From: Andrea Amorese Date: Tue, 31 Aug 2021 09:39:57 +0000 (+0200) Subject: Built motion from commit 8322a8b8.|2.5.34 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:;/%22?a=commitdiff_plain;h=94f6dd65d109271ee5aa18c70ef6f5045eabf7f0;p=motion2.git Built motion from commit 8322a8b8.|2.5.34 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 2fdaa93..a629e3e 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-08-31T09:18:32.852Z", + "time": "2021-08-31T09:29:41.041Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index aa246f0..c4db96f 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-08-31T09:18:32.852Z", + "time": "2021-08-31T09:29:41.041Z", "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 8c20875..84c8c55 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 _0x39e6=['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[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','VIRTUAL','action','STRING','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'];(function(_0x1a028b,_0x2254cd){var _0x1da227=function(_0x2ce4d3){while(--_0x2ce4d3){_0x1a028b['push'](_0x1a028b['shift']());}};_0x1da227(++_0x2254cd);}(_0x39e6,0x9e));var _0x639e=function(_0x49fd3f,_0x1f0be1){_0x49fd3f=_0x49fd3f-0x0;var _0x243538=_0x39e6[_0x49fd3f];return _0x243538;};'use strict';var Sequelize=require(_0x639e('0x0'));module['exports']={'name':{'type':Sequelize[_0x639e('0x1')],'get':function(_0x5719fc){return this['getDataValue'](_0x639e('0x2'));}},'action':{'type':Sequelize[_0x639e('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x639e('0x4'),_0x639e('0x5'),_0x639e('0x6'),_0x639e('0x7'),_0x639e('0x8'),_0x639e('0x9'),_0x639e('0xa')]],'msg':_0x639e('0xb')}},'comment':_0x639e('0xb')},'data1':{'type':Sequelize[_0x639e('0x3')](0x1000),'comment':_0x639e('0xc')},'data2':{'type':Sequelize[_0x639e('0x3')](0x1000),'comment':_0x639e('0xd')},'data3':{'type':Sequelize[_0x639e('0x3')](0x1000),'comment':_0x639e('0xe')},'data4':{'type':Sequelize[_0x639e('0x3')](0x1000),'comments':_0x639e('0xf')},'data5':{'type':Sequelize[_0x639e('0x3')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth]'},'data6':{'type':Sequelize['STRING'],'comments':_0x639e('0x10')},'data7':{'type':Sequelize[_0x639e('0x11')],'comments':_0x639e('0x12')}}; \ No newline at end of file +var _0x9536=['action','contactManager','integration','motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL'];(function(_0x477a8a,_0x3e248a){var _0x16529b=function(_0x206ae6){while(--_0x206ae6){_0x477a8a['push'](_0x477a8a['shift']());}};_0x16529b(++_0x3e248a);}(_0x9536,0x179));var _0x6953=function(_0x10c51f,_0x11270f){_0x10c51f=_0x10c51f-0x0;var _0x56a0cd=_0x9536[_0x10c51f];return _0x56a0cd;};'use strict';var Sequelize=require(_0x6953('0x0'));module[_0x6953('0x1')]={'name':{'type':Sequelize[_0x6953('0x2')],'get':function(_0x40b3c3){return this['getDataValue'](_0x6953('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x6953('0x4'),_0x6953('0x5'),_0x6953('0x6'),_0x6953('0x7'),_0x6953('0x8'),'browser',_0x6953('0x9'),_0x6953('0xa')]],'msg':_0x6953('0xb')}},'comment':_0x6953('0xb')},'data1':{'type':Sequelize[_0x6953('0xc')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x6953('0xc')](0x1000),'comment':_0x6953('0xd')},'data3':{'type':Sequelize[_0x6953('0xc')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x6953('0xc')](0x1000),'comments':_0x6953('0xe')},'data5':{'type':Sequelize[_0x6953('0xc')](0x1000),'comments':_0x6953('0xf')},'data6':{'type':Sequelize[_0x6953('0xc')],'comments':_0x6953('0x10')},'data7':{'type':Sequelize[_0x6953('0x11')],'comments':_0x6953('0x12')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index bfdcc21..cdeb96f 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 _0x599e=['sendStatus','error','name','body','Action','find','params','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then'];(function(_0x54d771,_0x156160){var _0x1f12a0=function(_0x15c5a3){while(--_0x15c5a3){_0x54d771['push'](_0x54d771['shift']());}};_0x1f12a0(++_0x156160);}(_0x599e,0x1df));var _0xe599=function(_0x392fa7,_0x46b1eb){_0x392fa7=_0x392fa7-0x0;var _0x1b8d51=_0x599e[_0x392fa7];return _0x1b8d51;};'use strict';var emlformat=require(_0xe599('0x0'));var rimraf=require(_0xe599('0x1'));var zipdir=require(_0xe599('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe599('0x3'));var moment=require(_0xe599('0x4'));var BPromise=require(_0xe599('0x5'));var Mustache=require(_0xe599('0x6'));var util=require(_0xe599('0x7'));var path=require(_0xe599('0x8'));var sox=require(_0xe599('0x9'));var csv=require(_0xe599('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe599('0xb'));var squel=require(_0xe599('0xc'));var crypto=require(_0xe599('0xd'));var jsforce=require(_0xe599('0xe'));var deskjs=require(_0xe599('0xf'));var toCsv=require(_0xe599('0xa'));var querystring=require(_0xe599('0x10'));var Papa=require(_0xe599('0x11'));var Redis=require('ioredis');var authService=require(_0xe599('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe599('0x13'));var hardwareService=require(_0xe599('0x14'));var logger=require(_0xe599('0x15'))('api');var utils=require(_0xe599('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe599('0x17'));var db=require(_0xe599('0x18'))['db'];function respondWithStatusCode(_0x540a64,_0x12c55f){_0x12c55f=_0x12c55f||0xcc;return function(_0x1acd70){if(_0x1acd70){return _0x540a64['sendStatus'](_0x12c55f);}return _0x540a64['status'](_0x12c55f)[_0xe599('0x19')]();};}function respondWithResult(_0xc87582,_0x428582){_0x428582=_0x428582||0xc8;return function(_0xa51b41){if(_0xa51b41){return _0xc87582[_0xe599('0x1a')](_0x428582)[_0xe599('0x1b')](_0xa51b41);}};}function respondWithFilteredResult(_0x1effa6,_0x478cfa){return function(_0x154088){if(_0x154088){var _0x4f96e7=typeof _0x478cfa[_0xe599('0x1c')]===_0xe599('0x1d')&&typeof _0x478cfa[_0xe599('0x1e')]===_0xe599('0x1d');var _0xed17d1=_0x154088[_0xe599('0x1f')];var _0x6fdb6b=_0x4f96e7?0x0:_0x478cfa[_0xe599('0x1c')];var _0x32bdf0=_0x4f96e7?_0x154088[_0xe599('0x1f')]:_0x478cfa[_0xe599('0x1c')]+_0x478cfa[_0xe599('0x1e')];var _0x1a8247;if(_0x32bdf0>=_0xed17d1){_0x32bdf0=_0xed17d1;_0x1a8247=0xc8;}else{_0x1a8247=0xce;}_0x1effa6[_0xe599('0x1a')](_0x1a8247);return _0x1effa6[_0xe599('0x20')](_0xe599('0x21'),_0x6fdb6b+'-'+_0x32bdf0+'/'+_0xed17d1)[_0xe599('0x1b')](_0x154088);}return null;};}function patchUpdates(_0x35b4a8){return function(_0x62b742){try{jsonpatch[_0xe599('0x22')](_0x62b742,_0x35b4a8,!![]);}catch(_0x2da140){return BPromise['reject'](_0x2da140);}return _0x62b742[_0xe599('0x23')]();};}function saveUpdates(_0xba8ab8,_0x4d9111){return function(_0x10c988){if(_0x10c988){return _0x10c988[_0xe599('0x24')](_0xba8ab8)[_0xe599('0x25')](function(_0x31d575){return _0x31d575;});}return null;};}function removeEntity(_0xe4c6ca,_0x1b4670){return function(_0x11813b){if(_0x11813b){return _0x11813b['destroy']()[_0xe599('0x25')](function(){_0xe4c6ca[_0xe599('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5abaf2,_0x491a6a){return function(_0x58c2a9){if(!_0x58c2a9){_0x5abaf2[_0xe599('0x26')](0x194);}return _0x58c2a9;};}function handleError(_0x5091d6,_0x1ab0cf){_0x1ab0cf=_0x1ab0cf||0x1f4;return function(_0x54c5b6){logger[_0xe599('0x27')](_0x54c5b6['stack']);if(_0x54c5b6[_0xe599('0x28')]){delete _0x54c5b6[_0xe599('0x28')];}_0x5091d6['status'](_0x1ab0cf)['send'](_0x54c5b6);};}exports[_0xe599('0x24')]=function(_0x57253e,_0x363d9c){if(_0x57253e['body']['id']){delete _0x57253e[_0xe599('0x29')]['id'];}return db[_0xe599('0x2a')][_0xe599('0x2b')]({'where':{'id':_0x57253e[_0xe599('0x2c')]['id']}})['then'](handleEntityNotFound(_0x363d9c,null))[_0xe599('0x25')](saveUpdates(_0x57253e['body'],null))[_0xe599('0x25')](respondWithResult(_0x363d9c,null))[_0xe599('0x2d')](handleError(_0x363d9c,null));};exports[_0xe599('0x2e')]=function(_0x27ace4,_0x22a742){return db[_0xe599('0x2a')][_0xe599('0x2b')]({'where':{'id':_0x27ace4[_0xe599('0x2c')]['id']}})[_0xe599('0x25')](handleEntityNotFound(_0x22a742,null))[_0xe599('0x25')](removeEntity(_0x22a742,null))[_0xe599('0x2d')](handleError(_0x22a742,null));}; \ No newline at end of file +var _0xb0d9=['save','then','destroy','error','stack','name','update','body','Action','find','params','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','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/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x2d9535,_0x4bc592){var _0xb4e710=function(_0x50b9a9){while(--_0x50b9a9){_0x2d9535['push'](_0x2d9535['shift']());}};_0xb4e710(++_0x4bc592);}(_0xb0d9,0xcc));var _0x9b0d=function(_0x214d95,_0x1028e1){_0x214d95=_0x214d95-0x0;var _0x1faabc=_0xb0d9[_0x214d95];return _0x1faabc;};'use strict';var emlformat=require(_0x9b0d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9b0d('0x1'));var jsonpatch=require(_0x9b0d('0x2'));var rp=require(_0x9b0d('0x3'));var moment=require(_0x9b0d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9b0d('0x5'));var path=require(_0x9b0d('0x6'));var sox=require('sox');var csv=require(_0x9b0d('0x7'));var ejs=require(_0x9b0d('0x8'));var fs=require('fs');var fs_extra=require(_0x9b0d('0x9'));var _=require(_0x9b0d('0xa'));var squel=require(_0x9b0d('0xb'));var crypto=require(_0x9b0d('0xc'));var jsforce=require(_0x9b0d('0xd'));var deskjs=require(_0x9b0d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9b0d('0xf'));var Papa=require(_0x9b0d('0x10'));var Redis=require(_0x9b0d('0x11'));var authService=require(_0x9b0d('0x12'));var qs=require(_0x9b0d('0x13'));var as=require(_0x9b0d('0x14'));var hardwareService=require(_0x9b0d('0x15'));var logger=require(_0x9b0d('0x16'))(_0x9b0d('0x17'));var utils=require('../../config/utils');var config=require(_0x9b0d('0x18'));var licenseUtil=require(_0x9b0d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47e846,_0x1df24c){_0x1df24c=_0x1df24c||0xcc;return function(_0x42e37b){if(_0x42e37b){return _0x47e846[_0x9b0d('0x1a')](_0x1df24c);}return _0x47e846[_0x9b0d('0x1b')](_0x1df24c)[_0x9b0d('0x1c')]();};}function respondWithResult(_0x11a6be,_0x23bda7){_0x23bda7=_0x23bda7||0xc8;return function(_0x38f0bb){if(_0x38f0bb){return _0x11a6be[_0x9b0d('0x1b')](_0x23bda7)['json'](_0x38f0bb);}};}function respondWithFilteredResult(_0x35b0cc,_0x4be02d){return function(_0x5a0afa){if(_0x5a0afa){var _0xcdcd9d=typeof _0x4be02d[_0x9b0d('0x1d')]===_0x9b0d('0x1e')&&typeof _0x4be02d['limit']===_0x9b0d('0x1e');var _0x7c6124=_0x5a0afa[_0x9b0d('0x1f')];var _0x29a11e=_0xcdcd9d?0x0:_0x4be02d['offset'];var _0x24a6c0=_0xcdcd9d?_0x5a0afa[_0x9b0d('0x1f')]:_0x4be02d[_0x9b0d('0x1d')]+_0x4be02d[_0x9b0d('0x20')];var _0x1b0cff;if(_0x24a6c0>=_0x7c6124){_0x24a6c0=_0x7c6124;_0x1b0cff=0xc8;}else{_0x1b0cff=0xce;}_0x35b0cc[_0x9b0d('0x1b')](_0x1b0cff);return _0x35b0cc[_0x9b0d('0x21')](_0x9b0d('0x22'),_0x29a11e+'-'+_0x24a6c0+'/'+_0x7c6124)['json'](_0x5a0afa);}return null;};}function patchUpdates(_0x5c4836){return function(_0x4c3c7a){try{jsonpatch[_0x9b0d('0x23')](_0x4c3c7a,_0x5c4836,!![]);}catch(_0x2efa0e){return BPromise['reject'](_0x2efa0e);}return _0x4c3c7a[_0x9b0d('0x24')]();};}function saveUpdates(_0x239f0a,_0x2e086c){return function(_0x6d6170){if(_0x6d6170){return _0x6d6170['update'](_0x239f0a)[_0x9b0d('0x25')](function(_0x2a43f9){return _0x2a43f9;});}return null;};}function removeEntity(_0xbef75,_0x514923){return function(_0x484076){if(_0x484076){return _0x484076[_0x9b0d('0x26')]()[_0x9b0d('0x25')](function(){_0xbef75[_0x9b0d('0x1b')](0xcc)[_0x9b0d('0x1c')]();});}};}function handleEntityNotFound(_0x16e10a,_0x88dcbe){return function(_0x42ae11){if(!_0x42ae11){_0x16e10a[_0x9b0d('0x1a')](0x194);}return _0x42ae11;};}function handleError(_0x568ef2,_0x3fa5d2){_0x3fa5d2=_0x3fa5d2||0x1f4;return function(_0xcad831){logger[_0x9b0d('0x27')](_0xcad831[_0x9b0d('0x28')]);if(_0xcad831[_0x9b0d('0x29')]){delete _0xcad831[_0x9b0d('0x29')];}_0x568ef2[_0x9b0d('0x1b')](_0x3fa5d2)['send'](_0xcad831);};}exports[_0x9b0d('0x2a')]=function(_0x342a9b,_0x515de4){if(_0x342a9b[_0x9b0d('0x2b')]['id']){delete _0x342a9b['body']['id'];}return db[_0x9b0d('0x2c')][_0x9b0d('0x2d')]({'where':{'id':_0x342a9b[_0x9b0d('0x2e')]['id']}})[_0x9b0d('0x25')](handleEntityNotFound(_0x515de4,null))[_0x9b0d('0x25')](saveUpdates(_0x342a9b[_0x9b0d('0x2b')],null))[_0x9b0d('0x25')](respondWithResult(_0x515de4,null))[_0x9b0d('0x2f')](handleError(_0x515de4,null));};exports['destroy']=function(_0x27610c,_0x1a6a2a){return db[_0x9b0d('0x2c')]['find']({'where':{'id':_0x27610c[_0x9b0d('0x2e')]['id']}})[_0x9b0d('0x25')](handleEntityNotFound(_0x1a6a2a,null))[_0x9b0d('0x25')](removeEntity(_0x1a6a2a,null))[_0x9b0d('0x2f')](handleError(_0x1a6a2a,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 7bde7bc..acd7824 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 _0xe698=['path','rimraf','../../config/environment','./action.attributes','exports','define','lodash','util','moment','bluebird','request-promise'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xe698,0x69));var _0x8e69=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe698[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8e69('0x0'));var util=require(_0x8e69('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8e69('0x2'));var BPromise=require(_0x8e69('0x3'));var rp=require(_0x8e69('0x4'));var fs=require('fs');var path=require(_0x8e69('0x5'));var rimraf=require(_0x8e69('0x6'));var config=require(_0x8e69('0x7'));var attributes=require(_0x8e69('0x8'));module[_0x8e69('0x9')]=function(_0x1d6979,_0x3aa1ff){return _0x1d6979[_0x8e69('0xa')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd15d=['bluebird','request-promise','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','moment'];(function(_0x3fe56a,_0x8afe77){var _0x5e3f42=function(_0x368455){while(--_0x368455){_0x3fe56a['push'](_0x3fe56a['shift']());}};_0x5e3f42(++_0x8afe77);}(_0xd15d,0xe1));var _0xdd15=function(_0x408706,_0x3a9d00){_0x408706=_0x408706-0x0;var _0x35cce9=_0xd15d[_0x408706];return _0x35cce9;};'use strict';var _=require(_0xdd15('0x0'));var util=require(_0xdd15('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdd15('0x2'));var BPromise=require(_0xdd15('0x3'));var rp=require(_0xdd15('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd15('0x5'));var config=require(_0xdd15('0x6'));var attributes=require(_0xdd15('0x7'));module[_0xdd15('0x8')]=function(_0x516e2e,_0x46b8d3){return _0x516e2e[_0xdd15('0x9')](_0xdd15('0xa'),attributes,{'tableName':_0xdd15('0xb'),'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 4b0c783..0f8c373 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x426384,_0x1901ab){var _0x3aa40a=function(_0x2db297){while(--_0x2db297){_0x426384['push'](_0x426384['shift']());}};_0x3aa40a(++_0x1901ab);}(_0x5fab,0x177));var _0xb5fa=function(_0x8a0140,_0x4a1b16){_0x8a0140=_0x8a0140-0x0;var _0x1be8a8=_0x5fab[_0x8a0140];return _0x1be8a8;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ 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(_0x51b41f,_0xb993e4){var _0x449755=function(_0x56c90b){while(--_0x56c90b){_0x51b41f['push'](_0x51b41f['shift']());}};_0x449755(++_0xb993e4);}(_0xabce,0x103));var _0xeabc=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0xabce[_0x4bb66f];return _0xf2772f;};'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 459b535..304b9c3 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 _0x0e37=['/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','update','delete'];(function(_0x5e3af6,_0x3c97dd){var _0x215aa8=function(_0x3adef5){while(--_0x3adef5){_0x5e3af6['push'](_0x5e3af6['shift']());}};_0x215aa8(++_0x3c97dd);}(_0x0e37,0xbd));var _0x70e3=function(_0x4c7136,_0x2ada46){_0x4c7136=_0x4c7136-0x0;var _0x3549a0=_0x0e37[_0x4c7136];return _0x3549a0;};'use strict';var multer=require(_0x70e3('0x0'));var util=require(_0x70e3('0x1'));var path=require(_0x70e3('0x2'));var timeout=require(_0x70e3('0x3'));var express=require(_0x70e3('0x4'));var router=express[_0x70e3('0x5')]();var fs_extra=require(_0x70e3('0x6'));var auth=require(_0x70e3('0x7'));var interaction=require(_0x70e3('0x8'));var config=require(_0x70e3('0x9'));var controller=require(_0x70e3('0xa'));router[_0x70e3('0xb')]('/:id',auth[_0x70e3('0xc')](),controller[_0x70e3('0xd')]);router[_0x70e3('0xe')](_0x70e3('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x70e3('0x10')]=router; \ No newline at end of file +var _0x8adf=['./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x8adf,0x18f));var _0xf8ad=function(_0x20b404,_0x15a121){_0x20b404=_0x20b404-0x0;var _0x36c3d1=_0x8adf[_0x20b404];return _0x36c3d1;};'use strict';var multer=require(_0xf8ad('0x0'));var util=require(_0xf8ad('0x1'));var path=require(_0xf8ad('0x2'));var timeout=require(_0xf8ad('0x3'));var express=require(_0xf8ad('0x4'));var router=express[_0xf8ad('0x5')]();var fs_extra=require(_0xf8ad('0x6'));var auth=require(_0xf8ad('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf8ad('0x8'));var controller=require(_0xf8ad('0x9'));router[_0xf8ad('0xa')](_0xf8ad('0xb'),auth[_0xf8ad('0xc')](),controller[_0xf8ad('0xd')]);router[_0xf8ad('0xe')](_0xf8ad('0xb'),auth[_0xf8ad('0xc')](),controller[_0xf8ad('0xf')]);module[_0xf8ad('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index b637131..686b8bd 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 _0xabce=['exports','STRING','TEXT','sequelize'];(function(_0x3ead99,_0x2a6278){var _0x2c29e7=function(_0x15cd43){while(--_0x15cd43){_0x3ead99['push'](_0x3ead99['shift']());}};_0x2c29e7(++_0x2a6278);}(_0xabce,0x103));var _0xeabc=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xabce[_0x4bfac3];return _0x15f0f2;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeabc('0x2')]},'parent':{'type':Sequelize[_0xeabc('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xeabc('0x3')]}}; \ No newline at end of file +var _0xc4aa=['STRING','sequelize','exports'];(function(_0x4bf9ea,_0x422763){var _0x29ecc7=function(_0x2742d2){while(--_0x2742d2){_0x4bf9ea['push'](_0x4bf9ea['shift']());}};_0x29ecc7(++_0x422763);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc4aa[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xac4a('0x2')]},'parent':{'type':Sequelize[_0xac4a('0x2')]},'table':{'type':Sequelize[_0xac4a('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index d0b6632..65fac05 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 _0xe550=['keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','IS\x20EMPTY','getFields','%s-%s.%s','randomstring','output','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','IS\x20NOT\x20NULL','operator','clone','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','AnalyticCustomReport','rawAttributes','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','CustomReports','update','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)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric'];(function(_0x35fbfb,_0x62a6af){var _0x247285=function(_0x4780d2){while(--_0x4780d2){_0x35fbfb['push'](_0x35fbfb['shift']());}};_0x247285(++_0x62a6af);}(_0xe550,0x18e));var _0x0e55=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe550[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x0e55('0x0'));var rimraf=require(_0x0e55('0x1'));var zipdir=require(_0x0e55('0x2'));var jsonpatch=require(_0x0e55('0x3'));var rp=require(_0x0e55('0x4'));var moment=require('moment');var BPromise=require(_0x0e55('0x5'));var Mustache=require(_0x0e55('0x6'));var util=require(_0x0e55('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x0e55('0x8'));var ejs=require(_0x0e55('0x9'));var fs=require('fs');var fs_extra=require(_0x0e55('0xa'));var _=require(_0x0e55('0xb'));var squel=require(_0x0e55('0xc'));var crypto=require(_0x0e55('0xd'));var jsforce=require(_0x0e55('0xe'));var deskjs=require(_0x0e55('0xf'));var toCsv=require(_0x0e55('0x8'));var querystring=require(_0x0e55('0x10'));var Papa=require(_0x0e55('0x11'));var Redis=require(_0x0e55('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0e55('0x13'));var as=require(_0x0e55('0x14'));var hardwareService=require(_0x0e55('0x15'));var logger=require(_0x0e55('0x16'))(_0x0e55('0x17'));var utils=require(_0x0e55('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0e55('0x19'));var db=require('../../mysqldb')['db'];var dbH=require(_0x0e55('0x1a'))['dbH'];function respondWithStatusCode(_0x27cb53,_0x302666){_0x302666=_0x302666||0xcc;return function(_0x100a54){if(_0x100a54){return _0x27cb53[_0x0e55('0x1b')](_0x302666);}return _0x27cb53['status'](_0x302666)[_0x0e55('0x1c')]();};}function respondWithResult(_0x157155,_0x46a43f){_0x46a43f=_0x46a43f||0xc8;return function(_0x2fccc5){if(_0x2fccc5){return _0x157155[_0x0e55('0x1d')](_0x46a43f)[_0x0e55('0x1e')](_0x2fccc5);}};}function respondWithFilteredResult(_0xe82e0f,_0x5d1c88){return function(_0x9002ab){if(_0x9002ab){var _0x93a4a9=typeof _0x5d1c88['offset']===_0x0e55('0x1f')&&typeof _0x5d1c88[_0x0e55('0x20')]===_0x0e55('0x1f');var _0xe3d864=_0x9002ab['count'];var _0x4cc9fd=_0x93a4a9?0x0:_0x5d1c88['offset'];var _0x3841e1=_0x93a4a9?_0x9002ab[_0x0e55('0x21')]:_0x5d1c88[_0x0e55('0x22')]+_0x5d1c88[_0x0e55('0x20')];var _0x165e2b;if(_0x3841e1>=_0xe3d864){_0x3841e1=_0xe3d864;_0x165e2b=0xc8;}else{_0x165e2b=0xce;}_0xe82e0f['status'](_0x165e2b);return _0xe82e0f[_0x0e55('0x23')](_0x0e55('0x24'),_0x4cc9fd+'-'+_0x3841e1+'/'+_0xe3d864)[_0x0e55('0x1e')](_0x9002ab);}return null;};}function patchUpdates(_0x12ceb3){return function(_0x391e7a){try{jsonpatch[_0x0e55('0x25')](_0x391e7a,_0x12ceb3,!![]);}catch(_0xa08a3b){return BPromise[_0x0e55('0x26')](_0xa08a3b);}return _0x391e7a[_0x0e55('0x27')]();};}function saveUpdates(_0x3f3503,_0x521f2b){return function(_0x7727e2){if(_0x7727e2){return _0x7727e2['update'](_0x3f3503)[_0x0e55('0x28')](function(_0x35d59f){return _0x35d59f;});}return null;};}function removeEntity(_0x5380f4,_0x1fc3fb){return function(_0x2227cc){if(_0x2227cc){return _0x2227cc[_0x0e55('0x29')]()[_0x0e55('0x28')](function(){var _0x46a05c=_0x2227cc[_0x0e55('0x2a')]({'plain':!![]});var _0x39c694='CustomReports';return db[_0x0e55('0x2b')][_0x0e55('0x29')]({'where':{'type':_0x39c694,'resourceId':_0x46a05c['id']}})[_0x0e55('0x28')](function(){return _0x2227cc;});})[_0x0e55('0x28')](function(){_0x5380f4[_0x0e55('0x1d')](0xcc)[_0x0e55('0x1c')]();});}};}function handleEntityNotFound(_0x3aae44,_0x5bae7c){return function(_0x2634c1){if(!_0x2634c1){_0x3aae44[_0x0e55('0x1b')](0x194);}return _0x2634c1;};}function handleError(_0x9636c9,_0x4f47f8){_0x4f47f8=_0x4f47f8||0x1f4;return function(_0x2f346c){logger[_0x0e55('0x2c')](_0x2f346c[_0x0e55('0x2d')]);if(_0x2f346c[_0x0e55('0x2e')]){delete _0x2f346c[_0x0e55('0x2e')];}_0x9636c9['status'](_0x4f47f8)['send'](_0x2f346c);};}exports[_0x0e55('0x2f')]=function(_0x29754f,_0x201451){var _0x434206={},_0x33e6cf={},_0x95f7b1={'count':0x0,'rows':[]};var _0x588c09=_['map'](db[_0x0e55('0x30')][_0x0e55('0x31')],function(_0x3e36b9){return{'name':_0x3e36b9['fieldName'],'type':_0x3e36b9[_0x0e55('0x32')][_0x0e55('0x33')]};});_0x33e6cf['model']=_[_0x0e55('0x34')](_0x588c09,_0x0e55('0x2e'));_0x33e6cf['query']=_[_0x0e55('0x35')](_0x29754f[_0x0e55('0x36')]);_0x33e6cf[_0x0e55('0x37')]=_[_0x0e55('0x38')](_0x33e6cf[_0x0e55('0x39')],_0x33e6cf['query']);_0x434206[_0x0e55('0x3a')]=_[_0x0e55('0x38')](_0x33e6cf[_0x0e55('0x39')],qs[_0x0e55('0x3b')](_0x29754f[_0x0e55('0x36')]['fields']));_0x434206[_0x0e55('0x3a')]=_0x434206[_0x0e55('0x3a')][_0x0e55('0x3c')]?_0x434206[_0x0e55('0x3a')]:_0x33e6cf['model'];if(!_0x29754f[_0x0e55('0x36')][_0x0e55('0x3d')](_0x0e55('0x3e'))){_0x434206[_0x0e55('0x20')]=qs[_0x0e55('0x20')](_0x29754f[_0x0e55('0x36')][_0x0e55('0x20')]);_0x434206[_0x0e55('0x22')]=qs['offset'](_0x29754f['query'][_0x0e55('0x22')]);}_0x434206[_0x0e55('0x3f')]=qs[_0x0e55('0x40')](_0x29754f[_0x0e55('0x36')][_0x0e55('0x40')]);_0x434206['where']=qs[_0x0e55('0x37')](_[_0x0e55('0x41')](_0x29754f['query'],_0x33e6cf['filters']),_0x588c09);if(_0x29754f[_0x0e55('0x36')][_0x0e55('0x42')]){_0x434206['where']=_[_0x0e55('0x43')](_0x434206[_0x0e55('0x44')],{'$or':_[_0x0e55('0x34')](_0x588c09,function(_0x490f6e){if(_0x490f6e[_0x0e55('0x32')]!==_0x0e55('0x45')){var _0x14a30a={};_0x14a30a[_0x490f6e['name']]={'$like':'%'+_0x29754f[_0x0e55('0x36')][_0x0e55('0x42')]+'%'};return _0x14a30a;}})});}_0x434206=_['merge']({},_0x434206,_0x29754f[_0x0e55('0x46')]);var _0x34e53a={'where':_0x434206[_0x0e55('0x44')]};return db[_0x0e55('0x30')][_0x0e55('0x21')](_0x34e53a)[_0x0e55('0x28')](function(_0x22c4a7){_0x95f7b1[_0x0e55('0x21')]=_0x22c4a7;if(_0x29754f['query'][_0x0e55('0x47')]){_0x434206[_0x0e55('0x48')]=[{'all':!![]}];}return db[_0x0e55('0x30')][_0x0e55('0x49')](_0x434206);})[_0x0e55('0x28')](function(_0x36752f){_0x95f7b1[_0x0e55('0x4a')]=_0x36752f;return _0x95f7b1;})[_0x0e55('0x28')](respondWithFilteredResult(_0x201451,_0x434206))[_0x0e55('0x4b')](handleError(_0x201451,null));};exports[_0x0e55('0x4c')]=function(_0x3dad73,_0x5db42a){var _0x2d3bfa={'raw':![],'where':{'id':_0x3dad73[_0x0e55('0x4d')]['id']}},_0x1f0de1={};_0x1f0de1['model']=_[_0x0e55('0x35')](db['AnalyticCustomReport'][_0x0e55('0x31')]);_0x1f0de1[_0x0e55('0x36')]=_[_0x0e55('0x35')](_0x3dad73[_0x0e55('0x36')]);_0x1f0de1[_0x0e55('0x37')]=_[_0x0e55('0x38')](_0x1f0de1[_0x0e55('0x39')],_0x1f0de1[_0x0e55('0x36')]);_0x2d3bfa[_0x0e55('0x3a')]=_[_0x0e55('0x38')](_0x1f0de1[_0x0e55('0x39')],qs[_0x0e55('0x3b')](_0x3dad73[_0x0e55('0x36')][_0x0e55('0x3b')]));_0x2d3bfa[_0x0e55('0x3a')]=_0x2d3bfa['attributes'][_0x0e55('0x3c')]?_0x2d3bfa[_0x0e55('0x3a')]:_0x1f0de1[_0x0e55('0x39')];if(_0x3dad73[_0x0e55('0x36')][_0x0e55('0x47')]){_0x2d3bfa['include']=[{'all':!![]}];}_0x2d3bfa=_[_0x0e55('0x43')]({},_0x2d3bfa,_0x3dad73[_0x0e55('0x46')]);return db['AnalyticCustomReport'][_0x0e55('0x4e')](_0x2d3bfa)[_0x0e55('0x28')](handleEntityNotFound(_0x5db42a,null))['then'](respondWithResult(_0x5db42a,null))[_0x0e55('0x4b')](handleError(_0x5db42a,null));};exports[_0x0e55('0x4f')]=function(_0x4d425f,_0x2c10f3){return db['AnalyticCustomReport'][_0x0e55('0x4f')](_0x4d425f[_0x0e55('0x50')],{})[_0x0e55('0x28')](function(_0x1c08fb){var _0x291280=_0x4d425f[_0x0e55('0x51')][_0x0e55('0x2a')]({'plain':!![]});if(!_0x291280)throw new Error(_0x0e55('0x52'));if(_0x291280['role']==='user'){var _0x44d786=_0x1c08fb['get']({'plain':!![]});var _0x3e8350=_0x0e55('0x53');return db[_0x0e55('0x54')]['find']({'where':{'name':_0x3e8350,'userProfileId':_0x291280['userProfileId']},'raw':!![]})[_0x0e55('0x28')](function(_0x4f207a){if(_0x4f207a&&_0x4f207a[_0x0e55('0x55')]===0x0){return db[_0x0e55('0x2b')][_0x0e55('0x4f')]({'name':_0x44d786[_0x0e55('0x2e')],'resourceId':_0x44d786['id'],'type':_0x0e55('0x56'),'sectionId':_0x4f207a['id']},{})[_0x0e55('0x28')](function(){return _0x1c08fb;});}else{return _0x1c08fb;}})['catch'](function(_0x503098){logger[_0x0e55('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x503098);throw _0x503098;});}return _0x1c08fb;})['then'](respondWithResult(_0x2c10f3,0xc9))['catch'](handleError(_0x2c10f3,null));};exports[_0x0e55('0x57')]=function(_0xfe97b6,_0x44a84e){if(_0xfe97b6[_0x0e55('0x50')]['id']){delete _0xfe97b6[_0x0e55('0x50')]['id'];}return db['AnalyticCustomReport'][_0x0e55('0x4e')]({'where':{'id':_0xfe97b6[_0x0e55('0x4d')]['id']}})[_0x0e55('0x28')](handleEntityNotFound(_0x44a84e,null))[_0x0e55('0x28')](saveUpdates(_0xfe97b6[_0x0e55('0x50')],null))['then'](respondWithResult(_0x44a84e,null))['catch'](handleError(_0x44a84e,null));};exports['destroy']=function(_0x1524fe,_0x5aff59){return db[_0x0e55('0x30')][_0x0e55('0x4e')]({'where':{'id':_0x1524fe[_0x0e55('0x4d')]['id']}})[_0x0e55('0x28')](handleEntityNotFound(_0x5aff59,null))[_0x0e55('0x28')](removeEntity(_0x5aff59,null))[_0x0e55('0x4b')](handleError(_0x5aff59,null));};exports[_0x0e55('0x58')]=function(_0x332153,_0x4fa308){var _0x42717e=0xa;var _0x4c7f97=[_0x0e55('0x59'),_0x0e55('0x5a'),_0x0e55('0x5b'),_0x0e55('0x5c')];var _0x5c2a0d={'SUM':_0x0e55('0x5d'),'COUNT':_0x0e55('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x0e55('0x5f'),'MIN':_0x0e55('0x60'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x0e55('0x61'),'GROUP_CONCAT ASC':_0x0e55('0x62'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x314ff3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x0e55('0x63'),'HOUR':_0x0e55('0x64'),'ROUND':_0x0e55('0x65'),'UNIX_TIMESTAMP':_0x0e55('0x66')};var _0x49c982=function(_0x84aaa2){return!_[_0x0e55('0x67')]([_0x0e55('0x68'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x0e55('0x69')],_0x84aaa2);};var _0x4e7a7d=function(_0x5ac1f8){if(!_0x5ac1f8||!_0x5ac1f8[_0x0e55('0x6a')][_0x0e55('0x3c')]){return'';}for(var _0x259fea='(',_0x3f5031=0x0;_0x3f5031<_0x5ac1f8['rules']['length'];_0x3f5031+=0x1){_0x3f5031>0x0&&(_0x259fea+='\x20'+_0x5ac1f8['operator']+'\x20');_0x259fea+=_0x5ac1f8[_0x0e55('0x6a')][_0x3f5031]['group']?_0x4e7a7d(_0x5ac1f8[_0x0e55('0x6a')][_0x3f5031][_0x0e55('0x6b')]):_0x5ac1f8['rules'][_0x3f5031][_0x0e55('0x6c')]+'\x20'+_0x5ac1f8[_0x0e55('0x6a')][_0x3f5031][_0x0e55('0x6d')]+(_0x49c982(_0x5ac1f8[_0x0e55('0x6a')][_0x3f5031]['condition'])?'\x20'+_0x5ac1f8['rules'][_0x3f5031][_0x0e55('0x6e')]:'');}return _0x259fea+')';};var _0x5d3232={'where':{'id':_0x332153[_0x0e55('0x4d')]['id']}},_0x3b50ed,_0x28607c,_0x58d804,_0x55eb9e,_0x22489f;_0x5d3232=_[_0x0e55('0x43')]({},_0x5d3232,_0x332153['options']);return db['AnalyticCustomReport'][_0x0e55('0x4e')](_0x5d3232)[_0x0e55('0x28')](function(_0x5a2fe2){if(_0x5a2fe2){_0x3b50ed=_0x5a2fe2;return _0x5a2fe2['getFields']();}return null;})['then'](function(_0x29c469){if(_0x29c469){if(!_0x29c469[_0x0e55('0x3c')]){throw new db[(_0x0e55('0x6f'))][(_0x0e55('0x70'))](_0x0e55('0x71'),0x193);}_0x28607c=_0x29c469;return db[_0x0e55('0x72')]['findAll']({'raw':!![]});}return null;})[_0x0e55('0x28')](function(_0x260ded){if(_0x260ded){_0x58d804=_[_0x0e55('0x73')](_0x260ded,'id');var _0x4330e7;var _0x508900=squel[_0x0e55('0x74')]();_0x508900[_0x0e55('0x75')](_0x3b50ed[_0x0e55('0x76')]);for(var _0x16e73a=0x0;_0x16e73a<_0x28607c[_0x0e55('0x3c')];_0x16e73a+=0x1){_0x4330e7=_0x28607c[_0x16e73a]['MetricId']?_0x58d804[_0x28607c[_0x16e73a][_0x0e55('0x77')]][_0x0e55('0x78')]:_0x28607c[_0x16e73a][_0x0e55('0x6c')];_0x4330e7=_0x28607c[_0x16e73a][_0x0e55('0x79')]?_[_0x0e55('0x7a')](_0x5c2a0d[_0x28607c[_0x16e73a][_0x0e55('0x79')]],'%s',_0x4330e7):_0x4330e7;_0x4330e7=_0x28607c[_0x16e73a][_0x0e55('0x7b')]?_[_0x0e55('0x7a')](_0x314ff3[_0x28607c[_0x16e73a][_0x0e55('0x7b')]],'%s',_0x4330e7):_0x4330e7;if(_0x28607c[_0x16e73a][_0x0e55('0x7c')]){_0x508900['group'](_0x4330e7);}_0x28607c[_0x16e73a]['orderBy']&&_0x508900['order'](_0x4330e7,_0x28607c[_0x16e73a][_0x0e55('0x7d')]===_0x0e55('0x7e')?![]:!![]);_0x508900[_0x0e55('0x6c')](_0x4330e7,_0x28607c[_0x16e73a][_0x0e55('0x7f')]||_0x4330e7);}if(_0x3b50ed[_0x0e55('0x80')]){_0x3b50ed['joins']=JSON[_0x0e55('0x81')](_0x3b50ed['joins']);for(var _0x37ed79=0x0;_0x37ed79<_0x3b50ed[_0x0e55('0x80')][_0x0e55('0x3c')];_0x37ed79+=0x1){if(_0x3b50ed[_0x0e55('0x80')][_0x37ed79][_0x0e55('0x32')]&&_[_0x0e55('0x67')](_0x4c7f97,_0x3b50ed['joins'][_0x37ed79][_0x0e55('0x32')])&&_0x3b50ed['joins'][_0x37ed79][_0x0e55('0x82')]&&_0x3b50ed[_0x0e55('0x80')][_0x37ed79][_0x0e55('0x83')]&&_0x3b50ed['joins'][_0x37ed79][_0x0e55('0x84')]){_0x508900[_0x3b50ed[_0x0e55('0x80')][_0x37ed79]['type']](_0x3b50ed[_0x0e55('0x80')][_0x37ed79]['foreignTable'],null,util[_0x0e55('0x7b')](_0x0e55('0x85'),_0x3b50ed[_0x0e55('0x76')],_0x3b50ed[_0x0e55('0x80')][_0x37ed79][_0x0e55('0x82')],_0x3b50ed[_0x0e55('0x80')][_0x37ed79]['foreignTable'],_0x3b50ed['joins'][_0x37ed79]['foreignKey']));}}}if(_0x3b50ed['conditions']){_0x3b50ed[_0x0e55('0x86')]=JSON['parse'](_0x3b50ed[_0x0e55('0x86')]);_0x508900[_0x0e55('0x44')](_0x4e7a7d(_0x3b50ed[_0x0e55('0x86')][_0x0e55('0x6b')]));}_0x22489f=_0x508900['clone']();_0x508900[_0x0e55('0x20')](_0x42717e);_0x508900[_0x0e55('0x22')](0x0);logger[_0x0e55('0x87')](_0x0e55('0x88'),_0x508900[_0x0e55('0x89')]());return dbH[_0x0e55('0x8a')][_0x0e55('0x36')](_0x508900['toString'](),{'type':dbH['sequelize'][_0x0e55('0x8b')][_0x0e55('0x8c')]});}})[_0x0e55('0x28')](respondWithResult(_0x4fa308,null))[_0x0e55('0x4b')](handleError(_0x4fa308,null));};function runReport(_0x337ed1,_0x4f2557,_0x1079c8){var _0x941caa=_0x4f2557[_0x0e55('0x2e')];var _0x34fea9=0xa;var _0x402f53=[_0x0e55('0x59'),_0x0e55('0x5a'),_0x0e55('0x5b'),_0x0e55('0x5c')];var _0x2b7818={'SUM':_0x0e55('0x5d'),'COUNT':_0x0e55('0x5e'),'COUNT DISTINCT':_0x0e55('0x8d'),'MAX':_0x0e55('0x5f'),'MIN':'MIN(%s)','AVG':_0x0e55('0x8e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x0e55('0x8f')};var _0x25186a={'SEC_TO_TIME':_0x0e55('0x90'),'DATE':_0x0e55('0x63'),'HOUR':_0x0e55('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x0e55('0x66')};var _0x2ef209=function(_0x351d4e){return!_[_0x0e55('0x67')]([_0x0e55('0x68'),'IS\x20NOT\x20NULL',_0x0e55('0x91'),'IS\x20NOT\x20EMPTY'],_0x351d4e);};var _0x147212=function(_0xef3db6){if(!_0xef3db6||!_0xef3db6[_0x0e55('0x6a')][_0x0e55('0x3c')]){return'';}for(var _0x1226c5='(',_0x39b46b=0x0;_0x39b46b<_0xef3db6['rules'][_0x0e55('0x3c')];_0x39b46b+=0x1){_0x39b46b>0x0&&(_0x1226c5+='\x20'+_0xef3db6['operator']+'\x20');_0x1226c5+=_0xef3db6[_0x0e55('0x6a')][_0x39b46b][_0x0e55('0x6b')]?_0x147212(_0xef3db6['rules'][_0x39b46b][_0x0e55('0x6b')]):_0xef3db6[_0x0e55('0x6a')][_0x39b46b]['field']+'\x20'+_0xef3db6['rules'][_0x39b46b]['condition']+(_0x2ef209(_0xef3db6[_0x0e55('0x6a')][_0x39b46b][_0x0e55('0x6d')])?'\x20'+_0xef3db6[_0x0e55('0x6a')][_0x39b46b][_0x0e55('0x6e')]:'');}return _0x1226c5+')';};var _0x4876ad={'where':{'id':_0x337ed1['id']}},_0x61fd9d,_0x1063b3,_0x463f52,_0x594a23,_0x1d4e1b;_0x4876ad=_['merge']({},_0x4876ad,_0x1079c8);return db[_0x0e55('0x30')][_0x0e55('0x4e')](_0x4876ad)[_0x0e55('0x28')](function(_0x2afecc){if(_0x2afecc){_0x61fd9d=_0x2afecc;return _0x2afecc[_0x0e55('0x92')]();}return null;})[_0x0e55('0x28')](function(_0x36b68e){if(_0x36b68e){if(!_0x36b68e['length']){throw new db[(_0x0e55('0x6f'))][(_0x0e55('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1063b3=_0x36b68e;return db[_0x0e55('0x72')][_0x0e55('0x49')]({'raw':!![]});}return null;})['then'](function(_0xb8cecb){if(_0xb8cecb){_0x463f52=_['keyBy'](_0xb8cecb,'id');var _0x224103;var _0x4f92bd=squel[_0x0e55('0x74')]();_0x4f92bd[_0x0e55('0x75')](_0x61fd9d[_0x0e55('0x76')]);for(var _0x221c88=0x0;_0x221c88<_0x1063b3[_0x0e55('0x3c')];_0x221c88+=0x1){_0x224103=_0x1063b3[_0x221c88]['MetricId']?_0x463f52[_0x1063b3[_0x221c88][_0x0e55('0x77')]][_0x0e55('0x78')]:_0x1063b3[_0x221c88][_0x0e55('0x6c')];_0x224103=_0x1063b3[_0x221c88][_0x0e55('0x79')]?_[_0x0e55('0x7a')](_0x2b7818[_0x1063b3[_0x221c88]['function']],'%s',_0x224103):_0x224103;_0x224103=_0x1063b3[_0x221c88][_0x0e55('0x7b')]?_[_0x0e55('0x7a')](_0x25186a[_0x1063b3[_0x221c88][_0x0e55('0x7b')]],'%s',_0x224103):_0x224103;if(_0x1063b3[_0x221c88][_0x0e55('0x7c')]){_0x4f92bd[_0x0e55('0x6b')](_0x224103);}_0x1063b3[_0x221c88]['orderBy']&&_0x4f92bd[_0x0e55('0x3f')](_0x224103,_0x1063b3[_0x221c88]['orderBy']===_0x0e55('0x7e')?![]:!![]);_0x4f92bd[_0x0e55('0x6c')](_0x224103,_0x1063b3[_0x221c88][_0x0e55('0x7f')]||_0x224103);}if(_0x61fd9d[_0x0e55('0x80')]){_0x61fd9d['joins']=JSON[_0x0e55('0x81')](_0x61fd9d['joins']);for(var _0x14f92b=0x0;_0x14f92b<_0x61fd9d['joins'][_0x0e55('0x3c')];_0x14f92b+=0x1){if(_0x61fd9d[_0x0e55('0x80')][_0x14f92b]['type']&&_['includes'](_0x402f53,_0x61fd9d[_0x0e55('0x80')][_0x14f92b]['type'])&&_0x61fd9d[_0x0e55('0x80')][_0x14f92b][_0x0e55('0x82')]&&_0x61fd9d['joins'][_0x14f92b][_0x0e55('0x83')]&&_0x61fd9d[_0x0e55('0x80')][_0x14f92b][_0x0e55('0x84')]){_0x4f92bd[_0x61fd9d[_0x0e55('0x80')][_0x14f92b][_0x0e55('0x32')]](_0x61fd9d[_0x0e55('0x80')][_0x14f92b]['foreignTable'],null,util[_0x0e55('0x7b')]('%s.%s\x20=\x20%s.%s',_0x61fd9d[_0x0e55('0x76')],_0x61fd9d[_0x0e55('0x80')][_0x14f92b][_0x0e55('0x82')],_0x61fd9d[_0x0e55('0x80')][_0x14f92b][_0x0e55('0x83')],_0x61fd9d['joins'][_0x14f92b]['foreignKey']));}}}if(_0x61fd9d[_0x0e55('0x86')]){_0x61fd9d[_0x0e55('0x86')]=JSON[_0x0e55('0x81')](_0x61fd9d[_0x0e55('0x86')]);_0x4f92bd[_0x0e55('0x44')](_0x147212(_0x61fd9d[_0x0e55('0x86')][_0x0e55('0x6b')]));}_0x1d4e1b=_0x4f92bd['clone']();_0x4f92bd[_0x0e55('0x20')](_0x34fea9);_0x4f92bd['offset'](0x0);return;}})[_0x0e55('0x28')](function(){if(_0x4f2557['output']==='web'){return null;}var _0x169d42=_[_0x0e55('0x43')](_0x4f2557,{'name':_0x4f2557['fullPath']||_0x4f2557[_0x0e55('0x2e')]||_0x61fd9d['name'],'basename':_0x941caa,'savename':util[_0x0e55('0x7b')](_0x0e55('0x93'),_0x4f2557[_0x0e55('0x2e')]||_0x61fd9d['name'],require(_0x0e55('0x94'))['generate'](0x4),_0x4f2557[_0x0e55('0x95')]||_0x0e55('0x96')),'reportId':_0x61fd9d['id'],'reportType':_0x0e55('0x97')});return db[_0x0e55('0x98')]['create'](_0x169d42,{'raw':!![]});})[_0x0e55('0x28')](function(_0x2be6f8){if(_0x61fd9d[_0x0e55('0x76')]===_0x0e55('0x99')){_0x1d4e1b[_0x0e55('0x44')](_0x61fd9d[_0x0e55('0x76')]+_0x0e55('0x9a'),_0x4f2557[_0x0e55('0x9b')],_0x4f2557[_0x0e55('0x9c')]);}else{_0x1d4e1b[_0x0e55('0x44')](_0x61fd9d['table']+_0x0e55('0x9d'),_0x4f2557[_0x0e55('0x9b')],_0x4f2557[_0x0e55('0x9c')]);}if(_0x2be6f8){logger[_0x0e55('0x9e')]('Run\x20Query:',_0x1d4e1b[_0x0e55('0x89')]());require(_0x0e55('0x9f'))[_0x0e55('0xa0')](path[_0x0e55('0x59')](__dirname,_0x0e55('0xa1'),_0x2be6f8[_0x0e55('0x95')]),[_0x2be6f8['id'],_0x1d4e1b['toString'](),path[_0x0e55('0x59')](__dirname,_0x0e55('0xa2'),_0x2be6f8[_0x0e55('0xa3')]),_0x941caa]);return _0x2be6f8;}else{var _0x35148c=squel['select']();_0x35148c[_0x0e55('0x75')]('('+_0x1d4e1b[_0x0e55('0x89')]()+')',_0x0e55('0xa4'));_0x35148c[_0x0e55('0x6c')](_0x0e55('0xa5'),_0x0e55('0x21'));_0x1d4e1b[_0x0e55('0x20')](_0x4f2557[_0x0e55('0x20')]||_0x34fea9);_0x1d4e1b['offset'](_0x4f2557[_0x0e55('0x22')]||0x0);return dbH[_0x0e55('0x8a')][_0x0e55('0x36')](_0x35148c[_0x0e55('0x89')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']})[_0x0e55('0x28')](function(_0x39e619){if(!_0x39e619[_0x0e55('0x3c')]){_0x594a23=0x0;}else{_0x594a23=_0x39e619[0x0][_0x0e55('0x21')]||0x0;}return dbH[_0x0e55('0x8a')][_0x0e55('0x36')](_0x1d4e1b[_0x0e55('0x89')](),{'type':dbH[_0x0e55('0x8a')][_0x0e55('0x8b')][_0x0e55('0x8c')]});})['then'](function(_0x2cc83e){return{'rows':_0x2cc83e||[],'count':_0x594a23};});}});}exports[_0x0e55('0xa6')]=function(_0x4417df,_0x2f6017){return runReport(_0x4417df['params'],_0x4417df[_0x0e55('0x36')],_0x4417df[_0x0e55('0x46')])[_0x0e55('0x28')](respondWithResult(_0x2f6017,null))['catch'](handleError(_0x2f6017,null));};exports[_0x0e55('0xa7')]=runReport;exports[_0x0e55('0x36')]=function(_0x4cce3a,_0xd99a4){var _0x3241ae=0xa;var _0x5ad05d=[_0x0e55('0x59'),'left_join',_0x0e55('0x5b'),'cross_join'];var _0x2b9bd3={'SUM':_0x0e55('0x5d'),'COUNT':_0x0e55('0x5e'),'COUNT DISTINCT':_0x0e55('0x8d'),'MAX':_0x0e55('0x5f'),'MIN':_0x0e55('0x60'),'AVG':_0x0e55('0x8e'),'GROUP_CONCAT':_0x0e55('0x61'),'GROUP_CONCAT ASC':_0x0e55('0x62'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1c55c3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x0e55('0x63'),'HOUR':_0x0e55('0x64'),'ROUND':_0x0e55('0x65'),'UNIX_TIMESTAMP':_0x0e55('0x66')};var _0x53457c=function(_0x590f30){return!_[_0x0e55('0x67')](['IS\x20NULL',_0x0e55('0xa8'),_0x0e55('0x91'),_0x0e55('0x69')],_0x590f30);};var _0x3d5641=function(_0x4a88e8){if(!_0x4a88e8||!_0x4a88e8[_0x0e55('0x6a')][_0x0e55('0x3c')]){return'';}for(var _0x552364='(',_0x32e584=0x0;_0x32e584<_0x4a88e8[_0x0e55('0x6a')][_0x0e55('0x3c')];_0x32e584+=0x1){_0x32e584>0x0&&(_0x552364+='\x20'+_0x4a88e8[_0x0e55('0xa9')]+'\x20');_0x552364+=_0x4a88e8[_0x0e55('0x6a')][_0x32e584][_0x0e55('0x6b')]?_0x3d5641(_0x4a88e8[_0x0e55('0x6a')][_0x32e584][_0x0e55('0x6b')]):_0x4a88e8[_0x0e55('0x6a')][_0x32e584]['field']+'\x20'+_0x4a88e8[_0x0e55('0x6a')][_0x32e584][_0x0e55('0x6d')]+(_0x53457c(_0x4a88e8[_0x0e55('0x6a')][_0x32e584]['condition'])?'\x20'+_0x4a88e8['rules'][_0x32e584][_0x0e55('0x6e')]:'');}return _0x552364+')';};var _0x2a6229={'where':{'id':_0x4cce3a[_0x0e55('0x4d')]['id']}},_0x3b9c20,_0x3997cb,_0x140097,_0x40f41c,_0x1ddf71;_0x2a6229=_[_0x0e55('0x43')]({},_0x2a6229,_0x4cce3a[_0x0e55('0x46')]);return db['AnalyticCustomReport']['find'](_0x2a6229)[_0x0e55('0x28')](function(_0x16e1aa){if(_0x16e1aa){_0x3b9c20=_0x16e1aa;return _0x16e1aa[_0x0e55('0x92')]();}return null;})[_0x0e55('0x28')](function(_0x1a1701){if(_0x1a1701){if(!_0x1a1701[_0x0e55('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x0e55('0x71'),0x193);}_0x3997cb=_0x1a1701;return db[_0x0e55('0x72')]['findAll']({'raw':!![]});}return null;})[_0x0e55('0x28')](function(_0xf07450){if(_0xf07450){_0x140097=_[_0x0e55('0x73')](_0xf07450,'id');var _0x2feb43;var _0x474ea0=squel['select']();_0x474ea0[_0x0e55('0x75')](_0x3b9c20[_0x0e55('0x76')]);for(var _0x3835a2=0x0;_0x3835a2<_0x3997cb[_0x0e55('0x3c')];_0x3835a2+=0x1){_0x2feb43=_0x3997cb[_0x3835a2][_0x0e55('0x77')]?_0x140097[_0x3997cb[_0x3835a2][_0x0e55('0x77')]]['metric']:_0x3997cb[_0x3835a2][_0x0e55('0x6c')];_0x2feb43=_0x3997cb[_0x3835a2][_0x0e55('0x79')]?_['replace'](_0x2b9bd3[_0x3997cb[_0x3835a2][_0x0e55('0x79')]],'%s',_0x2feb43):_0x2feb43;_0x2feb43=_0x3997cb[_0x3835a2][_0x0e55('0x7b')]?_['replace'](_0x1c55c3[_0x3997cb[_0x3835a2]['format']],'%s',_0x2feb43):_0x2feb43;if(_0x3997cb[_0x3835a2][_0x0e55('0x7c')]){_0x474ea0['group'](_0x2feb43);}_0x3997cb[_0x3835a2][_0x0e55('0x7d')]&&_0x474ea0[_0x0e55('0x3f')](_0x2feb43,_0x3997cb[_0x3835a2][_0x0e55('0x7d')]===_0x0e55('0x7e')?![]:!![]);_0x474ea0[_0x0e55('0x6c')](_0x2feb43,_0x3997cb[_0x3835a2][_0x0e55('0x7f')]||_0x2feb43);}if(_0x3b9c20[_0x0e55('0x80')]){_0x3b9c20[_0x0e55('0x80')]=JSON[_0x0e55('0x81')](_0x3b9c20[_0x0e55('0x80')]);for(var _0x2b22f6=0x0;_0x2b22f6<_0x3b9c20[_0x0e55('0x80')][_0x0e55('0x3c')];_0x2b22f6+=0x1){if(_0x3b9c20[_0x0e55('0x80')][_0x2b22f6]['type']&&_[_0x0e55('0x67')](_0x5ad05d,_0x3b9c20[_0x0e55('0x80')][_0x2b22f6][_0x0e55('0x32')])&&_0x3b9c20[_0x0e55('0x80')][_0x2b22f6]['parentKey']&&_0x3b9c20[_0x0e55('0x80')][_0x2b22f6][_0x0e55('0x83')]&&_0x3b9c20['joins'][_0x2b22f6][_0x0e55('0x84')]){_0x474ea0[_0x3b9c20[_0x0e55('0x80')][_0x2b22f6]['type']](_0x3b9c20[_0x0e55('0x80')][_0x2b22f6][_0x0e55('0x83')],null,util[_0x0e55('0x7b')](_0x0e55('0x85'),_0x3b9c20[_0x0e55('0x76')],_0x3b9c20[_0x0e55('0x80')][_0x2b22f6][_0x0e55('0x82')],_0x3b9c20[_0x0e55('0x80')][_0x2b22f6]['foreignTable'],_0x3b9c20['joins'][_0x2b22f6][_0x0e55('0x84')]));}}}if(_0x3b9c20[_0x0e55('0x86')]){_0x3b9c20[_0x0e55('0x86')]=JSON[_0x0e55('0x81')](_0x3b9c20[_0x0e55('0x86')]);_0x474ea0[_0x0e55('0x44')](_0x3d5641(_0x3b9c20[_0x0e55('0x86')][_0x0e55('0x6b')]));}_0x1ddf71=_0x474ea0[_0x0e55('0xaa')]();_0x474ea0[_0x0e55('0x20')](_0x3241ae);_0x474ea0[_0x0e55('0x22')](0x0);logger[_0x0e55('0x87')](_0x0e55('0x88'),_0x474ea0[_0x0e55('0x89')]());return dbH[_0x0e55('0x8a')][_0x0e55('0x36')](_0x474ea0['toString'](),{'type':dbH['sequelize'][_0x0e55('0x8b')][_0x0e55('0x8c')]});}})[_0x0e55('0x28')](function(){return{'sql':_0x1ddf71['toString']()};})[_0x0e55('0x28')](respondWithResult(_0xd99a4,null))[_0x0e55('0x4b')](handleError(_0xd99a4,null));}; \ No newline at end of file +var _0x3c32=['Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','AVG(%s)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','value','getFields','keyBy','table','function','output','%s-%s.%s','randomstring','custom','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','../../components/export/','../../files/reports','countTable','COUNT(*)','run','SUM(%s)','MAX(%s)','debug','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','end','status','json','offset','limit','undefined','count','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','AnalyticCustomReport','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','body','preview','join','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','field','condition','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','MetricId','metric','replace','format','groupBy','group','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone'];(function(_0x5ca353,_0x21eb37){var _0x4f2fe5=function(_0x14cd1b){while(--_0x14cd1b){_0x5ca353['push'](_0x5ca353['shift']());}};_0x4f2fe5(++_0x21eb37);}(_0x3c32,0x161));var _0x23c3=function(_0x333a41,_0xf7eb2a){_0x333a41=_0x333a41-0x0;var _0x28a7b4=_0x3c32[_0x333a41];return _0x28a7b4;};'use strict';var emlformat=require(_0x23c3('0x0'));var rimraf=require(_0x23c3('0x1'));var zipdir=require(_0x23c3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x23c3('0x3'));var moment=require(_0x23c3('0x4'));var BPromise=require(_0x23c3('0x5'));var Mustache=require('mustache');var util=require(_0x23c3('0x6'));var path=require('path');var sox=require(_0x23c3('0x7'));var csv=require(_0x23c3('0x8'));var ejs=require(_0x23c3('0x9'));var fs=require('fs');var fs_extra=require(_0x23c3('0xa'));var _=require(_0x23c3('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x23c3('0xc'));var toCsv=require(_0x23c3('0x8'));var querystring=require(_0x23c3('0xd'));var Papa=require(_0x23c3('0xe'));var Redis=require(_0x23c3('0xf'));var authService=require(_0x23c3('0x10'));var qs=require(_0x23c3('0x11'));var as=require(_0x23c3('0x12'));var hardwareService=require(_0x23c3('0x13'));var logger=require(_0x23c3('0x14'))(_0x23c3('0x15'));var utils=require(_0x23c3('0x16'));var config=require(_0x23c3('0x17'));var licenseUtil=require(_0x23c3('0x18'));var db=require(_0x23c3('0x19'))['db'];var dbH=require(_0x23c3('0x19'))[_0x23c3('0x1a')];function respondWithStatusCode(_0x28bfbb,_0xb94312){_0xb94312=_0xb94312||0xcc;return function(_0x285c46){if(_0x285c46){return _0x28bfbb['sendStatus'](_0xb94312);}return _0x28bfbb['status'](_0xb94312)[_0x23c3('0x1b')]();};}function respondWithResult(_0x38a11a,_0x4192bf){_0x4192bf=_0x4192bf||0xc8;return function(_0x32c118){if(_0x32c118){return _0x38a11a[_0x23c3('0x1c')](_0x4192bf)[_0x23c3('0x1d')](_0x32c118);}};}function respondWithFilteredResult(_0x16b80c,_0x51e880){return function(_0x4f65f8){if(_0x4f65f8){var _0x2b224d=typeof _0x51e880[_0x23c3('0x1e')]==='undefined'&&typeof _0x51e880[_0x23c3('0x1f')]===_0x23c3('0x20');var _0x20a8b7=_0x4f65f8[_0x23c3('0x21')];var _0x25880d=_0x2b224d?0x0:_0x51e880[_0x23c3('0x1e')];var _0x56cc03=_0x2b224d?_0x4f65f8[_0x23c3('0x21')]:_0x51e880[_0x23c3('0x1e')]+_0x51e880[_0x23c3('0x1f')];var _0x47abe2;if(_0x56cc03>=_0x20a8b7){_0x56cc03=_0x20a8b7;_0x47abe2=0xc8;}else{_0x47abe2=0xce;}_0x16b80c[_0x23c3('0x1c')](_0x47abe2);return _0x16b80c['set']('Content-Range',_0x25880d+'-'+_0x56cc03+'/'+_0x20a8b7)[_0x23c3('0x1d')](_0x4f65f8);}return null;};}function patchUpdates(_0x584f90){return function(_0x5719d3){try{jsonpatch[_0x23c3('0x22')](_0x5719d3,_0x584f90,!![]);}catch(_0x28f694){return BPromise[_0x23c3('0x23')](_0x28f694);}return _0x5719d3[_0x23c3('0x24')]();};}function saveUpdates(_0x5c5993,_0x47067e){return function(_0x49f572){if(_0x49f572){return _0x49f572[_0x23c3('0x25')](_0x5c5993)[_0x23c3('0x26')](function(_0x30fe87){return _0x30fe87;});}return null;};}function removeEntity(_0x1210a4,_0x576c20){return function(_0xc5affc){if(_0xc5affc){return _0xc5affc[_0x23c3('0x27')]()['then'](function(){var _0x24fabd=_0xc5affc[_0x23c3('0x28')]({'plain':!![]});var _0x2864c6=_0x23c3('0x29');return db[_0x23c3('0x2a')]['destroy']({'where':{'type':_0x2864c6,'resourceId':_0x24fabd['id']}})[_0x23c3('0x26')](function(){return _0xc5affc;});})[_0x23c3('0x26')](function(){_0x1210a4[_0x23c3('0x1c')](0xcc)[_0x23c3('0x1b')]();});}};}function handleEntityNotFound(_0xa520fc,_0x32b6f1){return function(_0x237c7d){if(!_0x237c7d){_0xa520fc[_0x23c3('0x2b')](0x194);}return _0x237c7d;};}function handleError(_0x856e72,_0x347ef8){_0x347ef8=_0x347ef8||0x1f4;return function(_0x36f07f){logger[_0x23c3('0x2c')](_0x36f07f[_0x23c3('0x2d')]);if(_0x36f07f[_0x23c3('0x2e')]){delete _0x36f07f[_0x23c3('0x2e')];}_0x856e72[_0x23c3('0x1c')](_0x347ef8)[_0x23c3('0x2f')](_0x36f07f);};}exports[_0x23c3('0x30')]=function(_0x12b8be,_0xd732d7){var _0x1bc3ce={},_0x47abc5={},_0x5411dc={'count':0x0,'rows':[]};var _0x4f4b46=_[_0x23c3('0x31')](db['AnalyticCustomReport'][_0x23c3('0x32')],function(_0x4cc578){return{'name':_0x4cc578[_0x23c3('0x33')],'type':_0x4cc578[_0x23c3('0x34')][_0x23c3('0x35')]};});_0x47abc5[_0x23c3('0x36')]=_[_0x23c3('0x31')](_0x4f4b46,_0x23c3('0x2e'));_0x47abc5[_0x23c3('0x37')]=_['keys'](_0x12b8be[_0x23c3('0x37')]);_0x47abc5['filters']=_[_0x23c3('0x38')](_0x47abc5[_0x23c3('0x36')],_0x47abc5['query']);_0x1bc3ce['attributes']=_['intersection'](_0x47abc5[_0x23c3('0x36')],qs[_0x23c3('0x39')](_0x12b8be[_0x23c3('0x37')]['fields']));_0x1bc3ce[_0x23c3('0x3a')]=_0x1bc3ce[_0x23c3('0x3a')][_0x23c3('0x3b')]?_0x1bc3ce[_0x23c3('0x3a')]:_0x47abc5[_0x23c3('0x36')];if(!_0x12b8be['query'][_0x23c3('0x3c')](_0x23c3('0x3d'))){_0x1bc3ce[_0x23c3('0x1f')]=qs['limit'](_0x12b8be['query'][_0x23c3('0x1f')]);_0x1bc3ce[_0x23c3('0x1e')]=qs[_0x23c3('0x1e')](_0x12b8be[_0x23c3('0x37')]['offset']);}_0x1bc3ce[_0x23c3('0x3e')]=qs[_0x23c3('0x3f')](_0x12b8be[_0x23c3('0x37')][_0x23c3('0x3f')]);_0x1bc3ce[_0x23c3('0x40')]=qs[_0x23c3('0x41')](_['pick'](_0x12b8be['query'],_0x47abc5[_0x23c3('0x41')]),_0x4f4b46);if(_0x12b8be['query'][_0x23c3('0x42')]){_0x1bc3ce[_0x23c3('0x40')]=_[_0x23c3('0x43')](_0x1bc3ce[_0x23c3('0x40')],{'$or':_[_0x23c3('0x31')](_0x4f4b46,function(_0x1c2338){if(_0x1c2338[_0x23c3('0x34')]!==_0x23c3('0x44')){var _0x6ec23a={};_0x6ec23a[_0x1c2338[_0x23c3('0x2e')]]={'$like':'%'+_0x12b8be[_0x23c3('0x37')][_0x23c3('0x42')]+'%'};return _0x6ec23a;}})});}_0x1bc3ce=_[_0x23c3('0x43')]({},_0x1bc3ce,_0x12b8be[_0x23c3('0x45')]);var _0x6d8e29={'where':_0x1bc3ce['where']};return db['AnalyticCustomReport'][_0x23c3('0x21')](_0x6d8e29)[_0x23c3('0x26')](function(_0x5b4bf0){_0x5411dc[_0x23c3('0x21')]=_0x5b4bf0;if(_0x12b8be[_0x23c3('0x37')][_0x23c3('0x46')]){_0x1bc3ce['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x23c3('0x47')](_0x1bc3ce);})[_0x23c3('0x26')](function(_0x2da88e){_0x5411dc[_0x23c3('0x48')]=_0x2da88e;return _0x5411dc;})[_0x23c3('0x26')](respondWithFilteredResult(_0xd732d7,_0x1bc3ce))[_0x23c3('0x49')](handleError(_0xd732d7,null));};exports[_0x23c3('0x4a')]=function(_0x33b393,_0xef696c){var _0x5dfb33={'raw':![],'where':{'id':_0x33b393[_0x23c3('0x4b')]['id']}},_0x595d3d={};_0x595d3d['model']=_[_0x23c3('0x4c')](db[_0x23c3('0x4d')]['rawAttributes']);_0x595d3d[_0x23c3('0x37')]=_[_0x23c3('0x4c')](_0x33b393[_0x23c3('0x37')]);_0x595d3d[_0x23c3('0x41')]=_[_0x23c3('0x38')](_0x595d3d['model'],_0x595d3d[_0x23c3('0x37')]);_0x5dfb33[_0x23c3('0x3a')]=_['intersection'](_0x595d3d['model'],qs['fields'](_0x33b393['query'][_0x23c3('0x39')]));_0x5dfb33[_0x23c3('0x3a')]=_0x5dfb33[_0x23c3('0x3a')][_0x23c3('0x3b')]?_0x5dfb33[_0x23c3('0x3a')]:_0x595d3d[_0x23c3('0x36')];if(_0x33b393[_0x23c3('0x37')][_0x23c3('0x46')]){_0x5dfb33['include']=[{'all':!![]}];}_0x5dfb33=_[_0x23c3('0x43')]({},_0x5dfb33,_0x33b393['options']);return db[_0x23c3('0x4d')][_0x23c3('0x4e')](_0x5dfb33)['then'](handleEntityNotFound(_0xef696c,null))[_0x23c3('0x26')](respondWithResult(_0xef696c,null))[_0x23c3('0x49')](handleError(_0xef696c,null));};exports[_0x23c3('0x4f')]=function(_0x20a08b,_0x9b2923){return db[_0x23c3('0x4d')]['create'](_0x20a08b['body'],{})[_0x23c3('0x26')](function(_0x2550e8){var _0x49a182=_0x20a08b[_0x23c3('0x50')]['get']({'plain':!![]});if(!_0x49a182)throw new Error(_0x23c3('0x51'));if(_0x49a182['role']==='user'){var _0x7ff776=_0x2550e8[_0x23c3('0x28')]({'plain':!![]});var _0x1288b1='Reports';return db['UserProfileSection'][_0x23c3('0x4e')]({'where':{'name':_0x1288b1,'userProfileId':_0x49a182[_0x23c3('0x52')]},'raw':!![]})['then'](function(_0x59a4e2){if(_0x59a4e2&&_0x59a4e2['autoAssociation']===0x0){return db[_0x23c3('0x2a')]['create']({'name':_0x7ff776[_0x23c3('0x2e')],'resourceId':_0x7ff776['id'],'type':_0x23c3('0x29'),'sectionId':_0x59a4e2['id']},{})[_0x23c3('0x26')](function(){return _0x2550e8;});}else{return _0x2550e8;}})[_0x23c3('0x49')](function(_0x4b909e){logger[_0x23c3('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b909e);throw _0x4b909e;});}return _0x2550e8;})['then'](respondWithResult(_0x9b2923,0xc9))[_0x23c3('0x49')](handleError(_0x9b2923,null));};exports['update']=function(_0x5f31ca,_0x1fc444){if(_0x5f31ca[_0x23c3('0x53')]['id']){delete _0x5f31ca['body']['id'];}return db[_0x23c3('0x4d')][_0x23c3('0x4e')]({'where':{'id':_0x5f31ca[_0x23c3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1fc444,null))['then'](saveUpdates(_0x5f31ca[_0x23c3('0x53')],null))['then'](respondWithResult(_0x1fc444,null))[_0x23c3('0x49')](handleError(_0x1fc444,null));};exports[_0x23c3('0x27')]=function(_0x41aadd,_0x29a881){return db[_0x23c3('0x4d')][_0x23c3('0x4e')]({'where':{'id':_0x41aadd[_0x23c3('0x4b')]['id']}})[_0x23c3('0x26')](handleEntityNotFound(_0x29a881,null))[_0x23c3('0x26')](removeEntity(_0x29a881,null))[_0x23c3('0x49')](handleError(_0x29a881,null));};exports[_0x23c3('0x54')]=function(_0x5df662,_0xb6734){var _0x3c870e=0xa;var _0x479d7b=[_0x23c3('0x55'),_0x23c3('0x56'),_0x23c3('0x57'),'cross_join'];var _0x2298c9={'SUM':'SUM(%s)','COUNT':_0x23c3('0x58'),'COUNT DISTINCT':_0x23c3('0x59'),'MAX':'MAX(%s)','MIN':_0x23c3('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x23c3('0x5b'),'GROUP_CONCAT ASC':_0x23c3('0x5c'),'GROUP_CONCAT DESC':_0x23c3('0x5d')};var _0x3d5be0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x23c3('0x5e')};var _0x34b3b6=function(_0x195d8b){return!_[_0x23c3('0x5f')]([_0x23c3('0x60'),_0x23c3('0x61'),_0x23c3('0x62'),_0x23c3('0x63')],_0x195d8b);};var _0x2026cc=function(_0x2a4b5c){if(!_0x2a4b5c||!_0x2a4b5c[_0x23c3('0x64')][_0x23c3('0x3b')]){return'';}for(var _0x45ca73='(',_0x1a1aec=0x0;_0x1a1aec<_0x2a4b5c[_0x23c3('0x64')]['length'];_0x1a1aec+=0x1){_0x1a1aec>0x0&&(_0x45ca73+='\x20'+_0x2a4b5c[_0x23c3('0x65')]+'\x20');_0x45ca73+=_0x2a4b5c[_0x23c3('0x64')][_0x1a1aec]['group']?_0x2026cc(_0x2a4b5c['rules'][_0x1a1aec]['group']):_0x2a4b5c[_0x23c3('0x64')][_0x1a1aec][_0x23c3('0x66')]+'\x20'+_0x2a4b5c['rules'][_0x1a1aec]['condition']+(_0x34b3b6(_0x2a4b5c[_0x23c3('0x64')][_0x1a1aec][_0x23c3('0x67')])?'\x20'+_0x2a4b5c['rules'][_0x1a1aec]['value']:'');}return _0x45ca73+')';};var _0x1dca53={'where':{'id':_0x5df662[_0x23c3('0x4b')]['id']}},_0x38378c,_0x14526a,_0x1651b6,_0x3d6a1e,_0x465486;_0x1dca53=_[_0x23c3('0x43')]({},_0x1dca53,_0x5df662[_0x23c3('0x45')]);return db[_0x23c3('0x4d')]['find'](_0x1dca53)['then'](function(_0x590e93){if(_0x590e93){_0x38378c=_0x590e93;return _0x590e93['getFields']();}return null;})[_0x23c3('0x26')](function(_0x46631e){if(_0x46631e){if(!_0x46631e[_0x23c3('0x3b')]){throw new db[(_0x23c3('0x68'))][(_0x23c3('0x69'))](_0x23c3('0x6a'),0x193);}_0x14526a=_0x46631e;return db[_0x23c3('0x6b')]['findAll']({'raw':!![]});}return null;})[_0x23c3('0x26')](function(_0x3a6b84){if(_0x3a6b84){_0x1651b6=_['keyBy'](_0x3a6b84,'id');var _0x35bc9e;var _0x5cddd8=squel[_0x23c3('0x6c')]();_0x5cddd8[_0x23c3('0x6d')](_0x38378c['table']);for(var _0x275e55=0x0;_0x275e55<_0x14526a['length'];_0x275e55+=0x1){_0x35bc9e=_0x14526a[_0x275e55][_0x23c3('0x6e')]?_0x1651b6[_0x14526a[_0x275e55]['MetricId']][_0x23c3('0x6f')]:_0x14526a[_0x275e55][_0x23c3('0x66')];_0x35bc9e=_0x14526a[_0x275e55]['function']?_[_0x23c3('0x70')](_0x2298c9[_0x14526a[_0x275e55]['function']],'%s',_0x35bc9e):_0x35bc9e;_0x35bc9e=_0x14526a[_0x275e55][_0x23c3('0x71')]?_[_0x23c3('0x70')](_0x3d5be0[_0x14526a[_0x275e55][_0x23c3('0x71')]],'%s',_0x35bc9e):_0x35bc9e;if(_0x14526a[_0x275e55][_0x23c3('0x72')]){_0x5cddd8[_0x23c3('0x73')](_0x35bc9e);}_0x14526a[_0x275e55][_0x23c3('0x74')]&&_0x5cddd8[_0x23c3('0x3e')](_0x35bc9e,_0x14526a[_0x275e55][_0x23c3('0x74')]===_0x23c3('0x75')?![]:!![]);_0x5cddd8[_0x23c3('0x66')](_0x35bc9e,_0x14526a[_0x275e55][_0x23c3('0x76')]||_0x35bc9e);}if(_0x38378c[_0x23c3('0x77')]){_0x38378c['joins']=JSON[_0x23c3('0x78')](_0x38378c[_0x23c3('0x77')]);for(var _0x16038b=0x0;_0x16038b<_0x38378c[_0x23c3('0x77')][_0x23c3('0x3b')];_0x16038b+=0x1){if(_0x38378c['joins'][_0x16038b][_0x23c3('0x34')]&&_[_0x23c3('0x5f')](_0x479d7b,_0x38378c[_0x23c3('0x77')][_0x16038b][_0x23c3('0x34')])&&_0x38378c[_0x23c3('0x77')][_0x16038b][_0x23c3('0x79')]&&_0x38378c[_0x23c3('0x77')][_0x16038b][_0x23c3('0x7a')]&&_0x38378c[_0x23c3('0x77')][_0x16038b][_0x23c3('0x7b')]){_0x5cddd8[_0x38378c[_0x23c3('0x77')][_0x16038b]['type']](_0x38378c['joins'][_0x16038b][_0x23c3('0x7a')],null,util[_0x23c3('0x71')](_0x23c3('0x7c'),_0x38378c['table'],_0x38378c[_0x23c3('0x77')][_0x16038b][_0x23c3('0x79')],_0x38378c['joins'][_0x16038b][_0x23c3('0x7a')],_0x38378c[_0x23c3('0x77')][_0x16038b][_0x23c3('0x7b')]));}}}if(_0x38378c[_0x23c3('0x7d')]){_0x38378c[_0x23c3('0x7d')]=JSON['parse'](_0x38378c['conditions']);_0x5cddd8[_0x23c3('0x40')](_0x2026cc(_0x38378c[_0x23c3('0x7d')][_0x23c3('0x73')]));}_0x465486=_0x5cddd8[_0x23c3('0x7e')]();_0x5cddd8['limit'](_0x3c870e);_0x5cddd8['offset'](0x0);logger['debug'](_0x23c3('0x7f'),_0x5cddd8[_0x23c3('0x80')]());return dbH[_0x23c3('0x81')]['query'](_0x5cddd8[_0x23c3('0x80')](),{'type':dbH[_0x23c3('0x81')][_0x23c3('0x82')][_0x23c3('0x83')]});}})['then'](respondWithResult(_0xb6734,null))['catch'](handleError(_0xb6734,null));};function runReport(_0x13924c,_0x5b76c6,_0x280bdf){var _0x2b92eb=_0x5b76c6['name'];var _0x343461=0xa;var _0x217eee=[_0x23c3('0x55'),'left_join','right_join',_0x23c3('0x84')];var _0x2d5ac2={'SUM':'SUM(%s)','COUNT':_0x23c3('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x23c3('0x85'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x23c3('0x5c'),'GROUP_CONCAT DESC':_0x23c3('0x5d')};var _0xb417b7={'SEC_TO_TIME':_0x23c3('0x86'),'DATE':'DATE(%s)','HOUR':_0x23c3('0x87'),'ROUND':_0x23c3('0x88'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x376e4e=function(_0x112ca3){return!_[_0x23c3('0x5f')]([_0x23c3('0x60'),_0x23c3('0x61'),_0x23c3('0x62'),_0x23c3('0x63')],_0x112ca3);};var _0x2bffc5=function(_0x19965d){if(!_0x19965d||!_0x19965d[_0x23c3('0x64')]['length']){return'';}for(var _0x459ddf='(',_0x3ef0fb=0x0;_0x3ef0fb<_0x19965d['rules']['length'];_0x3ef0fb+=0x1){_0x3ef0fb>0x0&&(_0x459ddf+='\x20'+_0x19965d[_0x23c3('0x65')]+'\x20');_0x459ddf+=_0x19965d[_0x23c3('0x64')][_0x3ef0fb]['group']?_0x2bffc5(_0x19965d[_0x23c3('0x64')][_0x3ef0fb][_0x23c3('0x73')]):_0x19965d[_0x23c3('0x64')][_0x3ef0fb][_0x23c3('0x66')]+'\x20'+_0x19965d[_0x23c3('0x64')][_0x3ef0fb]['condition']+(_0x376e4e(_0x19965d['rules'][_0x3ef0fb][_0x23c3('0x67')])?'\x20'+_0x19965d[_0x23c3('0x64')][_0x3ef0fb][_0x23c3('0x89')]:'');}return _0x459ddf+')';};var _0x125846={'where':{'id':_0x13924c['id']}},_0x65a9f6,_0x599f30,_0x3560cb,_0xe3a164,_0x14f9b5;_0x125846=_[_0x23c3('0x43')]({},_0x125846,_0x280bdf);return db[_0x23c3('0x4d')]['find'](_0x125846)[_0x23c3('0x26')](function(_0x160f22){if(_0x160f22){_0x65a9f6=_0x160f22;return _0x160f22[_0x23c3('0x8a')]();}return null;})[_0x23c3('0x26')](function(_0x589ed2){if(_0x589ed2){if(!_0x589ed2[_0x23c3('0x3b')]){throw new db[(_0x23c3('0x68'))]['ValidationErrorItem'](_0x23c3('0x6a'),0x193);}_0x599f30=_0x589ed2;return db[_0x23c3('0x6b')]['findAll']({'raw':!![]});}return null;})[_0x23c3('0x26')](function(_0xf34f22){if(_0xf34f22){_0x3560cb=_[_0x23c3('0x8b')](_0xf34f22,'id');var _0x5665ad;var _0x2fa763=squel['select']();_0x2fa763['from'](_0x65a9f6[_0x23c3('0x8c')]);for(var _0x13f269=0x0;_0x13f269<_0x599f30[_0x23c3('0x3b')];_0x13f269+=0x1){_0x5665ad=_0x599f30[_0x13f269][_0x23c3('0x6e')]?_0x3560cb[_0x599f30[_0x13f269][_0x23c3('0x6e')]][_0x23c3('0x6f')]:_0x599f30[_0x13f269][_0x23c3('0x66')];_0x5665ad=_0x599f30[_0x13f269][_0x23c3('0x8d')]?_[_0x23c3('0x70')](_0x2d5ac2[_0x599f30[_0x13f269][_0x23c3('0x8d')]],'%s',_0x5665ad):_0x5665ad;_0x5665ad=_0x599f30[_0x13f269][_0x23c3('0x71')]?_['replace'](_0xb417b7[_0x599f30[_0x13f269][_0x23c3('0x71')]],'%s',_0x5665ad):_0x5665ad;if(_0x599f30[_0x13f269]['groupBy']){_0x2fa763[_0x23c3('0x73')](_0x5665ad);}_0x599f30[_0x13f269][_0x23c3('0x74')]&&_0x2fa763[_0x23c3('0x3e')](_0x5665ad,_0x599f30[_0x13f269][_0x23c3('0x74')]===_0x23c3('0x75')?![]:!![]);_0x2fa763['field'](_0x5665ad,_0x599f30[_0x13f269][_0x23c3('0x76')]||_0x5665ad);}if(_0x65a9f6[_0x23c3('0x77')]){_0x65a9f6[_0x23c3('0x77')]=JSON['parse'](_0x65a9f6[_0x23c3('0x77')]);for(var _0x4c1f06=0x0;_0x4c1f06<_0x65a9f6['joins']['length'];_0x4c1f06+=0x1){if(_0x65a9f6[_0x23c3('0x77')][_0x4c1f06][_0x23c3('0x34')]&&_[_0x23c3('0x5f')](_0x217eee,_0x65a9f6[_0x23c3('0x77')][_0x4c1f06][_0x23c3('0x34')])&&_0x65a9f6['joins'][_0x4c1f06][_0x23c3('0x79')]&&_0x65a9f6[_0x23c3('0x77')][_0x4c1f06][_0x23c3('0x7a')]&&_0x65a9f6[_0x23c3('0x77')][_0x4c1f06][_0x23c3('0x7b')]){_0x2fa763[_0x65a9f6[_0x23c3('0x77')][_0x4c1f06][_0x23c3('0x34')]](_0x65a9f6[_0x23c3('0x77')][_0x4c1f06]['foreignTable'],null,util[_0x23c3('0x71')](_0x23c3('0x7c'),_0x65a9f6[_0x23c3('0x8c')],_0x65a9f6[_0x23c3('0x77')][_0x4c1f06][_0x23c3('0x79')],_0x65a9f6[_0x23c3('0x77')][_0x4c1f06][_0x23c3('0x7a')],_0x65a9f6['joins'][_0x4c1f06][_0x23c3('0x7b')]));}}}if(_0x65a9f6[_0x23c3('0x7d')]){_0x65a9f6[_0x23c3('0x7d')]=JSON[_0x23c3('0x78')](_0x65a9f6['conditions']);_0x2fa763[_0x23c3('0x40')](_0x2bffc5(_0x65a9f6[_0x23c3('0x7d')]['group']));}_0x14f9b5=_0x2fa763[_0x23c3('0x7e')]();_0x2fa763['limit'](_0x343461);_0x2fa763[_0x23c3('0x1e')](0x0);return;}})['then'](function(){if(_0x5b76c6[_0x23c3('0x8e')]==='web'){return null;}var _0x7fede6=_[_0x23c3('0x43')](_0x5b76c6,{'name':_0x5b76c6['fullPath']||_0x5b76c6[_0x23c3('0x2e')]||_0x65a9f6[_0x23c3('0x2e')],'basename':_0x2b92eb,'savename':util[_0x23c3('0x71')](_0x23c3('0x8f'),_0x5b76c6['name']||_0x65a9f6['name'],require(_0x23c3('0x90'))['generate'](0x4),_0x5b76c6['output']||'csv'),'reportId':_0x65a9f6['id'],'reportType':_0x23c3('0x91')});return db[_0x23c3('0x92')][_0x23c3('0x4f')](_0x7fede6,{'raw':!![]});})[_0x23c3('0x26')](function(_0x1f22cb){if(_0x65a9f6['table']===_0x23c3('0x93')){_0x14f9b5[_0x23c3('0x40')](_0x65a9f6[_0x23c3('0x8c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x5b76c6['startDate'],_0x5b76c6[_0x23c3('0x94')]);}else{_0x14f9b5[_0x23c3('0x40')](_0x65a9f6[_0x23c3('0x8c')]+_0x23c3('0x95'),_0x5b76c6[_0x23c3('0x96')],_0x5b76c6[_0x23c3('0x94')]);}if(_0x1f22cb){logger[_0x23c3('0x97')]('Run\x20Query:',_0x14f9b5['toString']());require('child_process')['fork'](path[_0x23c3('0x55')](__dirname,_0x23c3('0x98'),_0x1f22cb[_0x23c3('0x8e')]),[_0x1f22cb['id'],_0x14f9b5[_0x23c3('0x80')](),path['join'](__dirname,_0x23c3('0x99'),_0x1f22cb['savename']),_0x2b92eb]);return _0x1f22cb;}else{var _0x41846b=squel[_0x23c3('0x6c')]();_0x41846b[_0x23c3('0x6d')]('('+_0x14f9b5['toString']()+')',_0x23c3('0x9a'));_0x41846b[_0x23c3('0x66')](_0x23c3('0x9b'),_0x23c3('0x21'));_0x14f9b5[_0x23c3('0x1f')](_0x5b76c6[_0x23c3('0x1f')]||_0x343461);_0x14f9b5[_0x23c3('0x1e')](_0x5b76c6[_0x23c3('0x1e')]||0x0);return dbH[_0x23c3('0x81')][_0x23c3('0x37')](_0x41846b[_0x23c3('0x80')](),{'type':dbH['sequelize'][_0x23c3('0x82')][_0x23c3('0x83')]})['then'](function(_0x1473b0){if(!_0x1473b0[_0x23c3('0x3b')]){_0xe3a164=0x0;}else{_0xe3a164=_0x1473b0[0x0][_0x23c3('0x21')]||0x0;}return dbH[_0x23c3('0x81')][_0x23c3('0x37')](_0x14f9b5[_0x23c3('0x80')](),{'type':dbH[_0x23c3('0x81')][_0x23c3('0x82')][_0x23c3('0x83')]});})[_0x23c3('0x26')](function(_0x39ab49){return{'rows':_0x39ab49||[],'count':_0xe3a164};});}});}exports[_0x23c3('0x9c')]=function(_0x4cc0ed,_0x598e69){return runReport(_0x4cc0ed[_0x23c3('0x4b')],_0x4cc0ed[_0x23c3('0x37')],_0x4cc0ed['options'])[_0x23c3('0x26')](respondWithResult(_0x598e69,null))[_0x23c3('0x49')](handleError(_0x598e69,null));};exports['runReport']=runReport;exports[_0x23c3('0x37')]=function(_0x35bcac,_0x327b00){var _0x3e8278=0xa;var _0x59bd3f=[_0x23c3('0x55'),_0x23c3('0x56'),_0x23c3('0x57'),'cross_join'];var _0x3fdec3={'SUM':_0x23c3('0x9d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x23c3('0x9e'),'MIN':_0x23c3('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x23c3('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x23c3('0x5d')};var _0x203e27={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x23c3('0x87'),'ROUND':_0x23c3('0x88'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1ebfc3=function(_0x19564a){return!_['includes']([_0x23c3('0x60'),_0x23c3('0x61'),'IS\x20EMPTY',_0x23c3('0x63')],_0x19564a);};var _0x27ae68=function(_0x36575c){if(!_0x36575c||!_0x36575c['rules'][_0x23c3('0x3b')]){return'';}for(var _0x404f67='(',_0x9f85bf=0x0;_0x9f85bf<_0x36575c[_0x23c3('0x64')][_0x23c3('0x3b')];_0x9f85bf+=0x1){_0x9f85bf>0x0&&(_0x404f67+='\x20'+_0x36575c[_0x23c3('0x65')]+'\x20');_0x404f67+=_0x36575c['rules'][_0x9f85bf]['group']?_0x27ae68(_0x36575c['rules'][_0x9f85bf]['group']):_0x36575c[_0x23c3('0x64')][_0x9f85bf][_0x23c3('0x66')]+'\x20'+_0x36575c[_0x23c3('0x64')][_0x9f85bf][_0x23c3('0x67')]+(_0x1ebfc3(_0x36575c[_0x23c3('0x64')][_0x9f85bf][_0x23c3('0x67')])?'\x20'+_0x36575c[_0x23c3('0x64')][_0x9f85bf][_0x23c3('0x89')]:'');}return _0x404f67+')';};var _0x5055ea={'where':{'id':_0x35bcac[_0x23c3('0x4b')]['id']}},_0x2b940c,_0x26ed07,_0x4e47e8,_0x5b7e43,_0xe4fbcb;_0x5055ea=_[_0x23c3('0x43')]({},_0x5055ea,_0x35bcac[_0x23c3('0x45')]);return db[_0x23c3('0x4d')][_0x23c3('0x4e')](_0x5055ea)[_0x23c3('0x26')](function(_0x5c9f16){if(_0x5c9f16){_0x2b940c=_0x5c9f16;return _0x5c9f16[_0x23c3('0x8a')]();}return null;})[_0x23c3('0x26')](function(_0x24f29c){if(_0x24f29c){if(!_0x24f29c[_0x23c3('0x3b')]){throw new db[(_0x23c3('0x68'))][(_0x23c3('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x26ed07=_0x24f29c;return db[_0x23c3('0x6b')][_0x23c3('0x47')]({'raw':!![]});}return null;})[_0x23c3('0x26')](function(_0x5cb579){if(_0x5cb579){_0x4e47e8=_['keyBy'](_0x5cb579,'id');var _0x45f5ef;var _0x4fa4c8=squel['select']();_0x4fa4c8['from'](_0x2b940c[_0x23c3('0x8c')]);for(var _0x263e55=0x0;_0x263e55<_0x26ed07[_0x23c3('0x3b')];_0x263e55+=0x1){_0x45f5ef=_0x26ed07[_0x263e55][_0x23c3('0x6e')]?_0x4e47e8[_0x26ed07[_0x263e55]['MetricId']][_0x23c3('0x6f')]:_0x26ed07[_0x263e55][_0x23c3('0x66')];_0x45f5ef=_0x26ed07[_0x263e55][_0x23c3('0x8d')]?_[_0x23c3('0x70')](_0x3fdec3[_0x26ed07[_0x263e55]['function']],'%s',_0x45f5ef):_0x45f5ef;_0x45f5ef=_0x26ed07[_0x263e55][_0x23c3('0x71')]?_[_0x23c3('0x70')](_0x203e27[_0x26ed07[_0x263e55][_0x23c3('0x71')]],'%s',_0x45f5ef):_0x45f5ef;if(_0x26ed07[_0x263e55][_0x23c3('0x72')]){_0x4fa4c8['group'](_0x45f5ef);}_0x26ed07[_0x263e55][_0x23c3('0x74')]&&_0x4fa4c8['order'](_0x45f5ef,_0x26ed07[_0x263e55]['orderBy']===_0x23c3('0x75')?![]:!![]);_0x4fa4c8[_0x23c3('0x66')](_0x45f5ef,_0x26ed07[_0x263e55][_0x23c3('0x76')]||_0x45f5ef);}if(_0x2b940c[_0x23c3('0x77')]){_0x2b940c[_0x23c3('0x77')]=JSON[_0x23c3('0x78')](_0x2b940c[_0x23c3('0x77')]);for(var _0xc24eae=0x0;_0xc24eae<_0x2b940c['joins'][_0x23c3('0x3b')];_0xc24eae+=0x1){if(_0x2b940c[_0x23c3('0x77')][_0xc24eae][_0x23c3('0x34')]&&_[_0x23c3('0x5f')](_0x59bd3f,_0x2b940c[_0x23c3('0x77')][_0xc24eae]['type'])&&_0x2b940c['joins'][_0xc24eae][_0x23c3('0x79')]&&_0x2b940c[_0x23c3('0x77')][_0xc24eae][_0x23c3('0x7a')]&&_0x2b940c[_0x23c3('0x77')][_0xc24eae][_0x23c3('0x7b')]){_0x4fa4c8[_0x2b940c[_0x23c3('0x77')][_0xc24eae][_0x23c3('0x34')]](_0x2b940c[_0x23c3('0x77')][_0xc24eae][_0x23c3('0x7a')],null,util[_0x23c3('0x71')]('%s.%s\x20=\x20%s.%s',_0x2b940c[_0x23c3('0x8c')],_0x2b940c[_0x23c3('0x77')][_0xc24eae][_0x23c3('0x79')],_0x2b940c[_0x23c3('0x77')][_0xc24eae]['foreignTable'],_0x2b940c['joins'][_0xc24eae][_0x23c3('0x7b')]));}}}if(_0x2b940c['conditions']){_0x2b940c[_0x23c3('0x7d')]=JSON[_0x23c3('0x78')](_0x2b940c[_0x23c3('0x7d')]);_0x4fa4c8[_0x23c3('0x40')](_0x27ae68(_0x2b940c[_0x23c3('0x7d')][_0x23c3('0x73')]));}_0xe4fbcb=_0x4fa4c8[_0x23c3('0x7e')]();_0x4fa4c8['limit'](_0x3e8278);_0x4fa4c8[_0x23c3('0x1e')](0x0);logger[_0x23c3('0x9f')](_0x23c3('0x7f'),_0x4fa4c8[_0x23c3('0x80')]());return dbH[_0x23c3('0x81')][_0x23c3('0x37')](_0x4fa4c8[_0x23c3('0x80')](),{'type':dbH[_0x23c3('0x81')][_0x23c3('0x82')][_0x23c3('0x83')]});}})['then'](function(){return{'sql':_0xe4fbcb[_0x23c3('0x80')]()};})[_0x23c3('0x26')](respondWithResult(_0x327b00,null))[_0x23c3('0x49')](handleError(_0x327b00,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 09720f6..4d19288 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 _0x815e=['path','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x40f070,_0xcadfa2){var _0x168220=function(_0x24d2f4){while(--_0x24d2f4){_0x40f070['push'](_0x40f070['shift']());}};_0x168220(++_0xcadfa2);}(_0x815e,0x165));var _0xe815=function(_0x4365fc,_0x3165c2){_0x4365fc=_0x4365fc-0x0;var _0x246d0e=_0x815e[_0x4365fc];return _0x246d0e;};'use strict';var _=require(_0xe815('0x0'));var util=require(_0xe815('0x1'));var logger=require(_0xe815('0x2'))(_0xe815('0x3'));var moment=require(_0xe815('0x4'));var BPromise=require(_0xe815('0x5'));var rp=require(_0xe815('0x6'));var fs=require('fs');var path=require(_0xe815('0x7'));var rimraf=require(_0xe815('0x8'));var config=require('../../config/environment');var attributes=require(_0xe815('0x9'));module[_0xe815('0xa')]=function(_0xd7d77c,_0x52fb30){return _0xd7d77c[_0xe815('0xb')](_0xe815('0xc'),attributes,{'tableName':_0xe815('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdde5=['moment','bluebird','path','rimraf','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api'];(function(_0x18f152,_0x41585a){var _0xa10b34=function(_0x1e9798){while(--_0x1e9798){_0x18f152['push'](_0x18f152['shift']());}};_0xa10b34(++_0x41585a);}(_0xdde5,0xe4));var _0x5dde=function(_0x2bd88d,_0x2d5dc3){_0x2bd88d=_0x2bd88d-0x0;var _0x5516d4=_0xdde5[_0x2bd88d];return _0x5516d4;};'use strict';var _=require('lodash');var util=require(_0x5dde('0x0'));var logger=require(_0x5dde('0x1'))(_0x5dde('0x2'));var moment=require(_0x5dde('0x3'));var BPromise=require(_0x5dde('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5dde('0x5'));var rimraf=require(_0x5dde('0x6'));var config=require('../../config/environment');var attributes=require(_0x5dde('0x7'));module[_0x5dde('0x8')]=function(_0x1e8d17,_0x477be6){return _0x1e8d17['define'](_0x5dde('0x9'),attributes,{'tableName':_0x5dde('0xa'),'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 4a2134d..45bdca0 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 _0x4d76=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x4d76,0xd2));var _0x64d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d76[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x64d7('0x0'));var moment=require(_0x64d7('0x1'));var BPromise=require('bluebird');var rs=require(_0x64d7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64d7('0x3'))['db'];var utils=require(_0x64d7('0x4'));var logger=require(_0x64d7('0x5'))(_0x64d7('0x6'));var config=require(_0x64d7('0x7'));var jayson=require(_0x64d7('0x8'));var client=jayson[_0x64d7('0x9')][_0x64d7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29c536,_0x40899c,_0x12693c){return new BPromise(function(_0x560567,_0x5de231){return client[_0x64d7('0xb')](_0x29c536,_0x12693c)['then'](function(_0x3f6b5f){logger[_0x64d7('0xc')](_0x64d7('0xd'),_0x40899c,_0x64d7('0xe'));logger['debug'](_0x64d7('0xf'),_0x40899c,_0x64d7('0xe'),JSON[_0x64d7('0x10')](_0x3f6b5f));if(_0x3f6b5f[_0x64d7('0x11')]){if(_0x3f6b5f[_0x64d7('0x11')][_0x64d7('0x12')]===0x1f4){logger[_0x64d7('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x40899c,_0x3f6b5f[_0x64d7('0x11')][_0x64d7('0x13')]);return _0x5de231(_0x3f6b5f[_0x64d7('0x11')][_0x64d7('0x13')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x40899c,_0x3f6b5f[_0x64d7('0x11')][_0x64d7('0x13')]);return _0x560567(_0x3f6b5f[_0x64d7('0x11')][_0x64d7('0x13')]);}else{logger['info'](_0x64d7('0xd'),_0x40899c,'request\x20sent');_0x560567(_0x3f6b5f['result'][_0x64d7('0x13')]);}})[_0x64d7('0x14')](function(_0x52dbcf){logger[_0x64d7('0x11')](_0x64d7('0xd'),_0x40899c,_0x52dbcf);_0x5de231(_0x52dbcf);});});} \ No newline at end of file +var _0xd815=['then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4ebbea,_0x21d241){var _0x13c4b7=function(_0x48bbb5){while(--_0x48bbb5){_0x4ebbea['push'](_0x4ebbea['shift']());}};_0x13c4b7(++_0x21d241);}(_0xd815,0x83));var _0x5d81=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd815[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5d81('0x0'));var util=require(_0x5d81('0x1'));var moment=require(_0x5d81('0x2'));var BPromise=require('bluebird');var rs=require(_0x5d81('0x3'));var fs=require('fs');var Redis=require(_0x5d81('0x4'));var db=require(_0x5d81('0x5'))['db'];var utils=require(_0x5d81('0x6'));var logger=require('../../config/logger')(_0x5d81('0x7'));var config=require(_0x5d81('0x8'));var jayson=require(_0x5d81('0x9'));var client=jayson[_0x5d81('0xa')][_0x5d81('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f2ee1,_0xcbd47b,_0x43dd8e){return new BPromise(function(_0x3d0edd,_0x1f44db){return client[_0x5d81('0xc')](_0x2f2ee1,_0x43dd8e)[_0x5d81('0xd')](function(_0x261dd6){logger[_0x5d81('0xe')](_0x5d81('0xf'),_0xcbd47b,'request\x20sent');logger[_0x5d81('0x10')](_0x5d81('0x11'),_0xcbd47b,_0x5d81('0x12'),JSON['stringify'](_0x261dd6));if(_0x261dd6[_0x5d81('0x13')]){if(_0x261dd6[_0x5d81('0x13')][_0x5d81('0x14')]===0x1f4){logger[_0x5d81('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0xcbd47b,_0x261dd6[_0x5d81('0x13')][_0x5d81('0x15')]);return _0x1f44db(_0x261dd6[_0x5d81('0x13')][_0x5d81('0x15')]);}logger[_0x5d81('0x13')](_0x5d81('0xf'),_0xcbd47b,_0x261dd6[_0x5d81('0x13')]['message']);return _0x3d0edd(_0x261dd6['error'][_0x5d81('0x15')]);}else{logger[_0x5d81('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0xcbd47b,_0x5d81('0x12'));_0x3d0edd(_0x261dd6[_0x5d81('0x16')][_0x5d81('0x15')]);}})[_0x5d81('0x17')](function(_0x3bef71){logger[_0x5d81('0x13')](_0x5d81('0xf'),_0xcbd47b,_0x3bef71);_0x1f44db(_0x3bef71);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 3bc0600..30c0ce4 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 _0x0cab=['post','create','update','exports','util','connect-timeout','Router','../../components/interaction/service','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query'];(function(_0x291cd4,_0x44288d){var _0x3bc45c=function(_0x8011cc){while(--_0x8011cc){_0x291cd4['push'](_0x291cd4['shift']());}};_0x3bc45c(++_0x44288d);}(_0x0cab,0x1f2));var _0xb0ca=function(_0x4baeec,_0x156ecf){_0x4baeec=_0x4baeec-0x0;var _0x39fbb0=_0x0cab[_0x4baeec];return _0x39fbb0;};'use strict';var multer=require('multer');var util=require(_0xb0ca('0x0'));var path=require('path');var timeout=require(_0xb0ca('0x1'));var express=require('express');var router=express[_0xb0ca('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb0ca('0x3'));var config=require('../../config/environment');var controller=require(_0xb0ca('0x4'));router['get']('/',auth[_0xb0ca('0x5')](),controller[_0xb0ca('0x6')]);router[_0xb0ca('0x7')](_0xb0ca('0x8'),auth[_0xb0ca('0x5')](),controller[_0xb0ca('0x9')]);router[_0xb0ca('0x7')](_0xb0ca('0xa'),auth[_0xb0ca('0x5')](),controller[_0xb0ca('0xb')]);router[_0xb0ca('0x7')](_0xb0ca('0xc'),auth[_0xb0ca('0x5')](),controller['run']);router[_0xb0ca('0x7')](_0xb0ca('0xd'),auth[_0xb0ca('0x5')](),controller[_0xb0ca('0xe')]);router[_0xb0ca('0xf')]('/',auth[_0xb0ca('0x5')](),controller[_0xb0ca('0x10')]);router['put']('/:id',auth[_0xb0ca('0x5')](),controller[_0xb0ca('0x11')]);router['delete']('/:id',auth[_0xb0ca('0x5')](),controller['destroy']);module[_0xb0ca('0x12')]=router; \ No newline at end of file +var _0xcdd0=['show','/:id/preview','preview','/:id/run','run','post','create','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x46634f,_0xa89aa6){var _0x5d0a01=function(_0x1f5f9c){while(--_0x1f5f9c){_0x46634f['push'](_0x46634f['shift']());}};_0x5d0a01(++_0xa89aa6);}(_0xcdd0,0x1d8));var _0x0cdd=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xcdd0[_0x2df507];return _0x1f7167;};'use strict';var multer=require(_0x0cdd('0x0'));var util=require(_0x0cdd('0x1'));var path=require('path');var timeout=require(_0x0cdd('0x2'));var express=require(_0x0cdd('0x3'));var router=express[_0x0cdd('0x4')]();var fs_extra=require(_0x0cdd('0x5'));var auth=require(_0x0cdd('0x6'));var interaction=require(_0x0cdd('0x7'));var config=require(_0x0cdd('0x8'));var controller=require('./analyticCustomReport.controller');router[_0x0cdd('0x9')]('/',auth[_0x0cdd('0xa')](),controller['index']);router[_0x0cdd('0x9')](_0x0cdd('0xb'),auth[_0x0cdd('0xa')](),controller[_0x0cdd('0xc')]);router[_0x0cdd('0x9')](_0x0cdd('0xd'),auth[_0x0cdd('0xa')](),controller[_0x0cdd('0xe')]);router[_0x0cdd('0x9')](_0x0cdd('0xf'),auth[_0x0cdd('0xa')](),controller[_0x0cdd('0x10')]);router[_0x0cdd('0x9')]('/:id/query',auth[_0x0cdd('0xa')](),controller['query']);router[_0x0cdd('0x11')]('/',auth[_0x0cdd('0xa')](),controller[_0x0cdd('0x12')]);router['put'](_0x0cdd('0xb'),auth[_0x0cdd('0xa')](),controller[_0x0cdd('0x13')]);router['delete'](_0x0cdd('0xb'),auth['isAuthenticated'](),controller[_0x0cdd('0x14')]);module[_0x0cdd('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 0a76989..7e4b1c8 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 _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x41413a,_0xbd7ec6){var _0x3c3321=function(_0x493773){while(--_0x493773){_0x41413a['push'](_0x41413a['shift']());}};_0x3c3321(++_0xbd7ec6);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7df('0x2')]},'parent':{'type':Sequelize[_0xd7df('0x2')]},'table':{'type':Sequelize[_0xd7df('0x2')]},'conditions':{'type':Sequelize[_0xd7df('0x3')]},'joins':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file +var _0x1883=['exports','STRING','TEXT','sequelize'];(function(_0x2a1f67,_0xcf91dd){var _0x468cc2=function(_0x36ccd8){while(--_0x36ccd8){_0x2a1f67['push'](_0x2a1f67['shift']());}};_0x468cc2(++_0xcf91dd);}(_0x1883,0xab));var _0x3188=function(_0x5ef76e,_0x585045){_0x5ef76e=_0x5ef76e-0x0;var _0x5399a1=_0x1883[_0x5ef76e];return _0x5399a1;};'use strict';var Sequelize=require(_0x3188('0x0'));module[_0x3188('0x1')]={'name':{'type':Sequelize[_0x3188('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3188('0x2')]},'parent':{'type':Sequelize[_0x3188('0x2')]},'table':{'type':Sequelize[_0x3188('0x2')]},'conditions':{'type':Sequelize[_0x3188('0x3')]},'joins':{'type':Sequelize[_0x3188('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 02dbf58..fc95335 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 _0xc4aa=['Content-Range','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','AnalyticDefaultReport','findAll','rows','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','MAX(%s)','AVG(%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','groupBy','alias','includes','foreignKey','output','web','fullPath','%s-%s.%s','randomstring','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','fork','countTable','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xc4aa[_0x3b0731];return _0x4204d7;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];var dbH=require(_0xac4a('0x16'))['dbH'];function respondWithStatusCode(_0x21a79,_0x68424a){_0x68424a=_0x68424a||0xcc;return function(_0x247b78){if(_0x247b78){return _0x21a79[_0xac4a('0x17')](_0x68424a);}return _0x21a79[_0xac4a('0x18')](_0x68424a)[_0xac4a('0x19')]();};}function respondWithResult(_0x34bc01,_0x33c287){_0x33c287=_0x33c287||0xc8;return function(_0x190418){if(_0x190418){return _0x34bc01[_0xac4a('0x18')](_0x33c287)[_0xac4a('0x1a')](_0x190418);}};}function respondWithFilteredResult(_0x26dbb8,_0x4a2119){return function(_0x402fff){if(_0x402fff){var _0x34d797=typeof _0x4a2119[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x4a2119[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x28e304=_0x402fff[_0xac4a('0x1e')];var _0x546c5d=_0x34d797?0x0:_0x4a2119['offset'];var _0x21a729=_0x34d797?_0x402fff[_0xac4a('0x1e')]:_0x4a2119[_0xac4a('0x1b')]+_0x4a2119['limit'];var _0x39e83e;if(_0x21a729>=_0x28e304){_0x21a729=_0x28e304;_0x39e83e=0xc8;}else{_0x39e83e=0xce;}_0x26dbb8[_0xac4a('0x18')](_0x39e83e);return _0x26dbb8[_0xac4a('0x1f')](_0xac4a('0x20'),_0x546c5d+'-'+_0x21a729+'/'+_0x28e304)[_0xac4a('0x1a')](_0x402fff);}return null;};}function patchUpdates(_0x3e829c){return function(_0xe38996){try{jsonpatch[_0xac4a('0x21')](_0xe38996,_0x3e829c,!![]);}catch(_0x534092){return BPromise[_0xac4a('0x22')](_0x534092);}return _0xe38996[_0xac4a('0x23')]();};}function saveUpdates(_0x599787,_0x3d7ce0){return function(_0x4169c0){if(_0x4169c0){return _0x4169c0[_0xac4a('0x24')](_0x599787)[_0xac4a('0x25')](function(_0x4d2d6c){return _0x4d2d6c;});}return null;};}function removeEntity(_0x1b7998,_0x2503d8){return function(_0x15435c){if(_0x15435c){return _0x15435c[_0xac4a('0x26')]()[_0xac4a('0x25')](function(){var _0x2b0dc2=_0x15435c[_0xac4a('0x27')]({'plain':!![]});var _0x36054a=_0xac4a('0x28');return db[_0xac4a('0x29')][_0xac4a('0x26')]({'where':{'type':_0x36054a,'resourceId':_0x2b0dc2['id']}})[_0xac4a('0x25')](function(){return _0x15435c;});})[_0xac4a('0x25')](function(){_0x1b7998[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x20202c,_0x4e17ce){return function(_0x23b061){if(!_0x23b061){_0x20202c[_0xac4a('0x17')](0x194);}return _0x23b061;};}function handleError(_0x42a33c,_0x2772fe){_0x2772fe=_0x2772fe||0x1f4;return function(_0x116700){logger['error'](_0x116700['stack']);if(_0x116700[_0xac4a('0x2a')]){delete _0x116700[_0xac4a('0x2a')];}_0x42a33c[_0xac4a('0x18')](_0x2772fe)['send'](_0x116700);};}exports['index']=function(_0x355755,_0x2896bc){var _0x228629={},_0x432066={},_0x17118e={'count':0x0,'rows':[]};var _0x53d3a5=_[_0xac4a('0x2b')](db['AnalyticDefaultReport'][_0xac4a('0x2c')],function(_0x57adcf){return{'name':_0x57adcf[_0xac4a('0x2d')],'type':_0x57adcf[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x432066[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0x53d3a5,_0xac4a('0x2a'));_0x432066[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x355755[_0xac4a('0x31')]);_0x432066[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x432066[_0xac4a('0x30')],_0x432066[_0xac4a('0x31')]);_0x228629[_0xac4a('0x35')]=_['intersection'](_0x432066[_0xac4a('0x30')],qs[_0xac4a('0x36')](_0x355755['query'][_0xac4a('0x36')]));_0x228629[_0xac4a('0x35')]=_0x228629['attributes']['length']?_0x228629[_0xac4a('0x35')]:_0x432066[_0xac4a('0x30')];if(!_0x355755[_0xac4a('0x31')][_0xac4a('0x37')]('nolimit')){_0x228629[_0xac4a('0x1d')]=qs[_0xac4a('0x1d')](_0x355755['query'][_0xac4a('0x1d')]);_0x228629[_0xac4a('0x1b')]=qs[_0xac4a('0x1b')](_0x355755['query'][_0xac4a('0x1b')]);}_0x228629[_0xac4a('0x38')]=qs[_0xac4a('0x39')](_0x355755['query'][_0xac4a('0x39')]);_0x228629[_0xac4a('0x3a')]=qs['filters'](_['pick'](_0x355755[_0xac4a('0x31')],_0x432066['filters']),_0x53d3a5);if(_0x355755['query']['filter']){_0x228629['where']=_[_0xac4a('0x3b')](_0x228629[_0xac4a('0x3a')],{'$or':_[_0xac4a('0x2b')](_0x53d3a5,function(_0x472484){if(_0x472484[_0xac4a('0x2e')]!==_0xac4a('0x3c')){var _0x4220e2={};_0x4220e2[_0x472484[_0xac4a('0x2a')]]={'$like':'%'+_0x355755[_0xac4a('0x31')][_0xac4a('0x3d')]+'%'};return _0x4220e2;}})});}_0x228629=_[_0xac4a('0x3b')]({},_0x228629,_0x355755[_0xac4a('0x3e')]);var _0x4e4994={'where':_0x228629['where']};return db['AnalyticDefaultReport'][_0xac4a('0x1e')](_0x4e4994)[_0xac4a('0x25')](function(_0x14e80b){_0x17118e[_0xac4a('0x1e')]=_0x14e80b;if(_0x355755[_0xac4a('0x31')][_0xac4a('0x3f')]){_0x228629[_0xac4a('0x40')]=[{'all':!![]}];}return db[_0xac4a('0x41')][_0xac4a('0x42')](_0x228629);})[_0xac4a('0x25')](function(_0x561cb7){_0x17118e[_0xac4a('0x43')]=_0x561cb7;return _0x17118e;})[_0xac4a('0x25')](respondWithFilteredResult(_0x2896bc,_0x228629))[_0xac4a('0x44')](handleError(_0x2896bc,null));};exports[_0xac4a('0x45')]=function(_0x1a96cf,_0x57b879){var _0x8700b4={'raw':!![],'where':{'id':_0x1a96cf['params']['id']}},_0x1b77bb={};_0x1b77bb[_0xac4a('0x30')]=_['keys'](db[_0xac4a('0x41')][_0xac4a('0x2c')]);_0x1b77bb[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x1a96cf[_0xac4a('0x31')]);_0x1b77bb[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],_0x1b77bb[_0xac4a('0x31')]);_0x8700b4[_0xac4a('0x35')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],qs['fields'](_0x1a96cf[_0xac4a('0x31')][_0xac4a('0x36')]));_0x8700b4[_0xac4a('0x35')]=_0x8700b4['attributes'][_0xac4a('0x46')]?_0x8700b4[_0xac4a('0x35')]:_0x1b77bb['model'];if(_0x1a96cf[_0xac4a('0x31')]['includeAll']){_0x8700b4[_0xac4a('0x40')]=[{'all':!![]}];}_0x8700b4=_[_0xac4a('0x3b')]({},_0x8700b4,_0x1a96cf[_0xac4a('0x3e')]);return db['AnalyticDefaultReport']['find'](_0x8700b4)[_0xac4a('0x25')](handleEntityNotFound(_0x57b879,null))['then'](respondWithResult(_0x57b879,null))[_0xac4a('0x44')](handleError(_0x57b879,null));};exports['create']=function(_0x3d2aaf,_0x530bbb){return db[_0xac4a('0x41')][_0xac4a('0x47')](_0x3d2aaf[_0xac4a('0x48')],{})[_0xac4a('0x25')](function(_0x54782f){var _0x31c794=_0x3d2aaf[_0xac4a('0x49')][_0xac4a('0x27')]({'plain':!![]});if(!_0x31c794)throw new Error(_0xac4a('0x4a'));if(_0x31c794[_0xac4a('0x4b')]===_0xac4a('0x49')){var _0x187306=_0x54782f['get']({'plain':!![]});var _0x35dee5=_0xac4a('0x4c');return db['UserProfileSection'][_0xac4a('0x4d')]({'where':{'name':_0x35dee5,'userProfileId':_0x31c794[_0xac4a('0x4e')]},'raw':!![]})[_0xac4a('0x25')](function(_0x3ac36e){if(_0x3ac36e&&_0x3ac36e['autoAssociation']===0x0){return db[_0xac4a('0x29')][_0xac4a('0x47')]({'name':_0x187306[_0xac4a('0x2a')],'resourceId':_0x187306['id'],'type':_0xac4a('0x28'),'sectionId':_0x3ac36e['id']},{})[_0xac4a('0x25')](function(){return _0x54782f;});}else{return _0x54782f;}})['catch'](function(_0x179373){logger['error'](_0xac4a('0x4f'),_0x179373);throw _0x179373;});}return _0x54782f;})[_0xac4a('0x25')](respondWithResult(_0x530bbb,0xc9))['catch'](handleError(_0x530bbb,null));};exports['update']=function(_0x437466,_0x70fdc3){if(_0x437466['body']['id']){delete _0x437466[_0xac4a('0x48')]['id'];}return db[_0xac4a('0x41')][_0xac4a('0x4d')]({'where':{'id':_0x437466[_0xac4a('0x50')]['id']}})['then'](handleEntityNotFound(_0x70fdc3,null))[_0xac4a('0x25')](saveUpdates(_0x437466[_0xac4a('0x48')],null))[_0xac4a('0x25')](respondWithResult(_0x70fdc3,null))[_0xac4a('0x44')](handleError(_0x70fdc3,null));};exports[_0xac4a('0x26')]=function(_0x411547,_0x36179a){return db['AnalyticDefaultReport'][_0xac4a('0x4d')]({'where':{'id':_0x411547[_0xac4a('0x50')]['id']}})[_0xac4a('0x25')](handleEntityNotFound(_0x36179a,null))[_0xac4a('0x25')](removeEntity(_0x36179a,null))[_0xac4a('0x44')](handleError(_0x36179a,null));};exports[_0xac4a('0x51')]=function(_0x213df2,_0x236f57){var _0x159e43=0xa;var _0x786d9=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x5222f3={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xac4a('0x57'),'MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x5cac9b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x2f9940=function(_0xb7b884){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),'IS\x20NOT\x20EMPTY'],_0xb7b884);};var _0x347880=function(_0x19ce2c){if(!_0x19ce2c||!_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x429273='(',_0x2bc39a=0x0;_0x2bc39a<_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')];_0x2bc39a+=0x1){_0x2bc39a>0x0&&(_0x429273+='\x20'+_0x19ce2c[_0xac4a('0x62')]+'\x20');_0x429273+=_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]?_0x347880(_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]):_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x64')]+'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x65')]+(_0x2f9940(_0x19ce2c['rules'][_0x2bc39a][_0xac4a('0x65')])?'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a]['value']:'');}return _0x429273+')';};var _0x3c3576={'where':{'id':_0x213df2['params']['id']}},_0x34bd1c,_0x2d24c7,_0x2b8562,_0x357cac,_0x4d1440;_0x3c3576=_[_0xac4a('0x3b')]({},_0x3c3576,_0x213df2[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x3c3576)[_0xac4a('0x25')](function(_0x21ef8b){if(_0x21ef8b){_0x34bd1c=_0x21ef8b;return _0x21ef8b[_0xac4a('0x66')]();}return null;})[_0xac4a('0x25')](function(_0x44c60b){if(_0x44c60b){if(!_0x44c60b[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d24c7=_0x44c60b;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x423f70){if(_0x423f70){_0x2b8562=_[_0xac4a('0x69')](_0x423f70,'id');var _0x283107;var _0x1d24bb=squel[_0xac4a('0x6a')]();_0x1d24bb[_0xac4a('0x6b')](_0x34bd1c[_0xac4a('0x6c')]);for(var _0xb09b89=0x0;_0xb09b89<_0x2d24c7[_0xac4a('0x46')];_0xb09b89+=0x1){_0x283107=_0x2d24c7[_0xb09b89]['MetricId']?_0x2b8562[_0x2d24c7[_0xb09b89][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x2d24c7[_0xb09b89][_0xac4a('0x64')];_0x283107=_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]?_['replace'](_0x5222f3[_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]],'%s',_0x283107):_0x283107;_0x283107=_0x2d24c7[_0xb09b89]['format']?_[_0xac4a('0x70')](_0x5cac9b[_0x2d24c7[_0xb09b89][_0xac4a('0x71')]],'%s',_0x283107):_0x283107;if(_0x2d24c7[_0xb09b89]['groupBy']){_0x1d24bb['group'](_0x283107);}_0x2d24c7[_0xb09b89][_0xac4a('0x72')]&&_0x1d24bb[_0xac4a('0x38')](_0x283107,_0x2d24c7[_0xb09b89][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x1d24bb[_0xac4a('0x64')](_0x283107,_0x2d24c7[_0xb09b89]['alias']||_0x283107);}if(_0x34bd1c[_0xac4a('0x73')]){_0x34bd1c['joins']=JSON['parse'](_0x34bd1c[_0xac4a('0x73')]);for(var _0x56ef2a=0x0;_0x56ef2a<_0x34bd1c[_0xac4a('0x73')]['length'];_0x56ef2a+=0x1){if(_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x2e')]&&_['includes'](_0x786d9,_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type'])&&_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x74')]&&_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')]&&_0x34bd1c['joins'][_0x56ef2a]['foreignKey']){_0x1d24bb[_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type']](_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignTable'],null,util['format'](_0xac4a('0x76'),_0x34bd1c[_0xac4a('0x6c')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['parentKey'],_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignKey']));}}}if(_0x34bd1c['conditions']){_0x34bd1c[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x34bd1c[_0xac4a('0x77')]);_0x1d24bb[_0xac4a('0x3a')](_0x347880(_0x34bd1c[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x4d1440=_0x1d24bb[_0xac4a('0x79')]();_0x1d24bb[_0xac4a('0x1d')](_0x159e43);_0x1d24bb[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x1d24bb[_0xac4a('0x7b')]());return dbH[_0xac4a('0x7c')]['query'](_0x1d24bb[_0xac4a('0x7b')](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')][_0xac4a('0x7e')]});}})[_0xac4a('0x25')](respondWithResult(_0x236f57,null))['catch'](handleError(_0x236f57,null));};function runReport(_0x290a73,_0x19ce24,_0xc9d040){var _0x37e519=_0x19ce24[_0xac4a('0x2a')];var _0x451248=0xa;var _0xd7bdd6=['join',_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x35a97c={'SUM':_0xac4a('0x56'),'COUNT':_0xac4a('0x7f'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xac4a('0x80'),'MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x56a934={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x212a22=function(_0x1fe86a){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),_0xac4a('0x83')],_0x1fe86a);};var _0x406b64=function(_0x35328e){if(!_0x35328e||!_0x35328e[_0xac4a('0x61')]['length']){return'';}for(var _0x50f471='(',_0x31cda0=0x0;_0x31cda0<_0x35328e[_0xac4a('0x61')][_0xac4a('0x46')];_0x31cda0+=0x1){_0x31cda0>0x0&&(_0x50f471+='\x20'+_0x35328e[_0xac4a('0x62')]+'\x20');_0x50f471+=_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]?_0x406b64(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]):_0x35328e['rules'][_0x31cda0]['field']+'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')]+(_0x212a22(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')])?'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x84')]:'');}return _0x50f471+')';};var _0xdaa2ef={'where':{'id':_0x290a73['id']}},_0x2e704b,_0x540d8e,_0x5e0be4,_0x32fd0c,_0x168f30;_0xdaa2ef=_[_0xac4a('0x3b')]({},_0xdaa2ef,_0xc9d040);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0xdaa2ef)[_0xac4a('0x25')](function(_0x338af3){if(_0x338af3){_0x2e704b=_0x338af3;return _0x338af3['getFields']();}return null;})[_0xac4a('0x25')](function(_0x1bacf2){if(_0x1bacf2){if(!_0x1bacf2[_0xac4a('0x46')]){throw new db['Sequelize'][(_0xac4a('0x85'))](_0xac4a('0x86'),0x193);}_0x540d8e=_0x1bacf2;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x27d023){if(_0x27d023){_0x5e0be4=_[_0xac4a('0x69')](_0x27d023,'id');var _0x2ef42a;var _0x322465=squel['select']();_0x322465[_0xac4a('0x6b')](_0x2e704b['table']);for(var _0x203321=0x0;_0x203321<_0x540d8e[_0xac4a('0x46')];_0x203321+=0x1){_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6d')]?_0x5e0be4[_0x540d8e[_0x203321][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x540d8e[_0x203321][_0xac4a('0x64')];_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6f')]?_['replace'](_0x35a97c[_0x540d8e[_0x203321][_0xac4a('0x6f')]],'%s',_0x2ef42a):_0x2ef42a;_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x71')]?_[_0xac4a('0x70')](_0x56a934[_0x540d8e[_0x203321][_0xac4a('0x71')]],'%s',_0x2ef42a):_0x2ef42a;if(_0x540d8e[_0x203321][_0xac4a('0x87')]){_0x322465['group'](_0x2ef42a);}_0x540d8e[_0x203321][_0xac4a('0x72')]&&_0x322465[_0xac4a('0x38')](_0x2ef42a,_0x540d8e[_0x203321]['orderBy']==='DESC'?![]:!![]);_0x322465[_0xac4a('0x64')](_0x2ef42a,_0x540d8e[_0x203321][_0xac4a('0x88')]||_0x2ef42a);}if(_0x2e704b['joins']){_0x2e704b[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x73')]);for(var _0x37657e=0x0;_0x37657e<_0x2e704b[_0xac4a('0x73')][_0xac4a('0x46')];_0x37657e+=0x1){if(_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]&&_[_0xac4a('0x89')](_0xd7bdd6,_0x2e704b[_0xac4a('0x73')][_0x37657e]['type'])&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x74')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x75')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x8a')]){_0x322465[_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]](_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],null,util[_0xac4a('0x71')]('%s.%s\x20=\x20%s.%s',_0x2e704b[_0xac4a('0x6c')],_0x2e704b[_0xac4a('0x73')][_0x37657e]['parentKey'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignKey']));}}}if(_0x2e704b[_0xac4a('0x77')]){_0x2e704b[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x77')]);_0x322465[_0xac4a('0x3a')](_0x406b64(_0x2e704b[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x168f30=_0x322465[_0xac4a('0x79')]();_0x322465[_0xac4a('0x1d')](_0x451248);_0x322465[_0xac4a('0x1b')](0x0);return;}})[_0xac4a('0x25')](function(){if(_0x19ce24[_0xac4a('0x8b')]===_0xac4a('0x8c')){return null;}var _0x4217df=_['merge'](_0x19ce24,{'name':_0x19ce24[_0xac4a('0x8d')]||_0x19ce24[_0xac4a('0x2a')]||_0x2e704b['name'],'basename':_0x37e519,'savename':util[_0xac4a('0x71')](_0xac4a('0x8e'),_0x19ce24[_0xac4a('0x2a')]||_0x2e704b[_0xac4a('0x2a')],require(_0xac4a('0x8f'))['generate'](0x4),_0x19ce24[_0xac4a('0x8b')]||'csv'),'reportId':_0x2e704b['id'],'reportType':_0xac4a('0x90')});return db[_0xac4a('0x91')][_0xac4a('0x47')](_0x4217df,{'raw':!![]});})[_0xac4a('0x25')](function(_0x53f23d){if(_0x2e704b[_0xac4a('0x6c')]==='cdr'){_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+_0xac4a('0x92'),_0x19ce24['startDate'],_0x19ce24[_0xac4a('0x93')]);}else{_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x19ce24[_0xac4a('0x94')],_0x19ce24[_0xac4a('0x93')]);}if(_0x53f23d){logger[_0xac4a('0x95')](_0xac4a('0x96'),_0x168f30[_0xac4a('0x7b')]());require(_0xac4a('0x97'))[_0xac4a('0x98')](path[_0xac4a('0x52')](__dirname,'../../components/export/',_0x53f23d[_0xac4a('0x8b')]),[_0x53f23d['id'],_0x168f30['toString'](),path['join'](__dirname,'../../files/reports',_0x53f23d['savename']),_0x37e519]);return _0x53f23d;}else{var _0x502275=squel[_0xac4a('0x6a')]();_0x502275[_0xac4a('0x6b')]('('+_0x168f30[_0xac4a('0x7b')]()+')',_0xac4a('0x99'));_0x502275[_0xac4a('0x64')]('COUNT(*)',_0xac4a('0x1e'));_0x168f30[_0xac4a('0x1d')](_0x19ce24[_0xac4a('0x1d')]||_0x451248);_0x168f30[_0xac4a('0x1b')](_0x19ce24[_0xac4a('0x1b')]||0x0);return dbH[_0xac4a('0x7c')][_0xac4a('0x31')](_0x502275[_0xac4a('0x7b')](),{'type':dbH['sequelize'][_0xac4a('0x7d')][_0xac4a('0x7e')]})[_0xac4a('0x25')](function(_0x25331f){if(!_0x25331f[_0xac4a('0x46')]){_0x32fd0c=0x0;}else{_0x32fd0c=_0x25331f[0x0][_0xac4a('0x1e')]||0x0;}return dbH[_0xac4a('0x7c')]['query'](_0x168f30['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});})[_0xac4a('0x25')](function(_0x366f5a){return{'rows':_0x366f5a||[],'count':_0x32fd0c};});}});}exports['run']=function(_0x5bd013,_0x2fe103){return runReport(_0x5bd013[_0xac4a('0x50')],_0x5bd013[_0xac4a('0x31')],_0x5bd013[_0xac4a('0x3e')])[_0xac4a('0x25')](respondWithResult(_0x2fe103,null))['catch'](handleError(_0x2fe103,null));};exports[_0xac4a('0x9a')]=runReport;exports['query']=function(_0x4f2d85,_0x538cfd){var _0x63c30=0xa;var _0x4301c3=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0xcad25d={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':_0xac4a('0x9b'),'GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0xcd140e={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x37cb49=function(_0xe0fd57){return!_[_0xac4a('0x89')]([_0xac4a('0x5f'),_0xac4a('0x9c'),_0xac4a('0x60'),_0xac4a('0x83')],_0xe0fd57);};var _0x41cdb5=function(_0x172d03){if(!_0x172d03||!_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x3e2575='(',_0x4cc581=0x0;_0x4cc581<_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')];_0x4cc581+=0x1){_0x4cc581>0x0&&(_0x3e2575+='\x20'+_0x172d03[_0xac4a('0x62')]+'\x20');_0x3e2575+=_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]?_0x41cdb5(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]):_0x172d03[_0xac4a('0x61')][_0x4cc581]['field']+'\x20'+_0x172d03['rules'][_0x4cc581][_0xac4a('0x65')]+(_0x37cb49(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x65')])?'\x20'+_0x172d03['rules'][_0x4cc581]['value']:'');}return _0x3e2575+')';};var _0x5de198={'where':{'id':_0x4f2d85[_0xac4a('0x50')]['id']}},_0x2b6773,_0x52df82,_0x59e82c,_0x216055,_0x52963c;_0x5de198=_['merge']({},_0x5de198,_0x4f2d85[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x5de198)[_0xac4a('0x25')](function(_0x403a16){if(_0x403a16){_0x2b6773=_0x403a16;return _0x403a16[_0xac4a('0x66')]();}return null;})['then'](function(_0x25bf23){if(_0x25bf23){if(!_0x25bf23[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem'](_0xac4a('0x86'),0x193);}_0x52df82=_0x25bf23;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x5bb911){if(_0x5bb911){_0x59e82c=_[_0xac4a('0x69')](_0x5bb911,'id');var _0x403f5a;var _0x3eae2f=squel[_0xac4a('0x6a')]();_0x3eae2f[_0xac4a('0x6b')](_0x2b6773[_0xac4a('0x6c')]);for(var _0x4a0cd9=0x0;_0x4a0cd9<_0x52df82['length'];_0x4a0cd9+=0x1){_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]?_0x59e82c[_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x52df82[_0x4a0cd9][_0xac4a('0x64')];_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6f')]?_[_0xac4a('0x70')](_0xcad25d[_0x52df82[_0x4a0cd9]['function']],'%s',_0x403f5a):_0x403f5a;_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x71')]?_['replace'](_0xcd140e[_0x52df82[_0x4a0cd9][_0xac4a('0x71')]],'%s',_0x403f5a):_0x403f5a;if(_0x52df82[_0x4a0cd9]['groupBy']){_0x3eae2f[_0xac4a('0x63')](_0x403f5a);}_0x52df82[_0x4a0cd9][_0xac4a('0x72')]&&_0x3eae2f[_0xac4a('0x38')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x3eae2f[_0xac4a('0x64')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x88')]||_0x403f5a);}if(_0x2b6773[_0xac4a('0x73')]){_0x2b6773[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2b6773['joins']);for(var _0x3dd60a=0x0;_0x3dd60a<_0x2b6773[_0xac4a('0x73')][_0xac4a('0x46')];_0x3dd60a+=0x1){if(_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')]&&_['includes'](_0x4301c3,_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')])&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')]&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a]['foreignTable']&&_0x2b6773['joins'][_0x3dd60a]['foreignKey']){_0x3eae2f[_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x2e')]](_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x75')],null,util[_0xac4a('0x71')](_0xac4a('0x76'),_0x2b6773['table'],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')],_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x75')],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x8a')]));}}}if(_0x2b6773['conditions']){_0x2b6773[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2b6773[_0xac4a('0x77')]);_0x3eae2f[_0xac4a('0x3a')](_0x41cdb5(_0x2b6773[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x52963c=_0x3eae2f[_0xac4a('0x79')]();_0x3eae2f[_0xac4a('0x1d')](_0x63c30);_0x3eae2f[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x3eae2f[_0xac4a('0x7b')]());return dbH['sequelize'][_0xac4a('0x31')](_0x3eae2f['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});}})[_0xac4a('0x25')](function(){return{'sql':_0x52963c[_0xac4a('0x7b')]()};})[_0xac4a('0x25')](respondWithResult(_0x538cfd,null))[_0xac4a('0x44')](handleError(_0x538cfd,null));}; \ No newline at end of file +var _0xda19=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','groupBy','orderBy','order','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','Sequelize','metric','format','DESC','parse','parentKey','web','output','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','run','runReport','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','json','offset','undefined','limit','count','set','apply','update','then','DefaultReports','destroy','end','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','includeAll','include','findAll','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','options','find','getFields'];(function(_0x336de0,_0x50b920){var _0x4872f7=function(_0x3ae566){while(--_0x3ae566){_0x336de0['push'](_0x336de0['shift']());}};_0x4872f7(++_0x50b920);}(_0xda19,0xd5));var _0x9da1=function(_0x26c01d,_0x36774d){_0x26c01d=_0x26c01d-0x0;var _0x370ba4=_0xda19[_0x26c01d];return _0x370ba4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];var dbH=require('../../mysqldb')[_0x9da1('0x17')];function respondWithStatusCode(_0x1d93f8,_0xd2d225){_0xd2d225=_0xd2d225||0xcc;return function(_0x1ffa2a){if(_0x1ffa2a){return _0x1d93f8['sendStatus'](_0xd2d225);}return _0x1d93f8[_0x9da1('0x18')](_0xd2d225)['end']();};}function respondWithResult(_0x4d17e1,_0x40ba9d){_0x40ba9d=_0x40ba9d||0xc8;return function(_0x479ccd){if(_0x479ccd){return _0x4d17e1[_0x9da1('0x18')](_0x40ba9d)[_0x9da1('0x19')](_0x479ccd);}};}function respondWithFilteredResult(_0x37653d,_0x1a1a6b){return function(_0x7f1a64){if(_0x7f1a64){var _0x514d8e=typeof _0x1a1a6b[_0x9da1('0x1a')]===_0x9da1('0x1b')&&typeof _0x1a1a6b[_0x9da1('0x1c')]===_0x9da1('0x1b');var _0xfb278d=_0x7f1a64[_0x9da1('0x1d')];var _0x497676=_0x514d8e?0x0:_0x1a1a6b['offset'];var _0x17205d=_0x514d8e?_0x7f1a64[_0x9da1('0x1d')]:_0x1a1a6b[_0x9da1('0x1a')]+_0x1a1a6b[_0x9da1('0x1c')];var _0x40a967;if(_0x17205d>=_0xfb278d){_0x17205d=_0xfb278d;_0x40a967=0xc8;}else{_0x40a967=0xce;}_0x37653d[_0x9da1('0x18')](_0x40a967);return _0x37653d[_0x9da1('0x1e')]('Content-Range',_0x497676+'-'+_0x17205d+'/'+_0xfb278d)[_0x9da1('0x19')](_0x7f1a64);}return null;};}function patchUpdates(_0x554845){return function(_0x9c3b37){try{jsonpatch[_0x9da1('0x1f')](_0x9c3b37,_0x554845,!![]);}catch(_0x1fc065){return BPromise['reject'](_0x1fc065);}return _0x9c3b37['save']();};}function saveUpdates(_0x14793b,_0x3e6f85){return function(_0x16ee0c){if(_0x16ee0c){return _0x16ee0c[_0x9da1('0x20')](_0x14793b)[_0x9da1('0x21')](function(_0x165b73){return _0x165b73;});}return null;};}function removeEntity(_0x4c60aa,_0x2413fe){return function(_0x3bfa40){if(_0x3bfa40){return _0x3bfa40['destroy']()[_0x9da1('0x21')](function(){var _0x3f5680=_0x3bfa40['get']({'plain':!![]});var _0x2fd49c=_0x9da1('0x22');return db['UserProfileResource'][_0x9da1('0x23')]({'where':{'type':_0x2fd49c,'resourceId':_0x3f5680['id']}})[_0x9da1('0x21')](function(){return _0x3bfa40;});})['then'](function(){_0x4c60aa['status'](0xcc)[_0x9da1('0x24')]();});}};}function handleEntityNotFound(_0x47055e,_0x5eca5b){return function(_0x27c6e2){if(!_0x27c6e2){_0x47055e['sendStatus'](0x194);}return _0x27c6e2;};}function handleError(_0x5a6f2d,_0x5a59c2){_0x5a59c2=_0x5a59c2||0x1f4;return function(_0x31b826){logger[_0x9da1('0x25')](_0x31b826[_0x9da1('0x26')]);if(_0x31b826[_0x9da1('0x27')]){delete _0x31b826[_0x9da1('0x27')];}_0x5a6f2d['status'](_0x5a59c2)[_0x9da1('0x28')](_0x31b826);};}exports['index']=function(_0x1feae0,_0x235ced){var _0x5b38b3={},_0xc29ba8={},_0x2eb48f={'count':0x0,'rows':[]};var _0x4f318b=_[_0x9da1('0x29')](db[_0x9da1('0x2a')][_0x9da1('0x2b')],function(_0x2b2b48){return{'name':_0x2b2b48['fieldName'],'type':_0x2b2b48['type'][_0x9da1('0x2c')]};});_0xc29ba8[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x4f318b,_0x9da1('0x27'));_0xc29ba8[_0x9da1('0x2e')]=_['keys'](_0x1feae0[_0x9da1('0x2e')]);_0xc29ba8[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xc29ba8[_0x9da1('0x2d')],_0xc29ba8[_0x9da1('0x2e')]);_0x5b38b3[_0x9da1('0x31')]=_['intersection'](_0xc29ba8[_0x9da1('0x2d')],qs['fields'](_0x1feae0['query'][_0x9da1('0x32')]));_0x5b38b3['attributes']=_0x5b38b3[_0x9da1('0x31')][_0x9da1('0x33')]?_0x5b38b3[_0x9da1('0x31')]:_0xc29ba8[_0x9da1('0x2d')];if(!_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x5b38b3[_0x9da1('0x1c')]=qs['limit'](_0x1feae0[_0x9da1('0x2e')]['limit']);_0x5b38b3[_0x9da1('0x1a')]=qs['offset'](_0x1feae0['query'][_0x9da1('0x1a')]);}_0x5b38b3['order']=qs[_0x9da1('0x36')](_0x1feae0[_0x9da1('0x2e')]['sort']);_0x5b38b3[_0x9da1('0x37')]=qs[_0x9da1('0x2f')](_[_0x9da1('0x38')](_0x1feae0[_0x9da1('0x2e')],_0xc29ba8['filters']),_0x4f318b);if(_0x1feae0[_0x9da1('0x2e')]['filter']){_0x5b38b3[_0x9da1('0x37')]=_['merge'](_0x5b38b3[_0x9da1('0x37')],{'$or':_[_0x9da1('0x29')](_0x4f318b,function(_0x58e165){if(_0x58e165[_0x9da1('0x39')]!==_0x9da1('0x3a')){var _0x394acf={};_0x394acf[_0x58e165['name']]={'$like':'%'+_0x1feae0['query']['filter']+'%'};return _0x394acf;}})});}_0x5b38b3=_[_0x9da1('0x3b')]({},_0x5b38b3,_0x1feae0['options']);var _0x5b215c={'where':_0x5b38b3[_0x9da1('0x37')]};return db[_0x9da1('0x2a')][_0x9da1('0x1d')](_0x5b215c)['then'](function(_0x42dbd8){_0x2eb48f[_0x9da1('0x1d')]=_0x42dbd8;if(_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x3c')]){_0x5b38b3[_0x9da1('0x3d')]=[{'all':!![]}];}return db[_0x9da1('0x2a')][_0x9da1('0x3e')](_0x5b38b3);})['then'](function(_0x467350){_0x2eb48f['rows']=_0x467350;return _0x2eb48f;})[_0x9da1('0x21')](respondWithFilteredResult(_0x235ced,_0x5b38b3))['catch'](handleError(_0x235ced,null));};exports[_0x9da1('0x3f')]=function(_0x40d848,_0x599211){var _0x265366={'raw':!![],'where':{'id':_0x40d848['params']['id']}},_0xfeec5f={};_0xfeec5f[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x2a')][_0x9da1('0x2b')]);_0xfeec5f['query']=_['keys'](_0x40d848[_0x9da1('0x2e')]);_0xfeec5f[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],_0xfeec5f[_0x9da1('0x2e')]);_0x265366[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],qs['fields'](_0x40d848[_0x9da1('0x2e')][_0x9da1('0x32')]));_0x265366[_0x9da1('0x31')]=_0x265366['attributes'][_0x9da1('0x33')]?_0x265366[_0x9da1('0x31')]:_0xfeec5f[_0x9da1('0x2d')];if(_0x40d848['query'][_0x9da1('0x3c')]){_0x265366[_0x9da1('0x3d')]=[{'all':!![]}];}_0x265366=_[_0x9da1('0x3b')]({},_0x265366,_0x40d848['options']);return db[_0x9da1('0x2a')]['find'](_0x265366)['then'](handleEntityNotFound(_0x599211,null))[_0x9da1('0x21')](respondWithResult(_0x599211,null))[_0x9da1('0x40')](handleError(_0x599211,null));};exports['create']=function(_0x712d10,_0x2066d2){return db['AnalyticDefaultReport'][_0x9da1('0x41')](_0x712d10[_0x9da1('0x42')],{})[_0x9da1('0x21')](function(_0x3a529d){var _0x4780ca=_0x712d10[_0x9da1('0x43')][_0x9da1('0x44')]({'plain':!![]});if(!_0x4780ca)throw new Error(_0x9da1('0x45'));if(_0x4780ca[_0x9da1('0x46')]==='user'){var _0x147c65=_0x3a529d[_0x9da1('0x44')]({'plain':!![]});var _0x34a203=_0x9da1('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x34a203,'userProfileId':_0x4780ca[_0x9da1('0x48')]},'raw':!![]})[_0x9da1('0x21')](function(_0x3870dd){if(_0x3870dd&&_0x3870dd[_0x9da1('0x49')]===0x0){return db[_0x9da1('0x4a')][_0x9da1('0x41')]({'name':_0x147c65[_0x9da1('0x27')],'resourceId':_0x147c65['id'],'type':_0x9da1('0x22'),'sectionId':_0x3870dd['id']},{})[_0x9da1('0x21')](function(){return _0x3a529d;});}else{return _0x3a529d;}})[_0x9da1('0x40')](function(_0x868167){logger[_0x9da1('0x25')](_0x9da1('0x4b'),_0x868167);throw _0x868167;});}return _0x3a529d;})[_0x9da1('0x21')](respondWithResult(_0x2066d2,0xc9))['catch'](handleError(_0x2066d2,null));};exports[_0x9da1('0x20')]=function(_0x1fbb5d,_0x4d241a){if(_0x1fbb5d[_0x9da1('0x42')]['id']){delete _0x1fbb5d['body']['id'];}return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x1fbb5d[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x4d241a,null))[_0x9da1('0x21')](saveUpdates(_0x1fbb5d[_0x9da1('0x42')],null))[_0x9da1('0x21')](respondWithResult(_0x4d241a,null))[_0x9da1('0x40')](handleError(_0x4d241a,null));};exports[_0x9da1('0x23')]=function(_0x343b05,_0x170351){return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x343b05[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x170351,null))[_0x9da1('0x21')](removeEntity(_0x170351,null))[_0x9da1('0x40')](handleError(_0x170351,null));};exports[_0x9da1('0x4d')]=function(_0x4607a9,_0x2020d0){var _0x3c01c3=0xa;var _0xfa8d3f=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),_0x9da1('0x50')];var _0x5bda2a={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0xc27b00={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x27ac84=function(_0x10ebc9){return!_[_0x9da1('0x5c')]([_0x9da1('0x5d'),_0x9da1('0x5e'),_0x9da1('0x5f'),'IS\x20NOT\x20EMPTY'],_0x10ebc9);};var _0x5f5dc2=function(_0x454a68){if(!_0x454a68||!_0x454a68['rules']['length']){return'';}for(var _0x5b4a05='(',_0x6f86c3=0x0;_0x6f86c3<_0x454a68['rules'][_0x9da1('0x33')];_0x6f86c3+=0x1){_0x6f86c3>0x0&&(_0x5b4a05+='\x20'+_0x454a68['operator']+'\x20');_0x5b4a05+=_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x61')]?_0x5f5dc2(_0x454a68['rules'][_0x6f86c3][_0x9da1('0x61')]):_0x454a68[_0x9da1('0x60')][_0x6f86c3]['field']+'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x62')]+(_0x27ac84(_0x454a68['rules'][_0x6f86c3]['condition'])?'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x63')]:'');}return _0x5b4a05+')';};var _0x21d00c={'where':{'id':_0x4607a9['params']['id']}},_0x3ca531,_0x236b01,_0x44d7fe,_0x5cb102,_0x3d2c25;_0x21d00c=_['merge']({},_0x21d00c,_0x4607a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0x21d00c)[_0x9da1('0x21')](function(_0x3382b1){if(_0x3382b1){_0x3ca531=_0x3382b1;return _0x3382b1[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x1f2a4b){if(_0x1f2a4b){if(!_0x1f2a4b[_0x9da1('0x33')]){throw new db['Sequelize'][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x236b01=_0x1f2a4b;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x491fcb){if(_0x491fcb){_0x44d7fe=_[_0x9da1('0x6a')](_0x491fcb,'id');var _0x13fadd;var _0x419f78=squel[_0x9da1('0x6b')]();_0x419f78[_0x9da1('0x6c')](_0x3ca531[_0x9da1('0x6d')]);for(var _0x55a6d2=0x0;_0x55a6d2<_0x236b01[_0x9da1('0x33')];_0x55a6d2+=0x1){_0x13fadd=_0x236b01[_0x55a6d2]['MetricId']?_0x44d7fe[_0x236b01[_0x55a6d2][_0x9da1('0x6e')]]['metric']:_0x236b01[_0x55a6d2][_0x9da1('0x6f')];_0x13fadd=_0x236b01[_0x55a6d2][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x5bda2a[_0x236b01[_0x55a6d2][_0x9da1('0x70')]],'%s',_0x13fadd):_0x13fadd;_0x13fadd=_0x236b01[_0x55a6d2]['format']?_['replace'](_0xc27b00[_0x236b01[_0x55a6d2]['format']],'%s',_0x13fadd):_0x13fadd;if(_0x236b01[_0x55a6d2][_0x9da1('0x72')]){_0x419f78[_0x9da1('0x61')](_0x13fadd);}_0x236b01[_0x55a6d2][_0x9da1('0x73')]&&_0x419f78[_0x9da1('0x74')](_0x13fadd,_0x236b01[_0x55a6d2]['orderBy']==='DESC'?![]:!![]);_0x419f78[_0x9da1('0x6f')](_0x13fadd,_0x236b01[_0x55a6d2][_0x9da1('0x75')]||_0x13fadd);}if(_0x3ca531[_0x9da1('0x76')]){_0x3ca531['joins']=JSON['parse'](_0x3ca531[_0x9da1('0x76')]);for(var _0x1deb93=0x0;_0x1deb93<_0x3ca531[_0x9da1('0x76')]['length'];_0x1deb93+=0x1){if(_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0xfa8d3f,_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x39')])&&_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey']&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')]&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x78')]){_0x419f78[_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]](_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0x3ca531[_0x9da1('0x6d')],_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey'],_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],_0x3ca531['joins'][_0x1deb93][_0x9da1('0x78')]));}}}if(_0x3ca531['conditions']){_0x3ca531[_0x9da1('0x7a')]=JSON['parse'](_0x3ca531[_0x9da1('0x7a')]);_0x419f78[_0x9da1('0x37')](_0x5f5dc2(_0x3ca531[_0x9da1('0x7a')][_0x9da1('0x61')]));}_0x3d2c25=_0x419f78[_0x9da1('0x7b')]();_0x419f78[_0x9da1('0x1c')](_0x3c01c3);_0x419f78[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x419f78[_0x9da1('0x7e')]());return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x419f78[_0x9da1('0x7e')](),{'type':dbH['sequelize'][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](respondWithResult(_0x2020d0,null))[_0x9da1('0x40')](handleError(_0x2020d0,null));};function runReport(_0x162597,_0x4f39bc,_0x1ca102){var _0x2eb5e6=_0x4f39bc['name'];var _0x4a4cda=0xa;var _0x84f8d8=[_0x9da1('0x4e'),_0x9da1('0x82'),_0x9da1('0x4f'),_0x9da1('0x50')];var _0x4701b3={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x3a0a84={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':_0x9da1('0x83'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9da1('0x84')};var _0x354c5a=function(_0x53ab6a){return!_[_0x9da1('0x5c')](['IS\x20NULL',_0x9da1('0x5e'),'IS\x20EMPTY',_0x9da1('0x85')],_0x53ab6a);};var _0x106bd9=function(_0x347cb8){if(!_0x347cb8||!_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x3e331a='(',_0x1f785c=0x0;_0x1f785c<_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')];_0x1f785c+=0x1){_0x1f785c>0x0&&(_0x3e331a+='\x20'+_0x347cb8[_0x9da1('0x86')]+'\x20');_0x3e331a+=_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x61')]?_0x106bd9(_0x347cb8['rules'][_0x1f785c][_0x9da1('0x61')]):_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x6f')]+'\x20'+_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x62')]+(_0x354c5a(_0x347cb8[_0x9da1('0x60')][_0x1f785c]['condition'])?'\x20'+_0x347cb8['rules'][_0x1f785c][_0x9da1('0x63')]:'');}return _0x3e331a+')';};var _0xdecc82={'where':{'id':_0x162597['id']}},_0xe12dd7,_0x4cd85f,_0x4bf74c,_0x28335d,_0x175b4b;_0xdecc82=_[_0x9da1('0x3b')]({},_0xdecc82,_0x1ca102);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xdecc82)[_0x9da1('0x21')](function(_0x5561f0){if(_0x5561f0){_0xe12dd7=_0x5561f0;return _0x5561f0[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x5a64fd){if(_0x5a64fd){if(!_0x5a64fd['length']){throw new db[(_0x9da1('0x87'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cd85f=_0x5a64fd;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x18ae08){if(_0x18ae08){_0x4bf74c=_[_0x9da1('0x6a')](_0x18ae08,'id');var _0x30065d;var _0x40a2ef=squel[_0x9da1('0x6b')]();_0x40a2ef['from'](_0xe12dd7['table']);for(var _0xd10ba4=0x0;_0xd10ba4<_0x4cd85f[_0x9da1('0x33')];_0xd10ba4+=0x1){_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]?_0x4bf74c[_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]][_0x9da1('0x88')]:_0x4cd85f[_0xd10ba4][_0x9da1('0x6f')];_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x4701b3[_0x4cd85f[_0xd10ba4]['function']],'%s',_0x30065d):_0x30065d;_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]?_['replace'](_0x3a0a84[_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]],'%s',_0x30065d):_0x30065d;if(_0x4cd85f[_0xd10ba4][_0x9da1('0x72')]){_0x40a2ef[_0x9da1('0x61')](_0x30065d);}_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]&&_0x40a2ef[_0x9da1('0x74')](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]===_0x9da1('0x8a')?![]:!![]);_0x40a2ef['field'](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x75')]||_0x30065d);}if(_0xe12dd7['joins']){_0xe12dd7[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0xe12dd7[_0x9da1('0x76')]);for(var _0x22b679=0x0;_0x22b679<_0xe12dd7['joins'][_0x9da1('0x33')];_0x22b679+=0x1){if(_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0x84f8d8,_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')])&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]){_0x40a2ef[_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]](_0xe12dd7['joins'][_0x22b679][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0xe12dd7['table'],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]));}}}if(_0xe12dd7[_0x9da1('0x7a')]){_0xe12dd7[_0x9da1('0x7a')]=JSON['parse'](_0xe12dd7[_0x9da1('0x7a')]);_0x40a2ef[_0x9da1('0x37')](_0x106bd9(_0xe12dd7['conditions'][_0x9da1('0x61')]));}_0x175b4b=_0x40a2ef[_0x9da1('0x7b')]();_0x40a2ef[_0x9da1('0x1c')](_0x4a4cda);_0x40a2ef['offset'](0x0);return;}})['then'](function(){if(_0x4f39bc['output']===_0x9da1('0x8d')){return null;}var _0x3b17aa=_[_0x9da1('0x3b')](_0x4f39bc,{'name':_0x4f39bc['fullPath']||_0x4f39bc['name']||_0xe12dd7[_0x9da1('0x27')],'basename':_0x2eb5e6,'savename':util[_0x9da1('0x89')]('%s-%s.%s',_0x4f39bc[_0x9da1('0x27')]||_0xe12dd7['name'],require('randomstring')['generate'](0x4),_0x4f39bc[_0x9da1('0x8e')]||_0x9da1('0x8f')),'reportId':_0xe12dd7['id'],'reportType':_0x9da1('0x90')});return db[_0x9da1('0x91')][_0x9da1('0x41')](_0x3b17aa,{'raw':!![]});})[_0x9da1('0x21')](function(_0x2aac99){if(_0xe12dd7[_0x9da1('0x6d')]===_0x9da1('0x92')){_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc['startDate'],_0x4f39bc['endDate']);}else{_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc[_0x9da1('0x93')],_0x4f39bc[_0x9da1('0x94')]);}if(_0x2aac99){logger[_0x9da1('0x95')](_0x9da1('0x96'),_0x175b4b[_0x9da1('0x7e')]());require(_0x9da1('0x97'))[_0x9da1('0x98')](path[_0x9da1('0x4e')](__dirname,'../../components/export/',_0x2aac99[_0x9da1('0x8e')]),[_0x2aac99['id'],_0x175b4b[_0x9da1('0x7e')](),path[_0x9da1('0x4e')](__dirname,_0x9da1('0x99'),_0x2aac99[_0x9da1('0x9a')]),_0x2eb5e6]);return _0x2aac99;}else{var _0x5ad3f8=squel[_0x9da1('0x6b')]();_0x5ad3f8['from']('('+_0x175b4b[_0x9da1('0x7e')]()+')',_0x9da1('0x9b'));_0x5ad3f8[_0x9da1('0x6f')]('COUNT(*)','count');_0x175b4b[_0x9da1('0x1c')](_0x4f39bc[_0x9da1('0x1c')]||_0x4a4cda);_0x175b4b[_0x9da1('0x1a')](_0x4f39bc['offset']||0x0);return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x5ad3f8['toString'](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')]['SELECT']})['then'](function(_0x489b3f){if(!_0x489b3f[_0x9da1('0x33')]){_0x28335d=0x0;}else{_0x28335d=_0x489b3f[0x0]['count']||0x0;}return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x175b4b[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});})['then'](function(_0x355a71){return{'rows':_0x355a71||[],'count':_0x28335d};});}});}exports[_0x9da1('0x9c')]=function(_0x492e1a,_0x449a17){return runReport(_0x492e1a[_0x9da1('0x4c')],_0x492e1a[_0x9da1('0x2e')],_0x492e1a[_0x9da1('0x64')])['then'](respondWithResult(_0x449a17,null))[_0x9da1('0x40')](handleError(_0x449a17,null));};exports[_0x9da1('0x9d')]=runReport;exports[_0x9da1('0x2e')]=function(_0x8280a9,_0x374754){var _0x1e466a=0xa;var _0x3f9133=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),'cross_join'];var _0x3dd3e0={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x52e4a6={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4aa903=function(_0x55d7f2){return!_['includes'](['IS\x20NULL',_0x9da1('0x5e'),_0x9da1('0x5f'),_0x9da1('0x85')],_0x55d7f2);};var _0x3212ad=function(_0x5ac65b){if(!_0x5ac65b||!_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x21a99d='(',_0xd19a7c=0x0;_0xd19a7c<_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')];_0xd19a7c+=0x1){_0xd19a7c>0x0&&(_0x21a99d+='\x20'+_0x5ac65b[_0x9da1('0x86')]+'\x20');_0x21a99d+=_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]?_0x3212ad(_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]):_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x6f')]+'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c]['condition']+(_0x4aa903(_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x62')])?'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x63')]:'');}return _0x21a99d+')';};var _0xb14af1={'where':{'id':_0x8280a9[_0x9da1('0x4c')]['id']}},_0x245566,_0x5b2591,_0x3c51e3,_0x54b83d,_0x23bf86;_0xb14af1=_['merge']({},_0xb14af1,_0x8280a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xb14af1)[_0x9da1('0x21')](function(_0x4bb140){if(_0x4bb140){_0x245566=_0x4bb140;return _0x4bb140[_0x9da1('0x66')]();}return null;})['then'](function(_0x47cbdd){if(_0x47cbdd){if(!_0x47cbdd['length']){throw new db[(_0x9da1('0x87'))][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x5b2591=_0x47cbdd;return db['AnalyticMetric'][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x5e1e24){if(_0x5e1e24){_0x3c51e3=_[_0x9da1('0x6a')](_0x5e1e24,'id');var _0x49ddec;var _0x407218=squel['select']();_0x407218['from'](_0x245566['table']);for(var _0x316fee=0x0;_0x316fee<_0x5b2591['length'];_0x316fee+=0x1){_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x6e')]?_0x3c51e3[_0x5b2591[_0x316fee][_0x9da1('0x6e')]]['metric']:_0x5b2591[_0x316fee]['field'];_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x70')]?_['replace'](_0x3dd3e0[_0x5b2591[_0x316fee][_0x9da1('0x70')]],'%s',_0x49ddec):_0x49ddec;_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x89')]?_['replace'](_0x52e4a6[_0x5b2591[_0x316fee]['format']],'%s',_0x49ddec):_0x49ddec;if(_0x5b2591[_0x316fee][_0x9da1('0x72')]){_0x407218[_0x9da1('0x61')](_0x49ddec);}_0x5b2591[_0x316fee][_0x9da1('0x73')]&&_0x407218[_0x9da1('0x74')](_0x49ddec,_0x5b2591[_0x316fee]['orderBy']==='DESC'?![]:!![]);_0x407218[_0x9da1('0x6f')](_0x49ddec,_0x5b2591[_0x316fee][_0x9da1('0x75')]||_0x49ddec);}if(_0x245566[_0x9da1('0x76')]){_0x245566[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0x245566['joins']);for(var _0x56ec7d=0x0;_0x56ec7d<_0x245566[_0x9da1('0x76')][_0x9da1('0x33')];_0x56ec7d+=0x1){if(_0x245566['joins'][_0x56ec7d][_0x9da1('0x39')]&&_['includes'](_0x3f9133,_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')])&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x8c')]&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')]&&_0x245566['joins'][_0x56ec7d][_0x9da1('0x78')]){_0x407218[_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')]](_0x245566[_0x9da1('0x76')][_0x56ec7d]['foreignTable'],null,util[_0x9da1('0x89')](_0x9da1('0x79'),_0x245566[_0x9da1('0x6d')],_0x245566['joins'][_0x56ec7d]['parentKey'],_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')],_0x245566['joins'][_0x56ec7d]['foreignKey']));}}}if(_0x245566[_0x9da1('0x7a')]){_0x245566[_0x9da1('0x7a')]=JSON[_0x9da1('0x8b')](_0x245566[_0x9da1('0x7a')]);_0x407218[_0x9da1('0x37')](_0x3212ad(_0x245566['conditions'][_0x9da1('0x61')]));}_0x23bf86=_0x407218['clone']();_0x407218[_0x9da1('0x1c')](_0x1e466a);_0x407218[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x407218['toString']());return dbH['sequelize'][_0x9da1('0x2e')](_0x407218[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](function(){return{'sql':_0x23bf86['toString']()};})[_0x9da1('0x21')](respondWithResult(_0x374754,null))[_0x9da1('0x40')](handleError(_0x374754,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 9d5e975..de14362 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 _0x64f2=['./analyticDefaultReport.attributes','AnalyticDefaultReport','lodash','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x3df9dd,_0x26f5cd){var _0x4f11e4=function(_0x1993fe){while(--_0x1993fe){_0x3df9dd['push'](_0x3df9dd['shift']());}};_0x4f11e4(++_0x26f5cd);}(_0x64f2,0x7a));var _0x264f=function(_0x27e670,_0x3174d6){_0x27e670=_0x27e670-0x0;var _0xf68588=_0x64f2[_0x27e670];return _0xf68588;};'use strict';var _=require(_0x264f('0x0'));var util=require(_0x264f('0x1'));var logger=require(_0x264f('0x2'))('api');var moment=require(_0x264f('0x3'));var BPromise=require(_0x264f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x264f('0x5'));var config=require('../../config/environment');var attributes=require(_0x264f('0x6'));module['exports']=function(_0x5ebc40,_0x287875){return _0x5ebc40['define'](_0x264f('0x7'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x038d=['define','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports'];(function(_0x50f602,_0x4d28b9){var _0xcc89a5=function(_0x79b59){while(--_0x79b59){_0x50f602['push'](_0x50f602['shift']());}};_0xcc89a5(++_0x4d28b9);}(_0x038d,0x9f));var _0xd038=function(_0x569825,_0x20dae2){_0x569825=_0x569825-0x0;var _0x605413=_0x038d[_0x569825];return _0x605413;};'use strict';var _=require('lodash');var util=require(_0xd038('0x0'));var logger=require(_0xd038('0x1'))(_0xd038('0x2'));var moment=require(_0xd038('0x3'));var BPromise=require('bluebird');var rp=require(_0xd038('0x4'));var fs=require('fs');var path=require(_0xd038('0x5'));var rimraf=require('rimraf');var config=require(_0xd038('0x6'));var attributes=require(_0xd038('0x7'));module[_0xd038('0x8')]=function(_0x3e1e68,_0x24de48){return _0x3e1e68[_0xd038('0x9')](_0xd038('0xa'),attributes,{'tableName':_0xd038('0xb'),'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 a8d6ff5..15e2529 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 _0x205e=['jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x15cc1c,_0x3e8a24){var _0x56bc3b=function(_0x24d5b2){while(--_0x24d5b2){_0x15cc1c['push'](_0x15cc1c['shift']());}};_0x56bc3b(++_0x3e8a24);}(_0x205e,0xa7));var _0xe205=function(_0xcd52ea,_0x4bc4b9){_0xcd52ea=_0xcd52ea-0x0;var _0x2b3b74=_0x205e[_0xcd52ea];return _0x2b3b74;};'use strict';var _=require(_0xe205('0x0'));var util=require(_0xe205('0x1'));var moment=require(_0xe205('0x2'));var BPromise=require('bluebird');var rs=require(_0xe205('0x3'));var fs=require('fs');var Redis=require(_0xe205('0x4'));var db=require(_0xe205('0x5'))['db'];var utils=require(_0xe205('0x6'));var logger=require(_0xe205('0x7'))(_0xe205('0x8'));var config=require('../../config/environment');var jayson=require(_0xe205('0x9'));var client=jayson[_0xe205('0xa')][_0xe205('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbfe4df,_0x18cd7c,_0x28f38b){return new BPromise(function(_0x514d24,_0x3d5b37){return client['request'](_0xbfe4df,_0x28f38b)[_0xe205('0xc')](function(_0x4a53cc){logger[_0xe205('0xd')](_0xe205('0xe'),_0x18cd7c,_0xe205('0xf'));logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x18cd7c,_0xe205('0xf'),JSON[_0xe205('0x10')](_0x4a53cc));if(_0x4a53cc[_0xe205('0x11')]){if(_0x4a53cc[_0xe205('0x11')][_0xe205('0x12')]===0x1f4){logger[_0xe205('0x11')](_0xe205('0xe'),_0x18cd7c,_0x4a53cc[_0xe205('0x11')][_0xe205('0x13')]);return _0x3d5b37(_0x4a53cc['error'][_0xe205('0x13')]);}logger[_0xe205('0x11')](_0xe205('0xe'),_0x18cd7c,_0x4a53cc[_0xe205('0x11')][_0xe205('0x13')]);return _0x514d24(_0x4a53cc[_0xe205('0x11')]['message']);}else{logger[_0xe205('0xd')](_0xe205('0xe'),_0x18cd7c,_0xe205('0xf'));_0x514d24(_0x4a53cc[_0xe205('0x14')][_0xe205('0x13')]);}})[_0xe205('0x15')](function(_0x5da891){logger[_0xe205('0x11')](_0xe205('0xe'),_0x18cd7c,_0x5da891);_0x3d5b37(_0x5da891);});});} \ No newline at end of file +var _0xc155=['ioredis','../../mysqldb','rpc','../../config/environment','client','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring'];(function(_0x4ed17a,_0x2ed534){var _0x15bc0e=function(_0x19b69a){while(--_0x19b69a){_0x4ed17a['push'](_0x4ed17a['shift']());}};_0x15bc0e(++_0x2ed534);}(_0xc155,0xd9));var _0x5c15=function(_0x4d491e,_0x6759fd){_0x4d491e=_0x4d491e-0x0;var _0x58d24a=_0xc155[_0x4d491e];return _0x58d24a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5c15('0x0'));var BPromise=require(_0x5c15('0x1'));var rs=require(_0x5c15('0x2'));var fs=require('fs');var Redis=require(_0x5c15('0x3'));var db=require(_0x5c15('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5c15('0x5'));var config=require(_0x5c15('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5c15('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c74ec,_0xc266c9,_0x2793e7){return new BPromise(function(_0x59d46e,_0x68fc3){return client[_0x5c15('0x8')](_0x3c74ec,_0x2793e7)[_0x5c15('0x9')](function(_0xa1a36f){logger['info'](_0x5c15('0xa'),_0xc266c9,_0x5c15('0xb'));logger['debug'](_0x5c15('0xc'),_0xc266c9,_0x5c15('0xb'),JSON[_0x5c15('0xd')](_0xa1a36f));if(_0xa1a36f[_0x5c15('0xe')]){if(_0xa1a36f[_0x5c15('0xe')][_0x5c15('0xf')]===0x1f4){logger[_0x5c15('0xe')](_0x5c15('0xa'),_0xc266c9,_0xa1a36f[_0x5c15('0xe')][_0x5c15('0x10')]);return _0x68fc3(_0xa1a36f[_0x5c15('0xe')]['message']);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0xc266c9,_0xa1a36f['error'][_0x5c15('0x10')]);return _0x59d46e(_0xa1a36f[_0x5c15('0xe')][_0x5c15('0x10')]);}else{logger[_0x5c15('0x11')](_0x5c15('0xa'),_0xc266c9,_0x5c15('0xb'));_0x59d46e(_0xa1a36f[_0x5c15('0x12')]['message']);}})[_0x5c15('0x13')](function(_0x5bb3dc){logger[_0x5c15('0xe')](_0x5c15('0xa'),_0xc266c9,_0x5bb3dc);_0x68fc3(_0x5bb3dc);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 544fabf..59f9d49 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 _0xd4af=['connect-timeout','express','fs-extra','./analyticDefaultReport.controller','isAuthenticated','index','/:id','show','get','/:id/preview','preview','/:id/run','run','query','post','put','delete','destroy','exports','multer','util'];(function(_0x2fc7c4,_0xe9325b){var _0x209f4a=function(_0x5c70eb){while(--_0x5c70eb){_0x2fc7c4['push'](_0x2fc7c4['shift']());}};_0x209f4a(++_0xe9325b);}(_0xd4af,0xe5));var _0xfd4a=function(_0x485df3,_0x253fac){_0x485df3=_0x485df3-0x0;var _0x481d6b=_0xd4af[_0x485df3];return _0x481d6b;};'use strict';var multer=require(_0xfd4a('0x0'));var util=require(_0xfd4a('0x1'));var path=require('path');var timeout=require(_0xfd4a('0x2'));var express=require(_0xfd4a('0x3'));var router=express['Router']();var fs_extra=require(_0xfd4a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfd4a('0x5'));router['get']('/',auth[_0xfd4a('0x6')](),controller[_0xfd4a('0x7')]);router['get'](_0xfd4a('0x8'),auth['isAuthenticated'](),controller[_0xfd4a('0x9')]);router[_0xfd4a('0xa')](_0xfd4a('0xb'),auth[_0xfd4a('0x6')](),controller[_0xfd4a('0xc')]);router[_0xfd4a('0xa')](_0xfd4a('0xd'),auth[_0xfd4a('0x6')](),controller[_0xfd4a('0xe')]);router[_0xfd4a('0xa')]('/:id/query',auth[_0xfd4a('0x6')](),controller[_0xfd4a('0xf')]);router[_0xfd4a('0x10')]('/',auth[_0xfd4a('0x6')](),controller['create']);router[_0xfd4a('0x11')]('/:id',auth[_0xfd4a('0x6')](),controller['update']);router[_0xfd4a('0x12')](_0xfd4a('0x8'),auth[_0xfd4a('0x6')](),controller[_0xfd4a('0x13')]);module[_0xfd4a('0x14')]=router; \ No newline at end of file +var _0x24db=['../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','query','create','put','update','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x336e10,_0x402fd2){var _0x58046f=function(_0x5dd601){while(--_0x5dd601){_0x336e10['push'](_0x336e10['shift']());}};_0x58046f(++_0x402fd2);}(_0x24db,0xaa));var _0xb24d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24db[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb24d('0x0'));var util=require(_0xb24d('0x1'));var path=require(_0xb24d('0x2'));var timeout=require(_0xb24d('0x3'));var express=require(_0xb24d('0x4'));var router=express['Router']();var fs_extra=require(_0xb24d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb24d('0x6'));var config=require(_0xb24d('0x7'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb24d('0x8')]);router[_0xb24d('0x9')](_0xb24d('0xa'),auth[_0xb24d('0xb')](),controller[_0xb24d('0xc')]);router['get'](_0xb24d('0xd'),auth[_0xb24d('0xb')](),controller[_0xb24d('0xe')]);router['get'](_0xb24d('0xf'),auth[_0xb24d('0xb')](),controller[_0xb24d('0x10')]);router['get'](_0xb24d('0x11'),auth['isAuthenticated'](),controller[_0xb24d('0x12')]);router['post']('/',auth[_0xb24d('0xb')](),controller[_0xb24d('0x13')]);router[_0xb24d('0x14')](_0xb24d('0xa'),auth[_0xb24d('0xb')](),controller[_0xb24d('0x15')]);router['delete']('/:id',auth[_0xb24d('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 2534151..aa47fdf 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 _0x6a10=['INTEGER','moment','exports','STRING','ENUM','pdf','DATE','Loading','scheduled'];(function(_0x510faf,_0x583969){var _0x2ba9e9=function(_0x43d245){while(--_0x43d245){_0x510faf['push'](_0x510faf['shift']());}};_0x2ba9e9(++_0x583969);}(_0x6a10,0x1d5));var _0x06a1=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x6a10[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x06a1('0x0'));module[_0x06a1('0x1')]={'name':{'type':Sequelize[_0x06a1('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x06a1('0x3')]('csv',_0x06a1('0x4'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x06a1('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x06a1('0x5')]},'endDate':{'type':Sequelize[_0x06a1('0x5')]},'status':{'type':Sequelize[_0x06a1('0x2')],'defaultValue':_0x06a1('0x6')},'type':{'type':Sequelize['ENUM']('manual',_0x06a1('0x7')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x06a1('0x8')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x06a1('0x2')]}}; \ No newline at end of file +var _0x0e6e=['UNSIGNED','sequelize','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','INTEGER'];(function(_0x2dd21c,_0x2dba61){var _0x22595c=function(_0x925906){while(--_0x925906){_0x2dd21c['push'](_0x2dd21c['shift']());}};_0x22595c(++_0x2dba61);}(_0x0e6e,0x14b));var _0xe0e6=function(_0x5a31d2,_0x3e9618){_0x5a31d2=_0x5a31d2-0x0;var _0x2608f7=_0x0e6e[_0x5a31d2];return _0x2608f7;};'use strict';var Sequelize=require(_0xe0e6('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xe0e6('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0xe0e6('0x2')](_0xe0e6('0x3'),_0xe0e6('0x4'),_0xe0e6('0x5')),'allowNull':![],'defaultValue':_0xe0e6('0x3')},'savename':{'type':Sequelize[_0xe0e6('0x1')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xe0e6('0x6')]},'status':{'type':Sequelize[_0xe0e6('0x1')],'defaultValue':_0xe0e6('0x7')},'type':{'type':Sequelize[_0xe0e6('0x2')](_0xe0e6('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0xe0e6('0x8')},'reportId':{'type':Sequelize[_0xe0e6('0x9')](0xb)[_0xe0e6('0xa')]},'reportType':{'type':Sequelize[_0xe0e6('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 9f2a196..1372836 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 _0xd88c=['catch','show','params','find','create','body','user','get','download','basename','savename','output','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','format','%s.%s','toLowerCase','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','limit','set','apply','reject','save','update','then','ExtractedReports','UserProfileResource','destroy','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','offset','order','sort','where','merge','filter','options','includeAll','include','findAll','rows'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xd88c,0x73));var _0xcd88=function(_0x4de1a4,_0x3d21d7){_0x4de1a4=_0x4de1a4-0x0;var _0x2be3fb=_0xd88c[_0x4de1a4];return _0x2be3fb;};'use strict';var emlformat=require(_0xcd88('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcd88('0x1'));var rp=require(_0xcd88('0x2'));var moment=require(_0xcd88('0x3'));var BPromise=require(_0xcd88('0x4'));var Mustache=require(_0xcd88('0x5'));var util=require(_0xcd88('0x6'));var path=require(_0xcd88('0x7'));var sox=require(_0xcd88('0x8'));var csv=require(_0xcd88('0x9'));var ejs=require(_0xcd88('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd88('0xb'));var squel=require(_0xcd88('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcd88('0xd'));var toCsv=require(_0xcd88('0x9'));var querystring=require('querystring');var Papa=require(_0xcd88('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcd88('0xf'));var as=require(_0xcd88('0x10'));var hardwareService=require(_0xcd88('0x11'));var logger=require(_0xcd88('0x12'))(_0xcd88('0x13'));var utils=require(_0xcd88('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xcd88('0x15'));var db=require(_0xcd88('0x16'))['db'];function respondWithStatusCode(_0x2f67ab,_0x369adb){_0x369adb=_0x369adb||0xcc;return function(_0x2d0e94){if(_0x2d0e94){return _0x2f67ab[_0xcd88('0x17')](_0x369adb);}return _0x2f67ab[_0xcd88('0x18')](_0x369adb)[_0xcd88('0x19')]();};}function respondWithResult(_0x11ff1f,_0x5e3351){_0x5e3351=_0x5e3351||0xc8;return function(_0x40c095){if(_0x40c095){return _0x11ff1f[_0xcd88('0x18')](_0x5e3351)[_0xcd88('0x1a')](_0x40c095);}};}function respondWithFilteredResult(_0x5afb29,_0x27f523){return function(_0x463886){if(_0x463886){var _0x53250e=typeof _0x27f523['offset']===_0xcd88('0x1b')&&typeof _0x27f523['limit']==='undefined';var _0x22d42a=_0x463886[_0xcd88('0x1c')];var _0x4289e7=_0x53250e?0x0:_0x27f523['offset'];var _0x514ccc=_0x53250e?_0x463886[_0xcd88('0x1c')]:_0x27f523['offset']+_0x27f523[_0xcd88('0x1d')];var _0x5e904d;if(_0x514ccc>=_0x22d42a){_0x514ccc=_0x22d42a;_0x5e904d=0xc8;}else{_0x5e904d=0xce;}_0x5afb29[_0xcd88('0x18')](_0x5e904d);return _0x5afb29[_0xcd88('0x1e')]('Content-Range',_0x4289e7+'-'+_0x514ccc+'/'+_0x22d42a)[_0xcd88('0x1a')](_0x463886);}return null;};}function patchUpdates(_0x2428ab){return function(_0x5c2a4c){try{jsonpatch[_0xcd88('0x1f')](_0x5c2a4c,_0x2428ab,!![]);}catch(_0x3ab6f5){return BPromise[_0xcd88('0x20')](_0x3ab6f5);}return _0x5c2a4c[_0xcd88('0x21')]();};}function saveUpdates(_0x2a96dc,_0x513321){return function(_0x9c5a41){if(_0x9c5a41){return _0x9c5a41[_0xcd88('0x22')](_0x2a96dc)[_0xcd88('0x23')](function(_0x13d62f){return _0x13d62f;});}return null;};}function removeEntity(_0x174126,_0x291828){return function(_0x269bde){if(_0x269bde){return _0x269bde['destroy']()['then'](function(){var _0x2fbe6d=_0x269bde['get']({'plain':!![]});var _0x3810f1=_0xcd88('0x24');return db[_0xcd88('0x25')][_0xcd88('0x26')]({'where':{'type':_0x3810f1,'resourceId':_0x2fbe6d['id']}})[_0xcd88('0x23')](function(){return _0x269bde;});})[_0xcd88('0x23')](function(){_0x174126['status'](0xcc)[_0xcd88('0x19')]();});}};}function handleEntityNotFound(_0x3fbd49,_0x148f5a){return function(_0x42d336){if(!_0x42d336){_0x3fbd49[_0xcd88('0x17')](0x194);}return _0x42d336;};}function handleError(_0x3ee0d7,_0x53f33f){_0x53f33f=_0x53f33f||0x1f4;return function(_0x36e088){logger[_0xcd88('0x27')](_0x36e088['stack']);if(_0x36e088[_0xcd88('0x28')]){delete _0x36e088['name'];}_0x3ee0d7['status'](_0x53f33f)[_0xcd88('0x29')](_0x36e088);};}exports[_0xcd88('0x2a')]=function(_0x31df24,_0xb5742){var _0x44a5d4={},_0x1cde81={},_0x3f26d6={'count':0x0,'rows':[]};var _0x22c6f7=_[_0xcd88('0x2b')](db[_0xcd88('0x2c')][_0xcd88('0x2d')],function(_0x34ae1d){return{'name':_0x34ae1d[_0xcd88('0x2e')],'type':_0x34ae1d[_0xcd88('0x2f')][_0xcd88('0x30')]};});_0x1cde81['model']=_[_0xcd88('0x2b')](_0x22c6f7,'name');_0x1cde81['query']=_[_0xcd88('0x31')](_0x31df24[_0xcd88('0x32')]);_0x1cde81[_0xcd88('0x33')]=_[_0xcd88('0x34')](_0x1cde81['model'],_0x1cde81[_0xcd88('0x32')]);_0x44a5d4[_0xcd88('0x35')]=_[_0xcd88('0x34')](_0x1cde81[_0xcd88('0x36')],qs[_0xcd88('0x37')](_0x31df24[_0xcd88('0x32')]['fields']));_0x44a5d4[_0xcd88('0x35')]=_0x44a5d4[_0xcd88('0x35')][_0xcd88('0x38')]?_0x44a5d4['attributes']:_0x1cde81[_0xcd88('0x36')];if(!_0x31df24[_0xcd88('0x32')][_0xcd88('0x39')]('nolimit')){_0x44a5d4[_0xcd88('0x1d')]=qs[_0xcd88('0x1d')](_0x31df24[_0xcd88('0x32')][_0xcd88('0x1d')]);_0x44a5d4['offset']=qs['offset'](_0x31df24[_0xcd88('0x32')][_0xcd88('0x3a')]);}_0x44a5d4[_0xcd88('0x3b')]=qs[_0xcd88('0x3c')](_0x31df24[_0xcd88('0x32')][_0xcd88('0x3c')]);_0x44a5d4['where']=qs[_0xcd88('0x33')](_['pick'](_0x31df24[_0xcd88('0x32')],_0x1cde81['filters']),_0x22c6f7);if(_0x31df24[_0xcd88('0x32')]['filter']){_0x44a5d4[_0xcd88('0x3d')]=_[_0xcd88('0x3e')](_0x44a5d4[_0xcd88('0x3d')],{'$or':_[_0xcd88('0x2b')](_0x22c6f7,function(_0x1f5063){if(_0x1f5063['type']!=='VIRTUAL'){var _0x4cd1d9={};_0x4cd1d9[_0x1f5063[_0xcd88('0x28')]]={'$like':'%'+_0x31df24[_0xcd88('0x32')][_0xcd88('0x3f')]+'%'};return _0x4cd1d9;}})});}_0x44a5d4=_[_0xcd88('0x3e')]({},_0x44a5d4,_0x31df24[_0xcd88('0x40')]);var _0xb40e35={'where':_0x44a5d4[_0xcd88('0x3d')]};return db[_0xcd88('0x2c')][_0xcd88('0x1c')](_0xb40e35)[_0xcd88('0x23')](function(_0x3d7877){_0x3f26d6['count']=_0x3d7877;if(_0x31df24[_0xcd88('0x32')][_0xcd88('0x41')]){_0x44a5d4[_0xcd88('0x42')]=[{'all':!![]}];}return db[_0xcd88('0x2c')][_0xcd88('0x43')](_0x44a5d4);})[_0xcd88('0x23')](function(_0x403616){_0x3f26d6[_0xcd88('0x44')]=_0x403616;return _0x3f26d6;})[_0xcd88('0x23')](respondWithFilteredResult(_0xb5742,_0x44a5d4))[_0xcd88('0x45')](handleError(_0xb5742,null));};exports[_0xcd88('0x46')]=function(_0x13bfc8,_0x25d233){var _0x656fe9={'raw':!![],'where':{'id':_0x13bfc8[_0xcd88('0x47')]['id']}},_0x49a0d8={};_0x49a0d8[_0xcd88('0x36')]=_['keys'](db['AnalyticExtractedReport'][_0xcd88('0x2d')]);_0x49a0d8[_0xcd88('0x32')]=_['keys'](_0x13bfc8[_0xcd88('0x32')]);_0x49a0d8['filters']=_['intersection'](_0x49a0d8['model'],_0x49a0d8[_0xcd88('0x32')]);_0x656fe9[_0xcd88('0x35')]=_['intersection'](_0x49a0d8['model'],qs[_0xcd88('0x37')](_0x13bfc8[_0xcd88('0x32')][_0xcd88('0x37')]));_0x656fe9[_0xcd88('0x35')]=_0x656fe9[_0xcd88('0x35')][_0xcd88('0x38')]?_0x656fe9['attributes']:_0x49a0d8[_0xcd88('0x36')];if(_0x13bfc8[_0xcd88('0x32')][_0xcd88('0x41')]){_0x656fe9[_0xcd88('0x42')]=[{'all':!![]}];}_0x656fe9=_[_0xcd88('0x3e')]({},_0x656fe9,_0x13bfc8[_0xcd88('0x40')]);return db[_0xcd88('0x2c')][_0xcd88('0x48')](_0x656fe9)[_0xcd88('0x23')](handleEntityNotFound(_0x25d233,null))[_0xcd88('0x23')](respondWithResult(_0x25d233,null))['catch'](handleError(_0x25d233,null));};exports[_0xcd88('0x49')]=function(_0x20cdff,_0x570f13){return db[_0xcd88('0x2c')][_0xcd88('0x49')](_0x20cdff[_0xcd88('0x4a')],{})[_0xcd88('0x23')](function(_0x16afce){var _0x354824=_0x20cdff[_0xcd88('0x4b')][_0xcd88('0x4c')]({'plain':!![]});if(!_0x354824)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x354824['role']==='user'){var _0x1513ae=_0x16afce[_0xcd88('0x4c')]({'plain':!![]});var _0x2c07c9='ExtractedReports';return db['UserProfileSection'][_0xcd88('0x48')]({'where':{'name':_0x2c07c9,'userProfileId':_0x354824['userProfileId']},'raw':!![]})[_0xcd88('0x23')](function(_0x42c7d3){if(_0x42c7d3&&_0x42c7d3['autoAssociation']===0x0){return db['UserProfileResource'][_0xcd88('0x49')]({'name':_0x1513ae[_0xcd88('0x28')],'resourceId':_0x1513ae['id'],'type':_0x42c7d3[_0xcd88('0x28')],'sectionId':_0x42c7d3['id']},{})[_0xcd88('0x23')](function(){return _0x16afce;});}else{return _0x16afce;}})[_0xcd88('0x45')](function(_0x292c06){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x292c06);throw _0x292c06;});}return _0x16afce;})[_0xcd88('0x23')](respondWithResult(_0x570f13,0xc9))[_0xcd88('0x45')](handleError(_0x570f13,null));};exports['update']=function(_0x588005,_0x225b3c){if(_0x588005['body']['id']){delete _0x588005[_0xcd88('0x4a')]['id'];}return db['AnalyticExtractedReport'][_0xcd88('0x48')]({'where':{'id':_0x588005[_0xcd88('0x47')]['id']}})[_0xcd88('0x23')](handleEntityNotFound(_0x225b3c,null))['then'](saveUpdates(_0x588005[_0xcd88('0x4a')],null))[_0xcd88('0x23')](respondWithResult(_0x225b3c,null))['catch'](handleError(_0x225b3c,null));};exports[_0xcd88('0x26')]=function(_0x43f37d,_0xcc76d2){return db[_0xcd88('0x2c')][_0xcd88('0x48')]({'where':{'id':_0x43f37d[_0xcd88('0x47')]['id']}})[_0xcd88('0x23')](handleEntityNotFound(_0xcc76d2,null))[_0xcd88('0x23')](removeEntity(_0xcc76d2,null))[_0xcd88('0x45')](handleError(_0xcc76d2,null));};exports[_0xcd88('0x4d')]=function(_0x9eb505,_0x22fc3f,_0x18f3d0){return db[_0xcd88('0x2c')][_0xcd88('0x48')]({'where':{'id':_0x9eb505[_0xcd88('0x47')]['id']},'attributes':[_0xcd88('0x28'),_0xcd88('0x4e'),_0xcd88('0x4f'),_0xcd88('0x50')],'raw':!![]})[_0xcd88('0x23')](handleEntityNotFound(_0x22fc3f,null))[_0xcd88('0x23')](function(_0x23a2aa){if(_0x23a2aa){if(!fs[_0xcd88('0x51')](path[_0xcd88('0x52')](config[_0xcd88('0x53')],'server/files/reports',_0x23a2aa['savename']))){throw new db[(_0xcd88('0x54'))][(_0xcd88('0x55'))](_0xcd88('0x56'));}if(_0x9eb505['query'][_0xcd88('0x57')]){return _0x22fc3f[_0xcd88('0x17')](0xc8);}return _0x22fc3f[_0xcd88('0x4d')](path[_0xcd88('0x52')](config[_0xcd88('0x53')],_0xcd88('0x58'),_0x23a2aa[_0xcd88('0x4f')]),util[_0xcd88('0x59')](_0xcd88('0x5a'),_0x23a2aa['basename']||_0x23a2aa[_0xcd88('0x28')],_0x23a2aa[_0xcd88('0x50')][_0xcd88('0x5b')]()));}})[_0xcd88('0x45')](handleError(_0x22fc3f,null));}; \ No newline at end of file +var _0x7e26=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','join','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','toLowerCase','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x106656,_0x333139){var _0x4a5dbf=function(_0x537008){while(--_0x537008){_0x106656['push'](_0x106656['shift']());}};_0x4a5dbf(++_0x333139);}(_0x7e26,0x110));var _0x67e2=function(_0x172203,_0x4820fc){_0x172203=_0x172203-0x0;var _0x46efbf=_0x7e26[_0x172203];return _0x46efbf;};'use strict';var emlformat=require(_0x67e2('0x0'));var rimraf=require(_0x67e2('0x1'));var zipdir=require(_0x67e2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x67e2('0x3'));var BPromise=require(_0x67e2('0x4'));var Mustache=require(_0x67e2('0x5'));var util=require(_0x67e2('0x6'));var path=require(_0x67e2('0x7'));var sox=require(_0x67e2('0x8'));var csv=require(_0x67e2('0x9'));var ejs=require(_0x67e2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x67e2('0xb'));var squel=require('squel');var crypto=require(_0x67e2('0xc'));var jsforce=require(_0x67e2('0xd'));var deskjs=require(_0x67e2('0xe'));var toCsv=require(_0x67e2('0x9'));var querystring=require(_0x67e2('0xf'));var Papa=require(_0x67e2('0x10'));var Redis=require('ioredis');var authService=require(_0x67e2('0x11'));var qs=require(_0x67e2('0x12'));var as=require(_0x67e2('0x13'));var hardwareService=require(_0x67e2('0x14'));var logger=require(_0x67e2('0x15'))(_0x67e2('0x16'));var utils=require(_0x67e2('0x17'));var config=require(_0x67e2('0x18'));var licenseUtil=require(_0x67e2('0x19'));var db=require(_0x67e2('0x1a'))['db'];function respondWithStatusCode(_0x5f0c0d,_0x1e47fb){_0x1e47fb=_0x1e47fb||0xcc;return function(_0x2ee97d){if(_0x2ee97d){return _0x5f0c0d[_0x67e2('0x1b')](_0x1e47fb);}return _0x5f0c0d['status'](_0x1e47fb)[_0x67e2('0x1c')]();};}function respondWithResult(_0x19b67e,_0x122b88){_0x122b88=_0x122b88||0xc8;return function(_0x5811ab){if(_0x5811ab){return _0x19b67e[_0x67e2('0x1d')](_0x122b88)[_0x67e2('0x1e')](_0x5811ab);}};}function respondWithFilteredResult(_0xea5b8d,_0x3f654d){return function(_0x48e43c){if(_0x48e43c){var _0x1442d7=typeof _0x3f654d[_0x67e2('0x1f')]==='undefined'&&typeof _0x3f654d[_0x67e2('0x20')]===_0x67e2('0x21');var _0x43ee36=_0x48e43c[_0x67e2('0x22')];var _0x321ff7=_0x1442d7?0x0:_0x3f654d[_0x67e2('0x1f')];var _0x55b2fc=_0x1442d7?_0x48e43c[_0x67e2('0x22')]:_0x3f654d[_0x67e2('0x1f')]+_0x3f654d['limit'];var _0x54d447;if(_0x55b2fc>=_0x43ee36){_0x55b2fc=_0x43ee36;_0x54d447=0xc8;}else{_0x54d447=0xce;}_0xea5b8d[_0x67e2('0x1d')](_0x54d447);return _0xea5b8d[_0x67e2('0x23')](_0x67e2('0x24'),_0x321ff7+'-'+_0x55b2fc+'/'+_0x43ee36)[_0x67e2('0x1e')](_0x48e43c);}return null;};}function patchUpdates(_0x56ba4a){return function(_0x3abf82){try{jsonpatch[_0x67e2('0x25')](_0x3abf82,_0x56ba4a,!![]);}catch(_0x1fcbd2){return BPromise[_0x67e2('0x26')](_0x1fcbd2);}return _0x3abf82[_0x67e2('0x27')]();};}function saveUpdates(_0x3c0131,_0x5922bb){return function(_0x4a9b1c){if(_0x4a9b1c){return _0x4a9b1c['update'](_0x3c0131)[_0x67e2('0x28')](function(_0x1b0b85){return _0x1b0b85;});}return null;};}function removeEntity(_0x88140a,_0x35e283){return function(_0x2569a9){if(_0x2569a9){return _0x2569a9[_0x67e2('0x29')]()['then'](function(){var _0x404b83=_0x2569a9[_0x67e2('0x2a')]({'plain':!![]});var _0x571f79=_0x67e2('0x2b');return db[_0x67e2('0x2c')][_0x67e2('0x29')]({'where':{'type':_0x571f79,'resourceId':_0x404b83['id']}})[_0x67e2('0x28')](function(){return _0x2569a9;});})[_0x67e2('0x28')](function(){_0x88140a['status'](0xcc)[_0x67e2('0x1c')]();});}};}function handleEntityNotFound(_0x563105,_0x4c971d){return function(_0x52b5d8){if(!_0x52b5d8){_0x563105['sendStatus'](0x194);}return _0x52b5d8;};}function handleError(_0x368251,_0x74d775){_0x74d775=_0x74d775||0x1f4;return function(_0x15123){logger[_0x67e2('0x2d')](_0x15123[_0x67e2('0x2e')]);if(_0x15123[_0x67e2('0x2f')]){delete _0x15123[_0x67e2('0x2f')];}_0x368251['status'](_0x74d775)[_0x67e2('0x30')](_0x15123);};}exports[_0x67e2('0x31')]=function(_0x3b3f97,_0x22fd42){var _0x3f7245={},_0x4dd5b6={},_0x358026={'count':0x0,'rows':[]};var _0x1f989f=_[_0x67e2('0x32')](db[_0x67e2('0x33')]['rawAttributes'],function(_0x5266ce){return{'name':_0x5266ce[_0x67e2('0x34')],'type':_0x5266ce[_0x67e2('0x35')][_0x67e2('0x36')]};});_0x4dd5b6['model']=_[_0x67e2('0x32')](_0x1f989f,_0x67e2('0x2f'));_0x4dd5b6[_0x67e2('0x37')]=_[_0x67e2('0x38')](_0x3b3f97[_0x67e2('0x37')]);_0x4dd5b6[_0x67e2('0x39')]=_[_0x67e2('0x3a')](_0x4dd5b6[_0x67e2('0x3b')],_0x4dd5b6[_0x67e2('0x37')]);_0x3f7245['attributes']=_[_0x67e2('0x3a')](_0x4dd5b6[_0x67e2('0x3b')],qs[_0x67e2('0x3c')](_0x3b3f97[_0x67e2('0x37')][_0x67e2('0x3c')]));_0x3f7245['attributes']=_0x3f7245[_0x67e2('0x3d')][_0x67e2('0x3e')]?_0x3f7245[_0x67e2('0x3d')]:_0x4dd5b6[_0x67e2('0x3b')];if(!_0x3b3f97['query'][_0x67e2('0x3f')](_0x67e2('0x40'))){_0x3f7245['limit']=qs[_0x67e2('0x20')](_0x3b3f97[_0x67e2('0x37')]['limit']);_0x3f7245[_0x67e2('0x1f')]=qs[_0x67e2('0x1f')](_0x3b3f97[_0x67e2('0x37')][_0x67e2('0x1f')]);}_0x3f7245[_0x67e2('0x41')]=qs[_0x67e2('0x42')](_0x3b3f97[_0x67e2('0x37')]['sort']);_0x3f7245['where']=qs[_0x67e2('0x39')](_[_0x67e2('0x43')](_0x3b3f97['query'],_0x4dd5b6[_0x67e2('0x39')]),_0x1f989f);if(_0x3b3f97[_0x67e2('0x37')]['filter']){_0x3f7245[_0x67e2('0x44')]=_['merge'](_0x3f7245[_0x67e2('0x44')],{'$or':_[_0x67e2('0x32')](_0x1f989f,function(_0x149422){if(_0x149422[_0x67e2('0x35')]!==_0x67e2('0x45')){var _0x18e57c={};_0x18e57c[_0x149422['name']]={'$like':'%'+_0x3b3f97[_0x67e2('0x37')][_0x67e2('0x46')]+'%'};return _0x18e57c;}})});}_0x3f7245=_[_0x67e2('0x47')]({},_0x3f7245,_0x3b3f97[_0x67e2('0x48')]);var _0x40a780={'where':_0x3f7245[_0x67e2('0x44')]};return db[_0x67e2('0x33')][_0x67e2('0x22')](_0x40a780)[_0x67e2('0x28')](function(_0x35e736){_0x358026[_0x67e2('0x22')]=_0x35e736;if(_0x3b3f97[_0x67e2('0x37')][_0x67e2('0x49')]){_0x3f7245['include']=[{'all':!![]}];}return db[_0x67e2('0x33')][_0x67e2('0x4a')](_0x3f7245);})[_0x67e2('0x28')](function(_0x10e46f){_0x358026['rows']=_0x10e46f;return _0x358026;})[_0x67e2('0x28')](respondWithFilteredResult(_0x22fd42,_0x3f7245))[_0x67e2('0x4b')](handleError(_0x22fd42,null));};exports[_0x67e2('0x4c')]=function(_0x3fd812,_0x51c14a){var _0x235594={'raw':!![],'where':{'id':_0x3fd812[_0x67e2('0x4d')]['id']}},_0xd845c5={};_0xd845c5[_0x67e2('0x3b')]=_[_0x67e2('0x38')](db['AnalyticExtractedReport'][_0x67e2('0x4e')]);_0xd845c5['query']=_['keys'](_0x3fd812['query']);_0xd845c5[_0x67e2('0x39')]=_[_0x67e2('0x3a')](_0xd845c5[_0x67e2('0x3b')],_0xd845c5[_0x67e2('0x37')]);_0x235594['attributes']=_[_0x67e2('0x3a')](_0xd845c5[_0x67e2('0x3b')],qs['fields'](_0x3fd812[_0x67e2('0x37')]['fields']));_0x235594['attributes']=_0x235594['attributes'][_0x67e2('0x3e')]?_0x235594[_0x67e2('0x3d')]:_0xd845c5[_0x67e2('0x3b')];if(_0x3fd812[_0x67e2('0x37')][_0x67e2('0x49')]){_0x235594[_0x67e2('0x4f')]=[{'all':!![]}];}_0x235594=_[_0x67e2('0x47')]({},_0x235594,_0x3fd812[_0x67e2('0x48')]);return db[_0x67e2('0x33')][_0x67e2('0x50')](_0x235594)[_0x67e2('0x28')](handleEntityNotFound(_0x51c14a,null))[_0x67e2('0x28')](respondWithResult(_0x51c14a,null))['catch'](handleError(_0x51c14a,null));};exports[_0x67e2('0x51')]=function(_0x1a025e,_0x5bb4d6){return db['AnalyticExtractedReport'][_0x67e2('0x51')](_0x1a025e[_0x67e2('0x52')],{})[_0x67e2('0x28')](function(_0x3a1b71){var _0x48de9f=_0x1a025e[_0x67e2('0x53')][_0x67e2('0x2a')]({'plain':!![]});if(!_0x48de9f)throw new Error(_0x67e2('0x54'));if(_0x48de9f['role']===_0x67e2('0x53')){var _0xdcb652=_0x3a1b71[_0x67e2('0x2a')]({'plain':!![]});var _0xfd047a=_0x67e2('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0xfd047a,'userProfileId':_0x48de9f[_0x67e2('0x55')]},'raw':!![]})['then'](function(_0x47a508){if(_0x47a508&&_0x47a508[_0x67e2('0x56')]===0x0){return db[_0x67e2('0x2c')]['create']({'name':_0xdcb652[_0x67e2('0x2f')],'resourceId':_0xdcb652['id'],'type':_0x47a508['name'],'sectionId':_0x47a508['id']},{})['then'](function(){return _0x3a1b71;});}else{return _0x3a1b71;}})['catch'](function(_0x4bfe64){logger[_0x67e2('0x2d')](_0x67e2('0x57'),_0x4bfe64);throw _0x4bfe64;});}return _0x3a1b71;})['then'](respondWithResult(_0x5bb4d6,0xc9))[_0x67e2('0x4b')](handleError(_0x5bb4d6,null));};exports['update']=function(_0xb7904d,_0x2432a7){if(_0xb7904d[_0x67e2('0x52')]['id']){delete _0xb7904d[_0x67e2('0x52')]['id'];}return db[_0x67e2('0x33')][_0x67e2('0x50')]({'where':{'id':_0xb7904d[_0x67e2('0x4d')]['id']}})[_0x67e2('0x28')](handleEntityNotFound(_0x2432a7,null))[_0x67e2('0x28')](saveUpdates(_0xb7904d[_0x67e2('0x52')],null))[_0x67e2('0x28')](respondWithResult(_0x2432a7,null))[_0x67e2('0x4b')](handleError(_0x2432a7,null));};exports[_0x67e2('0x29')]=function(_0x2d46e1,_0xcf84d8){return db[_0x67e2('0x33')][_0x67e2('0x50')]({'where':{'id':_0x2d46e1[_0x67e2('0x4d')]['id']}})['then'](handleEntityNotFound(_0xcf84d8,null))[_0x67e2('0x28')](removeEntity(_0xcf84d8,null))['catch'](handleError(_0xcf84d8,null));};exports[_0x67e2('0x58')]=function(_0x18bc58,_0x448106,_0x5ba032){return db[_0x67e2('0x33')]['find']({'where':{'id':_0x18bc58[_0x67e2('0x4d')]['id']},'attributes':['name',_0x67e2('0x59'),_0x67e2('0x5a'),_0x67e2('0x5b')],'raw':!![]})[_0x67e2('0x28')](handleEntityNotFound(_0x448106,null))[_0x67e2('0x28')](function(_0x4075a2){if(_0x4075a2){if(!fs['existsSync'](path[_0x67e2('0x5c')](config['root'],_0x67e2('0x5d'),_0x4075a2[_0x67e2('0x5a')]))){throw new db['Sequelize'][(_0x67e2('0x5e'))](_0x67e2('0x5f'));}if(_0x18bc58[_0x67e2('0x37')][_0x67e2('0x60')]){return _0x448106[_0x67e2('0x1b')](0xc8);}return _0x448106['download'](path[_0x67e2('0x5c')](config['root'],_0x67e2('0x5d'),_0x4075a2[_0x67e2('0x5a')]),util['format']('%s.%s',_0x4075a2[_0x67e2('0x59')]||_0x4075a2[_0x67e2('0x2f')],_0x4075a2[_0x67e2('0x5b')][_0x67e2('0x61')]()));}})[_0x67e2('0x4b')](handleError(_0x448106,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index f979596..99186af 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 _0x3f65=['api','bluebird','request-promise','path','rimraf','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger'];(function(_0x4e0b8c,_0x443f31){var _0x633ecc=function(_0x1f1f36){while(--_0x1f1f36){_0x4e0b8c['push'](_0x4e0b8c['shift']());}};_0x633ecc(++_0x443f31);}(_0x3f65,0x171));var _0x53f6=function(_0xec4dc7,_0x345c4c){_0xec4dc7=_0xec4dc7-0x0;var _0x5e8142=_0x3f65[_0xec4dc7];return _0x5e8142;};'use strict';var _=require(_0x53f6('0x0'));var util=require(_0x53f6('0x1'));var logger=require(_0x53f6('0x2'))(_0x53f6('0x3'));var moment=require('moment');var BPromise=require(_0x53f6('0x4'));var rp=require(_0x53f6('0x5'));var fs=require('fs');var path=require(_0x53f6('0x6'));var rimraf=require(_0x53f6('0x7'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0x53f6('0x8')]=function(_0x97032f,_0x3feccd){return _0x97032f[_0x53f6('0x9')](_0x53f6('0xa'),attributes,{'tableName':_0x53f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x009f=['rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x009f,0x171));var _0xf009=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0x009f[_0x1b1e76];return _0x3d743a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf009('0x0'))('api');var moment=require(_0xf009('0x1'));var BPromise=require(_0xf009('0x2'));var rp=require(_0xf009('0x3'));var fs=require('fs');var path=require(_0xf009('0x4'));var rimraf=require(_0xf009('0x5'));var config=require(_0xf009('0x6'));var attributes=require(_0xf009('0x7'));module[_0xf009('0x8')]=function(_0x6975b6,_0x4f9874){return _0x6975b6[_0xf009('0x9')]('AnalyticExtractedReport',attributes,{'tableName':_0xf009('0xa'),'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 bc215d5..38e8c9a 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 _0x578c=['stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xf7aa86,_0x171456){var _0x5eb1ed=function(_0x47175f){while(--_0x47175f){_0xf7aa86['push'](_0xf7aa86['shift']());}};_0x5eb1ed(++_0x171456);}(_0x578c,0x1e8));var _0xc578=function(_0x4072a9,_0x270f79){_0x4072a9=_0x4072a9-0x0;var _0x595ab1=_0x578c[_0x4072a9];return _0x595ab1;};'use strict';var _=require(_0xc578('0x0'));var util=require(_0xc578('0x1'));var moment=require(_0xc578('0x2'));var BPromise=require(_0xc578('0x3'));var rs=require(_0xc578('0x4'));var fs=require('fs');var Redis=require(_0xc578('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc578('0x6'));var logger=require(_0xc578('0x7'))(_0xc578('0x8'));var config=require(_0xc578('0x9'));var jayson=require(_0xc578('0xa'));var client=jayson[_0xc578('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2be6a7,_0x475daa,_0x308eb2){return new BPromise(function(_0xe8792a,_0x5b667c){return client[_0xc578('0xc')](_0x2be6a7,_0x308eb2)[_0xc578('0xd')](function(_0x2f05c0){logger[_0xc578('0xe')](_0xc578('0xf'),_0x475daa,_0xc578('0x10'));logger[_0xc578('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x475daa,_0xc578('0x10'),JSON[_0xc578('0x12')](_0x2f05c0));if(_0x2f05c0['error']){if(_0x2f05c0['error'][_0xc578('0x13')]===0x1f4){logger['error'](_0xc578('0xf'),_0x475daa,_0x2f05c0['error']['message']);return _0x5b667c(_0x2f05c0[_0xc578('0x14')][_0xc578('0x15')]);}logger[_0xc578('0x14')](_0xc578('0xf'),_0x475daa,_0x2f05c0[_0xc578('0x14')][_0xc578('0x15')]);return _0xe8792a(_0x2f05c0['error'][_0xc578('0x15')]);}else{logger[_0xc578('0xe')](_0xc578('0xf'),_0x475daa,_0xc578('0x10'));_0xe8792a(_0x2f05c0['result']['message']);}})['catch'](function(_0x688791){logger[_0xc578('0x14')](_0xc578('0xf'),_0x475daa,_0x688791);_0x5b667c(_0x688791);});});} \ No newline at end of file +var _0x3589=['debug','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x57c3ec,_0x39d9c5){var _0x76a062=function(_0x1e109d){while(--_0x1e109d){_0x57c3ec['push'](_0x57c3ec['shift']());}};_0x76a062(++_0x39d9c5);}(_0x3589,0x94));var _0x9358=function(_0x1c96b1,_0x8fa33){_0x1c96b1=_0x1c96b1-0x0;var _0x9c1394=_0x3589[_0x1c96b1];return _0x9c1394;};'use strict';var _=require(_0x9358('0x0'));var util=require('util');var moment=require(_0x9358('0x1'));var BPromise=require('bluebird');var rs=require(_0x9358('0x2'));var fs=require('fs');var Redis=require(_0x9358('0x3'));var db=require(_0x9358('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9358('0x5'))(_0x9358('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9358('0x7')][_0x9358('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x390ba6,_0x2f6e05,_0x5c5548){return new BPromise(function(_0x4306a2,_0x10518e){return client[_0x9358('0x9')](_0x390ba6,_0x5c5548)['then'](function(_0x1b400c){logger[_0x9358('0xa')](_0x9358('0xb'),_0x2f6e05,'request\x20sent');logger[_0x9358('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x2f6e05,_0x9358('0xd'),JSON[_0x9358('0xe')](_0x1b400c));if(_0x1b400c[_0x9358('0xf')]){if(_0x1b400c[_0x9358('0xf')][_0x9358('0x10')]===0x1f4){logger[_0x9358('0xf')](_0x9358('0xb'),_0x2f6e05,_0x1b400c['error']['message']);return _0x10518e(_0x1b400c[_0x9358('0xf')][_0x9358('0x11')]);}logger[_0x9358('0xf')](_0x9358('0xb'),_0x2f6e05,_0x1b400c[_0x9358('0xf')][_0x9358('0x11')]);return _0x4306a2(_0x1b400c[_0x9358('0xf')][_0x9358('0x11')]);}else{logger[_0x9358('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2f6e05,_0x9358('0xd'));_0x4306a2(_0x1b400c[_0x9358('0x12')]['message']);}})[_0x9358('0x13')](function(_0x2571d4){logger[_0x9358('0xf')](_0x9358('0xb'),_0x2f6e05,_0x2571d4);_0x10518e(_0x2571d4);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index cea8408..8d1d19e 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 _0x5c53=['exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','update','delete','destroy'];(function(_0x5592bd,_0x15ac28){var _0x2ab33d=function(_0xca5c8d){while(--_0xca5c8d){_0x5592bd['push'](_0x5592bd['shift']());}};_0x2ab33d(++_0x15ac28);}(_0x5c53,0x1b9));var _0x35c5=function(_0x501148,_0x3cfffe){_0x501148=_0x501148-0x0;var _0x2a1d91=_0x5c53[_0x501148];return _0x2a1d91;};'use strict';var multer=require(_0x35c5('0x0'));var util=require('util');var path=require(_0x35c5('0x1'));var timeout=require(_0x35c5('0x2'));var express=require('express');var router=express[_0x35c5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x35c5('0x4'));var interaction=require(_0x35c5('0x5'));var config=require(_0x35c5('0x6'));var controller=require(_0x35c5('0x7'));router[_0x35c5('0x8')]('/',auth[_0x35c5('0x9')](),controller[_0x35c5('0xa')]);router[_0x35c5('0x8')](_0x35c5('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x35c5('0x8')](_0x35c5('0xc'),auth[_0x35c5('0x9')](),controller[_0x35c5('0xd')]);router[_0x35c5('0xe')]('/',auth[_0x35c5('0x9')](),controller[_0x35c5('0xf')]);router['put'](_0x35c5('0xb'),auth[_0x35c5('0x9')](),controller[_0x35c5('0x10')]);router[_0x35c5('0x11')](_0x35c5('0xb'),auth['isAuthenticated'](),controller[_0x35c5('0x12')]);module[_0x35c5('0x13')]=router; \ No newline at end of file +var _0x2baa=['put','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download'];(function(_0x203257,_0x10c653){var _0x20d1a6=function(_0x173500){while(--_0x173500){_0x203257['push'](_0x203257['shift']());}};_0x20d1a6(++_0x10c653);}(_0x2baa,0x108));var _0xa2ba=function(_0x4cf986,_0x336e42){_0x4cf986=_0x4cf986-0x0;var _0x1c320d=_0x2baa[_0x4cf986];return _0x1c320d;};'use strict';var multer=require('multer');var util=require(_0xa2ba('0x0'));var path=require(_0xa2ba('0x1'));var timeout=require(_0xa2ba('0x2'));var express=require('express');var router=express[_0xa2ba('0x3')]();var fs_extra=require(_0xa2ba('0x4'));var auth=require(_0xa2ba('0x5'));var interaction=require(_0xa2ba('0x6'));var config=require(_0xa2ba('0x7'));var controller=require(_0xa2ba('0x8'));router[_0xa2ba('0x9')]('/',auth[_0xa2ba('0xa')](),controller[_0xa2ba('0xb')]);router['get'](_0xa2ba('0xc'),auth['isAuthenticated'](),controller[_0xa2ba('0xd')]);router[_0xa2ba('0x9')](_0xa2ba('0xe'),auth[_0xa2ba('0xa')](),controller[_0xa2ba('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa2ba('0x10')](_0xa2ba('0xc'),auth[_0xa2ba('0xa')](),controller['update']);router[_0xa2ba('0x11')](_0xa2ba('0xc'),auth[_0xa2ba('0xa')](),controller[_0xa2ba('0x12')]);module[_0xa2ba('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 0970536..8bf0897 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 _0xbc80=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x126b14,_0x47a656){var _0xf42030=function(_0x38f89f){while(--_0x38f89f){_0x126b14['push'](_0x126b14['shift']());}};_0xf42030(++_0x47a656);}(_0xbc80,0xad));var _0x0bc8=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xbc80[_0x20ef64];return _0x3707d8;};'use strict';var Sequelize=require(_0x0bc8('0x0'));module[_0x0bc8('0x1')]={'field':{'type':Sequelize[_0x0bc8('0x2')]},'alias':{'type':Sequelize[_0x0bc8('0x3')]},'function':{'type':Sequelize[_0x0bc8('0x3')]},'format':{'type':Sequelize[_0x0bc8('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x0bc8('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xd4c6=['STRING','BOOLEAN','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd4c6,0x16e));var _0x6d4c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd4c6[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x6d4c('0x0'));module[_0x6d4c('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x6d4c('0x2')]},'function':{'type':Sequelize[_0x6d4c('0x2')]},'format':{'type':Sequelize[_0x6d4c('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x6d4c('0x2')]},'custom':{'type':Sequelize[_0x6d4c('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 d78465d..9d8693c 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 _0x826e=['hasOwnProperty','nolimit','order','sort','where','pick','map','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','params','rawAttributes','fields','find','catch','create','body','bulkCreate','update','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','AnalyticFieldReport','key','keys','query','filters','intersection','attributes','model','length'];(function(_0x2dfffc,_0x3411af){var _0xf9d20d=function(_0x137b78){while(--_0x137b78){_0x2dfffc['push'](_0x2dfffc['shift']());}};_0xf9d20d(++_0x3411af);}(_0x826e,0x170));var _0xe826=function(_0x1ae005,_0xdbce79){_0x1ae005=_0x1ae005-0x0;var _0x35b3c2=_0x826e[_0x1ae005];return _0x35b3c2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe826('0x0'));var zipdir=require(_0xe826('0x1'));var jsonpatch=require(_0xe826('0x2'));var rp=require(_0xe826('0x3'));var moment=require(_0xe826('0x4'));var BPromise=require(_0xe826('0x5'));var Mustache=require(_0xe826('0x6'));var util=require(_0xe826('0x7'));var path=require(_0xe826('0x8'));var sox=require(_0xe826('0x9'));var csv=require(_0xe826('0xa'));var ejs=require(_0xe826('0xb'));var fs=require('fs');var fs_extra=require(_0xe826('0xc'));var _=require('lodash');var squel=require(_0xe826('0xd'));var crypto=require(_0xe826('0xe'));var jsforce=require(_0xe826('0xf'));var deskjs=require(_0xe826('0x10'));var toCsv=require(_0xe826('0xa'));var querystring=require(_0xe826('0x11'));var Papa=require(_0xe826('0x12'));var Redis=require('ioredis');var authService=require(_0xe826('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe826('0x14'));var hardwareService=require(_0xe826('0x15'));var logger=require(_0xe826('0x16'))(_0xe826('0x17'));var utils=require(_0xe826('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe826('0x19'))['db'];function respondWithStatusCode(_0x486bf3,_0x363a1c){_0x363a1c=_0x363a1c||0xcc;return function(_0xf0bac6){if(_0xf0bac6){return _0x486bf3[_0xe826('0x1a')](_0x363a1c);}return _0x486bf3[_0xe826('0x1b')](_0x363a1c)[_0xe826('0x1c')]();};}function respondWithResult(_0x26a733,_0x230aa0){_0x230aa0=_0x230aa0||0xc8;return function(_0x50aad6){if(_0x50aad6){return _0x26a733[_0xe826('0x1b')](_0x230aa0)[_0xe826('0x1d')](_0x50aad6);}};}function respondWithFilteredResult(_0x48234f,_0x5139db){return function(_0x3d3580){if(_0x3d3580){var _0x2cd4b1=typeof _0x5139db[_0xe826('0x1e')]===_0xe826('0x1f')&&typeof _0x5139db[_0xe826('0x20')]===_0xe826('0x1f');var _0x5cc375=_0x3d3580['count'];var _0x370bd3=_0x2cd4b1?0x0:_0x5139db[_0xe826('0x1e')];var _0x52e860=_0x2cd4b1?_0x3d3580['count']:_0x5139db['offset']+_0x5139db['limit'];var _0xbf52ff;if(_0x52e860>=_0x5cc375){_0x52e860=_0x5cc375;_0xbf52ff=0xc8;}else{_0xbf52ff=0xce;}_0x48234f[_0xe826('0x1b')](_0xbf52ff);return _0x48234f[_0xe826('0x21')](_0xe826('0x22'),_0x370bd3+'-'+_0x52e860+'/'+_0x5cc375)[_0xe826('0x1d')](_0x3d3580);}return null;};}function patchUpdates(_0x1e5f03){return function(_0x5ced23){try{jsonpatch[_0xe826('0x23')](_0x5ced23,_0x1e5f03,!![]);}catch(_0x43b404){return BPromise[_0xe826('0x24')](_0x43b404);}return _0x5ced23[_0xe826('0x25')]();};}function saveUpdates(_0x128624,_0x54afc2){return function(_0x1e1193){if(_0x1e1193){return _0x1e1193['update'](_0x128624)[_0xe826('0x26')](function(_0x872d91){return _0x872d91;});}return null;};}function removeEntity(_0x48528d,_0x27b38b){return function(_0x4d4362){if(_0x4d4362){return _0x4d4362[_0xe826('0x27')]()[_0xe826('0x26')](function(){_0x48528d['status'](0xcc)[_0xe826('0x1c')]();});}};}function handleEntityNotFound(_0x3a5106,_0x4828a7){return function(_0x49ed7e){if(!_0x49ed7e){_0x3a5106[_0xe826('0x1a')](0x194);}return _0x49ed7e;};}function handleError(_0x153a63,_0x549e2b){_0x549e2b=_0x549e2b||0x1f4;return function(_0x28c5d2){logger['error'](_0x28c5d2[_0xe826('0x28')]);if(_0x28c5d2[_0xe826('0x29')]){delete _0x28c5d2['name'];}_0x153a63['status'](_0x549e2b)[_0xe826('0x2a')](_0x28c5d2);};}exports['index']=function(_0x93fe47,_0x16b8db){var _0x5a5753={},_0x286f96={},_0x2f4986={'count':0x0,'rows':[]};var _0x5ee9d0=_['map'](db[_0xe826('0x2b')]['rawAttributes'],function(_0x36da8f){return{'name':_0x36da8f['fieldName'],'type':_0x36da8f['type'][_0xe826('0x2c')]};});_0x286f96['model']=_['map'](_0x5ee9d0,_0xe826('0x29'));_0x286f96['query']=_[_0xe826('0x2d')](_0x93fe47[_0xe826('0x2e')]);_0x286f96[_0xe826('0x2f')]=_[_0xe826('0x30')](_0x286f96['model'],_0x286f96[_0xe826('0x2e')]);_0x5a5753[_0xe826('0x31')]=_[_0xe826('0x30')](_0x286f96[_0xe826('0x32')],qs['fields'](_0x93fe47[_0xe826('0x2e')]['fields']));_0x5a5753[_0xe826('0x31')]=_0x5a5753['attributes'][_0xe826('0x33')]?_0x5a5753[_0xe826('0x31')]:_0x286f96['model'];if(!_0x93fe47[_0xe826('0x2e')][_0xe826('0x34')](_0xe826('0x35'))){_0x5a5753['limit']=qs[_0xe826('0x20')](_0x93fe47['query'][_0xe826('0x20')]);_0x5a5753[_0xe826('0x1e')]=qs[_0xe826('0x1e')](_0x93fe47['query']['offset']);}_0x5a5753[_0xe826('0x36')]=qs[_0xe826('0x37')](_0x93fe47['query'][_0xe826('0x37')]);_0x5a5753[_0xe826('0x38')]=qs[_0xe826('0x2f')](_[_0xe826('0x39')](_0x93fe47[_0xe826('0x2e')],_0x286f96[_0xe826('0x2f')]),_0x5ee9d0);if(_0x93fe47[_0xe826('0x2e')]['filter']){_0x5a5753['where']=_['merge'](_0x5a5753['where'],{'$or':_[_0xe826('0x3a')](_0x5ee9d0,function(_0x41a0dd){if(_0x41a0dd[_0xe826('0x3b')]!==_0xe826('0x3c')){var _0x85ebf9={};_0x85ebf9[_0x41a0dd[_0xe826('0x29')]]={'$like':'%'+_0x93fe47[_0xe826('0x2e')]['filter']+'%'};return _0x85ebf9;}})});}_0x5a5753=_[_0xe826('0x3d')]({},_0x5a5753,_0x93fe47[_0xe826('0x3e')]);var _0x2c905b={'where':_0x5a5753[_0xe826('0x38')]};return db[_0xe826('0x2b')][_0xe826('0x3f')](_0x2c905b)['then'](function(_0x480db1){_0x2f4986['count']=_0x480db1;if(_0x93fe47['query'][_0xe826('0x40')]){_0x5a5753[_0xe826('0x41')]=[{'all':!![]}];}return db[_0xe826('0x2b')][_0xe826('0x42')](_0x5a5753);})[_0xe826('0x26')](function(_0x5ccc1c){_0x2f4986[_0xe826('0x43')]=_0x5ccc1c;return _0x2f4986;})['then'](respondWithFilteredResult(_0x16b8db,_0x5a5753))['catch'](handleError(_0x16b8db,null));};exports['show']=function(_0x15eaed,_0x458f51){var _0x933cbe={'raw':![],'where':{'id':_0x15eaed[_0xe826('0x44')]['id']}},_0x1b5aa5={};_0x1b5aa5[_0xe826('0x32')]=_['keys'](db['AnalyticFieldReport'][_0xe826('0x45')]);_0x1b5aa5['query']=_['keys'](_0x15eaed[_0xe826('0x2e')]);_0x1b5aa5['filters']=_['intersection'](_0x1b5aa5[_0xe826('0x32')],_0x1b5aa5['query']);_0x933cbe['attributes']=_['intersection'](_0x1b5aa5[_0xe826('0x32')],qs[_0xe826('0x46')](_0x15eaed['query'][_0xe826('0x46')]));_0x933cbe[_0xe826('0x31')]=_0x933cbe['attributes']['length']?_0x933cbe[_0xe826('0x31')]:_0x1b5aa5[_0xe826('0x32')];if(_0x15eaed['query'][_0xe826('0x40')]){_0x933cbe['include']=[{'all':!![]}];}_0x933cbe=_[_0xe826('0x3d')]({},_0x933cbe,_0x15eaed[_0xe826('0x3e')]);return db[_0xe826('0x2b')][_0xe826('0x47')](_0x933cbe)['then'](handleEntityNotFound(_0x458f51,null))[_0xe826('0x26')](respondWithResult(_0x458f51,null))[_0xe826('0x48')](handleError(_0x458f51,null));};exports[_0xe826('0x49')]=function(_0x1b85fb,_0x2dd090){return db[_0xe826('0x2b')]['create'](_0x1b85fb[_0xe826('0x4a')],{})[_0xe826('0x26')](respondWithResult(_0x2dd090,0xc9))[_0xe826('0x48')](handleError(_0x2dd090,null));};exports[_0xe826('0x4b')]=function(_0x3a4507,_0x3b2001){return db[_0xe826('0x2b')][_0xe826('0x4b')](_0x3a4507[_0xe826('0x4a')],{'raw':![],'individualHooks':!![]})[_0xe826('0x26')](respondWithResult(_0x3b2001,0xc9))[_0xe826('0x48')](handleError(_0x3b2001,null));};exports[_0xe826('0x4c')]=function(_0x366dd2,_0x3806fe){if(_0x366dd2[_0xe826('0x4a')]['id']){delete _0x366dd2['body']['id'];}return db[_0xe826('0x2b')][_0xe826('0x47')]({'where':{'id':_0x366dd2[_0xe826('0x44')]['id']}})[_0xe826('0x26')](handleEntityNotFound(_0x3806fe,null))['then'](saveUpdates(_0x366dd2[_0xe826('0x4a')],null))['then'](respondWithResult(_0x3806fe,null))[_0xe826('0x48')](handleError(_0x3806fe,null));};exports[_0xe826('0x27')]=function(_0x54fef3,_0x14ccd4){return db[_0xe826('0x2b')][_0xe826('0x47')]({'where':{'id':_0x54fef3['params']['id']}})[_0xe826('0x26')](handleEntityNotFound(_0x14ccd4,null))['then'](removeEntity(_0x14ccd4,null))[_0xe826('0x48')](handleError(_0x14ccd4,null));};exports['bulkDestroy']=function(_0x4ce2bc,_0x598271){return db[_0xe826('0x2b')]['destroy']({'where':{'id':_0x4ce2bc[_0xe826('0x2e')][_0xe826('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0xe826('0x26')](respondWithResult(_0x598271,0xcc))[_0xe826('0x48')](handleError(_0x598271,null));};exports[_0xe826('0x4e')]=function(_0x1e3e58,_0x53c144,_0x4e9b8e){return db[_0xe826('0x4f')][_0xe826('0x50')]({'where':{'id':_0x1e3e58[_0xe826('0x44')]['id']}})[_0xe826('0x26')](handleEntityNotFound(_0x53c144,null))[_0xe826('0x26')](function(_0x98946e){if(_0x98946e){return db[_0xe826('0x51')][_0xe826('0x52')](function(_0x4a00d0){return db[_0xe826('0x2b')]['destroy']({'where':{'CustomReportId':_0x1e3e58[_0xe826('0x44')]['id']},'transaction':_0x4a00d0})[_0xe826('0x26')](function(_0x25fdfc){var _0x1c9f0d=_['map'](_0x1e3e58['body'],function(_0x169fc9){delete _0x169fc9['id'];_0x169fc9[_0xe826('0x53')]=_0x1e3e58[_0xe826('0x44')]['id'];return _0x169fc9;});return db[_0xe826('0x2b')][_0xe826('0x4b')](_0x1c9f0d,{'transaction':_0x4a00d0});});})['then'](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x1e3e58[_0xe826('0x44')]['id']}});});}})[_0xe826('0x26')](respondWithResult(_0x53c144,null))[_0xe826('0x48')](handleError(_0x53c144,null));}; \ No newline at end of file +var _0xbff9=['to-csv','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','create','body','bulkCreate','find','bulkDestroy','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x1c5db9,_0x2ec26d){var _0x34ebeb=function(_0x5414e3){while(--_0x5414e3){_0x1c5db9['push'](_0x1c5db9['shift']());}};_0x34ebeb(++_0x2ec26d);}(_0xbff9,0x1de));var _0x9bff=function(_0x595468,_0x205292){_0x595468=_0x595468-0x0;var _0x26656b=_0xbff9[_0x595468];return _0x26656b;};'use strict';var emlformat=require(_0x9bff('0x0'));var rimraf=require(_0x9bff('0x1'));var zipdir=require(_0x9bff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9bff('0x3'));var BPromise=require(_0x9bff('0x4'));var Mustache=require('mustache');var util=require(_0x9bff('0x5'));var path=require(_0x9bff('0x6'));var sox=require(_0x9bff('0x7'));var csv=require('to-csv');var ejs=require(_0x9bff('0x8'));var fs=require('fs');var fs_extra=require(_0x9bff('0x9'));var _=require('lodash');var squel=require(_0x9bff('0xa'));var crypto=require(_0x9bff('0xb'));var jsforce=require(_0x9bff('0xc'));var deskjs=require(_0x9bff('0xd'));var toCsv=require(_0x9bff('0xe'));var querystring=require(_0x9bff('0xf'));var Papa=require('papaparse');var Redis=require(_0x9bff('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9bff('0x11'));var logger=require(_0x9bff('0x12'))(_0x9bff('0x13'));var utils=require('../../config/utils');var config=require(_0x9bff('0x14'));var licenseUtil=require(_0x9bff('0x15'));var db=require(_0x9bff('0x16'))['db'];function respondWithStatusCode(_0x352896,_0x24585e){_0x24585e=_0x24585e||0xcc;return function(_0x4885aa){if(_0x4885aa){return _0x352896[_0x9bff('0x17')](_0x24585e);}return _0x352896[_0x9bff('0x18')](_0x24585e)[_0x9bff('0x19')]();};}function respondWithResult(_0x2ce69d,_0xcfbfe6){_0xcfbfe6=_0xcfbfe6||0xc8;return function(_0x2171a0){if(_0x2171a0){return _0x2ce69d[_0x9bff('0x18')](_0xcfbfe6)[_0x9bff('0x1a')](_0x2171a0);}};}function respondWithFilteredResult(_0x2fdf35,_0x25828a){return function(_0x6f09b){if(_0x6f09b){var _0xc9f7c7=typeof _0x25828a['offset']==='undefined'&&typeof _0x25828a[_0x9bff('0x1b')]===_0x9bff('0x1c');var _0xfd0464=_0x6f09b[_0x9bff('0x1d')];var _0x87cf43=_0xc9f7c7?0x0:_0x25828a['offset'];var _0x36f5fb=_0xc9f7c7?_0x6f09b['count']:_0x25828a[_0x9bff('0x1e')]+_0x25828a['limit'];var _0x5117cc;if(_0x36f5fb>=_0xfd0464){_0x36f5fb=_0xfd0464;_0x5117cc=0xc8;}else{_0x5117cc=0xce;}_0x2fdf35['status'](_0x5117cc);return _0x2fdf35[_0x9bff('0x1f')](_0x9bff('0x20'),_0x87cf43+'-'+_0x36f5fb+'/'+_0xfd0464)['json'](_0x6f09b);}return null;};}function patchUpdates(_0x138c8f){return function(_0x3046ab){try{jsonpatch['apply'](_0x3046ab,_0x138c8f,!![]);}catch(_0x582416){return BPromise[_0x9bff('0x21')](_0x582416);}return _0x3046ab[_0x9bff('0x22')]();};}function saveUpdates(_0x52fcf9,_0x2d5104){return function(_0x4d7b66){if(_0x4d7b66){return _0x4d7b66[_0x9bff('0x23')](_0x52fcf9)[_0x9bff('0x24')](function(_0x592784){return _0x592784;});}return null;};}function removeEntity(_0x2488e2,_0x2b5d1c){return function(_0x5dc037){if(_0x5dc037){return _0x5dc037[_0x9bff('0x25')]()[_0x9bff('0x24')](function(){_0x2488e2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a3118,_0x2a337f){return function(_0x1cbc1f){if(!_0x1cbc1f){_0x4a3118[_0x9bff('0x17')](0x194);}return _0x1cbc1f;};}function handleError(_0xc3a9fe,_0x369ea0){_0x369ea0=_0x369ea0||0x1f4;return function(_0x1f27fd){logger[_0x9bff('0x26')](_0x1f27fd[_0x9bff('0x27')]);if(_0x1f27fd[_0x9bff('0x28')]){delete _0x1f27fd[_0x9bff('0x28')];}_0xc3a9fe['status'](_0x369ea0)[_0x9bff('0x29')](_0x1f27fd);};}exports[_0x9bff('0x2a')]=function(_0x24e00d,_0x48df9e){var _0x3f1567={},_0xff467a={},_0x1adf13={'count':0x0,'rows':[]};var _0x56e10f=_[_0x9bff('0x2b')](db[_0x9bff('0x2c')]['rawAttributes'],function(_0x30f619){return{'name':_0x30f619['fieldName'],'type':_0x30f619[_0x9bff('0x2d')][_0x9bff('0x2e')]};});_0xff467a[_0x9bff('0x2f')]=_[_0x9bff('0x2b')](_0x56e10f,'name');_0xff467a['query']=_[_0x9bff('0x30')](_0x24e00d[_0x9bff('0x31')]);_0xff467a[_0x9bff('0x32')]=_['intersection'](_0xff467a[_0x9bff('0x2f')],_0xff467a['query']);_0x3f1567[_0x9bff('0x33')]=_[_0x9bff('0x34')](_0xff467a[_0x9bff('0x2f')],qs[_0x9bff('0x35')](_0x24e00d[_0x9bff('0x31')][_0x9bff('0x35')]));_0x3f1567[_0x9bff('0x33')]=_0x3f1567[_0x9bff('0x33')][_0x9bff('0x36')]?_0x3f1567['attributes']:_0xff467a[_0x9bff('0x2f')];if(!_0x24e00d['query'][_0x9bff('0x37')](_0x9bff('0x38'))){_0x3f1567['limit']=qs[_0x9bff('0x1b')](_0x24e00d[_0x9bff('0x31')][_0x9bff('0x1b')]);_0x3f1567[_0x9bff('0x1e')]=qs[_0x9bff('0x1e')](_0x24e00d['query'][_0x9bff('0x1e')]);}_0x3f1567[_0x9bff('0x39')]=qs['sort'](_0x24e00d[_0x9bff('0x31')][_0x9bff('0x3a')]);_0x3f1567[_0x9bff('0x3b')]=qs['filters'](_[_0x9bff('0x3c')](_0x24e00d[_0x9bff('0x31')],_0xff467a['filters']),_0x56e10f);if(_0x24e00d[_0x9bff('0x31')][_0x9bff('0x3d')]){_0x3f1567[_0x9bff('0x3b')]=_[_0x9bff('0x3e')](_0x3f1567[_0x9bff('0x3b')],{'$or':_[_0x9bff('0x2b')](_0x56e10f,function(_0x20764d){if(_0x20764d['type']!==_0x9bff('0x3f')){var _0x3e3ce={};_0x3e3ce[_0x20764d[_0x9bff('0x28')]]={'$like':'%'+_0x24e00d['query'][_0x9bff('0x3d')]+'%'};return _0x3e3ce;}})});}_0x3f1567=_['merge']({},_0x3f1567,_0x24e00d[_0x9bff('0x40')]);var _0x24bd65={'where':_0x3f1567[_0x9bff('0x3b')]};return db[_0x9bff('0x2c')][_0x9bff('0x1d')](_0x24bd65)[_0x9bff('0x24')](function(_0x5c9aa7){_0x1adf13[_0x9bff('0x1d')]=_0x5c9aa7;if(_0x24e00d[_0x9bff('0x31')][_0x9bff('0x41')]){_0x3f1567['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x9bff('0x42')](_0x3f1567);})[_0x9bff('0x24')](function(_0x33306d){_0x1adf13[_0x9bff('0x43')]=_0x33306d;return _0x1adf13;})[_0x9bff('0x24')](respondWithFilteredResult(_0x48df9e,_0x3f1567))[_0x9bff('0x44')](handleError(_0x48df9e,null));};exports['show']=function(_0x2694e8,_0x5aba3f){var _0x15d98f={'raw':![],'where':{'id':_0x2694e8[_0x9bff('0x45')]['id']}},_0x4f72c={};_0x4f72c[_0x9bff('0x2f')]=_[_0x9bff('0x30')](db[_0x9bff('0x2c')][_0x9bff('0x46')]);_0x4f72c[_0x9bff('0x31')]=_['keys'](_0x2694e8['query']);_0x4f72c[_0x9bff('0x32')]=_['intersection'](_0x4f72c[_0x9bff('0x2f')],_0x4f72c[_0x9bff('0x31')]);_0x15d98f[_0x9bff('0x33')]=_[_0x9bff('0x34')](_0x4f72c['model'],qs[_0x9bff('0x35')](_0x2694e8[_0x9bff('0x31')][_0x9bff('0x35')]));_0x15d98f['attributes']=_0x15d98f[_0x9bff('0x33')]['length']?_0x15d98f[_0x9bff('0x33')]:_0x4f72c[_0x9bff('0x2f')];if(_0x2694e8[_0x9bff('0x31')][_0x9bff('0x41')]){_0x15d98f[_0x9bff('0x47')]=[{'all':!![]}];}_0x15d98f=_[_0x9bff('0x3e')]({},_0x15d98f,_0x2694e8['options']);return db[_0x9bff('0x2c')]['find'](_0x15d98f)[_0x9bff('0x24')](handleEntityNotFound(_0x5aba3f,null))[_0x9bff('0x24')](respondWithResult(_0x5aba3f,null))[_0x9bff('0x44')](handleError(_0x5aba3f,null));};exports['create']=function(_0x346797,_0xec86e5){return db[_0x9bff('0x2c')][_0x9bff('0x48')](_0x346797[_0x9bff('0x49')],{})[_0x9bff('0x24')](respondWithResult(_0xec86e5,0xc9))[_0x9bff('0x44')](handleError(_0xec86e5,null));};exports['bulkCreate']=function(_0x1d4ae5,_0x2fcfc2){return db['AnalyticFieldReport'][_0x9bff('0x4a')](_0x1d4ae5[_0x9bff('0x49')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2fcfc2,0xc9))[_0x9bff('0x44')](handleError(_0x2fcfc2,null));};exports[_0x9bff('0x23')]=function(_0x3b6f91,_0x192846){if(_0x3b6f91[_0x9bff('0x49')]['id']){delete _0x3b6f91[_0x9bff('0x49')]['id'];}return db['AnalyticFieldReport'][_0x9bff('0x4b')]({'where':{'id':_0x3b6f91[_0x9bff('0x45')]['id']}})[_0x9bff('0x24')](handleEntityNotFound(_0x192846,null))[_0x9bff('0x24')](saveUpdates(_0x3b6f91[_0x9bff('0x49')],null))[_0x9bff('0x24')](respondWithResult(_0x192846,null))[_0x9bff('0x44')](handleError(_0x192846,null));};exports[_0x9bff('0x25')]=function(_0x37d464,_0x35db89){return db[_0x9bff('0x2c')][_0x9bff('0x4b')]({'where':{'id':_0x37d464[_0x9bff('0x45')]['id']}})[_0x9bff('0x24')](handleEntityNotFound(_0x35db89,null))[_0x9bff('0x24')](removeEntity(_0x35db89,null))[_0x9bff('0x44')](handleError(_0x35db89,null));};exports[_0x9bff('0x4c')]=function(_0x184418,_0x3d49a5){return db[_0x9bff('0x2c')][_0x9bff('0x25')]({'where':{'id':_0x184418['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0x9bff('0x24')](respondWithResult(_0x3d49a5,0xcc))[_0x9bff('0x44')](handleError(_0x3d49a5,null));};exports['addFields']=function(_0x333975,_0x583e36,_0x522a8e){return db[_0x9bff('0x4d')][_0x9bff('0x4e')]({'where':{'id':_0x333975[_0x9bff('0x45')]['id']}})['then'](handleEntityNotFound(_0x583e36,null))[_0x9bff('0x24')](function(_0x5de237){if(_0x5de237){return db[_0x9bff('0x4f')][_0x9bff('0x50')](function(_0x5e6b01){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x333975[_0x9bff('0x45')]['id']},'transaction':_0x5e6b01})['then'](function(_0x559d0b){var _0x3fda64=_[_0x9bff('0x2b')](_0x333975[_0x9bff('0x49')],function(_0x584749){delete _0x584749['id'];_0x584749[_0x9bff('0x51')]=_0x333975['params']['id'];return _0x584749;});return db[_0x9bff('0x2c')][_0x9bff('0x4a')](_0x3fda64,{'transaction':_0x5e6b01});});})['then'](function(){return db[_0x9bff('0x2c')][_0x9bff('0x42')]({'where':{'CustomReportId':_0x333975[_0x9bff('0x45')]['id']}});});}})[_0x9bff('0x24')](respondWithResult(_0x583e36,null))[_0x9bff('0x44')](handleError(_0x583e36,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index f5fe583..fb699c0 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 _0x122d=['./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x293c95,_0x3f6393){var _0x986ea0=function(_0x4f3397){while(--_0x4f3397){_0x293c95['push'](_0x293c95['shift']());}};_0x986ea0(++_0x3f6393);}(_0x122d,0xca));var _0xd122=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0x122d[_0x503950];return _0x1657a9;};'use strict';var _=require(_0xd122('0x0'));var util=require('util');var logger=require(_0xd122('0x1'))(_0xd122('0x2'));var moment=require(_0xd122('0x3'));var BPromise=require('bluebird');var rp=require(_0xd122('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd122('0x5'));var config=require(_0xd122('0x6'));var attributes=require(_0xd122('0x7'));module[_0xd122('0x8')]=function(_0x18fe72,_0x5ac154){return _0x18fe72['define'](_0xd122('0x9'),attributes,{'tableName':_0xd122('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3f1=['moment','bluebird','request-promise','rimraf','../../config/environment','define','AnalyticFieldReport','lodash','util','../../config/logger','api'];(function(_0x1747e2,_0x520b4e){var _0x168443=function(_0x3a73da){while(--_0x3a73da){_0x1747e2['push'](_0x1747e2['shift']());}};_0x168443(++_0x520b4e);}(_0xe3f1,0x80));var _0x1e3f=function(_0x168eac,_0x234643){_0x168eac=_0x168eac-0x0;var _0x50a3a5=_0xe3f1[_0x168eac];return _0x50a3a5;};'use strict';var _=require(_0x1e3f('0x0'));var util=require(_0x1e3f('0x1'));var logger=require(_0x1e3f('0x2'))(_0x1e3f('0x3'));var moment=require(_0x1e3f('0x4'));var BPromise=require(_0x1e3f('0x5'));var rp=require(_0x1e3f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e3f('0x7'));var config=require(_0x1e3f('0x8'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x29ca16,_0x2f94a6){return _0x29ca16[_0x1e3f('0x9')](_0x1e3f('0xa'),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 506868c..467b834 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 _0x601e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring'];(function(_0x1b1574,_0x5c44d8){var _0x3afd35=function(_0x26e939){while(--_0x26e939){_0x1b1574['push'](_0x1b1574['shift']());}};_0x3afd35(++_0x5c44d8);}(_0x601e,0x1e0));var _0xe601=function(_0x1d0499,_0x23e22f){_0x1d0499=_0x1d0499-0x0;var _0x153fb3=_0x601e[_0x1d0499];return _0x153fb3;};'use strict';var _=require(_0xe601('0x0'));var util=require('util');var moment=require(_0xe601('0x1'));var BPromise=require('bluebird');var rs=require(_0xe601('0x2'));var fs=require('fs');var Redis=require(_0xe601('0x3'));var db=require(_0xe601('0x4'))['db'];var utils=require(_0xe601('0x5'));var logger=require(_0xe601('0x6'))(_0xe601('0x7'));var config=require(_0xe601('0x8'));var jayson=require(_0xe601('0x9'));var client=jayson[_0xe601('0xa')][_0xe601('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ba00f,_0x1077a5,_0x4b3254){return new BPromise(function(_0x1b603d,_0x125065){return client['request'](_0x4ba00f,_0x4b3254)[_0xe601('0xc')](function(_0xa6fa81){logger[_0xe601('0xd')](_0xe601('0xe'),_0x1077a5,_0xe601('0xf'));logger[_0xe601('0x10')](_0xe601('0x11'),_0x1077a5,_0xe601('0xf'),JSON[_0xe601('0x12')](_0xa6fa81));if(_0xa6fa81[_0xe601('0x13')]){if(_0xa6fa81[_0xe601('0x13')][_0xe601('0x14')]===0x1f4){logger[_0xe601('0x13')](_0xe601('0xe'),_0x1077a5,_0xa6fa81['error'][_0xe601('0x15')]);return _0x125065(_0xa6fa81[_0xe601('0x13')][_0xe601('0x15')]);}logger[_0xe601('0x13')](_0xe601('0xe'),_0x1077a5,_0xa6fa81[_0xe601('0x13')][_0xe601('0x15')]);return _0x1b603d(_0xa6fa81[_0xe601('0x13')][_0xe601('0x15')]);}else{logger[_0xe601('0xd')](_0xe601('0xe'),_0x1077a5,_0xe601('0xf'));_0x1b603d(_0xa6fa81['result']['message']);}})[_0xe601('0x16')](function(_0xb5996b){logger[_0xe601('0x13')](_0xe601('0xe'),_0x1077a5,_0xb5996b);_0x125065(_0xb5996b);});});} \ No newline at end of file +var _0xf247=['http','request','then','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x149f8a,_0x4da040){var _0x3f3387=function(_0x2d6c5f){while(--_0x2d6c5f){_0x149f8a['push'](_0x149f8a['shift']());}};_0x3f3387(++_0x4da040);}(_0xf247,0x172));var _0x7f24=function(_0x4df17c,_0x2d2b61){_0x4df17c=_0x4df17c-0x0;var _0x4e79b5=_0xf247[_0x4df17c];return _0x4e79b5;};'use strict';var _=require(_0x7f24('0x0'));var util=require(_0x7f24('0x1'));var moment=require(_0x7f24('0x2'));var BPromise=require(_0x7f24('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f24('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7f24('0x5'))(_0x7f24('0x6'));var config=require(_0x7f24('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7f24('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34338b,_0x56cf5d,_0x248939){return new BPromise(function(_0x45c105,_0x44d354){return client[_0x7f24('0x9')](_0x34338b,_0x248939)[_0x7f24('0xa')](function(_0x27f995){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x56cf5d,_0x7f24('0xb'));logger[_0x7f24('0xc')](_0x7f24('0xd'),_0x56cf5d,'request\x20sent',JSON[_0x7f24('0xe')](_0x27f995));if(_0x27f995[_0x7f24('0xf')]){if(_0x27f995['error']['code']===0x1f4){logger[_0x7f24('0xf')](_0x7f24('0x10'),_0x56cf5d,_0x27f995[_0x7f24('0xf')][_0x7f24('0x11')]);return _0x44d354(_0x27f995[_0x7f24('0xf')][_0x7f24('0x11')]);}logger['error'](_0x7f24('0x10'),_0x56cf5d,_0x27f995[_0x7f24('0xf')][_0x7f24('0x11')]);return _0x45c105(_0x27f995[_0x7f24('0xf')][_0x7f24('0x11')]);}else{logger[_0x7f24('0x12')](_0x7f24('0x10'),_0x56cf5d,_0x7f24('0xb'));_0x45c105(_0x27f995[_0x7f24('0x13')][_0x7f24('0x11')]);}})[_0x7f24('0x14')](function(_0x3dd794){logger[_0x7f24('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x56cf5d,_0x3dd794);_0x44d354(_0x3dd794);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 9d78679..293c627 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(_0x52a22e,_0x25f3ea){var _0x3fdeb0=function(_0x266f7c){while(--_0x266f7c){_0x52a22e['push'](_0x52a22e['shift']());}};_0x3fdeb0(++_0x25f3ea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x4e2118,_0x1d68fa){var _0x30cc12=function(_0x224e3e){while(--_0x224e3e){_0x4e2118['push'](_0x4e2118['shift']());}};_0x30cc12(++_0x1d68fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 6382a4e..5172f05 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 _0x2cbd=['exports','name','STRING','TEXT','sequelize'];(function(_0x1988c0,_0x6e5d0a){var _0x5c6be3=function(_0x29e815){while(--_0x29e815){_0x1988c0['push'](_0x1988c0['shift']());}};_0x5c6be3(++_0x6e5d0a);}(_0x2cbd,0x19e));var _0xd2cb=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x2cbd[_0x3cae69];return _0x3128eb;};'use strict';var Sequelize=require(_0xd2cb('0x0'));module[_0xd2cb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd2cb('0x2')},'table':{'type':Sequelize[_0xd2cb('0x3')]},'metric':{'type':Sequelize[_0xd2cb('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9990=['name','TEXT','exports','STRING'];(function(_0x4d6bfd,_0x8d79ff){var _0x243a46=function(_0x3883b1){while(--_0x3883b1){_0x4d6bfd['push'](_0x4d6bfd['shift']());}};_0x243a46(++_0x8d79ff);}(_0x9990,0xf6));var _0x0999=function(_0x9683dd,_0x334a98){_0x9683dd=_0x9683dd-0x0;var _0x42758e=_0x9990[_0x9683dd];return _0x42758e;};'use strict';var Sequelize=require('sequelize');module[_0x0999('0x0')]={'name':{'type':Sequelize[_0x0999('0x1')],'allowNull':![],'unique':_0x0999('0x2')},'table':{'type':Sequelize[_0x0999('0x1')]},'metric':{'type':Sequelize[_0x0999('0x3')]},'description':{'type':Sequelize[_0x0999('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index e9d6922..eface59 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 _0x425d=['VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','where','merge'];(function(_0x5c3b5f,_0x14a426){var _0xbceeb0=function(_0x4364bc){while(--_0x4364bc){_0x5c3b5f['push'](_0x5c3b5f['shift']());}};_0xbceeb0(++_0x14a426);}(_0x425d,0x1e0));var _0xd425=function(_0x1d606e,_0x438c6a){_0x1d606e=_0x1d606e-0x0;var _0x528543=_0x425d[_0x1d606e];return _0x528543;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];function respondWithStatusCode(_0x9bb611,_0x3cacf7){_0x3cacf7=_0x3cacf7||0xcc;return function(_0x3b5de8){if(_0x3b5de8){return _0x9bb611[_0xd425('0x1d')](_0x3cacf7);}return _0x9bb611['status'](_0x3cacf7)[_0xd425('0x1e')]();};}function respondWithResult(_0x17a498,_0x336dc3){_0x336dc3=_0x336dc3||0xc8;return function(_0x5d3d60){if(_0x5d3d60){return _0x17a498[_0xd425('0x1f')](_0x336dc3)[_0xd425('0x20')](_0x5d3d60);}};}function respondWithFilteredResult(_0x643fd2,_0x41f34d){return function(_0x1fc822){if(_0x1fc822){var _0x538a0a=typeof _0x41f34d[_0xd425('0x21')]===_0xd425('0x22')&&typeof _0x41f34d[_0xd425('0x23')]===_0xd425('0x22');var _0x5d6585=_0x1fc822[_0xd425('0x24')];var _0x434d97=_0x538a0a?0x0:_0x41f34d[_0xd425('0x21')];var _0x1155bc=_0x538a0a?_0x1fc822['count']:_0x41f34d['offset']+_0x41f34d['limit'];var _0x4b293a;if(_0x1155bc>=_0x5d6585){_0x1155bc=_0x5d6585;_0x4b293a=0xc8;}else{_0x4b293a=0xce;}_0x643fd2[_0xd425('0x1f')](_0x4b293a);return _0x643fd2[_0xd425('0x25')](_0xd425('0x26'),_0x434d97+'-'+_0x1155bc+'/'+_0x5d6585)['json'](_0x1fc822);}return null;};}function patchUpdates(_0x355af0){return function(_0x7e982e){try{jsonpatch['apply'](_0x7e982e,_0x355af0,!![]);}catch(_0x2e1ec4){return BPromise[_0xd425('0x27')](_0x2e1ec4);}return _0x7e982e[_0xd425('0x28')]();};}function saveUpdates(_0x1d3fc0,_0x3e93db){return function(_0xb240c4){if(_0xb240c4){return _0xb240c4[_0xd425('0x29')](_0x1d3fc0)[_0xd425('0x2a')](function(_0x314201){return _0x314201;});}return null;};}function removeEntity(_0x2b030b,_0x151ad9){return function(_0x40e84b){if(_0x40e84b){return _0x40e84b['destroy']()[_0xd425('0x2a')](function(){var _0x264b0e=_0x40e84b[_0xd425('0x2b')]({'plain':!![]});var _0x1908a5=_0xd425('0x2c');return db[_0xd425('0x2d')][_0xd425('0x2e')]({'where':{'type':_0x1908a5,'resourceId':_0x264b0e['id']}})['then'](function(){return _0x40e84b;});})[_0xd425('0x2a')](function(){_0x2b030b[_0xd425('0x1f')](0xcc)[_0xd425('0x1e')]();});}};}function handleEntityNotFound(_0x57c950,_0x27ef8a){return function(_0x3ad9bd){if(!_0x3ad9bd){_0x57c950[_0xd425('0x1d')](0x194);}return _0x3ad9bd;};}function handleError(_0x999fb9,_0x27d29a){_0x27d29a=_0x27d29a||0x1f4;return function(_0x185d7e){logger[_0xd425('0x2f')](_0x185d7e[_0xd425('0x30')]);if(_0x185d7e[_0xd425('0x31')]){delete _0x185d7e[_0xd425('0x31')];}_0x999fb9['status'](_0x27d29a)[_0xd425('0x32')](_0x185d7e);};}exports[_0xd425('0x33')]=function(_0x298602,_0x3695dd){var _0x3275b1={},_0x1abf33={},_0x47405f={'count':0x0,'rows':[]};var _0x40c392=_[_0xd425('0x34')](db[_0xd425('0x35')][_0xd425('0x36')],function(_0x5f3dab){return{'name':_0x5f3dab[_0xd425('0x37')],'type':_0x5f3dab[_0xd425('0x38')][_0xd425('0x39')]};});_0x1abf33[_0xd425('0x3a')]=_[_0xd425('0x34')](_0x40c392,'name');_0x1abf33[_0xd425('0x3b')]=_[_0xd425('0x3c')](_0x298602['query']);_0x1abf33['filters']=_['intersection'](_0x1abf33[_0xd425('0x3a')],_0x1abf33[_0xd425('0x3b')]);_0x3275b1[_0xd425('0x3d')]=_[_0xd425('0x3e')](_0x1abf33['model'],qs[_0xd425('0x3f')](_0x298602[_0xd425('0x3b')][_0xd425('0x3f')]));_0x3275b1[_0xd425('0x3d')]=_0x3275b1[_0xd425('0x3d')][_0xd425('0x40')]?_0x3275b1[_0xd425('0x3d')]:_0x1abf33['model'];if(!_0x298602[_0xd425('0x3b')]['hasOwnProperty'](_0xd425('0x41'))){_0x3275b1[_0xd425('0x23')]=qs[_0xd425('0x23')](_0x298602['query'][_0xd425('0x23')]);_0x3275b1[_0xd425('0x21')]=qs[_0xd425('0x21')](_0x298602[_0xd425('0x3b')]['offset']);}_0x3275b1[_0xd425('0x42')]=qs[_0xd425('0x43')](_0x298602['query']['sort']);_0x3275b1['where']=qs[_0xd425('0x44')](_[_0xd425('0x45')](_0x298602[_0xd425('0x3b')],_0x1abf33['filters']),_0x40c392);if(_0x298602['query']['filter']){_0x3275b1[_0xd425('0x46')]=_[_0xd425('0x47')](_0x3275b1[_0xd425('0x46')],{'$or':_[_0xd425('0x34')](_0x40c392,function(_0xa9fd7c){if(_0xa9fd7c[_0xd425('0x38')]!==_0xd425('0x48')){var _0x4b922f={};_0x4b922f[_0xa9fd7c[_0xd425('0x31')]]={'$like':'%'+_0x298602[_0xd425('0x3b')][_0xd425('0x49')]+'%'};return _0x4b922f;}})});}_0x3275b1=_['merge']({},_0x3275b1,_0x298602[_0xd425('0x4a')]);var _0x2dffc7={'where':_0x3275b1[_0xd425('0x46')]};return db['AnalyticMetric'][_0xd425('0x24')](_0x2dffc7)[_0xd425('0x2a')](function(_0x1c5ba6){_0x47405f[_0xd425('0x24')]=_0x1c5ba6;if(_0x298602['query'][_0xd425('0x4b')]){_0x3275b1[_0xd425('0x4c')]=[{'all':!![]}];}return db[_0xd425('0x35')][_0xd425('0x4d')](_0x3275b1);})[_0xd425('0x2a')](function(_0x2f6bf7){_0x47405f[_0xd425('0x4e')]=_0x2f6bf7;return _0x47405f;})['then'](respondWithFilteredResult(_0x3695dd,_0x3275b1))[_0xd425('0x4f')](handleError(_0x3695dd,null));};exports[_0xd425('0x50')]=function(_0x5b65fe,_0x1a44a8){var _0x491c51={'raw':!![],'where':{'id':_0x5b65fe[_0xd425('0x51')]['id']}},_0x5e12bf={};_0x5e12bf['model']=_[_0xd425('0x3c')](db['AnalyticMetric'][_0xd425('0x36')]);_0x5e12bf[_0xd425('0x3b')]=_[_0xd425('0x3c')](_0x5b65fe[_0xd425('0x3b')]);_0x5e12bf[_0xd425('0x44')]=_['intersection'](_0x5e12bf[_0xd425('0x3a')],_0x5e12bf['query']);_0x491c51[_0xd425('0x3d')]=_['intersection'](_0x5e12bf[_0xd425('0x3a')],qs[_0xd425('0x3f')](_0x5b65fe[_0xd425('0x3b')][_0xd425('0x3f')]));_0x491c51[_0xd425('0x3d')]=_0x491c51['attributes'][_0xd425('0x40')]?_0x491c51[_0xd425('0x3d')]:_0x5e12bf[_0xd425('0x3a')];if(_0x5b65fe[_0xd425('0x3b')][_0xd425('0x4b')]){_0x491c51['include']=[{'all':!![]}];}_0x491c51=_[_0xd425('0x47')]({},_0x491c51,_0x5b65fe[_0xd425('0x4a')]);return db[_0xd425('0x35')][_0xd425('0x52')](_0x491c51)[_0xd425('0x2a')](handleEntityNotFound(_0x1a44a8,null))[_0xd425('0x2a')](respondWithResult(_0x1a44a8,null))['catch'](handleError(_0x1a44a8,null));};exports[_0xd425('0x53')]=function(_0x128cb3,_0x5bfac6){return db[_0xd425('0x35')][_0xd425('0x53')](_0x128cb3[_0xd425('0x54')],{})[_0xd425('0x2a')](function(_0x5c0219){var _0x54f1d=_0x128cb3[_0xd425('0x55')][_0xd425('0x2b')]({'plain':!![]});if(!_0x54f1d)throw new Error(_0xd425('0x56'));if(_0x54f1d[_0xd425('0x57')]==='user'){var _0x4be6fa=_0x5c0219[_0xd425('0x2b')]({'plain':!![]});var _0x5496d8=_0xd425('0x2c');return db[_0xd425('0x58')]['find']({'where':{'name':_0x5496d8,'userProfileId':_0x54f1d[_0xd425('0x59')]},'raw':!![]})['then'](function(_0x48d5b8){if(_0x48d5b8&&_0x48d5b8[_0xd425('0x5a')]===0x0){return db[_0xd425('0x2d')][_0xd425('0x53')]({'name':_0x4be6fa[_0xd425('0x31')],'resourceId':_0x4be6fa['id'],'type':_0x48d5b8[_0xd425('0x31')],'sectionId':_0x48d5b8['id']},{})[_0xd425('0x2a')](function(){return _0x5c0219;});}else{return _0x5c0219;}})[_0xd425('0x4f')](function(_0x4118fe){logger['error'](_0xd425('0x5b'),_0x4118fe);throw _0x4118fe;});}return _0x5c0219;})[_0xd425('0x2a')](respondWithResult(_0x5bfac6,0xc9))[_0xd425('0x4f')](handleError(_0x5bfac6,null));};exports[_0xd425('0x29')]=function(_0x7b1080,_0x1c80c2){if(_0x7b1080[_0xd425('0x54')]['id']){delete _0x7b1080[_0xd425('0x54')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0x7b1080['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x1c80c2,null))[_0xd425('0x2a')](saveUpdates(_0x7b1080[_0xd425('0x54')],null))[_0xd425('0x2a')](respondWithResult(_0x1c80c2,null))['catch'](handleError(_0x1c80c2,null));};exports['destroy']=function(_0x499a60,_0x5e1294){return db[_0xd425('0x35')][_0xd425('0x52')]({'where':{'id':_0x499a60['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x5e1294,null))[_0xd425('0x2a')](removeEntity(_0x5e1294,null))[_0xd425('0x4f')](handleError(_0x5e1294,null));}; \ No newline at end of file +var _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x250b07,_0x5f4af3){var _0x2a9eb8=function(_0x6c96db){while(--_0x6c96db){_0x250b07['push'](_0x250b07['shift']());}};_0x2a9eb8(++_0x5f4af3);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x4a6156,_0x2b8ce6){_0x4a6156=_0x4a6156-0x0;var _0x12c1f6=_0xf2ca[_0x4a6156];return _0x12c1f6;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 28b81f9..f613821 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 _0x5e0e=['../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x2a9fe5,_0x14b23b){var _0x283856=function(_0x1f4190){while(--_0x1f4190){_0x2a9fe5['push'](_0x2a9fe5['shift']());}};_0x283856(++_0x14b23b);}(_0x5e0e,0x89));var _0xe5e0=function(_0x2ae6ee,_0x16805a){_0x2ae6ee=_0x2ae6ee-0x0;var _0x17653b=_0x5e0e[_0x2ae6ee];return _0x17653b;};'use strict';var _=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var logger=require('../../config/logger')(_0xe5e0('0x2'));var moment=require(_0xe5e0('0x3'));var BPromise=require(_0xe5e0('0x4'));var rp=require(_0xe5e0('0x5'));var fs=require('fs');var path=require(_0xe5e0('0x6'));var rimraf=require('rimraf');var config=require(_0xe5e0('0x7'));var attributes=require('./analyticMetric.attributes');module[_0xe5e0('0x8')]=function(_0x3e564e,_0x2ff9ac){return _0x3e564e[_0xe5e0('0x9')](_0xe5e0('0xa'),attributes,{'tableName':_0xe5e0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd43e=['bluebird','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','lodash','../../config/logger','api','moment'];(function(_0x458f09,_0xf2ee90){var _0x1ca565=function(_0x8ec760){while(--_0x8ec760){_0x458f09['push'](_0x458f09['shift']());}};_0x1ca565(++_0xf2ee90);}(_0xd43e,0x88));var _0xed43=function(_0x304c7d,_0x642f7b){_0x304c7d=_0x304c7d-0x0;var _0x50efde=_0xd43e[_0x304c7d];return _0x50efde;};'use strict';var _=require(_0xed43('0x0'));var util=require('util');var logger=require(_0xed43('0x1'))(_0xed43('0x2'));var moment=require(_0xed43('0x3'));var BPromise=require(_0xed43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xed43('0x5'));var config=require(_0xed43('0x6'));var attributes=require(_0xed43('0x7'));module[_0xed43('0x8')]=function(_0x52425d,_0x1d4276){return _0x52425d[_0xed43('0x9')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','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 4e71c69..6cbbd4f 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 _0x8ad5=['../../config/environment','jayson/promise','client','http','request','then','info','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','AnalyticMetric,\x20%s,\x20%s','result','catch','util','moment','randomstring','rpc'];(function(_0x4e1d6b,_0x157bdb){var _0x16ca93=function(_0x53dd51){while(--_0x53dd51){_0x4e1d6b['push'](_0x4e1d6b['shift']());}};_0x16ca93(++_0x157bdb);}(_0x8ad5,0x18b));var _0x58ad=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8ad5[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x58ad('0x0'));var moment=require(_0x58ad('0x1'));var BPromise=require('bluebird');var rs=require(_0x58ad('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x58ad('0x3'));var config=require(_0x58ad('0x4'));var jayson=require(_0x58ad('0x5'));var client=jayson[_0x58ad('0x6')][_0x58ad('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x288f1e,_0x4cdcbb,_0x15b98b){return new BPromise(function(_0x174071,_0x48077c){return client[_0x58ad('0x8')](_0x288f1e,_0x15b98b)[_0x58ad('0x9')](function(_0x1576a0){logger[_0x58ad('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x4cdcbb,'request\x20sent');logger[_0x58ad('0xb')](_0x58ad('0xc'),_0x4cdcbb,_0x58ad('0xd'),JSON[_0x58ad('0xe')](_0x1576a0));if(_0x1576a0[_0x58ad('0xf')]){if(_0x1576a0[_0x58ad('0xf')][_0x58ad('0x10')]===0x1f4){logger[_0x58ad('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x4cdcbb,_0x1576a0[_0x58ad('0xf')][_0x58ad('0x11')]);return _0x48077c(_0x1576a0[_0x58ad('0xf')]['message']);}logger[_0x58ad('0xf')](_0x58ad('0x12'),_0x4cdcbb,_0x1576a0[_0x58ad('0xf')][_0x58ad('0x11')]);return _0x174071(_0x1576a0[_0x58ad('0xf')]['message']);}else{logger['info'](_0x58ad('0x12'),_0x4cdcbb,_0x58ad('0xd'));_0x174071(_0x1576a0[_0x58ad('0x13')]['message']);}})[_0x58ad('0x14')](function(_0x5f3c33){logger[_0x58ad('0xf')](_0x58ad('0x12'),_0x4cdcbb,_0x5f3c33);_0x48077c(_0x5f3c33);});});} \ No newline at end of file +var _0x3647=['../../config/utils','../../config/logger','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4177a2,_0x5b28ad){var _0x17d111=function(_0x3acb46){while(--_0x3acb46){_0x4177a2['push'](_0x4177a2['shift']());}};_0x17d111(++_0x5b28ad);}(_0x3647,0xea));var _0x7364=function(_0x260af3,_0x177309){_0x260af3=_0x260af3-0x0;var _0x12ed98=_0x3647[_0x260af3];return _0x12ed98;};'use strict';var _=require(_0x7364('0x0'));var util=require(_0x7364('0x1'));var moment=require(_0x7364('0x2'));var BPromise=require('bluebird');var rs=require(_0x7364('0x3'));var fs=require('fs');var Redis=require(_0x7364('0x4'));var db=require(_0x7364('0x5'))['db'];var utils=require(_0x7364('0x6'));var logger=require(_0x7364('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7364('0x8')][_0x7364('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d2db2,_0x5014a2,_0xfae4aa){return new BPromise(function(_0xe7b0c1,_0x588334){return client[_0x7364('0xa')](_0x2d2db2,_0xfae4aa)[_0x7364('0xb')](function(_0x49c0a8){logger[_0x7364('0xc')](_0x7364('0xd'),_0x5014a2,_0x7364('0xe'));logger[_0x7364('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x5014a2,_0x7364('0xe'),JSON[_0x7364('0x10')](_0x49c0a8));if(_0x49c0a8[_0x7364('0x11')]){if(_0x49c0a8['error'][_0x7364('0x12')]===0x1f4){logger[_0x7364('0x11')](_0x7364('0xd'),_0x5014a2,_0x49c0a8[_0x7364('0x11')]['message']);return _0x588334(_0x49c0a8[_0x7364('0x11')][_0x7364('0x13')]);}logger[_0x7364('0x11')](_0x7364('0xd'),_0x5014a2,_0x49c0a8['error'][_0x7364('0x13')]);return _0xe7b0c1(_0x49c0a8[_0x7364('0x11')][_0x7364('0x13')]);}else{logger['info'](_0x7364('0xd'),_0x5014a2,'request\x20sent');_0xe7b0c1(_0x49c0a8['result'][_0x7364('0x13')]);}})['catch'](function(_0x4eaf57){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x5014a2,_0x4eaf57);_0x588334(_0x4eaf57);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 10f47f3..4e4568a 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 _0x4250=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show'];(function(_0x307ba9,_0x55cb03){var _0x198dcb=function(_0x4ec59c){while(--_0x4ec59c){_0x307ba9['push'](_0x307ba9['shift']());}};_0x198dcb(++_0x55cb03);}(_0x4250,0x146));var _0x0425=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x4250[_0x3ce3c];return _0x55a2c9;};'use strict';var multer=require(_0x0425('0x0'));var util=require(_0x0425('0x1'));var path=require(_0x0425('0x2'));var timeout=require(_0x0425('0x3'));var express=require('express');var router=express[_0x0425('0x4')]();var fs_extra=require(_0x0425('0x5'));var auth=require(_0x0425('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0425('0x7'));var controller=require(_0x0425('0x8'));router[_0x0425('0x9')]('/',auth[_0x0425('0xa')](),controller[_0x0425('0xb')]);router[_0x0425('0x9')](_0x0425('0xc'),auth[_0x0425('0xa')](),controller[_0x0425('0xd')]);router[_0x0425('0xe')]('/',auth[_0x0425('0xa')](),controller[_0x0425('0xf')]);router[_0x0425('0x10')](_0x0425('0xc'),auth[_0x0425('0xa')](),controller[_0x0425('0x11')]);router[_0x0425('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0425('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5697=['destroy','exports','multer','path','connect-timeout','express','./analyticMetric.controller','get','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x4d876f,_0x2e9908){var _0x1df7bf=function(_0x38ce25){while(--_0x38ce25){_0x4d876f['push'](_0x4d876f['shift']());}};_0x1df7bf(++_0x2e9908);}(_0x5697,0x1b5));var _0x7569=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x5697[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x7569('0x0'));var util=require('util');var path=require(_0x7569('0x1'));var timeout=require(_0x7569('0x2'));var express=require(_0x7569('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7569('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7569('0x5')](_0x7569('0x6'),auth[_0x7569('0x7')](),controller[_0x7569('0x8')]);router[_0x7569('0x9')]('/',auth[_0x7569('0x7')](),controller['create']);router[_0x7569('0xa')]('/:id',auth[_0x7569('0x7')](),controller[_0x7569('0xb')]);router[_0x7569('0xc')](_0x7569('0x6'),auth[_0x7569('0x7')](),controller[_0x7569('0xd')]);module[_0x7569('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 05c3796..bf0f446 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 _0x86d1=['exports','TEXT','sequelize'];(function(_0x4a6f93,_0x35d940){var _0x3e19eb=function(_0x30d207){while(--_0x30d207){_0x4a6f93['push'](_0x4a6f93['shift']());}};_0x3e19eb(++_0x35d940);}(_0x86d1,0xc5));var _0x186d=function(_0x3300f3,_0x3d3773){_0x3300f3=_0x3300f3-0x0;var _0x1262a5=_0x86d1[_0x3300f3];return _0x1262a5;};'use strict';var Sequelize=require(_0x186d('0x0'));module[_0x186d('0x1')]={'tree':{'type':Sequelize[_0x186d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8dcd=['exports','TEXT','sequelize'];(function(_0x3d2a1b,_0x4f3920){var _0x34ac08=function(_0x1560b5){while(--_0x1560b5){_0x3d2a1b['push'](_0x3d2a1b['shift']());}};_0x34ac08(++_0x4f3920);}(_0x8dcd,0x149));var _0xd8dc=function(_0x366990,_0x3f439b){_0x366990=_0x366990-0x0;var _0xef77ce=_0x8dcd[_0x366990];return _0xef77ce;};'use strict';var Sequelize=require(_0xd8dc('0x0'));module[_0xd8dc('0x1')]={'tree':{'type':Sequelize[_0xd8dc('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 8624747..96b1033 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 _0xa362=['catch','find','create','update','body','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','end','sendStatus','error','name','send','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','rows'];(function(_0x530182,_0x3a7dab){var _0x495d44=function(_0x255612){while(--_0x255612){_0x530182['push'](_0x530182['shift']());}};_0x495d44(++_0x3a7dab);}(_0xa362,0x9f));var _0x2a36=function(_0x185848,_0x1ce0fb){_0x185848=_0x185848-0x0;var _0x310fe7=_0xa362[_0x185848];return _0x310fe7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2a36('0x0'));var zipdir=require(_0x2a36('0x1'));var jsonpatch=require(_0x2a36('0x2'));var rp=require(_0x2a36('0x3'));var moment=require(_0x2a36('0x4'));var BPromise=require(_0x2a36('0x5'));var Mustache=require('mustache');var util=require(_0x2a36('0x6'));var path=require('path');var sox=require(_0x2a36('0x7'));var csv=require(_0x2a36('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a36('0x9'));var _=require(_0x2a36('0xa'));var squel=require('squel');var crypto=require(_0x2a36('0xb'));var jsforce=require(_0x2a36('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2a36('0x8'));var querystring=require(_0x2a36('0xd'));var Papa=require(_0x2a36('0xe'));var Redis=require(_0x2a36('0xf'));var authService=require(_0x2a36('0x10'));var qs=require(_0x2a36('0x11'));var as=require(_0x2a36('0x12'));var hardwareService=require(_0x2a36('0x13'));var logger=require(_0x2a36('0x14'))(_0x2a36('0x15'));var utils=require(_0x2a36('0x16'));var config=require(_0x2a36('0x17'));var licenseUtil=require(_0x2a36('0x18'));var db=require(_0x2a36('0x19'))['db'];function respondWithStatusCode(_0x29a1d8,_0x5d00a6){_0x5d00a6=_0x5d00a6||0xcc;return function(_0x78b58e){if(_0x78b58e){return _0x29a1d8['sendStatus'](_0x5d00a6);}return _0x29a1d8[_0x2a36('0x1a')](_0x5d00a6)['end']();};}function respondWithResult(_0x984093,_0x44f7f6){_0x44f7f6=_0x44f7f6||0xc8;return function(_0x302557){if(_0x302557){return _0x984093[_0x2a36('0x1a')](_0x44f7f6)['json'](_0x302557);}};}function respondWithFilteredResult(_0x3a4cbe,_0x29df16){return function(_0x2a6078){if(_0x2a6078){var _0x401298=typeof _0x29df16[_0x2a36('0x1b')]===_0x2a36('0x1c')&&typeof _0x29df16[_0x2a36('0x1d')]==='undefined';var _0x34ba16=_0x2a6078[_0x2a36('0x1e')];var _0x3ccaba=_0x401298?0x0:_0x29df16[_0x2a36('0x1b')];var _0x5f0c8d=_0x401298?_0x2a6078[_0x2a36('0x1e')]:_0x29df16['offset']+_0x29df16[_0x2a36('0x1d')];var _0x24ba69;if(_0x5f0c8d>=_0x34ba16){_0x5f0c8d=_0x34ba16;_0x24ba69=0xc8;}else{_0x24ba69=0xce;}_0x3a4cbe[_0x2a36('0x1a')](_0x24ba69);return _0x3a4cbe[_0x2a36('0x1f')](_0x2a36('0x20'),_0x3ccaba+'-'+_0x5f0c8d+'/'+_0x34ba16)[_0x2a36('0x21')](_0x2a6078);}return null;};}function patchUpdates(_0xdfcd1e){return function(_0x5f1fe9){try{jsonpatch[_0x2a36('0x22')](_0x5f1fe9,_0xdfcd1e,!![]);}catch(_0x21de3b){return BPromise[_0x2a36('0x23')](_0x21de3b);}return _0x5f1fe9[_0x2a36('0x24')]();};}function saveUpdates(_0x6f5cfb,_0x18a336){return function(_0x5e0994){if(_0x5e0994){return _0x5e0994['update'](_0x6f5cfb)[_0x2a36('0x25')](function(_0x4c20d2){return _0x4c20d2;});}return null;};}function removeEntity(_0x39be1a,_0x37df4f){return function(_0x38216a){if(_0x38216a){return _0x38216a['destroy']()[_0x2a36('0x25')](function(){_0x39be1a[_0x2a36('0x1a')](0xcc)[_0x2a36('0x26')]();});}};}function handleEntityNotFound(_0x4e5ed1,_0x2f5885){return function(_0x5b8cdc){if(!_0x5b8cdc){_0x4e5ed1[_0x2a36('0x27')](0x194);}return _0x5b8cdc;};}function handleError(_0x516c54,_0x221523){_0x221523=_0x221523||0x1f4;return function(_0x10445a){logger[_0x2a36('0x28')](_0x10445a['stack']);if(_0x10445a['name']){delete _0x10445a[_0x2a36('0x29')];}_0x516c54['status'](_0x221523)[_0x2a36('0x2a')](_0x10445a);};}exports['index']=function(_0x4acca7,_0x104613){var _0x5ca01d={},_0x2064dd={},_0x2a797f={'count':0x0,'rows':[]};var _0x1dfa30=_['map'](db[_0x2a36('0x2b')][_0x2a36('0x2c')],function(_0x4421da){return{'name':_0x4421da[_0x2a36('0x2d')],'type':_0x4421da[_0x2a36('0x2e')][_0x2a36('0x2f')]};});_0x2064dd['model']=_['map'](_0x1dfa30,_0x2a36('0x29'));_0x2064dd[_0x2a36('0x30')]=_[_0x2a36('0x31')](_0x4acca7[_0x2a36('0x30')]);_0x2064dd[_0x2a36('0x32')]=_[_0x2a36('0x33')](_0x2064dd['model'],_0x2064dd[_0x2a36('0x30')]);_0x5ca01d['attributes']=_[_0x2a36('0x33')](_0x2064dd[_0x2a36('0x34')],qs[_0x2a36('0x35')](_0x4acca7['query'][_0x2a36('0x35')]));_0x5ca01d['attributes']=_0x5ca01d[_0x2a36('0x36')][_0x2a36('0x37')]?_0x5ca01d[_0x2a36('0x36')]:_0x2064dd[_0x2a36('0x34')];if(!_0x4acca7[_0x2a36('0x30')][_0x2a36('0x38')](_0x2a36('0x39'))){_0x5ca01d[_0x2a36('0x1d')]=qs[_0x2a36('0x1d')](_0x4acca7[_0x2a36('0x30')][_0x2a36('0x1d')]);_0x5ca01d['offset']=qs[_0x2a36('0x1b')](_0x4acca7[_0x2a36('0x30')]['offset']);}_0x5ca01d['order']=qs[_0x2a36('0x3a')](_0x4acca7[_0x2a36('0x30')]['sort']);_0x5ca01d[_0x2a36('0x3b')]=qs['filters'](_[_0x2a36('0x3c')](_0x4acca7[_0x2a36('0x30')],_0x2064dd[_0x2a36('0x32')]),_0x1dfa30);if(_0x4acca7[_0x2a36('0x30')][_0x2a36('0x3d')]){_0x5ca01d[_0x2a36('0x3b')]=_['merge'](_0x5ca01d[_0x2a36('0x3b')],{'$or':_[_0x2a36('0x3e')](_0x1dfa30,function(_0x1b0616){if(_0x1b0616[_0x2a36('0x2e')]!==_0x2a36('0x3f')){var _0x4f8114={};_0x4f8114[_0x1b0616['name']]={'$like':'%'+_0x4acca7[_0x2a36('0x30')][_0x2a36('0x3d')]+'%'};return _0x4f8114;}})});}_0x5ca01d=_[_0x2a36('0x40')]({},_0x5ca01d,_0x4acca7[_0x2a36('0x41')]);var _0x2d4afb={'where':_0x5ca01d[_0x2a36('0x3b')]};return db[_0x2a36('0x2b')]['count'](_0x2d4afb)[_0x2a36('0x25')](function(_0x472f79){_0x2a797f[_0x2a36('0x1e')]=_0x472f79;if(_0x4acca7[_0x2a36('0x30')][_0x2a36('0x42')]){_0x5ca01d[_0x2a36('0x43')]=[{'all':!![]}];}return db[_0x2a36('0x2b')]['findAll'](_0x5ca01d);})[_0x2a36('0x25')](function(_0x4ee205){_0x2a797f[_0x2a36('0x44')]=_0x4ee205;return _0x2a797f;})[_0x2a36('0x25')](respondWithFilteredResult(_0x104613,_0x5ca01d))[_0x2a36('0x45')](handleError(_0x104613,null));};exports['show']=function(_0x2b8713,_0x386925){var _0x995a22={'raw':!![],'where':{'id':_0x2b8713['params']['id']}},_0x42037f={};_0x42037f[_0x2a36('0x34')]=_[_0x2a36('0x31')](db['AnalyticTreeReport'][_0x2a36('0x2c')]);_0x42037f['query']=_[_0x2a36('0x31')](_0x2b8713[_0x2a36('0x30')]);_0x42037f[_0x2a36('0x32')]=_['intersection'](_0x42037f[_0x2a36('0x34')],_0x42037f[_0x2a36('0x30')]);_0x995a22[_0x2a36('0x36')]=_[_0x2a36('0x33')](_0x42037f[_0x2a36('0x34')],qs[_0x2a36('0x35')](_0x2b8713[_0x2a36('0x30')][_0x2a36('0x35')]));_0x995a22['attributes']=_0x995a22['attributes']['length']?_0x995a22[_0x2a36('0x36')]:_0x42037f[_0x2a36('0x34')];if(_0x2b8713[_0x2a36('0x30')]['includeAll']){_0x995a22[_0x2a36('0x43')]=[{'all':!![]}];}_0x995a22=_[_0x2a36('0x40')]({},_0x995a22,_0x2b8713['options']);return db[_0x2a36('0x2b')][_0x2a36('0x46')](_0x995a22)[_0x2a36('0x25')](handleEntityNotFound(_0x386925,null))[_0x2a36('0x25')](respondWithResult(_0x386925,null))['catch'](handleError(_0x386925,null));};exports['create']=function(_0x3431b2,_0x1bd7d6){return db[_0x2a36('0x2b')][_0x2a36('0x47')](_0x3431b2['body'],{})[_0x2a36('0x25')](respondWithResult(_0x1bd7d6,0xc9))[_0x2a36('0x45')](handleError(_0x1bd7d6,null));};exports[_0x2a36('0x48')]=function(_0x474c1d,_0x41013e){if(_0x474c1d[_0x2a36('0x49')]['id']){delete _0x474c1d['body']['id'];}return db[_0x2a36('0x2b')][_0x2a36('0x46')]({'where':{'id':_0x474c1d[_0x2a36('0x4a')]['id']}})[_0x2a36('0x25')](handleEntityNotFound(_0x41013e,null))[_0x2a36('0x25')](saveUpdates(_0x474c1d[_0x2a36('0x49')],null))[_0x2a36('0x25')](respondWithResult(_0x41013e,null))[_0x2a36('0x45')](handleError(_0x41013e,null));};exports[_0x2a36('0x4b')]=function(_0x4f5864,_0x4277de){return db[_0x2a36('0x2b')][_0x2a36('0x46')]({'where':{'id':_0x4f5864[_0x2a36('0x4a')]['id']}})[_0x2a36('0x25')](handleEntityNotFound(_0x4277de,null))[_0x2a36('0x25')](removeEntity(_0x4277de,null))[_0x2a36('0x45')](handleError(_0x4277de,null));}; \ No newline at end of file +var _0xd2cd=['find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','AnalyticTreeReport','include','findAll','rows','catch','show','params','fields'];(function(_0x41814f,_0xb01ac1){var _0x376d53=function(_0x126df4){while(--_0x126df4){_0x41814f['push'](_0x41814f['shift']());}};_0x376d53(++_0xb01ac1);}(_0xd2cd,0x12b));var _0xdd2c=function(_0x31d849,_0x3db9bc){_0x31d849=_0x31d849-0x0;var _0x1c55b3=_0xd2cd[_0x31d849];return _0x1c55b3;};'use strict';var emlformat=require(_0xdd2c('0x0'));var rimraf=require(_0xdd2c('0x1'));var zipdir=require(_0xdd2c('0x2'));var jsonpatch=require(_0xdd2c('0x3'));var rp=require('request-promise');var moment=require(_0xdd2c('0x4'));var BPromise=require(_0xdd2c('0x5'));var Mustache=require('mustache');var util=require(_0xdd2c('0x6'));var path=require(_0xdd2c('0x7'));var sox=require(_0xdd2c('0x8'));var csv=require('to-csv');var ejs=require(_0xdd2c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd2c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdd2c('0xb'));var querystring=require('querystring');var Papa=require(_0xdd2c('0xc'));var Redis=require(_0xdd2c('0xd'));var authService=require(_0xdd2c('0xe'));var qs=require(_0xdd2c('0xf'));var as=require(_0xdd2c('0x10'));var hardwareService=require(_0xdd2c('0x11'));var logger=require(_0xdd2c('0x12'))(_0xdd2c('0x13'));var utils=require(_0xdd2c('0x14'));var config=require(_0xdd2c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd2c('0x16'))['db'];function respondWithStatusCode(_0x31ea91,_0x45987d){_0x45987d=_0x45987d||0xcc;return function(_0x32971c){if(_0x32971c){return _0x31ea91[_0xdd2c('0x17')](_0x45987d);}return _0x31ea91[_0xdd2c('0x18')](_0x45987d)[_0xdd2c('0x19')]();};}function respondWithResult(_0x27a268,_0x28035f){_0x28035f=_0x28035f||0xc8;return function(_0x333fbf){if(_0x333fbf){return _0x27a268[_0xdd2c('0x18')](_0x28035f)[_0xdd2c('0x1a')](_0x333fbf);}};}function respondWithFilteredResult(_0x2766c3,_0x37701e){return function(_0xf60d23){if(_0xf60d23){var _0xc0bd7f=typeof _0x37701e[_0xdd2c('0x1b')]===_0xdd2c('0x1c')&&typeof _0x37701e[_0xdd2c('0x1d')]===_0xdd2c('0x1c');var _0x35ecc5=_0xf60d23[_0xdd2c('0x1e')];var _0x2f886a=_0xc0bd7f?0x0:_0x37701e['offset'];var _0xe9626=_0xc0bd7f?_0xf60d23[_0xdd2c('0x1e')]:_0x37701e[_0xdd2c('0x1b')]+_0x37701e[_0xdd2c('0x1d')];var _0x24a555;if(_0xe9626>=_0x35ecc5){_0xe9626=_0x35ecc5;_0x24a555=0xc8;}else{_0x24a555=0xce;}_0x2766c3[_0xdd2c('0x18')](_0x24a555);return _0x2766c3[_0xdd2c('0x1f')](_0xdd2c('0x20'),_0x2f886a+'-'+_0xe9626+'/'+_0x35ecc5)[_0xdd2c('0x1a')](_0xf60d23);}return null;};}function patchUpdates(_0x5d7c58){return function(_0x20b793){try{jsonpatch[_0xdd2c('0x21')](_0x20b793,_0x5d7c58,!![]);}catch(_0x203f2c){return BPromise[_0xdd2c('0x22')](_0x203f2c);}return _0x20b793['save']();};}function saveUpdates(_0x2d1fa1,_0x5cab5f){return function(_0x5b540a){if(_0x5b540a){return _0x5b540a[_0xdd2c('0x23')](_0x2d1fa1)['then'](function(_0x2a7080){return _0x2a7080;});}return null;};}function removeEntity(_0x508810,_0x3dd4c6){return function(_0x373d76){if(_0x373d76){return _0x373d76[_0xdd2c('0x24')]()[_0xdd2c('0x25')](function(){_0x508810['status'](0xcc)[_0xdd2c('0x19')]();});}};}function handleEntityNotFound(_0x3fa42b,_0x5e7c73){return function(_0x517f94){if(!_0x517f94){_0x3fa42b[_0xdd2c('0x17')](0x194);}return _0x517f94;};}function handleError(_0x4ba3fd,_0x5a859c){_0x5a859c=_0x5a859c||0x1f4;return function(_0x21153f){logger[_0xdd2c('0x26')](_0x21153f[_0xdd2c('0x27')]);if(_0x21153f[_0xdd2c('0x28')]){delete _0x21153f[_0xdd2c('0x28')];}_0x4ba3fd[_0xdd2c('0x18')](_0x5a859c)[_0xdd2c('0x29')](_0x21153f);};}exports[_0xdd2c('0x2a')]=function(_0x3f0239,_0x3c5c48){var _0x68edd4={},_0x1e0425={},_0x49125b={'count':0x0,'rows':[]};var _0x415edc=_[_0xdd2c('0x2b')](db['AnalyticTreeReport'][_0xdd2c('0x2c')],function(_0x406555){return{'name':_0x406555['fieldName'],'type':_0x406555[_0xdd2c('0x2d')][_0xdd2c('0x2e')]};});_0x1e0425[_0xdd2c('0x2f')]=_[_0xdd2c('0x2b')](_0x415edc,_0xdd2c('0x28'));_0x1e0425['query']=_[_0xdd2c('0x30')](_0x3f0239[_0xdd2c('0x31')]);_0x1e0425['filters']=_[_0xdd2c('0x32')](_0x1e0425[_0xdd2c('0x2f')],_0x1e0425[_0xdd2c('0x31')]);_0x68edd4['attributes']=_[_0xdd2c('0x32')](_0x1e0425[_0xdd2c('0x2f')],qs['fields'](_0x3f0239[_0xdd2c('0x31')]['fields']));_0x68edd4[_0xdd2c('0x33')]=_0x68edd4[_0xdd2c('0x33')]['length']?_0x68edd4[_0xdd2c('0x33')]:_0x1e0425[_0xdd2c('0x2f')];if(!_0x3f0239[_0xdd2c('0x31')][_0xdd2c('0x34')](_0xdd2c('0x35'))){_0x68edd4[_0xdd2c('0x1d')]=qs[_0xdd2c('0x1d')](_0x3f0239['query'][_0xdd2c('0x1d')]);_0x68edd4[_0xdd2c('0x1b')]=qs[_0xdd2c('0x1b')](_0x3f0239[_0xdd2c('0x31')][_0xdd2c('0x1b')]);}_0x68edd4[_0xdd2c('0x36')]=qs[_0xdd2c('0x37')](_0x3f0239[_0xdd2c('0x31')][_0xdd2c('0x37')]);_0x68edd4[_0xdd2c('0x38')]=qs[_0xdd2c('0x39')](_[_0xdd2c('0x3a')](_0x3f0239[_0xdd2c('0x31')],_0x1e0425[_0xdd2c('0x39')]),_0x415edc);if(_0x3f0239[_0xdd2c('0x31')]['filter']){_0x68edd4[_0xdd2c('0x38')]=_['merge'](_0x68edd4[_0xdd2c('0x38')],{'$or':_['map'](_0x415edc,function(_0xa358d1){if(_0xa358d1[_0xdd2c('0x2d')]!==_0xdd2c('0x3b')){var _0x27d500={};_0x27d500[_0xa358d1[_0xdd2c('0x28')]]={'$like':'%'+_0x3f0239[_0xdd2c('0x31')][_0xdd2c('0x3c')]+'%'};return _0x27d500;}})});}_0x68edd4=_[_0xdd2c('0x3d')]({},_0x68edd4,_0x3f0239[_0xdd2c('0x3e')]);var _0x42f387={'where':_0x68edd4[_0xdd2c('0x38')]};return db[_0xdd2c('0x3f')][_0xdd2c('0x1e')](_0x42f387)[_0xdd2c('0x25')](function(_0x4921d8){_0x49125b[_0xdd2c('0x1e')]=_0x4921d8;if(_0x3f0239['query']['includeAll']){_0x68edd4[_0xdd2c('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xdd2c('0x41')](_0x68edd4);})[_0xdd2c('0x25')](function(_0x4db007){_0x49125b[_0xdd2c('0x42')]=_0x4db007;return _0x49125b;})['then'](respondWithFilteredResult(_0x3c5c48,_0x68edd4))[_0xdd2c('0x43')](handleError(_0x3c5c48,null));};exports[_0xdd2c('0x44')]=function(_0x32d6c3,_0x7482a3){var _0x35e5b4={'raw':!![],'where':{'id':_0x32d6c3[_0xdd2c('0x45')]['id']}},_0x1f2d8a={};_0x1f2d8a[_0xdd2c('0x2f')]=_['keys'](db['AnalyticTreeReport'][_0xdd2c('0x2c')]);_0x1f2d8a[_0xdd2c('0x31')]=_[_0xdd2c('0x30')](_0x32d6c3[_0xdd2c('0x31')]);_0x1f2d8a[_0xdd2c('0x39')]=_[_0xdd2c('0x32')](_0x1f2d8a[_0xdd2c('0x2f')],_0x1f2d8a['query']);_0x35e5b4['attributes']=_[_0xdd2c('0x32')](_0x1f2d8a[_0xdd2c('0x2f')],qs[_0xdd2c('0x46')](_0x32d6c3['query'][_0xdd2c('0x46')]));_0x35e5b4[_0xdd2c('0x33')]=_0x35e5b4['attributes']['length']?_0x35e5b4[_0xdd2c('0x33')]:_0x1f2d8a[_0xdd2c('0x2f')];if(_0x32d6c3[_0xdd2c('0x31')]['includeAll']){_0x35e5b4[_0xdd2c('0x40')]=[{'all':!![]}];}_0x35e5b4=_[_0xdd2c('0x3d')]({},_0x35e5b4,_0x32d6c3[_0xdd2c('0x3e')]);return db[_0xdd2c('0x3f')][_0xdd2c('0x47')](_0x35e5b4)[_0xdd2c('0x25')](handleEntityNotFound(_0x7482a3,null))[_0xdd2c('0x25')](respondWithResult(_0x7482a3,null))[_0xdd2c('0x43')](handleError(_0x7482a3,null));};exports[_0xdd2c('0x48')]=function(_0x4a8ebf,_0x32e867){return db[_0xdd2c('0x3f')][_0xdd2c('0x48')](_0x4a8ebf[_0xdd2c('0x49')],{})[_0xdd2c('0x25')](respondWithResult(_0x32e867,0xc9))[_0xdd2c('0x43')](handleError(_0x32e867,null));};exports[_0xdd2c('0x23')]=function(_0xe6c8ab,_0x57a4d8){if(_0xe6c8ab[_0xdd2c('0x49')]['id']){delete _0xe6c8ab[_0xdd2c('0x49')]['id'];}return db[_0xdd2c('0x3f')][_0xdd2c('0x47')]({'where':{'id':_0xe6c8ab[_0xdd2c('0x45')]['id']}})[_0xdd2c('0x25')](handleEntityNotFound(_0x57a4d8,null))[_0xdd2c('0x25')](saveUpdates(_0xe6c8ab[_0xdd2c('0x49')],null))['then'](respondWithResult(_0x57a4d8,null))[_0xdd2c('0x43')](handleError(_0x57a4d8,null));};exports[_0xdd2c('0x24')]=function(_0x5de3af,_0x2de26d){return db[_0xdd2c('0x3f')][_0xdd2c('0x47')]({'where':{'id':_0x5de3af[_0xdd2c('0x45')]['id']}})['then'](handleEntityNotFound(_0x2de26d,null))[_0xdd2c('0x25')](removeEntity(_0x2de26d,null))['catch'](handleError(_0x2de26d,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index e799b39..918d044 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 _0x57ea=['bluebird','request-promise','rimraf','../../config/environment','exports','define','analytics_report_trees','lodash','util','api','moment'];(function(_0x38889b,_0x6cf56b){var _0x4b3c97=function(_0x5acfaf){while(--_0x5acfaf){_0x38889b['push'](_0x38889b['shift']());}};_0x4b3c97(++_0x6cf56b);}(_0x57ea,0x17d));var _0xa57e=function(_0x4e7f3f,_0x5c57da){_0x4e7f3f=_0x4e7f3f-0x0;var _0x441fd2=_0x57ea[_0x4e7f3f];return _0x441fd2;};'use strict';var _=require(_0xa57e('0x0'));var util=require(_0xa57e('0x1'));var logger=require('../../config/logger')(_0xa57e('0x2'));var moment=require(_0xa57e('0x3'));var BPromise=require(_0xa57e('0x4'));var rp=require(_0xa57e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa57e('0x6'));var config=require(_0xa57e('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0xa57e('0x8')]=function(_0x3f8396,_0x2153f9){return _0x3f8396[_0xa57e('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0xa57e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c4f=['bluebird','request-promise','rimraf','./analyticTreeReport.attributes','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','moment'];(function(_0x1fa022,_0x5a1b71){var _0x1098d7=function(_0x466928){while(--_0x466928){_0x1fa022['push'](_0x1fa022['shift']());}};_0x1098d7(++_0x5a1b71);}(_0x7c4f,0x15a));var _0xf7c4=function(_0x39a953,_0x265d6a){_0x39a953=_0x39a953-0x0;var _0x68cfe7=_0x7c4f[_0x39a953];return _0x68cfe7;};'use strict';var _=require(_0xf7c4('0x0'));var util=require('util');var logger=require(_0xf7c4('0x1'))(_0xf7c4('0x2'));var moment=require(_0xf7c4('0x3'));var BPromise=require(_0xf7c4('0x4'));var rp=require(_0xf7c4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7c4('0x6'));var config=require('../../config/environment');var attributes=require(_0xf7c4('0x7'));module['exports']=function(_0x4df987,_0x3743be){return _0x4df987['define'](_0xf7c4('0x8'),attributes,{'tableName':_0xf7c4('0x9'),'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 12a036e..036fca0 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(_0x22bbbc,_0x91ae9f){var _0x2aa3cc=function(_0x1b1f53){while(--_0x1b1f53){_0x22bbbc['push'](_0x22bbbc['shift']());}};_0x2aa3cc(++_0x91ae9f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1998c7,_0x2afce7){_0x1998c7=_0x1998c7-0x0;var _0x54b045=_0x5f2f[_0x1998c7];return _0x54b045;};'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 _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x114eb9,_0x3bfc99){var _0x30dc14=function(_0x8b6004){while(--_0x8b6004){_0x114eb9['push'](_0x114eb9['shift']());}};_0x30dc14(++_0x3bfc99);}(_0x1261,0x144));var _0x1126=function(_0x6620b8,_0x8b3d5e){_0x6620b8=_0x6620b8-0x0;var _0x33de50=_0x1261[_0x6620b8];return _0x33de50;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 799205d..b93ea22 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 _0xafa7=['put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','post','create'];(function(_0x3d61fe,_0x3d2c36){var _0x457e37=function(_0x29ae75){while(--_0x29ae75){_0x3d61fe['push'](_0x3d61fe['shift']());}};_0x457e37(++_0x3d2c36);}(_0xafa7,0x77));var _0x7afa=function(_0x3299d1,_0x545733){_0x3299d1=_0x3299d1-0x0;var _0x44356e=_0xafa7[_0x3299d1];return _0x44356e;};'use strict';var multer=require(_0x7afa('0x0'));var util=require(_0x7afa('0x1'));var path=require('path');var timeout=require(_0x7afa('0x2'));var express=require(_0x7afa('0x3'));var router=express[_0x7afa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7afa('0x5'));var interaction=require(_0x7afa('0x6'));var config=require(_0x7afa('0x7'));var controller=require(_0x7afa('0x8'));router[_0x7afa('0x9')]('/',auth[_0x7afa('0xa')](),controller[_0x7afa('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7afa('0xc')]('/',auth[_0x7afa('0xa')](),controller[_0x7afa('0xd')]);router[_0x7afa('0xe')](_0x7afa('0xf'),auth[_0x7afa('0xa')](),controller[_0x7afa('0x10')]);router['delete'](_0x7afa('0xf'),auth[_0x7afa('0xa')](),controller[_0x7afa('0x11')]);module[_0x7afa('0x12')]=router; \ No newline at end of file +var _0x159e=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','show'];(function(_0x33e2e2,_0x25b93b){var _0x31ba0e=function(_0x13eea5){while(--_0x13eea5){_0x33e2e2['push'](_0x33e2e2['shift']());}};_0x31ba0e(++_0x25b93b);}(_0x159e,0x10a));var _0xe159=function(_0x50e264,_0x29b73a){_0x50e264=_0x50e264-0x0;var _0x2bc766=_0x159e[_0x50e264];return _0x2bc766;};'use strict';var multer=require(_0xe159('0x0'));var util=require(_0xe159('0x1'));var path=require(_0xe159('0x2'));var timeout=require(_0xe159('0x3'));var express=require(_0xe159('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe159('0x5'));var interaction=require(_0xe159('0x6'));var config=require(_0xe159('0x7'));var controller=require(_0xe159('0x8'));router['get']('/',auth[_0xe159('0x9')](),controller[_0xe159('0xa')]);router[_0xe159('0xb')](_0xe159('0xc'),auth[_0xe159('0x9')](),controller[_0xe159('0xd')]);router[_0xe159('0xe')]('/',auth[_0xe159('0x9')](),controller[_0xe159('0xf')]);router[_0xe159('0x10')]('/:id',auth[_0xe159('0x9')](),controller[_0xe159('0x11')]);router['delete'](_0xe159('0xc'),auth[_0xe159('0x9')](),controller[_0xe159('0x12')]);module[_0xe159('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 477cc54..bf6d0bd 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 _0x9ade=['exports','STRING','sequelize'];(function(_0x54263c,_0xe6a363){var _0x43b8a4=function(_0x51866e){while(--_0x51866e){_0x54263c['push'](_0x54263c['shift']());}};_0x43b8a4(++_0xe6a363);}(_0x9ade,0x107));var _0xe9ad=function(_0x193bec,_0x5bbea3){_0x193bec=_0x193bec-0x0;var _0x3aea83=_0x9ade[_0x193bec];return _0x3aea83;};'use strict';var Sequelize=require(_0xe9ad('0x0'));module[_0xe9ad('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe9ad('0x2')]}}; \ No newline at end of file +var _0xac55=['sequelize','exports','STRING'];(function(_0x593556,_0x38685b){var _0x3ce9b3=function(_0x2cc66f){while(--_0x2cc66f){_0x593556['push'](_0x593556['shift']());}};_0x3ce9b3(++_0x38685b);}(_0xac55,0x1c8));var _0x5ac5=function(_0x378c6f,_0x305418){_0x378c6f=_0x378c6f-0x0;var _0x3e140f=_0xac55[_0x378c6f];return _0x3e140f;};'use strict';var Sequelize=require(_0x5ac5('0x0'));module[_0x5ac5('0x1')]={'name':{'type':Sequelize[_0x5ac5('0x2')]},'basename':{'type':Sequelize[_0x5ac5('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 50507b2..1da944d 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 _0x7e75=['catch','clone','include','updatedAt','body','omit','create','file','originalname','basename','filename','mimetype','download','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','end','error','stack','name','send','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','show','params','length','find'];(function(_0xa8369a,_0x3d2319){var _0x4b74b7=function(_0x11d138){while(--_0x11d138){_0xa8369a['push'](_0xa8369a['shift']());}};_0x4b74b7(++_0x3d2319);}(_0x7e75,0x1d4));var _0x57e7=function(_0x4d75b4,_0x1eca80){_0x4d75b4=_0x4d75b4-0x0;var _0xaf0841=_0x7e75[_0x4d75b4];return _0xaf0841;};'use strict';var emlformat=require(_0x57e7('0x0'));var rimraf=require(_0x57e7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x57e7('0x2'));var rp=require(_0x57e7('0x3'));var moment=require(_0x57e7('0x4'));var BPromise=require(_0x57e7('0x5'));var Mustache=require(_0x57e7('0x6'));var util=require(_0x57e7('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x57e7('0x8'));var ejs=require(_0x57e7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57e7('0xa'));var squel=require('squel');var crypto=require(_0x57e7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x57e7('0xc'));var toCsv=require(_0x57e7('0x8'));var querystring=require(_0x57e7('0xd'));var Papa=require(_0x57e7('0xe'));var Redis=require(_0x57e7('0xf'));var authService=require(_0x57e7('0x10'));var qs=require(_0x57e7('0x11'));var as=require(_0x57e7('0x12'));var hardwareService=require(_0x57e7('0x13'));var logger=require(_0x57e7('0x14'))('api');var utils=require(_0x57e7('0x15'));var config=require(_0x57e7('0x16'));var licenseUtil=require(_0x57e7('0x17'));var db=require(_0x57e7('0x18'))['db'];function respondWithStatusCode(_0x362dfa,_0x4bc873){_0x4bc873=_0x4bc873||0xcc;return function(_0x5e9796){if(_0x5e9796){return _0x362dfa[_0x57e7('0x19')](_0x4bc873);}return _0x362dfa[_0x57e7('0x1a')](_0x4bc873)['end']();};}function respondWithResult(_0x19bf37,_0x2e99bd){_0x2e99bd=_0x2e99bd||0xc8;return function(_0x4eb45e){if(_0x4eb45e){return _0x19bf37[_0x57e7('0x1a')](_0x2e99bd)[_0x57e7('0x1b')](_0x4eb45e);}};}function respondWithFilteredResult(_0x5ab13f,_0x1d6bf1){return function(_0x3b2111){if(_0x3b2111){var _0x3fd66c=typeof _0x1d6bf1['offset']===_0x57e7('0x1c')&&typeof _0x1d6bf1[_0x57e7('0x1d')]===_0x57e7('0x1c');var _0x2971be=_0x3b2111[_0x57e7('0x1e')];var _0x2c2bbe=_0x3fd66c?0x0:_0x1d6bf1['offset'];var _0x52c4f1=_0x3fd66c?_0x3b2111[_0x57e7('0x1e')]:_0x1d6bf1[_0x57e7('0x1f')]+_0x1d6bf1[_0x57e7('0x1d')];var _0x469f07;if(_0x52c4f1>=_0x2971be){_0x52c4f1=_0x2971be;_0x469f07=0xc8;}else{_0x469f07=0xce;}_0x5ab13f[_0x57e7('0x1a')](_0x469f07);return _0x5ab13f[_0x57e7('0x20')]('Content-Range',_0x2c2bbe+'-'+_0x52c4f1+'/'+_0x2971be)[_0x57e7('0x1b')](_0x3b2111);}return null;};}function patchUpdates(_0x4ed07d){return function(_0x3edada){try{jsonpatch['apply'](_0x3edada,_0x4ed07d,!![]);}catch(_0x15ab09){return BPromise[_0x57e7('0x21')](_0x15ab09);}return _0x3edada[_0x57e7('0x22')]();};}function saveUpdates(_0x1625e0,_0x293ac5){return function(_0x4d2270){if(_0x4d2270){return _0x4d2270[_0x57e7('0x23')](_0x1625e0)[_0x57e7('0x24')](function(_0x57b82c){return _0x57b82c;});}return null;};}function removeEntity(_0x43c2d0,_0x334e70){return function(_0x4cf689){if(_0x4cf689){return _0x4cf689[_0x57e7('0x25')]()['then'](function(){_0x43c2d0[_0x57e7('0x1a')](0xcc)[_0x57e7('0x26')]();});}};}function handleEntityNotFound(_0x2cce38,_0x4b02f8){return function(_0x1de6db){if(!_0x1de6db){_0x2cce38[_0x57e7('0x19')](0x194);}return _0x1de6db;};}function handleError(_0x132ad4,_0x58660b){_0x58660b=_0x58660b||0x1f4;return function(_0x5019de){logger[_0x57e7('0x27')](_0x5019de[_0x57e7('0x28')]);if(_0x5019de[_0x57e7('0x29')]){delete _0x5019de[_0x57e7('0x29')];}_0x132ad4[_0x57e7('0x1a')](_0x58660b)[_0x57e7('0x2a')](_0x5019de);};}exports['index']=function(_0x3a3fa2,_0x1ec2bb){var _0xf16e7b={},_0x31e525={},_0x14d807={'count':0x0,'rows':[]};var _0x32db8c=_[_0x57e7('0x2b')](db[_0x57e7('0x2c')][_0x57e7('0x2d')],function(_0x3da06c){return{'name':_0x3da06c[_0x57e7('0x2e')],'type':_0x3da06c[_0x57e7('0x2f')][_0x57e7('0x30')]};});_0x31e525[_0x57e7('0x31')]=_[_0x57e7('0x2b')](_0x32db8c,_0x57e7('0x29'));_0x31e525[_0x57e7('0x32')]=_[_0x57e7('0x33')](_0x3a3fa2[_0x57e7('0x32')]);_0x31e525[_0x57e7('0x34')]=_[_0x57e7('0x35')](_0x31e525['model'],_0x31e525[_0x57e7('0x32')]);_0xf16e7b['attributes']=_[_0x57e7('0x35')](_0x31e525[_0x57e7('0x31')],qs['fields'](_0x3a3fa2[_0x57e7('0x32')][_0x57e7('0x36')]));_0xf16e7b[_0x57e7('0x37')]=_0xf16e7b[_0x57e7('0x37')]['length']?_0xf16e7b[_0x57e7('0x37')]:_0x31e525[_0x57e7('0x31')];if(!_0x3a3fa2[_0x57e7('0x32')][_0x57e7('0x38')](_0x57e7('0x39'))){_0xf16e7b[_0x57e7('0x1d')]=qs[_0x57e7('0x1d')](_0x3a3fa2[_0x57e7('0x32')]['limit']);_0xf16e7b[_0x57e7('0x1f')]=qs[_0x57e7('0x1f')](_0x3a3fa2['query']['offset']);}_0xf16e7b[_0x57e7('0x3a')]=qs[_0x57e7('0x3b')](_0x3a3fa2[_0x57e7('0x32')][_0x57e7('0x3b')]);_0xf16e7b[_0x57e7('0x3c')]=qs[_0x57e7('0x34')](_[_0x57e7('0x3d')](_0x3a3fa2[_0x57e7('0x32')],_0x31e525['filters']),_0x32db8c);if(_0x3a3fa2[_0x57e7('0x32')]['filter']){_0xf16e7b[_0x57e7('0x3c')]=_[_0x57e7('0x3e')](_0xf16e7b[_0x57e7('0x3c')],{'$or':_[_0x57e7('0x2b')](_0x32db8c,function(_0x10e330){if(_0x10e330[_0x57e7('0x2f')]!==_0x57e7('0x3f')){var _0x2c60af={};_0x2c60af[_0x10e330[_0x57e7('0x29')]]={'$like':'%'+_0x3a3fa2[_0x57e7('0x32')][_0x57e7('0x40')]+'%'};return _0x2c60af;}})});}_0xf16e7b=_[_0x57e7('0x3e')]({},_0xf16e7b,_0x3a3fa2[_0x57e7('0x41')]);var _0x1244fd={'where':_0xf16e7b['where']};return db[_0x57e7('0x2c')][_0x57e7('0x1e')](_0x1244fd)['then'](function(_0xf7207f){_0x14d807[_0x57e7('0x1e')]=_0xf7207f;if(_0x3a3fa2[_0x57e7('0x32')][_0x57e7('0x42')]){_0xf16e7b['include']=[{'all':!![]}];}return db[_0x57e7('0x2c')][_0x57e7('0x43')](_0xf16e7b);})[_0x57e7('0x24')](function(_0xd1ac7e){_0x14d807['rows']=_0xd1ac7e;return _0x14d807;})['then'](respondWithFilteredResult(_0x1ec2bb,_0xf16e7b))['catch'](handleError(_0x1ec2bb,null));};exports[_0x57e7('0x44')]=function(_0x21467b,_0x1f29bd){var _0x49a2fc={'raw':!![],'where':{'id':_0x21467b[_0x57e7('0x45')]['id']}},_0xf4c6f6={};_0xf4c6f6['model']=_[_0x57e7('0x33')](db[_0x57e7('0x2c')]['rawAttributes']);_0xf4c6f6['query']=_['keys'](_0x21467b[_0x57e7('0x32')]);_0xf4c6f6['filters']=_['intersection'](_0xf4c6f6['model'],_0xf4c6f6[_0x57e7('0x32')]);_0x49a2fc[_0x57e7('0x37')]=_[_0x57e7('0x35')](_0xf4c6f6['model'],qs[_0x57e7('0x36')](_0x21467b['query']['fields']));_0x49a2fc[_0x57e7('0x37')]=_0x49a2fc['attributes'][_0x57e7('0x46')]?_0x49a2fc[_0x57e7('0x37')]:_0xf4c6f6[_0x57e7('0x31')];if(_0x21467b[_0x57e7('0x32')][_0x57e7('0x42')]){_0x49a2fc['include']=[{'all':!![]}];}_0x49a2fc=_[_0x57e7('0x3e')]({},_0x49a2fc,_0x21467b['options']);return db[_0x57e7('0x2c')][_0x57e7('0x47')](_0x49a2fc)['then'](handleEntityNotFound(_0x1f29bd,null))[_0x57e7('0x24')](respondWithResult(_0x1f29bd,null))[_0x57e7('0x48')](handleError(_0x1f29bd,null));};exports[_0x57e7('0x49')]=function(_0x323745,_0x1ffc79){var _0x11dd29={'where':{'id':_0x323745[_0x57e7('0x45')]['id']}},_0x290bf3={};_0x290bf3[_0x57e7('0x31')]=_[_0x57e7('0x33')](db[_0x57e7('0x2c')][_0x57e7('0x2d')]);_0x11dd29['attributes']=_['intersection'](_0x290bf3[_0x57e7('0x31')],qs[_0x57e7('0x36')](_0x323745['query']['fields']));_0x11dd29[_0x57e7('0x37')]=_0x11dd29['attributes']['length']?_0x11dd29[_0x57e7('0x37')]:_0x290bf3[_0x57e7('0x31')];if(_0x323745[_0x57e7('0x32')][_0x57e7('0x42')]){_0x11dd29[_0x57e7('0x4a')]=[{'all':!![]}];}_0x11dd29=_['merge']({},_0x11dd29,_0x323745[_0x57e7('0x41')]);return db['Attachment'][_0x57e7('0x47')](_0x11dd29)[_0x57e7('0x24')](handleEntityNotFound(_0x1ffc79,null))[_0x57e7('0x24')](function(_0x4995d5){if(_0x4995d5){var _0x20892c=_0x4995d5['get']({'plain':!![]});_0x20892c=qs['omit'](_0x20892c,['id','createdAt',_0x57e7('0x4b')]);_0x323745[_0x57e7('0x4c')]=_[_0x57e7('0x4d')](_0x323745[_0x57e7('0x4c')],['id','createdAt',_0x57e7('0x4b')]);return db[_0x57e7('0x2c')][_0x57e7('0x4e')](_[_0x57e7('0x3e')](_0x20892c,_0x323745[_0x57e7('0x4c')]),{'include':_0x323745[_0x57e7('0x32')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x57e7('0x24')](respondWithResult(_0x1ffc79,0xc9))['catch'](handleError(_0x1ffc79,null));};exports[_0x57e7('0x23')]=function(_0x2e5bc8,_0x5ef5c9){if(_0x2e5bc8[_0x57e7('0x4c')]['id']){delete _0x2e5bc8['body']['id'];}return db[_0x57e7('0x2c')][_0x57e7('0x47')]({'where':{'id':_0x2e5bc8[_0x57e7('0x45')]['id']}})['then'](handleEntityNotFound(_0x5ef5c9,null))[_0x57e7('0x24')](saveUpdates(_0x2e5bc8[_0x57e7('0x4c')],null))[_0x57e7('0x24')](respondWithResult(_0x5ef5c9,null))[_0x57e7('0x48')](handleError(_0x5ef5c9,null));};exports[_0x57e7('0x25')]=function(_0x5065ab,_0x3c73fd){return db[_0x57e7('0x2c')]['find']({'where':{'id':_0x5065ab[_0x57e7('0x45')]['id']}})['then'](handleEntityNotFound(_0x3c73fd,null))[_0x57e7('0x24')](removeEntity(_0x3c73fd,null))[_0x57e7('0x48')](handleError(_0x3c73fd,null));};exports['create']=function(_0x23fb78,_0x4eed94,_0x3d6da6){_0x23fb78[_0x57e7('0x4c')][_0x57e7('0x29')]=_0x23fb78[_0x57e7('0x4f')][_0x57e7('0x50')];_0x23fb78[_0x57e7('0x4c')][_0x57e7('0x51')]=_0x23fb78[_0x57e7('0x4f')][_0x57e7('0x52')];_0x23fb78['body'][_0x57e7('0x2f')]=_0x23fb78['file'][_0x57e7('0x53')];return db[_0x57e7('0x2c')][_0x57e7('0x4e')](_0x23fb78[_0x57e7('0x4c')])[_0x57e7('0x24')](respondWithResult(_0x4eed94,0xc9))[_0x57e7('0x48')](handleError(_0x4eed94,null));};exports[_0x57e7('0x54')]=function(_0x439c2a,_0x1861e6,_0x58f84e){return db[_0x57e7('0x2c')]['findOne']({'where':{'id':_0x439c2a['params']['id']},'raw':!![]})[_0x57e7('0x24')](handleEntityNotFound(_0x1861e6,null))[_0x57e7('0x24')](function(_0x218fbf){if(_0x218fbf){var _0x191346=_0x218fbf[_0x57e7('0x55')]!==null;var _0x4870e1=path[_0x57e7('0x56')](config[_0x57e7('0x57')],_0x57e7('0x58'));if(_0x191346){_0x4870e1=path[_0x57e7('0x56')](_0x4870e1,_0x57e7('0x59'));}var _0x14f461=path[_0x57e7('0x56')](_0x4870e1,_0x218fbf['basename']);return _0x1861e6[_0x57e7('0x54')](_0x14f461);}})[_0x57e7('0x48')](handleError(_0x1861e6,null));}; \ No newline at end of file +var _0x98d9=['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','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','Attachment','rawAttributes','key','model','query','intersection','fields','attributes','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','length','get','omit','createdAt','updatedAt','body','find','create','originalname','mimetype','download','findOne','join','root','server/files/attachments/','offline-chat/','basename','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0x98d9,0x102));var _0x998d=function(_0x2731ef,_0x24af30){_0x2731ef=_0x2731ef-0x0;var _0x24933c=_0x98d9[_0x2731ef];return _0x24933c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x998d('0x0'));var zipdir=require(_0x998d('0x1'));var jsonpatch=require(_0x998d('0x2'));var rp=require(_0x998d('0x3'));var moment=require(_0x998d('0x4'));var BPromise=require(_0x998d('0x5'));var Mustache=require(_0x998d('0x6'));var util=require(_0x998d('0x7'));var path=require(_0x998d('0x8'));var sox=require(_0x998d('0x9'));var csv=require(_0x998d('0xa'));var ejs=require(_0x998d('0xb'));var fs=require('fs');var fs_extra=require(_0x998d('0xc'));var _=require(_0x998d('0xd'));var squel=require('squel');var crypto=require(_0x998d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x998d('0xf'));var toCsv=require(_0x998d('0xa'));var querystring=require(_0x998d('0x10'));var Papa=require(_0x998d('0x11'));var Redis=require(_0x998d('0x12'));var authService=require(_0x998d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x998d('0x14'));var hardwareService=require(_0x998d('0x15'));var logger=require(_0x998d('0x16'))(_0x998d('0x17'));var utils=require(_0x998d('0x18'));var config=require(_0x998d('0x19'));var licenseUtil=require(_0x998d('0x1a'));var db=require(_0x998d('0x1b'))['db'];function respondWithStatusCode(_0x27c681,_0x2b3de6){_0x2b3de6=_0x2b3de6||0xcc;return function(_0xe54cde){if(_0xe54cde){return _0x27c681[_0x998d('0x1c')](_0x2b3de6);}return _0x27c681[_0x998d('0x1d')](_0x2b3de6)[_0x998d('0x1e')]();};}function respondWithResult(_0x5f3ab8,_0x852d71){_0x852d71=_0x852d71||0xc8;return function(_0x358b36){if(_0x358b36){return _0x5f3ab8['status'](_0x852d71)['json'](_0x358b36);}};}function respondWithFilteredResult(_0x1764ec,_0x299b7f){return function(_0x328b3d){if(_0x328b3d){var _0x1a3c64=typeof _0x299b7f[_0x998d('0x1f')]===_0x998d('0x20')&&typeof _0x299b7f[_0x998d('0x21')]===_0x998d('0x20');var _0x5b0bcd=_0x328b3d[_0x998d('0x22')];var _0x1cdc44=_0x1a3c64?0x0:_0x299b7f[_0x998d('0x1f')];var _0x597548=_0x1a3c64?_0x328b3d[_0x998d('0x22')]:_0x299b7f['offset']+_0x299b7f[_0x998d('0x21')];var _0x3a45c6;if(_0x597548>=_0x5b0bcd){_0x597548=_0x5b0bcd;_0x3a45c6=0xc8;}else{_0x3a45c6=0xce;}_0x1764ec[_0x998d('0x1d')](_0x3a45c6);return _0x1764ec[_0x998d('0x23')](_0x998d('0x24'),_0x1cdc44+'-'+_0x597548+'/'+_0x5b0bcd)[_0x998d('0x25')](_0x328b3d);}return null;};}function patchUpdates(_0x1ee401){return function(_0x5794b2){try{jsonpatch[_0x998d('0x26')](_0x5794b2,_0x1ee401,!![]);}catch(_0x1f8750){return BPromise[_0x998d('0x27')](_0x1f8750);}return _0x5794b2[_0x998d('0x28')]();};}function saveUpdates(_0x41d36f,_0x11c5a9){return function(_0xd8d22d){if(_0xd8d22d){return _0xd8d22d[_0x998d('0x29')](_0x41d36f)[_0x998d('0x2a')](function(_0x101533){return _0x101533;});}return null;};}function removeEntity(_0x53b370,_0xe61dfc){return function(_0x175bb9){if(_0x175bb9){return _0x175bb9[_0x998d('0x2b')]()[_0x998d('0x2a')](function(){_0x53b370[_0x998d('0x1d')](0xcc)[_0x998d('0x1e')]();});}};}function handleEntityNotFound(_0x3e9668,_0x259ac0){return function(_0x119787){if(!_0x119787){_0x3e9668[_0x998d('0x1c')](0x194);}return _0x119787;};}function handleError(_0xbb7074,_0x7ffc7c){_0x7ffc7c=_0x7ffc7c||0x1f4;return function(_0x575b87){logger[_0x998d('0x2c')](_0x575b87[_0x998d('0x2d')]);if(_0x575b87[_0x998d('0x2e')]){delete _0x575b87[_0x998d('0x2e')];}_0xbb7074[_0x998d('0x1d')](_0x7ffc7c)['send'](_0x575b87);};}exports[_0x998d('0x2f')]=function(_0x388545,_0x4f083f){var _0x31654a={},_0x51796a={},_0x17ae78={'count':0x0,'rows':[]};var _0x4eed16=_[_0x998d('0x30')](db[_0x998d('0x31')][_0x998d('0x32')],function(_0x3af02d){return{'name':_0x3af02d['fieldName'],'type':_0x3af02d['type'][_0x998d('0x33')]};});_0x51796a[_0x998d('0x34')]=_[_0x998d('0x30')](_0x4eed16,'name');_0x51796a[_0x998d('0x35')]=_['keys'](_0x388545[_0x998d('0x35')]);_0x51796a['filters']=_['intersection'](_0x51796a[_0x998d('0x34')],_0x51796a[_0x998d('0x35')]);_0x31654a['attributes']=_[_0x998d('0x36')](_0x51796a[_0x998d('0x34')],qs[_0x998d('0x37')](_0x388545[_0x998d('0x35')][_0x998d('0x37')]));_0x31654a[_0x998d('0x38')]=_0x31654a[_0x998d('0x38')]['length']?_0x31654a[_0x998d('0x38')]:_0x51796a[_0x998d('0x34')];if(!_0x388545[_0x998d('0x35')]['hasOwnProperty']('nolimit')){_0x31654a[_0x998d('0x21')]=qs[_0x998d('0x21')](_0x388545[_0x998d('0x35')]['limit']);_0x31654a['offset']=qs['offset'](_0x388545[_0x998d('0x35')][_0x998d('0x1f')]);}_0x31654a[_0x998d('0x39')]=qs[_0x998d('0x3a')](_0x388545['query'][_0x998d('0x3a')]);_0x31654a['where']=qs[_0x998d('0x3b')](_[_0x998d('0x3c')](_0x388545[_0x998d('0x35')],_0x51796a[_0x998d('0x3b')]),_0x4eed16);if(_0x388545[_0x998d('0x35')][_0x998d('0x3d')]){_0x31654a[_0x998d('0x3e')]=_[_0x998d('0x3f')](_0x31654a['where'],{'$or':_[_0x998d('0x30')](_0x4eed16,function(_0x4b7487){if(_0x4b7487[_0x998d('0x40')]!==_0x998d('0x41')){var _0x4bc93f={};_0x4bc93f[_0x4b7487['name']]={'$like':'%'+_0x388545['query'][_0x998d('0x3d')]+'%'};return _0x4bc93f;}})});}_0x31654a=_[_0x998d('0x3f')]({},_0x31654a,_0x388545[_0x998d('0x42')]);var _0x31b26a={'where':_0x31654a[_0x998d('0x3e')]};return db[_0x998d('0x31')][_0x998d('0x22')](_0x31b26a)[_0x998d('0x2a')](function(_0x525383){_0x17ae78[_0x998d('0x22')]=_0x525383;if(_0x388545[_0x998d('0x35')][_0x998d('0x43')]){_0x31654a[_0x998d('0x44')]=[{'all':!![]}];}return db[_0x998d('0x31')]['findAll'](_0x31654a);})[_0x998d('0x2a')](function(_0x3093ef){_0x17ae78[_0x998d('0x45')]=_0x3093ef;return _0x17ae78;})['then'](respondWithFilteredResult(_0x4f083f,_0x31654a))[_0x998d('0x46')](handleError(_0x4f083f,null));};exports[_0x998d('0x47')]=function(_0x4af92e,_0x44e975){var _0x3101de={'raw':!![],'where':{'id':_0x4af92e[_0x998d('0x48')]['id']}},_0x4bb6a3={};_0x4bb6a3[_0x998d('0x34')]=_[_0x998d('0x49')](db[_0x998d('0x31')]['rawAttributes']);_0x4bb6a3[_0x998d('0x35')]=_[_0x998d('0x49')](_0x4af92e[_0x998d('0x35')]);_0x4bb6a3['filters']=_['intersection'](_0x4bb6a3[_0x998d('0x34')],_0x4bb6a3[_0x998d('0x35')]);_0x3101de[_0x998d('0x38')]=_[_0x998d('0x36')](_0x4bb6a3[_0x998d('0x34')],qs[_0x998d('0x37')](_0x4af92e[_0x998d('0x35')][_0x998d('0x37')]));_0x3101de['attributes']=_0x3101de[_0x998d('0x38')]['length']?_0x3101de['attributes']:_0x4bb6a3[_0x998d('0x34')];if(_0x4af92e[_0x998d('0x35')][_0x998d('0x43')]){_0x3101de['include']=[{'all':!![]}];}_0x3101de=_['merge']({},_0x3101de,_0x4af92e['options']);return db['Attachment']['find'](_0x3101de)[_0x998d('0x2a')](handleEntityNotFound(_0x44e975,null))[_0x998d('0x2a')](respondWithResult(_0x44e975,null))[_0x998d('0x46')](handleError(_0x44e975,null));};exports['clone']=function(_0x3af9d3,_0x378157){var _0x43c3a2={'where':{'id':_0x3af9d3[_0x998d('0x48')]['id']}},_0x23f570={};_0x23f570[_0x998d('0x34')]=_[_0x998d('0x49')](db['Attachment'][_0x998d('0x32')]);_0x43c3a2[_0x998d('0x38')]=_[_0x998d('0x36')](_0x23f570[_0x998d('0x34')],qs[_0x998d('0x37')](_0x3af9d3[_0x998d('0x35')]['fields']));_0x43c3a2[_0x998d('0x38')]=_0x43c3a2[_0x998d('0x38')][_0x998d('0x4a')]?_0x43c3a2[_0x998d('0x38')]:_0x23f570[_0x998d('0x34')];if(_0x3af9d3[_0x998d('0x35')]['includeAll']){_0x43c3a2[_0x998d('0x44')]=[{'all':!![]}];}_0x43c3a2=_['merge']({},_0x43c3a2,_0x3af9d3[_0x998d('0x42')]);return db[_0x998d('0x31')]['find'](_0x43c3a2)['then'](handleEntityNotFound(_0x378157,null))['then'](function(_0x2028d0){if(_0x2028d0){var _0x3a536c=_0x2028d0[_0x998d('0x4b')]({'plain':!![]});_0x3a536c=qs[_0x998d('0x4c')](_0x3a536c,['id',_0x998d('0x4d'),_0x998d('0x4e')]);_0x3af9d3[_0x998d('0x4f')]=_[_0x998d('0x4c')](_0x3af9d3[_0x998d('0x4f')],['id','createdAt',_0x998d('0x4e')]);return db[_0x998d('0x31')]['create'](_['merge'](_0x3a536c,_0x3af9d3[_0x998d('0x4f')]),{'include':_0x3af9d3[_0x998d('0x35')][_0x998d('0x43')]?[{'all':!![]}]:undefined});}})[_0x998d('0x2a')](respondWithResult(_0x378157,0xc9))[_0x998d('0x46')](handleError(_0x378157,null));};exports[_0x998d('0x29')]=function(_0x43875a,_0x616b73){if(_0x43875a[_0x998d('0x4f')]['id']){delete _0x43875a[_0x998d('0x4f')]['id'];}return db[_0x998d('0x31')]['find']({'where':{'id':_0x43875a[_0x998d('0x48')]['id']}})['then'](handleEntityNotFound(_0x616b73,null))['then'](saveUpdates(_0x43875a[_0x998d('0x4f')],null))[_0x998d('0x2a')](respondWithResult(_0x616b73,null))[_0x998d('0x46')](handleError(_0x616b73,null));};exports['destroy']=function(_0x57e939,_0x1f0ae2){return db[_0x998d('0x31')][_0x998d('0x50')]({'where':{'id':_0x57e939['params']['id']}})[_0x998d('0x2a')](handleEntityNotFound(_0x1f0ae2,null))[_0x998d('0x2a')](removeEntity(_0x1f0ae2,null))[_0x998d('0x46')](handleError(_0x1f0ae2,null));};exports[_0x998d('0x51')]=function(_0x1f9557,_0x3ecec0,_0x291eaa){_0x1f9557['body'][_0x998d('0x2e')]=_0x1f9557['file'][_0x998d('0x52')];_0x1f9557['body']['basename']=_0x1f9557['file']['filename'];_0x1f9557['body'][_0x998d('0x40')]=_0x1f9557['file'][_0x998d('0x53')];return db['Attachment'][_0x998d('0x51')](_0x1f9557[_0x998d('0x4f')])[_0x998d('0x2a')](respondWithResult(_0x3ecec0,0xc9))['catch'](handleError(_0x3ecec0,null));};exports[_0x998d('0x54')]=function(_0x1b7ef8,_0x504aa2,_0x112654){return db[_0x998d('0x31')][_0x998d('0x55')]({'where':{'id':_0x1b7ef8['params']['id']},'raw':!![]})[_0x998d('0x2a')](handleEntityNotFound(_0x504aa2,null))['then'](function(_0x44e519){if(_0x44e519){var _0x2844cf=_0x44e519['ChatOfflineMessageId']!==null;var _0x35185e=path[_0x998d('0x56')](config[_0x998d('0x57')],_0x998d('0x58'));if(_0x2844cf){_0x35185e=path['join'](_0x35185e,_0x998d('0x59'));}var _0x19e805=path[_0x998d('0x56')](_0x35185e,_0x44e519[_0x998d('0x5a')]);return _0x504aa2[_0x998d('0x54')](_0x19e805);}})[_0x998d('0x46')](handleError(_0x504aa2,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 7056777..9058ab5 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 _0x5a3a=['bluebird','request-promise','path','../../config/environment','./attachment.attributes','exports','define','Attachment','lodash','util','../../config/logger'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x5a3a,0x1d6));var _0xa5a3=function(_0x3823ef,_0x158ade){_0x3823ef=_0x3823ef-0x0;var _0x4e256f=_0x5a3a[_0x3823ef];return _0x4e256f;};'use strict';var _=require(_0xa5a3('0x0'));var util=require(_0xa5a3('0x1'));var logger=require(_0xa5a3('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa5a3('0x3'));var rp=require(_0xa5a3('0x4'));var fs=require('fs');var path=require(_0xa5a3('0x5'));var rimraf=require('rimraf');var config=require(_0xa5a3('0x6'));var attributes=require(_0xa5a3('0x7'));module[_0xa5a3('0x8')]=function(_0x3c2d67,_0x1f7592){return _0x3c2d67[_0xa5a3('0x9')](_0xa5a3('0xa'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69b5=['rimraf','../../config/environment','./attachment.attributes','define','Attachment','lodash','util','api','moment','bluebird','path'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0x69b5,0x1b2));var _0x569b=function(_0x3888bc,_0x3539a2){_0x3888bc=_0x3888bc-0x0;var _0x59d7c1=_0x69b5[_0x3888bc];return _0x59d7c1;};'use strict';var _=require(_0x569b('0x0'));var util=require(_0x569b('0x1'));var logger=require('../../config/logger')(_0x569b('0x2'));var moment=require(_0x569b('0x3'));var BPromise=require(_0x569b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x569b('0x5'));var rimraf=require(_0x569b('0x6'));var config=require(_0x569b('0x7'));var attributes=require(_0x569b('0x8'));module['exports']=function(_0x2d68f9,_0x5a6510){return _0x2d68f9[_0x569b('0x9')](_0x569b('0xa'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 0044caf..e8f67d1 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 _0xb2ff=['body','options','CreateAttachment','lodash','util','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','Attachment,\x20%s,\x20%s','message','result','catch','Attachment','create'];(function(_0x221888,_0x1d2891){var _0x18bc6c=function(_0x485060){while(--_0x485060){_0x221888['push'](_0x221888['shift']());}};_0x18bc6c(++_0x1d2891);}(_0xb2ff,0x123));var _0xfb2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2ff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfb2f('0x0'));var util=require(_0xfb2f('0x1'));var moment=require('moment');var BPromise=require(_0xfb2f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfb2f('0x3'));var logger=require('../../config/logger')(_0xfb2f('0x4'));var config=require(_0xfb2f('0x5'));var jayson=require(_0xfb2f('0x6'));var client=jayson[_0xfb2f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a0fd7,_0x28cb13,_0x4ff2df){return new BPromise(function(_0x34c04e,_0x4588d6){return client[_0xfb2f('0x8')](_0x4a0fd7,_0x4ff2df)[_0xfb2f('0x9')](function(_0x5abcdb){logger[_0xfb2f('0xa')]('Attachment,\x20%s,\x20%s',_0x28cb13,_0xfb2f('0xb'));logger['debug'](_0xfb2f('0xc'),_0x28cb13,_0xfb2f('0xb'),JSON[_0xfb2f('0xd')](_0x5abcdb));if(_0x5abcdb[_0xfb2f('0xe')]){if(_0x5abcdb[_0xfb2f('0xe')]['code']===0x1f4){logger[_0xfb2f('0xe')](_0xfb2f('0xf'),_0x28cb13,_0x5abcdb[_0xfb2f('0xe')][_0xfb2f('0x10')]);return _0x4588d6(_0x5abcdb[_0xfb2f('0xe')][_0xfb2f('0x10')]);}logger[_0xfb2f('0xe')](_0xfb2f('0xf'),_0x28cb13,_0x5abcdb['error'][_0xfb2f('0x10')]);return _0x34c04e(_0x5abcdb[_0xfb2f('0xe')][_0xfb2f('0x10')]);}else{logger[_0xfb2f('0xa')](_0xfb2f('0xf'),_0x28cb13,'request\x20sent');_0x34c04e(_0x5abcdb[_0xfb2f('0x11')][_0xfb2f('0x10')]);}})[_0xfb2f('0x12')](function(_0x240b79){logger[_0xfb2f('0xe')](_0xfb2f('0xf'),_0x28cb13,_0x240b79);_0x4588d6(_0x240b79);});});}exports['CreateAttachment']=function(_0x1d28e7){var _0x239a88=this;return new Promise(function(_0x507caa,_0x28bb16){return db[_0xfb2f('0x13')][_0xfb2f('0x14')](_0x1d28e7[_0xfb2f('0x15')],{'raw':_0x1d28e7[_0xfb2f('0x16')]?_0x1d28e7['options']['raw']===undefined?!![]:![]:!![]})[_0xfb2f('0x9')](function(_0x5d0afa){logger[_0xfb2f('0xa')]('CreateAttachment',_0x1d28e7);logger['debug'](_0xfb2f('0x17'),_0x1d28e7,JSON[_0xfb2f('0xd')](_0x5d0afa));_0x507caa(_0x5d0afa);})['catch'](function(_0x296340){logger[_0xfb2f('0xe')](_0xfb2f('0x17'),_0x296340[_0xfb2f('0x10')],_0x1d28e7);_0x28bb16(_0x239a88[_0xfb2f('0xe')](0x1f4,_0x296340['message']));});});}; \ No newline at end of file +var _0xb07f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Attachment','create','options','raw','CreateAttachment','debug','lodash','util','moment','bluebird','randomstring'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xb07f,0x109));var _0xfb07=function(_0x4cbfb7,_0x3a1e2b){_0x4cbfb7=_0x4cbfb7-0x0;var _0x31e9d3=_0xb07f[_0x4cbfb7];return _0x31e9d3;};'use strict';var _=require(_0xfb07('0x0'));var util=require(_0xfb07('0x1'));var moment=require(_0xfb07('0x2'));var BPromise=require(_0xfb07('0x3'));var rs=require(_0xfb07('0x4'));var fs=require('fs');var Redis=require(_0xfb07('0x5'));var db=require(_0xfb07('0x6'))['db'];var utils=require(_0xfb07('0x7'));var logger=require(_0xfb07('0x8'))(_0xfb07('0x9'));var config=require(_0xfb07('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfb07('0xb')][_0xfb07('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14fc69,_0x1efe64,_0x41d73a){return new BPromise(function(_0x3bb9cf,_0x2b5000){return client[_0xfb07('0xd')](_0x14fc69,_0x41d73a)[_0xfb07('0xe')](function(_0x3d7220){logger[_0xfb07('0xf')](_0xfb07('0x10'),_0x1efe64,'request\x20sent');logger['debug']('Attachment,\x20%s,\x20%s,\x20%s',_0x1efe64,_0xfb07('0x11'),JSON[_0xfb07('0x12')](_0x3d7220));if(_0x3d7220['error']){if(_0x3d7220[_0xfb07('0x13')][_0xfb07('0x14')]===0x1f4){logger[_0xfb07('0x13')](_0xfb07('0x10'),_0x1efe64,_0x3d7220[_0xfb07('0x13')][_0xfb07('0x15')]);return _0x2b5000(_0x3d7220[_0xfb07('0x13')]['message']);}logger[_0xfb07('0x13')](_0xfb07('0x10'),_0x1efe64,_0x3d7220[_0xfb07('0x13')][_0xfb07('0x15')]);return _0x3bb9cf(_0x3d7220[_0xfb07('0x13')][_0xfb07('0x15')]);}else{logger[_0xfb07('0xf')](_0xfb07('0x10'),_0x1efe64,_0xfb07('0x11'));_0x3bb9cf(_0x3d7220[_0xfb07('0x16')][_0xfb07('0x15')]);}})[_0xfb07('0x17')](function(_0x1e42c4){logger[_0xfb07('0x13')]('Attachment,\x20%s,\x20%s',_0x1efe64,_0x1e42c4);_0x2b5000(_0x1e42c4);});});}exports['CreateAttachment']=function(_0x3e747e){var _0x44b9c4=this;return new Promise(function(_0x197f12,_0x5e4079){return db[_0xfb07('0x18')][_0xfb07('0x19')](_0x3e747e['body'],{'raw':_0x3e747e['options']?_0x3e747e[_0xfb07('0x1a')][_0xfb07('0x1b')]===undefined?!![]:![]:!![]})[_0xfb07('0xe')](function(_0x2c6c44){logger[_0xfb07('0xf')](_0xfb07('0x1c'),_0x3e747e);logger[_0xfb07('0x1d')](_0xfb07('0x1c'),_0x3e747e,JSON[_0xfb07('0x12')](_0x2c6c44));_0x197f12(_0x2c6c44);})['catch'](function(_0x45806a){logger['error'](_0xfb07('0x1c'),_0x45806a[_0xfb07('0x15')],_0x3e747e);_0x5e4079(_0x44b9c4[_0xfb07('0x13')](0x1f4,_0x45806a[_0xfb07('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 42c2a84..033e348 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(_0x1a881a,_0x2ca020){var _0x1ac705=function(_0x595466){while(--_0x595466){_0x1a881a['push'](_0x1a881a['shift']());}};_0x1ac705(++_0x2ca020);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c9e54,_0x178247){_0x2c9e54=_0x2c9e54-0x0;var _0x25d074=_0xb10b[_0x2c9e54];return _0x25d074;};'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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x57b3e7,_0x220e40){_0x57b3e7=_0x57b3e7-0x0;var _0x81b55b=_0xdb28[_0x57b3e7];return _0x81b55b;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index e46f73a..c3a8e24 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 _0x07db=['blocked','add','clearBlockUser','getLicense','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','../../config/utils','login','google','/login','profile','callback','authenticate','use','clientID','clientSecret','secret','Setting','findOne','blockDuration','User','find','map','emails','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x07db,0x19c));var _0xb07d=function(_0x2fdce0,_0x496242){_0x2fdce0=_0x2fdce0-0x0;var _0x36f07e=_0x07db[_0x2fdce0];return _0x36f07e;};'use strict';var _=require(_0xb07d('0x0'));var passport=require(_0xb07d('0x1'));var GoogleStrategy=require(_0xb07d('0x2'))[_0xb07d('0x3')];var moment=require('moment');var db=require(_0xb07d('0x4'))['db'];var config=require(_0xb07d('0x5'));var signToken=require(_0xb07d('0x6'))['signToken'];var utils=require(_0xb07d('0x7'));exports[_0xb07d('0x8')]=passport['authenticate'](_0xb07d('0x9'),{'failureRedirect':_0xb07d('0xa'),'scope':[_0xb07d('0xb'),'email'],'session':![]});exports[_0xb07d('0xc')]=passport[_0xb07d('0xd')](_0xb07d('0x9'),{'failureRedirect':_0xb07d('0xa'),'session':![]});passport[_0xb07d('0xe')](new GoogleStrategy({'clientID':config[_0xb07d('0x9')]?config[_0xb07d('0x9')][_0xb07d('0xf')]:'id','clientSecret':config[_0xb07d('0x9')]?config[_0xb07d('0x9')][_0xb07d('0x10')]:_0xb07d('0x11'),'callbackURL':config[_0xb07d('0x9')]?config[_0xb07d('0x9')]['callbackURL']:''},function(_0x131f53,_0x2464c7,_0x9ac877,_0x46bab6){var _0x17a2aa,_0x24390b;return db[_0xb07d('0x12')][_0xb07d('0x13')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xb07d('0x14')],'raw':!![]})['then'](function(_0x12cf9a){_0x17a2aa=_0x12cf9a;return db[_0xb07d('0x15')][_0xb07d('0x16')]({'where':{'email':_[_0xb07d('0x17')](_0x9ac877[_0xb07d('0x18')],'value'),'role':{'$or':[_0xb07d('0x19'),_0xb07d('0x1a'),_0xb07d('0x1b')]}}});})[_0xb07d('0x1c')](function(_0xf6e454){_0x24390b=_0xf6e454;if(_0x24390b){if(_0x24390b['disabled']){return _0x46bab6(_0xb07d('0x1d'));}else if(_0x17a2aa[_0xb07d('0x14')]>0x0){if(_0x24390b[_0xb07d('0x1e')]){if(moment(_0x24390b['blockedAt'])[_0xb07d('0x1f')](_0x17a2aa['blockDuration'],'minutes')>moment()){return _0x46bab6(_0xb07d('0x1d'));}else{return utils[_0xb07d('0x20')](_0x24390b,0x0,![],null)[_0xb07d('0x1c')](function(){return utils[_0xb07d('0x21')](_0x24390b);})['then'](function(){return _0x46bab6(null,_0x24390b);});}}else{return utils[_0xb07d('0x21')](_0x24390b)[_0xb07d('0x1c')](function(){return _0x46bab6(null,_0x24390b);});}}else{return utils[_0xb07d('0x21')](_0x24390b)[_0xb07d('0x1c')](function(){return _0x46bab6(null,_0x24390b);});}}return _0x46bab6(_0xb07d('0x1d'));})['catch'](function(_0x126e51){_0x46bab6(_0x126e51);});})); \ No newline at end of file +var _0x4382=['signToken','../../config/utils','google','email','/login','use','clientID','secret','Setting','allowedLoginAttempts','blockDuration','then','User','emails','value','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','clearBlockUser','getLicense','catch','lodash','passport-google-oauth20','Strategy','moment','../../components/auth/service'];(function(_0x34d6bd,_0x55b744){var _0x248396=function(_0x23f061){while(--_0x23f061){_0x34d6bd['push'](_0x34d6bd['shift']());}};_0x248396(++_0x55b744);}(_0x4382,0xbf));var _0x2438=function(_0x24a4a9,_0x599571){_0x24a4a9=_0x24a4a9-0x0;var _0x3f81aa=_0x4382[_0x24a4a9];return _0x3f81aa;};'use strict';var _=require(_0x2438('0x0'));var passport=require('passport');var GoogleStrategy=require(_0x2438('0x1'))[_0x2438('0x2')];var moment=require(_0x2438('0x3'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var signToken=require(_0x2438('0x4'))[_0x2438('0x5')];var utils=require(_0x2438('0x6'));exports['login']=passport['authenticate'](_0x2438('0x7'),{'failureRedirect':'/login','scope':['profile',_0x2438('0x8')],'session':![]});exports['callback']=passport['authenticate']('google',{'failureRedirect':_0x2438('0x9'),'session':![]});passport[_0x2438('0xa')](new GoogleStrategy({'clientID':config[_0x2438('0x7')]?config[_0x2438('0x7')][_0x2438('0xb')]:'id','clientSecret':config[_0x2438('0x7')]?config[_0x2438('0x7')]['clientSecret']:_0x2438('0xc'),'callbackURL':config[_0x2438('0x7')]?config[_0x2438('0x7')]['callbackURL']:''},function(_0x1092af,_0x1d790c,_0x1bfd06,_0x3130bd){var _0x4c8935,_0x1e9a83;return db[_0x2438('0xd')]['findOne']({'where':{'id':0x1},'attributes':[_0x2438('0xe'),_0x2438('0xf')],'raw':!![]})[_0x2438('0x10')](function(_0x3cf7b7){_0x4c8935=_0x3cf7b7;return db[_0x2438('0x11')]['find']({'where':{'email':_['map'](_0x1bfd06[_0x2438('0x12')],_0x2438('0x13')),'role':{'$or':['admin',_0x2438('0x14'),_0x2438('0x15')]}}});})[_0x2438('0x10')](function(_0xeb4898){_0x1e9a83=_0xeb4898;if(_0x1e9a83){if(_0x1e9a83[_0x2438('0x16')]){return _0x3130bd(_0x2438('0x17'));}else if(_0x4c8935[_0x2438('0xf')]>0x0){if(_0x1e9a83[_0x2438('0x18')]){if(moment(_0x1e9a83['blockedAt'])['add'](_0x4c8935[_0x2438('0xf')],'minutes')>moment()){return _0x3130bd(_0x2438('0x17'));}else{return utils[_0x2438('0x19')](_0x1e9a83,0x0,![],null)['then'](function(){return utils[_0x2438('0x1a')](_0x1e9a83);})[_0x2438('0x10')](function(){return _0x3130bd(null,_0x1e9a83);});}}else{return utils['getLicense'](_0x1e9a83)['then'](function(){return _0x3130bd(null,_0x1e9a83);});}}else{return utils[_0x2438('0x1a')](_0x1e9a83)[_0x2438('0x10')](function(){return _0x3130bd(null,_0x1e9a83);});}}return _0x3130bd(_0x2438('0x17'));})[_0x2438('0x1b')](function(_0x457416){_0x3130bd(_0x457416);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 25fe1aa..09aa3b9 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 _0x3fc6=['get','login','/callback','setTokenCookie','exports','express','passport','Router','../user/user.controller.js','../../components/auth/service'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x3fc6,0x159));var _0x63fc=function(_0x591b32,_0x5d7305){_0x591b32=_0x591b32-0x0;var _0x4f68d3=_0x3fc6[_0x591b32];return _0x4f68d3;};'use strict';var express=require(_0x63fc('0x0'));var passport=require(_0x63fc('0x1'));var router=express[_0x63fc('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x63fc('0x3'));var authService=require(_0x63fc('0x4'));router[_0x63fc('0x5')]('/',controller[_0x63fc('0x6')]);router[_0x63fc('0x5')](_0x63fc('0x7'),controller['callback'],authService['isMiddleware'],userController[_0x63fc('0x6')],authService[_0x63fc('0x8')]);module[_0x63fc('0x9')]=router; \ No newline at end of file +var _0x2a3a=['../user/user.controller.js','login','get','/callback','callback','isMiddleware','setTokenCookie','express','passport','Router','./authGoogle.controller'];(function(_0x35b516,_0x251c15){var _0x1e6efe=function(_0x530e37){while(--_0x530e37){_0x35b516['push'](_0x35b516['shift']());}};_0x1e6efe(++_0x251c15);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x44cca9,_0x2ff22a){_0x44cca9=_0x44cca9-0x0;var _0x31cb3e=_0x2a3a[_0x44cca9];return _0x31cb3e;};'use strict';var express=require(_0xa2a3('0x0'));var passport=require(_0xa2a3('0x1'));var router=express[_0xa2a3('0x2')]();var controller=require(_0xa2a3('0x3'));var userController=require(_0xa2a3('0x4'));var authService=require('../../components/auth/service');router['get']('/',controller[_0xa2a3('0x5')]);router[_0xa2a3('0x6')](_0xa2a3('0x7'),controller[_0xa2a3('0x8')],authService[_0xa2a3('0x9')],userController[_0xa2a3('0x5')],authService[_0xa2a3('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 8784d23..ec725ae 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 _0x3437=['xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','now','securePassword','validatePasswordPattern','enforcePasswordHistory','previousPasswords','save','Password\x20reset!','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','add','clearBlockUser','minutes','getLicense','catch','MailAccount','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','pass','merge','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','body','Email\x20parameter\x20is\x20missing','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires'];(function(_0x5bdf15,_0x39f070){var _0x1c7939=function(_0x2895e9){while(--_0x2895e9){_0x5bdf15['push'](_0x5bdf15['shift']());}};_0x1c7939(++_0x39f070);}(_0x3437,0x19b));var _0x7343=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3437[_0x17d9e3];return _0x14192d;};'use strict';var util=require('util');var passport=require(_0x7343('0x0'));var LocalStrategy=require(_0x7343('0x1'))[_0x7343('0x2')];var jayson=require(_0x7343('0x3'));var _=require(_0x7343('0x4'));var rs=require('randomstring');var moment=require(_0x7343('0x5'));var db=require(_0x7343('0x6'))['db'];var authService=require(_0x7343('0x7'));var utils=require('../../config/utils');var client=jayson[_0x7343('0x8')][_0x7343('0x9')]({'port':0x232b});function localAuthenticate(_0x8d601b,_0x4dddd4,_0x2b4096,_0x185be5){var _0xcd591,_0x200969;return db[_0x7343('0xa')][_0x7343('0xb')]({'where':{'id':0x1},'attributes':[_0x7343('0xc'),_0x7343('0xd')],'raw':!![]})[_0x7343('0xe')](function(_0x2e353e){_0xcd591=_0x2e353e;return _0x8d601b['findOne']({'attributes':['id',_0x7343('0xf'),_0x7343('0x10'),_0x7343('0x11'),_0x7343('0x12'),_0x7343('0x13'),_0x7343('0x14'),_0x7343('0x15'),'loginAttempts'],'where':{'name':_0x4dddd4,'role':{'$or':[_0x7343('0x16'),_0x7343('0x17'),'agent']}}});})[_0x7343('0xe')](function(_0x1563aa){if(!_0x1563aa||_0x1563aa&&_0x1563aa[_0x7343('0xf')]!==_0x4dddd4){throw new Error(_0x7343('0x18'));}else{_0x200969=_0x1563aa;return _0x200969;}})[_0x7343('0xe')](function(){_0x200969[_0x7343('0x19')](_0x2b4096,function(_0x3092f7,_0x51e3b0){var _0x170a6a=_0x200969[_0x7343('0x1a')]+0x1;if(_0x3092f7){return _0x185be5(_0x3092f7);}else if(!_0x51e3b0){if(_0x200969[_0x7343('0x13')]){return _0x185be5(null,![],{'message':_0x7343('0x18')});}else if(_0xcd591[_0x7343('0xc')]>0x0){if(_0x200969[_0x7343('0x14')]){if(_0xcd591[_0x7343('0xd')]>0x0){if(moment(_0x200969[_0x7343('0x15')])[_0x7343('0x1b')](_0xcd591[_0x7343('0xd')],'minutes')>moment()){return _0x185be5(null,![],{'message':_0x7343('0x18')});}else{return utils[_0x7343('0x1c')](_0x200969,_0x170a6a,![],null)[_0x7343('0xe')](function(){return _0x185be5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x185be5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x170a6a>=_0xcd591['allowedLoginAttempts']){return utils[_0x7343('0x1c')](_0x200969,0x0,!![],moment())['then'](function(){return _0x185be5(null,![],{'message':_0x7343('0x18')});});}else{return utils[_0x7343('0x1c')](_0x200969,_0x170a6a,![],null)['then'](function(){return _0x185be5(null,![],{'message':_0x7343('0x18')});});}}}else{return _0x185be5(null,![],{'message':_0x7343('0x18')});}}else{if(_0x200969['disabled']){return _0x185be5(null,![],{'message':_0x7343('0x18')});}else if(_0xcd591['allowedLoginAttempts']>0x0){if(_0x200969[_0x7343('0x14')]){if(_0xcd591[_0x7343('0xd')]>0x0){if(moment(_0x200969[_0x7343('0x15')])[_0x7343('0x1b')](_0xcd591[_0x7343('0xd')],_0x7343('0x1d'))>moment()){return _0x185be5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x7343('0x1c')](_0x200969,0x0,![],null)[_0x7343('0xe')](function(){return utils[_0x7343('0x1e')](_0x200969);})[_0x7343('0xe')](function(){return _0x185be5(null,_0x200969);});}}else{return _0x185be5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x7343('0x1c')](_0x200969,0x0,![],null)[_0x7343('0xe')](function(){return utils[_0x7343('0x1e')](_0x200969);})[_0x7343('0xe')](function(){return _0x185be5(null,_0x200969);})[_0x7343('0x1f')](function(_0x5c15fd){return _0x185be5(null,![],_0x5c15fd);});}}else{if(_0x200969[_0x7343('0x14')]){return _0x185be5(null,![],{'message':_0x7343('0x18')});}else{return utils[_0x7343('0x1e')](_0x200969)[_0x7343('0xe')](function(){return _0x185be5(null,_0x200969);});}}}});})['catch'](function(_0xf2a5a2){return _0x185be5(null,![],_0xf2a5a2);});}function sendServiceMail(_0x340ae4){return db[_0x7343('0x20')]['find']({'where':{'service':!![]},'attributes':['id','name',_0x7343('0x21')],'include':[{'model':db[_0x7343('0x22')],'as':_0x7343('0x23')}]})[_0x7343('0xe')](function(_0xe6e4bc){if(!_0xe6e4bc){throw new Error(_0x7343('0x24'));}var _0x2e0f17={'tls':{'rejectUnauthorized':![]}};if(_0xe6e4bc[_0x7343('0x23')][_0x7343('0x25')]){_0x2e0f17[_0x7343('0x25')]=_0xe6e4bc[_0x7343('0x23')][_0x7343('0x25')];}else{_0x2e0f17[_0x7343('0x26')]=_0xe6e4bc[_0x7343('0x23')][_0x7343('0x26')];_0x2e0f17[_0x7343('0x27')]=_0xe6e4bc[_0x7343('0x23')][_0x7343('0x27')];_0x2e0f17[_0x7343('0x28')]=_0xe6e4bc['Smtp']['secure'];}if(_0xe6e4bc[_0x7343('0x23')]['authentication']){_0x2e0f17[_0x7343('0x29')]={'user':_0xe6e4bc[_0x7343('0x23')]['user'],'pass':_0xe6e4bc[_0x7343('0x23')][_0x7343('0x2a')]};}var _0x4ac80a={'account':_0x2e0f17,'message':_[_0x7343('0x2b')]({'from':util[_0x7343('0x2c')]('\x22%s\x22\x20<%s>',_0xe6e4bc[_0x7343('0xf')],_0xe6e4bc[_0x7343('0x21')]||_0xe6e4bc[_0x7343('0x23')][_0x7343('0x17')])},_0x340ae4)};return client[_0x7343('0x2d')](_0x7343('0x2e'),_0x4ac80a);})[_0x7343('0xe')](function(_0x1b36b4){if(_0x1b36b4[_0x7343('0x2f')]){throw new Error(util[_0x7343('0x2c')](_0x7343('0x30'),_0x1b36b4[_0x7343('0x2f')][_0x7343('0x31')]||JSON['stringify'](_0x1b36b4['error'])));}return!![];});}function handleError(_0x2c6df0,_0x11439f,_0x277ea7){return _0x2c6df0[_0x7343('0x32')](_0x11439f||0x1f4)['send']({'message':_0x277ea7?_0x277ea7[_0x7343('0x31')]||_0x277ea7:''});}exports[_0x7343('0x33')]=function(_0x8d3609,_0x1ec36f,_0x15babc){passport[_0x7343('0x19')]('local',function(_0x12a63f,_0x26f625,_0x19f7a8){var _0x182823=_0x12a63f||_0x19f7a8;if(_0x182823){return handleError(_0x1ec36f,0x191,_0x182823);}if(!_0x26f625){return handleError(_0x1ec36f,0x194,{'message':_0x7343('0x34')});}else{var _0x55211f={'payload':{'id':_0x26f625['id'],'role':_0x26f625['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x55211f)[_0x7343('0xe')](function(_0x5c1870){_0x1ec36f[_0x7343('0x35')]({'id':_0x26f625['id'],'token':_0x5c1870,'statusCall':'','isAlreadyLogged':_0x26f625['online']});});}})(_0x8d3609,_0x1ec36f,_0x15babc);};exports['forgot']=function(_0x54e40b,_0x30528a,_0x21cc35){if(!_0x54e40b[_0x7343('0x36')][_0x7343('0x21')]){return handleError(_0x30528a,0x1f4,{'message':_0x7343('0x37')});}var _0x544d3a=rs['generate']();_0x54e40b[_0x7343('0x36')][_0x7343('0x21')]=_0x54e40b[_0x7343('0x36')][_0x7343('0x21')]['trim']()[_0x7343('0x38')]();var _0x25aaa9;return db[_0x7343('0xa')][_0x7343('0xb')]({'where':{'id':0x1},'attributes':[_0x7343('0xc'),_0x7343('0xd')],'raw':!![]})[_0x7343('0xe')](function(_0x3371ce){_0x25aaa9=_0x3371ce;return db[_0x7343('0x39')][_0x7343('0x3a')]({'where':{'email':_0x54e40b[_0x7343('0x36')]['email']}});})['then'](function(_0x22daa4){if(!_0x22daa4){throw new Error(_0x7343('0x3b'));}if(_0x22daa4[_0x7343('0x13')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x22daa4[_0x7343('0x14')]){if(moment(_0x22daa4['blockedAt'])[_0x7343('0x1b')](_0x25aaa9['blockDuration'],_0x7343('0x1d'))>moment()){throw new Error(_0x7343('0x3c'));}else{_0x22daa4[_0x7343('0x14')]=![];_0x22daa4[_0x7343('0x15')]=null;}}_0x22daa4[_0x7343('0x3d')]=_0x544d3a;_0x22daa4[_0x7343('0x3e')]=Date['now']()+0x36ee80;return _0x22daa4['save']();})[_0x7343('0xe')](function(){return sendServiceMail({'to':_0x54e40b[_0x7343('0x36')]['email'],'subject':_0x7343('0x3f'),'text':_0x7343('0x40')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x54e40b[_0x7343('0x41')][_0x7343('0x26')]+_0x7343('0x42')+_0x544d3a+'\x0a\x0a'+_0x7343('0x43')});})[_0x7343('0xe')](function(){_0x30528a[_0x7343('0x32')](0xc8)['send']({'message':_0x7343('0x44')});})['catch'](function(_0x27700c){return handleError(_0x30528a,0x1f4,_0x27700c);});};exports[_0x7343('0x45')]=function(_0x2302c1,_0x44df87,_0x21a003){return db[_0x7343('0x39')][_0x7343('0x3a')]({'where':{'resetPasswordToken':_0x2302c1[_0x7343('0x46')][_0x7343('0x47')],'resetPasswordExpires':{'$gt':Date[_0x7343('0x48')]()}}})[_0x7343('0xe')](function(_0x27f4cc){if(!_0x27f4cc){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x7343('0xb')]({'attributes':['id',_0x7343('0x49'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x7343('0xe')](function(_0x1cb1ff){if(_0x1cb1ff[_0x7343('0x49')])authService[_0x7343('0x4a')](_0x2302c1[_0x7343('0x36')][_0x7343('0x10')]);if(!_0x1cb1ff[_0x7343('0x4b')]||!_0x27f4cc[_0x7343('0x4c')])return _0x27f4cc;authService['validatePasswordHistory'](_0x2302c1[_0x7343('0x36')][_0x7343('0x10')],_0x27f4cc['previousPasswords'],_0x1cb1ff['passwordHistoryLimit']);return _0x27f4cc;})[_0x7343('0xe')](function(){_0x27f4cc[_0x7343('0x10')]=_0x2302c1['body']['password'];_0x27f4cc['resetPasswordToken']=null;_0x27f4cc[_0x7343('0x3e')]=null;return _0x27f4cc[_0x7343('0x4d')]();});})['then'](function(){_0x44df87[_0x7343('0x32')](0xc8)['send']({'message':_0x7343('0x4e')});})[_0x7343('0x1f')](function(_0x3a5b67){return handleError(_0x44df87,0x1f4,_0x3a5b67);});};passport['use'](new LocalStrategy({'usernameField':'name','passwordField':_0x7343('0x10')},function(_0x5388ff,_0x51817a,_0x1d915e){return localAuthenticate(db[_0x7343('0x39')],_0x5388ff,_0x51817a,_0x1d915e);})); \ No newline at end of file +var _0xe0dc=['send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','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://','status','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','password','validatePasswordHistory','previousPasswords','passwordHistoryLimit','passport','passport-local','Strategy','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','role','disabled','blocked','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','blockedAt','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','secure','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','message','stringify'];(function(_0x19efe2,_0xe6d4d2){var _0x46537e=function(_0xd00235){while(--_0xd00235){_0x19efe2['push'](_0x19efe2['shift']());}};_0x46537e(++_0xe6d4d2);}(_0xe0dc,0x77));var _0xce0d=function(_0x5a84d1,_0x4a330f){_0x5a84d1=_0x5a84d1-0x0;var _0x4b656c=_0xe0dc[_0x5a84d1];return _0x4b656c;};'use strict';var util=require('util');var passport=require(_0xce0d('0x0'));var LocalStrategy=require(_0xce0d('0x1'))[_0xce0d('0x2')];var jayson=require('jayson/promise');var _=require(_0xce0d('0x3'));var rs=require(_0xce0d('0x4'));var moment=require('moment');var db=require(_0xce0d('0x5'))['db'];var authService=require(_0xce0d('0x6'));var utils=require(_0xce0d('0x7'));var client=jayson[_0xce0d('0x8')][_0xce0d('0x9')]({'port':0x232b});function localAuthenticate(_0x499c84,_0x2af3f4,_0x3c9bd5,_0x2d8919){var _0x267b83,_0x374cd8;return db['Setting'][_0xce0d('0xa')]({'where':{'id':0x1},'attributes':[_0xce0d('0xb'),_0xce0d('0xc')],'raw':!![]})[_0xce0d('0xd')](function(_0x1a8bef){_0x267b83=_0x1a8bef;return _0x499c84[_0xce0d('0xa')]({'attributes':['id',_0xce0d('0xe'),'password','salt',_0xce0d('0xf'),_0xce0d('0x10'),_0xce0d('0x11'),'blockedAt',_0xce0d('0x12')],'where':{'name':_0x2af3f4,'role':{'$or':[_0xce0d('0x13'),_0xce0d('0x14'),_0xce0d('0x15')]}}});})[_0xce0d('0xd')](function(_0xd45c05){if(!_0xd45c05||_0xd45c05&&_0xd45c05[_0xce0d('0xe')]!==_0x2af3f4){throw new Error(_0xce0d('0x16'));}else{_0x374cd8=_0xd45c05;return _0x374cd8;}})[_0xce0d('0xd')](function(){_0x374cd8[_0xce0d('0x17')](_0x3c9bd5,function(_0x98505d,_0x6852f1){var _0x1f8b05=_0x374cd8[_0xce0d('0x12')]+0x1;if(_0x98505d){return _0x2d8919(_0x98505d);}else if(!_0x6852f1){if(_0x374cd8['disabled']){return _0x2d8919(null,![],{'message':_0xce0d('0x16')});}else if(_0x267b83[_0xce0d('0xb')]>0x0){if(_0x374cd8[_0xce0d('0x11')]){if(_0x267b83[_0xce0d('0xc')]>0x0){if(moment(_0x374cd8['blockedAt'])[_0xce0d('0x18')](_0x267b83[_0xce0d('0xc')],_0xce0d('0x19'))>moment()){return _0x2d8919(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xce0d('0x1a')](_0x374cd8,_0x1f8b05,![],null)[_0xce0d('0xd')](function(){return _0x2d8919(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x2d8919(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x1f8b05>=_0x267b83[_0xce0d('0xb')]){return utils['clearBlockUser'](_0x374cd8,0x0,!![],moment())[_0xce0d('0xd')](function(){return _0x2d8919(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xce0d('0x1a')](_0x374cd8,_0x1f8b05,![],null)[_0xce0d('0xd')](function(){return _0x2d8919(null,![],{'message':_0xce0d('0x16')});});}}}else{return _0x2d8919(null,![],{'message':_0xce0d('0x16')});}}else{if(_0x374cd8[_0xce0d('0x10')]){return _0x2d8919(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x267b83[_0xce0d('0xb')]>0x0){if(_0x374cd8['blocked']){if(_0x267b83['blockDuration']>0x0){if(moment(_0x374cd8[_0xce0d('0x1b')])[_0xce0d('0x18')](_0x267b83[_0xce0d('0xc')],_0xce0d('0x19'))>moment()){return _0x2d8919(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x374cd8,0x0,![],null)[_0xce0d('0xd')](function(){return utils[_0xce0d('0x1c')](_0x374cd8);})[_0xce0d('0xd')](function(){return _0x2d8919(null,_0x374cd8);});}}else{return _0x2d8919(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xce0d('0x1a')](_0x374cd8,0x0,![],null)[_0xce0d('0xd')](function(){return utils[_0xce0d('0x1c')](_0x374cd8);})['then'](function(){return _0x2d8919(null,_0x374cd8);})[_0xce0d('0x1d')](function(_0x3a0b50){return _0x2d8919(null,![],_0x3a0b50);});}}else{if(_0x374cd8[_0xce0d('0x11')]){return _0x2d8919(null,![],{'message':_0xce0d('0x16')});}else{return utils['getLicense'](_0x374cd8)['then'](function(){return _0x2d8919(null,_0x374cd8);});}}}});})[_0xce0d('0x1d')](function(_0x2d9d9f){return _0x2d8919(null,![],_0x2d9d9f);});}function sendServiceMail(_0x2fbaca){return db[_0xce0d('0x1e')][_0xce0d('0x1f')]({'where':{'service':!![]},'attributes':['id',_0xce0d('0xe'),_0xce0d('0x20')],'include':[{'model':db[_0xce0d('0x21')],'as':_0xce0d('0x22')}]})[_0xce0d('0xd')](function(_0x452503){if(!_0x452503){throw new Error(_0xce0d('0x23'));}var _0x2ac5a1={'tls':{'rejectUnauthorized':![]}};if(_0x452503[_0xce0d('0x22')][_0xce0d('0x24')]){_0x2ac5a1[_0xce0d('0x24')]=_0x452503['Smtp'][_0xce0d('0x24')];}else{_0x2ac5a1['host']=_0x452503['Smtp'][_0xce0d('0x25')];_0x2ac5a1['port']=_0x452503[_0xce0d('0x22')]['port'];_0x2ac5a1[_0xce0d('0x26')]=_0x452503[_0xce0d('0x22')][_0xce0d('0x26')];}if(_0x452503[_0xce0d('0x22')]['authentication']){_0x2ac5a1[_0xce0d('0x27')]={'user':_0x452503['Smtp'][_0xce0d('0x14')],'pass':_0x452503[_0xce0d('0x22')][_0xce0d('0x28')]};}var _0x50438f={'account':_0x2ac5a1,'message':_[_0xce0d('0x29')]({'from':util[_0xce0d('0x2a')](_0xce0d('0x2b'),_0x452503[_0xce0d('0xe')],_0x452503[_0xce0d('0x20')]||_0x452503['Smtp'][_0xce0d('0x14')])},_0x2fbaca)};return client[_0xce0d('0x2c')](_0xce0d('0x2d'),_0x50438f);})[_0xce0d('0xd')](function(_0x46da95){if(_0x46da95[_0xce0d('0x2e')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x46da95['error'][_0xce0d('0x2f')]||JSON[_0xce0d('0x30')](_0x46da95[_0xce0d('0x2e')])));}return!![];});}function handleError(_0x226cc0,_0x43bc5e,_0x216908){return _0x226cc0['status'](_0x43bc5e||0x1f4)[_0xce0d('0x31')]({'message':_0x216908?_0x216908[_0xce0d('0x2f')]||_0x216908:''});}exports[_0xce0d('0x32')]=function(_0x47cefc,_0x2ccd1b,_0x44e043){passport[_0xce0d('0x17')](_0xce0d('0x33'),function(_0x5f3d8b,_0x3b7a10,_0x4b0724){var _0x215004=_0x5f3d8b||_0x4b0724;if(_0x215004){return handleError(_0x2ccd1b,0x191,_0x215004);}if(!_0x3b7a10){return handleError(_0x2ccd1b,0x194,{'message':_0xce0d('0x34')});}else{var _0x50df43={'payload':{'id':_0x3b7a10['id'],'role':_0x3b7a10[_0xce0d('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0xce0d('0x35')](_0x50df43)[_0xce0d('0xd')](function(_0x312ba4){_0x2ccd1b[_0xce0d('0x36')]({'id':_0x3b7a10['id'],'token':_0x312ba4,'statusCall':'','isAlreadyLogged':_0x3b7a10[_0xce0d('0x37')]});});}})(_0x47cefc,_0x2ccd1b,_0x44e043);};exports[_0xce0d('0x38')]=function(_0x1e6059,_0xed794,_0x22cd15){if(!_0x1e6059[_0xce0d('0x39')][_0xce0d('0x20')]){return handleError(_0xed794,0x1f4,{'message':_0xce0d('0x3a')});}var _0x5206d3=rs[_0xce0d('0x3b')]();_0x1e6059['body'][_0xce0d('0x20')]=_0x1e6059[_0xce0d('0x39')][_0xce0d('0x20')]['trim']()[_0xce0d('0x3c')]();var _0x2290ab;return db[_0xce0d('0x3d')][_0xce0d('0xa')]({'where':{'id':0x1},'attributes':[_0xce0d('0xb'),_0xce0d('0xc')],'raw':!![]})[_0xce0d('0xd')](function(_0x1205ae){_0x2290ab=_0x1205ae;return db[_0xce0d('0x3e')][_0xce0d('0x1f')]({'where':{'email':_0x1e6059[_0xce0d('0x39')]['email']}});})[_0xce0d('0xd')](function(_0x432ded){if(!_0x432ded){throw new Error(_0xce0d('0x3f'));}if(_0x432ded['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x432ded['blocked']){if(moment(_0x432ded[_0xce0d('0x1b')])[_0xce0d('0x18')](_0x2290ab[_0xce0d('0xc')],_0xce0d('0x19'))>moment()){throw new Error(_0xce0d('0x40'));}else{_0x432ded[_0xce0d('0x11')]=![];_0x432ded[_0xce0d('0x1b')]=null;}}_0x432ded[_0xce0d('0x41')]=_0x5206d3;_0x432ded[_0xce0d('0x42')]=Date[_0xce0d('0x43')]()+0x36ee80;return _0x432ded[_0xce0d('0x44')]();})[_0xce0d('0xd')](function(){return sendServiceMail({'to':_0x1e6059[_0xce0d('0x39')][_0xce0d('0x20')],'subject':_0xce0d('0x45'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xce0d('0x46')+_0xce0d('0x47')+_0x1e6059['headers']['host']+'/reset/'+_0x5206d3+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xce0d('0xd')](function(){_0xed794[_0xce0d('0x48')](0xc8)[_0xce0d('0x31')]({'message':_0xce0d('0x49')});})[_0xce0d('0x1d')](function(_0x36ca3c){return handleError(_0xed794,0x1f4,_0x36ca3c);});};exports['reset']=function(_0x5ba16e,_0x150f8e,_0x5c029c){return db[_0xce0d('0x3e')][_0xce0d('0x1f')]({'where':{'resetPasswordToken':_0x5ba16e[_0xce0d('0x4a')][_0xce0d('0x4b')],'resetPasswordExpires':{'$gt':Date[_0xce0d('0x43')]()}}})['then'](function(_0x41b501){if(!_0x41b501){throw new Error(_0xce0d('0x4c'));}return db[_0xce0d('0x3d')][_0xce0d('0xa')]({'attributes':['id',_0xce0d('0x4d'),_0xce0d('0x4e'),'passwordHistoryLimit']})['then'](function(_0x15e46b){if(_0x15e46b[_0xce0d('0x4d')])authService[_0xce0d('0x4f')](_0x5ba16e[_0xce0d('0x39')][_0xce0d('0x50')]);if(!_0x15e46b['enforcePasswordHistory']||!_0x41b501['previousPasswords'])return _0x41b501;authService[_0xce0d('0x51')](_0x5ba16e['body'][_0xce0d('0x50')],_0x41b501[_0xce0d('0x52')],_0x15e46b[_0xce0d('0x53')]);return _0x41b501;})['then'](function(){_0x41b501[_0xce0d('0x50')]=_0x5ba16e[_0xce0d('0x39')][_0xce0d('0x50')];_0x41b501[_0xce0d('0x41')]=null;_0x41b501[_0xce0d('0x42')]=null;return _0x41b501[_0xce0d('0x44')]();});})[_0xce0d('0xd')](function(){_0x150f8e[_0xce0d('0x48')](0xc8)[_0xce0d('0x31')]({'message':'Password\x20reset!'});})['catch'](function(_0x279d8c){return handleError(_0x150f8e,0x1f4,_0x279d8c);});};passport['use'](new LocalStrategy({'usernameField':_0xce0d('0xe'),'passwordField':_0xce0d('0x50')},function(_0x185056,_0x5650b3,_0x1033b0){return localAuthenticate(db[_0xce0d('0x3e')],_0x185056,_0x5650b3,_0x1033b0);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 4a70250..c059dc0 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 _0x35fe=['express','Router','post','login','/forgot','forgot','/reset/:token','reset'];(function(_0x3311ae,_0x362cee){var _0x107949=function(_0x2082a3){while(--_0x2082a3){_0x3311ae['push'](_0x3311ae['shift']());}};_0x107949(++_0x362cee);}(_0x35fe,0x180));var _0xe35f=function(_0x179b53,_0x31f6fe){_0x179b53=_0x179b53-0x0;var _0x38a146=_0x35fe[_0x179b53];return _0x38a146;};'use strict';var express=require(_0xe35f('0x0'));var router=express[_0xe35f('0x1')]();var controller=require('./authLocal.controller');router[_0xe35f('0x2')]('/',controller[_0xe35f('0x3')]);router[_0xe35f('0x2')](_0xe35f('0x4'),controller[_0xe35f('0x5')]);router[_0xe35f('0x2')](_0xe35f('0x6'),controller[_0xe35f('0x7')]);module['exports']=router; \ No newline at end of file +var _0x7f57=['express','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset','exports'];(function(_0x3559c4,_0x47580b){var _0x124053=function(_0x2edf1){while(--_0x2edf1){_0x3559c4['push'](_0x3559c4['shift']());}};_0x124053(++_0x47580b);}(_0x7f57,0x132));var _0x77f5=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x7f57[_0xfa634c];return _0x73e478;};'use strict';var express=require(_0x77f5('0x0'));var router=express['Router']();var controller=require(_0x77f5('0x1'));router[_0x77f5('0x2')]('/',controller[_0x77f5('0x3')]);router[_0x77f5('0x2')](_0x77f5('0x4'),controller[_0x77f5('0x5')]);router[_0x77f5('0x2')](_0x77f5('0x6'),controller[_0x77f5('0x7')]);module[_0x77f5('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 92e2664..91618e4 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 _0xa269=['sequelize','exports','STRING','BOOLEAN'];(function(_0x26a3e4,_0x2ac518){var _0x4b8201=function(_0x5e247b){while(--_0x5e247b){_0x26a3e4['push'](_0x26a3e4['shift']());}};_0x4b8201(++_0x2ac518);}(_0xa269,0x100));var _0x9a26=function(_0x1e2029,_0x48fbe6){_0x1e2029=_0x1e2029-0x0;var _0x55547c=_0xa269[_0x1e2029];return _0x55547c;};'use strict';var Sequelize=require(_0x9a26('0x0'));module[_0x9a26('0x1')]={'name':{'type':Sequelize[_0x9a26('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x9a26('0x2')]},'description':{'type':Sequelize[_0x9a26('0x2')]},'status':{'type':Sequelize[_0x9a26('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x6457=['sequelize','STRING','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6457,0x96));var _0x7645=function(_0x20eec2,_0x11dade){_0x20eec2=_0x20eec2-0x0;var _0x13bdd9=_0x6457[_0x20eec2];return _0x13bdd9;};'use strict';var Sequelize=require(_0x7645('0x0'));module['exports']={'name':{'type':Sequelize[_0x7645('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x7645('0x1')]},'description':{'type':Sequelize[_0x7645('0x1')]},'status':{'type':Sequelize[_0x7645('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'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 38a3904..252e478 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 _0x1fdd=['Automation','rawAttributes','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','include','findAll','rows','show','params','intersection','catch','create','body','find','destroy','Condition','addConditions','ids','omit','getConditions','addActions','getActions','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','name','index','map'];(function(_0x2bbcbf,_0x234d3f){var _0x4ac797=function(_0xcf1402){while(--_0xcf1402){_0x2bbcbf['push'](_0x2bbcbf['shift']());}};_0x4ac797(++_0x234d3f);}(_0x1fdd,0x11a));var _0xd1fd=function(_0x4d3ebb,_0x4c95dd){_0x4d3ebb=_0x4d3ebb-0x0;var _0x2864ca=_0x1fdd[_0x4d3ebb];return _0x2864ca;};'use strict';var emlformat=require(_0xd1fd('0x0'));var rimraf=require(_0xd1fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd1fd('0x2'));var rp=require(_0xd1fd('0x3'));var moment=require(_0xd1fd('0x4'));var BPromise=require(_0xd1fd('0x5'));var Mustache=require(_0xd1fd('0x6'));var util=require(_0xd1fd('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd1fd('0x8'));var ejs=require(_0xd1fd('0x9'));var fs=require('fs');var fs_extra=require(_0xd1fd('0xa'));var _=require(_0xd1fd('0xb'));var squel=require(_0xd1fd('0xc'));var crypto=require(_0xd1fd('0xd'));var jsforce=require(_0xd1fd('0xe'));var deskjs=require(_0xd1fd('0xf'));var toCsv=require(_0xd1fd('0x8'));var querystring=require('querystring');var Papa=require(_0xd1fd('0x10'));var Redis=require(_0xd1fd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd1fd('0x12'));var as=require(_0xd1fd('0x13'));var hardwareService=require(_0xd1fd('0x14'));var logger=require(_0xd1fd('0x15'))(_0xd1fd('0x16'));var utils=require(_0xd1fd('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd1fd('0x18'))['db'];function respondWithStatusCode(_0x4fc5f4,_0x235d20){_0x235d20=_0x235d20||0xcc;return function(_0x34566d){if(_0x34566d){return _0x4fc5f4[_0xd1fd('0x19')](_0x235d20);}return _0x4fc5f4[_0xd1fd('0x1a')](_0x235d20)[_0xd1fd('0x1b')]();};}function respondWithResult(_0x514927,_0x57c3f7){_0x57c3f7=_0x57c3f7||0xc8;return function(_0x255ece){if(_0x255ece){return _0x514927[_0xd1fd('0x1a')](_0x57c3f7)[_0xd1fd('0x1c')](_0x255ece);}};}function respondWithFilteredResult(_0x5b2c12,_0x383b01){return function(_0x430bd8){if(_0x430bd8){var _0x2367a8=typeof _0x383b01[_0xd1fd('0x1d')]===_0xd1fd('0x1e')&&typeof _0x383b01[_0xd1fd('0x1f')]==='undefined';var _0x341234=_0x430bd8[_0xd1fd('0x20')];var _0xe7db59=_0x2367a8?0x0:_0x383b01['offset'];var _0x532b5e=_0x2367a8?_0x430bd8[_0xd1fd('0x20')]:_0x383b01[_0xd1fd('0x1d')]+_0x383b01['limit'];var _0x335a9a;if(_0x532b5e>=_0x341234){_0x532b5e=_0x341234;_0x335a9a=0xc8;}else{_0x335a9a=0xce;}_0x5b2c12[_0xd1fd('0x1a')](_0x335a9a);return _0x5b2c12[_0xd1fd('0x21')](_0xd1fd('0x22'),_0xe7db59+'-'+_0x532b5e+'/'+_0x341234)['json'](_0x430bd8);}return null;};}function patchUpdates(_0x1750af){return function(_0x5c31fe){try{jsonpatch[_0xd1fd('0x23')](_0x5c31fe,_0x1750af,!![]);}catch(_0x415445){return BPromise['reject'](_0x415445);}return _0x5c31fe[_0xd1fd('0x24')]();};}function saveUpdates(_0x1a6582,_0x5071c4){return function(_0x5eaedb){if(_0x5eaedb){return _0x5eaedb[_0xd1fd('0x25')](_0x1a6582)[_0xd1fd('0x26')](function(_0x3ba45b){return _0x3ba45b;});}return null;};}function removeEntity(_0x49c925,_0x52f8e7){return function(_0x36c45a){if(_0x36c45a){return _0x36c45a['destroy']()['then'](function(){_0x49c925['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ca57a,_0x39f3e5){return function(_0x2215bd){if(!_0x2215bd){_0x1ca57a['sendStatus'](0x194);}return _0x2215bd;};}function handleError(_0x38f000,_0x3dde5c){_0x3dde5c=_0x3dde5c||0x1f4;return function(_0x33592e){logger['error'](_0x33592e['stack']);if(_0x33592e['name']){delete _0x33592e[_0xd1fd('0x27')];}_0x38f000[_0xd1fd('0x1a')](_0x3dde5c)['send'](_0x33592e);};}exports[_0xd1fd('0x28')]=function(_0x106a30,_0x2779c8){var _0x1f3375={},_0x2089fb={},_0x463164={'count':0x0,'rows':[]};var _0x1be238=_[_0xd1fd('0x29')](db[_0xd1fd('0x2a')][_0xd1fd('0x2b')],function(_0x4d00bd){return{'name':_0x4d00bd['fieldName'],'type':_0x4d00bd[_0xd1fd('0x2c')]['key']};});_0x2089fb[_0xd1fd('0x2d')]=_[_0xd1fd('0x29')](_0x1be238,_0xd1fd('0x27'));_0x2089fb[_0xd1fd('0x2e')]=_[_0xd1fd('0x2f')](_0x106a30['query']);_0x2089fb[_0xd1fd('0x30')]=_['intersection'](_0x2089fb['model'],_0x2089fb[_0xd1fd('0x2e')]);_0x1f3375[_0xd1fd('0x31')]=_['intersection'](_0x2089fb[_0xd1fd('0x2d')],qs[_0xd1fd('0x32')](_0x106a30['query'][_0xd1fd('0x32')]));_0x1f3375[_0xd1fd('0x31')]=_0x1f3375['attributes'][_0xd1fd('0x33')]?_0x1f3375[_0xd1fd('0x31')]:_0x2089fb['model'];if(!_0x106a30['query'][_0xd1fd('0x34')](_0xd1fd('0x35'))){_0x1f3375[_0xd1fd('0x1f')]=qs['limit'](_0x106a30[_0xd1fd('0x2e')][_0xd1fd('0x1f')]);_0x1f3375[_0xd1fd('0x1d')]=qs[_0xd1fd('0x1d')](_0x106a30[_0xd1fd('0x2e')][_0xd1fd('0x1d')]);}_0x1f3375[_0xd1fd('0x36')]=qs['sort'](_0x106a30['query'][_0xd1fd('0x37')]);_0x1f3375['where']=qs[_0xd1fd('0x30')](_[_0xd1fd('0x38')](_0x106a30[_0xd1fd('0x2e')],_0x2089fb[_0xd1fd('0x30')]),_0x1be238);if(_0x106a30[_0xd1fd('0x2e')][_0xd1fd('0x39')]){_0x1f3375['where']=_[_0xd1fd('0x3a')](_0x1f3375['where'],{'$or':_[_0xd1fd('0x29')](_0x1be238,function(_0x2949c1){if(_0x2949c1['type']!==_0xd1fd('0x3b')){var _0x1f3f24={};_0x1f3f24[_0x2949c1[_0xd1fd('0x27')]]={'$like':'%'+_0x106a30['query'][_0xd1fd('0x39')]+'%'};return _0x1f3f24;}})});}_0x1f3375=_[_0xd1fd('0x3a')]({},_0x1f3375,_0x106a30[_0xd1fd('0x3c')]);var _0x4748ae={'where':_0x1f3375[_0xd1fd('0x3d')]};return db[_0xd1fd('0x2a')][_0xd1fd('0x20')](_0x4748ae)[_0xd1fd('0x26')](function(_0x5a12bb){_0x463164['count']=_0x5a12bb;if(_0x106a30[_0xd1fd('0x2e')]['includeAll']){_0x1f3375[_0xd1fd('0x3e')]=[{'all':!![]}];}return db['Automation'][_0xd1fd('0x3f')](_0x1f3375);})[_0xd1fd('0x26')](function(_0x1301a4){_0x463164[_0xd1fd('0x40')]=_0x1301a4;return _0x463164;})[_0xd1fd('0x26')](respondWithFilteredResult(_0x2779c8,_0x1f3375))['catch'](handleError(_0x2779c8,null));};exports[_0xd1fd('0x41')]=function(_0x1c4e2e,_0x5633da){var _0x46d311={'raw':![],'where':{'id':_0x1c4e2e[_0xd1fd('0x42')]['id']}},_0x146a74={};_0x146a74[_0xd1fd('0x2d')]=_[_0xd1fd('0x2f')](db[_0xd1fd('0x2a')][_0xd1fd('0x2b')]);_0x146a74[_0xd1fd('0x2e')]=_[_0xd1fd('0x2f')](_0x1c4e2e[_0xd1fd('0x2e')]);_0x146a74[_0xd1fd('0x30')]=_['intersection'](_0x146a74[_0xd1fd('0x2d')],_0x146a74['query']);_0x46d311[_0xd1fd('0x31')]=_[_0xd1fd('0x43')](_0x146a74[_0xd1fd('0x2d')],qs['fields'](_0x1c4e2e[_0xd1fd('0x2e')][_0xd1fd('0x32')]));_0x46d311[_0xd1fd('0x31')]=_0x46d311[_0xd1fd('0x31')][_0xd1fd('0x33')]?_0x46d311[_0xd1fd('0x31')]:_0x146a74[_0xd1fd('0x2d')];if(_0x1c4e2e[_0xd1fd('0x2e')]['includeAll']){_0x46d311['include']=[{'all':!![]}];}_0x46d311=_[_0xd1fd('0x3a')]({},_0x46d311,_0x1c4e2e[_0xd1fd('0x3c')]);return db['Automation']['find'](_0x46d311)[_0xd1fd('0x26')](handleEntityNotFound(_0x5633da,null))['then'](respondWithResult(_0x5633da,null))[_0xd1fd('0x44')](handleError(_0x5633da,null));};exports[_0xd1fd('0x45')]=function(_0x8b649,_0x380b1a){return db[_0xd1fd('0x2a')][_0xd1fd('0x45')](_0x8b649['body'],{})[_0xd1fd('0x26')](respondWithResult(_0x380b1a,0xc9))[_0xd1fd('0x44')](handleError(_0x380b1a,null));};exports[_0xd1fd('0x25')]=function(_0x1ef378,_0x31aa4c){if(_0x1ef378[_0xd1fd('0x46')]['id']){delete _0x1ef378[_0xd1fd('0x46')]['id'];}return db[_0xd1fd('0x2a')][_0xd1fd('0x47')]({'where':{'id':_0x1ef378[_0xd1fd('0x42')]['id']}})['then'](handleEntityNotFound(_0x31aa4c,null))[_0xd1fd('0x26')](saveUpdates(_0x1ef378[_0xd1fd('0x46')],null))['then'](respondWithResult(_0x31aa4c,null))['catch'](handleError(_0x31aa4c,null));};exports[_0xd1fd('0x48')]=function(_0x320165,_0x5dd7ec){return db[_0xd1fd('0x2a')][_0xd1fd('0x47')]({'where':{'id':_0x320165[_0xd1fd('0x42')]['id']}})[_0xd1fd('0x26')](handleEntityNotFound(_0x5dd7ec,null))['then'](removeEntity(_0x5dd7ec,null))[_0xd1fd('0x44')](handleError(_0x5dd7ec,null));};exports['addConditions']=function(_0x4db6a8,_0xe6f8c1,_0x14f494){return db[_0xd1fd('0x49')][_0xd1fd('0x47')]({'where':{'id':_0x4db6a8[_0xd1fd('0x42')]['id']}})[_0xd1fd('0x26')](handleEntityNotFound(_0xe6f8c1,null))[_0xd1fd('0x26')](function(_0x99c722){if(_0x99c722){return _0x99c722[_0xd1fd('0x4a')](_0x4db6a8[_0xd1fd('0x46')][_0xd1fd('0x4b')],_[_0xd1fd('0x4c')](_0x4db6a8[_0xd1fd('0x46')],[_0xd1fd('0x4b'),'id'])||{});}})[_0xd1fd('0x26')](respondWithResult(_0xe6f8c1,null))[_0xd1fd('0x44')](handleError(_0xe6f8c1,null));};exports[_0xd1fd('0x4d')]=function(_0x5397aa,_0x2c5293,_0x317956){var _0x3e5e1e={};var _0x35908c={};var _0x55226d;var _0xdd692;return db[_0xd1fd('0x2a')]['findOne']({'where':{'id':_0x5397aa['params']['id']}})[_0xd1fd('0x26')](handleEntityNotFound(_0x2c5293,null))[_0xd1fd('0x26')](function(_0x5d3a56){if(_0x5d3a56){_0x55226d=_0x5d3a56;_0x35908c[_0xd1fd('0x2d')]=_[_0xd1fd('0x2f')](db[_0xd1fd('0x49')][_0xd1fd('0x2b')]);_0x35908c[_0xd1fd('0x2e')]=_[_0xd1fd('0x2f')](_0x5397aa[_0xd1fd('0x2e')]);_0x35908c[_0xd1fd('0x30')]=_[_0xd1fd('0x43')](_0x35908c[_0xd1fd('0x2d')],_0x35908c[_0xd1fd('0x2e')]);_0x3e5e1e['attributes']=_[_0xd1fd('0x43')](_0x35908c['model'],qs[_0xd1fd('0x32')](_0x5397aa[_0xd1fd('0x2e')][_0xd1fd('0x32')]));_0x3e5e1e[_0xd1fd('0x31')]=_0x3e5e1e[_0xd1fd('0x31')][_0xd1fd('0x33')]?_0x3e5e1e[_0xd1fd('0x31')]:_0x35908c[_0xd1fd('0x2d')];_0x3e5e1e[_0xd1fd('0x36')]=qs[_0xd1fd('0x37')](_0x5397aa['query']['sort']);_0x3e5e1e[_0xd1fd('0x3d')]=qs[_0xd1fd('0x30')](_[_0xd1fd('0x38')](_0x5397aa[_0xd1fd('0x2e')],_0x35908c[_0xd1fd('0x30')]));if(_0x5397aa['query'][_0xd1fd('0x39')]){_0x3e5e1e['where']=_[_0xd1fd('0x3a')](_0x3e5e1e[_0xd1fd('0x3d')],{'$or':_[_0xd1fd('0x29')](_0x3e5e1e[_0xd1fd('0x31')],function(_0x157130){var _0x2305bd={};_0x2305bd[_0x157130]={'$like':'%'+_0x5397aa[_0xd1fd('0x2e')][_0xd1fd('0x39')]+'%'};return _0x2305bd;})});}_0x3e5e1e=_[_0xd1fd('0x3a')]({},_0x3e5e1e,_0x5397aa[_0xd1fd('0x3c')]);return _0x55226d[_0xd1fd('0x4d')](_0x3e5e1e);}})['then'](function(_0x40390a){if(_0x40390a){_0xdd692=_0x40390a[_0xd1fd('0x33')];if(!_0x5397aa[_0xd1fd('0x2e')]['hasOwnProperty'](_0xd1fd('0x35'))){_0x3e5e1e['limit']=qs[_0xd1fd('0x1f')](_0x5397aa['query'][_0xd1fd('0x1f')]);_0x3e5e1e[_0xd1fd('0x1d')]=qs[_0xd1fd('0x1d')](_0x5397aa['query'][_0xd1fd('0x1d')]);}return _0x55226d[_0xd1fd('0x4d')](_0x3e5e1e);}})[_0xd1fd('0x26')](function(_0x195e75){if(_0x195e75){return _0x195e75?{'count':_0xdd692,'rows':_0x195e75}:null;}})['then'](respondWithResult(_0x2c5293,null))[_0xd1fd('0x44')](handleError(_0x2c5293,null));};exports[_0xd1fd('0x4e')]=function(_0x242399,_0x505b85,_0x1abdd9){return db['Action'][_0xd1fd('0x47')]({'where':{'id':_0x242399[_0xd1fd('0x42')]['id']}})[_0xd1fd('0x26')](handleEntityNotFound(_0x505b85,null))['then'](function(_0x46ef43){if(_0x46ef43){return _0x46ef43[_0xd1fd('0x4e')](_0x242399['body'][_0xd1fd('0x4b')],_[_0xd1fd('0x4c')](_0x242399[_0xd1fd('0x46')],['ids','id'])||{});}})[_0xd1fd('0x26')](respondWithResult(_0x505b85,null))['catch'](handleError(_0x505b85,null));};exports[_0xd1fd('0x4f')]=function(_0x5bcd7a,_0x16a140,_0xe4b77a){var _0x287037={};var _0x180c0a={};var _0x1e610b;var _0x2b6896;return db[_0xd1fd('0x2a')][_0xd1fd('0x50')]({'where':{'id':_0x5bcd7a[_0xd1fd('0x42')]['id']}})[_0xd1fd('0x26')](handleEntityNotFound(_0x16a140,null))[_0xd1fd('0x26')](function(_0x743b41){if(_0x743b41){_0x1e610b=_0x743b41;_0x180c0a[_0xd1fd('0x2d')]=_[_0xd1fd('0x2f')](db['Action'][_0xd1fd('0x2b')]);_0x180c0a['query']=_[_0xd1fd('0x2f')](_0x5bcd7a['query']);_0x180c0a[_0xd1fd('0x30')]=_['intersection'](_0x180c0a[_0xd1fd('0x2d')],_0x180c0a[_0xd1fd('0x2e')]);_0x287037[_0xd1fd('0x31')]=_[_0xd1fd('0x43')](_0x180c0a[_0xd1fd('0x2d')],qs['fields'](_0x5bcd7a[_0xd1fd('0x2e')]['fields']));_0x287037[_0xd1fd('0x31')]=_0x287037[_0xd1fd('0x31')][_0xd1fd('0x33')]?_0x287037[_0xd1fd('0x31')]:_0x180c0a[_0xd1fd('0x2d')];_0x287037[_0xd1fd('0x36')]=qs[_0xd1fd('0x37')](_0x5bcd7a[_0xd1fd('0x2e')]['sort']);_0x287037[_0xd1fd('0x3d')]=qs['filters'](_[_0xd1fd('0x38')](_0x5bcd7a[_0xd1fd('0x2e')],_0x180c0a[_0xd1fd('0x30')]));if(_0x5bcd7a[_0xd1fd('0x2e')][_0xd1fd('0x39')]){_0x287037[_0xd1fd('0x3d')]=_[_0xd1fd('0x3a')](_0x287037[_0xd1fd('0x3d')],{'$or':_[_0xd1fd('0x29')](_0x287037[_0xd1fd('0x31')],function(_0x599b7d){var _0x1bc942={};_0x1bc942[_0x599b7d]={'$like':'%'+_0x5bcd7a['query'][_0xd1fd('0x39')]+'%'};return _0x1bc942;})});}_0x287037=_[_0xd1fd('0x3a')]({},_0x287037,_0x5bcd7a['options']);return _0x1e610b['getActions'](_0x287037);}})[_0xd1fd('0x26')](function(_0x1d2944){if(_0x1d2944){_0x2b6896=_0x1d2944[_0xd1fd('0x33')];if(!_0x5bcd7a[_0xd1fd('0x2e')][_0xd1fd('0x34')]('nolimit')){_0x287037[_0xd1fd('0x1f')]=qs[_0xd1fd('0x1f')](_0x5bcd7a['query'][_0xd1fd('0x1f')]);_0x287037[_0xd1fd('0x1d')]=qs[_0xd1fd('0x1d')](_0x5bcd7a[_0xd1fd('0x2e')]['offset']);}return _0x1e610b[_0xd1fd('0x4f')](_0x287037);}})[_0xd1fd('0x26')](function(_0x49117c){if(_0x49117c){return _0x49117c?{'count':_0x2b6896,'rows':_0x49117c}:null;}})[_0xd1fd('0x26')](respondWithResult(_0x16a140,null))['catch'](handleError(_0x16a140,null));}; \ No newline at end of file +var _0x314c=['sort','addActions','pick','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Automation','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filter','merge','type','options','includeAll','catch','show','params','length','include','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne'];(function(_0x7b7737,_0x22a892){var _0x118dc0=function(_0x1f0d0e){while(--_0x1f0d0e){_0x7b7737['push'](_0x7b7737['shift']());}};_0x118dc0(++_0x22a892);}(_0x314c,0x193));var _0xc314=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x314c[_0x2d34d6];return _0x1d3d12;};'use strict';var emlformat=require(_0xc314('0x0'));var rimraf=require(_0xc314('0x1'));var zipdir=require(_0xc314('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc314('0x3'));var moment=require(_0xc314('0x4'));var BPromise=require(_0xc314('0x5'));var Mustache=require(_0xc314('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc314('0x7'));var ejs=require(_0xc314('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc314('0x9'));var squel=require(_0xc314('0xa'));var crypto=require('crypto');var jsforce=require(_0xc314('0xb'));var deskjs=require(_0xc314('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc314('0xd'));var Redis=require(_0xc314('0xe'));var authService=require(_0xc314('0xf'));var qs=require(_0xc314('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc314('0x11'))(_0xc314('0x12'));var utils=require(_0xc314('0x13'));var config=require(_0xc314('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43ddd4,_0x3dc701){_0x3dc701=_0x3dc701||0xcc;return function(_0x18c029){if(_0x18c029){return _0x43ddd4[_0xc314('0x15')](_0x3dc701);}return _0x43ddd4[_0xc314('0x16')](_0x3dc701)[_0xc314('0x17')]();};}function respondWithResult(_0x301efe,_0x44bf10){_0x44bf10=_0x44bf10||0xc8;return function(_0x3db4a5){if(_0x3db4a5){return _0x301efe[_0xc314('0x16')](_0x44bf10)[_0xc314('0x18')](_0x3db4a5);}};}function respondWithFilteredResult(_0x5dc586,_0x5dbd51){return function(_0x88873b){if(_0x88873b){var _0x2c008f=typeof _0x5dbd51[_0xc314('0x19')]===_0xc314('0x1a')&&typeof _0x5dbd51['limit']===_0xc314('0x1a');var _0x3f848c=_0x88873b[_0xc314('0x1b')];var _0x506ce7=_0x2c008f?0x0:_0x5dbd51[_0xc314('0x19')];var _0x288b28=_0x2c008f?_0x88873b['count']:_0x5dbd51[_0xc314('0x19')]+_0x5dbd51[_0xc314('0x1c')];var _0x5a7c96;if(_0x288b28>=_0x3f848c){_0x288b28=_0x3f848c;_0x5a7c96=0xc8;}else{_0x5a7c96=0xce;}_0x5dc586['status'](_0x5a7c96);return _0x5dc586[_0xc314('0x1d')](_0xc314('0x1e'),_0x506ce7+'-'+_0x288b28+'/'+_0x3f848c)[_0xc314('0x18')](_0x88873b);}return null;};}function patchUpdates(_0x3fcdc9){return function(_0x48bbb1){try{jsonpatch[_0xc314('0x1f')](_0x48bbb1,_0x3fcdc9,!![]);}catch(_0x4a4864){return BPromise[_0xc314('0x20')](_0x4a4864);}return _0x48bbb1[_0xc314('0x21')]();};}function saveUpdates(_0x3254bb,_0x872f82){return function(_0x1b0ff1){if(_0x1b0ff1){return _0x1b0ff1[_0xc314('0x22')](_0x3254bb)[_0xc314('0x23')](function(_0x477f25){return _0x477f25;});}return null;};}function removeEntity(_0x10d4c4,_0x368a32){return function(_0x1e6750){if(_0x1e6750){return _0x1e6750[_0xc314('0x24')]()[_0xc314('0x23')](function(){_0x10d4c4[_0xc314('0x16')](0xcc)[_0xc314('0x17')]();});}};}function handleEntityNotFound(_0x4c27a6,_0x214254){return function(_0x29022d){if(!_0x29022d){_0x4c27a6[_0xc314('0x15')](0x194);}return _0x29022d;};}function handleError(_0x579701,_0x3eebd6){_0x3eebd6=_0x3eebd6||0x1f4;return function(_0x586613){logger[_0xc314('0x25')](_0x586613[_0xc314('0x26')]);if(_0x586613[_0xc314('0x27')]){delete _0x586613[_0xc314('0x27')];}_0x579701[_0xc314('0x16')](_0x3eebd6)[_0xc314('0x28')](_0x586613);};}exports[_0xc314('0x29')]=function(_0x1b9557,_0x399b94){var _0x14bbec={},_0x23319d={},_0x1ad850={'count':0x0,'rows':[]};var _0x4af9c6=_['map'](db[_0xc314('0x2a')][_0xc314('0x2b')],function(_0x235e13){return{'name':_0x235e13[_0xc314('0x2c')],'type':_0x235e13['type'][_0xc314('0x2d')]};});_0x23319d[_0xc314('0x2e')]=_[_0xc314('0x2f')](_0x4af9c6,_0xc314('0x27'));_0x23319d[_0xc314('0x30')]=_[_0xc314('0x31')](_0x1b9557['query']);_0x23319d[_0xc314('0x32')]=_[_0xc314('0x33')](_0x23319d['model'],_0x23319d[_0xc314('0x30')]);_0x14bbec[_0xc314('0x34')]=_[_0xc314('0x33')](_0x23319d['model'],qs[_0xc314('0x35')](_0x1b9557[_0xc314('0x30')]['fields']));_0x14bbec[_0xc314('0x34')]=_0x14bbec[_0xc314('0x34')]['length']?_0x14bbec['attributes']:_0x23319d['model'];if(!_0x1b9557[_0xc314('0x30')][_0xc314('0x36')](_0xc314('0x37'))){_0x14bbec['limit']=qs[_0xc314('0x1c')](_0x1b9557['query']['limit']);_0x14bbec['offset']=qs[_0xc314('0x19')](_0x1b9557[_0xc314('0x30')]['offset']);}_0x14bbec[_0xc314('0x38')]=qs['sort'](_0x1b9557[_0xc314('0x30')]['sort']);_0x14bbec[_0xc314('0x39')]=qs[_0xc314('0x32')](_['pick'](_0x1b9557[_0xc314('0x30')],_0x23319d[_0xc314('0x32')]),_0x4af9c6);if(_0x1b9557[_0xc314('0x30')][_0xc314('0x3a')]){_0x14bbec[_0xc314('0x39')]=_[_0xc314('0x3b')](_0x14bbec[_0xc314('0x39')],{'$or':_[_0xc314('0x2f')](_0x4af9c6,function(_0x13fed9){if(_0x13fed9[_0xc314('0x3c')]!=='VIRTUAL'){var _0x5e7360={};_0x5e7360[_0x13fed9[_0xc314('0x27')]]={'$like':'%'+_0x1b9557[_0xc314('0x30')][_0xc314('0x3a')]+'%'};return _0x5e7360;}})});}_0x14bbec=_[_0xc314('0x3b')]({},_0x14bbec,_0x1b9557[_0xc314('0x3d')]);var _0x55ebdc={'where':_0x14bbec[_0xc314('0x39')]};return db[_0xc314('0x2a')][_0xc314('0x1b')](_0x55ebdc)[_0xc314('0x23')](function(_0x220c19){_0x1ad850['count']=_0x220c19;if(_0x1b9557['query'][_0xc314('0x3e')]){_0x14bbec['include']=[{'all':!![]}];}return db[_0xc314('0x2a')]['findAll'](_0x14bbec);})[_0xc314('0x23')](function(_0x497ba6){_0x1ad850['rows']=_0x497ba6;return _0x1ad850;})[_0xc314('0x23')](respondWithFilteredResult(_0x399b94,_0x14bbec))[_0xc314('0x3f')](handleError(_0x399b94,null));};exports[_0xc314('0x40')]=function(_0x35cb6a,_0x25f769){var _0x461817={'raw':![],'where':{'id':_0x35cb6a[_0xc314('0x41')]['id']}},_0x41ed31={};_0x41ed31[_0xc314('0x2e')]=_[_0xc314('0x31')](db['Automation'][_0xc314('0x2b')]);_0x41ed31[_0xc314('0x30')]=_[_0xc314('0x31')](_0x35cb6a[_0xc314('0x30')]);_0x41ed31[_0xc314('0x32')]=_[_0xc314('0x33')](_0x41ed31[_0xc314('0x2e')],_0x41ed31[_0xc314('0x30')]);_0x461817[_0xc314('0x34')]=_[_0xc314('0x33')](_0x41ed31['model'],qs['fields'](_0x35cb6a['query'][_0xc314('0x35')]));_0x461817[_0xc314('0x34')]=_0x461817[_0xc314('0x34')][_0xc314('0x42')]?_0x461817['attributes']:_0x41ed31[_0xc314('0x2e')];if(_0x35cb6a[_0xc314('0x30')][_0xc314('0x3e')]){_0x461817[_0xc314('0x43')]=[{'all':!![]}];}_0x461817=_['merge']({},_0x461817,_0x35cb6a[_0xc314('0x3d')]);return db['Automation'][_0xc314('0x44')](_0x461817)['then'](handleEntityNotFound(_0x25f769,null))[_0xc314('0x23')](respondWithResult(_0x25f769,null))['catch'](handleError(_0x25f769,null));};exports['create']=function(_0x378c7b,_0x5ddcd9){return db[_0xc314('0x2a')][_0xc314('0x45')](_0x378c7b[_0xc314('0x46')],{})[_0xc314('0x23')](respondWithResult(_0x5ddcd9,0xc9))[_0xc314('0x3f')](handleError(_0x5ddcd9,null));};exports[_0xc314('0x22')]=function(_0x28a7e1,_0x2ed90b){if(_0x28a7e1[_0xc314('0x46')]['id']){delete _0x28a7e1[_0xc314('0x46')]['id'];}return db[_0xc314('0x2a')][_0xc314('0x44')]({'where':{'id':_0x28a7e1['params']['id']}})[_0xc314('0x23')](handleEntityNotFound(_0x2ed90b,null))[_0xc314('0x23')](saveUpdates(_0x28a7e1[_0xc314('0x46')],null))[_0xc314('0x23')](respondWithResult(_0x2ed90b,null))[_0xc314('0x3f')](handleError(_0x2ed90b,null));};exports[_0xc314('0x24')]=function(_0x37b56c,_0x2814cb){return db[_0xc314('0x2a')][_0xc314('0x44')]({'where':{'id':_0x37b56c[_0xc314('0x41')]['id']}})[_0xc314('0x23')](handleEntityNotFound(_0x2814cb,null))[_0xc314('0x23')](removeEntity(_0x2814cb,null))[_0xc314('0x3f')](handleError(_0x2814cb,null));};exports[_0xc314('0x47')]=function(_0x4a4072,_0x47a5e8,_0x1f41a1){return db[_0xc314('0x48')][_0xc314('0x44')]({'where':{'id':_0x4a4072[_0xc314('0x41')]['id']}})[_0xc314('0x23')](handleEntityNotFound(_0x47a5e8,null))[_0xc314('0x23')](function(_0x2f5b14){if(_0x2f5b14){return _0x2f5b14[_0xc314('0x47')](_0x4a4072[_0xc314('0x46')][_0xc314('0x49')],_[_0xc314('0x4a')](_0x4a4072[_0xc314('0x46')],[_0xc314('0x49'),'id'])||{});}})[_0xc314('0x23')](respondWithResult(_0x47a5e8,null))['catch'](handleError(_0x47a5e8,null));};exports[_0xc314('0x4b')]=function(_0x160c23,_0x187c38,_0x32f878){var _0x1bdd8f={};var _0x2c46fd={};var _0x2b61a6;var _0x393c31;return db['Automation'][_0xc314('0x4c')]({'where':{'id':_0x160c23['params']['id']}})[_0xc314('0x23')](handleEntityNotFound(_0x187c38,null))[_0xc314('0x23')](function(_0x48f4d8){if(_0x48f4d8){_0x2b61a6=_0x48f4d8;_0x2c46fd[_0xc314('0x2e')]=_[_0xc314('0x31')](db[_0xc314('0x48')][_0xc314('0x2b')]);_0x2c46fd[_0xc314('0x30')]=_[_0xc314('0x31')](_0x160c23['query']);_0x2c46fd['filters']=_[_0xc314('0x33')](_0x2c46fd['model'],_0x2c46fd[_0xc314('0x30')]);_0x1bdd8f[_0xc314('0x34')]=_[_0xc314('0x33')](_0x2c46fd['model'],qs['fields'](_0x160c23['query'][_0xc314('0x35')]));_0x1bdd8f[_0xc314('0x34')]=_0x1bdd8f[_0xc314('0x34')][_0xc314('0x42')]?_0x1bdd8f[_0xc314('0x34')]:_0x2c46fd['model'];_0x1bdd8f[_0xc314('0x38')]=qs[_0xc314('0x4d')](_0x160c23[_0xc314('0x30')][_0xc314('0x4d')]);_0x1bdd8f[_0xc314('0x39')]=qs[_0xc314('0x32')](_['pick'](_0x160c23[_0xc314('0x30')],_0x2c46fd['filters']));if(_0x160c23[_0xc314('0x30')][_0xc314('0x3a')]){_0x1bdd8f[_0xc314('0x39')]=_[_0xc314('0x3b')](_0x1bdd8f[_0xc314('0x39')],{'$or':_[_0xc314('0x2f')](_0x1bdd8f[_0xc314('0x34')],function(_0x29032d){var _0x2ba009={};_0x2ba009[_0x29032d]={'$like':'%'+_0x160c23[_0xc314('0x30')][_0xc314('0x3a')]+'%'};return _0x2ba009;})});}_0x1bdd8f=_[_0xc314('0x3b')]({},_0x1bdd8f,_0x160c23[_0xc314('0x3d')]);return _0x2b61a6[_0xc314('0x4b')](_0x1bdd8f);}})[_0xc314('0x23')](function(_0x65d028){if(_0x65d028){_0x393c31=_0x65d028[_0xc314('0x42')];if(!_0x160c23[_0xc314('0x30')][_0xc314('0x36')](_0xc314('0x37'))){_0x1bdd8f[_0xc314('0x1c')]=qs[_0xc314('0x1c')](_0x160c23[_0xc314('0x30')][_0xc314('0x1c')]);_0x1bdd8f[_0xc314('0x19')]=qs['offset'](_0x160c23[_0xc314('0x30')][_0xc314('0x19')]);}return _0x2b61a6['getConditions'](_0x1bdd8f);}})[_0xc314('0x23')](function(_0x5b1443){if(_0x5b1443){return _0x5b1443?{'count':_0x393c31,'rows':_0x5b1443}:null;}})[_0xc314('0x23')](respondWithResult(_0x187c38,null))[_0xc314('0x3f')](handleError(_0x187c38,null));};exports[_0xc314('0x4e')]=function(_0x1fd0ab,_0x3957da,_0x4f0de5){return db['Action']['find']({'where':{'id':_0x1fd0ab['params']['id']}})[_0xc314('0x23')](handleEntityNotFound(_0x3957da,null))[_0xc314('0x23')](function(_0x5d50c1){if(_0x5d50c1){return _0x5d50c1[_0xc314('0x4e')](_0x1fd0ab[_0xc314('0x46')][_0xc314('0x49')],_[_0xc314('0x4a')](_0x1fd0ab[_0xc314('0x46')],[_0xc314('0x49'),'id'])||{});}})[_0xc314('0x23')](respondWithResult(_0x3957da,null))[_0xc314('0x3f')](handleError(_0x3957da,null));};exports['getActions']=function(_0x1fd86f,_0x5089c7,_0x141f6a){var _0x64ce64={};var _0x302918={};var _0x444ab1;var _0x14270e;return db[_0xc314('0x2a')][_0xc314('0x4c')]({'where':{'id':_0x1fd86f[_0xc314('0x41')]['id']}})['then'](handleEntityNotFound(_0x5089c7,null))[_0xc314('0x23')](function(_0x30d5d0){if(_0x30d5d0){_0x444ab1=_0x30d5d0;_0x302918[_0xc314('0x2e')]=_['keys'](db['Action'][_0xc314('0x2b')]);_0x302918['query']=_[_0xc314('0x31')](_0x1fd86f['query']);_0x302918[_0xc314('0x32')]=_[_0xc314('0x33')](_0x302918[_0xc314('0x2e')],_0x302918[_0xc314('0x30')]);_0x64ce64['attributes']=_[_0xc314('0x33')](_0x302918[_0xc314('0x2e')],qs[_0xc314('0x35')](_0x1fd86f[_0xc314('0x30')][_0xc314('0x35')]));_0x64ce64[_0xc314('0x34')]=_0x64ce64[_0xc314('0x34')][_0xc314('0x42')]?_0x64ce64[_0xc314('0x34')]:_0x302918['model'];_0x64ce64[_0xc314('0x38')]=qs['sort'](_0x1fd86f[_0xc314('0x30')][_0xc314('0x4d')]);_0x64ce64[_0xc314('0x39')]=qs[_0xc314('0x32')](_[_0xc314('0x4f')](_0x1fd86f[_0xc314('0x30')],_0x302918[_0xc314('0x32')]));if(_0x1fd86f[_0xc314('0x30')][_0xc314('0x3a')]){_0x64ce64[_0xc314('0x39')]=_[_0xc314('0x3b')](_0x64ce64[_0xc314('0x39')],{'$or':_[_0xc314('0x2f')](_0x64ce64[_0xc314('0x34')],function(_0x4cfe4){var _0x1f5262={};_0x1f5262[_0x4cfe4]={'$like':'%'+_0x1fd86f[_0xc314('0x30')][_0xc314('0x3a')]+'%'};return _0x1f5262;})});}_0x64ce64=_[_0xc314('0x3b')]({},_0x64ce64,_0x1fd86f[_0xc314('0x3d')]);return _0x444ab1['getActions'](_0x64ce64);}})[_0xc314('0x23')](function(_0xb5dcd1){if(_0xb5dcd1){_0x14270e=_0xb5dcd1['length'];if(!_0x1fd86f['query'][_0xc314('0x36')](_0xc314('0x37'))){_0x64ce64[_0xc314('0x1c')]=qs[_0xc314('0x1c')](_0x1fd86f[_0xc314('0x30')]['limit']);_0x64ce64[_0xc314('0x19')]=qs['offset'](_0x1fd86f[_0xc314('0x30')]['offset']);}return _0x444ab1['getActions'](_0x64ce64);}})[_0xc314('0x23')](function(_0x1ccadb){if(_0x1ccadb){return _0x1ccadb?{'count':_0x14270e,'rows':_0x1ccadb}:null;}})['then'](respondWithResult(_0x5089c7,null))['catch'](handleError(_0x5089c7,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 867d55e..df67553 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 _0x5006=['define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./automation.attributes','exports'];(function(_0x109bc8,_0x53c816){var _0x420c92=function(_0x501329){while(--_0x501329){_0x109bc8['push'](_0x109bc8['shift']());}};_0x420c92(++_0x53c816);}(_0x5006,0x85));var _0x6500=function(_0x17a32f,_0x1e8d1b){_0x17a32f=_0x17a32f-0x0;var _0x32a571=_0x5006[_0x17a32f];return _0x32a571;};'use strict';var _=require(_0x6500('0x0'));var util=require(_0x6500('0x1'));var logger=require(_0x6500('0x2'))(_0x6500('0x3'));var moment=require(_0x6500('0x4'));var BPromise=require('bluebird');var rp=require(_0x6500('0x5'));var fs=require('fs');var path=require(_0x6500('0x6'));var rimraf=require('rimraf');var config=require(_0x6500('0x7'));var attributes=require(_0x6500('0x8'));module[_0x6500('0x9')]=function(_0x57ba04,_0x21dd3c){return _0x57ba04[_0x6500('0xa')](_0x6500('0xb'),attributes,{'tableName':_0x6500('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd84c=['bluebird','path','rimraf','../../config/environment','exports','define','Automation','tools_automations','util','../../config/logger'];(function(_0x1ac370,_0x4f1bd9){var _0x6f0ff3=function(_0x22b11b){while(--_0x22b11b){_0x1ac370['push'](_0x1ac370['shift']());}};_0x6f0ff3(++_0x4f1bd9);}(_0xd84c,0x116));var _0xcd84=function(_0x3067f3,_0x55914e){_0x3067f3=_0x3067f3-0x0;var _0xcecdf4=_0xd84c[_0x3067f3];return _0xcecdf4;};'use strict';var _=require('lodash');var util=require(_0xcd84('0x0'));var logger=require(_0xcd84('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcd84('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd84('0x3'));var rimraf=require(_0xcd84('0x4'));var config=require(_0xcd84('0x5'));var attributes=require('./automation.attributes');module[_0xcd84('0x6')]=function(_0x1ffcbd,_0x115abf){return _0x1ffcbd[_0xcd84('0x7')](_0xcd84('0x8'),attributes,{'tableName':_0xcd84('0x9'),'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 18fa46c..5d3b59e 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 _0x0598=['../../config/utils','jayson/promise','client','info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','bluebird','../../mysqldb'];(function(_0x43bf96,_0x436e04){var _0x15b6e5=function(_0x4bd062){while(--_0x4bd062){_0x43bf96['push'](_0x43bf96['shift']());}};_0x15b6e5(++_0x436e04);}(_0x0598,0x92));var _0x8059=function(_0x1452a6,_0x83702){_0x1452a6=_0x1452a6-0x0;var _0x3ab433=_0x0598[_0x1452a6];return _0x3ab433;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5996d7,_0x248273,_0x347f1b){return new BPromise(function(_0x4610d2,_0x116946){return client['request'](_0x5996d7,_0x347f1b)['then'](function(_0x89dda1){logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,_0x8059('0x9'));logger[_0x8059('0xa')]('Automation,\x20%s,\x20%s,\x20%s',_0x248273,'request\x20sent',JSON[_0x8059('0xb')](_0x89dda1));if(_0x89dda1[_0x8059('0xc')]){if(_0x89dda1['error']['code']===0x1f4){logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);return _0x116946(_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);}logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1['error'][_0x8059('0xd')]);return _0x4610d2(_0x89dda1['error'][_0x8059('0xd')]);}else{logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,'request\x20sent');_0x4610d2(_0x89dda1['result']['message']);}})[_0x8059('0xe')](function(_0x239195){logger[_0x8059('0xc')](_0x8059('0x8'),_0x248273,_0x239195);_0x116946(_0x239195);});});} \ No newline at end of file +var _0xa3b7=['info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x1895b7,_0x21fbc7){var _0x1aecdc=function(_0x44682a){while(--_0x44682a){_0x1895b7['push'](_0x1895b7['shift']());}};_0x1aecdc(++_0x21fbc7);}(_0xa3b7,0xe6));var _0x7a3b=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0xa3b7[_0x178f52];return _0x556f99;};'use strict';var _=require(_0x7a3b('0x0'));var util=require('util');var moment=require(_0x7a3b('0x1'));var BPromise=require('bluebird');var rs=require(_0x7a3b('0x2'));var fs=require('fs');var Redis=require(_0x7a3b('0x3'));var db=require(_0x7a3b('0x4'))['db'];var utils=require(_0x7a3b('0x5'));var logger=require(_0x7a3b('0x6'))(_0x7a3b('0x7'));var config=require(_0x7a3b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7a3b('0x9')][_0x7a3b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31274f,_0x43c083,_0x63f93d){return new BPromise(function(_0x560f45,_0x1d6e53){return client['request'](_0x31274f,_0x63f93d)[_0x7a3b('0xb')](function(_0x60adf9){logger[_0x7a3b('0xc')](_0x7a3b('0xd'),_0x43c083,_0x7a3b('0xe'));logger[_0x7a3b('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x43c083,_0x7a3b('0xe'),JSON[_0x7a3b('0x10')](_0x60adf9));if(_0x60adf9[_0x7a3b('0x11')]){if(_0x60adf9['error'][_0x7a3b('0x12')]===0x1f4){logger[_0x7a3b('0x11')]('Automation,\x20%s,\x20%s',_0x43c083,_0x60adf9[_0x7a3b('0x11')][_0x7a3b('0x13')]);return _0x1d6e53(_0x60adf9[_0x7a3b('0x11')]['message']);}logger[_0x7a3b('0x11')](_0x7a3b('0xd'),_0x43c083,_0x60adf9[_0x7a3b('0x11')]['message']);return _0x560f45(_0x60adf9[_0x7a3b('0x11')][_0x7a3b('0x13')]);}else{logger['info'](_0x7a3b('0xd'),_0x43c083,_0x7a3b('0xe'));_0x560f45(_0x60adf9[_0x7a3b('0x14')]['message']);}})[_0x7a3b('0x15')](function(_0x414a5b){logger['error'](_0x7a3b('0xd'),_0x43c083,_0x414a5b);_0x1d6e53(_0x414a5b);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 3120a2d..1b51d53 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 _0x8eac=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','show','/:id/conditions','getConditions','/:id/actions','create','addConditions','post','addActions','put','update','delete','destroy','exports','multer','path'];(function(_0x4c3afd,_0x3e7a45){var _0x4e2ef3=function(_0x426053){while(--_0x426053){_0x4c3afd['push'](_0x4c3afd['shift']());}};_0x4e2ef3(++_0x3e7a45);}(_0x8eac,0x11c));var _0xc8ea=function(_0x1a1f82,_0x16e88b){_0x1a1f82=_0x1a1f82-0x0;var _0x152427=_0x8eac[_0x1a1f82];return _0x152427;};'use strict';var multer=require(_0xc8ea('0x0'));var util=require('util');var path=require(_0xc8ea('0x1'));var timeout=require(_0xc8ea('0x2'));var express=require(_0xc8ea('0x3'));var router=express[_0xc8ea('0x4')]();var fs_extra=require(_0xc8ea('0x5'));var auth=require(_0xc8ea('0x6'));var interaction=require(_0xc8ea('0x7'));var config=require(_0xc8ea('0x8'));var controller=require(_0xc8ea('0x9'));router[_0xc8ea('0xa')]('/',auth[_0xc8ea('0xb')](),controller['index']);router[_0xc8ea('0xa')](_0xc8ea('0xc'),auth[_0xc8ea('0xb')](),controller[_0xc8ea('0xd')]);router[_0xc8ea('0xa')](_0xc8ea('0xe'),auth[_0xc8ea('0xb')](),controller[_0xc8ea('0xf')]);router[_0xc8ea('0xa')](_0xc8ea('0x10'),auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth['isAuthenticated'](),controller[_0xc8ea('0x11')]);router['post'](_0xc8ea('0xe'),auth['isAuthenticated'](),controller[_0xc8ea('0x12')]);router[_0xc8ea('0x13')](_0xc8ea('0x10'),auth[_0xc8ea('0xb')](),controller[_0xc8ea('0x14')]);router[_0xc8ea('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xc8ea('0x16')]);router[_0xc8ea('0x17')](_0xc8ea('0xc'),auth[_0xc8ea('0xb')](),controller[_0xc8ea('0x18')]);module[_0xc8ea('0x19')]=router; \ No newline at end of file +var _0xc14d=['create','post','addConditions','addActions','/:id','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','show','getConditions','/:id/actions'];(function(_0x40e810,_0x337158){var _0x4d4b15=function(_0x4480a3){while(--_0x4480a3){_0x40e810['push'](_0x40e810['shift']());}};_0x4d4b15(++_0x337158);}(_0xc14d,0x1ea));var _0xdc14=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc14d[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdc14('0x0'));var timeout=require(_0xdc14('0x1'));var express=require(_0xdc14('0x2'));var router=express[_0xdc14('0x3')]();var fs_extra=require(_0xdc14('0x4'));var auth=require(_0xdc14('0x5'));var interaction=require(_0xdc14('0x6'));var config=require(_0xdc14('0x7'));var controller=require(_0xdc14('0x8'));router[_0xdc14('0x9')]('/',auth[_0xdc14('0xa')](),controller['index']);router[_0xdc14('0x9')]('/:id',auth[_0xdc14('0xa')](),controller[_0xdc14('0xb')]);router[_0xdc14('0x9')]('/:id/conditions',auth[_0xdc14('0xa')](),controller[_0xdc14('0xc')]);router[_0xdc14('0x9')](_0xdc14('0xd'),auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth[_0xdc14('0xa')](),controller[_0xdc14('0xe')]);router[_0xdc14('0xf')]('/:id/conditions',auth[_0xdc14('0xa')](),controller[_0xdc14('0x10')]);router[_0xdc14('0xf')]('/:id/actions',auth[_0xdc14('0xa')](),controller[_0xdc14('0x11')]);router['put']('/:id',auth[_0xdc14('0xa')](),controller['update']);router['delete'](_0xdc14('0x12'),auth['isAuthenticated'](),controller[_0xdc14('0x13')]);module[_0xdc14('0x14')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index ce71431..f1635a7 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 _0x6918=['never','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always'];(function(_0x51f1af,_0x55a1a4){var _0x3ae83d=function(_0xd475e6){while(--_0xd475e6){_0x51f1af['push'](_0x51f1af['shift']());}};_0x3ae83d(++_0x55a1a4);}(_0x6918,0xc8));var _0x8691=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6918[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x8691('0x0')]={'name':{'type':Sequelize[_0x8691('0x1')],'unique':_0x8691('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x8691('0x3')](_0x8691('0x4')),'allowNull':![],'defaultValue':_0x8691('0x4')},'description':{'type':Sequelize[_0x8691('0x1')]},'active':{'type':Sequelize[_0x8691('0x5')],'defaultValue':0x0,'comment':_0x8691('0x6')},'limitCalls':{'type':Sequelize[_0x8691('0x7')](0x4)[_0x8691('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8691('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x8691('0x7')](0x3)[_0x8691('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8691('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8691('0x7')](0x3)[_0x8691('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8691('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8691('0x7')](0x5)[_0x8691('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8691('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x8691('0x7')](0x3)[_0x8691('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8691('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8691('0x7')](0x5)[_0x8691('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8691('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8691('0x7')](0x3)[_0x8691('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8691('0x7')](0x5)[_0x8691('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8691('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8691('0x7')](0x3)[_0x8691('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8691('0xf')},'dialTimezone':{'type':Sequelize[_0x8691('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8691('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x8691('0x3')](_0x8691('0x10'),_0x8691('0x11'),'onlyIfOpen'),'defaultValue':_0x8691('0x10')},'dialAMDActive':{'type':Sequelize[_0x8691('0x5')],'defaultValue':0x0,'comment':_0x8691('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x8691('0x7')](0x9)[_0x8691('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x8691('0x7')](0x9)[_0x8691('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8691('0x7')](0x9)[_0x8691('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8691('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8691('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x8691('0x7')](0x9)[_0x8691('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x8691('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8691('0x14')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x8691('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8691('0x15')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8691('0x7')](0x5)[_0x8691('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8691('0x7')](0x9)[_0x8691('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x8691('0x3')](_0x8691('0x16'),_0x8691('0x17')),'defaultValue':_0x8691('0x16')},'dialPrefix':{'type':Sequelize[_0x8691('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8691('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8691('0x18')},'dialCutDigit':{'type':Sequelize[_0x8691('0x7')](0x3)[_0x8691('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8691('0x7')](0x3)[_0x8691('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8691('0x19')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8691('0x7')](0x5)[_0x8691('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8691('0x1a')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8691('0x1b')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8691('0x7')](0x3)[_0x8691('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8691('0x1c')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8691('0x7')](0x5)[_0x8691('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8691('0x1d')},'dialMachineMaxRetry':{'type':Sequelize[_0x8691('0x7')](0x3)[_0x8691('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x8691('0x7')](0x5)[_0x8691('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8691('0x7')](0x3)[_0x8691('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8691('0x1e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8691('0x7')](0x5)[_0x8691('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x6599=['#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','never','Active/Disactive\x20AMD','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6599,0x16e));var _0x9659=function(_0x208d75,_0x92d742){_0x208d75=_0x208d75-0x0;var _0x382d27=_0x6599[_0x208d75];return _0x382d27;};'use strict';var Sequelize=require(_0x9659('0x0'));module[_0x9659('0x1')]={'name':{'type':Sequelize[_0x9659('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x9659('0x3')),'allowNull':![],'defaultValue':_0x9659('0x3')},'description':{'type':Sequelize[_0x9659('0x2')]},'active':{'type':Sequelize[_0x9659('0x4')],'defaultValue':0x0,'comment':_0x9659('0x5')},'limitCalls':{'type':Sequelize[_0x9659('0x6')](0x4)[_0x9659('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9659('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x9659('0x6')](0x3)[_0x9659('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9659('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9659('0x6')](0x3)[_0x9659('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9659('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9659('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x9659('0x6')](0x3)[_0x9659('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9659('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9659('0x6')](0x5)[_0x9659('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9659('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9659('0x6')](0x3)[_0x9659('0x7')],'defaultValue':0x3,'comment':_0x9659('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9659('0x6')](0x5)[_0x9659('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9659('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9659('0x6')](0x3)[_0x9659('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9659('0xe')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9659('0x2')],'defaultValue':_0x9659('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x9659('0x10')]('always',_0x9659('0x11'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x9659('0x4')],'defaultValue':0x0,'comment':_0x9659('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x9659('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x9659('0x6')](0x9)[_0x9659('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9659('0x6')](0x9)[_0x9659('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9659('0x6')](0x9)[_0x9659('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9659('0x13')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9659('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9659('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9659('0x6')](0x9)[_0x9659('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9659('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x9659('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9659('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9659('0x6')](0x5)[_0x9659('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9659('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9659('0x6')](0x9)[_0x9659('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9659('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9659('0x10')](_0x9659('0x19'),_0x9659('0x1a')),'defaultValue':_0x9659('0x19')},'dialPrefix':{'type':Sequelize[_0x9659('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9659('0x6')](0x3)[_0x9659('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9659('0x1b')},'dialCutDigit':{'type':Sequelize[_0x9659('0x6')](0x3)[_0x9659('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9659('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9659('0x6')](0x3)[_0x9659('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9659('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9659('0x6')](0x5)[_0x9659('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9659('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9659('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x9659('0x6')](0x5)[_0x9659('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9659('0x6')](0x3)[_0x9659('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9659('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9659('0x6')](0x5)[_0x9659('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9659('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x9659('0x6')](0x3)[_0x9659('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9659('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9659('0x6')](0x5)[_0x9659('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9659('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9659('0x6')](0x5)[_0x9659('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9659('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 6bada14..77159b1 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 _0xae20=['IvrCampaigns','UserProfileResource','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','hasOwnProperty','order','sort','where','pick','filter','merge','options','Campaign','includeAll','include','findAll','catch','show','params','fields','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','UserProfileSection','find','getHoppers','findOne','CmHopper','nolimit','CampaignId','getHopperHistories','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','ContactId','ListId','createdAt','field','scheduledAt','CmListId','toString','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','select','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','from','onlyIfOpen','into','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','apply','reject','save','update','destroy','get'];(function(_0x151e67,_0x41cca0){var _0x8dc7c7=function(_0x68515c){while(--_0x68515c){_0x151e67['push'](_0x151e67['shift']());}};_0x8dc7c7(++_0x41cca0);}(_0xae20,0xea));var _0x0ae2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xae20[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x0ae2('0x0'));var rimraf=require(_0x0ae2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ae2('0x2'));var rp=require(_0x0ae2('0x3'));var moment=require(_0x0ae2('0x4'));var BPromise=require(_0x0ae2('0x5'));var Mustache=require(_0x0ae2('0x6'));var util=require(_0x0ae2('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x0ae2('0x8'));var ejs=require(_0x0ae2('0x9'));var fs=require('fs');var fs_extra=require(_0x0ae2('0xa'));var _=require('lodash');var squel=require(_0x0ae2('0xb'));var crypto=require(_0x0ae2('0xc'));var jsforce=require(_0x0ae2('0xd'));var deskjs=require(_0x0ae2('0xe'));var toCsv=require(_0x0ae2('0x8'));var querystring=require(_0x0ae2('0xf'));var Papa=require(_0x0ae2('0x10'));var Redis=require(_0x0ae2('0x11'));var authService=require(_0x0ae2('0x12'));var qs=require(_0x0ae2('0x13'));var as=require(_0x0ae2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ae2('0x15'))('api');var utils=require(_0x0ae2('0x16'));var config=require(_0x0ae2('0x17'));var licenseUtil=require(_0x0ae2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54578d,_0x50a02e){_0x50a02e=_0x50a02e||0xcc;return function(_0x146c76){if(_0x146c76){return _0x54578d[_0x0ae2('0x19')](_0x50a02e);}return _0x54578d[_0x0ae2('0x1a')](_0x50a02e)['end']();};}function respondWithResult(_0x3f1a7d,_0x20ccfd){_0x20ccfd=_0x20ccfd||0xc8;return function(_0x21a1af){if(_0x21a1af){return _0x3f1a7d[_0x0ae2('0x1a')](_0x20ccfd)[_0x0ae2('0x1b')](_0x21a1af);}};}function respondWithFilteredResult(_0x5777e6,_0x5452cb){return function(_0x558a8f){if(_0x558a8f){var _0x240787=typeof _0x5452cb[_0x0ae2('0x1c')]==='undefined'&&typeof _0x5452cb[_0x0ae2('0x1d')]==='undefined';var _0x1dfa4f=_0x558a8f[_0x0ae2('0x1e')];var _0x368fff=_0x240787?0x0:_0x5452cb[_0x0ae2('0x1c')];var _0x2a12ac=_0x240787?_0x558a8f[_0x0ae2('0x1e')]:_0x5452cb[_0x0ae2('0x1c')]+_0x5452cb[_0x0ae2('0x1d')];var _0x1036e5;if(_0x2a12ac>=_0x1dfa4f){_0x2a12ac=_0x1dfa4f;_0x1036e5=0xc8;}else{_0x1036e5=0xce;}_0x5777e6[_0x0ae2('0x1a')](_0x1036e5);return _0x5777e6[_0x0ae2('0x1f')]('Content-Range',_0x368fff+'-'+_0x2a12ac+'/'+_0x1dfa4f)[_0x0ae2('0x1b')](_0x558a8f);}return null;};}function patchUpdates(_0x51cb67){return function(_0x3cdefe){try{jsonpatch[_0x0ae2('0x20')](_0x3cdefe,_0x51cb67,!![]);}catch(_0x38b119){return BPromise[_0x0ae2('0x21')](_0x38b119);}return _0x3cdefe[_0x0ae2('0x22')]();};}function saveUpdates(_0x1534c8,_0xa78782){return function(_0x3db830){if(_0x3db830){return _0x3db830[_0x0ae2('0x23')](_0x1534c8)['then'](function(_0x8e1ba0){return _0x8e1ba0;});}return null;};}function removeEntity(_0x28112d,_0x2933de){return function(_0x2e05d3){if(_0x2e05d3){return _0x2e05d3[_0x0ae2('0x24')]()['then'](function(){var _0x48509b=_0x2e05d3[_0x0ae2('0x25')]({'plain':!![]});var _0x30f6f6=_0x0ae2('0x26');return db[_0x0ae2('0x27')][_0x0ae2('0x24')]({'where':{'type':_0x30f6f6,'resourceId':_0x48509b['id']}})['then'](function(){return _0x2e05d3;});})[_0x0ae2('0x28')](function(){_0x28112d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aa0df,_0x26b449){return function(_0x33094d){if(!_0x33094d){_0x1aa0df['sendStatus'](0x194);}return _0x33094d;};}function handleError(_0x422df4,_0xfe905d){_0xfe905d=_0xfe905d||0x1f4;return function(_0xfd7236){logger[_0x0ae2('0x29')](_0xfd7236[_0x0ae2('0x2a')]);if(_0xfd7236[_0x0ae2('0x2b')]){delete _0xfd7236['name'];}_0x422df4[_0x0ae2('0x1a')](_0xfe905d)['send'](_0xfd7236);};}exports[_0x0ae2('0x2c')]=function(_0x6a8830,_0x5b59d0){var _0x31bd70={},_0x2c033a={},_0x289d3b={'count':0x0,'rows':[]};var _0x5963fc=_[_0x0ae2('0x2d')](db['Campaign'][_0x0ae2('0x2e')],function(_0x37cad0){return{'name':_0x37cad0[_0x0ae2('0x2f')],'type':_0x37cad0[_0x0ae2('0x30')][_0x0ae2('0x31')]};});_0x2c033a[_0x0ae2('0x32')]=_[_0x0ae2('0x2d')](_0x5963fc,_0x0ae2('0x2b'));_0x2c033a['query']=_[_0x0ae2('0x33')](_0x6a8830[_0x0ae2('0x34')]);_0x2c033a[_0x0ae2('0x35')]=_['intersection'](_0x2c033a[_0x0ae2('0x32')],_0x2c033a[_0x0ae2('0x34')]);_0x31bd70[_0x0ae2('0x36')]=_[_0x0ae2('0x37')](_0x2c033a['model'],qs['fields'](_0x6a8830['query']['fields']));_0x31bd70['attributes']=_0x31bd70[_0x0ae2('0x36')]['length']?_0x31bd70[_0x0ae2('0x36')]:_0x2c033a[_0x0ae2('0x32')];if(!_0x6a8830[_0x0ae2('0x34')][_0x0ae2('0x38')]('nolimit')){_0x31bd70[_0x0ae2('0x1d')]=qs[_0x0ae2('0x1d')](_0x6a8830[_0x0ae2('0x34')][_0x0ae2('0x1d')]);_0x31bd70[_0x0ae2('0x1c')]=qs['offset'](_0x6a8830[_0x0ae2('0x34')][_0x0ae2('0x1c')]);}_0x31bd70[_0x0ae2('0x39')]=qs[_0x0ae2('0x3a')](_0x6a8830[_0x0ae2('0x34')][_0x0ae2('0x3a')]);_0x31bd70[_0x0ae2('0x3b')]=qs['filters'](_[_0x0ae2('0x3c')](_0x6a8830[_0x0ae2('0x34')],_0x2c033a[_0x0ae2('0x35')]),_0x5963fc);if(_0x6a8830['query'][_0x0ae2('0x3d')]){_0x31bd70[_0x0ae2('0x3b')]=_[_0x0ae2('0x3e')](_0x31bd70[_0x0ae2('0x3b')],{'$or':_['map'](_0x5963fc,function(_0x39e5fd){if(_0x39e5fd[_0x0ae2('0x30')]!=='VIRTUAL'){var _0x1556e1={};_0x1556e1[_0x39e5fd[_0x0ae2('0x2b')]]={'$like':'%'+_0x6a8830[_0x0ae2('0x34')][_0x0ae2('0x3d')]+'%'};return _0x1556e1;}})});}_0x31bd70=_[_0x0ae2('0x3e')]({},_0x31bd70,_0x6a8830[_0x0ae2('0x3f')]);var _0x3014cd={'where':_0x31bd70[_0x0ae2('0x3b')]};return db[_0x0ae2('0x40')][_0x0ae2('0x1e')](_0x3014cd)['then'](function(_0x3851e5){_0x289d3b[_0x0ae2('0x1e')]=_0x3851e5;if(_0x6a8830[_0x0ae2('0x34')][_0x0ae2('0x41')]){_0x31bd70[_0x0ae2('0x42')]=[{'all':!![]}];}return db[_0x0ae2('0x40')][_0x0ae2('0x43')](_0x31bd70);})[_0x0ae2('0x28')](function(_0x18af12){_0x289d3b['rows']=_0x18af12;return _0x289d3b;})[_0x0ae2('0x28')](respondWithFilteredResult(_0x5b59d0,_0x31bd70))[_0x0ae2('0x44')](handleError(_0x5b59d0,null));};exports[_0x0ae2('0x45')]=function(_0x46c8ea,_0x39a28c){var _0x5a28ed={'raw':![],'where':{'id':_0x46c8ea[_0x0ae2('0x46')]['id']}},_0x50e3fc={};_0x50e3fc[_0x0ae2('0x32')]=_[_0x0ae2('0x33')](db[_0x0ae2('0x40')][_0x0ae2('0x2e')]);_0x50e3fc[_0x0ae2('0x34')]=_[_0x0ae2('0x33')](_0x46c8ea[_0x0ae2('0x34')]);_0x50e3fc[_0x0ae2('0x35')]=_[_0x0ae2('0x37')](_0x50e3fc[_0x0ae2('0x32')],_0x50e3fc['query']);_0x5a28ed[_0x0ae2('0x36')]=_['intersection'](_0x50e3fc[_0x0ae2('0x32')],qs[_0x0ae2('0x47')](_0x46c8ea[_0x0ae2('0x34')][_0x0ae2('0x47')]));_0x5a28ed[_0x0ae2('0x36')]=_0x5a28ed[_0x0ae2('0x36')][_0x0ae2('0x48')]?_0x5a28ed[_0x0ae2('0x36')]:_0x50e3fc['model'];if(_0x46c8ea[_0x0ae2('0x34')][_0x0ae2('0x41')]){_0x5a28ed[_0x0ae2('0x42')]=[{'all':!![]}];}_0x5a28ed=_[_0x0ae2('0x3e')]({},_0x5a28ed,_0x46c8ea[_0x0ae2('0x3f')]);return db[_0x0ae2('0x40')]['find'](_0x5a28ed)['then'](handleEntityNotFound(_0x39a28c,null))[_0x0ae2('0x28')](respondWithResult(_0x39a28c,null))['catch'](handleError(_0x39a28c,null));};exports['create']=function(_0x2e9357,_0x34feb1){return db['Campaign'][_0x0ae2('0x49')](_0x2e9357['body'],{})[_0x0ae2('0x28')](function(_0x386ebc){var _0x5663ac=_0x2e9357['user'][_0x0ae2('0x25')]({'plain':!![]});if(!_0x5663ac)throw new Error(_0x0ae2('0x4a'));if(_0x5663ac[_0x0ae2('0x4b')]===_0x0ae2('0x4c')){var _0x235de1=_0x386ebc[_0x0ae2('0x25')]({'plain':!![]});var _0x1a9240=_0x0ae2('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x1a9240,'userProfileId':_0x5663ac[_0x0ae2('0x4d')]},'raw':!![]})['then'](function(_0x3d8331){if(_0x3d8331&&_0x3d8331[_0x0ae2('0x4e')]===0x0){return db[_0x0ae2('0x27')]['create']({'name':_0x235de1[_0x0ae2('0x2b')],'resourceId':_0x235de1['id'],'type':_0x3d8331[_0x0ae2('0x2b')],'sectionId':_0x3d8331['id']},{})['then'](function(){return _0x386ebc;});}else{return _0x386ebc;}})['catch'](function(_0x1d744f){logger[_0x0ae2('0x29')](_0x0ae2('0x4f'),_0x1d744f);throw _0x1d744f;});}return _0x386ebc;})[_0x0ae2('0x28')](respondWithResult(_0x34feb1,0xc9))['catch'](handleError(_0x34feb1,null));};exports[_0x0ae2('0x50')]=function(_0x3e1fee,_0x356b4a){var _0x2bb93e={'where':{'id':_0x3e1fee[_0x0ae2('0x46')]['id']}},_0x12795f={};_0x12795f[_0x0ae2('0x32')]=_['keys'](db[_0x0ae2('0x40')][_0x0ae2('0x2e')]);_0x2bb93e['attributes']=_[_0x0ae2('0x37')](_0x12795f['model'],qs[_0x0ae2('0x47')](_0x3e1fee[_0x0ae2('0x34')][_0x0ae2('0x47')]));_0x2bb93e[_0x0ae2('0x36')]=_0x2bb93e[_0x0ae2('0x36')][_0x0ae2('0x48')]?_0x2bb93e[_0x0ae2('0x36')]:_0x12795f[_0x0ae2('0x32')];if(_0x3e1fee['query'][_0x0ae2('0x41')]){_0x2bb93e['include']=[{'all':!![]}];}_0x2bb93e=_[_0x0ae2('0x3e')]({},_0x2bb93e,_0x3e1fee[_0x0ae2('0x3f')]);return db['Campaign']['find'](_0x2bb93e)[_0x0ae2('0x28')](handleEntityNotFound(_0x356b4a,null))[_0x0ae2('0x28')](function(_0x2183fe){if(_0x2183fe){var _0x588b27=_0x2183fe['get']({'plain':!![]});_0x588b27=qs[_0x0ae2('0x51')](_0x588b27,['id','createdAt',_0x0ae2('0x52')]);_0x3e1fee['body']=_['omit'](_0x3e1fee[_0x0ae2('0x53')],['id','createdAt',_0x0ae2('0x52')]);return db['Campaign']['create'](_[_0x0ae2('0x3e')](_0x588b27,_0x3e1fee[_0x0ae2('0x53')]),{'include':_0x3e1fee['query'][_0x0ae2('0x41')]?[{'all':!![]}]:undefined})[_0x0ae2('0x28')](function(_0x31c6b7){var _0x45b655=_0x3e1fee['user']['get']({'plain':!![]});if(!_0x45b655)throw new Error(_0x0ae2('0x4a'));if(_0x45b655[_0x0ae2('0x4b')]===_0x0ae2('0x4c')){var _0x305c02=_0x31c6b7[_0x0ae2('0x25')]({'plain':!![]});var _0x3883d8=_0x0ae2('0x26');return db[_0x0ae2('0x54')][_0x0ae2('0x55')]({'where':{'name':_0x3883d8,'userProfileId':_0x45b655['userProfileId']},'raw':!![]})[_0x0ae2('0x28')](function(_0x4e721e){if(_0x4e721e&&_0x4e721e['autoAssociation']===0x0){return db[_0x0ae2('0x27')][_0x0ae2('0x49')]({'name':_0x305c02['name'],'resourceId':_0x305c02['id'],'type':_0x4e721e[_0x0ae2('0x2b')],'sectionId':_0x4e721e['id']},{})[_0x0ae2('0x28')](function(){return _0x31c6b7;});}else{return _0x31c6b7;}})[_0x0ae2('0x44')](function(_0x3bfa2e){logger[_0x0ae2('0x29')](_0x0ae2('0x4f'),_0x3bfa2e);throw _0x3bfa2e;});}return _0x31c6b7;});}})[_0x0ae2('0x28')](respondWithResult(_0x356b4a,0xc9))['catch'](handleError(_0x356b4a,null));};exports[_0x0ae2('0x23')]=function(_0x518b60,_0x19cb4c){if(_0x518b60[_0x0ae2('0x53')]['id']){delete _0x518b60[_0x0ae2('0x53')]['id'];}return db['Campaign'][_0x0ae2('0x55')]({'where':{'id':_0x518b60['params']['id']}})[_0x0ae2('0x28')](handleEntityNotFound(_0x19cb4c,null))[_0x0ae2('0x28')](saveUpdates(_0x518b60[_0x0ae2('0x53')],null))[_0x0ae2('0x28')](respondWithResult(_0x19cb4c,null))[_0x0ae2('0x44')](handleError(_0x19cb4c,null));};exports[_0x0ae2('0x24')]=function(_0x2a2675,_0x235cd6){return db[_0x0ae2('0x40')][_0x0ae2('0x55')]({'where':{'id':_0x2a2675[_0x0ae2('0x46')]['id']}})[_0x0ae2('0x28')](handleEntityNotFound(_0x235cd6,null))[_0x0ae2('0x28')](removeEntity(_0x235cd6,null))['catch'](handleError(_0x235cd6,null));};exports[_0x0ae2('0x56')]=function(_0x492e60,_0x1e4af4,_0x1e1558){var _0x266cb9={'raw':!![],'where':{}};var _0xade6b0={};var _0x50ac56={'count':0x0,'rows':[]};return db[_0x0ae2('0x40')][_0x0ae2('0x57')]({'where':{'id':_0x492e60[_0x0ae2('0x46')]['id']}})['then'](handleEntityNotFound(_0x1e4af4,null))[_0x0ae2('0x28')](function(_0x405660){if(_0x405660){_0xade6b0[_0x0ae2('0x32')]=_[_0x0ae2('0x33')](db[_0x0ae2('0x58')][_0x0ae2('0x2e')]);_0xade6b0[_0x0ae2('0x34')]=_[_0x0ae2('0x33')](_0x492e60['query']);_0xade6b0[_0x0ae2('0x35')]=_[_0x0ae2('0x37')](_0xade6b0['model'],_0xade6b0[_0x0ae2('0x34')]);_0x266cb9['attributes']=_['intersection'](_0xade6b0[_0x0ae2('0x32')],qs['fields'](_0x492e60['query']['fields']));_0x266cb9['attributes']=_0x266cb9[_0x0ae2('0x36')][_0x0ae2('0x48')]?_0x266cb9[_0x0ae2('0x36')]:_0xade6b0[_0x0ae2('0x32')];if(!_0x492e60[_0x0ae2('0x34')]['hasOwnProperty'](_0x0ae2('0x59'))){_0x266cb9[_0x0ae2('0x1d')]=qs[_0x0ae2('0x1d')](_0x492e60[_0x0ae2('0x34')][_0x0ae2('0x1d')]);_0x266cb9['offset']=qs['offset'](_0x492e60['query'][_0x0ae2('0x1c')]);}_0x266cb9[_0x0ae2('0x39')]=qs['sort'](_0x492e60[_0x0ae2('0x34')][_0x0ae2('0x3a')]);_0x266cb9[_0x0ae2('0x3b')]=qs[_0x0ae2('0x35')](_[_0x0ae2('0x3c')](_0x492e60[_0x0ae2('0x34')],_0xade6b0[_0x0ae2('0x35')]));_0x266cb9['where'][_0x0ae2('0x5a')]=_0x405660['id'];if(_0x492e60[_0x0ae2('0x34')][_0x0ae2('0x3d')]){_0x266cb9[_0x0ae2('0x3b')]=_[_0x0ae2('0x3e')](_0x266cb9[_0x0ae2('0x3b')],{'$or':_[_0x0ae2('0x2d')](_0x266cb9[_0x0ae2('0x36')],function(_0x39ec80){var _0x1c4099={};_0x1c4099[_0x39ec80]={'$like':'%'+_0x492e60[_0x0ae2('0x34')][_0x0ae2('0x3d')]+'%'};return _0x1c4099;})});}_0x266cb9=_[_0x0ae2('0x3e')]({},_0x266cb9,_0x492e60[_0x0ae2('0x3f')]);return db[_0x0ae2('0x58')]['count']({'where':_0x266cb9[_0x0ae2('0x3b')]})[_0x0ae2('0x28')](function(_0x2ec229){_0x50ac56[_0x0ae2('0x1e')]=_0x2ec229;if(_0x492e60['query']['includeAll']){_0x266cb9[_0x0ae2('0x42')]=[{'all':!![]}];}return db[_0x0ae2('0x58')][_0x0ae2('0x43')](_0x266cb9);})[_0x0ae2('0x28')](function(_0x137734){_0x50ac56['rows']=_0x137734;return _0x50ac56;});}})[_0x0ae2('0x28')](respondWithFilteredResult(_0x1e4af4,_0x266cb9))[_0x0ae2('0x44')](handleError(_0x1e4af4,null));};exports[_0x0ae2('0x5b')]=function(_0x4d6912,_0x377663,_0x275bc6){var _0x40cd17={'raw':!![],'where':{}};var _0x14116f={};var _0x46ea44={'count':0x0,'rows':[]};return db[_0x0ae2('0x40')][_0x0ae2('0x57')]({'where':{'id':_0x4d6912[_0x0ae2('0x46')]['id']}})[_0x0ae2('0x28')](handleEntityNotFound(_0x377663,null))[_0x0ae2('0x28')](function(_0x4ad8e9){if(_0x4ad8e9){_0x14116f[_0x0ae2('0x32')]=_['keys'](db['CmHopperHistory'][_0x0ae2('0x2e')]);_0x14116f[_0x0ae2('0x34')]=_[_0x0ae2('0x33')](_0x4d6912[_0x0ae2('0x34')]);_0x14116f[_0x0ae2('0x35')]=_['intersection'](_0x14116f[_0x0ae2('0x32')],_0x14116f[_0x0ae2('0x34')]);_0x40cd17[_0x0ae2('0x36')]=_[_0x0ae2('0x37')](_0x14116f[_0x0ae2('0x32')],qs[_0x0ae2('0x47')](_0x4d6912[_0x0ae2('0x34')][_0x0ae2('0x47')]));_0x40cd17['attributes']=_0x40cd17[_0x0ae2('0x36')][_0x0ae2('0x48')]?_0x40cd17['attributes']:_0x14116f['model'];if(!_0x4d6912[_0x0ae2('0x34')][_0x0ae2('0x38')](_0x0ae2('0x59'))){_0x40cd17[_0x0ae2('0x1d')]=qs['limit'](_0x4d6912[_0x0ae2('0x34')][_0x0ae2('0x1d')]);_0x40cd17['offset']=qs['offset'](_0x4d6912[_0x0ae2('0x34')][_0x0ae2('0x1c')]);}_0x40cd17[_0x0ae2('0x39')]=qs[_0x0ae2('0x3a')](_0x4d6912[_0x0ae2('0x34')][_0x0ae2('0x3a')]);_0x40cd17['where']=qs[_0x0ae2('0x35')](_['pick'](_0x4d6912[_0x0ae2('0x34')],_0x14116f['filters']));_0x40cd17[_0x0ae2('0x3b')][_0x0ae2('0x5a')]=_0x4ad8e9['id'];if(_0x4d6912[_0x0ae2('0x34')][_0x0ae2('0x3d')]){_0x40cd17['where']=_['merge'](_0x40cd17['where'],{'$or':_['map'](_0x40cd17['attributes'],function(_0x1d615d){var _0x440454={};_0x440454[_0x1d615d]={'$like':'%'+_0x4d6912[_0x0ae2('0x34')][_0x0ae2('0x3d')]+'%'};return _0x440454;})});}_0x40cd17=_['merge']({},_0x40cd17,_0x4d6912[_0x0ae2('0x3f')]);return db[_0x0ae2('0x5c')]['count']({'where':_0x40cd17['where']})['then'](function(_0x434244){_0x46ea44[_0x0ae2('0x1e')]=_0x434244;if(_0x4d6912['query'][_0x0ae2('0x41')]){_0x40cd17[_0x0ae2('0x42')]=[{'all':!![]}];}return db[_0x0ae2('0x5c')][_0x0ae2('0x43')](_0x40cd17);})['then'](function(_0x47b992){_0x46ea44[_0x0ae2('0x5d')]=_0x47b992;return _0x46ea44;});}})[_0x0ae2('0x28')](respondWithFilteredResult(_0x377663,_0x40cd17))['catch'](handleError(_0x377663,null));};exports[_0x0ae2('0x5e')]=function(_0x31cb76,_0x19bc38,_0x4489de){var _0x172fde={'raw':!![],'where':{}};var _0x4d2bbb={};var _0x4a8bae={'count':0x0,'rows':[]};return db[_0x0ae2('0x40')]['findOne']({'where':{'id':_0x31cb76['params']['id']}})[_0x0ae2('0x28')](handleEntityNotFound(_0x19bc38,null))[_0x0ae2('0x28')](function(_0x282be1){if(_0x282be1){_0x4d2bbb['model']=_[_0x0ae2('0x33')](db[_0x0ae2('0x5f')][_0x0ae2('0x2e')]);_0x4d2bbb['query']=_[_0x0ae2('0x33')](_0x31cb76[_0x0ae2('0x34')]);_0x4d2bbb[_0x0ae2('0x35')]=_[_0x0ae2('0x37')](_0x4d2bbb['model'],_0x4d2bbb[_0x0ae2('0x34')]);_0x172fde['attributes']=_[_0x0ae2('0x37')](_0x4d2bbb[_0x0ae2('0x32')],qs[_0x0ae2('0x47')](_0x31cb76[_0x0ae2('0x34')][_0x0ae2('0x47')]));_0x172fde[_0x0ae2('0x36')]=_0x172fde[_0x0ae2('0x36')][_0x0ae2('0x48')]?_0x172fde[_0x0ae2('0x36')]:_0x4d2bbb[_0x0ae2('0x32')];if(!_0x31cb76['query'][_0x0ae2('0x38')]('nolimit')){_0x172fde[_0x0ae2('0x1d')]=qs[_0x0ae2('0x1d')](_0x31cb76['query']['limit']);_0x172fde[_0x0ae2('0x1c')]=qs['offset'](_0x31cb76[_0x0ae2('0x34')][_0x0ae2('0x1c')]);}_0x172fde[_0x0ae2('0x39')]=qs[_0x0ae2('0x3a')](_0x31cb76[_0x0ae2('0x34')][_0x0ae2('0x3a')]);_0x172fde['where']=qs[_0x0ae2('0x35')](_[_0x0ae2('0x3c')](_0x31cb76[_0x0ae2('0x34')],_0x4d2bbb[_0x0ae2('0x35')]));_0x172fde[_0x0ae2('0x3b')][_0x0ae2('0x5a')]=_0x282be1['id'];if(_0x31cb76['query'][_0x0ae2('0x3d')]){_0x172fde[_0x0ae2('0x3b')]=_[_0x0ae2('0x3e')](_0x172fde['where'],{'$or':_[_0x0ae2('0x2d')](_0x172fde[_0x0ae2('0x36')],function(_0x5d7a68){var _0x3c77f7={};_0x3c77f7[_0x5d7a68]={'$like':'%'+_0x31cb76['query'][_0x0ae2('0x3d')]+'%'};return _0x3c77f7;})});}_0x172fde=_[_0x0ae2('0x3e')]({},_0x172fde,_0x31cb76['options']);return db[_0x0ae2('0x5f')][_0x0ae2('0x1e')]({'where':_0x172fde[_0x0ae2('0x3b')]})[_0x0ae2('0x28')](function(_0x838a9a){_0x4a8bae['count']=_0x838a9a;if(_0x31cb76[_0x0ae2('0x34')]['includeAll']){_0x172fde[_0x0ae2('0x42')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x0ae2('0x43')](_0x172fde);})['then'](function(_0x3bd9af){_0x4a8bae[_0x0ae2('0x5d')]=_0x3bd9af;return _0x4a8bae;});}})['then'](respondWithFilteredResult(_0x19bc38,_0x172fde))[_0x0ae2('0x44')](handleError(_0x19bc38,null));};exports[_0x0ae2('0x60')]=function(_0x351f2d,_0x29b9fc,_0x6333dc){var _0x370a34={'raw':!![],'where':{}};var _0x49c2c0={};var _0x17f0e7={'count':0x0,'rows':[]};return db[_0x0ae2('0x40')][_0x0ae2('0x57')]({'where':{'id':_0x351f2d['params']['id']}})[_0x0ae2('0x28')](handleEntityNotFound(_0x29b9fc,null))[_0x0ae2('0x28')](function(_0x44bf94){if(_0x44bf94){_0x49c2c0[_0x0ae2('0x32')]=_['keys'](db[_0x0ae2('0x61')][_0x0ae2('0x2e')]);_0x49c2c0[_0x0ae2('0x34')]=_['keys'](_0x351f2d[_0x0ae2('0x34')]);_0x49c2c0[_0x0ae2('0x35')]=_['intersection'](_0x49c2c0[_0x0ae2('0x32')],_0x49c2c0[_0x0ae2('0x34')]);_0x370a34[_0x0ae2('0x36')]=_[_0x0ae2('0x37')](_0x49c2c0['model'],qs[_0x0ae2('0x47')](_0x351f2d[_0x0ae2('0x34')][_0x0ae2('0x47')]));_0x370a34[_0x0ae2('0x36')]=_0x370a34['attributes']['length']?_0x370a34[_0x0ae2('0x36')]:_0x49c2c0['model'];if(!_0x351f2d[_0x0ae2('0x34')]['hasOwnProperty']('nolimit')){_0x370a34['limit']=qs[_0x0ae2('0x1d')](_0x351f2d['query'][_0x0ae2('0x1d')]);_0x370a34['offset']=qs['offset'](_0x351f2d[_0x0ae2('0x34')][_0x0ae2('0x1c')]);}_0x370a34['order']=qs[_0x0ae2('0x3a')](_0x351f2d[_0x0ae2('0x34')][_0x0ae2('0x3a')]);_0x370a34[_0x0ae2('0x3b')]=qs['filters'](_[_0x0ae2('0x3c')](_0x351f2d['query'],_0x49c2c0[_0x0ae2('0x35')]));_0x370a34[_0x0ae2('0x3b')][_0x0ae2('0x5a')]=_0x44bf94['id'];if(_0x351f2d[_0x0ae2('0x34')]['filter']){_0x370a34['where']=_[_0x0ae2('0x3e')](_0x370a34['where'],{'$or':_['map'](_0x370a34[_0x0ae2('0x36')],function(_0xbf1327){var _0x579fc9={};_0x579fc9[_0xbf1327]={'$like':'%'+_0x351f2d['query']['filter']+'%'};return _0x579fc9;})});}_0x370a34=_[_0x0ae2('0x3e')]({},_0x370a34,_0x351f2d[_0x0ae2('0x3f')]);return db[_0x0ae2('0x61')][_0x0ae2('0x1e')]({'where':_0x370a34[_0x0ae2('0x3b')]})[_0x0ae2('0x28')](function(_0x18c78d){_0x17f0e7['count']=_0x18c78d;if(_0x351f2d[_0x0ae2('0x34')]['includeAll']){_0x370a34['include']=[{'all':!![]}];}return db[_0x0ae2('0x61')][_0x0ae2('0x43')](_0x370a34);})['then'](function(_0x1ddbc3){_0x17f0e7[_0x0ae2('0x5d')]=_0x1ddbc3;return _0x17f0e7;});}})[_0x0ae2('0x28')](respondWithFilteredResult(_0x29b9fc,_0x370a34))['catch'](handleError(_0x29b9fc,null));};exports['getLists']=function(_0x163f4d,_0x3bf6a2,_0x2186ef){var _0x4f5141={};var _0x4f5e9e={};var _0x3ad153;var _0x3cd4d8;return db['Campaign'][_0x0ae2('0x57')]({'where':{'id':_0x163f4d[_0x0ae2('0x46')]['id']}})[_0x0ae2('0x28')](handleEntityNotFound(_0x3bf6a2,null))['then'](function(_0x1747f3){if(_0x1747f3){_0x3ad153=_0x1747f3;_0x4f5e9e[_0x0ae2('0x32')]=_[_0x0ae2('0x33')](db[_0x0ae2('0x62')]['rawAttributes']);_0x4f5e9e[_0x0ae2('0x34')]=_['keys'](_0x163f4d['query']);_0x4f5e9e[_0x0ae2('0x35')]=_[_0x0ae2('0x37')](_0x4f5e9e[_0x0ae2('0x32')],_0x4f5e9e[_0x0ae2('0x34')]);_0x4f5141[_0x0ae2('0x36')]=_[_0x0ae2('0x37')](_0x4f5e9e[_0x0ae2('0x32')],qs[_0x0ae2('0x47')](_0x163f4d[_0x0ae2('0x34')][_0x0ae2('0x47')]));_0x4f5141[_0x0ae2('0x36')]=_0x4f5141['attributes']['length']?_0x4f5141[_0x0ae2('0x36')]:_0x4f5e9e[_0x0ae2('0x32')];_0x4f5141[_0x0ae2('0x39')]=qs[_0x0ae2('0x3a')](_0x163f4d[_0x0ae2('0x34')][_0x0ae2('0x3a')]);_0x4f5141['where']=qs[_0x0ae2('0x35')](_[_0x0ae2('0x3c')](_0x163f4d[_0x0ae2('0x34')],_0x4f5e9e[_0x0ae2('0x35')]));if(_0x163f4d[_0x0ae2('0x34')]['filter']){_0x4f5141[_0x0ae2('0x3b')]=_[_0x0ae2('0x3e')](_0x4f5141[_0x0ae2('0x3b')],{'$or':_[_0x0ae2('0x2d')](_0x4f5141[_0x0ae2('0x36')],function(_0x3e6b78){var _0x472c06={};_0x472c06[_0x3e6b78]={'$like':'%'+_0x163f4d[_0x0ae2('0x34')][_0x0ae2('0x3d')]+'%'};return _0x472c06;})});}_0x4f5141=_['merge']({},_0x4f5141,_0x163f4d[_0x0ae2('0x3f')]);return _0x3ad153[_0x0ae2('0x63')](_0x4f5141);}})['then'](function(_0x121b78){if(_0x121b78){_0x3cd4d8=_0x121b78[_0x0ae2('0x48')];if(!_0x163f4d['query']['hasOwnProperty'](_0x0ae2('0x59'))){_0x4f5141[_0x0ae2('0x1d')]=qs[_0x0ae2('0x1d')](_0x163f4d[_0x0ae2('0x34')]['limit']);_0x4f5141[_0x0ae2('0x1c')]=qs[_0x0ae2('0x1c')](_0x163f4d['query'][_0x0ae2('0x1c')]);}return _0x3ad153['getLists'](_0x4f5141);}})[_0x0ae2('0x28')](function(_0x5d357d){if(_0x5d357d){return _0x5d357d?{'count':_0x3cd4d8,'rows':_0x5d357d}:null;}})[_0x0ae2('0x28')](respondWithResult(_0x3bf6a2,null))[_0x0ae2('0x44')](handleError(_0x3bf6a2,null));};exports[_0x0ae2('0x64')]=function(_0x449c17,_0x17336a,_0x47186e){var _0x201c30,_0x3c6fd1;return db[_0x0ae2('0x40')]['find']({'where':{'id':_0x449c17[_0x0ae2('0x46')]['id']}})[_0x0ae2('0x28')](handleEntityNotFound(_0x17336a,null))['then'](function(_0x2203d9){if(_0x2203d9){_0x3c6fd1=_0x2203d9;return _0x2203d9[_0x0ae2('0x64')](_0x449c17['body'][_0x0ae2('0x65')],_['omit'](_0x449c17[_0x0ae2('0x53')],[_0x0ae2('0x65'),'id'])||{});}return null;})[_0x0ae2('0x66')](function(_0x382854){var _0x290af5;_0x201c30=_0x382854||[];var _0xfc1ee1=[];if(_0x382854){for(var _0x339e54=0x0;_0x339e54<_0x382854[_0x0ae2('0x48')];_0x339e54+=0x1){var _0x4faf6e=_0x382854[_0x339e54][_0x0ae2('0x25')]({'plain':!![]});_0x3c6fd1['dialCheckDuplicateType']=_0x449c17[_0x0ae2('0x53')][_0x0ae2('0x67')]?_0x449c17[_0x0ae2('0x53')][_0x0ae2('0x67')]:_0x3c6fd1[_0x0ae2('0x67')];switch(_0x3c6fd1[_0x0ae2('0x67')]){case'always':_0x290af5=squel[_0x0ae2('0x68')]()['into'](_0x0ae2('0x69'))[_0x0ae2('0x6a')]([_0x0ae2('0x6b'),'scheduledAt',_0x0ae2('0x6c'),_0x0ae2('0x6d'),_0x0ae2('0x5a'),_0x0ae2('0x6e'),_0x0ae2('0x52')],squel['select']()[_0x0ae2('0x6f')](_0x0ae2('0x6b'),_0x0ae2('0x6b'))[_0x0ae2('0x6f')]('NOW()',_0x0ae2('0x70'))[_0x0ae2('0x6f')]('id',_0x0ae2('0x6c'))[_0x0ae2('0x6f')](_0x4faf6e[_0x0ae2('0x71')][_0x0ae2('0x72')](),_0x0ae2('0x6d'))[_0x0ae2('0x6f')](_0x449c17['params']['id'][_0x0ae2('0x72')](),_0x0ae2('0x5a'))[_0x0ae2('0x6f')](_0x0ae2('0x73'),_0x0ae2('0x6e'))[_0x0ae2('0x6f')]('NOW()',_0x0ae2('0x52'))['from'](_0x0ae2('0x74'))[_0x0ae2('0x3b')](_0x0ae2('0x75'))['where'](_0x0ae2('0x76'),_0x4faf6e[_0x0ae2('0x71')][_0x0ae2('0x72')]())[_0x0ae2('0x3b')]('phone\x20IS\x20NOT\x20NULL')[_0x0ae2('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0ae2('0x77')]()['field']('COALESCE(calleridnum,\x27\x27)')['from'](_0x0ae2('0x78'))[_0x0ae2('0x3b')](_0x0ae2('0x79'),_0x449c17['params']['id']['toString']()))[_0x0ae2('0x3b')](_0x0ae2('0x7a'),squel['select']()[_0x0ae2('0x6f')](_0x0ae2('0x7b'))[_0x0ae2('0x7c')](_0x0ae2('0x69'))[_0x0ae2('0x3b')](_0x0ae2('0x79'),_0x449c17[_0x0ae2('0x46')]['id']['toString']())))['toString']();break;case _0x0ae2('0x7d'):_0x290af5=squel['insert']()[_0x0ae2('0x7e')]('cm_hopper')[_0x0ae2('0x6a')]([_0x0ae2('0x6b'),_0x0ae2('0x70'),'ContactId','ListId',_0x0ae2('0x5a'),_0x0ae2('0x6e'),_0x0ae2('0x52')],squel[_0x0ae2('0x77')]()[_0x0ae2('0x6f')]('phone',_0x0ae2('0x6b'))[_0x0ae2('0x6f')](_0x0ae2('0x73'),_0x0ae2('0x70'))[_0x0ae2('0x6f')]('id',_0x0ae2('0x6c'))[_0x0ae2('0x6f')](_0x4faf6e[_0x0ae2('0x71')][_0x0ae2('0x72')](),'ListId')['field'](_0x449c17['params']['id'][_0x0ae2('0x72')](),'CampaignId')[_0x0ae2('0x6f')](_0x0ae2('0x73'),_0x0ae2('0x6e'))['field'](_0x0ae2('0x73'),'updatedAt')['from'](_0x0ae2('0x74'))['where'](_0x0ae2('0x75'))[_0x0ae2('0x3b')](_0x0ae2('0x76'),_0x4faf6e[_0x0ae2('0x71')]['toString']())[_0x0ae2('0x3b')](_0x0ae2('0x7f'))[_0x0ae2('0x3b')](_0x0ae2('0x7a'),squel[_0x0ae2('0x77')]()[_0x0ae2('0x6f')](_0x0ae2('0x7b'))[_0x0ae2('0x7c')]('cm_hopper')['where'](_0x0ae2('0x79'),_0x449c17['params']['id'][_0x0ae2('0x72')]())))[_0x0ae2('0x72')]();break;default:_0x290af5=squel['insert']()[_0x0ae2('0x7e')](_0x0ae2('0x69'))[_0x0ae2('0x6a')]([_0x0ae2('0x6b'),_0x0ae2('0x70'),_0x0ae2('0x6c'),'ListId',_0x0ae2('0x5a'),_0x0ae2('0x6e'),_0x0ae2('0x52')],squel['select']()[_0x0ae2('0x6f')](_0x0ae2('0x6b'),_0x0ae2('0x6b'))[_0x0ae2('0x6f')](_0x0ae2('0x73'),_0x0ae2('0x70'))['field']('id','ContactId')[_0x0ae2('0x6f')](_0x4faf6e[_0x0ae2('0x71')]['toString'](),'ListId')[_0x0ae2('0x6f')](_0x449c17[_0x0ae2('0x46')]['id'][_0x0ae2('0x72')](),_0x0ae2('0x5a'))[_0x0ae2('0x6f')](_0x0ae2('0x73'),'createdAt')[_0x0ae2('0x6f')]('NOW()',_0x0ae2('0x52'))[_0x0ae2('0x7c')](_0x0ae2('0x74'))[_0x0ae2('0x3b')](_0x0ae2('0x75'))['where'](_0x0ae2('0x76'),_0x4faf6e[_0x0ae2('0x71')][_0x0ae2('0x72')]())[_0x0ae2('0x3b')](_0x0ae2('0x7f')))[_0x0ae2('0x72')]();}_0xfc1ee1[_0x0ae2('0x80')](db[_0x0ae2('0x81')]['query'](_0x290af5));}return BPromise[_0x0ae2('0x82')](_0xfc1ee1);}})[_0x0ae2('0x28')](function(){return _0x201c30;})[_0x0ae2('0x28')](respondWithResult(_0x17336a,null))[_0x0ae2('0x44')](handleError(_0x17336a,null));};exports[_0x0ae2('0x83')]=function(_0x27e7b4,_0x109b7e,_0x68078d){return db[_0x0ae2('0x40')]['find']({'where':{'id':_0x27e7b4['params']['id']}})[_0x0ae2('0x28')](handleEntityNotFound(_0x109b7e,null))[_0x0ae2('0x28')](function(_0xe5899c){if(_0xe5899c){return _0xe5899c[_0x0ae2('0x83')](_0x27e7b4['query'][_0x0ae2('0x65')]);}})[_0x0ae2('0x28')](function(_0x374e87){if(_0x374e87){return db[_0x0ae2('0x58')][_0x0ae2('0x24')]({'where':{'ListId':_0x27e7b4[_0x0ae2('0x34')]['ids'],'CampaignId':_0x27e7b4[_0x0ae2('0x46')]['id']}})[_0x0ae2('0x28')](function(){return _0x374e87;});}})[_0x0ae2('0x28')](respondWithStatusCode(_0x109b7e,null))[_0x0ae2('0x44')](handleError(_0x109b7e,null));};exports[_0x0ae2('0x84')]=function(_0x7fcc8a,_0x38317f,_0x3a1d0b){var _0x92d7bd={};var _0x5a2391={};var _0x1889e6;var _0x5cdd41;return db[_0x0ae2('0x40')][_0x0ae2('0x57')]({'where':{'id':_0x7fcc8a[_0x0ae2('0x46')]['id']}})['then'](handleEntityNotFound(_0x38317f,null))[_0x0ae2('0x28')](function(_0x5af8fe){if(_0x5af8fe){_0x1889e6=_0x5af8fe;_0x5a2391[_0x0ae2('0x32')]=_[_0x0ae2('0x33')](db[_0x0ae2('0x62')][_0x0ae2('0x2e')]);_0x5a2391['query']=_['keys'](_0x7fcc8a[_0x0ae2('0x34')]);_0x5a2391[_0x0ae2('0x35')]=_[_0x0ae2('0x37')](_0x5a2391['model'],_0x5a2391[_0x0ae2('0x34')]);_0x92d7bd[_0x0ae2('0x36')]=_['intersection'](_0x5a2391[_0x0ae2('0x32')],qs[_0x0ae2('0x47')](_0x7fcc8a[_0x0ae2('0x34')][_0x0ae2('0x47')]));_0x92d7bd[_0x0ae2('0x36')]=_0x92d7bd[_0x0ae2('0x36')][_0x0ae2('0x48')]?_0x92d7bd[_0x0ae2('0x36')]:_0x5a2391[_0x0ae2('0x32')];_0x92d7bd[_0x0ae2('0x39')]=qs[_0x0ae2('0x3a')](_0x7fcc8a['query'][_0x0ae2('0x3a')]);_0x92d7bd[_0x0ae2('0x3b')]=qs[_0x0ae2('0x35')](_['pick'](_0x7fcc8a[_0x0ae2('0x34')],_0x5a2391[_0x0ae2('0x35')]));if(_0x7fcc8a[_0x0ae2('0x34')]['filter']){_0x92d7bd[_0x0ae2('0x3b')]=_[_0x0ae2('0x3e')](_0x92d7bd[_0x0ae2('0x3b')],{'$or':_[_0x0ae2('0x2d')](_0x92d7bd[_0x0ae2('0x36')],function(_0x59f1c3){var _0x7f9dea={};_0x7f9dea[_0x59f1c3]={'$like':'%'+_0x7fcc8a[_0x0ae2('0x34')][_0x0ae2('0x3d')]+'%'};return _0x7f9dea;})});}_0x92d7bd=_[_0x0ae2('0x3e')]({},_0x92d7bd,_0x7fcc8a[_0x0ae2('0x3f')]);return _0x1889e6['getBlackLists'](_0x92d7bd);}})[_0x0ae2('0x28')](function(_0x53ecd1){if(_0x53ecd1){_0x5cdd41=_0x53ecd1[_0x0ae2('0x48')];if(!_0x7fcc8a[_0x0ae2('0x34')][_0x0ae2('0x38')](_0x0ae2('0x59'))){_0x92d7bd[_0x0ae2('0x1d')]=qs[_0x0ae2('0x1d')](_0x7fcc8a[_0x0ae2('0x34')][_0x0ae2('0x1d')]);_0x92d7bd[_0x0ae2('0x1c')]=qs[_0x0ae2('0x1c')](_0x7fcc8a['query'][_0x0ae2('0x1c')]);}return _0x1889e6['getBlackLists'](_0x92d7bd);}})[_0x0ae2('0x28')](function(_0xc2fc3f){if(_0xc2fc3f){return _0xc2fc3f?{'count':_0x5cdd41,'rows':_0xc2fc3f}:null;}})['then'](respondWithResult(_0x38317f,null))[_0x0ae2('0x44')](handleError(_0x38317f,null));};exports[_0x0ae2('0x85')]=function(_0x6abb83,_0x45b612,_0x47654d){var _0x34f041,_0x35e95b;return db[_0x0ae2('0x40')]['find']({'where':{'id':_0x6abb83[_0x0ae2('0x46')]['id']}})[_0x0ae2('0x28')](handleEntityNotFound(_0x45b612,null))['then'](function(_0x461d87){if(_0x461d87){_0x35e95b=_0x461d87;return _0x461d87[_0x0ae2('0x85')](_0x6abb83['body'][_0x0ae2('0x65')],_[_0x0ae2('0x51')](_0x6abb83[_0x0ae2('0x53')],[_0x0ae2('0x65'),'id'])||{});}return null;})[_0x0ae2('0x66')](function(_0x1ca82f){var _0x1fafe7;_0x34f041=_0x1ca82f||[];var _0x4480ec=[];if(_0x1ca82f){for(var _0x54a963=0x0;_0x54a963<_0x1ca82f[_0x0ae2('0x48')];_0x54a963+=0x1){var _0x8e94b=_0x1ca82f[_0x54a963][_0x0ae2('0x25')]({'plain':!![]});_0x1fafe7=squel[_0x0ae2('0x68')]()['into'](_0x0ae2('0x86'))[_0x0ae2('0x6a')]([_0x0ae2('0x6b'),'ContactId','ListId',_0x0ae2('0x5a'),'createdAt',_0x0ae2('0x52')],squel[_0x0ae2('0x77')]()[_0x0ae2('0x6f')](_0x0ae2('0x6b'),'phone')['field']('id',_0x0ae2('0x6c'))[_0x0ae2('0x6f')](_0x8e94b[_0x0ae2('0x71')][_0x0ae2('0x72')](),'ListId')[_0x0ae2('0x6f')](_0x6abb83[_0x0ae2('0x46')]['id']['toString'](),_0x0ae2('0x5a'))['field'](_0x0ae2('0x73'),_0x0ae2('0x6e'))['field']('NOW()',_0x0ae2('0x52'))[_0x0ae2('0x7c')](_0x0ae2('0x74'))[_0x0ae2('0x3b')](_0x0ae2('0x75'))[_0x0ae2('0x3b')](_0x0ae2('0x76'),_0x8e94b[_0x0ae2('0x71')][_0x0ae2('0x72')]())[_0x0ae2('0x3b')](_0x0ae2('0x7f')))[_0x0ae2('0x72')]();_0x4480ec[_0x0ae2('0x80')](db[_0x0ae2('0x81')][_0x0ae2('0x34')](_0x1fafe7));}return BPromise['all'](_0x4480ec);}})[_0x0ae2('0x28')](function(){return _0x34f041;})[_0x0ae2('0x28')](respondWithResult(_0x45b612,null))[_0x0ae2('0x44')](handleError(_0x45b612,null));};exports[_0x0ae2('0x87')]=function(_0xd1ec60,_0x1baf46,_0x28d1e1){return db[_0x0ae2('0x40')]['find']({'where':{'id':_0xd1ec60[_0x0ae2('0x46')]['id']}})[_0x0ae2('0x28')](handleEntityNotFound(_0x1baf46,null))[_0x0ae2('0x28')](function(_0x17535f){if(_0x17535f){return _0x17535f[_0x0ae2('0x87')](_0xd1ec60[_0x0ae2('0x34')][_0x0ae2('0x65')]);}})['then'](function(_0x1a39ca){if(_0x1a39ca){return db[_0x0ae2('0x61')][_0x0ae2('0x24')]({'where':{'ListId':_0xd1ec60['query'][_0x0ae2('0x65')],'CampaignId':_0xd1ec60[_0x0ae2('0x46')]['id']}})[_0x0ae2('0x28')](function(){return _0x1a39ca;});}})[_0x0ae2('0x28')](respondWithStatusCode(_0x1baf46,null))[_0x0ae2('0x44')](handleError(_0x1baf46,null));}; \ No newline at end of file +var _0xc572=['mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../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','UserProfileResource','destroy','error','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','getHoppers','findOne','CmHopper','nolimit','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','cm_contacts','push','sequelize','all','removeLists','ids','getBlackLists','addBlackLists','removeBlackLists','rimraf','fast-json-patch','request-promise','moment'];(function(_0x37594c,_0x250938){var _0xc6c829=function(_0x130bba){while(--_0x130bba){_0x37594c['push'](_0x37594c['shift']());}};_0xc6c829(++_0x250938);}(_0xc572,0x83));var _0x2c57=function(_0x1b62b1,_0x45aa36){_0x1b62b1=_0x1b62b1-0x0;var _0x10d1d6=_0xc572[_0x1b62b1];return _0x10d1d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c57('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c57('0x1'));var rp=require(_0x2c57('0x2'));var moment=require(_0x2c57('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2c57('0x4'));var util=require(_0x2c57('0x5'));var path=require(_0x2c57('0x6'));var sox=require('sox');var csv=require(_0x2c57('0x7'));var ejs=require(_0x2c57('0x8'));var fs=require('fs');var fs_extra=require(_0x2c57('0x9'));var _=require(_0x2c57('0xa'));var squel=require(_0x2c57('0xb'));var crypto=require('crypto');var jsforce=require(_0x2c57('0xc'));var deskjs=require(_0x2c57('0xd'));var toCsv=require(_0x2c57('0x7'));var querystring=require('querystring');var Papa=require(_0x2c57('0xe'));var Redis=require(_0x2c57('0xf'));var authService=require(_0x2c57('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2c57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c57('0x12'))(_0x2c57('0x13'));var utils=require(_0x2c57('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2c57('0x15'));var db=require(_0x2c57('0x16'))['db'];function respondWithStatusCode(_0x3794ec,_0x2f09f2){_0x2f09f2=_0x2f09f2||0xcc;return function(_0x5cfe4a){if(_0x5cfe4a){return _0x3794ec[_0x2c57('0x17')](_0x2f09f2);}return _0x3794ec[_0x2c57('0x18')](_0x2f09f2)[_0x2c57('0x19')]();};}function respondWithResult(_0xde5dc7,_0x55aa51){_0x55aa51=_0x55aa51||0xc8;return function(_0x44283c){if(_0x44283c){return _0xde5dc7['status'](_0x55aa51)[_0x2c57('0x1a')](_0x44283c);}};}function respondWithFilteredResult(_0x27ee6a,_0x40ea7f){return function(_0x4eed4a){if(_0x4eed4a){var _0x54853d=typeof _0x40ea7f[_0x2c57('0x1b')]===_0x2c57('0x1c')&&typeof _0x40ea7f['limit']===_0x2c57('0x1c');var _0x49732c=_0x4eed4a[_0x2c57('0x1d')];var _0x37377c=_0x54853d?0x0:_0x40ea7f[_0x2c57('0x1b')];var _0xe341d6=_0x54853d?_0x4eed4a[_0x2c57('0x1d')]:_0x40ea7f[_0x2c57('0x1b')]+_0x40ea7f[_0x2c57('0x1e')];var _0x3dda27;if(_0xe341d6>=_0x49732c){_0xe341d6=_0x49732c;_0x3dda27=0xc8;}else{_0x3dda27=0xce;}_0x27ee6a['status'](_0x3dda27);return _0x27ee6a[_0x2c57('0x1f')](_0x2c57('0x20'),_0x37377c+'-'+_0xe341d6+'/'+_0x49732c)[_0x2c57('0x1a')](_0x4eed4a);}return null;};}function patchUpdates(_0x3cebbb){return function(_0x1a5550){try{jsonpatch[_0x2c57('0x21')](_0x1a5550,_0x3cebbb,!![]);}catch(_0xed9f1b){return BPromise[_0x2c57('0x22')](_0xed9f1b);}return _0x1a5550[_0x2c57('0x23')]();};}function saveUpdates(_0xadf040,_0x367d98){return function(_0x13f15f){if(_0x13f15f){return _0x13f15f[_0x2c57('0x24')](_0xadf040)[_0x2c57('0x25')](function(_0x193bb9){return _0x193bb9;});}return null;};}function removeEntity(_0x12d27b,_0x6b0db4){return function(_0x5c622c){if(_0x5c622c){return _0x5c622c['destroy']()[_0x2c57('0x25')](function(){var _0x28acd8=_0x5c622c['get']({'plain':!![]});var _0x3e9417='IvrCampaigns';return db[_0x2c57('0x26')][_0x2c57('0x27')]({'where':{'type':_0x3e9417,'resourceId':_0x28acd8['id']}})['then'](function(){return _0x5c622c;});})['then'](function(){_0x12d27b[_0x2c57('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xde3fed,_0x11c71e){return function(_0x23a62a){if(!_0x23a62a){_0xde3fed[_0x2c57('0x17')](0x194);}return _0x23a62a;};}function handleError(_0xd25881,_0x17029c){_0x17029c=_0x17029c||0x1f4;return function(_0x2b704e){logger[_0x2c57('0x28')](_0x2b704e['stack']);if(_0x2b704e['name']){delete _0x2b704e['name'];}_0xd25881[_0x2c57('0x18')](_0x17029c)[_0x2c57('0x29')](_0x2b704e);};}exports[_0x2c57('0x2a')]=function(_0x27db63,_0xd54295){var _0x26fa4e={},_0x3cbef4={},_0x4690e5={'count':0x0,'rows':[]};var _0x58b8fa=_[_0x2c57('0x2b')](db[_0x2c57('0x2c')][_0x2c57('0x2d')],function(_0x1bb846){return{'name':_0x1bb846[_0x2c57('0x2e')],'type':_0x1bb846[_0x2c57('0x2f')][_0x2c57('0x30')]};});_0x3cbef4[_0x2c57('0x31')]=_[_0x2c57('0x2b')](_0x58b8fa,_0x2c57('0x32'));_0x3cbef4[_0x2c57('0x33')]=_[_0x2c57('0x34')](_0x27db63['query']);_0x3cbef4[_0x2c57('0x35')]=_[_0x2c57('0x36')](_0x3cbef4[_0x2c57('0x31')],_0x3cbef4[_0x2c57('0x33')]);_0x26fa4e[_0x2c57('0x37')]=_['intersection'](_0x3cbef4[_0x2c57('0x31')],qs[_0x2c57('0x38')](_0x27db63[_0x2c57('0x33')][_0x2c57('0x38')]));_0x26fa4e['attributes']=_0x26fa4e[_0x2c57('0x37')][_0x2c57('0x39')]?_0x26fa4e[_0x2c57('0x37')]:_0x3cbef4[_0x2c57('0x31')];if(!_0x27db63[_0x2c57('0x33')][_0x2c57('0x3a')]('nolimit')){_0x26fa4e['limit']=qs[_0x2c57('0x1e')](_0x27db63['query'][_0x2c57('0x1e')]);_0x26fa4e[_0x2c57('0x1b')]=qs['offset'](_0x27db63[_0x2c57('0x33')][_0x2c57('0x1b')]);}_0x26fa4e[_0x2c57('0x3b')]=qs[_0x2c57('0x3c')](_0x27db63[_0x2c57('0x33')][_0x2c57('0x3c')]);_0x26fa4e[_0x2c57('0x3d')]=qs[_0x2c57('0x35')](_[_0x2c57('0x3e')](_0x27db63['query'],_0x3cbef4[_0x2c57('0x35')]),_0x58b8fa);if(_0x27db63[_0x2c57('0x33')][_0x2c57('0x3f')]){_0x26fa4e[_0x2c57('0x3d')]=_[_0x2c57('0x40')](_0x26fa4e[_0x2c57('0x3d')],{'$or':_[_0x2c57('0x2b')](_0x58b8fa,function(_0x35f4eb){if(_0x35f4eb[_0x2c57('0x2f')]!==_0x2c57('0x41')){var _0x45a180={};_0x45a180[_0x35f4eb[_0x2c57('0x32')]]={'$like':'%'+_0x27db63[_0x2c57('0x33')][_0x2c57('0x3f')]+'%'};return _0x45a180;}})});}_0x26fa4e=_['merge']({},_0x26fa4e,_0x27db63[_0x2c57('0x42')]);var _0x39281c={'where':_0x26fa4e['where']};return db['Campaign'][_0x2c57('0x1d')](_0x39281c)[_0x2c57('0x25')](function(_0x2d7b59){_0x4690e5[_0x2c57('0x1d')]=_0x2d7b59;if(_0x27db63[_0x2c57('0x33')][_0x2c57('0x43')]){_0x26fa4e['include']=[{'all':!![]}];}return db[_0x2c57('0x2c')][_0x2c57('0x44')](_0x26fa4e);})[_0x2c57('0x25')](function(_0x1c66d8){_0x4690e5[_0x2c57('0x45')]=_0x1c66d8;return _0x4690e5;})[_0x2c57('0x25')](respondWithFilteredResult(_0xd54295,_0x26fa4e))[_0x2c57('0x46')](handleError(_0xd54295,null));};exports['show']=function(_0x165f24,_0x3d95ec){var _0x2c910c={'raw':![],'where':{'id':_0x165f24[_0x2c57('0x47')]['id']}},_0x28f700={};_0x28f700[_0x2c57('0x31')]=_[_0x2c57('0x34')](db['Campaign'][_0x2c57('0x2d')]);_0x28f700[_0x2c57('0x33')]=_['keys'](_0x165f24[_0x2c57('0x33')]);_0x28f700[_0x2c57('0x35')]=_[_0x2c57('0x36')](_0x28f700[_0x2c57('0x31')],_0x28f700[_0x2c57('0x33')]);_0x2c910c[_0x2c57('0x37')]=_[_0x2c57('0x36')](_0x28f700[_0x2c57('0x31')],qs[_0x2c57('0x38')](_0x165f24[_0x2c57('0x33')][_0x2c57('0x38')]));_0x2c910c[_0x2c57('0x37')]=_0x2c910c[_0x2c57('0x37')]['length']?_0x2c910c[_0x2c57('0x37')]:_0x28f700['model'];if(_0x165f24[_0x2c57('0x33')]['includeAll']){_0x2c910c[_0x2c57('0x48')]=[{'all':!![]}];}_0x2c910c=_[_0x2c57('0x40')]({},_0x2c910c,_0x165f24[_0x2c57('0x42')]);return db[_0x2c57('0x2c')][_0x2c57('0x49')](_0x2c910c)[_0x2c57('0x25')](handleEntityNotFound(_0x3d95ec,null))[_0x2c57('0x25')](respondWithResult(_0x3d95ec,null))[_0x2c57('0x46')](handleError(_0x3d95ec,null));};exports['create']=function(_0x17792c,_0x4191c3){return db[_0x2c57('0x2c')][_0x2c57('0x4a')](_0x17792c['body'],{})[_0x2c57('0x25')](function(_0x1ce4ca){var _0x55d4a7=_0x17792c[_0x2c57('0x4b')]['get']({'plain':!![]});if(!_0x55d4a7)throw new Error(_0x2c57('0x4c'));if(_0x55d4a7[_0x2c57('0x4d')]===_0x2c57('0x4b')){var _0x42fe09=_0x1ce4ca[_0x2c57('0x4e')]({'plain':!![]});var _0x3eb5=_0x2c57('0x4f');return db[_0x2c57('0x50')][_0x2c57('0x49')]({'where':{'name':_0x3eb5,'userProfileId':_0x55d4a7[_0x2c57('0x51')]},'raw':!![]})['then'](function(_0xf53f57){if(_0xf53f57&&_0xf53f57[_0x2c57('0x52')]===0x0){return db[_0x2c57('0x26')]['create']({'name':_0x42fe09[_0x2c57('0x32')],'resourceId':_0x42fe09['id'],'type':_0xf53f57[_0x2c57('0x32')],'sectionId':_0xf53f57['id']},{})[_0x2c57('0x25')](function(){return _0x1ce4ca;});}else{return _0x1ce4ca;}})[_0x2c57('0x46')](function(_0xb47e46){logger[_0x2c57('0x28')](_0x2c57('0x53'),_0xb47e46);throw _0xb47e46;});}return _0x1ce4ca;})[_0x2c57('0x25')](respondWithResult(_0x4191c3,0xc9))['catch'](handleError(_0x4191c3,null));};exports[_0x2c57('0x54')]=function(_0x16d3ef,_0x4fa6fd){var _0x2aec0e={'where':{'id':_0x16d3ef[_0x2c57('0x47')]['id']}},_0x5a1ff8={};_0x5a1ff8[_0x2c57('0x31')]=_[_0x2c57('0x34')](db[_0x2c57('0x2c')]['rawAttributes']);_0x2aec0e[_0x2c57('0x37')]=_[_0x2c57('0x36')](_0x5a1ff8[_0x2c57('0x31')],qs['fields'](_0x16d3ef[_0x2c57('0x33')][_0x2c57('0x38')]));_0x2aec0e[_0x2c57('0x37')]=_0x2aec0e[_0x2c57('0x37')][_0x2c57('0x39')]?_0x2aec0e[_0x2c57('0x37')]:_0x5a1ff8[_0x2c57('0x31')];if(_0x16d3ef[_0x2c57('0x33')][_0x2c57('0x43')]){_0x2aec0e[_0x2c57('0x48')]=[{'all':!![]}];}_0x2aec0e=_['merge']({},_0x2aec0e,_0x16d3ef[_0x2c57('0x42')]);return db[_0x2c57('0x2c')][_0x2c57('0x49')](_0x2aec0e)[_0x2c57('0x25')](handleEntityNotFound(_0x4fa6fd,null))[_0x2c57('0x25')](function(_0xf5c7c3){if(_0xf5c7c3){var _0x2f6c24=_0xf5c7c3[_0x2c57('0x4e')]({'plain':!![]});_0x2f6c24=qs[_0x2c57('0x55')](_0x2f6c24,['id',_0x2c57('0x56'),_0x2c57('0x57')]);_0x16d3ef[_0x2c57('0x58')]=_['omit'](_0x16d3ef[_0x2c57('0x58')],['id',_0x2c57('0x56'),_0x2c57('0x57')]);return db[_0x2c57('0x2c')][_0x2c57('0x4a')](_[_0x2c57('0x40')](_0x2f6c24,_0x16d3ef[_0x2c57('0x58')]),{'include':_0x16d3ef[_0x2c57('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0x2c57('0x25')](function(_0x23bd14){var _0x134a52=_0x16d3ef[_0x2c57('0x4b')]['get']({'plain':!![]});if(!_0x134a52)throw new Error(_0x2c57('0x4c'));if(_0x134a52['role']===_0x2c57('0x4b')){var _0x35568b=_0x23bd14[_0x2c57('0x4e')]({'plain':!![]});var _0x576b73=_0x2c57('0x4f');return db['UserProfileSection'][_0x2c57('0x49')]({'where':{'name':_0x576b73,'userProfileId':_0x134a52[_0x2c57('0x51')]},'raw':!![]})[_0x2c57('0x25')](function(_0x2027aa){if(_0x2027aa&&_0x2027aa[_0x2c57('0x52')]===0x0){return db[_0x2c57('0x26')][_0x2c57('0x4a')]({'name':_0x35568b['name'],'resourceId':_0x35568b['id'],'type':_0x2027aa[_0x2c57('0x32')],'sectionId':_0x2027aa['id']},{})[_0x2c57('0x25')](function(){return _0x23bd14;});}else{return _0x23bd14;}})[_0x2c57('0x46')](function(_0x2625eb){logger[_0x2c57('0x28')](_0x2c57('0x53'),_0x2625eb);throw _0x2625eb;});}return _0x23bd14;});}})[_0x2c57('0x25')](respondWithResult(_0x4fa6fd,0xc9))[_0x2c57('0x46')](handleError(_0x4fa6fd,null));};exports[_0x2c57('0x24')]=function(_0x8256e,_0x9b49c1){if(_0x8256e[_0x2c57('0x58')]['id']){delete _0x8256e[_0x2c57('0x58')]['id'];}return db[_0x2c57('0x2c')][_0x2c57('0x49')]({'where':{'id':_0x8256e[_0x2c57('0x47')]['id']}})['then'](handleEntityNotFound(_0x9b49c1,null))['then'](saveUpdates(_0x8256e['body'],null))[_0x2c57('0x25')](respondWithResult(_0x9b49c1,null))[_0x2c57('0x46')](handleError(_0x9b49c1,null));};exports[_0x2c57('0x27')]=function(_0x229705,_0x2e0f21){return db[_0x2c57('0x2c')]['find']({'where':{'id':_0x229705['params']['id']}})[_0x2c57('0x25')](handleEntityNotFound(_0x2e0f21,null))[_0x2c57('0x25')](removeEntity(_0x2e0f21,null))[_0x2c57('0x46')](handleError(_0x2e0f21,null));};exports[_0x2c57('0x59')]=function(_0xcfc68e,_0x350d70,_0x1156d1){var _0x4f32c8={'raw':!![],'where':{}};var _0x457a9c={};var _0x41d728={'count':0x0,'rows':[]};return db[_0x2c57('0x2c')][_0x2c57('0x5a')]({'where':{'id':_0xcfc68e[_0x2c57('0x47')]['id']}})[_0x2c57('0x25')](handleEntityNotFound(_0x350d70,null))[_0x2c57('0x25')](function(_0x5537d5){if(_0x5537d5){_0x457a9c[_0x2c57('0x31')]=_[_0x2c57('0x34')](db[_0x2c57('0x5b')][_0x2c57('0x2d')]);_0x457a9c[_0x2c57('0x33')]=_[_0x2c57('0x34')](_0xcfc68e[_0x2c57('0x33')]);_0x457a9c[_0x2c57('0x35')]=_[_0x2c57('0x36')](_0x457a9c['model'],_0x457a9c[_0x2c57('0x33')]);_0x4f32c8[_0x2c57('0x37')]=_['intersection'](_0x457a9c[_0x2c57('0x31')],qs[_0x2c57('0x38')](_0xcfc68e[_0x2c57('0x33')][_0x2c57('0x38')]));_0x4f32c8['attributes']=_0x4f32c8[_0x2c57('0x37')]['length']?_0x4f32c8[_0x2c57('0x37')]:_0x457a9c['model'];if(!_0xcfc68e[_0x2c57('0x33')][_0x2c57('0x3a')](_0x2c57('0x5c'))){_0x4f32c8['limit']=qs[_0x2c57('0x1e')](_0xcfc68e[_0x2c57('0x33')][_0x2c57('0x1e')]);_0x4f32c8[_0x2c57('0x1b')]=qs[_0x2c57('0x1b')](_0xcfc68e[_0x2c57('0x33')][_0x2c57('0x1b')]);}_0x4f32c8[_0x2c57('0x3b')]=qs[_0x2c57('0x3c')](_0xcfc68e[_0x2c57('0x33')][_0x2c57('0x3c')]);_0x4f32c8[_0x2c57('0x3d')]=qs['filters'](_[_0x2c57('0x3e')](_0xcfc68e[_0x2c57('0x33')],_0x457a9c[_0x2c57('0x35')]));_0x4f32c8['where'][_0x2c57('0x5d')]=_0x5537d5['id'];if(_0xcfc68e[_0x2c57('0x33')][_0x2c57('0x3f')]){_0x4f32c8[_0x2c57('0x3d')]=_[_0x2c57('0x40')](_0x4f32c8[_0x2c57('0x3d')],{'$or':_[_0x2c57('0x2b')](_0x4f32c8['attributes'],function(_0x1e5b3f){var _0xf58388={};_0xf58388[_0x1e5b3f]={'$like':'%'+_0xcfc68e['query']['filter']+'%'};return _0xf58388;})});}_0x4f32c8=_['merge']({},_0x4f32c8,_0xcfc68e[_0x2c57('0x42')]);return db[_0x2c57('0x5b')]['count']({'where':_0x4f32c8['where']})['then'](function(_0x3df573){_0x41d728['count']=_0x3df573;if(_0xcfc68e[_0x2c57('0x33')][_0x2c57('0x43')]){_0x4f32c8[_0x2c57('0x48')]=[{'all':!![]}];}return db[_0x2c57('0x5b')][_0x2c57('0x44')](_0x4f32c8);})[_0x2c57('0x25')](function(_0x10b164){_0x41d728[_0x2c57('0x45')]=_0x10b164;return _0x41d728;});}})[_0x2c57('0x25')](respondWithFilteredResult(_0x350d70,_0x4f32c8))[_0x2c57('0x46')](handleError(_0x350d70,null));};exports[_0x2c57('0x5e')]=function(_0x543551,_0x43e9ca,_0x337f24){var _0x15d176={'raw':!![],'where':{}};var _0x300c99={};var _0x3ed2a6={'count':0x0,'rows':[]};return db[_0x2c57('0x2c')][_0x2c57('0x5a')]({'where':{'id':_0x543551[_0x2c57('0x47')]['id']}})['then'](handleEntityNotFound(_0x43e9ca,null))[_0x2c57('0x25')](function(_0x148b87){if(_0x148b87){_0x300c99['model']=_['keys'](db[_0x2c57('0x5f')]['rawAttributes']);_0x300c99[_0x2c57('0x33')]=_[_0x2c57('0x34')](_0x543551[_0x2c57('0x33')]);_0x300c99[_0x2c57('0x35')]=_[_0x2c57('0x36')](_0x300c99['model'],_0x300c99['query']);_0x15d176['attributes']=_[_0x2c57('0x36')](_0x300c99[_0x2c57('0x31')],qs[_0x2c57('0x38')](_0x543551[_0x2c57('0x33')]['fields']));_0x15d176[_0x2c57('0x37')]=_0x15d176['attributes'][_0x2c57('0x39')]?_0x15d176[_0x2c57('0x37')]:_0x300c99['model'];if(!_0x543551[_0x2c57('0x33')]['hasOwnProperty'](_0x2c57('0x5c'))){_0x15d176[_0x2c57('0x1e')]=qs[_0x2c57('0x1e')](_0x543551[_0x2c57('0x33')]['limit']);_0x15d176['offset']=qs[_0x2c57('0x1b')](_0x543551['query'][_0x2c57('0x1b')]);}_0x15d176[_0x2c57('0x3b')]=qs[_0x2c57('0x3c')](_0x543551[_0x2c57('0x33')][_0x2c57('0x3c')]);_0x15d176['where']=qs['filters'](_['pick'](_0x543551[_0x2c57('0x33')],_0x300c99[_0x2c57('0x35')]));_0x15d176[_0x2c57('0x3d')]['CampaignId']=_0x148b87['id'];if(_0x543551[_0x2c57('0x33')][_0x2c57('0x3f')]){_0x15d176[_0x2c57('0x3d')]=_[_0x2c57('0x40')](_0x15d176['where'],{'$or':_[_0x2c57('0x2b')](_0x15d176[_0x2c57('0x37')],function(_0x116eca){var _0x1917c7={};_0x1917c7[_0x116eca]={'$like':'%'+_0x543551[_0x2c57('0x33')][_0x2c57('0x3f')]+'%'};return _0x1917c7;})});}_0x15d176=_['merge']({},_0x15d176,_0x543551[_0x2c57('0x42')]);return db[_0x2c57('0x5f')][_0x2c57('0x1d')]({'where':_0x15d176[_0x2c57('0x3d')]})['then'](function(_0x2ab0da){_0x3ed2a6[_0x2c57('0x1d')]=_0x2ab0da;if(_0x543551[_0x2c57('0x33')][_0x2c57('0x43')]){_0x15d176[_0x2c57('0x48')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x2c57('0x44')](_0x15d176);})[_0x2c57('0x25')](function(_0x144e7c){_0x3ed2a6['rows']=_0x144e7c;return _0x3ed2a6;});}})[_0x2c57('0x25')](respondWithFilteredResult(_0x43e9ca,_0x15d176))[_0x2c57('0x46')](handleError(_0x43e9ca,null));};exports[_0x2c57('0x60')]=function(_0x489e08,_0x15fe00,_0x135b8a){var _0x26be8f={'raw':!![],'where':{}};var _0x2e084d={};var _0x4daf5d={'count':0x0,'rows':[]};return db[_0x2c57('0x2c')][_0x2c57('0x5a')]({'where':{'id':_0x489e08[_0x2c57('0x47')]['id']}})[_0x2c57('0x25')](handleEntityNotFound(_0x15fe00,null))[_0x2c57('0x25')](function(_0x48ff3a){if(_0x48ff3a){_0x2e084d['model']=_['keys'](db['CmHopperFinal'][_0x2c57('0x2d')]);_0x2e084d[_0x2c57('0x33')]=_[_0x2c57('0x34')](_0x489e08[_0x2c57('0x33')]);_0x2e084d['filters']=_['intersection'](_0x2e084d[_0x2c57('0x31')],_0x2e084d['query']);_0x26be8f[_0x2c57('0x37')]=_[_0x2c57('0x36')](_0x2e084d[_0x2c57('0x31')],qs[_0x2c57('0x38')](_0x489e08[_0x2c57('0x33')][_0x2c57('0x38')]));_0x26be8f[_0x2c57('0x37')]=_0x26be8f[_0x2c57('0x37')][_0x2c57('0x39')]?_0x26be8f[_0x2c57('0x37')]:_0x2e084d[_0x2c57('0x31')];if(!_0x489e08[_0x2c57('0x33')][_0x2c57('0x3a')]('nolimit')){_0x26be8f[_0x2c57('0x1e')]=qs[_0x2c57('0x1e')](_0x489e08[_0x2c57('0x33')][_0x2c57('0x1e')]);_0x26be8f[_0x2c57('0x1b')]=qs[_0x2c57('0x1b')](_0x489e08['query'][_0x2c57('0x1b')]);}_0x26be8f['order']=qs['sort'](_0x489e08[_0x2c57('0x33')][_0x2c57('0x3c')]);_0x26be8f[_0x2c57('0x3d')]=qs['filters'](_[_0x2c57('0x3e')](_0x489e08[_0x2c57('0x33')],_0x2e084d[_0x2c57('0x35')]));_0x26be8f['where'][_0x2c57('0x5d')]=_0x48ff3a['id'];if(_0x489e08[_0x2c57('0x33')][_0x2c57('0x3f')]){_0x26be8f[_0x2c57('0x3d')]=_[_0x2c57('0x40')](_0x26be8f[_0x2c57('0x3d')],{'$or':_[_0x2c57('0x2b')](_0x26be8f['attributes'],function(_0x33ea00){var _0x4296a7={};_0x4296a7[_0x33ea00]={'$like':'%'+_0x489e08[_0x2c57('0x33')][_0x2c57('0x3f')]+'%'};return _0x4296a7;})});}_0x26be8f=_['merge']({},_0x26be8f,_0x489e08[_0x2c57('0x42')]);return db[_0x2c57('0x61')][_0x2c57('0x1d')]({'where':_0x26be8f['where']})[_0x2c57('0x25')](function(_0x3f0273){_0x4daf5d[_0x2c57('0x1d')]=_0x3f0273;if(_0x489e08['query'][_0x2c57('0x43')]){_0x26be8f[_0x2c57('0x48')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x2c57('0x44')](_0x26be8f);})[_0x2c57('0x25')](function(_0x44a360){_0x4daf5d[_0x2c57('0x45')]=_0x44a360;return _0x4daf5d;});}})[_0x2c57('0x25')](respondWithFilteredResult(_0x15fe00,_0x26be8f))[_0x2c57('0x46')](handleError(_0x15fe00,null));};exports['getHopperBlacks']=function(_0x1694a8,_0x2a6777,_0x4df123){var _0x2c6c6e={'raw':!![],'where':{}};var _0x40ac4d={};var _0x3e9056={'count':0x0,'rows':[]};return db[_0x2c57('0x2c')]['findOne']({'where':{'id':_0x1694a8['params']['id']}})[_0x2c57('0x25')](handleEntityNotFound(_0x2a6777,null))[_0x2c57('0x25')](function(_0x18b1ef){if(_0x18b1ef){_0x40ac4d[_0x2c57('0x31')]=_['keys'](db[_0x2c57('0x62')][_0x2c57('0x2d')]);_0x40ac4d[_0x2c57('0x33')]=_[_0x2c57('0x34')](_0x1694a8[_0x2c57('0x33')]);_0x40ac4d[_0x2c57('0x35')]=_['intersection'](_0x40ac4d['model'],_0x40ac4d[_0x2c57('0x33')]);_0x2c6c6e['attributes']=_[_0x2c57('0x36')](_0x40ac4d[_0x2c57('0x31')],qs[_0x2c57('0x38')](_0x1694a8[_0x2c57('0x33')]['fields']));_0x2c6c6e[_0x2c57('0x37')]=_0x2c6c6e['attributes'][_0x2c57('0x39')]?_0x2c6c6e[_0x2c57('0x37')]:_0x40ac4d['model'];if(!_0x1694a8[_0x2c57('0x33')][_0x2c57('0x3a')](_0x2c57('0x5c'))){_0x2c6c6e[_0x2c57('0x1e')]=qs[_0x2c57('0x1e')](_0x1694a8[_0x2c57('0x33')][_0x2c57('0x1e')]);_0x2c6c6e[_0x2c57('0x1b')]=qs['offset'](_0x1694a8[_0x2c57('0x33')][_0x2c57('0x1b')]);}_0x2c6c6e[_0x2c57('0x3b')]=qs[_0x2c57('0x3c')](_0x1694a8[_0x2c57('0x33')][_0x2c57('0x3c')]);_0x2c6c6e[_0x2c57('0x3d')]=qs['filters'](_[_0x2c57('0x3e')](_0x1694a8['query'],_0x40ac4d['filters']));_0x2c6c6e[_0x2c57('0x3d')][_0x2c57('0x5d')]=_0x18b1ef['id'];if(_0x1694a8[_0x2c57('0x33')][_0x2c57('0x3f')]){_0x2c6c6e[_0x2c57('0x3d')]=_['merge'](_0x2c6c6e['where'],{'$or':_['map'](_0x2c6c6e[_0x2c57('0x37')],function(_0x2ca1db){var _0x560119={};_0x560119[_0x2ca1db]={'$like':'%'+_0x1694a8['query'][_0x2c57('0x3f')]+'%'};return _0x560119;})});}_0x2c6c6e=_[_0x2c57('0x40')]({},_0x2c6c6e,_0x1694a8[_0x2c57('0x42')]);return db['CmHopperBlack']['count']({'where':_0x2c6c6e['where']})[_0x2c57('0x25')](function(_0x37d4ff){_0x3e9056['count']=_0x37d4ff;if(_0x1694a8[_0x2c57('0x33')]['includeAll']){_0x2c6c6e[_0x2c57('0x48')]=[{'all':!![]}];}return db[_0x2c57('0x62')][_0x2c57('0x44')](_0x2c6c6e);})[_0x2c57('0x25')](function(_0x1f6d24){_0x3e9056[_0x2c57('0x45')]=_0x1f6d24;return _0x3e9056;});}})[_0x2c57('0x25')](respondWithFilteredResult(_0x2a6777,_0x2c6c6e))['catch'](handleError(_0x2a6777,null));};exports[_0x2c57('0x63')]=function(_0x1e4499,_0x1fc6f5,_0x4587d1){var _0x5beb1e={};var _0x5a9aac={};var _0x43b578;var _0x237acb;return db[_0x2c57('0x2c')][_0x2c57('0x5a')]({'where':{'id':_0x1e4499[_0x2c57('0x47')]['id']}})[_0x2c57('0x25')](handleEntityNotFound(_0x1fc6f5,null))[_0x2c57('0x25')](function(_0x27d939){if(_0x27d939){_0x43b578=_0x27d939;_0x5a9aac[_0x2c57('0x31')]=_[_0x2c57('0x34')](db[_0x2c57('0x64')][_0x2c57('0x2d')]);_0x5a9aac[_0x2c57('0x33')]=_[_0x2c57('0x34')](_0x1e4499['query']);_0x5a9aac[_0x2c57('0x35')]=_[_0x2c57('0x36')](_0x5a9aac[_0x2c57('0x31')],_0x5a9aac[_0x2c57('0x33')]);_0x5beb1e['attributes']=_[_0x2c57('0x36')](_0x5a9aac[_0x2c57('0x31')],qs[_0x2c57('0x38')](_0x1e4499[_0x2c57('0x33')]['fields']));_0x5beb1e[_0x2c57('0x37')]=_0x5beb1e[_0x2c57('0x37')][_0x2c57('0x39')]?_0x5beb1e[_0x2c57('0x37')]:_0x5a9aac[_0x2c57('0x31')];_0x5beb1e['order']=qs['sort'](_0x1e4499[_0x2c57('0x33')][_0x2c57('0x3c')]);_0x5beb1e[_0x2c57('0x3d')]=qs[_0x2c57('0x35')](_['pick'](_0x1e4499[_0x2c57('0x33')],_0x5a9aac[_0x2c57('0x35')]));if(_0x1e4499[_0x2c57('0x33')][_0x2c57('0x3f')]){_0x5beb1e[_0x2c57('0x3d')]=_[_0x2c57('0x40')](_0x5beb1e['where'],{'$or':_[_0x2c57('0x2b')](_0x5beb1e[_0x2c57('0x37')],function(_0x7d324f){var _0x1659d8={};_0x1659d8[_0x7d324f]={'$like':'%'+_0x1e4499[_0x2c57('0x33')]['filter']+'%'};return _0x1659d8;})});}_0x5beb1e=_[_0x2c57('0x40')]({},_0x5beb1e,_0x1e4499[_0x2c57('0x42')]);return _0x43b578['getLists'](_0x5beb1e);}})[_0x2c57('0x25')](function(_0x2d32d5){if(_0x2d32d5){_0x237acb=_0x2d32d5['length'];if(!_0x1e4499['query']['hasOwnProperty'](_0x2c57('0x5c'))){_0x5beb1e[_0x2c57('0x1e')]=qs[_0x2c57('0x1e')](_0x1e4499[_0x2c57('0x33')][_0x2c57('0x1e')]);_0x5beb1e[_0x2c57('0x1b')]=qs[_0x2c57('0x1b')](_0x1e4499['query'][_0x2c57('0x1b')]);}return _0x43b578['getLists'](_0x5beb1e);}})[_0x2c57('0x25')](function(_0x2cd24c){if(_0x2cd24c){return _0x2cd24c?{'count':_0x237acb,'rows':_0x2cd24c}:null;}})[_0x2c57('0x25')](respondWithResult(_0x1fc6f5,null))[_0x2c57('0x46')](handleError(_0x1fc6f5,null));};exports[_0x2c57('0x65')]=function(_0x8c5261,_0x4fd9d8,_0x59028e){var _0x2f95ce,_0x94399a;return db[_0x2c57('0x2c')][_0x2c57('0x49')]({'where':{'id':_0x8c5261[_0x2c57('0x47')]['id']}})[_0x2c57('0x25')](handleEntityNotFound(_0x4fd9d8,null))[_0x2c57('0x25')](function(_0x1436b0){if(_0x1436b0){_0x94399a=_0x1436b0;return _0x1436b0['addLists'](_0x8c5261[_0x2c57('0x58')]['ids'],_[_0x2c57('0x55')](_0x8c5261[_0x2c57('0x58')],['ids','id'])||{});}return null;})['spread'](function(_0x2856bb){var _0x203ac9;_0x2f95ce=_0x2856bb||[];var _0x5518bb=[];if(_0x2856bb){for(var _0x123623=0x0;_0x123623<_0x2856bb[_0x2c57('0x39')];_0x123623+=0x1){var _0x372a4a=_0x2856bb[_0x123623][_0x2c57('0x4e')]({'plain':!![]});_0x94399a[_0x2c57('0x66')]=_0x8c5261[_0x2c57('0x58')][_0x2c57('0x66')]?_0x8c5261[_0x2c57('0x58')][_0x2c57('0x66')]:_0x94399a[_0x2c57('0x66')];switch(_0x94399a[_0x2c57('0x66')]){case _0x2c57('0x67'):_0x203ac9=squel[_0x2c57('0x68')]()[_0x2c57('0x69')](_0x2c57('0x6a'))[_0x2c57('0x6b')]([_0x2c57('0x6c'),_0x2c57('0x6d'),_0x2c57('0x6e'),_0x2c57('0x6f'),'CampaignId',_0x2c57('0x56'),_0x2c57('0x57')],squel[_0x2c57('0x70')]()['field']('phone',_0x2c57('0x6c'))['field']('NOW()',_0x2c57('0x6d'))['field']('id',_0x2c57('0x6e'))[_0x2c57('0x71')](_0x372a4a[_0x2c57('0x72')][_0x2c57('0x73')](),'ListId')[_0x2c57('0x71')](_0x8c5261[_0x2c57('0x47')]['id'][_0x2c57('0x73')](),_0x2c57('0x5d'))['field'](_0x2c57('0x74'),'createdAt')[_0x2c57('0x71')](_0x2c57('0x74'),'updatedAt')[_0x2c57('0x75')]('cm_contacts')[_0x2c57('0x3d')](_0x2c57('0x76'))[_0x2c57('0x3d')](_0x2c57('0x77'),_0x372a4a[_0x2c57('0x72')][_0x2c57('0x73')]())[_0x2c57('0x3d')](_0x2c57('0x78'))[_0x2c57('0x3d')](_0x2c57('0x79'),squel[_0x2c57('0x70')]()[_0x2c57('0x71')](_0x2c57('0x7a'))[_0x2c57('0x75')]('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x8c5261[_0x2c57('0x47')]['id'][_0x2c57('0x73')]()))['where'](_0x2c57('0x79'),squel[_0x2c57('0x70')]()[_0x2c57('0x71')](_0x2c57('0x7b'))[_0x2c57('0x75')]('cm_hopper')['where'](_0x2c57('0x7c'),_0x8c5261[_0x2c57('0x47')]['id'][_0x2c57('0x73')]())))[_0x2c57('0x73')]();break;case _0x2c57('0x7d'):_0x203ac9=squel[_0x2c57('0x68')]()[_0x2c57('0x69')]('cm_hopper')[_0x2c57('0x6b')]([_0x2c57('0x6c'),_0x2c57('0x6d'),_0x2c57('0x6e'),'ListId',_0x2c57('0x5d'),_0x2c57('0x56'),_0x2c57('0x57')],squel[_0x2c57('0x70')]()[_0x2c57('0x71')](_0x2c57('0x6c'),'phone')[_0x2c57('0x71')](_0x2c57('0x74'),_0x2c57('0x6d'))[_0x2c57('0x71')]('id',_0x2c57('0x6e'))['field'](_0x372a4a['CmListId'][_0x2c57('0x73')](),'ListId')[_0x2c57('0x71')](_0x8c5261[_0x2c57('0x47')]['id'][_0x2c57('0x73')](),_0x2c57('0x5d'))['field'](_0x2c57('0x74'),'createdAt')[_0x2c57('0x71')](_0x2c57('0x74'),_0x2c57('0x57'))[_0x2c57('0x75')]('cm_contacts')[_0x2c57('0x3d')](_0x2c57('0x76'))[_0x2c57('0x3d')]('ListId\x20=\x20?',_0x372a4a[_0x2c57('0x72')][_0x2c57('0x73')]())[_0x2c57('0x3d')](_0x2c57('0x78'))['where'](_0x2c57('0x79'),squel[_0x2c57('0x70')]()[_0x2c57('0x71')]('COALESCE(phone,\x27\x27)')[_0x2c57('0x75')]('cm_hopper')['where'](_0x2c57('0x7c'),_0x8c5261[_0x2c57('0x47')]['id']['toString']())))[_0x2c57('0x73')]();break;default:_0x203ac9=squel['insert']()[_0x2c57('0x69')](_0x2c57('0x6a'))[_0x2c57('0x6b')](['phone','scheduledAt',_0x2c57('0x6e'),_0x2c57('0x6f'),'CampaignId',_0x2c57('0x56'),_0x2c57('0x57')],squel[_0x2c57('0x70')]()[_0x2c57('0x71')](_0x2c57('0x6c'),_0x2c57('0x6c'))[_0x2c57('0x71')](_0x2c57('0x74'),_0x2c57('0x6d'))[_0x2c57('0x71')]('id','ContactId')[_0x2c57('0x71')](_0x372a4a[_0x2c57('0x72')][_0x2c57('0x73')](),_0x2c57('0x6f'))[_0x2c57('0x71')](_0x8c5261[_0x2c57('0x47')]['id'][_0x2c57('0x73')](),_0x2c57('0x5d'))[_0x2c57('0x71')](_0x2c57('0x74'),_0x2c57('0x56'))[_0x2c57('0x71')](_0x2c57('0x74'),'updatedAt')[_0x2c57('0x75')](_0x2c57('0x7e'))[_0x2c57('0x3d')](_0x2c57('0x76'))[_0x2c57('0x3d')](_0x2c57('0x77'),_0x372a4a[_0x2c57('0x72')][_0x2c57('0x73')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x2c57('0x73')]();}_0x5518bb[_0x2c57('0x7f')](db[_0x2c57('0x80')][_0x2c57('0x33')](_0x203ac9));}return BPromise[_0x2c57('0x81')](_0x5518bb);}})[_0x2c57('0x25')](function(){return _0x2f95ce;})['then'](respondWithResult(_0x4fd9d8,null))['catch'](handleError(_0x4fd9d8,null));};exports[_0x2c57('0x82')]=function(_0x2e58b7,_0x349675,_0x4c4e42){return db[_0x2c57('0x2c')][_0x2c57('0x49')]({'where':{'id':_0x2e58b7['params']['id']}})[_0x2c57('0x25')](handleEntityNotFound(_0x349675,null))['then'](function(_0x21d408){if(_0x21d408){return _0x21d408['removeLists'](_0x2e58b7[_0x2c57('0x33')][_0x2c57('0x83')]);}})[_0x2c57('0x25')](function(_0x47e10c){if(_0x47e10c){return db[_0x2c57('0x5b')][_0x2c57('0x27')]({'where':{'ListId':_0x2e58b7[_0x2c57('0x33')][_0x2c57('0x83')],'CampaignId':_0x2e58b7[_0x2c57('0x47')]['id']}})[_0x2c57('0x25')](function(){return _0x47e10c;});}})['then'](respondWithStatusCode(_0x349675,null))[_0x2c57('0x46')](handleError(_0x349675,null));};exports[_0x2c57('0x84')]=function(_0x2bf69f,_0xa9eb6d,_0x2b1c6d){var _0x37fad7={};var _0xec5989={};var _0x49988e;var _0x5e1fa1;return db[_0x2c57('0x2c')][_0x2c57('0x5a')]({'where':{'id':_0x2bf69f[_0x2c57('0x47')]['id']}})[_0x2c57('0x25')](handleEntityNotFound(_0xa9eb6d,null))['then'](function(_0x2bd4a1){if(_0x2bd4a1){_0x49988e=_0x2bd4a1;_0xec5989[_0x2c57('0x31')]=_['keys'](db[_0x2c57('0x64')][_0x2c57('0x2d')]);_0xec5989[_0x2c57('0x33')]=_[_0x2c57('0x34')](_0x2bf69f[_0x2c57('0x33')]);_0xec5989[_0x2c57('0x35')]=_['intersection'](_0xec5989[_0x2c57('0x31')],_0xec5989[_0x2c57('0x33')]);_0x37fad7[_0x2c57('0x37')]=_[_0x2c57('0x36')](_0xec5989[_0x2c57('0x31')],qs[_0x2c57('0x38')](_0x2bf69f[_0x2c57('0x33')][_0x2c57('0x38')]));_0x37fad7['attributes']=_0x37fad7[_0x2c57('0x37')][_0x2c57('0x39')]?_0x37fad7['attributes']:_0xec5989[_0x2c57('0x31')];_0x37fad7[_0x2c57('0x3b')]=qs[_0x2c57('0x3c')](_0x2bf69f['query'][_0x2c57('0x3c')]);_0x37fad7[_0x2c57('0x3d')]=qs[_0x2c57('0x35')](_['pick'](_0x2bf69f[_0x2c57('0x33')],_0xec5989[_0x2c57('0x35')]));if(_0x2bf69f[_0x2c57('0x33')][_0x2c57('0x3f')]){_0x37fad7[_0x2c57('0x3d')]=_[_0x2c57('0x40')](_0x37fad7[_0x2c57('0x3d')],{'$or':_['map'](_0x37fad7[_0x2c57('0x37')],function(_0x3c0d9e){var _0xe1884b={};_0xe1884b[_0x3c0d9e]={'$like':'%'+_0x2bf69f[_0x2c57('0x33')][_0x2c57('0x3f')]+'%'};return _0xe1884b;})});}_0x37fad7=_[_0x2c57('0x40')]({},_0x37fad7,_0x2bf69f[_0x2c57('0x42')]);return _0x49988e[_0x2c57('0x84')](_0x37fad7);}})[_0x2c57('0x25')](function(_0x410709){if(_0x410709){_0x5e1fa1=_0x410709[_0x2c57('0x39')];if(!_0x2bf69f['query'][_0x2c57('0x3a')](_0x2c57('0x5c'))){_0x37fad7[_0x2c57('0x1e')]=qs[_0x2c57('0x1e')](_0x2bf69f[_0x2c57('0x33')]['limit']);_0x37fad7[_0x2c57('0x1b')]=qs[_0x2c57('0x1b')](_0x2bf69f[_0x2c57('0x33')]['offset']);}return _0x49988e[_0x2c57('0x84')](_0x37fad7);}})[_0x2c57('0x25')](function(_0x56e2dd){if(_0x56e2dd){return _0x56e2dd?{'count':_0x5e1fa1,'rows':_0x56e2dd}:null;}})['then'](respondWithResult(_0xa9eb6d,null))[_0x2c57('0x46')](handleError(_0xa9eb6d,null));};exports[_0x2c57('0x85')]=function(_0x569644,_0x506dc5,_0x1191e7){var _0x2cdd3a,_0x48d889;return db[_0x2c57('0x2c')][_0x2c57('0x49')]({'where':{'id':_0x569644[_0x2c57('0x47')]['id']}})[_0x2c57('0x25')](handleEntityNotFound(_0x506dc5,null))['then'](function(_0x1c408a){if(_0x1c408a){_0x48d889=_0x1c408a;return _0x1c408a[_0x2c57('0x85')](_0x569644[_0x2c57('0x58')]['ids'],_[_0x2c57('0x55')](_0x569644[_0x2c57('0x58')],['ids','id'])||{});}return null;})['spread'](function(_0x2074e0){var _0x397fe2;_0x2cdd3a=_0x2074e0||[];var _0x153656=[];if(_0x2074e0){for(var _0xa0cac3=0x0;_0xa0cac3<_0x2074e0[_0x2c57('0x39')];_0xa0cac3+=0x1){var _0xc1b2dd=_0x2074e0[_0xa0cac3][_0x2c57('0x4e')]({'plain':!![]});_0x397fe2=squel[_0x2c57('0x68')]()['into']('cm_hopper_black')[_0x2c57('0x6b')]([_0x2c57('0x6c'),'ContactId',_0x2c57('0x6f'),_0x2c57('0x5d'),_0x2c57('0x56'),_0x2c57('0x57')],squel[_0x2c57('0x70')]()[_0x2c57('0x71')]('phone',_0x2c57('0x6c'))['field']('id','ContactId')[_0x2c57('0x71')](_0xc1b2dd[_0x2c57('0x72')][_0x2c57('0x73')](),_0x2c57('0x6f'))[_0x2c57('0x71')](_0x569644[_0x2c57('0x47')]['id'][_0x2c57('0x73')](),'CampaignId')['field'](_0x2c57('0x74'),_0x2c57('0x56'))[_0x2c57('0x71')](_0x2c57('0x74'),'updatedAt')[_0x2c57('0x75')]('cm_contacts')[_0x2c57('0x3d')]('deletedAt\x20IS\x20NULL')[_0x2c57('0x3d')](_0x2c57('0x77'),_0xc1b2dd['CmListId'][_0x2c57('0x73')]())[_0x2c57('0x3d')](_0x2c57('0x78')))[_0x2c57('0x73')]();_0x153656[_0x2c57('0x7f')](db[_0x2c57('0x80')]['query'](_0x397fe2));}return BPromise[_0x2c57('0x81')](_0x153656);}})[_0x2c57('0x25')](function(){return _0x2cdd3a;})[_0x2c57('0x25')](respondWithResult(_0x506dc5,null))['catch'](handleError(_0x506dc5,null));};exports['removeBlackLists']=function(_0x4d1257,_0x13f1a0,_0x54a8d2){return db[_0x2c57('0x2c')][_0x2c57('0x49')]({'where':{'id':_0x4d1257[_0x2c57('0x47')]['id']}})[_0x2c57('0x25')](handleEntityNotFound(_0x13f1a0,null))[_0x2c57('0x25')](function(_0x22a09e){if(_0x22a09e){return _0x22a09e[_0x2c57('0x86')](_0x4d1257[_0x2c57('0x33')][_0x2c57('0x83')]);}})[_0x2c57('0x25')](function(_0x489cb6){if(_0x489cb6){return db[_0x2c57('0x62')][_0x2c57('0x27')]({'where':{'ListId':_0x4d1257['query'][_0x2c57('0x83')],'CampaignId':_0x4d1257[_0x2c57('0x47')]['id']}})[_0x2c57('0x25')](function(){return _0x489cb6;});}})[_0x2c57('0x25')](respondWithStatusCode(_0x13f1a0,null))[_0x2c57('0x46')](handleError(_0x13f1a0,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 7d1ba4b..5e24482 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(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_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 diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 5e5d364..d986083 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 _0xe356=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','Campaign,\x20%s,\x20%s','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','map','model','include','then','stringify','catch','lodash'];(function(_0xda66e7,_0x5120a2){var _0xe0bade=function(_0x4dcc00){while(--_0x4dcc00){_0xda66e7['push'](_0xda66e7['shift']());}};_0xe0bade(++_0x5120a2);}(_0xe356,0x1ee));var _0x6e35=function(_0x323474,_0x37cde7){_0x323474=_0x323474-0x0;var _0x4b732f=_0xe356[_0x323474];return _0x4b732f;};'use strict';var _=require(_0x6e35('0x0'));var util=require(_0x6e35('0x1'));var moment=require(_0x6e35('0x2'));var BPromise=require(_0x6e35('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e35('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e35('0x5'));var logger=require(_0x6e35('0x6'))(_0x6e35('0x7'));var config=require('../../config/environment');var jayson=require(_0x6e35('0x8'));var client=jayson[_0x6e35('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x389ae2,_0xba948e,_0x114b4c){return new BPromise(function(_0x1da99b,_0x5119fa){return client[_0x6e35('0xa')](_0x389ae2,_0x114b4c)['then'](function(_0x3b3c16){logger['info'](_0x6e35('0xb'),_0xba948e,'request\x20sent');logger['debug'](_0x6e35('0xc'),_0xba948e,_0x6e35('0xd'),JSON['stringify'](_0x3b3c16));if(_0x3b3c16['error']){if(_0x3b3c16[_0x6e35('0xe')][_0x6e35('0xf')]===0x1f4){logger[_0x6e35('0xe')]('Campaign,\x20%s,\x20%s',_0xba948e,_0x3b3c16[_0x6e35('0xe')][_0x6e35('0x10')]);return _0x5119fa(_0x3b3c16[_0x6e35('0xe')]['message']);}logger[_0x6e35('0xe')](_0x6e35('0xb'),_0xba948e,_0x3b3c16[_0x6e35('0xe')]['message']);return _0x1da99b(_0x3b3c16[_0x6e35('0xe')][_0x6e35('0x10')]);}else{logger[_0x6e35('0x11')]('Campaign,\x20%s,\x20%s',_0xba948e,_0x6e35('0xd'));_0x1da99b(_0x3b3c16[_0x6e35('0x12')][_0x6e35('0x10')]);}})['catch'](function(_0x3e7e7a){logger[_0x6e35('0xe')](_0x6e35('0xb'),_0xba948e,_0x3e7e7a);_0x5119fa(_0x3e7e7a);});});}exports[_0x6e35('0x13')]=function(_0x58a622){var _0x408504=this;return new Promise(function(_0x2bd771,_0x53e26d){return db[_0x6e35('0x14')][_0x6e35('0x15')]({'raw':_0x58a622[_0x6e35('0x16')]?_0x58a622[_0x6e35('0x16')][_0x6e35('0x17')]===undefined?!![]:![]:!![],'where':_0x58a622[_0x6e35('0x16')]?_0x58a622['options'][_0x6e35('0x18')]||null:null,'attributes':_0x58a622[_0x6e35('0x16')]?_0x58a622[_0x6e35('0x16')][_0x6e35('0x19')]||null:null,'limit':_0x58a622[_0x6e35('0x16')]?_0x58a622[_0x6e35('0x16')][_0x6e35('0x1a')]||null:null,'include':_0x58a622[_0x6e35('0x16')]?_0x58a622[_0x6e35('0x16')]['include']?_[_0x6e35('0x1b')](_0x58a622['options']['include'],function(_0x301c39){return{'model':db[_0x301c39[_0x6e35('0x1c')]],'as':_0x301c39['as'],'attributes':_0x301c39[_0x6e35('0x19')],'include':_0x301c39['include']?_[_0x6e35('0x1b')](_0x301c39[_0x6e35('0x1d')],function(_0x24afad){return{'model':db[_0x24afad[_0x6e35('0x1c')]],'as':_0x24afad['as'],'attributes':_0x24afad[_0x6e35('0x19')],'include':_0x24afad[_0x6e35('0x1d')]?_[_0x6e35('0x1b')](_0x24afad[_0x6e35('0x1d')],function(_0x353bfb){return{'model':db[_0x353bfb[_0x6e35('0x1c')]],'as':_0x353bfb['as'],'attributes':_0x353bfb['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e35('0x1e')](function(_0x30ae66){logger[_0x6e35('0x11')]('GetCampaign',_0x58a622);logger['debug'](_0x6e35('0x13'),_0x58a622,JSON[_0x6e35('0x1f')](_0x30ae66));_0x2bd771(_0x30ae66);})[_0x6e35('0x20')](function(_0x4f4514){logger['error'](_0x6e35('0x13'),_0x4f4514[_0x6e35('0x10')],_0x58a622);_0x53e26d(_0x408504[_0x6e35('0xe')](0x1f4,_0x4f4514['message']));});});}; \ No newline at end of file +var _0x4522=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','Campaign','options','raw','where','limit','include','map','model','attributes','info'];(function(_0x3a42fa,_0x55e471){var _0x30dcba=function(_0x3cc64b){while(--_0x3cc64b){_0x3a42fa['push'](_0x3a42fa['shift']());}};_0x30dcba(++_0x55e471);}(_0x4522,0x1a0));var _0x2452=function(_0x7858a3,_0x1fb0df){_0x7858a3=_0x7858a3-0x0;var _0x2c56ed=_0x4522[_0x7858a3];return _0x2c56ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2452('0x0'));var BPromise=require(_0x2452('0x1'));var rs=require(_0x2452('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2452('0x3'))['db'];var utils=require(_0x2452('0x4'));var logger=require(_0x2452('0x5'))(_0x2452('0x6'));var config=require(_0x2452('0x7'));var jayson=require(_0x2452('0x8'));var client=jayson[_0x2452('0x9')][_0x2452('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0139,_0x149807,_0x3bc193){return new BPromise(function(_0x33b935,_0x24073f){return client[_0x2452('0xb')](_0x2f0139,_0x3bc193)[_0x2452('0xc')](function(_0x2995b5){logger['info']('Campaign,\x20%s,\x20%s',_0x149807,_0x2452('0xd'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x149807,_0x2452('0xd'),JSON[_0x2452('0xe')](_0x2995b5));if(_0x2995b5[_0x2452('0xf')]){if(_0x2995b5[_0x2452('0xf')][_0x2452('0x10')]===0x1f4){logger[_0x2452('0xf')](_0x2452('0x11'),_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x24073f(_0x2995b5['error']['message']);}logger[_0x2452('0xf')]('Campaign,\x20%s,\x20%s',_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x33b935(_0x2995b5[_0x2452('0xf')][_0x2452('0x12')]);}else{logger['info'](_0x2452('0x11'),_0x149807,'request\x20sent');_0x33b935(_0x2995b5[_0x2452('0x13')][_0x2452('0x12')]);}})[_0x2452('0x14')](function(_0xdede20){logger['error'](_0x2452('0x11'),_0x149807,_0xdede20);_0x24073f(_0xdede20);});});}exports[_0x2452('0x15')]=function(_0x59d89a){var _0x4802ad=this;return new Promise(function(_0x1bfb44,_0x37c6a6){return db[_0x2452('0x16')]['findAll']({'raw':_0x59d89a[_0x2452('0x17')]?_0x59d89a[_0x2452('0x17')][_0x2452('0x18')]===undefined?!![]:![]:!![],'where':_0x59d89a[_0x2452('0x17')]?_0x59d89a[_0x2452('0x17')][_0x2452('0x19')]||null:null,'attributes':_0x59d89a[_0x2452('0x17')]?_0x59d89a[_0x2452('0x17')]['attributes']||null:null,'limit':_0x59d89a['options']?_0x59d89a[_0x2452('0x17')][_0x2452('0x1a')]||null:null,'include':_0x59d89a['options']?_0x59d89a[_0x2452('0x17')][_0x2452('0x1b')]?_[_0x2452('0x1c')](_0x59d89a[_0x2452('0x17')][_0x2452('0x1b')],function(_0x397f21){return{'model':db[_0x397f21[_0x2452('0x1d')]],'as':_0x397f21['as'],'attributes':_0x397f21['attributes'],'include':_0x397f21[_0x2452('0x1b')]?_[_0x2452('0x1c')](_0x397f21[_0x2452('0x1b')],function(_0x231410){return{'model':db[_0x231410[_0x2452('0x1d')]],'as':_0x231410['as'],'attributes':_0x231410['attributes'],'include':_0x231410['include']?_[_0x2452('0x1c')](_0x231410[_0x2452('0x1b')],function(_0x46fcbb){return{'model':db[_0x46fcbb[_0x2452('0x1d')]],'as':_0x46fcbb['as'],'attributes':_0x46fcbb[_0x2452('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fba00){logger[_0x2452('0x1f')]('GetCampaign',_0x59d89a);logger['debug'](_0x2452('0x15'),_0x59d89a,JSON[_0x2452('0xe')](_0x3fba00));_0x1bfb44(_0x3fba00);})[_0x2452('0x14')](function(_0x28e6ea){logger[_0x2452('0xf')](_0x2452('0x15'),_0x28e6ea['message'],_0x59d89a);_0x37c6a6(_0x4802ad['error'](0x1f4,_0x28e6ea[_0x2452('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 7f417cc..4752617 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 _0xc6d9=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addBlackLists','removeBlackLists','exports','util','path'];(function(_0x351e51,_0x337d1a){var _0x169cce=function(_0x893459){while(--_0x893459){_0x351e51['push'](_0x351e51['shift']());}};_0x169cce(++_0x337d1a);}(_0xc6d9,0xd0));var _0x9c6d=function(_0x1172a7,_0x23f9ee){_0x1172a7=_0x1172a7-0x0;var _0x5badf9=_0xc6d9[_0x1172a7];return _0x5badf9;};'use strict';var multer=require('multer');var util=require(_0x9c6d('0x0'));var path=require(_0x9c6d('0x1'));var timeout=require(_0x9c6d('0x2'));var express=require(_0x9c6d('0x3'));var router=express[_0x9c6d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9c6d('0x5'));var interaction=require(_0x9c6d('0x6'));var config=require(_0x9c6d('0x7'));var controller=require('./campaign.controller');router[_0x9c6d('0x8')]('/',auth[_0x9c6d('0x9')](),controller[_0x9c6d('0xa')]);router[_0x9c6d('0x8')](_0x9c6d('0xb'),auth[_0x9c6d('0x9')](),controller[_0x9c6d('0xc')]);router['get'](_0x9c6d('0xd'),auth[_0x9c6d('0x9')](),controller[_0x9c6d('0xe')]);router[_0x9c6d('0x8')](_0x9c6d('0xf'),auth[_0x9c6d('0x9')](),controller[_0x9c6d('0x10')]);router['get'](_0x9c6d('0x11'),auth[_0x9c6d('0x9')](),controller['getHopperFinals']);router[_0x9c6d('0x8')]('/:id/hopper_black',auth[_0x9c6d('0x9')](),controller[_0x9c6d('0x12')]);router['get'](_0x9c6d('0x13'),auth[_0x9c6d('0x9')](),controller[_0x9c6d('0x14')]);router[_0x9c6d('0x8')](_0x9c6d('0x15'),auth[_0x9c6d('0x9')](),controller[_0x9c6d('0x16')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9c6d('0x17')]);router[_0x9c6d('0x18')](_0x9c6d('0x19'),auth[_0x9c6d('0x9')](),controller[_0x9c6d('0x1a')]);router[_0x9c6d('0x18')](_0x9c6d('0x13'),auth[_0x9c6d('0x9')](),controller['addLists']);router['post'](_0x9c6d('0x15'),auth[_0x9c6d('0x9')](),controller[_0x9c6d('0x1b')]);router['put'](_0x9c6d('0xb'),auth[_0x9c6d('0x9')](),controller['update']);router['delete'](_0x9c6d('0xb'),auth[_0x9c6d('0x9')](),controller['destroy']);router['delete'](_0x9c6d('0x13'),auth[_0x9c6d('0x9')](),controller['removeLists']);router['delete'](_0x9c6d('0x15'),auth[_0x9c6d('0x9')](),controller[_0x9c6d('0x1c')]);module[_0x9c6d('0x1d')]=router; \ No newline at end of file +var _0xc4a7=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','/:id/lists','addBlackLists','put','delete','destroy','removeLists','exports'];(function(_0x467b61,_0x519884){var _0x5443f6=function(_0x34d693){while(--_0x34d693){_0x467b61['push'](_0x467b61['shift']());}};_0x5443f6(++_0x519884);}(_0xc4a7,0x132));var _0x7c4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc4a7[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x7c4a('0x0'));var util=require(_0x7c4a('0x1'));var path=require(_0x7c4a('0x2'));var timeout=require(_0x7c4a('0x3'));var express=require(_0x7c4a('0x4'));var router=express[_0x7c4a('0x5')]();var fs_extra=require(_0x7c4a('0x6'));var auth=require(_0x7c4a('0x7'));var interaction=require(_0x7c4a('0x8'));var config=require('../../config/environment');var controller=require(_0x7c4a('0x9'));router[_0x7c4a('0xa')]('/',auth[_0x7c4a('0xb')](),controller[_0x7c4a('0xc')]);router[_0x7c4a('0xa')](_0x7c4a('0xd'),auth['isAuthenticated'](),controller[_0x7c4a('0xe')]);router[_0x7c4a('0xa')](_0x7c4a('0xf'),auth[_0x7c4a('0xb')](),controller[_0x7c4a('0x10')]);router[_0x7c4a('0xa')]('/:id/hopper_histories',auth[_0x7c4a('0xb')](),controller[_0x7c4a('0x11')]);router['get'](_0x7c4a('0x12'),auth['isAuthenticated'](),controller[_0x7c4a('0x13')]);router[_0x7c4a('0xa')]('/:id/hopper_black',auth[_0x7c4a('0xb')](),controller['getHopperBlacks']);router[_0x7c4a('0xa')]('/:id/lists',auth[_0x7c4a('0xb')](),controller[_0x7c4a('0x14')]);router[_0x7c4a('0xa')](_0x7c4a('0x15'),auth[_0x7c4a('0xb')](),controller[_0x7c4a('0x16')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7c4a('0x17')]);router[_0x7c4a('0x18')](_0x7c4a('0x19'),auth[_0x7c4a('0xb')](),controller[_0x7c4a('0x1a')]);router[_0x7c4a('0x18')](_0x7c4a('0x1b'),auth[_0x7c4a('0xb')](),controller['addLists']);router[_0x7c4a('0x18')](_0x7c4a('0x15'),auth['isAuthenticated'](),controller[_0x7c4a('0x1c')]);router[_0x7c4a('0x1d')](_0x7c4a('0xd'),auth[_0x7c4a('0xb')](),controller['update']);router[_0x7c4a('0x1e')](_0x7c4a('0xd'),auth[_0x7c4a('0xb')](),controller[_0x7c4a('0x1f')]);router[_0x7c4a('0x1e')](_0x7c4a('0x1b'),auth[_0x7c4a('0xb')](),controller[_0x7c4a('0x20')]);router['delete']('/:id/blacklists',auth[_0x7c4a('0xb')](),controller['removeBlackLists']);module[_0x7c4a('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 1ff8642..6fcda0f 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 _0x6eee=['STRING','getDataValue','key','sequelize','exports','TEXT'];(function(_0x1a8132,_0x1d4978){var _0x5b9329=function(_0x1f1447){while(--_0x1f1447){_0x1a8132['push'](_0x1a8132['shift']());}};_0x5b9329(++_0x1d4978);}(_0x6eee,0x1ef));var _0xe6ee=function(_0x1495c4,_0x4a2fd4){_0x1495c4=_0x1495c4-0x0;var _0x24e8b0=_0x6eee[_0x1495c4];return _0x24e8b0;};'use strict';var Sequelize=require(_0xe6ee('0x0'));module[_0xe6ee('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xe6ee('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe6ee('0x3')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xe6ee('0x4')](_0xe6ee('0x5'));}}}; \ No newline at end of file +var _0x4c09=['STRING','getDataValue','key','sequelize','TEXT'];(function(_0x378e65,_0x43692a){var _0x3e43eb=function(_0x355a3f){while(--_0x355a3f){_0x378e65['push'](_0x378e65['shift']());}};_0x3e43eb(++_0x43692a);}(_0x4c09,0x12a));var _0x94c0=function(_0x8eb9d,_0x320ee6){_0x8eb9d=_0x8eb9d-0x0;var _0x28c28=_0x4c09[_0x8eb9d];return _0x28c28;};'use strict';var Sequelize=require(_0x94c0('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x94c0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x94c0('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x94c0('0x3')](_0x94c0('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index c54c784..85da4b9 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 _0xb03e=['includeAll','include','findAll','rows','catch','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','UserProfileSection','userProfileId','autoAssociation','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','CannedAnswers','UserProfileResource','destroy','error','stack','name','send','index','CannedAnswer','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options'];(function(_0x4e8144,_0x3e0b99){var _0x58342f=function(_0x1f778e){while(--_0x1f778e){_0x4e8144['push'](_0x4e8144['shift']());}};_0x58342f(++_0x3e0b99);}(_0xb03e,0x12b));var _0xeb03=function(_0xbd2f63,_0x34bda6){_0xbd2f63=_0xbd2f63-0x0;var _0x3cf268=_0xb03e[_0xbd2f63];return _0x3cf268;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb03('0x0'));var zipdir=require(_0xeb03('0x1'));var jsonpatch=require(_0xeb03('0x2'));var rp=require(_0xeb03('0x3'));var moment=require(_0xeb03('0x4'));var BPromise=require(_0xeb03('0x5'));var Mustache=require(_0xeb03('0x6'));var util=require(_0xeb03('0x7'));var path=require(_0xeb03('0x8'));var sox=require(_0xeb03('0x9'));var csv=require(_0xeb03('0xa'));var ejs=require(_0xeb03('0xb'));var fs=require('fs');var fs_extra=require(_0xeb03('0xc'));var _=require(_0xeb03('0xd'));var squel=require(_0xeb03('0xe'));var crypto=require(_0xeb03('0xf'));var jsforce=require(_0xeb03('0x10'));var deskjs=require(_0xeb03('0x11'));var toCsv=require(_0xeb03('0xa'));var querystring=require(_0xeb03('0x12'));var Papa=require(_0xeb03('0x13'));var Redis=require('ioredis');var authService=require(_0xeb03('0x14'));var qs=require(_0xeb03('0x15'));var as=require(_0xeb03('0x16'));var hardwareService=require(_0xeb03('0x17'));var logger=require(_0xeb03('0x18'))(_0xeb03('0x19'));var utils=require(_0xeb03('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xeb03('0x1b'));var db=require(_0xeb03('0x1c'))['db'];function respondWithStatusCode(_0x32d6b2,_0x45a9a7){_0x45a9a7=_0x45a9a7||0xcc;return function(_0x585b46){if(_0x585b46){return _0x32d6b2[_0xeb03('0x1d')](_0x45a9a7);}return _0x32d6b2[_0xeb03('0x1e')](_0x45a9a7)[_0xeb03('0x1f')]();};}function respondWithResult(_0x30be93,_0x657818){_0x657818=_0x657818||0xc8;return function(_0x442ac2){if(_0x442ac2){return _0x30be93['status'](_0x657818)[_0xeb03('0x20')](_0x442ac2);}};}function respondWithFilteredResult(_0x10d306,_0x4d8e49){return function(_0x1d8ddc){if(_0x1d8ddc){var _0x5ce478=typeof _0x4d8e49[_0xeb03('0x21')]===_0xeb03('0x22')&&typeof _0x4d8e49[_0xeb03('0x23')]===_0xeb03('0x22');var _0x187472=_0x1d8ddc['count'];var _0x1d6a50=_0x5ce478?0x0:_0x4d8e49[_0xeb03('0x21')];var _0x49aa82=_0x5ce478?_0x1d8ddc[_0xeb03('0x24')]:_0x4d8e49[_0xeb03('0x21')]+_0x4d8e49[_0xeb03('0x23')];var _0x38560d;if(_0x49aa82>=_0x187472){_0x49aa82=_0x187472;_0x38560d=0xc8;}else{_0x38560d=0xce;}_0x10d306[_0xeb03('0x1e')](_0x38560d);return _0x10d306[_0xeb03('0x25')]('Content-Range',_0x1d6a50+'-'+_0x49aa82+'/'+_0x187472)[_0xeb03('0x20')](_0x1d8ddc);}return null;};}function patchUpdates(_0x4280a5){return function(_0x90853c){try{jsonpatch[_0xeb03('0x26')](_0x90853c,_0x4280a5,!![]);}catch(_0x385908){return BPromise[_0xeb03('0x27')](_0x385908);}return _0x90853c['save']();};}function saveUpdates(_0x41436b,_0x13bdff){return function(_0x4454dc){if(_0x4454dc){return _0x4454dc[_0xeb03('0x28')](_0x41436b)[_0xeb03('0x29')](function(_0x2ef095){return _0x2ef095;});}return null;};}function removeEntity(_0x43b490,_0x2674fe){return function(_0x3e043a){if(_0x3e043a){return _0x3e043a['destroy']()[_0xeb03('0x29')](function(){var _0x435aae=_0x3e043a['get']({'plain':!![]});var _0x28645a=_0xeb03('0x2a');return db[_0xeb03('0x2b')][_0xeb03('0x2c')]({'where':{'type':_0x28645a,'resourceId':_0x435aae['id']}})[_0xeb03('0x29')](function(){return _0x3e043a;});})[_0xeb03('0x29')](function(){_0x43b490['status'](0xcc)[_0xeb03('0x1f')]();});}};}function handleEntityNotFound(_0x3dd818,_0x8c3ba3){return function(_0x4bd353){if(!_0x4bd353){_0x3dd818[_0xeb03('0x1d')](0x194);}return _0x4bd353;};}function handleError(_0xac72e,_0x398f27){_0x398f27=_0x398f27||0x1f4;return function(_0xc9103f){logger[_0xeb03('0x2d')](_0xc9103f[_0xeb03('0x2e')]);if(_0xc9103f[_0xeb03('0x2f')]){delete _0xc9103f[_0xeb03('0x2f')];}_0xac72e[_0xeb03('0x1e')](_0x398f27)[_0xeb03('0x30')](_0xc9103f);};}exports[_0xeb03('0x31')]=function(_0x381b4d,_0x2032ba){var _0x5b055b={},_0x30166d={},_0xf062de={'count':0x0,'rows':[]};var _0xb30f61=_['map'](db[_0xeb03('0x32')][_0xeb03('0x33')],function(_0x2302f4){return{'name':_0x2302f4[_0xeb03('0x34')],'type':_0x2302f4[_0xeb03('0x35')][_0xeb03('0x36')]};});_0x30166d[_0xeb03('0x37')]=_[_0xeb03('0x38')](_0xb30f61,_0xeb03('0x2f'));_0x30166d[_0xeb03('0x39')]=_[_0xeb03('0x3a')](_0x381b4d[_0xeb03('0x39')]);_0x30166d[_0xeb03('0x3b')]=_['intersection'](_0x30166d[_0xeb03('0x37')],_0x30166d[_0xeb03('0x39')]);_0x5b055b[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x30166d[_0xeb03('0x37')],qs['fields'](_0x381b4d[_0xeb03('0x39')][_0xeb03('0x3e')]));_0x5b055b[_0xeb03('0x3c')]=_0x5b055b[_0xeb03('0x3c')][_0xeb03('0x3f')]?_0x5b055b[_0xeb03('0x3c')]:_0x30166d[_0xeb03('0x37')];if(!_0x381b4d[_0xeb03('0x39')][_0xeb03('0x40')](_0xeb03('0x41'))){_0x5b055b[_0xeb03('0x23')]=qs['limit'](_0x381b4d['query'][_0xeb03('0x23')]);_0x5b055b[_0xeb03('0x21')]=qs['offset'](_0x381b4d[_0xeb03('0x39')][_0xeb03('0x21')]);}_0x5b055b[_0xeb03('0x42')]=qs[_0xeb03('0x43')](_0x381b4d[_0xeb03('0x39')][_0xeb03('0x43')]);_0x5b055b[_0xeb03('0x44')]=qs[_0xeb03('0x3b')](_[_0xeb03('0x45')](_0x381b4d[_0xeb03('0x39')],_0x30166d[_0xeb03('0x3b')]),_0xb30f61);if(_0x381b4d[_0xeb03('0x39')]['filter']){_0x5b055b['where']=_[_0xeb03('0x46')](_0x5b055b[_0xeb03('0x44')],{'$or':[{'key':{'$like':'%'+_0x381b4d[_0xeb03('0x39')][_0xeb03('0x47')]+'%'}},{'value':{'$like':'%'+_0x381b4d[_0xeb03('0x39')][_0xeb03('0x47')]+'%'}}]});}_0x5b055b=_[_0xeb03('0x46')]({},_0x5b055b,_0x381b4d[_0xeb03('0x48')]);var _0xb0397f={'where':_0x5b055b[_0xeb03('0x44')]};return db['CannedAnswer']['count'](_0xb0397f)[_0xeb03('0x29')](function(_0xcf29b0){_0xf062de[_0xeb03('0x24')]=_0xcf29b0;if(_0x381b4d[_0xeb03('0x39')][_0xeb03('0x49')]){_0x5b055b[_0xeb03('0x4a')]=[{'all':!![]}];}return db['CannedAnswer'][_0xeb03('0x4b')](_0x5b055b);})['then'](function(_0x4a0e38){_0xf062de[_0xeb03('0x4c')]=_0x4a0e38;return _0xf062de;})[_0xeb03('0x29')](respondWithFilteredResult(_0x2032ba,_0x5b055b))[_0xeb03('0x4d')](handleError(_0x2032ba,null));};exports['show']=function(_0x92bb3,_0x5cc4f5){var _0x26b326={'raw':!![],'where':{'id':_0x92bb3[_0xeb03('0x4e')]['id']}},_0x353fde={};_0x353fde['model']=_[_0xeb03('0x3a')](db[_0xeb03('0x32')]['rawAttributes']);_0x353fde[_0xeb03('0x39')]=_[_0xeb03('0x3a')](_0x92bb3['query']);_0x353fde[_0xeb03('0x3b')]=_[_0xeb03('0x3d')](_0x353fde['model'],_0x353fde[_0xeb03('0x39')]);_0x26b326[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x353fde[_0xeb03('0x37')],qs[_0xeb03('0x3e')](_0x92bb3['query'][_0xeb03('0x3e')]));_0x26b326[_0xeb03('0x3c')]=_0x26b326[_0xeb03('0x3c')]['length']?_0x26b326[_0xeb03('0x3c')]:_0x353fde[_0xeb03('0x37')];if(_0x92bb3[_0xeb03('0x39')][_0xeb03('0x49')]){_0x26b326['include']=[{'all':!![]}];}_0x26b326=_[_0xeb03('0x46')]({},_0x26b326,_0x92bb3[_0xeb03('0x48')]);return db[_0xeb03('0x32')][_0xeb03('0x4f')](_0x26b326)[_0xeb03('0x29')](handleEntityNotFound(_0x5cc4f5,null))[_0xeb03('0x29')](respondWithResult(_0x5cc4f5,null))['catch'](handleError(_0x5cc4f5,null));};exports[_0xeb03('0x28')]=function(_0x547e39,_0x1ff353){if(_0x547e39[_0xeb03('0x50')]['id']){delete _0x547e39[_0xeb03('0x50')]['id'];}return db[_0xeb03('0x32')][_0xeb03('0x4f')]({'where':{'id':_0x547e39[_0xeb03('0x4e')]['id']}})[_0xeb03('0x29')](handleEntityNotFound(_0x1ff353,null))[_0xeb03('0x29')](saveUpdates(_0x547e39[_0xeb03('0x50')],null))[_0xeb03('0x29')](respondWithResult(_0x1ff353,null))[_0xeb03('0x4d')](handleError(_0x1ff353,null));};exports[_0xeb03('0x2c')]=function(_0x5b43fd,_0x4ad85d){return db[_0xeb03('0x32')][_0xeb03('0x4f')]({'where':{'id':_0x5b43fd['params']['id']}})[_0xeb03('0x29')](handleEntityNotFound(_0x4ad85d,null))['then'](removeEntity(_0x4ad85d,null))[_0xeb03('0x4d')](handleError(_0x4ad85d,null));};exports[_0xeb03('0x51')]=function(_0x3fed3d,_0x3068b0){var _0x3691b1={'key':_0x3fed3d[_0xeb03('0x50')][_0xeb03('0x36')]};if(_0x3fed3d[_0xeb03('0x50')][_0xeb03('0x52')]){_0x3691b1[_0xeb03('0x52')]=_0x3fed3d['body'][_0xeb03('0x52')];}else if(_0x3fed3d[_0xeb03('0x50')]['SmsAccountId']){_0x3691b1[_0xeb03('0x53')]=_0x3fed3d['body'][_0xeb03('0x53')];}else if(_0x3fed3d[_0xeb03('0x50')][_0xeb03('0x54')]){_0x3691b1[_0xeb03('0x54')]=_0x3fed3d[_0xeb03('0x50')][_0xeb03('0x54')];}else if(_0x3fed3d[_0xeb03('0x50')]['ChatWebsiteId']){_0x3691b1['ChatWebsiteId']=_0x3fed3d[_0xeb03('0x50')][_0xeb03('0x55')];}return db[_0xeb03('0x32')]['find']({'where':_0x3691b1})[_0xeb03('0x29')](function(_0x1bf4fd){if(_0x1bf4fd){throw new db[(_0xeb03('0x56'))][(_0xeb03('0x57'))](_0xeb03('0x58'));}return db[_0xeb03('0x32')][_0xeb03('0x51')](_0x3fed3d[_0xeb03('0x50')]);})[_0xeb03('0x29')](function(_0x179c8a){var _0x5f24b1=_0x3fed3d[_0xeb03('0x59')]['get']({'plain':!![]});if(!_0x5f24b1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f24b1['role']===_0xeb03('0x59')){var _0x58f0ca=_0x179c8a['get']({'plain':!![]});return db[_0xeb03('0x5a')][_0xeb03('0x4f')]({'where':{'name':_0xeb03('0x2a'),'userProfileId':_0x5f24b1[_0xeb03('0x5b')]},'raw':!![]})[_0xeb03('0x29')](function(_0x1b0284){if(_0x1b0284&&_0x1b0284[_0xeb03('0x5c')]===0x0){return db[_0xeb03('0x2b')][_0xeb03('0x51')]({'name':_0x58f0ca[_0xeb03('0x2f')],'resourceId':_0x58f0ca['id'],'type':_0x1b0284['name'],'sectionId':_0x1b0284['id']},{})[_0xeb03('0x29')](function(){return _0x179c8a;});}else{return _0x179c8a;}})['catch'](function(_0x5bb44a){logger[_0xeb03('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bb44a);throw _0x5bb44a;});}return _0x179c8a;})[_0xeb03('0x29')](respondWithResult(_0x3068b0,0xc9))['catch'](handleError(_0x3068b0,null));}; \ No newline at end of file +var _0xfa5d=['Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','options','includeAll','include','findAll','show','params','length','find','catch','body','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','create','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x586518,_0x1998d4){var _0x12e942=function(_0x2f6a7d){while(--_0x2f6a7d){_0x586518['push'](_0x586518['shift']());}};_0x12e942(++_0x1998d4);}(_0xfa5d,0x8e));var _0xdfa5=function(_0x4b26ac,_0x50470a){_0x4b26ac=_0x4b26ac-0x0;var _0x109499=_0xfa5d[_0x4b26ac];return _0x109499;};'use strict';var emlformat=require(_0xdfa5('0x0'));var rimraf=require(_0xdfa5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdfa5('0x2'));var rp=require(_0xdfa5('0x3'));var moment=require(_0xdfa5('0x4'));var BPromise=require(_0xdfa5('0x5'));var Mustache=require(_0xdfa5('0x6'));var util=require('util');var path=require(_0xdfa5('0x7'));var sox=require(_0xdfa5('0x8'));var csv=require(_0xdfa5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdfa5('0xa'));var _=require(_0xdfa5('0xb'));var squel=require(_0xdfa5('0xc'));var crypto=require(_0xdfa5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdfa5('0xe'));var toCsv=require(_0xdfa5('0x9'));var querystring=require('querystring');var Papa=require(_0xdfa5('0xf'));var Redis=require(_0xdfa5('0x10'));var authService=require(_0xdfa5('0x11'));var qs=require(_0xdfa5('0x12'));var as=require(_0xdfa5('0x13'));var hardwareService=require(_0xdfa5('0x14'));var logger=require(_0xdfa5('0x15'))(_0xdfa5('0x16'));var utils=require(_0xdfa5('0x17'));var config=require(_0xdfa5('0x18'));var licenseUtil=require(_0xdfa5('0x19'));var db=require(_0xdfa5('0x1a'))['db'];function respondWithStatusCode(_0x1c900c,_0x2681dd){_0x2681dd=_0x2681dd||0xcc;return function(_0xd10f57){if(_0xd10f57){return _0x1c900c[_0xdfa5('0x1b')](_0x2681dd);}return _0x1c900c[_0xdfa5('0x1c')](_0x2681dd)[_0xdfa5('0x1d')]();};}function respondWithResult(_0x570e89,_0x2d11c0){_0x2d11c0=_0x2d11c0||0xc8;return function(_0x31c3f7){if(_0x31c3f7){return _0x570e89[_0xdfa5('0x1c')](_0x2d11c0)[_0xdfa5('0x1e')](_0x31c3f7);}};}function respondWithFilteredResult(_0x6c3a01,_0x15ddc7){return function(_0x10faa7){if(_0x10faa7){var _0x5158b3=typeof _0x15ddc7[_0xdfa5('0x1f')]===_0xdfa5('0x20')&&typeof _0x15ddc7[_0xdfa5('0x21')]==='undefined';var _0xb75e4f=_0x10faa7[_0xdfa5('0x22')];var _0xd3323d=_0x5158b3?0x0:_0x15ddc7[_0xdfa5('0x1f')];var _0x1dbcfb=_0x5158b3?_0x10faa7[_0xdfa5('0x22')]:_0x15ddc7[_0xdfa5('0x1f')]+_0x15ddc7[_0xdfa5('0x21')];var _0x4d0002;if(_0x1dbcfb>=_0xb75e4f){_0x1dbcfb=_0xb75e4f;_0x4d0002=0xc8;}else{_0x4d0002=0xce;}_0x6c3a01[_0xdfa5('0x1c')](_0x4d0002);return _0x6c3a01[_0xdfa5('0x23')](_0xdfa5('0x24'),_0xd3323d+'-'+_0x1dbcfb+'/'+_0xb75e4f)[_0xdfa5('0x1e')](_0x10faa7);}return null;};}function patchUpdates(_0x462db9){return function(_0x5db228){try{jsonpatch[_0xdfa5('0x25')](_0x5db228,_0x462db9,!![]);}catch(_0xf58462){return BPromise['reject'](_0xf58462);}return _0x5db228[_0xdfa5('0x26')]();};}function saveUpdates(_0x2b55b1,_0x59aef6){return function(_0x50be32){if(_0x50be32){return _0x50be32[_0xdfa5('0x27')](_0x2b55b1)[_0xdfa5('0x28')](function(_0x517ca8){return _0x517ca8;});}return null;};}function removeEntity(_0xc19348,_0x495925){return function(_0x4e6df9){if(_0x4e6df9){return _0x4e6df9[_0xdfa5('0x29')]()[_0xdfa5('0x28')](function(){var _0x206f90=_0x4e6df9[_0xdfa5('0x2a')]({'plain':!![]});var _0xbf8b97='CannedAnswers';return db[_0xdfa5('0x2b')][_0xdfa5('0x29')]({'where':{'type':_0xbf8b97,'resourceId':_0x206f90['id']}})[_0xdfa5('0x28')](function(){return _0x4e6df9;});})[_0xdfa5('0x28')](function(){_0xc19348[_0xdfa5('0x1c')](0xcc)[_0xdfa5('0x1d')]();});}};}function handleEntityNotFound(_0x32b82c,_0x552183){return function(_0xbd1620){if(!_0xbd1620){_0x32b82c[_0xdfa5('0x1b')](0x194);}return _0xbd1620;};}function handleError(_0x26ea68,_0x491c8f){_0x491c8f=_0x491c8f||0x1f4;return function(_0x279aa4){logger[_0xdfa5('0x2c')](_0x279aa4[_0xdfa5('0x2d')]);if(_0x279aa4['name']){delete _0x279aa4[_0xdfa5('0x2e')];}_0x26ea68[_0xdfa5('0x1c')](_0x491c8f)['send'](_0x279aa4);};}exports[_0xdfa5('0x2f')]=function(_0x23d631,_0x2c6db8){var _0x16b442={},_0x486d04={},_0x21efdc={'count':0x0,'rows':[]};var _0x1a16ee=_[_0xdfa5('0x30')](db[_0xdfa5('0x31')][_0xdfa5('0x32')],function(_0xa11de7){return{'name':_0xa11de7[_0xdfa5('0x33')],'type':_0xa11de7[_0xdfa5('0x34')][_0xdfa5('0x35')]};});_0x486d04[_0xdfa5('0x36')]=_[_0xdfa5('0x30')](_0x1a16ee,_0xdfa5('0x2e'));_0x486d04[_0xdfa5('0x37')]=_[_0xdfa5('0x38')](_0x23d631[_0xdfa5('0x37')]);_0x486d04[_0xdfa5('0x39')]=_[_0xdfa5('0x3a')](_0x486d04[_0xdfa5('0x36')],_0x486d04[_0xdfa5('0x37')]);_0x16b442[_0xdfa5('0x3b')]=_[_0xdfa5('0x3a')](_0x486d04['model'],qs[_0xdfa5('0x3c')](_0x23d631[_0xdfa5('0x37')][_0xdfa5('0x3c')]));_0x16b442[_0xdfa5('0x3b')]=_0x16b442['attributes']['length']?_0x16b442[_0xdfa5('0x3b')]:_0x486d04[_0xdfa5('0x36')];if(!_0x23d631['query'][_0xdfa5('0x3d')]('nolimit')){_0x16b442[_0xdfa5('0x21')]=qs[_0xdfa5('0x21')](_0x23d631[_0xdfa5('0x37')][_0xdfa5('0x21')]);_0x16b442[_0xdfa5('0x1f')]=qs[_0xdfa5('0x1f')](_0x23d631[_0xdfa5('0x37')]['offset']);}_0x16b442[_0xdfa5('0x3e')]=qs[_0xdfa5('0x3f')](_0x23d631[_0xdfa5('0x37')][_0xdfa5('0x3f')]);_0x16b442[_0xdfa5('0x40')]=qs[_0xdfa5('0x39')](_[_0xdfa5('0x41')](_0x23d631['query'],_0x486d04[_0xdfa5('0x39')]),_0x1a16ee);if(_0x23d631['query']['filter']){_0x16b442[_0xdfa5('0x40')]=_[_0xdfa5('0x42')](_0x16b442[_0xdfa5('0x40')],{'$or':[{'key':{'$like':'%'+_0x23d631['query']['filter']+'%'}},{'value':{'$like':'%'+_0x23d631[_0xdfa5('0x37')]['filter']+'%'}}]});}_0x16b442=_[_0xdfa5('0x42')]({},_0x16b442,_0x23d631[_0xdfa5('0x43')]);var _0x42afca={'where':_0x16b442[_0xdfa5('0x40')]};return db['CannedAnswer']['count'](_0x42afca)[_0xdfa5('0x28')](function(_0x241c62){_0x21efdc['count']=_0x241c62;if(_0x23d631[_0xdfa5('0x37')][_0xdfa5('0x44')]){_0x16b442[_0xdfa5('0x45')]=[{'all':!![]}];}return db[_0xdfa5('0x31')][_0xdfa5('0x46')](_0x16b442);})[_0xdfa5('0x28')](function(_0xb9b030){_0x21efdc['rows']=_0xb9b030;return _0x21efdc;})[_0xdfa5('0x28')](respondWithFilteredResult(_0x2c6db8,_0x16b442))['catch'](handleError(_0x2c6db8,null));};exports[_0xdfa5('0x47')]=function(_0x68a934,_0x554a3a){var _0x302435={'raw':!![],'where':{'id':_0x68a934[_0xdfa5('0x48')]['id']}},_0x41ff4f={};_0x41ff4f[_0xdfa5('0x36')]=_[_0xdfa5('0x38')](db['CannedAnswer']['rawAttributes']);_0x41ff4f[_0xdfa5('0x37')]=_[_0xdfa5('0x38')](_0x68a934['query']);_0x41ff4f['filters']=_[_0xdfa5('0x3a')](_0x41ff4f[_0xdfa5('0x36')],_0x41ff4f[_0xdfa5('0x37')]);_0x302435[_0xdfa5('0x3b')]=_[_0xdfa5('0x3a')](_0x41ff4f[_0xdfa5('0x36')],qs['fields'](_0x68a934[_0xdfa5('0x37')][_0xdfa5('0x3c')]));_0x302435[_0xdfa5('0x3b')]=_0x302435[_0xdfa5('0x3b')][_0xdfa5('0x49')]?_0x302435['attributes']:_0x41ff4f['model'];if(_0x68a934[_0xdfa5('0x37')][_0xdfa5('0x44')]){_0x302435['include']=[{'all':!![]}];}_0x302435=_[_0xdfa5('0x42')]({},_0x302435,_0x68a934['options']);return db[_0xdfa5('0x31')][_0xdfa5('0x4a')](_0x302435)[_0xdfa5('0x28')](handleEntityNotFound(_0x554a3a,null))[_0xdfa5('0x28')](respondWithResult(_0x554a3a,null))[_0xdfa5('0x4b')](handleError(_0x554a3a,null));};exports[_0xdfa5('0x27')]=function(_0x19d724,_0x879d3e){if(_0x19d724[_0xdfa5('0x4c')]['id']){delete _0x19d724['body']['id'];}return db[_0xdfa5('0x31')][_0xdfa5('0x4a')]({'where':{'id':_0x19d724[_0xdfa5('0x48')]['id']}})[_0xdfa5('0x28')](handleEntityNotFound(_0x879d3e,null))['then'](saveUpdates(_0x19d724[_0xdfa5('0x4c')],null))[_0xdfa5('0x28')](respondWithResult(_0x879d3e,null))[_0xdfa5('0x4b')](handleError(_0x879d3e,null));};exports[_0xdfa5('0x29')]=function(_0x2004d4,_0x28f7bb){return db['CannedAnswer'][_0xdfa5('0x4a')]({'where':{'id':_0x2004d4[_0xdfa5('0x48')]['id']}})[_0xdfa5('0x28')](handleEntityNotFound(_0x28f7bb,null))['then'](removeEntity(_0x28f7bb,null))[_0xdfa5('0x4b')](handleError(_0x28f7bb,null));};exports['create']=function(_0x5a0df5,_0x11d492){var _0x3bc02={'key':_0x5a0df5[_0xdfa5('0x4c')]['key']};if(_0x5a0df5[_0xdfa5('0x4c')]['MailAccountId']){_0x3bc02['MailAccountId']=_0x5a0df5[_0xdfa5('0x4c')]['MailAccountId'];}else if(_0x5a0df5['body'][_0xdfa5('0x4d')]){_0x3bc02[_0xdfa5('0x4d')]=_0x5a0df5[_0xdfa5('0x4c')][_0xdfa5('0x4d')];}else if(_0x5a0df5['body'][_0xdfa5('0x4e')]){_0x3bc02['OpenchannelAccountId']=_0x5a0df5[_0xdfa5('0x4c')][_0xdfa5('0x4e')];}else if(_0x5a0df5['body'][_0xdfa5('0x4f')]){_0x3bc02[_0xdfa5('0x4f')]=_0x5a0df5[_0xdfa5('0x4c')][_0xdfa5('0x4f')];}return db[_0xdfa5('0x31')][_0xdfa5('0x4a')]({'where':_0x3bc02})[_0xdfa5('0x28')](function(_0x301e5f){if(_0x301e5f){throw new db['Sequelize'][(_0xdfa5('0x50'))](_0xdfa5('0x51'));}return db[_0xdfa5('0x31')]['create'](_0x5a0df5[_0xdfa5('0x4c')]);})[_0xdfa5('0x28')](function(_0x3e4516){var _0x5d814a=_0x5a0df5[_0xdfa5('0x52')]['get']({'plain':!![]});if(!_0x5d814a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d814a[_0xdfa5('0x53')]==='user'){var _0x4158e0=_0x3e4516[_0xdfa5('0x2a')]({'plain':!![]});return db[_0xdfa5('0x54')][_0xdfa5('0x4a')]({'where':{'name':_0xdfa5('0x55'),'userProfileId':_0x5d814a[_0xdfa5('0x56')]},'raw':!![]})[_0xdfa5('0x28')](function(_0x6b3cec){if(_0x6b3cec&&_0x6b3cec[_0xdfa5('0x57')]===0x0){return db[_0xdfa5('0x2b')][_0xdfa5('0x58')]({'name':_0x4158e0[_0xdfa5('0x2e')],'resourceId':_0x4158e0['id'],'type':_0x6b3cec[_0xdfa5('0x2e')],'sectionId':_0x6b3cec['id']},{})[_0xdfa5('0x28')](function(){return _0x3e4516;});}else{return _0x3e4516;}})[_0xdfa5('0x4b')](function(_0x14808e){logger[_0xdfa5('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14808e);throw _0x14808e;});}return _0x3e4516;})[_0xdfa5('0x28')](respondWithResult(_0x11d492,0xc9))[_0xdfa5('0x4b')](handleError(_0x11d492,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 22328b4..14f0b9a 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 _0x0541=['../../config/logger','moment','bluebird','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util'];(function(_0x44bb23,_0x2c1b28){var _0x42147c=function(_0xb6e405){while(--_0xb6e405){_0x44bb23['push'](_0x44bb23['shift']());}};_0x42147c(++_0x2c1b28);}(_0x0541,0x1f2));var _0x1054=function(_0x548e1d,_0x3534d3){_0x548e1d=_0x548e1d-0x0;var _0x398584=_0x0541[_0x548e1d];return _0x398584;};'use strict';var _=require(_0x1054('0x0'));var util=require(_0x1054('0x1'));var logger=require(_0x1054('0x2'))('api');var moment=require(_0x1054('0x3'));var BPromise=require(_0x1054('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(_0x1054('0x5'));module['exports']=function(_0x5cdfff,_0x1a3a45){return _0x5cdfff[_0x1054('0x6')](_0x1054('0x7'),attributes,{'tableName':_0x1054('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1054('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5f36=['tools_canned_answers','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0x1a181c,_0x39e8ea){var _0x2c7d03=function(_0x2d1a05){while(--_0x2d1a05){_0x1a181c['push'](_0x1a181c['shift']());}};_0x2c7d03(++_0x39e8ea);}(_0x5f36,0x12c));var _0x65f3=function(_0x89a74f,_0x5eb47e){_0x89a74f=_0x89a74f-0x0;var _0x267754=_0x5f36[_0x89a74f];return _0x267754;};'use strict';var _=require(_0x65f3('0x0'));var util=require('util');var logger=require(_0x65f3('0x1'))(_0x65f3('0x2'));var moment=require(_0x65f3('0x3'));var BPromise=require(_0x65f3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x65f3('0x5'));var rimraf=require(_0x65f3('0x6'));var config=require(_0x65f3('0x7'));var attributes=require(_0x65f3('0x8'));module[_0x65f3('0x9')]=function(_0xf331ee,_0x18bd93){return _0xf331ee[_0x65f3('0xa')](_0x65f3('0xb'),attributes,{'tableName':_0x65f3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index d0000df..e69691f 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(_0x1d6198,_0x226b3e){var _0x2659d4=function(_0x27c563){while(--_0x27c563){_0x1d6198['push'](_0x1d6198['shift']());}};_0x2659d4(++_0x226b3e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x3fd1d8,_0x5a821d){var _0x30a08e=function(_0x59c355){while(--_0x59c355){_0x3fd1d8['push'](_0x3fd1d8['shift']());}};_0x30a08e(++_0x5a821d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 9757e03..1f0942e 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 _0xd8e7=['get','index','isAuthenticated','show','post','create','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x59b439,_0x14ae7b){var _0x521ea3=function(_0x5af627){while(--_0x5af627){_0x59b439['push'](_0x59b439['shift']());}};_0x521ea3(++_0x14ae7b);}(_0xd8e7,0x82));var _0x7d8e=function(_0x1c3665,_0x3c8c8e){_0x1c3665=_0x1c3665-0x0;var _0x4f6949=_0xd8e7[_0x1c3665];return _0x4f6949;};'use strict';var multer=require(_0x7d8e('0x0'));var util=require(_0x7d8e('0x1'));var path=require(_0x7d8e('0x2'));var timeout=require(_0x7d8e('0x3'));var express=require(_0x7d8e('0x4'));var router=express[_0x7d8e('0x5')]();var fs_extra=require(_0x7d8e('0x6'));var auth=require(_0x7d8e('0x7'));var interaction=require(_0x7d8e('0x8'));var config=require(_0x7d8e('0x9'));var controller=require('./cannedAnswer.controller');router[_0x7d8e('0xa')]('/',auth['isAuthenticated'](),controller[_0x7d8e('0xb')]);router[_0x7d8e('0xa')]('/:id',auth[_0x7d8e('0xc')](),controller[_0x7d8e('0xd')]);router[_0x7d8e('0xe')]('/',auth['isAuthenticated'](),controller[_0x7d8e('0xf')]);router[_0x7d8e('0x10')](_0x7d8e('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x7d8e('0x12')](_0x7d8e('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x7d8e('0x13')]=router; \ No newline at end of file +var _0x0ba3=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','post','create','put','delete','destroy','exports'];(function(_0x464f16,_0x2412ee){var _0x4793eb=function(_0x480166){while(--_0x480166){_0x464f16['push'](_0x464f16['shift']());}};_0x4793eb(++_0x2412ee);}(_0x0ba3,0x1b0));var _0x30ba=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x0ba3[_0x2261ce];return _0x524640;};'use strict';var multer=require(_0x30ba('0x0'));var util=require(_0x30ba('0x1'));var path=require(_0x30ba('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x30ba('0x3')]();var fs_extra=require(_0x30ba('0x4'));var auth=require(_0x30ba('0x5'));var interaction=require(_0x30ba('0x6'));var config=require(_0x30ba('0x7'));var controller=require(_0x30ba('0x8'));router[_0x30ba('0x9')]('/',auth[_0x30ba('0xa')](),controller['index']);router[_0x30ba('0x9')](_0x30ba('0xb'),auth[_0x30ba('0xa')](),controller['show']);router[_0x30ba('0xc')]('/',auth[_0x30ba('0xa')](),controller[_0x30ba('0xd')]);router[_0x30ba('0xe')](_0x30ba('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x30ba('0xf')](_0x30ba('0xb'),auth[_0x30ba('0xa')](),controller[_0x30ba('0x10')]);module[_0x30ba('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index bfb9f86..632613a 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 _0x933b=['STRING','INTEGER','sequelize','exports'];(function(_0x47335c,_0xa64542){var _0x5b3c5c=function(_0x5eadfb){while(--_0x5eadfb){_0x47335c['push'](_0x47335c['shift']());}};_0x5b3c5c(++_0xa64542);}(_0x933b,0x16e));var _0xb933=function(_0x231940,_0x20a072){_0x231940=_0x231940-0x0;var _0xffb384=_0x933b[_0x231940];return _0xffb384;};'use strict';var Sequelize=require(_0xb933('0x0'));module[_0xb933('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xb933('0x2')]},'src':{'type':Sequelize[_0xb933('0x2')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xb933('0x2')]},'channel':{'type':Sequelize[_0xb933('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xb933('0x2')]},'duration':{'type':Sequelize[_0xb933('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xb933('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb933('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb933('0x2')]},'userfield':{'type':Sequelize[_0xb933('0x2')]},'uniqueid':{'type':Sequelize[_0xb933('0x2')]},'linkedid':{'type':Sequelize[_0xb933('0x2')]},'sequence':{'type':Sequelize[_0xb933('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb933('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5fc7=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x5edf40,_0x4a71ee){var _0x31cd2e=function(_0x37fe56){while(--_0x37fe56){_0x5edf40['push'](_0x5edf40['shift']());}};_0x31cd2e(++_0x4a71ee);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0x5fc7[_0x5eef05];return _0x56d4b8;};'use strict';var Sequelize=require(_0x75fc('0x0'));module[_0x75fc('0x1')]={'calldate':{'type':Sequelize[_0x75fc('0x2')],'allowNull':![],'defaultValue':_0x75fc('0x3')},'clid':{'type':Sequelize[_0x75fc('0x4')]},'src':{'type':Sequelize[_0x75fc('0x4')]},'dst':{'type':Sequelize[_0x75fc('0x4')]},'dcontext':{'type':Sequelize[_0x75fc('0x4')]},'channel':{'type':Sequelize[_0x75fc('0x4')]},'dstchannel':{'type':Sequelize[_0x75fc('0x4')]},'lastapp':{'type':Sequelize[_0x75fc('0x4')]},'lastdata':{'type':Sequelize[_0x75fc('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x75fc('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x75fc('0x4')]},'amaflags':{'type':Sequelize[_0x75fc('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x75fc('0x4')]},'userfield':{'type':Sequelize[_0x75fc('0x4')]},'uniqueid':{'type':Sequelize[_0x75fc('0x4')]},'linkedid':{'type':Sequelize[_0x75fc('0x4')]},'sequence':{'type':Sequelize[_0x75fc('0x4')]},'peeraccount':{'type':Sequelize[_0x75fc('0x4')]},'type':{'type':Sequelize[_0x75fc('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index df0d5dc..c30dcd7 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 _0x6c32=['name','send','index','map','Cdr','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','update','destroy','then','error'];(function(_0x292f93,_0x2c6e8e){var _0x5a94b1=function(_0x25735e){while(--_0x25735e){_0x292f93['push'](_0x292f93['shift']());}};_0x5a94b1(++_0x2c6e8e);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x26c3('0x0'));var rimraf=require(_0x26c3('0x1'));var zipdir=require(_0x26c3('0x2'));var jsonpatch=require(_0x26c3('0x3'));var rp=require(_0x26c3('0x4'));var moment=require(_0x26c3('0x5'));var BPromise=require(_0x26c3('0x6'));var Mustache=require(_0x26c3('0x7'));var util=require(_0x26c3('0x8'));var path=require('path');var sox=require(_0x26c3('0x9'));var csv=require(_0x26c3('0xa'));var ejs=require(_0x26c3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x26c3('0xc'));var squel=require('squel');var crypto=require(_0x26c3('0xd'));var jsforce=require(_0x26c3('0xe'));var deskjs=require(_0x26c3('0xf'));var toCsv=require(_0x26c3('0xa'));var querystring=require(_0x26c3('0x10'));var Papa=require(_0x26c3('0x11'));var Redis=require(_0x26c3('0x12'));var authService=require(_0x26c3('0x13'));var qs=require(_0x26c3('0x14'));var as=require(_0x26c3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x26c3('0x16'));var licenseUtil=require(_0x26c3('0x17'));var db=require(_0x26c3('0x18'))['db'];function respondWithStatusCode(_0x457fc9,_0x4b8d92){_0x4b8d92=_0x4b8d92||0xcc;return function(_0x4c7b94){if(_0x4c7b94){return _0x457fc9[_0x26c3('0x19')](_0x4b8d92);}return _0x457fc9[_0x26c3('0x1a')](_0x4b8d92)[_0x26c3('0x1b')]();};}function respondWithResult(_0x3cd3c7,_0x17c399){_0x17c399=_0x17c399||0xc8;return function(_0x568d0b){if(_0x568d0b){return _0x3cd3c7['status'](_0x17c399)[_0x26c3('0x1c')](_0x568d0b);}};}function respondWithFilteredResult(_0xc14c69,_0x4f4256){return function(_0x4ed7c1){if(_0x4ed7c1){var _0x124cb3=typeof _0x4f4256['offset']===_0x26c3('0x1d')&&typeof _0x4f4256['limit']==='undefined';var _0x3931d5=_0x4ed7c1['count'];var _0x38fe17=_0x124cb3?0x0:_0x4f4256['offset'];var _0x170039=_0x124cb3?_0x4ed7c1[_0x26c3('0x1e')]:_0x4f4256[_0x26c3('0x1f')]+_0x4f4256[_0x26c3('0x20')];var _0x20317d;if(_0x170039>=_0x3931d5){_0x170039=_0x3931d5;_0x20317d=0xc8;}else{_0x20317d=0xce;}_0xc14c69['status'](_0x20317d);return _0xc14c69['set'](_0x26c3('0x21'),_0x38fe17+'-'+_0x170039+'/'+_0x3931d5)[_0x26c3('0x1c')](_0x4ed7c1);}return null;};}function patchUpdates(_0x480b76){return function(_0x5344e7){try{jsonpatch[_0x26c3('0x22')](_0x5344e7,_0x480b76,!![]);}catch(_0x5c2f7d){return BPromise['reject'](_0x5c2f7d);}return _0x5344e7[_0x26c3('0x23')]();};}function saveUpdates(_0x4eb863,_0x21034d){return function(_0x4a76b5){if(_0x4a76b5){return _0x4a76b5[_0x26c3('0x24')](_0x4eb863)['then'](function(_0x449548){return _0x449548;});}return null;};}function removeEntity(_0x146b69,_0x2f1648){return function(_0xdc0f2c){if(_0xdc0f2c){return _0xdc0f2c[_0x26c3('0x25')]()[_0x26c3('0x26')](function(){_0x146b69[_0x26c3('0x1a')](0xcc)[_0x26c3('0x1b')]();});}};}function handleEntityNotFound(_0x85a057,_0x3f6a18){return function(_0x52dae1){if(!_0x52dae1){_0x85a057[_0x26c3('0x19')](0x194);}return _0x52dae1;};}function handleError(_0x4c7696,_0x50d85e){_0x50d85e=_0x50d85e||0x1f4;return function(_0x44b4f8){logger[_0x26c3('0x27')](_0x44b4f8['stack']);if(_0x44b4f8[_0x26c3('0x28')]){delete _0x44b4f8['name'];}_0x4c7696[_0x26c3('0x1a')](_0x50d85e)[_0x26c3('0x29')](_0x44b4f8);};}exports[_0x26c3('0x2a')]=function(_0x130fcc,_0x3dbda5){var _0x50cd11={},_0x1d3331={},_0x27f556={'count':0x0,'rows':[]};var _0xebb766=_[_0x26c3('0x2b')](db[_0x26c3('0x2c')][_0x26c3('0x2d')],function(_0x5557b8){return{'name':_0x5557b8[_0x26c3('0x2e')],'type':_0x5557b8[_0x26c3('0x2f')][_0x26c3('0x30')]};});_0x1d3331['model']=_[_0x26c3('0x2b')](_0xebb766,_0x26c3('0x28'));_0x1d3331[_0x26c3('0x31')]=_[_0x26c3('0x32')](_0x130fcc[_0x26c3('0x31')]);_0x1d3331[_0x26c3('0x33')]=_['intersection'](_0x1d3331[_0x26c3('0x34')],_0x1d3331[_0x26c3('0x31')]);_0x50cd11['attributes']=_['intersection'](_0x1d3331['model'],qs['fields'](_0x130fcc['query'][_0x26c3('0x35')]));_0x50cd11[_0x26c3('0x36')]=_0x50cd11['attributes'][_0x26c3('0x37')]?_0x50cd11[_0x26c3('0x36')]:_0x1d3331['model'];if(!_0x130fcc['query'][_0x26c3('0x38')]('nolimit')){_0x50cd11[_0x26c3('0x20')]=qs['limit'](_0x130fcc[_0x26c3('0x31')][_0x26c3('0x20')]);_0x50cd11[_0x26c3('0x1f')]=qs[_0x26c3('0x1f')](_0x130fcc[_0x26c3('0x31')]['offset']);}_0x50cd11[_0x26c3('0x39')]=qs[_0x26c3('0x3a')](_0x130fcc[_0x26c3('0x31')][_0x26c3('0x3a')]);_0x50cd11[_0x26c3('0x3b')]=qs[_0x26c3('0x33')](_['pick'](_0x130fcc['query'],_0x1d3331[_0x26c3('0x33')]),_0xebb766);if(_0x130fcc[_0x26c3('0x31')][_0x26c3('0x3c')]){_0x50cd11[_0x26c3('0x3b')]=_[_0x26c3('0x3d')](_0x50cd11['where'],{'$or':_['map'](_0xebb766,function(_0x4c2df1){if(_0x4c2df1[_0x26c3('0x2f')]!==_0x26c3('0x3e')){var _0x832ef2={};_0x832ef2[_0x4c2df1[_0x26c3('0x28')]]={'$like':'%'+_0x130fcc[_0x26c3('0x31')]['filter']+'%'};return _0x832ef2;}})});}_0x50cd11=_['merge']({},_0x50cd11,_0x130fcc[_0x26c3('0x3f')]);var _0x16e680={'where':_0x50cd11[_0x26c3('0x3b')]};return db[_0x26c3('0x2c')]['count'](_0x16e680)[_0x26c3('0x26')](function(_0x2b4bdf){_0x27f556[_0x26c3('0x1e')]=_0x2b4bdf;if(_0x130fcc[_0x26c3('0x31')][_0x26c3('0x40')]){_0x50cd11[_0x26c3('0x41')]=[{'all':!![]}];}return db[_0x26c3('0x2c')][_0x26c3('0x42')](_0x50cd11);})[_0x26c3('0x26')](function(_0x1c0d6c){_0x27f556[_0x26c3('0x43')]=_0x1c0d6c;return _0x27f556;})[_0x26c3('0x26')](respondWithFilteredResult(_0x3dbda5,_0x50cd11))[_0x26c3('0x44')](handleError(_0x3dbda5,null));};exports['show']=function(_0x2f775b,_0x2ecb43){var _0xfb596a={'raw':!![],'where':{'id':_0x2f775b[_0x26c3('0x45')]['id']}},_0x46ebfb={};_0x46ebfb[_0x26c3('0x34')]=_['keys'](db[_0x26c3('0x2c')]['rawAttributes']);_0x46ebfb[_0x26c3('0x31')]=_['keys'](_0x2f775b[_0x26c3('0x31')]);_0x46ebfb[_0x26c3('0x33')]=_['intersection'](_0x46ebfb[_0x26c3('0x34')],_0x46ebfb[_0x26c3('0x31')]);_0xfb596a[_0x26c3('0x36')]=_[_0x26c3('0x46')](_0x46ebfb[_0x26c3('0x34')],qs['fields'](_0x2f775b[_0x26c3('0x31')]['fields']));_0xfb596a[_0x26c3('0x36')]=_0xfb596a['attributes']['length']?_0xfb596a[_0x26c3('0x36')]:_0x46ebfb[_0x26c3('0x34')];if(_0x2f775b[_0x26c3('0x31')]['includeAll']){_0xfb596a[_0x26c3('0x41')]=[{'all':!![]}];}_0xfb596a=_[_0x26c3('0x3d')]({},_0xfb596a,_0x2f775b[_0x26c3('0x3f')]);return db[_0x26c3('0x2c')][_0x26c3('0x47')](_0xfb596a)[_0x26c3('0x26')](handleEntityNotFound(_0x2ecb43,null))['then'](respondWithResult(_0x2ecb43,null))[_0x26c3('0x44')](handleError(_0x2ecb43,null));};exports[_0x26c3('0x48')]=function(_0x378982,_0x133cf7){return db['Cdr'][_0x26c3('0x48')](_0x378982[_0x26c3('0x49')],{})['then'](respondWithResult(_0x133cf7,0xc9))[_0x26c3('0x44')](handleError(_0x133cf7,null));};exports[_0x26c3('0x24')]=function(_0x522fe2,_0x4566ab){if(_0x522fe2['body']['id']){delete _0x522fe2[_0x26c3('0x49')]['id'];}return db[_0x26c3('0x2c')][_0x26c3('0x47')]({'where':{'id':_0x522fe2[_0x26c3('0x45')]['id']}})[_0x26c3('0x26')](handleEntityNotFound(_0x4566ab,null))[_0x26c3('0x26')](saveUpdates(_0x522fe2[_0x26c3('0x49')],null))['then'](respondWithResult(_0x4566ab,null))[_0x26c3('0x44')](handleError(_0x4566ab,null));};exports['destroy']=function(_0x4ada42,_0x3b3e31){return db[_0x26c3('0x2c')][_0x26c3('0x47')]({'where':{'id':_0x4ada42['params']['id']}})['then'](handleEntityNotFound(_0x3b3e31,null))[_0x26c3('0x26')](removeEntity(_0x3b3e31,null))[_0x26c3('0x44')](handleError(_0x3b3e31,null));};exports[_0x26c3('0x4a')]=function(_0x4d1ec7,_0x446453){return db[_0x26c3('0x2c')][_0x26c3('0x4a')]()['then'](respondWithResult(_0x446453,null))[_0x26c3('0x44')](handleError(_0x446453,null));}; \ No newline at end of file +var _0xf494=['create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','Cdr','includeAll','include','findAll','rows','catch','length','find'];(function(_0x5bb6c9,_0x1fd920){var _0x398757=function(_0x3b71ca){while(--_0x3b71ca){_0x5bb6c9['push'](_0x5bb6c9['shift']());}};_0x398757(++_0x1fd920);}(_0xf494,0x1c6));var _0x4f49=function(_0x5b1490,_0x5459ee){_0x5b1490=_0x5b1490-0x0;var _0x437bed=_0xf494[_0x5b1490];return _0x437bed;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];function respondWithStatusCode(_0x12527d,_0x4bf89f){_0x4bf89f=_0x4bf89f||0xcc;return function(_0x1e1c37){if(_0x1e1c37){return _0x12527d[_0x4f49('0x19')](_0x4bf89f);}return _0x12527d[_0x4f49('0x1a')](_0x4bf89f)[_0x4f49('0x1b')]();};}function respondWithResult(_0x1a0f1e,_0x2f0131){_0x2f0131=_0x2f0131||0xc8;return function(_0xfdb477){if(_0xfdb477){return _0x1a0f1e['status'](_0x2f0131)[_0x4f49('0x1c')](_0xfdb477);}};}function respondWithFilteredResult(_0x1f2d0d,_0x415e83){return function(_0x5878f4){if(_0x5878f4){var _0x5bdfaf=typeof _0x415e83[_0x4f49('0x1d')]===_0x4f49('0x1e')&&typeof _0x415e83[_0x4f49('0x1f')]==='undefined';var _0x1dccfd=_0x5878f4[_0x4f49('0x20')];var _0x4e85df=_0x5bdfaf?0x0:_0x415e83['offset'];var _0x5bb23b=_0x5bdfaf?_0x5878f4['count']:_0x415e83['offset']+_0x415e83[_0x4f49('0x1f')];var _0x1834f4;if(_0x5bb23b>=_0x1dccfd){_0x5bb23b=_0x1dccfd;_0x1834f4=0xc8;}else{_0x1834f4=0xce;}_0x1f2d0d[_0x4f49('0x1a')](_0x1834f4);return _0x1f2d0d[_0x4f49('0x21')]('Content-Range',_0x4e85df+'-'+_0x5bb23b+'/'+_0x1dccfd)[_0x4f49('0x1c')](_0x5878f4);}return null;};}function patchUpdates(_0x2aed27){return function(_0x197a49){try{jsonpatch[_0x4f49('0x22')](_0x197a49,_0x2aed27,!![]);}catch(_0xea82f8){return BPromise['reject'](_0xea82f8);}return _0x197a49[_0x4f49('0x23')]();};}function saveUpdates(_0x357446,_0x3ae590){return function(_0x53b57d){if(_0x53b57d){return _0x53b57d[_0x4f49('0x24')](_0x357446)[_0x4f49('0x25')](function(_0x32ca7b){return _0x32ca7b;});}return null;};}function removeEntity(_0x43c458,_0x9d30aa){return function(_0x36187b){if(_0x36187b){return _0x36187b['destroy']()['then'](function(){_0x43c458[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x4fedbb,_0x408552){return function(_0x2c1519){if(!_0x2c1519){_0x4fedbb[_0x4f49('0x19')](0x194);}return _0x2c1519;};}function handleError(_0x525950,_0xc54070){_0xc54070=_0xc54070||0x1f4;return function(_0x2eed1c){logger[_0x4f49('0x26')](_0x2eed1c[_0x4f49('0x27')]);if(_0x2eed1c[_0x4f49('0x28')]){delete _0x2eed1c[_0x4f49('0x28')];}_0x525950['status'](_0xc54070)['send'](_0x2eed1c);};}exports[_0x4f49('0x29')]=function(_0x2c00ee,_0x605c91){var _0x560050={},_0x3cbfbd={},_0x206203={'count':0x0,'rows':[]};var _0x43d8e3=_['map'](db['Cdr'][_0x4f49('0x2a')],function(_0x27d004){return{'name':_0x27d004[_0x4f49('0x2b')],'type':_0x27d004['type'][_0x4f49('0x2c')]};});_0x3cbfbd[_0x4f49('0x2d')]=_[_0x4f49('0x2e')](_0x43d8e3,_0x4f49('0x28'));_0x3cbfbd[_0x4f49('0x2f')]=_[_0x4f49('0x30')](_0x2c00ee[_0x4f49('0x2f')]);_0x3cbfbd[_0x4f49('0x31')]=_[_0x4f49('0x32')](_0x3cbfbd[_0x4f49('0x2d')],_0x3cbfbd[_0x4f49('0x2f')]);_0x560050[_0x4f49('0x33')]=_[_0x4f49('0x32')](_0x3cbfbd[_0x4f49('0x2d')],qs[_0x4f49('0x34')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x34')]));_0x560050[_0x4f49('0x33')]=_0x560050[_0x4f49('0x33')]['length']?_0x560050[_0x4f49('0x33')]:_0x3cbfbd[_0x4f49('0x2d')];if(!_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x35')](_0x4f49('0x36'))){_0x560050[_0x4f49('0x1f')]=qs[_0x4f49('0x1f')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x1f')]);_0x560050[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x1d')]);}_0x560050['order']=qs[_0x4f49('0x37')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x37')]);_0x560050[_0x4f49('0x38')]=qs[_0x4f49('0x31')](_[_0x4f49('0x39')](_0x2c00ee[_0x4f49('0x2f')],_0x3cbfbd[_0x4f49('0x31')]),_0x43d8e3);if(_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x3a')]){_0x560050[_0x4f49('0x38')]=_[_0x4f49('0x3b')](_0x560050[_0x4f49('0x38')],{'$or':_[_0x4f49('0x2e')](_0x43d8e3,function(_0x4e3f72){if(_0x4e3f72[_0x4f49('0x3c')]!==_0x4f49('0x3d')){var _0x543605={};_0x543605[_0x4e3f72[_0x4f49('0x28')]]={'$like':'%'+_0x2c00ee[_0x4f49('0x2f')]['filter']+'%'};return _0x543605;}})});}_0x560050=_[_0x4f49('0x3b')]({},_0x560050,_0x2c00ee[_0x4f49('0x3e')]);var _0x2548ad={'where':_0x560050[_0x4f49('0x38')]};return db[_0x4f49('0x3f')][_0x4f49('0x20')](_0x2548ad)[_0x4f49('0x25')](function(_0x5d464e){_0x206203['count']=_0x5d464e;if(_0x2c00ee['query'][_0x4f49('0x40')]){_0x560050[_0x4f49('0x41')]=[{'all':!![]}];}return db[_0x4f49('0x3f')][_0x4f49('0x42')](_0x560050);})[_0x4f49('0x25')](function(_0x1ecf6c){_0x206203[_0x4f49('0x43')]=_0x1ecf6c;return _0x206203;})[_0x4f49('0x25')](respondWithFilteredResult(_0x605c91,_0x560050))[_0x4f49('0x44')](handleError(_0x605c91,null));};exports['show']=function(_0x5238a3,_0x412395){var _0x432b5d={'raw':!![],'where':{'id':_0x5238a3['params']['id']}},_0x159642={};_0x159642[_0x4f49('0x2d')]=_['keys'](db['Cdr'][_0x4f49('0x2a')]);_0x159642[_0x4f49('0x2f')]=_[_0x4f49('0x30')](_0x5238a3['query']);_0x159642[_0x4f49('0x31')]=_[_0x4f49('0x32')](_0x159642['model'],_0x159642[_0x4f49('0x2f')]);_0x432b5d['attributes']=_[_0x4f49('0x32')](_0x159642[_0x4f49('0x2d')],qs[_0x4f49('0x34')](_0x5238a3['query'][_0x4f49('0x34')]));_0x432b5d[_0x4f49('0x33')]=_0x432b5d[_0x4f49('0x33')][_0x4f49('0x45')]?_0x432b5d[_0x4f49('0x33')]:_0x159642[_0x4f49('0x2d')];if(_0x5238a3[_0x4f49('0x2f')][_0x4f49('0x40')]){_0x432b5d[_0x4f49('0x41')]=[{'all':!![]}];}_0x432b5d=_[_0x4f49('0x3b')]({},_0x432b5d,_0x5238a3['options']);return db[_0x4f49('0x3f')][_0x4f49('0x46')](_0x432b5d)['then'](handleEntityNotFound(_0x412395,null))[_0x4f49('0x25')](respondWithResult(_0x412395,null))['catch'](handleError(_0x412395,null));};exports[_0x4f49('0x47')]=function(_0x41c580,_0x2d3dcd){return db[_0x4f49('0x3f')]['create'](_0x41c580[_0x4f49('0x48')],{})[_0x4f49('0x25')](respondWithResult(_0x2d3dcd,0xc9))[_0x4f49('0x44')](handleError(_0x2d3dcd,null));};exports[_0x4f49('0x24')]=function(_0x3ec266,_0x72ea05){if(_0x3ec266[_0x4f49('0x48')]['id']){delete _0x3ec266[_0x4f49('0x48')]['id'];}return db[_0x4f49('0x3f')][_0x4f49('0x46')]({'where':{'id':_0x3ec266[_0x4f49('0x49')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0x72ea05,null))[_0x4f49('0x25')](saveUpdates(_0x3ec266[_0x4f49('0x48')],null))[_0x4f49('0x25')](respondWithResult(_0x72ea05,null))[_0x4f49('0x44')](handleError(_0x72ea05,null));};exports['destroy']=function(_0x4eadc2,_0xce5121){return db[_0x4f49('0x3f')][_0x4f49('0x46')]({'where':{'id':_0x4eadc2[_0x4f49('0x49')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0xce5121,null))[_0x4f49('0x25')](removeEntity(_0xce5121,null))[_0x4f49('0x44')](handleError(_0xce5121,null));};exports['describe']=function(_0x6637f4,_0x4ff0a2){return db[_0x4f49('0x3f')][_0x4f49('0x4a')]()[_0x4f49('0x25')](respondWithResult(_0x4ff0a2,null))[_0x4f49('0x44')](handleError(_0x4ff0a2,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index b1c69ce..77f63c1 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x48d5d0,_0x573cd4){var _0x474fb6=function(_0x434704){while(--_0x434704){_0x48d5d0['push'](_0x48d5d0['shift']());}};_0x474fb6(++_0x573cd4);}(_0x7a54,0x106));var _0x47a5=function(_0x2351cf,_0x39539b){_0x2351cf=_0x2351cf-0x0;var _0x5c3a50=_0x7a54[_0x2351cf];return _0x5c3a50;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x15a161,_0x95e2ad){var _0x2ef65c=function(_0x26cc8e){while(--_0x26cc8e){_0x15a161['push'](_0x15a161['shift']());}};_0x2ef65c(++_0x95e2ad);}(_0x7a54,0x106));var _0x47a5=function(_0x11dbdf,_0x19d0a9){_0x11dbdf=_0x11dbdf-0x0;var _0x26b245=_0x7a54[_0x11dbdf];return _0x26b245;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 2afb372..5913406 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 _0xb307=['error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb307,0xa4));var _0x7b30=function(_0x339eee,_0xccb61b){_0x339eee=_0x339eee-0x0;var _0x319b12=_0xb307[_0x339eee];return _0x319b12;};'use strict';var _=require(_0x7b30('0x0'));var util=require(_0x7b30('0x1'));var moment=require('moment');var BPromise=require(_0x7b30('0x2'));var rs=require(_0x7b30('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b30('0x4'))['db'];var utils=require(_0x7b30('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7b30('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7b30('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32f0d4,_0x31bde1,_0x1f9739){return new BPromise(function(_0x186428,_0x1ff178){return client[_0x7b30('0x8')](_0x32f0d4,_0x1f9739)[_0x7b30('0x9')](function(_0x304972){logger[_0x7b30('0xa')](_0x7b30('0xb'),_0x31bde1,_0x7b30('0xc'));logger[_0x7b30('0xd')](_0x7b30('0xe'),_0x31bde1,_0x7b30('0xc'),JSON[_0x7b30('0xf')](_0x304972));if(_0x304972[_0x7b30('0x10')]){if(_0x304972['error'][_0x7b30('0x11')]===0x1f4){logger[_0x7b30('0x10')](_0x7b30('0xb'),_0x31bde1,_0x304972[_0x7b30('0x10')][_0x7b30('0x12')]);return _0x1ff178(_0x304972['error'][_0x7b30('0x12')]);}logger[_0x7b30('0x10')](_0x7b30('0xb'),_0x31bde1,_0x304972[_0x7b30('0x10')]['message']);return _0x186428(_0x304972['error'][_0x7b30('0x12')]);}else{logger[_0x7b30('0xa')](_0x7b30('0xb'),_0x31bde1,_0x7b30('0xc'));_0x186428(_0x304972['result'][_0x7b30('0x12')]);}})[_0x7b30('0x13')](function(_0x17bb8f){logger[_0x7b30('0x10')](_0x7b30('0xb'),_0x31bde1,_0x17bb8f);_0x1ff178(_0x17bb8f);});});} \ No newline at end of file +var _0xc1c0=['../../config/logger','rpc','client','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc1c0,0x13d));var _0x0c1c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc1c0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0c1c('0x0'));var util=require(_0x0c1c('0x1'));var moment=require('moment');var BPromise=require(_0x0c1c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c1c('0x3'));var db=require(_0x0c1c('0x4'))['db'];var utils=require(_0x0c1c('0x5'));var logger=require(_0x0c1c('0x6'))(_0x0c1c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0c1c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x168500,_0x322bcc,_0x5b6b0d){return new BPromise(function(_0x5e2feb,_0x264e16){return client['request'](_0x168500,_0x5b6b0d)[_0x0c1c('0x9')](function(_0xd44595){logger[_0x0c1c('0xa')](_0x0c1c('0xb'),_0x322bcc,'request\x20sent');logger[_0x0c1c('0xc')](_0x0c1c('0xd'),_0x322bcc,_0x0c1c('0xe'),JSON[_0x0c1c('0xf')](_0xd44595));if(_0xd44595['error']){if(_0xd44595[_0x0c1c('0x10')]['code']===0x1f4){logger[_0x0c1c('0x10')](_0x0c1c('0xb'),_0x322bcc,_0xd44595['error'][_0x0c1c('0x11')]);return _0x264e16(_0xd44595[_0x0c1c('0x10')][_0x0c1c('0x11')]);}logger[_0x0c1c('0x10')](_0x0c1c('0xb'),_0x322bcc,_0xd44595[_0x0c1c('0x10')][_0x0c1c('0x11')]);return _0x5e2feb(_0xd44595['error'][_0x0c1c('0x11')]);}else{logger[_0x0c1c('0xa')]('Cdr,\x20%s,\x20%s',_0x322bcc,'request\x20sent');_0x5e2feb(_0xd44595[_0x0c1c('0x12')][_0x0c1c('0x11')]);}})['catch'](function(_0x1dcb78){logger[_0x0c1c('0x10')](_0x0c1c('0xb'),_0x322bcc,_0x1dcb78);_0x264e16(_0x1dcb78);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 02de4ad..e12313d 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 7e1809f..e95d752 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 _0xeb37=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x549d57,_0x6b8598){var _0x330291=function(_0x53483d){while(--_0x53483d){_0x549d57['push'](_0x549d57['shift']());}};_0x330291(++_0x6b8598);}(_0xeb37,0x18d));var _0x7eb3=function(_0x2d126d,_0x235723){_0x2d126d=_0x2d126d-0x0;var _0x4e9654=_0xeb37[_0x2d126d];return _0x4e9654;};'use strict';var Sequelize=require(_0x7eb3('0x0'));module['exports']={'priority':{'type':Sequelize[_0x7eb3('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7eb3('0x2')],'allowNull':![],'defaultValue':_0x7eb3('0x3')},'appdata':{'type':Sequelize[_0x7eb3('0x4')]()},'description':{'type':Sequelize[_0x7eb3('0x2')]},'interval':{'type':Sequelize[_0x7eb3('0x2')],'defaultValue':_0x7eb3('0x5')}}; \ No newline at end of file +var _0xd0e0=['sequelize','exports','INTEGER','STRING','*,*,*,*'];(function(_0x5222d9,_0x12496d){var _0x16b0d5=function(_0x4220a6){while(--_0x4220a6){_0x5222d9['push'](_0x5222d9['shift']());}};_0x16b0d5(++_0x12496d);}(_0xd0e0,0x19a));var _0x0d0e=function(_0x10b843,_0x3b9ec0){_0x10b843=_0x10b843-0x0;var _0x42c583=_0xd0e0[_0x10b843];return _0x42c583;};'use strict';var Sequelize=require(_0x0d0e('0x0'));module[_0x0d0e('0x1')]={'priority':{'type':Sequelize[_0x0d0e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0d0e('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0d0e('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 71a23cb..ccba1d3 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 _0xac72=['body','find','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','error','stack','name','send','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','catch'];(function(_0x52cbab,_0x243e32){var _0x5eb55a=function(_0x381399){while(--_0x381399){_0x52cbab['push'](_0x52cbab['shift']());}};_0x5eb55a(++_0x243e32);}(_0xac72,0x1eb));var _0x2ac7=function(_0x2fc95b,_0x2ed4f){_0x2fc95b=_0x2fc95b-0x0;var _0x631439=_0xac72[_0x2fc95b];return _0x631439;};'use strict';var emlformat=require(_0x2ac7('0x0'));var rimraf=require(_0x2ac7('0x1'));var zipdir=require(_0x2ac7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2ac7('0x3'));var moment=require(_0x2ac7('0x4'));var BPromise=require(_0x2ac7('0x5'));var Mustache=require(_0x2ac7('0x6'));var util=require(_0x2ac7('0x7'));var path=require(_0x2ac7('0x8'));var sox=require(_0x2ac7('0x9'));var csv=require(_0x2ac7('0xa'));var ejs=require(_0x2ac7('0xb'));var fs=require('fs');var fs_extra=require(_0x2ac7('0xc'));var _=require(_0x2ac7('0xd'));var squel=require(_0x2ac7('0xe'));var crypto=require(_0x2ac7('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2ac7('0x10'));var toCsv=require(_0x2ac7('0xa'));var querystring=require('querystring');var Papa=require(_0x2ac7('0x11'));var Redis=require(_0x2ac7('0x12'));var authService=require(_0x2ac7('0x13'));var qs=require(_0x2ac7('0x14'));var as=require(_0x2ac7('0x15'));var hardwareService=require(_0x2ac7('0x16'));var logger=require(_0x2ac7('0x17'))('api');var utils=require(_0x2ac7('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2ac7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f054d,_0x80af2c){_0x80af2c=_0x80af2c||0xcc;return function(_0x4ddc6c){if(_0x4ddc6c){return _0x1f054d['sendStatus'](_0x80af2c);}return _0x1f054d[_0x2ac7('0x1a')](_0x80af2c)[_0x2ac7('0x1b')]();};}function respondWithResult(_0x49fd6d,_0x98d965){_0x98d965=_0x98d965||0xc8;return function(_0x16ef90){if(_0x16ef90){return _0x49fd6d['status'](_0x98d965)[_0x2ac7('0x1c')](_0x16ef90);}};}function respondWithFilteredResult(_0xb7b036,_0x4cc90a){return function(_0x48c250){if(_0x48c250){var _0x150ecc=typeof _0x4cc90a[_0x2ac7('0x1d')]===_0x2ac7('0x1e')&&typeof _0x4cc90a[_0x2ac7('0x1f')]==='undefined';var _0x17932f=_0x48c250[_0x2ac7('0x20')];var _0x206d33=_0x150ecc?0x0:_0x4cc90a[_0x2ac7('0x1d')];var _0x30378f=_0x150ecc?_0x48c250[_0x2ac7('0x20')]:_0x4cc90a[_0x2ac7('0x1d')]+_0x4cc90a[_0x2ac7('0x1f')];var _0x44188c;if(_0x30378f>=_0x17932f){_0x30378f=_0x17932f;_0x44188c=0xc8;}else{_0x44188c=0xce;}_0xb7b036[_0x2ac7('0x1a')](_0x44188c);return _0xb7b036[_0x2ac7('0x21')](_0x2ac7('0x22'),_0x206d33+'-'+_0x30378f+'/'+_0x17932f)[_0x2ac7('0x1c')](_0x48c250);}return null;};}function patchUpdates(_0x16907c){return function(_0x57941){try{jsonpatch['apply'](_0x57941,_0x16907c,!![]);}catch(_0x4d4db2){return BPromise['reject'](_0x4d4db2);}return _0x57941[_0x2ac7('0x23')]();};}function saveUpdates(_0x5556cd,_0x1c88f6){return function(_0x3cb589){if(_0x3cb589){return _0x3cb589[_0x2ac7('0x24')](_0x5556cd)[_0x2ac7('0x25')](function(_0x4d6d65){return _0x4d6d65;});}return null;};}function removeEntity(_0x12813b,_0x2821e0){return function(_0x325818){if(_0x325818){return _0x325818['destroy']()[_0x2ac7('0x25')](function(){_0x12813b[_0x2ac7('0x1a')](0xcc)[_0x2ac7('0x1b')]();});}};}function handleEntityNotFound(_0x5a8c01,_0x4d5518){return function(_0xea00e2){if(!_0xea00e2){_0x5a8c01['sendStatus'](0x194);}return _0xea00e2;};}function handleError(_0x1a2ac5,_0x5f610e){_0x5f610e=_0x5f610e||0x1f4;return function(_0x1dbcbd){logger[_0x2ac7('0x26')](_0x1dbcbd[_0x2ac7('0x27')]);if(_0x1dbcbd[_0x2ac7('0x28')]){delete _0x1dbcbd[_0x2ac7('0x28')];}_0x1a2ac5['status'](_0x5f610e)[_0x2ac7('0x29')](_0x1dbcbd);};}exports['show']=function(_0x2f4326,_0x39179d){var _0x53e46d={'raw':!![],'where':{'id':_0x2f4326[_0x2ac7('0x2a')]['id']}},_0x3fac0e={};_0x3fac0e[_0x2ac7('0x2b')]=_[_0x2ac7('0x2c')](db[_0x2ac7('0x2d')][_0x2ac7('0x2e')]);_0x3fac0e[_0x2ac7('0x2f')]=_[_0x2ac7('0x2c')](_0x2f4326['query']);_0x3fac0e[_0x2ac7('0x30')]=_[_0x2ac7('0x31')](_0x3fac0e[_0x2ac7('0x2b')],_0x3fac0e['query']);_0x53e46d[_0x2ac7('0x32')]=_['intersection'](_0x3fac0e[_0x2ac7('0x2b')],qs[_0x2ac7('0x33')](_0x2f4326[_0x2ac7('0x2f')][_0x2ac7('0x33')]));_0x53e46d[_0x2ac7('0x32')]=_0x53e46d[_0x2ac7('0x32')][_0x2ac7('0x34')]?_0x53e46d[_0x2ac7('0x32')]:_0x3fac0e['model'];if(_0x2f4326[_0x2ac7('0x2f')][_0x2ac7('0x35')]){_0x53e46d[_0x2ac7('0x36')]=[{'all':!![]}];}_0x53e46d=_[_0x2ac7('0x37')]({},_0x53e46d,_0x2f4326[_0x2ac7('0x38')]);return db[_0x2ac7('0x2d')]['find'](_0x53e46d)['then'](handleEntityNotFound(_0x39179d,null))[_0x2ac7('0x25')](respondWithResult(_0x39179d,null))[_0x2ac7('0x39')](handleError(_0x39179d,null));};exports[_0x2ac7('0x24')]=function(_0x5129fd,_0x4b3c6a){if(_0x5129fd[_0x2ac7('0x3a')]['id']){delete _0x5129fd[_0x2ac7('0x3a')]['id'];}return db['ChatApplication'][_0x2ac7('0x3b')]({'where':{'id':_0x5129fd[_0x2ac7('0x2a')]['id']}})[_0x2ac7('0x25')](handleEntityNotFound(_0x4b3c6a,null))['then'](saveUpdates(_0x5129fd['body'],null))[_0x2ac7('0x25')](respondWithResult(_0x4b3c6a,null))[_0x2ac7('0x39')](handleError(_0x4b3c6a,null));};exports[_0x2ac7('0x3c')]=function(_0x384b9b,_0x5d4492){return db[_0x2ac7('0x2d')][_0x2ac7('0x3b')]({'where':{'id':_0x384b9b[_0x2ac7('0x2a')]['id']}})[_0x2ac7('0x25')](handleEntityNotFound(_0x5d4492,null))['then'](removeEntity(_0x5d4492,null))['catch'](handleError(_0x5d4492,null));}; \ No newline at end of file +var _0x26f9=['length','includeAll','include','options','find','catch','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','params','model','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields'];(function(_0x3c1414,_0x329ebb){var _0x348b31=function(_0x56f902){while(--_0x56f902){_0x3c1414['push'](_0x3c1414['shift']());}};_0x348b31(++_0x329ebb);}(_0x26f9,0x16f));var _0x926f=function(_0x380b8f,_0x32271d){_0x380b8f=_0x380b8f-0x0;var _0x646c69=_0x26f9[_0x380b8f];return _0x646c69;};'use strict';var emlformat=require(_0x926f('0x0'));var rimraf=require(_0x926f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x926f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x926f('0x3'));var Mustache=require(_0x926f('0x4'));var util=require('util');var path=require(_0x926f('0x5'));var sox=require(_0x926f('0x6'));var csv=require(_0x926f('0x7'));var ejs=require(_0x926f('0x8'));var fs=require('fs');var fs_extra=require(_0x926f('0x9'));var _=require(_0x926f('0xa'));var squel=require(_0x926f('0xb'));var crypto=require(_0x926f('0xc'));var jsforce=require(_0x926f('0xd'));var deskjs=require(_0x926f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x926f('0xf'));var Papa=require('papaparse');var Redis=require(_0x926f('0x10'));var authService=require(_0x926f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x926f('0x12'));var hardwareService=require(_0x926f('0x13'));var logger=require(_0x926f('0x14'))(_0x926f('0x15'));var utils=require(_0x926f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x926f('0x17'));var db=require(_0x926f('0x18'))['db'];function respondWithStatusCode(_0x14f316,_0x1ac8ab){_0x1ac8ab=_0x1ac8ab||0xcc;return function(_0x44f5da){if(_0x44f5da){return _0x14f316[_0x926f('0x19')](_0x1ac8ab);}return _0x14f316[_0x926f('0x1a')](_0x1ac8ab)['end']();};}function respondWithResult(_0x48ee07,_0x5e6fb1){_0x5e6fb1=_0x5e6fb1||0xc8;return function(_0x11197b){if(_0x11197b){return _0x48ee07[_0x926f('0x1a')](_0x5e6fb1)[_0x926f('0x1b')](_0x11197b);}};}function respondWithFilteredResult(_0x280759,_0x57c87f){return function(_0x37035c){if(_0x37035c){var _0x385fad=typeof _0x57c87f['offset']===_0x926f('0x1c')&&typeof _0x57c87f['limit']===_0x926f('0x1c');var _0x5ad99f=_0x37035c['count'];var _0x36ead3=_0x385fad?0x0:_0x57c87f[_0x926f('0x1d')];var _0x4f25e3=_0x385fad?_0x37035c[_0x926f('0x1e')]:_0x57c87f[_0x926f('0x1d')]+_0x57c87f[_0x926f('0x1f')];var _0x50b2d4;if(_0x4f25e3>=_0x5ad99f){_0x4f25e3=_0x5ad99f;_0x50b2d4=0xc8;}else{_0x50b2d4=0xce;}_0x280759[_0x926f('0x1a')](_0x50b2d4);return _0x280759[_0x926f('0x20')]('Content-Range',_0x36ead3+'-'+_0x4f25e3+'/'+_0x5ad99f)[_0x926f('0x1b')](_0x37035c);}return null;};}function patchUpdates(_0x4241ac){return function(_0x56fef1){try{jsonpatch[_0x926f('0x21')](_0x56fef1,_0x4241ac,!![]);}catch(_0xa942ae){return BPromise[_0x926f('0x22')](_0xa942ae);}return _0x56fef1[_0x926f('0x23')]();};}function saveUpdates(_0x150430,_0x3b7179){return function(_0x412260){if(_0x412260){return _0x412260[_0x926f('0x24')](_0x150430)[_0x926f('0x25')](function(_0x61738a){return _0x61738a;});}return null;};}function removeEntity(_0x2be66b,_0x4a93a4){return function(_0x2d76eb){if(_0x2d76eb){return _0x2d76eb[_0x926f('0x26')]()['then'](function(){_0x2be66b[_0x926f('0x1a')](0xcc)[_0x926f('0x27')]();});}};}function handleEntityNotFound(_0x36a17e,_0x26391d){return function(_0x799889){if(!_0x799889){_0x36a17e[_0x926f('0x19')](0x194);}return _0x799889;};}function handleError(_0x4b8964,_0x110e59){_0x110e59=_0x110e59||0x1f4;return function(_0x5065dd){logger[_0x926f('0x28')](_0x5065dd[_0x926f('0x29')]);if(_0x5065dd[_0x926f('0x2a')]){delete _0x5065dd[_0x926f('0x2a')];}_0x4b8964['status'](_0x110e59)[_0x926f('0x2b')](_0x5065dd);};}exports['show']=function(_0xc88ea4,_0x2556ce){var _0x518a47={'raw':!![],'where':{'id':_0xc88ea4[_0x926f('0x2c')]['id']}},_0x5f35fe={};_0x5f35fe[_0x926f('0x2d')]=_['keys'](db[_0x926f('0x2e')][_0x926f('0x2f')]);_0x5f35fe['query']=_['keys'](_0xc88ea4[_0x926f('0x30')]);_0x5f35fe[_0x926f('0x31')]=_[_0x926f('0x32')](_0x5f35fe['model'],_0x5f35fe[_0x926f('0x30')]);_0x518a47[_0x926f('0x33')]=_[_0x926f('0x32')](_0x5f35fe['model'],qs[_0x926f('0x34')](_0xc88ea4[_0x926f('0x30')][_0x926f('0x34')]));_0x518a47[_0x926f('0x33')]=_0x518a47[_0x926f('0x33')][_0x926f('0x35')]?_0x518a47['attributes']:_0x5f35fe[_0x926f('0x2d')];if(_0xc88ea4[_0x926f('0x30')][_0x926f('0x36')]){_0x518a47[_0x926f('0x37')]=[{'all':!![]}];}_0x518a47=_['merge']({},_0x518a47,_0xc88ea4[_0x926f('0x38')]);return db[_0x926f('0x2e')][_0x926f('0x39')](_0x518a47)[_0x926f('0x25')](handleEntityNotFound(_0x2556ce,null))[_0x926f('0x25')](respondWithResult(_0x2556ce,null))[_0x926f('0x3a')](handleError(_0x2556ce,null));};exports[_0x926f('0x24')]=function(_0xaad45d,_0x2184c1){if(_0xaad45d[_0x926f('0x3b')]['id']){delete _0xaad45d[_0x926f('0x3b')]['id'];}return db['ChatApplication'][_0x926f('0x39')]({'where':{'id':_0xaad45d[_0x926f('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2184c1,null))[_0x926f('0x25')](saveUpdates(_0xaad45d[_0x926f('0x3b')],null))[_0x926f('0x25')](respondWithResult(_0x2184c1,null))[_0x926f('0x3a')](handleError(_0x2184c1,null));};exports[_0x926f('0x26')]=function(_0x3a21ca,_0x9ff853){return db[_0x926f('0x2e')]['find']({'where':{'id':_0x3a21ca[_0x926f('0x2c')]['id']}})['then'](handleEntityNotFound(_0x9ff853,null))[_0x926f('0x25')](removeEntity(_0x9ff853,null))[_0x926f('0x3a')](handleError(_0x9ff853,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 470cd2f..350e5bc 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 _0x6d9f=['chat_applications','utf8mb4','utf8mb4_unicode_ci','api','moment','request-promise','path','rimraf','./chatApplication.attributes','ChatApplication'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x6d9f,0x16b));var _0xf6d9=function(_0x20d353,_0x2e2108){_0x20d353=_0x20d353-0x0;var _0x542001=_0x6d9f[_0x20d353];return _0x542001;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf6d9('0x0'));var moment=require(_0xf6d9('0x1'));var BPromise=require('bluebird');var rp=require(_0xf6d9('0x2'));var fs=require('fs');var path=require(_0xf6d9('0x3'));var rimraf=require(_0xf6d9('0x4'));var config=require('../../config/environment');var attributes=require(_0xf6d9('0x5'));module['exports']=function(_0x592a43,_0x2ad980){return _0x592a43['define'](_0xf6d9('0x6'),attributes,{'tableName':_0xf6d9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf6d9('0x8'),'collate':_0xf6d9('0x9')});}; \ No newline at end of file +var _0xf377=['util','moment','bluebird','request-promise','path','../../config/environment','exports','define','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x5f5997,_0x19fade){var _0x48af85=function(_0x3ef53f){while(--_0x3ef53f){_0x5f5997['push'](_0x5f5997['shift']());}};_0x48af85(++_0x19fade);}(_0xf377,0x113));var _0x7f37=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xf377[_0xdc37a1];return _0x99b4fe;};'use strict';var _=require(_0x7f37('0x0'));var util=require(_0x7f37('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7f37('0x2'));var BPromise=require(_0x7f37('0x3'));var rp=require(_0x7f37('0x4'));var fs=require('fs');var path=require(_0x7f37('0x5'));var rimraf=require('rimraf');var config=require(_0x7f37('0x6'));var attributes=require('./chatApplication.attributes');module[_0x7f37('0x7')]=function(_0x5bb98e,_0x51f504){return _0x5bb98e[_0x7f37('0x8')]('ChatApplication',attributes,{'tableName':_0x7f37('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7f37('0xa'),'collate':_0x7f37('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 25583d8..94592f3 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 _0xb7dd=['request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ChatApplication,\x20%s,\x20%s'];(function(_0x45fcb3,_0x1381c4){var _0x506991=function(_0x6dc617){while(--_0x6dc617){_0x45fcb3['push'](_0x45fcb3['shift']());}};_0x506991(++_0x1381c4);}(_0xb7dd,0x1bf));var _0xdb7d=function(_0x46a559,_0x2dd5e6){_0x46a559=_0x46a559-0x0;var _0x31c613=_0xb7dd[_0x46a559];return _0x31c613;};'use strict';var _=require('lodash');var util=require(_0xdb7d('0x0'));var moment=require(_0xdb7d('0x1'));var BPromise=require(_0xdb7d('0x2'));var rs=require(_0xdb7d('0x3'));var fs=require('fs');var Redis=require(_0xdb7d('0x4'));var db=require(_0xdb7d('0x5'))['db'];var utils=require(_0xdb7d('0x6'));var logger=require(_0xdb7d('0x7'))(_0xdb7d('0x8'));var config=require(_0xdb7d('0x9'));var jayson=require(_0xdb7d('0xa'));var client=jayson['client'][_0xdb7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36b164,_0x5ee352,_0x47e123){return new BPromise(function(_0x45cff0,_0x53cbe9){return client[_0xdb7d('0xc')](_0x36b164,_0x47e123)['then'](function(_0x1ce89c){logger[_0xdb7d('0xd')](_0xdb7d('0xe'),_0x5ee352,_0xdb7d('0xf'));logger[_0xdb7d('0x10')](_0xdb7d('0x11'),_0x5ee352,_0xdb7d('0xf'),JSON['stringify'](_0x1ce89c));if(_0x1ce89c[_0xdb7d('0x12')]){if(_0x1ce89c[_0xdb7d('0x12')]['code']===0x1f4){logger[_0xdb7d('0x12')]('ChatApplication,\x20%s,\x20%s',_0x5ee352,_0x1ce89c[_0xdb7d('0x12')][_0xdb7d('0x13')]);return _0x53cbe9(_0x1ce89c[_0xdb7d('0x12')]['message']);}logger[_0xdb7d('0x12')]('ChatApplication,\x20%s,\x20%s',_0x5ee352,_0x1ce89c[_0xdb7d('0x12')][_0xdb7d('0x13')]);return _0x45cff0(_0x1ce89c[_0xdb7d('0x12')][_0xdb7d('0x13')]);}else{logger[_0xdb7d('0xd')]('ChatApplication,\x20%s,\x20%s',_0x5ee352,_0xdb7d('0xf'));_0x45cff0(_0x1ce89c['result'][_0xdb7d('0x13')]);}})[_0xdb7d('0x14')](function(_0x4ccd69){logger[_0xdb7d('0x12')]('ChatApplication,\x20%s,\x20%s',_0x5ee352,_0x4ccd69);_0x53cbe9(_0x4ccd69);});});} \ No newline at end of file +var _0xacad=['then','info','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x5ad07a,_0x5dc082){var _0x22b237=function(_0x475012){while(--_0x475012){_0x5ad07a['push'](_0x5ad07a['shift']());}};_0x22b237(++_0x5dc082);}(_0xacad,0xf1));var _0xdaca=function(_0x53edeb,_0x1bafb2){_0x53edeb=_0x53edeb-0x0;var _0x45e208=_0xacad[_0x53edeb];return _0x45e208;};'use strict';var _=require(_0xdaca('0x0'));var util=require(_0xdaca('0x1'));var moment=require(_0xdaca('0x2'));var BPromise=require(_0xdaca('0x3'));var rs=require(_0xdaca('0x4'));var fs=require('fs');var Redis=require(_0xdaca('0x5'));var db=require(_0xdaca('0x6'))['db'];var utils=require(_0xdaca('0x7'));var logger=require(_0xdaca('0x8'))(_0xdaca('0x9'));var config=require(_0xdaca('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdaca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x986265,_0x92bf00,_0x552968){return new BPromise(function(_0x482986,_0x4267ed){return client['request'](_0x986265,_0x552968)[_0xdaca('0xc')](function(_0x5e67d6){logger[_0xdaca('0xd')]('ChatApplication,\x20%s,\x20%s',_0x92bf00,'request\x20sent');logger[_0xdaca('0xe')](_0xdaca('0xf'),_0x92bf00,_0xdaca('0x10'),JSON['stringify'](_0x5e67d6));if(_0x5e67d6[_0xdaca('0x11')]){if(_0x5e67d6[_0xdaca('0x11')][_0xdaca('0x12')]===0x1f4){logger['error'](_0xdaca('0x13'),_0x92bf00,_0x5e67d6[_0xdaca('0x11')][_0xdaca('0x14')]);return _0x4267ed(_0x5e67d6[_0xdaca('0x11')]['message']);}logger['error'](_0xdaca('0x13'),_0x92bf00,_0x5e67d6[_0xdaca('0x11')][_0xdaca('0x14')]);return _0x482986(_0x5e67d6[_0xdaca('0x11')]['message']);}else{logger[_0xdaca('0xd')](_0xdaca('0x13'),_0x92bf00,_0xdaca('0x10'));_0x482986(_0x5e67d6[_0xdaca('0x15')][_0xdaca('0x14')]);}})[_0xdaca('0x16')](function(_0x3f0a24){logger[_0xdaca('0x11')](_0xdaca('0x13'),_0x92bf00,_0x3f0a24);_0x4267ed(_0x3f0a24);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index aad4199..05cb73d 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 _0x9328=['destroy','exports','path','Router','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','put','delete'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0x9328,0xf2));var _0x8932=function(_0x5254d8,_0x2ce5dc){_0x5254d8=_0x5254d8-0x0;var _0x326c93=_0x9328[_0x5254d8];return _0x326c93;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8932('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8932('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x8932('0x2'));var interaction=require(_0x8932('0x3'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0x8932('0x4')](_0x8932('0x5'),auth[_0x8932('0x6')](),controller[_0x8932('0x7')]);router[_0x8932('0x8')](_0x8932('0x5'),auth[_0x8932('0x6')](),controller['update']);router[_0x8932('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8932('0xa')]);module[_0x8932('0xb')]=router; \ No newline at end of file +var _0xcadd=['./chatApplication.controller','/:id','isAuthenticated','show','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x475be2,_0xf0639){var _0x4ff8b1=function(_0x4bccc9){while(--_0x4bccc9){_0x475be2['push'](_0x475be2['shift']());}};_0x4ff8b1(++_0xf0639);}(_0xcadd,0x107));var _0xdcad=function(_0x49e8bb,_0x2ddee0){_0x49e8bb=_0x49e8bb-0x0;var _0x12af3b=_0xcadd[_0x49e8bb];return _0x12af3b;};'use strict';var multer=require('multer');var util=require(_0xdcad('0x0'));var path=require(_0xdcad('0x1'));var timeout=require(_0xdcad('0x2'));var express=require(_0xdcad('0x3'));var router=express[_0xdcad('0x4')]();var fs_extra=require(_0xdcad('0x5'));var auth=require(_0xdcad('0x6'));var interaction=require(_0xdcad('0x7'));var config=require(_0xdcad('0x8'));var controller=require(_0xdcad('0x9'));router['get'](_0xdcad('0xa'),auth[_0xdcad('0xb')](),controller[_0xdcad('0xc')]);router['put'](_0xdcad('0xa'),auth[_0xdcad('0xb')](),controller[_0xdcad('0xd')]);router[_0xdcad('0xe')](_0xdcad('0xa'),auth[_0xdcad('0xb')](),controller[_0xdcad('0xf')]);module[_0xdcad('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index fc352a2..cb32869 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 _0xae59=['STRING','sequelize'];(function(_0x321227,_0x261976){var _0x1dc172=function(_0x1d3e7a){while(--_0x1d3e7a){_0x321227['push'](_0x321227['shift']());}};_0x1dc172(++_0x261976);}(_0xae59,0x8d));var _0x9ae5=function(_0x2f8564,_0x35f38f){_0x2f8564=_0x2f8564-0x0;var _0x58cf05=_0xae59[_0x2f8564];return _0x58cf05;};'use strict';var Sequelize=require(_0x9ae5('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ae5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9ae5('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x8173=['exports','STRING','BOOLEAN','sequelize'];(function(_0x420da2,_0x3e6aaf){var _0x57ee13=function(_0x212b15){while(--_0x212b15){_0x420da2['push'](_0x420da2['shift']());}};_0x57ee13(++_0x3e6aaf);}(_0x8173,0x1db));var _0x3817=function(_0x224be7,_0x45ccfd){_0x224be7=_0x224be7-0x0;var _0x3fdd2c=_0x8173[_0x224be7];return _0x3fdd2c;};'use strict';var Sequelize=require(_0x3817('0x0'));module[_0x3817('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x3817('0x2')]},'write':{'type':Sequelize[_0x3817('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index a7c6bb3..4c7ab13 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 _0x7a17=['pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','send','index','map','ChatGroup','rawAttributes','type','key','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters'];(function(_0x2c618d,_0x300f9e){var _0x43467e=function(_0x1fa460){while(--_0x1fa460){_0x2c618d['push'](_0x2c618d['shift']());}};_0x43467e(++_0x300f9e);}(_0x7a17,0x13e));var _0x77a1=function(_0xd58bce,_0xe415c2){_0xd58bce=_0xd58bce-0x0;var _0x6eac4f=_0x7a17[_0xd58bce];return _0x6eac4f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x77a1('0x0'));var zipdir=require(_0x77a1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x77a1('0x2'));var moment=require('moment');var BPromise=require(_0x77a1('0x3'));var Mustache=require('mustache');var util=require(_0x77a1('0x4'));var path=require(_0x77a1('0x5'));var sox=require('sox');var csv=require(_0x77a1('0x6'));var ejs=require(_0x77a1('0x7'));var fs=require('fs');var fs_extra=require(_0x77a1('0x8'));var _=require('lodash');var squel=require(_0x77a1('0x9'));var crypto=require(_0x77a1('0xa'));var jsforce=require(_0x77a1('0xb'));var deskjs=require(_0x77a1('0xc'));var toCsv=require(_0x77a1('0x6'));var querystring=require(_0x77a1('0xd'));var Papa=require('papaparse');var Redis=require(_0x77a1('0xe'));var authService=require(_0x77a1('0xf'));var qs=require(_0x77a1('0x10'));var as=require(_0x77a1('0x11'));var hardwareService=require(_0x77a1('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x77a1('0x13'));var config=require(_0x77a1('0x14'));var licenseUtil=require(_0x77a1('0x15'));var db=require(_0x77a1('0x16'))['db'];config['redis']=_[_0x77a1('0x17')](config[_0x77a1('0x18')],{'host':_0x77a1('0x19'),'port':0x18eb});var socket=require(_0x77a1('0x1a'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x77a1('0x1b')](socket);function respondWithStatusCode(_0xb35517,_0x2e99d4){_0x2e99d4=_0x2e99d4||0xcc;return function(_0x479d0f){if(_0x479d0f){return _0xb35517['sendStatus'](_0x2e99d4);}return _0xb35517[_0x77a1('0x1c')](_0x2e99d4)[_0x77a1('0x1d')]();};}function respondWithResult(_0x30c3fb,_0x20fc28){_0x20fc28=_0x20fc28||0xc8;return function(_0x31dec1){if(_0x31dec1){return _0x30c3fb[_0x77a1('0x1c')](_0x20fc28)[_0x77a1('0x1e')](_0x31dec1);}};}function respondWithFilteredResult(_0x159d4f,_0x1ec9c3){return function(_0x433059){if(_0x433059){var _0x352d58=typeof _0x1ec9c3[_0x77a1('0x1f')]===_0x77a1('0x20')&&typeof _0x1ec9c3[_0x77a1('0x21')]==='undefined';var _0x164472=_0x433059[_0x77a1('0x22')];var _0x5ca52a=_0x352d58?0x0:_0x1ec9c3[_0x77a1('0x1f')];var _0x6aa1b3=_0x352d58?_0x433059[_0x77a1('0x22')]:_0x1ec9c3[_0x77a1('0x1f')]+_0x1ec9c3[_0x77a1('0x21')];var _0x59ab13;if(_0x6aa1b3>=_0x164472){_0x6aa1b3=_0x164472;_0x59ab13=0xc8;}else{_0x59ab13=0xce;}_0x159d4f[_0x77a1('0x1c')](_0x59ab13);return _0x159d4f['set'](_0x77a1('0x23'),_0x5ca52a+'-'+_0x6aa1b3+'/'+_0x164472)[_0x77a1('0x1e')](_0x433059);}return null;};}function patchUpdates(_0x46569b){return function(_0x2ec831){try{jsonpatch[_0x77a1('0x24')](_0x2ec831,_0x46569b,!![]);}catch(_0x49b497){return BPromise['reject'](_0x49b497);}return _0x2ec831[_0x77a1('0x25')]();};}function saveUpdates(_0xe08b10,_0x46f588){return function(_0x11a092){if(_0x11a092){return _0x11a092[_0x77a1('0x26')](_0xe08b10)[_0x77a1('0x27')](function(_0x5d3295){return _0x5d3295;});}return null;};}function removeEntity(_0x459a0a,_0x5e7d66){return function(_0x545ae6){if(_0x545ae6){return _0x545ae6[_0x77a1('0x28')]()[_0x77a1('0x27')](function(){_0x459a0a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e7367,_0x2d24f2){return function(_0x472056){if(!_0x472056){_0x5e7367['sendStatus'](0x194);}return _0x472056;};}function handleError(_0x8ccc62,_0x47ca55){_0x47ca55=_0x47ca55||0x1f4;return function(_0x536eeb){logger[_0x77a1('0x29')](_0x536eeb['stack']);if(_0x536eeb['name']){delete _0x536eeb['name'];}_0x8ccc62[_0x77a1('0x1c')](_0x47ca55)[_0x77a1('0x2a')](_0x536eeb);};}exports[_0x77a1('0x2b')]=function(_0x5ba6e5,_0x5694f1){var _0x2fe128={},_0x301c9c={},_0x5e84d0={'count':0x0,'rows':[]};var _0x24acb2=_[_0x77a1('0x2c')](db[_0x77a1('0x2d')][_0x77a1('0x2e')],function(_0x5cbff8){return{'name':_0x5cbff8['fieldName'],'type':_0x5cbff8[_0x77a1('0x2f')][_0x77a1('0x30')]};});_0x301c9c[_0x77a1('0x31')]=_[_0x77a1('0x2c')](_0x24acb2,_0x77a1('0x32'));_0x301c9c['query']=_[_0x77a1('0x33')](_0x5ba6e5[_0x77a1('0x34')]);_0x301c9c['filters']=_[_0x77a1('0x35')](_0x301c9c[_0x77a1('0x31')],_0x301c9c[_0x77a1('0x34')]);_0x2fe128[_0x77a1('0x36')]=_[_0x77a1('0x35')](_0x301c9c[_0x77a1('0x31')],qs[_0x77a1('0x37')](_0x5ba6e5[_0x77a1('0x34')][_0x77a1('0x37')]));_0x2fe128[_0x77a1('0x36')]=_0x2fe128[_0x77a1('0x36')][_0x77a1('0x38')]?_0x2fe128['attributes']:_0x301c9c['model'];if(!_0x5ba6e5[_0x77a1('0x34')][_0x77a1('0x39')](_0x77a1('0x3a'))){_0x2fe128[_0x77a1('0x21')]=qs[_0x77a1('0x21')](_0x5ba6e5[_0x77a1('0x34')][_0x77a1('0x21')]);_0x2fe128['offset']=qs[_0x77a1('0x1f')](_0x5ba6e5['query'][_0x77a1('0x1f')]);}_0x2fe128[_0x77a1('0x3b')]=qs[_0x77a1('0x3c')](_0x5ba6e5[_0x77a1('0x34')]['sort']);_0x2fe128['where']=qs[_0x77a1('0x3d')](_[_0x77a1('0x3e')](_0x5ba6e5[_0x77a1('0x34')],_0x301c9c['filters']),_0x24acb2);if(_0x5ba6e5[_0x77a1('0x34')][_0x77a1('0x3f')]){_0x2fe128[_0x77a1('0x40')]=_[_0x77a1('0x41')](_0x2fe128[_0x77a1('0x40')],{'$or':_['map'](_0x24acb2,function(_0x26ad1b){if(_0x26ad1b[_0x77a1('0x2f')]!==_0x77a1('0x42')){var _0x4b8ee7={};_0x4b8ee7[_0x26ad1b[_0x77a1('0x32')]]={'$like':'%'+_0x5ba6e5[_0x77a1('0x34')][_0x77a1('0x3f')]+'%'};return _0x4b8ee7;}})});}_0x2fe128=_[_0x77a1('0x41')]({},_0x2fe128,_0x5ba6e5[_0x77a1('0x43')]);var _0x4b62d7={'where':_0x2fe128[_0x77a1('0x40')]};return db['ChatGroup'][_0x77a1('0x22')](_0x4b62d7)[_0x77a1('0x27')](function(_0x3ab4b6){_0x5e84d0[_0x77a1('0x22')]=_0x3ab4b6;if(_0x5ba6e5['query'][_0x77a1('0x44')]){_0x2fe128[_0x77a1('0x45')]=[{'all':!![]}];}return db[_0x77a1('0x2d')]['findAll'](_0x2fe128);})[_0x77a1('0x27')](function(_0x57d0b9){_0x5e84d0[_0x77a1('0x46')]=_0x57d0b9;return _0x5e84d0;})[_0x77a1('0x27')](respondWithFilteredResult(_0x5694f1,_0x2fe128))[_0x77a1('0x47')](handleError(_0x5694f1,null));};exports[_0x77a1('0x48')]=function(_0xfef315,_0x3fffbf){var _0x2c8384={'raw':!![],'where':{'id':_0xfef315[_0x77a1('0x49')]['id']}},_0xdf594={};_0xdf594[_0x77a1('0x31')]=_[_0x77a1('0x33')](db[_0x77a1('0x2d')][_0x77a1('0x2e')]);_0xdf594[_0x77a1('0x34')]=_[_0x77a1('0x33')](_0xfef315[_0x77a1('0x34')]);_0xdf594[_0x77a1('0x3d')]=_[_0x77a1('0x35')](_0xdf594['model'],_0xdf594[_0x77a1('0x34')]);_0x2c8384['attributes']=_['intersection'](_0xdf594[_0x77a1('0x31')],qs['fields'](_0xfef315[_0x77a1('0x34')][_0x77a1('0x37')]));_0x2c8384[_0x77a1('0x36')]=_0x2c8384[_0x77a1('0x36')]['length']?_0x2c8384['attributes']:_0xdf594[_0x77a1('0x31')];if(_0xfef315[_0x77a1('0x34')][_0x77a1('0x44')]){_0x2c8384['include']=[{'all':!![]}];}_0x2c8384=_[_0x77a1('0x41')]({},_0x2c8384,_0xfef315['options']);return db[_0x77a1('0x2d')]['find'](_0x2c8384)[_0x77a1('0x27')](handleEntityNotFound(_0x3fffbf,null))[_0x77a1('0x27')](respondWithResult(_0x3fffbf,null))['catch'](handleError(_0x3fffbf,null));};exports[_0x77a1('0x4a')]=function(_0x220754,_0x54ec0d){return db[_0x77a1('0x2d')][_0x77a1('0x4a')](_0x220754['body'],{})[_0x77a1('0x27')](respondWithResult(_0x54ec0d,0xc9))['catch'](handleError(_0x54ec0d,null));};exports[_0x77a1('0x26')]=function(_0x34fd78,_0x24ad99){if(_0x34fd78['body']['id']){delete _0x34fd78[_0x77a1('0x4b')]['id'];}return db[_0x77a1('0x2d')][_0x77a1('0x4c')]({'where':{'id':_0x34fd78[_0x77a1('0x49')]['id']}})[_0x77a1('0x27')](handleEntityNotFound(_0x24ad99,null))[_0x77a1('0x27')](saveUpdates(_0x34fd78['body'],null))[_0x77a1('0x27')](respondWithResult(_0x24ad99,null))[_0x77a1('0x47')](handleError(_0x24ad99,null));};exports[_0x77a1('0x28')]=function(_0x59791e,_0x752202){return db['ChatGroup'][_0x77a1('0x4c')]({'where':{'id':_0x59791e[_0x77a1('0x49')]['id']}})['then'](handleEntityNotFound(_0x752202,null))[_0x77a1('0x27')](removeEntity(_0x752202,null))[_0x77a1('0x47')](handleError(_0x752202,null));};exports[_0x77a1('0x4d')]=function(_0x38d573,_0x623852){return db['ChatGroup']['describe']()[_0x77a1('0x27')](respondWithResult(_0x623852,null))['catch'](handleError(_0x623852,null));};exports[_0x77a1('0x4e')]=function(_0x4001e8,_0x6807b2,_0x38205a){return db[_0x77a1('0x4f')][_0x77a1('0x22')]({'where':{'ChatGroupId':_0x4001e8[_0x77a1('0x49')]['id'],'ToId':_0x4001e8[_0x77a1('0x50')]['id'],'read':![]}})[_0x77a1('0x27')](function(_0x498c3e){return{'id':_[_0x77a1('0x51')](_0x4001e8[_0x77a1('0x49')]['id']),'count':_0x498c3e};})[_0x77a1('0x27')](respondWithResult(_0x6807b2,null))[_0x77a1('0x47')](handleError(_0x6807b2,null));};exports[_0x77a1('0x52')]=function(_0x1d1cd3,_0x3ca529,_0x2c698b){return db[_0x77a1('0x2d')][_0x77a1('0x4c')]({'where':{'id':_0x1d1cd3[_0x77a1('0x49')]['id']}})['then'](handleEntityNotFound(_0x3ca529,null))[_0x77a1('0x27')](function(_0x180d8c){if(_0x180d8c){return _0x180d8c[_0x77a1('0x52')](_0x1d1cd3[_0x77a1('0x4b')][_0x77a1('0x53')],_['omit'](_0x1d1cd3['body'],['ids','id'])||{});}})[_0x77a1('0x27')](respondWithResult(_0x3ca529,null))[_0x77a1('0x47')](handleError(_0x3ca529,null));};exports[_0x77a1('0x54')]=function(_0x501eed,_0x17b32e,_0xd9e788){var _0x15ab82={};var _0x135425={};var _0x429978;var _0x1a1f57;return db[_0x77a1('0x2d')][_0x77a1('0x55')]({'where':{'id':_0x501eed[_0x77a1('0x49')]['id']}})['then'](handleEntityNotFound(_0x17b32e,null))['then'](function(_0x405cc6){if(_0x405cc6){_0x429978=_0x405cc6;_0x135425[_0x77a1('0x31')]=_['keys'](db[_0x77a1('0x56')][_0x77a1('0x2e')]);_0x135425[_0x77a1('0x34')]=_[_0x77a1('0x33')](_0x501eed[_0x77a1('0x34')]);_0x135425['filters']=_[_0x77a1('0x35')](_0x135425['model'],_0x135425['query']);_0x15ab82[_0x77a1('0x36')]=_[_0x77a1('0x35')](_0x135425['model'],qs[_0x77a1('0x37')](_0x501eed[_0x77a1('0x34')][_0x77a1('0x37')]));_0x15ab82[_0x77a1('0x36')]=_0x15ab82[_0x77a1('0x36')]['length']?_0x15ab82['attributes']:_0x135425[_0x77a1('0x31')];_0x15ab82[_0x77a1('0x3b')]=qs[_0x77a1('0x3c')](_0x501eed[_0x77a1('0x34')][_0x77a1('0x3c')]);_0x15ab82[_0x77a1('0x40')]=qs[_0x77a1('0x3d')](_['pick'](_0x501eed['query'],_0x135425['filters']));if(_0x501eed[_0x77a1('0x34')][_0x77a1('0x3f')]){_0x15ab82[_0x77a1('0x40')]=_[_0x77a1('0x41')](_0x15ab82['where'],{'$or':_[_0x77a1('0x2c')](_0x15ab82['attributes'],function(_0x471e46){var _0x13b80e={};_0x13b80e[_0x471e46]={'$like':'%'+_0x501eed[_0x77a1('0x34')][_0x77a1('0x3f')]+'%'};return _0x13b80e;})});}_0x15ab82=_[_0x77a1('0x41')]({},_0x15ab82,_0x501eed[_0x77a1('0x43')]);return _0x429978[_0x77a1('0x54')](_0x15ab82);}})[_0x77a1('0x27')](function(_0x877f4d){if(_0x877f4d){_0x1a1f57=_0x877f4d[_0x77a1('0x38')];if(!_0x501eed[_0x77a1('0x34')][_0x77a1('0x39')]('nolimit')){_0x15ab82[_0x77a1('0x21')]=qs[_0x77a1('0x21')](_0x501eed[_0x77a1('0x34')][_0x77a1('0x21')]);_0x15ab82[_0x77a1('0x1f')]=qs[_0x77a1('0x1f')](_0x501eed[_0x77a1('0x34')][_0x77a1('0x1f')]);}return _0x429978[_0x77a1('0x54')](_0x15ab82);}})['then'](function(_0x265d78){if(_0x265d78){return _0x265d78?{'count':_0x1a1f57,'rows':_0x265d78}:null;}})[_0x77a1('0x27')](respondWithResult(_0x17b32e,null))['catch'](handleError(_0x17b32e,null));};exports[_0x77a1('0x57')]=function(_0x260ae2,_0x6361c6,_0x5be9e2){return db[_0x77a1('0x2d')][_0x77a1('0x4c')]({'where':{'id':_0x260ae2[_0x77a1('0x49')]['id']}})['then'](handleEntityNotFound(_0x6361c6,null))['then'](function(_0x1cce58){if(_0x1cce58){return _0x1cce58[_0x77a1('0x57')](_0x260ae2[_0x77a1('0x34')][_0x77a1('0x53')]);}})['then'](respondWithStatusCode(_0x6361c6,null))[_0x77a1('0x47')](handleError(_0x6361c6,null));};exports[_0x77a1('0x58')]=function(_0x4541d7,_0x4adff9,_0x36e2da){if(_0x4541d7['body']['id']){delete _0x4541d7[_0x77a1('0x4b')]['id'];}return db[_0x77a1('0x2d')]['find']({'where':{'id':_0x4541d7[_0x77a1('0x49')]['id']}})[_0x77a1('0x27')](handleEntityNotFound(_0x4adff9,null))[_0x77a1('0x27')](function(_0x2a1059){if(_0x2a1059){_0x4541d7[_0x77a1('0x4b')][_0x77a1('0x59')]=_0x2a1059['id'];return db[_0x77a1('0x4f')][_0x77a1('0x4a')](_0x4541d7['body']);}})[_0x77a1('0x27')](respondWithResult(_0x4adff9,null))['catch'](handleError(_0x4adff9,null));};exports[_0x77a1('0x5a')]=function(_0x2c54be,_0x5b21df,_0x489aa5){var _0x426f31={};var _0x62d4bd={};var _0x5b3cbc;var _0x4eebbc;return db['ChatGroup'][_0x77a1('0x55')]({'where':{'id':_0x2c54be[_0x77a1('0x49')]['id']}})[_0x77a1('0x27')](handleEntityNotFound(_0x5b21df,null))[_0x77a1('0x27')](function(_0x44e71d){if(_0x44e71d){_0x5b3cbc=_0x44e71d;_0x62d4bd['model']=_['keys'](db[_0x77a1('0x4f')][_0x77a1('0x2e')]);_0x62d4bd[_0x77a1('0x34')]=_['keys'](_0x2c54be['query']);_0x62d4bd[_0x77a1('0x3d')]=_[_0x77a1('0x35')](_0x62d4bd['model'],_0x62d4bd[_0x77a1('0x34')]);_0x426f31[_0x77a1('0x36')]=_['intersection'](_0x62d4bd[_0x77a1('0x31')],qs[_0x77a1('0x37')](_0x2c54be['query'][_0x77a1('0x37')]));_0x426f31[_0x77a1('0x36')]=_0x426f31[_0x77a1('0x36')][_0x77a1('0x38')]?_0x426f31[_0x77a1('0x36')]:_0x62d4bd['model'];_0x426f31[_0x77a1('0x3b')]=qs['sort'](_0x2c54be[_0x77a1('0x34')][_0x77a1('0x3c')]);_0x426f31[_0x77a1('0x40')]=qs[_0x77a1('0x3d')](_[_0x77a1('0x3e')](_0x2c54be[_0x77a1('0x34')],_0x62d4bd[_0x77a1('0x3d')]));if(_0x2c54be['query']['filter']){_0x426f31[_0x77a1('0x40')]=_[_0x77a1('0x41')](_0x426f31[_0x77a1('0x40')],{'$or':_[_0x77a1('0x2c')](_0x426f31[_0x77a1('0x36')],function(_0x21c9d5){var _0x4e649a={};_0x4e649a[_0x21c9d5]={'$like':'%'+_0x2c54be[_0x77a1('0x34')][_0x77a1('0x3f')]+'%'};return _0x4e649a;})});}if(_0x2c54be[_0x77a1('0x34')]['$gte']){var _0x2bf6ca=_0x2c54be[_0x77a1('0x34')][_0x77a1('0x5b')][_0x77a1('0x5c')](',');var _0x4f34e8={};_0x4f34e8[_0x2bf6ca[0x0]]={'$gte':moment(_0x2bf6ca[0x1])[_0x77a1('0x5d')](_0x77a1('0x5e'))};_0x426f31[_0x77a1('0x40')]=_[_0x77a1('0x41')](_0x426f31[_0x77a1('0x40')],_0x4f34e8);}_0x426f31=_[_0x77a1('0x41')]({},_0x426f31,_0x2c54be[_0x77a1('0x43')]);return _0x5b3cbc[_0x77a1('0x5a')](_0x426f31);}})[_0x77a1('0x27')](function(_0x13af84){if(_0x13af84){_0x4eebbc=_0x13af84[_0x77a1('0x38')];if(!_0x2c54be[_0x77a1('0x34')][_0x77a1('0x39')](_0x77a1('0x3a'))){_0x426f31[_0x77a1('0x21')]=qs[_0x77a1('0x21')](_0x2c54be['query']['limit']);_0x426f31[_0x77a1('0x1f')]=qs['offset'](_0x2c54be[_0x77a1('0x34')][_0x77a1('0x1f')]);}return _0x5b3cbc[_0x77a1('0x5a')](_0x426f31);}})[_0x77a1('0x27')](function(_0x5e2bb3){if(_0x5e2bb3){return _0x5e2bb3?{'count':_0x4eebbc,'rows':_0x5e2bb3}:null;}})[_0x77a1('0x27')](respondWithResult(_0x5b21df,null))['catch'](handleError(_0x5b21df,null));}; \ No newline at end of file +var _0x3e99=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','error','name','send','index','ChatGroup','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','length','includeAll','find','create','body','update','params','describe','getUnread','user','toInteger','addMembers','getMembers','findOne','User','nolimit','removeMembers','ids','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x3e99,0x11e));var _0x93e9=function(_0x3e2fb2,_0x51e61e){_0x3e2fb2=_0x3e2fb2-0x0;var _0xcf2aa8=_0x3e99[_0x3e2fb2];return _0xcf2aa8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93e9('0x0'));var zipdir=require(_0x93e9('0x1'));var jsonpatch=require(_0x93e9('0x2'));var rp=require('request-promise');var moment=require(_0x93e9('0x3'));var BPromise=require(_0x93e9('0x4'));var Mustache=require(_0x93e9('0x5'));var util=require(_0x93e9('0x6'));var path=require(_0x93e9('0x7'));var sox=require(_0x93e9('0x8'));var csv=require(_0x93e9('0x9'));var ejs=require(_0x93e9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x93e9('0xb'));var squel=require(_0x93e9('0xc'));var crypto=require(_0x93e9('0xd'));var jsforce=require(_0x93e9('0xe'));var deskjs=require(_0x93e9('0xf'));var toCsv=require(_0x93e9('0x9'));var querystring=require(_0x93e9('0x10'));var Papa=require(_0x93e9('0x11'));var Redis=require('ioredis');var authService=require(_0x93e9('0x12'));var qs=require(_0x93e9('0x13'));var as=require(_0x93e9('0x14'));var hardwareService=require(_0x93e9('0x15'));var logger=require('../../config/logger')(_0x93e9('0x16'));var utils=require(_0x93e9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x93e9('0x18'));var db=require(_0x93e9('0x19'))['db'];config[_0x93e9('0x1a')]=_[_0x93e9('0x1b')](config[_0x93e9('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatGroup.socket')[_0x93e9('0x1c')](socket);function respondWithStatusCode(_0x4cf88b,_0x1164c0){_0x1164c0=_0x1164c0||0xcc;return function(_0x21f0e9){if(_0x21f0e9){return _0x4cf88b[_0x93e9('0x1d')](_0x1164c0);}return _0x4cf88b[_0x93e9('0x1e')](_0x1164c0)[_0x93e9('0x1f')]();};}function respondWithResult(_0x4593e8,_0x14ec48){_0x14ec48=_0x14ec48||0xc8;return function(_0x32d6f6){if(_0x32d6f6){return _0x4593e8['status'](_0x14ec48)[_0x93e9('0x20')](_0x32d6f6);}};}function respondWithFilteredResult(_0x3eed3c,_0x28e325){return function(_0x3658f1){if(_0x3658f1){var _0x5dc46f=typeof _0x28e325[_0x93e9('0x21')]===_0x93e9('0x22')&&typeof _0x28e325[_0x93e9('0x23')]===_0x93e9('0x22');var _0x52c92c=_0x3658f1['count'];var _0x4a71ed=_0x5dc46f?0x0:_0x28e325['offset'];var _0x4deb7b=_0x5dc46f?_0x3658f1[_0x93e9('0x24')]:_0x28e325[_0x93e9('0x21')]+_0x28e325[_0x93e9('0x23')];var _0x41e080;if(_0x4deb7b>=_0x52c92c){_0x4deb7b=_0x52c92c;_0x41e080=0xc8;}else{_0x41e080=0xce;}_0x3eed3c[_0x93e9('0x1e')](_0x41e080);return _0x3eed3c['set'](_0x93e9('0x25'),_0x4a71ed+'-'+_0x4deb7b+'/'+_0x52c92c)[_0x93e9('0x20')](_0x3658f1);}return null;};}function patchUpdates(_0x7e9741){return function(_0x52fec7){try{jsonpatch[_0x93e9('0x26')](_0x52fec7,_0x7e9741,!![]);}catch(_0x4c9e32){return BPromise['reject'](_0x4c9e32);}return _0x52fec7[_0x93e9('0x27')]();};}function saveUpdates(_0x19dc70,_0x14b553){return function(_0x83ee15){if(_0x83ee15){return _0x83ee15['update'](_0x19dc70)[_0x93e9('0x28')](function(_0x2cedcf){return _0x2cedcf;});}return null;};}function removeEntity(_0x45f3fd,_0x264426){return function(_0x1f95d5){if(_0x1f95d5){return _0x1f95d5['destroy']()['then'](function(){_0x45f3fd[_0x93e9('0x1e')](0xcc)[_0x93e9('0x1f')]();});}};}function handleEntityNotFound(_0x5e42d9,_0x27ff03){return function(_0x1d23c8){if(!_0x1d23c8){_0x5e42d9[_0x93e9('0x1d')](0x194);}return _0x1d23c8;};}function handleError(_0x5ab70b,_0x43208a){_0x43208a=_0x43208a||0x1f4;return function(_0x527596){logger[_0x93e9('0x29')](_0x527596['stack']);if(_0x527596[_0x93e9('0x2a')]){delete _0x527596[_0x93e9('0x2a')];}_0x5ab70b[_0x93e9('0x1e')](_0x43208a)[_0x93e9('0x2b')](_0x527596);};}exports[_0x93e9('0x2c')]=function(_0x3fad22,_0x4b9213){var _0x231cfa={},_0x179258={},_0x55be20={'count':0x0,'rows':[]};var _0x4fc2ba=_['map'](db[_0x93e9('0x2d')][_0x93e9('0x2e')],function(_0x49317e){return{'name':_0x49317e['fieldName'],'type':_0x49317e[_0x93e9('0x2f')]['key']};});_0x179258[_0x93e9('0x30')]=_['map'](_0x4fc2ba,_0x93e9('0x2a'));_0x179258[_0x93e9('0x31')]=_[_0x93e9('0x32')](_0x3fad22['query']);_0x179258[_0x93e9('0x33')]=_[_0x93e9('0x34')](_0x179258[_0x93e9('0x30')],_0x179258['query']);_0x231cfa['attributes']=_[_0x93e9('0x34')](_0x179258['model'],qs['fields'](_0x3fad22[_0x93e9('0x31')][_0x93e9('0x35')]));_0x231cfa[_0x93e9('0x36')]=_0x231cfa[_0x93e9('0x36')]['length']?_0x231cfa[_0x93e9('0x36')]:_0x179258[_0x93e9('0x30')];if(!_0x3fad22['query'][_0x93e9('0x37')]('nolimit')){_0x231cfa[_0x93e9('0x23')]=qs['limit'](_0x3fad22[_0x93e9('0x31')]['limit']);_0x231cfa[_0x93e9('0x21')]=qs[_0x93e9('0x21')](_0x3fad22[_0x93e9('0x31')]['offset']);}_0x231cfa[_0x93e9('0x38')]=qs[_0x93e9('0x39')](_0x3fad22[_0x93e9('0x31')]['sort']);_0x231cfa['where']=qs[_0x93e9('0x33')](_[_0x93e9('0x3a')](_0x3fad22[_0x93e9('0x31')],_0x179258[_0x93e9('0x33')]),_0x4fc2ba);if(_0x3fad22['query'][_0x93e9('0x3b')]){_0x231cfa[_0x93e9('0x3c')]=_[_0x93e9('0x3d')](_0x231cfa[_0x93e9('0x3c')],{'$or':_[_0x93e9('0x3e')](_0x4fc2ba,function(_0xe7acf2){if(_0xe7acf2[_0x93e9('0x2f')]!==_0x93e9('0x3f')){var _0x87fd4d={};_0x87fd4d[_0xe7acf2[_0x93e9('0x2a')]]={'$like':'%'+_0x3fad22[_0x93e9('0x31')][_0x93e9('0x3b')]+'%'};return _0x87fd4d;}})});}_0x231cfa=_['merge']({},_0x231cfa,_0x3fad22[_0x93e9('0x40')]);var _0x5093eb={'where':_0x231cfa['where']};return db[_0x93e9('0x2d')][_0x93e9('0x24')](_0x5093eb)[_0x93e9('0x28')](function(_0x5d37b7){_0x55be20[_0x93e9('0x24')]=_0x5d37b7;if(_0x3fad22[_0x93e9('0x31')]['includeAll']){_0x231cfa[_0x93e9('0x41')]=[{'all':!![]}];}return db[_0x93e9('0x2d')][_0x93e9('0x42')](_0x231cfa);})[_0x93e9('0x28')](function(_0x16705c){_0x55be20[_0x93e9('0x43')]=_0x16705c;return _0x55be20;})[_0x93e9('0x28')](respondWithFilteredResult(_0x4b9213,_0x231cfa))[_0x93e9('0x44')](handleError(_0x4b9213,null));};exports[_0x93e9('0x45')]=function(_0x1e810e,_0x406dbd){var _0x1eccf4={'raw':!![],'where':{'id':_0x1e810e['params']['id']}},_0x2d300d={};_0x2d300d[_0x93e9('0x30')]=_['keys'](db[_0x93e9('0x2d')]['rawAttributes']);_0x2d300d['query']=_['keys'](_0x1e810e[_0x93e9('0x31')]);_0x2d300d['filters']=_['intersection'](_0x2d300d[_0x93e9('0x30')],_0x2d300d['query']);_0x1eccf4[_0x93e9('0x36')]=_[_0x93e9('0x34')](_0x2d300d[_0x93e9('0x30')],qs[_0x93e9('0x35')](_0x1e810e[_0x93e9('0x31')][_0x93e9('0x35')]));_0x1eccf4[_0x93e9('0x36')]=_0x1eccf4[_0x93e9('0x36')][_0x93e9('0x46')]?_0x1eccf4[_0x93e9('0x36')]:_0x2d300d[_0x93e9('0x30')];if(_0x1e810e[_0x93e9('0x31')][_0x93e9('0x47')]){_0x1eccf4['include']=[{'all':!![]}];}_0x1eccf4=_[_0x93e9('0x3d')]({},_0x1eccf4,_0x1e810e[_0x93e9('0x40')]);return db[_0x93e9('0x2d')][_0x93e9('0x48')](_0x1eccf4)['then'](handleEntityNotFound(_0x406dbd,null))['then'](respondWithResult(_0x406dbd,null))[_0x93e9('0x44')](handleError(_0x406dbd,null));};exports[_0x93e9('0x49')]=function(_0x5bff40,_0x2ea0a4){return db['ChatGroup'][_0x93e9('0x49')](_0x5bff40[_0x93e9('0x4a')],{})[_0x93e9('0x28')](respondWithResult(_0x2ea0a4,0xc9))[_0x93e9('0x44')](handleError(_0x2ea0a4,null));};exports[_0x93e9('0x4b')]=function(_0x4d57a4,_0x2d9468){if(_0x4d57a4[_0x93e9('0x4a')]['id']){delete _0x4d57a4[_0x93e9('0x4a')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x4d57a4['params']['id']}})[_0x93e9('0x28')](handleEntityNotFound(_0x2d9468,null))[_0x93e9('0x28')](saveUpdates(_0x4d57a4[_0x93e9('0x4a')],null))[_0x93e9('0x28')](respondWithResult(_0x2d9468,null))[_0x93e9('0x44')](handleError(_0x2d9468,null));};exports['destroy']=function(_0x2efc55,_0x744d42){return db[_0x93e9('0x2d')]['find']({'where':{'id':_0x2efc55[_0x93e9('0x4c')]['id']}})[_0x93e9('0x28')](handleEntityNotFound(_0x744d42,null))['then'](removeEntity(_0x744d42,null))[_0x93e9('0x44')](handleError(_0x744d42,null));};exports[_0x93e9('0x4d')]=function(_0x47ea3e,_0x5cd8cd){return db[_0x93e9('0x2d')]['describe']()[_0x93e9('0x28')](respondWithResult(_0x5cd8cd,null))[_0x93e9('0x44')](handleError(_0x5cd8cd,null));};exports[_0x93e9('0x4e')]=function(_0x432ae2,_0x2340c4,_0x5ca055){return db['ChatInternalMessage'][_0x93e9('0x24')]({'where':{'ChatGroupId':_0x432ae2[_0x93e9('0x4c')]['id'],'ToId':_0x432ae2[_0x93e9('0x4f')]['id'],'read':![]}})[_0x93e9('0x28')](function(_0xe854f){return{'id':_[_0x93e9('0x50')](_0x432ae2['params']['id']),'count':_0xe854f};})[_0x93e9('0x28')](respondWithResult(_0x2340c4,null))[_0x93e9('0x44')](handleError(_0x2340c4,null));};exports[_0x93e9('0x51')]=function(_0x133fc8,_0x1e4d63,_0x9ac4b7){return db['ChatGroup'][_0x93e9('0x48')]({'where':{'id':_0x133fc8[_0x93e9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1e4d63,null))[_0x93e9('0x28')](function(_0x75997e){if(_0x75997e){return _0x75997e[_0x93e9('0x51')](_0x133fc8[_0x93e9('0x4a')]['ids'],_['omit'](_0x133fc8[_0x93e9('0x4a')],['ids','id'])||{});}})[_0x93e9('0x28')](respondWithResult(_0x1e4d63,null))['catch'](handleError(_0x1e4d63,null));};exports[_0x93e9('0x52')]=function(_0xbbedc0,_0x38964c,_0x1d67c8){var _0x2bade7={};var _0x494f43={};var _0x3b4ba9;var _0x486b3a;return db[_0x93e9('0x2d')][_0x93e9('0x53')]({'where':{'id':_0xbbedc0['params']['id']}})[_0x93e9('0x28')](handleEntityNotFound(_0x38964c,null))[_0x93e9('0x28')](function(_0x1a0e71){if(_0x1a0e71){_0x3b4ba9=_0x1a0e71;_0x494f43[_0x93e9('0x30')]=_[_0x93e9('0x32')](db[_0x93e9('0x54')]['rawAttributes']);_0x494f43[_0x93e9('0x31')]=_[_0x93e9('0x32')](_0xbbedc0[_0x93e9('0x31')]);_0x494f43[_0x93e9('0x33')]=_[_0x93e9('0x34')](_0x494f43[_0x93e9('0x30')],_0x494f43[_0x93e9('0x31')]);_0x2bade7[_0x93e9('0x36')]=_[_0x93e9('0x34')](_0x494f43[_0x93e9('0x30')],qs[_0x93e9('0x35')](_0xbbedc0['query'][_0x93e9('0x35')]));_0x2bade7[_0x93e9('0x36')]=_0x2bade7[_0x93e9('0x36')][_0x93e9('0x46')]?_0x2bade7['attributes']:_0x494f43['model'];_0x2bade7[_0x93e9('0x38')]=qs[_0x93e9('0x39')](_0xbbedc0[_0x93e9('0x31')]['sort']);_0x2bade7[_0x93e9('0x3c')]=qs[_0x93e9('0x33')](_[_0x93e9('0x3a')](_0xbbedc0['query'],_0x494f43[_0x93e9('0x33')]));if(_0xbbedc0[_0x93e9('0x31')][_0x93e9('0x3b')]){_0x2bade7[_0x93e9('0x3c')]=_[_0x93e9('0x3d')](_0x2bade7[_0x93e9('0x3c')],{'$or':_[_0x93e9('0x3e')](_0x2bade7[_0x93e9('0x36')],function(_0x5281f3){var _0x1625ba={};_0x1625ba[_0x5281f3]={'$like':'%'+_0xbbedc0[_0x93e9('0x31')]['filter']+'%'};return _0x1625ba;})});}_0x2bade7=_['merge']({},_0x2bade7,_0xbbedc0[_0x93e9('0x40')]);return _0x3b4ba9['getMembers'](_0x2bade7);}})[_0x93e9('0x28')](function(_0x105d82){if(_0x105d82){_0x486b3a=_0x105d82['length'];if(!_0xbbedc0[_0x93e9('0x31')]['hasOwnProperty'](_0x93e9('0x55'))){_0x2bade7[_0x93e9('0x23')]=qs[_0x93e9('0x23')](_0xbbedc0['query'][_0x93e9('0x23')]);_0x2bade7[_0x93e9('0x21')]=qs['offset'](_0xbbedc0[_0x93e9('0x31')][_0x93e9('0x21')]);}return _0x3b4ba9[_0x93e9('0x52')](_0x2bade7);}})[_0x93e9('0x28')](function(_0x24f949){if(_0x24f949){return _0x24f949?{'count':_0x486b3a,'rows':_0x24f949}:null;}})[_0x93e9('0x28')](respondWithResult(_0x38964c,null))[_0x93e9('0x44')](handleError(_0x38964c,null));};exports[_0x93e9('0x56')]=function(_0x3cfc0e,_0x1cef5a,_0x48138c){return db[_0x93e9('0x2d')]['find']({'where':{'id':_0x3cfc0e[_0x93e9('0x4c')]['id']}})[_0x93e9('0x28')](handleEntityNotFound(_0x1cef5a,null))[_0x93e9('0x28')](function(_0x38bb57){if(_0x38bb57){return _0x38bb57[_0x93e9('0x56')](_0x3cfc0e[_0x93e9('0x31')][_0x93e9('0x57')]);}})[_0x93e9('0x28')](respondWithStatusCode(_0x1cef5a,null))[_0x93e9('0x44')](handleError(_0x1cef5a,null));};exports[_0x93e9('0x58')]=function(_0x25f7b9,_0x5627fd,_0x435bb8){if(_0x25f7b9['body']['id']){delete _0x25f7b9[_0x93e9('0x4a')]['id'];}return db[_0x93e9('0x2d')][_0x93e9('0x48')]({'where':{'id':_0x25f7b9[_0x93e9('0x4c')]['id']}})[_0x93e9('0x28')](handleEntityNotFound(_0x5627fd,null))[_0x93e9('0x28')](function(_0x4bfade){if(_0x4bfade){_0x25f7b9[_0x93e9('0x4a')][_0x93e9('0x59')]=_0x4bfade['id'];return db[_0x93e9('0x5a')]['create'](_0x25f7b9[_0x93e9('0x4a')]);}})[_0x93e9('0x28')](respondWithResult(_0x5627fd,null))['catch'](handleError(_0x5627fd,null));};exports[_0x93e9('0x5b')]=function(_0x43475e,_0x27ba61,_0x8da2a0){var _0x223790={};var _0x31c7da={};var _0x1b3f5f;var _0x1669f4;return db['ChatGroup'][_0x93e9('0x53')]({'where':{'id':_0x43475e[_0x93e9('0x4c')]['id']}})[_0x93e9('0x28')](handleEntityNotFound(_0x27ba61,null))[_0x93e9('0x28')](function(_0x28d67a){if(_0x28d67a){_0x1b3f5f=_0x28d67a;_0x31c7da[_0x93e9('0x30')]=_['keys'](db[_0x93e9('0x5a')]['rawAttributes']);_0x31c7da['query']=_[_0x93e9('0x32')](_0x43475e[_0x93e9('0x31')]);_0x31c7da['filters']=_['intersection'](_0x31c7da['model'],_0x31c7da['query']);_0x223790[_0x93e9('0x36')]=_[_0x93e9('0x34')](_0x31c7da[_0x93e9('0x30')],qs['fields'](_0x43475e['query'][_0x93e9('0x35')]));_0x223790['attributes']=_0x223790['attributes'][_0x93e9('0x46')]?_0x223790['attributes']:_0x31c7da['model'];_0x223790[_0x93e9('0x38')]=qs[_0x93e9('0x39')](_0x43475e[_0x93e9('0x31')][_0x93e9('0x39')]);_0x223790[_0x93e9('0x3c')]=qs[_0x93e9('0x33')](_[_0x93e9('0x3a')](_0x43475e[_0x93e9('0x31')],_0x31c7da['filters']));if(_0x43475e[_0x93e9('0x31')]['filter']){_0x223790[_0x93e9('0x3c')]=_[_0x93e9('0x3d')](_0x223790[_0x93e9('0x3c')],{'$or':_[_0x93e9('0x3e')](_0x223790[_0x93e9('0x36')],function(_0x4ba919){var _0x31db91={};_0x31db91[_0x4ba919]={'$like':'%'+_0x43475e[_0x93e9('0x31')]['filter']+'%'};return _0x31db91;})});}if(_0x43475e[_0x93e9('0x31')][_0x93e9('0x5c')]){var _0x591d48=_0x43475e[_0x93e9('0x31')][_0x93e9('0x5c')][_0x93e9('0x5d')](',');var _0x10d606={};_0x10d606[_0x591d48[0x0]]={'$gte':moment(_0x591d48[0x1])[_0x93e9('0x5e')](_0x93e9('0x5f'))};_0x223790['where']=_[_0x93e9('0x3d')](_0x223790[_0x93e9('0x3c')],_0x10d606);}_0x223790=_['merge']({},_0x223790,_0x43475e[_0x93e9('0x40')]);return _0x1b3f5f['getMessages'](_0x223790);}})[_0x93e9('0x28')](function(_0x19922a){if(_0x19922a){_0x1669f4=_0x19922a[_0x93e9('0x46')];if(!_0x43475e[_0x93e9('0x31')]['hasOwnProperty'](_0x93e9('0x55'))){_0x223790['limit']=qs['limit'](_0x43475e['query'][_0x93e9('0x23')]);_0x223790['offset']=qs['offset'](_0x43475e[_0x93e9('0x31')]['offset']);}return _0x1b3f5f[_0x93e9('0x5b')](_0x223790);}})[_0x93e9('0x28')](function(_0x43c61f){if(_0x43c61f){return _0x43c61f?{'count':_0x1669f4,'rows':_0x43c61f}:null;}})[_0x93e9('0x28')](respondWithResult(_0x27ba61,null))[_0x93e9('0x44')](handleError(_0x27ba61,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 75f0c1b..0c45e8b 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 _0xe6c0=['../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0xf482d4,_0x55210d){var _0x1331f0=function(_0x64509a){while(--_0x64509a){_0xf482d4['push'](_0xf482d4['shift']());}};_0x1331f0(++_0x55210d);}(_0xe6c0,0x88));var _0x0e6c=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xe6c0[_0x50007c];return _0x5c1ec7;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x0e6c('0x0'))['db'][_0x0e6c('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x0e6c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0e6c('0x3'),'afterDestroy':_0x0e6c('0x4')};function emitEvent(_0x27070e){return function(_0x37d20e,_0x11ec6f,_0x441f36){ChatGroupEvents[_0x0e6c('0x5')](_0x27070e+':'+_0x37d20e['id'],_0x37d20e);ChatGroupEvents[_0x0e6c('0x5')](_0x27070e,_0x37d20e);_0x441f36(null);};}for(var e in events){if(events[_0x0e6c('0x6')](e)){var event=events[e];ChatGroup[_0x0e6c('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x37c7=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','ChatGroup'];(function(_0x110cbb,_0x186ee7){var _0x145f91=function(_0x3d2195){while(--_0x3d2195){_0x110cbb['push'](_0x110cbb['shift']());}};_0x145f91(++_0x186ee7);}(_0x37c7,0xda));var _0x737c=function(_0x3fd165,_0x5e2e2f){_0x3fd165=_0x3fd165-0x0;var _0x50f970=_0x37c7[_0x3fd165];return _0x50f970;};'use strict';var EventEmitter=require(_0x737c('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x737c('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x737c('0x2')](0x0);var events={'afterCreate':_0x737c('0x3'),'afterUpdate':_0x737c('0x4'),'afterDestroy':_0x737c('0x5')};function emitEvent(_0xd7f3a4){return function(_0x2ca0a9,_0x5e7ce6,_0x3ad39b){ChatGroupEvents[_0x737c('0x6')](_0xd7f3a4+':'+_0x2ca0a9['id'],_0x2ca0a9);ChatGroupEvents[_0x737c('0x6')](_0xd7f3a4,_0x2ca0a9);_0x3ad39b(null);};}for(var e in events){if(events[_0x737c('0x7')](e)){var event=events[e];ChatGroup[_0x737c('0x8')](e,emitEvent(event));}}module[_0x737c('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 9ad6284..25f0700 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 _0xbff6=['./chatGroup.attributes','exports','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbff6,0x1ba));var _0x6bff=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xbff6[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x6bff('0x0'));var util=require(_0x6bff('0x1'));var logger=require('../../config/logger')(_0x6bff('0x2'));var moment=require(_0x6bff('0x3'));var BPromise=require(_0x6bff('0x4'));var rp=require(_0x6bff('0x5'));var fs=require('fs');var path=require(_0x6bff('0x6'));var rimraf=require('rimraf');var config=require(_0x6bff('0x7'));var attributes=require(_0x6bff('0x8'));module[_0x6bff('0x9')]=function(_0xa84feb,_0x136b16){return _0xa84feb['define']('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x390d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups'];(function(_0x247147,_0x27989c){var _0x49d146=function(_0x2329ed){while(--_0x2329ed){_0x247147['push'](_0x247147['shift']());}};_0x49d146(++_0x27989c);}(_0x390d,0xee));var _0xd390=function(_0x2cea39,_0x15b1e2){_0x2cea39=_0x2cea39-0x0;var _0x1cfeb6=_0x390d[_0x2cea39];return _0x1cfeb6;};'use strict';var _=require(_0xd390('0x0'));var util=require(_0xd390('0x1'));var logger=require(_0xd390('0x2'))(_0xd390('0x3'));var moment=require(_0xd390('0x4'));var BPromise=require(_0xd390('0x5'));var rp=require(_0xd390('0x6'));var fs=require('fs');var path=require(_0xd390('0x7'));var rimraf=require(_0xd390('0x8'));var config=require('../../config/environment');var attributes=require(_0xd390('0x9'));module[_0xd390('0xa')]=function(_0x5a825b,_0x149248){return _0x5a825b[_0xd390('0xb')](_0xd390('0xc'),attributes,{'tableName':_0xd390('0xd'),'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 b92aa57..c234471 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 _0xe599=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./chatGroup.socket','register','request','then','info','request\x20sent','debug','stringify','error','ChatGroup,\x20%s,\x20%s','message','catch','lodash'];(function(_0x560d66,_0xf86af7){var _0x1a7191=function(_0x47fdbc){while(--_0x47fdbc){_0x560d66['push'](_0x560d66['shift']());}};_0x1a7191(++_0xf86af7);}(_0xe599,0x1e5));var _0x9e59=function(_0x4aa192,_0x2a1a42){_0x4aa192=_0x4aa192-0x0;var _0x43913d=_0xe599[_0x4aa192];return _0x43913d;};'use strict';var _=require(_0x9e59('0x0'));var util=require(_0x9e59('0x1'));var moment=require(_0x9e59('0x2'));var BPromise=require(_0x9e59('0x3'));var rs=require(_0x9e59('0x4'));var fs=require('fs');var Redis=require(_0x9e59('0x5'));var db=require(_0x9e59('0x6'))['db'];var utils=require(_0x9e59('0x7'));var logger=require(_0x9e59('0x8'))('rpc');var config=require(_0x9e59('0x9'));var jayson=require(_0x9e59('0xa'));var client=jayson['client'][_0x9e59('0xb')]({'port':0x232a});config['redis']=_[_0x9e59('0xc')](config[_0x9e59('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e59('0xe'))(new Redis(config[_0x9e59('0xd')]));require(_0x9e59('0xf'))[_0x9e59('0x10')](socket);function respondWithRpcPromise(_0x64d093,_0x14a5d7,_0x578fdc){return new BPromise(function(_0x312bc6,_0x5ba142){return client[_0x9e59('0x11')](_0x64d093,_0x578fdc)[_0x9e59('0x12')](function(_0x21c404){logger[_0x9e59('0x13')]('ChatGroup,\x20%s,\x20%s',_0x14a5d7,_0x9e59('0x14'));logger[_0x9e59('0x15')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x14a5d7,_0x9e59('0x14'),JSON[_0x9e59('0x16')](_0x21c404));if(_0x21c404[_0x9e59('0x17')]){if(_0x21c404[_0x9e59('0x17')]['code']===0x1f4){logger[_0x9e59('0x17')](_0x9e59('0x18'),_0x14a5d7,_0x21c404[_0x9e59('0x17')][_0x9e59('0x19')]);return _0x5ba142(_0x21c404[_0x9e59('0x17')][_0x9e59('0x19')]);}logger[_0x9e59('0x17')](_0x9e59('0x18'),_0x14a5d7,_0x21c404['error'][_0x9e59('0x19')]);return _0x312bc6(_0x21c404['error']['message']);}else{logger['info'](_0x9e59('0x18'),_0x14a5d7,_0x9e59('0x14'));_0x312bc6(_0x21c404['result'][_0x9e59('0x19')]);}})[_0x9e59('0x1a')](function(_0x40f315){logger[_0x9e59('0x17')](_0x9e59('0x18'),_0x14a5d7,_0x40f315);_0x5ba142(_0x40f315);});});} \ No newline at end of file +var _0xf776=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./chatGroup.socket','register','request','then'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xf776,0x169));var _0x6f77=function(_0x4bfc13,_0x56189a){_0x4bfc13=_0x4bfc13-0x0;var _0x24e668=_0xf776[_0x4bfc13];return _0x24e668;};'use strict';var _=require(_0x6f77('0x0'));var util=require('util');var moment=require(_0x6f77('0x1'));var BPromise=require(_0x6f77('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f77('0x3'));var db=require(_0x6f77('0x4'))['db'];var utils=require(_0x6f77('0x5'));var logger=require(_0x6f77('0x6'))('rpc');var config=require(_0x6f77('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6f77('0x8')][_0x6f77('0x9')]({'port':0x232a});config[_0x6f77('0xa')]=_[_0x6f77('0xb')](config['redis'],{'host':_0x6f77('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f77('0xa')]));require(_0x6f77('0xd'))[_0x6f77('0xe')](socket);function respondWithRpcPromise(_0x148902,_0x51b0cb,_0x11f8ad){return new BPromise(function(_0x2902bd,_0x2f4a50){return client[_0x6f77('0xf')](_0x148902,_0x11f8ad)[_0x6f77('0x10')](function(_0x1ae008){logger['info'](_0x6f77('0x11'),_0x51b0cb,_0x6f77('0x12'));logger[_0x6f77('0x13')](_0x6f77('0x14'),_0x51b0cb,_0x6f77('0x12'),JSON[_0x6f77('0x15')](_0x1ae008));if(_0x1ae008[_0x6f77('0x16')]){if(_0x1ae008[_0x6f77('0x16')][_0x6f77('0x17')]===0x1f4){logger[_0x6f77('0x16')](_0x6f77('0x11'),_0x51b0cb,_0x1ae008[_0x6f77('0x16')]['message']);return _0x2f4a50(_0x1ae008['error'][_0x6f77('0x18')]);}logger[_0x6f77('0x16')]('ChatGroup,\x20%s,\x20%s',_0x51b0cb,_0x1ae008[_0x6f77('0x16')]['message']);return _0x2902bd(_0x1ae008[_0x6f77('0x16')][_0x6f77('0x18')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x51b0cb,_0x6f77('0x12'));_0x2902bd(_0x1ae008[_0x6f77('0x19')][_0x6f77('0x18')]);}})[_0x6f77('0x1a')](function(_0xb1e6d){logger[_0x6f77('0x16')](_0x6f77('0x11'),_0x51b0cb,_0xb1e6d);_0x2f4a50(_0xb1e6d);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 6ceb0e0..47f53a7 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 _0x58a4=['update','emit','removeListener','register','length','chatGroup:','./chatGroup.events','remove'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0x58a4,0x1ee));var _0x458a=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0x58a4[_0xd050c6];return _0x7278a;};'use strict';var ChatGroupEvents=require(_0x458a('0x0'));var events=['save',_0x458a('0x1'),_0x458a('0x2')];function createListener(_0x317933,_0x415584){return function(_0x25e1c0){_0x415584[_0x458a('0x3')](_0x317933,_0x25e1c0);};}function removeListener(_0x5ef3ca,_0x2d013f){return function(){ChatGroupEvents[_0x458a('0x4')](_0x5ef3ca,_0x2d013f);};}exports[_0x458a('0x5')]=function(_0x2d22e8){for(var _0x451367=0x0,_0x43064e=events[_0x458a('0x6')];_0x451367<_0x43064e;_0x451367++){var _0x1ce74b=events[_0x451367];var _0x54889e=createListener(_0x458a('0x7')+_0x1ce74b,_0x2d22e8);ChatGroupEvents['on'](_0x1ce74b,_0x54889e);}}; \ No newline at end of file +var _0x2d5f=['remove','emit','removeListener','register','length','chatGroup:','./chatGroup.events'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x2d5f,0x1f0));var _0xf2d5=function(_0x2c2a8e,_0x1dfe39){_0x2c2a8e=_0x2c2a8e-0x0;var _0x3b9e38=_0x2d5f[_0x2c2a8e];return _0x3b9e38;};'use strict';var ChatGroupEvents=require(_0xf2d5('0x0'));var events=['save',_0xf2d5('0x1'),'update'];function createListener(_0x3dda86,_0x350713){return function(_0x1203b4){_0x350713[_0xf2d5('0x2')](_0x3dda86,_0x1203b4);};}function removeListener(_0x34989f,_0x15f0b7){return function(){ChatGroupEvents[_0xf2d5('0x3')](_0x34989f,_0x15f0b7);};}exports[_0xf2d5('0x4')]=function(_0x38fe97){for(var _0x2dd2ab=0x0,_0xa7dbaa=events[_0xf2d5('0x5')];_0x2dd2ab<_0xa7dbaa;_0x2dd2ab++){var _0x1768b1=events[_0x2dd2ab];var _0x32e98c=createListener(_0xf2d5('0x6')+_0x1768b1,_0x38fe97);ChatGroupEvents['on'](_0x1768b1,_0x32e98c);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index f8be791..f8eb45e 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 _0xa2d5=['../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','post','/:id/messages','addMessage','put','update','destroy','delete','removeMembers','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x28001b,_0x5854cf){var _0x238a36=function(_0x582a51){while(--_0x582a51){_0x28001b['push'](_0x28001b['shift']());}};_0x238a36(++_0x5854cf);}(_0xa2d5,0x12e));var _0x5a2d=function(_0x181ac8,_0x4d7515){_0x181ac8=_0x181ac8-0x0;var _0x449ae3=_0xa2d5[_0x181ac8];return _0x449ae3;};'use strict';var multer=require(_0x5a2d('0x0'));var util=require(_0x5a2d('0x1'));var path=require('path');var timeout=require(_0x5a2d('0x2'));var express=require(_0x5a2d('0x3'));var router=express[_0x5a2d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5a2d('0x5'));var config=require(_0x5a2d('0x6'));var controller=require(_0x5a2d('0x7'));router[_0x5a2d('0x8')]('/',auth[_0x5a2d('0x9')](),controller[_0x5a2d('0xa')]);router[_0x5a2d('0x8')](_0x5a2d('0xb'),auth[_0x5a2d('0x9')](),controller[_0x5a2d('0xc')]);router[_0x5a2d('0x8')](_0x5a2d('0xd'),auth[_0x5a2d('0x9')](),controller[_0x5a2d('0xe')]);router['get'](_0x5a2d('0xf'),auth[_0x5a2d('0x9')](),controller[_0x5a2d('0x10')]);router['get'](_0x5a2d('0x11'),auth['isAuthenticated'](),controller[_0x5a2d('0x12')]);router[_0x5a2d('0x8')]('/:id/messages',auth[_0x5a2d('0x9')](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x5a2d('0x11'),auth[_0x5a2d('0x9')](),controller['addMembers']);router[_0x5a2d('0x13')](_0x5a2d('0x14'),auth[_0x5a2d('0x9')](),controller[_0x5a2d('0x15')]);router[_0x5a2d('0x16')](_0x5a2d('0xd'),auth['isAuthenticated'](),controller[_0x5a2d('0x17')]);router['delete'](_0x5a2d('0xd'),auth[_0x5a2d('0x9')](),controller[_0x5a2d('0x18')]);router[_0x5a2d('0x19')]('/:id/members',auth[_0x5a2d('0x9')](),controller[_0x5a2d('0x1a')]);module[_0x5a2d('0x1b')]=router; \ No newline at end of file +var _0xac73=['getMessages','create','post','addMembers','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages'];(function(_0xb0de07,_0x3ca2a0){var _0x4633d8=function(_0x2368e0){while(--_0x2368e0){_0xb0de07['push'](_0xb0de07['shift']());}};_0x4633d8(++_0x3ca2a0);}(_0xac73,0x171));var _0x3ac7=function(_0x1e5198,_0x3bad9b){_0x1e5198=_0x1e5198-0x0;var _0x4a9160=_0xac73[_0x1e5198];return _0x4a9160;};'use strict';var multer=require(_0x3ac7('0x0'));var util=require(_0x3ac7('0x1'));var path=require(_0x3ac7('0x2'));var timeout=require(_0x3ac7('0x3'));var express=require('express');var router=express[_0x3ac7('0x4')]();var fs_extra=require(_0x3ac7('0x5'));var auth=require(_0x3ac7('0x6'));var interaction=require(_0x3ac7('0x7'));var config=require(_0x3ac7('0x8'));var controller=require(_0x3ac7('0x9'));router[_0x3ac7('0xa')]('/',auth[_0x3ac7('0xb')](),controller[_0x3ac7('0xc')]);router[_0x3ac7('0xa')](_0x3ac7('0xd'),auth[_0x3ac7('0xb')](),controller['describe']);router[_0x3ac7('0xa')](_0x3ac7('0xe'),auth[_0x3ac7('0xb')](),controller[_0x3ac7('0xf')]);router[_0x3ac7('0xa')](_0x3ac7('0x10'),auth['isAuthenticated'](),controller[_0x3ac7('0x11')]);router['get'](_0x3ac7('0x12'),auth['isAuthenticated'](),controller[_0x3ac7('0x13')]);router[_0x3ac7('0xa')](_0x3ac7('0x14'),auth[_0x3ac7('0xb')](),controller[_0x3ac7('0x15')]);router['post']('/',auth[_0x3ac7('0xb')](),controller[_0x3ac7('0x16')]);router[_0x3ac7('0x17')](_0x3ac7('0x12'),auth['isAuthenticated'](),controller[_0x3ac7('0x18')]);router['post']('/:id/messages',auth[_0x3ac7('0xb')](),controller['addMessage']);router[_0x3ac7('0x19')](_0x3ac7('0xe'),auth['isAuthenticated'](),controller[_0x3ac7('0x1a')]);router[_0x3ac7('0x1b')](_0x3ac7('0xe'),auth[_0x3ac7('0xb')](),controller[_0x3ac7('0x1c')]);router['delete'](_0x3ac7('0x12'),auth[_0x3ac7('0xb')](),controller['removeMembers']);module[_0x3ac7('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index e02b666..037a182 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 _0x3266=['BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','long','DATE','out','sequelize','exports'];(function(_0x5a2da5,_0x12e6c3){var _0x477530=function(_0x4a64f5){while(--_0x4a64f5){_0x5a2da5['push'](_0x5a2da5['shift']());}};_0x477530(++_0x12e6c3);}(_0x3266,0x6a));var _0x6326=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x3266[_0x548627];return _0x844a84;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'closed':{'type':Sequelize[_0x6326('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6326('0x3')]},'ratingType':{'type':Sequelize[_0x6326('0x4')](_0x6326('0x5'),_0x6326('0x6')),'defaultValue':_0x6326('0x5')},'ratingMessage':{'type':Sequelize[_0x6326('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x6326('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6326('0x8')]},'secondDisposition':{'type':Sequelize[_0x6326('0x8')]},'thirdDisposition':{'type':Sequelize[_0x6326('0x8')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x6326('0x8')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x6326('0x8')]},'osVersion':{'type':Sequelize[_0x6326('0x8')]},'deviceModel':{'type':Sequelize[_0x6326('0x8')]},'deviceVendor':{'type':Sequelize[_0x6326('0x8')]},'deviceType':{'type':Sequelize[_0x6326('0x8')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x6326('0x8')]},'formData':{'type':Sequelize[_0x6326('0x7')](_0x6326('0x9'))},'read1stAt':{'type':Sequelize[_0x6326('0xa')]},'lastMsgAt':{'type':Sequelize[_0x6326('0xa')]},'lastMsgDirection':{'type':Sequelize[_0x6326('0x4')]('in',_0x6326('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6326('0x8')]},'customerPort':{'type':Sequelize[_0x6326('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x6326('0x7')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5c00=['STRING','out','sequelize','exports','BOOLEAN','ENUM','thumb','star','TEXT','DATE'];(function(_0x1b80c6,_0x34069a){var _0x512646=function(_0x548dbb){while(--_0x548dbb){_0x1b80c6['push'](_0x1b80c6['shift']());}};_0x512646(++_0x34069a);}(_0x5c00,0x17e));var _0x05c0=function(_0xcde2ee,_0x4d32cc){_0xcde2ee=_0xcde2ee-0x0;var _0x6eb7b2=_0x5c00[_0xcde2ee];return _0x6eb7b2;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'closed':{'type':Sequelize[_0x05c0('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x05c0('0x3')]('star',_0x05c0('0x4')),'defaultValue':_0x05c0('0x5')},'ratingMessage':{'type':Sequelize[_0x05c0('0x6')]},'pathTranscript':{'type':Sequelize[_0x05c0('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x05c0('0x7')]},'disposition':{'type':Sequelize[_0x05c0('0x8')]},'secondDisposition':{'type':Sequelize[_0x05c0('0x8')]},'thirdDisposition':{'type':Sequelize[_0x05c0('0x8')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x05c0('0x8')]},'browserVersion':{'type':Sequelize[_0x05c0('0x8')]},'osName':{'type':Sequelize[_0x05c0('0x8')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x05c0('0x8')]},'deviceVendor':{'type':Sequelize[_0x05c0('0x8')]},'deviceType':{'type':Sequelize[_0x05c0('0x8')]},'referer':{'type':Sequelize[_0x05c0('0x6')]},'customerIp':{'type':Sequelize[_0x05c0('0x8')]},'formData':{'type':Sequelize[_0x05c0('0x6')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x05c0('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x05c0('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x05c0('0x8')]},'customerPort':{'type':Sequelize[_0x05c0('0x8')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x05c0('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index deddf79..8f4ff12 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 _0x0abf=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','select','field','color','from','tools_tags','user_has_chat_interactions','users','chat_interactions','left_join','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SELECT','clone','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','show','includeAll','include','options','params','describe','ChatWebsite','findOne','vidaooApiKey','vidaooTopic','vidaooMetadata','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','download','mailTranscript','format','transcript-%s.txt','now','User','CmContact','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','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','pick','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','root','attachments','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','firstName','views','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','undefined','limit','count','reject','update','destroy','end','stack','name','render','merge','body','contact','agent','account','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','rawAttributes','fieldName','type','key','model'];(function(_0x429746,_0x4b5f94){var _0x46c4c3=function(_0x57509f){while(--_0x57509f){_0x429746['push'](_0x429746['shift']());}};_0x46c4c3(++_0x4b5f94);}(_0x0abf,0xe8));var _0xf0ab=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0abf[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xf0ab('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0ab('0x12'))(_0xf0ab('0x13'));var utils=require(_0xf0ab('0x14'));var config=require(_0xf0ab('0x15'));var licenseUtil=require(_0xf0ab('0x16'));var db=require(_0xf0ab('0x17'))['db'];config[_0xf0ab('0x18')]=_['defaults'](config[_0xf0ab('0x18')],{'host':_0xf0ab('0x19'),'port':0x18eb});var socket=require(_0xf0ab('0x1a'))(new Redis(config[_0xf0ab('0x18')]));require(_0xf0ab('0x1b'))[_0xf0ab('0x1c')](socket);var jayson=require(_0xf0ab('0x1d'));var client=jayson[_0xf0ab('0x1e')][_0xf0ab('0x1f')]({'port':0x232b});var client9004=jayson[_0xf0ab('0x1e')][_0xf0ab('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x221bac,_0x200cf5,_0x2f4618,_0x230f40){return new BPromise(function(_0x54b0ce,_0x457465){var _0x9e3b47=_0x230f40||client;return _0x9e3b47[_0xf0ab('0x20')](_0x221bac,_0x2f4618)[_0xf0ab('0x21')](function(_0x776619){logger[_0xf0ab('0x22')](_0xf0ab('0x23'),_0x200cf5,_0xf0ab('0x24'));logger[_0xf0ab('0x25')](_0xf0ab('0x26'),_0x200cf5,_0xf0ab('0x24'),JSON[_0xf0ab('0x27')](_0x776619));if(_0x776619[_0xf0ab('0x28')]){if(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x29')]===0x1f4){logger[_0xf0ab('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);return _0x457465(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);}logger[_0xf0ab('0x28')](_0xf0ab('0x23'),_0x200cf5,_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);return _0x54b0ce(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);}else{logger[_0xf0ab('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,'request\x20sent');_0x54b0ce(_0x776619['result'][_0xf0ab('0x2a')]);}})['catch'](function(_0x3eca32){logger[_0xf0ab('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,_0x3eca32);_0x457465(_0x3eca32);});});}function respondWithStatusCode(_0x163078,_0x22671e){_0x22671e=_0x22671e||0xcc;return function(_0x10bf5f){if(_0x10bf5f){return _0x163078[_0xf0ab('0x2b')](_0x22671e);}return _0x163078[_0xf0ab('0x2c')](_0x22671e)['end']();};}function respondWithResult(_0x2d0da7,_0x574ce7){_0x574ce7=_0x574ce7||0xc8;return function(_0x55d799){if(_0x55d799){return _0x2d0da7[_0xf0ab('0x2c')](_0x574ce7)[_0xf0ab('0x2d')](_0x55d799);}};}function respondWithFilteredResult(_0x1b223d,_0x445160){return function(_0x43476c){if(_0x43476c){var _0x174052=typeof _0x445160[_0xf0ab('0x2e')]===_0xf0ab('0x2f')&&typeof _0x445160[_0xf0ab('0x30')]===_0xf0ab('0x2f');var _0x21e8ac=_0x43476c[_0xf0ab('0x31')];var _0x58cbe1=_0x174052?0x0:_0x445160[_0xf0ab('0x2e')];var _0x35973a=_0x174052?_0x43476c['count']:_0x445160['offset']+_0x445160[_0xf0ab('0x30')];var _0x1dc84e;if(_0x35973a>=_0x21e8ac){_0x35973a=_0x21e8ac;_0x1dc84e=0xc8;}else{_0x1dc84e=0xce;}_0x1b223d[_0xf0ab('0x2c')](_0x1dc84e);return _0x1b223d['set']('Content-Range',_0x58cbe1+'-'+_0x35973a+'/'+_0x21e8ac)[_0xf0ab('0x2d')](_0x43476c);}return null;};}function patchUpdates(_0x58fa03){return function(_0x1cfd52){try{jsonpatch['apply'](_0x1cfd52,_0x58fa03,!![]);}catch(_0x3f66fa){return BPromise[_0xf0ab('0x32')](_0x3f66fa);}return _0x1cfd52['save']();};}function saveUpdates(_0x56e728,_0x469f42){return function(_0x27c6f9){if(_0x27c6f9){return _0x27c6f9[_0xf0ab('0x33')](_0x56e728)[_0xf0ab('0x21')](function(_0x2519c7){return _0x2519c7;});}return null;};}function removeEntity(_0x36195d,_0x17f3b3){return function(_0xf8f0f4){if(_0xf8f0f4){return _0xf8f0f4[_0xf0ab('0x34')]()[_0xf0ab('0x21')](function(){_0x36195d[_0xf0ab('0x2c')](0xcc)[_0xf0ab('0x35')]();});}};}function handleEntityNotFound(_0x22dcfe,_0x437fdb){return function(_0x5d8443){if(!_0x5d8443){_0x22dcfe[_0xf0ab('0x2b')](0x194);}return _0x5d8443;};}function handleError(_0x45c449,_0xc575ed){_0xc575ed=_0xc575ed||0x1f4;return function(_0x5c9192){logger[_0xf0ab('0x28')](_0x5c9192[_0xf0ab('0x36')]);if(_0x5c9192[_0xf0ab('0x37')]){delete _0x5c9192['name'];}_0x45c449[_0xf0ab('0x2c')](_0xc575ed)['send'](_0x5c9192);};}function getMustacheRender(_0xda3971,_0x492d7c){return Mustache[_0xf0ab('0x38')](_0xda3971,_[_0xf0ab('0x39')](_0x492d7c[_0xf0ab('0x3a')],{'contact':_0x492d7c[_0xf0ab('0x3b')],'message':_0x492d7c[_0xf0ab('0x2a')],'agent':_0x492d7c[_0xf0ab('0x3c')],'interaction':_0x492d7c['interaction'],'account':_0x492d7c[_0xf0ab('0x3d')]}))||'';}function getInteractionUsers(_0x683d08,_0x5a6df5){return new BPromise(function(_0x207fbb,_0xce89bc){try{if(_0x5a6df5[_0x683d08['id']]){_0x683d08[_0xf0ab('0x3e')]=_[_0xf0ab('0x3f')](_0x5a6df5[_0x683d08['id']],function(_0x31fa72){return{'id':_0x31fa72['id'],'fullname':_0x31fa72[_0xf0ab('0x40')]};});}}catch(_0x28c20c){_0xce89bc(_0x28c20c);}_0x207fbb(_0x683d08);});}function getInteractionTags(_0x528d4b,_0x406a1d){return new BPromise(function(_0x4f6e93,_0x7c4629){try{if(_0x528d4b['TagIds']){_0x528d4b[_0xf0ab('0x41')]=[];_0x528d4b[_0xf0ab('0x42')][_0xf0ab('0x43')](',')[_0xf0ab('0x44')](function(_0x2b7ed5){_0x528d4b['Tags'][_0xf0ab('0x45')](_0x406a1d[_0x2b7ed5]);});}delete _0x528d4b[_0xf0ab('0x42')];}catch(_0x28e7a4){_0x7c4629(_0x28e7a4);}_0x4f6e93(_0x528d4b);});}function updateChatInteraction(_0x197955,_0x191caf,_0x17a73){return new BPromise(function(_0x45849c,_0x413f5c){return getInteractionUsers(_0x197955,_0x17a73)[_0xf0ab('0x21')](function(_0x3b214a){return getInteractionTags(_0x3b214a,_0x191caf);})[_0xf0ab('0x21')](function(_0x32ec93){_0x45849c(_0x32ec93);})[_0xf0ab('0x46')](function(_0x5e6b6b){_0x413f5c(_0x5e6b6b);});});}exports['index']=function(_0x2fc677,_0x4e6c41){var _0x1fc766={},_0x2d50c0={},_0x4bbdf6={'count':0x0,'rows':[]};var _0x8c2d2c=_[_0xf0ab('0x3f')](db['ChatInteraction'][_0xf0ab('0x47')],function(_0x29cc6a){return{'name':_0x29cc6a[_0xf0ab('0x48')],'type':_0x29cc6a[_0xf0ab('0x49')][_0xf0ab('0x4a')]};});_0x2d50c0[_0xf0ab('0x4b')]=_[_0xf0ab('0x3f')](_0x8c2d2c,_0xf0ab('0x37'));_0x2d50c0[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x2fc677[_0xf0ab('0x4c')]);_0x2d50c0[_0xf0ab('0x4e')]=_[_0xf0ab('0x4f')](_0x2d50c0[_0xf0ab('0x4b')],_0x2d50c0['query']);_0x1fc766['attributes']=_[_0xf0ab('0x4f')](_0x2d50c0['model'],qs['fields'](_0x2fc677['query'][_0xf0ab('0x50')]));_0x1fc766[_0xf0ab('0x51')]=_0x1fc766[_0xf0ab('0x51')][_0xf0ab('0x52')]?_0x1fc766[_0xf0ab('0x51')]:_0x2d50c0[_0xf0ab('0x4b')];if(!_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x53')](_0xf0ab('0x54'))){_0x1fc766[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x2fc677[_0xf0ab('0x4c')]['limit']);_0x1fc766[_0xf0ab('0x2e')]=qs[_0xf0ab('0x2e')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x2e')]);}_0x1fc766[_0xf0ab('0x55')]=qs[_0xf0ab('0x56')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x56')]);_0x1fc766['where']=qs['filters'](_['pick'](_0x2fc677[_0xf0ab('0x4c')],_0x2d50c0[_0xf0ab('0x4e')]),_0x8c2d2c);var _0x577c85=[];var _0xa1a416=squel[_0xf0ab('0x57')]()['field']('id')[_0xf0ab('0x58')](_0xf0ab('0x37'))[_0xf0ab('0x58')](_0xf0ab('0x59'))[_0xf0ab('0x5a')](_0xf0ab('0x5b'));var _0x26508b=squel['select']()[_0xf0ab('0x58')]('u.id')[_0xf0ab('0x58')]('u.fullname')[_0xf0ab('0x58')]('ui.ChatInteractionId')['from'](_0xf0ab('0x5c'),'ui')['left_join'](_0xf0ab('0x5d'),'u','u.id\x20=\x20ui.UserId');var _0x2eff07=squel['select']()[_0xf0ab('0x5a')](_0xf0ab('0x5e'),'i')[_0xf0ab('0x5f')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xf0ab('0x5d'),'o',_0xf0ab('0x60'))['left_join']('chat_websites','a',_0xf0ab('0x61'))[_0xf0ab('0x5f')](_0xf0ab('0x62'),'me',_0xf0ab('0x63'))[_0xf0ab('0x5f')](_0xf0ab('0x64'),'it',_0xf0ab('0x65'))[_0xf0ab('0x5f')](_0xf0ab('0x5b'),'t',_0xf0ab('0x66'));var _0x1e6a4e=squel['expr']();var _0x41ed17=[];var _0x5b24e3=squel[_0xf0ab('0x67')]();var _0x61d3db;if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x68')]){_0x61d3db=as[_0xf0ab('0x69')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x68')]);var _0x1f11aa=_0x61d3db[_0xf0ab('0x6a')];for(var _0x180ee6=0x0;_0x180ee6<_0x61d3db['conditions'][_0xf0ab('0x52')];_0x180ee6++){var _0x2266f3=_0x61d3db[_0xf0ab('0x6b')][_0x180ee6];var _0x1d4a72='i';var _0x2232eb=_[_0xf0ab('0x6c')](_0x8c2d2c,[_0xf0ab('0x37'),_0x2266f3[_0xf0ab('0x58')]]);if(!_0x2232eb){switch(_0x2266f3[_0xf0ab('0x58')]){case'unreadMessages':if(_0x2266f3['value']==0x1){_0x2eff07[_0xf0ab('0x6d')]('`'+_0x2266f3[_0xf0ab('0x58')]+_0xf0ab('0x6e'));}else{_0x2eff07['having']('`'+_0x2266f3[_0xf0ab('0x58')]+_0xf0ab('0x6f'));}break;case _0xf0ab('0x70'):if(_0x2266f3['operator']===_0xf0ab('0x71')){if(_0x2266f3[_0xf0ab('0x72')][_0xf0ab('0x43')]('\x20')[_0xf0ab('0x52')]>0x1){_0x1e6a4e[_0x1f11aa](_0xf0ab('0x73'),qs['getFullTextValue'](_0x2266f3[_0xf0ab('0x72')]),null);}else{var _0x70b02d='%'+_0x2266f3[_0xf0ab('0x72')]+'%';_0x1e6a4e[_0x1f11aa](_0xf0ab('0x74'),_0x70b02d,_0x70b02d,_0x70b02d);}}else{_0x2232eb=_[_0xf0ab('0x6c')](_0x8c2d2c,[_0xf0ab('0x37'),_0xf0ab('0x75')]);_0x2266f3[_0xf0ab('0x58')]=_0xf0ab('0x75');_0x5154f5=as[_0xf0ab('0x76')](_0x1d4a72,_0x2232eb[_0xf0ab('0x49')],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')]['start'],_0x5154f5['value'][_0xf0ab('0x35')]);}break;case _0xf0ab('0x78'):var _0x325ad6=_0x2266f3['value'][_0xf0ab('0x43')](',')['map'](function(_0x1a32dc){return Number(_0x1a32dc);});_0x325ad6[_0xf0ab('0x44')](function(_0x1787e2){_0x5b24e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1787e2+',%');});_0x41ed17=_[_0xf0ab('0x79')](_0x41ed17,_0x325ad6);break;case'User':if(_0x2266f3['operator']===_0xf0ab('0x71')){_0x1e6a4e[_0x1f11aa](_0xf0ab('0x7a'),'%'+_0x2266f3[_0xf0ab('0x72')]+'%',null);}else{_0x2232eb=_['find'](_0x8c2d2c,[_0xf0ab('0x37'),_0xf0ab('0x7b')]);_0x2266f3[_0xf0ab('0x58')]=_0xf0ab('0x7b');_0x5154f5=as['buildExpression'](_0x1d4a72,_0x2232eb['type'],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5['text'],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);}break;case _0xf0ab('0x3a'):_0x5154f5=as[_0xf0ab('0x76')]('me',null,_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);break;}}else{var _0x5154f5=as[_0xf0ab('0x76')](_0x1d4a72,_0x2232eb[_0xf0ab('0x49')],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);}}}else{var _0x42f067=_(_0x2fc677['query'])[_0xf0ab('0x4d')]()[_0xf0ab('0x3f')](function(_0x4c8e95){return _['some'](_0x8c2d2c,['name',_0x4c8e95])?_0x4c8e95:undefined;})[_0xf0ab('0x7d')]()[_0xf0ab('0x72')]();if(!_[_0xf0ab('0x7e')](_0x42f067)){_0x42f067[_0xf0ab('0x44')](function(_0x15aa78){if(_0x15aa78===_0xf0ab('0x7f')){_0x2eff07['where'](_0xf0ab('0x80'),[]['concat'](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]));}else if(_0x15aa78==='createdAt'){var _0x2978a9=JSON['parse'](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78])['$gte'];var _0x58ca28=JSON[_0xf0ab('0x81')](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78])[_0xf0ab('0x82')];_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x84'),_0x2978a9,_0x58ca28);}else{if(_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]===_0xf0ab('0x85')){_0x2eff07[_0xf0ab('0x83')]('i.'+_0x15aa78+_0xf0ab('0x86'));}else{_0x2eff07[_0xf0ab('0x83')]('i.'+_0x15aa78+_0xf0ab('0x87'),_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]);}}});}if(_0x2fc677[_0xf0ab('0x4c')]['read']){if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x88')]==0x1){_0x2eff07[_0xf0ab('0x6d')](_0xf0ab('0x89'));}else{_0x2eff07[_0xf0ab('0x6d')](_0xf0ab('0x8a'));}}if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')]){_0x41ed17=_[_0xf0ab('0x8c')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')])?_0x2fc677[_0xf0ab('0x4c')]['tag']:new Array(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')]);_0x41ed17[_0xf0ab('0x44')](function(_0x2196a7){_0x5b24e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2196a7+',%');});}if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8d')]){var _0x4463cc=_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8d')]['replace']('\x5c','\x5c\x5c')[_0xf0ab('0x8e')](/'/g,'\x27\x27');if(qs[_0xf0ab('0x8f')](_0x4463cc)){_0x1e6a4e['or']('i.id\x20LIKE\x20?',_0x4463cc+'%');}else{_0x1e6a4e['or'](_0xf0ab('0x90'),qs['getFullTextValue'](_0x4463cc))['or'](_0xf0ab('0x91'),_0x4463cc+'%');}}}_0x2eff07[_0xf0ab('0x83')](_0x1e6a4e);_0x2eff07['group'](_0xf0ab('0x92'));var _0x148a72={'type':db['Sequelize']['QueryTypes'][_0xf0ab('0x93')],'raw':!![]};var _0x58140c=_0x2eff07[_0xf0ab('0x94')]();_0x58140c[_0xf0ab('0x58')]('i.id');_0x58140c['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf0ab('0x95'));if(_0x1fc766[_0xf0ab('0x55')]){_0x1fc766[_0xf0ab('0x55')][_0xf0ab('0x44')](function(_0x49c89f){var _0x272f9c=_0x49c89f[0x0]===_0xf0ab('0x96')?_0x49c89f[0x0]:'i.'+_0x49c89f[0x0];_0x2eff07[_0xf0ab('0x55')](_0x272f9c,_0x49c89f[0x1]===_0xf0ab('0x97')?![]:!![]);});}if(!_[_0xf0ab('0x7e')](_0x41ed17)){_0x2eff07['having'](_0x5b24e3);_0x58140c['where'](_0xf0ab('0x98'),_0x41ed17);}BPromise[_0xf0ab('0x99')]()['then'](function(){if(!_0x61d3db){if(_0x2fc677['query'][_0xf0ab('0x7f')])return;_0x58140c[_0xf0ab('0x83')](_0xf0ab('0x9a'));_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x9a'));return;}if(_0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9c')]!==_0xf0ab('0x3c'))return;return _0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9d')]({'attributes':['id'],'raw':!![]})[_0xf0ab('0x21')](function(_0x52eca9){if(_['isEmpty'](_0x52eca9)){_0x58140c[_0xf0ab('0x83')]('i.ChatWebsiteId\x20IS\x20NULL');_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x9e'));}else{_0x58140c[_0xf0ab('0x83')](_0xf0ab('0x80'),_['map'](_0x52eca9,'id'));_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x80'),_[_0xf0ab('0x3f')](_0x52eca9,'id'));}});})[_0xf0ab('0x21')](function(){if(_0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9c')]===_0xf0ab('0x3c')&&!_0x61d3db&&!_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x7f')])return[];return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0x58140c[_0xf0ab('0xa0')](),_0x148a72);})[_0xf0ab('0x21')](function(_0x4211a1){_0x4bbdf6['count']=_0x4211a1[_0xf0ab('0x52')];if(_0x4bbdf6[_0xf0ab('0x31')]===0x0)return[];return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0xa1a416[_0xf0ab('0xa0')](),_0x148a72)[_0xf0ab('0x21')](function(_0x611cf7){_0x577c85=_['keyBy'](_0x611cf7,'id');_0x148a72=_['merge'](_0x148a72,{'model':db[_0xf0ab('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x50')]){_0x1fc766['attributes'][_0xf0ab('0x44')](function(_0x405b34){_0x2eff07[_0xf0ab('0x58')]('i.'+_0x405b34);});}else{_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa2'),'unreadMessages');_0x2eff07['field'](_0xf0ab('0xa3'),'Account.key');_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa4'),'Account.mandatoryDisposition');_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa5'),_0xf0ab('0x96'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa6'));_0x2eff07['field'](_0xf0ab('0xa7'),_0xf0ab('0xa8'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa9'),_0xf0ab('0xaa'));_0x2eff07['field'](_0xf0ab('0xab'),_0xf0ab('0xac'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xad'),_0xf0ab('0xae'));_0x2eff07['field'](_0xf0ab('0xaf'),_0xf0ab('0xb0'));_0x2eff07[_0xf0ab('0x58')]('c.fax',_0xf0ab('0xb1'));_0x2eff07['field'](_0xf0ab('0xb2'),_0xf0ab('0xb3'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xb4'),'Owner.internal');_0x2eff07[_0xf0ab('0x58')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x1fc766[_0xf0ab('0x30')])_0x2eff07['limit'](_0x1fc766['limit']);if(_0x1fc766[_0xf0ab('0x2e')])_0x2eff07[_0xf0ab('0x2e')](_0x1fc766['offset']);return db['sequelize']['query'](_0x2eff07['toString'](),_0x148a72);})[_0xf0ab('0x21')](function(_0x12d9b6){if(_0x12d9b6[_0xf0ab('0x52')]>0x0)_0x26508b[_0xf0ab('0x83')](_0xf0ab('0xb5'),_['map'](_0x12d9b6,'id'));return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0x26508b[_0xf0ab('0xa0')](),_0x148a72)[_0xf0ab('0x21')](function(_0x84eab9){var _0x27cd98=_[_0xf0ab('0xb6')](_0x84eab9,'ChatInteractionId');var _0x16dca7=[];_0x12d9b6[_0xf0ab('0x44')](function(_0x39633a){_0x16dca7[_0xf0ab('0x45')](updateChatInteraction(_0x39633a,_0x577c85,_0x27cd98));});return BPromise[_0xf0ab('0xb7')](_0x16dca7);});});})[_0xf0ab('0x21')](function(_0x527a4b){_0x4bbdf6[_0xf0ab('0xb8')]=_0x527a4b;return _0x4bbdf6;})[_0xf0ab('0x21')](respondWithFilteredResult(_0x4e6c41,_0x1fc766))[_0xf0ab('0x46')](handleError(_0x4e6c41,null));};exports[_0xf0ab('0xb9')]=function(_0x4ca7a3,_0x426419){var _0x395bf6={'raw':![],'where':{'id':_0x4ca7a3['params']['id']}},_0x5b7744={};_0x5b7744[_0xf0ab('0x4b')]=_[_0xf0ab('0x4d')](db[_0xf0ab('0xa1')][_0xf0ab('0x47')]);_0x5b7744[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x4ca7a3[_0xf0ab('0x4c')]);_0x5b7744[_0xf0ab('0x4e')]=_['intersection'](_0x5b7744[_0xf0ab('0x4b')],_0x5b7744['query']);_0x395bf6['attributes']=_[_0xf0ab('0x4f')](_0x5b7744[_0xf0ab('0x4b')],qs[_0xf0ab('0x50')](_0x4ca7a3[_0xf0ab('0x4c')][_0xf0ab('0x50')]));_0x395bf6[_0xf0ab('0x51')]=_0x395bf6[_0xf0ab('0x51')][_0xf0ab('0x52')]?_0x395bf6['attributes']:_0x5b7744[_0xf0ab('0x4b')];if(_0x4ca7a3[_0xf0ab('0x4c')][_0xf0ab('0xba')]){_0x395bf6[_0xf0ab('0xbb')]=[{'all':!![]}];}_0x395bf6=_[_0xf0ab('0x39')]({},_0x395bf6,_0x4ca7a3[_0xf0ab('0xbc')]);return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')](_0x395bf6)[_0xf0ab('0x21')](handleEntityNotFound(_0x426419,null))[_0xf0ab('0x21')](respondWithResult(_0x426419,null))['catch'](handleError(_0x426419,null));};exports['create']=function(_0x58946c,_0x2f339d){return db['ChatInteraction']['create'](_0x58946c[_0xf0ab('0x3a')],{})[_0xf0ab('0x21')](respondWithResult(_0x2f339d,0xc9))[_0xf0ab('0x46')](handleError(_0x2f339d,null));};exports[_0xf0ab('0x33')]=function(_0xdf495,_0x55a296){if(_0xdf495[_0xf0ab('0x3a')]['id']){delete _0xdf495[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0xdf495[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x55a296,null))[_0xf0ab('0x21')](saveUpdates(_0xdf495[_0xf0ab('0x3a')],null))['then'](respondWithResult(_0x55a296,null))[_0xf0ab('0x46')](handleError(_0x55a296,null));};exports['destroy']=function(_0x3c1a2c,_0x17a3b6){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x3c1a2c[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x17a3b6,null))[_0xf0ab('0x21')](removeEntity(_0x17a3b6,null))[_0xf0ab('0x46')](handleError(_0x17a3b6,null));};exports[_0xf0ab('0xbe')]=function(_0x1f2efa,_0x1d12fb){return db[_0xf0ab('0xa1')]['describe']()[_0xf0ab('0x21')](respondWithResult(_0x1d12fb,null))[_0xf0ab('0x46')](handleError(_0x1d12fb,null));};exports['createVidaooSession']=function(_0x35486d,_0x3f5ade){var _0x135a10=_0x35486d[_0xf0ab('0xbd')]['id'];var _0x48fc7e;var _0x5f55d2;var _0x7c7c3b;return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x135a10}})[_0xf0ab('0x21')](function(_0x2beaaa){_0x48fc7e=_0x2beaaa;return db[_0xf0ab('0xbf')][_0xf0ab('0xc0')]({'where':{'id':_0x2beaaa[_0xf0ab('0x7f')]},'attributes':['id',_0xf0ab('0xc1'),'vidaooEscalation',_0xf0ab('0xc2'),'vidaooNote',_0xf0ab('0xc3')],'raw':!![]});})[_0xf0ab('0x21')](function(_0x354e18){if(_0x354e18&&_0x354e18['vidaooApiKey']&&_0x354e18[_0xf0ab('0xc4')]){_0x5f55d2=_0x354e18;var _0x2068d6={'interaction':{'id':_0x135a10},'agent':{'id':_0x35486d[_0xf0ab('0x9b')]['id'],'name':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0x37')],'fullname':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0x40')],'email':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0xc5')]},'contact':_0x35486d['body']['contact'],'account':_0x35486d[_0xf0ab('0x3a')][_0xf0ab('0x3d')]};var _0x35b480={'rejectUnauthorized':![],'method':_0xf0ab('0xc6'),'url':_0xf0ab('0xc7'),'headers':{'X-APIKEY':_0x354e18[_0xf0ab('0xc1')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0xc5')]],'buttons':null,'topic':_0x5f55d2[_0xf0ab('0xc2')],'note':_[_0xf0ab('0xc8')](_0x5f55d2['vidaooNote'])?null:getMustacheRender(_0x5f55d2[_0xf0ab('0xc9')],_0x2068d6),'metadata':null},'redirect':_0xf0ab('0xca'),'json':!![]};try{if(!_[_0xf0ab('0xc8')](_0x5f55d2[_0xf0ab('0xc3')])){var _0x41e2d8=getMustacheRender(_0x5f55d2[_0xf0ab('0xc3')],_0x2068d6);var _0x57f44d=JSON[_0xf0ab('0x81')](_0x41e2d8);_0x35b480[_0xf0ab('0x3a')][_0xf0ab('0xcb')]=_0x57f44d;}}catch(_0x533b37){throw new db[(_0xf0ab('0xcc'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x35b480);}else{throw new db[(_0xf0ab('0xcc'))][(_0xf0ab('0xcd'))](_0xf0ab('0xce'));}})['then'](function(_0x1697ca){_0x7c7c3b=_0x1697ca;if(_0x7c7c3b['id']){var _0x15da8a={'body':_0x7c7c3b[_0xf0ab('0xcf')],'ChatWebsiteId':_0x5f55d2['id'],'ChatInteractionId':_0x48fc7e['id'],'direction':'out','UserId':_0x35486d[_0xf0ab('0x9b')]['id']};return db[_0xf0ab('0xd0')][_0xf0ab('0xd1')](_0x15da8a,{});}else{throw new db['Sequelize'][(_0xf0ab('0xcd'))](_0xf0ab('0xd2'));}})[_0xf0ab('0x21')](function(){return _0x48fc7e[_0xf0ab('0xd3')]({'vidaooSessionId':_0x7c7c3b['id']});})[_0xf0ab('0x21')](respondWithResult(_0x3f5ade,null))[_0xf0ab('0x46')](handleError(_0x3f5ade,null));};exports[_0xf0ab('0xd4')]=function(_0x115e3d,_0x2d0f9c){if(_0x115e3d[_0xf0ab('0x3a')]['id']){delete _0x115e3d[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x115e3d[_0xf0ab('0xbd')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xf0ab('0x21')](handleEntityNotFound(_0x2d0f9c,null))[_0xf0ab('0x21')](saveUpdates(_0x115e3d['body'],null))[_0xf0ab('0x21')](respondWithResult(_0x2d0f9c,null))['catch'](handleError(_0x2d0f9c,null));};exports[_0xf0ab('0xd5')]=function(_0x1e9768,_0x4398a3,_0x4195d9){if(_0x1e9768[_0xf0ab('0x3a')]['id']){delete _0x1e9768[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x1e9768[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](function(_0x5f10a5){if(!_0x5f10a5){logger[_0xf0ab('0x28')](_0xf0ab('0xd6'),_0xf0ab('0xd5'),0x194,_0xf0ab('0xd7'));_0x4398a3[_0xf0ab('0x2b')](0x194);}else{if(_0x5f10a5[_0xf0ab('0x7b')]){throw new db['Sequelize']['ValidationError'](_0xf0ab('0xd8'));}}return _0x5f10a5;})[_0xf0ab('0x21')](function(_0x564124){if(_0x564124){return _0x564124[_0xf0ab('0x33')]({'closed':_0x1e9768[_0xf0ab('0x3a')][_0xf0ab('0xd9')],'disposition':_0x1e9768['body'][_0xf0ab('0xda')]})[_0xf0ab('0x21')](function(_0x2d9046){return _0x2d9046;});}})[_0xf0ab('0x21')](function(_0x4e5f1e){return respondWithRpcPromise(_0xf0ab('0xdb'),_0xf0ab('0xd5'),_0x1e9768[_0xf0ab('0x3a')],client9004);})['then'](respondWithResult(_0x4398a3,null))['catch'](handleError(_0x4398a3,null));};exports['attachmentUpload']=function(_0x581cb1,_0x22251d,_0x2b5993){_0x581cb1[_0xf0ab('0x3a')]['name']=_0x581cb1[_0xf0ab('0xdc')]['originalname'];_0x581cb1[_0xf0ab('0x3a')][_0xf0ab('0xdd')]=_0x581cb1[_0xf0ab('0xdc')][_0xf0ab('0xde')];_0x581cb1[_0xf0ab('0x3a')][_0xf0ab('0x49')]=_0x581cb1[_0xf0ab('0xdc')][_0xf0ab('0xdf')];return db[_0xf0ab('0xe0')][_0xf0ab('0xd1')](_0x581cb1[_0xf0ab('0x3a')])[_0xf0ab('0x21')](respondWithResult(_0x22251d,0xc9))[_0xf0ab('0x46')](handleError(_0x22251d,null));};exports[_0xf0ab('0xe1')]=function(_0x4d09bf,_0x415b9d,_0x11ed58){return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x4d09bf[_0xf0ab('0xbd')]['id']},'raw':!![]})[_0xf0ab('0x21')](handleEntityNotFound(_0x415b9d,null))[_0xf0ab('0x21')](function(_0x278e32){if(_0x278e32){if(_0x278e32['closed']){return _0x415b9d[_0xf0ab('0x2c')](0x193)[_0xf0ab('0x2d')]({'status':0x193,'message':_0xf0ab('0xe2')});}return db[_0xf0ab('0xe0')][_0xf0ab('0xc0')]({'where':{'id':_0x4d09bf[_0xf0ab('0x4c')][_0xf0ab('0xe3')]},'raw':!![]})[_0xf0ab('0x21')](handleEntityNotFound(_0x415b9d,null));}})['then'](function(_0xadae03){if(_0xadae03){var _0x550b00=_0xadae03[_0xf0ab('0xe4')]!==null;var _0x2bfb6a=path[_0xf0ab('0xe5')](config['root'],_0xf0ab('0xe6'));if(_0x550b00){_0x2bfb6a=path[_0xf0ab('0xe5')](_0x2bfb6a,'offline-chat/');}var _0x5d62e4=path['join'](_0x2bfb6a,_0xadae03['basename']);return _0x415b9d[_0xf0ab('0xe7')](_0x5d62e4);}})['catch'](handleError(_0x415b9d,null));};exports['close']=function(_0x3b8bbe,_0x7e24c4){var _0x2d0ea3=null;var _0x4a18ad=null;var _0x57aaae=null;var _0x2ab0be=null;if(_0x3b8bbe[_0xf0ab('0x3a')]['id']){delete _0x3b8bbe['body']['id'];}if(_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xe8')]){_0x2ab0be=path['join'](config['root'],'server/files/chat/upload/',util[_0xf0ab('0xe9')](_0xf0ab('0xea'),Date[_0xf0ab('0xeb')]()));_0x3b8bbe[_0xf0ab('0x3a')]['pathTranscript']=_0x2ab0be;}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x3b8bbe['params']['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xf0ab('0xec')],'as':'User'}]}]})[_0xf0ab('0x21')](handleEntityNotFound(_0x7e24c4,null))[_0xf0ab('0x21')](saveUpdates(_0x3b8bbe[_0xf0ab('0x3a')],null))[_0xf0ab('0x21')](function(_0x116c84){if(_0x116c84){_0x2d0ea3=_0x116c84;return db[_0xf0ab('0xbf')][_0xf0ab('0x6c')]({'where':{'id':_0x2d0ea3[_0xf0ab('0x7f')]}});}})[_0xf0ab('0x21')](function(_0x1d6e15){if(_0x1d6e15){_0x57aaae=_0x1d6e15;return db[_0xf0ab('0xed')][_0xf0ab('0x6c')]({'where':{'id':_0x2d0ea3['ContactId']}});}})[_0xf0ab('0x21')](function(_0x29427c){if(_0x29427c){_0x4a18ad=_0x29427c;if(_0x2ab0be){var _0x29d4a1=null;for(var _0x50e996=0x1;_0x50e996<_0x2d0ea3['Messages'][_0xf0ab('0x52')];++_0x50e996){_0x29d4a1=_0x2d0ea3[_0xf0ab('0xee')][_0x50e996];var _0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae[_0xf0ab('0xf0')],_0x29d4a1[_0xf0ab('0x7b')]):_0xf0ab('0xf1');var _0xc1537e=_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xf2')]||util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0xf0ab('0xf3'),_0x29d4a1[_0xf0ab('0x75')]);switch(_0x57aaae[_0xf0ab('0xf4')]){case _0xf0ab('0xf5'):_0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae['agentAlias'],_0x29d4a1[_0xf0ab('0x7b')]):'System';break;case _0xf0ab('0xf6'):_0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?_0x29d4a1[_0xf0ab('0xec')][_0xf0ab('0xf7')]||_0x29d4a1['User'][_0xf0ab('0x40')]:'System';break;case'agent_fullname':_0x8e04bb=_0x29d4a1['UserId']?_0x29d4a1[_0xf0ab('0xec')][_0xf0ab('0x40')]:_0xf0ab('0xf1');break;default:_0x8e04bb=_0x29d4a1['UserId']?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae[_0xf0ab('0xf0')],_0x29d4a1[_0xf0ab('0x7b')]):_0xf0ab('0xf1');}var _0x2c39f0=util[_0xf0ab('0xe9')](_0xf0ab('0xf8'),moment(_0x29d4a1[_0xf0ab('0xf9')])[_0xf0ab('0xe9')](_0xf0ab('0xfa')),_0x29d4a1[_0xf0ab('0xfb')]==='in'?_0xc1537e:_0x8e04bb,_0x29d4a1['body']);if(!_0x29d4a1[_0xf0ab('0xfc')]){fs[_0xf0ab('0xfd')](_0x2ab0be,_0x2c39f0);}}return db[_0xf0ab('0xfe')][_0xf0ab('0xc0')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf0ab('0xff'),'raw':!![]}]});}}})['then'](function(_0x21eb2b){if(_0x21eb2b&&_0x21eb2b['Smtp']&&_0x3b8bbe[_0xf0ab('0x3a')]){var _0x262659={'tls':{'rejectUnauthorized':![]}};if(_0x21eb2b['Smtp'][_0xf0ab('0x100')]){_0x262659[_0xf0ab('0x100')]=_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x100')];}else{_0x262659[_0xf0ab('0x101')]=_0x21eb2b['Smtp'][_0xf0ab('0x101')];_0x262659[_0xf0ab('0x102')]=_0x21eb2b[_0xf0ab('0xff')]['port'];_0x262659['secure']=_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x103')];}if(_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x104')]){_0x262659['auth']={'user':_0x21eb2b['Smtp'][_0xf0ab('0x9b')],'pass':_0x21eb2b[_0xf0ab('0xff')]['pass']};}return respondWithRpcPromise('SendMail',_0xf0ab('0x105'),{'account':_0x262659,'message':{'from':util['format'](_0xf0ab('0x106'),_0x21eb2b['name'],_0x21eb2b[_0xf0ab('0xc5')]||_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x9b')]),'to':_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xe8')],'subject':_0xf0ab('0x107'),'text':util[_0xf0ab('0xe9')](_0xf0ab('0x108'),_0x3b8bbe['body'][_0xf0ab('0xe8')]),'attachments':[{'path':_0x2ab0be}]}})[_0xf0ab('0x21')](function(){return _0x2d0ea3;})[_0xf0ab('0x46')](function(_0x15f041){console[_0xf0ab('0x28')](_0x15f041);});}else{return _0x2d0ea3;}})['then'](respondWithStatusCode(_0x7e24c4,0xc8))[_0xf0ab('0x46')](handleError(_0x7e24c4,null));};exports[_0xf0ab('0x109')]=function(_0x5eda4b,_0x57a8ab,_0x3cee1d){return db[_0xf0ab('0xd0')][_0xf0ab('0x6c')]({'where':{'id':_0x5eda4b[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x57a8ab,null))[_0xf0ab('0x21')](function(_0x4dff6e){if(_0x4dff6e){return _0x4dff6e[_0xf0ab('0x109')](_0x5eda4b[_0xf0ab('0x3a')][_0xf0ab('0x10a')],_[_0xf0ab('0x10b')](_0x5eda4b[_0xf0ab('0x3a')],[_0xf0ab('0x10a'),'id'])||{});}})['then'](respondWithResult(_0x57a8ab,null))[_0xf0ab('0x46')](handleError(_0x57a8ab,null));};exports['getMessages']=function(_0x283bf5,_0x1afcea,_0x22a9f8){var _0x33dbfc={'raw':![],'where':{}};var _0x487318={};var _0x546e13={'count':0x0,'rows':[]};return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x283bf5[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x1afcea,null))[_0xf0ab('0x21')](function(_0xa3b903){if(_0xa3b903){_0x487318['model']=_[_0xf0ab('0x4d')](db[_0xf0ab('0xd0')][_0xf0ab('0x47')]);_0x487318[_0xf0ab('0x4c')]=_['keys'](_0x283bf5[_0xf0ab('0x4c')]);_0x487318[_0xf0ab('0x4e')]=_['intersection'](_0x487318[_0xf0ab('0x4b')],_0x487318[_0xf0ab('0x4c')]);_0x33dbfc[_0xf0ab('0x51')]=_[_0xf0ab('0x4f')](_0x487318[_0xf0ab('0x4b')],qs['fields'](_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x50')]));_0x33dbfc[_0xf0ab('0x51')]=_0x33dbfc['attributes'][_0xf0ab('0x52')]?_0x33dbfc[_0xf0ab('0x51')]:_0x487318[_0xf0ab('0x4b')];if(!_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x53')](_0xf0ab('0x54'))){_0x33dbfc[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x30')]);_0x33dbfc['offset']=qs['offset'](_0x283bf5[_0xf0ab('0x4c')]['offset']);}_0x33dbfc['order']=qs[_0xf0ab('0x56')](_0x283bf5[_0xf0ab('0x4c')]['sort']);_0x33dbfc[_0xf0ab('0x83')]=qs[_0xf0ab('0x4e')](_[_0xf0ab('0x10c')](_0x283bf5['query'],_0x487318[_0xf0ab('0x4e')]));_0x33dbfc['where'][_0xf0ab('0x10d')]=_0xa3b903['id'];if(_0x283bf5['query'][_0xf0ab('0x8d')]){_0x33dbfc[_0xf0ab('0x83')]=_[_0xf0ab('0x39')](_0x33dbfc['where'],{'$or':_[_0xf0ab('0x3f')](_0x33dbfc[_0xf0ab('0x51')],function(_0x2ddc1d){var _0x3cef14={};_0x3cef14[_0x2ddc1d]={'$like':'%'+_0x283bf5['query'][_0xf0ab('0x8d')]+'%'};return _0x3cef14;})});}if(_0x283bf5[_0xf0ab('0x4c')]['$gte']){var _0x38ea18=_0x283bf5[_0xf0ab('0x4c')]['$gte']['split'](',');var _0x7ee6b3={};_0x7ee6b3[_0x38ea18[0x0]]={'$gte':moment(_0x38ea18[0x1])[_0xf0ab('0xe9')](_0xf0ab('0x10e'))};_0x33dbfc['where']=_[_0xf0ab('0x39')](_0x33dbfc['where'],_0x7ee6b3);}_0x33dbfc=_[_0xf0ab('0x39')]({},_0x33dbfc,_0x283bf5['options']);return db[_0xf0ab('0xd0')]['count']({'where':_0x33dbfc['where']})['then'](function(_0x1d1451){_0x546e13['count']=_0x1d1451;if(_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0xba')]){_0x33dbfc[_0xf0ab('0xbb')]=[{'all':!![]}];}return db[_0xf0ab('0xd0')][_0xf0ab('0x10f')](_0x33dbfc);})['then'](function(_0x16a1d2){_0x546e13[_0xf0ab('0xb8')]=_0x16a1d2;return _0x546e13;});}})[_0xf0ab('0x21')](respondWithFilteredResult(_0x1afcea,_0x33dbfc))[_0xf0ab('0x46')](handleError(_0x1afcea,null));};exports[_0xf0ab('0x110')]=function(_0x4b91de,_0x3a602f,_0x47788a){var _0x3592f1={'where':{}},_0x577f13={},_0x2f99c2={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf0ab('0xc0')]({'where':{'id':_0x4b91de[_0xf0ab('0xbd')]['id']}})['then'](handleEntityNotFound(_0x3a602f,null))['then'](function(_0x43c6b8){if(_0x43c6b8){_0x577f13['model']=_[_0xf0ab('0x4d')](db[_0xf0ab('0xd0')][_0xf0ab('0x47')]);_0x577f13[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x4b91de[_0xf0ab('0x4c')]);_0x577f13['filters']=_[_0xf0ab('0x4f')](_0x577f13[_0xf0ab('0x4b')],_0x577f13[_0xf0ab('0x4c')]);_0x3592f1[_0xf0ab('0x51')]=_[_0xf0ab('0x4f')](_0x577f13[_0xf0ab('0x4b')],qs[_0xf0ab('0x50')](_0x4b91de['query'][_0xf0ab('0x50')]));_0x3592f1[_0xf0ab('0x51')]=_0x3592f1['attributes'][_0xf0ab('0x52')]?_0x3592f1['attributes']:_0x577f13[_0xf0ab('0x4b')];if(!_0x4b91de['query']['hasOwnProperty']('nolimit')){_0x3592f1[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x30')]);_0x3592f1[_0xf0ab('0x2e')]=qs[_0xf0ab('0x2e')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x2e')]);}_0x3592f1[_0xf0ab('0x55')]=qs[_0xf0ab('0x56')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x56')]);_0x3592f1[_0xf0ab('0x83')]=qs[_0xf0ab('0x4e')](_[_0xf0ab('0x10c')](_0x4b91de[_0xf0ab('0x4c')],_0x577f13[_0xf0ab('0x4e')]));_0x3592f1['where'][_0xf0ab('0x10d')]=_0x43c6b8['id'];if(_0x4b91de['query'][_0xf0ab('0x8d')]){_0x3592f1['where']=_[_0xf0ab('0x39')](_0x3592f1[_0xf0ab('0x83')],{'$or':_[_0xf0ab('0x3f')](_0x3592f1['attributes'],function(_0x58f64c){var _0x5dc7d4={};_0x5dc7d4[_0x58f64c]={'$like':'%'+_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x8d')]+'%'};return _0x5dc7d4;})});}_0x3592f1['where'][_0xf0ab('0xfc')]=![];if(_0x4b91de[_0xf0ab('0x4c')]['id']){_0x3592f1[_0xf0ab('0x83')]['id']={'$gt':_0x4b91de[_0xf0ab('0x4c')]['id']};}_0x3592f1=_['merge']({},_0x3592f1,_0x4b91de['options']);return db[_0xf0ab('0xd0')][_0xf0ab('0x31')]({'where':_0x3592f1[_0xf0ab('0x83')]})[_0xf0ab('0x21')](function(_0x2ab983){_0x2f99c2['count']=_0x2ab983;_0x3592f1[_0xf0ab('0xbb')]=[];if(_0x4b91de['query'][_0xf0ab('0x111')]){_0x3592f1[_0xf0ab('0xbb')][_0xf0ab('0x45')]({'model':db['User'],'as':_0xf0ab('0xec'),'attributes':['id',_0xf0ab('0x40'),_0xf0ab('0xf7')]});}if(_0x4b91de[_0xf0ab('0x4c')]['includeAll']){_0x3592f1[_0xf0ab('0xbb')]=[{'all':!![]}];}return db[_0xf0ab('0xd0')][_0xf0ab('0x10f')](_0x3592f1);})[_0xf0ab('0x21')](function(_0x3d70c0){_0x2f99c2[_0xf0ab('0xb8')]=_0x3d70c0;return _0x2f99c2;});}})[_0xf0ab('0x21')](respondWithFilteredResult(_0x3a602f,_0x3592f1))[_0xf0ab('0x46')](handleError(_0x3a602f,null));};exports['addTags']=function(_0x4d10af,_0x5cf4bd,_0x368523){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x4d10af['params']['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x5cf4bd,null))[_0xf0ab('0x21')](function(_0x46a38a){if(_0x46a38a){return _0x46a38a[_0xf0ab('0x112')](_0x4d10af[_0xf0ab('0x3a')][_0xf0ab('0x10a')],_['omit'](_0x4d10af[_0xf0ab('0x3a')],[_0xf0ab('0x10a'),'id'])||{})[_0xf0ab('0x113')](function(){return db['Tag'][_0xf0ab('0x10f')]({'attributes':['id',_0xf0ab('0x37'),_0xf0ab('0x59')],'where':{'id':_0x4d10af[_0xf0ab('0x3a')][_0xf0ab('0x10a')]}});})[_0xf0ab('0x21')](function(_0x1df97b){socket[_0xf0ab('0x114')](_0xf0ab('0x115'),{'id':Number(_0x4d10af[_0xf0ab('0xbd')]['id']),'tags':_0x1df97b||[]});return{'id':Number(_0x4d10af[_0xf0ab('0xbd')]['id']),'tags':_0x1df97b||[]};});}})[_0xf0ab('0x21')](respondWithResult(_0x5cf4bd,null))['catch'](handleError(_0x5cf4bd,null));};exports[_0xf0ab('0x116')]=function(_0x3ca465,_0x4e379d,_0x122e66){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x3ca465[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x4e379d,null))[_0xf0ab('0x21')](function(_0x5c56e0){if(_0x5c56e0){return _0x5c56e0[_0xf0ab('0x116')](_0x3ca465[_0xf0ab('0x4c')][_0xf0ab('0x10a')]);}})['then'](respondWithStatusCode(_0x4e379d,null))[_0xf0ab('0x46')](handleError(_0x4e379d,null));};exports[_0xf0ab('0xe7')]=function(_0x2baa40,_0x4ff52d){var _0x2a2fea=moment()[_0xf0ab('0x117')]()[_0xf0ab('0xa0')]();var _0x4eccbd=path['join'](config['root'],_0xf0ab('0x118'),_0xf0ab('0x119'),_0xf0ab('0x11a'));var _0x5b6475=path[_0xf0ab('0xe5')](config[_0xf0ab('0x11b')],'server',_0xf0ab('0x119'),_0xf0ab('0x11c'));var _0x595bda=path[_0xf0ab('0xe5')](_0x4eccbd,_0x2a2fea);var _0x2bd3e3=util['format']('transcript-%d-%s.zip',_0x2baa40[_0xf0ab('0xbd')]['id'],_0x2a2fea);var _0x25242e=path[_0xf0ab('0xe5')](_0x4eccbd,_0x2bd3e3);var _0x3d8794=[];_0x3d8794[_0xf0ab('0x45')]({'model':db['User'],'as':_0xf0ab('0xec'),'attributes':['id','fullname'],'raw':!![]});_0x3d8794[_0xf0ab('0x45')]({'model':db[_0xf0ab('0xed')],'as':_0xf0ab('0x70'),'attributes':['id','firstName',_0xf0ab('0x11d')],'raw':!![]});if(_0x2baa40[_0xf0ab('0x4c')][_0xf0ab('0x11c')]){_0x3d8794[_0xf0ab('0x45')]({'model':db[_0xf0ab('0xe0')],'as':'Attachment','raw':!![]});}var _0x243763=[{'model':db[_0xf0ab('0xd0')],'as':_0xf0ab('0xee'),'attributes':['id',_0xf0ab('0x3a'),'createdAt',_0xf0ab('0xfb'),_0xf0ab('0xfc'),_0xf0ab('0x88')],'include':_0x3d8794}];_0x243763['push']({'model':db[_0xf0ab('0xbf')],'as':_0xf0ab('0x11e'),'attributes':['id',_0xf0ab('0x37')]});_0x243763['push']({'model':db[_0xf0ab('0xec')],'as':_0xf0ab('0x11f'),'attributes':['id',_0xf0ab('0x40')]});return db[_0xf0ab('0xa1')]['find']({'where':{'id':_0x2baa40[_0xf0ab('0xbd')]['id']},'include':_0x243763})[_0xf0ab('0x21')](handleEntityNotFound(_0x4ff52d,null))[_0xf0ab('0x21')](function(_0x2c2e20){if(_0x2c2e20){var _0x57bd77=_0x2c2e20[_0xf0ab('0x120')]({'plain':!![]});fs[_0xf0ab('0x121')](_0x595bda);var _0x169b02={'channel':_0xf0ab('0x122'),'account':_0x57bd77[_0xf0ab('0x11e')]['name'],'agent':_0x57bd77[_0xf0ab('0x11f')]?_0x57bd77['Owner'][_0xf0ab('0x40')]:_0xf0ab('0x123'),'createdAt':moment(_0x57bd77[_0xf0ab('0xf9')])['format'](_0xf0ab('0x10e'))['toString'](),'closedAt':_0x57bd77['closed']?moment(_0x57bd77['closedAt'])[_0xf0ab('0xe9')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x57bd77[_0xf0ab('0xda')],'chatInfo':{'browser':_0x57bd77[_0xf0ab('0x124')],'os':_0x57bd77[_0xf0ab('0x125')],'referer':_0x57bd77[_0xf0ab('0x126')],'customerIp':_0x57bd77[_0xf0ab('0x127')],'customerPort':_0x57bd77['customerPort']?_0x57bd77[_0xf0ab('0x128')]:_0xf0ab('0x123')},'messages':_(_0x57bd77['Messages'])[_0xf0ab('0x129')]()[_0xf0ab('0x8d')]({'secret':![]})[_0xf0ab('0x3f')](function(_0x2aa512){if(_0x2aa512['Attachment']){var _0x26009e=path[_0xf0ab('0xe5')](_0x5b6475,_0x2aa512['Attachment'][_0xf0ab('0xdd')]);if(fs[_0xf0ab('0x12a')](_0x26009e)){fs['createReadStream'](_0x26009e)[_0xf0ab('0x12b')](fs[_0xf0ab('0x12c')](path['join'](_0x595bda,_0x2aa512[_0xf0ab('0xe0')][_0xf0ab('0xdd')])));}}return{'date':moment(_0x2aa512[_0xf0ab('0xf9')])[_0xf0ab('0xe9')](_0xf0ab('0x10e'))['toString'](),'sender':_0x2aa512[_0xf0ab('0xfb')]==='out'?_0x2aa512[_0xf0ab('0xec')]?_0x2aa512['User'][_0xf0ab('0x40')]:_0xf0ab('0xf1'):_0x2aa512[_0xf0ab('0x70')][_0xf0ab('0x12d')]+(_0x2aa512[_0xf0ab('0x70')][_0xf0ab('0x11d')]?'\x20'+_0x2aa512[_0xf0ab('0x70')]['lastName']:''),'body':_0x2aa512[_0xf0ab('0xe0')]?_0x2aa512[_0xf0ab('0xe0')][_0xf0ab('0xdd')]:_0x2aa512[_0xf0ab('0x3a')],'direction':_0x2aa512[_0xf0ab('0xfb')]==='out'?'A':'C','secret':_0x2aa512[_0xf0ab('0xfc')],'read':_0x2aa512[_0xf0ab('0x88')],'attachment':_0x2aa512[_0xf0ab('0xe0')]};})[_0xf0ab('0x72')]()};return ejs['renderFile'](path[_0xf0ab('0xe5')](config[_0xf0ab('0x11b')],_0xf0ab('0x118'),_0xf0ab('0x12e'),'downloadInteraction.ejs'),{'interaction':_0x169b02})['then'](function(_0x3ad886){var _0x3df4a2=path['join'](_0x595bda,'transcript-'+_0x57bd77['id']+'-'+_0x2a2fea+_0xf0ab('0x12f'));var _0x378d44={'path':_0x3df4a2,'channel':_0xf0ab('0x122'),'interactionId':_0x57bd77['id']};return pdf[_0xf0ab('0x130')](_0x3ad886,_0x378d44);})[_0xf0ab('0x21')](function(){return new BPromise(function(_0x1e4acb,_0x25a1eb){zipdir(_0x595bda,{'saveTo':_0x25242e},function(_0x406090,_0x414d09){if(_0x406090)return _0x25a1eb(_0x406090);return _0x1e4acb(_0x414d09);});})[_0xf0ab('0x21')](function(){return new BPromise(function(_0x235528,_0x581c80){rimraf(_0x595bda,function(_0x14332a){if(_0x14332a)_0x581c80(_0x14332a);return _0x235528();});});})[_0xf0ab('0x21')](function(){return _0x4ff52d[_0xf0ab('0xe7')](_0x25242e,_0x2bd3e3,function(_0x4f9211){if(_0x4f9211){console[_0xf0ab('0x131')](_0xf0ab('0x132'),_0x4f9211);}else{fs[_0xf0ab('0x133')](_0x25242e);}});});});}else{return _0x4ff52d['sendStatus'](0xc8);}})[_0xf0ab('0x46')](handleError(_0x4ff52d,null));}; \ No newline at end of file +var _0x7916=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','jayson/promise','http','client','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','reject','save','end','name','render','merge','body','agent','interaction','Users','map','fullname','TagIds','Tags','split','forEach','push','index','ChatInteraction','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','union','User','operator','UserId','some','isEmpty','ChatWebsiteId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','length','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','catch','show','params','includeAll','include','options','create','destroy','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','contact','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','attachId','join','offline-chat/','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','Messages','ChatWebsite','CmContact','%s%d','agentAlias','System','Visitor','agentIdentifier','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','Smtp','service','host','port','secure','authentication','pass','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','includeAgent','addTags','spread','Tag','emit','removeTags','download','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','createReadStream','createWriteStream','out','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x46bb87,_0x5a88fa){var _0x304cdc=function(_0x277021){while(--_0x277021){_0x46bb87['push'](_0x46bb87['shift']());}};_0x304cdc(++_0x5a88fa);}(_0x7916,0x128));var _0x6791=function(_0x2ac02d,_0x264eb5){_0x2ac02d=_0x2ac02d-0x0;var _0x5b22f2=_0x7916[_0x2ac02d];return _0x5b22f2;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x6791('0x11'));var logger=require(_0x6791('0x12'))(_0x6791('0x13'));var utils=require(_0x6791('0x14'));var config=require(_0x6791('0x15'));var licenseUtil=require(_0x6791('0x16'));var db=require(_0x6791('0x17'))['db'];config[_0x6791('0x18')]=_[_0x6791('0x19')](config[_0x6791('0x18')],{'host':_0x6791('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6791('0x1b'))['register'](socket);var jayson=require(_0x6791('0x1c'));var client=jayson['client'][_0x6791('0x1d')]({'port':0x232b});var client9004=jayson[_0x6791('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3e4792,_0x4b80ed,_0x3856ac,_0x150d1f){return new BPromise(function(_0x596a06,_0xbc35d){var _0x36d7a1=_0x150d1f||client;return _0x36d7a1['request'](_0x3e4792,_0x3856ac)[_0x6791('0x1f')](function(_0x4d8a79){logger[_0x6791('0x20')](_0x6791('0x21'),_0x4b80ed,_0x6791('0x22'));logger[_0x6791('0x23')](_0x6791('0x24'),_0x4b80ed,_0x6791('0x22'),JSON[_0x6791('0x25')](_0x4d8a79));if(_0x4d8a79['error']){if(_0x4d8a79[_0x6791('0x26')][_0x6791('0x27')]===0x1f4){logger['error'](_0x6791('0x21'),_0x4b80ed,_0x4d8a79[_0x6791('0x26')]['message']);return _0xbc35d(_0x4d8a79[_0x6791('0x26')][_0x6791('0x28')]);}logger[_0x6791('0x26')](_0x6791('0x21'),_0x4b80ed,_0x4d8a79['error'][_0x6791('0x28')]);return _0x596a06(_0x4d8a79[_0x6791('0x26')]['message']);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x4b80ed,_0x6791('0x22'));_0x596a06(_0x4d8a79['result'][_0x6791('0x28')]);}})['catch'](function(_0x54a092){logger['error'](_0x6791('0x21'),_0x4b80ed,_0x54a092);_0xbc35d(_0x54a092);});});}function respondWithStatusCode(_0x23442e,_0xd49b84){_0xd49b84=_0xd49b84||0xcc;return function(_0x56a74e){if(_0x56a74e){return _0x23442e[_0x6791('0x29')](_0xd49b84);}return _0x23442e[_0x6791('0x2a')](_0xd49b84)['end']();};}function respondWithResult(_0x342107,_0x5cbb79){_0x5cbb79=_0x5cbb79||0xc8;return function(_0x424b0e){if(_0x424b0e){return _0x342107['status'](_0x5cbb79)['json'](_0x424b0e);}};}function respondWithFilteredResult(_0x270a1d,_0x551718){return function(_0x2f56a2){if(_0x2f56a2){var _0x34b006=typeof _0x551718['offset']===_0x6791('0x2b')&&typeof _0x551718[_0x6791('0x2c')]===_0x6791('0x2b');var _0xd36448=_0x2f56a2['count'];var _0x4f91d6=_0x34b006?0x0:_0x551718[_0x6791('0x2d')];var _0x5e5ac3=_0x34b006?_0x2f56a2[_0x6791('0x2e')]:_0x551718[_0x6791('0x2d')]+_0x551718[_0x6791('0x2c')];var _0x2b98b8;if(_0x5e5ac3>=_0xd36448){_0x5e5ac3=_0xd36448;_0x2b98b8=0xc8;}else{_0x2b98b8=0xce;}_0x270a1d[_0x6791('0x2a')](_0x2b98b8);return _0x270a1d[_0x6791('0x2f')](_0x6791('0x30'),_0x4f91d6+'-'+_0x5e5ac3+'/'+_0xd36448)[_0x6791('0x31')](_0x2f56a2);}return null;};}function patchUpdates(_0x152751){return function(_0x100210){try{jsonpatch['apply'](_0x100210,_0x152751,!![]);}catch(_0x28b3d4){return BPromise[_0x6791('0x32')](_0x28b3d4);}return _0x100210[_0x6791('0x33')]();};}function saveUpdates(_0xa1ed41,_0x19cd22){return function(_0x36f673){if(_0x36f673){return _0x36f673['update'](_0xa1ed41)['then'](function(_0x551357){return _0x551357;});}return null;};}function removeEntity(_0x1de770,_0x21a9cf){return function(_0x252916){if(_0x252916){return _0x252916['destroy']()['then'](function(){_0x1de770[_0x6791('0x2a')](0xcc)[_0x6791('0x34')]();});}};}function handleEntityNotFound(_0x31a525,_0x42deeb){return function(_0x50db2b){if(!_0x50db2b){_0x31a525[_0x6791('0x29')](0x194);}return _0x50db2b;};}function handleError(_0xee6b68,_0x2068a5){_0x2068a5=_0x2068a5||0x1f4;return function(_0x56d8c8){logger[_0x6791('0x26')](_0x56d8c8['stack']);if(_0x56d8c8['name']){delete _0x56d8c8[_0x6791('0x35')];}_0xee6b68[_0x6791('0x2a')](_0x2068a5)['send'](_0x56d8c8);};}function getMustacheRender(_0x764f15,_0x70b2b7){return Mustache[_0x6791('0x36')](_0x764f15,_[_0x6791('0x37')](_0x70b2b7[_0x6791('0x38')],{'contact':_0x70b2b7['contact'],'message':_0x70b2b7[_0x6791('0x28')],'agent':_0x70b2b7[_0x6791('0x39')],'interaction':_0x70b2b7[_0x6791('0x3a')],'account':_0x70b2b7['account']}))||'';}function getInteractionUsers(_0x3a6062,_0x24955c){return new BPromise(function(_0x2349b0,_0x577006){try{if(_0x24955c[_0x3a6062['id']]){_0x3a6062[_0x6791('0x3b')]=_[_0x6791('0x3c')](_0x24955c[_0x3a6062['id']],function(_0x13be81){return{'id':_0x13be81['id'],'fullname':_0x13be81[_0x6791('0x3d')]};});}}catch(_0x593fda){_0x577006(_0x593fda);}_0x2349b0(_0x3a6062);});}function getInteractionTags(_0x18c478,_0x1a4b64){return new BPromise(function(_0x3e95b6,_0xd0f1c){try{if(_0x18c478[_0x6791('0x3e')]){_0x18c478[_0x6791('0x3f')]=[];_0x18c478[_0x6791('0x3e')][_0x6791('0x40')](',')[_0x6791('0x41')](function(_0x4e4004){_0x18c478['Tags'][_0x6791('0x42')](_0x1a4b64[_0x4e4004]);});}delete _0x18c478[_0x6791('0x3e')];}catch(_0x5900b6){_0xd0f1c(_0x5900b6);}_0x3e95b6(_0x18c478);});}function updateChatInteraction(_0x39dcb7,_0x1c9913,_0x1c6803){return new BPromise(function(_0x3edb86,_0x1a922e){return getInteractionUsers(_0x39dcb7,_0x1c6803)[_0x6791('0x1f')](function(_0x44e0ba){return getInteractionTags(_0x44e0ba,_0x1c9913);})['then'](function(_0xb3bea8){_0x3edb86(_0xb3bea8);})['catch'](function(_0x17ecf0){_0x1a922e(_0x17ecf0);});});}exports[_0x6791('0x43')]=function(_0x16f26c,_0xbd6326){var _0x573e38={},_0xe55ee={},_0x4f0e2d={'count':0x0,'rows':[]};var _0xeb9d45=_[_0x6791('0x3c')](db[_0x6791('0x44')][_0x6791('0x45')],function(_0x91a161){return{'name':_0x91a161[_0x6791('0x46')],'type':_0x91a161['type'][_0x6791('0x47')]};});_0xe55ee[_0x6791('0x48')]=_[_0x6791('0x3c')](_0xeb9d45,_0x6791('0x35'));_0xe55ee['query']=_[_0x6791('0x49')](_0x16f26c[_0x6791('0x4a')]);_0xe55ee['filters']=_[_0x6791('0x4b')](_0xe55ee['model'],_0xe55ee[_0x6791('0x4a')]);_0x573e38[_0x6791('0x4c')]=_[_0x6791('0x4b')](_0xe55ee[_0x6791('0x48')],qs[_0x6791('0x4d')](_0x16f26c[_0x6791('0x4a')][_0x6791('0x4d')]));_0x573e38[_0x6791('0x4c')]=_0x573e38[_0x6791('0x4c')]['length']?_0x573e38[_0x6791('0x4c')]:_0xe55ee['model'];if(!_0x16f26c[_0x6791('0x4a')][_0x6791('0x4e')](_0x6791('0x4f'))){_0x573e38[_0x6791('0x2c')]=qs[_0x6791('0x2c')](_0x16f26c['query'][_0x6791('0x2c')]);_0x573e38[_0x6791('0x2d')]=qs[_0x6791('0x2d')](_0x16f26c[_0x6791('0x4a')][_0x6791('0x2d')]);}_0x573e38['order']=qs[_0x6791('0x50')](_0x16f26c[_0x6791('0x4a')]['sort']);_0x573e38[_0x6791('0x51')]=qs['filters'](_[_0x6791('0x52')](_0x16f26c[_0x6791('0x4a')],_0xe55ee[_0x6791('0x53')]),_0xeb9d45);var _0x37e360=[];var _0x558069=squel[_0x6791('0x54')]()[_0x6791('0x55')]('id')['field'](_0x6791('0x35'))[_0x6791('0x55')](_0x6791('0x56'))['from'](_0x6791('0x57'));var _0x166b9a=squel['select']()[_0x6791('0x55')](_0x6791('0x58'))['field'](_0x6791('0x59'))[_0x6791('0x55')](_0x6791('0x5a'))[_0x6791('0x5b')]('user_has_chat_interactions','ui')[_0x6791('0x5c')](_0x6791('0x5d'),'u',_0x6791('0x5e'));var _0x5b534b=squel['select']()[_0x6791('0x5b')](_0x6791('0x5f'),'i')[_0x6791('0x5c')](_0x6791('0x60'),'c',_0x6791('0x61'))['left_join']('users','o',_0x6791('0x62'))['left_join']('chat_websites','a',_0x6791('0x63'))[_0x6791('0x5c')](_0x6791('0x64'),'me',_0x6791('0x65'))[_0x6791('0x5c')](_0x6791('0x66'),'it','it.ChatInteractionId\x20=\x20i.id')['left_join'](_0x6791('0x57'),'t',_0x6791('0x67'));var _0x56e424=squel[_0x6791('0x68')]();var _0x535ecf=[];var _0x473443=squel[_0x6791('0x68')]();var _0x50cf85;if(_0x16f26c[_0x6791('0x4a')][_0x6791('0x69')]){_0x50cf85=as[_0x6791('0x6a')](_0x16f26c['query'][_0x6791('0x69')]);var _0x2c6316=_0x50cf85[_0x6791('0x6b')];for(var _0x383853=0x0;_0x383853<_0x50cf85[_0x6791('0x6c')]['length'];_0x383853++){var _0x54d0ba=_0x50cf85[_0x6791('0x6c')][_0x383853];var _0x13430e='i';var _0x5d2668=_[_0x6791('0x6d')](_0xeb9d45,[_0x6791('0x35'),_0x54d0ba[_0x6791('0x55')]]);if(!_0x5d2668){switch(_0x54d0ba[_0x6791('0x55')]){case _0x6791('0x6e'):if(_0x54d0ba[_0x6791('0x6f')]==0x1){_0x5b534b[_0x6791('0x70')]('`'+_0x54d0ba[_0x6791('0x55')]+'`\x20=\x200');}else{_0x5b534b[_0x6791('0x70')]('`'+_0x54d0ba[_0x6791('0x55')]+_0x6791('0x71'));}break;case _0x6791('0x72'):if(_0x54d0ba['operator']===_0x6791('0x73')){if(_0x54d0ba[_0x6791('0x6f')][_0x6791('0x40')]('\x20')['length']>0x1){_0x56e424[_0x2c6316](_0x6791('0x74'),qs[_0x6791('0x75')](_0x54d0ba[_0x6791('0x6f')]),null);}else{var _0x11df6b='%'+_0x54d0ba['value']+'%';_0x56e424[_0x2c6316](_0x6791('0x76'),_0x11df6b,_0x11df6b,_0x11df6b);}}else{_0x5d2668=_[_0x6791('0x6d')](_0xeb9d45,['name',_0x6791('0x77')]);_0x54d0ba[_0x6791('0x55')]=_0x6791('0x77');_0xbd55d7=as[_0x6791('0x78')](_0x13430e,_0x5d2668[_0x6791('0x79')],_0x54d0ba);_0x56e424[_0x2c6316](_0xbd55d7[_0x6791('0x7a')],_0xbd55d7['value'][_0x6791('0x7b')],_0xbd55d7[_0x6791('0x6f')][_0x6791('0x34')]);}break;case'Tag':var _0x2d487e=_0x54d0ba['value'][_0x6791('0x40')](',')[_0x6791('0x3c')](function(_0xf0941a){return Number(_0xf0941a);});_0x2d487e[_0x6791('0x41')](function(_0x28d86b){_0x473443['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x28d86b+',%');});_0x535ecf=_[_0x6791('0x7c')](_0x535ecf,_0x2d487e);break;case _0x6791('0x7d'):if(_0x54d0ba[_0x6791('0x7e')]===_0x6791('0x73')){_0x56e424[_0x2c6316]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x54d0ba[_0x6791('0x6f')]+'%',null);}else{_0x5d2668=_[_0x6791('0x6d')](_0xeb9d45,['name',_0x6791('0x7f')]);_0x54d0ba[_0x6791('0x55')]='UserId';_0xbd55d7=as[_0x6791('0x78')](_0x13430e,_0x5d2668[_0x6791('0x79')],_0x54d0ba);_0x56e424[_0x2c6316](_0xbd55d7[_0x6791('0x7a')],_0xbd55d7[_0x6791('0x6f')]['start'],_0xbd55d7[_0x6791('0x6f')][_0x6791('0x34')]);}break;case'body':_0xbd55d7=as[_0x6791('0x78')]('me',null,_0x54d0ba);_0x56e424[_0x2c6316](_0xbd55d7[_0x6791('0x7a')],_0xbd55d7[_0x6791('0x6f')][_0x6791('0x7b')],_0xbd55d7[_0x6791('0x6f')]['end']);break;}}else{var _0xbd55d7=as[_0x6791('0x78')](_0x13430e,_0x5d2668['type'],_0x54d0ba);_0x56e424[_0x2c6316](_0xbd55d7[_0x6791('0x7a')],_0xbd55d7[_0x6791('0x6f')][_0x6791('0x7b')],_0xbd55d7['value'][_0x6791('0x34')]);}}}else{var _0x165899=_(_0x16f26c[_0x6791('0x4a')])[_0x6791('0x49')]()[_0x6791('0x3c')](function(_0x1a1c3b){return _[_0x6791('0x80')](_0xeb9d45,[_0x6791('0x35'),_0x1a1c3b])?_0x1a1c3b:undefined;})['compact']()[_0x6791('0x6f')]();if(!_[_0x6791('0x81')](_0x165899)){_0x165899['forEach'](function(_0x48909c){if(_0x48909c===_0x6791('0x82')){_0x5b534b[_0x6791('0x51')]('i.ChatWebsiteId\x20IN\x20?',[][_0x6791('0x83')](_0x16f26c['query'][_0x48909c]));}else if(_0x48909c===_0x6791('0x84')){var _0x304e2a=JSON[_0x6791('0x85')](_0x16f26c[_0x6791('0x4a')][_0x48909c])[_0x6791('0x86')];var _0x2d15b5=JSON[_0x6791('0x85')](_0x16f26c[_0x6791('0x4a')][_0x48909c])[_0x6791('0x87')];_0x5b534b[_0x6791('0x51')](_0x6791('0x88'),_0x304e2a,_0x2d15b5);}else{if(_0x16f26c[_0x6791('0x4a')][_0x48909c]===_0x6791('0x89')){_0x5b534b[_0x6791('0x51')]('i.'+_0x48909c+_0x6791('0x8a'));}else{_0x5b534b[_0x6791('0x51')]('i.'+_0x48909c+_0x6791('0x8b'),_0x16f26c[_0x6791('0x4a')][_0x48909c]);}}});}if(_0x16f26c[_0x6791('0x4a')]['read']){if(_0x16f26c['query']['read']==0x1){_0x5b534b[_0x6791('0x70')](_0x6791('0x8c'));}else{_0x5b534b[_0x6791('0x70')](_0x6791('0x8d'));}}if(_0x16f26c[_0x6791('0x4a')][_0x6791('0x8e')]){_0x535ecf=_[_0x6791('0x8f')](_0x16f26c[_0x6791('0x4a')][_0x6791('0x8e')])?_0x16f26c[_0x6791('0x4a')][_0x6791('0x8e')]:new Array(_0x16f26c[_0x6791('0x4a')][_0x6791('0x8e')]);_0x535ecf[_0x6791('0x41')](function(_0x2dafe6){_0x473443['or'](_0x6791('0x90'),'%,'+_0x2dafe6+',%');});}if(_0x16f26c[_0x6791('0x4a')][_0x6791('0x91')]){var _0x159544=_0x16f26c[_0x6791('0x4a')][_0x6791('0x91')][_0x6791('0x92')]('\x5c','\x5c\x5c')[_0x6791('0x92')](/'/g,'\x27\x27');if(qs[_0x6791('0x93')](_0x159544)){_0x56e424['or'](_0x6791('0x94'),_0x159544+'%');}else{_0x56e424['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6791('0x75')](_0x159544))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x159544+'%');}}}_0x5b534b[_0x6791('0x51')](_0x56e424);_0x5b534b[_0x6791('0x95')]('i.id');var _0x1c2864={'type':db['Sequelize'][_0x6791('0x96')][_0x6791('0x97')],'raw':!![]};var _0x5945cb=_0x5b534b[_0x6791('0x98')]();_0x5945cb[_0x6791('0x55')](_0x6791('0x99'));_0x5945cb['field'](_0x6791('0x9a'),_0x6791('0x6e'));if(_0x573e38[_0x6791('0x9b')]){_0x573e38[_0x6791('0x9b')][_0x6791('0x41')](function(_0x35cd1b){var _0x52ab63=_0x35cd1b[0x0]===_0x6791('0x9c')?_0x35cd1b[0x0]:'i.'+_0x35cd1b[0x0];_0x5b534b[_0x6791('0x9b')](_0x52ab63,_0x35cd1b[0x1]===_0x6791('0x9d')?![]:!![]);});}if(!_[_0x6791('0x81')](_0x535ecf)){_0x5b534b[_0x6791('0x70')](_0x473443);_0x5945cb[_0x6791('0x51')](_0x6791('0x9e'),_0x535ecf);}BPromise['resolve']()[_0x6791('0x1f')](function(){if(!_0x50cf85){if(_0x16f26c['query'][_0x6791('0x82')])return;_0x5945cb['where'](_0x6791('0x9f'));_0x5b534b[_0x6791('0x51')](_0x6791('0x9f'));return;}if(_0x16f26c[_0x6791('0xa0')][_0x6791('0xa1')]!==_0x6791('0x39'))return;return _0x16f26c['user'][_0x6791('0xa2')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2f2f6d){if(_['isEmpty'](_0x2f2f6d)){_0x5945cb['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x5b534b[_0x6791('0x51')](_0x6791('0xa3'));}else{_0x5945cb['where'](_0x6791('0xa4'),_['map'](_0x2f2f6d,'id'));_0x5b534b[_0x6791('0x51')](_0x6791('0xa4'),_['map'](_0x2f2f6d,'id'));}});})['then'](function(){if(_0x16f26c['user'][_0x6791('0xa1')]===_0x6791('0x39')&&!_0x50cf85&&!_0x16f26c[_0x6791('0x4a')]['ChatWebsiteId'])return[];return db[_0x6791('0xa5')][_0x6791('0x4a')](_0x5945cb[_0x6791('0xa6')](),_0x1c2864);})[_0x6791('0x1f')](function(_0xaf50fd){_0x4f0e2d['count']=_0xaf50fd[_0x6791('0xa7')];if(_0x4f0e2d[_0x6791('0x2e')]===0x0)return[];return db[_0x6791('0xa5')][_0x6791('0x4a')](_0x558069[_0x6791('0xa6')](),_0x1c2864)['then'](function(_0x6ef225){_0x37e360=_[_0x6791('0xa8')](_0x6ef225,'id');_0x1c2864=_['merge'](_0x1c2864,{'model':db[_0x6791('0x44')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x16f26c[_0x6791('0x4a')][_0x6791('0x4d')]){_0x573e38[_0x6791('0x4c')]['forEach'](function(_0x29e2a0){_0x5b534b[_0x6791('0x55')]('i.'+_0x29e2a0);});}else{_0x5b534b[_0x6791('0x55')](_0x6791('0x9a'),_0x6791('0x6e'));_0x5b534b[_0x6791('0x55')](_0x6791('0xa9'),_0x6791('0xaa'));_0x5b534b['field']('a.mandatoryDisposition',_0x6791('0xab'));_0x5b534b[_0x6791('0x55')](_0x6791('0xac'),'contactName');_0x5b534b[_0x6791('0x55')]('i.*');_0x5b534b[_0x6791('0x55')](_0x6791('0xad'),'Contact.firstName');_0x5b534b[_0x6791('0x55')](_0x6791('0xae'),_0x6791('0xaf'));_0x5b534b[_0x6791('0x55')](_0x6791('0xb0'),'Contact.email');_0x5b534b[_0x6791('0x55')](_0x6791('0xb1'),_0x6791('0xb2'));_0x5b534b['field']('c.mobile',_0x6791('0xb3'));_0x5b534b[_0x6791('0x55')]('c.fax',_0x6791('0xb4'));_0x5b534b[_0x6791('0x55')](_0x6791('0xb5'),'Owner.fullname');_0x5b534b[_0x6791('0x55')]('o.internal','Owner.internal');_0x5b534b[_0x6791('0x55')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x6791('0x3e'));}if(_0x573e38[_0x6791('0x2c')])_0x5b534b[_0x6791('0x2c')](_0x573e38[_0x6791('0x2c')]);if(_0x573e38[_0x6791('0x2d')])_0x5b534b[_0x6791('0x2d')](_0x573e38['offset']);return db[_0x6791('0xa5')]['query'](_0x5b534b[_0x6791('0xa6')](),_0x1c2864);})['then'](function(_0x599f9f){if(_0x599f9f[_0x6791('0xa7')]>0x0)_0x166b9a[_0x6791('0x51')](_0x6791('0xb6'),_[_0x6791('0x3c')](_0x599f9f,'id'));return db[_0x6791('0xa5')][_0x6791('0x4a')](_0x166b9a[_0x6791('0xa6')](),_0x1c2864)[_0x6791('0x1f')](function(_0x1bdeab){var _0x1d7926=_[_0x6791('0xb7')](_0x1bdeab,_0x6791('0xb8'));var _0x2bb01f=[];_0x599f9f[_0x6791('0x41')](function(_0x386f26){_0x2bb01f[_0x6791('0x42')](updateChatInteraction(_0x386f26,_0x37e360,_0x1d7926));});return BPromise[_0x6791('0xb9')](_0x2bb01f);});});})[_0x6791('0x1f')](function(_0x153fd1){_0x4f0e2d['rows']=_0x153fd1;return _0x4f0e2d;})[_0x6791('0x1f')](respondWithFilteredResult(_0xbd6326,_0x573e38))[_0x6791('0xba')](handleError(_0xbd6326,null));};exports[_0x6791('0xbb')]=function(_0x4dc5e1,_0x4c6eb1){var _0x4bce1d={'raw':![],'where':{'id':_0x4dc5e1[_0x6791('0xbc')]['id']}},_0x42d7fb={};_0x42d7fb['model']=_[_0x6791('0x49')](db[_0x6791('0x44')][_0x6791('0x45')]);_0x42d7fb[_0x6791('0x4a')]=_[_0x6791('0x49')](_0x4dc5e1[_0x6791('0x4a')]);_0x42d7fb[_0x6791('0x53')]=_[_0x6791('0x4b')](_0x42d7fb['model'],_0x42d7fb[_0x6791('0x4a')]);_0x4bce1d['attributes']=_[_0x6791('0x4b')](_0x42d7fb[_0x6791('0x48')],qs[_0x6791('0x4d')](_0x4dc5e1['query']['fields']));_0x4bce1d['attributes']=_0x4bce1d[_0x6791('0x4c')][_0x6791('0xa7')]?_0x4bce1d[_0x6791('0x4c')]:_0x42d7fb[_0x6791('0x48')];if(_0x4dc5e1['query'][_0x6791('0xbd')]){_0x4bce1d[_0x6791('0xbe')]=[{'all':!![]}];}_0x4bce1d=_[_0x6791('0x37')]({},_0x4bce1d,_0x4dc5e1[_0x6791('0xbf')]);return db['ChatInteraction']['find'](_0x4bce1d)['then'](handleEntityNotFound(_0x4c6eb1,null))[_0x6791('0x1f')](respondWithResult(_0x4c6eb1,null))['catch'](handleError(_0x4c6eb1,null));};exports[_0x6791('0xc0')]=function(_0x416812,_0xfb6287){return db[_0x6791('0x44')][_0x6791('0xc0')](_0x416812[_0x6791('0x38')],{})[_0x6791('0x1f')](respondWithResult(_0xfb6287,0xc9))[_0x6791('0xba')](handleError(_0xfb6287,null));};exports['update']=function(_0x38fa5c,_0x300c8b){if(_0x38fa5c['body']['id']){delete _0x38fa5c[_0x6791('0x38')]['id'];}return db[_0x6791('0x44')][_0x6791('0x6d')]({'where':{'id':_0x38fa5c[_0x6791('0xbc')]['id']}})['then'](handleEntityNotFound(_0x300c8b,null))[_0x6791('0x1f')](saveUpdates(_0x38fa5c[_0x6791('0x38')],null))[_0x6791('0x1f')](respondWithResult(_0x300c8b,null))[_0x6791('0xba')](handleError(_0x300c8b,null));};exports[_0x6791('0xc1')]=function(_0x201cfc,_0x456077){return db[_0x6791('0x44')][_0x6791('0x6d')]({'where':{'id':_0x201cfc['params']['id']}})[_0x6791('0x1f')](handleEntityNotFound(_0x456077,null))[_0x6791('0x1f')](removeEntity(_0x456077,null))[_0x6791('0xba')](handleError(_0x456077,null));};exports[_0x6791('0xc2')]=function(_0x19cb72,_0x5aad37){return db['ChatInteraction'][_0x6791('0xc2')]()[_0x6791('0x1f')](respondWithResult(_0x5aad37,null))['catch'](handleError(_0x5aad37,null));};exports[_0x6791('0xc3')]=function(_0x355c3a,_0x409f15){var _0x3fffd9=_0x355c3a[_0x6791('0xbc')]['id'];var _0xccd935;var _0x16b1d2;var _0x21a12c;return db[_0x6791('0x44')]['findOne']({'where':{'id':_0x3fffd9}})[_0x6791('0x1f')](function(_0x323f3c){_0xccd935=_0x323f3c;return db['ChatWebsite'][_0x6791('0xc4')]({'where':{'id':_0x323f3c['ChatWebsiteId']},'attributes':['id',_0x6791('0xc5'),_0x6791('0xc6'),_0x6791('0xc7'),_0x6791('0xc8'),_0x6791('0xc9')],'raw':!![]});})[_0x6791('0x1f')](function(_0x3a6ce4){if(_0x3a6ce4&&_0x3a6ce4[_0x6791('0xc5')]&&_0x3a6ce4[_0x6791('0xc6')]){_0x16b1d2=_0x3a6ce4;var _0x1ee4d7={'interaction':{'id':_0x3fffd9},'agent':{'id':_0x355c3a[_0x6791('0xa0')]['id'],'name':_0x355c3a[_0x6791('0xa0')][_0x6791('0x35')],'fullname':_0x355c3a[_0x6791('0xa0')][_0x6791('0x3d')],'email':_0x355c3a[_0x6791('0xa0')][_0x6791('0xca')]},'contact':_0x355c3a[_0x6791('0x38')][_0x6791('0xcb')],'account':_0x355c3a['body'][_0x6791('0xcc')]};var _0x5f52f8={'rejectUnauthorized':![],'method':_0x6791('0xcd'),'url':_0x6791('0xce'),'headers':{'X-APIKEY':_0x3a6ce4[_0x6791('0xc5')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x355c3a[_0x6791('0xa0')][_0x6791('0xca')]],'buttons':null,'topic':_0x16b1d2[_0x6791('0xc7')],'note':_[_0x6791('0xcf')](_0x16b1d2[_0x6791('0xc8')])?null:getMustacheRender(_0x16b1d2['vidaooNote'],_0x1ee4d7),'metadata':null},'redirect':_0x6791('0xd0'),'json':!![]};try{if(!_['isNull'](_0x16b1d2['vidaooMetadata'])){var _0x37bb87=getMustacheRender(_0x16b1d2[_0x6791('0xc9')],_0x1ee4d7);var _0x371229=JSON[_0x6791('0x85')](_0x37bb87);_0x5f52f8[_0x6791('0x38')][_0x6791('0xd1')]=_0x371229;}}catch(_0x2e8d88){throw new db['Sequelize'][(_0x6791('0xd2'))](_0x6791('0xd3'));}return rp(_0x5f52f8);}else{throw new db[(_0x6791('0xd4'))][(_0x6791('0xd2'))](_0x6791('0xd5'));}})[_0x6791('0x1f')](function(_0x550c19){_0x21a12c=_0x550c19;if(_0x21a12c['id']){var _0x3a6909={'body':_0x21a12c[_0x6791('0xd6')],'ChatWebsiteId':_0x16b1d2['id'],'ChatInteractionId':_0xccd935['id'],'direction':'out','UserId':_0x355c3a[_0x6791('0xa0')]['id']};return db[_0x6791('0xd7')][_0x6791('0xc0')](_0x3a6909,{});}else{throw new db[(_0x6791('0xd4'))]['ValidationError'](_0x6791('0xd8'));}})[_0x6791('0x1f')](function(){return _0xccd935[_0x6791('0xd9')]({'vidaooSessionId':_0x21a12c['id']});})[_0x6791('0x1f')](respondWithResult(_0x409f15,null))['catch'](handleError(_0x409f15,null));};exports['customUpdate']=function(_0x46b51c,_0x3b618b){if(_0x46b51c[_0x6791('0x38')]['id']){delete _0x46b51c['body']['id'];}return db[_0x6791('0x44')][_0x6791('0x6d')]({'where':{'id':_0x46b51c[_0x6791('0xbc')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})['then'](handleEntityNotFound(_0x3b618b,null))[_0x6791('0x1f')](saveUpdates(_0x46b51c['body'],null))[_0x6791('0x1f')](respondWithResult(_0x3b618b,null))[_0x6791('0xba')](handleError(_0x3b618b,null));};exports[_0x6791('0xda')]=function(_0x576b1c,_0x348f18,_0x51538c){if(_0x576b1c[_0x6791('0x38')]['id']){delete _0x576b1c['body']['id'];}return db[_0x6791('0x44')]['find']({'where':{'id':_0x576b1c[_0x6791('0xbc')]['id']}})[_0x6791('0x1f')](function(_0x181b92){if(!_0x181b92){logger[_0x6791('0x26')](_0x6791('0xdb'),'abandon',0x194,_0x6791('0xdc'));_0x348f18['sendStatus'](0x194);}else{if(_0x181b92[_0x6791('0x7f')]){throw new db['Sequelize'][(_0x6791('0xd2'))](_0x6791('0xdd'));}}return _0x181b92;})[_0x6791('0x1f')](function(_0x105823){if(_0x105823){return _0x105823['update']({'closed':_0x576b1c['body'][_0x6791('0xde')],'disposition':_0x576b1c[_0x6791('0x38')][_0x6791('0xdf')]})[_0x6791('0x1f')](function(_0x5932ab){return _0x5932ab;});}})[_0x6791('0x1f')](function(_0x56389f){return respondWithRpcPromise(_0x6791('0xe0'),_0x6791('0xda'),_0x576b1c[_0x6791('0x38')],client9004);})[_0x6791('0x1f')](respondWithResult(_0x348f18,null))[_0x6791('0xba')](handleError(_0x348f18,null));};exports[_0x6791('0xe1')]=function(_0x3312c4,_0x5cd7c8,_0x3213a4){_0x3312c4[_0x6791('0x38')][_0x6791('0x35')]=_0x3312c4[_0x6791('0xe2')][_0x6791('0xe3')];_0x3312c4[_0x6791('0x38')][_0x6791('0xe4')]=_0x3312c4[_0x6791('0xe2')][_0x6791('0xe5')];_0x3312c4[_0x6791('0x38')][_0x6791('0x79')]=_0x3312c4[_0x6791('0xe2')]['mimetype'];return db[_0x6791('0xe6')][_0x6791('0xc0')](_0x3312c4['body'])[_0x6791('0x1f')](respondWithResult(_0x5cd7c8,0xc9))[_0x6791('0xba')](handleError(_0x5cd7c8,null));};exports[_0x6791('0xe7')]=function(_0x4e7de0,_0x5ad60f,_0x405363){return db[_0x6791('0x44')][_0x6791('0xc4')]({'where':{'id':_0x4e7de0[_0x6791('0xbc')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5ad60f,null))['then'](function(_0x1ea78e){if(_0x1ea78e){if(_0x1ea78e[_0x6791('0xde')]){return _0x5ad60f[_0x6791('0x2a')](0x193)[_0x6791('0x31')]({'status':0x193,'message':_0x6791('0xe8')});}return db[_0x6791('0xe6')][_0x6791('0xc4')]({'where':{'id':_0x4e7de0[_0x6791('0x4a')][_0x6791('0xe9')]},'raw':!![]})[_0x6791('0x1f')](handleEntityNotFound(_0x5ad60f,null));}})[_0x6791('0x1f')](function(_0x51e0ff){if(_0x51e0ff){var _0x40ced1=_0x51e0ff['ChatOfflineMessageId']!==null;var _0x2bbbf6=path[_0x6791('0xea')](config['root'],'server/files/attachments/');if(_0x40ced1){_0x2bbbf6=path[_0x6791('0xea')](_0x2bbbf6,_0x6791('0xeb'));}var _0x50b575=path[_0x6791('0xea')](_0x2bbbf6,_0x51e0ff[_0x6791('0xe4')]);return _0x5ad60f['download'](_0x50b575);}})[_0x6791('0xba')](handleError(_0x5ad60f,null));};exports[_0x6791('0xec')]=function(_0x217690,_0x3f8140){var _0x216b49=null;var _0x104b7d=null;var _0x1d1840=null;var _0xeeee25=null;if(_0x217690[_0x6791('0x38')]['id']){delete _0x217690['body']['id'];}if(_0x217690[_0x6791('0x38')][_0x6791('0xed')]){_0xeeee25=path[_0x6791('0xea')](config[_0x6791('0xee')],_0x6791('0xef'),util[_0x6791('0xf0')](_0x6791('0xf1'),Date['now']()));_0x217690[_0x6791('0x38')]['pathTranscript']=_0xeeee25;}return db[_0x6791('0x44')]['find']({'where':{'id':_0x217690[_0x6791('0xbc')]['id']},'include':[{'model':db[_0x6791('0xd7')],'as':_0x6791('0xf2'),'include':[{'model':db['User'],'as':'User'}]}]})[_0x6791('0x1f')](handleEntityNotFound(_0x3f8140,null))[_0x6791('0x1f')](saveUpdates(_0x217690[_0x6791('0x38')],null))[_0x6791('0x1f')](function(_0x749c0b){if(_0x749c0b){_0x216b49=_0x749c0b;return db[_0x6791('0xf3')][_0x6791('0x6d')]({'where':{'id':_0x216b49[_0x6791('0x82')]}});}})['then'](function(_0x2df0f3){if(_0x2df0f3){_0x1d1840=_0x2df0f3;return db[_0x6791('0xf4')][_0x6791('0x6d')]({'where':{'id':_0x216b49[_0x6791('0x77')]}});}})[_0x6791('0x1f')](function(_0x206dda){if(_0x206dda){_0x104b7d=_0x206dda;if(_0xeeee25){var _0x13ab4d=null;for(var _0x4685f1=0x1;_0x4685f1<_0x216b49['Messages'][_0x6791('0xa7')];++_0x4685f1){_0x13ab4d=_0x216b49[_0x6791('0xf2')][_0x4685f1];var _0x7f7b0d=_0x13ab4d[_0x6791('0x7f')]?util[_0x6791('0xf0')](_0x6791('0xf5'),_0x1d1840[_0x6791('0xf6')],_0x13ab4d[_0x6791('0x7f')]):_0x6791('0xf7');var _0x54f969=_0x217690['body']['customer']||util[_0x6791('0xf0')]('%s%d',_0x6791('0xf8'),_0x13ab4d[_0x6791('0x77')]);switch(_0x1d1840[_0x6791('0xf9')]){case'website_alias':_0x7f7b0d=_0x13ab4d[_0x6791('0x7f')]?util['format']('%s%d',_0x1d1840[_0x6791('0xf6')],_0x13ab4d[_0x6791('0x7f')]):_0x6791('0xf7');break;case _0x6791('0xfa'):_0x7f7b0d=_0x13ab4d[_0x6791('0x7f')]?_0x13ab4d[_0x6791('0x7d')][_0x6791('0xfb')]||_0x13ab4d[_0x6791('0x7d')][_0x6791('0x3d')]:_0x6791('0xf7');break;case _0x6791('0xfc'):_0x7f7b0d=_0x13ab4d[_0x6791('0x7f')]?_0x13ab4d[_0x6791('0x7d')]['fullname']:_0x6791('0xf7');break;default:_0x7f7b0d=_0x13ab4d[_0x6791('0x7f')]?util[_0x6791('0xf0')](_0x6791('0xf5'),_0x1d1840[_0x6791('0xf6')],_0x13ab4d[_0x6791('0x7f')]):_0x6791('0xf7');}var _0xd5e51f=util[_0x6791('0xf0')](_0x6791('0xfd'),moment(_0x13ab4d[_0x6791('0x84')])['format'](_0x6791('0xfe')),_0x13ab4d[_0x6791('0xff')]==='in'?_0x54f969:_0x7f7b0d,_0x13ab4d[_0x6791('0x38')]);if(!_0x13ab4d[_0x6791('0x100')]){fs[_0x6791('0x101')](_0xeeee25,_0xd5e51f);}}return db['MailAccount'][_0x6791('0xc4')]({'where':{'service':!![]},'include':[{'model':db[_0x6791('0x102')],'as':_0x6791('0x103'),'raw':!![]}]});}}})['then'](function(_0x287f0){if(_0x287f0&&_0x287f0[_0x6791('0x103')]&&_0x217690['body']){var _0x505914={'tls':{'rejectUnauthorized':![]}};if(_0x287f0[_0x6791('0x103')][_0x6791('0x104')]){_0x505914[_0x6791('0x104')]=_0x287f0['Smtp'][_0x6791('0x104')];}else{_0x505914['host']=_0x287f0[_0x6791('0x103')][_0x6791('0x105')];_0x505914[_0x6791('0x106')]=_0x287f0[_0x6791('0x103')][_0x6791('0x106')];_0x505914[_0x6791('0x107')]=_0x287f0[_0x6791('0x103')][_0x6791('0x107')];}if(_0x287f0['Smtp'][_0x6791('0x108')]){_0x505914['auth']={'user':_0x287f0[_0x6791('0x103')][_0x6791('0xa0')],'pass':_0x287f0[_0x6791('0x103')][_0x6791('0x109')]};}return respondWithRpcPromise(_0x6791('0x10a'),_0x6791('0x10b'),{'account':_0x505914,'message':{'from':util[_0x6791('0xf0')]('\x22%s\x22\x20<%s>',_0x287f0[_0x6791('0x35')],_0x287f0['email']||_0x287f0['Smtp'][_0x6791('0xa0')]),'to':_0x217690[_0x6791('0x38')][_0x6791('0xed')],'subject':_0x6791('0x10c'),'text':util[_0x6791('0xf0')](_0x6791('0x10d'),_0x217690['body'][_0x6791('0xed')]),'attachments':[{'path':_0xeeee25}]}})[_0x6791('0x1f')](function(){return _0x216b49;})[_0x6791('0xba')](function(_0x598e2a){console[_0x6791('0x26')](_0x598e2a);});}else{return _0x216b49;}})[_0x6791('0x1f')](respondWithStatusCode(_0x3f8140,0xc8))[_0x6791('0xba')](handleError(_0x3f8140,null));};exports[_0x6791('0x10e')]=function(_0x1c5b2e,_0x2d5291,_0x881fc6){return db[_0x6791('0xd7')][_0x6791('0x6d')]({'where':{'id':_0x1c5b2e['params']['id']}})[_0x6791('0x1f')](handleEntityNotFound(_0x2d5291,null))[_0x6791('0x1f')](function(_0x5096ae){if(_0x5096ae){return _0x5096ae['addMessage'](_0x1c5b2e['body'][_0x6791('0x10f')],_[_0x6791('0x110')](_0x1c5b2e[_0x6791('0x38')],[_0x6791('0x10f'),'id'])||{});}})[_0x6791('0x1f')](respondWithResult(_0x2d5291,null))[_0x6791('0xba')](handleError(_0x2d5291,null));};exports['getMessages']=function(_0x541ee8,_0x4876ef,_0x48d62f){var _0x2e5b68={'raw':![],'where':{}};var _0x56fadd={};var _0x5ad2f9={'count':0x0,'rows':[]};return db[_0x6791('0x44')][_0x6791('0xc4')]({'where':{'id':_0x541ee8[_0x6791('0xbc')]['id']}})['then'](handleEntityNotFound(_0x4876ef,null))[_0x6791('0x1f')](function(_0x117382){if(_0x117382){_0x56fadd['model']=_[_0x6791('0x49')](db[_0x6791('0xd7')][_0x6791('0x45')]);_0x56fadd['query']=_[_0x6791('0x49')](_0x541ee8[_0x6791('0x4a')]);_0x56fadd[_0x6791('0x53')]=_[_0x6791('0x4b')](_0x56fadd[_0x6791('0x48')],_0x56fadd[_0x6791('0x4a')]);_0x2e5b68[_0x6791('0x4c')]=_['intersection'](_0x56fadd['model'],qs[_0x6791('0x4d')](_0x541ee8[_0x6791('0x4a')][_0x6791('0x4d')]));_0x2e5b68[_0x6791('0x4c')]=_0x2e5b68[_0x6791('0x4c')]['length']?_0x2e5b68[_0x6791('0x4c')]:_0x56fadd[_0x6791('0x48')];if(!_0x541ee8[_0x6791('0x4a')][_0x6791('0x4e')]('nolimit')){_0x2e5b68['limit']=qs[_0x6791('0x2c')](_0x541ee8[_0x6791('0x4a')][_0x6791('0x2c')]);_0x2e5b68[_0x6791('0x2d')]=qs[_0x6791('0x2d')](_0x541ee8[_0x6791('0x4a')][_0x6791('0x2d')]);}_0x2e5b68['order']=qs[_0x6791('0x50')](_0x541ee8[_0x6791('0x4a')]['sort']);_0x2e5b68[_0x6791('0x51')]=qs[_0x6791('0x53')](_[_0x6791('0x52')](_0x541ee8['query'],_0x56fadd[_0x6791('0x53')]));_0x2e5b68[_0x6791('0x51')][_0x6791('0xb8')]=_0x117382['id'];if(_0x541ee8[_0x6791('0x4a')]['filter']){_0x2e5b68[_0x6791('0x51')]=_[_0x6791('0x37')](_0x2e5b68[_0x6791('0x51')],{'$or':_[_0x6791('0x3c')](_0x2e5b68['attributes'],function(_0x1b96a8){var _0x4f2e87={};_0x4f2e87[_0x1b96a8]={'$like':'%'+_0x541ee8[_0x6791('0x4a')][_0x6791('0x91')]+'%'};return _0x4f2e87;})});}if(_0x541ee8[_0x6791('0x4a')][_0x6791('0x86')]){var _0x267d3f=_0x541ee8[_0x6791('0x4a')]['$gte'][_0x6791('0x40')](',');var _0x1fe4f3={};_0x1fe4f3[_0x267d3f[0x0]]={'$gte':moment(_0x267d3f[0x1])[_0x6791('0xf0')](_0x6791('0x111'))};_0x2e5b68['where']=_['merge'](_0x2e5b68['where'],_0x1fe4f3);}_0x2e5b68=_['merge']({},_0x2e5b68,_0x541ee8[_0x6791('0xbf')]);return db[_0x6791('0xd7')][_0x6791('0x2e')]({'where':_0x2e5b68[_0x6791('0x51')]})[_0x6791('0x1f')](function(_0x28265e){_0x5ad2f9[_0x6791('0x2e')]=_0x28265e;if(_0x541ee8['query'][_0x6791('0xbd')]){_0x2e5b68['include']=[{'all':!![]}];}return db[_0x6791('0xd7')][_0x6791('0x112')](_0x2e5b68);})[_0x6791('0x1f')](function(_0x5a1d1d){_0x5ad2f9[_0x6791('0x113')]=_0x5a1d1d;return _0x5ad2f9;});}})[_0x6791('0x1f')](respondWithFilteredResult(_0x4876ef,_0x2e5b68))[_0x6791('0xba')](handleError(_0x4876ef,null));};exports[_0x6791('0x114')]=function(_0x202f0a,_0x2f4e6f,_0x4dd36a){var _0x42370c={'where':{}},_0x5a23ba={},_0x5088cd={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x6791('0xc4')]({'where':{'id':_0x202f0a[_0x6791('0xbc')]['id']}})[_0x6791('0x1f')](handleEntityNotFound(_0x2f4e6f,null))[_0x6791('0x1f')](function(_0xe4951){if(_0xe4951){_0x5a23ba[_0x6791('0x48')]=_[_0x6791('0x49')](db[_0x6791('0xd7')][_0x6791('0x45')]);_0x5a23ba['query']=_[_0x6791('0x49')](_0x202f0a['query']);_0x5a23ba[_0x6791('0x53')]=_[_0x6791('0x4b')](_0x5a23ba[_0x6791('0x48')],_0x5a23ba[_0x6791('0x4a')]);_0x42370c[_0x6791('0x4c')]=_[_0x6791('0x4b')](_0x5a23ba[_0x6791('0x48')],qs['fields'](_0x202f0a[_0x6791('0x4a')]['fields']));_0x42370c['attributes']=_0x42370c[_0x6791('0x4c')][_0x6791('0xa7')]?_0x42370c['attributes']:_0x5a23ba[_0x6791('0x48')];if(!_0x202f0a[_0x6791('0x4a')][_0x6791('0x4e')](_0x6791('0x4f'))){_0x42370c[_0x6791('0x2c')]=qs['limit'](_0x202f0a[_0x6791('0x4a')][_0x6791('0x2c')]);_0x42370c[_0x6791('0x2d')]=qs[_0x6791('0x2d')](_0x202f0a[_0x6791('0x4a')]['offset']);}_0x42370c[_0x6791('0x9b')]=qs['sort'](_0x202f0a['query'][_0x6791('0x50')]);_0x42370c['where']=qs[_0x6791('0x53')](_['pick'](_0x202f0a[_0x6791('0x4a')],_0x5a23ba[_0x6791('0x53')]));_0x42370c[_0x6791('0x51')][_0x6791('0xb8')]=_0xe4951['id'];if(_0x202f0a[_0x6791('0x4a')][_0x6791('0x91')]){_0x42370c[_0x6791('0x51')]=_[_0x6791('0x37')](_0x42370c[_0x6791('0x51')],{'$or':_['map'](_0x42370c['attributes'],function(_0x50e02c){var _0x2d7581={};_0x2d7581[_0x50e02c]={'$like':'%'+_0x202f0a[_0x6791('0x4a')][_0x6791('0x91')]+'%'};return _0x2d7581;})});}_0x42370c[_0x6791('0x51')][_0x6791('0x100')]=![];if(_0x202f0a[_0x6791('0x4a')]['id']){_0x42370c['where']['id']={'$gt':_0x202f0a['query']['id']};}_0x42370c=_[_0x6791('0x37')]({},_0x42370c,_0x202f0a[_0x6791('0xbf')]);return db[_0x6791('0xd7')]['count']({'where':_0x42370c[_0x6791('0x51')]})[_0x6791('0x1f')](function(_0x4a143f){_0x5088cd['count']=_0x4a143f;_0x42370c[_0x6791('0xbe')]=[];if(_0x202f0a[_0x6791('0x4a')][_0x6791('0x115')]){_0x42370c[_0x6791('0xbe')][_0x6791('0x42')]({'model':db[_0x6791('0x7d')],'as':_0x6791('0x7d'),'attributes':['id',_0x6791('0x3d'),_0x6791('0xfb')]});}if(_0x202f0a[_0x6791('0x4a')][_0x6791('0xbd')]){_0x42370c[_0x6791('0xbe')]=[{'all':!![]}];}return db[_0x6791('0xd7')][_0x6791('0x112')](_0x42370c);})[_0x6791('0x1f')](function(_0x44dc2a){_0x5088cd['rows']=_0x44dc2a;return _0x5088cd;});}})[_0x6791('0x1f')](respondWithFilteredResult(_0x2f4e6f,_0x42370c))['catch'](handleError(_0x2f4e6f,null));};exports[_0x6791('0x116')]=function(_0x9c2cb,_0x5038f2,_0x7e30d9){return db[_0x6791('0x44')]['find']({'where':{'id':_0x9c2cb[_0x6791('0xbc')]['id']}})['then'](handleEntityNotFound(_0x5038f2,null))[_0x6791('0x1f')](function(_0xd53708){if(_0xd53708){return _0xd53708['setTags'](_0x9c2cb['body']['ids'],_[_0x6791('0x110')](_0x9c2cb[_0x6791('0x38')],['ids','id'])||{})[_0x6791('0x117')](function(){return db[_0x6791('0x118')][_0x6791('0x112')]({'attributes':['id','name',_0x6791('0x56')],'where':{'id':_0x9c2cb[_0x6791('0x38')][_0x6791('0x10f')]}});})[_0x6791('0x1f')](function(_0x5e3c66){socket[_0x6791('0x119')]('chatInteractionTags:save',{'id':Number(_0x9c2cb[_0x6791('0xbc')]['id']),'tags':_0x5e3c66||[]});return{'id':Number(_0x9c2cb[_0x6791('0xbc')]['id']),'tags':_0x5e3c66||[]};});}})[_0x6791('0x1f')](respondWithResult(_0x5038f2,null))['catch'](handleError(_0x5038f2,null));};exports[_0x6791('0x11a')]=function(_0x10530c,_0x521cae,_0x3f4172){return db[_0x6791('0x44')]['find']({'where':{'id':_0x10530c[_0x6791('0xbc')]['id']}})[_0x6791('0x1f')](handleEntityNotFound(_0x521cae,null))[_0x6791('0x1f')](function(_0x926ee4){if(_0x926ee4){return _0x926ee4[_0x6791('0x11a')](_0x10530c[_0x6791('0x4a')][_0x6791('0x10f')]);}})['then'](respondWithStatusCode(_0x521cae,null))[_0x6791('0xba')](handleError(_0x521cae,null));};exports[_0x6791('0x11b')]=function(_0x22dbd0,_0x1cc5c3){var _0x1d2613=moment()[_0x6791('0x11c')]()[_0x6791('0xa6')]();var _0x1d3607=path[_0x6791('0xea')](config[_0x6791('0xee')],_0x6791('0x11d'),_0x6791('0x11e'),_0x6791('0x11f'));var _0x3b3363=path[_0x6791('0xea')](config['root'],'server',_0x6791('0x11e'),_0x6791('0x120'));var _0x56d353=path[_0x6791('0xea')](_0x1d3607,_0x1d2613);var _0x481b70=util[_0x6791('0xf0')](_0x6791('0x121'),_0x22dbd0[_0x6791('0xbc')]['id'],_0x1d2613);var _0x1caa00=path[_0x6791('0xea')](_0x1d3607,_0x481b70);var _0x14d7e3=[];_0x14d7e3[_0x6791('0x42')]({'model':db[_0x6791('0x7d')],'as':_0x6791('0x7d'),'attributes':['id',_0x6791('0x3d')],'raw':!![]});_0x14d7e3[_0x6791('0x42')]({'model':db[_0x6791('0xf4')],'as':'Contact','attributes':['id',_0x6791('0x122'),_0x6791('0x123')],'raw':!![]});if(_0x22dbd0[_0x6791('0x4a')][_0x6791('0x120')]){_0x14d7e3[_0x6791('0x42')]({'model':db[_0x6791('0xe6')],'as':_0x6791('0xe6'),'raw':!![]});}var _0xb8d13a=[{'model':db[_0x6791('0xd7')],'as':_0x6791('0xf2'),'attributes':['id',_0x6791('0x38'),_0x6791('0x84'),_0x6791('0xff'),_0x6791('0x100'),_0x6791('0x124')],'include':_0x14d7e3}];_0xb8d13a[_0x6791('0x42')]({'model':db[_0x6791('0xf3')],'as':_0x6791('0x125'),'attributes':['id','name']});_0xb8d13a[_0x6791('0x42')]({'model':db['User'],'as':_0x6791('0x126'),'attributes':['id','fullname']});return db[_0x6791('0x44')][_0x6791('0x6d')]({'where':{'id':_0x22dbd0['params']['id']},'include':_0xb8d13a})[_0x6791('0x1f')](handleEntityNotFound(_0x1cc5c3,null))[_0x6791('0x1f')](function(_0x3c7b66){if(_0x3c7b66){var _0x3d7e1f=_0x3c7b66[_0x6791('0x127')]({'plain':!![]});fs[_0x6791('0x128')](_0x56d353);var _0x2e6bc5={'channel':_0x6791('0x129'),'account':_0x3d7e1f[_0x6791('0x125')][_0x6791('0x35')],'agent':_0x3d7e1f[_0x6791('0x126')]?_0x3d7e1f[_0x6791('0x126')][_0x6791('0x3d')]:_0x6791('0x12a'),'createdAt':moment(_0x3d7e1f[_0x6791('0x84')])[_0x6791('0xf0')](_0x6791('0x111'))[_0x6791('0xa6')](),'closedAt':_0x3d7e1f[_0x6791('0xde')]?moment(_0x3d7e1f[_0x6791('0x12b')])[_0x6791('0xf0')](_0x6791('0x111'))['toString']():'','disposition':_0x3d7e1f[_0x6791('0xdf')],'chatInfo':{'browser':_0x3d7e1f[_0x6791('0x12c')],'os':_0x3d7e1f[_0x6791('0x12d')],'referer':_0x3d7e1f[_0x6791('0x12e')],'customerIp':_0x3d7e1f[_0x6791('0x12f')],'customerPort':_0x3d7e1f[_0x6791('0x130')]?_0x3d7e1f[_0x6791('0x130')]:_0x6791('0x12a')},'messages':_(_0x3d7e1f[_0x6791('0xf2')])[_0x6791('0x131')]()[_0x6791('0x91')]({'secret':![]})[_0x6791('0x3c')](function(_0x449a9f){if(_0x449a9f[_0x6791('0xe6')]){var _0xc6d9ba=path[_0x6791('0xea')](_0x3b3363,_0x449a9f[_0x6791('0xe6')][_0x6791('0xe4')]);if(fs['existsSync'](_0xc6d9ba)){fs[_0x6791('0x132')](_0xc6d9ba)['pipe'](fs[_0x6791('0x133')](path['join'](_0x56d353,_0x449a9f[_0x6791('0xe6')][_0x6791('0xe4')])));}}return{'date':moment(_0x449a9f[_0x6791('0x84')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x6791('0xa6')](),'sender':_0x449a9f[_0x6791('0xff')]===_0x6791('0x134')?_0x449a9f[_0x6791('0x7d')]?_0x449a9f['User'][_0x6791('0x3d')]:'System':_0x449a9f['Contact'][_0x6791('0x122')]+(_0x449a9f[_0x6791('0x72')][_0x6791('0x123')]?'\x20'+_0x449a9f[_0x6791('0x72')][_0x6791('0x123')]:''),'body':_0x449a9f[_0x6791('0xe6')]?_0x449a9f[_0x6791('0xe6')]['basename']:_0x449a9f[_0x6791('0x38')],'direction':_0x449a9f['direction']===_0x6791('0x134')?'A':'C','secret':_0x449a9f['secret'],'read':_0x449a9f[_0x6791('0x124')],'attachment':_0x449a9f[_0x6791('0xe6')]};})[_0x6791('0x6f')]()};return ejs['renderFile'](path[_0x6791('0xea')](config[_0x6791('0xee')],_0x6791('0x11d'),_0x6791('0x135'),_0x6791('0x136')),{'interaction':_0x2e6bc5})[_0x6791('0x1f')](function(_0x2946bd){var _0x4ede2f=path[_0x6791('0xea')](_0x56d353,_0x6791('0x137')+_0x3d7e1f['id']+'-'+_0x1d2613+_0x6791('0x138'));var _0x2a8d18={'path':_0x4ede2f,'channel':_0x6791('0x129'),'interactionId':_0x3d7e1f['id']};return pdf[_0x6791('0x139')](_0x2946bd,_0x2a8d18);})[_0x6791('0x1f')](function(){return new BPromise(function(_0x192f05,_0x1e661a){zipdir(_0x56d353,{'saveTo':_0x1caa00},function(_0x102182,_0x2f15a2){if(_0x102182)return _0x1e661a(_0x102182);return _0x192f05(_0x2f15a2);});})[_0x6791('0x1f')](function(){return new BPromise(function(_0x2aa871,_0x59376b){rimraf(_0x56d353,function(_0xefb45b){if(_0xefb45b)_0x59376b(_0xefb45b);return _0x2aa871();});});})[_0x6791('0x1f')](function(){return _0x1cc5c3['download'](_0x1caa00,_0x481b70,function(_0x4c3ef2){if(_0x4c3ef2){console[_0x6791('0x13a')](_0x6791('0x13b'),_0x4c3ef2);}else{fs[_0x6791('0x13c')](_0x1caa00);}});});});}else{return _0x1cc5c3[_0x6791('0x29')](0xc8);}})['catch'](handleError(_0x1cc5c3,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index cc6a0ee..a82094f 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 _0x3b86=['then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x3b86,0xc0));var _0x63b8=function(_0x5c5b24,_0xe2eb09){_0x5c5b24=_0x5c5b24-0x0;var _0x32321b=_0x3b86[_0x5c5b24];return _0x32321b;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x63b8('0x0'))['db'][_0x63b8('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x63b8('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x63b8('0x3')](0x0);var events={'afterCreate':_0x63b8('0x4'),'afterUpdate':_0x63b8('0x5'),'afterDestroy':_0x63b8('0x6')};function emitEvent(_0x17a88d){return function(_0x296afa,_0x12fd73,_0x2d43d5){_0x296afa[_0x63b8('0x7')]({'attributes':['id'],'raw':!![]})[_0x63b8('0x8')](function(_0x378487){_0x296afa[_0x63b8('0x9')](_0x63b8('0xa'),_0x378487[_0x63b8('0xb')](function(_0x1a2cad){return{'id':_0x1a2cad['id']};}));return ChatMessage[_0x63b8('0xc')]({'where':{'ChatInteractionId':_0x296afa['id'],'direction':'in','read':![]},'raw':!![]});})[_0x63b8('0x8')](function(_0x2b2eeb){_0x296afa[_0x63b8('0x9')](_0x63b8('0xd'),_0x2b2eeb[_0x63b8('0xe')]);ChatInteractionEvents['emit'](_0x17a88d+':'+_0x296afa['id'],_0x296afa);ChatInteractionEvents[_0x63b8('0xf')](_0x17a88d,_0x296afa);_0x2d43d5(null);})[_0x63b8('0x10')](_0x2d43d5(null));};}for(var e in events){if(events[_0x63b8('0x11')](e)){var event=events[e];ChatInteraction[_0x63b8('0x12')](e,emitEvent(event));}}module[_0x63b8('0x13')]=ChatInteractionEvents; \ No newline at end of file +var _0x0fce=['emit','catch','hasOwnProperty','exports','../../mysqldb','ChatMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','map','unreadMessages','length'];(function(_0x248703,_0xa58c07){var _0x12daa9=function(_0x53250b){while(--_0x53250b){_0x248703['push'](_0x248703['shift']());}};_0x12daa9(++_0xa58c07);}(_0x0fce,0x16c));var _0xe0fc=function(_0x305005,_0x42aa78){_0x305005=_0x305005-0x0;var _0x2affe7=_0x0fce[_0x305005];return _0x2affe7;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xe0fc('0x0'))['db']['ChatInteraction'];var ChatMessage=require(_0xe0fc('0x0'))['db'][_0xe0fc('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xe0fc('0x2')](0x0);var events={'afterCreate':_0xe0fc('0x3'),'afterUpdate':'update','afterDestroy':_0xe0fc('0x4')};function emitEvent(_0x4cdc2f){return function(_0x196d0c,_0x175e3e,_0xfad95){_0x196d0c[_0xe0fc('0x5')]({'attributes':['id'],'raw':!![]})[_0xe0fc('0x6')](function(_0x34767b){_0x196d0c[_0xe0fc('0x7')]('Users',_0x34767b[_0xe0fc('0x8')](function(_0x3b01b4){return{'id':_0x3b01b4['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x196d0c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe0fc('0x6')](function(_0xcab731){_0x196d0c[_0xe0fc('0x7')](_0xe0fc('0x9'),_0xcab731[_0xe0fc('0xa')]);ChatInteractionEvents['emit'](_0x4cdc2f+':'+_0x196d0c['id'],_0x196d0c);ChatInteractionEvents[_0xe0fc('0xb')](_0x4cdc2f,_0x196d0c);_0xfad95(null);})[_0xe0fc('0xc')](_0xfad95(null));};}for(var e in events){if(events[_0xe0fc('0xd')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xe0fc('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index db8cafd..78d0863 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 _0x7f1c=['api','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','exports','define','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7f1c,0x1d1));var _0xc7f1=function(_0x28c2dd,_0x45c558){_0x28c2dd=_0x28c2dd-0x0;var _0x5a2895=_0x7f1c[_0x28c2dd];return _0x5a2895;};'use strict';var _=require(_0xc7f1('0x0'));var util=require(_0xc7f1('0x1'));var logger=require(_0xc7f1('0x2'))(_0xc7f1('0x3'));var moment=require('moment');var BPromise=require(_0xc7f1('0x4'));var rp=require(_0xc7f1('0x5'));var fs=require('fs');var path=require(_0xc7f1('0x6'));var rimraf=require(_0xc7f1('0x7'));var config=require('../../config/environment');var attributes=require(_0xc7f1('0x8'));module[_0xc7f1('0x9')]=function(_0x4acc5d,_0x464815){return _0x4acc5d[_0xc7f1('0xa')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x20ecfd,_0x120f45,_0x8b46da){if(_0x20ecfd[_0xc7f1('0xb')](_0xc7f1('0xc'))){_0x20ecfd[_0xc7f1('0xd')]=moment()[_0xc7f1('0xe')](_0xc7f1('0xf'));}_0x8b46da(null,_0x20ecfd);}},'charset':_0xc7f1('0x10'),'collate':_0xc7f1('0x11')});}; \ No newline at end of file +var _0x29c7=['request-promise','path','rimraf','./chatInteraction.attributes','define','ChatInteraction','changed','closed','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x23d9dd,_0xd0cc97){var _0x178fa6=function(_0x2ea17a){while(--_0x2ea17a){_0x23d9dd['push'](_0x23d9dd['shift']());}};_0x178fa6(++_0xd0cc97);}(_0x29c7,0x1a3));var _0x729c=function(_0x50e2b6,_0x4c4540){_0x50e2b6=_0x50e2b6-0x0;var _0x5d105c=_0x29c7[_0x50e2b6];return _0x5d105c;};'use strict';var _=require(_0x729c('0x0'));var util=require(_0x729c('0x1'));var logger=require(_0x729c('0x2'))(_0x729c('0x3'));var moment=require(_0x729c('0x4'));var BPromise=require(_0x729c('0x5'));var rp=require(_0x729c('0x6'));var fs=require('fs');var path=require(_0x729c('0x7'));var rimraf=require(_0x729c('0x8'));var config=require('../../config/environment');var attributes=require(_0x729c('0x9'));module['exports']=function(_0xd86d96,_0x5288db){return _0xd86d96[_0x729c('0xa')](_0x729c('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4fd7a4,_0x58b93e,_0x348f5a){if(_0x4fd7a4[_0x729c('0xc')](_0x729c('0xd'))){_0x4fd7a4['closedAt']=moment()[_0x729c('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x348f5a(null,_0x4fd7a4);}},'charset':_0x729c('0xf'),'collate':_0x729c('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 9e9cb4e..fe90c14 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 _0x27ef=['result','catch','ChatInteraction','options','raw','where','attributes','UpdateChatInteraction','stringify','AddTagsToChatInteraction','then','addTags','body','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0xcdc1e2,_0xe7a35b){var _0x21e4da=function(_0x3e40a1){while(--_0x3e40a1){_0xcdc1e2['push'](_0xcdc1e2['shift']());}};_0x21e4da(++_0xe7a35b);}(_0x27ef,0x1c8));var _0xf27e=function(_0x2a8122,_0xd957e){_0x2a8122=_0x2a8122-0x0;var _0x49a5c7=_0x27ef[_0x2a8122];return _0x49a5c7;};'use strict';var _=require('lodash');var util=require(_0xf27e('0x0'));var moment=require(_0xf27e('0x1'));var BPromise=require(_0xf27e('0x2'));var rs=require(_0xf27e('0x3'));var fs=require('fs');var Redis=require(_0xf27e('0x4'));var db=require(_0xf27e('0x5'))['db'];var utils=require(_0xf27e('0x6'));var logger=require(_0xf27e('0x7'))('rpc');var config=require(_0xf27e('0x8'));var jayson=require(_0xf27e('0x9'));var client=jayson[_0xf27e('0xa')]['http']({'port':0x232a});config[_0xf27e('0xb')]=_[_0xf27e('0xc')](config[_0xf27e('0xb')],{'host':_0xf27e('0xd'),'port':0x18eb});var socket=require(_0xf27e('0xe'))(new Redis(config[_0xf27e('0xb')]));require(_0xf27e('0xf'))['register'](socket);function respondWithRpcPromise(_0x1d9240,_0x394be9,_0x44667a){return new BPromise(function(_0x5b5201,_0x5b9265){return client['request'](_0x1d9240,_0x44667a)['then'](function(_0x1c3710){logger['info'](_0xf27e('0x10'),_0x394be9,_0xf27e('0x11'));logger[_0xf27e('0x12')](_0xf27e('0x13'),_0x394be9,'request\x20sent',JSON['stringify'](_0x1c3710));if(_0x1c3710[_0xf27e('0x14')]){if(_0x1c3710[_0xf27e('0x14')][_0xf27e('0x15')]===0x1f4){logger[_0xf27e('0x14')](_0xf27e('0x10'),_0x394be9,_0x1c3710[_0xf27e('0x14')][_0xf27e('0x16')]);return _0x5b9265(_0x1c3710[_0xf27e('0x14')][_0xf27e('0x16')]);}logger[_0xf27e('0x14')](_0xf27e('0x10'),_0x394be9,_0x1c3710['error'][_0xf27e('0x16')]);return _0x5b5201(_0x1c3710[_0xf27e('0x14')][_0xf27e('0x16')]);}else{logger[_0xf27e('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x394be9,_0xf27e('0x11'));_0x5b5201(_0x1c3710[_0xf27e('0x18')][_0xf27e('0x16')]);}})[_0xf27e('0x19')](function(_0x5adb0d){logger['error'](_0xf27e('0x10'),_0x394be9,_0x5adb0d);_0x5b9265(_0x5adb0d);});});}exports['UpdateChatInteraction']=function(_0xf21199){var _0x1c584a=this;return new Promise(function(_0xac4baf,_0x58577a){return db[_0xf27e('0x1a')]['update'](_0xf21199['body'],{'raw':_0xf21199[_0xf27e('0x1b')]?_0xf21199['options'][_0xf27e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf21199[_0xf27e('0x1b')]?_0xf21199['options'][_0xf27e('0x1d')]||null:null,'attributes':_0xf21199[_0xf27e('0x1b')]?_0xf21199['options'][_0xf27e('0x1e')]||null:null,'limit':_0xf21199[_0xf27e('0x1b')]?_0xf21199['options']['limit']||null:null})['then'](function(_0x359742){logger[_0xf27e('0x17')](_0xf27e('0x1f'),_0xf21199);logger[_0xf27e('0x12')](_0xf27e('0x1f'),_0xf21199,JSON[_0xf27e('0x20')](_0x359742));_0xac4baf(_0x359742);})[_0xf27e('0x19')](function(_0x211436){logger[_0xf27e('0x14')](_0xf27e('0x1f'),_0x211436[_0xf27e('0x16')],_0xf21199);_0x58577a(_0x1c584a[_0xf27e('0x14')](0x1f4,_0x211436[_0xf27e('0x16')]));});});};exports[_0xf27e('0x21')]=function(_0x546f8e){return new Promise(function(_0x575890,_0x56898c){return db[_0xf27e('0x1a')]['find']({'where':_0x546f8e['options']?_0x546f8e['options']['where']||null:null})[_0xf27e('0x22')](function(_0x3e7bd1){if(_0x3e7bd1){return _0x3e7bd1[_0xf27e('0x23')](_0x546f8e[_0xf27e('0x24')]['ids'],_['omit'](_0x546f8e[_0xf27e('0x24')],[_0xf27e('0x25'),'id'])||{});}})[_0xf27e('0x26')](function(_0xb0a813){logger[_0xf27e('0x17')](_0xf27e('0x27'),_0x546f8e);logger[_0xf27e('0x12')](_0xf27e('0x27'),_0x546f8e,JSON[_0xf27e('0x20')](_0xb0a813));_0x575890(_0xb0a813);})[_0xf27e('0x19')](function(_0x532e0c){logger[_0xf27e('0x14')](_0xf27e('0x27'),_0x532e0c['message'],_0x546f8e);_0x56898c(_this[_0xf27e('0x14')](0x1f4,_0x532e0c['message']));});});}; \ No newline at end of file +var _0x99ed=['attributes','then','UpdateChatInteraction','AddTagsToChatInteraction','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ChatInteraction','body','options','raw','where'];(function(_0x4ea6af,_0x4aa32e){var _0x4cb1e6=function(_0xc9edd0){while(--_0xc9edd0){_0x4ea6af['push'](_0x4ea6af['shift']());}};_0x4cb1e6(++_0x4aa32e);}(_0x99ed,0x1ac));var _0xd99e=function(_0x7e20f4,_0x2ee0e6){_0x7e20f4=_0x7e20f4-0x0;var _0x1977bc=_0x99ed[_0x7e20f4];return _0x1977bc;};'use strict';var _=require(_0xd99e('0x0'));var util=require(_0xd99e('0x1'));var moment=require(_0xd99e('0x2'));var BPromise=require(_0xd99e('0x3'));var rs=require(_0xd99e('0x4'));var fs=require('fs');var Redis=require(_0xd99e('0x5'));var db=require(_0xd99e('0x6'))['db'];var utils=require(_0xd99e('0x7'));var logger=require(_0xd99e('0x8'))(_0xd99e('0x9'));var config=require(_0xd99e('0xa'));var jayson=require(_0xd99e('0xb'));var client=jayson[_0xd99e('0xc')][_0xd99e('0xd')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd99e('0xe')],{'host':_0xd99e('0xf'),'port':0x18eb});var socket=require(_0xd99e('0x10'))(new Redis(config['redis']));require(_0xd99e('0x11'))[_0xd99e('0x12')](socket);function respondWithRpcPromise(_0x168780,_0x264c49,_0x483080){return new BPromise(function(_0x86ee38,_0xbd3502){return client['request'](_0x168780,_0x483080)['then'](function(_0x36858e){logger[_0xd99e('0x13')](_0xd99e('0x14'),_0x264c49,_0xd99e('0x15'));logger[_0xd99e('0x16')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x264c49,_0xd99e('0x15'),JSON[_0xd99e('0x17')](_0x36858e));if(_0x36858e['error']){if(_0x36858e[_0xd99e('0x18')][_0xd99e('0x19')]===0x1f4){logger[_0xd99e('0x18')](_0xd99e('0x14'),_0x264c49,_0x36858e['error'][_0xd99e('0x1a')]);return _0xbd3502(_0x36858e[_0xd99e('0x18')][_0xd99e('0x1a')]);}logger[_0xd99e('0x18')](_0xd99e('0x14'),_0x264c49,_0x36858e[_0xd99e('0x18')][_0xd99e('0x1a')]);return _0x86ee38(_0x36858e[_0xd99e('0x18')][_0xd99e('0x1a')]);}else{logger[_0xd99e('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x264c49,_0xd99e('0x15'));_0x86ee38(_0x36858e[_0xd99e('0x1b')][_0xd99e('0x1a')]);}})[_0xd99e('0x1c')](function(_0xbfb64b){logger['error'](_0xd99e('0x14'),_0x264c49,_0xbfb64b);_0xbd3502(_0xbfb64b);});});}exports['UpdateChatInteraction']=function(_0x4d318f){var _0x26c270=this;return new Promise(function(_0x8b8190,_0x149470){return db[_0xd99e('0x1d')]['update'](_0x4d318f[_0xd99e('0x1e')],{'raw':_0x4d318f[_0xd99e('0x1f')]?_0x4d318f[_0xd99e('0x1f')][_0xd99e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d318f[_0xd99e('0x1f')]?_0x4d318f[_0xd99e('0x1f')][_0xd99e('0x21')]||null:null,'attributes':_0x4d318f[_0xd99e('0x1f')]?_0x4d318f['options'][_0xd99e('0x22')]||null:null,'limit':_0x4d318f[_0xd99e('0x1f')]?_0x4d318f['options']['limit']||null:null})[_0xd99e('0x23')](function(_0x45b747){logger[_0xd99e('0x13')]('UpdateChatInteraction',_0x4d318f);logger[_0xd99e('0x16')](_0xd99e('0x24'),_0x4d318f,JSON['stringify'](_0x45b747));_0x8b8190(_0x45b747);})[_0xd99e('0x1c')](function(_0x3096af){logger[_0xd99e('0x18')](_0xd99e('0x24'),_0x3096af['message'],_0x4d318f);_0x149470(_0x26c270[_0xd99e('0x18')](0x1f4,_0x3096af[_0xd99e('0x1a')]));});});};exports[_0xd99e('0x25')]=function(_0x24b79f){return new Promise(function(_0x587943,_0x29a1cf){return db['ChatInteraction']['find']({'where':_0x24b79f[_0xd99e('0x1f')]?_0x24b79f['options']['where']||null:null})[_0xd99e('0x23')](function(_0x5bf8cc){if(_0x5bf8cc){return _0x5bf8cc['addTags'](_0x24b79f[_0xd99e('0x1e')][_0xd99e('0x26')],_[_0xd99e('0x27')](_0x24b79f[_0xd99e('0x1e')],[_0xd99e('0x26'),'id'])||{});}})[_0xd99e('0x28')](function(_0x357ded){logger['info']('AddTags',_0x24b79f);logger[_0xd99e('0x16')](_0xd99e('0x29'),_0x24b79f,JSON[_0xd99e('0x17')](_0x357ded));_0x587943(_0x357ded);})[_0xd99e('0x1c')](function(_0x5689b8){logger[_0xd99e('0x18')](_0xd99e('0x29'),_0x5689b8[_0xd99e('0x1a')],_0x24b79f);_0x29a1cf(_this[_0xd99e('0x18')](0x1f4,_0x5689b8[_0xd99e('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index e51a812..30898e4 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 _0x3667=['remove','update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x496e49,_0x15b358){var _0x49d8da=function(_0x488292){while(--_0x488292){_0x496e49['push'](_0x496e49['shift']());}};_0x49d8da(++_0x15b358);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInteractionEvents=require(_0x7366('0x0'));var events=[_0x7366('0x1'),_0x7366('0x2'),_0x7366('0x3')];function createListener(_0x3c601d,_0x5d1072){return function(_0x27a90d){_0x5d1072[_0x7366('0x4')](_0x3c601d,_0x27a90d);};}function removeListener(_0x4b32a7,_0x27726b){return function(){ChatInteractionEvents[_0x7366('0x5')](_0x4b32a7,_0x27726b);};}exports[_0x7366('0x6')]=function(_0x1c0cf4){for(var _0x101e3d=0x0,_0x589397=events[_0x7366('0x7')];_0x101e3d<_0x589397;_0x101e3d++){var _0xa1a3c5=events[_0x101e3d];var _0x2dd32b=createListener(_0x7366('0x8')+_0xa1a3c5,_0x1c0cf4);ChatInteractionEvents['on'](_0xa1a3c5,_0x2dd32b);}}; \ No newline at end of file +var _0xdedc=['emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xdedc,0xdd));var _0xcded=function(_0x3bb557,_0x2d4e15){_0x3bb557=_0x3bb557-0x0;var _0x5eebcb=_0xdedc[_0x3bb557];return _0x5eebcb;};'use strict';var ChatInteractionEvents=require(_0xcded('0x0'));var events=[_0xcded('0x1'),_0xcded('0x2'),'update'];function createListener(_0x4979de,_0x43ca97){return function(_0x3b48c4){_0x43ca97[_0xcded('0x3')](_0x4979de,_0x3b48c4);};}function removeListener(_0x3b631b,_0x48037d){return function(){ChatInteractionEvents[_0xcded('0x4')](_0x3b631b,_0x48037d);};}exports[_0xcded('0x5')]=function(_0x18f8c1){for(var _0x59407c=0x0,_0x27efea=events[_0xcded('0x6')];_0x59407c<_0x27efea;_0x59407c++){var _0x56666f=events[_0x59407c];var _0x4a103e=createListener(_0xcded('0x7')+_0x56666f,_0x18f8c1);ChatInteractionEvents['on'](_0x56666f,_0x4a103e);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index b84a55f..963fd55 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 _0x703b=['chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/abandon','abandon','close','delete','chatinteraction:destroy','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','root','%s-%s','now','originalname','/:id/attachment_upload','single','file','/:id/messages','addMessage','/:id/tags','tracked'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x703b,0x185));var _0xb703=function(_0x43593d,_0x59b4b8){_0x43593d=_0x43593d-0x0;var _0x55a3ab=_0x703b[_0x43593d];return _0x55a3ab;};'use strict';var multer=require(_0xb703('0x0'));var util=require(_0xb703('0x1'));var path=require(_0xb703('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb703('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb703('0x4'));var interaction=require(_0xb703('0x5'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0xb703('0x6')]('/',auth[_0xb703('0x7')](),controller[_0xb703('0x8')]);router[_0xb703('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xb703('0x9')]);router[_0xb703('0x6')](_0xb703('0xa'),auth[_0xb703('0xb')](),controller[_0xb703('0xc')]);router[_0xb703('0x6')](_0xb703('0xd'),auth['isChatInteractionAuthorized'](),controller[_0xb703('0xe')]);router[_0xb703('0x6')]('/:id/messages',auth[_0xb703('0x7')](),controller[_0xb703('0xf')]);router['get']('/:id/my_messages',auth[_0xb703('0xb')](),controller[_0xb703('0x10')]);router[_0xb703('0x6')](_0xb703('0x11'),auth[_0xb703('0x7')](),controller[_0xb703('0x12')]);router[_0xb703('0x13')]('/',auth[_0xb703('0x7')](),controller[_0xb703('0x14')]);router[_0xb703('0x13')](_0xb703('0x15'),auth[_0xb703('0x7')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xb703('0x16')]({'destination':function(_0x4a6b1f,_0x3d4d0f,_0x229da7){_0x229da7(null,path['join'](config[_0xb703('0x17')],'server/files/attachments/'));},'filename':function(_0x1f5cfe,_0x2b99ba,_0x4d5da0){_0x4d5da0(null,util['format'](_0xb703('0x18'),Date[_0xb703('0x19')](),_0x2b99ba[_0xb703('0x1a')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xb703('0x1b'),upload[_0xb703('0x1c')](_0xb703('0x1d')),controller['attachmentUpload']);router[_0xb703('0x13')](_0xb703('0x1e'),auth['isChatInteractionAuthorized'](),controller[_0xb703('0x1f')]);router[_0xb703('0x13')](_0xb703('0x20'),auth['isAuthenticated'](),interaction[_0xb703('0x21')](_0xb703('0x22'),_0xb703('0x23')),controller[_0xb703('0x24')]);router[_0xb703('0x25')](_0xb703('0xa'),auth[_0xb703('0x7')](),interaction[_0xb703('0x21')](_0xb703('0x22'),_0xb703('0x26')),controller[_0xb703('0x27')]);router[_0xb703('0x25')]('/:id/custom_update',controller['customUpdate']);router[_0xb703('0x25')](_0xb703('0x28'),auth[_0xb703('0xb')](),controller[_0xb703('0x29')]);router[_0xb703('0x25')]('/:id/close',controller[_0xb703('0x2a')]);router[_0xb703('0x2b')](_0xb703('0xa'),auth['isAuthenticated'](),interaction['tracked'](_0xb703('0x22'),_0xb703('0x2c')),controller['destroy']);router[_0xb703('0x2b')](_0xb703('0x20'),auth[_0xb703('0x7')](),controller[_0xb703('0x2d')]);module[_0xb703('0x2e')]=router; \ No newline at end of file +var _0x3418=['file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','customUpdate','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','download','post','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','now','originalname','single'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_0x3418,0x7d));var _0x8341=function(_0x3c9307,_0x27679f){_0x3c9307=_0x3c9307-0x0;var _0x32524e=_0x3418[_0x3c9307];return _0x32524e;};'use strict';var multer=require(_0x8341('0x0'));var util=require(_0x8341('0x1'));var path=require(_0x8341('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8341('0x3')]();var fs_extra=require(_0x8341('0x4'));var auth=require(_0x8341('0x5'));var interaction=require(_0x8341('0x6'));var config=require(_0x8341('0x7'));var controller=require(_0x8341('0x8'));router[_0x8341('0x9')]('/',auth[_0x8341('0xa')](),controller[_0x8341('0xb')]);router[_0x8341('0x9')](_0x8341('0xc'),auth[_0x8341('0xa')](),controller[_0x8341('0xd')]);router[_0x8341('0x9')](_0x8341('0xe'),auth[_0x8341('0xf')](),controller[_0x8341('0x10')]);router[_0x8341('0x9')](_0x8341('0x11'),auth[_0x8341('0xf')](),controller[_0x8341('0x12')]);router['get'](_0x8341('0x13'),auth[_0x8341('0xa')](),controller['getMessages']);router['get'](_0x8341('0x14'),auth['isChatInteractionAuthorized'](),controller[_0x8341('0x15')]);router[_0x8341('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x8341('0x16')]);router['post']('/',auth[_0x8341('0xa')](),controller['create']);router[_0x8341('0x17')](_0x8341('0x18'),auth[_0x8341('0xa')](),controller[_0x8341('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1cd9bc,_0x2e15d5,_0x2b73ad){_0x2b73ad(null,path[_0x8341('0x1a')](config[_0x8341('0x1b')],_0x8341('0x1c')));},'filename':function(_0x580168,_0x4bf78d,_0x120d37){_0x120d37(null,util[_0x8341('0x1d')](_0x8341('0x1e'),Date[_0x8341('0x1f')](),_0x4bf78d[_0x8341('0x20')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x8341('0x21')](_0x8341('0x22')),controller[_0x8341('0x23')]);router[_0x8341('0x17')]('/:id/messages',auth[_0x8341('0xf')](),controller[_0x8341('0x24')]);router[_0x8341('0x17')](_0x8341('0x25'),auth['isAuthenticated'](),interaction[_0x8341('0x26')](_0x8341('0x27'),_0x8341('0x28')),controller[_0x8341('0x29')]);router[_0x8341('0x2a')](_0x8341('0xe'),auth[_0x8341('0xa')](),interaction[_0x8341('0x26')](_0x8341('0x27'),_0x8341('0x2b')),controller['update']);router[_0x8341('0x2a')]('/:id/custom_update',controller[_0x8341('0x2c')]);router[_0x8341('0x2a')](_0x8341('0x2d'),auth[_0x8341('0xf')](),controller['abandon']);router[_0x8341('0x2a')](_0x8341('0x2e'),controller[_0x8341('0x2f')]);router[_0x8341('0x30')]('/:id',auth[_0x8341('0xa')](),interaction[_0x8341('0x26')](_0x8341('0x27'),_0x8341('0x31')),controller[_0x8341('0x32')]);router[_0x8341('0x30')](_0x8341('0x25'),auth[_0x8341('0xa')](),controller[_0x8341('0x33')]);module[_0x8341('0x34')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index fd7d0bb..11e0d89 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 _0xd115=['INTEGER','sequelize','TEXT','medium','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd115,0x83));var _0x5d11=function(_0x280c4c,_0x4bf8b6){_0x280c4c=_0x280c4c-0x0;var _0x525c92=_0xd115[_0x280c4c];return _0x525c92;};'use strict';var Sequelize=require(_0x5d11('0x0'));module['exports']={'body':{'type':Sequelize[_0x5d11('0x1')](_0x5d11('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5d11('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5d11('0x4')]}}; \ No newline at end of file +var _0x05ae=['INTEGER','sequelize','exports','TEXT','BOOLEAN'];(function(_0x230e68,_0x1f7c7a){var _0x400304=function(_0x33a59a){while(--_0x33a59a){_0x230e68['push'](_0x230e68['shift']());}};_0x400304(++_0x1f7c7a);}(_0x05ae,0x15f));var _0xe05a=function(_0x488f05,_0x2f10e5){_0x488f05=_0x488f05-0x0;var _0x4b83f2=_0x05ae[_0x488f05];return _0x4b83f2;};'use strict';var Sequelize=require(_0xe05a('0x0'));module[_0xe05a('0x1')]={'body':{'type':Sequelize[_0xe05a('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe05a('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xe05a('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 7873744..8e62894 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 _0xa747=['FromId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','includeAll','ChatInternalMessage','findAll','rows','catch','show','include','find','create','update','body','params','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','length','push'];(function(_0x357681,_0x7447cc){var _0xa009ba=function(_0x28673a){while(--_0x28673a){_0x357681['push'](_0x357681['shift']());}};_0xa009ba(++_0x7447cc);}(_0xa747,0xe6));var _0x7a74=function(_0x1dfa47,_0x227d10){_0x1dfa47=_0x1dfa47-0x0;var _0x39a4df=_0xa747[_0x1dfa47];return _0x39a4df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a74('0x0'));var zipdir=require(_0x7a74('0x1'));var jsonpatch=require(_0x7a74('0x2'));var rp=require(_0x7a74('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7a74('0x4'));var util=require(_0x7a74('0x5'));var path=require(_0x7a74('0x6'));var sox=require('sox');var csv=require(_0x7a74('0x7'));var ejs=require(_0x7a74('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a74('0x9'));var squel=require(_0x7a74('0xa'));var crypto=require('crypto');var jsforce=require(_0x7a74('0xb'));var deskjs=require(_0x7a74('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7a74('0xd'));var Papa=require(_0x7a74('0xe'));var Redis=require(_0x7a74('0xf'));var authService=require(_0x7a74('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7a74('0x11'));var hardwareService=require(_0x7a74('0x12'));var logger=require(_0x7a74('0x13'))('api');var utils=require(_0x7a74('0x14'));var config=require(_0x7a74('0x15'));var licenseUtil=require(_0x7a74('0x16'));var db=require('../../mysqldb')['db'];config[_0x7a74('0x17')]=_[_0x7a74('0x18')](config[_0x7a74('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x7a74('0x19'))(new Redis(config[_0x7a74('0x17')]));require(_0x7a74('0x1a'))[_0x7a74('0x1b')](socket);function respondWithStatusCode(_0x36a10b,_0x35c6f6){_0x35c6f6=_0x35c6f6||0xcc;return function(_0x45137e){if(_0x45137e){return _0x36a10b[_0x7a74('0x1c')](_0x35c6f6);}return _0x36a10b[_0x7a74('0x1d')](_0x35c6f6)[_0x7a74('0x1e')]();};}function respondWithResult(_0x246f2f,_0x5f1a60){_0x5f1a60=_0x5f1a60||0xc8;return function(_0x3266c7){if(_0x3266c7){return _0x246f2f['status'](_0x5f1a60)[_0x7a74('0x1f')](_0x3266c7);}};}function respondWithFilteredResult(_0x2b9dc9,_0x54f284){return function(_0x47934e){if(_0x47934e){var _0x124412=typeof _0x54f284[_0x7a74('0x20')]===_0x7a74('0x21')&&typeof _0x54f284[_0x7a74('0x22')]===_0x7a74('0x21');var _0x121d44=_0x47934e['count'];var _0x594dbc=_0x124412?0x0:_0x54f284['offset'];var _0x5d6688=_0x124412?_0x47934e[_0x7a74('0x23')]:_0x54f284[_0x7a74('0x20')]+_0x54f284[_0x7a74('0x22')];var _0x4433c8;if(_0x5d6688>=_0x121d44){_0x5d6688=_0x121d44;_0x4433c8=0xc8;}else{_0x4433c8=0xce;}_0x2b9dc9[_0x7a74('0x1d')](_0x4433c8);return _0x2b9dc9[_0x7a74('0x24')](_0x7a74('0x25'),_0x594dbc+'-'+_0x5d6688+'/'+_0x121d44)[_0x7a74('0x1f')](_0x47934e);}return null;};}function patchUpdates(_0x14da3b){return function(_0x260872){try{jsonpatch[_0x7a74('0x26')](_0x260872,_0x14da3b,!![]);}catch(_0x499b0b){return BPromise['reject'](_0x499b0b);}return _0x260872[_0x7a74('0x27')]();};}function saveUpdates(_0xae306,_0x3627f7){return function(_0x2c6be8){if(_0x2c6be8){return _0x2c6be8['update'](_0xae306)['then'](function(_0x20f571){return _0x20f571;});}return null;};}function removeEntity(_0x3d702e,_0x9ac5b2){return function(_0x453f49){if(_0x453f49){return _0x453f49[_0x7a74('0x28')]()[_0x7a74('0x29')](function(){_0x3d702e['status'](0xcc)[_0x7a74('0x1e')]();});}};}function handleEntityNotFound(_0xce99ef,_0xc4f96f){return function(_0x58adc0){if(!_0x58adc0){_0xce99ef['sendStatus'](0x194);}return _0x58adc0;};}function handleError(_0x25db80,_0x376535){_0x376535=_0x376535||0x1f4;return function(_0x10e51b){logger[_0x7a74('0x2a')](_0x10e51b[_0x7a74('0x2b')]);if(_0x10e51b[_0x7a74('0x2c')]){delete _0x10e51b[_0x7a74('0x2c')];}_0x25db80[_0x7a74('0x1d')](_0x376535)[_0x7a74('0x2d')](_0x10e51b);};}exports[_0x7a74('0x2e')]=function(_0x3d9f15,_0x2a0413){var _0x24a896={},_0x2425ac={},_0x517f06={'count':0x0,'rows':[]};var _0x57bd57=_[_0x7a74('0x2f')](db['ChatInternalMessage'][_0x7a74('0x30')],function(_0x1ce78e){return{'name':_0x1ce78e[_0x7a74('0x31')],'type':_0x1ce78e[_0x7a74('0x32')]['key']};});_0x2425ac[_0x7a74('0x33')]=_[_0x7a74('0x2f')](_0x57bd57,'name');_0x2425ac[_0x7a74('0x34')]=_[_0x7a74('0x35')](_0x3d9f15[_0x7a74('0x34')]);_0x2425ac[_0x7a74('0x36')]=_[_0x7a74('0x37')](_0x2425ac[_0x7a74('0x33')],_0x2425ac['query']);_0x24a896[_0x7a74('0x38')]=_[_0x7a74('0x37')](_0x2425ac[_0x7a74('0x33')],qs[_0x7a74('0x39')](_0x3d9f15[_0x7a74('0x34')][_0x7a74('0x39')]));_0x24a896[_0x7a74('0x38')]=_0x24a896['attributes']['length']?_0x24a896[_0x7a74('0x38')]:_0x2425ac[_0x7a74('0x33')];if(!_0x3d9f15[_0x7a74('0x34')][_0x7a74('0x3a')](_0x7a74('0x3b'))){_0x24a896[_0x7a74('0x22')]=qs[_0x7a74('0x22')](_0x3d9f15[_0x7a74('0x34')][_0x7a74('0x22')]);_0x24a896[_0x7a74('0x20')]=qs[_0x7a74('0x20')](_0x3d9f15['query'][_0x7a74('0x20')]);}_0x24a896['order']=qs[_0x7a74('0x3c')](_0x3d9f15[_0x7a74('0x34')][_0x7a74('0x3c')]);_0x24a896['where']=qs['filters'](_['pick'](_0x3d9f15[_0x7a74('0x34')],_0x2425ac[_0x7a74('0x36')]),_0x57bd57);if(_0x3d9f15[_0x7a74('0x34')][_0x7a74('0x3d')]){_0x24a896[_0x7a74('0x3e')]=_['merge'](_0x24a896[_0x7a74('0x3e')],{'$or':_['map'](_0x57bd57,function(_0xa9822){if(_0xa9822[_0x7a74('0x32')]!==_0x7a74('0x3f')){var _0x1dd5a0={};_0x1dd5a0[_0xa9822[_0x7a74('0x2c')]]={'$like':'%'+_0x3d9f15[_0x7a74('0x34')][_0x7a74('0x3d')]+'%'};return _0x1dd5a0;}})});}_0x24a896=_[_0x7a74('0x40')]({},_0x24a896,_0x3d9f15[_0x7a74('0x41')]);var _0x316ba2={'where':_0x24a896[_0x7a74('0x3e')]};return db['ChatInternalMessage'][_0x7a74('0x23')](_0x316ba2)[_0x7a74('0x29')](function(_0x438148){_0x517f06[_0x7a74('0x23')]=_0x438148;if(_0x3d9f15['query'][_0x7a74('0x42')]){_0x24a896['include']=[{'all':!![]}];}return db[_0x7a74('0x43')][_0x7a74('0x44')](_0x24a896);})[_0x7a74('0x29')](function(_0x369df4){_0x517f06[_0x7a74('0x45')]=_0x369df4;return _0x517f06;})['then'](respondWithFilteredResult(_0x2a0413,_0x24a896))[_0x7a74('0x46')](handleError(_0x2a0413,null));};exports[_0x7a74('0x47')]=function(_0xd4432c,_0x2ed6f9){var _0x59dfd2={'raw':!![],'where':{'id':_0xd4432c['params']['id']}},_0x1ab441={};_0x1ab441['model']=_[_0x7a74('0x35')](db[_0x7a74('0x43')][_0x7a74('0x30')]);_0x1ab441['query']=_['keys'](_0xd4432c[_0x7a74('0x34')]);_0x1ab441[_0x7a74('0x36')]=_[_0x7a74('0x37')](_0x1ab441['model'],_0x1ab441[_0x7a74('0x34')]);_0x59dfd2[_0x7a74('0x38')]=_[_0x7a74('0x37')](_0x1ab441[_0x7a74('0x33')],qs[_0x7a74('0x39')](_0xd4432c[_0x7a74('0x34')][_0x7a74('0x39')]));_0x59dfd2[_0x7a74('0x38')]=_0x59dfd2[_0x7a74('0x38')]['length']?_0x59dfd2['attributes']:_0x1ab441[_0x7a74('0x33')];if(_0xd4432c[_0x7a74('0x34')]['includeAll']){_0x59dfd2[_0x7a74('0x48')]=[{'all':!![]}];}_0x59dfd2=_[_0x7a74('0x40')]({},_0x59dfd2,_0xd4432c[_0x7a74('0x41')]);return db[_0x7a74('0x43')][_0x7a74('0x49')](_0x59dfd2)[_0x7a74('0x29')](handleEntityNotFound(_0x2ed6f9,null))[_0x7a74('0x29')](respondWithResult(_0x2ed6f9,null))[_0x7a74('0x46')](handleError(_0x2ed6f9,null));};exports[_0x7a74('0x4a')]=function(_0x43c821,_0x24ba8c){return db[_0x7a74('0x43')][_0x7a74('0x4a')](_0x43c821['body'],{})[_0x7a74('0x29')](respondWithResult(_0x24ba8c,0xc9))[_0x7a74('0x46')](handleError(_0x24ba8c,null));};exports[_0x7a74('0x4b')]=function(_0x384b5c,_0x1da816){if(_0x384b5c[_0x7a74('0x4c')]['id']){delete _0x384b5c[_0x7a74('0x4c')]['id'];}return db[_0x7a74('0x43')]['find']({'where':{'id':_0x384b5c['params']['id']}})[_0x7a74('0x29')](handleEntityNotFound(_0x1da816,null))['then'](saveUpdates(_0x384b5c[_0x7a74('0x4c')],null))[_0x7a74('0x29')](respondWithResult(_0x1da816,null))[_0x7a74('0x46')](handleError(_0x1da816,null));};exports[_0x7a74('0x28')]=function(_0x2d5c8a,_0x26cae8){return db[_0x7a74('0x43')]['find']({'where':{'id':_0x2d5c8a[_0x7a74('0x4d')]['id']}})['then'](handleEntityNotFound(_0x26cae8,null))[_0x7a74('0x29')](removeEntity(_0x26cae8,null))['catch'](handleError(_0x26cae8,null));};exports[_0x7a74('0x4e')]=function(_0x5e843c,_0x287e18){return db[_0x7a74('0x43')]['describe']()[_0x7a74('0x29')](respondWithResult(_0x287e18,null))['catch'](handleError(_0x287e18,null));};function wrapUser(_0x3b1fae){return function(_0x19a0ce){var _0x5534ae=_0x3b1fae[_0x7a74('0x4f')]({'plain':!![]});_0x5534ae[_0x7a74('0x50')]=[];if(_0x19a0ce){_0x5534ae[_0x7a74('0x51')]=_0x19a0ce[_0x7a74('0x52')];_0x5534ae[_0x7a74('0x53')]=_0x19a0ce;}else{_0x5534ae[_0x7a74('0x51')]=moment(0x0)[_0x7a74('0x54')](_0x7a74('0x55'));_0x5534ae[_0x7a74('0x53')]={};}return _0x5534ae;};}exports[_0x7a74('0x56')]=function(_0x3cb0ef,_0x315e1d,_0x54357f){var _0x5687e9=[];return db[_0x7a74('0x57')][_0x7a74('0x44')]({'where':{'role':[_0x7a74('0x58'),_0x7a74('0x59'),_0x7a74('0x5a')]},'attributes':['id',_0x7a74('0x5b'),_0x7a74('0x2c'),'role',_0x7a74('0x5c'),_0x7a74('0x5d'),_0x7a74('0x5e'),_0x7a74('0x5f'),_0x7a74('0x60'),_0x7a74('0x61')],'order':qs['sort']('-online'),'include':[{'model':db['VoiceQueue'],'as':_0x7a74('0x62'),'attributes':['id',_0x7a74('0x2c'),_0x7a74('0x32')],'through':{'attributes':[]}}]})[_0x7a74('0x29')](function(_0x41ecaa){if(_0x41ecaa){var _0x1645ef=_0x3cb0ef[_0x7a74('0x5a')][_0x7a74('0x4f')]({'plain':!![]});if(!_0x1645ef)throw new Error(_0x7a74('0x63'));if(_0x1645ef[_0x7a74('0x64')]===_0x7a74('0x5a')){return db[_0x7a74('0x65')][_0x7a74('0x49')]({'where':{'name':_0x7a74('0x66'),'userProfileId':_0x1645ef[_0x7a74('0x67')]},'raw':!![]})[_0x7a74('0x29')](function(_0x17e239){if(_0x17e239){if(_0x17e239[_0x7a74('0x68')]===0x0){return db[_0x7a74('0x69')]['findAll']({'where':{'sectionId':_0x17e239['id']},'raw':!![]})[_0x7a74('0x29')](function(_0x3bf624){var _0x2c5fab=[];if(_[_0x7a74('0x6a')](_0x3bf624)){_0x2c5fab=_[_0x7a74('0x3d')](_0x41ecaa,function(_0x38a07b){if(_0x38a07b[_0x7a74('0x64')]!==_0x7a74('0x58')){return _0x38a07b;}});return _0x2c5fab;}else{for(var _0x33df4b=0x0;_0x33df4b<_0x41ecaa[_0x7a74('0x6b')];_0x33df4b++){var _0x9fd9c1=_0x41ecaa[_0x33df4b];if(_0x9fd9c1['role']===_0x7a74('0x58')){var _0x22f2bf=_[_0x7a74('0x49')](_0x3bf624,function(_0x1e62d4){return _0x1e62d4['resourceId']===_0x9fd9c1['id'];});if(_0x22f2bf)_0x2c5fab['push'](_0x9fd9c1);}else{_0x2c5fab['push'](_0x9fd9c1);}}return _0x2c5fab;}});}else{return _0x41ecaa;}}else{var _0x1b60fd=_[_0x7a74('0x3d')](_0x41ecaa,function(_0x498989){if(_0x498989['role']!==_0x7a74('0x58')){return _0x498989;}});return _0x1b60fd;}});}else{return _0x41ecaa;}}})['then'](function(_0x69d50e){var _0x5c9e9e=[];if(_0x69d50e){_0x5687e9=_0x69d50e;for(var _0x173aa6=0x0;_0x173aa6<_0x69d50e[_0x7a74('0x6b')];_0x173aa6+=0x1){_0x5687e9[_0x173aa6][_0x7a74('0x50')]=[];_0x5c9e9e[_0x7a74('0x6c')](db[_0x7a74('0x43')][_0x7a74('0x49')]({'where':{'FromId':[_0x3cb0ef[_0x7a74('0x5a')]['id'],_0x69d50e[_0x173aa6]['id']],'ToId':[_0x3cb0ef[_0x7a74('0x5a')]['id'],_0x69d50e[_0x173aa6]['id']],'ChatGroupId':null},'attributes':['id',_0x7a74('0x52'),_0x7a74('0x6d'),'ToId',_0x7a74('0x6e'),_0x7a74('0x4c')],'order':qs[_0x7a74('0x3c')](_0x7a74('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7a74('0x29')](wrapUser(_0x69d50e[_0x173aa6])));}return BPromise[_0x7a74('0x70')](_0x5c9e9e);}return[];})['then'](function(_0x492072){return{'rows':_0x492072,'count':_0x492072['length']};})[_0x7a74('0x29')](respondWithResult(_0x315e1d,null))[_0x7a74('0x46')](handleError(_0x315e1d,null));}; \ No newline at end of file +var _0x71a8=['../../config/license/util','../../mysqldb','redis','localhost','./chatInternalMessage.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','options','includeAll','findAll','rows','catch','show','params','merge','find','create','body','describe','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x32cb9e,_0x5aad6f){var _0x2eef34=function(_0x3228d4){while(--_0x3228d4){_0x32cb9e['push'](_0x32cb9e['shift']());}};_0x2eef34(++_0x5aad6f);}(_0x71a8,0x12b));var _0x871a=function(_0x5c820b,_0x51fb10){_0x5c820b=_0x5c820b-0x0;var _0x2d63b2=_0x71a8[_0x5c820b];return _0x2d63b2;};'use strict';var emlformat=require(_0x871a('0x0'));var rimraf=require(_0x871a('0x1'));var zipdir=require(_0x871a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x871a('0x3'));var BPromise=require(_0x871a('0x4'));var Mustache=require(_0x871a('0x5'));var util=require(_0x871a('0x6'));var path=require(_0x871a('0x7'));var sox=require(_0x871a('0x8'));var csv=require(_0x871a('0x9'));var ejs=require(_0x871a('0xa'));var fs=require('fs');var fs_extra=require(_0x871a('0xb'));var _=require(_0x871a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x871a('0xd'));var deskjs=require(_0x871a('0xe'));var toCsv=require(_0x871a('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x871a('0xf'));var authService=require(_0x871a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x871a('0x11'));var hardwareService=require(_0x871a('0x12'));var logger=require('../../config/logger')(_0x871a('0x13'));var utils=require(_0x871a('0x14'));var config=require(_0x871a('0x15'));var licenseUtil=require(_0x871a('0x16'));var db=require(_0x871a('0x17'))['db'];config[_0x871a('0x18')]=_['defaults'](config[_0x871a('0x18')],{'host':_0x871a('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x871a('0x18')]));require(_0x871a('0x1a'))[_0x871a('0x1b')](socket);function respondWithStatusCode(_0x4b39f4,_0x3a576a){_0x3a576a=_0x3a576a||0xcc;return function(_0x3819c8){if(_0x3819c8){return _0x4b39f4['sendStatus'](_0x3a576a);}return _0x4b39f4['status'](_0x3a576a)['end']();};}function respondWithResult(_0x269349,_0xb717f1){_0xb717f1=_0xb717f1||0xc8;return function(_0x4b0263){if(_0x4b0263){return _0x269349[_0x871a('0x1c')](_0xb717f1)[_0x871a('0x1d')](_0x4b0263);}};}function respondWithFilteredResult(_0x96954c,_0x31e80d){return function(_0x276254){if(_0x276254){var _0x6f6fdc=typeof _0x31e80d[_0x871a('0x1e')]===_0x871a('0x1f')&&typeof _0x31e80d[_0x871a('0x20')]===_0x871a('0x1f');var _0x523e51=_0x276254['count'];var _0x1b5f42=_0x6f6fdc?0x0:_0x31e80d[_0x871a('0x1e')];var _0x7cf9b0=_0x6f6fdc?_0x276254[_0x871a('0x21')]:_0x31e80d[_0x871a('0x1e')]+_0x31e80d[_0x871a('0x20')];var _0x247299;if(_0x7cf9b0>=_0x523e51){_0x7cf9b0=_0x523e51;_0x247299=0xc8;}else{_0x247299=0xce;}_0x96954c['status'](_0x247299);return _0x96954c[_0x871a('0x22')](_0x871a('0x23'),_0x1b5f42+'-'+_0x7cf9b0+'/'+_0x523e51)[_0x871a('0x1d')](_0x276254);}return null;};}function patchUpdates(_0x54f109){return function(_0x5dd97f){try{jsonpatch['apply'](_0x5dd97f,_0x54f109,!![]);}catch(_0x67ae71){return BPromise['reject'](_0x67ae71);}return _0x5dd97f[_0x871a('0x24')]();};}function saveUpdates(_0x46a35f,_0x23796f){return function(_0x3b4f01){if(_0x3b4f01){return _0x3b4f01[_0x871a('0x25')](_0x46a35f)[_0x871a('0x26')](function(_0x2aa750){return _0x2aa750;});}return null;};}function removeEntity(_0x47ed9b,_0x16cd6b){return function(_0x244f8f){if(_0x244f8f){return _0x244f8f[_0x871a('0x27')]()['then'](function(){_0x47ed9b[_0x871a('0x1c')](0xcc)[_0x871a('0x28')]();});}};}function handleEntityNotFound(_0x3c710a,_0x3b967c){return function(_0x46c382){if(!_0x46c382){_0x3c710a['sendStatus'](0x194);}return _0x46c382;};}function handleError(_0x1b3e81,_0x347cfe){_0x347cfe=_0x347cfe||0x1f4;return function(_0x47aa6d){logger['error'](_0x47aa6d[_0x871a('0x29')]);if(_0x47aa6d[_0x871a('0x2a')]){delete _0x47aa6d[_0x871a('0x2a')];}_0x1b3e81[_0x871a('0x1c')](_0x347cfe)[_0x871a('0x2b')](_0x47aa6d);};}exports[_0x871a('0x2c')]=function(_0x3c3f1e,_0x476803){var _0x27ec58={},_0x46a8b5={},_0x34ceda={'count':0x0,'rows':[]};var _0x455f64=_[_0x871a('0x2d')](db[_0x871a('0x2e')][_0x871a('0x2f')],function(_0x11432a){return{'name':_0x11432a[_0x871a('0x30')],'type':_0x11432a[_0x871a('0x31')][_0x871a('0x32')]};});_0x46a8b5['model']=_['map'](_0x455f64,'name');_0x46a8b5[_0x871a('0x33')]=_[_0x871a('0x34')](_0x3c3f1e[_0x871a('0x33')]);_0x46a8b5[_0x871a('0x35')]=_[_0x871a('0x36')](_0x46a8b5[_0x871a('0x37')],_0x46a8b5['query']);_0x27ec58[_0x871a('0x38')]=_[_0x871a('0x36')](_0x46a8b5['model'],qs[_0x871a('0x39')](_0x3c3f1e['query'][_0x871a('0x39')]));_0x27ec58[_0x871a('0x38')]=_0x27ec58[_0x871a('0x38')][_0x871a('0x3a')]?_0x27ec58['attributes']:_0x46a8b5[_0x871a('0x37')];if(!_0x3c3f1e[_0x871a('0x33')][_0x871a('0x3b')]('nolimit')){_0x27ec58[_0x871a('0x20')]=qs['limit'](_0x3c3f1e['query'][_0x871a('0x20')]);_0x27ec58[_0x871a('0x1e')]=qs[_0x871a('0x1e')](_0x3c3f1e[_0x871a('0x33')][_0x871a('0x1e')]);}_0x27ec58[_0x871a('0x3c')]=qs[_0x871a('0x3d')](_0x3c3f1e[_0x871a('0x33')][_0x871a('0x3d')]);_0x27ec58[_0x871a('0x3e')]=qs['filters'](_['pick'](_0x3c3f1e['query'],_0x46a8b5[_0x871a('0x35')]),_0x455f64);if(_0x3c3f1e[_0x871a('0x33')][_0x871a('0x3f')]){_0x27ec58[_0x871a('0x3e')]=_['merge'](_0x27ec58['where'],{'$or':_[_0x871a('0x2d')](_0x455f64,function(_0x86c988){if(_0x86c988[_0x871a('0x31')]!=='VIRTUAL'){var _0x25299e={};_0x25299e[_0x86c988['name']]={'$like':'%'+_0x3c3f1e['query'][_0x871a('0x3f')]+'%'};return _0x25299e;}})});}_0x27ec58=_['merge']({},_0x27ec58,_0x3c3f1e[_0x871a('0x40')]);var _0x54db09={'where':_0x27ec58[_0x871a('0x3e')]};return db[_0x871a('0x2e')][_0x871a('0x21')](_0x54db09)[_0x871a('0x26')](function(_0x2597cf){_0x34ceda[_0x871a('0x21')]=_0x2597cf;if(_0x3c3f1e[_0x871a('0x33')][_0x871a('0x41')]){_0x27ec58['include']=[{'all':!![]}];}return db[_0x871a('0x2e')][_0x871a('0x42')](_0x27ec58);})[_0x871a('0x26')](function(_0x54b064){_0x34ceda[_0x871a('0x43')]=_0x54b064;return _0x34ceda;})[_0x871a('0x26')](respondWithFilteredResult(_0x476803,_0x27ec58))[_0x871a('0x44')](handleError(_0x476803,null));};exports[_0x871a('0x45')]=function(_0x522956,_0xca91ce){var _0x51a05e={'raw':!![],'where':{'id':_0x522956[_0x871a('0x46')]['id']}},_0xac97f4={};_0xac97f4[_0x871a('0x37')]=_[_0x871a('0x34')](db[_0x871a('0x2e')][_0x871a('0x2f')]);_0xac97f4['query']=_[_0x871a('0x34')](_0x522956[_0x871a('0x33')]);_0xac97f4['filters']=_[_0x871a('0x36')](_0xac97f4[_0x871a('0x37')],_0xac97f4[_0x871a('0x33')]);_0x51a05e[_0x871a('0x38')]=_[_0x871a('0x36')](_0xac97f4[_0x871a('0x37')],qs[_0x871a('0x39')](_0x522956[_0x871a('0x33')][_0x871a('0x39')]));_0x51a05e['attributes']=_0x51a05e[_0x871a('0x38')][_0x871a('0x3a')]?_0x51a05e['attributes']:_0xac97f4[_0x871a('0x37')];if(_0x522956['query'][_0x871a('0x41')]){_0x51a05e['include']=[{'all':!![]}];}_0x51a05e=_[_0x871a('0x47')]({},_0x51a05e,_0x522956[_0x871a('0x40')]);return db['ChatInternalMessage'][_0x871a('0x48')](_0x51a05e)[_0x871a('0x26')](handleEntityNotFound(_0xca91ce,null))[_0x871a('0x26')](respondWithResult(_0xca91ce,null))[_0x871a('0x44')](handleError(_0xca91ce,null));};exports[_0x871a('0x49')]=function(_0x1d20ef,_0xa75492){return db[_0x871a('0x2e')][_0x871a('0x49')](_0x1d20ef[_0x871a('0x4a')],{})[_0x871a('0x26')](respondWithResult(_0xa75492,0xc9))['catch'](handleError(_0xa75492,null));};exports['update']=function(_0x4bb727,_0x5ea43e){if(_0x4bb727['body']['id']){delete _0x4bb727[_0x871a('0x4a')]['id'];}return db[_0x871a('0x2e')][_0x871a('0x48')]({'where':{'id':_0x4bb727['params']['id']}})[_0x871a('0x26')](handleEntityNotFound(_0x5ea43e,null))[_0x871a('0x26')](saveUpdates(_0x4bb727[_0x871a('0x4a')],null))[_0x871a('0x26')](respondWithResult(_0x5ea43e,null))[_0x871a('0x44')](handleError(_0x5ea43e,null));};exports['destroy']=function(_0x52dca3,_0x50104e){return db[_0x871a('0x2e')][_0x871a('0x48')]({'where':{'id':_0x52dca3['params']['id']}})[_0x871a('0x26')](handleEntityNotFound(_0x50104e,null))[_0x871a('0x26')](removeEntity(_0x50104e,null))[_0x871a('0x44')](handleError(_0x50104e,null));};exports['describe']=function(_0x491c7f,_0x52c5ad){return db[_0x871a('0x2e')][_0x871a('0x4b')]()[_0x871a('0x26')](respondWithResult(_0x52c5ad,null))[_0x871a('0x44')](handleError(_0x52c5ad,null));};function wrapUser(_0x2af81a){return function(_0x2e8405){var _0x52bb8a=_0x2af81a['get']({'plain':!![]});_0x52bb8a['messages']=[];if(_0x2e8405){_0x52bb8a['lastMessageAt']=_0x2e8405[_0x871a('0x4c')];_0x52bb8a[_0x871a('0x4d')]=_0x2e8405;}else{_0x52bb8a[_0x871a('0x4e')]=moment(0x0)[_0x871a('0x4f')](_0x871a('0x50'));_0x52bb8a[_0x871a('0x4d')]={};}return _0x52bb8a;};}exports[_0x871a('0x51')]=function(_0x293eff,_0x2e85ca,_0x46cbe1){var _0x939f50=[];return db[_0x871a('0x52')]['findAll']({'where':{'role':[_0x871a('0x53'),_0x871a('0x54'),_0x871a('0x55')]},'attributes':['id',_0x871a('0x56'),_0x871a('0x2a'),_0x871a('0x57'),_0x871a('0x58'),_0x871a('0x59'),_0x871a('0x5a'),_0x871a('0x5b'),_0x871a('0x5c'),_0x871a('0x5d')],'order':qs[_0x871a('0x3d')]('-online'),'include':[{'model':db['VoiceQueue'],'as':_0x871a('0x5e'),'attributes':['id',_0x871a('0x2a'),_0x871a('0x31')],'through':{'attributes':[]}}]})[_0x871a('0x26')](function(_0x5b3f1c){if(_0x5b3f1c){var _0x3fea0b=_0x293eff['user']['get']({'plain':!![]});if(!_0x3fea0b)throw new Error(_0x871a('0x5f'));if(_0x3fea0b[_0x871a('0x57')]===_0x871a('0x55')){return db['UserProfileSection'][_0x871a('0x48')]({'where':{'name':_0x871a('0x60'),'userProfileId':_0x3fea0b[_0x871a('0x61')]},'raw':!![]})['then'](function(_0x44ac41){if(_0x44ac41){if(_0x44ac41[_0x871a('0x62')]===0x0){return db[_0x871a('0x63')][_0x871a('0x42')]({'where':{'sectionId':_0x44ac41['id']},'raw':!![]})['then'](function(_0x441d6f){var _0xfab92a=[];if(_['isEmpty'](_0x441d6f)){_0xfab92a=_['filter'](_0x5b3f1c,function(_0x3d92c3){if(_0x3d92c3[_0x871a('0x57')]!==_0x871a('0x53')){return _0x3d92c3;}});return _0xfab92a;}else{for(var _0x2e500b=0x0;_0x2e500b<_0x5b3f1c[_0x871a('0x3a')];_0x2e500b++){var _0x46ab00=_0x5b3f1c[_0x2e500b];if(_0x46ab00[_0x871a('0x57')]===_0x871a('0x53')){var _0x856d92=_[_0x871a('0x48')](_0x441d6f,function(_0x8eb3ec){return _0x8eb3ec[_0x871a('0x64')]===_0x46ab00['id'];});if(_0x856d92)_0xfab92a[_0x871a('0x65')](_0x46ab00);}else{_0xfab92a['push'](_0x46ab00);}}return _0xfab92a;}});}else{return _0x5b3f1c;}}else{var _0x209d8e=_[_0x871a('0x3f')](_0x5b3f1c,function(_0x2e071f){if(_0x2e071f[_0x871a('0x57')]!==_0x871a('0x53')){return _0x2e071f;}});return _0x209d8e;}});}else{return _0x5b3f1c;}}})['then'](function(_0x383c3c){var _0x432cdf=[];if(_0x383c3c){_0x939f50=_0x383c3c;for(var _0x4f0310=0x0;_0x4f0310<_0x383c3c[_0x871a('0x3a')];_0x4f0310+=0x1){_0x939f50[_0x4f0310]['messages']=[];_0x432cdf[_0x871a('0x65')](db[_0x871a('0x2e')][_0x871a('0x48')]({'where':{'FromId':[_0x293eff['user']['id'],_0x383c3c[_0x4f0310]['id']],'ToId':[_0x293eff[_0x871a('0x55')]['id'],_0x383c3c[_0x4f0310]['id']],'ChatGroupId':null},'attributes':['id',_0x871a('0x4c'),_0x871a('0x66'),_0x871a('0x67'),_0x871a('0x68'),'body'],'order':qs[_0x871a('0x3d')](_0x871a('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x871a('0x26')](wrapUser(_0x383c3c[_0x4f0310])));}return BPromise[_0x871a('0x6a')](_0x432cdf);}return[];})[_0x871a('0x26')](function(_0x1a8ec1){return{'rows':_0x1a8ec1,'count':_0x1a8ec1[_0x871a('0x3a')]};})[_0x871a('0x26')](respondWithResult(_0x2e85ca,null))[_0x871a('0x44')](handleError(_0x2e85ca,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 8767498..a2aeb92 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 _0x7cfd=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5e70b6,_0x4bd147){var _0x1c33cb=function(_0x2ef898){while(--_0x2ef898){_0x5e70b6['push'](_0x5e70b6['shift']());}};_0x1c33cb(++_0x4bd147);}(_0x7cfd,0x10e));var _0xd7cf=function(_0x5c9e7b,_0x1f38d5){_0x5c9e7b=_0x5c9e7b-0x0;var _0x1a4936=_0x7cfd[_0x5c9e7b];return _0x1a4936;};'use strict';var EventEmitter=require(_0xd7cf('0x0'));var ChatInternalMessage=require(_0xd7cf('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd7cf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd7cf('0x3')};function emitEvent(_0x45c0a9){return function(_0x1b8ec7,_0x16946b,_0x59eb8b){ChatInternalMessageEvents[_0xd7cf('0x4')](_0x45c0a9+':'+_0x1b8ec7['id'],_0x1b8ec7);ChatInternalMessageEvents['emit'](_0x45c0a9,_0x1b8ec7);_0x59eb8b(null);};}for(var e in events){if(events[_0xd7cf('0x5')](e)){var event=events[e];ChatInternalMessage[_0xd7cf('0x6')](e,emitEvent(event));}}module[_0xd7cf('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x3d64=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x2436fd,_0x5539d0){var _0x135213=function(_0x3e7cfa){while(--_0x3e7cfa){_0x2436fd['push'](_0x2436fd['shift']());}};_0x135213(++_0x5539d0);}(_0x3d64,0xf8));var _0x43d6=function(_0x48459a,_0x4773ff){_0x48459a=_0x48459a-0x0;var _0x31e404=_0x3d64[_0x48459a];return _0x31e404;};'use strict';var EventEmitter=require(_0x43d6('0x0'));var ChatInternalMessage=require(_0x43d6('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x43d6('0x2')](0x0);var events={'afterCreate':_0x43d6('0x3'),'afterUpdate':'update','afterDestroy':_0x43d6('0x4')};function emitEvent(_0x35cda7){return function(_0x3a624f,_0x3e014b,_0x26768c){ChatInternalMessageEvents[_0x43d6('0x5')](_0x35cda7+':'+_0x3a624f['id'],_0x3a624f);ChatInternalMessageEvents['emit'](_0x35cda7,_0x3a624f);_0x26768c(null);};}for(var e in events){if(events[_0x43d6('0x6')](e)){var event=events[e];ChatInternalMessage[_0x43d6('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index c542f47..0a10570 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 _0x6d86=['moment','bluebird','request-promise','rimraf','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x6d86,0xfb));var _0x66d8=function(_0x48703a,_0x53d4ef){_0x48703a=_0x48703a-0x0;var _0x4e9e36=_0x6d86[_0x48703a];return _0x4e9e36;};'use strict';var _=require('lodash');var util=require(_0x66d8('0x0'));var logger=require(_0x66d8('0x1'))('api');var moment=require(_0x66d8('0x2'));var BPromise=require(_0x66d8('0x3'));var rp=require(_0x66d8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x66d8('0x5'));var config=require('../../config/environment');var attributes=require(_0x66d8('0x6'));module[_0x66d8('0x7')]=function(_0xe9daa8,_0x572eb1){return _0xe9daa8['define'](_0x66d8('0x8'),attributes,{'tableName':_0x66d8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x66d8('0xa')});}; \ No newline at end of file +var _0x6278=['lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x6278,0xbb));var _0x8627=function(_0x27eda0,_0x42a3cf){_0x27eda0=_0x27eda0-0x0;var _0x2b63a5=_0x6278[_0x27eda0];return _0x2b63a5;};'use strict';var _=require(_0x8627('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8627('0x1'));var BPromise=require(_0x8627('0x2'));var rp=require(_0x8627('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8627('0x4'));var config=require(_0x8627('0x5'));var attributes=require(_0x8627('0x6'));module['exports']=function(_0x4d5784,_0x41a119){return _0x4d5784[_0x8627('0x7')]('ChatInternalMessage',attributes,{'tableName':_0x8627('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8627('0x9'),'collate':_0x8627('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 972879d..f06579a 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 _0x0a09=['redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInternalMessage,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x90aac9,_0x1caf1f){var _0x5b0665=function(_0xcc2179){while(--_0xcc2179){_0x90aac9['push'](_0x90aac9['shift']());}};_0x5b0665(++_0x1caf1f);}(_0x0a09,0x1ed));var _0x90a0=function(_0x4f1da5,_0x4ced17){_0x4f1da5=_0x4f1da5-0x0;var _0xe972a8=_0x0a09[_0x4f1da5];return _0xe972a8;};'use strict';var _=require(_0x90a0('0x0'));var util=require(_0x90a0('0x1'));var moment=require(_0x90a0('0x2'));var BPromise=require(_0x90a0('0x3'));var rs=require(_0x90a0('0x4'));var fs=require('fs');var Redis=require(_0x90a0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x90a0('0x6'));var logger=require('../../config/logger')(_0x90a0('0x7'));var config=require(_0x90a0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x90a0('0x9')][_0x90a0('0xa')]({'port':0x232a});config[_0x90a0('0xb')]=_[_0x90a0('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x90a0('0xd'))(new Redis(config[_0x90a0('0xb')]));require(_0x90a0('0xe'))[_0x90a0('0xf')](socket);function respondWithRpcPromise(_0x9d3f7c,_0x3143c9,_0x9f55e9){return new BPromise(function(_0x260df6,_0x2c113c){return client['request'](_0x9d3f7c,_0x9f55e9)[_0x90a0('0x10')](function(_0x26de29){logger[_0x90a0('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x3143c9,_0x90a0('0x12'));logger[_0x90a0('0x13')](_0x90a0('0x14'),_0x3143c9,_0x90a0('0x12'),JSON[_0x90a0('0x15')](_0x26de29));if(_0x26de29[_0x90a0('0x16')]){if(_0x26de29['error'][_0x90a0('0x17')]===0x1f4){logger[_0x90a0('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x3143c9,_0x26de29[_0x90a0('0x16')]['message']);return _0x2c113c(_0x26de29['error'][_0x90a0('0x18')]);}logger[_0x90a0('0x16')](_0x90a0('0x19'),_0x3143c9,_0x26de29[_0x90a0('0x16')]['message']);return _0x260df6(_0x26de29[_0x90a0('0x16')][_0x90a0('0x18')]);}else{logger[_0x90a0('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x3143c9,_0x90a0('0x12'));_0x260df6(_0x26de29[_0x90a0('0x1a')]['message']);}})[_0x90a0('0x1b')](function(_0x6f659a){logger[_0x90a0('0x16')](_0x90a0('0x19'),_0x3143c9,_0x6f659a);_0x2c113c(_0x6f659a);});});} \ No newline at end of file +var _0x0734=['../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','ChatInternalMessage,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x16c1d2,_0x1a607d){var _0x4f2fc2=function(_0xe2929c){while(--_0xe2929c){_0x16c1d2['push'](_0x16c1d2['shift']());}};_0x4f2fc2(++_0x1a607d);}(_0x0734,0xba));var _0x4073=function(_0x145e8a,_0x37d65e){_0x145e8a=_0x145e8a-0x0;var _0x25bc0e=_0x0734[_0x145e8a];return _0x25bc0e;};'use strict';var _=require(_0x4073('0x0'));var util=require(_0x4073('0x1'));var moment=require(_0x4073('0x2'));var BPromise=require(_0x4073('0x3'));var rs=require(_0x4073('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4073('0x5'))['db'];var utils=require(_0x4073('0x6'));var logger=require(_0x4073('0x7'))(_0x4073('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4073('0x9')]['http']({'port':0x232a});config[_0x4073('0xa')]=_[_0x4073('0xb')](config[_0x4073('0xa')],{'host':_0x4073('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4073('0xa')]));require('./chatInternalMessage.socket')[_0x4073('0xd')](socket);function respondWithRpcPromise(_0x3d11b0,_0x2bc6de,_0x35242b){return new BPromise(function(_0x48d485,_0x4f79c6){return client[_0x4073('0xe')](_0x3d11b0,_0x35242b)[_0x4073('0xf')](function(_0x5dc902){logger[_0x4073('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x2bc6de,_0x4073('0x11'));logger[_0x4073('0x12')](_0x4073('0x13'),_0x2bc6de,_0x4073('0x11'),JSON['stringify'](_0x5dc902));if(_0x5dc902[_0x4073('0x14')]){if(_0x5dc902[_0x4073('0x14')]['code']===0x1f4){logger[_0x4073('0x14')](_0x4073('0x15'),_0x2bc6de,_0x5dc902[_0x4073('0x14')][_0x4073('0x16')]);return _0x4f79c6(_0x5dc902[_0x4073('0x14')][_0x4073('0x16')]);}logger['error'](_0x4073('0x15'),_0x2bc6de,_0x5dc902['error'][_0x4073('0x16')]);return _0x48d485(_0x5dc902[_0x4073('0x14')]['message']);}else{logger[_0x4073('0x10')](_0x4073('0x15'),_0x2bc6de,_0x4073('0x11'));_0x48d485(_0x5dc902['result'][_0x4073('0x16')]);}})[_0x4073('0x17')](function(_0x520eea){logger['error'](_0x4073('0x15'),_0x2bc6de,_0x520eea);_0x4f79c6(_0x520eea);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index ee9d3f6..99f40a3 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 _0xe1d9=['length','./chatInternalMessage.events','save','remove','update','register'];(function(_0x40c9dc,_0x40fd93){var _0x242ea5=function(_0x389ec6){while(--_0x389ec6){_0x40c9dc['push'](_0x40c9dc['shift']());}};_0x242ea5(++_0x40fd93);}(_0xe1d9,0xf7));var _0x9e1d=function(_0x4e877f,_0x548d48){_0x4e877f=_0x4e877f-0x0;var _0x4718c1=_0xe1d9[_0x4e877f];return _0x4718c1;};'use strict';var ChatInternalMessageEvents=require(_0x9e1d('0x0'));var events=[_0x9e1d('0x1'),_0x9e1d('0x2'),_0x9e1d('0x3')];function createListener(_0x502b84,_0x81bc47){return function(_0x947468){_0x81bc47['emit'](_0x502b84,_0x947468);};}function removeListener(_0x1f8145,_0x57a85c){return function(){ChatInternalMessageEvents['removeListener'](_0x1f8145,_0x57a85c);};}exports[_0x9e1d('0x4')]=function(_0x58da79){for(var _0x3c4ff1=0x0,_0x1e77d6=events[_0x9e1d('0x5')];_0x3c4ff1<_0x1e77d6;_0x3c4ff1++){var _0x915e7b=events[_0x3c4ff1];var _0x105a8f=createListener('chatInternalMessage:'+_0x915e7b,_0x58da79);ChatInternalMessageEvents['on'](_0x915e7b,_0x105a8f);}}; \ No newline at end of file +var _0x49bb=['./chatInternalMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x811152,_0x984bb){var _0x99a968=function(_0x38c3f7){while(--_0x38c3f7){_0x811152['push'](_0x811152['shift']());}};_0x99a968(++_0x984bb);}(_0x49bb,0xd8));var _0xb49b=function(_0x98e33b,_0x29f5fb){_0x98e33b=_0x98e33b-0x0;var _0x4d52be=_0x49bb[_0x98e33b];return _0x4d52be;};'use strict';var ChatInternalMessageEvents=require(_0xb49b('0x0'));var events=[_0xb49b('0x1'),_0xb49b('0x2'),_0xb49b('0x3')];function createListener(_0x3d255b,_0x590ff5){return function(_0x5b0cea){_0x590ff5[_0xb49b('0x4')](_0x3d255b,_0x5b0cea);};}function removeListener(_0x2ebd01,_0x3e0a91){return function(){ChatInternalMessageEvents[_0xb49b('0x5')](_0x2ebd01,_0x3e0a91);};}exports[_0xb49b('0x6')]=function(_0x5ccd75){for(var _0x59dcce=0x0,_0x5dace4=events[_0xb49b('0x7')];_0x59dcce<_0x5dace4;_0x59dcce++){var _0x52c8be=events[_0x59dcce];var _0x5cce4b=createListener('chatInternalMessage:'+_0x52c8be,_0x5ccd75);ChatInternalMessageEvents['on'](_0x52c8be,_0x5cce4b);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 51b6ec7..bcd1512 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 _0x8d6b=['index','/describe','/users','getUsers','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated'];(function(_0x1d5a10,_0x76b262){var _0x561067=function(_0x1d6da9){while(--_0x1d6da9){_0x1d5a10['push'](_0x1d5a10['shift']());}};_0x561067(++_0x76b262);}(_0x8d6b,0x1aa));var _0xb8d6=function(_0x3730b3,_0x5b3c63){_0x3730b3=_0x3730b3-0x0;var _0x4f1b23=_0x8d6b[_0x3730b3];return _0x4f1b23;};'use strict';var multer=require(_0xb8d6('0x0'));var util=require(_0xb8d6('0x1'));var path=require(_0xb8d6('0x2'));var timeout=require('connect-timeout');var express=require(_0xb8d6('0x3'));var router=express[_0xb8d6('0x4')]();var fs_extra=require(_0xb8d6('0x5'));var auth=require(_0xb8d6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb8d6('0x7'));var controller=require(_0xb8d6('0x8'));router[_0xb8d6('0x9')]('/',auth[_0xb8d6('0xa')](),controller[_0xb8d6('0xb')]);router[_0xb8d6('0x9')](_0xb8d6('0xc'),auth[_0xb8d6('0xa')](),controller['describe']);router[_0xb8d6('0x9')](_0xb8d6('0xd'),auth[_0xb8d6('0xa')](),controller[_0xb8d6('0xe')]);router[_0xb8d6('0x9')](_0xb8d6('0xf'),auth[_0xb8d6('0xa')](),controller['show']);router[_0xb8d6('0x10')]('/',auth['isAuthenticated'](),controller[_0xb8d6('0x11')]);router[_0xb8d6('0x12')](_0xb8d6('0xf'),controller[_0xb8d6('0x13')]);router[_0xb8d6('0x14')](_0xb8d6('0xf'),auth[_0xb8d6('0xa')](),controller[_0xb8d6('0x15')]);module[_0xb8d6('0x16')]=router; \ No newline at end of file +var _0xd24c=['update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','/describe','get','/users','/:id','show','create','put'];(function(_0x44cf47,_0x26aed9){var _0x36d3d0=function(_0x500de1){while(--_0x500de1){_0x44cf47['push'](_0x44cf47['shift']());}};_0x36d3d0(++_0x26aed9);}(_0xd24c,0xae));var _0xcd24=function(_0x1e8664,_0x3d547b){_0x1e8664=_0x1e8664-0x0;var _0x51f990=_0xd24c[_0x1e8664];return _0x51f990;};'use strict';var multer=require(_0xcd24('0x0'));var util=require('util');var path=require(_0xcd24('0x1'));var timeout=require(_0xcd24('0x2'));var express=require(_0xcd24('0x3'));var router=express[_0xcd24('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcd24('0x5'));var config=require(_0xcd24('0x6'));var controller=require(_0xcd24('0x7'));router['get']('/',auth[_0xcd24('0x8')](),controller['index']);router['get'](_0xcd24('0x9'),auth[_0xcd24('0x8')](),controller['describe']);router[_0xcd24('0xa')](_0xcd24('0xb'),auth[_0xcd24('0x8')](),controller['getUsers']);router['get'](_0xcd24('0xc'),auth[_0xcd24('0x8')](),controller[_0xcd24('0xd')]);router['post']('/',auth[_0xcd24('0x8')](),controller[_0xcd24('0xe')]);router[_0xcd24('0xf')](_0xcd24('0xc'),controller[_0xcd24('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xcd24('0x11')]);module[_0xcd24('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index ddc3ff0..de1899c 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 _0x80ed=['BOOLEAN','ENUM','out','DATE','sequelize','TEXT','medium'];(function(_0x3ec143,_0x505aea){var _0x19e682=function(_0x36c4dd){while(--_0x36c4dd){_0x3ec143['push'](_0x3ec143['shift']());}};_0x19e682(++_0x505aea);}(_0x80ed,0x11c));var _0xd80e=function(_0x241a95,_0x475183){_0x241a95=_0x241a95-0x0;var _0x50f683=_0x80ed[_0x241a95];return _0x50f683;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'body':{'type':Sequelize[_0xd80e('0x1')](_0xd80e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd80e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd80e('0x4')]('in',_0xd80e('0x5')),'defaultValue':_0xd80e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd80e('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd80e('0x1')]}}; \ No newline at end of file +var _0xf7b4=['STRING','TEXT','sequelize','medium','BOOLEAN','out','DATE'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0xf7b4,0x152));var _0x4f7b=function(_0x4a3acd,_0x5240e0){_0x4a3acd=_0x4a3acd-0x0;var _0x1c7a15=_0xf7b4[_0x4a3acd];return _0x1c7a15;};'use strict';var Sequelize=require(_0x4f7b('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x4f7b('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x4f7b('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4f7b('0x3')),'defaultValue':_0x4f7b('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4f7b('0x4')]},'providerName':{'type':Sequelize[_0x4f7b('0x5')]},'providerResponse':{'type':Sequelize[_0x4f7b('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index f3e7b22..6146fcc 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 _0xa9e0=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','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','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x67766e,_0x50858c){var _0x351e53=function(_0x151a6){while(--_0x151a6){_0x67766e['push'](_0x67766e['shift']());}};_0x351e53(++_0x50858c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file +var _0xa9e0=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','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','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x4a9e01,_0x1713e3){var _0x525c6a=function(_0x1d997e){while(--_0x1d997e){_0x4a9e01['push'](_0x4a9e01['shift']());}};_0x525c6a(++_0x1713e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index a8ccc83..89ddee7 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 _0xe3cf=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x24b11c,_0x356378){var _0x349837=function(_0x37938f){while(--_0x37938f){_0x24b11c['push'](_0x24b11c['shift']());}};_0x349837(++_0x356378);}(_0xe3cf,0xce));var _0xfe3c=function(_0x2d9562,_0x5073fc){_0x2d9562=_0x2d9562-0x0;var _0x3d11c1=_0xe3cf[_0x2d9562];return _0x3d11c1;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xfe3c('0x0'))['db'][_0xfe3c('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xfe3c('0x2')](0x0);var events={'afterCreate':_0xfe3c('0x3'),'afterUpdate':_0xfe3c('0x4'),'afterDestroy':_0xfe3c('0x5')};function emitEvent(_0x32dbd7){return function(_0x7a565c,_0x1d0f83,_0x3ff64d){ChatMessageEvents[_0xfe3c('0x6')](_0x32dbd7+':'+_0x7a565c['id'],_0x7a565c);ChatMessageEvents[_0xfe3c('0x6')](_0x32dbd7,_0x7a565c);_0x3ff64d(null);};}for(var e in events){if(events[_0xfe3c('0x7')](e)){var event=events[e];ChatMessage[_0xfe3c('0x8')](e,emitEvent(event));}}module[_0xfe3c('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0xc1b6=['save','update','remove','emit','hasOwnProperty','hook','events','ChatMessage','setMaxListeners'];(function(_0x292967,_0x15053b){var _0xa27097=function(_0x1f2ea9){while(--_0x1f2ea9){_0x292967['push'](_0x292967['shift']());}};_0xa27097(++_0x15053b);}(_0xc1b6,0x189));var _0x6c1b=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0xc1b6[_0x3f5dca];return _0x5b833a;};'use strict';var EventEmitter=require(_0x6c1b('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x6c1b('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6c1b('0x2')](0x0);var events={'afterCreate':_0x6c1b('0x3'),'afterUpdate':_0x6c1b('0x4'),'afterDestroy':_0x6c1b('0x5')};function emitEvent(_0x1a0abb){return function(_0x2c70f2,_0x162b6d,_0x41f3bb){ChatMessageEvents[_0x6c1b('0x6')](_0x1a0abb+':'+_0x2c70f2['id'],_0x2c70f2);ChatMessageEvents['emit'](_0x1a0abb,_0x2c70f2);_0x41f3bb(null);};}for(var e in events){if(events[_0x6c1b('0x7')](e)){var event=events[e];ChatMessage[_0x6c1b('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index f5321eb..c0f3d77 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 _0x0869=['rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','body','FULLTEXT','models','direction','secret','isNil','ChatInteraction','findOne','ChatInteractionId','then','update','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3f8169,_0x540e58){var _0x1f527c=function(_0x1f6b4f){while(--_0x1f6b4f){_0x3f8169['push'](_0x3f8169['shift']());}};_0x1f527c(++_0x540e58);}(_0x0869,0xaf));var _0x9086=function(_0x85bcf9,_0x3953e2){_0x85bcf9=_0x85bcf9-0x0;var _0x42324c=_0x0869[_0x85bcf9];return _0x42324c;};'use strict';var _=require(_0x9086('0x0'));var util=require(_0x9086('0x1'));var logger=require(_0x9086('0x2'))(_0x9086('0x3'));var moment=require('moment');var BPromise=require(_0x9086('0x4'));var rp=require(_0x9086('0x5'));var fs=require('fs');var path=require(_0x9086('0x6'));var rimraf=require(_0x9086('0x7'));var config=require(_0x9086('0x8'));var attributes=require(_0x9086('0x9'));module['exports']=function(_0x330294,_0x3bd9f3){return _0x330294[_0x9086('0xa')]('ChatMessage',attributes,{'tableName':_0x9086('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x9086('0xc')],'type':_0x9086('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xd45e64,_0x1edb3a,_0x107cc5){var _0x1b1fda=_0x330294[_0x9086('0xe')];var _0x43c230=_0xd45e64['get']({'plain':!![]});if(_0x43c230['direction']['toLowerCase']()==='in'||_0x43c230[_0x9086('0xf')]['toLowerCase']()==='out'&&!_0x43c230[_0x9086('0x10')]&&!_[_0x9086('0x11')](_0x43c230['UserId'])){_0x1b1fda[_0x9086('0x12')][_0x9086('0x13')]({'where':{'id':_0x43c230[_0x9086('0x14')]}})[_0x9086('0x15')](function(_0x4a4c04){if(_0x4a4c04){_0x4a4c04[_0x9086('0x16')]({'lastMsgAt':_0x43c230['createdAt'],'lastMsgDirection':_0x43c230['direction']['toLowerCase']()});}})[_0x9086('0x17')](function(_0x7616f1){console[_0x9086('0x18')](_0x7616f1);});}_0x107cc5();}},'charset':'utf8mb4','collate':_0x9086('0x19')});}; \ No newline at end of file +var _0xbd81=['rimraf','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','models','direction','toLowerCase','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xbd81,0x110));var _0x1bd8=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xbd81[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0x1bd8('0x0'));var util=require(_0x1bd8('0x1'));var logger=require(_0x1bd8('0x2'))(_0x1bd8('0x3'));var moment=require(_0x1bd8('0x4'));var BPromise=require(_0x1bd8('0x5'));var rp=require(_0x1bd8('0x6'));var fs=require('fs');var path=require(_0x1bd8('0x7'));var rimraf=require(_0x1bd8('0x8'));var config=require('../../config/environment');var attributes=require(_0x1bd8('0x9'));module[_0x1bd8('0xa')]=function(_0x433288,_0x58b4e4){return _0x433288[_0x1bd8('0xb')](_0x1bd8('0xc'),attributes,{'tableName':_0x1bd8('0xd'),'paranoid':![],'indexes':[{'name':_0x1bd8('0xe'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x50060d,_0x5b96d2,_0x4e37d1){var _0x2747e9=_0x433288[_0x1bd8('0xf')];var _0x1a7cd7=_0x50060d['get']({'plain':!![]});if(_0x1a7cd7[_0x1bd8('0x10')]['toLowerCase']()==='in'||_0x1a7cd7[_0x1bd8('0x10')][_0x1bd8('0x11')]()==='out'&&!_0x1a7cd7[_0x1bd8('0x12')]&&!_['isNil'](_0x1a7cd7[_0x1bd8('0x13')])){_0x2747e9[_0x1bd8('0x14')][_0x1bd8('0x15')]({'where':{'id':_0x1a7cd7[_0x1bd8('0x16')]}})[_0x1bd8('0x17')](function(_0x5cd338){if(_0x5cd338){_0x5cd338[_0x1bd8('0x18')]({'lastMsgAt':_0x1a7cd7[_0x1bd8('0x19')],'lastMsgDirection':_0x1a7cd7[_0x1bd8('0x10')]['toLowerCase']()});}})['catch'](function(_0x45b7c7){console[_0x1bd8('0x1a')](_0x45b7c7);});}_0x4e37d1();}},'charset':_0x1bd8('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index e4b641c..923be1a 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 _0x7753=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','options','raw','lodash','util','moment'];(function(_0x39772f,_0x5605cb){var _0xc9edbf=function(_0x106a39){while(--_0x106a39){_0x39772f['push'](_0x39772f['shift']());}};_0xc9edbf(++_0x5605cb);}(_0x7753,0xfd));var _0x3775=function(_0x5806c3,_0x5105d8){_0x5806c3=_0x5806c3-0x0;var _0x48ac77=_0x7753[_0x5806c3];return _0x48ac77;};'use strict';var _=require(_0x3775('0x0'));var util=require(_0x3775('0x1'));var moment=require(_0x3775('0x2'));var BPromise=require(_0x3775('0x3'));var rs=require(_0x3775('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3775('0x5'))['db'];var utils=require(_0x3775('0x6'));var logger=require(_0x3775('0x7'))('rpc');var config=require(_0x3775('0x8'));var jayson=require(_0x3775('0x9'));var client=jayson['client'][_0x3775('0xa')]({'port':0x232a});config[_0x3775('0xb')]=_['defaults'](config['redis'],{'host':_0x3775('0xc'),'port':0x18eb});var socket=require(_0x3775('0xd'))(new Redis(config[_0x3775('0xb')]));require(_0x3775('0xe'))[_0x3775('0xf')](socket);function respondWithRpcPromise(_0x4dcc31,_0x2c8595,_0x184879){return new BPromise(function(_0x3ec895,_0x19155a){return client[_0x3775('0x10')](_0x4dcc31,_0x184879)[_0x3775('0x11')](function(_0x483de9){logger[_0x3775('0x12')](_0x3775('0x13'),_0x2c8595,_0x3775('0x14'));logger[_0x3775('0x15')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2c8595,_0x3775('0x14'),JSON['stringify'](_0x483de9));if(_0x483de9[_0x3775('0x16')]){if(_0x483de9[_0x3775('0x16')][_0x3775('0x17')]===0x1f4){logger['error'](_0x3775('0x13'),_0x2c8595,_0x483de9['error']['message']);return _0x19155a(_0x483de9[_0x3775('0x16')][_0x3775('0x18')]);}logger[_0x3775('0x16')](_0x3775('0x13'),_0x2c8595,_0x483de9[_0x3775('0x16')][_0x3775('0x18')]);return _0x3ec895(_0x483de9[_0x3775('0x16')][_0x3775('0x18')]);}else{logger['info'](_0x3775('0x13'),_0x2c8595,'request\x20sent');_0x3ec895(_0x483de9[_0x3775('0x19')][_0x3775('0x18')]);}})[_0x3775('0x1a')](function(_0x4eb999){logger[_0x3775('0x16')](_0x3775('0x13'),_0x2c8595,_0x4eb999);_0x19155a(_0x4eb999);});});}exports[_0x3775('0x1b')]=function(_0x6974b9){var _0x39f873=this;return new Promise(function(_0x43d3b4,_0x4aa5b7){return db[_0x3775('0x1c')][_0x3775('0x1d')](_0x6974b9['body'],{'raw':_0x6974b9[_0x3775('0x1e')]?_0x6974b9[_0x3775('0x1e')][_0x3775('0x1f')]===undefined?!![]:![]:!![]})[_0x3775('0x11')](function(_0x58affa){logger['info'](_0x3775('0x1b'),_0x6974b9);logger[_0x3775('0x15')](_0x3775('0x1b'),_0x6974b9,JSON['stringify'](_0x58affa));_0x43d3b4(_0x58affa);})['catch'](function(_0xb7222){logger[_0x3775('0x16')](_0x3775('0x1b'),_0xb7222['message'],_0x6974b9);_0x4aa5b7(_0x39f873[_0x3775('0x16')](0x1f4,_0xb7222[_0x3775('0x18')]));});});}; \ No newline at end of file +var _0x5721=['request','then','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','request\x20sent','result','ChatMessage','create','body','options','raw','CreateChatMessage','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','./chatMessage.socket','register'];(function(_0xf951ef,_0x111d3c){var _0x25357b=function(_0x3b9330){while(--_0x3b9330){_0xf951ef['push'](_0xf951ef['shift']());}};_0x25357b(++_0x111d3c);}(_0x5721,0xc2));var _0x1572=function(_0x595adc,_0x3e9d42){_0x595adc=_0x595adc-0x0;var _0x3a2419=_0x5721[_0x595adc];return _0x3a2419;};'use strict';var _=require(_0x1572('0x0'));var util=require(_0x1572('0x1'));var moment=require(_0x1572('0x2'));var BPromise=require(_0x1572('0x3'));var rs=require(_0x1572('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1572('0x5'))['db'];var utils=require(_0x1572('0x6'));var logger=require('../../config/logger')(_0x1572('0x7'));var config=require(_0x1572('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1572('0x9')][_0x1572('0xa')]({'port':0x232a});config['redis']=_[_0x1572('0xb')](config['redis'],{'host':_0x1572('0xc'),'port':0x18eb});var socket=require(_0x1572('0xd'))(new Redis(config['redis']));require(_0x1572('0xe'))[_0x1572('0xf')](socket);function respondWithRpcPromise(_0x2541c6,_0x2d12b8,_0x27ec8d){return new BPromise(function(_0x538d1b,_0x425c63){return client[_0x1572('0x10')](_0x2541c6,_0x27ec8d)[_0x1572('0x11')](function(_0x4911c5){logger[_0x1572('0x12')]('ChatMessage,\x20%s,\x20%s',_0x2d12b8,'request\x20sent');logger[_0x1572('0x13')](_0x1572('0x14'),_0x2d12b8,'request\x20sent',JSON[_0x1572('0x15')](_0x4911c5));if(_0x4911c5[_0x1572('0x16')]){if(_0x4911c5[_0x1572('0x16')][_0x1572('0x17')]===0x1f4){logger[_0x1572('0x16')](_0x1572('0x18'),_0x2d12b8,_0x4911c5[_0x1572('0x16')][_0x1572('0x19')]);return _0x425c63(_0x4911c5['error']['message']);}logger[_0x1572('0x16')](_0x1572('0x18'),_0x2d12b8,_0x4911c5[_0x1572('0x16')][_0x1572('0x19')]);return _0x538d1b(_0x4911c5['error']['message']);}else{logger[_0x1572('0x12')](_0x1572('0x18'),_0x2d12b8,_0x1572('0x1a'));_0x538d1b(_0x4911c5[_0x1572('0x1b')][_0x1572('0x19')]);}})['catch'](function(_0x1cc31c){logger[_0x1572('0x16')](_0x1572('0x18'),_0x2d12b8,_0x1cc31c);_0x425c63(_0x1cc31c);});});}exports['CreateChatMessage']=function(_0x7f603){var _0x49f9ea=this;return new Promise(function(_0x2ebf20,_0x544a78){return db[_0x1572('0x1c')][_0x1572('0x1d')](_0x7f603[_0x1572('0x1e')],{'raw':_0x7f603['options']?_0x7f603[_0x1572('0x1f')][_0x1572('0x20')]===undefined?!![]:![]:!![]})[_0x1572('0x11')](function(_0x43636a){logger['info'](_0x1572('0x21'),_0x7f603);logger[_0x1572('0x13')](_0x1572('0x21'),_0x7f603,JSON['stringify'](_0x43636a));_0x2ebf20(_0x43636a);})[_0x1572('0x22')](function(_0x33d339){logger['error'](_0x1572('0x21'),_0x33d339[_0x1572('0x19')],_0x7f603);_0x544a78(_0x49f9ea[_0x1572('0x16')](0x1f4,_0x33d339['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 640523b..bb2cf38 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 _0xa41a=['emit','removeListener','./chatMessage.events','save','update'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa41a,0x6b));var _0xaa41=function(_0x2bfc14,_0x126a00){_0x2bfc14=_0x2bfc14-0x0;var _0x49260d=_0xa41a[_0x2bfc14];return _0x49260d;};'use strict';var ChatMessageEvents=require(_0xaa41('0x0'));var events=[_0xaa41('0x1'),'remove',_0xaa41('0x2')];function createListener(_0x2a96ba,_0x43654a){return function(_0xc5ce74){_0x43654a[_0xaa41('0x3')](_0x2a96ba,_0xc5ce74);};}function removeListener(_0x3168be,_0x42896b){return function(){ChatMessageEvents[_0xaa41('0x4')](_0x3168be,_0x42896b);};}exports['register']=function(_0x2122a0){for(var _0x1ec9d4=0x0,_0x54bc5a=events['length'];_0x1ec9d4<_0x54bc5a;_0x1ec9d4++){var _0x179545=events[_0x1ec9d4];var _0x202cce=createListener('chatMessage:'+_0x179545,_0x2122a0);ChatMessageEvents['on'](_0x179545,_0x202cce);}}; \ No newline at end of file +var _0x254a=['emit','register','./chatMessage.events','save','remove'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x254a,0x138));var _0xa254=function(_0x33a47b,_0x25022a){_0x33a47b=_0x33a47b-0x0;var _0x3164d0=_0x254a[_0x33a47b];return _0x3164d0;};'use strict';var ChatMessageEvents=require(_0xa254('0x0'));var events=[_0xa254('0x1'),_0xa254('0x2'),'update'];function createListener(_0xdd386c,_0x3e56d3){return function(_0x34467a){_0x3e56d3[_0xa254('0x3')](_0xdd386c,_0x34467a);};}function removeListener(_0x500e29,_0x8fbfaf){return function(){ChatMessageEvents['removeListener'](_0x500e29,_0x8fbfaf);};}exports[_0xa254('0x4')]=function(_0x3d5886){for(var _0x1201ae=0x0,_0x597d72=events['length'];_0x1201ae<_0x597d72;_0x1201ae++){var _0xaeed42=events[_0x1201ae];var _0x352a44=createListener('chatMessage:'+_0xaeed42,_0x3d5886);ChatMessageEvents['on'](_0xaeed42,_0x352a44);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 3ee549c..78e8209 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 _0x707b=['/:id/accept','/:id/reject','reject','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','tracked','chat','chatmessage:create','create','put'];(function(_0x304c70,_0x599404){var _0x74595=function(_0x5c4ee3){while(--_0x5c4ee3){_0x304c70['push'](_0x304c70['shift']());}};_0x74595(++_0x599404);}(_0x707b,0x165));var _0xb707=function(_0x15833e,_0x58a046){_0x15833e=_0x15833e-0x0;var _0x5c4745=_0x707b[_0x15833e];return _0x5c4745;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb707('0x0'));var timeout=require(_0xb707('0x1'));var express=require('express');var router=express[_0xb707('0x2')]();var fs_extra=require(_0xb707('0x3'));var auth=require(_0xb707('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb707('0x5'));var controller=require('./chatMessage.controller');router[_0xb707('0x6')]('/',auth[_0xb707('0x7')](),controller['index']);router['get'](_0xb707('0x8'),auth[_0xb707('0x7')](),controller[_0xb707('0x9')]);router[_0xb707('0x6')](_0xb707('0xa'),auth['isAuthenticated'](),controller[_0xb707('0xb')]);router['post']('/',auth[_0xb707('0x7')](),interaction[_0xb707('0xc')](_0xb707('0xd'),_0xb707('0xe')),controller[_0xb707('0xf')]);router['put']('/:id',controller['update']);router[_0xb707('0x10')](_0xb707('0x11'),auth[_0xb707('0x7')](),controller['accept']);router['put'](_0xb707('0x12'),auth[_0xb707('0x7')](),controller[_0xb707('0x13')]);router['delete']('/:id',auth[_0xb707('0x7')](),controller[_0xb707('0x14')]);module[_0xb707('0x15')]=router; \ No newline at end of file +var _0xefef=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','tracked','chat','chatmessage:create','put','update','accept','reject','delete'];(function(_0x5e194d,_0x224a5a){var _0x4ae15f=function(_0x1337e6){while(--_0x1337e6){_0x5e194d['push'](_0x5e194d['shift']());}};_0x4ae15f(++_0x224a5a);}(_0xefef,0x7a));var _0xfefe=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xefef[_0x33032e];return _0x13316b;};'use strict';var multer=require(_0xfefe('0x0'));var util=require(_0xfefe('0x1'));var path=require(_0xfefe('0x2'));var timeout=require(_0xfefe('0x3'));var express=require(_0xfefe('0x4'));var router=express[_0xfefe('0x5')]();var fs_extra=require(_0xfefe('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xfefe('0x7'));var config=require(_0xfefe('0x8'));var controller=require('./chatMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfefe('0x9')]('/describe',auth[_0xfefe('0xa')](),controller['describe']);router[_0xfefe('0x9')](_0xfefe('0xb'),auth[_0xfefe('0xa')](),controller[_0xfefe('0xc')]);router[_0xfefe('0xd')]('/',auth[_0xfefe('0xa')](),interaction[_0xfefe('0xe')](_0xfefe('0xf'),_0xfefe('0x10')),controller['create']);router[_0xfefe('0x11')](_0xfefe('0xb'),controller[_0xfefe('0x12')]);router[_0xfefe('0x11')]('/:id/accept',auth[_0xfefe('0xa')](),controller[_0xfefe('0x13')]);router[_0xfefe('0x11')]('/:id/reject',auth[_0xfefe('0xa')](),controller[_0xfefe('0x14')]);router[_0xfefe('0x15')](_0xfefe('0xb'),auth[_0xfefe('0xa')](),controller[_0xfefe('0x16')]);module[_0xfefe('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 620c63c..e47de5a 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 _0x2b14=['medium','sequelize','TEXT'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0x2b14,0x13f));var _0x42b1=function(_0x215772,_0x52e22a){_0x215772=_0x215772-0x0;var _0x4c2adc=_0x2b14[_0x215772];return _0x4c2adc;};'use strict';var Sequelize=require(_0x42b1('0x0'));module['exports']={'body':{'type':Sequelize[_0x42b1('0x1')](_0x42b1('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xc587=['sequelize','exports'];(function(_0x42244f,_0x15f098){var _0x5cd361=function(_0x477822){while(--_0x477822){_0x42244f['push'](_0x42244f['shift']());}};_0x5cd361(++_0x15f098);}(_0xc587,0x12a));var _0x7c58=function(_0x35e45f,_0x24b936){_0x35e45f=_0x35e45f-0x0;var _0x31ba04=_0xc587[_0x35e45f];return _0x31ba04;};'use strict';var Sequelize=require(_0x7c58('0x0'));module[_0x7c58('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index fd5f81a..f492bde 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(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x7a54,0x106));var _0x47a5=function(_0x47b893,_0x9e44b){_0x47b893=_0x47b893-0x0;var _0x1968e1=_0x7a54[_0x47b893];return _0x1968e1;};'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(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x7a54,0x106));var _0x47a5=function(_0x5d9bb0,_0x3f55cb){_0x5d9bb0=_0x5d9bb0-0x0;var _0x441add=_0x7a54[_0x5d9bb0];return _0x441add;};'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.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index ffdddac..afc4ac6 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 _0x5ef9=['rimraf','exports','define','ChatOfflineMessage','utf8mb4','lodash','../../config/logger','moment','bluebird'];(function(_0x13639d,_0x3c996b){var _0x52ef14=function(_0x3faf51){while(--_0x3faf51){_0x13639d['push'](_0x13639d['shift']());}};_0x52ef14(++_0x3c996b);}(_0x5ef9,0xdd));var _0x95ef=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x5ef9[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require(_0x95ef('0x0'));var util=require('util');var logger=require(_0x95ef('0x1'))('api');var moment=require(_0x95ef('0x2'));var BPromise=require(_0x95ef('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x95ef('0x4'));var config=require('../../config/environment');var attributes=require('./chatOfflineMessage.attributes');module[_0x95ef('0x5')]=function(_0x34e538,_0x501b0b){return _0x34e538[_0x95ef('0x6')](_0x95ef('0x7'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x95ef('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4980=['api','request-promise','path','../../config/environment','exports','define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x2b6e12,_0x3c6822){var _0x57039f=function(_0x25ed18){while(--_0x25ed18){_0x2b6e12['push'](_0x2b6e12['shift']());}};_0x57039f(++_0x3c6822);}(_0x4980,0xfb));var _0x0498=function(_0x50c6a6,_0x4c4935){_0x50c6a6=_0x50c6a6-0x0;var _0x38d9c1=_0x4980[_0x50c6a6];return _0x38d9c1;};'use strict';var _=require(_0x0498('0x0'));var util=require(_0x0498('0x1'));var logger=require('../../config/logger')(_0x0498('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0498('0x3'));var fs=require('fs');var path=require(_0x0498('0x4'));var rimraf=require('rimraf');var config=require(_0x0498('0x5'));var attributes=require('./chatOfflineMessage.attributes');module[_0x0498('0x6')]=function(_0x218325,_0x28645d){return _0x218325[_0x0498('0x7')]('ChatOfflineMessage',attributes,{'tableName':_0x0498('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0498('0x9'),'collate':_0x0498('0xa')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index c0422d0..8d8199d 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 _0xa992=['http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x27b834,_0x21e37e){var _0x34b47c=function(_0x70dabc){while(--_0x70dabc){_0x27b834['push'](_0x27b834['shift']());}};_0x34b47c(++_0x21e37e);}(_0xa992,0x18c));var _0x2a99=function(_0x291c7f,_0x17b1e5){_0x291c7f=_0x291c7f-0x0;var _0x5ee1bf=_0xa992[_0x291c7f];return _0x5ee1bf;};'use strict';var _=require(_0x2a99('0x0'));var util=require(_0x2a99('0x1'));var moment=require(_0x2a99('0x2'));var BPromise=require(_0x2a99('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a99('0x4'));var db=require(_0x2a99('0x5'))['db'];var utils=require(_0x2a99('0x6'));var logger=require(_0x2a99('0x7'))(_0x2a99('0x8'));var config=require(_0x2a99('0x9'));var jayson=require(_0x2a99('0xa'));var client=jayson[_0x2a99('0xb')][_0x2a99('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9325b0,_0x483fb7,_0x365583){return new BPromise(function(_0x3b6f29,_0x3edcfc){return client[_0x2a99('0xd')](_0x9325b0,_0x365583)[_0x2a99('0xe')](function(_0x243164){logger[_0x2a99('0xf')](_0x2a99('0x10'),_0x483fb7,_0x2a99('0x11'));logger[_0x2a99('0x12')](_0x2a99('0x13'),_0x483fb7,'request\x20sent',JSON['stringify'](_0x243164));if(_0x243164[_0x2a99('0x14')]){if(_0x243164[_0x2a99('0x14')][_0x2a99('0x15')]===0x1f4){logger[_0x2a99('0x14')](_0x2a99('0x10'),_0x483fb7,_0x243164[_0x2a99('0x14')]['message']);return _0x3edcfc(_0x243164[_0x2a99('0x14')][_0x2a99('0x16')]);}logger[_0x2a99('0x14')](_0x2a99('0x10'),_0x483fb7,_0x243164[_0x2a99('0x14')]['message']);return _0x3b6f29(_0x243164[_0x2a99('0x14')]['message']);}else{logger['info'](_0x2a99('0x10'),_0x483fb7,_0x2a99('0x11'));_0x3b6f29(_0x243164[_0x2a99('0x17')]['message']);}})['catch'](function(_0x55d1f0){logger[_0x2a99('0x14')](_0x2a99('0x10'),_0x483fb7,_0x55d1f0);_0x3edcfc(_0x55d1f0);});});} \ No newline at end of file +var _0xa265=['info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','request','then'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0xa265,0xe6));var _0x5a26=function(_0x4f7696,_0x5437b0){_0x4f7696=_0x4f7696-0x0;var _0x5b1d91=_0xa265[_0x4f7696];return _0x5b1d91;};'use strict';var _=require(_0x5a26('0x0'));var util=require(_0x5a26('0x1'));var moment=require(_0x5a26('0x2'));var BPromise=require(_0x5a26('0x3'));var rs=require(_0x5a26('0x4'));var fs=require('fs');var Redis=require(_0x5a26('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5a26('0x6'));var jayson=require(_0x5a26('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5d95f9,_0x452734,_0xcbe300){return new BPromise(function(_0x5389de,_0x13bbd2){return client[_0x5a26('0x8')](_0x5d95f9,_0xcbe300)[_0x5a26('0x9')](function(_0x48db7f){logger[_0x5a26('0xa')](_0x5a26('0xb'),_0x452734,'request\x20sent');logger[_0x5a26('0xc')](_0x5a26('0xd'),_0x452734,'request\x20sent',JSON[_0x5a26('0xe')](_0x48db7f));if(_0x48db7f[_0x5a26('0xf')]){if(_0x48db7f[_0x5a26('0xf')][_0x5a26('0x10')]===0x1f4){logger[_0x5a26('0xf')](_0x5a26('0xb'),_0x452734,_0x48db7f[_0x5a26('0xf')][_0x5a26('0x11')]);return _0x13bbd2(_0x48db7f[_0x5a26('0xf')][_0x5a26('0x11')]);}logger[_0x5a26('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x452734,_0x48db7f[_0x5a26('0xf')][_0x5a26('0x11')]);return _0x5389de(_0x48db7f['error'][_0x5a26('0x11')]);}else{logger['info'](_0x5a26('0xb'),_0x452734,'request\x20sent');_0x5389de(_0x48db7f[_0x5a26('0x12')]['message']);}})[_0x5a26('0x13')](function(_0x226b00){logger['error'](_0x5a26('0xb'),_0x452734,_0x226b00);_0x13bbd2(_0x226b00);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 2757c80..b85bb6e 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 _0x07ae=['create','put','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x07ae,0x1a6));var _0xe07a=function(_0x5d0260,_0x3ffa21){_0x5d0260=_0x5d0260-0x0;var _0x58b075=_0x07ae[_0x5d0260];return _0x58b075;};'use strict';var multer=require('multer');var util=require(_0xe07a('0x0'));var path=require(_0xe07a('0x1'));var timeout=require('connect-timeout');var express=require(_0xe07a('0x2'));var router=express[_0xe07a('0x3')]();var fs_extra=require(_0xe07a('0x4'));var auth=require(_0xe07a('0x5'));var interaction=require(_0xe07a('0x6'));var config=require('../../config/environment');var controller=require(_0xe07a('0x7'));router[_0xe07a('0x8')]('/',auth[_0xe07a('0x9')](),controller['index']);router[_0xe07a('0x8')](_0xe07a('0xa'),auth[_0xe07a('0x9')](),controller[_0xe07a('0xb')]);router[_0xe07a('0x8')](_0xe07a('0xc'),auth[_0xe07a('0x9')](),controller[_0xe07a('0xd')]);router[_0xe07a('0xe')]('/',auth[_0xe07a('0x9')](),controller[_0xe07a('0xf')]);router[_0xe07a('0x10')](_0xe07a('0xc'),auth[_0xe07a('0x9')](),controller['update']);router[_0xe07a('0x11')](_0xe07a('0xc'),auth[_0xe07a('0x9')](),controller['destroy']);module[_0xe07a('0x12')]=router; \ No newline at end of file +var _0xa18f=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','show','post','create','put','/:id','update','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa18f,0x13f));var _0xfa18=function(_0x19d332,_0x22ec74){_0x19d332=_0x19d332-0x0;var _0xffd364=_0xa18f[_0x19d332];return _0xffd364;};'use strict';var multer=require(_0xfa18('0x0'));var util=require(_0xfa18('0x1'));var path=require(_0xfa18('0x2'));var timeout=require(_0xfa18('0x3'));var express=require('express');var router=express[_0xfa18('0x4')]();var fs_extra=require(_0xfa18('0x5'));var auth=require(_0xfa18('0x6'));var interaction=require(_0xfa18('0x7'));var config=require(_0xfa18('0x8'));var controller=require('./chatOfflineMessage.controller');router[_0xfa18('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfa18('0x9')](_0xfa18('0xa'),auth[_0xfa18('0xb')](),controller['describe']);router[_0xfa18('0x9')]('/:id',auth[_0xfa18('0xb')](),controller[_0xfa18('0xc')]);router[_0xfa18('0xd')]('/',auth['isAuthenticated'](),controller[_0xfa18('0xe')]);router[_0xfa18('0xf')](_0xfa18('0x10'),auth[_0xfa18('0xb')](),controller[_0xfa18('0x11')]);router['delete'](_0xfa18('0x10'),auth['isAuthenticated'](),controller[_0xfa18('0x12')]);module[_0xfa18('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 8eb222d..8132593 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 _0xb0da=['exports','STRING','ENUM','mouseOver'];(function(_0x5dca3b,_0x1fdac5){var _0x585514=function(_0x5ec8b3){while(--_0x5ec8b3){_0x5dca3b['push'](_0x5dca3b['shift']());}};_0x585514(++_0x1fdac5);}(_0xb0da,0x6c));var _0xab0d=function(_0x2af71e,_0x4e23c8){_0x2af71e=_0x2af71e-0x0;var _0x24564f=_0xb0da[_0x2af71e];return _0x24564f;};'use strict';var Sequelize=require('sequelize');module[_0xab0d('0x0')]={'name':{'type':Sequelize[_0xab0d('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xab0d('0x2')](_0xab0d('0x3'),'timeout'),'defaultValue':_0xab0d('0x3')},'selector':{'type':Sequelize[_0xab0d('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xba35=['sequelize','exports','STRING','ENUM','timeout','mouseOver','INTEGER'];(function(_0x48a5a6,_0x301564){var _0x2954c2=function(_0x42fe40){while(--_0x42fe40){_0x48a5a6['push'](_0x48a5a6['shift']());}};_0x2954c2(++_0x301564);}(_0xba35,0x1d5));var _0x5ba3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xba35[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x5ba3('0x0'));module[_0x5ba3('0x1')]={'name':{'type':Sequelize[_0x5ba3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5ba3('0x3')]('mouseOver',_0x5ba3('0x4')),'defaultValue':_0x5ba3('0x5')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x5ba3('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 35848f2..ce990d6 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 _0xf8b2=['set','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','show','model','keys','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','then','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x5b0144,_0x48dcce){var _0x17903f=function(_0x404099){while(--_0x404099){_0x5b0144['push'](_0x5b0144['shift']());}};_0x17903f(++_0x48dcce);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x390636,_0x156bce){_0x390636=_0x390636-0x0;var _0x4a6ae8=_0xf8b2[_0x390636];return _0x4a6ae8;};'use strict';var emlformat=require(_0x2f8b('0x0'));var rimraf=require(_0x2f8b('0x1'));var zipdir=require(_0x2f8b('0x2'));var jsonpatch=require(_0x2f8b('0x3'));var rp=require(_0x2f8b('0x4'));var moment=require(_0x2f8b('0x5'));var BPromise=require(_0x2f8b('0x6'));var Mustache=require(_0x2f8b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2f8b('0x8'));var csv=require(_0x2f8b('0x9'));var ejs=require(_0x2f8b('0xa'));var fs=require('fs');var fs_extra=require(_0x2f8b('0xb'));var _=require(_0x2f8b('0xc'));var squel=require(_0x2f8b('0xd'));var crypto=require(_0x2f8b('0xe'));var jsforce=require(_0x2f8b('0xf'));var deskjs=require(_0x2f8b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2f8b('0x11'));var Papa=require(_0x2f8b('0x12'));var Redis=require(_0x2f8b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2f8b('0x14'));var as=require(_0x2f8b('0x15'));var hardwareService=require(_0x2f8b('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x2f8b('0x17'));var config=require(_0x2f8b('0x18'));var licenseUtil=require(_0x2f8b('0x19'));var db=require(_0x2f8b('0x1a'))['db'];function respondWithStatusCode(_0x175111,_0x4cb1e0){_0x4cb1e0=_0x4cb1e0||0xcc;return function(_0x16d5a2){if(_0x16d5a2){return _0x175111['sendStatus'](_0x4cb1e0);}return _0x175111[_0x2f8b('0x1b')](_0x4cb1e0)[_0x2f8b('0x1c')]();};}function respondWithResult(_0x1b6a17,_0x15634){_0x15634=_0x15634||0xc8;return function(_0xf9cbe0){if(_0xf9cbe0){return _0x1b6a17[_0x2f8b('0x1b')](_0x15634)[_0x2f8b('0x1d')](_0xf9cbe0);}};}function respondWithFilteredResult(_0x2b6003,_0x532fe4){return function(_0x14a248){if(_0x14a248){var _0xdec711=typeof _0x532fe4[_0x2f8b('0x1e')]===_0x2f8b('0x1f')&&typeof _0x532fe4[_0x2f8b('0x20')]===_0x2f8b('0x1f');var _0x3d65ee=_0x14a248[_0x2f8b('0x21')];var _0x35ec40=_0xdec711?0x0:_0x532fe4['offset'];var _0x23dd63=_0xdec711?_0x14a248[_0x2f8b('0x21')]:_0x532fe4[_0x2f8b('0x1e')]+_0x532fe4['limit'];var _0xdc8171;if(_0x23dd63>=_0x3d65ee){_0x23dd63=_0x3d65ee;_0xdc8171=0xc8;}else{_0xdc8171=0xce;}_0x2b6003['status'](_0xdc8171);return _0x2b6003[_0x2f8b('0x22')](_0x2f8b('0x23'),_0x35ec40+'-'+_0x23dd63+'/'+_0x3d65ee)[_0x2f8b('0x1d')](_0x14a248);}return null;};}function patchUpdates(_0x26d78f){return function(_0x3be6dc){try{jsonpatch['apply'](_0x3be6dc,_0x26d78f,!![]);}catch(_0x29c2f3){return BPromise[_0x2f8b('0x24')](_0x29c2f3);}return _0x3be6dc[_0x2f8b('0x25')]();};}function saveUpdates(_0x17b251,_0x3ad38b){return function(_0x1ffbae){if(_0x1ffbae){return _0x1ffbae[_0x2f8b('0x26')](_0x17b251)['then'](function(_0x273950){return _0x273950;});}return null;};}function removeEntity(_0x23f73c,_0x3560c4){return function(_0x41e12b){if(_0x41e12b){return _0x41e12b[_0x2f8b('0x27')]()['then'](function(){_0x23f73c[_0x2f8b('0x1b')](0xcc)[_0x2f8b('0x1c')]();});}};}function handleEntityNotFound(_0x152492,_0x46a95a){return function(_0x183e51){if(!_0x183e51){_0x152492[_0x2f8b('0x28')](0x194);}return _0x183e51;};}function handleError(_0x45e313,_0x347f5a){_0x347f5a=_0x347f5a||0x1f4;return function(_0x4145b3){logger['error'](_0x4145b3[_0x2f8b('0x29')]);if(_0x4145b3['name']){delete _0x4145b3[_0x2f8b('0x2a')];}_0x45e313[_0x2f8b('0x1b')](_0x347f5a)[_0x2f8b('0x2b')](_0x4145b3);};}exports[_0x2f8b('0x2c')]=function(_0x72b23b,_0x4adacd){var _0x2cfbea={'raw':!![],'where':{'id':_0x72b23b['params']['id']}},_0x5cc78c={};_0x5cc78c[_0x2f8b('0x2d')]=_[_0x2f8b('0x2e')](db['ChatProactiveAction'][_0x2f8b('0x2f')]);_0x5cc78c[_0x2f8b('0x30')]=_[_0x2f8b('0x2e')](_0x72b23b[_0x2f8b('0x30')]);_0x5cc78c[_0x2f8b('0x31')]=_[_0x2f8b('0x32')](_0x5cc78c['model'],_0x5cc78c[_0x2f8b('0x30')]);_0x2cfbea[_0x2f8b('0x33')]=_[_0x2f8b('0x32')](_0x5cc78c[_0x2f8b('0x2d')],qs[_0x2f8b('0x34')](_0x72b23b[_0x2f8b('0x30')][_0x2f8b('0x34')]));_0x2cfbea['attributes']=_0x2cfbea[_0x2f8b('0x33')]['length']?_0x2cfbea[_0x2f8b('0x33')]:_0x5cc78c[_0x2f8b('0x2d')];if(_0x72b23b[_0x2f8b('0x30')][_0x2f8b('0x35')]){_0x2cfbea[_0x2f8b('0x36')]=[{'all':!![]}];}_0x2cfbea=_[_0x2f8b('0x37')]({},_0x2cfbea,_0x72b23b[_0x2f8b('0x38')]);return db[_0x2f8b('0x39')][_0x2f8b('0x3a')](_0x2cfbea)['then'](handleEntityNotFound(_0x4adacd,null))['then'](respondWithResult(_0x4adacd,null))[_0x2f8b('0x3b')](handleError(_0x4adacd,null));};exports[_0x2f8b('0x3c')]=function(_0x339648,_0x3f7f9c){return db['ChatProactiveAction'][_0x2f8b('0x3c')](_0x339648[_0x2f8b('0x3d')],{})[_0x2f8b('0x3e')](respondWithResult(_0x3f7f9c,0xc9))[_0x2f8b('0x3b')](handleError(_0x3f7f9c,null));};exports[_0x2f8b('0x26')]=function(_0x523419,_0x56c05c){if(_0x523419[_0x2f8b('0x3d')]['id']){delete _0x523419[_0x2f8b('0x3d')]['id'];}return db[_0x2f8b('0x39')][_0x2f8b('0x3a')]({'where':{'id':_0x523419[_0x2f8b('0x3f')]['id']}})[_0x2f8b('0x3e')](handleEntityNotFound(_0x56c05c,null))[_0x2f8b('0x3e')](saveUpdates(_0x523419['body'],null))[_0x2f8b('0x3e')](respondWithResult(_0x56c05c,null))[_0x2f8b('0x3b')](handleError(_0x56c05c,null));};exports['destroy']=function(_0x13c969,_0x4594b2){return db[_0x2f8b('0x39')]['find']({'where':{'id':_0x13c969[_0x2f8b('0x3f')]['id']}})[_0x2f8b('0x3e')](handleEntityNotFound(_0x4594b2,null))['then'](removeEntity(_0x4594b2,null))[_0x2f8b('0x3b')](handleError(_0x4594b2,null));}; \ No newline at end of file +var _0x8781=['limit','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','show','model','keys','query','filters','intersection','attributes','fields','includeAll','include','find','catch','ChatProactiveAction','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined'];(function(_0x185597,_0x3ca825){var _0x5f02ab=function(_0x1e8745){while(--_0x1e8745){_0x185597['push'](_0x185597['shift']());}};_0x5f02ab(++_0x3ca825);}(_0x8781,0x1c8));var _0x1878=function(_0x203def,_0x23d488){_0x203def=_0x203def-0x0;var _0x41087c=_0x8781[_0x203def];return _0x41087c;};'use strict';var emlformat=require(_0x1878('0x0'));var rimraf=require(_0x1878('0x1'));var zipdir=require(_0x1878('0x2'));var jsonpatch=require(_0x1878('0x3'));var rp=require(_0x1878('0x4'));var moment=require(_0x1878('0x5'));var BPromise=require(_0x1878('0x6'));var Mustache=require('mustache');var util=require(_0x1878('0x7'));var path=require(_0x1878('0x8'));var sox=require(_0x1878('0x9'));var csv=require(_0x1878('0xa'));var ejs=require(_0x1878('0xb'));var fs=require('fs');var fs_extra=require(_0x1878('0xc'));var _=require('lodash');var squel=require(_0x1878('0xd'));var crypto=require(_0x1878('0xe'));var jsforce=require(_0x1878('0xf'));var deskjs=require(_0x1878('0x10'));var toCsv=require(_0x1878('0xa'));var querystring=require(_0x1878('0x11'));var Papa=require(_0x1878('0x12'));var Redis=require(_0x1878('0x13'));var authService=require(_0x1878('0x14'));var qs=require(_0x1878('0x15'));var as=require(_0x1878('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1878('0x17'))(_0x1878('0x18'));var utils=require(_0x1878('0x19'));var config=require(_0x1878('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4272ab,_0x1ed9f0){_0x1ed9f0=_0x1ed9f0||0xcc;return function(_0x181e51){if(_0x181e51){return _0x4272ab[_0x1878('0x1b')](_0x1ed9f0);}return _0x4272ab['status'](_0x1ed9f0)['end']();};}function respondWithResult(_0x19ffaa,_0x396f3a){_0x396f3a=_0x396f3a||0xc8;return function(_0x49d3a1){if(_0x49d3a1){return _0x19ffaa[_0x1878('0x1c')](_0x396f3a)[_0x1878('0x1d')](_0x49d3a1);}};}function respondWithFilteredResult(_0xb324ba,_0x4a5ba9){return function(_0x562902){if(_0x562902){var _0x13e16d=typeof _0x4a5ba9[_0x1878('0x1e')]===_0x1878('0x1f')&&typeof _0x4a5ba9[_0x1878('0x20')]===_0x1878('0x1f');var _0x430e64=_0x562902[_0x1878('0x21')];var _0x1642b3=_0x13e16d?0x0:_0x4a5ba9[_0x1878('0x1e')];var _0x2b8492=_0x13e16d?_0x562902[_0x1878('0x21')]:_0x4a5ba9['offset']+_0x4a5ba9['limit'];var _0xf80c60;if(_0x2b8492>=_0x430e64){_0x2b8492=_0x430e64;_0xf80c60=0xc8;}else{_0xf80c60=0xce;}_0xb324ba[_0x1878('0x1c')](_0xf80c60);return _0xb324ba['set'](_0x1878('0x22'),_0x1642b3+'-'+_0x2b8492+'/'+_0x430e64)[_0x1878('0x1d')](_0x562902);}return null;};}function patchUpdates(_0x1fae20){return function(_0x387f5){try{jsonpatch[_0x1878('0x23')](_0x387f5,_0x1fae20,!![]);}catch(_0x4dc6f1){return BPromise[_0x1878('0x24')](_0x4dc6f1);}return _0x387f5['save']();};}function saveUpdates(_0x1c2b5d,_0x45e2b6){return function(_0x2bc65b){if(_0x2bc65b){return _0x2bc65b[_0x1878('0x25')](_0x1c2b5d)[_0x1878('0x26')](function(_0x524e68){return _0x524e68;});}return null;};}function removeEntity(_0x461905,_0x10ce95){return function(_0x215e59){if(_0x215e59){return _0x215e59[_0x1878('0x27')]()[_0x1878('0x26')](function(){_0x461905[_0x1878('0x1c')](0xcc)[_0x1878('0x28')]();});}};}function handleEntityNotFound(_0x4e114d,_0x122c65){return function(_0x10ab5c){if(!_0x10ab5c){_0x4e114d[_0x1878('0x1b')](0x194);}return _0x10ab5c;};}function handleError(_0xb191d0,_0x46f5b7){_0x46f5b7=_0x46f5b7||0x1f4;return function(_0x57580b){logger[_0x1878('0x29')](_0x57580b[_0x1878('0x2a')]);if(_0x57580b[_0x1878('0x2b')]){delete _0x57580b[_0x1878('0x2b')];}_0xb191d0['status'](_0x46f5b7)[_0x1878('0x2c')](_0x57580b);};}exports[_0x1878('0x2d')]=function(_0x13fb40,_0x31b2ba){var _0x1eda2b={'raw':!![],'where':{'id':_0x13fb40['params']['id']}},_0x45e3db={};_0x45e3db[_0x1878('0x2e')]=_[_0x1878('0x2f')](db['ChatProactiveAction']['rawAttributes']);_0x45e3db[_0x1878('0x30')]=_['keys'](_0x13fb40['query']);_0x45e3db[_0x1878('0x31')]=_[_0x1878('0x32')](_0x45e3db[_0x1878('0x2e')],_0x45e3db['query']);_0x1eda2b[_0x1878('0x33')]=_[_0x1878('0x32')](_0x45e3db[_0x1878('0x2e')],qs[_0x1878('0x34')](_0x13fb40['query'][_0x1878('0x34')]));_0x1eda2b[_0x1878('0x33')]=_0x1eda2b[_0x1878('0x33')]['length']?_0x1eda2b['attributes']:_0x45e3db[_0x1878('0x2e')];if(_0x13fb40['query'][_0x1878('0x35')]){_0x1eda2b[_0x1878('0x36')]=[{'all':!![]}];}_0x1eda2b=_['merge']({},_0x1eda2b,_0x13fb40['options']);return db['ChatProactiveAction'][_0x1878('0x37')](_0x1eda2b)[_0x1878('0x26')](handleEntityNotFound(_0x31b2ba,null))[_0x1878('0x26')](respondWithResult(_0x31b2ba,null))[_0x1878('0x38')](handleError(_0x31b2ba,null));};exports['create']=function(_0xcd00c2,_0x4ca033){return db[_0x1878('0x39')][_0x1878('0x3a')](_0xcd00c2['body'],{})[_0x1878('0x26')](respondWithResult(_0x4ca033,0xc9))[_0x1878('0x38')](handleError(_0x4ca033,null));};exports['update']=function(_0xd589dc,_0x4086ea){if(_0xd589dc['body']['id']){delete _0xd589dc[_0x1878('0x3b')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0xd589dc[_0x1878('0x3c')]['id']}})[_0x1878('0x26')](handleEntityNotFound(_0x4086ea,null))['then'](saveUpdates(_0xd589dc[_0x1878('0x3b')],null))[_0x1878('0x26')](respondWithResult(_0x4086ea,null))[_0x1878('0x38')](handleError(_0x4086ea,null));};exports[_0x1878('0x27')]=function(_0x5cbdfe,_0x41e778){return db[_0x1878('0x39')][_0x1878('0x37')]({'where':{'id':_0x5cbdfe['params']['id']}})['then'](handleEntityNotFound(_0x41e778,null))[_0x1878('0x26')](removeEntity(_0x41e778,null))[_0x1878('0x38')](handleError(_0x41e778,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 562d4a4..19d5ba7 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 _0x602a=['moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util','../../config/logger'];(function(_0x573e49,_0x4d92cd){var _0x20ee7b=function(_0x42801c){while(--_0x42801c){_0x573e49['push'](_0x573e49['shift']());}};_0x20ee7b(++_0x4d92cd);}(_0x602a,0x129));var _0xa602=function(_0x4cc765,_0x3bf3a5){_0x4cc765=_0x4cc765-0x0;var _0x5e9e1e=_0x602a[_0x4cc765];return _0x5e9e1e;};'use strict';var _=require(_0xa602('0x0'));var util=require(_0xa602('0x1'));var logger=require(_0xa602('0x2'))('api');var moment=require(_0xa602('0x3'));var BPromise=require(_0xa602('0x4'));var rp=require(_0xa602('0x5'));var fs=require('fs');var path=require(_0xa602('0x6'));var rimraf=require('rimraf');var config=require(_0xa602('0x7'));var attributes=require(_0xa602('0x8'));module[_0xa602('0x9')]=function(_0x1a1ee9,_0x572716){return _0x1a1ee9[_0xa602('0xa')](_0xa602('0xb'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49b1=['chat_proactive_actions','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction'];(function(_0x5341ff,_0x1de6df){var _0x53be58=function(_0x4da0da){while(--_0x4da0da){_0x5341ff['push'](_0x5341ff['shift']());}};_0x53be58(++_0x1de6df);}(_0x49b1,0x160));var _0x149b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49b1[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x149b('0x0'));var logger=require(_0x149b('0x1'))(_0x149b('0x2'));var moment=require(_0x149b('0x3'));var BPromise=require(_0x149b('0x4'));var rp=require(_0x149b('0x5'));var fs=require('fs');var path=require(_0x149b('0x6'));var rimraf=require('rimraf');var config=require(_0x149b('0x7'));var attributes=require(_0x149b('0x8'));module[_0x149b('0x9')]=function(_0x4edec7,_0x571bbf){return _0x4edec7[_0x149b('0xa')](_0x149b('0xb'),attributes,{'tableName':_0x149b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 24a97ee..bc0b6a3 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 _0x66f1=['../../config/environment','jayson/promise','http','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x485e7b,_0x3cb71b){var _0x18404e=function(_0x1c2fae){while(--_0x1c2fae){_0x485e7b['push'](_0x485e7b['shift']());}};_0x18404e(++_0x3cb71b);}(_0x66f1,0x114));var _0x166f=function(_0x124eba,_0x22cb6b){_0x124eba=_0x124eba-0x0;var _0x2c8e35=_0x66f1[_0x124eba];return _0x2c8e35;};'use strict';var _=require(_0x166f('0x0'));var util=require('util');var moment=require(_0x166f('0x1'));var BPromise=require(_0x166f('0x2'));var rs=require(_0x166f('0x3'));var fs=require('fs');var Redis=require(_0x166f('0x4'));var db=require(_0x166f('0x5'))['db'];var utils=require(_0x166f('0x6'));var logger=require(_0x166f('0x7'))(_0x166f('0x8'));var config=require(_0x166f('0x9'));var jayson=require(_0x166f('0xa'));var client=jayson['client'][_0x166f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x329eb1,_0x3d0dcf,_0x57a5ca){return new BPromise(function(_0x1ebc23,_0x2329d){return client['request'](_0x329eb1,_0x57a5ca)['then'](function(_0x13f6dd){logger[_0x166f('0xc')](_0x166f('0xd'),_0x3d0dcf,_0x166f('0xe'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x3d0dcf,_0x166f('0xe'),JSON['stringify'](_0x13f6dd));if(_0x13f6dd[_0x166f('0xf')]){if(_0x13f6dd[_0x166f('0xf')][_0x166f('0x10')]===0x1f4){logger[_0x166f('0xf')](_0x166f('0xd'),_0x3d0dcf,_0x13f6dd[_0x166f('0xf')][_0x166f('0x11')]);return _0x2329d(_0x13f6dd[_0x166f('0xf')]['message']);}logger[_0x166f('0xf')](_0x166f('0xd'),_0x3d0dcf,_0x13f6dd[_0x166f('0xf')][_0x166f('0x11')]);return _0x1ebc23(_0x13f6dd[_0x166f('0xf')][_0x166f('0x11')]);}else{logger[_0x166f('0xc')](_0x166f('0xd'),_0x3d0dcf,_0x166f('0xe'));_0x1ebc23(_0x13f6dd[_0x166f('0x12')][_0x166f('0x11')]);}})['catch'](function(_0x5d825a){logger[_0x166f('0xf')](_0x166f('0xd'),_0x3d0dcf,_0x5d825a);_0x2329d(_0x5d825a);});});} \ No newline at end of file +var _0x9d3d=['code','message','result','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x9d3d,0x96));var _0xd9d3=function(_0x1fcb56,_0x2fa343){_0x1fcb56=_0x1fcb56-0x0;var _0x116580=_0x9d3d[_0x1fcb56];return _0x116580;};'use strict';var _=require('lodash');var util=require(_0xd9d3('0x0'));var moment=require(_0xd9d3('0x1'));var BPromise=require(_0xd9d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9d3('0x3'))['db'];var utils=require(_0xd9d3('0x4'));var logger=require(_0xd9d3('0x5'))(_0xd9d3('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd9d3('0x7')][_0xd9d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x417f9c,_0x5cf97f,_0x4e59be){return new BPromise(function(_0x41f40b,_0x49b9c4){return client[_0xd9d3('0x9')](_0x417f9c,_0x4e59be)[_0xd9d3('0xa')](function(_0x1967e1){logger[_0xd9d3('0xb')](_0xd9d3('0xc'),_0x5cf97f,_0xd9d3('0xd'));logger[_0xd9d3('0xe')](_0xd9d3('0xf'),_0x5cf97f,'request\x20sent',JSON[_0xd9d3('0x10')](_0x1967e1));if(_0x1967e1[_0xd9d3('0x11')]){if(_0x1967e1['error'][_0xd9d3('0x12')]===0x1f4){logger[_0xd9d3('0x11')](_0xd9d3('0xc'),_0x5cf97f,_0x1967e1[_0xd9d3('0x11')][_0xd9d3('0x13')]);return _0x49b9c4(_0x1967e1['error'][_0xd9d3('0x13')]);}logger[_0xd9d3('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x5cf97f,_0x1967e1[_0xd9d3('0x11')][_0xd9d3('0x13')]);return _0x41f40b(_0x1967e1[_0xd9d3('0x11')][_0xd9d3('0x13')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x5cf97f,_0xd9d3('0xd'));_0x41f40b(_0x1967e1[_0xd9d3('0x14')]['message']);}})['catch'](function(_0x3a9161){logger[_0xd9d3('0x11')](_0xd9d3('0xc'),_0x5cf97f,_0x3a9161);_0x49b9c4(_0x3a9161);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 1cf90e2..d51d9d1 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 _0x5d58=['/:id','isAuthenticated','show','create','update','delete','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x23c550,_0x7e41c4){var _0x5635b1=function(_0x68f9ce){while(--_0x68f9ce){_0x23c550['push'](_0x23c550['shift']());}};_0x5635b1(++_0x7e41c4);}(_0x5d58,0x187));var _0x85d5=function(_0x189bd5,_0x3fa4c5){_0x189bd5=_0x189bd5-0x0;var _0x1f3987=_0x5d58[_0x189bd5];return _0x1f3987;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85d5('0x0')]();var fs_extra=require(_0x85d5('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var controller=require('./chatProactiveAction.controller');router[_0x85d5('0x4')](_0x85d5('0x5'),auth[_0x85d5('0x6')](),controller[_0x85d5('0x7')]);router['post']('/',auth[_0x85d5('0x6')](),controller[_0x85d5('0x8')]);router['put'](_0x85d5('0x5'),auth['isAuthenticated'](),controller[_0x85d5('0x9')]);router[_0x85d5('0xa')](_0x85d5('0x5'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xae24=['destroy','exports','multer','path','express','Router','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x2f02d4,_0x27b24a){var _0x4b707d=function(_0x52f3ba){while(--_0x52f3ba){_0x2f02d4['push'](_0x2f02d4['shift']());}};_0x4b707d(++_0x27b24a);}(_0xae24,0x182));var _0x4ae2=function(_0x3363da,_0x30ddb1){_0x3363da=_0x3363da-0x0;var _0xe890b7=_0xae24[_0x3363da];return _0xe890b7;};'use strict';var multer=require(_0x4ae2('0x0'));var util=require('util');var path=require(_0x4ae2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ae2('0x4'));var config=require('../../config/environment');var controller=require(_0x4ae2('0x5'));router[_0x4ae2('0x6')](_0x4ae2('0x7'),auth[_0x4ae2('0x8')](),controller[_0x4ae2('0x9')]);router[_0x4ae2('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4ae2('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x4ae2('0xc')]);router[_0x4ae2('0xd')]('/:id',auth[_0x4ae2('0x8')](),controller[_0x4ae2('0xe')]);module[_0x4ae2('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 487c5e2..2d27c1b 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 _0xf4cc=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x3a9f32,_0x3092f4){var _0x473794=function(_0x5e0e8e){while(--_0x5e0e8e){_0x3a9f32['push'](_0x3a9f32['shift']());}};_0x473794(++_0x3092f4);}(_0xf4cc,0x1f4));var _0xcf4c=function(_0x382407,_0x31eef6){_0x382407=_0x382407-0x0;var _0x52655c=_0xf4cc[_0x382407];return _0x52655c;};'use strict';var Sequelize=require(_0xcf4c('0x0'));module[_0xcf4c('0x1')]={'name':{'type':Sequelize[_0xcf4c('0x2')],'unique':_0xcf4c('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcf4c('0x2')]},'timeout':{'type':Sequelize[_0xcf4c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcf4c('0x5')](_0xcf4c('0x6'),_0xcf4c('0x7'),_0xcf4c('0x8'))}}; \ No newline at end of file +var _0x0faf=['INTEGER','rrmemory','beepall','roundrobin','exports','STRING','name'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x0faf,0x107));var _0xf0fa=function(_0xdaf736,_0xd8c667){_0xdaf736=_0xdaf736-0x0;var _0x1090b3=_0x0faf[_0xdaf736];return _0x1090b3;};'use strict';var Sequelize=require('sequelize');module[_0xf0fa('0x0')]={'name':{'type':Sequelize[_0xf0fa('0x1')],'unique':_0xf0fa('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf0fa('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xf0fa('0x4'),_0xf0fa('0x5'),_0xf0fa('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index b863b9a..d5eaf18 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 _0xc07d=['every','TeamId','all','union','compact','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','isArray','getAgents','eml-format','rimraf','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','then','ChatQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','get','ChatQueues','sendStatus','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','sort','where','merge','VIRTUAL','options','include','findAll','rows','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','order','pick','ChatQueueId','filter','User','findAndCountAll','agent','chatPause','createdAt','format','%s/%s','getTeams','addTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','push','toString','SELECT'];(function(_0x2b49cc,_0x358e17){var _0x199256=function(_0x297325){while(--_0x297325){_0x2b49cc['push'](_0x2b49cc['shift']());}};_0x199256(++_0x358e17);}(_0xc07d,0xa2));var _0xdc07=function(_0x446e5a,_0x1b7c65){_0x446e5a=_0x446e5a-0x0;var _0x44d13a=_0xc07d[_0x446e5a];return _0x44d13a;};'use strict';var emlformat=require(_0xdc07('0x0'));var rimraf=require(_0xdc07('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc07('0x2'));var rp=require('request-promise');var moment=require(_0xdc07('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdc07('0x4'));var util=require('util');var path=require(_0xdc07('0x5'));var sox=require('sox');var csv=require(_0xdc07('0x6'));var ejs=require(_0xdc07('0x7'));var fs=require('fs');var fs_extra=require(_0xdc07('0x8'));var _=require(_0xdc07('0x9'));var squel=require(_0xdc07('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdc07('0xb'));var toCsv=require(_0xdc07('0x6'));var querystring=require(_0xdc07('0xc'));var Papa=require(_0xdc07('0xd'));var Redis=require(_0xdc07('0xe'));var authService=require(_0xdc07('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdc07('0x10'));var logger=require(_0xdc07('0x11'))(_0xdc07('0x12'));var utils=require(_0xdc07('0x13'));var config=require(_0xdc07('0x14'));var licenseUtil=require(_0xdc07('0x15'));var db=require(_0xdc07('0x16'))['db'];config[_0xdc07('0x17')]=_[_0xdc07('0x18')](config[_0xdc07('0x17')],{'host':_0xdc07('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc07('0x17')]));require('./chatQueue.socket')[_0xdc07('0x1a')](socket);var jayson=require(_0xdc07('0x1b'));var client=jayson[_0xdc07('0x1c')][_0xdc07('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3241d5,_0x40bf88,_0x81c2a7,_0x3966b7){return new BPromise(function(_0x272b68,_0x406bc4){var _0x5ac477=_0x3966b7||client;return _0x5ac477[_0xdc07('0x1e')](_0x3241d5,_0x81c2a7)[_0xdc07('0x1f')](function(_0x246b7b){logger['info'](_0xdc07('0x20'),_0x40bf88,'request\x20sent');logger[_0xdc07('0x21')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x40bf88,_0xdc07('0x22'),JSON['stringify'](_0x246b7b));if(_0x246b7b[_0xdc07('0x23')]){if(_0x246b7b['error'][_0xdc07('0x24')]===0x1f4){logger[_0xdc07('0x23')]('ChatQueue,\x20%s,\x20%s',_0x40bf88,_0x246b7b[_0xdc07('0x23')]['message']);return _0x406bc4(_0x246b7b[_0xdc07('0x23')][_0xdc07('0x25')]);}logger[_0xdc07('0x23')](_0xdc07('0x20'),_0x40bf88,_0x246b7b[_0xdc07('0x23')][_0xdc07('0x25')]);return _0x272b68(_0x246b7b[_0xdc07('0x23')][_0xdc07('0x25')]);}else{logger[_0xdc07('0x26')](_0xdc07('0x20'),_0x40bf88,_0xdc07('0x22'));_0x272b68(_0x246b7b['result'][_0xdc07('0x25')]);}})[_0xdc07('0x27')](function(_0x5aa0f6){logger['error'](_0xdc07('0x20'),_0x40bf88,_0x5aa0f6);_0x406bc4(_0x5aa0f6);});});}function respondWithStatusCode(_0x3a5657,_0x3b716d){_0x3b716d=_0x3b716d||0xcc;return function(_0x487e11){if(_0x487e11){return _0x3a5657['sendStatus'](_0x3b716d);}return _0x3a5657['status'](_0x3b716d)[_0xdc07('0x28')]();};}function respondWithResult(_0x6d82c6,_0x181fb4){_0x181fb4=_0x181fb4||0xc8;return function(_0x3c6d6e){if(_0x3c6d6e){return _0x6d82c6[_0xdc07('0x29')](_0x181fb4)['json'](_0x3c6d6e);}};}function respondWithFilteredResult(_0x3821e0,_0x2cc57b){return function(_0x27b9cf){if(_0x27b9cf){var _0x24e98b=typeof _0x2cc57b[_0xdc07('0x2a')]===_0xdc07('0x2b')&&typeof _0x2cc57b[_0xdc07('0x2c')]===_0xdc07('0x2b');var _0x15692f=_0x27b9cf['count'];var _0x4d50d2=_0x24e98b?0x0:_0x2cc57b['offset'];var _0x5a73a0=_0x24e98b?_0x27b9cf[_0xdc07('0x2d')]:_0x2cc57b[_0xdc07('0x2a')]+_0x2cc57b[_0xdc07('0x2c')];var _0x446be6;if(_0x5a73a0>=_0x15692f){_0x5a73a0=_0x15692f;_0x446be6=0xc8;}else{_0x446be6=0xce;}_0x3821e0[_0xdc07('0x29')](_0x446be6);return _0x3821e0[_0xdc07('0x2e')](_0xdc07('0x2f'),_0x4d50d2+'-'+_0x5a73a0+'/'+_0x15692f)[_0xdc07('0x30')](_0x27b9cf);}return null;};}function patchUpdates(_0x411570){return function(_0x3cf22f){try{jsonpatch['apply'](_0x3cf22f,_0x411570,!![]);}catch(_0x13e8da){return BPromise[_0xdc07('0x31')](_0x13e8da);}return _0x3cf22f[_0xdc07('0x32')]();};}function saveUpdates(_0x53f2e2,_0x50124e){return function(_0x126c85){if(_0x126c85){return _0x126c85[_0xdc07('0x33')](_0x53f2e2)['then'](function(_0x681550){return _0x681550;});}return null;};}function removeEntity(_0x309495,_0x76f25b){return function(_0x1dd014){if(_0x1dd014){return _0x1dd014[_0xdc07('0x34')]()['then'](function(){var _0xa2d502=_0x1dd014[_0xdc07('0x35')]({'plain':!![]});var _0x1840c8=_0xdc07('0x36');return db['UserProfileResource'][_0xdc07('0x34')]({'where':{'type':_0x1840c8,'resourceId':_0xa2d502['id']}})[_0xdc07('0x1f')](function(){return _0x1dd014;});})['then'](function(){_0x309495['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x330517,_0x2e8bbb){return function(_0xbc7276){if(!_0xbc7276){_0x330517[_0xdc07('0x37')](0x194);}return _0xbc7276;};}function handleError(_0x544d69,_0x554af9){_0x554af9=_0x554af9||0x1f4;return function(_0x10a88f){logger[_0xdc07('0x23')](_0x10a88f[_0xdc07('0x38')]);if(_0x10a88f[_0xdc07('0x39')]){delete _0x10a88f[_0xdc07('0x39')];}_0x544d69['status'](_0x554af9)[_0xdc07('0x3a')](_0x10a88f);};}exports[_0xdc07('0x3b')]=function(_0x50c058,_0x35bb80){var _0x3c44bf={},_0x3b8fcd={},_0x3f3457={'count':0x0,'rows':[]};var _0x13b496=_[_0xdc07('0x3c')](db[_0xdc07('0x3d')][_0xdc07('0x3e')],function(_0x456573){return{'name':_0x456573[_0xdc07('0x3f')],'type':_0x456573[_0xdc07('0x40')][_0xdc07('0x41')]};});_0x3b8fcd[_0xdc07('0x42')]=_[_0xdc07('0x3c')](_0x13b496,_0xdc07('0x39'));_0x3b8fcd[_0xdc07('0x43')]=_[_0xdc07('0x44')](_0x50c058['query']);_0x3b8fcd[_0xdc07('0x45')]=_['intersection'](_0x3b8fcd[_0xdc07('0x42')],_0x3b8fcd['query']);_0x3c44bf[_0xdc07('0x46')]=_[_0xdc07('0x47')](_0x3b8fcd['model'],qs[_0xdc07('0x48')](_0x50c058['query']['fields']));_0x3c44bf[_0xdc07('0x46')]=_0x3c44bf[_0xdc07('0x46')][_0xdc07('0x49')]?_0x3c44bf[_0xdc07('0x46')]:_0x3b8fcd[_0xdc07('0x42')];if(!_0x50c058['query']['hasOwnProperty']('nolimit')){_0x3c44bf['limit']=qs[_0xdc07('0x2c')](_0x50c058['query'][_0xdc07('0x2c')]);_0x3c44bf[_0xdc07('0x2a')]=qs[_0xdc07('0x2a')](_0x50c058[_0xdc07('0x43')][_0xdc07('0x2a')]);}_0x3c44bf['order']=qs[_0xdc07('0x4a')](_0x50c058['query'][_0xdc07('0x4a')]);_0x3c44bf[_0xdc07('0x4b')]=qs[_0xdc07('0x45')](_['pick'](_0x50c058[_0xdc07('0x43')],_0x3b8fcd[_0xdc07('0x45')]),_0x13b496);if(_0x50c058[_0xdc07('0x43')]['filter']){_0x3c44bf[_0xdc07('0x4b')]=_[_0xdc07('0x4c')](_0x3c44bf['where'],{'$or':_[_0xdc07('0x3c')](_0x13b496,function(_0x87bf44){if(_0x87bf44[_0xdc07('0x40')]!==_0xdc07('0x4d')){var _0x4e24fc={};_0x4e24fc[_0x87bf44['name']]={'$like':'%'+_0x50c058[_0xdc07('0x43')]['filter']+'%'};return _0x4e24fc;}})});}_0x3c44bf=_[_0xdc07('0x4c')]({},_0x3c44bf,_0x50c058[_0xdc07('0x4e')]);var _0x4c3293={'where':_0x3c44bf[_0xdc07('0x4b')]};return db[_0xdc07('0x3d')][_0xdc07('0x2d')](_0x4c3293)[_0xdc07('0x1f')](function(_0x11dc10){_0x3f3457['count']=_0x11dc10;if(_0x50c058['query']['includeAll']){_0x3c44bf[_0xdc07('0x4f')]=[{'all':!![]}];}return db[_0xdc07('0x3d')][_0xdc07('0x50')](_0x3c44bf);})[_0xdc07('0x1f')](function(_0x5086ae){_0x3f3457[_0xdc07('0x51')]=_0x5086ae;return _0x3f3457;})[_0xdc07('0x1f')](respondWithFilteredResult(_0x35bb80,_0x3c44bf))[_0xdc07('0x27')](handleError(_0x35bb80,null));};exports['show']=function(_0x49ff5f,_0x4381fe){var _0x254302={'raw':!![],'where':{'id':_0x49ff5f['params']['id']}},_0x2c6090={};_0x2c6090[_0xdc07('0x42')]=_[_0xdc07('0x44')](db[_0xdc07('0x3d')][_0xdc07('0x3e')]);_0x2c6090[_0xdc07('0x43')]=_[_0xdc07('0x44')](_0x49ff5f[_0xdc07('0x43')]);_0x2c6090[_0xdc07('0x45')]=_['intersection'](_0x2c6090[_0xdc07('0x42')],_0x2c6090['query']);_0x254302[_0xdc07('0x46')]=_['intersection'](_0x2c6090['model'],qs[_0xdc07('0x48')](_0x49ff5f[_0xdc07('0x43')]['fields']));_0x254302[_0xdc07('0x46')]=_0x254302[_0xdc07('0x46')][_0xdc07('0x49')]?_0x254302[_0xdc07('0x46')]:_0x2c6090[_0xdc07('0x42')];if(_0x49ff5f[_0xdc07('0x43')]['includeAll']){_0x254302['include']=[{'all':!![]}];}_0x254302=_[_0xdc07('0x4c')]({},_0x254302,_0x49ff5f[_0xdc07('0x4e')]);return db[_0xdc07('0x3d')]['find'](_0x254302)[_0xdc07('0x1f')](handleEntityNotFound(_0x4381fe,null))[_0xdc07('0x1f')](respondWithResult(_0x4381fe,null))[_0xdc07('0x27')](handleError(_0x4381fe,null));};exports[_0xdc07('0x52')]=function(_0x5bddb5,_0x8d9d9e){return db[_0xdc07('0x3d')][_0xdc07('0x52')](_0x5bddb5[_0xdc07('0x53')],{})[_0xdc07('0x1f')](function(_0x35c0c5){var _0x17c04e=_0x5bddb5['user']['get']({'plain':!![]});if(!_0x17c04e)throw new Error(_0xdc07('0x54'));if(_0x17c04e['role']===_0xdc07('0x55')){var _0x213aa1=_0x35c0c5[_0xdc07('0x35')]({'plain':!![]});var _0x343b9d=_0xdc07('0x36');return db[_0xdc07('0x56')][_0xdc07('0x57')]({'where':{'name':_0x343b9d,'userProfileId':_0x17c04e[_0xdc07('0x58')]},'raw':!![]})[_0xdc07('0x1f')](function(_0x4f625e){if(_0x4f625e&&_0x4f625e[_0xdc07('0x59')]===0x0){return db['UserProfileResource'][_0xdc07('0x52')]({'name':_0x213aa1[_0xdc07('0x39')],'resourceId':_0x213aa1['id'],'type':_0x4f625e[_0xdc07('0x39')],'sectionId':_0x4f625e['id']},{})[_0xdc07('0x1f')](function(){return _0x35c0c5;});}else{return _0x35c0c5;}})[_0xdc07('0x27')](function(_0x15fd28){logger[_0xdc07('0x23')](_0xdc07('0x5a'),_0x15fd28);throw _0x15fd28;});}return _0x35c0c5;})[_0xdc07('0x1f')](respondWithResult(_0x8d9d9e,0xc9))['catch'](handleError(_0x8d9d9e,null));};exports['update']=function(_0x19691e,_0x734314){if(_0x19691e['body']['id']){delete _0x19691e['body']['id'];}return db[_0xdc07('0x3d')][_0xdc07('0x57')]({'where':{'id':_0x19691e['params']['id']}})['then'](handleEntityNotFound(_0x734314,null))[_0xdc07('0x1f')](saveUpdates(_0x19691e[_0xdc07('0x53')],null))[_0xdc07('0x1f')](respondWithResult(_0x734314,null))[_0xdc07('0x27')](handleError(_0x734314,null));};exports[_0xdc07('0x34')]=function(_0x37ec92,_0x52873f){return db['ChatQueue']['find']({'where':{'id':_0x37ec92[_0xdc07('0x5b')]['id']}})[_0xdc07('0x1f')](handleEntityNotFound(_0x52873f,null))[_0xdc07('0x1f')](removeEntity(_0x52873f,null))[_0xdc07('0x27')](handleError(_0x52873f,null));};exports[_0xdc07('0x5c')]=function(_0x50da68,_0x20f658){return db[_0xdc07('0x3d')][_0xdc07('0x5c')]()[_0xdc07('0x1f')](respondWithResult(_0x20f658,null))[_0xdc07('0x27')](handleError(_0x20f658,null));};exports[_0xdc07('0x5d')]=function(_0x4771c3,_0x58be89,_0x1b2266){var _0x382ce3={'raw':!![],'where':{}},_0x54d919={},_0x25da59;return db[_0xdc07('0x3d')][_0xdc07('0x5e')]({'where':{'id':_0x4771c3[_0xdc07('0x5b')]['id']}})[_0xdc07('0x1f')](handleEntityNotFound(_0x58be89,null))['then'](function(_0x424d40){if(_0x424d40){_0x25da59=_0x424d40[_0xdc07('0x35')]({'plain':!![]});_0x54d919[_0xdc07('0x42')]=_['keys'](db[_0xdc07('0x5f')]['rawAttributes']);_0x54d919[_0xdc07('0x43')]=_[_0xdc07('0x44')](_0x4771c3['query']);_0x54d919[_0xdc07('0x45')]=_['intersection'](_0x54d919['model'],_0x54d919[_0xdc07('0x43')]);_0x382ce3[_0xdc07('0x46')]=_[_0xdc07('0x47')](_0x54d919[_0xdc07('0x42')],qs['fields'](_0x4771c3[_0xdc07('0x43')][_0xdc07('0x48')]));_0x382ce3[_0xdc07('0x46')]=_0x382ce3[_0xdc07('0x46')][_0xdc07('0x49')]?_0x382ce3[_0xdc07('0x46')]:_0x54d919[_0xdc07('0x42')];if(!_0x4771c3[_0xdc07('0x43')][_0xdc07('0x60')](_0xdc07('0x61'))){_0x382ce3[_0xdc07('0x2c')]=qs[_0xdc07('0x2c')](_0x4771c3[_0xdc07('0x43')][_0xdc07('0x2c')]);_0x382ce3['offset']=qs[_0xdc07('0x2a')](_0x4771c3[_0xdc07('0x43')]['offset']);}_0x382ce3[_0xdc07('0x62')]=qs[_0xdc07('0x4a')](_0x4771c3[_0xdc07('0x43')][_0xdc07('0x4a')]);_0x382ce3['where']=qs[_0xdc07('0x45')](_[_0xdc07('0x63')](_0x4771c3['query'],_0x54d919[_0xdc07('0x45')]));_0x382ce3['where'][_0xdc07('0x64')]=_0x424d40['id'];if(_0x4771c3[_0xdc07('0x43')][_0xdc07('0x65')]){_0x382ce3['where']=_['merge'](_0x382ce3[_0xdc07('0x4b')],{'$or':_['map'](_0x382ce3['attributes'],function(_0x2e5857){var _0x117e82={};_0x117e82[_0x2e5857]={'$like':'%'+_0x4771c3[_0xdc07('0x43')][_0xdc07('0x65')]+'%'};return _0x117e82;})});}_0x382ce3=_['merge']({},_0x382ce3,_0x4771c3['options']);return db[_0xdc07('0x5f')]['findAll'](_0x382ce3);}})['then'](function(_0x433896){if(_0x433896){return db[_0xdc07('0x66')][_0xdc07('0x67')]({'where':{'id':_['map'](_0x433896,'UserId'),'role':_0xdc07('0x68')},'attributes':['id',_0xdc07('0x39'),_0xdc07('0x69'),'updatedAt',_0xdc07('0x6a')]});}})[_0xdc07('0x1f')](function(_0x3c4db1){if(_0x3c4db1){return{'count':_0x3c4db1[_0xdc07('0x2d')],'rows':_[_0xdc07('0x3c')](_0x3c4db1[_0xdc07('0x51')],function(_0x57d5b4){return{'membername':_0x57d5b4['name'],'UserId':_0x57d5b4['id'],'queue_name':_0x25da59[_0xdc07('0x39')],'ChatQueueId':_0x25da59['id'],'interface':util[_0xdc07('0x6b')](_0xdc07('0x6c'),'SIP',_0x57d5b4[_0xdc07('0x39')]),'penalty':0x0,'paused':_0x57d5b4[_0xdc07('0x69')],'createdAt':_0x57d5b4['createdAt'],'updatedAt':_0x57d5b4['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xdc07('0x1f')](respondWithFilteredResult(_0x58be89,_0x382ce3))[_0xdc07('0x27')](handleError(_0x58be89,null));};exports['getTeams']=function(_0x212df7,_0x30a0b2,_0x38f5c7){var _0xeb8fd9={};var _0x32bf47={};var _0x1f175d;var _0x1183a3;return db['ChatQueue']['findOne']({'where':{'id':_0x212df7[_0xdc07('0x5b')]['id']}})[_0xdc07('0x1f')](handleEntityNotFound(_0x30a0b2,null))[_0xdc07('0x1f')](function(_0x21edb1){if(_0x21edb1){_0x1f175d=_0x21edb1;_0x32bf47['model']=_[_0xdc07('0x44')](db['Team'][_0xdc07('0x3e')]);_0x32bf47[_0xdc07('0x43')]=_[_0xdc07('0x44')](_0x212df7[_0xdc07('0x43')]);_0x32bf47[_0xdc07('0x45')]=_[_0xdc07('0x47')](_0x32bf47[_0xdc07('0x42')],_0x32bf47['query']);_0xeb8fd9[_0xdc07('0x46')]=_['intersection'](_0x32bf47[_0xdc07('0x42')],qs[_0xdc07('0x48')](_0x212df7['query'][_0xdc07('0x48')]));_0xeb8fd9[_0xdc07('0x46')]=_0xeb8fd9[_0xdc07('0x46')][_0xdc07('0x49')]?_0xeb8fd9[_0xdc07('0x46')]:_0x32bf47[_0xdc07('0x42')];_0xeb8fd9[_0xdc07('0x62')]=qs[_0xdc07('0x4a')](_0x212df7[_0xdc07('0x43')]['sort']);_0xeb8fd9[_0xdc07('0x4b')]=qs[_0xdc07('0x45')](_[_0xdc07('0x63')](_0x212df7[_0xdc07('0x43')],_0x32bf47[_0xdc07('0x45')]));if(_0x212df7[_0xdc07('0x43')]['filter']){_0xeb8fd9['where']=_[_0xdc07('0x4c')](_0xeb8fd9[_0xdc07('0x4b')],{'$or':_[_0xdc07('0x3c')](_0xeb8fd9[_0xdc07('0x46')],function(_0x35c5cc){var _0x3c005e={};_0x3c005e[_0x35c5cc]={'$like':'%'+_0x212df7[_0xdc07('0x43')][_0xdc07('0x65')]+'%'};return _0x3c005e;})});}_0xeb8fd9=_[_0xdc07('0x4c')]({},_0xeb8fd9,_0x212df7[_0xdc07('0x4e')]);return _0x1f175d[_0xdc07('0x6d')](_0xeb8fd9);}})['then'](function(_0x24d9ad){if(_0x24d9ad){_0x1183a3=_0x24d9ad[_0xdc07('0x49')];if(!_0x212df7[_0xdc07('0x43')][_0xdc07('0x60')](_0xdc07('0x61'))){_0xeb8fd9[_0xdc07('0x2c')]=qs[_0xdc07('0x2c')](_0x212df7[_0xdc07('0x43')][_0xdc07('0x2c')]);_0xeb8fd9[_0xdc07('0x2a')]=qs[_0xdc07('0x2a')](_0x212df7['query'][_0xdc07('0x2a')]);}return _0x1f175d['getTeams'](_0xeb8fd9);}})[_0xdc07('0x1f')](function(_0x26b645){if(_0x26b645){return _0x26b645?{'count':_0x1183a3,'rows':_0x26b645}:null;}})[_0xdc07('0x1f')](respondWithResult(_0x30a0b2,null))[_0xdc07('0x27')](handleError(_0x30a0b2,null));};exports[_0xdc07('0x6e')]=function(_0x38c5ed,_0x337f58,_0xb652a4){var _0x474216=_0x38c5ed[_0xdc07('0x53')][_0xdc07('0x6f')];return db[_0xdc07('0x70')][_0xdc07('0x50')]({'where':{'id':_0x474216},'attributes':['id'],'include':[{'model':db[_0xdc07('0x66')],'as':_0xdc07('0x71'),'attributes':['id',_0xdc07('0x39'),'online',_0xdc07('0x72'),_0xdc07('0x73')],'raw':!![]}]})['then'](function(_0x5aa893){if(_0x5aa893){var _0x12bd86=_[_0xdc07('0x74')](_0x5aa893,function(_0x50c560){var _0x37155d=_0x50c560[_0xdc07('0x35')]({'plain':!![]});return _0x37155d[_0xdc07('0x71')];});return db['ChatQueue']['find']({'where':{'id':_0x38c5ed[_0xdc07('0x5b')]['id']}})['then'](function(_0x516be7){return db[_0xdc07('0x75')][_0xdc07('0x76')](function(_0x50f527){return _0x516be7['addTeams'](_0x474216,{'transaction':_0x50f527})[_0xdc07('0x1f')](function(){return BPromise[_0xdc07('0x77')](_0x12bd86,function(_0x2803f3){return db[_0xdc07('0x5f')][_0xdc07('0x78')]({'where':{'UserId':_0x2803f3['id'],'ChatQueueId':_0x38c5ed[_0xdc07('0x5b')]['id']},'transaction':_0x50f527});});})['then'](function(){_0x12bd86[_0xdc07('0x79')](function(_0x379b90){socket['emit']('userChatQueue:save',{'UserId':_0x379b90['id'],'ChatQueueId':_0x516be7['id']});});});});});}})[_0xdc07('0x1f')](respondWithStatusCode(_0x337f58,null))[_0xdc07('0x27')](handleError(_0x337f58,null));};exports[_0xdc07('0x7a')]=function(_0x280bc1,_0x198319,_0x778403){return db[_0xdc07('0x70')]['findAll']({'where':{'id':_0x280bc1['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xdc07('0x66')],'as':_0xdc07('0x71'),'attributes':['id'],'raw':!![]}]})[_0xdc07('0x1f')](handleEntityNotFound(_0x198319,null))[_0xdc07('0x1f')](function(_0x2e61c3){var _0x17f377=_[_0xdc07('0x3c')](_0x2e61c3,'id');var _0x3c5409=[];var _0x569267=[];var _0x9e3931=squel['select']();_0x9e3931[_0xdc07('0x7b')](_0xdc07('0x7c'))[_0xdc07('0x7d')](_0xdc07('0x7e'),'tq')[_0xdc07('0x7f')](_0xdc07('0x80'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xdc07('0x4b')](_0xdc07('0x81'),_0x280bc1[_0xdc07('0x5b')]['id']);for(var _0x35e778=0x0;_0x35e778<_0x2e61c3[_0xdc07('0x49')];_0x35e778+=0x1){let _0x25eb01=_0x2e61c3[_0x35e778];for(var _0x49e051=0x0;_0x49e051<_0x25eb01[_0xdc07('0x71')]['length'];_0x49e051+=0x1){let _0x5f1f42=_0x25eb01['Agents'][_0x49e051];var _0x7d898f=_0x9e3931[_0xdc07('0x82')]();_0x7d898f[_0xdc07('0x4b')]('ut.UserId\x20=\x20?',_0x5f1f42['id']);_0x569267[_0xdc07('0x83')](db[_0xdc07('0x75')][_0xdc07('0x43')](_0x7d898f[_0xdc07('0x84')](),{'type':db[_0xdc07('0x75')]['QueryTypes'][_0xdc07('0x85')]})[_0xdc07('0x1f')](function(_0x53c648){if(_0x53c648[_0xdc07('0x49')]===0x1){return _0x5f1f42['id'];}else{var _0x13ee2b=_[_0xdc07('0x86')](_['map'](_0x53c648,_0xdc07('0x87')),function(_0x4beedf){return _['includes'](_0x17f377,_0x4beedf);});if(_0x13ee2b){return _0x5f1f42['id'];}}}));}}return BPromise[_0xdc07('0x88')](_0x569267)[_0xdc07('0x1f')](function(_0x267f19){_0x3c5409=_(_0x3c5409)[_0xdc07('0x89')](_0x267f19)[_0xdc07('0x8a')]()['value']();return db[_0xdc07('0x3d')][_0xdc07('0x57')]({'where':{'id':_0x280bc1[_0xdc07('0x5b')]['id']}})[_0xdc07('0x1f')](function(_0x29f04c){return db[_0xdc07('0x75')][_0xdc07('0x76')](function(_0x18a485){return _0x29f04c[_0xdc07('0x7a')](_0x280bc1[_0xdc07('0x43')][_0xdc07('0x6f')],{'transaction':_0x18a485})['then'](function(){if(!_['isEmpty'](_0x3c5409)){return _0x29f04c[_0xdc07('0x8b')](_0x3c5409,{'transaction':_0x18a485});}})[_0xdc07('0x1f')](function(){_0x3c5409[_0xdc07('0x79')](function(_0x3696c5){socket[_0xdc07('0x8c')](_0xdc07('0x8d'),{'UserId':_0x3696c5,'ChatQueueId':_0x29f04c['id']});});});});});});})[_0xdc07('0x1f')](respondWithStatusCode(_0x198319,null))['catch'](handleError(_0x198319,null));};exports['addAgents']=function(_0x6a1a93,_0x5684c0,_0xbefdc0){return db['ChatQueue'][_0xdc07('0x57')]({'where':{'id':_0x6a1a93[_0xdc07('0x5b')]['id']}})[_0xdc07('0x1f')](handleEntityNotFound(_0x5684c0,null))['then'](function(_0x295298){if(_0x295298){return _0x295298[_0xdc07('0x8e')](_0x6a1a93[_0xdc07('0x53')][_0xdc07('0x6f')],_[_0xdc07('0x8f')](_0x6a1a93[_0xdc07('0x53')],[_0xdc07('0x6f'),'id'])||{})[_0xdc07('0x90')](function(_0x409e77){for(var _0x379290=0x0;_0x379290<_0x6a1a93['body'][_0xdc07('0x6f')][_0xdc07('0x49')];_0x379290+=0x1){socket['emit'](_0xdc07('0x91'),{'UserId':Number(_0x6a1a93[_0xdc07('0x53')][_0xdc07('0x6f')][_0x379290]),'ChatQueueId':Number(_0x6a1a93[_0xdc07('0x5b')]['id'])});}return _0x409e77;});}})[_0xdc07('0x1f')](respondWithResult(_0x5684c0,null))[_0xdc07('0x27')](handleError(_0x5684c0,null));};exports[_0xdc07('0x8b')]=function(_0x3812fd,_0x4e11d9,_0x27b87c){return db[_0xdc07('0x3d')]['find']({'where':{'id':_0x3812fd['params']['id']}})[_0xdc07('0x1f')](handleEntityNotFound(_0x4e11d9,null))[_0xdc07('0x1f')](function(_0x3ccbc4){if(_0x3ccbc4){return _0x3ccbc4['removeAgents'](_0x3812fd['query']['ids'])[_0xdc07('0x1f')](function(){if(_[_0xdc07('0x92')](_0x3812fd['query']['ids'])){for(var _0x38a54e=0x0;_0x38a54e<_0x3812fd[_0xdc07('0x43')][_0xdc07('0x6f')][_0xdc07('0x49')];_0x38a54e+=0x1){socket[_0xdc07('0x8c')](_0xdc07('0x8d'),{'UserId':Number(_0x3812fd[_0xdc07('0x43')][_0xdc07('0x6f')][_0x38a54e]),'ChatQueueId':Number(_0x3812fd[_0xdc07('0x5b')]['id'])});}}else{socket[_0xdc07('0x8c')](_0xdc07('0x8d'),{'UserId':Number(_0x3812fd[_0xdc07('0x43')][_0xdc07('0x6f')]),'ChatQueueId':Number(_0x3812fd[_0xdc07('0x5b')]['id'])});}});}})[_0xdc07('0x1f')](respondWithStatusCode(_0x4e11d9,null))[_0xdc07('0x27')](handleError(_0x4e11d9,null));};exports['getAgents']=function(_0x220b7c,_0x41ae1b,_0x5dae67){var _0x321c87={};var _0x1dd2ab={};var _0xf318d7;var _0x11e337;return db[_0xdc07('0x3d')][_0xdc07('0x5e')]({'where':{'id':_0x220b7c[_0xdc07('0x5b')]['id']}})[_0xdc07('0x1f')](handleEntityNotFound(_0x41ae1b,null))['then'](function(_0x2e71b7){if(_0x2e71b7){_0xf318d7=_0x2e71b7;_0x1dd2ab[_0xdc07('0x42')]=_[_0xdc07('0x44')](db[_0xdc07('0x66')][_0xdc07('0x3e')]);_0x1dd2ab[_0xdc07('0x43')]=_[_0xdc07('0x44')](_0x220b7c[_0xdc07('0x43')]);_0x1dd2ab[_0xdc07('0x45')]=_[_0xdc07('0x47')](_0x1dd2ab[_0xdc07('0x42')],_0x1dd2ab[_0xdc07('0x43')]);_0x321c87[_0xdc07('0x46')]=_['intersection'](_0x1dd2ab[_0xdc07('0x42')],qs[_0xdc07('0x48')](_0x220b7c['query']['fields']));_0x321c87[_0xdc07('0x46')]=_0x321c87[_0xdc07('0x46')][_0xdc07('0x49')]?_0x321c87[_0xdc07('0x46')]:_0x1dd2ab[_0xdc07('0x42')];_0x321c87[_0xdc07('0x62')]=qs[_0xdc07('0x4a')](_0x220b7c[_0xdc07('0x43')]['sort']);_0x321c87['where']=qs[_0xdc07('0x45')](_[_0xdc07('0x63')](_0x220b7c[_0xdc07('0x43')],_0x1dd2ab['filters']));if(_0x220b7c[_0xdc07('0x43')][_0xdc07('0x65')]){_0x321c87['where']=_[_0xdc07('0x4c')](_0x321c87[_0xdc07('0x4b')],{'$or':_[_0xdc07('0x3c')](_0x321c87[_0xdc07('0x46')],function(_0x4b9549){var _0x2ad90b={};_0x2ad90b[_0x4b9549]={'$like':'%'+_0x220b7c['query'][_0xdc07('0x65')]+'%'};return _0x2ad90b;})});}_0x321c87=_['merge']({},_0x321c87,_0x220b7c[_0xdc07('0x4e')]);return _0xf318d7[_0xdc07('0x93')](_0x321c87);}})['then'](function(_0x76fe99){if(_0x76fe99){_0x11e337=_0x76fe99['length'];if(!_0x220b7c[_0xdc07('0x43')]['hasOwnProperty'](_0xdc07('0x61'))){_0x321c87[_0xdc07('0x2c')]=qs['limit'](_0x220b7c[_0xdc07('0x43')][_0xdc07('0x2c')]);_0x321c87['offset']=qs[_0xdc07('0x2a')](_0x220b7c[_0xdc07('0x43')][_0xdc07('0x2a')]);}return _0xf318d7[_0xdc07('0x93')](_0x321c87);}})[_0xdc07('0x1f')](function(_0x400ba2){if(_0x400ba2){return _0x400ba2?{'count':_0x11e337,'rows':_0x400ba2}:null;}})[_0xdc07('0x1f')](respondWithResult(_0x41ae1b,null))['catch'](handleError(_0x41ae1b,null));}; \ No newline at end of file +var _0x39c4=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatQueue.socket','register','client','http','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','offset','undefined','count','set','Content-Range','json','reject','save','update','destroy','ChatQueues','UserProfileResource','sendStatus','name','send','index','map','ChatQueue','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','show','params','find','create','user','get','UserProfileSection','userProfileId','body','describe','nolimit','UserChatQueue','User','agent','chatPause','updatedAt','rows','format','%s/%s','SIP','getTeams','Team','rawAttributes','pick','addTeams','ids','findAll','Agents','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','isEmpty','removeAgents','omit','spread','isArray','userChatQueue:remove','getAgents','findOne','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x1e9713,_0x115f99){var _0x310d43=function(_0x392890){while(--_0x392890){_0x1e9713['push'](_0x1e9713['shift']());}};_0x310d43(++_0x115f99);}(_0x39c4,0x81));var _0x439c=function(_0x668fdd,_0x32efd3){_0x668fdd=_0x668fdd-0x0;var _0x392397=_0x39c4[_0x668fdd];return _0x392397;};'use strict';var emlformat=require(_0x439c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x439c('0x1'));var jsonpatch=require(_0x439c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x439c('0x3'));var Mustache=require('mustache');var util=require(_0x439c('0x4'));var path=require(_0x439c('0x5'));var sox=require(_0x439c('0x6'));var csv=require(_0x439c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x439c('0x8'));var _=require(_0x439c('0x9'));var squel=require(_0x439c('0xa'));var crypto=require(_0x439c('0xb'));var jsforce=require(_0x439c('0xc'));var deskjs=require(_0x439c('0xd'));var toCsv=require(_0x439c('0x7'));var querystring=require(_0x439c('0xe'));var Papa=require(_0x439c('0xf'));var Redis=require('ioredis');var authService=require(_0x439c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x439c('0x11'));var hardwareService=require(_0x439c('0x12'));var logger=require('../../config/logger')(_0x439c('0x13'));var utils=require(_0x439c('0x14'));var config=require(_0x439c('0x15'));var licenseUtil=require(_0x439c('0x16'));var db=require(_0x439c('0x17'))['db'];config['redis']=_[_0x439c('0x18')](config[_0x439c('0x19')],{'host':_0x439c('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x439c('0x19')]));require(_0x439c('0x1b'))[_0x439c('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x439c('0x1d')][_0x439c('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x29bb42,_0x951589,_0x3fd41a,_0x11d217){return new BPromise(function(_0x33720d,_0x2e4e53){var _0x32af8b=_0x11d217||client;return _0x32af8b['request'](_0x29bb42,_0x3fd41a)[_0x439c('0x1f')](function(_0x4dbe12){logger['info'](_0x439c('0x20'),_0x951589,_0x439c('0x21'));logger[_0x439c('0x22')](_0x439c('0x23'),_0x951589,_0x439c('0x21'),JSON[_0x439c('0x24')](_0x4dbe12));if(_0x4dbe12['error']){if(_0x4dbe12[_0x439c('0x25')][_0x439c('0x26')]===0x1f4){logger['error'](_0x439c('0x20'),_0x951589,_0x4dbe12[_0x439c('0x25')]['message']);return _0x2e4e53(_0x4dbe12[_0x439c('0x25')][_0x439c('0x27')]);}logger[_0x439c('0x25')](_0x439c('0x20'),_0x951589,_0x4dbe12[_0x439c('0x25')][_0x439c('0x27')]);return _0x33720d(_0x4dbe12['error'][_0x439c('0x27')]);}else{logger[_0x439c('0x28')](_0x439c('0x20'),_0x951589,_0x439c('0x21'));_0x33720d(_0x4dbe12[_0x439c('0x29')]['message']);}})[_0x439c('0x2a')](function(_0x564cc0){logger[_0x439c('0x25')]('ChatQueue,\x20%s,\x20%s',_0x951589,_0x564cc0);_0x2e4e53(_0x564cc0);});});}function respondWithStatusCode(_0x1cec89,_0x2093e6){_0x2093e6=_0x2093e6||0xcc;return function(_0x3d5d0d){if(_0x3d5d0d){return _0x1cec89['sendStatus'](_0x2093e6);}return _0x1cec89[_0x439c('0x2b')](_0x2093e6)[_0x439c('0x2c')]();};}function respondWithResult(_0x1854f7,_0x158aff){_0x158aff=_0x158aff||0xc8;return function(_0x3b4816){if(_0x3b4816){return _0x1854f7[_0x439c('0x2b')](_0x158aff)['json'](_0x3b4816);}};}function respondWithFilteredResult(_0x437e46,_0x368ed0){return function(_0x2304ac){if(_0x2304ac){var _0x5e934b=typeof _0x368ed0[_0x439c('0x2d')]==='undefined'&&typeof _0x368ed0['limit']===_0x439c('0x2e');var _0x2dbced=_0x2304ac[_0x439c('0x2f')];var _0x4f1389=_0x5e934b?0x0:_0x368ed0[_0x439c('0x2d')];var _0x398e7d=_0x5e934b?_0x2304ac[_0x439c('0x2f')]:_0x368ed0[_0x439c('0x2d')]+_0x368ed0['limit'];var _0x4a096b;if(_0x398e7d>=_0x2dbced){_0x398e7d=_0x2dbced;_0x4a096b=0xc8;}else{_0x4a096b=0xce;}_0x437e46[_0x439c('0x2b')](_0x4a096b);return _0x437e46[_0x439c('0x30')](_0x439c('0x31'),_0x4f1389+'-'+_0x398e7d+'/'+_0x2dbced)[_0x439c('0x32')](_0x2304ac);}return null;};}function patchUpdates(_0x5d2664){return function(_0xf9ff64){try{jsonpatch['apply'](_0xf9ff64,_0x5d2664,!![]);}catch(_0x57a86b){return BPromise[_0x439c('0x33')](_0x57a86b);}return _0xf9ff64[_0x439c('0x34')]();};}function saveUpdates(_0x84cf0c,_0x3fabfe){return function(_0x24e372){if(_0x24e372){return _0x24e372[_0x439c('0x35')](_0x84cf0c)[_0x439c('0x1f')](function(_0x8273ac){return _0x8273ac;});}return null;};}function removeEntity(_0x2971e8,_0x52e68e){return function(_0x225166){if(_0x225166){return _0x225166[_0x439c('0x36')]()[_0x439c('0x1f')](function(){var _0x2be281=_0x225166['get']({'plain':!![]});var _0x376b13=_0x439c('0x37');return db[_0x439c('0x38')][_0x439c('0x36')]({'where':{'type':_0x376b13,'resourceId':_0x2be281['id']}})[_0x439c('0x1f')](function(){return _0x225166;});})[_0x439c('0x1f')](function(){_0x2971e8[_0x439c('0x2b')](0xcc)[_0x439c('0x2c')]();});}};}function handleEntityNotFound(_0x4f6d6c,_0x44e908){return function(_0x500b68){if(!_0x500b68){_0x4f6d6c[_0x439c('0x39')](0x194);}return _0x500b68;};}function handleError(_0x4bdbbf,_0x3b0cbc){_0x3b0cbc=_0x3b0cbc||0x1f4;return function(_0xb0f465){logger[_0x439c('0x25')](_0xb0f465['stack']);if(_0xb0f465['name']){delete _0xb0f465[_0x439c('0x3a')];}_0x4bdbbf[_0x439c('0x2b')](_0x3b0cbc)[_0x439c('0x3b')](_0xb0f465);};}exports[_0x439c('0x3c')]=function(_0x55ada1,_0x483387){var _0xa02bc1={},_0x358c0f={},_0x6b2d46={'count':0x0,'rows':[]};var _0x1add3f=_[_0x439c('0x3d')](db[_0x439c('0x3e')]['rawAttributes'],function(_0x5dcd33){return{'name':_0x5dcd33[_0x439c('0x3f')],'type':_0x5dcd33[_0x439c('0x40')]['key']};});_0x358c0f[_0x439c('0x41')]=_['map'](_0x1add3f,_0x439c('0x3a'));_0x358c0f['query']=_[_0x439c('0x42')](_0x55ada1[_0x439c('0x43')]);_0x358c0f[_0x439c('0x44')]=_[_0x439c('0x45')](_0x358c0f[_0x439c('0x41')],_0x358c0f[_0x439c('0x43')]);_0xa02bc1['attributes']=_[_0x439c('0x45')](_0x358c0f['model'],qs[_0x439c('0x46')](_0x55ada1[_0x439c('0x43')][_0x439c('0x46')]));_0xa02bc1['attributes']=_0xa02bc1[_0x439c('0x47')][_0x439c('0x48')]?_0xa02bc1[_0x439c('0x47')]:_0x358c0f[_0x439c('0x41')];if(!_0x55ada1[_0x439c('0x43')][_0x439c('0x49')]('nolimit')){_0xa02bc1[_0x439c('0x4a')]=qs['limit'](_0x55ada1[_0x439c('0x43')][_0x439c('0x4a')]);_0xa02bc1[_0x439c('0x2d')]=qs[_0x439c('0x2d')](_0x55ada1[_0x439c('0x43')][_0x439c('0x2d')]);}_0xa02bc1[_0x439c('0x4b')]=qs['sort'](_0x55ada1[_0x439c('0x43')][_0x439c('0x4c')]);_0xa02bc1['where']=qs[_0x439c('0x44')](_['pick'](_0x55ada1['query'],_0x358c0f[_0x439c('0x44')]),_0x1add3f);if(_0x55ada1[_0x439c('0x43')]['filter']){_0xa02bc1[_0x439c('0x4d')]=_[_0x439c('0x4e')](_0xa02bc1[_0x439c('0x4d')],{'$or':_[_0x439c('0x3d')](_0x1add3f,function(_0x5a3af7){if(_0x5a3af7[_0x439c('0x40')]!==_0x439c('0x4f')){var _0x1a3ea8={};_0x1a3ea8[_0x5a3af7[_0x439c('0x3a')]]={'$like':'%'+_0x55ada1['query'][_0x439c('0x50')]+'%'};return _0x1a3ea8;}})});}_0xa02bc1=_['merge']({},_0xa02bc1,_0x55ada1[_0x439c('0x51')]);var _0x29cd7c={'where':_0xa02bc1['where']};return db[_0x439c('0x3e')]['count'](_0x29cd7c)[_0x439c('0x1f')](function(_0x45f25b){_0x6b2d46[_0x439c('0x2f')]=_0x45f25b;if(_0x55ada1[_0x439c('0x43')][_0x439c('0x52')]){_0xa02bc1[_0x439c('0x53')]=[{'all':!![]}];}return db[_0x439c('0x3e')]['findAll'](_0xa02bc1);})[_0x439c('0x1f')](function(_0x49af5b){_0x6b2d46['rows']=_0x49af5b;return _0x6b2d46;})[_0x439c('0x1f')](respondWithFilteredResult(_0x483387,_0xa02bc1))[_0x439c('0x2a')](handleError(_0x483387,null));};exports[_0x439c('0x54')]=function(_0xa40c8e,_0x45eab8){var _0x5029dc={'raw':!![],'where':{'id':_0xa40c8e[_0x439c('0x55')]['id']}},_0x15d486={};_0x15d486[_0x439c('0x41')]=_[_0x439c('0x42')](db[_0x439c('0x3e')]['rawAttributes']);_0x15d486['query']=_[_0x439c('0x42')](_0xa40c8e[_0x439c('0x43')]);_0x15d486['filters']=_['intersection'](_0x15d486[_0x439c('0x41')],_0x15d486[_0x439c('0x43')]);_0x5029dc[_0x439c('0x47')]=_[_0x439c('0x45')](_0x15d486[_0x439c('0x41')],qs[_0x439c('0x46')](_0xa40c8e['query']['fields']));_0x5029dc[_0x439c('0x47')]=_0x5029dc[_0x439c('0x47')][_0x439c('0x48')]?_0x5029dc[_0x439c('0x47')]:_0x15d486[_0x439c('0x41')];if(_0xa40c8e[_0x439c('0x43')][_0x439c('0x52')]){_0x5029dc[_0x439c('0x53')]=[{'all':!![]}];}_0x5029dc=_[_0x439c('0x4e')]({},_0x5029dc,_0xa40c8e[_0x439c('0x51')]);return db[_0x439c('0x3e')][_0x439c('0x56')](_0x5029dc)[_0x439c('0x1f')](handleEntityNotFound(_0x45eab8,null))[_0x439c('0x1f')](respondWithResult(_0x45eab8,null))['catch'](handleError(_0x45eab8,null));};exports['create']=function(_0x1a2959,_0xa9cb07){return db[_0x439c('0x3e')][_0x439c('0x57')](_0x1a2959['body'],{})[_0x439c('0x1f')](function(_0xc34f44){var _0x1cc017=_0x1a2959[_0x439c('0x58')][_0x439c('0x59')]({'plain':!![]});if(!_0x1cc017)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1cc017['role']===_0x439c('0x58')){var _0x22c290=_0xc34f44[_0x439c('0x59')]({'plain':!![]});var _0x2152a1=_0x439c('0x37');return db[_0x439c('0x5a')][_0x439c('0x56')]({'where':{'name':_0x2152a1,'userProfileId':_0x1cc017[_0x439c('0x5b')]},'raw':!![]})['then'](function(_0x4f7686){if(_0x4f7686&&_0x4f7686['autoAssociation']===0x0){return db['UserProfileResource'][_0x439c('0x57')]({'name':_0x22c290[_0x439c('0x3a')],'resourceId':_0x22c290['id'],'type':_0x4f7686['name'],'sectionId':_0x4f7686['id']},{})['then'](function(){return _0xc34f44;});}else{return _0xc34f44;}})['catch'](function(_0x4c7285){logger[_0x439c('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7285);throw _0x4c7285;});}return _0xc34f44;})['then'](respondWithResult(_0xa9cb07,0xc9))[_0x439c('0x2a')](handleError(_0xa9cb07,null));};exports[_0x439c('0x35')]=function(_0x9d09a5,_0x3ee18f){if(_0x9d09a5[_0x439c('0x5c')]['id']){delete _0x9d09a5[_0x439c('0x5c')]['id'];}return db[_0x439c('0x3e')][_0x439c('0x56')]({'where':{'id':_0x9d09a5[_0x439c('0x55')]['id']}})[_0x439c('0x1f')](handleEntityNotFound(_0x3ee18f,null))['then'](saveUpdates(_0x9d09a5['body'],null))[_0x439c('0x1f')](respondWithResult(_0x3ee18f,null))[_0x439c('0x2a')](handleError(_0x3ee18f,null));};exports[_0x439c('0x36')]=function(_0x25cd97,_0x36d2ef){return db[_0x439c('0x3e')][_0x439c('0x56')]({'where':{'id':_0x25cd97[_0x439c('0x55')]['id']}})[_0x439c('0x1f')](handleEntityNotFound(_0x36d2ef,null))[_0x439c('0x1f')](removeEntity(_0x36d2ef,null))['catch'](handleError(_0x36d2ef,null));};exports[_0x439c('0x5d')]=function(_0x35c1b4,_0x2dba1f){return db[_0x439c('0x3e')][_0x439c('0x5d')]()[_0x439c('0x1f')](respondWithResult(_0x2dba1f,null))['catch'](handleError(_0x2dba1f,null));};exports['getMembers']=function(_0x76d2d1,_0x32d54,_0x1caf2b){var _0x17f100={'raw':!![],'where':{}},_0x547721={},_0x43d4bd;return db[_0x439c('0x3e')]['findOne']({'where':{'id':_0x76d2d1[_0x439c('0x55')]['id']}})[_0x439c('0x1f')](handleEntityNotFound(_0x32d54,null))[_0x439c('0x1f')](function(_0x405a9f){if(_0x405a9f){_0x43d4bd=_0x405a9f['get']({'plain':!![]});_0x547721[_0x439c('0x41')]=_['keys'](db['UserChatQueue']['rawAttributes']);_0x547721[_0x439c('0x43')]=_[_0x439c('0x42')](_0x76d2d1[_0x439c('0x43')]);_0x547721['filters']=_[_0x439c('0x45')](_0x547721[_0x439c('0x41')],_0x547721['query']);_0x17f100[_0x439c('0x47')]=_[_0x439c('0x45')](_0x547721[_0x439c('0x41')],qs['fields'](_0x76d2d1[_0x439c('0x43')][_0x439c('0x46')]));_0x17f100[_0x439c('0x47')]=_0x17f100[_0x439c('0x47')][_0x439c('0x48')]?_0x17f100[_0x439c('0x47')]:_0x547721[_0x439c('0x41')];if(!_0x76d2d1[_0x439c('0x43')]['hasOwnProperty'](_0x439c('0x5e'))){_0x17f100[_0x439c('0x4a')]=qs[_0x439c('0x4a')](_0x76d2d1['query'][_0x439c('0x4a')]);_0x17f100[_0x439c('0x2d')]=qs[_0x439c('0x2d')](_0x76d2d1['query']['offset']);}_0x17f100[_0x439c('0x4b')]=qs[_0x439c('0x4c')](_0x76d2d1[_0x439c('0x43')][_0x439c('0x4c')]);_0x17f100[_0x439c('0x4d')]=qs[_0x439c('0x44')](_['pick'](_0x76d2d1[_0x439c('0x43')],_0x547721[_0x439c('0x44')]));_0x17f100[_0x439c('0x4d')]['ChatQueueId']=_0x405a9f['id'];if(_0x76d2d1[_0x439c('0x43')][_0x439c('0x50')]){_0x17f100[_0x439c('0x4d')]=_[_0x439c('0x4e')](_0x17f100['where'],{'$or':_['map'](_0x17f100[_0x439c('0x47')],function(_0x12ce3c){var _0x426fc7={};_0x426fc7[_0x12ce3c]={'$like':'%'+_0x76d2d1[_0x439c('0x43')][_0x439c('0x50')]+'%'};return _0x426fc7;})});}_0x17f100=_[_0x439c('0x4e')]({},_0x17f100,_0x76d2d1[_0x439c('0x51')]);return db[_0x439c('0x5f')]['findAll'](_0x17f100);}})[_0x439c('0x1f')](function(_0x51ebf3){if(_0x51ebf3){return db[_0x439c('0x60')]['findAndCountAll']({'where':{'id':_[_0x439c('0x3d')](_0x51ebf3,'UserId'),'role':_0x439c('0x61')},'attributes':['id',_0x439c('0x3a'),_0x439c('0x62'),_0x439c('0x63'),'createdAt']});}})[_0x439c('0x1f')](function(_0x51dd50){if(_0x51dd50){return{'count':_0x51dd50[_0x439c('0x2f')],'rows':_['map'](_0x51dd50[_0x439c('0x64')],function(_0x40bbf4){return{'membername':_0x40bbf4[_0x439c('0x3a')],'UserId':_0x40bbf4['id'],'queue_name':_0x43d4bd[_0x439c('0x3a')],'ChatQueueId':_0x43d4bd['id'],'interface':util[_0x439c('0x65')](_0x439c('0x66'),_0x439c('0x67'),_0x40bbf4[_0x439c('0x3a')]),'penalty':0x0,'paused':_0x40bbf4[_0x439c('0x62')],'createdAt':_0x40bbf4['createdAt'],'updatedAt':_0x40bbf4[_0x439c('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x439c('0x1f')](respondWithFilteredResult(_0x32d54,_0x17f100))['catch'](handleError(_0x32d54,null));};exports[_0x439c('0x68')]=function(_0x370473,_0x2ab6ef,_0x5774c4){var _0x5d559e={};var _0x5e0490={};var _0x42b153;var _0x11c250;return db[_0x439c('0x3e')]['findOne']({'where':{'id':_0x370473[_0x439c('0x55')]['id']}})[_0x439c('0x1f')](handleEntityNotFound(_0x2ab6ef,null))[_0x439c('0x1f')](function(_0x51f799){if(_0x51f799){_0x42b153=_0x51f799;_0x5e0490['model']=_[_0x439c('0x42')](db[_0x439c('0x69')][_0x439c('0x6a')]);_0x5e0490[_0x439c('0x43')]=_['keys'](_0x370473[_0x439c('0x43')]);_0x5e0490[_0x439c('0x44')]=_[_0x439c('0x45')](_0x5e0490[_0x439c('0x41')],_0x5e0490['query']);_0x5d559e[_0x439c('0x47')]=_[_0x439c('0x45')](_0x5e0490[_0x439c('0x41')],qs['fields'](_0x370473[_0x439c('0x43')][_0x439c('0x46')]));_0x5d559e[_0x439c('0x47')]=_0x5d559e['attributes']['length']?_0x5d559e[_0x439c('0x47')]:_0x5e0490[_0x439c('0x41')];_0x5d559e[_0x439c('0x4b')]=qs[_0x439c('0x4c')](_0x370473['query'][_0x439c('0x4c')]);_0x5d559e['where']=qs[_0x439c('0x44')](_[_0x439c('0x6b')](_0x370473[_0x439c('0x43')],_0x5e0490[_0x439c('0x44')]));if(_0x370473[_0x439c('0x43')]['filter']){_0x5d559e[_0x439c('0x4d')]=_['merge'](_0x5d559e[_0x439c('0x4d')],{'$or':_['map'](_0x5d559e['attributes'],function(_0x24881c){var _0x4238c4={};_0x4238c4[_0x24881c]={'$like':'%'+_0x370473[_0x439c('0x43')][_0x439c('0x50')]+'%'};return _0x4238c4;})});}_0x5d559e=_[_0x439c('0x4e')]({},_0x5d559e,_0x370473['options']);return _0x42b153[_0x439c('0x68')](_0x5d559e);}})[_0x439c('0x1f')](function(_0x2ed820){if(_0x2ed820){_0x11c250=_0x2ed820[_0x439c('0x48')];if(!_0x370473[_0x439c('0x43')][_0x439c('0x49')](_0x439c('0x5e'))){_0x5d559e[_0x439c('0x4a')]=qs['limit'](_0x370473[_0x439c('0x43')][_0x439c('0x4a')]);_0x5d559e['offset']=qs[_0x439c('0x2d')](_0x370473[_0x439c('0x43')]['offset']);}return _0x42b153[_0x439c('0x68')](_0x5d559e);}})[_0x439c('0x1f')](function(_0x39c17f){if(_0x39c17f){return _0x39c17f?{'count':_0x11c250,'rows':_0x39c17f}:null;}})[_0x439c('0x1f')](respondWithResult(_0x2ab6ef,null))[_0x439c('0x2a')](handleError(_0x2ab6ef,null));};exports[_0x439c('0x6c')]=function(_0x410e8a,_0x2f0e44,_0x445d48){var _0x39e202=_0x410e8a[_0x439c('0x5c')][_0x439c('0x6d')];return db[_0x439c('0x69')][_0x439c('0x6e')]({'where':{'id':_0x39e202},'attributes':['id'],'include':[{'model':db[_0x439c('0x60')],'as':_0x439c('0x6f'),'attributes':['id',_0x439c('0x3a'),'online',_0x439c('0x70'),_0x439c('0x71')],'raw':!![]}]})['then'](function(_0x283ffd){if(_0x283ffd){var _0x4bb2b6=_[_0x439c('0x72')](_0x283ffd,function(_0x27dcbc){var _0x44d0dd=_0x27dcbc[_0x439c('0x59')]({'plain':!![]});return _0x44d0dd[_0x439c('0x6f')];});return db[_0x439c('0x3e')][_0x439c('0x56')]({'where':{'id':_0x410e8a[_0x439c('0x55')]['id']}})[_0x439c('0x1f')](function(_0x398506){return db['sequelize'][_0x439c('0x73')](function(_0x10265a){return _0x398506[_0x439c('0x6c')](_0x39e202,{'transaction':_0x10265a})[_0x439c('0x1f')](function(){return BPromise[_0x439c('0x74')](_0x4bb2b6,function(_0x5dfd2b){return db['UserChatQueue'][_0x439c('0x75')]({'where':{'UserId':_0x5dfd2b['id'],'ChatQueueId':_0x410e8a[_0x439c('0x55')]['id']},'transaction':_0x10265a});});})[_0x439c('0x1f')](function(){_0x4bb2b6[_0x439c('0x76')](function(_0x2a9e2e){socket[_0x439c('0x77')](_0x439c('0x78'),{'UserId':_0x2a9e2e['id'],'ChatQueueId':_0x398506['id']});});});});});}})[_0x439c('0x1f')](respondWithStatusCode(_0x2f0e44,null))[_0x439c('0x2a')](handleError(_0x2f0e44,null));};exports[_0x439c('0x79')]=function(_0x49a974,_0x28cd86,_0x3c6701){return db[_0x439c('0x69')]['findAll']({'where':{'id':_0x49a974[_0x439c('0x43')][_0x439c('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x439c('0x60')],'as':_0x439c('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x439c('0x1f')](handleEntityNotFound(_0x28cd86,null))[_0x439c('0x1f')](function(_0x20daab){var _0x171645=_['map'](_0x20daab,'id');var _0x4a31e4=[];var _0x12f008=[];var _0xe30492=squel['select']();_0xe30492['field'](_0x439c('0x7a'))[_0x439c('0x7b')](_0x439c('0x7c'),'tq')[_0x439c('0x7d')](_0x439c('0x7e'),'ut',_0x439c('0x7f'))[_0x439c('0x4d')](_0x439c('0x80'),_0x49a974[_0x439c('0x55')]['id']);for(var _0x1bb590=0x0;_0x1bb590<_0x20daab[_0x439c('0x48')];_0x1bb590+=0x1){let _0x440a24=_0x20daab[_0x1bb590];for(var _0x19c38a=0x0;_0x19c38a<_0x440a24[_0x439c('0x6f')][_0x439c('0x48')];_0x19c38a+=0x1){let _0x304b04=_0x440a24[_0x439c('0x6f')][_0x19c38a];var _0x3f636e=_0xe30492[_0x439c('0x81')]();_0x3f636e[_0x439c('0x4d')](_0x439c('0x82'),_0x304b04['id']);_0x12f008[_0x439c('0x83')](db[_0x439c('0x84')]['query'](_0x3f636e[_0x439c('0x85')](),{'type':db[_0x439c('0x84')][_0x439c('0x86')][_0x439c('0x87')]})[_0x439c('0x1f')](function(_0x1a2853){if(_0x1a2853[_0x439c('0x48')]===0x1){return _0x304b04['id'];}else{var _0x24f902=_[_0x439c('0x88')](_[_0x439c('0x3d')](_0x1a2853,_0x439c('0x89')),function(_0x4344bc){return _['includes'](_0x171645,_0x4344bc);});if(_0x24f902){return _0x304b04['id'];}}}));}}return BPromise[_0x439c('0x8a')](_0x12f008)['then'](function(_0x273af5){_0x4a31e4=_(_0x4a31e4)['union'](_0x273af5)[_0x439c('0x8b')]()[_0x439c('0x8c')]();return db[_0x439c('0x3e')]['find']({'where':{'id':_0x49a974[_0x439c('0x55')]['id']}})['then'](function(_0x4407e2){return db[_0x439c('0x84')]['transaction'](function(_0x52f27b){return _0x4407e2['removeTeams'](_0x49a974['query'][_0x439c('0x6d')],{'transaction':_0x52f27b})[_0x439c('0x1f')](function(){if(!_[_0x439c('0x8d')](_0x4a31e4)){return _0x4407e2[_0x439c('0x8e')](_0x4a31e4,{'transaction':_0x52f27b});}})[_0x439c('0x1f')](function(){_0x4a31e4[_0x439c('0x76')](function(_0x2548ce){socket['emit']('userChatQueue:remove',{'UserId':_0x2548ce,'ChatQueueId':_0x4407e2['id']});});});});});});})[_0x439c('0x1f')](respondWithStatusCode(_0x28cd86,null))[_0x439c('0x2a')](handleError(_0x28cd86,null));};exports['addAgents']=function(_0x1dc360,_0x3ede20,_0x24e92d){return db[_0x439c('0x3e')]['find']({'where':{'id':_0x1dc360[_0x439c('0x55')]['id']}})[_0x439c('0x1f')](handleEntityNotFound(_0x3ede20,null))[_0x439c('0x1f')](function(_0x11671b){if(_0x11671b){return _0x11671b['addAgents'](_0x1dc360['body'][_0x439c('0x6d')],_[_0x439c('0x8f')](_0x1dc360[_0x439c('0x5c')],[_0x439c('0x6d'),'id'])||{})[_0x439c('0x90')](function(_0x1a9c58){for(var _0x4dbcd0=0x0;_0x4dbcd0<_0x1dc360[_0x439c('0x5c')][_0x439c('0x6d')][_0x439c('0x48')];_0x4dbcd0+=0x1){socket[_0x439c('0x77')](_0x439c('0x78'),{'UserId':Number(_0x1dc360[_0x439c('0x5c')][_0x439c('0x6d')][_0x4dbcd0]),'ChatQueueId':Number(_0x1dc360[_0x439c('0x55')]['id'])});}return _0x1a9c58;});}})[_0x439c('0x1f')](respondWithResult(_0x3ede20,null))[_0x439c('0x2a')](handleError(_0x3ede20,null));};exports[_0x439c('0x8e')]=function(_0x47fd4,_0x29f14c,_0x20c9c6){return db['ChatQueue'][_0x439c('0x56')]({'where':{'id':_0x47fd4[_0x439c('0x55')]['id']}})[_0x439c('0x1f')](handleEntityNotFound(_0x29f14c,null))[_0x439c('0x1f')](function(_0x1024c3){if(_0x1024c3){return _0x1024c3[_0x439c('0x8e')](_0x47fd4[_0x439c('0x43')][_0x439c('0x6d')])[_0x439c('0x1f')](function(){if(_[_0x439c('0x91')](_0x47fd4[_0x439c('0x43')]['ids'])){for(var _0x2a025b=0x0;_0x2a025b<_0x47fd4[_0x439c('0x43')][_0x439c('0x6d')]['length'];_0x2a025b+=0x1){socket[_0x439c('0x77')](_0x439c('0x92'),{'UserId':Number(_0x47fd4[_0x439c('0x43')]['ids'][_0x2a025b]),'ChatQueueId':Number(_0x47fd4['params']['id'])});}}else{socket[_0x439c('0x77')](_0x439c('0x92'),{'UserId':Number(_0x47fd4[_0x439c('0x43')][_0x439c('0x6d')]),'ChatQueueId':Number(_0x47fd4[_0x439c('0x55')]['id'])});}});}})[_0x439c('0x1f')](respondWithStatusCode(_0x29f14c,null))[_0x439c('0x2a')](handleError(_0x29f14c,null));};exports[_0x439c('0x93')]=function(_0x17781f,_0x50c086,_0x1a1880){var _0x155ca2={};var _0x553e89={};var _0x36a7ea;var _0x31871f;return db['ChatQueue'][_0x439c('0x94')]({'where':{'id':_0x17781f[_0x439c('0x55')]['id']}})[_0x439c('0x1f')](handleEntityNotFound(_0x50c086,null))[_0x439c('0x1f')](function(_0x4198a4){if(_0x4198a4){_0x36a7ea=_0x4198a4;_0x553e89[_0x439c('0x41')]=_[_0x439c('0x42')](db[_0x439c('0x60')][_0x439c('0x6a')]);_0x553e89[_0x439c('0x43')]=_[_0x439c('0x42')](_0x17781f[_0x439c('0x43')]);_0x553e89[_0x439c('0x44')]=_['intersection'](_0x553e89[_0x439c('0x41')],_0x553e89[_0x439c('0x43')]);_0x155ca2[_0x439c('0x47')]=_[_0x439c('0x45')](_0x553e89['model'],qs[_0x439c('0x46')](_0x17781f[_0x439c('0x43')][_0x439c('0x46')]));_0x155ca2[_0x439c('0x47')]=_0x155ca2[_0x439c('0x47')]['length']?_0x155ca2[_0x439c('0x47')]:_0x553e89[_0x439c('0x41')];_0x155ca2['order']=qs[_0x439c('0x4c')](_0x17781f[_0x439c('0x43')][_0x439c('0x4c')]);_0x155ca2[_0x439c('0x4d')]=qs[_0x439c('0x44')](_[_0x439c('0x6b')](_0x17781f[_0x439c('0x43')],_0x553e89[_0x439c('0x44')]));if(_0x17781f['query'][_0x439c('0x50')]){_0x155ca2[_0x439c('0x4d')]=_[_0x439c('0x4e')](_0x155ca2[_0x439c('0x4d')],{'$or':_[_0x439c('0x3d')](_0x155ca2[_0x439c('0x47')],function(_0x4f0635){var _0x4993e5={};_0x4993e5[_0x4f0635]={'$like':'%'+_0x17781f['query'][_0x439c('0x50')]+'%'};return _0x4993e5;})});}_0x155ca2=_[_0x439c('0x4e')]({},_0x155ca2,_0x17781f[_0x439c('0x51')]);return _0x36a7ea[_0x439c('0x93')](_0x155ca2);}})[_0x439c('0x1f')](function(_0x2ce9fb){if(_0x2ce9fb){_0x31871f=_0x2ce9fb['length'];if(!_0x17781f[_0x439c('0x43')]['hasOwnProperty'](_0x439c('0x5e'))){_0x155ca2['limit']=qs[_0x439c('0x4a')](_0x17781f[_0x439c('0x43')][_0x439c('0x4a')]);_0x155ca2[_0x439c('0x2d')]=qs[_0x439c('0x2d')](_0x17781f['query'][_0x439c('0x2d')]);}return _0x36a7ea['getAgents'](_0x155ca2);}})[_0x439c('0x1f')](function(_0x12bcc9){if(_0x12bcc9){return _0x12bcc9?{'count':_0x31871f,'rows':_0x12bcc9}:null;}})[_0x439c('0x1f')](respondWithResult(_0x50c086,null))['catch'](handleError(_0x50c086,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 306292e..c23d277 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 _0x7fad=['emit','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x2d66f1,_0x5713b4){var _0x2c8138=function(_0x556625){while(--_0x556625){_0x2d66f1['push'](_0x2d66f1['shift']());}};_0x2c8138(++_0x5713b4);}(_0x7fad,0x1db));var _0xd7fa=function(_0x231b2e,_0x2a33f9){_0x231b2e=_0x231b2e-0x0;var _0x3feb2a=_0x7fad[_0x231b2e];return _0x3feb2a;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0xd7fa('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xd7fa('0x1')](0x0);var events={'afterCreate':_0xd7fa('0x2'),'afterUpdate':_0xd7fa('0x3'),'afterDestroy':_0xd7fa('0x4')};function emitEvent(_0x33c68a){return function(_0x1d03c9,_0x20316e,_0x22a644){ChatQueueEvents[_0xd7fa('0x5')](_0x33c68a+':'+_0x1d03c9['id'],_0x1d03c9);ChatQueueEvents[_0xd7fa('0x5')](_0x33c68a,_0x1d03c9);_0x22a644(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xd7fa('0x6')](e,emitEvent(event));}}module[_0xd7fa('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0x8ac5=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x9a2130,_0x30df80){var _0x285d62=function(_0x4c09ad){while(--_0x4c09ad){_0x9a2130['push'](_0x9a2130['shift']());}};_0x285d62(++_0x30df80);}(_0x8ac5,0x11e));var _0x58ac=function(_0x381bac,_0xc87b81){_0x381bac=_0x381bac-0x0;var _0x5eb3bb=_0x8ac5[_0x381bac];return _0x5eb3bb;};'use strict';var EventEmitter=require(_0x58ac('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x58ac('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x58ac('0x2')};function emitEvent(_0x5d9c68){return function(_0x12da38,_0x242587,_0xac1b5e){ChatQueueEvents[_0x58ac('0x3')](_0x5d9c68+':'+_0x12da38['id'],_0x12da38);ChatQueueEvents[_0x58ac('0x3')](_0x5d9c68,_0x12da38);_0xac1b5e(null);};}for(var e in events){if(events[_0x58ac('0x4')](e)){var event=events[e];ChatQueue[_0x58ac('0x5')](e,emitEvent(event));}}module[_0x58ac('0x6')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index dee847d..96a0e4f 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 _0x7afc=['ChatQueue','chat_queues','moment','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7afc,0xde));var _0xc7af=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0x7afc[_0x6d6a66];return _0x11eb6e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc7af('0x0'));var BPromise=require('bluebird');var rp=require(_0xc7af('0x1'));var fs=require('fs');var path=require(_0xc7af('0x2'));var rimraf=require(_0xc7af('0x3'));var config=require(_0xc7af('0x4'));var attributes=require(_0xc7af('0x5'));module[_0xc7af('0x6')]=function(_0xb6e4eb,_0x420087){return _0xb6e4eb[_0xc7af('0x7')](_0xc7af('0x8'),attributes,{'tableName':_0xc7af('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3661=['api','moment','bluebird','request-promise','path','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','lodash','util','../../config/logger'];(function(_0x56260c,_0x3594bc){var _0x3293b9=function(_0x3e1744){while(--_0x3e1744){_0x56260c['push'](_0x56260c['shift']());}};_0x3293b9(++_0x3594bc);}(_0x3661,0xa6));var _0x1366=function(_0x294ae9,_0x4c95ff){_0x294ae9=_0x294ae9-0x0;var _0x38489e=_0x3661[_0x294ae9];return _0x38489e;};'use strict';var _=require(_0x1366('0x0'));var util=require(_0x1366('0x1'));var logger=require(_0x1366('0x2'))(_0x1366('0x3'));var moment=require(_0x1366('0x4'));var BPromise=require(_0x1366('0x5'));var rp=require(_0x1366('0x6'));var fs=require('fs');var path=require(_0x1366('0x7'));var rimraf=require('rimraf');var config=require(_0x1366('0x8'));var attributes=require(_0x1366('0x9'));module[_0x1366('0xa')]=function(_0x12e3d2,_0x3575cc){return _0x12e3d2[_0x1366('0xb')](_0x1366('0xc'),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 a403531..b19f5ab 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 _0xd8d7=['GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit','include','map','model','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','rpc','jayson/promise','client','http','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x35f0c6,_0x946290){var _0xc12a2a=function(_0x472d18){while(--_0x472d18){_0x35f0c6['push'](_0x35f0c6['shift']());}};_0xc12a2a(++_0x946290);}(_0xd8d7,0x1d4));var _0x7d8d=function(_0x460150,_0x232949){_0x460150=_0x460150-0x0;var _0x340677=_0xd8d7[_0x460150];return _0x340677;};'use strict';var _=require(_0x7d8d('0x0'));var util=require(_0x7d8d('0x1'));var moment=require(_0x7d8d('0x2'));var BPromise=require(_0x7d8d('0x3'));var rs=require(_0x7d8d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7d8d('0x5'));var config=require('../../config/environment');var jayson=require(_0x7d8d('0x6'));var client=jayson[_0x7d8d('0x7')][_0x7d8d('0x8')]({'port':0x232a});config[_0x7d8d('0x9')]=_[_0x7d8d('0xa')](config[_0x7d8d('0x9')],{'host':_0x7d8d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d8d('0x9')]));require(_0x7d8d('0xc'))[_0x7d8d('0xd')](socket);function respondWithRpcPromise(_0x144911,_0x407423,_0x27efce){return new BPromise(function(_0x2a0f33,_0x5aa889){return client[_0x7d8d('0xe')](_0x144911,_0x27efce)[_0x7d8d('0xf')](function(_0xe1ca5f){logger[_0x7d8d('0x10')](_0x7d8d('0x11'),_0x407423,'request\x20sent');logger[_0x7d8d('0x12')](_0x7d8d('0x13'),_0x407423,_0x7d8d('0x14'),JSON[_0x7d8d('0x15')](_0xe1ca5f));if(_0xe1ca5f[_0x7d8d('0x16')]){if(_0xe1ca5f[_0x7d8d('0x16')]['code']===0x1f4){logger[_0x7d8d('0x16')](_0x7d8d('0x11'),_0x407423,_0xe1ca5f[_0x7d8d('0x16')][_0x7d8d('0x17')]);return _0x5aa889(_0xe1ca5f[_0x7d8d('0x16')]['message']);}logger[_0x7d8d('0x16')]('ChatQueue,\x20%s,\x20%s',_0x407423,_0xe1ca5f[_0x7d8d('0x16')]['message']);return _0x2a0f33(_0xe1ca5f[_0x7d8d('0x16')][_0x7d8d('0x17')]);}else{logger[_0x7d8d('0x10')](_0x7d8d('0x11'),_0x407423,_0x7d8d('0x14'));_0x2a0f33(_0xe1ca5f[_0x7d8d('0x18')][_0x7d8d('0x17')]);}})[_0x7d8d('0x19')](function(_0x4b15c0){logger[_0x7d8d('0x16')](_0x7d8d('0x11'),_0x407423,_0x4b15c0);_0x5aa889(_0x4b15c0);});});}exports[_0x7d8d('0x1a')]=function(_0x17e3cf){var _0x888ca2=this;return new Promise(function(_0x3db362,_0x3b32d3){return db[_0x7d8d('0x1b')][_0x7d8d('0x1c')]({'raw':_0x17e3cf[_0x7d8d('0x1d')]?_0x17e3cf[_0x7d8d('0x1d')][_0x7d8d('0x1e')]===undefined?!![]:![]:!![],'where':_0x17e3cf[_0x7d8d('0x1d')]?_0x17e3cf[_0x7d8d('0x1d')]['where']||null:null,'attributes':_0x17e3cf['options']?_0x17e3cf['options'][_0x7d8d('0x1f')]||null:null,'limit':_0x17e3cf[_0x7d8d('0x1d')]?_0x17e3cf[_0x7d8d('0x1d')][_0x7d8d('0x20')]||null:null,'include':_0x17e3cf[_0x7d8d('0x1d')]?_0x17e3cf['options'][_0x7d8d('0x21')]?_[_0x7d8d('0x22')](_0x17e3cf[_0x7d8d('0x1d')][_0x7d8d('0x21')],function(_0x3a8cf4){return{'model':db[_0x3a8cf4[_0x7d8d('0x23')]],'as':_0x3a8cf4['as'],'attributes':_0x3a8cf4[_0x7d8d('0x1f')],'include':_0x3a8cf4['include']?_[_0x7d8d('0x22')](_0x3a8cf4[_0x7d8d('0x21')],function(_0x23afc4){return{'model':db[_0x23afc4[_0x7d8d('0x23')]],'as':_0x23afc4['as'],'attributes':_0x23afc4[_0x7d8d('0x1f')],'include':_0x23afc4['include']?_['map'](_0x23afc4[_0x7d8d('0x21')],function(_0x198f21){return{'model':db[_0x198f21[_0x7d8d('0x23')]],'as':_0x198f21['as'],'attributes':_0x198f21['attributes']};}):[]};}):[]};}):[]:[]})[_0x7d8d('0xf')](function(_0xadbf05){logger[_0x7d8d('0x10')]('GetChatQueue',_0x17e3cf);logger[_0x7d8d('0x12')](_0x7d8d('0x1a'),_0x17e3cf,JSON['stringify'](_0xadbf05));_0x3db362(_0xadbf05);})[_0x7d8d('0x19')](function(_0x46319a){logger[_0x7d8d('0x16')](_0x7d8d('0x1a'),_0x46319a[_0x7d8d('0x17')],_0x17e3cf);_0x3b32d3(_0x888ca2['error'](0x1f4,_0x46319a['message']));});});};exports[_0x7d8d('0x24')]=function(_0x1226ba){var _0x5c0370=this;return new Promise(function(_0x311ee8,_0x5232c3){return db[_0x7d8d('0x1b')][_0x7d8d('0x25')]({'raw':_0x1226ba['options']?_0x1226ba[_0x7d8d('0x1d')][_0x7d8d('0x1e')]===undefined?!![]:![]:!![],'where':_0x1226ba[_0x7d8d('0x1d')]?_0x1226ba[_0x7d8d('0x1d')]['where']||null:null,'attributes':_0x1226ba[_0x7d8d('0x1d')]?_0x1226ba['options'][_0x7d8d('0x1f')]||null:null,'include':_0x1226ba[_0x7d8d('0x1d')]?_0x1226ba[_0x7d8d('0x1d')][_0x7d8d('0x21')]?_['map'](_0x1226ba[_0x7d8d('0x1d')][_0x7d8d('0x21')],function(_0x95ab0c){return{'model':db[_0x95ab0c[_0x7d8d('0x23')]],'as':_0x95ab0c['as'],'attributes':_0x95ab0c[_0x7d8d('0x1f')],'include':_0x95ab0c[_0x7d8d('0x21')]?_[_0x7d8d('0x22')](_0x95ab0c[_0x7d8d('0x21')],function(_0x4c8e96){return{'model':db[_0x4c8e96[_0x7d8d('0x23')]],'as':_0x4c8e96['as'],'attributes':_0x4c8e96[_0x7d8d('0x1f')],'include':_0x4c8e96[_0x7d8d('0x21')]?_['map'](_0x4c8e96['include'],function(_0x5767ac){return{'model':db[_0x5767ac[_0x7d8d('0x23')]],'as':_0x5767ac['as'],'attributes':_0x5767ac[_0x7d8d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7d8d('0xf')](function(_0x21cdd2){logger[_0x7d8d('0x10')]('ShowChatQueue',_0x1226ba);logger[_0x7d8d('0x12')](_0x7d8d('0x24'),_0x1226ba,JSON['stringify'](_0x21cdd2));_0x311ee8(_0x21cdd2);})[_0x7d8d('0x19')](function(_0x12100b){logger[_0x7d8d('0x16')](_0x7d8d('0x24'),_0x12100b[_0x7d8d('0x17')],_0x1226ba);_0x5232c3(_0x5c0370[_0x7d8d('0x16')](0x1f4,_0x12100b[_0x7d8d('0x17')]));});});}; \ No newline at end of file +var _0xa2cb=['result','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','include','map','model','catch','ShowChatQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','http','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4c1ed6,_0x365585){var _0x43b25a=function(_0xcc2e37){while(--_0xcc2e37){_0x4c1ed6['push'](_0x4c1ed6['shift']());}};_0x43b25a(++_0x365585);}(_0xa2cb,0x7d));var _0xba2c=function(_0x5f79cb,_0x4b2c88){_0x5f79cb=_0x5f79cb-0x0;var _0x3580bc=_0xa2cb[_0x5f79cb];return _0x3580bc;};'use strict';var _=require(_0xba2c('0x0'));var util=require(_0xba2c('0x1'));var moment=require('moment');var BPromise=require(_0xba2c('0x2'));var rs=require(_0xba2c('0x3'));var fs=require('fs');var Redis=require(_0xba2c('0x4'));var db=require(_0xba2c('0x5'))['db'];var utils=require(_0xba2c('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xba2c('0x7')]({'port':0x232a});config['redis']=_[_0xba2c('0x8')](config['redis'],{'host':_0xba2c('0x9'),'port':0x18eb});var socket=require(_0xba2c('0xa'))(new Redis(config['redis']));require(_0xba2c('0xb'))[_0xba2c('0xc')](socket);function respondWithRpcPromise(_0x4f8ce7,_0x2957ea,_0xdfaf9e){return new BPromise(function(_0x14063f,_0x15781e){return client['request'](_0x4f8ce7,_0xdfaf9e)[_0xba2c('0xd')](function(_0x1d2146){logger[_0xba2c('0xe')](_0xba2c('0xf'),_0x2957ea,_0xba2c('0x10'));logger[_0xba2c('0x11')](_0xba2c('0x12'),_0x2957ea,_0xba2c('0x10'),JSON[_0xba2c('0x13')](_0x1d2146));if(_0x1d2146[_0xba2c('0x14')]){if(_0x1d2146['error'][_0xba2c('0x15')]===0x1f4){logger[_0xba2c('0x14')](_0xba2c('0xf'),_0x2957ea,_0x1d2146[_0xba2c('0x14')][_0xba2c('0x16')]);return _0x15781e(_0x1d2146[_0xba2c('0x14')][_0xba2c('0x16')]);}logger[_0xba2c('0x14')](_0xba2c('0xf'),_0x2957ea,_0x1d2146['error'][_0xba2c('0x16')]);return _0x14063f(_0x1d2146[_0xba2c('0x14')][_0xba2c('0x16')]);}else{logger[_0xba2c('0xe')](_0xba2c('0xf'),_0x2957ea,'request\x20sent');_0x14063f(_0x1d2146[_0xba2c('0x17')][_0xba2c('0x16')]);}})['catch'](function(_0x596599){logger['error']('ChatQueue,\x20%s,\x20%s',_0x2957ea,_0x596599);_0x15781e(_0x596599);});});}exports[_0xba2c('0x18')]=function(_0x1c27c0){var _0x1298eb=this;return new Promise(function(_0x266824,_0x42dff6){return db[_0xba2c('0x19')][_0xba2c('0x1a')]({'raw':_0x1c27c0[_0xba2c('0x1b')]?_0x1c27c0[_0xba2c('0x1b')][_0xba2c('0x1c')]===undefined?!![]:![]:!![],'where':_0x1c27c0[_0xba2c('0x1b')]?_0x1c27c0[_0xba2c('0x1b')][_0xba2c('0x1d')]||null:null,'attributes':_0x1c27c0[_0xba2c('0x1b')]?_0x1c27c0[_0xba2c('0x1b')][_0xba2c('0x1e')]||null:null,'limit':_0x1c27c0[_0xba2c('0x1b')]?_0x1c27c0[_0xba2c('0x1b')]['limit']||null:null,'include':_0x1c27c0[_0xba2c('0x1b')]?_0x1c27c0[_0xba2c('0x1b')][_0xba2c('0x1f')]?_[_0xba2c('0x20')](_0x1c27c0['options']['include'],function(_0x199b1d){return{'model':db[_0x199b1d['model']],'as':_0x199b1d['as'],'attributes':_0x199b1d[_0xba2c('0x1e')],'include':_0x199b1d[_0xba2c('0x1f')]?_[_0xba2c('0x20')](_0x199b1d[_0xba2c('0x1f')],function(_0x28c5fc){return{'model':db[_0x28c5fc[_0xba2c('0x21')]],'as':_0x28c5fc['as'],'attributes':_0x28c5fc['attributes'],'include':_0x28c5fc['include']?_[_0xba2c('0x20')](_0x28c5fc[_0xba2c('0x1f')],function(_0x19ee5a){return{'model':db[_0x19ee5a[_0xba2c('0x21')]],'as':_0x19ee5a['as'],'attributes':_0x19ee5a[_0xba2c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xba2c('0xd')](function(_0x1ff162){logger[_0xba2c('0xe')](_0xba2c('0x18'),_0x1c27c0);logger[_0xba2c('0x11')](_0xba2c('0x18'),_0x1c27c0,JSON[_0xba2c('0x13')](_0x1ff162));_0x266824(_0x1ff162);})[_0xba2c('0x22')](function(_0x367106){logger[_0xba2c('0x14')](_0xba2c('0x18'),_0x367106[_0xba2c('0x16')],_0x1c27c0);_0x42dff6(_0x1298eb[_0xba2c('0x14')](0x1f4,_0x367106[_0xba2c('0x16')]));});});};exports[_0xba2c('0x23')]=function(_0x11c7df){var _0x2fcc34=this;return new Promise(function(_0x5b7113,_0x915697){return db['ChatQueue'][_0xba2c('0x24')]({'raw':_0x11c7df[_0xba2c('0x1b')]?_0x11c7df[_0xba2c('0x1b')][_0xba2c('0x1c')]===undefined?!![]:![]:!![],'where':_0x11c7df[_0xba2c('0x1b')]?_0x11c7df[_0xba2c('0x1b')]['where']||null:null,'attributes':_0x11c7df[_0xba2c('0x1b')]?_0x11c7df[_0xba2c('0x1b')][_0xba2c('0x1e')]||null:null,'include':_0x11c7df[_0xba2c('0x1b')]?_0x11c7df[_0xba2c('0x1b')][_0xba2c('0x1f')]?_[_0xba2c('0x20')](_0x11c7df[_0xba2c('0x1b')][_0xba2c('0x1f')],function(_0x57dcc2){return{'model':db[_0x57dcc2[_0xba2c('0x21')]],'as':_0x57dcc2['as'],'attributes':_0x57dcc2[_0xba2c('0x1e')],'include':_0x57dcc2[_0xba2c('0x1f')]?_['map'](_0x57dcc2[_0xba2c('0x1f')],function(_0x41bde5){return{'model':db[_0x41bde5[_0xba2c('0x21')]],'as':_0x41bde5['as'],'attributes':_0x41bde5[_0xba2c('0x1e')],'include':_0x41bde5['include']?_['map'](_0x41bde5[_0xba2c('0x1f')],function(_0x5a3bfb){return{'model':db[_0x5a3bfb[_0xba2c('0x21')]],'as':_0x5a3bfb['as'],'attributes':_0x5a3bfb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x72c712){logger[_0xba2c('0xe')](_0xba2c('0x23'),_0x11c7df);logger[_0xba2c('0x11')]('ShowChatQueue',_0x11c7df,JSON[_0xba2c('0x13')](_0x72c712));_0x5b7113(_0x72c712);})[_0xba2c('0x22')](function(_0x19266a){logger['error'](_0xba2c('0x23'),_0x19266a[_0xba2c('0x16')],_0x11c7df);_0x915697(_0x2fcc34[_0xba2c('0x14')](0x1f4,_0x19266a[_0xba2c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index ec20d08..401ad0a 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 _0xa41a=['emit','removeListener','./chatQueue.events','save','update'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xa41a,0x6b));var _0xaa41=function(_0x1241ff,_0x541ca2){_0x1241ff=_0x1241ff-0x0;var _0x4a7d7d=_0xa41a[_0x1241ff];return _0x4a7d7d;};'use strict';var ChatQueueEvents=require(_0xaa41('0x0'));var events=[_0xaa41('0x1'),'remove',_0xaa41('0x2')];function createListener(_0x2a96ba,_0x43654a){return function(_0xc5ce74){_0x43654a[_0xaa41('0x3')](_0x2a96ba,_0xc5ce74);};}function removeListener(_0x3168be,_0x42896b){return function(){ChatQueueEvents[_0xaa41('0x4')](_0x3168be,_0x42896b);};}exports['register']=function(_0x2122a0){for(var _0x1ec9d4=0x0,_0x54bc5a=events['length'];_0x1ec9d4<_0x54bc5a;_0x1ec9d4++){var _0x179545=events[_0x1ec9d4];var _0x202cce=createListener('chatQueue:'+_0x179545,_0x2122a0);ChatQueueEvents['on'](_0x179545,_0x202cce);}}; \ No newline at end of file +var _0xd0bb=['chatQueue:','./chatQueue.events','save','remove','emit','register','length'];(function(_0x2f50af,_0x54037b){var _0x172d76=function(_0x35c9d0){while(--_0x35c9d0){_0x2f50af['push'](_0x2f50af['shift']());}};_0x172d76(++_0x54037b);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x14e4cf,_0x5ab1da){_0x14e4cf=_0x14e4cf-0x0;var _0x2770b=_0xd0bb[_0x14e4cf];return _0x2770b;};'use strict';var ChatQueueEvents=require(_0xbd0b('0x0'));var events=[_0xbd0b('0x1'),_0xbd0b('0x2'),'update'];function createListener(_0x68ea36,_0x4ab08f){return function(_0x39b03a){_0x4ab08f[_0xbd0b('0x3')](_0x68ea36,_0x39b03a);};}function removeListener(_0x53e6ce,_0x432acf){return function(){ChatQueueEvents['removeListener'](_0x53e6ce,_0x432acf);};}exports[_0xbd0b('0x4')]=function(_0x1b2499){for(var _0x158b5c=0x0,_0x37c205=events[_0xbd0b('0x5')];_0x158b5c<_0x37c205;_0x158b5c++){var _0x5eb975=events[_0x158b5c];var _0x2a4075=createListener(_0xbd0b('0x6')+_0x5eb975,_0x1b2499);ChatQueueEvents['on'](_0x5eb975,_0x2a4075);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 5363ebb..6546f1f 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(_0x99ae42,_0x9187d9){var _0x45e06c=function(_0x1f6f64){while(--_0x1f6f64){_0x99ae42['push'](_0x99ae42['shift']());}};_0x45e06c(++_0x9187d9);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x3f582b,_0xebfae6){var _0x2290db=function(_0x289f7f){while(--_0x289f7f){_0x3f582b['push'](_0x3f582b['shift']());}};_0x2290db(++_0xebfae6);}(_0x814b,0x1a2));var _0xb814=function(_0x2cc594,_0x4d727b){_0x2cc594=_0x2cc594-0x0;var _0x4abff7=_0x814b[_0x2cc594];return _0x4abff7;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 5099e64..fd8cb81 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 _0x8813=['STRING','DATE','moment','exports'];(function(_0x5123b6,_0x46b621){var _0x116a74=function(_0x26f872){while(--_0x26f872){_0x5123b6['push'](_0x5123b6['shift']());}};_0x116a74(++_0x46b621);}(_0x8813,0x86));var _0x3881=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8813[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x3881('0x0'));var Sequelize=require('sequelize');module[_0x3881('0x1')]={'uniqueid':{'type':Sequelize[_0x3881('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3881('0x2')]},'joinAt':{'type':Sequelize[_0x3881('0x3')]},'leaveAt':{'type':Sequelize[_0x3881('0x3')]},'acceptAt':{'type':Sequelize[_0x3881('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe57d=['exports','STRING','DATE','moment'];(function(_0xb6e43,_0x1568fc){var _0x47c40f=function(_0x107786){while(--_0x107786){_0xb6e43['push'](_0xb6e43['shift']());}};_0x47c40f(++_0x1568fc);}(_0xe57d,0xd7));var _0xde57=function(_0x415429,_0x1e15b8){_0x415429=_0x415429-0x0;var _0x5f3cc5=_0xe57d[_0x415429];return _0x5f3cc5;};'use strict';var moment=require(_0xde57('0x0'));var Sequelize=require('sequelize');module[_0xde57('0x1')]={'uniqueid':{'type':Sequelize[_0xde57('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xde57('0x3')]},'acceptAt':{'type':Sequelize[_0xde57('0x3')]},'exitAt':{'type':Sequelize[_0xde57('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index b3daeb4..28b9161 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 _0x022a=['then','end','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatQueueReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','destroy'];(function(_0x258197,_0x1caee0){var _0x312eee=function(_0x6c8baf){while(--_0x6c8baf){_0x258197['push'](_0x258197['shift']());}};_0x312eee(++_0x1caee0);}(_0x022a,0x1f0));var _0xa022=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0x022a[_0x4347ec];return _0x4c8314;};'use strict';var emlformat=require(_0xa022('0x0'));var rimraf=require(_0xa022('0x1'));var zipdir=require(_0xa022('0x2'));var jsonpatch=require(_0xa022('0x3'));var rp=require(_0xa022('0x4'));var moment=require(_0xa022('0x5'));var BPromise=require(_0xa022('0x6'));var Mustache=require(_0xa022('0x7'));var util=require(_0xa022('0x8'));var path=require(_0xa022('0x9'));var sox=require(_0xa022('0xa'));var csv=require(_0xa022('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa022('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa022('0xd'));var jsforce=require(_0xa022('0xe'));var deskjs=require(_0xa022('0xf'));var toCsv=require(_0xa022('0xb'));var querystring=require(_0xa022('0x10'));var Papa=require(_0xa022('0x11'));var Redis=require(_0xa022('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa022('0x13'));var as=require(_0xa022('0x14'));var hardwareService=require(_0xa022('0x15'));var logger=require('../../config/logger')(_0xa022('0x16'));var utils=require('../../config/utils');var config=require(_0xa022('0x17'));var licenseUtil=require(_0xa022('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c3326,_0x41dffb){_0x41dffb=_0x41dffb||0xcc;return function(_0x2ddabf){if(_0x2ddabf){return _0x5c3326[_0xa022('0x19')](_0x41dffb);}return _0x5c3326[_0xa022('0x1a')](_0x41dffb)['end']();};}function respondWithResult(_0x51a098,_0x1c9bc3){_0x1c9bc3=_0x1c9bc3||0xc8;return function(_0x5a57c5){if(_0x5a57c5){return _0x51a098[_0xa022('0x1a')](_0x1c9bc3)[_0xa022('0x1b')](_0x5a57c5);}};}function respondWithFilteredResult(_0x34db44,_0x2bc4d6){return function(_0x1fb150){if(_0x1fb150){var _0x1a16a4=typeof _0x2bc4d6[_0xa022('0x1c')]===_0xa022('0x1d')&&typeof _0x2bc4d6[_0xa022('0x1e')]===_0xa022('0x1d');var _0xd094d2=_0x1fb150[_0xa022('0x1f')];var _0x32bb92=_0x1a16a4?0x0:_0x2bc4d6[_0xa022('0x1c')];var _0x5aafa5=_0x1a16a4?_0x1fb150[_0xa022('0x1f')]:_0x2bc4d6[_0xa022('0x1c')]+_0x2bc4d6[_0xa022('0x1e')];var _0xb97bc8;if(_0x5aafa5>=_0xd094d2){_0x5aafa5=_0xd094d2;_0xb97bc8=0xc8;}else{_0xb97bc8=0xce;}_0x34db44[_0xa022('0x1a')](_0xb97bc8);return _0x34db44[_0xa022('0x20')]('Content-Range',_0x32bb92+'-'+_0x5aafa5+'/'+_0xd094d2)[_0xa022('0x1b')](_0x1fb150);}return null;};}function patchUpdates(_0x4e7005){return function(_0x5e80f6){try{jsonpatch[_0xa022('0x21')](_0x5e80f6,_0x4e7005,!![]);}catch(_0x3731e6){return BPromise['reject'](_0x3731e6);}return _0x5e80f6[_0xa022('0x22')]();};}function saveUpdates(_0x443984,_0x2d0c76){return function(_0x24b800){if(_0x24b800){return _0x24b800['update'](_0x443984)['then'](function(_0x81c0ae){return _0x81c0ae;});}return null;};}function removeEntity(_0xa326f2,_0x428ccf){return function(_0xf730bd){if(_0xf730bd){return _0xf730bd[_0xa022('0x23')]()[_0xa022('0x24')](function(){_0xa326f2['status'](0xcc)[_0xa022('0x25')]();});}};}function handleEntityNotFound(_0x5400ff,_0xcfce3f){return function(_0x5ce466){if(!_0x5ce466){_0x5400ff[_0xa022('0x19')](0x194);}return _0x5ce466;};}function handleError(_0x32cad9,_0x280352){_0x280352=_0x280352||0x1f4;return function(_0x5d2215){logger[_0xa022('0x26')](_0x5d2215[_0xa022('0x27')]);if(_0x5d2215[_0xa022('0x28')]){delete _0x5d2215[_0xa022('0x28')];}_0x32cad9[_0xa022('0x1a')](_0x280352)[_0xa022('0x29')](_0x5d2215);};}exports[_0xa022('0x2a')]=function(_0x2a6cb7,_0x295cbc){var _0x5f53c1={},_0x16df86={},_0x312e7b={'count':0x0,'rows':[]};var _0x6fc8a9=_[_0xa022('0x2b')](db['ChatQueueReport'][_0xa022('0x2c')],function(_0x358d37){return{'name':_0x358d37['fieldName'],'type':_0x358d37[_0xa022('0x2d')][_0xa022('0x2e')]};});_0x16df86['model']=_['map'](_0x6fc8a9,_0xa022('0x28'));_0x16df86[_0xa022('0x2f')]=_[_0xa022('0x30')](_0x2a6cb7['query']);_0x16df86[_0xa022('0x31')]=_[_0xa022('0x32')](_0x16df86[_0xa022('0x33')],_0x16df86[_0xa022('0x2f')]);_0x5f53c1[_0xa022('0x34')]=_[_0xa022('0x32')](_0x16df86[_0xa022('0x33')],qs[_0xa022('0x35')](_0x2a6cb7[_0xa022('0x2f')]['fields']));_0x5f53c1['attributes']=_0x5f53c1[_0xa022('0x34')][_0xa022('0x36')]?_0x5f53c1[_0xa022('0x34')]:_0x16df86['model'];if(!_0x2a6cb7[_0xa022('0x2f')][_0xa022('0x37')](_0xa022('0x38'))){_0x5f53c1[_0xa022('0x1e')]=qs[_0xa022('0x1e')](_0x2a6cb7[_0xa022('0x2f')][_0xa022('0x1e')]);_0x5f53c1[_0xa022('0x1c')]=qs[_0xa022('0x1c')](_0x2a6cb7[_0xa022('0x2f')][_0xa022('0x1c')]);}_0x5f53c1['order']=qs[_0xa022('0x39')](_0x2a6cb7[_0xa022('0x2f')][_0xa022('0x39')]);_0x5f53c1[_0xa022('0x3a')]=qs[_0xa022('0x31')](_['pick'](_0x2a6cb7[_0xa022('0x2f')],_0x16df86['filters']),_0x6fc8a9);if(_0x2a6cb7[_0xa022('0x2f')][_0xa022('0x3b')]){_0x5f53c1['where']=_[_0xa022('0x3c')](_0x5f53c1[_0xa022('0x3a')],{'$or':_[_0xa022('0x2b')](_0x6fc8a9,function(_0x24ef5c){if(_0x24ef5c[_0xa022('0x2d')]!==_0xa022('0x3d')){var _0xe38116={};_0xe38116[_0x24ef5c[_0xa022('0x28')]]={'$like':'%'+_0x2a6cb7[_0xa022('0x2f')][_0xa022('0x3b')]+'%'};return _0xe38116;}})});}_0x5f53c1=_[_0xa022('0x3c')]({},_0x5f53c1,_0x2a6cb7[_0xa022('0x3e')]);var _0x21f194={'where':_0x5f53c1[_0xa022('0x3a')]};return db[_0xa022('0x3f')][_0xa022('0x1f')](_0x21f194)[_0xa022('0x24')](function(_0x1b349a){_0x312e7b[_0xa022('0x1f')]=_0x1b349a;if(_0x2a6cb7[_0xa022('0x2f')][_0xa022('0x40')]){_0x5f53c1[_0xa022('0x41')]=[{'all':!![]}];}return db[_0xa022('0x3f')][_0xa022('0x42')](_0x5f53c1);})[_0xa022('0x24')](function(_0x28b0b4){_0x312e7b[_0xa022('0x43')]=_0x28b0b4;return _0x312e7b;})[_0xa022('0x24')](respondWithFilteredResult(_0x295cbc,_0x5f53c1))[_0xa022('0x44')](handleError(_0x295cbc,null));};exports[_0xa022('0x45')]=function(_0x26efc5,_0x3ef0a9){var _0xcd433a={'raw':!![],'where':{'id':_0x26efc5[_0xa022('0x46')]['id']}},_0x296f49={};_0x296f49[_0xa022('0x33')]=_['keys'](db[_0xa022('0x3f')]['rawAttributes']);_0x296f49[_0xa022('0x2f')]=_[_0xa022('0x30')](_0x26efc5[_0xa022('0x2f')]);_0x296f49[_0xa022('0x31')]=_[_0xa022('0x32')](_0x296f49[_0xa022('0x33')],_0x296f49[_0xa022('0x2f')]);_0xcd433a['attributes']=_['intersection'](_0x296f49['model'],qs['fields'](_0x26efc5['query']['fields']));_0xcd433a[_0xa022('0x34')]=_0xcd433a[_0xa022('0x34')][_0xa022('0x36')]?_0xcd433a[_0xa022('0x34')]:_0x296f49[_0xa022('0x33')];if(_0x26efc5[_0xa022('0x2f')][_0xa022('0x40')]){_0xcd433a[_0xa022('0x41')]=[{'all':!![]}];}_0xcd433a=_[_0xa022('0x3c')]({},_0xcd433a,_0x26efc5[_0xa022('0x3e')]);return db[_0xa022('0x3f')][_0xa022('0x47')](_0xcd433a)[_0xa022('0x24')](handleEntityNotFound(_0x3ef0a9,null))[_0xa022('0x24')](respondWithResult(_0x3ef0a9,null))['catch'](handleError(_0x3ef0a9,null));};exports[_0xa022('0x48')]=function(_0x176482,_0x29bbf1){return db[_0xa022('0x3f')][_0xa022('0x48')](_0x176482[_0xa022('0x49')],{})['then'](respondWithResult(_0x29bbf1,0xc9))['catch'](handleError(_0x29bbf1,null));};exports[_0xa022('0x4a')]=function(_0xffd646,_0x298dfe){if(_0xffd646['body']['id']){delete _0xffd646[_0xa022('0x49')]['id'];}return db[_0xa022('0x3f')][_0xa022('0x47')]({'where':{'id':_0xffd646[_0xa022('0x46')]['id']}})[_0xa022('0x24')](handleEntityNotFound(_0x298dfe,null))['then'](saveUpdates(_0xffd646['body'],null))[_0xa022('0x24')](respondWithResult(_0x298dfe,null))[_0xa022('0x44')](handleError(_0x298dfe,null));};exports[_0xa022('0x23')]=function(_0x22cd5c,_0x5a4f39){return db[_0xa022('0x3f')][_0xa022('0x47')]({'where':{'id':_0x22cd5c['params']['id']}})['then'](handleEntityNotFound(_0x5a4f39,null))[_0xa022('0x24')](removeEntity(_0x5a4f39,null))[_0xa022('0x44')](handleError(_0x5a4f39,null));};exports[_0xa022('0x4b')]=function(_0x24c245,_0x3ff64e){return db[_0xa022('0x3f')]['describe']()[_0xa022('0x24')](respondWithResult(_0x3ff64e,null))[_0xa022('0x44')](handleError(_0x3ff64e,null));}; \ No newline at end of file +var _0xa899=['../../config/environment','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','end','sendStatus','error','name','index','map','ChatQueueReport','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x119d13,_0x263cd2){var _0x333c35=function(_0x422c6e){while(--_0x422c6e){_0x119d13['push'](_0x119d13['shift']());}};_0x333c35(++_0x263cd2);}(_0xa899,0x155));var _0x9a89=function(_0x154983,_0xc29edf){_0x154983=_0x154983-0x0;var _0x3d1243=_0xa899[_0x154983];return _0x3d1243;};'use strict';var emlformat=require(_0x9a89('0x0'));var rimraf=require(_0x9a89('0x1'));var zipdir=require(_0x9a89('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9a89('0x3'));var moment=require(_0x9a89('0x4'));var BPromise=require(_0x9a89('0x5'));var Mustache=require(_0x9a89('0x6'));var util=require(_0x9a89('0x7'));var path=require(_0x9a89('0x8'));var sox=require(_0x9a89('0x9'));var csv=require(_0x9a89('0xa'));var ejs=require(_0x9a89('0xb'));var fs=require('fs');var fs_extra=require(_0x9a89('0xc'));var _=require(_0x9a89('0xd'));var squel=require(_0x9a89('0xe'));var crypto=require(_0x9a89('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9a89('0xa'));var querystring=require(_0x9a89('0x10'));var Papa=require('papaparse');var Redis=require(_0x9a89('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9a89('0x12'));var as=require(_0x9a89('0x13'));var hardwareService=require(_0x9a89('0x14'));var logger=require(_0x9a89('0x15'))(_0x9a89('0x16'));var utils=require(_0x9a89('0x17'));var config=require(_0x9a89('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4342c8,_0x8b7403){_0x8b7403=_0x8b7403||0xcc;return function(_0x2bdb0d){if(_0x2bdb0d){return _0x4342c8['sendStatus'](_0x8b7403);}return _0x4342c8['status'](_0x8b7403)['end']();};}function respondWithResult(_0x1c66a3,_0xf08a5a){_0xf08a5a=_0xf08a5a||0xc8;return function(_0x5720a2){if(_0x5720a2){return _0x1c66a3[_0x9a89('0x19')](_0xf08a5a)[_0x9a89('0x1a')](_0x5720a2);}};}function respondWithFilteredResult(_0x33a08f,_0x203ee9){return function(_0x597e58){if(_0x597e58){var _0x11a933=typeof _0x203ee9[_0x9a89('0x1b')]==='undefined'&&typeof _0x203ee9['limit']===_0x9a89('0x1c');var _0x4a15f1=_0x597e58[_0x9a89('0x1d')];var _0x334725=_0x11a933?0x0:_0x203ee9['offset'];var _0xdbb337=_0x11a933?_0x597e58['count']:_0x203ee9[_0x9a89('0x1b')]+_0x203ee9[_0x9a89('0x1e')];var _0x54c45d;if(_0xdbb337>=_0x4a15f1){_0xdbb337=_0x4a15f1;_0x54c45d=0xc8;}else{_0x54c45d=0xce;}_0x33a08f[_0x9a89('0x19')](_0x54c45d);return _0x33a08f[_0x9a89('0x1f')](_0x9a89('0x20'),_0x334725+'-'+_0xdbb337+'/'+_0x4a15f1)[_0x9a89('0x1a')](_0x597e58);}return null;};}function patchUpdates(_0x66f8c7){return function(_0x146ec0){try{jsonpatch[_0x9a89('0x21')](_0x146ec0,_0x66f8c7,!![]);}catch(_0x1548db){return BPromise['reject'](_0x1548db);}return _0x146ec0['save']();};}function saveUpdates(_0x1ef5ef,_0x330121){return function(_0xea8910){if(_0xea8910){return _0xea8910[_0x9a89('0x22')](_0x1ef5ef)[_0x9a89('0x23')](function(_0x3cc288){return _0x3cc288;});}return null;};}function removeEntity(_0x4ac234,_0x50adcf){return function(_0x42c5ee){if(_0x42c5ee){return _0x42c5ee['destroy']()[_0x9a89('0x23')](function(){_0x4ac234[_0x9a89('0x19')](0xcc)[_0x9a89('0x24')]();});}};}function handleEntityNotFound(_0x3b1807,_0x423a1d){return function(_0x35032a){if(!_0x35032a){_0x3b1807[_0x9a89('0x25')](0x194);}return _0x35032a;};}function handleError(_0x4d7876,_0x1a5005){_0x1a5005=_0x1a5005||0x1f4;return function(_0x5002a2){logger[_0x9a89('0x26')](_0x5002a2['stack']);if(_0x5002a2['name']){delete _0x5002a2[_0x9a89('0x27')];}_0x4d7876[_0x9a89('0x19')](_0x1a5005)['send'](_0x5002a2);};}exports[_0x9a89('0x28')]=function(_0x5abe70,_0x27f442){var _0x365e34={},_0x267512={},_0x2d019e={'count':0x0,'rows':[]};var _0x2324c0=_[_0x9a89('0x29')](db[_0x9a89('0x2a')]['rawAttributes'],function(_0x4df9f2){return{'name':_0x4df9f2['fieldName'],'type':_0x4df9f2[_0x9a89('0x2b')]['key']};});_0x267512[_0x9a89('0x2c')]=_[_0x9a89('0x29')](_0x2324c0,_0x9a89('0x27'));_0x267512['query']=_[_0x9a89('0x2d')](_0x5abe70['query']);_0x267512[_0x9a89('0x2e')]=_[_0x9a89('0x2f')](_0x267512[_0x9a89('0x2c')],_0x267512[_0x9a89('0x30')]);_0x365e34[_0x9a89('0x31')]=_['intersection'](_0x267512[_0x9a89('0x2c')],qs[_0x9a89('0x32')](_0x5abe70[_0x9a89('0x30')][_0x9a89('0x32')]));_0x365e34[_0x9a89('0x31')]=_0x365e34[_0x9a89('0x31')][_0x9a89('0x33')]?_0x365e34[_0x9a89('0x31')]:_0x267512[_0x9a89('0x2c')];if(!_0x5abe70['query'][_0x9a89('0x34')](_0x9a89('0x35'))){_0x365e34[_0x9a89('0x1e')]=qs[_0x9a89('0x1e')](_0x5abe70[_0x9a89('0x30')][_0x9a89('0x1e')]);_0x365e34[_0x9a89('0x1b')]=qs[_0x9a89('0x1b')](_0x5abe70[_0x9a89('0x30')][_0x9a89('0x1b')]);}_0x365e34['order']=qs[_0x9a89('0x36')](_0x5abe70[_0x9a89('0x30')][_0x9a89('0x36')]);_0x365e34[_0x9a89('0x37')]=qs[_0x9a89('0x2e')](_[_0x9a89('0x38')](_0x5abe70[_0x9a89('0x30')],_0x267512[_0x9a89('0x2e')]),_0x2324c0);if(_0x5abe70[_0x9a89('0x30')][_0x9a89('0x39')]){_0x365e34[_0x9a89('0x37')]=_[_0x9a89('0x3a')](_0x365e34['where'],{'$or':_[_0x9a89('0x29')](_0x2324c0,function(_0x4a26e7){if(_0x4a26e7[_0x9a89('0x2b')]!==_0x9a89('0x3b')){var _0x26112d={};_0x26112d[_0x4a26e7[_0x9a89('0x27')]]={'$like':'%'+_0x5abe70[_0x9a89('0x30')][_0x9a89('0x39')]+'%'};return _0x26112d;}})});}_0x365e34=_[_0x9a89('0x3a')]({},_0x365e34,_0x5abe70[_0x9a89('0x3c')]);var _0x192138={'where':_0x365e34['where']};return db[_0x9a89('0x2a')][_0x9a89('0x1d')](_0x192138)[_0x9a89('0x23')](function(_0x20c53b){_0x2d019e['count']=_0x20c53b;if(_0x5abe70['query'][_0x9a89('0x3d')]){_0x365e34['include']=[{'all':!![]}];}return db[_0x9a89('0x2a')][_0x9a89('0x3e')](_0x365e34);})[_0x9a89('0x23')](function(_0x34885f){_0x2d019e[_0x9a89('0x3f')]=_0x34885f;return _0x2d019e;})[_0x9a89('0x23')](respondWithFilteredResult(_0x27f442,_0x365e34))[_0x9a89('0x40')](handleError(_0x27f442,null));};exports[_0x9a89('0x41')]=function(_0x5e592b,_0x4c4f2c){var _0x4fe28a={'raw':!![],'where':{'id':_0x5e592b['params']['id']}},_0x1d3545={};_0x1d3545['model']=_[_0x9a89('0x2d')](db[_0x9a89('0x2a')][_0x9a89('0x42')]);_0x1d3545['query']=_[_0x9a89('0x2d')](_0x5e592b['query']);_0x1d3545[_0x9a89('0x2e')]=_['intersection'](_0x1d3545[_0x9a89('0x2c')],_0x1d3545[_0x9a89('0x30')]);_0x4fe28a[_0x9a89('0x31')]=_['intersection'](_0x1d3545[_0x9a89('0x2c')],qs[_0x9a89('0x32')](_0x5e592b[_0x9a89('0x30')]['fields']));_0x4fe28a['attributes']=_0x4fe28a[_0x9a89('0x31')]['length']?_0x4fe28a[_0x9a89('0x31')]:_0x1d3545[_0x9a89('0x2c')];if(_0x5e592b['query'][_0x9a89('0x3d')]){_0x4fe28a[_0x9a89('0x43')]=[{'all':!![]}];}_0x4fe28a=_['merge']({},_0x4fe28a,_0x5e592b['options']);return db[_0x9a89('0x2a')][_0x9a89('0x44')](_0x4fe28a)['then'](handleEntityNotFound(_0x4c4f2c,null))[_0x9a89('0x23')](respondWithResult(_0x4c4f2c,null))['catch'](handleError(_0x4c4f2c,null));};exports[_0x9a89('0x45')]=function(_0x2d58d4,_0x31f48){return db[_0x9a89('0x2a')][_0x9a89('0x45')](_0x2d58d4['body'],{})[_0x9a89('0x23')](respondWithResult(_0x31f48,0xc9))['catch'](handleError(_0x31f48,null));};exports[_0x9a89('0x22')]=function(_0xc007aa,_0x58196c){if(_0xc007aa[_0x9a89('0x46')]['id']){delete _0xc007aa[_0x9a89('0x46')]['id'];}return db[_0x9a89('0x2a')][_0x9a89('0x44')]({'where':{'id':_0xc007aa[_0x9a89('0x47')]['id']}})[_0x9a89('0x23')](handleEntityNotFound(_0x58196c,null))[_0x9a89('0x23')](saveUpdates(_0xc007aa[_0x9a89('0x46')],null))[_0x9a89('0x23')](respondWithResult(_0x58196c,null))[_0x9a89('0x40')](handleError(_0x58196c,null));};exports[_0x9a89('0x48')]=function(_0x5abc42,_0x3546ba){return db[_0x9a89('0x2a')][_0x9a89('0x44')]({'where':{'id':_0x5abc42['params']['id']}})[_0x9a89('0x23')](handleEntityNotFound(_0x3546ba,null))[_0x9a89('0x23')](removeEntity(_0x3546ba,null))['catch'](handleError(_0x3546ba,null));};exports['describe']=function(_0xc3653d,_0x4410ca){return db[_0x9a89('0x2a')]['describe']()[_0x9a89('0x23')](respondWithResult(_0x4410ca,null))[_0x9a89('0x40')](handleError(_0x4410ca,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 76e160d..97924d9 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x928d97,_0x1f4d41){var _0x2268ed=function(_0x1d53ce){while(--_0x1d53ce){_0x928d97['push'](_0x928d97['shift']());}};_0x2268ed(++_0x1f4d41);}(_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('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x3db0b8,_0x1e7c2b){var _0x2ff0c3=function(_0x51e28b){while(--_0x51e28b){_0x3db0b8['push'](_0x3db0b8['shift']());}};_0x2ff0c3(++_0x1e7c2b);}(_0xb7e7,0x121));var _0x7b7e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xb7e7[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index f52bcd1..aa93327 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 _0x6777=['../../config/logger','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','raw','stringify','UpdateChatQueueReport','update','body','options','where','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x6777,0xb9));var _0x7677=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x6777[_0x1d87fc];return _0x492b56;};'use strict';var _=require(_0x7677('0x0'));var util=require(_0x7677('0x1'));var moment=require(_0x7677('0x2'));var BPromise=require('bluebird');var rs=require(_0x7677('0x3'));var fs=require('fs');var Redis=require(_0x7677('0x4'));var db=require(_0x7677('0x5'))['db'];var utils=require(_0x7677('0x6'));var logger=require(_0x7677('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7677('0x8'));var client=jayson[_0x7677('0x9')][_0x7677('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x581df1,_0x4c5f3c,_0x329839){return new BPromise(function(_0x2dd39f,_0x1e45d6){return client['request'](_0x581df1,_0x329839)[_0x7677('0xb')](function(_0x488188){logger[_0x7677('0xc')](_0x7677('0xd'),_0x4c5f3c,'request\x20sent');logger[_0x7677('0xe')](_0x7677('0xf'),_0x4c5f3c,_0x7677('0x10'),JSON['stringify'](_0x488188));if(_0x488188['error']){if(_0x488188['error']['code']===0x1f4){logger[_0x7677('0x11')](_0x7677('0xd'),_0x4c5f3c,_0x488188[_0x7677('0x11')][_0x7677('0x12')]);return _0x1e45d6(_0x488188[_0x7677('0x11')]['message']);}logger[_0x7677('0x11')](_0x7677('0xd'),_0x4c5f3c,_0x488188[_0x7677('0x11')]['message']);return _0x2dd39f(_0x488188[_0x7677('0x11')]['message']);}else{logger[_0x7677('0xc')](_0x7677('0xd'),_0x4c5f3c,'request\x20sent');_0x2dd39f(_0x488188[_0x7677('0x13')][_0x7677('0x12')]);}})[_0x7677('0x14')](function(_0x587231){logger[_0x7677('0x11')](_0x7677('0xd'),_0x4c5f3c,_0x587231);_0x1e45d6(_0x587231);});});}exports[_0x7677('0x15')]=function(_0x525926){var _0x36041e=this;return new Promise(function(_0x8d9825,_0x1c5b6b){return db[_0x7677('0x16')][_0x7677('0x17')](_0x525926['body'],{'raw':_0x525926['options']?_0x525926['options'][_0x7677('0x18')]===undefined?!![]:![]:!![]})[_0x7677('0xb')](function(_0x5dd74d){logger[_0x7677('0xc')](_0x7677('0x15'),_0x525926);logger[_0x7677('0xe')](_0x7677('0x15'),_0x525926,JSON[_0x7677('0x19')](_0x5dd74d));_0x8d9825(_0x5dd74d);})['catch'](function(_0x45619f){logger[_0x7677('0x11')]('CreateChatQueueReport',_0x45619f['message'],_0x525926);_0x1c5b6b(_0x36041e[_0x7677('0x11')](0x1f4,_0x45619f[_0x7677('0x12')]));});});};exports[_0x7677('0x1a')]=function(_0x59d1e6){var _0x1ef4aa=this;return new Promise(function(_0x53a949,_0x3884bc){return db['ChatQueueReport'][_0x7677('0x1b')](_0x59d1e6[_0x7677('0x1c')],{'raw':_0x59d1e6['options']?_0x59d1e6['options'][_0x7677('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59d1e6[_0x7677('0x1d')]?_0x59d1e6['options'][_0x7677('0x1e')]||null:null,'attributes':_0x59d1e6[_0x7677('0x1d')]?_0x59d1e6[_0x7677('0x1d')][_0x7677('0x1f')]||null:null,'limit':_0x59d1e6[_0x7677('0x1d')]?_0x59d1e6[_0x7677('0x1d')]['limit']||null:null})[_0x7677('0xb')](function(_0x37524d){logger['info'](_0x7677('0x1a'),_0x59d1e6);logger[_0x7677('0xe')]('UpdateChatQueueReport',_0x59d1e6,JSON[_0x7677('0x19')](_0x37524d));_0x53a949(_0x37524d);})[_0x7677('0x14')](function(_0x3a7b39){logger['error'](_0x7677('0x1a'),_0x3a7b39[_0x7677('0x12')],_0x59d1e6);_0x3884bc(_0x1ef4aa['error'](0x1f4,_0x3a7b39[_0x7677('0x12')]));});});}; \ No newline at end of file +var _0xcf36=['info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','create','body','options','CreateChatQueueReport','UpdateChatQueueReport','ChatQueueReport','raw','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x855e30,_0x1646d4){var _0x538690=function(_0xcd1bbb){while(--_0xcd1bbb){_0x855e30['push'](_0x855e30['shift']());}};_0x538690(++_0x1646d4);}(_0xcf36,0xc3));var _0x6cf3=function(_0x12a984,_0x588a25){_0x12a984=_0x12a984-0x0;var _0x1b005e=_0xcf36[_0x12a984];return _0x1b005e;};'use strict';var _=require(_0x6cf3('0x0'));var util=require(_0x6cf3('0x1'));var moment=require(_0x6cf3('0x2'));var BPromise=require(_0x6cf3('0x3'));var rs=require(_0x6cf3('0x4'));var fs=require('fs');var Redis=require(_0x6cf3('0x5'));var db=require(_0x6cf3('0x6'))['db'];var utils=require(_0x6cf3('0x7'));var logger=require(_0x6cf3('0x8'))(_0x6cf3('0x9'));var config=require(_0x6cf3('0xa'));var jayson=require(_0x6cf3('0xb'));var client=jayson[_0x6cf3('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55994e,_0xed1fff,_0x7faa89){return new BPromise(function(_0x2ba062,_0x5ecb66){return client[_0x6cf3('0xd')](_0x55994e,_0x7faa89)[_0x6cf3('0xe')](function(_0x21d4d0){logger[_0x6cf3('0xf')](_0x6cf3('0x10'),_0xed1fff,'request\x20sent');logger[_0x6cf3('0x11')](_0x6cf3('0x12'),_0xed1fff,'request\x20sent',JSON[_0x6cf3('0x13')](_0x21d4d0));if(_0x21d4d0[_0x6cf3('0x14')]){if(_0x21d4d0['error'][_0x6cf3('0x15')]===0x1f4){logger[_0x6cf3('0x14')](_0x6cf3('0x10'),_0xed1fff,_0x21d4d0[_0x6cf3('0x14')]['message']);return _0x5ecb66(_0x21d4d0[_0x6cf3('0x14')][_0x6cf3('0x16')]);}logger[_0x6cf3('0x14')](_0x6cf3('0x10'),_0xed1fff,_0x21d4d0['error']['message']);return _0x2ba062(_0x21d4d0[_0x6cf3('0x14')]['message']);}else{logger[_0x6cf3('0xf')](_0x6cf3('0x10'),_0xed1fff,_0x6cf3('0x17'));_0x2ba062(_0x21d4d0[_0x6cf3('0x18')][_0x6cf3('0x16')]);}})[_0x6cf3('0x19')](function(_0x5eec56){logger[_0x6cf3('0x14')](_0x6cf3('0x10'),_0xed1fff,_0x5eec56);_0x5ecb66(_0x5eec56);});});}exports['CreateChatQueueReport']=function(_0x5e1a15){var _0x161721=this;return new Promise(function(_0x57cbd9,_0x3f3793){return db['ChatQueueReport'][_0x6cf3('0x1a')](_0x5e1a15[_0x6cf3('0x1b')],{'raw':_0x5e1a15[_0x6cf3('0x1c')]?_0x5e1a15[_0x6cf3('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3c6d45){logger['info'](_0x6cf3('0x1d'),_0x5e1a15);logger['debug'](_0x6cf3('0x1d'),_0x5e1a15,JSON[_0x6cf3('0x13')](_0x3c6d45));_0x57cbd9(_0x3c6d45);})[_0x6cf3('0x19')](function(_0x162e78){logger[_0x6cf3('0x14')](_0x6cf3('0x1d'),_0x162e78[_0x6cf3('0x16')],_0x5e1a15);_0x3f3793(_0x161721[_0x6cf3('0x14')](0x1f4,_0x162e78[_0x6cf3('0x16')]));});});};exports[_0x6cf3('0x1e')]=function(_0x3301d0){var _0x313975=this;return new Promise(function(_0xb36f27,_0x6304b1){return db[_0x6cf3('0x1f')]['update'](_0x3301d0[_0x6cf3('0x1b')],{'raw':_0x3301d0[_0x6cf3('0x1c')]?_0x3301d0[_0x6cf3('0x1c')][_0x6cf3('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3301d0[_0x6cf3('0x1c')]?_0x3301d0[_0x6cf3('0x1c')]['where']||null:null,'attributes':_0x3301d0[_0x6cf3('0x1c')]?_0x3301d0['options'][_0x6cf3('0x21')]||null:null,'limit':_0x3301d0[_0x6cf3('0x1c')]?_0x3301d0['options'][_0x6cf3('0x22')]||null:null})[_0x6cf3('0xe')](function(_0x2f24eb){logger[_0x6cf3('0xf')](_0x6cf3('0x1e'),_0x3301d0);logger['debug']('UpdateChatQueueReport',_0x3301d0,JSON[_0x6cf3('0x13')](_0x2f24eb));_0xb36f27(_0x2f24eb);})[_0x6cf3('0x19')](function(_0x721888){logger[_0x6cf3('0x14')](_0x6cf3('0x1e'),_0x721888['message'],_0x3301d0);_0x6304b1(_0x313975['error'](0x1f4,_0x721888[_0x6cf3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index ac032cb..d69e465 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 _0x361b=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x26d779,_0x4c7d16){var _0x44d48a=function(_0x51ec1e){while(--_0x51ec1e){_0x26d779['push'](_0x26d779['shift']());}};_0x44d48a(++_0x4c7d16);}(_0x361b,0x13e));var _0xb361=function(_0x30ad25,_0x2d5e6f){_0x30ad25=_0x30ad25-0x0;var _0x30388a=_0x361b[_0x30ad25];return _0x30388a;};'use strict';var multer=require('multer');var util=require(_0xb361('0x0'));var path=require(_0xb361('0x1'));var timeout=require(_0xb361('0x2'));var express=require('express');var router=express[_0xb361('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb361('0x4'));var interaction=require(_0xb361('0x5'));var config=require(_0xb361('0x6'));var controller=require('./chatQueueReport.controller');router[_0xb361('0x7')]('/',auth[_0xb361('0x8')](),controller[_0xb361('0x9')]);router[_0xb361('0x7')](_0xb361('0xa'),auth[_0xb361('0x8')](),controller[_0xb361('0xb')]);router[_0xb361('0x7')](_0xb361('0xc'),auth[_0xb361('0x8')](),controller['show']);router[_0xb361('0xd')]('/',auth['isAuthenticated'](),controller[_0xb361('0xe')]);router['put']('/:id',auth[_0xb361('0x8')](),controller['update']);router[_0xb361('0xf')](_0xb361('0xc'),auth[_0xb361('0x8')](),controller[_0xb361('0x10')]);module[_0xb361('0x11')]=router; \ No newline at end of file +var _0x12d7=['../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','fs-extra'];(function(_0x1aadbd,_0x1e7d39){var _0x44b046=function(_0xb9be3b){while(--_0xb9be3b){_0x1aadbd['push'](_0x1aadbd['shift']());}};_0x44b046(++_0x1e7d39);}(_0x12d7,0x1bf));var _0x712d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12d7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x712d('0x0'));var util=require(_0x712d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x712d('0x2'));var auth=require(_0x712d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x712d('0x4'));var controller=require(_0x712d('0x5'));router[_0x712d('0x6')]('/',auth[_0x712d('0x7')](),controller['index']);router['get'](_0x712d('0x8'),auth[_0x712d('0x7')](),controller[_0x712d('0x9')]);router[_0x712d('0x6')](_0x712d('0xa'),auth[_0x712d('0x7')](),controller[_0x712d('0xb')]);router[_0x712d('0xc')]('/',auth[_0x712d('0x7')](),controller[_0x712d('0xd')]);router[_0x712d('0xe')]('/:id',auth[_0x712d('0x7')](),controller[_0x712d('0xf')]);router[_0x712d('0x10')](_0x712d('0xa'),auth[_0x712d('0x7')](),controller[_0x712d('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 2241a6f..6d0fd85 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(_0x949fa7,_0x2bd1b2){var _0x4874f4=function(_0x5602b7){while(--_0x5602b7){_0x949fa7['push'](_0x949fa7['shift']());}};_0x4874f4(++_0x2bd1b2);}(_0xaa88,0x137));var _0x8aa8=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xaa88[_0x468b0f];return _0x3e74d9;};'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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x58ee84,_0x5f08f2){var _0x3ff1c4=function(_0x3f8a26){while(--_0x3f8a26){_0x58ee84['push'](_0x58ee84['shift']());}};_0x3ff1c4(++_0x5f08f2);}(_0xe706,0xa3));var _0x6e70=function(_0x7a6897,_0x66fa7c){_0x7a6897=_0x7a6897-0x0;var _0x1d49c1=_0xe706[_0x7a6897];return _0x1d49c1;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index da9597d..ba741e2 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 _0x82b3=['where','filters','pick','filter','merge','options','ChatTransferReport','then','includeAll','include','findAll','rows','catch','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','limit','set','apply','reject','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','offset','order','sort'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x82b3,0xf6));var _0x382b=function(_0x1ace50,_0x36aaef){_0x1ace50=_0x1ace50-0x0;var _0x59c30e=_0x82b3[_0x1ace50];return _0x59c30e;};'use strict';var emlformat=require(_0x382b('0x0'));var rimraf=require(_0x382b('0x1'));var zipdir=require(_0x382b('0x2'));var jsonpatch=require(_0x382b('0x3'));var rp=require('request-promise');var moment=require(_0x382b('0x4'));var BPromise=require(_0x382b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x382b('0x6'));var sox=require(_0x382b('0x7'));var csv=require(_0x382b('0x8'));var ejs=require(_0x382b('0x9'));var fs=require('fs');var fs_extra=require(_0x382b('0xa'));var _=require(_0x382b('0xb'));var squel=require('squel');var crypto=require(_0x382b('0xc'));var jsforce=require(_0x382b('0xd'));var deskjs=require(_0x382b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x382b('0xf'));var Papa=require(_0x382b('0x10'));var Redis=require(_0x382b('0x11'));var authService=require(_0x382b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x382b('0x13'));var hardwareService=require(_0x382b('0x14'));var logger=require(_0x382b('0x15'))(_0x382b('0x16'));var utils=require('../../config/utils');var config=require(_0x382b('0x17'));var licenseUtil=require(_0x382b('0x18'));var db=require(_0x382b('0x19'))['db'];function respondWithStatusCode(_0x4af95e,_0x14e480){_0x14e480=_0x14e480||0xcc;return function(_0x3ed04e){if(_0x3ed04e){return _0x4af95e[_0x382b('0x1a')](_0x14e480);}return _0x4af95e['status'](_0x14e480)[_0x382b('0x1b')]();};}function respondWithResult(_0x3448c6,_0x3b96ba){_0x3b96ba=_0x3b96ba||0xc8;return function(_0x430196){if(_0x430196){return _0x3448c6[_0x382b('0x1c')](_0x3b96ba)[_0x382b('0x1d')](_0x430196);}};}function respondWithFilteredResult(_0x4502cd,_0x1bbd79){return function(_0x3cc3e5){if(_0x3cc3e5){var _0x28a221=typeof _0x1bbd79['offset']===_0x382b('0x1e')&&typeof _0x1bbd79['limit']==='undefined';var _0x599d43=_0x3cc3e5[_0x382b('0x1f')];var _0xb0e20=_0x28a221?0x0:_0x1bbd79['offset'];var _0x504ccd=_0x28a221?_0x3cc3e5[_0x382b('0x1f')]:_0x1bbd79['offset']+_0x1bbd79[_0x382b('0x20')];var _0x1ea2f8;if(_0x504ccd>=_0x599d43){_0x504ccd=_0x599d43;_0x1ea2f8=0xc8;}else{_0x1ea2f8=0xce;}_0x4502cd['status'](_0x1ea2f8);return _0x4502cd[_0x382b('0x21')]('Content-Range',_0xb0e20+'-'+_0x504ccd+'/'+_0x599d43)['json'](_0x3cc3e5);}return null;};}function patchUpdates(_0x10e7ce){return function(_0x1ac23b){try{jsonpatch[_0x382b('0x22')](_0x1ac23b,_0x10e7ce,!![]);}catch(_0x4d9a17){return BPromise[_0x382b('0x23')](_0x4d9a17);}return _0x1ac23b['save']();};}function saveUpdates(_0x426119,_0x2d1df4){return function(_0x3a5066){if(_0x3a5066){return _0x3a5066[_0x382b('0x24')](_0x426119)['then'](function(_0x4735bf){return _0x4735bf;});}return null;};}function removeEntity(_0x1fd102,_0x523210){return function(_0x15dce1){if(_0x15dce1){return _0x15dce1[_0x382b('0x25')]()['then'](function(){_0x1fd102[_0x382b('0x1c')](0xcc)[_0x382b('0x1b')]();});}};}function handleEntityNotFound(_0x11838e,_0x450535){return function(_0x523f81){if(!_0x523f81){_0x11838e[_0x382b('0x1a')](0x194);}return _0x523f81;};}function handleError(_0x57be29,_0x151cb0){_0x151cb0=_0x151cb0||0x1f4;return function(_0x6e324d){logger[_0x382b('0x26')](_0x6e324d[_0x382b('0x27')]);if(_0x6e324d[_0x382b('0x28')]){delete _0x6e324d[_0x382b('0x28')];}_0x57be29['status'](_0x151cb0)[_0x382b('0x29')](_0x6e324d);};}exports[_0x382b('0x2a')]=function(_0x478764,_0x4ab3dc){var _0x198251={},_0x138449={},_0x180ee4={'count':0x0,'rows':[]};var _0x1458ac=_[_0x382b('0x2b')](db['ChatTransferReport'][_0x382b('0x2c')],function(_0x333e16){return{'name':_0x333e16[_0x382b('0x2d')],'type':_0x333e16[_0x382b('0x2e')][_0x382b('0x2f')]};});_0x138449[_0x382b('0x30')]=_['map'](_0x1458ac,_0x382b('0x28'));_0x138449['query']=_[_0x382b('0x31')](_0x478764[_0x382b('0x32')]);_0x138449['filters']=_[_0x382b('0x33')](_0x138449[_0x382b('0x30')],_0x138449['query']);_0x198251[_0x382b('0x34')]=_['intersection'](_0x138449[_0x382b('0x30')],qs[_0x382b('0x35')](_0x478764[_0x382b('0x32')]['fields']));_0x198251[_0x382b('0x34')]=_0x198251['attributes'][_0x382b('0x36')]?_0x198251['attributes']:_0x138449[_0x382b('0x30')];if(!_0x478764['query']['hasOwnProperty']('nolimit')){_0x198251[_0x382b('0x20')]=qs[_0x382b('0x20')](_0x478764['query']['limit']);_0x198251[_0x382b('0x37')]=qs[_0x382b('0x37')](_0x478764[_0x382b('0x32')][_0x382b('0x37')]);}_0x198251[_0x382b('0x38')]=qs['sort'](_0x478764[_0x382b('0x32')][_0x382b('0x39')]);_0x198251[_0x382b('0x3a')]=qs[_0x382b('0x3b')](_[_0x382b('0x3c')](_0x478764['query'],_0x138449['filters']),_0x1458ac);if(_0x478764['query'][_0x382b('0x3d')]){_0x198251[_0x382b('0x3a')]=_['merge'](_0x198251[_0x382b('0x3a')],{'$or':_[_0x382b('0x2b')](_0x1458ac,function(_0x450fa9){if(_0x450fa9[_0x382b('0x2e')]!=='VIRTUAL'){var _0x339605={};_0x339605[_0x450fa9[_0x382b('0x28')]]={'$like':'%'+_0x478764[_0x382b('0x32')][_0x382b('0x3d')]+'%'};return _0x339605;}})});}_0x198251=_[_0x382b('0x3e')]({},_0x198251,_0x478764[_0x382b('0x3f')]);var _0x2639b0={'where':_0x198251[_0x382b('0x3a')]};return db[_0x382b('0x40')]['count'](_0x2639b0)[_0x382b('0x41')](function(_0x5f0f76){_0x180ee4[_0x382b('0x1f')]=_0x5f0f76;if(_0x478764[_0x382b('0x32')][_0x382b('0x42')]){_0x198251[_0x382b('0x43')]=[{'all':!![]}];}return db[_0x382b('0x40')][_0x382b('0x44')](_0x198251);})[_0x382b('0x41')](function(_0x3f04f4){_0x180ee4[_0x382b('0x45')]=_0x3f04f4;return _0x180ee4;})['then'](respondWithFilteredResult(_0x4ab3dc,_0x198251))[_0x382b('0x46')](handleError(_0x4ab3dc,null));};exports['show']=function(_0x53996e,_0x1902a5){var _0x3d71b1={'raw':!![],'where':{'id':_0x53996e[_0x382b('0x47')]['id']}},_0x408977={};_0x408977[_0x382b('0x30')]=_['keys'](db[_0x382b('0x40')]['rawAttributes']);_0x408977['query']=_[_0x382b('0x31')](_0x53996e[_0x382b('0x32')]);_0x408977[_0x382b('0x3b')]=_['intersection'](_0x408977[_0x382b('0x30')],_0x408977[_0x382b('0x32')]);_0x3d71b1[_0x382b('0x34')]=_[_0x382b('0x33')](_0x408977[_0x382b('0x30')],qs['fields'](_0x53996e['query'][_0x382b('0x35')]));_0x3d71b1[_0x382b('0x34')]=_0x3d71b1[_0x382b('0x34')][_0x382b('0x36')]?_0x3d71b1[_0x382b('0x34')]:_0x408977[_0x382b('0x30')];if(_0x53996e[_0x382b('0x32')][_0x382b('0x42')]){_0x3d71b1['include']=[{'all':!![]}];}_0x3d71b1=_['merge']({},_0x3d71b1,_0x53996e['options']);return db[_0x382b('0x40')]['find'](_0x3d71b1)[_0x382b('0x41')](handleEntityNotFound(_0x1902a5,null))['then'](respondWithResult(_0x1902a5,null))['catch'](handleError(_0x1902a5,null));};exports[_0x382b('0x48')]=function(_0x2fe564,_0x107201){return db['ChatTransferReport'][_0x382b('0x48')](_0x2fe564[_0x382b('0x49')],{})[_0x382b('0x41')](respondWithResult(_0x107201,0xc9))[_0x382b('0x46')](handleError(_0x107201,null));};exports[_0x382b('0x24')]=function(_0x176ca9,_0x38f834){if(_0x176ca9[_0x382b('0x49')]['id']){delete _0x176ca9['body']['id'];}return db[_0x382b('0x40')]['find']({'where':{'id':_0x176ca9[_0x382b('0x47')]['id']}})[_0x382b('0x41')](handleEntityNotFound(_0x38f834,null))[_0x382b('0x41')](saveUpdates(_0x176ca9['body'],null))[_0x382b('0x41')](respondWithResult(_0x38f834,null))[_0x382b('0x46')](handleError(_0x38f834,null));};exports[_0x382b('0x25')]=function(_0xa9d081,_0xf82722){return db[_0x382b('0x40')][_0x382b('0x4a')]({'where':{'id':_0xa9d081['params']['id']}})['then'](handleEntityNotFound(_0xf82722,null))['then'](removeEntity(_0xf82722,null))['catch'](handleError(_0xf82722,null));};exports[_0x382b('0x4b')]=function(_0x39ea43,_0x533ee6){return db[_0x382b('0x40')]['describe']()[_0x382b('0x41')](respondWithResult(_0x533ee6,null))[_0x382b('0x46')](handleError(_0x533ee6,null));}; \ No newline at end of file +var _0x2b85=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','error','name','index','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x2b85,0x166));var _0x52b8=function(_0x4e5787,_0x4986d9){_0x4e5787=_0x4e5787-0x0;var _0x554114=_0x2b85[_0x4e5787];return _0x554114;};'use strict';var emlformat=require(_0x52b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x52b8('0x1'));var jsonpatch=require(_0x52b8('0x2'));var rp=require(_0x52b8('0x3'));var moment=require(_0x52b8('0x4'));var BPromise=require(_0x52b8('0x5'));var Mustache=require(_0x52b8('0x6'));var util=require(_0x52b8('0x7'));var path=require(_0x52b8('0x8'));var sox=require(_0x52b8('0x9'));var csv=require(_0x52b8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x52b8('0xb'));var squel=require(_0x52b8('0xc'));var crypto=require(_0x52b8('0xd'));var jsforce=require(_0x52b8('0xe'));var deskjs=require(_0x52b8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x52b8('0x10'));var Papa=require(_0x52b8('0x11'));var Redis=require('ioredis');var authService=require(_0x52b8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x52b8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x52b8('0x14'));var utils=require(_0x52b8('0x15'));var config=require(_0x52b8('0x16'));var licenseUtil=require(_0x52b8('0x17'));var db=require(_0x52b8('0x18'))['db'];function respondWithStatusCode(_0x43b500,_0x2b4c1f){_0x2b4c1f=_0x2b4c1f||0xcc;return function(_0x2156fe){if(_0x2156fe){return _0x43b500[_0x52b8('0x19')](_0x2b4c1f);}return _0x43b500[_0x52b8('0x1a')](_0x2b4c1f)[_0x52b8('0x1b')]();};}function respondWithResult(_0x44a735,_0x3b3846){_0x3b3846=_0x3b3846||0xc8;return function(_0x3129da){if(_0x3129da){return _0x44a735['status'](_0x3b3846)[_0x52b8('0x1c')](_0x3129da);}};}function respondWithFilteredResult(_0x1a9ccb,_0x152771){return function(_0x57650a){if(_0x57650a){var _0x4930f0=typeof _0x152771[_0x52b8('0x1d')]===_0x52b8('0x1e')&&typeof _0x152771[_0x52b8('0x1f')]==='undefined';var _0x9121c5=_0x57650a[_0x52b8('0x20')];var _0x1ba89d=_0x4930f0?0x0:_0x152771['offset'];var _0x37a27b=_0x4930f0?_0x57650a[_0x52b8('0x20')]:_0x152771[_0x52b8('0x1d')]+_0x152771['limit'];var _0x4bd95c;if(_0x37a27b>=_0x9121c5){_0x37a27b=_0x9121c5;_0x4bd95c=0xc8;}else{_0x4bd95c=0xce;}_0x1a9ccb[_0x52b8('0x1a')](_0x4bd95c);return _0x1a9ccb['set'](_0x52b8('0x21'),_0x1ba89d+'-'+_0x37a27b+'/'+_0x9121c5)[_0x52b8('0x1c')](_0x57650a);}return null;};}function patchUpdates(_0x4e1594){return function(_0xee9fe1){try{jsonpatch[_0x52b8('0x22')](_0xee9fe1,_0x4e1594,!![]);}catch(_0xc51c4f){return BPromise['reject'](_0xc51c4f);}return _0xee9fe1[_0x52b8('0x23')]();};}function saveUpdates(_0x415d3f,_0x228ab6){return function(_0x4a1c1e){if(_0x4a1c1e){return _0x4a1c1e[_0x52b8('0x24')](_0x415d3f)['then'](function(_0x364814){return _0x364814;});}return null;};}function removeEntity(_0x225df8,_0x35ca8b){return function(_0x51526e){if(_0x51526e){return _0x51526e[_0x52b8('0x25')]()[_0x52b8('0x26')](function(){_0x225df8[_0x52b8('0x1a')](0xcc)[_0x52b8('0x1b')]();});}};}function handleEntityNotFound(_0x178080,_0x1575ff){return function(_0x2a5bd7){if(!_0x2a5bd7){_0x178080[_0x52b8('0x19')](0x194);}return _0x2a5bd7;};}function handleError(_0x564239,_0x208f45){_0x208f45=_0x208f45||0x1f4;return function(_0x16cee6){logger[_0x52b8('0x27')](_0x16cee6['stack']);if(_0x16cee6[_0x52b8('0x28')]){delete _0x16cee6[_0x52b8('0x28')];}_0x564239[_0x52b8('0x1a')](_0x208f45)['send'](_0x16cee6);};}exports[_0x52b8('0x29')]=function(_0x38eb6a,_0x2834a7){var _0x5d2c98={},_0x5c7bf0={},_0x18f75f={'count':0x0,'rows':[]};var _0x3f60c7=_['map'](db[_0x52b8('0x2a')][_0x52b8('0x2b')],function(_0x2a3d15){return{'name':_0x2a3d15[_0x52b8('0x2c')],'type':_0x2a3d15[_0x52b8('0x2d')][_0x52b8('0x2e')]};});_0x5c7bf0[_0x52b8('0x2f')]=_[_0x52b8('0x30')](_0x3f60c7,_0x52b8('0x28'));_0x5c7bf0[_0x52b8('0x31')]=_[_0x52b8('0x32')](_0x38eb6a[_0x52b8('0x31')]);_0x5c7bf0['filters']=_['intersection'](_0x5c7bf0[_0x52b8('0x2f')],_0x5c7bf0[_0x52b8('0x31')]);_0x5d2c98[_0x52b8('0x33')]=_[_0x52b8('0x34')](_0x5c7bf0[_0x52b8('0x2f')],qs[_0x52b8('0x35')](_0x38eb6a['query'][_0x52b8('0x35')]));_0x5d2c98[_0x52b8('0x33')]=_0x5d2c98[_0x52b8('0x33')][_0x52b8('0x36')]?_0x5d2c98[_0x52b8('0x33')]:_0x5c7bf0[_0x52b8('0x2f')];if(!_0x38eb6a[_0x52b8('0x31')][_0x52b8('0x37')](_0x52b8('0x38'))){_0x5d2c98[_0x52b8('0x1f')]=qs[_0x52b8('0x1f')](_0x38eb6a[_0x52b8('0x31')][_0x52b8('0x1f')]);_0x5d2c98[_0x52b8('0x1d')]=qs[_0x52b8('0x1d')](_0x38eb6a[_0x52b8('0x31')][_0x52b8('0x1d')]);}_0x5d2c98[_0x52b8('0x39')]=qs[_0x52b8('0x3a')](_0x38eb6a['query'][_0x52b8('0x3a')]);_0x5d2c98['where']=qs[_0x52b8('0x3b')](_[_0x52b8('0x3c')](_0x38eb6a['query'],_0x5c7bf0['filters']),_0x3f60c7);if(_0x38eb6a[_0x52b8('0x31')][_0x52b8('0x3d')]){_0x5d2c98[_0x52b8('0x3e')]=_[_0x52b8('0x3f')](_0x5d2c98[_0x52b8('0x3e')],{'$or':_['map'](_0x3f60c7,function(_0x4242b6){if(_0x4242b6['type']!==_0x52b8('0x40')){var _0x3ddf79={};_0x3ddf79[_0x4242b6[_0x52b8('0x28')]]={'$like':'%'+_0x38eb6a[_0x52b8('0x31')][_0x52b8('0x3d')]+'%'};return _0x3ddf79;}})});}_0x5d2c98=_[_0x52b8('0x3f')]({},_0x5d2c98,_0x38eb6a[_0x52b8('0x41')]);var _0x40b0ad={'where':_0x5d2c98[_0x52b8('0x3e')]};return db[_0x52b8('0x2a')][_0x52b8('0x20')](_0x40b0ad)[_0x52b8('0x26')](function(_0x190ff7){_0x18f75f['count']=_0x190ff7;if(_0x38eb6a[_0x52b8('0x31')][_0x52b8('0x42')]){_0x5d2c98[_0x52b8('0x43')]=[{'all':!![]}];}return db[_0x52b8('0x2a')][_0x52b8('0x44')](_0x5d2c98);})[_0x52b8('0x26')](function(_0x222102){_0x18f75f[_0x52b8('0x45')]=_0x222102;return _0x18f75f;})[_0x52b8('0x26')](respondWithFilteredResult(_0x2834a7,_0x5d2c98))[_0x52b8('0x46')](handleError(_0x2834a7,null));};exports[_0x52b8('0x47')]=function(_0x3e7102,_0x31a6eb){var _0x2c1a36={'raw':!![],'where':{'id':_0x3e7102['params']['id']}},_0x910597={};_0x910597['model']=_[_0x52b8('0x32')](db[_0x52b8('0x2a')][_0x52b8('0x2b')]);_0x910597[_0x52b8('0x31')]=_['keys'](_0x3e7102[_0x52b8('0x31')]);_0x910597['filters']=_[_0x52b8('0x34')](_0x910597['model'],_0x910597[_0x52b8('0x31')]);_0x2c1a36[_0x52b8('0x33')]=_[_0x52b8('0x34')](_0x910597[_0x52b8('0x2f')],qs[_0x52b8('0x35')](_0x3e7102['query'][_0x52b8('0x35')]));_0x2c1a36['attributes']=_0x2c1a36[_0x52b8('0x33')][_0x52b8('0x36')]?_0x2c1a36[_0x52b8('0x33')]:_0x910597[_0x52b8('0x2f')];if(_0x3e7102['query'][_0x52b8('0x42')]){_0x2c1a36[_0x52b8('0x43')]=[{'all':!![]}];}_0x2c1a36=_[_0x52b8('0x3f')]({},_0x2c1a36,_0x3e7102[_0x52b8('0x41')]);return db[_0x52b8('0x2a')][_0x52b8('0x48')](_0x2c1a36)[_0x52b8('0x26')](handleEntityNotFound(_0x31a6eb,null))[_0x52b8('0x26')](respondWithResult(_0x31a6eb,null))['catch'](handleError(_0x31a6eb,null));};exports[_0x52b8('0x49')]=function(_0x5c37e3,_0x37648a){return db[_0x52b8('0x2a')]['create'](_0x5c37e3['body'],{})[_0x52b8('0x26')](respondWithResult(_0x37648a,0xc9))[_0x52b8('0x46')](handleError(_0x37648a,null));};exports[_0x52b8('0x24')]=function(_0x593e01,_0x1c188d){if(_0x593e01['body']['id']){delete _0x593e01[_0x52b8('0x4a')]['id'];}return db[_0x52b8('0x2a')]['find']({'where':{'id':_0x593e01['params']['id']}})[_0x52b8('0x26')](handleEntityNotFound(_0x1c188d,null))[_0x52b8('0x26')](saveUpdates(_0x593e01[_0x52b8('0x4a')],null))['then'](respondWithResult(_0x1c188d,null))['catch'](handleError(_0x1c188d,null));};exports[_0x52b8('0x25')]=function(_0x3d6152,_0x3567af){return db[_0x52b8('0x2a')][_0x52b8('0x48')]({'where':{'id':_0x3d6152['params']['id']}})['then'](handleEntityNotFound(_0x3567af,null))[_0x52b8('0x26')](removeEntity(_0x3567af,null))[_0x52b8('0x46')](handleError(_0x3567af,null));};exports[_0x52b8('0x4b')]=function(_0x1a6735,_0x4b8cf3){return db['ChatTransferReport'][_0x52b8('0x4b')]()[_0x52b8('0x26')](respondWithResult(_0x4b8cf3,null))[_0x52b8('0x46')](handleError(_0x4b8cf3,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index e68962e..c96d68a 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 _0xe8f5=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x36a680,_0x298c65){var _0x308a59=function(_0x553dba){while(--_0x553dba){_0x36a680['push'](_0x36a680['shift']());}};_0x308a59(++_0x298c65);}(_0xe8f5,0xed));var _0x5e8f=function(_0x1fe67a,_0x3794b1){_0x1fe67a=_0x1fe67a-0x0;var _0x3c5f44=_0xe8f5[_0x1fe67a];return _0x3c5f44;};'use strict';var _=require(_0x5e8f('0x0'));var util=require(_0x5e8f('0x1'));var logger=require(_0x5e8f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e8f('0x3'));var rp=require(_0x5e8f('0x4'));var fs=require('fs');var path=require(_0x5e8f('0x5'));var rimraf=require(_0x5e8f('0x6'));var config=require(_0x5e8f('0x7'));var attributes=require(_0x5e8f('0x8'));module[_0x5e8f('0x9')]=function(_0x4bbdc5,_0x19f626){return _0x4bbdc5[_0x5e8f('0xa')](_0x5e8f('0xb'),attributes,{'tableName':_0x5e8f('0xc'),'paranoid':![],'indexes':[{'name':_0x5e8f('0xd'),'fields':[_0x5e8f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x86a3=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','report_chat_transfer','uniqueid','lodash'];(function(_0x269c2c,_0x4f3883){var _0xe6f9b3=function(_0x392cd8){while(--_0x392cd8){_0x269c2c['push'](_0x269c2c['shift']());}};_0xe6f9b3(++_0x4f3883);}(_0x86a3,0xe3));var _0x386a=function(_0x179b53,_0x31f6fe){_0x179b53=_0x179b53-0x0;var _0x38a146=_0x86a3[_0x179b53];return _0x38a146;};'use strict';var _=require(_0x386a('0x0'));var util=require(_0x386a('0x1'));var logger=require('../../config/logger')(_0x386a('0x2'));var moment=require(_0x386a('0x3'));var BPromise=require(_0x386a('0x4'));var rp=require(_0x386a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x386a('0x6'));var config=require(_0x386a('0x7'));var attributes=require(_0x386a('0x8'));module[_0x386a('0x9')]=function(_0x55fa46,_0x25845c){return _0x55fa46['define']('ChatTransferReport',attributes,{'tableName':_0x386a('0xa'),'paranoid':![],'indexes':[{'name':_0x386a('0xb'),'fields':[_0x386a('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 3761308..a4a47a3 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 _0x51ff=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x39f210,_0x2fe032){var _0x19b0a6=function(_0x2338b6){while(--_0x2338b6){_0x39f210['push'](_0x39f210['shift']());}};_0x19b0a6(++_0x2fe032);}(_0x51ff,0x1b6));var _0xf51f=function(_0x3db05c,_0x2be283){_0x3db05c=_0x3db05c-0x0;var _0x3243e5=_0x51ff[_0x3db05c];return _0x3243e5;};'use strict';var _=require(_0xf51f('0x0'));var util=require(_0xf51f('0x1'));var moment=require('moment');var BPromise=require(_0xf51f('0x2'));var rs=require(_0xf51f('0x3'));var fs=require('fs');var Redis=require(_0xf51f('0x4'));var db=require(_0xf51f('0x5'))['db'];var utils=require(_0xf51f('0x6'));var logger=require(_0xf51f('0x7'))(_0xf51f('0x8'));var config=require(_0xf51f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf51f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ae39a,_0x190db8,_0x383fa8){return new BPromise(function(_0x298617,_0x24eadd){return client[_0xf51f('0xb')](_0x2ae39a,_0x383fa8)['then'](function(_0x290286){logger[_0xf51f('0xc')](_0xf51f('0xd'),_0x190db8,_0xf51f('0xe'));logger[_0xf51f('0xf')](_0xf51f('0x10'),_0x190db8,_0xf51f('0xe'),JSON[_0xf51f('0x11')](_0x290286));if(_0x290286[_0xf51f('0x12')]){if(_0x290286[_0xf51f('0x12')][_0xf51f('0x13')]===0x1f4){logger[_0xf51f('0x12')](_0xf51f('0xd'),_0x190db8,_0x290286['error'][_0xf51f('0x14')]);return _0x24eadd(_0x290286[_0xf51f('0x12')]['message']);}logger[_0xf51f('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x190db8,_0x290286[_0xf51f('0x12')]['message']);return _0x298617(_0x290286[_0xf51f('0x12')]['message']);}else{logger[_0xf51f('0xc')](_0xf51f('0xd'),_0x190db8,_0xf51f('0xe'));_0x298617(_0x290286[_0xf51f('0x15')][_0xf51f('0x14')]);}})[_0xf51f('0x16')](function(_0x192355){logger[_0xf51f('0x12')](_0xf51f('0xd'),_0x190db8,_0x192355);_0x24eadd(_0x192355);});});} \ No newline at end of file +var _0x9c84=['message','catch','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x268319,_0x53fc42){var _0x1f9479=function(_0x1e9127){while(--_0x1e9127){_0x268319['push'](_0x268319['shift']());}};_0x1f9479(++_0x53fc42);}(_0x9c84,0x158));var _0x49c8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9c84[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x49c8('0x0'));var util=require('util');var moment=require(_0x49c8('0x1'));var BPromise=require(_0x49c8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x49c8('0x3'));var logger=require(_0x49c8('0x4'))(_0x49c8('0x5'));var config=require(_0x49c8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b1063,_0x4af735,_0x31020b){return new BPromise(function(_0x183898,_0x3320e9){return client[_0x49c8('0x8')](_0x4b1063,_0x31020b)[_0x49c8('0x9')](function(_0x3b2742){logger[_0x49c8('0xa')](_0x49c8('0xb'),_0x4af735,_0x49c8('0xc'));logger[_0x49c8('0xd')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4af735,'request\x20sent',JSON[_0x49c8('0xe')](_0x3b2742));if(_0x3b2742[_0x49c8('0xf')]){if(_0x3b2742[_0x49c8('0xf')][_0x49c8('0x10')]===0x1f4){logger[_0x49c8('0xf')](_0x49c8('0xb'),_0x4af735,_0x3b2742['error'][_0x49c8('0x11')]);return _0x3320e9(_0x3b2742[_0x49c8('0xf')][_0x49c8('0x11')]);}logger[_0x49c8('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x4af735,_0x3b2742['error'][_0x49c8('0x11')]);return _0x183898(_0x3b2742['error'][_0x49c8('0x11')]);}else{logger[_0x49c8('0xa')](_0x49c8('0xb'),_0x4af735,_0x49c8('0xc'));_0x183898(_0x3b2742['result'][_0x49c8('0x11')]);}})[_0x49c8('0x12')](function(_0x42a3dc){logger['error'](_0x49c8('0xb'),_0x4af735,_0x42a3dc);_0x3320e9(_0x42a3dc);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 92c2563..d8e0af3 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 _0x51a6=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x41b91b,_0x9d49fa){var _0x2508f6=function(_0x21c5ea){while(--_0x21c5ea){_0x41b91b['push'](_0x41b91b['shift']());}};_0x2508f6(++_0x9d49fa);}(_0x51a6,0x117));var _0x651a=function(_0x4bed75,_0x211cc7){_0x4bed75=_0x4bed75-0x0;var _0x2dd8e8=_0x51a6[_0x4bed75];return _0x2dd8e8;};'use strict';var multer=require(_0x651a('0x0'));var util=require(_0x651a('0x1'));var path=require('path');var timeout=require(_0x651a('0x2'));var express=require('express');var router=express[_0x651a('0x3')]();var fs_extra=require(_0x651a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x651a('0x5'));var config=require(_0x651a('0x6'));var controller=require(_0x651a('0x7'));router[_0x651a('0x8')]('/',auth[_0x651a('0x9')](),controller['index']);router[_0x651a('0x8')](_0x651a('0xa'),auth[_0x651a('0x9')](),controller[_0x651a('0xb')]);router[_0x651a('0x8')](_0x651a('0xc'),auth[_0x651a('0x9')](),controller[_0x651a('0xd')]);router[_0x651a('0xe')]('/',auth[_0x651a('0x9')](),controller['create']);router[_0x651a('0xf')](_0x651a('0xc'),auth[_0x651a('0x9')](),controller['update']);router[_0x651a('0x10')]('/:id',auth[_0x651a('0x9')](),controller[_0x651a('0x11')]);module[_0x651a('0x12')]=router; \ No newline at end of file +var _0xe0a7=['isAuthenticated','index','describe','/:id','post','put','update','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe0a7,0x16d));var _0x7e0a=function(_0x133ac3,_0x1be667){_0x133ac3=_0x133ac3-0x0;var _0x4defe1=_0xe0a7[_0x133ac3];return _0x4defe1;};'use strict';var multer=require(_0x7e0a('0x0'));var util=require(_0x7e0a('0x1'));var path=require('path');var timeout=require(_0x7e0a('0x2'));var express=require('express');var router=express[_0x7e0a('0x3')]();var fs_extra=require(_0x7e0a('0x4'));var auth=require(_0x7e0a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7e0a('0x6'));var controller=require(_0x7e0a('0x7'));router[_0x7e0a('0x8')]('/',auth[_0x7e0a('0x9')](),controller[_0x7e0a('0xa')]);router[_0x7e0a('0x8')]('/describe',auth[_0x7e0a('0x9')](),controller[_0x7e0a('0xb')]);router[_0x7e0a('0x8')](_0x7e0a('0xc'),auth[_0x7e0a('0x9')](),controller['show']);router[_0x7e0a('0xd')]('/',auth[_0x7e0a('0x9')](),controller['create']);router[_0x7e0a('0xe')]('/:id',auth[_0x7e0a('0x9')](),controller[_0x7e0a('0xf')]);router['delete'](_0x7e0a('0xc'),auth[_0x7e0a('0x9')](),controller[_0x7e0a('0x10')]);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 577085d..313eb95 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 _0x509d=['Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','thumb','star','input','name','onlineForm','parse','getDataValue','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','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.','website_alias','bottom_right','alternate','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note'];(function(_0x4d8e54,_0xef2374){var _0x76b44f=function(_0x31f393){while(--_0x31f393){_0x4d8e54['push'](_0x4d8e54['shift']());}};_0x76b44f(++_0xef2374);}(_0x509d,0x151));var _0xd509=function(_0x4dfb1b,_0x26850a){_0x4dfb1b=_0x4dfb1b-0x0;var _0x4dc88=_0x509d[_0x4dfb1b];return _0x4dc88;};'use strict';var Sequelize=require(_0xd509('0x0'));var rs=require('randomstring');module[_0xd509('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xd509('0x2')],'allowNull':![],'unique':_0xd509('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xd509('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xd509('0x4')},'key':{'type':Sequelize[_0xd509('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xd509('0x2')],'defaultValue':_0xd509('0x5')},'customerAlias':{'type':Sequelize[_0xd509('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xd509('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xd509('0x2')],'allowNull':![],'defaultValue':_0xd509('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xd509('0x2')],'allowNull':![],'defaultValue':_0xd509('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xd509('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0xd509('0x8')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xd509('0x2')],'defaultValue':_0xd509('0x9')},'start_chat_button':{'type':Sequelize[_0xd509('0x2')],'defaultValue':_0xd509('0xa')},'offline_chat_button':{'type':Sequelize[_0xd509('0x2')],'defaultValue':_0xd509('0xb')},'header_offline':{'type':Sequelize[_0xd509('0x2')],'defaultValue':_0xd509('0xc')},'download_transcript':{'type':Sequelize[_0xd509('0xd')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xd509('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xd509('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xd509('0xd')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xd509('0x10')]},'closingQuestion':{'type':Sequelize[_0xd509('0x2')],'defaultValue':_0xd509('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xd509('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd509('0x12')},'noteTitle':{'type':Sequelize[_0xd509('0x2')],'defaultValue':_0xd509('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd509('0x14')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd509('0x15')},'closingMessageButton':{'type':Sequelize[_0xd509('0x2')],'defaultValue':_0xd509('0xb')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xd509('0x16')},'conditionAgreement':{'type':Sequelize[_0xd509('0xd')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xd509('0xd')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xd509('0xd')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xd509('0x2')],'defaultValue':_0xd509('0x17')},'ratingType':{'type':Sequelize[_0xd509('0x18')]('star',_0xd509('0x19')),'defaultValue':_0xd509('0x1a')},'ratingStarsNumber':{'type':Sequelize[_0xd509('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xd509('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xd509('0x1b'),'variable':null,'config':{'placeholder':_0xd509('0x1c'),'type':'text','required':!![]},'props':{'title':_0xd509('0x1c'),'helpText':''}},{'type':_0xd509('0x1b'),'props':{'title':_0xd509('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xd509('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xd509('0x1d'))?JSON[_0xd509('0x1e')](this[_0xd509('0x1f')]('onlineForm')):{};},'set':function(_0x5bd9e6){return this[_0xd509('0x20')](_0xd509('0x1d'),JSON['stringify'](_0x5bd9e6));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xd509('0x21')]({'items':[{'type':_0xd509('0x1b'),'props':{'title':_0xd509('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xd509('0x4'),'type':_0xd509('0x4')},'variable':null},{'type':_0xd509('0x22'),'config':{'placeholder':_0xd509('0x23')},'props':{'title':_0xd509('0x23'),'helpText':_0xd509('0x24')}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON[_0xd509('0x1e')](this['getDataValue'](_0xd509('0x25'))):{};},'set':function(_0x1e17e6){return this['setDataValue'](_0xd509('0x25'),JSON['stringify'](_0x1e17e6));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xd509('0x26')]();}},'autoclose':{'type':Sequelize[_0xd509('0xd')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xd509('0xd')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xd509('0xd')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xd509('0xd')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xd509('0x2')]},'waitingTitle':{'type':Sequelize[_0xd509('0x2')],'defaultValue':_0xd509('0x27')},'waitingMessage':{'type':Sequelize[_0xd509('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xd509('0x2')],'defaultValue':_0xd509('0x28')},'offlineMessageBody':{'type':Sequelize[_0xd509('0x2')],'defaultValue':_0xd509('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0xd509('0xd')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xd509('0x2')],'defaultValue':_0xd509('0x2a')},'skipUnmanaged':{'type':Sequelize[_0xd509('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xd509('0x2')],'defaultValue':_0xd509('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0xd509('0xd')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xd509('0xd')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xd509('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xd509('0xd')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xd509('0x2')]},'notificationTemplate':{'type':Sequelize[_0xd509('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xd509('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd509('0xd')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xd509('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0xd509('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xd509('0x2c')},'verticalAlignment':{'type':Sequelize[_0xd509('0xe')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xd509('0x2')],'defaultValue':_0xd509('0x2d')},'defaultTitle':{'type':Sequelize[_0xd509('0x2')]},'customerAvatar':{'type':Sequelize[_0xd509('0x10')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xd509('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xd509('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd509('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd509('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xd509('0x2')],'defaultValue':_0xd509('0x2e')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd509('0x2f'),'set':function(_0x29a6f2){if(!_0x29a6f2)this[_0xd509('0x20')]('mandatoryDispositionPauseId',null);this[_0xd509('0x20')](_0xd509('0x30'),_0x29a6f2);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xd509('0x2')]},'vidaooTopic':{'type':Sequelize[_0xd509('0x2')],'allowNull':![],'defaultValue':_0xd509('0x31')},'vidaooNote':{'type':Sequelize[_0xd509('0x2')],'defaultValue':function(){return _0xd509('0x32');}},'vidaooMetadata':{'type':Sequelize[_0xd509('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xd509('0xd')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x98cc=['star','input','name','getDataValue','onlineForm','setDataValue','stringify','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','#fafafa','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Skip','Feedback','thumb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x98cc,0x156));var _0xc98c=function(_0x361078,_0x283dcb){_0x361078=_0x361078-0x0;var _0x22d9e8=_0x98cc[_0x361078];return _0x22d9e8;};'use strict';var Sequelize=require(_0xc98c('0x0'));var rs=require(_0xc98c('0x1'));module[_0xc98c('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xc98c('0x3')],'allowNull':![],'unique':_0xc98c('0x4')},'description':{'type':Sequelize[_0xc98c('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xc98c('0x5')},'mapKeyOffline':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0xc98c('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc98c('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xc98c('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xc98c('0x3')],'allowNull':![],'defaultValue':_0xc98c('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xc98c('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xc98c('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xc98c('0x9')](_0xc98c('0xa'),_0xc98c('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':_0xc98c('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xc98c('0xd')},'offline_chat_button':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':_0xc98c('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xc98c('0xf')},'download_transcript':{'type':Sequelize[_0xc98c('0x10')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xc98c('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':_0xc98c('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0xc98c('0x10')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xc98c('0x12')]},'closingQuestion':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':_0xc98c('0x13')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xc98c('0x14')},'formSubmitFailureMessage':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':_0xc98c('0x15')},'noteTitle':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':_0xc98c('0x16')},'placeholderMessage':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':_0xc98c('0x17')},'conditionAgreement':{'type':Sequelize[_0xc98c('0x10')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xc98c('0x10')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xc98c('0x10')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xc98c('0x10')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':_0xc98c('0x18')},'ratingType':{'type':Sequelize[_0xc98c('0x9')]('star',_0xc98c('0x19')),'defaultValue':_0xc98c('0x1a')},'ratingStarsNumber':{'type':Sequelize[_0xc98c('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xc98c('0x12')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xc98c('0x1b'),'variable':null,'config':{'placeholder':_0xc98c('0x1c'),'type':'text','required':!![]},'props':{'title':_0xc98c('0x1c'),'helpText':''}},{'type':_0xc98c('0x1b'),'props':{'title':_0xc98c('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xc98c('0x5'),'type':_0xc98c('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xc98c('0x1d')]('onlineForm')?JSON['parse'](this[_0xc98c('0x1d')](_0xc98c('0x1e'))):{};},'set':function(_0x2531aa){return this[_0xc98c('0x1f')](_0xc98c('0x1e'),JSON[_0xc98c('0x20')](_0x2531aa));}},'offlineForm':{'type':Sequelize[_0xc98c('0x12')],'defaultValue':function(){return JSON[_0xc98c('0x20')]({'items':[{'type':_0xc98c('0x1b'),'props':{'title':_0xc98c('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xc98c('0x5'),'type':_0xc98c('0x5')},'variable':null},{'type':_0xc98c('0x21'),'config':{'placeholder':'Comments'},'props':{'title':_0xc98c('0x22'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xc98c('0x23'))?JSON['parse'](this['getDataValue'](_0xc98c('0x23'))):{};},'set':function(_0x2b21e0){return this[_0xc98c('0x1f')](_0xc98c('0x23'),JSON['stringify'](_0x2b21e0));}},'token':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':function(){return rs[_0xc98c('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xc98c('0x10')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xc98c('0x3')]},'forwardOffline':{'type':Sequelize[_0xc98c('0x10')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xc98c('0x3')]},'waitingTitle':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':_0xc98c('0x25')},'waitingMessage':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':_0xc98c('0x26')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xc98c('0x10')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':_0xc98c('0x27')},'skipUnmanaged':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':_0xc98c('0x17')},'sendUnmanaged':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':_0xc98c('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0xc98c('0x10')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xc98c('0x10')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xc98c('0x12')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xc98c('0x12')],'defaultValue':function(){return _0xc98c('0x28');}},'notificationSound':{'type':Sequelize[_0xc98c('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':_0xc98c('0x29')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':_0xc98c('0x2a')},'defaultTitle':{'type':Sequelize[_0xc98c('0x3')]},'customerAvatar':{'type':Sequelize[_0xc98c('0x12')]},'showCustomerAvatar':{'type':Sequelize[_0xc98c('0x10')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xc98c('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xc98c('0x3')],'allowNull':![],'defaultValue':_0xc98c('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xc98c('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc98c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc98c('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc98c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc98c('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc98c('0x10')],'defaultValue':![],'comment':_0xc98c('0x2c'),'set':function(_0x394f09){if(!_0x394f09)this[_0xc98c('0x1f')](_0xc98c('0x2d'),null);this['setDataValue']('mandatoryDisposition',_0x394f09);}},'vidaooEscalation':{'type':Sequelize[_0xc98c('0x10')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xc98c('0x3')]},'vidaooTopic':{'type':Sequelize[_0xc98c('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xc98c('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xc98c('0x12')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 1447450..f69dae3 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 _0xc17a=['first','split','firstName','lastName','referer','browser','format','version','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','ChatInteraction','threadId','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','forcedOwnership','startRouting','Start','EventManager','files','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','user','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','toPairsIn','mapValues','subjectOffline','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','fullname','internal','Tag','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','interval','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','increment','chatLicenseExceeded','all','some','remote','x-real-ip','replace','verticalAlignment','backgroundColor','addApplications','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','jayson/promise','client','http','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','update','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','map','ChatWebsite','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','rows','show','params','Pause','mandatoryDispositionPause','filters','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','nolimit','findAll','removeDispositions','addAnswer','getAnswers','CannedAnswer','ids','addLogo','sitepic','file','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','isNil','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','ListId','contact','customerIp','cf-connecting-ip','x-forwarded-for'];(function(_0x32fc16,_0x26b884){var _0x262a81=function(_0x5a5941){while(--_0x5a5941){_0x32fc16['push'](_0x32fc16['shift']());}};_0x262a81(++_0x26b884);}(_0xc17a,0x85));var _0xac17=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xc17a[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require(_0xac17('0x0'));var rimraf=require(_0xac17('0x1'));var zipdir=require(_0xac17('0x2'));var jsonpatch=require(_0xac17('0x3'));var rp=require(_0xac17('0x4'));var moment=require(_0xac17('0x5'));var BPromise=require(_0xac17('0x6'));var Mustache=require(_0xac17('0x7'));var util=require(_0xac17('0x8'));var path=require(_0xac17('0x9'));var sox=require('sox');var csv=require(_0xac17('0xa'));var ejs=require(_0xac17('0xb'));var fs=require('fs');var fs_extra=require(_0xac17('0xc'));var _=require('lodash');var squel=require(_0xac17('0xd'));var crypto=require(_0xac17('0xe'));var jsforce=require(_0xac17('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xac17('0xa'));var querystring=require(_0xac17('0x10'));var Papa=require(_0xac17('0x11'));var Redis=require(_0xac17('0x12'));var authService=require(_0xac17('0x13'));var qs=require(_0xac17('0x14'));var as=require(_0xac17('0x15'));var hardwareService=require(_0xac17('0x16'));var logger=require(_0xac17('0x17'))(_0xac17('0x18'));var utils=require(_0xac17('0x19'));var config=require(_0xac17('0x1a'));var licenseUtil=require(_0xac17('0x1b'));var db=require(_0xac17('0x1c'))['db'];config[_0xac17('0x1d')]=_[_0xac17('0x1e')](config[_0xac17('0x1d')],{'host':_0xac17('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac17('0x1d')]));require(_0xac17('0x20'))['register'](socket);var jayson=require(_0xac17('0x21'));var client=jayson[_0xac17('0x22')][_0xac17('0x23')]({'port':0x232c});var client9002=jayson[_0xac17('0x22')][_0xac17('0x23')]({'port':0x232a});var client9003=jayson['client'][_0xac17('0x23')]({'port':0x232b});var client9001=jayson['client'][_0xac17('0x23')]({'port':0x2329});function respondWithRpcPromise(_0x1aed47,_0xff2f1c,_0x2fbf97,_0x178007){return new BPromise(function(_0x103182,_0x10615a){var _0x45c9a3=_0x178007||client;return _0x45c9a3['request'](_0x1aed47,_0x2fbf97)['then'](function(_0x1d9373){logger[_0xac17('0x24')](_0xac17('0x25'),_0xff2f1c,_0xac17('0x26'));logger['debug'](_0xac17('0x27'),_0xff2f1c,_0xac17('0x26'),JSON[_0xac17('0x28')](_0x1d9373));if(_0x1d9373[_0xac17('0x29')]){if(_0x1d9373[_0xac17('0x29')][_0xac17('0x2a')]===0x1f4){logger[_0xac17('0x29')]('ChatWebsite,\x20%s,\x20%s',_0xff2f1c,_0x1d9373[_0xac17('0x29')][_0xac17('0x2b')]);return _0x10615a(_0x1d9373[_0xac17('0x29')]['message']);}logger[_0xac17('0x29')]('ChatWebsite,\x20%s,\x20%s',_0xff2f1c,_0x1d9373['error'][_0xac17('0x2b')]);return _0x103182(_0x1d9373[_0xac17('0x29')]['message']);}else{logger[_0xac17('0x24')](_0xac17('0x25'),_0xff2f1c,_0xac17('0x26'));_0x103182(_0x1d9373[_0xac17('0x2c')][_0xac17('0x2b')]);}})[_0xac17('0x2d')](function(_0x3163f5){logger[_0xac17('0x29')](_0xac17('0x25'),_0xff2f1c,_0x3163f5);_0x10615a(_0x3163f5);});});}function respondWithStatusCode(_0x56b94d,_0x3eb08b){_0x3eb08b=_0x3eb08b||0xcc;return function(_0x184cf7){if(_0x184cf7){return _0x56b94d[_0xac17('0x2e')](_0x3eb08b);}return _0x56b94d[_0xac17('0x2f')](_0x3eb08b)[_0xac17('0x30')]();};}function respondWithResult(_0x561520,_0x1e3324){_0x1e3324=_0x1e3324||0xc8;return function(_0x16b93d){if(_0x16b93d){return _0x561520[_0xac17('0x2f')](_0x1e3324)[_0xac17('0x31')](_0x16b93d);}};}function respondWithFilteredResult(_0x96279d,_0x56d76e){return function(_0x591346){if(_0x591346){var _0x28659b=typeof _0x56d76e['offset']==='undefined'&&typeof _0x56d76e['limit']===_0xac17('0x32');var _0x2397f8=_0x591346[_0xac17('0x33')];var _0x38c6a0=_0x28659b?0x0:_0x56d76e['offset'];var _0x4f34b0=_0x28659b?_0x591346[_0xac17('0x33')]:_0x56d76e[_0xac17('0x34')]+_0x56d76e[_0xac17('0x35')];var _0x7554fd;if(_0x4f34b0>=_0x2397f8){_0x4f34b0=_0x2397f8;_0x7554fd=0xc8;}else{_0x7554fd=0xce;}_0x96279d['status'](_0x7554fd);return _0x96279d['set'](_0xac17('0x36'),_0x38c6a0+'-'+_0x4f34b0+'/'+_0x2397f8)[_0xac17('0x31')](_0x591346);}return null;};}function patchUpdates(_0x5e5a58){return function(_0x12b41c){try{jsonpatch[_0xac17('0x37')](_0x12b41c,_0x5e5a58,!![]);}catch(_0x37d091){return BPromise['reject'](_0x37d091);}return _0x12b41c[_0xac17('0x38')]();};}function saveUpdates(_0x3425e2,_0x1ffce9){return function(_0x4cb573){if(_0x4cb573){return _0x4cb573[_0xac17('0x39')](_0x3425e2)[_0xac17('0x3a')](function(_0xacc0e5){return _0xacc0e5;});}return null;};}function removeEntity(_0x2b9ceb,_0x57732b){return function(_0x14ed11){if(_0x14ed11){return _0x14ed11[_0xac17('0x3b')]()[_0xac17('0x3a')](function(){var _0x4f2e7e=_0x14ed11[_0xac17('0x3c')]({'plain':!![]});var _0x1a6caa=_0xac17('0x3d');return db[_0xac17('0x3e')][_0xac17('0x3b')]({'where':{'type':_0x1a6caa,'resourceId':_0x4f2e7e['id']}})[_0xac17('0x3a')](function(){return _0x14ed11;});})[_0xac17('0x3a')](function(){_0x2b9ceb[_0xac17('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x593a44,_0x4f54cd){return function(_0x2ccb11){if(!_0x2ccb11){_0x593a44['sendStatus'](0x194);}return _0x2ccb11;};}function handleError(_0x33bbab,_0x4b437d){_0x4b437d=_0x4b437d||0x1f4;return function(_0x716d71){logger['error'](_0x716d71[_0xac17('0x3f')]);if(_0x716d71['name']){delete _0x716d71[_0xac17('0x40')];}_0x33bbab[_0xac17('0x2f')](_0x4b437d)[_0xac17('0x41')](_0x716d71);};}exports['index']=function(_0x411f2a,_0xdab933){var _0x1ba586={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3fcfca={},_0x389676={'count':0x0,'rows':[]};var _0x308427=_[_0xac17('0x42')](db[_0xac17('0x43')][_0xac17('0x44')],function(_0x536614){return{'name':_0x536614['fieldName'],'type':_0x536614[_0xac17('0x45')][_0xac17('0x46')]};});_0x3fcfca[_0xac17('0x47')]=_[_0xac17('0x42')](_0x308427,_0xac17('0x40'));_0x3fcfca[_0xac17('0x48')]=_[_0xac17('0x49')](_0x411f2a[_0xac17('0x48')]);_0x3fcfca['filters']=_[_0xac17('0x4a')](_0x3fcfca[_0xac17('0x47')],_0x3fcfca['query']);_0x1ba586[_0xac17('0x4b')]=_[_0xac17('0x4a')](_0x3fcfca['model'],qs['fields'](_0x411f2a[_0xac17('0x48')][_0xac17('0x4c')]));_0x1ba586['attributes']=_0x1ba586[_0xac17('0x4b')][_0xac17('0x4d')]?_0x1ba586[_0xac17('0x4b')]:_0x3fcfca[_0xac17('0x47')];if(!_0x411f2a[_0xac17('0x48')][_0xac17('0x4e')]('nolimit')){_0x1ba586['limit']=qs[_0xac17('0x35')](_0x411f2a[_0xac17('0x48')]['limit']);_0x1ba586[_0xac17('0x34')]=qs[_0xac17('0x34')](_0x411f2a[_0xac17('0x48')][_0xac17('0x34')]);}_0x1ba586[_0xac17('0x4f')]=qs[_0xac17('0x50')](_0x411f2a[_0xac17('0x48')][_0xac17('0x50')]);_0x1ba586['where']=qs['filters'](_[_0xac17('0x51')](_0x411f2a[_0xac17('0x48')],_0x3fcfca['filters']),_0x308427);if(_0x411f2a[_0xac17('0x48')]['filter']){_0x1ba586['where']=_['merge'](_0x1ba586[_0xac17('0x52')],{'$or':_['map'](_0x308427,function(_0x8f6c9e){if(_0x8f6c9e[_0xac17('0x45')]!==_0xac17('0x53')){var _0xd11670={};_0xd11670[_0x8f6c9e[_0xac17('0x40')]]={'$like':'%'+_0x411f2a[_0xac17('0x48')][_0xac17('0x54')]+'%'};return _0xd11670;}})});}_0x1ba586=_[_0xac17('0x55')]({},_0x1ba586,_0x411f2a[_0xac17('0x56')]);var _0x39a6c0={'where':_0x1ba586[_0xac17('0x52')]};return db['ChatWebsite']['count'](_0x39a6c0)['then'](function(_0x4ad6ee){_0x389676[_0xac17('0x33')]=_0x4ad6ee;if(_0x411f2a['query'][_0xac17('0x57')]){_0x1ba586[_0xac17('0x58')]=[{'all':!![]}];}return db[_0xac17('0x43')]['findAll'](_0x1ba586);})[_0xac17('0x3a')](function(_0x59d466){_0x389676[_0xac17('0x59')]=_0x59d466;return _0x389676;})['then'](respondWithFilteredResult(_0xdab933,_0x1ba586))[_0xac17('0x2d')](handleError(_0xdab933,null));};exports[_0xac17('0x5a')]=function(_0x2a48ee,_0x1e930f){var _0xeee3f3={'raw':![],'where':{'id':_0x2a48ee[_0xac17('0x5b')]['id']},'include':[{'model':db[_0xac17('0x5c')],'as':_0xac17('0x5d')}]},_0x4cf72b={};_0x4cf72b[_0xac17('0x47')]=_[_0xac17('0x49')](db[_0xac17('0x43')]['rawAttributes']);_0x4cf72b[_0xac17('0x48')]=_[_0xac17('0x49')](_0x2a48ee[_0xac17('0x48')]);_0x4cf72b[_0xac17('0x5e')]=_[_0xac17('0x4a')](_0x4cf72b[_0xac17('0x47')],_0x4cf72b['query']);_0xeee3f3['attributes']=_['intersection'](_0x4cf72b['model'],qs[_0xac17('0x4c')](_0x2a48ee[_0xac17('0x48')]['fields']));_0xeee3f3[_0xac17('0x4b')]=_0xeee3f3[_0xac17('0x4b')][_0xac17('0x4d')]?_0xeee3f3['attributes']:_0x4cf72b[_0xac17('0x47')];if(_0x2a48ee[_0xac17('0x48')][_0xac17('0x57')]){_0xeee3f3[_0xac17('0x58')]=[{'all':!![]}];}_0xeee3f3=_['merge']({},_0xeee3f3,_0x2a48ee[_0xac17('0x56')]);return db[_0xac17('0x43')][_0xac17('0x5f')](_0xeee3f3)['then'](handleEntityNotFound(_0x1e930f,null))[_0xac17('0x3a')](respondWithResult(_0x1e930f,null))[_0xac17('0x2d')](handleError(_0x1e930f,null));};exports[_0xac17('0x60')]=function(_0x71c876,_0xf3cfd1){return db[_0xac17('0x43')][_0xac17('0x60')](_0x71c876[_0xac17('0x61')],{})[_0xac17('0x3a')](function(_0xd58164){var _0x4593b7=_0x71c876['user'][_0xac17('0x3c')]({'plain':!![]});if(!_0x4593b7)throw new Error(_0xac17('0x62'));if(_0x4593b7[_0xac17('0x63')]==='user'){var _0x3cff6e=_0xd58164[_0xac17('0x3c')]({'plain':!![]});var _0x5b109d=_0xac17('0x3d');return db[_0xac17('0x64')]['find']({'where':{'name':_0x5b109d,'userProfileId':_0x4593b7['userProfileId']},'raw':!![]})[_0xac17('0x3a')](function(_0x4f65bb){if(_0x4f65bb&&_0x4f65bb[_0xac17('0x65')]===0x0){return db[_0xac17('0x3e')][_0xac17('0x60')]({'name':_0x3cff6e[_0xac17('0x40')],'resourceId':_0x3cff6e['id'],'type':_0x4f65bb[_0xac17('0x40')],'sectionId':_0x4f65bb['id']},{})[_0xac17('0x3a')](function(){return _0xd58164;});}else{return _0xd58164;}})[_0xac17('0x2d')](function(_0x5f22b9){logger[_0xac17('0x29')](_0xac17('0x66'),_0x5f22b9);throw _0x5f22b9;});}return _0xd58164;})[_0xac17('0x3a')](respondWithResult(_0xf3cfd1,0xc9))[_0xac17('0x2d')](handleError(_0xf3cfd1,null));};exports[_0xac17('0x39')]=function(_0x26c44d,_0x1a70f3){if(_0x26c44d[_0xac17('0x61')]['id']){delete _0x26c44d['body']['id'];}return db['ChatWebsite'][_0xac17('0x5f')]({'where':{'id':_0x26c44d[_0xac17('0x5b')]['id']},'include':[{'model':db[_0xac17('0x5c')],'as':_0xac17('0x5d')}]})[_0xac17('0x3a')](handleEntityNotFound(_0x1a70f3,null))[_0xac17('0x3a')](saveUpdates(_0x26c44d[_0xac17('0x61')],null))['then'](respondWithResult(_0x1a70f3,null))[_0xac17('0x2d')](handleError(_0x1a70f3,null));};exports['destroy']=function(_0x12809e,_0x52577d){return db['ChatWebsite'][_0xac17('0x5f')]({'where':{'id':_0x12809e[_0xac17('0x5b')]['id']}})['then'](handleEntityNotFound(_0x52577d,null))[_0xac17('0x3a')](removeEntity(_0x52577d,null))[_0xac17('0x2d')](handleError(_0x52577d,null));};exports[_0xac17('0x67')]=function(_0x412cfe,_0x55cfc0){return db['ChatWebsite'][_0xac17('0x67')]()[_0xac17('0x3a')](respondWithResult(_0x55cfc0,null))[_0xac17('0x2d')](handleError(_0x55cfc0,null));};exports[_0xac17('0x68')]=function(_0x489ea1,_0x1d1d9d,_0x3a87aa){if(_0x489ea1[_0xac17('0x61')]['id']){delete _0x489ea1['body']['id'];}return db[_0xac17('0x43')][_0xac17('0x5f')]({'where':{'id':_0x489ea1['params']['id']}})[_0xac17('0x3a')](handleEntityNotFound(_0x1d1d9d,null))[_0xac17('0x3a')](function(_0x1fc88c){if(_0x1fc88c){_0x489ea1[_0xac17('0x61')][_0xac17('0x69')]=_0x1fc88c['id'];return db[_0xac17('0x6a')][_0xac17('0x60')](_0x489ea1[_0xac17('0x61')]);}})[_0xac17('0x3a')](respondWithResult(_0x1d1d9d,null))[_0xac17('0x2d')](handleError(_0x1d1d9d,null));};exports[_0xac17('0x6b')]=function(_0x289b1d,_0xbafd6a,_0x2938a7){var _0x5c1eea={'raw':![],'where':{}};var _0x4c68b7={};var _0x3a13fe={'count':0x0,'rows':[]};return db[_0xac17('0x43')][_0xac17('0x6c')]({'where':{'id':_0x289b1d[_0xac17('0x5b')]['id']}})[_0xac17('0x3a')](handleEntityNotFound(_0xbafd6a,null))[_0xac17('0x3a')](function(_0x27acfe){if(_0x27acfe){_0x4c68b7[_0xac17('0x47')]=_[_0xac17('0x49')](db[_0xac17('0x6a')][_0xac17('0x44')]);_0x4c68b7['query']=_[_0xac17('0x49')](_0x289b1d['query']);_0x4c68b7[_0xac17('0x5e')]=_[_0xac17('0x4a')](_0x4c68b7[_0xac17('0x47')],_0x4c68b7[_0xac17('0x48')]);_0x5c1eea[_0xac17('0x4b')]=_[_0xac17('0x4a')](_0x4c68b7['model'],qs[_0xac17('0x4c')](_0x289b1d[_0xac17('0x48')][_0xac17('0x4c')]));_0x5c1eea['attributes']=_0x5c1eea[_0xac17('0x4b')]['length']?_0x5c1eea[_0xac17('0x4b')]:_0x4c68b7['model'];if(!_0x289b1d[_0xac17('0x48')][_0xac17('0x4e')](_0xac17('0x6d'))){_0x5c1eea[_0xac17('0x35')]=qs[_0xac17('0x35')](_0x289b1d['query']['limit']);_0x5c1eea['offset']=qs[_0xac17('0x34')](_0x289b1d['query'][_0xac17('0x34')]);}_0x5c1eea[_0xac17('0x4f')]=qs[_0xac17('0x50')](_0x289b1d['query'][_0xac17('0x50')]);_0x5c1eea[_0xac17('0x52')]=qs[_0xac17('0x5e')](_[_0xac17('0x51')](_0x289b1d['query'],_0x4c68b7[_0xac17('0x5e')]));_0x5c1eea[_0xac17('0x52')][_0xac17('0x69')]=_0x27acfe['id'];if(_0x289b1d['query'][_0xac17('0x54')]){_0x5c1eea[_0xac17('0x52')]=_[_0xac17('0x55')](_0x5c1eea[_0xac17('0x52')],{'$or':_[_0xac17('0x42')](_0x5c1eea[_0xac17('0x4b')],function(_0x1d871b){var _0x4b5510={};_0x4b5510[_0x1d871b]={'$like':'%'+_0x289b1d['query'][_0xac17('0x54')]+'%'};return _0x4b5510;})});}_0x5c1eea=_[_0xac17('0x55')]({},_0x5c1eea,_0x289b1d[_0xac17('0x56')]);return db[_0xac17('0x6a')][_0xac17('0x33')]({'where':_0x5c1eea[_0xac17('0x52')]})[_0xac17('0x3a')](function(_0x39c73d){_0x3a13fe[_0xac17('0x33')]=_0x39c73d;if(_0x289b1d['query']['includeAll']){_0x5c1eea['include']=[{'all':!![]}];}return db[_0xac17('0x6a')][_0xac17('0x6e')](_0x5c1eea);})[_0xac17('0x3a')](function(_0x170960){_0x3a13fe[_0xac17('0x59')]=_0x170960;return _0x3a13fe;});}})[_0xac17('0x3a')](respondWithFilteredResult(_0xbafd6a,_0x5c1eea))[_0xac17('0x2d')](handleError(_0xbafd6a,null));};exports['removeDispositions']=function(_0x2d6124,_0x2dbbda,_0x7e6a05){return db['ChatWebsite'][_0xac17('0x5f')]({'where':{'id':_0x2d6124[_0xac17('0x5b')]['id']}})[_0xac17('0x3a')](handleEntityNotFound(_0x2dbbda,null))['then'](function(_0x3db159){if(_0x3db159){return _0x3db159[_0xac17('0x6f')](_0x2d6124['query']['ids']);}})['then'](respondWithStatusCode(_0x2dbbda,null))[_0xac17('0x2d')](handleError(_0x2dbbda,null));};exports[_0xac17('0x70')]=function(_0x171516,_0x519ca4,_0x1eaa23){if(_0x171516['body']['id']){delete _0x171516[_0xac17('0x61')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x171516[_0xac17('0x5b')]['id']}})['then'](handleEntityNotFound(_0x519ca4,null))['then'](function(_0x547a36){if(_0x547a36){_0x171516['body'][_0xac17('0x69')]=_0x547a36['id'];return db['CannedAnswer'][_0xac17('0x60')](_0x171516[_0xac17('0x61')]);}})[_0xac17('0x3a')](respondWithResult(_0x519ca4,null))[_0xac17('0x2d')](handleError(_0x519ca4,null));};exports[_0xac17('0x71')]=function(_0x1fbb81,_0x43c0ba,_0x163455){var _0x1b8d5c={'raw':![],'where':{}};var _0x2485c0={};var _0x237b2c={'count':0x0,'rows':[]};return db[_0xac17('0x43')][_0xac17('0x6c')]({'where':{'id':_0x1fbb81[_0xac17('0x5b')]['id']}})[_0xac17('0x3a')](handleEntityNotFound(_0x43c0ba,null))['then'](function(_0x205a2){if(_0x205a2){_0x2485c0[_0xac17('0x47')]=_['keys'](db['CannedAnswer'][_0xac17('0x44')]);_0x2485c0[_0xac17('0x48')]=_['keys'](_0x1fbb81[_0xac17('0x48')]);_0x2485c0[_0xac17('0x5e')]=_['intersection'](_0x2485c0[_0xac17('0x47')],_0x2485c0[_0xac17('0x48')]);_0x1b8d5c[_0xac17('0x4b')]=_[_0xac17('0x4a')](_0x2485c0['model'],qs['fields'](_0x1fbb81[_0xac17('0x48')][_0xac17('0x4c')]));_0x1b8d5c[_0xac17('0x4b')]=_0x1b8d5c[_0xac17('0x4b')]['length']?_0x1b8d5c[_0xac17('0x4b')]:_0x2485c0[_0xac17('0x47')];if(!_0x1fbb81[_0xac17('0x48')][_0xac17('0x4e')](_0xac17('0x6d'))){_0x1b8d5c[_0xac17('0x35')]=qs[_0xac17('0x35')](_0x1fbb81[_0xac17('0x48')]['limit']);_0x1b8d5c[_0xac17('0x34')]=qs[_0xac17('0x34')](_0x1fbb81[_0xac17('0x48')][_0xac17('0x34')]);}_0x1b8d5c[_0xac17('0x4f')]=qs[_0xac17('0x50')](_0x1fbb81[_0xac17('0x48')][_0xac17('0x50')]);_0x1b8d5c[_0xac17('0x52')]=qs[_0xac17('0x5e')](_['pick'](_0x1fbb81[_0xac17('0x48')],_0x2485c0['filters']));_0x1b8d5c[_0xac17('0x52')][_0xac17('0x69')]=_0x205a2['id'];if(_0x1fbb81[_0xac17('0x48')][_0xac17('0x54')]){_0x1b8d5c[_0xac17('0x52')]=_[_0xac17('0x55')](_0x1b8d5c[_0xac17('0x52')],{'$or':_[_0xac17('0x42')](_0x1b8d5c['attributes'],function(_0x1979ec){var _0x45dcd5={};_0x45dcd5[_0x1979ec]={'$like':'%'+_0x1fbb81[_0xac17('0x48')][_0xac17('0x54')]+'%'};return _0x45dcd5;})});}_0x1b8d5c=_[_0xac17('0x55')]({},_0x1b8d5c,_0x1fbb81[_0xac17('0x56')]);return db[_0xac17('0x72')][_0xac17('0x33')]({'where':_0x1b8d5c[_0xac17('0x52')]})[_0xac17('0x3a')](function(_0x3fa8f0){_0x237b2c[_0xac17('0x33')]=_0x3fa8f0;if(_0x1fbb81[_0xac17('0x48')][_0xac17('0x57')]){_0x1b8d5c[_0xac17('0x58')]=[{'all':!![]}];}return db[_0xac17('0x72')][_0xac17('0x6e')](_0x1b8d5c);})[_0xac17('0x3a')](function(_0x4fa4){_0x237b2c[_0xac17('0x59')]=_0x4fa4;return _0x237b2c;});}})[_0xac17('0x3a')](respondWithFilteredResult(_0x43c0ba,_0x1b8d5c))[_0xac17('0x2d')](handleError(_0x43c0ba,null));};exports['removeAnswers']=function(_0xadbb30,_0x302330,_0x496a05){return db[_0xac17('0x43')][_0xac17('0x5f')]({'where':{'id':_0xadbb30[_0xac17('0x5b')]['id']}})[_0xac17('0x3a')](handleEntityNotFound(_0x302330,null))[_0xac17('0x3a')](function(_0x1072b1){if(_0x1072b1){return _0x1072b1['removeAnswers'](_0xadbb30[_0xac17('0x48')][_0xac17('0x73')]);}})[_0xac17('0x3a')](respondWithStatusCode(_0x302330,null))['catch'](handleError(_0x302330,null));};exports[_0xac17('0x74')]=function(_0x26abb4,_0x32c88d,_0x355ff7){_0x26abb4[_0xac17('0x61')][_0xac17('0x75')]=_0x26abb4[_0xac17('0x76')]['filename'];return db[_0xac17('0x43')][_0xac17('0x5f')]({'where':{'id':_0x26abb4['params']['id']}})[_0xac17('0x3a')](handleEntityNotFound(_0x32c88d,null))[_0xac17('0x3a')](saveUpdates(_0x26abb4['body'],null))[_0xac17('0x3a')](respondWithResult(_0x32c88d,null))[_0xac17('0x2d')](handleError(_0x32c88d,null));};exports['addAvatar']=function(_0x16738e,_0x4e6ad0,_0x162137){_0x16738e[_0xac17('0x61')][_0xac17('0x77')]=_0x16738e[_0xac17('0x76')][_0xac17('0x78')];return db[_0xac17('0x43')][_0xac17('0x5f')]({'where':{'id':_0x16738e['params']['id']}})[_0xac17('0x3a')](handleEntityNotFound(_0x4e6ad0,null))[_0xac17('0x3a')](saveUpdates(_0x16738e[_0xac17('0x61')],null))['then'](respondWithResult(_0x4e6ad0,null))['catch'](handleError(_0x4e6ad0,null));};exports[_0xac17('0x79')]=function(_0xc46418,_0x2bcb69,_0x21f9ac){_0xc46418[_0xac17('0x61')][_0xac17('0x7a')]=_0xc46418[_0xac17('0x76')][_0xac17('0x78')];return db[_0xac17('0x43')][_0xac17('0x5f')]({'where':{'id':_0xc46418[_0xac17('0x5b')]['id']}})[_0xac17('0x3a')](handleEntityNotFound(_0x2bcb69,null))['then'](saveUpdates(_0xc46418[_0xac17('0x61')],null))[_0xac17('0x3a')](respondWithResult(_0x2bcb69,null))[_0xac17('0x2d')](handleError(_0x2bcb69,null));};exports[_0xac17('0x7b')]=function(_0x35275c,_0x525f1f,_0x44dfe7){_0x35275c[_0xac17('0x61')][_0xac17('0x7c')]=_0x35275c['file'][_0xac17('0x78')];return db['ChatWebsite'][_0xac17('0x5f')]({'where':{'id':_0x35275c[_0xac17('0x5b')]['id']}})['then'](handleEntityNotFound(_0x525f1f,null))[_0xac17('0x3a')](saveUpdates(_0x35275c['body'],null))['then'](respondWithResult(_0x525f1f,null))[_0xac17('0x2d')](handleError(_0x525f1f,null));};exports[_0xac17('0x7d')]=function(_0x8a4d90,_0x4e8d7d,_0xa612b7){var _0x5b7a18=path[_0xac17('0x7e')](config[_0xac17('0x7f')],_0xac17('0x80'));var _0x325603={'where':{'id':_0x8a4d90['params']['id']},'attributes':['id',_0xac17('0x75')],'raw':!![]};var _0x1a462a=![];return require(_0xac17('0x1b'))[_0xac17('0x81')]()[_0xac17('0x3a')](function(_0x4a5388){if(_0x4a5388){_0x1a462a=_0x4a5388[_0xac17('0x82')];}})[_0xac17('0x3a')](function(){return db[_0xac17('0x43')][_0xac17('0x5f')](_0x325603);})[_0xac17('0x3a')](handleEntityNotFound(_0x4e8d7d,null))[_0xac17('0x3a')](function(_0x3bc9d7){if(_0x3bc9d7){if(!_['isNil'](_0x3bc9d7[_0xac17('0x75')])){if(fs['existsSync'](path[_0xac17('0x7e')](config['root'],_0xac17('0x83'),_0x3bc9d7[_0xac17('0x75')]))&&_0x1a462a){_0x5b7a18=path[_0xac17('0x7e')](config[_0xac17('0x7f')],_0xac17('0x83'),_0x3bc9d7[_0xac17('0x75')]);}}return _0x4e8d7d[_0xac17('0x84')](_0x5b7a18);}})[_0xac17('0x2d')](handleError(_0x4e8d7d,null));};exports[_0xac17('0x85')]=function(_0x82dee7,_0x49f798,_0x1acf4b){var _0x1bf8f6=path[_0xac17('0x7e')](config[_0xac17('0x7f')],_0xac17('0x86'));var _0x4288e8={'where':{'id':_0x82dee7[_0xac17('0x5b')]['id']},'attributes':['id',_0xac17('0x77')],'raw':!![]};return db[_0xac17('0x43')][_0xac17('0x5f')](_0x4288e8)[_0xac17('0x3a')](handleEntityNotFound(_0x49f798,null))[_0xac17('0x3a')](function(_0x320926){if(_0x320926){if(!_['isNil'](_0x320926[_0xac17('0x77')])){if(fs[_0xac17('0x87')](path[_0xac17('0x7e')](config[_0xac17('0x7f')],'server/files/images/avatars/',_0x320926['agentAvatar']))){_0x1bf8f6=path[_0xac17('0x7e')](config[_0xac17('0x7f')],_0xac17('0x88'),_0x320926[_0xac17('0x77')]);}}return _0x49f798[_0xac17('0x84')](_0x1bf8f6);}})['catch'](handleError(_0x49f798,null));};exports[_0xac17('0x89')]=function(_0x104175,_0x2bbdd0,_0x4c309d){var _0x15635e=path[_0xac17('0x7e')](config[_0xac17('0x7f')],_0xac17('0x8a'));var _0x417f2a={'where':{'id':_0x104175[_0xac17('0x5b')]['id']},'attributes':['id','customerAvatar',_0xac17('0x8b')],'raw':!![]};return db['ChatWebsite'][_0xac17('0x5f')](_0x417f2a)[_0xac17('0x3a')](handleEntityNotFound(_0x2bbdd0,null))[_0xac17('0x3a')](function(_0x31649b){if(_0x31649b){if(!_['isNil'](_0x31649b['customerAvatar'])){if(fs[_0xac17('0x87')](path[_0xac17('0x7e')](config[_0xac17('0x7f')],_0xac17('0x88'),_0x31649b[_0xac17('0x7a')]))&&_0x31649b[_0xac17('0x8b')]){_0x15635e=path['join'](config[_0xac17('0x7f')],'server/files/images/avatars/',_0x31649b[_0xac17('0x7a')]);}}return _0x2bbdd0[_0xac17('0x84')](_0x15635e);}})[_0xac17('0x2d')](handleError(_0x2bbdd0,null));};exports['getSystemAvatar']=function(_0x5599d9,_0x386376,_0x20acf8){var _0x443988=path[_0xac17('0x7e')](config['root'],_0xac17('0x8c'));var _0x3d6885={'where':{'id':_0x5599d9[_0xac17('0x5b')]['id']},'attributes':['id',_0xac17('0x7c')],'raw':!![]};return db[_0xac17('0x43')][_0xac17('0x5f')](_0x3d6885)[_0xac17('0x3a')](handleEntityNotFound(_0x386376,null))[_0xac17('0x3a')](function(_0x216031){if(_0x216031){if(!_[_0xac17('0x8d')](_0x216031[_0xac17('0x7c')])){if(fs[_0xac17('0x87')](path[_0xac17('0x7e')](config['root'],'server/files/images/avatars/',_0x216031[_0xac17('0x7c')]))){_0x443988=path[_0xac17('0x7e')](config[_0xac17('0x7f')],_0xac17('0x88'),_0x216031[_0xac17('0x7c')]);}}return _0x386376[_0xac17('0x84')](_0x443988);}})[_0xac17('0x2d')](handleError(_0x386376,null));};exports[_0xac17('0x8e')]=function(_0xaa78b0,_0x253e15,_0x276d1a){var _0x19e7d4=require(_0xac17('0x8f'));var _0x33eb70=new _0x19e7d4();var _0x17f709=_0x33eb70[_0xac17('0x90')](_0xaa78b0[_0xac17('0x91')][_0xac17('0x92')])[_0xac17('0x93')]();var _0x547671={'body':_0xaa78b0[_0xac17('0x61')],'channel':_0xac17('0x94')};var _0x485432=[];var _0x135b9a=[];var _0x55cea5={};var _0xc4d2ea=![];return db[_0xac17('0x95')][_0xac17('0x67')]()[_0xac17('0x3a')](function(_0x554e8f){if(!_0x554e8f){throw new db[(_0xac17('0x96'))][(_0xac17('0x97'))](_0xac17('0x98'));}_0x485432=_[_0xac17('0x99')](_['keys'](_0x554e8f),[_0xac17('0x9a'),_0xac17('0x9b')]);_0x135b9a=_['difference'](_[_0xac17('0x49')](_0x554e8f),[_0xac17('0x9a'),_0xac17('0x9b'),_0xac17('0x9c'),'ListId']);if(_0xaa78b0[_0xac17('0x61')]['id']){delete _0xaa78b0[_0xac17('0x61')]['id'];}if(_['isNil'](_0xaa78b0['body']['from'])){throw new db[(_0xac17('0x96'))][(_0xac17('0x97'))](_0xac17('0x9d'));}if(_['isNil'](_0xaa78b0[_0xac17('0x61')][_0xac17('0x61')])||_0xaa78b0[_0xac17('0x61')]['body']===''){throw new db[(_0xac17('0x96'))][(_0xac17('0x97'))](_0xac17('0x9e'));}if(_[_0xac17('0x8d')](_0xaa78b0[_0xac17('0x61')][_0xac17('0x9f')])){throw new db[(_0xac17('0x96'))][(_0xac17('0x97'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x135b9a);}if(!_[_0xac17('0xa0')](_0x135b9a,_0xaa78b0[_0xac17('0x61')][_0xac17('0x9f')])){throw new db[(_0xac17('0x96'))][(_0xac17('0x97'))](_0xac17('0xa1')+_0x135b9a);}_0x55cea5[_0xaa78b0['body'][_0xac17('0x9f')]]=_0xaa78b0[_0xac17('0x61')][_0xac17('0xa2')];})['then'](function(){return db['ChatWebsite'][_0xac17('0x5f')]({'where':{'id':_0xaa78b0[_0xac17('0x5b')]['id']},'include':[{'model':db[_0xac17('0xa3')],'as':_0xac17('0xa4'),'include':[{'model':db[_0xac17('0x95')],'as':_0xac17('0xa5'),'where':_0x55cea5,'limit':0x1,'order':[[_0xac17('0x9b'),_0xac17('0xa6')]]}]},{'model':db[_0xac17('0xa7')],'as':_0xac17('0xa8')}]});})[_0xac17('0x3a')](handleEntityNotFound(_0x253e15,null))['then'](function(_0x5cd9a6){if(_0x5cd9a6&&_0x5cd9a6[_0xac17('0xa4')]){_0x547671[_0xac17('0xa9')]=_0x5cd9a6;_0x547671[_0xac17('0xaa')]=_0x5cd9a6[_0xac17('0xa8')];_0x547671[_0xac17('0xab')]=_0x5cd9a6[_0xac17('0xa4')];_0x547671[_0xac17('0xaa')]=_[_0xac17('0xac')](_0x547671[_0xac17('0xaa')],[_0xac17('0xad')],[_0xac17('0xae')]);if(_0x547671[_0xac17('0xa9')][_0xac17('0xa8')]){delete _0x547671[_0xac17('0xa9')][_0xac17('0xa8')];}if(_0x547671[_0xac17('0xa9')][_0xac17('0xa4')]&&_0x547671[_0xac17('0xa9')]['List'][_0xac17('0xa5')][_0xac17('0x4d')]){return _0x547671[_0xac17('0xa9')]['List'][_0xac17('0xa5')][0x0];}var _0x4d7003=_[_0xac17('0x1e')](_0xaa78b0[_0xac17('0x61')],{'firstName':_0xaa78b0[_0xac17('0x61')][_0xac17('0xa2')],'ListId':_0x5cd9a6[_0xac17('0xaf')]});_0x4d7003[_0xaa78b0[_0xac17('0x61')][_0xac17('0x9f')]]=_0xaa78b0[_0xac17('0x61')]['from'];return db[_0xac17('0x95')][_0xac17('0x60')](_0x4d7003,{'fields':_0x485432,'raw':!![]});}})[_0xac17('0x3a')](handleEntityNotFound(_0x253e15,null))[_0xac17('0x3a')](function(_0x492101){_0x547671[_0xac17('0xb0')]=_0x492101;var _0x47c5fa=_0xaa78b0[_0xac17('0x61')][_0xac17('0xb1')];if(_0xaa78b0[_0xac17('0x91')][_0xac17('0xb2')]){_0x47c5fa=_0xaa78b0[_0xac17('0x91')][_0xac17('0xb2')];}else if(_0xaa78b0[_0xac17('0x91')][_0xac17('0xb3')]){_0x47c5fa=_[_0xac17('0xb4')](_0xaa78b0[_0xac17('0x91')][_0xac17('0xb3')][_0xac17('0xb5')](','));}if(_0x492101){var _0x47d863={'ContactId':_0x492101['id'],'ChatWebsiteId':_0xaa78b0[_0xac17('0x5b')]['id'],'from':(_0x492101[_0xac17('0xb6')]||'')+'\x20'+(_0x492101[_0xac17('0xb7')]||''),'customerIp':_0x47c5fa,'customerPort':_0xaa78b0[_0xac17('0x91')]['x-real-port']?_0xaa78b0[_0xac17('0x91')]['x-real-port']:null,'referer':_0xaa78b0[_0xac17('0x61')][_0xac17('0xb8')],'browserName':_0x17f709[_0xac17('0xb9')][_0xac17('0x40')]&&_0x17f709[_0xac17('0xb9')]['version']?util[_0xac17('0xba')]('%s\x20%s',_0x17f709['browser'][_0xac17('0x40')],_0x17f709[_0xac17('0xb9')][_0xac17('0xbb')]):'unknown','browserVersion':_0x17f709[_0xac17('0xb9')][_0xac17('0xbb')]||_0xac17('0xbc'),'osName':util[_0xac17('0xba')](_0xac17('0xbd'),_0x17f709['os']['name'],_0x17f709['os'][_0xac17('0xbb')]),'osVersion':_0x17f709['os'][_0xac17('0xbb')],'deviceModel':_0x17f709[_0xac17('0xbe')][_0xac17('0x47')]&&_0x17f709[_0xac17('0xbe')][_0xac17('0xbf')]?util[_0xac17('0xba')](_0xac17('0xc0'),_0x17f709[_0xac17('0xbe')][_0xac17('0x47')],_0x17f709[_0xac17('0xbe')][_0xac17('0xbf')],_0x17f709[_0xac17('0xbe')][_0xac17('0x45')]):null,'deviceVendor':_0x17f709[_0xac17('0xbe')][_0xac17('0xbf')],'deviceType':_0x17f709[_0xac17('0xbe')][_0xac17('0x45')],'formData':JSON[_0xac17('0x28')](_0xaa78b0[_0xac17('0x61')])};var _0x56b475={'ChatWebsiteId':_0xaa78b0[_0xac17('0x5b')]['id'],'closed':![]};if(_0xaa78b0['body']['threadId']){_0x56b475['threadId']=_0xaa78b0[_0xac17('0x61')]['threadId'];return db[_0xac17('0xc1')][_0xac17('0x5f')]({'where':_0x56b475})[_0xac17('0x3a')](function(_0x5b8c8a){if(_0x5b8c8a){return[_0x5b8c8a,![]];}_0x47d863[_0xac17('0xc2')]=_0xaa78b0[_0xac17('0x61')][_0xac17('0xc2')];_0x47d863['externalUrl']=_0xaa78b0[_0xac17('0x61')]['externalUrl'];return db[_0xac17('0xc1')][_0xac17('0x60')](_0x47d863)[_0xac17('0x3a')](function(_0x532d81){return[_0x532d81,!![]];});});}_0x56b475[_0xac17('0xc3')]=_0x492101['id'];if(_0xaa78b0['body'][_0xac17('0xc4')]&&_0xaa78b0['body'][_0xac17('0xc4')]['id']){_0x56b475['id']=_0xaa78b0[_0xac17('0x61')]['interaction']['id'];return db[_0xac17('0xc1')][_0xac17('0x5f')]({'where':_0x56b475})[_0xac17('0x3a')](function(_0x483305){if(_0x483305){return[_0x483305,![]];}return db[_0xac17('0xc1')][_0xac17('0x60')](_0x47d863)[_0xac17('0x3a')](function(_0x23cb0d){return[_0x23cb0d,!![]];});});}return db[_0xac17('0xc1')][_0xac17('0x60')](_0x47d863)[_0xac17('0x3a')](function(_0x292d99){return[_0x292d99,!![]];});}})[_0xac17('0xc5')](function(_0x5e8964,_0x139b6f){if(_0x5e8964){_0xc4d2ea=_0x139b6f;if(!_0x139b6f){var _0xf0bcdb={'from':(_0x547671[_0xac17('0xb0')][_0xac17('0xb6')]||'')+'\x20'+(_0x547671[_0xac17('0xb0')][_0xac17('0xb7')]||'')};if(_0xaa78b0[_0xac17('0x61')][_0xac17('0xc2')]&&_0xaa78b0[_0xac17('0x61')][_0xac17('0xc6')]&&_0xaa78b0[_0xac17('0x61')][_0xac17('0xc2')]!=_0xaa78b0[_0xac17('0x61')][_0xac17('0xc6')]){_0xf0bcdb['threadId']=_0xaa78b0[_0xac17('0x61')][_0xac17('0xc6')];}return _0x5e8964[_0xac17('0x39')](_0xf0bcdb);}else{return _0x5e8964;}}})[_0xac17('0x3a')](function(_0x291d73){_0x547671[_0xac17('0xc4')]=_0x291d73[_0xac17('0x3c')]({'plain':!![]});_0x547671['interaction'][_0xac17('0xc7')]=_0xc4d2ea;if(_0x547671[_0xac17('0xc4')][_0xac17('0xc7')]){if(_0x547671[_0xac17('0xa9')][_0xac17('0xc8')]){_0x547671[_0xac17('0xaa')][_0xac17('0xc9')]({'id':0x0,'priority':_0x547671[_0xac17('0xaa')][_0xac17('0x4d')]+0x1,'app':_0xac17('0xca'),'appdata':_0xac17('0xcb'),'interval':_0xac17('0xcc')});}}return db[_0xac17('0xcd')]['create']({'body':_0xaa78b0[_0xac17('0x61')]['body'],'ChatWebsiteId':_0xaa78b0[_0xac17('0x5b')]['id'],'ChatInteractionId':_0x291d73['id'],'direction':'in','ContactId':_0x547671[_0xac17('0xb0')]['id'],'AttachmentId':_0xaa78b0[_0xac17('0x61')][_0xac17('0xce')]});})['then'](function(_0x3cf54c){_0x547671[_0xac17('0x2b')]=_0x3cf54c;if(_0x547671['interaction'][_0xac17('0xcf')]){return db[_0xac17('0xd0')][_0xac17('0x5f')]({'attributes':['id',_0xac17('0x40')],'where':{'id':_0x547671[_0xac17('0xc4')][_0xac17('0xcf')]}})[_0xac17('0x3a')](function(_0x2eed83){if(_0x2eed83){_0x547671['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xac17('0xd1'),'appdata':_0x2eed83[_0xac17('0x40')]+','+(_0x547671[_0xac17('0xa9')]['waitForTheAssignedAgent']||0xa),'interval':_0xac17('0xcc')});_0x547671[_0xac17('0xd2')]=!![];}return respondWithRpcPromise('Start',_0xac17('0xd3'),_0x547671);});}return respondWithRpcPromise(_0xac17('0xd4'),_0xac17('0xd3'),_0x547671);})['then'](function(_0x5f2cd9){respondWithRpcPromise('EventManager',_0xac17('0xd5'),{'event':_0xac17('0x8e'),'message':_0x5f2cd9},client9002);return _0x5f2cd9;})[_0xac17('0x3a')](respondWithResult(_0x253e15,null))[_0xac17('0x2d')](handleError(_0x253e15,null));};exports['offline']=function(_0x5f1eeb,_0x4c0a9e,_0x552fd1){var _0x4b3471,_0x453166,_0xe65166;var _0x8b8006=[];var _0x27be03=[];var _0x1ea00d={};var _0x2d6304=_0x5f1eeb[_0xac17('0xd6')]||[];var _0x52f936=[];var _0x18db33;return db['CmContact'][_0xac17('0x67')]()[_0xac17('0x3a')](function(_0x643d8c){if(!_0x643d8c){throw new db[(_0xac17('0x96'))][(_0xac17('0x97'))](_0xac17('0x98'));}_0x27be03=_[_0xac17('0x99')](_[_0xac17('0x49')](_0x643d8c),['createdAt',_0xac17('0x9b')]);_0x8b8006=_['difference'](_[_0xac17('0x49')](_0x643d8c),['createdAt',_0xac17('0x9b'),'CompanyId',_0xac17('0xaf')]);if(_0x5f1eeb['body']['id']){delete _0x5f1eeb['body']['id'];}if(_[_0xac17('0x8d')](_0x5f1eeb[_0xac17('0x61')][_0xac17('0xa2')])){throw _0x4c0a9e['status'](0x1f4)[_0xac17('0x41')](new db[(_0xac17('0x96'))][(_0xac17('0x97'))]('from\x20is\x20mandatory'));}if(_[_0xac17('0x8d')](_0x5f1eeb['body']['body'])||_0x5f1eeb[_0xac17('0x61')][_0xac17('0x61')]===''){throw _0x4c0a9e[_0xac17('0x2f')](0x1f4)[_0xac17('0x41')](new db[(_0xac17('0x96'))][(_0xac17('0x97'))](_0xac17('0x9e')));}if(_[_0xac17('0x8d')](_0x5f1eeb['body']['mapKeyOffline'])){throw _0x4c0a9e[_0xac17('0x2f')](0x1f4)[_0xac17('0x41')](new db[(_0xac17('0x96'))][(_0xac17('0x97'))](_0xac17('0xd7')+_0x8b8006));}if(!_['includes'](_0x8b8006,_0x5f1eeb[_0xac17('0x61')]['mapKeyOffline'])){throw _0x4c0a9e[_0xac17('0x2f')](0x1f4)[_0xac17('0x41')](new db[(_0xac17('0x96'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x8b8006));}_0x1ea00d[_0x5f1eeb['body'][_0xac17('0xd8')]]=_0x5f1eeb[_0xac17('0x61')]['from'];})[_0xac17('0x3a')](function(){return db[_0xac17('0x43')]['find']({'where':{'id':_0x5f1eeb[_0xac17('0x5b')]['id']},'include':[{'model':db[_0xac17('0xa3')],'as':_0xac17('0xa4')},{'model':db[_0xac17('0xd9')],'as':_0xac17('0xd9')}]});})['then'](handleEntityNotFound(_0x4c0a9e,null))[_0xac17('0x3a')](function(_0x300e4c){if(_0x300e4c&&_0x300e4c[_0xac17('0xa4')]){_0x453166=_0x300e4c;var _0x2f372a=_[_0xac17('0x1e')](_0x5f1eeb['body'],{'firstName':_0x5f1eeb['body']['from'],'phone':_0x5f1eeb[_0xac17('0x61')][_0xac17('0xa2')],'ListId':_0x300e4c[_0xac17('0xaf')]});_0x2f372a[_0x5f1eeb[_0xac17('0x61')][_0xac17('0xd8')]]=_0x5f1eeb[_0xac17('0x61')][_0xac17('0xa2')];return db[_0xac17('0x95')][_0xac17('0xda')]({'where':_0x1ea00d,'defaults':_0x2f372a});}})[_0xac17('0xc5')](function(_0x43d839){if(_0x43d839){_0xe65166=_0x43d839;var _0xdcd8fb=fs[_0xac17('0xdb')](path['join'](config[_0xac17('0x7f')],_0xac17('0xdc')),_0xac17('0xdd'));var _0x27a78a=ejs[_0xac17('0xde')](_0xdcd8fb,{'body':_[_0xac17('0xdf')](_0x5f1eeb[_0xac17('0x61')][_0xac17('0x61')]),'bodyTitle':_0x453166['offlineMessageBody']});return db[_0xac17('0xe0')][_0xac17('0x60')]({'body':_0x27a78a,'ContactId':_0x43d839['id'],'ChatWebsiteId':_0x453166['id']});}})[_0xac17('0x3a')](function(_0xb75fe4){_0x18db33=_0xb75fe4;if(_0x2d6304[_0xac17('0x4d')]){var _0x403fe6=_0x2d6304[_0xac17('0x42')](function(_0x373a9c){return{'name':_0x373a9c[_0xac17('0xe1')],'basename':_0x373a9c[_0xac17('0x78')],'type':_0x373a9c[_0xac17('0xe2')],'ChatOfflineMessageId':_0xb75fe4['id']};});_0x52f936=_0x403fe6[_0xac17('0x42')](_0x28c3fa=>{var _0x3c7134={'filename':_0x28c3fa['name'],'path':path['join'](config[_0xac17('0x7f')],_0xac17('0xe3'),'files',_0xac17('0xe4'),_0xac17('0xe5'),_0x28c3fa[_0xac17('0xe6')])};return _0x3c7134;});if(!_0x453166[_0xac17('0xe7')]){return db[_0xac17('0xe8')][_0xac17('0xe9')](function(_0x4d6bc2){return db[_0xac17('0xea')][_0xac17('0xeb')](_0x403fe6,{'transaction':_0x4d6bc2});});}}})['then'](function(){if(_0x18db33){_0x4b3471=_0x18db33;return db['MailAccount']['findOne']({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':_0xac17('0xec'),'raw':!![]}]});}})[_0xac17('0x3a')](function(_0x54e0ca){if(_0x54e0ca&&_0x54e0ca[_0xac17('0xec')]&&_0x453166[_0xac17('0xed')]&&_0x453166[_0xac17('0xee')]){var _0x4e5c61={'tls':{'rejectUnauthorized':![]}};if(_0x54e0ca[_0xac17('0xec')]['service']){_0x4e5c61[_0xac17('0xef')]=_0x54e0ca[_0xac17('0xec')]['service'];}else{_0x4e5c61[_0xac17('0xf0')]=_0x54e0ca[_0xac17('0xec')]['host'];_0x4e5c61['port']=_0x54e0ca['Smtp'][_0xac17('0xf1')];_0x4e5c61['secure']=_0x54e0ca['Smtp'][_0xac17('0xf2')];}if(_0x54e0ca[_0xac17('0xec')][_0xac17('0xf3')]){_0x4e5c61[_0xac17('0xf4')]={'user':_0x54e0ca['Smtp'][_0xac17('0xf5')],'pass':_0x54e0ca[_0xac17('0xec')]['pass']};}return respondWithRpcPromise(_0xac17('0xf6'),_0xac17('0xf7'),{'account':_0x4e5c61,'message':{'from':util['format'](_0xac17('0xf8'),_0x54e0ca[_0xac17('0x40')],_0x54e0ca[_0xac17('0xf9')]||_0x54e0ca[_0xac17('0xec')]['user']),'to':_0x453166[_0xac17('0xee')],'subject':_0x453166[_0xac17('0xfa')],'html':_0x4b3471[_0xac17('0x61')],'attachments':_0x52f936}},client9003)[_0xac17('0x3a')](function(){return _0x4b3471;})[_0xac17('0x2d')](function(_0x37e9d2){console[_0xac17('0x29')](_0x37e9d2);});}})[_0xac17('0x3a')](function(){if(_0x453166&&_0x453166[_0xac17('0xe7')]&&_0x453166[_0xac17('0xfb')]){var _0x1fcf08=[];if(_0x2d6304[_0xac17('0x4d')]){_0x1fcf08=_0x2d6304[_0xac17('0x42')](function(_0x383204){return{'name':_0x383204[_0xac17('0xe1')],'basename':_0x383204[_0xac17('0x78')],'type':_0x383204[_0xac17('0xe2')],'ChatOfflineMessageId':_0x18db33['id']};});}var _0x27702b;if(!_[_0xac17('0x8d')](_0x453166['subjectOffline'])){var _0x4674de=_[_0xac17('0x42')](_0x5f1eeb[_0xac17('0x61')],function(_0x926b36){return _0x926b36;});var _0x5d875b=_[_0xac17('0xfc')](_0x4674de)[0x0];var _0x19f91b=_[_0xac17('0xfd')](_0x5d875b,function(_0x33cd4c){return _0x33cd4c;});_0x27702b=_0x19f91b[0x1][_0x453166[_0xac17('0xfe')]];}var _0x1dedeb={'from':_0xe65166[_0xac17('0xf9')],'firstName':_0xe65166[_0xac17('0xb6')],'lastName':_0xe65166['lastName'],'mapKey':_0xac17('0xf9'),'message':{'from':_0xe65166['email'],'to':_0x453166[_0xac17('0xd9')][_0xac17('0xf9')],'cc':'','subject':_['isNil'](_0x27702b)?_0x453166[_0xac17('0xfa')]:_0x27702b,'messageId':'','sentAt':new Date(),'attach':_0x1fcf08[_0xac17('0x4d')],'attachments':_0x1fcf08,'originChannel':'Chat','ChatWebsiteId':_0x453166['id'],'ChatOfflineMessageId':_0x4b3471['id'],'originTo':_0x453166[_0xac17('0xd9')]['email']},'body':_0x4b3471['body']};var _0x3c3333={'account':{'id':_0x453166[_0xac17('0xfb')]},'body':_0x1dedeb,'log':_0xac17('0xff')};return respondWithRpcPromise(_0xac17('0xff'),_0xac17('0x100'),_0x3c3333,client9001)[_0xac17('0x3a')](function(){return _0x4b3471;})[_0xac17('0x2d')](function(_0x490984){console[_0xac17('0x29')](_0x490984);});}return;})[_0xac17('0x3a')](function(){if(_0x4b3471){return _0x4b3471;}})[_0xac17('0x3a')](respondWithResult(_0x4c0a9e,null))['catch'](function(_0x80d7ff){console[_0xac17('0x29')](_0xac17('0x2d'),_0x80d7ff);for(var _0x7e77ae of _0x2d6304){var _0x31d851=path[_0xac17('0x7e')](config[_0xac17('0x7f')],_0xac17('0xe3'),_0xac17('0xd6'),_0xac17('0xe4'),'offline-chat',_0x7e77ae['filename']);fs_extra['remove'](_0x31d851)[_0xac17('0x2d')](function(_0x3fa835){console[_0xac17('0x29')](_0xac17('0x101'),_0x31d851,_0x3fa835);});}});};exports[_0xac17('0x102')]=function(_0x3f1a01,_0x2f2b8b,_0xf479d8){return db[_0xac17('0xc1')]['find']({'where':{'id':_0x3f1a01[_0xac17('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2f2b8b,null))[_0xac17('0x3a')](function(_0x4b10ae){if(_0x4b10ae){return _0x4b10ae['addInteraction'](_0x3f1a01[_0xac17('0x61')][_0xac17('0x73')],_[_0xac17('0x103')](_0x3f1a01[_0xac17('0x61')],['ids','id'])||{});}})[_0xac17('0x3a')](respondWithResult(_0x2f2b8b,null))['catch'](handleError(_0x2f2b8b,null));};exports[_0xac17('0x104')]=function(_0x64b33b,_0x94020c,_0x2fcc4d){var _0x19cd39={'raw':![],'where':{}};var _0x74e100={};var _0x2446b8={'count':0x0,'rows':[]};return db[_0xac17('0x43')][_0xac17('0x6c')]({'where':{'id':_0x64b33b[_0xac17('0x5b')]['id']}})[_0xac17('0x3a')](handleEntityNotFound(_0x94020c,null))[_0xac17('0x3a')](function(_0x4f1865){if(_0x4f1865){_0x74e100[_0xac17('0x47')]=_[_0xac17('0x49')](db[_0xac17('0xc1')][_0xac17('0x44')]);_0x74e100[_0xac17('0x48')]=_[_0xac17('0x49')](_0x64b33b[_0xac17('0x48')]);_0x74e100[_0xac17('0x5e')]=_[_0xac17('0x4a')](_0x74e100[_0xac17('0x47')],_0x74e100[_0xac17('0x48')]);_0x19cd39[_0xac17('0x4b')]=_[_0xac17('0x4a')](_0x74e100[_0xac17('0x47')],qs[_0xac17('0x4c')](_0x64b33b[_0xac17('0x48')][_0xac17('0x4c')]));_0x19cd39[_0xac17('0x4b')]=_0x19cd39[_0xac17('0x4b')]['length']?_0x19cd39['attributes']:_0x74e100[_0xac17('0x47')];if(!_0x64b33b[_0xac17('0x48')]['hasOwnProperty'](_0xac17('0x6d'))){_0x19cd39[_0xac17('0x35')]=qs[_0xac17('0x35')](_0x64b33b['query'][_0xac17('0x35')]);_0x19cd39[_0xac17('0x34')]=qs['offset'](_0x64b33b[_0xac17('0x48')]['offset']);}_0x19cd39[_0xac17('0x4f')]=qs[_0xac17('0x50')](_0x64b33b['query'][_0xac17('0x50')]);_0x19cd39[_0xac17('0x52')]=qs[_0xac17('0x5e')](_[_0xac17('0x51')](_0x64b33b['query'],_0x74e100[_0xac17('0x5e')]));_0x19cd39[_0xac17('0x52')]['ChatWebsiteId']=_0x4f1865['id'];if(_0x64b33b[_0xac17('0x48')]['filter']){_0x19cd39[_0xac17('0x52')]=_[_0xac17('0x55')](_0x19cd39[_0xac17('0x52')],{'$or':_['map'](_0x19cd39[_0xac17('0x4b')],function(_0x160f45){var _0x408e3c={};_0x408e3c[_0x160f45]={'$like':'%'+_0x64b33b['query'][_0xac17('0x54')]+'%'};return _0x408e3c;})});}_0x19cd39=_[_0xac17('0x55')]({},_0x19cd39,_0x64b33b[_0xac17('0x56')]);return db['ChatInteraction'][_0xac17('0x33')]({'where':_0x19cd39[_0xac17('0x52')]})['then'](function(_0x5a91bb){_0x2446b8[_0xac17('0x33')]=_0x5a91bb;if(_0x64b33b['query'][_0xac17('0x57')]){_0x19cd39[_0xac17('0x58')]=[{'model':db[_0xac17('0x95')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xac17('0x105'),'attributes':[_0xac17('0x40'),_0xac17('0x106'),_0xac17('0x107')],'required':![]},{'model':db[_0xac17('0x108')],'as':'Tags','attributes':['id',_0xac17('0x40'),_0xac17('0x109')],'where':_0x64b33b[_0xac17('0x48')][_0xac17('0x10a')]?{'id':_0x64b33b[_0xac17('0x48')][_0xac17('0x10a')]}:undefined,'required':_0x64b33b[_0xac17('0x48')]['tag']?!![]:![]}];}return db[_0xac17('0xc1')][_0xac17('0x6e')](_0x19cd39);})[_0xac17('0x3a')](function(_0x38369e){_0x2446b8[_0xac17('0x59')]=_0x38369e;return _0x2446b8;});}})['then'](respondWithFilteredResult(_0x94020c,_0x19cd39))['catch'](handleError(_0x94020c,null));};function iftimePromise(_0x24241d,_0x3991ce){return respondWithRpcPromise(_0xac17('0x10b'),_0xac17('0x10c'),{'command':_0x3991ce[_0xac17('0x10d')]?util[_0xac17('0xba')](_0xac17('0x10e'),_0x24241d['interval'],_0x3991ce[_0xac17('0x10d')]):util['format'](_0xac17('0x10f'),_0x24241d['interval'])},client9002)[_0xac17('0x3a')](function(_0xb2d1ad){var _0x31783f=_0xb2d1ad&&_0xb2d1ad[_0xac17('0x110')](_0xac17('0x111'))>=0x0?!![]:![];logger[_0xac17('0x24')](_0xac17('0x112'),_0x3991ce['id'],_0x24241d['id'],_0x24241d[_0xac17('0x113')],_0x31783f?_0xac17('0x114'):_0xac17('0x115'),_0x3991ce[_0xac17('0x10d')]?_0x3991ce['timezone']:'No\x20timezone');return _0x31783f;})['catch'](function(_0x319c20){logger['error'](_0xac17('0x112'),_0x3991ce['id'],_0x24241d['id'],_0x24241d[_0xac17('0x113')],util[_0xac17('0x116')](_0x319c20,{'showHidden':![],'depth':null}),_0x3991ce[_0xac17('0x10d')]?_0x3991ce[_0xac17('0x10d')]:_0xac17('0x117'));return![];});}exports['getSnippet']=function(_0x1a3a36,_0x364128,_0x3cd6ea){var _0x553805=0x0;var _0x15bb88=0x0;var _0x266e29=![];var _0x29979a;var _0x588eb3;return db[_0xac17('0x43')][_0xac17('0x5f')]({'where':{'id':_0x1a3a36[_0xac17('0x5b')]['id']},'include':[{'model':db[_0xac17('0x118')],'as':_0xac17('0x118'),'include':[{'model':db['Interval'],'as':_0xac17('0x119'),'attributes':['id',_0xac17('0x113')],'raw':!![]}]}]})[_0xac17('0x3a')](handleEntityNotFound(_0x364128,null))['then'](function(_0x221f59){if(_0x221f59){_0x29979a=_0x221f59;return _0x221f59[_0xac17('0x11a')]({'raw':!![]});}})[_0xac17('0x3a')](function(_0x12c121){if(_0x29979a){if(_0x12c121){_0x588eb3=_0x12c121;}}return require(_0xac17('0x1b'))[_0xac17('0x81')]();})[_0xac17('0x3a')](function(_0x1fbce1){if(_0x1fbce1){_0x15bb88=_0x1fbce1[_0xac17('0x11b')];_0x266e29=_0x1fbce1['custom'];}})[_0xac17('0x3a')](function(){return db[_0xac17('0xc1')][_0xac17('0x33')]({'where':{'closed':![]}});})[_0xac17('0x3a')](function(_0x1c5e34){_0x553805=_0x1c5e34;if(_0x15bb88&&_0x1c5e34>_0x15bb88){return db['License'][_0xac17('0x6c')]({'where':{'id':0x1}})[_0xac17('0x3a')](function(_0xb9b860){if(_0xb9b860){_0xb9b860[_0xac17('0x11c')](_0xac17('0x11d'));}});}})[_0xac17('0x3a')](function(){if(_0x29979a[_0xac17('0x118')]&&_0x29979a['Interval'][_0xac17('0x119')]){var _0x3f3b1e=[];for(var _0x553fa0=0x0;_0x553fa0<_0x29979a[_0xac17('0x118')]['Intervals'][_0xac17('0x4d')];_0x553fa0++){var _0x1d99f6=_0x29979a[_0xac17('0x118')]['Intervals'][_0x553fa0][_0xac17('0x3c')]({'plain':!![]});_0x3f3b1e['push'](iftimePromise(_0x1d99f6,_0x29979a));}return BPromise[_0xac17('0x11e')](_0x3f3b1e)[_0xac17('0x3a')](function(_0x4e35da){return _[_0xac17('0x11f')](_0x4e35da);});}else{return!![];}})[_0xac17('0x3a')](function(_0x5a4f92){var _0x2bad1f=fs[_0xac17('0xdb')](path[_0xac17('0x7e')](config[_0xac17('0x7f')],'server/files/chat/iframe.ejs'),_0xac17('0xdd'));var _0x2f545c={'remote':_0x29979a[_0xac17('0x120')],'query':querystring['stringify'](_['merge'](_0x29979a[_0xac17('0x3c')]({'plain':!![]}),{'customerIp':_0x1a3a36['headers'][_0xac17('0xb3')]||_0x1a3a36[_0xac17('0x91')][_0xac17('0x121')]||_0x1a3a36['connection']['remoteAddress']||_0x1a3a36['ip'],'referer':_0x1a3a36[_0xac17('0x91')][_0xac17('0xb8')],'openedInteractions':_0x553805,'maxInteractions':_0x15bb88,'virtual':_0x266e29[_0xac17('0x11b')],'online':_0x5a4f92,'custom':_0x266e29}))[_0xac17('0x122')](/'/g,'\x5c\x27')};_0x364128[_0xac17('0x41')](ejs[_0xac17('0xde')](Mustache[_0xac17('0xde')](_0x2bad1f,_0x2f545c),{'proactiveActions':_0x588eb3,'alignment':_0x29979a['alignment'],'verticalAlignment':_0x29979a[_0xac17('0x123')],'div_color':_0x29979a[_0xac17('0x109')],'text_color':_0x29979a['textColor'],'button_color':_0x29979a['color_button'],'background_color':_0x29979a[_0xac17('0x124')]}));})[_0xac17('0x2d')](handleError(_0x364128,null));};exports[_0xac17('0x125')]=function(_0x1dc736,_0x5a01d5,_0x3493d4){return db[_0xac17('0x43')][_0xac17('0x6c')]({'where':{'id':_0x1dc736[_0xac17('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5a01d5,null))[_0xac17('0x3a')](function(_0x34f15b){if(_0x34f15b){return db[_0xac17('0xe8')][_0xac17('0xe9')](function(_0x50ed76){return db['ChatApplication'][_0xac17('0x3b')]({'where':{'ChatWebsiteId':_0x1dc736['params']['id']},'transaction':_0x50ed76})['then'](function(_0x51c1c0){var _0x440748=_[_0xac17('0x42')](_0x1dc736[_0xac17('0x61')],function(_0x658777){_0x658777[_0xac17('0x69')]=_0x1dc736[_0xac17('0x5b')]['id'];return _0x658777;});return db[_0xac17('0xa7')][_0xac17('0xeb')](_0x440748,{'transaction':_0x50ed76});});})[_0xac17('0x3a')](function(){return db[_0xac17('0xa7')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x1dc736[_0xac17('0x5b')]['id']},'order':_0xac17('0xad')});});}})[_0xac17('0x3a')](respondWithResult(_0x5a01d5,null))[_0xac17('0x2d')](handleError(_0x5a01d5,null));};exports[_0xac17('0x126')]=function(_0x8d257e,_0xa07e9b,_0x5f468f){var _0x584df4={};var _0x2c028d={};var _0x5d96b9;var _0x43b2e3;return db[_0xac17('0x43')][_0xac17('0x6c')]({'where':{'id':_0x8d257e[_0xac17('0x5b')]['id']}})[_0xac17('0x3a')](handleEntityNotFound(_0xa07e9b,null))[_0xac17('0x3a')](function(_0x398afe){if(_0x398afe){_0x5d96b9=_0x398afe;_0x2c028d[_0xac17('0x47')]=_[_0xac17('0x49')](db[_0xac17('0xa7')][_0xac17('0x44')]);_0x2c028d[_0xac17('0x48')]=_[_0xac17('0x49')](_0x8d257e[_0xac17('0x48')]);_0x2c028d[_0xac17('0x5e')]=_[_0xac17('0x4a')](_0x2c028d[_0xac17('0x47')],_0x2c028d[_0xac17('0x48')]);_0x584df4[_0xac17('0x4b')]=_[_0xac17('0x4a')](_0x2c028d[_0xac17('0x47')],qs[_0xac17('0x4c')](_0x8d257e[_0xac17('0x48')][_0xac17('0x4c')]));_0x584df4[_0xac17('0x4b')]=_0x584df4[_0xac17('0x4b')][_0xac17('0x4d')]?_0x584df4['attributes']:_0x2c028d[_0xac17('0x47')];_0x584df4[_0xac17('0x4f')]=qs[_0xac17('0x50')](_0x8d257e[_0xac17('0x48')][_0xac17('0x50')]);_0x584df4['where']=qs[_0xac17('0x5e')](_['pick'](_0x8d257e[_0xac17('0x48')],_0x2c028d[_0xac17('0x5e')]));if(_0x8d257e[_0xac17('0x48')][_0xac17('0x54')]){_0x584df4['where']=_[_0xac17('0x55')](_0x584df4['where'],{'$or':_['map'](_0x584df4[_0xac17('0x4b')],function(_0x3e3aff){var _0x1e150a={};_0x1e150a[_0x3e3aff]={'$like':'%'+_0x8d257e['query']['filter']+'%'};return _0x1e150a;})});}_0x584df4=_['merge']({},_0x584df4,_0x8d257e['options']);return _0x5d96b9[_0xac17('0x126')](_0x584df4);}})[_0xac17('0x3a')](function(_0x101b81){if(_0x101b81){_0x43b2e3=_0x101b81[_0xac17('0x4d')];if(!_0x8d257e[_0xac17('0x48')][_0xac17('0x4e')](_0xac17('0x6d'))){_0x584df4[_0xac17('0x35')]=qs[_0xac17('0x35')](_0x8d257e['query'][_0xac17('0x35')]);_0x584df4[_0xac17('0x34')]=qs['offset'](_0x8d257e[_0xac17('0x48')][_0xac17('0x34')]);}return _0x5d96b9[_0xac17('0x126')](_0x584df4);}})[_0xac17('0x3a')](function(_0x25245b){if(_0x25245b){return _0x25245b?{'count':_0x43b2e3,'rows':_0x25245b}:null;}})['then'](respondWithResult(_0xa07e9b,null))[_0xac17('0x2d')](handleError(_0xa07e9b,null));};exports[_0xac17('0x127')]=function(_0x479019,_0x4b7f73,_0x1f9741){return db[_0xac17('0x128')][_0xac17('0x5f')]({'where':{'id':_0x479019[_0xac17('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4b7f73,null))['then'](function(_0x570166){if(_0x570166){return _0x570166['addProactiveActions'](_0x479019['body'][_0xac17('0x73')],_['omit'](_0x479019['body'],[_0xac17('0x73'),'id'])||{});}})[_0xac17('0x3a')](respondWithResult(_0x4b7f73,null))[_0xac17('0x2d')](handleError(_0x4b7f73,null));};exports[_0xac17('0x11a')]=function(_0x3e5d88,_0x290fa5,_0x14bf77){var _0x384a98={};var _0x306f29={};var _0x2e92b1;var _0x33a006;return db['ChatWebsite'][_0xac17('0x6c')]({'where':{'id':_0x3e5d88[_0xac17('0x5b')]['id']}})[_0xac17('0x3a')](handleEntityNotFound(_0x290fa5,null))['then'](function(_0x4c830){if(_0x4c830){_0x2e92b1=_0x4c830;_0x306f29[_0xac17('0x47')]=_[_0xac17('0x49')](db[_0xac17('0x129')][_0xac17('0x44')]);_0x306f29[_0xac17('0x48')]=_[_0xac17('0x49')](_0x3e5d88[_0xac17('0x48')]);_0x306f29[_0xac17('0x5e')]=_[_0xac17('0x4a')](_0x306f29['model'],_0x306f29[_0xac17('0x48')]);_0x384a98[_0xac17('0x4b')]=_[_0xac17('0x4a')](_0x306f29[_0xac17('0x47')],qs[_0xac17('0x4c')](_0x3e5d88['query'][_0xac17('0x4c')]));_0x384a98[_0xac17('0x4b')]=_0x384a98[_0xac17('0x4b')][_0xac17('0x4d')]?_0x384a98['attributes']:_0x306f29['model'];_0x384a98[_0xac17('0x4f')]=qs[_0xac17('0x50')](_0x3e5d88[_0xac17('0x48')][_0xac17('0x50')]);_0x384a98['where']=qs[_0xac17('0x5e')](_['pick'](_0x3e5d88[_0xac17('0x48')],_0x306f29[_0xac17('0x5e')]));if(_0x3e5d88[_0xac17('0x48')][_0xac17('0x54')]){_0x384a98['where']=_[_0xac17('0x55')](_0x384a98[_0xac17('0x52')],{'$or':_[_0xac17('0x42')](_0x384a98[_0xac17('0x4b')],function(_0x38d1c1){var _0x5034cf={};_0x5034cf[_0x38d1c1]={'$like':'%'+_0x3e5d88[_0xac17('0x48')]['filter']+'%'};return _0x5034cf;})});}_0x384a98=_[_0xac17('0x55')]({},_0x384a98,_0x3e5d88[_0xac17('0x56')]);return _0x2e92b1[_0xac17('0x11a')](_0x384a98);}})['then'](function(_0x435d96){if(_0x435d96){_0x33a006=_0x435d96['length'];if(!_0x3e5d88[_0xac17('0x48')][_0xac17('0x4e')]('nolimit')){_0x384a98[_0xac17('0x35')]=qs[_0xac17('0x35')](_0x3e5d88['query'][_0xac17('0x35')]);_0x384a98[_0xac17('0x34')]=qs[_0xac17('0x34')](_0x3e5d88[_0xac17('0x48')]['offset']);}return _0x2e92b1[_0xac17('0x11a')](_0x384a98);}})[_0xac17('0x3a')](function(_0x3df343){if(_0x3df343){return _0x3df343?{'count':_0x33a006,'rows':_0x3df343}:null;}})['then'](respondWithResult(_0x290fa5,null))['catch'](handleError(_0x290fa5,null));};exports[_0xac17('0x12a')]=function(_0x3ad464,_0x1d6c51,_0xc95eb8){var _0x164124=_0x3ad464[_0xac17('0x48')][_0xac17('0x12b')]==='false'?_0xac17('0x12c'):_0xac17('0x12d');return db['ChatWebsite'][_0xac17('0x5f')]({'attributes':['id',_0x164124],'where':{'id':_0x3ad464['params']['id']}})['then'](handleEntityNotFound(_0x1d6c51,null))['then'](function(_0x582359){if(_0x582359){var _0x3275dd=_0x582359[_0x164124];var _0x16a749=_0x3275dd&&_0x3275dd[_0xac17('0x12e')]?_0x3275dd[_0xac17('0x12e')]:[];_0x1d6c51[_0xac17('0x41')]({'fromKey':_[_0xac17('0x8d')](_0x3275dd[_0xac17('0x12f')])?undefined:_0x3275dd[_0xac17('0x12f')],'count':_0x16a749[_0xac17('0x4d')],'rows':_0x16a749});}})[_0xac17('0x2d')](handleError(_0x1d6c51,null));};exports[_0xac17('0x130')]=function(_0x37d941,_0x5879aa,_0xa523d7){var _0x41713e={'raw':![],'where':{}};var _0xa3b60e={};var _0x7c439d={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x37d941[_0xac17('0x5b')]['id']}})[_0xac17('0x3a')](handleEntityNotFound(_0x5879aa,null))[_0xac17('0x3a')](function(_0x16226a){if(_0x16226a){_0xa3b60e[_0xac17('0x47')]=_[_0xac17('0x49')](db[_0xac17('0xe0')]['rawAttributes']);_0xa3b60e['query']=_[_0xac17('0x49')](_0x37d941[_0xac17('0x48')]);_0xa3b60e[_0xac17('0x5e')]=_[_0xac17('0x4a')](_0xa3b60e[_0xac17('0x47')],_0xa3b60e[_0xac17('0x48')]);_0x41713e[_0xac17('0x4b')]=_[_0xac17('0x4a')](_0xa3b60e[_0xac17('0x47')],qs[_0xac17('0x4c')](_0x37d941[_0xac17('0x48')][_0xac17('0x4c')]));_0x41713e['attributes']=_0x41713e[_0xac17('0x4b')][_0xac17('0x4d')]?_0x41713e['attributes']:_0xa3b60e['model'];if(!_0x37d941[_0xac17('0x48')][_0xac17('0x4e')]('nolimit')){_0x41713e[_0xac17('0x35')]=qs['limit'](_0x37d941['query']['limit']);_0x41713e[_0xac17('0x34')]=qs[_0xac17('0x34')](_0x37d941[_0xac17('0x48')][_0xac17('0x34')]);}_0x41713e[_0xac17('0x4f')]=qs[_0xac17('0x50')](_0x37d941[_0xac17('0x48')][_0xac17('0x50')]);_0x41713e['where']=qs['filters'](_['pick'](_0x37d941['query'],_0xa3b60e[_0xac17('0x5e')]));_0x41713e['where'][_0xac17('0x69')]=_0x16226a['id'];if(_0x37d941[_0xac17('0x48')][_0xac17('0x54')]){_0x41713e[_0xac17('0x52')]=_[_0xac17('0x55')](_0x41713e[_0xac17('0x52')],{'$or':_['map'](_0x41713e['attributes'],function(_0x559f96){var _0x472396={};_0x472396[_0x559f96]={'$like':'%'+_0x37d941[_0xac17('0x48')][_0xac17('0x54')]+'%'};return _0x472396;})});}_0x41713e=_[_0xac17('0x55')]({},_0x41713e,_0x37d941[_0xac17('0x56')]);return db[_0xac17('0xe0')]['count']({'where':_0x41713e[_0xac17('0x52')]})[_0xac17('0x3a')](function(_0x3c01a4){_0x7c439d[_0xac17('0x33')]=_0x3c01a4;if(_0x37d941[_0xac17('0x48')][_0xac17('0x57')]){_0x41713e[_0xac17('0x58')]=[{'all':!![]}];}else{_0x41713e[_0xac17('0x58')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['Attachment'],'as':_0xac17('0x131'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x41713e);})['then'](function(_0x1806c2){_0x7c439d[_0xac17('0x59')]=_0x1806c2;return _0x7c439d;});}})['then'](respondWithFilteredResult(_0x5879aa,_0x41713e))['catch'](handleError(_0x5879aa,null));};exports[_0xac17('0x132')]=function(_0x348248,_0x430ad1,_0xfc000e){return db['ChatWebsite'][_0xac17('0x5f')]({'where':{'id':_0x348248[_0xac17('0x5b')]['id']}})[_0xac17('0x3a')](handleEntityNotFound(_0x430ad1,null))[_0xac17('0x3a')](function(_0x1d9224){if(_0x1d9224){return _0x1d9224[_0xac17('0x132')](_0x348248['body']['ids'],_[_0xac17('0x103')](_0x348248['body'],[_0xac17('0x73'),'id'])||{})[_0xac17('0xc5')](function(_0x1fadb6){for(var _0x32257c=0x0;_0x32257c<_0x348248[_0xac17('0x61')]['ids'][_0xac17('0x4d')];_0x32257c+=0x1){socket[_0xac17('0x133')](_0xac17('0x134'),{'UserId':Number(_0x348248[_0xac17('0x61')][_0xac17('0x73')][_0x32257c]),'ChatWebsiteId':Number(_0x348248[_0xac17('0x5b')]['id'])});}return _0x1fadb6;});}})[_0xac17('0x3a')](respondWithResult(_0x430ad1,null))[_0xac17('0x2d')](handleError(_0x430ad1,null));};exports[_0xac17('0x135')]=function(_0x36dd23,_0x4aef42,_0x5ec1d0){return db['ChatWebsite']['find']({'where':{'id':_0x36dd23[_0xac17('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4aef42,null))['then'](function(_0x27382b){if(_0x27382b){return _0x27382b[_0xac17('0x135')](_0x36dd23[_0xac17('0x48')][_0xac17('0x73')])[_0xac17('0x3a')](function(){if(_[_0xac17('0x136')](_0x36dd23['query'][_0xac17('0x73')])){for(var _0x949b03=0x0;_0x949b03<_0x36dd23[_0xac17('0x48')][_0xac17('0x73')][_0xac17('0x4d')];_0x949b03+=0x1){socket['emit'](_0xac17('0x137'),{'UserId':Number(_0x36dd23['query'][_0xac17('0x73')][_0x949b03]),'ChatWebsiteId':Number(_0x36dd23[_0xac17('0x5b')]['id'])});}}else{socket[_0xac17('0x133')]('userChatWebsite:remove',{'UserId':Number(_0x36dd23[_0xac17('0x48')][_0xac17('0x73')]),'ChatWebsiteId':Number(_0x36dd23['params']['id'])});}});}})[_0xac17('0x3a')](respondWithStatusCode(_0x4aef42,null))[_0xac17('0x2d')](handleError(_0x4aef42,null));};exports[_0xac17('0x138')]=function(_0x3c58bc,_0x64903d,_0x1dfe5b){var _0x1e8cff={};var _0x1dded9={};var _0x27041f;var _0x266188;return db['ChatWebsite'][_0xac17('0x6c')]({'where':{'id':_0x3c58bc[_0xac17('0x5b')]['id']}})[_0xac17('0x3a')](handleEntityNotFound(_0x64903d,null))['then'](function(_0x4e66cd){if(_0x4e66cd){_0x27041f=_0x4e66cd;_0x1dded9[_0xac17('0x47')]=_['keys'](db[_0xac17('0xd0')]['rawAttributes']);_0x1dded9[_0xac17('0x48')]=_[_0xac17('0x49')](_0x3c58bc[_0xac17('0x48')]);_0x1dded9[_0xac17('0x5e')]=_[_0xac17('0x4a')](_0x1dded9[_0xac17('0x47')],_0x1dded9[_0xac17('0x48')]);_0x1e8cff[_0xac17('0x4b')]=_[_0xac17('0x4a')](_0x1dded9[_0xac17('0x47')],qs[_0xac17('0x4c')](_0x3c58bc['query']['fields']));_0x1e8cff[_0xac17('0x4b')]=_0x1e8cff[_0xac17('0x4b')][_0xac17('0x4d')]?_0x1e8cff[_0xac17('0x4b')]:_0x1dded9[_0xac17('0x47')];_0x1e8cff[_0xac17('0x4f')]=qs[_0xac17('0x50')](_0x3c58bc[_0xac17('0x48')]['sort']);_0x1e8cff[_0xac17('0x52')]=qs['filters'](_[_0xac17('0x51')](_0x3c58bc[_0xac17('0x48')],_0x1dded9[_0xac17('0x5e')]));if(_0x3c58bc['query']['filter']){_0x1e8cff[_0xac17('0x52')]=_[_0xac17('0x55')](_0x1e8cff['where'],{'$or':_[_0xac17('0x42')](_0x1e8cff[_0xac17('0x4b')],function(_0x3b2cb8){var _0x559291={};_0x559291[_0x3b2cb8]={'$like':'%'+_0x3c58bc[_0xac17('0x48')][_0xac17('0x54')]+'%'};return _0x559291;})});}_0x1e8cff=_[_0xac17('0x55')]({},_0x1e8cff,_0x3c58bc['options']);return _0x27041f['getAgents'](_0x1e8cff);}})[_0xac17('0x3a')](function(_0xa0bea6){if(_0xa0bea6){_0x266188=_0xa0bea6[_0xac17('0x4d')];if(!_0x3c58bc[_0xac17('0x48')][_0xac17('0x4e')]('nolimit')){_0x1e8cff[_0xac17('0x35')]=qs[_0xac17('0x35')](_0x3c58bc[_0xac17('0x48')]['limit']);_0x1e8cff[_0xac17('0x34')]=qs[_0xac17('0x34')](_0x3c58bc[_0xac17('0x48')][_0xac17('0x34')]);}return _0x27041f[_0xac17('0x138')](_0x1e8cff);}})['then'](function(_0x520a6d){if(_0x520a6d){return _0x520a6d?{'count':_0x266188,'rows':_0x520a6d}:null;}})[_0xac17('0x3a')](respondWithResult(_0x64903d,null))[_0xac17('0x2d')](handleError(_0x64903d,null));}; \ No newline at end of file +var _0x9a84=['originalname','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','authentication','auth','pass','SendMail','sendMail','MailAccountId','subjectOffline','toPairsIn','mapValues','email','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','server','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','License','chatLicenseExceeded','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','textColor','color_button','ChatApplication','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ChatWebsiteId','Disposition','findOne','nolimit','include','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','sitepic','file','filename','customerAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','applications','list','priority','asc','ListId','customerIp','headers','cf-connecting-ip','x-forwarded-for','split','firstName','x-real-port','referer','version','format','%s\x20%s','browser','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','interaction','spread','contact','lastName','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','files','no\x20available\x20attributes','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage'];(function(_0x11f88e,_0x1a6c79){var _0x5f0c08=function(_0x253aaf){while(--_0x253aaf){_0x11f88e['push'](_0x11f88e['shift']());}};_0x5f0c08(++_0x1a6c79);}(_0x9a84,0x18c));var _0x49a8=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x9a84[_0x4d8ed9];return _0x1e2140;};'use strict';var emlformat=require(_0x49a8('0x0'));var rimraf=require(_0x49a8('0x1'));var zipdir=require(_0x49a8('0x2'));var jsonpatch=require(_0x49a8('0x3'));var rp=require('request-promise');var moment=require(_0x49a8('0x4'));var BPromise=require(_0x49a8('0x5'));var Mustache=require('mustache');var util=require(_0x49a8('0x6'));var path=require(_0x49a8('0x7'));var sox=require(_0x49a8('0x8'));var csv=require(_0x49a8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x49a8('0xa'));var _=require(_0x49a8('0xb'));var squel=require(_0x49a8('0xc'));var crypto=require(_0x49a8('0xd'));var jsforce=require(_0x49a8('0xe'));var deskjs=require(_0x49a8('0xf'));var toCsv=require(_0x49a8('0x9'));var querystring=require(_0x49a8('0x10'));var Papa=require(_0x49a8('0x11'));var Redis=require(_0x49a8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x49a8('0x13'));var as=require(_0x49a8('0x14'));var hardwareService=require(_0x49a8('0x15'));var logger=require(_0x49a8('0x16'))(_0x49a8('0x17'));var utils=require(_0x49a8('0x18'));var config=require(_0x49a8('0x19'));var licenseUtil=require(_0x49a8('0x1a'));var db=require(_0x49a8('0x1b'))['db'];config[_0x49a8('0x1c')]=_[_0x49a8('0x1d')](config[_0x49a8('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x49a8('0x1e'))(new Redis(config[_0x49a8('0x1c')]));require(_0x49a8('0x1f'))['register'](socket);var jayson=require(_0x49a8('0x20'));var client=jayson[_0x49a8('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x49a8('0x21')][_0x49a8('0x22')]({'port':0x232a});var client9003=jayson[_0x49a8('0x21')][_0x49a8('0x22')]({'port':0x232b});var client9001=jayson[_0x49a8('0x21')]['http']({'port':0x2329});function respondWithRpcPromise(_0x42a2b9,_0x30dcdf,_0x375c0a,_0x5afd77){return new BPromise(function(_0x2fac14,_0x41f129){var _0x33b957=_0x5afd77||client;return _0x33b957[_0x49a8('0x23')](_0x42a2b9,_0x375c0a)['then'](function(_0xd58d91){logger[_0x49a8('0x24')](_0x49a8('0x25'),_0x30dcdf,_0x49a8('0x26'));logger[_0x49a8('0x27')](_0x49a8('0x28'),_0x30dcdf,_0x49a8('0x26'),JSON[_0x49a8('0x29')](_0xd58d91));if(_0xd58d91['error']){if(_0xd58d91['error'][_0x49a8('0x2a')]===0x1f4){logger[_0x49a8('0x2b')](_0x49a8('0x25'),_0x30dcdf,_0xd58d91[_0x49a8('0x2b')][_0x49a8('0x2c')]);return _0x41f129(_0xd58d91[_0x49a8('0x2b')][_0x49a8('0x2c')]);}logger['error'](_0x49a8('0x25'),_0x30dcdf,_0xd58d91['error'][_0x49a8('0x2c')]);return _0x2fac14(_0xd58d91[_0x49a8('0x2b')]['message']);}else{logger[_0x49a8('0x24')](_0x49a8('0x25'),_0x30dcdf,_0x49a8('0x26'));_0x2fac14(_0xd58d91[_0x49a8('0x2d')][_0x49a8('0x2c')]);}})[_0x49a8('0x2e')](function(_0x70b950){logger[_0x49a8('0x2b')]('ChatWebsite,\x20%s,\x20%s',_0x30dcdf,_0x70b950);_0x41f129(_0x70b950);});});}function respondWithStatusCode(_0x164e78,_0x4e93bf){_0x4e93bf=_0x4e93bf||0xcc;return function(_0x4628b5){if(_0x4628b5){return _0x164e78[_0x49a8('0x2f')](_0x4e93bf);}return _0x164e78[_0x49a8('0x30')](_0x4e93bf)[_0x49a8('0x31')]();};}function respondWithResult(_0x19d325,_0x5a8598){_0x5a8598=_0x5a8598||0xc8;return function(_0x427bed){if(_0x427bed){return _0x19d325[_0x49a8('0x30')](_0x5a8598)[_0x49a8('0x32')](_0x427bed);}};}function respondWithFilteredResult(_0xa1407a,_0x3740fa){return function(_0x57bd77){if(_0x57bd77){var _0x30a78a=typeof _0x3740fa[_0x49a8('0x33')]===_0x49a8('0x34')&&typeof _0x3740fa[_0x49a8('0x35')]===_0x49a8('0x34');var _0x1460d3=_0x57bd77[_0x49a8('0x36')];var _0x24ae71=_0x30a78a?0x0:_0x3740fa[_0x49a8('0x33')];var _0x260d0e=_0x30a78a?_0x57bd77['count']:_0x3740fa['offset']+_0x3740fa[_0x49a8('0x35')];var _0x9c692b;if(_0x260d0e>=_0x1460d3){_0x260d0e=_0x1460d3;_0x9c692b=0xc8;}else{_0x9c692b=0xce;}_0xa1407a[_0x49a8('0x30')](_0x9c692b);return _0xa1407a[_0x49a8('0x37')](_0x49a8('0x38'),_0x24ae71+'-'+_0x260d0e+'/'+_0x1460d3)[_0x49a8('0x32')](_0x57bd77);}return null;};}function patchUpdates(_0x2fefb1){return function(_0x362752){try{jsonpatch[_0x49a8('0x39')](_0x362752,_0x2fefb1,!![]);}catch(_0x52639b){return BPromise[_0x49a8('0x3a')](_0x52639b);}return _0x362752[_0x49a8('0x3b')]();};}function saveUpdates(_0x4f3f4d,_0x52c6a2){return function(_0xe75ae){if(_0xe75ae){return _0xe75ae['update'](_0x4f3f4d)[_0x49a8('0x3c')](function(_0x34837e){return _0x34837e;});}return null;};}function removeEntity(_0x2ff6d7,_0x36ac06){return function(_0x48e22d){if(_0x48e22d){return _0x48e22d[_0x49a8('0x3d')]()[_0x49a8('0x3c')](function(){var _0x33f5aa=_0x48e22d['get']({'plain':!![]});var _0x1ae983='ChatWebsites';return db[_0x49a8('0x3e')]['destroy']({'where':{'type':_0x1ae983,'resourceId':_0x33f5aa['id']}})[_0x49a8('0x3c')](function(){return _0x48e22d;});})['then'](function(){_0x2ff6d7['status'](0xcc)[_0x49a8('0x31')]();});}};}function handleEntityNotFound(_0x38d4ea,_0xa9840f){return function(_0x5ce2d2){if(!_0x5ce2d2){_0x38d4ea[_0x49a8('0x2f')](0x194);}return _0x5ce2d2;};}function handleError(_0x53926e,_0x398ece){_0x398ece=_0x398ece||0x1f4;return function(_0x3b13da){logger[_0x49a8('0x2b')](_0x3b13da[_0x49a8('0x3f')]);if(_0x3b13da[_0x49a8('0x40')]){delete _0x3b13da[_0x49a8('0x40')];}_0x53926e['status'](_0x398ece)[_0x49a8('0x41')](_0x3b13da);};}exports['index']=function(_0x17ad16,_0x15d9a1){var _0x30a515={'include':[{'model':db[_0x49a8('0x42')],'as':_0x49a8('0x43')}]},_0x16002d={},_0x23aed3={'count':0x0,'rows':[]};var _0x38507e=_[_0x49a8('0x44')](db[_0x49a8('0x45')][_0x49a8('0x46')],function(_0x26da89){return{'name':_0x26da89[_0x49a8('0x47')],'type':_0x26da89[_0x49a8('0x48')][_0x49a8('0x49')]};});_0x16002d[_0x49a8('0x4a')]=_[_0x49a8('0x44')](_0x38507e,_0x49a8('0x40'));_0x16002d['query']=_['keys'](_0x17ad16[_0x49a8('0x4b')]);_0x16002d[_0x49a8('0x4c')]=_[_0x49a8('0x4d')](_0x16002d['model'],_0x16002d[_0x49a8('0x4b')]);_0x30a515[_0x49a8('0x4e')]=_['intersection'](_0x16002d[_0x49a8('0x4a')],qs['fields'](_0x17ad16['query']['fields']));_0x30a515[_0x49a8('0x4e')]=_0x30a515['attributes'][_0x49a8('0x4f')]?_0x30a515['attributes']:_0x16002d[_0x49a8('0x4a')];if(!_0x17ad16[_0x49a8('0x4b')][_0x49a8('0x50')]('nolimit')){_0x30a515['limit']=qs['limit'](_0x17ad16[_0x49a8('0x4b')][_0x49a8('0x35')]);_0x30a515['offset']=qs['offset'](_0x17ad16[_0x49a8('0x4b')][_0x49a8('0x33')]);}_0x30a515[_0x49a8('0x51')]=qs[_0x49a8('0x52')](_0x17ad16[_0x49a8('0x4b')][_0x49a8('0x52')]);_0x30a515[_0x49a8('0x53')]=qs[_0x49a8('0x4c')](_[_0x49a8('0x54')](_0x17ad16[_0x49a8('0x4b')],_0x16002d[_0x49a8('0x4c')]),_0x38507e);if(_0x17ad16[_0x49a8('0x4b')][_0x49a8('0x55')]){_0x30a515[_0x49a8('0x53')]=_[_0x49a8('0x56')](_0x30a515[_0x49a8('0x53')],{'$or':_[_0x49a8('0x44')](_0x38507e,function(_0xf9aff5){if(_0xf9aff5[_0x49a8('0x48')]!==_0x49a8('0x57')){var _0x3602ab={};_0x3602ab[_0xf9aff5[_0x49a8('0x40')]]={'$like':'%'+_0x17ad16[_0x49a8('0x4b')][_0x49a8('0x55')]+'%'};return _0x3602ab;}})});}_0x30a515=_[_0x49a8('0x56')]({},_0x30a515,_0x17ad16[_0x49a8('0x58')]);var _0x3351b7={'where':_0x30a515[_0x49a8('0x53')]};return db[_0x49a8('0x45')][_0x49a8('0x36')](_0x3351b7)[_0x49a8('0x3c')](function(_0x4f7d03){_0x23aed3[_0x49a8('0x36')]=_0x4f7d03;if(_0x17ad16[_0x49a8('0x4b')][_0x49a8('0x59')]){_0x30a515['include']=[{'all':!![]}];}return db['ChatWebsite'][_0x49a8('0x5a')](_0x30a515);})[_0x49a8('0x3c')](function(_0x1d52cd){_0x23aed3['rows']=_0x1d52cd;return _0x23aed3;})[_0x49a8('0x3c')](respondWithFilteredResult(_0x15d9a1,_0x30a515))[_0x49a8('0x2e')](handleError(_0x15d9a1,null));};exports[_0x49a8('0x5b')]=function(_0x33addd,_0x1fcbaa){var _0x208152={'raw':![],'where':{'id':_0x33addd[_0x49a8('0x5c')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5d58e6={};_0x5d58e6['model']=_[_0x49a8('0x5d')](db[_0x49a8('0x45')][_0x49a8('0x46')]);_0x5d58e6[_0x49a8('0x4b')]=_[_0x49a8('0x5d')](_0x33addd[_0x49a8('0x4b')]);_0x5d58e6[_0x49a8('0x4c')]=_[_0x49a8('0x4d')](_0x5d58e6[_0x49a8('0x4a')],_0x5d58e6[_0x49a8('0x4b')]);_0x208152['attributes']=_[_0x49a8('0x4d')](_0x5d58e6[_0x49a8('0x4a')],qs[_0x49a8('0x5e')](_0x33addd[_0x49a8('0x4b')][_0x49a8('0x5e')]));_0x208152[_0x49a8('0x4e')]=_0x208152[_0x49a8('0x4e')][_0x49a8('0x4f')]?_0x208152['attributes']:_0x5d58e6[_0x49a8('0x4a')];if(_0x33addd[_0x49a8('0x4b')][_0x49a8('0x59')]){_0x208152['include']=[{'all':!![]}];}_0x208152=_['merge']({},_0x208152,_0x33addd['options']);return db[_0x49a8('0x45')][_0x49a8('0x5f')](_0x208152)[_0x49a8('0x3c')](handleEntityNotFound(_0x1fcbaa,null))[_0x49a8('0x3c')](respondWithResult(_0x1fcbaa,null))['catch'](handleError(_0x1fcbaa,null));};exports[_0x49a8('0x60')]=function(_0x34880c,_0xf66244){return db[_0x49a8('0x45')]['create'](_0x34880c[_0x49a8('0x61')],{})[_0x49a8('0x3c')](function(_0x1ea906){var _0x5801b9=_0x34880c[_0x49a8('0x62')]['get']({'plain':!![]});if(!_0x5801b9)throw new Error(_0x49a8('0x63'));if(_0x5801b9[_0x49a8('0x64')]==='user'){var _0x374b14=_0x1ea906[_0x49a8('0x65')]({'plain':!![]});var _0x254eba='ChatWebsites';return db[_0x49a8('0x66')][_0x49a8('0x5f')]({'where':{'name':_0x254eba,'userProfileId':_0x5801b9[_0x49a8('0x67')]},'raw':!![]})['then'](function(_0x31318f){if(_0x31318f&&_0x31318f[_0x49a8('0x68')]===0x0){return db[_0x49a8('0x3e')][_0x49a8('0x60')]({'name':_0x374b14[_0x49a8('0x40')],'resourceId':_0x374b14['id'],'type':_0x31318f['name'],'sectionId':_0x31318f['id']},{})[_0x49a8('0x3c')](function(){return _0x1ea906;});}else{return _0x1ea906;}})['catch'](function(_0x43206e){logger[_0x49a8('0x2b')](_0x49a8('0x69'),_0x43206e);throw _0x43206e;});}return _0x1ea906;})[_0x49a8('0x3c')](respondWithResult(_0xf66244,0xc9))[_0x49a8('0x2e')](handleError(_0xf66244,null));};exports[_0x49a8('0x6a')]=function(_0x399dde,_0xa30a61){if(_0x399dde[_0x49a8('0x61')]['id']){delete _0x399dde[_0x49a8('0x61')]['id'];}return db[_0x49a8('0x45')][_0x49a8('0x5f')]({'where':{'id':_0x399dde[_0x49a8('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x49a8('0x43')}]})[_0x49a8('0x3c')](handleEntityNotFound(_0xa30a61,null))[_0x49a8('0x3c')](saveUpdates(_0x399dde[_0x49a8('0x61')],null))[_0x49a8('0x3c')](respondWithResult(_0xa30a61,null))[_0x49a8('0x2e')](handleError(_0xa30a61,null));};exports[_0x49a8('0x3d')]=function(_0x28add,_0x5ecca3){return db[_0x49a8('0x45')][_0x49a8('0x5f')]({'where':{'id':_0x28add[_0x49a8('0x5c')]['id']}})[_0x49a8('0x3c')](handleEntityNotFound(_0x5ecca3,null))[_0x49a8('0x3c')](removeEntity(_0x5ecca3,null))[_0x49a8('0x2e')](handleError(_0x5ecca3,null));};exports[_0x49a8('0x6b')]=function(_0x424f38,_0x44bae7){return db[_0x49a8('0x45')][_0x49a8('0x6b')]()['then'](respondWithResult(_0x44bae7,null))[_0x49a8('0x2e')](handleError(_0x44bae7,null));};exports[_0x49a8('0x6c')]=function(_0x254f07,_0x499617,_0x3a7781){if(_0x254f07[_0x49a8('0x61')]['id']){delete _0x254f07[_0x49a8('0x61')]['id'];}return db[_0x49a8('0x45')][_0x49a8('0x5f')]({'where':{'id':_0x254f07[_0x49a8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x499617,null))[_0x49a8('0x3c')](function(_0x1c26f8){if(_0x1c26f8){_0x254f07[_0x49a8('0x61')][_0x49a8('0x6d')]=_0x1c26f8['id'];return db[_0x49a8('0x6e')]['create'](_0x254f07['body']);}})[_0x49a8('0x3c')](respondWithResult(_0x499617,null))[_0x49a8('0x2e')](handleError(_0x499617,null));};exports['getDispositions']=function(_0x2ec8ac,_0x378848,_0x4ff0ee){var _0x575a39={'raw':![],'where':{}};var _0xc81c0b={};var _0x56e3bc={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x49a8('0x6f')]({'where':{'id':_0x2ec8ac[_0x49a8('0x5c')]['id']}})[_0x49a8('0x3c')](handleEntityNotFound(_0x378848,null))[_0x49a8('0x3c')](function(_0x4aa764){if(_0x4aa764){_0xc81c0b['model']=_[_0x49a8('0x5d')](db[_0x49a8('0x6e')][_0x49a8('0x46')]);_0xc81c0b['query']=_[_0x49a8('0x5d')](_0x2ec8ac[_0x49a8('0x4b')]);_0xc81c0b['filters']=_[_0x49a8('0x4d')](_0xc81c0b[_0x49a8('0x4a')],_0xc81c0b[_0x49a8('0x4b')]);_0x575a39['attributes']=_[_0x49a8('0x4d')](_0xc81c0b[_0x49a8('0x4a')],qs[_0x49a8('0x5e')](_0x2ec8ac[_0x49a8('0x4b')][_0x49a8('0x5e')]));_0x575a39[_0x49a8('0x4e')]=_0x575a39[_0x49a8('0x4e')][_0x49a8('0x4f')]?_0x575a39[_0x49a8('0x4e')]:_0xc81c0b[_0x49a8('0x4a')];if(!_0x2ec8ac['query'][_0x49a8('0x50')](_0x49a8('0x70'))){_0x575a39[_0x49a8('0x35')]=qs[_0x49a8('0x35')](_0x2ec8ac[_0x49a8('0x4b')][_0x49a8('0x35')]);_0x575a39[_0x49a8('0x33')]=qs[_0x49a8('0x33')](_0x2ec8ac['query']['offset']);}_0x575a39[_0x49a8('0x51')]=qs['sort'](_0x2ec8ac[_0x49a8('0x4b')][_0x49a8('0x52')]);_0x575a39[_0x49a8('0x53')]=qs[_0x49a8('0x4c')](_[_0x49a8('0x54')](_0x2ec8ac[_0x49a8('0x4b')],_0xc81c0b[_0x49a8('0x4c')]));_0x575a39['where'][_0x49a8('0x6d')]=_0x4aa764['id'];if(_0x2ec8ac[_0x49a8('0x4b')][_0x49a8('0x55')]){_0x575a39[_0x49a8('0x53')]=_[_0x49a8('0x56')](_0x575a39['where'],{'$or':_['map'](_0x575a39[_0x49a8('0x4e')],function(_0x411aec){var _0x1f4833={};_0x1f4833[_0x411aec]={'$like':'%'+_0x2ec8ac[_0x49a8('0x4b')][_0x49a8('0x55')]+'%'};return _0x1f4833;})});}_0x575a39=_[_0x49a8('0x56')]({},_0x575a39,_0x2ec8ac[_0x49a8('0x58')]);return db[_0x49a8('0x6e')][_0x49a8('0x36')]({'where':_0x575a39[_0x49a8('0x53')]})[_0x49a8('0x3c')](function(_0x214e9d){_0x56e3bc[_0x49a8('0x36')]=_0x214e9d;if(_0x2ec8ac[_0x49a8('0x4b')][_0x49a8('0x59')]){_0x575a39[_0x49a8('0x71')]=[{'all':!![]}];}return db[_0x49a8('0x6e')][_0x49a8('0x5a')](_0x575a39);})['then'](function(_0x2f534e){_0x56e3bc[_0x49a8('0x72')]=_0x2f534e;return _0x56e3bc;});}})[_0x49a8('0x3c')](respondWithFilteredResult(_0x378848,_0x575a39))[_0x49a8('0x2e')](handleError(_0x378848,null));};exports[_0x49a8('0x73')]=function(_0x1962b1,_0x194bea,_0x4da0b1){return db[_0x49a8('0x45')][_0x49a8('0x5f')]({'where':{'id':_0x1962b1[_0x49a8('0x5c')]['id']}})[_0x49a8('0x3c')](handleEntityNotFound(_0x194bea,null))[_0x49a8('0x3c')](function(_0x4aa33a){if(_0x4aa33a){return _0x4aa33a[_0x49a8('0x73')](_0x1962b1['query']['ids']);}})[_0x49a8('0x3c')](respondWithStatusCode(_0x194bea,null))[_0x49a8('0x2e')](handleError(_0x194bea,null));};exports['addAnswer']=function(_0x1e1075,_0x393f29,_0x91d6bf){if(_0x1e1075[_0x49a8('0x61')]['id']){delete _0x1e1075[_0x49a8('0x61')]['id'];}return db[_0x49a8('0x45')]['find']({'where':{'id':_0x1e1075[_0x49a8('0x5c')]['id']}})[_0x49a8('0x3c')](handleEntityNotFound(_0x393f29,null))[_0x49a8('0x3c')](function(_0x1c0bb2){if(_0x1c0bb2){_0x1e1075[_0x49a8('0x61')][_0x49a8('0x6d')]=_0x1c0bb2['id'];return db[_0x49a8('0x74')][_0x49a8('0x60')](_0x1e1075['body']);}})[_0x49a8('0x3c')](respondWithResult(_0x393f29,null))[_0x49a8('0x2e')](handleError(_0x393f29,null));};exports[_0x49a8('0x75')]=function(_0x3d205a,_0x272d7c,_0x1f3fc7){var _0x1ca0d6={'raw':![],'where':{}};var _0x1b83be={};var _0x519504={'count':0x0,'rows':[]};return db[_0x49a8('0x45')][_0x49a8('0x6f')]({'where':{'id':_0x3d205a[_0x49a8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x272d7c,null))['then'](function(_0x26590f){if(_0x26590f){_0x1b83be[_0x49a8('0x4a')]=_[_0x49a8('0x5d')](db['CannedAnswer']['rawAttributes']);_0x1b83be[_0x49a8('0x4b')]=_[_0x49a8('0x5d')](_0x3d205a[_0x49a8('0x4b')]);_0x1b83be[_0x49a8('0x4c')]=_[_0x49a8('0x4d')](_0x1b83be['model'],_0x1b83be['query']);_0x1ca0d6[_0x49a8('0x4e')]=_[_0x49a8('0x4d')](_0x1b83be['model'],qs[_0x49a8('0x5e')](_0x3d205a['query'][_0x49a8('0x5e')]));_0x1ca0d6['attributes']=_0x1ca0d6[_0x49a8('0x4e')][_0x49a8('0x4f')]?_0x1ca0d6[_0x49a8('0x4e')]:_0x1b83be[_0x49a8('0x4a')];if(!_0x3d205a[_0x49a8('0x4b')]['hasOwnProperty'](_0x49a8('0x70'))){_0x1ca0d6['limit']=qs[_0x49a8('0x35')](_0x3d205a[_0x49a8('0x4b')][_0x49a8('0x35')]);_0x1ca0d6['offset']=qs['offset'](_0x3d205a[_0x49a8('0x4b')][_0x49a8('0x33')]);}_0x1ca0d6[_0x49a8('0x51')]=qs[_0x49a8('0x52')](_0x3d205a['query'][_0x49a8('0x52')]);_0x1ca0d6['where']=qs[_0x49a8('0x4c')](_[_0x49a8('0x54')](_0x3d205a['query'],_0x1b83be[_0x49a8('0x4c')]));_0x1ca0d6['where'][_0x49a8('0x6d')]=_0x26590f['id'];if(_0x3d205a[_0x49a8('0x4b')][_0x49a8('0x55')]){_0x1ca0d6[_0x49a8('0x53')]=_['merge'](_0x1ca0d6[_0x49a8('0x53')],{'$or':_['map'](_0x1ca0d6[_0x49a8('0x4e')],function(_0x7fc8a5){var _0x3f7e29={};_0x3f7e29[_0x7fc8a5]={'$like':'%'+_0x3d205a[_0x49a8('0x4b')]['filter']+'%'};return _0x3f7e29;})});}_0x1ca0d6=_[_0x49a8('0x56')]({},_0x1ca0d6,_0x3d205a[_0x49a8('0x58')]);return db[_0x49a8('0x74')][_0x49a8('0x36')]({'where':_0x1ca0d6['where']})[_0x49a8('0x3c')](function(_0x14c53d){_0x519504[_0x49a8('0x36')]=_0x14c53d;if(_0x3d205a[_0x49a8('0x4b')][_0x49a8('0x59')]){_0x1ca0d6[_0x49a8('0x71')]=[{'all':!![]}];}return db[_0x49a8('0x74')][_0x49a8('0x5a')](_0x1ca0d6);})['then'](function(_0x327b11){_0x519504[_0x49a8('0x72')]=_0x327b11;return _0x519504;});}})[_0x49a8('0x3c')](respondWithFilteredResult(_0x272d7c,_0x1ca0d6))[_0x49a8('0x2e')](handleError(_0x272d7c,null));};exports[_0x49a8('0x76')]=function(_0x39b8a5,_0x594032,_0x1fb062){return db[_0x49a8('0x45')][_0x49a8('0x5f')]({'where':{'id':_0x39b8a5['params']['id']}})[_0x49a8('0x3c')](handleEntityNotFound(_0x594032,null))['then'](function(_0x4a3257){if(_0x4a3257){return _0x4a3257[_0x49a8('0x76')](_0x39b8a5['query'][_0x49a8('0x77')]);}})['then'](respondWithStatusCode(_0x594032,null))['catch'](handleError(_0x594032,null));};exports['addLogo']=function(_0x4c5074,_0x4a2aee,_0x279a20){_0x4c5074['body'][_0x49a8('0x78')]=_0x4c5074[_0x49a8('0x79')][_0x49a8('0x7a')];return db[_0x49a8('0x45')][_0x49a8('0x5f')]({'where':{'id':_0x4c5074['params']['id']}})[_0x49a8('0x3c')](handleEntityNotFound(_0x4a2aee,null))[_0x49a8('0x3c')](saveUpdates(_0x4c5074[_0x49a8('0x61')],null))[_0x49a8('0x3c')](respondWithResult(_0x4a2aee,null))['catch'](handleError(_0x4a2aee,null));};exports['addAvatar']=function(_0x5abbcc,_0x1caeaa,_0x1f7d41){_0x5abbcc[_0x49a8('0x61')]['agentAvatar']=_0x5abbcc[_0x49a8('0x79')][_0x49a8('0x7a')];return db['ChatWebsite'][_0x49a8('0x5f')]({'where':{'id':_0x5abbcc[_0x49a8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1caeaa,null))['then'](saveUpdates(_0x5abbcc[_0x49a8('0x61')],null))[_0x49a8('0x3c')](respondWithResult(_0x1caeaa,null))[_0x49a8('0x2e')](handleError(_0x1caeaa,null));};exports['addCustomerAvatar']=function(_0x1b44c8,_0x2e53d8,_0x25b08f){_0x1b44c8[_0x49a8('0x61')][_0x49a8('0x7b')]=_0x1b44c8[_0x49a8('0x79')][_0x49a8('0x7a')];return db[_0x49a8('0x45')][_0x49a8('0x5f')]({'where':{'id':_0x1b44c8[_0x49a8('0x5c')]['id']}})[_0x49a8('0x3c')](handleEntityNotFound(_0x2e53d8,null))['then'](saveUpdates(_0x1b44c8['body'],null))[_0x49a8('0x3c')](respondWithResult(_0x2e53d8,null))[_0x49a8('0x2e')](handleError(_0x2e53d8,null));};exports['addSystemAvatar']=function(_0x1f8ecf,_0x3bf82f,_0x395a25){_0x1f8ecf['body'][_0x49a8('0x7c')]=_0x1f8ecf[_0x49a8('0x79')][_0x49a8('0x7a')];return db[_0x49a8('0x45')][_0x49a8('0x5f')]({'where':{'id':_0x1f8ecf['params']['id']}})[_0x49a8('0x3c')](handleEntityNotFound(_0x3bf82f,null))[_0x49a8('0x3c')](saveUpdates(_0x1f8ecf[_0x49a8('0x61')],null))['then'](respondWithResult(_0x3bf82f,null))['catch'](handleError(_0x3bf82f,null));};exports[_0x49a8('0x7d')]=function(_0x125618,_0x2511ef,_0x8344ec){var _0x5c0dc4=path[_0x49a8('0x7e')](config[_0x49a8('0x7f')],_0x49a8('0x80'));var _0x4a3c9a={'where':{'id':_0x125618['params']['id']},'attributes':['id',_0x49a8('0x78')],'raw':!![]};var _0x439cd3=![];return require('../../config/license/util')['getLicense']()[_0x49a8('0x3c')](function(_0x8d64f7){if(_0x8d64f7){_0x439cd3=_0x8d64f7[_0x49a8('0x81')];}})[_0x49a8('0x3c')](function(){return db[_0x49a8('0x45')]['find'](_0x4a3c9a);})[_0x49a8('0x3c')](handleEntityNotFound(_0x2511ef,null))[_0x49a8('0x3c')](function(_0x33440d){if(_0x33440d){if(!_[_0x49a8('0x82')](_0x33440d[_0x49a8('0x78')])){if(fs[_0x49a8('0x83')](path['join'](config[_0x49a8('0x7f')],_0x49a8('0x84'),_0x33440d[_0x49a8('0x78')]))&&_0x439cd3){_0x5c0dc4=path[_0x49a8('0x7e')](config['root'],'server/files/images/logos/',_0x33440d[_0x49a8('0x78')]);}}return _0x2511ef['download'](_0x5c0dc4);}})[_0x49a8('0x2e')](handleError(_0x2511ef,null));};exports[_0x49a8('0x85')]=function(_0x2b8b55,_0x5a4512,_0x4ab312){var _0x258809=path[_0x49a8('0x7e')](config[_0x49a8('0x7f')],_0x49a8('0x86'));var _0x4909fb={'where':{'id':_0x2b8b55[_0x49a8('0x5c')]['id']},'attributes':['id',_0x49a8('0x87')],'raw':!![]};return db[_0x49a8('0x45')][_0x49a8('0x5f')](_0x4909fb)[_0x49a8('0x3c')](handleEntityNotFound(_0x5a4512,null))[_0x49a8('0x3c')](function(_0x10bf4c){if(_0x10bf4c){if(!_['isNil'](_0x10bf4c[_0x49a8('0x87')])){if(fs[_0x49a8('0x83')](path[_0x49a8('0x7e')](config[_0x49a8('0x7f')],'server/files/images/avatars/',_0x10bf4c['agentAvatar']))){_0x258809=path['join'](config[_0x49a8('0x7f')],_0x49a8('0x88'),_0x10bf4c[_0x49a8('0x87')]);}}return _0x5a4512['download'](_0x258809);}})[_0x49a8('0x2e')](handleError(_0x5a4512,null));};exports['getCustomerAvatar']=function(_0xf03420,_0x496b6b,_0x1b1c20){var _0x230c27=path['join'](config['root'],_0x49a8('0x89'));var _0x5d9a5d={'where':{'id':_0xf03420[_0x49a8('0x5c')]['id']},'attributes':['id',_0x49a8('0x7b'),_0x49a8('0x8a')],'raw':!![]};return db[_0x49a8('0x45')][_0x49a8('0x5f')](_0x5d9a5d)['then'](handleEntityNotFound(_0x496b6b,null))[_0x49a8('0x3c')](function(_0x2cd626){if(_0x2cd626){if(!_[_0x49a8('0x82')](_0x2cd626[_0x49a8('0x7b')])){if(fs[_0x49a8('0x83')](path['join'](config['root'],_0x49a8('0x88'),_0x2cd626[_0x49a8('0x7b')]))&&_0x2cd626[_0x49a8('0x8a')]){_0x230c27=path['join'](config[_0x49a8('0x7f')],_0x49a8('0x88'),_0x2cd626[_0x49a8('0x7b')]);}}return _0x496b6b[_0x49a8('0x8b')](_0x230c27);}})[_0x49a8('0x2e')](handleError(_0x496b6b,null));};exports[_0x49a8('0x8c')]=function(_0x4b3e01,_0x3f43bd,_0x1e2485){var _0x47a4fc=path[_0x49a8('0x7e')](config[_0x49a8('0x7f')],_0x49a8('0x8d'));var _0x34a3d6={'where':{'id':_0x4b3e01[_0x49a8('0x5c')]['id']},'attributes':['id',_0x49a8('0x7c')],'raw':!![]};return db[_0x49a8('0x45')][_0x49a8('0x5f')](_0x34a3d6)[_0x49a8('0x3c')](handleEntityNotFound(_0x3f43bd,null))['then'](function(_0x45d3f1){if(_0x45d3f1){if(!_[_0x49a8('0x82')](_0x45d3f1[_0x49a8('0x7c')])){if(fs['existsSync'](path[_0x49a8('0x7e')](config[_0x49a8('0x7f')],_0x49a8('0x88'),_0x45d3f1['systemAvatar']))){_0x47a4fc=path['join'](config['root'],_0x49a8('0x88'),_0x45d3f1[_0x49a8('0x7c')]);}}return _0x3f43bd[_0x49a8('0x8b')](_0x47a4fc);}})[_0x49a8('0x2e')](handleError(_0x3f43bd,null));};exports[_0x49a8('0x8e')]=function(_0x516d08,_0x2116a5,_0x20ff62){var _0x3b2a24=require(_0x49a8('0x8f'));var _0x475856=new _0x3b2a24();var _0x1f1d95=_0x475856[_0x49a8('0x90')](_0x516d08['headers'][_0x49a8('0x91')])[_0x49a8('0x92')]();var _0x42517c={'body':_0x516d08[_0x49a8('0x61')],'channel':_0x49a8('0x93')};var _0x37844e=[];var _0xde67d7=[];var _0x58843a={};var _0x94b4c4=![];return db[_0x49a8('0x94')]['describe']()[_0x49a8('0x3c')](function(_0x454f80){if(!_0x454f80){throw new db['Sequelize'][(_0x49a8('0x95'))]('no\x20available\x20attributes');}_0x37844e=_[_0x49a8('0x96')](_[_0x49a8('0x5d')](_0x454f80),[_0x49a8('0x97'),_0x49a8('0x98')]);_0xde67d7=_[_0x49a8('0x96')](_['keys'](_0x454f80),[_0x49a8('0x97'),'updatedAt',_0x49a8('0x99'),'ListId']);if(_0x516d08[_0x49a8('0x61')]['id']){delete _0x516d08[_0x49a8('0x61')]['id'];}if(_[_0x49a8('0x82')](_0x516d08['body'][_0x49a8('0x9a')])){throw new db[(_0x49a8('0x9b'))][(_0x49a8('0x95'))](_0x49a8('0x9c'));}if(_[_0x49a8('0x82')](_0x516d08[_0x49a8('0x61')][_0x49a8('0x61')])||_0x516d08[_0x49a8('0x61')][_0x49a8('0x61')]===''){throw new db['Sequelize'][(_0x49a8('0x95'))](_0x49a8('0x9d'));}if(_[_0x49a8('0x82')](_0x516d08[_0x49a8('0x61')][_0x49a8('0x9e')])){throw new db[(_0x49a8('0x9b'))][(_0x49a8('0x95'))](_0x49a8('0x9f')+_0xde67d7);}if(!_[_0x49a8('0xa0')](_0xde67d7,_0x516d08[_0x49a8('0x61')][_0x49a8('0x9e')])){throw new db['Sequelize'][(_0x49a8('0x95'))](_0x49a8('0xa1')+_0xde67d7);}_0x58843a[_0x516d08['body'][_0x49a8('0x9e')]]=_0x516d08['body'][_0x49a8('0x9a')];})[_0x49a8('0x3c')](function(){return db['ChatWebsite'][_0x49a8('0x5f')]({'where':{'id':_0x516d08['params']['id']},'include':[{'model':db[_0x49a8('0xa2')],'as':_0x49a8('0xa3'),'include':[{'model':db[_0x49a8('0x94')],'as':_0x49a8('0xa4'),'where':_0x58843a,'limit':0x1,'order':[[_0x49a8('0x98'),_0x49a8('0xa5')]]}]},{'model':db['ChatApplication'],'as':_0x49a8('0xa6')}]});})[_0x49a8('0x3c')](handleEntityNotFound(_0x2116a5,null))[_0x49a8('0x3c')](function(_0x5592d0){if(_0x5592d0&&_0x5592d0[_0x49a8('0xa3')]){_0x42517c[_0x49a8('0xa7')]=_0x5592d0;_0x42517c[_0x49a8('0xa8')]=_0x5592d0['Applications'];_0x42517c[_0x49a8('0xa9')]=_0x5592d0[_0x49a8('0xa3')];_0x42517c[_0x49a8('0xa8')]=_['orderBy'](_0x42517c[_0x49a8('0xa8')],[_0x49a8('0xaa')],[_0x49a8('0xab')]);if(_0x42517c[_0x49a8('0xa7')][_0x49a8('0xa6')]){delete _0x42517c[_0x49a8('0xa7')][_0x49a8('0xa6')];}if(_0x42517c[_0x49a8('0xa7')]['List']&&_0x42517c[_0x49a8('0xa7')][_0x49a8('0xa3')]['Contacts'][_0x49a8('0x4f')]){return _0x42517c['account'][_0x49a8('0xa3')][_0x49a8('0xa4')][0x0];}var _0x1fd959=_['defaults'](_0x516d08['body'],{'firstName':_0x516d08[_0x49a8('0x61')]['from'],'ListId':_0x5592d0[_0x49a8('0xac')]});_0x1fd959[_0x516d08['body']['mapKey']]=_0x516d08[_0x49a8('0x61')]['from'];return db[_0x49a8('0x94')][_0x49a8('0x60')](_0x1fd959,{'fields':_0x37844e,'raw':!![]});}})[_0x49a8('0x3c')](handleEntityNotFound(_0x2116a5,null))[_0x49a8('0x3c')](function(_0x4609a6){_0x42517c['contact']=_0x4609a6;var _0x35a7a2=_0x516d08[_0x49a8('0x61')][_0x49a8('0xad')];if(_0x516d08['headers']['cf-connecting-ip']){_0x35a7a2=_0x516d08[_0x49a8('0xae')][_0x49a8('0xaf')];}else if(_0x516d08[_0x49a8('0xae')]['x-forwarded-for']){_0x35a7a2=_['first'](_0x516d08[_0x49a8('0xae')][_0x49a8('0xb0')][_0x49a8('0xb1')](','));}if(_0x4609a6){var _0x105594={'ContactId':_0x4609a6['id'],'ChatWebsiteId':_0x516d08[_0x49a8('0x5c')]['id'],'from':(_0x4609a6[_0x49a8('0xb2')]||'')+'\x20'+(_0x4609a6['lastName']||''),'customerIp':_0x35a7a2,'customerPort':_0x516d08[_0x49a8('0xae')][_0x49a8('0xb3')]?_0x516d08['headers']['x-real-port']:null,'referer':_0x516d08[_0x49a8('0x61')][_0x49a8('0xb4')],'browserName':_0x1f1d95['browser'][_0x49a8('0x40')]&&_0x1f1d95['browser'][_0x49a8('0xb5')]?util[_0x49a8('0xb6')](_0x49a8('0xb7'),_0x1f1d95[_0x49a8('0xb8')][_0x49a8('0x40')],_0x1f1d95['browser']['version']):'unknown','browserVersion':_0x1f1d95[_0x49a8('0xb8')]['version']||_0x49a8('0xb9'),'osName':util['format']('%s\x20%s',_0x1f1d95['os'][_0x49a8('0x40')],_0x1f1d95['os'][_0x49a8('0xb5')]),'osVersion':_0x1f1d95['os'][_0x49a8('0xb5')],'deviceModel':_0x1f1d95[_0x49a8('0xba')][_0x49a8('0x4a')]&&_0x1f1d95['device'][_0x49a8('0xbb')]?util[_0x49a8('0xb6')](_0x49a8('0xbc'),_0x1f1d95[_0x49a8('0xba')][_0x49a8('0x4a')],_0x1f1d95[_0x49a8('0xba')][_0x49a8('0xbb')],_0x1f1d95['device']['type']):null,'deviceVendor':_0x1f1d95[_0x49a8('0xba')][_0x49a8('0xbb')],'deviceType':_0x1f1d95['device'][_0x49a8('0x48')],'formData':JSON[_0x49a8('0x29')](_0x516d08[_0x49a8('0x61')])};var _0x3700f0={'ChatWebsiteId':_0x516d08[_0x49a8('0x5c')]['id'],'closed':![]};if(_0x516d08[_0x49a8('0x61')]['threadId']){_0x3700f0[_0x49a8('0xbd')]=_0x516d08[_0x49a8('0x61')][_0x49a8('0xbd')];return db[_0x49a8('0xbe')][_0x49a8('0x5f')]({'where':_0x3700f0})[_0x49a8('0x3c')](function(_0x5db8b4){if(_0x5db8b4){return[_0x5db8b4,![]];}_0x105594[_0x49a8('0xbd')]=_0x516d08[_0x49a8('0x61')][_0x49a8('0xbd')];_0x105594['externalUrl']=_0x516d08[_0x49a8('0x61')][_0x49a8('0xbf')];return db[_0x49a8('0xbe')][_0x49a8('0x60')](_0x105594)[_0x49a8('0x3c')](function(_0x12c03f){return[_0x12c03f,!![]];});});}_0x3700f0['ContactId']=_0x4609a6['id'];if(_0x516d08[_0x49a8('0x61')][_0x49a8('0xc0')]&&_0x516d08[_0x49a8('0x61')][_0x49a8('0xc0')]['id']){_0x3700f0['id']=_0x516d08[_0x49a8('0x61')]['interaction']['id'];return db[_0x49a8('0xbe')][_0x49a8('0x5f')]({'where':_0x3700f0})[_0x49a8('0x3c')](function(_0x506e77){if(_0x506e77){return[_0x506e77,![]];}return db[_0x49a8('0xbe')][_0x49a8('0x60')](_0x105594)[_0x49a8('0x3c')](function(_0x460eb1){return[_0x460eb1,!![]];});});}return db['ChatInteraction']['create'](_0x105594)[_0x49a8('0x3c')](function(_0x417910){return[_0x417910,!![]];});}})[_0x49a8('0xc1')](function(_0x3a922c,_0x15ed6a){if(_0x3a922c){_0x94b4c4=_0x15ed6a;if(!_0x15ed6a){var _0x2b821a={'from':(_0x42517c[_0x49a8('0xc2')][_0x49a8('0xb2')]||'')+'\x20'+(_0x42517c[_0x49a8('0xc2')][_0x49a8('0xc3')]||'')};if(_0x516d08[_0x49a8('0x61')][_0x49a8('0xbd')]&&_0x516d08[_0x49a8('0x61')][_0x49a8('0xc4')]&&_0x516d08[_0x49a8('0x61')][_0x49a8('0xbd')]!=_0x516d08[_0x49a8('0x61')][_0x49a8('0xc4')]){_0x2b821a[_0x49a8('0xbd')]=_0x516d08[_0x49a8('0x61')]['messageId'];}return _0x3a922c['update'](_0x2b821a);}else{return _0x3a922c;}}})[_0x49a8('0x3c')](function(_0x5c4bb0){_0x42517c[_0x49a8('0xc0')]=_0x5c4bb0[_0x49a8('0x65')]({'plain':!![]});_0x42517c[_0x49a8('0xc0')][_0x49a8('0xc5')]=_0x94b4c4;if(_0x42517c[_0x49a8('0xc0')][_0x49a8('0xc5')]){if(_0x42517c[_0x49a8('0xa7')][_0x49a8('0xc6')]){_0x42517c[_0x49a8('0xa8')][_0x49a8('0xc7')]({'id':0x0,'priority':_0x42517c[_0x49a8('0xa8')][_0x49a8('0x4f')]+0x1,'app':_0x49a8('0xc8'),'appdata':'unmanaged','interval':_0x49a8('0xc9')});}}return db[_0x49a8('0xca')]['create']({'body':_0x516d08[_0x49a8('0x61')][_0x49a8('0x61')],'ChatWebsiteId':_0x516d08[_0x49a8('0x5c')]['id'],'ChatInteractionId':_0x5c4bb0['id'],'direction':'in','ContactId':_0x42517c[_0x49a8('0xc2')]['id'],'AttachmentId':_0x516d08[_0x49a8('0x61')]['AttachmentId']});})['then'](function(_0xacdbc6){_0x42517c[_0x49a8('0x2c')]=_0xacdbc6;if(_0x42517c['interaction'][_0x49a8('0xcb')]){return db[_0x49a8('0xcc')]['find']({'attributes':['id',_0x49a8('0x40')],'where':{'id':_0x42517c[_0x49a8('0xc0')][_0x49a8('0xcb')]}})['then'](function(_0x364f7d){if(_0x364f7d){_0x42517c[_0x49a8('0xa8')]['unshift']({'id':0x0,'priority':0x0,'app':_0x49a8('0xcd'),'appdata':_0x364f7d[_0x49a8('0x40')]+','+(_0x42517c[_0x49a8('0xa7')][_0x49a8('0xce')]||0xa),'interval':_0x49a8('0xc9')});_0x42517c['forcedOwnership']=!![];}return respondWithRpcPromise(_0x49a8('0xcf'),'startRouting',_0x42517c);});}return respondWithRpcPromise(_0x49a8('0xcf'),_0x49a8('0xd0'),_0x42517c);})[_0x49a8('0x3c')](function(_0x557f8d){respondWithRpcPromise(_0x49a8('0xd1'),'EventManager',{'event':_0x49a8('0x8e'),'message':_0x557f8d},client9002);return _0x557f8d;})[_0x49a8('0x3c')](respondWithResult(_0x2116a5,null))['catch'](handleError(_0x2116a5,null));};exports[_0x49a8('0xd2')]=function(_0x1f3141,_0x133c1c,_0x15f1d9){var _0x5e8b38,_0x1c4d96,_0xa17093;var _0x57dec9=[];var _0x51a3a8=[];var _0x2ce14f={};var _0x1c4796=_0x1f3141[_0x49a8('0xd3')]||[];var _0x4a8210=[];var _0x2dfd3e;return db[_0x49a8('0x94')][_0x49a8('0x6b')]()[_0x49a8('0x3c')](function(_0x275b59){if(!_0x275b59){throw new db[(_0x49a8('0x9b'))][(_0x49a8('0x95'))](_0x49a8('0xd4'));}_0x51a3a8=_['difference'](_[_0x49a8('0x5d')](_0x275b59),['createdAt',_0x49a8('0x98')]);_0x57dec9=_[_0x49a8('0x96')](_[_0x49a8('0x5d')](_0x275b59),[_0x49a8('0x97'),_0x49a8('0x98'),_0x49a8('0x99'),_0x49a8('0xac')]);if(_0x1f3141[_0x49a8('0x61')]['id']){delete _0x1f3141['body']['id'];}if(_[_0x49a8('0x82')](_0x1f3141[_0x49a8('0x61')][_0x49a8('0x9a')])){throw _0x133c1c[_0x49a8('0x30')](0x1f4)[_0x49a8('0x41')](new db[(_0x49a8('0x9b'))]['ValidationError'](_0x49a8('0x9c')));}if(_[_0x49a8('0x82')](_0x1f3141['body'][_0x49a8('0x61')])||_0x1f3141[_0x49a8('0x61')][_0x49a8('0x61')]===''){throw _0x133c1c[_0x49a8('0x30')](0x1f4)[_0x49a8('0x41')](new db['Sequelize'][(_0x49a8('0x95'))](_0x49a8('0x9d')));}if(_['isNil'](_0x1f3141[_0x49a8('0x61')]['mapKeyOffline'])){throw _0x133c1c['status'](0x1f4)[_0x49a8('0x41')](new db[(_0x49a8('0x9b'))][(_0x49a8('0x95'))](_0x49a8('0xd5')+_0x57dec9));}if(!_[_0x49a8('0xa0')](_0x57dec9,_0x1f3141[_0x49a8('0x61')]['mapKeyOffline'])){throw _0x133c1c[_0x49a8('0x30')](0x1f4)[_0x49a8('0x41')](new db['Sequelize'][(_0x49a8('0x95'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x57dec9));}_0x2ce14f[_0x1f3141[_0x49a8('0x61')][_0x49a8('0xd6')]]=_0x1f3141[_0x49a8('0x61')][_0x49a8('0x9a')];})[_0x49a8('0x3c')](function(){return db[_0x49a8('0x45')]['find']({'where':{'id':_0x1f3141[_0x49a8('0x5c')]['id']},'include':[{'model':db[_0x49a8('0xa2')],'as':_0x49a8('0xa3')},{'model':db[_0x49a8('0xd7')],'as':_0x49a8('0xd7')}]});})[_0x49a8('0x3c')](handleEntityNotFound(_0x133c1c,null))['then'](function(_0x22a405){if(_0x22a405&&_0x22a405[_0x49a8('0xa3')]){_0x1c4d96=_0x22a405;var _0x4be58e=_[_0x49a8('0x1d')](_0x1f3141[_0x49a8('0x61')],{'firstName':_0x1f3141[_0x49a8('0x61')][_0x49a8('0x9a')],'phone':_0x1f3141[_0x49a8('0x61')][_0x49a8('0x9a')],'ListId':_0x22a405[_0x49a8('0xac')]});_0x4be58e[_0x1f3141[_0x49a8('0x61')][_0x49a8('0xd6')]]=_0x1f3141[_0x49a8('0x61')][_0x49a8('0x9a')];return db['CmContact']['findOrCreate']({'where':_0x2ce14f,'defaults':_0x4be58e});}})[_0x49a8('0xc1')](function(_0x2c8911){if(_0x2c8911){_0xa17093=_0x2c8911;var _0x2ca782=fs[_0x49a8('0xd8')](path['join'](config['root'],_0x49a8('0xd9')),_0x49a8('0xda'));var _0x128da5=ejs[_0x49a8('0xdb')](_0x2ca782,{'body':_[_0x49a8('0xdc')](_0x1f3141[_0x49a8('0x61')]['body']),'bodyTitle':_0x1c4d96['offlineMessageBody']});return db[_0x49a8('0xdd')][_0x49a8('0x60')]({'body':_0x128da5,'ContactId':_0x2c8911['id'],'ChatWebsiteId':_0x1c4d96['id']});}})[_0x49a8('0x3c')](function(_0x4e6b0d){_0x2dfd3e=_0x4e6b0d;if(_0x1c4796[_0x49a8('0x4f')]){var _0xe367aa=_0x1c4796[_0x49a8('0x44')](function(_0x11ce85){return{'name':_0x11ce85[_0x49a8('0xde')],'basename':_0x11ce85[_0x49a8('0x7a')],'type':_0x11ce85['mimetype'],'ChatOfflineMessageId':_0x4e6b0d['id']};});_0x4a8210=_0xe367aa[_0x49a8('0x44')](_0x54253b=>{var _0x2507ca={'filename':_0x54253b['name'],'path':path[_0x49a8('0x7e')](config['root'],'server',_0x49a8('0xd3'),_0x49a8('0xdf'),'offline-chat',_0x54253b[_0x49a8('0xe0')])};return _0x2507ca;});if(!_0x1c4d96[_0x49a8('0xe1')]){return db[_0x49a8('0xe2')][_0x49a8('0xe3')](function(_0x24363d){return db[_0x49a8('0xe4')][_0x49a8('0xe5')](_0xe367aa,{'transaction':_0x24363d});});}}})['then'](function(){if(_0x2dfd3e){_0x5e8b38=_0x2dfd3e;return db[_0x49a8('0xd7')][_0x49a8('0x6f')]({'where':{'active':!![]},'include':[{'model':db[_0x49a8('0xe6')],'as':_0x49a8('0xe7'),'raw':!![]}]});}})[_0x49a8('0x3c')](function(_0x23cbc0){if(_0x23cbc0&&_0x23cbc0[_0x49a8('0xe7')]&&_0x1c4d96[_0x49a8('0xe8')]&&_0x1c4d96[_0x49a8('0xe9')]){var _0x14d740={'tls':{'rejectUnauthorized':![]}};if(_0x23cbc0['Smtp'][_0x49a8('0xea')]){_0x14d740[_0x49a8('0xea')]=_0x23cbc0[_0x49a8('0xe7')][_0x49a8('0xea')];}else{_0x14d740[_0x49a8('0xeb')]=_0x23cbc0[_0x49a8('0xe7')][_0x49a8('0xeb')];_0x14d740['port']=_0x23cbc0[_0x49a8('0xe7')]['port'];_0x14d740['secure']=_0x23cbc0[_0x49a8('0xe7')]['secure'];}if(_0x23cbc0['Smtp'][_0x49a8('0xec')]){_0x14d740[_0x49a8('0xed')]={'user':_0x23cbc0[_0x49a8('0xe7')]['user'],'pass':_0x23cbc0['Smtp'][_0x49a8('0xee')]};}return respondWithRpcPromise(_0x49a8('0xef'),_0x49a8('0xf0'),{'account':_0x14d740,'message':{'from':util[_0x49a8('0xb6')]('\x22%s\x22\x20<%s>',_0x23cbc0[_0x49a8('0x40')],_0x23cbc0['email']||_0x23cbc0['Smtp']['user']),'to':_0x1c4d96[_0x49a8('0xe9')],'subject':_0x1c4d96['offlineMessageSubject'],'html':_0x5e8b38['body'],'attachments':_0x4a8210}},client9003)['then'](function(){return _0x5e8b38;})[_0x49a8('0x2e')](function(_0x43bf25){console[_0x49a8('0x2b')](_0x43bf25);});}})['then'](function(){if(_0x1c4d96&&_0x1c4d96[_0x49a8('0xe1')]&&_0x1c4d96[_0x49a8('0xf1')]){var _0xa8470a=[];if(_0x1c4796[_0x49a8('0x4f')]){_0xa8470a=_0x1c4796[_0x49a8('0x44')](function(_0x2d026e){return{'name':_0x2d026e['originalname'],'basename':_0x2d026e[_0x49a8('0x7a')],'type':_0x2d026e['mimetype'],'ChatOfflineMessageId':_0x2dfd3e['id']};});}var _0x414054;if(!_[_0x49a8('0x82')](_0x1c4d96[_0x49a8('0xf2')])){var _0x47f037=_[_0x49a8('0x44')](_0x1f3141[_0x49a8('0x61')],function(_0x34e610){return _0x34e610;});var _0x4a04f7=_[_0x49a8('0xf3')](_0x47f037)[0x0];var _0x1b0d75=_[_0x49a8('0xf4')](_0x4a04f7,function(_0x4cbc56){return _0x4cbc56;});_0x414054=_0x1b0d75[0x1][_0x1c4d96[_0x49a8('0xf2')]];}var _0x454dbd={'from':_0xa17093[_0x49a8('0xf5')],'firstName':_0xa17093['firstName'],'lastName':_0xa17093['lastName'],'mapKey':'email','message':{'from':_0xa17093[_0x49a8('0xf5')],'to':_0x1c4d96[_0x49a8('0xd7')][_0x49a8('0xf5')],'cc':'','subject':_[_0x49a8('0x82')](_0x414054)?_0x1c4d96[_0x49a8('0xf6')]:_0x414054,'messageId':'','sentAt':new Date(),'attach':_0xa8470a[_0x49a8('0x4f')],'attachments':_0xa8470a,'originChannel':_0x49a8('0xf7'),'ChatWebsiteId':_0x1c4d96['id'],'ChatOfflineMessageId':_0x5e8b38['id'],'originTo':_0x1c4d96['MailAccount']['email']},'body':_0x5e8b38[_0x49a8('0x61')]};var _0x575c55={'account':{'id':_0x1c4d96['MailAccountId']},'body':_0x454dbd,'log':_0x49a8('0xf8')};return respondWithRpcPromise(_0x49a8('0xf8'),_0x49a8('0xf9'),_0x575c55,client9001)[_0x49a8('0x3c')](function(){return _0x5e8b38;})['catch'](function(_0x33024c){console[_0x49a8('0x2b')](_0x33024c);});}return;})['then'](function(){if(_0x5e8b38){return _0x5e8b38;}})[_0x49a8('0x3c')](respondWithResult(_0x133c1c,null))[_0x49a8('0x2e')](function(_0x28418d){console[_0x49a8('0x2b')]('catch',_0x28418d);for(var _0x5a2268 of _0x1c4796){var _0x494e3c=path['join'](config[_0x49a8('0x7f')],_0x49a8('0xfa'),_0x49a8('0xd3'),'attachments','offline-chat',_0x5a2268[_0x49a8('0x7a')]);fs_extra[_0x49a8('0xfb')](_0x494e3c)[_0x49a8('0x2e')](function(_0x339abb){console[_0x49a8('0x2b')](_0x49a8('0xfc'),_0x494e3c,_0x339abb);});}});};exports[_0x49a8('0xfd')]=function(_0x288267,_0x3417fc,_0x5a1c28){return db[_0x49a8('0xbe')][_0x49a8('0x5f')]({'where':{'id':_0x288267[_0x49a8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3417fc,null))[_0x49a8('0x3c')](function(_0x13d5ea){if(_0x13d5ea){return _0x13d5ea[_0x49a8('0xfd')](_0x288267[_0x49a8('0x61')][_0x49a8('0x77')],_[_0x49a8('0xfe')](_0x288267[_0x49a8('0x61')],[_0x49a8('0x77'),'id'])||{});}})[_0x49a8('0x3c')](respondWithResult(_0x3417fc,null))[_0x49a8('0x2e')](handleError(_0x3417fc,null));};exports['getInteractions']=function(_0x2435f6,_0x3d43cd,_0x478b7d){var _0x3b433e={'raw':![],'where':{}};var _0x2ce5b3={};var _0x39abab={'count':0x0,'rows':[]};return db[_0x49a8('0x45')]['findOne']({'where':{'id':_0x2435f6[_0x49a8('0x5c')]['id']}})[_0x49a8('0x3c')](handleEntityNotFound(_0x3d43cd,null))[_0x49a8('0x3c')](function(_0x4ea774){if(_0x4ea774){_0x2ce5b3['model']=_[_0x49a8('0x5d')](db[_0x49a8('0xbe')][_0x49a8('0x46')]);_0x2ce5b3[_0x49a8('0x4b')]=_[_0x49a8('0x5d')](_0x2435f6[_0x49a8('0x4b')]);_0x2ce5b3['filters']=_[_0x49a8('0x4d')](_0x2ce5b3['model'],_0x2ce5b3[_0x49a8('0x4b')]);_0x3b433e[_0x49a8('0x4e')]=_[_0x49a8('0x4d')](_0x2ce5b3['model'],qs[_0x49a8('0x5e')](_0x2435f6['query'][_0x49a8('0x5e')]));_0x3b433e['attributes']=_0x3b433e[_0x49a8('0x4e')]['length']?_0x3b433e[_0x49a8('0x4e')]:_0x2ce5b3['model'];if(!_0x2435f6[_0x49a8('0x4b')]['hasOwnProperty'](_0x49a8('0x70'))){_0x3b433e[_0x49a8('0x35')]=qs[_0x49a8('0x35')](_0x2435f6[_0x49a8('0x4b')][_0x49a8('0x35')]);_0x3b433e[_0x49a8('0x33')]=qs[_0x49a8('0x33')](_0x2435f6[_0x49a8('0x4b')]['offset']);}_0x3b433e[_0x49a8('0x51')]=qs[_0x49a8('0x52')](_0x2435f6[_0x49a8('0x4b')]['sort']);_0x3b433e['where']=qs['filters'](_['pick'](_0x2435f6[_0x49a8('0x4b')],_0x2ce5b3['filters']));_0x3b433e[_0x49a8('0x53')]['ChatWebsiteId']=_0x4ea774['id'];if(_0x2435f6['query']['filter']){_0x3b433e[_0x49a8('0x53')]=_[_0x49a8('0x56')](_0x3b433e[_0x49a8('0x53')],{'$or':_[_0x49a8('0x44')](_0x3b433e[_0x49a8('0x4e')],function(_0x26107c){var _0x22ca6f={};_0x22ca6f[_0x26107c]={'$like':'%'+_0x2435f6[_0x49a8('0x4b')]['filter']+'%'};return _0x22ca6f;})});}_0x3b433e=_[_0x49a8('0x56')]({},_0x3b433e,_0x2435f6[_0x49a8('0x58')]);return db['ChatInteraction'][_0x49a8('0x36')]({'where':_0x3b433e[_0x49a8('0x53')]})[_0x49a8('0x3c')](function(_0x55c156){_0x39abab[_0x49a8('0x36')]=_0x55c156;if(_0x2435f6[_0x49a8('0x4b')][_0x49a8('0x59')]){_0x3b433e[_0x49a8('0x71')]=[{'model':db[_0x49a8('0x94')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x49a8('0xff'),'attributes':[_0x49a8('0x40'),_0x49a8('0x100'),_0x49a8('0x101')],'required':![]},{'model':db[_0x49a8('0x102')],'as':_0x49a8('0x103'),'attributes':['id',_0x49a8('0x40'),_0x49a8('0x104')],'where':_0x2435f6[_0x49a8('0x4b')][_0x49a8('0x105')]?{'id':_0x2435f6[_0x49a8('0x4b')]['tag']}:undefined,'required':_0x2435f6[_0x49a8('0x4b')][_0x49a8('0x105')]?!![]:![]}];}return db[_0x49a8('0xbe')][_0x49a8('0x5a')](_0x3b433e);})[_0x49a8('0x3c')](function(_0x3622e2){_0x39abab[_0x49a8('0x72')]=_0x3622e2;return _0x39abab;});}})[_0x49a8('0x3c')](respondWithFilteredResult(_0x3d43cd,_0x3b433e))[_0x49a8('0x2e')](handleError(_0x3d43cd,null));};function iftimePromise(_0x492ba9,_0x4ff8ac){return respondWithRpcPromise(_0x49a8('0x106'),_0x49a8('0x107'),{'command':_0x4ff8ac[_0x49a8('0x108')]?util[_0x49a8('0xb6')](_0x49a8('0x109'),_0x492ba9[_0x49a8('0x10a')],_0x4ff8ac['timezone']):util[_0x49a8('0xb6')](_0x49a8('0x10b'),_0x492ba9[_0x49a8('0x10a')])},client9002)[_0x49a8('0x3c')](function(_0x55add4){var _0x1d858c=_0x55add4&&_0x55add4[_0x49a8('0x10c')](_0x49a8('0x10d'))>=0x0?!![]:![];logger['info'](_0x49a8('0x10e'),_0x4ff8ac['id'],_0x492ba9['id'],_0x492ba9[_0x49a8('0x10a')],_0x1d858c?_0x49a8('0x10f'):_0x49a8('0x110'),_0x4ff8ac[_0x49a8('0x108')]?_0x4ff8ac['timezone']:'No\x20timezone');return _0x1d858c;})['catch'](function(_0x2b6e67){logger[_0x49a8('0x2b')](_0x49a8('0x10e'),_0x4ff8ac['id'],_0x492ba9['id'],_0x492ba9[_0x49a8('0x10a')],util['inspect'](_0x2b6e67,{'showHidden':![],'depth':null}),_0x4ff8ac[_0x49a8('0x108')]?_0x4ff8ac[_0x49a8('0x108')]:_0x49a8('0x111'));return![];});}exports['getSnippet']=function(_0x769223,_0x15c6c6,_0x1023ef){var _0x3ce0c4=0x0;var _0x30d43c=0x0;var _0x435457=![];var _0x12259b;var _0x881699;return db['ChatWebsite']['find']({'where':{'id':_0x769223[_0x49a8('0x5c')]['id']},'include':[{'model':db[_0x49a8('0x112')],'as':_0x49a8('0x112'),'include':[{'model':db['Interval'],'as':_0x49a8('0x113'),'attributes':['id',_0x49a8('0x10a')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x15c6c6,null))[_0x49a8('0x3c')](function(_0x2d7755){if(_0x2d7755){_0x12259b=_0x2d7755;return _0x2d7755[_0x49a8('0x114')]({'raw':!![]});}})[_0x49a8('0x3c')](function(_0x495ac4){if(_0x12259b){if(_0x495ac4){_0x881699=_0x495ac4;}}return require(_0x49a8('0x1a'))['getLicense']();})[_0x49a8('0x3c')](function(_0x41a2fa){if(_0x41a2fa){_0x30d43c=_0x41a2fa[_0x49a8('0x115')];_0x435457=_0x41a2fa['custom'];}})['then'](function(){return db['ChatInteraction'][_0x49a8('0x36')]({'where':{'closed':![]}});})[_0x49a8('0x3c')](function(_0x578aa8){_0x3ce0c4=_0x578aa8;if(_0x30d43c&&_0x578aa8>_0x30d43c){return db[_0x49a8('0x116')][_0x49a8('0x6f')]({'where':{'id':0x1}})[_0x49a8('0x3c')](function(_0x1c8dba){if(_0x1c8dba){_0x1c8dba['increment'](_0x49a8('0x117'));}});}})[_0x49a8('0x3c')](function(){if(_0x12259b[_0x49a8('0x112')]&&_0x12259b['Interval']['Intervals']){var _0x1d6d87=[];for(var _0x222ec8=0x0;_0x222ec8<_0x12259b['Interval'][_0x49a8('0x113')][_0x49a8('0x4f')];_0x222ec8++){var _0x4b4b73=_0x12259b[_0x49a8('0x112')][_0x49a8('0x113')][_0x222ec8][_0x49a8('0x65')]({'plain':!![]});_0x1d6d87[_0x49a8('0xc7')](iftimePromise(_0x4b4b73,_0x12259b));}return BPromise['all'](_0x1d6d87)['then'](function(_0x12f5bd){return _['some'](_0x12f5bd);});}else{return!![];}})[_0x49a8('0x3c')](function(_0x22f60c){var _0xab5398=fs[_0x49a8('0xd8')](path['join'](config[_0x49a8('0x7f')],_0x49a8('0x118')),_0x49a8('0xda'));var _0x156bfa={'remote':_0x12259b[_0x49a8('0x119')],'query':querystring[_0x49a8('0x29')](_[_0x49a8('0x56')](_0x12259b['get']({'plain':!![]}),{'customerIp':_0x769223[_0x49a8('0xae')][_0x49a8('0xb0')]||_0x769223[_0x49a8('0xae')][_0x49a8('0x11a')]||_0x769223[_0x49a8('0x11b')][_0x49a8('0x11c')]||_0x769223['ip'],'referer':_0x769223[_0x49a8('0xae')][_0x49a8('0xb4')],'openedInteractions':_0x3ce0c4,'maxInteractions':_0x30d43c,'virtual':_0x435457[_0x49a8('0x115')],'online':_0x22f60c,'custom':_0x435457}))['replace'](/'/g,'\x5c\x27')};_0x15c6c6[_0x49a8('0x41')](ejs['render'](Mustache['render'](_0xab5398,_0x156bfa),{'proactiveActions':_0x881699,'alignment':_0x12259b[_0x49a8('0x11d')],'verticalAlignment':_0x12259b[_0x49a8('0x11e')],'div_color':_0x12259b[_0x49a8('0x104')],'text_color':_0x12259b[_0x49a8('0x11f')],'button_color':_0x12259b[_0x49a8('0x120')],'background_color':_0x12259b['backgroundColor']}));})[_0x49a8('0x2e')](handleError(_0x15c6c6,null));};exports['addApplications']=function(_0x2ae661,_0x305231,_0x1585cd){return db[_0x49a8('0x45')][_0x49a8('0x6f')]({'where':{'id':_0x2ae661[_0x49a8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x305231,null))['then'](function(_0x3c3158){if(_0x3c3158){return db['sequelize'][_0x49a8('0xe3')](function(_0x527d18){return db[_0x49a8('0x121')]['destroy']({'where':{'ChatWebsiteId':_0x2ae661[_0x49a8('0x5c')]['id']},'transaction':_0x527d18})[_0x49a8('0x3c')](function(_0x270350){var _0x5eb9c1=_[_0x49a8('0x44')](_0x2ae661[_0x49a8('0x61')],function(_0x2bd9bd){_0x2bd9bd[_0x49a8('0x6d')]=_0x2ae661[_0x49a8('0x5c')]['id'];return _0x2bd9bd;});return db[_0x49a8('0x121')]['bulkCreate'](_0x5eb9c1,{'transaction':_0x527d18});});})[_0x49a8('0x3c')](function(){return db['ChatApplication'][_0x49a8('0x122')]({'where':{'ChatWebsiteId':_0x2ae661['params']['id']},'order':'priority'});});}})[_0x49a8('0x3c')](respondWithResult(_0x305231,null))[_0x49a8('0x2e')](handleError(_0x305231,null));};exports[_0x49a8('0x123')]=function(_0x39d714,_0x413617,_0x3fba77){var _0x20acdf={};var _0x38f140={};var _0x32df2f;var _0x1b8b72;return db['ChatWebsite'][_0x49a8('0x6f')]({'where':{'id':_0x39d714['params']['id']}})[_0x49a8('0x3c')](handleEntityNotFound(_0x413617,null))['then'](function(_0x365c7e){if(_0x365c7e){_0x32df2f=_0x365c7e;_0x38f140['model']=_[_0x49a8('0x5d')](db[_0x49a8('0x121')]['rawAttributes']);_0x38f140[_0x49a8('0x4b')]=_[_0x49a8('0x5d')](_0x39d714[_0x49a8('0x4b')]);_0x38f140[_0x49a8('0x4c')]=_[_0x49a8('0x4d')](_0x38f140['model'],_0x38f140[_0x49a8('0x4b')]);_0x20acdf[_0x49a8('0x4e')]=_[_0x49a8('0x4d')](_0x38f140[_0x49a8('0x4a')],qs[_0x49a8('0x5e')](_0x39d714[_0x49a8('0x4b')]['fields']));_0x20acdf[_0x49a8('0x4e')]=_0x20acdf[_0x49a8('0x4e')][_0x49a8('0x4f')]?_0x20acdf[_0x49a8('0x4e')]:_0x38f140[_0x49a8('0x4a')];_0x20acdf[_0x49a8('0x51')]=qs[_0x49a8('0x52')](_0x39d714[_0x49a8('0x4b')][_0x49a8('0x52')]);_0x20acdf[_0x49a8('0x53')]=qs[_0x49a8('0x4c')](_[_0x49a8('0x54')](_0x39d714['query'],_0x38f140['filters']));if(_0x39d714['query'][_0x49a8('0x55')]){_0x20acdf['where']=_['merge'](_0x20acdf['where'],{'$or':_[_0x49a8('0x44')](_0x20acdf[_0x49a8('0x4e')],function(_0x5efe47){var _0x1ef1b3={};_0x1ef1b3[_0x5efe47]={'$like':'%'+_0x39d714[_0x49a8('0x4b')][_0x49a8('0x55')]+'%'};return _0x1ef1b3;})});}_0x20acdf=_[_0x49a8('0x56')]({},_0x20acdf,_0x39d714[_0x49a8('0x58')]);return _0x32df2f['getApplications'](_0x20acdf);}})[_0x49a8('0x3c')](function(_0x3616c4){if(_0x3616c4){_0x1b8b72=_0x3616c4[_0x49a8('0x4f')];if(!_0x39d714[_0x49a8('0x4b')][_0x49a8('0x50')](_0x49a8('0x70'))){_0x20acdf[_0x49a8('0x35')]=qs[_0x49a8('0x35')](_0x39d714[_0x49a8('0x4b')]['limit']);_0x20acdf[_0x49a8('0x33')]=qs[_0x49a8('0x33')](_0x39d714['query'][_0x49a8('0x33')]);}return _0x32df2f['getApplications'](_0x20acdf);}})[_0x49a8('0x3c')](function(_0x3b1e87){if(_0x3b1e87){return _0x3b1e87?{'count':_0x1b8b72,'rows':_0x3b1e87}:null;}})['then'](respondWithResult(_0x413617,null))[_0x49a8('0x2e')](handleError(_0x413617,null));};exports[_0x49a8('0x124')]=function(_0x7c915e,_0x500d5c,_0x486198){return db[_0x49a8('0x125')][_0x49a8('0x5f')]({'where':{'id':_0x7c915e[_0x49a8('0x5c')]['id']}})[_0x49a8('0x3c')](handleEntityNotFound(_0x500d5c,null))[_0x49a8('0x3c')](function(_0x139893){if(_0x139893){return _0x139893[_0x49a8('0x124')](_0x7c915e[_0x49a8('0x61')]['ids'],_['omit'](_0x7c915e[_0x49a8('0x61')],[_0x49a8('0x77'),'id'])||{});}})['then'](respondWithResult(_0x500d5c,null))[_0x49a8('0x2e')](handleError(_0x500d5c,null));};exports['getProactiveActions']=function(_0x3a5a57,_0xa07a5d,_0x68cc68){var _0x20ce64={};var _0x12d0f2={};var _0x173424;var _0xcaeac2;return db['ChatWebsite']['findOne']({'where':{'id':_0x3a5a57['params']['id']}})[_0x49a8('0x3c')](handleEntityNotFound(_0xa07a5d,null))[_0x49a8('0x3c')](function(_0x49699e){if(_0x49699e){_0x173424=_0x49699e;_0x12d0f2['model']=_[_0x49a8('0x5d')](db[_0x49a8('0x126')][_0x49a8('0x46')]);_0x12d0f2[_0x49a8('0x4b')]=_[_0x49a8('0x5d')](_0x3a5a57[_0x49a8('0x4b')]);_0x12d0f2[_0x49a8('0x4c')]=_[_0x49a8('0x4d')](_0x12d0f2['model'],_0x12d0f2[_0x49a8('0x4b')]);_0x20ce64[_0x49a8('0x4e')]=_[_0x49a8('0x4d')](_0x12d0f2[_0x49a8('0x4a')],qs[_0x49a8('0x5e')](_0x3a5a57[_0x49a8('0x4b')][_0x49a8('0x5e')]));_0x20ce64[_0x49a8('0x4e')]=_0x20ce64[_0x49a8('0x4e')][_0x49a8('0x4f')]?_0x20ce64[_0x49a8('0x4e')]:_0x12d0f2[_0x49a8('0x4a')];_0x20ce64[_0x49a8('0x51')]=qs[_0x49a8('0x52')](_0x3a5a57[_0x49a8('0x4b')][_0x49a8('0x52')]);_0x20ce64['where']=qs['filters'](_['pick'](_0x3a5a57[_0x49a8('0x4b')],_0x12d0f2[_0x49a8('0x4c')]));if(_0x3a5a57['query'][_0x49a8('0x55')]){_0x20ce64[_0x49a8('0x53')]=_[_0x49a8('0x56')](_0x20ce64['where'],{'$or':_[_0x49a8('0x44')](_0x20ce64[_0x49a8('0x4e')],function(_0x49f64b){var _0x32181d={};_0x32181d[_0x49f64b]={'$like':'%'+_0x3a5a57[_0x49a8('0x4b')][_0x49a8('0x55')]+'%'};return _0x32181d;})});}_0x20ce64=_[_0x49a8('0x56')]({},_0x20ce64,_0x3a5a57[_0x49a8('0x58')]);return _0x173424[_0x49a8('0x114')](_0x20ce64);}})[_0x49a8('0x3c')](function(_0xc79493){if(_0xc79493){_0xcaeac2=_0xc79493[_0x49a8('0x4f')];if(!_0x3a5a57[_0x49a8('0x4b')][_0x49a8('0x50')](_0x49a8('0x70'))){_0x20ce64['limit']=qs[_0x49a8('0x35')](_0x3a5a57['query'][_0x49a8('0x35')]);_0x20ce64[_0x49a8('0x33')]=qs[_0x49a8('0x33')](_0x3a5a57[_0x49a8('0x4b')][_0x49a8('0x33')]);}return _0x173424[_0x49a8('0x114')](_0x20ce64);}})[_0x49a8('0x3c')](function(_0x50352b){if(_0x50352b){return _0x50352b?{'count':_0xcaeac2,'rows':_0x50352b}:null;}})['then'](respondWithResult(_0xa07a5d,null))['catch'](handleError(_0xa07a5d,null));};exports[_0x49a8('0x127')]=function(_0x34cea8,_0x19d366,_0x4f3cfb){var _0x4c305e=_0x34cea8[_0x49a8('0x4b')]['online']===_0x49a8('0x128')?'offlineForm':_0x49a8('0x129');return db[_0x49a8('0x45')]['find']({'attributes':['id',_0x4c305e],'where':{'id':_0x34cea8[_0x49a8('0x5c')]['id']}})[_0x49a8('0x3c')](handleEntityNotFound(_0x19d366,null))[_0x49a8('0x3c')](function(_0x2ed606){if(_0x2ed606){var _0x4ffcb9=_0x2ed606[_0x4c305e];var _0x5e24c8=_0x4ffcb9&&_0x4ffcb9[_0x49a8('0x12a')]?_0x4ffcb9[_0x49a8('0x12a')]:[];_0x19d366[_0x49a8('0x41')]({'fromKey':_['isNil'](_0x4ffcb9['fromKey'])?undefined:_0x4ffcb9[_0x49a8('0x12b')],'count':_0x5e24c8[_0x49a8('0x4f')],'rows':_0x5e24c8});}})[_0x49a8('0x2e')](handleError(_0x19d366,null));};exports[_0x49a8('0x12c')]=function(_0x38c4b0,_0x5e84bb,_0x221f6d){var _0x24eff1={'raw':![],'where':{}};var _0x436cdd={};var _0x1b5b8d={'count':0x0,'rows':[]};return db[_0x49a8('0x45')][_0x49a8('0x6f')]({'where':{'id':_0x38c4b0[_0x49a8('0x5c')]['id']}})[_0x49a8('0x3c')](handleEntityNotFound(_0x5e84bb,null))[_0x49a8('0x3c')](function(_0x422c54){if(_0x422c54){_0x436cdd[_0x49a8('0x4a')]=_[_0x49a8('0x5d')](db[_0x49a8('0xdd')][_0x49a8('0x46')]);_0x436cdd['query']=_[_0x49a8('0x5d')](_0x38c4b0[_0x49a8('0x4b')]);_0x436cdd[_0x49a8('0x4c')]=_['intersection'](_0x436cdd['model'],_0x436cdd[_0x49a8('0x4b')]);_0x24eff1['attributes']=_[_0x49a8('0x4d')](_0x436cdd[_0x49a8('0x4a')],qs[_0x49a8('0x5e')](_0x38c4b0[_0x49a8('0x4b')][_0x49a8('0x5e')]));_0x24eff1[_0x49a8('0x4e')]=_0x24eff1['attributes'][_0x49a8('0x4f')]?_0x24eff1['attributes']:_0x436cdd[_0x49a8('0x4a')];if(!_0x38c4b0[_0x49a8('0x4b')][_0x49a8('0x50')](_0x49a8('0x70'))){_0x24eff1[_0x49a8('0x35')]=qs[_0x49a8('0x35')](_0x38c4b0[_0x49a8('0x4b')][_0x49a8('0x35')]);_0x24eff1['offset']=qs[_0x49a8('0x33')](_0x38c4b0['query'][_0x49a8('0x33')]);}_0x24eff1[_0x49a8('0x51')]=qs[_0x49a8('0x52')](_0x38c4b0[_0x49a8('0x4b')][_0x49a8('0x52')]);_0x24eff1[_0x49a8('0x53')]=qs[_0x49a8('0x4c')](_['pick'](_0x38c4b0[_0x49a8('0x4b')],_0x436cdd[_0x49a8('0x4c')]));_0x24eff1[_0x49a8('0x53')][_0x49a8('0x6d')]=_0x422c54['id'];if(_0x38c4b0['query'][_0x49a8('0x55')]){_0x24eff1[_0x49a8('0x53')]=_[_0x49a8('0x56')](_0x24eff1[_0x49a8('0x53')],{'$or':_[_0x49a8('0x44')](_0x24eff1[_0x49a8('0x4e')],function(_0x1ea9e6){var _0xa69b28={};_0xa69b28[_0x1ea9e6]={'$like':'%'+_0x38c4b0[_0x49a8('0x4b')][_0x49a8('0x55')]+'%'};return _0xa69b28;})});}_0x24eff1=_[_0x49a8('0x56')]({},_0x24eff1,_0x38c4b0[_0x49a8('0x58')]);return db[_0x49a8('0xdd')]['count']({'where':_0x24eff1[_0x49a8('0x53')]})['then'](function(_0x1e7ecb){_0x1b5b8d[_0x49a8('0x36')]=_0x1e7ecb;if(_0x38c4b0[_0x49a8('0x4b')]['includeAll']){_0x24eff1[_0x49a8('0x71')]=[{'all':!![]}];}else{_0x24eff1[_0x49a8('0x71')]=[{'model':db[_0x49a8('0x94')],'as':_0x49a8('0x12d'),'required':![]},{'model':db['Attachment'],'as':_0x49a8('0x12e'),'required':![]}];}return db[_0x49a8('0xdd')][_0x49a8('0x5a')](_0x24eff1);})[_0x49a8('0x3c')](function(_0x47e532){_0x1b5b8d[_0x49a8('0x72')]=_0x47e532;return _0x1b5b8d;});}})[_0x49a8('0x3c')](respondWithFilteredResult(_0x5e84bb,_0x24eff1))['catch'](handleError(_0x5e84bb,null));};exports[_0x49a8('0x12f')]=function(_0x344ef1,_0x529b96,_0x11fc4c){return db['ChatWebsite']['find']({'where':{'id':_0x344ef1['params']['id']}})[_0x49a8('0x3c')](handleEntityNotFound(_0x529b96,null))[_0x49a8('0x3c')](function(_0x2bb0d7){if(_0x2bb0d7){return _0x2bb0d7[_0x49a8('0x12f')](_0x344ef1[_0x49a8('0x61')][_0x49a8('0x77')],_[_0x49a8('0xfe')](_0x344ef1[_0x49a8('0x61')],[_0x49a8('0x77'),'id'])||{})[_0x49a8('0xc1')](function(_0x46346b){for(var _0x5eea22=0x0;_0x5eea22<_0x344ef1[_0x49a8('0x61')][_0x49a8('0x77')][_0x49a8('0x4f')];_0x5eea22+=0x1){socket[_0x49a8('0x130')]('userChatWebsite:save',{'UserId':Number(_0x344ef1[_0x49a8('0x61')][_0x49a8('0x77')][_0x5eea22]),'ChatWebsiteId':Number(_0x344ef1[_0x49a8('0x5c')]['id'])});}return _0x46346b;});}})[_0x49a8('0x3c')](respondWithResult(_0x529b96,null))['catch'](handleError(_0x529b96,null));};exports['removeAgents']=function(_0x4ed057,_0x4a0daf,_0x165b9d){return db[_0x49a8('0x45')][_0x49a8('0x5f')]({'where':{'id':_0x4ed057[_0x49a8('0x5c')]['id']}})[_0x49a8('0x3c')](handleEntityNotFound(_0x4a0daf,null))[_0x49a8('0x3c')](function(_0x5764c2){if(_0x5764c2){return _0x5764c2[_0x49a8('0x131')](_0x4ed057[_0x49a8('0x4b')][_0x49a8('0x77')])[_0x49a8('0x3c')](function(){if(_[_0x49a8('0x132')](_0x4ed057[_0x49a8('0x4b')][_0x49a8('0x77')])){for(var _0x4fdf4e=0x0;_0x4fdf4e<_0x4ed057[_0x49a8('0x4b')][_0x49a8('0x77')][_0x49a8('0x4f')];_0x4fdf4e+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x4ed057[_0x49a8('0x4b')][_0x49a8('0x77')][_0x4fdf4e]),'ChatWebsiteId':Number(_0x4ed057[_0x49a8('0x5c')]['id'])});}}else{socket[_0x49a8('0x130')](_0x49a8('0x133'),{'UserId':Number(_0x4ed057['query'][_0x49a8('0x77')]),'ChatWebsiteId':Number(_0x4ed057['params']['id'])});}});}})[_0x49a8('0x3c')](respondWithStatusCode(_0x4a0daf,null))['catch'](handleError(_0x4a0daf,null));};exports[_0x49a8('0x134')]=function(_0xa21aa9,_0xc2fac1,_0x164514){var _0x2b5969={};var _0x5a8e51={};var _0x564196;var _0x4504ba;return db[_0x49a8('0x45')][_0x49a8('0x6f')]({'where':{'id':_0xa21aa9['params']['id']}})['then'](handleEntityNotFound(_0xc2fac1,null))[_0x49a8('0x3c')](function(_0x3aebbf){if(_0x3aebbf){_0x564196=_0x3aebbf;_0x5a8e51[_0x49a8('0x4a')]=_[_0x49a8('0x5d')](db['User'][_0x49a8('0x46')]);_0x5a8e51[_0x49a8('0x4b')]=_[_0x49a8('0x5d')](_0xa21aa9[_0x49a8('0x4b')]);_0x5a8e51[_0x49a8('0x4c')]=_['intersection'](_0x5a8e51[_0x49a8('0x4a')],_0x5a8e51[_0x49a8('0x4b')]);_0x2b5969[_0x49a8('0x4e')]=_[_0x49a8('0x4d')](_0x5a8e51[_0x49a8('0x4a')],qs['fields'](_0xa21aa9[_0x49a8('0x4b')][_0x49a8('0x5e')]));_0x2b5969[_0x49a8('0x4e')]=_0x2b5969[_0x49a8('0x4e')][_0x49a8('0x4f')]?_0x2b5969[_0x49a8('0x4e')]:_0x5a8e51['model'];_0x2b5969[_0x49a8('0x51')]=qs['sort'](_0xa21aa9[_0x49a8('0x4b')]['sort']);_0x2b5969[_0x49a8('0x53')]=qs[_0x49a8('0x4c')](_[_0x49a8('0x54')](_0xa21aa9[_0x49a8('0x4b')],_0x5a8e51[_0x49a8('0x4c')]));if(_0xa21aa9[_0x49a8('0x4b')]['filter']){_0x2b5969[_0x49a8('0x53')]=_[_0x49a8('0x56')](_0x2b5969[_0x49a8('0x53')],{'$or':_[_0x49a8('0x44')](_0x2b5969[_0x49a8('0x4e')],function(_0x4a02f1){var _0x1df608={};_0x1df608[_0x4a02f1]={'$like':'%'+_0xa21aa9[_0x49a8('0x4b')][_0x49a8('0x55')]+'%'};return _0x1df608;})});}_0x2b5969=_[_0x49a8('0x56')]({},_0x2b5969,_0xa21aa9[_0x49a8('0x58')]);return _0x564196[_0x49a8('0x134')](_0x2b5969);}})[_0x49a8('0x3c')](function(_0x1fa262){if(_0x1fa262){_0x4504ba=_0x1fa262[_0x49a8('0x4f')];if(!_0xa21aa9[_0x49a8('0x4b')][_0x49a8('0x50')]('nolimit')){_0x2b5969[_0x49a8('0x35')]=qs['limit'](_0xa21aa9[_0x49a8('0x4b')]['limit']);_0x2b5969[_0x49a8('0x33')]=qs['offset'](_0xa21aa9[_0x49a8('0x4b')][_0x49a8('0x33')]);}return _0x564196[_0x49a8('0x134')](_0x2b5969);}})[_0x49a8('0x3c')](function(_0x2b7adc){if(_0x2b7adc){return _0x2b7adc?{'count':_0x4504ba,'rows':_0x2b7adc}:null;}})[_0x49a8('0x3c')](respondWithResult(_0xc2fac1,null))['catch'](handleError(_0xc2fac1,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 6c2127d..7193ec8 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 _0xe8f7=['update','remove','emit','hook','exports','events','ChatWebsite','setMaxListeners','save'];(function(_0x2096ed,_0x368818){var _0x4899de=function(_0x326316){while(--_0x326316){_0x2096ed['push'](_0x2096ed['shift']());}};_0x4899de(++_0x368818);}(_0xe8f7,0x137));var _0x7e8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe8f7[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x7e8f('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x7e8f('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x7e8f('0x2')](0x0);var events={'afterCreate':_0x7e8f('0x3'),'afterUpdate':_0x7e8f('0x4'),'afterDestroy':_0x7e8f('0x5')};function emitEvent(_0xa9b6b5){return function(_0x4249af,_0x47c258,_0x4dcc25){ChatWebsiteEvents[_0x7e8f('0x6')](_0xa9b6b5+':'+_0x4249af['id'],_0x4249af);ChatWebsiteEvents[_0x7e8f('0x6')](_0xa9b6b5,_0x4249af);_0x4dcc25(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x7e8f('0x7')](e,emitEvent(event));}}module[_0x7e8f('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x7b83=['hook','events','../../mysqldb','ChatWebsite','update','remove','emit','hasOwnProperty'];(function(_0x4320ce,_0x49f5f5){var _0x537dae=function(_0x5991ef){while(--_0x5991ef){_0x4320ce['push'](_0x4320ce['shift']());}};_0x537dae(++_0x49f5f5);}(_0x7b83,0xa1));var _0x37b8=function(_0x212986,_0x11e744){_0x212986=_0x212986-0x0;var _0x20fcfc=_0x7b83[_0x212986];return _0x20fcfc;};'use strict';var EventEmitter=require(_0x37b8('0x0'));var ChatWebsite=require(_0x37b8('0x1'))['db'][_0x37b8('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x37b8('0x3'),'afterDestroy':_0x37b8('0x4')};function emitEvent(_0x45fd66){return function(_0x48aaa1,_0x420271,_0x3c2cbe){ChatWebsiteEvents[_0x37b8('0x5')](_0x45fd66+':'+_0x48aaa1['id'],_0x48aaa1);ChatWebsiteEvents[_0x37b8('0x5')](_0x45fd66,_0x48aaa1);_0x3c2cbe(null);};}for(var e in events){if(events[_0x37b8('0x6')](e)){var event=events[e];ChatWebsite[_0x37b8('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index e995414..67cce7e 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 _0x4ac2=['path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5cc26e,_0x4a8851){var _0x2b528a=function(_0x43b0e1){while(--_0x43b0e1){_0x5cc26e['push'](_0x5cc26e['shift']());}};_0x2b528a(++_0x4a8851);}(_0x4ac2,0x19a));var _0x24ac=function(_0x140200,_0xc14af3){_0x140200=_0x140200-0x0;var _0x479b9a=_0x4ac2[_0x140200];return _0x479b9a;};'use strict';var _=require(_0x24ac('0x0'));var util=require('util');var logger=require(_0x24ac('0x1'))(_0x24ac('0x2'));var moment=require(_0x24ac('0x3'));var BPromise=require(_0x24ac('0x4'));var rp=require(_0x24ac('0x5'));var fs=require('fs');var path=require(_0x24ac('0x6'));var rimraf=require(_0x24ac('0x7'));var config=require(_0x24ac('0x8'));var attributes=require(_0x24ac('0x9'));module[_0x24ac('0xa')]=function(_0x438108,_0x25dd51){return _0x438108[_0x24ac('0xb')](_0x24ac('0xc'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d3c=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash'];(function(_0x1f5756,_0x390cca){var _0x142c16=function(_0x10a125){while(--_0x10a125){_0x1f5756['push'](_0x1f5756['shift']());}};_0x142c16(++_0x390cca);}(_0x6d3c,0x197));var _0xc6d3=function(_0x1c186c,_0x4d6867){_0x1c186c=_0x1c186c-0x0;var _0x39ecf4=_0x6d3c[_0x1c186c];return _0x39ecf4;};'use strict';var _=require(_0xc6d3('0x0'));var util=require(_0xc6d3('0x1'));var logger=require(_0xc6d3('0x2'))('api');var moment=require(_0xc6d3('0x3'));var BPromise=require(_0xc6d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6d3('0x5'));var rimraf=require(_0xc6d3('0x6'));var config=require(_0xc6d3('0x7'));var attributes=require(_0xc6d3('0x8'));module[_0xc6d3('0x9')]=function(_0x15bf06,_0x4070a2){return _0x15bf06['define'](_0xc6d3('0xa'),attributes,{'tableName':_0xc6d3('0xb'),'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 b2d0612..4d1ea0d 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 _0x5d5e=['info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then'];(function(_0x1b91b4,_0x1c9f21){var _0x48245b=function(_0x28c34e){while(--_0x28c34e){_0x1b91b4['push'](_0x1b91b4['shift']());}};_0x48245b(++_0x1c9f21);}(_0x5d5e,0x6b));var _0xe5d5=function(_0x772c80,_0x3c9cd4){_0x772c80=_0x772c80-0x0;var _0x33ddda=_0x5d5e[_0x772c80];return _0x33ddda;};'use strict';var _=require(_0xe5d5('0x0'));var util=require(_0xe5d5('0x1'));var moment=require('moment');var BPromise=require(_0xe5d5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5d5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe5d5('0x4'));var jayson=require(_0xe5d5('0x5'));var client=jayson[_0xe5d5('0x6')]['http']({'port':0x232a});config[_0xe5d5('0x7')]=_['defaults'](config['redis'],{'host':_0xe5d5('0x8'),'port':0x18eb});var socket=require(_0xe5d5('0x9'))(new Redis(config[_0xe5d5('0x7')]));require('./chatWebsite.socket')[_0xe5d5('0xa')](socket);function respondWithRpcPromise(_0x79431b,_0x20f7d1,_0x29923c){return new BPromise(function(_0xe42126,_0x51cdce){return client[_0xe5d5('0xb')](_0x79431b,_0x29923c)[_0xe5d5('0xc')](function(_0x3f74fe){logger[_0xe5d5('0xd')](_0xe5d5('0xe'),_0x20f7d1,_0xe5d5('0xf'));logger[_0xe5d5('0x10')](_0xe5d5('0x11'),_0x20f7d1,_0xe5d5('0xf'),JSON[_0xe5d5('0x12')](_0x3f74fe));if(_0x3f74fe[_0xe5d5('0x13')]){if(_0x3f74fe[_0xe5d5('0x13')][_0xe5d5('0x14')]===0x1f4){logger[_0xe5d5('0x13')](_0xe5d5('0xe'),_0x20f7d1,_0x3f74fe[_0xe5d5('0x13')][_0xe5d5('0x15')]);return _0x51cdce(_0x3f74fe['error'][_0xe5d5('0x15')]);}logger[_0xe5d5('0x13')](_0xe5d5('0xe'),_0x20f7d1,_0x3f74fe[_0xe5d5('0x13')][_0xe5d5('0x15')]);return _0xe42126(_0x3f74fe['error'][_0xe5d5('0x15')]);}else{logger['info'](_0xe5d5('0xe'),_0x20f7d1,_0xe5d5('0xf'));_0xe42126(_0x3f74fe[_0xe5d5('0x16')][_0xe5d5('0x15')]);}})[_0xe5d5('0x17')](function(_0xaad865){logger[_0xe5d5('0x13')](_0xe5d5('0xe'),_0x20f7d1,_0xaad865);_0x51cdce(_0xaad865);});});} \ No newline at end of file +var _0x3c9b=['info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','request','then'];(function(_0x3a30ba,_0x4b8af8){var _0x1f0494=function(_0x164b43){while(--_0x164b43){_0x3a30ba['push'](_0x3a30ba['shift']());}};_0x1f0494(++_0x4b8af8);}(_0x3c9b,0x7a));var _0xb3c9=function(_0x6ebef7,_0x67333d){_0x6ebef7=_0x6ebef7-0x0;var _0x585493=_0x3c9b[_0x6ebef7];return _0x585493;};'use strict';var _=require(_0xb3c9('0x0'));var util=require(_0xb3c9('0x1'));var moment=require(_0xb3c9('0x2'));var BPromise=require(_0xb3c9('0x3'));var rs=require(_0xb3c9('0x4'));var fs=require('fs');var Redis=require(_0xb3c9('0x5'));var db=require(_0xb3c9('0x6'))['db'];var utils=require(_0xb3c9('0x7'));var logger=require(_0xb3c9('0x8'))(_0xb3c9('0x9'));var config=require(_0xb3c9('0xa'));var jayson=require(_0xb3c9('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0xb3c9('0xc')]=_[_0xb3c9('0xd')](config[_0xb3c9('0xc')],{'host':_0xb3c9('0xe'),'port':0x18eb});var socket=require(_0xb3c9('0xf'))(new Redis(config[_0xb3c9('0xc')]));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x499028,_0x1750e3,_0x272b4c){return new BPromise(function(_0x4f52da,_0x41b234){return client[_0xb3c9('0x10')](_0x499028,_0x272b4c)[_0xb3c9('0x11')](function(_0x3589f3){logger[_0xb3c9('0x12')](_0xb3c9('0x13'),_0x1750e3,'request\x20sent');logger[_0xb3c9('0x14')](_0xb3c9('0x15'),_0x1750e3,'request\x20sent',JSON[_0xb3c9('0x16')](_0x3589f3));if(_0x3589f3['error']){if(_0x3589f3[_0xb3c9('0x17')]['code']===0x1f4){logger[_0xb3c9('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x1750e3,_0x3589f3[_0xb3c9('0x17')]['message']);return _0x41b234(_0x3589f3[_0xb3c9('0x17')][_0xb3c9('0x18')]);}logger['error'](_0xb3c9('0x13'),_0x1750e3,_0x3589f3[_0xb3c9('0x17')][_0xb3c9('0x18')]);return _0x4f52da(_0x3589f3['error']['message']);}else{logger[_0xb3c9('0x12')](_0xb3c9('0x13'),_0x1750e3,_0xb3c9('0x19'));_0x4f52da(_0x3589f3[_0xb3c9('0x1a')][_0xb3c9('0x18')]);}})[_0xb3c9('0x1b')](function(_0x183625){logger[_0xb3c9('0x17')](_0xb3c9('0x13'),_0x1750e3,_0x183625);_0x41b234(_0x183625);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 6b27dcd..baaa7ab 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 _0xd7f0=['remove','update','emit','register','chatWebsite:','./chatWebsite.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7f0,0x1a9));var _0x0d7f=function(_0x4fbfc1,_0x278e58){_0x4fbfc1=_0x4fbfc1-0x0;var _0x4bbc50=_0xd7f0[_0x4fbfc1];return _0x4bbc50;};'use strict';var ChatWebsiteEvents=require(_0x0d7f('0x0'));var events=[_0x0d7f('0x1'),_0x0d7f('0x2'),_0x0d7f('0x3')];function createListener(_0x12c403,_0x15aa0c){return function(_0x22ea54){_0x15aa0c[_0x0d7f('0x4')](_0x12c403,_0x22ea54);};}function removeListener(_0x2fbb70,_0x307308){return function(){ChatWebsiteEvents['removeListener'](_0x2fbb70,_0x307308);};}exports[_0x0d7f('0x5')]=function(_0x577479){for(var _0x21dd20=0x0,_0x47f575=events['length'];_0x21dd20<_0x47f575;_0x21dd20++){var _0xd53d9f=events[_0x21dd20];var _0x5d284b=createListener(_0x0d7f('0x6')+_0xd53d9f,_0x577479);ChatWebsiteEvents['on'](_0xd53d9f,_0x5d284b);}}; \ No newline at end of file +var _0x7073=['update','emit','removeListener','length','./chatWebsite.events','save'];(function(_0x5ba961,_0x57f074){var _0xd6092f=function(_0x339148){while(--_0x339148){_0x5ba961['push'](_0x5ba961['shift']());}};_0xd6092f(++_0x57f074);}(_0x7073,0x11e));var _0x3707=function(_0x577287,_0xfcf054){_0x577287=_0x577287-0x0;var _0x5f149c=_0x7073[_0x577287];return _0x5f149c;};'use strict';var ChatWebsiteEvents=require(_0x3707('0x0'));var events=[_0x3707('0x1'),'remove',_0x3707('0x2')];function createListener(_0x32b7d5,_0x55c6ab){return function(_0x51d878){_0x55c6ab[_0x3707('0x3')](_0x32b7d5,_0x51d878);};}function removeListener(_0xf22b08,_0x539f34){return function(){ChatWebsiteEvents[_0x3707('0x4')](_0xf22b08,_0x539f34);};}exports['register']=function(_0x4b2fd0){for(var _0x2a5ba7=0x0,_0x5a0955=events[_0x3707('0x5')];_0x2a5ba7<_0x5a0955;_0x2a5ba7++){var _0x4e5b47=events[_0x2a5ba7];var _0x153855=createListener('chatWebsite:'+_0x4e5b47,_0x4b2fd0);ChatWebsiteEvents['on'](_0x4e5b47,_0x153855);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 53f615f..8f60e4a 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 _0x675f=['isAuthenticated','index','get','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getLogo','/:id/avatar','getAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','format','%s-%s','now','/:id/logo','single','file','addLogo','server/files/images/avatars/','originalname','addAvatar','/:id/system_avatar','server/files','attachments','offline-chat','ensureDir','extname','/:id/offline','offline','addInteraction','addProactiveActions','addAgents','put','/:id','update','delete','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x675f,0x149));var _0xf675=function(_0xa62b04,_0x40a760){_0xa62b04=_0xa62b04-0x0;var _0x2729d8=_0x675f[_0xa62b04];return _0x2729d8;};'use strict';var multer=require(_0xf675('0x0'));var util=require(_0xf675('0x1'));var path=require(_0xf675('0x2'));var timeout=require(_0xf675('0x3'));var express=require(_0xf675('0x4'));var router=express[_0xf675('0x5')]();var fs_extra=require(_0xf675('0x6'));var auth=require(_0xf675('0x7'));var interaction=require(_0xf675('0x8'));var config=require(_0xf675('0x9'));var controller=require(_0xf675('0xa'));router['get']('/',auth[_0xf675('0xb')](),controller[_0xf675('0xc')]);router[_0xf675('0xd')]('/describe',auth[_0xf675('0xb')](),controller[_0xf675('0xe')]);router[_0xf675('0xd')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf675('0xd')](_0xf675('0xf'),auth[_0xf675('0xb')](),controller[_0xf675('0x10')]);router['get'](_0xf675('0x11'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xf675('0xd')]('/:id/logo',controller[_0xf675('0x12')]);router[_0xf675('0xd')](_0xf675('0x13'),controller[_0xf675('0x14')]);router[_0xf675('0xd')]('/:id/customer_avatar',controller['getCustomerAvatar']);router[_0xf675('0xd')]('/:id/system_avatar',controller['getSystemAvatar']);router[_0xf675('0xd')](_0xf675('0x15'),auth[_0xf675('0xb')](),controller[_0xf675('0x16')]);router['get'](_0xf675('0x17'),controller[_0xf675('0x18')]);router[_0xf675('0xd')](_0xf675('0x19'),auth[_0xf675('0xb')](),controller[_0xf675('0x1a')]);router[_0xf675('0xd')](_0xf675('0x1b'),auth['isAuthenticated'](),controller[_0xf675('0x1c')]);router['get'](_0xf675('0x1d'),controller[_0xf675('0x1e')]);router[_0xf675('0xd')](_0xf675('0x1f'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0xf675('0xd')](_0xf675('0x20'),auth[_0xf675('0xb')](),controller[_0xf675('0x21')]);router[_0xf675('0x22')]('/',auth['isAuthenticated'](),controller[_0xf675('0x23')]);router[_0xf675('0x22')](_0xf675('0xf'),auth['isAuthenticated'](),controller[_0xf675('0x24')]);router[_0xf675('0x22')]('/:id/canned_answers',auth[_0xf675('0xb')](),controller[_0xf675('0x25')]);var upload=multer({'storage':multer[_0xf675('0x26')]({'destination':function(_0x261e22,_0xe35d0e,_0x436f25){_0x436f25(null,path[_0xf675('0x27')](config[_0xf675('0x28')],'server/files/images/logos/'));},'filename':function(_0x2b4193,_0xbaa712,_0xbd115a){_0xbd115a(null,util[_0xf675('0x29')](_0xf675('0x2a'),Date[_0xf675('0x2b')](),_0xbaa712['originalname']));}})});router[_0xf675('0x22')](_0xf675('0x2c'),upload[_0xf675('0x2d')](_0xf675('0x2e')),controller[_0xf675('0x2f')]);var upload=multer({'storage':multer[_0xf675('0x26')]({'destination':function(_0x1be7ab,_0x376ff8,_0x2cdb38){_0x2cdb38(null,path[_0xf675('0x27')](config['root'],_0xf675('0x30')));},'filename':function(_0x4e40a7,_0x4a2bcc,_0x555e19){_0x555e19(null,util[_0xf675('0x29')](_0xf675('0x2a'),Date[_0xf675('0x2b')](),_0x4a2bcc[_0xf675('0x31')]));}})});router[_0xf675('0x22')](_0xf675('0x13'),upload[_0xf675('0x2d')](_0xf675('0x2e')),controller[_0xf675('0x32')]);var upload=multer({'storage':multer[_0xf675('0x26')]({'destination':function(_0x5d3235,_0x3b6082,_0x2292d9){_0x2292d9(null,path[_0xf675('0x27')](config[_0xf675('0x28')],_0xf675('0x30')));},'filename':function(_0x1f8358,_0x267adc,_0x4f6b2c){_0x4f6b2c(null,util[_0xf675('0x29')](_0xf675('0x2a'),Date[_0xf675('0x2b')](),_0x267adc[_0xf675('0x31')]));}})});router['post']('/:id/customer_avatar',upload[_0xf675('0x2d')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xf675('0x26')]({'destination':function(_0x5dba7f,_0x3216c0,_0x26eb36){_0x26eb36(null,path['join'](config[_0xf675('0x28')],_0xf675('0x30')));},'filename':function(_0x33b416,_0x41df8c,_0x396e66){_0x396e66(null,util[_0xf675('0x29')]('%s-%s',Date[_0xf675('0x2b')](),_0x41df8c[_0xf675('0x31')]));}})});router[_0xf675('0x22')](_0xf675('0x33'),upload['single']('file'),controller['addSystemAvatar']);router[_0xf675('0x22')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xf675('0x26')]({'destination':function(_0x27b839,_0x5196a7,_0x4b2c95){const _0x44d952=path[_0xf675('0x27')](config[_0xf675('0x28')],_0xf675('0x34'),_0xf675('0x35'),_0xf675('0x36'));fs_extra[_0xf675('0x37')](_0x44d952,function(){_0x4b2c95(null,_0x44d952);});},'filename':function(_0x17813e,_0x5da6a2,_0x41b5f3){const _0x5ad593=_0x5da6a2[_0xf675('0x31')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4bdd80=path[_0xf675('0x38')](_0x5ad593);const _0x464c57=Date[_0xf675('0x2b')]()+'-'+_0x5ad593['replace'](_0x4bdd80,'')+_0x4bdd80;_0x41b5f3(null,_0x464c57);}})});router['post'](_0xf675('0x39'),offlineUploadMulter['any'](),controller[_0xf675('0x3a')]);router[_0xf675('0x22')](_0xf675('0x15'),auth[_0xf675('0xb')](),controller[_0xf675('0x3b')]);router[_0xf675('0x22')](_0xf675('0x19'),auth[_0xf675('0xb')](),controller['addApplications']);router['post']('/:id/proactive_actions',auth[_0xf675('0xb')](),controller[_0xf675('0x3c')]);router[_0xf675('0x22')](_0xf675('0x20'),auth[_0xf675('0xb')](),controller[_0xf675('0x3d')]);router[_0xf675('0x3e')](_0xf675('0x3f'),auth[_0xf675('0xb')](),controller[_0xf675('0x40')]);router[_0xf675('0x41')]('/:id',auth[_0xf675('0xb')](),controller['destroy']);router[_0xf675('0x41')](_0xf675('0xf'),auth[_0xf675('0xb')](),controller['removeDispositions']);router[_0xf675('0x41')]('/:id/canned_answers',auth[_0xf675('0xb')](),controller[_0xf675('0x42')]);router[_0xf675('0x41')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xf675('0x43')]=router; \ No newline at end of file +var _0x9132=['/:id/dispositions','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','now','originalname','addLogo','%s-%s','single','file','addAvatar','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','notify','server/files','attachments','offline-chat','replace','/:id/offline','any','offline','addInteraction','/:id/proactive_actions','addProactiveActions','addAgents','put','update','delete','removeAnswers','removeAgents','exports','multer','util','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/offline_messages','/:id/users','getAgents','post'];(function(_0x37719e,_0x1758f3){var _0x2258c6=function(_0x2a1bd4){while(--_0x2a1bd4){_0x37719e['push'](_0x37719e['shift']());}};_0x2258c6(++_0x1758f3);}(_0x9132,0x120));var _0x2913=function(_0xc2837a,_0x4518a9){_0xc2837a=_0xc2837a-0x0;var _0x3363ba=_0x9132[_0xc2837a];return _0x3363ba;};'use strict';var multer=require(_0x2913('0x0'));var util=require(_0x2913('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2913('0x2')]();var fs_extra=require(_0x2913('0x3'));var auth=require(_0x2913('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0x2913('0x5')]('/',auth[_0x2913('0x6')](),controller[_0x2913('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x2913('0x8')]);router[_0x2913('0x5')](_0x2913('0x9'),auth[_0x2913('0x6')](),controller['show']);router[_0x2913('0x5')]('/:id/dispositions',auth[_0x2913('0x6')](),controller[_0x2913('0xa')]);router['get'](_0x2913('0xb'),auth[_0x2913('0x6')](),controller[_0x2913('0xc')]);router[_0x2913('0x5')](_0x2913('0xd'),controller['getLogo']);router['get'](_0x2913('0xe'),controller[_0x2913('0xf')]);router[_0x2913('0x5')]('/:id/customer_avatar',controller['getCustomerAvatar']);router[_0x2913('0x5')](_0x2913('0x10'),controller[_0x2913('0x11')]);router[_0x2913('0x5')](_0x2913('0x12'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x2913('0x5')]('/:id/snippet',controller[_0x2913('0x13')]);router[_0x2913('0x5')](_0x2913('0x14'),auth[_0x2913('0x6')](),controller[_0x2913('0x15')]);router[_0x2913('0x5')]('/:id/proactive_actions',auth[_0x2913('0x6')](),controller[_0x2913('0x16')]);router['get']('/:id/fields',controller['getFields']);router[_0x2913('0x5')](_0x2913('0x17'),auth[_0x2913('0x6')](),controller['getOfflineMessages']);router[_0x2913('0x5')](_0x2913('0x18'),auth[_0x2913('0x6')](),controller[_0x2913('0x19')]);router[_0x2913('0x1a')]('/',auth[_0x2913('0x6')](),controller['create']);router['post'](_0x2913('0x1b'),auth[_0x2913('0x6')](),controller[_0x2913('0x1c')]);router[_0x2913('0x1a')](_0x2913('0xb'),auth[_0x2913('0x6')](),controller[_0x2913('0x1d')]);var upload=multer({'storage':multer[_0x2913('0x1e')]({'destination':function(_0x3d87d1,_0x2198cd,_0x2481b3){_0x2481b3(null,path[_0x2913('0x1f')](config[_0x2913('0x20')],_0x2913('0x21')));},'filename':function(_0x8c9bd7,_0x3b6fdf,_0x4805f1){_0x4805f1(null,util[_0x2913('0x22')]('%s-%s',Date[_0x2913('0x23')](),_0x3b6fdf[_0x2913('0x24')]));}})});router[_0x2913('0x1a')]('/:id/logo',upload['single']('file'),controller[_0x2913('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4cf6e2,_0x2c0384,_0x539bd4){_0x539bd4(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x2e9c8f,_0x49d365,_0x5b4285){_0x5b4285(null,util['format'](_0x2913('0x26'),Date[_0x2913('0x23')](),_0x49d365[_0x2913('0x24')]));}})});router[_0x2913('0x1a')](_0x2913('0xe'),upload[_0x2913('0x27')](_0x2913('0x28')),controller[_0x2913('0x29')]);var upload=multer({'storage':multer[_0x2913('0x1e')]({'destination':function(_0x307ef9,_0x5ddcaa,_0x4607d6){_0x4607d6(null,path[_0x2913('0x1f')](config[_0x2913('0x20')],_0x2913('0x2a')));},'filename':function(_0x2994a7,_0x2207ba,_0x480f59){_0x480f59(null,util[_0x2913('0x22')](_0x2913('0x26'),Date[_0x2913('0x23')](),_0x2207ba[_0x2913('0x24')]));}})});router['post']('/:id/customer_avatar',upload['single'](_0x2913('0x28')),controller[_0x2913('0x2b')]);var upload=multer({'storage':multer[_0x2913('0x1e')]({'destination':function(_0xdc1e89,_0x434557,_0x41e26a){_0x41e26a(null,path[_0x2913('0x1f')](config[_0x2913('0x20')],_0x2913('0x2a')));},'filename':function(_0x4d9ce5,_0x19fed2,_0x13380a){_0x13380a(null,util[_0x2913('0x22')](_0x2913('0x26'),Date[_0x2913('0x23')](),_0x19fed2['originalname']));}})});router[_0x2913('0x1a')]('/:id/system_avatar',upload[_0x2913('0x27')]('file'),controller[_0x2913('0x2c')]);router[_0x2913('0x1a')]('/:id/notify',controller[_0x2913('0x2d')]);const offlineUploadMulter=multer({'storage':multer[_0x2913('0x1e')]({'destination':function(_0x5b922a,_0x167b4f,_0x58ca5f){const _0x5039e7=path['join'](config['root'],_0x2913('0x2e'),_0x2913('0x2f'),_0x2913('0x30'));fs_extra['ensureDir'](_0x5039e7,function(){_0x58ca5f(null,_0x5039e7);});},'filename':function(_0x42ee4b,_0x174164,_0x52b6eb){const _0x5c03c9=_0x174164[_0x2913('0x24')][_0x2913('0x31')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x213a9c=path['extname'](_0x5c03c9);const _0x30221b=Date[_0x2913('0x23')]()+'-'+_0x5c03c9['replace'](_0x213a9c,'')+_0x213a9c;_0x52b6eb(null,_0x30221b);}})});router[_0x2913('0x1a')](_0x2913('0x32'),offlineUploadMulter[_0x2913('0x33')](),controller[_0x2913('0x34')]);router[_0x2913('0x1a')](_0x2913('0x12'),auth[_0x2913('0x6')](),controller[_0x2913('0x35')]);router['post']('/:id/applications',auth[_0x2913('0x6')](),controller['addApplications']);router['post'](_0x2913('0x36'),auth[_0x2913('0x6')](),controller[_0x2913('0x37')]);router[_0x2913('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0x2913('0x38')]);router[_0x2913('0x39')](_0x2913('0x9'),auth[_0x2913('0x6')](),controller[_0x2913('0x3a')]);router['delete'](_0x2913('0x9'),auth[_0x2913('0x6')](),controller['destroy']);router[_0x2913('0x3b')](_0x2913('0x1b'),auth[_0x2913('0x6')](),controller['removeDispositions']);router[_0x2913('0x3b')](_0x2913('0xb'),auth[_0x2913('0x6')](),controller[_0x2913('0x3c')]);router[_0x2913('0x3b')](_0x2913('0x18'),auth[_0x2913('0x6')](),controller[_0x2913('0x3d')]);module[_0x2913('0x3e')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 80c596a..1ad805c 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 _0x938d=['sequelize','exports','ENUM','AmazonAWS','Google'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd938('0x0'));module[_0xd938('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xd938('0x2')](_0xd938('0x3'),_0xd938('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1c88=['AmazonAWS','sequelize','STRING','ENUM'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x1c88,0x1a9));var _0x81c8=function(_0x284885,_0x34b143){_0x284885=_0x284885-0x0;var _0x3a9710=_0x1c88[_0x284885];return _0x3a9710;};'use strict';var Sequelize=require(_0x81c8('0x0'));module['exports']={'name':{'type':Sequelize[_0x81c8('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x81c8('0x2')](_0x81c8('0x3'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x81c8('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index c0377aa..3dd36d4 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 _0x5f66=['update','catch','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','CloudProvider','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body'];(function(_0x2e4d24,_0x2ec28b){var _0x53eb15=function(_0x4dc1c2){while(--_0x4dc1c2){_0x2e4d24['push'](_0x2e4d24['shift']());}};_0x53eb15(++_0x2ec28b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'all':!![]}];}return db[_0x65f6('0x27')][_0x65f6('0x3c')](_0x4ac04b);})[_0x65f6('0x21')](function(_0xed4c96){_0x266cfe[_0x65f6('0x3d')]=_0xed4c96;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))['catch'](handleError(_0x559330,null));};exports[_0x65f6('0x3e')]=function(_0x400ed2,_0x377ae5){var _0x181798={'raw':!![],'where':{'id':_0x400ed2[_0x65f6('0x3f')]['id']}},_0x83e2d9={};_0x83e2d9[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x83e2d9[_0x65f6('0x2c')]=_[_0x65f6('0x2b')](_0x400ed2[_0x65f6('0x2c')]);_0x83e2d9[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],_0x83e2d9['query']);_0x181798[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x400ed2['query'][_0x65f6('0x2f')]));_0x181798[_0x65f6('0x30')]=_0x181798[_0x65f6('0x30')]['length']?_0x181798[_0x65f6('0x30')]:_0x83e2d9[_0x65f6('0x2a')];if(_0x400ed2[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x181798['include']=[{'all':!![]}];}_0x181798=_[_0x65f6('0x37')]({},_0x181798,_0x400ed2['options']);return db[_0x65f6('0x27')][_0x65f6('0x40')](_0x181798)['then'](handleEntityNotFound(_0x377ae5,null))[_0x65f6('0x21')](respondWithResult(_0x377ae5,null))['catch'](handleError(_0x377ae5,null));};exports[_0x65f6('0x41')]=function(_0x4d9b76,_0x2d1706){return db[_0x65f6('0x27')][_0x65f6('0x41')](_0x4d9b76[_0x65f6('0x42')],{})['then'](respondWithResult(_0x2d1706,0xc9))['catch'](handleError(_0x2d1706,null));};exports[_0x65f6('0x43')]=function(_0x15d3ba,_0x3b647a){if(_0x15d3ba[_0x65f6('0x42')]['id']){delete _0x15d3ba[_0x65f6('0x42')]['id'];}return db[_0x65f6('0x27')][_0x65f6('0x40')]({'where':{'id':_0x15d3ba[_0x65f6('0x3f')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b647a,null))['then'](saveUpdates(_0x15d3ba[_0x65f6('0x42')],null))[_0x65f6('0x21')](respondWithResult(_0x3b647a,null))[_0x65f6('0x44')](handleError(_0x3b647a,null));};exports['destroy']=function(_0x47e749,_0x42d453){return db['CloudProvider'][_0x65f6('0x40')]({'where':{'id':_0x47e749[_0x65f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x42d453,null))[_0x65f6('0x21')](removeEntity(_0x42d453,null))['catch'](handleError(_0x42d453,null));}; \ No newline at end of file +var _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','CloudProvider','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x33ab41,_0xa2d039){var _0x12403d=function(_0x41f3a9){while(--_0x41f3a9){_0x33ab41['push'](_0x33ab41['shift']());}};_0x12403d(++_0xa2d039);}(_0x2ef3,0xba));var _0x32ef=function(_0x26d312,_0x2e4c4d){_0x26d312=_0x26d312-0x0;var _0xe32c16=_0x2ef3[_0x26d312];return _0xe32c16;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['CloudProvider'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['CloudProvider'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['CloudProvider']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 46a84fd..266055a 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 _0x07ca=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','CloudProvider'];(function(_0x1cca4d,_0x1aa72f){var _0x270153=function(_0x1386d4){while(--_0x1386d4){_0x1cca4d['push'](_0x1cca4d['shift']());}};_0x270153(++_0x1aa72f);}(_0x07ca,0x16b));var _0xa07c=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0x07ca[_0x9e0cb3];return _0x5926b7;};'use strict';var _=require(_0xa07c('0x0'));var util=require(_0xa07c('0x1'));var logger=require(_0xa07c('0x2'))(_0xa07c('0x3'));var moment=require(_0xa07c('0x4'));var BPromise=require(_0xa07c('0x5'));var rp=require(_0xa07c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa07c('0x7'));var config=require(_0xa07c('0x8'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x740cf,_0x9e1f39){return _0x740cf[_0xa07c('0x9')](_0xa07c('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5fd=['bluebird','path','rimraf','./cloudProvider.attributes','exports','CloudProvider','lodash','../../config/logger','api'];(function(_0x1c9dbc,_0x511e0c){var _0x2c33fa=function(_0x5d2c4c){while(--_0x5d2c4c){_0x1c9dbc['push'](_0x1c9dbc['shift']());}};_0x2c33fa(++_0x511e0c);}(_0xf5fd,0x15c));var _0xdf5f=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xf5fd[_0x29d94e];return _0x106237;};'use strict';var _=require(_0xdf5f('0x0'));var util=require('util');var logger=require(_0xdf5f('0x1'))(_0xdf5f('0x2'));var moment=require('moment');var BPromise=require(_0xdf5f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf5f('0x4'));var rimraf=require(_0xdf5f('0x5'));var config=require('../../config/environment');var attributes=require(_0xdf5f('0x6'));module[_0xdf5f('0x7')]=function(_0x4d2406,_0x1da282){return _0x4d2406['define'](_0xdf5f('0x8'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 40d83fe..260beec 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 _0x0c3a=['jayson/promise','client','request','then','info','CloudProvider,\x20%s,\x20%s','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x0c3a,0x171));var _0xa0c3=function(_0x24358b,_0x11ba19){_0x24358b=_0x24358b-0x0;var _0xae1267=_0x0c3a[_0x24358b];return _0xae1267;};'use strict';var _=require(_0xa0c3('0x0'));var util=require(_0xa0c3('0x1'));var moment=require(_0xa0c3('0x2'));var BPromise=require(_0xa0c3('0x3'));var rs=require(_0xa0c3('0x4'));var fs=require('fs');var Redis=require(_0xa0c3('0x5'));var db=require(_0xa0c3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0c3('0x7'))(_0xa0c3('0x8'));var config=require('../../config/environment');var jayson=require(_0xa0c3('0x9'));var client=jayson[_0xa0c3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd974,_0x4f90f8,_0x5770bd){return new BPromise(function(_0x10da7c,_0x109c9a){return client[_0xa0c3('0xb')](_0x2fd974,_0x5770bd)[_0xa0c3('0xc')](function(_0x5d7c35){logger[_0xa0c3('0xd')](_0xa0c3('0xe'),_0x4f90f8,'request\x20sent');logger['debug'](_0xa0c3('0xf'),_0x4f90f8,_0xa0c3('0x10'),JSON['stringify'](_0x5d7c35));if(_0x5d7c35[_0xa0c3('0x11')]){if(_0x5d7c35[_0xa0c3('0x11')][_0xa0c3('0x12')]===0x1f4){logger['error'](_0xa0c3('0xe'),_0x4f90f8,_0x5d7c35[_0xa0c3('0x11')]['message']);return _0x109c9a(_0x5d7c35['error'][_0xa0c3('0x13')]);}logger[_0xa0c3('0x11')](_0xa0c3('0xe'),_0x4f90f8,_0x5d7c35[_0xa0c3('0x11')][_0xa0c3('0x13')]);return _0x10da7c(_0x5d7c35['error'][_0xa0c3('0x13')]);}else{logger['info'](_0xa0c3('0xe'),_0x4f90f8,'request\x20sent');_0x10da7c(_0x5d7c35['result']['message']);}})[_0xa0c3('0x14')](function(_0x474695){logger[_0xa0c3('0x11')]('CloudProvider,\x20%s,\x20%s',_0x4f90f8,_0x474695);_0x109c9a(_0x474695);});});} \ No newline at end of file +var _0xd943=['info','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x41aae4,_0x4f8b6f){var _0x39504c=function(_0x166759){while(--_0x166759){_0x41aae4['push'](_0x41aae4['shift']());}};_0x39504c(++_0x4f8b6f);}(_0xd943,0x15d));var _0x3d94=function(_0x49ec25,_0xaab17a){_0x49ec25=_0x49ec25-0x0;var _0x5648f8=_0xd943[_0x49ec25];return _0x5648f8;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('CloudProvider,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index b1191f2..d03822d 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 _0x9b12=['create','put','delete','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0xd4a4ca,_0x3172df){var _0x15803d=function(_0x320d25){while(--_0x320d25){_0xd4a4ca['push'](_0xd4a4ca['shift']());}};_0x15803d(++_0x3172df);}(_0x9b12,0x83));var _0x29b1=function(_0x542e27,_0x549ee5){_0x542e27=_0x542e27-0x0;var _0x272d32=_0x9b12[_0x542e27];return _0x272d32;};'use strict';var multer=require(_0x29b1('0x0'));var util=require(_0x29b1('0x1'));var path=require('path');var timeout=require(_0x29b1('0x2'));var express=require('express');var router=express[_0x29b1('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x29b1('0x4'));var config=require(_0x29b1('0x5'));var controller=require(_0x29b1('0x6'));router[_0x29b1('0x7')]('/',auth[_0x29b1('0x8')](),controller[_0x29b1('0x9')]);router['get'](_0x29b1('0xa'),auth['isAuthenticated'](),controller[_0x29b1('0xb')]);router[_0x29b1('0xc')]('/',auth[_0x29b1('0x8')](),controller[_0x29b1('0xd')]);router[_0x29b1('0xe')](_0x29b1('0xa'),auth[_0x29b1('0x8')](),controller['update']);router[_0x29b1('0xf')](_0x29b1('0xa'),auth[_0x29b1('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd14c=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller'];(function(_0x3eb1b9,_0x537dba){var _0x29a332=function(_0x331e5d){while(--_0x331e5d){_0x3eb1b9['push'](_0x3eb1b9['shift']());}};_0x29a332(++_0x537dba);}(_0xd14c,0x124));var _0xcd14=function(_0x413051,_0x4f5a49){_0x413051=_0x413051-0x0;var _0x363295=_0xd14c[_0x413051];return _0x363295;};'use strict';var multer=require('multer');var util=require(_0xcd14('0x0'));var path=require(_0xcd14('0x1'));var timeout=require(_0xcd14('0x2'));var express=require(_0xcd14('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcd14('0x4'));var interaction=require(_0xcd14('0x5'));var config=require(_0xcd14('0x6'));var controller=require(_0xcd14('0x7'));router[_0xcd14('0x8')]('/',auth[_0xcd14('0x9')](),controller[_0xcd14('0xa')]);router[_0xcd14('0x8')](_0xcd14('0xb'),auth[_0xcd14('0x9')](),controller[_0xcd14('0xc')]);router[_0xcd14('0xd')]('/',auth[_0xcd14('0x9')](),controller[_0xcd14('0xe')]);router[_0xcd14('0xf')](_0xcd14('0xb'),auth['isAuthenticated'](),controller[_0xcd14('0x10')]);router[_0xcd14('0x11')](_0xcd14('0xb'),auth[_0xcd14('0x9')](),controller[_0xcd14('0x12')]);module[_0xcd14('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 245c09e..70a1454 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 _0x590b=['sequelize','exports','STRING','name'];(function(_0x153b2a,_0x37188a){var _0x3907e1=function(_0x16c456){while(--_0x16c456){_0x153b2a['push'](_0x153b2a['shift']());}};_0x3907e1(++_0x37188a);}(_0x590b,0x1cc));var _0xb590=function(_0x1f2e09,_0x51d100){_0x1f2e09=_0x1f2e09-0x0;var _0x32b2a6=_0x590b[_0x1f2e09];return _0x32b2a6;};'use strict';var Sequelize=require(_0xb590('0x0'));module[_0xb590('0x1')]={'name':{'type':Sequelize[_0xb590('0x2')],'unique':_0xb590('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb590('0x2')]},'companyId':{'type':Sequelize[_0xb590('0x2')]},'website':{'type':Sequelize[_0xb590('0x2')]},'phone':{'type':Sequelize[_0xb590('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xb590('0x2')]},'postalCode':{'type':Sequelize[_0xb590('0x2')]},'city':{'type':Sequelize[_0xb590('0x2')]},'country':{'type':Sequelize[_0xb590('0x2')]},'email':{'type':Sequelize[_0xb590('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xb590('0x2')]},'sStreet':{'type':Sequelize[_0xb590('0x2')]},'sPostalCode':{'type':Sequelize[_0xb590('0x2')]},'sCity':{'type':Sequelize[_0xb590('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb590('0x2')]}}; \ No newline at end of file +var _0x323b=['sequelize','STRING','name'];(function(_0x51a85d,_0x57e810){var _0x4cfe87=function(_0x97e35c){while(--_0x97e35c){_0x51a85d['push'](_0x51a85d['shift']());}};_0x4cfe87(++_0x57e810);}(_0x323b,0x1ad));var _0xb323=function(_0x5cad0f,_0x2e69a6){_0x5cad0f=_0x5cad0f-0x0;var _0x4e576d=_0x323b[_0x5cad0f];return _0x4e576d;};'use strict';var Sequelize=require(_0xb323('0x0'));module['exports']={'name':{'type':Sequelize[_0xb323('0x1')],'unique':_0xb323('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb323('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xb323('0x1')]},'phone':{'type':Sequelize[_0xb323('0x1')]},'fax':{'type':Sequelize[_0xb323('0x1')]},'type':{'type':Sequelize[_0xb323('0x1')]},'street':{'type':Sequelize[_0xb323('0x1')]},'postalCode':{'type':Sequelize[_0xb323('0x1')]},'city':{'type':Sequelize[_0xb323('0x1')]},'country':{'type':Sequelize[_0xb323('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xb323('0x1')]},'sPostalCode':{'type':Sequelize[_0xb323('0x1')]},'sCity':{'type':Sequelize[_0xb323('0x1')]},'sCountry':{'type':Sequelize[_0xb323('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index fecc301..8f702b9 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 _0x389f=['findAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addContacts','CmContact','ids','omit','getContacts','map','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','end','status','undefined','limit','count','offset','set','Content-Range','json','reject','then','destroy','UserProfileResource','error','name','send','index','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include'];(function(_0x34caae,_0x5f4c73){var _0x3c6480=function(_0x244cd3){while(--_0x244cd3){_0x34caae['push'](_0x34caae['shift']());}};_0x3c6480(++_0x5f4c73);}(_0x389f,0x17a));var _0xf389=function(_0xb7caad,_0x170fc6){_0xb7caad=_0xb7caad-0x0;var _0x53ba91=_0x389f[_0xb7caad];return _0x53ba91;};'use strict';var emlformat=require(_0xf389('0x0'));var rimraf=require(_0xf389('0x1'));var zipdir=require(_0xf389('0x2'));var jsonpatch=require(_0xf389('0x3'));var rp=require(_0xf389('0x4'));var moment=require(_0xf389('0x5'));var BPromise=require(_0xf389('0x6'));var Mustache=require(_0xf389('0x7'));var util=require(_0xf389('0x8'));var path=require(_0xf389('0x9'));var sox=require(_0xf389('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf389('0xb'));var _=require(_0xf389('0xc'));var squel=require(_0xf389('0xd'));var crypto=require(_0xf389('0xe'));var jsforce=require(_0xf389('0xf'));var deskjs=require(_0xf389('0x10'));var toCsv=require(_0xf389('0x11'));var querystring=require(_0xf389('0x12'));var Papa=require('papaparse');var Redis=require(_0xf389('0x13'));var authService=require(_0xf389('0x14'));var qs=require(_0xf389('0x15'));var as=require(_0xf389('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf389('0x17'));var utils=require(_0xf389('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf389('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fec4a,_0x5e85b3){_0x5e85b3=_0x5e85b3||0xcc;return function(_0x45a4ec){if(_0x45a4ec){return _0x2fec4a['sendStatus'](_0x5e85b3);}return _0x2fec4a['status'](_0x5e85b3)[_0xf389('0x1a')]();};}function respondWithResult(_0x286dc6,_0x33f9b7){_0x33f9b7=_0x33f9b7||0xc8;return function(_0x5106cb){if(_0x5106cb){return _0x286dc6[_0xf389('0x1b')](_0x33f9b7)['json'](_0x5106cb);}};}function respondWithFilteredResult(_0x3ef789,_0x3f541d){return function(_0x4517c4){if(_0x4517c4){var _0x8b0fad=typeof _0x3f541d['offset']===_0xf389('0x1c')&&typeof _0x3f541d[_0xf389('0x1d')]===_0xf389('0x1c');var _0x2680b8=_0x4517c4[_0xf389('0x1e')];var _0x3d5584=_0x8b0fad?0x0:_0x3f541d[_0xf389('0x1f')];var _0x144295=_0x8b0fad?_0x4517c4['count']:_0x3f541d[_0xf389('0x1f')]+_0x3f541d['limit'];var _0x47d3c4;if(_0x144295>=_0x2680b8){_0x144295=_0x2680b8;_0x47d3c4=0xc8;}else{_0x47d3c4=0xce;}_0x3ef789[_0xf389('0x1b')](_0x47d3c4);return _0x3ef789[_0xf389('0x20')](_0xf389('0x21'),_0x3d5584+'-'+_0x144295+'/'+_0x2680b8)[_0xf389('0x22')](_0x4517c4);}return null;};}function patchUpdates(_0xa15940){return function(_0x6f8356){try{jsonpatch['apply'](_0x6f8356,_0xa15940,!![]);}catch(_0x2535f4){return BPromise[_0xf389('0x23')](_0x2535f4);}return _0x6f8356['save']();};}function saveUpdates(_0xc13762,_0x190551){return function(_0x36e52f){if(_0x36e52f){return _0x36e52f['update'](_0xc13762)[_0xf389('0x24')](function(_0x52ae40){return _0x52ae40;});}return null;};}function removeEntity(_0x31c9e6,_0x3bbeae){return function(_0x44f891){if(_0x44f891){return _0x44f891[_0xf389('0x25')]()['then'](function(){var _0x1076a7=_0x44f891['get']({'plain':!![]});var _0x5924ac='Companies';return db[_0xf389('0x26')][_0xf389('0x25')]({'where':{'type':_0x5924ac,'resourceId':_0x1076a7['id']}})[_0xf389('0x24')](function(){return _0x44f891;});})[_0xf389('0x24')](function(){_0x31c9e6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1127a7,_0x300558){return function(_0x41447f){if(!_0x41447f){_0x1127a7['sendStatus'](0x194);}return _0x41447f;};}function handleError(_0x1fc437,_0xa69da3){_0xa69da3=_0xa69da3||0x1f4;return function(_0x3c30db){logger[_0xf389('0x27')](_0x3c30db['stack']);if(_0x3c30db[_0xf389('0x28')]){delete _0x3c30db[_0xf389('0x28')];}_0x1fc437[_0xf389('0x1b')](_0xa69da3)[_0xf389('0x29')](_0x3c30db);};}exports[_0xf389('0x2a')]=function(_0x51e089,_0xac3d95){var _0x443729={},_0x41371c={},_0x4d0a98={'count':0x0,'rows':[]};return db[_0xf389('0x2b')]['describe']()[_0xf389('0x24')](function(_0x320621){_0x41371c[_0xf389('0x2c')]=_[_0xf389('0x2d')](_0x320621);_0x41371c['query']=_[_0xf389('0x2d')](_0x51e089[_0xf389('0x2e')]);_0x41371c[_0xf389('0x2f')]=_[_0xf389('0x30')](_0x41371c[_0xf389('0x2c')],_0x41371c[_0xf389('0x2e')]);_0x443729[_0xf389('0x31')]=_[_0xf389('0x30')](_0x41371c['model'],qs[_0xf389('0x32')](_0x51e089[_0xf389('0x2e')][_0xf389('0x32')]));_0x443729[_0xf389('0x31')]=_0x443729[_0xf389('0x31')][_0xf389('0x33')]?_0x443729[_0xf389('0x31')]:_0x41371c[_0xf389('0x2c')];if(!_0x51e089['query'][_0xf389('0x34')]('nolimit')){_0x443729[_0xf389('0x1d')]=qs[_0xf389('0x1d')](_0x51e089[_0xf389('0x2e')]['limit']);_0x443729[_0xf389('0x1f')]=qs[_0xf389('0x1f')](_0x51e089[_0xf389('0x2e')][_0xf389('0x1f')]);}_0x443729[_0xf389('0x35')]=qs[_0xf389('0x36')](_0x51e089[_0xf389('0x2e')]['sort']);_0x443729[_0xf389('0x37')]=qs[_0xf389('0x2f')](_[_0xf389('0x38')](_0x51e089[_0xf389('0x2e')],_0x41371c['filters']),_0x320621);if(_0x51e089[_0xf389('0x2e')]['filter']){_0x443729[_0xf389('0x37')]=_[_0xf389('0x39')](_0x443729[_0xf389('0x37')],{'$or':_['map'](_0x443729[_0xf389('0x31')],function(_0x3e5b89){var _0x59c03d={};_0x59c03d[_0x3e5b89]={'$like':'%'+_0x51e089[_0xf389('0x2e')][_0xf389('0x3a')]+'%'};return _0x59c03d;})});}_0x443729=_[_0xf389('0x39')]({},_0x443729,_0x51e089[_0xf389('0x3b')]);var _0x489eec={'where':_0x443729['where']};return db[_0xf389('0x2b')][_0xf389('0x1e')](_0x489eec)[_0xf389('0x24')](function(_0x2c107e){_0x4d0a98['count']=_0x2c107e;if(_0x51e089[_0xf389('0x2e')][_0xf389('0x3c')]){_0x443729[_0xf389('0x3d')]=[{'all':!![]}];}return db[_0xf389('0x2b')][_0xf389('0x3e')](_0x443729);})[_0xf389('0x24')](function(_0x4e9eb5){_0x4d0a98[_0xf389('0x3f')]=_0x4e9eb5;return _0x4d0a98;})[_0xf389('0x24')](respondWithFilteredResult(_0xac3d95,_0x443729))['catch'](handleError(_0xac3d95,null));})[_0xf389('0x40')](handleError(_0xac3d95,null));};exports[_0xf389('0x41')]=function(_0x4e67a6,_0x26ea8d){var _0x5301c9={'raw':![],'where':{'id':_0x4e67a6[_0xf389('0x42')]['id']}},_0x22b7f2={};_0x22b7f2[_0xf389('0x2c')]=_['keys'](db[_0xf389('0x2b')][_0xf389('0x43')]);_0x22b7f2['query']=_[_0xf389('0x2d')](_0x4e67a6[_0xf389('0x2e')]);_0x22b7f2[_0xf389('0x2f')]=_[_0xf389('0x30')](_0x22b7f2[_0xf389('0x2c')],_0x22b7f2['query']);_0x5301c9[_0xf389('0x31')]=_[_0xf389('0x30')](_0x22b7f2[_0xf389('0x2c')],qs[_0xf389('0x32')](_0x4e67a6[_0xf389('0x2e')][_0xf389('0x32')]));_0x5301c9['attributes']=_0x5301c9[_0xf389('0x31')][_0xf389('0x33')]?_0x5301c9[_0xf389('0x31')]:_0x22b7f2[_0xf389('0x2c')];if(_0x4e67a6[_0xf389('0x2e')][_0xf389('0x3c')]){_0x5301c9[_0xf389('0x3d')]=[{'all':!![]}];}_0x5301c9=_[_0xf389('0x39')]({},_0x5301c9,_0x4e67a6[_0xf389('0x3b')]);return db[_0xf389('0x2b')][_0xf389('0x44')](_0x5301c9)[_0xf389('0x24')](handleEntityNotFound(_0x26ea8d,null))[_0xf389('0x24')](respondWithResult(_0x26ea8d,null))[_0xf389('0x40')](handleError(_0x26ea8d,null));};exports[_0xf389('0x45')]=function(_0x233904,_0x45fda2){return db[_0xf389('0x2b')][_0xf389('0x45')](_0x233904[_0xf389('0x46')],{})['then'](function(_0xc4c48){var _0x333c67=_0x233904[_0xf389('0x47')][_0xf389('0x48')]({'plain':!![]});if(!_0x333c67)throw new Error(_0xf389('0x49'));if(_0x333c67[_0xf389('0x4a')]===_0xf389('0x47')){var _0x333ff5=_0xc4c48[_0xf389('0x48')]({'plain':!![]});var _0x276312=_0xf389('0x4b');return db[_0xf389('0x4c')]['find']({'where':{'name':_0x276312,'userProfileId':_0x333c67['userProfileId']},'raw':!![]})[_0xf389('0x24')](function(_0x45eea8){if(_0x45eea8&&_0x45eea8[_0xf389('0x4d')]===0x0){return db[_0xf389('0x26')]['create']({'name':_0x333ff5[_0xf389('0x28')],'resourceId':_0x333ff5['id'],'type':_0x45eea8['name'],'sectionId':_0x45eea8['id']},{})[_0xf389('0x24')](function(){return _0xc4c48;});}else{return _0xc4c48;}})[_0xf389('0x40')](function(_0x519721){logger[_0xf389('0x27')](_0xf389('0x4e'),_0x519721);throw _0x519721;});}return _0xc4c48;})['then'](respondWithResult(_0x45fda2,0xc9))[_0xf389('0x40')](handleError(_0x45fda2,null));};exports[_0xf389('0x4f')]=function(_0xdbf77f,_0x498429){if(_0xdbf77f[_0xf389('0x46')]['id']){delete _0xdbf77f['body']['id'];}return db[_0xf389('0x2b')][_0xf389('0x44')]({'where':{'id':_0xdbf77f[_0xf389('0x42')]['id']}})['then'](handleEntityNotFound(_0x498429,null))[_0xf389('0x24')](saveUpdates(_0xdbf77f[_0xf389('0x46')],null))[_0xf389('0x24')](respondWithResult(_0x498429,null))[_0xf389('0x40')](handleError(_0x498429,null));};exports[_0xf389('0x25')]=function(_0x28ce40,_0x418536){return db[_0xf389('0x2b')]['find']({'where':{'id':_0x28ce40[_0xf389('0x42')]['id']}})[_0xf389('0x24')](handleEntityNotFound(_0x418536,null))[_0xf389('0x24')](removeEntity(_0x418536,null))['catch'](handleError(_0x418536,null));};exports[_0xf389('0x50')]=function(_0x361667,_0x5dc590){return db['CmCompany'][_0xf389('0x50')]()[_0xf389('0x24')](respondWithResult(_0x5dc590,null))['catch'](handleError(_0x5dc590,null));};exports[_0xf389('0x51')]=function(_0x327323,_0x11a76c,_0x908c50){return db[_0xf389('0x52')]['find']({'where':{'id':_0x327323['params']['id']}})[_0xf389('0x24')](handleEntityNotFound(_0x11a76c,null))['then'](function(_0x577012){if(_0x577012){return _0x577012[_0xf389('0x51')](_0x327323[_0xf389('0x46')][_0xf389('0x53')],_[_0xf389('0x54')](_0x327323[_0xf389('0x46')],[_0xf389('0x53'),'id'])||{});}})[_0xf389('0x24')](respondWithResult(_0x11a76c,null))[_0xf389('0x40')](handleError(_0x11a76c,null));};exports[_0xf389('0x55')]=function(_0x32beb6,_0x5a233d,_0x14f147){var _0x2209fc={};var _0x3e24ae={};var _0x95d1b9;var _0x14132c;return db[_0xf389('0x2b')]['findOne']({'where':{'id':_0x32beb6['params']['id']}})[_0xf389('0x24')](handleEntityNotFound(_0x5a233d,null))[_0xf389('0x24')](function(_0x416080){if(_0x416080){_0x95d1b9=_0x416080;_0x3e24ae['model']=_[_0xf389('0x2d')](db[_0xf389('0x52')][_0xf389('0x43')]);_0x3e24ae[_0xf389('0x2e')]=_['keys'](_0x32beb6[_0xf389('0x2e')]);_0x3e24ae['filters']=_[_0xf389('0x30')](_0x3e24ae[_0xf389('0x2c')],_0x3e24ae['query']);_0x2209fc[_0xf389('0x31')]=_[_0xf389('0x30')](_0x3e24ae[_0xf389('0x2c')],qs[_0xf389('0x32')](_0x32beb6[_0xf389('0x2e')][_0xf389('0x32')]));_0x2209fc['attributes']=_0x2209fc[_0xf389('0x31')][_0xf389('0x33')]?_0x2209fc[_0xf389('0x31')]:_0x3e24ae[_0xf389('0x2c')];_0x2209fc[_0xf389('0x35')]=qs[_0xf389('0x36')](_0x32beb6['query'][_0xf389('0x36')]);_0x2209fc[_0xf389('0x37')]=qs[_0xf389('0x2f')](_[_0xf389('0x38')](_0x32beb6['query'],_0x3e24ae[_0xf389('0x2f')]));if(_0x32beb6[_0xf389('0x2e')][_0xf389('0x3a')]){_0x2209fc[_0xf389('0x37')]=_['merge'](_0x2209fc[_0xf389('0x37')],{'$or':_[_0xf389('0x56')](_0x2209fc[_0xf389('0x31')],function(_0x3702a6){var _0x117bd3={};_0x117bd3[_0x3702a6]={'$like':'%'+_0x32beb6['query']['filter']+'%'};return _0x117bd3;})});}_0x2209fc=_[_0xf389('0x39')]({},_0x2209fc,_0x32beb6[_0xf389('0x3b')]);return _0x95d1b9['getContacts'](_0x2209fc);}})[_0xf389('0x24')](function(_0x3cfb09){if(_0x3cfb09){_0x14132c=_0x3cfb09[_0xf389('0x33')];if(!_0x32beb6['query'][_0xf389('0x34')](_0xf389('0x57'))){_0x2209fc[_0xf389('0x1d')]=qs[_0xf389('0x1d')](_0x32beb6['query'][_0xf389('0x1d')]);_0x2209fc['offset']=qs[_0xf389('0x1f')](_0x32beb6[_0xf389('0x2e')][_0xf389('0x1f')]);}return _0x95d1b9[_0xf389('0x55')](_0x2209fc);}})['then'](function(_0x3c834c){if(_0x3c834c){return _0x3c834c?{'count':_0x14132c,'rows':_0x3c834c}:null;}})[_0xf389('0x24')](respondWithResult(_0x5a233d,null))['catch'](handleError(_0x5a233d,null));}; \ No newline at end of file +var _0x86db=['ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','Companies','then','error','stack','name','send','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','options','include','findAll','rows','catch','show','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addContacts','CmContact','ids','getContacts','findOne','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv'];(function(_0x104caf,_0x51ab3b){var _0x16d1e0=function(_0x513a67){while(--_0x513a67){_0x104caf['push'](_0x104caf['shift']());}};_0x16d1e0(++_0x51ab3b);}(_0x86db,0xec));var _0xb86d=function(_0x58fa7f,_0x4ed6e3){_0x58fa7f=_0x58fa7f-0x0;var _0x526007=_0x86db[_0x58fa7f];return _0x526007;};'use strict';var emlformat=require(_0xb86d('0x0'));var rimraf=require(_0xb86d('0x1'));var zipdir=require(_0xb86d('0x2'));var jsonpatch=require(_0xb86d('0x3'));var rp=require(_0xb86d('0x4'));var moment=require(_0xb86d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb86d('0x6'));var util=require(_0xb86d('0x7'));var path=require(_0xb86d('0x8'));var sox=require('sox');var csv=require(_0xb86d('0x9'));var ejs=require(_0xb86d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb86d('0xb'));var crypto=require(_0xb86d('0xc'));var jsforce=require(_0xb86d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb86d('0x9'));var querystring=require('querystring');var Papa=require(_0xb86d('0xe'));var Redis=require('ioredis');var authService=require(_0xb86d('0xf'));var qs=require(_0xb86d('0x10'));var as=require(_0xb86d('0x11'));var hardwareService=require(_0xb86d('0x12'));var logger=require(_0xb86d('0x13'))(_0xb86d('0x14'));var utils=require(_0xb86d('0x15'));var config=require(_0xb86d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb86d('0x17'))['db'];function respondWithStatusCode(_0x444850,_0x2da8c8){_0x2da8c8=_0x2da8c8||0xcc;return function(_0x5df669){if(_0x5df669){return _0x444850[_0xb86d('0x18')](_0x2da8c8);}return _0x444850[_0xb86d('0x19')](_0x2da8c8)[_0xb86d('0x1a')]();};}function respondWithResult(_0x34d877,_0x10a6c8){_0x10a6c8=_0x10a6c8||0xc8;return function(_0x50a7fd){if(_0x50a7fd){return _0x34d877['status'](_0x10a6c8)[_0xb86d('0x1b')](_0x50a7fd);}};}function respondWithFilteredResult(_0x47bd6f,_0x599fc5){return function(_0x227a37){if(_0x227a37){var _0x3e76cc=typeof _0x599fc5[_0xb86d('0x1c')]==='undefined'&&typeof _0x599fc5[_0xb86d('0x1d')]===_0xb86d('0x1e');var _0x5695a2=_0x227a37[_0xb86d('0x1f')];var _0x4bc461=_0x3e76cc?0x0:_0x599fc5['offset'];var _0x4c6da6=_0x3e76cc?_0x227a37['count']:_0x599fc5['offset']+_0x599fc5['limit'];var _0x2bb10c;if(_0x4c6da6>=_0x5695a2){_0x4c6da6=_0x5695a2;_0x2bb10c=0xc8;}else{_0x2bb10c=0xce;}_0x47bd6f[_0xb86d('0x19')](_0x2bb10c);return _0x47bd6f[_0xb86d('0x20')](_0xb86d('0x21'),_0x4bc461+'-'+_0x4c6da6+'/'+_0x5695a2)[_0xb86d('0x1b')](_0x227a37);}return null;};}function patchUpdates(_0x5ef37f){return function(_0xc304e6){try{jsonpatch['apply'](_0xc304e6,_0x5ef37f,!![]);}catch(_0x3ecc54){return BPromise['reject'](_0x3ecc54);}return _0xc304e6['save']();};}function saveUpdates(_0x4083a4,_0x21d8fe){return function(_0x5d3c98){if(_0x5d3c98){return _0x5d3c98[_0xb86d('0x22')](_0x4083a4)['then'](function(_0x210a38){return _0x210a38;});}return null;};}function removeEntity(_0x1be56a,_0x3a246e){return function(_0xce7930){if(_0xce7930){return _0xce7930['destroy']()['then'](function(){var _0x33a67a=_0xce7930['get']({'plain':!![]});var _0x29527d=_0xb86d('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x29527d,'resourceId':_0x33a67a['id']}})['then'](function(){return _0xce7930;});})[_0xb86d('0x24')](function(){_0x1be56a[_0xb86d('0x19')](0xcc)[_0xb86d('0x1a')]();});}};}function handleEntityNotFound(_0x40187d,_0x5925fc){return function(_0x265325){if(!_0x265325){_0x40187d[_0xb86d('0x18')](0x194);}return _0x265325;};}function handleError(_0x49dcf2,_0x1e5f38){_0x1e5f38=_0x1e5f38||0x1f4;return function(_0x5f1f07){logger[_0xb86d('0x25')](_0x5f1f07[_0xb86d('0x26')]);if(_0x5f1f07['name']){delete _0x5f1f07[_0xb86d('0x27')];}_0x49dcf2[_0xb86d('0x19')](_0x1e5f38)[_0xb86d('0x28')](_0x5f1f07);};}exports['index']=function(_0x3c4323,_0x3f553b){var _0x53bfcf={},_0x481fd0={},_0xdf630f={'count':0x0,'rows':[]};return db[_0xb86d('0x29')]['describe']()[_0xb86d('0x24')](function(_0x6d9428){_0x481fd0[_0xb86d('0x2a')]=_[_0xb86d('0x2b')](_0x6d9428);_0x481fd0['query']=_[_0xb86d('0x2b')](_0x3c4323[_0xb86d('0x2c')]);_0x481fd0[_0xb86d('0x2d')]=_[_0xb86d('0x2e')](_0x481fd0['model'],_0x481fd0['query']);_0x53bfcf[_0xb86d('0x2f')]=_[_0xb86d('0x2e')](_0x481fd0[_0xb86d('0x2a')],qs['fields'](_0x3c4323['query'][_0xb86d('0x30')]));_0x53bfcf[_0xb86d('0x2f')]=_0x53bfcf[_0xb86d('0x2f')][_0xb86d('0x31')]?_0x53bfcf['attributes']:_0x481fd0['model'];if(!_0x3c4323[_0xb86d('0x2c')][_0xb86d('0x32')](_0xb86d('0x33'))){_0x53bfcf[_0xb86d('0x1d')]=qs[_0xb86d('0x1d')](_0x3c4323['query'][_0xb86d('0x1d')]);_0x53bfcf[_0xb86d('0x1c')]=qs[_0xb86d('0x1c')](_0x3c4323['query'][_0xb86d('0x1c')]);}_0x53bfcf[_0xb86d('0x34')]=qs[_0xb86d('0x35')](_0x3c4323['query']['sort']);_0x53bfcf[_0xb86d('0x36')]=qs[_0xb86d('0x2d')](_['pick'](_0x3c4323[_0xb86d('0x2c')],_0x481fd0[_0xb86d('0x2d')]),_0x6d9428);if(_0x3c4323['query'][_0xb86d('0x37')]){_0x53bfcf['where']=_[_0xb86d('0x38')](_0x53bfcf[_0xb86d('0x36')],{'$or':_[_0xb86d('0x39')](_0x53bfcf['attributes'],function(_0x17c0c5){var _0x103905={};_0x103905[_0x17c0c5]={'$like':'%'+_0x3c4323['query']['filter']+'%'};return _0x103905;})});}_0x53bfcf=_[_0xb86d('0x38')]({},_0x53bfcf,_0x3c4323[_0xb86d('0x3a')]);var _0x5eb7c7={'where':_0x53bfcf['where']};return db['CmCompany'][_0xb86d('0x1f')](_0x5eb7c7)[_0xb86d('0x24')](function(_0x5db890){_0xdf630f['count']=_0x5db890;if(_0x3c4323['query']['includeAll']){_0x53bfcf[_0xb86d('0x3b')]=[{'all':!![]}];}return db[_0xb86d('0x29')][_0xb86d('0x3c')](_0x53bfcf);})['then'](function(_0x26cc37){_0xdf630f[_0xb86d('0x3d')]=_0x26cc37;return _0xdf630f;})[_0xb86d('0x24')](respondWithFilteredResult(_0x3f553b,_0x53bfcf))[_0xb86d('0x3e')](handleError(_0x3f553b,null));})[_0xb86d('0x3e')](handleError(_0x3f553b,null));};exports[_0xb86d('0x3f')]=function(_0x3210da,_0x374128){var _0x3f9383={'raw':![],'where':{'id':_0x3210da['params']['id']}},_0x9175fa={};_0x9175fa[_0xb86d('0x2a')]=_['keys'](db[_0xb86d('0x29')][_0xb86d('0x40')]);_0x9175fa[_0xb86d('0x2c')]=_['keys'](_0x3210da[_0xb86d('0x2c')]);_0x9175fa['filters']=_['intersection'](_0x9175fa[_0xb86d('0x2a')],_0x9175fa['query']);_0x3f9383[_0xb86d('0x2f')]=_[_0xb86d('0x2e')](_0x9175fa[_0xb86d('0x2a')],qs[_0xb86d('0x30')](_0x3210da[_0xb86d('0x2c')]['fields']));_0x3f9383['attributes']=_0x3f9383[_0xb86d('0x2f')][_0xb86d('0x31')]?_0x3f9383['attributes']:_0x9175fa[_0xb86d('0x2a')];if(_0x3210da[_0xb86d('0x2c')]['includeAll']){_0x3f9383[_0xb86d('0x3b')]=[{'all':!![]}];}_0x3f9383=_[_0xb86d('0x38')]({},_0x3f9383,_0x3210da[_0xb86d('0x3a')]);return db[_0xb86d('0x29')][_0xb86d('0x41')](_0x3f9383)[_0xb86d('0x24')](handleEntityNotFound(_0x374128,null))[_0xb86d('0x24')](respondWithResult(_0x374128,null))[_0xb86d('0x3e')](handleError(_0x374128,null));};exports['create']=function(_0x28f376,_0x508cd5){return db[_0xb86d('0x29')][_0xb86d('0x42')](_0x28f376[_0xb86d('0x43')],{})['then'](function(_0x597c23){var _0x4ba905=_0x28f376['user']['get']({'plain':!![]});if(!_0x4ba905)throw new Error(_0xb86d('0x44'));if(_0x4ba905[_0xb86d('0x45')]===_0xb86d('0x46')){var _0x62584c=_0x597c23[_0xb86d('0x47')]({'plain':!![]});var _0x416fd6='Companies';return db['UserProfileSection'][_0xb86d('0x41')]({'where':{'name':_0x416fd6,'userProfileId':_0x4ba905['userProfileId']},'raw':!![]})['then'](function(_0x3c5b5e){if(_0x3c5b5e&&_0x3c5b5e[_0xb86d('0x48')]===0x0){return db['UserProfileResource'][_0xb86d('0x42')]({'name':_0x62584c['name'],'resourceId':_0x62584c['id'],'type':_0x3c5b5e[_0xb86d('0x27')],'sectionId':_0x3c5b5e['id']},{})['then'](function(){return _0x597c23;});}else{return _0x597c23;}})[_0xb86d('0x3e')](function(_0x448c3b){logger['error'](_0xb86d('0x49'),_0x448c3b);throw _0x448c3b;});}return _0x597c23;})['then'](respondWithResult(_0x508cd5,0xc9))['catch'](handleError(_0x508cd5,null));};exports[_0xb86d('0x22')]=function(_0x507f41,_0xd12806){if(_0x507f41['body']['id']){delete _0x507f41['body']['id'];}return db[_0xb86d('0x29')][_0xb86d('0x41')]({'where':{'id':_0x507f41[_0xb86d('0x4a')]['id']}})['then'](handleEntityNotFound(_0xd12806,null))[_0xb86d('0x24')](saveUpdates(_0x507f41['body'],null))[_0xb86d('0x24')](respondWithResult(_0xd12806,null))[_0xb86d('0x3e')](handleError(_0xd12806,null));};exports['destroy']=function(_0x4d4dce,_0x13c8ae){return db['CmCompany'][_0xb86d('0x41')]({'where':{'id':_0x4d4dce['params']['id']}})['then'](handleEntityNotFound(_0x13c8ae,null))['then'](removeEntity(_0x13c8ae,null))[_0xb86d('0x3e')](handleError(_0x13c8ae,null));};exports[_0xb86d('0x4b')]=function(_0x53fb57,_0x122c9d){return db[_0xb86d('0x29')][_0xb86d('0x4b')]()[_0xb86d('0x24')](respondWithResult(_0x122c9d,null))[_0xb86d('0x3e')](handleError(_0x122c9d,null));};exports[_0xb86d('0x4c')]=function(_0x35ee63,_0x284489,_0x4a7ef6){return db[_0xb86d('0x4d')][_0xb86d('0x41')]({'where':{'id':_0x35ee63['params']['id']}})[_0xb86d('0x24')](handleEntityNotFound(_0x284489,null))[_0xb86d('0x24')](function(_0xe710a8){if(_0xe710a8){return _0xe710a8[_0xb86d('0x4c')](_0x35ee63[_0xb86d('0x43')][_0xb86d('0x4e')],_['omit'](_0x35ee63[_0xb86d('0x43')],['ids','id'])||{});}})[_0xb86d('0x24')](respondWithResult(_0x284489,null))[_0xb86d('0x3e')](handleError(_0x284489,null));};exports[_0xb86d('0x4f')]=function(_0x96e9f0,_0x4f0614,_0xb2bc3d){var _0x553024={};var _0xa7c3fa={};var _0xb217be;var _0x12c7ee;return db[_0xb86d('0x29')][_0xb86d('0x50')]({'where':{'id':_0x96e9f0['params']['id']}})['then'](handleEntityNotFound(_0x4f0614,null))['then'](function(_0x697f5a){if(_0x697f5a){_0xb217be=_0x697f5a;_0xa7c3fa[_0xb86d('0x2a')]=_[_0xb86d('0x2b')](db[_0xb86d('0x4d')][_0xb86d('0x40')]);_0xa7c3fa[_0xb86d('0x2c')]=_[_0xb86d('0x2b')](_0x96e9f0['query']);_0xa7c3fa['filters']=_['intersection'](_0xa7c3fa[_0xb86d('0x2a')],_0xa7c3fa['query']);_0x553024[_0xb86d('0x2f')]=_[_0xb86d('0x2e')](_0xa7c3fa[_0xb86d('0x2a')],qs[_0xb86d('0x30')](_0x96e9f0[_0xb86d('0x2c')]['fields']));_0x553024[_0xb86d('0x2f')]=_0x553024[_0xb86d('0x2f')]['length']?_0x553024[_0xb86d('0x2f')]:_0xa7c3fa[_0xb86d('0x2a')];_0x553024[_0xb86d('0x34')]=qs['sort'](_0x96e9f0[_0xb86d('0x2c')][_0xb86d('0x35')]);_0x553024[_0xb86d('0x36')]=qs['filters'](_[_0xb86d('0x51')](_0x96e9f0[_0xb86d('0x2c')],_0xa7c3fa[_0xb86d('0x2d')]));if(_0x96e9f0[_0xb86d('0x2c')][_0xb86d('0x37')]){_0x553024[_0xb86d('0x36')]=_[_0xb86d('0x38')](_0x553024[_0xb86d('0x36')],{'$or':_[_0xb86d('0x39')](_0x553024[_0xb86d('0x2f')],function(_0x3fd645){var _0x12c73a={};_0x12c73a[_0x3fd645]={'$like':'%'+_0x96e9f0[_0xb86d('0x2c')][_0xb86d('0x37')]+'%'};return _0x12c73a;})});}_0x553024=_['merge']({},_0x553024,_0x96e9f0['options']);return _0xb217be['getContacts'](_0x553024);}})[_0xb86d('0x24')](function(_0x43f302){if(_0x43f302){_0x12c7ee=_0x43f302[_0xb86d('0x31')];if(!_0x96e9f0[_0xb86d('0x2c')][_0xb86d('0x32')]('nolimit')){_0x553024[_0xb86d('0x1d')]=qs['limit'](_0x96e9f0['query']['limit']);_0x553024['offset']=qs[_0xb86d('0x1c')](_0x96e9f0[_0xb86d('0x2c')][_0xb86d('0x1c')]);}return _0xb217be[_0xb86d('0x4f')](_0x553024);}})[_0xb86d('0x24')](function(_0x353897){if(_0x353897){return _0x353897?{'count':_0x12c7ee,'rows':_0x353897}:null;}})['then'](respondWithResult(_0x4f0614,null))[_0xb86d('0x3e')](handleError(_0x4f0614,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 595e325..ab62b2b 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 _0x15ff=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','CmCompany','cm_companies','util','../../config/logger','api'];(function(_0x4ee23c,_0x81eb23){var _0x1c5772=function(_0x2cd653){while(--_0x2cd653){_0x4ee23c['push'](_0x4ee23c['shift']());}};_0x1c5772(++_0x81eb23);}(_0x15ff,0x1dd));var _0xf15f=function(_0x54af5c,_0x21792f){_0x54af5c=_0x54af5c-0x0;var _0x4a0c95=_0x15ff[_0x54af5c];return _0x4a0c95;};'use strict';var _=require('lodash');var util=require(_0xf15f('0x0'));var logger=require(_0xf15f('0x1'))(_0xf15f('0x2'));var moment=require(_0xf15f('0x3'));var BPromise=require(_0xf15f('0x4'));var rp=require(_0xf15f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf15f('0x6'));var config=require(_0xf15f('0x7'));var attributes=require('./cmCompany.attributes');module[_0xf15f('0x8')]=function(_0x533b68,_0x4d55c0){return _0x533b68[_0xf15f('0x9')](_0xf15f('0xa'),attributes,{'tableName':_0xf15f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb509=['../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x511003,_0x3f34a7){var _0x379817=function(_0x41bb71){while(--_0x41bb71){_0x511003['push'](_0x511003['shift']());}};_0x379817(++_0x3f34a7);}(_0xb509,0x165));var _0x9b50=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xb509[_0x45bf86];return _0x1f02b7;};'use strict';var _=require(_0x9b50('0x0'));var util=require(_0x9b50('0x1'));var logger=require(_0x9b50('0x2'))('api');var moment=require(_0x9b50('0x3'));var BPromise=require(_0x9b50('0x4'));var rp=require(_0x9b50('0x5'));var fs=require('fs');var path=require(_0x9b50('0x6'));var rimraf=require('rimraf');var config=require(_0x9b50('0x7'));var attributes=require(_0x9b50('0x8'));module[_0x9b50('0x9')]=function(_0xc819,_0x12cc49){return _0xc819[_0x9b50('0xa')](_0x9b50('0xb'),attributes,{'tableName':_0x9b50('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 a07ff60..3b6a5e2 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 _0x443e=['request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','CmCompany,\x20%s,\x20%s'];(function(_0x53e531,_0x28658f){var _0x51e130=function(_0x4ada37){while(--_0x4ada37){_0x53e531['push'](_0x53e531['shift']());}};_0x51e130(++_0x28658f);}(_0x443e,0x127));var _0xe443=function(_0xe1b5f6,_0x210c09){_0xe1b5f6=_0xe1b5f6-0x0;var _0x44636e=_0x443e[_0xe1b5f6];return _0x44636e;};'use strict';var _=require(_0xe443('0x0'));var util=require(_0xe443('0x1'));var moment=require(_0xe443('0x2'));var BPromise=require(_0xe443('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe443('0x4'));var db=require(_0xe443('0x5'))['db'];var utils=require(_0xe443('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe443('0x7'));var jayson=require(_0xe443('0x8'));var client=jayson[_0xe443('0x9')][_0xe443('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16b2c0,_0xe0681b,_0x2533c0){return new BPromise(function(_0x3f7548,_0x349031){return client[_0xe443('0xb')](_0x16b2c0,_0x2533c0)['then'](function(_0x5a3c68){logger['info'](_0xe443('0xc'),_0xe0681b,_0xe443('0xd'));logger[_0xe443('0xe')](_0xe443('0xf'),_0xe0681b,_0xe443('0xd'),JSON[_0xe443('0x10')](_0x5a3c68));if(_0x5a3c68[_0xe443('0x11')]){if(_0x5a3c68['error'][_0xe443('0x12')]===0x1f4){logger[_0xe443('0x11')](_0xe443('0xc'),_0xe0681b,_0x5a3c68[_0xe443('0x11')][_0xe443('0x13')]);return _0x349031(_0x5a3c68[_0xe443('0x11')][_0xe443('0x13')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0xe0681b,_0x5a3c68[_0xe443('0x11')]['message']);return _0x3f7548(_0x5a3c68[_0xe443('0x11')][_0xe443('0x13')]);}else{logger['info'](_0xe443('0xc'),_0xe0681b,_0xe443('0xd'));_0x3f7548(_0x5a3c68[_0xe443('0x14')][_0xe443('0x13')]);}})[_0xe443('0x15')](function(_0x533c6c){logger[_0xe443('0x11')]('CmCompany,\x20%s,\x20%s',_0xe0681b,_0x533c6c);_0x349031(_0x533c6c);});});} \ No newline at end of file +var _0x05a9=['randomstring','../../config/logger','jayson/promise','client','http','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird'];(function(_0x5db626,_0x4c3f96){var _0x3fcfd5=function(_0x2dfe42){while(--_0x2dfe42){_0x5db626['push'](_0x5db626['shift']());}};_0x3fcfd5(++_0x4c3f96);}(_0x05a9,0x177));var _0x905a=function(_0x355c5e,_0x515f18){_0x355c5e=_0x355c5e-0x0;var _0x3b7b5d=_0x05a9[_0x355c5e];return _0x3b7b5d;};'use strict';var _=require(_0x905a('0x0'));var util=require('util');var moment=require(_0x905a('0x1'));var BPromise=require(_0x905a('0x2'));var rs=require(_0x905a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x905a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x905a('0x5'));var client=jayson[_0x905a('0x6')][_0x905a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x42abe2,_0x27c8e3,_0x1ab42f){return new BPromise(function(_0x595c15,_0x1d30a1){return client['request'](_0x42abe2,_0x1ab42f)['then'](function(_0x38b333){logger['info'](_0x905a('0x8'),_0x27c8e3,_0x905a('0x9'));logger[_0x905a('0xa')](_0x905a('0xb'),_0x27c8e3,_0x905a('0x9'),JSON[_0x905a('0xc')](_0x38b333));if(_0x38b333['error']){if(_0x38b333[_0x905a('0xd')][_0x905a('0xe')]===0x1f4){logger[_0x905a('0xd')]('CmCompany,\x20%s,\x20%s',_0x27c8e3,_0x38b333['error'][_0x905a('0xf')]);return _0x1d30a1(_0x38b333[_0x905a('0xd')][_0x905a('0xf')]);}logger['error'](_0x905a('0x8'),_0x27c8e3,_0x38b333[_0x905a('0xd')]['message']);return _0x595c15(_0x38b333[_0x905a('0xd')][_0x905a('0xf')]);}else{logger[_0x905a('0x10')](_0x905a('0x8'),_0x27c8e3,_0x905a('0x9'));_0x595c15(_0x38b333['result']['message']);}})[_0x905a('0x11')](function(_0x5761f1){logger['error']('CmCompany,\x20%s,\x20%s',_0x27c8e3,_0x5761f1);_0x1d30a1(_0x5761f1);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index e7e5844..2ef8361 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 _0x0f60=['./cmCompany.controller','get','isAuthenticated','index','/describe','/:id/contacts','getContacts','post','addContacts','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x0f60,0x1f1));var _0x00f6=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x0f60[_0x2f71f6];return _0x2b23ea;};'use strict';var multer=require(_0x00f6('0x0'));var util=require(_0x00f6('0x1'));var path=require(_0x00f6('0x2'));var timeout=require(_0x00f6('0x3'));var express=require('express');var router=express[_0x00f6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x00f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x00f6('0x6'));var controller=require(_0x00f6('0x7'));router[_0x00f6('0x8')]('/',auth[_0x00f6('0x9')](),controller[_0x00f6('0xa')]);router[_0x00f6('0x8')](_0x00f6('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x00f6('0x8')]('/:id',auth[_0x00f6('0x9')](),controller['show']);router[_0x00f6('0x8')](_0x00f6('0xc'),auth[_0x00f6('0x9')](),controller[_0x00f6('0xd')]);router[_0x00f6('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x00f6('0xe')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x00f6('0xf')]);router[_0x00f6('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x00f6('0x11')]);router['delete'](_0x00f6('0x12'),auth['isAuthenticated'](),controller[_0x00f6('0x13')]);module[_0x00f6('0x14')]=router; \ No newline at end of file +var _0x7429=['create','addContacts','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','describe','/:id','show','getContacts'];(function(_0x19931c,_0x307479){var _0x1cadca=function(_0x1d1f14){while(--_0x1d1f14){_0x19931c['push'](_0x19931c['shift']());}};_0x1cadca(++_0x307479);}(_0x7429,0xc3));var _0x9742=function(_0x409f91,_0x3c7abe){_0x409f91=_0x409f91-0x0;var _0x2b738a=_0x7429[_0x409f91];return _0x2b738a;};'use strict';var multer=require(_0x9742('0x0'));var util=require(_0x9742('0x1'));var path=require(_0x9742('0x2'));var timeout=require(_0x9742('0x3'));var express=require('express');var router=express[_0x9742('0x4')]();var fs_extra=require(_0x9742('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9742('0x6'));var controller=require(_0x9742('0x7'));router[_0x9742('0x8')]('/',auth[_0x9742('0x9')](),controller[_0x9742('0xa')]);router['get']('/describe',auth[_0x9742('0x9')](),controller[_0x9742('0xb')]);router['get'](_0x9742('0xc'),auth['isAuthenticated'](),controller[_0x9742('0xd')]);router[_0x9742('0x8')]('/:id/contacts',auth[_0x9742('0x9')](),controller[_0x9742('0xe')]);router['post']('/',auth[_0x9742('0x9')](),controller[_0x9742('0xf')]);router['post']('/:id/contacts',auth[_0x9742('0x9')](),controller[_0x9742('0x10')]);router[_0x9742('0x11')](_0x9742('0xc'),auth['isAuthenticated'](),controller[_0x9742('0x12')]);router['delete'](_0x9742('0xc'),auth[_0x9742('0x9')](),controller[_0x9742('0x13')]);module[_0x9742('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index a1efe66..7bdc2a9 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 _0xd2ce=['sequelize','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x2e2e5b,_0x56a052){var _0x1d0bdf=function(_0x421167){while(--_0x421167){_0x2e2e5b['push'](_0x2e2e5b['shift']());}};_0x1d0bdf(++_0x56a052);}(_0xd2ce,0x12f));var _0xed2c=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xd2ce[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0xed2c('0x0'));var Sequelize=require(_0xed2c('0x1'));module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xed2c('0x2')]},'street':{'type':Sequelize[_0xed2c('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xed2c('0x2')]},'country':{'type':Sequelize[_0xed2c('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xed2c('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xed2c('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xed2c('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xed2c('0x2')]},'fb_data':{'type':Sequelize[_0xed2c('0x2')]},'twitter':{'type':Sequelize[_0xed2c('0x2')]},'skype':{'type':Sequelize[_0xed2c('0x2')]},'teams':{'type':Sequelize[_0xed2c('0x2')]},'viber':{'type':Sequelize[_0xed2c('0x2')]},'line':{'type':Sequelize[_0xed2c('0x2')]},'wechat':{'type':Sequelize[_0xed2c('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0xed2c('0x4')](0x2)[_0xed2c('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xed2c('0x6')],'defaultValue':Sequelize[_0xed2c('0x7')]}}; \ No newline at end of file +var _0x7701=['exports','STRING','TEXT','UNSIGNED','DATE','NOW','sequelize'];(function(_0x3d5798,_0x2f97a4){var _0x282fd2=function(_0x376efb){while(--_0x376efb){_0x3d5798['push'](_0x3d5798['shift']());}};_0x282fd2(++_0x2f97a4);}(_0x7701,0xbc));var _0x1770=function(_0x18ce59,_0x124e24){_0x18ce59=_0x18ce59-0x0;var _0x1e0e29=_0x7701[_0x18ce59];return _0x1e0e29;};'use strict';var _=require('lodash');var Sequelize=require(_0x1770('0x0'));module[_0x1770('0x1')]={'firstName':{'type':Sequelize[_0x1770('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x1770('0x2')]},'postalCode':{'type':Sequelize[_0x1770('0x2')]},'city':{'type':Sequelize[_0x1770('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x1770('0x2')]},'description':{'type':Sequelize[_0x1770('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x1770('0x2')]},'fax':{'type':Sequelize[_0x1770('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x1770('0x2')]},'fb_data':{'type':Sequelize[_0x1770('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x1770('0x2')]},'teams':{'type':Sequelize[_0x1770('0x2')]},'viber':{'type':Sequelize[_0x1770('0x2')]},'line':{'type':Sequelize[_0x1770('0x2')]},'wechat':{'type':Sequelize[_0x1770('0x2')]},'telegram':{'type':Sequelize[_0x1770('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x1770('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x1770('0x5')],'defaultValue':Sequelize[_0x1770('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index be7f95d..e874ee8 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 _0x71de=['ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','VoiceCallReport','ChatQueueReport','FaxQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','duplicates','$or','spread','show','$and','format','params','omit','pickBy','table','setFields','id\x20=\x20?','toParam','phone','getTags','options','setTags','ids','getHoppers','rawAttributes','pick','ContactId','includeAll','include','getHopperHistories','CmHopperHistory','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','root','file','chmodSync','0777','CompanyId','json','pid','send','upload','createReadStream','parse','binding','No\x20firstName\x20column\x20specified','child_process','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','mail','chat','sms','openchannel','fax','voice','-createdAt','channel','includes','toLowerCase','range','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','callerid','starttime','endtime','note','userDisposition','UserId','fullname','createdAt','findAndCountAll','startCase','Account','closed','closedAt','disposition','thirdDisposition','key','Tags','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','Owner','all','sortBy','reverse','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','index','CmContact','keys','startsWith','push','CmCustomField','findOne','trimStart','length','cf_','type','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','field','from','tools_tags','select','left_join','uc.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','expr','search','parseSearch','sqlOperator','conditions','find','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','and','uc.UserId\x20=\x20?','dateOfBirth','castTo','text','filter','Contact','isEmpty','ListId','where','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','order','DESC','having','t.id\x20IN\x20?','resolve','user','role','agent','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','merge','c.firstName','c.lastName','c.phone','c.mobile','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','rows','catch','describe','tags','columnName','displayName','findAll','alias','custom','values','body','get','mergeWith','join','info','CmHopper','create','ChatMessage'];(function(_0x4792eb,_0x1e1aca){var _0x25fb07=function(_0x49a331){while(--_0x49a331){_0x4792eb['push'](_0x4792eb['shift']());}};_0x25fb07(++_0x1e1aca);}(_0x71de,0x7a));var _0xe71d=function(_0x483e04,_0x4add30){_0x483e04=_0x483e04-0x0;var _0x48c273=_0x71de[_0x483e04];return _0x48c273;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe71d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe71d('0x1'));var rp=require('request-promise');var moment=require(_0xe71d('0x2'));var BPromise=require(_0xe71d('0x3'));var Mustache=require(_0xe71d('0x4'));var util=require(_0xe71d('0x5'));var path=require(_0xe71d('0x6'));var sox=require('sox');var csv=require(_0xe71d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe71d('0x8'));var _=require(_0xe71d('0x9'));var squel=require(_0xe71d('0xa'));var crypto=require(_0xe71d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe71d('0xc'));var toCsv=require(_0xe71d('0x7'));var querystring=require(_0xe71d('0xd'));var Papa=require(_0xe71d('0xe'));var Redis=require('ioredis');var authService=require(_0xe71d('0xf'));var qs=require(_0xe71d('0x10'));var as=require(_0xe71d('0x11'));var hardwareService=require(_0xe71d('0x12'));var logger=require(_0xe71d('0x13'))(_0xe71d('0x14'));var utils=require(_0xe71d('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe71d('0x16'))['db'];config['redis']=_[_0xe71d('0x17')](config[_0xe71d('0x18')],{'host':_0xe71d('0x19'),'port':0x18eb});var socket=require(_0xe71d('0x1a'))(new Redis(config['redis']));require(_0xe71d('0x1b'))['register'](socket);function respondWithStatusCode(_0x57ac57,_0xf47ef4){_0xf47ef4=_0xf47ef4||0xcc;return function(_0x255816){if(_0x255816){return _0x57ac57['sendStatus'](_0xf47ef4);}return _0x57ac57[_0xe71d('0x1c')](_0xf47ef4)[_0xe71d('0x1d')]();};}function respondWithResult(_0x11e4da,_0xc4815a){_0xc4815a=_0xc4815a||0xc8;return function(_0x2790d8){if(_0x2790d8){return _0x11e4da['status'](_0xc4815a)['json'](_0x2790d8);}};}function respondWithFilteredResult(_0x2ce0d3,_0x4aa50c){return function(_0x1cf310){if(_0x1cf310){var _0x41ef34=typeof _0x4aa50c[_0xe71d('0x1e')]===_0xe71d('0x1f')&&typeof _0x4aa50c[_0xe71d('0x20')]==='undefined';var _0x2d77e6=_0x1cf310[_0xe71d('0x21')];var _0x496ea6=_0x41ef34?0x0:_0x4aa50c[_0xe71d('0x1e')];var _0x19e664=_0x41ef34?_0x1cf310[_0xe71d('0x21')]:_0x4aa50c[_0xe71d('0x1e')]+_0x4aa50c[_0xe71d('0x20')];var _0x15cea0;if(_0x19e664>=_0x2d77e6){_0x19e664=_0x2d77e6;_0x15cea0=0xc8;}else{_0x15cea0=0xce;}_0x2ce0d3[_0xe71d('0x1c')](_0x15cea0);return _0x2ce0d3['set'](_0xe71d('0x22'),_0x496ea6+'-'+_0x19e664+'/'+_0x2d77e6)['json'](_0x1cf310);}return null;};}function patchUpdates(_0x32b7f0){return function(_0x3e7e3e){try{jsonpatch[_0xe71d('0x23')](_0x3e7e3e,_0x32b7f0,!![]);}catch(_0x1e1e66){return BPromise[_0xe71d('0x24')](_0x1e1e66);}return _0x3e7e3e[_0xe71d('0x25')]();};}function saveUpdates(_0x4147d1,_0x16c954){return function(_0x390157){if(_0x390157){return _0x390157[_0xe71d('0x26')](_0x4147d1)[_0xe71d('0x27')](function(_0x66dc39){return _0x66dc39;});}return null;};}function removeEntity(_0x5702bb,_0x3e5abc){return function(_0x17a281){if(_0x17a281){return _0x17a281[_0xe71d('0x28')]()['then'](function(){_0x5702bb[_0xe71d('0x1c')](0xcc)[_0xe71d('0x1d')]();});}};}function handleEntityNotFound(_0x1da252,_0x79cba4){return function(_0x5bcddc){if(!_0x5bcddc){_0x1da252['sendStatus'](0x194);}return _0x5bcddc;};}function handleError(_0x3c1ad4,_0x40066e){_0x40066e=_0x40066e||0x1f4;return function(_0x8f3342){logger[_0xe71d('0x29')](_0x8f3342['stack']);if(_0x8f3342[_0xe71d('0x2a')]){delete _0x8f3342['name'];}_0x3c1ad4[_0xe71d('0x1c')](_0x40066e)['send'](_0x8f3342);};}exports[_0xe71d('0x2b')]=function(_0x4492c0,_0x551a2f){var _0x1ad794={},_0x3825dd={},_0x3561c6={'count':0x0,'rows':[]};return db[_0xe71d('0x2c')]['describe']()[_0xe71d('0x27')](function(_0x5c8a8d){var _0xa37986=[];for(var _0x195952=0x0;_0x1959520x1){_0x57b139['or'](_0xe71d('0x64'),qs[_0xe71d('0x65')](_0x457fee),null);}else{if(qs[_0xe71d('0x66')](_0x457fee)){_0x57b139['or'](_0xe71d('0x67'),_0x457fee+'%');_0x57b139['or'](_0xe71d('0x68'),_0x457fee+'%');_0x57b139['or'](_0xe71d('0x69'),_0x457fee+'%');_0x57b139['or'](_0xe71d('0x6a'),_0x457fee+'%');}else if(qs[_0xe71d('0x6b')](_0x457fee)){_0x57b139['or'](_0xe71d('0x6c'),_0x457fee+'%');}else{_0x57b139['or']('c.firstName\x20LIKE\x20?','%'+_0x457fee+'%');_0x57b139['or'](_0xe71d('0x6d'),'%'+_0x457fee+'%');_0x57b139['or'](_0xe71d('0x6c'),'%'+_0x457fee+'%');}}}}_0x538a2c[_0xe71d('0x5c')](_0x57b139);_0x538a2c[_0xe71d('0x6e')](_0xe71d('0x6f'));var _0x5d4835={'type':db[_0xe71d('0x70')][_0xe71d('0x71')][_0xe71d('0x72')],'raw':!![]};var _0x3af43a=_0x538a2c['clone']()['field']('c.id');if(_0x1ad794[_0xe71d('0x73')]){_0x1ad794['order'][_0xe71d('0x50')](function(_0x493b12){_0x538a2c[_0xe71d('0x73')]('c.'+_0x493b12[0x0],_0x493b12[0x1]===_0xe71d('0x74')?![]:!![]);});}if(!_[_0xe71d('0x5a')](_0x10b5db)){_0x538a2c[_0xe71d('0x75')](_0x41257e);_0x3af43a[_0xe71d('0x5c')](_0xe71d('0x76'),_0x10b5db);}BPromise[_0xe71d('0x77')]()[_0xe71d('0x27')](function(){if(!_0x3dccdf)return;if(_0x4492c0[_0xe71d('0x78')][_0xe71d('0x79')]!==_0xe71d('0x7a'))return;if(!_['some'](_0x3dccdf[_0xe71d('0x4a')],[_0xe71d('0x3f'),_0xe71d('0x52')])){return _0x4492c0[_0xe71d('0x78')][_0xe71d('0x7b')]({'attributes':['id'],'raw':!![]})[_0xe71d('0x27')](function(_0x424f5b){if(_['isEmpty'](_0x424f5b)){_0x3af43a[_0xe71d('0x5c')](_0xe71d('0x7c'));_0x538a2c[_0xe71d('0x5c')](_0xe71d('0x7c'));}else{_0x3af43a[_0xe71d('0x5c')](_0xe71d('0x5d'),_[_0xe71d('0x4f')](_0x424f5b,'id'));_0x538a2c[_0xe71d('0x5c')]('c.ListId\x20IN\x20?',_['map'](_0x424f5b,'id'));}});}})[_0xe71d('0x27')](function(){if(_0x4492c0[_0xe71d('0x78')]['role']==='agent'&&!_0x3dccdf&&!_0x4492c0[_0xe71d('0x36')]['ListId'])return[];return db[_0xe71d('0x7d')][_0xe71d('0x36')](_0x3af43a[_0xe71d('0x7e')](),_0x5d4835);})[_0xe71d('0x27')](function(_0x32071a){_0x3561c6['count']=_0x32071a[_0xe71d('0x33')];if(_0x3561c6['count']===0x0)return[];return db['sequelize']['query'](_0x49d0cd[_0xe71d('0x7e')](),_0x5d4835)[_0xe71d('0x27')](function(_0x5d9989){_0x79df4b=_['keyBy'](_0x5d9989,'id');_0x5d4835=_[_0xe71d('0x7f')](_0x5d4835,{'model':db[_0xe71d('0x2c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4492c0[_0xe71d('0x36')][_0xe71d('0x3b')]){_0x1ad794[_0xe71d('0x39')][_0xe71d('0x50')](function(_0x4c37e4){_0x538a2c[_0xe71d('0x3f')]('c.'+_0x4c37e4);});}else{_0x538a2c[_0xe71d('0x3f')](_0xe71d('0x6f'));_0x538a2c[_0xe71d('0x3f')](_0xe71d('0x80'));_0x538a2c[_0xe71d('0x3f')](_0xe71d('0x81'));_0x538a2c[_0xe71d('0x3f')](_0xe71d('0x82'));_0x538a2c[_0xe71d('0x3f')](_0xe71d('0x83'));_0x538a2c['field']('c.fax');_0x538a2c[_0xe71d('0x3f')](_0xe71d('0x84'));_0x538a2c[_0xe71d('0x3f')](_0xe71d('0x85'));_0x538a2c[_0xe71d('0x3f')](_0xe71d('0x86'));_0x538a2c[_0xe71d('0x3f')](_0xe71d('0x87'));_0x538a2c[_0xe71d('0x3f')](_0xe71d('0x88'));_0x538a2c['field'](_0xe71d('0x89'),'TagIds');}if(_0x1ad794['limit'])_0x538a2c[_0xe71d('0x20')](_0x1ad794[_0xe71d('0x20')]);if(_0x1ad794[_0xe71d('0x1e')])_0x538a2c['offset'](_0x1ad794[_0xe71d('0x1e')]);return db['sequelize'][_0xe71d('0x36')](_0x538a2c['toString'](),_0x5d4835);});})[_0xe71d('0x27')](function(_0x294e55){_0x294e55[_0xe71d('0x50')](function(_0x5173b8){if(_0x5173b8[_0xe71d('0x8a')]){_0x5173b8['Tags']=[];_0x5173b8[_0xe71d('0x8a')][_0xe71d('0x4e')](',')['forEach'](function(_0x5bed2c){_0x5173b8['Tags'][_0xe71d('0x2f')](_0x79df4b[_0x5bed2c]);});}delete _0x5173b8[_0xe71d('0x8a')];});_0x3561c6[_0xe71d('0x8b')]=_0x294e55;return _0x3561c6;})[_0xe71d('0x27')](respondWithFilteredResult(_0x551a2f,_0x1ad794));})[_0xe71d('0x8c')](handleError(_0x551a2f,null));};exports['destroy']=function(_0x541923,_0x3e038e){return db[_0xe71d('0x2c')]['find']({'where':{'id':_0x541923['params']['id']}})[_0xe71d('0x27')](handleEntityNotFound(_0x3e038e,null))[_0xe71d('0x27')](removeEntity(_0x3e038e,null))[_0xe71d('0x8c')](handleError(_0x3e038e,null));};exports[_0xe71d('0x8d')]=function(_0x35463b,_0x27c8cf){return db[_0xe71d('0x2c')]['describe']()[_0xe71d('0x27')](function(_0x57beb9){delete _0x57beb9[_0xe71d('0x8e')];for(var _0x2f0ca8=0x0;_0x2f0ca8=_0x5e2d53){_0x24076b=_0x5e2d53;_0x4845ce=0xc8;}else{_0x4845ce=0xce;}_0x597335[_0xd22c('0x17')](_0x4845ce);return _0x597335['set'](_0xd22c('0x1d'),_0x301201+'-'+_0x24076b+'/'+_0x5e2d53)[_0xd22c('0x1e')](_0x26672c);}return null;};}function patchUpdates(_0x65163b){return function(_0x2c9ff9){try{jsonpatch['apply'](_0x2c9ff9,_0x65163b,!![]);}catch(_0x4eaf89){return BPromise[_0xd22c('0x1f')](_0x4eaf89);}return _0x2c9ff9[_0xd22c('0x20')]();};}function saveUpdates(_0x786cf0,_0xb3b004){return function(_0x303818){if(_0x303818){return _0x303818[_0xd22c('0x21')](_0x786cf0)[_0xd22c('0x22')](function(_0x19493c){return _0x19493c;});}return null;};}function removeEntity(_0x542f05,_0x22e1fe){return function(_0x3f6538){if(_0x3f6538){return _0x3f6538[_0xd22c('0x23')]()[_0xd22c('0x22')](function(){_0x542f05['status'](0xcc)[_0xd22c('0x18')]();});}};}function handleEntityNotFound(_0x3adee2,_0x4ef674){return function(_0x5cb012){if(!_0x5cb012){_0x3adee2['sendStatus'](0x194);}return _0x5cb012;};}function handleError(_0x1ce6a6,_0x542f7c){_0x542f7c=_0x542f7c||0x1f4;return function(_0x437fe8){logger[_0xd22c('0x24')](_0x437fe8[_0xd22c('0x25')]);if(_0x437fe8['name']){delete _0x437fe8[_0xd22c('0x26')];}_0x1ce6a6[_0xd22c('0x17')](_0x542f7c)[_0xd22c('0x27')](_0x437fe8);};}exports[_0xd22c('0x28')]=function(_0x215b49,_0x2c6a4b){var _0x5a1919={},_0x134d06={},_0x21dd58={'count':0x0,'rows':[]};return db[_0xd22c('0x29')][_0xd22c('0x2a')]()['then'](function(_0x243172){var _0xa16548=[];for(var _0x3aef93=0x0;_0x3aef930x1){_0x27add2['or'](_0xd22c('0x65'),qs[_0xd22c('0x66')](_0xcc9356),null);}else{if(qs[_0xd22c('0x67')](_0xcc9356)){_0x27add2['or'](_0xd22c('0x68'),_0xcc9356+'%');_0x27add2['or'](_0xd22c('0x69'),_0xcc9356+'%');_0x27add2['or'](_0xd22c('0x6a'),_0xcc9356+'%');_0x27add2['or'](_0xd22c('0x6b'),_0xcc9356+'%');}else if(qs[_0xd22c('0x6c')](_0xcc9356)){_0x27add2['or'](_0xd22c('0x6d'),_0xcc9356+'%');}else{_0x27add2['or']('c.firstName\x20LIKE\x20?','%'+_0xcc9356+'%');_0x27add2['or']('c.lastName\x20LIKE\x20?','%'+_0xcc9356+'%');_0x27add2['or'](_0xd22c('0x6d'),'%'+_0xcc9356+'%');}}}}_0x10848['where'](_0x27add2);_0x10848[_0xd22c('0x6e')]('c.id');var _0x494ad1={'type':db[_0xd22c('0x6f')][_0xd22c('0x70')][_0xd22c('0x71')],'raw':!![]};var _0x34c5ea=_0x10848['clone']()[_0xd22c('0x41')]('c.id');if(_0x5a1919[_0xd22c('0x3d')]){_0x5a1919[_0xd22c('0x3d')][_0xd22c('0x53')](function(_0x176eac){_0x10848[_0xd22c('0x3d')]('c.'+_0x176eac[0x0],_0x176eac[0x1]==='DESC'?![]:!![]);});}if(!_[_0xd22c('0x5e')](_0x4b4551)){_0x10848[_0xd22c('0x72')](_0x260c55);_0x34c5ea[_0xd22c('0x3f')](_0xd22c('0x73'),_0x4b4551);}BPromise[_0xd22c('0x74')]()[_0xd22c('0x22')](function(){if(!_0x3120a0)return;if(_0x215b49['user'][_0xd22c('0x75')]!==_0xd22c('0x76'))return;if(!_[_0xd22c('0x77')](_0x3120a0[_0xd22c('0x4e')],[_0xd22c('0x41'),'User'])){return _0x215b49[_0xd22c('0x78')]['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x1d6daf){if(_['isEmpty'](_0x1d6daf)){_0x34c5ea[_0xd22c('0x3f')]('c.ListId\x20IS\x20NULL');_0x10848[_0xd22c('0x3f')](_0xd22c('0x79'));}else{_0x34c5ea['where']('c.ListId\x20IN\x20?',_[_0xd22c('0x52')](_0x1d6daf,'id'));_0x10848['where'](_0xd22c('0x5f'),_[_0xd22c('0x52')](_0x1d6daf,'id'));}});}})[_0xd22c('0x22')](function(){if(_0x215b49[_0xd22c('0x78')][_0xd22c('0x75')]===_0xd22c('0x76')&&!_0x3120a0&&!_0x215b49[_0xd22c('0x36')][_0xd22c('0x7a')])return[];return db['sequelize'][_0xd22c('0x36')](_0x34c5ea['toString'](),_0x494ad1);})[_0xd22c('0x22')](function(_0x527559){_0x21dd58[_0xd22c('0x1c')]=_0x527559[_0xd22c('0x2c')];if(_0x21dd58[_0xd22c('0x1c')]===0x0)return[];return db['sequelize'][_0xd22c('0x36')](_0x8ca1bb[_0xd22c('0x7b')](),_0x494ad1)[_0xd22c('0x22')](function(_0x454346){_0x15336b=_['keyBy'](_0x454346,'id');_0x494ad1=_['merge'](_0x494ad1,{'model':db[_0xd22c('0x29')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x215b49[_0xd22c('0x36')][_0xd22c('0x39')]){_0x5a1919[_0xd22c('0x3a')][_0xd22c('0x53')](function(_0x322603){_0x10848['field']('c.'+_0x322603);});}else{_0x10848[_0xd22c('0x41')](_0xd22c('0x7c'));_0x10848[_0xd22c('0x41')](_0xd22c('0x7d'));_0x10848[_0xd22c('0x41')](_0xd22c('0x7e'));_0x10848['field']('c.phone');_0x10848[_0xd22c('0x41')]('c.mobile');_0x10848[_0xd22c('0x41')]('c.fax');_0x10848[_0xd22c('0x41')]('c.email');_0x10848[_0xd22c('0x41')](_0xd22c('0x7f'));_0x10848[_0xd22c('0x41')](_0xd22c('0x80'));_0x10848[_0xd22c('0x41')](_0xd22c('0x81'));_0x10848[_0xd22c('0x41')](_0xd22c('0x82'));_0x10848[_0xd22c('0x41')](_0xd22c('0x83'),_0xd22c('0x84'));}if(_0x5a1919['limit'])_0x10848[_0xd22c('0x1a')](_0x5a1919[_0xd22c('0x1a')]);if(_0x5a1919['offset'])_0x10848[_0xd22c('0x19')](_0x5a1919[_0xd22c('0x19')]);return db[_0xd22c('0x85')][_0xd22c('0x36')](_0x10848[_0xd22c('0x7b')](),_0x494ad1);});})[_0xd22c('0x22')](function(_0x3cb518){_0x3cb518[_0xd22c('0x53')](function(_0x230453){if(_0x230453[_0xd22c('0x84')]){_0x230453[_0xd22c('0x86')]=[];_0x230453[_0xd22c('0x84')][_0xd22c('0x51')](',')[_0xd22c('0x53')](function(_0x441e50){_0x230453[_0xd22c('0x86')][_0xd22c('0x2f')](_0x15336b[_0x441e50]);});}delete _0x230453['TagIds'];});_0x21dd58['rows']=_0x3cb518;return _0x21dd58;})[_0xd22c('0x22')](respondWithFilteredResult(_0x2c6a4b,_0x5a1919));})['catch'](handleError(_0x2c6a4b,null));};exports[_0xd22c('0x23')]=function(_0x1c780c,_0x582d9e){return db[_0xd22c('0x29')][_0xd22c('0x4f')]({'where':{'id':_0x1c780c[_0xd22c('0x87')]['id']}})['then'](handleEntityNotFound(_0x582d9e,null))[_0xd22c('0x22')](removeEntity(_0x582d9e,null))[_0xd22c('0x88')](handleError(_0x582d9e,null));};exports[_0xd22c('0x2a')]=function(_0x28a3db,_0x4e283c){return db['CmContact']['describe']()['then'](function(_0x277a35){delete _0x277a35[_0xd22c('0x89')];for(var _0xbdae10=0x0;_0xbdae10{}\s\\|]/g,'-');_0x3acc65(null,util[_0xbb32('0x22')]('%s-%s%s',path[_0xbb32('0x23')](_0x4b6085[_0xbb32('0x20')],path[_0xbb32('0x24')](_0x4b6085[_0xbb32('0x20')])),Date[_0xbb32('0x25')](),path[_0xbb32('0x24')](_0x4b6085[_0xbb32('0x20')])));}})});router['post'](_0xbb32('0x26'),upload['single']('file'),controller[_0xbb32('0x27')]);var upload=multer({'storage':multer[_0xbb32('0x1d')]({'destination':function(_0x13a131,_0x43e33c,_0x2123e6){_0x2123e6(null,path[_0xbb32('0x28')](config[_0xbb32('0x1e')],_0xbb32('0x1f')));},'filename':function(_0x4944a0,_0xe8154d,_0x301cc3){_0xe8154d[_0xbb32('0x20')]=_0xe8154d[_0xbb32('0x20')][_0xbb32('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x301cc3(null,util[_0xbb32('0x22')]('%s-%s%s',path[_0xbb32('0x23')](_0xe8154d[_0xbb32('0x20')],path[_0xbb32('0x24')](_0xe8154d[_0xbb32('0x20')])),Date['now'](),path[_0xbb32('0x24')](_0xe8154d[_0xbb32('0x20')])));}})});router[_0xbb32('0x16')](_0xbb32('0x29'),upload[_0xbb32('0x2a')](_0xbb32('0x2b')),controller['upload']);router['post'](_0xbb32('0x2c'),auth[_0xbb32('0xa')](),controller[_0xbb32('0x2d')]);router['put'](_0xbb32('0xe'),auth[_0xbb32('0xa')](),controller[_0xbb32('0x2e')]);router[_0xbb32('0x2f')](_0xbb32('0xe'),auth[_0xbb32('0xa')](),controller[_0xbb32('0x30')]);module[_0xbb32('0x31')]=router; \ No newline at end of file +var _0x2d5a=['replace','originalname','extname','/csv','single','file','uploadCsv','format','%s-%s%s','basename','now','/upload','upload','/upload/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','/merge','merge','create','bulkCreate','setTags','diskStorage','join','root','server/files/tmp'];(function(_0x52660e,_0x4bae6b){var _0x2fd1a3=function(_0x2caaaf){while(--_0x2caaaf){_0x52660e['push'](_0x52660e['shift']());}};_0x2fd1a3(++_0x4bae6b);}(_0x2d5a,0x155));var _0xa2d5=function(_0x59973c,_0x5e0799){_0x59973c=_0x59973c-0x0;var _0x29c5aa=_0x2d5a[_0x59973c];return _0x29c5aa;};'use strict';var multer=require(_0xa2d5('0x0'));var util=require(_0xa2d5('0x1'));var path=require(_0xa2d5('0x2'));var timeout=require(_0xa2d5('0x3'));var express=require(_0xa2d5('0x4'));var router=express[_0xa2d5('0x5')]();var fs_extra=require(_0xa2d5('0x6'));var auth=require(_0xa2d5('0x7'));var interaction=require(_0xa2d5('0x8'));var config=require(_0xa2d5('0x9'));var controller=require(_0xa2d5('0xa'));router[_0xa2d5('0xb')]('/',auth[_0xa2d5('0xc')](),controller[_0xa2d5('0xd')]);router[_0xa2d5('0xb')]('/describe',auth[_0xa2d5('0xc')](),controller['describe']);router['get'](_0xa2d5('0xe'),auth[_0xa2d5('0xc')](),controller[_0xa2d5('0xf')]);router['get'](_0xa2d5('0x10'),auth[_0xa2d5('0xc')](),controller[_0xa2d5('0x11')]);router[_0xa2d5('0xb')](_0xa2d5('0x12'),auth['isAuthenticated'](),controller[_0xa2d5('0x13')]);router[_0xa2d5('0xb')](_0xa2d5('0x14'),auth[_0xa2d5('0xc')](),controller[_0xa2d5('0x15')]);router['get'](_0xa2d5('0x16'),auth[_0xa2d5('0xc')](),controller['getHopperFinals']);router[_0xa2d5('0xb')](_0xa2d5('0x17'),auth[_0xa2d5('0xc')](),controller[_0xa2d5('0x18')]);router[_0xa2d5('0xb')](_0xa2d5('0x19'),auth[_0xa2d5('0xc')](),controller[_0xa2d5('0x1a')]);router[_0xa2d5('0x1b')](_0xa2d5('0x1c'),auth[_0xa2d5('0xc')](),controller[_0xa2d5('0x1d')]);router[_0xa2d5('0x1b')]('/',auth['isAuthenticated'](),controller[_0xa2d5('0x1e')]);router[_0xa2d5('0x1b')]('/create_many',auth['isAuthenticated'](),controller[_0xa2d5('0x1f')]);router[_0xa2d5('0x1b')]('/:id/tags',auth[_0xa2d5('0xc')](),controller[_0xa2d5('0x20')]);var upload=multer({'storage':multer[_0xa2d5('0x21')]({'destination':function(_0x26eb13,_0x3f0e73,_0x17bb83){_0x17bb83(null,path[_0xa2d5('0x22')](config[_0xa2d5('0x23')],_0xa2d5('0x24')));},'filename':function(_0x234abd,_0x2920f0,_0x3d8ffe){_0x2920f0['originalname']=_0x2920f0['originalname'][_0xa2d5('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3d8ffe(null,util['format']('%s-%s%s',path['basename'](_0x2920f0[_0xa2d5('0x26')],path[_0xa2d5('0x27')](_0x2920f0[_0xa2d5('0x26')])),Date['now'](),path[_0xa2d5('0x27')](_0x2920f0[_0xa2d5('0x26')])));}})});router[_0xa2d5('0x1b')](_0xa2d5('0x28'),upload[_0xa2d5('0x29')](_0xa2d5('0x2a')),controller[_0xa2d5('0x2b')]);var upload=multer({'storage':multer[_0xa2d5('0x21')]({'destination':function(_0x4c99fd,_0x199c6b,_0x36dd97){_0x36dd97(null,path['join'](config[_0xa2d5('0x23')],_0xa2d5('0x24')));},'filename':function(_0x367c6d,_0x55a6b1,_0x9692dc){_0x55a6b1[_0xa2d5('0x26')]=_0x55a6b1[_0xa2d5('0x26')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x9692dc(null,util[_0xa2d5('0x2c')](_0xa2d5('0x2d'),path[_0xa2d5('0x2e')](_0x55a6b1[_0xa2d5('0x26')],path[_0xa2d5('0x27')](_0x55a6b1[_0xa2d5('0x26')])),Date[_0xa2d5('0x2f')](),path[_0xa2d5('0x27')](_0x55a6b1[_0xa2d5('0x26')])));}})});router[_0xa2d5('0x1b')](_0xa2d5('0x30'),upload['single'](_0xa2d5('0x2a')),controller[_0xa2d5('0x31')]);router[_0xa2d5('0x1b')](_0xa2d5('0x32'),auth['isAuthenticated'](),controller['import']);router['put']('/:id',auth[_0xa2d5('0xc')](),controller['update']);router[_0xa2d5('0x33')]('/:id',auth[_0xa2d5('0xc')](),controller[_0xa2d5('0x34')]);module[_0xa2d5('0x35')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index a771baf..825fd45 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 _0x136b=['select','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','exports','VIRTUAL','STRING','setDataValue','alias','getDataValue','name','TEXT','long','type'];(function(_0x705b98,_0x1c345b){var _0x47b72f=function(_0x44f02a){while(--_0x44f02a){_0x705b98['push'](_0x705b98['shift']());}};_0x47b72f(++_0x1c345b);}(_0x136b,0x85));var _0xb136=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x136b[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0xb136('0x0'));var _=require('lodash');module[_0xb136('0x1')]={'name':{'type':Sequelize[_0xb136('0x2')],'get':function(_0x4f82db){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0xb136('0x3')],'allowNull':![],'set':function(_0x12634b){this[_0xb136('0x4')](_0xb136('0x5'),_0x12634b?_0x12634b:this[_0xb136('0x6')](_0xb136('0x7')));}},'type':{'type':Sequelize[_0xb136('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0xb136('0x8')](_0xb136('0x9')),'get':function(){if(this[_0xb136('0x6')](_0xb136('0xa'))===_0xb136('0xb')){return JSON['parse'](this['getDataValue'](_0xb136('0xc')));}else{return this['getDataValue']('values');}},'set':function(_0x276dc8){if(Array[_0xb136('0xd')](_0x276dc8)){this[_0xb136('0x4')]('values',JSON[_0xb136('0xe')](_0x276dc8));}else{this[_0xb136('0x4')]('values',_0x276dc8);}}},'required':{'type':Sequelize[_0xb136('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xb136('0x10')](_0xb136('0x11'))}}; \ No newline at end of file +var _0xda13=['type','select','parse','values','isArray','stringify','setDataValue','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','TEXT','long'];(function(_0x5af89d,_0xa40ecd){var _0x44e390=function(_0x296473){while(--_0x296473){_0x5af89d['push'](_0x5af89d['shift']());}};_0x44e390(++_0xa40ecd);}(_0xda13,0x13a));var _0x3da1=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0xda13[_0x44a3b0];return _0x39e6f6;};'use strict';var Sequelize=require(_0x3da1('0x0'));var _=require(_0x3da1('0x1'));module[_0x3da1('0x2')]={'name':{'type':Sequelize[_0x3da1('0x3')],'get':function(_0x35e929){return this[_0x3da1('0x4')](_0x3da1('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5307ad){this['setDataValue'](_0x3da1('0x5'),_0x5307ad?_0x5307ad:this[_0x3da1('0x4')]('name'));}},'type':{'type':Sequelize[_0x3da1('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x3da1('0x7')](_0x3da1('0x8')),'get':function(){if(this['getDataValue'](_0x3da1('0x9'))===_0x3da1('0xa')){return JSON[_0x3da1('0xb')](this[_0x3da1('0x4')]('values'));}else{return this[_0x3da1('0x4')](_0x3da1('0xc'));}},'set':function(_0x2916f2){if(Array[_0x3da1('0xd')](_0x2916f2)){this['setDataValue']('values',JSON[_0x3da1('0xe')](_0x2916f2));}else{this[_0x3da1('0xf')](_0x3da1('0xc'),_0x2916f2);}}},'required':{'type':Sequelize[_0x3da1('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x3da1('0x11')](_0x3da1('0x12'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index d832bb3..d9cacc2 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 _0x1420=['undefined','limit','apply','reject','update','then','error','name','send','index','map','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','count','includeAll','rows','show','params','include','catch','body','find','transaction','Sequelize','TEXT','number','INTEGER','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x52bfa5,_0x42cf21){var _0x26f80b=function(_0x73c5b0){while(--_0x73c5b0){_0x52bfa5['push'](_0x52bfa5['shift']());}};_0x26f80b(++_0x42cf21);}(_0x1420,0x138));var _0x0142=function(_0x2d51e8,_0x137aad){_0x2d51e8=_0x2d51e8-0x0;var _0x2a5b70=_0x1420[_0x2d51e8];return _0x2a5b70;};'use strict';var emlformat=require(_0x0142('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0142('0x1'));var jsonpatch=require(_0x0142('0x2'));var rp=require(_0x0142('0x3'));var moment=require(_0x0142('0x4'));var BPromise=require(_0x0142('0x5'));var Mustache=require(_0x0142('0x6'));var util=require(_0x0142('0x7'));var path=require(_0x0142('0x8'));var sox=require(_0x0142('0x9'));var csv=require(_0x0142('0xa'));var ejs=require(_0x0142('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0142('0xc'));var squel=require('squel');var crypto=require(_0x0142('0xd'));var jsforce=require(_0x0142('0xe'));var deskjs=require(_0x0142('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0142('0x10'));var Papa=require(_0x0142('0x11'));var Redis=require(_0x0142('0x12'));var authService=require(_0x0142('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0142('0x14'));var hardwareService=require(_0x0142('0x15'));var logger=require(_0x0142('0x16'))(_0x0142('0x17'));var utils=require(_0x0142('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0142('0x19'));var db=require(_0x0142('0x1a'))['db'];function respondWithStatusCode(_0x8e6911,_0x4a762f){_0x4a762f=_0x4a762f||0xcc;return function(_0x52bce7){if(_0x52bce7){return _0x8e6911[_0x0142('0x1b')](_0x4a762f);}return _0x8e6911[_0x0142('0x1c')](_0x4a762f)[_0x0142('0x1d')]();};}function respondWithResult(_0x34cb0c,_0x45efac){_0x45efac=_0x45efac||0xc8;return function(_0xe07c52){if(_0xe07c52){return _0x34cb0c['status'](_0x45efac)[_0x0142('0x1e')](_0xe07c52);}};}function respondWithFilteredResult(_0x462945,_0x1b56bf){return function(_0x952ed1){if(_0x952ed1){var _0x4a13a2=typeof _0x1b56bf[_0x0142('0x1f')]===_0x0142('0x20')&&typeof _0x1b56bf[_0x0142('0x21')]===_0x0142('0x20');var _0xb29bd8=_0x952ed1['count'];var _0x27aa7f=_0x4a13a2?0x0:_0x1b56bf[_0x0142('0x1f')];var _0xe5dcbc=_0x4a13a2?_0x952ed1['count']:_0x1b56bf[_0x0142('0x1f')]+_0x1b56bf['limit'];var _0x562607;if(_0xe5dcbc>=_0xb29bd8){_0xe5dcbc=_0xb29bd8;_0x562607=0xc8;}else{_0x562607=0xce;}_0x462945['status'](_0x562607);return _0x462945['set']('Content-Range',_0x27aa7f+'-'+_0xe5dcbc+'/'+_0xb29bd8)[_0x0142('0x1e')](_0x952ed1);}return null;};}function patchUpdates(_0x4fc2c5){return function(_0x6ac8b1){try{jsonpatch[_0x0142('0x22')](_0x6ac8b1,_0x4fc2c5,!![]);}catch(_0x34eac9){return BPromise[_0x0142('0x23')](_0x34eac9);}return _0x6ac8b1['save']();};}function saveUpdates(_0x3b44fc,_0x172e75){return function(_0x5d33e7){if(_0x5d33e7){return _0x5d33e7[_0x0142('0x24')](_0x3b44fc)[_0x0142('0x25')](function(_0x4ec2a1){return _0x4ec2a1;});}return null;};}function removeEntity(_0x54e09f,_0xa99765){return function(_0x5d729c){if(_0x5d729c){return _0x5d729c['destroy']()[_0x0142('0x25')](function(){_0x54e09f['status'](0xcc)[_0x0142('0x1d')]();});}};}function handleEntityNotFound(_0x5ccc53,_0x2d4987){return function(_0x5ed55d){if(!_0x5ed55d){_0x5ccc53['sendStatus'](0x194);}return _0x5ed55d;};}function handleError(_0x98274d,_0x581909){_0x581909=_0x581909||0x1f4;return function(_0x1d954b){logger[_0x0142('0x26')](_0x1d954b['stack']);if(_0x1d954b[_0x0142('0x27')]){delete _0x1d954b[_0x0142('0x27')];}_0x98274d[_0x0142('0x1c')](_0x581909)[_0x0142('0x28')](_0x1d954b);};}exports[_0x0142('0x29')]=function(_0x4e6512,_0x101852){var _0x5510c4={},_0x1ee3a5={},_0x5cf336={'count':0x0,'rows':[]};var _0x5c89f9=_[_0x0142('0x2a')](db[_0x0142('0x2b')][_0x0142('0x2c')],function(_0x1cfe8b){return{'name':_0x1cfe8b[_0x0142('0x2d')],'type':_0x1cfe8b['type'][_0x0142('0x2e')]};});_0x1ee3a5[_0x0142('0x2f')]=_[_0x0142('0x30')](_[_0x0142('0x2a')](_0x5c89f9,_0x0142('0x27')),[_0x0142('0x27')]);_0x1ee3a5[_0x0142('0x31')]=_[_0x0142('0x32')](_0x4e6512[_0x0142('0x31')]);_0x1ee3a5[_0x0142('0x33')]=_[_0x0142('0x34')](_0x1ee3a5[_0x0142('0x2f')],_0x1ee3a5[_0x0142('0x31')]);_0x5510c4[_0x0142('0x35')]=_['intersection'](_0x1ee3a5['model'],qs['fields'](_0x4e6512[_0x0142('0x31')][_0x0142('0x36')]));_0x5510c4[_0x0142('0x35')]=_0x5510c4['attributes'][_0x0142('0x37')]?_0x5510c4['attributes']:_0x1ee3a5[_0x0142('0x2f')];if(!_0x4e6512[_0x0142('0x31')][_0x0142('0x38')](_0x0142('0x39'))){_0x5510c4['limit']=qs[_0x0142('0x21')](_0x4e6512[_0x0142('0x31')][_0x0142('0x21')]);_0x5510c4[_0x0142('0x1f')]=qs[_0x0142('0x1f')](_0x4e6512['query'][_0x0142('0x1f')]);}_0x5510c4[_0x0142('0x3a')]=qs['sort'](_0x4e6512[_0x0142('0x31')][_0x0142('0x3b')]);_0x5510c4[_0x0142('0x3c')]=qs['filters'](_['pick'](_0x4e6512[_0x0142('0x31')],_0x1ee3a5[_0x0142('0x33')]),_0x5c89f9);if(_0x4e6512[_0x0142('0x31')][_0x0142('0x3d')]){_0x5510c4[_0x0142('0x3c')]=_['merge'](_0x5510c4[_0x0142('0x3c')],{'$or':_['map'](_0x5c89f9,function(_0x473d20){if(_0x473d20[_0x0142('0x3e')]!==_0x0142('0x3f')){var _0x12a39f={};_0x12a39f[_0x473d20[_0x0142('0x27')]]={'$like':'%'+_0x4e6512[_0x0142('0x31')][_0x0142('0x3d')]+'%'};return _0x12a39f;}})});}_0x5510c4=_[_0x0142('0x40')]({},_0x5510c4,_0x4e6512[_0x0142('0x41')]);var _0x23b6c0={'where':_0x5510c4['where']};return db['CmCustomField']['count'](_0x23b6c0)[_0x0142('0x25')](function(_0x5edcaf){_0x5cf336[_0x0142('0x42')]=_0x5edcaf;if(_0x4e6512[_0x0142('0x31')][_0x0142('0x43')]){_0x5510c4['include']=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x5510c4);})[_0x0142('0x25')](function(_0x10af48){_0x5cf336[_0x0142('0x44')]=_0x10af48;return _0x5cf336;})[_0x0142('0x25')](respondWithFilteredResult(_0x101852,_0x5510c4))['catch'](handleError(_0x101852,null));};exports[_0x0142('0x45')]=function(_0x221b3f,_0x214472){var _0x1e2eb3={'raw':!![],'where':{'id':_0x221b3f[_0x0142('0x46')]['id']}},_0x7dcc57={};_0x7dcc57[_0x0142('0x2f')]=_[_0x0142('0x32')](db[_0x0142('0x2b')]['rawAttributes']);_0x7dcc57[_0x0142('0x31')]=_[_0x0142('0x32')](_0x221b3f[_0x0142('0x31')]);_0x7dcc57['filters']=_[_0x0142('0x34')](_0x7dcc57[_0x0142('0x2f')],_0x7dcc57['query']);_0x1e2eb3[_0x0142('0x35')]=_[_0x0142('0x34')](_0x7dcc57['model'],qs[_0x0142('0x36')](_0x221b3f[_0x0142('0x31')]['fields']));_0x1e2eb3[_0x0142('0x35')]=_0x1e2eb3['attributes'][_0x0142('0x37')]?_0x1e2eb3['attributes']:_0x7dcc57['model'];if(_0x221b3f[_0x0142('0x31')][_0x0142('0x43')]){_0x1e2eb3[_0x0142('0x47')]=[{'all':!![]}];}_0x1e2eb3=_['merge']({},_0x1e2eb3,_0x221b3f[_0x0142('0x41')]);return db[_0x0142('0x2b')]['find'](_0x1e2eb3)['then'](handleEntityNotFound(_0x214472,null))[_0x0142('0x25')](respondWithResult(_0x214472,null))[_0x0142('0x48')](handleError(_0x214472,null));};exports[_0x0142('0x24')]=function(_0x4f0427,_0x5d7711){if(_0x4f0427[_0x0142('0x49')]['id']){delete _0x4f0427[_0x0142('0x49')]['id'];}return db['CmCustomField'][_0x0142('0x4a')]({'where':{'id':_0x4f0427[_0x0142('0x46')]['id']}})['then'](handleEntityNotFound(_0x5d7711,null))[_0x0142('0x25')](saveUpdates(_0x4f0427[_0x0142('0x49')],null))['then'](respondWithResult(_0x5d7711,null))['catch'](handleError(_0x5d7711,null));};exports['destroy']=function(_0x11c3ea,_0x1ec88d){return db[_0x0142('0x2b')][_0x0142('0x4a')]({'where':{'id':_0x11c3ea[_0x0142('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ec88d,null))['then'](removeEntity(_0x1ec88d,null))[_0x0142('0x48')](handleError(_0x1ec88d,null));};exports['create']=function(_0x2b6ebc,_0x46cf7a){var _0x51324e;return db['sequelize'][_0x0142('0x4b')](function(_0x1c5a24){return db['CmCustomField']['create'](_0x2b6ebc[_0x0142('0x49')],{'transaction':_0x1c5a24})[_0x0142('0x25')](function(_0x591276){_0x51324e=_0x591276;var _0x15da82={'type':db[_0x0142('0x4c')][_0x0142('0x4d')],'transaction':_0x1c5a24};switch(_0x2b6ebc['body'][_0x0142('0x3e')]){case'text':_0x15da82[_0x0142('0x3e')]=db[_0x0142('0x4c')][_0x0142('0x4d')];break;case _0x0142('0x4e'):_0x15da82['type']=db[_0x0142('0x4c')][_0x0142('0x4f')];break;case'switch':_0x15da82[_0x0142('0x3e')]=db[_0x0142('0x4c')][_0x0142('0x50')];_0x15da82[_0x0142('0x51')]=![];break;default:}return db[_0x0142('0x52')][_0x0142('0x53')][_0x0142('0x54')](_0x0142('0x55'),util['format']('cf_%d',_0x51324e['id']),_0x15da82);})[_0x0142('0x25')](function(){return _0x51324e;});})[_0x0142('0x25')](respondWithResult(_0x46cf7a,0xc9))['catch'](handleError(_0x46cf7a,null));}; \ No newline at end of file +var _0x42a8=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','stack','name','send','index','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','map','query','filters','intersection','attributes','fields','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','catch','params','keys','length','include','find','body','create','sequelize','transaction','text','Sequelize','TEXT','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5ad1b7,_0x450413){var _0x5e8b3a=function(_0x324b65){while(--_0x324b65){_0x5ad1b7['push'](_0x5ad1b7['shift']());}};_0x5e8b3a(++_0x450413);}(_0x42a8,0xa9));var _0x842a=function(_0x5566b7,_0x4e9e2c){_0x5566b7=_0x5566b7-0x0;var _0x1c7ea7=_0x42a8[_0x5566b7];return _0x1c7ea7;};'use strict';var emlformat=require(_0x842a('0x0'));var rimraf=require(_0x842a('0x1'));var zipdir=require(_0x842a('0x2'));var jsonpatch=require(_0x842a('0x3'));var rp=require(_0x842a('0x4'));var moment=require(_0x842a('0x5'));var BPromise=require(_0x842a('0x6'));var Mustache=require(_0x842a('0x7'));var util=require(_0x842a('0x8'));var path=require(_0x842a('0x9'));var sox=require(_0x842a('0xa'));var csv=require(_0x842a('0xb'));var ejs=require(_0x842a('0xc'));var fs=require('fs');var fs_extra=require(_0x842a('0xd'));var _=require(_0x842a('0xe'));var squel=require('squel');var crypto=require(_0x842a('0xf'));var jsforce=require(_0x842a('0x10'));var deskjs=require(_0x842a('0x11'));var toCsv=require(_0x842a('0xb'));var querystring=require(_0x842a('0x12'));var Papa=require('papaparse');var Redis=require(_0x842a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x842a('0x14'));var as=require(_0x842a('0x15'));var hardwareService=require(_0x842a('0x16'));var logger=require('../../config/logger')(_0x842a('0x17'));var utils=require(_0x842a('0x18'));var config=require(_0x842a('0x19'));var licenseUtil=require(_0x842a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5136e9,_0x4916a8){_0x4916a8=_0x4916a8||0xcc;return function(_0x2b57e9){if(_0x2b57e9){return _0x5136e9['sendStatus'](_0x4916a8);}return _0x5136e9[_0x842a('0x1b')](_0x4916a8)[_0x842a('0x1c')]();};}function respondWithResult(_0x109d69,_0x5dcddf){_0x5dcddf=_0x5dcddf||0xc8;return function(_0x4e0eaf){if(_0x4e0eaf){return _0x109d69[_0x842a('0x1b')](_0x5dcddf)[_0x842a('0x1d')](_0x4e0eaf);}};}function respondWithFilteredResult(_0x1c8c99,_0x1a01bd){return function(_0x1328e1){if(_0x1328e1){var _0x556331=typeof _0x1a01bd['offset']===_0x842a('0x1e')&&typeof _0x1a01bd[_0x842a('0x1f')]===_0x842a('0x1e');var _0x32d0e1=_0x1328e1[_0x842a('0x20')];var _0xa86433=_0x556331?0x0:_0x1a01bd[_0x842a('0x21')];var _0x27f163=_0x556331?_0x1328e1['count']:_0x1a01bd[_0x842a('0x21')]+_0x1a01bd[_0x842a('0x1f')];var _0x27a83b;if(_0x27f163>=_0x32d0e1){_0x27f163=_0x32d0e1;_0x27a83b=0xc8;}else{_0x27a83b=0xce;}_0x1c8c99[_0x842a('0x1b')](_0x27a83b);return _0x1c8c99[_0x842a('0x22')](_0x842a('0x23'),_0xa86433+'-'+_0x27f163+'/'+_0x32d0e1)['json'](_0x1328e1);}return null;};}function patchUpdates(_0x1d7328){return function(_0x4f56ac){try{jsonpatch[_0x842a('0x24')](_0x4f56ac,_0x1d7328,!![]);}catch(_0x58f017){return BPromise['reject'](_0x58f017);}return _0x4f56ac['save']();};}function saveUpdates(_0x11627f,_0x379405){return function(_0x5af7fe){if(_0x5af7fe){return _0x5af7fe[_0x842a('0x25')](_0x11627f)[_0x842a('0x26')](function(_0x352736){return _0x352736;});}return null;};}function removeEntity(_0x124722,_0x1c25e4){return function(_0x32c019){if(_0x32c019){return _0x32c019[_0x842a('0x27')]()[_0x842a('0x26')](function(){_0x124722[_0x842a('0x1b')](0xcc)[_0x842a('0x1c')]();});}};}function handleEntityNotFound(_0x467fbc,_0x637ea5){return function(_0x56ee85){if(!_0x56ee85){_0x467fbc['sendStatus'](0x194);}return _0x56ee85;};}function handleError(_0x342ec4,_0x212200){_0x212200=_0x212200||0x1f4;return function(_0x2c0ef3){logger['error'](_0x2c0ef3[_0x842a('0x28')]);if(_0x2c0ef3[_0x842a('0x29')]){delete _0x2c0ef3[_0x842a('0x29')];}_0x342ec4[_0x842a('0x1b')](_0x212200)[_0x842a('0x2a')](_0x2c0ef3);};}exports[_0x842a('0x2b')]=function(_0x14924e,_0xfed091){var _0x5d451a={},_0x384f36={},_0x378c8d={'count':0x0,'rows':[]};var _0x10c8ca=_['map'](db[_0x842a('0x2c')][_0x842a('0x2d')],function(_0xc2b96){return{'name':_0xc2b96[_0x842a('0x2e')],'type':_0xc2b96[_0x842a('0x2f')][_0x842a('0x30')]};});_0x384f36[_0x842a('0x31')]=_[_0x842a('0x32')](_[_0x842a('0x33')](_0x10c8ca,_0x842a('0x29')),[_0x842a('0x29')]);_0x384f36[_0x842a('0x34')]=_['keys'](_0x14924e['query']);_0x384f36[_0x842a('0x35')]=_[_0x842a('0x36')](_0x384f36[_0x842a('0x31')],_0x384f36[_0x842a('0x34')]);_0x5d451a[_0x842a('0x37')]=_[_0x842a('0x36')](_0x384f36[_0x842a('0x31')],qs['fields'](_0x14924e[_0x842a('0x34')][_0x842a('0x38')]));_0x5d451a[_0x842a('0x37')]=_0x5d451a[_0x842a('0x37')]['length']?_0x5d451a['attributes']:_0x384f36[_0x842a('0x31')];if(!_0x14924e[_0x842a('0x34')]['hasOwnProperty']('nolimit')){_0x5d451a[_0x842a('0x1f')]=qs[_0x842a('0x1f')](_0x14924e[_0x842a('0x34')]['limit']);_0x5d451a[_0x842a('0x21')]=qs[_0x842a('0x21')](_0x14924e['query'][_0x842a('0x21')]);}_0x5d451a[_0x842a('0x39')]=qs[_0x842a('0x3a')](_0x14924e['query'][_0x842a('0x3a')]);_0x5d451a[_0x842a('0x3b')]=qs[_0x842a('0x35')](_[_0x842a('0x3c')](_0x14924e['query'],_0x384f36[_0x842a('0x35')]),_0x10c8ca);if(_0x14924e[_0x842a('0x34')]['filter']){_0x5d451a[_0x842a('0x3b')]=_[_0x842a('0x3d')](_0x5d451a[_0x842a('0x3b')],{'$or':_[_0x842a('0x33')](_0x10c8ca,function(_0x472c72){if(_0x472c72[_0x842a('0x2f')]!=='VIRTUAL'){var _0x2676b4={};_0x2676b4[_0x472c72[_0x842a('0x29')]]={'$like':'%'+_0x14924e['query'][_0x842a('0x3e')]+'%'};return _0x2676b4;}})});}_0x5d451a=_[_0x842a('0x3d')]({},_0x5d451a,_0x14924e[_0x842a('0x3f')]);var _0x2bcaf3={'where':_0x5d451a[_0x842a('0x3b')]};return db[_0x842a('0x2c')][_0x842a('0x20')](_0x2bcaf3)[_0x842a('0x26')](function(_0x17c80b){_0x378c8d[_0x842a('0x20')]=_0x17c80b;if(_0x14924e[_0x842a('0x34')][_0x842a('0x40')]){_0x5d451a['include']=[{'all':!![]}];}return db[_0x842a('0x2c')][_0x842a('0x41')](_0x5d451a);})[_0x842a('0x26')](function(_0xce83bd){_0x378c8d[_0x842a('0x42')]=_0xce83bd;return _0x378c8d;})[_0x842a('0x26')](respondWithFilteredResult(_0xfed091,_0x5d451a))[_0x842a('0x43')](handleError(_0xfed091,null));};exports['show']=function(_0x4d03d6,_0x385701){var _0x40afae={'raw':!![],'where':{'id':_0x4d03d6[_0x842a('0x44')]['id']}},_0x330b65={};_0x330b65['model']=_[_0x842a('0x45')](db[_0x842a('0x2c')][_0x842a('0x2d')]);_0x330b65[_0x842a('0x34')]=_[_0x842a('0x45')](_0x4d03d6[_0x842a('0x34')]);_0x330b65[_0x842a('0x35')]=_['intersection'](_0x330b65[_0x842a('0x31')],_0x330b65[_0x842a('0x34')]);_0x40afae[_0x842a('0x37')]=_[_0x842a('0x36')](_0x330b65['model'],qs[_0x842a('0x38')](_0x4d03d6[_0x842a('0x34')][_0x842a('0x38')]));_0x40afae[_0x842a('0x37')]=_0x40afae[_0x842a('0x37')][_0x842a('0x46')]?_0x40afae[_0x842a('0x37')]:_0x330b65[_0x842a('0x31')];if(_0x4d03d6[_0x842a('0x34')][_0x842a('0x40')]){_0x40afae[_0x842a('0x47')]=[{'all':!![]}];}_0x40afae=_[_0x842a('0x3d')]({},_0x40afae,_0x4d03d6[_0x842a('0x3f')]);return db[_0x842a('0x2c')][_0x842a('0x48')](_0x40afae)[_0x842a('0x26')](handleEntityNotFound(_0x385701,null))['then'](respondWithResult(_0x385701,null))[_0x842a('0x43')](handleError(_0x385701,null));};exports[_0x842a('0x25')]=function(_0x1c1fce,_0x5b6366){if(_0x1c1fce[_0x842a('0x49')]['id']){delete _0x1c1fce['body']['id'];}return db[_0x842a('0x2c')]['find']({'where':{'id':_0x1c1fce[_0x842a('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b6366,null))[_0x842a('0x26')](saveUpdates(_0x1c1fce[_0x842a('0x49')],null))[_0x842a('0x26')](respondWithResult(_0x5b6366,null))['catch'](handleError(_0x5b6366,null));};exports[_0x842a('0x27')]=function(_0x1b6391,_0x297979){return db[_0x842a('0x2c')][_0x842a('0x48')]({'where':{'id':_0x1b6391[_0x842a('0x44')]['id']}})['then'](handleEntityNotFound(_0x297979,null))[_0x842a('0x26')](removeEntity(_0x297979,null))[_0x842a('0x43')](handleError(_0x297979,null));};exports[_0x842a('0x4a')]=function(_0x1ef4d5,_0x369c3e){var _0x202473;return db[_0x842a('0x4b')][_0x842a('0x4c')](function(_0x57fd50){return db[_0x842a('0x2c')][_0x842a('0x4a')](_0x1ef4d5[_0x842a('0x49')],{'transaction':_0x57fd50})[_0x842a('0x26')](function(_0x1c0a9b){_0x202473=_0x1c0a9b;var _0x10f03d={'type':db['Sequelize']['TEXT'],'transaction':_0x57fd50};switch(_0x1ef4d5['body'][_0x842a('0x2f')]){case _0x842a('0x4d'):_0x10f03d[_0x842a('0x2f')]=db[_0x842a('0x4e')][_0x842a('0x4f')];break;case _0x842a('0x50'):_0x10f03d[_0x842a('0x2f')]=db[_0x842a('0x4e')][_0x842a('0x51')];break;case'switch':_0x10f03d['type']=db[_0x842a('0x4e')][_0x842a('0x52')];_0x10f03d[_0x842a('0x53')]=![];break;default:}return db[_0x842a('0x4b')][_0x842a('0x54')][_0x842a('0x55')](_0x842a('0x56'),util['format']('cf_%d',_0x202473['id']),_0x10f03d);})[_0x842a('0x26')](function(){return _0x202473;});})['then'](respondWithResult(_0x369c3e,0xc9))['catch'](handleError(_0x369c3e,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 0035cb8..9e6fde2 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 _0xa7f3=['request-promise','rimraf','../../config/environment','exports','CmCustomField','cm_custom_fields','util','../../config/logger','api','moment','bluebird'];(function(_0x43676e,_0x26e150){var _0x4fa0dc=function(_0x36efc9){while(--_0x36efc9){_0x43676e['push'](_0x43676e['shift']());}};_0x4fa0dc(++_0x26e150);}(_0xa7f3,0x124));var _0x3a7f=function(_0xc1815e,_0x4bc3b5){_0xc1815e=_0xc1815e-0x0;var _0x31bbb3=_0xa7f3[_0xc1815e];return _0x31bbb3;};'use strict';var _=require('lodash');var util=require(_0x3a7f('0x0'));var logger=require(_0x3a7f('0x1'))(_0x3a7f('0x2'));var moment=require(_0x3a7f('0x3'));var BPromise=require(_0x3a7f('0x4'));var rp=require(_0x3a7f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a7f('0x6'));var config=require(_0x3a7f('0x7'));var attributes=require('./cmCustomField.attributes');module[_0x3a7f('0x8')]=function(_0x6fce91,_0x238e2e){return _0x6fce91['define'](_0x3a7f('0x9'),attributes,{'tableName':_0x3a7f('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36be=['cm_custom_fields','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','define','CmCustomField'];(function(_0x1b639a,_0x13a62f){var _0x25bb3f=function(_0x4fe672){while(--_0x4fe672){_0x1b639a['push'](_0x1b639a['shift']());}};_0x25bb3f(++_0x13a62f);}(_0x36be,0x1c4));var _0xe36b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x36be[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xe36b('0x0'));var util=require(_0xe36b('0x1'));var logger=require(_0xe36b('0x2'))(_0xe36b('0x3'));var moment=require('moment');var BPromise=require(_0xe36b('0x4'));var rp=require(_0xe36b('0x5'));var fs=require('fs');var path=require(_0xe36b('0x6'));var rimraf=require('rimraf');var config=require(_0xe36b('0x7'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0xb17dd5,_0x384064){return _0xb17dd5[_0xe36b('0x8')](_0xe36b('0x9'),attributes,{'tableName':_0xe36b('0xa'),'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 24a4758..956717a 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 _0x348a=['request\x20sent','stringify','error','code','message','info','result','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','CmCustomField,\x20%s,\x20%s'];(function(_0x3a5625,_0x5df68b){var _0x2ff55e=function(_0x1e8d06){while(--_0x1e8d06){_0x3a5625['push'](_0x3a5625['shift']());}};_0x2ff55e(++_0x5df68b);}(_0x348a,0x1bc));var _0xa348=function(_0x1b8191,_0xf183e9){_0x1b8191=_0x1b8191-0x0;var _0x2ccc28=_0x348a[_0x1b8191];return _0x2ccc28;};'use strict';var _=require('lodash');var util=require(_0xa348('0x0'));var moment=require('moment');var BPromise=require(_0xa348('0x1'));var rs=require(_0xa348('0x2'));var fs=require('fs');var Redis=require(_0xa348('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa348('0x4'));var logger=require(_0xa348('0x5'))('rpc');var config=require(_0xa348('0x6'));var jayson=require(_0xa348('0x7'));var client=jayson[_0xa348('0x8')][_0xa348('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x301a6c,_0x505e50,_0x274505){return new BPromise(function(_0x5d8353,_0x3d1260){return client[_0xa348('0xa')](_0x301a6c,_0x274505)['then'](function(_0x1186dd){logger['info'](_0xa348('0xb'),_0x505e50,_0xa348('0xc'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x505e50,_0xa348('0xc'),JSON[_0xa348('0xd')](_0x1186dd));if(_0x1186dd[_0xa348('0xe')]){if(_0x1186dd[_0xa348('0xe')][_0xa348('0xf')]===0x1f4){logger[_0xa348('0xe')](_0xa348('0xb'),_0x505e50,_0x1186dd['error'][_0xa348('0x10')]);return _0x3d1260(_0x1186dd[_0xa348('0xe')]['message']);}logger[_0xa348('0xe')](_0xa348('0xb'),_0x505e50,_0x1186dd[_0xa348('0xe')][_0xa348('0x10')]);return _0x5d8353(_0x1186dd[_0xa348('0xe')][_0xa348('0x10')]);}else{logger[_0xa348('0x11')](_0xa348('0xb'),_0x505e50,_0xa348('0xc'));_0x5d8353(_0x1186dd[_0xa348('0x12')][_0xa348('0x10')]);}})['catch'](function(_0x439dda){logger[_0xa348('0xe')](_0xa348('0xb'),_0x505e50,_0x439dda);_0x3d1260(_0x439dda);});});} \ No newline at end of file +var _0x75da=['info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5c4916,_0x41fc89){var _0x97e650=function(_0x274279){while(--_0x274279){_0x5c4916['push'](_0x5c4916['shift']());}};_0x97e650(++_0x41fc89);}(_0x75da,0xd2));var _0xa75d=function(_0x62b58e,_0x46fe1e){_0x62b58e=_0x62b58e-0x0;var _0x37fe84=_0x75da[_0x62b58e];return _0x37fe84;};'use strict';var _=require(_0xa75d('0x0'));var util=require(_0xa75d('0x1'));var moment=require(_0xa75d('0x2'));var BPromise=require(_0xa75d('0x3'));var rs=require(_0xa75d('0x4'));var fs=require('fs');var Redis=require(_0xa75d('0x5'));var db=require(_0xa75d('0x6'))['db'];var utils=require(_0xa75d('0x7'));var logger=require(_0xa75d('0x8'))('rpc');var config=require(_0xa75d('0x9'));var jayson=require(_0xa75d('0xa'));var client=jayson[_0xa75d('0xb')][_0xa75d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53f731,_0x1b2860,_0x2a0bc3){return new BPromise(function(_0x2c9516,_0x39bf56){return client[_0xa75d('0xd')](_0x53f731,_0x2a0bc3)[_0xa75d('0xe')](function(_0x35ad40){logger[_0xa75d('0xf')](_0xa75d('0x10'),_0x1b2860,_0xa75d('0x11'));logger['debug'](_0xa75d('0x12'),_0x1b2860,_0xa75d('0x11'),JSON[_0xa75d('0x13')](_0x35ad40));if(_0x35ad40[_0xa75d('0x14')]){if(_0x35ad40['error'][_0xa75d('0x15')]===0x1f4){logger[_0xa75d('0x14')](_0xa75d('0x10'),_0x1b2860,_0x35ad40['error']['message']);return _0x39bf56(_0x35ad40[_0xa75d('0x14')][_0xa75d('0x16')]);}logger[_0xa75d('0x14')](_0xa75d('0x10'),_0x1b2860,_0x35ad40['error'][_0xa75d('0x16')]);return _0x2c9516(_0x35ad40[_0xa75d('0x14')][_0xa75d('0x16')]);}else{logger[_0xa75d('0xf')](_0xa75d('0x10'),_0x1b2860,_0xa75d('0x11'));_0x2c9516(_0x35ad40[_0xa75d('0x17')][_0xa75d('0x16')]);}})[_0xa75d('0x18')](function(_0x370a46){logger[_0xa75d('0x14')](_0xa75d('0x10'),_0x1b2860,_0x370a46);_0x39bf56(_0x370a46);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 95953be..b6e8576 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 _0x6334=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4d35f3,_0x19ba66){var _0x382fea=function(_0x2c2390){while(--_0x2c2390){_0x4d35f3['push'](_0x4d35f3['shift']());}};_0x382fea(++_0x19ba66);}(_0x6334,0x119));var _0x4633=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0x6334[_0x142020];return _0x40da8f;};'use strict';var multer=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var path=require(_0x4633('0x2'));var timeout=require(_0x4633('0x3'));var express=require(_0x4633('0x4'));var router=express[_0x4633('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4633('0x6'));var interaction=require(_0x4633('0x7'));var config=require(_0x4633('0x8'));var controller=require(_0x4633('0x9'));router[_0x4633('0xa')]('/',auth[_0x4633('0xb')](),controller[_0x4633('0xc')]);router['get'](_0x4633('0xd'),auth['isAuthenticated'](),controller[_0x4633('0xe')]);router[_0x4633('0xf')]('/',auth['isAuthenticated'](),controller[_0x4633('0x10')]);router[_0x4633('0x11')](_0x4633('0xd'),auth['isAuthenticated'](),controller[_0x4633('0x12')]);router[_0x4633('0x13')]('/:id',auth[_0x4633('0xb')](),controller[_0x4633('0x14')]);module[_0x4633('0x15')]=router; \ No newline at end of file +var _0xaba6=['delete','destroy','multer','util','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','show','create','/:id','update'];(function(_0x558521,_0x40555a){var _0x4ba7a2=function(_0x6c6c62){while(--_0x6c6c62){_0x558521['push'](_0x558521['shift']());}};_0x4ba7a2(++_0x40555a);}(_0xaba6,0xe2));var _0x6aba=function(_0x41293b,_0x4e73cd){_0x41293b=_0x41293b-0x0;var _0x8a8ec9=_0xaba6[_0x41293b];return _0x8a8ec9;};'use strict';var multer=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6aba('0x2'));var auth=require(_0x6aba('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6aba('0x4'));var controller=require(_0x6aba('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6aba('0x6')]('/:id',auth[_0x6aba('0x7')](),controller[_0x6aba('0x8')]);router['post']('/',auth[_0x6aba('0x7')](),controller[_0x6aba('0x9')]);router['put'](_0x6aba('0xa'),auth[_0x6aba('0x7')](),controller[_0x6aba('0xb')]);router[_0x6aba('0xc')](_0x6aba('0xa'),auth[_0x6aba('0x7')](),controller[_0x6aba('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 5162c7e..077928c 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 _0x41c9=['UNSIGNED','contactListQueue','sequelize','STRING','BOOLEAN','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE'];(function(_0x15a89f,_0x2ad1fe){var _0x2d7f5c=function(_0x239969){while(--_0x239969){_0x15a89f['push'](_0x15a89f['shift']());}};_0x2d7f5c(++_0x2ad1fe);}(_0x41c9,0xd2));var _0x941c=function(_0x19a257,_0x42b509){_0x19a257=_0x19a257-0x0;var _0x4b6e49=_0x41c9[_0x19a257];return _0x4b6e49;};'use strict';var moment=require('moment');var Sequelize=require(_0x941c('0x0'));module['exports']={'phone':{'type':Sequelize[_0x941c('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x941c('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x941c('0x3'))},'countbusyretry':{'type':Sequelize[_0x941c('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x941c('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x941c('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x941c('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x941c('0x5')]},'priority':{'type':Sequelize[_0x941c('0x4')](0x2)[_0x941c('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x941c('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x941c('0x4')],'unique':_0x941c('0x7')},'ListId':{'type':Sequelize[_0x941c('0x4')],'unique':_0x941c('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x941c('0x4')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x941c('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x941c('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x941c('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x941c('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x941c('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x941c('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1069=['contactListQueue','moment','BOOLEAN','DATE','INTEGER','STRING','UNSIGNED'];(function(_0x46796b,_0x1ff5b0){var _0x33e74e=function(_0x5477ef){while(--_0x5477ef){_0x46796b['push'](_0x46796b['shift']());}};_0x33e74e(++_0x1ff5b0);}(_0x1069,0xe1));var _0x9106=function(_0x46edc0,_0x2ce700){_0x46edc0=_0x46edc0-0x0;var _0x2ca5fa=_0x1069[_0x46edc0];return _0x2ca5fa;};'use strict';var moment=require(_0x9106('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x9106('0x1')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x9106('0x2')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x9106('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x9106('0x1')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9106('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x9106('0x3')](0x2)[_0x9106('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x9106('0x3')],'unique':_0x9106('0x6')},'ListId':{'type':Sequelize[_0x9106('0x3')],'unique':_0x9106('0x6')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x9106('0x3')],'unique':_0x9106('0x6')},'CampaignId':{'type':Sequelize[_0x9106('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x9106('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9106('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9106('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9106('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 7b4fad1..4cd2285 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 _0x2e72=['CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','map','direction','isEmpty','hopperIds','priority','scheduledAt','DESC','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','sendStatus','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','end','error','stack','name','send','CmHopper','rawAttributes','fieldName','type','key','model','query','filters','concat','$and','$gt','$gte','$ne','$not','$between','$in','$like','$notLike','$iLike','$notILike','$overlap','$contained','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','findAll','rows','catch','params','keys','intersection','fields','includeAll','include','merge','options','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','updatedAt','state','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0x2e72,0x147));var _0x22e7=function(_0x4f74a5,_0x1fd979){_0x4f74a5=_0x4f74a5-0x0;var _0x5be8b2=_0x2e72[_0x4f74a5];return _0x5be8b2;};'use strict';var emlformat=require(_0x22e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x22e7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x22e7('0x2'));var moment=require(_0x22e7('0x3'));var BPromise=require(_0x22e7('0x4'));var Mustache=require(_0x22e7('0x5'));var util=require(_0x22e7('0x6'));var path=require(_0x22e7('0x7'));var sox=require('sox');var csv=require(_0x22e7('0x8'));var ejs=require(_0x22e7('0x9'));var fs=require('fs');var fs_extra=require(_0x22e7('0xa'));var _=require(_0x22e7('0xb'));var squel=require(_0x22e7('0xc'));var crypto=require(_0x22e7('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x22e7('0x8'));var querystring=require(_0x22e7('0xe'));var Papa=require('papaparse');var Redis=require(_0x22e7('0xf'));var authService=require(_0x22e7('0x10'));var qs=require(_0x22e7('0x11'));var as=require(_0x22e7('0x12'));var hardwareService=require(_0x22e7('0x13'));var logger=require(_0x22e7('0x14'))(_0x22e7('0x15'));var utils=require(_0x22e7('0x16'));var config=require(_0x22e7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x22e7('0x18'))['db'];function respondWithStatusCode(_0x94ee9c,_0x4fcc84){_0x4fcc84=_0x4fcc84||0xcc;return function(_0x3a8dc2){if(_0x3a8dc2){return _0x94ee9c['sendStatus'](_0x4fcc84);}return _0x94ee9c[_0x22e7('0x19')](_0x4fcc84)['end']();};}function respondWithResult(_0x1d3bd8,_0x10918b){_0x10918b=_0x10918b||0xc8;return function(_0x4d78ec){if(_0x4d78ec){return _0x1d3bd8[_0x22e7('0x19')](_0x10918b)[_0x22e7('0x1a')](_0x4d78ec);}};}function respondWithFilteredResult(_0x133525,_0xef8cc0){return function(_0x5dd67f){if(_0x5dd67f){var _0x535750=typeof _0xef8cc0[_0x22e7('0x1b')]===_0x22e7('0x1c')&&typeof _0xef8cc0[_0x22e7('0x1d')]===_0x22e7('0x1c');var _0x185d4c=_0x5dd67f[_0x22e7('0x1e')];var _0x40df63=_0x535750?0x0:_0xef8cc0[_0x22e7('0x1b')];var _0x5e9170=_0x535750?_0x5dd67f[_0x22e7('0x1e')]:_0xef8cc0[_0x22e7('0x1b')]+_0xef8cc0[_0x22e7('0x1d')];var _0x4037eb;if(_0x5e9170>=_0x185d4c){_0x5e9170=_0x185d4c;_0x4037eb=0xc8;}else{_0x4037eb=0xce;}_0x133525[_0x22e7('0x19')](_0x4037eb);return _0x133525[_0x22e7('0x1f')](_0x22e7('0x20'),_0x40df63+'-'+_0x5e9170+'/'+_0x185d4c)[_0x22e7('0x1a')](_0x5dd67f);}return null;};}function patchUpdates(_0x279595){return function(_0x17e31f){try{jsonpatch['apply'](_0x17e31f,_0x279595,!![]);}catch(_0x10418c){return BPromise['reject'](_0x10418c);}return _0x17e31f[_0x22e7('0x21')]();};}function saveUpdates(_0x178397,_0x50d5da){return function(_0x1eab5c){if(_0x1eab5c){return _0x1eab5c[_0x22e7('0x22')](_0x178397)['then'](function(_0x18ff10){return _0x18ff10;});}return null;};}function removeEntity(_0xf4111,_0x195a51){return function(_0x21c08a){if(_0x21c08a){return _0x21c08a['destroy']()[_0x22e7('0x23')](function(){_0xf4111[_0x22e7('0x19')](0xcc)[_0x22e7('0x24')]();});}};}function handleEntityNotFound(_0x5971bd,_0x39bf9a){return function(_0x19e2f4){if(!_0x19e2f4){_0x5971bd['sendStatus'](0x194);}return _0x19e2f4;};}function handleError(_0x44750c,_0x3fe93c){_0x3fe93c=_0x3fe93c||0x1f4;return function(_0xcd91e7){logger[_0x22e7('0x25')](_0xcd91e7[_0x22e7('0x26')]);if(_0xcd91e7[_0x22e7('0x27')]){delete _0xcd91e7[_0x22e7('0x27')];}_0x44750c['status'](_0x3fe93c)[_0x22e7('0x28')](_0xcd91e7);};}exports['index']=function(_0x283290,_0x3b18d1){var _0x15f42c={},_0x3c85c7={},_0x3b2375={'count':0x0,'rows':[]};var _0x5dd5cf=_['map'](db[_0x22e7('0x29')][_0x22e7('0x2a')],function(_0x3edfd8){return{'name':_0x3edfd8[_0x22e7('0x2b')],'type':_0x3edfd8[_0x22e7('0x2c')][_0x22e7('0x2d')]};});_0x3c85c7[_0x22e7('0x2e')]=_['map'](_0x5dd5cf,_0x22e7('0x27'));_0x3c85c7[_0x22e7('0x2f')]=_['keys'](_0x283290[_0x22e7('0x2f')]);_0x3c85c7[_0x22e7('0x30')]=_['intersection'](_0x3c85c7[_0x22e7('0x2e')],_0x3c85c7[_0x22e7('0x2f')]);_0x3c85c7[_0x22e7('0x30')]=_[_0x22e7('0x31')](_0x3c85c7[_0x22e7('0x30')],[_0x22e7('0x32'),'$or',_0x22e7('0x33'),_0x22e7('0x34'),'$lt','$lte',_0x22e7('0x35'),'$eq',_0x22e7('0x36'),_0x22e7('0x37'),'$notBetween',_0x22e7('0x38'),'$notIn',_0x22e7('0x39'),_0x22e7('0x3a'),_0x22e7('0x3b'),_0x22e7('0x3c'),_0x22e7('0x39'),_0x22e7('0x3d'),'$contains',_0x22e7('0x3e'),'$any']);_0x15f42c[_0x22e7('0x3f')]=_['intersection'](_0x3c85c7[_0x22e7('0x2e')],qs['fields'](_0x283290[_0x22e7('0x2f')]['fields']));_0x15f42c[_0x22e7('0x3f')]=_0x15f42c[_0x22e7('0x3f')][_0x22e7('0x40')]?_0x15f42c['attributes']:_0x3c85c7['model'];if(!_0x283290[_0x22e7('0x2f')][_0x22e7('0x41')](_0x22e7('0x42'))){_0x15f42c[_0x22e7('0x1d')]=qs[_0x22e7('0x1d')](_0x283290[_0x22e7('0x2f')][_0x22e7('0x1d')]);_0x15f42c[_0x22e7('0x1b')]=qs['offset'](_0x283290[_0x22e7('0x2f')][_0x22e7('0x1b')]);}_0x15f42c[_0x22e7('0x43')]=qs[_0x22e7('0x44')](_0x283290[_0x22e7('0x2f')][_0x22e7('0x44')]);_0x15f42c[_0x22e7('0x45')]=qs[_0x22e7('0x30')](_[_0x22e7('0x46')](_0x283290[_0x22e7('0x2f')],_0x3c85c7[_0x22e7('0x30')]),_0x5dd5cf);if(_0x283290[_0x22e7('0x2f')][_0x22e7('0x47')]){_0x15f42c[_0x22e7('0x45')]=_['merge'](_0x15f42c[_0x22e7('0x45')],{'$or':_['map'](_0x5dd5cf,function(_0x224736){if(_0x224736['type']!==_0x22e7('0x48')){var _0x2be5b8={};_0x2be5b8[_0x224736['name']]={'$like':'%'+_0x283290['query']['filter']+'%'};return _0x2be5b8;}})});}_0x15f42c=_['merge']({},_0x15f42c,_0x283290['options']);var _0x3ae674={'where':_0x15f42c['where']};return db[_0x22e7('0x29')][_0x22e7('0x1e')](_0x3ae674)[_0x22e7('0x23')](function(_0x4b4622){_0x3b2375[_0x22e7('0x1e')]=_0x4b4622;if(_0x283290[_0x22e7('0x2f')]['includeAll']){_0x15f42c['include']=[{'all':!![]}];}return db['CmHopper'][_0x22e7('0x49')](_0x15f42c);})[_0x22e7('0x23')](function(_0x3a6438){_0x3b2375[_0x22e7('0x4a')]=_0x3a6438;return _0x3b2375;})[_0x22e7('0x23')](respondWithFilteredResult(_0x3b18d1,_0x15f42c))[_0x22e7('0x4b')](handleError(_0x3b18d1,null));};exports['show']=function(_0xc069de,_0x556e13){var _0x522cbf={'raw':!![],'where':{'id':_0xc069de[_0x22e7('0x4c')]['id']}},_0x381faf={};_0x381faf['model']=_[_0x22e7('0x4d')](db[_0x22e7('0x29')][_0x22e7('0x2a')]);_0x381faf[_0x22e7('0x2f')]=_[_0x22e7('0x4d')](_0xc069de['query']);_0x381faf['filters']=_['intersection'](_0x381faf[_0x22e7('0x2e')],_0x381faf[_0x22e7('0x2f')]);_0x522cbf[_0x22e7('0x3f')]=_[_0x22e7('0x4e')](_0x381faf[_0x22e7('0x2e')],qs[_0x22e7('0x4f')](_0xc069de['query'][_0x22e7('0x4f')]));_0x522cbf[_0x22e7('0x3f')]=_0x522cbf['attributes'][_0x22e7('0x40')]?_0x522cbf[_0x22e7('0x3f')]:_0x381faf[_0x22e7('0x2e')];if(_0xc069de[_0x22e7('0x2f')][_0x22e7('0x50')]){_0x522cbf[_0x22e7('0x51')]=[{'all':!![]}];}_0x522cbf=_[_0x22e7('0x52')]({},_0x522cbf,_0xc069de[_0x22e7('0x53')]);return db[_0x22e7('0x29')][_0x22e7('0x54')](_0x522cbf)[_0x22e7('0x23')](handleEntityNotFound(_0x556e13,null))['then'](respondWithResult(_0x556e13,null))[_0x22e7('0x4b')](handleError(_0x556e13,null));};exports[_0x22e7('0x55')]=function(_0x468193,_0x190a7a){return db['CmHopper'][_0x22e7('0x55')](_0x468193[_0x22e7('0x56')],{})[_0x22e7('0x23')](respondWithResult(_0x190a7a,0xc9))[_0x22e7('0x4b')](handleError(_0x190a7a,null));};exports['update']=function(_0x143f88,_0x398d95){if(_0x143f88[_0x22e7('0x56')]['id']){delete _0x143f88[_0x22e7('0x56')]['id'];}return db['CmHopper'][_0x22e7('0x54')]({'where':{'id':_0x143f88[_0x22e7('0x4c')]['id']}})[_0x22e7('0x23')](handleEntityNotFound(_0x398d95,null))[_0x22e7('0x23')](saveUpdates(_0x143f88['body'],null))[_0x22e7('0x23')](respondWithResult(_0x398d95,null))[_0x22e7('0x4b')](handleError(_0x398d95,null));};exports[_0x22e7('0x57')]=function(_0x405a3,_0x4a474c){return db[_0x22e7('0x29')][_0x22e7('0x57')]()[_0x22e7('0x23')](respondWithResult(_0x4a474c,null))['catch'](handleError(_0x4a474c,null));};exports[_0x22e7('0x58')]=function(_0x1d3baf,_0x1a67fd){var _0x55d2f6;return db[_0x22e7('0x29')][_0x22e7('0x54')]({'where':{'id':_0x1d3baf[_0x22e7('0x4c')]['id']}})[_0x22e7('0x23')](handleEntityNotFound(_0x1a67fd,null))[_0x22e7('0x23')](function(_0x3a2f8a){if(_0x3a2f8a){return _0x3a2f8a['destroy']()[_0x22e7('0x23')](function(_0x30438b){return _0x30438b;});}})[_0x22e7('0x23')](function(_0x35b67c){_0x55d2f6=_0x35b67c;if(_0x35b67c){if(_0x35b67c[_0x22e7('0x59')]||_0x35b67c[_0x22e7('0x5a')]){return db[_0x35b67c[_0x22e7('0x59')]?_0x22e7('0x5b'):'Campaign'][_0x22e7('0x54')]({'where':{'id':_0x35b67c[_0x22e7('0x59')]?_0x35b67c['VoiceQueueId']:_0x35b67c[_0x22e7('0x5a')]},'attributes':['id',_0x22e7('0x27')],'raw':!![]});}}})[_0x22e7('0x23')](function(_0x12aafb){var _0x867f2a={};if(_0x12aafb){_[_0x22e7('0x52')](_0x867f2a,_[_0x22e7('0x5c')](_0x55d2f6[_0x22e7('0x5d')],['createdAt',_0x22e7('0x5e'),'id']));_0x867f2a[_0x22e7('0x5f')]=0x15;_0x867f2a['statedesc']=_0x22e7('0x60');_0x867f2a[_0x22e7('0x61')]=_0x12aafb[_0x22e7('0x27')];_0x867f2a[_0x22e7('0x62')]=_0x1d3baf['user'][_0x22e7('0x27')];_0x867f2a['UserId']=_0x1d3baf[_0x22e7('0x63')]['id'];_0x867f2a['deleted']=!![];_0x867f2a[_0x22e7('0x64')]=moment()[_0x22e7('0x65')](_0x22e7('0x66'));_0x867f2a[_0x22e7('0x67')]=_0x55d2f6[_0x22e7('0x68')];_0x867f2a[_0x22e7('0x69')]=_0x55d2f6[_0x22e7('0x59')]?_0x22e7('0x6a'):'ivr';return db[_0x22e7('0x6b')][_0x22e7('0x54')]({'where':{'id':_0x867f2a[_0x22e7('0x6c')]},'attributes':[_0x22e7('0x6d'),_0x22e7('0x6e')]})[_0x22e7('0x23')](function(_0x3432e4){if(!_[_0x22e7('0x6f')](_0x1a67fd)&&!_[_0x22e7('0x6f')](_0x3432e4[_0x22e7('0x6d')])){_0x867f2a[_0x22e7('0x70')]=_0x3432e4[_0x22e7('0x6d')];if(!_[_0x22e7('0x6f')](_0x3432e4[_0x22e7('0x6e')])){_0x867f2a[_0x22e7('0x70')]+='\x20'+_0x3432e4[_0x22e7('0x6e')];}}})[_0x22e7('0x71')](function(){return db[_0x22e7('0x72')][_0x22e7('0x55')](_0x867f2a);});}})[_0x22e7('0x23')](function(){return _0x1a67fd[_0x22e7('0x19')](0xcc)[_0x22e7('0x24')]();})[_0x22e7('0x4b')](handleError(_0x1a67fd,null));};exports[_0x22e7('0x73')]=function(_0x1b4fcd,_0x1758e6,_0x23c673){var _0x1d361e=[];return db[_0x22e7('0x6b')][_0x22e7('0x57')]()[_0x22e7('0x23')](function(_0x295cbb){_0x1d361e=_[_0x22e7('0x4d')](_0x295cbb);return _0x1b4fcd[_0x22e7('0x63')][_0x22e7('0x74')]({'where':{'type':_0x22e7('0x75'),'dialActive':!![],'dialMethod':_0x22e7('0x76')},'attributes':['id',_0x22e7('0x77')],'raw':!![]});})['then'](function(_0x5a161b){if(_0x5a161b&&_0x5a161b[_0x22e7('0x40')]){return db[_0x22e7('0x78')][_0x22e7('0x79')](function(_0x3d1419){var _0x2d12ae={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x22e7('0x65')](_0x22e7('0x66'))},'VoiceQueueId':{'$in':_[_0x22e7('0x7a')](_0x5a161b,'id')},'$or':[{'UserId':null},{'UserId':_0x1b4fcd[_0x22e7('0x63')]['id']}]};var _0x31bba5=[];if(_0x1b4fcd[_0x22e7('0x56')][_0x22e7('0x7b')]&&_0x1b4fcd[_0x22e7('0x56')][_0x22e7('0x7b')]==='prev'){if(!_[_0x22e7('0x7c')](_0x1b4fcd['body'][_0x22e7('0x7d')])){_0x2d12ae['id']={'$in':_0x1b4fcd[_0x22e7('0x56')][_0x22e7('0x7d')]};}_0x31bba5=[[_0x22e7('0x7e'),'ASC'],[_0x22e7('0x7f'),_0x5a161b[0x0][_0x22e7('0x77')]==='ASC'?_0x22e7('0x80'):_0x22e7('0x81')],db[_0x22e7('0x78')]['literal'](_0x22e7('0x82')),['id',_0x22e7('0x80')]];}else{if(!_[_0x22e7('0x7c')](_0x1b4fcd['body'][_0x22e7('0x7d')])){_0x2d12ae['id']={'$notIn':_0x1b4fcd[_0x22e7('0x56')][_0x22e7('0x7d')]};}_0x31bba5=[['priority',_0x22e7('0x80')],[_0x22e7('0x7f'),_0x5a161b[0x0][_0x22e7('0x77')]],db[_0x22e7('0x78')][_0x22e7('0x83')](_0x22e7('0x84')),['id',_0x22e7('0x81')]];}return db[_0x22e7('0x29')][_0x22e7('0x85')]({'attributes':['id',_0x22e7('0x86')],'where':_0x2d12ae,'order':_0x31bba5,'transaction':_0x3d1419,'lock':_0x3d1419['LOCK'][_0x22e7('0x87')],'include':[{'model':db[_0x22e7('0x6b')],'as':_0x22e7('0x88'),'attributes':_0x1d361e,'include':[{'model':db[_0x22e7('0x89')],'as':_0x22e7('0x8a'),'attributes':['id','name']}]},{'model':db[_0x22e7('0x8b')],'as':_0x22e7('0x8c'),'attributes':['id','name']},{'model':db[_0x22e7('0x5b')],'as':_0x22e7('0x8d'),'attributes':['id',_0x22e7('0x27'),_0x22e7('0x8e')]}]})[_0x22e7('0x23')](function(_0x166a86){if(_0x166a86){return _0x166a86[_0x22e7('0x22')]({'UserId':_0x1b4fcd[_0x22e7('0x63')]['id']},{'transaction':_0x3d1419});}});});}})['then'](handleEntityNotFound(_0x1758e6,null))[_0x22e7('0x23')](respondWithResult(_0x1758e6,null))[_0x22e7('0x4b')](handleError(_0x1758e6,null));};exports[_0x22e7('0x8f')]=function(_0x3bb98d,_0x4f1727,_0x425a95){return _0x3bb98d[_0x22e7('0x63')][_0x22e7('0x74')]({'where':{'type':_0x22e7('0x75'),'dialActive':!![],'dialMethod':_0x22e7('0x76')},'attributes':['id'],'raw':!![]})[_0x22e7('0x23')](function(_0x12db22){if(_0x12db22&&_0x12db22[_0x22e7('0x40')]){return db['CmHopper'][_0x22e7('0x1e')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x22e7('0x65')](_0x22e7('0x66'))},'VoiceQueueId':{'$in':_[_0x22e7('0x7a')](_0x12db22,'id')},'$or':[{'UserId':null},{'UserId':_0x3bb98d['user']['id']}]}});}return 0x0;})[_0x22e7('0x23')](function(_0x3eec45){if(!_[_0x22e7('0x6f')](_0x3eec45)&&_[_0x22e7('0x90')](_0x3eec45)){return _0x4f1727[_0x22e7('0x19')](0xc8)[_0x22e7('0x1a')]({'contacts':_0x3eec45});}else{logger[_0x22e7('0x25')](_0x22e7('0x91'),_0x22e7('0x8f'),0x194,'entity\x20not\x20found');_0x4f1727[_0x22e7('0x92')](0x194);}})[_0x22e7('0x4b')](handleError(_0x4f1727,null));}; \ No newline at end of file +var _0x9efc=['rawAttributes','type','key','model','map','query','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','CmHopper','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','destroy','VoiceQueueId','CampaignId','Campaign','dataValues','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','preview','dialOrderByScheduledAt','sequelize','format','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','Contact','CmCompany','Company','CmList','List','VoiceQueue','Queue','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','count','set','apply','save','update','then','sendStatus','name','send','index'];(function(_0x43afbb,_0x448109){var _0xa9ddec=function(_0x4e965f){while(--_0x4e965f){_0x43afbb['push'](_0x43afbb['shift']());}};_0xa9ddec(++_0x448109);}(_0x9efc,0x19d));var _0xc9ef=function(_0x1c0fc3,_0x3537bb){_0x1c0fc3=_0x1c0fc3-0x0;var _0x338237=_0x9efc[_0x1c0fc3];return _0x338237;};'use strict';var emlformat=require(_0xc9ef('0x0'));var rimraf=require(_0xc9ef('0x1'));var zipdir=require(_0xc9ef('0x2'));var jsonpatch=require(_0xc9ef('0x3'));var rp=require('request-promise');var moment=require(_0xc9ef('0x4'));var BPromise=require(_0xc9ef('0x5'));var Mustache=require('mustache');var util=require(_0xc9ef('0x6'));var path=require('path');var sox=require(_0xc9ef('0x7'));var csv=require(_0xc9ef('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9ef('0x9'));var _=require(_0xc9ef('0xa'));var squel=require(_0xc9ef('0xb'));var crypto=require(_0xc9ef('0xc'));var jsforce=require(_0xc9ef('0xd'));var deskjs=require(_0xc9ef('0xe'));var toCsv=require(_0xc9ef('0x8'));var querystring=require(_0xc9ef('0xf'));var Papa=require(_0xc9ef('0x10'));var Redis=require(_0xc9ef('0x11'));var authService=require(_0xc9ef('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc9ef('0x13'));var hardwareService=require(_0xc9ef('0x14'));var logger=require(_0xc9ef('0x15'))(_0xc9ef('0x16'));var utils=require(_0xc9ef('0x17'));var config=require(_0xc9ef('0x18'));var licenseUtil=require(_0xc9ef('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ca8a0,_0x345cf7){_0x345cf7=_0x345cf7||0xcc;return function(_0x5f051f){if(_0x5f051f){return _0x2ca8a0['sendStatus'](_0x345cf7);}return _0x2ca8a0[_0xc9ef('0x1a')](_0x345cf7)[_0xc9ef('0x1b')]();};}function respondWithResult(_0x20932e,_0x526f23){_0x526f23=_0x526f23||0xc8;return function(_0xa73704){if(_0xa73704){return _0x20932e[_0xc9ef('0x1a')](_0x526f23)[_0xc9ef('0x1c')](_0xa73704);}};}function respondWithFilteredResult(_0x26605b,_0x5144c3){return function(_0x4fd7cf){if(_0x4fd7cf){var _0x271761=typeof _0x5144c3[_0xc9ef('0x1d')]==='undefined'&&typeof _0x5144c3['limit']==='undefined';var _0x5acf6f=_0x4fd7cf['count'];var _0x2030fb=_0x271761?0x0:_0x5144c3[_0xc9ef('0x1d')];var _0x4d6754=_0x271761?_0x4fd7cf[_0xc9ef('0x1e')]:_0x5144c3[_0xc9ef('0x1d')]+_0x5144c3['limit'];var _0x285f89;if(_0x4d6754>=_0x5acf6f){_0x4d6754=_0x5acf6f;_0x285f89=0xc8;}else{_0x285f89=0xce;}_0x26605b[_0xc9ef('0x1a')](_0x285f89);return _0x26605b[_0xc9ef('0x1f')]('Content-Range',_0x2030fb+'-'+_0x4d6754+'/'+_0x5acf6f)[_0xc9ef('0x1c')](_0x4fd7cf);}return null;};}function patchUpdates(_0x28a2e1){return function(_0x2986d9){try{jsonpatch[_0xc9ef('0x20')](_0x2986d9,_0x28a2e1,!![]);}catch(_0x43c66d){return BPromise['reject'](_0x43c66d);}return _0x2986d9[_0xc9ef('0x21')]();};}function saveUpdates(_0x4090be,_0x389a9d){return function(_0x5d1cf6){if(_0x5d1cf6){return _0x5d1cf6[_0xc9ef('0x22')](_0x4090be)[_0xc9ef('0x23')](function(_0x455301){return _0x455301;});}return null;};}function removeEntity(_0x4c1221,_0x2c6167){return function(_0x412c91){if(_0x412c91){return _0x412c91['destroy']()[_0xc9ef('0x23')](function(){_0x4c1221[_0xc9ef('0x1a')](0xcc)[_0xc9ef('0x1b')]();});}};}function handleEntityNotFound(_0x201e26,_0x1e2daa){return function(_0x4b9550){if(!_0x4b9550){_0x201e26[_0xc9ef('0x24')](0x194);}return _0x4b9550;};}function handleError(_0x454dd2,_0x3a54dc){_0x3a54dc=_0x3a54dc||0x1f4;return function(_0x1647d0){logger['error'](_0x1647d0['stack']);if(_0x1647d0[_0xc9ef('0x25')]){delete _0x1647d0['name'];}_0x454dd2[_0xc9ef('0x1a')](_0x3a54dc)[_0xc9ef('0x26')](_0x1647d0);};}exports[_0xc9ef('0x27')]=function(_0x45f6cf,_0x4c4dba){var _0x3fc3dd={},_0x5b35dd={},_0x5a36f1={'count':0x0,'rows':[]};var _0x5e5c7e=_['map'](db['CmHopper'][_0xc9ef('0x28')],function(_0x33c957){return{'name':_0x33c957['fieldName'],'type':_0x33c957[_0xc9ef('0x29')][_0xc9ef('0x2a')]};});_0x5b35dd[_0xc9ef('0x2b')]=_[_0xc9ef('0x2c')](_0x5e5c7e,'name');_0x5b35dd[_0xc9ef('0x2d')]=_['keys'](_0x45f6cf[_0xc9ef('0x2d')]);_0x5b35dd[_0xc9ef('0x2e')]=_[_0xc9ef('0x2f')](_0x5b35dd['model'],_0x5b35dd[_0xc9ef('0x2d')]);_0x5b35dd['filters']=_[_0xc9ef('0x30')](_0x5b35dd[_0xc9ef('0x2e')],[_0xc9ef('0x31'),_0xc9ef('0x32'),_0xc9ef('0x33'),_0xc9ef('0x34'),_0xc9ef('0x35'),_0xc9ef('0x36'),_0xc9ef('0x37'),_0xc9ef('0x38'),_0xc9ef('0x39'),_0xc9ef('0x3a'),_0xc9ef('0x3b'),_0xc9ef('0x3c'),_0xc9ef('0x3d'),_0xc9ef('0x3e'),_0xc9ef('0x3f'),'$iLike',_0xc9ef('0x40'),_0xc9ef('0x3e'),_0xc9ef('0x41'),_0xc9ef('0x42'),_0xc9ef('0x43'),_0xc9ef('0x44')]);_0x3fc3dd[_0xc9ef('0x45')]=_[_0xc9ef('0x2f')](_0x5b35dd[_0xc9ef('0x2b')],qs[_0xc9ef('0x46')](_0x45f6cf[_0xc9ef('0x2d')][_0xc9ef('0x46')]));_0x3fc3dd[_0xc9ef('0x45')]=_0x3fc3dd[_0xc9ef('0x45')][_0xc9ef('0x47')]?_0x3fc3dd['attributes']:_0x5b35dd['model'];if(!_0x45f6cf[_0xc9ef('0x2d')][_0xc9ef('0x48')]('nolimit')){_0x3fc3dd[_0xc9ef('0x49')]=qs[_0xc9ef('0x49')](_0x45f6cf[_0xc9ef('0x2d')][_0xc9ef('0x49')]);_0x3fc3dd[_0xc9ef('0x1d')]=qs[_0xc9ef('0x1d')](_0x45f6cf['query'][_0xc9ef('0x1d')]);}_0x3fc3dd[_0xc9ef('0x4a')]=qs[_0xc9ef('0x4b')](_0x45f6cf[_0xc9ef('0x2d')]['sort']);_0x3fc3dd[_0xc9ef('0x4c')]=qs[_0xc9ef('0x2e')](_[_0xc9ef('0x4d')](_0x45f6cf[_0xc9ef('0x2d')],_0x5b35dd['filters']),_0x5e5c7e);if(_0x45f6cf[_0xc9ef('0x2d')][_0xc9ef('0x4e')]){_0x3fc3dd[_0xc9ef('0x4c')]=_[_0xc9ef('0x4f')](_0x3fc3dd[_0xc9ef('0x4c')],{'$or':_['map'](_0x5e5c7e,function(_0x51a328){if(_0x51a328[_0xc9ef('0x29')]!=='VIRTUAL'){var _0x435a73={};_0x435a73[_0x51a328[_0xc9ef('0x25')]]={'$like':'%'+_0x45f6cf[_0xc9ef('0x2d')]['filter']+'%'};return _0x435a73;}})});}_0x3fc3dd=_[_0xc9ef('0x4f')]({},_0x3fc3dd,_0x45f6cf[_0xc9ef('0x50')]);var _0x2be84c={'where':_0x3fc3dd[_0xc9ef('0x4c')]};return db[_0xc9ef('0x51')]['count'](_0x2be84c)[_0xc9ef('0x23')](function(_0x5bf122){_0x5a36f1['count']=_0x5bf122;if(_0x45f6cf[_0xc9ef('0x2d')][_0xc9ef('0x52')]){_0x3fc3dd[_0xc9ef('0x53')]=[{'all':!![]}];}return db['CmHopper'][_0xc9ef('0x54')](_0x3fc3dd);})[_0xc9ef('0x23')](function(_0x31f7c9){_0x5a36f1[_0xc9ef('0x55')]=_0x31f7c9;return _0x5a36f1;})['then'](respondWithFilteredResult(_0x4c4dba,_0x3fc3dd))[_0xc9ef('0x56')](handleError(_0x4c4dba,null));};exports[_0xc9ef('0x57')]=function(_0xfee817,_0x30d54d){var _0x3f2b09={'raw':!![],'where':{'id':_0xfee817[_0xc9ef('0x58')]['id']}},_0x2e9486={};_0x2e9486[_0xc9ef('0x2b')]=_[_0xc9ef('0x59')](db['CmHopper']['rawAttributes']);_0x2e9486[_0xc9ef('0x2d')]=_[_0xc9ef('0x59')](_0xfee817['query']);_0x2e9486[_0xc9ef('0x2e')]=_[_0xc9ef('0x2f')](_0x2e9486[_0xc9ef('0x2b')],_0x2e9486[_0xc9ef('0x2d')]);_0x3f2b09[_0xc9ef('0x45')]=_[_0xc9ef('0x2f')](_0x2e9486[_0xc9ef('0x2b')],qs[_0xc9ef('0x46')](_0xfee817[_0xc9ef('0x2d')][_0xc9ef('0x46')]));_0x3f2b09[_0xc9ef('0x45')]=_0x3f2b09[_0xc9ef('0x45')][_0xc9ef('0x47')]?_0x3f2b09[_0xc9ef('0x45')]:_0x2e9486['model'];if(_0xfee817['query']['includeAll']){_0x3f2b09[_0xc9ef('0x53')]=[{'all':!![]}];}_0x3f2b09=_[_0xc9ef('0x4f')]({},_0x3f2b09,_0xfee817[_0xc9ef('0x50')]);return db[_0xc9ef('0x51')]['find'](_0x3f2b09)[_0xc9ef('0x23')](handleEntityNotFound(_0x30d54d,null))['then'](respondWithResult(_0x30d54d,null))['catch'](handleError(_0x30d54d,null));};exports['create']=function(_0x266a20,_0x1eee7e){return db['CmHopper'][_0xc9ef('0x5a')](_0x266a20[_0xc9ef('0x5b')],{})[_0xc9ef('0x23')](respondWithResult(_0x1eee7e,0xc9))['catch'](handleError(_0x1eee7e,null));};exports[_0xc9ef('0x22')]=function(_0x25b17a,_0x2452c1){if(_0x25b17a['body']['id']){delete _0x25b17a[_0xc9ef('0x5b')]['id'];}return db[_0xc9ef('0x51')][_0xc9ef('0x5c')]({'where':{'id':_0x25b17a['params']['id']}})[_0xc9ef('0x23')](handleEntityNotFound(_0x2452c1,null))[_0xc9ef('0x23')](saveUpdates(_0x25b17a[_0xc9ef('0x5b')],null))[_0xc9ef('0x23')](respondWithResult(_0x2452c1,null))[_0xc9ef('0x56')](handleError(_0x2452c1,null));};exports[_0xc9ef('0x5d')]=function(_0x38af4c,_0xfc2b19){return db[_0xc9ef('0x51')]['describe']()[_0xc9ef('0x23')](respondWithResult(_0xfc2b19,null))[_0xc9ef('0x56')](handleError(_0xfc2b19,null));};exports[_0xc9ef('0x5e')]=function(_0x144565,_0x3ca748){var _0xd5bbf6;return db[_0xc9ef('0x51')][_0xc9ef('0x5c')]({'where':{'id':_0x144565[_0xc9ef('0x58')]['id']}})[_0xc9ef('0x23')](handleEntityNotFound(_0x3ca748,null))['then'](function(_0x246a99){if(_0x246a99){return _0x246a99[_0xc9ef('0x5e')]()['then'](function(_0x6f4ff8){return _0x6f4ff8;});}})[_0xc9ef('0x23')](function(_0x1f7cf1){_0xd5bbf6=_0x1f7cf1;if(_0x1f7cf1){if(_0x1f7cf1[_0xc9ef('0x5f')]||_0x1f7cf1[_0xc9ef('0x60')]){return db[_0x1f7cf1[_0xc9ef('0x5f')]?'VoiceQueue':_0xc9ef('0x61')][_0xc9ef('0x5c')]({'where':{'id':_0x1f7cf1[_0xc9ef('0x5f')]?_0x1f7cf1['VoiceQueueId']:_0x1f7cf1[_0xc9ef('0x60')]},'attributes':['id',_0xc9ef('0x25')],'raw':!![]});}}})['then'](function(_0x59ea34){var _0x54a1c2={};if(_0x59ea34){_[_0xc9ef('0x4f')](_0x54a1c2,_['omit'](_0xd5bbf6[_0xc9ef('0x62')],['createdAt',_0xc9ef('0x63'),'id']));_0x54a1c2[_0xc9ef('0x64')]=0x15;_0x54a1c2[_0xc9ef('0x65')]=_0xc9ef('0x66');_0x54a1c2[_0xc9ef('0x67')]=_0x59ea34[_0xc9ef('0x25')];_0x54a1c2[_0xc9ef('0x68')]=_0x144565[_0xc9ef('0x69')][_0xc9ef('0x25')];_0x54a1c2[_0xc9ef('0x6a')]=_0x144565['user']['id'];_0x54a1c2[_0xc9ef('0x66')]=!![];_0x54a1c2[_0xc9ef('0x6b')]=moment()['format'](_0xc9ef('0x6c'));_0x54a1c2[_0xc9ef('0x6d')]=_0xd5bbf6[_0xc9ef('0x6e')];_0x54a1c2[_0xc9ef('0x6f')]=_0xd5bbf6[_0xc9ef('0x5f')]?_0xc9ef('0x70'):_0xc9ef('0x71');return db[_0xc9ef('0x72')]['find']({'where':{'id':_0x54a1c2[_0xc9ef('0x73')]},'attributes':[_0xc9ef('0x74'),_0xc9ef('0x75')]})[_0xc9ef('0x23')](function(_0x17524f){if(!_[_0xc9ef('0x76')](_0x3ca748)&&!_[_0xc9ef('0x76')](_0x17524f[_0xc9ef('0x74')])){_0x54a1c2[_0xc9ef('0x77')]=_0x17524f[_0xc9ef('0x74')];if(!_[_0xc9ef('0x76')](_0x17524f[_0xc9ef('0x75')])){_0x54a1c2['calleridname']+='\x20'+_0x17524f['lastName'];}}})[_0xc9ef('0x78')](function(){return db[_0xc9ef('0x79')][_0xc9ef('0x5a')](_0x54a1c2);});}})[_0xc9ef('0x23')](function(){return _0x3ca748['status'](0xcc)[_0xc9ef('0x1b')]();})[_0xc9ef('0x56')](handleError(_0x3ca748,null));};exports['getPreview']=function(_0x3d9839,_0xfa484,_0x52939e){var _0x55c61f=[];return db[_0xc9ef('0x72')]['describe']()[_0xc9ef('0x23')](function(_0x59b956){_0x55c61f=_[_0xc9ef('0x59')](_0x59b956);return _0x3d9839[_0xc9ef('0x69')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xc9ef('0x7a')},'attributes':['id',_0xc9ef('0x7b')],'raw':!![]});})[_0xc9ef('0x23')](function(_0x344627){if(_0x344627&&_0x344627[_0xc9ef('0x47')]){return db[_0xc9ef('0x7c')]['transaction'](function(_0x803cfe){var _0x343683={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xc9ef('0x7d')](_0xc9ef('0x6c'))},'VoiceQueueId':{'$in':_['map'](_0x344627,'id')},'$or':[{'UserId':null},{'UserId':_0x3d9839['user']['id']}]};var _0x391ed3=[];if(_0x3d9839['body'][_0xc9ef('0x7e')]&&_0x3d9839[_0xc9ef('0x5b')][_0xc9ef('0x7e')]===_0xc9ef('0x7f')){if(!_[_0xc9ef('0x80')](_0x3d9839[_0xc9ef('0x5b')]['hopperIds'])){_0x343683['id']={'$in':_0x3d9839['body'][_0xc9ef('0x81')]};}_0x391ed3=[[_0xc9ef('0x82'),_0xc9ef('0x83')],[_0xc9ef('0x84'),_0x344627[0x0][_0xc9ef('0x7b')]===_0xc9ef('0x83')?_0xc9ef('0x85'):_0xc9ef('0x83')],db['sequelize'][_0xc9ef('0x86')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xc9ef('0x85')]];}else{if(!_['isEmpty'](_0x3d9839['body'][_0xc9ef('0x81')])){_0x343683['id']={'$notIn':_0x3d9839[_0xc9ef('0x5b')][_0xc9ef('0x81')]};}_0x391ed3=[[_0xc9ef('0x82'),'DESC'],['scheduledAt',_0x344627[0x0][_0xc9ef('0x7b')]],db[_0xc9ef('0x7c')][_0xc9ef('0x86')](_0xc9ef('0x87')),['id',_0xc9ef('0x83')]];}return db['CmHopper'][_0xc9ef('0x88')]({'attributes':['id',_0xc9ef('0x89')],'where':_0x343683,'order':_0x391ed3,'transaction':_0x803cfe,'lock':_0x803cfe['LOCK'][_0xc9ef('0x8a')],'include':[{'model':db[_0xc9ef('0x72')],'as':_0xc9ef('0x8b'),'attributes':_0x55c61f,'include':[{'model':db[_0xc9ef('0x8c')],'as':_0xc9ef('0x8d'),'attributes':['id','name']}]},{'model':db[_0xc9ef('0x8e')],'as':_0xc9ef('0x8f'),'attributes':['id','name']},{'model':db[_0xc9ef('0x90')],'as':_0xc9ef('0x91'),'attributes':['id','name','dialActive']}]})[_0xc9ef('0x23')](function(_0x3a1114){if(_0x3a1114){return _0x3a1114[_0xc9ef('0x22')]({'UserId':_0x3d9839['user']['id']},{'transaction':_0x803cfe});}});});}})[_0xc9ef('0x23')](handleEntityNotFound(_0xfa484,null))[_0xc9ef('0x23')](respondWithResult(_0xfa484,null))[_0xc9ef('0x56')](handleError(_0xfa484,null));};exports[_0xc9ef('0x92')]=function(_0x3e237f,_0x13c682,_0x3cda9c){return _0x3e237f['user'][_0xc9ef('0x93')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xc9ef('0x7a')},'attributes':['id'],'raw':!![]})[_0xc9ef('0x23')](function(_0x2daa52){if(_0x2daa52&&_0x2daa52[_0xc9ef('0x47')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xc9ef('0x7d')](_0xc9ef('0x6c'))},'VoiceQueueId':{'$in':_[_0xc9ef('0x2c')](_0x2daa52,'id')},'$or':[{'UserId':null},{'UserId':_0x3e237f['user']['id']}]}});}return 0x0;})[_0xc9ef('0x23')](function(_0x2c3e6f){if(!_[_0xc9ef('0x76')](_0x2c3e6f)&&_[_0xc9ef('0x94')](_0x2c3e6f)){return _0x13c682[_0xc9ef('0x1a')](0xc8)[_0xc9ef('0x1c')]({'contacts':_0x2c3e6f});}else{logger['error'](_0xc9ef('0x95'),_0xc9ef('0x92'),0x194,_0xc9ef('0x96'));_0x13c682[_0xc9ef('0x24')](0x194);}})[_0xc9ef('0x56')](handleError(_0x13c682,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 91a0dd5..0b9c265 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 _0xd8fb=['util','../../config/logger','api','path','rimraf','./cmHopper.attributes','exports','CmHopper','scheduledat','priority','lodash'];(function(_0x21fdcb,_0x4964c7){var _0x3634f1=function(_0x53aa16){while(--_0x53aa16){_0x21fdcb['push'](_0x21fdcb['shift']());}};_0x3634f1(++_0x4964c7);}(_0xd8fb,0x99));var _0xbd8f=function(_0x5c5c37,_0x5c6165){_0x5c5c37=_0x5c5c37-0x0;var _0x31b432=_0xd8fb[_0x5c5c37];return _0x31b432;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xbd8f('0x9'),'fields':[_0xbd8f('0x9')]},{'name':'phone','fields':['phone']},{'name':_0xbd8f('0xa'),'fields':[_0xbd8f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc6ac=['./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x48f011,_0x4787c2){_0x48f011=_0x48f011-0x0;var _0x2a2c82=_0xc6ac[_0x48f011];return _0x2a2c82;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'paranoid':![],'indexes':[{'name':_0xcc6a('0xe'),'fields':['scheduledat']},{'name':_0xcc6a('0xf'),'fields':[_0xcc6a('0xf')]},{'name':_0xcc6a('0x10'),'fields':[_0xcc6a('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 1d7fb37..a73b026 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 _0xbdc5=['limit','map','include','model','attributes','find','raw','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','findAll','Contact','keys','User','length','UserId','push','includes','all','MoveContactManagedDialer','sequelize','CmHopperFinal','destroy','CountReScheduled','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','LOCK','UPDATE','GetContactRecallMe','GetCmHopperPreview','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetCmHopper','CmHopper','options','where'];(function(_0x119886,_0x1bb82c){var _0x23b022=function(_0x5bea28){while(--_0x5bea28){_0x119886['push'](_0x119886['shift']());}};_0x23b022(++_0x1bb82c);}(_0xbdc5,0x1cf));var _0x5bdc=function(_0x2dfcb0,_0x212ef9){_0x2dfcb0=_0x2dfcb0-0x0;var _0x38bf92=_0xbdc5[_0x2dfcb0];return _0x38bf92;};'use strict';var _=require('lodash');var util=require(_0x5bdc('0x0'));var moment=require(_0x5bdc('0x1'));var BPromise=require(_0x5bdc('0x2'));var rs=require(_0x5bdc('0x3'));var fs=require('fs');var Redis=require(_0x5bdc('0x4'));var db=require(_0x5bdc('0x5'))['db'];var utils=require(_0x5bdc('0x6'));var logger=require('../../config/logger')(_0x5bdc('0x7'));var config=require(_0x5bdc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5bdc('0x9')][_0x5bdc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ce573,_0x506d51,_0x610bfe){return new BPromise(function(_0x3da3a1,_0x428785){return client[_0x5bdc('0xb')](_0x2ce573,_0x610bfe)[_0x5bdc('0xc')](function(_0x902284){logger['info'](_0x5bdc('0xd'),_0x506d51,_0x5bdc('0xe'));logger[_0x5bdc('0xf')](_0x5bdc('0x10'),_0x506d51,_0x5bdc('0xe'),JSON[_0x5bdc('0x11')](_0x902284));if(_0x902284[_0x5bdc('0x12')]){if(_0x902284[_0x5bdc('0x12')][_0x5bdc('0x13')]===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x506d51,_0x902284[_0x5bdc('0x12')][_0x5bdc('0x14')]);return _0x428785(_0x902284[_0x5bdc('0x12')][_0x5bdc('0x14')]);}logger['error'](_0x5bdc('0xd'),_0x506d51,_0x902284[_0x5bdc('0x12')][_0x5bdc('0x14')]);return _0x3da3a1(_0x902284[_0x5bdc('0x12')][_0x5bdc('0x14')]);}else{logger[_0x5bdc('0x15')]('CmHopper,\x20%s,\x20%s',_0x506d51,_0x5bdc('0xe'));_0x3da3a1(_0x902284['result'][_0x5bdc('0x14')]);}})[_0x5bdc('0x16')](function(_0xb4a6b){logger['error']('CmHopper,\x20%s,\x20%s',_0x506d51,_0xb4a6b);_0x428785(_0xb4a6b);});});}exports[_0x5bdc('0x17')]=function(_0x447bc7){var _0xaef67e=this;return new Promise(function(_0x55bd1c,_0x51c451){return db[_0x5bdc('0x18')]['findAll']({'raw':_0x447bc7[_0x5bdc('0x19')]?_0x447bc7[_0x5bdc('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x447bc7['options']?_0x447bc7[_0x5bdc('0x19')][_0x5bdc('0x1a')]||null:null,'attributes':_0x447bc7[_0x5bdc('0x19')]?_0x447bc7[_0x5bdc('0x19')]['attributes']||null:null,'limit':_0x447bc7[_0x5bdc('0x19')]?_0x447bc7[_0x5bdc('0x19')][_0x5bdc('0x1b')]||null:null,'include':_0x447bc7['options']?_0x447bc7[_0x5bdc('0x19')]['include']?_[_0x5bdc('0x1c')](_0x447bc7[_0x5bdc('0x19')][_0x5bdc('0x1d')],function(_0x170198){return{'model':db[_0x170198[_0x5bdc('0x1e')]],'as':_0x170198['as'],'attributes':_0x170198[_0x5bdc('0x1f')],'include':_0x170198[_0x5bdc('0x1d')]?_[_0x5bdc('0x1c')](_0x170198['include'],function(_0x49a83c){return{'model':db[_0x49a83c[_0x5bdc('0x1e')]],'as':_0x49a83c['as'],'attributes':_0x49a83c['attributes'],'include':_0x49a83c[_0x5bdc('0x1d')]?_[_0x5bdc('0x1c')](_0x49a83c['include'],function(_0x1a7400){return{'model':db[_0x1a7400[_0x5bdc('0x1e')]],'as':_0x1a7400['as'],'attributes':_0x1a7400['attributes']};}):[]};}):[]};}):[]:[]})[_0x5bdc('0xc')](function(_0x3290f7){logger[_0x5bdc('0x15')](_0x5bdc('0x17'),_0x447bc7);logger[_0x5bdc('0xf')](_0x5bdc('0x17'),_0x447bc7,JSON[_0x5bdc('0x11')](_0x3290f7));_0x55bd1c(_0x3290f7);})['catch'](function(_0x4d7b8a){logger[_0x5bdc('0x12')](_0x5bdc('0x17'),_0x4d7b8a[_0x5bdc('0x14')],_0x447bc7);_0x51c451(_0xaef67e['error'](0x1f4,_0x4d7b8a[_0x5bdc('0x14')]));});});};exports['ShowCmHopper']=function(_0x41dd99){var _0x570fed=this;return new Promise(function(_0x339e22,_0x1ca703){return db[_0x5bdc('0x18')][_0x5bdc('0x20')]({'raw':_0x41dd99[_0x5bdc('0x19')]?_0x41dd99[_0x5bdc('0x19')][_0x5bdc('0x21')]===undefined?!![]:![]:!![],'where':_0x41dd99[_0x5bdc('0x19')]?_0x41dd99[_0x5bdc('0x19')]['where']||null:null,'attributes':_0x41dd99[_0x5bdc('0x19')]?_0x41dd99[_0x5bdc('0x19')][_0x5bdc('0x1f')]||null:null,'include':_0x41dd99[_0x5bdc('0x19')]?_0x41dd99[_0x5bdc('0x19')][_0x5bdc('0x1d')]?_[_0x5bdc('0x1c')](_0x41dd99['options'][_0x5bdc('0x1d')],function(_0x5169e3){return{'model':db[_0x5169e3[_0x5bdc('0x1e')]],'as':_0x5169e3['as'],'attributes':_0x5169e3[_0x5bdc('0x1f')],'include':_0x5169e3[_0x5bdc('0x1d')]?_[_0x5bdc('0x1c')](_0x5169e3['include'],function(_0x24f892){return{'model':db[_0x24f892[_0x5bdc('0x1e')]],'as':_0x24f892['as'],'attributes':_0x24f892[_0x5bdc('0x1f')],'include':_0x24f892['include']?_[_0x5bdc('0x1c')](_0x24f892[_0x5bdc('0x1d')],function(_0x27f1dd){return{'model':db[_0x27f1dd[_0x5bdc('0x1e')]],'as':_0x27f1dd['as'],'attributes':_0x27f1dd[_0x5bdc('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29dd76){logger['info']('ShowCmHopper',_0x41dd99);logger[_0x5bdc('0xf')]('ShowCmHopper',_0x41dd99,JSON[_0x5bdc('0x11')](_0x29dd76));_0x339e22(_0x29dd76);})[_0x5bdc('0x16')](function(_0x27f7fd){logger[_0x5bdc('0x12')](_0x5bdc('0x22'),_0x27f7fd[_0x5bdc('0x14')],_0x41dd99);_0x1ca703(_0x570fed[_0x5bdc('0x12')](0x1f4,_0x27f7fd[_0x5bdc('0x14')]));});});};exports[_0x5bdc('0x23')]=function(_0x26a26d){var _0x5945ad=this;return new Promise(function(_0x7157bb,_0x3fe5b8){return db[_0x5bdc('0x18')][_0x5bdc('0x24')](_0x26a26d[_0x5bdc('0x25')],{'raw':_0x26a26d[_0x5bdc('0x19')]?_0x26a26d['options'][_0x5bdc('0x21')]===undefined?!![]:![]:!![]})[_0x5bdc('0xc')](function(_0x206ac4){logger[_0x5bdc('0x15')]('CreateCmHopper',_0x26a26d);logger['debug'](_0x5bdc('0x23'),_0x26a26d,JSON[_0x5bdc('0x11')](_0x206ac4));_0x7157bb(_0x206ac4);})[_0x5bdc('0x16')](function(_0x419cee){logger[_0x5bdc('0x12')](_0x5bdc('0x23'),_0x419cee['message'],_0x26a26d);_0x3fe5b8(_0x5945ad['error'](0x1f4,_0x419cee['message']));});});};exports[_0x5bdc('0x26')]=function(_0x1d2c2e){var _0x1740af=this;return new Promise(function(_0xe7abb5,_0x2d6407){return db[_0x5bdc('0x18')][_0x5bdc('0x27')](_0x1d2c2e[_0x5bdc('0x25')],{'raw':_0x1d2c2e[_0x5bdc('0x19')]?_0x1d2c2e[_0x5bdc('0x19')][_0x5bdc('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d2c2e[_0x5bdc('0x19')]?_0x1d2c2e['options']['where']||null:null,'attributes':_0x1d2c2e[_0x5bdc('0x19')]?_0x1d2c2e['options'][_0x5bdc('0x1f')]||null:null,'limit':_0x1d2c2e[_0x5bdc('0x19')]?_0x1d2c2e[_0x5bdc('0x19')][_0x5bdc('0x1b')]||null:null})[_0x5bdc('0xc')](function(_0x2d5330){logger['info']('UpdateCmHopper',_0x1d2c2e);logger['debug'](_0x5bdc('0x26'),_0x1d2c2e,JSON[_0x5bdc('0x11')](_0x2d5330));_0xe7abb5(_0x2d5330);})[_0x5bdc('0x16')](function(_0x33554a){logger['error']('UpdateCmHopper',_0x33554a['message'],_0x1d2c2e);_0x2d6407(_0x1740af['error'](0x1f4,_0x33554a[_0x5bdc('0x14')]));});});};exports[_0x5bdc('0x28')]=function(_0x22cc8f){var _0x6aface=this;return new Promise(function(_0x57d2b8,_0x5dadf5){return db[_0x5bdc('0x18')]['destroy']({'where':_0x22cc8f[_0x5bdc('0x19')]?_0x22cc8f[_0x5bdc('0x19')][_0x5bdc('0x1a')]||null:null})[_0x5bdc('0xc')](function(_0x253b7a){logger[_0x5bdc('0x15')](_0x5bdc('0x28'),_0x22cc8f);logger[_0x5bdc('0xf')](_0x5bdc('0x28'),_0x22cc8f,JSON[_0x5bdc('0x11')](_0x253b7a));_0x57d2b8(_0x253b7a);})[_0x5bdc('0x16')](function(_0x12fb5f){logger['error'](_0x5bdc('0x28'),_0x12fb5f[_0x5bdc('0x14')],_0x22cc8f);_0x5dadf5(_0x6aface[_0x5bdc('0x12')](0x1f4,_0x12fb5f[_0x5bdc('0x14')]));});});};exports[_0x5bdc('0x29')]=function(_0x316b53){var _0x19e969=this;return new Promise(function(_0x41bb3c,_0x450a82){return db[_0x5bdc('0x2a')][_0x5bdc('0x2b')]()['then'](function(_0x5c8b2e){return db['sequelize'][_0x5bdc('0x2c')](function(_0x910296){return db[_0x5bdc('0x18')][_0x5bdc('0x2d')]({'where':_0x316b53['options']?_0x316b53[_0x5bdc('0x19')][_0x5bdc('0x1a')]||null:null,'attributes':_0x316b53[_0x5bdc('0x19')]?_0x316b53[_0x5bdc('0x19')][_0x5bdc('0x1f')]||null:null,'limit':_0x316b53[_0x5bdc('0x19')]?_0x316b53[_0x5bdc('0x19')][_0x5bdc('0x1b')]||null:null,'order':_0x316b53[_0x5bdc('0x19')]?_0x316b53['options']['order']||null:null,'transaction':_0x910296,'lock':_0x910296['LOCK']['UPDATE'],'include':[{'model':db[_0x5bdc('0x2a')],'as':_0x5bdc('0x2e'),'attributes':_[_0x5bdc('0x2f')](_0x5c8b2e)},{'model':db[_0x5bdc('0x30')],'as':'Agent','attributes':['id','name','voicePause']}]})[_0x5bdc('0xc')](function(_0x395418){var _0x39379a=[];var _0x1b8e5a=[];for(var _0xd28823=0x0;_0xd28823<_0x395418[_0x5bdc('0x31')];_0xd28823+=0x1){var _0x5c16dc=_0x395418[_0xd28823][_0x5bdc('0x32')];if(_0x5c16dc===null){_0x39379a[_0x5bdc('0x33')](_0x395418[_0xd28823][_0x5bdc('0x27')](_0x316b53['body'],{'transaction':_0x910296}));}else if(!_0x1b8e5a[_0x5bdc('0x34')](_0x5c16dc)){_0x1b8e5a[_0x5bdc('0x33')](_0x5c16dc);_0x39379a[_0x5bdc('0x33')](_0x395418[_0xd28823][_0x5bdc('0x27')](_0x316b53['body'],{'transaction':_0x910296}));}}return BPromise[_0x5bdc('0x35')](_0x39379a);});})[_0x5bdc('0xc')](function(_0x509406){logger[_0x5bdc('0x15')](_0x5bdc('0x29'),_0x316b53);logger[_0x5bdc('0xf')]('GetContactDialer',_0x316b53,JSON['stringify'](_0x509406));_0x41bb3c(_0x509406);})[_0x5bdc('0x16')](function(_0xb06800){logger['error'](_0x5bdc('0x29'),_0xb06800[_0x5bdc('0x14')],_0x316b53);_0x450a82(_0x19e969['error'](0x1f4,_0xb06800['message']));});});});};exports[_0x5bdc('0x36')]=function(_0x4978c5){var _0x299385=this;return new Promise(function(_0x1df5f7,_0x292146){return db[_0x5bdc('0x37')][_0x5bdc('0x2c')](function(_0x53600e){return db[_0x5bdc('0x38')]['create'](_0x4978c5[_0x5bdc('0x25')],{'raw':_0x4978c5[_0x5bdc('0x19')]?_0x4978c5[_0x5bdc('0x19')][_0x5bdc('0x21')]===undefined?!![]:![]:!![],'transaction':_0x53600e})[_0x5bdc('0xc')](function(){return db[_0x5bdc('0x18')][_0x5bdc('0x39')]({'where':_0x4978c5[_0x5bdc('0x19')]?_0x4978c5[_0x5bdc('0x19')][_0x5bdc('0x1a')]||null:null,'transaction':_0x53600e});});})['then'](function(_0xa8ecfc){logger[_0x5bdc('0x15')](_0x5bdc('0x36'),_0x4978c5);logger[_0x5bdc('0xf')](_0x5bdc('0x36'),_0x4978c5,JSON[_0x5bdc('0x11')](_0xa8ecfc));_0x1df5f7(_0xa8ecfc);})['catch'](function(_0x32eb79){logger[_0x5bdc('0x12')](_0x5bdc('0x36'),_0x32eb79[_0x5bdc('0x14')],_0x4978c5);_0x292146(_0x299385[_0x5bdc('0x12')](0x1f4,_0x32eb79[_0x5bdc('0x14')]));});});};exports[_0x5bdc('0x3a')]=function(_0x542bb4){var _0x5f00d1=this;return new Promise(function(_0x2ea604,_0x79e4ec){return db['CmHopper'][_0x5bdc('0x2d')]({'raw':_0x542bb4[_0x5bdc('0x19')]?_0x542bb4['options'][_0x5bdc('0x21')]===undefined?!![]:![]:!![],'where':_0x542bb4[_0x5bdc('0x19')]?_0x542bb4['options'][_0x5bdc('0x1a')]||null:null,'attributes':[[db[_0x5bdc('0x37')]['fn'](_0x5bdc('0x3b'),db[_0x5bdc('0x37')]['fn']('IF',db[_0x5bdc('0x37')][_0x5bdc('0x3c')]('`scheduledat`\x20>=\x20'+util[_0x5bdc('0x3d')](_0x5bdc('0x3e'),moment()[_0x5bdc('0x3d')](_0x5bdc('0x3f')))+_0x5bdc('0x40')))),_0x5bdc('0x41')]]})[_0x5bdc('0xc')](function(_0x3062b9){logger[_0x5bdc('0x15')](_0x5bdc('0x3a'),_0x542bb4);logger['debug'](_0x5bdc('0x3a'),_0x542bb4,JSON[_0x5bdc('0x11')](_0x3062b9));_0x2ea604(_0x3062b9);})[_0x5bdc('0x16')](function(_0x32b280){logger[_0x5bdc('0x12')](_0x5bdc('0x3a'),_0x32b280[_0x5bdc('0x14')],_0x542bb4);_0x79e4ec(_0x5f00d1[_0x5bdc('0x12')](0x1f4,_0x32b280[_0x5bdc('0x14')]));});});};exports['GetContactRecallMe']=function(_0x170565){var _0x4778bc=this;return new Promise(function(_0x28696e,_0x838380){return db[_0x5bdc('0x2a')]['describe']()['then'](function(_0x5b78af){return db['sequelize']['transaction'](function(_0x21bc17){return db[_0x5bdc('0x18')][_0x5bdc('0x2d')]({'where':_0x170565[_0x5bdc('0x19')]?_0x170565[_0x5bdc('0x19')]['where']||null:null,'attributes':_0x170565[_0x5bdc('0x19')]?_0x170565['options'][_0x5bdc('0x1f')]||null:null,'limit':0x1,'order':_0x170565[_0x5bdc('0x19')]?_0x170565[_0x5bdc('0x19')]['order']||null:null,'group':db[_0x5bdc('0x18')][_0x5bdc('0x32')],'transaction':_0x21bc17,'lock':_0x21bc17[_0x5bdc('0x42')][_0x5bdc('0x43')],'include':_0x170565[_0x5bdc('0x19')]?_0x170565[_0x5bdc('0x19')][_0x5bdc('0x1d')]?_[_0x5bdc('0x1c')](_0x170565[_0x5bdc('0x19')]['include'],function(_0x290676){return{'model':db[_0x290676[_0x5bdc('0x1e')]],'as':_0x290676['as'],'attributes':_0x290676['attributes'],'include':_0x290676['include']?_['map'](_0x290676[_0x5bdc('0x1d')],function(_0x4dcf72){return{'model':db[_0x4dcf72[_0x5bdc('0x1e')]],'as':_0x4dcf72['as'],'attributes':_0x4dcf72[_0x5bdc('0x1f')],'include':_0x4dcf72[_0x5bdc('0x1d')]?_[_0x5bdc('0x1c')](_0x4dcf72[_0x5bdc('0x1d')],function(_0x1db7b0){return{'model':db[_0x1db7b0[_0x5bdc('0x1e')]],'as':_0x1db7b0['as'],'attributes':_0x1db7b0[_0x5bdc('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50e318){var _0x154aa0=[];for(var _0x26ddf3=0x0;_0x26ddf3<_0x50e318[_0x5bdc('0x31')];_0x26ddf3+=0x1){_0x154aa0[_0x5bdc('0x33')](_0x50e318[_0x26ddf3]['update'](_0x170565[_0x5bdc('0x25')],{'transaction':_0x21bc17}));}return BPromise['all'](_0x154aa0);});})[_0x5bdc('0xc')](function(_0x3aa1ea){logger[_0x5bdc('0x15')](_0x5bdc('0x44'),_0x170565);logger[_0x5bdc('0xf')](_0x5bdc('0x44'),_0x170565,JSON[_0x5bdc('0x11')](_0x3aa1ea));_0x28696e(_0x3aa1ea);})[_0x5bdc('0x16')](function(_0x4139d5){logger[_0x5bdc('0x12')](_0x5bdc('0x44'),_0x4139d5[_0x5bdc('0x14')],_0x170565);_0x838380(_0x4778bc[_0x5bdc('0x12')](0x1f4,_0x4139d5['message']));});});});};exports[_0x5bdc('0x45')]=function(_0x42c2e6){var _0x3e434f=this;return new Promise(function(_0x472c2f,_0x1f5a0f){db[_0x5bdc('0x2a')][_0x5bdc('0x2b')]()[_0x5bdc('0xc')](function(_0x51dca7){return db[_0x5bdc('0x18')][_0x5bdc('0x2d')]({'raw':_0x42c2e6[_0x5bdc('0x19')]?_0x42c2e6[_0x5bdc('0x19')][_0x5bdc('0x21')]===undefined?!![]:![]:!![],'where':_0x42c2e6[_0x5bdc('0x19')]?_0x42c2e6['options']['where']||null:null,'attributes':_0x42c2e6[_0x5bdc('0x19')]?_0x42c2e6[_0x5bdc('0x19')][_0x5bdc('0x1f')]||null:null,'limit':_0x42c2e6[_0x5bdc('0x19')]?_0x42c2e6[_0x5bdc('0x19')][_0x5bdc('0x1b')]||null:null,'include':_0x42c2e6[_0x5bdc('0x19')]?_0x42c2e6[_0x5bdc('0x19')][_0x5bdc('0x1d')]?_['map'](_0x42c2e6[_0x5bdc('0x19')][_0x5bdc('0x1d')],function(_0x5e907f){return{'model':db[_0x5e907f[_0x5bdc('0x1e')]],'as':_0x5e907f['as'],'attributes':_0x5e907f['as']==='Contact'?_[_0x5bdc('0x2f')](_0x51dca7):_0x5e907f[_0x5bdc('0x1f')],'include':_0x5e907f[_0x5bdc('0x1d')]?_[_0x5bdc('0x1c')](_0x5e907f[_0x5bdc('0x1d')],function(_0x1da472){return{'model':db[_0x1da472['model']],'as':_0x1da472['as'],'attributes':_0x1da472['attributes'],'include':_0x1da472[_0x5bdc('0x1d')]?_[_0x5bdc('0x1c')](_0x1da472['include'],function(_0x237ee6){return{'model':db[_0x237ee6[_0x5bdc('0x1e')]],'as':_0x237ee6['as'],'attributes':_0x237ee6[_0x5bdc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5bdc('0xc')](function(_0x24f6b2){logger['info']('GetCmHopper',_0x42c2e6);logger[_0x5bdc('0xf')](_0x5bdc('0x17'),_0x42c2e6,JSON[_0x5bdc('0x11')](_0x24f6b2));_0x472c2f(_0x24f6b2);})[_0x5bdc('0x16')](function(_0x111bc4){logger[_0x5bdc('0x12')](_0x5bdc('0x17'),_0x111bc4[_0x5bdc('0x14')],_0x42c2e6);_0x1f5a0f(_0x3e434f[_0x5bdc('0x12')](0x1f4,_0x111bc4[_0x5bdc('0x14')]));});});});}; \ No newline at end of file +var _0xef35=['sequelize','transaction','order','UPDATE','Contact','User','name','voicePause','length','UserId','push','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','contactsRescheduled','GetContactRecallMe','CmContact','LOCK','GetCmHopperPreview','keys','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','http','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopper','CmHopper','findAll','options','raw','limit','map','include','attributes','model','debug','catch','ShowCmHopper','find','where','CreateCmHopper','create','UpdateCmHopper','update','body','destroy','DestroyCmHopper','GetContactDialer','describe'];(function(_0x3f86a0,_0x168727){var _0x1f315f=function(_0x174a02){while(--_0x174a02){_0x3f86a0['push'](_0x3f86a0['shift']());}};_0x1f315f(++_0x168727);}(_0xef35,0x168));var _0x5ef3=function(_0x4f3b2d,_0x3bbf46){_0x4f3b2d=_0x4f3b2d-0x0;var _0x3dddfa=_0xef35[_0x4f3b2d];return _0x3dddfa;};'use strict';var _=require('lodash');var util=require(_0x5ef3('0x0'));var moment=require(_0x5ef3('0x1'));var BPromise=require(_0x5ef3('0x2'));var rs=require(_0x5ef3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5ef3('0x4'));var logger=require('../../config/logger')(_0x5ef3('0x5'));var config=require('../../config/environment');var jayson=require(_0x5ef3('0x6'));var client=jayson['client'][_0x5ef3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xad842c,_0x57d8a0,_0x36f8eb){return new BPromise(function(_0x539178,_0x1321c7){return client['request'](_0xad842c,_0x36f8eb)[_0x5ef3('0x8')](function(_0x2144b0){logger[_0x5ef3('0x9')](_0x5ef3('0xa'),_0x57d8a0,_0x5ef3('0xb'));logger['debug'](_0x5ef3('0xc'),_0x57d8a0,_0x5ef3('0xb'),JSON[_0x5ef3('0xd')](_0x2144b0));if(_0x2144b0[_0x5ef3('0xe')]){if(_0x2144b0['error'][_0x5ef3('0xf')]===0x1f4){logger[_0x5ef3('0xe')](_0x5ef3('0xa'),_0x57d8a0,_0x2144b0[_0x5ef3('0xe')][_0x5ef3('0x10')]);return _0x1321c7(_0x2144b0[_0x5ef3('0xe')][_0x5ef3('0x10')]);}logger[_0x5ef3('0xe')]('CmHopper,\x20%s,\x20%s',_0x57d8a0,_0x2144b0[_0x5ef3('0xe')][_0x5ef3('0x10')]);return _0x539178(_0x2144b0[_0x5ef3('0xe')][_0x5ef3('0x10')]);}else{logger[_0x5ef3('0x9')]('CmHopper,\x20%s,\x20%s',_0x57d8a0,_0x5ef3('0xb'));_0x539178(_0x2144b0[_0x5ef3('0x11')][_0x5ef3('0x10')]);}})['catch'](function(_0x126154){logger[_0x5ef3('0xe')](_0x5ef3('0xa'),_0x57d8a0,_0x126154);_0x1321c7(_0x126154);});});}exports[_0x5ef3('0x12')]=function(_0x4935ff){var _0x45161a=this;return new Promise(function(_0xe942c5,_0x64d41d){return db[_0x5ef3('0x13')][_0x5ef3('0x14')]({'raw':_0x4935ff[_0x5ef3('0x15')]?_0x4935ff[_0x5ef3('0x15')][_0x5ef3('0x16')]===undefined?!![]:![]:!![],'where':_0x4935ff['options']?_0x4935ff[_0x5ef3('0x15')]['where']||null:null,'attributes':_0x4935ff['options']?_0x4935ff[_0x5ef3('0x15')]['attributes']||null:null,'limit':_0x4935ff[_0x5ef3('0x15')]?_0x4935ff[_0x5ef3('0x15')][_0x5ef3('0x17')]||null:null,'include':_0x4935ff['options']?_0x4935ff[_0x5ef3('0x15')]['include']?_[_0x5ef3('0x18')](_0x4935ff[_0x5ef3('0x15')][_0x5ef3('0x19')],function(_0x1875b1){return{'model':db[_0x1875b1['model']],'as':_0x1875b1['as'],'attributes':_0x1875b1[_0x5ef3('0x1a')],'include':_0x1875b1[_0x5ef3('0x19')]?_[_0x5ef3('0x18')](_0x1875b1[_0x5ef3('0x19')],function(_0x5d9962){return{'model':db[_0x5d9962[_0x5ef3('0x1b')]],'as':_0x5d9962['as'],'attributes':_0x5d9962[_0x5ef3('0x1a')],'include':_0x5d9962[_0x5ef3('0x19')]?_[_0x5ef3('0x18')](_0x5d9962[_0x5ef3('0x19')],function(_0x5e64b7){return{'model':db[_0x5e64b7[_0x5ef3('0x1b')]],'as':_0x5e64b7['as'],'attributes':_0x5e64b7[_0x5ef3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5ef3('0x8')](function(_0x3f7edf){logger[_0x5ef3('0x9')](_0x5ef3('0x12'),_0x4935ff);logger[_0x5ef3('0x1c')](_0x5ef3('0x12'),_0x4935ff,JSON['stringify'](_0x3f7edf));_0xe942c5(_0x3f7edf);})[_0x5ef3('0x1d')](function(_0x1538a0){logger[_0x5ef3('0xe')]('GetCmHopper',_0x1538a0[_0x5ef3('0x10')],_0x4935ff);_0x64d41d(_0x45161a['error'](0x1f4,_0x1538a0[_0x5ef3('0x10')]));});});};exports[_0x5ef3('0x1e')]=function(_0x3c02be){var _0x297110=this;return new Promise(function(_0x162b95,_0x402bc4){return db[_0x5ef3('0x13')][_0x5ef3('0x1f')]({'raw':_0x3c02be[_0x5ef3('0x15')]?_0x3c02be[_0x5ef3('0x15')][_0x5ef3('0x16')]===undefined?!![]:![]:!![],'where':_0x3c02be[_0x5ef3('0x15')]?_0x3c02be[_0x5ef3('0x15')][_0x5ef3('0x20')]||null:null,'attributes':_0x3c02be['options']?_0x3c02be['options'][_0x5ef3('0x1a')]||null:null,'include':_0x3c02be[_0x5ef3('0x15')]?_0x3c02be[_0x5ef3('0x15')][_0x5ef3('0x19')]?_[_0x5ef3('0x18')](_0x3c02be[_0x5ef3('0x15')][_0x5ef3('0x19')],function(_0x91d960){return{'model':db[_0x91d960[_0x5ef3('0x1b')]],'as':_0x91d960['as'],'attributes':_0x91d960[_0x5ef3('0x1a')],'include':_0x91d960[_0x5ef3('0x19')]?_[_0x5ef3('0x18')](_0x91d960[_0x5ef3('0x19')],function(_0x1ac4ae){return{'model':db[_0x1ac4ae['model']],'as':_0x1ac4ae['as'],'attributes':_0x1ac4ae[_0x5ef3('0x1a')],'include':_0x1ac4ae[_0x5ef3('0x19')]?_[_0x5ef3('0x18')](_0x1ac4ae[_0x5ef3('0x19')],function(_0x3a0405){return{'model':db[_0x3a0405[_0x5ef3('0x1b')]],'as':_0x3a0405['as'],'attributes':_0x3a0405[_0x5ef3('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51cc63){logger[_0x5ef3('0x9')]('ShowCmHopper',_0x3c02be);logger[_0x5ef3('0x1c')](_0x5ef3('0x1e'),_0x3c02be,JSON[_0x5ef3('0xd')](_0x51cc63));_0x162b95(_0x51cc63);})[_0x5ef3('0x1d')](function(_0x6422a1){logger['error'](_0x5ef3('0x1e'),_0x6422a1[_0x5ef3('0x10')],_0x3c02be);_0x402bc4(_0x297110['error'](0x1f4,_0x6422a1[_0x5ef3('0x10')]));});});};exports[_0x5ef3('0x21')]=function(_0x1a1687){var _0x1d77ce=this;return new Promise(function(_0x537711,_0x55bcb4){return db[_0x5ef3('0x13')][_0x5ef3('0x22')](_0x1a1687['body'],{'raw':_0x1a1687['options']?_0x1a1687[_0x5ef3('0x15')][_0x5ef3('0x16')]===undefined?!![]:![]:!![]})[_0x5ef3('0x8')](function(_0x4dbe87){logger[_0x5ef3('0x9')]('CreateCmHopper',_0x1a1687);logger[_0x5ef3('0x1c')](_0x5ef3('0x21'),_0x1a1687,JSON['stringify'](_0x4dbe87));_0x537711(_0x4dbe87);})['catch'](function(_0x5512f1){logger['error']('CreateCmHopper',_0x5512f1[_0x5ef3('0x10')],_0x1a1687);_0x55bcb4(_0x1d77ce[_0x5ef3('0xe')](0x1f4,_0x5512f1['message']));});});};exports[_0x5ef3('0x23')]=function(_0x567cef){var _0x43c551=this;return new Promise(function(_0xc6e409,_0xad0f32){return db[_0x5ef3('0x13')][_0x5ef3('0x24')](_0x567cef[_0x5ef3('0x25')],{'raw':_0x567cef[_0x5ef3('0x15')]?_0x567cef[_0x5ef3('0x15')][_0x5ef3('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x567cef[_0x5ef3('0x15')]?_0x567cef[_0x5ef3('0x15')][_0x5ef3('0x20')]||null:null,'attributes':_0x567cef[_0x5ef3('0x15')]?_0x567cef[_0x5ef3('0x15')][_0x5ef3('0x1a')]||null:null,'limit':_0x567cef[_0x5ef3('0x15')]?_0x567cef[_0x5ef3('0x15')][_0x5ef3('0x17')]||null:null})[_0x5ef3('0x8')](function(_0x4a3d30){logger[_0x5ef3('0x9')]('UpdateCmHopper',_0x567cef);logger[_0x5ef3('0x1c')](_0x5ef3('0x23'),_0x567cef,JSON[_0x5ef3('0xd')](_0x4a3d30));_0xc6e409(_0x4a3d30);})[_0x5ef3('0x1d')](function(_0x55a5ef){logger[_0x5ef3('0xe')](_0x5ef3('0x23'),_0x55a5ef['message'],_0x567cef);_0xad0f32(_0x43c551[_0x5ef3('0xe')](0x1f4,_0x55a5ef['message']));});});};exports['DestroyCmHopper']=function(_0x2662ba){var _0x700b1d=this;return new Promise(function(_0x17d790,_0x493bdd){return db[_0x5ef3('0x13')][_0x5ef3('0x26')]({'where':_0x2662ba[_0x5ef3('0x15')]?_0x2662ba[_0x5ef3('0x15')][_0x5ef3('0x20')]||null:null})[_0x5ef3('0x8')](function(_0x118339){logger[_0x5ef3('0x9')](_0x5ef3('0x27'),_0x2662ba);logger[_0x5ef3('0x1c')](_0x5ef3('0x27'),_0x2662ba,JSON[_0x5ef3('0xd')](_0x118339));_0x17d790(_0x118339);})['catch'](function(_0xc75e9c){logger[_0x5ef3('0xe')]('DestroyCmHopper',_0xc75e9c[_0x5ef3('0x10')],_0x2662ba);_0x493bdd(_0x700b1d['error'](0x1f4,_0xc75e9c[_0x5ef3('0x10')]));});});};exports[_0x5ef3('0x28')]=function(_0x5d2b98){var _0x377928=this;return new Promise(function(_0x5ce412,_0x17a002){return db['CmContact'][_0x5ef3('0x29')]()[_0x5ef3('0x8')](function(_0x225679){return db[_0x5ef3('0x2a')][_0x5ef3('0x2b')](function(_0x10f3cf){return db[_0x5ef3('0x13')][_0x5ef3('0x14')]({'where':_0x5d2b98[_0x5ef3('0x15')]?_0x5d2b98['options']['where']||null:null,'attributes':_0x5d2b98[_0x5ef3('0x15')]?_0x5d2b98[_0x5ef3('0x15')][_0x5ef3('0x1a')]||null:null,'limit':_0x5d2b98['options']?_0x5d2b98[_0x5ef3('0x15')]['limit']||null:null,'order':_0x5d2b98[_0x5ef3('0x15')]?_0x5d2b98['options'][_0x5ef3('0x2c')]||null:null,'transaction':_0x10f3cf,'lock':_0x10f3cf['LOCK'][_0x5ef3('0x2d')],'include':[{'model':db['CmContact'],'as':_0x5ef3('0x2e'),'attributes':_['keys'](_0x225679)},{'model':db[_0x5ef3('0x2f')],'as':'Agent','attributes':['id',_0x5ef3('0x30'),_0x5ef3('0x31')]}]})[_0x5ef3('0x8')](function(_0x13da44){var _0x2dc8e8=[];var _0xdb30b9=[];for(var _0x3d65c1=0x0;_0x3d65c1<_0x13da44[_0x5ef3('0x32')];_0x3d65c1+=0x1){var _0x50c124=_0x13da44[_0x3d65c1][_0x5ef3('0x33')];if(_0x50c124===null){_0x2dc8e8[_0x5ef3('0x34')](_0x13da44[_0x3d65c1][_0x5ef3('0x24')](_0x5d2b98[_0x5ef3('0x25')],{'transaction':_0x10f3cf}));}else if(!_0xdb30b9['includes'](_0x50c124)){_0xdb30b9[_0x5ef3('0x34')](_0x50c124);_0x2dc8e8[_0x5ef3('0x34')](_0x13da44[_0x3d65c1][_0x5ef3('0x24')](_0x5d2b98[_0x5ef3('0x25')],{'transaction':_0x10f3cf}));}}return BPromise['all'](_0x2dc8e8);});})['then'](function(_0x4554a1){logger[_0x5ef3('0x9')]('GetContactDialer',_0x5d2b98);logger[_0x5ef3('0x1c')](_0x5ef3('0x28'),_0x5d2b98,JSON[_0x5ef3('0xd')](_0x4554a1));_0x5ce412(_0x4554a1);})[_0x5ef3('0x1d')](function(_0x25b778){logger[_0x5ef3('0xe')](_0x5ef3('0x28'),_0x25b778[_0x5ef3('0x10')],_0x5d2b98);_0x17a002(_0x377928[_0x5ef3('0xe')](0x1f4,_0x25b778['message']));});});});};exports[_0x5ef3('0x35')]=function(_0xc409){var _0x368cca=this;return new Promise(function(_0x3ac0f9,_0x6b4ef9){return db[_0x5ef3('0x2a')]['transaction'](function(_0x432486){return db[_0x5ef3('0x36')]['create'](_0xc409[_0x5ef3('0x25')],{'raw':_0xc409['options']?_0xc409['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x432486})['then'](function(){return db['CmHopper'][_0x5ef3('0x26')]({'where':_0xc409['options']?_0xc409[_0x5ef3('0x15')][_0x5ef3('0x20')]||null:null,'transaction':_0x432486});});})[_0x5ef3('0x8')](function(_0x2eb6de){logger[_0x5ef3('0x9')](_0x5ef3('0x35'),_0xc409);logger[_0x5ef3('0x1c')](_0x5ef3('0x35'),_0xc409,JSON[_0x5ef3('0xd')](_0x2eb6de));_0x3ac0f9(_0x2eb6de);})['catch'](function(_0x16c355){logger[_0x5ef3('0xe')]('MoveContactManagedDialer',_0x16c355[_0x5ef3('0x10')],_0xc409);_0x6b4ef9(_0x368cca[_0x5ef3('0xe')](0x1f4,_0x16c355['message']));});});};exports[_0x5ef3('0x37')]=function(_0x3932dc){var _0x2681eb=this;return new Promise(function(_0x21e213,_0xf55f27){return db[_0x5ef3('0x13')][_0x5ef3('0x14')]({'raw':_0x3932dc[_0x5ef3('0x15')]?_0x3932dc[_0x5ef3('0x15')][_0x5ef3('0x16')]===undefined?!![]:![]:!![],'where':_0x3932dc[_0x5ef3('0x15')]?_0x3932dc[_0x5ef3('0x15')][_0x5ef3('0x20')]||null:null,'attributes':[[db[_0x5ef3('0x2a')]['fn'](_0x5ef3('0x38'),db['sequelize']['fn']('IF',db[_0x5ef3('0x2a')][_0x5ef3('0x39')](_0x5ef3('0x3a')+util[_0x5ef3('0x3b')](_0x5ef3('0x3c'),moment()[_0x5ef3('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0x5ef3('0x3d')]]})[_0x5ef3('0x8')](function(_0x53dca3){logger[_0x5ef3('0x9')](_0x5ef3('0x37'),_0x3932dc);logger[_0x5ef3('0x1c')]('CountReScheduled',_0x3932dc,JSON[_0x5ef3('0xd')](_0x53dca3));_0x21e213(_0x53dca3);})['catch'](function(_0x49d55b){logger['error']('CountReScheduled',_0x49d55b[_0x5ef3('0x10')],_0x3932dc);_0xf55f27(_0x2681eb['error'](0x1f4,_0x49d55b['message']));});});};exports[_0x5ef3('0x3e')]=function(_0x52b403){var _0x109d2d=this;return new Promise(function(_0x2cb3d1,_0x337310){return db[_0x5ef3('0x3f')][_0x5ef3('0x29')]()[_0x5ef3('0x8')](function(_0x2fdbcb){return db['sequelize'][_0x5ef3('0x2b')](function(_0xee0cc5){return db[_0x5ef3('0x13')][_0x5ef3('0x14')]({'where':_0x52b403[_0x5ef3('0x15')]?_0x52b403[_0x5ef3('0x15')][_0x5ef3('0x20')]||null:null,'attributes':_0x52b403[_0x5ef3('0x15')]?_0x52b403[_0x5ef3('0x15')][_0x5ef3('0x1a')]||null:null,'limit':0x1,'order':_0x52b403['options']?_0x52b403[_0x5ef3('0x15')]['order']||null:null,'group':db[_0x5ef3('0x13')][_0x5ef3('0x33')],'transaction':_0xee0cc5,'lock':_0xee0cc5[_0x5ef3('0x40')][_0x5ef3('0x2d')],'include':_0x52b403[_0x5ef3('0x15')]?_0x52b403[_0x5ef3('0x15')][_0x5ef3('0x19')]?_[_0x5ef3('0x18')](_0x52b403[_0x5ef3('0x15')]['include'],function(_0x2daa59){return{'model':db[_0x2daa59[_0x5ef3('0x1b')]],'as':_0x2daa59['as'],'attributes':_0x2daa59['attributes'],'include':_0x2daa59['include']?_[_0x5ef3('0x18')](_0x2daa59[_0x5ef3('0x19')],function(_0x261c4d){return{'model':db[_0x261c4d[_0x5ef3('0x1b')]],'as':_0x261c4d['as'],'attributes':_0x261c4d[_0x5ef3('0x1a')],'include':_0x261c4d[_0x5ef3('0x19')]?_['map'](_0x261c4d[_0x5ef3('0x19')],function(_0x112edc){return{'model':db[_0x112edc['model']],'as':_0x112edc['as'],'attributes':_0x112edc[_0x5ef3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5ef3('0x8')](function(_0xd13c7c){var _0x34c90c=[];for(var _0x2528d1=0x0;_0x2528d1<_0xd13c7c['length'];_0x2528d1+=0x1){_0x34c90c['push'](_0xd13c7c[_0x2528d1][_0x5ef3('0x24')](_0x52b403[_0x5ef3('0x25')],{'transaction':_0xee0cc5}));}return BPromise['all'](_0x34c90c);});})[_0x5ef3('0x8')](function(_0x45dd01){logger['info']('GetContactRecallMe',_0x52b403);logger['debug'](_0x5ef3('0x3e'),_0x52b403,JSON[_0x5ef3('0xd')](_0x45dd01));_0x2cb3d1(_0x45dd01);})[_0x5ef3('0x1d')](function(_0x12bc1d){logger[_0x5ef3('0xe')]('GetContactRecallMe',_0x12bc1d[_0x5ef3('0x10')],_0x52b403);_0x337310(_0x109d2d['error'](0x1f4,_0x12bc1d[_0x5ef3('0x10')]));});});});};exports[_0x5ef3('0x41')]=function(_0xd8e565){var _0x33ae6e=this;return new Promise(function(_0x52c740,_0x18949b){db['CmContact'][_0x5ef3('0x29')]()[_0x5ef3('0x8')](function(_0x37a537){return db[_0x5ef3('0x13')][_0x5ef3('0x14')]({'raw':_0xd8e565[_0x5ef3('0x15')]?_0xd8e565[_0x5ef3('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0xd8e565[_0x5ef3('0x15')]?_0xd8e565[_0x5ef3('0x15')][_0x5ef3('0x20')]||null:null,'attributes':_0xd8e565[_0x5ef3('0x15')]?_0xd8e565['options']['attributes']||null:null,'limit':_0xd8e565[_0x5ef3('0x15')]?_0xd8e565[_0x5ef3('0x15')][_0x5ef3('0x17')]||null:null,'include':_0xd8e565[_0x5ef3('0x15')]?_0xd8e565['options'][_0x5ef3('0x19')]?_[_0x5ef3('0x18')](_0xd8e565[_0x5ef3('0x15')][_0x5ef3('0x19')],function(_0x3f2c75){return{'model':db[_0x3f2c75['model']],'as':_0x3f2c75['as'],'attributes':_0x3f2c75['as']===_0x5ef3('0x2e')?_[_0x5ef3('0x42')](_0x37a537):_0x3f2c75[_0x5ef3('0x1a')],'include':_0x3f2c75[_0x5ef3('0x19')]?_['map'](_0x3f2c75[_0x5ef3('0x19')],function(_0x4054a1){return{'model':db[_0x4054a1[_0x5ef3('0x1b')]],'as':_0x4054a1['as'],'attributes':_0x4054a1[_0x5ef3('0x1a')],'include':_0x4054a1[_0x5ef3('0x19')]?_[_0x5ef3('0x18')](_0x4054a1[_0x5ef3('0x19')],function(_0x16703c){return{'model':db[_0x16703c[_0x5ef3('0x1b')]],'as':_0x16703c['as'],'attributes':_0x16703c[_0x5ef3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5ef3('0x8')](function(_0xabb4e7){logger[_0x5ef3('0x9')]('GetCmHopper',_0xd8e565);logger[_0x5ef3('0x1c')]('GetCmHopper',_0xd8e565,JSON[_0x5ef3('0xd')](_0xabb4e7));_0x52c740(_0xabb4e7);})[_0x5ef3('0x1d')](function(_0xccc36){logger[_0x5ef3('0xe')](_0x5ef3('0x12'),_0xccc36['message'],_0xd8e565);_0x18949b(_0x33ae6e[_0x5ef3('0xe')](0x1f4,_0xccc36[_0x5ef3('0x10')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 5d6bed9..83fbffe 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 _0x24a3=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','/:id','show','post','getPreview','update','delete','destroy','exports','multer','util'];(function(_0xef6134,_0x2f8a83){var _0x18bcc6=function(_0x16b20a){while(--_0x16b20a){_0xef6134['push'](_0xef6134['shift']());}};_0x18bcc6(++_0x2f8a83);}(_0x24a3,0x111));var _0x324a=function(_0x15ac09,_0x43685b){_0x15ac09=_0x15ac09-0x0;var _0x128429=_0x24a3[_0x15ac09];return _0x128429;};'use strict';var multer=require(_0x324a('0x0'));var util=require(_0x324a('0x1'));var path=require(_0x324a('0x2'));var timeout=require(_0x324a('0x3'));var express=require(_0x324a('0x4'));var router=express[_0x324a('0x5')]();var fs_extra=require(_0x324a('0x6'));var auth=require(_0x324a('0x7'));var interaction=require(_0x324a('0x8'));var config=require(_0x324a('0x9'));var controller=require(_0x324a('0xa'));router[_0x324a('0xb')]('/',auth[_0x324a('0xc')](),controller[_0x324a('0xd')]);router[_0x324a('0xb')]('/describe',auth[_0x324a('0xc')](),controller[_0x324a('0xe')]);router[_0x324a('0xb')](_0x324a('0xf'),auth[_0x324a('0xc')](),controller[_0x324a('0x10')]);router[_0x324a('0xb')](_0x324a('0x11'),auth[_0x324a('0xc')](),controller[_0x324a('0x12')]);router['post']('/',auth[_0x324a('0xc')](),controller['create']);router[_0x324a('0x13')]('/preview',auth[_0x324a('0xc')](),controller[_0x324a('0x14')]);router['put'](_0x324a('0x11'),auth[_0x324a('0xc')](),controller[_0x324a('0x15')]);router[_0x324a('0x16')](_0x324a('0x11'),auth[_0x324a('0xc')](),controller[_0x324a('0x17')]);module[_0x324a('0x18')]=router; \ No newline at end of file +var _0x3890=['get','index','/describe','/opencontacts','getOpenContacts','isAuthenticated','show','create','post','getPreview','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopper.controller'];(function(_0x1bb42e,_0x11d4e0){var _0x2aa2da=function(_0x18078a){while(--_0x18078a){_0x1bb42e['push'](_0x1bb42e['shift']());}};_0x2aa2da(++_0x11d4e0);}(_0x3890,0x1a7));var _0x0389=function(_0xfb4933,_0x2651df){_0xfb4933=_0xfb4933-0x0;var _0x3731fa=_0x3890[_0xfb4933];return _0x3731fa;};'use strict';var multer=require(_0x0389('0x0'));var util=require(_0x0389('0x1'));var path=require('path');var timeout=require(_0x0389('0x2'));var express=require(_0x0389('0x3'));var router=express[_0x0389('0x4')]();var fs_extra=require(_0x0389('0x5'));var auth=require(_0x0389('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0389('0x7'));var controller=require(_0x0389('0x8'));router[_0x0389('0x9')]('/',auth['isAuthenticated'](),controller[_0x0389('0xa')]);router[_0x0389('0x9')](_0x0389('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x0389('0x9')](_0x0389('0xc'),auth['isAuthenticated'](),controller[_0x0389('0xd')]);router['get']('/:id',auth[_0x0389('0xe')](),controller[_0x0389('0xf')]);router['post']('/',auth[_0x0389('0xe')](),controller[_0x0389('0x10')]);router[_0x0389('0x11')]('/preview',auth['isAuthenticated'](),controller[_0x0389('0x12')]);router[_0x0389('0x13')](_0x0389('0x14'),auth['isAuthenticated'](),controller[_0x0389('0x15')]);router['delete'](_0x0389('0x14'),auth[_0x0389('0xe')](),controller[_0x0389('0x16')]);module[_0x0389('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 9c726d1..f4bbd84 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 _0x2178=['INTEGER','contactListQueue','moment','exports','STRING'];(function(_0x1fcc18,_0x21125e){var _0x436790=function(_0x1fdbb2){while(--_0x1fdbb2){_0x1fcc18['push'](_0x1fcc18['shift']());}};_0x436790(++_0x21125e);}(_0x2178,0x1b0));var _0x8217=function(_0x411289,_0x36dbc8){_0x411289=_0x411289-0x0;var _0x5e72ec=_0x2178[_0x411289];return _0x5e72ec;};'use strict';var moment=require(_0x8217('0x0'));var Sequelize=require('sequelize');module[_0x8217('0x1')]={'phone':{'type':Sequelize[_0x8217('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x8217('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x8217('0x3')],'unique':_0x8217('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x8217('0x4')}}; \ No newline at end of file +var _0x4351=['sequelize','exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x5d1969,_0x2c2d71){var _0x5c8cc9=function(_0x2777a9){while(--_0x2777a9){_0x5d1969['push'](_0x5d1969['shift']());}};_0x5c8cc9(++_0x2c2d71);}(_0x4351,0x1b5));var _0x1435=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x4351[_0xae7c2f];return _0x5d7001;};'use strict';var moment=require(_0x1435('0x0'));var Sequelize=require(_0x1435('0x1'));module[_0x1435('0x2')]={'phone':{'type':Sequelize[_0x1435('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x1435('0x4')],'unique':_0x1435('0x5')},'ListId':{'type':Sequelize[_0x1435('0x4')],'unique':_0x1435('0x5')},'VoiceQueueId':{'type':Sequelize[_0x1435('0x4')],'unique':_0x1435('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index a4c3151..49c5afb 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 _0x261b=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','save','stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','merge','filter','then','includeAll','include','findAll','rows','catch','show','params','find','update','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis'];(function(_0x3b8e35,_0x5046e8){var _0x2aeff1=function(_0x50bef6){while(--_0x50bef6){_0x3b8e35['push'](_0x3b8e35['shift']());}};_0x2aeff1(++_0x5046e8);}(_0x261b,0x108));var _0xb261=function(_0x4a0772,_0x2b7b45){_0x4a0772=_0x4a0772-0x0;var _0x29cf88=_0x261b[_0x4a0772];return _0x29cf88;};'use strict';var emlformat=require(_0xb261('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb261('0x1'));var jsonpatch=require(_0xb261('0x2'));var rp=require(_0xb261('0x3'));var moment=require(_0xb261('0x4'));var BPromise=require(_0xb261('0x5'));var Mustache=require(_0xb261('0x6'));var util=require(_0xb261('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb261('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb261('0x9'));var crypto=require(_0xb261('0xa'));var jsforce=require(_0xb261('0xb'));var deskjs=require(_0xb261('0xc'));var toCsv=require(_0xb261('0xd'));var querystring=require(_0xb261('0xe'));var Papa=require('papaparse');var Redis=require(_0xb261('0xf'));var authService=require(_0xb261('0x10'));var qs=require(_0xb261('0x11'));var as=require(_0xb261('0x12'));var hardwareService=require(_0xb261('0x13'));var logger=require('../../config/logger')(_0xb261('0x14'));var utils=require('../../config/utils');var config=require(_0xb261('0x15'));var licenseUtil=require(_0xb261('0x16'));var db=require(_0xb261('0x17'))['db'];function respondWithStatusCode(_0x302e1d,_0x1cab8e){_0x1cab8e=_0x1cab8e||0xcc;return function(_0x33e638){if(_0x33e638){return _0x302e1d[_0xb261('0x18')](_0x1cab8e);}return _0x302e1d[_0xb261('0x19')](_0x1cab8e)[_0xb261('0x1a')]();};}function respondWithResult(_0x466f25,_0x2ddb0e){_0x2ddb0e=_0x2ddb0e||0xc8;return function(_0x11de57){if(_0x11de57){return _0x466f25[_0xb261('0x19')](_0x2ddb0e)[_0xb261('0x1b')](_0x11de57);}};}function respondWithFilteredResult(_0xbdb521,_0xbfe961){return function(_0x149e2e){if(_0x149e2e){var _0x50e3bd=typeof _0xbfe961[_0xb261('0x1c')]===_0xb261('0x1d')&&typeof _0xbfe961['limit']==='undefined';var _0x55aa07=_0x149e2e[_0xb261('0x1e')];var _0x473c91=_0x50e3bd?0x0:_0xbfe961[_0xb261('0x1c')];var _0x203555=_0x50e3bd?_0x149e2e[_0xb261('0x1e')]:_0xbfe961['offset']+_0xbfe961['limit'];var _0x23d092;if(_0x203555>=_0x55aa07){_0x203555=_0x55aa07;_0x23d092=0xc8;}else{_0x23d092=0xce;}_0xbdb521['status'](_0x23d092);return _0xbdb521['set'](_0xb261('0x1f'),_0x473c91+'-'+_0x203555+'/'+_0x55aa07)['json'](_0x149e2e);}return null;};}function patchUpdates(_0x5c8c07){return function(_0x575868){try{jsonpatch['apply'](_0x575868,_0x5c8c07,!![]);}catch(_0x1f7769){return BPromise['reject'](_0x1f7769);}return _0x575868[_0xb261('0x20')]();};}function saveUpdates(_0x31e135,_0x2ebe35){return function(_0x35bb1d){if(_0x35bb1d){return _0x35bb1d['update'](_0x31e135)['then'](function(_0x10fbf5){return _0x10fbf5;});}return null;};}function removeEntity(_0x323754,_0x12fea2){return function(_0x31f6d4){if(_0x31f6d4){return _0x31f6d4['destroy']()['then'](function(){_0x323754[_0xb261('0x19')](0xcc)[_0xb261('0x1a')]();});}};}function handleEntityNotFound(_0x499c24,_0x364b93){return function(_0x2de1a5){if(!_0x2de1a5){_0x499c24[_0xb261('0x18')](0x194);}return _0x2de1a5;};}function handleError(_0xcd5c18,_0x65a918){_0x65a918=_0x65a918||0x1f4;return function(_0x45c041){logger['error'](_0x45c041[_0xb261('0x21')]);if(_0x45c041[_0xb261('0x22')]){delete _0x45c041[_0xb261('0x22')];}_0xcd5c18['status'](_0x65a918)['send'](_0x45c041);};}exports[_0xb261('0x23')]=function(_0x2bd574,_0x375dbd){var _0x138020={},_0x582680={},_0x333f66={'count':0x0,'rows':[]};var _0x521f5b=_[_0xb261('0x24')](db[_0xb261('0x25')][_0xb261('0x26')],function(_0xf759a0){return{'name':_0xf759a0[_0xb261('0x27')],'type':_0xf759a0[_0xb261('0x28')]['key']};});_0x582680[_0xb261('0x29')]=_[_0xb261('0x24')](_0x521f5b,_0xb261('0x22'));_0x582680[_0xb261('0x2a')]=_[_0xb261('0x2b')](_0x2bd574['query']);_0x582680['filters']=_['intersection'](_0x582680[_0xb261('0x29')],_0x582680['query']);_0x138020[_0xb261('0x2c')]=_[_0xb261('0x2d')](_0x582680[_0xb261('0x29')],qs[_0xb261('0x2e')](_0x2bd574[_0xb261('0x2a')][_0xb261('0x2e')]));_0x138020['attributes']=_0x138020[_0xb261('0x2c')][_0xb261('0x2f')]?_0x138020[_0xb261('0x2c')]:_0x582680['model'];if(!_0x2bd574[_0xb261('0x2a')][_0xb261('0x30')](_0xb261('0x31'))){_0x138020['limit']=qs[_0xb261('0x32')](_0x2bd574[_0xb261('0x2a')][_0xb261('0x32')]);_0x138020[_0xb261('0x1c')]=qs[_0xb261('0x1c')](_0x2bd574[_0xb261('0x2a')][_0xb261('0x1c')]);}_0x138020[_0xb261('0x33')]=qs[_0xb261('0x34')](_0x2bd574[_0xb261('0x2a')][_0xb261('0x34')]);_0x138020[_0xb261('0x35')]=qs[_0xb261('0x36')](_['pick'](_0x2bd574[_0xb261('0x2a')],_0x582680[_0xb261('0x36')]),_0x521f5b);if(_0x2bd574[_0xb261('0x2a')]['filter']){_0x138020['where']=_[_0xb261('0x37')](_0x138020[_0xb261('0x35')],{'$or':_[_0xb261('0x24')](_0x521f5b,function(_0x4670ce){if(_0x4670ce[_0xb261('0x28')]!=='VIRTUAL'){var _0x2f1dca={};_0x2f1dca[_0x4670ce[_0xb261('0x22')]]={'$like':'%'+_0x2bd574[_0xb261('0x2a')][_0xb261('0x38')]+'%'};return _0x2f1dca;}})});}_0x138020=_[_0xb261('0x37')]({},_0x138020,_0x2bd574['options']);var _0x56905c={'where':_0x138020['where']};return db[_0xb261('0x25')][_0xb261('0x1e')](_0x56905c)[_0xb261('0x39')](function(_0xcd114a){_0x333f66[_0xb261('0x1e')]=_0xcd114a;if(_0x2bd574[_0xb261('0x2a')][_0xb261('0x3a')]){_0x138020[_0xb261('0x3b')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xb261('0x3c')](_0x138020);})[_0xb261('0x39')](function(_0x346997){_0x333f66[_0xb261('0x3d')]=_0x346997;return _0x333f66;})[_0xb261('0x39')](respondWithFilteredResult(_0x375dbd,_0x138020))[_0xb261('0x3e')](handleError(_0x375dbd,null));};exports[_0xb261('0x3f')]=function(_0x5746f5,_0x1a3da2){var _0x2ebc14={'raw':!![],'where':{'id':_0x5746f5[_0xb261('0x40')]['id']}},_0x965722={};_0x965722[_0xb261('0x29')]=_[_0xb261('0x2b')](db[_0xb261('0x25')]['rawAttributes']);_0x965722[_0xb261('0x2a')]=_[_0xb261('0x2b')](_0x5746f5[_0xb261('0x2a')]);_0x965722[_0xb261('0x36')]=_[_0xb261('0x2d')](_0x965722[_0xb261('0x29')],_0x965722[_0xb261('0x2a')]);_0x2ebc14[_0xb261('0x2c')]=_[_0xb261('0x2d')](_0x965722[_0xb261('0x29')],qs[_0xb261('0x2e')](_0x5746f5[_0xb261('0x2a')]['fields']));_0x2ebc14['attributes']=_0x2ebc14[_0xb261('0x2c')]['length']?_0x2ebc14[_0xb261('0x2c')]:_0x965722[_0xb261('0x29')];if(_0x5746f5['query'][_0xb261('0x3a')]){_0x2ebc14[_0xb261('0x3b')]=[{'all':!![]}];}_0x2ebc14=_['merge']({},_0x2ebc14,_0x5746f5['options']);return db[_0xb261('0x25')][_0xb261('0x41')](_0x2ebc14)['then'](handleEntityNotFound(_0x1a3da2,null))[_0xb261('0x39')](respondWithResult(_0x1a3da2,null))['catch'](handleError(_0x1a3da2,null));};exports[_0xb261('0x42')]=function(_0x2bbd5e,_0x2097fa){if(_0x2bbd5e[_0xb261('0x43')]['id']){delete _0x2bbd5e[_0xb261('0x43')]['id'];}return db[_0xb261('0x25')][_0xb261('0x41')]({'where':{'id':_0x2bbd5e['params']['id']}})['then'](handleEntityNotFound(_0x2097fa,null))[_0xb261('0x39')](saveUpdates(_0x2bbd5e[_0xb261('0x43')],null))['then'](respondWithResult(_0x2097fa,null))[_0xb261('0x3e')](handleError(_0x2097fa,null));};exports[_0xb261('0x44')]=function(_0x4318a3,_0x2be6c3){return db[_0xb261('0x25')][_0xb261('0x41')]({'where':{'id':_0x4318a3['params']['id']}})['then'](handleEntityNotFound(_0x2be6c3,null))[_0xb261('0x39')](removeEntity(_0x2be6c3,null))[_0xb261('0x3e')](handleError(_0x2be6c3,null));};exports['describe']=function(_0x8a3d0c,_0x453031){return db[_0xb261('0x25')][_0xb261('0x45')]()['then'](respondWithResult(_0x453031,null))[_0xb261('0x3e')](handleError(_0x453031,null));}; \ No newline at end of file +var _0x2801=['name','index','map','CmHopperBlack','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','findAll','rows','params','include','options','find','catch','body','describe','eml-format','rimraf','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack'];(function(_0x24b469,_0x56ca74){var _0x19c933=function(_0x4d9cc0){while(--_0x4d9cc0){_0x24b469['push'](_0x24b469['shift']());}};_0x19c933(++_0x56ca74);}(_0x2801,0xeb));var _0x1280=function(_0x490f82,_0x2faa40){_0x490f82=_0x490f82-0x0;var _0x13b126=_0x2801[_0x490f82];return _0x13b126;};'use strict';var emlformat=require(_0x1280('0x0'));var rimraf=require(_0x1280('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1280('0x2'));var Mustache=require(_0x1280('0x3'));var util=require(_0x1280('0x4'));var path=require(_0x1280('0x5'));var sox=require(_0x1280('0x6'));var csv=require(_0x1280('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1280('0x8'));var _=require(_0x1280('0x9'));var squel=require(_0x1280('0xa'));var crypto=require(_0x1280('0xb'));var jsforce=require(_0x1280('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1280('0x7'));var querystring=require('querystring');var Papa=require(_0x1280('0xd'));var Redis=require(_0x1280('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1280('0xf'));var hardwareService=require(_0x1280('0x10'));var logger=require(_0x1280('0x11'))(_0x1280('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1280('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1628f6,_0x2d3453){_0x2d3453=_0x2d3453||0xcc;return function(_0x2a5a6f){if(_0x2a5a6f){return _0x1628f6[_0x1280('0x14')](_0x2d3453);}return _0x1628f6['status'](_0x2d3453)[_0x1280('0x15')]();};}function respondWithResult(_0x223cbe,_0x16234e){_0x16234e=_0x16234e||0xc8;return function(_0x466b1d){if(_0x466b1d){return _0x223cbe[_0x1280('0x16')](_0x16234e)['json'](_0x466b1d);}};}function respondWithFilteredResult(_0x5d4883,_0x5b7fb5){return function(_0xf0051b){if(_0xf0051b){var _0x302845=typeof _0x5b7fb5['offset']===_0x1280('0x17')&&typeof _0x5b7fb5[_0x1280('0x18')]===_0x1280('0x17');var _0x1aa579=_0xf0051b[_0x1280('0x19')];var _0x246c53=_0x302845?0x0:_0x5b7fb5[_0x1280('0x1a')];var _0x428d05=_0x302845?_0xf0051b[_0x1280('0x19')]:_0x5b7fb5['offset']+_0x5b7fb5[_0x1280('0x18')];var _0x3b5f3d;if(_0x428d05>=_0x1aa579){_0x428d05=_0x1aa579;_0x3b5f3d=0xc8;}else{_0x3b5f3d=0xce;}_0x5d4883['status'](_0x3b5f3d);return _0x5d4883[_0x1280('0x1b')](_0x1280('0x1c'),_0x246c53+'-'+_0x428d05+'/'+_0x1aa579)[_0x1280('0x1d')](_0xf0051b);}return null;};}function patchUpdates(_0x4d7ce2){return function(_0x229867){try{jsonpatch['apply'](_0x229867,_0x4d7ce2,!![]);}catch(_0x220584){return BPromise[_0x1280('0x1e')](_0x220584);}return _0x229867[_0x1280('0x1f')]();};}function saveUpdates(_0x3ea249,_0x56c5c0){return function(_0x1091ca){if(_0x1091ca){return _0x1091ca[_0x1280('0x20')](_0x3ea249)[_0x1280('0x21')](function(_0x224ab7){return _0x224ab7;});}return null;};}function removeEntity(_0x384be0,_0x1dae88){return function(_0x13e78a){if(_0x13e78a){return _0x13e78a[_0x1280('0x22')]()[_0x1280('0x21')](function(){_0x384be0[_0x1280('0x16')](0xcc)[_0x1280('0x15')]();});}};}function handleEntityNotFound(_0x4c594f,_0x1277e9){return function(_0x5c4c83){if(!_0x5c4c83){_0x4c594f['sendStatus'](0x194);}return _0x5c4c83;};}function handleError(_0x117d8a,_0x22fc18){_0x22fc18=_0x22fc18||0x1f4;return function(_0x1adb94){logger[_0x1280('0x23')](_0x1adb94[_0x1280('0x24')]);if(_0x1adb94[_0x1280('0x25')]){delete _0x1adb94['name'];}_0x117d8a[_0x1280('0x16')](_0x22fc18)['send'](_0x1adb94);};}exports[_0x1280('0x26')]=function(_0x1ad6f3,_0x37bd04){var _0x3e1a09={},_0x1338fe={},_0x2f6913={'count':0x0,'rows':[]};var _0x46faff=_[_0x1280('0x27')](db[_0x1280('0x28')][_0x1280('0x29')],function(_0x17a61f){return{'name':_0x17a61f[_0x1280('0x2a')],'type':_0x17a61f['type']['key']};});_0x1338fe['model']=_[_0x1280('0x27')](_0x46faff,_0x1280('0x25'));_0x1338fe[_0x1280('0x2b')]=_[_0x1280('0x2c')](_0x1ad6f3['query']);_0x1338fe[_0x1280('0x2d')]=_[_0x1280('0x2e')](_0x1338fe[_0x1280('0x2f')],_0x1338fe[_0x1280('0x2b')]);_0x3e1a09[_0x1280('0x30')]=_[_0x1280('0x2e')](_0x1338fe[_0x1280('0x2f')],qs[_0x1280('0x31')](_0x1ad6f3[_0x1280('0x2b')][_0x1280('0x31')]));_0x3e1a09['attributes']=_0x3e1a09[_0x1280('0x30')][_0x1280('0x32')]?_0x3e1a09['attributes']:_0x1338fe[_0x1280('0x2f')];if(!_0x1ad6f3[_0x1280('0x2b')][_0x1280('0x33')](_0x1280('0x34'))){_0x3e1a09['limit']=qs[_0x1280('0x18')](_0x1ad6f3[_0x1280('0x2b')][_0x1280('0x18')]);_0x3e1a09[_0x1280('0x1a')]=qs[_0x1280('0x1a')](_0x1ad6f3['query']['offset']);}_0x3e1a09['order']=qs[_0x1280('0x35')](_0x1ad6f3[_0x1280('0x2b')]['sort']);_0x3e1a09[_0x1280('0x36')]=qs[_0x1280('0x2d')](_[_0x1280('0x37')](_0x1ad6f3['query'],_0x1338fe['filters']),_0x46faff);if(_0x1ad6f3[_0x1280('0x2b')][_0x1280('0x38')]){_0x3e1a09[_0x1280('0x36')]=_[_0x1280('0x39')](_0x3e1a09[_0x1280('0x36')],{'$or':_[_0x1280('0x27')](_0x46faff,function(_0x398950){if(_0x398950['type']!=='VIRTUAL'){var _0x10507f={};_0x10507f[_0x398950[_0x1280('0x25')]]={'$like':'%'+_0x1ad6f3['query']['filter']+'%'};return _0x10507f;}})});}_0x3e1a09=_[_0x1280('0x39')]({},_0x3e1a09,_0x1ad6f3['options']);var _0x351a8e={'where':_0x3e1a09[_0x1280('0x36')]};return db[_0x1280('0x28')][_0x1280('0x19')](_0x351a8e)['then'](function(_0x4f6828){_0x2f6913[_0x1280('0x19')]=_0x4f6828;if(_0x1ad6f3['query'][_0x1280('0x3a')]){_0x3e1a09['include']=[{'all':!![]}];}return db[_0x1280('0x28')][_0x1280('0x3b')](_0x3e1a09);})[_0x1280('0x21')](function(_0x383974){_0x2f6913[_0x1280('0x3c')]=_0x383974;return _0x2f6913;})[_0x1280('0x21')](respondWithFilteredResult(_0x37bd04,_0x3e1a09))['catch'](handleError(_0x37bd04,null));};exports['show']=function(_0x5b3d99,_0x1c8f5b){var _0x141a01={'raw':!![],'where':{'id':_0x5b3d99[_0x1280('0x3d')]['id']}},_0x2232bb={};_0x2232bb[_0x1280('0x2f')]=_[_0x1280('0x2c')](db[_0x1280('0x28')][_0x1280('0x29')]);_0x2232bb['query']=_[_0x1280('0x2c')](_0x5b3d99[_0x1280('0x2b')]);_0x2232bb[_0x1280('0x2d')]=_[_0x1280('0x2e')](_0x2232bb[_0x1280('0x2f')],_0x2232bb[_0x1280('0x2b')]);_0x141a01[_0x1280('0x30')]=_[_0x1280('0x2e')](_0x2232bb[_0x1280('0x2f')],qs[_0x1280('0x31')](_0x5b3d99[_0x1280('0x2b')][_0x1280('0x31')]));_0x141a01[_0x1280('0x30')]=_0x141a01[_0x1280('0x30')][_0x1280('0x32')]?_0x141a01[_0x1280('0x30')]:_0x2232bb[_0x1280('0x2f')];if(_0x5b3d99['query'][_0x1280('0x3a')]){_0x141a01[_0x1280('0x3e')]=[{'all':!![]}];}_0x141a01=_[_0x1280('0x39')]({},_0x141a01,_0x5b3d99[_0x1280('0x3f')]);return db[_0x1280('0x28')][_0x1280('0x40')](_0x141a01)[_0x1280('0x21')](handleEntityNotFound(_0x1c8f5b,null))['then'](respondWithResult(_0x1c8f5b,null))[_0x1280('0x41')](handleError(_0x1c8f5b,null));};exports[_0x1280('0x20')]=function(_0x401eb1,_0x1d5361){if(_0x401eb1[_0x1280('0x42')]['id']){delete _0x401eb1[_0x1280('0x42')]['id'];}return db[_0x1280('0x28')][_0x1280('0x40')]({'where':{'id':_0x401eb1[_0x1280('0x3d')]['id']}})[_0x1280('0x21')](handleEntityNotFound(_0x1d5361,null))[_0x1280('0x21')](saveUpdates(_0x401eb1[_0x1280('0x42')],null))[_0x1280('0x21')](respondWithResult(_0x1d5361,null))['catch'](handleError(_0x1d5361,null));};exports['destroy']=function(_0x272412,_0x19520b){return db[_0x1280('0x28')][_0x1280('0x40')]({'where':{'id':_0x272412['params']['id']}})[_0x1280('0x21')](handleEntityNotFound(_0x19520b,null))[_0x1280('0x21')](removeEntity(_0x19520b,null))[_0x1280('0x41')](handleError(_0x19520b,null));};exports['describe']=function(_0x56a63f,_0x2744e3){return db['CmHopperBlack'][_0x1280('0x43')]()[_0x1280('0x21')](respondWithResult(_0x2744e3,null))[_0x1280('0x41')](handleError(_0x2744e3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 10a0b88..61200ef 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 _0xc476=['../../config/environment','./cmHopperBlack.attributes','CmHopperBlack','cm_hopper_black','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc476,0x176));var _0x6c47=function(_0xb1937e,_0x330b2f){_0xb1937e=_0xb1937e-0x0;var _0x44474f=_0xc476[_0xb1937e];return _0x44474f;};'use strict';var _=require('lodash');var util=require(_0x6c47('0x0'));var logger=require('../../config/logger')(_0x6c47('0x1'));var moment=require(_0x6c47('0x2'));var BPromise=require(_0x6c47('0x3'));var rp=require(_0x6c47('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c47('0x5'));var config=require(_0x6c47('0x6'));var attributes=require(_0x6c47('0x7'));module['exports']=function(_0x5f5146,_0x4de7fc){return _0x5f5146['define'](_0x6c47('0x8'),attributes,{'tableName':_0x6c47('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a41=['bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','api'];(function(_0x20e7db,_0x31f44f){var _0x1121b3=function(_0x3950c5){while(--_0x3950c5){_0x20e7db['push'](_0x20e7db['shift']());}};_0x1121b3(++_0x31f44f);}(_0x6a41,0x8d));var _0x16a4=function(_0x41a10f,_0xa263){_0x41a10f=_0x41a10f-0x0;var _0x3cb877=_0x6a41[_0x41a10f];return _0x3cb877;};'use strict';var _=require(_0x16a4('0x0'));var util=require(_0x16a4('0x1'));var logger=require('../../config/logger')(_0x16a4('0x2'));var moment=require('moment');var BPromise=require(_0x16a4('0x3'));var rp=require(_0x16a4('0x4'));var fs=require('fs');var path=require(_0x16a4('0x5'));var rimraf=require(_0x16a4('0x6'));var config=require('../../config/environment');var attributes=require(_0x16a4('0x7'));module[_0x16a4('0x8')]=function(_0x185c69,_0x27431d){return _0x185c69[_0x16a4('0x9')](_0x16a4('0xa'),attributes,{'tableName':_0x16a4('0xb'),'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 1e54ed0..6643d64 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 _0xffff=['stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','debug','request\x20sent'];(function(_0x70b60c,_0x4baa3a){var _0x423065=function(_0x37be8c){while(--_0x37be8c){_0x70b60c['push'](_0x70b60c['shift']());}};_0x423065(++_0x4baa3a);}(_0xffff,0x1ec));var _0xffff=function(_0x58d7e5,_0x202353){_0x58d7e5=_0x58d7e5-0x0;var _0x466d4a=_0xffff[_0x58d7e5];return _0x466d4a;};'use strict';var _=require(_0xffff('0x0'));var util=require(_0xffff('0x1'));var moment=require(_0xffff('0x2'));var BPromise=require(_0xffff('0x3'));var rs=require(_0xffff('0x4'));var fs=require('fs');var Redis=require(_0xffff('0x5'));var db=require(_0xffff('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xffff('0x7'));var config=require(_0xffff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xffff('0x9')][_0xffff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x116467,_0x102f1e,_0x2c8589){return new BPromise(function(_0x2de696,_0x310db0){return client[_0xffff('0xb')](_0x116467,_0x2c8589)[_0xffff('0xc')](function(_0x5a07de){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x102f1e,'request\x20sent');logger[_0xffff('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x102f1e,_0xffff('0xe'),JSON[_0xffff('0xf')](_0x5a07de));if(_0x5a07de[_0xffff('0x10')]){if(_0x5a07de[_0xffff('0x10')][_0xffff('0x11')]===0x1f4){logger[_0xffff('0x10')](_0xffff('0x12'),_0x102f1e,_0x5a07de[_0xffff('0x10')][_0xffff('0x13')]);return _0x310db0(_0x5a07de[_0xffff('0x10')][_0xffff('0x13')]);}logger[_0xffff('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x102f1e,_0x5a07de[_0xffff('0x10')][_0xffff('0x13')]);return _0x2de696(_0x5a07de[_0xffff('0x10')]['message']);}else{logger[_0xffff('0x14')](_0xffff('0x12'),_0x102f1e,_0xffff('0xe'));_0x2de696(_0x5a07de[_0xffff('0x15')]['message']);}})[_0xffff('0x16')](function(_0x137324){logger[_0xffff('0x10')](_0xffff('0x12'),_0x102f1e,_0x137324);_0x310db0(_0x137324);});});}exports[_0xffff('0x17')]=function(_0x3ef729){var _0x12138c=this;return new Promise(function(_0x1cf94e,_0xf21468){return db[_0xffff('0x18')][_0xffff('0x19')]({'raw':_0x3ef729[_0xffff('0x1a')]?_0x3ef729['options'][_0xffff('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ef729[_0xffff('0x1a')]?_0x3ef729[_0xffff('0x1a')][_0xffff('0x1c')]||null:null,'attributes':_0x3ef729['options']?_0x3ef729[_0xffff('0x1a')][_0xffff('0x1d')]||null:null,'limit':_0x3ef729[_0xffff('0x1a')]?_0x3ef729[_0xffff('0x1a')][_0xffff('0x1e')]||null:null,'include':_0x3ef729[_0xffff('0x1a')]?_0x3ef729[_0xffff('0x1a')][_0xffff('0x1f')]?_[_0xffff('0x20')](_0x3ef729[_0xffff('0x1a')][_0xffff('0x1f')],function(_0x4172a1){return{'model':db[_0x4172a1['model']],'as':_0x4172a1['as'],'attributes':_0x4172a1[_0xffff('0x1d')],'include':_0x4172a1[_0xffff('0x1f')]?_['map'](_0x4172a1['include'],function(_0x1a670e){return{'model':db[_0x1a670e[_0xffff('0x21')]],'as':_0x1a670e['as'],'attributes':_0x1a670e[_0xffff('0x1d')],'include':_0x1a670e[_0xffff('0x1f')]?_[_0xffff('0x20')](_0x1a670e[_0xffff('0x1f')],function(_0x4e780a){return{'model':db[_0x4e780a[_0xffff('0x21')]],'as':_0x4e780a['as'],'attributes':_0x4e780a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x16d799){logger['info']('GetCmHopperBlack',_0x3ef729);logger[_0xffff('0xd')]('GetCmHopperBlack',_0x3ef729,JSON[_0xffff('0xf')](_0x16d799));_0x1cf94e(_0x16d799);})[_0xffff('0x16')](function(_0x54671f){logger[_0xffff('0x10')](_0xffff('0x17'),_0x54671f[_0xffff('0x13')],_0x3ef729);_0xf21468(_0x12138c[_0xffff('0x10')](0x1f4,_0x54671f[_0xffff('0x13')]));});});};exports[_0xffff('0x22')]=function(_0x2b6ea5){var _0x1e4371=this;return new Promise(function(_0x226627,_0x5dc18d){return db[_0xffff('0x18')][_0xffff('0x23')](_0x2b6ea5[_0xffff('0x24')],{'raw':_0x2b6ea5[_0xffff('0x1a')]?_0x2b6ea5[_0xffff('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b6ea5[_0xffff('0x1a')]?_0x2b6ea5[_0xffff('0x1a')][_0xffff('0x1c')]||null:null,'attributes':_0x2b6ea5[_0xffff('0x1a')]?_0x2b6ea5[_0xffff('0x1a')][_0xffff('0x1d')]||null:null,'limit':_0x2b6ea5[_0xffff('0x1a')]?_0x2b6ea5[_0xffff('0x1a')][_0xffff('0x1e')]||null:null})['then'](function(_0x5e6ce1){logger['info'](_0xffff('0x22'),_0x2b6ea5);logger[_0xffff('0xd')]('UpdateCmHopperBlack',_0x2b6ea5,JSON[_0xffff('0xf')](_0x5e6ce1));_0x226627(_0x5e6ce1);})[_0xffff('0x16')](function(_0x3108f4){logger[_0xffff('0x10')](_0xffff('0x22'),_0x3108f4['message'],_0x2b6ea5);_0x5dc18d(_0x1e4371['error'](0x1f4,_0x3108f4['message']));});});};exports[_0xffff('0x25')]=function(_0x55f3aa){var _0x24973b=this;return new Promise(function(_0x706185,_0x184e12){return db[_0xffff('0x18')][_0xffff('0x26')]({'where':_0x55f3aa[_0xffff('0x1a')]?_0x55f3aa[_0xffff('0x1a')][_0xffff('0x1c')]||null:null})[_0xffff('0xc')](function(_0x2e55d3){logger[_0xffff('0x14')](_0xffff('0x25'),_0x55f3aa);logger['debug']('DestroyCmHopperBlack',_0x55f3aa,JSON[_0xffff('0xf')](_0x2e55d3));_0x706185(_0x2e55d3);})[_0xffff('0x16')](function(_0x419cac){logger[_0xffff('0x10')](_0xffff('0x25'),_0x419cac['message'],_0x55f3aa);_0x184e12(_0x24973b[_0xffff('0x10')](0x1f4,_0x419cac[_0xffff('0x13')]));});});}; \ No newline at end of file +var _0x28c2=['DestroyCmHopperBlack','destroy','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','CmHopperBlack,\x20%s,\x20%s','message','info','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','map','stringify','update','body','UpdateCmHopperBlack'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x28c2,0xca));var _0x228c=function(_0x5773f5,_0x5d8c42){_0x5773f5=_0x5773f5-0x0;var _0x437123=_0x28c2[_0x5773f5];return _0x437123;};'use strict';var _=require(_0x228c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x228c('0x1'));var rs=require(_0x228c('0x2'));var fs=require('fs');var Redis=require(_0x228c('0x3'));var db=require(_0x228c('0x4'))['db'];var utils=require(_0x228c('0x5'));var logger=require(_0x228c('0x6'))(_0x228c('0x7'));var config=require(_0x228c('0x8'));var jayson=require(_0x228c('0x9'));var client=jayson[_0x228c('0xa')][_0x228c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ed3d6,_0x2b1f78,_0x3a89ae){return new BPromise(function(_0xc2129c,_0x2806e9){return client[_0x228c('0xc')](_0x2ed3d6,_0x3a89ae)[_0x228c('0xd')](function(_0xa27d43){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x2b1f78,_0x228c('0xe'));logger[_0x228c('0xf')](_0x228c('0x10'),_0x2b1f78,_0x228c('0xe'),JSON['stringify'](_0xa27d43));if(_0xa27d43[_0x228c('0x11')]){if(_0xa27d43[_0x228c('0x11')][_0x228c('0x12')]===0x1f4){logger[_0x228c('0x11')](_0x228c('0x13'),_0x2b1f78,_0xa27d43[_0x228c('0x11')][_0x228c('0x14')]);return _0x2806e9(_0xa27d43[_0x228c('0x11')][_0x228c('0x14')]);}logger[_0x228c('0x11')](_0x228c('0x13'),_0x2b1f78,_0xa27d43[_0x228c('0x11')][_0x228c('0x14')]);return _0xc2129c(_0xa27d43[_0x228c('0x11')][_0x228c('0x14')]);}else{logger[_0x228c('0x15')](_0x228c('0x13'),_0x2b1f78,_0x228c('0xe'));_0xc2129c(_0xa27d43['result'][_0x228c('0x14')]);}})[_0x228c('0x16')](function(_0x22b498){logger['error'](_0x228c('0x13'),_0x2b1f78,_0x22b498);_0x2806e9(_0x22b498);});});}exports[_0x228c('0x17')]=function(_0x5749d0){var _0x169864=this;return new Promise(function(_0x5eb26f,_0x165b74){return db[_0x228c('0x18')][_0x228c('0x19')]({'raw':_0x5749d0[_0x228c('0x1a')]?_0x5749d0['options'][_0x228c('0x1b')]===undefined?!![]:![]:!![],'where':_0x5749d0[_0x228c('0x1a')]?_0x5749d0[_0x228c('0x1a')][_0x228c('0x1c')]||null:null,'attributes':_0x5749d0[_0x228c('0x1a')]?_0x5749d0[_0x228c('0x1a')][_0x228c('0x1d')]||null:null,'limit':_0x5749d0[_0x228c('0x1a')]?_0x5749d0['options'][_0x228c('0x1e')]||null:null,'include':_0x5749d0[_0x228c('0x1a')]?_0x5749d0['options'][_0x228c('0x1f')]?_['map'](_0x5749d0['options'][_0x228c('0x1f')],function(_0x544127){return{'model':db[_0x544127[_0x228c('0x20')]],'as':_0x544127['as'],'attributes':_0x544127[_0x228c('0x1d')],'include':_0x544127['include']?_['map'](_0x544127[_0x228c('0x1f')],function(_0x2598dc){return{'model':db[_0x2598dc['model']],'as':_0x2598dc['as'],'attributes':_0x2598dc[_0x228c('0x1d')],'include':_0x2598dc[_0x228c('0x1f')]?_[_0x228c('0x21')](_0x2598dc['include'],function(_0x127fea){return{'model':db[_0x127fea[_0x228c('0x20')]],'as':_0x127fea['as'],'attributes':_0x127fea[_0x228c('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1519c6){logger[_0x228c('0x15')](_0x228c('0x17'),_0x5749d0);logger[_0x228c('0xf')](_0x228c('0x17'),_0x5749d0,JSON[_0x228c('0x22')](_0x1519c6));_0x5eb26f(_0x1519c6);})['catch'](function(_0x4e21aa){logger[_0x228c('0x11')](_0x228c('0x17'),_0x4e21aa[_0x228c('0x14')],_0x5749d0);_0x165b74(_0x169864[_0x228c('0x11')](0x1f4,_0x4e21aa['message']));});});};exports['UpdateCmHopperBlack']=function(_0x25c65f){var _0x4deb75=this;return new Promise(function(_0x3aac02,_0x5c657b){return db[_0x228c('0x18')][_0x228c('0x23')](_0x25c65f[_0x228c('0x24')],{'raw':_0x25c65f['options']?_0x25c65f[_0x228c('0x1a')][_0x228c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25c65f[_0x228c('0x1a')]?_0x25c65f['options'][_0x228c('0x1c')]||null:null,'attributes':_0x25c65f[_0x228c('0x1a')]?_0x25c65f[_0x228c('0x1a')][_0x228c('0x1d')]||null:null,'limit':_0x25c65f[_0x228c('0x1a')]?_0x25c65f[_0x228c('0x1a')][_0x228c('0x1e')]||null:null})['then'](function(_0x1a40eb){logger[_0x228c('0x15')](_0x228c('0x25'),_0x25c65f);logger['debug'](_0x228c('0x25'),_0x25c65f,JSON['stringify'](_0x1a40eb));_0x3aac02(_0x1a40eb);})[_0x228c('0x16')](function(_0x350f4e){logger['error'](_0x228c('0x25'),_0x350f4e['message'],_0x25c65f);_0x5c657b(_0x4deb75['error'](0x1f4,_0x350f4e['message']));});});};exports[_0x228c('0x26')]=function(_0xf87183){var _0x140e30=this;return new Promise(function(_0x10e66f,_0x541561){return db[_0x228c('0x18')][_0x228c('0x27')]({'where':_0xf87183['options']?_0xf87183[_0x228c('0x1a')][_0x228c('0x1c')]||null:null})[_0x228c('0xd')](function(_0x38152f){logger[_0x228c('0x15')](_0x228c('0x26'),_0xf87183);logger[_0x228c('0xf')]('DestroyCmHopperBlack',_0xf87183,JSON[_0x228c('0x22')](_0x38152f));_0x10e66f(_0x38152f);})[_0x228c('0x16')](function(_0x36cd5f){logger[_0x228c('0x11')]('DestroyCmHopperBlack',_0x36cd5f[_0x228c('0x14')],_0xf87183);_0x541561(_0x140e30[_0x228c('0x11')](0x1f4,_0x36cd5f['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 22bb70d..91e2bef 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 _0x7bd0=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','update','delete','destroy','exports'];(function(_0x333fc8,_0x2b292c){var _0x432439=function(_0x5501b6){while(--_0x5501b6){_0x333fc8['push'](_0x333fc8['shift']());}};_0x432439(++_0x2b292c);}(_0x7bd0,0x111));var _0x07bd=function(_0x36b037,_0x2b234e){_0x36b037=_0x36b037-0x0;var _0x409194=_0x7bd0[_0x36b037];return _0x409194;};'use strict';var multer=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var path=require(_0x07bd('0x2'));var timeout=require(_0x07bd('0x3'));var express=require(_0x07bd('0x4'));var router=express[_0x07bd('0x5')]();var fs_extra=require(_0x07bd('0x6'));var auth=require(_0x07bd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x07bd('0x8'));var controller=require(_0x07bd('0x9'));router[_0x07bd('0xa')]('/',auth[_0x07bd('0xb')](),controller[_0x07bd('0xc')]);router[_0x07bd('0xa')](_0x07bd('0xd'),auth['isAuthenticated'](),controller[_0x07bd('0xe')]);router['get'](_0x07bd('0xf'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x10')]);router['put'](_0x07bd('0xf'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x11')]);router[_0x07bd('0x12')]('/:id',auth[_0x07bd('0xb')](),controller[_0x07bd('0x13')]);module[_0x07bd('0x14')]=router; \ No newline at end of file +var _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','describe','/:id','show','put','delete','destroy','multer','util'];(function(_0x228dce,_0x1f1cd0){var _0x31513e=function(_0x480f75){while(--_0x480f75){_0x228dce['push'](_0x228dce['shift']());}};_0x31513e(++_0x1f1cd0);}(_0xf494,0x1c6));var _0x4f49=function(_0x1e78e2,_0x252b20){_0x1e78e2=_0x1e78e2-0x0;var _0x1932e5=_0xf494[_0x1e78e2];return _0x1932e5;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x11')](_0x4f49('0xe'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);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 3d54052..d805597 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 _0x98f2=['DATE','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','moment','exports','INTEGER','STRING'];(function(_0x3770c8,_0x1e6cbd){var _0x25ac10=function(_0x4ab39f){while(--_0x4ab39f){_0x3770c8['push'](_0x3770c8['shift']());}};_0x25ac10(++_0x1e6cbd);}(_0x98f2,0x158));var _0x298f=function(_0x30acbc,_0x3c154a){_0x30acbc=_0x30acbc-0x0;var _0x733c46=_0x98f2[_0x30acbc];return _0x733c46;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x298f('0x0'));module[_0x298f('0x1')]={'state':{'type':Sequelize[_0x298f('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x298f('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x298f('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x298f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x298f('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x298f('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x298f('0x3')]},'originatecalleridname':{'type':Sequelize[_0x298f('0x3')]},'calleridnum':{'type':Sequelize[_0x298f('0x3')]},'calleridname':{'type':Sequelize[_0x298f('0x3')]},'starttime':{'type':Sequelize[_0x298f('0x4')]},'responsetime':{'type':Sequelize[_0x298f('0x4')]},'answertime':{'type':Sequelize[_0x298f('0x4')]},'droptime':{'type':Sequelize[_0x298f('0x4')]},'endtime':{'type':Sequelize[_0x298f('0x4')]},'ringtime':{'type':Sequelize[_0x298f('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x298f('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x298f('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x298f('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x298f('0x3')]},'campaign':{'type':Sequelize[_0x298f('0x3')]},'campaigntype':{'type':Sequelize[_0x298f('0x3')]},'membername':{'type':Sequelize[_0x298f('0x3')]},'reason':{'type':Sequelize[_0x298f('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x298f('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x298f('0x4')],'set':function(_0x452e9d){var _0x2ae25c=this['getDataValue'](_0x298f('0x5'));if(_0x2ae25c&&_0x452e9d){this[_0x298f('0x6')](_0x298f('0x7'),moment(_0x452e9d)[_0x298f('0x8')](moment(_0x2ae25c),_0x298f('0x9')));}return this[_0x298f('0x6')](_0x298f('0xa'),_0x452e9d);}},'amd':{'type':Sequelize[_0x298f('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x298f('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x298f('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x298f('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x298f('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x298f('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x298f('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x298f('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x298f('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x298f('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x298f('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x298f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x06cc=['moment','INTEGER','STRING','DATE','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize'];(function(_0x11104e,_0x5f2595){var _0x174b8f=function(_0x436fad){while(--_0x436fad){_0x11104e['push'](_0x11104e['shift']());}};_0x174b8f(++_0x5f2595);}(_0x06cc,0xd7));var _0xc06c=function(_0x148989,_0x2448df){_0x148989=_0x148989-0x0;var _0xcc3a1e=_0x06cc[_0x148989];return _0xcc3a1e;};'use strict';var Sequelize=require(_0xc06c('0x0'));var moment=require(_0xc06c('0x1'));module['exports']={'state':{'type':Sequelize[_0xc06c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xc06c('0x3')]},'scheduledat':{'type':Sequelize[_0xc06c('0x4')]},'countbusyretry':{'type':Sequelize[_0xc06c('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc06c('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc06c('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc06c('0x3')]},'calleridname':{'type':Sequelize[_0xc06c('0x3')]},'starttime':{'type':Sequelize[_0xc06c('0x4')]},'responsetime':{'type':Sequelize[_0xc06c('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xc06c('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xc06c('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc06c('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc06c('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc06c('0x3')]},'campaign':{'type':Sequelize[_0xc06c('0x3')]},'campaigntype':{'type':Sequelize[_0xc06c('0x3')]},'membername':{'type':Sequelize[_0xc06c('0x3')]},'reason':{'type':Sequelize[_0xc06c('0x3')]},'disposition':{'type':Sequelize[_0xc06c('0x3')]},'secondDisposition':{'type':Sequelize[_0xc06c('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc06c('0x3')]},'dispositionat':{'type':Sequelize[_0xc06c('0x4')],'set':function(_0x217a73){var _0x521d2a=this['getDataValue'](_0xc06c('0x5'));if(_0x521d2a&&_0x217a73){this[_0xc06c('0x6')](_0xc06c('0x7'),moment(_0x217a73)[_0xc06c('0x8')](moment(_0x521d2a),_0xc06c('0x9')));}return this[_0xc06c('0x6')](_0xc06c('0xa'),_0x217a73);}},'amd':{'type':Sequelize[_0xc06c('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xc06c('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xc06c('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xc06c('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xc06c('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc06c('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc06c('0x4')]},'deleted':{'type':Sequelize[_0xc06c('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xc06c('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xc06c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc06c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc06c('0x2')],'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 cd99fc9..ab2e3ff 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 _0xacf4=['reject','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','select','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','NOW()','CampaignId\x20=\x20?','checkContactHopper','CmHopper','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','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x4ff87f,_0x17e4af){var _0x4399e6=function(_0x25036c){while(--_0x25036c){_0x4ff87f['push'](_0x4ff87f['shift']());}};_0x4399e6(++_0x17e4af);}(_0xacf4,0xe7));var _0x4acf=function(_0x297ec5,_0x860cf4){_0x297ec5=_0x297ec5-0x0;var _0x367d44=_0xacf4[_0x297ec5];return _0x367d44;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['CmHopperFinal'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':!![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['CmHopperFinal']['describe']()[_0x4acf('0x21')](respondWithResult(_0x2d946c,null))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x33bc52,_0x287406){if(_0x33bc52[_0x4acf('0x47')][_0x4acf('0x48')]){delete _0x33bc52[_0x4acf('0x47')][_0x4acf('0x48')];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'uniqueid':_0x33bc52[_0x4acf('0x41')]['id']}})['then'](handleEntityNotFound(_0x287406,null))[_0x4acf('0x21')](saveUpdates(_0x33bc52[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x287406,null))[_0x4acf('0x3f')](handleError(_0x287406,null));};exports[_0x4acf('0x49')]=function(_0x3cf54a,_0x2785b9,_0x2d0561){return db[_0x4acf('0x29')][_0x4acf('0x3d')]({'raw':![],'where':{'VoiceQueueId':_0x3cf54a[_0x4acf('0x41')]['id']},'attributes':[[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),_0x4acf('0x4d')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x4e')))),_0x4acf('0x4f')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x50')))),'busyContacts'],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x51')))),_0x4acf('0x52')],[db['sequelize']['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x4acf('0x53')],[db['sequelize']['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x54')))),_0x4acf('0x55')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x2022,\x201,\x20null'))),_0x4acf('0x56')],[db[_0x4acf('0x4a')]['fn']('COUNT',db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal'](_0x4acf('0x57')))),_0x4acf('0x58')]]})[_0x4acf('0x21')](handleEntityNotFound(_0x2785b9,null))['then'](respondWithResult(_0x2785b9,null))[_0x4acf('0x3f')](handleError(_0x2785b9,null));};exports[_0x4acf('0x59')]=function(_0xb5bd81,_0x452ee6,_0x54b093){return db[_0x4acf('0x29')][_0x4acf('0x3d')]({'raw':![],'where':{'CampaignId':_0xb5bd81[_0x4acf('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x5a')))),_0x4acf('0x4d')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x4e')))),_0x4acf('0x4f')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x50')))),_0x4acf('0x5b')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x4acf('0x52')],[db['sequelize']['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x4acf('0x5c')))),_0x4acf('0x53')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db['sequelize'][_0x4acf('0x4c')](_0x4acf('0x5d')))),_0x4acf('0x56')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db['sequelize'][_0x4acf('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),_0x4acf('0x58')]]})[_0x4acf('0x21')](handleEntityNotFound(_0x452ee6,null))[_0x4acf('0x21')](respondWithResult(_0x452ee6,null))[_0x4acf('0x3f')](handleError(_0x452ee6,null));};exports[_0x4acf('0x5e')]=function(_0x173655,_0x1f2dbc,_0xc0d942){return db[_0x4acf('0x5f')][_0x4acf('0x45')]({'where':{'id':_0x173655[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x1f2dbc,null))['then'](function(_0x11f356){var _0xacca91;if(_0x11f356){_0xacca91=squel[_0x4acf('0x60')]()[_0x4acf('0x61')](_0x4acf('0x62'))[_0x4acf('0x63')]([_0x4acf('0x64'),_0x4acf('0x65'),_0x4acf('0x66'),_0x4acf('0x67'),'VoiceQueueId',_0x4acf('0x68'),_0x4acf('0x69')],squel['select']()[_0x4acf('0x6a')](_0x4acf('0x6b'),'phone')[_0x4acf('0x6a')]('NOW()','scheduledAt')[_0x4acf('0x6a')]('ANY_VALUE(ContactId)',_0x4acf('0x66'))[_0x4acf('0x6a')](_0x4acf('0x6c'),_0x4acf('0x67'))['field'](_0x4acf('0x6d'),_0x4acf('0x6e'))['field']('NOW()','createdAt')[_0x4acf('0x6a')]('NOW()',_0x4acf('0x69'))[_0x4acf('0x6f')](_0x4acf('0x70'))['where'](_0x4acf('0x71'),_0x173655[_0x4acf('0x41')]['id']['toString']())[_0x4acf('0x35')](_0x4acf('0x72'),_0x173655['body'][_0x4acf('0x73')][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x75'))[_0x4acf('0x35')](_0x4acf('0x76'),squel['select']()[_0x4acf('0x6a')]('phone')[_0x4acf('0x6f')](_0x4acf('0x62'))['where']('VoiceQueueId\x20=\x20?',_0x173655['params']['id'][_0x4acf('0x74')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x4acf('0x6a')]('calleridnum')[_0x4acf('0x6f')](_0x4acf('0x70'))[_0x4acf('0x35')](_0x4acf('0x71'),_0x173655[_0x4acf('0x41')]['id']['toString']())['where'](_0x4acf('0x77')))[_0x4acf('0x78')](_0x4acf('0x66')))[_0x4acf('0x74')]();return db[_0x4acf('0x4a')]['query'](_0xacca91);}return[];})[_0x4acf('0x21')](respondWithResult(_0x1f2dbc,null))[_0x4acf('0x3f')](handleError(_0x1f2dbc,null));};exports[_0x4acf('0x79')]=function(_0x453c6d,_0x1a82e7,_0x3d02c7){return db[_0x4acf('0x7a')]['find']({'where':{'id':_0x453c6d[_0x4acf('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a82e7,null))[_0x4acf('0x21')](function(_0x1bbe6d){var _0x2a36e2;if(_0x1bbe6d){_0x2a36e2=squel[_0x4acf('0x60')]()[_0x4acf('0x61')]('cm_hopper')[_0x4acf('0x63')](['phone',_0x4acf('0x65'),_0x4acf('0x66'),'ListId',_0x4acf('0x7b'),_0x4acf('0x68'),_0x4acf('0x69')],squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')]('ANY_VALUE(calleridnum)',_0x4acf('0x64'))['field']('NOW()',_0x4acf('0x65'))[_0x4acf('0x6a')](_0x4acf('0x7d'),_0x4acf('0x66'))['field']('ANY_VALUE(ListId)',_0x4acf('0x67'))[_0x4acf('0x6a')](_0x4acf('0x7e'),_0x4acf('0x7b'))[_0x4acf('0x6a')](_0x4acf('0x7f'),_0x4acf('0x68'))[_0x4acf('0x6a')]('NOW()','updatedAt')[_0x4acf('0x6f')](_0x4acf('0x70'))[_0x4acf('0x35')](_0x4acf('0x80'),_0x453c6d[_0x4acf('0x41')]['id'][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x72'),_0x453c6d[_0x4acf('0x47')]['state'][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x75'))[_0x4acf('0x35')](_0x4acf('0x76'),squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')](_0x4acf('0x64'))[_0x4acf('0x6f')](_0x4acf('0x62'))[_0x4acf('0x35')](_0x4acf('0x80'),_0x453c6d[_0x4acf('0x41')]['id']['toString']()))[_0x4acf('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')]('calleridnum')[_0x4acf('0x6f')](_0x4acf('0x70'))['where']('CampaignId\x20=\x20?',_0x453c6d[_0x4acf('0x41')]['id'][_0x4acf('0x74')]())['where']('state\x20=\x204'))[_0x4acf('0x78')](_0x4acf('0x66')))[_0x4acf('0x74')]();return db[_0x4acf('0x4a')]['query'](_0x2a36e2);}return[];})[_0x4acf('0x21')](respondWithResult(_0x1a82e7,null))[_0x4acf('0x3f')](handleError(_0x1a82e7,null));};exports[_0x4acf('0x81')]=function(_0x34e1ea,_0x43e9bf,_0x367ad4){return db[_0x4acf('0x82')]['findOne']({'where':{'VoiceQueueId':_0x34e1ea[_0x4acf('0x47')][_0x4acf('0x6e')],'CampaignId':_0x34e1ea[_0x4acf('0x47')]['CampaignId'],'ContactId':_0x34e1ea[_0x4acf('0x47')][_0x4acf('0x66')]}})[_0x4acf('0x21')](handleEntityNotFound(_0x43e9bf,null))[_0x4acf('0x21')](function(_0x37ffab){if(_0x37ffab){return _0x37ffab;}return null;})[_0x4acf('0x21')](respondWithResult(_0x43e9bf,null))[_0x4acf('0x3f')](handleError(_0x43e9bf,null));}; \ No newline at end of file +var _0xf61e=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','status','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','describe','update','body','uniqueid','params','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','noSuchContacts','noAnswerContacts','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','cm_hopper','phone','scheduledAt','VoiceQueueId','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','fromQuery','ContactId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','checkContactHopper','findOne','eml-format'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xf61e,0x191));var _0xef61=function(_0x4a8d9a,_0x575174){_0x4a8d9a=_0x4a8d9a-0x0;var _0x50d09a=_0xf61e[_0x4a8d9a];return _0x50d09a;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b144,_0x4e738f){return function(_0x2a6832){if(!_0x2a6832){_0x16b144[_0xef61('0x1d')](0x194);}return _0x2a6832;};}function handleError(_0x2419a9,_0xf4c7c9){_0xf4c7c9=_0xf4c7c9||0x1f4;return function(_0x2155f1){logger[_0xef61('0x2a')](_0x2155f1[_0xef61('0x2b')]);if(_0x2155f1[_0xef61('0x2c')]){delete _0x2155f1[_0xef61('0x2c')];}_0x2419a9[_0xef61('0x29')](_0xf4c7c9)[_0xef61('0x2d')](_0x2155f1);};}exports[_0xef61('0x2e')]=function(_0xeb9a62,_0x63edd4){var _0x1f3572={},_0x85978={},_0x39c15e={'count':0x0,'rows':[]};var _0x393ea9=_[_0xef61('0x2f')](db[_0xef61('0x30')][_0xef61('0x31')],function(_0x53fa3b){return{'name':_0x53fa3b['fieldName'],'type':_0x53fa3b['type'][_0xef61('0x32')]};});_0x85978[_0xef61('0x33')]=_[_0xef61('0x2f')](_0x393ea9,'name');_0x85978[_0xef61('0x34')]=_[_0xef61('0x35')](_0xeb9a62['query']);_0x85978[_0xef61('0x36')]=_['intersection'](_0x85978['model'],_0x85978[_0xef61('0x34')]);_0x1f3572['attributes']=_[_0xef61('0x37')](_0x85978['model'],qs[_0xef61('0x38')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x38')]));_0x1f3572[_0xef61('0x39')]=_0x1f3572[_0xef61('0x39')][_0xef61('0x3a')]?_0x1f3572[_0xef61('0x39')]:_0x85978[_0xef61('0x33')];if(!_0xeb9a62[_0xef61('0x34')][_0xef61('0x3b')]('nolimit')){_0x1f3572[_0xef61('0x23')]=qs[_0xef61('0x23')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x23')]);_0x1f3572[_0xef61('0x20')]=qs['offset'](_0xeb9a62[_0xef61('0x34')][_0xef61('0x20')]);}_0x1f3572[_0xef61('0x3c')]=qs['sort'](_0xeb9a62['query']['sort']);_0x1f3572[_0xef61('0x3d')]=qs['filters'](_['pick'](_0xeb9a62['query'],_0x85978[_0xef61('0x36')]),_0x393ea9);if(_0xeb9a62[_0xef61('0x34')][_0xef61('0x3e')]){_0x1f3572['where']=_['merge'](_0x1f3572['where'],{'$or':_[_0xef61('0x2f')](_0x393ea9,function(_0x32ad44){if(_0x32ad44['type']!==_0xef61('0x3f')){var _0x12f442={};_0x12f442[_0x32ad44[_0xef61('0x2c')]]={'$like':'%'+_0xeb9a62[_0xef61('0x34')]['filter']+'%'};return _0x12f442;}})});}_0x1f3572=_[_0xef61('0x40')]({},_0x1f3572,_0xeb9a62[_0xef61('0x41')]);var _0x3103d4={'where':_0x1f3572[_0xef61('0x3d')]};return db['CmHopperFinal']['count'](_0x3103d4)[_0xef61('0x28')](function(_0x462972){_0x39c15e[_0xef61('0x22')]=_0x462972;if(_0xeb9a62['query'][_0xef61('0x42')]){_0x1f3572[_0xef61('0x43')]=[{'all':!![]}];}return db[_0xef61('0x30')][_0xef61('0x44')](_0x1f3572);})['then'](function(_0x545597){_0x39c15e['rows']=_0x545597;return _0x39c15e;})[_0xef61('0x28')](respondWithFilteredResult(_0x63edd4,_0x1f3572))[_0xef61('0x45')](handleError(_0x63edd4,null));};exports[_0xef61('0x46')]=function(_0xe40d,_0x3f81a1){var _0x272143={'raw':!![],'where':{'id':_0xe40d['params']['id']}},_0xc9b467={};_0xc9b467[_0xef61('0x33')]=_[_0xef61('0x35')](db[_0xef61('0x30')][_0xef61('0x31')]);_0xc9b467['query']=_[_0xef61('0x35')](_0xe40d[_0xef61('0x34')]);_0xc9b467[_0xef61('0x36')]=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],_0xc9b467[_0xef61('0x34')]);_0x272143['attributes']=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],qs[_0xef61('0x38')](_0xe40d['query'][_0xef61('0x38')]));_0x272143[_0xef61('0x39')]=_0x272143[_0xef61('0x39')][_0xef61('0x3a')]?_0x272143[_0xef61('0x39')]:_0xc9b467[_0xef61('0x33')];if(_0xe40d['query'][_0xef61('0x42')]){_0x272143[_0xef61('0x43')]=[{'all':!![]}];}_0x272143=_['merge']({},_0x272143,_0xe40d[_0xef61('0x41')]);return db[_0xef61('0x30')][_0xef61('0x47')](_0x272143)[_0xef61('0x28')](handleEntityNotFound(_0x3f81a1,null))['then'](respondWithResult(_0x3f81a1,null))[_0xef61('0x45')](handleError(_0x3f81a1,null));};exports[_0xef61('0x48')]=function(_0x5e614b,_0x47b09d){return db[_0xef61('0x30')][_0xef61('0x48')]()['then'](respondWithResult(_0x47b09d,null))[_0xef61('0x45')](handleError(_0x47b09d,null));};exports[_0xef61('0x49')]=function(_0x13d0f8,_0x2904e0){if(_0x13d0f8[_0xef61('0x4a')][_0xef61('0x4b')]){delete _0x13d0f8[_0xef61('0x4a')]['uniqueid'];}return db[_0xef61('0x30')]['find']({'where':{'uniqueid':_0x13d0f8[_0xef61('0x4c')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x2904e0,null))[_0xef61('0x28')](saveUpdates(_0x13d0f8[_0xef61('0x4a')],null))[_0xef61('0x28')](respondWithResult(_0x2904e0,null))[_0xef61('0x45')](handleError(_0x2904e0,null));};exports[_0xef61('0x4d')]=function(_0x1565c7,_0x264877,_0x4af2f3){return db[_0xef61('0x30')][_0xef61('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x1565c7['params']['id']},'attributes':[[db['sequelize']['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db['sequelize'][_0xef61('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0xef61('0x51')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')]('`state`\x20=\x203,\x201,\x20null'))),_0xef61('0x52')],[db[_0xef61('0x4f')]['fn']('COUNT',db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xef61('0x53')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0xef61('0x54')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x55')))),_0xef61('0x56')],[db['sequelize']['fn']('COUNT',db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x57')))),_0xef61('0x58')],[db['sequelize']['fn'](_0xef61('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0xef61('0x50')](_0xef61('0x59')))),_0xef61('0x5a')],[db['sequelize']['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x5b')))),_0xef61('0x5c')]]})[_0xef61('0x28')](handleEntityNotFound(_0x264877,null))[_0xef61('0x28')](respondWithResult(_0x264877,null))[_0xef61('0x45')](handleError(_0x264877,null));};exports[_0xef61('0x5d')]=function(_0x5507ee,_0x15a8c5,_0x4b26e6){return db['CmHopperFinal'][_0xef61('0x44')]({'raw':![],'where':{'CampaignId':_0x5507ee[_0xef61('0x4c')]['id']},'attributes':[[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xef61('0x51')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x5e')))),_0xef61('0x52')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db['sequelize'][_0xef61('0x50')](_0xef61('0x5f')))),'busyContacts'],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x60')))),_0xef61('0x54')],[db[_0xef61('0x4f')]['fn']('COUNT',db[_0xef61('0x4f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xef61('0x56')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db['sequelize']['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x57')))),_0xef61('0x58')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x59')))),_0xef61('0x5a')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x5b')))),_0xef61('0x5c')]]})['then'](handleEntityNotFound(_0x15a8c5,null))[_0xef61('0x28')](respondWithResult(_0x15a8c5,null))[_0xef61('0x45')](handleError(_0x15a8c5,null));};exports[_0xef61('0x61')]=function(_0x5ab4fe,_0x38117b,_0x346752){return db['VoiceQueue'][_0xef61('0x47')]({'where':{'id':_0x5ab4fe[_0xef61('0x4c')]['id']}})['then'](handleEntityNotFound(_0x38117b,null))[_0xef61('0x28')](function(_0x54777a){var _0xe62ec2;if(_0x54777a){_0xe62ec2=squel[_0xef61('0x62')]()['into'](_0xef61('0x63'))['fromQuery']([_0xef61('0x64'),_0xef61('0x65'),'ContactId','ListId',_0xef61('0x66'),_0xef61('0x67'),_0xef61('0x68')],squel[_0xef61('0x69')]()[_0xef61('0x6a')]('ANY_VALUE(calleridnum)',_0xef61('0x64'))[_0xef61('0x6a')](_0xef61('0x6b'),_0xef61('0x65'))[_0xef61('0x6a')](_0xef61('0x6c'),'ContactId')[_0xef61('0x6a')]('ANY_VALUE(ListId)',_0xef61('0x6d'))[_0xef61('0x6a')](_0xef61('0x6e'),_0xef61('0x66'))[_0xef61('0x6a')](_0xef61('0x6b'),_0xef61('0x67'))[_0xef61('0x6a')](_0xef61('0x6b'),_0xef61('0x68'))[_0xef61('0x6f')](_0xef61('0x70'))[_0xef61('0x3d')]('VoiceQueueId\x20=\x20?',_0x5ab4fe[_0xef61('0x4c')]['id'][_0xef61('0x71')]())[_0xef61('0x3d')](_0xef61('0x72'),_0x5ab4fe['body'][_0xef61('0x73')]['toString']())['where'](_0xef61('0x74'))['where'](_0xef61('0x75'),squel['select']()['field'](_0xef61('0x64'))[_0xef61('0x6f')]('cm_hopper')[_0xef61('0x3d')]('VoiceQueueId\x20=\x20?',_0x5ab4fe[_0xef61('0x4c')]['id'][_0xef61('0x71')]()))[_0xef61('0x3d')](_0xef61('0x75'),squel['select']()[_0xef61('0x6a')]('calleridnum')[_0xef61('0x6f')](_0xef61('0x70'))[_0xef61('0x3d')](_0xef61('0x76'),_0x5ab4fe[_0xef61('0x4c')]['id'][_0xef61('0x71')]())[_0xef61('0x3d')](_0xef61('0x77')))[_0xef61('0x78')]('ContactId'))[_0xef61('0x71')]();return db['sequelize'][_0xef61('0x34')](_0xe62ec2);}return[];})[_0xef61('0x28')](respondWithResult(_0x38117b,null))['catch'](handleError(_0x38117b,null));};exports[_0xef61('0x79')]=function(_0x5b86e4,_0x52f7c5,_0x465fb5){return db[_0xef61('0x7a')]['find']({'where':{'id':_0x5b86e4[_0xef61('0x4c')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x52f7c5,null))['then'](function(_0x352633){var _0x2cb8a8;if(_0x352633){_0x2cb8a8=squel['insert']()[_0xef61('0x7b')]('cm_hopper')[_0xef61('0x7c')]([_0xef61('0x64'),_0xef61('0x65'),_0xef61('0x7d'),'ListId',_0xef61('0x7e'),_0xef61('0x67'),_0xef61('0x68')],squel['select']()[_0xef61('0x6a')](_0xef61('0x7f'),'phone')['field'](_0xef61('0x6b'),_0xef61('0x65'))[_0xef61('0x6a')](_0xef61('0x6c'),_0xef61('0x7d'))[_0xef61('0x6a')](_0xef61('0x80'),_0xef61('0x6d'))[_0xef61('0x6a')](_0xef61('0x81'),_0xef61('0x7e'))[_0xef61('0x6a')](_0xef61('0x6b'),_0xef61('0x67'))[_0xef61('0x6a')](_0xef61('0x6b'),'updatedAt')[_0xef61('0x6f')](_0xef61('0x70'))[_0xef61('0x3d')](_0xef61('0x82'),_0x5b86e4[_0xef61('0x4c')]['id'][_0xef61('0x71')]())[_0xef61('0x3d')](_0xef61('0x72'),_0x5b86e4[_0xef61('0x4a')][_0xef61('0x73')][_0xef61('0x71')]())[_0xef61('0x3d')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xef61('0x3d')](_0xef61('0x75'),squel['select']()[_0xef61('0x6a')](_0xef61('0x64'))[_0xef61('0x6f')](_0xef61('0x63'))[_0xef61('0x3d')]('CampaignId\x20=\x20?',_0x5b86e4[_0xef61('0x4c')]['id']['toString']()))[_0xef61('0x3d')](_0xef61('0x75'),squel[_0xef61('0x69')]()[_0xef61('0x6a')](_0xef61('0x83'))[_0xef61('0x6f')](_0xef61('0x70'))[_0xef61('0x3d')]('CampaignId\x20=\x20?',_0x5b86e4[_0xef61('0x4c')]['id'][_0xef61('0x71')]())[_0xef61('0x3d')](_0xef61('0x77')))[_0xef61('0x78')](_0xef61('0x7d')))[_0xef61('0x71')]();return db[_0xef61('0x4f')][_0xef61('0x34')](_0x2cb8a8);}return[];})['then'](respondWithResult(_0x52f7c5,null))[_0xef61('0x45')](handleError(_0x52f7c5,null));};exports[_0xef61('0x84')]=function(_0x22006a,_0x317c4a,_0x5d8ee9){return db['CmHopper'][_0xef61('0x85')]({'where':{'VoiceQueueId':_0x22006a[_0xef61('0x4a')][_0xef61('0x66')],'CampaignId':_0x22006a[_0xef61('0x4a')][_0xef61('0x7e')],'ContactId':_0x22006a[_0xef61('0x4a')][_0xef61('0x7d')]}})['then'](handleEntityNotFound(_0x317c4a,null))[_0xef61('0x28')](function(_0x660c71){if(_0x660c71){return _0x660c71;}return null;})[_0xef61('0x28')](respondWithResult(_0x317c4a,null))[_0xef61('0x45')](handleError(_0x317c4a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 87fdf3e..609500e 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 _0x6652=['exports','CmHopperFinal','calleridnum','uniqueid','../../config/logger','moment','request-promise','path','../../config/environment','./cmHopperFinal.attributes'];(function(_0x620cbe,_0x193075){var _0x30ad91=function(_0x1478cc){while(--_0x1478cc){_0x620cbe['push'](_0x620cbe['shift']());}};_0x30ad91(++_0x193075);}(_0x6652,0x11c));var _0x2665=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6652[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2665('0x0'))('api');var moment=require(_0x2665('0x1'));var BPromise=require('bluebird');var rp=require(_0x2665('0x2'));var fs=require('fs');var path=require(_0x2665('0x3'));var rimraf=require('rimraf');var config=require(_0x2665('0x4'));var attributes=require(_0x2665('0x5'));module[_0x2665('0x6')]=function(_0x428c88,_0x2a751a){return _0x428c88['define'](_0x2665('0x7'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x2665('0x8'),'fields':[_0x2665('0x8')]},{'name':_0x2665('0x9'),'fields':[_0x2665('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x43d6=['moment','request-promise','path','rimraf','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','api'];(function(_0x561ad5,_0x9a5108){var _0x1c31b0=function(_0x287df4){while(--_0x287df4){_0x561ad5['push'](_0x561ad5['shift']());}};_0x1c31b0(++_0x9a5108);}(_0x43d6,0x1b7));var _0x643d=function(_0x108dc4,_0x560072){_0x108dc4=_0x108dc4-0x0;var _0x5ad20f=_0x43d6[_0x108dc4];return _0x5ad20f;};'use strict';var _=require(_0x643d('0x0'));var util=require(_0x643d('0x1'));var logger=require('../../config/logger')(_0x643d('0x2'));var moment=require(_0x643d('0x3'));var BPromise=require('bluebird');var rp=require(_0x643d('0x4'));var fs=require('fs');var path=require(_0x643d('0x5'));var rimraf=require(_0x643d('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0x643d('0x7')]=function(_0x22ba5e,_0x1d662f){return _0x22ba5e[_0x643d('0x8')](_0x643d('0x9'),attributes,{'tableName':_0x643d('0xa'),'paranoid':![],'indexes':[{'name':_0x643d('0xb'),'fields':['calleridnum']},{'name':_0x643d('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 8968719..9fd0456 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x571cdc,_0x57f256){var _0x43f762=function(_0x3d804a){while(--_0x3d804a){_0x571cdc['push'](_0x571cdc['shift']());}};_0x43f762(++_0x57f256);}(_0xb10b,0x12a));var _0xbb10=function(_0x3452c5,_0x11829a){_0x3452c5=_0x3452c5-0x0;var _0x3d2172=_0xb10b[_0x3452c5];return _0x3d2172;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _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(_0x2d9465,_0x17e92b){var _0x452c02=function(_0x7dbd7c){while(--_0x7dbd7c){_0x2d9465['push'](_0x2d9465['shift']());}};_0x452c02(++_0x17e92b);}(_0x7a54,0x106));var _0x47a5=function(_0x50bc96,_0xa0c190){_0x50bc96=_0x50bc96-0x0;var _0x507f03=_0x7a54[_0x50bc96];return _0x507f03;};'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 b378a58..4b5a027 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 _0x022b=['checkContactHopper','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper'];(function(_0x54ce45,_0x269ee8){var _0x252c2d=function(_0x9ea2ea){while(--_0x9ea2ea){_0x54ce45['push'](_0x54ce45['shift']());}};_0x252c2d(++_0x269ee8);}(_0x022b,0x1cb));var _0xb022=function(_0x3eb267,_0x441384){_0x3eb267=_0x3eb267-0x0;var _0x55b58f=_0x022b[_0x3eb267];return _0x55b58f;};'use strict';var multer=require('multer');var util=require(_0xb022('0x0'));var path=require(_0xb022('0x1'));var timeout=require(_0xb022('0x2'));var express=require(_0xb022('0x3'));var router=express[_0xb022('0x4')]();var fs_extra=require(_0xb022('0x5'));var auth=require(_0xb022('0x6'));var interaction=require(_0xb022('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xb022('0x8')]('/',auth[_0xb022('0x9')](),controller[_0xb022('0xa')]);router['get'](_0xb022('0xb'),auth[_0xb022('0x9')](),controller[_0xb022('0xc')]);router[_0xb022('0x8')](_0xb022('0xd'),auth[_0xb022('0x9')](),controller[_0xb022('0xe')]);router['get'](_0xb022('0xf'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0xb022('0x8')](_0xb022('0x10'),auth[_0xb022('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xb022('0x11')]('/voice/queue/moveContacts/:id',auth[_0xb022('0x9')](),controller[_0xb022('0x12')]);router['post'](_0xb022('0x13'),auth[_0xb022('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xb022('0x11')](_0xb022('0x14'),auth[_0xb022('0x9')](),controller[_0xb022('0x15')]);router['put'](_0xb022('0xd'),auth[_0xb022('0x9')](),controller[_0xb022('0x16')]);module[_0xb022('0x17')]=router; \ No newline at end of file +var _0x6811=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x263f1b,_0x52dd99){var _0x396b48=function(_0x228357){while(--_0x228357){_0x263f1b['push'](_0x263f1b['shift']());}};_0x396b48(++_0x52dd99);}(_0x6811,0x121));var _0x1681=function(_0x300a0a,_0x1653d4){_0x300a0a=_0x300a0a-0x0;var _0x28b718=_0x6811[_0x300a0a];return _0x28b718;};'use strict';var multer=require(_0x1681('0x0'));var util=require(_0x1681('0x1'));var path=require(_0x1681('0x2'));var timeout=require(_0x1681('0x3'));var express=require(_0x1681('0x4'));var router=express[_0x1681('0x5')]();var fs_extra=require(_0x1681('0x6'));var auth=require(_0x1681('0x7'));var interaction=require(_0x1681('0x8'));var config=require(_0x1681('0x9'));var controller=require('./cmHopperFinal.controller');router[_0x1681('0xa')]('/',auth['isAuthenticated'](),controller[_0x1681('0xb')]);router['get'](_0x1681('0xc'),auth[_0x1681('0xd')](),controller['describe']);router[_0x1681('0xa')](_0x1681('0xe'),auth['isAuthenticated'](),controller[_0x1681('0xf')]);router[_0x1681('0xa')]('/voice/queue/countAttributes/:id',auth[_0x1681('0xd')](),controller[_0x1681('0x10')]);router['get'](_0x1681('0x11'),auth[_0x1681('0xd')](),controller[_0x1681('0x12')]);router[_0x1681('0x13')]('/voice/queue/moveContacts/:id',auth[_0x1681('0xd')](),controller[_0x1681('0x14')]);router[_0x1681('0x13')](_0x1681('0x15'),auth[_0x1681('0xd')](),controller[_0x1681('0x16')]);router[_0x1681('0x13')](_0x1681('0x17'),auth[_0x1681('0xd')](),controller[_0x1681('0x18')]);router['put'](_0x1681('0xe'),auth['isAuthenticated'](),controller[_0x1681('0x19')]);module[_0x1681('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 6fbc007..0632aad 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 _0xf37c=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xf37c,0x1b7));var _0xcf37=function(_0x51bb4d,_0x43d5d8){_0x51bb4d=_0x51bb4d-0x0;var _0x394bd2=_0xf37c[_0x51bb4d];return _0x394bd2;};'use strict';var Sequelize=require(_0xcf37('0x0'));module[_0xcf37('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xcf37('0x2')]},'scheduledat':{'type':Sequelize[_0xcf37('0x3')]},'countbusyretry':{'type':Sequelize[_0xcf37('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcf37('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xcf37('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xcf37('0x2')]},'calleridnum':{'type':Sequelize[_0xcf37('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xcf37('0x3')]},'responsetime':{'type':Sequelize[_0xcf37('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xcf37('0x3')]},'endtime':{'type':Sequelize[_0xcf37('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xcf37('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xcf37('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xcf37('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcf37('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xcf37('0x2')]},'membername':{'type':Sequelize[_0xcf37('0x2')]},'reason':{'type':Sequelize[_0xcf37('0x2')]},'amd':{'type':Sequelize[_0xcf37('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xcf37('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcf37('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcf37('0x3')]},'recallme':{'type':Sequelize[_0xcf37('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xcf37('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcf37('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcf37('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcf37('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcf37('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x87a1=['BOOLEAN','sequelize','STRING','DATE','INTEGER'];(function(_0x2cc894,_0x33e887){var _0x300a1b=function(_0x485060){while(--_0x485060){_0x2cc894['push'](_0x2cc894['shift']());}};_0x300a1b(++_0x33e887);}(_0x87a1,0xce));var _0x187a=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x87a1[_0xb0f7c3];return _0x28ea68;};'use strict';var Sequelize=require(_0x187a('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x187a('0x1')]},'scheduledat':{'type':Sequelize[_0x187a('0x2')]},'countbusyretry':{'type':Sequelize[_0x187a('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x187a('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x187a('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x187a('0x1')]},'originatecalleridname':{'type':Sequelize[_0x187a('0x1')]},'calleridnum':{'type':Sequelize[_0x187a('0x1')]},'calleridname':{'type':Sequelize[_0x187a('0x1')]},'starttime':{'type':Sequelize[_0x187a('0x2')]},'responsetime':{'type':Sequelize[_0x187a('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x187a('0x2')]},'endtime':{'type':Sequelize[_0x187a('0x2')]},'ringtime':{'type':Sequelize[_0x187a('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x187a('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x187a('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x187a('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x187a('0x1')]},'campaign':{'type':Sequelize[_0x187a('0x1')]},'campaigntype':{'type':Sequelize[_0x187a('0x1')]},'membername':{'type':Sequelize[_0x187a('0x1')]},'reason':{'type':Sequelize[_0x187a('0x1')]},'amd':{'type':Sequelize[_0x187a('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x187a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x187a('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x187a('0x2')]},'recallme':{'type':Sequelize[_0x187a('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x187a('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x187a('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x187a('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x187a('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x187a('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 905c158..2a30271 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 _0x0430=['then','destroy','error','send','index','map','CmHopperHistory','rawAttributes','type','name','query','keys','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','params','fields','options','find','create','body','catch','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update'];(function(_0x13452f,_0x71c9fc){var _0x3449e6=function(_0x5582f0){while(--_0x5582f0){_0x13452f['push'](_0x13452f['shift']());}};_0x3449e6(++_0x71c9fc);}(_0x0430,0x152));var _0x0043=function(_0x5c2a03,_0x537e2e){_0x5c2a03=_0x5c2a03-0x0;var _0x43568b=_0x0430[_0x5c2a03];return _0x43568b;};'use strict';var emlformat=require(_0x0043('0x0'));var rimraf=require(_0x0043('0x1'));var zipdir=require(_0x0043('0x2'));var jsonpatch=require(_0x0043('0x3'));var rp=require(_0x0043('0x4'));var moment=require(_0x0043('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0043('0x6'));var util=require(_0x0043('0x7'));var path=require('path');var sox=require(_0x0043('0x8'));var csv=require('to-csv');var ejs=require(_0x0043('0x9'));var fs=require('fs');var fs_extra=require(_0x0043('0xa'));var _=require(_0x0043('0xb'));var squel=require(_0x0043('0xc'));var crypto=require('crypto');var jsforce=require(_0x0043('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0043('0xe'));var querystring=require('querystring');var Papa=require(_0x0043('0xf'));var Redis=require(_0x0043('0x10'));var authService=require(_0x0043('0x11'));var qs=require(_0x0043('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0043('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x0043('0x14'));var config=require(_0x0043('0x15'));var licenseUtil=require(_0x0043('0x16'));var db=require(_0x0043('0x17'))['db'];function respondWithStatusCode(_0x5aeaec,_0x1e4bfc){_0x1e4bfc=_0x1e4bfc||0xcc;return function(_0x42c0db){if(_0x42c0db){return _0x5aeaec[_0x0043('0x18')](_0x1e4bfc);}return _0x5aeaec[_0x0043('0x19')](_0x1e4bfc)[_0x0043('0x1a')]();};}function respondWithResult(_0x59c168,_0x4af3a2){_0x4af3a2=_0x4af3a2||0xc8;return function(_0x29e70e){if(_0x29e70e){return _0x59c168[_0x0043('0x19')](_0x4af3a2)[_0x0043('0x1b')](_0x29e70e);}};}function respondWithFilteredResult(_0x2c7ec1,_0x3f0cc8){return function(_0x3d7464){if(_0x3d7464){var _0x1cdc1b=typeof _0x3f0cc8[_0x0043('0x1c')]===_0x0043('0x1d')&&typeof _0x3f0cc8[_0x0043('0x1e')]==='undefined';var _0x3cfd61=_0x3d7464[_0x0043('0x1f')];var _0x3c439d=_0x1cdc1b?0x0:_0x3f0cc8[_0x0043('0x1c')];var _0x47b806=_0x1cdc1b?_0x3d7464[_0x0043('0x1f')]:_0x3f0cc8[_0x0043('0x1c')]+_0x3f0cc8[_0x0043('0x1e')];var _0x21092e;if(_0x47b806>=_0x3cfd61){_0x47b806=_0x3cfd61;_0x21092e=0xc8;}else{_0x21092e=0xce;}_0x2c7ec1[_0x0043('0x19')](_0x21092e);return _0x2c7ec1[_0x0043('0x20')](_0x0043('0x21'),_0x3c439d+'-'+_0x47b806+'/'+_0x3cfd61)[_0x0043('0x1b')](_0x3d7464);}return null;};}function patchUpdates(_0x44b85f){return function(_0x18408c){try{jsonpatch[_0x0043('0x22')](_0x18408c,_0x44b85f,!![]);}catch(_0x2b8a97){return BPromise['reject'](_0x2b8a97);}return _0x18408c[_0x0043('0x23')]();};}function saveUpdates(_0x1b1e9d,_0x1a41bd){return function(_0x3ffa4e){if(_0x3ffa4e){return _0x3ffa4e[_0x0043('0x24')](_0x1b1e9d)[_0x0043('0x25')](function(_0x4c5fe9){return _0x4c5fe9;});}return null;};}function removeEntity(_0x3efa67,_0xaff182){return function(_0x576fdb){if(_0x576fdb){return _0x576fdb[_0x0043('0x26')]()[_0x0043('0x25')](function(){_0x3efa67['status'](0xcc)[_0x0043('0x1a')]();});}};}function handleEntityNotFound(_0x508e7e,_0x3937f7){return function(_0x50b5a1){if(!_0x50b5a1){_0x508e7e[_0x0043('0x18')](0x194);}return _0x50b5a1;};}function handleError(_0x3b6938,_0x170af8){_0x170af8=_0x170af8||0x1f4;return function(_0x1edc8a){logger[_0x0043('0x27')](_0x1edc8a['stack']);if(_0x1edc8a['name']){delete _0x1edc8a['name'];}_0x3b6938[_0x0043('0x19')](_0x170af8)[_0x0043('0x28')](_0x1edc8a);};}exports[_0x0043('0x29')]=function(_0x3f7c8e,_0x2745de){var _0x202592={},_0x1fcd5d={},_0x336f9b={'count':0x0,'rows':[]};var _0x443145=_[_0x0043('0x2a')](db[_0x0043('0x2b')][_0x0043('0x2c')],function(_0x4cac3d){return{'name':_0x4cac3d['fieldName'],'type':_0x4cac3d[_0x0043('0x2d')]['key']};});_0x1fcd5d['model']=_[_0x0043('0x2a')](_0x443145,_0x0043('0x2e'));_0x1fcd5d[_0x0043('0x2f')]=_[_0x0043('0x30')](_0x3f7c8e[_0x0043('0x2f')]);_0x1fcd5d[_0x0043('0x31')]=_[_0x0043('0x32')](_0x1fcd5d['model'],_0x1fcd5d['query']);_0x202592[_0x0043('0x33')]=_[_0x0043('0x32')](_0x1fcd5d[_0x0043('0x34')],qs['fields'](_0x3f7c8e[_0x0043('0x2f')]['fields']));_0x202592[_0x0043('0x33')]=_0x202592[_0x0043('0x33')][_0x0043('0x35')]?_0x202592[_0x0043('0x33')]:_0x1fcd5d[_0x0043('0x34')];if(!_0x3f7c8e[_0x0043('0x2f')][_0x0043('0x36')](_0x0043('0x37'))){_0x202592[_0x0043('0x1e')]=qs['limit'](_0x3f7c8e['query'][_0x0043('0x1e')]);_0x202592[_0x0043('0x1c')]=qs[_0x0043('0x1c')](_0x3f7c8e[_0x0043('0x2f')][_0x0043('0x1c')]);}_0x202592[_0x0043('0x38')]=qs['sort'](_0x3f7c8e[_0x0043('0x2f')][_0x0043('0x39')]);_0x202592[_0x0043('0x3a')]=qs[_0x0043('0x31')](_[_0x0043('0x3b')](_0x3f7c8e[_0x0043('0x2f')],_0x1fcd5d[_0x0043('0x31')]),_0x443145);if(_0x3f7c8e[_0x0043('0x2f')]['filter']){_0x202592[_0x0043('0x3a')]=_[_0x0043('0x3c')](_0x202592[_0x0043('0x3a')],{'$or':_[_0x0043('0x2a')](_0x443145,function(_0xcc368b){if(_0xcc368b[_0x0043('0x2d')]!==_0x0043('0x3d')){var _0x11cdf9={};_0x11cdf9[_0xcc368b[_0x0043('0x2e')]]={'$like':'%'+_0x3f7c8e[_0x0043('0x2f')][_0x0043('0x3e')]+'%'};return _0x11cdf9;}})});}_0x202592=_[_0x0043('0x3c')]({},_0x202592,_0x3f7c8e['options']);var _0x138b13={'where':_0x202592[_0x0043('0x3a')]};return db[_0x0043('0x2b')]['count'](_0x138b13)[_0x0043('0x25')](function(_0x13da24){_0x336f9b[_0x0043('0x1f')]=_0x13da24;if(_0x3f7c8e[_0x0043('0x2f')][_0x0043('0x3f')]){_0x202592['include']=[{'all':!![]}];}return db[_0x0043('0x2b')][_0x0043('0x40')](_0x202592);})[_0x0043('0x25')](function(_0x1cd3e4){_0x336f9b[_0x0043('0x41')]=_0x1cd3e4;return _0x336f9b;})[_0x0043('0x25')](respondWithFilteredResult(_0x2745de,_0x202592))['catch'](handleError(_0x2745de,null));};exports['show']=function(_0x50eb20,_0xee91e7){var _0x970f98={'raw':!![],'where':{'id':_0x50eb20[_0x0043('0x42')]['id']}},_0x349ba9={};_0x349ba9['model']=_[_0x0043('0x30')](db['CmHopperHistory'][_0x0043('0x2c')]);_0x349ba9[_0x0043('0x2f')]=_['keys'](_0x50eb20[_0x0043('0x2f')]);_0x349ba9[_0x0043('0x31')]=_[_0x0043('0x32')](_0x349ba9[_0x0043('0x34')],_0x349ba9[_0x0043('0x2f')]);_0x970f98[_0x0043('0x33')]=_['intersection'](_0x349ba9[_0x0043('0x34')],qs[_0x0043('0x43')](_0x50eb20[_0x0043('0x2f')][_0x0043('0x43')]));_0x970f98[_0x0043('0x33')]=_0x970f98[_0x0043('0x33')][_0x0043('0x35')]?_0x970f98[_0x0043('0x33')]:_0x349ba9['model'];if(_0x50eb20['query'][_0x0043('0x3f')]){_0x970f98['include']=[{'all':!![]}];}_0x970f98=_[_0x0043('0x3c')]({},_0x970f98,_0x50eb20[_0x0043('0x44')]);return db[_0x0043('0x2b')][_0x0043('0x45')](_0x970f98)[_0x0043('0x25')](handleEntityNotFound(_0xee91e7,null))[_0x0043('0x25')](respondWithResult(_0xee91e7,null))['catch'](handleError(_0xee91e7,null));};exports[_0x0043('0x46')]=function(_0x539c1e,_0x2a0ab4){return db[_0x0043('0x2b')][_0x0043('0x46')](_0x539c1e[_0x0043('0x47')],{})['then'](respondWithResult(_0x2a0ab4,0xc9))[_0x0043('0x48')](handleError(_0x2a0ab4,null));};exports[_0x0043('0x49')]=function(_0xfe6a2e,_0xe3b3f0){return db['CmHopperHistory'][_0x0043('0x49')]()[_0x0043('0x25')](respondWithResult(_0xe3b3f0,null))[_0x0043('0x48')](handleError(_0xe3b3f0,null));};exports[_0x0043('0x24')]=function(_0x27a937,_0x23c2d1){if(_0x27a937[_0x0043('0x47')][_0x0043('0x4a')]){delete _0x27a937[_0x0043('0x47')]['uniqueid'];}return db[_0x0043('0x2b')][_0x0043('0x45')]({'where':{'uniqueid':_0x27a937[_0x0043('0x42')]['id']}})[_0x0043('0x25')](handleEntityNotFound(_0x23c2d1,null))[_0x0043('0x25')](saveUpdates(_0x27a937[_0x0043('0x47')],null))[_0x0043('0x25')](respondWithResult(_0x23c2d1,null))[_0x0043('0x48')](handleError(_0x23c2d1,null));}; \ No newline at end of file +var _0x0a65=['create','body','describe','update','uniqueid','params','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../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','then','destroy','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','CmHopperHistory','includeAll','include','rows','catch','options','find'];(function(_0xa0e0af,_0x47846c){var _0x5b4817=function(_0x5f3b86){while(--_0x5f3b86){_0xa0e0af['push'](_0xa0e0af['shift']());}};_0x5b4817(++_0x47846c);}(_0x0a65,0x96));var _0x50a6=function(_0x31f703,_0x2e0c5a){_0x31f703=_0x31f703-0x0;var _0x438149=_0x0a65[_0x31f703];return _0x438149;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x50a6('0x0'));var zipdir=require(_0x50a6('0x1'));var jsonpatch=require(_0x50a6('0x2'));var rp=require(_0x50a6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x50a6('0x4'));var util=require(_0x50a6('0x5'));var path=require(_0x50a6('0x6'));var sox=require('sox');var csv=require(_0x50a6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x50a6('0x8'));var _=require(_0x50a6('0x9'));var squel=require(_0x50a6('0xa'));var crypto=require(_0x50a6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x50a6('0xc'));var toCsv=require(_0x50a6('0x7'));var querystring=require(_0x50a6('0xd'));var Papa=require('papaparse');var Redis=require(_0x50a6('0xe'));var authService=require(_0x50a6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x50a6('0x10'));var hardwareService=require(_0x50a6('0x11'));var logger=require(_0x50a6('0x12'))('api');var utils=require(_0x50a6('0x13'));var config=require(_0x50a6('0x14'));var licenseUtil=require(_0x50a6('0x15'));var db=require(_0x50a6('0x16'))['db'];function respondWithStatusCode(_0x3f9e8b,_0x451f33){_0x451f33=_0x451f33||0xcc;return function(_0x15ee40){if(_0x15ee40){return _0x3f9e8b[_0x50a6('0x17')](_0x451f33);}return _0x3f9e8b[_0x50a6('0x18')](_0x451f33)[_0x50a6('0x19')]();};}function respondWithResult(_0x5d4b73,_0x1bde43){_0x1bde43=_0x1bde43||0xc8;return function(_0x2738c2){if(_0x2738c2){return _0x5d4b73[_0x50a6('0x18')](_0x1bde43)[_0x50a6('0x1a')](_0x2738c2);}};}function respondWithFilteredResult(_0x128b2b,_0x3ec020){return function(_0x3b5ddd){if(_0x3b5ddd){var _0x33310c=typeof _0x3ec020[_0x50a6('0x1b')]===_0x50a6('0x1c')&&typeof _0x3ec020[_0x50a6('0x1d')]===_0x50a6('0x1c');var _0x1b1fa3=_0x3b5ddd[_0x50a6('0x1e')];var _0x28d00f=_0x33310c?0x0:_0x3ec020['offset'];var _0x5c2c3f=_0x33310c?_0x3b5ddd['count']:_0x3ec020[_0x50a6('0x1b')]+_0x3ec020['limit'];var _0x372dd5;if(_0x5c2c3f>=_0x1b1fa3){_0x5c2c3f=_0x1b1fa3;_0x372dd5=0xc8;}else{_0x372dd5=0xce;}_0x128b2b['status'](_0x372dd5);return _0x128b2b[_0x50a6('0x1f')](_0x50a6('0x20'),_0x28d00f+'-'+_0x5c2c3f+'/'+_0x1b1fa3)[_0x50a6('0x1a')](_0x3b5ddd);}return null;};}function patchUpdates(_0x42c02e){return function(_0x3e60df){try{jsonpatch[_0x50a6('0x21')](_0x3e60df,_0x42c02e,!![]);}catch(_0x4c770e){return BPromise['reject'](_0x4c770e);}return _0x3e60df['save']();};}function saveUpdates(_0x167063,_0x36c243){return function(_0x5be585){if(_0x5be585){return _0x5be585['update'](_0x167063)[_0x50a6('0x22')](function(_0x191ce7){return _0x191ce7;});}return null;};}function removeEntity(_0x240976,_0x65130){return function(_0x500f8a){if(_0x500f8a){return _0x500f8a[_0x50a6('0x23')]()[_0x50a6('0x22')](function(){_0x240976['status'](0xcc)[_0x50a6('0x19')]();});}};}function handleEntityNotFound(_0x230396,_0x504db7){return function(_0x4dada4){if(!_0x4dada4){_0x230396[_0x50a6('0x17')](0x194);}return _0x4dada4;};}function handleError(_0x153d6f,_0x17bd92){_0x17bd92=_0x17bd92||0x1f4;return function(_0x23a9ca){logger[_0x50a6('0x24')](_0x23a9ca[_0x50a6('0x25')]);if(_0x23a9ca[_0x50a6('0x26')]){delete _0x23a9ca[_0x50a6('0x26')];}_0x153d6f[_0x50a6('0x18')](_0x17bd92)[_0x50a6('0x27')](_0x23a9ca);};}exports[_0x50a6('0x28')]=function(_0x2698e8,_0x1535d8){var _0x5b42e6={},_0x5a5ae3={},_0x352b0d={'count':0x0,'rows':[]};var _0x59e480=_[_0x50a6('0x29')](db['CmHopperHistory']['rawAttributes'],function(_0x1b73c6){return{'name':_0x1b73c6['fieldName'],'type':_0x1b73c6[_0x50a6('0x2a')][_0x50a6('0x2b')]};});_0x5a5ae3[_0x50a6('0x2c')]=_[_0x50a6('0x29')](_0x59e480,_0x50a6('0x26'));_0x5a5ae3[_0x50a6('0x2d')]=_[_0x50a6('0x2e')](_0x2698e8[_0x50a6('0x2d')]);_0x5a5ae3[_0x50a6('0x2f')]=_[_0x50a6('0x30')](_0x5a5ae3[_0x50a6('0x2c')],_0x5a5ae3['query']);_0x5b42e6[_0x50a6('0x31')]=_['intersection'](_0x5a5ae3['model'],qs[_0x50a6('0x32')](_0x2698e8[_0x50a6('0x2d')][_0x50a6('0x32')]));_0x5b42e6['attributes']=_0x5b42e6[_0x50a6('0x31')]['length']?_0x5b42e6[_0x50a6('0x31')]:_0x5a5ae3[_0x50a6('0x2c')];if(!_0x2698e8[_0x50a6('0x2d')][_0x50a6('0x33')](_0x50a6('0x34'))){_0x5b42e6[_0x50a6('0x1d')]=qs[_0x50a6('0x1d')](_0x2698e8[_0x50a6('0x2d')]['limit']);_0x5b42e6[_0x50a6('0x1b')]=qs[_0x50a6('0x1b')](_0x2698e8[_0x50a6('0x2d')][_0x50a6('0x1b')]);}_0x5b42e6[_0x50a6('0x35')]=qs[_0x50a6('0x36')](_0x2698e8[_0x50a6('0x2d')][_0x50a6('0x36')]);_0x5b42e6[_0x50a6('0x37')]=qs[_0x50a6('0x2f')](_[_0x50a6('0x38')](_0x2698e8[_0x50a6('0x2d')],_0x5a5ae3['filters']),_0x59e480);if(_0x2698e8[_0x50a6('0x2d')][_0x50a6('0x39')]){_0x5b42e6[_0x50a6('0x37')]=_[_0x50a6('0x3a')](_0x5b42e6[_0x50a6('0x37')],{'$or':_[_0x50a6('0x29')](_0x59e480,function(_0x2fc18b){if(_0x2fc18b[_0x50a6('0x2a')]!=='VIRTUAL'){var _0x50f89d={};_0x50f89d[_0x2fc18b[_0x50a6('0x26')]]={'$like':'%'+_0x2698e8['query'][_0x50a6('0x39')]+'%'};return _0x50f89d;}})});}_0x5b42e6=_[_0x50a6('0x3a')]({},_0x5b42e6,_0x2698e8['options']);var _0x566fd9={'where':_0x5b42e6['where']};return db[_0x50a6('0x3b')][_0x50a6('0x1e')](_0x566fd9)['then'](function(_0x2431b5){_0x352b0d['count']=_0x2431b5;if(_0x2698e8[_0x50a6('0x2d')][_0x50a6('0x3c')]){_0x5b42e6[_0x50a6('0x3d')]=[{'all':!![]}];}return db[_0x50a6('0x3b')]['findAll'](_0x5b42e6);})[_0x50a6('0x22')](function(_0x2e8cc9){_0x352b0d[_0x50a6('0x3e')]=_0x2e8cc9;return _0x352b0d;})['then'](respondWithFilteredResult(_0x1535d8,_0x5b42e6))[_0x50a6('0x3f')](handleError(_0x1535d8,null));};exports['show']=function(_0x387277,_0x53678f){var _0x28f48c={'raw':!![],'where':{'id':_0x387277['params']['id']}},_0x43a8da={};_0x43a8da[_0x50a6('0x2c')]=_['keys'](db[_0x50a6('0x3b')]['rawAttributes']);_0x43a8da[_0x50a6('0x2d')]=_[_0x50a6('0x2e')](_0x387277[_0x50a6('0x2d')]);_0x43a8da[_0x50a6('0x2f')]=_['intersection'](_0x43a8da[_0x50a6('0x2c')],_0x43a8da[_0x50a6('0x2d')]);_0x28f48c['attributes']=_[_0x50a6('0x30')](_0x43a8da[_0x50a6('0x2c')],qs[_0x50a6('0x32')](_0x387277[_0x50a6('0x2d')][_0x50a6('0x32')]));_0x28f48c[_0x50a6('0x31')]=_0x28f48c[_0x50a6('0x31')]['length']?_0x28f48c[_0x50a6('0x31')]:_0x43a8da['model'];if(_0x387277[_0x50a6('0x2d')][_0x50a6('0x3c')]){_0x28f48c[_0x50a6('0x3d')]=[{'all':!![]}];}_0x28f48c=_[_0x50a6('0x3a')]({},_0x28f48c,_0x387277[_0x50a6('0x40')]);return db[_0x50a6('0x3b')][_0x50a6('0x41')](_0x28f48c)[_0x50a6('0x22')](handleEntityNotFound(_0x53678f,null))[_0x50a6('0x22')](respondWithResult(_0x53678f,null))[_0x50a6('0x3f')](handleError(_0x53678f,null));};exports[_0x50a6('0x42')]=function(_0xa31488,_0x4c2d76){return db[_0x50a6('0x3b')][_0x50a6('0x42')](_0xa31488[_0x50a6('0x43')],{})[_0x50a6('0x22')](respondWithResult(_0x4c2d76,0xc9))[_0x50a6('0x3f')](handleError(_0x4c2d76,null));};exports[_0x50a6('0x44')]=function(_0x246f41,_0x4058e1){return db[_0x50a6('0x3b')][_0x50a6('0x44')]()[_0x50a6('0x22')](respondWithResult(_0x4058e1,null))[_0x50a6('0x3f')](handleError(_0x4058e1,null));};exports[_0x50a6('0x45')]=function(_0x2f92d5,_0x319b7a){if(_0x2f92d5['body'][_0x50a6('0x46')]){delete _0x2f92d5[_0x50a6('0x43')][_0x50a6('0x46')];}return db[_0x50a6('0x3b')][_0x50a6('0x41')]({'where':{'uniqueid':_0x2f92d5[_0x50a6('0x47')]['id']}})[_0x50a6('0x22')](handleEntityNotFound(_0x319b7a,null))[_0x50a6('0x22')](saveUpdates(_0x2f92d5[_0x50a6('0x43')],null))[_0x50a6('0x22')](respondWithResult(_0x319b7a,null))['catch'](handleError(_0x319b7a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index bb357cb..3aa8abe 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 _0xe1c4=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x561661,_0x4ec0db){var _0x1b766b=function(_0x50d8b6){while(--_0x50d8b6){_0x561661['push'](_0x561661['shift']());}};_0x1b766b(++_0x4ec0db);}(_0xe1c4,0x1ec));var _0x4e1c=function(_0x22d670,_0x2611ef){_0x22d670=_0x22d670-0x0;var _0x21ef8f=_0xe1c4[_0x22d670];return _0x21ef8f;};'use strict';var _=require(_0x4e1c('0x0'));var util=require(_0x4e1c('0x1'));var logger=require(_0x4e1c('0x2'))('api');var moment=require('moment');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('./cmHopperHistory.attributes');module['exports']=function(_0x7af82a,_0x119617){return _0x7af82a[_0x4e1c('0x7')](_0x4e1c('0x8'),attributes,{'tableName':_0x4e1c('0x9'),'paranoid':![],'indexes':[{'name':_0x4e1c('0xa'),'fields':[_0x4e1c('0xa')]},{'name':_0x4e1c('0xb'),'fields':[_0x4e1c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xee9c=['endtime','uniqueid','util','../../config/logger','api','moment','path','rimraf','exports','define','CmHopperHistory'];(function(_0x5c8cdf,_0x52c442){var _0x34f979=function(_0x35ceb1){while(--_0x35ceb1){_0x5c8cdf['push'](_0x5c8cdf['shift']());}};_0x34f979(++_0x52c442);}(_0xee9c,0x1e6));var _0xcee9=function(_0x2998db,_0x3424f1){_0x2998db=_0x2998db-0x0;var _0x115fea=_0xee9c[_0x2998db];return _0x115fea;};'use strict';var _=require('lodash');var util=require(_0xcee9('0x0'));var logger=require(_0xcee9('0x1'))(_0xcee9('0x2'));var moment=require(_0xcee9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcee9('0x4'));var rimraf=require(_0xcee9('0x5'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0xcee9('0x6')]=function(_0x547ea0,_0x2e438b){return _0x547ea0[_0xcee9('0x7')](_0xcee9('0x8'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0xcee9('0x9')]},{'name':_0xcee9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index ddee21f..d6a1be8 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 _0xb58b=['CmHopperHistory','create','body','options','raw','debug','catch','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperHistory'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb58b,0x1f1));var _0xbb58=function(_0x3ce130,_0x1054c6){_0x3ce130=_0x3ce130-0x0;var _0x39c52f=_0xb58b[_0x3ce130];return _0x39c52f;};'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']('CmHopperHistory,\x20%s,\x20%s',_0x323066,_0xbb58('0xd'));_0x5d7fe8(_0x36ca50[_0xbb58('0x13')][_0xbb58('0x12')]);}})['catch'](function(_0x5edc97){logger['error']('CmHopperHistory,\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')](_0x3134ea[_0xbb58('0x17')],{'raw':_0x3134ea[_0xbb58('0x18')]?_0x3134ea[_0xbb58('0x18')][_0xbb58('0x19')]===undefined?!![]:![]:!![]})[_0xbb58('0xa')](function(_0x497fd0){logger[_0xbb58('0xb')](_0xbb58('0x14'),_0x3134ea);logger[_0xbb58('0x1a')](_0xbb58('0x14'),_0x3134ea,JSON[_0xbb58('0xf')](_0x497fd0));_0xbee66(_0x497fd0);})[_0xbb58('0x1b')](function(_0x49453a){logger[_0xbb58('0x10')](_0xbb58('0x14'),_0x49453a['message'],_0x3134ea);_0x497653(_0x48f3e0[_0xbb58('0x10')](0x1f4,_0x49453a['message']));});});};exports[_0xbb58('0x1c')]=function(_0x287822){var _0x152f22=this;return new Promise(function(_0x3e215c,_0x2d111c){return db[_0xbb58('0x15')][_0xbb58('0x1d')]({'raw':_0x287822[_0xbb58('0x18')]?_0x287822['options'][_0xbb58('0x19')]===undefined?!![]:![]:!![],'where':_0x287822[_0xbb58('0x18')]?_0x287822[_0xbb58('0x18')][_0xbb58('0x1e')]||null:null,'attributes':[[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')][_0xbb58('0x21')]('id')),_0xbb58('0x22')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x24')))),'predictiveIntervalAnsweredCalls'],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x25')))),_0xbb58('0x26')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db['sequelize']['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x27')))),_0xbb58('0x28')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x29'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x2a')))),_0xbb58('0x2b')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x29'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xbb58('0x2c')))),_0xbb58('0x2d')]]})[_0xbb58('0xa')](function(_0x3c7627){logger[_0xbb58('0xb')](_0xbb58('0x1c'),_0x287822);logger[_0xbb58('0x1a')](_0xbb58('0x1c'),_0x287822,JSON['stringify'](_0x3c7627));_0x3e215c(_0x3c7627);})[_0xbb58('0x1b')](function(_0x230859){logger['error'](_0xbb58('0x1c'),_0x230859['message'],_0x287822);_0x2d111c(_0x152f22[_0xbb58('0x10')](0x1f4,_0x230859['message']));});});};exports[_0xbb58('0x2e')]=function(_0x36c7b4){var _0x52f4af=this;return new Promise(function(_0x3d3aee,_0x300c7b){return db[_0xbb58('0x15')][_0xbb58('0x1d')]({'raw':_0x36c7b4[_0xbb58('0x18')]?_0x36c7b4[_0xbb58('0x18')][_0xbb58('0x19')]===undefined?!![]:![]:!![],'where':_0x36c7b4[_0xbb58('0x18')]?_0x36c7b4['options'][_0xbb58('0x1e')]||null:null,'attributes':[[_0xbb58('0x2f'),_0xbb58('0x30')],[db['sequelize']['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db['sequelize'][_0xbb58('0x23')](_0xbb58('0x31')))),_0xbb58('0x32')],[db['sequelize']['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x33')))),_0xbb58('0x34')],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x24')))),_0xbb58('0x35')],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db['sequelize'][_0xbb58('0x23')](_0xbb58('0x36')))),_0xbb58('0x37')],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x38')))),'outboundCongestionCallsDay'],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x39')))),_0xbb58('0x3a')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x3b')))),_0xbb58('0x3c')],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xbb58('0x3d')))),_0xbb58('0x3e')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x3f')))),_0xbb58('0x40')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db['sequelize']['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')]('`state`\x20=\x2014,\x201,\x20null'))),_0xbb58('0x41')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db['sequelize'][_0xbb58('0x23')]('`state`\x20=\x2018,\x201,\x20null'))),_0xbb58('0x42')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db['sequelize']['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')]('`state`\x20=\x2016,\x201,\x20null'))),_0xbb58('0x43')],[db['sequelize']['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x44')))),_0xbb58('0x42')],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')]['literal'](_0xbb58('0x45')))),_0xbb58('0x46')]],'group':['campaign']})[_0xbb58('0xa')](function(_0x44636b){logger[_0xbb58('0xb')]('GetVoiceQueueHopperHistory',_0x36c7b4);logger[_0xbb58('0x1a')](_0xbb58('0x2e'),_0x36c7b4,JSON[_0xbb58('0xf')](_0x44636b));_0x3d3aee(_0x44636b);})['catch'](function(_0x537ed5){logger['error'](_0xbb58('0x2e'),_0x537ed5[_0xbb58('0x12')],_0x36c7b4);_0x300c7b(_0x52f4af[_0xbb58('0x10')](0x1f4,_0x537ed5['message']));});});};exports['GetCampaignHopperHistory']=function(_0x1573d1){var _0x40c55d=this;return new Promise(function(_0x37bb99,_0x23ed08){return db[_0xbb58('0x15')]['findAll']({'raw':_0x1573d1[_0xbb58('0x18')]?_0x1573d1[_0xbb58('0x18')][_0xbb58('0x19')]===undefined?!![]:![]:!![],'where':_0x1573d1['options']?_0x1573d1[_0xbb58('0x18')][_0xbb58('0x1e')]||null:null,'attributes':[[_0xbb58('0x2f'),_0xbb58('0x30')],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')][_0xbb58('0x21')]('id')),_0xbb58('0x47')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0xbb58('0x48')]],'group':['campaign']})[_0xbb58('0xa')](function(_0x29c28b){logger[_0xbb58('0xb')](_0xbb58('0x49'),_0x1573d1);logger[_0xbb58('0x1a')](_0xbb58('0x49'),_0x1573d1,JSON[_0xbb58('0xf')](_0x29c28b));_0x37bb99(_0x29c28b);})[_0xbb58('0x1b')](function(_0x19ef37){logger[_0xbb58('0x10')](_0xbb58('0x49'),_0x19ef37['message'],_0x1573d1);_0x23ed08(_0x40c55d[_0xbb58('0x10')](0x1f4,_0x19ef37[_0xbb58('0x12')]));});});}; \ No newline at end of file +var _0x0962=['then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','debug','stringify','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','where','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x5b28c2,_0x808665){var _0x15d58d=function(_0x208c3a){while(--_0x208c3a){_0x5b28c2['push'](_0x5b28c2['shift']());}};_0x15d58d(++_0x808665);}(_0x0962,0x198));var _0x2096=function(_0x13b368,_0x37d457){_0x13b368=_0x13b368-0x0;var _0x4c0748=_0x0962[_0x13b368];return _0x4c0748;};'use strict';var _=require(_0x2096('0x0'));var util=require(_0x2096('0x1'));var moment=require(_0x2096('0x2'));var BPromise=require(_0x2096('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2096('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2096('0x5'))(_0x2096('0x6'));var config=require(_0x2096('0x7'));var jayson=require(_0x2096('0x8'));var client=jayson[_0x2096('0x9')][_0x2096('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x130711,_0x39471c,_0x4b5f76){return new BPromise(function(_0x16799f,_0x10b0e7){return client[_0x2096('0xb')](_0x130711,_0x4b5f76)[_0x2096('0xc')](function(_0x2f49bf){logger[_0x2096('0xd')](_0x2096('0xe'),_0x39471c,_0x2096('0xf'));logger['debug'](_0x2096('0x10'),_0x39471c,_0x2096('0xf'),JSON['stringify'](_0x2f49bf));if(_0x2f49bf[_0x2096('0x11')]){if(_0x2f49bf[_0x2096('0x11')][_0x2096('0x12')]===0x1f4){logger[_0x2096('0x11')](_0x2096('0xe'),_0x39471c,_0x2f49bf['error'][_0x2096('0x13')]);return _0x10b0e7(_0x2f49bf[_0x2096('0x11')][_0x2096('0x13')]);}logger['error'](_0x2096('0xe'),_0x39471c,_0x2f49bf[_0x2096('0x11')][_0x2096('0x13')]);return _0x16799f(_0x2f49bf['error'][_0x2096('0x13')]);}else{logger[_0x2096('0xd')](_0x2096('0xe'),_0x39471c,_0x2096('0xf'));_0x16799f(_0x2f49bf['result'][_0x2096('0x13')]);}})[_0x2096('0x14')](function(_0x1ffbb8){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x39471c,_0x1ffbb8);_0x10b0e7(_0x1ffbb8);});});}exports[_0x2096('0x15')]=function(_0x22c478){var _0x4e4dc2=this;return new Promise(function(_0xd7e9e0,_0x2b7da7){return db[_0x2096('0x16')]['create'](_0x22c478[_0x2096('0x17')],{'raw':_0x22c478['options']?_0x22c478[_0x2096('0x18')][_0x2096('0x19')]===undefined?!![]:![]:!![]})[_0x2096('0xc')](function(_0x12fe63){logger[_0x2096('0xd')](_0x2096('0x15'),_0x22c478);logger[_0x2096('0x1a')](_0x2096('0x15'),_0x22c478,JSON[_0x2096('0x1b')](_0x12fe63));_0xd7e9e0(_0x12fe63);})['catch'](function(_0x40f28c){logger['error'](_0x2096('0x15'),_0x40f28c['message'],_0x22c478);_0x2b7da7(_0x4e4dc2['error'](0x1f4,_0x40f28c[_0x2096('0x13')]));});});};exports[_0x2096('0x1c')]=function(_0x3c3d9c){var _0xb49a24=this;return new Promise(function(_0x88f8e,_0x2b7866){return db[_0x2096('0x16')][_0x2096('0x1d')]({'raw':_0x3c3d9c[_0x2096('0x18')]?_0x3c3d9c[_0x2096('0x18')][_0x2096('0x19')]===undefined?!![]:![]:!![],'where':_0x3c3d9c[_0x2096('0x18')]?_0x3c3d9c['options']['where']||null:null,'attributes':[[db[_0x2096('0x1e')]['fn'](_0x2096('0x1f'),db[_0x2096('0x1e')][_0x2096('0x20')]('id')),_0x2096('0x21')],[db[_0x2096('0x1e')]['fn'](_0x2096('0x1f'),db[_0x2096('0x1e')]['fn']('IF',db[_0x2096('0x1e')]['literal'](_0x2096('0x22')))),_0x2096('0x23')],[db[_0x2096('0x1e')]['fn'](_0x2096('0x1f'),db[_0x2096('0x1e')]['fn']('IF',db[_0x2096('0x1e')][_0x2096('0x24')](_0x2096('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x2096('0x1e')]['fn'](_0x2096('0x1f'),db['sequelize']['fn']('IF',db[_0x2096('0x1e')][_0x2096('0x24')](_0x2096('0x26')))),_0x2096('0x27')],[db[_0x2096('0x1e')]['fn'](_0x2096('0x28'),db[_0x2096('0x1e')]['fn']('IF',db[_0x2096('0x1e')]['literal'](_0x2096('0x29')))),_0x2096('0x2a')],[db['sequelize']['fn'](_0x2096('0x28'),db['sequelize']['fn']('IF',db['sequelize'][_0x2096('0x24')](_0x2096('0x2b')))),_0x2096('0x2c')]]})[_0x2096('0xc')](function(_0x5db3b5){logger['info'](_0x2096('0x1c'),_0x3c3d9c);logger[_0x2096('0x1a')](_0x2096('0x1c'),_0x3c3d9c,JSON[_0x2096('0x1b')](_0x5db3b5));_0x88f8e(_0x5db3b5);})['catch'](function(_0x504c7c){logger[_0x2096('0x11')](_0x2096('0x1c'),_0x504c7c['message'],_0x3c3d9c);_0x2b7866(_0xb49a24[_0x2096('0x11')](0x1f4,_0x504c7c[_0x2096('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0xea2602){var _0x596334=this;return new Promise(function(_0x580aa9,_0x3c99ea){return db['CmHopperHistory'][_0x2096('0x1d')]({'raw':_0xea2602['options']?_0xea2602[_0x2096('0x18')][_0x2096('0x19')]===undefined?!![]:![]:!![],'where':_0xea2602[_0x2096('0x18')]?_0xea2602[_0x2096('0x18')][_0x2096('0x2d')]||null:null,'attributes':[[_0x2096('0x2e'),_0x2096('0x2f')],[db[_0x2096('0x1e')]['fn'](_0x2096('0x1f'),db[_0x2096('0x1e')]['fn']('IF',db[_0x2096('0x1e')][_0x2096('0x24')]('`state`\x20=\x200,\x201,\x20null'))),_0x2096('0x30')],[db['sequelize']['fn'](_0x2096('0x1f'),db[_0x2096('0x1e')]['fn']('IF',db[_0x2096('0x1e')][_0x2096('0x24')](_0x2096('0x31')))),_0x2096('0x32')],[db[_0x2096('0x1e')]['fn'](_0x2096('0x1f'),db[_0x2096('0x1e')]['fn']('IF',db[_0x2096('0x1e')][_0x2096('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0x2096('0x33')],[db['sequelize']['fn'](_0x2096('0x1f'),db[_0x2096('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x2096('0x34')))),_0x2096('0x35')],[db['sequelize']['fn'](_0x2096('0x1f'),db[_0x2096('0x1e')]['fn']('IF',db[_0x2096('0x1e')][_0x2096('0x24')](_0x2096('0x36')))),_0x2096('0x37')],[db['sequelize']['fn'](_0x2096('0x1f'),db[_0x2096('0x1e')]['fn']('IF',db[_0x2096('0x1e')]['literal'](_0x2096('0x38')))),_0x2096('0x39')],[db[_0x2096('0x1e')]['fn']('COUNT',db[_0x2096('0x1e')]['fn']('IF',db[_0x2096('0x1e')]['literal'](_0x2096('0x3a')))),_0x2096('0x3b')],[db[_0x2096('0x1e')]['fn'](_0x2096('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x2096('0x24')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x2096('0x1f'),db[_0x2096('0x1e')]['fn']('IF',db[_0x2096('0x1e')][_0x2096('0x24')]('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db[_0x2096('0x1e')]['fn'](_0x2096('0x1f'),db[_0x2096('0x1e')]['fn']('IF',db[_0x2096('0x1e')][_0x2096('0x24')](_0x2096('0x3c')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x2096('0x1f'),db[_0x2096('0x1e')]['fn']('IF',db[_0x2096('0x1e')][_0x2096('0x24')](_0x2096('0x3d')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x2096('0x1f'),db[_0x2096('0x1e')]['fn']('IF',db['sequelize'][_0x2096('0x24')](_0x2096('0x3e')))),_0x2096('0x3f')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2096('0x1e')][_0x2096('0x24')](_0x2096('0x40')))),_0x2096('0x41')],[db[_0x2096('0x1e')]['fn'](_0x2096('0x1f'),db['sequelize']['fn']('IF',db[_0x2096('0x1e')][_0x2096('0x24')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x2096('0x2e')]})[_0x2096('0xc')](function(_0x13b2d1){logger[_0x2096('0xd')](_0x2096('0x42'),_0xea2602);logger[_0x2096('0x1a')](_0x2096('0x42'),_0xea2602,JSON[_0x2096('0x1b')](_0x13b2d1));_0x580aa9(_0x13b2d1);})[_0x2096('0x14')](function(_0x1cd09f){logger['error'](_0x2096('0x42'),_0x1cd09f[_0x2096('0x13')],_0xea2602);_0x3c99ea(_0x596334[_0x2096('0x11')](0x1f4,_0x1cd09f[_0x2096('0x13')]));});});};exports[_0x2096('0x43')]=function(_0x5677bd){var _0x53055f=this;return new Promise(function(_0x51eacd,_0x48ec17){return db['CmHopperHistory'][_0x2096('0x1d')]({'raw':_0x5677bd[_0x2096('0x18')]?_0x5677bd[_0x2096('0x18')][_0x2096('0x19')]===undefined?!![]:![]:!![],'where':_0x5677bd[_0x2096('0x18')]?_0x5677bd[_0x2096('0x18')][_0x2096('0x2d')]||null:null,'attributes':[[_0x2096('0x2e'),_0x2096('0x2f')],[db[_0x2096('0x1e')]['fn']('COUNT',db[_0x2096('0x1e')][_0x2096('0x20')]('id')),_0x2096('0x44')],[db[_0x2096('0x1e')]['fn'](_0x2096('0x1f'),db['sequelize']['fn']('IF',db[_0x2096('0x1e')][_0x2096('0x24')](_0x2096('0x22')))),_0x2096('0x45')]],'group':[_0x2096('0x2e')]})[_0x2096('0xc')](function(_0x14a5db){logger[_0x2096('0xd')]('GetCampaignHopperHistory',_0x5677bd);logger[_0x2096('0x1a')](_0x2096('0x43'),_0x5677bd,JSON[_0x2096('0x1b')](_0x14a5db));_0x51eacd(_0x14a5db);})[_0x2096('0x14')](function(_0x1e4e2d){logger[_0x2096('0x11')](_0x2096('0x43'),_0x1e4e2d[_0x2096('0x13')],_0x5677bd);_0x48ec17(_0x53055f['error'](0x1f4,_0x1e4e2d[_0x2096('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index f77bada..527775c 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 _0xaf4f=['post','create','put','/:id','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','show'];(function(_0x1c4f83,_0x545e66){var _0x287301=function(_0x315ef2){while(--_0x315ef2){_0x1c4f83['push'](_0x1c4f83['shift']());}};_0x287301(++_0x545e66);}(_0xaf4f,0x138));var _0xfaf4=function(_0xb7202,_0x4aa500){_0xb7202=_0xb7202-0x0;var _0x6488bb=_0xaf4f[_0xb7202];return _0x6488bb;};'use strict';var multer=require(_0xfaf4('0x0'));var util=require(_0xfaf4('0x1'));var path=require(_0xfaf4('0x2'));var timeout=require(_0xfaf4('0x3'));var express=require('express');var router=express[_0xfaf4('0x4')]();var fs_extra=require(_0xfaf4('0x5'));var auth=require(_0xfaf4('0x6'));var interaction=require(_0xfaf4('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0xfaf4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xfaf4('0x9')](),controller[_0xfaf4('0xa')]);router[_0xfaf4('0x8')]('/:id',auth[_0xfaf4('0x9')](),controller[_0xfaf4('0xb')]);router[_0xfaf4('0xc')]('/',auth[_0xfaf4('0x9')](),controller[_0xfaf4('0xd')]);router[_0xfaf4('0xe')](_0xfaf4('0xf'),auth['isAuthenticated'](),controller[_0xfaf4('0x10')]);module[_0xfaf4('0x11')]=router; \ No newline at end of file +var _0x913b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','update','multer','util','path','connect-timeout'];(function(_0x5290dd,_0x4e2f72){var _0x3dda5f=function(_0x3590eb){while(--_0x3590eb){_0x5290dd['push'](_0x5290dd['shift']());}};_0x3dda5f(++_0x4e2f72);}(_0x913b,0xea));var _0xb913=function(_0x2390bd,_0x212fbd){_0x2390bd=_0x2390bd-0x0;var _0x3a969d=_0x913b[_0x2390bd];return _0x3a969d;};'use strict';var multer=require(_0xb913('0x0'));var util=require(_0xb913('0x1'));var path=require(_0xb913('0x2'));var timeout=require(_0xb913('0x3'));var express=require(_0xb913('0x4'));var router=express[_0xb913('0x5')]();var fs_extra=require(_0xb913('0x6'));var auth=require(_0xb913('0x7'));var interaction=require(_0xb913('0x8'));var config=require('../../config/environment');var controller=require(_0xb913('0x9'));router[_0xb913('0xa')]('/',auth[_0xb913('0xb')](),controller[_0xb913('0xc')]);router['get'](_0xb913('0xd'),auth[_0xb913('0xb')](),controller[_0xb913('0xe')]);router['get'](_0xb913('0xf'),auth[_0xb913('0xb')](),controller['show']);router['post']('/',auth[_0xb913('0xb')](),controller['create']);router['put']('/:id',auth[_0xb913('0xb')](),controller[_0xb913('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 3d4abba..9e4de85 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 _0x26cf=['STRING','exports'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0x26cf,0x135));var _0xf26c=function(_0x32a2e6,_0x4cdc75){_0x32a2e6=_0x32a2e6-0x0;var _0x2d798b=_0x26cf[_0x32a2e6];return _0x2d798b;};'use strict';var Sequelize=require('sequelize');module[_0xf26c('0x0')]={'name':{'type':Sequelize[_0xf26c('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf26c('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1354=['name','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1354,0x95));var _0x4135=function(_0xdb01a,_0x54a83a){_0xdb01a=_0xdb01a-0x0;var _0x107ede=_0x1354[_0xdb01a];return _0x107ede;};'use strict';var Sequelize=require(_0x4135('0x0'));module[_0x4135('0x1')]={'name':{'type':Sequelize[_0x4135('0x2')],'unique':_0x4135('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4135('0x2')]},'dialPrefix':{'type':Sequelize[_0x4135('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index fd91052..b280412 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 _0x9df1=['include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','length','nolimit','findAll','rows','removeDispositions','ids','addContacts','tags','isArray','join','push','each','CmContact','success','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','writeFileSync','setHeader','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','/tmp/list_%d_%s.csv','transaction','addCustomFields','Sequelize','TEXT','switch','BOOLEAN','sequelize','queryInterface','addColumn','cm_contacts','cf_%s','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','destroy','get','Lists','UserProfileResource','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','merge','VIRTUAL','filter','options','where','CmList','includeAll','catch','show','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9df1,0xcd));var _0x19df=function(_0x885428,_0x160268){_0x885428=_0x885428-0x0;var _0x2f006c=_0x9df1[_0x885428];return _0x2f006c;};'use strict';var emlformat=require(_0x19df('0x0'));var rimraf=require(_0x19df('0x1'));var zipdir=require(_0x19df('0x2'));var jsonpatch=require(_0x19df('0x3'));var rp=require(_0x19df('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x19df('0x5'));var util=require('util');var path=require(_0x19df('0x6'));var sox=require(_0x19df('0x7'));var csv=require(_0x19df('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x19df('0x9'));var _=require('lodash');var squel=require(_0x19df('0xa'));var crypto=require(_0x19df('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x19df('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x19df('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x19df('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x19df('0xf'));var logger=require(_0x19df('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x19df('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x19df('0x12'))['db'];config[_0x19df('0x13')]=_[_0x19df('0x14')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x19df('0x13')]));require(_0x19df('0x15'))[_0x19df('0x16')](socket);function respondWithStatusCode(_0x2ede7e,_0x56a686){_0x56a686=_0x56a686||0xcc;return function(_0x5be958){if(_0x5be958){return _0x2ede7e[_0x19df('0x17')](_0x56a686);}return _0x2ede7e[_0x19df('0x18')](_0x56a686)[_0x19df('0x19')]();};}function respondWithResult(_0x43de64,_0x31a391){_0x31a391=_0x31a391||0xc8;return function(_0x90aeb6){if(_0x90aeb6){return _0x43de64[_0x19df('0x18')](_0x31a391)[_0x19df('0x1a')](_0x90aeb6);}};}function respondWithFilteredResult(_0x3a9403,_0xecba9d){return function(_0x4e6b97){if(_0x4e6b97){var _0x2aeb74=typeof _0xecba9d[_0x19df('0x1b')]===_0x19df('0x1c')&&typeof _0xecba9d['limit']===_0x19df('0x1c');var _0x365682=_0x4e6b97['count'];var _0x1ad8ec=_0x2aeb74?0x0:_0xecba9d[_0x19df('0x1b')];var _0x40cc9c=_0x2aeb74?_0x4e6b97[_0x19df('0x1d')]:_0xecba9d['offset']+_0xecba9d[_0x19df('0x1e')];var _0x1ac007;if(_0x40cc9c>=_0x365682){_0x40cc9c=_0x365682;_0x1ac007=0xc8;}else{_0x1ac007=0xce;}_0x3a9403['status'](_0x1ac007);return _0x3a9403['set']('Content-Range',_0x1ad8ec+'-'+_0x40cc9c+'/'+_0x365682)[_0x19df('0x1a')](_0x4e6b97);}return null;};}function patchUpdates(_0x41e533){return function(_0x5f474b){try{jsonpatch[_0x19df('0x1f')](_0x5f474b,_0x41e533,!![]);}catch(_0x1cffda){return BPromise[_0x19df('0x20')](_0x1cffda);}return _0x5f474b[_0x19df('0x21')]();};}function saveUpdates(_0x2dc139,_0x1f130f){return function(_0x24276f){if(_0x24276f){return _0x24276f[_0x19df('0x22')](_0x2dc139)['then'](function(_0x55b4f7){return _0x55b4f7;});}return null;};}function removeEntity(_0x3068cd,_0x3cfd62){return function(_0x38e136){if(_0x38e136){return _0x38e136[_0x19df('0x23')]()['then'](function(){var _0x3cfdfa=_0x38e136[_0x19df('0x24')]({'plain':!![]});var _0x5ab12d=_0x19df('0x25');return db[_0x19df('0x26')][_0x19df('0x23')]({'where':{'type':_0x5ab12d,'resourceId':_0x3cfdfa['id']}})[_0x19df('0x27')](function(){return _0x38e136;});})[_0x19df('0x27')](function(){_0x3068cd[_0x19df('0x18')](0xcc)[_0x19df('0x19')]();});}};}function handleEntityNotFound(_0x4e46fa,_0x2160ba){return function(_0x3fe0e3){if(!_0x3fe0e3){_0x4e46fa[_0x19df('0x17')](0x194);}return _0x3fe0e3;};}function handleError(_0x497128,_0x537e1c){_0x537e1c=_0x537e1c||0x1f4;return function(_0x3fc155){logger[_0x19df('0x28')](_0x3fc155[_0x19df('0x29')]);if(_0x3fc155[_0x19df('0x2a')]){delete _0x3fc155[_0x19df('0x2a')];}_0x497128[_0x19df('0x18')](_0x537e1c)[_0x19df('0x2b')](_0x3fc155);};}exports['index']=function(_0x49a813,_0x3d63af){var _0x1e4639={},_0x14ed85={},_0x6a3197={'count':0x0,'rows':[]};var _0x167a76=_[_0x19df('0x2c')](db['CmList'][_0x19df('0x2d')],function(_0x288f6e){return{'name':_0x288f6e[_0x19df('0x2e')],'type':_0x288f6e[_0x19df('0x2f')][_0x19df('0x30')]};});_0x14ed85[_0x19df('0x31')]=_[_0x19df('0x2c')](_0x167a76,'name');_0x14ed85[_0x19df('0x32')]=_['keys'](_0x49a813[_0x19df('0x32')]);_0x14ed85[_0x19df('0x33')]=_[_0x19df('0x34')](_0x14ed85[_0x19df('0x31')],_0x14ed85[_0x19df('0x32')]);_0x1e4639['attributes']=_[_0x19df('0x34')](_0x14ed85[_0x19df('0x31')],qs[_0x19df('0x35')](_0x49a813[_0x19df('0x32')][_0x19df('0x35')]));_0x1e4639[_0x19df('0x36')]=_0x1e4639[_0x19df('0x36')]['length']?_0x1e4639[_0x19df('0x36')]:_0x14ed85[_0x19df('0x31')];if(!_0x49a813[_0x19df('0x32')][_0x19df('0x37')]('nolimit')){_0x1e4639[_0x19df('0x1e')]=qs[_0x19df('0x1e')](_0x49a813['query']['limit']);_0x1e4639[_0x19df('0x1b')]=qs[_0x19df('0x1b')](_0x49a813[_0x19df('0x32')]['offset']);}_0x1e4639[_0x19df('0x38')]=qs[_0x19df('0x39')](_0x49a813['query'][_0x19df('0x39')]);_0x1e4639['where']=qs[_0x19df('0x33')](_[_0x19df('0x3a')](_0x49a813[_0x19df('0x32')],_0x14ed85[_0x19df('0x33')]),_0x167a76);if(_0x49a813['query']['filter']){_0x1e4639['where']=_[_0x19df('0x3b')](_0x1e4639['where'],{'$or':_['map'](_0x167a76,function(_0x5b9ea5){if(_0x5b9ea5[_0x19df('0x2f')]!==_0x19df('0x3c')){var _0x7f8de={};_0x7f8de[_0x5b9ea5[_0x19df('0x2a')]]={'$like':'%'+_0x49a813[_0x19df('0x32')][_0x19df('0x3d')]+'%'};return _0x7f8de;}})});}_0x1e4639=_[_0x19df('0x3b')]({},_0x1e4639,_0x49a813[_0x19df('0x3e')]);var _0x284d00={'where':_0x1e4639[_0x19df('0x3f')]};return db[_0x19df('0x40')][_0x19df('0x1d')](_0x284d00)[_0x19df('0x27')](function(_0x3d29e6){_0x6a3197[_0x19df('0x1d')]=_0x3d29e6;if(_0x49a813[_0x19df('0x32')][_0x19df('0x41')]){_0x1e4639['include']=[{'all':!![]}];}return db[_0x19df('0x40')]['findAll'](_0x1e4639);})['then'](function(_0x53662f){_0x6a3197['rows']=_0x53662f;return _0x6a3197;})['then'](respondWithFilteredResult(_0x3d63af,_0x1e4639))[_0x19df('0x42')](handleError(_0x3d63af,null));};exports[_0x19df('0x43')]=function(_0x2bbd02,_0x379e6f){var _0x9a9944={'raw':![],'where':{'id':_0x2bbd02['params']['id']}},_0x3cd63e={};_0x3cd63e['model']=_[_0x19df('0x44')](db[_0x19df('0x40')][_0x19df('0x2d')]);_0x3cd63e['query']=_['keys'](_0x2bbd02['query']);_0x3cd63e['filters']=_[_0x19df('0x34')](_0x3cd63e[_0x19df('0x31')],_0x3cd63e['query']);_0x9a9944[_0x19df('0x36')]=_[_0x19df('0x34')](_0x3cd63e['model'],qs[_0x19df('0x35')](_0x2bbd02['query']['fields']));_0x9a9944[_0x19df('0x36')]=_0x9a9944[_0x19df('0x36')]['length']?_0x9a9944[_0x19df('0x36')]:_0x3cd63e[_0x19df('0x31')];if(_0x2bbd02[_0x19df('0x32')][_0x19df('0x41')]){_0x9a9944[_0x19df('0x45')]=[{'all':!![]}];}_0x9a9944=_[_0x19df('0x3b')]({},_0x9a9944,_0x2bbd02['options']);return db[_0x19df('0x40')][_0x19df('0x46')](_0x9a9944)[_0x19df('0x27')](handleEntityNotFound(_0x379e6f,null))[_0x19df('0x27')](respondWithResult(_0x379e6f,null))[_0x19df('0x42')](handleError(_0x379e6f,null));};exports[_0x19df('0x47')]=function(_0x41c1b9,_0x36c4f8){return db[_0x19df('0x40')][_0x19df('0x47')](_0x41c1b9[_0x19df('0x48')],{})[_0x19df('0x27')](function(_0x3ec0ce){var _0x29b0de=_0x41c1b9['user'][_0x19df('0x24')]({'plain':!![]});if(!_0x29b0de)throw new Error(_0x19df('0x49'));if(_0x29b0de[_0x19df('0x4a')]===_0x19df('0x4b')){var _0x48fb9b=_0x3ec0ce[_0x19df('0x24')]({'plain':!![]});var _0x4cac03='Lists';return db[_0x19df('0x4c')][_0x19df('0x46')]({'where':{'name':_0x4cac03,'userProfileId':_0x29b0de[_0x19df('0x4d')]},'raw':!![]})['then'](function(_0x1f1da6){if(_0x1f1da6&&_0x1f1da6[_0x19df('0x4e')]===0x0){return db[_0x19df('0x26')][_0x19df('0x47')]({'name':_0x48fb9b[_0x19df('0x2a')],'resourceId':_0x48fb9b['id'],'type':_0x1f1da6['name'],'sectionId':_0x1f1da6['id']},{})[_0x19df('0x27')](function(){return _0x3ec0ce;});}else{return _0x3ec0ce;}})[_0x19df('0x42')](function(_0x5ce586){logger[_0x19df('0x28')](_0x19df('0x4f'),_0x5ce586);throw _0x5ce586;});}return _0x3ec0ce;})[_0x19df('0x27')](respondWithResult(_0x36c4f8,0xc9))[_0x19df('0x42')](handleError(_0x36c4f8,null));};exports[_0x19df('0x22')]=function(_0x1a0529,_0x6b8993){if(_0x1a0529['body']['id']){delete _0x1a0529[_0x19df('0x48')]['id'];}return db[_0x19df('0x40')][_0x19df('0x46')]({'where':{'id':_0x1a0529['params']['id']}})['then'](handleEntityNotFound(_0x6b8993,null))[_0x19df('0x27')](saveUpdates(_0x1a0529[_0x19df('0x48')],null))[_0x19df('0x27')](respondWithResult(_0x6b8993,null))['catch'](handleError(_0x6b8993,null));};exports['destroy']=function(_0x4ccb67,_0x3b653f){return db[_0x19df('0x40')][_0x19df('0x46')]({'where':{'id':_0x4ccb67[_0x19df('0x50')]['id']}})[_0x19df('0x27')](handleEntityNotFound(_0x3b653f,null))['then'](removeEntity(_0x3b653f,null))[_0x19df('0x42')](handleError(_0x3b653f,null));};exports[_0x19df('0x51')]=function(_0x4b7aa9,_0x11fb57){return db[_0x19df('0x40')][_0x19df('0x51')]()[_0x19df('0x27')](respondWithResult(_0x11fb57,null))[_0x19df('0x42')](handleError(_0x11fb57,null));};exports[_0x19df('0x52')]=function(_0x441d2d,_0x4b6dfe,_0x3eac37){if(_0x441d2d[_0x19df('0x48')]['id']){delete _0x441d2d[_0x19df('0x48')]['id'];}return db[_0x19df('0x40')][_0x19df('0x46')]({'where':{'id':_0x441d2d[_0x19df('0x50')]['id']}})['then'](handleEntityNotFound(_0x4b6dfe,null))['then'](function(_0x4370ef){if(_0x4370ef){_0x441d2d['body'][_0x19df('0x53')]=_0x4370ef['id'];return db[_0x19df('0x54')][_0x19df('0x47')](_0x441d2d[_0x19df('0x48')]);}})[_0x19df('0x27')](respondWithResult(_0x4b6dfe,null))['catch'](handleError(_0x4b6dfe,null));};exports[_0x19df('0x55')]=function(_0x4e947e,_0x451bc8,_0x4d9e87){var _0x36c32a={'raw':![],'where':{}};var _0x39d36b={};var _0x20d6c8={'count':0x0,'rows':[]};return db['CmList'][_0x19df('0x56')]({'where':{'id':_0x4e947e[_0x19df('0x50')]['id']}})['then'](handleEntityNotFound(_0x451bc8,null))[_0x19df('0x27')](function(_0x4e0bd1){if(_0x4e0bd1){_0x39d36b[_0x19df('0x31')]=_['keys'](db[_0x19df('0x54')]['rawAttributes']);_0x39d36b[_0x19df('0x32')]=_[_0x19df('0x44')](_0x4e947e[_0x19df('0x32')]);_0x39d36b[_0x19df('0x33')]=_[_0x19df('0x34')](_0x39d36b[_0x19df('0x31')],_0x39d36b[_0x19df('0x32')]);_0x36c32a[_0x19df('0x36')]=_[_0x19df('0x34')](_0x39d36b[_0x19df('0x31')],qs[_0x19df('0x35')](_0x4e947e['query']['fields']));_0x36c32a[_0x19df('0x36')]=_0x36c32a[_0x19df('0x36')][_0x19df('0x57')]?_0x36c32a[_0x19df('0x36')]:_0x39d36b[_0x19df('0x31')];if(!_0x4e947e[_0x19df('0x32')][_0x19df('0x37')](_0x19df('0x58'))){_0x36c32a[_0x19df('0x1e')]=qs[_0x19df('0x1e')](_0x4e947e[_0x19df('0x32')][_0x19df('0x1e')]);_0x36c32a['offset']=qs['offset'](_0x4e947e[_0x19df('0x32')]['offset']);}_0x36c32a['order']=qs['sort'](_0x4e947e['query']['sort']);_0x36c32a[_0x19df('0x3f')]=qs[_0x19df('0x33')](_[_0x19df('0x3a')](_0x4e947e[_0x19df('0x32')],_0x39d36b[_0x19df('0x33')]));_0x36c32a[_0x19df('0x3f')][_0x19df('0x53')]=_0x4e0bd1['id'];if(_0x4e947e[_0x19df('0x32')]['filter']){_0x36c32a[_0x19df('0x3f')]=_['merge'](_0x36c32a[_0x19df('0x3f')],{'$or':_[_0x19df('0x2c')](_0x36c32a[_0x19df('0x36')],function(_0x53627b){var _0xa0ded={};_0xa0ded[_0x53627b]={'$like':'%'+_0x4e947e[_0x19df('0x32')][_0x19df('0x3d')]+'%'};return _0xa0ded;})});}_0x36c32a=_['merge']({},_0x36c32a,_0x4e947e[_0x19df('0x3e')]);return db[_0x19df('0x54')][_0x19df('0x1d')]({'where':_0x36c32a[_0x19df('0x3f')]})[_0x19df('0x27')](function(_0x4eb174){_0x20d6c8[_0x19df('0x1d')]=_0x4eb174;if(_0x4e947e['query'][_0x19df('0x41')]){_0x36c32a[_0x19df('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x19df('0x59')](_0x36c32a);})[_0x19df('0x27')](function(_0x18b397){_0x20d6c8[_0x19df('0x5a')]=_0x18b397;return _0x20d6c8;});}})[_0x19df('0x27')](respondWithFilteredResult(_0x451bc8,_0x36c32a))[_0x19df('0x42')](handleError(_0x451bc8,null));};exports[_0x19df('0x5b')]=function(_0x1ad7ef,_0x454be2,_0x5ce347){return db['CmList'][_0x19df('0x46')]({'where':{'id':_0x1ad7ef['params']['id']}})[_0x19df('0x27')](handleEntityNotFound(_0x454be2,null))['then'](function(_0x11b83c){if(_0x11b83c){return _0x11b83c[_0x19df('0x5b')](_0x1ad7ef[_0x19df('0x32')][_0x19df('0x5c')]);}})[_0x19df('0x27')](respondWithStatusCode(_0x454be2,null))[_0x19df('0x42')](handleError(_0x454be2,null));};exports[_0x19df('0x5d')]=function(_0x28057f,_0xd08380,_0x2bc2df){return db[_0x19df('0x40')][_0x19df('0x46')]({'where':{'id':_0x28057f[_0x19df('0x50')]['id']}})['then'](handleEntityNotFound(_0xd08380,null))[_0x19df('0x27')](function(_0x3203dd){if(_0x3203dd){var _0x59c841=[];var _0x430fac={'success':[],'errors':[]};return db['CmContact'][_0x19df('0x51')]()['then'](function(_0x5ae27d){if(_0x28057f[_0x19df('0x48')][_0x19df('0x5e')]&&_[_0x19df('0x5f')](_0x28057f[_0x19df('0x48')][_0x19df('0x5e')])){if(_0x28057f[_0x19df('0x48')][_0x19df('0x5e')][_0x19df('0x57')]){_0x28057f[_0x19df('0x48')][_0x19df('0x5e')]=_0x28057f[_0x19df('0x48')][_0x19df('0x5e')][_0x19df('0x60')](';')+';';}else{_0x28057f[_0x19df('0x48')][_0x19df('0x5e')]=null;}}else{_0x28057f[_0x19df('0x48')][_0x19df('0x5e')]=null;}if(_0x28057f[_0x19df('0x48')]&&_['isArray'](_0x28057f[_0x19df('0x48')])){for(var _0x4e7d59=0x0;_0x4e7d59<_0x28057f[_0x19df('0x48')][_0x19df('0x57')];_0x4e7d59+=0x1){_0x28057f[_0x19df('0x48')][_0x4e7d59]['ListId']=_0x28057f['params']['id'];_0x59c841[_0x19df('0x61')](_0x28057f['body'][_0x4e7d59]);}return BPromise[_0x19df('0x62')](_0x59c841,function(_0x42f06f){return db[_0x19df('0x63')][_0x19df('0x47')](_['omit'](_0x42f06f,[_0x19df('0x5c'),'id'])||{},{'fields':_['keys'](_0x5ae27d),'raw':!![]})[_0x19df('0x27')](function(_0x493f7c){_0x430fac[_0x19df('0x64')][_0x19df('0x61')](_0x493f7c['dataValues']);})[_0x19df('0x42')](function(_0x408eb1){_0x430fac[_0x19df('0x65')]['push']({'data':_0x42f06f,'error':_0x408eb1[_0x19df('0x66')]});});})[_0x19df('0x27')](function(_0x4b0d7b){return _0x430fac;})[_0x19df('0x42')](function(_0x57e1a8){return _0x57e1a8;});}else{_0xd08380[_0x19df('0x18')](0x190)[_0x19df('0x1a')]({'message':_0x19df('0x67')});}});}})['then'](respondWithResult(_0xd08380,null))['catch'](handleError(_0xd08380,null));};exports[_0x19df('0x68')]=function(_0x1eb7ba,_0x558ff3,_0x4a9a9f){var _0x3b799c;return db[_0x19df('0x40')][_0x19df('0x46')]({'where':{'id':_0x1eb7ba['params']['id']},'include':[{'model':db[_0x19df('0x69')],'as':_0x19df('0x6a')}]})[_0x19df('0x27')](handleEntityNotFound(_0x558ff3,null))['then'](function(_0x394915){if(_0x394915){_0x3b799c=_0x394915;return db[_0x19df('0x63')][_0x19df('0x2d')];}})['then'](function(_0x1120da){if(_0x1120da){var _0x4eb969={};var _0x22d3eb={};_0x22d3eb['model']=_[_0x19df('0x6b')](_[_0x19df('0x44')](_0x1120da),_[_0x19df('0x2c')](_0x3b799c[_0x19df('0x6a')],function(_0x581c1b){return util[_0x19df('0x6c')](_0x19df('0x6d'),_0x581c1b['id']);}));_0x22d3eb[_0x19df('0x32')]=_['keys'](_0x1eb7ba['query']);_0x22d3eb['filters']=_[_0x19df('0x34')](_0x22d3eb[_0x19df('0x31')],_0x22d3eb[_0x19df('0x32')]);_0x4eb969[_0x19df('0x36')]=_[_0x19df('0x34')](_0x22d3eb[_0x19df('0x31')],qs[_0x19df('0x35')](_0x1eb7ba[_0x19df('0x32')]['fields']));_0x4eb969['attributes']=_0x4eb969[_0x19df('0x36')][_0x19df('0x57')]?_0x4eb969[_0x19df('0x36')]:_0x22d3eb[_0x19df('0x31')];if(!_0x1eb7ba[_0x19df('0x32')][_0x19df('0x37')](_0x19df('0x58'))){_0x4eb969[_0x19df('0x1e')]=qs[_0x19df('0x1e')](_0x1eb7ba[_0x19df('0x32')][_0x19df('0x1e')]);_0x4eb969[_0x19df('0x1b')]=qs[_0x19df('0x1b')](_0x1eb7ba['query'][_0x19df('0x1b')]);}_0x4eb969[_0x19df('0x38')]=qs[_0x19df('0x39')](_0x1eb7ba[_0x19df('0x32')][_0x19df('0x39')]);_0x4eb969[_0x19df('0x3f')]=qs['filters'](_['pick'](_0x1eb7ba[_0x19df('0x32')],_0x22d3eb[_0x19df('0x33')]));_0x4eb969['raw']=!![];if(_0x1eb7ba['query'][_0x19df('0x3d')]){_0x4eb969['where']=_[_0x19df('0x3b')](_0x4eb969[_0x19df('0x3f')],{'$or':_['map'](_0x4eb969[_0x19df('0x36')],function(_0xd1b51f){var _0x195427={};_0x195427[_0xd1b51f]={'$like':'%'+_0x1eb7ba[_0x19df('0x32')][_0x19df('0x3d')]+'%'};return _0x195427;})});}_0x4eb969=_[_0x19df('0x3b')]({},_0x4eb969,_0x1eb7ba[_0x19df('0x3e')]);return _0x3b799c[_0x19df('0x68')](_0x4eb969);}})[_0x19df('0x27')](respondWithResult(_0x558ff3,null))[_0x19df('0x42')](handleError(_0x558ff3,null));};exports['getContactsCsv']=function(_0x3fa417,_0x5d84af,_0x4cab00){var _0x5c92d3;return db['CmList']['find']({'where':{'id':_0x3fa417['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x19df('0x6a')}]})[_0x19df('0x27')](handleEntityNotFound(_0x5d84af,null))[_0x19df('0x27')](function(_0x1e677b){if(_0x1e677b){_0x5c92d3=_0x1e677b;return db[_0x19df('0x63')][_0x19df('0x2d')];}})[_0x19df('0x27')](function(_0x97f6c9){if(_0x97f6c9){var _0x16990a={};var _0x5ad16a={};_0x5ad16a[_0x19df('0x31')]=_[_0x19df('0x6b')](_[_0x19df('0x44')](_0x97f6c9),_[_0x19df('0x2c')](_0x5c92d3[_0x19df('0x6a')],function(_0x366ead){return util[_0x19df('0x6c')](_0x19df('0x6d'),_0x366ead['id']);}));_0x5ad16a['query']=_['keys'](_0x3fa417[_0x19df('0x32')]);_0x5ad16a[_0x19df('0x33')]=_['intersection'](_0x5ad16a['model'],_0x5ad16a[_0x19df('0x32')]);_0x16990a[_0x19df('0x36')]=_['intersection'](_0x5ad16a[_0x19df('0x31')],qs[_0x19df('0x35')](_0x3fa417[_0x19df('0x32')][_0x19df('0x35')]));_0x16990a[_0x19df('0x36')]=_0x16990a[_0x19df('0x36')][_0x19df('0x57')]?_0x16990a[_0x19df('0x36')]:_0x5ad16a[_0x19df('0x31')];if(!_0x3fa417['query'][_0x19df('0x37')]('nolimit')){_0x16990a['limit']=qs[_0x19df('0x1e')](_0x3fa417[_0x19df('0x32')][_0x19df('0x1e')]);_0x16990a[_0x19df('0x1b')]=qs[_0x19df('0x1b')](_0x3fa417['query'][_0x19df('0x1b')]);}_0x16990a[_0x19df('0x38')]=qs[_0x19df('0x39')](_0x3fa417[_0x19df('0x32')]['sort']);_0x16990a[_0x19df('0x3f')]=qs[_0x19df('0x33')](_['pick'](_0x3fa417[_0x19df('0x32')],_0x5ad16a['filters']));_0x16990a[_0x19df('0x6e')]=!![];if(_0x3fa417['query']['filter']){_0x16990a['where']=_[_0x19df('0x3b')](_0x16990a['where'],{'$or':_[_0x19df('0x2c')](_0x16990a[_0x19df('0x36')],function(_0x125fde){var _0x3040ad={};_0x3040ad[_0x125fde]={'$like':'%'+_0x3fa417[_0x19df('0x32')][_0x19df('0x3d')]+'%'};return _0x3040ad;})});}_0x16990a=_[_0x19df('0x3b')]({},_0x16990a,_0x3fa417['options']);return _0x5c92d3[_0x19df('0x68')](_0x16990a);}})[_0x19df('0x27')](function(_0x317b85){if(!_['isEmpty'](_0x317b85)){var _0x5bb8e0=toCsv(_0x317b85);var _0x43cb4f=Date['now']();fs[_0x19df('0x6f')](util['format']('/tmp/list_%d_%s.csv',_0x5c92d3['id'],_0x43cb4f),_0x5bb8e0);_0x5d84af[_0x19df('0x70')]('Content-disposition',_0x19df('0x71')+util[_0x19df('0x6c')](_0x19df('0x72'),_0x5c92d3['id'],_0x43cb4f));_0x5d84af[_0x19df('0x70')]('Content-type',_0x19df('0x73'));return _0x5d84af[_0x19df('0x74')](util[_0x19df('0x6c')](_0x19df('0x75'),_0x5c92d3['id'],_0x43cb4f));}else{return _0x5d84af['sendStatus'](0xcc);}})[_0x19df('0x42')](handleError(_0x5d84af,null));};exports['addCustomField']=function(_0x1012dc,_0x30e7a9,_0x1935cb){var _0x40bae7;delete _0x1012dc['body']['id'];return db[_0x19df('0x40')][_0x19df('0x56')]({'where':{'id':_0x1012dc[_0x19df('0x50')]['id']}})[_0x19df('0x27')](handleEntityNotFound(_0x30e7a9,null))[_0x19df('0x27')](function(_0xc164fc){if(_0xc164fc){return db['sequelize'][_0x19df('0x76')](function(_0x1107e9){return db[_0x19df('0x69')][_0x19df('0x47')](_0x1012dc[_0x19df('0x48')],{'transaction':_0x1107e9})[_0x19df('0x27')](function(_0x4dc6a7){_0x40bae7=_0x4dc6a7;return _0xc164fc[_0x19df('0x77')](_0x4dc6a7,{'transaction':_0x1107e9});})[_0x19df('0x27')](function(){var _0x248393={'type':db[_0x19df('0x78')][_0x19df('0x79')],'transaction':_0x1107e9};switch(_0x1012dc[_0x19df('0x48')][_0x19df('0x2f')]){case'text':_0x248393[_0x19df('0x2f')]=db[_0x19df('0x78')][_0x19df('0x79')];break;case'number':_0x248393[_0x19df('0x2f')]=db['Sequelize']['INTEGER'];break;case _0x19df('0x7a'):_0x248393[_0x19df('0x2f')]=db[_0x19df('0x78')][_0x19df('0x7b')];_0x248393['defaultValue']=![];break;default:}return db[_0x19df('0x7c')][_0x19df('0x7d')][_0x19df('0x7e')](_0x19df('0x7f'),util[_0x19df('0x6c')](_0x19df('0x80'),_0x40bae7['id']),_0x248393);})[_0x19df('0x27')](function(){return _0x40bae7;});});}})['then'](respondWithResult(_0x30e7a9,null))[_0x19df('0x42')](handleError(_0x30e7a9,null));};exports['getCustomFields']=function(_0x1c197d,_0x5da4f6,_0x47c867){var _0x1b6f75={};var _0x197574={};var _0x4b5fe4;var _0x5409aa;return db[_0x19df('0x40')][_0x19df('0x56')]({'where':{'id':_0x1c197d[_0x19df('0x50')]['id']}})['then'](handleEntityNotFound(_0x5da4f6,null))['then'](function(_0x27c557){if(_0x27c557){_0x4b5fe4=_0x27c557;_0x197574['model']=_[_0x19df('0x44')](db[_0x19df('0x69')]['rawAttributes']);_0x197574[_0x19df('0x32')]=_[_0x19df('0x44')](_0x1c197d['query']);_0x197574[_0x19df('0x33')]=_['intersection'](_0x197574[_0x19df('0x31')],_0x197574[_0x19df('0x32')]);_0x1b6f75['attributes']=_[_0x19df('0x34')](_0x197574[_0x19df('0x31')],qs['fields'](_0x1c197d[_0x19df('0x32')][_0x19df('0x35')]));_0x1b6f75[_0x19df('0x36')]=_0x1b6f75[_0x19df('0x36')][_0x19df('0x57')]?_0x1b6f75[_0x19df('0x36')]:_0x197574[_0x19df('0x31')];_0x1b6f75[_0x19df('0x38')]=qs[_0x19df('0x39')](_0x1c197d[_0x19df('0x32')][_0x19df('0x39')]);_0x1b6f75[_0x19df('0x3f')]=qs[_0x19df('0x33')](_[_0x19df('0x3a')](_0x1c197d['query'],_0x197574[_0x19df('0x33')]));_0x1b6f75['where']=_['merge'](_0x1b6f75[_0x19df('0x3f')],{'$or':[{'ListId':_0x27c557['id']},{'ListId':null}]});if(_0x1c197d[_0x19df('0x32')][_0x19df('0x3d')]){_0x1b6f75['where']=_['merge'](_0x1b6f75[_0x19df('0x3f')],{'$or':_['map'](_0x1b6f75[_0x19df('0x36')],function(_0x5e16bd){var _0x23a3f2={};_0x23a3f2[_0x5e16bd]={'$like':'%'+_0x1c197d[_0x19df('0x32')][_0x19df('0x3d')]+'%'};return _0x23a3f2;})});}_0x1b6f75=_[_0x19df('0x3b')]({},_0x1b6f75,_0x1c197d[_0x19df('0x3e')]);return db['CmCustomField']['findAndCountAll'](_0x1b6f75);}})[_0x19df('0x27')](respondWithResult(_0x5da4f6,null))[_0x19df('0x42')](handleError(_0x5da4f6,null));};exports['addAgents']=function(_0x232d54,_0x4f9ca8,_0x4609e5){return db[_0x19df('0x40')][_0x19df('0x46')]({'where':{'id':_0x232d54[_0x19df('0x50')]['id']}})[_0x19df('0x27')](handleEntityNotFound(_0x4f9ca8,null))[_0x19df('0x27')](function(_0x347e80){if(_0x347e80){return _0x347e80['addAgents'](_0x232d54[_0x19df('0x48')][_0x19df('0x5c')],_[_0x19df('0x81')](_0x232d54[_0x19df('0x48')],[_0x19df('0x5c'),'id'])||{})[_0x19df('0x82')](function(_0x4e3414){for(var _0x30816f=0x0;_0x30816f<_0x232d54[_0x19df('0x48')][_0x19df('0x5c')]['length'];_0x30816f+=0x1){socket[_0x19df('0x83')](_0x19df('0x84'),{'UserId':Number(_0x232d54[_0x19df('0x48')][_0x19df('0x5c')][_0x30816f]),'CmListId':Number(_0x232d54[_0x19df('0x50')]['id'])});}return _0x4e3414;});}})[_0x19df('0x27')](respondWithResult(_0x4f9ca8,null))[_0x19df('0x42')](handleError(_0x4f9ca8,null));};exports[_0x19df('0x85')]=function(_0x250f3c,_0x3e1c9e,_0x529a9f){return db[_0x19df('0x40')][_0x19df('0x46')]({'where':{'id':_0x250f3c[_0x19df('0x50')]['id']}})[_0x19df('0x27')](handleEntityNotFound(_0x3e1c9e,null))['then'](function(_0x1685a8){if(_0x1685a8){return _0x1685a8[_0x19df('0x85')](_0x250f3c[_0x19df('0x32')][_0x19df('0x5c')])[_0x19df('0x27')](function(){if(_[_0x19df('0x5f')](_0x250f3c['query'][_0x19df('0x5c')])){for(var _0x2a2943=0x0;_0x2a2943<_0x250f3c[_0x19df('0x32')][_0x19df('0x5c')][_0x19df('0x57')];_0x2a2943+=0x1){socket[_0x19df('0x83')](_0x19df('0x86'),{'UserId':Number(_0x250f3c[_0x19df('0x32')][_0x19df('0x5c')][_0x2a2943]),'CmListId':Number(_0x250f3c[_0x19df('0x50')]['id'])});}}else{socket['emit'](_0x19df('0x86'),{'UserId':Number(_0x250f3c[_0x19df('0x32')][_0x19df('0x5c')]),'CmListId':Number(_0x250f3c[_0x19df('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x3e1c9e,null))[_0x19df('0x42')](handleError(_0x3e1c9e,null));};exports[_0x19df('0x87')]=function(_0x2e88e6,_0x1afaea,_0xd7e3e2){var _0x40ac8e={};var _0x5d9129={};var _0x4657bd;var _0x535937;return db[_0x19df('0x40')][_0x19df('0x56')]({'where':{'id':_0x2e88e6[_0x19df('0x50')]['id']}})[_0x19df('0x27')](handleEntityNotFound(_0x1afaea,null))[_0x19df('0x27')](function(_0x54c663){if(_0x54c663){_0x4657bd=_0x54c663;_0x5d9129[_0x19df('0x31')]=_[_0x19df('0x44')](db[_0x19df('0x88')]['rawAttributes']);_0x5d9129[_0x19df('0x32')]=_['keys'](_0x2e88e6[_0x19df('0x32')]);_0x5d9129[_0x19df('0x33')]=_['intersection'](_0x5d9129[_0x19df('0x31')],_0x5d9129[_0x19df('0x32')]);_0x40ac8e[_0x19df('0x36')]=_[_0x19df('0x34')](_0x5d9129[_0x19df('0x31')],qs[_0x19df('0x35')](_0x2e88e6[_0x19df('0x32')][_0x19df('0x35')]));_0x40ac8e[_0x19df('0x36')]=_0x40ac8e['attributes']['length']?_0x40ac8e[_0x19df('0x36')]:_0x5d9129[_0x19df('0x31')];_0x40ac8e['order']=qs['sort'](_0x2e88e6['query'][_0x19df('0x39')]);_0x40ac8e['where']=qs['filters'](_[_0x19df('0x3a')](_0x2e88e6[_0x19df('0x32')],_0x5d9129[_0x19df('0x33')]));if(_0x2e88e6[_0x19df('0x32')][_0x19df('0x3d')]){_0x40ac8e[_0x19df('0x3f')]=_[_0x19df('0x3b')](_0x40ac8e[_0x19df('0x3f')],{'$or':_[_0x19df('0x2c')](_0x40ac8e[_0x19df('0x36')],function(_0x4f092a){var _0x1a39d6={};_0x1a39d6[_0x4f092a]={'$like':'%'+_0x2e88e6[_0x19df('0x32')][_0x19df('0x3d')]+'%'};return _0x1a39d6;})});}_0x40ac8e=_[_0x19df('0x3b')]({},_0x40ac8e,_0x2e88e6[_0x19df('0x3e')]);return _0x4657bd['getAgents'](_0x40ac8e);}})['then'](function(_0x33e5dc){if(_0x33e5dc){_0x535937=_0x33e5dc[_0x19df('0x57')];if(!_0x2e88e6[_0x19df('0x32')][_0x19df('0x37')](_0x19df('0x58'))){_0x40ac8e[_0x19df('0x1e')]=qs['limit'](_0x2e88e6[_0x19df('0x32')]['limit']);_0x40ac8e[_0x19df('0x1b')]=qs['offset'](_0x2e88e6['query']['offset']);}return _0x4657bd[_0x19df('0x87')](_0x40ac8e);}})['then'](function(_0x1aea15){if(_0x1aea15){return _0x1aea15?{'count':_0x535937,'rows':_0x1aea15}:null;}})[_0x19df('0x27')](respondWithResult(_0x1afaea,null))[_0x19df('0x42')](handleError(_0x1afaea,null));}; \ No newline at end of file +var _0x4df9=['../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','get','Lists','UserProfileResource','destroy','error','stack','name','send','map','CmList','rawAttributes','type','query','keys','filters','model','attributes','intersection','fields','length','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ListId','Disposition','getDispositions','hasOwnProperty','nolimit','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','order','cf_%d','raw','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findOne','findAndCountAll','addAgents','omit','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0x20b90a,_0x513db0){var _0x168c89=function(_0x1c4a1b){while(--_0x1c4a1b){_0x20b90a['push'](_0x20b90a['shift']());}};_0x168c89(++_0x513db0);}(_0x4df9,0x10c));var _0x94df=function(_0x3ec951,_0x21ae6c){_0x3ec951=_0x3ec951-0x0;var _0x1c0667=_0x4df9[_0x3ec951];return _0x1c0667;};'use strict';var emlformat=require(_0x94df('0x0'));var rimraf=require(_0x94df('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x94df('0x2'));var rp=require(_0x94df('0x3'));var moment=require('moment');var BPromise=require(_0x94df('0x4'));var Mustache=require(_0x94df('0x5'));var util=require(_0x94df('0x6'));var path=require(_0x94df('0x7'));var sox=require(_0x94df('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x94df('0x9'));var squel=require(_0x94df('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x94df('0xb'));var toCsv=require(_0x94df('0xc'));var querystring=require(_0x94df('0xd'));var Papa=require('papaparse');var Redis=require(_0x94df('0xe'));var authService=require(_0x94df('0xf'));var qs=require(_0x94df('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x94df('0x11'))(_0x94df('0x12'));var utils=require(_0x94df('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x94df('0x14'));var db=require(_0x94df('0x15'))['db'];config[_0x94df('0x16')]=_[_0x94df('0x17')](config[_0x94df('0x16')],{'host':_0x94df('0x18'),'port':0x18eb});var socket=require(_0x94df('0x19'))(new Redis(config['redis']));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0xbd2efa,_0x47c42f){_0x47c42f=_0x47c42f||0xcc;return function(_0x55dec2){if(_0x55dec2){return _0xbd2efa[_0x94df('0x1a')](_0x47c42f);}return _0xbd2efa[_0x94df('0x1b')](_0x47c42f)[_0x94df('0x1c')]();};}function respondWithResult(_0x4a3267,_0xc920c7){_0xc920c7=_0xc920c7||0xc8;return function(_0x1e484a){if(_0x1e484a){return _0x4a3267[_0x94df('0x1b')](_0xc920c7)[_0x94df('0x1d')](_0x1e484a);}};}function respondWithFilteredResult(_0x332850,_0x5388a3){return function(_0x425e8b){if(_0x425e8b){var _0x4a57b1=typeof _0x5388a3['offset']===_0x94df('0x1e')&&typeof _0x5388a3[_0x94df('0x1f')]===_0x94df('0x1e');var _0x44fd7a=_0x425e8b[_0x94df('0x20')];var _0x1fd28e=_0x4a57b1?0x0:_0x5388a3[_0x94df('0x21')];var _0x3afa6e=_0x4a57b1?_0x425e8b[_0x94df('0x20')]:_0x5388a3[_0x94df('0x21')]+_0x5388a3[_0x94df('0x1f')];var _0x53f880;if(_0x3afa6e>=_0x44fd7a){_0x3afa6e=_0x44fd7a;_0x53f880=0xc8;}else{_0x53f880=0xce;}_0x332850[_0x94df('0x1b')](_0x53f880);return _0x332850[_0x94df('0x22')](_0x94df('0x23'),_0x1fd28e+'-'+_0x3afa6e+'/'+_0x44fd7a)[_0x94df('0x1d')](_0x425e8b);}return null;};}function patchUpdates(_0xa0b462){return function(_0x1116ca){try{jsonpatch['apply'](_0x1116ca,_0xa0b462,!![]);}catch(_0xddc81a){return BPromise[_0x94df('0x24')](_0xddc81a);}return _0x1116ca[_0x94df('0x25')]();};}function saveUpdates(_0x3c64fa,_0x33cad0){return function(_0x895085){if(_0x895085){return _0x895085['update'](_0x3c64fa)[_0x94df('0x26')](function(_0x51cf3d){return _0x51cf3d;});}return null;};}function removeEntity(_0x4707c6,_0x54ed8f){return function(_0x5a72d2){if(_0x5a72d2){return _0x5a72d2['destroy']()['then'](function(){var _0x2e8a3c=_0x5a72d2[_0x94df('0x27')]({'plain':!![]});var _0x72b79=_0x94df('0x28');return db[_0x94df('0x29')][_0x94df('0x2a')]({'where':{'type':_0x72b79,'resourceId':_0x2e8a3c['id']}})[_0x94df('0x26')](function(){return _0x5a72d2;});})[_0x94df('0x26')](function(){_0x4707c6[_0x94df('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x99ed31,_0x52c17d){return function(_0x2fdccb){if(!_0x2fdccb){_0x99ed31[_0x94df('0x1a')](0x194);}return _0x2fdccb;};}function handleError(_0x37f1e9,_0x24eb4a){_0x24eb4a=_0x24eb4a||0x1f4;return function(_0x98a3ba){logger[_0x94df('0x2b')](_0x98a3ba[_0x94df('0x2c')]);if(_0x98a3ba['name']){delete _0x98a3ba[_0x94df('0x2d')];}_0x37f1e9[_0x94df('0x1b')](_0x24eb4a)[_0x94df('0x2e')](_0x98a3ba);};}exports['index']=function(_0x35b875,_0x2807e){var _0x597e6c={},_0x29395d={},_0x567534={'count':0x0,'rows':[]};var _0x505211=_[_0x94df('0x2f')](db[_0x94df('0x30')][_0x94df('0x31')],function(_0x266c9c){return{'name':_0x266c9c['fieldName'],'type':_0x266c9c[_0x94df('0x32')]['key']};});_0x29395d['model']=_[_0x94df('0x2f')](_0x505211,'name');_0x29395d[_0x94df('0x33')]=_[_0x94df('0x34')](_0x35b875[_0x94df('0x33')]);_0x29395d[_0x94df('0x35')]=_['intersection'](_0x29395d[_0x94df('0x36')],_0x29395d['query']);_0x597e6c[_0x94df('0x37')]=_[_0x94df('0x38')](_0x29395d[_0x94df('0x36')],qs[_0x94df('0x39')](_0x35b875['query'][_0x94df('0x39')]));_0x597e6c[_0x94df('0x37')]=_0x597e6c[_0x94df('0x37')][_0x94df('0x3a')]?_0x597e6c[_0x94df('0x37')]:_0x29395d[_0x94df('0x36')];if(!_0x35b875['query']['hasOwnProperty']('nolimit')){_0x597e6c['limit']=qs[_0x94df('0x1f')](_0x35b875[_0x94df('0x33')][_0x94df('0x1f')]);_0x597e6c['offset']=qs[_0x94df('0x21')](_0x35b875[_0x94df('0x33')][_0x94df('0x21')]);}_0x597e6c['order']=qs[_0x94df('0x3b')](_0x35b875['query']['sort']);_0x597e6c[_0x94df('0x3c')]=qs[_0x94df('0x35')](_[_0x94df('0x3d')](_0x35b875[_0x94df('0x33')],_0x29395d[_0x94df('0x35')]),_0x505211);if(_0x35b875[_0x94df('0x33')][_0x94df('0x3e')]){_0x597e6c[_0x94df('0x3c')]=_[_0x94df('0x3f')](_0x597e6c['where'],{'$or':_['map'](_0x505211,function(_0x3e5590){if(_0x3e5590[_0x94df('0x32')]!=='VIRTUAL'){var _0x5a802e={};_0x5a802e[_0x3e5590[_0x94df('0x2d')]]={'$like':'%'+_0x35b875[_0x94df('0x33')]['filter']+'%'};return _0x5a802e;}})});}_0x597e6c=_['merge']({},_0x597e6c,_0x35b875[_0x94df('0x40')]);var _0x5729b2={'where':_0x597e6c['where']};return db[_0x94df('0x30')][_0x94df('0x20')](_0x5729b2)[_0x94df('0x26')](function(_0x56e1a6){_0x567534[_0x94df('0x20')]=_0x56e1a6;if(_0x35b875[_0x94df('0x33')][_0x94df('0x41')]){_0x597e6c[_0x94df('0x42')]=[{'all':!![]}];}return db[_0x94df('0x30')]['findAll'](_0x597e6c);})[_0x94df('0x26')](function(_0xcc8950){_0x567534[_0x94df('0x43')]=_0xcc8950;return _0x567534;})[_0x94df('0x26')](respondWithFilteredResult(_0x2807e,_0x597e6c))['catch'](handleError(_0x2807e,null));};exports[_0x94df('0x44')]=function(_0x5a2b04,_0x137e8a){var _0x4aec04={'raw':![],'where':{'id':_0x5a2b04[_0x94df('0x45')]['id']}},_0x5c938a={};_0x5c938a[_0x94df('0x36')]=_[_0x94df('0x34')](db[_0x94df('0x30')][_0x94df('0x31')]);_0x5c938a['query']=_['keys'](_0x5a2b04['query']);_0x5c938a['filters']=_[_0x94df('0x38')](_0x5c938a['model'],_0x5c938a[_0x94df('0x33')]);_0x4aec04[_0x94df('0x37')]=_[_0x94df('0x38')](_0x5c938a[_0x94df('0x36')],qs[_0x94df('0x39')](_0x5a2b04['query'][_0x94df('0x39')]));_0x4aec04[_0x94df('0x37')]=_0x4aec04[_0x94df('0x37')][_0x94df('0x3a')]?_0x4aec04[_0x94df('0x37')]:_0x5c938a[_0x94df('0x36')];if(_0x5a2b04[_0x94df('0x33')][_0x94df('0x41')]){_0x4aec04[_0x94df('0x42')]=[{'all':!![]}];}_0x4aec04=_[_0x94df('0x3f')]({},_0x4aec04,_0x5a2b04[_0x94df('0x40')]);return db[_0x94df('0x30')][_0x94df('0x46')](_0x4aec04)['then'](handleEntityNotFound(_0x137e8a,null))[_0x94df('0x26')](respondWithResult(_0x137e8a,null))[_0x94df('0x47')](handleError(_0x137e8a,null));};exports[_0x94df('0x48')]=function(_0x1e95c8,_0x4569a1){return db['CmList'][_0x94df('0x48')](_0x1e95c8[_0x94df('0x49')],{})['then'](function(_0x697d66){var _0x42df5d=_0x1e95c8['user'][_0x94df('0x27')]({'plain':!![]});if(!_0x42df5d)throw new Error(_0x94df('0x4a'));if(_0x42df5d[_0x94df('0x4b')]==='user'){var _0x57f5a9=_0x697d66['get']({'plain':!![]});var _0x3111c8='Lists';return db[_0x94df('0x4c')][_0x94df('0x46')]({'where':{'name':_0x3111c8,'userProfileId':_0x42df5d[_0x94df('0x4d')]},'raw':!![]})[_0x94df('0x26')](function(_0x217113){if(_0x217113&&_0x217113[_0x94df('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x57f5a9[_0x94df('0x2d')],'resourceId':_0x57f5a9['id'],'type':_0x217113['name'],'sectionId':_0x217113['id']},{})['then'](function(){return _0x697d66;});}else{return _0x697d66;}})[_0x94df('0x47')](function(_0x5b50de){logger[_0x94df('0x2b')](_0x94df('0x4f'),_0x5b50de);throw _0x5b50de;});}return _0x697d66;})[_0x94df('0x26')](respondWithResult(_0x4569a1,0xc9))[_0x94df('0x47')](handleError(_0x4569a1,null));};exports[_0x94df('0x50')]=function(_0x2b6e8e,_0x5be357){if(_0x2b6e8e['body']['id']){delete _0x2b6e8e[_0x94df('0x49')]['id'];}return db[_0x94df('0x30')][_0x94df('0x46')]({'where':{'id':_0x2b6e8e['params']['id']}})[_0x94df('0x26')](handleEntityNotFound(_0x5be357,null))[_0x94df('0x26')](saveUpdates(_0x2b6e8e[_0x94df('0x49')],null))[_0x94df('0x26')](respondWithResult(_0x5be357,null))[_0x94df('0x47')](handleError(_0x5be357,null));};exports['destroy']=function(_0x359a79,_0x5884aa){return db['CmList'][_0x94df('0x46')]({'where':{'id':_0x359a79[_0x94df('0x45')]['id']}})['then'](handleEntityNotFound(_0x5884aa,null))[_0x94df('0x26')](removeEntity(_0x5884aa,null))[_0x94df('0x47')](handleError(_0x5884aa,null));};exports[_0x94df('0x51')]=function(_0x1cd915,_0x361b57){return db[_0x94df('0x30')]['describe']()[_0x94df('0x26')](respondWithResult(_0x361b57,null))[_0x94df('0x47')](handleError(_0x361b57,null));};exports[_0x94df('0x52')]=function(_0x54763c,_0x161747,_0x54235f){if(_0x54763c[_0x94df('0x49')]['id']){delete _0x54763c[_0x94df('0x49')]['id'];}return db[_0x94df('0x30')][_0x94df('0x46')]({'where':{'id':_0x54763c[_0x94df('0x45')]['id']}})[_0x94df('0x26')](handleEntityNotFound(_0x161747,null))['then'](function(_0x3d72d1){if(_0x3d72d1){_0x54763c[_0x94df('0x49')][_0x94df('0x53')]=_0x3d72d1['id'];return db[_0x94df('0x54')][_0x94df('0x48')](_0x54763c[_0x94df('0x49')]);}})['then'](respondWithResult(_0x161747,null))['catch'](handleError(_0x161747,null));};exports[_0x94df('0x55')]=function(_0x8c8ba2,_0x49e2ea,_0x551a6f){var _0x4d52f4={'raw':![],'where':{}};var _0x980564={};var _0x4ad990={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x8c8ba2[_0x94df('0x45')]['id']}})[_0x94df('0x26')](handleEntityNotFound(_0x49e2ea,null))[_0x94df('0x26')](function(_0x4ccdb1){if(_0x4ccdb1){_0x980564['model']=_[_0x94df('0x34')](db[_0x94df('0x54')][_0x94df('0x31')]);_0x980564['query']=_[_0x94df('0x34')](_0x8c8ba2[_0x94df('0x33')]);_0x980564[_0x94df('0x35')]=_[_0x94df('0x38')](_0x980564[_0x94df('0x36')],_0x980564[_0x94df('0x33')]);_0x4d52f4[_0x94df('0x37')]=_[_0x94df('0x38')](_0x980564[_0x94df('0x36')],qs[_0x94df('0x39')](_0x8c8ba2[_0x94df('0x33')][_0x94df('0x39')]));_0x4d52f4['attributes']=_0x4d52f4[_0x94df('0x37')][_0x94df('0x3a')]?_0x4d52f4[_0x94df('0x37')]:_0x980564[_0x94df('0x36')];if(!_0x8c8ba2[_0x94df('0x33')][_0x94df('0x56')](_0x94df('0x57'))){_0x4d52f4[_0x94df('0x1f')]=qs[_0x94df('0x1f')](_0x8c8ba2['query'][_0x94df('0x1f')]);_0x4d52f4[_0x94df('0x21')]=qs['offset'](_0x8c8ba2[_0x94df('0x33')][_0x94df('0x21')]);}_0x4d52f4['order']=qs[_0x94df('0x3b')](_0x8c8ba2[_0x94df('0x33')]['sort']);_0x4d52f4[_0x94df('0x3c')]=qs[_0x94df('0x35')](_[_0x94df('0x3d')](_0x8c8ba2[_0x94df('0x33')],_0x980564[_0x94df('0x35')]));_0x4d52f4[_0x94df('0x3c')]['ListId']=_0x4ccdb1['id'];if(_0x8c8ba2[_0x94df('0x33')][_0x94df('0x3e')]){_0x4d52f4[_0x94df('0x3c')]=_[_0x94df('0x3f')](_0x4d52f4[_0x94df('0x3c')],{'$or':_[_0x94df('0x2f')](_0x4d52f4[_0x94df('0x37')],function(_0x3075ef){var _0x3671b1={};_0x3671b1[_0x3075ef]={'$like':'%'+_0x8c8ba2[_0x94df('0x33')][_0x94df('0x3e')]+'%'};return _0x3671b1;})});}_0x4d52f4=_['merge']({},_0x4d52f4,_0x8c8ba2[_0x94df('0x40')]);return db['Disposition']['count']({'where':_0x4d52f4[_0x94df('0x3c')]})[_0x94df('0x26')](function(_0x5bef27){_0x4ad990[_0x94df('0x20')]=_0x5bef27;if(_0x8c8ba2[_0x94df('0x33')][_0x94df('0x41')]){_0x4d52f4[_0x94df('0x42')]=[{'all':!![]}];}return db['Disposition'][_0x94df('0x58')](_0x4d52f4);})['then'](function(_0x2082e1){_0x4ad990[_0x94df('0x43')]=_0x2082e1;return _0x4ad990;});}})['then'](respondWithFilteredResult(_0x49e2ea,_0x4d52f4))[_0x94df('0x47')](handleError(_0x49e2ea,null));};exports[_0x94df('0x59')]=function(_0x52294d,_0x290181,_0x12198f){return db['CmList'][_0x94df('0x46')]({'where':{'id':_0x52294d[_0x94df('0x45')]['id']}})[_0x94df('0x26')](handleEntityNotFound(_0x290181,null))['then'](function(_0x40809b){if(_0x40809b){return _0x40809b[_0x94df('0x59')](_0x52294d[_0x94df('0x33')][_0x94df('0x5a')]);}})['then'](respondWithStatusCode(_0x290181,null))[_0x94df('0x47')](handleError(_0x290181,null));};exports[_0x94df('0x5b')]=function(_0x435e0b,_0x36f440,_0x34a98c){return db[_0x94df('0x30')][_0x94df('0x46')]({'where':{'id':_0x435e0b[_0x94df('0x45')]['id']}})[_0x94df('0x26')](handleEntityNotFound(_0x36f440,null))['then'](function(_0x3a9653){if(_0x3a9653){var _0x40840c=[];var _0x11c86e={'success':[],'errors':[]};return db[_0x94df('0x5c')][_0x94df('0x51')]()['then'](function(_0x143401){if(_0x435e0b[_0x94df('0x49')][_0x94df('0x5d')]&&_[_0x94df('0x5e')](_0x435e0b['body'][_0x94df('0x5d')])){if(_0x435e0b[_0x94df('0x49')]['tags'][_0x94df('0x3a')]){_0x435e0b[_0x94df('0x49')]['tags']=_0x435e0b['body'][_0x94df('0x5d')][_0x94df('0x5f')](';')+';';}else{_0x435e0b[_0x94df('0x49')][_0x94df('0x5d')]=null;}}else{_0x435e0b[_0x94df('0x49')]['tags']=null;}if(_0x435e0b[_0x94df('0x49')]&&_[_0x94df('0x5e')](_0x435e0b[_0x94df('0x49')])){for(var _0x4cde21=0x0;_0x4cde21<_0x435e0b['body'][_0x94df('0x3a')];_0x4cde21+=0x1){_0x435e0b[_0x94df('0x49')][_0x4cde21][_0x94df('0x53')]=_0x435e0b[_0x94df('0x45')]['id'];_0x40840c[_0x94df('0x60')](_0x435e0b['body'][_0x4cde21]);}return BPromise[_0x94df('0x61')](_0x40840c,function(_0x263e67){return db[_0x94df('0x5c')][_0x94df('0x48')](_['omit'](_0x263e67,[_0x94df('0x5a'),'id'])||{},{'fields':_[_0x94df('0x34')](_0x143401),'raw':!![]})[_0x94df('0x26')](function(_0x2d30be){_0x11c86e[_0x94df('0x62')][_0x94df('0x60')](_0x2d30be[_0x94df('0x63')]);})[_0x94df('0x47')](function(_0x442531){_0x11c86e[_0x94df('0x64')][_0x94df('0x60')]({'data':_0x263e67,'error':_0x442531['message']});});})[_0x94df('0x26')](function(_0x263f21){return _0x11c86e;})[_0x94df('0x47')](function(_0x332705){return _0x332705;});}else{_0x36f440[_0x94df('0x1b')](0x190)['json']({'message':_0x94df('0x65')});}});}})['then'](respondWithResult(_0x36f440,null))[_0x94df('0x47')](handleError(_0x36f440,null));};exports[_0x94df('0x66')]=function(_0x4c0a41,_0x1e0ae7,_0x390369){var _0x38983b;return db[_0x94df('0x30')]['find']({'where':{'id':_0x4c0a41[_0x94df('0x45')]['id']},'include':[{'model':db[_0x94df('0x67')],'as':_0x94df('0x68')}]})['then'](handleEntityNotFound(_0x1e0ae7,null))[_0x94df('0x26')](function(_0xe7a93e){if(_0xe7a93e){_0x38983b=_0xe7a93e;return db[_0x94df('0x5c')][_0x94df('0x31')];}})[_0x94df('0x26')](function(_0x14f2ed){if(_0x14f2ed){var _0xac8aea={};var _0x593301={};_0x593301[_0x94df('0x36')]=_[_0x94df('0x69')](_['keys'](_0x14f2ed),_[_0x94df('0x2f')](_0x38983b[_0x94df('0x68')],function(_0x22241e){return util[_0x94df('0x6a')]('cf_%d',_0x22241e['id']);}));_0x593301['query']=_[_0x94df('0x34')](_0x4c0a41[_0x94df('0x33')]);_0x593301[_0x94df('0x35')]=_['intersection'](_0x593301[_0x94df('0x36')],_0x593301[_0x94df('0x33')]);_0xac8aea[_0x94df('0x37')]=_['intersection'](_0x593301[_0x94df('0x36')],qs[_0x94df('0x39')](_0x4c0a41[_0x94df('0x33')][_0x94df('0x39')]));_0xac8aea['attributes']=_0xac8aea['attributes'][_0x94df('0x3a')]?_0xac8aea[_0x94df('0x37')]:_0x593301[_0x94df('0x36')];if(!_0x4c0a41['query'][_0x94df('0x56')](_0x94df('0x57'))){_0xac8aea[_0x94df('0x1f')]=qs[_0x94df('0x1f')](_0x4c0a41[_0x94df('0x33')][_0x94df('0x1f')]);_0xac8aea[_0x94df('0x21')]=qs['offset'](_0x4c0a41[_0x94df('0x33')]['offset']);}_0xac8aea[_0x94df('0x6b')]=qs[_0x94df('0x3b')](_0x4c0a41['query'][_0x94df('0x3b')]);_0xac8aea['where']=qs[_0x94df('0x35')](_[_0x94df('0x3d')](_0x4c0a41['query'],_0x593301[_0x94df('0x35')]));_0xac8aea['raw']=!![];if(_0x4c0a41['query'][_0x94df('0x3e')]){_0xac8aea[_0x94df('0x3c')]=_[_0x94df('0x3f')](_0xac8aea[_0x94df('0x3c')],{'$or':_['map'](_0xac8aea[_0x94df('0x37')],function(_0x2750dd){var _0x944316={};_0x944316[_0x2750dd]={'$like':'%'+_0x4c0a41[_0x94df('0x33')][_0x94df('0x3e')]+'%'};return _0x944316;})});}_0xac8aea=_[_0x94df('0x3f')]({},_0xac8aea,_0x4c0a41['options']);return _0x38983b[_0x94df('0x66')](_0xac8aea);}})[_0x94df('0x26')](respondWithResult(_0x1e0ae7,null))['catch'](handleError(_0x1e0ae7,null));};exports['getContactsCsv']=function(_0x3d3a4e,_0x5a2273,_0x1129ff){var _0x3269b2;return db['CmList'][_0x94df('0x46')]({'where':{'id':_0x3d3a4e['params']['id']},'include':[{'model':db[_0x94df('0x67')],'as':'CustomFields'}]})[_0x94df('0x26')](handleEntityNotFound(_0x5a2273,null))['then'](function(_0x2e773d){if(_0x2e773d){_0x3269b2=_0x2e773d;return db[_0x94df('0x5c')][_0x94df('0x31')];}})[_0x94df('0x26')](function(_0x230163){if(_0x230163){var _0x7e2226={};var _0x1d0f66={};_0x1d0f66['model']=_[_0x94df('0x69')](_['keys'](_0x230163),_[_0x94df('0x2f')](_0x3269b2[_0x94df('0x68')],function(_0xad66d2){return util[_0x94df('0x6a')](_0x94df('0x6c'),_0xad66d2['id']);}));_0x1d0f66[_0x94df('0x33')]=_[_0x94df('0x34')](_0x3d3a4e[_0x94df('0x33')]);_0x1d0f66[_0x94df('0x35')]=_['intersection'](_0x1d0f66['model'],_0x1d0f66[_0x94df('0x33')]);_0x7e2226[_0x94df('0x37')]=_[_0x94df('0x38')](_0x1d0f66[_0x94df('0x36')],qs[_0x94df('0x39')](_0x3d3a4e[_0x94df('0x33')][_0x94df('0x39')]));_0x7e2226[_0x94df('0x37')]=_0x7e2226[_0x94df('0x37')][_0x94df('0x3a')]?_0x7e2226[_0x94df('0x37')]:_0x1d0f66[_0x94df('0x36')];if(!_0x3d3a4e[_0x94df('0x33')][_0x94df('0x56')](_0x94df('0x57'))){_0x7e2226[_0x94df('0x1f')]=qs[_0x94df('0x1f')](_0x3d3a4e[_0x94df('0x33')]['limit']);_0x7e2226[_0x94df('0x21')]=qs[_0x94df('0x21')](_0x3d3a4e[_0x94df('0x33')][_0x94df('0x21')]);}_0x7e2226[_0x94df('0x6b')]=qs['sort'](_0x3d3a4e[_0x94df('0x33')][_0x94df('0x3b')]);_0x7e2226[_0x94df('0x3c')]=qs[_0x94df('0x35')](_[_0x94df('0x3d')](_0x3d3a4e[_0x94df('0x33')],_0x1d0f66[_0x94df('0x35')]));_0x7e2226[_0x94df('0x6d')]=!![];if(_0x3d3a4e[_0x94df('0x33')]['filter']){_0x7e2226['where']=_[_0x94df('0x3f')](_0x7e2226[_0x94df('0x3c')],{'$or':_[_0x94df('0x2f')](_0x7e2226[_0x94df('0x37')],function(_0xa0d208){var _0x4347be={};_0x4347be[_0xa0d208]={'$like':'%'+_0x3d3a4e[_0x94df('0x33')][_0x94df('0x3e')]+'%'};return _0x4347be;})});}_0x7e2226=_['merge']({},_0x7e2226,_0x3d3a4e[_0x94df('0x40')]);return _0x3269b2[_0x94df('0x66')](_0x7e2226);}})[_0x94df('0x26')](function(_0x35bf65){if(!_[_0x94df('0x6e')](_0x35bf65)){var _0x1686bf=toCsv(_0x35bf65);var _0x252ff5=Date['now']();fs[_0x94df('0x6f')](util['format'](_0x94df('0x70'),_0x3269b2['id'],_0x252ff5),_0x1686bf);_0x5a2273[_0x94df('0x71')](_0x94df('0x72'),_0x94df('0x73')+util[_0x94df('0x6a')](_0x94df('0x74'),_0x3269b2['id'],_0x252ff5));_0x5a2273[_0x94df('0x71')]('Content-type',_0x94df('0x75'));return _0x5a2273['download'](util['format'](_0x94df('0x70'),_0x3269b2['id'],_0x252ff5));}else{return _0x5a2273[_0x94df('0x1a')](0xcc);}})[_0x94df('0x47')](handleError(_0x5a2273,null));};exports[_0x94df('0x76')]=function(_0x458d2c,_0x33fa9b,_0x50c7aa){var _0xdbd467;delete _0x458d2c[_0x94df('0x49')]['id'];return db[_0x94df('0x30')]['findOne']({'where':{'id':_0x458d2c[_0x94df('0x45')]['id']}})[_0x94df('0x26')](handleEntityNotFound(_0x33fa9b,null))['then'](function(_0xc1389b){if(_0xc1389b){return db[_0x94df('0x77')][_0x94df('0x78')](function(_0x23d155){return db['CmCustomField'][_0x94df('0x48')](_0x458d2c[_0x94df('0x49')],{'transaction':_0x23d155})['then'](function(_0x3a873d){_0xdbd467=_0x3a873d;return _0xc1389b[_0x94df('0x79')](_0x3a873d,{'transaction':_0x23d155});})[_0x94df('0x26')](function(){var _0x18d0f2={'type':db[_0x94df('0x7a')][_0x94df('0x7b')],'transaction':_0x23d155};switch(_0x458d2c[_0x94df('0x49')][_0x94df('0x32')]){case'text':_0x18d0f2['type']=db[_0x94df('0x7a')][_0x94df('0x7b')];break;case'number':_0x18d0f2[_0x94df('0x32')]=db['Sequelize']['INTEGER'];break;case _0x94df('0x7c'):_0x18d0f2[_0x94df('0x32')]=db[_0x94df('0x7a')][_0x94df('0x7d')];_0x18d0f2[_0x94df('0x7e')]=![];break;default:}return db[_0x94df('0x77')][_0x94df('0x7f')][_0x94df('0x80')](_0x94df('0x81'),util['format'](_0x94df('0x82'),_0xdbd467['id']),_0x18d0f2);})[_0x94df('0x26')](function(){return _0xdbd467;});});}})[_0x94df('0x26')](respondWithResult(_0x33fa9b,null))[_0x94df('0x47')](handleError(_0x33fa9b,null));};exports[_0x94df('0x83')]=function(_0x2d36c8,_0x37a5ba,_0x36f0ba){var _0x48df02={};var _0x39dca4={};var _0x282030;var _0x4cdeaf;return db[_0x94df('0x30')][_0x94df('0x84')]({'where':{'id':_0x2d36c8[_0x94df('0x45')]['id']}})['then'](handleEntityNotFound(_0x37a5ba,null))[_0x94df('0x26')](function(_0x2d8204){if(_0x2d8204){_0x282030=_0x2d8204;_0x39dca4[_0x94df('0x36')]=_[_0x94df('0x34')](db['CmCustomField'][_0x94df('0x31')]);_0x39dca4[_0x94df('0x33')]=_[_0x94df('0x34')](_0x2d36c8[_0x94df('0x33')]);_0x39dca4[_0x94df('0x35')]=_[_0x94df('0x38')](_0x39dca4[_0x94df('0x36')],_0x39dca4[_0x94df('0x33')]);_0x48df02[_0x94df('0x37')]=_[_0x94df('0x38')](_0x39dca4[_0x94df('0x36')],qs[_0x94df('0x39')](_0x2d36c8['query']['fields']));_0x48df02[_0x94df('0x37')]=_0x48df02['attributes'][_0x94df('0x3a')]?_0x48df02['attributes']:_0x39dca4['model'];_0x48df02[_0x94df('0x6b')]=qs[_0x94df('0x3b')](_0x2d36c8[_0x94df('0x33')][_0x94df('0x3b')]);_0x48df02[_0x94df('0x3c')]=qs[_0x94df('0x35')](_[_0x94df('0x3d')](_0x2d36c8['query'],_0x39dca4[_0x94df('0x35')]));_0x48df02[_0x94df('0x3c')]=_[_0x94df('0x3f')](_0x48df02[_0x94df('0x3c')],{'$or':[{'ListId':_0x2d8204['id']},{'ListId':null}]});if(_0x2d36c8[_0x94df('0x33')]['filter']){_0x48df02[_0x94df('0x3c')]=_[_0x94df('0x3f')](_0x48df02[_0x94df('0x3c')],{'$or':_[_0x94df('0x2f')](_0x48df02['attributes'],function(_0x3245c6){var _0x66dc84={};_0x66dc84[_0x3245c6]={'$like':'%'+_0x2d36c8[_0x94df('0x33')][_0x94df('0x3e')]+'%'};return _0x66dc84;})});}_0x48df02=_[_0x94df('0x3f')]({},_0x48df02,_0x2d36c8['options']);return db[_0x94df('0x67')][_0x94df('0x85')](_0x48df02);}})[_0x94df('0x26')](respondWithResult(_0x37a5ba,null))[_0x94df('0x47')](handleError(_0x37a5ba,null));};exports[_0x94df('0x86')]=function(_0x394634,_0x568a34,_0x27f4f7){return db[_0x94df('0x30')][_0x94df('0x46')]({'where':{'id':_0x394634[_0x94df('0x45')]['id']}})[_0x94df('0x26')](handleEntityNotFound(_0x568a34,null))[_0x94df('0x26')](function(_0xdba302){if(_0xdba302){return _0xdba302['addAgents'](_0x394634[_0x94df('0x49')][_0x94df('0x5a')],_[_0x94df('0x87')](_0x394634[_0x94df('0x49')],['ids','id'])||{})['spread'](function(_0x147bac){for(var _0x1e364b=0x0;_0x1e364b<_0x394634[_0x94df('0x49')][_0x94df('0x5a')]['length'];_0x1e364b+=0x1){socket[_0x94df('0x88')](_0x94df('0x89'),{'UserId':Number(_0x394634[_0x94df('0x49')]['ids'][_0x1e364b]),'CmListId':Number(_0x394634['params']['id'])});}return _0x147bac;});}})[_0x94df('0x26')](respondWithResult(_0x568a34,null))['catch'](handleError(_0x568a34,null));};exports[_0x94df('0x8a')]=function(_0x422059,_0x3dfde4,_0x17c3dd){return db['CmList'][_0x94df('0x46')]({'where':{'id':_0x422059[_0x94df('0x45')]['id']}})['then'](handleEntityNotFound(_0x3dfde4,null))[_0x94df('0x26')](function(_0x15eb82){if(_0x15eb82){return _0x15eb82[_0x94df('0x8a')](_0x422059[_0x94df('0x33')][_0x94df('0x5a')])[_0x94df('0x26')](function(){if(_[_0x94df('0x5e')](_0x422059[_0x94df('0x33')][_0x94df('0x5a')])){for(var _0xe8034d=0x0;_0xe8034d<_0x422059[_0x94df('0x33')][_0x94df('0x5a')]['length'];_0xe8034d+=0x1){socket[_0x94df('0x88')]('userCmList:remove',{'UserId':Number(_0x422059[_0x94df('0x33')][_0x94df('0x5a')][_0xe8034d]),'CmListId':Number(_0x422059[_0x94df('0x45')]['id'])});}}else{socket[_0x94df('0x88')](_0x94df('0x8b'),{'UserId':Number(_0x422059[_0x94df('0x33')]['ids']),'CmListId':Number(_0x422059['params']['id'])});}});}})[_0x94df('0x26')](respondWithStatusCode(_0x3dfde4,null))[_0x94df('0x47')](handleError(_0x3dfde4,null));};exports[_0x94df('0x8c')]=function(_0x1a9080,_0x5048dc,_0x1f346d){var _0x7d8206={};var _0x2ff5a1={};var _0xf3e81b;var _0x55a8e6;return db[_0x94df('0x30')][_0x94df('0x84')]({'where':{'id':_0x1a9080[_0x94df('0x45')]['id']}})[_0x94df('0x26')](handleEntityNotFound(_0x5048dc,null))[_0x94df('0x26')](function(_0x5022ac){if(_0x5022ac){_0xf3e81b=_0x5022ac;_0x2ff5a1[_0x94df('0x36')]=_[_0x94df('0x34')](db[_0x94df('0x8d')]['rawAttributes']);_0x2ff5a1[_0x94df('0x33')]=_[_0x94df('0x34')](_0x1a9080[_0x94df('0x33')]);_0x2ff5a1['filters']=_[_0x94df('0x38')](_0x2ff5a1[_0x94df('0x36')],_0x2ff5a1[_0x94df('0x33')]);_0x7d8206[_0x94df('0x37')]=_['intersection'](_0x2ff5a1[_0x94df('0x36')],qs[_0x94df('0x39')](_0x1a9080[_0x94df('0x33')]['fields']));_0x7d8206[_0x94df('0x37')]=_0x7d8206[_0x94df('0x37')][_0x94df('0x3a')]?_0x7d8206[_0x94df('0x37')]:_0x2ff5a1['model'];_0x7d8206[_0x94df('0x6b')]=qs[_0x94df('0x3b')](_0x1a9080[_0x94df('0x33')][_0x94df('0x3b')]);_0x7d8206[_0x94df('0x3c')]=qs[_0x94df('0x35')](_[_0x94df('0x3d')](_0x1a9080[_0x94df('0x33')],_0x2ff5a1[_0x94df('0x35')]));if(_0x1a9080[_0x94df('0x33')]['filter']){_0x7d8206[_0x94df('0x3c')]=_[_0x94df('0x3f')](_0x7d8206[_0x94df('0x3c')],{'$or':_[_0x94df('0x2f')](_0x7d8206['attributes'],function(_0x7377fc){var _0x21eb56={};_0x21eb56[_0x7377fc]={'$like':'%'+_0x1a9080[_0x94df('0x33')]['filter']+'%'};return _0x21eb56;})});}_0x7d8206=_['merge']({},_0x7d8206,_0x1a9080[_0x94df('0x40')]);return _0xf3e81b['getAgents'](_0x7d8206);}})[_0x94df('0x26')](function(_0x3d374c){if(_0x3d374c){_0x55a8e6=_0x3d374c[_0x94df('0x3a')];if(!_0x1a9080[_0x94df('0x33')][_0x94df('0x56')]('nolimit')){_0x7d8206[_0x94df('0x1f')]=qs[_0x94df('0x1f')](_0x1a9080[_0x94df('0x33')][_0x94df('0x1f')]);_0x7d8206[_0x94df('0x21')]=qs[_0x94df('0x21')](_0x1a9080[_0x94df('0x33')][_0x94df('0x21')]);}return _0xf3e81b['getAgents'](_0x7d8206);}})[_0x94df('0x26')](function(_0xae27ca){if(_0xae27ca){return _0xae27ca?{'count':_0x55a8e6,'rows':_0xae27ca}:null;}})[_0x94df('0x26')](respondWithResult(_0x5048dc,null))[_0x94df('0x47')](handleError(_0x5048dc,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 1e06802..71f2220 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0x5fc3[_0x376db5];return _0x304c17;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x53661f,_0x5829fe){var _0x4f66e3=function(_0x27a399){while(--_0x27a399){_0x53661f['push'](_0x53661f['shift']());}};_0x4f66e3(++_0x5829fe);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 9e1a318..fee88ef 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 _0xa8a8=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util'];(function(_0x5ef421,_0x11c273){var _0x59ea99=function(_0x13e745){while(--_0x13e745){_0x5ef421['push'](_0x5ef421['shift']());}};_0x59ea99(++_0x11c273);}(_0xa8a8,0xec));var _0x8a8a=function(_0x53cc3f,_0x41bf88){_0x53cc3f=_0x53cc3f-0x0;var _0x6e4144=_0xa8a8[_0x53cc3f];return _0x6e4144;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var moment=require('moment');var BPromise=require(_0x8a8a('0x4'));var rp=require(_0x8a8a('0x5'));var fs=require('fs');var path=require(_0x8a8a('0x6'));var rimraf=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var attributes=require(_0x8a8a('0x9'));module[_0x8a8a('0xa')]=function(_0x12db82,_0x2e8193){return _0x12db82[_0x8a8a('0xb')](_0x8a8a('0xc'),attributes,{'tableName':_0x8a8a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c81=['moment','../../config/environment','./cmList.attributes','exports','define','CmList','lodash','util','api'];(function(_0x58aa21,_0x524475){var _0x5c6b63=function(_0x2d4878){while(--_0x2d4878){_0x58aa21['push'](_0x58aa21['shift']());}};_0x5c6b63(++_0x524475);}(_0x3c81,0x102));var _0x13c8=function(_0x29d197,_0x3691a9){_0x29d197=_0x29d197-0x0;var _0xfc7d6f=_0x3c81[_0x29d197];return _0xfc7d6f;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var logger=require('../../config/logger')(_0x13c8('0x2'));var moment=require(_0x13c8('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(_0x13c8('0x4'));var attributes=require(_0x13c8('0x5'));module[_0x13c8('0x6')]=function(_0x1c16f1,_0x2a4d66){return _0x1c16f1[_0x13c8('0x7')](_0x13c8('0x8'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 81c829f..bb2a639 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 _0x0d49=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./cmList.socket','register','then','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x27828f,_0x2617e2){var _0x4c8b4f=function(_0x18c0b2){while(--_0x18c0b2){_0x27828f['push'](_0x27828f['shift']());}};_0x4c8b4f(++_0x2617e2);}(_0x0d49,0x1d5));var _0x90d4=function(_0x282244,_0x2596e6){_0x282244=_0x282244-0x0;var _0x1d6440=_0x0d49[_0x282244];return _0x1d6440;};'use strict';var _=require(_0x90d4('0x0'));var util=require(_0x90d4('0x1'));var moment=require(_0x90d4('0x2'));var BPromise=require(_0x90d4('0x3'));var rs=require(_0x90d4('0x4'));var fs=require('fs');var Redis=require(_0x90d4('0x5'));var db=require(_0x90d4('0x6'))['db'];var utils=require(_0x90d4('0x7'));var logger=require(_0x90d4('0x8'))(_0x90d4('0x9'));var config=require('../../config/environment');var jayson=require(_0x90d4('0xa'));var client=jayson['client'][_0x90d4('0xb')]({'port':0x232a});config[_0x90d4('0xc')]=_[_0x90d4('0xd')](config[_0x90d4('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x90d4('0xe'))(new Redis(config[_0x90d4('0xc')]));require(_0x90d4('0xf'))[_0x90d4('0x10')](socket);function respondWithRpcPromise(_0x1aa535,_0x29ba02,_0x231893){return new BPromise(function(_0x15a723,_0x32df7a){return client['request'](_0x1aa535,_0x231893)[_0x90d4('0x11')](function(_0xfa8f84){logger['info'](_0x90d4('0x12'),_0x29ba02,'request\x20sent');logger[_0x90d4('0x13')](_0x90d4('0x14'),_0x29ba02,_0x90d4('0x15'),JSON[_0x90d4('0x16')](_0xfa8f84));if(_0xfa8f84[_0x90d4('0x17')]){if(_0xfa8f84['error'][_0x90d4('0x18')]===0x1f4){logger[_0x90d4('0x17')](_0x90d4('0x12'),_0x29ba02,_0xfa8f84[_0x90d4('0x17')][_0x90d4('0x19')]);return _0x32df7a(_0xfa8f84[_0x90d4('0x17')][_0x90d4('0x19')]);}logger[_0x90d4('0x17')](_0x90d4('0x12'),_0x29ba02,_0xfa8f84[_0x90d4('0x17')][_0x90d4('0x19')]);return _0x15a723(_0xfa8f84[_0x90d4('0x17')][_0x90d4('0x19')]);}else{logger[_0x90d4('0x1a')](_0x90d4('0x12'),_0x29ba02,_0x90d4('0x15'));_0x15a723(_0xfa8f84[_0x90d4('0x1b')][_0x90d4('0x19')]);}})[_0x90d4('0x1c')](function(_0x1d103b){logger[_0x90d4('0x17')](_0x90d4('0x12'),_0x29ba02,_0x1d103b);_0x32df7a(_0x1d103b);});});} \ No newline at end of file +var _0xbbc8=['register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./cmList.socket'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0xbbc8,0x9b));var _0x8bbc=function(_0x3497cf,_0x422f34){_0x3497cf=_0x3497cf-0x0;var _0x3cb7da=_0xbbc8[_0x3497cf];return _0x3cb7da;};'use strict';var _=require('lodash');var util=require(_0x8bbc('0x0'));var moment=require(_0x8bbc('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bbc('0x2'));var db=require(_0x8bbc('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8bbc('0x4'));var config=require(_0x8bbc('0x5'));var jayson=require(_0x8bbc('0x6'));var client=jayson[_0x8bbc('0x7')][_0x8bbc('0x8')]({'port':0x232a});config['redis']=_[_0x8bbc('0x9')](config[_0x8bbc('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8bbc('0xb'))(new Redis(config['redis']));require(_0x8bbc('0xc'))[_0x8bbc('0xd')](socket);function respondWithRpcPromise(_0x1ee5d3,_0x7bc3b8,_0x504889){return new BPromise(function(_0x4ae6df,_0x12c959){return client[_0x8bbc('0xe')](_0x1ee5d3,_0x504889)[_0x8bbc('0xf')](function(_0x25dec0){logger[_0x8bbc('0x10')](_0x8bbc('0x11'),_0x7bc3b8,_0x8bbc('0x12'));logger['debug'](_0x8bbc('0x13'),_0x7bc3b8,_0x8bbc('0x12'),JSON['stringify'](_0x25dec0));if(_0x25dec0['error']){if(_0x25dec0[_0x8bbc('0x14')]['code']===0x1f4){logger[_0x8bbc('0x14')](_0x8bbc('0x11'),_0x7bc3b8,_0x25dec0['error'][_0x8bbc('0x15')]);return _0x12c959(_0x25dec0[_0x8bbc('0x14')][_0x8bbc('0x15')]);}logger[_0x8bbc('0x14')](_0x8bbc('0x11'),_0x7bc3b8,_0x25dec0[_0x8bbc('0x14')]['message']);return _0x4ae6df(_0x25dec0[_0x8bbc('0x14')][_0x8bbc('0x15')]);}else{logger[_0x8bbc('0x10')]('CmList,\x20%s,\x20%s',_0x7bc3b8,_0x8bbc('0x12'));_0x4ae6df(_0x25dec0[_0x8bbc('0x16')]['message']);}})[_0x8bbc('0x17')](function(_0x4f744d){logger[_0x8bbc('0x14')](_0x8bbc('0x11'),_0x7bc3b8,_0x4f744d);_0x12c959(_0x4f744d);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 2776f91..6c551aa 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 _0x2ae4=['removeListener','register','length','cmList:','./cmList.events','save','remove','emit'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2ae4,0x9c));var _0x42ae=function(_0x13ebc9,_0x528695){_0x13ebc9=_0x13ebc9-0x0;var _0x16c2f3=_0x2ae4[_0x13ebc9];return _0x16c2f3;};'use strict';var CmListEvents=require(_0x42ae('0x0'));var events=[_0x42ae('0x1'),_0x42ae('0x2'),'update'];function createListener(_0x10ebfc,_0x1397b4){return function(_0x53d599){_0x1397b4[_0x42ae('0x3')](_0x10ebfc,_0x53d599);};}function removeListener(_0x363fd9,_0x5debaa){return function(){CmListEvents[_0x42ae('0x4')](_0x363fd9,_0x5debaa);};}exports[_0x42ae('0x5')]=function(_0x2f2792){for(var _0x18b324=0x0,_0x4698b4=events[_0x42ae('0x6')];_0x18b324<_0x4698b4;_0x18b324++){var _0x2bff04=events[_0x18b324];var _0x3b8698=createListener(_0x42ae('0x7')+_0x2bff04,_0x2f2792);CmListEvents['on'](_0x2bff04,_0x3b8698);}}; \ No newline at end of file +var _0x4042=['register','cmList:','./cmList.events','save','remove','update','emit','removeListener'];(function(_0x2f2626,_0x37b58c){var _0x2d8937=function(_0x2cd6f8){while(--_0x2cd6f8){_0x2f2626['push'](_0x2f2626['shift']());}};_0x2d8937(++_0x37b58c);}(_0x4042,0x16a));var _0x2404=function(_0x524a84,_0x55bf89){_0x524a84=_0x524a84-0x0;var _0x462627=_0x4042[_0x524a84];return _0x462627;};'use strict';var CmListEvents=require(_0x2404('0x0'));var events=[_0x2404('0x1'),_0x2404('0x2'),_0x2404('0x3')];function createListener(_0x585e4c,_0x4c69e1){return function(_0x677b3a){_0x4c69e1[_0x2404('0x4')](_0x585e4c,_0x677b3a);};}function removeListener(_0x1f2fac,_0x1fa2e8){return function(){CmListEvents[_0x2404('0x5')](_0x1f2fac,_0x1fa2e8);};}exports[_0x2404('0x6')]=function(_0x35767a){for(var _0xbb96b1=0x0,_0x54d40b=events['length'];_0xbb96b1<_0x54d40b;_0xbb96b1++){var _0x3cafb1=events[_0xbb96b1];var _0x21d14c=createListener(_0x2404('0x7')+_0x3cafb1,_0x35767a);CmListEvents['on'](_0x3cafb1,_0x21d14c);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 474c15a..b1a4202 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 _0x36cf=['/:id/dispositions','addDisposition','addContacts','addAgents','put','update','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','/:id','show','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post'];(function(_0x5e759c,_0x199b91){var _0x13715e=function(_0x30fa0f){while(--_0x30fa0f){_0x5e759c['push'](_0x5e759c['shift']());}};_0x13715e(++_0x199b91);}(_0x36cf,0x70));var _0xf36c=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x36cf[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0xf36c('0x0'));var util=require(_0xf36c('0x1'));var path=require(_0xf36c('0x2'));var timeout=require(_0xf36c('0x3'));var express=require('express');var router=express[_0xf36c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf36c('0x5'));var interaction=require(_0xf36c('0x6'));var config=require(_0xf36c('0x7'));var controller=require(_0xf36c('0x8'));router[_0xf36c('0x9')]('/',auth[_0xf36c('0xa')](),controller[_0xf36c('0xb')]);router['get']('/describe',auth[_0xf36c('0xa')](),controller[_0xf36c('0xc')]);router[_0xf36c('0x9')](_0xf36c('0xd'),auth[_0xf36c('0xa')](),controller[_0xf36c('0xe')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0xf36c('0x9')](_0xf36c('0xf'),auth['isAuthenticated'](),controller[_0xf36c('0x10')]);router[_0xf36c('0x9')](_0xf36c('0x11'),auth[_0xf36c('0xa')](),controller[_0xf36c('0x12')]);router[_0xf36c('0x9')](_0xf36c('0x13'),auth[_0xf36c('0xa')](),controller[_0xf36c('0x14')]);router[_0xf36c('0x9')](_0xf36c('0x15'),auth['isAuthenticated'](),controller[_0xf36c('0x16')]);router[_0xf36c('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf36c('0x17')](_0xf36c('0x18'),auth[_0xf36c('0xa')](),controller[_0xf36c('0x19')]);router[_0xf36c('0x17')](_0xf36c('0xf'),auth[_0xf36c('0xa')](),controller[_0xf36c('0x1a')]);router[_0xf36c('0x17')](_0xf36c('0x13'),auth[_0xf36c('0xa')](),controller['addCustomField']);router[_0xf36c('0x17')]('/:id/users',auth[_0xf36c('0xa')](),controller[_0xf36c('0x1b')]);router[_0xf36c('0x1c')](_0xf36c('0xd'),auth[_0xf36c('0xa')](),controller[_0xf36c('0x1d')]);router[_0xf36c('0x1e')](_0xf36c('0xd'),auth[_0xf36c('0xa')](),controller['destroy']);router[_0xf36c('0x1e')](_0xf36c('0x18'),auth[_0xf36c('0xa')](),controller[_0xf36c('0x1f')]);router['delete'](_0xf36c('0x15'),auth[_0xf36c('0xa')](),controller[_0xf36c('0x20')]);module[_0xf36c('0x21')]=router; \ No newline at end of file +var _0xa850=['/:id/fields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','put','update','delete','destroy','removeDispositions','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','getContactsCsv'];(function(_0x338ae2,_0x4513ee){var _0x4e72bb=function(_0x196655){while(--_0x196655){_0x338ae2['push'](_0x338ae2['shift']());}};_0x4e72bb(++_0x4513ee);}(_0xa850,0xb7));var _0x0a85=function(_0x45ca71,_0x1245f3){_0x45ca71=_0x45ca71-0x0;var _0x36ad3e=_0xa850[_0x45ca71];return _0x36ad3e;};'use strict';var multer=require(_0x0a85('0x0'));var util=require(_0x0a85('0x1'));var path=require(_0x0a85('0x2'));var timeout=require(_0x0a85('0x3'));var express=require(_0x0a85('0x4'));var router=express[_0x0a85('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0a85('0x6'));var interaction=require(_0x0a85('0x7'));var config=require(_0x0a85('0x8'));var controller=require(_0x0a85('0x9'));router[_0x0a85('0xa')]('/',auth['isAuthenticated'](),controller[_0x0a85('0xb')]);router[_0x0a85('0xa')](_0x0a85('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x0a85('0xa')](_0x0a85('0xd'),auth[_0x0a85('0xe')](),controller[_0x0a85('0xf')]);router[_0x0a85('0xa')](_0x0a85('0x10'),auth[_0x0a85('0xe')](),controller[_0x0a85('0x11')]);router[_0x0a85('0xa')](_0x0a85('0x12'),auth[_0x0a85('0xe')](),controller[_0x0a85('0x13')]);router[_0x0a85('0xa')]('/:id/contacts/csv',auth[_0x0a85('0xe')](),controller[_0x0a85('0x14')]);router['get'](_0x0a85('0x15'),auth[_0x0a85('0xe')](),controller['getCustomFields']);router[_0x0a85('0xa')](_0x0a85('0x16'),auth[_0x0a85('0xe')](),controller[_0x0a85('0x17')]);router[_0x0a85('0x18')]('/',auth[_0x0a85('0xe')](),controller[_0x0a85('0x19')]);router[_0x0a85('0x18')](_0x0a85('0x10'),auth[_0x0a85('0xe')](),controller[_0x0a85('0x1a')]);router['post'](_0x0a85('0x12'),auth[_0x0a85('0xe')](),controller[_0x0a85('0x1b')]);router[_0x0a85('0x18')](_0x0a85('0x15'),auth['isAuthenticated'](),controller[_0x0a85('0x1c')]);router['post'](_0x0a85('0x16'),auth[_0x0a85('0xe')](),controller['addAgents']);router[_0x0a85('0x1d')](_0x0a85('0xd'),auth['isAuthenticated'](),controller[_0x0a85('0x1e')]);router[_0x0a85('0x1f')](_0x0a85('0xd'),auth[_0x0a85('0xe')](),controller[_0x0a85('0x20')]);router[_0x0a85('0x1f')]('/:id/dispositions',auth[_0x0a85('0xe')](),controller[_0x0a85('0x21')]);router[_0x0a85('0x1f')](_0x0a85('0x16'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 4ffc9bb..c879221 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 _0xec6a=['field','STRING','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec6a,0x134));var _0xaec6=function(_0x38eb34,_0x592e49){_0x38eb34=_0x38eb34-0x0;var _0x1109ee=_0xec6a[_0x38eb34];return _0x1109ee;};'use strict';var Sequelize=require(_0xaec6('0x0'));module[_0xaec6('0x1')]={'name':{'type':Sequelize[_0xaec6('0x2')],'get':function(_0x19e508){return this[_0xaec6('0x3')](_0xaec6('0x4'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xaec6('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x7f49=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0xdc4aa5,_0x403e60){var _0xe4bda9=function(_0x5f318b){while(--_0x5f318b){_0xdc4aa5['push'](_0xdc4aa5['shift']());}};_0xe4bda9(++_0x403e60);}(_0x7f49,0xbf));var _0x97f4=function(_0x4f6a71,_0x36b6c2){_0x4f6a71=_0x4f6a71-0x0;var _0x1d9b3a=_0x7f49[_0x4f6a71];return _0x1d9b3a;};'use strict';var Sequelize=require(_0x97f4('0x0'));module[_0x97f4('0x1')]={'name':{'type':Sequelize[_0x97f4('0x2')],'get':function(_0x2d6449){return this[_0x97f4('0x3')](_0x97f4('0x4'));}},'field':{'type':Sequelize[_0x97f4('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x97f4('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x97f4('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 692689d..59bdf63 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(_0x5af22c,_0x143d66){var _0x552f8f=function(_0x21e73c){while(--_0x21e73c){_0x5af22c['push'](_0x5af22c['shift']());}};_0x552f8f(++_0x143d66);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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(_0x5976f9,_0x55870e){var _0x1f3121=function(_0x163a74){while(--_0x163a74){_0x5976f9['push'](_0x5976f9['shift']());}};_0x1f3121(++_0x55870e);}(_0x7a54,0x106));var _0x47a5=function(_0x23bbb9,_0x184f68){_0x23bbb9=_0x23bbb9-0x0;var _0x5ce6d9=_0x7a54[_0x23bbb9];return _0x5ce6d9;};'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 736f61d..83ad644 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 _0x58a5=['../../config/environment','./condition.attributes','Condition','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x297b2b,_0x11eb85){var _0x14754b=function(_0x377d2f){while(--_0x377d2f){_0x297b2b['push'](_0x297b2b['shift']());}};_0x14754b(++_0x11eb85);}(_0x58a5,0x135));var _0x558a=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x58a5[_0x4eafed];return _0x159c85;};'use strict';var _=require(_0x558a('0x0'));var util=require('util');var logger=require(_0x558a('0x1'))(_0x558a('0x2'));var moment=require('moment');var BPromise=require(_0x558a('0x3'));var rp=require(_0x558a('0x4'));var fs=require('fs');var path=require(_0x558a('0x5'));var rimraf=require('rimraf');var config=require(_0x558a('0x6'));var attributes=require(_0x558a('0x7'));module['exports']=function(_0x47305a,_0x2f8bb7){return _0x47305a['define'](_0x558a('0x8'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x347e=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./condition.attributes','exports','Condition','tools_conditions','lodash','util'];(function(_0x38f01f,_0x5cbe9d){var _0x2bd563=function(_0x503e65){while(--_0x503e65){_0x38f01f['push'](_0x38f01f['shift']());}};_0x2bd563(++_0x5cbe9d);}(_0x347e,0x1ec));var _0xe347=function(_0x5a9841,_0x950566){_0x5a9841=_0x5a9841-0x0;var _0xb4f748=_0x347e[_0x5a9841];return _0xb4f748;};'use strict';var _=require(_0xe347('0x0'));var util=require(_0xe347('0x1'));var logger=require(_0xe347('0x2'))(_0xe347('0x3'));var moment=require(_0xe347('0x4'));var BPromise=require(_0xe347('0x5'));var rp=require(_0xe347('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe347('0x7'));var config=require(_0xe347('0x8'));var attributes=require(_0xe347('0x9'));module[_0xe347('0xa')]=function(_0xdf9801,_0xf41af7){return _0xdf9801['define'](_0xe347('0xb'),attributes,{'tableName':_0xe347('0xc'),'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 98dc22c..4916d93 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 _0x67af=['info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then'];(function(_0x439cfb,_0x441762){var _0x1e390a=function(_0x26a7f9){while(--_0x26a7f9){_0x439cfb['push'](_0x439cfb['shift']());}};_0x1e390a(++_0x441762);}(_0x67af,0x1ee));var _0xf67a=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0x67af[_0x173f10];return _0x53142d;};'use strict';var _=require('lodash');var util=require(_0xf67a('0x0'));var moment=require(_0xf67a('0x1'));var BPromise=require(_0xf67a('0x2'));var rs=require(_0xf67a('0x3'));var fs=require('fs');var Redis=require(_0xf67a('0x4'));var db=require(_0xf67a('0x5'))['db'];var utils=require(_0xf67a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf67a('0x7'));var jayson=require(_0xf67a('0x8'));var client=jayson[_0xf67a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x491a57,_0x16dad2,_0x57c341){return new BPromise(function(_0x3b0900,_0x29abf8){return client[_0xf67a('0xa')](_0x491a57,_0x57c341)[_0xf67a('0xb')](function(_0x3a0a44){logger[_0xf67a('0xc')](_0xf67a('0xd'),_0x16dad2,_0xf67a('0xe'));logger[_0xf67a('0xf')](_0xf67a('0x10'),_0x16dad2,'request\x20sent',JSON[_0xf67a('0x11')](_0x3a0a44));if(_0x3a0a44[_0xf67a('0x12')]){if(_0x3a0a44[_0xf67a('0x12')][_0xf67a('0x13')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x16dad2,_0x3a0a44[_0xf67a('0x12')][_0xf67a('0x14')]);return _0x29abf8(_0x3a0a44[_0xf67a('0x12')]['message']);}logger[_0xf67a('0x12')]('Condition,\x20%s,\x20%s',_0x16dad2,_0x3a0a44[_0xf67a('0x12')][_0xf67a('0x14')]);return _0x3b0900(_0x3a0a44[_0xf67a('0x12')][_0xf67a('0x14')]);}else{logger[_0xf67a('0xc')](_0xf67a('0xd'),_0x16dad2,_0xf67a('0xe'));_0x3b0900(_0x3a0a44[_0xf67a('0x15')]['message']);}})[_0xf67a('0x16')](function(_0xfa016c){logger[_0xf67a('0x12')]('Condition,\x20%s,\x20%s',_0x16dad2,_0xfa016c);_0x29abf8(_0xfa016c);});});} \ No newline at end of file +var _0xbf56=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch'];(function(_0x49a292,_0x45c4c2){var _0x42b2c0=function(_0x548a17){while(--_0x548a17){_0x49a292['push'](_0x49a292['shift']());}};_0x42b2c0(++_0x45c4c2);}(_0xbf56,0xf7));var _0x6bf5=function(_0x5619d5,_0x33a683){_0x5619d5=_0x5619d5-0x0;var _0x5dd579=_0xbf56[_0x5619d5];return _0x5dd579;};'use strict';var _=require('lodash');var util=require(_0x6bf5('0x0'));var moment=require(_0x6bf5('0x1'));var BPromise=require(_0x6bf5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6bf5('0x3'));var db=require(_0x6bf5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6bf5('0x5'))(_0x6bf5('0x6'));var config=require(_0x6bf5('0x7'));var jayson=require(_0x6bf5('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x180862,_0x14280a,_0x12af5b){return new BPromise(function(_0x106877,_0x1ebfdf){return client[_0x6bf5('0x9')](_0x180862,_0x12af5b)['then'](function(_0x359a48){logger[_0x6bf5('0xa')](_0x6bf5('0xb'),_0x14280a,_0x6bf5('0xc'));logger[_0x6bf5('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x14280a,_0x6bf5('0xc'),JSON['stringify'](_0x359a48));if(_0x359a48[_0x6bf5('0xe')]){if(_0x359a48[_0x6bf5('0xe')][_0x6bf5('0xf')]===0x1f4){logger[_0x6bf5('0xe')]('Condition,\x20%s,\x20%s',_0x14280a,_0x359a48[_0x6bf5('0xe')]['message']);return _0x1ebfdf(_0x359a48[_0x6bf5('0xe')][_0x6bf5('0x10')]);}logger['error']('Condition,\x20%s,\x20%s',_0x14280a,_0x359a48[_0x6bf5('0xe')][_0x6bf5('0x10')]);return _0x106877(_0x359a48[_0x6bf5('0xe')][_0x6bf5('0x10')]);}else{logger[_0x6bf5('0xa')](_0x6bf5('0xb'),_0x14280a,_0x6bf5('0xc'));_0x106877(_0x359a48[_0x6bf5('0x11')][_0x6bf5('0x10')]);}})[_0x6bf5('0x12')](function(_0x1e8405){logger[_0x6bf5('0xe')]('Condition,\x20%s,\x20%s',_0x14280a,_0x1e8405);_0x1ebfdf(_0x1e8405);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 53c8e62..07a5442 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 _0x6239=['isAuthenticated','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id'];(function(_0x4651bd,_0x12a42f){var _0xdf510d=function(_0x12e500){while(--_0x12e500){_0x4651bd['push'](_0x4651bd['shift']());}};_0xdf510d(++_0x12a42f);}(_0x6239,0x144));var _0x9623=function(_0x57ef13,_0x531e2d){_0x57ef13=_0x57ef13-0x0;var _0x2ab789=_0x6239[_0x57ef13];return _0x2ab789;};'use strict';var multer=require(_0x9623('0x0'));var util=require(_0x9623('0x1'));var path=require(_0x9623('0x2'));var timeout=require('connect-timeout');var express=require(_0x9623('0x3'));var router=express[_0x9623('0x4')]();var fs_extra=require(_0x9623('0x5'));var auth=require(_0x9623('0x6'));var interaction=require(_0x9623('0x7'));var config=require(_0x9623('0x8'));var controller=require(_0x9623('0x9'));router[_0x9623('0xa')](_0x9623('0xb'),auth[_0x9623('0xc')](),controller['update']);router[_0x9623('0xd')](_0x9623('0xb'),auth[_0x9623('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9980=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','put','/:id','isAuthenticated','update','delete','destroy'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x9980,0x131));var _0x0998=function(_0x5e05cd,_0x282468){_0x5e05cd=_0x5e05cd-0x0;var _0xe9adbb=_0x9980[_0x5e05cd];return _0xe9adbb;};'use strict';var multer=require(_0x0998('0x0'));var util=require(_0x0998('0x1'));var path=require(_0x0998('0x2'));var timeout=require(_0x0998('0x3'));var express=require(_0x0998('0x4'));var router=express[_0x0998('0x5')]();var fs_extra=require(_0x0998('0x6'));var auth=require(_0x0998('0x7'));var interaction=require(_0x0998('0x8'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x0998('0x9')](_0x0998('0xa'),auth[_0x0998('0xb')](),controller[_0x0998('0xc')]);router[_0x0998('0xd')](_0x0998('0xa'),auth['isAuthenticated'](),controller[_0x0998('0xe')]);module[_0x0998('0xf')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 33ff262..39760bb 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 _0x0713=['STRING','name'];(function(_0x39db49,_0x1b9b0e){var _0x4b3cfc=function(_0x128213){while(--_0x128213){_0x39db49['push'](_0x39db49['shift']());}};_0x4b3cfc(++_0x1b9b0e);}(_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(_0x53ad27,_0x3cb1ec){var _0x48a898=function(_0x47929d){while(--_0x47929d){_0x53ad27['push'](_0x53ad27['shift']());}};_0x48a898(++_0x3cb1ec);}(_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/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index ff95f9a..b9aeec4 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 _0x5c3d=['./dashboard.socket','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','sendStatus','error','stack','name','send','index','map','Dashboard','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardItem','findOne','getItems','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','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','redis','defaults','socket.io-emitter'];(function(_0x235b31,_0x19f6b3){var _0x49d926=function(_0x3ef6e8){while(--_0x3ef6e8){_0x235b31['push'](_0x235b31['shift']());}};_0x49d926(++_0x19f6b3);}(_0x5c3d,0xd3));var _0xd5c3=function(_0x191c92,_0x38a4fc){_0x191c92=_0x191c92-0x0;var _0x574178=_0x5c3d[_0x191c92];return _0x574178;};'use strict';var emlformat=require(_0xd5c3('0x0'));var rimraf=require(_0xd5c3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd5c3('0x2'));var rp=require(_0xd5c3('0x3'));var moment=require(_0xd5c3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd5c3('0x5'));var path=require('path');var sox=require(_0xd5c3('0x6'));var csv=require(_0xd5c3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd5c3('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd5c3('0x9'));var jsforce=require(_0xd5c3('0xa'));var deskjs=require(_0xd5c3('0xb'));var toCsv=require(_0xd5c3('0x7'));var querystring=require(_0xd5c3('0xc'));var Papa=require(_0xd5c3('0xd'));var Redis=require(_0xd5c3('0xe'));var authService=require(_0xd5c3('0xf'));var qs=require(_0xd5c3('0x10'));var as=require(_0xd5c3('0x11'));var hardwareService=require(_0xd5c3('0x12'));var logger=require(_0xd5c3('0x13'))(_0xd5c3('0x14'));var utils=require(_0xd5c3('0x15'));var config=require(_0xd5c3('0x16'));var licenseUtil=require(_0xd5c3('0x17'));var db=require('../../mysqldb')['db'];config[_0xd5c3('0x18')]=_[_0xd5c3('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd5c3('0x1a'))(new Redis(config['redis']));require(_0xd5c3('0x1b'))['register'](socket);function respondWithStatusCode(_0x5b2298,_0x2110f7){_0x2110f7=_0x2110f7||0xcc;return function(_0x21c6f2){if(_0x21c6f2){return _0x5b2298['sendStatus'](_0x2110f7);}return _0x5b2298[_0xd5c3('0x1c')](_0x2110f7)[_0xd5c3('0x1d')]();};}function respondWithResult(_0x366fb8,_0x5b8fa0){_0x5b8fa0=_0x5b8fa0||0xc8;return function(_0x575bc3){if(_0x575bc3){return _0x366fb8[_0xd5c3('0x1c')](_0x5b8fa0)[_0xd5c3('0x1e')](_0x575bc3);}};}function respondWithFilteredResult(_0x239812,_0x2ea022){return function(_0x1c26c6){if(_0x1c26c6){var _0x327184=typeof _0x2ea022[_0xd5c3('0x1f')]==='undefined'&&typeof _0x2ea022[_0xd5c3('0x20')]===_0xd5c3('0x21');var _0x3d1854=_0x1c26c6[_0xd5c3('0x22')];var _0x2a2463=_0x327184?0x0:_0x2ea022['offset'];var _0x2a0814=_0x327184?_0x1c26c6[_0xd5c3('0x22')]:_0x2ea022['offset']+_0x2ea022[_0xd5c3('0x20')];var _0x5140ba;if(_0x2a0814>=_0x3d1854){_0x2a0814=_0x3d1854;_0x5140ba=0xc8;}else{_0x5140ba=0xce;}_0x239812[_0xd5c3('0x1c')](_0x5140ba);return _0x239812[_0xd5c3('0x23')](_0xd5c3('0x24'),_0x2a2463+'-'+_0x2a0814+'/'+_0x3d1854)['json'](_0x1c26c6);}return null;};}function patchUpdates(_0x3af170){return function(_0x5395cc){try{jsonpatch[_0xd5c3('0x25')](_0x5395cc,_0x3af170,!![]);}catch(_0x92030e){return BPromise[_0xd5c3('0x26')](_0x92030e);}return _0x5395cc[_0xd5c3('0x27')]();};}function saveUpdates(_0x58b4c8,_0xe6d2db){return function(_0x3619a8){if(_0x3619a8){return _0x3619a8['update'](_0x58b4c8)[_0xd5c3('0x28')](function(_0x248fd1){return _0x248fd1;});}return null;};}function removeEntity(_0x2b5dc5,_0xd1dfc7){return function(_0x59c294){if(_0x59c294){return _0x59c294[_0xd5c3('0x29')]()[_0xd5c3('0x28')](function(){var _0x9096c4=_0x59c294[_0xd5c3('0x2a')]({'plain':!![]});var _0x3f779f=_0xd5c3('0x2b');return db[_0xd5c3('0x2c')][_0xd5c3('0x29')]({'where':{'type':_0x3f779f,'resourceId':_0x9096c4['id']}})[_0xd5c3('0x28')](function(){return _0x59c294;});})[_0xd5c3('0x28')](function(){_0x2b5dc5[_0xd5c3('0x1c')](0xcc)[_0xd5c3('0x1d')]();});}};}function handleEntityNotFound(_0x1413d3,_0x3a10a9){return function(_0x2e3711){if(!_0x2e3711){_0x1413d3[_0xd5c3('0x2d')](0x194);}return _0x2e3711;};}function handleError(_0x149348,_0x1d72df){_0x1d72df=_0x1d72df||0x1f4;return function(_0x34e079){logger[_0xd5c3('0x2e')](_0x34e079[_0xd5c3('0x2f')]);if(_0x34e079[_0xd5c3('0x30')]){delete _0x34e079[_0xd5c3('0x30')];}_0x149348[_0xd5c3('0x1c')](_0x1d72df)[_0xd5c3('0x31')](_0x34e079);};}exports[_0xd5c3('0x32')]=function(_0x505b6d,_0x3d6586){var _0x52a7c2={},_0x65eda7={},_0x2c1062={'count':0x0,'rows':[]};var _0x50485e=_[_0xd5c3('0x33')](db[_0xd5c3('0x34')]['rawAttributes'],function(_0x5c2c43){return{'name':_0x5c2c43[_0xd5c3('0x35')],'type':_0x5c2c43[_0xd5c3('0x36')][_0xd5c3('0x37')]};});_0x65eda7[_0xd5c3('0x38')]=_[_0xd5c3('0x33')](_0x50485e,_0xd5c3('0x30'));_0x65eda7[_0xd5c3('0x39')]=_[_0xd5c3('0x3a')](_0x505b6d[_0xd5c3('0x39')]);_0x65eda7['filters']=_[_0xd5c3('0x3b')](_0x65eda7['model'],_0x65eda7[_0xd5c3('0x39')]);_0x52a7c2[_0xd5c3('0x3c')]=_[_0xd5c3('0x3b')](_0x65eda7[_0xd5c3('0x38')],qs[_0xd5c3('0x3d')](_0x505b6d[_0xd5c3('0x39')][_0xd5c3('0x3d')]));_0x52a7c2['attributes']=_0x52a7c2[_0xd5c3('0x3c')][_0xd5c3('0x3e')]?_0x52a7c2[_0xd5c3('0x3c')]:_0x65eda7['model'];if(!_0x505b6d[_0xd5c3('0x39')][_0xd5c3('0x3f')](_0xd5c3('0x40'))){_0x52a7c2[_0xd5c3('0x20')]=qs['limit'](_0x505b6d[_0xd5c3('0x39')]['limit']);_0x52a7c2[_0xd5c3('0x1f')]=qs['offset'](_0x505b6d[_0xd5c3('0x39')][_0xd5c3('0x1f')]);}_0x52a7c2[_0xd5c3('0x41')]=qs['sort'](_0x505b6d[_0xd5c3('0x39')][_0xd5c3('0x42')]);_0x52a7c2[_0xd5c3('0x43')]=qs[_0xd5c3('0x44')](_[_0xd5c3('0x45')](_0x505b6d[_0xd5c3('0x39')],_0x65eda7[_0xd5c3('0x44')]),_0x50485e);if(_0x505b6d['query'][_0xd5c3('0x46')]){_0x52a7c2[_0xd5c3('0x43')]=_[_0xd5c3('0x47')](_0x52a7c2[_0xd5c3('0x43')],{'$or':_[_0xd5c3('0x33')](_0x50485e,function(_0x34aefe){if(_0x34aefe['type']!=='VIRTUAL'){var _0xf3e005={};_0xf3e005[_0x34aefe[_0xd5c3('0x30')]]={'$like':'%'+_0x505b6d['query'][_0xd5c3('0x46')]+'%'};return _0xf3e005;}})});}_0x52a7c2=_['merge']({},_0x52a7c2,_0x505b6d[_0xd5c3('0x48')]);var _0x3f5c68={'where':_0x52a7c2['where']};return db[_0xd5c3('0x34')]['count'](_0x3f5c68)['then'](function(_0x3b8737){_0x2c1062['count']=_0x3b8737;if(_0x505b6d[_0xd5c3('0x39')][_0xd5c3('0x49')]){_0x52a7c2[_0xd5c3('0x4a')]=[{'all':!![]}];}return db[_0xd5c3('0x34')][_0xd5c3('0x4b')](_0x52a7c2);})[_0xd5c3('0x28')](function(_0x14f369){_0x2c1062[_0xd5c3('0x4c')]=_0x14f369;return _0x2c1062;})[_0xd5c3('0x28')](respondWithFilteredResult(_0x3d6586,_0x52a7c2))[_0xd5c3('0x4d')](handleError(_0x3d6586,null));};exports[_0xd5c3('0x4e')]=function(_0x5573a0,_0x328bf0){var _0x1a270d={'raw':![],'where':{'id':_0x5573a0[_0xd5c3('0x4f')]['id']}},_0x38dace={};_0x38dace[_0xd5c3('0x38')]=_['keys'](db[_0xd5c3('0x34')][_0xd5c3('0x50')]);_0x38dace['query']=_[_0xd5c3('0x3a')](_0x5573a0[_0xd5c3('0x39')]);_0x38dace[_0xd5c3('0x44')]=_[_0xd5c3('0x3b')](_0x38dace[_0xd5c3('0x38')],_0x38dace[_0xd5c3('0x39')]);_0x1a270d[_0xd5c3('0x3c')]=_[_0xd5c3('0x3b')](_0x38dace[_0xd5c3('0x38')],qs[_0xd5c3('0x3d')](_0x5573a0[_0xd5c3('0x39')][_0xd5c3('0x3d')]));_0x1a270d[_0xd5c3('0x3c')]=_0x1a270d[_0xd5c3('0x3c')]['length']?_0x1a270d[_0xd5c3('0x3c')]:_0x38dace[_0xd5c3('0x38')];if(_0x5573a0['query']['includeAll']){_0x1a270d['include']=[{'all':!![]}];}_0x1a270d=_[_0xd5c3('0x47')]({},_0x1a270d,_0x5573a0[_0xd5c3('0x48')]);return db['Dashboard']['find'](_0x1a270d)[_0xd5c3('0x28')](handleEntityNotFound(_0x328bf0,null))[_0xd5c3('0x28')](respondWithResult(_0x328bf0,null))['catch'](handleError(_0x328bf0,null));};exports[_0xd5c3('0x51')]=function(_0x368d44,_0xdb901b){return db[_0xd5c3('0x34')][_0xd5c3('0x51')](_0x368d44[_0xd5c3('0x52')],{})[_0xd5c3('0x28')](function(_0x4dc3f8){var _0x45b0df=_0x368d44[_0xd5c3('0x53')][_0xd5c3('0x2a')]({'plain':!![]});if(!_0x45b0df)throw new Error(_0xd5c3('0x54'));if(_0x45b0df[_0xd5c3('0x55')]===_0xd5c3('0x53')){var _0x1fb612=_0x4dc3f8[_0xd5c3('0x2a')]({'plain':!![]});var _0x181c71=_0xd5c3('0x2b');return db['UserProfileSection'][_0xd5c3('0x56')]({'where':{'name':_0x181c71,'userProfileId':_0x45b0df[_0xd5c3('0x57')]},'raw':!![]})[_0xd5c3('0x28')](function(_0x5e2728){if(_0x5e2728&&_0x5e2728[_0xd5c3('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x1fb612['name'],'resourceId':_0x1fb612['id'],'type':_0x5e2728['name'],'sectionId':_0x5e2728['id']},{})['then'](function(){return _0x4dc3f8;});}else{return _0x4dc3f8;}})[_0xd5c3('0x4d')](function(_0x2a018a){logger[_0xd5c3('0x2e')](_0xd5c3('0x59'),_0x2a018a);throw _0x2a018a;});}return _0x4dc3f8;})[_0xd5c3('0x28')](respondWithResult(_0xdb901b,0xc9))[_0xd5c3('0x4d')](handleError(_0xdb901b,null));};exports[_0xd5c3('0x5a')]=function(_0x49e429,_0x5b842a){var _0x2a8f6d={'where':{'id':_0x49e429[_0xd5c3('0x4f')]['id']}},_0xcf4342={};_0xcf4342[_0xd5c3('0x38')]=_['keys'](db[_0xd5c3('0x34')][_0xd5c3('0x50')]);_0x2a8f6d[_0xd5c3('0x3c')]=_[_0xd5c3('0x3b')](_0xcf4342['model'],qs[_0xd5c3('0x3d')](_0x49e429[_0xd5c3('0x39')][_0xd5c3('0x3d')]));_0x2a8f6d[_0xd5c3('0x3c')]=_0x2a8f6d[_0xd5c3('0x3c')][_0xd5c3('0x3e')]?_0x2a8f6d[_0xd5c3('0x3c')]:_0xcf4342[_0xd5c3('0x38')];if(_0x49e429[_0xd5c3('0x39')][_0xd5c3('0x49')]){_0x2a8f6d[_0xd5c3('0x4a')]=[{'all':!![]}];}_0x2a8f6d=_[_0xd5c3('0x47')]({},_0x2a8f6d,_0x49e429[_0xd5c3('0x48')]);return db[_0xd5c3('0x34')][_0xd5c3('0x56')](_0x2a8f6d)[_0xd5c3('0x28')](handleEntityNotFound(_0x5b842a,null))[_0xd5c3('0x28')](function(_0x29adcd){if(_0x29adcd){var _0x4fd127=_0x29adcd[_0xd5c3('0x2a')]({'plain':!![]});_0x4fd127=qs['omit'](_0x4fd127,['id',_0xd5c3('0x5b'),_0xd5c3('0x5c')]);_0x49e429[_0xd5c3('0x52')]=_[_0xd5c3('0x5d')](_0x49e429[_0xd5c3('0x52')],['id',_0xd5c3('0x5b'),_0xd5c3('0x5c')]);return db[_0xd5c3('0x34')]['create'](_[_0xd5c3('0x47')](_0x4fd127,_0x49e429[_0xd5c3('0x52')]),{'include':_0x49e429[_0xd5c3('0x39')]['includeAll']?[{'all':!![]}]:undefined})[_0xd5c3('0x28')](function(_0x5f356){var _0x46a069=_0x49e429[_0xd5c3('0x53')][_0xd5c3('0x2a')]({'plain':!![]});if(!_0x46a069)throw new Error(_0xd5c3('0x54'));if(_0x46a069[_0xd5c3('0x55')]===_0xd5c3('0x53')){var _0x260bec=_0x5f356[_0xd5c3('0x2a')]({'plain':!![]});var _0xcf40a7=_0xd5c3('0x2b');return db['UserProfileSection'][_0xd5c3('0x56')]({'where':{'name':_0xcf40a7,'userProfileId':_0x46a069[_0xd5c3('0x57')]},'raw':!![]})[_0xd5c3('0x28')](function(_0x251e70){if(_0x251e70&&_0x251e70[_0xd5c3('0x58')]===0x0){return db[_0xd5c3('0x2c')]['create']({'name':_0x260bec['name'],'resourceId':_0x260bec['id'],'type':_0x251e70[_0xd5c3('0x30')],'sectionId':_0x251e70['id']},{})[_0xd5c3('0x28')](function(){return _0x5f356;});}else{return _0x5f356;}})['catch'](function(_0x1b9207){logger[_0xd5c3('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b9207);throw _0x1b9207;});}return _0x5f356;});}})[_0xd5c3('0x28')](respondWithResult(_0x5b842a,0xc9))[_0xd5c3('0x4d')](handleError(_0x5b842a,null));};exports['update']=function(_0x5cb8b8,_0x5bd35b){if(_0x5cb8b8[_0xd5c3('0x52')]['id']){delete _0x5cb8b8[_0xd5c3('0x52')]['id'];}return db[_0xd5c3('0x34')][_0xd5c3('0x56')]({'where':{'id':_0x5cb8b8[_0xd5c3('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5bd35b,null))[_0xd5c3('0x28')](saveUpdates(_0x5cb8b8['body'],null))[_0xd5c3('0x28')](respondWithResult(_0x5bd35b,null))[_0xd5c3('0x4d')](handleError(_0x5bd35b,null));};exports[_0xd5c3('0x29')]=function(_0x4645e,_0x15048c){return db[_0xd5c3('0x34')]['find']({'where':{'id':_0x4645e[_0xd5c3('0x4f')]['id']}})[_0xd5c3('0x28')](handleEntityNotFound(_0x15048c,null))[_0xd5c3('0x28')](removeEntity(_0x15048c,null))[_0xd5c3('0x4d')](handleError(_0x15048c,null));};function widgetAttributes(_0x3d3c9f){try{switch(_0x3d3c9f['type']){case _0xd5c3('0x5e'):return[{'name':_0xd5c3('0x5f'),'value':_0x3d3c9f[_0xd5c3('0x5f')]||(_0x3d3c9f[_0xd5c3('0x60')]&&_0x3d3c9f[_0xd5c3('0x60')][0x0]?_0x3d3c9f['attrs'][0x0]['value']:undefined)||'https://'}];case _0xd5c3('0x61'):return[{'name':_0xd5c3('0x62'),'value':_0x3d3c9f[_0xd5c3('0x62')]||(_0x3d3c9f[_0xd5c3('0x60')]&&_0x3d3c9f[_0xd5c3('0x60')][0x0]?_0x3d3c9f[_0xd5c3('0x60')][0x0][_0xd5c3('0x63')]:undefined)||''}];case _0xd5c3('0x64'):return[{'name':_0xd5c3('0x65'),'value':_0x3d3c9f[_0xd5c3('0x65')]||(_0x3d3c9f[_0xd5c3('0x60')]&&_0x3d3c9f['attrs'][0x0]?_0x3d3c9f[_0xd5c3('0x60')][0x0][_0xd5c3('0x63')]:undefined)||_0xd5c3('0x66')},{'name':'attrTimezone','value':_0x3d3c9f['attrTimezone']||(_0x3d3c9f[_0xd5c3('0x60')]&&_0x3d3c9f[_0xd5c3('0x60')][0x1]?_0x3d3c9f[_0xd5c3('0x60')][0x1][_0xd5c3('0x63')]:undefined)||_0xd5c3('0x67')},{'name':_0xd5c3('0x68'),'value':_0x3d3c9f[_0xd5c3('0x68')]||(_0x3d3c9f[_0xd5c3('0x60')]&&_0x3d3c9f[_0xd5c3('0x60')][0x2]?_0x3d3c9f[_0xd5c3('0x60')][0x2][_0xd5c3('0x63')]:undefined)||0xc}];case'counter':return[{'name':_0xd5c3('0x69'),'value':_0x3d3c9f[_0xd5c3('0x69')]||(_0x3d3c9f[_0xd5c3('0x60')]&&_0x3d3c9f['attrs'][0x0]?_0x3d3c9f[_0xd5c3('0x60')][0x0][_0xd5c3('0x63')]:undefined)||_0xd5c3('0x6a')},{'name':_0xd5c3('0x6b'),'value':_0x3d3c9f[_0xd5c3('0x6b')]||(_0x3d3c9f['attrs']&&_0x3d3c9f['attrs'][0x1]?_0x3d3c9f[_0xd5c3('0x60')][0x1][_0xd5c3('0x63')]:undefined)||[]},{'name':'attrFontSize','value':_0x3d3c9f[_0xd5c3('0x68')]||(_0x3d3c9f[_0xd5c3('0x60')]&&_0x3d3c9f['attrs'][0x2]?_0x3d3c9f[_0xd5c3('0x60')][0x2][_0xd5c3('0x63')]:undefined)||0x14}];case'multibar-chart':case _0xd5c3('0x6c'):return[{'name':_0xd5c3('0x6d'),'value':_0x3d3c9f['attrSerie1']||(_0x3d3c9f[_0xd5c3('0x60')]&&_0x3d3c9f[_0xd5c3('0x60')][0x0]?_0x3d3c9f[_0xd5c3('0x60')][0x0][_0xd5c3('0x63')]:undefined)||'total'},{'name':'attrSerie2','value':_0x3d3c9f['attrSerie2']||(_0x3d3c9f[_0xd5c3('0x60')]&&_0x3d3c9f['attrs'][0x1]?_0x3d3c9f[_0xd5c3('0x60')][0x1][_0xd5c3('0x63')]:undefined)||null},{'name':_0xd5c3('0x6e'),'value':_0x3d3c9f['attrSerie3']||(_0x3d3c9f['attrs']&&_0x3d3c9f[_0xd5c3('0x60')][0x2]?_0x3d3c9f['attrs'][0x2][_0xd5c3('0x63')]:undefined)||null},{'name':_0xd5c3('0x6b'),'value':_0x3d3c9f[_0xd5c3('0x6b')]||(_0x3d3c9f[_0xd5c3('0x60')]&&_0x3d3c9f[_0xd5c3('0x60')][0x3]?_0x3d3c9f[_0xd5c3('0x60')][0x3][_0xd5c3('0x63')]:undefined)||[]}];case'web-report':return[{'name':_0xd5c3('0x6f'),'type':_0x3d3c9f[_0xd5c3('0x70')]||(_0x3d3c9f['attrs']&&_0x3d3c9f['attrs'][0x0]?_0x3d3c9f[_0xd5c3('0x60')][0x0][_0xd5c3('0x36')]:undefined)||null,'value':_0x3d3c9f[_0xd5c3('0x6f')]||(_0x3d3c9f['attrs']&&_0x3d3c9f[_0xd5c3('0x60')][0x0]?_0x3d3c9f[_0xd5c3('0x60')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x3d3c9f[_0xd5c3('0x71')]||(_0x3d3c9f[_0xd5c3('0x60')]&&_0x3d3c9f['attrs'][0x1]?_0x3d3c9f[_0xd5c3('0x60')][0x1][_0xd5c3('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x4d0190){logger[_0xd5c3('0x2e')](_0xd5c3('0x72'),JSON[_0xd5c3('0x73')](_0x4d0190));return[];}}exports['addItem']=function(_0x2384b4,_0x1d2822,_0x55bcb8){if(_0x2384b4[_0xd5c3('0x52')]['id']){delete _0x2384b4[_0xd5c3('0x52')]['id'];}return db[_0xd5c3('0x34')][_0xd5c3('0x56')]({'where':{'id':_0x2384b4[_0xd5c3('0x4f')]['id']}})[_0xd5c3('0x28')](handleEntityNotFound(_0x1d2822,null))['then'](function(_0x189c7e){if(_0x189c7e){_0x2384b4[_0xd5c3('0x52')]['DashboardId']=_0x189c7e['id'];_0x2384b4[_0xd5c3('0x52')][_0xd5c3('0x60')]=widgetAttributes(_0x2384b4['body']);return db[_0xd5c3('0x74')][_0xd5c3('0x51')](_0x2384b4['body']);}})[_0xd5c3('0x28')](respondWithResult(_0x1d2822,null))['catch'](handleError(_0x1d2822,null));};exports['getItems']=function(_0x14c913,_0x2b2478,_0x48cea6){var _0x4c6526={};var _0x238642={};var _0x35d861;var _0x3ebf9d;return db['Dashboard'][_0xd5c3('0x75')]({'where':{'id':_0x14c913[_0xd5c3('0x4f')]['id']}})[_0xd5c3('0x28')](handleEntityNotFound(_0x2b2478,null))[_0xd5c3('0x28')](function(_0x304a1b){if(_0x304a1b){_0x35d861=_0x304a1b;_0x238642[_0xd5c3('0x38')]=_['keys'](db[_0xd5c3('0x74')][_0xd5c3('0x50')]);_0x238642[_0xd5c3('0x39')]=_[_0xd5c3('0x3a')](_0x14c913[_0xd5c3('0x39')]);_0x238642[_0xd5c3('0x44')]=_[_0xd5c3('0x3b')](_0x238642[_0xd5c3('0x38')],_0x238642[_0xd5c3('0x39')]);_0x4c6526['attributes']=_['intersection'](_0x238642[_0xd5c3('0x38')],qs['fields'](_0x14c913['query'][_0xd5c3('0x3d')]));_0x4c6526[_0xd5c3('0x3c')]=_0x4c6526[_0xd5c3('0x3c')]['length']?_0x4c6526['attributes']:_0x238642[_0xd5c3('0x38')];_0x4c6526[_0xd5c3('0x41')]=qs[_0xd5c3('0x42')](_0x14c913[_0xd5c3('0x39')][_0xd5c3('0x42')]);_0x4c6526[_0xd5c3('0x43')]=qs[_0xd5c3('0x44')](_[_0xd5c3('0x45')](_0x14c913[_0xd5c3('0x39')],_0x238642[_0xd5c3('0x44')]));if(_0x14c913['query']['filter']){_0x4c6526['where']=_[_0xd5c3('0x47')](_0x4c6526[_0xd5c3('0x43')],{'$or':_[_0xd5c3('0x33')](_0x4c6526[_0xd5c3('0x3c')],function(_0x361756){var _0x34de10={};_0x34de10[_0x361756]={'$like':'%'+_0x14c913['query']['filter']+'%'};return _0x34de10;})});}_0x4c6526=_[_0xd5c3('0x47')]({},_0x4c6526,_0x14c913['options']);return _0x35d861['getItems'](_0x4c6526);}})[_0xd5c3('0x28')](function(_0x4f5859){if(_0x4f5859){_0x3ebf9d=_0x4f5859['length'];if(!_0x14c913[_0xd5c3('0x39')]['hasOwnProperty']('nolimit')){_0x4c6526[_0xd5c3('0x20')]=qs[_0xd5c3('0x20')](_0x14c913['query'][_0xd5c3('0x20')]);_0x4c6526['offset']=qs[_0xd5c3('0x1f')](_0x14c913[_0xd5c3('0x39')][_0xd5c3('0x1f')]);}return _0x35d861[_0xd5c3('0x76')](_0x4c6526);}})[_0xd5c3('0x28')](function(_0x1b6d04){if(_0x1b6d04){return _0x1b6d04?{'count':_0x3ebf9d,'rows':_0x1b6d04}:null;}})[_0xd5c3('0x28')](respondWithResult(_0x2b2478,null))[_0xd5c3('0x4d')](handleError(_0x2b2478,null));}; \ No newline at end of file +var _0x7b7b=['attrs','value','custom','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrVoiceQueues','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','getItems','findOne','pick','hasOwnProperty','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','then','UserProfileResource','destroy','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','model','keys','intersection','attributes','fields','length','query','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','include','findAll','catch','includeAll','options','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','createdAt','error','update','attrUrl'];(function(_0x44caf4,_0x238750){var _0x117cad=function(_0x3e64c8){while(--_0x3e64c8){_0x44caf4['push'](_0x44caf4['shift']());}};_0x117cad(++_0x238750);}(_0x7b7b,0x17b));var _0xb7b7=function(_0x107179,_0x46e138){_0x107179=_0x107179-0x0;var _0x31f40e=_0x7b7b[_0x107179];return _0x31f40e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb7b7('0x0'));var zipdir=require(_0xb7b7('0x1'));var jsonpatch=require(_0xb7b7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb7b7('0x3'));var Mustache=require(_0xb7b7('0x4'));var util=require(_0xb7b7('0x5'));var path=require(_0xb7b7('0x6'));var sox=require(_0xb7b7('0x7'));var csv=require(_0xb7b7('0x8'));var ejs=require(_0xb7b7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb7b7('0xa'));var squel=require(_0xb7b7('0xb'));var crypto=require('crypto');var jsforce=require(_0xb7b7('0xc'));var deskjs=require(_0xb7b7('0xd'));var toCsv=require(_0xb7b7('0x8'));var querystring=require('querystring');var Papa=require(_0xb7b7('0xe'));var Redis=require(_0xb7b7('0xf'));var authService=require(_0xb7b7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb7b7('0x11'));var hardwareService=require(_0xb7b7('0x12'));var logger=require(_0xb7b7('0x13'))(_0xb7b7('0x14'));var utils=require('../../config/utils');var config=require(_0xb7b7('0x15'));var licenseUtil=require(_0xb7b7('0x16'));var db=require(_0xb7b7('0x17'))['db'];config[_0xb7b7('0x18')]=_['defaults'](config[_0xb7b7('0x18')],{'host':_0xb7b7('0x19'),'port':0x18eb});var socket=require(_0xb7b7('0x1a'))(new Redis(config['redis']));require(_0xb7b7('0x1b'))[_0xb7b7('0x1c')](socket);function respondWithStatusCode(_0x447423,_0xed1923){_0xed1923=_0xed1923||0xcc;return function(_0x5bc890){if(_0x5bc890){return _0x447423[_0xb7b7('0x1d')](_0xed1923);}return _0x447423[_0xb7b7('0x1e')](_0xed1923)[_0xb7b7('0x1f')]();};}function respondWithResult(_0x2cf686,_0x2d6bc0){_0x2d6bc0=_0x2d6bc0||0xc8;return function(_0x4d216a){if(_0x4d216a){return _0x2cf686[_0xb7b7('0x1e')](_0x2d6bc0)[_0xb7b7('0x20')](_0x4d216a);}};}function respondWithFilteredResult(_0x1fd2eb,_0x5c474e){return function(_0x16545f){if(_0x16545f){var _0x429280=typeof _0x5c474e[_0xb7b7('0x21')]==='undefined'&&typeof _0x5c474e[_0xb7b7('0x22')]===_0xb7b7('0x23');var _0x401346=_0x16545f[_0xb7b7('0x24')];var _0x25afa3=_0x429280?0x0:_0x5c474e[_0xb7b7('0x21')];var _0x1bcba2=_0x429280?_0x16545f['count']:_0x5c474e[_0xb7b7('0x21')]+_0x5c474e[_0xb7b7('0x22')];var _0x3fe263;if(_0x1bcba2>=_0x401346){_0x1bcba2=_0x401346;_0x3fe263=0xc8;}else{_0x3fe263=0xce;}_0x1fd2eb[_0xb7b7('0x1e')](_0x3fe263);return _0x1fd2eb['set'](_0xb7b7('0x25'),_0x25afa3+'-'+_0x1bcba2+'/'+_0x401346)['json'](_0x16545f);}return null;};}function patchUpdates(_0x58ea14){return function(_0x14ac0a){try{jsonpatch['apply'](_0x14ac0a,_0x58ea14,!![]);}catch(_0xfe4a31){return BPromise[_0xb7b7('0x26')](_0xfe4a31);}return _0x14ac0a[_0xb7b7('0x27')]();};}function saveUpdates(_0x2e25ed,_0x50bee5){return function(_0x5b8a43){if(_0x5b8a43){return _0x5b8a43['update'](_0x2e25ed)[_0xb7b7('0x28')](function(_0x2c9fca){return _0x2c9fca;});}return null;};}function removeEntity(_0x3ba10c,_0x246663){return function(_0x41d02d){if(_0x41d02d){return _0x41d02d['destroy']()[_0xb7b7('0x28')](function(){var _0x20231a=_0x41d02d['get']({'plain':!![]});var _0x3225fb='CustomDashboards';return db[_0xb7b7('0x29')][_0xb7b7('0x2a')]({'where':{'type':_0x3225fb,'resourceId':_0x20231a['id']}})['then'](function(){return _0x41d02d;});})[_0xb7b7('0x28')](function(){_0x3ba10c[_0xb7b7('0x1e')](0xcc)[_0xb7b7('0x1f')]();});}};}function handleEntityNotFound(_0x5d01d8,_0x2cce93){return function(_0x45ff6d){if(!_0x45ff6d){_0x5d01d8[_0xb7b7('0x1d')](0x194);}return _0x45ff6d;};}function handleError(_0x3e5365,_0x1a4b8c){_0x1a4b8c=_0x1a4b8c||0x1f4;return function(_0x526df1){logger['error'](_0x526df1[_0xb7b7('0x2b')]);if(_0x526df1[_0xb7b7('0x2c')]){delete _0x526df1['name'];}_0x3e5365[_0xb7b7('0x1e')](_0x1a4b8c)['send'](_0x526df1);};}exports[_0xb7b7('0x2d')]=function(_0x2781e6,_0xfd7ff4){var _0x12d108={},_0x55020c={},_0x9eae5c={'count':0x0,'rows':[]};var _0x2ad1d1=_[_0xb7b7('0x2e')](db[_0xb7b7('0x2f')][_0xb7b7('0x30')],function(_0x90695e){return{'name':_0x90695e[_0xb7b7('0x31')],'type':_0x90695e[_0xb7b7('0x32')]['key']};});_0x55020c[_0xb7b7('0x33')]=_['map'](_0x2ad1d1,_0xb7b7('0x2c'));_0x55020c['query']=_[_0xb7b7('0x34')](_0x2781e6['query']);_0x55020c['filters']=_[_0xb7b7('0x35')](_0x55020c[_0xb7b7('0x33')],_0x55020c['query']);_0x12d108[_0xb7b7('0x36')]=_['intersection'](_0x55020c['model'],qs[_0xb7b7('0x37')](_0x2781e6['query'][_0xb7b7('0x37')]));_0x12d108['attributes']=_0x12d108[_0xb7b7('0x36')][_0xb7b7('0x38')]?_0x12d108['attributes']:_0x55020c[_0xb7b7('0x33')];if(!_0x2781e6[_0xb7b7('0x39')]['hasOwnProperty'](_0xb7b7('0x3a'))){_0x12d108['limit']=qs[_0xb7b7('0x22')](_0x2781e6[_0xb7b7('0x39')][_0xb7b7('0x22')]);_0x12d108[_0xb7b7('0x21')]=qs[_0xb7b7('0x21')](_0x2781e6[_0xb7b7('0x39')]['offset']);}_0x12d108[_0xb7b7('0x3b')]=qs['sort'](_0x2781e6['query'][_0xb7b7('0x3c')]);_0x12d108[_0xb7b7('0x3d')]=qs[_0xb7b7('0x3e')](_['pick'](_0x2781e6['query'],_0x55020c[_0xb7b7('0x3e')]),_0x2ad1d1);if(_0x2781e6[_0xb7b7('0x39')][_0xb7b7('0x3f')]){_0x12d108[_0xb7b7('0x3d')]=_['merge'](_0x12d108[_0xb7b7('0x3d')],{'$or':_[_0xb7b7('0x2e')](_0x2ad1d1,function(_0xb51faa){if(_0xb51faa[_0xb7b7('0x32')]!==_0xb7b7('0x40')){var _0x237825={};_0x237825[_0xb51faa[_0xb7b7('0x2c')]]={'$like':'%'+_0x2781e6[_0xb7b7('0x39')][_0xb7b7('0x3f')]+'%'};return _0x237825;}})});}_0x12d108=_[_0xb7b7('0x41')]({},_0x12d108,_0x2781e6['options']);var _0x541d53={'where':_0x12d108[_0xb7b7('0x3d')]};return db['Dashboard'][_0xb7b7('0x24')](_0x541d53)[_0xb7b7('0x28')](function(_0x159cb7){_0x9eae5c[_0xb7b7('0x24')]=_0x159cb7;if(_0x2781e6[_0xb7b7('0x39')]['includeAll']){_0x12d108[_0xb7b7('0x42')]=[{'all':!![]}];}return db[_0xb7b7('0x2f')][_0xb7b7('0x43')](_0x12d108);})['then'](function(_0x2aa0a9){_0x9eae5c['rows']=_0x2aa0a9;return _0x9eae5c;})[_0xb7b7('0x28')](respondWithFilteredResult(_0xfd7ff4,_0x12d108))[_0xb7b7('0x44')](handleError(_0xfd7ff4,null));};exports['show']=function(_0x297d79,_0x200caf){var _0xaf2db3={'raw':![],'where':{'id':_0x297d79['params']['id']}},_0x43cf35={};_0x43cf35[_0xb7b7('0x33')]=_[_0xb7b7('0x34')](db['Dashboard']['rawAttributes']);_0x43cf35[_0xb7b7('0x39')]=_['keys'](_0x297d79['query']);_0x43cf35[_0xb7b7('0x3e')]=_[_0xb7b7('0x35')](_0x43cf35[_0xb7b7('0x33')],_0x43cf35[_0xb7b7('0x39')]);_0xaf2db3['attributes']=_[_0xb7b7('0x35')](_0x43cf35[_0xb7b7('0x33')],qs[_0xb7b7('0x37')](_0x297d79[_0xb7b7('0x39')][_0xb7b7('0x37')]));_0xaf2db3[_0xb7b7('0x36')]=_0xaf2db3['attributes']['length']?_0xaf2db3[_0xb7b7('0x36')]:_0x43cf35[_0xb7b7('0x33')];if(_0x297d79[_0xb7b7('0x39')][_0xb7b7('0x45')]){_0xaf2db3[_0xb7b7('0x42')]=[{'all':!![]}];}_0xaf2db3=_['merge']({},_0xaf2db3,_0x297d79[_0xb7b7('0x46')]);return db[_0xb7b7('0x2f')][_0xb7b7('0x47')](_0xaf2db3)[_0xb7b7('0x28')](handleEntityNotFound(_0x200caf,null))['then'](respondWithResult(_0x200caf,null))['catch'](handleError(_0x200caf,null));};exports[_0xb7b7('0x48')]=function(_0x3b67f6,_0x1f6798){return db[_0xb7b7('0x2f')][_0xb7b7('0x48')](_0x3b67f6[_0xb7b7('0x49')],{})['then'](function(_0xa480fc){var _0x2493a3=_0x3b67f6[_0xb7b7('0x4a')][_0xb7b7('0x4b')]({'plain':!![]});if(!_0x2493a3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2493a3[_0xb7b7('0x4c')]==='user'){var _0x35b02b=_0xa480fc[_0xb7b7('0x4b')]({'plain':!![]});var _0x1b6a51='CustomDashboards';return db[_0xb7b7('0x4d')][_0xb7b7('0x47')]({'where':{'name':_0x1b6a51,'userProfileId':_0x2493a3[_0xb7b7('0x4e')]},'raw':!![]})[_0xb7b7('0x28')](function(_0x569a7d){if(_0x569a7d&&_0x569a7d[_0xb7b7('0x4f')]===0x0){return db[_0xb7b7('0x29')][_0xb7b7('0x48')]({'name':_0x35b02b[_0xb7b7('0x2c')],'resourceId':_0x35b02b['id'],'type':_0x569a7d['name'],'sectionId':_0x569a7d['id']},{})[_0xb7b7('0x28')](function(){return _0xa480fc;});}else{return _0xa480fc;}})[_0xb7b7('0x44')](function(_0x5a153e){logger['error'](_0xb7b7('0x50'),_0x5a153e);throw _0x5a153e;});}return _0xa480fc;})[_0xb7b7('0x28')](respondWithResult(_0x1f6798,0xc9))['catch'](handleError(_0x1f6798,null));};exports[_0xb7b7('0x51')]=function(_0x15bca6,_0x4ad713){var _0x2ab08e={'where':{'id':_0x15bca6[_0xb7b7('0x52')]['id']}},_0x4e9201={};_0x4e9201[_0xb7b7('0x33')]=_['keys'](db[_0xb7b7('0x2f')][_0xb7b7('0x30')]);_0x2ab08e['attributes']=_[_0xb7b7('0x35')](_0x4e9201['model'],qs[_0xb7b7('0x37')](_0x15bca6['query'][_0xb7b7('0x37')]));_0x2ab08e[_0xb7b7('0x36')]=_0x2ab08e[_0xb7b7('0x36')][_0xb7b7('0x38')]?_0x2ab08e[_0xb7b7('0x36')]:_0x4e9201[_0xb7b7('0x33')];if(_0x15bca6['query'][_0xb7b7('0x45')]){_0x2ab08e['include']=[{'all':!![]}];}_0x2ab08e=_[_0xb7b7('0x41')]({},_0x2ab08e,_0x15bca6['options']);return db[_0xb7b7('0x2f')][_0xb7b7('0x47')](_0x2ab08e)[_0xb7b7('0x28')](handleEntityNotFound(_0x4ad713,null))['then'](function(_0x3668a3){if(_0x3668a3){var _0x43a7b6=_0x3668a3[_0xb7b7('0x4b')]({'plain':!![]});_0x43a7b6=qs[_0xb7b7('0x53')](_0x43a7b6,['id','createdAt',_0xb7b7('0x54')]);_0x15bca6[_0xb7b7('0x49')]=_[_0xb7b7('0x53')](_0x15bca6[_0xb7b7('0x49')],['id',_0xb7b7('0x55'),_0xb7b7('0x54')]);return db[_0xb7b7('0x2f')]['create'](_['merge'](_0x43a7b6,_0x15bca6['body']),{'include':_0x15bca6[_0xb7b7('0x39')][_0xb7b7('0x45')]?[{'all':!![]}]:undefined})[_0xb7b7('0x28')](function(_0x30518a){var _0x4af8c5=_0x15bca6[_0xb7b7('0x4a')]['get']({'plain':!![]});if(!_0x4af8c5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4af8c5[_0xb7b7('0x4c')]===_0xb7b7('0x4a')){var _0x5b5de7=_0x30518a[_0xb7b7('0x4b')]({'plain':!![]});var _0x440422='CustomDashboards';return db[_0xb7b7('0x4d')][_0xb7b7('0x47')]({'where':{'name':_0x440422,'userProfileId':_0x4af8c5[_0xb7b7('0x4e')]},'raw':!![]})['then'](function(_0x27193e){if(_0x27193e&&_0x27193e['autoAssociation']===0x0){return db[_0xb7b7('0x29')][_0xb7b7('0x48')]({'name':_0x5b5de7[_0xb7b7('0x2c')],'resourceId':_0x5b5de7['id'],'type':_0x27193e[_0xb7b7('0x2c')],'sectionId':_0x27193e['id']},{})[_0xb7b7('0x28')](function(){return _0x30518a;});}else{return _0x30518a;}})[_0xb7b7('0x44')](function(_0x24a822){logger[_0xb7b7('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24a822);throw _0x24a822;});}return _0x30518a;});}})[_0xb7b7('0x28')](respondWithResult(_0x4ad713,0xc9))[_0xb7b7('0x44')](handleError(_0x4ad713,null));};exports[_0xb7b7('0x57')]=function(_0x124db0,_0x1a782e){if(_0x124db0[_0xb7b7('0x49')]['id']){delete _0x124db0['body']['id'];}return db[_0xb7b7('0x2f')]['find']({'where':{'id':_0x124db0['params']['id']}})[_0xb7b7('0x28')](handleEntityNotFound(_0x1a782e,null))[_0xb7b7('0x28')](saveUpdates(_0x124db0['body'],null))[_0xb7b7('0x28')](respondWithResult(_0x1a782e,null))[_0xb7b7('0x44')](handleError(_0x1a782e,null));};exports[_0xb7b7('0x2a')]=function(_0x33bc82,_0x515662){return db[_0xb7b7('0x2f')][_0xb7b7('0x47')]({'where':{'id':_0x33bc82[_0xb7b7('0x52')]['id']}})['then'](handleEntityNotFound(_0x515662,null))['then'](removeEntity(_0x515662,null))[_0xb7b7('0x44')](handleError(_0x515662,null));};function widgetAttributes(_0x591c8d){try{switch(_0x591c8d[_0xb7b7('0x32')]){case'iframe':return[{'name':_0xb7b7('0x58'),'value':_0x591c8d[_0xb7b7('0x58')]||(_0x591c8d[_0xb7b7('0x59')]&&_0x591c8d[_0xb7b7('0x59')][0x0]?_0x591c8d[_0xb7b7('0x59')][0x0][_0xb7b7('0x5a')]:undefined)||'https://'}];case _0xb7b7('0x5b'):return[{'name':'attrPath','value':_0x591c8d['attrPath']||(_0x591c8d[_0xb7b7('0x59')]&&_0x591c8d['attrs'][0x0]?_0x591c8d['attrs'][0x0][_0xb7b7('0x5a')]:undefined)||''}];case _0xb7b7('0x5c'):return[{'name':'attrHourFormat','value':_0x591c8d[_0xb7b7('0x5d')]||(_0x591c8d['attrs']&&_0x591c8d[_0xb7b7('0x59')][0x0]?_0x591c8d[_0xb7b7('0x59')][0x0][_0xb7b7('0x5a')]:undefined)||_0xb7b7('0x5e')},{'name':_0xb7b7('0x5f'),'value':_0x591c8d[_0xb7b7('0x5f')]||(_0x591c8d[_0xb7b7('0x59')]&&_0x591c8d['attrs'][0x1]?_0x591c8d['attrs'][0x1][_0xb7b7('0x5a')]:undefined)||_0xb7b7('0x60')},{'name':_0xb7b7('0x61'),'value':_0x591c8d['attrFontSize']||(_0x591c8d[_0xb7b7('0x59')]&&_0x591c8d[_0xb7b7('0x59')][0x2]?_0x591c8d[_0xb7b7('0x59')][0x2]['value']:undefined)||0xc}];case _0xb7b7('0x62'):return[{'name':'attrMetric','value':_0x591c8d[_0xb7b7('0x63')]||(_0x591c8d['attrs']&&_0x591c8d[_0xb7b7('0x59')][0x0]?_0x591c8d[_0xb7b7('0x59')][0x0]['value']:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x591c8d['attrVoiceQueues']||(_0x591c8d[_0xb7b7('0x59')]&&_0x591c8d['attrs'][0x1]?_0x591c8d[_0xb7b7('0x59')][0x1][_0xb7b7('0x5a')]:undefined)||[]},{'name':'attrFontSize','value':_0x591c8d['attrFontSize']||(_0x591c8d['attrs']&&_0x591c8d[_0xb7b7('0x59')][0x2]?_0x591c8d['attrs'][0x2][_0xb7b7('0x5a')]:undefined)||0x14}];case _0xb7b7('0x64'):case _0xb7b7('0x65'):return[{'name':_0xb7b7('0x66'),'value':_0x591c8d[_0xb7b7('0x66')]||(_0x591c8d['attrs']&&_0x591c8d[_0xb7b7('0x59')][0x0]?_0x591c8d[_0xb7b7('0x59')][0x0][_0xb7b7('0x5a')]:undefined)||_0xb7b7('0x67')},{'name':_0xb7b7('0x68'),'value':_0x591c8d[_0xb7b7('0x68')]||(_0x591c8d[_0xb7b7('0x59')]&&_0x591c8d[_0xb7b7('0x59')][0x1]?_0x591c8d[_0xb7b7('0x59')][0x1][_0xb7b7('0x5a')]:undefined)||null},{'name':'attrSerie3','value':_0x591c8d[_0xb7b7('0x69')]||(_0x591c8d[_0xb7b7('0x59')]&&_0x591c8d[_0xb7b7('0x59')][0x2]?_0x591c8d[_0xb7b7('0x59')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x591c8d[_0xb7b7('0x6a')]||(_0x591c8d[_0xb7b7('0x59')]&&_0x591c8d[_0xb7b7('0x59')][0x3]?_0x591c8d[_0xb7b7('0x59')][0x3][_0xb7b7('0x5a')]:undefined)||[]}];case'web-report':return[{'name':_0xb7b7('0x6b'),'type':_0x591c8d[_0xb7b7('0x6c')]||(_0x591c8d[_0xb7b7('0x59')]&&_0x591c8d['attrs'][0x0]?_0x591c8d['attrs'][0x0]['type']:undefined)||null,'value':_0x591c8d['attrReport']||(_0x591c8d[_0xb7b7('0x59')]&&_0x591c8d[_0xb7b7('0x59')][0x0]?_0x591c8d[_0xb7b7('0x59')][0x0][_0xb7b7('0x5a')]:undefined)||null},{'name':'attrRefresh','value':_0x591c8d[_0xb7b7('0x6d')]||(_0x591c8d[_0xb7b7('0x59')]&&_0x591c8d['attrs'][0x1]?_0x591c8d[_0xb7b7('0x59')][0x1][_0xb7b7('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x1551ef){logger[_0xb7b7('0x56')](_0xb7b7('0x6e'),JSON[_0xb7b7('0x6f')](_0x1551ef));return[];}}exports['addItem']=function(_0x44f235,_0x58d6ac,_0x221c80){if(_0x44f235[_0xb7b7('0x49')]['id']){delete _0x44f235['body']['id'];}return db['Dashboard'][_0xb7b7('0x47')]({'where':{'id':_0x44f235[_0xb7b7('0x52')]['id']}})['then'](handleEntityNotFound(_0x58d6ac,null))[_0xb7b7('0x28')](function(_0x44dfdc){if(_0x44dfdc){_0x44f235[_0xb7b7('0x49')][_0xb7b7('0x70')]=_0x44dfdc['id'];_0x44f235['body'][_0xb7b7('0x59')]=widgetAttributes(_0x44f235[_0xb7b7('0x49')]);return db['DashboardItem'][_0xb7b7('0x48')](_0x44f235[_0xb7b7('0x49')]);}})[_0xb7b7('0x28')](respondWithResult(_0x58d6ac,null))[_0xb7b7('0x44')](handleError(_0x58d6ac,null));};exports[_0xb7b7('0x71')]=function(_0x49a32f,_0x577eb3,_0x482558){var _0x52a630={};var _0xa5db33={};var _0x424b9c;var _0x92f2fe;return db[_0xb7b7('0x2f')][_0xb7b7('0x72')]({'where':{'id':_0x49a32f[_0xb7b7('0x52')]['id']}})[_0xb7b7('0x28')](handleEntityNotFound(_0x577eb3,null))['then'](function(_0x4c600e){if(_0x4c600e){_0x424b9c=_0x4c600e;_0xa5db33[_0xb7b7('0x33')]=_['keys'](db['DashboardItem'][_0xb7b7('0x30')]);_0xa5db33['query']=_[_0xb7b7('0x34')](_0x49a32f[_0xb7b7('0x39')]);_0xa5db33['filters']=_[_0xb7b7('0x35')](_0xa5db33[_0xb7b7('0x33')],_0xa5db33[_0xb7b7('0x39')]);_0x52a630[_0xb7b7('0x36')]=_[_0xb7b7('0x35')](_0xa5db33['model'],qs['fields'](_0x49a32f[_0xb7b7('0x39')][_0xb7b7('0x37')]));_0x52a630[_0xb7b7('0x36')]=_0x52a630[_0xb7b7('0x36')][_0xb7b7('0x38')]?_0x52a630[_0xb7b7('0x36')]:_0xa5db33[_0xb7b7('0x33')];_0x52a630['order']=qs[_0xb7b7('0x3c')](_0x49a32f['query']['sort']);_0x52a630['where']=qs['filters'](_[_0xb7b7('0x73')](_0x49a32f[_0xb7b7('0x39')],_0xa5db33[_0xb7b7('0x3e')]));if(_0x49a32f['query'][_0xb7b7('0x3f')]){_0x52a630[_0xb7b7('0x3d')]=_[_0xb7b7('0x41')](_0x52a630[_0xb7b7('0x3d')],{'$or':_[_0xb7b7('0x2e')](_0x52a630['attributes'],function(_0x13d678){var _0x12292a={};_0x12292a[_0x13d678]={'$like':'%'+_0x49a32f[_0xb7b7('0x39')][_0xb7b7('0x3f')]+'%'};return _0x12292a;})});}_0x52a630=_[_0xb7b7('0x41')]({},_0x52a630,_0x49a32f[_0xb7b7('0x46')]);return _0x424b9c['getItems'](_0x52a630);}})[_0xb7b7('0x28')](function(_0xde38b){if(_0xde38b){_0x92f2fe=_0xde38b['length'];if(!_0x49a32f['query'][_0xb7b7('0x74')](_0xb7b7('0x3a'))){_0x52a630[_0xb7b7('0x22')]=qs[_0xb7b7('0x22')](_0x49a32f[_0xb7b7('0x39')][_0xb7b7('0x22')]);_0x52a630[_0xb7b7('0x21')]=qs['offset'](_0x49a32f[_0xb7b7('0x39')]['offset']);}return _0x424b9c['getItems'](_0x52a630);}})[_0xb7b7('0x28')](function(_0x43e775){if(_0x43e775){return _0x43e775?{'count':_0x92f2fe,'rows':_0x43e775}:null;}})[_0xb7b7('0x28')](respondWithResult(_0x577eb3,null))['catch'](handleError(_0x577eb3,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 6c101c7..ac0cdb1 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 _0x231a=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x40f59c,_0x3e57b7){var _0x2202c9=function(_0xcb458){while(--_0xcb458){_0x40f59c['push'](_0x40f59c['shift']());}};_0x2202c9(++_0x3e57b7);}(_0x231a,0xc6));var _0xa231=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x231a[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xa231('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa231('0x1')](0x0);var events={'afterCreate':_0xa231('0x2'),'afterUpdate':_0xa231('0x3'),'afterDestroy':_0xa231('0x4')};function emitEvent(_0x3e4866){return function(_0xd97e69,_0x4e66a7,_0x5a920b){DashboardEvents[_0xa231('0x5')](_0x3e4866+':'+_0xd97e69['id'],_0xd97e69);DashboardEvents[_0xa231('0x5')](_0x3e4866,_0xd97e69);_0x5a920b(null);};}for(var e in events){if(events[_0xa231('0x6')](e)){var event=events[e];Dashboard[_0xa231('0x7')](e,emitEvent(event));}}module[_0xa231('0x8')]=DashboardEvents; \ No newline at end of file +var _0xe3da=['../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x307414,_0x372878){var _0x174ad4=function(_0x58139a){while(--_0x58139a){_0x307414['push'](_0x307414['shift']());}};_0x174ad4(++_0x372878);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xae3d('0x0'));var Dashboard=require(_0xae3d('0x1'))['db'][_0xae3d('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xae3d('0x3')](0x0);var events={'afterCreate':_0xae3d('0x4'),'afterUpdate':_0xae3d('0x5'),'afterDestroy':_0xae3d('0x6')};function emitEvent(_0x17952f){return function(_0xb2dfd3,_0x22bacf,_0x1b9397){DashboardEvents[_0xae3d('0x7')](_0x17952f+':'+_0xb2dfd3['id'],_0xb2dfd3);DashboardEvents[_0xae3d('0x7')](_0x17952f,_0xb2dfd3);_0x1b9397(null);};}for(var e in events){if(events[_0xae3d('0x8')](e)){var event=events[e];Dashboard[_0xae3d('0x9')](e,emitEvent(event));}}module[_0xae3d('0xa')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 2c90b00..f28fd11 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 _0x6313=['dashboards','util','request-promise','../../config/environment','./dashboard.attributes','exports','define'];(function(_0x3f09a3,_0x5a2624){var _0x484fb2=function(_0xf13dfe){while(--_0xf13dfe){_0x3f09a3['push'](_0x3f09a3['shift']());}};_0x484fb2(++_0x5a2624);}(_0x6313,0x135));var _0x3631=function(_0x454db3,_0xcd150e){_0x454db3=_0x454db3-0x0;var _0x3b36da=_0x6313[_0x454db3];return _0x3b36da;};'use strict';var _=require('lodash');var util=require(_0x3631('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3631('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3631('0x2'));var attributes=require(_0x3631('0x3'));module[_0x3631('0x4')]=function(_0x5331ad,_0x4e3edb){return _0x5331ad[_0x3631('0x5')]('Dashboard',attributes,{'tableName':_0x3631('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50a8=['./dashboard.attributes','exports','define','lodash','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0x50a8,0x198));var _0x850a=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x50a8[_0x3fba9f];return _0x192cf1;};'use strict';var _=require(_0x850a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x850a('0x1'));var BPromise=require('bluebird');var rp=require(_0x850a('0x2'));var fs=require('fs');var path=require(_0x850a('0x3'));var rimraf=require(_0x850a('0x4'));var config=require(_0x850a('0x5'));var attributes=require(_0x850a('0x6'));module[_0x850a('0x7')]=function(_0xb85c1a,_0x442316){return _0xb85c1a[_0x850a('0x8')]('Dashboard',attributes,{'tableName':'dashboards','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 aaf865d..ce781bc 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 _0x151a=['../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','code','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x211f66,_0x6d409f){var _0x324240=function(_0x5b0c0e){while(--_0x5b0c0e){_0x211f66['push'](_0x211f66['shift']());}};_0x324240(++_0x6d409f);}(_0x151a,0x1c3));var _0xa151=function(_0x4796eb,_0x2f8389){_0x4796eb=_0x4796eb-0x0;var _0x1fb1a4=_0x151a[_0x4796eb];return _0x1fb1a4;};'use strict';var _=require(_0xa151('0x0'));var util=require(_0xa151('0x1'));var moment=require(_0xa151('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa151('0x3'));var db=require(_0xa151('0x4'))['db'];var utils=require(_0xa151('0x5'));var logger=require(_0xa151('0x6'))(_0xa151('0x7'));var config=require(_0xa151('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa151('0x9')][_0xa151('0xa')]({'port':0x232a});config['redis']=_[_0xa151('0xb')](config[_0xa151('0xc')],{'host':_0xa151('0xd'),'port':0x18eb});var socket=require(_0xa151('0xe'))(new Redis(config['redis']));require(_0xa151('0xf'))[_0xa151('0x10')](socket);function respondWithRpcPromise(_0x3c0906,_0x2a0148,_0x179c63){return new BPromise(function(_0x1049fb,_0x9fac38){return client[_0xa151('0x11')](_0x3c0906,_0x179c63)[_0xa151('0x12')](function(_0x5710e2){logger[_0xa151('0x13')](_0xa151('0x14'),_0x2a0148,_0xa151('0x15'));logger['debug'](_0xa151('0x16'),_0x2a0148,_0xa151('0x15'),JSON['stringify'](_0x5710e2));if(_0x5710e2[_0xa151('0x17')]){if(_0x5710e2[_0xa151('0x17')][_0xa151('0x18')]===0x1f4){logger[_0xa151('0x17')](_0xa151('0x14'),_0x2a0148,_0x5710e2['error']['message']);return _0x9fac38(_0x5710e2[_0xa151('0x17')]['message']);}logger[_0xa151('0x17')]('Dashboard,\x20%s,\x20%s',_0x2a0148,_0x5710e2[_0xa151('0x17')]['message']);return _0x1049fb(_0x5710e2[_0xa151('0x17')]['message']);}else{logger['info'](_0xa151('0x14'),_0x2a0148,_0xa151('0x15'));_0x1049fb(_0x5710e2[_0xa151('0x19')]['message']);}})[_0xa151('0x1a')](function(_0x4a108c){logger[_0xa151('0x17')](_0xa151('0x14'),_0x2a0148,_0x4a108c);_0x9fac38(_0x4a108c);});});} \ No newline at end of file +var _0x1b7a=['debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s'];(function(_0x4bd573,_0x1209da){var _0x211061=function(_0x190394){while(--_0x190394){_0x4bd573['push'](_0x4bd573['shift']());}};_0x211061(++_0x1209da);}(_0x1b7a,0x15a));var _0xa1b7=function(_0x180320,_0x3c754e){_0x180320=_0x180320-0x0;var _0x25dbf1=_0x1b7a[_0x180320];return _0x25dbf1;};'use strict';var _=require('lodash');var util=require(_0xa1b7('0x0'));var moment=require('moment');var BPromise=require(_0xa1b7('0x1'));var rs=require(_0xa1b7('0x2'));var fs=require('fs');var Redis=require(_0xa1b7('0x3'));var db=require(_0xa1b7('0x4'))['db'];var utils=require(_0xa1b7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa1b7('0x6'));var jayson=require(_0xa1b7('0x7'));var client=jayson[_0xa1b7('0x8')]['http']({'port':0x232a});config[_0xa1b7('0x9')]=_[_0xa1b7('0xa')](config[_0xa1b7('0x9')],{'host':_0xa1b7('0xb'),'port':0x18eb});var socket=require(_0xa1b7('0xc'))(new Redis(config[_0xa1b7('0x9')]));require(_0xa1b7('0xd'))['register'](socket);function respondWithRpcPromise(_0xb63b4c,_0x524e38,_0x32e240){return new BPromise(function(_0x28087a,_0x34d32c){return client[_0xa1b7('0xe')](_0xb63b4c,_0x32e240)[_0xa1b7('0xf')](function(_0x3b2b27){logger[_0xa1b7('0x10')](_0xa1b7('0x11'),_0x524e38,'request\x20sent');logger[_0xa1b7('0x12')](_0xa1b7('0x13'),_0x524e38,_0xa1b7('0x14'),JSON[_0xa1b7('0x15')](_0x3b2b27));if(_0x3b2b27[_0xa1b7('0x16')]){if(_0x3b2b27['error'][_0xa1b7('0x17')]===0x1f4){logger[_0xa1b7('0x16')]('Dashboard,\x20%s,\x20%s',_0x524e38,_0x3b2b27[_0xa1b7('0x16')][_0xa1b7('0x18')]);return _0x34d32c(_0x3b2b27[_0xa1b7('0x16')][_0xa1b7('0x18')]);}logger['error'](_0xa1b7('0x11'),_0x524e38,_0x3b2b27[_0xa1b7('0x16')][_0xa1b7('0x18')]);return _0x28087a(_0x3b2b27[_0xa1b7('0x16')][_0xa1b7('0x18')]);}else{logger[_0xa1b7('0x10')](_0xa1b7('0x11'),_0x524e38,_0xa1b7('0x14'));_0x28087a(_0x3b2b27[_0xa1b7('0x19')]['message']);}})['catch'](function(_0x34e84c){logger['error']('Dashboard,\x20%s,\x20%s',_0x524e38,_0x34e84c);_0x34d32c(_0x34e84c);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 5a530ed..3e196b5 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 _0x2d2b=['remove','emit','removeListener','register','dashboard:','./dashboard.events','save'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x2d2b,0x101));var _0xb2d2=function(_0x4c39b7,_0x43bb18){_0x4c39b7=_0x4c39b7-0x0;var _0x56ad4c=_0x2d2b[_0x4c39b7];return _0x56ad4c;};'use strict';var DashboardEvents=require(_0xb2d2('0x0'));var events=[_0xb2d2('0x1'),_0xb2d2('0x2'),'update'];function createListener(_0xfdaead,_0xc8666c){return function(_0x5ddbc3){_0xc8666c[_0xb2d2('0x3')](_0xfdaead,_0x5ddbc3);};}function removeListener(_0x1217a0,_0x39b99c){return function(){DashboardEvents[_0xb2d2('0x4')](_0x1217a0,_0x39b99c);};}exports[_0xb2d2('0x5')]=function(_0x5c8f26){for(var _0x3aa2fd=0x0,_0x1d3597=events['length'];_0x3aa2fd<_0x1d3597;_0x3aa2fd++){var _0x118fb7=events[_0x3aa2fd];var _0x59f107=createListener(_0xb2d2('0x6')+_0x118fb7,_0x5c8f26);DashboardEvents['on'](_0x118fb7,_0x59f107);}}; \ No newline at end of file +var _0x8f79=['register','length','dashboard:','./dashboard.events','remove','update','emit'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8f79,0x176));var _0x98f7=function(_0x5bb017,_0x5d0edb){_0x5bb017=_0x5bb017-0x0;var _0x549f3a=_0x8f79[_0x5bb017];return _0x549f3a;};'use strict';var DashboardEvents=require(_0x98f7('0x0'));var events=['save',_0x98f7('0x1'),_0x98f7('0x2')];function createListener(_0xf800f,_0x2d2fe4){return function(_0x2bf108){_0x2d2fe4[_0x98f7('0x3')](_0xf800f,_0x2bf108);};}function removeListener(_0x4553e4,_0x6d8106){return function(){DashboardEvents['removeListener'](_0x4553e4,_0x6d8106);};}exports[_0x98f7('0x4')]=function(_0x16e4d2){for(var _0x418c3b=0x0,_0x18f924=events[_0x98f7('0x5')];_0x418c3b<_0x18f924;_0x418c3b++){var _0x1717ec=events[_0x418c3b];var _0x38399f=createListener(_0x98f7('0x6')+_0x1717ec,_0x16e4d2);DashboardEvents['on'](_0x1717ec,_0x38399f);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 7789d36..3579605 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 _0x31e1=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','index','get','isAuthenticated','show','/:id/items','post','create','/:id/clone','addItem','put','/:id','delete','exports','multer'];(function(_0x191c46,_0x6c5895){var _0x36bc53=function(_0x52117e){while(--_0x52117e){_0x191c46['push'](_0x191c46['shift']());}};_0x36bc53(++_0x6c5895);}(_0x31e1,0x12a));var _0x131e=function(_0x48539f,_0x402061){_0x48539f=_0x48539f-0x0;var _0x2bb0b8=_0x31e1[_0x48539f];return _0x2bb0b8;};'use strict';var multer=require(_0x131e('0x0'));var util=require(_0x131e('0x1'));var path=require(_0x131e('0x2'));var timeout=require(_0x131e('0x3'));var express=require(_0x131e('0x4'));var router=express[_0x131e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x131e('0x6'));var interaction=require(_0x131e('0x7'));var config=require(_0x131e('0x8'));var controller=require(_0x131e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x131e('0xa')]);router[_0x131e('0xb')]('/:id',auth[_0x131e('0xc')](),controller[_0x131e('0xd')]);router[_0x131e('0xb')](_0x131e('0xe'),auth[_0x131e('0xc')](),controller['getItems']);router[_0x131e('0xf')]('/',auth[_0x131e('0xc')](),controller[_0x131e('0x10')]);router[_0x131e('0xf')](_0x131e('0x11'),auth['isAuthenticated'](),controller['clone']);router['post'](_0x131e('0xe'),auth[_0x131e('0xc')](),controller[_0x131e('0x12')]);router[_0x131e('0x13')](_0x131e('0x14'),auth['isAuthenticated'](),controller['update']);router[_0x131e('0x15')](_0x131e('0x14'),auth[_0x131e('0xc')](),controller['destroy']);module[_0x131e('0x16')]=router; \ No newline at end of file +var _0x6651=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index','/:id','show','get','/:id/items','post','create','clone','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0xc4a545,_0x4f50d9){var _0xfa810a=function(_0x57bbe8){while(--_0x57bbe8){_0xc4a545['push'](_0xc4a545['shift']());}};_0xfa810a(++_0x4f50d9);}(_0x6651,0x154));var _0x1665=function(_0x15e56a,_0x5483d9){_0x15e56a=_0x15e56a-0x0;var _0x472c0d=_0x6651[_0x15e56a];return _0x472c0d;};'use strict';var multer=require('multer');var util=require(_0x1665('0x0'));var path=require(_0x1665('0x1'));var timeout=require(_0x1665('0x2'));var express=require(_0x1665('0x3'));var router=express[_0x1665('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1665('0x5'));var interaction=require(_0x1665('0x6'));var config=require(_0x1665('0x7'));var controller=require(_0x1665('0x8'));router['get']('/',auth[_0x1665('0x9')](),controller[_0x1665('0xa')]);router['get'](_0x1665('0xb'),auth['isAuthenticated'](),controller[_0x1665('0xc')]);router[_0x1665('0xd')](_0x1665('0xe'),auth['isAuthenticated'](),controller['getItems']);router[_0x1665('0xf')]('/',auth[_0x1665('0x9')](),controller[_0x1665('0x10')]);router['post']('/:id/clone',auth[_0x1665('0x9')](),controller[_0x1665('0x11')]);router['post'](_0x1665('0xe'),auth[_0x1665('0x9')](),controller['addItem']);router[_0x1665('0x12')](_0x1665('0xb'),auth['isAuthenticated'](),controller[_0x1665('0x13')]);router[_0x1665('0x14')]('/:id',auth[_0x1665('0x9')](),controller[_0x1665('0x15')]);module[_0x1665('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 53a01ac..d0df2e8 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 _0x524e=['exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','lodash'];(function(_0x11fe15,_0x4f999d){var _0x1e7c0b=function(_0xbd08aa){while(--_0xbd08aa){_0x11fe15['push'](_0x11fe15['shift']());}};_0x1e7c0b(++_0x4f999d);}(_0x524e,0x15e));var _0xe524=function(_0x5d8491,_0x49ae38){_0x5d8491=_0x5d8491-0x0;var _0x1eaff4=_0x524e[_0x5d8491];return _0x1eaff4;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require(_0xe524('0x0'));module[_0xe524('0x1')]={'title':{'type':Sequelize[_0xe524('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe524('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xe524('0x3')](_0xe524('0x4')),'get':function(){try{return JSON[_0xe524('0x5')](this[_0xe524('0x6')](_0xe524('0x7')));}catch(_0x110cff){return[];}},'set':function(_0x4f75d6){try{this[_0xe524('0x8')](_0xe524('0x7'),JSON[_0xe524('0x9')](_0x4f75d6));}catch(_0x533c14){this[_0xe524('0x8')](_0xe524('0x7'),JSON[_0xe524('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xe524('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xe524('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xe524('0xa')]},'col':{'type':Sequelize[_0xe524('0xa')]},'background':{'type':Sequelize[_0xe524('0x2')],'allowNull':![],'defaultValue':_0xe524('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xe524('0x2')],'allowNull':![],'defaultValue':_0xe524('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xe524('0x2')]},'titleFontSize':{'type':Sequelize[_0xe524('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x9536=['squel','lodash','exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize'];(function(_0x4d7169,_0x558b4e){var _0x59f92e=function(_0x586d7d){while(--_0x586d7d){_0x4d7169['push'](_0x4d7169['shift']());}};_0x59f92e(++_0x558b4e);}(_0x9536,0x179));var _0x6953=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0x9536[_0x9d1e6b];return _0x2b3070;};'use strict';var Sequelize=require(_0x6953('0x0'));var squel=require(_0x6953('0x1'));var _=require(_0x6953('0x2'));module[_0x6953('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6953('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x6953('0x5')),'get':function(){try{return JSON[_0x6953('0x6')](this[_0x6953('0x7')](_0x6953('0x8')));}catch(_0x2f3cc3){return[];}},'set':function(_0x494ac2){try{this[_0x6953('0x9')](_0x6953('0x8'),JSON[_0x6953('0xa')](_0x494ac2));}catch(_0x3e1aff){this[_0x6953('0x9')]('attrs',JSON[_0x6953('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x6953('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6953('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x6953('0xb')]},'background':{'type':Sequelize[_0x6953('0x4')],'allowNull':![],'defaultValue':_0x6953('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x6953('0x4')],'allowNull':![],'defaultValue':_0x6953('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6953('0x4')]},'titleFontSize':{'type':Sequelize[_0x6953('0xb')],'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 00f6999..20b175d 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 _0xb2bb=['count','set','apply','reject','save','update','then','destroy','name','show','params','model','DashboardItem','rawAttributes','keys','filters','intersection','query','attributes','fields','length','options','find','catch','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie3','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x285f25,_0x1f841c){var _0x5ef16a=function(_0x2f9897){while(--_0x2f9897){_0x285f25['push'](_0x285f25['shift']());}};_0x5ef16a(++_0x1f841c);}(_0xb2bb,0x198));var _0xbb2b=function(_0xffd8b0,_0x12c51f){_0xffd8b0=_0xffd8b0-0x0;var _0x301ba0=_0xb2bb[_0xffd8b0];return _0x301ba0;};'use strict';var emlformat=require(_0xbb2b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb2b('0x1'));var jsonpatch=require(_0xbb2b('0x2'));var rp=require(_0xbb2b('0x3'));var moment=require(_0xbb2b('0x4'));var BPromise=require(_0xbb2b('0x5'));var Mustache=require(_0xbb2b('0x6'));var util=require(_0xbb2b('0x7'));var path=require('path');var sox=require(_0xbb2b('0x8'));var csv=require(_0xbb2b('0x9'));var ejs=require(_0xbb2b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb2b('0xb'));var squel=require(_0xbb2b('0xc'));var crypto=require(_0xbb2b('0xd'));var jsforce=require(_0xbb2b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbb2b('0x9'));var querystring=require(_0xbb2b('0xf'));var Papa=require(_0xbb2b('0x10'));var Redis=require(_0xbb2b('0x11'));var authService=require(_0xbb2b('0x12'));var qs=require(_0xbb2b('0x13'));var as=require(_0xbb2b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbb2b('0x15'));var utils=require(_0xbb2b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb2b('0x17'));var db=require(_0xbb2b('0x18'))['db'];config[_0xbb2b('0x19')]=_['defaults'](config[_0xbb2b('0x19')],{'host':_0xbb2b('0x1a'),'port':0x18eb});var socket=require(_0xbb2b('0x1b'))(new Redis(config['redis']));require(_0xbb2b('0x1c'))[_0xbb2b('0x1d')](socket);function respondWithStatusCode(_0x299be5,_0x420790){_0x420790=_0x420790||0xcc;return function(_0x5b1ed4){if(_0x5b1ed4){return _0x299be5[_0xbb2b('0x1e')](_0x420790);}return _0x299be5[_0xbb2b('0x1f')](_0x420790)[_0xbb2b('0x20')]();};}function respondWithResult(_0x16facd,_0x16418e){_0x16418e=_0x16418e||0xc8;return function(_0x4946fe){if(_0x4946fe){return _0x16facd[_0xbb2b('0x1f')](_0x16418e)[_0xbb2b('0x21')](_0x4946fe);}};}function respondWithFilteredResult(_0x19296e,_0xfe488c){return function(_0x49e14a){if(_0x49e14a){var _0x30b18f=typeof _0xfe488c[_0xbb2b('0x22')]===_0xbb2b('0x23')&&typeof _0xfe488c[_0xbb2b('0x24')]===_0xbb2b('0x23');var _0x15c22e=_0x49e14a['count'];var _0x3ab5cf=_0x30b18f?0x0:_0xfe488c[_0xbb2b('0x22')];var _0x111b39=_0x30b18f?_0x49e14a[_0xbb2b('0x25')]:_0xfe488c['offset']+_0xfe488c[_0xbb2b('0x24')];var _0x355b04;if(_0x111b39>=_0x15c22e){_0x111b39=_0x15c22e;_0x355b04=0xc8;}else{_0x355b04=0xce;}_0x19296e['status'](_0x355b04);return _0x19296e[_0xbb2b('0x26')]('Content-Range',_0x3ab5cf+'-'+_0x111b39+'/'+_0x15c22e)[_0xbb2b('0x21')](_0x49e14a);}return null;};}function patchUpdates(_0x3ad58c){return function(_0x5d1b8e){try{jsonpatch[_0xbb2b('0x27')](_0x5d1b8e,_0x3ad58c,!![]);}catch(_0x4277e1){return BPromise[_0xbb2b('0x28')](_0x4277e1);}return _0x5d1b8e[_0xbb2b('0x29')]();};}function saveUpdates(_0x114341,_0x28649e){return function(_0x5d4faa){if(_0x5d4faa){return _0x5d4faa[_0xbb2b('0x2a')](_0x114341)[_0xbb2b('0x2b')](function(_0x4e25c6){return _0x4e25c6;});}return null;};}function removeEntity(_0x47851c,_0xb791b6){return function(_0x5ac4ba){if(_0x5ac4ba){return _0x5ac4ba[_0xbb2b('0x2c')]()[_0xbb2b('0x2b')](function(){_0x47851c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x11f382,_0x3f4def){return function(_0x226e4a){if(!_0x226e4a){_0x11f382[_0xbb2b('0x1e')](0x194);}return _0x226e4a;};}function handleError(_0x453d12,_0x360fae){_0x360fae=_0x360fae||0x1f4;return function(_0x384c29){logger['error'](_0x384c29['stack']);if(_0x384c29['name']){delete _0x384c29[_0xbb2b('0x2d')];}_0x453d12[_0xbb2b('0x1f')](_0x360fae)['send'](_0x384c29);};}exports[_0xbb2b('0x2e')]=function(_0x142e23,_0x3945ac){var _0x17b788={'raw':![],'where':{'id':_0x142e23[_0xbb2b('0x2f')]['id']}},_0x43afdf={};_0x43afdf[_0xbb2b('0x30')]=_['keys'](db[_0xbb2b('0x31')][_0xbb2b('0x32')]);_0x43afdf['query']=_[_0xbb2b('0x33')](_0x142e23['query']);_0x43afdf[_0xbb2b('0x34')]=_[_0xbb2b('0x35')](_0x43afdf[_0xbb2b('0x30')],_0x43afdf[_0xbb2b('0x36')]);_0x17b788[_0xbb2b('0x37')]=_[_0xbb2b('0x35')](_0x43afdf['model'],qs[_0xbb2b('0x38')](_0x142e23['query']['fields']));_0x17b788['attributes']=_0x17b788[_0xbb2b('0x37')][_0xbb2b('0x39')]?_0x17b788[_0xbb2b('0x37')]:_0x43afdf[_0xbb2b('0x30')];if(_0x142e23[_0xbb2b('0x36')]['includeAll']){_0x17b788['include']=[{'all':!![]}];}_0x17b788=_['merge']({},_0x17b788,_0x142e23[_0xbb2b('0x3a')]);return db[_0xbb2b('0x31')][_0xbb2b('0x3b')](_0x17b788)[_0xbb2b('0x2b')](handleEntityNotFound(_0x3945ac,null))[_0xbb2b('0x2b')](respondWithResult(_0x3945ac,null))[_0xbb2b('0x3c')](handleError(_0x3945ac,null));};exports[_0xbb2b('0x2c')]=function(_0x174fa0,_0x458b1c){return db[_0xbb2b('0x31')][_0xbb2b('0x3b')]({'where':{'id':_0x174fa0['params']['id']}})[_0xbb2b('0x2b')](handleEntityNotFound(_0x458b1c,null))[_0xbb2b('0x2b')](removeEntity(_0x458b1c,null))[_0xbb2b('0x3c')](handleError(_0x458b1c,null));};function widgetAttributes(_0x4e00dc){try{switch(_0x4e00dc['type']){case _0xbb2b('0x3d'):return[{'name':_0xbb2b('0x3e'),'value':_0x4e00dc[_0xbb2b('0x3e')]||(_0x4e00dc['attrs']&&_0x4e00dc[_0xbb2b('0x3f')][0x0]?_0x4e00dc['attrs'][0x0][_0xbb2b('0x40')]:undefined)||_0xbb2b('0x41')}];case'custom':return[{'name':_0xbb2b('0x42'),'value':_0x4e00dc['attrPath']||(_0x4e00dc[_0xbb2b('0x3f')]&&_0x4e00dc[_0xbb2b('0x3f')][0x0]?_0x4e00dc[_0xbb2b('0x3f')][0x0][_0xbb2b('0x40')]:undefined)||''}];case _0xbb2b('0x43'):return[{'name':_0xbb2b('0x44'),'value':_0x4e00dc['attrHourFormat']||(_0x4e00dc[_0xbb2b('0x3f')]&&_0x4e00dc[_0xbb2b('0x3f')][0x0]?_0x4e00dc[_0xbb2b('0x3f')][0x0]['value']:undefined)||_0xbb2b('0x45')},{'name':'attrTimezone','value':_0x4e00dc[_0xbb2b('0x46')]||(_0x4e00dc['attrs']&&_0x4e00dc[_0xbb2b('0x3f')][0x1]?_0x4e00dc['attrs'][0x1]['value']:undefined)||_0xbb2b('0x47')},{'name':_0xbb2b('0x48'),'value':_0x4e00dc[_0xbb2b('0x48')]||(_0x4e00dc[_0xbb2b('0x3f')]&&_0x4e00dc['attrs'][0x2]?_0x4e00dc[_0xbb2b('0x3f')][0x2][_0xbb2b('0x40')]:undefined)||0xc}];case _0xbb2b('0x49'):return[{'name':_0xbb2b('0x4a'),'value':_0x4e00dc[_0xbb2b('0x4a')]||(_0x4e00dc[_0xbb2b('0x3f')]&&_0x4e00dc[_0xbb2b('0x3f')][0x0]?_0x4e00dc['attrs'][0x0][_0xbb2b('0x40')]:undefined)||_0xbb2b('0x4b')},{'name':_0xbb2b('0x4c'),'value':_0x4e00dc[_0xbb2b('0x4c')]||(_0x4e00dc[_0xbb2b('0x3f')]&&_0x4e00dc[_0xbb2b('0x3f')][0x1]?_0x4e00dc['attrs'][0x1][_0xbb2b('0x40')]:undefined)||[]},{'name':'attrFontSize','value':_0x4e00dc[_0xbb2b('0x48')]||(_0x4e00dc[_0xbb2b('0x3f')]&&_0x4e00dc[_0xbb2b('0x3f')][0x2]?_0x4e00dc[_0xbb2b('0x3f')][0x2]['value']:undefined)||0x14}];case _0xbb2b('0x4d'):case _0xbb2b('0x4e'):return[{'name':_0xbb2b('0x4f'),'value':_0x4e00dc[_0xbb2b('0x4f')]||(_0x4e00dc[_0xbb2b('0x3f')]&&_0x4e00dc[_0xbb2b('0x3f')][0x0]?_0x4e00dc['attrs'][0x0][_0xbb2b('0x40')]:undefined)||_0xbb2b('0x4b')},{'name':'attrSerie2','value':_0x4e00dc['attrSerie2']||(_0x4e00dc[_0xbb2b('0x3f')]&&_0x4e00dc[_0xbb2b('0x3f')][0x1]?_0x4e00dc[_0xbb2b('0x3f')][0x1]['value']:undefined)||null},{'name':_0xbb2b('0x50'),'value':_0x4e00dc[_0xbb2b('0x50')]||(_0x4e00dc[_0xbb2b('0x3f')]&&_0x4e00dc[_0xbb2b('0x3f')][0x2]?_0x4e00dc['attrs'][0x2][_0xbb2b('0x40')]:undefined)||null},{'name':_0xbb2b('0x4c'),'value':_0x4e00dc[_0xbb2b('0x4c')]||(_0x4e00dc[_0xbb2b('0x3f')]&&_0x4e00dc[_0xbb2b('0x3f')][0x3]?_0x4e00dc[_0xbb2b('0x3f')][0x3][_0xbb2b('0x40')]:undefined)||[]}];case'web-report':return[{'name':_0xbb2b('0x51'),'type':_0x4e00dc[_0xbb2b('0x52')]||(_0x4e00dc['attrs']&&_0x4e00dc[_0xbb2b('0x3f')][0x0]?_0x4e00dc[_0xbb2b('0x3f')][0x0][_0xbb2b('0x53')]:undefined)||null,'value':_0x4e00dc[_0xbb2b('0x51')]||(_0x4e00dc[_0xbb2b('0x3f')]&&_0x4e00dc[_0xbb2b('0x3f')][0x0]?_0x4e00dc[_0xbb2b('0x3f')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x4e00dc[_0xbb2b('0x54')]||(_0x4e00dc[_0xbb2b('0x3f')]&&_0x4e00dc[_0xbb2b('0x3f')][0x1]?_0x4e00dc[_0xbb2b('0x3f')][0x1][_0xbb2b('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x62967b){logger['error'](_0xbb2b('0x55'),JSON[_0xbb2b('0x56')](_0x62967b));return[];}}exports[_0xbb2b('0x57')]=function(_0x27830a,_0x338a62){if(_0x27830a['body']){_0x27830a[_0xbb2b('0x58')]['attrs']=widgetAttributes(_0x27830a[_0xbb2b('0x58')]);}return db[_0xbb2b('0x31')][_0xbb2b('0x57')](_0x27830a[_0xbb2b('0x58')],{})[_0xbb2b('0x2b')](respondWithResult(_0x338a62,0xc9))['catch'](handleError(_0x338a62,null));};exports[_0xbb2b('0x2a')]=function(_0x3928c3,_0x27dc21){if(_0x3928c3[_0xbb2b('0x58')]['id']){delete _0x3928c3[_0xbb2b('0x58')]['id'];}_0x3928c3['body'][_0xbb2b('0x3f')]=widgetAttributes(_0x3928c3[_0xbb2b('0x58')]);return db[_0xbb2b('0x31')][_0xbb2b('0x3b')]({'where':{'id':_0x3928c3[_0xbb2b('0x2f')]['id']}})[_0xbb2b('0x2b')](handleEntityNotFound(_0x27dc21,null))[_0xbb2b('0x2b')](saveUpdates(_0x3928c3[_0xbb2b('0x58')],null))[_0xbb2b('0x2b')](respondWithResult(_0x27dc21,null))[_0xbb2b('0x3c')](handleError(_0x27dc21,null));}; \ No newline at end of file +var _0x295f=['lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','./dashboardItem.socket','register','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','show','params','model','rawAttributes','query','keys','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','DashboardItem','type','iframe','attrUrl','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0x295f,0x104));var _0xf295=function(_0x44a38b,_0x377276){_0x44a38b=_0x44a38b-0x0;var _0x5b4d31=_0x295f[_0x44a38b];return _0x5b4d31;};'use strict';var emlformat=require(_0xf295('0x0'));var rimraf=require(_0xf295('0x1'));var zipdir=require(_0xf295('0x2'));var jsonpatch=require(_0xf295('0x3'));var rp=require(_0xf295('0x4'));var moment=require(_0xf295('0x5'));var BPromise=require(_0xf295('0x6'));var Mustache=require(_0xf295('0x7'));var util=require(_0xf295('0x8'));var path=require(_0xf295('0x9'));var sox=require(_0xf295('0xa'));var csv=require(_0xf295('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf295('0xc'));var _=require(_0xf295('0xd'));var squel=require('squel');var crypto=require(_0xf295('0xe'));var jsforce=require(_0xf295('0xf'));var deskjs=require(_0xf295('0x10'));var toCsv=require(_0xf295('0xb'));var querystring=require(_0xf295('0x11'));var Papa=require(_0xf295('0x12'));var Redis=require('ioredis');var authService=require(_0xf295('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf295('0x14'));var logger=require(_0xf295('0x15'))(_0xf295('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf295('0x17'));var db=require(_0xf295('0x18'))['db'];config[_0xf295('0x19')]=_['defaults'](config[_0xf295('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf295('0x19')]));require(_0xf295('0x1a'))[_0xf295('0x1b')](socket);function respondWithStatusCode(_0x4d499a,_0xa52136){_0xa52136=_0xa52136||0xcc;return function(_0x156b63){if(_0x156b63){return _0x4d499a['sendStatus'](_0xa52136);}return _0x4d499a[_0xf295('0x1c')](_0xa52136)['end']();};}function respondWithResult(_0x34fdcf,_0x5b79e9){_0x5b79e9=_0x5b79e9||0xc8;return function(_0x1c018c){if(_0x1c018c){return _0x34fdcf[_0xf295('0x1c')](_0x5b79e9)['json'](_0x1c018c);}};}function respondWithFilteredResult(_0x23e1b4,_0x5a5b56){return function(_0xa9cdf9){if(_0xa9cdf9){var _0x3c04f5=typeof _0x5a5b56[_0xf295('0x1d')]===_0xf295('0x1e')&&typeof _0x5a5b56[_0xf295('0x1f')]===_0xf295('0x1e');var _0x59c220=_0xa9cdf9[_0xf295('0x20')];var _0x45d47c=_0x3c04f5?0x0:_0x5a5b56['offset'];var _0x2cefb3=_0x3c04f5?_0xa9cdf9[_0xf295('0x20')]:_0x5a5b56['offset']+_0x5a5b56[_0xf295('0x1f')];var _0x621a48;if(_0x2cefb3>=_0x59c220){_0x2cefb3=_0x59c220;_0x621a48=0xc8;}else{_0x621a48=0xce;}_0x23e1b4[_0xf295('0x1c')](_0x621a48);return _0x23e1b4['set'](_0xf295('0x21'),_0x45d47c+'-'+_0x2cefb3+'/'+_0x59c220)[_0xf295('0x22')](_0xa9cdf9);}return null;};}function patchUpdates(_0x1e7256){return function(_0x346685){try{jsonpatch[_0xf295('0x23')](_0x346685,_0x1e7256,!![]);}catch(_0x48105e){return BPromise[_0xf295('0x24')](_0x48105e);}return _0x346685[_0xf295('0x25')]();};}function saveUpdates(_0x5c676c,_0x89ae8c){return function(_0x5a46c3){if(_0x5a46c3){return _0x5a46c3[_0xf295('0x26')](_0x5c676c)[_0xf295('0x27')](function(_0x2dfc4c){return _0x2dfc4c;});}return null;};}function removeEntity(_0x1427fe,_0x4ddaea){return function(_0x4abd53){if(_0x4abd53){return _0x4abd53[_0xf295('0x28')]()['then'](function(){_0x1427fe['status'](0xcc)[_0xf295('0x29')]();});}};}function handleEntityNotFound(_0x57fac0,_0x4ec514){return function(_0x4ddc68){if(!_0x4ddc68){_0x57fac0[_0xf295('0x2a')](0x194);}return _0x4ddc68;};}function handleError(_0x3fb39c,_0x5dde91){_0x5dde91=_0x5dde91||0x1f4;return function(_0x18dbe7){logger[_0xf295('0x2b')](_0x18dbe7[_0xf295('0x2c')]);if(_0x18dbe7[_0xf295('0x2d')]){delete _0x18dbe7[_0xf295('0x2d')];}_0x3fb39c[_0xf295('0x1c')](_0x5dde91)[_0xf295('0x2e')](_0x18dbe7);};}exports[_0xf295('0x2f')]=function(_0x5ede79,_0x3897fa){var _0x5b8f08={'raw':![],'where':{'id':_0x5ede79[_0xf295('0x30')]['id']}},_0x1f929c={};_0x1f929c[_0xf295('0x31')]=_['keys'](db['DashboardItem'][_0xf295('0x32')]);_0x1f929c[_0xf295('0x33')]=_[_0xf295('0x34')](_0x5ede79[_0xf295('0x33')]);_0x1f929c[_0xf295('0x35')]=_['intersection'](_0x1f929c[_0xf295('0x31')],_0x1f929c[_0xf295('0x33')]);_0x5b8f08[_0xf295('0x36')]=_[_0xf295('0x37')](_0x1f929c[_0xf295('0x31')],qs[_0xf295('0x38')](_0x5ede79[_0xf295('0x33')][_0xf295('0x38')]));_0x5b8f08['attributes']=_0x5b8f08[_0xf295('0x36')][_0xf295('0x39')]?_0x5b8f08[_0xf295('0x36')]:_0x1f929c[_0xf295('0x31')];if(_0x5ede79[_0xf295('0x33')][_0xf295('0x3a')]){_0x5b8f08[_0xf295('0x3b')]=[{'all':!![]}];}_0x5b8f08=_[_0xf295('0x3c')]({},_0x5b8f08,_0x5ede79[_0xf295('0x3d')]);return db['DashboardItem'][_0xf295('0x3e')](_0x5b8f08)[_0xf295('0x27')](handleEntityNotFound(_0x3897fa,null))['then'](respondWithResult(_0x3897fa,null))[_0xf295('0x3f')](handleError(_0x3897fa,null));};exports['destroy']=function(_0x3a4882,_0x16a094){return db[_0xf295('0x40')][_0xf295('0x3e')]({'where':{'id':_0x3a4882['params']['id']}})[_0xf295('0x27')](handleEntityNotFound(_0x16a094,null))[_0xf295('0x27')](removeEntity(_0x16a094,null))[_0xf295('0x3f')](handleError(_0x16a094,null));};function widgetAttributes(_0x4e7998){try{switch(_0x4e7998[_0xf295('0x41')]){case _0xf295('0x42'):return[{'name':_0xf295('0x43'),'value':_0x4e7998[_0xf295('0x43')]||(_0x4e7998[_0xf295('0x44')]&&_0x4e7998[_0xf295('0x44')][0x0]?_0x4e7998[_0xf295('0x44')][0x0][_0xf295('0x45')]:undefined)||_0xf295('0x46')}];case'custom':return[{'name':_0xf295('0x47'),'value':_0x4e7998[_0xf295('0x47')]||(_0x4e7998[_0xf295('0x44')]&&_0x4e7998[_0xf295('0x44')][0x0]?_0x4e7998[_0xf295('0x44')][0x0][_0xf295('0x45')]:undefined)||''}];case'clock':return[{'name':_0xf295('0x48'),'value':_0x4e7998[_0xf295('0x48')]||(_0x4e7998['attrs']&&_0x4e7998[_0xf295('0x44')][0x0]?_0x4e7998[_0xf295('0x44')][0x0]['value']:undefined)||_0xf295('0x49')},{'name':_0xf295('0x4a'),'value':_0x4e7998[_0xf295('0x4a')]||(_0x4e7998['attrs']&&_0x4e7998[_0xf295('0x44')][0x1]?_0x4e7998[_0xf295('0x44')][0x1][_0xf295('0x45')]:undefined)||_0xf295('0x4b')},{'name':_0xf295('0x4c'),'value':_0x4e7998['attrFontSize']||(_0x4e7998[_0xf295('0x44')]&&_0x4e7998[_0xf295('0x44')][0x2]?_0x4e7998['attrs'][0x2][_0xf295('0x45')]:undefined)||0xc}];case _0xf295('0x4d'):return[{'name':_0xf295('0x4e'),'value':_0x4e7998[_0xf295('0x4e')]||(_0x4e7998[_0xf295('0x44')]&&_0x4e7998[_0xf295('0x44')][0x0]?_0x4e7998[_0xf295('0x44')][0x0][_0xf295('0x45')]:undefined)||_0xf295('0x4f')},{'name':_0xf295('0x50'),'value':_0x4e7998[_0xf295('0x50')]||(_0x4e7998[_0xf295('0x44')]&&_0x4e7998['attrs'][0x1]?_0x4e7998['attrs'][0x1][_0xf295('0x45')]:undefined)||[]},{'name':'attrFontSize','value':_0x4e7998['attrFontSize']||(_0x4e7998[_0xf295('0x44')]&&_0x4e7998[_0xf295('0x44')][0x2]?_0x4e7998[_0xf295('0x44')][0x2][_0xf295('0x45')]:undefined)||0x14}];case _0xf295('0x51'):case _0xf295('0x52'):return[{'name':_0xf295('0x53'),'value':_0x4e7998[_0xf295('0x53')]||(_0x4e7998[_0xf295('0x44')]&&_0x4e7998[_0xf295('0x44')][0x0]?_0x4e7998[_0xf295('0x44')][0x0][_0xf295('0x45')]:undefined)||'total'},{'name':_0xf295('0x54'),'value':_0x4e7998[_0xf295('0x54')]||(_0x4e7998['attrs']&&_0x4e7998[_0xf295('0x44')][0x1]?_0x4e7998[_0xf295('0x44')][0x1][_0xf295('0x45')]:undefined)||null},{'name':_0xf295('0x55'),'value':_0x4e7998[_0xf295('0x55')]||(_0x4e7998[_0xf295('0x44')]&&_0x4e7998[_0xf295('0x44')][0x2]?_0x4e7998[_0xf295('0x44')][0x2][_0xf295('0x45')]:undefined)||null},{'name':_0xf295('0x50'),'value':_0x4e7998[_0xf295('0x50')]||(_0x4e7998[_0xf295('0x44')]&&_0x4e7998[_0xf295('0x44')][0x3]?_0x4e7998['attrs'][0x3][_0xf295('0x45')]:undefined)||[]}];case'web-report':return[{'name':_0xf295('0x56'),'type':_0x4e7998['reportType']||(_0x4e7998[_0xf295('0x44')]&&_0x4e7998['attrs'][0x0]?_0x4e7998['attrs'][0x0][_0xf295('0x41')]:undefined)||null,'value':_0x4e7998[_0xf295('0x56')]||(_0x4e7998['attrs']&&_0x4e7998['attrs'][0x0]?_0x4e7998[_0xf295('0x44')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x4e7998[_0xf295('0x57')]||(_0x4e7998[_0xf295('0x44')]&&_0x4e7998[_0xf295('0x44')][0x1]?_0x4e7998[_0xf295('0x44')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x517c93){logger[_0xf295('0x2b')]('widgetAttributes:\x20%s',JSON[_0xf295('0x58')](_0x517c93));return[];}}exports[_0xf295('0x59')]=function(_0x78ec40,_0x36f830){if(_0x78ec40[_0xf295('0x5a')]){_0x78ec40[_0xf295('0x5a')][_0xf295('0x44')]=widgetAttributes(_0x78ec40['body']);}return db[_0xf295('0x40')]['create'](_0x78ec40[_0xf295('0x5a')],{})[_0xf295('0x27')](respondWithResult(_0x36f830,0xc9))[_0xf295('0x3f')](handleError(_0x36f830,null));};exports[_0xf295('0x26')]=function(_0x3a3422,_0x12cbcc){if(_0x3a3422[_0xf295('0x5a')]['id']){delete _0x3a3422[_0xf295('0x5a')]['id'];}_0x3a3422[_0xf295('0x5a')][_0xf295('0x44')]=widgetAttributes(_0x3a3422[_0xf295('0x5a')]);return db[_0xf295('0x40')][_0xf295('0x3e')]({'where':{'id':_0x3a3422[_0xf295('0x30')]['id']}})[_0xf295('0x27')](handleEntityNotFound(_0x12cbcc,null))[_0xf295('0x27')](saveUpdates(_0x3a3422[_0xf295('0x5a')],null))[_0xf295('0x27')](respondWithResult(_0x12cbcc,null))[_0xf295('0x3f')](handleError(_0x12cbcc,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index a5d33c0..bbd6aea 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 _0x48c3=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x48c3,0x1d2));var _0x348c=function(_0x167b85,_0x1d21b8){_0x167b85=_0x167b85-0x0;var _0x4fc2f6=_0x48c3[_0x167b85];return _0x4fc2f6;};'use strict';var EventEmitter=require(_0x348c('0x0'));var DashboardItem=require(_0x348c('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x348c('0x2')](0x0);var events={'afterCreate':_0x348c('0x3'),'afterUpdate':_0x348c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x9c185){return function(_0x3fa65b,_0x44bff7,_0x3474c6){DashboardItemEvents[_0x348c('0x5')](_0x9c185+':'+_0x3fa65b['id'],_0x3fa65b);DashboardItemEvents[_0x348c('0x5')](_0x9c185,_0x3fa65b);_0x3474c6(null);};}for(var e in events){if(events[_0x348c('0x6')](e)){var event=events[e];DashboardItem[_0x348c('0x7')](e,emitEvent(event));}}module[_0x348c('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x55f9=['exports','../../mysqldb','save','update','emit'];(function(_0x29279c,_0x570176){var _0x279b1f=function(_0xd36d1f){while(--_0xd36d1f){_0x29279c['push'](_0x29279c['shift']());}};_0x279b1f(++_0x570176);}(_0x55f9,0x1aa));var _0x955f=function(_0x415f9b,_0x40ad3a){_0x415f9b=_0x415f9b-0x0;var _0x2e5986=_0x55f9[_0x415f9b];return _0x2e5986;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x955f('0x0'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x955f('0x1'),'afterUpdate':_0x955f('0x2'),'afterDestroy':'remove'};function emitEvent(_0x26519b){return function(_0x329710,_0x7f4fe4,_0x18b432){DashboardItemEvents[_0x955f('0x3')](_0x26519b+':'+_0x329710['id'],_0x329710);DashboardItemEvents[_0x955f('0x3')](_0x26519b,_0x329710);_0x18b432(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x955f('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 6c1a430..3b5c962 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 _0x75cf=['api','moment','request-promise','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util'];(function(_0x26cdcf,_0x34c597){var _0x5970e5=function(_0x107db9){while(--_0x107db9){_0x26cdcf['push'](_0x26cdcf['shift']());}};_0x5970e5(++_0x34c597);}(_0x75cf,0x18a));var _0xf75c=function(_0x3401b9,_0x1829a0){_0x3401b9=_0x3401b9-0x0;var _0x4bc48c=_0x75cf[_0x3401b9];return _0x4bc48c;};'use strict';var _=require(_0xf75c('0x0'));var util=require(_0xf75c('0x1'));var logger=require('../../config/logger')(_0xf75c('0x2'));var moment=require(_0xf75c('0x3'));var BPromise=require('bluebird');var rp=require(_0xf75c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf75c('0x5'));var attributes=require(_0xf75c('0x6'));module[_0xf75c('0x7')]=function(_0x5abcc2,_0x221f5c){return _0x5abcc2[_0xf75c('0x8')](_0xf75c('0x9'),attributes,{'tableName':_0xf75c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeacb=['../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x97e53c,_0x313cce){var _0x2c2282=function(_0x5905a6){while(--_0x5905a6){_0x97e53c['push'](_0x97e53c['shift']());}};_0x2c2282(++_0x313cce);}(_0xeacb,0x199));var _0xbeac=function(_0x3d8171,_0x4279f8){_0x3d8171=_0x3d8171-0x0;var _0x2976be=_0xeacb[_0x3d8171];return _0x2976be;};'use strict';var _=require(_0xbeac('0x0'));var util=require('util');var logger=require(_0xbeac('0x1'))(_0xbeac('0x2'));var moment=require(_0xbeac('0x3'));var BPromise=require(_0xbeac('0x4'));var rp=require(_0xbeac('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbeac('0x6'));var config=require(_0xbeac('0x7'));var attributes=require(_0xbeac('0x8'));module[_0xbeac('0x9')]=function(_0x1c082d,_0x1660f5){return _0x1c082d[_0xbeac('0xa')](_0xbeac('0xb'),attributes,{'tableName':_0xbeac('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index dc1bcfa..7f98bdf 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 _0xda47=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','redis','defaults','localhost','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xda47,0x120));var _0x7da4=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0xda47[_0x5eef05];return _0x56d4b8;};'use strict';var _=require(_0x7da4('0x0'));var util=require(_0x7da4('0x1'));var moment=require(_0x7da4('0x2'));var BPromise=require(_0x7da4('0x3'));var rs=require(_0x7da4('0x4'));var fs=require('fs');var Redis=require(_0x7da4('0x5'));var db=require(_0x7da4('0x6'))['db'];var utils=require(_0x7da4('0x7'));var logger=require(_0x7da4('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7da4('0x9')]({'port':0x232a});config[_0x7da4('0xa')]=_[_0x7da4('0xb')](config[_0x7da4('0xa')],{'host':_0x7da4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7da4('0xa')]));require(_0x7da4('0xd'))[_0x7da4('0xe')](socket);function respondWithRpcPromise(_0x56a708,_0x315c1e,_0x5df445){return new BPromise(function(_0x4d0946,_0x5b9705){return client[_0x7da4('0xf')](_0x56a708,_0x5df445)[_0x7da4('0x10')](function(_0x1033b6){logger[_0x7da4('0x11')](_0x7da4('0x12'),_0x315c1e,_0x7da4('0x13'));logger[_0x7da4('0x14')](_0x7da4('0x15'),_0x315c1e,_0x7da4('0x13'),JSON['stringify'](_0x1033b6));if(_0x1033b6[_0x7da4('0x16')]){if(_0x1033b6['error'][_0x7da4('0x17')]===0x1f4){logger[_0x7da4('0x16')](_0x7da4('0x12'),_0x315c1e,_0x1033b6[_0x7da4('0x16')]['message']);return _0x5b9705(_0x1033b6[_0x7da4('0x16')][_0x7da4('0x18')]);}logger[_0x7da4('0x16')](_0x7da4('0x12'),_0x315c1e,_0x1033b6[_0x7da4('0x16')]['message']);return _0x4d0946(_0x1033b6[_0x7da4('0x16')][_0x7da4('0x18')]);}else{logger[_0x7da4('0x11')](_0x7da4('0x12'),_0x315c1e,_0x7da4('0x13'));_0x4d0946(_0x1033b6['result']['message']);}})[_0x7da4('0x19')](function(_0x4384e1){logger['error'](_0x7da4('0x12'),_0x315c1e,_0x4384e1);_0x5b9705(_0x4384e1);});});} \ No newline at end of file +var _0x7499=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x7499,0x1bb));var _0x9749=function(_0x2f3947,_0x2ee083){_0x2f3947=_0x2f3947-0x0;var _0x3e6ab7=_0x7499[_0x2f3947];return _0x3e6ab7;};'use strict';var _=require(_0x9749('0x0'));var util=require(_0x9749('0x1'));var moment=require('moment');var BPromise=require(_0x9749('0x2'));var rs=require(_0x9749('0x3'));var fs=require('fs');var Redis=require(_0x9749('0x4'));var db=require(_0x9749('0x5'))['db'];var utils=require(_0x9749('0x6'));var logger=require(_0x9749('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9749('0x8'));var client=jayson[_0x9749('0x9')][_0x9749('0xa')]({'port':0x232a});config[_0x9749('0xb')]=_[_0x9749('0xc')](config['redis'],{'host':_0x9749('0xd'),'port':0x18eb});var socket=require(_0x9749('0xe'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0x9749('0xf')](socket);function respondWithRpcPromise(_0x1fda69,_0x2c6037,_0xb60bc2){return new BPromise(function(_0xe242f2,_0x4bf128){return client[_0x9749('0x10')](_0x1fda69,_0xb60bc2)['then'](function(_0x5aabec){logger[_0x9749('0x11')](_0x9749('0x12'),_0x2c6037,_0x9749('0x13'));logger[_0x9749('0x14')](_0x9749('0x15'),_0x2c6037,_0x9749('0x13'),JSON[_0x9749('0x16')](_0x5aabec));if(_0x5aabec[_0x9749('0x17')]){if(_0x5aabec[_0x9749('0x17')][_0x9749('0x18')]===0x1f4){logger['error'](_0x9749('0x12'),_0x2c6037,_0x5aabec[_0x9749('0x17')][_0x9749('0x19')]);return _0x4bf128(_0x5aabec[_0x9749('0x17')]['message']);}logger['error'](_0x9749('0x12'),_0x2c6037,_0x5aabec['error'][_0x9749('0x19')]);return _0xe242f2(_0x5aabec[_0x9749('0x17')]['message']);}else{logger['info'](_0x9749('0x12'),_0x2c6037,_0x9749('0x13'));_0xe242f2(_0x5aabec[_0x9749('0x1a')][_0x9749('0x19')]);}})[_0x9749('0x1b')](function(_0x2d5672){logger[_0x9749('0x17')](_0x9749('0x12'),_0x2c6037,_0x2d5672);_0x4bf128(_0x2d5672);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index fd89fcb..031e313 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 _0x54b7=['./dashboardItem.events','save','remove','update','emit','register','length','dashboardItem:'];(function(_0x8f4b4d,_0x538a8d){var _0x39b5b8=function(_0x31ed73){while(--_0x31ed73){_0x8f4b4d['push'](_0x8f4b4d['shift']());}};_0x39b5b8(++_0x538a8d);}(_0x54b7,0x188));var _0x754b=function(_0x357a4f,_0x869f31){_0x357a4f=_0x357a4f-0x0;var _0x372a9d=_0x54b7[_0x357a4f];return _0x372a9d;};'use strict';var DashboardItemEvents=require(_0x754b('0x0'));var events=[_0x754b('0x1'),_0x754b('0x2'),_0x754b('0x3')];function createListener(_0x2b01c1,_0x331cd3){return function(_0x236363){_0x331cd3[_0x754b('0x4')](_0x2b01c1,_0x236363);};}function removeListener(_0x3c9610,_0x538c8f){return function(){DashboardItemEvents['removeListener'](_0x3c9610,_0x538c8f);};}exports[_0x754b('0x5')]=function(_0xa6c47){for(var _0x11478e=0x0,_0x491482=events[_0x754b('0x6')];_0x11478e<_0x491482;_0x11478e++){var _0x4ec717=events[_0x11478e];var _0x139932=createListener(_0x754b('0x7')+_0x4ec717,_0xa6c47);DashboardItemEvents['on'](_0x4ec717,_0x139932);}}; \ No newline at end of file +var _0x0b32=['removeListener','register','length','dashboardItem:','save','update','emit'];(function(_0x1729df,_0x5be4a6){var _0x91cd6e=function(_0x1fab38){while(--_0x1fab38){_0x1729df['push'](_0x1729df['shift']());}};_0x91cd6e(++_0x5be4a6);}(_0x0b32,0x19a));var _0x20b3=function(_0x558f81,_0x129671){_0x558f81=_0x558f81-0x0;var _0x1d8d1b=_0x0b32[_0x558f81];return _0x1d8d1b;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x20b3('0x0'),'remove',_0x20b3('0x1')];function createListener(_0x3ee0d4,_0x25d1d8){return function(_0x2b1798){_0x25d1d8[_0x20b3('0x2')](_0x3ee0d4,_0x2b1798);};}function removeListener(_0x127f4b,_0x3a1e46){return function(){DashboardItemEvents[_0x20b3('0x3')](_0x127f4b,_0x3a1e46);};}exports[_0x20b3('0x4')]=function(_0x2d54ac){for(var _0x130f0a=0x0,_0xf2e6ae=events[_0x20b3('0x5')];_0x130f0a<_0xf2e6ae;_0x130f0a++){var _0xfa91ad=events[_0x130f0a];var _0x2e11df=createListener(_0x20b3('0x6')+_0xfa91ad,_0x2d54ac);DashboardItemEvents['on'](_0xfa91ad,_0x2e11df);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 5e8d0d8..d0b35b2 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 _0xb858=['util','path','connect-timeout','fs-extra','./dashboardItem.controller','get','/:id','isAuthenticated','show','exports','multer'];(function(_0xa3fadc,_0xd1e16){var _0x23ecb8=function(_0x2c71f7){while(--_0x2c71f7){_0xa3fadc['push'](_0xa3fadc['shift']());}};_0x23ecb8(++_0xd1e16);}(_0xb858,0x154));var _0x8b85=function(_0x246f47,_0x64a14a){_0x246f47=_0x246f47-0x0;var _0x26cf81=_0xb858[_0x246f47];return _0x26cf81;};'use strict';var multer=require(_0x8b85('0x0'));var util=require(_0x8b85('0x1'));var path=require(_0x8b85('0x2'));var timeout=require(_0x8b85('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8b85('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8b85('0x5'));router[_0x8b85('0x6')](_0x8b85('0x7'),auth[_0x8b85('0x8')](),controller[_0x8b85('0x9')]);router['post']('/',auth[_0x8b85('0x8')](),controller['create']);router['put'](_0x8b85('0x7'),auth[_0x8b85('0x8')](),controller['update']);router['delete'](_0x8b85('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x8b85('0xa')]=router; \ No newline at end of file +var _0x40c5=['post','/:id','delete','destroy','multer','util','connect-timeout','express','Router','../../config/environment','get','isAuthenticated'];(function(_0x7d4941,_0xc3b7f1){var _0x4ecc6e=function(_0x50d8fd){while(--_0x50d8fd){_0x7d4941['push'](_0x7d4941['shift']());}};_0x4ecc6e(++_0xc3b7f1);}(_0x40c5,0x1d8));var _0x540c=function(_0x2dba1a,_0x31ad56){_0x2dba1a=_0x2dba1a-0x0;var _0x9ff08f=_0x40c5[_0x2dba1a];return _0x9ff08f;};'use strict';var multer=require(_0x540c('0x0'));var util=require(_0x540c('0x1'));var path=require('path');var timeout=require(_0x540c('0x2'));var express=require(_0x540c('0x3'));var router=express[_0x540c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x540c('0x5'));var controller=require('./dashboardItem.controller');router[_0x540c('0x6')]('/:id',auth[_0x540c('0x7')](),controller['show']);router[_0x540c('0x8')]('/',auth[_0x540c('0x7')](),controller['create']);router['put'](_0x540c('0x9'),auth[_0x540c('0x7')](),controller['update']);router[_0x540c('0xa')](_0x540c('0x9'),auth[_0x540c('0x7')](),controller[_0x540c('0xb')]);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 678cf33..b698a05 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 _0x3edd=['third','exports','STRING','ENUM','first'];(function(_0x1c203f,_0x22fbd0){var _0x23c42b=function(_0x279a18){while(--_0x279a18){_0x1c203f['push'](_0x1c203f['shift']());}};_0x23c42b(++_0x22fbd0);}(_0x3edd,0x1dc));var _0xd3ed=function(_0x484974,_0x16c846){_0x484974=_0x484974-0x0;var _0xce0b5d=_0x3edd[_0x484974];return _0xce0b5d;};'use strict';var Sequelize=require('sequelize');module[_0xd3ed('0x0')]={'name':{'type':Sequelize[_0xd3ed('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xd3ed('0x2')](_0xd3ed('0x3'),'second',_0xd3ed('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xebb2=['first','second','third','sequelize','exports','STRING','ENUM'];(function(_0x4c570b,_0x857bb5){var _0x489ff9=function(_0x3d13b9){while(--_0x3d13b9){_0x4c570b['push'](_0x4c570b['shift']());}};_0x489ff9(++_0x857bb5);}(_0xebb2,0x15a));var _0x2ebb=function(_0x21a7c7,_0x5a98c7){_0x21a7c7=_0x21a7c7-0x0;var _0x3b54dd=_0xebb2[_0x21a7c7];return _0x3b54dd;};'use strict';var Sequelize=require(_0x2ebb('0x0'));module[_0x2ebb('0x1')]={'name':{'type':Sequelize[_0x2ebb('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x2ebb('0x3')](_0x2ebb('0x4'),_0x2ebb('0x5'),_0x2ebb('0x6')),'allowNull':![],'defaultValue':_0x2ebb('0x4')},'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 69e94bd..00eae41 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 _0x29e0=['model','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','intersection','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','get','Dispositions','error','name','send','index','map','Disposition','rawAttributes','fieldName','type','query','filters'];(function(_0x1ccf4f,_0x18ce33){var _0x3f747c=function(_0x166f08){while(--_0x166f08){_0x1ccf4f['push'](_0x1ccf4f['shift']());}};_0x3f747c(++_0x18ce33);}(_0x29e0,0x1c8));var _0x029e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x029e('0x0'));var rimraf=require(_0x029e('0x1'));var zipdir=require(_0x029e('0x2'));var jsonpatch=require(_0x029e('0x3'));var rp=require(_0x029e('0x4'));var moment=require(_0x029e('0x5'));var BPromise=require(_0x029e('0x6'));var Mustache=require(_0x029e('0x7'));var util=require(_0x029e('0x8'));var path=require(_0x029e('0x9'));var sox=require(_0x029e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x029e('0xb'));var _=require(_0x029e('0xc'));var squel=require(_0x029e('0xd'));var crypto=require('crypto');var jsforce=require(_0x029e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x029e('0xf'));var querystring=require(_0x029e('0x10'));var Papa=require(_0x029e('0x11'));var Redis=require(_0x029e('0x12'));var authService=require(_0x029e('0x13'));var qs=require(_0x029e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x029e('0x15'));var logger=require(_0x029e('0x16'))(_0x029e('0x17'));var utils=require(_0x029e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x029e('0x19'));var db=require(_0x029e('0x1a'))['db'];function respondWithStatusCode(_0x25a340,_0x1a9e07){_0x1a9e07=_0x1a9e07||0xcc;return function(_0xaaa66b){if(_0xaaa66b){return _0x25a340[_0x029e('0x1b')](_0x1a9e07);}return _0x25a340[_0x029e('0x1c')](_0x1a9e07)[_0x029e('0x1d')]();};}function respondWithResult(_0x31381c,_0x5a3708){_0x5a3708=_0x5a3708||0xc8;return function(_0x17c492){if(_0x17c492){return _0x31381c['status'](_0x5a3708)[_0x029e('0x1e')](_0x17c492);}};}function respondWithFilteredResult(_0x427f82,_0x4ba79c){return function(_0xebc7a8){if(_0xebc7a8){var _0x3d37c7=typeof _0x4ba79c[_0x029e('0x1f')]===_0x029e('0x20')&&typeof _0x4ba79c['limit']==='undefined';var _0x13f334=_0xebc7a8[_0x029e('0x21')];var _0x57eb0f=_0x3d37c7?0x0:_0x4ba79c[_0x029e('0x1f')];var _0x3e7b68=_0x3d37c7?_0xebc7a8[_0x029e('0x21')]:_0x4ba79c['offset']+_0x4ba79c[_0x029e('0x22')];var _0x32192a;if(_0x3e7b68>=_0x13f334){_0x3e7b68=_0x13f334;_0x32192a=0xc8;}else{_0x32192a=0xce;}_0x427f82[_0x029e('0x1c')](_0x32192a);return _0x427f82[_0x029e('0x23')](_0x029e('0x24'),_0x57eb0f+'-'+_0x3e7b68+'/'+_0x13f334)['json'](_0xebc7a8);}return null;};}function patchUpdates(_0x188c12){return function(_0x4cb568){try{jsonpatch['apply'](_0x4cb568,_0x188c12,!![]);}catch(_0x4396bd){return BPromise['reject'](_0x4396bd);}return _0x4cb568[_0x029e('0x25')]();};}function saveUpdates(_0x19a4b7,_0x2f155c){return function(_0x242b8a){if(_0x242b8a){return _0x242b8a[_0x029e('0x26')](_0x19a4b7)[_0x029e('0x27')](function(_0x42c41c){return _0x42c41c;});}return null;};}function removeEntity(_0x4d7993,_0x5000f5){return function(_0x195014){if(_0x195014){return _0x195014[_0x029e('0x28')]()[_0x029e('0x27')](function(){var _0x1c1dd9=_0x195014[_0x029e('0x29')]({'plain':!![]});var _0x3c1bd1=_0x029e('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x3c1bd1,'resourceId':_0x1c1dd9['id']}})[_0x029e('0x27')](function(){return _0x195014;});})[_0x029e('0x27')](function(){_0x4d7993[_0x029e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x265c93,_0x5a5e51){return function(_0x3d55b6){if(!_0x3d55b6){_0x265c93[_0x029e('0x1b')](0x194);}return _0x3d55b6;};}function handleError(_0x50a65b,_0x11028f){_0x11028f=_0x11028f||0x1f4;return function(_0x52bfd8){logger[_0x029e('0x2b')](_0x52bfd8['stack']);if(_0x52bfd8[_0x029e('0x2c')]){delete _0x52bfd8[_0x029e('0x2c')];}_0x50a65b[_0x029e('0x1c')](_0x11028f)[_0x029e('0x2d')](_0x52bfd8);};}exports[_0x029e('0x2e')]=function(_0x4c5500,_0x352076){var _0xdf7732={},_0x37b40f={},_0x57fa60={'count':0x0,'rows':[]};var _0x1b654f=_[_0x029e('0x2f')](db[_0x029e('0x30')][_0x029e('0x31')],function(_0x2d1f63){return{'name':_0x2d1f63[_0x029e('0x32')],'type':_0x2d1f63[_0x029e('0x33')]['key']};});_0x37b40f['model']=_['map'](_0x1b654f,_0x029e('0x2c'));_0x37b40f['query']=_['keys'](_0x4c5500[_0x029e('0x34')]);_0x37b40f[_0x029e('0x35')]=_['intersection'](_0x37b40f[_0x029e('0x36')],_0x37b40f[_0x029e('0x34')]);_0xdf7732[_0x029e('0x37')]=_['intersection'](_0x37b40f['model'],qs['fields'](_0x4c5500[_0x029e('0x34')]['fields']));_0xdf7732[_0x029e('0x37')]=_0xdf7732['attributes'][_0x029e('0x38')]?_0xdf7732[_0x029e('0x37')]:_0x37b40f[_0x029e('0x36')];if(!_0x4c5500[_0x029e('0x34')][_0x029e('0x39')](_0x029e('0x3a'))){_0xdf7732[_0x029e('0x22')]=qs[_0x029e('0x22')](_0x4c5500[_0x029e('0x34')]['limit']);_0xdf7732[_0x029e('0x1f')]=qs[_0x029e('0x1f')](_0x4c5500[_0x029e('0x34')][_0x029e('0x1f')]);}_0xdf7732[_0x029e('0x3b')]=qs['sort'](_0x4c5500[_0x029e('0x34')]['sort']);_0xdf7732[_0x029e('0x3c')]=qs[_0x029e('0x35')](_[_0x029e('0x3d')](_0x4c5500[_0x029e('0x34')],_0x37b40f[_0x029e('0x35')]),_0x1b654f);if(_0x4c5500[_0x029e('0x34')][_0x029e('0x3e')]){_0xdf7732[_0x029e('0x3c')]=_[_0x029e('0x3f')](_0xdf7732[_0x029e('0x3c')],{'$or':_['map'](_0x1b654f,function(_0x56e484){if(_0x56e484[_0x029e('0x33')]!=='VIRTUAL'){var _0x5ee923={};_0x5ee923[_0x56e484[_0x029e('0x2c')]]={'$like':'%'+_0x4c5500['query'][_0x029e('0x3e')]+'%'};return _0x5ee923;}})});}_0xdf7732=_[_0x029e('0x3f')]({},_0xdf7732,_0x4c5500[_0x029e('0x40')]);var _0x4b967f={'where':_0xdf7732[_0x029e('0x3c')]};return db['Disposition']['count'](_0x4b967f)[_0x029e('0x27')](function(_0x4c348a){_0x57fa60['count']=_0x4c348a;if(_0x4c5500[_0x029e('0x34')][_0x029e('0x41')]){_0xdf7732[_0x029e('0x42')]=[{'all':!![]}];}return db[_0x029e('0x30')][_0x029e('0x43')](_0xdf7732);})['then'](function(_0x2961a2){_0x57fa60[_0x029e('0x44')]=_0x2961a2;return _0x57fa60;})[_0x029e('0x27')](respondWithFilteredResult(_0x352076,_0xdf7732))[_0x029e('0x45')](handleError(_0x352076,null));};exports['show']=function(_0x5207b6,_0x23466b){var _0x33ee02={'raw':!![],'where':{'id':_0x5207b6[_0x029e('0x46')]['id']}},_0x2f7c7f={};_0x2f7c7f['model']=_[_0x029e('0x47')](db[_0x029e('0x30')][_0x029e('0x31')]);_0x2f7c7f[_0x029e('0x34')]=_[_0x029e('0x47')](_0x5207b6[_0x029e('0x34')]);_0x2f7c7f[_0x029e('0x35')]=_[_0x029e('0x48')](_0x2f7c7f['model'],_0x2f7c7f[_0x029e('0x34')]);_0x33ee02[_0x029e('0x37')]=_[_0x029e('0x48')](_0x2f7c7f['model'],qs[_0x029e('0x49')](_0x5207b6[_0x029e('0x34')][_0x029e('0x49')]));_0x33ee02[_0x029e('0x37')]=_0x33ee02[_0x029e('0x37')][_0x029e('0x38')]?_0x33ee02[_0x029e('0x37')]:_0x2f7c7f[_0x029e('0x36')];if(_0x5207b6[_0x029e('0x34')][_0x029e('0x41')]){_0x33ee02['include']=[{'all':!![]}];}_0x33ee02=_[_0x029e('0x3f')]({},_0x33ee02,_0x5207b6[_0x029e('0x40')]);return db[_0x029e('0x30')][_0x029e('0x4a')](_0x33ee02)['then'](handleEntityNotFound(_0x23466b,null))['then'](respondWithResult(_0x23466b,null))[_0x029e('0x45')](handleError(_0x23466b,null));};exports[_0x029e('0x4b')]=function(_0x23ce8a,_0x3ea219){return db['Disposition']['create'](_0x23ce8a['body'],{})[_0x029e('0x27')](function(_0x480fd8){var _0x57f8ac=_0x23ce8a[_0x029e('0x4c')]['get']({'plain':!![]});if(!_0x57f8ac)throw new Error(_0x029e('0x4d'));if(_0x57f8ac[_0x029e('0x4e')]===_0x029e('0x4c')){var _0xcf43fd=_0x480fd8[_0x029e('0x29')]({'plain':!![]});var _0x4b3dd5=_0x029e('0x2a');return db[_0x029e('0x4f')][_0x029e('0x4a')]({'where':{'name':_0x4b3dd5,'userProfileId':_0x57f8ac[_0x029e('0x50')]},'raw':!![]})[_0x029e('0x27')](function(_0x5730f8){if(_0x5730f8&&_0x5730f8[_0x029e('0x51')]===0x0){return db[_0x029e('0x52')][_0x029e('0x4b')]({'name':_0xcf43fd[_0x029e('0x2c')],'resourceId':_0xcf43fd['id'],'type':_0x5730f8[_0x029e('0x2c')],'sectionId':_0x5730f8['id']},{})[_0x029e('0x27')](function(){return _0x480fd8;});}else{return _0x480fd8;}})['catch'](function(_0x190d9d){logger[_0x029e('0x2b')](_0x029e('0x53'),_0x190d9d);throw _0x190d9d;});}return _0x480fd8;})[_0x029e('0x27')](respondWithResult(_0x3ea219,0xc9))['catch'](handleError(_0x3ea219,null));};exports[_0x029e('0x26')]=function(_0x12088f,_0x44caf5){if(_0x12088f['body']['id']){delete _0x12088f[_0x029e('0x54')]['id'];}return db[_0x029e('0x30')][_0x029e('0x4a')]({'where':{'id':_0x12088f[_0x029e('0x46')]['id']}})[_0x029e('0x27')](handleEntityNotFound(_0x44caf5,null))[_0x029e('0x27')](saveUpdates(_0x12088f['body'],null))[_0x029e('0x27')](respondWithResult(_0x44caf5,null))[_0x029e('0x45')](handleError(_0x44caf5,null));};exports[_0x029e('0x28')]=function(_0x599628,_0x413c70){return db[_0x029e('0x30')][_0x029e('0x4a')]({'where':{'id':_0x599628['params']['id']}})[_0x029e('0x27')](handleEntityNotFound(_0x413c70,null))[_0x029e('0x27')](removeEntity(_0x413c70,null))[_0x029e('0x45')](handleError(_0x413c70,null));}; \ No newline at end of file +var _0x4813=['show','fields','includeAll','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','params','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','offset','limit','Content-Range','apply','save','then','destroy','get','Dispositions','UserProfileResource','end','error','name','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4813,0x14e));var _0x3481=function(_0x5130e8,_0xae32b3){_0x5130e8=_0x5130e8-0x0;var _0x2fa29e=_0x4813[_0x5130e8];return _0x2fa29e;};'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(){var _0x59b203=_0x418a7d[_0x3481('0x21')]({'plain':!![]});var _0x3e5963=_0x3481('0x22');return db[_0x3481('0x23')]['destroy']({'where':{'type':_0x3e5963,'resourceId':_0x59b203['id']}})[_0x3481('0x1f')](function(){return _0x418a7d;});})[_0x3481('0x1f')](function(){_0x2185ba[_0x3481('0x18')](0xcc)[_0x3481('0x24')]();});}};}function handleEntityNotFound(_0xe79636,_0x3942c7){return function(_0xc4a238){if(!_0xc4a238){_0xe79636[_0x3481('0x17')](0x194);}return _0xc4a238;};}function handleError(_0x136718,_0x1fcfef){_0x1fcfef=_0x1fcfef||0x1f4;return function(_0x4a20d5){logger[_0x3481('0x25')](_0x4a20d5['stack']);if(_0x4a20d5[_0x3481('0x26')]){delete _0x4a20d5[_0x3481('0x26')];}_0x136718[_0x3481('0x18')](_0x1fcfef)['send'](_0x4a20d5);};}exports[_0x3481('0x27')]=function(_0x1fa9cc,_0x2df894){var _0x28699f={},_0x3e217b={},_0x59d53d={'count':0x0,'rows':[]};var _0x45603b=_[_0x3481('0x28')](db[_0x3481('0x29')][_0x3481('0x2a')],function(_0x4db65d){return{'name':_0x4db65d[_0x3481('0x2b')],'type':_0x4db65d[_0x3481('0x2c')][_0x3481('0x2d')]};});_0x3e217b[_0x3481('0x2e')]=_[_0x3481('0x28')](_0x45603b,_0x3481('0x26'));_0x3e217b[_0x3481('0x2f')]=_[_0x3481('0x30')](_0x1fa9cc['query']);_0x3e217b[_0x3481('0x31')]=_[_0x3481('0x32')](_0x3e217b[_0x3481('0x2e')],_0x3e217b['query']);_0x28699f[_0x3481('0x33')]=_['intersection'](_0x3e217b[_0x3481('0x2e')],qs['fields'](_0x1fa9cc[_0x3481('0x2f')]['fields']));_0x28699f[_0x3481('0x33')]=_0x28699f[_0x3481('0x33')][_0x3481('0x34')]?_0x28699f['attributes']:_0x3e217b[_0x3481('0x2e')];if(!_0x1fa9cc['query'][_0x3481('0x35')]('nolimit')){_0x28699f[_0x3481('0x1b')]=qs[_0x3481('0x1b')](_0x1fa9cc[_0x3481('0x2f')][_0x3481('0x1b')]);_0x28699f[_0x3481('0x1a')]=qs[_0x3481('0x1a')](_0x1fa9cc[_0x3481('0x2f')][_0x3481('0x1a')]);}_0x28699f[_0x3481('0x36')]=qs['sort'](_0x1fa9cc[_0x3481('0x2f')]['sort']);_0x28699f[_0x3481('0x37')]=qs[_0x3481('0x31')](_[_0x3481('0x38')](_0x1fa9cc[_0x3481('0x2f')],_0x3e217b['filters']),_0x45603b);if(_0x1fa9cc['query'][_0x3481('0x39')]){_0x28699f[_0x3481('0x37')]=_[_0x3481('0x3a')](_0x28699f[_0x3481('0x37')],{'$or':_['map'](_0x45603b,function(_0x2b3307){if(_0x2b3307[_0x3481('0x2c')]!==_0x3481('0x3b')){var _0x3de071={};_0x3de071[_0x2b3307[_0x3481('0x26')]]={'$like':'%'+_0x1fa9cc[_0x3481('0x2f')][_0x3481('0x39')]+'%'};return _0x3de071;}})});}_0x28699f=_['merge']({},_0x28699f,_0x1fa9cc[_0x3481('0x3c')]);var _0x10d779={'where':_0x28699f[_0x3481('0x37')]};return db['Disposition']['count'](_0x10d779)[_0x3481('0x1f')](function(_0x420b8c){_0x59d53d[_0x3481('0x3d')]=_0x420b8c;if(_0x1fa9cc['query']['includeAll']){_0x28699f[_0x3481('0x3e')]=[{'all':!![]}];}return db[_0x3481('0x29')][_0x3481('0x3f')](_0x28699f);})[_0x3481('0x1f')](function(_0x5c4928){_0x59d53d[_0x3481('0x40')]=_0x5c4928;return _0x59d53d;})['then'](respondWithFilteredResult(_0x2df894,_0x28699f))[_0x3481('0x41')](handleError(_0x2df894,null));};exports[_0x3481('0x42')]=function(_0x2f0a7f,_0x31d391){var _0x4b777f={'raw':!![],'where':{'id':_0x2f0a7f['params']['id']}},_0x5a9338={};_0x5a9338['model']=_[_0x3481('0x30')](db[_0x3481('0x29')][_0x3481('0x2a')]);_0x5a9338[_0x3481('0x2f')]=_[_0x3481('0x30')](_0x2f0a7f[_0x3481('0x2f')]);_0x5a9338[_0x3481('0x31')]=_[_0x3481('0x32')](_0x5a9338[_0x3481('0x2e')],_0x5a9338[_0x3481('0x2f')]);_0x4b777f[_0x3481('0x33')]=_['intersection'](_0x5a9338['model'],qs[_0x3481('0x43')](_0x2f0a7f[_0x3481('0x2f')][_0x3481('0x43')]));_0x4b777f[_0x3481('0x33')]=_0x4b777f['attributes'][_0x3481('0x34')]?_0x4b777f['attributes']:_0x5a9338[_0x3481('0x2e')];if(_0x2f0a7f[_0x3481('0x2f')][_0x3481('0x44')]){_0x4b777f[_0x3481('0x3e')]=[{'all':!![]}];}_0x4b777f=_[_0x3481('0x3a')]({},_0x4b777f,_0x2f0a7f['options']);return db[_0x3481('0x29')]['find'](_0x4b777f)[_0x3481('0x1f')](handleEntityNotFound(_0x31d391,null))[_0x3481('0x1f')](respondWithResult(_0x31d391,null))['catch'](handleError(_0x31d391,null));};exports[_0x3481('0x45')]=function(_0x54ec34,_0x27e106){return db[_0x3481('0x29')][_0x3481('0x45')](_0x54ec34['body'],{})['then'](function(_0x2e7c83){var _0x282e17=_0x54ec34[_0x3481('0x46')][_0x3481('0x21')]({'plain':!![]});if(!_0x282e17)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x282e17[_0x3481('0x47')]===_0x3481('0x46')){var _0xdd5422=_0x2e7c83['get']({'plain':!![]});var _0x59407a=_0x3481('0x22');return db[_0x3481('0x48')]['find']({'where':{'name':_0x59407a,'userProfileId':_0x282e17[_0x3481('0x49')]},'raw':!![]})[_0x3481('0x1f')](function(_0x236309){if(_0x236309&&_0x236309[_0x3481('0x4a')]===0x0){return db[_0x3481('0x23')]['create']({'name':_0xdd5422[_0x3481('0x26')],'resourceId':_0xdd5422['id'],'type':_0x236309[_0x3481('0x26')],'sectionId':_0x236309['id']},{})[_0x3481('0x1f')](function(){return _0x2e7c83;});}else{return _0x2e7c83;}})['catch'](function(_0x80037){logger[_0x3481('0x25')](_0x3481('0x4b'),_0x80037);throw _0x80037;});}return _0x2e7c83;})['then'](respondWithResult(_0x27e106,0xc9))['catch'](handleError(_0x27e106,null));};exports[_0x3481('0x4c')]=function(_0x8a7b71,_0x420045){if(_0x8a7b71['body']['id']){delete _0x8a7b71[_0x3481('0x4d')]['id'];}return db[_0x3481('0x29')][_0x3481('0x4e')]({'where':{'id':_0x8a7b71['params']['id']}})[_0x3481('0x1f')](handleEntityNotFound(_0x420045,null))['then'](saveUpdates(_0x8a7b71[_0x3481('0x4d')],null))[_0x3481('0x1f')](respondWithResult(_0x420045,null))['catch'](handleError(_0x420045,null));};exports['destroy']=function(_0x5a2522,_0x28ebe3){return db[_0x3481('0x29')][_0x3481('0x4e')]({'where':{'id':_0x5a2522[_0x3481('0x4f')]['id']}})[_0x3481('0x1f')](handleEntityNotFound(_0x28ebe3,null))[_0x3481('0x1f')](removeEntity(_0x28ebe3,null))[_0x3481('0x41')](handleError(_0x28ebe3,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 9d59a4d..18977fd 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 _0xe774=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','Disposition','tools_dispositions','name_voice','ListId','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','WhatsappAccountId','lodash'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0xe774,0x1cd));var _0x4e77=function(_0x375044,_0x37b53c){_0x375044=_0x375044-0x0;var _0x1b85c7=_0xe774[_0x375044];return _0x1b85c7;};'use strict';var _=require(_0x4e77('0x0'));var util=require(_0x4e77('0x1'));var logger=require(_0x4e77('0x2'))(_0x4e77('0x3'));var moment=require('moment');var BPromise=require(_0x4e77('0x4'));var rp=require(_0x4e77('0x5'));var fs=require('fs');var path=require(_0x4e77('0x6'));var rimraf=require(_0x4e77('0x7'));var config=require(_0x4e77('0x8'));var attributes=require('./disposition.attributes');module[_0x4e77('0x9')]=function(_0x15240c,_0x21869e){return _0x15240c['define'](_0x4e77('0xa'),attributes,{'tableName':_0x4e77('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x4e77('0xc'),'fields':['name',_0x4e77('0xd')]},{'unique':!![],'name':'name_chat','fields':[_0x4e77('0xe'),_0x4e77('0xf')]},{'unique':!![],'name':_0x4e77('0x10'),'fields':['name',_0x4e77('0x11')]},{'unique':!![],'name':_0x4e77('0x12'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0x4e77('0x13'),'fields':[_0x4e77('0xe'),_0x4e77('0x14')]},{'unique':!![],'name':'name_openchannel','fields':[_0x4e77('0xe'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x4e77('0xe'),_0x4e77('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf15c=['name_chat','name','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./disposition.attributes','exports','ListId'];(function(_0x2fa1c6,_0x4a5b8d){var _0x5f3257=function(_0x195b53){while(--_0x195b53){_0x2fa1c6['push'](_0x2fa1c6['shift']());}};_0x5f3257(++_0x4a5b8d);}(_0xf15c,0xb3));var _0xcf15=function(_0x5b04e0,_0x4d2550){_0x5b04e0=_0x5b04e0-0x0;var _0x4465fd=_0xf15c[_0x5b04e0];return _0x4465fd;};'use strict';var _=require(_0xcf15('0x0'));var util=require('util');var logger=require(_0xcf15('0x1'))('api');var moment=require(_0xcf15('0x2'));var BPromise=require(_0xcf15('0x3'));var rp=require(_0xcf15('0x4'));var fs=require('fs');var path=require(_0xcf15('0x5'));var rimraf=require(_0xcf15('0x6'));var config=require('../../config/environment');var attributes=require(_0xcf15('0x7'));module[_0xcf15('0x8')]=function(_0x9cf5fb,_0x1b05b2){return _0x9cf5fb['define']('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name',_0xcf15('0x9')]},{'unique':!![],'name':_0xcf15('0xa'),'fields':[_0xcf15('0xb'),_0xcf15('0xc')]},{'unique':!![],'name':_0xcf15('0xd'),'fields':['name',_0xcf15('0xe')]},{'unique':!![],'name':'name_sms','fields':[_0xcf15('0xb'),_0xcf15('0xf')]},{'unique':!![],'name':_0xcf15('0x10'),'fields':[_0xcf15('0xb'),_0xcf15('0x11')]},{'unique':!![],'name':_0xcf15('0x12'),'fields':[_0xcf15('0xb'),_0xcf15('0x13')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xcf15('0xb'),_0xcf15('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 04a3343..3a5a72d 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(_0x3821a5,_0x57962d){var _0xfa695b=function(_0x5d1bd4){while(--_0x5d1bd4){_0x3821a5['push'](_0x3821a5['shift']());}};_0xfa695b(++_0x57962d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x16ea66,_0x35060f){var _0x5c11f2=function(_0x515ab2){while(--_0x515ab2){_0x16ea66['push'](_0x16ea66['shift']());}};_0x5c11f2(++_0x35060f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 e417825..1da4439 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 _0x3f53=['isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x2b0f11,_0x4883cd){var _0x6fdaee=function(_0x5abccc){while(--_0x5abccc){_0x2b0f11['push'](_0x2b0f11['shift']());}};_0x6fdaee(++_0x4883cd);}(_0x3f53,0x186));var _0x33f5=function(_0x150228,_0x4ee82c){_0x150228=_0x150228-0x0;var _0x5de9a6=_0x3f53[_0x150228];return _0x5de9a6;};'use strict';var multer=require(_0x33f5('0x0'));var util=require(_0x33f5('0x1'));var path=require('path');var timeout=require(_0x33f5('0x2'));var express=require(_0x33f5('0x3'));var router=express[_0x33f5('0x4')]();var fs_extra=require(_0x33f5('0x5'));var auth=require(_0x33f5('0x6'));var interaction=require(_0x33f5('0x7'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x33f5('0x8')]('/',auth[_0x33f5('0x9')](),controller[_0x33f5('0xa')]);router[_0x33f5('0x8')](_0x33f5('0xb'),auth[_0x33f5('0x9')](),controller[_0x33f5('0xc')]);router[_0x33f5('0xd')]('/',auth[_0x33f5('0x9')](),controller[_0x33f5('0xe')]);router[_0x33f5('0xf')](_0x33f5('0xb'),auth['isAuthenticated'](),controller[_0x33f5('0x10')]);router['delete']('/:id',auth[_0x33f5('0x9')](),controller[_0x33f5('0x11')]);module[_0x33f5('0x12')]=router; \ No newline at end of file +var _0xeb53=['multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','./disposition.controller','get','isAuthenticated','show','post','create','put','update','exports'];(function(_0x31b96b,_0x41ea0f){var _0x5ea8b3=function(_0x43b218){while(--_0x43b218){_0x31b96b['push'](_0x31b96b['shift']());}};_0x5ea8b3(++_0x41ea0f);}(_0xeb53,0x11d));var _0x3eb5=function(_0x2a0aa0,_0x4621ab){_0x2a0aa0=_0x2a0aa0-0x0;var _0x328f6f=_0xeb53[_0x2a0aa0];return _0x328f6f;};'use strict';var multer=require(_0x3eb5('0x0'));var util=require(_0x3eb5('0x1'));var path=require(_0x3eb5('0x2'));var timeout=require(_0x3eb5('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3eb5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3eb5('0x5'));var config=require('../../config/environment');var controller=require(_0x3eb5('0x6'));router[_0x3eb5('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x3eb5('0x8')](),controller[_0x3eb5('0x9')]);router[_0x3eb5('0xa')]('/',auth['isAuthenticated'](),controller[_0x3eb5('0xb')]);router[_0x3eb5('0xc')]('/:id',auth[_0x3eb5('0x8')](),controller[_0x3eb5('0xd')]);router['delete']('/:id',auth[_0x3eb5('0x8')](),controller['destroy']);module[_0x3eb5('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 6a92d49..7344f32 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 _0xe185=['SIP','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','14400','ENUM','12000','INTEGER'];(function(_0x29711a,_0x389c71){var _0x3467ea=function(_0x55dc22){while(--_0x55dc22){_0x29711a['push'](_0x29711a['shift']());}};_0x3467ea(++_0x389c71);}(_0xe185,0xa3));var _0x5e18=function(_0x386744,_0x38db5a){_0x386744=_0x386744-0x0;var _0x2de9f9=_0xe185[_0x386744];return _0x2de9f9;};'use strict';var Sequelize=require('sequelize');module[_0x5e18('0x0')]={'name':{'type':Sequelize[_0x5e18('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0x5e18('0x2'),'no'),'defaultValue':_0x5e18('0x2')},'headerinfo':{'type':Sequelize[_0x5e18('0x1')],'defaultValue':_0x5e18('0x3')},'localstationid':{'type':Sequelize[_0x5e18('0x1')],'unique':_0x5e18('0x4')},'minrate':{'type':Sequelize['ENUM'](_0x5e18('0x5'),_0x5e18('0x6'),_0x5e18('0x7'),_0x5e18('0x8'),'12000',_0x5e18('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x5e18('0xa')](_0x5e18('0x5'),'4800','7200',_0x5e18('0x8'),_0x5e18('0xb'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x5e18('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5e18('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x5e18('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x5e18('0xd'),'IAX',_0x5e18('0xe'),'KHOMP'),'defaultValue':_0x5e18('0xd')},'key':{'type':Sequelize[_0x5e18('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5e18('0xf')],'defaultValue':function(){return _0x5e18('0x10');}},'notificationSound':{'type':Sequelize[_0x5e18('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5e18('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5e18('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5e18('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5e18('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5e18('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5e18('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5e18('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5e18('0x11')],'defaultValue':![],'comment':_0x5e18('0x12'),'set':function(_0x5172e4){if(!_0x5172e4)this[_0x5e18('0x13')](_0x5e18('0x14'),null);this[_0x5e18('0x13')](_0x5e18('0x15'),_0x5172e4);}}}; \ No newline at end of file +var _0x26b4=['v17,v27,v29','INTEGER','SIP','IAX','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','7200','9600','12000','14400','4800'];(function(_0x2a7e52,_0x3765ff){var _0x37c7e2=function(_0x92203a){while(--_0x92203a){_0x2a7e52['push'](_0x2a7e52['shift']());}};_0x37c7e2(++_0x3765ff);}(_0x26b4,0x174));var _0x426b=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x26b4[_0x88cd7b];return _0x56fcc8;};'use strict';var Sequelize=require('sequelize');module[_0x426b('0x0')]={'name':{'type':Sequelize[_0x426b('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x426b('0x1')]},'ecm':{'type':Sequelize[_0x426b('0x2')](_0x426b('0x3'),'no'),'defaultValue':_0x426b('0x3')},'headerinfo':{'type':Sequelize[_0x426b('0x1')],'defaultValue':_0x426b('0x4')},'localstationid':{'type':Sequelize[_0x426b('0x1')],'unique':_0x426b('0x5')},'minrate':{'type':Sequelize[_0x426b('0x2')](_0x426b('0x6'),'4800',_0x426b('0x7'),_0x426b('0x8'),_0x426b('0x9'),_0x426b('0xa')),'defaultValue':_0x426b('0xb')},'maxrate':{'type':Sequelize[_0x426b('0x2')](_0x426b('0x6'),_0x426b('0xb'),_0x426b('0x7'),'9600','12000',_0x426b('0xa')),'defaultValue':_0x426b('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x426b('0xc')},'gateway':{'type':Sequelize[_0x426b('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x426b('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x426b('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x426b('0x2')](_0x426b('0xe'),_0x426b('0xf'),'DADHI',_0x426b('0x10')),'defaultValue':_0x426b('0xe')},'key':{'type':Sequelize[_0x426b('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x426b('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x426b('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x426b('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x426b('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x426b('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x426b('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x426b('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x426b('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x426b('0x12')],'defaultValue':![],'comment':_0x426b('0x14'),'set':function(_0x3d464a){if(!_0x3d464a)this[_0x426b('0x15')](_0x426b('0x16'),null);this[_0x426b('0x15')](_0x426b('0x17'),_0x3d464a);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index cf51564..1912166 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 _0x3b1a=['UserProfileResource','stack','name','send','index','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','mandatoryDispositionPause','keys','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','params','describe','addDisposition','Disposition','findOne','pick','FaxAccountId','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Owner','internal','Tag','color','tag','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','priority','appdata','CDR(type)=inbound-fax','ecm','gateway','faxdetect','maxrate','minrate','push','FAXOPT(','Set','/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','createdAt','updatedAt','ListId','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','isArray','userFaxAccount:remove','User','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','FaxAccounts'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x3b1a,0x82));var _0xa3b1=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0x3b1a[_0x496738];return _0xee1381;};'use strict';var emlformat=require(_0xa3b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa3b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa3b1('0x2'));var moment=require(_0xa3b1('0x3'));var BPromise=require(_0xa3b1('0x4'));var Mustache=require(_0xa3b1('0x5'));var util=require(_0xa3b1('0x6'));var path=require(_0xa3b1('0x7'));var sox=require(_0xa3b1('0x8'));var csv=require(_0xa3b1('0x9'));var ejs=require(_0xa3b1('0xa'));var fs=require('fs');var fs_extra=require(_0xa3b1('0xb'));var _=require(_0xa3b1('0xc'));var squel=require(_0xa3b1('0xd'));var crypto=require(_0xa3b1('0xe'));var jsforce=require(_0xa3b1('0xf'));var deskjs=require(_0xa3b1('0x10'));var toCsv=require(_0xa3b1('0x9'));var querystring=require('querystring');var Papa=require(_0xa3b1('0x11'));var Redis=require(_0xa3b1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa3b1('0x13'));var as=require(_0xa3b1('0x14'));var hardwareService=require(_0xa3b1('0x15'));var logger=require(_0xa3b1('0x16'))(_0xa3b1('0x17'));var utils=require(_0xa3b1('0x18'));var config=require(_0xa3b1('0x19'));var licenseUtil=require(_0xa3b1('0x1a'));var db=require(_0xa3b1('0x1b'))['db'];config[_0xa3b1('0x1c')]=_[_0xa3b1('0x1d')](config[_0xa3b1('0x1c')],{'host':_0xa3b1('0x1e'),'port':0x18eb});var socket=require(_0xa3b1('0x1f'))(new Redis(config[_0xa3b1('0x1c')]));require(_0xa3b1('0x20'))['register'](socket);var jayson=require(_0xa3b1('0x21'));var client=jayson[_0xa3b1('0x22')][_0xa3b1('0x23')]({'port':0x232c});var client9002=jayson[_0xa3b1('0x22')][_0xa3b1('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x5c650a,_0x451a02,_0x1a9029,_0x3c2fe7){return new BPromise(function(_0x18cd55,_0x4e8583){var _0x5831cc=_0x3c2fe7||client;return _0x5831cc[_0xa3b1('0x24')](_0x5c650a,_0x1a9029)[_0xa3b1('0x25')](function(_0x367d00){logger[_0xa3b1('0x26')](_0xa3b1('0x27'),_0x451a02,_0xa3b1('0x28'));logger[_0xa3b1('0x29')](_0xa3b1('0x2a'),_0x451a02,_0xa3b1('0x28'),JSON[_0xa3b1('0x2b')](_0x367d00));if(_0x367d00['error']){if(_0x367d00[_0xa3b1('0x2c')][_0xa3b1('0x2d')]===0x1f4){logger[_0xa3b1('0x2c')]('FaxAccount,\x20%s,\x20%s',_0x451a02,_0x367d00[_0xa3b1('0x2c')][_0xa3b1('0x2e')]);return _0x4e8583(_0x367d00['error'][_0xa3b1('0x2e')]);}logger['error'](_0xa3b1('0x27'),_0x451a02,_0x367d00['error'][_0xa3b1('0x2e')]);return _0x18cd55(_0x367d00['error'][_0xa3b1('0x2e')]);}else{logger[_0xa3b1('0x26')](_0xa3b1('0x27'),_0x451a02,_0xa3b1('0x28'));_0x18cd55(_0x367d00[_0xa3b1('0x2f')][_0xa3b1('0x2e')]);}})[_0xa3b1('0x30')](function(_0x19227c){logger[_0xa3b1('0x2c')]('FaxAccount,\x20%s,\x20%s',_0x451a02,_0x19227c);_0x4e8583(_0x19227c);});});}function respondWithStatusCode(_0xafc28b,_0x3734ce){_0x3734ce=_0x3734ce||0xcc;return function(_0x155706){if(_0x155706){return _0xafc28b['sendStatus'](_0x3734ce);}return _0xafc28b[_0xa3b1('0x31')](_0x3734ce)[_0xa3b1('0x32')]();};}function respondWithResult(_0x2f65c8,_0x525396){_0x525396=_0x525396||0xc8;return function(_0xc7173a){if(_0xc7173a){return _0x2f65c8[_0xa3b1('0x31')](_0x525396)[_0xa3b1('0x33')](_0xc7173a);}};}function respondWithFilteredResult(_0x35e2c4,_0x2f6132){return function(_0x413744){if(_0x413744){var _0x42d33d=typeof _0x2f6132[_0xa3b1('0x34')]===_0xa3b1('0x35')&&typeof _0x2f6132['limit']===_0xa3b1('0x35');var _0xdd7f05=_0x413744['count'];var _0x274ad3=_0x42d33d?0x0:_0x2f6132[_0xa3b1('0x34')];var _0x22ba55=_0x42d33d?_0x413744[_0xa3b1('0x36')]:_0x2f6132['offset']+_0x2f6132[_0xa3b1('0x37')];var _0x4cdd72;if(_0x22ba55>=_0xdd7f05){_0x22ba55=_0xdd7f05;_0x4cdd72=0xc8;}else{_0x4cdd72=0xce;}_0x35e2c4[_0xa3b1('0x31')](_0x4cdd72);return _0x35e2c4[_0xa3b1('0x38')](_0xa3b1('0x39'),_0x274ad3+'-'+_0x22ba55+'/'+_0xdd7f05)[_0xa3b1('0x33')](_0x413744);}return null;};}function patchUpdates(_0x4c41c9){return function(_0x4cd017){try{jsonpatch[_0xa3b1('0x3a')](_0x4cd017,_0x4c41c9,!![]);}catch(_0x52637d){return BPromise['reject'](_0x52637d);}return _0x4cd017[_0xa3b1('0x3b')]();};}function saveUpdates(_0x10671c,_0x1a3710){return function(_0xc573a){if(_0xc573a){return _0xc573a[_0xa3b1('0x3c')](_0x10671c)[_0xa3b1('0x25')](function(_0x59b2e2){return _0x59b2e2;});}return null;};}function removeEntity(_0x450347,_0x137234){return function(_0x3bab9b){if(_0x3bab9b){return _0x3bab9b[_0xa3b1('0x3d')]()[_0xa3b1('0x25')](function(){var _0x256531=_0x3bab9b['get']({'plain':!![]});var _0x49aff1=_0xa3b1('0x3e');return db[_0xa3b1('0x3f')]['destroy']({'where':{'type':_0x49aff1,'resourceId':_0x256531['id']}})[_0xa3b1('0x25')](function(){return _0x3bab9b;});})[_0xa3b1('0x25')](function(){_0x450347['status'](0xcc)[_0xa3b1('0x32')]();});}};}function handleEntityNotFound(_0x2fb943,_0x426101){return function(_0x58a07f){if(!_0x58a07f){_0x2fb943['sendStatus'](0x194);}return _0x58a07f;};}function handleError(_0x26d621,_0x31ae56){_0x31ae56=_0x31ae56||0x1f4;return function(_0x140dc9){logger[_0xa3b1('0x2c')](_0x140dc9[_0xa3b1('0x40')]);if(_0x140dc9[_0xa3b1('0x41')]){delete _0x140dc9['name'];}_0x26d621[_0xa3b1('0x31')](_0x31ae56)[_0xa3b1('0x42')](_0x140dc9);};}exports[_0xa3b1('0x43')]=function(_0x9c06eb,_0x286ff6){var _0xc4a810={'include':[{'model':db[_0xa3b1('0x44')],'as':'mandatoryDispositionPause'}]},_0x141163={},_0x5683fe={'count':0x0,'rows':[]};var _0x2924fa=_[_0xa3b1('0x45')](db[_0xa3b1('0x46')][_0xa3b1('0x47')],function(_0x2697b4){return{'name':_0x2697b4[_0xa3b1('0x48')],'type':_0x2697b4[_0xa3b1('0x49')][_0xa3b1('0x4a')]};});_0x141163['model']=_[_0xa3b1('0x45')](_0x2924fa,_0xa3b1('0x41'));_0x141163[_0xa3b1('0x4b')]=_['keys'](_0x9c06eb['query']);_0x141163['filters']=_[_0xa3b1('0x4c')](_0x141163[_0xa3b1('0x4d')],_0x141163[_0xa3b1('0x4b')]);_0xc4a810[_0xa3b1('0x4e')]=_[_0xa3b1('0x4c')](_0x141163[_0xa3b1('0x4d')],qs[_0xa3b1('0x4f')](_0x9c06eb[_0xa3b1('0x4b')][_0xa3b1('0x4f')]));_0xc4a810[_0xa3b1('0x4e')]=_0xc4a810[_0xa3b1('0x4e')][_0xa3b1('0x50')]?_0xc4a810[_0xa3b1('0x4e')]:_0x141163[_0xa3b1('0x4d')];if(!_0x9c06eb[_0xa3b1('0x4b')][_0xa3b1('0x51')](_0xa3b1('0x52'))){_0xc4a810['limit']=qs['limit'](_0x9c06eb[_0xa3b1('0x4b')][_0xa3b1('0x37')]);_0xc4a810['offset']=qs[_0xa3b1('0x34')](_0x9c06eb[_0xa3b1('0x4b')][_0xa3b1('0x34')]);}_0xc4a810[_0xa3b1('0x53')]=qs[_0xa3b1('0x54')](_0x9c06eb[_0xa3b1('0x4b')][_0xa3b1('0x54')]);_0xc4a810[_0xa3b1('0x55')]=qs[_0xa3b1('0x56')](_['pick'](_0x9c06eb[_0xa3b1('0x4b')],_0x141163[_0xa3b1('0x56')]),_0x2924fa);if(_0x9c06eb[_0xa3b1('0x4b')]['filter']){_0xc4a810[_0xa3b1('0x55')]=_[_0xa3b1('0x57')](_0xc4a810[_0xa3b1('0x55')],{'$or':_[_0xa3b1('0x45')](_0x2924fa,function(_0x31ba4e){if(_0x31ba4e[_0xa3b1('0x49')]!=='VIRTUAL'){var _0x14ccb7={};_0x14ccb7[_0x31ba4e[_0xa3b1('0x41')]]={'$like':'%'+_0x9c06eb['query'][_0xa3b1('0x58')]+'%'};return _0x14ccb7;}})});}_0xc4a810=_['merge']({},_0xc4a810,_0x9c06eb[_0xa3b1('0x59')]);var _0x16dd4c={'where':_0xc4a810[_0xa3b1('0x55')]};return db['FaxAccount']['count'](_0x16dd4c)[_0xa3b1('0x25')](function(_0x20028e){_0x5683fe['count']=_0x20028e;if(_0x9c06eb[_0xa3b1('0x4b')]['includeAll']){_0xc4a810['include']=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0xc4a810);})[_0xa3b1('0x25')](function(_0x2371d6){_0x5683fe['rows']=_0x2371d6;return _0x5683fe;})[_0xa3b1('0x25')](respondWithFilteredResult(_0x286ff6,_0xc4a810))['catch'](handleError(_0x286ff6,null));};exports['show']=function(_0x5c69a5,_0x464509){var _0x4a19a6={'raw':![],'where':{'id':_0x5c69a5['params']['id']},'include':[{'model':db[_0xa3b1('0x44')],'as':_0xa3b1('0x5a')}]},_0x200663={};_0x200663[_0xa3b1('0x4d')]=_[_0xa3b1('0x5b')](db['FaxAccount'][_0xa3b1('0x47')]);_0x200663[_0xa3b1('0x4b')]=_['keys'](_0x5c69a5[_0xa3b1('0x4b')]);_0x200663[_0xa3b1('0x56')]=_[_0xa3b1('0x4c')](_0x200663[_0xa3b1('0x4d')],_0x200663['query']);_0x4a19a6[_0xa3b1('0x4e')]=_['intersection'](_0x200663[_0xa3b1('0x4d')],qs[_0xa3b1('0x4f')](_0x5c69a5[_0xa3b1('0x4b')][_0xa3b1('0x4f')]));_0x4a19a6[_0xa3b1('0x4e')]=_0x4a19a6['attributes'][_0xa3b1('0x50')]?_0x4a19a6[_0xa3b1('0x4e')]:_0x200663[_0xa3b1('0x4d')];if(_0x5c69a5[_0xa3b1('0x4b')][_0xa3b1('0x5c')]){_0x4a19a6[_0xa3b1('0x5d')]=[{'all':!![]}];}_0x4a19a6=_['merge']({},_0x4a19a6,_0x5c69a5[_0xa3b1('0x59')]);return db[_0xa3b1('0x46')][_0xa3b1('0x5e')](_0x4a19a6)[_0xa3b1('0x25')](handleEntityNotFound(_0x464509,null))[_0xa3b1('0x25')](respondWithResult(_0x464509,null))[_0xa3b1('0x30')](handleError(_0x464509,null));};exports[_0xa3b1('0x5f')]=function(_0x40c0fd,_0x11c003){return db[_0xa3b1('0x46')]['create'](_0x40c0fd[_0xa3b1('0x60')],{})[_0xa3b1('0x25')](function(_0x40f243){var _0x7d53ad=_0x40c0fd[_0xa3b1('0x61')][_0xa3b1('0x62')]({'plain':!![]});if(!_0x7d53ad)throw new Error(_0xa3b1('0x63'));if(_0x7d53ad[_0xa3b1('0x64')]===_0xa3b1('0x61')){var _0x51132a=_0x40f243['get']({'plain':!![]});var _0x1a1073=_0xa3b1('0x3e');return db['UserProfileSection'][_0xa3b1('0x5e')]({'where':{'name':_0x1a1073,'userProfileId':_0x7d53ad[_0xa3b1('0x65')]},'raw':!![]})[_0xa3b1('0x25')](function(_0x128520){if(_0x128520&&_0x128520['autoAssociation']===0x0){return db['UserProfileResource'][_0xa3b1('0x5f')]({'name':_0x51132a[_0xa3b1('0x41')],'resourceId':_0x51132a['id'],'type':_0x128520[_0xa3b1('0x41')],'sectionId':_0x128520['id']},{})['then'](function(){return _0x40f243;});}else{return _0x40f243;}})[_0xa3b1('0x30')](function(_0x32f705){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32f705);throw _0x32f705;});}return _0x40f243;})[_0xa3b1('0x25')](respondWithResult(_0x11c003,0xc9))[_0xa3b1('0x30')](handleError(_0x11c003,null));};exports[_0xa3b1('0x3c')]=function(_0x5d38d0,_0x4608ab){if(_0x5d38d0[_0xa3b1('0x60')]['id']){delete _0x5d38d0[_0xa3b1('0x60')]['id'];}return db[_0xa3b1('0x46')][_0xa3b1('0x5e')]({'where':{'id':_0x5d38d0[_0xa3b1('0x66')]['id']},'include':[{'model':db[_0xa3b1('0x44')],'as':_0xa3b1('0x5a')}]})[_0xa3b1('0x25')](handleEntityNotFound(_0x4608ab,null))['then'](saveUpdates(_0x5d38d0[_0xa3b1('0x60')],null))[_0xa3b1('0x25')](respondWithResult(_0x4608ab,null))['catch'](handleError(_0x4608ab,null));};exports[_0xa3b1('0x3d')]=function(_0x1536ff,_0x560deb){return db['FaxAccount']['find']({'where':{'id':_0x1536ff[_0xa3b1('0x66')]['id']}})[_0xa3b1('0x25')](handleEntityNotFound(_0x560deb,null))[_0xa3b1('0x25')](removeEntity(_0x560deb,null))['catch'](handleError(_0x560deb,null));};exports['describe']=function(_0x4218c4,_0x10aecf){return db[_0xa3b1('0x46')][_0xa3b1('0x67')]()[_0xa3b1('0x25')](respondWithResult(_0x10aecf,null))['catch'](handleError(_0x10aecf,null));};exports[_0xa3b1('0x68')]=function(_0x27bc9a,_0x131c93,_0x42621){if(_0x27bc9a[_0xa3b1('0x60')]['id']){delete _0x27bc9a[_0xa3b1('0x60')]['id'];}return db[_0xa3b1('0x46')][_0xa3b1('0x5e')]({'where':{'id':_0x27bc9a[_0xa3b1('0x66')]['id']}})[_0xa3b1('0x25')](handleEntityNotFound(_0x131c93,null))[_0xa3b1('0x25')](function(_0x3e36aa){if(_0x3e36aa){_0x27bc9a[_0xa3b1('0x60')]['FaxAccountId']=_0x3e36aa['id'];return db[_0xa3b1('0x69')][_0xa3b1('0x5f')](_0x27bc9a['body']);}})[_0xa3b1('0x25')](respondWithResult(_0x131c93,null))[_0xa3b1('0x30')](handleError(_0x131c93,null));};exports['getDispositions']=function(_0x26e1e8,_0x1eb20a,_0xd2a85c){var _0x37e5c3={'raw':![],'where':{}};var _0x650e3e={};var _0x25d18d={'count':0x0,'rows':[]};return db['FaxAccount'][_0xa3b1('0x6a')]({'where':{'id':_0x26e1e8[_0xa3b1('0x66')]['id']}})['then'](handleEntityNotFound(_0x1eb20a,null))[_0xa3b1('0x25')](function(_0x50b445){if(_0x50b445){_0x650e3e[_0xa3b1('0x4d')]=_[_0xa3b1('0x5b')](db[_0xa3b1('0x69')]['rawAttributes']);_0x650e3e['query']=_['keys'](_0x26e1e8['query']);_0x650e3e[_0xa3b1('0x56')]=_[_0xa3b1('0x4c')](_0x650e3e[_0xa3b1('0x4d')],_0x650e3e['query']);_0x37e5c3[_0xa3b1('0x4e')]=_[_0xa3b1('0x4c')](_0x650e3e[_0xa3b1('0x4d')],qs['fields'](_0x26e1e8[_0xa3b1('0x4b')]['fields']));_0x37e5c3['attributes']=_0x37e5c3[_0xa3b1('0x4e')]['length']?_0x37e5c3[_0xa3b1('0x4e')]:_0x650e3e['model'];if(!_0x26e1e8['query'][_0xa3b1('0x51')]('nolimit')){_0x37e5c3[_0xa3b1('0x37')]=qs[_0xa3b1('0x37')](_0x26e1e8[_0xa3b1('0x4b')][_0xa3b1('0x37')]);_0x37e5c3['offset']=qs[_0xa3b1('0x34')](_0x26e1e8[_0xa3b1('0x4b')][_0xa3b1('0x34')]);}_0x37e5c3[_0xa3b1('0x53')]=qs['sort'](_0x26e1e8['query'][_0xa3b1('0x54')]);_0x37e5c3[_0xa3b1('0x55')]=qs[_0xa3b1('0x56')](_[_0xa3b1('0x6b')](_0x26e1e8[_0xa3b1('0x4b')],_0x650e3e['filters']));_0x37e5c3[_0xa3b1('0x55')][_0xa3b1('0x6c')]=_0x50b445['id'];if(_0x26e1e8[_0xa3b1('0x4b')][_0xa3b1('0x58')]){_0x37e5c3[_0xa3b1('0x55')]=_[_0xa3b1('0x57')](_0x37e5c3[_0xa3b1('0x55')],{'$or':_[_0xa3b1('0x45')](_0x37e5c3['attributes'],function(_0x3be70f){var _0x4615fc={};_0x4615fc[_0x3be70f]={'$like':'%'+_0x26e1e8[_0xa3b1('0x4b')]['filter']+'%'};return _0x4615fc;})});}_0x37e5c3=_[_0xa3b1('0x57')]({},_0x37e5c3,_0x26e1e8['options']);return db[_0xa3b1('0x69')]['count']({'where':_0x37e5c3[_0xa3b1('0x55')]})['then'](function(_0x546ca7){_0x25d18d[_0xa3b1('0x36')]=_0x546ca7;if(_0x26e1e8[_0xa3b1('0x4b')][_0xa3b1('0x5c')]){_0x37e5c3[_0xa3b1('0x5d')]=[{'all':!![]}];}return db['Disposition'][_0xa3b1('0x6d')](_0x37e5c3);})['then'](function(_0x16c8f9){_0x25d18d['rows']=_0x16c8f9;return _0x25d18d;});}})[_0xa3b1('0x25')](respondWithFilteredResult(_0x1eb20a,_0x37e5c3))[_0xa3b1('0x30')](handleError(_0x1eb20a,null));};exports[_0xa3b1('0x6e')]=function(_0x5c39b5,_0x52ea82,_0x1e7eec){return db['FaxAccount'][_0xa3b1('0x5e')]({'where':{'id':_0x5c39b5[_0xa3b1('0x66')]['id']}})[_0xa3b1('0x25')](handleEntityNotFound(_0x52ea82,null))[_0xa3b1('0x25')](function(_0x3929b6){if(_0x3929b6){return _0x3929b6[_0xa3b1('0x6e')](_0x5c39b5[_0xa3b1('0x4b')]['ids']);}})[_0xa3b1('0x25')](respondWithStatusCode(_0x52ea82,null))[_0xa3b1('0x30')](handleError(_0x52ea82,null));};exports[_0xa3b1('0x6f')]=function(_0x143124,_0x4e4195,_0x2b659b){if(_0x143124[_0xa3b1('0x60')]['id']){delete _0x143124[_0xa3b1('0x60')]['id'];}return db[_0xa3b1('0x46')]['find']({'where':{'id':_0x143124[_0xa3b1('0x66')]['id']}})[_0xa3b1('0x25')](handleEntityNotFound(_0x4e4195,null))['then'](function(_0x2a11f5){if(_0x2a11f5){_0x143124[_0xa3b1('0x60')][_0xa3b1('0x6c')]=_0x2a11f5['id'];return db[_0xa3b1('0x70')][_0xa3b1('0x5f')](_0x143124['body']);}})['then'](respondWithResult(_0x4e4195,null))[_0xa3b1('0x30')](handleError(_0x4e4195,null));};exports[_0xa3b1('0x71')]=function(_0x9eb745,_0x544179,_0x2d027e){var _0x40417f={'raw':![],'where':{}};var _0x28254a={};var _0x4e07c7={'count':0x0,'rows':[]};return db[_0xa3b1('0x46')][_0xa3b1('0x6a')]({'where':{'id':_0x9eb745[_0xa3b1('0x66')]['id']}})[_0xa3b1('0x25')](handleEntityNotFound(_0x544179,null))['then'](function(_0x286cfa){if(_0x286cfa){_0x28254a['model']=_[_0xa3b1('0x5b')](db[_0xa3b1('0x70')]['rawAttributes']);_0x28254a[_0xa3b1('0x4b')]=_[_0xa3b1('0x5b')](_0x9eb745[_0xa3b1('0x4b')]);_0x28254a[_0xa3b1('0x56')]=_['intersection'](_0x28254a[_0xa3b1('0x4d')],_0x28254a[_0xa3b1('0x4b')]);_0x40417f[_0xa3b1('0x4e')]=_['intersection'](_0x28254a[_0xa3b1('0x4d')],qs[_0xa3b1('0x4f')](_0x9eb745[_0xa3b1('0x4b')][_0xa3b1('0x4f')]));_0x40417f[_0xa3b1('0x4e')]=_0x40417f[_0xa3b1('0x4e')][_0xa3b1('0x50')]?_0x40417f['attributes']:_0x28254a[_0xa3b1('0x4d')];if(!_0x9eb745[_0xa3b1('0x4b')][_0xa3b1('0x51')](_0xa3b1('0x52'))){_0x40417f[_0xa3b1('0x37')]=qs[_0xa3b1('0x37')](_0x9eb745['query'][_0xa3b1('0x37')]);_0x40417f[_0xa3b1('0x34')]=qs[_0xa3b1('0x34')](_0x9eb745['query'][_0xa3b1('0x34')]);}_0x40417f[_0xa3b1('0x53')]=qs[_0xa3b1('0x54')](_0x9eb745[_0xa3b1('0x4b')][_0xa3b1('0x54')]);_0x40417f[_0xa3b1('0x55')]=qs[_0xa3b1('0x56')](_[_0xa3b1('0x6b')](_0x9eb745[_0xa3b1('0x4b')],_0x28254a[_0xa3b1('0x56')]));_0x40417f[_0xa3b1('0x55')]['FaxAccountId']=_0x286cfa['id'];if(_0x9eb745[_0xa3b1('0x4b')][_0xa3b1('0x58')]){_0x40417f[_0xa3b1('0x55')]=_[_0xa3b1('0x57')](_0x40417f[_0xa3b1('0x55')],{'$or':_[_0xa3b1('0x45')](_0x40417f[_0xa3b1('0x4e')],function(_0x50d961){var _0x4648ee={};_0x4648ee[_0x50d961]={'$like':'%'+_0x9eb745['query'][_0xa3b1('0x58')]+'%'};return _0x4648ee;})});}_0x40417f=_[_0xa3b1('0x57')]({},_0x40417f,_0x9eb745[_0xa3b1('0x59')]);return db[_0xa3b1('0x70')][_0xa3b1('0x36')]({'where':_0x40417f[_0xa3b1('0x55')]})[_0xa3b1('0x25')](function(_0x1f8873){_0x4e07c7[_0xa3b1('0x36')]=_0x1f8873;if(_0x9eb745[_0xa3b1('0x4b')]['includeAll']){_0x40417f['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xa3b1('0x6d')](_0x40417f);})[_0xa3b1('0x25')](function(_0xdd28f9){_0x4e07c7[_0xa3b1('0x72')]=_0xdd28f9;return _0x4e07c7;});}})[_0xa3b1('0x25')](respondWithFilteredResult(_0x544179,_0x40417f))['catch'](handleError(_0x544179,null));};exports[_0xa3b1('0x73')]=function(_0x216342,_0xcaf17a,_0x1a2e01){return db[_0xa3b1('0x46')][_0xa3b1('0x5e')]({'where':{'id':_0x216342[_0xa3b1('0x66')]['id']}})['then'](handleEntityNotFound(_0xcaf17a,null))['then'](function(_0x13d65a){if(_0x13d65a){return _0x13d65a['removeAnswers'](_0x216342['query'][_0xa3b1('0x74')]);}})[_0xa3b1('0x25')](respondWithStatusCode(_0xcaf17a,null))['catch'](handleError(_0xcaf17a,null));};exports[_0xa3b1('0x75')]=function(_0x8b6bb1,_0x312744,_0x215fe6){return db[_0xa3b1('0x76')]['find']({'where':{'id':_0x8b6bb1[_0xa3b1('0x66')]['id']}})[_0xa3b1('0x25')](handleEntityNotFound(_0x312744,null))[_0xa3b1('0x25')](function(_0x2bd71a){if(_0x2bd71a){return _0x2bd71a[_0xa3b1('0x75')](_0x8b6bb1[_0xa3b1('0x60')][_0xa3b1('0x74')],_[_0xa3b1('0x77')](_0x8b6bb1[_0xa3b1('0x60')],[_0xa3b1('0x74'),'id'])||{});}})['then'](respondWithResult(_0x312744,null))[_0xa3b1('0x30')](handleError(_0x312744,null));};exports[_0xa3b1('0x78')]=function(_0x3a3084,_0x3583de,_0x30bbad){var _0x231d3e={'raw':![],'where':{}};var _0x5dd1d9={};var _0x4c99b8={'count':0x0,'rows':[]};return db[_0xa3b1('0x46')][_0xa3b1('0x6a')]({'where':{'id':_0x3a3084['params']['id']}})[_0xa3b1('0x25')](handleEntityNotFound(_0x3583de,null))[_0xa3b1('0x25')](function(_0x1c4cef){if(_0x1c4cef){_0x5dd1d9[_0xa3b1('0x4d')]=_[_0xa3b1('0x5b')](db[_0xa3b1('0x76')][_0xa3b1('0x47')]);_0x5dd1d9[_0xa3b1('0x4b')]=_[_0xa3b1('0x5b')](_0x3a3084[_0xa3b1('0x4b')]);_0x5dd1d9['filters']=_[_0xa3b1('0x4c')](_0x5dd1d9[_0xa3b1('0x4d')],_0x5dd1d9[_0xa3b1('0x4b')]);_0x231d3e[_0xa3b1('0x4e')]=_[_0xa3b1('0x4c')](_0x5dd1d9[_0xa3b1('0x4d')],qs[_0xa3b1('0x4f')](_0x3a3084[_0xa3b1('0x4b')]['fields']));_0x231d3e['attributes']=_0x231d3e['attributes'][_0xa3b1('0x50')]?_0x231d3e[_0xa3b1('0x4e')]:_0x5dd1d9['model'];if(!_0x3a3084[_0xa3b1('0x4b')][_0xa3b1('0x51')](_0xa3b1('0x52'))){_0x231d3e[_0xa3b1('0x37')]=qs[_0xa3b1('0x37')](_0x3a3084[_0xa3b1('0x4b')]['limit']);_0x231d3e[_0xa3b1('0x34')]=qs[_0xa3b1('0x34')](_0x3a3084['query']['offset']);}_0x231d3e['order']=qs[_0xa3b1('0x54')](_0x3a3084[_0xa3b1('0x4b')][_0xa3b1('0x54')]);_0x231d3e[_0xa3b1('0x55')]=qs['filters'](_['pick'](_0x3a3084[_0xa3b1('0x4b')],_0x5dd1d9[_0xa3b1('0x56')]));_0x231d3e[_0xa3b1('0x55')][_0xa3b1('0x6c')]=_0x1c4cef['id'];if(_0x3a3084[_0xa3b1('0x4b')]['filter']){_0x231d3e['where']=_[_0xa3b1('0x57')](_0x231d3e[_0xa3b1('0x55')],{'$or':_[_0xa3b1('0x45')](_0x231d3e[_0xa3b1('0x4e')],function(_0x29f839){var _0x2cb525={};_0x2cb525[_0x29f839]={'$like':'%'+_0x3a3084['query'][_0xa3b1('0x58')]+'%'};return _0x2cb525;})});}_0x231d3e=_[_0xa3b1('0x57')]({},_0x231d3e,_0x3a3084[_0xa3b1('0x59')]);return db[_0xa3b1('0x76')]['count']({'where':_0x231d3e[_0xa3b1('0x55')]})[_0xa3b1('0x25')](function(_0x33de45){_0x4c99b8[_0xa3b1('0x36')]=_0x33de45;if(_0x3a3084[_0xa3b1('0x4b')][_0xa3b1('0x5c')]){_0x231d3e[_0xa3b1('0x5d')]=[{'model':db[_0xa3b1('0x79')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xa3b1('0x7a'),'attributes':['name','fullname',_0xa3b1('0x7b')],'required':![]},{'model':db[_0xa3b1('0x7c')],'as':'Tags','attributes':['id',_0xa3b1('0x41'),_0xa3b1('0x7d')],'where':_0x3a3084['query']['tag']?{'id':_0x3a3084[_0xa3b1('0x4b')][_0xa3b1('0x7e')]}:undefined,'required':_0x3a3084[_0xa3b1('0x4b')]['tag']?!![]:![]}];}return db[_0xa3b1('0x76')][_0xa3b1('0x6d')](_0x231d3e);})[_0xa3b1('0x25')](function(_0x24651b){_0x4c99b8['rows']=_0x24651b;return _0x4c99b8;});}})[_0xa3b1('0x25')](respondWithFilteredResult(_0x3583de,_0x231d3e))['catch'](handleError(_0x3583de,null));};exports['addApplications']=function(_0x218f1d,_0x4fc31b,_0x5f489b){return db[_0xa3b1('0x46')]['findOne']({'where':{'id':_0x218f1d[_0xa3b1('0x66')]['id']}})[_0xa3b1('0x25')](handleEntityNotFound(_0x4fc31b,null))[_0xa3b1('0x25')](function(_0x203cce){if(_0x203cce){return db[_0xa3b1('0x7f')][_0xa3b1('0x80')](function(_0x1ba4a0){return db['FaxApplication'][_0xa3b1('0x3d')]({'where':{'FaxAccountId':_0x218f1d[_0xa3b1('0x66')]['id']},'transaction':_0x1ba4a0})[_0xa3b1('0x25')](function(_0xe507fe){var _0x4f7f82=_[_0xa3b1('0x45')](_0x218f1d[_0xa3b1('0x60')],function(_0xa828c6){_0xa828c6[_0xa3b1('0x6c')]=_0x218f1d[_0xa3b1('0x66')]['id'];return _0xa828c6;});return db[_0xa3b1('0x81')][_0xa3b1('0x82')](_0x4f7f82,{'transaction':_0x1ba4a0});});})[_0xa3b1('0x25')](function(){return db[_0xa3b1('0x81')][_0xa3b1('0x83')]({'where':{'FaxAccountId':_0x218f1d[_0xa3b1('0x66')]['id']},'order':'priority'});});}})[_0xa3b1('0x25')](respondWithResult(_0x4fc31b,null))[_0xa3b1('0x30')](handleError(_0x4fc31b,null));};exports[_0xa3b1('0x84')]=function(_0x6bb7b1,_0x375e10,_0xee95e0){var _0x2471da={};var _0x533af3={};var _0x4f693a;var _0x256c3a;return db['FaxAccount'][_0xa3b1('0x6a')]({'where':{'id':_0x6bb7b1[_0xa3b1('0x66')]['id']}})[_0xa3b1('0x25')](handleEntityNotFound(_0x375e10,null))[_0xa3b1('0x25')](function(_0x47df13){if(_0x47df13){_0x4f693a=_0x47df13;_0x533af3[_0xa3b1('0x4d')]=_['keys'](db[_0xa3b1('0x81')][_0xa3b1('0x47')]);_0x533af3[_0xa3b1('0x4b')]=_[_0xa3b1('0x5b')](_0x6bb7b1['query']);_0x533af3[_0xa3b1('0x56')]=_[_0xa3b1('0x4c')](_0x533af3[_0xa3b1('0x4d')],_0x533af3[_0xa3b1('0x4b')]);_0x2471da['attributes']=_[_0xa3b1('0x4c')](_0x533af3[_0xa3b1('0x4d')],qs[_0xa3b1('0x4f')](_0x6bb7b1['query'][_0xa3b1('0x4f')]));_0x2471da['attributes']=_0x2471da['attributes'][_0xa3b1('0x50')]?_0x2471da['attributes']:_0x533af3[_0xa3b1('0x4d')];_0x2471da['order']=qs[_0xa3b1('0x54')](_0x6bb7b1[_0xa3b1('0x4b')][_0xa3b1('0x54')]);_0x2471da[_0xa3b1('0x55')]=qs['filters'](_[_0xa3b1('0x6b')](_0x6bb7b1[_0xa3b1('0x4b')],_0x533af3[_0xa3b1('0x56')]));if(_0x6bb7b1[_0xa3b1('0x4b')][_0xa3b1('0x58')]){_0x2471da[_0xa3b1('0x55')]=_[_0xa3b1('0x57')](_0x2471da['where'],{'$or':_[_0xa3b1('0x45')](_0x2471da[_0xa3b1('0x4e')],function(_0x6bc27c){var _0x8d056f={};_0x8d056f[_0x6bc27c]={'$like':'%'+_0x6bb7b1[_0xa3b1('0x4b')][_0xa3b1('0x58')]+'%'};return _0x8d056f;})});}_0x2471da=_[_0xa3b1('0x57')]({},_0x2471da,_0x6bb7b1[_0xa3b1('0x59')]);return _0x4f693a[_0xa3b1('0x84')](_0x2471da);}})['then'](function(_0x3c4a3d){if(_0x3c4a3d){_0x256c3a=_0x3c4a3d[_0xa3b1('0x50')];if(!_0x6bb7b1[_0xa3b1('0x4b')]['hasOwnProperty']('nolimit')){_0x2471da['limit']=qs['limit'](_0x6bb7b1['query']['limit']);_0x2471da[_0xa3b1('0x34')]=qs['offset'](_0x6bb7b1[_0xa3b1('0x4b')][_0xa3b1('0x34')]);}return _0x4f693a[_0xa3b1('0x84')](_0x2471da);}})[_0xa3b1('0x25')](function(_0x190bc8){if(_0x190bc8){return _0x190bc8?{'count':_0x256c3a,'rows':_0x190bc8}:null;}})[_0xa3b1('0x25')](respondWithResult(_0x375e10,null))[_0xa3b1('0x30')](handleError(_0x375e10,null));};function Extension(_0x5b496c,_0x5063ed,_0xb892e6,_0x3246be){this[_0xa3b1('0x85')]=_0xa3b1('0x86');this[_0xa3b1('0x87')]=_0x5b496c[_0xa3b1('0x88')];this['app']=_0x3246be;this[_0xa3b1('0x49')]=_0xa3b1('0x89');this[_0xa3b1('0x8a')]=_0xa3b1('0x8b');this[_0xa3b1('0x6c')]=_0x5b496c['id'];this[_0xa3b1('0x8c')]=_0x5063ed;this[_0xa3b1('0x8d')]=_0xb892e6;}function createExtensionsReciveFax(_0x344675){var _0x25e84c=0x1;var _0x27ef2a=[];_0x27ef2a['push'](new Extension(_0x344675,_0x25e84c,'','Answer'));_0x25e84c+=0x1;_0x27ef2a['push'](new Extension(_0x344675,_0x25e84c,_0xa3b1('0x8e'),'Set'));_0x25e84c+=0x1;for(var _0x4880d7 in _0x344675){if(_0x344675[_0xa3b1('0x51')](_0x4880d7)&&(_0x4880d7===_0xa3b1('0x8f')||_0x4880d7==='localstationid'||_0x4880d7===_0xa3b1('0x90')||_0x4880d7===_0xa3b1('0x91')||_0x4880d7==='headerinfo'||_0x4880d7===_0xa3b1('0x92')||_0x4880d7===_0xa3b1('0x93')||_0x4880d7==='modem'||_0x4880d7==='t38timeout')){_0x27ef2a[_0xa3b1('0x94')](new Extension(_0x344675,_0x25e84c,_0xa3b1('0x95')+_0x4880d7+')='+_0x344675[_0x4880d7],_0xa3b1('0x96')));_0x25e84c+=0x1;}}_0x27ef2a['push'](new Extension(_0x344675,_0x25e84c,'6','Wait'));_0x25e84c+=0x1;_0x27ef2a['push'](new Extension(_0x344675,_0x25e84c,_0xa3b1('0x97'),_0xa3b1('0x98')));_0x25e84c=0x0;return _0x27ef2a;}exports[_0xa3b1('0x99')]=function(_0xb5b6e5,_0x11b0c6,_0x285ded){var _0x3b9709;return db[_0xa3b1('0x7f')]['transaction'](function(_0x5317b2){return db['FaxAccount'][_0xa3b1('0x5f')](_0xb5b6e5['body'],{'transaction':_0x5317b2})[_0xa3b1('0x25')](function(_0x1795d9){_0x3b9709=_0x1795d9[_0xa3b1('0x62')]({'plain':!![]});return db[_0xa3b1('0x9a')][_0xa3b1('0x82')](createExtensionsReciveFax(_0x3b9709),{'transaction':_0x5317b2});});})['then'](function(){return _0x3b9709;})[_0xa3b1('0x25')](respondWithResult(_0x11b0c6,null))[_0xa3b1('0x30')](handleError(_0x11b0c6,null));};exports[_0xa3b1('0x9b')]=function(_0x1e8120,_0x33c946,_0x3412ff){var _0x24b2ad;return db['sequelize'][_0xa3b1('0x80')](function(_0x4d4b3a){return db['FaxAccount'][_0xa3b1('0x3c')](_0x1e8120[_0xa3b1('0x60')],{'where':{'id':_0x1e8120['body']['id']},'transaction':_0x4d4b3a})[_0xa3b1('0x25')](function(_0x4e57f9){return db[_0xa3b1('0x9a')][_0xa3b1('0x3d')]({'where':{'FaxAccountId':_0x1e8120[_0xa3b1('0x60')]['id']},'transaction':_0x4d4b3a})[_0xa3b1('0x25')](function(_0x2fddea){return db[_0xa3b1('0x9a')]['bulkCreate'](createExtensionsReciveFax(_[_0xa3b1('0x77')](_0x1e8120[_0xa3b1('0x60')],[_0xa3b1('0x9c'),_0xa3b1('0x4a'),_0xa3b1('0x9d'),_0xa3b1('0x9e'),'TrunkId',_0xa3b1('0x9f')])),{'transaction':_0x4d4b3a});});});})[_0xa3b1('0x25')](function(){return db[_0xa3b1('0x46')]['findById'](_0x1e8120[_0xa3b1('0x60')]['id']);})[_0xa3b1('0x25')](respondWithResult(_0x33c946,null))[_0xa3b1('0x30')](handleError(_0x33c946,null));};exports['getMessages']=function(_0x4d355c,_0x2300f0,_0x2c0039){var _0x5aa47d={'raw':!![],'where':{}};var _0x308c3a={};var _0x3f8c03={'count':0x0,'rows':[]};return db[_0xa3b1('0x46')]['findOne']({'where':{'id':_0x4d355c[_0xa3b1('0x66')]['id']}})[_0xa3b1('0x25')](handleEntityNotFound(_0x2300f0,null))[_0xa3b1('0x25')](function(_0xfe5ea5){if(_0xfe5ea5){_0x308c3a[_0xa3b1('0x4d')]=_['keys'](db[_0xa3b1('0xa0')][_0xa3b1('0x47')]);_0x308c3a[_0xa3b1('0x4b')]=_[_0xa3b1('0x5b')](_0x4d355c[_0xa3b1('0x4b')]);_0x308c3a[_0xa3b1('0x56')]=_[_0xa3b1('0x4c')](_0x308c3a[_0xa3b1('0x4d')],_0x308c3a['query']);_0x5aa47d[_0xa3b1('0x4e')]=_[_0xa3b1('0x4c')](_0x308c3a[_0xa3b1('0x4d')],qs[_0xa3b1('0x4f')](_0x4d355c[_0xa3b1('0x4b')][_0xa3b1('0x4f')]));_0x5aa47d[_0xa3b1('0x4e')]=_0x5aa47d[_0xa3b1('0x4e')]['length']?_0x5aa47d[_0xa3b1('0x4e')]:_0x308c3a[_0xa3b1('0x4d')];if(!_0x4d355c[_0xa3b1('0x4b')][_0xa3b1('0x51')](_0xa3b1('0x52'))){_0x5aa47d[_0xa3b1('0x37')]=qs['limit'](_0x4d355c['query'][_0xa3b1('0x37')]);_0x5aa47d[_0xa3b1('0x34')]=qs['offset'](_0x4d355c[_0xa3b1('0x4b')][_0xa3b1('0x34')]);}_0x5aa47d[_0xa3b1('0x53')]=qs[_0xa3b1('0x54')](_0x4d355c[_0xa3b1('0x4b')][_0xa3b1('0x54')]);_0x5aa47d[_0xa3b1('0x55')]=qs[_0xa3b1('0x56')](_[_0xa3b1('0x6b')](_0x4d355c[_0xa3b1('0x4b')],_0x308c3a[_0xa3b1('0x56')]));_0x5aa47d[_0xa3b1('0x55')][_0xa3b1('0x6c')]=_0xfe5ea5['id'];if(_0x4d355c[_0xa3b1('0x4b')][_0xa3b1('0x58')]){_0x5aa47d[_0xa3b1('0x55')]=_['merge'](_0x5aa47d[_0xa3b1('0x55')],{'$or':_['map'](_0x5aa47d[_0xa3b1('0x4e')],function(_0x2da2aa){var _0x13b7bb={};_0x13b7bb[_0x2da2aa]={'$like':'%'+_0x4d355c[_0xa3b1('0x4b')][_0xa3b1('0x58')]+'%'};return _0x13b7bb;})});}if(_0x4d355c['query'][_0xa3b1('0xa1')]){var _0x3fd984=_0x4d355c[_0xa3b1('0x4b')][_0xa3b1('0xa1')][_0xa3b1('0xa2')](',');var _0x167abc={};_0x167abc[_0x3fd984[0x0]]={'$gte':moment(_0x3fd984[0x1])[_0xa3b1('0xa3')](_0xa3b1('0xa4'))};_0x5aa47d[_0xa3b1('0x55')]=_['merge'](_0x5aa47d[_0xa3b1('0x55')],_0x167abc);}_0x5aa47d=_['merge']({},_0x5aa47d,_0x4d355c[_0xa3b1('0x59')]);return db[_0xa3b1('0xa0')][_0xa3b1('0x36')]({'where':_0x5aa47d[_0xa3b1('0x55')]})['then'](function(_0x52e95c){_0x3f8c03[_0xa3b1('0x36')]=_0x52e95c;if(_0x4d355c['query'][_0xa3b1('0x5c')]){_0x5aa47d[_0xa3b1('0x5d')]=[{'all':!![]}];}return db[_0xa3b1('0xa0')][_0xa3b1('0x6d')](_0x5aa47d);})[_0xa3b1('0x25')](function(_0xaa54de){_0x3f8c03[_0xa3b1('0x72')]=_0xaa54de;return _0x3f8c03;});}})[_0xa3b1('0x25')](respondWithFilteredResult(_0x2300f0,_0x5aa47d))[_0xa3b1('0x30')](handleError(_0x2300f0,null));};exports[_0xa3b1('0x42')]=function(_0x2f0295,_0x143812,_0x12844a){var _0x1b92bb,_0x38c89c={},_0x3f012d;if(_0x2f0295[_0xa3b1('0x60')]['to']){_0x3f012d=_0x2f0295[_0xa3b1('0x60')]['to'][0x0];}return db[_0xa3b1('0x46')][_0xa3b1('0x5e')]({'where':{'id':_0x2f0295['params']['id']},'include':[{'model':db['CmList'],'as':_0xa3b1('0xa5'),'include':[{'model':db[_0xa3b1('0x79')],'as':_0xa3b1('0xa6'),'where':{'fax':_0x3f012d},'limit':0x1,'order':[[_0xa3b1('0x9e'),_0xa3b1('0xa7')]]}]}]})[_0xa3b1('0x25')](handleEntityNotFound(_0x143812,null))[_0xa3b1('0x25')](function(_0xc61dba){_0x1b92bb=_0xc61dba;if(_0x2f0295[_0xa3b1('0x60')][_0xa3b1('0xa8')]&&_0x2f0295[_0xa3b1('0x60')][_0xa3b1('0xa8')]['length']){for(var _0xec15f1=0x0;_0xec15f1<_0x2f0295['body'][_0xa3b1('0xa8')][_0xa3b1('0x50')];_0xec15f1+=0x1){_0x2f0295[_0xa3b1('0x60')][_0xa3b1('0xa8')][_0xec15f1]={'filename':_0x2f0295[_0xa3b1('0x60')][_0xa3b1('0xa8')][_0xec15f1][_0xa3b1('0x41')],'id':_0x2f0295[_0xa3b1('0x60')][_0xa3b1('0xa8')][_0xec15f1]['id'],'path':path[_0xa3b1('0xa9')](config[_0xa3b1('0xaa')],_0xa3b1('0xab'),_0x2f0295[_0xa3b1('0x60')][_0xa3b1('0xa8')][_0xec15f1][_0xa3b1('0xac')])};}}return respondWithRpcPromise(_0xa3b1('0xad'),_0xa3b1('0xad'),{'FaxAccountId':_[_0xa3b1('0xae')](_0x2f0295['params']['id'])?undefined:_0x2f0295[_0xa3b1('0x66')]['id'],'path':_[_0xa3b1('0xae')](_0x2f0295[_0xa3b1('0x60')]['attachments'][0x0][_0xa3b1('0x7')])?undefined:_0x2f0295[_0xa3b1('0x60')][_0xa3b1('0xa8')][0x0][_0xa3b1('0x7')],'fax':_[_0xa3b1('0xae')](_0x2f0295['body']['to'][0x0])?undefined:_0x2f0295[_0xa3b1('0x60')]['to'][0x0]},client9002);})['then'](function(){if(_0x1b92bb){if(_[_0xa3b1('0xae')](_0x2f0295[_0xa3b1('0x60')][_0xa3b1('0xaf')])){_0x2f0295[_0xa3b1('0x60')][_0xa3b1('0xaf')]=util[_0xa3b1('0xa3')](_0xa3b1('0xb0'),_0x1b92bb[_0xa3b1('0x41')],_0x1b92bb[_0xa3b1('0xb1')]);}if(_0x1b92bb['List']){if(_0x1b92bb[_0xa3b1('0xa5')][_0xa3b1('0xa6')][_0xa3b1('0x50')]){return _0x1b92bb[_0xa3b1('0xa5')][_0xa3b1('0xa6')][0x0];}else{return db[_0xa3b1('0x79')][_0xa3b1('0x5f')](_[_0xa3b1('0x1d')](_0x2f0295[_0xa3b1('0x60')],{'firstName':_0x2f0295[_0xa3b1('0x60')]['to'][0x0],'phone':_0x2f0295[_0xa3b1('0x60')]['to'][0x0],'fax':_0x2f0295[_0xa3b1('0x60')]['to'][0x0],'ListId':_0x1b92bb['ListId']}));}}else{throw new Error(_0xa3b1('0xb2'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xa3b1('0x25')](function(_0x20f48c){if(_0x20f48c){return db[_0xa3b1('0x76')][_0xa3b1('0x5e')]({'where':{'ContactId':_0x20f48c['id'],'closed':![],'FaxAccountId':_0x1b92bb['id']}})[_0xa3b1('0x25')](function(_0x160b61){if(_0x160b61){return[_0x160b61,![]];}return db[_0xa3b1('0x76')][_0xa3b1('0x5f')]({'UserId':_0x2f0295[_0xa3b1('0x61')]['id'],'ContactId':_0x20f48c['id'],'FaxAccountId':_0x1b92bb['id'],'fax':_0x2f0295[_0xa3b1('0x60')]['to'][0x0],'firstMsgDirection':_0xa3b1('0xb3'),'Messages':[_['merge'](_0x2f0295['body'],{'read':![],'body':_0x2f0295['body']['attachments'][0x0][_0xa3b1('0xb4')],'FaxAccountId':_0x1b92bb['id'],'UserId':_0x2f0295[_0xa3b1('0x61')]['id'],'ContactId':_0x20f48c['id'],'AttachmentId':_0x2f0295[_0xa3b1('0x60')][_0xa3b1('0xa8')][0x0]['id']})]},{'include':[{'model':db[_0xa3b1('0xa0')],'as':_0xa3b1('0xb5')}]})[_0xa3b1('0x25')](function(_0x214a92){return[_0x214a92,!![]];});});}else{throw new Error(_0xa3b1('0xb6'));}})['spread'](function(_0x276892,_0x2d3c07){if(_0x2d3c07){return _0x276892;}return db[_0xa3b1('0xa0')]['create']({'direction':'out','read':![],'body':_0x2f0295[_0xa3b1('0x60')]['attachments'][0x0]['filename'],'FaxAccountId':_0x1b92bb['id'],'FaxInteractionId':_0x276892['id'],'UserId':_0x2f0295[_0xa3b1('0x61')]['id'],'ContactId':_0x276892['ContactId'],'AttachmentId':_0x2f0295[_0xa3b1('0x60')][_0xa3b1('0xa8')][0x0]['id']})[_0xa3b1('0x25')](function(_0x273ef2){_0x276892[_0xa3b1('0xb7')][_0xa3b1('0xb5')]=[];_0x276892[_0xa3b1('0xb7')]['Messages'][_0xa3b1('0x94')](_0x273ef2[_0xa3b1('0xb7')]);return _0x276892;});})[_0xa3b1('0x25')](function(_0x1317ec){respondWithRpcPromise(_0xa3b1('0xb8'),'SendFax',{'FaxAccountId':_[_0xa3b1('0xae')](_0x2f0295[_0xa3b1('0x66')]['id'])?undefined:_0x2f0295['params']['id'],'path':_[_0xa3b1('0xae')](_0x2f0295[_0xa3b1('0x60')][_0xa3b1('0xa8')][0x0]['path'])?undefined:_0x2f0295[_0xa3b1('0x60')][_0xa3b1('0xa8')][0x0][_0xa3b1('0x7')],'fax':_[_0xa3b1('0xae')](_0x2f0295[_0xa3b1('0x60')]['to'][0x0])?undefined:_0x2f0295[_0xa3b1('0x60')]['to'][0x0],'AttachmentId':_0x2f0295['body'][_0xa3b1('0xa8')][0x0]['id']},client9002)[_0xa3b1('0x25')](function(_0x36e8b7){logger[_0xa3b1('0x26')](_0xa3b1('0xb9'),_0x36e8b7);})[_0xa3b1('0x30')](function(_0x56f70c){logger[_0xa3b1('0x26')](_0xa3b1('0xb9'),_0x56f70c);});return _0x1317ec;})['then'](respondWithResult(_0x143812,null))[_0xa3b1('0x30')](handleError(_0x143812,null));};exports['addAgents']=function(_0x72faca,_0xaf6abe,_0xc20cc8){return db['FaxAccount'][_0xa3b1('0x5e')]({'where':{'id':_0x72faca[_0xa3b1('0x66')]['id']}})[_0xa3b1('0x25')](handleEntityNotFound(_0xaf6abe,null))['then'](function(_0x3a91f4){if(_0x3a91f4){return _0x3a91f4[_0xa3b1('0xba')](_0x72faca['body'][_0xa3b1('0x74')],_[_0xa3b1('0x77')](_0x72faca[_0xa3b1('0x60')],[_0xa3b1('0x74'),'id'])||{})[_0xa3b1('0xbb')](function(_0x307936){for(var _0x37478e=0x0;_0x37478e<_0x72faca['body'][_0xa3b1('0x74')][_0xa3b1('0x50')];_0x37478e+=0x1){socket[_0xa3b1('0xbc')]('userFaxAccount:save',{'UserId':Number(_0x72faca[_0xa3b1('0x60')][_0xa3b1('0x74')][_0x37478e]),'FaxAccountId':Number(_0x72faca['params']['id'])});}return _0x307936;});}})[_0xa3b1('0x25')](respondWithResult(_0xaf6abe,null))[_0xa3b1('0x30')](handleError(_0xaf6abe,null));};exports['removeAgents']=function(_0x30e151,_0x1b6849,_0x4510ae){return db[_0xa3b1('0x46')]['find']({'where':{'id':_0x30e151[_0xa3b1('0x66')]['id']}})[_0xa3b1('0x25')](handleEntityNotFound(_0x1b6849,null))[_0xa3b1('0x25')](function(_0x420ea8){if(_0x420ea8){return _0x420ea8['removeAgents'](_0x30e151[_0xa3b1('0x4b')]['ids'])[_0xa3b1('0x25')](function(){if(_[_0xa3b1('0xbd')](_0x30e151[_0xa3b1('0x4b')][_0xa3b1('0x74')])){for(var _0x85d93b=0x0;_0x85d93b<_0x30e151['query']['ids']['length'];_0x85d93b+=0x1){socket[_0xa3b1('0xbc')](_0xa3b1('0xbe'),{'UserId':Number(_0x30e151[_0xa3b1('0x4b')][_0xa3b1('0x74')][_0x85d93b]),'FaxAccountId':Number(_0x30e151[_0xa3b1('0x66')]['id'])});}}else{socket[_0xa3b1('0xbc')](_0xa3b1('0xbe'),{'UserId':Number(_0x30e151[_0xa3b1('0x4b')]['ids']),'FaxAccountId':Number(_0x30e151['params']['id'])});}});}})[_0xa3b1('0x25')](respondWithStatusCode(_0x1b6849,null))['catch'](handleError(_0x1b6849,null));};exports['getAgents']=function(_0x4fe95d,_0x145dba,_0x4dbdaf){var _0x5026e0={};var _0x3a554f={};var _0x93a405;var _0x41decd;return db[_0xa3b1('0x46')][_0xa3b1('0x6a')]({'where':{'id':_0x4fe95d['params']['id']}})[_0xa3b1('0x25')](handleEntityNotFound(_0x145dba,null))[_0xa3b1('0x25')](function(_0x55c208){if(_0x55c208){_0x93a405=_0x55c208;_0x3a554f[_0xa3b1('0x4d')]=_[_0xa3b1('0x5b')](db[_0xa3b1('0xbf')][_0xa3b1('0x47')]);_0x3a554f[_0xa3b1('0x4b')]=_[_0xa3b1('0x5b')](_0x4fe95d['query']);_0x3a554f['filters']=_[_0xa3b1('0x4c')](_0x3a554f[_0xa3b1('0x4d')],_0x3a554f[_0xa3b1('0x4b')]);_0x5026e0['attributes']=_['intersection'](_0x3a554f[_0xa3b1('0x4d')],qs['fields'](_0x4fe95d[_0xa3b1('0x4b')][_0xa3b1('0x4f')]));_0x5026e0['attributes']=_0x5026e0[_0xa3b1('0x4e')][_0xa3b1('0x50')]?_0x5026e0['attributes']:_0x3a554f[_0xa3b1('0x4d')];_0x5026e0[_0xa3b1('0x53')]=qs['sort'](_0x4fe95d[_0xa3b1('0x4b')][_0xa3b1('0x54')]);_0x5026e0[_0xa3b1('0x55')]=qs[_0xa3b1('0x56')](_['pick'](_0x4fe95d['query'],_0x3a554f[_0xa3b1('0x56')]));if(_0x4fe95d[_0xa3b1('0x4b')][_0xa3b1('0x58')]){_0x5026e0['where']=_['merge'](_0x5026e0[_0xa3b1('0x55')],{'$or':_[_0xa3b1('0x45')](_0x5026e0[_0xa3b1('0x4e')],function(_0x49b9b2){var _0x411304={};_0x411304[_0x49b9b2]={'$like':'%'+_0x4fe95d[_0xa3b1('0x4b')][_0xa3b1('0x58')]+'%'};return _0x411304;})});}_0x5026e0=_[_0xa3b1('0x57')]({},_0x5026e0,_0x4fe95d[_0xa3b1('0x59')]);return _0x93a405[_0xa3b1('0xc0')](_0x5026e0);}})[_0xa3b1('0x25')](function(_0xd3160f){if(_0xd3160f){_0x41decd=_0xd3160f[_0xa3b1('0x50')];if(!_0x4fe95d[_0xa3b1('0x4b')][_0xa3b1('0x51')]('nolimit')){_0x5026e0['limit']=qs[_0xa3b1('0x37')](_0x4fe95d[_0xa3b1('0x4b')][_0xa3b1('0x37')]);_0x5026e0[_0xa3b1('0x34')]=qs[_0xa3b1('0x34')](_0x4fe95d[_0xa3b1('0x4b')][_0xa3b1('0x34')]);}return _0x93a405[_0xa3b1('0xc0')](_0x5026e0);}})[_0xa3b1('0x25')](function(_0x29e1f9){if(_0x29e1f9){return _0x29e1f9?{'count':_0x41decd,'rows':_0x29e1f9}:null;}})['then'](respondWithResult(_0x145dba,null))[_0xa3b1('0x30')](handleError(_0x145dba,null));}; \ No newline at end of file +var _0x5924=['filter','merge','where','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','order','findAll','removeDispositions','ids','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','exten','localstationid','app','system','Fax\x20Extension','appdata','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','push','ReceiveFax','updateAccountApplications','VoiceExtension','tech','key','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','emit','getAgents','User','eml-format','fast-json-patch','bluebird','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','register','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','destroy','get','FaxAccounts','stack','name','send','index','Pause','map','FaxAccount','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick'];(function(_0x3c7297,_0x5bbb7c){var _0x723d1d=function(_0x41a81e){while(--_0x41a81e){_0x3c7297['push'](_0x3c7297['shift']());}};_0x723d1d(++_0x5bbb7c);}(_0x5924,0x12e));var _0x4592=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0x5924[_0x445101];return _0x3c3d04;};'use strict';var emlformat=require(_0x4592('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4592('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4592('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4592('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4592('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4592('0x5'));var squel=require(_0x4592('0x6'));var crypto=require(_0x4592('0x7'));var jsforce=require(_0x4592('0x8'));var deskjs=require(_0x4592('0x9'));var toCsv=require(_0x4592('0xa'));var querystring=require(_0x4592('0xb'));var Papa=require(_0x4592('0xc'));var Redis=require(_0x4592('0xd'));var authService=require(_0x4592('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4592('0xf'));var logger=require(_0x4592('0x10'))(_0x4592('0x11'));var utils=require('../../config/utils');var config=require(_0x4592('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x4592('0x13'))['db'];config[_0x4592('0x14')]=_[_0x4592('0x15')](config[_0x4592('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x4592('0x16'))(new Redis(config[_0x4592('0x14')]));require(_0x4592('0x17'))[_0x4592('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4592('0x19')][_0x4592('0x1a')]({'port':0x232c});var client9002=jayson[_0x4592('0x19')][_0x4592('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x43ba12,_0x4b1f8a,_0x38858b,_0x49e8f7){return new BPromise(function(_0x922887,_0x1ea594){var _0x3476e6=_0x49e8f7||client;return _0x3476e6['request'](_0x43ba12,_0x38858b)[_0x4592('0x1b')](function(_0x11fd35){logger[_0x4592('0x1c')](_0x4592('0x1d'),_0x4b1f8a,_0x4592('0x1e'));logger[_0x4592('0x1f')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4b1f8a,_0x4592('0x1e'),JSON[_0x4592('0x20')](_0x11fd35));if(_0x11fd35['error']){if(_0x11fd35['error'][_0x4592('0x21')]===0x1f4){logger[_0x4592('0x22')](_0x4592('0x1d'),_0x4b1f8a,_0x11fd35[_0x4592('0x22')][_0x4592('0x23')]);return _0x1ea594(_0x11fd35[_0x4592('0x22')]['message']);}logger[_0x4592('0x22')](_0x4592('0x1d'),_0x4b1f8a,_0x11fd35[_0x4592('0x22')][_0x4592('0x23')]);return _0x922887(_0x11fd35[_0x4592('0x22')][_0x4592('0x23')]);}else{logger[_0x4592('0x1c')]('FaxAccount,\x20%s,\x20%s',_0x4b1f8a,_0x4592('0x1e'));_0x922887(_0x11fd35[_0x4592('0x24')]['message']);}})['catch'](function(_0x270219){logger[_0x4592('0x22')](_0x4592('0x1d'),_0x4b1f8a,_0x270219);_0x1ea594(_0x270219);});});}function respondWithStatusCode(_0x54a4d8,_0x13e17f){_0x13e17f=_0x13e17f||0xcc;return function(_0x25a46c){if(_0x25a46c){return _0x54a4d8[_0x4592('0x25')](_0x13e17f);}return _0x54a4d8[_0x4592('0x26')](_0x13e17f)[_0x4592('0x27')]();};}function respondWithResult(_0x30348b,_0x47e700){_0x47e700=_0x47e700||0xc8;return function(_0x5bcaa0){if(_0x5bcaa0){return _0x30348b['status'](_0x47e700)[_0x4592('0x28')](_0x5bcaa0);}};}function respondWithFilteredResult(_0x14a5d2,_0x44d819){return function(_0x1cac12){if(_0x1cac12){var _0xd3309d=typeof _0x44d819[_0x4592('0x29')]==='undefined'&&typeof _0x44d819[_0x4592('0x2a')]==='undefined';var _0x3ed05e=_0x1cac12['count'];var _0xc55dbe=_0xd3309d?0x0:_0x44d819[_0x4592('0x29')];var _0xeae8c4=_0xd3309d?_0x1cac12[_0x4592('0x2b')]:_0x44d819['offset']+_0x44d819['limit'];var _0x1630b7;if(_0xeae8c4>=_0x3ed05e){_0xeae8c4=_0x3ed05e;_0x1630b7=0xc8;}else{_0x1630b7=0xce;}_0x14a5d2[_0x4592('0x26')](_0x1630b7);return _0x14a5d2['set'](_0x4592('0x2c'),_0xc55dbe+'-'+_0xeae8c4+'/'+_0x3ed05e)['json'](_0x1cac12);}return null;};}function patchUpdates(_0x1ade0){return function(_0x206402){try{jsonpatch['apply'](_0x206402,_0x1ade0,!![]);}catch(_0x5eb613){return BPromise[_0x4592('0x2d')](_0x5eb613);}return _0x206402[_0x4592('0x2e')]();};}function saveUpdates(_0x2dfa19,_0x34c1bd){return function(_0x463719){if(_0x463719){return _0x463719[_0x4592('0x2f')](_0x2dfa19)[_0x4592('0x1b')](function(_0xbc561c){return _0xbc561c;});}return null;};}function removeEntity(_0x2ac0c0,_0x3a0b3d){return function(_0xc78dc8){if(_0xc78dc8){return _0xc78dc8[_0x4592('0x30')]()[_0x4592('0x1b')](function(){var _0x230a9c=_0xc78dc8[_0x4592('0x31')]({'plain':!![]});var _0x456741=_0x4592('0x32');return db['UserProfileResource'][_0x4592('0x30')]({'where':{'type':_0x456741,'resourceId':_0x230a9c['id']}})[_0x4592('0x1b')](function(){return _0xc78dc8;});})['then'](function(){_0x2ac0c0[_0x4592('0x26')](0xcc)[_0x4592('0x27')]();});}};}function handleEntityNotFound(_0x3169e6,_0x51be1e){return function(_0x1a8e0e){if(!_0x1a8e0e){_0x3169e6[_0x4592('0x25')](0x194);}return _0x1a8e0e;};}function handleError(_0x4c9614,_0x5f06c7){_0x5f06c7=_0x5f06c7||0x1f4;return function(_0xc9cd63){logger[_0x4592('0x22')](_0xc9cd63[_0x4592('0x33')]);if(_0xc9cd63[_0x4592('0x34')]){delete _0xc9cd63[_0x4592('0x34')];}_0x4c9614[_0x4592('0x26')](_0x5f06c7)[_0x4592('0x35')](_0xc9cd63);};}exports[_0x4592('0x36')]=function(_0x1e8410,_0x367a64){var _0x12a9b2={'include':[{'model':db[_0x4592('0x37')],'as':'mandatoryDispositionPause'}]},_0x53a790={},_0x1b8811={'count':0x0,'rows':[]};var _0x1e04fb=_[_0x4592('0x38')](db[_0x4592('0x39')]['rawAttributes'],function(_0x2796eb){return{'name':_0x2796eb[_0x4592('0x3a')],'type':_0x2796eb['type']['key']};});_0x53a790[_0x4592('0x3b')]=_['map'](_0x1e04fb,'name');_0x53a790[_0x4592('0x3c')]=_[_0x4592('0x3d')](_0x1e8410[_0x4592('0x3c')]);_0x53a790[_0x4592('0x3e')]=_[_0x4592('0x3f')](_0x53a790[_0x4592('0x3b')],_0x53a790[_0x4592('0x3c')]);_0x12a9b2[_0x4592('0x40')]=_[_0x4592('0x3f')](_0x53a790['model'],qs[_0x4592('0x41')](_0x1e8410['query']['fields']));_0x12a9b2['attributes']=_0x12a9b2[_0x4592('0x40')][_0x4592('0x42')]?_0x12a9b2[_0x4592('0x40')]:_0x53a790['model'];if(!_0x1e8410[_0x4592('0x3c')]['hasOwnProperty'](_0x4592('0x43'))){_0x12a9b2[_0x4592('0x2a')]=qs[_0x4592('0x2a')](_0x1e8410[_0x4592('0x3c')][_0x4592('0x2a')]);_0x12a9b2[_0x4592('0x29')]=qs[_0x4592('0x29')](_0x1e8410[_0x4592('0x3c')][_0x4592('0x29')]);}_0x12a9b2['order']=qs[_0x4592('0x44')](_0x1e8410[_0x4592('0x3c')][_0x4592('0x44')]);_0x12a9b2['where']=qs[_0x4592('0x3e')](_[_0x4592('0x45')](_0x1e8410[_0x4592('0x3c')],_0x53a790[_0x4592('0x3e')]),_0x1e04fb);if(_0x1e8410[_0x4592('0x3c')][_0x4592('0x46')]){_0x12a9b2['where']=_[_0x4592('0x47')](_0x12a9b2[_0x4592('0x48')],{'$or':_[_0x4592('0x38')](_0x1e04fb,function(_0x15faf9){if(_0x15faf9[_0x4592('0x49')]!==_0x4592('0x4a')){var _0x61438={};_0x61438[_0x15faf9[_0x4592('0x34')]]={'$like':'%'+_0x1e8410['query']['filter']+'%'};return _0x61438;}})});}_0x12a9b2=_[_0x4592('0x47')]({},_0x12a9b2,_0x1e8410[_0x4592('0x4b')]);var _0x4bcaa0={'where':_0x12a9b2[_0x4592('0x48')]};return db['FaxAccount'][_0x4592('0x2b')](_0x4bcaa0)[_0x4592('0x1b')](function(_0x4a4735){_0x1b8811['count']=_0x4a4735;if(_0x1e8410[_0x4592('0x3c')][_0x4592('0x4c')]){_0x12a9b2[_0x4592('0x4d')]=[{'all':!![]}];}return db[_0x4592('0x39')]['findAll'](_0x12a9b2);})[_0x4592('0x1b')](function(_0x1edd12){_0x1b8811[_0x4592('0x4e')]=_0x1edd12;return _0x1b8811;})[_0x4592('0x1b')](respondWithFilteredResult(_0x367a64,_0x12a9b2))[_0x4592('0x4f')](handleError(_0x367a64,null));};exports[_0x4592('0x50')]=function(_0x1923d0,_0x10351d){var _0x326625={'raw':![],'where':{'id':_0x1923d0[_0x4592('0x51')]['id']},'include':[{'model':db[_0x4592('0x37')],'as':_0x4592('0x52')}]},_0x158452={};_0x158452[_0x4592('0x3b')]=_[_0x4592('0x3d')](db[_0x4592('0x39')][_0x4592('0x53')]);_0x158452['query']=_[_0x4592('0x3d')](_0x1923d0['query']);_0x158452[_0x4592('0x3e')]=_[_0x4592('0x3f')](_0x158452[_0x4592('0x3b')],_0x158452[_0x4592('0x3c')]);_0x326625['attributes']=_['intersection'](_0x158452[_0x4592('0x3b')],qs['fields'](_0x1923d0[_0x4592('0x3c')][_0x4592('0x41')]));_0x326625[_0x4592('0x40')]=_0x326625[_0x4592('0x40')][_0x4592('0x42')]?_0x326625[_0x4592('0x40')]:_0x158452[_0x4592('0x3b')];if(_0x1923d0[_0x4592('0x3c')][_0x4592('0x4c')]){_0x326625[_0x4592('0x4d')]=[{'all':!![]}];}_0x326625=_[_0x4592('0x47')]({},_0x326625,_0x1923d0[_0x4592('0x4b')]);return db['FaxAccount'][_0x4592('0x54')](_0x326625)[_0x4592('0x1b')](handleEntityNotFound(_0x10351d,null))['then'](respondWithResult(_0x10351d,null))['catch'](handleError(_0x10351d,null));};exports['create']=function(_0x24c426,_0xc113ab){return db[_0x4592('0x39')]['create'](_0x24c426['body'],{})[_0x4592('0x1b')](function(_0x4e3bac){var _0x2422b1=_0x24c426[_0x4592('0x55')]['get']({'plain':!![]});if(!_0x2422b1)throw new Error(_0x4592('0x56'));if(_0x2422b1[_0x4592('0x57')]===_0x4592('0x55')){var _0x1b86ce=_0x4e3bac['get']({'plain':!![]});var _0x3ae21c=_0x4592('0x32');return db[_0x4592('0x58')][_0x4592('0x54')]({'where':{'name':_0x3ae21c,'userProfileId':_0x2422b1['userProfileId']},'raw':!![]})[_0x4592('0x1b')](function(_0x3bd577){if(_0x3bd577&&_0x3bd577[_0x4592('0x59')]===0x0){return db['UserProfileResource']['create']({'name':_0x1b86ce[_0x4592('0x34')],'resourceId':_0x1b86ce['id'],'type':_0x3bd577[_0x4592('0x34')],'sectionId':_0x3bd577['id']},{})[_0x4592('0x1b')](function(){return _0x4e3bac;});}else{return _0x4e3bac;}})['catch'](function(_0x2119d6){logger[_0x4592('0x22')](_0x4592('0x5a'),_0x2119d6);throw _0x2119d6;});}return _0x4e3bac;})[_0x4592('0x1b')](respondWithResult(_0xc113ab,0xc9))[_0x4592('0x4f')](handleError(_0xc113ab,null));};exports[_0x4592('0x2f')]=function(_0x44f433,_0x3fd8cc){if(_0x44f433['body']['id']){delete _0x44f433[_0x4592('0x5b')]['id'];}return db[_0x4592('0x39')][_0x4592('0x54')]({'where':{'id':_0x44f433[_0x4592('0x51')]['id']},'include':[{'model':db['Pause'],'as':_0x4592('0x52')}]})[_0x4592('0x1b')](handleEntityNotFound(_0x3fd8cc,null))[_0x4592('0x1b')](saveUpdates(_0x44f433['body'],null))[_0x4592('0x1b')](respondWithResult(_0x3fd8cc,null))[_0x4592('0x4f')](handleError(_0x3fd8cc,null));};exports[_0x4592('0x30')]=function(_0x3f0991,_0x382659){return db[_0x4592('0x39')][_0x4592('0x54')]({'where':{'id':_0x3f0991[_0x4592('0x51')]['id']}})[_0x4592('0x1b')](handleEntityNotFound(_0x382659,null))[_0x4592('0x1b')](removeEntity(_0x382659,null))[_0x4592('0x4f')](handleError(_0x382659,null));};exports[_0x4592('0x5c')]=function(_0x279818,_0x1abda9){return db[_0x4592('0x39')][_0x4592('0x5c')]()['then'](respondWithResult(_0x1abda9,null))['catch'](handleError(_0x1abda9,null));};exports[_0x4592('0x5d')]=function(_0x28dde1,_0x3bb84c,_0x2c2071){if(_0x28dde1[_0x4592('0x5b')]['id']){delete _0x28dde1[_0x4592('0x5b')]['id'];}return db[_0x4592('0x39')][_0x4592('0x54')]({'where':{'id':_0x28dde1['params']['id']}})[_0x4592('0x1b')](handleEntityNotFound(_0x3bb84c,null))['then'](function(_0x16924f){if(_0x16924f){_0x28dde1[_0x4592('0x5b')][_0x4592('0x5e')]=_0x16924f['id'];return db[_0x4592('0x5f')][_0x4592('0x60')](_0x28dde1[_0x4592('0x5b')]);}})[_0x4592('0x1b')](respondWithResult(_0x3bb84c,null))['catch'](handleError(_0x3bb84c,null));};exports[_0x4592('0x61')]=function(_0x1b702e,_0x6d8511,_0x5714d8){var _0x5461b7={'raw':![],'where':{}};var _0x2e0ebc={};var _0x330914={'count':0x0,'rows':[]};return db[_0x4592('0x39')][_0x4592('0x62')]({'where':{'id':_0x1b702e[_0x4592('0x51')]['id']}})[_0x4592('0x1b')](handleEntityNotFound(_0x6d8511,null))[_0x4592('0x1b')](function(_0x98ca45){if(_0x98ca45){_0x2e0ebc['model']=_[_0x4592('0x3d')](db[_0x4592('0x5f')]['rawAttributes']);_0x2e0ebc[_0x4592('0x3c')]=_['keys'](_0x1b702e[_0x4592('0x3c')]);_0x2e0ebc[_0x4592('0x3e')]=_['intersection'](_0x2e0ebc['model'],_0x2e0ebc[_0x4592('0x3c')]);_0x5461b7[_0x4592('0x40')]=_[_0x4592('0x3f')](_0x2e0ebc['model'],qs[_0x4592('0x41')](_0x1b702e[_0x4592('0x3c')][_0x4592('0x41')]));_0x5461b7['attributes']=_0x5461b7['attributes'][_0x4592('0x42')]?_0x5461b7[_0x4592('0x40')]:_0x2e0ebc['model'];if(!_0x1b702e[_0x4592('0x3c')][_0x4592('0x63')]('nolimit')){_0x5461b7[_0x4592('0x2a')]=qs[_0x4592('0x2a')](_0x1b702e[_0x4592('0x3c')][_0x4592('0x2a')]);_0x5461b7[_0x4592('0x29')]=qs[_0x4592('0x29')](_0x1b702e[_0x4592('0x3c')][_0x4592('0x29')]);}_0x5461b7[_0x4592('0x64')]=qs[_0x4592('0x44')](_0x1b702e[_0x4592('0x3c')][_0x4592('0x44')]);_0x5461b7['where']=qs[_0x4592('0x3e')](_['pick'](_0x1b702e[_0x4592('0x3c')],_0x2e0ebc[_0x4592('0x3e')]));_0x5461b7[_0x4592('0x48')][_0x4592('0x5e')]=_0x98ca45['id'];if(_0x1b702e[_0x4592('0x3c')]['filter']){_0x5461b7['where']=_[_0x4592('0x47')](_0x5461b7[_0x4592('0x48')],{'$or':_[_0x4592('0x38')](_0x5461b7[_0x4592('0x40')],function(_0x3932cc){var _0x50ccd5={};_0x50ccd5[_0x3932cc]={'$like':'%'+_0x1b702e[_0x4592('0x3c')][_0x4592('0x46')]+'%'};return _0x50ccd5;})});}_0x5461b7=_[_0x4592('0x47')]({},_0x5461b7,_0x1b702e['options']);return db[_0x4592('0x5f')][_0x4592('0x2b')]({'where':_0x5461b7['where']})[_0x4592('0x1b')](function(_0x2afa83){_0x330914[_0x4592('0x2b')]=_0x2afa83;if(_0x1b702e[_0x4592('0x3c')][_0x4592('0x4c')]){_0x5461b7[_0x4592('0x4d')]=[{'all':!![]}];}return db[_0x4592('0x5f')][_0x4592('0x65')](_0x5461b7);})[_0x4592('0x1b')](function(_0x4793ae){_0x330914[_0x4592('0x4e')]=_0x4793ae;return _0x330914;});}})[_0x4592('0x1b')](respondWithFilteredResult(_0x6d8511,_0x5461b7))[_0x4592('0x4f')](handleError(_0x6d8511,null));};exports[_0x4592('0x66')]=function(_0x51339c,_0x4c4dba,_0x5854b4){return db['FaxAccount'][_0x4592('0x54')]({'where':{'id':_0x51339c[_0x4592('0x51')]['id']}})[_0x4592('0x1b')](handleEntityNotFound(_0x4c4dba,null))['then'](function(_0x1470cc){if(_0x1470cc){return _0x1470cc[_0x4592('0x66')](_0x51339c[_0x4592('0x3c')][_0x4592('0x67')]);}})[_0x4592('0x1b')](respondWithStatusCode(_0x4c4dba,null))[_0x4592('0x4f')](handleError(_0x4c4dba,null));};exports['addAnswer']=function(_0x23759d,_0x5c8983,_0x544cb2){if(_0x23759d['body']['id']){delete _0x23759d[_0x4592('0x5b')]['id'];}return db[_0x4592('0x39')][_0x4592('0x54')]({'where':{'id':_0x23759d[_0x4592('0x51')]['id']}})[_0x4592('0x1b')](handleEntityNotFound(_0x5c8983,null))[_0x4592('0x1b')](function(_0x1e74a5){if(_0x1e74a5){_0x23759d['body'][_0x4592('0x5e')]=_0x1e74a5['id'];return db[_0x4592('0x68')]['create'](_0x23759d[_0x4592('0x5b')]);}})[_0x4592('0x1b')](respondWithResult(_0x5c8983,null))['catch'](handleError(_0x5c8983,null));};exports['getAnswers']=function(_0x1467cd,_0xc2d987,_0x137c2a){var _0x2096b7={'raw':![],'where':{}};var _0x2d6707={};var _0x25a19e={'count':0x0,'rows':[]};return db[_0x4592('0x39')]['findOne']({'where':{'id':_0x1467cd['params']['id']}})['then'](handleEntityNotFound(_0xc2d987,null))[_0x4592('0x1b')](function(_0x28f636){if(_0x28f636){_0x2d6707[_0x4592('0x3b')]=_[_0x4592('0x3d')](db[_0x4592('0x68')][_0x4592('0x53')]);_0x2d6707[_0x4592('0x3c')]=_[_0x4592('0x3d')](_0x1467cd[_0x4592('0x3c')]);_0x2d6707[_0x4592('0x3e')]=_[_0x4592('0x3f')](_0x2d6707[_0x4592('0x3b')],_0x2d6707[_0x4592('0x3c')]);_0x2096b7[_0x4592('0x40')]=_[_0x4592('0x3f')](_0x2d6707[_0x4592('0x3b')],qs['fields'](_0x1467cd[_0x4592('0x3c')][_0x4592('0x41')]));_0x2096b7[_0x4592('0x40')]=_0x2096b7['attributes'][_0x4592('0x42')]?_0x2096b7[_0x4592('0x40')]:_0x2d6707[_0x4592('0x3b')];if(!_0x1467cd[_0x4592('0x3c')]['hasOwnProperty'](_0x4592('0x43'))){_0x2096b7[_0x4592('0x2a')]=qs[_0x4592('0x2a')](_0x1467cd[_0x4592('0x3c')][_0x4592('0x2a')]);_0x2096b7[_0x4592('0x29')]=qs[_0x4592('0x29')](_0x1467cd[_0x4592('0x3c')][_0x4592('0x29')]);}_0x2096b7[_0x4592('0x64')]=qs[_0x4592('0x44')](_0x1467cd[_0x4592('0x3c')][_0x4592('0x44')]);_0x2096b7[_0x4592('0x48')]=qs['filters'](_[_0x4592('0x45')](_0x1467cd[_0x4592('0x3c')],_0x2d6707['filters']));_0x2096b7[_0x4592('0x48')]['FaxAccountId']=_0x28f636['id'];if(_0x1467cd['query'][_0x4592('0x46')]){_0x2096b7[_0x4592('0x48')]=_[_0x4592('0x47')](_0x2096b7[_0x4592('0x48')],{'$or':_[_0x4592('0x38')](_0x2096b7['attributes'],function(_0x5643b3){var _0xe55b9a={};_0xe55b9a[_0x5643b3]={'$like':'%'+_0x1467cd['query']['filter']+'%'};return _0xe55b9a;})});}_0x2096b7=_[_0x4592('0x47')]({},_0x2096b7,_0x1467cd[_0x4592('0x4b')]);return db[_0x4592('0x68')]['count']({'where':_0x2096b7[_0x4592('0x48')]})[_0x4592('0x1b')](function(_0x3eaa49){_0x25a19e[_0x4592('0x2b')]=_0x3eaa49;if(_0x1467cd[_0x4592('0x3c')][_0x4592('0x4c')]){_0x2096b7[_0x4592('0x4d')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4592('0x65')](_0x2096b7);})[_0x4592('0x1b')](function(_0x2f7b20){_0x25a19e[_0x4592('0x4e')]=_0x2f7b20;return _0x25a19e;});}})[_0x4592('0x1b')](respondWithFilteredResult(_0xc2d987,_0x2096b7))[_0x4592('0x4f')](handleError(_0xc2d987,null));};exports[_0x4592('0x69')]=function(_0x80bae5,_0x253ddb,_0x3225e1){return db[_0x4592('0x39')]['find']({'where':{'id':_0x80bae5[_0x4592('0x51')]['id']}})[_0x4592('0x1b')](handleEntityNotFound(_0x253ddb,null))[_0x4592('0x1b')](function(_0x503027){if(_0x503027){return _0x503027[_0x4592('0x69')](_0x80bae5[_0x4592('0x3c')]['ids']);}})['then'](respondWithStatusCode(_0x253ddb,null))[_0x4592('0x4f')](handleError(_0x253ddb,null));};exports[_0x4592('0x6a')]=function(_0x22385c,_0x50d597,_0x371c34){return db[_0x4592('0x6b')]['find']({'where':{'id':_0x22385c[_0x4592('0x51')]['id']}})['then'](handleEntityNotFound(_0x50d597,null))['then'](function(_0x2beaae){if(_0x2beaae){return _0x2beaae['addInteraction'](_0x22385c[_0x4592('0x5b')][_0x4592('0x67')],_[_0x4592('0x6c')](_0x22385c['body'],[_0x4592('0x67'),'id'])||{});}})[_0x4592('0x1b')](respondWithResult(_0x50d597,null))[_0x4592('0x4f')](handleError(_0x50d597,null));};exports[_0x4592('0x6d')]=function(_0x10d76f,_0x136c35,_0x20a7cc){var _0x1dfbba={'raw':![],'where':{}};var _0x2234fc={};var _0x4dd4b1={'count':0x0,'rows':[]};return db[_0x4592('0x39')][_0x4592('0x62')]({'where':{'id':_0x10d76f['params']['id']}})[_0x4592('0x1b')](handleEntityNotFound(_0x136c35,null))[_0x4592('0x1b')](function(_0x1cc5bf){if(_0x1cc5bf){_0x2234fc[_0x4592('0x3b')]=_[_0x4592('0x3d')](db[_0x4592('0x6b')][_0x4592('0x53')]);_0x2234fc[_0x4592('0x3c')]=_['keys'](_0x10d76f[_0x4592('0x3c')]);_0x2234fc['filters']=_[_0x4592('0x3f')](_0x2234fc[_0x4592('0x3b')],_0x2234fc['query']);_0x1dfbba[_0x4592('0x40')]=_[_0x4592('0x3f')](_0x2234fc[_0x4592('0x3b')],qs[_0x4592('0x41')](_0x10d76f[_0x4592('0x3c')]['fields']));_0x1dfbba['attributes']=_0x1dfbba[_0x4592('0x40')][_0x4592('0x42')]?_0x1dfbba['attributes']:_0x2234fc[_0x4592('0x3b')];if(!_0x10d76f[_0x4592('0x3c')][_0x4592('0x63')](_0x4592('0x43'))){_0x1dfbba[_0x4592('0x2a')]=qs[_0x4592('0x2a')](_0x10d76f[_0x4592('0x3c')][_0x4592('0x2a')]);_0x1dfbba[_0x4592('0x29')]=qs['offset'](_0x10d76f[_0x4592('0x3c')]['offset']);}_0x1dfbba[_0x4592('0x64')]=qs[_0x4592('0x44')](_0x10d76f[_0x4592('0x3c')][_0x4592('0x44')]);_0x1dfbba[_0x4592('0x48')]=qs[_0x4592('0x3e')](_['pick'](_0x10d76f[_0x4592('0x3c')],_0x2234fc[_0x4592('0x3e')]));_0x1dfbba['where'][_0x4592('0x5e')]=_0x1cc5bf['id'];if(_0x10d76f[_0x4592('0x3c')][_0x4592('0x46')]){_0x1dfbba[_0x4592('0x48')]=_[_0x4592('0x47')](_0x1dfbba['where'],{'$or':_[_0x4592('0x38')](_0x1dfbba['attributes'],function(_0xd29fc9){var _0x4f0595={};_0x4f0595[_0xd29fc9]={'$like':'%'+_0x10d76f[_0x4592('0x3c')]['filter']+'%'};return _0x4f0595;})});}_0x1dfbba=_[_0x4592('0x47')]({},_0x1dfbba,_0x10d76f[_0x4592('0x4b')]);return db[_0x4592('0x6b')]['count']({'where':_0x1dfbba[_0x4592('0x48')]})[_0x4592('0x1b')](function(_0x5cb755){_0x4dd4b1[_0x4592('0x2b')]=_0x5cb755;if(_0x10d76f[_0x4592('0x3c')][_0x4592('0x4c')]){_0x1dfbba[_0x4592('0x4d')]=[{'model':db[_0x4592('0x6e')],'as':_0x4592('0x6f'),'required':![]},{'model':db['User'],'as':_0x4592('0x70'),'attributes':[_0x4592('0x34'),_0x4592('0x71'),_0x4592('0x72')],'required':![]},{'model':db[_0x4592('0x73')],'as':_0x4592('0x74'),'attributes':['id',_0x4592('0x34'),_0x4592('0x75')],'where':_0x10d76f[_0x4592('0x3c')][_0x4592('0x76')]?{'id':_0x10d76f['query'][_0x4592('0x76')]}:undefined,'required':_0x10d76f[_0x4592('0x3c')][_0x4592('0x76')]?!![]:![]}];}return db['FaxInteraction'][_0x4592('0x65')](_0x1dfbba);})[_0x4592('0x1b')](function(_0x456eeb){_0x4dd4b1[_0x4592('0x4e')]=_0x456eeb;return _0x4dd4b1;});}})[_0x4592('0x1b')](respondWithFilteredResult(_0x136c35,_0x1dfbba))[_0x4592('0x4f')](handleError(_0x136c35,null));};exports[_0x4592('0x77')]=function(_0x35dc5c,_0x381983,_0x388850){return db[_0x4592('0x39')][_0x4592('0x62')]({'where':{'id':_0x35dc5c[_0x4592('0x51')]['id']}})[_0x4592('0x1b')](handleEntityNotFound(_0x381983,null))[_0x4592('0x1b')](function(_0x31bbdb){if(_0x31bbdb){return db[_0x4592('0x78')][_0x4592('0x79')](function(_0x3c466c){return db[_0x4592('0x7a')][_0x4592('0x30')]({'where':{'FaxAccountId':_0x35dc5c[_0x4592('0x51')]['id']},'transaction':_0x3c466c})['then'](function(_0x543f50){var _0xe12973=_[_0x4592('0x38')](_0x35dc5c[_0x4592('0x5b')],function(_0x76982b){_0x76982b[_0x4592('0x5e')]=_0x35dc5c['params']['id'];return _0x76982b;});return db['FaxApplication'][_0x4592('0x7b')](_0xe12973,{'transaction':_0x3c466c});});})['then'](function(){return db[_0x4592('0x7a')]['findAndCountAll']({'where':{'FaxAccountId':_0x35dc5c[_0x4592('0x51')]['id']},'order':_0x4592('0x7c')});});}})['then'](respondWithResult(_0x381983,null))[_0x4592('0x4f')](handleError(_0x381983,null));};exports[_0x4592('0x7d')]=function(_0x4b641d,_0x228cd5,_0x412e59){var _0xf10dcc={};var _0x5d19d7={};var _0x498405;var _0x5b1fd8;return db[_0x4592('0x39')][_0x4592('0x62')]({'where':{'id':_0x4b641d[_0x4592('0x51')]['id']}})[_0x4592('0x1b')](handleEntityNotFound(_0x228cd5,null))[_0x4592('0x1b')](function(_0x338eeb){if(_0x338eeb){_0x498405=_0x338eeb;_0x5d19d7[_0x4592('0x3b')]=_['keys'](db[_0x4592('0x7a')][_0x4592('0x53')]);_0x5d19d7[_0x4592('0x3c')]=_[_0x4592('0x3d')](_0x4b641d[_0x4592('0x3c')]);_0x5d19d7[_0x4592('0x3e')]=_[_0x4592('0x3f')](_0x5d19d7[_0x4592('0x3b')],_0x5d19d7[_0x4592('0x3c')]);_0xf10dcc[_0x4592('0x40')]=_[_0x4592('0x3f')](_0x5d19d7[_0x4592('0x3b')],qs[_0x4592('0x41')](_0x4b641d[_0x4592('0x3c')]['fields']));_0xf10dcc[_0x4592('0x40')]=_0xf10dcc[_0x4592('0x40')][_0x4592('0x42')]?_0xf10dcc['attributes']:_0x5d19d7[_0x4592('0x3b')];_0xf10dcc[_0x4592('0x64')]=qs[_0x4592('0x44')](_0x4b641d[_0x4592('0x3c')][_0x4592('0x44')]);_0xf10dcc[_0x4592('0x48')]=qs['filters'](_[_0x4592('0x45')](_0x4b641d[_0x4592('0x3c')],_0x5d19d7[_0x4592('0x3e')]));if(_0x4b641d[_0x4592('0x3c')][_0x4592('0x46')]){_0xf10dcc['where']=_[_0x4592('0x47')](_0xf10dcc[_0x4592('0x48')],{'$or':_[_0x4592('0x38')](_0xf10dcc[_0x4592('0x40')],function(_0x5c693f){var _0x45b267={};_0x45b267[_0x5c693f]={'$like':'%'+_0x4b641d[_0x4592('0x3c')]['filter']+'%'};return _0x45b267;})});}_0xf10dcc=_[_0x4592('0x47')]({},_0xf10dcc,_0x4b641d[_0x4592('0x4b')]);return _0x498405[_0x4592('0x7d')](_0xf10dcc);}})[_0x4592('0x1b')](function(_0x1a3cd9){if(_0x1a3cd9){_0x5b1fd8=_0x1a3cd9[_0x4592('0x42')];if(!_0x4b641d[_0x4592('0x3c')][_0x4592('0x63')](_0x4592('0x43'))){_0xf10dcc[_0x4592('0x2a')]=qs[_0x4592('0x2a')](_0x4b641d[_0x4592('0x3c')]['limit']);_0xf10dcc[_0x4592('0x29')]=qs[_0x4592('0x29')](_0x4b641d[_0x4592('0x3c')][_0x4592('0x29')]);}return _0x498405[_0x4592('0x7d')](_0xf10dcc);}})[_0x4592('0x1b')](function(_0x1f3465){if(_0x1f3465){return _0x1f3465?{'count':_0x5b1fd8,'rows':_0x1f3465}:null;}})[_0x4592('0x1b')](respondWithResult(_0x228cd5,null))[_0x4592('0x4f')](handleError(_0x228cd5,null));};function Extension(_0x418428,_0x5230aa,_0x32607a,_0x589be6){this['context']='from-voip-provider';this[_0x4592('0x7e')]=_0x418428[_0x4592('0x7f')];this[_0x4592('0x80')]=_0x589be6;this[_0x4592('0x49')]=_0x4592('0x81');this['description']=_0x4592('0x82');this[_0x4592('0x5e')]=_0x418428['id'];this['priority']=_0x5230aa;this[_0x4592('0x83')]=_0x32607a;}function createExtensionsReciveFax(_0x462833){var _0x515b53=0x1;var _0x44d2c9=[];_0x44d2c9['push'](new Extension(_0x462833,_0x515b53,'',_0x4592('0x84')));_0x515b53+=0x1;_0x44d2c9['push'](new Extension(_0x462833,_0x515b53,_0x4592('0x85'),_0x4592('0x86')));_0x515b53+=0x1;for(var _0x367085 in _0x462833){if(_0x462833[_0x4592('0x63')](_0x367085)&&(_0x367085===_0x4592('0x87')||_0x367085===_0x4592('0x7f')||_0x367085===_0x4592('0x88')||_0x367085===_0x4592('0x89')||_0x367085===_0x4592('0x8a')||_0x367085===_0x4592('0x8b')||_0x367085===_0x4592('0x8c')||_0x367085==='modem'||_0x367085==='t38timeout')){_0x44d2c9[_0x4592('0x8d')](new Extension(_0x462833,_0x515b53,'FAXOPT('+_0x367085+')='+_0x462833[_0x367085],_0x4592('0x86')));_0x515b53+=0x1;}}_0x44d2c9['push'](new Extension(_0x462833,_0x515b53,'6','Wait'));_0x515b53+=0x1;_0x44d2c9['push'](new Extension(_0x462833,_0x515b53,'/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',_0x4592('0x8e')));_0x515b53=0x0;return _0x44d2c9;}exports['addAccountApplications']=function(_0xcf7a32,_0x18e888,_0x5f3be3){var _0x18c277;return db['sequelize']['transaction'](function(_0x553f57){return db[_0x4592('0x39')][_0x4592('0x60')](_0xcf7a32[_0x4592('0x5b')],{'transaction':_0x553f57})['then'](function(_0x278b88){_0x18c277=_0x278b88['get']({'plain':!![]});return db['VoiceExtension'][_0x4592('0x7b')](createExtensionsReciveFax(_0x18c277),{'transaction':_0x553f57});});})[_0x4592('0x1b')](function(){return _0x18c277;})['then'](respondWithResult(_0x18e888,null))['catch'](handleError(_0x18e888,null));};exports[_0x4592('0x8f')]=function(_0x1c428f,_0x261496,_0x1596a8){var _0x1829ea;return db[_0x4592('0x78')][_0x4592('0x79')](function(_0x1d85a8){return db['FaxAccount'][_0x4592('0x2f')](_0x1c428f[_0x4592('0x5b')],{'where':{'id':_0x1c428f[_0x4592('0x5b')]['id']},'transaction':_0x1d85a8})[_0x4592('0x1b')](function(_0x2fd000){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x1c428f['body']['id']},'transaction':_0x1d85a8})[_0x4592('0x1b')](function(_0x5c30e6){return db[_0x4592('0x90')]['bulkCreate'](createExtensionsReciveFax(_[_0x4592('0x6c')](_0x1c428f[_0x4592('0x5b')],[_0x4592('0x91'),_0x4592('0x92'),'createdAt',_0x4592('0x93'),_0x4592('0x94'),_0x4592('0x95')])),{'transaction':_0x1d85a8});});});})[_0x4592('0x1b')](function(){return db[_0x4592('0x39')]['findById'](_0x1c428f['body']['id']);})[_0x4592('0x1b')](respondWithResult(_0x261496,null))[_0x4592('0x4f')](handleError(_0x261496,null));};exports[_0x4592('0x96')]=function(_0x25f2b9,_0x547a33,_0x211942){var _0x30677a={'raw':!![],'where':{}};var _0x1da68d={};var _0x41b7f6={'count':0x0,'rows':[]};return db[_0x4592('0x39')]['findOne']({'where':{'id':_0x25f2b9[_0x4592('0x51')]['id']}})[_0x4592('0x1b')](handleEntityNotFound(_0x547a33,null))[_0x4592('0x1b')](function(_0x5dd8eb){if(_0x5dd8eb){_0x1da68d[_0x4592('0x3b')]=_['keys'](db[_0x4592('0x97')][_0x4592('0x53')]);_0x1da68d[_0x4592('0x3c')]=_[_0x4592('0x3d')](_0x25f2b9[_0x4592('0x3c')]);_0x1da68d['filters']=_[_0x4592('0x3f')](_0x1da68d[_0x4592('0x3b')],_0x1da68d[_0x4592('0x3c')]);_0x30677a[_0x4592('0x40')]=_[_0x4592('0x3f')](_0x1da68d[_0x4592('0x3b')],qs[_0x4592('0x41')](_0x25f2b9[_0x4592('0x3c')][_0x4592('0x41')]));_0x30677a[_0x4592('0x40')]=_0x30677a[_0x4592('0x40')]['length']?_0x30677a[_0x4592('0x40')]:_0x1da68d[_0x4592('0x3b')];if(!_0x25f2b9[_0x4592('0x3c')][_0x4592('0x63')](_0x4592('0x43'))){_0x30677a[_0x4592('0x2a')]=qs[_0x4592('0x2a')](_0x25f2b9[_0x4592('0x3c')][_0x4592('0x2a')]);_0x30677a[_0x4592('0x29')]=qs[_0x4592('0x29')](_0x25f2b9[_0x4592('0x3c')][_0x4592('0x29')]);}_0x30677a[_0x4592('0x64')]=qs[_0x4592('0x44')](_0x25f2b9[_0x4592('0x3c')][_0x4592('0x44')]);_0x30677a['where']=qs[_0x4592('0x3e')](_[_0x4592('0x45')](_0x25f2b9[_0x4592('0x3c')],_0x1da68d[_0x4592('0x3e')]));_0x30677a[_0x4592('0x48')][_0x4592('0x5e')]=_0x5dd8eb['id'];if(_0x25f2b9['query'][_0x4592('0x46')]){_0x30677a[_0x4592('0x48')]=_[_0x4592('0x47')](_0x30677a[_0x4592('0x48')],{'$or':_[_0x4592('0x38')](_0x30677a['attributes'],function(_0xc8408f){var _0x3bb535={};_0x3bb535[_0xc8408f]={'$like':'%'+_0x25f2b9[_0x4592('0x3c')]['filter']+'%'};return _0x3bb535;})});}if(_0x25f2b9['query'][_0x4592('0x98')]){var _0x5a0ff0=_0x25f2b9[_0x4592('0x3c')]['$gte']['split'](',');var _0x59475e={};_0x59475e[_0x5a0ff0[0x0]]={'$gte':moment(_0x5a0ff0[0x1])[_0x4592('0x99')](_0x4592('0x9a'))};_0x30677a[_0x4592('0x48')]=_[_0x4592('0x47')](_0x30677a[_0x4592('0x48')],_0x59475e);}_0x30677a=_['merge']({},_0x30677a,_0x25f2b9['options']);return db[_0x4592('0x97')][_0x4592('0x2b')]({'where':_0x30677a[_0x4592('0x48')]})[_0x4592('0x1b')](function(_0x22b247){_0x41b7f6[_0x4592('0x2b')]=_0x22b247;if(_0x25f2b9['query'][_0x4592('0x4c')]){_0x30677a[_0x4592('0x4d')]=[{'all':!![]}];}return db['FaxMessage'][_0x4592('0x65')](_0x30677a);})['then'](function(_0x488f85){_0x41b7f6[_0x4592('0x4e')]=_0x488f85;return _0x41b7f6;});}})['then'](respondWithFilteredResult(_0x547a33,_0x30677a))[_0x4592('0x4f')](handleError(_0x547a33,null));};exports[_0x4592('0x35')]=function(_0x469981,_0x479a9d,_0x5435fb){var _0x482908,_0x58a693={},_0x67e029;if(_0x469981[_0x4592('0x5b')]['to']){_0x67e029=_0x469981[_0x4592('0x5b')]['to'][0x0];}return db[_0x4592('0x39')][_0x4592('0x54')]({'where':{'id':_0x469981[_0x4592('0x51')]['id']},'include':[{'model':db[_0x4592('0x9b')],'as':_0x4592('0x9c'),'include':[{'model':db[_0x4592('0x6e')],'as':_0x4592('0x9d'),'where':{'fax':_0x67e029},'limit':0x1,'order':[[_0x4592('0x93'),_0x4592('0x9e')]]}]}]})[_0x4592('0x1b')](handleEntityNotFound(_0x479a9d,null))[_0x4592('0x1b')](function(_0x236955){_0x482908=_0x236955;if(_0x469981[_0x4592('0x5b')][_0x4592('0x9f')]&&_0x469981[_0x4592('0x5b')][_0x4592('0x9f')]['length']){for(var _0x1c3b10=0x0;_0x1c3b10<_0x469981[_0x4592('0x5b')]['attachments']['length'];_0x1c3b10+=0x1){_0x469981[_0x4592('0x5b')][_0x4592('0x9f')][_0x1c3b10]={'filename':_0x469981[_0x4592('0x5b')][_0x4592('0x9f')][_0x1c3b10][_0x4592('0x34')],'id':_0x469981['body']['attachments'][_0x1c3b10]['id'],'path':path['join'](config[_0x4592('0xa0')],_0x4592('0xa1'),_0x469981[_0x4592('0x5b')]['attachments'][_0x1c3b10][_0x4592('0xa2')])};}}return respondWithRpcPromise(_0x4592('0xa3'),_0x4592('0xa3'),{'FaxAccountId':_[_0x4592('0xa4')](_0x469981[_0x4592('0x51')]['id'])?undefined:_0x469981[_0x4592('0x51')]['id'],'path':_['isNil'](_0x469981[_0x4592('0x5b')][_0x4592('0x9f')][0x0][_0x4592('0x3')])?undefined:_0x469981[_0x4592('0x5b')]['attachments'][0x0][_0x4592('0x3')],'fax':_[_0x4592('0xa4')](_0x469981[_0x4592('0x5b')]['to'][0x0])?undefined:_0x469981['body']['to'][0x0]},client9002);})[_0x4592('0x1b')](function(){if(_0x482908){if(_[_0x4592('0xa4')](_0x469981[_0x4592('0x5b')][_0x4592('0xa5')])){_0x469981[_0x4592('0x5b')]['from']=util['format'](_0x4592('0xa6'),_0x482908['name'],_0x482908[_0x4592('0xa7')]);}if(_0x482908[_0x4592('0x9c')]){if(_0x482908[_0x4592('0x9c')]['Contacts'][_0x4592('0x42')]){return _0x482908[_0x4592('0x9c')][_0x4592('0x9d')][0x0];}else{return db[_0x4592('0x6e')][_0x4592('0x60')](_[_0x4592('0x15')](_0x469981[_0x4592('0x5b')],{'firstName':_0x469981[_0x4592('0x5b')]['to'][0x0],'phone':_0x469981[_0x4592('0x5b')]['to'][0x0],'fax':_0x469981[_0x4592('0x5b')]['to'][0x0],'ListId':_0x482908[_0x4592('0x95')]}));}}else{throw new Error(_0x4592('0xa8'));}}else{throw new Error(_0x4592('0xa9'));}})[_0x4592('0x1b')](function(_0x51c521){if(_0x51c521){return db[_0x4592('0x6b')][_0x4592('0x54')]({'where':{'ContactId':_0x51c521['id'],'closed':![],'FaxAccountId':_0x482908['id']}})[_0x4592('0x1b')](function(_0x1e6415){if(_0x1e6415){return[_0x1e6415,![]];}return db['FaxInteraction'][_0x4592('0x60')]({'UserId':_0x469981['user']['id'],'ContactId':_0x51c521['id'],'FaxAccountId':_0x482908['id'],'fax':_0x469981[_0x4592('0x5b')]['to'][0x0],'firstMsgDirection':_0x4592('0xaa'),'Messages':[_[_0x4592('0x47')](_0x469981['body'],{'read':![],'body':_0x469981[_0x4592('0x5b')][_0x4592('0x9f')][0x0]['filename'],'FaxAccountId':_0x482908['id'],'UserId':_0x469981[_0x4592('0x55')]['id'],'ContactId':_0x51c521['id'],'AttachmentId':_0x469981[_0x4592('0x5b')][_0x4592('0x9f')][0x0]['id']})]},{'include':[{'model':db[_0x4592('0x97')],'as':_0x4592('0xab')}]})[_0x4592('0x1b')](function(_0x16ae23){return[_0x16ae23,!![]];});});}else{throw new Error(_0x4592('0xac'));}})['spread'](function(_0x5d6a7c,_0x2d22fb){if(_0x2d22fb){return _0x5d6a7c;}return db[_0x4592('0x97')]['create']({'direction':_0x4592('0xaa'),'read':![],'body':_0x469981['body'][_0x4592('0x9f')][0x0][_0x4592('0xad')],'FaxAccountId':_0x482908['id'],'FaxInteractionId':_0x5d6a7c['id'],'UserId':_0x469981[_0x4592('0x55')]['id'],'ContactId':_0x5d6a7c[_0x4592('0xae')],'AttachmentId':_0x469981['body'][_0x4592('0x9f')][0x0]['id']})[_0x4592('0x1b')](function(_0x299eae){_0x5d6a7c[_0x4592('0xaf')][_0x4592('0xab')]=[];_0x5d6a7c['dataValues'][_0x4592('0xab')][_0x4592('0x8d')](_0x299eae[_0x4592('0xaf')]);return _0x5d6a7c;});})[_0x4592('0x1b')](function(_0x28b594){respondWithRpcPromise(_0x4592('0xb0'),_0x4592('0xb0'),{'FaxAccountId':_[_0x4592('0xa4')](_0x469981[_0x4592('0x51')]['id'])?undefined:_0x469981[_0x4592('0x51')]['id'],'path':_['isNil'](_0x469981['body'][_0x4592('0x9f')][0x0]['path'])?undefined:_0x469981['body'][_0x4592('0x9f')][0x0][_0x4592('0x3')],'fax':_['isNil'](_0x469981[_0x4592('0x5b')]['to'][0x0])?undefined:_0x469981['body']['to'][0x0],'AttachmentId':_0x469981[_0x4592('0x5b')]['attachments'][0x0]['id']},client9002)['then'](function(_0x40c001){logger[_0x4592('0x1c')](_0x4592('0xb1'),_0x40c001);})[_0x4592('0x4f')](function(_0x35cf76){logger['info'](_0x4592('0xb1'),_0x35cf76);});return _0x28b594;})[_0x4592('0x1b')](respondWithResult(_0x479a9d,null))[_0x4592('0x4f')](handleError(_0x479a9d,null));};exports[_0x4592('0xb2')]=function(_0x15ff5e,_0x522571,_0xb5d2dd){return db[_0x4592('0x39')][_0x4592('0x54')]({'where':{'id':_0x15ff5e[_0x4592('0x51')]['id']}})[_0x4592('0x1b')](handleEntityNotFound(_0x522571,null))[_0x4592('0x1b')](function(_0x1dbabc){if(_0x1dbabc){return _0x1dbabc['addAgents'](_0x15ff5e[_0x4592('0x5b')][_0x4592('0x67')],_['omit'](_0x15ff5e[_0x4592('0x5b')],[_0x4592('0x67'),'id'])||{})['spread'](function(_0x3e1eaa){for(var _0x4ef44e=0x0;_0x4ef44e<_0x15ff5e[_0x4592('0x5b')]['ids'][_0x4592('0x42')];_0x4ef44e+=0x1){socket['emit'](_0x4592('0xb3'),{'UserId':Number(_0x15ff5e[_0x4592('0x5b')][_0x4592('0x67')][_0x4ef44e]),'FaxAccountId':Number(_0x15ff5e[_0x4592('0x51')]['id'])});}return _0x3e1eaa;});}})[_0x4592('0x1b')](respondWithResult(_0x522571,null))['catch'](handleError(_0x522571,null));};exports[_0x4592('0xb4')]=function(_0x449a09,_0x41f589,_0x33cab7){return db[_0x4592('0x39')][_0x4592('0x54')]({'where':{'id':_0x449a09[_0x4592('0x51')]['id']}})[_0x4592('0x1b')](handleEntityNotFound(_0x41f589,null))[_0x4592('0x1b')](function(_0x683c29){if(_0x683c29){return _0x683c29[_0x4592('0xb4')](_0x449a09['query'][_0x4592('0x67')])[_0x4592('0x1b')](function(){if(_[_0x4592('0xb5')](_0x449a09[_0x4592('0x3c')][_0x4592('0x67')])){for(var _0xe08d43=0x0;_0xe08d43<_0x449a09[_0x4592('0x3c')][_0x4592('0x67')]['length'];_0xe08d43+=0x1){socket['emit'](_0x4592('0xb6'),{'UserId':Number(_0x449a09[_0x4592('0x3c')]['ids'][_0xe08d43]),'FaxAccountId':Number(_0x449a09[_0x4592('0x51')]['id'])});}}else{socket[_0x4592('0xb7')]('userFaxAccount:remove',{'UserId':Number(_0x449a09[_0x4592('0x3c')][_0x4592('0x67')]),'FaxAccountId':Number(_0x449a09[_0x4592('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x41f589,null))[_0x4592('0x4f')](handleError(_0x41f589,null));};exports[_0x4592('0xb8')]=function(_0x4265bf,_0xdd5858,_0x3dd607){var _0x4d2ba3={};var _0x2fa161={};var _0x35fb75;var _0x191966;return db[_0x4592('0x39')]['findOne']({'where':{'id':_0x4265bf[_0x4592('0x51')]['id']}})[_0x4592('0x1b')](handleEntityNotFound(_0xdd5858,null))[_0x4592('0x1b')](function(_0x36a69d){if(_0x36a69d){_0x35fb75=_0x36a69d;_0x2fa161[_0x4592('0x3b')]=_[_0x4592('0x3d')](db[_0x4592('0xb9')][_0x4592('0x53')]);_0x2fa161['query']=_[_0x4592('0x3d')](_0x4265bf['query']);_0x2fa161[_0x4592('0x3e')]=_[_0x4592('0x3f')](_0x2fa161[_0x4592('0x3b')],_0x2fa161['query']);_0x4d2ba3[_0x4592('0x40')]=_[_0x4592('0x3f')](_0x2fa161[_0x4592('0x3b')],qs[_0x4592('0x41')](_0x4265bf[_0x4592('0x3c')][_0x4592('0x41')]));_0x4d2ba3[_0x4592('0x40')]=_0x4d2ba3[_0x4592('0x40')][_0x4592('0x42')]?_0x4d2ba3['attributes']:_0x2fa161['model'];_0x4d2ba3[_0x4592('0x64')]=qs[_0x4592('0x44')](_0x4265bf[_0x4592('0x3c')][_0x4592('0x44')]);_0x4d2ba3[_0x4592('0x48')]=qs[_0x4592('0x3e')](_[_0x4592('0x45')](_0x4265bf[_0x4592('0x3c')],_0x2fa161[_0x4592('0x3e')]));if(_0x4265bf[_0x4592('0x3c')][_0x4592('0x46')]){_0x4d2ba3['where']=_[_0x4592('0x47')](_0x4d2ba3[_0x4592('0x48')],{'$or':_[_0x4592('0x38')](_0x4d2ba3['attributes'],function(_0x17332f){var _0x59085b={};_0x59085b[_0x17332f]={'$like':'%'+_0x4265bf[_0x4592('0x3c')][_0x4592('0x46')]+'%'};return _0x59085b;})});}_0x4d2ba3=_['merge']({},_0x4d2ba3,_0x4265bf[_0x4592('0x4b')]);return _0x35fb75['getAgents'](_0x4d2ba3);}})['then'](function(_0x1b75b5){if(_0x1b75b5){_0x191966=_0x1b75b5['length'];if(!_0x4265bf[_0x4592('0x3c')][_0x4592('0x63')](_0x4592('0x43'))){_0x4d2ba3[_0x4592('0x2a')]=qs['limit'](_0x4265bf[_0x4592('0x3c')][_0x4592('0x2a')]);_0x4d2ba3[_0x4592('0x29')]=qs[_0x4592('0x29')](_0x4265bf[_0x4592('0x3c')][_0x4592('0x29')]);}return _0x35fb75['getAgents'](_0x4d2ba3);}})[_0x4592('0x1b')](function(_0xf28c27){if(_0xf28c27){return _0xf28c27?{'count':_0x191966,'rows':_0xf28c27}:null;}})[_0x4592('0x1b')](respondWithResult(_0xdd5858,null))[_0x4592('0x4f')](handleError(_0xdd5858,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 77f1a05..b4da000 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 _0x7cc8=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x3aaaca,_0x1325e3){var _0x1b9816=function(_0x440d85){while(--_0x440d85){_0x3aaaca['push'](_0x3aaaca['shift']());}};_0x1b9816(++_0x1325e3);}(_0x7cc8,0x8c));var _0x87cc=function(_0x3dd06c,_0x51d017){_0x3dd06c=_0x3dd06c-0x0;var _0x13dedc=_0x7cc8[_0x3dd06c];return _0x13dedc;};'use strict';var EventEmitter=require(_0x87cc('0x0'));var FaxAccount=require(_0x87cc('0x1'))['db'][_0x87cc('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x87cc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x87cc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x459830){return function(_0x22f539,_0x61dc86,_0x34dec1){FaxAccountEvents['emit'](_0x459830+':'+_0x22f539['id'],_0x22f539);FaxAccountEvents[_0x87cc('0x5')](_0x459830,_0x22f539);_0x34dec1(null);};}for(var e in events){if(events[_0x87cc('0x6')](e)){var event=events[e];FaxAccount[_0x87cc('0x7')](e,emitEvent(event));}}module[_0x87cc('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x5eed=['hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3a5105,_0x11f35c){var _0x53633f=function(_0xa1c454){while(--_0xa1c454){_0x3a5105['push'](_0x3a5105['shift']());}};_0x53633f(++_0x11f35c);}(_0x5eed,0x10a));var _0xd5ee=function(_0x1995ce,_0x22a926){_0x1995ce=_0x1995ce-0x0;var _0x314ebe=_0x5eed[_0x1995ce];return _0x314ebe;};'use strict';var EventEmitter=require(_0xd5ee('0x0'));var FaxAccount=require(_0xd5ee('0x1'))['db'][_0xd5ee('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xd5ee('0x3')](0x0);var events={'afterCreate':_0xd5ee('0x4'),'afterUpdate':_0xd5ee('0x5'),'afterDestroy':_0xd5ee('0x6')};function emitEvent(_0x1e3cb1){return function(_0x1ee9cf,_0x36514e,_0x4f2115){FaxAccountEvents[_0xd5ee('0x7')](_0x1e3cb1+':'+_0x1ee9cf['id'],_0x1ee9cf);FaxAccountEvents[_0xd5ee('0x7')](_0x1e3cb1,_0x1ee9cf);_0x4f2115(null);};}for(var e in events){if(events[_0xd5ee('0x8')](e)){var event=events[e];FaxAccount[_0xd5ee('0x9')](e,emitEvent(event));}}module[_0xd5ee('0xa')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index fc71be9..5655769 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 _0x7a9e=['bluebird','request-promise','path','rimraf','./faxAccount.attributes','exports','lodash','../../config/logger','api'];(function(_0x25b7df,_0x9f181b){var _0x580d3e=function(_0x3fe9af){while(--_0x3fe9af){_0x25b7df['push'](_0x25b7df['shift']());}};_0x580d3e(++_0x9f181b);}(_0x7a9e,0x15c));var _0xe7a9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7a9e[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xe7a9('0x0'));var util=require('util');var logger=require(_0xe7a9('0x1'))(_0xe7a9('0x2'));var moment=require('moment');var BPromise=require(_0xe7a9('0x3'));var rp=require(_0xe7a9('0x4'));var fs=require('fs');var path=require(_0xe7a9('0x5'));var rimraf=require(_0xe7a9('0x6'));var config=require('../../config/environment');var attributes=require(_0xe7a9('0x7'));module[_0xe7a9('0x8')]=function(_0x36d528,_0x366c60){return _0x36d528['define']('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc04c=['define','FaxAccount','fax_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xc04c,0xab));var _0xcc04=function(_0x57ffe1,_0x19341c){_0x57ffe1=_0x57ffe1-0x0;var _0x1d4c97=_0xc04c[_0x57ffe1];return _0x1d4c97;};'use strict';var _=require(_0xcc04('0x0'));var util=require(_0xcc04('0x1'));var logger=require(_0xcc04('0x2'))('api');var moment=require(_0xcc04('0x3'));var BPromise=require(_0xcc04('0x4'));var rp=require(_0xcc04('0x5'));var fs=require('fs');var path=require(_0xcc04('0x6'));var rimraf=require(_0xcc04('0x7'));var config=require(_0xcc04('0x8'));var attributes=require(_0xcc04('0x9'));module[_0xcc04('0xa')]=function(_0x295aac,_0xc5ffb2){return _0x295aac[_0xcc04('0xb')](_0xcc04('0xc'),attributes,{'tableName':_0xcc04('0xd'),'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 ad5d80c..bcb2cad 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 _0xe9ec=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','fax','CmContact','describe','difference','keys','updatedAt','createdAt','body','from','ValidationError','from\x20is\x20mandatory','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','DESC','FaxApplication','Applications','applications','list','orderBy','priority','asc','Contacts','create','contact','FaxInteraction','spread','push','length','close','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','agent','waitForTheAssignedAgent','Start','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x67c395,_0x38f3be){var _0x583186=function(_0x2a9441){while(--_0x2a9441){_0x67c395['push'](_0x67c395['shift']());}};_0x583186(++_0x38f3be);}(_0xe9ec,0x105));var _0xce9e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe9ec[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xce9e('0x0'));var util=require(_0xce9e('0x1'));var moment=require(_0xce9e('0x2'));var BPromise=require('bluebird');var rs=require(_0xce9e('0x3'));var fs=require('fs');var Redis=require(_0xce9e('0x4'));var db=require(_0xce9e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xce9e('0x6'));var config=require(_0xce9e('0x7'));var jayson=require(_0xce9e('0x8'));var client=jayson[_0xce9e('0x9')][_0xce9e('0xa')]({'port':0x232c});config[_0xce9e('0xb')]=_[_0xce9e('0xc')](config['redis'],{'host':_0xce9e('0xd'),'port':0x18eb});var socket=require(_0xce9e('0xe'))(new Redis(config[_0xce9e('0xb')]));require('./faxAccount.socket')[_0xce9e('0xf')](socket);function respondWithRpcPromise(_0x5b28e4,_0x19445f,_0x5f2ffc){return new BPromise(function(_0x50cd47,_0x2d538c){return client[_0xce9e('0x10')](_0x5b28e4,_0x5f2ffc)[_0xce9e('0x11')](function(_0x246511){logger[_0xce9e('0x12')](_0xce9e('0x13'),_0x19445f,'request\x20sent');logger[_0xce9e('0x14')](_0xce9e('0x15'),_0x19445f,_0xce9e('0x16'),JSON[_0xce9e('0x17')](_0x246511));if(_0x246511['error']){if(_0x246511[_0xce9e('0x18')][_0xce9e('0x19')]===0x1f4){logger[_0xce9e('0x18')](_0xce9e('0x13'),_0x19445f,_0x246511[_0xce9e('0x18')][_0xce9e('0x1a')]);return _0x2d538c(_0x246511[_0xce9e('0x18')][_0xce9e('0x1a')]);}logger[_0xce9e('0x18')](_0xce9e('0x13'),_0x19445f,_0x246511[_0xce9e('0x18')][_0xce9e('0x1a')]);return _0x50cd47(_0x246511['error']['message']);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x19445f,'request\x20sent');_0x50cd47(_0x246511[_0xce9e('0x1b')][_0xce9e('0x1a')]);}})[_0xce9e('0x1c')](function(_0x5c33e9){logger[_0xce9e('0x18')]('FaxAccount,\x20%s,\x20%s',_0x19445f,_0x5c33e9);_0x2d538c(_0x5c33e9);});});}exports[_0xce9e('0x1d')]=function(_0x2b9993){var _0x398f73=this;return new Promise(function(_0x128133,_0x10c7cf){return db[_0xce9e('0x1e')][_0xce9e('0x1f')]({'raw':_0x2b9993[_0xce9e('0x20')]?_0x2b9993['options'][_0xce9e('0x21')]===undefined?!![]:![]:!![],'where':_0x2b9993[_0xce9e('0x20')]?_0x2b9993[_0xce9e('0x20')][_0xce9e('0x22')]||null:null,'attributes':_0x2b9993[_0xce9e('0x20')]?_0x2b9993['options'][_0xce9e('0x23')]||null:null,'limit':_0x2b9993[_0xce9e('0x20')]?_0x2b9993[_0xce9e('0x20')][_0xce9e('0x24')]||null:null,'include':_0x2b9993[_0xce9e('0x20')]?_0x2b9993[_0xce9e('0x20')][_0xce9e('0x25')]?_[_0xce9e('0x26')](_0x2b9993['options'][_0xce9e('0x25')],function(_0x4f7611){return{'model':db[_0x4f7611[_0xce9e('0x27')]],'as':_0x4f7611['as'],'attributes':_0x4f7611[_0xce9e('0x23')],'include':_0x4f7611['include']?_[_0xce9e('0x26')](_0x4f7611['include'],function(_0x9f19cb){return{'model':db[_0x9f19cb[_0xce9e('0x27')]],'as':_0x9f19cb['as'],'attributes':_0x9f19cb[_0xce9e('0x23')],'include':_0x9f19cb['include']?_['map'](_0x9f19cb[_0xce9e('0x25')],function(_0x4ccc0b){return{'model':db[_0x4ccc0b[_0xce9e('0x27')]],'as':_0x4ccc0b['as'],'attributes':_0x4ccc0b['attributes']};}):[]};}):[]};}):[]:[]})[_0xce9e('0x11')](function(_0x12a398){logger['info'](_0xce9e('0x1d'),_0x2b9993);logger[_0xce9e('0x14')]('GetFaxAccount',_0x2b9993,JSON[_0xce9e('0x17')](_0x12a398));_0x128133(_0x12a398);})[_0xce9e('0x1c')](function(_0x4c4375){logger['error'](_0xce9e('0x1d'),_0x4c4375[_0xce9e('0x1a')],_0x2b9993);_0x10c7cf(_0x398f73['error'](0x1f4,_0x4c4375[_0xce9e('0x1a')]));});});};exports[_0xce9e('0x28')]=function(_0x431171,_0x4b881f,_0x46881a){var _0x68df0a=this;return new Promise(function(_0x194e97,_0x5e9e75){var _0x17f3c1={'body':_0x431171['body'],'channel':_0xce9e('0x29')};var _0x1fb60b=[];var _0x34e09e=[];var _0x486af9={};return db[_0xce9e('0x2a')][_0xce9e('0x2b')]()[_0xce9e('0x11')](function(_0x85b00e){if(!_0x85b00e){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x1fb60b=_[_0xce9e('0x2c')](_[_0xce9e('0x2d')](_0x85b00e),['createdAt',_0xce9e('0x2e')]);_0x34e09e=_['difference'](_[_0xce9e('0x2d')](_0x85b00e),[_0xce9e('0x2f'),_0xce9e('0x2e'),'CompanyId','ListId']);if(_0x431171[_0xce9e('0x30')]['id']){delete _0x431171['body']['id'];}if(_['isNil'](_0x431171[_0xce9e('0x30')][_0xce9e('0x31')])){throw new db['Sequelize'][(_0xce9e('0x32'))](_0xce9e('0x33'));}if(_[_0xce9e('0x34')](_0x431171[_0xce9e('0x30')]['body'])||_0x431171[_0xce9e('0x30')][_0xce9e('0x30')]===''){throw new db[(_0xce9e('0x35'))][(_0xce9e('0x32'))](_0xce9e('0x36'));}if(_[_0xce9e('0x34')](_0x431171[_0xce9e('0x30')][_0xce9e('0x37')])){throw new db['Sequelize'][(_0xce9e('0x32'))](_0xce9e('0x38')+_0x34e09e);}if(!_[_0xce9e('0x39')](_0x34e09e,_0x431171[_0xce9e('0x30')][_0xce9e('0x37')])){throw new db[(_0xce9e('0x35'))][(_0xce9e('0x32'))](_0xce9e('0x3a')+_0x34e09e);}_0x486af9[_0x431171[_0xce9e('0x30')]['mapKey']]=_0x431171['body'][_0xce9e('0x31')];})[_0xce9e('0x11')](function(){return db[_0xce9e('0x1e')][_0xce9e('0x3b')]({'where':{'id':_0x431171[_0xce9e('0x3c')]['id']},'include':[{'model':db[_0xce9e('0x3d')],'as':_0xce9e('0x3e'),'include':[{'model':db[_0xce9e('0x2a')],'as':'Contacts','where':_0x486af9,'limit':0x1,'order':[['updatedAt',_0xce9e('0x3f')]]}]},{'model':db[_0xce9e('0x40')],'as':_0xce9e('0x41')}]});})[_0xce9e('0x11')](function(_0x193489){if(_0x193489&&_0x193489[_0xce9e('0x3e')]){var _0x484d1a=_0x193489['get']({'plain':!![]});_0x17f3c1['account']=_0x484d1a;_0x17f3c1[_0xce9e('0x42')]=_0x484d1a['Applications'];_0x17f3c1[_0xce9e('0x43')]=_0x484d1a[_0xce9e('0x3e')];_0x17f3c1[_0xce9e('0x42')]=_[_0xce9e('0x44')](_0x17f3c1['applications'],[_0xce9e('0x45')],[_0xce9e('0x46')]);if(_0x17f3c1['account'][_0xce9e('0x41')]){delete _0x17f3c1[_0xce9e('0x3c')][_0xce9e('0x41')];}if(_0x17f3c1[_0xce9e('0x3c')][_0xce9e('0x3e')]&&_0x17f3c1[_0xce9e('0x3c')][_0xce9e('0x3e')][_0xce9e('0x47')]['length']){return _0x17f3c1['account'][_0xce9e('0x3e')]['Contacts'][0x0];}var _0x5eb04c=_[_0xce9e('0xc')](_0x431171[_0xce9e('0x30')],{'firstName':_0x431171[_0xce9e('0x30')][_0xce9e('0x31')],'ListId':_0x484d1a['ListId']});_0x5eb04c[_0x431171[_0xce9e('0x30')][_0xce9e('0x37')]]=_0x431171['body'][_0xce9e('0x31')];return db['CmContact'][_0xce9e('0x48')](_0x5eb04c,{'fields':_0x1fb60b,'raw':!![]});}})['then'](function(_0x2ae834){_0x17f3c1[_0xce9e('0x49')]=_0x2ae834;if(_0x2ae834){var _0x1ed0cf={'ContactId':_0x2ae834['id'],'FaxAccountId':_0x431171[_0xce9e('0x3c')]['id'],'fax':_0x2ae834[_0xce9e('0x29')]};return db[_0xce9e('0x4a')][_0xce9e('0x3b')]({'where':{'ContactId':_0x2ae834['id'],'closed':![],'FaxAccountId':_0x431171[_0xce9e('0x3c')]['id']}})[_0xce9e('0x11')](function(_0x497a07){if(_0x497a07){return[_0x497a07,![]];}return db[_0xce9e('0x4a')]['create'](_0x1ed0cf)[_0xce9e('0x11')](function(_0xe1e8e5){return[_0xe1e8e5,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xce9e('0x4b')](function(_0x1ce976,_0x5f12eb){var _0x45e304=_0x1ce976['get']({'plain':!![]});if(_0x5f12eb){if(_0x17f3c1[_0xce9e('0x3c')]['autoclose']){_0x17f3c1[_0xce9e('0x42')][_0xce9e('0x4c')]({'id':0x0,'priority':_0x17f3c1['applications'][_0xce9e('0x4d')]+0x1,'app':_0xce9e('0x4e'),'appdata':'unmanaged','interval':_0xce9e('0x4f')});}_0x45e304[_0xce9e('0x50')]=!![];}else{_0x45e304['created']=![];}_0x17f3c1[_0xce9e('0x51')]=_0x45e304;return db[_0xce9e('0x52')][_0xce9e('0x48')]({'body':_0x431171['body'][_0xce9e('0x30')],'FaxAccountId':_0x431171[_0xce9e('0x3c')]['id'],'FaxInteractionId':_0x1ce976['id'],'direction':'in','ContactId':_0x1ce976['ContactId'],'AttachmentId':_0x431171[_0xce9e('0x30')][_0xce9e('0x53')]});})[_0xce9e('0x11')](function(_0x3d0477){_0x17f3c1[_0xce9e('0x1a')]=_0x3d0477;if(_0x17f3c1[_0xce9e('0x51')][_0xce9e('0x54')]){return db[_0xce9e('0x55')][_0xce9e('0x3b')]({'attributes':['id',_0xce9e('0x56')],'where':{'id':_0x17f3c1[_0xce9e('0x51')][_0xce9e('0x54')]}})[_0xce9e('0x11')](function(_0x26a43e){if(_0x26a43e){_0x17f3c1[_0xce9e('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':_0xce9e('0x57'),'appdata':_0x26a43e[_0xce9e('0x56')]+','+(_0x17f3c1[_0xce9e('0x3c')][_0xce9e('0x58')]||0xa),'interval':_0xce9e('0x4f')});}return respondWithRpcPromise(_0xce9e('0x59'),'startRouting',_0x17f3c1);});}return respondWithRpcPromise(_0xce9e('0x59'),'startRouting',_0x17f3c1);})[_0xce9e('0x11')](function(_0x344332){_0x194e97(_0x344332);})[_0xce9e('0x1c')](function(_0x45633f){_0x5e9e75(_0x68df0a['error'](0x1f4,_0x45633f['message']));});});}; \ No newline at end of file +var _0xae4b=['name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','Contacts','DESC','get','applications','Applications','list','orderBy','priority','account','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','unmanaged','created','ContactId','AttachmentId','interaction','UserId','User'];(function(_0x34b2c2,_0x248869){var _0x23bd82=function(_0xe64107){while(--_0xe64107){_0x34b2c2['push'](_0x34b2c2['shift']());}};_0x23bd82(++_0x248869);}(_0xae4b,0x1c9));var _0xbae4=function(_0x334d6d,_0x3f3fb9){_0x334d6d=_0x334d6d-0x0;var _0x2d23e9=_0xae4b[_0x334d6d];return _0x2d23e9;};'use strict';var _=require('lodash');var util=require(_0xbae4('0x0'));var moment=require('moment');var BPromise=require(_0xbae4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbae4('0x2'));var db=require(_0xbae4('0x3'))['db'];var utils=require(_0xbae4('0x4'));var logger=require(_0xbae4('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbae4('0x6'));var client=jayson[_0xbae4('0x7')][_0xbae4('0x8')]({'port':0x232c});config[_0xbae4('0x9')]=_[_0xbae4('0xa')](config[_0xbae4('0x9')],{'host':_0xbae4('0xb'),'port':0x18eb});var socket=require(_0xbae4('0xc'))(new Redis(config[_0xbae4('0x9')]));require(_0xbae4('0xd'))[_0xbae4('0xe')](socket);function respondWithRpcPromise(_0x100bf6,_0x5cafb5,_0x5846a3){return new BPromise(function(_0x351c34,_0x478f96){return client['request'](_0x100bf6,_0x5846a3)[_0xbae4('0xf')](function(_0x7da37){logger[_0xbae4('0x10')](_0xbae4('0x11'),_0x5cafb5,'request\x20sent');logger[_0xbae4('0x12')](_0xbae4('0x13'),_0x5cafb5,_0xbae4('0x14'),JSON['stringify'](_0x7da37));if(_0x7da37[_0xbae4('0x15')]){if(_0x7da37[_0xbae4('0x15')]['code']===0x1f4){logger[_0xbae4('0x15')](_0xbae4('0x11'),_0x5cafb5,_0x7da37[_0xbae4('0x15')][_0xbae4('0x16')]);return _0x478f96(_0x7da37[_0xbae4('0x15')][_0xbae4('0x16')]);}logger[_0xbae4('0x15')](_0xbae4('0x11'),_0x5cafb5,_0x7da37[_0xbae4('0x15')][_0xbae4('0x16')]);return _0x351c34(_0x7da37[_0xbae4('0x15')][_0xbae4('0x16')]);}else{logger[_0xbae4('0x10')](_0xbae4('0x11'),_0x5cafb5,_0xbae4('0x14'));_0x351c34(_0x7da37[_0xbae4('0x17')][_0xbae4('0x16')]);}})['catch'](function(_0x3b9730){logger[_0xbae4('0x15')]('FaxAccount,\x20%s,\x20%s',_0x5cafb5,_0x3b9730);_0x478f96(_0x3b9730);});});}exports[_0xbae4('0x18')]=function(_0x2b9133){var _0x463df7=this;return new Promise(function(_0x52f887,_0x2d69bc){return db[_0xbae4('0x19')][_0xbae4('0x1a')]({'raw':_0x2b9133[_0xbae4('0x1b')]?_0x2b9133[_0xbae4('0x1b')][_0xbae4('0x1c')]===undefined?!![]:![]:!![],'where':_0x2b9133[_0xbae4('0x1b')]?_0x2b9133[_0xbae4('0x1b')][_0xbae4('0x1d')]||null:null,'attributes':_0x2b9133['options']?_0x2b9133['options'][_0xbae4('0x1e')]||null:null,'limit':_0x2b9133[_0xbae4('0x1b')]?_0x2b9133['options'][_0xbae4('0x1f')]||null:null,'include':_0x2b9133[_0xbae4('0x1b')]?_0x2b9133['options'][_0xbae4('0x20')]?_[_0xbae4('0x21')](_0x2b9133[_0xbae4('0x1b')][_0xbae4('0x20')],function(_0x4981a5){return{'model':db[_0x4981a5[_0xbae4('0x22')]],'as':_0x4981a5['as'],'attributes':_0x4981a5['attributes'],'include':_0x4981a5[_0xbae4('0x20')]?_['map'](_0x4981a5[_0xbae4('0x20')],function(_0x4ef5fa){return{'model':db[_0x4ef5fa[_0xbae4('0x22')]],'as':_0x4ef5fa['as'],'attributes':_0x4ef5fa[_0xbae4('0x1e')],'include':_0x4ef5fa['include']?_[_0xbae4('0x21')](_0x4ef5fa['include'],function(_0x2d46f4){return{'model':db[_0x2d46f4[_0xbae4('0x22')]],'as':_0x2d46f4['as'],'attributes':_0x2d46f4[_0xbae4('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x416b98){logger[_0xbae4('0x10')](_0xbae4('0x18'),_0x2b9133);logger[_0xbae4('0x12')](_0xbae4('0x18'),_0x2b9133,JSON['stringify'](_0x416b98));_0x52f887(_0x416b98);})['catch'](function(_0x51936a){logger[_0xbae4('0x15')](_0xbae4('0x18'),_0x51936a[_0xbae4('0x16')],_0x2b9133);_0x2d69bc(_0x463df7['error'](0x1f4,_0x51936a['message']));});});};exports[_0xbae4('0x23')]=function(_0x1ffab6,_0x2c4759,_0xcf9121){var _0x273f8e=this;return new Promise(function(_0x2bc656,_0x3237b5){var _0x236734={'body':_0x1ffab6['body'],'channel':_0xbae4('0x24')};var _0x282ba5=[];var _0x1e171e=[];var _0x405fd7={};return db[_0xbae4('0x25')][_0xbae4('0x26')]()[_0xbae4('0xf')](function(_0x2b0491){if(!_0x2b0491){throw new db[(_0xbae4('0x27'))][(_0xbae4('0x28'))](_0xbae4('0x29'));}_0x282ba5=_[_0xbae4('0x2a')](_[_0xbae4('0x2b')](_0x2b0491),[_0xbae4('0x2c'),_0xbae4('0x2d')]);_0x1e171e=_[_0xbae4('0x2a')](_[_0xbae4('0x2b')](_0x2b0491),[_0xbae4('0x2c'),_0xbae4('0x2d'),_0xbae4('0x2e'),_0xbae4('0x2f')]);if(_0x1ffab6[_0xbae4('0x30')]['id']){delete _0x1ffab6[_0xbae4('0x30')]['id'];}if(_[_0xbae4('0x31')](_0x1ffab6['body'][_0xbae4('0x32')])){throw new db[(_0xbae4('0x27'))]['ValidationError'](_0xbae4('0x33'));}if(_[_0xbae4('0x31')](_0x1ffab6[_0xbae4('0x30')]['body'])||_0x1ffab6[_0xbae4('0x30')][_0xbae4('0x30')]===''){throw new db[(_0xbae4('0x27'))][(_0xbae4('0x28'))](_0xbae4('0x34'));}if(_['isNil'](_0x1ffab6[_0xbae4('0x30')][_0xbae4('0x35')])){throw new db[(_0xbae4('0x27'))]['ValidationError'](_0xbae4('0x36')+_0x1e171e);}if(!_[_0xbae4('0x37')](_0x1e171e,_0x1ffab6[_0xbae4('0x30')][_0xbae4('0x35')])){throw new db[(_0xbae4('0x27'))][(_0xbae4('0x28'))](_0xbae4('0x38')+_0x1e171e);}_0x405fd7[_0x1ffab6['body']['mapKey']]=_0x1ffab6[_0xbae4('0x30')]['from'];})[_0xbae4('0xf')](function(){return db[_0xbae4('0x19')][_0xbae4('0x39')]({'where':{'id':_0x1ffab6['account']['id']},'include':[{'model':db[_0xbae4('0x3a')],'as':_0xbae4('0x3b'),'include':[{'model':db['CmContact'],'as':_0xbae4('0x3c'),'where':_0x405fd7,'limit':0x1,'order':[['updatedAt',_0xbae4('0x3d')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0xbae4('0xf')](function(_0xdef5d1){if(_0xdef5d1&&_0xdef5d1[_0xbae4('0x3b')]){var _0x44cc09=_0xdef5d1[_0xbae4('0x3e')]({'plain':!![]});_0x236734['account']=_0x44cc09;_0x236734[_0xbae4('0x3f')]=_0x44cc09[_0xbae4('0x40')];_0x236734[_0xbae4('0x41')]=_0x44cc09[_0xbae4('0x3b')];_0x236734['applications']=_[_0xbae4('0x42')](_0x236734[_0xbae4('0x3f')],[_0xbae4('0x43')],['asc']);if(_0x236734[_0xbae4('0x44')][_0xbae4('0x40')]){delete _0x236734[_0xbae4('0x44')]['Applications'];}if(_0x236734['account']['List']&&_0x236734[_0xbae4('0x44')][_0xbae4('0x3b')][_0xbae4('0x3c')][_0xbae4('0x45')]){return _0x236734['account'][_0xbae4('0x3b')][_0xbae4('0x3c')][0x0];}var _0xb625bd=_[_0xbae4('0xa')](_0x1ffab6[_0xbae4('0x30')],{'firstName':_0x1ffab6[_0xbae4('0x30')][_0xbae4('0x32')],'ListId':_0x44cc09['ListId']});_0xb625bd[_0x1ffab6[_0xbae4('0x30')]['mapKey']]=_0x1ffab6[_0xbae4('0x30')]['from'];return db[_0xbae4('0x25')][_0xbae4('0x46')](_0xb625bd,{'fields':_0x282ba5,'raw':!![]});}})['then'](function(_0x47dea0){_0x236734[_0xbae4('0x47')]=_0x47dea0;if(_0x47dea0){var _0x2d59fb={'ContactId':_0x47dea0['id'],'FaxAccountId':_0x1ffab6[_0xbae4('0x44')]['id'],'fax':_0x47dea0['fax']};return db[_0xbae4('0x48')][_0xbae4('0x39')]({'where':{'ContactId':_0x47dea0['id'],'closed':![],'FaxAccountId':_0x1ffab6['account']['id']}})[_0xbae4('0xf')](function(_0x4350d3){if(_0x4350d3){return[_0x4350d3,![]];}return db[_0xbae4('0x48')][_0xbae4('0x46')](_0x2d59fb)[_0xbae4('0xf')](function(_0x52ca43){return[_0x52ca43,!![]];});});}else{throw new Error(_0xbae4('0x49'));}})[_0xbae4('0x4a')](function(_0x4b6cbc,_0x5c8fed){var _0x5c8133=_0x4b6cbc['get']({'plain':!![]});if(_0x5c8fed){if(_0x236734['account']['autoclose']){_0x236734[_0xbae4('0x3f')][_0xbae4('0x4b')]({'id':0x0,'priority':_0x236734[_0xbae4('0x3f')][_0xbae4('0x45')]+0x1,'app':'close','appdata':_0xbae4('0x4c'),'interval':'*,*,*,*'});}_0x5c8133[_0xbae4('0x4d')]=!![];}else{_0x5c8133[_0xbae4('0x4d')]=![];}_0x236734['interaction']=_0x5c8133;return db['FaxMessage']['create']({'body':_0x1ffab6[_0xbae4('0x30')][_0xbae4('0x30')],'FaxAccountId':_0x1ffab6[_0xbae4('0x44')]['id'],'FaxInteractionId':_0x4b6cbc['id'],'direction':'in','ContactId':_0x4b6cbc[_0xbae4('0x4e')],'AttachmentId':_0x1ffab6[_0xbae4('0x30')][_0xbae4('0x4f')]});})[_0xbae4('0xf')](function(_0x30f0fe){_0x236734[_0xbae4('0x16')]=_0x30f0fe;if(_0x236734[_0xbae4('0x50')][_0xbae4('0x51')]){return db[_0xbae4('0x52')][_0xbae4('0x39')]({'attributes':['id',_0xbae4('0x53')],'where':{'id':_0x236734[_0xbae4('0x50')][_0xbae4('0x51')]}})[_0xbae4('0xf')](function(_0x221a74){if(_0x221a74){_0x236734[_0xbae4('0x3f')][_0xbae4('0x54')]({'id':0x0,'priority':0x0,'app':_0xbae4('0x55'),'appdata':_0x221a74['name']+','+(_0x236734[_0xbae4('0x44')][_0xbae4('0x56')]||0xa),'interval':_0xbae4('0x57')});}return respondWithRpcPromise(_0xbae4('0x58'),'startRouting',_0x236734);});}return respondWithRpcPromise(_0xbae4('0x58'),'startRouting',_0x236734);})['then'](function(_0x149ccb){_0x2bc656(_0x149ccb);})[_0xbae4('0x59')](function(_0x12609c){_0x3237b5(_0x273f8e[_0xbae4('0x15')](0x1f4,_0x12609c[_0xbae4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 269331e..131c299 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 _0x68a3=['save','update','removeListener','length','faxAccount:','./faxAccount.events'];(function(_0x453e58,_0x51523e){var _0x4be39c=function(_0x3f35fd){while(--_0x3f35fd){_0x453e58['push'](_0x453e58['shift']());}};_0x4be39c(++_0x51523e);}(_0x68a3,0x1a3));var _0x368a=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0x68a3[_0x8a7e38];return _0x228609;};'use strict';var FaxAccountEvents=require(_0x368a('0x0'));var events=[_0x368a('0x1'),'remove',_0x368a('0x2')];function createListener(_0x14ebed,_0x411df7){return function(_0x516768){_0x411df7['emit'](_0x14ebed,_0x516768);};}function removeListener(_0x287de7,_0x5557a2){return function(){FaxAccountEvents[_0x368a('0x3')](_0x287de7,_0x5557a2);};}exports['register']=function(_0x1fbf1c){for(var _0x349950=0x0,_0x178d98=events[_0x368a('0x4')];_0x349950<_0x178d98;_0x349950++){var _0x47ba0b=events[_0x349950];var _0x25abbc=createListener(_0x368a('0x5')+_0x47ba0b,_0x1fbf1c);FaxAccountEvents['on'](_0x47ba0b,_0x25abbc);}}; \ No newline at end of file +var _0x7efe=['faxAccount:','./faxAccount.events','save','update','emit','register','length'];(function(_0x141fc2,_0x2142d3){var _0x5b275b=function(_0xdc85c5){while(--_0xdc85c5){_0x141fc2['push'](_0x141fc2['shift']());}};_0x5b275b(++_0x2142d3);}(_0x7efe,0x1eb));var _0xe7ef=function(_0x1ea72b,_0x1959a2){_0x1ea72b=_0x1ea72b-0x0;var _0x4deecb=_0x7efe[_0x1ea72b];return _0x4deecb;};'use strict';var FaxAccountEvents=require(_0xe7ef('0x0'));var events=[_0xe7ef('0x1'),'remove',_0xe7ef('0x2')];function createListener(_0x29946a,_0x24c9f6){return function(_0x5017da){_0x24c9f6[_0xe7ef('0x3')](_0x29946a,_0x5017da);};}function removeListener(_0x56d482,_0x1d081d){return function(){FaxAccountEvents['removeListener'](_0x56d482,_0x1d081d);};}exports[_0xe7ef('0x4')]=function(_0x4c533d){for(var _0x420efd=0x0,_0xc9ddcc=events[_0xe7ef('0x5')];_0x420efd<_0xc9ddcc;_0x420efd++){var _0x3de71e=events[_0x420efd];var _0x4362a1=createListener(_0xe7ef('0x6')+_0x3de71e,_0x4c533d);FaxAccountEvents['on'](_0x3de71e,_0x4362a1);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index e045154..1e580b2 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x36e88b,_0x1aff1b){var _0x5df45c=function(_0x555b78){while(--_0x555b78){_0x36e88b['push'](_0x36e88b['shift']());}};_0x5df45c(++_0x1aff1b);}(_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/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x385e3a,_0x2a7f5f){var _0x1e07fd=function(_0x2268be){while(--_0x2268be){_0x385e3a['push'](_0x385e3a['shift']());}};_0x1e07fd(++_0x2a7f5f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index dfb5aa2..1e7bc72 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 _0x67fb=['STRING','*,*,*,*','exports','INTEGER','noop','TEXT'];(function(_0x12ee1d,_0x51bca3){var _0x1b614e=function(_0x39d6a2){while(--_0x39d6a2){_0x12ee1d['push'](_0x12ee1d['shift']());}};_0x1b614e(++_0x51bca3);}(_0x67fb,0x92));var _0xb67f=function(_0x2b77f4,_0x57de3b){_0x2b77f4=_0x2b77f4-0x0;var _0x1f13bf=_0x67fb[_0x2b77f4];return _0x1f13bf;};'use strict';var Sequelize=require('sequelize');module[_0xb67f('0x0')]={'priority':{'type':Sequelize[_0xb67f('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb67f('0x2')},'appdata':{'type':Sequelize[_0xb67f('0x3')]()},'description':{'type':Sequelize[_0xb67f('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb67f('0x5')}}; \ No newline at end of file +var _0x97c1=['sequelize','noop','STRING','*,*,*,*'];(function(_0x4924cb,_0x4b24f8){var _0x1bc1c8=function(_0x41e91e){while(--_0x41e91e){_0x4924cb['push'](_0x4924cb['shift']());}};_0x1bc1c8(++_0x4b24f8);}(_0x97c1,0xa4));var _0x197c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x97c1[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x197c('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x197c('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x197c('0x2')]},'interval':{'type':Sequelize[_0x197c('0x2')],'defaultValue':_0x197c('0x3')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 978540a..cd11cf7 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 _0xd9a3=['moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','reject','update','then','error','stack','name','send','map','FaxApplication','fieldName','type','key','model','query','intersection','fields','attributes','length','sort','where','filters','filter','VIRTUAL','options','findAll','rows','show','params','keys','rawAttributes','includeAll','include','merge','find','catch','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x383cab,_0x5ea01f){var _0x131761=function(_0x400dfc){while(--_0x400dfc){_0x383cab['push'](_0x383cab['shift']());}};_0x131761(++_0x5ea01f);}(_0xd9a3,0x118));var _0x3d9a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd9a3[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x3d9a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3d9a('0x1'));var jsonpatch=require(_0x3d9a('0x2'));var rp=require(_0x3d9a('0x3'));var moment=require(_0x3d9a('0x4'));var BPromise=require(_0x3d9a('0x5'));var Mustache=require('mustache');var util=require(_0x3d9a('0x6'));var path=require(_0x3d9a('0x7'));var sox=require(_0x3d9a('0x8'));var csv=require('to-csv');var ejs=require(_0x3d9a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d9a('0xa'));var squel=require(_0x3d9a('0xb'));var crypto=require(_0x3d9a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3d9a('0xd'));var toCsv=require(_0x3d9a('0xe'));var querystring=require('querystring');var Papa=require(_0x3d9a('0xf'));var Redis=require(_0x3d9a('0x10'));var authService=require(_0x3d9a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d9a('0x12'));var logger=require(_0x3d9a('0x13'))(_0x3d9a('0x14'));var utils=require('../../config/utils');var config=require(_0x3d9a('0x15'));var licenseUtil=require(_0x3d9a('0x16'));var db=require(_0x3d9a('0x17'))['db'];function respondWithStatusCode(_0x10c84d,_0x5d26c0){_0x5d26c0=_0x5d26c0||0xcc;return function(_0x36ce8b){if(_0x36ce8b){return _0x10c84d[_0x3d9a('0x18')](_0x5d26c0);}return _0x10c84d[_0x3d9a('0x19')](_0x5d26c0)['end']();};}function respondWithResult(_0xe65e05,_0x127a61){_0x127a61=_0x127a61||0xc8;return function(_0x45a2ee){if(_0x45a2ee){return _0xe65e05[_0x3d9a('0x19')](_0x127a61)[_0x3d9a('0x1a')](_0x45a2ee);}};}function respondWithFilteredResult(_0x2e4283,_0x20433a){return function(_0x2fc73d){if(_0x2fc73d){var _0x223b9c=typeof _0x20433a['offset']==='undefined'&&typeof _0x20433a[_0x3d9a('0x1b')]===_0x3d9a('0x1c');var _0x3a5cdd=_0x2fc73d[_0x3d9a('0x1d')];var _0x57c579=_0x223b9c?0x0:_0x20433a[_0x3d9a('0x1e')];var _0x11fe25=_0x223b9c?_0x2fc73d[_0x3d9a('0x1d')]:_0x20433a[_0x3d9a('0x1e')]+_0x20433a['limit'];var _0x393db5;if(_0x11fe25>=_0x3a5cdd){_0x11fe25=_0x3a5cdd;_0x393db5=0xc8;}else{_0x393db5=0xce;}_0x2e4283[_0x3d9a('0x19')](_0x393db5);return _0x2e4283['set'](_0x3d9a('0x1f'),_0x57c579+'-'+_0x11fe25+'/'+_0x3a5cdd)[_0x3d9a('0x1a')](_0x2fc73d);}return null;};}function patchUpdates(_0x7c559){return function(_0x512e1b){try{jsonpatch[_0x3d9a('0x20')](_0x512e1b,_0x7c559,!![]);}catch(_0x20473d){return BPromise[_0x3d9a('0x21')](_0x20473d);}return _0x512e1b['save']();};}function saveUpdates(_0x37348f,_0xb0ce27){return function(_0x3d6f82){if(_0x3d6f82){return _0x3d6f82[_0x3d9a('0x22')](_0x37348f)['then'](function(_0x57e017){return _0x57e017;});}return null;};}function removeEntity(_0x558adb,_0x1d6ad4){return function(_0x1532d8){if(_0x1532d8){return _0x1532d8['destroy']()[_0x3d9a('0x23')](function(){_0x558adb[_0x3d9a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ac65f,_0x3ae459){return function(_0x272290){if(!_0x272290){_0x2ac65f[_0x3d9a('0x18')](0x194);}return _0x272290;};}function handleError(_0x3151f4,_0x2080fb){_0x2080fb=_0x2080fb||0x1f4;return function(_0x45c183){logger[_0x3d9a('0x24')](_0x45c183[_0x3d9a('0x25')]);if(_0x45c183['name']){delete _0x45c183[_0x3d9a('0x26')];}_0x3151f4[_0x3d9a('0x19')](_0x2080fb)[_0x3d9a('0x27')](_0x45c183);};}exports['index']=function(_0x16ffe6,_0x30e487){var _0x16db7b={},_0x2da2b3={},_0x4a5fbd={'count':0x0,'rows':[]};var _0x49fa27=_[_0x3d9a('0x28')](db[_0x3d9a('0x29')]['rawAttributes'],function(_0x524f87){return{'name':_0x524f87[_0x3d9a('0x2a')],'type':_0x524f87[_0x3d9a('0x2b')][_0x3d9a('0x2c')]};});_0x2da2b3[_0x3d9a('0x2d')]=_[_0x3d9a('0x28')](_0x49fa27,_0x3d9a('0x26'));_0x2da2b3[_0x3d9a('0x2e')]=_['keys'](_0x16ffe6['query']);_0x2da2b3['filters']=_['intersection'](_0x2da2b3[_0x3d9a('0x2d')],_0x2da2b3[_0x3d9a('0x2e')]);_0x16db7b['attributes']=_[_0x3d9a('0x2f')](_0x2da2b3['model'],qs[_0x3d9a('0x30')](_0x16ffe6[_0x3d9a('0x2e')]['fields']));_0x16db7b[_0x3d9a('0x31')]=_0x16db7b['attributes'][_0x3d9a('0x32')]?_0x16db7b['attributes']:_0x2da2b3['model'];if(!_0x16ffe6[_0x3d9a('0x2e')]['hasOwnProperty']('nolimit')){_0x16db7b['limit']=qs[_0x3d9a('0x1b')](_0x16ffe6[_0x3d9a('0x2e')]['limit']);_0x16db7b[_0x3d9a('0x1e')]=qs[_0x3d9a('0x1e')](_0x16ffe6[_0x3d9a('0x2e')][_0x3d9a('0x1e')]);}_0x16db7b['order']=qs['sort'](_0x16ffe6['query'][_0x3d9a('0x33')]);_0x16db7b[_0x3d9a('0x34')]=qs['filters'](_['pick'](_0x16ffe6[_0x3d9a('0x2e')],_0x2da2b3[_0x3d9a('0x35')]),_0x49fa27);if(_0x16ffe6['query'][_0x3d9a('0x36')]){_0x16db7b[_0x3d9a('0x34')]=_['merge'](_0x16db7b[_0x3d9a('0x34')],{'$or':_[_0x3d9a('0x28')](_0x49fa27,function(_0x57de71){if(_0x57de71[_0x3d9a('0x2b')]!==_0x3d9a('0x37')){var _0x39ea68={};_0x39ea68[_0x57de71['name']]={'$like':'%'+_0x16ffe6[_0x3d9a('0x2e')][_0x3d9a('0x36')]+'%'};return _0x39ea68;}})});}_0x16db7b=_['merge']({},_0x16db7b,_0x16ffe6[_0x3d9a('0x38')]);var _0x4e3506={'where':_0x16db7b[_0x3d9a('0x34')]};return db['FaxApplication'][_0x3d9a('0x1d')](_0x4e3506)['then'](function(_0x559995){_0x4a5fbd['count']=_0x559995;if(_0x16ffe6[_0x3d9a('0x2e')]['includeAll']){_0x16db7b['include']=[{'all':!![]}];}return db[_0x3d9a('0x29')][_0x3d9a('0x39')](_0x16db7b);})[_0x3d9a('0x23')](function(_0x2ae7a7){_0x4a5fbd[_0x3d9a('0x3a')]=_0x2ae7a7;return _0x4a5fbd;})[_0x3d9a('0x23')](respondWithFilteredResult(_0x30e487,_0x16db7b))['catch'](handleError(_0x30e487,null));};exports[_0x3d9a('0x3b')]=function(_0x53c0c0,_0x1a830a){var _0x1a58ad={'raw':!![],'where':{'id':_0x53c0c0[_0x3d9a('0x3c')]['id']}},_0x23ed63={};_0x23ed63[_0x3d9a('0x2d')]=_[_0x3d9a('0x3d')](db['FaxApplication'][_0x3d9a('0x3e')]);_0x23ed63[_0x3d9a('0x2e')]=_[_0x3d9a('0x3d')](_0x53c0c0[_0x3d9a('0x2e')]);_0x23ed63['filters']=_[_0x3d9a('0x2f')](_0x23ed63[_0x3d9a('0x2d')],_0x23ed63[_0x3d9a('0x2e')]);_0x1a58ad['attributes']=_['intersection'](_0x23ed63[_0x3d9a('0x2d')],qs[_0x3d9a('0x30')](_0x53c0c0[_0x3d9a('0x2e')][_0x3d9a('0x30')]));_0x1a58ad[_0x3d9a('0x31')]=_0x1a58ad[_0x3d9a('0x31')]['length']?_0x1a58ad[_0x3d9a('0x31')]:_0x23ed63[_0x3d9a('0x2d')];if(_0x53c0c0[_0x3d9a('0x2e')][_0x3d9a('0x3f')]){_0x1a58ad[_0x3d9a('0x40')]=[{'all':!![]}];}_0x1a58ad=_[_0x3d9a('0x41')]({},_0x1a58ad,_0x53c0c0[_0x3d9a('0x38')]);return db['FaxApplication'][_0x3d9a('0x42')](_0x1a58ad)[_0x3d9a('0x23')](handleEntityNotFound(_0x1a830a,null))[_0x3d9a('0x23')](respondWithResult(_0x1a830a,null))[_0x3d9a('0x43')](handleError(_0x1a830a,null));};exports[_0x3d9a('0x44')]=function(_0xaeb897,_0x4b55d0){return db[_0x3d9a('0x29')][_0x3d9a('0x44')](_0xaeb897['body'],{})[_0x3d9a('0x23')](respondWithResult(_0x4b55d0,0xc9))[_0x3d9a('0x43')](handleError(_0x4b55d0,null));};exports[_0x3d9a('0x22')]=function(_0x2a637e,_0x5cbbbb){if(_0x2a637e[_0x3d9a('0x45')]['id']){delete _0x2a637e[_0x3d9a('0x45')]['id'];}return db['FaxApplication'][_0x3d9a('0x42')]({'where':{'id':_0x2a637e[_0x3d9a('0x3c')]['id']}})[_0x3d9a('0x23')](handleEntityNotFound(_0x5cbbbb,null))[_0x3d9a('0x23')](saveUpdates(_0x2a637e[_0x3d9a('0x45')],null))['then'](respondWithResult(_0x5cbbbb,null))[_0x3d9a('0x43')](handleError(_0x5cbbbb,null));};exports[_0x3d9a('0x46')]=function(_0x8705e0,_0x11016e){return db[_0x3d9a('0x29')][_0x3d9a('0x42')]({'where':{'id':_0x8705e0[_0x3d9a('0x3c')]['id']}})[_0x3d9a('0x23')](handleEntityNotFound(_0x11016e,null))[_0x3d9a('0x23')](removeEntity(_0x11016e,null))[_0x3d9a('0x43')](handleError(_0x11016e,null));}; \ No newline at end of file +var _0x0120=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','send','index','map','FaxApplication','fieldName','key','name','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','fast-json-patch','moment'];(function(_0x31bd97,_0x4eb9fb){var _0x53975f=function(_0x27e378){while(--_0x27e378){_0x31bd97['push'](_0x31bd97['shift']());}};_0x53975f(++_0x4eb9fb);}(_0x0120,0x96));var _0x0012=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x0120[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0012('0x0'));var rp=require('request-promise');var moment=require(_0x0012('0x1'));var BPromise=require(_0x0012('0x2'));var Mustache=require(_0x0012('0x3'));var util=require(_0x0012('0x4'));var path=require(_0x0012('0x5'));var sox=require(_0x0012('0x6'));var csv=require(_0x0012('0x7'));var ejs=require(_0x0012('0x8'));var fs=require('fs');var fs_extra=require(_0x0012('0x9'));var _=require(_0x0012('0xa'));var squel=require(_0x0012('0xb'));var crypto=require('crypto');var jsforce=require(_0x0012('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0012('0x7'));var querystring=require(_0x0012('0xd'));var Papa=require(_0x0012('0xe'));var Redis=require(_0x0012('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0012('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0012('0x11'));var logger=require(_0x0012('0x12'))(_0x0012('0x13'));var utils=require(_0x0012('0x14'));var config=require(_0x0012('0x15'));var licenseUtil=require(_0x0012('0x16'));var db=require(_0x0012('0x17'))['db'];function respondWithStatusCode(_0x9ce2e4,_0x2cbe91){_0x2cbe91=_0x2cbe91||0xcc;return function(_0xfa2f1c){if(_0xfa2f1c){return _0x9ce2e4['sendStatus'](_0x2cbe91);}return _0x9ce2e4[_0x0012('0x18')](_0x2cbe91)[_0x0012('0x19')]();};}function respondWithResult(_0x5ce79f,_0x49a965){_0x49a965=_0x49a965||0xc8;return function(_0x1e214){if(_0x1e214){return _0x5ce79f[_0x0012('0x18')](_0x49a965)[_0x0012('0x1a')](_0x1e214);}};}function respondWithFilteredResult(_0x10bf9a,_0x41817f){return function(_0x3c490e){if(_0x3c490e){var _0x2a3807=typeof _0x41817f[_0x0012('0x1b')]===_0x0012('0x1c')&&typeof _0x41817f[_0x0012('0x1d')]===_0x0012('0x1c');var _0x565408=_0x3c490e[_0x0012('0x1e')];var _0x3b4395=_0x2a3807?0x0:_0x41817f['offset'];var _0x162c78=_0x2a3807?_0x3c490e[_0x0012('0x1e')]:_0x41817f[_0x0012('0x1b')]+_0x41817f['limit'];var _0x35a3f4;if(_0x162c78>=_0x565408){_0x162c78=_0x565408;_0x35a3f4=0xc8;}else{_0x35a3f4=0xce;}_0x10bf9a['status'](_0x35a3f4);return _0x10bf9a[_0x0012('0x1f')](_0x0012('0x20'),_0x3b4395+'-'+_0x162c78+'/'+_0x565408)[_0x0012('0x1a')](_0x3c490e);}return null;};}function patchUpdates(_0xfc48b4){return function(_0x1705df){try{jsonpatch['apply'](_0x1705df,_0xfc48b4,!![]);}catch(_0xd6d13e){return BPromise[_0x0012('0x21')](_0xd6d13e);}return _0x1705df[_0x0012('0x22')]();};}function saveUpdates(_0x28c262,_0x290320){return function(_0x2ecff4){if(_0x2ecff4){return _0x2ecff4[_0x0012('0x23')](_0x28c262)[_0x0012('0x24')](function(_0x48aa1e){return _0x48aa1e;});}return null;};}function removeEntity(_0x5dfc37,_0x7b83ba){return function(_0x285a18){if(_0x285a18){return _0x285a18[_0x0012('0x25')]()[_0x0012('0x24')](function(){_0x5dfc37['status'](0xcc)[_0x0012('0x19')]();});}};}function handleEntityNotFound(_0x2dc389,_0x678de){return function(_0x4cac94){if(!_0x4cac94){_0x2dc389['sendStatus'](0x194);}return _0x4cac94;};}function handleError(_0x4c1ccb,_0x45ce44){_0x45ce44=_0x45ce44||0x1f4;return function(_0x3bcd9c){logger[_0x0012('0x26')](_0x3bcd9c[_0x0012('0x27')]);if(_0x3bcd9c['name']){delete _0x3bcd9c['name'];}_0x4c1ccb['status'](_0x45ce44)[_0x0012('0x28')](_0x3bcd9c);};}exports[_0x0012('0x29')]=function(_0xfc0b1f,_0x5947bd){var _0xa6aa56={},_0x261180={},_0x45a097={'count':0x0,'rows':[]};var _0x320aab=_[_0x0012('0x2a')](db[_0x0012('0x2b')]['rawAttributes'],function(_0x54addc){return{'name':_0x54addc[_0x0012('0x2c')],'type':_0x54addc['type'][_0x0012('0x2d')]};});_0x261180['model']=_[_0x0012('0x2a')](_0x320aab,_0x0012('0x2e'));_0x261180['query']=_[_0x0012('0x2f')](_0xfc0b1f['query']);_0x261180[_0x0012('0x30')]=_['intersection'](_0x261180[_0x0012('0x31')],_0x261180[_0x0012('0x32')]);_0xa6aa56[_0x0012('0x33')]=_[_0x0012('0x34')](_0x261180['model'],qs[_0x0012('0x35')](_0xfc0b1f[_0x0012('0x32')][_0x0012('0x35')]));_0xa6aa56[_0x0012('0x33')]=_0xa6aa56[_0x0012('0x33')][_0x0012('0x36')]?_0xa6aa56['attributes']:_0x261180[_0x0012('0x31')];if(!_0xfc0b1f[_0x0012('0x32')][_0x0012('0x37')](_0x0012('0x38'))){_0xa6aa56[_0x0012('0x1d')]=qs['limit'](_0xfc0b1f['query'][_0x0012('0x1d')]);_0xa6aa56[_0x0012('0x1b')]=qs[_0x0012('0x1b')](_0xfc0b1f[_0x0012('0x32')]['offset']);}_0xa6aa56['order']=qs[_0x0012('0x39')](_0xfc0b1f[_0x0012('0x32')][_0x0012('0x39')]);_0xa6aa56[_0x0012('0x3a')]=qs['filters'](_[_0x0012('0x3b')](_0xfc0b1f[_0x0012('0x32')],_0x261180[_0x0012('0x30')]),_0x320aab);if(_0xfc0b1f[_0x0012('0x32')][_0x0012('0x3c')]){_0xa6aa56[_0x0012('0x3a')]=_[_0x0012('0x3d')](_0xa6aa56[_0x0012('0x3a')],{'$or':_['map'](_0x320aab,function(_0x5c756a){if(_0x5c756a[_0x0012('0x3e')]!==_0x0012('0x3f')){var _0x58d2bf={};_0x58d2bf[_0x5c756a[_0x0012('0x2e')]]={'$like':'%'+_0xfc0b1f[_0x0012('0x32')]['filter']+'%'};return _0x58d2bf;}})});}_0xa6aa56=_[_0x0012('0x3d')]({},_0xa6aa56,_0xfc0b1f[_0x0012('0x40')]);var _0x3f7e6f={'where':_0xa6aa56['where']};return db['FaxApplication'][_0x0012('0x1e')](_0x3f7e6f)[_0x0012('0x24')](function(_0x5d0206){_0x45a097[_0x0012('0x1e')]=_0x5d0206;if(_0xfc0b1f[_0x0012('0x32')][_0x0012('0x41')]){_0xa6aa56[_0x0012('0x42')]=[{'all':!![]}];}return db[_0x0012('0x2b')][_0x0012('0x43')](_0xa6aa56);})['then'](function(_0xa72234){_0x45a097[_0x0012('0x44')]=_0xa72234;return _0x45a097;})[_0x0012('0x24')](respondWithFilteredResult(_0x5947bd,_0xa6aa56))[_0x0012('0x45')](handleError(_0x5947bd,null));};exports[_0x0012('0x46')]=function(_0x55e504,_0x2d26a6){var _0x48d37c={'raw':!![],'where':{'id':_0x55e504[_0x0012('0x47')]['id']}},_0x3e2561={};_0x3e2561[_0x0012('0x31')]=_[_0x0012('0x2f')](db['FaxApplication'][_0x0012('0x48')]);_0x3e2561['query']=_[_0x0012('0x2f')](_0x55e504[_0x0012('0x32')]);_0x3e2561['filters']=_[_0x0012('0x34')](_0x3e2561[_0x0012('0x31')],_0x3e2561[_0x0012('0x32')]);_0x48d37c[_0x0012('0x33')]=_[_0x0012('0x34')](_0x3e2561[_0x0012('0x31')],qs[_0x0012('0x35')](_0x55e504[_0x0012('0x32')][_0x0012('0x35')]));_0x48d37c['attributes']=_0x48d37c['attributes'][_0x0012('0x36')]?_0x48d37c['attributes']:_0x3e2561['model'];if(_0x55e504[_0x0012('0x32')][_0x0012('0x41')]){_0x48d37c[_0x0012('0x42')]=[{'all':!![]}];}_0x48d37c=_[_0x0012('0x3d')]({},_0x48d37c,_0x55e504[_0x0012('0x40')]);return db[_0x0012('0x2b')][_0x0012('0x49')](_0x48d37c)['then'](handleEntityNotFound(_0x2d26a6,null))[_0x0012('0x24')](respondWithResult(_0x2d26a6,null))[_0x0012('0x45')](handleError(_0x2d26a6,null));};exports['create']=function(_0x33c963,_0x3313e9){return db['FaxApplication'][_0x0012('0x4a')](_0x33c963[_0x0012('0x4b')],{})[_0x0012('0x24')](respondWithResult(_0x3313e9,0xc9))[_0x0012('0x45')](handleError(_0x3313e9,null));};exports['update']=function(_0x15cd9d,_0x2b505a){if(_0x15cd9d[_0x0012('0x4b')]['id']){delete _0x15cd9d[_0x0012('0x4b')]['id'];}return db[_0x0012('0x2b')][_0x0012('0x49')]({'where':{'id':_0x15cd9d[_0x0012('0x47')]['id']}})[_0x0012('0x24')](handleEntityNotFound(_0x2b505a,null))[_0x0012('0x24')](saveUpdates(_0x15cd9d[_0x0012('0x4b')],null))['then'](respondWithResult(_0x2b505a,null))['catch'](handleError(_0x2b505a,null));};exports[_0x0012('0x25')]=function(_0x583012,_0xc140d1){return db[_0x0012('0x2b')][_0x0012('0x49')]({'where':{'id':_0x583012[_0x0012('0x47')]['id']}})['then'](handleEntityNotFound(_0xc140d1,null))[_0x0012('0x24')](removeEntity(_0xc140d1,null))['catch'](handleError(_0xc140d1,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 93f3858..7fc6177 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 _0x6035=['define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./faxApplication.attributes','exports'];(function(_0x4b0416,_0x5076aa){var _0x2d3665=function(_0x1cfb1c){while(--_0x1cfb1c){_0x4b0416['push'](_0x4b0416['shift']());}};_0x2d3665(++_0x5076aa);}(_0x6035,0x154));var _0x5603=function(_0x1b0a18,_0x56afcd){_0x1b0a18=_0x1b0a18-0x0;var _0x25df46=_0x6035[_0x1b0a18];return _0x25df46;};'use strict';var _=require(_0x5603('0x0'));var util=require(_0x5603('0x1'));var logger=require(_0x5603('0x2'))(_0x5603('0x3'));var moment=require(_0x5603('0x4'));var BPromise=require(_0x5603('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5603('0x6'));var rimraf=require(_0x5603('0x7'));var config=require('../../config/environment');var attributes=require(_0x5603('0x8'));module[_0x5603('0x9')]=function(_0x2c51e4,_0x482b2e){return _0x2c51e4[_0x5603('0xa')]('FaxApplication',attributes,{'tableName':_0x5603('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5603('0xc'),'collate':_0x5603('0xd')});}; \ No newline at end of file +var _0x8a9f=['exports','define','FaxApplication','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes'];(function(_0x4ffb74,_0xf3421e){var _0x1fee55=function(_0x535607){while(--_0x535607){_0x4ffb74['push'](_0x4ffb74['shift']());}};_0x1fee55(++_0xf3421e);}(_0x8a9f,0x1d7));var _0xf8a9=function(_0x4b89d9,_0x3a4a59){_0x4b89d9=_0x4b89d9-0x0;var _0x5648ac=_0x8a9f[_0x4b89d9];return _0x5648ac;};'use strict';var _=require(_0xf8a9('0x0'));var util=require(_0xf8a9('0x1'));var logger=require(_0xf8a9('0x2'))('api');var moment=require(_0xf8a9('0x3'));var BPromise=require(_0xf8a9('0x4'));var rp=require(_0xf8a9('0x5'));var fs=require('fs');var path=require(_0xf8a9('0x6'));var rimraf=require(_0xf8a9('0x7'));var config=require(_0xf8a9('0x8'));var attributes=require(_0xf8a9('0x9'));module[_0xf8a9('0xa')]=function(_0x366053,_0x49dd48){return _0x366053[_0xf8a9('0xb')](_0xf8a9('0xc'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 50c58a4..19d77aa 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 _0xbc44=['attributes','limit','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','where'];(function(_0x1c4d3c,_0x505e21){var _0x4aa45f=function(_0x3eec1a){while(--_0x3eec1a){_0x1c4d3c['push'](_0x1c4d3c['shift']());}};_0x4aa45f(++_0x505e21);}(_0xbc44,0xff));var _0x4bc4=function(_0x412f7e,_0x5a5fb7){_0x412f7e=_0x412f7e-0x0;var _0x92803e=_0xbc44[_0x412f7e];return _0x92803e;};'use strict';var _=require('lodash');var util=require(_0x4bc4('0x0'));var moment=require(_0x4bc4('0x1'));var BPromise=require('bluebird');var rs=require(_0x4bc4('0x2'));var fs=require('fs');var Redis=require(_0x4bc4('0x3'));var db=require(_0x4bc4('0x4'))['db'];var utils=require(_0x4bc4('0x5'));var logger=require(_0x4bc4('0x6'))(_0x4bc4('0x7'));var config=require(_0x4bc4('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4bc4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a5a04,_0x248416,_0x201adf){return new BPromise(function(_0x15b6fe,_0x4b4335){return client[_0x4bc4('0xa')](_0x4a5a04,_0x201adf)['then'](function(_0x4324d7){logger[_0x4bc4('0xb')](_0x4bc4('0xc'),_0x248416,_0x4bc4('0xd'));logger[_0x4bc4('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x248416,_0x4bc4('0xd'),JSON['stringify'](_0x4324d7));if(_0x4324d7[_0x4bc4('0xf')]){if(_0x4324d7[_0x4bc4('0xf')][_0x4bc4('0x10')]===0x1f4){logger[_0x4bc4('0xf')]('FaxApplication,\x20%s,\x20%s',_0x248416,_0x4324d7[_0x4bc4('0xf')][_0x4bc4('0x11')]);return _0x4b4335(_0x4324d7[_0x4bc4('0xf')][_0x4bc4('0x11')]);}logger['error'](_0x4bc4('0xc'),_0x248416,_0x4324d7[_0x4bc4('0xf')][_0x4bc4('0x11')]);return _0x15b6fe(_0x4324d7[_0x4bc4('0xf')][_0x4bc4('0x11')]);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x248416,'request\x20sent');_0x15b6fe(_0x4324d7[_0x4bc4('0x12')][_0x4bc4('0x11')]);}})[_0x4bc4('0x13')](function(_0x8675f9){logger[_0x4bc4('0xf')](_0x4bc4('0xc'),_0x248416,_0x8675f9);_0x4b4335(_0x8675f9);});});}exports[_0x4bc4('0x14')]=function(_0x37d3ed){var _0x1033bf=this;return new Promise(function(_0xaa5d02,_0x1d2462){return db[_0x4bc4('0x15')]['update'](_0x37d3ed[_0x4bc4('0x16')],{'raw':_0x37d3ed['options']?_0x37d3ed['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37d3ed[_0x4bc4('0x17')]?_0x37d3ed[_0x4bc4('0x17')][_0x4bc4('0x18')]||null:null,'attributes':_0x37d3ed[_0x4bc4('0x17')]?_0x37d3ed[_0x4bc4('0x17')][_0x4bc4('0x19')]||null:null,'limit':_0x37d3ed['options']?_0x37d3ed[_0x4bc4('0x17')][_0x4bc4('0x1a')]||null:null})[_0x4bc4('0x1b')](function(_0x7915e3){logger['info']('UpdateFaxApplication',_0x37d3ed);logger[_0x4bc4('0xe')](_0x4bc4('0x14'),_0x37d3ed,JSON['stringify'](_0x7915e3));_0xaa5d02(_0x7915e3);})[_0x4bc4('0x13')](function(_0x1e144f){logger[_0x4bc4('0xf')]('UpdateFaxApplication',_0x1e144f['message'],_0x37d3ed);_0x1d2462(_0x1033bf[_0x4bc4('0xf')](0x1f4,_0x1e144f['message']));});});}; \ No newline at end of file +var _0xf71d=['FaxApplication','update','body','options','where','attributes','limit','UpdateFaxApplication','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch'];(function(_0x12ec3e,_0x396b4a){var _0x12cbbe=function(_0x249766){while(--_0x249766){_0x12ec3e['push'](_0x12ec3e['shift']());}};_0x12cbbe(++_0x396b4a);}(_0xf71d,0xda));var _0xdf71=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0xf71d[_0x313c96];return _0x522f53;};'use strict';var _=require(_0xdf71('0x0'));var util=require('util');var moment=require(_0xdf71('0x1'));var BPromise=require(_0xdf71('0x2'));var rs=require(_0xdf71('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf71('0x4'))['db'];var utils=require(_0xdf71('0x5'));var logger=require(_0xdf71('0x6'))(_0xdf71('0x7'));var config=require(_0xdf71('0x8'));var jayson=require(_0xdf71('0x9'));var client=jayson[_0xdf71('0xa')][_0xdf71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c0516,_0x2cdb41,_0x397036){return new BPromise(function(_0x486c8f,_0x153275){return client['request'](_0x3c0516,_0x397036)[_0xdf71('0xc')](function(_0x48066a){logger[_0xdf71('0xd')](_0xdf71('0xe'),_0x2cdb41,_0xdf71('0xf'));logger[_0xdf71('0x10')](_0xdf71('0x11'),_0x2cdb41,_0xdf71('0xf'),JSON['stringify'](_0x48066a));if(_0x48066a[_0xdf71('0x12')]){if(_0x48066a[_0xdf71('0x12')]['code']===0x1f4){logger[_0xdf71('0x12')](_0xdf71('0xe'),_0x2cdb41,_0x48066a[_0xdf71('0x12')]['message']);return _0x153275(_0x48066a['error'][_0xdf71('0x13')]);}logger[_0xdf71('0x12')]('FaxApplication,\x20%s,\x20%s',_0x2cdb41,_0x48066a['error']['message']);return _0x486c8f(_0x48066a['error']['message']);}else{logger[_0xdf71('0xd')]('FaxApplication,\x20%s,\x20%s',_0x2cdb41,'request\x20sent');_0x486c8f(_0x48066a[_0xdf71('0x14')][_0xdf71('0x13')]);}})[_0xdf71('0x15')](function(_0xa33d3d){logger['error'](_0xdf71('0xe'),_0x2cdb41,_0xa33d3d);_0x153275(_0xa33d3d);});});}exports['UpdateFaxApplication']=function(_0x5a6d12){var _0x1b8283=this;return new Promise(function(_0x2de060,_0x379f5c){return db[_0xdf71('0x16')][_0xdf71('0x17')](_0x5a6d12[_0xdf71('0x18')],{'raw':_0x5a6d12[_0xdf71('0x19')]?_0x5a6d12[_0xdf71('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a6d12[_0xdf71('0x19')]?_0x5a6d12[_0xdf71('0x19')][_0xdf71('0x1a')]||null:null,'attributes':_0x5a6d12[_0xdf71('0x19')]?_0x5a6d12[_0xdf71('0x19')][_0xdf71('0x1b')]||null:null,'limit':_0x5a6d12[_0xdf71('0x19')]?_0x5a6d12[_0xdf71('0x19')][_0xdf71('0x1c')]||null:null})['then'](function(_0x4a4ab9){logger[_0xdf71('0xd')](_0xdf71('0x1d'),_0x5a6d12);logger[_0xdf71('0x10')]('UpdateFaxApplication',_0x5a6d12,JSON['stringify'](_0x4a4ab9));_0x2de060(_0x4a4ab9);})['catch'](function(_0x2e6098){logger[_0xdf71('0x12')](_0xdf71('0x1d'),_0x2e6098['message'],_0x5a6d12);_0x379f5c(_0x1b8283[_0xdf71('0x12')](0x1f4,_0x2e6098[_0xdf71('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index f39b56c..3d38f52 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 _0x9c00=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x23d802,_0x4280d9){var _0x52b891=function(_0x3f78fd){while(--_0x3f78fd){_0x23d802['push'](_0x23d802['shift']());}};_0x52b891(++_0x4280d9);}(_0x9c00,0x1a0));var _0x09c0=function(_0x52dd39,_0xdb90a5){_0x52dd39=_0x52dd39-0x0;var _0x1d4076=_0x9c00[_0x52dd39];return _0x1d4076;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x4'));var interaction=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var controller=require(_0x09c0('0x7'));router[_0x09c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c0('0x8')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0xc')]('/',auth['isAuthenticated'](),controller[_0x09c0('0xd')]);router[_0x09c0('0xe')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xf')]);router[_0x09c0('0x10')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x11')]);module[_0x09c0('0x12')]=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x4076db,_0x3d795a){var _0x22b315=function(_0x3d587f){while(--_0x3d587f){_0x4076db['push'](_0x4076db['shift']());}};_0x22b315(++_0x3d795a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xb7e7[_0x2aec52];return _0x3b8835;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 2c61b64..1892b87 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 _0xe191=['sequelize','exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x3517dd,_0x46f306){var _0x37fa0a=function(_0xd2d064){while(--_0xd2d064){_0x3517dd['push'](_0x3517dd['shift']());}};_0x37fa0a(++_0x46f306);}(_0xe191,0x1f1));var _0x1e19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe191[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1e19('0x0'));module[_0x1e19('0x1')]={'closed':{'type':Sequelize[_0x1e19('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1e19('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1e19('0x3')]},'note':{'type':Sequelize[_0x1e19('0x3')]},'read1stAt':{'type':Sequelize[_0x1e19('0x4')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1e19('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x1e19('0x5')]('in',_0x1e19('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x1085=['DATE','sequelize','exports','BOOLEAN','STRING','ENUM','out'];(function(_0x327d9b,_0x50de30){var _0x4f8e83=function(_0x5b17c4){while(--_0x5b17c4){_0x327d9b['push'](_0x327d9b['shift']());}};_0x4f8e83(++_0x50de30);}(_0x1085,0x13c));var _0x5108=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1085[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5108('0x0'));module[_0x5108('0x1')]={'closed':{'type':Sequelize[_0x5108('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5108('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5108('0x3')]},'note':{'type':Sequelize[_0x5108('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x5108('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x5108('0x4')]('in',_0x5108('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5108('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x5108('0x4')]('in',_0x5108('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index a7b7c43..a616dde 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 _0xa7a6=['o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','groupBy','all','catch','show','params','rawAttributes','filters','includeAll','include','options','create','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','FaxInteractionId','merge','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','setTags','spread','emit','removeTags','download','unix','root','server','files','tmp','transcript-%d-%s.zip','Attachment','Messages','get','join','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','status','json','offset','limit','undefined','count','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','Users','TagIds','split','Tags','push','index','map','FaxInteraction','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','u.id','u.fullname','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','type','body','compact','isEmpty','FaxAccountId','where','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','role','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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','contactName','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax'];(function(_0x12edca,_0x4eaf21){var _0x57ce31=function(_0x544be5){while(--_0x544be5){_0x12edca['push'](_0x12edca['shift']());}};_0x57ce31(++_0x4eaf21);}(_0xa7a6,0x115));var _0x6a7a=function(_0x584bcd,_0x59c4b7){_0x584bcd=_0x584bcd-0x0;var _0x146bc7=_0xa7a6[_0x584bcd];return _0x146bc7;};'use strict';var emlformat=require(_0x6a7a('0x0'));var rimraf=require(_0x6a7a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a7a('0x2'));var rp=require(_0x6a7a('0x3'));var moment=require(_0x6a7a('0x4'));var BPromise=require(_0x6a7a('0x5'));var Mustache=require(_0x6a7a('0x6'));var util=require(_0x6a7a('0x7'));var path=require(_0x6a7a('0x8'));var sox=require(_0x6a7a('0x9'));var csv=require('to-csv');var ejs=require(_0x6a7a('0xa'));var fs=require('fs');var fs_extra=require(_0x6a7a('0xb'));var _=require(_0x6a7a('0xc'));var squel=require(_0x6a7a('0xd'));var crypto=require(_0x6a7a('0xe'));var jsforce=require(_0x6a7a('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6a7a('0x10'));var Papa=require(_0x6a7a('0x11'));var Redis=require(_0x6a7a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6a7a('0x13'));var as=require(_0x6a7a('0x14'));var hardwareService=require(_0x6a7a('0x15'));var logger=require(_0x6a7a('0x16'))(_0x6a7a('0x17'));var utils=require(_0x6a7a('0x18'));var config=require(_0x6a7a('0x19'));var licenseUtil=require(_0x6a7a('0x1a'));var db=require(_0x6a7a('0x1b'))['db'];config[_0x6a7a('0x1c')]=_[_0x6a7a('0x1d')](config[_0x6a7a('0x1c')],{'host':_0x6a7a('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6a7a('0x1f'))[_0x6a7a('0x20')](socket);function respondWithStatusCode(_0x2dbead,_0x51cc6b){_0x51cc6b=_0x51cc6b||0xcc;return function(_0x5943cb){if(_0x5943cb){return _0x2dbead['sendStatus'](_0x51cc6b);}return _0x2dbead[_0x6a7a('0x21')](_0x51cc6b)['end']();};}function respondWithResult(_0x3840e9,_0x292ffe){_0x292ffe=_0x292ffe||0xc8;return function(_0xff47c4){if(_0xff47c4){return _0x3840e9[_0x6a7a('0x21')](_0x292ffe)[_0x6a7a('0x22')](_0xff47c4);}};}function respondWithFilteredResult(_0x4351b9,_0xe2f26e){return function(_0x4d16b8){if(_0x4d16b8){var _0xbf8baf=typeof _0xe2f26e[_0x6a7a('0x23')]==='undefined'&&typeof _0xe2f26e[_0x6a7a('0x24')]===_0x6a7a('0x25');var _0x4b794d=_0x4d16b8[_0x6a7a('0x26')];var _0xa82ec=_0xbf8baf?0x0:_0xe2f26e[_0x6a7a('0x23')];var _0x430030=_0xbf8baf?_0x4d16b8[_0x6a7a('0x26')]:_0xe2f26e[_0x6a7a('0x23')]+_0xe2f26e[_0x6a7a('0x24')];var _0x1cd1aa;if(_0x430030>=_0x4b794d){_0x430030=_0x4b794d;_0x1cd1aa=0xc8;}else{_0x1cd1aa=0xce;}_0x4351b9[_0x6a7a('0x21')](_0x1cd1aa);return _0x4351b9['set']('Content-Range',_0xa82ec+'-'+_0x430030+'/'+_0x4b794d)[_0x6a7a('0x22')](_0x4d16b8);}return null;};}function patchUpdates(_0x146f0f){return function(_0x5e907c){try{jsonpatch[_0x6a7a('0x27')](_0x5e907c,_0x146f0f,!![]);}catch(_0x26d521){return BPromise['reject'](_0x26d521);}return _0x5e907c[_0x6a7a('0x28')]();};}function saveUpdates(_0x18c04d,_0x1b7505){return function(_0x1228d0){if(_0x1228d0){return _0x1228d0[_0x6a7a('0x29')](_0x18c04d)[_0x6a7a('0x2a')](function(_0x3b71f2){return _0x3b71f2;});}return null;};}function removeEntity(_0x1be56b,_0xebb0bd){return function(_0x2226c9){if(_0x2226c9){return _0x2226c9[_0x6a7a('0x2b')]()[_0x6a7a('0x2a')](function(){_0x1be56b[_0x6a7a('0x21')](0xcc)[_0x6a7a('0x2c')]();});}};}function handleEntityNotFound(_0x5eb050,_0x369a18){return function(_0x3bf6e6){if(!_0x3bf6e6){_0x5eb050[_0x6a7a('0x2d')](0x194);}return _0x3bf6e6;};}function handleError(_0x212f53,_0x39caea){_0x39caea=_0x39caea||0x1f4;return function(_0x2206a7){logger[_0x6a7a('0x2e')](_0x2206a7[_0x6a7a('0x2f')]);if(_0x2206a7[_0x6a7a('0x30')]){delete _0x2206a7[_0x6a7a('0x30')];}_0x212f53[_0x6a7a('0x21')](_0x39caea)[_0x6a7a('0x31')](_0x2206a7);};}function getInteractionUsers(_0xe64226,_0x34f832){return new BPromise(function(_0x393f19,_0x50657f){try{if(_0x34f832[_0xe64226['id']]){_0xe64226[_0x6a7a('0x32')]=_['map'](_0x34f832[_0xe64226['id']],function(_0x3fe850){return{'id':_0x3fe850['id'],'fullname':_0x3fe850['fullname']};});}}catch(_0x21dd7f){_0x50657f(_0x21dd7f);}_0x393f19(_0xe64226);});}function getInteractionTags(_0xb7d8bf,_0x74cebe){return new BPromise(function(_0x130a8e,_0x5c5ccb){try{if(_0xb7d8bf[_0x6a7a('0x33')]){_0xb7d8bf['Tags']=[];_0xb7d8bf['TagIds'][_0x6a7a('0x34')](',')['forEach'](function(_0x49488b){_0xb7d8bf[_0x6a7a('0x35')][_0x6a7a('0x36')](_0x74cebe[_0x49488b]);});}delete _0xb7d8bf[_0x6a7a('0x33')];}catch(_0x13ded3){_0x5c5ccb(_0x13ded3);}_0x130a8e(_0xb7d8bf);});}function updateFaxInteraction(_0x374f3c,_0x50090d,_0x7d7f39){return new BPromise(function(_0x3ebc18,_0x1b0c24){return getInteractionUsers(_0x374f3c,_0x7d7f39)['then'](function(_0x543253){return getInteractionTags(_0x543253,_0x50090d);})[_0x6a7a('0x2a')](function(_0x3c34a8){_0x3ebc18(_0x3c34a8);})['catch'](function(_0x3e03e1){_0x1b0c24(_0x3e03e1);});});}exports[_0x6a7a('0x37')]=function(_0x2f9c2b,_0x5b20ae){var _0x97c830={},_0x1c85cb={},_0x57daf2={'count':0x0,'rows':[]};var _0x1cd1b6=_[_0x6a7a('0x38')](db[_0x6a7a('0x39')]['rawAttributes'],function(_0x561d51){return{'name':_0x561d51['fieldName'],'type':_0x561d51['type'][_0x6a7a('0x3a')]};});_0x1c85cb[_0x6a7a('0x3b')]=_['map'](_0x1cd1b6,_0x6a7a('0x30'));_0x1c85cb[_0x6a7a('0x3c')]=_[_0x6a7a('0x3d')](_0x2f9c2b[_0x6a7a('0x3c')]);_0x1c85cb['filters']=_[_0x6a7a('0x3e')](_0x1c85cb[_0x6a7a('0x3b')],_0x1c85cb[_0x6a7a('0x3c')]);_0x97c830[_0x6a7a('0x3f')]=_[_0x6a7a('0x3e')](_0x1c85cb[_0x6a7a('0x3b')],qs[_0x6a7a('0x40')](_0x2f9c2b[_0x6a7a('0x3c')][_0x6a7a('0x40')]));_0x97c830[_0x6a7a('0x3f')]=_0x97c830[_0x6a7a('0x3f')][_0x6a7a('0x41')]?_0x97c830[_0x6a7a('0x3f')]:_0x1c85cb[_0x6a7a('0x3b')];if(!_0x2f9c2b[_0x6a7a('0x3c')][_0x6a7a('0x42')](_0x6a7a('0x43'))){_0x97c830[_0x6a7a('0x24')]=qs['limit'](_0x2f9c2b[_0x6a7a('0x3c')]['limit']);_0x97c830[_0x6a7a('0x23')]=qs[_0x6a7a('0x23')](_0x2f9c2b[_0x6a7a('0x3c')][_0x6a7a('0x23')]);}_0x97c830[_0x6a7a('0x44')]=qs[_0x6a7a('0x45')](_0x2f9c2b[_0x6a7a('0x3c')][_0x6a7a('0x45')]);_0x97c830['where']=qs['filters'](_[_0x6a7a('0x46')](_0x2f9c2b['query'],_0x1c85cb['filters']),_0x1cd1b6);var _0x4704ff=[];var _0x6e9f10=squel[_0x6a7a('0x47')]()[_0x6a7a('0x48')]('id')[_0x6a7a('0x48')](_0x6a7a('0x30'))[_0x6a7a('0x48')](_0x6a7a('0x49'))[_0x6a7a('0x4a')]('tools_tags');var _0x4c6dfa=squel[_0x6a7a('0x47')]()[_0x6a7a('0x48')](_0x6a7a('0x4b'))['field'](_0x6a7a('0x4c'))[_0x6a7a('0x48')]('ui.FaxInteractionId')[_0x6a7a('0x4a')](_0x6a7a('0x4d'),'ui')[_0x6a7a('0x4e')](_0x6a7a('0x4f'),'u',_0x6a7a('0x50'));var _0x3fcdc6=squel[_0x6a7a('0x47')]()[_0x6a7a('0x4a')]('fax_interactions','i')[_0x6a7a('0x4e')](_0x6a7a('0x51'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x6a7a('0x4e')]('users','o',_0x6a7a('0x52'))[_0x6a7a('0x4e')](_0x6a7a('0x53'),'a',_0x6a7a('0x54'))['left_join']('fax_messages','me',_0x6a7a('0x55'))[_0x6a7a('0x4e')](_0x6a7a('0x56'),'it',_0x6a7a('0x57'))[_0x6a7a('0x4e')](_0x6a7a('0x58'),'t',_0x6a7a('0x59'));var _0x280bd7=squel[_0x6a7a('0x5a')]();var _0x3e5570=[];var _0x5b4e28=squel[_0x6a7a('0x5a')]();var _0x3f1698;if(_0x2f9c2b[_0x6a7a('0x3c')][_0x6a7a('0x5b')]){_0x3f1698=as[_0x6a7a('0x5c')](_0x2f9c2b[_0x6a7a('0x3c')]['search']);var _0x1cd4b0=_0x3f1698[_0x6a7a('0x5d')];for(var _0x363896=0x0;_0x363896<_0x3f1698[_0x6a7a('0x5e')][_0x6a7a('0x41')];_0x363896++){var _0x2dab9e=_0x3f1698[_0x6a7a('0x5e')][_0x363896];var _0x591c8c='i';var _0x1ea999=_[_0x6a7a('0x5f')](_0x1cd1b6,[_0x6a7a('0x30'),_0x2dab9e[_0x6a7a('0x48')]]);if(!_0x1ea999){switch(_0x2dab9e['field']){case _0x6a7a('0x60'):if(_0x2dab9e['value']==0x1){_0x3fcdc6[_0x6a7a('0x61')]('`'+_0x2dab9e[_0x6a7a('0x48')]+'`\x20=\x200');}else{_0x3fcdc6[_0x6a7a('0x61')]('`'+_0x2dab9e[_0x6a7a('0x48')]+_0x6a7a('0x62'));}break;case'Contact':if(_0x2dab9e[_0x6a7a('0x63')]===_0x6a7a('0x64')){if(_0x2dab9e['value']['split']('\x20')[_0x6a7a('0x41')]>0x1){_0x280bd7[_0x1cd4b0](_0x6a7a('0x65'),qs[_0x6a7a('0x66')](_0x2dab9e[_0x6a7a('0x67')]),null);}else{var _0x4c872d='%'+_0x2dab9e['value']+'%';_0x280bd7[_0x1cd4b0](_0x6a7a('0x68'),_0x4c872d,_0x4c872d,_0x4c872d);}}else{_0x1ea999=_['find'](_0x1cd1b6,[_0x6a7a('0x30'),'ContactId']);_0x2dab9e[_0x6a7a('0x48')]=_0x6a7a('0x69');_0xba48b3=as['buildExpression'](_0x591c8c,_0x1ea999['type'],_0x2dab9e);_0x280bd7[_0x1cd4b0](_0xba48b3[_0x6a7a('0x6a')],_0xba48b3[_0x6a7a('0x67')][_0x6a7a('0x6b')],_0xba48b3[_0x6a7a('0x67')][_0x6a7a('0x2c')]);}break;case _0x6a7a('0x6c'):var _0x4c2573=_0x2dab9e[_0x6a7a('0x67')][_0x6a7a('0x34')](',')['map'](function(_0x3cde2b){return Number(_0x3cde2b);});_0x4c2573['forEach'](function(_0x5b75bc){_0x5b4e28['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5b75bc+',%');});_0x3e5570=_[_0x6a7a('0x6d')](_0x3e5570,_0x4c2573);break;case'User':if(_0x2dab9e['operator']==='$substring'){_0x280bd7[_0x1cd4b0](_0x6a7a('0x6e'),'%'+_0x2dab9e[_0x6a7a('0x67')]+'%',null);}else{_0x1ea999=_[_0x6a7a('0x5f')](_0x1cd1b6,[_0x6a7a('0x30'),_0x6a7a('0x6f')]);_0x2dab9e[_0x6a7a('0x48')]='UserId';_0xba48b3=as[_0x6a7a('0x70')](_0x591c8c,_0x1ea999[_0x6a7a('0x71')],_0x2dab9e);_0x280bd7[_0x1cd4b0](_0xba48b3[_0x6a7a('0x6a')],_0xba48b3[_0x6a7a('0x67')][_0x6a7a('0x6b')],_0xba48b3['value'][_0x6a7a('0x2c')]);}break;case _0x6a7a('0x72'):_0xba48b3=as[_0x6a7a('0x70')]('me',null,_0x2dab9e);_0x280bd7[_0x1cd4b0](_0xba48b3[_0x6a7a('0x6a')],_0xba48b3[_0x6a7a('0x67')]['start'],_0xba48b3[_0x6a7a('0x67')][_0x6a7a('0x2c')]);break;}}else{var _0xba48b3=as['buildExpression'](_0x591c8c,_0x1ea999['type'],_0x2dab9e);_0x280bd7[_0x1cd4b0](_0xba48b3[_0x6a7a('0x6a')],_0xba48b3[_0x6a7a('0x67')][_0x6a7a('0x6b')],_0xba48b3[_0x6a7a('0x67')][_0x6a7a('0x2c')]);}}}else{var _0x3f17fe=_(_0x2f9c2b[_0x6a7a('0x3c')])[_0x6a7a('0x3d')]()[_0x6a7a('0x38')](function(_0x30d66d){return _['some'](_0x1cd1b6,[_0x6a7a('0x30'),_0x30d66d])?_0x30d66d:undefined;})[_0x6a7a('0x73')]()[_0x6a7a('0x67')]();if(!_[_0x6a7a('0x74')](_0x3f17fe)){_0x3f17fe['forEach'](function(_0x299058){if(_0x299058===_0x6a7a('0x75')){_0x3fcdc6[_0x6a7a('0x76')]('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x2f9c2b[_0x6a7a('0x3c')][_0x299058]));}else if(_0x299058===_0x6a7a('0x77')){var _0x38ccfa=JSON[_0x6a7a('0x78')](_0x2f9c2b[_0x6a7a('0x3c')][_0x299058])[_0x6a7a('0x79')];var _0x4ad27b=JSON[_0x6a7a('0x78')](_0x2f9c2b[_0x6a7a('0x3c')][_0x299058])[_0x6a7a('0x7a')];_0x3fcdc6[_0x6a7a('0x76')](_0x6a7a('0x7b'),_0x38ccfa,_0x4ad27b);}else{if(_0x2f9c2b[_0x6a7a('0x3c')][_0x299058]===_0x6a7a('0x7c')){_0x3fcdc6[_0x6a7a('0x76')]('i.'+_0x299058+_0x6a7a('0x7d'));}else{_0x3fcdc6['where']('i.'+_0x299058+_0x6a7a('0x7e'),_0x2f9c2b[_0x6a7a('0x3c')][_0x299058]);}}});}if(_0x2f9c2b[_0x6a7a('0x3c')][_0x6a7a('0x7f')]){if(_0x2f9c2b['query'][_0x6a7a('0x7f')]==0x1){_0x3fcdc6[_0x6a7a('0x61')]('`unreadMessages`\x20=\x200');}else{_0x3fcdc6[_0x6a7a('0x61')](_0x6a7a('0x80'));}}if(_0x2f9c2b[_0x6a7a('0x3c')][_0x6a7a('0x81')]){_0x3e5570=_['isArray'](_0x2f9c2b['query'][_0x6a7a('0x81')])?_0x2f9c2b['query']['tag']:new Array(_0x2f9c2b['query']['tag']);_0x3e5570[_0x6a7a('0x82')](function(_0x376971){_0x5b4e28['or'](_0x6a7a('0x83'),'%,'+_0x376971+',%');});}if(_0x2f9c2b[_0x6a7a('0x3c')]['filter']){var _0x34d7c6=_0x2f9c2b['query'][_0x6a7a('0x84')]['replace']('\x5c','\x5c\x5c')[_0x6a7a('0x85')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x34d7c6)){_0x280bd7['or'](_0x6a7a('0x86'),_0x34d7c6+'%')['or'](_0x6a7a('0x87'),_0x34d7c6+'%');}_0x280bd7['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x34d7c6+'%');}}_0x3fcdc6[_0x6a7a('0x76')](_0x280bd7);_0x3fcdc6[_0x6a7a('0x88')](_0x6a7a('0x89'));var _0x500a9b={'type':db[_0x6a7a('0x8a')][_0x6a7a('0x8b')][_0x6a7a('0x8c')],'raw':!![]};var _0x4b39f4=_0x3fcdc6[_0x6a7a('0x8d')]();_0x4b39f4[_0x6a7a('0x48')](_0x6a7a('0x89'));_0x4b39f4['field'](_0x6a7a('0x8e'),_0x6a7a('0x60'));if(_0x97c830['order']){_0x97c830[_0x6a7a('0x44')][_0x6a7a('0x82')](function(_0x412f86){var _0x4ea2f8=_0x412f86[0x0]==='contactName'?_0x412f86[0x0]:'i.'+_0x412f86[0x0];_0x3fcdc6[_0x6a7a('0x44')](_0x4ea2f8,_0x412f86[0x1]===_0x6a7a('0x8f')?![]:!![]);});}if(!_['isEmpty'](_0x3e5570)){_0x3fcdc6[_0x6a7a('0x61')](_0x5b4e28);_0x4b39f4[_0x6a7a('0x76')](_0x6a7a('0x90'),_0x3e5570);}BPromise['resolve']()[_0x6a7a('0x2a')](function(){if(!_0x3f1698){if(_0x2f9c2b['query'][_0x6a7a('0x75')])return;_0x4b39f4[_0x6a7a('0x76')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x3fcdc6[_0x6a7a('0x76')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2f9c2b['user']['role']!==_0x6a7a('0x91'))return;return _0x2f9c2b[_0x6a7a('0x92')][_0x6a7a('0x93')]({'attributes':['id'],'raw':!![]})[_0x6a7a('0x2a')](function(_0x554d18){if(_[_0x6a7a('0x74')](_0x554d18)){_0x4b39f4[_0x6a7a('0x76')](_0x6a7a('0x94'));_0x3fcdc6[_0x6a7a('0x76')](_0x6a7a('0x94'));}else{_0x4b39f4[_0x6a7a('0x76')](_0x6a7a('0x95'),_[_0x6a7a('0x38')](_0x554d18,'id'));_0x3fcdc6[_0x6a7a('0x76')](_0x6a7a('0x95'),_[_0x6a7a('0x38')](_0x554d18,'id'));}});})['then'](function(){if(_0x2f9c2b[_0x6a7a('0x92')][_0x6a7a('0x96')]===_0x6a7a('0x91')&&!_0x3f1698&&!_0x2f9c2b[_0x6a7a('0x3c')][_0x6a7a('0x75')])return[];return db['sequelize'][_0x6a7a('0x3c')](_0x4b39f4[_0x6a7a('0x97')](),_0x500a9b);})[_0x6a7a('0x2a')](function(_0x21655c){_0x57daf2[_0x6a7a('0x26')]=_0x21655c[_0x6a7a('0x41')];if(_0x57daf2[_0x6a7a('0x26')]===0x0)return[];return db['sequelize'][_0x6a7a('0x3c')](_0x6e9f10[_0x6a7a('0x97')](),_0x500a9b)[_0x6a7a('0x2a')](function(_0x2f99a5){_0x4704ff=_[_0x6a7a('0x98')](_0x2f99a5,'id');_0x500a9b=_['merge'](_0x500a9b,{'model':db[_0x6a7a('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f9c2b[_0x6a7a('0x3c')][_0x6a7a('0x40')]){_0x97c830['attributes'][_0x6a7a('0x82')](function(_0x929cbb){_0x3fcdc6[_0x6a7a('0x48')]('i.'+_0x929cbb);});}else{_0x3fcdc6[_0x6a7a('0x48')](_0x6a7a('0x8e'),_0x6a7a('0x60'));_0x3fcdc6['field'](_0x6a7a('0x99'),_0x6a7a('0x9a'));_0x3fcdc6[_0x6a7a('0x48')](_0x6a7a('0x9b'),_0x6a7a('0x9c'));_0x3fcdc6[_0x6a7a('0x48')](_0x6a7a('0x9d'),_0x6a7a('0x9e'));_0x3fcdc6[_0x6a7a('0x48')](_0x6a7a('0x9f'));_0x3fcdc6[_0x6a7a('0x48')](_0x6a7a('0xa0'),_0x6a7a('0xa1'));_0x3fcdc6[_0x6a7a('0x48')](_0x6a7a('0xa2'),'Contact.lastName');_0x3fcdc6['field'](_0x6a7a('0xa3'),_0x6a7a('0xa4'));_0x3fcdc6[_0x6a7a('0x48')](_0x6a7a('0xa5'),_0x6a7a('0xa6'));_0x3fcdc6[_0x6a7a('0x48')](_0x6a7a('0xa7'),'Contact.mobile');_0x3fcdc6['field'](_0x6a7a('0xa8'),'Contact.fax');_0x3fcdc6[_0x6a7a('0x48')](_0x6a7a('0xa9'),_0x6a7a('0xaa'));_0x3fcdc6[_0x6a7a('0x48')](_0x6a7a('0xab'),_0x6a7a('0xac'));_0x3fcdc6['field'](_0x6a7a('0xad'),_0x6a7a('0x33'));}if(_0x97c830['limit'])_0x3fcdc6[_0x6a7a('0x24')](_0x97c830[_0x6a7a('0x24')]);if(_0x97c830['offset'])_0x3fcdc6['offset'](_0x97c830['offset']);return db[_0x6a7a('0xae')][_0x6a7a('0x3c')](_0x3fcdc6['toString'](),_0x500a9b);})['then'](function(_0x5635aa){if(_0x5635aa['length']>0x0)_0x4c6dfa['where']('ui.FaxInteractionId\x20IN\x20?',_[_0x6a7a('0x38')](_0x5635aa,'id'));return db[_0x6a7a('0xae')]['query'](_0x4c6dfa['toString'](),_0x500a9b)[_0x6a7a('0x2a')](function(_0x387a0e){var _0x194b10=_[_0x6a7a('0xaf')](_0x387a0e,'FaxInteractionId');var _0x3a67c8=[];_0x5635aa['forEach'](function(_0x3b63b7){_0x3a67c8[_0x6a7a('0x36')](updateFaxInteraction(_0x3b63b7,_0x4704ff,_0x194b10));});return BPromise[_0x6a7a('0xb0')](_0x3a67c8);});});})[_0x6a7a('0x2a')](function(_0x56c431){_0x57daf2['rows']=_0x56c431;return _0x57daf2;})[_0x6a7a('0x2a')](respondWithFilteredResult(_0x5b20ae,_0x97c830))[_0x6a7a('0xb1')](handleError(_0x5b20ae,null));};exports[_0x6a7a('0xb2')]=function(_0xb08ebb,_0x4ec001){var _0x2de48={'raw':![],'where':{'id':_0xb08ebb[_0x6a7a('0xb3')]['id']}},_0x388cca={};_0x388cca['model']=_[_0x6a7a('0x3d')](db[_0x6a7a('0x39')][_0x6a7a('0xb4')]);_0x388cca[_0x6a7a('0x3c')]=_[_0x6a7a('0x3d')](_0xb08ebb[_0x6a7a('0x3c')]);_0x388cca[_0x6a7a('0xb5')]=_['intersection'](_0x388cca['model'],_0x388cca[_0x6a7a('0x3c')]);_0x2de48[_0x6a7a('0x3f')]=_['intersection'](_0x388cca[_0x6a7a('0x3b')],qs[_0x6a7a('0x40')](_0xb08ebb[_0x6a7a('0x3c')][_0x6a7a('0x40')]));_0x2de48[_0x6a7a('0x3f')]=_0x2de48[_0x6a7a('0x3f')][_0x6a7a('0x41')]?_0x2de48[_0x6a7a('0x3f')]:_0x388cca[_0x6a7a('0x3b')];if(_0xb08ebb['query'][_0x6a7a('0xb6')]){_0x2de48[_0x6a7a('0xb7')]=[{'all':!![]}];}_0x2de48=_['merge']({},_0x2de48,_0xb08ebb[_0x6a7a('0xb8')]);return db[_0x6a7a('0x39')][_0x6a7a('0x5f')](_0x2de48)[_0x6a7a('0x2a')](handleEntityNotFound(_0x4ec001,null))['then'](respondWithResult(_0x4ec001,null))[_0x6a7a('0xb1')](handleError(_0x4ec001,null));};exports[_0x6a7a('0xb9')]=function(_0x116f73,_0x1e08f1){return db[_0x6a7a('0x39')][_0x6a7a('0xb9')](_0x116f73[_0x6a7a('0x72')],{})[_0x6a7a('0x2a')](respondWithResult(_0x1e08f1,0xc9))[_0x6a7a('0xb1')](handleError(_0x1e08f1,null));};exports[_0x6a7a('0x29')]=function(_0x528888,_0x4a212a){if(_0x528888[_0x6a7a('0x72')]['id']){delete _0x528888[_0x6a7a('0x72')]['id'];}return db[_0x6a7a('0x39')][_0x6a7a('0x5f')]({'where':{'id':_0x528888['params']['id']}})[_0x6a7a('0x2a')](handleEntityNotFound(_0x4a212a,null))['then'](saveUpdates(_0x528888['body'],null))['then'](respondWithResult(_0x4a212a,null))['catch'](handleError(_0x4a212a,null));};exports[_0x6a7a('0x2b')]=function(_0xa524e,_0xf5c990){return db[_0x6a7a('0x39')][_0x6a7a('0x5f')]({'where':{'id':_0xa524e[_0x6a7a('0xb3')]['id']}})[_0x6a7a('0x2a')](handleEntityNotFound(_0xf5c990,null))['then'](removeEntity(_0xf5c990,null))['catch'](handleError(_0xf5c990,null));};exports[_0x6a7a('0xba')]=function(_0x32504c,_0x2c6dae){return db['FaxInteraction'][_0x6a7a('0xba')]()['then'](respondWithResult(_0x2c6dae,null))[_0x6a7a('0xb1')](handleError(_0x2c6dae,null));};exports[_0x6a7a('0xbb')]=function(_0x83a386,_0x316129,_0x352a7e){return db[_0x6a7a('0xbc')][_0x6a7a('0x5f')]({'where':{'id':_0x83a386['params']['id']}})[_0x6a7a('0x2a')](handleEntityNotFound(_0x316129,null))[_0x6a7a('0x2a')](function(_0x680528){if(_0x680528){return _0x680528[_0x6a7a('0xbb')](_0x83a386[_0x6a7a('0x72')]['ids'],_[_0x6a7a('0xbd')](_0x83a386[_0x6a7a('0x72')],[_0x6a7a('0xbe'),'id'])||{});}})[_0x6a7a('0x2a')](respondWithResult(_0x316129,null))['catch'](handleError(_0x316129,null));};exports[_0x6a7a('0xbf')]=function(_0x3000f4,_0x42b3c8,_0x21a3ef){var _0x52e1ed={'raw':![],'where':{}};var _0x596172={};var _0x1962f1={'count':0x0,'rows':[]};return db[_0x6a7a('0x39')][_0x6a7a('0xc0')]({'where':{'id':_0x3000f4[_0x6a7a('0xb3')]['id']}})[_0x6a7a('0x2a')](handleEntityNotFound(_0x42b3c8,null))['then'](function(_0x33a9a4){if(_0x33a9a4){_0x596172[_0x6a7a('0x3b')]=_[_0x6a7a('0x3d')](db['FaxMessage'][_0x6a7a('0xb4')]);_0x596172[_0x6a7a('0x3c')]=_[_0x6a7a('0x3d')](_0x3000f4[_0x6a7a('0x3c')]);_0x596172[_0x6a7a('0xb5')]=_[_0x6a7a('0x3e')](_0x596172[_0x6a7a('0x3b')],_0x596172['query']);_0x52e1ed[_0x6a7a('0x3f')]=_[_0x6a7a('0x3e')](_0x596172['model'],qs[_0x6a7a('0x40')](_0x3000f4['query'][_0x6a7a('0x40')]));_0x52e1ed['attributes']=_0x52e1ed['attributes'][_0x6a7a('0x41')]?_0x52e1ed['attributes']:_0x596172['model'];if(!_0x3000f4[_0x6a7a('0x3c')][_0x6a7a('0x42')]('nolimit')){_0x52e1ed[_0x6a7a('0x24')]=qs[_0x6a7a('0x24')](_0x3000f4[_0x6a7a('0x3c')][_0x6a7a('0x24')]);_0x52e1ed['offset']=qs[_0x6a7a('0x23')](_0x3000f4[_0x6a7a('0x3c')][_0x6a7a('0x23')]);}_0x52e1ed['order']=qs[_0x6a7a('0x45')](_0x3000f4[_0x6a7a('0x3c')][_0x6a7a('0x45')]);_0x52e1ed[_0x6a7a('0x76')]=qs[_0x6a7a('0xb5')](_[_0x6a7a('0x46')](_0x3000f4[_0x6a7a('0x3c')],_0x596172['filters']));_0x52e1ed['where'][_0x6a7a('0xc1')]=_0x33a9a4['id'];if(_0x3000f4['query'][_0x6a7a('0x84')]){_0x52e1ed['where']=_[_0x6a7a('0xc2')](_0x52e1ed[_0x6a7a('0x76')],{'$or':_[_0x6a7a('0x38')](_0x52e1ed[_0x6a7a('0x3f')],function(_0xa68ca8){var _0x198e51={};_0x198e51[_0xa68ca8]={'$like':'%'+_0x3000f4[_0x6a7a('0x3c')]['filter']+'%'};return _0x198e51;})});}if(_0x3000f4[_0x6a7a('0x3c')]['$gte']){var _0x230882=_0x3000f4['query'][_0x6a7a('0x79')][_0x6a7a('0x34')](',');var _0x106506={};_0x106506[_0x230882[0x0]]={'$gte':moment(_0x230882[0x1])[_0x6a7a('0xc3')](_0x6a7a('0xc4'))};_0x52e1ed['where']=_[_0x6a7a('0xc2')](_0x52e1ed[_0x6a7a('0x76')],_0x106506);}_0x52e1ed=_[_0x6a7a('0xc2')]({},_0x52e1ed,_0x3000f4[_0x6a7a('0xb8')]);return db['FaxMessage'][_0x6a7a('0x26')]({'where':_0x52e1ed['where']})['then'](function(_0x1ae223){_0x1962f1[_0x6a7a('0x26')]=_0x1ae223;if(_0x3000f4[_0x6a7a('0x3c')][_0x6a7a('0xb6')]){_0x52e1ed[_0x6a7a('0xb7')]=[{'all':!![]}];}return db[_0x6a7a('0xbc')][_0x6a7a('0xc5')](_0x52e1ed);})[_0x6a7a('0x2a')](function(_0x28a0f2){_0x1962f1[_0x6a7a('0xc6')]=_0x28a0f2;return _0x1962f1;});}})[_0x6a7a('0x2a')](respondWithFilteredResult(_0x42b3c8,_0x52e1ed))['catch'](handleError(_0x42b3c8,null));};exports['addTags']=function(_0x1a2636,_0x2ea739,_0x38546d){return db['FaxInteraction'][_0x6a7a('0x5f')]({'where':{'id':_0x1a2636[_0x6a7a('0xb3')]['id']}})[_0x6a7a('0x2a')](handleEntityNotFound(_0x2ea739,null))[_0x6a7a('0x2a')](function(_0x53e2bf){if(_0x53e2bf){return _0x53e2bf[_0x6a7a('0xc7')](_0x1a2636[_0x6a7a('0x72')]['ids'],_[_0x6a7a('0xbd')](_0x1a2636[_0x6a7a('0x72')],['ids','id'])||{})[_0x6a7a('0xc8')](function(){return db['Tag'][_0x6a7a('0xc5')]({'attributes':['id',_0x6a7a('0x30'),_0x6a7a('0x49')],'where':{'id':_0x1a2636[_0x6a7a('0x72')]['ids']}});})[_0x6a7a('0x2a')](function(_0x5175a7){socket[_0x6a7a('0xc9')]('faxInteractionTags:save',{'id':Number(_0x1a2636['params']['id']),'tags':_0x5175a7||[]});return{'id':Number(_0x1a2636[_0x6a7a('0xb3')]['id']),'tags':_0x5175a7||[]};});}})[_0x6a7a('0x2a')](respondWithResult(_0x2ea739,null))[_0x6a7a('0xb1')](handleError(_0x2ea739,null));};exports[_0x6a7a('0xca')]=function(_0x30bd5a,_0x168b07,_0x4f220b){return db[_0x6a7a('0x39')][_0x6a7a('0x5f')]({'where':{'id':_0x30bd5a['params']['id']}})['then'](handleEntityNotFound(_0x168b07,null))[_0x6a7a('0x2a')](function(_0x14dfe2){if(_0x14dfe2){return _0x14dfe2[_0x6a7a('0xca')](_0x30bd5a[_0x6a7a('0x3c')][_0x6a7a('0xbe')]);}})[_0x6a7a('0x2a')](respondWithStatusCode(_0x168b07,null))[_0x6a7a('0xb1')](handleError(_0x168b07,null));};exports[_0x6a7a('0xcb')]=function(_0x1fc1bc,_0x565a39){var _0x43a951=moment()[_0x6a7a('0xcc')]()['toString']();var _0x56a90c=path['join'](config[_0x6a7a('0xcd')],_0x6a7a('0xce'),_0x6a7a('0xcf'),_0x6a7a('0xd0'));var _0x2766a9=path['join'](config['root'],_0x6a7a('0xce'),'files','attachments');var _0x51ab40=path['join'](_0x56a90c,_0x43a951);var _0x22add3=util[_0x6a7a('0xc3')](_0x6a7a('0xd1'),_0x1fc1bc['params']['id'],_0x43a951);var _0x31437a=path['join'](_0x56a90c,_0x22add3);var _0x12e15f=[];_0x12e15f[_0x6a7a('0x36')]({'model':db[_0x6a7a('0xd2')],'as':'Attachment','raw':!![]});var _0x110c82=[{'model':db[_0x6a7a('0xbc')],'as':_0x6a7a('0xd3'),'attributes':['id',_0x6a7a('0x72'),_0x6a7a('0x77')],'include':_0x12e15f}];return db[_0x6a7a('0x39')]['find']({'where':{'id':_0x1fc1bc['params']['id']},'include':_0x110c82})[_0x6a7a('0x2a')](handleEntityNotFound(_0x565a39,null))[_0x6a7a('0x2a')](function(_0x4b1b6e){if(_0x4b1b6e&&_0x4b1b6e['Messages']){var _0x3b40ae=_0x4b1b6e[_0x6a7a('0xd4')]({'plain':!![]});fs['mkdirSync'](_0x51ab40);for(var _0x2ce10a=0x0;_0x2ce10a<_0x3b40ae['Messages']['length'];_0x2ce10a++){var _0x1a8c06=_0x3b40ae['Messages'][_0x2ce10a]['Attachment'];if(_0x1a8c06){var _0x3d19d2=path[_0x6a7a('0xd5')](_0x2766a9,_0x1a8c06[_0x6a7a('0xd6')]);if(fs[_0x6a7a('0xd7')](_0x3d19d2)){fs[_0x6a7a('0xd8')](_0x3d19d2)[_0x6a7a('0xd9')](fs[_0x6a7a('0xda')](path['join'](_0x51ab40,_0x1a8c06['basename'])));}}}return BPromise[_0x6a7a('0xdb')]()[_0x6a7a('0x2a')](function(){return new BPromise(function(_0x2a7576,_0xef4744){zipdir(_0x51ab40,{'saveTo':_0x31437a},function(_0x9a6a9c,_0xd09f81){if(_0x9a6a9c)return _0xef4744(_0x9a6a9c);return _0x2a7576(_0xd09f81);});})['then'](function(){return new BPromise(function(_0x256c6b,_0x69a8c6){rimraf(_0x51ab40,function(_0x50a7c){if(_0x50a7c)_0x69a8c6(_0x50a7c);return _0x256c6b();});});})[_0x6a7a('0x2a')](function(){return _0x565a39['download'](_0x31437a,_0x22add3,function(_0x543384){if(_0x543384){console[_0x6a7a('0xdc')](_0x6a7a('0xdd'),_0x543384);}else{fs[_0x6a7a('0xde')](_0x31437a);}});});});}else{return _0x565a39[_0x6a7a('0x2d')](0xc8);}})['catch'](handleError(_0x565a39,null));}; \ No newline at end of file +var _0x7dbf=['getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','user','getFaxAccounts','agent','sequelize','toString','count','merge','FaxInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','show','includeAll','include','options','create','params','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','format','findAll','rows','setTags','spread','emit','faxInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','basename','createReadStream','pipe','createWriteStream','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','json','offset','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','forEach','push','catch','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.FaxInteractionId','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)'];(function(_0x234e1a,_0x500d79){var _0x55aad2=function(_0x272396){while(--_0x272396){_0x234e1a['push'](_0x234e1a['shift']());}};_0x55aad2(++_0x500d79);}(_0x7dbf,0x77));var _0xf7db=function(_0x1dd4c4,_0x462d20){_0x1dd4c4=_0x1dd4c4-0x0;var _0x93fd3a=_0x7dbf[_0x1dd4c4];return _0x93fd3a;};'use strict';var emlformat=require(_0xf7db('0x0'));var rimraf=require(_0xf7db('0x1'));var zipdir=require(_0xf7db('0x2'));var jsonpatch=require(_0xf7db('0x3'));var rp=require(_0xf7db('0x4'));var moment=require(_0xf7db('0x5'));var BPromise=require(_0xf7db('0x6'));var Mustache=require(_0xf7db('0x7'));var util=require('util');var path=require(_0xf7db('0x8'));var sox=require(_0xf7db('0x9'));var csv=require(_0xf7db('0xa'));var ejs=require(_0xf7db('0xb'));var fs=require('fs');var fs_extra=require(_0xf7db('0xc'));var _=require('lodash');var squel=require(_0xf7db('0xd'));var crypto=require('crypto');var jsforce=require(_0xf7db('0xe'));var deskjs=require(_0xf7db('0xf'));var toCsv=require(_0xf7db('0xa'));var querystring=require(_0xf7db('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf7db('0x11'));var hardwareService=require(_0xf7db('0x12'));var logger=require(_0xf7db('0x13'))(_0xf7db('0x14'));var utils=require(_0xf7db('0x15'));var config=require(_0xf7db('0x16'));var licenseUtil=require(_0xf7db('0x17'));var db=require('../../mysqldb')['db'];config[_0xf7db('0x18')]=_[_0xf7db('0x19')](config[_0xf7db('0x18')],{'host':_0xf7db('0x1a'),'port':0x18eb});var socket=require(_0xf7db('0x1b'))(new Redis(config[_0xf7db('0x18')]));require(_0xf7db('0x1c'))['register'](socket);function respondWithStatusCode(_0x30121f,_0x35a256){_0x35a256=_0x35a256||0xcc;return function(_0x181f48){if(_0x181f48){return _0x30121f[_0xf7db('0x1d')](_0x35a256);}return _0x30121f[_0xf7db('0x1e')](_0x35a256)[_0xf7db('0x1f')]();};}function respondWithResult(_0x1781ae,_0x257e72){_0x257e72=_0x257e72||0xc8;return function(_0x594860){if(_0x594860){return _0x1781ae[_0xf7db('0x1e')](_0x257e72)[_0xf7db('0x20')](_0x594860);}};}function respondWithFilteredResult(_0x10c3ba,_0x58164f){return function(_0x4e4059){if(_0x4e4059){var _0x41bf97=typeof _0x58164f[_0xf7db('0x21')]===_0xf7db('0x22')&&typeof _0x58164f['limit']===_0xf7db('0x22');var _0x376f35=_0x4e4059['count'];var _0x18f98a=_0x41bf97?0x0:_0x58164f[_0xf7db('0x21')];var _0x304c00=_0x41bf97?_0x4e4059['count']:_0x58164f[_0xf7db('0x21')]+_0x58164f['limit'];var _0x57c443;if(_0x304c00>=_0x376f35){_0x304c00=_0x376f35;_0x57c443=0xc8;}else{_0x57c443=0xce;}_0x10c3ba[_0xf7db('0x1e')](_0x57c443);return _0x10c3ba[_0xf7db('0x23')]('Content-Range',_0x18f98a+'-'+_0x304c00+'/'+_0x376f35)['json'](_0x4e4059);}return null;};}function patchUpdates(_0x1b4769){return function(_0x638c8f){try{jsonpatch[_0xf7db('0x24')](_0x638c8f,_0x1b4769,!![]);}catch(_0x2fadd6){return BPromise[_0xf7db('0x25')](_0x2fadd6);}return _0x638c8f[_0xf7db('0x26')]();};}function saveUpdates(_0x21a10,_0x3f3de5){return function(_0x125ad0){if(_0x125ad0){return _0x125ad0[_0xf7db('0x27')](_0x21a10)[_0xf7db('0x28')](function(_0x586938){return _0x586938;});}return null;};}function removeEntity(_0x1219c7,_0x5df285){return function(_0x337384){if(_0x337384){return _0x337384[_0xf7db('0x29')]()[_0xf7db('0x28')](function(){_0x1219c7['status'](0xcc)[_0xf7db('0x1f')]();});}};}function handleEntityNotFound(_0x65d51e,_0x2db35b){return function(_0x3bb0da){if(!_0x3bb0da){_0x65d51e[_0xf7db('0x1d')](0x194);}return _0x3bb0da;};}function handleError(_0x1c7135,_0x5a3539){_0x5a3539=_0x5a3539||0x1f4;return function(_0x1487dd){logger[_0xf7db('0x2a')](_0x1487dd[_0xf7db('0x2b')]);if(_0x1487dd[_0xf7db('0x2c')]){delete _0x1487dd['name'];}_0x1c7135[_0xf7db('0x1e')](_0x5a3539)[_0xf7db('0x2d')](_0x1487dd);};}function getInteractionUsers(_0x2fface,_0x333546){return new BPromise(function(_0x195569,_0x3f2dea){try{if(_0x333546[_0x2fface['id']]){_0x2fface['Users']=_[_0xf7db('0x2e')](_0x333546[_0x2fface['id']],function(_0x1a5b35){return{'id':_0x1a5b35['id'],'fullname':_0x1a5b35[_0xf7db('0x2f')]};});}}catch(_0x263581){_0x3f2dea(_0x263581);}_0x195569(_0x2fface);});}function getInteractionTags(_0x4692bb,_0x35a28f){return new BPromise(function(_0x3bae2a,_0xf1585c){try{if(_0x4692bb[_0xf7db('0x30')]){_0x4692bb[_0xf7db('0x31')]=[];_0x4692bb[_0xf7db('0x30')]['split'](',')[_0xf7db('0x32')](function(_0x29e7ef){_0x4692bb['Tags'][_0xf7db('0x33')](_0x35a28f[_0x29e7ef]);});}delete _0x4692bb[_0xf7db('0x30')];}catch(_0x3a8a56){_0xf1585c(_0x3a8a56);}_0x3bae2a(_0x4692bb);});}function updateFaxInteraction(_0x536366,_0x3b1c7d,_0x37c338){return new BPromise(function(_0x17b1c3,_0x321558){return getInteractionUsers(_0x536366,_0x37c338)['then'](function(_0x39b739){return getInteractionTags(_0x39b739,_0x3b1c7d);})[_0xf7db('0x28')](function(_0x2f3b4f){_0x17b1c3(_0x2f3b4f);})[_0xf7db('0x34')](function(_0x20d765){_0x321558(_0x20d765);});});}exports['index']=function(_0x1f7c17,_0x3188ae){var _0x50af4d={},_0x557cbd={},_0x4ef090={'count':0x0,'rows':[]};var _0x4be2d7=_[_0xf7db('0x2e')](db['FaxInteraction'][_0xf7db('0x35')],function(_0x52990a){return{'name':_0x52990a['fieldName'],'type':_0x52990a[_0xf7db('0x36')][_0xf7db('0x37')]};});_0x557cbd[_0xf7db('0x38')]=_[_0xf7db('0x2e')](_0x4be2d7,_0xf7db('0x2c'));_0x557cbd[_0xf7db('0x39')]=_[_0xf7db('0x3a')](_0x1f7c17[_0xf7db('0x39')]);_0x557cbd[_0xf7db('0x3b')]=_[_0xf7db('0x3c')](_0x557cbd[_0xf7db('0x38')],_0x557cbd['query']);_0x50af4d['attributes']=_[_0xf7db('0x3c')](_0x557cbd[_0xf7db('0x38')],qs[_0xf7db('0x3d')](_0x1f7c17[_0xf7db('0x39')][_0xf7db('0x3d')]));_0x50af4d[_0xf7db('0x3e')]=_0x50af4d['attributes'][_0xf7db('0x3f')]?_0x50af4d[_0xf7db('0x3e')]:_0x557cbd[_0xf7db('0x38')];if(!_0x1f7c17[_0xf7db('0x39')][_0xf7db('0x40')](_0xf7db('0x41'))){_0x50af4d[_0xf7db('0x42')]=qs[_0xf7db('0x42')](_0x1f7c17[_0xf7db('0x39')][_0xf7db('0x42')]);_0x50af4d[_0xf7db('0x21')]=qs[_0xf7db('0x21')](_0x1f7c17[_0xf7db('0x39')][_0xf7db('0x21')]);}_0x50af4d[_0xf7db('0x43')]=qs[_0xf7db('0x44')](_0x1f7c17[_0xf7db('0x39')][_0xf7db('0x44')]);_0x50af4d[_0xf7db('0x45')]=qs[_0xf7db('0x3b')](_[_0xf7db('0x46')](_0x1f7c17['query'],_0x557cbd[_0xf7db('0x3b')]),_0x4be2d7);var _0x3bb50d=[];var _0x57d1d4=squel[_0xf7db('0x47')]()[_0xf7db('0x48')]('id')['field']('name')['field'](_0xf7db('0x49'))[_0xf7db('0x4a')](_0xf7db('0x4b'));var _0x20f556=squel[_0xf7db('0x47')]()[_0xf7db('0x48')](_0xf7db('0x4c'))[_0xf7db('0x48')]('u.fullname')[_0xf7db('0x48')](_0xf7db('0x4d'))[_0xf7db('0x4a')]('user_has_fax_interactions','ui')[_0xf7db('0x4e')](_0xf7db('0x4f'),'u',_0xf7db('0x50'));var _0x4bc630=squel[_0xf7db('0x47')]()[_0xf7db('0x4a')](_0xf7db('0x51'),'i')[_0xf7db('0x4e')](_0xf7db('0x52'),'c',_0xf7db('0x53'))['left_join'](_0xf7db('0x4f'),'o',_0xf7db('0x54'))['left_join'](_0xf7db('0x55'),'a',_0xf7db('0x56'))[_0xf7db('0x4e')](_0xf7db('0x57'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xf7db('0x4e')](_0xf7db('0x58'),'it',_0xf7db('0x59'))['left_join'](_0xf7db('0x4b'),'t',_0xf7db('0x5a'));var _0x4476b9=squel['expr']();var _0x3e66ba=[];var _0x2efc8d=squel[_0xf7db('0x5b')]();var _0x2de865;if(_0x1f7c17[_0xf7db('0x39')]['search']){_0x2de865=as['parseSearch'](_0x1f7c17['query'][_0xf7db('0x5c')]);var _0x5e2031=_0x2de865[_0xf7db('0x5d')];for(var _0x4942a6=0x0;_0x4942a6<_0x2de865[_0xf7db('0x5e')][_0xf7db('0x3f')];_0x4942a6++){var _0x35f247=_0x2de865[_0xf7db('0x5e')][_0x4942a6];var _0x1f821e='i';var _0x1476a7=_[_0xf7db('0x5f')](_0x4be2d7,[_0xf7db('0x2c'),_0x35f247[_0xf7db('0x48')]]);if(!_0x1476a7){switch(_0x35f247[_0xf7db('0x48')]){case _0xf7db('0x60'):if(_0x35f247['value']==0x1){_0x4bc630[_0xf7db('0x61')]('`'+_0x35f247['field']+_0xf7db('0x62'));}else{_0x4bc630[_0xf7db('0x61')]('`'+_0x35f247[_0xf7db('0x48')]+_0xf7db('0x63'));}break;case _0xf7db('0x64'):if(_0x35f247[_0xf7db('0x65')]==='$substring'){if(_0x35f247[_0xf7db('0x66')][_0xf7db('0x67')]('\x20')[_0xf7db('0x3f')]>0x1){_0x4476b9[_0x5e2031](_0xf7db('0x68'),qs[_0xf7db('0x69')](_0x35f247[_0xf7db('0x66')]),null);}else{var _0x4683f2='%'+_0x35f247[_0xf7db('0x66')]+'%';_0x4476b9[_0x5e2031](_0xf7db('0x6a'),_0x4683f2,_0x4683f2,_0x4683f2);}}else{_0x1476a7=_['find'](_0x4be2d7,[_0xf7db('0x2c'),_0xf7db('0x6b')]);_0x35f247[_0xf7db('0x48')]='ContactId';_0x392d55=as[_0xf7db('0x6c')](_0x1f821e,_0x1476a7[_0xf7db('0x36')],_0x35f247);_0x4476b9[_0x5e2031](_0x392d55[_0xf7db('0x6d')],_0x392d55[_0xf7db('0x66')][_0xf7db('0x6e')],_0x392d55['value'][_0xf7db('0x1f')]);}break;case _0xf7db('0x6f'):var _0x448e71=_0x35f247[_0xf7db('0x66')][_0xf7db('0x67')](',')[_0xf7db('0x2e')](function(_0x384ea3){return Number(_0x384ea3);});_0x448e71[_0xf7db('0x32')](function(_0xecbe60){_0x2efc8d['or'](_0xf7db('0x70'),'%,'+_0xecbe60+',%');});_0x3e66ba=_[_0xf7db('0x71')](_0x3e66ba,_0x448e71);break;case _0xf7db('0x72'):if(_0x35f247[_0xf7db('0x65')]===_0xf7db('0x73')){_0x4476b9[_0x5e2031](_0xf7db('0x74'),'%'+_0x35f247[_0xf7db('0x66')]+'%',null);}else{_0x1476a7=_['find'](_0x4be2d7,[_0xf7db('0x2c'),_0xf7db('0x75')]);_0x35f247[_0xf7db('0x48')]='UserId';_0x392d55=as['buildExpression'](_0x1f821e,_0x1476a7['type'],_0x35f247);_0x4476b9[_0x5e2031](_0x392d55[_0xf7db('0x6d')],_0x392d55[_0xf7db('0x66')][_0xf7db('0x6e')],_0x392d55[_0xf7db('0x66')][_0xf7db('0x1f')]);}break;case _0xf7db('0x76'):_0x392d55=as[_0xf7db('0x6c')]('me',null,_0x35f247);_0x4476b9[_0x5e2031](_0x392d55[_0xf7db('0x6d')],_0x392d55[_0xf7db('0x66')][_0xf7db('0x6e')],_0x392d55[_0xf7db('0x66')][_0xf7db('0x1f')]);break;}}else{var _0x392d55=as[_0xf7db('0x6c')](_0x1f821e,_0x1476a7[_0xf7db('0x36')],_0x35f247);_0x4476b9[_0x5e2031](_0x392d55['text'],_0x392d55[_0xf7db('0x66')][_0xf7db('0x6e')],_0x392d55[_0xf7db('0x66')][_0xf7db('0x1f')]);}}}else{var _0x5838e0=_(_0x1f7c17['query'])[_0xf7db('0x3a')]()['map'](function(_0x3b86d0){return _[_0xf7db('0x77')](_0x4be2d7,['name',_0x3b86d0])?_0x3b86d0:undefined;})[_0xf7db('0x78')]()['value']();if(!_[_0xf7db('0x79')](_0x5838e0)){_0x5838e0[_0xf7db('0x32')](function(_0x2925f4){if(_0x2925f4===_0xf7db('0x7a')){_0x4bc630[_0xf7db('0x45')](_0xf7db('0x7b'),[][_0xf7db('0x7c')](_0x1f7c17[_0xf7db('0x39')][_0x2925f4]));}else if(_0x2925f4===_0xf7db('0x7d')){var _0x353c2d=JSON[_0xf7db('0x7e')](_0x1f7c17[_0xf7db('0x39')][_0x2925f4])[_0xf7db('0x7f')];var _0x47f8d4=JSON[_0xf7db('0x7e')](_0x1f7c17[_0xf7db('0x39')][_0x2925f4])[_0xf7db('0x80')];_0x4bc630[_0xf7db('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x353c2d,_0x47f8d4);}else{if(_0x1f7c17['query'][_0x2925f4]===_0xf7db('0x81')){_0x4bc630[_0xf7db('0x45')]('i.'+_0x2925f4+_0xf7db('0x82'));}else{_0x4bc630['where']('i.'+_0x2925f4+'\x20=\x20?',_0x1f7c17[_0xf7db('0x39')][_0x2925f4]);}}});}if(_0x1f7c17['query'][_0xf7db('0x83')]){if(_0x1f7c17[_0xf7db('0x39')]['read']==0x1){_0x4bc630['having'](_0xf7db('0x84'));}else{_0x4bc630[_0xf7db('0x61')](_0xf7db('0x85'));}}if(_0x1f7c17[_0xf7db('0x39')][_0xf7db('0x86')]){_0x3e66ba=_['isArray'](_0x1f7c17[_0xf7db('0x39')][_0xf7db('0x86')])?_0x1f7c17[_0xf7db('0x39')][_0xf7db('0x86')]:new Array(_0x1f7c17[_0xf7db('0x39')]['tag']);_0x3e66ba['forEach'](function(_0x326bb4){_0x2efc8d['or'](_0xf7db('0x70'),'%,'+_0x326bb4+',%');});}if(_0x1f7c17['query'][_0xf7db('0x87')]){var _0xd0c39e=_0x1f7c17[_0xf7db('0x39')][_0xf7db('0x87')][_0xf7db('0x88')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xf7db('0x89')](_0xd0c39e)){_0x4476b9['or'](_0xf7db('0x8a'),_0xd0c39e+'%')['or'](_0xf7db('0x8b'),_0xd0c39e+'%');}_0x4476b9['or'](_0xf7db('0x8c'),_0xd0c39e+'%');}}_0x4bc630[_0xf7db('0x45')](_0x4476b9);_0x4bc630[_0xf7db('0x8d')](_0xf7db('0x8e'));var _0x346c79={'type':db['Sequelize'][_0xf7db('0x8f')][_0xf7db('0x90')],'raw':!![]};var _0x4d7de7=_0x4bc630[_0xf7db('0x91')]();_0x4d7de7[_0xf7db('0x48')](_0xf7db('0x8e'));_0x4d7de7['field'](_0xf7db('0x92'),_0xf7db('0x60'));if(_0x50af4d[_0xf7db('0x43')]){_0x50af4d[_0xf7db('0x43')][_0xf7db('0x32')](function(_0x6e18cd){var _0x351244=_0x6e18cd[0x0]===_0xf7db('0x93')?_0x6e18cd[0x0]:'i.'+_0x6e18cd[0x0];_0x4bc630[_0xf7db('0x43')](_0x351244,_0x6e18cd[0x1]===_0xf7db('0x94')?![]:!![]);});}if(!_['isEmpty'](_0x3e66ba)){_0x4bc630[_0xf7db('0x61')](_0x2efc8d);_0x4d7de7[_0xf7db('0x45')](_0xf7db('0x95'),_0x3e66ba);}BPromise[_0xf7db('0x96')]()[_0xf7db('0x28')](function(){if(!_0x2de865){if(_0x1f7c17[_0xf7db('0x39')]['FaxAccountId'])return;_0x4d7de7['where'](_0xf7db('0x97'));_0x4bc630['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x1f7c17['user'][_0xf7db('0x98')]!=='agent')return;return _0x1f7c17[_0xf7db('0x99')][_0xf7db('0x9a')]({'attributes':['id'],'raw':!![]})[_0xf7db('0x28')](function(_0x10bc2e){if(_[_0xf7db('0x79')](_0x10bc2e)){_0x4d7de7[_0xf7db('0x45')]('i.FaxAccountId\x20IS\x20NULL');_0x4bc630[_0xf7db('0x45')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x4d7de7[_0xf7db('0x45')](_0xf7db('0x7b'),_[_0xf7db('0x2e')](_0x10bc2e,'id'));_0x4bc630[_0xf7db('0x45')]('i.FaxAccountId\x20IN\x20?',_[_0xf7db('0x2e')](_0x10bc2e,'id'));}});})[_0xf7db('0x28')](function(){if(_0x1f7c17['user'][_0xf7db('0x98')]===_0xf7db('0x9b')&&!_0x2de865&&!_0x1f7c17[_0xf7db('0x39')][_0xf7db('0x7a')])return[];return db[_0xf7db('0x9c')][_0xf7db('0x39')](_0x4d7de7[_0xf7db('0x9d')](),_0x346c79);})[_0xf7db('0x28')](function(_0x563c10){_0x4ef090[_0xf7db('0x9e')]=_0x563c10[_0xf7db('0x3f')];if(_0x4ef090[_0xf7db('0x9e')]===0x0)return[];return db['sequelize']['query'](_0x57d1d4['toString'](),_0x346c79)[_0xf7db('0x28')](function(_0x3745b1){_0x3bb50d=_['keyBy'](_0x3745b1,'id');_0x346c79=_[_0xf7db('0x9f')](_0x346c79,{'model':db[_0xf7db('0xa0')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1f7c17[_0xf7db('0x39')][_0xf7db('0x3d')]){_0x50af4d[_0xf7db('0x3e')][_0xf7db('0x32')](function(_0x2682b4){_0x4bc630[_0xf7db('0x48')]('i.'+_0x2682b4);});}else{_0x4bc630[_0xf7db('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf7db('0x60'));_0x4bc630[_0xf7db('0x48')](_0xf7db('0xa1'),_0xf7db('0xa2'));_0x4bc630[_0xf7db('0x48')](_0xf7db('0xa3'),_0xf7db('0xa4'));_0x4bc630[_0xf7db('0x48')](_0xf7db('0xa5'),'contactName');_0x4bc630[_0xf7db('0x48')](_0xf7db('0xa6'));_0x4bc630[_0xf7db('0x48')](_0xf7db('0xa7'),_0xf7db('0xa8'));_0x4bc630[_0xf7db('0x48')](_0xf7db('0xa9'),'Contact.lastName');_0x4bc630[_0xf7db('0x48')](_0xf7db('0xaa'),_0xf7db('0xab'));_0x4bc630[_0xf7db('0x48')](_0xf7db('0xac'),_0xf7db('0xad'));_0x4bc630[_0xf7db('0x48')](_0xf7db('0xae'),_0xf7db('0xaf'));_0x4bc630[_0xf7db('0x48')]('c.fax',_0xf7db('0xb0'));_0x4bc630[_0xf7db('0x48')](_0xf7db('0xb1'),_0xf7db('0xb2'));_0x4bc630['field'](_0xf7db('0xb3'),_0xf7db('0xb4'));_0x4bc630[_0xf7db('0x48')](_0xf7db('0xb5'),_0xf7db('0x30'));}if(_0x50af4d['limit'])_0x4bc630[_0xf7db('0x42')](_0x50af4d['limit']);if(_0x50af4d[_0xf7db('0x21')])_0x4bc630[_0xf7db('0x21')](_0x50af4d[_0xf7db('0x21')]);return db['sequelize'][_0xf7db('0x39')](_0x4bc630[_0xf7db('0x9d')](),_0x346c79);})[_0xf7db('0x28')](function(_0x451f9b){if(_0x451f9b[_0xf7db('0x3f')]>0x0)_0x20f556[_0xf7db('0x45')](_0xf7db('0xb6'),_[_0xf7db('0x2e')](_0x451f9b,'id'));return db[_0xf7db('0x9c')][_0xf7db('0x39')](_0x20f556[_0xf7db('0x9d')](),_0x346c79)[_0xf7db('0x28')](function(_0x524b3f){var _0x7cea7a=_[_0xf7db('0xb7')](_0x524b3f,_0xf7db('0xb8'));var _0x2d4753=[];_0x451f9b[_0xf7db('0x32')](function(_0x349180){_0x2d4753[_0xf7db('0x33')](updateFaxInteraction(_0x349180,_0x3bb50d,_0x7cea7a));});return BPromise[_0xf7db('0xb9')](_0x2d4753);});});})[_0xf7db('0x28')](function(_0x2b6608){_0x4ef090['rows']=_0x2b6608;return _0x4ef090;})[_0xf7db('0x28')](respondWithFilteredResult(_0x3188ae,_0x50af4d))[_0xf7db('0x34')](handleError(_0x3188ae,null));};exports[_0xf7db('0xba')]=function(_0x820f44,_0x207e88){var _0xb1d77a={'raw':![],'where':{'id':_0x820f44['params']['id']}},_0x3bf155={};_0x3bf155[_0xf7db('0x38')]=_[_0xf7db('0x3a')](db['FaxInteraction']['rawAttributes']);_0x3bf155['query']=_['keys'](_0x820f44[_0xf7db('0x39')]);_0x3bf155[_0xf7db('0x3b')]=_[_0xf7db('0x3c')](_0x3bf155[_0xf7db('0x38')],_0x3bf155[_0xf7db('0x39')]);_0xb1d77a[_0xf7db('0x3e')]=_['intersection'](_0x3bf155[_0xf7db('0x38')],qs['fields'](_0x820f44['query']['fields']));_0xb1d77a['attributes']=_0xb1d77a[_0xf7db('0x3e')][_0xf7db('0x3f')]?_0xb1d77a[_0xf7db('0x3e')]:_0x3bf155['model'];if(_0x820f44['query'][_0xf7db('0xbb')]){_0xb1d77a[_0xf7db('0xbc')]=[{'all':!![]}];}_0xb1d77a=_['merge']({},_0xb1d77a,_0x820f44[_0xf7db('0xbd')]);return db['FaxInteraction'][_0xf7db('0x5f')](_0xb1d77a)[_0xf7db('0x28')](handleEntityNotFound(_0x207e88,null))[_0xf7db('0x28')](respondWithResult(_0x207e88,null))['catch'](handleError(_0x207e88,null));};exports[_0xf7db('0xbe')]=function(_0x21eb45,_0x4d7461){return db[_0xf7db('0xa0')][_0xf7db('0xbe')](_0x21eb45['body'],{})[_0xf7db('0x28')](respondWithResult(_0x4d7461,0xc9))[_0xf7db('0x34')](handleError(_0x4d7461,null));};exports[_0xf7db('0x27')]=function(_0x1f3e93,_0x4d52a4){if(_0x1f3e93['body']['id']){delete _0x1f3e93[_0xf7db('0x76')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x1f3e93[_0xf7db('0xbf')]['id']}})[_0xf7db('0x28')](handleEntityNotFound(_0x4d52a4,null))['then'](saveUpdates(_0x1f3e93[_0xf7db('0x76')],null))[_0xf7db('0x28')](respondWithResult(_0x4d52a4,null))[_0xf7db('0x34')](handleError(_0x4d52a4,null));};exports[_0xf7db('0x29')]=function(_0x3a0596,_0x3ca23f){return db[_0xf7db('0xa0')][_0xf7db('0x5f')]({'where':{'id':_0x3a0596[_0xf7db('0xbf')]['id']}})['then'](handleEntityNotFound(_0x3ca23f,null))['then'](removeEntity(_0x3ca23f,null))[_0xf7db('0x34')](handleError(_0x3ca23f,null));};exports['describe']=function(_0x3a550c,_0x35d908){return db[_0xf7db('0xa0')][_0xf7db('0xc0')]()[_0xf7db('0x28')](respondWithResult(_0x35d908,null))[_0xf7db('0x34')](handleError(_0x35d908,null));};exports[_0xf7db('0xc1')]=function(_0x58830c,_0x2ffef1,_0x36dbcd){return db['FaxMessage']['find']({'where':{'id':_0x58830c[_0xf7db('0xbf')]['id']}})[_0xf7db('0x28')](handleEntityNotFound(_0x2ffef1,null))[_0xf7db('0x28')](function(_0xd3483c){if(_0xd3483c){return _0xd3483c[_0xf7db('0xc1')](_0x58830c[_0xf7db('0x76')][_0xf7db('0xc2')],_[_0xf7db('0xc3')](_0x58830c[_0xf7db('0x76')],[_0xf7db('0xc2'),'id'])||{});}})[_0xf7db('0x28')](respondWithResult(_0x2ffef1,null))[_0xf7db('0x34')](handleError(_0x2ffef1,null));};exports[_0xf7db('0xc4')]=function(_0x3e871b,_0x555de1,_0x5932c5){var _0x49fb2a={'raw':![],'where':{}};var _0x3a3f20={};var _0x521561={'count':0x0,'rows':[]};return db[_0xf7db('0xa0')][_0xf7db('0xc5')]({'where':{'id':_0x3e871b['params']['id']}})['then'](handleEntityNotFound(_0x555de1,null))['then'](function(_0x45883e){if(_0x45883e){_0x3a3f20[_0xf7db('0x38')]=_[_0xf7db('0x3a')](db[_0xf7db('0xc6')]['rawAttributes']);_0x3a3f20['query']=_['keys'](_0x3e871b[_0xf7db('0x39')]);_0x3a3f20[_0xf7db('0x3b')]=_[_0xf7db('0x3c')](_0x3a3f20[_0xf7db('0x38')],_0x3a3f20[_0xf7db('0x39')]);_0x49fb2a[_0xf7db('0x3e')]=_[_0xf7db('0x3c')](_0x3a3f20[_0xf7db('0x38')],qs['fields'](_0x3e871b['query']['fields']));_0x49fb2a[_0xf7db('0x3e')]=_0x49fb2a[_0xf7db('0x3e')]['length']?_0x49fb2a[_0xf7db('0x3e')]:_0x3a3f20[_0xf7db('0x38')];if(!_0x3e871b[_0xf7db('0x39')][_0xf7db('0x40')](_0xf7db('0x41'))){_0x49fb2a[_0xf7db('0x42')]=qs[_0xf7db('0x42')](_0x3e871b['query'][_0xf7db('0x42')]);_0x49fb2a[_0xf7db('0x21')]=qs['offset'](_0x3e871b[_0xf7db('0x39')]['offset']);}_0x49fb2a[_0xf7db('0x43')]=qs[_0xf7db('0x44')](_0x3e871b[_0xf7db('0x39')][_0xf7db('0x44')]);_0x49fb2a['where']=qs[_0xf7db('0x3b')](_[_0xf7db('0x46')](_0x3e871b[_0xf7db('0x39')],_0x3a3f20['filters']));_0x49fb2a[_0xf7db('0x45')][_0xf7db('0xb8')]=_0x45883e['id'];if(_0x3e871b['query'][_0xf7db('0x87')]){_0x49fb2a[_0xf7db('0x45')]=_[_0xf7db('0x9f')](_0x49fb2a[_0xf7db('0x45')],{'$or':_[_0xf7db('0x2e')](_0x49fb2a[_0xf7db('0x3e')],function(_0x346747){var _0x2b468c={};_0x2b468c[_0x346747]={'$like':'%'+_0x3e871b['query'][_0xf7db('0x87')]+'%'};return _0x2b468c;})});}if(_0x3e871b['query'][_0xf7db('0x7f')]){var _0x5d8609=_0x3e871b[_0xf7db('0x39')][_0xf7db('0x7f')]['split'](',');var _0x5ad3ca={};_0x5ad3ca[_0x5d8609[0x0]]={'$gte':moment(_0x5d8609[0x1])[_0xf7db('0xc7')]('YYYY-MM-DD\x20HH:mm:ss')};_0x49fb2a[_0xf7db('0x45')]=_[_0xf7db('0x9f')](_0x49fb2a[_0xf7db('0x45')],_0x5ad3ca);}_0x49fb2a=_[_0xf7db('0x9f')]({},_0x49fb2a,_0x3e871b[_0xf7db('0xbd')]);return db['FaxMessage'][_0xf7db('0x9e')]({'where':_0x49fb2a[_0xf7db('0x45')]})['then'](function(_0x19bd11){_0x521561[_0xf7db('0x9e')]=_0x19bd11;if(_0x3e871b[_0xf7db('0x39')]['includeAll']){_0x49fb2a['include']=[{'all':!![]}];}return db[_0xf7db('0xc6')][_0xf7db('0xc8')](_0x49fb2a);})[_0xf7db('0x28')](function(_0x22d3b7){_0x521561[_0xf7db('0xc9')]=_0x22d3b7;return _0x521561;});}})[_0xf7db('0x28')](respondWithFilteredResult(_0x555de1,_0x49fb2a))[_0xf7db('0x34')](handleError(_0x555de1,null));};exports['addTags']=function(_0x58bd25,_0x4b2d0d,_0x4a190a){return db[_0xf7db('0xa0')][_0xf7db('0x5f')]({'where':{'id':_0x58bd25[_0xf7db('0xbf')]['id']}})[_0xf7db('0x28')](handleEntityNotFound(_0x4b2d0d,null))['then'](function(_0x3aa993){if(_0x3aa993){return _0x3aa993[_0xf7db('0xca')](_0x58bd25[_0xf7db('0x76')]['ids'],_['omit'](_0x58bd25[_0xf7db('0x76')],['ids','id'])||{})[_0xf7db('0xcb')](function(){return db[_0xf7db('0x6f')][_0xf7db('0xc8')]({'attributes':['id',_0xf7db('0x2c'),_0xf7db('0x49')],'where':{'id':_0x58bd25[_0xf7db('0x76')][_0xf7db('0xc2')]}});})['then'](function(_0x590fcd){socket[_0xf7db('0xcc')](_0xf7db('0xcd'),{'id':Number(_0x58bd25[_0xf7db('0xbf')]['id']),'tags':_0x590fcd||[]});return{'id':Number(_0x58bd25[_0xf7db('0xbf')]['id']),'tags':_0x590fcd||[]};});}})['then'](respondWithResult(_0x4b2d0d,null))[_0xf7db('0x34')](handleError(_0x4b2d0d,null));};exports[_0xf7db('0xce')]=function(_0x219a10,_0x20d737,_0x468c44){return db[_0xf7db('0xa0')][_0xf7db('0x5f')]({'where':{'id':_0x219a10[_0xf7db('0xbf')]['id']}})[_0xf7db('0x28')](handleEntityNotFound(_0x20d737,null))[_0xf7db('0x28')](function(_0xd33848){if(_0xd33848){return _0xd33848[_0xf7db('0xce')](_0x219a10[_0xf7db('0x39')][_0xf7db('0xc2')]);}})['then'](respondWithStatusCode(_0x20d737,null))[_0xf7db('0x34')](handleError(_0x20d737,null));};exports[_0xf7db('0xcf')]=function(_0x4fed70,_0x547829){var _0x7ca184=moment()['unix']()['toString']();var _0x3e46b8=path[_0xf7db('0xd0')](config[_0xf7db('0xd1')],_0xf7db('0xd2'),_0xf7db('0xd3'),_0xf7db('0xd4'));var _0x2ab928=path[_0xf7db('0xd0')](config[_0xf7db('0xd1')],_0xf7db('0xd2'),_0xf7db('0xd3'),_0xf7db('0xd5'));var _0x2cf325=path[_0xf7db('0xd0')](_0x3e46b8,_0x7ca184);var _0x4aa2e8=util[_0xf7db('0xc7')](_0xf7db('0xd6'),_0x4fed70[_0xf7db('0xbf')]['id'],_0x7ca184);var _0x2894eb=path[_0xf7db('0xd0')](_0x3e46b8,_0x4aa2e8);var _0xb3bcab=[];_0xb3bcab['push']({'model':db[_0xf7db('0xd7')],'as':'Attachment','raw':!![]});var _0x27b21a=[{'model':db['FaxMessage'],'as':_0xf7db('0xd8'),'attributes':['id','body',_0xf7db('0x7d')],'include':_0xb3bcab}];return db[_0xf7db('0xa0')][_0xf7db('0x5f')]({'where':{'id':_0x4fed70[_0xf7db('0xbf')]['id']},'include':_0x27b21a})[_0xf7db('0x28')](handleEntityNotFound(_0x547829,null))[_0xf7db('0x28')](function(_0x113c8d){if(_0x113c8d&&_0x113c8d[_0xf7db('0xd8')]){var _0x5bddab=_0x113c8d[_0xf7db('0xd9')]({'plain':!![]});fs['mkdirSync'](_0x2cf325);for(var _0x459543=0x0;_0x459543<_0x5bddab['Messages'][_0xf7db('0x3f')];_0x459543++){var _0xb79e3d=_0x5bddab['Messages'][_0x459543][_0xf7db('0xd7')];if(_0xb79e3d){var _0x5d453a=path[_0xf7db('0xd0')](_0x2ab928,_0xb79e3d[_0xf7db('0xda')]);if(fs['existsSync'](_0x5d453a)){fs[_0xf7db('0xdb')](_0x5d453a)[_0xf7db('0xdc')](fs[_0xf7db('0xdd')](path[_0xf7db('0xd0')](_0x2cf325,_0xb79e3d[_0xf7db('0xda')])));}}}return BPromise[_0xf7db('0x96')]()[_0xf7db('0x28')](function(){return new BPromise(function(_0x1dcea4,_0x30d00f){zipdir(_0x2cf325,{'saveTo':_0x2894eb},function(_0x2a4824,_0x3b4277){if(_0x2a4824)return _0x30d00f(_0x2a4824);return _0x1dcea4(_0x3b4277);});})[_0xf7db('0x28')](function(){return new BPromise(function(_0x1eea76,_0xd1b16d){rimraf(_0x2cf325,function(_0x401d49){if(_0x401d49)_0xd1b16d(_0x401d49);return _0x1eea76();});});})[_0xf7db('0x28')](function(){return _0x547829[_0xf7db('0xcf')](_0x2894eb,_0x4aa2e8,function(_0x4b9ec7){if(_0x4b9ec7){console[_0xf7db('0xde')](_0xf7db('0xdf'),_0x4b9ec7);}else{fs['unlinkSync'](_0x2894eb);}});});});}else{return _0x547829[_0xf7db('0x1d')](0xc8);}})['catch'](handleError(_0x547829,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 6fe3f9c..8360829 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 _0x82f4=['hasOwnProperty','hook','../../mysqldb','FaxMessage','setMaxListeners','save','update','getUsers','then','setDataValue','map','findAll','length','emit','catch'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x82f4,0x98));var _0x482f=function(_0x4fef8b,_0x4d1704){_0x4fef8b=_0x4fef8b-0x0;var _0x3a8d8b=_0x82f4[_0x4fef8b];return _0x3a8d8b;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x482f('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0x482f('0x0'))['db'][_0x482f('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x482f('0x2')](0x0);var events={'afterCreate':_0x482f('0x3'),'afterUpdate':_0x482f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x20a342){return function(_0x41680a,_0x4eb6f7,_0x5b593b){_0x41680a[_0x482f('0x5')]({'attributes':['id'],'raw':!![]})[_0x482f('0x6')](function(_0x4c4973){_0x41680a[_0x482f('0x7')]('Users',_0x4c4973[_0x482f('0x8')](function(_0xd633ee){return{'id':_0xd633ee['id']};}));return FaxMessage[_0x482f('0x9')]({'where':{'FaxInteractionId':_0x41680a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x519050){_0x41680a[_0x482f('0x7')]('unreadMessages',_0x519050[_0x482f('0xa')]);FaxInteractionEvents[_0x482f('0xb')](_0x20a342+':'+_0x41680a['id'],_0x41680a);FaxInteractionEvents[_0x482f('0xb')](_0x20a342,_0x41680a);_0x5b593b(null);})[_0x482f('0xc')](_0x5b593b(null));};}for(var e in events){if(events[_0x482f('0xd')](e)){var event=events[e];FaxInteraction[_0x482f('0xe')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x8486=['exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','findAll','then','unreadMessages','emit','hasOwnProperty','hook'];(function(_0x2efb11,_0x213f70){var _0x29bb11=function(_0x234f65){while(--_0x234f65){_0x2efb11['push'](_0x2efb11['shift']());}};_0x29bb11(++_0x213f70);}(_0x8486,0x100));var _0x6848=function(_0x27e10d,_0x1d5e2c){_0x27e10d=_0x27e10d-0x0;var _0x1c477b=_0x8486[_0x27e10d];return _0x1c477b;};'use strict';var EventEmitter=require(_0x6848('0x0'));var FaxInteraction=require(_0x6848('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x6848('0x1'))['db'][_0x6848('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x6848('0x3')](0x0);var events={'afterCreate':_0x6848('0x4'),'afterUpdate':_0x6848('0x5'),'afterDestroy':_0x6848('0x6')};function emitEvent(_0x928772){return function(_0x58b5fe,_0x2c51f1,_0x1462b2){_0x58b5fe[_0x6848('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5bad94){_0x58b5fe[_0x6848('0x8')](_0x6848('0x9'),_0x5bad94['map'](function(_0x5b6d11){return{'id':_0x5b6d11['id']};}));return FaxMessage[_0x6848('0xa')]({'where':{'FaxInteractionId':_0x58b5fe['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6848('0xb')](function(_0x3e09e9){_0x58b5fe[_0x6848('0x8')](_0x6848('0xc'),_0x3e09e9['length']);FaxInteractionEvents[_0x6848('0xd')](_0x928772+':'+_0x58b5fe['id'],_0x58b5fe);FaxInteractionEvents[_0x6848('0xd')](_0x928772,_0x58b5fe);_0x1462b2(null);})['catch'](_0x1462b2(null));};}for(var e in events){if(events[_0x6848('0xe')](e)){var event=events[e];FaxInteraction[_0x6848('0xf')](e,emitEvent(event));}}module[_0x6848('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 1f71cc4..caa22c1 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 _0x8d92=['bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x11beb7,_0x2d32c7){var _0x357aa2=function(_0x4ac79f){while(--_0x4ac79f){_0x11beb7['push'](_0x11beb7['shift']());}};_0x357aa2(++_0x2d32c7);}(_0x8d92,0x13c));var _0x28d9=function(_0x507527,_0x3d1f6e){_0x507527=_0x507527-0x0;var _0x2dec80=_0x8d92[_0x507527];return _0x2dec80;};'use strict';var _=require(_0x28d9('0x0'));var util=require(_0x28d9('0x1'));var logger=require(_0x28d9('0x2'))(_0x28d9('0x3'));var moment=require('moment');var BPromise=require(_0x28d9('0x4'));var rp=require(_0x28d9('0x5'));var fs=require('fs');var path=require(_0x28d9('0x6'));var rimraf=require(_0x28d9('0x7'));var config=require(_0x28d9('0x8'));var attributes=require(_0x28d9('0x9'));module[_0x28d9('0xa')]=function(_0x37069f,_0x182d0b){return _0x37069f[_0x28d9('0xb')](_0x28d9('0xc'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x50c129,_0x208b9c,_0x338765){if(_0x50c129[_0x28d9('0xd')](_0x28d9('0xe'))){_0x50c129['closedAt']=moment()['format'](_0x28d9('0xf'));}_0x338765(null,_0x50c129);}}});}; \ No newline at end of file +var _0xc025=['bluebird','request-promise','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closedAt','format','lodash','../../config/logger','moment'];(function(_0x3f2a44,_0xf70f4b){var _0x50d3cb=function(_0x4f896d){while(--_0x4f896d){_0x3f2a44['push'](_0x3f2a44['shift']());}};_0x50d3cb(++_0xf70f4b);}(_0xc025,0x169));var _0x5c02=function(_0x26803d,_0x2d71a2){_0x26803d=_0x26803d-0x0;var _0x3b5a2e=_0xc025[_0x26803d];return _0x3b5a2e;};'use strict';var _=require(_0x5c02('0x0'));var util=require('util');var logger=require(_0x5c02('0x1'))('api');var moment=require(_0x5c02('0x2'));var BPromise=require(_0x5c02('0x3'));var rp=require(_0x5c02('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5c02('0x5'));var attributes=require(_0x5c02('0x6'));module['exports']=function(_0x1f9dd5,_0x44256d){return _0x1f9dd5[_0x5c02('0x7')](_0x5c02('0x8'),attributes,{'tableName':_0x5c02('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3adf86,_0x5a1363,_0x1c39de){if(_0x3adf86[_0x5c02('0xa')]('closed')){_0x3adf86[_0x5c02('0xb')]=moment()[_0x5c02('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1c39de(null,_0x3adf86);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 10b1808..a622d36 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 _0xe552=['redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x5ea489,_0x4ec72a){var _0x1cd414=function(_0x2b6fbd){while(--_0x2b6fbd){_0x5ea489['push'](_0x5ea489['shift']());}};_0x1cd414(++_0x4ec72a);}(_0xe552,0x1b7));var _0x2e55=function(_0x2e4b5d,_0x2d8d76){_0x2e4b5d=_0x2e4b5d-0x0;var _0x4cc52e=_0xe552[_0x2e4b5d];return _0x4cc52e;};'use strict';var _=require(_0x2e55('0x0'));var util=require(_0x2e55('0x1'));var moment=require(_0x2e55('0x2'));var BPromise=require(_0x2e55('0x3'));var rs=require(_0x2e55('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e55('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e55('0x6'))('rpc');var config=require(_0x2e55('0x7'));var jayson=require(_0x2e55('0x8'));var client=jayson[_0x2e55('0x9')][_0x2e55('0xa')]({'port':0x232a});config[_0x2e55('0xb')]=_[_0x2e55('0xc')](config[_0x2e55('0xb')],{'host':_0x2e55('0xd'),'port':0x18eb});var socket=require(_0x2e55('0xe'))(new Redis(config[_0x2e55('0xb')]));require(_0x2e55('0xf'))[_0x2e55('0x10')](socket);function respondWithRpcPromise(_0x230940,_0x27608b,_0x5c92ad){return new BPromise(function(_0x111c79,_0x5eacf0){return client[_0x2e55('0x11')](_0x230940,_0x5c92ad)['then'](function(_0x2cf0fc){logger['info'](_0x2e55('0x12'),_0x27608b,_0x2e55('0x13'));logger[_0x2e55('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x27608b,'request\x20sent',JSON[_0x2e55('0x15')](_0x2cf0fc));if(_0x2cf0fc[_0x2e55('0x16')]){if(_0x2cf0fc[_0x2e55('0x16')][_0x2e55('0x17')]===0x1f4){logger[_0x2e55('0x16')](_0x2e55('0x12'),_0x27608b,_0x2cf0fc[_0x2e55('0x16')]['message']);return _0x5eacf0(_0x2cf0fc[_0x2e55('0x16')][_0x2e55('0x18')]);}logger['error'](_0x2e55('0x12'),_0x27608b,_0x2cf0fc[_0x2e55('0x16')][_0x2e55('0x18')]);return _0x111c79(_0x2cf0fc[_0x2e55('0x16')][_0x2e55('0x18')]);}else{logger[_0x2e55('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x27608b,'request\x20sent');_0x111c79(_0x2cf0fc[_0x2e55('0x1a')][_0x2e55('0x18')]);}})[_0x2e55('0x1b')](function(_0x3ba44f){logger[_0x2e55('0x16')](_0x2e55('0x12'),_0x27608b,_0x3ba44f);_0x5eacf0(_0x3ba44f);});});}exports[_0x2e55('0x1c')]=function(_0x8b6d5d){var _0x1eeda6=this;return new Promise(function(_0xb5998d,_0x2c4f59){return db[_0x2e55('0x1d')][_0x2e55('0x1e')](_0x8b6d5d[_0x2e55('0x1f')],{'raw':_0x8b6d5d[_0x2e55('0x20')]?_0x8b6d5d[_0x2e55('0x20')][_0x2e55('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8b6d5d[_0x2e55('0x20')]?_0x8b6d5d[_0x2e55('0x20')][_0x2e55('0x22')]||null:null,'attributes':_0x8b6d5d['options']?_0x8b6d5d['options'][_0x2e55('0x23')]||null:null,'limit':_0x8b6d5d[_0x2e55('0x20')]?_0x8b6d5d[_0x2e55('0x20')][_0x2e55('0x24')]||null:null})[_0x2e55('0x25')](function(_0x427e1c){logger[_0x2e55('0x19')](_0x2e55('0x1c'),_0x8b6d5d);logger[_0x2e55('0x14')](_0x2e55('0x1c'),_0x8b6d5d,JSON[_0x2e55('0x15')](_0x427e1c));_0xb5998d(_0x427e1c);})['catch'](function(_0x15b451){logger[_0x2e55('0x16')](_0x2e55('0x1c'),_0x15b451[_0x2e55('0x18')],_0x8b6d5d);_0x2c4f59(_0x1eeda6[_0x2e55('0x16')](0x1f4,_0x15b451[_0x2e55('0x18')]));});});};exports[_0x2e55('0x26')]=function(_0x19fe5a){return new Promise(function(_0x2d45ec,_0x5dfed3){return db[_0x2e55('0x1d')][_0x2e55('0x27')]({'where':_0x19fe5a[_0x2e55('0x20')]?_0x19fe5a[_0x2e55('0x20')][_0x2e55('0x22')]||null:null})[_0x2e55('0x25')](function(_0x3d150d){if(_0x3d150d){return _0x3d150d[_0x2e55('0x28')](_0x19fe5a[_0x2e55('0x1f')][_0x2e55('0x29')],_[_0x2e55('0x2a')](_0x19fe5a[_0x2e55('0x1f')],[_0x2e55('0x29'),'id'])||{});}})[_0x2e55('0x2b')](function(_0x2d5725){logger[_0x2e55('0x19')](_0x2e55('0x2c'),_0x19fe5a);logger[_0x2e55('0x14')]('AddTags',_0x19fe5a,JSON[_0x2e55('0x15')](_0x2d5725));_0x2d45ec(_0x2d5725);})['catch'](function(_0x4b9028){logger[_0x2e55('0x16')](_0x2e55('0x2c'),_0x4b9028[_0x2e55('0x18')],_0x19fe5a);_0x5dfed3(_this[_0x2e55('0x16')](0x1f4,_0x4b9028[_0x2e55('0x18')]));});});}; \ No newline at end of file +var _0xb621=['request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','limit','AddTagsToFaxInteraction','find','where','addTags','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','FaxInteraction,\x20%s,\x20%s'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xb621,0xee));var _0x1b62=function(_0x4471d2,_0x4461ec){_0x4471d2=_0x4471d2-0x0;var _0x113c9e=_0xb621[_0x4471d2];return _0x113c9e;};'use strict';var _=require(_0x1b62('0x0'));var util=require(_0x1b62('0x1'));var moment=require(_0x1b62('0x2'));var BPromise=require(_0x1b62('0x3'));var rs=require(_0x1b62('0x4'));var fs=require('fs');var Redis=require(_0x1b62('0x5'));var db=require(_0x1b62('0x6'))['db'];var utils=require(_0x1b62('0x7'));var logger=require('../../config/logger')(_0x1b62('0x8'));var config=require(_0x1b62('0x9'));var jayson=require(_0x1b62('0xa'));var client=jayson[_0x1b62('0xb')][_0x1b62('0xc')]({'port':0x232a});config[_0x1b62('0xd')]=_[_0x1b62('0xe')](config[_0x1b62('0xd')],{'host':_0x1b62('0xf'),'port':0x18eb});var socket=require(_0x1b62('0x10'))(new Redis(config[_0x1b62('0xd')]));require('./faxInteraction.socket')[_0x1b62('0x11')](socket);function respondWithRpcPromise(_0x32c798,_0x448c01,_0x46a21f){return new BPromise(function(_0x48bca3,_0x4eda39){return client[_0x1b62('0x12')](_0x32c798,_0x46a21f)['then'](function(_0x5384d3){logger['info'](_0x1b62('0x13'),_0x448c01,_0x1b62('0x14'));logger[_0x1b62('0x15')](_0x1b62('0x16'),_0x448c01,_0x1b62('0x14'),JSON[_0x1b62('0x17')](_0x5384d3));if(_0x5384d3[_0x1b62('0x18')]){if(_0x5384d3[_0x1b62('0x18')][_0x1b62('0x19')]===0x1f4){logger[_0x1b62('0x18')](_0x1b62('0x13'),_0x448c01,_0x5384d3['error'][_0x1b62('0x1a')]);return _0x4eda39(_0x5384d3['error'][_0x1b62('0x1a')]);}logger['error'](_0x1b62('0x13'),_0x448c01,_0x5384d3['error'][_0x1b62('0x1a')]);return _0x48bca3(_0x5384d3['error'][_0x1b62('0x1a')]);}else{logger[_0x1b62('0x1b')]('FaxInteraction,\x20%s,\x20%s',_0x448c01,_0x1b62('0x14'));_0x48bca3(_0x5384d3[_0x1b62('0x1c')]['message']);}})[_0x1b62('0x1d')](function(_0x19f103){logger[_0x1b62('0x18')](_0x1b62('0x13'),_0x448c01,_0x19f103);_0x4eda39(_0x19f103);});});}exports[_0x1b62('0x1e')]=function(_0x171149){var _0x4d1ec5=this;return new Promise(function(_0x1f7ccd,_0x11760f){return db[_0x1b62('0x1f')][_0x1b62('0x20')](_0x171149[_0x1b62('0x21')],{'raw':_0x171149[_0x1b62('0x22')]?_0x171149[_0x1b62('0x22')][_0x1b62('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x171149['options']?_0x171149[_0x1b62('0x22')]['where']||null:null,'attributes':_0x171149[_0x1b62('0x22')]?_0x171149[_0x1b62('0x22')]['attributes']||null:null,'limit':_0x171149[_0x1b62('0x22')]?_0x171149[_0x1b62('0x22')][_0x1b62('0x24')]||null:null})['then'](function(_0x1ac436){logger['info']('UpdateFaxInteraction',_0x171149);logger[_0x1b62('0x15')](_0x1b62('0x1e'),_0x171149,JSON[_0x1b62('0x17')](_0x1ac436));_0x1f7ccd(_0x1ac436);})[_0x1b62('0x1d')](function(_0x2ee0f8){logger[_0x1b62('0x18')]('UpdateFaxInteraction',_0x2ee0f8[_0x1b62('0x1a')],_0x171149);_0x11760f(_0x4d1ec5[_0x1b62('0x18')](0x1f4,_0x2ee0f8[_0x1b62('0x1a')]));});});};exports[_0x1b62('0x25')]=function(_0x464585){return new Promise(function(_0x4316c2,_0x596be4){return db['FaxInteraction'][_0x1b62('0x26')]({'where':_0x464585[_0x1b62('0x22')]?_0x464585[_0x1b62('0x22')][_0x1b62('0x27')]||null:null})['then'](function(_0x45f815){if(_0x45f815){return _0x45f815[_0x1b62('0x28')](_0x464585[_0x1b62('0x21')][_0x1b62('0x29')],_['omit'](_0x464585[_0x1b62('0x21')],[_0x1b62('0x29'),'id'])||{});}})['spread'](function(_0x2b6560){logger['info'](_0x1b62('0x2a'),_0x464585);logger[_0x1b62('0x15')](_0x1b62('0x2a'),_0x464585,JSON['stringify'](_0x2b6560));_0x4316c2(_0x2b6560);})[_0x1b62('0x1d')](function(_0x10622d){logger[_0x1b62('0x18')](_0x1b62('0x2a'),_0x10622d[_0x1b62('0x1a')],_0x464585);_0x596be4(_this[_0x1b62('0x18')](0x1f4,_0x10622d['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 597149d..910e06b 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 _0x5a02=['./faxInteraction.events','save','remove','update','removeListener','register','length','faxInteraction:'];(function(_0x434138,_0x74656){var _0x40ebdd=function(_0x2b8c41){while(--_0x2b8c41){_0x434138['push'](_0x434138['shift']());}};_0x40ebdd(++_0x74656);}(_0x5a02,0x100));var _0x25a0=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x5a02[_0x235482];return _0x5f5bea;};'use strict';var FaxInteractionEvents=require(_0x25a0('0x0'));var events=[_0x25a0('0x1'),_0x25a0('0x2'),_0x25a0('0x3')];function createListener(_0xe08e81,_0x4b8179){return function(_0x475d32){_0x4b8179['emit'](_0xe08e81,_0x475d32);};}function removeListener(_0x4170c6,_0x163e17){return function(){FaxInteractionEvents[_0x25a0('0x4')](_0x4170c6,_0x163e17);};}exports[_0x25a0('0x5')]=function(_0x1bb0ba){for(var _0x578a46=0x0,_0x363d6b=events[_0x25a0('0x6')];_0x578a46<_0x363d6b;_0x578a46++){var _0x5b2246=events[_0x578a46];var _0x5d7936=createListener(_0x25a0('0x7')+_0x5b2246,_0x1bb0ba);FaxInteractionEvents['on'](_0x5b2246,_0x5d7936);}}; \ No newline at end of file +var _0x64cc=['./faxInteraction.events','save','remove','update','emit','removeListener','length'];(function(_0x538604,_0x3d9ad3){var _0x183b36=function(_0x20d2d5){while(--_0x20d2d5){_0x538604['push'](_0x538604['shift']());}};_0x183b36(++_0x3d9ad3);}(_0x64cc,0xe7));var _0xc64c=function(_0x181b84,_0x42f8f1){_0x181b84=_0x181b84-0x0;var _0x3f773d=_0x64cc[_0x181b84];return _0x3f773d;};'use strict';var FaxInteractionEvents=require(_0xc64c('0x0'));var events=[_0xc64c('0x1'),_0xc64c('0x2'),_0xc64c('0x3')];function createListener(_0x51a945,_0x388aa1){return function(_0x122e99){_0x388aa1[_0xc64c('0x4')](_0x51a945,_0x122e99);};}function removeListener(_0x55e853,_0x42957b){return function(){FaxInteractionEvents[_0xc64c('0x5')](_0x55e853,_0x42957b);};}exports['register']=function(_0x5b7ffa){for(var _0x331dde=0x0,_0x4bfc2f=events[_0xc64c('0x6')];_0x331dde<_0x4bfc2f;_0x331dde++){var _0x2c53e3=events[_0x331dde];var _0x3f4cad=createListener('faxInteraction:'+_0x2c53e3,_0x5b7ffa);FaxInteractionEvents['on'](_0x2c53e3,_0x3f4cad);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 5bf5430..fb1b3f6 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 _0x9b34=['describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe'];(function(_0x519952,_0x552def){var _0x9bb00f=function(_0x4f18be){while(--_0x4f18be){_0x519952['push'](_0x519952['shift']());}};_0x9bb00f(++_0x552def);}(_0x9b34,0x1c2));var _0x49b3=function(_0x56488f,_0x216de1){_0x56488f=_0x56488f-0x0;var _0x4190e8=_0x9b34[_0x56488f];return _0x4190e8;};'use strict';var multer=require(_0x49b3('0x0'));var util=require(_0x49b3('0x1'));var path=require(_0x49b3('0x2'));var timeout=require(_0x49b3('0x3'));var express=require(_0x49b3('0x4'));var router=express['Router']();var fs_extra=require(_0x49b3('0x5'));var auth=require(_0x49b3('0x6'));var interaction=require(_0x49b3('0x7'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router[_0x49b3('0x8')]('/',auth[_0x49b3('0x9')](),controller[_0x49b3('0xa')]);router[_0x49b3('0x8')](_0x49b3('0xb'),auth[_0x49b3('0x9')](),controller[_0x49b3('0xc')]);router['get'](_0x49b3('0xd'),auth[_0x49b3('0x9')](),controller[_0x49b3('0xe')]);router[_0x49b3('0x8')](_0x49b3('0xf'),auth['isAuthenticated'](),controller[_0x49b3('0x10')]);router[_0x49b3('0x8')](_0x49b3('0x11'),auth['isAuthenticated'](),controller['download']);router[_0x49b3('0x12')]('/',auth[_0x49b3('0x9')](),controller[_0x49b3('0x13')]);router['post'](_0x49b3('0xf'),auth[_0x49b3('0x9')](),controller[_0x49b3('0x14')]);router[_0x49b3('0x12')](_0x49b3('0x15'),auth[_0x49b3('0x9')](),interaction[_0x49b3('0x16')](_0x49b3('0x17'),_0x49b3('0x18')),controller[_0x49b3('0x19')]);router[_0x49b3('0x1a')](_0x49b3('0xd'),auth[_0x49b3('0x9')](),interaction[_0x49b3('0x16')](_0x49b3('0x17'),_0x49b3('0x1b')),controller[_0x49b3('0x1c')]);router['delete'](_0x49b3('0xd'),auth['isAuthenticated'](),interaction[_0x49b3('0x16')]('fax','faxinteraction:destroy'),controller[_0x49b3('0x1d')]);router[_0x49b3('0x1e')](_0x49b3('0x15'),auth[_0x49b3('0x9')](),controller[_0x49b3('0x1f')]);module[_0x49b3('0x20')]=router; \ No newline at end of file +var _0xe0ae=['update','delete','destroy','/:id/tags','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','index','get','/describe','isAuthenticated','show','/:id/messages','getMessages','post','addMessage','tracked','fax','faxinteraction:addtags','addTags','/:id','faxinteraction:update'];(function(_0x540a65,_0x1b75e2){var _0x14dc3e=function(_0x349ab4){while(--_0x349ab4){_0x540a65['push'](_0x540a65['shift']());}};_0x14dc3e(++_0x1b75e2);}(_0xe0ae,0xa1));var _0xee0a=function(_0x552fce,_0x3f24bc){_0x552fce=_0x552fce-0x0;var _0x3e27a2=_0xe0ae[_0x552fce];return _0x3e27a2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee0a('0x0'));var timeout=require(_0xee0a('0x1'));var express=require('express');var router=express[_0xee0a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xee0a('0x3'));var interaction=require(_0xee0a('0x4'));var config=require('../../config/environment');var controller=require(_0xee0a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xee0a('0x6')]);router[_0xee0a('0x7')](_0xee0a('0x8'),auth[_0xee0a('0x9')](),controller['describe']);router[_0xee0a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xee0a('0xa')]);router[_0xee0a('0x7')](_0xee0a('0xb'),auth['isAuthenticated'](),controller[_0xee0a('0xc')]);router[_0xee0a('0x7')]('/:id/download',auth[_0xee0a('0x9')](),controller['download']);router[_0xee0a('0xd')]('/',auth[_0xee0a('0x9')](),controller['create']);router[_0xee0a('0xd')]('/:id/messages',auth[_0xee0a('0x9')](),controller[_0xee0a('0xe')]);router['post']('/:id/tags',auth[_0xee0a('0x9')](),interaction[_0xee0a('0xf')](_0xee0a('0x10'),_0xee0a('0x11')),controller[_0xee0a('0x12')]);router['put'](_0xee0a('0x13'),auth[_0xee0a('0x9')](),interaction['tracked'](_0xee0a('0x10'),_0xee0a('0x14')),controller[_0xee0a('0x15')]);router[_0xee0a('0x16')]('/:id',auth[_0xee0a('0x9')](),interaction[_0xee0a('0xf')](_0xee0a('0x10'),'faxinteraction:destroy'),controller[_0xee0a('0x17')]);router[_0xee0a('0x16')](_0xee0a('0x18'),auth[_0xee0a('0x9')](),controller['removeTags']);module[_0xee0a('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index ea10b54..7501f40 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 _0xe009=['ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x5253c3,_0x3e4a0a){var _0x3c3917=function(_0x51efd7){while(--_0x51efd7){_0x5253c3['push'](_0x5253c3['shift']());}};_0x3c3917(++_0x3e4a0a);}(_0xe009,0x122));var _0x9e00=function(_0x3c5bbf,_0x481d7e){_0x3c5bbf=_0x3c5bbf-0x0;var _0x32b4a3=_0xe009[_0x3c5bbf];return _0x32b4a3;};'use strict';var Sequelize=require(_0x9e00('0x0'));module[_0x9e00('0x1')]={'body':{'type':Sequelize[_0x9e00('0x2')](_0x9e00('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9e00('0x4')]('in','out'),'defaultValue':_0x9e00('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x9e00('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x9e00('0x6')]}}; \ No newline at end of file +var _0x20ce=['ENUM','out','DATE','sequelize','exports','TEXT','BOOLEAN'];(function(_0x4a9204,_0x77a66b){var _0x26428b=function(_0x1923fa){while(--_0x1923fa){_0x4a9204['push'](_0x4a9204['shift']());}};_0x26428b(++_0x77a66b);}(_0x20ce,0x10d));var _0xe20c=function(_0x254a53,_0x46f0e8){_0x254a53=_0x254a53-0x0;var _0x59c2d9=_0x20ce[_0x254a53];return _0x59c2d9;};'use strict';var Sequelize=require(_0xe20c('0x0'));module[_0xe20c('0x1')]={'body':{'type':Sequelize[_0xe20c('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe20c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe20c('0x4')]('in',_0xe20c('0x5')),'defaultValue':_0xe20c('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xe20c('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xe20c('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 6f1d82f..b8a2be3 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 _0x218e=['channel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','QueryTypes','rejectmessage','create','Attachment','findOne','SendFax','basename','AttachmentId','download','join','root','server','files','attachments','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','name','send','index','FaxMessage','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','body','describe','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','User','email','internal','agent','manual','interface','SIP/%s'];(function(_0x467070,_0x393133){var _0x5a5575=function(_0x5881ff){while(--_0x5881ff){_0x467070['push'](_0x467070['shift']());}};_0x5a5575(++_0x393133);}(_0x218e,0x1bc));var _0xe218=function(_0xe75fc8,_0x383a28){_0xe75fc8=_0xe75fc8-0x0;var _0x4b73af=_0x218e[_0xe75fc8];return _0x4b73af;};'use strict';var emlformat=require(_0xe218('0x0'));var rimraf=require(_0xe218('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe218('0x2'));var rp=require(_0xe218('0x3'));var moment=require('moment');var BPromise=require(_0xe218('0x4'));var Mustache=require(_0xe218('0x5'));var util=require('util');var path=require(_0xe218('0x6'));var sox=require(_0xe218('0x7'));var csv=require(_0xe218('0x8'));var ejs=require(_0xe218('0x9'));var fs=require('fs');var fs_extra=require(_0xe218('0xa'));var _=require(_0xe218('0xb'));var squel=require(_0xe218('0xc'));var crypto=require('crypto');var jsforce=require(_0xe218('0xd'));var deskjs=require(_0xe218('0xe'));var toCsv=require(_0xe218('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe218('0xf'));var authService=require(_0xe218('0x10'));var qs=require(_0xe218('0x11'));var as=require(_0xe218('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe218('0x13'))('api');var utils=require(_0xe218('0x14'));var config=require(_0xe218('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe218('0x16'))['db'];config[_0xe218('0x17')]=_[_0xe218('0x18')](config[_0xe218('0x17')],{'host':_0xe218('0x19'),'port':0x18eb});var socket=require(_0xe218('0x1a'))(new Redis(config[_0xe218('0x17')]));require(_0xe218('0x1b'))[_0xe218('0x1c')](socket);var jayson=require(_0xe218('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xe218('0x1e')][_0xe218('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x21a617,_0x5682f9,_0x4d1b09,_0x2660ff){return new BPromise(function(_0x294c9d,_0x1eb165){var _0x4eccfa=_0x2660ff||client;return _0x4eccfa[_0xe218('0x20')](_0x21a617,_0x4d1b09)['then'](function(_0x1e4a69){logger[_0xe218('0x21')](_0xe218('0x22'),_0x5682f9,'request\x20sent');logger['debug'](_0xe218('0x23'),_0x5682f9,'request\x20sent',JSON[_0xe218('0x24')](_0x1e4a69));if(_0x1e4a69[_0xe218('0x25')]){if(_0x1e4a69[_0xe218('0x25')]['code']===0x1f4){logger['error'](_0xe218('0x22'),_0x5682f9,_0x1e4a69[_0xe218('0x25')]['message']);return _0x1eb165(_0x1e4a69[_0xe218('0x25')][_0xe218('0x26')]);}logger[_0xe218('0x25')](_0xe218('0x22'),_0x5682f9,_0x1e4a69[_0xe218('0x25')][_0xe218('0x26')]);return _0x294c9d(_0x1e4a69[_0xe218('0x25')]['message']);}else{logger['info'](_0xe218('0x22'),_0x5682f9,_0xe218('0x27'));_0x294c9d(_0x1e4a69[_0xe218('0x28')][_0xe218('0x26')]);}})['catch'](function(_0x2bff3c){logger[_0xe218('0x25')](_0xe218('0x22'),_0x5682f9,_0x2bff3c);_0x1eb165(_0x2bff3c);});});}function respondWithStatusCode(_0x1ddf28,_0x188682){_0x188682=_0x188682||0xcc;return function(_0x4d4024){if(_0x4d4024){return _0x1ddf28[_0xe218('0x29')](_0x188682);}return _0x1ddf28[_0xe218('0x2a')](_0x188682)[_0xe218('0x2b')]();};}function respondWithResult(_0x35d0b6,_0x1eb45d){_0x1eb45d=_0x1eb45d||0xc8;return function(_0x48cdb8){if(_0x48cdb8){return _0x35d0b6[_0xe218('0x2a')](_0x1eb45d)[_0xe218('0x2c')](_0x48cdb8);}};}function respondWithFilteredResult(_0x2f080d,_0x3a4128){return function(_0x170deb){if(_0x170deb){var _0x3e183c=typeof _0x3a4128[_0xe218('0x2d')]===_0xe218('0x2e')&&typeof _0x3a4128[_0xe218('0x2f')]==='undefined';var _0x20550c=_0x170deb[_0xe218('0x30')];var _0x4471b7=_0x3e183c?0x0:_0x3a4128[_0xe218('0x2d')];var _0x29c8c6=_0x3e183c?_0x170deb[_0xe218('0x30')]:_0x3a4128['offset']+_0x3a4128['limit'];var _0x25950f;if(_0x29c8c6>=_0x20550c){_0x29c8c6=_0x20550c;_0x25950f=0xc8;}else{_0x25950f=0xce;}_0x2f080d[_0xe218('0x2a')](_0x25950f);return _0x2f080d[_0xe218('0x31')]('Content-Range',_0x4471b7+'-'+_0x29c8c6+'/'+_0x20550c)[_0xe218('0x2c')](_0x170deb);}return null;};}function patchUpdates(_0x2c7031){return function(_0x39e3ff){try{jsonpatch['apply'](_0x39e3ff,_0x2c7031,!![]);}catch(_0x3b4447){return BPromise[_0xe218('0x32')](_0x3b4447);}return _0x39e3ff[_0xe218('0x33')]();};}function saveUpdates(_0x4a073b,_0x59ca2f){return function(_0x5537f9){if(_0x5537f9){return _0x5537f9[_0xe218('0x34')](_0x4a073b)['then'](function(_0x26d5c1){return _0x26d5c1;});}return null;};}function removeEntity(_0x2dbd48,_0x23f3c7){return function(_0x3a4f55){if(_0x3a4f55){return _0x3a4f55[_0xe218('0x35')]()[_0xe218('0x36')](function(){_0x2dbd48[_0xe218('0x2a')](0xcc)[_0xe218('0x2b')]();});}};}function handleEntityNotFound(_0x2c4704,_0x4449ae){return function(_0x179209){if(!_0x179209){_0x2c4704[_0xe218('0x29')](0x194);}return _0x179209;};}function handleError(_0x587ecd,_0x51d6f3){_0x51d6f3=_0x51d6f3||0x1f4;return function(_0x4669aa){logger[_0xe218('0x25')](_0x4669aa['stack']);if(_0x4669aa['name']){delete _0x4669aa[_0xe218('0x37')];}_0x587ecd[_0xe218('0x2a')](_0x51d6f3)[_0xe218('0x38')](_0x4669aa);};}exports[_0xe218('0x39')]=function(_0x458c09,_0x524a10){var _0x32c00b={},_0x594c8d={},_0x4afb6f={'count':0x0,'rows':[]};var _0x2986d8=_['map'](db[_0xe218('0x3a')][_0xe218('0x3b')],function(_0x1fc9d1){return{'name':_0x1fc9d1[_0xe218('0x3c')],'type':_0x1fc9d1[_0xe218('0x3d')]['key']};});_0x594c8d[_0xe218('0x3e')]=_[_0xe218('0x3f')](_0x2986d8,_0xe218('0x37'));_0x594c8d[_0xe218('0x40')]=_['keys'](_0x458c09[_0xe218('0x40')]);_0x594c8d['filters']=_[_0xe218('0x41')](_0x594c8d['model'],_0x594c8d[_0xe218('0x40')]);_0x32c00b[_0xe218('0x42')]=_[_0xe218('0x41')](_0x594c8d[_0xe218('0x3e')],qs[_0xe218('0x43')](_0x458c09[_0xe218('0x40')][_0xe218('0x43')]));_0x32c00b[_0xe218('0x42')]=_0x32c00b['attributes'][_0xe218('0x44')]?_0x32c00b[_0xe218('0x42')]:_0x594c8d[_0xe218('0x3e')];if(!_0x458c09[_0xe218('0x40')][_0xe218('0x45')](_0xe218('0x46'))){_0x32c00b[_0xe218('0x2f')]=qs[_0xe218('0x2f')](_0x458c09[_0xe218('0x40')][_0xe218('0x2f')]);_0x32c00b[_0xe218('0x2d')]=qs[_0xe218('0x2d')](_0x458c09[_0xe218('0x40')][_0xe218('0x2d')]);}_0x32c00b[_0xe218('0x47')]=qs[_0xe218('0x48')](_0x458c09['query']['sort']);_0x32c00b['where']=qs[_0xe218('0x49')](_[_0xe218('0x4a')](_0x458c09[_0xe218('0x40')],_0x594c8d[_0xe218('0x49')]),_0x2986d8);if(_0x458c09[_0xe218('0x40')][_0xe218('0x4b')]){_0x32c00b[_0xe218('0x4c')]=_[_0xe218('0x4d')](_0x32c00b[_0xe218('0x4c')],{'$or':_['map'](_0x2986d8,function(_0x1a67de){if(_0x1a67de[_0xe218('0x3d')]!==_0xe218('0x4e')){var _0x13913e={};_0x13913e[_0x1a67de[_0xe218('0x37')]]={'$like':'%'+_0x458c09['query'][_0xe218('0x4b')]+'%'};return _0x13913e;}})});}_0x32c00b=_[_0xe218('0x4d')]({},_0x32c00b,_0x458c09[_0xe218('0x4f')]);var _0x5bc1e3={'where':_0x32c00b['where']};return db['FaxMessage'][_0xe218('0x30')](_0x5bc1e3)[_0xe218('0x36')](function(_0x46878b){_0x4afb6f[_0xe218('0x30')]=_0x46878b;if(_0x458c09[_0xe218('0x40')][_0xe218('0x50')]){_0x32c00b[_0xe218('0x51')]=[{'all':!![]}];}return db[_0xe218('0x3a')]['findAll'](_0x32c00b);})[_0xe218('0x36')](function(_0x392a59){_0x4afb6f[_0xe218('0x52')]=_0x392a59;return _0x4afb6f;})['then'](respondWithFilteredResult(_0x524a10,_0x32c00b))[_0xe218('0x53')](handleError(_0x524a10,null));};exports[_0xe218('0x54')]=function(_0x59a224,_0x371783){var _0x10452a={'raw':!![],'where':{'id':_0x59a224[_0xe218('0x55')]['id']}},_0x128a85={};_0x128a85[_0xe218('0x3e')]=_[_0xe218('0x56')](db[_0xe218('0x3a')][_0xe218('0x3b')]);_0x128a85[_0xe218('0x40')]=_[_0xe218('0x56')](_0x59a224['query']);_0x128a85[_0xe218('0x49')]=_[_0xe218('0x41')](_0x128a85[_0xe218('0x3e')],_0x128a85[_0xe218('0x40')]);_0x10452a[_0xe218('0x42')]=_['intersection'](_0x128a85['model'],qs[_0xe218('0x43')](_0x59a224['query']['fields']));_0x10452a['attributes']=_0x10452a[_0xe218('0x42')][_0xe218('0x44')]?_0x10452a[_0xe218('0x42')]:_0x128a85[_0xe218('0x3e')];if(_0x59a224[_0xe218('0x40')]['includeAll']){_0x10452a['include']=[{'all':!![]}];}_0x10452a=_['merge']({},_0x10452a,_0x59a224[_0xe218('0x4f')]);return db[_0xe218('0x3a')][_0xe218('0x57')](_0x10452a)[_0xe218('0x36')](handleEntityNotFound(_0x371783,null))[_0xe218('0x36')](respondWithResult(_0x371783,null))['catch'](handleError(_0x371783,null));};exports[_0xe218('0x34')]=function(_0x16df5a,_0x9b49f9){if(_0x16df5a[_0xe218('0x58')]['id']){delete _0x16df5a[_0xe218('0x58')]['id'];}return db[_0xe218('0x3a')][_0xe218('0x57')]({'where':{'id':_0x16df5a['params']['id']}})[_0xe218('0x36')](handleEntityNotFound(_0x9b49f9,null))['then'](saveUpdates(_0x16df5a[_0xe218('0x58')],null))[_0xe218('0x36')](respondWithResult(_0x9b49f9,null))[_0xe218('0x53')](handleError(_0x9b49f9,null));};exports['destroy']=function(_0x37342b,_0x5bb634){return db[_0xe218('0x3a')]['find']({'where':{'id':_0x37342b[_0xe218('0x55')]['id']}})[_0xe218('0x36')](handleEntityNotFound(_0x5bb634,null))['then'](removeEntity(_0x5bb634,null))[_0xe218('0x53')](handleError(_0x5bb634,null));};exports['describe']=function(_0x2d198f,_0x36830a){return db[_0xe218('0x3a')][_0xe218('0x59')]()['then'](respondWithResult(_0x36830a,null))[_0xe218('0x53')](handleError(_0x36830a,null));};var interaction_log=require(_0xe218('0x13'))(_0xe218('0x5a'));exports[_0xe218('0x5b')]=function(_0x1bd952,_0x50d822,_0x9a1c0){var _0x5effe3={'agent':{},'channel':_0xe218('0x5c')};if(_0x1bd952[_0xe218('0x58')]['id']){delete _0x1bd952['body']['id'];}_0x1bd952['body'][_0xe218('0x5d')]=!![];_0x1bd952[_0xe218('0x58')][_0xe218('0x5e')]=moment()['format'](_0xe218('0x5f'));_0x1bd952['body'][_0xe218('0x60')]=_0x1bd952[_0xe218('0x58')]['UserId']||_0x1bd952[_0xe218('0x61')]['id'];_0x5effe3['agent']['id']=_0x1bd952[_0xe218('0x58')][_0xe218('0x60')];return db[_0xe218('0x3a')]['find']({'where':{'id':_0x1bd952[_0xe218('0x55')]['id'],'UserId':null}})[_0xe218('0x36')](handleEntityNotFound(_0x50d822,null))[_0xe218('0x36')](saveUpdates(_0x1bd952[_0xe218('0x58')],null))[_0xe218('0x36')](function(_0x1cf220){if(_0x1cf220){_0x5effe3[_0xe218('0x26')]=_0x1cf220[_0xe218('0x62')]({'plain':!![]});return db[_0xe218('0x63')]['find']({'where':{'id':_0x1cf220[_0xe218('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x50d822,null))['then'](function(_0x441fb6){if(_0x441fb6){return _0x441fb6[_0xe218('0x34')]({'UserId':_0x1bd952[_0xe218('0x58')][_0xe218('0x60')],'read1stAt':_[_0xe218('0x65')](_0x441fb6[_0xe218('0x66')])?moment()[_0xe218('0x67')](_0xe218('0x5f')):undefined});}return null;})[_0xe218('0x36')](function(_0x45d400){if(_0x45d400){_0x5effe3[_0xe218('0x68')]=_0x45d400['get']({'plain':!![]});interaction_log['info'](_0xe218('0x69'),_0x1bd952[_0xe218('0x61')]['id'],_0x1bd952[_0xe218('0x61')][_0xe218('0x37')],_0x1bd952[_0xe218('0x61')]['role'],_0x5effe3[_0xe218('0x68')]['id'],_0x1bd952[_0xe218('0x58')]?JSON[_0xe218('0x24')](_0x1bd952[_0xe218('0x58')]):_0xe218('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xe218('0x6b'),_0x5effe3);}return null;})[_0xe218('0x36')](function(_0x3834f4){var _0x3be277=_0xe218('0x6c')+_0x3834f4[_0xe218('0x26')][_0xe218('0x6d')];return db[_0xe218('0x6e')][_0xe218('0x40')](_0x3be277,{'type':db['Sequelize']['QueryTypes'][_0xe218('0x6f')],'raw':!![]})['then'](function(_0x27dedc){return _0x27dedc;});})[_0xe218('0x36')](function(_0x292faa){if(_0x292faa){_0x5effe3[_0xe218('0x26')][_0xe218('0x70')]=_0x292faa[0x0];if(!_0x1bd952[_0xe218('0x58')][_0xe218('0x60')])return;return db[_0xe218('0x71')]['find']({'where':{'id':_0x1bd952['body'][_0xe218('0x60')],'role':'agent'},'attributes':['id',_0xe218('0x37'),'fullname',_0xe218('0x72'),_0xe218('0x73')],'raw':!![]});}return null;})[_0xe218('0x36')](function(_0x2ed60a){if(!_0x2ed60a)return null;_0x5effe3[_0xe218('0x26')][_0xe218('0x74')]=_0x2ed60a;return _0x5effe3;})[_0xe218('0x36')](function(_0x59c7ae){if(_0x59c7ae){if(_0x1bd952[_0xe218('0x58')][_0xe218('0x75')]){_0x5effe3[_0xe218('0x26')][_0xe218('0x76')]=util[_0xe218('0x67')](_0xe218('0x77'),_0x1bd952[_0xe218('0x61')]['name']);_0x5effe3['message'][_0xe218('0x78')]=_0x5effe3[_0xe218('0x78')];_0x5effe3[_0xe218('0x26')][_0xe218('0x79')]=_0xe218('0x5b');return respondWithRpcPromise(_0xe218('0x7a'),_0xe218('0x7a'),{'event':_0xe218('0x7b'),'message':_0x5effe3[_0xe218('0x26')]},client9002)['then'](function(){return _0x5effe3;});}return _0x5effe3;}return null;})[_0xe218('0x36')](respondWithResult(_0x50d822,null))['catch'](handleError(_0x50d822,null));};var interaction_log=require(_0xe218('0x13'))(_0xe218('0x5a'));exports['reject']=function(_0x28b632,_0x125f98,_0x1efb83){var _0x2992f6={'agent':{},'channel':'fax'};if(_0x28b632[_0xe218('0x58')]['id']){delete _0x28b632[_0xe218('0x58')]['id'];}_0x28b632[_0xe218('0x58')]['UserId']=_0x28b632[_0xe218('0x58')][_0xe218('0x60')]||_0x28b632['user']['id'];_0x2992f6[_0xe218('0x74')]['id']=_0x28b632[_0xe218('0x58')]['UserId'];return db[_0xe218('0x3a')]['find']({'where':{'id':_0x28b632[_0xe218('0x55')]['id'],'UserId':null}})[_0xe218('0x36')](handleEntityNotFound(_0x125f98,null))[_0xe218('0x36')](function(_0x27ff3e){if(_0x27ff3e){_0x2992f6['message']=_0x27ff3e[_0xe218('0x62')]({'plain':!![]});return db['FaxInteraction'][_0xe218('0x57')]({'where':{'id':_0x27ff3e[_0xe218('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x125f98,null))[_0xe218('0x36')](function(_0x1fb099){if(_0x1fb099){_0x2992f6[_0xe218('0x68')]=_0x1fb099['get']({'plain':!![]});interaction_log[_0xe218('0x21')](_0xe218('0x7c'),_0x28b632[_0xe218('0x61')]['id'],_0x28b632[_0xe218('0x61')][_0xe218('0x37')],_0x28b632[_0xe218('0x61')][_0xe218('0x7d')],_0x2992f6['interaction']['id'],_0x28b632[_0xe218('0x58')]?JSON['stringify'](_0x28b632[_0xe218('0x58')]):_0xe218('0x6a'));return respondWithRpcPromise(_0xe218('0x7e'),'rejectMessage',_0x2992f6);}return null;})[_0xe218('0x36')](function(_0x407620){var _0x33e172=_0xe218('0x6c')+_0x407620[_0xe218('0x26')][_0xe218('0x6d')];return db[_0xe218('0x6e')]['query'](_0x33e172,{'type':db['Sequelize'][_0xe218('0x7f')][_0xe218('0x6f')],'raw':!![]})[_0xe218('0x36')](function(_0x2082a9){return _0x2082a9;});})[_0xe218('0x36')](function(_0x1355fa){if(_0x1355fa){_0x2992f6[_0xe218('0x26')][_0xe218('0x70')]=_0x1355fa[0x0];if(!_0x28b632['body'][_0xe218('0x60')])return;return db[_0xe218('0x71')]['find']({'where':{'id':_0x28b632['body'][_0xe218('0x60')],'role':'agent'},'attributes':['id',_0xe218('0x37'),'fullname','email','internal'],'raw':!![]});}return null;})[_0xe218('0x36')](function(_0x21788b){if(!_0x21788b)return null;_0x2992f6[_0xe218('0x26')]['agent']=_0x21788b;return _0x2992f6;})[_0xe218('0x36')](function(_0x5f31f9){if(_0x5f31f9){_0x5f31f9[_0xe218('0x26')]['interface']=util[_0xe218('0x67')]('SIP/%s',_0x28b632[_0xe218('0x61')]['name']);_0x5f31f9[_0xe218('0x26')][_0xe218('0x78')]=_0x2992f6[_0xe218('0x78')];_0x5f31f9[_0xe218('0x26')][_0xe218('0x79')]=_0xe218('0x32');respondWithRpcPromise(_0xe218('0x7a'),_0xe218('0x7a'),{'event':_0xe218('0x80'),'message':_0x5f31f9['message']},client9002);return _0x2992f6;}return null;})[_0xe218('0x36')](respondWithResult(_0x125f98,null))[_0xe218('0x53')](handleError(_0x125f98,null));};exports[_0xe218('0x81')]=function(_0x49e95b,_0x39f840){var _0x1bb6f0;return db['FaxMessage'][_0xe218('0x81')](_0x49e95b[_0xe218('0x58')],{})[_0xe218('0x36')](function(_0x4403f9){_0x1bb6f0=_0x4403f9;return db['CmContact']['findOne']({'where':{'id':_0x1bb6f0[_0xe218('0x6d')]}});})[_0xe218('0x36')](function(_0x5212af){if(_[_0xe218('0x65')](_0x5212af)){return;}else{_0x1bb6f0['fax']=_0x5212af[_0xe218('0x5c')];return db[_0xe218('0x82')][_0xe218('0x83')]({'where':{'id':_0x1bb6f0['AttachmentId']}});}})[_0xe218('0x36')](function(_0x32e69d){return respondWithRpcPromise(_0xe218('0x84'),_0xe218('0x84'),{'FaxAccountId':_[_0xe218('0x65')](_0x49e95b[_0xe218('0x58')])?undefined:_0x49e95b['body']['FaxAccountId'],'path':_['isNil'](_0x32e69d)?undefined:util[_0xe218('0x67')]('/var/opt/motion2/server/files/attachments/%s',_0x32e69d[_0xe218('0x85')]),'fax':_[_0xe218('0x65')](_0x1bb6f0['fax'])?undefined:_0x1bb6f0['fax'],'AttachmentId':_0x1bb6f0[_0xe218('0x86')]},client9002);})[_0xe218('0x36')](respondWithResult(_0x39f840,0xc9))[_0xe218('0x53')](handleError(_0x39f840,null));};exports[_0xe218('0x87')]=function(_0x1055bf,_0x1a5b51){var _0x7da97f=path[_0xe218('0x88')](config[_0xe218('0x89')],_0xe218('0x8a'),_0xe218('0x8b'),_0xe218('0x8c'));return db[_0xe218('0x3a')]['find']({'where':{'id':_0x1055bf[_0xe218('0x55')]['id']},'include':[{'model':db[_0xe218('0x82')],'as':_0xe218('0x82')}]})[_0xe218('0x36')](handleEntityNotFound(_0x1a5b51,null))['then'](function(_0x58ddff){if(_0x58ddff){return _0x1a5b51['download'](path[_0xe218('0x88')](_0x7da97f,_0x58ddff[_0xe218('0x82')][_0xe218('0x85')]));}})[_0xe218('0x53')](handleError(_0x1a5b51,null));}; \ No newline at end of file +var _0x07ff=['nolimit','order','sort','where','filters','pick','filter','merge','options','FaxMessage','includeAll','include','findAll','find','body','describe','../../config/logger','fax-interactions','accept','fax','read','readAt','UserId','user','params','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','agent','email','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','fullname','internal','rejectmessage','create','CmContact','findOne','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty'];(function(_0xf84870,_0x4dc38f){var _0x4541a4=function(_0x3ff5d5){while(--_0x3ff5d5){_0xf84870['push'](_0xf84870['shift']());}};_0x4541a4(++_0x4dc38f);}(_0x07ff,0x176));var _0xf07f=function(_0x5a13ba,_0x4702e9){_0x5a13ba=_0x5a13ba-0x0;var _0x425288=_0x07ff[_0x5a13ba];return _0x425288;};'use strict';var emlformat=require(_0xf07f('0x0'));var rimraf=require(_0xf07f('0x1'));var zipdir=require(_0xf07f('0x2'));var jsonpatch=require(_0xf07f('0x3'));var rp=require(_0xf07f('0x4'));var moment=require(_0xf07f('0x5'));var BPromise=require(_0xf07f('0x6'));var Mustache=require(_0xf07f('0x7'));var util=require(_0xf07f('0x8'));var path=require(_0xf07f('0x9'));var sox=require(_0xf07f('0xa'));var csv=require(_0xf07f('0xb'));var ejs=require(_0xf07f('0xc'));var fs=require('fs');var fs_extra=require(_0xf07f('0xd'));var _=require(_0xf07f('0xe'));var squel=require('squel');var crypto=require(_0xf07f('0xf'));var jsforce=require(_0xf07f('0x10'));var deskjs=require(_0xf07f('0x11'));var toCsv=require(_0xf07f('0xb'));var querystring=require('querystring');var Papa=require(_0xf07f('0x12'));var Redis=require(_0xf07f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf07f('0x14'));var as=require(_0xf07f('0x15'));var hardwareService=require(_0xf07f('0x16'));var logger=require('../../config/logger')(_0xf07f('0x17'));var utils=require(_0xf07f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf07f('0x19'));var db=require(_0xf07f('0x1a'))['db'];config[_0xf07f('0x1b')]=_[_0xf07f('0x1c')](config[_0xf07f('0x1b')],{'host':_0xf07f('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf07f('0x1b')]));require(_0xf07f('0x1e'))[_0xf07f('0x1f')](socket);var jayson=require(_0xf07f('0x20'));var client=jayson[_0xf07f('0x21')][_0xf07f('0x22')]({'port':0x232c});var client9002=jayson['client'][_0xf07f('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x3ca583,_0x23d32b,_0x14d89a,_0x34c744){return new BPromise(function(_0x59fcc2,_0x5bc9ad){var _0x4adac4=_0x34c744||client;return _0x4adac4[_0xf07f('0x23')](_0x3ca583,_0x14d89a)['then'](function(_0x41930a){logger[_0xf07f('0x24')](_0xf07f('0x25'),_0x23d32b,_0xf07f('0x26'));logger['debug'](_0xf07f('0x27'),_0x23d32b,_0xf07f('0x26'),JSON[_0xf07f('0x28')](_0x41930a));if(_0x41930a[_0xf07f('0x29')]){if(_0x41930a[_0xf07f('0x29')][_0xf07f('0x2a')]===0x1f4){logger[_0xf07f('0x29')](_0xf07f('0x25'),_0x23d32b,_0x41930a[_0xf07f('0x29')][_0xf07f('0x2b')]);return _0x5bc9ad(_0x41930a[_0xf07f('0x29')][_0xf07f('0x2b')]);}logger[_0xf07f('0x29')](_0xf07f('0x25'),_0x23d32b,_0x41930a[_0xf07f('0x29')][_0xf07f('0x2b')]);return _0x59fcc2(_0x41930a[_0xf07f('0x29')][_0xf07f('0x2b')]);}else{logger[_0xf07f('0x24')](_0xf07f('0x25'),_0x23d32b,_0xf07f('0x26'));_0x59fcc2(_0x41930a[_0xf07f('0x2c')][_0xf07f('0x2b')]);}})[_0xf07f('0x2d')](function(_0x395d4d){logger['error'](_0xf07f('0x25'),_0x23d32b,_0x395d4d);_0x5bc9ad(_0x395d4d);});});}function respondWithStatusCode(_0x10f51f,_0x3d02b9){_0x3d02b9=_0x3d02b9||0xcc;return function(_0x2f15f4){if(_0x2f15f4){return _0x10f51f[_0xf07f('0x2e')](_0x3d02b9);}return _0x10f51f[_0xf07f('0x2f')](_0x3d02b9)[_0xf07f('0x30')]();};}function respondWithResult(_0x5888cd,_0x362d02){_0x362d02=_0x362d02||0xc8;return function(_0xcd52d3){if(_0xcd52d3){return _0x5888cd[_0xf07f('0x2f')](_0x362d02)[_0xf07f('0x31')](_0xcd52d3);}};}function respondWithFilteredResult(_0x50ec3e,_0x123ad6){return function(_0x480026){if(_0x480026){var _0x5f3cbb=typeof _0x123ad6[_0xf07f('0x32')]===_0xf07f('0x33')&&typeof _0x123ad6['limit']===_0xf07f('0x33');var _0x2d495b=_0x480026['count'];var _0xeb5539=_0x5f3cbb?0x0:_0x123ad6['offset'];var _0x521555=_0x5f3cbb?_0x480026[_0xf07f('0x34')]:_0x123ad6[_0xf07f('0x32')]+_0x123ad6[_0xf07f('0x35')];var _0x3e5c2e;if(_0x521555>=_0x2d495b){_0x521555=_0x2d495b;_0x3e5c2e=0xc8;}else{_0x3e5c2e=0xce;}_0x50ec3e[_0xf07f('0x2f')](_0x3e5c2e);return _0x50ec3e[_0xf07f('0x36')](_0xf07f('0x37'),_0xeb5539+'-'+_0x521555+'/'+_0x2d495b)[_0xf07f('0x31')](_0x480026);}return null;};}function patchUpdates(_0x313e4c){return function(_0x3ce0a6){try{jsonpatch[_0xf07f('0x38')](_0x3ce0a6,_0x313e4c,!![]);}catch(_0x4cbb20){return BPromise[_0xf07f('0x39')](_0x4cbb20);}return _0x3ce0a6[_0xf07f('0x3a')]();};}function saveUpdates(_0xe2c498,_0x22e0e4){return function(_0x25e2af){if(_0x25e2af){return _0x25e2af[_0xf07f('0x3b')](_0xe2c498)['then'](function(_0x367c0f){return _0x367c0f;});}return null;};}function removeEntity(_0x395f4c,_0xf9b4f8){return function(_0x2ceeda){if(_0x2ceeda){return _0x2ceeda[_0xf07f('0x3c')]()[_0xf07f('0x3d')](function(){_0x395f4c[_0xf07f('0x2f')](0xcc)[_0xf07f('0x30')]();});}};}function handleEntityNotFound(_0x5dc68d,_0x26517d){return function(_0x236fcb){if(!_0x236fcb){_0x5dc68d[_0xf07f('0x2e')](0x194);}return _0x236fcb;};}function handleError(_0x3976c9,_0x56fa71){_0x56fa71=_0x56fa71||0x1f4;return function(_0x4eced3){logger[_0xf07f('0x29')](_0x4eced3[_0xf07f('0x3e')]);if(_0x4eced3[_0xf07f('0x3f')]){delete _0x4eced3['name'];}_0x3976c9[_0xf07f('0x2f')](_0x56fa71)[_0xf07f('0x40')](_0x4eced3);};}exports[_0xf07f('0x41')]=function(_0x146766,_0x3f3f10){var _0x2d5dec={},_0x390e1f={},_0x94d2fe={'count':0x0,'rows':[]};var _0x128159=_[_0xf07f('0x42')](db['FaxMessage'][_0xf07f('0x43')],function(_0x1cc8fc){return{'name':_0x1cc8fc[_0xf07f('0x44')],'type':_0x1cc8fc[_0xf07f('0x45')][_0xf07f('0x46')]};});_0x390e1f[_0xf07f('0x47')]=_[_0xf07f('0x42')](_0x128159,_0xf07f('0x3f'));_0x390e1f[_0xf07f('0x48')]=_[_0xf07f('0x49')](_0x146766[_0xf07f('0x48')]);_0x390e1f['filters']=_['intersection'](_0x390e1f[_0xf07f('0x47')],_0x390e1f[_0xf07f('0x48')]);_0x2d5dec[_0xf07f('0x4a')]=_[_0xf07f('0x4b')](_0x390e1f['model'],qs[_0xf07f('0x4c')](_0x146766['query'][_0xf07f('0x4c')]));_0x2d5dec[_0xf07f('0x4a')]=_0x2d5dec[_0xf07f('0x4a')][_0xf07f('0x4d')]?_0x2d5dec['attributes']:_0x390e1f[_0xf07f('0x47')];if(!_0x146766[_0xf07f('0x48')][_0xf07f('0x4e')](_0xf07f('0x4f'))){_0x2d5dec['limit']=qs[_0xf07f('0x35')](_0x146766[_0xf07f('0x48')][_0xf07f('0x35')]);_0x2d5dec[_0xf07f('0x32')]=qs[_0xf07f('0x32')](_0x146766[_0xf07f('0x48')]['offset']);}_0x2d5dec[_0xf07f('0x50')]=qs['sort'](_0x146766[_0xf07f('0x48')][_0xf07f('0x51')]);_0x2d5dec[_0xf07f('0x52')]=qs[_0xf07f('0x53')](_[_0xf07f('0x54')](_0x146766['query'],_0x390e1f['filters']),_0x128159);if(_0x146766['query'][_0xf07f('0x55')]){_0x2d5dec['where']=_['merge'](_0x2d5dec[_0xf07f('0x52')],{'$or':_[_0xf07f('0x42')](_0x128159,function(_0x23c05b){if(_0x23c05b[_0xf07f('0x45')]!=='VIRTUAL'){var _0x11267f={};_0x11267f[_0x23c05b[_0xf07f('0x3f')]]={'$like':'%'+_0x146766[_0xf07f('0x48')][_0xf07f('0x55')]+'%'};return _0x11267f;}})});}_0x2d5dec=_[_0xf07f('0x56')]({},_0x2d5dec,_0x146766[_0xf07f('0x57')]);var _0x24a973={'where':_0x2d5dec[_0xf07f('0x52')]};return db[_0xf07f('0x58')][_0xf07f('0x34')](_0x24a973)['then'](function(_0x501f2a){_0x94d2fe[_0xf07f('0x34')]=_0x501f2a;if(_0x146766['query'][_0xf07f('0x59')]){_0x2d5dec[_0xf07f('0x5a')]=[{'all':!![]}];}return db['FaxMessage'][_0xf07f('0x5b')](_0x2d5dec);})[_0xf07f('0x3d')](function(_0x146ac0){_0x94d2fe['rows']=_0x146ac0;return _0x94d2fe;})[_0xf07f('0x3d')](respondWithFilteredResult(_0x3f3f10,_0x2d5dec))[_0xf07f('0x2d')](handleError(_0x3f3f10,null));};exports['show']=function(_0x3bba21,_0x25d42d){var _0x18bd6e={'raw':!![],'where':{'id':_0x3bba21['params']['id']}},_0x56e61b={};_0x56e61b[_0xf07f('0x47')]=_[_0xf07f('0x49')](db[_0xf07f('0x58')][_0xf07f('0x43')]);_0x56e61b[_0xf07f('0x48')]=_['keys'](_0x3bba21[_0xf07f('0x48')]);_0x56e61b['filters']=_[_0xf07f('0x4b')](_0x56e61b[_0xf07f('0x47')],_0x56e61b[_0xf07f('0x48')]);_0x18bd6e[_0xf07f('0x4a')]=_[_0xf07f('0x4b')](_0x56e61b[_0xf07f('0x47')],qs[_0xf07f('0x4c')](_0x3bba21[_0xf07f('0x48')][_0xf07f('0x4c')]));_0x18bd6e[_0xf07f('0x4a')]=_0x18bd6e['attributes'][_0xf07f('0x4d')]?_0x18bd6e[_0xf07f('0x4a')]:_0x56e61b['model'];if(_0x3bba21['query'][_0xf07f('0x59')]){_0x18bd6e[_0xf07f('0x5a')]=[{'all':!![]}];}_0x18bd6e=_['merge']({},_0x18bd6e,_0x3bba21[_0xf07f('0x57')]);return db[_0xf07f('0x58')][_0xf07f('0x5c')](_0x18bd6e)[_0xf07f('0x3d')](handleEntityNotFound(_0x25d42d,null))['then'](respondWithResult(_0x25d42d,null))['catch'](handleError(_0x25d42d,null));};exports['update']=function(_0x30e677,_0x5b0750){if(_0x30e677[_0xf07f('0x5d')]['id']){delete _0x30e677['body']['id'];}return db[_0xf07f('0x58')]['find']({'where':{'id':_0x30e677['params']['id']}})[_0xf07f('0x3d')](handleEntityNotFound(_0x5b0750,null))[_0xf07f('0x3d')](saveUpdates(_0x30e677[_0xf07f('0x5d')],null))[_0xf07f('0x3d')](respondWithResult(_0x5b0750,null))['catch'](handleError(_0x5b0750,null));};exports[_0xf07f('0x3c')]=function(_0x78da02,_0x49e828){return db[_0xf07f('0x58')][_0xf07f('0x5c')]({'where':{'id':_0x78da02['params']['id']}})[_0xf07f('0x3d')](handleEntityNotFound(_0x49e828,null))[_0xf07f('0x3d')](removeEntity(_0x49e828,null))[_0xf07f('0x2d')](handleError(_0x49e828,null));};exports['describe']=function(_0x50095c,_0x180bfc){return db[_0xf07f('0x58')][_0xf07f('0x5e')]()[_0xf07f('0x3d')](respondWithResult(_0x180bfc,null))[_0xf07f('0x2d')](handleError(_0x180bfc,null));};var interaction_log=require(_0xf07f('0x5f'))(_0xf07f('0x60'));exports[_0xf07f('0x61')]=function(_0x550f97,_0x3be0a7,_0x2a7161){var _0x3cf0d6={'agent':{},'channel':_0xf07f('0x62')};if(_0x550f97[_0xf07f('0x5d')]['id']){delete _0x550f97[_0xf07f('0x5d')]['id'];}_0x550f97[_0xf07f('0x5d')][_0xf07f('0x63')]=!![];_0x550f97[_0xf07f('0x5d')][_0xf07f('0x64')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x550f97[_0xf07f('0x5d')][_0xf07f('0x65')]=_0x550f97['body']['UserId']||_0x550f97[_0xf07f('0x66')]['id'];_0x3cf0d6['agent']['id']=_0x550f97[_0xf07f('0x5d')][_0xf07f('0x65')];return db[_0xf07f('0x58')][_0xf07f('0x5c')]({'where':{'id':_0x550f97[_0xf07f('0x67')]['id'],'UserId':null}})[_0xf07f('0x3d')](handleEntityNotFound(_0x3be0a7,null))[_0xf07f('0x3d')](saveUpdates(_0x550f97[_0xf07f('0x5d')],null))[_0xf07f('0x3d')](function(_0x150dd2){if(_0x150dd2){_0x3cf0d6[_0xf07f('0x2b')]=_0x150dd2[_0xf07f('0x68')]({'plain':!![]});return db[_0xf07f('0x69')][_0xf07f('0x5c')]({'where':{'id':_0x150dd2[_0xf07f('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x3be0a7,null))[_0xf07f('0x3d')](function(_0x27b8f6){if(_0x27b8f6){return _0x27b8f6['update']({'UserId':_0x550f97['body'][_0xf07f('0x65')],'read1stAt':_[_0xf07f('0x6b')](_0x27b8f6[_0xf07f('0x6c')])?moment()[_0xf07f('0x6d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf07f('0x3d')](function(_0x4b1a0b){if(_0x4b1a0b){_0x3cf0d6['interaction']=_0x4b1a0b[_0xf07f('0x68')]({'plain':!![]});interaction_log['info'](_0xf07f('0x6e'),_0x550f97[_0xf07f('0x66')]['id'],_0x550f97[_0xf07f('0x66')]['name'],_0x550f97[_0xf07f('0x66')][_0xf07f('0x6f')],_0x3cf0d6[_0xf07f('0x70')]['id'],_0x550f97[_0xf07f('0x5d')]?JSON[_0xf07f('0x28')](_0x550f97[_0xf07f('0x5d')]):_0xf07f('0x71'));return respondWithRpcPromise(_0xf07f('0x72'),_0xf07f('0x73'),_0x3cf0d6);}return null;})[_0xf07f('0x3d')](function(_0x148039){var _0x15b326=_0xf07f('0x74')+_0x148039[_0xf07f('0x2b')][_0xf07f('0x75')];return db[_0xf07f('0x76')][_0xf07f('0x48')](_0x15b326,{'type':db[_0xf07f('0x77')]['QueryTypes'][_0xf07f('0x78')],'raw':!![]})[_0xf07f('0x3d')](function(_0xe890bb){return _0xe890bb;});})[_0xf07f('0x3d')](function(_0xbf986f){if(_0xbf986f){_0x3cf0d6[_0xf07f('0x2b')]['contact']=_0xbf986f[0x0];if(!_0x550f97['body'][_0xf07f('0x65')])return;return db[_0xf07f('0x79')][_0xf07f('0x5c')]({'where':{'id':_0x550f97[_0xf07f('0x5d')][_0xf07f('0x65')],'role':_0xf07f('0x7a')},'attributes':['id',_0xf07f('0x3f'),'fullname',_0xf07f('0x7b'),'internal'],'raw':!![]});}return null;})['then'](function(_0x572064){if(!_0x572064)return null;_0x3cf0d6[_0xf07f('0x2b')][_0xf07f('0x7a')]=_0x572064;return _0x3cf0d6;})[_0xf07f('0x3d')](function(_0x403954){if(_0x403954){if(_0x550f97[_0xf07f('0x5d')][_0xf07f('0x7c')]){_0x3cf0d6['message'][_0xf07f('0x7d')]=util['format'](_0xf07f('0x7e'),_0x550f97[_0xf07f('0x66')][_0xf07f('0x3f')]);_0x3cf0d6[_0xf07f('0x2b')][_0xf07f('0x7f')]=_0x3cf0d6['channel'];_0x3cf0d6[_0xf07f('0x2b')][_0xf07f('0x80')]=_0xf07f('0x61');return respondWithRpcPromise(_0xf07f('0x81'),_0xf07f('0x81'),{'event':_0xf07f('0x82'),'message':_0x3cf0d6['message']},client9002)[_0xf07f('0x3d')](function(){return _0x3cf0d6;});}return _0x3cf0d6;}return null;})[_0xf07f('0x3d')](respondWithResult(_0x3be0a7,null))[_0xf07f('0x2d')](handleError(_0x3be0a7,null));};var interaction_log=require(_0xf07f('0x5f'))('fax-interactions');exports[_0xf07f('0x39')]=function(_0x107214,_0x561fed,_0x1bfdd2){var _0x1777d9={'agent':{},'channel':'fax'};if(_0x107214['body']['id']){delete _0x107214[_0xf07f('0x5d')]['id'];}_0x107214['body'][_0xf07f('0x65')]=_0x107214[_0xf07f('0x5d')][_0xf07f('0x65')]||_0x107214[_0xf07f('0x66')]['id'];_0x1777d9[_0xf07f('0x7a')]['id']=_0x107214[_0xf07f('0x5d')][_0xf07f('0x65')];return db['FaxMessage'][_0xf07f('0x5c')]({'where':{'id':_0x107214['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x561fed,null))['then'](function(_0x146f8f){if(_0x146f8f){_0x1777d9['message']=_0x146f8f[_0xf07f('0x68')]({'plain':!![]});return db['FaxInteraction'][_0xf07f('0x5c')]({'where':{'id':_0x146f8f[_0xf07f('0x6a')]}});}return null;})[_0xf07f('0x3d')](handleEntityNotFound(_0x561fed,null))[_0xf07f('0x3d')](function(_0x469eba){if(_0x469eba){_0x1777d9['interaction']=_0x469eba[_0xf07f('0x68')]({'plain':!![]});interaction_log[_0xf07f('0x24')](_0xf07f('0x83'),_0x107214[_0xf07f('0x66')]['id'],_0x107214['user'][_0xf07f('0x3f')],_0x107214[_0xf07f('0x66')][_0xf07f('0x6f')],_0x1777d9[_0xf07f('0x70')]['id'],_0x107214[_0xf07f('0x5d')]?JSON['stringify'](_0x107214[_0xf07f('0x5d')]):_0xf07f('0x71'));return respondWithRpcPromise(_0xf07f('0x84'),_0xf07f('0x85'),_0x1777d9);}return null;})[_0xf07f('0x3d')](function(_0x1b912f){var _0x1741e2=_0xf07f('0x74')+_0x1b912f[_0xf07f('0x2b')][_0xf07f('0x75')];return db['sequelize'][_0xf07f('0x48')](_0x1741e2,{'type':db[_0xf07f('0x77')]['QueryTypes'][_0xf07f('0x78')],'raw':!![]})[_0xf07f('0x3d')](function(_0x438e69){return _0x438e69;});})[_0xf07f('0x3d')](function(_0x1252cc){if(_0x1252cc){_0x1777d9['message'][_0xf07f('0x86')]=_0x1252cc[0x0];if(!_0x107214[_0xf07f('0x5d')]['UserId'])return;return db[_0xf07f('0x79')][_0xf07f('0x5c')]({'where':{'id':_0x107214[_0xf07f('0x5d')][_0xf07f('0x65')],'role':_0xf07f('0x7a')},'attributes':['id','name',_0xf07f('0x87'),_0xf07f('0x7b'),_0xf07f('0x88')],'raw':!![]});}return null;})[_0xf07f('0x3d')](function(_0x52574c){if(!_0x52574c)return null;_0x1777d9[_0xf07f('0x2b')]['agent']=_0x52574c;return _0x1777d9;})['then'](function(_0x32202e){if(_0x32202e){_0x32202e['message']['interface']=util[_0xf07f('0x6d')](_0xf07f('0x7e'),_0x107214[_0xf07f('0x66')][_0xf07f('0x3f')]);_0x32202e[_0xf07f('0x2b')]['channel']=_0x1777d9['channel'];_0x32202e[_0xf07f('0x2b')][_0xf07f('0x80')]=_0xf07f('0x39');respondWithRpcPromise(_0xf07f('0x81'),'EventManager',{'event':_0xf07f('0x89'),'message':_0x32202e[_0xf07f('0x2b')]},client9002);return _0x1777d9;}return null;})['then'](respondWithResult(_0x561fed,null))[_0xf07f('0x2d')](handleError(_0x561fed,null));};exports[_0xf07f('0x8a')]=function(_0x534ca4,_0x356704){var _0x4c7383;return db[_0xf07f('0x58')][_0xf07f('0x8a')](_0x534ca4['body'],{})['then'](function(_0xc5f73f){_0x4c7383=_0xc5f73f;return db[_0xf07f('0x8b')][_0xf07f('0x8c')]({'where':{'id':_0x4c7383[_0xf07f('0x75')]}});})[_0xf07f('0x3d')](function(_0x116a87){if(_[_0xf07f('0x6b')](_0x116a87)){return;}else{_0x4c7383[_0xf07f('0x62')]=_0x116a87[_0xf07f('0x62')];return db[_0xf07f('0x8d')][_0xf07f('0x8c')]({'where':{'id':_0x4c7383['AttachmentId']}});}})[_0xf07f('0x3d')](function(_0x4116a9){return respondWithRpcPromise(_0xf07f('0x8e'),_0xf07f('0x8e'),{'FaxAccountId':_['isNil'](_0x534ca4[_0xf07f('0x5d')])?undefined:_0x534ca4[_0xf07f('0x5d')][_0xf07f('0x8f')],'path':_['isNil'](_0x4116a9)?undefined:util[_0xf07f('0x6d')](_0xf07f('0x90'),_0x4116a9[_0xf07f('0x91')]),'fax':_['isNil'](_0x4c7383['fax'])?undefined:_0x4c7383['fax'],'AttachmentId':_0x4c7383[_0xf07f('0x92')]},client9002);})[_0xf07f('0x3d')](respondWithResult(_0x356704,0xc9))[_0xf07f('0x2d')](handleError(_0x356704,null));};exports[_0xf07f('0x93')]=function(_0x49621b,_0x59f09a){var _0x1aa1d6=path[_0xf07f('0x94')](config[_0xf07f('0x95')],'server','files',_0xf07f('0x96'));return db['FaxMessage']['find']({'where':{'id':_0x49621b[_0xf07f('0x67')]['id']},'include':[{'model':db[_0xf07f('0x8d')],'as':_0xf07f('0x8d')}]})[_0xf07f('0x3d')](handleEntityNotFound(_0x59f09a,null))[_0xf07f('0x3d')](function(_0x492152){if(_0x492152){return _0x59f09a[_0xf07f('0x93')](path[_0xf07f('0x94')](_0x1aa1d6,_0x492152[_0xf07f('0x8d')]['basename']));}})[_0xf07f('0x2d')](handleError(_0x59f09a,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 12a612d..2537584 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 _0xa93a=['update','emit','hasOwnProperty','exports','FaxMessage'];(function(_0x1b4a4a,_0x17e1be){var _0x467676=function(_0x4aa264){while(--_0x4aa264){_0x1b4a4a['push'](_0x1b4a4a['shift']());}};_0x467676(++_0x17e1be);}(_0xa93a,0xb8));var _0xaa93=function(_0x4da850,_0x9db3b6){_0x4da850=_0x4da850-0x0;var _0x57d1da=_0xa93a[_0x4da850];return _0x57d1da;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0xaa93('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xaa93('0x1'),'afterDestroy':'remove'};function emitEvent(_0xdb8133){return function(_0x4deab1,_0x242aa2,_0x181549){FaxMessageEvents[_0xaa93('0x2')](_0xdb8133+':'+_0x4deab1['id'],_0x4deab1);FaxMessageEvents[_0xaa93('0x2')](_0xdb8133,_0x4deab1);_0x181549(null);};}for(var e in events){if(events[_0xaa93('0x3')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xaa93('0x4')]=FaxMessageEvents; \ No newline at end of file +var _0xeda7=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xeda7,0x196));var _0x7eda=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xeda7[_0x1969a7];return _0x3d665f;};'use strict';var EventEmitter=require(_0x7eda('0x0'));var FaxMessage=require(_0x7eda('0x1'))['db'][_0x7eda('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7eda('0x3')](0x0);var events={'afterCreate':_0x7eda('0x4'),'afterUpdate':_0x7eda('0x5'),'afterDestroy':_0x7eda('0x6')};function emitEvent(_0x2b1d21){return function(_0x324a25,_0x36a9f1,_0x15856b){FaxMessageEvents[_0x7eda('0x7')](_0x2b1d21+':'+_0x324a25['id'],_0x324a25);FaxMessageEvents[_0x7eda('0x7')](_0x2b1d21,_0x324a25);_0x15856b(null);};}for(var e in events){if(events[_0x7eda('0x8')](e)){var event=events[e];FaxMessage[_0x7eda('0x9')](e,emitEvent(event));}}module[_0x7eda('0xa')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index ff938da..4b9cf8a 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 _0x335d=['api','moment','rimraf','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','models','get','toLowerCase','direction','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x3a8ce2,_0x33b823){var _0x4ab5f0=function(_0x576d3c){while(--_0x576d3c){_0x3a8ce2['push'](_0x3a8ce2['shift']());}};_0x4ab5f0(++_0x33b823);}(_0x335d,0x1a1));var _0xd335=function(_0x328b40,_0x370642){_0x328b40=_0x328b40-0x0;var _0x556a56=_0x335d[_0x328b40];return _0x556a56;};'use strict';var _=require(_0xd335('0x0'));var util=require(_0xd335('0x1'));var logger=require(_0xd335('0x2'))(_0xd335('0x3'));var moment=require(_0xd335('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd335('0x5'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0xd335('0x6')]=function(_0x143563,_0x4f0a86){return _0x143563[_0xd335('0x7')](_0xd335('0x8'),attributes,{'tableName':_0xd335('0x9'),'paranoid':![],'indexes':[{'name':_0xd335('0xa'),'fields':[_0xd335('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4a956b,_0x5afa8b,_0x1eb4cc){var _0x581cc6=_0x143563[_0xd335('0xc')];var _0x3bf009=_0x4a956b[_0xd335('0xd')]({'plain':!![]});if(_0x3bf009['direction'][_0xd335('0xe')]()==='in'||_0x3bf009[_0xd335('0xf')][_0xd335('0xe')]()===_0xd335('0x10')&&!_0x3bf009[_0xd335('0x11')]&&!_[_0xd335('0x12')](_0x3bf009[_0xd335('0x13')])){_0x581cc6[_0xd335('0x14')][_0xd335('0x15')]({'where':{'id':_0x3bf009[_0xd335('0x16')]}})[_0xd335('0x17')](function(_0x4639eb){if(_0x4639eb){_0x4639eb[_0xd335('0x18')]({'lastMsgAt':_0x3bf009['createdAt'],'lastMsgDirection':_0x3bf009['direction']['toLowerCase']()});}})['catch'](function(_0xd72523){console[_0xd335('0x19')](_0xd72523);});}_0x1eb4cc();}},'charset':_0xd335('0x1a'),'collate':_0xd335('0x1b')});}; \ No newline at end of file +var _0x8128=['request-promise','path','rimraf','./faxMessage.attributes','define','fax_messages','FULLTEXT','models','get','toLowerCase','direction','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x2bda14,_0x4fab1b){var _0xb5dd49=function(_0x1da71e){while(--_0x1da71e){_0x2bda14['push'](_0x2bda14['shift']());}};_0xb5dd49(++_0x4fab1b);}(_0x8128,0x1bb));var _0x8812=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x8128[_0x4fde08];return _0x12e725;};'use strict';var _=require('lodash');var util=require(_0x8812('0x0'));var logger=require(_0x8812('0x1'))(_0x8812('0x2'));var moment=require(_0x8812('0x3'));var BPromise=require(_0x8812('0x4'));var rp=require(_0x8812('0x5'));var fs=require('fs');var path=require(_0x8812('0x6'));var rimraf=require(_0x8812('0x7'));var config=require('../../config/environment');var attributes=require(_0x8812('0x8'));module['exports']=function(_0xe16ad4,_0x5289b6){return _0xe16ad4[_0x8812('0x9')]('FaxMessage',attributes,{'tableName':_0x8812('0xa'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0x8812('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3cb0d1,_0x5dd22c,_0xf38985){var _0x129736=_0xe16ad4[_0x8812('0xc')];var _0x4a3698=_0x3cb0d1[_0x8812('0xd')]({'plain':!![]});if(_0x4a3698['direction'][_0x8812('0xe')]()==='in'||_0x4a3698[_0x8812('0xf')][_0x8812('0xe')]()==='out'&&!_0x4a3698[_0x8812('0x10')]&&!_[_0x8812('0x11')](_0x4a3698[_0x8812('0x12')])){_0x129736[_0x8812('0x13')][_0x8812('0x14')]({'where':{'id':_0x4a3698[_0x8812('0x15')]}})[_0x8812('0x16')](function(_0xb9c8c4){if(_0xb9c8c4){_0xb9c8c4[_0x8812('0x17')]({'lastMsgAt':_0x4a3698['createdAt'],'lastMsgDirection':_0x4a3698[_0x8812('0xf')]['toLowerCase']()});}})[_0x8812('0x18')](function(_0x44786a){console[_0x8812('0x19')](_0x44786a);});}_0xf38985();}},'charset':_0x8812('0x1a'),'collate':_0x8812('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 61a0ab0..0c4e8cb 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 _0x9a19=['http','redis','socket.io-emitter','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','update','attributes','limit','UpdateFaxMessage','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5c1449,_0x2af4b4){var _0x270473=function(_0x1461b6){while(--_0x1461b6){_0x5c1449['push'](_0x5c1449['shift']());}};_0x270473(++_0x2af4b4);}(_0x9a19,0x114));var _0x99a1=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0x9a19[_0x425716];return _0x2d39af;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var moment=require(_0x99a1('0x2'));var BPromise=require('bluebird');var rs=require(_0x99a1('0x3'));var fs=require('fs');var Redis=require(_0x99a1('0x4'));var db=require(_0x99a1('0x5'))['db'];var utils=require(_0x99a1('0x6'));var logger=require(_0x99a1('0x7'))(_0x99a1('0x8'));var config=require(_0x99a1('0x9'));var jayson=require(_0x99a1('0xa'));var client=jayson[_0x99a1('0xb')][_0x99a1('0xc')]({'port':0x232a});config[_0x99a1('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x99a1('0xe'))(new Redis(config[_0x99a1('0xd')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4696f6,_0xd7b568,_0x23db53){return new BPromise(function(_0x26473f,_0x1551a1){return client['request'](_0x4696f6,_0x23db53)[_0x99a1('0xf')](function(_0xdd29e1){logger[_0x99a1('0x10')](_0x99a1('0x11'),_0xd7b568,_0x99a1('0x12'));logger[_0x99a1('0x13')](_0x99a1('0x14'),_0xd7b568,_0x99a1('0x12'),JSON[_0x99a1('0x15')](_0xdd29e1));if(_0xdd29e1[_0x99a1('0x16')]){if(_0xdd29e1[_0x99a1('0x16')][_0x99a1('0x17')]===0x1f4){logger[_0x99a1('0x16')](_0x99a1('0x11'),_0xd7b568,_0xdd29e1[_0x99a1('0x16')]['message']);return _0x1551a1(_0xdd29e1[_0x99a1('0x16')][_0x99a1('0x18')]);}logger[_0x99a1('0x16')](_0x99a1('0x11'),_0xd7b568,_0xdd29e1[_0x99a1('0x16')][_0x99a1('0x18')]);return _0x26473f(_0xdd29e1[_0x99a1('0x16')]['message']);}else{logger['info'](_0x99a1('0x11'),_0xd7b568,_0x99a1('0x12'));_0x26473f(_0xdd29e1[_0x99a1('0x19')][_0x99a1('0x18')]);}})[_0x99a1('0x1a')](function(_0x209021){logger[_0x99a1('0x16')](_0x99a1('0x11'),_0xd7b568,_0x209021);_0x1551a1(_0x209021);});});}exports[_0x99a1('0x1b')]=function(_0x2d8cac){var _0x3c23c0=this;return new Promise(function(_0x5eabcb,_0x3023a1){return db[_0x99a1('0x1c')]['create'](_0x2d8cac[_0x99a1('0x1d')],{'raw':_0x2d8cac['options']?_0x2d8cac[_0x99a1('0x1e')][_0x99a1('0x1f')]===undefined?!![]:![]:!![]})[_0x99a1('0xf')](function(_0x2d3b82){logger['info'](_0x99a1('0x1b'),_0x2d8cac);logger[_0x99a1('0x13')]('CreateFaxMessage',_0x2d8cac,JSON[_0x99a1('0x15')](_0x2d3b82));_0x5eabcb(_0x2d3b82);})['catch'](function(_0x1f9800){logger[_0x99a1('0x16')](_0x99a1('0x1b'),_0x1f9800[_0x99a1('0x18')],_0x2d8cac);_0x3023a1(_0x3c23c0[_0x99a1('0x16')](0x1f4,_0x1f9800[_0x99a1('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x114b38){var _0x5dabd9=this;return new Promise(function(_0x5dc733,_0xafea84){return db[_0x99a1('0x1c')][_0x99a1('0x20')](_0x114b38[_0x99a1('0x1d')],{'raw':_0x114b38[_0x99a1('0x1e')]?_0x114b38[_0x99a1('0x1e')][_0x99a1('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x114b38['options']?_0x114b38[_0x99a1('0x1e')]['where']||null:null,'attributes':_0x114b38[_0x99a1('0x1e')]?_0x114b38[_0x99a1('0x1e')][_0x99a1('0x21')]||null:null,'limit':_0x114b38['options']?_0x114b38[_0x99a1('0x1e')][_0x99a1('0x22')]||null:null})['then'](function(_0x37514e){logger[_0x99a1('0x10')](_0x99a1('0x23'),_0x114b38);logger[_0x99a1('0x13')](_0x99a1('0x23'),_0x114b38,JSON[_0x99a1('0x15')](_0x37514e));_0x5dc733(_0x37514e);})[_0x99a1('0x1a')](function(_0x26c23c){logger['error']('UpdateFaxMessage',_0x26c23c[_0x99a1('0x18')],_0x114b38);_0xafea84(_0x5dabd9['error'](0x1f4,_0x26c23c[_0x99a1('0x18')]));});});}; \ No newline at end of file +var _0xe14d=['code','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x23dafd,_0xd1678d){var _0x869c19=function(_0x3b942c){while(--_0x3b942c){_0x23dafd['push'](_0x23dafd['shift']());}};_0x869c19(++_0xd1678d);}(_0xe14d,0x1ee));var _0xde14=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xe14d[_0xbe200f];return _0x192597;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xde14('0xc')],{'host':_0xde14('0xd'),'port':0x18eb});var socket=require(_0xde14('0xe'))(new Redis(config[_0xde14('0xc')]));require(_0xde14('0xf'))[_0xde14('0x10')](socket);function respondWithRpcPromise(_0xa17e8,_0x1ce0a2,_0x4b2b15){return new BPromise(function(_0x1a7167,_0xe785fb){return client[_0xde14('0x11')](_0xa17e8,_0x4b2b15)[_0xde14('0x12')](function(_0x8e0e){logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));logger[_0xde14('0x16')](_0xde14('0x17'),_0x1ce0a2,_0xde14('0x15'),JSON[_0xde14('0x18')](_0x8e0e));if(_0x8e0e[_0xde14('0x19')]){if(_0x8e0e[_0xde14('0x19')][_0xde14('0x1a')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0xe785fb(_0x8e0e[_0xde14('0x19')]['message']);}logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0x1a7167(_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);}else{logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));_0x1a7167(_0x8e0e[_0xde14('0x1c')]['message']);}})[_0xde14('0x1d')](function(_0x3bfc59){logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x3bfc59);_0xe785fb(_0x3bfc59);});});}exports['CreateFaxMessage']=function(_0x394de7){var _0x53e905=this;return new Promise(function(_0x45d101,_0x4c24a8){return db[_0xde14('0x1e')][_0xde14('0x1f')](_0x394de7[_0xde14('0x20')],{'raw':_0x394de7[_0xde14('0x21')]?_0x394de7[_0xde14('0x21')][_0xde14('0x22')]===undefined?!![]:![]:!![]})[_0xde14('0x12')](function(_0x2dd9e7){logger[_0xde14('0x13')](_0xde14('0x23'),_0x394de7);logger[_0xde14('0x16')](_0xde14('0x23'),_0x394de7,JSON[_0xde14('0x18')](_0x2dd9e7));_0x45d101(_0x2dd9e7);})['catch'](function(_0x42dd4f){logger[_0xde14('0x19')](_0xde14('0x23'),_0x42dd4f[_0xde14('0x1b')],_0x394de7);_0x4c24a8(_0x53e905[_0xde14('0x19')](0x1f4,_0x42dd4f[_0xde14('0x1b')]));});});};exports[_0xde14('0x24')]=function(_0x23c735){var _0x1618e1=this;return new Promise(function(_0x350a78,_0x4eff65){return db[_0xde14('0x1e')][_0xde14('0x25')](_0x23c735[_0xde14('0x20')],{'raw':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')]['where']||null:null,'attributes':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x26')]||null:null,'limit':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')][_0xde14('0x27')]||null:null})[_0xde14('0x12')](function(_0x237d3f){logger[_0xde14('0x13')](_0xde14('0x24'),_0x23c735);logger['debug'](_0xde14('0x24'),_0x23c735,JSON[_0xde14('0x18')](_0x237d3f));_0x350a78(_0x237d3f);})['catch'](function(_0xf25a9e){logger['error'](_0xde14('0x24'),_0xf25a9e[_0xde14('0x1b')],_0x23c735);_0x4eff65(_0x1618e1[_0xde14('0x19')](0x1f4,_0xf25a9e[_0xde14('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 4c3625b..c4e7a27 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 _0xae28=['removeListener','register','./faxMessage.events','update','emit'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xae28,0x142));var _0x8ae2=function(_0x70e2cf,_0x430c1e){_0x70e2cf=_0x70e2cf-0x0;var _0x1654d4=_0xae28[_0x70e2cf];return _0x1654d4;};'use strict';var FaxMessageEvents=require(_0x8ae2('0x0'));var events=['save','remove',_0x8ae2('0x1')];function createListener(_0xaba869,_0x2b9ea3){return function(_0x51517a){_0x2b9ea3[_0x8ae2('0x2')](_0xaba869,_0x51517a);};}function removeListener(_0x2fb3a0,_0x1059eb){return function(){FaxMessageEvents[_0x8ae2('0x3')](_0x2fb3a0,_0x1059eb);};}exports[_0x8ae2('0x4')]=function(_0x5626cf){for(var _0xaf923c=0x0,_0x104173=events['length'];_0xaf923c<_0x104173;_0xaf923c++){var _0x1a2605=events[_0xaf923c];var _0x28a143=createListener('faxMessage:'+_0x1a2605,_0x5626cf);FaxMessageEvents['on'](_0x1a2605,_0x28a143);}}; \ No newline at end of file +var _0x7bcc=['remove','update','emit','removeListener','register','length','./faxMessage.events'];(function(_0x64697d,_0x120343){var _0x5f0cfc=function(_0x5b28fb){while(--_0x5b28fb){_0x64697d['push'](_0x64697d['shift']());}};_0x5f0cfc(++_0x120343);}(_0x7bcc,0x76));var _0xc7bc=function(_0x28196b,_0x142edf){_0x28196b=_0x28196b-0x0;var _0xba80a0=_0x7bcc[_0x28196b];return _0xba80a0;};'use strict';var FaxMessageEvents=require(_0xc7bc('0x0'));var events=['save',_0xc7bc('0x1'),_0xc7bc('0x2')];function createListener(_0xf8fc0e,_0x158cdd){return function(_0x3accdd){_0x158cdd[_0xc7bc('0x3')](_0xf8fc0e,_0x3accdd);};}function removeListener(_0x2be421,_0x1b5f9f){return function(){FaxMessageEvents[_0xc7bc('0x4')](_0x2be421,_0x1b5f9f);};}exports[_0xc7bc('0x5')]=function(_0x493e41){for(var _0x16bf93=0x0,_0x282d3f=events[_0xc7bc('0x6')];_0x16bf93<_0x282d3f;_0x16bf93++){var _0x3a2101=events[_0x16bf93];var _0x560128=createListener('faxMessage:'+_0x3a2101,_0x493e41);FaxMessageEvents['on'](_0x3a2101,_0x560128);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index e6b3a1f..1a02a77 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 _0xbf6e=['accept','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','/:id/download','download','post','tracked','fax','faxmessage:create','put','update','/:id/accept'];(function(_0x485cd4,_0x506e1b){var _0x528199=function(_0x8472b3){while(--_0x8472b3){_0x485cd4['push'](_0x485cd4['shift']());}};_0x528199(++_0x506e1b);}(_0xbf6e,0x149));var _0xebf6=function(_0x2de66b,_0x33ae0c){_0x2de66b=_0x2de66b-0x0;var _0x19c1ea=_0xbf6e[_0x2de66b];return _0x19c1ea;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xebf6('0x0'));var timeout=require(_0xebf6('0x1'));var express=require(_0xebf6('0x2'));var router=express[_0xebf6('0x3')]();var fs_extra=require(_0xebf6('0x4'));var auth=require(_0xebf6('0x5'));var interaction=require(_0xebf6('0x6'));var config=require('../../config/environment');var controller=require(_0xebf6('0x7'));router[_0xebf6('0x8')]('/',auth[_0xebf6('0x9')](),controller[_0xebf6('0xa')]);router[_0xebf6('0x8')](_0xebf6('0xb'),auth[_0xebf6('0x9')](),controller['describe']);router[_0xebf6('0x8')](_0xebf6('0xc'),auth[_0xebf6('0x9')](),controller['show']);router[_0xebf6('0x8')](_0xebf6('0xd'),auth['isAuthenticated'](),controller[_0xebf6('0xe')]);router[_0xebf6('0xf')]('/',auth[_0xebf6('0x9')](),interaction[_0xebf6('0x10')](_0xebf6('0x11'),_0xebf6('0x12')),controller['create']);router[_0xebf6('0x13')](_0xebf6('0xc'),auth['isAuthenticated'](),controller[_0xebf6('0x14')]);router[_0xebf6('0x13')](_0xebf6('0x15'),auth[_0xebf6('0x9')](),controller[_0xebf6('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xebf6('0x17')]);router[_0xebf6('0x18')]('/:id',auth[_0xebf6('0x9')](),controller[_0xebf6('0x19')]);module[_0xebf6('0x1a')]=router; \ No newline at end of file +var _0xb9a7=['faxmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','/:id/download','post','tracked'];(function(_0x2e69c2,_0x38b3c9){var _0x43b101=function(_0xfea063){while(--_0xfea063){_0x2e69c2['push'](_0x2e69c2['shift']());}};_0x43b101(++_0x38b3c9);}(_0xb9a7,0x112));var _0x7b9a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xb9a7[_0x1928c9];return _0x51b5fb;};'use strict';var multer=require('multer');var util=require(_0x7b9a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7b9a('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x7b9a('0x2'));var interaction=require(_0x7b9a('0x3'));var config=require(_0x7b9a('0x4'));var controller=require(_0x7b9a('0x5'));router[_0x7b9a('0x6')]('/',auth[_0x7b9a('0x7')](),controller[_0x7b9a('0x8')]);router[_0x7b9a('0x6')](_0x7b9a('0x9'),auth[_0x7b9a('0x7')](),controller['describe']);router[_0x7b9a('0x6')](_0x7b9a('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x7b9a('0xb'),auth[_0x7b9a('0x7')](),controller['download']);router[_0x7b9a('0xc')]('/',auth['isAuthenticated'](),interaction[_0x7b9a('0xd')]('fax',_0x7b9a('0xe')),controller[_0x7b9a('0xf')]);router[_0x7b9a('0x10')]('/:id',auth[_0x7b9a('0x7')](),controller[_0x7b9a('0x11')]);router['put'](_0x7b9a('0x12'),auth[_0x7b9a('0x7')](),controller['accept']);router[_0x7b9a('0x10')](_0x7b9a('0x13'),auth[_0x7b9a('0x7')](),controller[_0x7b9a('0x14')]);router[_0x7b9a('0x15')](_0x7b9a('0xa'),auth[_0x7b9a('0x7')](),controller[_0x7b9a('0x16')]);module[_0x7b9a('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 806a4cb..5d92388 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 _0x83ad=['name','ENUM','rrmemory','INTEGER','sequelize','STRING'];(function(_0xfff28b,_0x204443){var _0x13c9f0=function(_0x4d9f58){while(--_0x4d9f58){_0xfff28b['push'](_0xfff28b['shift']());}};_0x13c9f0(++_0x204443);}(_0x83ad,0x1e4));var _0xd83a=function(_0x5c34a9,_0x69b8b8){_0x5c34a9=_0x5c34a9-0x0;var _0x4f44ed=_0x83ad[_0x5c34a9];return _0x4f44ed;};'use strict';var Sequelize=require(_0xd83a('0x0'));module['exports']={'name':{'type':Sequelize[_0xd83a('0x1')],'unique':_0xd83a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd83a('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd83a('0x3')](_0xd83a('0x4'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xd83a('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc139=['roundrobin','sequelize','name','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x50b774,_0x17af3d){var _0xedafdb=function(_0x211f40){while(--_0x211f40){_0x50b774['push'](_0x50b774['shift']());}};_0xedafdb(++_0x17af3d);}(_0xc139,0x1b9));var _0x9c13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc139[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9c13('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x9c13('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9c13('0x2')]},'timeout':{'type':Sequelize[_0x9c13('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9c13('0x4')](_0x9c13('0x5'),_0x9c13('0x6'),_0x9c13('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9c13('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 bd72b29..bdecedb 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 _0x9b1d=['fieldName','type','model','map','query','keys','intersection','attributes','fields','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','length','create','body','user','FaxQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','findAndCountAll','agent','updatedAt','createdAt','faxPause','getTeams','addTeams','Team','Agents','interface','transaction','each','findOrCreate','forEach','emit','ids','User','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','userFaxQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','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','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','index','FaxQueue','rawAttributes'];(function(_0x1b6629,_0x41826d){var _0x3fbd4b=function(_0x533b4f){while(--_0x533b4f){_0x1b6629['push'](_0x1b6629['shift']());}};_0x3fbd4b(++_0x41826d);}(_0x9b1d,0x173));var _0xd9b1=function(_0x10a4f2,_0x437345){_0x10a4f2=_0x10a4f2-0x0;var _0x1a02bd=_0x9b1d[_0x10a4f2];return _0x1a02bd;};'use strict';var emlformat=require(_0xd9b1('0x0'));var rimraf=require(_0xd9b1('0x1'));var zipdir=require(_0xd9b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9b1('0x3'));var moment=require(_0xd9b1('0x4'));var BPromise=require(_0xd9b1('0x5'));var Mustache=require(_0xd9b1('0x6'));var util=require('util');var path=require(_0xd9b1('0x7'));var sox=require(_0xd9b1('0x8'));var csv=require(_0xd9b1('0x9'));var ejs=require(_0xd9b1('0xa'));var fs=require('fs');var fs_extra=require(_0xd9b1('0xb'));var _=require(_0xd9b1('0xc'));var squel=require(_0xd9b1('0xd'));var crypto=require(_0xd9b1('0xe'));var jsforce=require(_0xd9b1('0xf'));var deskjs=require(_0xd9b1('0x10'));var toCsv=require(_0xd9b1('0x9'));var querystring=require('querystring');var Papa=require(_0xd9b1('0x11'));var Redis=require(_0xd9b1('0x12'));var authService=require(_0xd9b1('0x13'));var qs=require(_0xd9b1('0x14'));var as=require(_0xd9b1('0x15'));var hardwareService=require(_0xd9b1('0x16'));var logger=require(_0xd9b1('0x17'))(_0xd9b1('0x18'));var utils=require(_0xd9b1('0x19'));var config=require(_0xd9b1('0x1a'));var licenseUtil=require(_0xd9b1('0x1b'));var db=require(_0xd9b1('0x1c'))['db'];config[_0xd9b1('0x1d')]=_[_0xd9b1('0x1e')](config['redis'],{'host':_0xd9b1('0x1f'),'port':0x18eb});var socket=require(_0xd9b1('0x20'))(new Redis(config['redis']));require(_0xd9b1('0x21'))[_0xd9b1('0x22')](socket);function respondWithStatusCode(_0x58a47e,_0x232a58){_0x232a58=_0x232a58||0xcc;return function(_0x199dbe){if(_0x199dbe){return _0x58a47e[_0xd9b1('0x23')](_0x232a58);}return _0x58a47e[_0xd9b1('0x24')](_0x232a58)[_0xd9b1('0x25')]();};}function respondWithResult(_0x13f9c0,_0x4dd91f){_0x4dd91f=_0x4dd91f||0xc8;return function(_0x1dbe3c){if(_0x1dbe3c){return _0x13f9c0[_0xd9b1('0x24')](_0x4dd91f)[_0xd9b1('0x26')](_0x1dbe3c);}};}function respondWithFilteredResult(_0x2ef93e,_0x5d672a){return function(_0xfd4a8b){if(_0xfd4a8b){var _0x5a3b65=typeof _0x5d672a['offset']==='undefined'&&typeof _0x5d672a[_0xd9b1('0x27')]===_0xd9b1('0x28');var _0x2287bc=_0xfd4a8b[_0xd9b1('0x29')];var _0x1588de=_0x5a3b65?0x0:_0x5d672a['offset'];var _0x3bafd2=_0x5a3b65?_0xfd4a8b[_0xd9b1('0x29')]:_0x5d672a[_0xd9b1('0x2a')]+_0x5d672a[_0xd9b1('0x27')];var _0x2448f8;if(_0x3bafd2>=_0x2287bc){_0x3bafd2=_0x2287bc;_0x2448f8=0xc8;}else{_0x2448f8=0xce;}_0x2ef93e['status'](_0x2448f8);return _0x2ef93e[_0xd9b1('0x2b')](_0xd9b1('0x2c'),_0x1588de+'-'+_0x3bafd2+'/'+_0x2287bc)[_0xd9b1('0x26')](_0xfd4a8b);}return null;};}function patchUpdates(_0x2933ba){return function(_0xa67ece){try{jsonpatch['apply'](_0xa67ece,_0x2933ba,!![]);}catch(_0x4e5c1f){return BPromise[_0xd9b1('0x2d')](_0x4e5c1f);}return _0xa67ece[_0xd9b1('0x2e')]();};}function saveUpdates(_0x179275,_0xf766a8){return function(_0x31ba79){if(_0x31ba79){return _0x31ba79[_0xd9b1('0x2f')](_0x179275)['then'](function(_0x368755){return _0x368755;});}return null;};}function removeEntity(_0x15e122,_0x215945){return function(_0x5599b5){if(_0x5599b5){return _0x5599b5['destroy']()[_0xd9b1('0x30')](function(){var _0x4dfc89=_0x5599b5[_0xd9b1('0x31')]({'plain':!![]});var _0x4c892f='FaxQueues';return db[_0xd9b1('0x32')][_0xd9b1('0x33')]({'where':{'type':_0x4c892f,'resourceId':_0x4dfc89['id']}})[_0xd9b1('0x30')](function(){return _0x5599b5;});})[_0xd9b1('0x30')](function(){_0x15e122['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5256a4,_0x34af09){return function(_0x4f248b){if(!_0x4f248b){_0x5256a4['sendStatus'](0x194);}return _0x4f248b;};}function handleError(_0x47d066,_0x44c24b){_0x44c24b=_0x44c24b||0x1f4;return function(_0xb5fdaa){logger[_0xd9b1('0x34')](_0xb5fdaa[_0xd9b1('0x35')]);if(_0xb5fdaa['name']){delete _0xb5fdaa[_0xd9b1('0x36')];}_0x47d066[_0xd9b1('0x24')](_0x44c24b)['send'](_0xb5fdaa);};}exports[_0xd9b1('0x37')]=function(_0x1c2330,_0x2978e5){var _0x432ef4={},_0x352184={},_0x2cd5cb={'count':0x0,'rows':[]};var _0xeb0fa7=_['map'](db[_0xd9b1('0x38')][_0xd9b1('0x39')],function(_0x36107a){return{'name':_0x36107a[_0xd9b1('0x3a')],'type':_0x36107a[_0xd9b1('0x3b')]['key']};});_0x352184[_0xd9b1('0x3c')]=_[_0xd9b1('0x3d')](_0xeb0fa7,'name');_0x352184[_0xd9b1('0x3e')]=_[_0xd9b1('0x3f')](_0x1c2330[_0xd9b1('0x3e')]);_0x352184['filters']=_[_0xd9b1('0x40')](_0x352184[_0xd9b1('0x3c')],_0x352184['query']);_0x432ef4[_0xd9b1('0x41')]=_[_0xd9b1('0x40')](_0x352184['model'],qs[_0xd9b1('0x42')](_0x1c2330[_0xd9b1('0x3e')][_0xd9b1('0x42')]));_0x432ef4[_0xd9b1('0x41')]=_0x432ef4[_0xd9b1('0x41')]['length']?_0x432ef4[_0xd9b1('0x41')]:_0x352184['model'];if(!_0x1c2330['query']['hasOwnProperty']('nolimit')){_0x432ef4[_0xd9b1('0x27')]=qs[_0xd9b1('0x27')](_0x1c2330[_0xd9b1('0x3e')][_0xd9b1('0x27')]);_0x432ef4['offset']=qs['offset'](_0x1c2330[_0xd9b1('0x3e')]['offset']);}_0x432ef4[_0xd9b1('0x43')]=qs[_0xd9b1('0x44')](_0x1c2330['query'][_0xd9b1('0x44')]);_0x432ef4[_0xd9b1('0x45')]=qs['filters'](_[_0xd9b1('0x46')](_0x1c2330['query'],_0x352184[_0xd9b1('0x47')]),_0xeb0fa7);if(_0x1c2330[_0xd9b1('0x3e')][_0xd9b1('0x48')]){_0x432ef4[_0xd9b1('0x45')]=_['merge'](_0x432ef4[_0xd9b1('0x45')],{'$or':_[_0xd9b1('0x3d')](_0xeb0fa7,function(_0x595eac){if(_0x595eac[_0xd9b1('0x3b')]!==_0xd9b1('0x49')){var _0x21db95={};_0x21db95[_0x595eac[_0xd9b1('0x36')]]={'$like':'%'+_0x1c2330[_0xd9b1('0x3e')][_0xd9b1('0x48')]+'%'};return _0x21db95;}})});}_0x432ef4=_[_0xd9b1('0x4a')]({},_0x432ef4,_0x1c2330[_0xd9b1('0x4b')]);var _0x76ba2d={'where':_0x432ef4[_0xd9b1('0x45')]};return db['FaxQueue'][_0xd9b1('0x29')](_0x76ba2d)[_0xd9b1('0x30')](function(_0x1ee2a8){_0x2cd5cb[_0xd9b1('0x29')]=_0x1ee2a8;if(_0x1c2330[_0xd9b1('0x3e')][_0xd9b1('0x4c')]){_0x432ef4[_0xd9b1('0x4d')]=[{'all':!![]}];}return db[_0xd9b1('0x38')][_0xd9b1('0x4e')](_0x432ef4);})[_0xd9b1('0x30')](function(_0x4a7b95){_0x2cd5cb[_0xd9b1('0x4f')]=_0x4a7b95;return _0x2cd5cb;})[_0xd9b1('0x30')](respondWithFilteredResult(_0x2978e5,_0x432ef4))[_0xd9b1('0x50')](handleError(_0x2978e5,null));};exports[_0xd9b1('0x51')]=function(_0x214986,_0x36e1a1){var _0x2748d8={'raw':!![],'where':{'id':_0x214986['params']['id']}},_0xb14b81={};_0xb14b81[_0xd9b1('0x3c')]=_['keys'](db['FaxQueue'][_0xd9b1('0x39')]);_0xb14b81[_0xd9b1('0x3e')]=_['keys'](_0x214986[_0xd9b1('0x3e')]);_0xb14b81['filters']=_[_0xd9b1('0x40')](_0xb14b81[_0xd9b1('0x3c')],_0xb14b81[_0xd9b1('0x3e')]);_0x2748d8[_0xd9b1('0x41')]=_['intersection'](_0xb14b81[_0xd9b1('0x3c')],qs['fields'](_0x214986['query'][_0xd9b1('0x42')]));_0x2748d8['attributes']=_0x2748d8['attributes'][_0xd9b1('0x52')]?_0x2748d8['attributes']:_0xb14b81[_0xd9b1('0x3c')];if(_0x214986['query']['includeAll']){_0x2748d8['include']=[{'all':!![]}];}_0x2748d8=_['merge']({},_0x2748d8,_0x214986[_0xd9b1('0x4b')]);return db[_0xd9b1('0x38')]['find'](_0x2748d8)['then'](handleEntityNotFound(_0x36e1a1,null))[_0xd9b1('0x30')](respondWithResult(_0x36e1a1,null))[_0xd9b1('0x50')](handleError(_0x36e1a1,null));};exports['create']=function(_0x303ac6,_0x42dae4){return db[_0xd9b1('0x38')][_0xd9b1('0x53')](_0x303ac6[_0xd9b1('0x54')],{})[_0xd9b1('0x30')](function(_0x47e238){var _0x4b1c2b=_0x303ac6[_0xd9b1('0x55')][_0xd9b1('0x31')]({'plain':!![]});if(!_0x4b1c2b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b1c2b['role']===_0xd9b1('0x55')){var _0x3b478c=_0x47e238[_0xd9b1('0x31')]({'plain':!![]});var _0x544a1a=_0xd9b1('0x56');return db['UserProfileSection']['find']({'where':{'name':_0x544a1a,'userProfileId':_0x4b1c2b[_0xd9b1('0x57')]},'raw':!![]})[_0xd9b1('0x30')](function(_0x5cfa37){if(_0x5cfa37&&_0x5cfa37[_0xd9b1('0x58')]===0x0){return db['UserProfileResource'][_0xd9b1('0x53')]({'name':_0x3b478c[_0xd9b1('0x36')],'resourceId':_0x3b478c['id'],'type':_0x5cfa37[_0xd9b1('0x36')],'sectionId':_0x5cfa37['id']},{})[_0xd9b1('0x30')](function(){return _0x47e238;});}else{return _0x47e238;}})[_0xd9b1('0x50')](function(_0x167b16){logger[_0xd9b1('0x34')](_0xd9b1('0x59'),_0x167b16);throw _0x167b16;});}return _0x47e238;})[_0xd9b1('0x30')](respondWithResult(_0x42dae4,0xc9))[_0xd9b1('0x50')](handleError(_0x42dae4,null));};exports[_0xd9b1('0x2f')]=function(_0x2cfb25,_0x3d0512){if(_0x2cfb25[_0xd9b1('0x54')]['id']){delete _0x2cfb25[_0xd9b1('0x54')]['id'];}return db[_0xd9b1('0x38')][_0xd9b1('0x5a')]({'where':{'id':_0x2cfb25[_0xd9b1('0x5b')]['id']}})[_0xd9b1('0x30')](handleEntityNotFound(_0x3d0512,null))[_0xd9b1('0x30')](saveUpdates(_0x2cfb25['body'],null))[_0xd9b1('0x30')](respondWithResult(_0x3d0512,null))[_0xd9b1('0x50')](handleError(_0x3d0512,null));};exports['destroy']=function(_0x14b0ac,_0x36bca6){return db[_0xd9b1('0x38')]['find']({'where':{'id':_0x14b0ac[_0xd9b1('0x5b')]['id']}})[_0xd9b1('0x30')](handleEntityNotFound(_0x36bca6,null))[_0xd9b1('0x30')](removeEntity(_0x36bca6,null))[_0xd9b1('0x50')](handleError(_0x36bca6,null));};exports[_0xd9b1('0x5c')]=function(_0x5107f9,_0x435e23){return db['FaxQueue']['describe']()[_0xd9b1('0x30')](respondWithResult(_0x435e23,null))['catch'](handleError(_0x435e23,null));};exports[_0xd9b1('0x5d')]=function(_0x12a0c4,_0x88c2f7,_0x3c2ccd){var _0x22fa02={'raw':!![],'where':{}},_0x345c2a={},_0x548033;return db['FaxQueue'][_0xd9b1('0x5e')]({'where':{'id':_0x12a0c4[_0xd9b1('0x5b')]['id']}})[_0xd9b1('0x30')](handleEntityNotFound(_0x88c2f7,null))[_0xd9b1('0x30')](function(_0x1c2334){if(_0x1c2334){_0x548033=_0x1c2334[_0xd9b1('0x31')]({'plain':!![]});_0x345c2a['model']=_[_0xd9b1('0x3f')](db[_0xd9b1('0x5f')]['rawAttributes']);_0x345c2a[_0xd9b1('0x3e')]=_['keys'](_0x12a0c4[_0xd9b1('0x3e')]);_0x345c2a[_0xd9b1('0x47')]=_['intersection'](_0x345c2a['model'],_0x345c2a[_0xd9b1('0x3e')]);_0x22fa02['attributes']=_[_0xd9b1('0x40')](_0x345c2a[_0xd9b1('0x3c')],qs['fields'](_0x12a0c4[_0xd9b1('0x3e')][_0xd9b1('0x42')]));_0x22fa02[_0xd9b1('0x41')]=_0x22fa02[_0xd9b1('0x41')][_0xd9b1('0x52')]?_0x22fa02['attributes']:_0x345c2a[_0xd9b1('0x3c')];if(!_0x12a0c4['query'][_0xd9b1('0x60')](_0xd9b1('0x61'))){_0x22fa02[_0xd9b1('0x27')]=qs[_0xd9b1('0x27')](_0x12a0c4[_0xd9b1('0x3e')]['limit']);_0x22fa02[_0xd9b1('0x2a')]=qs['offset'](_0x12a0c4['query'][_0xd9b1('0x2a')]);}_0x22fa02['order']=qs[_0xd9b1('0x44')](_0x12a0c4[_0xd9b1('0x3e')][_0xd9b1('0x44')]);_0x22fa02[_0xd9b1('0x45')]=qs[_0xd9b1('0x47')](_[_0xd9b1('0x46')](_0x12a0c4[_0xd9b1('0x3e')],_0x345c2a['filters']));_0x22fa02[_0xd9b1('0x45')]['FaxQueueId']=_0x1c2334['id'];if(_0x12a0c4['query'][_0xd9b1('0x48')]){_0x22fa02[_0xd9b1('0x45')]=_[_0xd9b1('0x4a')](_0x22fa02[_0xd9b1('0x45')],{'$or':_['map'](_0x22fa02['attributes'],function(_0x484f4a){var _0x45fba6={};_0x45fba6[_0x484f4a]={'$like':'%'+_0x12a0c4[_0xd9b1('0x3e')][_0xd9b1('0x48')]+'%'};return _0x45fba6;})});}_0x22fa02=_['merge']({},_0x22fa02,_0x12a0c4[_0xd9b1('0x4b')]);return db[_0xd9b1('0x5f')][_0xd9b1('0x4e')](_0x22fa02);}})['then'](function(_0x9645d8){if(_0x9645d8){return db['User'][_0xd9b1('0x62')]({'where':{'id':_['map'](_0x9645d8,'UserId'),'role':_0xd9b1('0x63')},'attributes':['id','name','faxPause',_0xd9b1('0x64'),_0xd9b1('0x65')]});}})[_0xd9b1('0x30')](function(_0x106160){if(_0x106160){return{'count':_0x106160[_0xd9b1('0x29')],'rows':_[_0xd9b1('0x3d')](_0x106160[_0xd9b1('0x4f')],function(_0x1c613e){return{'membername':_0x1c613e['name'],'UserId':_0x1c613e['id'],'queue_name':_0x548033[_0xd9b1('0x36')],'FaxQueueId':_0x548033['id'],'interface':util['format']('%s/%s','SIP',_0x1c613e[_0xd9b1('0x36')]),'penalty':0x0,'paused':_0x1c613e[_0xd9b1('0x66')],'createdAt':_0x1c613e[_0xd9b1('0x65')],'updatedAt':_0x1c613e[_0xd9b1('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd9b1('0x30')](respondWithFilteredResult(_0x88c2f7,_0x22fa02))[_0xd9b1('0x50')](handleError(_0x88c2f7,null));};exports[_0xd9b1('0x67')]=function(_0x198f7a,_0x2ef04c,_0x1ec26d){var _0x2aeaf4={};var _0x20ecf6={};var _0x568dee;var _0x1ca9ad;return db[_0xd9b1('0x38')][_0xd9b1('0x5e')]({'where':{'id':_0x198f7a[_0xd9b1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2ef04c,null))[_0xd9b1('0x30')](function(_0x53800a){if(_0x53800a){_0x568dee=_0x53800a;_0x20ecf6[_0xd9b1('0x3c')]=_[_0xd9b1('0x3f')](db['Team'][_0xd9b1('0x39')]);_0x20ecf6['query']=_[_0xd9b1('0x3f')](_0x198f7a[_0xd9b1('0x3e')]);_0x20ecf6[_0xd9b1('0x47')]=_[_0xd9b1('0x40')](_0x20ecf6[_0xd9b1('0x3c')],_0x20ecf6[_0xd9b1('0x3e')]);_0x2aeaf4['attributes']=_[_0xd9b1('0x40')](_0x20ecf6[_0xd9b1('0x3c')],qs[_0xd9b1('0x42')](_0x198f7a[_0xd9b1('0x3e')]['fields']));_0x2aeaf4[_0xd9b1('0x41')]=_0x2aeaf4[_0xd9b1('0x41')]['length']?_0x2aeaf4[_0xd9b1('0x41')]:_0x20ecf6[_0xd9b1('0x3c')];_0x2aeaf4[_0xd9b1('0x43')]=qs[_0xd9b1('0x44')](_0x198f7a[_0xd9b1('0x3e')]['sort']);_0x2aeaf4[_0xd9b1('0x45')]=qs['filters'](_[_0xd9b1('0x46')](_0x198f7a[_0xd9b1('0x3e')],_0x20ecf6[_0xd9b1('0x47')]));if(_0x198f7a[_0xd9b1('0x3e')][_0xd9b1('0x48')]){_0x2aeaf4[_0xd9b1('0x45')]=_[_0xd9b1('0x4a')](_0x2aeaf4[_0xd9b1('0x45')],{'$or':_[_0xd9b1('0x3d')](_0x2aeaf4['attributes'],function(_0x4965c2){var _0x4684e5={};_0x4684e5[_0x4965c2]={'$like':'%'+_0x198f7a[_0xd9b1('0x3e')][_0xd9b1('0x48')]+'%'};return _0x4684e5;})});}_0x2aeaf4=_[_0xd9b1('0x4a')]({},_0x2aeaf4,_0x198f7a[_0xd9b1('0x4b')]);return _0x568dee[_0xd9b1('0x67')](_0x2aeaf4);}})[_0xd9b1('0x30')](function(_0x306077){if(_0x306077){_0x1ca9ad=_0x306077[_0xd9b1('0x52')];if(!_0x198f7a[_0xd9b1('0x3e')][_0xd9b1('0x60')](_0xd9b1('0x61'))){_0x2aeaf4[_0xd9b1('0x27')]=qs[_0xd9b1('0x27')](_0x198f7a[_0xd9b1('0x3e')]['limit']);_0x2aeaf4[_0xd9b1('0x2a')]=qs['offset'](_0x198f7a[_0xd9b1('0x3e')][_0xd9b1('0x2a')]);}return _0x568dee[_0xd9b1('0x67')](_0x2aeaf4);}})['then'](function(_0x34c8e8){if(_0x34c8e8){return _0x34c8e8?{'count':_0x1ca9ad,'rows':_0x34c8e8}:null;}})[_0xd9b1('0x30')](respondWithResult(_0x2ef04c,null))['catch'](handleError(_0x2ef04c,null));};exports[_0xd9b1('0x68')]=function(_0x1fa060,_0x368af8,_0x194a59){var _0x20ae02=_0x1fa060['body']['ids'];return db[_0xd9b1('0x69')][_0xd9b1('0x4e')]({'where':{'id':_0x20ae02},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd9b1('0x6a'),'attributes':['id',_0xd9b1('0x36'),'online','voicePause',_0xd9b1('0x6b')],'raw':!![]}]})[_0xd9b1('0x30')](function(_0x52d001){if(_0x52d001){var _0x32dd84=_['flatMap'](_0x52d001,function(_0x5d1c21){var _0x194b45=_0x5d1c21[_0xd9b1('0x31')]({'plain':!![]});return _0x194b45[_0xd9b1('0x6a')];});return db[_0xd9b1('0x38')][_0xd9b1('0x5a')]({'where':{'id':_0x1fa060[_0xd9b1('0x5b')]['id']}})[_0xd9b1('0x30')](function(_0x2e778d){return db['sequelize'][_0xd9b1('0x6c')](function(_0x19351e){return _0x2e778d['addTeams'](_0x20ae02,{'transaction':_0x19351e})[_0xd9b1('0x30')](function(){return BPromise[_0xd9b1('0x6d')](_0x32dd84,function(_0xb1da70){return db['UserFaxQueue'][_0xd9b1('0x6e')]({'where':{'UserId':_0xb1da70['id'],'FaxQueueId':_0x1fa060[_0xd9b1('0x5b')]['id']},'transaction':_0x19351e});});})[_0xd9b1('0x30')](function(){_0x32dd84[_0xd9b1('0x6f')](function(_0x5332eb){socket[_0xd9b1('0x70')]('userFaxQueue:save',{'UserId':_0x5332eb['id'],'FaxQueueId':_0x2e778d['id']});});});});});}})[_0xd9b1('0x30')](respondWithStatusCode(_0x368af8,null))['catch'](handleError(_0x368af8,null));};exports['removeTeams']=function(_0x5bd368,_0x3a84a4,_0x1e2327){return db[_0xd9b1('0x69')]['findAll']({'where':{'id':_0x5bd368[_0xd9b1('0x3e')][_0xd9b1('0x71')]},'attributes':['id'],'include':[{'model':db[_0xd9b1('0x72')],'as':_0xd9b1('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3a84a4,null))['then'](function(_0x568ce8){var _0x43bc50=_[_0xd9b1('0x3d')](_0x568ce8,'id');var _0x247b81=[];var _0x5173df=[];var _0x488cb2=squel[_0xd9b1('0x73')]();_0x488cb2['field'](_0xd9b1('0x74'))[_0xd9b1('0x75')]('team_has_fax_queues','tq')[_0xd9b1('0x76')](_0xd9b1('0x77'),'ut',_0xd9b1('0x78'))[_0xd9b1('0x45')]('FaxQueueId\x20=\x20?',_0x5bd368[_0xd9b1('0x5b')]['id']);for(var _0x3a807a=0x0;_0x3a807a<_0x568ce8[_0xd9b1('0x52')];_0x3a807a+=0x1){let _0x4574c1=_0x568ce8[_0x3a807a];for(var _0x303c0d=0x0;_0x303c0d<_0x4574c1[_0xd9b1('0x6a')][_0xd9b1('0x52')];_0x303c0d+=0x1){let _0x2871d6=_0x4574c1[_0xd9b1('0x6a')][_0x303c0d];var _0x4753f3=_0x488cb2[_0xd9b1('0x79')]();_0x4753f3[_0xd9b1('0x45')](_0xd9b1('0x7a'),_0x2871d6['id']);_0x5173df[_0xd9b1('0x7b')](db['sequelize']['query'](_0x4753f3[_0xd9b1('0x7c')](),{'type':db[_0xd9b1('0x7d')][_0xd9b1('0x7e')]['SELECT']})[_0xd9b1('0x30')](function(_0x1a0389){if(_0x1a0389[_0xd9b1('0x52')]===0x1){return _0x2871d6['id'];}else{var _0x1e9b23=_[_0xd9b1('0x7f')](_[_0xd9b1('0x3d')](_0x1a0389,_0xd9b1('0x80')),function(_0x46ed94){return _[_0xd9b1('0x81')](_0x43bc50,_0x46ed94);});if(_0x1e9b23){return _0x2871d6['id'];}}}));}}return BPromise[_0xd9b1('0x82')](_0x5173df)['then'](function(_0x47cccc){_0x247b81=_(_0x247b81)[_0xd9b1('0x83')](_0x47cccc)[_0xd9b1('0x84')]()[_0xd9b1('0x85')]();return db[_0xd9b1('0x38')][_0xd9b1('0x5a')]({'where':{'id':_0x5bd368[_0xd9b1('0x5b')]['id']}})['then'](function(_0xcb373d){return db[_0xd9b1('0x7d')][_0xd9b1('0x6c')](function(_0x343d18){return _0xcb373d[_0xd9b1('0x86')](_0x5bd368[_0xd9b1('0x3e')]['ids'],{'transaction':_0x343d18})['then'](function(){if(!_[_0xd9b1('0x87')](_0x247b81)){return _0xcb373d[_0xd9b1('0x88')](_0x247b81,{'transaction':_0x343d18});}})[_0xd9b1('0x30')](function(){_0x247b81[_0xd9b1('0x6f')](function(_0x127365){socket[_0xd9b1('0x70')](_0xd9b1('0x89'),{'UserId':_0x127365,'FaxQueueId':_0xcb373d['id']});});});});});});})[_0xd9b1('0x30')](respondWithStatusCode(_0x3a84a4,null))['catch'](handleError(_0x3a84a4,null));};exports[_0xd9b1('0x8a')]=function(_0x212eb6,_0x22681c,_0x3efc40){return db[_0xd9b1('0x38')][_0xd9b1('0x5a')]({'where':{'id':_0x212eb6['params']['id']}})[_0xd9b1('0x30')](handleEntityNotFound(_0x22681c,null))[_0xd9b1('0x30')](function(_0x3eec80){if(_0x3eec80){return _0x3eec80[_0xd9b1('0x8a')](_0x212eb6[_0xd9b1('0x54')][_0xd9b1('0x71')],_[_0xd9b1('0x8b')](_0x212eb6[_0xd9b1('0x54')],[_0xd9b1('0x71'),'id'])||{})['spread'](function(_0x2db32f){for(var _0x295b90=0x0;_0x295b90<_0x212eb6['body'][_0xd9b1('0x71')][_0xd9b1('0x52')];_0x295b90+=0x1){socket['emit'](_0xd9b1('0x8c'),{'UserId':Number(_0x212eb6[_0xd9b1('0x54')][_0xd9b1('0x71')][_0x295b90]),'FaxQueueId':Number(_0x212eb6[_0xd9b1('0x5b')]['id'])});}return _0x2db32f;});}})['then'](respondWithResult(_0x22681c,null))[_0xd9b1('0x50')](handleError(_0x22681c,null));};exports[_0xd9b1('0x88')]=function(_0x55af70,_0x1664bc,_0x5b3b40){return db[_0xd9b1('0x38')]['find']({'where':{'id':_0x55af70[_0xd9b1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1664bc,null))[_0xd9b1('0x30')](function(_0x1576ad){if(_0x1576ad){return _0x1576ad['removeAgents'](_0x55af70[_0xd9b1('0x3e')][_0xd9b1('0x71')])['then'](function(){if(_[_0xd9b1('0x8d')](_0x55af70[_0xd9b1('0x3e')][_0xd9b1('0x71')])){for(var _0x5a0f9c=0x0;_0x5a0f9c<_0x55af70[_0xd9b1('0x3e')][_0xd9b1('0x71')][_0xd9b1('0x52')];_0x5a0f9c+=0x1){socket['emit'](_0xd9b1('0x89'),{'UserId':Number(_0x55af70[_0xd9b1('0x3e')][_0xd9b1('0x71')][_0x5a0f9c]),'FaxQueueId':Number(_0x55af70[_0xd9b1('0x5b')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x55af70[_0xd9b1('0x3e')][_0xd9b1('0x71')]),'FaxQueueId':Number(_0x55af70[_0xd9b1('0x5b')]['id'])});}});}})[_0xd9b1('0x30')](respondWithStatusCode(_0x1664bc,null))[_0xd9b1('0x50')](handleError(_0x1664bc,null));};exports[_0xd9b1('0x8e')]=function(_0x403ba4,_0x252578,_0x320b85){var _0x3448b7={};var _0x1b7a92={};var _0x1e7a3c;var _0x51a31b;return db[_0xd9b1('0x38')][_0xd9b1('0x5e')]({'where':{'id':_0x403ba4['params']['id']}})[_0xd9b1('0x30')](handleEntityNotFound(_0x252578,null))[_0xd9b1('0x30')](function(_0xbfad21){if(_0xbfad21){_0x1e7a3c=_0xbfad21;_0x1b7a92['model']=_[_0xd9b1('0x3f')](db[_0xd9b1('0x72')][_0xd9b1('0x39')]);_0x1b7a92[_0xd9b1('0x3e')]=_[_0xd9b1('0x3f')](_0x403ba4['query']);_0x1b7a92['filters']=_[_0xd9b1('0x40')](_0x1b7a92[_0xd9b1('0x3c')],_0x1b7a92[_0xd9b1('0x3e')]);_0x3448b7[_0xd9b1('0x41')]=_[_0xd9b1('0x40')](_0x1b7a92[_0xd9b1('0x3c')],qs[_0xd9b1('0x42')](_0x403ba4[_0xd9b1('0x3e')][_0xd9b1('0x42')]));_0x3448b7[_0xd9b1('0x41')]=_0x3448b7[_0xd9b1('0x41')][_0xd9b1('0x52')]?_0x3448b7['attributes']:_0x1b7a92['model'];_0x3448b7[_0xd9b1('0x43')]=qs[_0xd9b1('0x44')](_0x403ba4[_0xd9b1('0x3e')][_0xd9b1('0x44')]);_0x3448b7[_0xd9b1('0x45')]=qs[_0xd9b1('0x47')](_[_0xd9b1('0x46')](_0x403ba4[_0xd9b1('0x3e')],_0x1b7a92[_0xd9b1('0x47')]));if(_0x403ba4[_0xd9b1('0x3e')][_0xd9b1('0x48')]){_0x3448b7['where']=_[_0xd9b1('0x4a')](_0x3448b7[_0xd9b1('0x45')],{'$or':_[_0xd9b1('0x3d')](_0x3448b7[_0xd9b1('0x41')],function(_0xd2f71e){var _0x5f2f1c={};_0x5f2f1c[_0xd2f71e]={'$like':'%'+_0x403ba4[_0xd9b1('0x3e')][_0xd9b1('0x48')]+'%'};return _0x5f2f1c;})});}_0x3448b7=_[_0xd9b1('0x4a')]({},_0x3448b7,_0x403ba4[_0xd9b1('0x4b')]);return _0x1e7a3c[_0xd9b1('0x8e')](_0x3448b7);}})[_0xd9b1('0x30')](function(_0x4fbd34){if(_0x4fbd34){_0x51a31b=_0x4fbd34[_0xd9b1('0x52')];if(!_0x403ba4[_0xd9b1('0x3e')]['hasOwnProperty']('nolimit')){_0x3448b7[_0xd9b1('0x27')]=qs[_0xd9b1('0x27')](_0x403ba4['query']['limit']);_0x3448b7[_0xd9b1('0x2a')]=qs[_0xd9b1('0x2a')](_0x403ba4[_0xd9b1('0x3e')][_0xd9b1('0x2a')]);}return _0x1e7a3c['getAgents'](_0x3448b7);}})[_0xd9b1('0x30')](function(_0x309578){if(_0x309578){return _0x309578?{'count':_0x51a31b,'rows':_0x309578}:null;}})[_0xd9b1('0x30')](respondWithResult(_0x252578,null))[_0xd9b1('0x50')](handleError(_0x252578,null));}; \ No newline at end of file +var _0xf746=['Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','body','describe','getMembers','findOne','sort','pick','UserFaxQueue','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','%s/%s','Team','getTeams','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','FaxQueueId\x20=\x20?','clone','push','QueryTypes','every','TeamId','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','then','FaxQueues','UserProfileResource','destroy','sendStatus','error','name','send','index','FaxQueue','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','intersection','options','find','create','user','get'];(function(_0x5bf6e3,_0x3dd646){var _0x5fb016=function(_0x25c865){while(--_0x25c865){_0x5bf6e3['push'](_0x5bf6e3['shift']());}};_0x5fb016(++_0x3dd646);}(_0xf746,0x13d));var _0x6f74=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xf746[_0x3511d3];return _0x5d6321;};'use strict';var emlformat=require(_0x6f74('0x0'));var rimraf=require(_0x6f74('0x1'));var zipdir=require(_0x6f74('0x2'));var jsonpatch=require(_0x6f74('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6f74('0x4'));var Mustache=require('mustache');var util=require(_0x6f74('0x5'));var path=require(_0x6f74('0x6'));var sox=require(_0x6f74('0x7'));var csv=require(_0x6f74('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f74('0x9'));var _=require(_0x6f74('0xa'));var squel=require(_0x6f74('0xb'));var crypto=require(_0x6f74('0xc'));var jsforce=require(_0x6f74('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6f74('0xe'));var Papa=require(_0x6f74('0xf'));var Redis=require(_0x6f74('0x10'));var authService=require(_0x6f74('0x11'));var qs=require(_0x6f74('0x12'));var as=require(_0x6f74('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f74('0x14'))(_0x6f74('0x15'));var utils=require(_0x6f74('0x16'));var config=require(_0x6f74('0x17'));var licenseUtil=require(_0x6f74('0x18'));var db=require(_0x6f74('0x19'))['db'];config[_0x6f74('0x1a')]=_[_0x6f74('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6f74('0x1c'))(new Redis(config[_0x6f74('0x1a')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x35c4dd,_0x4f84e2){_0x4f84e2=_0x4f84e2||0xcc;return function(_0x3f7504){if(_0x3f7504){return _0x35c4dd['sendStatus'](_0x4f84e2);}return _0x35c4dd[_0x6f74('0x1d')](_0x4f84e2)[_0x6f74('0x1e')]();};}function respondWithResult(_0x584b96,_0x4c3f44){_0x4c3f44=_0x4c3f44||0xc8;return function(_0x1ea934){if(_0x1ea934){return _0x584b96[_0x6f74('0x1d')](_0x4c3f44)[_0x6f74('0x1f')](_0x1ea934);}};}function respondWithFilteredResult(_0x3cb731,_0x46fbf4){return function(_0x3de6fe){if(_0x3de6fe){var _0x407ee7=typeof _0x46fbf4['offset']===_0x6f74('0x20')&&typeof _0x46fbf4[_0x6f74('0x21')]===_0x6f74('0x20');var _0x2b47f2=_0x3de6fe[_0x6f74('0x22')];var _0x4e4b95=_0x407ee7?0x0:_0x46fbf4[_0x6f74('0x23')];var _0x4849e4=_0x407ee7?_0x3de6fe['count']:_0x46fbf4[_0x6f74('0x23')]+_0x46fbf4[_0x6f74('0x21')];var _0x5c5f81;if(_0x4849e4>=_0x2b47f2){_0x4849e4=_0x2b47f2;_0x5c5f81=0xc8;}else{_0x5c5f81=0xce;}_0x3cb731[_0x6f74('0x1d')](_0x5c5f81);return _0x3cb731['set'](_0x6f74('0x24'),_0x4e4b95+'-'+_0x4849e4+'/'+_0x2b47f2)[_0x6f74('0x1f')](_0x3de6fe);}return null;};}function patchUpdates(_0x564904){return function(_0x2e60aa){try{jsonpatch[_0x6f74('0x25')](_0x2e60aa,_0x564904,!![]);}catch(_0x113975){return BPromise[_0x6f74('0x26')](_0x113975);}return _0x2e60aa['save']();};}function saveUpdates(_0x504357,_0x17a7f0){return function(_0x214674){if(_0x214674){return _0x214674['update'](_0x504357)[_0x6f74('0x27')](function(_0x5be1ea){return _0x5be1ea;});}return null;};}function removeEntity(_0x54a8f9,_0x482578){return function(_0x3e9560){if(_0x3e9560){return _0x3e9560['destroy']()[_0x6f74('0x27')](function(){var _0x645345=_0x3e9560['get']({'plain':!![]});var _0x293756=_0x6f74('0x28');return db[_0x6f74('0x29')][_0x6f74('0x2a')]({'where':{'type':_0x293756,'resourceId':_0x645345['id']}})[_0x6f74('0x27')](function(){return _0x3e9560;});})[_0x6f74('0x27')](function(){_0x54a8f9['status'](0xcc)[_0x6f74('0x1e')]();});}};}function handleEntityNotFound(_0x435e3f,_0x259353){return function(_0x1ff4d8){if(!_0x1ff4d8){_0x435e3f[_0x6f74('0x2b')](0x194);}return _0x1ff4d8;};}function handleError(_0x45dc0d,_0x5bf80e){_0x5bf80e=_0x5bf80e||0x1f4;return function(_0x4e6168){logger[_0x6f74('0x2c')](_0x4e6168['stack']);if(_0x4e6168[_0x6f74('0x2d')]){delete _0x4e6168[_0x6f74('0x2d')];}_0x45dc0d[_0x6f74('0x1d')](_0x5bf80e)[_0x6f74('0x2e')](_0x4e6168);};}exports[_0x6f74('0x2f')]=function(_0xefb82f,_0x32c5dc){var _0x6095de={},_0x38c77a={},_0x2a3a67={'count':0x0,'rows':[]};var _0x278f60=_['map'](db[_0x6f74('0x30')][_0x6f74('0x31')],function(_0x4c86e9){return{'name':_0x4c86e9[_0x6f74('0x32')],'type':_0x4c86e9[_0x6f74('0x33')]['key']};});_0x38c77a[_0x6f74('0x34')]=_[_0x6f74('0x35')](_0x278f60,'name');_0x38c77a[_0x6f74('0x36')]=_[_0x6f74('0x37')](_0xefb82f[_0x6f74('0x36')]);_0x38c77a[_0x6f74('0x38')]=_['intersection'](_0x38c77a['model'],_0x38c77a[_0x6f74('0x36')]);_0x6095de[_0x6f74('0x39')]=_['intersection'](_0x38c77a[_0x6f74('0x34')],qs['fields'](_0xefb82f[_0x6f74('0x36')][_0x6f74('0x3a')]));_0x6095de['attributes']=_0x6095de[_0x6f74('0x39')][_0x6f74('0x3b')]?_0x6095de[_0x6f74('0x39')]:_0x38c77a['model'];if(!_0xefb82f[_0x6f74('0x36')][_0x6f74('0x3c')](_0x6f74('0x3d'))){_0x6095de[_0x6f74('0x21')]=qs[_0x6f74('0x21')](_0xefb82f[_0x6f74('0x36')][_0x6f74('0x21')]);_0x6095de[_0x6f74('0x23')]=qs[_0x6f74('0x23')](_0xefb82f[_0x6f74('0x36')][_0x6f74('0x23')]);}_0x6095de[_0x6f74('0x3e')]=qs['sort'](_0xefb82f[_0x6f74('0x36')]['sort']);_0x6095de[_0x6f74('0x3f')]=qs[_0x6f74('0x38')](_['pick'](_0xefb82f[_0x6f74('0x36')],_0x38c77a['filters']),_0x278f60);if(_0xefb82f[_0x6f74('0x36')][_0x6f74('0x40')]){_0x6095de[_0x6f74('0x3f')]=_[_0x6f74('0x41')](_0x6095de[_0x6f74('0x3f')],{'$or':_[_0x6f74('0x35')](_0x278f60,function(_0x488330){if(_0x488330[_0x6f74('0x33')]!==_0x6f74('0x42')){var _0x587975={};_0x587975[_0x488330[_0x6f74('0x2d')]]={'$like':'%'+_0xefb82f[_0x6f74('0x36')][_0x6f74('0x40')]+'%'};return _0x587975;}})});}_0x6095de=_[_0x6f74('0x41')]({},_0x6095de,_0xefb82f['options']);var _0xa54892={'where':_0x6095de[_0x6f74('0x3f')]};return db[_0x6f74('0x30')]['count'](_0xa54892)[_0x6f74('0x27')](function(_0xd3aa22){_0x2a3a67['count']=_0xd3aa22;if(_0xefb82f[_0x6f74('0x36')][_0x6f74('0x43')]){_0x6095de[_0x6f74('0x44')]=[{'all':!![]}];}return db[_0x6f74('0x30')][_0x6f74('0x45')](_0x6095de);})[_0x6f74('0x27')](function(_0xec0907){_0x2a3a67[_0x6f74('0x46')]=_0xec0907;return _0x2a3a67;})[_0x6f74('0x27')](respondWithFilteredResult(_0x32c5dc,_0x6095de))[_0x6f74('0x47')](handleError(_0x32c5dc,null));};exports['show']=function(_0x1c4f14,_0x4fff94){var _0x5c2f46={'raw':!![],'where':{'id':_0x1c4f14[_0x6f74('0x48')]['id']}},_0x22f148={};_0x22f148[_0x6f74('0x34')]=_[_0x6f74('0x37')](db[_0x6f74('0x30')][_0x6f74('0x31')]);_0x22f148[_0x6f74('0x36')]=_['keys'](_0x1c4f14[_0x6f74('0x36')]);_0x22f148[_0x6f74('0x38')]=_[_0x6f74('0x49')](_0x22f148[_0x6f74('0x34')],_0x22f148[_0x6f74('0x36')]);_0x5c2f46[_0x6f74('0x39')]=_['intersection'](_0x22f148[_0x6f74('0x34')],qs[_0x6f74('0x3a')](_0x1c4f14['query']['fields']));_0x5c2f46[_0x6f74('0x39')]=_0x5c2f46[_0x6f74('0x39')][_0x6f74('0x3b')]?_0x5c2f46['attributes']:_0x22f148[_0x6f74('0x34')];if(_0x1c4f14[_0x6f74('0x36')][_0x6f74('0x43')]){_0x5c2f46[_0x6f74('0x44')]=[{'all':!![]}];}_0x5c2f46=_['merge']({},_0x5c2f46,_0x1c4f14[_0x6f74('0x4a')]);return db[_0x6f74('0x30')][_0x6f74('0x4b')](_0x5c2f46)[_0x6f74('0x27')](handleEntityNotFound(_0x4fff94,null))[_0x6f74('0x27')](respondWithResult(_0x4fff94,null))[_0x6f74('0x47')](handleError(_0x4fff94,null));};exports[_0x6f74('0x4c')]=function(_0xc80bfd,_0x2701f0){return db[_0x6f74('0x30')][_0x6f74('0x4c')](_0xc80bfd['body'],{})[_0x6f74('0x27')](function(_0x56e69f){var _0x26bffb=_0xc80bfd[_0x6f74('0x4d')][_0x6f74('0x4e')]({'plain':!![]});if(!_0x26bffb)throw new Error(_0x6f74('0x4f'));if(_0x26bffb['role']===_0x6f74('0x4d')){var _0x15f3c2=_0x56e69f[_0x6f74('0x4e')]({'plain':!![]});var _0x4a36f2=_0x6f74('0x28');return db['UserProfileSection'][_0x6f74('0x4b')]({'where':{'name':_0x4a36f2,'userProfileId':_0x26bffb['userProfileId']},'raw':!![]})[_0x6f74('0x27')](function(_0x10f768){if(_0x10f768&&_0x10f768[_0x6f74('0x50')]===0x0){return db[_0x6f74('0x29')]['create']({'name':_0x15f3c2[_0x6f74('0x2d')],'resourceId':_0x15f3c2['id'],'type':_0x10f768[_0x6f74('0x2d')],'sectionId':_0x10f768['id']},{})[_0x6f74('0x27')](function(){return _0x56e69f;});}else{return _0x56e69f;}})['catch'](function(_0x330446){logger[_0x6f74('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x330446);throw _0x330446;});}return _0x56e69f;})['then'](respondWithResult(_0x2701f0,0xc9))[_0x6f74('0x47')](handleError(_0x2701f0,null));};exports['update']=function(_0x3018ad,_0xf3a59c){if(_0x3018ad[_0x6f74('0x51')]['id']){delete _0x3018ad[_0x6f74('0x51')]['id'];}return db[_0x6f74('0x30')][_0x6f74('0x4b')]({'where':{'id':_0x3018ad[_0x6f74('0x48')]['id']}})['then'](handleEntityNotFound(_0xf3a59c,null))[_0x6f74('0x27')](saveUpdates(_0x3018ad[_0x6f74('0x51')],null))[_0x6f74('0x27')](respondWithResult(_0xf3a59c,null))[_0x6f74('0x47')](handleError(_0xf3a59c,null));};exports['destroy']=function(_0xb35264,_0x3158cc){return db[_0x6f74('0x30')][_0x6f74('0x4b')]({'where':{'id':_0xb35264['params']['id']}})[_0x6f74('0x27')](handleEntityNotFound(_0x3158cc,null))[_0x6f74('0x27')](removeEntity(_0x3158cc,null))[_0x6f74('0x47')](handleError(_0x3158cc,null));};exports[_0x6f74('0x52')]=function(_0x3361cc,_0x35f11d){return db[_0x6f74('0x30')][_0x6f74('0x52')]()[_0x6f74('0x27')](respondWithResult(_0x35f11d,null))[_0x6f74('0x47')](handleError(_0x35f11d,null));};exports[_0x6f74('0x53')]=function(_0x45f668,_0x4b98ee,_0x1ed337){var _0x54ca60={'raw':!![],'where':{}},_0x46a284={},_0x1226df;return db[_0x6f74('0x30')][_0x6f74('0x54')]({'where':{'id':_0x45f668[_0x6f74('0x48')]['id']}})[_0x6f74('0x27')](handleEntityNotFound(_0x4b98ee,null))['then'](function(_0x1d92fc){if(_0x1d92fc){_0x1226df=_0x1d92fc[_0x6f74('0x4e')]({'plain':!![]});_0x46a284[_0x6f74('0x34')]=_['keys'](db['UserFaxQueue'][_0x6f74('0x31')]);_0x46a284[_0x6f74('0x36')]=_[_0x6f74('0x37')](_0x45f668[_0x6f74('0x36')]);_0x46a284['filters']=_[_0x6f74('0x49')](_0x46a284[_0x6f74('0x34')],_0x46a284[_0x6f74('0x36')]);_0x54ca60[_0x6f74('0x39')]=_['intersection'](_0x46a284[_0x6f74('0x34')],qs[_0x6f74('0x3a')](_0x45f668[_0x6f74('0x36')][_0x6f74('0x3a')]));_0x54ca60['attributes']=_0x54ca60[_0x6f74('0x39')]['length']?_0x54ca60['attributes']:_0x46a284[_0x6f74('0x34')];if(!_0x45f668[_0x6f74('0x36')]['hasOwnProperty'](_0x6f74('0x3d'))){_0x54ca60[_0x6f74('0x21')]=qs[_0x6f74('0x21')](_0x45f668[_0x6f74('0x36')][_0x6f74('0x21')]);_0x54ca60[_0x6f74('0x23')]=qs[_0x6f74('0x23')](_0x45f668[_0x6f74('0x36')][_0x6f74('0x23')]);}_0x54ca60['order']=qs[_0x6f74('0x55')](_0x45f668[_0x6f74('0x36')][_0x6f74('0x55')]);_0x54ca60['where']=qs[_0x6f74('0x38')](_[_0x6f74('0x56')](_0x45f668[_0x6f74('0x36')],_0x46a284[_0x6f74('0x38')]));_0x54ca60[_0x6f74('0x3f')]['FaxQueueId']=_0x1d92fc['id'];if(_0x45f668[_0x6f74('0x36')][_0x6f74('0x40')]){_0x54ca60['where']=_[_0x6f74('0x41')](_0x54ca60['where'],{'$or':_['map'](_0x54ca60['attributes'],function(_0x42f294){var _0x252deb={};_0x252deb[_0x42f294]={'$like':'%'+_0x45f668[_0x6f74('0x36')]['filter']+'%'};return _0x252deb;})});}_0x54ca60=_[_0x6f74('0x41')]({},_0x54ca60,_0x45f668[_0x6f74('0x4a')]);return db[_0x6f74('0x57')][_0x6f74('0x45')](_0x54ca60);}})[_0x6f74('0x27')](function(_0x9cebc0){if(_0x9cebc0){return db[_0x6f74('0x58')][_0x6f74('0x59')]({'where':{'id':_['map'](_0x9cebc0,_0x6f74('0x5a')),'role':'agent'},'attributes':['id','name',_0x6f74('0x5b'),_0x6f74('0x5c'),_0x6f74('0x5d')]});}})['then'](function(_0x147ffe){if(_0x147ffe){return{'count':_0x147ffe['count'],'rows':_[_0x6f74('0x35')](_0x147ffe[_0x6f74('0x46')],function(_0x1abb7b){return{'membername':_0x1abb7b[_0x6f74('0x2d')],'UserId':_0x1abb7b['id'],'queue_name':_0x1226df[_0x6f74('0x2d')],'FaxQueueId':_0x1226df['id'],'interface':util[_0x6f74('0x5e')](_0x6f74('0x5f'),'SIP',_0x1abb7b[_0x6f74('0x2d')]),'penalty':0x0,'paused':_0x1abb7b[_0x6f74('0x5b')],'createdAt':_0x1abb7b['createdAt'],'updatedAt':_0x1abb7b[_0x6f74('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6f74('0x27')](respondWithFilteredResult(_0x4b98ee,_0x54ca60))['catch'](handleError(_0x4b98ee,null));};exports['getTeams']=function(_0x462959,_0x860fe6,_0x4893c4){var _0x5255be={};var _0x14aa7c={};var _0x8cfff6;var _0x26bf29;return db[_0x6f74('0x30')][_0x6f74('0x54')]({'where':{'id':_0x462959['params']['id']}})['then'](handleEntityNotFound(_0x860fe6,null))[_0x6f74('0x27')](function(_0x1cb476){if(_0x1cb476){_0x8cfff6=_0x1cb476;_0x14aa7c[_0x6f74('0x34')]=_[_0x6f74('0x37')](db[_0x6f74('0x60')]['rawAttributes']);_0x14aa7c[_0x6f74('0x36')]=_[_0x6f74('0x37')](_0x462959['query']);_0x14aa7c[_0x6f74('0x38')]=_[_0x6f74('0x49')](_0x14aa7c[_0x6f74('0x34')],_0x14aa7c['query']);_0x5255be[_0x6f74('0x39')]=_[_0x6f74('0x49')](_0x14aa7c[_0x6f74('0x34')],qs[_0x6f74('0x3a')](_0x462959[_0x6f74('0x36')][_0x6f74('0x3a')]));_0x5255be[_0x6f74('0x39')]=_0x5255be['attributes'][_0x6f74('0x3b')]?_0x5255be[_0x6f74('0x39')]:_0x14aa7c[_0x6f74('0x34')];_0x5255be[_0x6f74('0x3e')]=qs['sort'](_0x462959[_0x6f74('0x36')]['sort']);_0x5255be[_0x6f74('0x3f')]=qs[_0x6f74('0x38')](_[_0x6f74('0x56')](_0x462959[_0x6f74('0x36')],_0x14aa7c[_0x6f74('0x38')]));if(_0x462959[_0x6f74('0x36')][_0x6f74('0x40')]){_0x5255be['where']=_['merge'](_0x5255be[_0x6f74('0x3f')],{'$or':_[_0x6f74('0x35')](_0x5255be[_0x6f74('0x39')],function(_0x43e622){var _0x2c3112={};_0x2c3112[_0x43e622]={'$like':'%'+_0x462959[_0x6f74('0x36')][_0x6f74('0x40')]+'%'};return _0x2c3112;})});}_0x5255be=_['merge']({},_0x5255be,_0x462959[_0x6f74('0x4a')]);return _0x8cfff6[_0x6f74('0x61')](_0x5255be);}})['then'](function(_0x1118d3){if(_0x1118d3){_0x26bf29=_0x1118d3[_0x6f74('0x3b')];if(!_0x462959['query'][_0x6f74('0x3c')](_0x6f74('0x3d'))){_0x5255be[_0x6f74('0x21')]=qs[_0x6f74('0x21')](_0x462959[_0x6f74('0x36')][_0x6f74('0x21')]);_0x5255be[_0x6f74('0x23')]=qs[_0x6f74('0x23')](_0x462959[_0x6f74('0x36')][_0x6f74('0x23')]);}return _0x8cfff6[_0x6f74('0x61')](_0x5255be);}})[_0x6f74('0x27')](function(_0x1af908){if(_0x1af908){return _0x1af908?{'count':_0x26bf29,'rows':_0x1af908}:null;}})[_0x6f74('0x27')](respondWithResult(_0x860fe6,null))[_0x6f74('0x47')](handleError(_0x860fe6,null));};exports[_0x6f74('0x62')]=function(_0x68ccf2,_0x4c1d37,_0x5c423f){var _0x5949a3=_0x68ccf2['body'][_0x6f74('0x63')];return db['Team'][_0x6f74('0x45')]({'where':{'id':_0x5949a3},'attributes':['id'],'include':[{'model':db[_0x6f74('0x58')],'as':_0x6f74('0x64'),'attributes':['id',_0x6f74('0x2d'),_0x6f74('0x65'),'voicePause',_0x6f74('0x66')],'raw':!![]}]})[_0x6f74('0x27')](function(_0xe0b39d){if(_0xe0b39d){var _0x4ddc25=_[_0x6f74('0x67')](_0xe0b39d,function(_0x56a63c){var _0x41f012=_0x56a63c[_0x6f74('0x4e')]({'plain':!![]});return _0x41f012[_0x6f74('0x64')];});return db['FaxQueue'][_0x6f74('0x4b')]({'where':{'id':_0x68ccf2[_0x6f74('0x48')]['id']}})[_0x6f74('0x27')](function(_0x55a7fa){return db[_0x6f74('0x68')][_0x6f74('0x69')](function(_0x2f9131){return _0x55a7fa[_0x6f74('0x62')](_0x5949a3,{'transaction':_0x2f9131})['then'](function(){return BPromise['each'](_0x4ddc25,function(_0x36c6a6){return db[_0x6f74('0x57')]['findOrCreate']({'where':{'UserId':_0x36c6a6['id'],'FaxQueueId':_0x68ccf2[_0x6f74('0x48')]['id']},'transaction':_0x2f9131});});})[_0x6f74('0x27')](function(){_0x4ddc25[_0x6f74('0x6a')](function(_0x57538e){socket[_0x6f74('0x6b')](_0x6f74('0x6c'),{'UserId':_0x57538e['id'],'FaxQueueId':_0x55a7fa['id']});});});});});}})[_0x6f74('0x27')](respondWithStatusCode(_0x4c1d37,null))[_0x6f74('0x47')](handleError(_0x4c1d37,null));};exports[_0x6f74('0x6d')]=function(_0x349324,_0x251b8b,_0xb2ce53){return db[_0x6f74('0x60')][_0x6f74('0x45')]({'where':{'id':_0x349324[_0x6f74('0x36')][_0x6f74('0x63')]},'attributes':['id'],'include':[{'model':db[_0x6f74('0x58')],'as':_0x6f74('0x64'),'attributes':['id'],'raw':!![]}]})[_0x6f74('0x27')](handleEntityNotFound(_0x251b8b,null))[_0x6f74('0x27')](function(_0x4df11d){var _0x5e9818=_[_0x6f74('0x35')](_0x4df11d,'id');var _0x49e4fb=[];var _0x261bdc=[];var _0x317a04=squel[_0x6f74('0x6e')]();_0x317a04[_0x6f74('0x6f')](_0x6f74('0x70'))[_0x6f74('0x71')](_0x6f74('0x72'),'tq')['join'](_0x6f74('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6f74('0x3f')](_0x6f74('0x74'),_0x349324[_0x6f74('0x48')]['id']);for(var _0x57ea14=0x0;_0x57ea14<_0x4df11d['length'];_0x57ea14+=0x1){let _0x5a6d94=_0x4df11d[_0x57ea14];for(var _0x5d6d70=0x0;_0x5d6d70<_0x5a6d94['Agents'][_0x6f74('0x3b')];_0x5d6d70+=0x1){let _0x9ff1fb=_0x5a6d94[_0x6f74('0x64')][_0x5d6d70];var _0x1d949e=_0x317a04[_0x6f74('0x75')]();_0x1d949e[_0x6f74('0x3f')]('ut.UserId\x20=\x20?',_0x9ff1fb['id']);_0x261bdc[_0x6f74('0x76')](db[_0x6f74('0x68')][_0x6f74('0x36')](_0x1d949e['toString'](),{'type':db[_0x6f74('0x68')][_0x6f74('0x77')]['SELECT']})[_0x6f74('0x27')](function(_0x331cdc){if(_0x331cdc['length']===0x1){return _0x9ff1fb['id'];}else{var _0xf3765e=_[_0x6f74('0x78')](_[_0x6f74('0x35')](_0x331cdc,_0x6f74('0x79')),function(_0x3e2e2e){return _['includes'](_0x5e9818,_0x3e2e2e);});if(_0xf3765e){return _0x9ff1fb['id'];}}}));}}return BPromise['all'](_0x261bdc)[_0x6f74('0x27')](function(_0x3c4faa){_0x49e4fb=_(_0x49e4fb)['union'](_0x3c4faa)[_0x6f74('0x7a')]()[_0x6f74('0x7b')]();return db[_0x6f74('0x30')][_0x6f74('0x4b')]({'where':{'id':_0x349324['params']['id']}})['then'](function(_0x32b898){return db[_0x6f74('0x68')][_0x6f74('0x69')](function(_0x406d36){return _0x32b898[_0x6f74('0x6d')](_0x349324['query'][_0x6f74('0x63')],{'transaction':_0x406d36})[_0x6f74('0x27')](function(){if(!_[_0x6f74('0x7c')](_0x49e4fb)){return _0x32b898[_0x6f74('0x7d')](_0x49e4fb,{'transaction':_0x406d36});}})['then'](function(){_0x49e4fb['forEach'](function(_0xe912bc){socket[_0x6f74('0x6b')]('userFaxQueue:remove',{'UserId':_0xe912bc,'FaxQueueId':_0x32b898['id']});});});});});});})['then'](respondWithStatusCode(_0x251b8b,null))[_0x6f74('0x47')](handleError(_0x251b8b,null));};exports[_0x6f74('0x7e')]=function(_0x567a66,_0x1da39e,_0x7c5cce){return db[_0x6f74('0x30')][_0x6f74('0x4b')]({'where':{'id':_0x567a66[_0x6f74('0x48')]['id']}})[_0x6f74('0x27')](handleEntityNotFound(_0x1da39e,null))['then'](function(_0x320b7c){if(_0x320b7c){return _0x320b7c['addAgents'](_0x567a66[_0x6f74('0x51')][_0x6f74('0x63')],_[_0x6f74('0x7f')](_0x567a66[_0x6f74('0x51')],[_0x6f74('0x63'),'id'])||{})[_0x6f74('0x80')](function(_0x384f89){for(var _0xb9d2a8=0x0;_0xb9d2a8<_0x567a66['body'][_0x6f74('0x63')][_0x6f74('0x3b')];_0xb9d2a8+=0x1){socket[_0x6f74('0x6b')](_0x6f74('0x6c'),{'UserId':Number(_0x567a66[_0x6f74('0x51')][_0x6f74('0x63')][_0xb9d2a8]),'FaxQueueId':Number(_0x567a66['params']['id'])});}return _0x384f89;});}})[_0x6f74('0x27')](respondWithResult(_0x1da39e,null))['catch'](handleError(_0x1da39e,null));};exports[_0x6f74('0x7d')]=function(_0x2f7541,_0x13cbe0,_0xad299b){return db['FaxQueue'][_0x6f74('0x4b')]({'where':{'id':_0x2f7541[_0x6f74('0x48')]['id']}})[_0x6f74('0x27')](handleEntityNotFound(_0x13cbe0,null))[_0x6f74('0x27')](function(_0x4c2f35){if(_0x4c2f35){return _0x4c2f35[_0x6f74('0x7d')](_0x2f7541['query'][_0x6f74('0x63')])[_0x6f74('0x27')](function(){if(_[_0x6f74('0x81')](_0x2f7541['query'][_0x6f74('0x63')])){for(var _0x5ed5ba=0x0;_0x5ed5ba<_0x2f7541[_0x6f74('0x36')][_0x6f74('0x63')][_0x6f74('0x3b')];_0x5ed5ba+=0x1){socket[_0x6f74('0x6b')]('userFaxQueue:remove',{'UserId':Number(_0x2f7541['query'][_0x6f74('0x63')][_0x5ed5ba]),'FaxQueueId':Number(_0x2f7541[_0x6f74('0x48')]['id'])});}}else{socket[_0x6f74('0x6b')](_0x6f74('0x82'),{'UserId':Number(_0x2f7541[_0x6f74('0x36')][_0x6f74('0x63')]),'FaxQueueId':Number(_0x2f7541['params']['id'])});}});}})['then'](respondWithStatusCode(_0x13cbe0,null))[_0x6f74('0x47')](handleError(_0x13cbe0,null));};exports[_0x6f74('0x83')]=function(_0xdb66db,_0x5409fb,_0x50006e){var _0x481eb8={};var _0x4677e4={};var _0x317d26;var _0x42da88;return db[_0x6f74('0x30')]['findOne']({'where':{'id':_0xdb66db[_0x6f74('0x48')]['id']}})['then'](handleEntityNotFound(_0x5409fb,null))[_0x6f74('0x27')](function(_0x3d77e3){if(_0x3d77e3){_0x317d26=_0x3d77e3;_0x4677e4[_0x6f74('0x34')]=_[_0x6f74('0x37')](db['User'][_0x6f74('0x31')]);_0x4677e4['query']=_[_0x6f74('0x37')](_0xdb66db['query']);_0x4677e4[_0x6f74('0x38')]=_[_0x6f74('0x49')](_0x4677e4['model'],_0x4677e4['query']);_0x481eb8[_0x6f74('0x39')]=_[_0x6f74('0x49')](_0x4677e4[_0x6f74('0x34')],qs['fields'](_0xdb66db['query'][_0x6f74('0x3a')]));_0x481eb8['attributes']=_0x481eb8[_0x6f74('0x39')][_0x6f74('0x3b')]?_0x481eb8[_0x6f74('0x39')]:_0x4677e4[_0x6f74('0x34')];_0x481eb8['order']=qs['sort'](_0xdb66db[_0x6f74('0x36')][_0x6f74('0x55')]);_0x481eb8['where']=qs['filters'](_['pick'](_0xdb66db[_0x6f74('0x36')],_0x4677e4[_0x6f74('0x38')]));if(_0xdb66db['query'][_0x6f74('0x40')]){_0x481eb8[_0x6f74('0x3f')]=_['merge'](_0x481eb8[_0x6f74('0x3f')],{'$or':_[_0x6f74('0x35')](_0x481eb8[_0x6f74('0x39')],function(_0x20582d){var _0xd3bd3b={};_0xd3bd3b[_0x20582d]={'$like':'%'+_0xdb66db[_0x6f74('0x36')]['filter']+'%'};return _0xd3bd3b;})});}_0x481eb8=_[_0x6f74('0x41')]({},_0x481eb8,_0xdb66db[_0x6f74('0x4a')]);return _0x317d26[_0x6f74('0x83')](_0x481eb8);}})['then'](function(_0x1742a5){if(_0x1742a5){_0x42da88=_0x1742a5['length'];if(!_0xdb66db[_0x6f74('0x36')][_0x6f74('0x3c')]('nolimit')){_0x481eb8[_0x6f74('0x21')]=qs[_0x6f74('0x21')](_0xdb66db[_0x6f74('0x36')][_0x6f74('0x21')]);_0x481eb8['offset']=qs[_0x6f74('0x23')](_0xdb66db[_0x6f74('0x36')][_0x6f74('0x23')]);}return _0x317d26[_0x6f74('0x83')](_0x481eb8);}})[_0x6f74('0x27')](function(_0x8d96b8){if(_0x8d96b8){return _0x8d96b8?{'count':_0x42da88,'rows':_0x8d96b8}:null;}})['then'](respondWithResult(_0x5409fb,null))[_0x6f74('0x47')](handleError(_0x5409fb,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 74075e2..0a1a285 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 _0xd345=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxQueue','update'];(function(_0x767c51,_0x25c455){var _0x717e11=function(_0x21c2ef){while(--_0x21c2ef){_0x767c51['push'](_0x767c51['shift']());}};_0x717e11(++_0x25c455);}(_0xd345,0xe4));var _0x5d34=function(_0x1119ab,_0x2127e4){_0x1119ab=_0x1119ab-0x0;var _0x337c16=_0xd345[_0x1119ab];return _0x337c16;};'use strict';var EventEmitter=require(_0x5d34('0x0'));var FaxQueue=require(_0x5d34('0x1'))['db'][_0x5d34('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5d34('0x3'),'afterDestroy':_0x5d34('0x4')};function emitEvent(_0x4ba72c){return function(_0x41adc9,_0xd7464f,_0xe8ac73){FaxQueueEvents[_0x5d34('0x5')](_0x4ba72c+':'+_0x41adc9['id'],_0x41adc9);FaxQueueEvents[_0x5d34('0x5')](_0x4ba72c,_0x41adc9);_0xe8ac73(null);};}for(var e in events){if(events[_0x5d34('0x6')](e)){var event=events[e];FaxQueue[_0x5d34('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x0ab5=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x361fad,_0x5d2d6a){var _0x1d3f23=function(_0x5bbed0){while(--_0x5bbed0){_0x361fad['push'](_0x361fad['shift']());}};_0x1d3f23(++_0x5d2d6a);}(_0x0ab5,0x14d));var _0x50ab=function(_0x4dabb7,_0x3a58f0){_0x4dabb7=_0x4dabb7-0x0;var _0x7de17d=_0x0ab5[_0x4dabb7];return _0x7de17d;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x50ab('0x0'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x50ab('0x1')](0x0);var events={'afterCreate':_0x50ab('0x2'),'afterUpdate':_0x50ab('0x3'),'afterDestroy':_0x50ab('0x4')};function emitEvent(_0x263cff){return function(_0x3390ca,_0x280f74,_0x537aad){FaxQueueEvents['emit'](_0x263cff+':'+_0x3390ca['id'],_0x3390ca);FaxQueueEvents[_0x50ab('0x5')](_0x263cff,_0x3390ca);_0x537aad(null);};}for(var e in events){if(events[_0x50ab('0x6')](e)){var event=events[e];FaxQueue[_0x50ab('0x7')](e,emitEvent(event));}}module[_0x50ab('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 4681ce1..169f40b 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 _0x2c79=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','FaxQueue','lodash','util','../../config/logger'];(function(_0x5ea79d,_0x2b6657){var _0x3c2b27=function(_0x160aad){while(--_0x160aad){_0x5ea79d['push'](_0x5ea79d['shift']());}};_0x3c2b27(++_0x2b6657);}(_0x2c79,0x15c));var _0x92c7=function(_0x2e4484,_0x324f8d){_0x2e4484=_0x2e4484-0x0;var _0x278b84=_0x2c79[_0x2e4484];return _0x278b84;};'use strict';var _=require(_0x92c7('0x0'));var util=require(_0x92c7('0x1'));var logger=require(_0x92c7('0x2'))(_0x92c7('0x3'));var moment=require(_0x92c7('0x4'));var BPromise=require(_0x92c7('0x5'));var rp=require(_0x92c7('0x6'));var fs=require('fs');var path=require(_0x92c7('0x7'));var rimraf=require(_0x92c7('0x8'));var config=require(_0x92c7('0x9'));var attributes=require(_0x92c7('0xa'));module[_0x92c7('0xb')]=function(_0xb8571b,_0x33911f){return _0xb8571b['define'](_0x92c7('0xc'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5be4=['../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x19f9e6,_0x4f59a6){var _0x45c862=function(_0x3447fb){while(--_0x3447fb){_0x19f9e6['push'](_0x19f9e6['shift']());}};_0x45c862(++_0x4f59a6);}(_0x5be4,0x6e));var _0x45be=function(_0x194c05,_0x2c491e){_0x194c05=_0x194c05-0x0;var _0x41e551=_0x5be4[_0x194c05];return _0x41e551;};'use strict';var _=require(_0x45be('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x45be('0x1'));var moment=require(_0x45be('0x2'));var BPromise=require(_0x45be('0x3'));var rp=require(_0x45be('0x4'));var fs=require('fs');var path=require(_0x45be('0x5'));var rimraf=require(_0x45be('0x6'));var config=require(_0x45be('0x7'));var attributes=require(_0x45be('0x8'));module[_0x45be('0x9')]=function(_0x2f0d7a,_0x43cef8){return _0x2f0d7a[_0x45be('0xa')](_0x45be('0xb'),attributes,{'tableName':_0x45be('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 b1e8855..c693a51 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 _0x5409=['jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','include','map','attributes','model','then','ShowFaxQueue','find','where','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x35bf53,_0x3ed582){var _0x54420f=function(_0x3759e7){while(--_0x3759e7){_0x35bf53['push'](_0x35bf53['shift']());}};_0x54420f(++_0x3ed582);}(_0x5409,0x131));var _0x9540=function(_0x1a36ef,_0x1208fd){_0x1a36ef=_0x1a36ef-0x0;var _0x5abaac=_0x5409[_0x1a36ef];return _0x5abaac;};'use strict';var _=require('lodash');var util=require(_0x9540('0x0'));var moment=require(_0x9540('0x1'));var BPromise=require(_0x9540('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9540('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9540('0x4'))(_0x9540('0x5'));var config=require(_0x9540('0x6'));var jayson=require(_0x9540('0x7'));var client=jayson[_0x9540('0x8')][_0x9540('0x9')]({'port':0x232a});config[_0x9540('0xa')]=_[_0x9540('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9540('0xc'))(new Redis(config[_0x9540('0xa')]));require(_0x9540('0xd'))[_0x9540('0xe')](socket);function respondWithRpcPromise(_0x4d4f88,_0x147e1e,_0x2efeb9){return new BPromise(function(_0x29c5c0,_0x12cb86){return client['request'](_0x4d4f88,_0x2efeb9)['then'](function(_0x3bfa80){logger[_0x9540('0xf')](_0x9540('0x10'),_0x147e1e,_0x9540('0x11'));logger[_0x9540('0x12')](_0x9540('0x13'),_0x147e1e,'request\x20sent',JSON[_0x9540('0x14')](_0x3bfa80));if(_0x3bfa80[_0x9540('0x15')]){if(_0x3bfa80[_0x9540('0x15')][_0x9540('0x16')]===0x1f4){logger['error'](_0x9540('0x10'),_0x147e1e,_0x3bfa80[_0x9540('0x15')]['message']);return _0x12cb86(_0x3bfa80[_0x9540('0x15')]['message']);}logger[_0x9540('0x15')](_0x9540('0x10'),_0x147e1e,_0x3bfa80[_0x9540('0x15')][_0x9540('0x17')]);return _0x29c5c0(_0x3bfa80['error'][_0x9540('0x17')]);}else{logger[_0x9540('0xf')]('FaxQueue,\x20%s,\x20%s',_0x147e1e,_0x9540('0x11'));_0x29c5c0(_0x3bfa80[_0x9540('0x18')][_0x9540('0x17')]);}})[_0x9540('0x19')](function(_0x212d40){logger[_0x9540('0x15')](_0x9540('0x10'),_0x147e1e,_0x212d40);_0x12cb86(_0x212d40);});});}exports[_0x9540('0x1a')]=function(_0x54fa22){var _0x122a9b=this;return new Promise(function(_0x5c6a03,_0x19c6bc){return db[_0x9540('0x1b')][_0x9540('0x1c')]({'raw':_0x54fa22[_0x9540('0x1d')]?_0x54fa22[_0x9540('0x1d')][_0x9540('0x1e')]===undefined?!![]:![]:!![],'where':_0x54fa22[_0x9540('0x1d')]?_0x54fa22[_0x9540('0x1d')]['where']||null:null,'attributes':_0x54fa22[_0x9540('0x1d')]?_0x54fa22[_0x9540('0x1d')]['attributes']||null:null,'limit':_0x54fa22[_0x9540('0x1d')]?_0x54fa22[_0x9540('0x1d')]['limit']||null:null,'include':_0x54fa22['options']?_0x54fa22[_0x9540('0x1d')][_0x9540('0x1f')]?_[_0x9540('0x20')](_0x54fa22[_0x9540('0x1d')]['include'],function(_0x321bfc){return{'model':db[_0x321bfc['model']],'as':_0x321bfc['as'],'attributes':_0x321bfc[_0x9540('0x21')],'include':_0x321bfc[_0x9540('0x1f')]?_['map'](_0x321bfc[_0x9540('0x1f')],function(_0x1e1d85){return{'model':db[_0x1e1d85[_0x9540('0x22')]],'as':_0x1e1d85['as'],'attributes':_0x1e1d85['attributes'],'include':_0x1e1d85[_0x9540('0x1f')]?_[_0x9540('0x20')](_0x1e1d85[_0x9540('0x1f')],function(_0x373cd9){return{'model':db[_0x373cd9['model']],'as':_0x373cd9['as'],'attributes':_0x373cd9['attributes']};}):[]};}):[]};}):[]:[]})[_0x9540('0x23')](function(_0x326f62){logger[_0x9540('0xf')]('GetFaxQueue',_0x54fa22);logger['debug'](_0x9540('0x1a'),_0x54fa22,JSON[_0x9540('0x14')](_0x326f62));_0x5c6a03(_0x326f62);})['catch'](function(_0x485628){logger[_0x9540('0x15')](_0x9540('0x1a'),_0x485628[_0x9540('0x17')],_0x54fa22);_0x19c6bc(_0x122a9b['error'](0x1f4,_0x485628[_0x9540('0x17')]));});});};exports[_0x9540('0x24')]=function(_0x3ac837){var _0x4e32ba=this;return new Promise(function(_0x225f4c,_0x1b6fa5){return db[_0x9540('0x1b')][_0x9540('0x25')]({'raw':_0x3ac837[_0x9540('0x1d')]?_0x3ac837[_0x9540('0x1d')][_0x9540('0x1e')]===undefined?!![]:![]:!![],'where':_0x3ac837['options']?_0x3ac837[_0x9540('0x1d')][_0x9540('0x26')]||null:null,'attributes':_0x3ac837[_0x9540('0x1d')]?_0x3ac837[_0x9540('0x1d')][_0x9540('0x21')]||null:null,'include':_0x3ac837['options']?_0x3ac837[_0x9540('0x1d')][_0x9540('0x1f')]?_[_0x9540('0x20')](_0x3ac837['options'][_0x9540('0x1f')],function(_0x44455f){return{'model':db[_0x44455f[_0x9540('0x22')]],'as':_0x44455f['as'],'attributes':_0x44455f[_0x9540('0x21')],'include':_0x44455f['include']?_[_0x9540('0x20')](_0x44455f['include'],function(_0x15b938){return{'model':db[_0x15b938[_0x9540('0x22')]],'as':_0x15b938['as'],'attributes':_0x15b938[_0x9540('0x21')],'include':_0x15b938[_0x9540('0x1f')]?_[_0x9540('0x20')](_0x15b938[_0x9540('0x1f')],function(_0x505346){return{'model':db[_0x505346[_0x9540('0x22')]],'as':_0x505346['as'],'attributes':_0x505346['attributes']};}):[]};}):[]};}):[]:[]})[_0x9540('0x23')](function(_0x521899){logger[_0x9540('0xf')](_0x9540('0x24'),_0x3ac837);logger[_0x9540('0x12')](_0x9540('0x24'),_0x3ac837,JSON['stringify'](_0x521899));_0x225f4c(_0x521899);})[_0x9540('0x19')](function(_0x3b2138){logger[_0x9540('0x15')](_0x9540('0x24'),_0x3b2138[_0x9540('0x17')],_0x3ac837);_0x1b6fa5(_0x4e32ba[_0x9540('0x15')](0x1f4,_0x3b2138[_0x9540('0x17')]));});});}; \ No newline at end of file +var _0x4d7b=['http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','FaxQueue','findAll','options','raw','attributes','limit','include','map','model','GetFaxQueue','stringify','catch','ShowFaxQueue','find','where','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0x4d7b,0xf7));var _0xb4d7=function(_0x4ea28f,_0x393e51){_0x4ea28f=_0x4ea28f-0x0;var _0x2340c0=_0x4d7b[_0x4ea28f];return _0x2340c0;};'use strict';var _=require(_0xb4d7('0x0'));var util=require(_0xb4d7('0x1'));var moment=require(_0xb4d7('0x2'));var BPromise=require(_0xb4d7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4d7('0x4'))['db'];var utils=require(_0xb4d7('0x5'));var logger=require(_0xb4d7('0x6'))(_0xb4d7('0x7'));var config=require(_0xb4d7('0x8'));var jayson=require(_0xb4d7('0x9'));var client=jayson[_0xb4d7('0xa')][_0xb4d7('0xb')]({'port':0x232a});config[_0xb4d7('0xc')]=_[_0xb4d7('0xd')](config[_0xb4d7('0xc')],{'host':_0xb4d7('0xe'),'port':0x18eb});var socket=require(_0xb4d7('0xf'))(new Redis(config[_0xb4d7('0xc')]));require(_0xb4d7('0x10'))[_0xb4d7('0x11')](socket);function respondWithRpcPromise(_0x122414,_0x2cb1ab,_0x595272){return new BPromise(function(_0x1c2580,_0x4ec3a1){return client[_0xb4d7('0x12')](_0x122414,_0x595272)[_0xb4d7('0x13')](function(_0x1468e2){logger[_0xb4d7('0x14')](_0xb4d7('0x15'),_0x2cb1ab,_0xb4d7('0x16'));logger[_0xb4d7('0x17')](_0xb4d7('0x18'),_0x2cb1ab,_0xb4d7('0x16'),JSON['stringify'](_0x1468e2));if(_0x1468e2[_0xb4d7('0x19')]){if(_0x1468e2[_0xb4d7('0x19')][_0xb4d7('0x1a')]===0x1f4){logger[_0xb4d7('0x19')](_0xb4d7('0x15'),_0x2cb1ab,_0x1468e2['error'][_0xb4d7('0x1b')]);return _0x4ec3a1(_0x1468e2[_0xb4d7('0x19')][_0xb4d7('0x1b')]);}logger[_0xb4d7('0x19')](_0xb4d7('0x15'),_0x2cb1ab,_0x1468e2[_0xb4d7('0x19')][_0xb4d7('0x1b')]);return _0x1c2580(_0x1468e2[_0xb4d7('0x19')][_0xb4d7('0x1b')]);}else{logger[_0xb4d7('0x14')](_0xb4d7('0x15'),_0x2cb1ab,_0xb4d7('0x16'));_0x1c2580(_0x1468e2['result'][_0xb4d7('0x1b')]);}})['catch'](function(_0x94e256){logger[_0xb4d7('0x19')](_0xb4d7('0x15'),_0x2cb1ab,_0x94e256);_0x4ec3a1(_0x94e256);});});}exports['GetFaxQueue']=function(_0x2c8af2){var _0x426211=this;return new Promise(function(_0xfb0a49,_0x18ee09){return db[_0xb4d7('0x1c')][_0xb4d7('0x1d')]({'raw':_0x2c8af2['options']?_0x2c8af2[_0xb4d7('0x1e')][_0xb4d7('0x1f')]===undefined?!![]:![]:!![],'where':_0x2c8af2['options']?_0x2c8af2['options']['where']||null:null,'attributes':_0x2c8af2[_0xb4d7('0x1e')]?_0x2c8af2['options'][_0xb4d7('0x20')]||null:null,'limit':_0x2c8af2[_0xb4d7('0x1e')]?_0x2c8af2[_0xb4d7('0x1e')][_0xb4d7('0x21')]||null:null,'include':_0x2c8af2[_0xb4d7('0x1e')]?_0x2c8af2['options'][_0xb4d7('0x22')]?_[_0xb4d7('0x23')](_0x2c8af2['options'][_0xb4d7('0x22')],function(_0x1bb99b){return{'model':db[_0x1bb99b[_0xb4d7('0x24')]],'as':_0x1bb99b['as'],'attributes':_0x1bb99b['attributes'],'include':_0x1bb99b[_0xb4d7('0x22')]?_[_0xb4d7('0x23')](_0x1bb99b[_0xb4d7('0x22')],function(_0x2bbbfc){return{'model':db[_0x2bbbfc['model']],'as':_0x2bbbfc['as'],'attributes':_0x2bbbfc[_0xb4d7('0x20')],'include':_0x2bbbfc[_0xb4d7('0x22')]?_[_0xb4d7('0x23')](_0x2bbbfc[_0xb4d7('0x22')],function(_0x306a7e){return{'model':db[_0x306a7e['model']],'as':_0x306a7e['as'],'attributes':_0x306a7e[_0xb4d7('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb4d7('0x13')](function(_0x490fe4){logger[_0xb4d7('0x14')](_0xb4d7('0x25'),_0x2c8af2);logger[_0xb4d7('0x17')](_0xb4d7('0x25'),_0x2c8af2,JSON[_0xb4d7('0x26')](_0x490fe4));_0xfb0a49(_0x490fe4);})[_0xb4d7('0x27')](function(_0x21933e){logger['error'](_0xb4d7('0x25'),_0x21933e[_0xb4d7('0x1b')],_0x2c8af2);_0x18ee09(_0x426211[_0xb4d7('0x19')](0x1f4,_0x21933e[_0xb4d7('0x1b')]));});});};exports[_0xb4d7('0x28')]=function(_0x32997c){var _0x2fa26a=this;return new Promise(function(_0x11af74,_0x21dea0){return db['FaxQueue'][_0xb4d7('0x29')]({'raw':_0x32997c[_0xb4d7('0x1e')]?_0x32997c[_0xb4d7('0x1e')][_0xb4d7('0x1f')]===undefined?!![]:![]:!![],'where':_0x32997c[_0xb4d7('0x1e')]?_0x32997c[_0xb4d7('0x1e')][_0xb4d7('0x2a')]||null:null,'attributes':_0x32997c[_0xb4d7('0x1e')]?_0x32997c['options'][_0xb4d7('0x20')]||null:null,'include':_0x32997c[_0xb4d7('0x1e')]?_0x32997c['options'][_0xb4d7('0x22')]?_[_0xb4d7('0x23')](_0x32997c[_0xb4d7('0x1e')]['include'],function(_0x537324){return{'model':db[_0x537324[_0xb4d7('0x24')]],'as':_0x537324['as'],'attributes':_0x537324[_0xb4d7('0x20')],'include':_0x537324['include']?_['map'](_0x537324[_0xb4d7('0x22')],function(_0x187fb0){return{'model':db[_0x187fb0['model']],'as':_0x187fb0['as'],'attributes':_0x187fb0['attributes'],'include':_0x187fb0[_0xb4d7('0x22')]?_[_0xb4d7('0x23')](_0x187fb0[_0xb4d7('0x22')],function(_0x5a56cf){return{'model':db[_0x5a56cf[_0xb4d7('0x24')]],'as':_0x5a56cf['as'],'attributes':_0x5a56cf[_0xb4d7('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x551e48){logger[_0xb4d7('0x14')](_0xb4d7('0x28'),_0x32997c);logger['debug'](_0xb4d7('0x28'),_0x32997c,JSON[_0xb4d7('0x26')](_0x551e48));_0x11af74(_0x551e48);})[_0xb4d7('0x27')](function(_0x271c6c){logger[_0xb4d7('0x19')]('ShowFaxQueue',_0x271c6c[_0xb4d7('0x1b')],_0x32997c);_0x21dea0(_0x2fa26a[_0xb4d7('0x19')](0x1f4,_0x271c6c[_0xb4d7('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index e9b2c62..fc34b9c 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 _0x2d9b=['removeListener','register','faxQueue:','./faxQueue.events','save','update','emit'];(function(_0x20fd58,_0x3041a1){var _0x17187e=function(_0x5eedd1){while(--_0x5eedd1){_0x20fd58['push'](_0x20fd58['shift']());}};_0x17187e(++_0x3041a1);}(_0x2d9b,0x73));var _0xb2d9=function(_0x11beb2,_0x155af8){_0x11beb2=_0x11beb2-0x0;var _0x4c50ef=_0x2d9b[_0x11beb2];return _0x4c50ef;};'use strict';var FaxQueueEvents=require(_0xb2d9('0x0'));var events=[_0xb2d9('0x1'),'remove',_0xb2d9('0x2')];function createListener(_0x267f57,_0x234dfb){return function(_0x581f2d){_0x234dfb[_0xb2d9('0x3')](_0x267f57,_0x581f2d);};}function removeListener(_0x19d2b1,_0x5b5dbf){return function(){FaxQueueEvents[_0xb2d9('0x4')](_0x19d2b1,_0x5b5dbf);};}exports[_0xb2d9('0x5')]=function(_0x53cdd3){for(var _0x182fb0=0x0,_0x1129fa=events['length'];_0x182fb0<_0x1129fa;_0x182fb0++){var _0x4c9cac=events[_0x182fb0];var _0x1cf7a5=createListener(_0xb2d9('0x6')+_0x4c9cac,_0x53cdd3);FaxQueueEvents['on'](_0x4c9cac,_0x1cf7a5);}}; \ No newline at end of file +var _0xdf3b=['save','update','removeListener','register','length'];(function(_0x22d655,_0x3941dd){var _0x257739=function(_0x98136e){while(--_0x98136e){_0x22d655['push'](_0x22d655['shift']());}};_0x257739(++_0x3941dd);}(_0xdf3b,0x172));var _0xbdf3=function(_0x3c1b2d,_0x23b1b9){_0x3c1b2d=_0x3c1b2d-0x0;var _0x412475=_0xdf3b[_0x3c1b2d];return _0x412475;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xbdf3('0x0'),'remove',_0xbdf3('0x1')];function createListener(_0x17e56d,_0x40f4b7){return function(_0x1e17e8){_0x40f4b7['emit'](_0x17e56d,_0x1e17e8);};}function removeListener(_0x163fab,_0x384237){return function(){FaxQueueEvents[_0xbdf3('0x2')](_0x163fab,_0x384237);};}exports[_0xbdf3('0x3')]=function(_0x46a1fe){for(var _0x36aa91=0x0,_0x1c8b0b=events[_0xbdf3('0x4')];_0x36aa91<_0x1c8b0b;_0x36aa91++){var _0x3b70ca=events[_0x36aa91];var _0x58afbd=createListener('faxQueue:'+_0x3b70ca,_0x46a1fe);FaxQueueEvents['on'](_0x3b70ca,_0x58afbd);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index de85515..c1824e5 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 _0x5d0a=['fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','create','post','/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','path','express','Router'];(function(_0x274208,_0x3182ff){var _0x209164=function(_0x316e02){while(--_0x316e02){_0x274208['push'](_0x274208['shift']());}};_0x209164(++_0x3182ff);}(_0x5d0a,0x175));var _0xa5d0=function(_0x5ec660,_0x105498){_0x5ec660=_0x5ec660-0x0;var _0x11f584=_0x5d0a[_0x5ec660];return _0x11f584;};'use strict';var multer=require(_0xa5d0('0x0'));var util=require('util');var path=require(_0xa5d0('0x1'));var timeout=require('connect-timeout');var express=require(_0xa5d0('0x2'));var router=express[_0xa5d0('0x3')]();var fs_extra=require(_0xa5d0('0x4'));var auth=require(_0xa5d0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa5d0('0x6'));var controller=require(_0xa5d0('0x7'));router[_0xa5d0('0x8')]('/',auth[_0xa5d0('0x9')](),controller[_0xa5d0('0xa')]);router[_0xa5d0('0x8')](_0xa5d0('0xb'),auth[_0xa5d0('0x9')](),controller[_0xa5d0('0xc')]);router[_0xa5d0('0x8')](_0xa5d0('0xd'),auth['isAuthenticated'](),controller[_0xa5d0('0xe')]);router[_0xa5d0('0x8')](_0xa5d0('0xf'),auth[_0xa5d0('0x9')](),controller[_0xa5d0('0x10')]);router[_0xa5d0('0x8')](_0xa5d0('0x11'),auth[_0xa5d0('0x9')](),controller[_0xa5d0('0x12')]);router[_0xa5d0('0x8')]('/:id/users',auth[_0xa5d0('0x9')](),controller['getAgents']);router['post']('/',auth[_0xa5d0('0x9')](),controller[_0xa5d0('0x13')]);router[_0xa5d0('0x14')](_0xa5d0('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0xa5d0('0x14')](_0xa5d0('0x15'),auth[_0xa5d0('0x9')](),controller[_0xa5d0('0x16')]);router[_0xa5d0('0x17')](_0xa5d0('0xd'),auth[_0xa5d0('0x9')](),controller['update']);router[_0xa5d0('0x18')]('/:id',auth[_0xa5d0('0x9')](),controller[_0xa5d0('0x19')]);router['delete']('/:id/teams',auth[_0xa5d0('0x9')](),controller[_0xa5d0('0x1a')]);router['delete'](_0xa5d0('0x15'),auth[_0xa5d0('0x9')](),controller[_0xa5d0('0x1b')]);module[_0xa5d0('0x1c')]=router; \ No newline at end of file +var _0xadb5=['index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','update','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x5a2426,_0x109f36){var _0x2142be=function(_0x2f0227){while(--_0x2f0227){_0x5a2426['push'](_0x5a2426['shift']());}};_0x2142be(++_0x109f36);}(_0xadb5,0xad));var _0x5adb=function(_0x12935b,_0x1b988e){_0x12935b=_0x12935b-0x0;var _0x2eae05=_0xadb5[_0x12935b];return _0x2eae05;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./faxQueue.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getMembers']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['get'](_0x5adb('0x11'),auth['isAuthenticated'](),controller[_0x5adb('0x12')]);router['post']('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x13')]);router[_0x5adb('0x14')]('/:id/teams',auth[_0x5adb('0x8')](),controller[_0x5adb('0x15')]);router[_0x5adb('0x14')]('/:id/users',auth[_0x5adb('0x8')](),controller['addAgents']);router[_0x5adb('0x16')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);router[_0x5adb('0x18')]('/:id/teams',auth[_0x5adb('0x8')](),controller['removeTeams']);router[_0x5adb('0x18')]('/:id/users',auth[_0x5adb('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index aed9d28..babd471 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 _0xeddf=['DATE','moment','sequelize','exports','STRING'];(function(_0x840cd,_0x2828bc){var _0x1b430a=function(_0x1628d4){while(--_0x1628d4){_0x840cd['push'](_0x840cd['shift']());}};_0x1b430a(++_0x2828bc);}(_0xeddf,0x13c));var _0xfedd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeddf[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0xfedd('0x0'));var Sequelize=require(_0xfedd('0x1'));module[_0xfedd('0x2')]={'uniqueid':{'type':Sequelize[_0xfedd('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xfedd('0x3')]},'joinAt':{'type':Sequelize[_0xfedd('0x4')]},'leaveAt':{'type':Sequelize[_0xfedd('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xfedd('0x4')]},'reason':{'type':Sequelize[_0xfedd('0x3')]}}; \ No newline at end of file +var _0x82a0=['sequelize','exports','STRING','DATE','moment'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x82a0,0xdb));var _0x082a=function(_0x40f9a0,_0x3458cc){_0x40f9a0=_0x40f9a0-0x0;var _0x3e3144=_0x82a0[_0x40f9a0];return _0x3e3144;};'use strict';var moment=require(_0x082a('0x0'));var Sequelize=require(_0x082a('0x1'));module[_0x082a('0x2')]={'uniqueid':{'type':Sequelize[_0x082a('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x082a('0x4')]},'acceptAt':{'type':Sequelize[_0x082a('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x082a('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 402a177..17ce2a9 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 _0x8e94=['send','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params','length','options','find','create','body','catch','describe','eml-format','rimraf','fast-json-patch','moment','mustache','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','end','stack','name'];(function(_0x129a7e,_0x3ae6bf){var _0x21c87c=function(_0x4088c7){while(--_0x4088c7){_0x129a7e['push'](_0x129a7e['shift']());}};_0x21c87c(++_0x3ae6bf);}(_0x8e94,0xf8));var _0x48e9=function(_0xa7d678,_0x3dfdff){_0xa7d678=_0xa7d678-0x0;var _0x5cc539=_0x8e94[_0xa7d678];return _0x5cc539;};'use strict';var emlformat=require(_0x48e9('0x0'));var rimraf=require(_0x48e9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x48e9('0x2'));var rp=require('request-promise');var moment=require(_0x48e9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x48e9('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x48e9('0x5'));var ejs=require(_0x48e9('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x48e9('0x7'));var squel=require('squel');var crypto=require(_0x48e9('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x48e9('0x9'));var toCsv=require(_0x48e9('0x5'));var querystring=require(_0x48e9('0xa'));var Papa=require(_0x48e9('0xb'));var Redis=require('ioredis');var authService=require(_0x48e9('0xc'));var qs=require(_0x48e9('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x48e9('0xe'));var logger=require('../../config/logger')(_0x48e9('0xf'));var utils=require(_0x48e9('0x10'));var config=require(_0x48e9('0x11'));var licenseUtil=require(_0x48e9('0x12'));var db=require(_0x48e9('0x13'))['db'];function respondWithStatusCode(_0x956ebd,_0x567600){_0x567600=_0x567600||0xcc;return function(_0x28fcc0){if(_0x28fcc0){return _0x956ebd[_0x48e9('0x14')](_0x567600);}return _0x956ebd[_0x48e9('0x15')](_0x567600)['end']();};}function respondWithResult(_0x49ef9b,_0x38ee14){_0x38ee14=_0x38ee14||0xc8;return function(_0x29bb11){if(_0x29bb11){return _0x49ef9b[_0x48e9('0x15')](_0x38ee14)[_0x48e9('0x16')](_0x29bb11);}};}function respondWithFilteredResult(_0x1a5fd6,_0x18f318){return function(_0x421862){if(_0x421862){var _0x223884=typeof _0x18f318[_0x48e9('0x17')]===_0x48e9('0x18')&&typeof _0x18f318[_0x48e9('0x19')]===_0x48e9('0x18');var _0x5a7470=_0x421862[_0x48e9('0x1a')];var _0x421508=_0x223884?0x0:_0x18f318[_0x48e9('0x17')];var _0x51ab2d=_0x223884?_0x421862[_0x48e9('0x1a')]:_0x18f318[_0x48e9('0x17')]+_0x18f318[_0x48e9('0x19')];var _0xc7f638;if(_0x51ab2d>=_0x5a7470){_0x51ab2d=_0x5a7470;_0xc7f638=0xc8;}else{_0xc7f638=0xce;}_0x1a5fd6[_0x48e9('0x15')](_0xc7f638);return _0x1a5fd6[_0x48e9('0x1b')](_0x48e9('0x1c'),_0x421508+'-'+_0x51ab2d+'/'+_0x5a7470)[_0x48e9('0x16')](_0x421862);}return null;};}function patchUpdates(_0x54f07d){return function(_0x351fc5){try{jsonpatch[_0x48e9('0x1d')](_0x351fc5,_0x54f07d,!![]);}catch(_0xe985e6){return BPromise['reject'](_0xe985e6);}return _0x351fc5['save']();};}function saveUpdates(_0x1501ab,_0x5fa95d){return function(_0x422d40){if(_0x422d40){return _0x422d40[_0x48e9('0x1e')](_0x1501ab)['then'](function(_0x2c864d){return _0x2c864d;});}return null;};}function removeEntity(_0x27a61a,_0x56f782){return function(_0x2035dd){if(_0x2035dd){return _0x2035dd[_0x48e9('0x1f')]()[_0x48e9('0x20')](function(){_0x27a61a['status'](0xcc)[_0x48e9('0x21')]();});}};}function handleEntityNotFound(_0x361bff,_0x502d3d){return function(_0x588daa){if(!_0x588daa){_0x361bff['sendStatus'](0x194);}return _0x588daa;};}function handleError(_0x4e2e95,_0x338aa9){_0x338aa9=_0x338aa9||0x1f4;return function(_0x1ac2e8){logger['error'](_0x1ac2e8[_0x48e9('0x22')]);if(_0x1ac2e8[_0x48e9('0x23')]){delete _0x1ac2e8['name'];}_0x4e2e95[_0x48e9('0x15')](_0x338aa9)[_0x48e9('0x24')](_0x1ac2e8);};}exports[_0x48e9('0x25')]=function(_0x2fe15b,_0x976ae1){var _0x5565c5={},_0x64c551={},_0x3f7196={'count':0x0,'rows':[]};var _0x5e37aa=_[_0x48e9('0x26')](db[_0x48e9('0x27')][_0x48e9('0x28')],function(_0x509be8){return{'name':_0x509be8[_0x48e9('0x29')],'type':_0x509be8['type'][_0x48e9('0x2a')]};});_0x64c551[_0x48e9('0x2b')]=_[_0x48e9('0x26')](_0x5e37aa,_0x48e9('0x23'));_0x64c551[_0x48e9('0x2c')]=_[_0x48e9('0x2d')](_0x2fe15b[_0x48e9('0x2c')]);_0x64c551[_0x48e9('0x2e')]=_[_0x48e9('0x2f')](_0x64c551[_0x48e9('0x2b')],_0x64c551[_0x48e9('0x2c')]);_0x5565c5['attributes']=_['intersection'](_0x64c551[_0x48e9('0x2b')],qs[_0x48e9('0x30')](_0x2fe15b['query']['fields']));_0x5565c5[_0x48e9('0x31')]=_0x5565c5[_0x48e9('0x31')]['length']?_0x5565c5[_0x48e9('0x31')]:_0x64c551[_0x48e9('0x2b')];if(!_0x2fe15b['query'][_0x48e9('0x32')](_0x48e9('0x33'))){_0x5565c5['limit']=qs[_0x48e9('0x19')](_0x2fe15b[_0x48e9('0x2c')][_0x48e9('0x19')]);_0x5565c5[_0x48e9('0x17')]=qs[_0x48e9('0x17')](_0x2fe15b[_0x48e9('0x2c')]['offset']);}_0x5565c5[_0x48e9('0x34')]=qs[_0x48e9('0x35')](_0x2fe15b[_0x48e9('0x2c')][_0x48e9('0x35')]);_0x5565c5[_0x48e9('0x36')]=qs[_0x48e9('0x2e')](_[_0x48e9('0x37')](_0x2fe15b[_0x48e9('0x2c')],_0x64c551[_0x48e9('0x2e')]),_0x5e37aa);if(_0x2fe15b[_0x48e9('0x2c')][_0x48e9('0x38')]){_0x5565c5['where']=_[_0x48e9('0x39')](_0x5565c5[_0x48e9('0x36')],{'$or':_[_0x48e9('0x26')](_0x5e37aa,function(_0x155c4e){if(_0x155c4e['type']!==_0x48e9('0x3a')){var _0x44f4ab={};_0x44f4ab[_0x155c4e[_0x48e9('0x23')]]={'$like':'%'+_0x2fe15b[_0x48e9('0x2c')][_0x48e9('0x38')]+'%'};return _0x44f4ab;}})});}_0x5565c5=_[_0x48e9('0x39')]({},_0x5565c5,_0x2fe15b['options']);var _0x5de597={'where':_0x5565c5[_0x48e9('0x36')]};return db[_0x48e9('0x27')][_0x48e9('0x1a')](_0x5de597)[_0x48e9('0x20')](function(_0x3411c0){_0x3f7196[_0x48e9('0x1a')]=_0x3411c0;if(_0x2fe15b['query'][_0x48e9('0x3b')]){_0x5565c5[_0x48e9('0x3c')]=[{'all':!![]}];}return db[_0x48e9('0x27')]['findAll'](_0x5565c5);})[_0x48e9('0x20')](function(_0x83154c){_0x3f7196[_0x48e9('0x3d')]=_0x83154c;return _0x3f7196;})[_0x48e9('0x20')](respondWithFilteredResult(_0x976ae1,_0x5565c5))['catch'](handleError(_0x976ae1,null));};exports[_0x48e9('0x3e')]=function(_0xf85bf1,_0xf34683){var _0x133fa5={'raw':!![],'where':{'id':_0xf85bf1[_0x48e9('0x3f')]['id']}},_0x24fcce={};_0x24fcce[_0x48e9('0x2b')]=_[_0x48e9('0x2d')](db[_0x48e9('0x27')][_0x48e9('0x28')]);_0x24fcce[_0x48e9('0x2c')]=_['keys'](_0xf85bf1['query']);_0x24fcce[_0x48e9('0x2e')]=_[_0x48e9('0x2f')](_0x24fcce['model'],_0x24fcce[_0x48e9('0x2c')]);_0x133fa5[_0x48e9('0x31')]=_[_0x48e9('0x2f')](_0x24fcce[_0x48e9('0x2b')],qs[_0x48e9('0x30')](_0xf85bf1[_0x48e9('0x2c')][_0x48e9('0x30')]));_0x133fa5[_0x48e9('0x31')]=_0x133fa5['attributes'][_0x48e9('0x40')]?_0x133fa5[_0x48e9('0x31')]:_0x24fcce[_0x48e9('0x2b')];if(_0xf85bf1[_0x48e9('0x2c')]['includeAll']){_0x133fa5['include']=[{'all':!![]}];}_0x133fa5=_[_0x48e9('0x39')]({},_0x133fa5,_0xf85bf1[_0x48e9('0x41')]);return db[_0x48e9('0x27')][_0x48e9('0x42')](_0x133fa5)[_0x48e9('0x20')](handleEntityNotFound(_0xf34683,null))[_0x48e9('0x20')](respondWithResult(_0xf34683,null))['catch'](handleError(_0xf34683,null));};exports[_0x48e9('0x43')]=function(_0x12b347,_0x172bad){return db[_0x48e9('0x27')][_0x48e9('0x43')](_0x12b347[_0x48e9('0x44')],{})[_0x48e9('0x20')](respondWithResult(_0x172bad,0xc9))[_0x48e9('0x45')](handleError(_0x172bad,null));};exports[_0x48e9('0x1e')]=function(_0x2ef1b7,_0x1ba6a0){if(_0x2ef1b7[_0x48e9('0x44')]['id']){delete _0x2ef1b7['body']['id'];}return db[_0x48e9('0x27')]['find']({'where':{'id':_0x2ef1b7[_0x48e9('0x3f')]['id']}})[_0x48e9('0x20')](handleEntityNotFound(_0x1ba6a0,null))[_0x48e9('0x20')](saveUpdates(_0x2ef1b7[_0x48e9('0x44')],null))['then'](respondWithResult(_0x1ba6a0,null))[_0x48e9('0x45')](handleError(_0x1ba6a0,null));};exports[_0x48e9('0x1f')]=function(_0x36dc16,_0x1a727b){return db[_0x48e9('0x27')]['find']({'where':{'id':_0x36dc16[_0x48e9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1a727b,null))[_0x48e9('0x20')](removeEntity(_0x1a727b,null))[_0x48e9('0x45')](handleError(_0x1a727b,null));};exports['describe']=function(_0x2baca2,_0x2a3707){return db[_0x48e9('0x27')][_0x48e9('0x46')]()[_0x48e9('0x20')](respondWithResult(_0x2a3707,null))['catch'](handleError(_0x2a3707,null));}; \ No newline at end of file +var _0x2948=['mustache','util','sox','ejs','fs-extra','lodash','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','reject','update','then','destroy','stack','name','map','FaxQueueReport','fieldName','type','model','query','intersection','attributes','fields','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','show','params','keys','rawAttributes','length','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0x2948,0xcb));var _0x8294=function(_0x2ed83b,_0x19ed16){_0x2ed83b=_0x2ed83b-0x0;var _0xc8d1e6=_0x2948[_0x2ed83b];return _0xc8d1e6;};'use strict';var emlformat=require(_0x8294('0x0'));var rimraf=require(_0x8294('0x1'));var zipdir=require(_0x8294('0x2'));var jsonpatch=require(_0x8294('0x3'));var rp=require(_0x8294('0x4'));var moment=require(_0x8294('0x5'));var BPromise=require(_0x8294('0x6'));var Mustache=require(_0x8294('0x7'));var util=require(_0x8294('0x8'));var path=require('path');var sox=require(_0x8294('0x9'));var csv=require('to-csv');var ejs=require(_0x8294('0xa'));var fs=require('fs');var fs_extra=require(_0x8294('0xb'));var _=require(_0x8294('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8294('0xd'));var querystring=require(_0x8294('0xe'));var Papa=require('papaparse');var Redis=require(_0x8294('0xf'));var authService=require(_0x8294('0x10'));var qs=require(_0x8294('0x11'));var as=require(_0x8294('0x12'));var hardwareService=require(_0x8294('0x13'));var logger=require(_0x8294('0x14'))('api');var utils=require(_0x8294('0x15'));var config=require(_0x8294('0x16'));var licenseUtil=require(_0x8294('0x17'));var db=require(_0x8294('0x18'))['db'];function respondWithStatusCode(_0x3a13f4,_0x29f1c6){_0x29f1c6=_0x29f1c6||0xcc;return function(_0x71e347){if(_0x71e347){return _0x3a13f4[_0x8294('0x19')](_0x29f1c6);}return _0x3a13f4['status'](_0x29f1c6)[_0x8294('0x1a')]();};}function respondWithResult(_0xde307c,_0x3041ce){_0x3041ce=_0x3041ce||0xc8;return function(_0x552a87){if(_0x552a87){return _0xde307c['status'](_0x3041ce)['json'](_0x552a87);}};}function respondWithFilteredResult(_0x19295d,_0x1bccf6){return function(_0x25c9ae){if(_0x25c9ae){var _0x2ca14b=typeof _0x1bccf6[_0x8294('0x1b')]===_0x8294('0x1c')&&typeof _0x1bccf6[_0x8294('0x1d')]===_0x8294('0x1c');var _0xf93bde=_0x25c9ae[_0x8294('0x1e')];var _0x3d194a=_0x2ca14b?0x0:_0x1bccf6['offset'];var _0x40175a=_0x2ca14b?_0x25c9ae['count']:_0x1bccf6[_0x8294('0x1b')]+_0x1bccf6[_0x8294('0x1d')];var _0x256be3;if(_0x40175a>=_0xf93bde){_0x40175a=_0xf93bde;_0x256be3=0xc8;}else{_0x256be3=0xce;}_0x19295d[_0x8294('0x1f')](_0x256be3);return _0x19295d[_0x8294('0x20')](_0x8294('0x21'),_0x3d194a+'-'+_0x40175a+'/'+_0xf93bde)[_0x8294('0x22')](_0x25c9ae);}return null;};}function patchUpdates(_0x27273d){return function(_0x318fd3){try{jsonpatch['apply'](_0x318fd3,_0x27273d,!![]);}catch(_0x24ea70){return BPromise[_0x8294('0x23')](_0x24ea70);}return _0x318fd3['save']();};}function saveUpdates(_0x1e5d1e,_0x140666){return function(_0xc0eed4){if(_0xc0eed4){return _0xc0eed4[_0x8294('0x24')](_0x1e5d1e)[_0x8294('0x25')](function(_0x3a36af){return _0x3a36af;});}return null;};}function removeEntity(_0x2b6935,_0xff5d69){return function(_0x3aa9f6){if(_0x3aa9f6){return _0x3aa9f6[_0x8294('0x26')]()[_0x8294('0x25')](function(){_0x2b6935['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d2b6a,_0x557529){return function(_0x83f0c4){if(!_0x83f0c4){_0x2d2b6a['sendStatus'](0x194);}return _0x83f0c4;};}function handleError(_0x591b94,_0x37601e){_0x37601e=_0x37601e||0x1f4;return function(_0x399c9d){logger['error'](_0x399c9d[_0x8294('0x27')]);if(_0x399c9d[_0x8294('0x28')]){delete _0x399c9d[_0x8294('0x28')];}_0x591b94[_0x8294('0x1f')](_0x37601e)['send'](_0x399c9d);};}exports['index']=function(_0x311e6b,_0x2d6312){var _0x3ae908={},_0x4fa43c={},_0x5ae09f={'count':0x0,'rows':[]};var _0x460431=_[_0x8294('0x29')](db[_0x8294('0x2a')]['rawAttributes'],function(_0x5d0973){return{'name':_0x5d0973[_0x8294('0x2b')],'type':_0x5d0973[_0x8294('0x2c')]['key']};});_0x4fa43c[_0x8294('0x2d')]=_[_0x8294('0x29')](_0x460431,'name');_0x4fa43c[_0x8294('0x2e')]=_['keys'](_0x311e6b[_0x8294('0x2e')]);_0x4fa43c['filters']=_[_0x8294('0x2f')](_0x4fa43c[_0x8294('0x2d')],_0x4fa43c[_0x8294('0x2e')]);_0x3ae908[_0x8294('0x30')]=_[_0x8294('0x2f')](_0x4fa43c[_0x8294('0x2d')],qs[_0x8294('0x31')](_0x311e6b['query'][_0x8294('0x31')]));_0x3ae908[_0x8294('0x30')]=_0x3ae908[_0x8294('0x30')]['length']?_0x3ae908[_0x8294('0x30')]:_0x4fa43c[_0x8294('0x2d')];if(!_0x311e6b[_0x8294('0x2e')]['hasOwnProperty']('nolimit')){_0x3ae908[_0x8294('0x1d')]=qs[_0x8294('0x1d')](_0x311e6b[_0x8294('0x2e')][_0x8294('0x1d')]);_0x3ae908[_0x8294('0x1b')]=qs[_0x8294('0x1b')](_0x311e6b[_0x8294('0x2e')][_0x8294('0x1b')]);}_0x3ae908[_0x8294('0x32')]=qs['sort'](_0x311e6b[_0x8294('0x2e')][_0x8294('0x33')]);_0x3ae908['where']=qs[_0x8294('0x34')](_[_0x8294('0x35')](_0x311e6b[_0x8294('0x2e')],_0x4fa43c[_0x8294('0x34')]),_0x460431);if(_0x311e6b['query'][_0x8294('0x36')]){_0x3ae908[_0x8294('0x37')]=_[_0x8294('0x38')](_0x3ae908[_0x8294('0x37')],{'$or':_[_0x8294('0x29')](_0x460431,function(_0x1c1107){if(_0x1c1107['type']!=='VIRTUAL'){var _0x1fe795={};_0x1fe795[_0x1c1107['name']]={'$like':'%'+_0x311e6b[_0x8294('0x2e')][_0x8294('0x36')]+'%'};return _0x1fe795;}})});}_0x3ae908=_['merge']({},_0x3ae908,_0x311e6b[_0x8294('0x39')]);var _0x11efe0={'where':_0x3ae908[_0x8294('0x37')]};return db[_0x8294('0x2a')][_0x8294('0x1e')](_0x11efe0)[_0x8294('0x25')](function(_0x3cd9d2){_0x5ae09f[_0x8294('0x1e')]=_0x3cd9d2;if(_0x311e6b[_0x8294('0x2e')][_0x8294('0x3a')]){_0x3ae908[_0x8294('0x3b')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x8294('0x3c')](_0x3ae908);})[_0x8294('0x25')](function(_0x207c9c){_0x5ae09f['rows']=_0x207c9c;return _0x5ae09f;})[_0x8294('0x25')](respondWithFilteredResult(_0x2d6312,_0x3ae908))['catch'](handleError(_0x2d6312,null));};exports[_0x8294('0x3d')]=function(_0x5e4d2e,_0x5e0cbd){var _0x1394d3={'raw':!![],'where':{'id':_0x5e4d2e[_0x8294('0x3e')]['id']}},_0x4c63f1={};_0x4c63f1['model']=_[_0x8294('0x3f')](db['FaxQueueReport'][_0x8294('0x40')]);_0x4c63f1[_0x8294('0x2e')]=_[_0x8294('0x3f')](_0x5e4d2e['query']);_0x4c63f1[_0x8294('0x34')]=_[_0x8294('0x2f')](_0x4c63f1[_0x8294('0x2d')],_0x4c63f1['query']);_0x1394d3[_0x8294('0x30')]=_[_0x8294('0x2f')](_0x4c63f1['model'],qs[_0x8294('0x31')](_0x5e4d2e[_0x8294('0x2e')][_0x8294('0x31')]));_0x1394d3[_0x8294('0x30')]=_0x1394d3[_0x8294('0x30')][_0x8294('0x41')]?_0x1394d3['attributes']:_0x4c63f1[_0x8294('0x2d')];if(_0x5e4d2e['query'][_0x8294('0x3a')]){_0x1394d3['include']=[{'all':!![]}];}_0x1394d3=_[_0x8294('0x38')]({},_0x1394d3,_0x5e4d2e[_0x8294('0x39')]);return db['FaxQueueReport']['find'](_0x1394d3)['then'](handleEntityNotFound(_0x5e0cbd,null))['then'](respondWithResult(_0x5e0cbd,null))[_0x8294('0x42')](handleError(_0x5e0cbd,null));};exports[_0x8294('0x43')]=function(_0x2b7734,_0x4a5a18){return db[_0x8294('0x2a')][_0x8294('0x43')](_0x2b7734[_0x8294('0x44')],{})['then'](respondWithResult(_0x4a5a18,0xc9))['catch'](handleError(_0x4a5a18,null));};exports[_0x8294('0x24')]=function(_0x3a2101,_0x35285b){if(_0x3a2101[_0x8294('0x44')]['id']){delete _0x3a2101['body']['id'];}return db[_0x8294('0x2a')][_0x8294('0x45')]({'where':{'id':_0x3a2101[_0x8294('0x3e')]['id']}})[_0x8294('0x25')](handleEntityNotFound(_0x35285b,null))[_0x8294('0x25')](saveUpdates(_0x3a2101[_0x8294('0x44')],null))['then'](respondWithResult(_0x35285b,null))[_0x8294('0x42')](handleError(_0x35285b,null));};exports['destroy']=function(_0x15bbf7,_0x20e96e){return db[_0x8294('0x2a')][_0x8294('0x45')]({'where':{'id':_0x15bbf7[_0x8294('0x3e')]['id']}})['then'](handleEntityNotFound(_0x20e96e,null))[_0x8294('0x25')](removeEntity(_0x20e96e,null))[_0x8294('0x42')](handleError(_0x20e96e,null));};exports['describe']=function(_0x583cef,_0x4c9232){return db['FaxQueueReport']['describe']()[_0x8294('0x25')](respondWithResult(_0x4c9232,null))[_0x8294('0x42')](handleError(_0x4c9232,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 16835ee..46778a7 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 _0x0295=['rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash','api','request-promise','path'];(function(_0x16391a,_0x1a6fa1){var _0x157a82=function(_0x11f864){while(--_0x11f864){_0x16391a['push'](_0x16391a['shift']());}};_0x157a82(++_0x1a6fa1);}(_0x0295,0x1f0));var _0x5029=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0x0295[_0x1c510a];return _0x23cedd;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5029('0x9')]}],'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(_0x4e1b64,_0x50191f){var _0x47e0b8=function(_0x13030b){while(--_0x13030b){_0x4e1b64['push'](_0x4e1b64['shift']());}};_0x47e0b8(++_0x50191f);}(_0xf494,0x1c6));var _0x4f49=function(_0xbe5791,_0x2557f1){_0xbe5791=_0xbe5791-0x0;var _0x25c12c=_0xf494[_0xbe5791];return _0x25c12c;};'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 4f44e81..2322470 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 _0xe6c2=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','create','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','FaxQueueReport','where','attributes','catch','lodash','util','ioredis'];(function(_0x4bbb86,_0x4ee639){var _0x473a8b=function(_0x4f8ee6){while(--_0x4f8ee6){_0x4bbb86['push'](_0x4bbb86['shift']());}};_0x473a8b(++_0x4ee639);}(_0xe6c2,0x71));var _0x2e6c=function(_0xd0076c,_0xdb6697){_0xd0076c=_0xd0076c-0x0;var _0x3d69ab=_0xe6c2[_0xd0076c];return _0x3d69ab;};'use strict';var _=require(_0x2e6c('0x0'));var util=require(_0x2e6c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e6c('0x2'));var db=require(_0x2e6c('0x3'))['db'];var utils=require(_0x2e6c('0x4'));var logger=require(_0x2e6c('0x5'))('rpc');var config=require(_0x2e6c('0x6'));var jayson=require(_0x2e6c('0x7'));var client=jayson[_0x2e6c('0x8')][_0x2e6c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16c214,_0x23161d,_0x31a0b0){return new BPromise(function(_0x5615b5,_0x5ece02){return client[_0x2e6c('0xa')](_0x16c214,_0x31a0b0)[_0x2e6c('0xb')](function(_0x34868d){logger[_0x2e6c('0xc')](_0x2e6c('0xd'),_0x23161d,_0x2e6c('0xe'));logger[_0x2e6c('0xf')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x23161d,_0x2e6c('0xe'),JSON[_0x2e6c('0x10')](_0x34868d));if(_0x34868d[_0x2e6c('0x11')]){if(_0x34868d['error']['code']===0x1f4){logger[_0x2e6c('0x11')](_0x2e6c('0xd'),_0x23161d,_0x34868d['error'][_0x2e6c('0x12')]);return _0x5ece02(_0x34868d[_0x2e6c('0x11')][_0x2e6c('0x12')]);}logger[_0x2e6c('0x11')](_0x2e6c('0xd'),_0x23161d,_0x34868d[_0x2e6c('0x11')][_0x2e6c('0x12')]);return _0x5615b5(_0x34868d['error'][_0x2e6c('0x12')]);}else{logger[_0x2e6c('0xc')](_0x2e6c('0xd'),_0x23161d,'request\x20sent');_0x5615b5(_0x34868d['result'][_0x2e6c('0x12')]);}})['catch'](function(_0x36c88f){logger[_0x2e6c('0x11')](_0x2e6c('0xd'),_0x23161d,_0x36c88f);_0x5ece02(_0x36c88f);});});}exports['CreateFaxQueueReport']=function(_0x2d86a4){var _0x3b30fb=this;return new Promise(function(_0x23c6f9,_0x3b782d){return db['FaxQueueReport'][_0x2e6c('0x13')](_0x2d86a4[_0x2e6c('0x14')],{'raw':_0x2d86a4['options']?_0x2d86a4[_0x2e6c('0x15')][_0x2e6c('0x16')]===undefined?!![]:![]:!![]})[_0x2e6c('0xb')](function(_0x4780e0){logger['info'](_0x2e6c('0x17'),_0x2d86a4);logger[_0x2e6c('0xf')](_0x2e6c('0x17'),_0x2d86a4,JSON[_0x2e6c('0x10')](_0x4780e0));_0x23c6f9(_0x4780e0);})['catch'](function(_0x461636){logger[_0x2e6c('0x11')](_0x2e6c('0x17'),_0x461636[_0x2e6c('0x12')],_0x2d86a4);_0x3b782d(_0x3b30fb[_0x2e6c('0x11')](0x1f4,_0x461636[_0x2e6c('0x12')]));});});};exports[_0x2e6c('0x18')]=function(_0x4b72cc){var _0x2daf48=this;return new Promise(function(_0x445cd8,_0x4c45b8){return db[_0x2e6c('0x19')]['update'](_0x4b72cc['body'],{'raw':_0x4b72cc[_0x2e6c('0x15')]?_0x4b72cc[_0x2e6c('0x15')][_0x2e6c('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b72cc[_0x2e6c('0x15')]?_0x4b72cc[_0x2e6c('0x15')][_0x2e6c('0x1a')]||null:null,'attributes':_0x4b72cc['options']?_0x4b72cc['options'][_0x2e6c('0x1b')]||null:null,'limit':_0x4b72cc['options']?_0x4b72cc[_0x2e6c('0x15')]['limit']||null:null})[_0x2e6c('0xb')](function(_0xfa01d1){logger[_0x2e6c('0xc')](_0x2e6c('0x18'),_0x4b72cc);logger[_0x2e6c('0xf')]('UpdateFaxQueueReport',_0x4b72cc,JSON[_0x2e6c('0x10')](_0xfa01d1));_0x445cd8(_0xfa01d1);})[_0x2e6c('0x1c')](function(_0x4e1f60){logger[_0x2e6c('0x11')](_0x2e6c('0x18'),_0x4e1f60['message'],_0x4b72cc);_0x4c45b8(_0x2daf48['error'](0x1f4,_0x4e1f60[_0x2e6c('0x12')]));});});}; \ No newline at end of file +var _0x5f06=['stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','UpdateFaxQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x5f06,0x198));var _0x65f0=function(_0xd1076a,_0x3a5c9e){_0xd1076a=_0xd1076a-0x0;var _0x466ebc=_0x5f06[_0xd1076a];return _0x466ebc;};'use strict';var _=require('lodash');var util=require(_0x65f0('0x0'));var moment=require(_0x65f0('0x1'));var BPromise=require(_0x65f0('0x2'));var rs=require(_0x65f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x65f0('0x4'));var jayson=require(_0x65f0('0x5'));var client=jayson[_0x65f0('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c12f3,_0x70a633,_0x2751cd){return new BPromise(function(_0x28762f,_0xe98268){return client[_0x65f0('0x7')](_0x2c12f3,_0x2751cd)[_0x65f0('0x8')](function(_0x26ca7c){logger[_0x65f0('0x9')]('FaxQueueReport,\x20%s,\x20%s',_0x70a633,_0x65f0('0xa'));logger[_0x65f0('0xb')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x70a633,'request\x20sent',JSON[_0x65f0('0xc')](_0x26ca7c));if(_0x26ca7c['error']){if(_0x26ca7c[_0x65f0('0xd')][_0x65f0('0xe')]===0x1f4){logger['error'](_0x65f0('0xf'),_0x70a633,_0x26ca7c[_0x65f0('0xd')][_0x65f0('0x10')]);return _0xe98268(_0x26ca7c[_0x65f0('0xd')]['message']);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x70a633,_0x26ca7c[_0x65f0('0xd')][_0x65f0('0x10')]);return _0x28762f(_0x26ca7c[_0x65f0('0xd')][_0x65f0('0x10')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x70a633,_0x65f0('0xa'));_0x28762f(_0x26ca7c['result'][_0x65f0('0x10')]);}})[_0x65f0('0x11')](function(_0x476124){logger[_0x65f0('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x70a633,_0x476124);_0xe98268(_0x476124);});});}exports[_0x65f0('0x12')]=function(_0xd80998){var _0x19c17b=this;return new Promise(function(_0x52fea7,_0x4ee06b){return db[_0x65f0('0x13')][_0x65f0('0x14')](_0xd80998[_0x65f0('0x15')],{'raw':_0xd80998[_0x65f0('0x16')]?_0xd80998[_0x65f0('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x65f0('0x8')](function(_0x1de3cf){logger[_0x65f0('0x9')](_0x65f0('0x12'),_0xd80998);logger[_0x65f0('0xb')](_0x65f0('0x12'),_0xd80998,JSON['stringify'](_0x1de3cf));_0x52fea7(_0x1de3cf);})[_0x65f0('0x11')](function(_0xe2a9ae){logger[_0x65f0('0xd')]('CreateFaxQueueReport',_0xe2a9ae['message'],_0xd80998);_0x4ee06b(_0x19c17b[_0x65f0('0xd')](0x1f4,_0xe2a9ae['message']));});});};exports[_0x65f0('0x17')]=function(_0x19a9bf){var _0x1ad918=this;return new Promise(function(_0x1c318b,_0x23ad18){return db[_0x65f0('0x13')][_0x65f0('0x18')](_0x19a9bf['body'],{'raw':_0x19a9bf[_0x65f0('0x16')]?_0x19a9bf[_0x65f0('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19a9bf[_0x65f0('0x16')]?_0x19a9bf['options'][_0x65f0('0x19')]||null:null,'attributes':_0x19a9bf[_0x65f0('0x16')]?_0x19a9bf[_0x65f0('0x16')][_0x65f0('0x1a')]||null:null,'limit':_0x19a9bf[_0x65f0('0x16')]?_0x19a9bf[_0x65f0('0x16')][_0x65f0('0x1b')]||null:null})[_0x65f0('0x8')](function(_0x4e1df0){logger[_0x65f0('0x9')]('UpdateFaxQueueReport',_0x19a9bf);logger[_0x65f0('0xb')](_0x65f0('0x17'),_0x19a9bf,JSON[_0x65f0('0xc')](_0x4e1df0));_0x1c318b(_0x4e1df0);})['catch'](function(_0x4a390b){logger['error'](_0x65f0('0x17'),_0x4a390b[_0x65f0('0x10')],_0x19a9bf);_0x23ad18(_0x1ad918[_0x65f0('0xd')](0x1f4,_0x4a390b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 4789fba..838a3ca 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 _0xc339=['index','get','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','isAuthenticated'];(function(_0x2458c3,_0x51d683){var _0x2204d8=function(_0x165261){while(--_0x165261){_0x2458c3['push'](_0x2458c3['shift']());}};_0x2204d8(++_0x51d683);}(_0xc339,0x193));var _0x9c33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc339[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9c33('0x0'));var util=require(_0x9c33('0x1'));var path=require(_0x9c33('0x2'));var timeout=require(_0x9c33('0x3'));var express=require(_0x9c33('0x4'));var router=express[_0x9c33('0x5')]();var fs_extra=require(_0x9c33('0x6'));var auth=require(_0x9c33('0x7'));var interaction=require(_0x9c33('0x8'));var config=require('../../config/environment');var controller=require(_0x9c33('0x9'));router['get']('/',auth[_0x9c33('0xa')](),controller[_0x9c33('0xb')]);router[_0x9c33('0xc')](_0x9c33('0xd'),auth[_0x9c33('0xa')](),controller[_0x9c33('0xe')]);router['get'](_0x9c33('0xf'),auth[_0x9c33('0xa')](),controller[_0x9c33('0x10')]);router[_0x9c33('0x11')]('/',auth['isAuthenticated'](),controller[_0x9c33('0x12')]);router['put'](_0x9c33('0xf'),auth[_0x9c33('0xa')](),controller[_0x9c33('0x13')]);router[_0x9c33('0x14')](_0x9c33('0xf'),auth['isAuthenticated'](),controller[_0x9c33('0x15')]);module[_0x9c33('0x16')]=router; \ No newline at end of file +var _0x6e22=['delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','show','post','create','/:id'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6e22,0xa5));var _0x26e2=function(_0x1846a6,_0x30a18f){_0x1846a6=_0x1846a6-0x0;var _0x41b349=_0x6e22[_0x1846a6];return _0x41b349;};'use strict';var multer=require('multer');var util=require(_0x26e2('0x0'));var path=require(_0x26e2('0x1'));var timeout=require(_0x26e2('0x2'));var express=require('express');var router=express[_0x26e2('0x3')]();var fs_extra=require(_0x26e2('0x4'));var auth=require(_0x26e2('0x5'));var interaction=require(_0x26e2('0x6'));var config=require(_0x26e2('0x7'));var controller=require('./faxQueueReport.controller');router[_0x26e2('0x8')]('/',auth[_0x26e2('0x9')](),controller['index']);router[_0x26e2('0x8')](_0x26e2('0xa'),auth[_0x26e2('0x9')](),controller['describe']);router[_0x26e2('0x8')]('/:id',auth[_0x26e2('0x9')](),controller[_0x26e2('0xb')]);router[_0x26e2('0xc')]('/',auth[_0x26e2('0x9')](),controller[_0x26e2('0xd')]);router['put'](_0x26e2('0xe'),auth[_0x26e2('0x9')](),controller['update']);router[_0x26e2('0xf')](_0x26e2('0xe'),auth[_0x26e2('0x9')](),controller[_0x26e2('0x10')]);module[_0x26e2('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 486d5a8..38e9e83 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x311246,_0x49c786){var _0xe92782=function(_0x1e58e7){while(--_0x1e58e7){_0x311246['push'](_0x311246['shift']());}};_0xe92782(++_0x49c786);}(_0x008c,0x188));var _0xc008=function(_0x3018eb,_0x570c63){_0x3018eb=_0x3018eb-0x0;var _0x23131f=_0x008c[_0x3018eb];return _0x23131f;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x008c,0x188));var _0xc008=function(_0x456b57,_0x58691a){_0x456b57=_0x456b57-0x0;var _0x18f49f=_0x008c[_0x456b57];return _0x18f49f;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index b7c207a..06e61db 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 _0xb4d2=['stack','name','send','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','rows','show','params','keys','length','includeAll','include','find','create','body','catch','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','update','then','destroy','error'];(function(_0x5087b7,_0x117485){var _0x3b4c2b=function(_0x3d25db){while(--_0x3d25db){_0x5087b7['push'](_0x5087b7['shift']());}};_0x3b4c2b(++_0x117485);}(_0xb4d2,0xb3));var _0x2b4d=function(_0x4a4473,_0x2429a0){_0x4a4473=_0x4a4473-0x0;var _0x3aba5c=_0xb4d2[_0x4a4473];return _0x3aba5c;};'use strict';var emlformat=require(_0x2b4d('0x0'));var rimraf=require(_0x2b4d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b4d('0x2'));var rp=require(_0x2b4d('0x3'));var moment=require('moment');var BPromise=require(_0x2b4d('0x4'));var Mustache=require(_0x2b4d('0x5'));var util=require(_0x2b4d('0x6'));var path=require(_0x2b4d('0x7'));var sox=require('sox');var csv=require(_0x2b4d('0x8'));var ejs=require(_0x2b4d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2b4d('0xa'));var crypto=require(_0x2b4d('0xb'));var jsforce=require(_0x2b4d('0xc'));var deskjs=require(_0x2b4d('0xd'));var toCsv=require(_0x2b4d('0x8'));var querystring=require(_0x2b4d('0xe'));var Papa=require(_0x2b4d('0xf'));var Redis=require(_0x2b4d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2b4d('0x11'));var hardwareService=require(_0x2b4d('0x12'));var logger=require(_0x2b4d('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x2b4d('0x14'));var licenseUtil=require(_0x2b4d('0x15'));var db=require(_0x2b4d('0x16'))['db'];function respondWithStatusCode(_0x385ca0,_0x43644e){_0x43644e=_0x43644e||0xcc;return function(_0x17eed7){if(_0x17eed7){return _0x385ca0[_0x2b4d('0x17')](_0x43644e);}return _0x385ca0[_0x2b4d('0x18')](_0x43644e)[_0x2b4d('0x19')]();};}function respondWithResult(_0x3299b2,_0x244707){_0x244707=_0x244707||0xc8;return function(_0x328f70){if(_0x328f70){return _0x3299b2[_0x2b4d('0x18')](_0x244707)['json'](_0x328f70);}};}function respondWithFilteredResult(_0x7823af,_0x3eb06b){return function(_0xe04199){if(_0xe04199){var _0xe7cf84=typeof _0x3eb06b[_0x2b4d('0x1a')]===_0x2b4d('0x1b')&&typeof _0x3eb06b[_0x2b4d('0x1c')]===_0x2b4d('0x1b');var _0x1a1064=_0xe04199[_0x2b4d('0x1d')];var _0x4b4ddb=_0xe7cf84?0x0:_0x3eb06b[_0x2b4d('0x1a')];var _0x1cc7b8=_0xe7cf84?_0xe04199['count']:_0x3eb06b[_0x2b4d('0x1a')]+_0x3eb06b[_0x2b4d('0x1c')];var _0x3edb45;if(_0x1cc7b8>=_0x1a1064){_0x1cc7b8=_0x1a1064;_0x3edb45=0xc8;}else{_0x3edb45=0xce;}_0x7823af[_0x2b4d('0x18')](_0x3edb45);return _0x7823af[_0x2b4d('0x1e')]('Content-Range',_0x4b4ddb+'-'+_0x1cc7b8+'/'+_0x1a1064)[_0x2b4d('0x1f')](_0xe04199);}return null;};}function patchUpdates(_0x400049){return function(_0x4f8e08){try{jsonpatch[_0x2b4d('0x20')](_0x4f8e08,_0x400049,!![]);}catch(_0x3623a6){return BPromise['reject'](_0x3623a6);}return _0x4f8e08['save']();};}function saveUpdates(_0x10c1dc,_0x5aa81e){return function(_0x506898){if(_0x506898){return _0x506898[_0x2b4d('0x21')](_0x10c1dc)[_0x2b4d('0x22')](function(_0x229c6d){return _0x229c6d;});}return null;};}function removeEntity(_0x25b080,_0x1f5435){return function(_0x14de2f){if(_0x14de2f){return _0x14de2f[_0x2b4d('0x23')]()[_0x2b4d('0x22')](function(){_0x25b080[_0x2b4d('0x18')](0xcc)[_0x2b4d('0x19')]();});}};}function handleEntityNotFound(_0x3d05e2,_0x1b7925){return function(_0x147ab0){if(!_0x147ab0){_0x3d05e2[_0x2b4d('0x17')](0x194);}return _0x147ab0;};}function handleError(_0x1baceb,_0x4433fb){_0x4433fb=_0x4433fb||0x1f4;return function(_0x4fee47){logger[_0x2b4d('0x24')](_0x4fee47[_0x2b4d('0x25')]);if(_0x4fee47[_0x2b4d('0x26')]){delete _0x4fee47[_0x2b4d('0x26')];}_0x1baceb[_0x2b4d('0x18')](_0x4433fb)[_0x2b4d('0x27')](_0x4fee47);};}exports['index']=function(_0xcd0687,_0x2f575f){var _0x22ffbb={},_0x21a391={},_0x2c9a4e={'count':0x0,'rows':[]};var _0x5efadb=_[_0x2b4d('0x28')](db[_0x2b4d('0x29')][_0x2b4d('0x2a')],function(_0x42070c){return{'name':_0x42070c[_0x2b4d('0x2b')],'type':_0x42070c[_0x2b4d('0x2c')][_0x2b4d('0x2d')]};});_0x21a391[_0x2b4d('0x2e')]=_[_0x2b4d('0x28')](_0x5efadb,_0x2b4d('0x26'));_0x21a391[_0x2b4d('0x2f')]=_['keys'](_0xcd0687['query']);_0x21a391[_0x2b4d('0x30')]=_[_0x2b4d('0x31')](_0x21a391[_0x2b4d('0x2e')],_0x21a391[_0x2b4d('0x2f')]);_0x22ffbb[_0x2b4d('0x32')]=_[_0x2b4d('0x31')](_0x21a391['model'],qs[_0x2b4d('0x33')](_0xcd0687[_0x2b4d('0x2f')][_0x2b4d('0x33')]));_0x22ffbb[_0x2b4d('0x32')]=_0x22ffbb['attributes']['length']?_0x22ffbb[_0x2b4d('0x32')]:_0x21a391[_0x2b4d('0x2e')];if(!_0xcd0687[_0x2b4d('0x2f')][_0x2b4d('0x34')](_0x2b4d('0x35'))){_0x22ffbb[_0x2b4d('0x1c')]=qs['limit'](_0xcd0687[_0x2b4d('0x2f')][_0x2b4d('0x1c')]);_0x22ffbb[_0x2b4d('0x1a')]=qs['offset'](_0xcd0687[_0x2b4d('0x2f')][_0x2b4d('0x1a')]);}_0x22ffbb[_0x2b4d('0x36')]=qs['sort'](_0xcd0687['query']['sort']);_0x22ffbb[_0x2b4d('0x37')]=qs['filters'](_['pick'](_0xcd0687[_0x2b4d('0x2f')],_0x21a391[_0x2b4d('0x30')]),_0x5efadb);if(_0xcd0687[_0x2b4d('0x2f')][_0x2b4d('0x38')]){_0x22ffbb['where']=_[_0x2b4d('0x39')](_0x22ffbb[_0x2b4d('0x37')],{'$or':_[_0x2b4d('0x28')](_0x5efadb,function(_0x380b1e){if(_0x380b1e['type']!==_0x2b4d('0x3a')){var _0x463091={};_0x463091[_0x380b1e[_0x2b4d('0x26')]]={'$like':'%'+_0xcd0687[_0x2b4d('0x2f')][_0x2b4d('0x38')]+'%'};return _0x463091;}})});}_0x22ffbb=_['merge']({},_0x22ffbb,_0xcd0687[_0x2b4d('0x3b')]);var _0x52019d={'where':_0x22ffbb['where']};return db['FaxTransferReport']['count'](_0x52019d)['then'](function(_0x51cd9e){_0x2c9a4e[_0x2b4d('0x1d')]=_0x51cd9e;if(_0xcd0687['query']['includeAll']){_0x22ffbb['include']=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x22ffbb);})[_0x2b4d('0x22')](function(_0x39d12e){_0x2c9a4e[_0x2b4d('0x3c')]=_0x39d12e;return _0x2c9a4e;})['then'](respondWithFilteredResult(_0x2f575f,_0x22ffbb))['catch'](handleError(_0x2f575f,null));};exports[_0x2b4d('0x3d')]=function(_0x155849,_0x3ea3e2){var _0x8faaa1={'raw':!![],'where':{'id':_0x155849[_0x2b4d('0x3e')]['id']}},_0x1c3584={};_0x1c3584[_0x2b4d('0x2e')]=_[_0x2b4d('0x3f')](db[_0x2b4d('0x29')][_0x2b4d('0x2a')]);_0x1c3584[_0x2b4d('0x2f')]=_[_0x2b4d('0x3f')](_0x155849[_0x2b4d('0x2f')]);_0x1c3584[_0x2b4d('0x30')]=_[_0x2b4d('0x31')](_0x1c3584[_0x2b4d('0x2e')],_0x1c3584[_0x2b4d('0x2f')]);_0x8faaa1[_0x2b4d('0x32')]=_[_0x2b4d('0x31')](_0x1c3584[_0x2b4d('0x2e')],qs[_0x2b4d('0x33')](_0x155849[_0x2b4d('0x2f')]['fields']));_0x8faaa1[_0x2b4d('0x32')]=_0x8faaa1[_0x2b4d('0x32')][_0x2b4d('0x40')]?_0x8faaa1['attributes']:_0x1c3584[_0x2b4d('0x2e')];if(_0x155849['query'][_0x2b4d('0x41')]){_0x8faaa1[_0x2b4d('0x42')]=[{'all':!![]}];}_0x8faaa1=_['merge']({},_0x8faaa1,_0x155849['options']);return db[_0x2b4d('0x29')][_0x2b4d('0x43')](_0x8faaa1)['then'](handleEntityNotFound(_0x3ea3e2,null))[_0x2b4d('0x22')](respondWithResult(_0x3ea3e2,null))['catch'](handleError(_0x3ea3e2,null));};exports[_0x2b4d('0x44')]=function(_0x45df14,_0xc4e821){return db[_0x2b4d('0x29')][_0x2b4d('0x44')](_0x45df14[_0x2b4d('0x45')],{})[_0x2b4d('0x22')](respondWithResult(_0xc4e821,0xc9))['catch'](handleError(_0xc4e821,null));};exports[_0x2b4d('0x21')]=function(_0x28bc31,_0x3f8fa1){if(_0x28bc31[_0x2b4d('0x45')]['id']){delete _0x28bc31[_0x2b4d('0x45')]['id'];}return db[_0x2b4d('0x29')][_0x2b4d('0x43')]({'where':{'id':_0x28bc31[_0x2b4d('0x3e')]['id']}})[_0x2b4d('0x22')](handleEntityNotFound(_0x3f8fa1,null))[_0x2b4d('0x22')](saveUpdates(_0x28bc31[_0x2b4d('0x45')],null))[_0x2b4d('0x22')](respondWithResult(_0x3f8fa1,null))[_0x2b4d('0x46')](handleError(_0x3f8fa1,null));};exports[_0x2b4d('0x23')]=function(_0x19dc35,_0x304540){return db[_0x2b4d('0x29')]['find']({'where':{'id':_0x19dc35[_0x2b4d('0x3e')]['id']}})[_0x2b4d('0x22')](handleEntityNotFound(_0x304540,null))[_0x2b4d('0x22')](removeEntity(_0x304540,null))[_0x2b4d('0x46')](handleError(_0x304540,null));};exports[_0x2b4d('0x47')]=function(_0xf5d477,_0x36fbe3){return db['FaxTransferReport'][_0x2b4d('0x47')]()[_0x2b4d('0x22')](respondWithResult(_0x36fbe3,null))['catch'](handleError(_0x36fbe3,null));}; \ No newline at end of file +var _0x7d87=['limit','count','set','Content-Range','apply','reject','save','then','end','error','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','rows','catch','show','params','keys','include','find','create','body','update','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','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','offset','undefined'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x7d87,0x19f));var _0x77d8=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0x7d87[_0x289a67];return _0x572b49;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x77d8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x77d8('0x1'));var rp=require(_0x77d8('0x2'));var moment=require('moment');var BPromise=require(_0x77d8('0x3'));var Mustache=require(_0x77d8('0x4'));var util=require('util');var path=require(_0x77d8('0x5'));var sox=require(_0x77d8('0x6'));var csv=require(_0x77d8('0x7'));var ejs=require(_0x77d8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77d8('0x9'));var squel=require(_0x77d8('0xa'));var crypto=require(_0x77d8('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x77d8('0x7'));var querystring=require(_0x77d8('0xc'));var Papa=require(_0x77d8('0xd'));var Redis=require(_0x77d8('0xe'));var authService=require(_0x77d8('0xf'));var qs=require(_0x77d8('0x10'));var as=require(_0x77d8('0x11'));var hardwareService=require(_0x77d8('0x12'));var logger=require(_0x77d8('0x13'))(_0x77d8('0x14'));var utils=require(_0x77d8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x77d8('0x16'));var db=require(_0x77d8('0x17'))['db'];function respondWithStatusCode(_0x4bb8ed,_0x478d9a){_0x478d9a=_0x478d9a||0xcc;return function(_0x32b804){if(_0x32b804){return _0x4bb8ed[_0x77d8('0x18')](_0x478d9a);}return _0x4bb8ed['status'](_0x478d9a)['end']();};}function respondWithResult(_0x2423b9,_0x201dfa){_0x201dfa=_0x201dfa||0xc8;return function(_0x1e0e11){if(_0x1e0e11){return _0x2423b9[_0x77d8('0x19')](_0x201dfa)[_0x77d8('0x1a')](_0x1e0e11);}};}function respondWithFilteredResult(_0x2f50d7,_0x160f99){return function(_0x432883){if(_0x432883){var _0x3a9dfc=typeof _0x160f99[_0x77d8('0x1b')]===_0x77d8('0x1c')&&typeof _0x160f99[_0x77d8('0x1d')]===_0x77d8('0x1c');var _0x2075bd=_0x432883[_0x77d8('0x1e')];var _0x2df0d8=_0x3a9dfc?0x0:_0x160f99[_0x77d8('0x1b')];var _0xd8a0ee=_0x3a9dfc?_0x432883[_0x77d8('0x1e')]:_0x160f99[_0x77d8('0x1b')]+_0x160f99['limit'];var _0x2125e3;if(_0xd8a0ee>=_0x2075bd){_0xd8a0ee=_0x2075bd;_0x2125e3=0xc8;}else{_0x2125e3=0xce;}_0x2f50d7[_0x77d8('0x19')](_0x2125e3);return _0x2f50d7[_0x77d8('0x1f')](_0x77d8('0x20'),_0x2df0d8+'-'+_0xd8a0ee+'/'+_0x2075bd)[_0x77d8('0x1a')](_0x432883);}return null;};}function patchUpdates(_0x458e55){return function(_0xeac01f){try{jsonpatch[_0x77d8('0x21')](_0xeac01f,_0x458e55,!![]);}catch(_0x3e18dd){return BPromise[_0x77d8('0x22')](_0x3e18dd);}return _0xeac01f[_0x77d8('0x23')]();};}function saveUpdates(_0x1b8c48,_0x3737d7){return function(_0x45eac8){if(_0x45eac8){return _0x45eac8['update'](_0x1b8c48)[_0x77d8('0x24')](function(_0xa0f3de){return _0xa0f3de;});}return null;};}function removeEntity(_0x45b188,_0x4047dd){return function(_0x5f3f5e){if(_0x5f3f5e){return _0x5f3f5e['destroy']()[_0x77d8('0x24')](function(){_0x45b188[_0x77d8('0x19')](0xcc)[_0x77d8('0x25')]();});}};}function handleEntityNotFound(_0x54746e,_0x3b430f){return function(_0x4e20bf){if(!_0x4e20bf){_0x54746e['sendStatus'](0x194);}return _0x4e20bf;};}function handleError(_0x1ec6ae,_0x3c6d26){_0x3c6d26=_0x3c6d26||0x1f4;return function(_0x5a8e45){logger[_0x77d8('0x26')](_0x5a8e45['stack']);if(_0x5a8e45['name']){delete _0x5a8e45[_0x77d8('0x27')];}_0x1ec6ae[_0x77d8('0x19')](_0x3c6d26)[_0x77d8('0x28')](_0x5a8e45);};}exports[_0x77d8('0x29')]=function(_0x4aa980,_0x225834){var _0xd02e={},_0x14f83f={},_0x5d11f5={'count':0x0,'rows':[]};var _0x460a94=_[_0x77d8('0x2a')](db[_0x77d8('0x2b')][_0x77d8('0x2c')],function(_0x39b6bb){return{'name':_0x39b6bb[_0x77d8('0x2d')],'type':_0x39b6bb[_0x77d8('0x2e')][_0x77d8('0x2f')]};});_0x14f83f['model']=_[_0x77d8('0x2a')](_0x460a94,_0x77d8('0x27'));_0x14f83f['query']=_['keys'](_0x4aa980[_0x77d8('0x30')]);_0x14f83f[_0x77d8('0x31')]=_[_0x77d8('0x32')](_0x14f83f[_0x77d8('0x33')],_0x14f83f[_0x77d8('0x30')]);_0xd02e[_0x77d8('0x34')]=_[_0x77d8('0x32')](_0x14f83f[_0x77d8('0x33')],qs['fields'](_0x4aa980[_0x77d8('0x30')][_0x77d8('0x35')]));_0xd02e[_0x77d8('0x34')]=_0xd02e[_0x77d8('0x34')][_0x77d8('0x36')]?_0xd02e[_0x77d8('0x34')]:_0x14f83f[_0x77d8('0x33')];if(!_0x4aa980[_0x77d8('0x30')][_0x77d8('0x37')]('nolimit')){_0xd02e[_0x77d8('0x1d')]=qs[_0x77d8('0x1d')](_0x4aa980[_0x77d8('0x30')][_0x77d8('0x1d')]);_0xd02e[_0x77d8('0x1b')]=qs[_0x77d8('0x1b')](_0x4aa980[_0x77d8('0x30')][_0x77d8('0x1b')]);}_0xd02e[_0x77d8('0x38')]=qs[_0x77d8('0x39')](_0x4aa980[_0x77d8('0x30')]['sort']);_0xd02e[_0x77d8('0x3a')]=qs[_0x77d8('0x31')](_[_0x77d8('0x3b')](_0x4aa980[_0x77d8('0x30')],_0x14f83f[_0x77d8('0x31')]),_0x460a94);if(_0x4aa980['query'][_0x77d8('0x3c')]){_0xd02e[_0x77d8('0x3a')]=_[_0x77d8('0x3d')](_0xd02e[_0x77d8('0x3a')],{'$or':_['map'](_0x460a94,function(_0x2b017c){if(_0x2b017c[_0x77d8('0x2e')]!=='VIRTUAL'){var _0x55261d={};_0x55261d[_0x2b017c[_0x77d8('0x27')]]={'$like':'%'+_0x4aa980['query'][_0x77d8('0x3c')]+'%'};return _0x55261d;}})});}_0xd02e=_[_0x77d8('0x3d')]({},_0xd02e,_0x4aa980['options']);var _0xac2714={'where':_0xd02e[_0x77d8('0x3a')]};return db[_0x77d8('0x2b')][_0x77d8('0x1e')](_0xac2714)[_0x77d8('0x24')](function(_0x58cddd){_0x5d11f5[_0x77d8('0x1e')]=_0x58cddd;if(_0x4aa980[_0x77d8('0x30')][_0x77d8('0x3e')]){_0xd02e['include']=[{'all':!![]}];}return db[_0x77d8('0x2b')]['findAll'](_0xd02e);})[_0x77d8('0x24')](function(_0x25820e){_0x5d11f5[_0x77d8('0x3f')]=_0x25820e;return _0x5d11f5;})[_0x77d8('0x24')](respondWithFilteredResult(_0x225834,_0xd02e))[_0x77d8('0x40')](handleError(_0x225834,null));};exports[_0x77d8('0x41')]=function(_0x14cf66,_0x5f9708){var _0x310bcf={'raw':!![],'where':{'id':_0x14cf66[_0x77d8('0x42')]['id']}},_0x1006d3={};_0x1006d3[_0x77d8('0x33')]=_[_0x77d8('0x43')](db[_0x77d8('0x2b')][_0x77d8('0x2c')]);_0x1006d3['query']=_[_0x77d8('0x43')](_0x14cf66[_0x77d8('0x30')]);_0x1006d3[_0x77d8('0x31')]=_[_0x77d8('0x32')](_0x1006d3[_0x77d8('0x33')],_0x1006d3[_0x77d8('0x30')]);_0x310bcf[_0x77d8('0x34')]=_[_0x77d8('0x32')](_0x1006d3[_0x77d8('0x33')],qs[_0x77d8('0x35')](_0x14cf66[_0x77d8('0x30')][_0x77d8('0x35')]));_0x310bcf['attributes']=_0x310bcf[_0x77d8('0x34')][_0x77d8('0x36')]?_0x310bcf[_0x77d8('0x34')]:_0x1006d3[_0x77d8('0x33')];if(_0x14cf66['query'][_0x77d8('0x3e')]){_0x310bcf[_0x77d8('0x44')]=[{'all':!![]}];}_0x310bcf=_['merge']({},_0x310bcf,_0x14cf66['options']);return db[_0x77d8('0x2b')][_0x77d8('0x45')](_0x310bcf)[_0x77d8('0x24')](handleEntityNotFound(_0x5f9708,null))[_0x77d8('0x24')](respondWithResult(_0x5f9708,null))[_0x77d8('0x40')](handleError(_0x5f9708,null));};exports[_0x77d8('0x46')]=function(_0x6884cf,_0x48ad75){return db['FaxTransferReport'][_0x77d8('0x46')](_0x6884cf[_0x77d8('0x47')],{})['then'](respondWithResult(_0x48ad75,0xc9))[_0x77d8('0x40')](handleError(_0x48ad75,null));};exports[_0x77d8('0x48')]=function(_0x382be6,_0x5b19ca){if(_0x382be6[_0x77d8('0x47')]['id']){delete _0x382be6[_0x77d8('0x47')]['id'];}return db['FaxTransferReport'][_0x77d8('0x45')]({'where':{'id':_0x382be6[_0x77d8('0x42')]['id']}})['then'](handleEntityNotFound(_0x5b19ca,null))['then'](saveUpdates(_0x382be6[_0x77d8('0x47')],null))[_0x77d8('0x24')](respondWithResult(_0x5b19ca,null))[_0x77d8('0x40')](handleError(_0x5b19ca,null));};exports['destroy']=function(_0x266b6f,_0xde9a72){return db[_0x77d8('0x2b')][_0x77d8('0x45')]({'where':{'id':_0x266b6f[_0x77d8('0x42')]['id']}})[_0x77d8('0x24')](handleEntityNotFound(_0xde9a72,null))[_0x77d8('0x24')](removeEntity(_0xde9a72,null))[_0x77d8('0x40')](handleError(_0xde9a72,null));};exports[_0x77d8('0x49')]=function(_0xa86672,_0x335d9c){return db[_0x77d8('0x2b')][_0x77d8('0x49')]()[_0x77d8('0x24')](respondWithResult(_0x335d9c,null))[_0x77d8('0x40')](handleError(_0x335d9c,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 72d49cc..0f27669 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 _0xfddb=['lodash','util','../../config/logger','moment','../../config/environment','exports','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x4fcdf3,_0x53bf50){var _0x373b47=function(_0x377d93){while(--_0x377d93){_0x4fcdf3['push'](_0x4fcdf3['shift']());}};_0x373b47(++_0x53bf50);}(_0xfddb,0x1ea));var _0xbfdd=function(_0x5c5d22,_0x49df58){_0x5c5d22=_0x5c5d22-0x0;var _0x2699d5=_0xfddb[_0x5c5d22];return _0x2699d5;};'use strict';var _=require(_0xbfdd('0x0'));var util=require(_0xbfdd('0x1'));var logger=require(_0xbfdd('0x2'))('api');var moment=require(_0xbfdd('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(_0xbfdd('0x4'));var attributes=require('./faxTransferReport.attributes');module[_0xbfdd('0x5')]=function(_0x113b76,_0x99f0a8){return _0x113b76[_0xbfdd('0x6')](_0xbfdd('0x7'),attributes,{'tableName':_0xbfdd('0x8'),'paranoid':![],'indexes':[{'name':_0xbfdd('0x9'),'fields':[_0xbfdd('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d84=['rimraf','../../config/environment','./faxTransferReport.attributes','define','report_fax_transfer','uniqueid','lodash','util','moment','bluebird'];(function(_0x306475,_0x2bd154){var _0x4c4f29=function(_0x1ccaac){while(--_0x1ccaac){_0x306475['push'](_0x306475['shift']());}};_0x4c4f29(++_0x2bd154);}(_0x8d84,0x114));var _0x48d8=function(_0x35d197,_0x19f749){_0x35d197=_0x35d197-0x0;var _0x517d20=_0x8d84[_0x35d197];return _0x517d20;};'use strict';var _=require(_0x48d8('0x0'));var util=require(_0x48d8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x48d8('0x2'));var BPromise=require(_0x48d8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x48d8('0x4'));var config=require(_0x48d8('0x5'));var attributes=require(_0x48d8('0x6'));module['exports']=function(_0x530d3e,_0x57bfe1){return _0x530d3e[_0x48d8('0x7')]('FaxTransferReport',attributes,{'tableName':_0x48d8('0x8'),'paranoid':![],'indexes':[{'name':_0x48d8('0x9'),'fields':[_0x48d8('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index f7e77ee..97c7f6d 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 _0x459d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','FaxTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x547741,_0x4a0c6e){var _0x3a4f4f=function(_0x1afbb1){while(--_0x1afbb1){_0x547741['push'](_0x547741['shift']());}};_0x3a4f4f(++_0x4a0c6e);}(_0x459d,0x8b));var _0xd459=function(_0x2a4e92,_0xdd4ada){_0x2a4e92=_0x2a4e92-0x0;var _0xccdde0=_0x459d[_0x2a4e92];return _0xccdde0;};'use strict';var _=require(_0xd459('0x0'));var util=require(_0xd459('0x1'));var moment=require(_0xd459('0x2'));var BPromise=require('bluebird');var rs=require(_0xd459('0x3'));var fs=require('fs');var Redis=require(_0xd459('0x4'));var db=require(_0xd459('0x5'))['db'];var utils=require(_0xd459('0x6'));var logger=require(_0xd459('0x7'))(_0xd459('0x8'));var config=require(_0xd459('0x9'));var jayson=require(_0xd459('0xa'));var client=jayson[_0xd459('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14e771,_0x2f5637,_0x8ebd0){return new BPromise(function(_0x1d15a5,_0x27d207){return client[_0xd459('0xc')](_0x14e771,_0x8ebd0)[_0xd459('0xd')](function(_0x25af07){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x2f5637,_0xd459('0xe'));logger[_0xd459('0xf')](_0xd459('0x10'),_0x2f5637,_0xd459('0xe'),JSON['stringify'](_0x25af07));if(_0x25af07[_0xd459('0x11')]){if(_0x25af07[_0xd459('0x11')][_0xd459('0x12')]===0x1f4){logger[_0xd459('0x11')](_0xd459('0x13'),_0x2f5637,_0x25af07['error']['message']);return _0x27d207(_0x25af07[_0xd459('0x11')]['message']);}logger['error'](_0xd459('0x13'),_0x2f5637,_0x25af07[_0xd459('0x11')][_0xd459('0x14')]);return _0x1d15a5(_0x25af07[_0xd459('0x11')][_0xd459('0x14')]);}else{logger[_0xd459('0x15')](_0xd459('0x13'),_0x2f5637,_0xd459('0xe'));_0x1d15a5(_0x25af07[_0xd459('0x16')][_0xd459('0x14')]);}})[_0xd459('0x17')](function(_0x11a1ca){logger['error'](_0xd459('0x13'),_0x2f5637,_0x11a1ca);_0x27d207(_0x11a1ca);});});} \ No newline at end of file +var _0xae87=['debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s'];(function(_0xca82c9,_0x3cf12f){var _0x2e01f0=function(_0x130c85){while(--_0x130c85){_0xca82c9['push'](_0xca82c9['shift']());}};_0x2e01f0(++_0x3cf12f);}(_0xae87,0x110));var _0x7ae8=function(_0x4a7843,_0x24f6d1){_0x4a7843=_0x4a7843-0x0;var _0x2c57fe=_0xae87[_0x4a7843];return _0x2c57fe;};'use strict';var _=require(_0x7ae8('0x0'));var util=require(_0x7ae8('0x1'));var moment=require(_0x7ae8('0x2'));var BPromise=require('bluebird');var rs=require(_0x7ae8('0x3'));var fs=require('fs');var Redis=require(_0x7ae8('0x4'));var db=require(_0x7ae8('0x5'))['db'];var utils=require(_0x7ae8('0x6'));var logger=require('../../config/logger')(_0x7ae8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7ae8('0x8')][_0x7ae8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5edff8,_0x372d4e,_0xd4529d){return new BPromise(function(_0x412449,_0xbdbdf8){return client[_0x7ae8('0xa')](_0x5edff8,_0xd4529d)[_0x7ae8('0xb')](function(_0x79de54){logger[_0x7ae8('0xc')](_0x7ae8('0xd'),_0x372d4e,'request\x20sent');logger[_0x7ae8('0xe')](_0x7ae8('0xf'),_0x372d4e,_0x7ae8('0x10'),JSON[_0x7ae8('0x11')](_0x79de54));if(_0x79de54[_0x7ae8('0x12')]){if(_0x79de54[_0x7ae8('0x12')][_0x7ae8('0x13')]===0x1f4){logger[_0x7ae8('0x12')](_0x7ae8('0xd'),_0x372d4e,_0x79de54[_0x7ae8('0x12')][_0x7ae8('0x14')]);return _0xbdbdf8(_0x79de54[_0x7ae8('0x12')][_0x7ae8('0x14')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x372d4e,_0x79de54[_0x7ae8('0x12')][_0x7ae8('0x14')]);return _0x412449(_0x79de54[_0x7ae8('0x12')]['message']);}else{logger[_0x7ae8('0xc')](_0x7ae8('0xd'),_0x372d4e,_0x7ae8('0x10'));_0x412449(_0x79de54[_0x7ae8('0x15')]['message']);}})['catch'](function(_0x5ab1e1){logger[_0x7ae8('0x12')](_0x7ae8('0xd'),_0x372d4e,_0x5ab1e1);_0xbdbdf8(_0x5ab1e1);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 6e71c27..5a31755 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 _0xc02e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','path'];(function(_0x5c02a4,_0x73b71f){var _0x557283=function(_0x72a58e){while(--_0x72a58e){_0x5c02a4['push'](_0x5c02a4['shift']());}};_0x557283(++_0x73b71f);}(_0xc02e,0xee));var _0xec02=function(_0x374d55,_0x27d300){_0x374d55=_0x374d55-0x0;var _0xeb47a1=_0xc02e[_0x374d55];return _0xeb47a1;};'use strict';var multer=require(_0xec02('0x0'));var util=require('util');var path=require(_0xec02('0x1'));var timeout=require('connect-timeout');var express=require(_0xec02('0x2'));var router=express[_0xec02('0x3')]();var fs_extra=require(_0xec02('0x4'));var auth=require(_0xec02('0x5'));var interaction=require(_0xec02('0x6'));var config=require('../../config/environment');var controller=require(_0xec02('0x7'));router['get']('/',auth[_0xec02('0x8')](),controller[_0xec02('0x9')]);router[_0xec02('0xa')](_0xec02('0xb'),auth[_0xec02('0x8')](),controller[_0xec02('0xc')]);router[_0xec02('0xa')](_0xec02('0xd'),auth['isAuthenticated'](),controller[_0xec02('0xe')]);router[_0xec02('0xf')]('/',auth[_0xec02('0x8')](),controller[_0xec02('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xec02('0x11')]('/:id',auth[_0xec02('0x8')](),controller[_0xec02('0x12')]);module[_0xec02('0x13')]=router; \ No newline at end of file +var _0x4782=['fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','/describe','isAuthenticated','/:id','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x111ec2,_0x44fca8){var _0xdaad25=function(_0x191f1a){while(--_0x191f1a){_0x111ec2['push'](_0x111ec2['shift']());}};_0xdaad25(++_0x44fca8);}(_0x4782,0x9e));var _0x2478=function(_0x13e8ac,_0x25c0c0){_0x13e8ac=_0x13e8ac-0x0;var _0xc77ea6=_0x4782[_0x13e8ac];return _0xc77ea6;};'use strict';var multer=require(_0x2478('0x0'));var util=require('util');var path=require(_0x2478('0x1'));var timeout=require(_0x2478('0x2'));var express=require(_0x2478('0x3'));var router=express['Router']();var fs_extra=require(_0x2478('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2478('0x5'));var config=require(_0x2478('0x6'));var controller=require(_0x2478('0x7'));router[_0x2478('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2478('0x8')](_0x2478('0x9'),auth[_0x2478('0xa')](),controller['describe']);router[_0x2478('0x8')](_0x2478('0xb'),auth[_0x2478('0xa')](),controller['show']);router['post']('/',auth[_0x2478('0xa')](),controller[_0x2478('0xc')]);router[_0x2478('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x2478('0xe')]);router[_0x2478('0xf')](_0x2478('0xb'),auth['isAuthenticated'](),controller[_0x2478('0x10')]);module[_0x2478('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 8e2244b..065ec15 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 _0x63ad=['multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','delete','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63ad,0x165));var _0xd63a=function(_0x1f554f,_0x6de916){_0x1f554f=_0x1f554f-0x0;var _0x1ebadd=_0x63ad[_0x1f554f];return _0x1ebadd;};'use strict';var multer=require(_0xd63a('0x0'));var util=require(_0xd63a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd63a('0x2'));var auth=require(_0xd63a('0x3'));var interaction=require(_0xd63a('0x4'));var config=require(_0xd63a('0x5'));var controller=require(_0xd63a('0x6'));router[_0xd63a('0x7')]('/',auth[_0xd63a('0x8')](),controller[_0xd63a('0x9')]);router[_0xd63a('0x7')](_0xd63a('0xa'),auth[_0xd63a('0x8')](),controller[_0xd63a('0xb')]);router[_0xd63a('0x7')](_0xd63a('0xc'),auth[_0xd63a('0x8')](),controller[_0xd63a('0xd')]);router[_0xd63a('0x7')](_0xd63a('0xe'),auth[_0xd63a('0x8')](),controller[_0xd63a('0xf')]);router[_0xd63a('0x10')]('/',auth[_0xd63a('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xd63a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd63a('0x12')]);router[_0xd63a('0x13')]('/:id',auth[_0xd63a('0x8')](),controller['destroy']);module[_0xd63a('0x14')]=router; \ No newline at end of file +var _0x508b=['../../config/environment','./intDeskAccount.controller','get','show','/:id/configurations','isAuthenticated','getConfigurations','getFields','post','create','addConfiguration','update','destroy','exports','multer','path','express','fs-extra','../../components/auth/service'];(function(_0x4cd431,_0x38ce4b){var _0x1d1442=function(_0x59eb31){while(--_0x59eb31){_0x4cd431['push'](_0x4cd431['shift']());}};_0x1d1442(++_0x38ce4b);}(_0x508b,0x93));var _0xb508=function(_0x54e9cd,_0x16ae73){_0x54e9cd=_0x54e9cd-0x0;var _0x343ae7=_0x508b[_0x54e9cd];return _0x343ae7;};'use strict';var multer=require(_0xb508('0x0'));var util=require('util');var path=require(_0xb508('0x1'));var timeout=require('connect-timeout');var express=require(_0xb508('0x2'));var router=express['Router']();var fs_extra=require(_0xb508('0x3'));var auth=require(_0xb508('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb508('0x5'));var controller=require(_0xb508('0x6'));router[_0xb508('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb508('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb508('0x8')]);router['get'](_0xb508('0x9'),auth[_0xb508('0xa')](),controller[_0xb508('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xb508('0xc')]);router[_0xb508('0xd')]('/',auth['isAuthenticated'](),controller[_0xb508('0xe')]);router[_0xb508('0xd')](_0xb508('0x9'),auth[_0xb508('0xa')](),controller[_0xb508('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb508('0x10')]);router['delete']('/:id',auth[_0xb508('0xa')](),controller[_0xb508('0x11')]);module[_0xb508('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 42f7852..6cf8875 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 _0xbee2=['STRING','ENUM','basic','integrationTab','newTab','exports'];(function(_0x33155c,_0x3fdde1){var _0x5becf7=function(_0x2f7a2f){while(--_0x2f7a2f){_0x33155c['push'](_0x33155c['shift']());}};_0x5becf7(++_0x3fdde1);}(_0xbee2,0xfb));var _0x2bee=function(_0x1ad9b4,_0x5df9ed){_0x1ad9b4=_0x1ad9b4-0x0;var _0xbbee74=_0xbee2[_0x1ad9b4];return _0xbbee74;};'use strict';var Sequelize=require('sequelize');module[_0x2bee('0x0')]={'name':{'type':Sequelize[_0x2bee('0x1')]},'description':{'type':Sequelize[_0x2bee('0x1')]},'username':{'type':Sequelize[_0x2bee('0x1')]},'remoteUri':{'type':Sequelize[_0x2bee('0x1')]},'authType':{'type':Sequelize[_0x2bee('0x2')](_0x2bee('0x3')),'defaultValue':_0x2bee('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x2bee('0x1')]},'consumerSecret':{'type':Sequelize[_0x2bee('0x1')]},'token':{'type':Sequelize[_0x2bee('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2bee('0x2')](_0x2bee('0x4'),_0x2bee('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xb485=['newTab','sequelize','STRING','ENUM','basic','integrationTab'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb485,0x85));var _0x5b48=function(_0x1142bc,_0x75b3b7){_0x1142bc=_0x1142bc-0x0;var _0x2de9e2=_0xb485[_0x1142bc];return _0x2de9e2;};'use strict';var Sequelize=require(_0x5b48('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5b48('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x5b48('0x2')](_0x5b48('0x3')),'defaultValue':_0x5b48('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x5b48('0x1')]},'consumerSecret':{'type':Sequelize[_0x5b48('0x1')]},'token':{'type':Sequelize[_0x5b48('0x1')]},'tokenSecret':{'type':Sequelize[_0x5b48('0x1')]},'serverUrl':{'type':Sequelize[_0x5b48('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5b48('0x4'),_0x5b48('0x5')),'defaultValue':_0x5b48('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index e25eced..3ebdb2c 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 _0xce1e=['type','VIRTUAL','options','includeAll','include','rows','show','params','length','find','catch','create','body','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','application/json','authType','basic','headers','Authorization','Basic\x20%s','username','toString','base64','concat','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','error','name','send','map','DeskAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge'];(function(_0x2c9816,_0x19d8ab){var _0x1c367a=function(_0x12a630){while(--_0x12a630){_0x2c9816['push'](_0x2c9816['shift']());}};_0x1c367a(++_0x19d8ab);}(_0xce1e,0x11d));var _0xece1=function(_0x1bbffe,_0x39f25d){_0x1bbffe=_0x1bbffe-0x0;var _0x3c1047=_0xce1e[_0x1bbffe];return _0x3c1047;};'use strict';var emlformat=require(_0xece1('0x0'));var rimraf=require(_0xece1('0x1'));var zipdir=require(_0xece1('0x2'));var jsonpatch=require(_0xece1('0x3'));var rp=require(_0xece1('0x4'));var moment=require(_0xece1('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xece1('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xece1('0x7'));var ejs=require(_0xece1('0x8'));var fs=require('fs');var fs_extra=require(_0xece1('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xece1('0xa'));var jsforce=require(_0xece1('0xb'));var deskjs=require(_0xece1('0xc'));var toCsv=require(_0xece1('0x7'));var querystring=require(_0xece1('0xd'));var Papa=require('papaparse');var Redis=require(_0xece1('0xe'));var authService=require(_0xece1('0xf'));var qs=require(_0xece1('0x10'));var as=require(_0xece1('0x11'));var hardwareService=require(_0xece1('0x12'));var logger=require(_0xece1('0x13'))(_0xece1('0x14'));var utils=require(_0xece1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xece1('0x16'));var db=require(_0xece1('0x17'))['db'];var integrations=require(_0xece1('0x18'));function respondWithStatusCode(_0x15a7a7,_0x2024fe){_0x2024fe=_0x2024fe||0xcc;return function(_0x2b26e1){if(_0x2b26e1){return _0x15a7a7[_0xece1('0x19')](_0x2024fe);}return _0x15a7a7[_0xece1('0x1a')](_0x2024fe)[_0xece1('0x1b')]();};}function respondWithResult(_0x56a293,_0x6abcae){_0x6abcae=_0x6abcae||0xc8;return function(_0x4a57d7){if(_0x4a57d7){return _0x56a293['status'](_0x6abcae)['json'](_0x4a57d7);}};}function respondWithFilteredResult(_0x53c270,_0x26b8ef){return function(_0x30deef){if(_0x30deef){var _0x371661=typeof _0x26b8ef[_0xece1('0x1c')]==='undefined'&&typeof _0x26b8ef['limit']===_0xece1('0x1d');var _0x4e0b83=_0x30deef[_0xece1('0x1e')];var _0x2cdc0c=_0x371661?0x0:_0x26b8ef[_0xece1('0x1c')];var _0x445caf=_0x371661?_0x30deef['count']:_0x26b8ef[_0xece1('0x1c')]+_0x26b8ef[_0xece1('0x1f')];var _0x1d2d81;if(_0x445caf>=_0x4e0b83){_0x445caf=_0x4e0b83;_0x1d2d81=0xc8;}else{_0x1d2d81=0xce;}_0x53c270[_0xece1('0x1a')](_0x1d2d81);return _0x53c270['set'](_0xece1('0x20'),_0x2cdc0c+'-'+_0x445caf+'/'+_0x4e0b83)[_0xece1('0x21')](_0x30deef);}return null;};}function patchUpdates(_0x1efaeb){return function(_0x1eba7d){try{jsonpatch[_0xece1('0x22')](_0x1eba7d,_0x1efaeb,!![]);}catch(_0x897d85){return BPromise[_0xece1('0x23')](_0x897d85);}return _0x1eba7d[_0xece1('0x24')]();};}function saveUpdates(_0x47e887,_0x30fdd1){return function(_0xbc0e5c){if(_0xbc0e5c){return _0xbc0e5c[_0xece1('0x25')](_0x47e887)['then'](function(_0x270c3c){return _0x270c3c;});}return null;};}function removeEntity(_0x23f51a,_0x77ffc2){return function(_0x3275d4){if(_0x3275d4){return _0x3275d4['destroy']()[_0xece1('0x26')](function(){_0x23f51a[_0xece1('0x1a')](0xcc)[_0xece1('0x1b')]();});}};}function handleEntityNotFound(_0x380e90,_0x2cb6cc){return function(_0x43319e){if(!_0x43319e){_0x380e90[_0xece1('0x19')](0x194);}return _0x43319e;};}function handleError(_0x1f7ce2,_0x553cb1){_0x553cb1=_0x553cb1||0x1f4;return function(_0x75bb3f){logger[_0xece1('0x27')](_0x75bb3f['stack']);if(_0x75bb3f[_0xece1('0x28')]){delete _0x75bb3f[_0xece1('0x28')];}_0x1f7ce2[_0xece1('0x1a')](_0x553cb1)[_0xece1('0x29')](_0x75bb3f);};}exports['index']=function(_0x132870,_0x34799f){var _0x1852d2={},_0x81df={},_0x198f26={'count':0x0,'rows':[]};var _0x1cf283=_[_0xece1('0x2a')](db[_0xece1('0x2b')][_0xece1('0x2c')],function(_0x267af5){return{'name':_0x267af5[_0xece1('0x2d')],'type':_0x267af5['type'][_0xece1('0x2e')]};});_0x81df[_0xece1('0x2f')]=_['map'](_0x1cf283,_0xece1('0x28'));_0x81df['query']=_[_0xece1('0x30')](_0x132870[_0xece1('0x31')]);_0x81df[_0xece1('0x32')]=_[_0xece1('0x33')](_0x81df[_0xece1('0x2f')],_0x81df[_0xece1('0x31')]);_0x1852d2['attributes']=_[_0xece1('0x33')](_0x81df[_0xece1('0x2f')],qs[_0xece1('0x34')](_0x132870[_0xece1('0x31')][_0xece1('0x34')]));_0x1852d2[_0xece1('0x35')]=_0x1852d2[_0xece1('0x35')]['length']?_0x1852d2['attributes']:_0x81df[_0xece1('0x2f')];if(!_0x132870[_0xece1('0x31')]['hasOwnProperty']('nolimit')){_0x1852d2[_0xece1('0x1f')]=qs['limit'](_0x132870[_0xece1('0x31')][_0xece1('0x1f')]);_0x1852d2['offset']=qs[_0xece1('0x1c')](_0x132870['query'][_0xece1('0x1c')]);}_0x1852d2[_0xece1('0x36')]=qs[_0xece1('0x37')](_0x132870[_0xece1('0x31')][_0xece1('0x37')]);_0x1852d2[_0xece1('0x38')]=qs[_0xece1('0x32')](_[_0xece1('0x39')](_0x132870[_0xece1('0x31')],_0x81df[_0xece1('0x32')]),_0x1cf283);if(_0x132870[_0xece1('0x31')][_0xece1('0x3a')]){_0x1852d2[_0xece1('0x38')]=_[_0xece1('0x3b')](_0x1852d2[_0xece1('0x38')],{'$or':_[_0xece1('0x2a')](_0x1cf283,function(_0x1897c3){if(_0x1897c3[_0xece1('0x3c')]!==_0xece1('0x3d')){var _0x10f9b4={};_0x10f9b4[_0x1897c3['name']]={'$like':'%'+_0x132870[_0xece1('0x31')]['filter']+'%'};return _0x10f9b4;}})});}_0x1852d2=_[_0xece1('0x3b')]({},_0x1852d2,_0x132870[_0xece1('0x3e')]);var _0x5a72c5={'where':_0x1852d2[_0xece1('0x38')]};return db[_0xece1('0x2b')]['count'](_0x5a72c5)['then'](function(_0x4f3992){_0x198f26[_0xece1('0x1e')]=_0x4f3992;if(_0x132870[_0xece1('0x31')][_0xece1('0x3f')]){_0x1852d2[_0xece1('0x40')]=[{'all':!![]}];}return db[_0xece1('0x2b')]['findAll'](_0x1852d2);})['then'](function(_0x277e5e){_0x198f26[_0xece1('0x41')]=_0x277e5e;return _0x198f26;})['then'](respondWithFilteredResult(_0x34799f,_0x1852d2))['catch'](handleError(_0x34799f,null));};exports[_0xece1('0x42')]=function(_0x2ce531,_0x3645bc){var _0x4b2967={'raw':![],'where':{'id':_0x2ce531[_0xece1('0x43')]['id']}},_0x23999f={};_0x23999f[_0xece1('0x2f')]=_['keys'](db[_0xece1('0x2b')][_0xece1('0x2c')]);_0x23999f[_0xece1('0x31')]=_[_0xece1('0x30')](_0x2ce531['query']);_0x23999f[_0xece1('0x32')]=_['intersection'](_0x23999f[_0xece1('0x2f')],_0x23999f[_0xece1('0x31')]);_0x4b2967['attributes']=_[_0xece1('0x33')](_0x23999f['model'],qs[_0xece1('0x34')](_0x2ce531[_0xece1('0x31')][_0xece1('0x34')]));_0x4b2967['attributes']=_0x4b2967['attributes'][_0xece1('0x44')]?_0x4b2967['attributes']:_0x23999f[_0xece1('0x2f')];if(_0x2ce531[_0xece1('0x31')][_0xece1('0x3f')]){_0x4b2967[_0xece1('0x40')]=[{'all':!![]}];}_0x4b2967=_[_0xece1('0x3b')]({},_0x4b2967,_0x2ce531['options']);return db['DeskAccount'][_0xece1('0x45')](_0x4b2967)['then'](handleEntityNotFound(_0x3645bc,null))[_0xece1('0x26')](respondWithResult(_0x3645bc,null))[_0xece1('0x46')](handleError(_0x3645bc,null));};exports[_0xece1('0x47')]=function(_0x47d8d8,_0x1f185f){return db['DeskAccount'][_0xece1('0x47')](_0x47d8d8[_0xece1('0x48')],{})['then'](respondWithResult(_0x1f185f,0xc9))[_0xece1('0x46')](handleError(_0x1f185f,null));};exports[_0xece1('0x25')]=function(_0x4a9e15,_0x28bba1){if(_0x4a9e15[_0xece1('0x48')]['id']){delete _0x4a9e15[_0xece1('0x48')]['id'];}return db[_0xece1('0x2b')]['find']({'where':{'id':_0x4a9e15[_0xece1('0x43')]['id']}})[_0xece1('0x26')](handleEntityNotFound(_0x28bba1,null))[_0xece1('0x26')](saveUpdates(_0x4a9e15[_0xece1('0x48')],null))['then'](respondWithResult(_0x28bba1,null))['catch'](handleError(_0x28bba1,null));};exports[_0xece1('0x49')]=function(_0x14d49b,_0x376ebb){return db['DeskAccount'][_0xece1('0x45')]({'where':{'id':_0x14d49b[_0xece1('0x43')]['id']}})[_0xece1('0x26')](handleEntityNotFound(_0x376ebb,null))[_0xece1('0x26')](removeEntity(_0x376ebb,null))[_0xece1('0x46')](handleError(_0x376ebb,null));};exports[_0xece1('0x4a')]=function(_0x256b1f,_0x20a7c2,_0x5ab03a){var _0x2c6565={};var _0x107000={};var _0x2cbf50;var _0x1d6b92;return db[_0xece1('0x2b')][_0xece1('0x4b')]({'where':{'id':_0x256b1f[_0xece1('0x43')]['id']}})[_0xece1('0x26')](handleEntityNotFound(_0x20a7c2,null))[_0xece1('0x26')](function(_0x787431){if(_0x787431){_0x2cbf50=_0x787431;_0x107000[_0xece1('0x2f')]=_[_0xece1('0x30')](db['DeskConfiguration']['rawAttributes']);_0x107000[_0xece1('0x31')]=_['keys'](_0x256b1f[_0xece1('0x31')]);_0x107000[_0xece1('0x32')]=_[_0xece1('0x33')](_0x107000[_0xece1('0x2f')],_0x107000[_0xece1('0x31')]);_0x2c6565[_0xece1('0x35')]=_[_0xece1('0x33')](_0x107000[_0xece1('0x2f')],qs['fields'](_0x256b1f['query']['fields']));_0x2c6565[_0xece1('0x35')]=_0x2c6565[_0xece1('0x35')][_0xece1('0x44')]?_0x2c6565[_0xece1('0x35')]:_0x107000[_0xece1('0x2f')];_0x2c6565[_0xece1('0x36')]=qs[_0xece1('0x37')](_0x256b1f[_0xece1('0x31')][_0xece1('0x37')]);_0x2c6565[_0xece1('0x38')]=qs[_0xece1('0x32')](_['pick'](_0x256b1f[_0xece1('0x31')],_0x107000['filters']));if(_0x256b1f[_0xece1('0x31')]['filter']){_0x2c6565[_0xece1('0x38')]=_[_0xece1('0x3b')](_0x2c6565[_0xece1('0x38')],{'$or':_[_0xece1('0x2a')](_0x2c6565['attributes'],function(_0x1baee2){var _0x457cda={};_0x457cda[_0x1baee2]={'$like':'%'+_0x256b1f['query'][_0xece1('0x3a')]+'%'};return _0x457cda;})});}_0x2c6565=_[_0xece1('0x3b')]({},_0x2c6565,_0x256b1f[_0xece1('0x3e')]);return _0x2cbf50[_0xece1('0x4a')](_0x2c6565);}})[_0xece1('0x26')](function(_0x2ae0b5){if(_0x2ae0b5){_0x1d6b92=_0x2ae0b5['length'];if(!_0x256b1f[_0xece1('0x31')]['hasOwnProperty']('nolimit')){_0x2c6565[_0xece1('0x1f')]=qs[_0xece1('0x1f')](_0x256b1f[_0xece1('0x31')][_0xece1('0x1f')]);_0x2c6565[_0xece1('0x1c')]=qs[_0xece1('0x1c')](_0x256b1f['query'][_0xece1('0x1c')]);}return _0x2cbf50[_0xece1('0x4a')](_0x2c6565);}})[_0xece1('0x26')](function(_0x5a831d){if(_0x5a831d){return _0x5a831d?{'count':_0x1d6b92,'rows':_0x5a831d}:null;}})[_0xece1('0x26')](respondWithResult(_0x20a7c2,null))[_0xece1('0x46')](handleError(_0x20a7c2,null));};exports[_0xece1('0x4c')]=function(_0x4038e2,_0x4b2721,_0xeba5c6){if(_0x4038e2[_0xece1('0x48')]['id']){delete _0x4038e2[_0xece1('0x48')]['id'];}return db[_0xece1('0x2b')][_0xece1('0x4b')]({'where':{'id':_0x4038e2['params']['id']}})[_0xece1('0x26')](handleEntityNotFound(_0x4b2721,null))[_0xece1('0x26')](function(_0x750b49){if(_0x750b49){_0x4038e2[_0xece1('0x48')][_0xece1('0x4d')]=_0x750b49['id'];_0x4038e2[_0xece1('0x48')][_0xece1('0x4e')]=integrations[_0xece1('0x4f')](_0x4038e2[_0xece1('0x48')]['channel'],_0x4038e2['body']['type']);_0x4038e2['body'][_0xece1('0x50')]=integrations[_0xece1('0x51')](_0x4038e2[_0xece1('0x48')][_0xece1('0x52')],_0x4038e2[_0xece1('0x48')][_0xece1('0x3c')]);return db['DeskConfiguration']['create'](_0x4038e2[_0xece1('0x48')],{'include':[{'model':db[_0xece1('0x53')],'as':_0xece1('0x4e')},{'model':db[_0xece1('0x53')],'as':_0xece1('0x50')}]});}return null;})['then'](respondWithResult(_0x4b2721,null))['catch'](handleError(_0x4b2721,null));};exports[_0xece1('0x54')]=function(_0x56ae0c,_0x5f10d2,_0x2b5fce){var _0x29415c=[{'name':_0xece1('0x55'),'label':_0xece1('0x55'),'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 _0x24103a='';return db[_0xece1('0x2b')][_0xece1('0x4b')]({'where':{'id':_0x56ae0c[_0xece1('0x43')]['id']},'attributes':['id',_0xece1('0x56'),'authType','username',_0xece1('0x57'),_0xece1('0x58'),_0xece1('0x59'),_0xece1('0x5a'),_0xece1('0x5b')]})[_0xece1('0x26')](handleEntityNotFound(_0x5f10d2,null))['then'](function(_0x2ddaaf){if(_0x2ddaaf){_0x24103a=_0x2ddaaf[_0xece1('0x56')];var _0x2e0e67=_0x24103a[_0xece1('0x5c')](-0x1);if(_0x2e0e67==='/'){_0x24103a=_0x24103a[_0xece1('0x5d')](0x0,_0x24103a[_0xece1('0x5e')](_0x2e0e67));}var _0x4d04f0={'method':_0xece1('0x5f'),'uri':util[_0xece1('0x60')]('%s/custom_fields',_0x24103a),'headers':{'Content-Type':_0xece1('0x61'),'Accept':_0xece1('0x61')},'json':!![]};if(_0x2ddaaf[_0xece1('0x62')]===_0xece1('0x63')){_0x4d04f0[_0xece1('0x64')][_0xece1('0x65')]=util[_0xece1('0x60')](_0xece1('0x66'),new Buffer(util[_0xece1('0x60')]('%s:%s',_0x2ddaaf[_0xece1('0x67')],_0x2ddaaf['password']))[_0xece1('0x68')](_0xece1('0x69')));}return rp(_0x4d04f0)['then'](function(_0x3e48a4){return _0x29415c[_0xece1('0x6a')](_[_0xece1('0x2a')](_0x3e48a4['_embedded'][_0xece1('0x6b')],function(_0xac50d3){return{'id':_0xac50d3[_0xece1('0x28')],'name':_0xac50d3['name'],'type':_0xac50d3[_0xece1('0x3c')],'active':_0xac50d3[_0xece1('0x6c')],'label':_0xac50d3[_0xece1('0x6d')],'custom':!![]};}));});}})['then'](function(_0x9d0204){return{'count':_0x9d0204[_0xece1('0x44')],'rows':_0x9d0204};})[_0xece1('0x26')](respondWithResult(_0x5f10d2,null))['catch'](function(_0x235815){var _0x39072f=_0x56ae0c[_0xece1('0x31')][_0xece1('0x6e')]?0x1f4:_0x235815[_0xece1('0x6f')]||0x1f4;logger[_0xece1('0x27')](_0xece1('0x70'),'getFields',_0x39072f,JSON[_0xece1('0x71')](_0x235815));delete _0x235815['name'];if(_0x39072f===0x191){_0x39072f=0x190;}_0x5f10d2[_0xece1('0x1a')](_0x39072f)[_0xece1('0x29')](_0x56ae0c[_0xece1('0x31')][_0xece1('0x6e')]?{'message':_0xece1('0x72'),'statusCode':_0x235815['statusCode']}:_0x235815);});}; \ No newline at end of file +var _0x9079=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','includeAll','include','catch','show','keys','merge','find','create','body','params','getConfigurations','findOne','DeskConfiguration','nolimit','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','Subjects','DeskField','getFields','priority','remoteUri','authType','username','password','slice','substring','GET','application/json','basic','headers','Authorization','format','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9079,0x6c));var _0x9907=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9079[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9907('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9907('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9907('0x2'));var moment=require(_0x9907('0x3'));var BPromise=require(_0x9907('0x4'));var Mustache=require('mustache');var util=require(_0x9907('0x5'));var path=require(_0x9907('0x6'));var sox=require('sox');var csv=require(_0x9907('0x7'));var ejs=require(_0x9907('0x8'));var fs=require('fs');var fs_extra=require(_0x9907('0x9'));var _=require(_0x9907('0xa'));var squel=require(_0x9907('0xb'));var crypto=require(_0x9907('0xc'));var jsforce=require(_0x9907('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9907('0xe'));var Papa=require(_0x9907('0xf'));var Redis=require(_0x9907('0x10'));var authService=require(_0x9907('0x11'));var qs=require(_0x9907('0x12'));var as=require(_0x9907('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9907('0x14'))(_0x9907('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9907('0x16'));var db=require(_0x9907('0x17'))['db'];var integrations=require(_0x9907('0x18'));function respondWithStatusCode(_0x3a6fe1,_0x2c9120){_0x2c9120=_0x2c9120||0xcc;return function(_0x585160){if(_0x585160){return _0x3a6fe1[_0x9907('0x19')](_0x2c9120);}return _0x3a6fe1[_0x9907('0x1a')](_0x2c9120)[_0x9907('0x1b')]();};}function respondWithResult(_0x196821,_0x3d6102){_0x3d6102=_0x3d6102||0xc8;return function(_0xdd66a){if(_0xdd66a){return _0x196821['status'](_0x3d6102)['json'](_0xdd66a);}};}function respondWithFilteredResult(_0x560bb7,_0x155028){return function(_0x277d06){if(_0x277d06){var _0x2767c7=typeof _0x155028[_0x9907('0x1c')]===_0x9907('0x1d')&&typeof _0x155028[_0x9907('0x1e')]===_0x9907('0x1d');var _0x4b6511=_0x277d06[_0x9907('0x1f')];var _0x34ef3a=_0x2767c7?0x0:_0x155028[_0x9907('0x1c')];var _0x326b65=_0x2767c7?_0x277d06[_0x9907('0x1f')]:_0x155028[_0x9907('0x1c')]+_0x155028[_0x9907('0x1e')];var _0x3907ef;if(_0x326b65>=_0x4b6511){_0x326b65=_0x4b6511;_0x3907ef=0xc8;}else{_0x3907ef=0xce;}_0x560bb7[_0x9907('0x1a')](_0x3907ef);return _0x560bb7[_0x9907('0x20')](_0x9907('0x21'),_0x34ef3a+'-'+_0x326b65+'/'+_0x4b6511)[_0x9907('0x22')](_0x277d06);}return null;};}function patchUpdates(_0x30f6cb){return function(_0x203d10){try{jsonpatch[_0x9907('0x23')](_0x203d10,_0x30f6cb,!![]);}catch(_0x5ec7ca){return BPromise[_0x9907('0x24')](_0x5ec7ca);}return _0x203d10['save']();};}function saveUpdates(_0x46cb02,_0xa9ad5a){return function(_0x390121){if(_0x390121){return _0x390121[_0x9907('0x25')](_0x46cb02)['then'](function(_0x3467ff){return _0x3467ff;});}return null;};}function removeEntity(_0x5d0c66,_0x484be0){return function(_0x4bb7e4){if(_0x4bb7e4){return _0x4bb7e4[_0x9907('0x26')]()[_0x9907('0x27')](function(){_0x5d0c66[_0x9907('0x1a')](0xcc)[_0x9907('0x1b')]();});}};}function handleEntityNotFound(_0x52a6a9,_0x2cf3e2){return function(_0x212fcf){if(!_0x212fcf){_0x52a6a9[_0x9907('0x19')](0x194);}return _0x212fcf;};}function handleError(_0x324aac,_0x35e4f0){_0x35e4f0=_0x35e4f0||0x1f4;return function(_0x554e6e){logger[_0x9907('0x28')](_0x554e6e[_0x9907('0x29')]);if(_0x554e6e[_0x9907('0x2a')]){delete _0x554e6e[_0x9907('0x2a')];}_0x324aac['status'](_0x35e4f0)[_0x9907('0x2b')](_0x554e6e);};}exports['index']=function(_0x1fae91,_0x37f763){var _0xce451c={},_0x5886f0={},_0x17bd2d={'count':0x0,'rows':[]};var _0x4f535b=_[_0x9907('0x2c')](db[_0x9907('0x2d')][_0x9907('0x2e')],function(_0x4691d0){return{'name':_0x4691d0[_0x9907('0x2f')],'type':_0x4691d0[_0x9907('0x30')][_0x9907('0x31')]};});_0x5886f0[_0x9907('0x32')]=_[_0x9907('0x2c')](_0x4f535b,_0x9907('0x2a'));_0x5886f0[_0x9907('0x33')]=_['keys'](_0x1fae91[_0x9907('0x33')]);_0x5886f0[_0x9907('0x34')]=_[_0x9907('0x35')](_0x5886f0[_0x9907('0x32')],_0x5886f0[_0x9907('0x33')]);_0xce451c[_0x9907('0x36')]=_[_0x9907('0x35')](_0x5886f0[_0x9907('0x32')],qs[_0x9907('0x37')](_0x1fae91[_0x9907('0x33')]['fields']));_0xce451c['attributes']=_0xce451c[_0x9907('0x36')][_0x9907('0x38')]?_0xce451c[_0x9907('0x36')]:_0x5886f0[_0x9907('0x32')];if(!_0x1fae91[_0x9907('0x33')][_0x9907('0x39')]('nolimit')){_0xce451c[_0x9907('0x1e')]=qs[_0x9907('0x1e')](_0x1fae91[_0x9907('0x33')][_0x9907('0x1e')]);_0xce451c[_0x9907('0x1c')]=qs[_0x9907('0x1c')](_0x1fae91[_0x9907('0x33')][_0x9907('0x1c')]);}_0xce451c[_0x9907('0x3a')]=qs[_0x9907('0x3b')](_0x1fae91[_0x9907('0x33')][_0x9907('0x3b')]);_0xce451c[_0x9907('0x3c')]=qs[_0x9907('0x34')](_[_0x9907('0x3d')](_0x1fae91['query'],_0x5886f0['filters']),_0x4f535b);if(_0x1fae91[_0x9907('0x33')][_0x9907('0x3e')]){_0xce451c['where']=_['merge'](_0xce451c['where'],{'$or':_[_0x9907('0x2c')](_0x4f535b,function(_0x5b10a7){if(_0x5b10a7[_0x9907('0x30')]!=='VIRTUAL'){var _0x3a6eeb={};_0x3a6eeb[_0x5b10a7[_0x9907('0x2a')]]={'$like':'%'+_0x1fae91['query'][_0x9907('0x3e')]+'%'};return _0x3a6eeb;}})});}_0xce451c=_['merge']({},_0xce451c,_0x1fae91[_0x9907('0x3f')]);var _0x1a90e2={'where':_0xce451c[_0x9907('0x3c')]};return db[_0x9907('0x2d')][_0x9907('0x1f')](_0x1a90e2)[_0x9907('0x27')](function(_0x4387b6){_0x17bd2d[_0x9907('0x1f')]=_0x4387b6;if(_0x1fae91[_0x9907('0x33')][_0x9907('0x40')]){_0xce451c[_0x9907('0x41')]=[{'all':!![]}];}return db[_0x9907('0x2d')]['findAll'](_0xce451c);})[_0x9907('0x27')](function(_0x62245f){_0x17bd2d['rows']=_0x62245f;return _0x17bd2d;})[_0x9907('0x27')](respondWithFilteredResult(_0x37f763,_0xce451c))[_0x9907('0x42')](handleError(_0x37f763,null));};exports[_0x9907('0x43')]=function(_0x3f2be2,_0x1618dc){var _0x28f5da={'raw':![],'where':{'id':_0x3f2be2['params']['id']}},_0x4167f3={};_0x4167f3[_0x9907('0x32')]=_[_0x9907('0x44')](db[_0x9907('0x2d')][_0x9907('0x2e')]);_0x4167f3['query']=_['keys'](_0x3f2be2[_0x9907('0x33')]);_0x4167f3[_0x9907('0x34')]=_[_0x9907('0x35')](_0x4167f3[_0x9907('0x32')],_0x4167f3[_0x9907('0x33')]);_0x28f5da[_0x9907('0x36')]=_[_0x9907('0x35')](_0x4167f3[_0x9907('0x32')],qs[_0x9907('0x37')](_0x3f2be2[_0x9907('0x33')]['fields']));_0x28f5da['attributes']=_0x28f5da[_0x9907('0x36')][_0x9907('0x38')]?_0x28f5da['attributes']:_0x4167f3['model'];if(_0x3f2be2['query'][_0x9907('0x40')]){_0x28f5da['include']=[{'all':!![]}];}_0x28f5da=_[_0x9907('0x45')]({},_0x28f5da,_0x3f2be2[_0x9907('0x3f')]);return db[_0x9907('0x2d')][_0x9907('0x46')](_0x28f5da)['then'](handleEntityNotFound(_0x1618dc,null))['then'](respondWithResult(_0x1618dc,null))[_0x9907('0x42')](handleError(_0x1618dc,null));};exports[_0x9907('0x47')]=function(_0x1dbc38,_0x5cec6c){return db[_0x9907('0x2d')]['create'](_0x1dbc38[_0x9907('0x48')],{})[_0x9907('0x27')](respondWithResult(_0x5cec6c,0xc9))[_0x9907('0x42')](handleError(_0x5cec6c,null));};exports[_0x9907('0x25')]=function(_0x7fd984,_0x45f453){if(_0x7fd984[_0x9907('0x48')]['id']){delete _0x7fd984[_0x9907('0x48')]['id'];}return db['DeskAccount']['find']({'where':{'id':_0x7fd984[_0x9907('0x49')]['id']}})[_0x9907('0x27')](handleEntityNotFound(_0x45f453,null))[_0x9907('0x27')](saveUpdates(_0x7fd984[_0x9907('0x48')],null))[_0x9907('0x27')](respondWithResult(_0x45f453,null))[_0x9907('0x42')](handleError(_0x45f453,null));};exports[_0x9907('0x26')]=function(_0x2bd30a,_0x5d062b){return db['DeskAccount'][_0x9907('0x46')]({'where':{'id':_0x2bd30a[_0x9907('0x49')]['id']}})[_0x9907('0x27')](handleEntityNotFound(_0x5d062b,null))[_0x9907('0x27')](removeEntity(_0x5d062b,null))['catch'](handleError(_0x5d062b,null));};exports[_0x9907('0x4a')]=function(_0x5686c7,_0x29e79a,_0x377205){var _0x4cb495={};var _0x5039df={};var _0x1d4cd;var _0x195f84;return db[_0x9907('0x2d')][_0x9907('0x4b')]({'where':{'id':_0x5686c7['params']['id']}})[_0x9907('0x27')](handleEntityNotFound(_0x29e79a,null))['then'](function(_0x30f46f){if(_0x30f46f){_0x1d4cd=_0x30f46f;_0x5039df['model']=_['keys'](db[_0x9907('0x4c')][_0x9907('0x2e')]);_0x5039df['query']=_['keys'](_0x5686c7['query']);_0x5039df[_0x9907('0x34')]=_[_0x9907('0x35')](_0x5039df[_0x9907('0x32')],_0x5039df[_0x9907('0x33')]);_0x4cb495[_0x9907('0x36')]=_[_0x9907('0x35')](_0x5039df['model'],qs[_0x9907('0x37')](_0x5686c7[_0x9907('0x33')][_0x9907('0x37')]));_0x4cb495[_0x9907('0x36')]=_0x4cb495[_0x9907('0x36')][_0x9907('0x38')]?_0x4cb495['attributes']:_0x5039df['model'];_0x4cb495[_0x9907('0x3a')]=qs[_0x9907('0x3b')](_0x5686c7[_0x9907('0x33')][_0x9907('0x3b')]);_0x4cb495[_0x9907('0x3c')]=qs[_0x9907('0x34')](_[_0x9907('0x3d')](_0x5686c7['query'],_0x5039df[_0x9907('0x34')]));if(_0x5686c7[_0x9907('0x33')][_0x9907('0x3e')]){_0x4cb495['where']=_[_0x9907('0x45')](_0x4cb495[_0x9907('0x3c')],{'$or':_['map'](_0x4cb495['attributes'],function(_0x23c77f){var _0x264435={};_0x264435[_0x23c77f]={'$like':'%'+_0x5686c7[_0x9907('0x33')][_0x9907('0x3e')]+'%'};return _0x264435;})});}_0x4cb495=_[_0x9907('0x45')]({},_0x4cb495,_0x5686c7['options']);return _0x1d4cd[_0x9907('0x4a')](_0x4cb495);}})['then'](function(_0x185663){if(_0x185663){_0x195f84=_0x185663[_0x9907('0x38')];if(!_0x5686c7['query'][_0x9907('0x39')](_0x9907('0x4d'))){_0x4cb495[_0x9907('0x1e')]=qs[_0x9907('0x1e')](_0x5686c7[_0x9907('0x33')][_0x9907('0x1e')]);_0x4cb495['offset']=qs[_0x9907('0x1c')](_0x5686c7['query'][_0x9907('0x1c')]);}return _0x1d4cd[_0x9907('0x4a')](_0x4cb495);}})[_0x9907('0x27')](function(_0x5f2f3a){if(_0x5f2f3a){return _0x5f2f3a?{'count':_0x195f84,'rows':_0x5f2f3a}:null;}})['then'](respondWithResult(_0x29e79a,null))[_0x9907('0x42')](handleError(_0x29e79a,null));};exports[_0x9907('0x4e')]=function(_0x38df7c,_0xb5d063,_0x4a65c5){if(_0x38df7c[_0x9907('0x48')]['id']){delete _0x38df7c[_0x9907('0x48')]['id'];}return db['DeskAccount'][_0x9907('0x4b')]({'where':{'id':_0x38df7c[_0x9907('0x49')]['id']}})[_0x9907('0x27')](handleEntityNotFound(_0xb5d063,null))[_0x9907('0x27')](function(_0x1c1e17){if(_0x1c1e17){_0x38df7c[_0x9907('0x48')][_0x9907('0x4f')]=_0x1c1e17['id'];_0x38df7c[_0x9907('0x48')]['Subjects']=integrations[_0x9907('0x50')](_0x38df7c[_0x9907('0x48')]['channel'],_0x38df7c[_0x9907('0x48')][_0x9907('0x30')]);_0x38df7c['body'][_0x9907('0x51')]=integrations[_0x9907('0x52')](_0x38df7c[_0x9907('0x48')][_0x9907('0x53')],_0x38df7c[_0x9907('0x48')]['type']);return db[_0x9907('0x4c')]['create'](_0x38df7c['body'],{'include':[{'model':db['DeskField'],'as':_0x9907('0x54')},{'model':db[_0x9907('0x55')],'as':_0x9907('0x51')}]});}return null;})[_0x9907('0x27')](respondWithResult(_0xb5d063,null))[_0x9907('0x42')](handleError(_0xb5d063,null));};exports[_0x9907('0x56')]=function(_0x49a111,_0x1199a6,_0x1188c5){var _0x1e44e2=[{'name':_0x9907('0x57'),'label':_0x9907('0x57'),'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 _0x40d6af='';return db[_0x9907('0x2d')][_0x9907('0x4b')]({'where':{'id':_0x49a111['params']['id']},'attributes':['id',_0x9907('0x58'),_0x9907('0x59'),_0x9907('0x5a'),_0x9907('0x5b'),'consumerKey','consumerSecret','token','tokenSecret']})[_0x9907('0x27')](handleEntityNotFound(_0x1199a6,null))[_0x9907('0x27')](function(_0xf95d0e){if(_0xf95d0e){_0x40d6af=_0xf95d0e[_0x9907('0x58')];var _0x465675=_0x40d6af[_0x9907('0x5c')](-0x1);if(_0x465675==='/'){_0x40d6af=_0x40d6af[_0x9907('0x5d')](0x0,_0x40d6af['lastIndexOf'](_0x465675));}var _0x161adf={'method':_0x9907('0x5e'),'uri':util['format']('%s/custom_fields',_0x40d6af),'headers':{'Content-Type':_0x9907('0x5f'),'Accept':'application/json'},'json':!![]};if(_0xf95d0e[_0x9907('0x59')]===_0x9907('0x60')){_0x161adf[_0x9907('0x61')][_0x9907('0x62')]=util[_0x9907('0x63')](_0x9907('0x64'),new Buffer(util[_0x9907('0x63')](_0x9907('0x65'),_0xf95d0e[_0x9907('0x5a')],_0xf95d0e[_0x9907('0x5b')]))[_0x9907('0x66')](_0x9907('0x67')));}return rp(_0x161adf)['then'](function(_0x1a5178){return _0x1e44e2[_0x9907('0x68')](_[_0x9907('0x2c')](_0x1a5178[_0x9907('0x69')][_0x9907('0x6a')],function(_0x3defd5){return{'id':_0x3defd5[_0x9907('0x2a')],'name':_0x3defd5[_0x9907('0x2a')],'type':_0x3defd5[_0x9907('0x30')],'active':_0x3defd5[_0x9907('0x6b')],'label':_0x3defd5[_0x9907('0x6c')],'custom':!![]};}));});}})[_0x9907('0x27')](function(_0x500e2a){return{'count':_0x500e2a[_0x9907('0x38')],'rows':_0x500e2a};})[_0x9907('0x27')](respondWithResult(_0x1199a6,null))[_0x9907('0x42')](function(_0x50c6d0){var _0xf17977=_0x49a111['query']['test']?0x1f4:_0x50c6d0[_0x9907('0x6d')]||0x1f4;logger[_0x9907('0x28')](_0x9907('0x6e'),'getFields',_0xf17977,JSON[_0x9907('0x6f')](_0x50c6d0));delete _0x50c6d0[_0x9907('0x2a')];if(_0xf17977===0x191){_0xf17977=0x190;}_0x1199a6[_0x9907('0x1a')](_0xf17977)[_0x9907('0x2b')](_0x49a111[_0x9907('0x33')][_0x9907('0x70')]?{'message':_0x9907('0x71'),'statusCode':_0x50c6d0[_0x9907('0x6d')]}:_0x50c6d0);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 859e12a..a7d11eb 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 _0x98b3=['exports','define','int_desk_accounts','lodash','util','moment','bluebird','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0xd9a192,_0x410226){var _0x2f9fce=function(_0x25555a){while(--_0x25555a){_0xd9a192['push'](_0xd9a192['shift']());}};_0x2f9fce(++_0x410226);}(_0x98b3,0xf5));var _0x398b=function(_0x51ccd3,_0x209d76){_0x51ccd3=_0x51ccd3-0x0;var _0x32196d=_0x98b3[_0x51ccd3];return _0x32196d;};'use strict';var _=require(_0x398b('0x0'));var util=require(_0x398b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x398b('0x2'));var BPromise=require(_0x398b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x398b('0x4'));var config=require(_0x398b('0x5'));var attributes=require(_0x398b('0x6'));var integrations=require(_0x398b('0x7'));module[_0x398b('0x8')]=function(_0x8167b3,_0x59e701){return _0x8167b3[_0x398b('0x9')]('DeskAccount',attributes,{'tableName':_0x398b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a9b=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','int_desk_accounts','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x34b734,_0x3a7d2d){var _0x325008=function(_0x5b3140){while(--_0x5b3140){_0x34b734['push'](_0x34b734['shift']());}};_0x325008(++_0x3a7d2d);}(_0x2a9b,0xdd));var _0xb2a9=function(_0x39729d,_0x4f9219){_0x39729d=_0x39729d-0x0;var _0xa69d9d=_0x2a9b[_0x39729d];return _0xa69d9d;};'use strict';var _=require('lodash');var util=require(_0xb2a9('0x0'));var logger=require(_0xb2a9('0x1'))(_0xb2a9('0x2'));var moment=require(_0xb2a9('0x3'));var BPromise=require(_0xb2a9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2a9('0x5'));var rimraf=require(_0xb2a9('0x6'));var config=require(_0xb2a9('0x7'));var attributes=require(_0xb2a9('0x8'));var integrations=require(_0xb2a9('0x9'));module[_0xb2a9('0xa')]=function(_0x448e44,_0x523679){return _0x448e44['define']('DeskAccount',attributes,{'tableName':_0xb2a9('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 13084c0..9d56303 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 _0x394d=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','options','where','attributes','include','model','map','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4b5d8b,_0x5a4718){var _0x4bf7eb=function(_0x1746c1){while(--_0x1746c1){_0x4b5d8b['push'](_0x4b5d8b['shift']());}};_0x4bf7eb(++_0x5a4718);}(_0x394d,0x133));var _0xd394=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x394d[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xd394('0x0'));var util=require(_0xd394('0x1'));var moment=require(_0xd394('0x2'));var BPromise=require(_0xd394('0x3'));var rs=require(_0xd394('0x4'));var fs=require('fs');var Redis=require(_0xd394('0x5'));var db=require(_0xd394('0x6'))['db'];var utils=require(_0xd394('0x7'));var logger=require('../../config/logger')(_0xd394('0x8'));var config=require(_0xd394('0x9'));var jayson=require(_0xd394('0xa'));var client=jayson[_0xd394('0xb')][_0xd394('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d279f,_0x3b5329,_0x4a0bf4){return new BPromise(function(_0x354e39,_0x5da730){return client['request'](_0x2d279f,_0x4a0bf4)[_0xd394('0xd')](function(_0x1b267f){logger[_0xd394('0xe')]('DeskAccount,\x20%s,\x20%s',_0x3b5329,_0xd394('0xf'));logger[_0xd394('0x10')](_0xd394('0x11'),_0x3b5329,_0xd394('0xf'),JSON[_0xd394('0x12')](_0x1b267f));if(_0x1b267f[_0xd394('0x13')]){if(_0x1b267f[_0xd394('0x13')][_0xd394('0x14')]===0x1f4){logger[_0xd394('0x13')](_0xd394('0x15'),_0x3b5329,_0x1b267f[_0xd394('0x13')][_0xd394('0x16')]);return _0x5da730(_0x1b267f[_0xd394('0x13')][_0xd394('0x16')]);}logger[_0xd394('0x13')](_0xd394('0x15'),_0x3b5329,_0x1b267f['error'][_0xd394('0x16')]);return _0x354e39(_0x1b267f[_0xd394('0x13')][_0xd394('0x16')]);}else{logger[_0xd394('0xe')](_0xd394('0x15'),_0x3b5329,_0xd394('0xf'));_0x354e39(_0x1b267f[_0xd394('0x17')][_0xd394('0x16')]);}})[_0xd394('0x18')](function(_0x55ed29){logger['error']('DeskAccount,\x20%s,\x20%s',_0x3b5329,_0x55ed29);_0x5da730(_0x55ed29);});});}exports[_0xd394('0x19')]=function(_0x14351c){var _0x197804=this;return new Promise(function(_0x2f0a6f,_0x4b803b){return db[_0xd394('0x1a')]['findAll']({'raw':_0x14351c[_0xd394('0x1b')]?_0x14351c['options']['raw']===undefined?!![]:![]:!![],'where':_0x14351c['options']?_0x14351c[_0xd394('0x1b')][_0xd394('0x1c')]||null:null,'attributes':_0x14351c[_0xd394('0x1b')]?_0x14351c[_0xd394('0x1b')][_0xd394('0x1d')]||null:null,'limit':_0x14351c[_0xd394('0x1b')]?_0x14351c[_0xd394('0x1b')]['limit']||null:null,'include':_0x14351c[_0xd394('0x1b')]?_0x14351c[_0xd394('0x1b')][_0xd394('0x1e')]?_['map'](_0x14351c[_0xd394('0x1b')][_0xd394('0x1e')],function(_0x467f64){return{'model':db[_0x467f64['model']],'as':_0x467f64['as'],'attributes':_0x467f64['attributes'],'include':_0x467f64[_0xd394('0x1e')]?_['map'](_0x467f64[_0xd394('0x1e')],function(_0x29b474){return{'model':db[_0x29b474[_0xd394('0x1f')]],'as':_0x29b474['as'],'attributes':_0x29b474[_0xd394('0x1d')],'include':_0x29b474[_0xd394('0x1e')]?_[_0xd394('0x20')](_0x29b474[_0xd394('0x1e')],function(_0x58d20c){return{'model':db[_0x58d20c[_0xd394('0x1f')]],'as':_0x58d20c['as'],'attributes':_0x58d20c['attributes']};}):[]};}):[]};}):[]:[]})[_0xd394('0xd')](function(_0x1b304c){logger['info'](_0xd394('0x19'),_0x14351c);logger['debug'](_0xd394('0x19'),_0x14351c,JSON[_0xd394('0x12')](_0x1b304c));_0x2f0a6f(_0x1b304c);})['catch'](function(_0x47088a){logger['error'](_0xd394('0x19'),_0x47088a['message'],_0x14351c);_0x4b803b(_0x197804['error'](0x1f4,_0x47088a['message']));});});};exports[_0xd394('0x21')]=function(_0x2d7349){var _0x3e4bd6=this;return new Promise(function(_0x262aac,_0x24899a){return db[_0xd394('0x1a')][_0xd394('0x22')]({'raw':_0x2d7349[_0xd394('0x1b')]?_0x2d7349['options']['raw']===undefined?!![]:![]:!![],'where':_0x2d7349['options']?_0x2d7349[_0xd394('0x1b')][_0xd394('0x1c')]||null:null,'attributes':_0x2d7349[_0xd394('0x1b')]?_0x2d7349[_0xd394('0x1b')][_0xd394('0x1d')]||null:null,'include':_0x2d7349[_0xd394('0x1b')]?_0x2d7349[_0xd394('0x1b')]['include']?_[_0xd394('0x20')](_0x2d7349[_0xd394('0x1b')][_0xd394('0x1e')],function(_0x3c882d){return{'model':db[_0x3c882d[_0xd394('0x1f')]],'as':_0x3c882d['as'],'attributes':_0x3c882d['attributes'],'include':_0x3c882d[_0xd394('0x1e')]?_[_0xd394('0x20')](_0x3c882d[_0xd394('0x1e')],function(_0x25fb94){return{'model':db[_0x25fb94[_0xd394('0x1f')]],'as':_0x25fb94['as'],'attributes':_0x25fb94[_0xd394('0x1d')],'include':_0x25fb94['include']?_['map'](_0x25fb94[_0xd394('0x1e')],function(_0x403e78){return{'model':db[_0x403e78['model']],'as':_0x403e78['as'],'attributes':_0x403e78[_0xd394('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd394('0xd')](function(_0x40f16e){logger[_0xd394('0xe')]('ShowDeskAccount',_0x2d7349);logger[_0xd394('0x10')](_0xd394('0x21'),_0x2d7349,JSON[_0xd394('0x12')](_0x40f16e));_0x262aac(_0x40f16e);})['catch'](function(_0x181e96){logger[_0xd394('0x13')](_0xd394('0x21'),_0x181e96['message'],_0x2d7349);_0x24899a(_0x3e4bd6[_0xd394('0x13')](0x1f4,_0x181e96[_0xd394('0x16')]));});});}; \ No newline at end of file +var _0xeebc=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options','where','attributes','include','map','model','then','GetDeskAccount','debug','DeskAccount','find','raw','ShowDeskAccount','lodash','util','moment','bluebird','randomstring'];(function(_0x1aa660,_0x55cfcf){var _0x56b6f5=function(_0x54d875){while(--_0x54d875){_0x1aa660['push'](_0x1aa660['shift']());}};_0x56b6f5(++_0x55cfcf);}(_0xeebc,0x163));var _0xceeb=function(_0x47fb0c,_0x6ca079){_0x47fb0c=_0x47fb0c-0x0;var _0x317c6e=_0xeebc[_0x47fb0c];return _0x317c6e;};'use strict';var _=require(_0xceeb('0x0'));var util=require(_0xceeb('0x1'));var moment=require(_0xceeb('0x2'));var BPromise=require(_0xceeb('0x3'));var rs=require(_0xceeb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xceeb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xceeb('0x6'))(_0xceeb('0x7'));var config=require(_0xceeb('0x8'));var jayson=require(_0xceeb('0x9'));var client=jayson[_0xceeb('0xa')][_0xceeb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46ce82,_0x4d4408,_0x4fb4a5){return new BPromise(function(_0x9d55b1,_0x50c344){return client[_0xceeb('0xc')](_0x46ce82,_0x4fb4a5)['then'](function(_0x2a2129){logger[_0xceeb('0xd')](_0xceeb('0xe'),_0x4d4408,_0xceeb('0xf'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x4d4408,_0xceeb('0xf'),JSON[_0xceeb('0x10')](_0x2a2129));if(_0x2a2129[_0xceeb('0x11')]){if(_0x2a2129['error'][_0xceeb('0x12')]===0x1f4){logger[_0xceeb('0x11')](_0xceeb('0xe'),_0x4d4408,_0x2a2129[_0xceeb('0x11')][_0xceeb('0x13')]);return _0x50c344(_0x2a2129['error'][_0xceeb('0x13')]);}logger[_0xceeb('0x11')](_0xceeb('0xe'),_0x4d4408,_0x2a2129[_0xceeb('0x11')][_0xceeb('0x13')]);return _0x9d55b1(_0x2a2129[_0xceeb('0x11')][_0xceeb('0x13')]);}else{logger[_0xceeb('0xd')](_0xceeb('0xe'),_0x4d4408,_0xceeb('0xf'));_0x9d55b1(_0x2a2129[_0xceeb('0x14')][_0xceeb('0x13')]);}})[_0xceeb('0x15')](function(_0x2f1079){logger[_0xceeb('0x11')](_0xceeb('0xe'),_0x4d4408,_0x2f1079);_0x50c344(_0x2f1079);});});}exports['GetDeskAccount']=function(_0x197f07){var _0x2e7fb4=this;return new Promise(function(_0x2576f2,_0x3d41bf){return db['DeskAccount'][_0xceeb('0x16')]({'raw':_0x197f07[_0xceeb('0x17')]?_0x197f07[_0xceeb('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x197f07['options']?_0x197f07['options'][_0xceeb('0x18')]||null:null,'attributes':_0x197f07[_0xceeb('0x17')]?_0x197f07[_0xceeb('0x17')][_0xceeb('0x19')]||null:null,'limit':_0x197f07[_0xceeb('0x17')]?_0x197f07[_0xceeb('0x17')]['limit']||null:null,'include':_0x197f07[_0xceeb('0x17')]?_0x197f07[_0xceeb('0x17')][_0xceeb('0x1a')]?_[_0xceeb('0x1b')](_0x197f07[_0xceeb('0x17')][_0xceeb('0x1a')],function(_0x36e0ed){return{'model':db[_0x36e0ed[_0xceeb('0x1c')]],'as':_0x36e0ed['as'],'attributes':_0x36e0ed[_0xceeb('0x19')],'include':_0x36e0ed['include']?_[_0xceeb('0x1b')](_0x36e0ed[_0xceeb('0x1a')],function(_0x29ab62){return{'model':db[_0x29ab62[_0xceeb('0x1c')]],'as':_0x29ab62['as'],'attributes':_0x29ab62[_0xceeb('0x19')],'include':_0x29ab62[_0xceeb('0x1a')]?_['map'](_0x29ab62[_0xceeb('0x1a')],function(_0x30dec7){return{'model':db[_0x30dec7[_0xceeb('0x1c')]],'as':_0x30dec7['as'],'attributes':_0x30dec7[_0xceeb('0x19')]};}):[]};}):[]};}):[]:[]})[_0xceeb('0x1d')](function(_0x58b403){logger['info'](_0xceeb('0x1e'),_0x197f07);logger[_0xceeb('0x1f')](_0xceeb('0x1e'),_0x197f07,JSON['stringify'](_0x58b403));_0x2576f2(_0x58b403);})[_0xceeb('0x15')](function(_0x29591b){logger[_0xceeb('0x11')](_0xceeb('0x1e'),_0x29591b[_0xceeb('0x13')],_0x197f07);_0x3d41bf(_0x2e7fb4['error'](0x1f4,_0x29591b[_0xceeb('0x13')]));});});};exports['ShowDeskAccount']=function(_0x5b68e6){var _0x4f1cbd=this;return new Promise(function(_0x4ec532,_0x27e50a){return db[_0xceeb('0x20')][_0xceeb('0x21')]({'raw':_0x5b68e6[_0xceeb('0x17')]?_0x5b68e6[_0xceeb('0x17')][_0xceeb('0x22')]===undefined?!![]:![]:!![],'where':_0x5b68e6[_0xceeb('0x17')]?_0x5b68e6[_0xceeb('0x17')][_0xceeb('0x18')]||null:null,'attributes':_0x5b68e6['options']?_0x5b68e6[_0xceeb('0x17')][_0xceeb('0x19')]||null:null,'include':_0x5b68e6[_0xceeb('0x17')]?_0x5b68e6[_0xceeb('0x17')][_0xceeb('0x1a')]?_['map'](_0x5b68e6['options'][_0xceeb('0x1a')],function(_0x591ac2){return{'model':db[_0x591ac2[_0xceeb('0x1c')]],'as':_0x591ac2['as'],'attributes':_0x591ac2[_0xceeb('0x19')],'include':_0x591ac2['include']?_[_0xceeb('0x1b')](_0x591ac2[_0xceeb('0x1a')],function(_0x184769){return{'model':db[_0x184769['model']],'as':_0x184769['as'],'attributes':_0x184769[_0xceeb('0x19')],'include':_0x184769[_0xceeb('0x1a')]?_[_0xceeb('0x1b')](_0x184769[_0xceeb('0x1a')],function(_0x4e93b1){return{'model':db[_0x4e93b1[_0xceeb('0x1c')]],'as':_0x4e93b1['as'],'attributes':_0x4e93b1['attributes']};}):[]};}):[]};}):[]:[]})[_0xceeb('0x1d')](function(_0x803aff){logger['info']('ShowDeskAccount',_0x5b68e6);logger[_0xceeb('0x1f')](_0xceeb('0x23'),_0x5b68e6,JSON[_0xceeb('0x10')](_0x803aff));_0x4ec532(_0x803aff);})[_0xceeb('0x15')](function(_0x4d571a){logger['error']('ShowDeskAccount',_0x4d571a[_0xceeb('0x13')],_0x5b68e6);_0x27e50a(_0x4f1cbd[_0xceeb('0x11')](0x1f4,_0x4d571a['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 102de91..3390aeb 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 _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x37b1d8,_0x614312){var _0x3739e7=function(_0x15a5bb){while(--_0x15a5bb){_0x37b1d8['push'](_0x37b1d8['shift']());}};_0x3739e7(++_0x614312);}(_0x55ca,0x126));var _0xa55c=function(_0x5d23be,_0x3b4f3c){_0x5d23be=_0x5d23be-0x0;var _0x4d60a9=_0x55ca[_0x5d23be];return _0x4d60a9;};'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['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);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['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x530fca,_0x1617e6){var _0x59182b=function(_0x27e065){while(--_0x27e065){_0x530fca['push'](_0x530fca['shift']());}};_0x59182b(++_0x1617e6);}(_0x3e74,0x175));var _0x43e7=function(_0x1e01c4,_0x180d5f){_0x1e01c4=_0x1e01c4-0x0;var _0x122333=_0x3e74[_0x1e01c4];return _0x122333;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 09be236..e8c7f6a 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 _0x0f11=['sequelize','exports'];(function(_0xbe4f82,_0x31bdce){var _0x4e55fc=function(_0x1473d0){while(--_0x1473d0){_0xbe4f82['push'](_0xbe4f82['shift']());}};_0x4e55fc(++_0x31bdce);}(_0x0f11,0x7e));var _0x10f1=function(_0x3cc685,_0x46f70e){_0x3cc685=_0x3cc685-0x0;var _0x36c532=_0x0f11[_0x3cc685];return _0x36c532;};'use strict';var Sequelize=require(_0x10f1('0x0'));module[_0x10f1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5085=['STRING','exports'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x5085,0x10d));var _0x5508=function(_0x37bad3,_0x149cd9){_0x37bad3=_0x37bad3-0x0;var _0x3b7440=_0x5085[_0x37bad3];return _0x3b7440;};'use strict';var Sequelize=require('sequelize');module[_0x5508('0x0')]={'name':{'type':Sequelize[_0x5508('0x1')]},'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 65b99b1..1e79037 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 _0x58f2=['rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','destroy','DeskField','getFields','getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','sendStatus','error','name','send','map','DeskConfiguration'];(function(_0x24822c,_0x3c6311){var _0x2a48ac=function(_0x528bd4){while(--_0x528bd4){_0x24822c['push'](_0x24822c['shift']());}};_0x2a48ac(++_0x3c6311);}(_0x58f2,0x1b8));var _0x258f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x58f2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x258f('0x0'));var rimraf=require(_0x258f('0x1'));var zipdir=require(_0x258f('0x2'));var jsonpatch=require(_0x258f('0x3'));var rp=require(_0x258f('0x4'));var moment=require(_0x258f('0x5'));var BPromise=require(_0x258f('0x6'));var Mustache=require('mustache');var util=require(_0x258f('0x7'));var path=require(_0x258f('0x8'));var sox=require(_0x258f('0x9'));var csv=require(_0x258f('0xa'));var ejs=require(_0x258f('0xb'));var fs=require('fs');var fs_extra=require(_0x258f('0xc'));var _=require('lodash');var squel=require(_0x258f('0xd'));var crypto=require(_0x258f('0xe'));var jsforce=require(_0x258f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x258f('0xa'));var querystring=require(_0x258f('0x10'));var Papa=require(_0x258f('0x11'));var Redis=require(_0x258f('0x12'));var authService=require(_0x258f('0x13'));var qs=require(_0x258f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x258f('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x258f('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x564cfa,_0x270fd2){_0x270fd2=_0x270fd2||0xcc;return function(_0x536902){if(_0x536902){return _0x564cfa['sendStatus'](_0x270fd2);}return _0x564cfa[_0x258f('0x17')](_0x270fd2)[_0x258f('0x18')]();};}function respondWithResult(_0x107ee5,_0x1af97f){_0x1af97f=_0x1af97f||0xc8;return function(_0x4dfef4){if(_0x4dfef4){return _0x107ee5[_0x258f('0x17')](_0x1af97f)[_0x258f('0x19')](_0x4dfef4);}};}function respondWithFilteredResult(_0x3db47a,_0x223c33){return function(_0x3fe1d8){if(_0x3fe1d8){var _0x1f9809=typeof _0x223c33[_0x258f('0x1a')]===_0x258f('0x1b')&&typeof _0x223c33[_0x258f('0x1c')]==='undefined';var _0xe81fe4=_0x3fe1d8[_0x258f('0x1d')];var _0x387d51=_0x1f9809?0x0:_0x223c33['offset'];var _0x492b7a=_0x1f9809?_0x3fe1d8[_0x258f('0x1d')]:_0x223c33[_0x258f('0x1a')]+_0x223c33['limit'];var _0x397801;if(_0x492b7a>=_0xe81fe4){_0x492b7a=_0xe81fe4;_0x397801=0xc8;}else{_0x397801=0xce;}_0x3db47a[_0x258f('0x17')](_0x397801);return _0x3db47a['set'](_0x258f('0x1e'),_0x387d51+'-'+_0x492b7a+'/'+_0xe81fe4)['json'](_0x3fe1d8);}return null;};}function patchUpdates(_0x2320f2){return function(_0x2cb0f9){try{jsonpatch['apply'](_0x2cb0f9,_0x2320f2,!![]);}catch(_0x565bc8){return BPromise[_0x258f('0x1f')](_0x565bc8);}return _0x2cb0f9['save']();};}function saveUpdates(_0x11143c,_0x18d3c1){return function(_0x110110){if(_0x110110){return _0x110110[_0x258f('0x20')](_0x11143c)[_0x258f('0x21')](function(_0x4d41af){return _0x4d41af;});}return null;};}function removeEntity(_0x57121e,_0x405d00){return function(_0x2a952e){if(_0x2a952e){return _0x2a952e['destroy']()[_0x258f('0x21')](function(){_0x57121e[_0x258f('0x17')](0xcc)[_0x258f('0x18')]();});}};}function handleEntityNotFound(_0x51115a,_0x5b28bc){return function(_0x4ceb9e){if(!_0x4ceb9e){_0x51115a[_0x258f('0x22')](0x194);}return _0x4ceb9e;};}function handleError(_0x1f940b,_0x3c4277){_0x3c4277=_0x3c4277||0x1f4;return function(_0x131b4a){logger[_0x258f('0x23')](_0x131b4a['stack']);if(_0x131b4a[_0x258f('0x24')]){delete _0x131b4a[_0x258f('0x24')];}_0x1f940b['status'](_0x3c4277)[_0x258f('0x25')](_0x131b4a);};}exports['index']=function(_0x2c7a89,_0x3c08b0){var _0x449c4a={},_0x2b9102={},_0x5aef5a={'count':0x0,'rows':[]};var _0x55c59d=_[_0x258f('0x26')](db[_0x258f('0x27')][_0x258f('0x28')],function(_0x76427e){return{'name':_0x76427e[_0x258f('0x29')],'type':_0x76427e[_0x258f('0x2a')][_0x258f('0x2b')]};});_0x2b9102[_0x258f('0x2c')]=_[_0x258f('0x26')](_0x55c59d,'name');_0x2b9102['query']=_['keys'](_0x2c7a89[_0x258f('0x2d')]);_0x2b9102[_0x258f('0x2e')]=_[_0x258f('0x2f')](_0x2b9102['model'],_0x2b9102[_0x258f('0x2d')]);_0x449c4a[_0x258f('0x30')]=_[_0x258f('0x2f')](_0x2b9102[_0x258f('0x2c')],qs['fields'](_0x2c7a89['query'][_0x258f('0x31')]));_0x449c4a[_0x258f('0x30')]=_0x449c4a[_0x258f('0x30')][_0x258f('0x32')]?_0x449c4a[_0x258f('0x30')]:_0x2b9102['model'];if(!_0x2c7a89[_0x258f('0x2d')][_0x258f('0x33')](_0x258f('0x34'))){_0x449c4a[_0x258f('0x1c')]=qs['limit'](_0x2c7a89['query'][_0x258f('0x1c')]);_0x449c4a[_0x258f('0x1a')]=qs[_0x258f('0x1a')](_0x2c7a89['query']['offset']);}_0x449c4a[_0x258f('0x35')]=qs[_0x258f('0x36')](_0x2c7a89['query']['sort']);_0x449c4a[_0x258f('0x37')]=qs['filters'](_[_0x258f('0x38')](_0x2c7a89[_0x258f('0x2d')],_0x2b9102[_0x258f('0x2e')]),_0x55c59d);if(_0x2c7a89['query'][_0x258f('0x39')]){_0x449c4a[_0x258f('0x37')]=_[_0x258f('0x3a')](_0x449c4a['where'],{'$or':_[_0x258f('0x26')](_0x55c59d,function(_0x52ff96){if(_0x52ff96['type']!==_0x258f('0x3b')){var _0x57250c={};_0x57250c[_0x52ff96[_0x258f('0x24')]]={'$like':'%'+_0x2c7a89[_0x258f('0x2d')][_0x258f('0x39')]+'%'};return _0x57250c;}})});}_0x449c4a=_['merge']({},_0x449c4a,_0x2c7a89[_0x258f('0x3c')]);var _0x3531e5={'where':_0x449c4a['where']};return db[_0x258f('0x27')][_0x258f('0x1d')](_0x3531e5)[_0x258f('0x21')](function(_0x20d8b5){_0x5aef5a[_0x258f('0x1d')]=_0x20d8b5;if(_0x2c7a89[_0x258f('0x2d')][_0x258f('0x3d')]){_0x449c4a[_0x258f('0x3e')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x258f('0x3f')](_0x449c4a);})[_0x258f('0x21')](function(_0x55b081){_0x5aef5a['rows']=_0x55b081;return _0x5aef5a;})[_0x258f('0x21')](respondWithFilteredResult(_0x3c08b0,_0x449c4a))[_0x258f('0x40')](handleError(_0x3c08b0,null));};exports[_0x258f('0x41')]=function(_0x5b1764,_0x571563){var _0x13be9b={'raw':![],'where':{'id':_0x5b1764[_0x258f('0x42')]['id']}},_0x68cd70={};_0x68cd70[_0x258f('0x2c')]=_[_0x258f('0x43')](db[_0x258f('0x27')]['rawAttributes']);_0x68cd70[_0x258f('0x2d')]=_[_0x258f('0x43')](_0x5b1764[_0x258f('0x2d')]);_0x68cd70[_0x258f('0x2e')]=_['intersection'](_0x68cd70[_0x258f('0x2c')],_0x68cd70['query']);_0x13be9b['attributes']=_['intersection'](_0x68cd70[_0x258f('0x2c')],qs['fields'](_0x5b1764[_0x258f('0x2d')][_0x258f('0x31')]));_0x13be9b[_0x258f('0x30')]=_0x13be9b['attributes']['length']?_0x13be9b['attributes']:_0x68cd70[_0x258f('0x2c')];if(_0x5b1764[_0x258f('0x2d')][_0x258f('0x3d')]){_0x13be9b[_0x258f('0x3e')]=[{'all':!![]}];}_0x13be9b=_['merge']({},_0x13be9b,_0x5b1764[_0x258f('0x3c')]);return db['DeskConfiguration'][_0x258f('0x44')](_0x13be9b)[_0x258f('0x21')](handleEntityNotFound(_0x571563,null))['then'](respondWithResult(_0x571563,null))['catch'](handleError(_0x571563,null));};exports[_0x258f('0x45')]=function(_0x2908d0,_0xc705b7){return db['DeskConfiguration'][_0x258f('0x45')](_0x2908d0[_0x258f('0x46')],{})[_0x258f('0x21')](respondWithResult(_0xc705b7,0xc9))[_0x258f('0x40')](handleError(_0xc705b7,null));};exports[_0x258f('0x20')]=function(_0x190a95,_0x3733b2){if(_0x190a95[_0x258f('0x46')]['id']){delete _0x190a95[_0x258f('0x46')]['id'];}return db['DeskConfiguration'][_0x258f('0x44')]({'where':{'id':_0x190a95['params']['id']}})[_0x258f('0x21')](handleEntityNotFound(_0x3733b2,null))[_0x258f('0x21')](saveUpdates(_0x190a95[_0x258f('0x46')],null))[_0x258f('0x21')](respondWithResult(_0x3733b2,null))[_0x258f('0x40')](handleError(_0x3733b2,null));};exports[_0x258f('0x47')]=function(_0x3cffd9,_0x124ff9){return db[_0x258f('0x27')][_0x258f('0x44')]({'where':{'id':_0x3cffd9[_0x258f('0x42')]['id']}})['then'](handleEntityNotFound(_0x124ff9,null))[_0x258f('0x21')](removeEntity(_0x124ff9,null))[_0x258f('0x40')](handleError(_0x124ff9,null));};exports['getFields']=function(_0x4c5578,_0x1f3209,_0x5fb374){var _0x4fc051={};var _0x4c3945={};var _0x236c02;var _0x52f86e;return db['DeskConfiguration']['findOne']({'where':{'id':_0x4c5578[_0x258f('0x42')]['id']}})[_0x258f('0x21')](handleEntityNotFound(_0x1f3209,null))[_0x258f('0x21')](function(_0x518215){if(_0x518215){_0x236c02=_0x518215;_0x4c3945['model']=_[_0x258f('0x43')](db[_0x258f('0x48')]['rawAttributes']);_0x4c3945[_0x258f('0x2d')]=_[_0x258f('0x43')](_0x4c5578[_0x258f('0x2d')]);_0x4c3945[_0x258f('0x2e')]=_[_0x258f('0x2f')](_0x4c3945['model'],_0x4c3945[_0x258f('0x2d')]);_0x4fc051['attributes']=_[_0x258f('0x2f')](_0x4c3945[_0x258f('0x2c')],qs['fields'](_0x4c5578[_0x258f('0x2d')][_0x258f('0x31')]));_0x4fc051[_0x258f('0x30')]=_0x4fc051['attributes'][_0x258f('0x32')]?_0x4fc051[_0x258f('0x30')]:_0x4c3945[_0x258f('0x2c')];_0x4fc051['order']=qs['sort'](_0x4c5578[_0x258f('0x2d')][_0x258f('0x36')]);_0x4fc051[_0x258f('0x37')]=qs[_0x258f('0x2e')](_['pick'](_0x4c5578['query'],_0x4c3945[_0x258f('0x2e')]));if(_0x4c5578[_0x258f('0x2d')][_0x258f('0x39')]){_0x4fc051[_0x258f('0x37')]=_[_0x258f('0x3a')](_0x4fc051[_0x258f('0x37')],{'$or':_[_0x258f('0x26')](_0x4fc051[_0x258f('0x30')],function(_0x380c85){var _0x1bd29b={};_0x1bd29b[_0x380c85]={'$like':'%'+_0x4c5578[_0x258f('0x2d')]['filter']+'%'};return _0x1bd29b;})});}_0x4fc051=_[_0x258f('0x3a')]({},_0x4fc051,_0x4c5578['options']);return _0x236c02[_0x258f('0x49')](_0x4fc051);}})[_0x258f('0x21')](function(_0x5d14f9){if(_0x5d14f9){_0x52f86e=_0x5d14f9[_0x258f('0x32')];if(!_0x4c5578[_0x258f('0x2d')][_0x258f('0x33')]('nolimit')){_0x4fc051[_0x258f('0x1c')]=qs[_0x258f('0x1c')](_0x4c5578['query'][_0x258f('0x1c')]);_0x4fc051['offset']=qs[_0x258f('0x1a')](_0x4c5578[_0x258f('0x2d')][_0x258f('0x1a')]);}return _0x236c02['getFields'](_0x4fc051);}})[_0x258f('0x21')](function(_0x1e72cf){if(_0x1e72cf){return _0x1e72cf?{'count':_0x52f86e,'rows':_0x1e72cf}:null;}})[_0x258f('0x21')](respondWithResult(_0x1f3209,null))[_0x258f('0x40')](handleError(_0x1f3209,null));};exports[_0x258f('0x4a')]=function(_0x2c66f7,_0x179cd4,_0x5040ad){var _0x5a5116={};var _0xbc62cc={};var _0x31bf85;var _0x13573a;return db[_0x258f('0x27')][_0x258f('0x4b')]({'where':{'id':_0x2c66f7['params']['id']}})[_0x258f('0x21')](handleEntityNotFound(_0x179cd4,null))[_0x258f('0x21')](function(_0x2a3071){if(_0x2a3071){_0x31bf85=_0x2a3071;_0xbc62cc['model']=_[_0x258f('0x43')](db[_0x258f('0x48')][_0x258f('0x28')]);_0xbc62cc[_0x258f('0x2d')]=_['keys'](_0x2c66f7[_0x258f('0x2d')]);_0xbc62cc[_0x258f('0x2e')]=_[_0x258f('0x2f')](_0xbc62cc[_0x258f('0x2c')],_0xbc62cc['query']);_0x5a5116[_0x258f('0x30')]=_['intersection'](_0xbc62cc[_0x258f('0x2c')],qs[_0x258f('0x31')](_0x2c66f7[_0x258f('0x2d')]['fields']));_0x5a5116[_0x258f('0x30')]=_0x5a5116[_0x258f('0x30')][_0x258f('0x32')]?_0x5a5116[_0x258f('0x30')]:_0xbc62cc[_0x258f('0x2c')];_0x5a5116[_0x258f('0x35')]=qs[_0x258f('0x36')](_0x2c66f7[_0x258f('0x2d')][_0x258f('0x36')]);_0x5a5116[_0x258f('0x37')]=qs[_0x258f('0x2e')](_[_0x258f('0x38')](_0x2c66f7[_0x258f('0x2d')],_0xbc62cc['filters']));if(_0x2c66f7[_0x258f('0x2d')][_0x258f('0x39')]){_0x5a5116[_0x258f('0x37')]=_['merge'](_0x5a5116[_0x258f('0x37')],{'$or':_['map'](_0x5a5116[_0x258f('0x30')],function(_0x27d1bb){var _0x3cb92c={};_0x3cb92c[_0x27d1bb]={'$like':'%'+_0x2c66f7[_0x258f('0x2d')][_0x258f('0x39')]+'%'};return _0x3cb92c;})});}_0x5a5116=_[_0x258f('0x3a')]({},_0x5a5116,_0x2c66f7[_0x258f('0x3c')]);return _0x31bf85['getSubjects'](_0x5a5116);}})[_0x258f('0x21')](function(_0xc7dfc9){if(_0xc7dfc9){_0x13573a=_0xc7dfc9[_0x258f('0x32')];if(!_0x2c66f7[_0x258f('0x2d')]['hasOwnProperty'](_0x258f('0x34'))){_0x5a5116[_0x258f('0x1c')]=qs[_0x258f('0x1c')](_0x2c66f7[_0x258f('0x2d')]['limit']);_0x5a5116[_0x258f('0x1a')]=qs[_0x258f('0x1a')](_0x2c66f7[_0x258f('0x2d')][_0x258f('0x1a')]);}return _0x31bf85[_0x258f('0x4a')](_0x5a5116);}})[_0x258f('0x21')](function(_0x570edf){if(_0x570edf){return _0x570edf?{'count':_0x13573a,'rows':_0x570edf}:null;}})[_0x258f('0x21')](respondWithResult(_0x179cd4,null))[_0x258f('0x40')](handleError(_0x179cd4,null));};exports['getDescriptions']=function(_0xf6cca4,_0x14779e,_0x465c06){var _0x21d163={};var _0x1113c0={};var _0x91bdee;var _0x452c84;return db[_0x258f('0x27')]['findOne']({'where':{'id':_0xf6cca4['params']['id']}})[_0x258f('0x21')](handleEntityNotFound(_0x14779e,null))[_0x258f('0x21')](function(_0x21ea4d){if(_0x21ea4d){_0x91bdee=_0x21ea4d;_0x1113c0[_0x258f('0x2c')]=_[_0x258f('0x43')](db['DeskField'][_0x258f('0x28')]);_0x1113c0[_0x258f('0x2d')]=_[_0x258f('0x43')](_0xf6cca4[_0x258f('0x2d')]);_0x1113c0[_0x258f('0x2e')]=_[_0x258f('0x2f')](_0x1113c0[_0x258f('0x2c')],_0x1113c0['query']);_0x21d163[_0x258f('0x30')]=_[_0x258f('0x2f')](_0x1113c0[_0x258f('0x2c')],qs[_0x258f('0x31')](_0xf6cca4[_0x258f('0x2d')][_0x258f('0x31')]));_0x21d163['attributes']=_0x21d163[_0x258f('0x30')][_0x258f('0x32')]?_0x21d163[_0x258f('0x30')]:_0x1113c0[_0x258f('0x2c')];_0x21d163[_0x258f('0x35')]=qs[_0x258f('0x36')](_0xf6cca4[_0x258f('0x2d')][_0x258f('0x36')]);_0x21d163['where']=qs[_0x258f('0x2e')](_['pick'](_0xf6cca4[_0x258f('0x2d')],_0x1113c0[_0x258f('0x2e')]));if(_0xf6cca4[_0x258f('0x2d')][_0x258f('0x39')]){_0x21d163[_0x258f('0x37')]=_[_0x258f('0x3a')](_0x21d163[_0x258f('0x37')],{'$or':_['map'](_0x21d163['attributes'],function(_0x572460){var _0x3fdcd1={};_0x3fdcd1[_0x572460]={'$like':'%'+_0xf6cca4[_0x258f('0x2d')][_0x258f('0x39')]+'%'};return _0x3fdcd1;})});}_0x21d163=_[_0x258f('0x3a')]({},_0x21d163,_0xf6cca4[_0x258f('0x3c')]);return _0x91bdee[_0x258f('0x4c')](_0x21d163);}})[_0x258f('0x21')](function(_0x5a32b4){if(_0x5a32b4){_0x452c84=_0x5a32b4[_0x258f('0x32')];if(!_0xf6cca4[_0x258f('0x2d')][_0x258f('0x33')]('nolimit')){_0x21d163[_0x258f('0x1c')]=qs[_0x258f('0x1c')](_0xf6cca4[_0x258f('0x2d')][_0x258f('0x1c')]);_0x21d163[_0x258f('0x1a')]=qs['offset'](_0xf6cca4[_0x258f('0x2d')][_0x258f('0x1a')]);}return _0x91bdee['getDescriptions'](_0x21d163);}})[_0x258f('0x21')](function(_0xad8329){if(_0xad8329){return _0xad8329?{'count':_0x452c84,'rows':_0xad8329}:null;}})[_0x258f('0x21')](respondWithResult(_0x14779e,null))['catch'](handleError(_0x14779e,null));};exports['getTags']=function(_0x4c40b4,_0x5618b4,_0x134ed1){var _0x3a3324={};var _0x2617d2={};var _0x5e5e9c;var _0x234e42;return db['DeskConfiguration']['findOne']({'where':{'id':_0x4c40b4['params']['id']}})['then'](handleEntityNotFound(_0x5618b4,null))[_0x258f('0x21')](function(_0x44b608){if(_0x44b608){_0x5e5e9c=_0x44b608;_0x2617d2[_0x258f('0x2c')]=_[_0x258f('0x43')](db['Tag'][_0x258f('0x28')]);_0x2617d2[_0x258f('0x2d')]=_['keys'](_0x4c40b4[_0x258f('0x2d')]);_0x2617d2[_0x258f('0x2e')]=_[_0x258f('0x2f')](_0x2617d2['model'],_0x2617d2[_0x258f('0x2d')]);_0x3a3324[_0x258f('0x30')]=_[_0x258f('0x2f')](_0x2617d2['model'],qs['fields'](_0x4c40b4[_0x258f('0x2d')]['fields']));_0x3a3324[_0x258f('0x30')]=_0x3a3324['attributes'][_0x258f('0x32')]?_0x3a3324[_0x258f('0x30')]:_0x2617d2[_0x258f('0x2c')];_0x3a3324[_0x258f('0x35')]=qs[_0x258f('0x36')](_0x4c40b4[_0x258f('0x2d')][_0x258f('0x36')]);_0x3a3324[_0x258f('0x37')]=qs[_0x258f('0x2e')](_[_0x258f('0x38')](_0x4c40b4[_0x258f('0x2d')],_0x2617d2[_0x258f('0x2e')]));if(_0x4c40b4[_0x258f('0x2d')]['filter']){_0x3a3324[_0x258f('0x37')]=_['merge'](_0x3a3324[_0x258f('0x37')],{'$or':_[_0x258f('0x26')](_0x3a3324[_0x258f('0x30')],function(_0x63e72f){var _0x420241={};_0x420241[_0x63e72f]={'$like':'%'+_0x4c40b4[_0x258f('0x2d')][_0x258f('0x39')]+'%'};return _0x420241;})});}_0x3a3324=_[_0x258f('0x3a')]({},_0x3a3324,_0x4c40b4[_0x258f('0x3c')]);return _0x5e5e9c[_0x258f('0x4d')](_0x3a3324);}})[_0x258f('0x21')](function(_0x45c304){if(_0x45c304){_0x234e42=_0x45c304[_0x258f('0x32')];if(!_0x4c40b4[_0x258f('0x2d')]['hasOwnProperty'](_0x258f('0x34'))){_0x3a3324['limit']=qs[_0x258f('0x1c')](_0x4c40b4['query'][_0x258f('0x1c')]);_0x3a3324['offset']=qs[_0x258f('0x1a')](_0x4c40b4[_0x258f('0x2d')][_0x258f('0x1a')]);}return _0x5e5e9c['getTags'](_0x3a3324);}})[_0x258f('0x21')](function(_0x105f72){if(_0x105f72){return _0x105f72?{'count':_0x234e42,'rows':_0x105f72}:null;}})['then'](respondWithResult(_0x5618b4,null))[_0x258f('0x40')](handleError(_0x5618b4,null));};exports[_0x258f('0x4e')]=function(_0x46bbf4,_0x314bdc,_0x3465d1){if(_0x46bbf4[_0x258f('0x46')]['id']){delete _0x46bbf4[_0x258f('0x46')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x46bbf4[_0x258f('0x42')]['id']}})['then'](handleEntityNotFound(_0x314bdc,null))['then'](function(_0xf9ced4){if(_0xf9ced4){return _0xf9ced4[_0x258f('0x4e')](_0x46bbf4[_0x258f('0x46')][_0x258f('0x4f')]||[]);}return null;})[_0x258f('0x21')](respondWithResult(_0x314bdc,null))[_0x258f('0x40')](handleError(_0x314bdc,null));}; \ No newline at end of file +var _0x30cb=['offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','DeskConfiguration','includeAll','include','findAll','catch','show','find','create','body','params','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','squel','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json'];(function(_0x27c93e,_0x53e962){var _0x526b67=function(_0x2adf77){while(--_0x2adf77){_0x27c93e['push'](_0x27c93e['shift']());}};_0x526b67(++_0x53e962);}(_0x30cb,0x1c4));var _0xb30c=function(_0x441a8b,_0x443d8b){_0x441a8b=_0x441a8b-0x0;var _0x23a72f=_0x30cb[_0x441a8b];return _0x23a72f;};'use strict';var emlformat=require(_0xb30c('0x0'));var rimraf=require(_0xb30c('0x1'));var zipdir=require(_0xb30c('0x2'));var jsonpatch=require(_0xb30c('0x3'));var rp=require(_0xb30c('0x4'));var moment=require(_0xb30c('0x5'));var BPromise=require(_0xb30c('0x6'));var Mustache=require(_0xb30c('0x7'));var util=require(_0xb30c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xb30c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb30c('0xa'));var _=require('lodash');var squel=require(_0xb30c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb30c('0x9'));var querystring=require('querystring');var Papa=require(_0xb30c('0xc'));var Redis=require('ioredis');var authService=require(_0xb30c('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xb30c('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb30c('0xf'))('api');var utils=require(_0xb30c('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb30c('0x11'))['db'];function respondWithStatusCode(_0x47109f,_0x1993e4){_0x1993e4=_0x1993e4||0xcc;return function(_0x308237){if(_0x308237){return _0x47109f[_0xb30c('0x12')](_0x1993e4);}return _0x47109f[_0xb30c('0x13')](_0x1993e4)[_0xb30c('0x14')]();};}function respondWithResult(_0x28c4fc,_0x5d7bd7){_0x5d7bd7=_0x5d7bd7||0xc8;return function(_0x4570ad){if(_0x4570ad){return _0x28c4fc['status'](_0x5d7bd7)[_0xb30c('0x15')](_0x4570ad);}};}function respondWithFilteredResult(_0xb08ace,_0x19fece){return function(_0x2a0d1f){if(_0x2a0d1f){var _0x278e82=typeof _0x19fece[_0xb30c('0x16')]===_0xb30c('0x17')&&typeof _0x19fece[_0xb30c('0x18')]===_0xb30c('0x17');var _0x48e658=_0x2a0d1f[_0xb30c('0x19')];var _0x106e1d=_0x278e82?0x0:_0x19fece[_0xb30c('0x16')];var _0x50f833=_0x278e82?_0x2a0d1f[_0xb30c('0x19')]:_0x19fece['offset']+_0x19fece[_0xb30c('0x18')];var _0x42d7d7;if(_0x50f833>=_0x48e658){_0x50f833=_0x48e658;_0x42d7d7=0xc8;}else{_0x42d7d7=0xce;}_0xb08ace[_0xb30c('0x13')](_0x42d7d7);return _0xb08ace['set'](_0xb30c('0x1a'),_0x106e1d+'-'+_0x50f833+'/'+_0x48e658)[_0xb30c('0x15')](_0x2a0d1f);}return null;};}function patchUpdates(_0x1582a8){return function(_0x34efd8){try{jsonpatch[_0xb30c('0x1b')](_0x34efd8,_0x1582a8,!![]);}catch(_0x1a1b68){return BPromise[_0xb30c('0x1c')](_0x1a1b68);}return _0x34efd8[_0xb30c('0x1d')]();};}function saveUpdates(_0x2593e9,_0x5e5585){return function(_0x505de1){if(_0x505de1){return _0x505de1[_0xb30c('0x1e')](_0x2593e9)[_0xb30c('0x1f')](function(_0x48f9b7){return _0x48f9b7;});}return null;};}function removeEntity(_0x17248b,_0x5e7eaf){return function(_0x175a55){if(_0x175a55){return _0x175a55[_0xb30c('0x20')]()[_0xb30c('0x1f')](function(){_0x17248b[_0xb30c('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36bc3f,_0x2741e5){return function(_0x57c5c0){if(!_0x57c5c0){_0x36bc3f[_0xb30c('0x12')](0x194);}return _0x57c5c0;};}function handleError(_0x32e1e8,_0x5699d8){_0x5699d8=_0x5699d8||0x1f4;return function(_0x330f47){logger[_0xb30c('0x21')](_0x330f47[_0xb30c('0x22')]);if(_0x330f47[_0xb30c('0x23')]){delete _0x330f47['name'];}_0x32e1e8[_0xb30c('0x13')](_0x5699d8)[_0xb30c('0x24')](_0x330f47);};}exports[_0xb30c('0x25')]=function(_0x502bee,_0x4892a5){var _0x19cb4d={},_0x2f10f1={},_0x24a37a={'count':0x0,'rows':[]};var _0x32d24b=_['map'](db['DeskConfiguration'][_0xb30c('0x26')],function(_0x22ab74){return{'name':_0x22ab74[_0xb30c('0x27')],'type':_0x22ab74[_0xb30c('0x28')][_0xb30c('0x29')]};});_0x2f10f1[_0xb30c('0x2a')]=_[_0xb30c('0x2b')](_0x32d24b,_0xb30c('0x23'));_0x2f10f1[_0xb30c('0x2c')]=_[_0xb30c('0x2d')](_0x502bee[_0xb30c('0x2c')]);_0x2f10f1[_0xb30c('0x2e')]=_[_0xb30c('0x2f')](_0x2f10f1[_0xb30c('0x2a')],_0x2f10f1[_0xb30c('0x2c')]);_0x19cb4d['attributes']=_['intersection'](_0x2f10f1[_0xb30c('0x2a')],qs[_0xb30c('0x30')](_0x502bee['query']['fields']));_0x19cb4d[_0xb30c('0x31')]=_0x19cb4d[_0xb30c('0x31')][_0xb30c('0x32')]?_0x19cb4d[_0xb30c('0x31')]:_0x2f10f1[_0xb30c('0x2a')];if(!_0x502bee[_0xb30c('0x2c')][_0xb30c('0x33')](_0xb30c('0x34'))){_0x19cb4d[_0xb30c('0x18')]=qs[_0xb30c('0x18')](_0x502bee[_0xb30c('0x2c')]['limit']);_0x19cb4d[_0xb30c('0x16')]=qs['offset'](_0x502bee['query'][_0xb30c('0x16')]);}_0x19cb4d[_0xb30c('0x35')]=qs[_0xb30c('0x36')](_0x502bee[_0xb30c('0x2c')]['sort']);_0x19cb4d['where']=qs[_0xb30c('0x2e')](_[_0xb30c('0x37')](_0x502bee[_0xb30c('0x2c')],_0x2f10f1['filters']),_0x32d24b);if(_0x502bee['query'][_0xb30c('0x38')]){_0x19cb4d[_0xb30c('0x39')]=_['merge'](_0x19cb4d[_0xb30c('0x39')],{'$or':_[_0xb30c('0x2b')](_0x32d24b,function(_0x3c8620){if(_0x3c8620[_0xb30c('0x28')]!==_0xb30c('0x3a')){var _0x4d7285={};_0x4d7285[_0x3c8620[_0xb30c('0x23')]]={'$like':'%'+_0x502bee[_0xb30c('0x2c')][_0xb30c('0x38')]+'%'};return _0x4d7285;}})});}_0x19cb4d=_[_0xb30c('0x3b')]({},_0x19cb4d,_0x502bee[_0xb30c('0x3c')]);var _0x371a19={'where':_0x19cb4d[_0xb30c('0x39')]};return db[_0xb30c('0x3d')][_0xb30c('0x19')](_0x371a19)[_0xb30c('0x1f')](function(_0x49922a){_0x24a37a[_0xb30c('0x19')]=_0x49922a;if(_0x502bee[_0xb30c('0x2c')][_0xb30c('0x3e')]){_0x19cb4d[_0xb30c('0x3f')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xb30c('0x40')](_0x19cb4d);})['then'](function(_0x342551){_0x24a37a['rows']=_0x342551;return _0x24a37a;})[_0xb30c('0x1f')](respondWithFilteredResult(_0x4892a5,_0x19cb4d))[_0xb30c('0x41')](handleError(_0x4892a5,null));};exports[_0xb30c('0x42')]=function(_0x1899e9,_0x2f0386){var _0x28e428={'raw':![],'where':{'id':_0x1899e9['params']['id']}},_0xdcc5b0={};_0xdcc5b0[_0xb30c('0x2a')]=_[_0xb30c('0x2d')](db[_0xb30c('0x3d')][_0xb30c('0x26')]);_0xdcc5b0[_0xb30c('0x2c')]=_['keys'](_0x1899e9[_0xb30c('0x2c')]);_0xdcc5b0[_0xb30c('0x2e')]=_['intersection'](_0xdcc5b0[_0xb30c('0x2a')],_0xdcc5b0[_0xb30c('0x2c')]);_0x28e428[_0xb30c('0x31')]=_['intersection'](_0xdcc5b0[_0xb30c('0x2a')],qs[_0xb30c('0x30')](_0x1899e9[_0xb30c('0x2c')][_0xb30c('0x30')]));_0x28e428[_0xb30c('0x31')]=_0x28e428[_0xb30c('0x31')]['length']?_0x28e428['attributes']:_0xdcc5b0[_0xb30c('0x2a')];if(_0x1899e9[_0xb30c('0x2c')][_0xb30c('0x3e')]){_0x28e428[_0xb30c('0x3f')]=[{'all':!![]}];}_0x28e428=_[_0xb30c('0x3b')]({},_0x28e428,_0x1899e9['options']);return db[_0xb30c('0x3d')][_0xb30c('0x43')](_0x28e428)[_0xb30c('0x1f')](handleEntityNotFound(_0x2f0386,null))[_0xb30c('0x1f')](respondWithResult(_0x2f0386,null))[_0xb30c('0x41')](handleError(_0x2f0386,null));};exports[_0xb30c('0x44')]=function(_0x149f29,_0x443d1e){return db[_0xb30c('0x3d')][_0xb30c('0x44')](_0x149f29[_0xb30c('0x45')],{})[_0xb30c('0x1f')](respondWithResult(_0x443d1e,0xc9))['catch'](handleError(_0x443d1e,null));};exports[_0xb30c('0x1e')]=function(_0x258adc,_0x2cc560){if(_0x258adc[_0xb30c('0x45')]['id']){delete _0x258adc['body']['id'];}return db[_0xb30c('0x3d')][_0xb30c('0x43')]({'where':{'id':_0x258adc[_0xb30c('0x46')]['id']}})[_0xb30c('0x1f')](handleEntityNotFound(_0x2cc560,null))['then'](saveUpdates(_0x258adc[_0xb30c('0x45')],null))[_0xb30c('0x1f')](respondWithResult(_0x2cc560,null))[_0xb30c('0x41')](handleError(_0x2cc560,null));};exports[_0xb30c('0x20')]=function(_0x422cbf,_0x3ef76e){return db[_0xb30c('0x3d')][_0xb30c('0x43')]({'where':{'id':_0x422cbf['params']['id']}})[_0xb30c('0x1f')](handleEntityNotFound(_0x3ef76e,null))[_0xb30c('0x1f')](removeEntity(_0x3ef76e,null))[_0xb30c('0x41')](handleError(_0x3ef76e,null));};exports[_0xb30c('0x47')]=function(_0x1bf1a6,_0x4e7b6a,_0x5a7e7d){var _0x6bf7e7={};var _0x61ede1={};var _0x276f37;var _0x42aa2d;return db['DeskConfiguration'][_0xb30c('0x48')]({'where':{'id':_0x1bf1a6[_0xb30c('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e7b6a,null))['then'](function(_0x53a02a){if(_0x53a02a){_0x276f37=_0x53a02a;_0x61ede1[_0xb30c('0x2a')]=_[_0xb30c('0x2d')](db[_0xb30c('0x49')][_0xb30c('0x26')]);_0x61ede1['query']=_[_0xb30c('0x2d')](_0x1bf1a6[_0xb30c('0x2c')]);_0x61ede1[_0xb30c('0x2e')]=_[_0xb30c('0x2f')](_0x61ede1[_0xb30c('0x2a')],_0x61ede1[_0xb30c('0x2c')]);_0x6bf7e7['attributes']=_[_0xb30c('0x2f')](_0x61ede1[_0xb30c('0x2a')],qs['fields'](_0x1bf1a6['query']['fields']));_0x6bf7e7[_0xb30c('0x31')]=_0x6bf7e7[_0xb30c('0x31')][_0xb30c('0x32')]?_0x6bf7e7[_0xb30c('0x31')]:_0x61ede1['model'];_0x6bf7e7[_0xb30c('0x35')]=qs[_0xb30c('0x36')](_0x1bf1a6[_0xb30c('0x2c')][_0xb30c('0x36')]);_0x6bf7e7[_0xb30c('0x39')]=qs['filters'](_[_0xb30c('0x37')](_0x1bf1a6[_0xb30c('0x2c')],_0x61ede1[_0xb30c('0x2e')]));if(_0x1bf1a6[_0xb30c('0x2c')]['filter']){_0x6bf7e7[_0xb30c('0x39')]=_[_0xb30c('0x3b')](_0x6bf7e7[_0xb30c('0x39')],{'$or':_[_0xb30c('0x2b')](_0x6bf7e7[_0xb30c('0x31')],function(_0x2de20f){var _0x3c7e75={};_0x3c7e75[_0x2de20f]={'$like':'%'+_0x1bf1a6[_0xb30c('0x2c')][_0xb30c('0x38')]+'%'};return _0x3c7e75;})});}_0x6bf7e7=_[_0xb30c('0x3b')]({},_0x6bf7e7,_0x1bf1a6[_0xb30c('0x3c')]);return _0x276f37[_0xb30c('0x47')](_0x6bf7e7);}})['then'](function(_0x204c83){if(_0x204c83){_0x42aa2d=_0x204c83['length'];if(!_0x1bf1a6[_0xb30c('0x2c')][_0xb30c('0x33')]('nolimit')){_0x6bf7e7['limit']=qs[_0xb30c('0x18')](_0x1bf1a6[_0xb30c('0x2c')][_0xb30c('0x18')]);_0x6bf7e7[_0xb30c('0x16')]=qs[_0xb30c('0x16')](_0x1bf1a6[_0xb30c('0x2c')]['offset']);}return _0x276f37['getFields'](_0x6bf7e7);}})[_0xb30c('0x1f')](function(_0x584843){if(_0x584843){return _0x584843?{'count':_0x42aa2d,'rows':_0x584843}:null;}})['then'](respondWithResult(_0x4e7b6a,null))[_0xb30c('0x41')](handleError(_0x4e7b6a,null));};exports[_0xb30c('0x4a')]=function(_0x4daff1,_0x124b16,_0x1f928c){var _0x2ecac9={};var _0x3160ab={};var _0x16fd23;var _0x203ca0;return db[_0xb30c('0x3d')][_0xb30c('0x48')]({'where':{'id':_0x4daff1[_0xb30c('0x46')]['id']}})['then'](handleEntityNotFound(_0x124b16,null))[_0xb30c('0x1f')](function(_0x5474e1){if(_0x5474e1){_0x16fd23=_0x5474e1;_0x3160ab[_0xb30c('0x2a')]=_[_0xb30c('0x2d')](db[_0xb30c('0x49')][_0xb30c('0x26')]);_0x3160ab['query']=_[_0xb30c('0x2d')](_0x4daff1[_0xb30c('0x2c')]);_0x3160ab[_0xb30c('0x2e')]=_['intersection'](_0x3160ab[_0xb30c('0x2a')],_0x3160ab[_0xb30c('0x2c')]);_0x2ecac9[_0xb30c('0x31')]=_[_0xb30c('0x2f')](_0x3160ab['model'],qs['fields'](_0x4daff1['query'][_0xb30c('0x30')]));_0x2ecac9[_0xb30c('0x31')]=_0x2ecac9[_0xb30c('0x31')][_0xb30c('0x32')]?_0x2ecac9[_0xb30c('0x31')]:_0x3160ab[_0xb30c('0x2a')];_0x2ecac9[_0xb30c('0x35')]=qs[_0xb30c('0x36')](_0x4daff1[_0xb30c('0x2c')]['sort']);_0x2ecac9[_0xb30c('0x39')]=qs[_0xb30c('0x2e')](_[_0xb30c('0x37')](_0x4daff1[_0xb30c('0x2c')],_0x3160ab[_0xb30c('0x2e')]));if(_0x4daff1[_0xb30c('0x2c')][_0xb30c('0x38')]){_0x2ecac9[_0xb30c('0x39')]=_['merge'](_0x2ecac9[_0xb30c('0x39')],{'$or':_[_0xb30c('0x2b')](_0x2ecac9[_0xb30c('0x31')],function(_0x3d1f94){var _0x746851={};_0x746851[_0x3d1f94]={'$like':'%'+_0x4daff1[_0xb30c('0x2c')]['filter']+'%'};return _0x746851;})});}_0x2ecac9=_[_0xb30c('0x3b')]({},_0x2ecac9,_0x4daff1[_0xb30c('0x3c')]);return _0x16fd23[_0xb30c('0x4a')](_0x2ecac9);}})[_0xb30c('0x1f')](function(_0x36bc71){if(_0x36bc71){_0x203ca0=_0x36bc71[_0xb30c('0x32')];if(!_0x4daff1[_0xb30c('0x2c')][_0xb30c('0x33')]('nolimit')){_0x2ecac9[_0xb30c('0x18')]=qs['limit'](_0x4daff1[_0xb30c('0x2c')][_0xb30c('0x18')]);_0x2ecac9['offset']=qs[_0xb30c('0x16')](_0x4daff1[_0xb30c('0x2c')][_0xb30c('0x16')]);}return _0x16fd23[_0xb30c('0x4a')](_0x2ecac9);}})[_0xb30c('0x1f')](function(_0x4d18b0){if(_0x4d18b0){return _0x4d18b0?{'count':_0x203ca0,'rows':_0x4d18b0}:null;}})['then'](respondWithResult(_0x124b16,null))[_0xb30c('0x41')](handleError(_0x124b16,null));};exports['getDescriptions']=function(_0x2c8566,_0x5458bb,_0x592a03){var _0x4dbf4f={};var _0x3b76b1={};var _0x4e0f23;var _0x9c5320;return db[_0xb30c('0x3d')]['findOne']({'where':{'id':_0x2c8566[_0xb30c('0x46')]['id']}})[_0xb30c('0x1f')](handleEntityNotFound(_0x5458bb,null))[_0xb30c('0x1f')](function(_0x1a1e19){if(_0x1a1e19){_0x4e0f23=_0x1a1e19;_0x3b76b1[_0xb30c('0x2a')]=_[_0xb30c('0x2d')](db[_0xb30c('0x49')][_0xb30c('0x26')]);_0x3b76b1[_0xb30c('0x2c')]=_[_0xb30c('0x2d')](_0x2c8566[_0xb30c('0x2c')]);_0x3b76b1[_0xb30c('0x2e')]=_[_0xb30c('0x2f')](_0x3b76b1[_0xb30c('0x2a')],_0x3b76b1[_0xb30c('0x2c')]);_0x4dbf4f[_0xb30c('0x31')]=_[_0xb30c('0x2f')](_0x3b76b1[_0xb30c('0x2a')],qs['fields'](_0x2c8566[_0xb30c('0x2c')][_0xb30c('0x30')]));_0x4dbf4f[_0xb30c('0x31')]=_0x4dbf4f[_0xb30c('0x31')][_0xb30c('0x32')]?_0x4dbf4f[_0xb30c('0x31')]:_0x3b76b1[_0xb30c('0x2a')];_0x4dbf4f['order']=qs[_0xb30c('0x36')](_0x2c8566[_0xb30c('0x2c')][_0xb30c('0x36')]);_0x4dbf4f[_0xb30c('0x39')]=qs[_0xb30c('0x2e')](_[_0xb30c('0x37')](_0x2c8566['query'],_0x3b76b1[_0xb30c('0x2e')]));if(_0x2c8566[_0xb30c('0x2c')][_0xb30c('0x38')]){_0x4dbf4f[_0xb30c('0x39')]=_[_0xb30c('0x3b')](_0x4dbf4f[_0xb30c('0x39')],{'$or':_[_0xb30c('0x2b')](_0x4dbf4f[_0xb30c('0x31')],function(_0x3cd836){var _0x1c047b={};_0x1c047b[_0x3cd836]={'$like':'%'+_0x2c8566[_0xb30c('0x2c')][_0xb30c('0x38')]+'%'};return _0x1c047b;})});}_0x4dbf4f=_[_0xb30c('0x3b')]({},_0x4dbf4f,_0x2c8566[_0xb30c('0x3c')]);return _0x4e0f23[_0xb30c('0x4b')](_0x4dbf4f);}})[_0xb30c('0x1f')](function(_0x3dc2db){if(_0x3dc2db){_0x9c5320=_0x3dc2db[_0xb30c('0x32')];if(!_0x2c8566[_0xb30c('0x2c')]['hasOwnProperty']('nolimit')){_0x4dbf4f[_0xb30c('0x18')]=qs[_0xb30c('0x18')](_0x2c8566[_0xb30c('0x2c')][_0xb30c('0x18')]);_0x4dbf4f[_0xb30c('0x16')]=qs['offset'](_0x2c8566[_0xb30c('0x2c')][_0xb30c('0x16')]);}return _0x4e0f23[_0xb30c('0x4b')](_0x4dbf4f);}})['then'](function(_0x33ae8b){if(_0x33ae8b){return _0x33ae8b?{'count':_0x9c5320,'rows':_0x33ae8b}:null;}})[_0xb30c('0x1f')](respondWithResult(_0x5458bb,null))[_0xb30c('0x41')](handleError(_0x5458bb,null));};exports[_0xb30c('0x4c')]=function(_0x3cacae,_0x225c14,_0x4aac92){var _0x5f5211={};var _0x2b847d={};var _0xf1f15a;var _0x54442b;return db[_0xb30c('0x3d')]['findOne']({'where':{'id':_0x3cacae['params']['id']}})[_0xb30c('0x1f')](handleEntityNotFound(_0x225c14,null))[_0xb30c('0x1f')](function(_0x2a6bed){if(_0x2a6bed){_0xf1f15a=_0x2a6bed;_0x2b847d['model']=_[_0xb30c('0x2d')](db[_0xb30c('0x4d')][_0xb30c('0x26')]);_0x2b847d['query']=_[_0xb30c('0x2d')](_0x3cacae[_0xb30c('0x2c')]);_0x2b847d['filters']=_['intersection'](_0x2b847d[_0xb30c('0x2a')],_0x2b847d[_0xb30c('0x2c')]);_0x5f5211['attributes']=_['intersection'](_0x2b847d[_0xb30c('0x2a')],qs[_0xb30c('0x30')](_0x3cacae[_0xb30c('0x2c')][_0xb30c('0x30')]));_0x5f5211[_0xb30c('0x31')]=_0x5f5211[_0xb30c('0x31')][_0xb30c('0x32')]?_0x5f5211[_0xb30c('0x31')]:_0x2b847d[_0xb30c('0x2a')];_0x5f5211[_0xb30c('0x35')]=qs[_0xb30c('0x36')](_0x3cacae[_0xb30c('0x2c')][_0xb30c('0x36')]);_0x5f5211['where']=qs['filters'](_[_0xb30c('0x37')](_0x3cacae[_0xb30c('0x2c')],_0x2b847d[_0xb30c('0x2e')]));if(_0x3cacae['query'][_0xb30c('0x38')]){_0x5f5211[_0xb30c('0x39')]=_['merge'](_0x5f5211[_0xb30c('0x39')],{'$or':_['map'](_0x5f5211[_0xb30c('0x31')],function(_0xeac6b0){var _0x2b8e32={};_0x2b8e32[_0xeac6b0]={'$like':'%'+_0x3cacae[_0xb30c('0x2c')]['filter']+'%'};return _0x2b8e32;})});}_0x5f5211=_[_0xb30c('0x3b')]({},_0x5f5211,_0x3cacae['options']);return _0xf1f15a[_0xb30c('0x4c')](_0x5f5211);}})[_0xb30c('0x1f')](function(_0x1e0982){if(_0x1e0982){_0x54442b=_0x1e0982['length'];if(!_0x3cacae[_0xb30c('0x2c')][_0xb30c('0x33')](_0xb30c('0x34'))){_0x5f5211[_0xb30c('0x18')]=qs[_0xb30c('0x18')](_0x3cacae[_0xb30c('0x2c')][_0xb30c('0x18')]);_0x5f5211[_0xb30c('0x16')]=qs[_0xb30c('0x16')](_0x3cacae[_0xb30c('0x2c')]['offset']);}return _0xf1f15a['getTags'](_0x5f5211);}})['then'](function(_0x16cfd6){if(_0x16cfd6){return _0x16cfd6?{'count':_0x54442b,'rows':_0x16cfd6}:null;}})[_0xb30c('0x1f')](respondWithResult(_0x225c14,null))[_0xb30c('0x41')](handleError(_0x225c14,null));};exports[_0xb30c('0x4e')]=function(_0x1f8569,_0x590d4b,_0x537f54){if(_0x1f8569['body']['id']){delete _0x1f8569[_0xb30c('0x45')]['id'];}return db[_0xb30c('0x3d')][_0xb30c('0x48')]({'where':{'id':_0x1f8569['params']['id']}})[_0xb30c('0x1f')](handleEntityNotFound(_0x590d4b,null))[_0xb30c('0x1f')](function(_0x19de69){if(_0x19de69){return _0x19de69[_0xb30c('0x4e')](_0x1f8569[_0xb30c('0x45')]['ids']||[]);}return null;})[_0xb30c('0x1f')](respondWithResult(_0x590d4b,null))[_0xb30c('0x41')](handleError(_0x590d4b,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 3d1fc91..5a7b2a7 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 _0xfa2d=['bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash','util','../../config/logger','api'];(function(_0x159b60,_0x16af3f){var _0x460e63=function(_0x39fac8){while(--_0x39fac8){_0x159b60['push'](_0x159b60['shift']());}};_0x460e63(++_0x16af3f);}(_0xfa2d,0x188));var _0xdfa2=function(_0x28c71a,_0xbdb659){_0x28c71a=_0x28c71a-0x0;var _0x4a5905=_0xfa2d[_0x28c71a];return _0x4a5905;};'use strict';var _=require(_0xdfa2('0x0'));var util=require(_0xdfa2('0x1'));var logger=require(_0xdfa2('0x2'))(_0xdfa2('0x3'));var moment=require('moment');var BPromise=require(_0xdfa2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdfa2('0x5'));var rimraf=require(_0xdfa2('0x6'));var config=require(_0xdfa2('0x7'));var attributes=require(_0xdfa2('0x8'));module[_0xdfa2('0x9')]=function(_0x3634f1,_0x1f8f87){return _0x3634f1[_0xdfa2('0xa')]('DeskConfiguration',attributes,{'tableName':_0xdfa2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18f2=['request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0x4f47b7,_0x2271e8){var _0x19577c=function(_0x4dc067){while(--_0x4dc067){_0x4f47b7['push'](_0x4f47b7['shift']());}};_0x19577c(++_0x2271e8);}(_0x18f2,0x1b7));var _0x218f=function(_0x5ca7b0,_0x450a29){_0x5ca7b0=_0x5ca7b0-0x0;var _0x4560ca=_0x18f2[_0x5ca7b0];return _0x4560ca;};'use strict';var _=require(_0x218f('0x0'));var util=require(_0x218f('0x1'));var logger=require(_0x218f('0x2'))(_0x218f('0x3'));var moment=require(_0x218f('0x4'));var BPromise=require('bluebird');var rp=require(_0x218f('0x5'));var fs=require('fs');var path=require(_0x218f('0x6'));var rimraf=require('rimraf');var config=require(_0x218f('0x7'));var attributes=require(_0x218f('0x8'));module[_0x218f('0x9')]=function(_0x53e502,_0x473846){return _0x53e502[_0x218f('0xa')](_0x218f('0xb'),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 cc0c123..3dd959b 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 _0x6bec=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','debug','request\x20sent','error','code','DeskConfiguration,\x20%s,\x20%s','message','info'];(function(_0x26abcb,_0x394921){var _0x136b0b=function(_0x2f1e3){while(--_0x2f1e3){_0x26abcb['push'](_0x26abcb['shift']());}};_0x136b0b(++_0x394921);}(_0x6bec,0x86));var _0xc6be=function(_0x5724b5,_0xe0cfe3){_0x5724b5=_0x5724b5-0x0;var _0x14eeed=_0x6bec[_0x5724b5];return _0x14eeed;};'use strict';var _=require(_0xc6be('0x0'));var util=require(_0xc6be('0x1'));var moment=require(_0xc6be('0x2'));var BPromise=require(_0xc6be('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6be('0x4'));var db=require(_0xc6be('0x5'))['db'];var utils=require(_0xc6be('0x6'));var logger=require(_0xc6be('0x7'))(_0xc6be('0x8'));var config=require(_0xc6be('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc6be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4acaeb,_0x28dc94,_0x5e6a91){return new BPromise(function(_0x43711c,_0x42f470){return client[_0xc6be('0xb')](_0x4acaeb,_0x5e6a91)[_0xc6be('0xc')](function(_0x3487a5){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x28dc94,'request\x20sent');logger[_0xc6be('0xd')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x28dc94,_0xc6be('0xe'),JSON['stringify'](_0x3487a5));if(_0x3487a5[_0xc6be('0xf')]){if(_0x3487a5[_0xc6be('0xf')][_0xc6be('0x10')]===0x1f4){logger[_0xc6be('0xf')](_0xc6be('0x11'),_0x28dc94,_0x3487a5[_0xc6be('0xf')][_0xc6be('0x12')]);return _0x42f470(_0x3487a5[_0xc6be('0xf')][_0xc6be('0x12')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x28dc94,_0x3487a5[_0xc6be('0xf')]['message']);return _0x43711c(_0x3487a5['error'][_0xc6be('0x12')]);}else{logger[_0xc6be('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x28dc94,_0xc6be('0xe'));_0x43711c(_0x3487a5[_0xc6be('0x14')][_0xc6be('0x12')]);}})[_0xc6be('0x15')](function(_0x150dde){logger[_0xc6be('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x28dc94,_0x150dde);_0x42f470(_0x150dde);});});} \ No newline at end of file +var _0x09ef=['rpc','../../config/environment','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x36f058,_0x38e53c){var _0x26c53d=function(_0x441281){while(--_0x441281){_0x36f058['push'](_0x36f058['shift']());}};_0x26c53d(++_0x38e53c);}(_0x09ef,0x15e));var _0xf09e=function(_0x3d4255,_0x264be9){_0x3d4255=_0x3d4255-0x0;var _0x227451=_0x09ef[_0x3d4255];return _0x227451;};'use strict';var _=require(_0xf09e('0x0'));var util=require(_0xf09e('0x1'));var moment=require(_0xf09e('0x2'));var BPromise=require(_0xf09e('0x3'));var rs=require(_0xf09e('0x4'));var fs=require('fs');var Redis=require(_0xf09e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf09e('0x6'));var logger=require('../../config/logger')(_0xf09e('0x7'));var config=require(_0xf09e('0x8'));var jayson=require(_0xf09e('0x9'));var client=jayson[_0xf09e('0xa')][_0xf09e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x294258,_0x1d205f,_0x877574){return new BPromise(function(_0x2e5a79,_0x2f28e1){return client['request'](_0x294258,_0x877574)[_0xf09e('0xc')](function(_0xfdb22a){logger[_0xf09e('0xd')](_0xf09e('0xe'),_0x1d205f,_0xf09e('0xf'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1d205f,_0xf09e('0xf'),JSON[_0xf09e('0x10')](_0xfdb22a));if(_0xfdb22a['error']){if(_0xfdb22a[_0xf09e('0x11')]['code']===0x1f4){logger[_0xf09e('0x11')](_0xf09e('0xe'),_0x1d205f,_0xfdb22a[_0xf09e('0x11')][_0xf09e('0x12')]);return _0x2f28e1(_0xfdb22a[_0xf09e('0x11')][_0xf09e('0x12')]);}logger['error'](_0xf09e('0xe'),_0x1d205f,_0xfdb22a['error'][_0xf09e('0x12')]);return _0x2e5a79(_0xfdb22a[_0xf09e('0x11')][_0xf09e('0x12')]);}else{logger['info'](_0xf09e('0xe'),_0x1d205f,_0xf09e('0xf'));_0x2e5a79(_0xfdb22a[_0xf09e('0x13')][_0xf09e('0x12')]);}})[_0xf09e('0x14')](function(_0x176029){logger[_0xf09e('0x11')](_0xf09e('0xe'),_0x1d205f,_0x176029);_0x2f28e1(_0x176029);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 93972b4..8238440 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 _0x1918=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','/:id','show','post','put','update','util','path','express'];(function(_0x511e2f,_0x40455d){var _0x4e0d55=function(_0x737734){while(--_0x737734){_0x511e2f['push'](_0x511e2f['shift']());}};_0x4e0d55(++_0x40455d);}(_0x1918,0x1dd));var _0x8191=function(_0x3cc468,_0x22064f){_0x3cc468=_0x3cc468-0x0;var _0x551c52=_0x1918[_0x3cc468];return _0x551c52;};'use strict';var multer=require('multer');var util=require(_0x8191('0x0'));var path=require(_0x8191('0x1'));var timeout=require('connect-timeout');var express=require(_0x8191('0x2'));var router=express[_0x8191('0x3')]();var fs_extra=require(_0x8191('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8191('0x5'));var config=require(_0x8191('0x6'));var controller=require(_0x8191('0x7'));router['get']('/',auth[_0x8191('0x8')](),controller[_0x8191('0x9')]);router['get'](_0x8191('0xa'),auth[_0x8191('0x8')](),controller[_0x8191('0xb')]);router[_0x8191('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8191('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x8191('0xe')]);router['delete'](_0x8191('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc664=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','create','put','update','delete','destroy','exports'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xc664,0x90));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4c66('0x0'));var util=require(_0x4c66('0x1'));var path=require('path');var timeout=require(_0x4c66('0x2'));var express=require(_0x4c66('0x3'));var router=express[_0x4c66('0x4')]();var fs_extra=require(_0x4c66('0x5'));var auth=require(_0x4c66('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4c66('0x7'));var controller=require(_0x4c66('0x8'));router[_0x4c66('0x9')]('/',auth[_0x4c66('0xa')](),controller['index']);router[_0x4c66('0x9')](_0x4c66('0xb'),auth[_0x4c66('0xa')](),controller['show']);router['post']('/',auth[_0x4c66('0xa')](),controller[_0x4c66('0xc')]);router[_0x4c66('0xd')](_0x4c66('0xb'),auth['isAuthenticated'](),controller[_0x4c66('0xe')]);router[_0x4c66('0xf')](_0x4c66('0xb'),auth[_0x4c66('0xa')](),controller[_0x4c66('0x10')]);module[_0x4c66('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 83547d9..eddbb4e 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 _0x872b=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x4d2fda,_0x4eabbf){var _0x476325=function(_0x12c7f4){while(--_0x12c7f4){_0x4d2fda['push'](_0x4d2fda['shift']());}};_0x476325(++_0x4eabbf);}(_0x872b,0x1ad));var _0xb872=function(_0x1c26e7,_0x404d26){_0x1c26e7=_0x1c26e7-0x0;var _0x2d37f6=_0x872b[_0x1c26e7];return _0x2d37f6;};'use strict';var Sequelize=require(_0xb872('0x0'));module[_0xb872('0x1')]={'type':{'type':Sequelize[_0xb872('0x2')]('string','variable',_0xb872('0x3'),_0xb872('0x4'),_0xb872('0x5')),'defaultValue':_0xb872('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb872('0x7')]},'keyType':{'type':Sequelize[_0xb872('0x2')]('string','variable',_0xb872('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb872('0x7')]},'nameField':{'type':Sequelize[_0xb872('0x7')]},'customField':{'type':Sequelize[_0xb872('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb872('0x7')]}}; \ No newline at end of file +var _0x2ffd=['string','STRING','sequelize','exports','variable','customVariable','keyValue','picklist'];(function(_0x5a0043,_0x516a55){var _0x51adca=function(_0x2f170d){while(--_0x2f170d){_0x5a0043['push'](_0x5a0043['shift']());}};_0x51adca(++_0x516a55);}(_0x2ffd,0x1ca));var _0xd2ff=function(_0x4ce8ce,_0x513fd6){_0x4ce8ce=_0x4ce8ce-0x0;var _0x2b1e73=_0x2ffd[_0x4ce8ce];return _0x2b1e73;};'use strict';var Sequelize=require(_0xd2ff('0x0'));module[_0xd2ff('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xd2ff('0x2'),_0xd2ff('0x3'),_0xd2ff('0x4'),_0xd2ff('0x5')),'defaultValue':_0xd2ff('0x6')},'content':{'type':Sequelize[_0xd2ff('0x7')]},'key':{'type':Sequelize[_0xd2ff('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xd2ff('0x6'),_0xd2ff('0x2'),_0xd2ff('0x3'))},'keyContent':{'type':Sequelize[_0xd2ff('0x7')]},'idField':{'type':Sequelize[_0xd2ff('0x7')]},'nameField':{'type':Sequelize[_0xd2ff('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd2ff('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 9276025..c94a891 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 _0x7cfe=['request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','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/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','limit','sort','where','filters','pick','filter','VIRTUAL','merge','DeskField','includeAll','include','rows','catch','show','params','options','find','create','body','eml-format','fast-json-patch'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0x7cfe,0x94));var _0xe7cf=function(_0xb65e95,_0x55daa5){_0xb65e95=_0xb65e95-0x0;var _0x245378=_0x7cfe[_0xb65e95];return _0x245378;};'use strict';var emlformat=require(_0xe7cf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe7cf('0x1'));var rp=require(_0xe7cf('0x2'));var moment=require(_0xe7cf('0x3'));var BPromise=require(_0xe7cf('0x4'));var Mustache=require(_0xe7cf('0x5'));var util=require(_0xe7cf('0x6'));var path=require(_0xe7cf('0x7'));var sox=require('sox');var csv=require(_0xe7cf('0x8'));var ejs=require(_0xe7cf('0x9'));var fs=require('fs');var fs_extra=require(_0xe7cf('0xa'));var _=require(_0xe7cf('0xb'));var squel=require('squel');var crypto=require(_0xe7cf('0xc'));var jsforce=require(_0xe7cf('0xd'));var deskjs=require(_0xe7cf('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe7cf('0xf'));var Papa=require(_0xe7cf('0x10'));var Redis=require(_0xe7cf('0x11'));var authService=require(_0xe7cf('0x12'));var qs=require(_0xe7cf('0x13'));var as=require(_0xe7cf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe7cf('0x15'))(_0xe7cf('0x16'));var utils=require(_0xe7cf('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe7cf('0x18'));var db=require(_0xe7cf('0x19'))['db'];function respondWithStatusCode(_0x5b25dc,_0x4c12be){_0x4c12be=_0x4c12be||0xcc;return function(_0x53705c){if(_0x53705c){return _0x5b25dc[_0xe7cf('0x1a')](_0x4c12be);}return _0x5b25dc['status'](_0x4c12be)[_0xe7cf('0x1b')]();};}function respondWithResult(_0x37c3c9,_0x413cf7){_0x413cf7=_0x413cf7||0xc8;return function(_0x58c826){if(_0x58c826){return _0x37c3c9[_0xe7cf('0x1c')](_0x413cf7)['json'](_0x58c826);}};}function respondWithFilteredResult(_0x58a622,_0x2985ce){return function(_0x2a7123){if(_0x2a7123){var _0x5dde78=typeof _0x2985ce[_0xe7cf('0x1d')]===_0xe7cf('0x1e')&&typeof _0x2985ce['limit']===_0xe7cf('0x1e');var _0x3816ac=_0x2a7123[_0xe7cf('0x1f')];var _0x52a9fb=_0x5dde78?0x0:_0x2985ce['offset'];var _0x4cbac4=_0x5dde78?_0x2a7123['count']:_0x2985ce[_0xe7cf('0x1d')]+_0x2985ce['limit'];var _0x2408cb;if(_0x4cbac4>=_0x3816ac){_0x4cbac4=_0x3816ac;_0x2408cb=0xc8;}else{_0x2408cb=0xce;}_0x58a622[_0xe7cf('0x1c')](_0x2408cb);return _0x58a622['set'](_0xe7cf('0x20'),_0x52a9fb+'-'+_0x4cbac4+'/'+_0x3816ac)[_0xe7cf('0x21')](_0x2a7123);}return null;};}function patchUpdates(_0x33c6bd){return function(_0x5ea7a1){try{jsonpatch[_0xe7cf('0x22')](_0x5ea7a1,_0x33c6bd,!![]);}catch(_0x6fedca){return BPromise[_0xe7cf('0x23')](_0x6fedca);}return _0x5ea7a1[_0xe7cf('0x24')]();};}function saveUpdates(_0x4204af,_0x4c6292){return function(_0x562ba1){if(_0x562ba1){return _0x562ba1[_0xe7cf('0x25')](_0x4204af)['then'](function(_0x16a52c){return _0x16a52c;});}return null;};}function removeEntity(_0x335619,_0x5459d2){return function(_0x60116d){if(_0x60116d){return _0x60116d[_0xe7cf('0x26')]()[_0xe7cf('0x27')](function(){_0x335619[_0xe7cf('0x1c')](0xcc)[_0xe7cf('0x1b')]();});}};}function handleEntityNotFound(_0x3ca966,_0x3809e7){return function(_0x37e40f){if(!_0x37e40f){_0x3ca966['sendStatus'](0x194);}return _0x37e40f;};}function handleError(_0x1a48dc,_0x342a1b){_0x342a1b=_0x342a1b||0x1f4;return function(_0x26a977){logger['error'](_0x26a977[_0xe7cf('0x28')]);if(_0x26a977[_0xe7cf('0x29')]){delete _0x26a977[_0xe7cf('0x29')];}_0x1a48dc[_0xe7cf('0x1c')](_0x342a1b)[_0xe7cf('0x2a')](_0x26a977);};}exports[_0xe7cf('0x2b')]=function(_0x23937f,_0xa07554){var _0x4d310d={},_0x53130c={},_0x21b42f={'count':0x0,'rows':[]};var _0x56a684=_[_0xe7cf('0x2c')](db['DeskField'][_0xe7cf('0x2d')],function(_0x36398f){return{'name':_0x36398f[_0xe7cf('0x2e')],'type':_0x36398f[_0xe7cf('0x2f')][_0xe7cf('0x30')]};});_0x53130c[_0xe7cf('0x31')]=_['map'](_0x56a684,_0xe7cf('0x29'));_0x53130c[_0xe7cf('0x32')]=_[_0xe7cf('0x33')](_0x23937f[_0xe7cf('0x32')]);_0x53130c['filters']=_[_0xe7cf('0x34')](_0x53130c[_0xe7cf('0x31')],_0x53130c[_0xe7cf('0x32')]);_0x4d310d[_0xe7cf('0x35')]=_[_0xe7cf('0x34')](_0x53130c['model'],qs[_0xe7cf('0x36')](_0x23937f['query']['fields']));_0x4d310d[_0xe7cf('0x35')]=_0x4d310d[_0xe7cf('0x35')][_0xe7cf('0x37')]?_0x4d310d[_0xe7cf('0x35')]:_0x53130c[_0xe7cf('0x31')];if(!_0x23937f[_0xe7cf('0x32')]['hasOwnProperty']('nolimit')){_0x4d310d[_0xe7cf('0x38')]=qs[_0xe7cf('0x38')](_0x23937f[_0xe7cf('0x32')][_0xe7cf('0x38')]);_0x4d310d['offset']=qs[_0xe7cf('0x1d')](_0x23937f['query'][_0xe7cf('0x1d')]);}_0x4d310d['order']=qs[_0xe7cf('0x39')](_0x23937f[_0xe7cf('0x32')][_0xe7cf('0x39')]);_0x4d310d[_0xe7cf('0x3a')]=qs[_0xe7cf('0x3b')](_[_0xe7cf('0x3c')](_0x23937f[_0xe7cf('0x32')],_0x53130c[_0xe7cf('0x3b')]),_0x56a684);if(_0x23937f[_0xe7cf('0x32')][_0xe7cf('0x3d')]){_0x4d310d[_0xe7cf('0x3a')]=_['merge'](_0x4d310d['where'],{'$or':_[_0xe7cf('0x2c')](_0x56a684,function(_0xe3c124){if(_0xe3c124[_0xe7cf('0x2f')]!==_0xe7cf('0x3e')){var _0xc86fbd={};_0xc86fbd[_0xe3c124[_0xe7cf('0x29')]]={'$like':'%'+_0x23937f[_0xe7cf('0x32')][_0xe7cf('0x3d')]+'%'};return _0xc86fbd;}})});}_0x4d310d=_[_0xe7cf('0x3f')]({},_0x4d310d,_0x23937f['options']);var _0x5c1e1c={'where':_0x4d310d[_0xe7cf('0x3a')]};return db[_0xe7cf('0x40')][_0xe7cf('0x1f')](_0x5c1e1c)['then'](function(_0x53f6b6){_0x21b42f[_0xe7cf('0x1f')]=_0x53f6b6;if(_0x23937f[_0xe7cf('0x32')][_0xe7cf('0x41')]){_0x4d310d[_0xe7cf('0x42')]=[{'all':!![]}];}return db[_0xe7cf('0x40')]['findAll'](_0x4d310d);})[_0xe7cf('0x27')](function(_0x266bcb){_0x21b42f[_0xe7cf('0x43')]=_0x266bcb;return _0x21b42f;})[_0xe7cf('0x27')](respondWithFilteredResult(_0xa07554,_0x4d310d))[_0xe7cf('0x44')](handleError(_0xa07554,null));};exports[_0xe7cf('0x45')]=function(_0x317d99,_0x636a97){var _0x9e8d15={'raw':!![],'where':{'id':_0x317d99[_0xe7cf('0x46')]['id']}},_0x2ad989={};_0x2ad989[_0xe7cf('0x31')]=_[_0xe7cf('0x33')](db['DeskField'][_0xe7cf('0x2d')]);_0x2ad989[_0xe7cf('0x32')]=_[_0xe7cf('0x33')](_0x317d99[_0xe7cf('0x32')]);_0x2ad989[_0xe7cf('0x3b')]=_['intersection'](_0x2ad989[_0xe7cf('0x31')],_0x2ad989[_0xe7cf('0x32')]);_0x9e8d15[_0xe7cf('0x35')]=_[_0xe7cf('0x34')](_0x2ad989[_0xe7cf('0x31')],qs[_0xe7cf('0x36')](_0x317d99[_0xe7cf('0x32')][_0xe7cf('0x36')]));_0x9e8d15[_0xe7cf('0x35')]=_0x9e8d15[_0xe7cf('0x35')][_0xe7cf('0x37')]?_0x9e8d15['attributes']:_0x2ad989['model'];if(_0x317d99[_0xe7cf('0x32')][_0xe7cf('0x41')]){_0x9e8d15[_0xe7cf('0x42')]=[{'all':!![]}];}_0x9e8d15=_[_0xe7cf('0x3f')]({},_0x9e8d15,_0x317d99[_0xe7cf('0x47')]);return db['DeskField'][_0xe7cf('0x48')](_0x9e8d15)[_0xe7cf('0x27')](handleEntityNotFound(_0x636a97,null))['then'](respondWithResult(_0x636a97,null))[_0xe7cf('0x44')](handleError(_0x636a97,null));};exports[_0xe7cf('0x49')]=function(_0x324c47,_0x8474){return db[_0xe7cf('0x40')]['create'](_0x324c47[_0xe7cf('0x4a')],{})[_0xe7cf('0x27')](respondWithResult(_0x8474,0xc9))[_0xe7cf('0x44')](handleError(_0x8474,null));};exports[_0xe7cf('0x25')]=function(_0x5c2ad8,_0x2128ff){if(_0x5c2ad8['body']['id']){delete _0x5c2ad8[_0xe7cf('0x4a')]['id'];}return db[_0xe7cf('0x40')][_0xe7cf('0x48')]({'where':{'id':_0x5c2ad8[_0xe7cf('0x46')]['id']}})[_0xe7cf('0x27')](handleEntityNotFound(_0x2128ff,null))['then'](saveUpdates(_0x5c2ad8[_0xe7cf('0x4a')],null))['then'](respondWithResult(_0x2128ff,null))['catch'](handleError(_0x2128ff,null));};exports[_0xe7cf('0x26')]=function(_0x4052e2,_0x267d60){return db['DeskField'][_0xe7cf('0x48')]({'where':{'id':_0x4052e2['params']['id']}})['then'](handleEntityNotFound(_0x267d60,null))[_0xe7cf('0x27')](removeEntity(_0x267d60,null))[_0xe7cf('0x44')](handleError(_0x267d60,null));}; \ No newline at end of file +var _0x002d=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','name','send','index','map','DeskField','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','catch','create','body','find','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs'];(function(_0x4bd5c5,_0x2f05ec){var _0x113850=function(_0x2a7844){while(--_0x2a7844){_0x4bd5c5['push'](_0x4bd5c5['shift']());}};_0x113850(++_0x2f05ec);}(_0x002d,0xca));var _0xd002=function(_0x5e07c9,_0x2c8460){_0x5e07c9=_0x5e07c9-0x0;var _0x1af846=_0x002d[_0x5e07c9];return _0x1af846;};'use strict';var emlformat=require(_0xd002('0x0'));var rimraf=require(_0xd002('0x1'));var zipdir=require(_0xd002('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd002('0x3'));var BPromise=require(_0xd002('0x4'));var Mustache=require(_0xd002('0x5'));var util=require(_0xd002('0x6'));var path=require(_0xd002('0x7'));var sox=require(_0xd002('0x8'));var csv=require(_0xd002('0x9'));var ejs=require(_0xd002('0xa'));var fs=require('fs');var fs_extra=require(_0xd002('0xb'));var _=require(_0xd002('0xc'));var squel=require(_0xd002('0xd'));var crypto=require(_0xd002('0xe'));var jsforce=require(_0xd002('0xf'));var deskjs=require(_0xd002('0x10'));var toCsv=require(_0xd002('0x9'));var querystring=require(_0xd002('0x11'));var Papa=require(_0xd002('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd002('0x13'));var as=require(_0xd002('0x14'));var hardwareService=require(_0xd002('0x15'));var logger=require('../../config/logger')(_0xd002('0x16'));var utils=require(_0xd002('0x17'));var config=require(_0xd002('0x18'));var licenseUtil=require(_0xd002('0x19'));var db=require(_0xd002('0x1a'))['db'];function respondWithStatusCode(_0x1e6efa,_0x21a778){_0x21a778=_0x21a778||0xcc;return function(_0x28920f){if(_0x28920f){return _0x1e6efa[_0xd002('0x1b')](_0x21a778);}return _0x1e6efa[_0xd002('0x1c')](_0x21a778)[_0xd002('0x1d')]();};}function respondWithResult(_0x4de1c3,_0x3cbe14){_0x3cbe14=_0x3cbe14||0xc8;return function(_0x1e5c3b){if(_0x1e5c3b){return _0x4de1c3['status'](_0x3cbe14)['json'](_0x1e5c3b);}};}function respondWithFilteredResult(_0x5bc910,_0x460e7b){return function(_0x53cd4b){if(_0x53cd4b){var _0x13acd5=typeof _0x460e7b[_0xd002('0x1e')]===_0xd002('0x1f')&&typeof _0x460e7b[_0xd002('0x20')]===_0xd002('0x1f');var _0x124d97=_0x53cd4b[_0xd002('0x21')];var _0x5e1f31=_0x13acd5?0x0:_0x460e7b[_0xd002('0x1e')];var _0x4708f6=_0x13acd5?_0x53cd4b[_0xd002('0x21')]:_0x460e7b[_0xd002('0x1e')]+_0x460e7b[_0xd002('0x20')];var _0x4aa45d;if(_0x4708f6>=_0x124d97){_0x4708f6=_0x124d97;_0x4aa45d=0xc8;}else{_0x4aa45d=0xce;}_0x5bc910[_0xd002('0x1c')](_0x4aa45d);return _0x5bc910[_0xd002('0x22')](_0xd002('0x23'),_0x5e1f31+'-'+_0x4708f6+'/'+_0x124d97)[_0xd002('0x24')](_0x53cd4b);}return null;};}function patchUpdates(_0x5f3854){return function(_0x27c9c5){try{jsonpatch['apply'](_0x27c9c5,_0x5f3854,!![]);}catch(_0x490310){return BPromise[_0xd002('0x25')](_0x490310);}return _0x27c9c5[_0xd002('0x26')]();};}function saveUpdates(_0x1bfa76,_0x45cd2e){return function(_0x28cfb1){if(_0x28cfb1){return _0x28cfb1[_0xd002('0x27')](_0x1bfa76)[_0xd002('0x28')](function(_0x3a99ee){return _0x3a99ee;});}return null;};}function removeEntity(_0xe28024,_0x15ccfb){return function(_0x1a9884){if(_0x1a9884){return _0x1a9884[_0xd002('0x29')]()['then'](function(){_0xe28024[_0xd002('0x1c')](0xcc)[_0xd002('0x1d')]();});}};}function handleEntityNotFound(_0x55e3be,_0x32ac79){return function(_0x21fe25){if(!_0x21fe25){_0x55e3be[_0xd002('0x1b')](0x194);}return _0x21fe25;};}function handleError(_0x4df8db,_0x1c4b8a){_0x1c4b8a=_0x1c4b8a||0x1f4;return function(_0x4f58fa){logger['error'](_0x4f58fa['stack']);if(_0x4f58fa[_0xd002('0x2a')]){delete _0x4f58fa[_0xd002('0x2a')];}_0x4df8db[_0xd002('0x1c')](_0x1c4b8a)[_0xd002('0x2b')](_0x4f58fa);};}exports[_0xd002('0x2c')]=function(_0x24722d,_0x1648e1){var _0x3e0cc2={},_0x9999ea={},_0x70610d={'count':0x0,'rows':[]};var _0x5a79ba=_[_0xd002('0x2d')](db[_0xd002('0x2e')][_0xd002('0x2f')],function(_0x3b6653){return{'name':_0x3b6653['fieldName'],'type':_0x3b6653[_0xd002('0x30')]['key']};});_0x9999ea[_0xd002('0x31')]=_['map'](_0x5a79ba,_0xd002('0x2a'));_0x9999ea[_0xd002('0x32')]=_[_0xd002('0x33')](_0x24722d[_0xd002('0x32')]);_0x9999ea[_0xd002('0x34')]=_[_0xd002('0x35')](_0x9999ea[_0xd002('0x31')],_0x9999ea[_0xd002('0x32')]);_0x3e0cc2['attributes']=_[_0xd002('0x35')](_0x9999ea[_0xd002('0x31')],qs[_0xd002('0x36')](_0x24722d[_0xd002('0x32')][_0xd002('0x36')]));_0x3e0cc2[_0xd002('0x37')]=_0x3e0cc2['attributes']['length']?_0x3e0cc2['attributes']:_0x9999ea[_0xd002('0x31')];if(!_0x24722d['query'][_0xd002('0x38')](_0xd002('0x39'))){_0x3e0cc2[_0xd002('0x20')]=qs[_0xd002('0x20')](_0x24722d[_0xd002('0x32')][_0xd002('0x20')]);_0x3e0cc2[_0xd002('0x1e')]=qs[_0xd002('0x1e')](_0x24722d['query'][_0xd002('0x1e')]);}_0x3e0cc2[_0xd002('0x3a')]=qs['sort'](_0x24722d['query'][_0xd002('0x3b')]);_0x3e0cc2[_0xd002('0x3c')]=qs[_0xd002('0x34')](_[_0xd002('0x3d')](_0x24722d['query'],_0x9999ea[_0xd002('0x34')]),_0x5a79ba);if(_0x24722d['query'][_0xd002('0x3e')]){_0x3e0cc2[_0xd002('0x3c')]=_[_0xd002('0x3f')](_0x3e0cc2[_0xd002('0x3c')],{'$or':_[_0xd002('0x2d')](_0x5a79ba,function(_0x54c2ec){if(_0x54c2ec[_0xd002('0x30')]!==_0xd002('0x40')){var _0x23ad2e={};_0x23ad2e[_0x54c2ec[_0xd002('0x2a')]]={'$like':'%'+_0x24722d[_0xd002('0x32')][_0xd002('0x3e')]+'%'};return _0x23ad2e;}})});}_0x3e0cc2=_[_0xd002('0x3f')]({},_0x3e0cc2,_0x24722d[_0xd002('0x41')]);var _0x2693a9={'where':_0x3e0cc2[_0xd002('0x3c')]};return db[_0xd002('0x2e')][_0xd002('0x21')](_0x2693a9)[_0xd002('0x28')](function(_0x1509d0){_0x70610d[_0xd002('0x21')]=_0x1509d0;if(_0x24722d[_0xd002('0x32')]['includeAll']){_0x3e0cc2[_0xd002('0x42')]=[{'all':!![]}];}return db[_0xd002('0x2e')][_0xd002('0x43')](_0x3e0cc2);})[_0xd002('0x28')](function(_0x5339e3){_0x70610d[_0xd002('0x44')]=_0x5339e3;return _0x70610d;})[_0xd002('0x28')](respondWithFilteredResult(_0x1648e1,_0x3e0cc2))['catch'](handleError(_0x1648e1,null));};exports['show']=function(_0x3978a3,_0x382693){var _0x10ce62={'raw':!![],'where':{'id':_0x3978a3[_0xd002('0x45')]['id']}},_0x53e3ab={};_0x53e3ab['model']=_['keys'](db[_0xd002('0x2e')]['rawAttributes']);_0x53e3ab[_0xd002('0x32')]=_[_0xd002('0x33')](_0x3978a3['query']);_0x53e3ab[_0xd002('0x34')]=_[_0xd002('0x35')](_0x53e3ab[_0xd002('0x31')],_0x53e3ab[_0xd002('0x32')]);_0x10ce62[_0xd002('0x37')]=_['intersection'](_0x53e3ab['model'],qs[_0xd002('0x36')](_0x3978a3['query'][_0xd002('0x36')]));_0x10ce62[_0xd002('0x37')]=_0x10ce62['attributes']['length']?_0x10ce62[_0xd002('0x37')]:_0x53e3ab['model'];if(_0x3978a3[_0xd002('0x32')]['includeAll']){_0x10ce62[_0xd002('0x42')]=[{'all':!![]}];}_0x10ce62=_['merge']({},_0x10ce62,_0x3978a3[_0xd002('0x41')]);return db[_0xd002('0x2e')]['find'](_0x10ce62)[_0xd002('0x28')](handleEntityNotFound(_0x382693,null))[_0xd002('0x28')](respondWithResult(_0x382693,null))[_0xd002('0x46')](handleError(_0x382693,null));};exports[_0xd002('0x47')]=function(_0xe8893e,_0x246f9f){return db['DeskField'][_0xd002('0x47')](_0xe8893e[_0xd002('0x48')],{})[_0xd002('0x28')](respondWithResult(_0x246f9f,0xc9))[_0xd002('0x46')](handleError(_0x246f9f,null));};exports['update']=function(_0x1c5b7e,_0xf3edf0){if(_0x1c5b7e[_0xd002('0x48')]['id']){delete _0x1c5b7e[_0xd002('0x48')]['id'];}return db[_0xd002('0x2e')][_0xd002('0x49')]({'where':{'id':_0x1c5b7e['params']['id']}})[_0xd002('0x28')](handleEntityNotFound(_0xf3edf0,null))[_0xd002('0x28')](saveUpdates(_0x1c5b7e[_0xd002('0x48')],null))[_0xd002('0x28')](respondWithResult(_0xf3edf0,null))[_0xd002('0x46')](handleError(_0xf3edf0,null));};exports[_0xd002('0x29')]=function(_0x2f2c1f,_0x143060){return db[_0xd002('0x2e')][_0xd002('0x49')]({'where':{'id':_0x2f2c1f['params']['id']}})[_0xd002('0x28')](handleEntityNotFound(_0x143060,null))[_0xd002('0x28')](removeEntity(_0x143060,null))[_0xd002('0x46')](handleError(_0x143060,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 78979e1..1069564 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 _0xe955=['idField','FieldId','lodash','api','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes','exports','define','DeskField','desk_unique_index'];(function(_0xe39601,_0xbf94f1){var _0x204bd5=function(_0x26cf69){while(--_0x26cf69){_0xe39601['push'](_0xe39601['shift']());}};_0x204bd5(++_0xbf94f1);}(_0xe955,0x17b));var _0x5e95=function(_0x3149b3,_0x3d9bf1){_0x3149b3=_0x3149b3-0x0;var _0x37f4fb=_0xe955[_0x3149b3];return _0x37f4fb;};'use strict';var _=require(_0x5e95('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5e95('0x1'));var moment=require('moment');var BPromise=require(_0x5e95('0x2'));var rp=require(_0x5e95('0x3'));var fs=require('fs');var path=require(_0x5e95('0x4'));var rimraf=require('rimraf');var config=require(_0x5e95('0x5'));var attributes=require(_0x5e95('0x6'));module[_0x5e95('0x7')]=function(_0x4c6bc1,_0x363ded){return _0x4c6bc1[_0x5e95('0x8')](_0x5e95('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x5e95('0xa'),'fields':[_0x5e95('0xb'),_0x5e95('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4089=['desk_unique_index','idField','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','int_desk_fields'];(function(_0x25b4a4,_0x2e081b){var _0x707267=function(_0x440123){while(--_0x440123){_0x25b4a4['push'](_0x25b4a4['shift']());}};_0x707267(++_0x2e081b);}(_0x4089,0x16e));var _0x9408=function(_0x20d2a0,_0x13bb4f){_0x20d2a0=_0x20d2a0-0x0;var _0x3849c6=_0x4089[_0x20d2a0];return _0x3849c6;};'use strict';var _=require('lodash');var util=require(_0x9408('0x0'));var logger=require(_0x9408('0x1'))(_0x9408('0x2'));var moment=require(_0x9408('0x3'));var BPromise=require(_0x9408('0x4'));var rp=require(_0x9408('0x5'));var fs=require('fs');var path=require(_0x9408('0x6'));var rimraf=require(_0x9408('0x7'));var config=require(_0x9408('0x8'));var attributes=require(_0x9408('0x9'));module[_0x9408('0xa')]=function(_0x4ba9e8,_0x1b5624){return _0x4ba9e8['define']('DeskField',attributes,{'tableName':_0x9408('0xb'),'paranoid':![],'indexes':[{'name':_0x9408('0xc'),'fields':[_0x9408('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index cba43d4..736092f 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 _0x9fe7=['util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','DeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash'];(function(_0x2f9ae3,_0x3f01d1){var _0x3d7c59=function(_0x268bbc){while(--_0x268bbc){_0x2f9ae3['push'](_0x2f9ae3['shift']());}};_0x3d7c59(++_0x3f01d1);}(_0x9fe7,0xb3));var _0x79fe=function(_0x5736a1,_0x36b7a1){_0x5736a1=_0x5736a1-0x0;var _0x3de050=_0x9fe7[_0x5736a1];return _0x3de050;};'use strict';var _=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var moment=require('moment');var BPromise=require(_0x79fe('0x2'));var rs=require(_0x79fe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x79fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x79fe('0x5'));var config=require(_0x79fe('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x79fe('0x7')][_0x79fe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d00bd,_0x48f3ac,_0x4be6f0){return new BPromise(function(_0x17d563,_0x6b2554){return client[_0x79fe('0x9')](_0x2d00bd,_0x4be6f0)[_0x79fe('0xa')](function(_0x5c7abb){logger[_0x79fe('0xb')](_0x79fe('0xc'),_0x48f3ac,'request\x20sent');logger[_0x79fe('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0x48f3ac,_0x79fe('0xe'),JSON[_0x79fe('0xf')](_0x5c7abb));if(_0x5c7abb['error']){if(_0x5c7abb[_0x79fe('0x10')][_0x79fe('0x11')]===0x1f4){logger[_0x79fe('0x10')](_0x79fe('0xc'),_0x48f3ac,_0x5c7abb[_0x79fe('0x10')][_0x79fe('0x12')]);return _0x6b2554(_0x5c7abb[_0x79fe('0x10')]['message']);}logger['error']('DeskField,\x20%s,\x20%s',_0x48f3ac,_0x5c7abb['error'][_0x79fe('0x12')]);return _0x17d563(_0x5c7abb['error'][_0x79fe('0x12')]);}else{logger[_0x79fe('0xb')]('DeskField,\x20%s,\x20%s',_0x48f3ac,_0x79fe('0xe'));_0x17d563(_0x5c7abb['result'][_0x79fe('0x12')]);}})[_0x79fe('0x13')](function(_0x249d87){logger[_0x79fe('0x10')]('DeskField,\x20%s,\x20%s',_0x48f3ac,_0x249d87);_0x6b2554(_0x249d87);});});} \ No newline at end of file +var _0xfac0=['rpc','jayson/promise','client','http','request','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error','DeskField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0xfac0,0x187));var _0x0fac=function(_0x499311,_0x3b8bb0){_0x499311=_0x499311-0x0;var _0x9ae1f4=_0xfac0[_0x499311];return _0x9ae1f4;};'use strict';var _=require('lodash');var util=require(_0x0fac('0x0'));var moment=require(_0x0fac('0x1'));var BPromise=require(_0x0fac('0x2'));var rs=require(_0x0fac('0x3'));var fs=require('fs');var Redis=require(_0x0fac('0x4'));var db=require(_0x0fac('0x5'))['db'];var utils=require(_0x0fac('0x6'));var logger=require(_0x0fac('0x7'))(_0x0fac('0x8'));var config=require('../../config/environment');var jayson=require(_0x0fac('0x9'));var client=jayson[_0x0fac('0xa')][_0x0fac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc36286,_0x34a129,_0x7feb97){return new BPromise(function(_0x55f8e7,_0x285513){return client[_0x0fac('0xc')](_0xc36286,_0x7feb97)['then'](function(_0x23761d){logger['info']('DeskField,\x20%s,\x20%s',_0x34a129,_0x0fac('0xd'));logger['debug'](_0x0fac('0xe'),_0x34a129,_0x0fac('0xd'),JSON['stringify'](_0x23761d));if(_0x23761d[_0x0fac('0xf')]){if(_0x23761d[_0x0fac('0xf')]['code']===0x1f4){logger[_0x0fac('0xf')](_0x0fac('0x10'),_0x34a129,_0x23761d[_0x0fac('0xf')]['message']);return _0x285513(_0x23761d[_0x0fac('0xf')][_0x0fac('0x11')]);}logger[_0x0fac('0xf')](_0x0fac('0x10'),_0x34a129,_0x23761d[_0x0fac('0xf')]['message']);return _0x55f8e7(_0x23761d['error']['message']);}else{logger[_0x0fac('0x12')](_0x0fac('0x10'),_0x34a129,'request\x20sent');_0x55f8e7(_0x23761d[_0x0fac('0x13')][_0x0fac('0x11')]);}})[_0x0fac('0x14')](function(_0x4a6f9d){logger[_0x0fac('0xf')](_0x0fac('0x10'),_0x34a129,_0x4a6f9d);_0x285513(_0x4a6f9d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 4297fdc..cc7e827 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 _0x7086=['isAuthenticated','show','/:id/configurations','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0x7086,0x15c));var _0x6708=function(_0x5c5d11,_0x3b28df){_0x5c5d11=_0x5c5d11-0x0;var _0x211cb9=_0x7086[_0x5c5d11];return _0x211cb9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6708('0x0'));var timeout=require('connect-timeout');var express=require(_0x6708('0x1'));var router=express[_0x6708('0x2')]();var fs_extra=require(_0x6708('0x3'));var auth=require(_0x6708('0x4'));var interaction=require(_0x6708('0x5'));var config=require(_0x6708('0x6'));var controller=require(_0x6708('0x7'));router[_0x6708('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6708('0x8')]('/:id',auth[_0x6708('0x9')](),controller[_0x6708('0xa')]);router[_0x6708('0x8')](_0x6708('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x6708('0x8')]('/:id/fields',auth[_0x6708('0x9')](),controller['getFields']);router[_0x6708('0xc')]('/',auth[_0x6708('0x9')](),controller[_0x6708('0xd')]);router[_0x6708('0xc')](_0x6708('0xb'),auth['isAuthenticated'](),controller[_0x6708('0xe')]);router[_0x6708('0xf')](_0x6708('0x10'),auth['isAuthenticated'](),controller[_0x6708('0x11')]);router[_0x6708('0x12')](_0x6708('0x10'),auth['isAuthenticated'](),controller[_0x6708('0x13')]);module[_0x6708('0x14')]=router; \ No newline at end of file +var _0x7903=['getFields','post','create','addConfiguration','put','delete','/:id','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x21d6df,_0x11ae07){var _0x43e100=function(_0x5a9766){while(--_0x5a9766){_0x21d6df['push'](_0x21d6df['shift']());}};_0x43e100(++_0x11ae07);}(_0x7903,0xa8));var _0x3790=function(_0x4a4afc,_0x47ab1a){_0x4a4afc=_0x4a4afc-0x0;var _0x4c7f83=_0x7903[_0x4a4afc];return _0x4c7f83;};'use strict';var multer=require(_0x3790('0x0'));var util=require(_0x3790('0x1'));var path=require(_0x3790('0x2'));var timeout=require(_0x3790('0x3'));var express=require(_0x3790('0x4'));var router=express['Router']();var fs_extra=require(_0x3790('0x5'));var auth=require(_0x3790('0x6'));var interaction=require(_0x3790('0x7'));var config=require(_0x3790('0x8'));var controller=require('./intDynamics365Account.controller');router[_0x3790('0x9')]('/',auth[_0x3790('0xa')](),controller[_0x3790('0xb')]);router['get']('/:id',auth[_0x3790('0xa')](),controller[_0x3790('0xc')]);router[_0x3790('0x9')](_0x3790('0xd'),auth[_0x3790('0xa')](),controller[_0x3790('0xe')]);router[_0x3790('0x9')](_0x3790('0xf'),auth[_0x3790('0xa')](),controller[_0x3790('0x10')]);router[_0x3790('0x11')]('/',auth[_0x3790('0xa')](),controller[_0x3790('0x12')]);router[_0x3790('0x11')](_0x3790('0xd'),auth[_0x3790('0xa')](),controller[_0x3790('0x13')]);router[_0x3790('0x14')]('/:id',auth[_0x3790('0xa')](),controller['update']);router[_0x3790('0x15')](_0x3790('0x16'),auth[_0x3790('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 7efe347..4323275 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 _0xef0a=['exports','STRING','sequelize'];(function(_0x386a47,_0xd18e13){var _0x1ce25e=function(_0x197ae5){while(--_0x197ae5){_0x386a47['push'](_0x386a47['shift']());}};_0x1ce25e(++_0xd18e13);}(_0xef0a,0xdd));var _0xaef0=function(_0x21d630,_0x3298a9){_0x21d630=_0x21d630-0x0;var _0x5b91f3=_0xef0a[_0x21d630];return _0x5b91f3;};'use strict';var Sequelize=require(_0xaef0('0x0'));module[_0xaef0('0x1')]={'name':{'type':Sequelize[_0xaef0('0x2')]},'username':{'type':Sequelize[_0xaef0('0x2')]},'password':{'type':Sequelize[_0xaef0('0x2')]},'remoteUri':{'type':Sequelize[_0xaef0('0x2')]},'tenantId':{'type':Sequelize[_0xaef0('0x2')]},'clientId':{'type':Sequelize[_0xaef0('0x2')]},'clientSecret':{'type':Sequelize[_0xaef0('0x2')]},'serverUrl':{'type':Sequelize[_0xaef0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xaef0('0x2')]}}; \ No newline at end of file +var _0x6dd9=['exports','STRING','sequelize'];(function(_0x11262c,_0x20d80b){var _0x23977b=function(_0x273f88){while(--_0x273f88){_0x11262c['push'](_0x11262c['shift']());}};_0x23977b(++_0x20d80b);}(_0x6dd9,0xc5));var _0x96dd=function(_0x19cf51,_0x5ca5d6){_0x19cf51=_0x19cf51-0x0;var _0x2dedc9=_0x6dd9[_0x19cf51];return _0x2dedc9;};'use strict';var Sequelize=require(_0x96dd('0x0'));module[_0x96dd('0x1')]={'name':{'type':Sequelize[_0x96dd('0x2')]},'username':{'type':Sequelize[_0x96dd('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x96dd('0x2')]},'tenantId':{'type':Sequelize[_0x96dd('0x2')]},'clientId':{'type':Sequelize[_0x96dd('0x2')]},'clientSecret':{'type':Sequelize[_0x96dd('0x2')]},'serverUrl':{'type':Sequelize[_0x96dd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x96dd('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 28ca4e0..3292baf 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 _0x6b19=['%s/api/data/v9.0/','POST','/oauth2/token','password','access_token','GET','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','LogicalName','forEach','@odata.type','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','DisplayName','TrueOption','false','?$select=DisplayName,LogicalName','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','Dynamics365Account','includeAll','include','findAll','rows','show','options','catch','create','body','find','params','Dynamics365Configuration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','ownerid','caseorigincode','subject','phonenumber','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','overriddencreatedon','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','statecode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','findOne','username','tenantId','clientSecret','slice','substring','lastIndexOf','format'];(function(_0x2277ac,_0x5d7462){var _0x76a26b=function(_0x77b6f2){while(--_0x77b6f2){_0x2277ac['push'](_0x2277ac['shift']());}};_0x76a26b(++_0x5d7462);}(_0x6b19,0xe8));var _0x96b1=function(_0xbc343a,_0x50959e){_0xbc343a=_0xbc343a-0x0;var _0x55049e=_0x6b19[_0xbc343a];return _0x55049e;};'use strict';var emlformat=require(_0x96b1('0x0'));var rimraf=require(_0x96b1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x96b1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x96b1('0x3'));var Mustache=require(_0x96b1('0x4'));var util=require(_0x96b1('0x5'));var path=require(_0x96b1('0x6'));var sox=require(_0x96b1('0x7'));var csv=require('to-csv');var ejs=require(_0x96b1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96b1('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x96b1('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x96b1('0xb'));var querystring=require('querystring');var Papa=require(_0x96b1('0xc'));var Redis=require(_0x96b1('0xd'));var authService=require(_0x96b1('0xe'));var qs=require(_0x96b1('0xf'));var as=require(_0x96b1('0x10'));var hardwareService=require(_0x96b1('0x11'));var logger=require(_0x96b1('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x96b1('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x96b1('0x14'));function respondWithStatusCode(_0x18c9a0,_0x13e6c1){_0x13e6c1=_0x13e6c1||0xcc;return function(_0x5bc87e){if(_0x5bc87e){return _0x18c9a0[_0x96b1('0x15')](_0x13e6c1);}return _0x18c9a0[_0x96b1('0x16')](_0x13e6c1)[_0x96b1('0x17')]();};}function respondWithResult(_0x2119b1,_0x46b2bb){_0x46b2bb=_0x46b2bb||0xc8;return function(_0x4f4150){if(_0x4f4150){return _0x2119b1[_0x96b1('0x16')](_0x46b2bb)[_0x96b1('0x18')](_0x4f4150);}};}function respondWithFilteredResult(_0x23ce63,_0x12233d){return function(_0x2cd1f5){if(_0x2cd1f5){var _0x43b7f5=typeof _0x12233d[_0x96b1('0x19')]===_0x96b1('0x1a')&&typeof _0x12233d[_0x96b1('0x1b')]===_0x96b1('0x1a');var _0x450099=_0x2cd1f5[_0x96b1('0x1c')];var _0x2b192a=_0x43b7f5?0x0:_0x12233d[_0x96b1('0x19')];var _0x212b31=_0x43b7f5?_0x2cd1f5['count']:_0x12233d[_0x96b1('0x19')]+_0x12233d['limit'];var _0x33ac6d;if(_0x212b31>=_0x450099){_0x212b31=_0x450099;_0x33ac6d=0xc8;}else{_0x33ac6d=0xce;}_0x23ce63[_0x96b1('0x16')](_0x33ac6d);return _0x23ce63[_0x96b1('0x1d')]('Content-Range',_0x2b192a+'-'+_0x212b31+'/'+_0x450099)[_0x96b1('0x18')](_0x2cd1f5);}return null;};}function patchUpdates(_0x428fe2){return function(_0x48786f){try{jsonpatch['apply'](_0x48786f,_0x428fe2,!![]);}catch(_0x2b7d4d){return BPromise[_0x96b1('0x1e')](_0x2b7d4d);}return _0x48786f[_0x96b1('0x1f')]();};}function saveUpdates(_0x18594b,_0x555185){return function(_0x301ba2){if(_0x301ba2){return _0x301ba2[_0x96b1('0x20')](_0x18594b)[_0x96b1('0x21')](function(_0x54699d){return _0x54699d;});}return null;};}function removeEntity(_0x2b4f8e,_0x370f15){return function(_0x28b42b){if(_0x28b42b){return _0x28b42b[_0x96b1('0x22')]()['then'](function(){_0x2b4f8e[_0x96b1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21ac25,_0x4ad19f){return function(_0x6509d2){if(!_0x6509d2){_0x21ac25[_0x96b1('0x15')](0x194);}return _0x6509d2;};}function handleError(_0x4fb8de,_0x50dcbc){_0x50dcbc=_0x50dcbc||0x1f4;return function(_0x4b1fbe){logger[_0x96b1('0x23')](_0x4b1fbe[_0x96b1('0x24')]);if(_0x4b1fbe[_0x96b1('0x25')]){delete _0x4b1fbe[_0x96b1('0x25')];}_0x4fb8de[_0x96b1('0x16')](_0x50dcbc)['send'](_0x4b1fbe);};}exports[_0x96b1('0x26')]=function(_0x9f1153,_0x3cadbb){var _0x209ce8={},_0x51e2c1={},_0x30dd00={'count':0x0,'rows':[]};var _0x33f96b=_['map'](db['Dynamics365Account'][_0x96b1('0x27')],function(_0x53a198){return{'name':_0x53a198[_0x96b1('0x28')],'type':_0x53a198[_0x96b1('0x29')]['key']};});_0x51e2c1[_0x96b1('0x2a')]=_[_0x96b1('0x2b')](_0x33f96b,'name');_0x51e2c1[_0x96b1('0x2c')]=_[_0x96b1('0x2d')](_0x9f1153[_0x96b1('0x2c')]);_0x51e2c1['filters']=_[_0x96b1('0x2e')](_0x51e2c1[_0x96b1('0x2a')],_0x51e2c1[_0x96b1('0x2c')]);_0x209ce8[_0x96b1('0x2f')]=_[_0x96b1('0x2e')](_0x51e2c1[_0x96b1('0x2a')],qs['fields'](_0x9f1153[_0x96b1('0x2c')][_0x96b1('0x30')]));_0x209ce8['attributes']=_0x209ce8['attributes'][_0x96b1('0x31')]?_0x209ce8[_0x96b1('0x2f')]:_0x51e2c1[_0x96b1('0x2a')];if(!_0x9f1153['query']['hasOwnProperty'](_0x96b1('0x32'))){_0x209ce8[_0x96b1('0x1b')]=qs[_0x96b1('0x1b')](_0x9f1153[_0x96b1('0x2c')]['limit']);_0x209ce8[_0x96b1('0x19')]=qs['offset'](_0x9f1153[_0x96b1('0x2c')][_0x96b1('0x19')]);}_0x209ce8[_0x96b1('0x33')]=qs['sort'](_0x9f1153[_0x96b1('0x2c')][_0x96b1('0x34')]);_0x209ce8[_0x96b1('0x35')]=qs[_0x96b1('0x36')](_[_0x96b1('0x37')](_0x9f1153[_0x96b1('0x2c')],_0x51e2c1['filters']),_0x33f96b);if(_0x9f1153[_0x96b1('0x2c')][_0x96b1('0x38')]){_0x209ce8['where']=_[_0x96b1('0x39')](_0x209ce8['where'],{'$or':_[_0x96b1('0x2b')](_0x33f96b,function(_0x1d351d){if(_0x1d351d[_0x96b1('0x29')]!==_0x96b1('0x3a')){var _0x30be03={};_0x30be03[_0x1d351d[_0x96b1('0x25')]]={'$like':'%'+_0x9f1153[_0x96b1('0x2c')][_0x96b1('0x38')]+'%'};return _0x30be03;}})});}_0x209ce8=_[_0x96b1('0x39')]({},_0x209ce8,_0x9f1153['options']);var _0x94d1e6={'where':_0x209ce8[_0x96b1('0x35')]};return db[_0x96b1('0x3b')][_0x96b1('0x1c')](_0x94d1e6)[_0x96b1('0x21')](function(_0x961a2a){_0x30dd00[_0x96b1('0x1c')]=_0x961a2a;if(_0x9f1153[_0x96b1('0x2c')][_0x96b1('0x3c')]){_0x209ce8[_0x96b1('0x3d')]=[{'all':!![]}];}return db[_0x96b1('0x3b')][_0x96b1('0x3e')](_0x209ce8);})[_0x96b1('0x21')](function(_0x202784){_0x30dd00[_0x96b1('0x3f')]=_0x202784;return _0x30dd00;})['then'](respondWithFilteredResult(_0x3cadbb,_0x209ce8))['catch'](handleError(_0x3cadbb,null));};exports[_0x96b1('0x40')]=function(_0x2fdcb8,_0x5282dd){var _0x2d0e9b={'raw':![],'where':{'id':_0x2fdcb8['params']['id']}},_0x445ae5={};_0x445ae5['model']=_['keys'](db[_0x96b1('0x3b')][_0x96b1('0x27')]);_0x445ae5[_0x96b1('0x2c')]=_[_0x96b1('0x2d')](_0x2fdcb8[_0x96b1('0x2c')]);_0x445ae5[_0x96b1('0x36')]=_[_0x96b1('0x2e')](_0x445ae5[_0x96b1('0x2a')],_0x445ae5[_0x96b1('0x2c')]);_0x2d0e9b[_0x96b1('0x2f')]=_['intersection'](_0x445ae5[_0x96b1('0x2a')],qs['fields'](_0x2fdcb8[_0x96b1('0x2c')]['fields']));_0x2d0e9b[_0x96b1('0x2f')]=_0x2d0e9b['attributes'][_0x96b1('0x31')]?_0x2d0e9b[_0x96b1('0x2f')]:_0x445ae5[_0x96b1('0x2a')];if(_0x2fdcb8[_0x96b1('0x2c')][_0x96b1('0x3c')]){_0x2d0e9b['include']=[{'all':!![]}];}_0x2d0e9b=_[_0x96b1('0x39')]({},_0x2d0e9b,_0x2fdcb8[_0x96b1('0x41')]);return db[_0x96b1('0x3b')]['find'](_0x2d0e9b)[_0x96b1('0x21')](handleEntityNotFound(_0x5282dd,null))[_0x96b1('0x21')](respondWithResult(_0x5282dd,null))[_0x96b1('0x42')](handleError(_0x5282dd,null));};exports[_0x96b1('0x43')]=function(_0x4919b2,_0x191b12){return db[_0x96b1('0x3b')]['create'](_0x4919b2[_0x96b1('0x44')],{})[_0x96b1('0x21')](respondWithResult(_0x191b12,0xc9))[_0x96b1('0x42')](handleError(_0x191b12,null));};exports[_0x96b1('0x20')]=function(_0x2d6446,_0x1fadc4){if(_0x2d6446['body']['id']){delete _0x2d6446[_0x96b1('0x44')]['id'];}return db['Dynamics365Account'][_0x96b1('0x45')]({'where':{'id':_0x2d6446[_0x96b1('0x46')]['id']}})['then'](handleEntityNotFound(_0x1fadc4,null))[_0x96b1('0x21')](saveUpdates(_0x2d6446[_0x96b1('0x44')],null))['then'](respondWithResult(_0x1fadc4,null))[_0x96b1('0x42')](handleError(_0x1fadc4,null));};exports[_0x96b1('0x22')]=function(_0x2087ba,_0x3a7301){return db[_0x96b1('0x3b')][_0x96b1('0x45')]({'where':{'id':_0x2087ba[_0x96b1('0x46')]['id']}})[_0x96b1('0x21')](handleEntityNotFound(_0x3a7301,null))[_0x96b1('0x21')](removeEntity(_0x3a7301,null))[_0x96b1('0x42')](handleError(_0x3a7301,null));};exports['getConfigurations']=function(_0x296960,_0x220551,_0x12b862){var _0x1e89fe={};var _0x471177={};var _0x1e087d;var _0x420d36;return db[_0x96b1('0x3b')]['findOne']({'where':{'id':_0x296960['params']['id']}})[_0x96b1('0x21')](handleEntityNotFound(_0x220551,null))[_0x96b1('0x21')](function(_0x594d3c){if(_0x594d3c){_0x1e087d=_0x594d3c;_0x471177[_0x96b1('0x2a')]=_[_0x96b1('0x2d')](db[_0x96b1('0x47')]['rawAttributes']);_0x471177[_0x96b1('0x2c')]=_[_0x96b1('0x2d')](_0x296960['query']);_0x471177['filters']=_[_0x96b1('0x2e')](_0x471177[_0x96b1('0x2a')],_0x471177[_0x96b1('0x2c')]);_0x1e89fe[_0x96b1('0x2f')]=_[_0x96b1('0x2e')](_0x471177[_0x96b1('0x2a')],qs[_0x96b1('0x30')](_0x296960[_0x96b1('0x2c')][_0x96b1('0x30')]));_0x1e89fe[_0x96b1('0x2f')]=_0x1e89fe[_0x96b1('0x2f')][_0x96b1('0x31')]?_0x1e89fe['attributes']:_0x471177[_0x96b1('0x2a')];_0x1e89fe[_0x96b1('0x33')]=qs[_0x96b1('0x34')](_0x296960[_0x96b1('0x2c')][_0x96b1('0x34')]);_0x1e89fe[_0x96b1('0x35')]=qs[_0x96b1('0x36')](_['pick'](_0x296960[_0x96b1('0x2c')],_0x471177['filters']));if(_0x296960['query'][_0x96b1('0x38')]){_0x1e89fe[_0x96b1('0x35')]=_[_0x96b1('0x39')](_0x1e89fe[_0x96b1('0x35')],{'$or':_[_0x96b1('0x2b')](_0x1e89fe[_0x96b1('0x2f')],function(_0x38b16d){var _0x4fbac3={};_0x4fbac3[_0x38b16d]={'$like':'%'+_0x296960[_0x96b1('0x2c')]['filter']+'%'};return _0x4fbac3;})});}_0x1e89fe=_[_0x96b1('0x39')]({},_0x1e89fe,_0x296960['options']);return _0x1e087d[_0x96b1('0x48')](_0x1e89fe);}})[_0x96b1('0x21')](function(_0x49def8){if(_0x49def8){_0x420d36=_0x49def8[_0x96b1('0x31')];if(!_0x296960[_0x96b1('0x2c')][_0x96b1('0x49')](_0x96b1('0x32'))){_0x1e89fe['limit']=qs['limit'](_0x296960[_0x96b1('0x2c')][_0x96b1('0x1b')]);_0x1e89fe[_0x96b1('0x19')]=qs[_0x96b1('0x19')](_0x296960['query'][_0x96b1('0x19')]);}return _0x1e087d[_0x96b1('0x48')](_0x1e89fe);}})[_0x96b1('0x21')](function(_0x2048d6){if(_0x2048d6){return _0x2048d6?{'count':_0x420d36,'rows':_0x2048d6}:null;}})[_0x96b1('0x21')](respondWithResult(_0x220551,null))[_0x96b1('0x42')](handleError(_0x220551,null));};exports[_0x96b1('0x4a')]=function(_0x337b31,_0x1ebb27,_0x506099){if(_0x337b31['body']['id']){delete _0x337b31[_0x96b1('0x44')]['id'];}return db[_0x96b1('0x3b')]['findOne']({'where':{'id':_0x337b31['params']['id']}})[_0x96b1('0x21')](handleEntityNotFound(_0x1ebb27,null))[_0x96b1('0x21')](function(_0x2d98dd){if(_0x2d98dd){_0x337b31[_0x96b1('0x44')][_0x96b1('0x4b')]=_0x2d98dd['id'];_0x337b31[_0x96b1('0x44')][_0x96b1('0x4c')]=integrations['getSubjects'](_0x337b31['body'][_0x96b1('0x4d')],_0x337b31[_0x96b1('0x44')]['type']);_0x337b31['body'][_0x96b1('0x4e')]=integrations[_0x96b1('0x4f')](_0x337b31['body'][_0x96b1('0x4d')],_0x337b31[_0x96b1('0x44')][_0x96b1('0x29')]);return db[_0x96b1('0x47')][_0x96b1('0x43')](_0x337b31[_0x96b1('0x44')],{'include':[{'model':db['Dynamics365Field'],'as':_0x96b1('0x4c')},{'model':db[_0x96b1('0x50')],'as':_0x96b1('0x4e')}]});}return null;})[_0x96b1('0x21')](respondWithResult(_0x1ebb27,null))['catch'](handleError(_0x1ebb27,null));};exports[_0x96b1('0x51')]=function(_0x56d007,_0x24cc85,_0x30547f){var _0x397f51=_0x56d007[_0x96b1('0x2c')][_0x96b1('0x52')];var _0x1d9897=_0x397f51===_0x96b1('0x53')?_0x96b1('0x54'):_0x96b1('0x55');var _0x30553c='';var _0x3e7a23='';var _0x4e173b='';var _0x9b7f1a='';var _0x1cccb3='';var _0x45e093='';var _0x1b35ed='';var _0xc3f8d9='';var _0x51b25b=[_0x96b1('0x56'),_0x96b1('0x57'),'customerid',_0x96b1('0x58'),_0x96b1('0x59'),_0x96b1('0x5a'),_0x96b1('0x5b'),'regardingobjectid','directioncode','phonecall_activity_parties'];var _0x5ea76d=[_0x96b1('0x5c'),_0x96b1('0x5d'),'actualserviceunits',_0x96b1('0x5e'),_0x96b1('0x5f'),_0x96b1('0x60'),'contractdetailidname',_0x96b1('0x61'),_0x96b1('0x62'),_0x96b1('0x63'),'createdbyname',_0x96b1('0x64'),_0x96b1('0x65'),_0x96b1('0x66'),_0x96b1('0x67'),_0x96b1('0x68'),'customeridtype',_0x96b1('0x69'),'emailaddress','entitlementidname',_0x96b1('0x6a'),_0x96b1('0x6b'),_0x96b1('0x6c'),_0x96b1('0x6d'),'firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname',_0x96b1('0x6e'),'masteridname',_0x96b1('0x6f'),_0x96b1('0x70'),_0x96b1('0x71'),_0x96b1('0x72'),'modifiedon',_0x96b1('0x73'),_0x96b1('0x74'),'msdyn_incidenttypename',_0x96b1('0x75'),'numberofchildincidents','onholdtime',_0x96b1('0x76'),'owneridname',_0x96b1('0x77'),'owneridyominame',_0x96b1('0x78'),_0x96b1('0x79'),_0x96b1('0x7a'),'prioritycodename',_0x96b1('0x7b'),_0x96b1('0x7c'),_0x96b1('0x7d'),'resolvebykpiidname',_0x96b1('0x7e'),_0x96b1('0x7f'),'responsiblecontactidyominame',_0x96b1('0x80'),_0x96b1('0x81'),'slaname','socialprofileidname',_0x96b1('0x82'),'statuscode',_0x96b1('0x83'),'ticketnumber',_0x96b1('0x84'),_0x96b1('0x85'),_0x96b1('0x86'),_0x96b1('0x87'),_0x96b1('0x88')];var _0x5be750=_0x51b25b[_0x96b1('0x89')](_0x5ea76d);return db[_0x96b1('0x3b')][_0x96b1('0x8a')]({'where':{'id':_0x56d007['params']['id']},'attributes':['id',_0x96b1('0x8b'),'password','remoteUri',_0x96b1('0x8c'),'clientId',_0x96b1('0x8d')]})['then'](handleEntityNotFound(_0x24cc85,null))['then'](function(_0xe2f757){if(_0xe2f757){_0xc3f8d9=_0xe2f757['remoteUri'];var _0x23c398=_0xc3f8d9[_0x96b1('0x8e')](-0x1);if(_0x23c398==='/'){_0xc3f8d9=_0xc3f8d9[_0x96b1('0x8f')](0x0,_0xc3f8d9[_0x96b1('0x90')](_0x23c398));}_0x1b35ed=util[_0x96b1('0x91')](_0x96b1('0x92'),_0xc3f8d9);var _0x5ea80c={'method':_0x96b1('0x93'),'uri':'https://login.microsoftonline.com/'+_0xe2f757[_0x96b1('0x8c')]+_0x96b1('0x94'),'form':{'client_id':_0xe2f757['clientId'],'resource':_0xc3f8d9,'username':_0xe2f757[_0x96b1('0x8b')],'password':_0xe2f757[_0x96b1('0x95')],'grant_type':'password','client_secret':_0xe2f757[_0x96b1('0x8d')]},'json':!![]};return rp(_0x5ea80c);}})[_0x96b1('0x21')](function(_0x5846ef){_0x45e093=_0x5846ef[_0x96b1('0x96')];var _0x566e6b={'method':_0x96b1('0x97'),'uri':encodeURI(_0x1b35ed+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x1d9897+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x45e093,'If-None-Match':null,'OData-Version':_0x96b1('0x98')},'json':!![]};return rp(_0x566e6b);})[_0x96b1('0x21')](function(_0x2abf3e){var _0x28788a=_0x2abf3e['value'][0x0];var _0x1ab428=_0x28788a[_0x96b1('0x99')];var _0xd410e4={'method':_0x96b1('0x97'),'uri':_0x1b35ed+_0x96b1('0x9a')+_0x1ab428+_0x96b1('0x9b'),'headers':{'Authorization':_0x96b1('0x9c')+_0x45e093,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xd410e4);})[_0x96b1('0x21')](function(_0xf77d1b){_0x30553c=_0xf77d1b;_0x3e7a23=_0x30553c[_0x96b1('0x9d')];_0x3e7a23=_[_0x96b1('0x9e')](_0x3e7a23,function(_0x573caa){return!_0x5be750['includes'](_0x573caa[_0x96b1('0x9f')]);});var _0x37be2a=[];var _0x454f3d=[];_0x3e7a23[_0x96b1('0xa0')](function(_0x10583d){if(_0x10583d[_0x96b1('0xa1')]){var _0x349688=_0x10583d[_0x96b1('0xa1')][_0x96b1('0x8f')](_0x10583d[_0x96b1('0xa1')]['lastIndexOf']('.')+0x1);if(_0x349688==='PicklistAttributeMetadata'){_0x37be2a[_0x96b1('0xa2')](getSelectList(_0x1b35ed,_0x397f51,_0x454f3d,_0x30553c[_0x96b1('0x99')],_0x10583d[_0x96b1('0x99')],_0x45e093));}}});return Promise[_0x96b1('0xa3')](_0x37be2a);})[_0x96b1('0x21')](function(_0x4510cb){_0x4e173b=_0x4510cb[0x0];var _0x542c02=[];var _0x20fb44=[];_0x3e7a23['forEach'](function(_0x4359df){if(!_[_0x96b1('0xa4')](_0x4359df[_0x96b1('0xa1')])){var _0x162ece=_0x4359df[_0x96b1('0xa1')][_0x96b1('0x8f')](_0x4359df['@odata.type'][_0x96b1('0x90')]('.')+0x1);if(_0x162ece===_0x96b1('0xa5')){_0x542c02[_0x96b1('0xa2')](getBooleanList(_0x1b35ed,_0x397f51,_0x20fb44,_0x30553c[_0x96b1('0x99')],_0x4359df['MetadataId'],_0x45e093));}}});return Promise[_0x96b1('0xa3')](_0x542c02);})[_0x96b1('0x21')](function(_0x56d00e){_0x9b7f1a=_0x56d00e[0x0];var _0x566166=[];var _0x2258a9=[];_0x3e7a23[_0x96b1('0xa0')](function(_0x46642f){if(_0x46642f[_0x96b1('0xa1')]){var _0x5cdfc2=_0x46642f[_0x96b1('0xa1')]['substring'](_0x46642f[_0x96b1('0xa1')][_0x96b1('0x90')]('.')+0x1);if(_0x5cdfc2===_0x96b1('0xa6')||_0x5cdfc2===_0x96b1('0xa7')||_0x5cdfc2===_0x96b1('0xa8')||_0x5cdfc2===_0x96b1('0xa9')||_0x5cdfc2===_0x96b1('0xaa')||_0x5cdfc2==='DateTimeAttributeMetadata'||_0x5cdfc2===_0x96b1('0xab')||_0x5cdfc2===_0x96b1('0xac')||_0x5cdfc2===_0x96b1('0xad')||_0x5cdfc2===_0x96b1('0xae')){_0x566166[_0x96b1('0xa2')](getInputList(_0x1b35ed,_0x397f51,_0x5cdfc2,_0x2258a9,_0x30553c[_0x96b1('0x99')],_0x46642f[_0x96b1('0x99')],_0x45e093));}}});return Promise[_0x96b1('0xa3')](_0x566166);})['then'](function(_0x24a5d1){_0x1cccb3=_0x24a5d1[0x0];var _0x3c621e=_0x4e173b[_0x96b1('0x89')](_0x9b7f1a)[_0x96b1('0x89')](_0x1cccb3);var _0x2ab618={'count':_0x3c621e['length'],'rows':_0x3c621e};return _0x2ab618;})['then'](respondWithResult(_0x24cc85,null))[_0x96b1('0x42')](function(_0x2c8c8f){var _0x11efe4=_0x56d007[_0x96b1('0x2c')][_0x96b1('0xaf')]?0x1f4:_0x2c8c8f[_0x96b1('0xb0')]||0x1f4;logger['error'](_0x2c8c8f[_0x96b1('0x24')]);delete _0x2c8c8f[_0x96b1('0x25')];if(_0x11efe4===0x191){_0x11efe4=0x190;}_0x24cc85['status'](_0x11efe4)['send'](_0x56d007[_0x96b1('0x2c')]['test']?{'message':_0x96b1('0xb1'),'statusCode':_0x2c8c8f[_0x96b1('0xb0')]}:_0x2c8c8f);});};function getSelectList(_0x1aff9d,_0x1d7046,_0x481bbf,_0x5c28af,_0x567436,_0x168756){var _0x7ae09e={'method':'GET','uri':_0x1aff9d+_0x96b1('0x9a')+_0x5c28af+_0x96b1('0xb2')+_0x567436+_0x96b1('0xb3')+_0x96b1('0xb4'),'headers':{'Authorization':'Bearer\x20'+_0x168756,'If-None-Match':null,'OData-Version':_0x96b1('0x98')},'json':!![]};return rp(_0x7ae09e)[_0x96b1('0x21')](function(_0x295884){var _0x468e51=[];var _0x443d7a=_0x295884[_0x96b1('0xb5')]['Options'];_0x443d7a['forEach'](function(_0x30a4ff){_0x468e51[_0x96b1('0xa2')]({'name':_0x30a4ff[_0x96b1('0xb6')][_0x96b1('0xb7')]['Label'],'value':String(_0x30a4ff[_0x96b1('0xb8')])});});var _0x2783f3={'id':_0x1d7046+'_'+_0x295884[_0x96b1('0x9f')],'name':_0x295884[_0x96b1('0xb9')][_0x96b1('0xb7')]['Label'],'custom':![],'options':_0x468e51};_0x481bbf[_0x96b1('0xa2')](_0x2783f3);return _0x481bbf;});}function getBooleanList(_0x3b41b1,_0x406b80,_0x1b4326,_0x42341b,_0x163fb4,_0x13c498){var _0x2845b8={'method':_0x96b1('0x97'),'uri':_0x3b41b1+_0x96b1('0x9a')+_0x42341b+')/Attributes('+_0x163fb4+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x13c498,'If-None-Match':null,'OData-Version':_0x96b1('0x98')},'json':!![]};return rp(_0x2845b8)[_0x96b1('0x21')](function(_0x57a731){var _0x33be47=[];_0x33be47[_0x96b1('0xa2')]({'name':_0x57a731[_0x96b1('0xb5')][_0x96b1('0xba')][_0x96b1('0xb6')][_0x96b1('0xb7')][_0x96b1('0xb6')],'value':'true'},{'name':_0x57a731[_0x96b1('0xb5')]['FalseOption'][_0x96b1('0xb6')][_0x96b1('0xb7')][_0x96b1('0xb6')],'value':_0x96b1('0xbb')});var _0x787b0e={'id':_0x406b80+'_'+_0x57a731['LogicalName'],'name':_0x57a731[_0x96b1('0xb9')][_0x96b1('0xb7')][_0x96b1('0xb6')],'custom':![],'options':_0x33be47};_0x1b4326['push'](_0x787b0e);return _0x1b4326;});}function getInputList(_0x45f744,_0x3a404d,_0x12bdfc,_0xd0f773,_0x4ec77f,_0x371258,_0x370ba4){var _0x366a86={'method':_0x96b1('0x97'),'uri':_0x45f744+_0x96b1('0x9a')+_0x4ec77f+')/Attributes('+_0x371258+')/Microsoft.Dynamics.CRM.'+_0x12bdfc+_0x96b1('0xbc'),'headers':{'Authorization':_0x96b1('0x9c')+_0x370ba4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x366a86)[_0x96b1('0x21')](function(_0x328880){var _0x5be0dd={'id':_0x3a404d+'_'+_0x328880[_0x96b1('0x9f')],'name':_0x328880['DisplayName']['UserLocalizedLabel']?_0x328880[_0x96b1('0xb9')][_0x96b1('0xb7')][_0x96b1('0xb6')]:_0x328880['LogicalName'],'custom':![],'options':[]};_0xd0f773[_0x96b1('0xa2')](_0x5be0dd);return _0xd0f773;});} \ No newline at end of file +var _0x0c29=['undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','sort','where','filters','pick','VIRTUAL','filter','options','Dynamics365Account','includeAll','include','findAll','rows','show','params','keys','merge','find','catch','create','body','Dynamics365Configuration','order','getConfigurations','hasOwnProperty','addConfiguration','findOne','Subjects','getDescriptions','channel','Dynamics365Field','Descriptions','getFields','incident','Incident','PhoneCall','title','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','slainvokedidname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials','Options','Label','UserLocalizedLabel','Value',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','OptionSet','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','zip-dir','request-promise','moment','bluebird','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/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0c29,0xb7));var _0x90c2=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x0c29[_0x54d4fe];return _0x1ab5bb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x90c2('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x90c2('0x1'));var moment=require(_0x90c2('0x2'));var BPromise=require(_0x90c2('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x90c2('0x4'));var sox=require(_0x90c2('0x5'));var csv=require(_0x90c2('0x6'));var ejs=require(_0x90c2('0x7'));var fs=require('fs');var fs_extra=require(_0x90c2('0x8'));var _=require(_0x90c2('0x9'));var squel=require(_0x90c2('0xa'));var crypto=require(_0x90c2('0xb'));var jsforce=require(_0x90c2('0xc'));var deskjs=require(_0x90c2('0xd'));var toCsv=require(_0x90c2('0x6'));var querystring=require(_0x90c2('0xe'));var Papa=require(_0x90c2('0xf'));var Redis=require(_0x90c2('0x10'));var authService=require(_0x90c2('0x11'));var qs=require(_0x90c2('0x12'));var as=require(_0x90c2('0x13'));var hardwareService=require(_0x90c2('0x14'));var logger=require(_0x90c2('0x15'))(_0x90c2('0x16'));var utils=require('../../config/utils');var config=require(_0x90c2('0x17'));var licenseUtil=require(_0x90c2('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x90c2('0x19'));function respondWithStatusCode(_0x4119b7,_0x3f4283){_0x3f4283=_0x3f4283||0xcc;return function(_0x20d60f){if(_0x20d60f){return _0x4119b7[_0x90c2('0x1a')](_0x3f4283);}return _0x4119b7[_0x90c2('0x1b')](_0x3f4283)[_0x90c2('0x1c')]();};}function respondWithResult(_0x5dbf9d,_0x421db4){_0x421db4=_0x421db4||0xc8;return function(_0x3afdaf){if(_0x3afdaf){return _0x5dbf9d[_0x90c2('0x1b')](_0x421db4)[_0x90c2('0x1d')](_0x3afdaf);}};}function respondWithFilteredResult(_0x58cee7,_0x21aa81){return function(_0x4d1d24){if(_0x4d1d24){var _0x30457e=typeof _0x21aa81[_0x90c2('0x1e')]===_0x90c2('0x1f')&&typeof _0x21aa81[_0x90c2('0x20')]==='undefined';var _0x39ba9d=_0x4d1d24[_0x90c2('0x21')];var _0x5ce404=_0x30457e?0x0:_0x21aa81[_0x90c2('0x1e')];var _0x4001a4=_0x30457e?_0x4d1d24['count']:_0x21aa81[_0x90c2('0x1e')]+_0x21aa81[_0x90c2('0x20')];var _0x3b31d0;if(_0x4001a4>=_0x39ba9d){_0x4001a4=_0x39ba9d;_0x3b31d0=0xc8;}else{_0x3b31d0=0xce;}_0x58cee7['status'](_0x3b31d0);return _0x58cee7[_0x90c2('0x22')](_0x90c2('0x23'),_0x5ce404+'-'+_0x4001a4+'/'+_0x39ba9d)[_0x90c2('0x1d')](_0x4d1d24);}return null;};}function patchUpdates(_0x58d5e5){return function(_0x540a71){try{jsonpatch['apply'](_0x540a71,_0x58d5e5,!![]);}catch(_0x165fbc){return BPromise[_0x90c2('0x24')](_0x165fbc);}return _0x540a71[_0x90c2('0x25')]();};}function saveUpdates(_0x1e0809,_0x1e88a8){return function(_0x39ce2d){if(_0x39ce2d){return _0x39ce2d[_0x90c2('0x26')](_0x1e0809)[_0x90c2('0x27')](function(_0x590d8d){return _0x590d8d;});}return null;};}function removeEntity(_0x5e7819,_0x4cb665){return function(_0x7e8af9){if(_0x7e8af9){return _0x7e8af9[_0x90c2('0x28')]()[_0x90c2('0x27')](function(){_0x5e7819[_0x90c2('0x1b')](0xcc)[_0x90c2('0x1c')]();});}};}function handleEntityNotFound(_0x11156d,_0x31facb){return function(_0x9358fa){if(!_0x9358fa){_0x11156d['sendStatus'](0x194);}return _0x9358fa;};}function handleError(_0x1d066b,_0x4b5f86){_0x4b5f86=_0x4b5f86||0x1f4;return function(_0x3317e1){logger[_0x90c2('0x29')](_0x3317e1[_0x90c2('0x2a')]);if(_0x3317e1[_0x90c2('0x2b')]){delete _0x3317e1['name'];}_0x1d066b[_0x90c2('0x1b')](_0x4b5f86)[_0x90c2('0x2c')](_0x3317e1);};}exports['index']=function(_0x2dcd84,_0x1e0015){var _0x28160b={},_0x147425={},_0x52b385={'count':0x0,'rows':[]};var _0x1798d5=_[_0x90c2('0x2d')](db['Dynamics365Account'][_0x90c2('0x2e')],function(_0xdf41c1){return{'name':_0xdf41c1[_0x90c2('0x2f')],'type':_0xdf41c1[_0x90c2('0x30')]['key']};});_0x147425[_0x90c2('0x31')]=_[_0x90c2('0x2d')](_0x1798d5,_0x90c2('0x2b'));_0x147425['query']=_['keys'](_0x2dcd84[_0x90c2('0x32')]);_0x147425['filters']=_['intersection'](_0x147425[_0x90c2('0x31')],_0x147425[_0x90c2('0x32')]);_0x28160b[_0x90c2('0x33')]=_[_0x90c2('0x34')](_0x147425[_0x90c2('0x31')],qs[_0x90c2('0x35')](_0x2dcd84[_0x90c2('0x32')][_0x90c2('0x35')]));_0x28160b['attributes']=_0x28160b['attributes'][_0x90c2('0x36')]?_0x28160b[_0x90c2('0x33')]:_0x147425[_0x90c2('0x31')];if(!_0x2dcd84[_0x90c2('0x32')]['hasOwnProperty']('nolimit')){_0x28160b['limit']=qs[_0x90c2('0x20')](_0x2dcd84[_0x90c2('0x32')][_0x90c2('0x20')]);_0x28160b[_0x90c2('0x1e')]=qs[_0x90c2('0x1e')](_0x2dcd84[_0x90c2('0x32')]['offset']);}_0x28160b['order']=qs[_0x90c2('0x37')](_0x2dcd84[_0x90c2('0x32')]['sort']);_0x28160b[_0x90c2('0x38')]=qs[_0x90c2('0x39')](_[_0x90c2('0x3a')](_0x2dcd84['query'],_0x147425['filters']),_0x1798d5);if(_0x2dcd84[_0x90c2('0x32')]['filter']){_0x28160b[_0x90c2('0x38')]=_['merge'](_0x28160b[_0x90c2('0x38')],{'$or':_['map'](_0x1798d5,function(_0xd25ae9){if(_0xd25ae9[_0x90c2('0x30')]!==_0x90c2('0x3b')){var _0x2a9e1e={};_0x2a9e1e[_0xd25ae9['name']]={'$like':'%'+_0x2dcd84['query'][_0x90c2('0x3c')]+'%'};return _0x2a9e1e;}})});}_0x28160b=_['merge']({},_0x28160b,_0x2dcd84[_0x90c2('0x3d')]);var _0x54ec86={'where':_0x28160b[_0x90c2('0x38')]};return db[_0x90c2('0x3e')]['count'](_0x54ec86)[_0x90c2('0x27')](function(_0x20653b){_0x52b385[_0x90c2('0x21')]=_0x20653b;if(_0x2dcd84['query'][_0x90c2('0x3f')]){_0x28160b[_0x90c2('0x40')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x90c2('0x41')](_0x28160b);})[_0x90c2('0x27')](function(_0x172cec){_0x52b385[_0x90c2('0x42')]=_0x172cec;return _0x52b385;})[_0x90c2('0x27')](respondWithFilteredResult(_0x1e0015,_0x28160b))['catch'](handleError(_0x1e0015,null));};exports[_0x90c2('0x43')]=function(_0x5978f4,_0x4520e0){var _0x537ffb={'raw':![],'where':{'id':_0x5978f4[_0x90c2('0x44')]['id']}},_0x48b025={};_0x48b025[_0x90c2('0x31')]=_[_0x90c2('0x45')](db[_0x90c2('0x3e')][_0x90c2('0x2e')]);_0x48b025[_0x90c2('0x32')]=_[_0x90c2('0x45')](_0x5978f4[_0x90c2('0x32')]);_0x48b025[_0x90c2('0x39')]=_['intersection'](_0x48b025[_0x90c2('0x31')],_0x48b025[_0x90c2('0x32')]);_0x537ffb['attributes']=_[_0x90c2('0x34')](_0x48b025[_0x90c2('0x31')],qs[_0x90c2('0x35')](_0x5978f4[_0x90c2('0x32')][_0x90c2('0x35')]));_0x537ffb[_0x90c2('0x33')]=_0x537ffb[_0x90c2('0x33')][_0x90c2('0x36')]?_0x537ffb[_0x90c2('0x33')]:_0x48b025['model'];if(_0x5978f4[_0x90c2('0x32')]['includeAll']){_0x537ffb[_0x90c2('0x40')]=[{'all':!![]}];}_0x537ffb=_[_0x90c2('0x46')]({},_0x537ffb,_0x5978f4[_0x90c2('0x3d')]);return db[_0x90c2('0x3e')][_0x90c2('0x47')](_0x537ffb)[_0x90c2('0x27')](handleEntityNotFound(_0x4520e0,null))['then'](respondWithResult(_0x4520e0,null))[_0x90c2('0x48')](handleError(_0x4520e0,null));};exports[_0x90c2('0x49')]=function(_0x1d5693,_0x4f4f30){return db[_0x90c2('0x3e')][_0x90c2('0x49')](_0x1d5693[_0x90c2('0x4a')],{})[_0x90c2('0x27')](respondWithResult(_0x4f4f30,0xc9))[_0x90c2('0x48')](handleError(_0x4f4f30,null));};exports[_0x90c2('0x26')]=function(_0x4c3ea9,_0x211979){if(_0x4c3ea9[_0x90c2('0x4a')]['id']){delete _0x4c3ea9[_0x90c2('0x4a')]['id'];}return db['Dynamics365Account'][_0x90c2('0x47')]({'where':{'id':_0x4c3ea9[_0x90c2('0x44')]['id']}})['then'](handleEntityNotFound(_0x211979,null))[_0x90c2('0x27')](saveUpdates(_0x4c3ea9[_0x90c2('0x4a')],null))[_0x90c2('0x27')](respondWithResult(_0x211979,null))['catch'](handleError(_0x211979,null));};exports[_0x90c2('0x28')]=function(_0xa05f36,_0x54c9c8){return db[_0x90c2('0x3e')][_0x90c2('0x47')]({'where':{'id':_0xa05f36[_0x90c2('0x44')]['id']}})[_0x90c2('0x27')](handleEntityNotFound(_0x54c9c8,null))[_0x90c2('0x27')](removeEntity(_0x54c9c8,null))[_0x90c2('0x48')](handleError(_0x54c9c8,null));};exports['getConfigurations']=function(_0x17e0e4,_0x1b9ab7,_0x1ea4ee){var _0x4f9f44={};var _0x16beab={};var _0x516843;var _0x362f57;return db[_0x90c2('0x3e')]['findOne']({'where':{'id':_0x17e0e4['params']['id']}})['then'](handleEntityNotFound(_0x1b9ab7,null))[_0x90c2('0x27')](function(_0x9bbb41){if(_0x9bbb41){_0x516843=_0x9bbb41;_0x16beab[_0x90c2('0x31')]=_[_0x90c2('0x45')](db[_0x90c2('0x4b')][_0x90c2('0x2e')]);_0x16beab[_0x90c2('0x32')]=_[_0x90c2('0x45')](_0x17e0e4[_0x90c2('0x32')]);_0x16beab[_0x90c2('0x39')]=_[_0x90c2('0x34')](_0x16beab['model'],_0x16beab[_0x90c2('0x32')]);_0x4f9f44[_0x90c2('0x33')]=_[_0x90c2('0x34')](_0x16beab[_0x90c2('0x31')],qs[_0x90c2('0x35')](_0x17e0e4[_0x90c2('0x32')][_0x90c2('0x35')]));_0x4f9f44[_0x90c2('0x33')]=_0x4f9f44[_0x90c2('0x33')][_0x90c2('0x36')]?_0x4f9f44[_0x90c2('0x33')]:_0x16beab[_0x90c2('0x31')];_0x4f9f44[_0x90c2('0x4c')]=qs[_0x90c2('0x37')](_0x17e0e4[_0x90c2('0x32')][_0x90c2('0x37')]);_0x4f9f44['where']=qs['filters'](_['pick'](_0x17e0e4[_0x90c2('0x32')],_0x16beab[_0x90c2('0x39')]));if(_0x17e0e4['query'][_0x90c2('0x3c')]){_0x4f9f44[_0x90c2('0x38')]=_[_0x90c2('0x46')](_0x4f9f44[_0x90c2('0x38')],{'$or':_[_0x90c2('0x2d')](_0x4f9f44[_0x90c2('0x33')],function(_0x53292e){var _0x4fff8b={};_0x4fff8b[_0x53292e]={'$like':'%'+_0x17e0e4[_0x90c2('0x32')][_0x90c2('0x3c')]+'%'};return _0x4fff8b;})});}_0x4f9f44=_[_0x90c2('0x46')]({},_0x4f9f44,_0x17e0e4['options']);return _0x516843[_0x90c2('0x4d')](_0x4f9f44);}})[_0x90c2('0x27')](function(_0x435c5e){if(_0x435c5e){_0x362f57=_0x435c5e[_0x90c2('0x36')];if(!_0x17e0e4[_0x90c2('0x32')][_0x90c2('0x4e')]('nolimit')){_0x4f9f44[_0x90c2('0x20')]=qs['limit'](_0x17e0e4[_0x90c2('0x32')][_0x90c2('0x20')]);_0x4f9f44[_0x90c2('0x1e')]=qs[_0x90c2('0x1e')](_0x17e0e4[_0x90c2('0x32')][_0x90c2('0x1e')]);}return _0x516843[_0x90c2('0x4d')](_0x4f9f44);}})[_0x90c2('0x27')](function(_0x5bcadc){if(_0x5bcadc){return _0x5bcadc?{'count':_0x362f57,'rows':_0x5bcadc}:null;}})['then'](respondWithResult(_0x1b9ab7,null))[_0x90c2('0x48')](handleError(_0x1b9ab7,null));};exports[_0x90c2('0x4f')]=function(_0x2637af,_0x36b90e,_0x3329d9){if(_0x2637af[_0x90c2('0x4a')]['id']){delete _0x2637af[_0x90c2('0x4a')]['id'];}return db[_0x90c2('0x3e')][_0x90c2('0x50')]({'where':{'id':_0x2637af[_0x90c2('0x44')]['id']}})[_0x90c2('0x27')](handleEntityNotFound(_0x36b90e,null))[_0x90c2('0x27')](function(_0x256e05){if(_0x256e05){_0x2637af[_0x90c2('0x4a')]['AccountId']=_0x256e05['id'];_0x2637af[_0x90c2('0x4a')][_0x90c2('0x51')]=integrations['getSubjects'](_0x2637af[_0x90c2('0x4a')]['channel'],_0x2637af['body'][_0x90c2('0x30')]);_0x2637af[_0x90c2('0x4a')]['Descriptions']=integrations[_0x90c2('0x52')](_0x2637af['body'][_0x90c2('0x53')],_0x2637af[_0x90c2('0x4a')][_0x90c2('0x30')]);return db[_0x90c2('0x4b')][_0x90c2('0x49')](_0x2637af['body'],{'include':[{'model':db[_0x90c2('0x54')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0x90c2('0x55')}]});}return null;})[_0x90c2('0x27')](respondWithResult(_0x36b90e,null))['catch'](handleError(_0x36b90e,null));};exports[_0x90c2('0x56')]=function(_0x12c1b1,_0xe9ae80,_0x1eb97e){var _0x50df81=_0x12c1b1[_0x90c2('0x32')]['ticketType'];var _0x13a76e=_0x50df81===_0x90c2('0x57')?_0x90c2('0x58'):_0x90c2('0x59');var _0x4b6544='';var _0x3e5958='';var _0x28f7aa='';var _0x368e5c='';var _0x2bbeed='';var _0x3c6246='';var _0x29c93a='';var _0x555df5='';var _0x5ff4e5=[_0x90c2('0x5a'),'description',_0x90c2('0x5b'),_0x90c2('0x5c'),_0x90c2('0x5d'),'subject',_0x90c2('0x5e'),_0x90c2('0x5f'),_0x90c2('0x60'),_0x90c2('0x61')];var _0x2ec9d8=[_0x90c2('0x62'),_0x90c2('0x63'),_0x90c2('0x64'),_0x90c2('0x65'),_0x90c2('0x66'),_0x90c2('0x67'),_0x90c2('0x68'),_0x90c2('0x69'),_0x90c2('0x6a'),'createdbyexternalpartyyominame',_0x90c2('0x6b'),_0x90c2('0x6c'),_0x90c2('0x6d'),_0x90c2('0x6e'),_0x90c2('0x6f'),'customeridname',_0x90c2('0x70'),'customeridyominame',_0x90c2('0x71'),_0x90c2('0x72'),_0x90c2('0x73'),_0x90c2('0x74'),_0x90c2('0x75'),_0x90c2('0x76'),_0x90c2('0x77'),_0x90c2('0x78'),_0x90c2('0x79'),_0x90c2('0x7a'),_0x90c2('0x7b'),'lastonholdtime',_0x90c2('0x7c'),_0x90c2('0x7d'),_0x90c2('0x7e'),_0x90c2('0x7f'),_0x90c2('0x80'),_0x90c2('0x81'),_0x90c2('0x82'),_0x90c2('0x83'),_0x90c2('0x84'),_0x90c2('0x85'),'numberofchildincidents',_0x90c2('0x86'),'overriddencreatedon',_0x90c2('0x87'),_0x90c2('0x88'),_0x90c2('0x89'),_0x90c2('0x8a'),_0x90c2('0x8b'),_0x90c2('0x8c'),_0x90c2('0x8d'),_0x90c2('0x8e'),_0x90c2('0x8f'),_0x90c2('0x90'),_0x90c2('0x91'),_0x90c2('0x92'),'responsiblecontactidname',_0x90c2('0x93'),'sentimentvalue',_0x90c2('0x94'),'slaname',_0x90c2('0x95'),_0x90c2('0x96'),'statuscode',_0x90c2('0x97'),_0x90c2('0x98'),_0x90c2('0x99'),'transactioncurrencyidname',_0x90c2('0x9a'),_0x90c2('0x9b'),_0x90c2('0x9c')];var _0x478da4=_0x5ff4e5[_0x90c2('0x9d')](_0x2ec9d8);return db[_0x90c2('0x3e')][_0x90c2('0x50')]({'where':{'id':_0x12c1b1[_0x90c2('0x44')]['id']},'attributes':['id',_0x90c2('0x9e'),_0x90c2('0x9f'),_0x90c2('0xa0'),_0x90c2('0xa1'),_0x90c2('0xa2'),'clientSecret']})[_0x90c2('0x27')](handleEntityNotFound(_0xe9ae80,null))[_0x90c2('0x27')](function(_0x8361db){if(_0x8361db){_0x555df5=_0x8361db['remoteUri'];var _0x2ad4dd=_0x555df5[_0x90c2('0xa3')](-0x1);if(_0x2ad4dd==='/'){_0x555df5=_0x555df5[_0x90c2('0xa4')](0x0,_0x555df5[_0x90c2('0xa5')](_0x2ad4dd));}_0x29c93a=util[_0x90c2('0xa6')](_0x90c2('0xa7'),_0x555df5);var _0x4fdd77={'method':_0x90c2('0xa8'),'uri':_0x90c2('0xa9')+_0x8361db[_0x90c2('0xa1')]+'/oauth2/token','form':{'client_id':_0x8361db[_0x90c2('0xa2')],'resource':_0x555df5,'username':_0x8361db[_0x90c2('0x9e')],'password':_0x8361db[_0x90c2('0x9f')],'grant_type':_0x90c2('0x9f'),'client_secret':_0x8361db['clientSecret']},'json':!![]};return rp(_0x4fdd77);}})[_0x90c2('0x27')](function(_0x2d197a){_0x3c6246=_0x2d197a[_0x90c2('0xaa')];var _0x55e081={'method':_0x90c2('0xab'),'uri':encodeURI(_0x29c93a+_0x90c2('0xac')+_0x13a76e+'\x27'),'headers':{'Authorization':_0x90c2('0xad')+_0x3c6246,'If-None-Match':null,'OData-Version':_0x90c2('0xae')},'json':!![]};return rp(_0x55e081);})[_0x90c2('0x27')](function(_0x11ebaa){var _0x40d1da=_0x11ebaa[_0x90c2('0xaf')][0x0];var _0x35e854=_0x40d1da[_0x90c2('0xb0')];var _0x57c299={'method':_0x90c2('0xab'),'uri':_0x29c93a+_0x90c2('0xb1')+_0x35e854+_0x90c2('0xb2'),'headers':{'Authorization':_0x90c2('0xad')+_0x3c6246,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x57c299);})[_0x90c2('0x27')](function(_0x3d8b77){_0x4b6544=_0x3d8b77;_0x3e5958=_0x4b6544[_0x90c2('0xb3')];_0x3e5958=_[_0x90c2('0xb4')](_0x3e5958,function(_0x5c653a){return!_0x478da4[_0x90c2('0xb5')](_0x5c653a[_0x90c2('0xb6')]);});var _0x2eb0e9=[];var _0x3826cd=[];_0x3e5958[_0x90c2('0xb7')](function(_0x3ff727){if(_0x3ff727[_0x90c2('0xb8')]){var _0x5ec32f=_0x3ff727[_0x90c2('0xb8')]['substring'](_0x3ff727['@odata.type'][_0x90c2('0xa5')]('.')+0x1);if(_0x5ec32f===_0x90c2('0xb9')){_0x2eb0e9[_0x90c2('0xba')](getSelectList(_0x29c93a,_0x50df81,_0x3826cd,_0x4b6544[_0x90c2('0xb0')],_0x3ff727['MetadataId'],_0x3c6246));}}});return Promise[_0x90c2('0xbb')](_0x2eb0e9);})[_0x90c2('0x27')](function(_0x2d2ef7){_0x28f7aa=_0x2d2ef7[0x0];var _0x582d7c=[];var _0x22b5c4=[];_0x3e5958[_0x90c2('0xb7')](function(_0x2d30ca){if(!_[_0x90c2('0xbc')](_0x2d30ca[_0x90c2('0xb8')])){var _0x40bf88=_0x2d30ca[_0x90c2('0xb8')][_0x90c2('0xa4')](_0x2d30ca['@odata.type']['lastIndexOf']('.')+0x1);if(_0x40bf88===_0x90c2('0xbd')){_0x582d7c['push'](getBooleanList(_0x29c93a,_0x50df81,_0x22b5c4,_0x4b6544[_0x90c2('0xb0')],_0x2d30ca['MetadataId'],_0x3c6246));}}});return Promise[_0x90c2('0xbb')](_0x582d7c);})[_0x90c2('0x27')](function(_0x62faeb){_0x368e5c=_0x62faeb[0x0];var _0x514e22=[];var _0x448d1e=[];_0x3e5958[_0x90c2('0xb7')](function(_0x21ba8a){if(_0x21ba8a[_0x90c2('0xb8')]){var _0x58602b=_0x21ba8a[_0x90c2('0xb8')][_0x90c2('0xa4')](_0x21ba8a[_0x90c2('0xb8')][_0x90c2('0xa5')]('.')+0x1);if(_0x58602b==='StringAttributeMetadata'||_0x58602b===_0x90c2('0xbe')||_0x58602b===_0x90c2('0xbf')||_0x58602b===_0x90c2('0xc0')||_0x58602b==='MemoAttributeMetadata'||_0x58602b===_0x90c2('0xc1')||_0x58602b===_0x90c2('0xc2')||_0x58602b===_0x90c2('0xc3')||_0x58602b===_0x90c2('0xc4')||_0x58602b===_0x90c2('0xc5')){_0x514e22['push'](getInputList(_0x29c93a,_0x50df81,_0x58602b,_0x448d1e,_0x4b6544[_0x90c2('0xb0')],_0x21ba8a[_0x90c2('0xb0')],_0x3c6246));}}});return Promise['all'](_0x514e22);})[_0x90c2('0x27')](function(_0x27d742){_0x2bbeed=_0x27d742[0x0];var _0x274d1b=_0x28f7aa[_0x90c2('0x9d')](_0x368e5c)[_0x90c2('0x9d')](_0x2bbeed);var _0x15146f={'count':_0x274d1b[_0x90c2('0x36')],'rows':_0x274d1b};return _0x15146f;})[_0x90c2('0x27')](respondWithResult(_0xe9ae80,null))[_0x90c2('0x48')](function(_0x44055c){var _0x30a402=_0x12c1b1[_0x90c2('0x32')][_0x90c2('0xc6')]?0x1f4:_0x44055c[_0x90c2('0xc7')]||0x1f4;logger['error'](_0x44055c[_0x90c2('0x2a')]);delete _0x44055c['name'];if(_0x30a402===0x191){_0x30a402=0x190;}_0xe9ae80[_0x90c2('0x1b')](_0x30a402)[_0x90c2('0x2c')](_0x12c1b1[_0x90c2('0x32')][_0x90c2('0xc6')]?{'message':_0x90c2('0xc8'),'statusCode':_0x44055c[_0x90c2('0xc7')]}:_0x44055c);});};function getSelectList(_0x456fd3,_0x513247,_0x43d91e,_0x195246,_0x34dad1,_0x2722cc){var _0x3592a8={'method':_0x90c2('0xab'),'uri':_0x456fd3+_0x90c2('0xb1')+_0x195246+')/Attributes('+_0x34dad1+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x90c2('0xad')+_0x2722cc,'If-None-Match':null,'OData-Version':_0x90c2('0xae')},'json':!![]};return rp(_0x3592a8)[_0x90c2('0x27')](function(_0x1d6b3d){var _0x2a01d2=[];var _0x3322a1=_0x1d6b3d['OptionSet'][_0x90c2('0xc9')];_0x3322a1['forEach'](function(_0x121c7e){_0x2a01d2[_0x90c2('0xba')]({'name':_0x121c7e[_0x90c2('0xca')][_0x90c2('0xcb')][_0x90c2('0xca')],'value':String(_0x121c7e[_0x90c2('0xcc')])});});var _0x4f7cae={'id':_0x513247+'_'+_0x1d6b3d[_0x90c2('0xb6')],'name':_0x1d6b3d['DisplayName'][_0x90c2('0xcb')][_0x90c2('0xca')],'custom':![],'options':_0x2a01d2};_0x43d91e['push'](_0x4f7cae);return _0x43d91e;});}function getBooleanList(_0x5d2357,_0x412ab8,_0x19b784,_0x46f7fb,_0x18f4d0,_0x1127bb){var _0x1688a5={'method':_0x90c2('0xab'),'uri':_0x5d2357+_0x90c2('0xb1')+_0x46f7fb+_0x90c2('0xcd')+_0x18f4d0+_0x90c2('0xce'),'headers':{'Authorization':'Bearer\x20'+_0x1127bb,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1688a5)[_0x90c2('0x27')](function(_0x5c795c){var _0x1a1714=[];_0x1a1714['push']({'name':_0x5c795c['OptionSet']['TrueOption'][_0x90c2('0xca')]['UserLocalizedLabel'][_0x90c2('0xca')],'value':_0x90c2('0xcf')},{'name':_0x5c795c[_0x90c2('0xd0')][_0x90c2('0xd1')][_0x90c2('0xca')][_0x90c2('0xcb')]['Label'],'value':_0x90c2('0xd2')});var _0x2cf7e1={'id':_0x412ab8+'_'+_0x5c795c[_0x90c2('0xb6')],'name':_0x5c795c['DisplayName']['UserLocalizedLabel'][_0x90c2('0xca')],'custom':![],'options':_0x1a1714};_0x19b784[_0x90c2('0xba')](_0x2cf7e1);return _0x19b784;});}function getInputList(_0x3e05f3,_0x5eaedf,_0x2ea9d5,_0x2bcd71,_0x3de164,_0x4f9cfd,_0x198707){var _0x18d645={'method':_0x90c2('0xab'),'uri':_0x3e05f3+'EntityDefinitions('+_0x3de164+')/Attributes('+_0x4f9cfd+_0x90c2('0xd3')+_0x2ea9d5+_0x90c2('0xd4'),'headers':{'Authorization':'Bearer\x20'+_0x198707,'If-None-Match':null,'OData-Version':_0x90c2('0xae')},'json':!![]};return rp(_0x18d645)[_0x90c2('0x27')](function(_0x33a0eb){var _0x21914c={'id':_0x5eaedf+'_'+_0x33a0eb[_0x90c2('0xb6')],'name':_0x33a0eb[_0x90c2('0xd5')]['UserLocalizedLabel']?_0x33a0eb[_0x90c2('0xd5')][_0x90c2('0xcb')]['Label']:_0x33a0eb[_0x90c2('0xb6')],'custom':![],'options':[]};_0x2bcd71['push'](_0x21914c);return _0x2bcd71;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 75616bc..068afc6 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(_0x3d8c53,_0x10f4ff){var _0x15e4d1=function(_0x29bb10){while(--_0x29bb10){_0x3d8c53['push'](_0x3d8c53['shift']());}};_0x15e4d1(++_0x10f4ff);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x526b36,_0x1504e8){var _0x3d6670=function(_0xd571e6){while(--_0xd571e6){_0x526b36['push'](_0x526b36['shift']());}};_0x3d6670(++_0x1504e8);}(_0xe706,0xa3));var _0x6e70=function(_0x2ada6a,_0x49cece){_0x2ada6a=_0x2ada6a-0x0;var _0x42b8fa=_0xe706[_0x2ada6a];return _0x42b8fa;};'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'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'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 22eb883..643885c 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 _0xfeed=['Dynamics365Account','options','raw','where','attributes','limit','include','map','model','debug','ShowDynamics365Account','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDynamics365Account'];(function(_0x17a20c,_0x2dea01){var _0x1a5a87=function(_0x4fe770){while(--_0x4fe770){_0x17a20c['push'](_0x17a20c['shift']());}};_0x1a5a87(++_0x2dea01);}(_0xfeed,0x94));var _0xdfee=function(_0xb78554,_0x4e76cc){_0xb78554=_0xb78554-0x0;var _0x588dae=_0xfeed[_0xb78554];return _0x588dae;};'use strict';var _=require(_0xdfee('0x0'));var util=require(_0xdfee('0x1'));var moment=require('moment');var BPromise=require(_0xdfee('0x2'));var rs=require(_0xdfee('0x3'));var fs=require('fs');var Redis=require(_0xdfee('0x4'));var db=require(_0xdfee('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xdfee('0x6'));var jayson=require(_0xdfee('0x7'));var client=jayson[_0xdfee('0x8')][_0xdfee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25b8cf,_0x387fea,_0x150ea7){return new BPromise(function(_0xcc6f48,_0x5f0ed3){return client[_0xdfee('0xa')](_0x25b8cf,_0x150ea7)[_0xdfee('0xb')](function(_0xeec425){logger[_0xdfee('0xc')](_0xdfee('0xd'),_0x387fea,_0xdfee('0xe'));logger['debug'](_0xdfee('0xf'),_0x387fea,_0xdfee('0xe'),JSON[_0xdfee('0x10')](_0xeec425));if(_0xeec425['error']){if(_0xeec425[_0xdfee('0x11')][_0xdfee('0x12')]===0x1f4){logger[_0xdfee('0x11')](_0xdfee('0xd'),_0x387fea,_0xeec425[_0xdfee('0x11')][_0xdfee('0x13')]);return _0x5f0ed3(_0xeec425['error'][_0xdfee('0x13')]);}logger['error'](_0xdfee('0xd'),_0x387fea,_0xeec425[_0xdfee('0x11')]['message']);return _0xcc6f48(_0xeec425[_0xdfee('0x11')][_0xdfee('0x13')]);}else{logger[_0xdfee('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x387fea,_0xdfee('0xe'));_0xcc6f48(_0xeec425['result'][_0xdfee('0x13')]);}})[_0xdfee('0x14')](function(_0x8102ea){logger['error'](_0xdfee('0xd'),_0x387fea,_0x8102ea);_0x5f0ed3(_0x8102ea);});});}exports[_0xdfee('0x15')]=function(_0x5cac05){var _0x4fb383=this;return new Promise(function(_0x2b1e1f,_0x289d40){return db[_0xdfee('0x16')]['findAll']({'raw':_0x5cac05[_0xdfee('0x17')]?_0x5cac05[_0xdfee('0x17')][_0xdfee('0x18')]===undefined?!![]:![]:!![],'where':_0x5cac05['options']?_0x5cac05[_0xdfee('0x17')][_0xdfee('0x19')]||null:null,'attributes':_0x5cac05[_0xdfee('0x17')]?_0x5cac05[_0xdfee('0x17')][_0xdfee('0x1a')]||null:null,'limit':_0x5cac05[_0xdfee('0x17')]?_0x5cac05[_0xdfee('0x17')][_0xdfee('0x1b')]||null:null,'include':_0x5cac05[_0xdfee('0x17')]?_0x5cac05[_0xdfee('0x17')][_0xdfee('0x1c')]?_[_0xdfee('0x1d')](_0x5cac05['options'][_0xdfee('0x1c')],function(_0x3261a6){return{'model':db[_0x3261a6[_0xdfee('0x1e')]],'as':_0x3261a6['as'],'attributes':_0x3261a6['attributes'],'include':_0x3261a6['include']?_[_0xdfee('0x1d')](_0x3261a6[_0xdfee('0x1c')],function(_0x31e0bf){return{'model':db[_0x31e0bf[_0xdfee('0x1e')]],'as':_0x31e0bf['as'],'attributes':_0x31e0bf['attributes'],'include':_0x31e0bf[_0xdfee('0x1c')]?_[_0xdfee('0x1d')](_0x31e0bf['include'],function(_0x540062){return{'model':db[_0x540062[_0xdfee('0x1e')]],'as':_0x540062['as'],'attributes':_0x540062[_0xdfee('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32240e){logger[_0xdfee('0xc')](_0xdfee('0x15'),_0x5cac05);logger[_0xdfee('0x1f')]('GetDynamics365Account',_0x5cac05,JSON[_0xdfee('0x10')](_0x32240e));_0x2b1e1f(_0x32240e);})[_0xdfee('0x14')](function(_0x31e5db){logger[_0xdfee('0x11')](_0xdfee('0x15'),_0x31e5db[_0xdfee('0x13')],_0x5cac05);_0x289d40(_0x4fb383[_0xdfee('0x11')](0x1f4,_0x31e5db[_0xdfee('0x13')]));});});};exports[_0xdfee('0x20')]=function(_0x4a0b18){var _0x226d81=this;return new Promise(function(_0x51af5a,_0x446a32){return db[_0xdfee('0x16')][_0xdfee('0x21')]({'raw':_0x4a0b18[_0xdfee('0x17')]?_0x4a0b18[_0xdfee('0x17')][_0xdfee('0x18')]===undefined?!![]:![]:!![],'where':_0x4a0b18[_0xdfee('0x17')]?_0x4a0b18[_0xdfee('0x17')]['where']||null:null,'attributes':_0x4a0b18['options']?_0x4a0b18['options'][_0xdfee('0x1a')]||null:null,'include':_0x4a0b18[_0xdfee('0x17')]?_0x4a0b18[_0xdfee('0x17')][_0xdfee('0x1c')]?_['map'](_0x4a0b18[_0xdfee('0x17')][_0xdfee('0x1c')],function(_0x181891){return{'model':db[_0x181891[_0xdfee('0x1e')]],'as':_0x181891['as'],'attributes':_0x181891[_0xdfee('0x1a')],'include':_0x181891['include']?_[_0xdfee('0x1d')](_0x181891[_0xdfee('0x1c')],function(_0x25d51b){return{'model':db[_0x25d51b[_0xdfee('0x1e')]],'as':_0x25d51b['as'],'attributes':_0x25d51b[_0xdfee('0x1a')],'include':_0x25d51b[_0xdfee('0x1c')]?_['map'](_0x25d51b['include'],function(_0x370a8f){return{'model':db[_0x370a8f[_0xdfee('0x1e')]],'as':_0x370a8f['as'],'attributes':_0x370a8f[_0xdfee('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdfee('0xb')](function(_0x4af2bb){logger[_0xdfee('0xc')](_0xdfee('0x20'),_0x4a0b18);logger[_0xdfee('0x1f')](_0xdfee('0x20'),_0x4a0b18,JSON['stringify'](_0x4af2bb));_0x51af5a(_0x4af2bb);})[_0xdfee('0x14')](function(_0xb2606d){logger['error'](_0xdfee('0x20'),_0xb2606d[_0xdfee('0x13')],_0x4a0b18);_0x446a32(_0x226d81[_0xdfee('0x11')](0x1f4,_0xb2606d[_0xdfee('0x13')]));});});}; \ No newline at end of file +var _0xd196=['info','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','ShowDynamics365Account','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s'];(function(_0x463b88,_0x57c0a8){var _0x40cde8=function(_0x1b1f60){while(--_0x1b1f60){_0x463b88['push'](_0x463b88['shift']());}};_0x40cde8(++_0x57c0a8);}(_0xd196,0x140));var _0x6d19=function(_0x317e30,_0x32ad66){_0x317e30=_0x317e30-0x0;var _0x203788=_0xd196[_0x317e30];return _0x203788;};'use strict';var _=require(_0x6d19('0x0'));var util=require(_0x6d19('0x1'));var moment=require('moment');var BPromise=require(_0x6d19('0x2'));var rs=require(_0x6d19('0x3'));var fs=require('fs');var Redis=require(_0x6d19('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d19('0x5'));var logger=require('../../config/logger')(_0x6d19('0x6'));var config=require(_0x6d19('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6d19('0x8')][_0x6d19('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x359b96,_0x3f51a9,_0x365833){return new BPromise(function(_0x3d6080,_0x15e837){return client[_0x6d19('0xa')](_0x359b96,_0x365833)[_0x6d19('0xb')](function(_0x4bdbae){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x3f51a9,_0x6d19('0xc'));logger[_0x6d19('0xd')](_0x6d19('0xe'),_0x3f51a9,_0x6d19('0xc'),JSON[_0x6d19('0xf')](_0x4bdbae));if(_0x4bdbae[_0x6d19('0x10')]){if(_0x4bdbae['error'][_0x6d19('0x11')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x3f51a9,_0x4bdbae['error'][_0x6d19('0x12')]);return _0x15e837(_0x4bdbae[_0x6d19('0x10')][_0x6d19('0x12')]);}logger[_0x6d19('0x10')](_0x6d19('0x13'),_0x3f51a9,_0x4bdbae[_0x6d19('0x10')][_0x6d19('0x12')]);return _0x3d6080(_0x4bdbae[_0x6d19('0x10')][_0x6d19('0x12')]);}else{logger[_0x6d19('0x14')](_0x6d19('0x13'),_0x3f51a9,_0x6d19('0xc'));_0x3d6080(_0x4bdbae['result'][_0x6d19('0x12')]);}})[_0x6d19('0x15')](function(_0x518ca6){logger[_0x6d19('0x10')](_0x6d19('0x13'),_0x3f51a9,_0x518ca6);_0x15e837(_0x518ca6);});});}exports[_0x6d19('0x16')]=function(_0x476384){var _0x5274e3=this;return new Promise(function(_0x30e9a7,_0xa3fd93){return db[_0x6d19('0x17')][_0x6d19('0x18')]({'raw':_0x476384['options']?_0x476384[_0x6d19('0x19')][_0x6d19('0x1a')]===undefined?!![]:![]:!![],'where':_0x476384['options']?_0x476384[_0x6d19('0x19')][_0x6d19('0x1b')]||null:null,'attributes':_0x476384['options']?_0x476384[_0x6d19('0x19')][_0x6d19('0x1c')]||null:null,'limit':_0x476384['options']?_0x476384[_0x6d19('0x19')]['limit']||null:null,'include':_0x476384['options']?_0x476384[_0x6d19('0x19')][_0x6d19('0x1d')]?_['map'](_0x476384[_0x6d19('0x19')][_0x6d19('0x1d')],function(_0x4a4b3e){return{'model':db[_0x4a4b3e['model']],'as':_0x4a4b3e['as'],'attributes':_0x4a4b3e[_0x6d19('0x1c')],'include':_0x4a4b3e[_0x6d19('0x1d')]?_[_0x6d19('0x1e')](_0x4a4b3e[_0x6d19('0x1d')],function(_0x2f712b){return{'model':db[_0x2f712b[_0x6d19('0x1f')]],'as':_0x2f712b['as'],'attributes':_0x2f712b[_0x6d19('0x1c')],'include':_0x2f712b[_0x6d19('0x1d')]?_[_0x6d19('0x1e')](_0x2f712b[_0x6d19('0x1d')],function(_0x3a1005){return{'model':db[_0x3a1005['model']],'as':_0x3a1005['as'],'attributes':_0x3a1005['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x49579e){logger[_0x6d19('0x14')](_0x6d19('0x16'),_0x476384);logger['debug'](_0x6d19('0x16'),_0x476384,JSON['stringify'](_0x49579e));_0x30e9a7(_0x49579e);})[_0x6d19('0x15')](function(_0x2f67e4){logger[_0x6d19('0x10')](_0x6d19('0x16'),_0x2f67e4['message'],_0x476384);_0xa3fd93(_0x5274e3[_0x6d19('0x10')](0x1f4,_0x2f67e4['message']));});});};exports[_0x6d19('0x20')]=function(_0x2109f4){var _0x53fdbd=this;return new Promise(function(_0x43fc53,_0x3e30b2){return db[_0x6d19('0x17')][_0x6d19('0x21')]({'raw':_0x2109f4[_0x6d19('0x19')]?_0x2109f4[_0x6d19('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2109f4[_0x6d19('0x19')]?_0x2109f4[_0x6d19('0x19')][_0x6d19('0x1b')]||null:null,'attributes':_0x2109f4[_0x6d19('0x19')]?_0x2109f4['options'][_0x6d19('0x1c')]||null:null,'include':_0x2109f4[_0x6d19('0x19')]?_0x2109f4['options'][_0x6d19('0x1d')]?_[_0x6d19('0x1e')](_0x2109f4['options'][_0x6d19('0x1d')],function(_0x250193){return{'model':db[_0x250193[_0x6d19('0x1f')]],'as':_0x250193['as'],'attributes':_0x250193['attributes'],'include':_0x250193['include']?_[_0x6d19('0x1e')](_0x250193[_0x6d19('0x1d')],function(_0x2cbb18){return{'model':db[_0x2cbb18['model']],'as':_0x2cbb18['as'],'attributes':_0x2cbb18[_0x6d19('0x1c')],'include':_0x2cbb18[_0x6d19('0x1d')]?_[_0x6d19('0x1e')](_0x2cbb18['include'],function(_0x10c1d1){return{'model':db[_0x10c1d1[_0x6d19('0x1f')]],'as':_0x10c1d1['as'],'attributes':_0x10c1d1['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d19('0xb')](function(_0x1b1a54){logger[_0x6d19('0x14')](_0x6d19('0x20'),_0x2109f4);logger[_0x6d19('0xd')](_0x6d19('0x20'),_0x2109f4,JSON['stringify'](_0x1b1a54));_0x43fc53(_0x1b1a54);})[_0x6d19('0x15')](function(_0x4c7e9a){logger[_0x6d19('0x10')]('ShowDynamics365Account',_0x4c7e9a[_0x6d19('0x12')],_0x2109f4);_0x3e30b2(_0x53fdbd['error'](0x1f4,_0x4c7e9a[_0x6d19('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 9e221a9..e66e45b 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 _0x6b00=['/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show'];(function(_0x2b1e9a,_0x44d00e){var _0x814578=function(_0x4acdb2){while(--_0x4acdb2){_0x2b1e9a['push'](_0x2b1e9a['shift']());}};_0x814578(++_0x44d00e);}(_0x6b00,0x1ad));var _0x06b0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6b00[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x06b0('0x0'));var util=require(_0x06b0('0x1'));var path=require(_0x06b0('0x2'));var timeout=require(_0x06b0('0x3'));var express=require(_0x06b0('0x4'));var router=express[_0x06b0('0x5')]();var fs_extra=require(_0x06b0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x06b0('0x7'));var config=require(_0x06b0('0x8'));var controller=require('./intDynamics365Configuration.controller');router[_0x06b0('0x9')]('/',auth[_0x06b0('0xa')](),controller['index']);router[_0x06b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x06b0('0xb')]);router[_0x06b0('0x9')](_0x06b0('0xc'),auth[_0x06b0('0xa')](),controller['getFields']);router[_0x06b0('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x06b0('0xd')]);router[_0x06b0('0x9')](_0x06b0('0xe'),auth[_0x06b0('0xa')](),controller[_0x06b0('0xf')]);router[_0x06b0('0x10')]('/',auth[_0x06b0('0xa')](),controller['create']);router[_0x06b0('0x11')](_0x06b0('0x12'),auth[_0x06b0('0xa')](),controller['update']);router[_0x06b0('0x13')](_0x06b0('0x12'),auth['isAuthenticated'](),controller[_0x06b0('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc5c0=['/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','show'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc5c0,0x6c));var _0x0c5c=function(_0x1db5fb,_0x12ad19){_0x1db5fb=_0x1db5fb-0x0;var _0xe5a5a9=_0xc5c0[_0x1db5fb];return _0xe5a5a9;};'use strict';var multer=require(_0x0c5c('0x0'));var util=require(_0x0c5c('0x1'));var path=require(_0x0c5c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0c5c('0x3')]();var fs_extra=require(_0x0c5c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0c5c('0x5'));var config=require(_0x0c5c('0x6'));var controller=require(_0x0c5c('0x7'));router[_0x0c5c('0x8')]('/',auth[_0x0c5c('0x9')](),controller[_0x0c5c('0xa')]);router[_0x0c5c('0x8')]('/:id',auth[_0x0c5c('0x9')](),controller[_0x0c5c('0xb')]);router['get'](_0x0c5c('0xc'),auth[_0x0c5c('0x9')](),controller[_0x0c5c('0xd')]);router[_0x0c5c('0x8')]('/:id/subjects',auth[_0x0c5c('0x9')](),controller[_0x0c5c('0xe')]);router[_0x0c5c('0x8')](_0x0c5c('0xf'),auth[_0x0c5c('0x9')](),controller['getDescriptions']);router[_0x0c5c('0x10')]('/',auth['isAuthenticated'](),controller[_0x0c5c('0x11')]);router[_0x0c5c('0x12')](_0x0c5c('0x13'),auth[_0x0c5c('0x9')](),controller[_0x0c5c('0x14')]);router[_0x0c5c('0x15')](_0x0c5c('0x13'),auth[_0x0c5c('0x9')](),controller[_0x0c5c('0x16')]);module[_0x0c5c('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 735d03c..0b2ffcb 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 _0xc5df=['STRING','phonecall','incident','sequelize','exports'];(function(_0x3e0b77,_0x319ff0){var _0x1f1948=function(_0x31cdb6){while(--_0x31cdb6){_0x3e0b77['push'](_0x3e0b77['shift']());}};_0x1f1948(++_0x319ff0);}(_0xc5df,0x9e));var _0xfc5d=function(_0x1d9edf,_0x14043b){_0x1d9edf=_0x1d9edf-0x0;var _0x6c6aed=_0xc5df[_0x1d9edf];return _0x6c6aed;};'use strict';var Sequelize=require(_0xfc5d('0x0'));module[_0xfc5d('0x1')]={'name':{'type':Sequelize[_0xfc5d('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM']('incident',_0xfc5d('0x3')),'defaultValue':_0xfc5d('0x4')}}; \ No newline at end of file +var _0x13ee=['exports','STRING','phonecall','incident','sequelize'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0x13ee,0x1a8));var _0xe13e=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x13ee[_0x5311e8];return _0x582ad8;};'use strict';var Sequelize=require(_0xe13e('0x0'));module[_0xe13e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe13e('0x2')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0xe13e('0x3')),'defaultValue':_0xe13e('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 4fa8ee2..a321ecc 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 _0x5d72=['reject','save','update','destroy','then','error','stack','name','send','index','Dynamics365Configuration','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','findOne','keys','getFields','nolimit','getSubjects','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x445c98,_0x132bf7){var _0x2fe913=function(_0x32e864){while(--_0x32e864){_0x445c98['push'](_0x445c98['shift']());}};_0x2fe913(++_0x132bf7);}(_0x5d72,0x80));var _0x25d7=function(_0x289c3e,_0x3614b5){_0x289c3e=_0x289c3e-0x0;var _0x25a4b3=_0x5d72[_0x289c3e];return _0x25a4b3;};'use strict';var emlformat=require(_0x25d7('0x0'));var rimraf=require(_0x25d7('0x1'));var zipdir=require(_0x25d7('0x2'));var jsonpatch=require(_0x25d7('0x3'));var rp=require(_0x25d7('0x4'));var moment=require(_0x25d7('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x25d7('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x25d7('0x7'));var ejs=require(_0x25d7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x25d7('0x9'));var squel=require('squel');var crypto=require(_0x25d7('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x25d7('0xb'));var Papa=require(_0x25d7('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x25d7('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25d7('0xe'));var logger=require(_0x25d7('0xf'))(_0x25d7('0x10'));var utils=require(_0x25d7('0x11'));var config=require(_0x25d7('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x25d7('0x13'))['db'];function respondWithStatusCode(_0x567047,_0x41a3ed){_0x41a3ed=_0x41a3ed||0xcc;return function(_0x4e7269){if(_0x4e7269){return _0x567047[_0x25d7('0x14')](_0x41a3ed);}return _0x567047['status'](_0x41a3ed)['end']();};}function respondWithResult(_0x6d13ee,_0x35e969){_0x35e969=_0x35e969||0xc8;return function(_0x2de910){if(_0x2de910){return _0x6d13ee[_0x25d7('0x15')](_0x35e969)[_0x25d7('0x16')](_0x2de910);}};}function respondWithFilteredResult(_0x6ecb9c,_0x2d9555){return function(_0x75593){if(_0x75593){var _0x2b2d6b=typeof _0x2d9555[_0x25d7('0x17')]===_0x25d7('0x18')&&typeof _0x2d9555[_0x25d7('0x19')]==='undefined';var _0x16abf6=_0x75593[_0x25d7('0x1a')];var _0x17ca99=_0x2b2d6b?0x0:_0x2d9555[_0x25d7('0x17')];var _0x2473e8=_0x2b2d6b?_0x75593[_0x25d7('0x1a')]:_0x2d9555[_0x25d7('0x17')]+_0x2d9555[_0x25d7('0x19')];var _0x2d86bd;if(_0x2473e8>=_0x16abf6){_0x2473e8=_0x16abf6;_0x2d86bd=0xc8;}else{_0x2d86bd=0xce;}_0x6ecb9c[_0x25d7('0x15')](_0x2d86bd);return _0x6ecb9c[_0x25d7('0x1b')](_0x25d7('0x1c'),_0x17ca99+'-'+_0x2473e8+'/'+_0x16abf6)[_0x25d7('0x16')](_0x75593);}return null;};}function patchUpdates(_0x413645){return function(_0x2300d1){try{jsonpatch[_0x25d7('0x1d')](_0x2300d1,_0x413645,!![]);}catch(_0x7de068){return BPromise[_0x25d7('0x1e')](_0x7de068);}return _0x2300d1[_0x25d7('0x1f')]();};}function saveUpdates(_0x152f1e,_0x37538a){return function(_0x102a57){if(_0x102a57){return _0x102a57[_0x25d7('0x20')](_0x152f1e)['then'](function(_0x9d8cb0){return _0x9d8cb0;});}return null;};}function removeEntity(_0x4600b8,_0x3cab18){return function(_0x18d15d){if(_0x18d15d){return _0x18d15d[_0x25d7('0x21')]()[_0x25d7('0x22')](function(){_0x4600b8[_0x25d7('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa621d,_0x232d7d){return function(_0x12cd83){if(!_0x12cd83){_0xa621d['sendStatus'](0x194);}return _0x12cd83;};}function handleError(_0x2b9621,_0x101cd8){_0x101cd8=_0x101cd8||0x1f4;return function(_0xc028df){logger[_0x25d7('0x23')](_0xc028df[_0x25d7('0x24')]);if(_0xc028df[_0x25d7('0x25')]){delete _0xc028df[_0x25d7('0x25')];}_0x2b9621[_0x25d7('0x15')](_0x101cd8)[_0x25d7('0x26')](_0xc028df);};}exports[_0x25d7('0x27')]=function(_0xef0aa,_0x430c8c){var _0x3c98e6={},_0xf5dadd={},_0x421f92={'count':0x0,'rows':[]};var _0x583526=_['map'](db[_0x25d7('0x28')]['rawAttributes'],function(_0x1bce9c){return{'name':_0x1bce9c[_0x25d7('0x29')],'type':_0x1bce9c[_0x25d7('0x2a')][_0x25d7('0x2b')]};});_0xf5dadd[_0x25d7('0x2c')]=_[_0x25d7('0x2d')](_0x583526,_0x25d7('0x25'));_0xf5dadd[_0x25d7('0x2e')]=_['keys'](_0xef0aa['query']);_0xf5dadd[_0x25d7('0x2f')]=_[_0x25d7('0x30')](_0xf5dadd[_0x25d7('0x2c')],_0xf5dadd[_0x25d7('0x2e')]);_0x3c98e6['attributes']=_[_0x25d7('0x30')](_0xf5dadd[_0x25d7('0x2c')],qs[_0x25d7('0x31')](_0xef0aa[_0x25d7('0x2e')][_0x25d7('0x31')]));_0x3c98e6[_0x25d7('0x32')]=_0x3c98e6[_0x25d7('0x32')][_0x25d7('0x33')]?_0x3c98e6['attributes']:_0xf5dadd[_0x25d7('0x2c')];if(!_0xef0aa['query'][_0x25d7('0x34')]('nolimit')){_0x3c98e6['limit']=qs[_0x25d7('0x19')](_0xef0aa[_0x25d7('0x2e')][_0x25d7('0x19')]);_0x3c98e6[_0x25d7('0x17')]=qs[_0x25d7('0x17')](_0xef0aa[_0x25d7('0x2e')][_0x25d7('0x17')]);}_0x3c98e6[_0x25d7('0x35')]=qs[_0x25d7('0x36')](_0xef0aa[_0x25d7('0x2e')][_0x25d7('0x36')]);_0x3c98e6[_0x25d7('0x37')]=qs[_0x25d7('0x2f')](_[_0x25d7('0x38')](_0xef0aa[_0x25d7('0x2e')],_0xf5dadd[_0x25d7('0x2f')]),_0x583526);if(_0xef0aa['query'][_0x25d7('0x39')]){_0x3c98e6[_0x25d7('0x37')]=_['merge'](_0x3c98e6[_0x25d7('0x37')],{'$or':_[_0x25d7('0x2d')](_0x583526,function(_0x2b1a67){if(_0x2b1a67['type']!==_0x25d7('0x3a')){var _0x29bc14={};_0x29bc14[_0x2b1a67[_0x25d7('0x25')]]={'$like':'%'+_0xef0aa[_0x25d7('0x2e')][_0x25d7('0x39')]+'%'};return _0x29bc14;}})});}_0x3c98e6=_[_0x25d7('0x3b')]({},_0x3c98e6,_0xef0aa[_0x25d7('0x3c')]);var _0x2b687c={'where':_0x3c98e6[_0x25d7('0x37')]};return db[_0x25d7('0x28')][_0x25d7('0x1a')](_0x2b687c)[_0x25d7('0x22')](function(_0x304043){_0x421f92[_0x25d7('0x1a')]=_0x304043;if(_0xef0aa[_0x25d7('0x2e')][_0x25d7('0x3d')]){_0x3c98e6[_0x25d7('0x3e')]=[{'all':!![]}];}return db[_0x25d7('0x28')][_0x25d7('0x3f')](_0x3c98e6);})[_0x25d7('0x22')](function(_0x32d042){_0x421f92[_0x25d7('0x40')]=_0x32d042;return _0x421f92;})['then'](respondWithFilteredResult(_0x430c8c,_0x3c98e6))['catch'](handleError(_0x430c8c,null));};exports[_0x25d7('0x41')]=function(_0x5249a3,_0x10bc7f){var _0x18505b={'raw':![],'where':{'id':_0x5249a3[_0x25d7('0x42')]['id']}},_0x50abb6={};_0x50abb6[_0x25d7('0x2c')]=_['keys'](db[_0x25d7('0x28')][_0x25d7('0x43')]);_0x50abb6['query']=_['keys'](_0x5249a3[_0x25d7('0x2e')]);_0x50abb6[_0x25d7('0x2f')]=_[_0x25d7('0x30')](_0x50abb6[_0x25d7('0x2c')],_0x50abb6[_0x25d7('0x2e')]);_0x18505b[_0x25d7('0x32')]=_[_0x25d7('0x30')](_0x50abb6[_0x25d7('0x2c')],qs[_0x25d7('0x31')](_0x5249a3[_0x25d7('0x2e')]['fields']));_0x18505b[_0x25d7('0x32')]=_0x18505b[_0x25d7('0x32')][_0x25d7('0x33')]?_0x18505b[_0x25d7('0x32')]:_0x50abb6[_0x25d7('0x2c')];if(_0x5249a3[_0x25d7('0x2e')][_0x25d7('0x3d')]){_0x18505b[_0x25d7('0x3e')]=[{'all':!![]}];}_0x18505b=_[_0x25d7('0x3b')]({},_0x18505b,_0x5249a3[_0x25d7('0x3c')]);return db[_0x25d7('0x28')][_0x25d7('0x44')](_0x18505b)['then'](handleEntityNotFound(_0x10bc7f,null))[_0x25d7('0x22')](respondWithResult(_0x10bc7f,null))[_0x25d7('0x45')](handleError(_0x10bc7f,null));};exports['create']=function(_0x5b452d,_0x42ab35){return db[_0x25d7('0x28')][_0x25d7('0x46')](_0x5b452d['body'],{})[_0x25d7('0x22')](respondWithResult(_0x42ab35,0xc9))['catch'](handleError(_0x42ab35,null));};exports[_0x25d7('0x20')]=function(_0x2bfd35,_0x10130b){if(_0x2bfd35[_0x25d7('0x47')]['id']){delete _0x2bfd35[_0x25d7('0x47')]['id'];}return db[_0x25d7('0x28')][_0x25d7('0x44')]({'where':{'id':_0x2bfd35[_0x25d7('0x42')]['id']}})[_0x25d7('0x22')](handleEntityNotFound(_0x10130b,null))['then'](saveUpdates(_0x2bfd35[_0x25d7('0x47')],null))[_0x25d7('0x22')](respondWithResult(_0x10130b,null))[_0x25d7('0x45')](handleError(_0x10130b,null));};exports[_0x25d7('0x21')]=function(_0x463814,_0x41ac8a){return db['Dynamics365Configuration'][_0x25d7('0x44')]({'where':{'id':_0x463814[_0x25d7('0x42')]['id']}})[_0x25d7('0x22')](handleEntityNotFound(_0x41ac8a,null))[_0x25d7('0x22')](removeEntity(_0x41ac8a,null))[_0x25d7('0x45')](handleError(_0x41ac8a,null));};exports['getFields']=function(_0x180606,_0x563740,_0x239bc5){var _0x578680={};var _0x50286c={};var _0x268dd9;var _0x3bdfc1;return db[_0x25d7('0x28')][_0x25d7('0x48')]({'where':{'id':_0x180606[_0x25d7('0x42')]['id']}})['then'](handleEntityNotFound(_0x563740,null))['then'](function(_0x3938c6){if(_0x3938c6){_0x268dd9=_0x3938c6;_0x50286c[_0x25d7('0x2c')]=_[_0x25d7('0x49')](db['Dynamics365Field'][_0x25d7('0x43')]);_0x50286c[_0x25d7('0x2e')]=_[_0x25d7('0x49')](_0x180606[_0x25d7('0x2e')]);_0x50286c[_0x25d7('0x2f')]=_[_0x25d7('0x30')](_0x50286c[_0x25d7('0x2c')],_0x50286c[_0x25d7('0x2e')]);_0x578680[_0x25d7('0x32')]=_[_0x25d7('0x30')](_0x50286c['model'],qs[_0x25d7('0x31')](_0x180606[_0x25d7('0x2e')][_0x25d7('0x31')]));_0x578680[_0x25d7('0x32')]=_0x578680['attributes'][_0x25d7('0x33')]?_0x578680['attributes']:_0x50286c['model'];_0x578680[_0x25d7('0x35')]=qs[_0x25d7('0x36')](_0x180606[_0x25d7('0x2e')]['sort']);_0x578680[_0x25d7('0x37')]=qs['filters'](_[_0x25d7('0x38')](_0x180606[_0x25d7('0x2e')],_0x50286c[_0x25d7('0x2f')]));if(_0x180606[_0x25d7('0x2e')][_0x25d7('0x39')]){_0x578680[_0x25d7('0x37')]=_[_0x25d7('0x3b')](_0x578680[_0x25d7('0x37')],{'$or':_[_0x25d7('0x2d')](_0x578680['attributes'],function(_0x473c23){var _0x12ddbc={};_0x12ddbc[_0x473c23]={'$like':'%'+_0x180606[_0x25d7('0x2e')][_0x25d7('0x39')]+'%'};return _0x12ddbc;})});}_0x578680=_[_0x25d7('0x3b')]({},_0x578680,_0x180606[_0x25d7('0x3c')]);return _0x268dd9[_0x25d7('0x4a')](_0x578680);}})[_0x25d7('0x22')](function(_0x106bed){if(_0x106bed){_0x3bdfc1=_0x106bed[_0x25d7('0x33')];if(!_0x180606[_0x25d7('0x2e')][_0x25d7('0x34')](_0x25d7('0x4b'))){_0x578680[_0x25d7('0x19')]=qs[_0x25d7('0x19')](_0x180606[_0x25d7('0x2e')][_0x25d7('0x19')]);_0x578680['offset']=qs[_0x25d7('0x17')](_0x180606[_0x25d7('0x2e')]['offset']);}return _0x268dd9[_0x25d7('0x4a')](_0x578680);}})[_0x25d7('0x22')](function(_0xaa5549){if(_0xaa5549){return _0xaa5549?{'count':_0x3bdfc1,'rows':_0xaa5549}:null;}})[_0x25d7('0x22')](respondWithResult(_0x563740,null))[_0x25d7('0x45')](handleError(_0x563740,null));};exports[_0x25d7('0x4c')]=function(_0xfb73e,_0x513006,_0x15ff9d){var _0x475e41={};var _0x413e35={};var _0x1006c4;var _0x5c459d;return db[_0x25d7('0x28')][_0x25d7('0x48')]({'where':{'id':_0xfb73e[_0x25d7('0x42')]['id']}})[_0x25d7('0x22')](handleEntityNotFound(_0x513006,null))[_0x25d7('0x22')](function(_0x1f89aa){if(_0x1f89aa){_0x1006c4=_0x1f89aa;_0x413e35[_0x25d7('0x2c')]=_['keys'](db[_0x25d7('0x4d')][_0x25d7('0x43')]);_0x413e35[_0x25d7('0x2e')]=_[_0x25d7('0x49')](_0xfb73e[_0x25d7('0x2e')]);_0x413e35[_0x25d7('0x2f')]=_[_0x25d7('0x30')](_0x413e35[_0x25d7('0x2c')],_0x413e35['query']);_0x475e41[_0x25d7('0x32')]=_[_0x25d7('0x30')](_0x413e35[_0x25d7('0x2c')],qs[_0x25d7('0x31')](_0xfb73e[_0x25d7('0x2e')][_0x25d7('0x31')]));_0x475e41[_0x25d7('0x32')]=_0x475e41['attributes'][_0x25d7('0x33')]?_0x475e41[_0x25d7('0x32')]:_0x413e35[_0x25d7('0x2c')];_0x475e41[_0x25d7('0x35')]=qs[_0x25d7('0x36')](_0xfb73e[_0x25d7('0x2e')][_0x25d7('0x36')]);_0x475e41[_0x25d7('0x37')]=qs[_0x25d7('0x2f')](_[_0x25d7('0x38')](_0xfb73e[_0x25d7('0x2e')],_0x413e35[_0x25d7('0x2f')]));if(_0xfb73e[_0x25d7('0x2e')][_0x25d7('0x39')]){_0x475e41['where']=_[_0x25d7('0x3b')](_0x475e41['where'],{'$or':_[_0x25d7('0x2d')](_0x475e41[_0x25d7('0x32')],function(_0x8c268a){var _0x5b0853={};_0x5b0853[_0x8c268a]={'$like':'%'+_0xfb73e[_0x25d7('0x2e')]['filter']+'%'};return _0x5b0853;})});}_0x475e41=_['merge']({},_0x475e41,_0xfb73e[_0x25d7('0x3c')]);return _0x1006c4[_0x25d7('0x4c')](_0x475e41);}})['then'](function(_0x486502){if(_0x486502){_0x5c459d=_0x486502[_0x25d7('0x33')];if(!_0xfb73e[_0x25d7('0x2e')][_0x25d7('0x34')](_0x25d7('0x4b'))){_0x475e41['limit']=qs['limit'](_0xfb73e[_0x25d7('0x2e')][_0x25d7('0x19')]);_0x475e41[_0x25d7('0x17')]=qs[_0x25d7('0x17')](_0xfb73e[_0x25d7('0x2e')]['offset']);}return _0x1006c4[_0x25d7('0x4c')](_0x475e41);}})[_0x25d7('0x22')](function(_0x3b6c84){if(_0x3b6c84){return _0x3b6c84?{'count':_0x5c459d,'rows':_0x3b6c84}:null;}})[_0x25d7('0x22')](respondWithResult(_0x513006,null))['catch'](handleError(_0x513006,null));};exports['getDescriptions']=function(_0x38158a,_0x508536,_0x2eeedf){var _0x3c1f33={};var _0x193cd={};var _0xa8845c;var _0x3f9680;return db['Dynamics365Configuration'][_0x25d7('0x48')]({'where':{'id':_0x38158a[_0x25d7('0x42')]['id']}})[_0x25d7('0x22')](handleEntityNotFound(_0x508536,null))[_0x25d7('0x22')](function(_0x1ed790){if(_0x1ed790){_0xa8845c=_0x1ed790;_0x193cd['model']=_[_0x25d7('0x49')](db['Dynamics365Field']['rawAttributes']);_0x193cd[_0x25d7('0x2e')]=_['keys'](_0x38158a[_0x25d7('0x2e')]);_0x193cd['filters']=_[_0x25d7('0x30')](_0x193cd[_0x25d7('0x2c')],_0x193cd[_0x25d7('0x2e')]);_0x3c1f33[_0x25d7('0x32')]=_[_0x25d7('0x30')](_0x193cd[_0x25d7('0x2c')],qs['fields'](_0x38158a['query']['fields']));_0x3c1f33[_0x25d7('0x32')]=_0x3c1f33[_0x25d7('0x32')][_0x25d7('0x33')]?_0x3c1f33[_0x25d7('0x32')]:_0x193cd[_0x25d7('0x2c')];_0x3c1f33[_0x25d7('0x35')]=qs[_0x25d7('0x36')](_0x38158a[_0x25d7('0x2e')][_0x25d7('0x36')]);_0x3c1f33['where']=qs[_0x25d7('0x2f')](_['pick'](_0x38158a[_0x25d7('0x2e')],_0x193cd[_0x25d7('0x2f')]));if(_0x38158a[_0x25d7('0x2e')]['filter']){_0x3c1f33[_0x25d7('0x37')]=_[_0x25d7('0x3b')](_0x3c1f33[_0x25d7('0x37')],{'$or':_['map'](_0x3c1f33[_0x25d7('0x32')],function(_0x191750){var _0x150859={};_0x150859[_0x191750]={'$like':'%'+_0x38158a['query'][_0x25d7('0x39')]+'%'};return _0x150859;})});}_0x3c1f33=_[_0x25d7('0x3b')]({},_0x3c1f33,_0x38158a[_0x25d7('0x3c')]);return _0xa8845c[_0x25d7('0x4e')](_0x3c1f33);}})['then'](function(_0x2bc505){if(_0x2bc505){_0x3f9680=_0x2bc505[_0x25d7('0x33')];if(!_0x38158a['query'][_0x25d7('0x34')]('nolimit')){_0x3c1f33[_0x25d7('0x19')]=qs[_0x25d7('0x19')](_0x38158a['query'][_0x25d7('0x19')]);_0x3c1f33['offset']=qs['offset'](_0x38158a[_0x25d7('0x2e')][_0x25d7('0x17')]);}return _0xa8845c['getDescriptions'](_0x3c1f33);}})['then'](function(_0x38f877){if(_0x38f877){return _0x38f877?{'count':_0x3f9680,'rows':_0x38f877}:null;}})[_0x25d7('0x22')](respondWithResult(_0x508536,null))[_0x25d7('0x45')](handleError(_0x508536,null));}; \ No newline at end of file +var _0x8552=['getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','undefined','count','set','save','update','then','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','filter','VIRTUAL','options','Dynamics365Configuration','include','findAll','rows','show','params','rawAttributes','includeAll','find','create','body','destroy','getFields','findOne','Dynamics365Field','sort','merge','nolimit','getSubjects','catch'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0x8552,0x196));var _0x2855=function(_0x3725c8,_0x575de6){_0x3725c8=_0x3725c8-0x0;var _0x260e85=_0x8552[_0x3725c8];return _0x260e85;};'use strict';var emlformat=require(_0x2855('0x0'));var rimraf=require(_0x2855('0x1'));var zipdir=require(_0x2855('0x2'));var jsonpatch=require(_0x2855('0x3'));var rp=require(_0x2855('0x4'));var moment=require('moment');var BPromise=require(_0x2855('0x5'));var Mustache=require('mustache');var util=require(_0x2855('0x6'));var path=require(_0x2855('0x7'));var sox=require(_0x2855('0x8'));var csv=require(_0x2855('0x9'));var ejs=require(_0x2855('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2855('0xb'));var squel=require(_0x2855('0xc'));var crypto=require(_0x2855('0xd'));var jsforce=require(_0x2855('0xe'));var deskjs=require(_0x2855('0xf'));var toCsv=require(_0x2855('0x9'));var querystring=require(_0x2855('0x10'));var Papa=require(_0x2855('0x11'));var Redis=require('ioredis');var authService=require(_0x2855('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2855('0x13'));var hardwareService=require(_0x2855('0x14'));var logger=require(_0x2855('0x15'))('api');var utils=require(_0x2855('0x16'));var config=require(_0x2855('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7642ad,_0x169003){_0x169003=_0x169003||0xcc;return function(_0x129931){if(_0x129931){return _0x7642ad[_0x2855('0x18')](_0x169003);}return _0x7642ad['status'](_0x169003)[_0x2855('0x19')]();};}function respondWithResult(_0xf1ed53,_0x104f26){_0x104f26=_0x104f26||0xc8;return function(_0x20bfe8){if(_0x20bfe8){return _0xf1ed53[_0x2855('0x1a')](_0x104f26)[_0x2855('0x1b')](_0x20bfe8);}};}function respondWithFilteredResult(_0x359f99,_0x379c78){return function(_0x5cf322){if(_0x5cf322){var _0x5baf41=typeof _0x379c78[_0x2855('0x1c')]==='undefined'&&typeof _0x379c78[_0x2855('0x1d')]===_0x2855('0x1e');var _0x2f8d7b=_0x5cf322[_0x2855('0x1f')];var _0x55c0e6=_0x5baf41?0x0:_0x379c78[_0x2855('0x1c')];var _0x50f2b2=_0x5baf41?_0x5cf322[_0x2855('0x1f')]:_0x379c78[_0x2855('0x1c')]+_0x379c78[_0x2855('0x1d')];var _0x30289a;if(_0x50f2b2>=_0x2f8d7b){_0x50f2b2=_0x2f8d7b;_0x30289a=0xc8;}else{_0x30289a=0xce;}_0x359f99[_0x2855('0x1a')](_0x30289a);return _0x359f99[_0x2855('0x20')]('Content-Range',_0x55c0e6+'-'+_0x50f2b2+'/'+_0x2f8d7b)[_0x2855('0x1b')](_0x5cf322);}return null;};}function patchUpdates(_0x3e030a){return function(_0x5f1c47){try{jsonpatch['apply'](_0x5f1c47,_0x3e030a,!![]);}catch(_0x2757c5){return BPromise['reject'](_0x2757c5);}return _0x5f1c47[_0x2855('0x21')]();};}function saveUpdates(_0x139975,_0x5845c1){return function(_0x5d7378){if(_0x5d7378){return _0x5d7378[_0x2855('0x22')](_0x139975)['then'](function(_0x10b726){return _0x10b726;});}return null;};}function removeEntity(_0xae249f,_0x3ad73a){return function(_0x5d45df){if(_0x5d45df){return _0x5d45df['destroy']()[_0x2855('0x23')](function(){_0xae249f[_0x2855('0x1a')](0xcc)[_0x2855('0x19')]();});}};}function handleEntityNotFound(_0x34a28e,_0x1eb879){return function(_0x3517b2){if(!_0x3517b2){_0x34a28e[_0x2855('0x18')](0x194);}return _0x3517b2;};}function handleError(_0x2e652c,_0x435a09){_0x435a09=_0x435a09||0x1f4;return function(_0x2b3d52){logger[_0x2855('0x24')](_0x2b3d52[_0x2855('0x25')]);if(_0x2b3d52[_0x2855('0x26')]){delete _0x2b3d52['name'];}_0x2e652c[_0x2855('0x1a')](_0x435a09)[_0x2855('0x27')](_0x2b3d52);};}exports[_0x2855('0x28')]=function(_0x2865a8,_0x3bf2aa){var _0x2fdb52={},_0x136afe={},_0xb5ee25={'count':0x0,'rows':[]};var _0xc853e9=_[_0x2855('0x29')](db['Dynamics365Configuration']['rawAttributes'],function(_0x19b342){return{'name':_0x19b342[_0x2855('0x2a')],'type':_0x19b342[_0x2855('0x2b')][_0x2855('0x2c')]};});_0x136afe['model']=_[_0x2855('0x29')](_0xc853e9,'name');_0x136afe[_0x2855('0x2d')]=_[_0x2855('0x2e')](_0x2865a8[_0x2855('0x2d')]);_0x136afe[_0x2855('0x2f')]=_[_0x2855('0x30')](_0x136afe[_0x2855('0x31')],_0x136afe[_0x2855('0x2d')]);_0x2fdb52['attributes']=_['intersection'](_0x136afe[_0x2855('0x31')],qs[_0x2855('0x32')](_0x2865a8[_0x2855('0x2d')][_0x2855('0x32')]));_0x2fdb52[_0x2855('0x33')]=_0x2fdb52[_0x2855('0x33')][_0x2855('0x34')]?_0x2fdb52[_0x2855('0x33')]:_0x136afe[_0x2855('0x31')];if(!_0x2865a8[_0x2855('0x2d')][_0x2855('0x35')]('nolimit')){_0x2fdb52[_0x2855('0x1d')]=qs['limit'](_0x2865a8[_0x2855('0x2d')][_0x2855('0x1d')]);_0x2fdb52[_0x2855('0x1c')]=qs[_0x2855('0x1c')](_0x2865a8[_0x2855('0x2d')]['offset']);}_0x2fdb52[_0x2855('0x36')]=qs['sort'](_0x2865a8[_0x2855('0x2d')]['sort']);_0x2fdb52[_0x2855('0x37')]=qs[_0x2855('0x2f')](_[_0x2855('0x38')](_0x2865a8[_0x2855('0x2d')],_0x136afe[_0x2855('0x2f')]),_0xc853e9);if(_0x2865a8[_0x2855('0x2d')][_0x2855('0x39')]){_0x2fdb52['where']=_['merge'](_0x2fdb52['where'],{'$or':_[_0x2855('0x29')](_0xc853e9,function(_0x21cdd1){if(_0x21cdd1[_0x2855('0x2b')]!==_0x2855('0x3a')){var _0x4ba487={};_0x4ba487[_0x21cdd1[_0x2855('0x26')]]={'$like':'%'+_0x2865a8[_0x2855('0x2d')][_0x2855('0x39')]+'%'};return _0x4ba487;}})});}_0x2fdb52=_['merge']({},_0x2fdb52,_0x2865a8[_0x2855('0x3b')]);var _0x457dd1={'where':_0x2fdb52[_0x2855('0x37')]};return db[_0x2855('0x3c')]['count'](_0x457dd1)[_0x2855('0x23')](function(_0x70888d){_0xb5ee25['count']=_0x70888d;if(_0x2865a8[_0x2855('0x2d')]['includeAll']){_0x2fdb52[_0x2855('0x3d')]=[{'all':!![]}];}return db[_0x2855('0x3c')][_0x2855('0x3e')](_0x2fdb52);})[_0x2855('0x23')](function(_0x18b449){_0xb5ee25[_0x2855('0x3f')]=_0x18b449;return _0xb5ee25;})[_0x2855('0x23')](respondWithFilteredResult(_0x3bf2aa,_0x2fdb52))['catch'](handleError(_0x3bf2aa,null));};exports[_0x2855('0x40')]=function(_0x4eb46,_0x3d5e72){var _0x5433a8={'raw':![],'where':{'id':_0x4eb46[_0x2855('0x41')]['id']}},_0x308bc6={};_0x308bc6[_0x2855('0x31')]=_[_0x2855('0x2e')](db[_0x2855('0x3c')][_0x2855('0x42')]);_0x308bc6['query']=_[_0x2855('0x2e')](_0x4eb46[_0x2855('0x2d')]);_0x308bc6[_0x2855('0x2f')]=_[_0x2855('0x30')](_0x308bc6[_0x2855('0x31')],_0x308bc6[_0x2855('0x2d')]);_0x5433a8[_0x2855('0x33')]=_[_0x2855('0x30')](_0x308bc6[_0x2855('0x31')],qs[_0x2855('0x32')](_0x4eb46[_0x2855('0x2d')]['fields']));_0x5433a8[_0x2855('0x33')]=_0x5433a8[_0x2855('0x33')][_0x2855('0x34')]?_0x5433a8[_0x2855('0x33')]:_0x308bc6[_0x2855('0x31')];if(_0x4eb46['query'][_0x2855('0x43')]){_0x5433a8[_0x2855('0x3d')]=[{'all':!![]}];}_0x5433a8=_['merge']({},_0x5433a8,_0x4eb46[_0x2855('0x3b')]);return db[_0x2855('0x3c')][_0x2855('0x44')](_0x5433a8)[_0x2855('0x23')](handleEntityNotFound(_0x3d5e72,null))[_0x2855('0x23')](respondWithResult(_0x3d5e72,null))['catch'](handleError(_0x3d5e72,null));};exports['create']=function(_0x176cb9,_0x2e891a){return db[_0x2855('0x3c')][_0x2855('0x45')](_0x176cb9[_0x2855('0x46')],{})['then'](respondWithResult(_0x2e891a,0xc9))['catch'](handleError(_0x2e891a,null));};exports[_0x2855('0x22')]=function(_0x422f62,_0x245e78){if(_0x422f62[_0x2855('0x46')]['id']){delete _0x422f62[_0x2855('0x46')]['id'];}return db[_0x2855('0x3c')][_0x2855('0x44')]({'where':{'id':_0x422f62[_0x2855('0x41')]['id']}})[_0x2855('0x23')](handleEntityNotFound(_0x245e78,null))[_0x2855('0x23')](saveUpdates(_0x422f62['body'],null))[_0x2855('0x23')](respondWithResult(_0x245e78,null))['catch'](handleError(_0x245e78,null));};exports[_0x2855('0x47')]=function(_0x43d806,_0x375b8d){return db[_0x2855('0x3c')][_0x2855('0x44')]({'where':{'id':_0x43d806[_0x2855('0x41')]['id']}})['then'](handleEntityNotFound(_0x375b8d,null))[_0x2855('0x23')](removeEntity(_0x375b8d,null))['catch'](handleError(_0x375b8d,null));};exports[_0x2855('0x48')]=function(_0x3c01f7,_0x49eed2,_0x54c5e7){var _0x21fa41={};var _0x1eec9c={};var _0x36c8b5;var _0x4f3908;return db['Dynamics365Configuration'][_0x2855('0x49')]({'where':{'id':_0x3c01f7['params']['id']}})[_0x2855('0x23')](handleEntityNotFound(_0x49eed2,null))[_0x2855('0x23')](function(_0x36ebb2){if(_0x36ebb2){_0x36c8b5=_0x36ebb2;_0x1eec9c[_0x2855('0x31')]=_[_0x2855('0x2e')](db[_0x2855('0x4a')]['rawAttributes']);_0x1eec9c[_0x2855('0x2d')]=_[_0x2855('0x2e')](_0x3c01f7[_0x2855('0x2d')]);_0x1eec9c[_0x2855('0x2f')]=_[_0x2855('0x30')](_0x1eec9c[_0x2855('0x31')],_0x1eec9c[_0x2855('0x2d')]);_0x21fa41[_0x2855('0x33')]=_[_0x2855('0x30')](_0x1eec9c[_0x2855('0x31')],qs['fields'](_0x3c01f7['query'][_0x2855('0x32')]));_0x21fa41[_0x2855('0x33')]=_0x21fa41['attributes']['length']?_0x21fa41[_0x2855('0x33')]:_0x1eec9c[_0x2855('0x31')];_0x21fa41[_0x2855('0x36')]=qs[_0x2855('0x4b')](_0x3c01f7['query'][_0x2855('0x4b')]);_0x21fa41['where']=qs[_0x2855('0x2f')](_[_0x2855('0x38')](_0x3c01f7[_0x2855('0x2d')],_0x1eec9c['filters']));if(_0x3c01f7[_0x2855('0x2d')][_0x2855('0x39')]){_0x21fa41[_0x2855('0x37')]=_[_0x2855('0x4c')](_0x21fa41[_0x2855('0x37')],{'$or':_[_0x2855('0x29')](_0x21fa41[_0x2855('0x33')],function(_0x367e08){var _0x23585a={};_0x23585a[_0x367e08]={'$like':'%'+_0x3c01f7[_0x2855('0x2d')]['filter']+'%'};return _0x23585a;})});}_0x21fa41=_[_0x2855('0x4c')]({},_0x21fa41,_0x3c01f7[_0x2855('0x3b')]);return _0x36c8b5[_0x2855('0x48')](_0x21fa41);}})[_0x2855('0x23')](function(_0x4becdb){if(_0x4becdb){_0x4f3908=_0x4becdb[_0x2855('0x34')];if(!_0x3c01f7[_0x2855('0x2d')]['hasOwnProperty'](_0x2855('0x4d'))){_0x21fa41[_0x2855('0x1d')]=qs[_0x2855('0x1d')](_0x3c01f7[_0x2855('0x2d')][_0x2855('0x1d')]);_0x21fa41[_0x2855('0x1c')]=qs['offset'](_0x3c01f7[_0x2855('0x2d')][_0x2855('0x1c')]);}return _0x36c8b5[_0x2855('0x48')](_0x21fa41);}})[_0x2855('0x23')](function(_0xf988f1){if(_0xf988f1){return _0xf988f1?{'count':_0x4f3908,'rows':_0xf988f1}:null;}})['then'](respondWithResult(_0x49eed2,null))['catch'](handleError(_0x49eed2,null));};exports[_0x2855('0x4e')]=function(_0x29c201,_0x453ebf,_0x5435da){var _0x58e198={};var _0x1cdeef={};var _0x37eed5;var _0x1b66b4;return db[_0x2855('0x3c')]['findOne']({'where':{'id':_0x29c201[_0x2855('0x41')]['id']}})[_0x2855('0x23')](handleEntityNotFound(_0x453ebf,null))[_0x2855('0x23')](function(_0x9a6ef6){if(_0x9a6ef6){_0x37eed5=_0x9a6ef6;_0x1cdeef[_0x2855('0x31')]=_['keys'](db[_0x2855('0x4a')]['rawAttributes']);_0x1cdeef[_0x2855('0x2d')]=_[_0x2855('0x2e')](_0x29c201[_0x2855('0x2d')]);_0x1cdeef[_0x2855('0x2f')]=_[_0x2855('0x30')](_0x1cdeef[_0x2855('0x31')],_0x1cdeef[_0x2855('0x2d')]);_0x58e198[_0x2855('0x33')]=_[_0x2855('0x30')](_0x1cdeef['model'],qs[_0x2855('0x32')](_0x29c201[_0x2855('0x2d')][_0x2855('0x32')]));_0x58e198[_0x2855('0x33')]=_0x58e198['attributes'][_0x2855('0x34')]?_0x58e198[_0x2855('0x33')]:_0x1cdeef[_0x2855('0x31')];_0x58e198[_0x2855('0x36')]=qs[_0x2855('0x4b')](_0x29c201[_0x2855('0x2d')][_0x2855('0x4b')]);_0x58e198[_0x2855('0x37')]=qs[_0x2855('0x2f')](_[_0x2855('0x38')](_0x29c201[_0x2855('0x2d')],_0x1cdeef[_0x2855('0x2f')]));if(_0x29c201[_0x2855('0x2d')][_0x2855('0x39')]){_0x58e198[_0x2855('0x37')]=_['merge'](_0x58e198['where'],{'$or':_[_0x2855('0x29')](_0x58e198['attributes'],function(_0xa7d243){var _0x4c805e={};_0x4c805e[_0xa7d243]={'$like':'%'+_0x29c201[_0x2855('0x2d')][_0x2855('0x39')]+'%'};return _0x4c805e;})});}_0x58e198=_[_0x2855('0x4c')]({},_0x58e198,_0x29c201[_0x2855('0x3b')]);return _0x37eed5['getSubjects'](_0x58e198);}})[_0x2855('0x23')](function(_0xc92393){if(_0xc92393){_0x1b66b4=_0xc92393['length'];if(!_0x29c201[_0x2855('0x2d')][_0x2855('0x35')](_0x2855('0x4d'))){_0x58e198['limit']=qs[_0x2855('0x1d')](_0x29c201['query'][_0x2855('0x1d')]);_0x58e198[_0x2855('0x1c')]=qs[_0x2855('0x1c')](_0x29c201[_0x2855('0x2d')][_0x2855('0x1c')]);}return _0x37eed5[_0x2855('0x4e')](_0x58e198);}})[_0x2855('0x23')](function(_0x49d600){if(_0x49d600){return _0x49d600?{'count':_0x1b66b4,'rows':_0x49d600}:null;}})['then'](respondWithResult(_0x453ebf,null))[_0x2855('0x4f')](handleError(_0x453ebf,null));};exports[_0x2855('0x50')]=function(_0x2dadfa,_0x5a127b,_0x322d02){var _0x2d16c0={};var _0x53095e={};var _0x39ce5f;var _0x3bd629;return db[_0x2855('0x3c')][_0x2855('0x49')]({'where':{'id':_0x2dadfa[_0x2855('0x41')]['id']}})[_0x2855('0x23')](handleEntityNotFound(_0x5a127b,null))[_0x2855('0x23')](function(_0x4bcbba){if(_0x4bcbba){_0x39ce5f=_0x4bcbba;_0x53095e[_0x2855('0x31')]=_['keys'](db[_0x2855('0x4a')]['rawAttributes']);_0x53095e[_0x2855('0x2d')]=_[_0x2855('0x2e')](_0x2dadfa[_0x2855('0x2d')]);_0x53095e[_0x2855('0x2f')]=_[_0x2855('0x30')](_0x53095e[_0x2855('0x31')],_0x53095e[_0x2855('0x2d')]);_0x2d16c0[_0x2855('0x33')]=_[_0x2855('0x30')](_0x53095e['model'],qs[_0x2855('0x32')](_0x2dadfa['query'][_0x2855('0x32')]));_0x2d16c0[_0x2855('0x33')]=_0x2d16c0[_0x2855('0x33')][_0x2855('0x34')]?_0x2d16c0[_0x2855('0x33')]:_0x53095e[_0x2855('0x31')];_0x2d16c0[_0x2855('0x36')]=qs[_0x2855('0x4b')](_0x2dadfa[_0x2855('0x2d')]['sort']);_0x2d16c0[_0x2855('0x37')]=qs[_0x2855('0x2f')](_[_0x2855('0x38')](_0x2dadfa[_0x2855('0x2d')],_0x53095e[_0x2855('0x2f')]));if(_0x2dadfa['query'][_0x2855('0x39')]){_0x2d16c0['where']=_[_0x2855('0x4c')](_0x2d16c0[_0x2855('0x37')],{'$or':_[_0x2855('0x29')](_0x2d16c0[_0x2855('0x33')],function(_0x2bca03){var _0x307488={};_0x307488[_0x2bca03]={'$like':'%'+_0x2dadfa['query']['filter']+'%'};return _0x307488;})});}_0x2d16c0=_['merge']({},_0x2d16c0,_0x2dadfa['options']);return _0x39ce5f[_0x2855('0x50')](_0x2d16c0);}})[_0x2855('0x23')](function(_0xf1a725){if(_0xf1a725){_0x3bd629=_0xf1a725['length'];if(!_0x2dadfa[_0x2855('0x2d')]['hasOwnProperty']('nolimit')){_0x2d16c0[_0x2855('0x1d')]=qs[_0x2855('0x1d')](_0x2dadfa['query'][_0x2855('0x1d')]);_0x2d16c0[_0x2855('0x1c')]=qs[_0x2855('0x1c')](_0x2dadfa[_0x2855('0x2d')][_0x2855('0x1c')]);}return _0x39ce5f[_0x2855('0x50')](_0x2d16c0);}})[_0x2855('0x23')](function(_0x1f4893){if(_0x1f4893){return _0x1f4893?{'count':_0x3bd629,'rows':_0x1f4893}:null;}})['then'](respondWithResult(_0x5a127b,null))['catch'](handleError(_0x5a127b,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index bb29c46..8e7ac80 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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x154211,_0x4eeaa2){_0x154211=_0x154211-0x0;var _0x422ac8=_0x6f0d[_0x154211];return _0x422ac8;};'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 _0x9c44=['request-promise','path','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','../../config/logger','api','moment','bluebird'];(function(_0x595cef,_0x34e38e){var _0x5ce935=function(_0x252fac){while(--_0x252fac){_0x595cef['push'](_0x595cef['shift']());}};_0x5ce935(++_0x34e38e);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'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 071ef81..d93e603 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 _0x8fff=['request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xe2faf1,_0x4b7db6){var _0x21f89a=function(_0x587308){while(--_0x587308){_0xe2faf1['push'](_0xe2faf1['shift']());}};_0x21f89a(++_0x4b7db6);}(_0x8fff,0x90));var _0xf8ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8fff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf8ff('0x0'));var moment=require(_0xf8ff('0x1'));var BPromise=require(_0xf8ff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf8ff('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf8ff('0x4'));var logger=require(_0xf8ff('0x5'))(_0xf8ff('0x6'));var config=require(_0xf8ff('0x7'));var jayson=require(_0xf8ff('0x8'));var client=jayson[_0xf8ff('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x385f3c,_0x32f146,_0x156644){return new BPromise(function(_0x229306,_0x270e6a){return client[_0xf8ff('0xa')](_0x385f3c,_0x156644)[_0xf8ff('0xb')](function(_0x18470c){logger[_0xf8ff('0xc')](_0xf8ff('0xd'),_0x32f146,_0xf8ff('0xe'));logger[_0xf8ff('0xf')](_0xf8ff('0x10'),_0x32f146,_0xf8ff('0xe'),JSON['stringify'](_0x18470c));if(_0x18470c[_0xf8ff('0x11')]){if(_0x18470c['error'][_0xf8ff('0x12')]===0x1f4){logger[_0xf8ff('0x11')](_0xf8ff('0xd'),_0x32f146,_0x18470c[_0xf8ff('0x11')][_0xf8ff('0x13')]);return _0x270e6a(_0x18470c[_0xf8ff('0x11')]['message']);}logger[_0xf8ff('0x11')](_0xf8ff('0xd'),_0x32f146,_0x18470c[_0xf8ff('0x11')][_0xf8ff('0x13')]);return _0x229306(_0x18470c[_0xf8ff('0x11')][_0xf8ff('0x13')]);}else{logger['info'](_0xf8ff('0xd'),_0x32f146,'request\x20sent');_0x229306(_0x18470c[_0xf8ff('0x14')]['message']);}})[_0xf8ff('0x15')](function(_0x452d5c){logger['error'](_0xf8ff('0xd'),_0x32f146,_0x452d5c);_0x270e6a(_0x452d5c);});});} \ No newline at end of file +var _0x0faf=['error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0faf,0x13d));var _0xf0fa=function(_0x1f4b18,_0x4e777c){_0x1f4b18=_0x1f4b18-0x0;var _0xde3957=_0x0faf[_0x1f4b18];return _0xde3957;};'use strict';var _=require(_0xf0fa('0x0'));var util=require(_0xf0fa('0x1'));var moment=require(_0xf0fa('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0fa('0x3'));var fs=require('fs');var Redis=require(_0xf0fa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf0fa('0x5'));var logger=require(_0xf0fa('0x6'))('rpc');var config=require(_0xf0fa('0x7'));var jayson=require(_0xf0fa('0x8'));var client=jayson[_0xf0fa('0x9')][_0xf0fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4706a5,_0x339b00,_0xfe887c){return new BPromise(function(_0x3d8df0,_0x16ac20){return client[_0xf0fa('0xb')](_0x4706a5,_0xfe887c)[_0xf0fa('0xc')](function(_0x3cb168){logger[_0xf0fa('0xd')](_0xf0fa('0xe'),_0x339b00,_0xf0fa('0xf'));logger[_0xf0fa('0x10')](_0xf0fa('0x11'),_0x339b00,'request\x20sent',JSON[_0xf0fa('0x12')](_0x3cb168));if(_0x3cb168[_0xf0fa('0x13')]){if(_0x3cb168[_0xf0fa('0x13')][_0xf0fa('0x14')]===0x1f4){logger['error'](_0xf0fa('0xe'),_0x339b00,_0x3cb168[_0xf0fa('0x13')][_0xf0fa('0x15')]);return _0x16ac20(_0x3cb168['error'][_0xf0fa('0x15')]);}logger['error'](_0xf0fa('0xe'),_0x339b00,_0x3cb168['error'][_0xf0fa('0x15')]);return _0x3d8df0(_0x3cb168[_0xf0fa('0x13')][_0xf0fa('0x15')]);}else{logger[_0xf0fa('0xd')](_0xf0fa('0xe'),_0x339b00,_0xf0fa('0xf'));_0x3d8df0(_0x3cb168[_0xf0fa('0x16')][_0xf0fa('0x15')]);}})[_0xf0fa('0x17')](function(_0x52e6f4){logger[_0xf0fa('0x13')](_0xf0fa('0xe'),_0x339b00,_0x52e6f4);_0x16ac20(_0x52e6f4);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 0565c7e..64cc716 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 _0x57f1=['create','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','isAuthenticated','get','/:id'];(function(_0x4660b2,_0x17c4d4){var _0xa5e3aa=function(_0x4eda5f){while(--_0x4eda5f){_0x4660b2['push'](_0x4660b2['shift']());}};_0xa5e3aa(++_0x17c4d4);}(_0x57f1,0x84));var _0x157f=function(_0x1c066d,_0x43e933){_0x1c066d=_0x1c066d-0x0;var _0xe60d31=_0x57f1[_0x1c066d];return _0xe60d31;};'use strict';var multer=require(_0x157f('0x0'));var util=require('util');var path=require(_0x157f('0x1'));var timeout=require(_0x157f('0x2'));var express=require(_0x157f('0x3'));var router=express[_0x157f('0x4')]();var fs_extra=require(_0x157f('0x5'));var auth=require(_0x157f('0x6'));var interaction=require(_0x157f('0x7'));var config=require('../../config/environment');var controller=require(_0x157f('0x8'));router['get']('/',auth[_0x157f('0x9')](),controller['index']);router[_0x157f('0xa')](_0x157f('0xb'),auth[_0x157f('0x9')](),controller['show']);router['post']('/',auth[_0x157f('0x9')](),controller[_0x157f('0xc')]);router[_0x157f('0xd')](_0x157f('0xb'),auth[_0x157f('0x9')](),controller['update']);router[_0x157f('0xe')](_0x157f('0xb'),auth[_0x157f('0x9')](),controller['destroy']);module[_0x157f('0xf')]=router; \ No newline at end of file +var _0x8abb=['isAuthenticated','index','/:id','post','create','put','destroy','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get'];(function(_0x190ff6,_0x515cfd){var _0x5356d2=function(_0x2cf77c){while(--_0x2cf77c){_0x190ff6['push'](_0x190ff6['shift']());}};_0x5356d2(++_0x515cfd);}(_0x8abb,0x1ba));var _0xb8ab=function(_0x26eee0,_0x397b35){_0x26eee0=_0x26eee0-0x0;var _0x52aa95=_0x8abb[_0x26eee0];return _0x52aa95;};'use strict';var multer=require(_0xb8ab('0x0'));var util=require('util');var path=require(_0xb8ab('0x1'));var timeout=require('connect-timeout');var express=require(_0xb8ab('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb8ab('0x3'));var interaction=require(_0xb8ab('0x4'));var config=require(_0xb8ab('0x5'));var controller=require(_0xb8ab('0x6'));router[_0xb8ab('0x7')]('/',auth[_0xb8ab('0x8')](),controller[_0xb8ab('0x9')]);router['get'](_0xb8ab('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xb8ab('0xb')]('/',auth['isAuthenticated'](),controller[_0xb8ab('0xc')]);router[_0xb8ab('0xd')]('/:id',auth[_0xb8ab('0x8')](),controller['update']);router['delete'](_0xb8ab('0xa'),auth[_0xb8ab('0x8')](),controller[_0xb8ab('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 66319af..b238b65 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 _0x991f=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x991f,0x169));var _0xf991=function(_0x56c600,_0x11ff50){_0x56c600=_0x56c600-0x0;var _0x4df318=_0x991f[_0x56c600];return _0x4df318;};'use strict';var Sequelize=require(_0xf991('0x0'));module[_0xf991('0x1')]={'type':{'type':Sequelize[_0xf991('0x2')](_0xf991('0x3'),_0xf991('0x4'),_0xf991('0x5'),_0xf991('0x6'),'picklist'),'defaultValue':_0xf991('0x3')},'content':{'type':Sequelize[_0xf991('0x7')]},'key':{'type':Sequelize[_0xf991('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xf991('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf991('0x7')]},'nameField':{'type':Sequelize[_0xf991('0x7')]},'customField':{'type':Sequelize[_0xf991('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf991('0x7')]}}; \ No newline at end of file +var _0x45ab=['variable','BOOLEAN','exports','string','keyValue','STRING','ENUM'];(function(_0x4ec9e3,_0x15fbf4){var _0x2883ce=function(_0x3e9998){while(--_0x3e9998){_0x4ec9e3['push'](_0x4ec9e3['shift']());}};_0x2883ce(++_0x15fbf4);}(_0x45ab,0x1d0));var _0xb45a=function(_0x25d2fb,_0x18a774){_0x25d2fb=_0x25d2fb-0x0;var _0x1ded53=_0x45ab[_0x25d2fb];return _0x1ded53;};'use strict';var Sequelize=require('sequelize');module[_0xb45a('0x0')]={'type':{'type':Sequelize['ENUM'](_0xb45a('0x1'),'variable','customVariable',_0xb45a('0x2'),'picklist'),'defaultValue':_0xb45a('0x1')},'content':{'type':Sequelize[_0xb45a('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb45a('0x4')](_0xb45a('0x1'),_0xb45a('0x5'),'customVariable')},'keyContent':{'type':Sequelize[_0xb45a('0x3')]},'idField':{'type':Sequelize[_0xb45a('0x3')]},'nameField':{'type':Sequelize[_0xb45a('0x3')]},'customField':{'type':Sequelize[_0xb45a('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 3eba770..fe65016 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 _0x1fcb=['keys','find','create','body','params','destroy','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1fcb,0x15f));var _0xb1fc=function(_0x459bd2,_0x5f77a1){_0x459bd2=_0x459bd2-0x0;var _0x44cef5=_0x1fcb[_0x459bd2];return _0x44cef5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1fc('0x0'));var zipdir=require(_0xb1fc('0x1'));var jsonpatch=require(_0xb1fc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb1fc('0x3'));var Mustache=require('mustache');var util=require(_0xb1fc('0x4'));var path=require(_0xb1fc('0x5'));var sox=require(_0xb1fc('0x6'));var csv=require(_0xb1fc('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb1fc('0x8'));var _=require('lodash');var squel=require(_0xb1fc('0x9'));var crypto=require('crypto');var jsforce=require(_0xb1fc('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb1fc('0xb'));var Redis=require('ioredis');var authService=require(_0xb1fc('0xc'));var qs=require(_0xb1fc('0xd'));var as=require(_0xb1fc('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb1fc('0xf'))('api');var utils=require(_0xb1fc('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xb1fc('0x11'));var db=require(_0xb1fc('0x12'))['db'];function respondWithStatusCode(_0x11fbac,_0x8d5b40){_0x8d5b40=_0x8d5b40||0xcc;return function(_0x428353){if(_0x428353){return _0x11fbac[_0xb1fc('0x13')](_0x8d5b40);}return _0x11fbac['status'](_0x8d5b40)['end']();};}function respondWithResult(_0x162865,_0x131519){_0x131519=_0x131519||0xc8;return function(_0xee8fe4){if(_0xee8fe4){return _0x162865[_0xb1fc('0x14')](_0x131519)[_0xb1fc('0x15')](_0xee8fe4);}};}function respondWithFilteredResult(_0x233fb0,_0x275ebd){return function(_0x258765){if(_0x258765){var _0x31a2e7=typeof _0x275ebd[_0xb1fc('0x16')]===_0xb1fc('0x17')&&typeof _0x275ebd[_0xb1fc('0x18')]==='undefined';var _0x4e1ca1=_0x258765['count'];var _0x4fc19f=_0x31a2e7?0x0:_0x275ebd[_0xb1fc('0x16')];var _0x6377e=_0x31a2e7?_0x258765[_0xb1fc('0x19')]:_0x275ebd[_0xb1fc('0x16')]+_0x275ebd[_0xb1fc('0x18')];var _0x45a56b;if(_0x6377e>=_0x4e1ca1){_0x6377e=_0x4e1ca1;_0x45a56b=0xc8;}else{_0x45a56b=0xce;}_0x233fb0['status'](_0x45a56b);return _0x233fb0[_0xb1fc('0x1a')]('Content-Range',_0x4fc19f+'-'+_0x6377e+'/'+_0x4e1ca1)[_0xb1fc('0x15')](_0x258765);}return null;};}function patchUpdates(_0x176a88){return function(_0xb5116f){try{jsonpatch[_0xb1fc('0x1b')](_0xb5116f,_0x176a88,!![]);}catch(_0x60a5e5){return BPromise[_0xb1fc('0x1c')](_0x60a5e5);}return _0xb5116f[_0xb1fc('0x1d')]();};}function saveUpdates(_0x187600,_0x55d8cf){return function(_0xf109d6){if(_0xf109d6){return _0xf109d6[_0xb1fc('0x1e')](_0x187600)['then'](function(_0x119d85){return _0x119d85;});}return null;};}function removeEntity(_0x4da495,_0x4a9921){return function(_0x30f195){if(_0x30f195){return _0x30f195['destroy']()[_0xb1fc('0x1f')](function(){_0x4da495[_0xb1fc('0x14')](0xcc)[_0xb1fc('0x20')]();});}};}function handleEntityNotFound(_0x5b590f,_0x2f59b3){return function(_0x5717ca){if(!_0x5717ca){_0x5b590f[_0xb1fc('0x13')](0x194);}return _0x5717ca;};}function handleError(_0x38d3cd,_0xb45eeb){_0xb45eeb=_0xb45eeb||0x1f4;return function(_0x5093f6){logger[_0xb1fc('0x21')](_0x5093f6['stack']);if(_0x5093f6[_0xb1fc('0x22')]){delete _0x5093f6[_0xb1fc('0x22')];}_0x38d3cd[_0xb1fc('0x14')](_0xb45eeb)[_0xb1fc('0x23')](_0x5093f6);};}exports[_0xb1fc('0x24')]=function(_0x46a095,_0x525ee7){var _0x2c7229={},_0x473ffb={},_0x2a4a8a={'count':0x0,'rows':[]};var _0x111086=_[_0xb1fc('0x25')](db[_0xb1fc('0x26')][_0xb1fc('0x27')],function(_0x4c3512){return{'name':_0x4c3512[_0xb1fc('0x28')],'type':_0x4c3512[_0xb1fc('0x29')][_0xb1fc('0x2a')]};});_0x473ffb[_0xb1fc('0x2b')]=_['map'](_0x111086,_0xb1fc('0x22'));_0x473ffb[_0xb1fc('0x2c')]=_['keys'](_0x46a095[_0xb1fc('0x2c')]);_0x473ffb['filters']=_[_0xb1fc('0x2d')](_0x473ffb[_0xb1fc('0x2b')],_0x473ffb[_0xb1fc('0x2c')]);_0x2c7229[_0xb1fc('0x2e')]=_[_0xb1fc('0x2d')](_0x473ffb[_0xb1fc('0x2b')],qs[_0xb1fc('0x2f')](_0x46a095[_0xb1fc('0x2c')][_0xb1fc('0x2f')]));_0x2c7229[_0xb1fc('0x2e')]=_0x2c7229['attributes'][_0xb1fc('0x30')]?_0x2c7229[_0xb1fc('0x2e')]:_0x473ffb['model'];if(!_0x46a095[_0xb1fc('0x2c')]['hasOwnProperty'](_0xb1fc('0x31'))){_0x2c7229[_0xb1fc('0x18')]=qs[_0xb1fc('0x18')](_0x46a095['query'][_0xb1fc('0x18')]);_0x2c7229[_0xb1fc('0x16')]=qs['offset'](_0x46a095[_0xb1fc('0x2c')][_0xb1fc('0x16')]);}_0x2c7229[_0xb1fc('0x32')]=qs[_0xb1fc('0x33')](_0x46a095[_0xb1fc('0x2c')][_0xb1fc('0x33')]);_0x2c7229['where']=qs[_0xb1fc('0x34')](_[_0xb1fc('0x35')](_0x46a095['query'],_0x473ffb[_0xb1fc('0x34')]),_0x111086);if(_0x46a095[_0xb1fc('0x2c')]['filter']){_0x2c7229[_0xb1fc('0x36')]=_[_0xb1fc('0x37')](_0x2c7229['where'],{'$or':_[_0xb1fc('0x25')](_0x111086,function(_0x42df6d){if(_0x42df6d[_0xb1fc('0x29')]!==_0xb1fc('0x38')){var _0x30710e={};_0x30710e[_0x42df6d['name']]={'$like':'%'+_0x46a095['query'][_0xb1fc('0x39')]+'%'};return _0x30710e;}})});}_0x2c7229=_['merge']({},_0x2c7229,_0x46a095[_0xb1fc('0x3a')]);var _0x1a5f11={'where':_0x2c7229[_0xb1fc('0x36')]};return db[_0xb1fc('0x26')][_0xb1fc('0x19')](_0x1a5f11)[_0xb1fc('0x1f')](function(_0x348c99){_0x2a4a8a[_0xb1fc('0x19')]=_0x348c99;if(_0x46a095[_0xb1fc('0x2c')][_0xb1fc('0x3b')]){_0x2c7229[_0xb1fc('0x3c')]=[{'all':!![]}];}return db[_0xb1fc('0x26')][_0xb1fc('0x3d')](_0x2c7229);})[_0xb1fc('0x1f')](function(_0x209c54){_0x2a4a8a['rows']=_0x209c54;return _0x2a4a8a;})[_0xb1fc('0x1f')](respondWithFilteredResult(_0x525ee7,_0x2c7229))[_0xb1fc('0x3e')](handleError(_0x525ee7,null));};exports['show']=function(_0x2b949c,_0x47a8e6){var _0x1fbedf={'raw':!![],'where':{'id':_0x2b949c['params']['id']}},_0x4329be={};_0x4329be[_0xb1fc('0x2b')]=_[_0xb1fc('0x3f')](db[_0xb1fc('0x26')][_0xb1fc('0x27')]);_0x4329be[_0xb1fc('0x2c')]=_[_0xb1fc('0x3f')](_0x2b949c[_0xb1fc('0x2c')]);_0x4329be[_0xb1fc('0x34')]=_[_0xb1fc('0x2d')](_0x4329be[_0xb1fc('0x2b')],_0x4329be['query']);_0x1fbedf[_0xb1fc('0x2e')]=_[_0xb1fc('0x2d')](_0x4329be[_0xb1fc('0x2b')],qs[_0xb1fc('0x2f')](_0x2b949c[_0xb1fc('0x2c')][_0xb1fc('0x2f')]));_0x1fbedf['attributes']=_0x1fbedf['attributes']['length']?_0x1fbedf[_0xb1fc('0x2e')]:_0x4329be['model'];if(_0x2b949c[_0xb1fc('0x2c')][_0xb1fc('0x3b')]){_0x1fbedf[_0xb1fc('0x3c')]=[{'all':!![]}];}_0x1fbedf=_[_0xb1fc('0x37')]({},_0x1fbedf,_0x2b949c[_0xb1fc('0x3a')]);return db['Dynamics365Field'][_0xb1fc('0x40')](_0x1fbedf)[_0xb1fc('0x1f')](handleEntityNotFound(_0x47a8e6,null))[_0xb1fc('0x1f')](respondWithResult(_0x47a8e6,null))[_0xb1fc('0x3e')](handleError(_0x47a8e6,null));};exports[_0xb1fc('0x41')]=function(_0x2cb538,_0x4aa09d){return db[_0xb1fc('0x26')][_0xb1fc('0x41')](_0x2cb538['body'],{})['then'](respondWithResult(_0x4aa09d,0xc9))[_0xb1fc('0x3e')](handleError(_0x4aa09d,null));};exports['update']=function(_0x1c075a,_0x17956a){if(_0x1c075a[_0xb1fc('0x42')]['id']){delete _0x1c075a['body']['id'];}return db[_0xb1fc('0x26')][_0xb1fc('0x40')]({'where':{'id':_0x1c075a[_0xb1fc('0x43')]['id']}})[_0xb1fc('0x1f')](handleEntityNotFound(_0x17956a,null))['then'](saveUpdates(_0x1c075a['body'],null))[_0xb1fc('0x1f')](respondWithResult(_0x17956a,null))[_0xb1fc('0x3e')](handleError(_0x17956a,null));};exports[_0xb1fc('0x44')]=function(_0x43266e,_0x246c73){return db['Dynamics365Field'][_0xb1fc('0x40')]({'where':{'id':_0x43266e['params']['id']}})[_0xb1fc('0x1f')](handleEntityNotFound(_0x246c73,null))['then'](removeEntity(_0x246c73,null))[_0xb1fc('0x3e')](handleError(_0x246c73,null));}; \ No newline at end of file +var _0xfe01=['jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Dynamics365Field','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x28509e,_0x30bf0d){var _0x3a24c3=function(_0x3d278e){while(--_0x3d278e){_0x28509e['push'](_0x28509e['shift']());}};_0x3a24c3(++_0x30bf0d);}(_0xfe01,0x199));var _0x1fe0=function(_0x4c9b72,_0x429a1c){_0x4c9b72=_0x4c9b72-0x0;var _0x443f33=_0xfe01[_0x4c9b72];return _0x443f33;};'use strict';var emlformat=require(_0x1fe0('0x0'));var rimraf=require(_0x1fe0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1fe0('0x2'));var rp=require(_0x1fe0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1fe0('0x4'));var path=require(_0x1fe0('0x5'));var sox=require('sox');var csv=require(_0x1fe0('0x6'));var ejs=require(_0x1fe0('0x7'));var fs=require('fs');var fs_extra=require(_0x1fe0('0x8'));var _=require(_0x1fe0('0x9'));var squel=require('squel');var crypto=require(_0x1fe0('0xa'));var jsforce=require(_0x1fe0('0xb'));var deskjs=require(_0x1fe0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1fe0('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1fe0('0xe'));var qs=require(_0x1fe0('0xf'));var as=require(_0x1fe0('0x10'));var hardwareService=require(_0x1fe0('0x11'));var logger=require(_0x1fe0('0x12'))('api');var utils=require(_0x1fe0('0x13'));var config=require(_0x1fe0('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xce52ea,_0x42b497){_0x42b497=_0x42b497||0xcc;return function(_0x330126){if(_0x330126){return _0xce52ea['sendStatus'](_0x42b497);}return _0xce52ea[_0x1fe0('0x15')](_0x42b497)[_0x1fe0('0x16')]();};}function respondWithResult(_0x519eea,_0x19f2d8){_0x19f2d8=_0x19f2d8||0xc8;return function(_0x11552f){if(_0x11552f){return _0x519eea['status'](_0x19f2d8)[_0x1fe0('0x17')](_0x11552f);}};}function respondWithFilteredResult(_0x1376a0,_0x271323){return function(_0x4540d0){if(_0x4540d0){var _0x549acc=typeof _0x271323[_0x1fe0('0x18')]===_0x1fe0('0x19')&&typeof _0x271323[_0x1fe0('0x1a')]==='undefined';var _0x5ecbd2=_0x4540d0[_0x1fe0('0x1b')];var _0x5382ea=_0x549acc?0x0:_0x271323[_0x1fe0('0x18')];var _0x40df1e=_0x549acc?_0x4540d0[_0x1fe0('0x1b')]:_0x271323[_0x1fe0('0x18')]+_0x271323[_0x1fe0('0x1a')];var _0x41cce4;if(_0x40df1e>=_0x5ecbd2){_0x40df1e=_0x5ecbd2;_0x41cce4=0xc8;}else{_0x41cce4=0xce;}_0x1376a0['status'](_0x41cce4);return _0x1376a0[_0x1fe0('0x1c')](_0x1fe0('0x1d'),_0x5382ea+'-'+_0x40df1e+'/'+_0x5ecbd2)[_0x1fe0('0x17')](_0x4540d0);}return null;};}function patchUpdates(_0x4cb681){return function(_0x2e2c5e){try{jsonpatch[_0x1fe0('0x1e')](_0x2e2c5e,_0x4cb681,!![]);}catch(_0x524e6c){return BPromise[_0x1fe0('0x1f')](_0x524e6c);}return _0x2e2c5e[_0x1fe0('0x20')]();};}function saveUpdates(_0x343d74,_0x2a18cb){return function(_0x4e31e2){if(_0x4e31e2){return _0x4e31e2['update'](_0x343d74)[_0x1fe0('0x21')](function(_0x15152f){return _0x15152f;});}return null;};}function removeEntity(_0x21620f,_0x57ea48){return function(_0x346b03){if(_0x346b03){return _0x346b03[_0x1fe0('0x22')]()[_0x1fe0('0x21')](function(){_0x21620f[_0x1fe0('0x15')](0xcc)[_0x1fe0('0x16')]();});}};}function handleEntityNotFound(_0x28015c,_0x2b7687){return function(_0x47dddd){if(!_0x47dddd){_0x28015c['sendStatus'](0x194);}return _0x47dddd;};}function handleError(_0x336ee1,_0x241242){_0x241242=_0x241242||0x1f4;return function(_0x2e33e6){logger['error'](_0x2e33e6[_0x1fe0('0x23')]);if(_0x2e33e6[_0x1fe0('0x24')]){delete _0x2e33e6[_0x1fe0('0x24')];}_0x336ee1['status'](_0x241242)['send'](_0x2e33e6);};}exports[_0x1fe0('0x25')]=function(_0x273af3,_0x242684){var _0x315b1c={},_0x4ee8cb={},_0x4b179b={'count':0x0,'rows':[]};var _0x217c28=_[_0x1fe0('0x26')](db['Dynamics365Field'][_0x1fe0('0x27')],function(_0x247e6c){return{'name':_0x247e6c[_0x1fe0('0x28')],'type':_0x247e6c[_0x1fe0('0x29')][_0x1fe0('0x2a')]};});_0x4ee8cb['model']=_[_0x1fe0('0x26')](_0x217c28,'name');_0x4ee8cb[_0x1fe0('0x2b')]=_['keys'](_0x273af3[_0x1fe0('0x2b')]);_0x4ee8cb[_0x1fe0('0x2c')]=_['intersection'](_0x4ee8cb[_0x1fe0('0x2d')],_0x4ee8cb[_0x1fe0('0x2b')]);_0x315b1c['attributes']=_['intersection'](_0x4ee8cb['model'],qs[_0x1fe0('0x2e')](_0x273af3[_0x1fe0('0x2b')][_0x1fe0('0x2e')]));_0x315b1c[_0x1fe0('0x2f')]=_0x315b1c['attributes'][_0x1fe0('0x30')]?_0x315b1c[_0x1fe0('0x2f')]:_0x4ee8cb[_0x1fe0('0x2d')];if(!_0x273af3[_0x1fe0('0x2b')]['hasOwnProperty'](_0x1fe0('0x31'))){_0x315b1c[_0x1fe0('0x1a')]=qs['limit'](_0x273af3[_0x1fe0('0x2b')][_0x1fe0('0x1a')]);_0x315b1c[_0x1fe0('0x18')]=qs[_0x1fe0('0x18')](_0x273af3[_0x1fe0('0x2b')][_0x1fe0('0x18')]);}_0x315b1c[_0x1fe0('0x32')]=qs[_0x1fe0('0x33')](_0x273af3['query'][_0x1fe0('0x33')]);_0x315b1c[_0x1fe0('0x34')]=qs['filters'](_[_0x1fe0('0x35')](_0x273af3[_0x1fe0('0x2b')],_0x4ee8cb[_0x1fe0('0x2c')]),_0x217c28);if(_0x273af3[_0x1fe0('0x2b')][_0x1fe0('0x36')]){_0x315b1c['where']=_['merge'](_0x315b1c[_0x1fe0('0x34')],{'$or':_[_0x1fe0('0x26')](_0x217c28,function(_0x2b8446){if(_0x2b8446[_0x1fe0('0x29')]!==_0x1fe0('0x37')){var _0xb6eaa8={};_0xb6eaa8[_0x2b8446[_0x1fe0('0x24')]]={'$like':'%'+_0x273af3['query'][_0x1fe0('0x36')]+'%'};return _0xb6eaa8;}})});}_0x315b1c=_[_0x1fe0('0x38')]({},_0x315b1c,_0x273af3[_0x1fe0('0x39')]);var _0x1ca6f6={'where':_0x315b1c[_0x1fe0('0x34')]};return db[_0x1fe0('0x3a')][_0x1fe0('0x1b')](_0x1ca6f6)[_0x1fe0('0x21')](function(_0x470010){_0x4b179b[_0x1fe0('0x1b')]=_0x470010;if(_0x273af3['query'][_0x1fe0('0x3b')]){_0x315b1c[_0x1fe0('0x3c')]=[{'all':!![]}];}return db[_0x1fe0('0x3a')][_0x1fe0('0x3d')](_0x315b1c);})[_0x1fe0('0x21')](function(_0x47f153){_0x4b179b[_0x1fe0('0x3e')]=_0x47f153;return _0x4b179b;})['then'](respondWithFilteredResult(_0x242684,_0x315b1c))[_0x1fe0('0x3f')](handleError(_0x242684,null));};exports['show']=function(_0x37bd79,_0xaafeae){var _0x3f4bca={'raw':!![],'where':{'id':_0x37bd79[_0x1fe0('0x40')]['id']}},_0x58d292={};_0x58d292[_0x1fe0('0x2d')]=_['keys'](db[_0x1fe0('0x3a')][_0x1fe0('0x27')]);_0x58d292[_0x1fe0('0x2b')]=_['keys'](_0x37bd79[_0x1fe0('0x2b')]);_0x58d292[_0x1fe0('0x2c')]=_[_0x1fe0('0x41')](_0x58d292[_0x1fe0('0x2d')],_0x58d292[_0x1fe0('0x2b')]);_0x3f4bca['attributes']=_[_0x1fe0('0x41')](_0x58d292['model'],qs[_0x1fe0('0x2e')](_0x37bd79[_0x1fe0('0x2b')][_0x1fe0('0x2e')]));_0x3f4bca['attributes']=_0x3f4bca[_0x1fe0('0x2f')][_0x1fe0('0x30')]?_0x3f4bca['attributes']:_0x58d292[_0x1fe0('0x2d')];if(_0x37bd79['query'][_0x1fe0('0x3b')]){_0x3f4bca[_0x1fe0('0x3c')]=[{'all':!![]}];}_0x3f4bca=_['merge']({},_0x3f4bca,_0x37bd79['options']);return db[_0x1fe0('0x3a')][_0x1fe0('0x42')](_0x3f4bca)[_0x1fe0('0x21')](handleEntityNotFound(_0xaafeae,null))[_0x1fe0('0x21')](respondWithResult(_0xaafeae,null))[_0x1fe0('0x3f')](handleError(_0xaafeae,null));};exports[_0x1fe0('0x43')]=function(_0x56cc32,_0x276e2a){return db[_0x1fe0('0x3a')][_0x1fe0('0x43')](_0x56cc32[_0x1fe0('0x44')],{})[_0x1fe0('0x21')](respondWithResult(_0x276e2a,0xc9))[_0x1fe0('0x3f')](handleError(_0x276e2a,null));};exports[_0x1fe0('0x45')]=function(_0x5ede1d,_0x3f8433){if(_0x5ede1d[_0x1fe0('0x44')]['id']){delete _0x5ede1d[_0x1fe0('0x44')]['id'];}return db[_0x1fe0('0x3a')]['find']({'where':{'id':_0x5ede1d[_0x1fe0('0x40')]['id']}})['then'](handleEntityNotFound(_0x3f8433,null))['then'](saveUpdates(_0x5ede1d[_0x1fe0('0x44')],null))[_0x1fe0('0x21')](respondWithResult(_0x3f8433,null))[_0x1fe0('0x3f')](handleError(_0x3f8433,null));};exports['destroy']=function(_0x5e9359,_0x2b68c6){return db[_0x1fe0('0x3a')][_0x1fe0('0x42')]({'where':{'id':_0x5e9359['params']['id']}})[_0x1fe0('0x21')](handleEntityNotFound(_0x2b68c6,null))[_0x1fe0('0x21')](removeEntity(_0x2b68c6,null))[_0x1fe0('0x3f')](handleError(_0x2b68c6,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 8e424cf..f67c7d9 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 _0xf28c=['rimraf','../../config/environment','exports','Dynamics365Field','FieldId','util','api','moment','bluebird','request-promise'];(function(_0x20be5f,_0x1de5c7){var _0x30f91f=function(_0x1d1348){while(--_0x1d1348){_0x20be5f['push'](_0x20be5f['shift']());}};_0x30f91f(++_0x1de5c7);}(_0xf28c,0x87));var _0xcf28=function(_0x189715,_0xb904de){_0x189715=_0x189715-0x0;var _0x547804=_0xf28c[_0x189715];return _0x547804;};'use strict';var _=require('lodash');var util=require(_0xcf28('0x0'));var logger=require('../../config/logger')(_0xcf28('0x1'));var moment=require(_0xcf28('0x2'));var BPromise=require(_0xcf28('0x3'));var rp=require(_0xcf28('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf28('0x5'));var config=require(_0xcf28('0x6'));var attributes=require('./intDynamics365Field.attributes');module[_0xcf28('0x7')]=function(_0x46ac1d,_0x301ec6){return _0x46ac1d['define'](_0xcf28('0x8'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0xcf28('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb9e=['../../config/logger','api','moment','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','FieldId','lodash','util'];(function(_0x207d2f,_0x44400f){var _0x3c3498=function(_0x57fdfb){while(--_0x57fdfb){_0x207d2f['push'](_0x207d2f['shift']());}};_0x3c3498(++_0x44400f);}(_0xeb9e,0x191));var _0xeeb9=function(_0x450e64,_0x5004ba){_0x450e64=_0x450e64-0x0;var _0x24f22a=_0xeb9e[_0x450e64];return _0x24f22a;};'use strict';var _=require(_0xeeb9('0x0'));var util=require(_0xeeb9('0x1'));var logger=require(_0xeeb9('0x2'))(_0xeeb9('0x3'));var moment=require(_0xeeb9('0x4'));var BPromise=require('bluebird');var rp=require(_0xeeb9('0x5'));var fs=require('fs');var path=require(_0xeeb9('0x6'));var rimraf=require(_0xeeb9('0x7'));var config=require('../../config/environment');var attributes=require(_0xeeb9('0x8'));module[_0xeeb9('0x9')]=function(_0x35baa5,_0x23fa8c){return _0x35baa5['define'](_0xeeb9('0xa'),attributes,{'tableName':_0xeeb9('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0xeeb9('0xc')],'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 49b1d3e..d7a17b8 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 _0xc51a=['code','message','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x11b1b3,_0xf3cc69){var _0x437029=function(_0x40499a){while(--_0x40499a){_0x11b1b3['push'](_0x11b1b3['shift']());}};_0x437029(++_0xf3cc69);}(_0xc51a,0xae));var _0xac51=function(_0x3aeb53,_0x4985e9){_0x3aeb53=_0x3aeb53-0x0;var _0x18da07=_0xc51a[_0x3aeb53];return _0x18da07;};'use strict';var _=require('lodash');var util=require(_0xac51('0x0'));var moment=require(_0xac51('0x1'));var BPromise=require('bluebird');var rs=require(_0xac51('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac51('0x3'))['db'];var utils=require(_0xac51('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xac51('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xac51('0x6')][_0xac51('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xf95afd,_0x634645,_0x3940cf){return new BPromise(function(_0x5a2c84,_0x82789f){return client[_0xac51('0x8')](_0xf95afd,_0x3940cf)[_0xac51('0x9')](function(_0x174009){logger[_0xac51('0xa')](_0xac51('0xb'),_0x634645,'request\x20sent');logger[_0xac51('0xc')](_0xac51('0xd'),_0x634645,'request\x20sent',JSON[_0xac51('0xe')](_0x174009));if(_0x174009['error']){if(_0x174009[_0xac51('0xf')][_0xac51('0x10')]===0x1f4){logger[_0xac51('0xf')](_0xac51('0xb'),_0x634645,_0x174009[_0xac51('0xf')][_0xac51('0x11')]);return _0x82789f(_0x174009[_0xac51('0xf')][_0xac51('0x11')]);}logger[_0xac51('0xf')](_0xac51('0xb'),_0x634645,_0x174009[_0xac51('0xf')][_0xac51('0x11')]);return _0x5a2c84(_0x174009[_0xac51('0xf')]['message']);}else{logger['info'](_0xac51('0xb'),_0x634645,'request\x20sent');_0x5a2c84(_0x174009[_0xac51('0x12')][_0xac51('0x11')]);}})['catch'](function(_0x35381a){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x634645,_0x35381a);_0x82789f(_0x35381a);});});} \ No newline at end of file +var _0xe1a1=['then','info','Dynamics365Field,\x20%s,\x20%s','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x1da46b,_0x109ac4){var _0x3a94ef=function(_0x31a2b4){while(--_0x31a2b4){_0x1da46b['push'](_0x1da46b['shift']());}};_0x3a94ef(++_0x109ac4);}(_0xe1a1,0x1ba));var _0x1e1a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe1a1[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x1e1a('0x0'));var util=require(_0x1e1a('0x1'));var moment=require(_0x1e1a('0x2'));var BPromise=require(_0x1e1a('0x3'));var rs=require(_0x1e1a('0x4'));var fs=require('fs');var Redis=require(_0x1e1a('0x5'));var db=require(_0x1e1a('0x6'))['db'];var utils=require(_0x1e1a('0x7'));var logger=require(_0x1e1a('0x8'))(_0x1e1a('0x9'));var config=require(_0x1e1a('0xa'));var jayson=require(_0x1e1a('0xb'));var client=jayson[_0x1e1a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19fbe1,_0x3f9959,_0x31fd08){return new BPromise(function(_0x53ba74,_0xe210a5){return client[_0x1e1a('0xd')](_0x19fbe1,_0x31fd08)[_0x1e1a('0xe')](function(_0x248988){logger[_0x1e1a('0xf')](_0x1e1a('0x10'),_0x3f9959,'request\x20sent');logger['debug'](_0x1e1a('0x11'),_0x3f9959,_0x1e1a('0x12'),JSON[_0x1e1a('0x13')](_0x248988));if(_0x248988[_0x1e1a('0x14')]){if(_0x248988['error'][_0x1e1a('0x15')]===0x1f4){logger[_0x1e1a('0x14')](_0x1e1a('0x10'),_0x3f9959,_0x248988['error']['message']);return _0xe210a5(_0x248988['error'][_0x1e1a('0x16')]);}logger[_0x1e1a('0x14')](_0x1e1a('0x10'),_0x3f9959,_0x248988[_0x1e1a('0x14')][_0x1e1a('0x16')]);return _0x53ba74(_0x248988[_0x1e1a('0x14')][_0x1e1a('0x16')]);}else{logger[_0x1e1a('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x3f9959,_0x1e1a('0x12'));_0x53ba74(_0x248988[_0x1e1a('0x17')][_0x1e1a('0x16')]);}})['catch'](function(_0x5f1b84){logger[_0x1e1a('0x14')](_0x1e1a('0x10'),_0x3f9959,_0x5f1b84);_0xe210a5(_0x5f1b84);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index ede478b..eb8f070 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 _0xef42=['getConfigurations','/:id/fields','create','post','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x2f3332,_0x1a18f4){var _0x1feea3=function(_0x5f40d1){while(--_0x5f40d1){_0x2f3332['push'](_0x2f3332['shift']());}};_0x1feea3(++_0x1a18f4);}(_0xef42,0x1c0));var _0x2ef4=function(_0x41a4bb,_0x36b115){_0x41a4bb=_0x41a4bb-0x0;var _0x4d4239=_0xef42[_0x41a4bb];return _0x4d4239;};'use strict';var multer=require('multer');var util=require(_0x2ef4('0x0'));var path=require(_0x2ef4('0x1'));var timeout=require(_0x2ef4('0x2'));var express=require('express');var router=express[_0x2ef4('0x3')]();var fs_extra=require(_0x2ef4('0x4'));var auth=require(_0x2ef4('0x5'));var interaction=require(_0x2ef4('0x6'));var config=require('../../config/environment');var controller=require(_0x2ef4('0x7'));router[_0x2ef4('0x8')]('/',auth[_0x2ef4('0x9')](),controller[_0x2ef4('0xa')]);router['get'](_0x2ef4('0xb'),auth['isAuthenticated'](),controller[_0x2ef4('0xc')]);router['get'](_0x2ef4('0xd'),auth[_0x2ef4('0x9')](),controller[_0x2ef4('0xe')]);router[_0x2ef4('0x8')](_0x2ef4('0xf'),auth[_0x2ef4('0x9')](),controller['getFields']);router['post']('/',auth[_0x2ef4('0x9')](),controller[_0x2ef4('0x10')]);router[_0x2ef4('0x11')]('/:id/configurations',auth[_0x2ef4('0x9')](),controller['addConfiguration']);router['put'](_0x2ef4('0xb'),auth[_0x2ef4('0x9')](),controller[_0x2ef4('0x12')]);router[_0x2ef4('0x13')](_0x2ef4('0xb'),auth[_0x2ef4('0x9')](),controller[_0x2ef4('0x14')]);module[_0x2ef4('0x15')]=router; \ No newline at end of file +var _0xea51=['getFields','post','create','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x48b2cb,_0x5da5e7){var _0x3ad90f=function(_0x432a1e){while(--_0x432a1e){_0x48b2cb['push'](_0x48b2cb['shift']());}};_0x3ad90f(++_0x5da5e7);}(_0xea51,0xf8));var _0x1ea5=function(_0x2d1e45,_0x4a9d30){_0x2d1e45=_0x2d1e45-0x0;var _0x75982b=_0xea51[_0x2d1e45];return _0x75982b;};'use strict';var multer=require(_0x1ea5('0x0'));var util=require(_0x1ea5('0x1'));var path=require(_0x1ea5('0x2'));var timeout=require(_0x1ea5('0x3'));var express=require(_0x1ea5('0x4'));var router=express[_0x1ea5('0x5')]();var fs_extra=require(_0x1ea5('0x6'));var auth=require(_0x1ea5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1ea5('0x8'));var controller=require('./intFreshdeskAccount.controller');router[_0x1ea5('0x9')]('/',auth[_0x1ea5('0xa')](),controller[_0x1ea5('0xb')]);router[_0x1ea5('0x9')](_0x1ea5('0xc'),auth[_0x1ea5('0xa')](),controller[_0x1ea5('0xd')]);router['get'](_0x1ea5('0xe'),auth[_0x1ea5('0xa')](),controller[_0x1ea5('0xf')]);router['get']('/:id/fields',auth[_0x1ea5('0xa')](),controller[_0x1ea5('0x10')]);router[_0x1ea5('0x11')]('/',auth[_0x1ea5('0xa')](),controller[_0x1ea5('0x12')]);router[_0x1ea5('0x11')](_0x1ea5('0xe'),auth[_0x1ea5('0xa')](),controller[_0x1ea5('0x13')]);router[_0x1ea5('0x14')](_0x1ea5('0xc'),auth[_0x1ea5('0xa')](),controller[_0x1ea5('0x15')]);router[_0x1ea5('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1ea5('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 1e783aa..166e7e0 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(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x6d11,0xbf));var _0x16d1=function(_0x29b44a,_0xa8c3d4){_0x29b44a=_0x29b44a-0x0;var _0x5515a6=_0x6d11[_0x29b44a];return _0x5515a6;};'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 _0x1a37=['sequelize','exports','STRING','username','remoteUri'];(function(_0x21a9cf,_0x51f954){var _0x5d4ba7=function(_0x18d186){while(--_0x18d186){_0x21a9cf['push'](_0x21a9cf['shift']());}};_0x5d4ba7(++_0x51f954);}(_0x1a37,0xb4));var _0x71a3=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x1a37[_0x45bf86];return _0x1f02b7;};'use strict';var Sequelize=require(_0x71a3('0x0'));module[_0x71a3('0x1')]={'name':{'type':Sequelize[_0x71a3('0x2')]},'description':{'type':Sequelize[_0x71a3('0x2')]},'username':{'type':Sequelize[_0x71a3('0x2')],'unique':_0x71a3('0x3')},'apiKey':{'type':Sequelize[_0x71a3('0x2')]},'remoteUri':{'type':Sequelize[_0x71a3('0x2')],'unique':_0x71a3('0x4')},'serverUrl':{'type':Sequelize[_0x71a3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 698e555..18541cd 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 _0xfd6f=['keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','show','params','length','find','create','body','getConfigurations','FreshdeskConfiguration','order','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','toString','requester','subject','description','priority','group','source','ticket_type','company','includes','custom_text','custom_dropdown','label','default','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','undefined','limit','count','offset','json','apply','reject','update','end','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','model','query'];(function(_0x4cb306,_0x4300cc){var _0x8369a5=function(_0x5b7e24){while(--_0x5b7e24){_0x4cb306['push'](_0x4cb306['shift']());}};_0x8369a5(++_0x4300cc);}(_0xfd6f,0x19d));var _0xffd6=function(_0x23f577,_0x155bf7){_0x23f577=_0x23f577-0x0;var _0x52f80b=_0xfd6f[_0x23f577];return _0x52f80b;};'use strict';var emlformat=require(_0xffd6('0x0'));var rimraf=require(_0xffd6('0x1'));var zipdir=require(_0xffd6('0x2'));var jsonpatch=require(_0xffd6('0x3'));var rp=require(_0xffd6('0x4'));var moment=require('moment');var BPromise=require(_0xffd6('0x5'));var Mustache=require(_0xffd6('0x6'));var util=require(_0xffd6('0x7'));var path=require(_0xffd6('0x8'));var sox=require('sox');var csv=require(_0xffd6('0x9'));var ejs=require(_0xffd6('0xa'));var fs=require('fs');var fs_extra=require(_0xffd6('0xb'));var _=require(_0xffd6('0xc'));var squel=require('squel');var crypto=require(_0xffd6('0xd'));var jsforce=require(_0xffd6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xffd6('0xf'));var Papa=require(_0xffd6('0x10'));var Redis=require(_0xffd6('0x11'));var authService=require(_0xffd6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xffd6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xffd6('0x14'));var utils=require(_0xffd6('0x15'));var config=require(_0xffd6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xffd6('0x17'))['db'];var integrations=require(_0xffd6('0x18'));function respondWithStatusCode(_0x59d2d8,_0x12cbe9){_0x12cbe9=_0x12cbe9||0xcc;return function(_0x1bef90){if(_0x1bef90){return _0x59d2d8[_0xffd6('0x19')](_0x12cbe9);}return _0x59d2d8[_0xffd6('0x1a')](_0x12cbe9)['end']();};}function respondWithResult(_0x5f4765,_0x26ef4){_0x26ef4=_0x26ef4||0xc8;return function(_0x345c44){if(_0x345c44){return _0x5f4765[_0xffd6('0x1a')](_0x26ef4)['json'](_0x345c44);}};}function respondWithFilteredResult(_0x17114f,_0x131661){return function(_0x57e34e){if(_0x57e34e){var _0x39c0a6=typeof _0x131661['offset']===_0xffd6('0x1b')&&typeof _0x131661[_0xffd6('0x1c')]===_0xffd6('0x1b');var _0xb4cfe2=_0x57e34e[_0xffd6('0x1d')];var _0x57af76=_0x39c0a6?0x0:_0x131661[_0xffd6('0x1e')];var _0x39938d=_0x39c0a6?_0x57e34e[_0xffd6('0x1d')]:_0x131661[_0xffd6('0x1e')]+_0x131661['limit'];var _0x4e0446;if(_0x39938d>=_0xb4cfe2){_0x39938d=_0xb4cfe2;_0x4e0446=0xc8;}else{_0x4e0446=0xce;}_0x17114f[_0xffd6('0x1a')](_0x4e0446);return _0x17114f['set']('Content-Range',_0x57af76+'-'+_0x39938d+'/'+_0xb4cfe2)[_0xffd6('0x1f')](_0x57e34e);}return null;};}function patchUpdates(_0x1a7102){return function(_0x3240b1){try{jsonpatch[_0xffd6('0x20')](_0x3240b1,_0x1a7102,!![]);}catch(_0x191642){return BPromise[_0xffd6('0x21')](_0x191642);}return _0x3240b1['save']();};}function saveUpdates(_0x44e5f5,_0x26daf2){return function(_0x531b45){if(_0x531b45){return _0x531b45[_0xffd6('0x22')](_0x44e5f5)['then'](function(_0x270704){return _0x270704;});}return null;};}function removeEntity(_0x207f18,_0x18fd0f){return function(_0x5e0e4c){if(_0x5e0e4c){return _0x5e0e4c['destroy']()['then'](function(){_0x207f18[_0xffd6('0x1a')](0xcc)[_0xffd6('0x23')]();});}};}function handleEntityNotFound(_0x17218b,_0x55c752){return function(_0x423bb8){if(!_0x423bb8){_0x17218b[_0xffd6('0x19')](0x194);}return _0x423bb8;};}function handleError(_0x12352c,_0xdec862){_0xdec862=_0xdec862||0x1f4;return function(_0x3789f8){logger['error'](_0x3789f8[_0xffd6('0x24')]);if(_0x3789f8[_0xffd6('0x25')]){delete _0x3789f8[_0xffd6('0x25')];}_0x12352c[_0xffd6('0x1a')](_0xdec862)[_0xffd6('0x26')](_0x3789f8);};}exports[_0xffd6('0x27')]=function(_0x2f3645,_0x902b39){var _0x23bd05={},_0x4440f8={},_0x44276a={'count':0x0,'rows':[]};var _0x4d0901=_[_0xffd6('0x28')](db[_0xffd6('0x29')][_0xffd6('0x2a')],function(_0x35328a){return{'name':_0x35328a[_0xffd6('0x2b')],'type':_0x35328a[_0xffd6('0x2c')]['key']};});_0x4440f8[_0xffd6('0x2d')]=_[_0xffd6('0x28')](_0x4d0901,_0xffd6('0x25'));_0x4440f8[_0xffd6('0x2e')]=_[_0xffd6('0x2f')](_0x2f3645[_0xffd6('0x2e')]);_0x4440f8[_0xffd6('0x30')]=_[_0xffd6('0x31')](_0x4440f8[_0xffd6('0x2d')],_0x4440f8[_0xffd6('0x2e')]);_0x23bd05[_0xffd6('0x32')]=_[_0xffd6('0x31')](_0x4440f8['model'],qs[_0xffd6('0x33')](_0x2f3645[_0xffd6('0x2e')][_0xffd6('0x33')]));_0x23bd05['attributes']=_0x23bd05['attributes']['length']?_0x23bd05[_0xffd6('0x32')]:_0x4440f8[_0xffd6('0x2d')];if(!_0x2f3645[_0xffd6('0x2e')][_0xffd6('0x34')](_0xffd6('0x35'))){_0x23bd05[_0xffd6('0x1c')]=qs[_0xffd6('0x1c')](_0x2f3645['query'][_0xffd6('0x1c')]);_0x23bd05['offset']=qs[_0xffd6('0x1e')](_0x2f3645[_0xffd6('0x2e')][_0xffd6('0x1e')]);}_0x23bd05['order']=qs[_0xffd6('0x36')](_0x2f3645[_0xffd6('0x2e')]['sort']);_0x23bd05[_0xffd6('0x37')]=qs['filters'](_[_0xffd6('0x38')](_0x2f3645[_0xffd6('0x2e')],_0x4440f8[_0xffd6('0x30')]),_0x4d0901);if(_0x2f3645[_0xffd6('0x2e')][_0xffd6('0x39')]){_0x23bd05[_0xffd6('0x37')]=_[_0xffd6('0x3a')](_0x23bd05[_0xffd6('0x37')],{'$or':_[_0xffd6('0x28')](_0x4d0901,function(_0x4b91fa){if(_0x4b91fa[_0xffd6('0x2c')]!==_0xffd6('0x3b')){var _0x27d0c5={};_0x27d0c5[_0x4b91fa[_0xffd6('0x25')]]={'$like':'%'+_0x2f3645[_0xffd6('0x2e')][_0xffd6('0x39')]+'%'};return _0x27d0c5;}})});}_0x23bd05=_[_0xffd6('0x3a')]({},_0x23bd05,_0x2f3645[_0xffd6('0x3c')]);var _0x2abf19={'where':_0x23bd05[_0xffd6('0x37')]};return db[_0xffd6('0x29')]['count'](_0x2abf19)['then'](function(_0x1bdbc0){_0x44276a[_0xffd6('0x1d')]=_0x1bdbc0;if(_0x2f3645['query'][_0xffd6('0x3d')]){_0x23bd05[_0xffd6('0x3e')]=[{'all':!![]}];}return db[_0xffd6('0x29')][_0xffd6('0x3f')](_0x23bd05);})[_0xffd6('0x40')](function(_0x359998){_0x44276a[_0xffd6('0x41')]=_0x359998;return _0x44276a;})[_0xffd6('0x40')](respondWithFilteredResult(_0x902b39,_0x23bd05))[_0xffd6('0x42')](handleError(_0x902b39,null));};exports[_0xffd6('0x43')]=function(_0x297d05,_0x3791be){var _0x1b680a={'raw':![],'where':{'id':_0x297d05[_0xffd6('0x44')]['id']}},_0x3b5d60={};_0x3b5d60[_0xffd6('0x2d')]=_['keys'](db['FreshdeskAccount']['rawAttributes']);_0x3b5d60[_0xffd6('0x2e')]=_[_0xffd6('0x2f')](_0x297d05[_0xffd6('0x2e')]);_0x3b5d60['filters']=_['intersection'](_0x3b5d60['model'],_0x3b5d60['query']);_0x1b680a[_0xffd6('0x32')]=_[_0xffd6('0x31')](_0x3b5d60[_0xffd6('0x2d')],qs[_0xffd6('0x33')](_0x297d05[_0xffd6('0x2e')][_0xffd6('0x33')]));_0x1b680a[_0xffd6('0x32')]=_0x1b680a[_0xffd6('0x32')][_0xffd6('0x45')]?_0x1b680a[_0xffd6('0x32')]:_0x3b5d60[_0xffd6('0x2d')];if(_0x297d05[_0xffd6('0x2e')][_0xffd6('0x3d')]){_0x1b680a[_0xffd6('0x3e')]=[{'all':!![]}];}_0x1b680a=_['merge']({},_0x1b680a,_0x297d05[_0xffd6('0x3c')]);return db[_0xffd6('0x29')][_0xffd6('0x46')](_0x1b680a)[_0xffd6('0x40')](handleEntityNotFound(_0x3791be,null))[_0xffd6('0x40')](respondWithResult(_0x3791be,null))['catch'](handleError(_0x3791be,null));};exports[_0xffd6('0x47')]=function(_0x2d0a51,_0x5d81b5){return db[_0xffd6('0x29')][_0xffd6('0x47')](_0x2d0a51[_0xffd6('0x48')],{})[_0xffd6('0x40')](respondWithResult(_0x5d81b5,0xc9))[_0xffd6('0x42')](handleError(_0x5d81b5,null));};exports[_0xffd6('0x22')]=function(_0x17e609,_0x1930f9){if(_0x17e609[_0xffd6('0x48')]['id']){delete _0x17e609['body']['id'];}return db[_0xffd6('0x29')][_0xffd6('0x46')]({'where':{'id':_0x17e609['params']['id']}})[_0xffd6('0x40')](handleEntityNotFound(_0x1930f9,null))[_0xffd6('0x40')](saveUpdates(_0x17e609[_0xffd6('0x48')],null))['then'](respondWithResult(_0x1930f9,null))[_0xffd6('0x42')](handleError(_0x1930f9,null));};exports['destroy']=function(_0x48366a,_0x5ebed3){return db[_0xffd6('0x29')]['find']({'where':{'id':_0x48366a[_0xffd6('0x44')]['id']}})[_0xffd6('0x40')](handleEntityNotFound(_0x5ebed3,null))[_0xffd6('0x40')](removeEntity(_0x5ebed3,null))['catch'](handleError(_0x5ebed3,null));};exports[_0xffd6('0x49')]=function(_0x50aa80,_0x124912,_0x2b377e){var _0x295646={};var _0x3c1b27={};var _0x7dc3ae;var _0x2a27d9;return db[_0xffd6('0x29')]['findOne']({'where':{'id':_0x50aa80[_0xffd6('0x44')]['id']}})[_0xffd6('0x40')](handleEntityNotFound(_0x124912,null))[_0xffd6('0x40')](function(_0xa788ab){if(_0xa788ab){_0x7dc3ae=_0xa788ab;_0x3c1b27[_0xffd6('0x2d')]=_[_0xffd6('0x2f')](db[_0xffd6('0x4a')]['rawAttributes']);_0x3c1b27[_0xffd6('0x2e')]=_[_0xffd6('0x2f')](_0x50aa80[_0xffd6('0x2e')]);_0x3c1b27[_0xffd6('0x30')]=_['intersection'](_0x3c1b27[_0xffd6('0x2d')],_0x3c1b27[_0xffd6('0x2e')]);_0x295646[_0xffd6('0x32')]=_[_0xffd6('0x31')](_0x3c1b27[_0xffd6('0x2d')],qs[_0xffd6('0x33')](_0x50aa80[_0xffd6('0x2e')][_0xffd6('0x33')]));_0x295646[_0xffd6('0x32')]=_0x295646['attributes'][_0xffd6('0x45')]?_0x295646[_0xffd6('0x32')]:_0x3c1b27[_0xffd6('0x2d')];_0x295646[_0xffd6('0x4b')]=qs[_0xffd6('0x36')](_0x50aa80[_0xffd6('0x2e')][_0xffd6('0x36')]);_0x295646['where']=qs[_0xffd6('0x30')](_[_0xffd6('0x38')](_0x50aa80[_0xffd6('0x2e')],_0x3c1b27[_0xffd6('0x30')]));if(_0x50aa80[_0xffd6('0x2e')][_0xffd6('0x39')]){_0x295646['where']=_[_0xffd6('0x3a')](_0x295646[_0xffd6('0x37')],{'$or':_[_0xffd6('0x28')](_0x295646[_0xffd6('0x32')],function(_0x28f1df){var _0x12aff9={};_0x12aff9[_0x28f1df]={'$like':'%'+_0x50aa80[_0xffd6('0x2e')][_0xffd6('0x39')]+'%'};return _0x12aff9;})});}_0x295646=_[_0xffd6('0x3a')]({},_0x295646,_0x50aa80[_0xffd6('0x3c')]);return _0x7dc3ae[_0xffd6('0x49')](_0x295646);}})['then'](function(_0x461771){if(_0x461771){_0x2a27d9=_0x461771['length'];if(!_0x50aa80['query'][_0xffd6('0x34')]('nolimit')){_0x295646[_0xffd6('0x1c')]=qs['limit'](_0x50aa80[_0xffd6('0x2e')]['limit']);_0x295646[_0xffd6('0x1e')]=qs['offset'](_0x50aa80[_0xffd6('0x2e')][_0xffd6('0x1e')]);}return _0x7dc3ae[_0xffd6('0x49')](_0x295646);}})[_0xffd6('0x40')](function(_0x4f0db0){if(_0x4f0db0){return _0x4f0db0?{'count':_0x2a27d9,'rows':_0x4f0db0}:null;}})[_0xffd6('0x40')](respondWithResult(_0x124912,null))[_0xffd6('0x42')](handleError(_0x124912,null));};exports['addConfiguration']=function(_0x438264,_0x1c324c,_0x25b1a2){if(_0x438264['body']['id']){delete _0x438264['body']['id'];}return db['FreshdeskAccount'][_0xffd6('0x4c')]({'where':{'id':_0x438264['params']['id']}})['then'](handleEntityNotFound(_0x1c324c,null))[_0xffd6('0x40')](function(_0x8d5a9){if(_0x8d5a9){_0x438264[_0xffd6('0x48')][_0xffd6('0x4d')]=_0x8d5a9['id'];_0x438264['body'][_0xffd6('0x4e')]=integrations[_0xffd6('0x4f')](_0x438264['body'][_0xffd6('0x50')],_0x438264[_0xffd6('0x48')]['type']);_0x438264[_0xffd6('0x48')][_0xffd6('0x51')]=integrations[_0xffd6('0x52')](_0x438264[_0xffd6('0x48')][_0xffd6('0x50')],_0x438264[_0xffd6('0x48')]['type']);return db[_0xffd6('0x4a')]['create'](_0x438264[_0xffd6('0x48')],{'include':[{'model':db[_0xffd6('0x53')],'as':'Subjects'},{'model':db[_0xffd6('0x53')],'as':_0xffd6('0x51')}]});}return null;})[_0xffd6('0x40')](respondWithResult(_0x1c324c,null))[_0xffd6('0x42')](handleError(_0x1c324c,null));};exports[_0xffd6('0x54')]=function(_0x3e9b21,_0x8b8b47,_0x4c115e){var _0x4bf7a1='';return db['FreshdeskAccount'][_0xffd6('0x4c')]({'where':{'id':_0x3e9b21[_0xffd6('0x44')]['id']},'attributes':['id',_0xffd6('0x55'),_0xffd6('0x56')]})[_0xffd6('0x40')](handleEntityNotFound(_0x8b8b47,null))[_0xffd6('0x40')](function(_0x431a6e){if(_0x431a6e){_0x4bf7a1=_0x431a6e[_0xffd6('0x55')];var _0x9bd712=_0x4bf7a1[_0xffd6('0x57')](-0x1);if(_0x9bd712==='/'){_0x4bf7a1=_0x4bf7a1[_0xffd6('0x58')](0x0,_0x4bf7a1[_0xffd6('0x59')](_0x9bd712));}return rp({'method':_0xffd6('0x5a'),'uri':util[_0xffd6('0x5b')](_0xffd6('0x5c'),_0x4bf7a1,_0xffd6('0x5d')),'headers':{'Authorization':util[_0xffd6('0x5b')](_0xffd6('0x5e'),new Buffer(util[_0xffd6('0x5b')]('%s:X',_0x431a6e[_0xffd6('0x56')]))[_0xffd6('0x5f')]('base64'))},'json':!![]});}})[_0xffd6('0x40')](function(_0x2c0592){if(_0x2c0592){var _0x5c9382=[_0xffd6('0x60'),_0xffd6('0x61'),'agent',_0xffd6('0x62'),'status',_0xffd6('0x63'),_0xffd6('0x64'),_0xffd6('0x65'),_0xffd6('0x66'),_0xffd6('0x64'),_0xffd6('0x67')];_['remove'](_0x2c0592,function(_0x23e630){return _0x5c9382[_0xffd6('0x68')](_0x23e630[_0xffd6('0x25')])||!_0x23e630['default']&&_0x23e630['type']!==_0xffd6('0x69')&&_0x23e630[_0xffd6('0x2c')]!==_0xffd6('0x6a');});return{'count':_0x2c0592[_0xffd6('0x45')],'rows':_['map'](_0x2c0592,function(_0x278cbf){return{'id':_0x278cbf[_0xffd6('0x25')],'name':_0x278cbf[_0xffd6('0x6b')],'custom':!_0x278cbf[_0xffd6('0x6c')],'options':_0x278cbf[_0xffd6('0x6d')]?_[_0xffd6('0x28')](_0x278cbf[_0xffd6('0x6d')],function(_0xbc3d41){return{'name':_[_0xffd6('0x6e')](_0xbc3d41),'value':_0xbc3d41};}):[]};})};}})[_0xffd6('0x40')](respondWithResult(_0x8b8b47,null))[_0xffd6('0x42')](function(_0x5b1ade){var _0x114f90=_0x3e9b21[_0xffd6('0x2e')][_0xffd6('0x6f')]?0x1f4:_0x5b1ade[_0xffd6('0x70')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xffd6('0x54'),_0x114f90,JSON[_0xffd6('0x71')](_0x5b1ade));delete _0x5b1ade['name'];if(_0x114f90===0x191){_0x114f90=0x190;}_0x8b8b47[_0xffd6('0x1a')](_0x114f90)[_0xffd6('0x26')](_0x3e9b21[_0xffd6('0x2e')][_0xffd6('0x6f')]?{'message':_0xffd6('0x72'),'statusCode':_0x5b1ade[_0xffd6('0x70')]}:_0x5b1ade);});}; \ No newline at end of file +var _0xd957=['choices','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','stack','name','send','map','FreshdeskAccount','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','order','AccountId','Subjects','getSubjects','channel','FreshdeskField','Descriptions','getFields','apiKey','remoteUri','slice','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','description','priority','group','source','ticket_type','company','remove','custom_text','custom_dropdown','label'];(function(_0x3542dc,_0x1688a7){var _0x565444=function(_0x573905){while(--_0x573905){_0x3542dc['push'](_0x3542dc['shift']());}};_0x565444(++_0x1688a7);}(_0xd957,0x153));var _0x7d95=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd957[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x7d95('0x0'));var rimraf=require(_0x7d95('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7d95('0x2'));var rp=require(_0x7d95('0x3'));var moment=require('moment');var BPromise=require(_0x7d95('0x4'));var Mustache=require(_0x7d95('0x5'));var util=require(_0x7d95('0x6'));var path=require(_0x7d95('0x7'));var sox=require(_0x7d95('0x8'));var csv=require(_0x7d95('0x9'));var ejs=require(_0x7d95('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d95('0xb'));var squel=require(_0x7d95('0xc'));var crypto=require('crypto');var jsforce=require(_0x7d95('0xd'));var deskjs=require(_0x7d95('0xe'));var toCsv=require(_0x7d95('0x9'));var querystring=require(_0x7d95('0xf'));var Papa=require(_0x7d95('0x10'));var Redis=require('ioredis');var authService=require(_0x7d95('0x11'));var qs=require(_0x7d95('0x12'));var as=require(_0x7d95('0x13'));var hardwareService=require(_0x7d95('0x14'));var logger=require(_0x7d95('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x7d95('0x16'));var licenseUtil=require(_0x7d95('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7d95('0x18'));function respondWithStatusCode(_0x1d6b13,_0x310657){_0x310657=_0x310657||0xcc;return function(_0x396fa4){if(_0x396fa4){return _0x1d6b13[_0x7d95('0x19')](_0x310657);}return _0x1d6b13[_0x7d95('0x1a')](_0x310657)['end']();};}function respondWithResult(_0x82ac5f,_0x56e18f){_0x56e18f=_0x56e18f||0xc8;return function(_0x253133){if(_0x253133){return _0x82ac5f['status'](_0x56e18f)[_0x7d95('0x1b')](_0x253133);}};}function respondWithFilteredResult(_0x4f333d,_0x3b519a){return function(_0x30c2f8){if(_0x30c2f8){var _0x293f87=typeof _0x3b519a[_0x7d95('0x1c')]==='undefined'&&typeof _0x3b519a['limit']===_0x7d95('0x1d');var _0xab6ca=_0x30c2f8[_0x7d95('0x1e')];var _0x33a7ab=_0x293f87?0x0:_0x3b519a['offset'];var _0x1c656c=_0x293f87?_0x30c2f8[_0x7d95('0x1e')]:_0x3b519a['offset']+_0x3b519a[_0x7d95('0x1f')];var _0x1b5629;if(_0x1c656c>=_0xab6ca){_0x1c656c=_0xab6ca;_0x1b5629=0xc8;}else{_0x1b5629=0xce;}_0x4f333d[_0x7d95('0x1a')](_0x1b5629);return _0x4f333d[_0x7d95('0x20')](_0x7d95('0x21'),_0x33a7ab+'-'+_0x1c656c+'/'+_0xab6ca)[_0x7d95('0x1b')](_0x30c2f8);}return null;};}function patchUpdates(_0x3ae23a){return function(_0x45bec0){try{jsonpatch[_0x7d95('0x22')](_0x45bec0,_0x3ae23a,!![]);}catch(_0x489e8a){return BPromise[_0x7d95('0x23')](_0x489e8a);}return _0x45bec0['save']();};}function saveUpdates(_0x1e2b58,_0x4c0133){return function(_0x49386b){if(_0x49386b){return _0x49386b[_0x7d95('0x24')](_0x1e2b58)[_0x7d95('0x25')](function(_0x2ebd02){return _0x2ebd02;});}return null;};}function removeEntity(_0x54c0a2,_0x2f54c4){return function(_0xd7d5){if(_0xd7d5){return _0xd7d5['destroy']()[_0x7d95('0x25')](function(){_0x54c0a2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x548b5d,_0x3d869f){return function(_0x285890){if(!_0x285890){_0x548b5d['sendStatus'](0x194);}return _0x285890;};}function handleError(_0x25f5f2,_0x13f975){_0x13f975=_0x13f975||0x1f4;return function(_0x70c5cb){logger['error'](_0x70c5cb[_0x7d95('0x26')]);if(_0x70c5cb[_0x7d95('0x27')]){delete _0x70c5cb[_0x7d95('0x27')];}_0x25f5f2['status'](_0x13f975)[_0x7d95('0x28')](_0x70c5cb);};}exports['index']=function(_0x216fa6,_0x3be6fa){var _0x3d3bb8={},_0x3300c0={},_0x1e1b56={'count':0x0,'rows':[]};var _0x109b37=_[_0x7d95('0x29')](db[_0x7d95('0x2a')]['rawAttributes'],function(_0x2bb638){return{'name':_0x2bb638['fieldName'],'type':_0x2bb638[_0x7d95('0x2b')]['key']};});_0x3300c0[_0x7d95('0x2c')]=_[_0x7d95('0x29')](_0x109b37,_0x7d95('0x27'));_0x3300c0[_0x7d95('0x2d')]=_[_0x7d95('0x2e')](_0x216fa6[_0x7d95('0x2d')]);_0x3300c0['filters']=_[_0x7d95('0x2f')](_0x3300c0[_0x7d95('0x2c')],_0x3300c0[_0x7d95('0x2d')]);_0x3d3bb8[_0x7d95('0x30')]=_[_0x7d95('0x2f')](_0x3300c0[_0x7d95('0x2c')],qs['fields'](_0x216fa6[_0x7d95('0x2d')][_0x7d95('0x31')]));_0x3d3bb8['attributes']=_0x3d3bb8['attributes'][_0x7d95('0x32')]?_0x3d3bb8[_0x7d95('0x30')]:_0x3300c0['model'];if(!_0x216fa6[_0x7d95('0x2d')][_0x7d95('0x33')](_0x7d95('0x34'))){_0x3d3bb8[_0x7d95('0x1f')]=qs[_0x7d95('0x1f')](_0x216fa6[_0x7d95('0x2d')][_0x7d95('0x1f')]);_0x3d3bb8['offset']=qs[_0x7d95('0x1c')](_0x216fa6[_0x7d95('0x2d')][_0x7d95('0x1c')]);}_0x3d3bb8['order']=qs[_0x7d95('0x35')](_0x216fa6[_0x7d95('0x2d')]['sort']);_0x3d3bb8[_0x7d95('0x36')]=qs[_0x7d95('0x37')](_[_0x7d95('0x38')](_0x216fa6[_0x7d95('0x2d')],_0x3300c0['filters']),_0x109b37);if(_0x216fa6['query']['filter']){_0x3d3bb8['where']=_['merge'](_0x3d3bb8['where'],{'$or':_['map'](_0x109b37,function(_0x263785){if(_0x263785[_0x7d95('0x2b')]!==_0x7d95('0x39')){var _0x28d7eb={};_0x28d7eb[_0x263785[_0x7d95('0x27')]]={'$like':'%'+_0x216fa6[_0x7d95('0x2d')][_0x7d95('0x3a')]+'%'};return _0x28d7eb;}})});}_0x3d3bb8=_[_0x7d95('0x3b')]({},_0x3d3bb8,_0x216fa6[_0x7d95('0x3c')]);var _0x6901c5={'where':_0x3d3bb8['where']};return db[_0x7d95('0x2a')][_0x7d95('0x1e')](_0x6901c5)[_0x7d95('0x25')](function(_0x3fbb25){_0x1e1b56[_0x7d95('0x1e')]=_0x3fbb25;if(_0x216fa6[_0x7d95('0x2d')][_0x7d95('0x3d')]){_0x3d3bb8[_0x7d95('0x3e')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x7d95('0x3f')](_0x3d3bb8);})[_0x7d95('0x25')](function(_0x543bb7){_0x1e1b56[_0x7d95('0x40')]=_0x543bb7;return _0x1e1b56;})[_0x7d95('0x25')](respondWithFilteredResult(_0x3be6fa,_0x3d3bb8))['catch'](handleError(_0x3be6fa,null));};exports[_0x7d95('0x41')]=function(_0x548276,_0x4c627c){var _0x332f5a={'raw':![],'where':{'id':_0x548276[_0x7d95('0x42')]['id']}},_0x61bff6={};_0x61bff6[_0x7d95('0x2c')]=_[_0x7d95('0x2e')](db[_0x7d95('0x2a')][_0x7d95('0x43')]);_0x61bff6[_0x7d95('0x2d')]=_[_0x7d95('0x2e')](_0x548276['query']);_0x61bff6[_0x7d95('0x37')]=_['intersection'](_0x61bff6[_0x7d95('0x2c')],_0x61bff6[_0x7d95('0x2d')]);_0x332f5a[_0x7d95('0x30')]=_[_0x7d95('0x2f')](_0x61bff6[_0x7d95('0x2c')],qs[_0x7d95('0x31')](_0x548276[_0x7d95('0x2d')][_0x7d95('0x31')]));_0x332f5a[_0x7d95('0x30')]=_0x332f5a[_0x7d95('0x30')]['length']?_0x332f5a[_0x7d95('0x30')]:_0x61bff6[_0x7d95('0x2c')];if(_0x548276[_0x7d95('0x2d')][_0x7d95('0x3d')]){_0x332f5a[_0x7d95('0x3e')]=[{'all':!![]}];}_0x332f5a=_[_0x7d95('0x3b')]({},_0x332f5a,_0x548276['options']);return db['FreshdeskAccount'][_0x7d95('0x44')](_0x332f5a)[_0x7d95('0x25')](handleEntityNotFound(_0x4c627c,null))['then'](respondWithResult(_0x4c627c,null))[_0x7d95('0x45')](handleError(_0x4c627c,null));};exports[_0x7d95('0x46')]=function(_0x5c87eb,_0x476d06){return db[_0x7d95('0x2a')][_0x7d95('0x46')](_0x5c87eb[_0x7d95('0x47')],{})[_0x7d95('0x25')](respondWithResult(_0x476d06,0xc9))[_0x7d95('0x45')](handleError(_0x476d06,null));};exports[_0x7d95('0x24')]=function(_0x3709f3,_0x2109b4){if(_0x3709f3['body']['id']){delete _0x3709f3[_0x7d95('0x47')]['id'];}return db['FreshdeskAccount'][_0x7d95('0x44')]({'where':{'id':_0x3709f3['params']['id']}})[_0x7d95('0x25')](handleEntityNotFound(_0x2109b4,null))[_0x7d95('0x25')](saveUpdates(_0x3709f3[_0x7d95('0x47')],null))[_0x7d95('0x25')](respondWithResult(_0x2109b4,null))[_0x7d95('0x45')](handleError(_0x2109b4,null));};exports[_0x7d95('0x48')]=function(_0x19fa68,_0x25bf9f){return db[_0x7d95('0x2a')]['find']({'where':{'id':_0x19fa68[_0x7d95('0x42')]['id']}})[_0x7d95('0x25')](handleEntityNotFound(_0x25bf9f,null))[_0x7d95('0x25')](removeEntity(_0x25bf9f,null))[_0x7d95('0x45')](handleError(_0x25bf9f,null));};exports[_0x7d95('0x49')]=function(_0x118ff0,_0x2ba8b1,_0x40fbbc){var _0x3dbb32={};var _0x22f6b4={};var _0x1c2d38;var _0x2e927b;return db[_0x7d95('0x2a')][_0x7d95('0x4a')]({'where':{'id':_0x118ff0['params']['id']}})[_0x7d95('0x25')](handleEntityNotFound(_0x2ba8b1,null))[_0x7d95('0x25')](function(_0x26edb3){if(_0x26edb3){_0x1c2d38=_0x26edb3;_0x22f6b4[_0x7d95('0x2c')]=_[_0x7d95('0x2e')](db[_0x7d95('0x4b')][_0x7d95('0x43')]);_0x22f6b4[_0x7d95('0x2d')]=_[_0x7d95('0x2e')](_0x118ff0[_0x7d95('0x2d')]);_0x22f6b4[_0x7d95('0x37')]=_[_0x7d95('0x2f')](_0x22f6b4[_0x7d95('0x2c')],_0x22f6b4[_0x7d95('0x2d')]);_0x3dbb32[_0x7d95('0x30')]=_[_0x7d95('0x2f')](_0x22f6b4['model'],qs['fields'](_0x118ff0[_0x7d95('0x2d')][_0x7d95('0x31')]));_0x3dbb32[_0x7d95('0x30')]=_0x3dbb32['attributes'][_0x7d95('0x32')]?_0x3dbb32[_0x7d95('0x30')]:_0x22f6b4[_0x7d95('0x2c')];_0x3dbb32[_0x7d95('0x4c')]=qs[_0x7d95('0x35')](_0x118ff0[_0x7d95('0x2d')]['sort']);_0x3dbb32['where']=qs[_0x7d95('0x37')](_[_0x7d95('0x38')](_0x118ff0[_0x7d95('0x2d')],_0x22f6b4[_0x7d95('0x37')]));if(_0x118ff0[_0x7d95('0x2d')][_0x7d95('0x3a')]){_0x3dbb32['where']=_[_0x7d95('0x3b')](_0x3dbb32[_0x7d95('0x36')],{'$or':_[_0x7d95('0x29')](_0x3dbb32[_0x7d95('0x30')],function(_0x247904){var _0x47c6e6={};_0x47c6e6[_0x247904]={'$like':'%'+_0x118ff0[_0x7d95('0x2d')][_0x7d95('0x3a')]+'%'};return _0x47c6e6;})});}_0x3dbb32=_[_0x7d95('0x3b')]({},_0x3dbb32,_0x118ff0[_0x7d95('0x3c')]);return _0x1c2d38[_0x7d95('0x49')](_0x3dbb32);}})[_0x7d95('0x25')](function(_0x3a74a7){if(_0x3a74a7){_0x2e927b=_0x3a74a7[_0x7d95('0x32')];if(!_0x118ff0[_0x7d95('0x2d')]['hasOwnProperty']('nolimit')){_0x3dbb32['limit']=qs[_0x7d95('0x1f')](_0x118ff0[_0x7d95('0x2d')][_0x7d95('0x1f')]);_0x3dbb32[_0x7d95('0x1c')]=qs[_0x7d95('0x1c')](_0x118ff0[_0x7d95('0x2d')]['offset']);}return _0x1c2d38['getConfigurations'](_0x3dbb32);}})[_0x7d95('0x25')](function(_0x30e57f){if(_0x30e57f){return _0x30e57f?{'count':_0x2e927b,'rows':_0x30e57f}:null;}})[_0x7d95('0x25')](respondWithResult(_0x2ba8b1,null))['catch'](handleError(_0x2ba8b1,null));};exports['addConfiguration']=function(_0x4dd1d3,_0x4495a5,_0x5a9e3b){if(_0x4dd1d3['body']['id']){delete _0x4dd1d3[_0x7d95('0x47')]['id'];}return db[_0x7d95('0x2a')][_0x7d95('0x4a')]({'where':{'id':_0x4dd1d3['params']['id']}})[_0x7d95('0x25')](handleEntityNotFound(_0x4495a5,null))[_0x7d95('0x25')](function(_0x1dcb62){if(_0x1dcb62){_0x4dd1d3[_0x7d95('0x47')][_0x7d95('0x4d')]=_0x1dcb62['id'];_0x4dd1d3[_0x7d95('0x47')][_0x7d95('0x4e')]=integrations[_0x7d95('0x4f')](_0x4dd1d3[_0x7d95('0x47')]['channel'],_0x4dd1d3['body'][_0x7d95('0x2b')]);_0x4dd1d3[_0x7d95('0x47')]['Descriptions']=integrations['getDescriptions'](_0x4dd1d3[_0x7d95('0x47')][_0x7d95('0x50')],_0x4dd1d3[_0x7d95('0x47')][_0x7d95('0x2b')]);return db['FreshdeskConfiguration'][_0x7d95('0x46')](_0x4dd1d3[_0x7d95('0x47')],{'include':[{'model':db[_0x7d95('0x51')],'as':_0x7d95('0x4e')},{'model':db[_0x7d95('0x51')],'as':_0x7d95('0x52')}]});}return null;})[_0x7d95('0x25')](respondWithResult(_0x4495a5,null))['catch'](handleError(_0x4495a5,null));};exports[_0x7d95('0x53')]=function(_0x40a092,_0x242f1b,_0x3a7853){var _0x7ee627='';return db[_0x7d95('0x2a')][_0x7d95('0x4a')]({'where':{'id':_0x40a092[_0x7d95('0x42')]['id']},'attributes':['id','remoteUri',_0x7d95('0x54')]})['then'](handleEntityNotFound(_0x242f1b,null))['then'](function(_0x26c74a){if(_0x26c74a){_0x7ee627=_0x26c74a[_0x7d95('0x55')];var _0xbcd536=_0x7ee627[_0x7d95('0x56')](-0x1);if(_0xbcd536==='/'){_0x7ee627=_0x7ee627['substring'](0x0,_0x7ee627['lastIndexOf'](_0xbcd536));}return rp({'method':_0x7d95('0x57'),'uri':util[_0x7d95('0x58')]('%s/%s',_0x7ee627,_0x7d95('0x59')),'headers':{'Authorization':util['format'](_0x7d95('0x5a'),new Buffer(util[_0x7d95('0x58')](_0x7d95('0x5b'),_0x26c74a['apiKey']))['toString'](_0x7d95('0x5c')))},'json':!![]});}})[_0x7d95('0x25')](function(_0x164741){if(_0x164741){var _0x2ef52=[_0x7d95('0x5d'),_0x7d95('0x5e'),'agent',_0x7d95('0x5f'),_0x7d95('0x1a'),_0x7d95('0x60'),_0x7d95('0x61'),_0x7d95('0x62'),_0x7d95('0x63'),_0x7d95('0x61'),_0x7d95('0x64')];_[_0x7d95('0x65')](_0x164741,function(_0x6344e2){return _0x2ef52['includes'](_0x6344e2['name'])||!_0x6344e2['default']&&_0x6344e2[_0x7d95('0x2b')]!==_0x7d95('0x66')&&_0x6344e2[_0x7d95('0x2b')]!==_0x7d95('0x67');});return{'count':_0x164741['length'],'rows':_[_0x7d95('0x29')](_0x164741,function(_0xcd999){return{'id':_0xcd999[_0x7d95('0x27')],'name':_0xcd999[_0x7d95('0x68')],'custom':!_0xcd999['default'],'options':_0xcd999[_0x7d95('0x69')]?_[_0x7d95('0x29')](_0xcd999[_0x7d95('0x69')],function(_0x4565e7){return{'name':_['capitalize'](_0x4565e7),'value':_0x4565e7};}):[]};})};}})[_0x7d95('0x25')](respondWithResult(_0x242f1b,null))[_0x7d95('0x45')](function(_0x19de74){var _0x5603a4=_0x40a092[_0x7d95('0x2d')][_0x7d95('0x6a')]?0x1f4:_0x19de74[_0x7d95('0x6b')]||0x1f4;logger[_0x7d95('0x6c')]('getFields,\x20%s,\x20%s,\x20%s',_0x7d95('0x53'),_0x5603a4,JSON[_0x7d95('0x6d')](_0x19de74));delete _0x19de74[_0x7d95('0x27')];if(_0x5603a4===0x191){_0x5603a4=0x190;}_0x242f1b[_0x7d95('0x1a')](_0x5603a4)[_0x7d95('0x28')](_0x40a092[_0x7d95('0x2d')][_0x7d95('0x6a')]?{'message':_0x7d95('0x6e'),'statusCode':_0x19de74[_0x7d95('0x6b')]}:_0x19de74);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 6b66936..7789603 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 _0x3c09=['lodash','util','api','moment','bluebird','rimraf','../../config/environment','../../components/integrations/configuration','exports','FreshdeskAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c09,0xbe));var _0x93c0=function(_0x230b11,_0x32a101){_0x230b11=_0x230b11-0x0;var _0x327e9d=_0x3c09[_0x230b11];return _0x327e9d;};'use strict';var _=require(_0x93c0('0x0'));var util=require(_0x93c0('0x1'));var logger=require('../../config/logger')(_0x93c0('0x2'));var moment=require(_0x93c0('0x3'));var BPromise=require(_0x93c0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x93c0('0x5'));var config=require(_0x93c0('0x6'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x93c0('0x7'));module[_0x93c0('0x8')]=function(_0x2f45d7,_0x31a032){return _0x2f45d7['define'](_0x93c0('0x9'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe50c=['util','bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','int_freshdesk_accounts','lodash'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xe50c,0x1ac));var _0xce50=function(_0x408017,_0x1f217e){_0x408017=_0x408017-0x0;var _0xdca960=_0xe50c[_0x408017];return _0xdca960;};'use strict';var _=require(_0xce50('0x0'));var util=require(_0xce50('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xce50('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce50('0x3'));var rimraf=require(_0xce50('0x4'));var config=require(_0xce50('0x5'));var attributes=require(_0xce50('0x6'));var integrations=require(_0xce50('0x7'));module[_0xce50('0x8')]=function(_0x547449,_0x3e3754){return _0x547449[_0xce50('0x9')]('FreshdeskAccount',attributes,{'tableName':_0xce50('0xa'),'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 da65d20..f72fa89 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 _0x2bbb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','include','map','model','ShowFreshdeskAccount','find','raw','util','moment','bluebird'];(function(_0x40001a,_0x57f2ae){var _0x4cec45=function(_0x5e4166){while(--_0x5e4166){_0x40001a['push'](_0x40001a['shift']());}};_0x4cec45(++_0x57f2ae);}(_0x2bbb,0x85));var _0xb2bb=function(_0x42c6dc,_0x3a8ea2){_0x42c6dc=_0x42c6dc-0x0;var _0x1334fc=_0x2bbb[_0x42c6dc];return _0x1334fc;};'use strict';var _=require('lodash');var util=require(_0xb2bb('0x0'));var moment=require(_0xb2bb('0x1'));var BPromise=require(_0xb2bb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2bb('0x3'));var db=require(_0xb2bb('0x4'))['db'];var utils=require(_0xb2bb('0x5'));var logger=require(_0xb2bb('0x6'))(_0xb2bb('0x7'));var config=require(_0xb2bb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb2bb('0x9')][_0xb2bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53b48f,_0x12357d,_0x248f27){return new BPromise(function(_0x1738d9,_0x230064){return client['request'](_0x53b48f,_0x248f27)[_0xb2bb('0xb')](function(_0x4c6152){logger[_0xb2bb('0xc')](_0xb2bb('0xd'),_0x12357d,_0xb2bb('0xe'));logger[_0xb2bb('0xf')](_0xb2bb('0x10'),_0x12357d,'request\x20sent',JSON[_0xb2bb('0x11')](_0x4c6152));if(_0x4c6152['error']){if(_0x4c6152[_0xb2bb('0x12')][_0xb2bb('0x13')]===0x1f4){logger[_0xb2bb('0x12')](_0xb2bb('0xd'),_0x12357d,_0x4c6152[_0xb2bb('0x12')][_0xb2bb('0x14')]);return _0x230064(_0x4c6152['error'][_0xb2bb('0x14')]);}logger[_0xb2bb('0x12')](_0xb2bb('0xd'),_0x12357d,_0x4c6152[_0xb2bb('0x12')]['message']);return _0x1738d9(_0x4c6152[_0xb2bb('0x12')][_0xb2bb('0x14')]);}else{logger[_0xb2bb('0xc')](_0xb2bb('0xd'),_0x12357d,_0xb2bb('0xe'));_0x1738d9(_0x4c6152['result'][_0xb2bb('0x14')]);}})[_0xb2bb('0x15')](function(_0xa9bbcd){logger[_0xb2bb('0x12')](_0xb2bb('0xd'),_0x12357d,_0xa9bbcd);_0x230064(_0xa9bbcd);});});}exports[_0xb2bb('0x16')]=function(_0x35c4de){var _0xa4aa74=this;return new Promise(function(_0x8d2033,_0x1b241f){return db[_0xb2bb('0x17')][_0xb2bb('0x18')]({'raw':_0x35c4de['options']?_0x35c4de[_0xb2bb('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x35c4de[_0xb2bb('0x19')]?_0x35c4de['options'][_0xb2bb('0x1a')]||null:null,'attributes':_0x35c4de[_0xb2bb('0x19')]?_0x35c4de['options'][_0xb2bb('0x1b')]||null:null,'limit':_0x35c4de[_0xb2bb('0x19')]?_0x35c4de['options']['limit']||null:null,'include':_0x35c4de['options']?_0x35c4de[_0xb2bb('0x19')][_0xb2bb('0x1c')]?_[_0xb2bb('0x1d')](_0x35c4de['options'][_0xb2bb('0x1c')],function(_0x2b1f94){return{'model':db[_0x2b1f94[_0xb2bb('0x1e')]],'as':_0x2b1f94['as'],'attributes':_0x2b1f94['attributes'],'include':_0x2b1f94[_0xb2bb('0x1c')]?_[_0xb2bb('0x1d')](_0x2b1f94[_0xb2bb('0x1c')],function(_0x14aba5){return{'model':db[_0x14aba5['model']],'as':_0x14aba5['as'],'attributes':_0x14aba5[_0xb2bb('0x1b')],'include':_0x14aba5[_0xb2bb('0x1c')]?_[_0xb2bb('0x1d')](_0x14aba5['include'],function(_0xa09168){return{'model':db[_0xa09168[_0xb2bb('0x1e')]],'as':_0xa09168['as'],'attributes':_0xa09168[_0xb2bb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb2bb('0xb')](function(_0x149ab2){logger[_0xb2bb('0xc')]('GetFreshdeskAccount',_0x35c4de);logger[_0xb2bb('0xf')]('GetFreshdeskAccount',_0x35c4de,JSON[_0xb2bb('0x11')](_0x149ab2));_0x8d2033(_0x149ab2);})['catch'](function(_0x3d82c8){logger[_0xb2bb('0x12')]('GetFreshdeskAccount',_0x3d82c8[_0xb2bb('0x14')],_0x35c4de);_0x1b241f(_0xa4aa74['error'](0x1f4,_0x3d82c8[_0xb2bb('0x14')]));});});};exports[_0xb2bb('0x1f')]=function(_0x51a013){var _0xef2655=this;return new Promise(function(_0x8cbc9f,_0x214649){return db[_0xb2bb('0x17')][_0xb2bb('0x20')]({'raw':_0x51a013[_0xb2bb('0x19')]?_0x51a013[_0xb2bb('0x19')][_0xb2bb('0x21')]===undefined?!![]:![]:!![],'where':_0x51a013[_0xb2bb('0x19')]?_0x51a013[_0xb2bb('0x19')][_0xb2bb('0x1a')]||null:null,'attributes':_0x51a013['options']?_0x51a013[_0xb2bb('0x19')][_0xb2bb('0x1b')]||null:null,'include':_0x51a013[_0xb2bb('0x19')]?_0x51a013[_0xb2bb('0x19')][_0xb2bb('0x1c')]?_['map'](_0x51a013[_0xb2bb('0x19')][_0xb2bb('0x1c')],function(_0x32e8e0){return{'model':db[_0x32e8e0[_0xb2bb('0x1e')]],'as':_0x32e8e0['as'],'attributes':_0x32e8e0[_0xb2bb('0x1b')],'include':_0x32e8e0['include']?_['map'](_0x32e8e0[_0xb2bb('0x1c')],function(_0x3d37e9){return{'model':db[_0x3d37e9['model']],'as':_0x3d37e9['as'],'attributes':_0x3d37e9[_0xb2bb('0x1b')],'include':_0x3d37e9[_0xb2bb('0x1c')]?_['map'](_0x3d37e9[_0xb2bb('0x1c')],function(_0x4eb22d){return{'model':db[_0x4eb22d[_0xb2bb('0x1e')]],'as':_0x4eb22d['as'],'attributes':_0x4eb22d[_0xb2bb('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11e070){logger[_0xb2bb('0xc')](_0xb2bb('0x1f'),_0x51a013);logger[_0xb2bb('0xf')]('ShowFreshdeskAccount',_0x51a013,JSON[_0xb2bb('0x11')](_0x11e070));_0x8cbc9f(_0x11e070);})[_0xb2bb('0x15')](function(_0x6d068b){logger[_0xb2bb('0x12')](_0xb2bb('0x1f'),_0x6d068b[_0xb2bb('0x14')],_0x51a013);_0x214649(_0xef2655[_0xb2bb('0x12')](0x1f4,_0x6d068b[_0xb2bb('0x14')]));});});}; \ No newline at end of file +var _0x148e=['../../config/utils','rpc','../../config/environment','client','http','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetFreshdeskAccount','options','raw','where','attributes','limit','include','map','model','catch','ShowFreshdeskAccount','FreshdeskAccount','find','then','lodash','moment','randomstring','ioredis'];(function(_0x532054,_0x2095e3){var _0x4d4b44=function(_0xfe9386){while(--_0xfe9386){_0x532054['push'](_0x532054['shift']());}};_0x4d4b44(++_0x2095e3);}(_0x148e,0xfc));var _0xe148=function(_0x471273,_0x1587f1){_0x471273=_0x471273-0x0;var _0x56c63e=_0x148e[_0x471273];return _0x56c63e;};'use strict';var _=require(_0xe148('0x0'));var util=require('util');var moment=require(_0xe148('0x1'));var BPromise=require('bluebird');var rs=require(_0xe148('0x2'));var fs=require('fs');var Redis=require(_0xe148('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe148('0x4'));var logger=require('../../config/logger')(_0xe148('0x5'));var config=require(_0xe148('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe148('0x7')][_0xe148('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57bde2,_0x4649cd,_0x597e2f){return new BPromise(function(_0x2b77ee,_0x5eafd2){return client['request'](_0x57bde2,_0x597e2f)['then'](function(_0x193457){logger[_0xe148('0x9')](_0xe148('0xa'),_0x4649cd,_0xe148('0xb'));logger[_0xe148('0xc')](_0xe148('0xd'),_0x4649cd,_0xe148('0xb'),JSON[_0xe148('0xe')](_0x193457));if(_0x193457[_0xe148('0xf')]){if(_0x193457['error'][_0xe148('0x10')]===0x1f4){logger[_0xe148('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x4649cd,_0x193457[_0xe148('0xf')][_0xe148('0x11')]);return _0x5eafd2(_0x193457[_0xe148('0xf')][_0xe148('0x11')]);}logger[_0xe148('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x4649cd,_0x193457[_0xe148('0xf')]['message']);return _0x2b77ee(_0x193457[_0xe148('0xf')]['message']);}else{logger[_0xe148('0x9')](_0xe148('0xa'),_0x4649cd,_0xe148('0xb'));_0x2b77ee(_0x193457['result']['message']);}})['catch'](function(_0x56cb36){logger[_0xe148('0xf')](_0xe148('0xa'),_0x4649cd,_0x56cb36);_0x5eafd2(_0x56cb36);});});}exports[_0xe148('0x12')]=function(_0x154926){var _0x39a71f=this;return new Promise(function(_0x2535da,_0x187824){return db['FreshdeskAccount']['findAll']({'raw':_0x154926[_0xe148('0x13')]?_0x154926['options'][_0xe148('0x14')]===undefined?!![]:![]:!![],'where':_0x154926['options']?_0x154926[_0xe148('0x13')][_0xe148('0x15')]||null:null,'attributes':_0x154926[_0xe148('0x13')]?_0x154926[_0xe148('0x13')][_0xe148('0x16')]||null:null,'limit':_0x154926['options']?_0x154926[_0xe148('0x13')][_0xe148('0x17')]||null:null,'include':_0x154926['options']?_0x154926[_0xe148('0x13')][_0xe148('0x18')]?_[_0xe148('0x19')](_0x154926[_0xe148('0x13')]['include'],function(_0x5064b7){return{'model':db[_0x5064b7[_0xe148('0x1a')]],'as':_0x5064b7['as'],'attributes':_0x5064b7[_0xe148('0x16')],'include':_0x5064b7[_0xe148('0x18')]?_['map'](_0x5064b7[_0xe148('0x18')],function(_0x3a2b67){return{'model':db[_0x3a2b67[_0xe148('0x1a')]],'as':_0x3a2b67['as'],'attributes':_0x3a2b67['attributes'],'include':_0x3a2b67[_0xe148('0x18')]?_[_0xe148('0x19')](_0x3a2b67[_0xe148('0x18')],function(_0x385d2e){return{'model':db[_0x385d2e[_0xe148('0x1a')]],'as':_0x385d2e['as'],'attributes':_0x385d2e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f4b20){logger[_0xe148('0x9')]('GetFreshdeskAccount',_0x154926);logger[_0xe148('0xc')](_0xe148('0x12'),_0x154926,JSON[_0xe148('0xe')](_0x5f4b20));_0x2535da(_0x5f4b20);})[_0xe148('0x1b')](function(_0x1fa932){logger[_0xe148('0xf')]('GetFreshdeskAccount',_0x1fa932['message'],_0x154926);_0x187824(_0x39a71f['error'](0x1f4,_0x1fa932[_0xe148('0x11')]));});});};exports[_0xe148('0x1c')]=function(_0x190a40){var _0x47cd11=this;return new Promise(function(_0x288f0d,_0x3b2e30){return db[_0xe148('0x1d')][_0xe148('0x1e')]({'raw':_0x190a40[_0xe148('0x13')]?_0x190a40['options'][_0xe148('0x14')]===undefined?!![]:![]:!![],'where':_0x190a40['options']?_0x190a40[_0xe148('0x13')][_0xe148('0x15')]||null:null,'attributes':_0x190a40[_0xe148('0x13')]?_0x190a40[_0xe148('0x13')][_0xe148('0x16')]||null:null,'include':_0x190a40[_0xe148('0x13')]?_0x190a40[_0xe148('0x13')]['include']?_[_0xe148('0x19')](_0x190a40[_0xe148('0x13')]['include'],function(_0x2f043e){return{'model':db[_0x2f043e['model']],'as':_0x2f043e['as'],'attributes':_0x2f043e[_0xe148('0x16')],'include':_0x2f043e['include']?_[_0xe148('0x19')](_0x2f043e[_0xe148('0x18')],function(_0x477fa4){return{'model':db[_0x477fa4[_0xe148('0x1a')]],'as':_0x477fa4['as'],'attributes':_0x477fa4['attributes'],'include':_0x477fa4[_0xe148('0x18')]?_[_0xe148('0x19')](_0x477fa4['include'],function(_0x1c39c8){return{'model':db[_0x1c39c8[_0xe148('0x1a')]],'as':_0x1c39c8['as'],'attributes':_0x1c39c8[_0xe148('0x16')]};}):[]};}):[]};}):[]:[]})[_0xe148('0x1f')](function(_0x4708a8){logger[_0xe148('0x9')](_0xe148('0x1c'),_0x190a40);logger[_0xe148('0xc')](_0xe148('0x1c'),_0x190a40,JSON['stringify'](_0x4708a8));_0x288f0d(_0x4708a8);})[_0xe148('0x1b')](function(_0x17a816){logger['error'](_0xe148('0x1c'),_0x17a816['message'],_0x190a40);_0x3b2e30(_0x47cd11[_0xe148('0xf')](0x1f4,_0x17a816[_0xe148('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 9a395c2..5812039 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 _0xfabb=['/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','/:id/subjects','getSubjects'];(function(_0x3d096f,_0x1833b8){var _0x5826d0=function(_0x3c0482){while(--_0x3c0482){_0x3d096f['push'](_0x3d096f['shift']());}};_0x5826d0(++_0x1833b8);}(_0xfabb,0x1cb));var _0xbfab=function(_0x5cf5a4,_0x2197c7){_0x5cf5a4=_0x5cf5a4-0x0;var _0x1346af=_0xfabb[_0x5cf5a4];return _0x1346af;};'use strict';var multer=require('multer');var util=require(_0xbfab('0x0'));var path=require(_0xbfab('0x1'));var timeout=require(_0xbfab('0x2'));var express=require('express');var router=express[_0xbfab('0x3')]();var fs_extra=require(_0xbfab('0x4'));var auth=require(_0xbfab('0x5'));var interaction=require(_0xbfab('0x6'));var config=require(_0xbfab('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0xbfab('0x8')](),controller[_0xbfab('0x9')]);router[_0xbfab('0xa')](_0xbfab('0xb'),auth[_0xbfab('0x8')](),controller[_0xbfab('0xc')]);router['get'](_0xbfab('0xd'),auth[_0xbfab('0x8')](),controller['getFields']);router[_0xbfab('0xa')](_0xbfab('0xe'),auth[_0xbfab('0x8')](),controller[_0xbfab('0xf')]);router[_0xbfab('0xa')](_0xbfab('0x10'),auth[_0xbfab('0x8')](),controller['getDescriptions']);router['get'](_0xbfab('0x11'),auth[_0xbfab('0x8')](),controller[_0xbfab('0x12')]);router[_0xbfab('0x13')]('/',auth['isAuthenticated'](),controller[_0xbfab('0x14')]);router[_0xbfab('0x13')](_0xbfab('0x11'),auth['isAuthenticated'](),controller[_0xbfab('0x15')]);router[_0xbfab('0x16')]('/:id',auth[_0xbfab('0x8')](),controller[_0xbfab('0x17')]);router[_0xbfab('0x18')](_0xbfab('0xb'),auth[_0xbfab('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7ecd=['setTags','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post'];(function(_0x4916af,_0x226f84){var _0x410b1e=function(_0x47d789){while(--_0x47d789){_0x4916af['push'](_0x4916af['shift']());}};_0x410b1e(++_0x226f84);}(_0x7ecd,0x1e3));var _0xd7ec=function(_0x5df5b6,_0x1946c5){_0x5df5b6=_0x5df5b6-0x0;var _0x203f03=_0x7ecd[_0x5df5b6];return _0x203f03;};'use strict';var multer=require(_0xd7ec('0x0'));var util=require('util');var path=require(_0xd7ec('0x1'));var timeout=require(_0xd7ec('0x2'));var express=require(_0xd7ec('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd7ec('0x4'));var interaction=require(_0xd7ec('0x5'));var config=require(_0xd7ec('0x6'));var controller=require(_0xd7ec('0x7'));router[_0xd7ec('0x8')]('/',auth[_0xd7ec('0x9')](),controller['index']);router[_0xd7ec('0x8')](_0xd7ec('0xa'),auth[_0xd7ec('0x9')](),controller[_0xd7ec('0xb')]);router[_0xd7ec('0x8')](_0xd7ec('0xc'),auth[_0xd7ec('0x9')](),controller[_0xd7ec('0xd')]);router[_0xd7ec('0x8')]('/:id/subjects',auth[_0xd7ec('0x9')](),controller[_0xd7ec('0xe')]);router[_0xd7ec('0x8')](_0xd7ec('0xf'),auth[_0xd7ec('0x9')](),controller[_0xd7ec('0x10')]);router['get'](_0xd7ec('0x11'),auth[_0xd7ec('0x9')](),controller[_0xd7ec('0x12')]);router['post']('/',auth[_0xd7ec('0x9')](),controller[_0xd7ec('0x13')]);router[_0xd7ec('0x14')](_0xd7ec('0x11'),auth[_0xd7ec('0x9')](),controller[_0xd7ec('0x15')]);router['put'](_0xd7ec('0xa'),auth[_0xd7ec('0x9')](),controller['update']);router[_0xd7ec('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xd7ec('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 92675c2..35cc58c 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 _0x9b92=['exports','STRING','sequelize'];(function(_0x2217e3,_0x1bbe8e){var _0x55990a=function(_0x43b323){while(--_0x43b323){_0x2217e3['push'](_0x2217e3['shift']());}};_0x55990a(++_0x1bbe8e);}(_0x9b92,0x1a9));var _0x29b9=function(_0x466d45,_0x4a06a7){_0x466d45=_0x466d45-0x0;var _0x5ca2e2=_0x9b92[_0x466d45];return _0x5ca2e2;};'use strict';var Sequelize=require(_0x29b9('0x0'));module[_0x29b9('0x1')]={'name':{'type':Sequelize[_0x29b9('0x2')]},'description':{'type':Sequelize[_0x29b9('0x2')]}}; \ No newline at end of file +var _0x4798=['exports','STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4798,0xf5));var _0x8479=function(_0x311eb0,_0x469a4e){_0x311eb0=_0x311eb0-0x0;var _0x511d58=_0x4798[_0x311eb0];return _0x511d58;};'use strict';var Sequelize=require(_0x8479('0x0'));module[_0x8479('0x1')]={'name':{'type':Sequelize[_0x8479('0x2')]},'description':{'type':Sequelize[_0x8479('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index cebef99..dd7cdb4 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 _0x1c3b=['set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','FreshdeskConfiguration','rawAttributes','type','map','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','length','include','create','body','find','params','getFields','findOne','getSubjects','pick','getDescriptions','getTags','setTags','ids','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x3360b1,_0x2d1f2d){var _0x46f74b=function(_0x21dbf4){while(--_0x21dbf4){_0x3360b1['push'](_0x3360b1['shift']());}};_0x46f74b(++_0x2d1f2d);}(_0x1c3b,0x1c6));var _0xb1c3=function(_0x2cee7c,_0x142a07){_0x2cee7c=_0x2cee7c-0x0;var _0x1e582f=_0x1c3b[_0x2cee7c];return _0x1e582f;};'use strict';var emlformat=require(_0xb1c3('0x0'));var rimraf=require(_0xb1c3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb1c3('0x2'));var moment=require(_0xb1c3('0x3'));var BPromise=require(_0xb1c3('0x4'));var Mustache=require(_0xb1c3('0x5'));var util=require(_0xb1c3('0x6'));var path=require('path');var sox=require(_0xb1c3('0x7'));var csv=require(_0xb1c3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb1c3('0x9'));var _=require('lodash');var squel=require(_0xb1c3('0xa'));var crypto=require(_0xb1c3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb1c3('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb1c3('0xd'));var Redis=require(_0xb1c3('0xe'));var authService=require(_0xb1c3('0xf'));var qs=require(_0xb1c3('0x10'));var as=require(_0xb1c3('0x11'));var hardwareService=require(_0xb1c3('0x12'));var logger=require(_0xb1c3('0x13'))(_0xb1c3('0x14'));var utils=require('../../config/utils');var config=require(_0xb1c3('0x15'));var licenseUtil=require(_0xb1c3('0x16'));var db=require(_0xb1c3('0x17'))['db'];function respondWithStatusCode(_0x2872b4,_0x49b74e){_0x49b74e=_0x49b74e||0xcc;return function(_0x46be14){if(_0x46be14){return _0x2872b4[_0xb1c3('0x18')](_0x49b74e);}return _0x2872b4[_0xb1c3('0x19')](_0x49b74e)[_0xb1c3('0x1a')]();};}function respondWithResult(_0x2c3065,_0x21501c){_0x21501c=_0x21501c||0xc8;return function(_0x183d36){if(_0x183d36){return _0x2c3065[_0xb1c3('0x19')](_0x21501c)[_0xb1c3('0x1b')](_0x183d36);}};}function respondWithFilteredResult(_0x4c1bc,_0x424086){return function(_0x455ac8){if(_0x455ac8){var _0x462425=typeof _0x424086[_0xb1c3('0x1c')]===_0xb1c3('0x1d')&&typeof _0x424086['limit']===_0xb1c3('0x1d');var _0x1e1d70=_0x455ac8[_0xb1c3('0x1e')];var _0x35b9c6=_0x462425?0x0:_0x424086['offset'];var _0x893ded=_0x462425?_0x455ac8['count']:_0x424086[_0xb1c3('0x1c')]+_0x424086[_0xb1c3('0x1f')];var _0x492cb7;if(_0x893ded>=_0x1e1d70){_0x893ded=_0x1e1d70;_0x492cb7=0xc8;}else{_0x492cb7=0xce;}_0x4c1bc['status'](_0x492cb7);return _0x4c1bc[_0xb1c3('0x20')](_0xb1c3('0x21'),_0x35b9c6+'-'+_0x893ded+'/'+_0x1e1d70)[_0xb1c3('0x1b')](_0x455ac8);}return null;};}function patchUpdates(_0x1f0b82){return function(_0xe8ae24){try{jsonpatch[_0xb1c3('0x22')](_0xe8ae24,_0x1f0b82,!![]);}catch(_0x162daa){return BPromise[_0xb1c3('0x23')](_0x162daa);}return _0xe8ae24['save']();};}function saveUpdates(_0x181889,_0x4be2f2){return function(_0x13b8df){if(_0x13b8df){return _0x13b8df[_0xb1c3('0x24')](_0x181889)[_0xb1c3('0x25')](function(_0x4ce805){return _0x4ce805;});}return null;};}function removeEntity(_0x2e0867,_0x456dcd){return function(_0x40a72f){if(_0x40a72f){return _0x40a72f[_0xb1c3('0x26')]()[_0xb1c3('0x25')](function(){_0x2e0867['status'](0xcc)[_0xb1c3('0x1a')]();});}};}function handleEntityNotFound(_0x1e9545,_0x3a96c6){return function(_0x5ade23){if(!_0x5ade23){_0x1e9545['sendStatus'](0x194);}return _0x5ade23;};}function handleError(_0x1acea6,_0x2a848d){_0x2a848d=_0x2a848d||0x1f4;return function(_0x1d07ef){logger['error'](_0x1d07ef[_0xb1c3('0x27')]);if(_0x1d07ef['name']){delete _0x1d07ef[_0xb1c3('0x28')];}_0x1acea6['status'](_0x2a848d)[_0xb1c3('0x29')](_0x1d07ef);};}exports[_0xb1c3('0x2a')]=function(_0x1a7e79,_0x221c6c){var _0xa05584={},_0x164cde={},_0x3a522a={'count':0x0,'rows':[]};var _0xb46f70=_['map'](db[_0xb1c3('0x2b')][_0xb1c3('0x2c')],function(_0x3ac451){return{'name':_0x3ac451['fieldName'],'type':_0x3ac451[_0xb1c3('0x2d')]['key']};});_0x164cde['model']=_[_0xb1c3('0x2e')](_0xb46f70,'name');_0x164cde[_0xb1c3('0x2f')]=_[_0xb1c3('0x30')](_0x1a7e79[_0xb1c3('0x2f')]);_0x164cde['filters']=_['intersection'](_0x164cde[_0xb1c3('0x31')],_0x164cde['query']);_0xa05584[_0xb1c3('0x32')]=_[_0xb1c3('0x33')](_0x164cde[_0xb1c3('0x31')],qs[_0xb1c3('0x34')](_0x1a7e79[_0xb1c3('0x2f')][_0xb1c3('0x34')]));_0xa05584['attributes']=_0xa05584[_0xb1c3('0x32')]['length']?_0xa05584[_0xb1c3('0x32')]:_0x164cde[_0xb1c3('0x31')];if(!_0x1a7e79[_0xb1c3('0x2f')][_0xb1c3('0x35')](_0xb1c3('0x36'))){_0xa05584[_0xb1c3('0x1f')]=qs[_0xb1c3('0x1f')](_0x1a7e79['query'][_0xb1c3('0x1f')]);_0xa05584[_0xb1c3('0x1c')]=qs[_0xb1c3('0x1c')](_0x1a7e79[_0xb1c3('0x2f')]['offset']);}_0xa05584[_0xb1c3('0x37')]=qs[_0xb1c3('0x38')](_0x1a7e79[_0xb1c3('0x2f')]['sort']);_0xa05584['where']=qs['filters'](_['pick'](_0x1a7e79[_0xb1c3('0x2f')],_0x164cde[_0xb1c3('0x39')]),_0xb46f70);if(_0x1a7e79[_0xb1c3('0x2f')][_0xb1c3('0x3a')]){_0xa05584['where']=_[_0xb1c3('0x3b')](_0xa05584[_0xb1c3('0x3c')],{'$or':_[_0xb1c3('0x2e')](_0xb46f70,function(_0x4e5490){if(_0x4e5490[_0xb1c3('0x2d')]!==_0xb1c3('0x3d')){var _0x28b9f3={};_0x28b9f3[_0x4e5490[_0xb1c3('0x28')]]={'$like':'%'+_0x1a7e79[_0xb1c3('0x2f')][_0xb1c3('0x3a')]+'%'};return _0x28b9f3;}})});}_0xa05584=_[_0xb1c3('0x3b')]({},_0xa05584,_0x1a7e79[_0xb1c3('0x3e')]);var _0x5c7cb4={'where':_0xa05584['where']};return db[_0xb1c3('0x2b')][_0xb1c3('0x1e')](_0x5c7cb4)[_0xb1c3('0x25')](function(_0x3de512){_0x3a522a[_0xb1c3('0x1e')]=_0x3de512;if(_0x1a7e79[_0xb1c3('0x2f')][_0xb1c3('0x3f')]){_0xa05584['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xb1c3('0x40')](_0xa05584);})[_0xb1c3('0x25')](function(_0x275240){_0x3a522a[_0xb1c3('0x41')]=_0x275240;return _0x3a522a;})[_0xb1c3('0x25')](respondWithFilteredResult(_0x221c6c,_0xa05584))[_0xb1c3('0x42')](handleError(_0x221c6c,null));};exports['show']=function(_0x152a8a,_0x4559a7){var _0x143b5d={'raw':![],'where':{'id':_0x152a8a['params']['id']}},_0x4b8957={};_0x4b8957['model']=_[_0xb1c3('0x30')](db[_0xb1c3('0x2b')][_0xb1c3('0x2c')]);_0x4b8957[_0xb1c3('0x2f')]=_['keys'](_0x152a8a[_0xb1c3('0x2f')]);_0x4b8957[_0xb1c3('0x39')]=_[_0xb1c3('0x33')](_0x4b8957[_0xb1c3('0x31')],_0x4b8957[_0xb1c3('0x2f')]);_0x143b5d[_0xb1c3('0x32')]=_[_0xb1c3('0x33')](_0x4b8957[_0xb1c3('0x31')],qs[_0xb1c3('0x34')](_0x152a8a[_0xb1c3('0x2f')][_0xb1c3('0x34')]));_0x143b5d[_0xb1c3('0x32')]=_0x143b5d[_0xb1c3('0x32')][_0xb1c3('0x43')]?_0x143b5d[_0xb1c3('0x32')]:_0x4b8957[_0xb1c3('0x31')];if(_0x152a8a[_0xb1c3('0x2f')][_0xb1c3('0x3f')]){_0x143b5d[_0xb1c3('0x44')]=[{'all':!![]}];}_0x143b5d=_[_0xb1c3('0x3b')]({},_0x143b5d,_0x152a8a[_0xb1c3('0x3e')]);return db[_0xb1c3('0x2b')]['find'](_0x143b5d)[_0xb1c3('0x25')](handleEntityNotFound(_0x4559a7,null))['then'](respondWithResult(_0x4559a7,null))[_0xb1c3('0x42')](handleError(_0x4559a7,null));};exports[_0xb1c3('0x45')]=function(_0x55a0f0,_0x236ea9){return db[_0xb1c3('0x2b')][_0xb1c3('0x45')](_0x55a0f0['body'],{})[_0xb1c3('0x25')](respondWithResult(_0x236ea9,0xc9))[_0xb1c3('0x42')](handleError(_0x236ea9,null));};exports['update']=function(_0x2fed20,_0x134d9e){if(_0x2fed20[_0xb1c3('0x46')]['id']){delete _0x2fed20[_0xb1c3('0x46')]['id'];}return db['FreshdeskConfiguration'][_0xb1c3('0x47')]({'where':{'id':_0x2fed20[_0xb1c3('0x48')]['id']}})[_0xb1c3('0x25')](handleEntityNotFound(_0x134d9e,null))['then'](saveUpdates(_0x2fed20[_0xb1c3('0x46')],null))[_0xb1c3('0x25')](respondWithResult(_0x134d9e,null))[_0xb1c3('0x42')](handleError(_0x134d9e,null));};exports[_0xb1c3('0x26')]=function(_0x443850,_0x29706b){return db[_0xb1c3('0x2b')]['find']({'where':{'id':_0x443850[_0xb1c3('0x48')]['id']}})[_0xb1c3('0x25')](handleEntityNotFound(_0x29706b,null))[_0xb1c3('0x25')](removeEntity(_0x29706b,null))[_0xb1c3('0x42')](handleError(_0x29706b,null));};exports[_0xb1c3('0x49')]=function(_0x260369,_0x42428d,_0x5e617d){var _0x19f40e={};var _0x4c045d={};var _0x28b599;var _0x121057;return db['FreshdeskConfiguration'][_0xb1c3('0x4a')]({'where':{'id':_0x260369[_0xb1c3('0x48')]['id']}})[_0xb1c3('0x25')](handleEntityNotFound(_0x42428d,null))[_0xb1c3('0x25')](function(_0x83e2c6){if(_0x83e2c6){_0x28b599=_0x83e2c6;_0x4c045d[_0xb1c3('0x31')]=_[_0xb1c3('0x30')](db['FreshdeskField'][_0xb1c3('0x2c')]);_0x4c045d[_0xb1c3('0x2f')]=_['keys'](_0x260369[_0xb1c3('0x2f')]);_0x4c045d[_0xb1c3('0x39')]=_[_0xb1c3('0x33')](_0x4c045d[_0xb1c3('0x31')],_0x4c045d['query']);_0x19f40e['attributes']=_[_0xb1c3('0x33')](_0x4c045d[_0xb1c3('0x31')],qs[_0xb1c3('0x34')](_0x260369['query']['fields']));_0x19f40e[_0xb1c3('0x32')]=_0x19f40e[_0xb1c3('0x32')][_0xb1c3('0x43')]?_0x19f40e[_0xb1c3('0x32')]:_0x4c045d[_0xb1c3('0x31')];_0x19f40e[_0xb1c3('0x37')]=qs['sort'](_0x260369['query'][_0xb1c3('0x38')]);_0x19f40e[_0xb1c3('0x3c')]=qs[_0xb1c3('0x39')](_['pick'](_0x260369[_0xb1c3('0x2f')],_0x4c045d[_0xb1c3('0x39')]));if(_0x260369['query'][_0xb1c3('0x3a')]){_0x19f40e[_0xb1c3('0x3c')]=_[_0xb1c3('0x3b')](_0x19f40e['where'],{'$or':_['map'](_0x19f40e['attributes'],function(_0x424f96){var _0x4ec517={};_0x4ec517[_0x424f96]={'$like':'%'+_0x260369['query'][_0xb1c3('0x3a')]+'%'};return _0x4ec517;})});}_0x19f40e=_[_0xb1c3('0x3b')]({},_0x19f40e,_0x260369[_0xb1c3('0x3e')]);return _0x28b599[_0xb1c3('0x49')](_0x19f40e);}})['then'](function(_0x5f082e){if(_0x5f082e){_0x121057=_0x5f082e[_0xb1c3('0x43')];if(!_0x260369[_0xb1c3('0x2f')][_0xb1c3('0x35')](_0xb1c3('0x36'))){_0x19f40e[_0xb1c3('0x1f')]=qs[_0xb1c3('0x1f')](_0x260369[_0xb1c3('0x2f')]['limit']);_0x19f40e[_0xb1c3('0x1c')]=qs[_0xb1c3('0x1c')](_0x260369['query']['offset']);}return _0x28b599[_0xb1c3('0x49')](_0x19f40e);}})[_0xb1c3('0x25')](function(_0xcece16){if(_0xcece16){return _0xcece16?{'count':_0x121057,'rows':_0xcece16}:null;}})[_0xb1c3('0x25')](respondWithResult(_0x42428d,null))[_0xb1c3('0x42')](handleError(_0x42428d,null));};exports[_0xb1c3('0x4b')]=function(_0x20108c,_0x3f2a03,_0x14f500){var _0x24f0cb={};var _0x565a86={};var _0x591258;var _0x213dc9;return db['FreshdeskConfiguration'][_0xb1c3('0x4a')]({'where':{'id':_0x20108c[_0xb1c3('0x48')]['id']}})[_0xb1c3('0x25')](handleEntityNotFound(_0x3f2a03,null))[_0xb1c3('0x25')](function(_0xc6aaf9){if(_0xc6aaf9){_0x591258=_0xc6aaf9;_0x565a86[_0xb1c3('0x31')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x565a86[_0xb1c3('0x2f')]=_[_0xb1c3('0x30')](_0x20108c['query']);_0x565a86[_0xb1c3('0x39')]=_[_0xb1c3('0x33')](_0x565a86[_0xb1c3('0x31')],_0x565a86[_0xb1c3('0x2f')]);_0x24f0cb[_0xb1c3('0x32')]=_[_0xb1c3('0x33')](_0x565a86[_0xb1c3('0x31')],qs[_0xb1c3('0x34')](_0x20108c[_0xb1c3('0x2f')][_0xb1c3('0x34')]));_0x24f0cb[_0xb1c3('0x32')]=_0x24f0cb[_0xb1c3('0x32')][_0xb1c3('0x43')]?_0x24f0cb[_0xb1c3('0x32')]:_0x565a86[_0xb1c3('0x31')];_0x24f0cb[_0xb1c3('0x37')]=qs[_0xb1c3('0x38')](_0x20108c[_0xb1c3('0x2f')]['sort']);_0x24f0cb[_0xb1c3('0x3c')]=qs[_0xb1c3('0x39')](_[_0xb1c3('0x4c')](_0x20108c[_0xb1c3('0x2f')],_0x565a86[_0xb1c3('0x39')]));if(_0x20108c[_0xb1c3('0x2f')][_0xb1c3('0x3a')]){_0x24f0cb[_0xb1c3('0x3c')]=_[_0xb1c3('0x3b')](_0x24f0cb[_0xb1c3('0x3c')],{'$or':_['map'](_0x24f0cb['attributes'],function(_0x49d3b3){var _0x40aac0={};_0x40aac0[_0x49d3b3]={'$like':'%'+_0x20108c['query']['filter']+'%'};return _0x40aac0;})});}_0x24f0cb=_[_0xb1c3('0x3b')]({},_0x24f0cb,_0x20108c[_0xb1c3('0x3e')]);return _0x591258['getSubjects'](_0x24f0cb);}})[_0xb1c3('0x25')](function(_0x5977b3){if(_0x5977b3){_0x213dc9=_0x5977b3[_0xb1c3('0x43')];if(!_0x20108c[_0xb1c3('0x2f')][_0xb1c3('0x35')](_0xb1c3('0x36'))){_0x24f0cb['limit']=qs['limit'](_0x20108c[_0xb1c3('0x2f')]['limit']);_0x24f0cb[_0xb1c3('0x1c')]=qs['offset'](_0x20108c[_0xb1c3('0x2f')][_0xb1c3('0x1c')]);}return _0x591258[_0xb1c3('0x4b')](_0x24f0cb);}})[_0xb1c3('0x25')](function(_0x1e7679){if(_0x1e7679){return _0x1e7679?{'count':_0x213dc9,'rows':_0x1e7679}:null;}})['then'](respondWithResult(_0x3f2a03,null))[_0xb1c3('0x42')](handleError(_0x3f2a03,null));};exports[_0xb1c3('0x4d')]=function(_0x3210d9,_0x37e504,_0x34e277){var _0x24e4c0={};var _0x2d2bd9={};var _0x55902a;var _0x12fdec;return db[_0xb1c3('0x2b')][_0xb1c3('0x4a')]({'where':{'id':_0x3210d9[_0xb1c3('0x48')]['id']}})[_0xb1c3('0x25')](handleEntityNotFound(_0x37e504,null))['then'](function(_0x2c9ede){if(_0x2c9ede){_0x55902a=_0x2c9ede;_0x2d2bd9[_0xb1c3('0x31')]=_['keys'](db['FreshdeskField'][_0xb1c3('0x2c')]);_0x2d2bd9[_0xb1c3('0x2f')]=_[_0xb1c3('0x30')](_0x3210d9['query']);_0x2d2bd9[_0xb1c3('0x39')]=_['intersection'](_0x2d2bd9[_0xb1c3('0x31')],_0x2d2bd9[_0xb1c3('0x2f')]);_0x24e4c0[_0xb1c3('0x32')]=_['intersection'](_0x2d2bd9[_0xb1c3('0x31')],qs['fields'](_0x3210d9['query'][_0xb1c3('0x34')]));_0x24e4c0[_0xb1c3('0x32')]=_0x24e4c0['attributes'][_0xb1c3('0x43')]?_0x24e4c0[_0xb1c3('0x32')]:_0x2d2bd9[_0xb1c3('0x31')];_0x24e4c0[_0xb1c3('0x37')]=qs[_0xb1c3('0x38')](_0x3210d9[_0xb1c3('0x2f')][_0xb1c3('0x38')]);_0x24e4c0[_0xb1c3('0x3c')]=qs[_0xb1c3('0x39')](_['pick'](_0x3210d9[_0xb1c3('0x2f')],_0x2d2bd9['filters']));if(_0x3210d9[_0xb1c3('0x2f')][_0xb1c3('0x3a')]){_0x24e4c0[_0xb1c3('0x3c')]=_[_0xb1c3('0x3b')](_0x24e4c0['where'],{'$or':_[_0xb1c3('0x2e')](_0x24e4c0[_0xb1c3('0x32')],function(_0x168cae){var _0x3b1a56={};_0x3b1a56[_0x168cae]={'$like':'%'+_0x3210d9[_0xb1c3('0x2f')][_0xb1c3('0x3a')]+'%'};return _0x3b1a56;})});}_0x24e4c0=_[_0xb1c3('0x3b')]({},_0x24e4c0,_0x3210d9[_0xb1c3('0x3e')]);return _0x55902a[_0xb1c3('0x4d')](_0x24e4c0);}})['then'](function(_0x4a2079){if(_0x4a2079){_0x12fdec=_0x4a2079[_0xb1c3('0x43')];if(!_0x3210d9['query'][_0xb1c3('0x35')]('nolimit')){_0x24e4c0[_0xb1c3('0x1f')]=qs[_0xb1c3('0x1f')](_0x3210d9[_0xb1c3('0x2f')]['limit']);_0x24e4c0[_0xb1c3('0x1c')]=qs[_0xb1c3('0x1c')](_0x3210d9[_0xb1c3('0x2f')][_0xb1c3('0x1c')]);}return _0x55902a['getDescriptions'](_0x24e4c0);}})[_0xb1c3('0x25')](function(_0x4b2753){if(_0x4b2753){return _0x4b2753?{'count':_0x12fdec,'rows':_0x4b2753}:null;}})[_0xb1c3('0x25')](respondWithResult(_0x37e504,null))[_0xb1c3('0x42')](handleError(_0x37e504,null));};exports[_0xb1c3('0x4e')]=function(_0x55ccce,_0x16693e,_0x5cfe45){var _0x3acc6e={};var _0x232224={};var _0x33196e;var _0x787673;return db['FreshdeskConfiguration'][_0xb1c3('0x4a')]({'where':{'id':_0x55ccce[_0xb1c3('0x48')]['id']}})['then'](handleEntityNotFound(_0x16693e,null))[_0xb1c3('0x25')](function(_0x4095e3){if(_0x4095e3){_0x33196e=_0x4095e3;_0x232224['model']=_[_0xb1c3('0x30')](db['Tag'][_0xb1c3('0x2c')]);_0x232224[_0xb1c3('0x2f')]=_['keys'](_0x55ccce[_0xb1c3('0x2f')]);_0x232224['filters']=_[_0xb1c3('0x33')](_0x232224[_0xb1c3('0x31')],_0x232224[_0xb1c3('0x2f')]);_0x3acc6e[_0xb1c3('0x32')]=_['intersection'](_0x232224[_0xb1c3('0x31')],qs[_0xb1c3('0x34')](_0x55ccce[_0xb1c3('0x2f')][_0xb1c3('0x34')]));_0x3acc6e[_0xb1c3('0x32')]=_0x3acc6e[_0xb1c3('0x32')][_0xb1c3('0x43')]?_0x3acc6e[_0xb1c3('0x32')]:_0x232224[_0xb1c3('0x31')];_0x3acc6e['order']=qs[_0xb1c3('0x38')](_0x55ccce['query'][_0xb1c3('0x38')]);_0x3acc6e['where']=qs['filters'](_[_0xb1c3('0x4c')](_0x55ccce[_0xb1c3('0x2f')],_0x232224[_0xb1c3('0x39')]));if(_0x55ccce[_0xb1c3('0x2f')][_0xb1c3('0x3a')]){_0x3acc6e['where']=_[_0xb1c3('0x3b')](_0x3acc6e[_0xb1c3('0x3c')],{'$or':_[_0xb1c3('0x2e')](_0x3acc6e[_0xb1c3('0x32')],function(_0x3a1008){var _0x57fff6={};_0x57fff6[_0x3a1008]={'$like':'%'+_0x55ccce[_0xb1c3('0x2f')][_0xb1c3('0x3a')]+'%'};return _0x57fff6;})});}_0x3acc6e=_[_0xb1c3('0x3b')]({},_0x3acc6e,_0x55ccce[_0xb1c3('0x3e')]);return _0x33196e[_0xb1c3('0x4e')](_0x3acc6e);}})[_0xb1c3('0x25')](function(_0x477f0d){if(_0x477f0d){_0x787673=_0x477f0d['length'];if(!_0x55ccce[_0xb1c3('0x2f')][_0xb1c3('0x35')](_0xb1c3('0x36'))){_0x3acc6e[_0xb1c3('0x1f')]=qs[_0xb1c3('0x1f')](_0x55ccce[_0xb1c3('0x2f')]['limit']);_0x3acc6e[_0xb1c3('0x1c')]=qs['offset'](_0x55ccce['query'][_0xb1c3('0x1c')]);}return _0x33196e[_0xb1c3('0x4e')](_0x3acc6e);}})[_0xb1c3('0x25')](function(_0x332fb9){if(_0x332fb9){return _0x332fb9?{'count':_0x787673,'rows':_0x332fb9}:null;}})[_0xb1c3('0x25')](respondWithResult(_0x16693e,null))[_0xb1c3('0x42')](handleError(_0x16693e,null));};exports['setTags']=function(_0x38033d,_0x4c3cf3,_0xef972e){if(_0x38033d['body']['id']){delete _0x38033d[_0xb1c3('0x46')]['id'];}return db[_0xb1c3('0x2b')][_0xb1c3('0x4a')]({'where':{'id':_0x38033d[_0xb1c3('0x48')]['id']}})[_0xb1c3('0x25')](handleEntityNotFound(_0x4c3cf3,null))['then'](function(_0x36b07a){if(_0x36b07a){return _0x36b07a[_0xb1c3('0x4f')](_0x38033d['body'][_0xb1c3('0x50')]||[]);}return null;})['then'](respondWithResult(_0x4c3cf3,null))[_0xb1c3('0x42')](handleError(_0x4c3cf3,null));}; \ No newline at end of file +var _0x849d=['stack','name','send','index','FreshdeskConfiguration','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','count','findAll','rows','catch','show','params','find','create','body','destroy','getFields','findOne','filter','getSubjects','FreshdeskField','getDescriptions','getTags','setTags','ids','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','update','then','error'];(function(_0x58ac41,_0x29d8b5){var _0x5a23b4=function(_0x2cf465){while(--_0x2cf465){_0x58ac41['push'](_0x58ac41['shift']());}};_0x5a23b4(++_0x29d8b5);}(_0x849d,0x181));var _0xd849=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x849d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd849('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd849('0x1'));var rp=require(_0xd849('0x2'));var moment=require(_0xd849('0x3'));var BPromise=require(_0xd849('0x4'));var Mustache=require(_0xd849('0x5'));var util=require(_0xd849('0x6'));var path=require('path');var sox=require(_0xd849('0x7'));var csv=require(_0xd849('0x8'));var ejs=require(_0xd849('0x9'));var fs=require('fs');var fs_extra=require(_0xd849('0xa'));var _=require(_0xd849('0xb'));var squel=require(_0xd849('0xc'));var crypto=require(_0xd849('0xd'));var jsforce=require(_0xd849('0xe'));var deskjs=require(_0xd849('0xf'));var toCsv=require(_0xd849('0x8'));var querystring=require(_0xd849('0x10'));var Papa=require('papaparse');var Redis=require(_0xd849('0x11'));var authService=require(_0xd849('0x12'));var qs=require(_0xd849('0x13'));var as=require(_0xd849('0x14'));var hardwareService=require(_0xd849('0x15'));var logger=require(_0xd849('0x16'))(_0xd849('0x17'));var utils=require(_0xd849('0x18'));var config=require(_0xd849('0x19'));var licenseUtil=require(_0xd849('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48250c,_0xb7679e){_0xb7679e=_0xb7679e||0xcc;return function(_0x792ed){if(_0x792ed){return _0x48250c[_0xd849('0x1b')](_0xb7679e);}return _0x48250c[_0xd849('0x1c')](_0xb7679e)[_0xd849('0x1d')]();};}function respondWithResult(_0x50c313,_0x2dd3f2){_0x2dd3f2=_0x2dd3f2||0xc8;return function(_0x3936f6){if(_0x3936f6){return _0x50c313['status'](_0x2dd3f2)[_0xd849('0x1e')](_0x3936f6);}};}function respondWithFilteredResult(_0x1ff71b,_0x525c6a){return function(_0x303031){if(_0x303031){var _0x5ecea9=typeof _0x525c6a[_0xd849('0x1f')]===_0xd849('0x20')&&typeof _0x525c6a[_0xd849('0x21')]===_0xd849('0x20');var _0x1b5644=_0x303031['count'];var _0x50cdc5=_0x5ecea9?0x0:_0x525c6a[_0xd849('0x1f')];var _0x514044=_0x5ecea9?_0x303031['count']:_0x525c6a[_0xd849('0x1f')]+_0x525c6a[_0xd849('0x21')];var _0x2b6a96;if(_0x514044>=_0x1b5644){_0x514044=_0x1b5644;_0x2b6a96=0xc8;}else{_0x2b6a96=0xce;}_0x1ff71b[_0xd849('0x1c')](_0x2b6a96);return _0x1ff71b[_0xd849('0x22')](_0xd849('0x23'),_0x50cdc5+'-'+_0x514044+'/'+_0x1b5644)[_0xd849('0x1e')](_0x303031);}return null;};}function patchUpdates(_0x557abd){return function(_0x32b400){try{jsonpatch[_0xd849('0x24')](_0x32b400,_0x557abd,!![]);}catch(_0x350f79){return BPromise['reject'](_0x350f79);}return _0x32b400['save']();};}function saveUpdates(_0x2bf2ed,_0x22bcdf){return function(_0x509d29){if(_0x509d29){return _0x509d29[_0xd849('0x25')](_0x2bf2ed)[_0xd849('0x26')](function(_0x223dec){return _0x223dec;});}return null;};}function removeEntity(_0x5717cc,_0x23b7e3){return function(_0x33351e){if(_0x33351e){return _0x33351e['destroy']()[_0xd849('0x26')](function(){_0x5717cc[_0xd849('0x1c')](0xcc)[_0xd849('0x1d')]();});}};}function handleEntityNotFound(_0x4129d8,_0x58b0f7){return function(_0x3f0bcb){if(!_0x3f0bcb){_0x4129d8['sendStatus'](0x194);}return _0x3f0bcb;};}function handleError(_0x49e1d8,_0x1bb3f2){_0x1bb3f2=_0x1bb3f2||0x1f4;return function(_0x21cfb7){logger[_0xd849('0x27')](_0x21cfb7[_0xd849('0x28')]);if(_0x21cfb7[_0xd849('0x29')]){delete _0x21cfb7['name'];}_0x49e1d8[_0xd849('0x1c')](_0x1bb3f2)[_0xd849('0x2a')](_0x21cfb7);};}exports[_0xd849('0x2b')]=function(_0x1981e8,_0x43b6ec){var _0x37903f={},_0x3f6163={},_0x332858={'count':0x0,'rows':[]};var _0x393b01=_['map'](db[_0xd849('0x2c')][_0xd849('0x2d')],function(_0x469245){return{'name':_0x469245['fieldName'],'type':_0x469245[_0xd849('0x2e')][_0xd849('0x2f')]};});_0x3f6163[_0xd849('0x30')]=_[_0xd849('0x31')](_0x393b01,_0xd849('0x29'));_0x3f6163[_0xd849('0x32')]=_[_0xd849('0x33')](_0x1981e8[_0xd849('0x32')]);_0x3f6163[_0xd849('0x34')]=_['intersection'](_0x3f6163[_0xd849('0x30')],_0x3f6163[_0xd849('0x32')]);_0x37903f['attributes']=_[_0xd849('0x35')](_0x3f6163['model'],qs[_0xd849('0x36')](_0x1981e8[_0xd849('0x32')][_0xd849('0x36')]));_0x37903f['attributes']=_0x37903f[_0xd849('0x37')][_0xd849('0x38')]?_0x37903f[_0xd849('0x37')]:_0x3f6163['model'];if(!_0x1981e8[_0xd849('0x32')][_0xd849('0x39')](_0xd849('0x3a'))){_0x37903f[_0xd849('0x21')]=qs[_0xd849('0x21')](_0x1981e8['query'][_0xd849('0x21')]);_0x37903f[_0xd849('0x1f')]=qs['offset'](_0x1981e8[_0xd849('0x32')]['offset']);}_0x37903f[_0xd849('0x3b')]=qs[_0xd849('0x3c')](_0x1981e8['query']['sort']);_0x37903f[_0xd849('0x3d')]=qs[_0xd849('0x34')](_[_0xd849('0x3e')](_0x1981e8[_0xd849('0x32')],_0x3f6163['filters']),_0x393b01);if(_0x1981e8['query']['filter']){_0x37903f[_0xd849('0x3d')]=_['merge'](_0x37903f[_0xd849('0x3d')],{'$or':_[_0xd849('0x31')](_0x393b01,function(_0x293d89){if(_0x293d89[_0xd849('0x2e')]!==_0xd849('0x3f')){var _0x1559d3={};_0x1559d3[_0x293d89['name']]={'$like':'%'+_0x1981e8[_0xd849('0x32')]['filter']+'%'};return _0x1559d3;}})});}_0x37903f=_[_0xd849('0x40')]({},_0x37903f,_0x1981e8[_0xd849('0x41')]);var _0x103763={'where':_0x37903f[_0xd849('0x3d')]};return db[_0xd849('0x2c')][_0xd849('0x42')](_0x103763)[_0xd849('0x26')](function(_0x435a98){_0x332858[_0xd849('0x42')]=_0x435a98;if(_0x1981e8['query']['includeAll']){_0x37903f['include']=[{'all':!![]}];}return db[_0xd849('0x2c')][_0xd849('0x43')](_0x37903f);})[_0xd849('0x26')](function(_0x9e7f55){_0x332858[_0xd849('0x44')]=_0x9e7f55;return _0x332858;})[_0xd849('0x26')](respondWithFilteredResult(_0x43b6ec,_0x37903f))[_0xd849('0x45')](handleError(_0x43b6ec,null));};exports[_0xd849('0x46')]=function(_0x36297a,_0x14815e){var _0x9292d1={'raw':![],'where':{'id':_0x36297a[_0xd849('0x47')]['id']}},_0x1c7340={};_0x1c7340[_0xd849('0x30')]=_[_0xd849('0x33')](db['FreshdeskConfiguration'][_0xd849('0x2d')]);_0x1c7340['query']=_[_0xd849('0x33')](_0x36297a[_0xd849('0x32')]);_0x1c7340[_0xd849('0x34')]=_[_0xd849('0x35')](_0x1c7340['model'],_0x1c7340[_0xd849('0x32')]);_0x9292d1[_0xd849('0x37')]=_['intersection'](_0x1c7340['model'],qs[_0xd849('0x36')](_0x36297a[_0xd849('0x32')]['fields']));_0x9292d1[_0xd849('0x37')]=_0x9292d1[_0xd849('0x37')]['length']?_0x9292d1['attributes']:_0x1c7340[_0xd849('0x30')];if(_0x36297a[_0xd849('0x32')]['includeAll']){_0x9292d1['include']=[{'all':!![]}];}_0x9292d1=_[_0xd849('0x40')]({},_0x9292d1,_0x36297a[_0xd849('0x41')]);return db[_0xd849('0x2c')][_0xd849('0x48')](_0x9292d1)[_0xd849('0x26')](handleEntityNotFound(_0x14815e,null))[_0xd849('0x26')](respondWithResult(_0x14815e,null))['catch'](handleError(_0x14815e,null));};exports['create']=function(_0x225e99,_0x1ca9ef){return db[_0xd849('0x2c')][_0xd849('0x49')](_0x225e99[_0xd849('0x4a')],{})[_0xd849('0x26')](respondWithResult(_0x1ca9ef,0xc9))['catch'](handleError(_0x1ca9ef,null));};exports['update']=function(_0x4c7bab,_0x4c006f){if(_0x4c7bab[_0xd849('0x4a')]['id']){delete _0x4c7bab[_0xd849('0x4a')]['id'];}return db[_0xd849('0x2c')][_0xd849('0x48')]({'where':{'id':_0x4c7bab[_0xd849('0x47')]['id']}})[_0xd849('0x26')](handleEntityNotFound(_0x4c006f,null))[_0xd849('0x26')](saveUpdates(_0x4c7bab[_0xd849('0x4a')],null))[_0xd849('0x26')](respondWithResult(_0x4c006f,null))[_0xd849('0x45')](handleError(_0x4c006f,null));};exports[_0xd849('0x4b')]=function(_0x1cfabd,_0x8a9155){return db[_0xd849('0x2c')]['find']({'where':{'id':_0x1cfabd[_0xd849('0x47')]['id']}})[_0xd849('0x26')](handleEntityNotFound(_0x8a9155,null))[_0xd849('0x26')](removeEntity(_0x8a9155,null))['catch'](handleError(_0x8a9155,null));};exports[_0xd849('0x4c')]=function(_0x44a364,_0x283e03,_0x3a0169){var _0x11335a={};var _0x1b5cee={};var _0x28556e;var _0x44899f;return db[_0xd849('0x2c')][_0xd849('0x4d')]({'where':{'id':_0x44a364[_0xd849('0x47')]['id']}})[_0xd849('0x26')](handleEntityNotFound(_0x283e03,null))[_0xd849('0x26')](function(_0x1560ba){if(_0x1560ba){_0x28556e=_0x1560ba;_0x1b5cee[_0xd849('0x30')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x1b5cee[_0xd849('0x32')]=_['keys'](_0x44a364[_0xd849('0x32')]);_0x1b5cee[_0xd849('0x34')]=_[_0xd849('0x35')](_0x1b5cee[_0xd849('0x30')],_0x1b5cee[_0xd849('0x32')]);_0x11335a[_0xd849('0x37')]=_[_0xd849('0x35')](_0x1b5cee['model'],qs[_0xd849('0x36')](_0x44a364[_0xd849('0x32')][_0xd849('0x36')]));_0x11335a[_0xd849('0x37')]=_0x11335a['attributes'][_0xd849('0x38')]?_0x11335a['attributes']:_0x1b5cee[_0xd849('0x30')];_0x11335a[_0xd849('0x3b')]=qs[_0xd849('0x3c')](_0x44a364[_0xd849('0x32')][_0xd849('0x3c')]);_0x11335a[_0xd849('0x3d')]=qs[_0xd849('0x34')](_['pick'](_0x44a364[_0xd849('0x32')],_0x1b5cee['filters']));if(_0x44a364[_0xd849('0x32')][_0xd849('0x4e')]){_0x11335a[_0xd849('0x3d')]=_[_0xd849('0x40')](_0x11335a[_0xd849('0x3d')],{'$or':_[_0xd849('0x31')](_0x11335a[_0xd849('0x37')],function(_0xbedc70){var _0x46395d={};_0x46395d[_0xbedc70]={'$like':'%'+_0x44a364['query'][_0xd849('0x4e')]+'%'};return _0x46395d;})});}_0x11335a=_[_0xd849('0x40')]({},_0x11335a,_0x44a364[_0xd849('0x41')]);return _0x28556e['getFields'](_0x11335a);}})[_0xd849('0x26')](function(_0x55d39d){if(_0x55d39d){_0x44899f=_0x55d39d['length'];if(!_0x44a364[_0xd849('0x32')][_0xd849('0x39')](_0xd849('0x3a'))){_0x11335a[_0xd849('0x21')]=qs[_0xd849('0x21')](_0x44a364[_0xd849('0x32')][_0xd849('0x21')]);_0x11335a['offset']=qs[_0xd849('0x1f')](_0x44a364[_0xd849('0x32')][_0xd849('0x1f')]);}return _0x28556e[_0xd849('0x4c')](_0x11335a);}})[_0xd849('0x26')](function(_0x25996a){if(_0x25996a){return _0x25996a?{'count':_0x44899f,'rows':_0x25996a}:null;}})[_0xd849('0x26')](respondWithResult(_0x283e03,null))['catch'](handleError(_0x283e03,null));};exports[_0xd849('0x4f')]=function(_0x61a500,_0x184e07,_0x3c3a8d){var _0x366eab={};var _0x265a4d={};var _0x5959b5;var _0x39d5f3;return db[_0xd849('0x2c')]['findOne']({'where':{'id':_0x61a500[_0xd849('0x47')]['id']}})[_0xd849('0x26')](handleEntityNotFound(_0x184e07,null))[_0xd849('0x26')](function(_0x3ca181){if(_0x3ca181){_0x5959b5=_0x3ca181;_0x265a4d['model']=_['keys'](db[_0xd849('0x50')]['rawAttributes']);_0x265a4d[_0xd849('0x32')]=_['keys'](_0x61a500[_0xd849('0x32')]);_0x265a4d[_0xd849('0x34')]=_[_0xd849('0x35')](_0x265a4d[_0xd849('0x30')],_0x265a4d[_0xd849('0x32')]);_0x366eab[_0xd849('0x37')]=_[_0xd849('0x35')](_0x265a4d['model'],qs[_0xd849('0x36')](_0x61a500[_0xd849('0x32')][_0xd849('0x36')]));_0x366eab[_0xd849('0x37')]=_0x366eab[_0xd849('0x37')][_0xd849('0x38')]?_0x366eab[_0xd849('0x37')]:_0x265a4d[_0xd849('0x30')];_0x366eab[_0xd849('0x3b')]=qs[_0xd849('0x3c')](_0x61a500[_0xd849('0x32')][_0xd849('0x3c')]);_0x366eab[_0xd849('0x3d')]=qs[_0xd849('0x34')](_['pick'](_0x61a500[_0xd849('0x32')],_0x265a4d['filters']));if(_0x61a500[_0xd849('0x32')][_0xd849('0x4e')]){_0x366eab[_0xd849('0x3d')]=_[_0xd849('0x40')](_0x366eab[_0xd849('0x3d')],{'$or':_[_0xd849('0x31')](_0x366eab[_0xd849('0x37')],function(_0x825978){var _0x47da64={};_0x47da64[_0x825978]={'$like':'%'+_0x61a500[_0xd849('0x32')][_0xd849('0x4e')]+'%'};return _0x47da64;})});}_0x366eab=_['merge']({},_0x366eab,_0x61a500[_0xd849('0x41')]);return _0x5959b5[_0xd849('0x4f')](_0x366eab);}})[_0xd849('0x26')](function(_0x17fbc1){if(_0x17fbc1){_0x39d5f3=_0x17fbc1[_0xd849('0x38')];if(!_0x61a500[_0xd849('0x32')]['hasOwnProperty'](_0xd849('0x3a'))){_0x366eab['limit']=qs[_0xd849('0x21')](_0x61a500[_0xd849('0x32')][_0xd849('0x21')]);_0x366eab['offset']=qs['offset'](_0x61a500['query']['offset']);}return _0x5959b5['getSubjects'](_0x366eab);}})[_0xd849('0x26')](function(_0x521c93){if(_0x521c93){return _0x521c93?{'count':_0x39d5f3,'rows':_0x521c93}:null;}})[_0xd849('0x26')](respondWithResult(_0x184e07,null))[_0xd849('0x45')](handleError(_0x184e07,null));};exports[_0xd849('0x51')]=function(_0x5016ec,_0x1880e3,_0x548e49){var _0x158fe9={};var _0x5bd0b9={};var _0x5f2edf;var _0x14829c;return db[_0xd849('0x2c')][_0xd849('0x4d')]({'where':{'id':_0x5016ec[_0xd849('0x47')]['id']}})[_0xd849('0x26')](handleEntityNotFound(_0x1880e3,null))[_0xd849('0x26')](function(_0x276cb6){if(_0x276cb6){_0x5f2edf=_0x276cb6;_0x5bd0b9[_0xd849('0x30')]=_[_0xd849('0x33')](db[_0xd849('0x50')][_0xd849('0x2d')]);_0x5bd0b9['query']=_[_0xd849('0x33')](_0x5016ec[_0xd849('0x32')]);_0x5bd0b9['filters']=_[_0xd849('0x35')](_0x5bd0b9[_0xd849('0x30')],_0x5bd0b9[_0xd849('0x32')]);_0x158fe9['attributes']=_[_0xd849('0x35')](_0x5bd0b9[_0xd849('0x30')],qs[_0xd849('0x36')](_0x5016ec['query'][_0xd849('0x36')]));_0x158fe9[_0xd849('0x37')]=_0x158fe9[_0xd849('0x37')][_0xd849('0x38')]?_0x158fe9[_0xd849('0x37')]:_0x5bd0b9[_0xd849('0x30')];_0x158fe9[_0xd849('0x3b')]=qs['sort'](_0x5016ec[_0xd849('0x32')][_0xd849('0x3c')]);_0x158fe9[_0xd849('0x3d')]=qs[_0xd849('0x34')](_[_0xd849('0x3e')](_0x5016ec[_0xd849('0x32')],_0x5bd0b9['filters']));if(_0x5016ec[_0xd849('0x32')][_0xd849('0x4e')]){_0x158fe9[_0xd849('0x3d')]=_['merge'](_0x158fe9['where'],{'$or':_[_0xd849('0x31')](_0x158fe9[_0xd849('0x37')],function(_0x2b531a){var _0x9ff6e2={};_0x9ff6e2[_0x2b531a]={'$like':'%'+_0x5016ec[_0xd849('0x32')][_0xd849('0x4e')]+'%'};return _0x9ff6e2;})});}_0x158fe9=_['merge']({},_0x158fe9,_0x5016ec[_0xd849('0x41')]);return _0x5f2edf[_0xd849('0x51')](_0x158fe9);}})[_0xd849('0x26')](function(_0x462e90){if(_0x462e90){_0x14829c=_0x462e90[_0xd849('0x38')];if(!_0x5016ec[_0xd849('0x32')][_0xd849('0x39')](_0xd849('0x3a'))){_0x158fe9[_0xd849('0x21')]=qs['limit'](_0x5016ec[_0xd849('0x32')][_0xd849('0x21')]);_0x158fe9[_0xd849('0x1f')]=qs['offset'](_0x5016ec[_0xd849('0x32')]['offset']);}return _0x5f2edf[_0xd849('0x51')](_0x158fe9);}})[_0xd849('0x26')](function(_0x5b18b6){if(_0x5b18b6){return _0x5b18b6?{'count':_0x14829c,'rows':_0x5b18b6}:null;}})['then'](respondWithResult(_0x1880e3,null))[_0xd849('0x45')](handleError(_0x1880e3,null));};exports[_0xd849('0x52')]=function(_0xdecf7d,_0x4af055,_0x5349a4){var _0x45b6c0={};var _0x5dea36={};var _0x23b510;var _0x350de8;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0xdecf7d[_0xd849('0x47')]['id']}})[_0xd849('0x26')](handleEntityNotFound(_0x4af055,null))[_0xd849('0x26')](function(_0x732c2e){if(_0x732c2e){_0x23b510=_0x732c2e;_0x5dea36[_0xd849('0x30')]=_[_0xd849('0x33')](db['Tag'][_0xd849('0x2d')]);_0x5dea36[_0xd849('0x32')]=_[_0xd849('0x33')](_0xdecf7d[_0xd849('0x32')]);_0x5dea36[_0xd849('0x34')]=_[_0xd849('0x35')](_0x5dea36[_0xd849('0x30')],_0x5dea36[_0xd849('0x32')]);_0x45b6c0[_0xd849('0x37')]=_[_0xd849('0x35')](_0x5dea36[_0xd849('0x30')],qs[_0xd849('0x36')](_0xdecf7d['query'][_0xd849('0x36')]));_0x45b6c0['attributes']=_0x45b6c0[_0xd849('0x37')][_0xd849('0x38')]?_0x45b6c0['attributes']:_0x5dea36['model'];_0x45b6c0[_0xd849('0x3b')]=qs[_0xd849('0x3c')](_0xdecf7d[_0xd849('0x32')][_0xd849('0x3c')]);_0x45b6c0[_0xd849('0x3d')]=qs[_0xd849('0x34')](_[_0xd849('0x3e')](_0xdecf7d[_0xd849('0x32')],_0x5dea36['filters']));if(_0xdecf7d[_0xd849('0x32')][_0xd849('0x4e')]){_0x45b6c0[_0xd849('0x3d')]=_[_0xd849('0x40')](_0x45b6c0['where'],{'$or':_[_0xd849('0x31')](_0x45b6c0[_0xd849('0x37')],function(_0x59f087){var _0x2b50ae={};_0x2b50ae[_0x59f087]={'$like':'%'+_0xdecf7d[_0xd849('0x32')][_0xd849('0x4e')]+'%'};return _0x2b50ae;})});}_0x45b6c0=_[_0xd849('0x40')]({},_0x45b6c0,_0xdecf7d[_0xd849('0x41')]);return _0x23b510[_0xd849('0x52')](_0x45b6c0);}})[_0xd849('0x26')](function(_0x31cdf8){if(_0x31cdf8){_0x350de8=_0x31cdf8['length'];if(!_0xdecf7d[_0xd849('0x32')]['hasOwnProperty'](_0xd849('0x3a'))){_0x45b6c0[_0xd849('0x21')]=qs[_0xd849('0x21')](_0xdecf7d[_0xd849('0x32')]['limit']);_0x45b6c0[_0xd849('0x1f')]=qs['offset'](_0xdecf7d[_0xd849('0x32')][_0xd849('0x1f')]);}return _0x23b510[_0xd849('0x52')](_0x45b6c0);}})[_0xd849('0x26')](function(_0x2f1cd2){if(_0x2f1cd2){return _0x2f1cd2?{'count':_0x350de8,'rows':_0x2f1cd2}:null;}})[_0xd849('0x26')](respondWithResult(_0x4af055,null))[_0xd849('0x45')](handleError(_0x4af055,null));};exports[_0xd849('0x53')]=function(_0x112f5f,_0x8d9893,_0x209b02){if(_0x112f5f['body']['id']){delete _0x112f5f[_0xd849('0x4a')]['id'];}return db[_0xd849('0x2c')]['findOne']({'where':{'id':_0x112f5f[_0xd849('0x47')]['id']}})[_0xd849('0x26')](handleEntityNotFound(_0x8d9893,null))[_0xd849('0x26')](function(_0x21ca06){if(_0x21ca06){return _0x21ca06[_0xd849('0x53')](_0x112f5f[_0xd849('0x4a')][_0xd849('0x54')]||[]);}return null;})[_0xd849('0x26')](respondWithResult(_0x8d9893,null))['catch'](handleError(_0x8d9893,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 2d76b4c..f1da791 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 _0xb3dc=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0xb3dc,0xb9));var _0xcb3d=function(_0x1f235c,_0x339986){_0x1f235c=_0x1f235c-0x0;var _0x34f7a2=_0xb3dc[_0x1f235c];return _0x34f7a2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xcb3d('0x0'));var moment=require(_0xcb3d('0x1'));var BPromise=require(_0xcb3d('0x2'));var rp=require(_0xcb3d('0x3'));var fs=require('fs');var path=require(_0xcb3d('0x4'));var rimraf=require(_0xcb3d('0x5'));var config=require(_0xcb3d('0x6'));var attributes=require(_0xcb3d('0x7'));module[_0xcb3d('0x8')]=function(_0x17ad3e,_0x166dc2){return _0x17ad3e[_0xcb3d('0x9')](_0xcb3d('0xa'),attributes,{'tableName':_0xcb3d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43c2=['path','rimraf','../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x38d62a,_0x1621c8){var _0x3aa287=function(_0x34f9ba){while(--_0x34f9ba){_0x38d62a['push'](_0x38d62a['shift']());}};_0x3aa287(++_0x1621c8);}(_0x43c2,0x89));var _0x243c=function(_0x594c4d,_0x1940b6){_0x594c4d=_0x594c4d-0x0;var _0x2967f5=_0x43c2[_0x594c4d];return _0x2967f5;};'use strict';var _=require(_0x243c('0x0'));var util=require('util');var logger=require(_0x243c('0x1'))(_0x243c('0x2'));var moment=require(_0x243c('0x3'));var BPromise=require(_0x243c('0x4'));var rp=require(_0x243c('0x5'));var fs=require('fs');var path=require(_0x243c('0x6'));var rimraf=require(_0x243c('0x7'));var config=require(_0x243c('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x243c('0x9')]=function(_0x428e20,_0x3332d6){return _0x428e20[_0x243c('0xa')](_0x243c('0xb'),attributes,{'tableName':_0x243c('0xc'),'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 61299cd..90674a2 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 _0x5399=['util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1b2422,_0x1e98d4){var _0x376573=function(_0x5db41b){while(--_0x5db41b){_0x1b2422['push'](_0x1b2422['shift']());}};_0x376573(++_0x1e98d4);}(_0x5399,0xaa));var _0x9539=function(_0x368dbc,_0x1b3ddc){_0x368dbc=_0x368dbc-0x0;var _0x257b6b=_0x5399[_0x368dbc];return _0x257b6b;};'use strict';var _=require('lodash');var util=require(_0x9539('0x0'));var moment=require(_0x9539('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9539('0x2'))['db'];var utils=require(_0x9539('0x3'));var logger=require(_0x9539('0x4'))(_0x9539('0x5'));var config=require(_0x9539('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9539('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x56bb6,_0x433c30,_0x34388c){return new BPromise(function(_0x2d2611,_0x33aeae){return client[_0x9539('0x8')](_0x56bb6,_0x34388c)[_0x9539('0x9')](function(_0x330a72){logger[_0x9539('0xa')](_0x9539('0xb'),_0x433c30,_0x9539('0xc'));logger['debug'](_0x9539('0xd'),_0x433c30,'request\x20sent',JSON[_0x9539('0xe')](_0x330a72));if(_0x330a72['error']){if(_0x330a72['error']['code']===0x1f4){logger[_0x9539('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x433c30,_0x330a72[_0x9539('0xf')][_0x9539('0x10')]);return _0x33aeae(_0x330a72[_0x9539('0xf')][_0x9539('0x10')]);}logger[_0x9539('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x433c30,_0x330a72[_0x9539('0xf')][_0x9539('0x10')]);return _0x2d2611(_0x330a72[_0x9539('0xf')]['message']);}else{logger['info'](_0x9539('0xb'),_0x433c30,_0x9539('0xc'));_0x2d2611(_0x330a72['result'][_0x9539('0x10')]);}})['catch'](function(_0x2a202f){logger['error'](_0x9539('0xb'),_0x433c30,_0x2a202f);_0x33aeae(_0x2a202f);});});} \ No newline at end of file +var _0xf7a8=['stringify','error','message','result','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x66841e,_0x4c3487){var _0x1ad62f=function(_0x5168fc){while(--_0x5168fc){_0x66841e['push'](_0x66841e['shift']());}};_0x1ad62f(++_0x4c3487);}(_0xf7a8,0x9e));var _0x8f7a=function(_0x48946a,_0x298f8a){_0x48946a=_0x48946a-0x0;var _0x2fff8c=_0xf7a8[_0x48946a];return _0x2fff8c;};'use strict';var _=require('lodash');var util=require(_0x8f7a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8f7a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f7a('0x2'))['db'];var utils=require(_0x8f7a('0x3'));var logger=require(_0x8f7a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8f7a('0x5'));var client=jayson[_0x8f7a('0x6')][_0x8f7a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2a34cc,_0x2706a4,_0x19f65e){return new BPromise(function(_0x4a018a,_0x41bffe){return client['request'](_0x2a34cc,_0x19f65e)['then'](function(_0x300e41){logger[_0x8f7a('0x8')](_0x8f7a('0x9'),_0x2706a4,_0x8f7a('0xa'));logger[_0x8f7a('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2706a4,'request\x20sent',JSON[_0x8f7a('0xc')](_0x300e41));if(_0x300e41[_0x8f7a('0xd')]){if(_0x300e41['error']['code']===0x1f4){logger[_0x8f7a('0xd')](_0x8f7a('0x9'),_0x2706a4,_0x300e41[_0x8f7a('0xd')][_0x8f7a('0xe')]);return _0x41bffe(_0x300e41['error'][_0x8f7a('0xe')]);}logger[_0x8f7a('0xd')](_0x8f7a('0x9'),_0x2706a4,_0x300e41['error'][_0x8f7a('0xe')]);return _0x4a018a(_0x300e41['error'][_0x8f7a('0xe')]);}else{logger[_0x8f7a('0x8')](_0x8f7a('0x9'),_0x2706a4,_0x8f7a('0xa'));_0x4a018a(_0x300e41[_0x8f7a('0xf')][_0x8f7a('0xe')]);}})[_0x8f7a('0x10')](function(_0x1135ad){logger[_0x8f7a('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2706a4,_0x1135ad);_0x41bffe(_0x1135ad);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index e337aae..2a677e1 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 _0xe389=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show','post','put','destroy','multer','util','path','express','Router','fs-extra'];(function(_0x2caae5,_0x23acda){var _0x5e1f96=function(_0x218bbf){while(--_0x218bbf){_0x2caae5['push'](_0x2caae5['shift']());}};_0x5e1f96(++_0x23acda);}(_0xe389,0x108));var _0x9e38=function(_0x1d5525,_0x53f5d3){_0x1d5525=_0x1d5525-0x0;var _0x21b857=_0xe389[_0x1d5525];return _0x21b857;};'use strict';var multer=require(_0x9e38('0x0'));var util=require(_0x9e38('0x1'));var path=require(_0x9e38('0x2'));var timeout=require('connect-timeout');var express=require(_0x9e38('0x3'));var router=express[_0x9e38('0x4')]();var fs_extra=require(_0x9e38('0x5'));var auth=require(_0x9e38('0x6'));var interaction=require(_0x9e38('0x7'));var config=require(_0x9e38('0x8'));var controller=require(_0x9e38('0x9'));router[_0x9e38('0xa')]('/',auth['isAuthenticated'](),controller[_0x9e38('0xb')]);router[_0x9e38('0xa')](_0x9e38('0xc'),auth[_0x9e38('0xd')](),controller[_0x9e38('0xe')]);router[_0x9e38('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9e38('0x10')](_0x9e38('0xc'),auth[_0x9e38('0xd')](),controller['update']);router['delete'](_0x9e38('0xc'),auth['isAuthenticated'](),controller[_0x9e38('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3710=['/:id','show','post','create','put','update','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x512bbb,_0x3f5b87){var _0x1f8813=function(_0x5edcb4){while(--_0x5edcb4){_0x512bbb['push'](_0x512bbb['shift']());}};_0x1f8813(++_0x3f5b87);}(_0x3710,0x157));var _0x0371=function(_0x26a8ca,_0x133ef9){_0x26a8ca=_0x26a8ca-0x0;var _0xa5eb02=_0x3710[_0x26a8ca];return _0xa5eb02;};'use strict';var multer=require('multer');var util=require(_0x0371('0x0'));var path=require(_0x0371('0x1'));var timeout=require(_0x0371('0x2'));var express=require(_0x0371('0x3'));var router=express[_0x0371('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0371('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x0371('0x6')]('/',auth[_0x0371('0x7')](),controller[_0x0371('0x8')]);router['get'](_0x0371('0x9'),auth[_0x0371('0x7')](),controller[_0x0371('0xa')]);router[_0x0371('0xb')]('/',auth['isAuthenticated'](),controller[_0x0371('0xc')]);router[_0x0371('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x0371('0xe')]);router['delete'](_0x0371('0x9'),auth[_0x0371('0x7')](),controller['destroy']);module[_0x0371('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 6b3d878..57e008a 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 _0xb50e=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','exports'];(function(_0x9e3edc,_0x594d61){var _0x44a387=function(_0x4edc66){while(--_0x4edc66){_0x9e3edc['push'](_0x9e3edc['shift']());}};_0x44a387(++_0x594d61);}(_0xb50e,0xe7));var _0xeb50=function(_0x5d9041,_0x2c23bd){_0x5d9041=_0x5d9041-0x0;var _0x4c1042=_0xb50e[_0x5d9041];return _0x4c1042;};'use strict';var Sequelize=require('sequelize');module[_0xeb50('0x0')]={'type':{'type':Sequelize[_0xeb50('0x1')](_0xeb50('0x2'),_0xeb50('0x3'),_0xeb50('0x4'),_0xeb50('0x5'),'picklist'),'defaultValue':_0xeb50('0x2')},'content':{'type':Sequelize[_0xeb50('0x6')]},'key':{'type':Sequelize[_0xeb50('0x6')]},'keyType':{'type':Sequelize[_0xeb50('0x1')](_0xeb50('0x2'),'variable',_0xeb50('0x4'))},'keyContent':{'type':Sequelize[_0xeb50('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xeb50('0x6')]},'customField':{'type':Sequelize[_0xeb50('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xeb50('0x6')]}}; \ No newline at end of file +var _0x2320=['keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x353471,_0x19f123){var _0x584806=function(_0x3c8352){while(--_0x3c8352){_0x353471['push'](_0x353471['shift']());}};_0x584806(++_0x19f123);}(_0x2320,0xff));var _0x0232=function(_0x3e0616,_0x573294){_0x3e0616=_0x3e0616-0x0;var _0x58f3a3=_0x2320[_0x3e0616];return _0x58f3a3;};'use strict';var Sequelize=require(_0x0232('0x0'));module[_0x0232('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0232('0x2'),_0x0232('0x3'),_0x0232('0x4'),_0x0232('0x5'),_0x0232('0x6')),'defaultValue':_0x0232('0x2')},'content':{'type':Sequelize[_0x0232('0x7')]},'key':{'type':Sequelize[_0x0232('0x7')]},'keyType':{'type':Sequelize[_0x0232('0x8')]('string',_0x0232('0x3'),_0x0232('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0232('0x7')]},'nameField':{'type':Sequelize[_0x0232('0x7')]},'customField':{'type':Sequelize[_0x0232('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0232('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 14dbe09..6461673 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 _0xa9e0=['nolimit','sort','where','filter','merge','type','options','includeAll','include','findAll','catch','show','params','find','body','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','FreshdeskField','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x2c4d9f,_0x266437){var _0x3c558a=function(_0xe83d03){while(--_0xe83d03){_0x2c4d9f['push'](_0x2c4d9f['shift']());}};_0x3c558a(++_0x266437);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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['FreshdeskField'][_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));}; \ No newline at end of file +var _0xfe57=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update','then','name','send','map','FreshdeskField','fieldName','key','model','query','filters','intersection','fields','attributes','length','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','params','keys','includeAll','find','catch','create','body','destroy','eml-format','rimraf','request-promise'];(function(_0x22f7ad,_0x533f89){var _0x153322=function(_0x3ee7e5){while(--_0x3ee7e5){_0x22f7ad['push'](_0x22f7ad['shift']());}};_0x153322(++_0x533f89);}(_0xfe57,0x195));var _0x7fe5=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xfe57[_0x2df507];return _0x1f7167;};'use strict';var emlformat=require(_0x7fe5('0x0'));var rimraf=require(_0x7fe5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7fe5('0x2'));var moment=require(_0x7fe5('0x3'));var BPromise=require(_0x7fe5('0x4'));var Mustache=require(_0x7fe5('0x5'));var util=require(_0x7fe5('0x6'));var path=require(_0x7fe5('0x7'));var sox=require(_0x7fe5('0x8'));var csv=require(_0x7fe5('0x9'));var ejs=require(_0x7fe5('0xa'));var fs=require('fs');var fs_extra=require(_0x7fe5('0xb'));var _=require(_0x7fe5('0xc'));var squel=require(_0x7fe5('0xd'));var crypto=require(_0x7fe5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7fe5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7fe5('0x10'));var Papa=require(_0x7fe5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7fe5('0x12'));var as=require(_0x7fe5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fe5('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7fe5('0x15'));var licenseUtil=require(_0x7fe5('0x16'));var db=require(_0x7fe5('0x17'))['db'];function respondWithStatusCode(_0x225fc3,_0x53f76c){_0x53f76c=_0x53f76c||0xcc;return function(_0x329c95){if(_0x329c95){return _0x225fc3[_0x7fe5('0x18')](_0x53f76c);}return _0x225fc3['status'](_0x53f76c)[_0x7fe5('0x19')]();};}function respondWithResult(_0x54cfb2,_0x1f84b5){_0x1f84b5=_0x1f84b5||0xc8;return function(_0x2d297b){if(_0x2d297b){return _0x54cfb2['status'](_0x1f84b5)[_0x7fe5('0x1a')](_0x2d297b);}};}function respondWithFilteredResult(_0x56e76f,_0x39f175){return function(_0x221ab2){if(_0x221ab2){var _0xbdf0a4=typeof _0x39f175[_0x7fe5('0x1b')]===_0x7fe5('0x1c')&&typeof _0x39f175[_0x7fe5('0x1d')]==='undefined';var _0x166e23=_0x221ab2[_0x7fe5('0x1e')];var _0x340d5e=_0xbdf0a4?0x0:_0x39f175[_0x7fe5('0x1b')];var _0x2533db=_0xbdf0a4?_0x221ab2[_0x7fe5('0x1e')]:_0x39f175[_0x7fe5('0x1b')]+_0x39f175[_0x7fe5('0x1d')];var _0x478523;if(_0x2533db>=_0x166e23){_0x2533db=_0x166e23;_0x478523=0xc8;}else{_0x478523=0xce;}_0x56e76f[_0x7fe5('0x1f')](_0x478523);return _0x56e76f['set']('Content-Range',_0x340d5e+'-'+_0x2533db+'/'+_0x166e23)[_0x7fe5('0x1a')](_0x221ab2);}return null;};}function patchUpdates(_0x459c2d){return function(_0x2f6592){try{jsonpatch[_0x7fe5('0x20')](_0x2f6592,_0x459c2d,!![]);}catch(_0x39c560){return BPromise[_0x7fe5('0x21')](_0x39c560);}return _0x2f6592[_0x7fe5('0x22')]();};}function saveUpdates(_0xdd9df7,_0x1b271c){return function(_0x28a7fd){if(_0x28a7fd){return _0x28a7fd[_0x7fe5('0x23')](_0xdd9df7)[_0x7fe5('0x24')](function(_0x54ee98){return _0x54ee98;});}return null;};}function removeEntity(_0x3e7340,_0x2f39e0){return function(_0x43e547){if(_0x43e547){return _0x43e547['destroy']()[_0x7fe5('0x24')](function(){_0x3e7340['status'](0xcc)[_0x7fe5('0x19')]();});}};}function handleEntityNotFound(_0x53f522,_0x5c3b37){return function(_0x190355){if(!_0x190355){_0x53f522[_0x7fe5('0x18')](0x194);}return _0x190355;};}function handleError(_0x2a96f4,_0x399c55){_0x399c55=_0x399c55||0x1f4;return function(_0x4393c3){logger['error'](_0x4393c3['stack']);if(_0x4393c3[_0x7fe5('0x25')]){delete _0x4393c3[_0x7fe5('0x25')];}_0x2a96f4[_0x7fe5('0x1f')](_0x399c55)[_0x7fe5('0x26')](_0x4393c3);};}exports['index']=function(_0x46f816,_0x4a77e9){var _0x150ab9={},_0x1420de={},_0x204bc8={'count':0x0,'rows':[]};var _0x28a689=_[_0x7fe5('0x27')](db[_0x7fe5('0x28')]['rawAttributes'],function(_0xe521c6){return{'name':_0xe521c6[_0x7fe5('0x29')],'type':_0xe521c6['type'][_0x7fe5('0x2a')]};});_0x1420de[_0x7fe5('0x2b')]=_[_0x7fe5('0x27')](_0x28a689,_0x7fe5('0x25'));_0x1420de[_0x7fe5('0x2c')]=_['keys'](_0x46f816['query']);_0x1420de[_0x7fe5('0x2d')]=_[_0x7fe5('0x2e')](_0x1420de[_0x7fe5('0x2b')],_0x1420de[_0x7fe5('0x2c')]);_0x150ab9['attributes']=_[_0x7fe5('0x2e')](_0x1420de[_0x7fe5('0x2b')],qs[_0x7fe5('0x2f')](_0x46f816[_0x7fe5('0x2c')][_0x7fe5('0x2f')]));_0x150ab9[_0x7fe5('0x30')]=_0x150ab9['attributes'][_0x7fe5('0x31')]?_0x150ab9[_0x7fe5('0x30')]:_0x1420de[_0x7fe5('0x2b')];if(!_0x46f816[_0x7fe5('0x2c')]['hasOwnProperty']('nolimit')){_0x150ab9[_0x7fe5('0x1d')]=qs['limit'](_0x46f816[_0x7fe5('0x2c')]['limit']);_0x150ab9[_0x7fe5('0x1b')]=qs['offset'](_0x46f816['query']['offset']);}_0x150ab9['order']=qs[_0x7fe5('0x32')](_0x46f816[_0x7fe5('0x2c')]['sort']);_0x150ab9[_0x7fe5('0x33')]=qs[_0x7fe5('0x2d')](_['pick'](_0x46f816[_0x7fe5('0x2c')],_0x1420de['filters']),_0x28a689);if(_0x46f816['query'][_0x7fe5('0x34')]){_0x150ab9[_0x7fe5('0x33')]=_[_0x7fe5('0x35')](_0x150ab9[_0x7fe5('0x33')],{'$or':_[_0x7fe5('0x27')](_0x28a689,function(_0x4c4b05){if(_0x4c4b05[_0x7fe5('0x36')]!==_0x7fe5('0x37')){var _0x5839b2={};_0x5839b2[_0x4c4b05[_0x7fe5('0x25')]]={'$like':'%'+_0x46f816[_0x7fe5('0x2c')][_0x7fe5('0x34')]+'%'};return _0x5839b2;}})});}_0x150ab9=_[_0x7fe5('0x35')]({},_0x150ab9,_0x46f816[_0x7fe5('0x38')]);var _0x1c81c8={'where':_0x150ab9[_0x7fe5('0x33')]};return db['FreshdeskField']['count'](_0x1c81c8)[_0x7fe5('0x24')](function(_0x5f5db0){_0x204bc8[_0x7fe5('0x1e')]=_0x5f5db0;if(_0x46f816[_0x7fe5('0x2c')]['includeAll']){_0x150ab9[_0x7fe5('0x39')]=[{'all':!![]}];}return db[_0x7fe5('0x28')][_0x7fe5('0x3a')](_0x150ab9);})[_0x7fe5('0x24')](function(_0x2fd004){_0x204bc8[_0x7fe5('0x3b')]=_0x2fd004;return _0x204bc8;})[_0x7fe5('0x24')](respondWithFilteredResult(_0x4a77e9,_0x150ab9))['catch'](handleError(_0x4a77e9,null));};exports['show']=function(_0x411002,_0x4f81ca){var _0xad0b05={'raw':!![],'where':{'id':_0x411002[_0x7fe5('0x3c')]['id']}},_0x1a3e0d={};_0x1a3e0d[_0x7fe5('0x2b')]=_['keys'](db[_0x7fe5('0x28')]['rawAttributes']);_0x1a3e0d['query']=_[_0x7fe5('0x3d')](_0x411002[_0x7fe5('0x2c')]);_0x1a3e0d['filters']=_[_0x7fe5('0x2e')](_0x1a3e0d[_0x7fe5('0x2b')],_0x1a3e0d[_0x7fe5('0x2c')]);_0xad0b05[_0x7fe5('0x30')]=_[_0x7fe5('0x2e')](_0x1a3e0d['model'],qs[_0x7fe5('0x2f')](_0x411002[_0x7fe5('0x2c')]['fields']));_0xad0b05[_0x7fe5('0x30')]=_0xad0b05[_0x7fe5('0x30')][_0x7fe5('0x31')]?_0xad0b05[_0x7fe5('0x30')]:_0x1a3e0d['model'];if(_0x411002[_0x7fe5('0x2c')][_0x7fe5('0x3e')]){_0xad0b05[_0x7fe5('0x39')]=[{'all':!![]}];}_0xad0b05=_['merge']({},_0xad0b05,_0x411002[_0x7fe5('0x38')]);return db[_0x7fe5('0x28')][_0x7fe5('0x3f')](_0xad0b05)['then'](handleEntityNotFound(_0x4f81ca,null))[_0x7fe5('0x24')](respondWithResult(_0x4f81ca,null))[_0x7fe5('0x40')](handleError(_0x4f81ca,null));};exports[_0x7fe5('0x41')]=function(_0x4b8642,_0x19c4a6){return db[_0x7fe5('0x28')][_0x7fe5('0x41')](_0x4b8642[_0x7fe5('0x42')],{})[_0x7fe5('0x24')](respondWithResult(_0x19c4a6,0xc9))[_0x7fe5('0x40')](handleError(_0x19c4a6,null));};exports[_0x7fe5('0x23')]=function(_0x447b57,_0x446f01){if(_0x447b57[_0x7fe5('0x42')]['id']){delete _0x447b57[_0x7fe5('0x42')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x447b57['params']['id']}})['then'](handleEntityNotFound(_0x446f01,null))[_0x7fe5('0x24')](saveUpdates(_0x447b57['body'],null))[_0x7fe5('0x24')](respondWithResult(_0x446f01,null))[_0x7fe5('0x40')](handleError(_0x446f01,null));};exports[_0x7fe5('0x43')]=function(_0x1d9ca8,_0x362f33){return db['FreshdeskField'][_0x7fe5('0x3f')]({'where':{'id':_0x1d9ca8[_0x7fe5('0x3c')]['id']}})[_0x7fe5('0x24')](handleEntityNotFound(_0x362f33,null))[_0x7fe5('0x24')](removeEntity(_0x362f33,null))[_0x7fe5('0x40')](handleError(_0x362f33,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 1e85bb6..adf0cdb 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 _0x6552=['../../config/logger','api','moment','bluebird','request-promise','path','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId'];(function(_0x561981,_0xb5361b){var _0x35cda7=function(_0x721f31){while(--_0x721f31){_0x561981['push'](_0x561981['shift']());}};_0x35cda7(++_0xb5361b);}(_0x6552,0x1ea));var _0x2655=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6552[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2655('0x0'))(_0x2655('0x1'));var moment=require(_0x2655('0x2'));var BPromise=require(_0x2655('0x3'));var rp=require(_0x2655('0x4'));var fs=require('fs');var path=require(_0x2655('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2655('0x6'));module[_0x2655('0x7')]=function(_0x3149b8,_0x2eede3){return _0x3149b8[_0x2655('0x8')](_0x2655('0x9'),attributes,{'tableName':_0x2655('0xa'),'paranoid':![],'indexes':[{'name':_0x2655('0xb'),'fields':[_0x2655('0xc'),_0x2655('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb1e=['FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x18ab5b,_0x4b76cd){var _0x191823=function(_0x3427ee){while(--_0x3427ee){_0x18ab5b['push'](_0x18ab5b['shift']());}};_0x191823(++_0x4b76cd);}(_0xeb1e,0x115));var _0xeeb1=function(_0x21dd01,_0x5d4a3a){_0x21dd01=_0x21dd01-0x0;var _0x13c673=_0xeb1e[_0x21dd01];return _0x13c673;};'use strict';var _=require(_0xeeb1('0x0'));var util=require(_0xeeb1('0x1'));var logger=require(_0xeeb1('0x2'))(_0xeeb1('0x3'));var moment=require('moment');var BPromise=require(_0xeeb1('0x4'));var rp=require(_0xeeb1('0x5'));var fs=require('fs');var path=require(_0xeeb1('0x6'));var rimraf=require(_0xeeb1('0x7'));var config=require(_0xeeb1('0x8'));var attributes=require(_0xeeb1('0x9'));module[_0xeeb1('0xa')]=function(_0x51716a,_0x3b7d8d){return _0x51716a['define'](_0xeeb1('0xb'),attributes,{'tableName':_0xeeb1('0xc'),'paranoid':![],'indexes':[{'name':_0xeeb1('0xd'),'fields':[_0xeeb1('0xe'),_0xeeb1('0xf')],'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 ae79f83..d237a7d 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 _0xa15b=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x5bcf16,_0x36a554){var _0x37ef69=function(_0x2cb59f){while(--_0x2cb59f){_0x5bcf16['push'](_0x5bcf16['shift']());}};_0x37ef69(++_0x36a554);}(_0xa15b,0xd2));var _0xba15=function(_0xb71385,_0x5dd513){_0xb71385=_0xb71385-0x0;var _0x45ab9f=_0xa15b[_0xb71385];return _0x45ab9f;};'use strict';var _=require(_0xba15('0x0'));var util=require(_0xba15('0x1'));var moment=require(_0xba15('0x2'));var BPromise=require(_0xba15('0x3'));var rs=require(_0xba15('0x4'));var fs=require('fs');var Redis=require(_0xba15('0x5'));var db=require(_0xba15('0x6'))['db'];var utils=require(_0xba15('0x7'));var logger=require(_0xba15('0x8'))(_0xba15('0x9'));var config=require(_0xba15('0xa'));var jayson=require(_0xba15('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x207b98,_0x4b2478,_0x43c511){return new BPromise(function(_0x2b08ad,_0x2ddf71){return client[_0xba15('0xc')](_0x207b98,_0x43c511)[_0xba15('0xd')](function(_0x3695e){logger['info'](_0xba15('0xe'),_0x4b2478,_0xba15('0xf'));logger['debug']('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x4b2478,_0xba15('0xf'),JSON[_0xba15('0x10')](_0x3695e));if(_0x3695e[_0xba15('0x11')]){if(_0x3695e[_0xba15('0x11')][_0xba15('0x12')]===0x1f4){logger[_0xba15('0x11')](_0xba15('0xe'),_0x4b2478,_0x3695e[_0xba15('0x11')][_0xba15('0x13')]);return _0x2ddf71(_0x3695e[_0xba15('0x11')]['message']);}logger[_0xba15('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x4b2478,_0x3695e[_0xba15('0x11')][_0xba15('0x13')]);return _0x2b08ad(_0x3695e[_0xba15('0x11')][_0xba15('0x13')]);}else{logger['info'](_0xba15('0xe'),_0x4b2478,'request\x20sent');_0x2b08ad(_0x3695e['result'][_0xba15('0x13')]);}})[_0xba15('0x14')](function(_0x2fa9b0){logger[_0xba15('0x11')](_0xba15('0xe'),_0x4b2478,_0x2fa9b0);_0x2ddf71(_0x2fa9b0);});});} \ No newline at end of file +var _0xf217=['../../config/logger','../../config/environment','jayson/promise','client','http','request','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x596f6e,_0x3f8857){var _0x1e0803=function(_0x31f91f){while(--_0x31f91f){_0x596f6e['push'](_0x596f6e['shift']());}};_0x1e0803(++_0x3f8857);}(_0xf217,0x72));var _0x7f21=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xf217[_0x2ec461];return _0x28603d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7f21('0x0'));var BPromise=require(_0x7f21('0x1'));var rs=require(_0x7f21('0x2'));var fs=require('fs');var Redis=require(_0x7f21('0x3'));var db=require(_0x7f21('0x4'))['db'];var utils=require(_0x7f21('0x5'));var logger=require(_0x7f21('0x6'))('rpc');var config=require(_0x7f21('0x7'));var jayson=require(_0x7f21('0x8'));var client=jayson[_0x7f21('0x9')][_0x7f21('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c1ffe,_0x68a0b3,_0x486543){return new BPromise(function(_0x45bb0c,_0x16d370){return client[_0x7f21('0xb')](_0x1c1ffe,_0x486543)['then'](function(_0x16097c){logger['info'](_0x7f21('0xc'),_0x68a0b3,_0x7f21('0xd'));logger[_0x7f21('0xe')](_0x7f21('0xf'),_0x68a0b3,'request\x20sent',JSON['stringify'](_0x16097c));if(_0x16097c[_0x7f21('0x10')]){if(_0x16097c[_0x7f21('0x10')]['code']===0x1f4){logger[_0x7f21('0x10')](_0x7f21('0xc'),_0x68a0b3,_0x16097c['error']['message']);return _0x16d370(_0x16097c[_0x7f21('0x10')][_0x7f21('0x11')]);}logger[_0x7f21('0x10')](_0x7f21('0xc'),_0x68a0b3,_0x16097c[_0x7f21('0x10')][_0x7f21('0x11')]);return _0x45bb0c(_0x16097c[_0x7f21('0x10')][_0x7f21('0x11')]);}else{logger['info'](_0x7f21('0xc'),_0x68a0b3,'request\x20sent');_0x45bb0c(_0x16097c[_0x7f21('0x12')][_0x7f21('0x11')]);}})[_0x7f21('0x13')](function(_0x47678e){logger[_0x7f21('0x10')](_0x7f21('0xc'),_0x68a0b3,_0x47678e);_0x16d370(_0x47678e);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 343aa54..fc29fc9 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 _0x97c1=['delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x97c1,0xdf));var _0x197c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x97c1[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var path=require('path');var timeout=require(_0x197c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x197c('0x3'));var auth=require(_0x197c('0x4'));var interaction=require(_0x197c('0x5'));var config=require(_0x197c('0x6'));var controller=require(_0x197c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x197c('0x8')]);router[_0x197c('0x9')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller['show']);router['get'](_0x197c('0xc'),auth['isAuthenticated'](),controller[_0x197c('0xd')]);router[_0x197c('0x9')](_0x197c('0xe'),auth[_0x197c('0xb')](),controller['getFields']);router[_0x197c('0xf')]('/',auth[_0x197c('0xb')](),controller[_0x197c('0x10')]);router[_0x197c('0xf')](_0x197c('0xc'),auth['isAuthenticated'](),controller[_0x197c('0x11')]);router[_0x197c('0x12')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller['update']);router[_0x197c('0x13')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller[_0x197c('0x14')]);module[_0x197c('0x15')]=router; \ No newline at end of file +var _0xa478=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','getConfigurations','getFields','post','/:id/configurations','update'];(function(_0x512105,_0x357761){var _0x29d5e4=function(_0x3fa53f){while(--_0x3fa53f){_0x512105['push'](_0x512105['shift']());}};_0x29d5e4(++_0x357761);}(_0xa478,0x136));var _0x8a47=function(_0x2ab3c5,_0x35a3ef){_0x2ab3c5=_0x2ab3c5-0x0;var _0x2733aa=_0xa478[_0x2ab3c5];return _0x2733aa;};'use strict';var multer=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var path=require(_0x8a47('0x2'));var timeout=require(_0x8a47('0x3'));var express=require(_0x8a47('0x4'));var router=express[_0x8a47('0x5')]();var fs_extra=require(_0x8a47('0x6'));var auth=require(_0x8a47('0x7'));var interaction=require(_0x8a47('0x8'));var config=require(_0x8a47('0x9'));var controller=require(_0x8a47('0xa'));router[_0x8a47('0xb')]('/',auth['isAuthenticated'](),controller[_0x8a47('0xc')]);router[_0x8a47('0xb')](_0x8a47('0xd'),auth[_0x8a47('0xe')](),controller['show']);router[_0x8a47('0xb')]('/:id/configurations',auth[_0x8a47('0xe')](),controller[_0x8a47('0xf')]);router[_0x8a47('0xb')]('/:id/fields',auth[_0x8a47('0xe')](),controller[_0x8a47('0x10')]);router['post']('/',auth[_0x8a47('0xe')](),controller['create']);router[_0x8a47('0x11')](_0x8a47('0x12'),auth[_0x8a47('0xe')](),controller['addConfiguration']);router['put']('/:id',auth[_0x8a47('0xe')](),controller[_0x8a47('0x13')]);router['delete'](_0x8a47('0xd'),auth[_0x8a47('0xe')](),controller[_0x8a47('0x14')]);module[_0x8a47('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index f2d72fd..166dde2 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 _0x6a55=['STRING','sequelize'];(function(_0x1e14ae,_0x25be7a){var _0x5be775=function(_0x320ff6){while(--_0x320ff6){_0x1e14ae['push'](_0x1e14ae['shift']());}};_0x5be775(++_0x25be7a);}(_0x6a55,0xdb));var _0x56a5=function(_0x52eb16,_0x89c3d8){_0x52eb16=_0x52eb16-0x0;var _0x382d3f=_0x6a55[_0x52eb16];return _0x382d3f;};'use strict';var Sequelize=require(_0x56a5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x56a5('0x1')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x56a5('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a5('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2032=['remoteUri','exports','STRING','username'];(function(_0x35ccab,_0xd7ec6b){var _0x2ea2af=function(_0x17b00c){while(--_0x17b00c){_0x35ccab['push'](_0x35ccab['shift']());}};_0x2ea2af(++_0xd7ec6b);}(_0x2032,0xd9));var _0x2203=function(_0x293236,_0x34dd80){_0x293236=_0x293236-0x0;var _0x15ee41=_0x2032[_0x293236];return _0x15ee41;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')]},'description':{'type':Sequelize[_0x2203('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x2203('0x2')},'apiKey':{'type':Sequelize[_0x2203('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2203('0x3')},'serverUrl':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index a6b8928..ba0d9f1 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 _0x6433=['update','then','error','stack','name','index','map','FreshsalesAccount','type','key','model','keys','query','intersection','attributes','fields','nolimit','filters','pick','filter','merge','options','where','includeAll','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','rawAttributes','length','order','sort','hasOwnProperty','addConfiguration','AccountId','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','slice','substring','GET','format','/api/selector/owners','apiKey','email','Requested\x20Resource\x20not\x20Found','test','stringify','send','statusCode','eml-format','zip-dir','moment','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','reject','save'];(function(_0x1d4706,_0x1d40bd){var _0x2f665c=function(_0x39d1f2){while(--_0x39d1f2){_0x1d4706['push'](_0x1d4706['shift']());}};_0x2f665c(++_0x1d40bd);}(_0x6433,0x1b9));var _0x3643=function(_0x406fc9,_0x15d2f3){_0x406fc9=_0x406fc9-0x0;var _0x40e094=_0x6433[_0x406fc9];return _0x40e094;};'use strict';var emlformat=require(_0x3643('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3643('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3643('0x2'));var BPromise=require(_0x3643('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3643('0x4'));var csv=require(_0x3643('0x5'));var ejs=require(_0x3643('0x6'));var fs=require('fs');var fs_extra=require(_0x3643('0x7'));var _=require('lodash');var squel=require(_0x3643('0x8'));var crypto=require(_0x3643('0x9'));var jsforce=require(_0x3643('0xa'));var deskjs=require(_0x3643('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3643('0xc'));var Papa=require(_0x3643('0xd'));var Redis=require(_0x3643('0xe'));var authService=require(_0x3643('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3643('0x10'))(_0x3643('0x11'));var utils=require(_0x3643('0x12'));var config=require(_0x3643('0x13'));var licenseUtil=require(_0x3643('0x14'));var db=require(_0x3643('0x15'))['db'];var integrations=require(_0x3643('0x16'));function respondWithStatusCode(_0x27b79b,_0xc244c0){_0xc244c0=_0xc244c0||0xcc;return function(_0x14c885){if(_0x14c885){return _0x27b79b[_0x3643('0x17')](_0xc244c0);}return _0x27b79b['status'](_0xc244c0)[_0x3643('0x18')]();};}function respondWithResult(_0x4b5b8b,_0x5f1f27){_0x5f1f27=_0x5f1f27||0xc8;return function(_0x5435e7){if(_0x5435e7){return _0x4b5b8b['status'](_0x5f1f27)['json'](_0x5435e7);}};}function respondWithFilteredResult(_0x2c3280,_0x301a8f){return function(_0x105682){if(_0x105682){var _0x98901f=typeof _0x301a8f[_0x3643('0x19')]===_0x3643('0x1a')&&typeof _0x301a8f[_0x3643('0x1b')]===_0x3643('0x1a');var _0x4c9cd3=_0x105682[_0x3643('0x1c')];var _0x363aca=_0x98901f?0x0:_0x301a8f[_0x3643('0x19')];var _0x4f21e2=_0x98901f?_0x105682[_0x3643('0x1c')]:_0x301a8f['offset']+_0x301a8f[_0x3643('0x1b')];var _0x62eba;if(_0x4f21e2>=_0x4c9cd3){_0x4f21e2=_0x4c9cd3;_0x62eba=0xc8;}else{_0x62eba=0xce;}_0x2c3280[_0x3643('0x1d')](_0x62eba);return _0x2c3280[_0x3643('0x1e')](_0x3643('0x1f'),_0x363aca+'-'+_0x4f21e2+'/'+_0x4c9cd3)['json'](_0x105682);}return null;};}function patchUpdates(_0x478c7e){return function(_0x7d98e5){try{jsonpatch['apply'](_0x7d98e5,_0x478c7e,!![]);}catch(_0x573d51){return BPromise[_0x3643('0x20')](_0x573d51);}return _0x7d98e5[_0x3643('0x21')]();};}function saveUpdates(_0x275b54,_0x31cb54){return function(_0x17c936){if(_0x17c936){return _0x17c936[_0x3643('0x22')](_0x275b54)[_0x3643('0x23')](function(_0x287181){return _0x287181;});}return null;};}function removeEntity(_0x3f013b,_0x165594){return function(_0x2ec5d7){if(_0x2ec5d7){return _0x2ec5d7['destroy']()[_0x3643('0x23')](function(){_0x3f013b['status'](0xcc)[_0x3643('0x18')]();});}};}function handleEntityNotFound(_0x5cd2ac,_0x7c0547){return function(_0x4f0052){if(!_0x4f0052){_0x5cd2ac[_0x3643('0x17')](0x194);}return _0x4f0052;};}function handleError(_0x59ce7b,_0x1365c2){_0x1365c2=_0x1365c2||0x1f4;return function(_0x52c6a6){logger[_0x3643('0x24')](_0x52c6a6[_0x3643('0x25')]);if(_0x52c6a6[_0x3643('0x26')]){delete _0x52c6a6[_0x3643('0x26')];}_0x59ce7b[_0x3643('0x1d')](_0x1365c2)['send'](_0x52c6a6);};}exports[_0x3643('0x27')]=function(_0x85b52,_0x552efc){var _0x2faa30={},_0x1bca31={},_0xf1e3f7={'count':0x0,'rows':[]};var _0x24428d=_[_0x3643('0x28')](db[_0x3643('0x29')]['rawAttributes'],function(_0x6d8ebd){return{'name':_0x6d8ebd['fieldName'],'type':_0x6d8ebd[_0x3643('0x2a')][_0x3643('0x2b')]};});_0x1bca31[_0x3643('0x2c')]=_[_0x3643('0x28')](_0x24428d,_0x3643('0x26'));_0x1bca31['query']=_[_0x3643('0x2d')](_0x85b52[_0x3643('0x2e')]);_0x1bca31['filters']=_[_0x3643('0x2f')](_0x1bca31['model'],_0x1bca31[_0x3643('0x2e')]);_0x2faa30[_0x3643('0x30')]=_[_0x3643('0x2f')](_0x1bca31[_0x3643('0x2c')],qs[_0x3643('0x31')](_0x85b52[_0x3643('0x2e')][_0x3643('0x31')]));_0x2faa30['attributes']=_0x2faa30['attributes']['length']?_0x2faa30['attributes']:_0x1bca31['model'];if(!_0x85b52['query']['hasOwnProperty'](_0x3643('0x32'))){_0x2faa30[_0x3643('0x1b')]=qs[_0x3643('0x1b')](_0x85b52[_0x3643('0x2e')]['limit']);_0x2faa30[_0x3643('0x19')]=qs[_0x3643('0x19')](_0x85b52[_0x3643('0x2e')][_0x3643('0x19')]);}_0x2faa30['order']=qs['sort'](_0x85b52[_0x3643('0x2e')]['sort']);_0x2faa30['where']=qs[_0x3643('0x33')](_[_0x3643('0x34')](_0x85b52[_0x3643('0x2e')],_0x1bca31[_0x3643('0x33')]),_0x24428d);if(_0x85b52[_0x3643('0x2e')][_0x3643('0x35')]){_0x2faa30['where']=_[_0x3643('0x36')](_0x2faa30['where'],{'$or':_[_0x3643('0x28')](_0x24428d,function(_0x13c9ae){if(_0x13c9ae[_0x3643('0x2a')]!=='VIRTUAL'){var _0x5be811={};_0x5be811[_0x13c9ae[_0x3643('0x26')]]={'$like':'%'+_0x85b52[_0x3643('0x2e')][_0x3643('0x35')]+'%'};return _0x5be811;}})});}_0x2faa30=_[_0x3643('0x36')]({},_0x2faa30,_0x85b52[_0x3643('0x37')]);var _0x2b4f59={'where':_0x2faa30[_0x3643('0x38')]};return db['FreshsalesAccount'][_0x3643('0x1c')](_0x2b4f59)['then'](function(_0x122a49){_0xf1e3f7[_0x3643('0x1c')]=_0x122a49;if(_0x85b52[_0x3643('0x2e')][_0x3643('0x39')]){_0x2faa30['include']=[{'all':!![]}];}return db[_0x3643('0x29')][_0x3643('0x3a')](_0x2faa30);})['then'](function(_0x17f72f){_0xf1e3f7[_0x3643('0x3b')]=_0x17f72f;return _0xf1e3f7;})[_0x3643('0x23')](respondWithFilteredResult(_0x552efc,_0x2faa30))[_0x3643('0x3c')](handleError(_0x552efc,null));};exports[_0x3643('0x3d')]=function(_0x1d805a,_0x4b3e8){var _0x1ac05c={'raw':![],'where':{'id':_0x1d805a[_0x3643('0x3e')]['id']}},_0x1f238a={};_0x1f238a['model']=_[_0x3643('0x2d')](db[_0x3643('0x29')]['rawAttributes']);_0x1f238a['query']=_[_0x3643('0x2d')](_0x1d805a['query']);_0x1f238a['filters']=_[_0x3643('0x2f')](_0x1f238a['model'],_0x1f238a[_0x3643('0x2e')]);_0x1ac05c[_0x3643('0x30')]=_[_0x3643('0x2f')](_0x1f238a['model'],qs[_0x3643('0x31')](_0x1d805a[_0x3643('0x2e')]['fields']));_0x1ac05c[_0x3643('0x30')]=_0x1ac05c[_0x3643('0x30')]['length']?_0x1ac05c[_0x3643('0x30')]:_0x1f238a['model'];if(_0x1d805a[_0x3643('0x2e')][_0x3643('0x39')]){_0x1ac05c['include']=[{'all':!![]}];}_0x1ac05c=_[_0x3643('0x36')]({},_0x1ac05c,_0x1d805a[_0x3643('0x37')]);return db[_0x3643('0x29')][_0x3643('0x3f')](_0x1ac05c)[_0x3643('0x23')](handleEntityNotFound(_0x4b3e8,null))[_0x3643('0x23')](respondWithResult(_0x4b3e8,null))[_0x3643('0x3c')](handleError(_0x4b3e8,null));};exports['create']=function(_0x1c868e,_0x18eb9d){return db['FreshsalesAccount'][_0x3643('0x40')](_0x1c868e[_0x3643('0x41')],{})['then'](respondWithResult(_0x18eb9d,0xc9))['catch'](handleError(_0x18eb9d,null));};exports[_0x3643('0x22')]=function(_0x50b6e2,_0x29cd3d){if(_0x50b6e2[_0x3643('0x41')]['id']){delete _0x50b6e2[_0x3643('0x41')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x50b6e2['params']['id']}})['then'](handleEntityNotFound(_0x29cd3d,null))[_0x3643('0x23')](saveUpdates(_0x50b6e2[_0x3643('0x41')],null))[_0x3643('0x23')](respondWithResult(_0x29cd3d,null))[_0x3643('0x3c')](handleError(_0x29cd3d,null));};exports['destroy']=function(_0x3f77a7,_0x3ccc93){return db[_0x3643('0x29')][_0x3643('0x3f')]({'where':{'id':_0x3f77a7[_0x3643('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3ccc93,null))[_0x3643('0x23')](removeEntity(_0x3ccc93,null))[_0x3643('0x3c')](handleError(_0x3ccc93,null));};exports[_0x3643('0x42')]=function(_0x539c82,_0x574e2c,_0x231f79){var _0x8a0fc6={};var _0x20be09={};var _0x2524f8;var _0x1972df;return db[_0x3643('0x29')][_0x3643('0x43')]({'where':{'id':_0x539c82[_0x3643('0x3e')]['id']}})[_0x3643('0x23')](handleEntityNotFound(_0x574e2c,null))[_0x3643('0x23')](function(_0x52c644){if(_0x52c644){_0x2524f8=_0x52c644;_0x20be09[_0x3643('0x2c')]=_[_0x3643('0x2d')](db[_0x3643('0x44')][_0x3643('0x45')]);_0x20be09['query']=_[_0x3643('0x2d')](_0x539c82['query']);_0x20be09[_0x3643('0x33')]=_[_0x3643('0x2f')](_0x20be09[_0x3643('0x2c')],_0x20be09[_0x3643('0x2e')]);_0x8a0fc6[_0x3643('0x30')]=_[_0x3643('0x2f')](_0x20be09[_0x3643('0x2c')],qs[_0x3643('0x31')](_0x539c82[_0x3643('0x2e')][_0x3643('0x31')]));_0x8a0fc6[_0x3643('0x30')]=_0x8a0fc6['attributes'][_0x3643('0x46')]?_0x8a0fc6[_0x3643('0x30')]:_0x20be09[_0x3643('0x2c')];_0x8a0fc6[_0x3643('0x47')]=qs[_0x3643('0x48')](_0x539c82[_0x3643('0x2e')][_0x3643('0x48')]);_0x8a0fc6['where']=qs[_0x3643('0x33')](_['pick'](_0x539c82[_0x3643('0x2e')],_0x20be09[_0x3643('0x33')]));if(_0x539c82[_0x3643('0x2e')][_0x3643('0x35')]){_0x8a0fc6[_0x3643('0x38')]=_[_0x3643('0x36')](_0x8a0fc6['where'],{'$or':_[_0x3643('0x28')](_0x8a0fc6[_0x3643('0x30')],function(_0x4e4192){var _0x1d3061={};_0x1d3061[_0x4e4192]={'$like':'%'+_0x539c82[_0x3643('0x2e')][_0x3643('0x35')]+'%'};return _0x1d3061;})});}_0x8a0fc6=_[_0x3643('0x36')]({},_0x8a0fc6,_0x539c82['options']);return _0x2524f8[_0x3643('0x42')](_0x8a0fc6);}})[_0x3643('0x23')](function(_0x49422a){if(_0x49422a){_0x1972df=_0x49422a[_0x3643('0x46')];if(!_0x539c82[_0x3643('0x2e')][_0x3643('0x49')](_0x3643('0x32'))){_0x8a0fc6[_0x3643('0x1b')]=qs[_0x3643('0x1b')](_0x539c82[_0x3643('0x2e')][_0x3643('0x1b')]);_0x8a0fc6['offset']=qs[_0x3643('0x19')](_0x539c82[_0x3643('0x2e')][_0x3643('0x19')]);}return _0x2524f8['getConfigurations'](_0x8a0fc6);}})['then'](function(_0x746ed0){if(_0x746ed0){return _0x746ed0?{'count':_0x1972df,'rows':_0x746ed0}:null;}})[_0x3643('0x23')](respondWithResult(_0x574e2c,null))[_0x3643('0x3c')](handleError(_0x574e2c,null));};exports[_0x3643('0x4a')]=function(_0x59f9ac,_0x1be1d0,_0x50854e){if(_0x59f9ac[_0x3643('0x41')]['id']){delete _0x59f9ac['body']['id'];}return db[_0x3643('0x29')]['findOne']({'where':{'id':_0x59f9ac[_0x3643('0x3e')]['id']}})[_0x3643('0x23')](handleEntityNotFound(_0x1be1d0,null))[_0x3643('0x23')](function(_0x5e6f82){if(_0x5e6f82){_0x59f9ac[_0x3643('0x41')][_0x3643('0x4b')]=_0x5e6f82['id'];_0x59f9ac[_0x3643('0x41')]['Subjects']=integrations['getSubjects'](_0x59f9ac['body'][_0x3643('0x4c')],_0x59f9ac[_0x3643('0x41')][_0x3643('0x2a')]);_0x59f9ac[_0x3643('0x41')][_0x3643('0x4d')]=integrations[_0x3643('0x4e')](_0x59f9ac['body']['channel'],_0x59f9ac[_0x3643('0x41')][_0x3643('0x2a')]);return db[_0x3643('0x44')]['create'](_0x59f9ac['body'],{'include':[{'model':db[_0x3643('0x4f')],'as':'Subjects'},{'model':db[_0x3643('0x4f')],'as':_0x3643('0x4d')}]});}return null;})[_0x3643('0x23')](respondWithResult(_0x1be1d0,null))[_0x3643('0x3c')](handleError(_0x1be1d0,null));};exports[_0x3643('0x50')]=function(_0xd057ce,_0x3afd43,_0x4c2a93){var _0xade8b0='';var _0x549832='';return db['FreshsalesAccount'][_0x3643('0x43')]({'where':{'id':_0xd057ce['params']['id']},'attributes':['id',_0x3643('0x51'),_0x3643('0x52'),'apiKey']})[_0x3643('0x23')](handleEntityNotFound(_0x3afd43,null))[_0x3643('0x23')](function(_0x9386){if(_0x9386){_0x549832=_0x9386['username'];_0xade8b0=_0x9386[_0x3643('0x52')];var _0x4ce0a3=_0x9386[_0x3643('0x52')][_0x3643('0x53')](-0x1);if(_0x4ce0a3==='/'){_0xade8b0=_0xade8b0[_0x3643('0x54')](0x0,_0xade8b0['lastIndexOf'](_0x4ce0a3));}return rp({'method':_0x3643('0x55'),'uri':util[_0x3643('0x56')]('%s%s',_0xade8b0,_0x3643('0x57')),'headers':{'Authorization':'Token\x20token='+_0x9386[_0x3643('0x58')]},'json':!![]});}})[_0x3643('0x23')](function(_0x43855d){if(_0x43855d){var _0x5aeb1a=_0x43855d['users'];var _0x5eaba4=![];var _0x2344c2=null;for(_0x2344c2=0x0;_0x2344c2<_0x5aeb1a[_0x3643('0x46')];_0x2344c2++){if(_0x5aeb1a[_0x2344c2][_0x3643('0x59')]===_0x549832){_0x5eaba4=!![];}}if(_0x5eaba4){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3643('0x5a')});}}})[_0x3643('0x23')](respondWithResult(_0x3afd43,null))['catch'](function(_0xab709d){var _0x5ded79=_0xd057ce[_0x3643('0x2e')][_0x3643('0x5b')]?0x1f4:_0xab709d['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5ded79,JSON[_0x3643('0x5c')](_0xab709d));delete _0xab709d[_0x3643('0x26')];if(_0x5ded79===0x191){_0x5ded79=0x190;}_0x3afd43[_0x3643('0x1d')](_0x5ded79)[_0x3643('0x5d')](_0xd057ce[_0x3643('0x2e')][_0x3643('0x5b')]?{'message':'Wrong\x20credentials','statusCode':_0xab709d[_0x3643('0x5e')]}:_0xab709d);});}; \ No newline at end of file +var _0x4662=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','json','reject','save','update','destroy','then','end','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesAccount','include','findAll','rows','catch','params','includeAll','create','body','find','getConfigurations','FreshsalesConfiguration','length','order','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','Descriptions','getFields','username','remoteUri','lastIndexOf','format','%s%s','/api/selector/owners','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x5a6b45,_0x48fea6){var _0x2ad452=function(_0x57381c){while(--_0x57381c){_0x5a6b45['push'](_0x5a6b45['shift']());}};_0x2ad452(++_0x48fea6);}(_0x4662,0x18b));var _0x2466=function(_0x3eb1ea,_0x12ab5f){_0x3eb1ea=_0x3eb1ea-0x0;var _0x87f48d=_0x4662[_0x3eb1ea];return _0x87f48d;};'use strict';var emlformat=require(_0x2466('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2466('0x1'));var jsonpatch=require(_0x2466('0x2'));var rp=require(_0x2466('0x3'));var moment=require(_0x2466('0x4'));var BPromise=require(_0x2466('0x5'));var Mustache=require(_0x2466('0x6'));var util=require('util');var path=require(_0x2466('0x7'));var sox=require(_0x2466('0x8'));var csv=require(_0x2466('0x9'));var ejs=require(_0x2466('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2466('0xb'));var squel=require(_0x2466('0xc'));var crypto=require(_0x2466('0xd'));var jsforce=require(_0x2466('0xe'));var deskjs=require(_0x2466('0xf'));var toCsv=require(_0x2466('0x9'));var querystring=require(_0x2466('0x10'));var Papa=require(_0x2466('0x11'));var Redis=require(_0x2466('0x12'));var authService=require(_0x2466('0x13'));var qs=require(_0x2466('0x14'));var as=require(_0x2466('0x15'));var hardwareService=require(_0x2466('0x16'));var logger=require('../../config/logger')(_0x2466('0x17'));var utils=require('../../config/utils');var config=require(_0x2466('0x18'));var licenseUtil=require(_0x2466('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x86890,_0x105b41){_0x105b41=_0x105b41||0xcc;return function(_0x1981e7){if(_0x1981e7){return _0x86890[_0x2466('0x1a')](_0x105b41);}return _0x86890[_0x2466('0x1b')](_0x105b41)['end']();};}function respondWithResult(_0x1d05fe,_0x51f9f7){_0x51f9f7=_0x51f9f7||0xc8;return function(_0x2406e8){if(_0x2406e8){return _0x1d05fe['status'](_0x51f9f7)['json'](_0x2406e8);}};}function respondWithFilteredResult(_0x51c84c,_0x511fa8){return function(_0x529fd7){if(_0x529fd7){var _0x2ed5ec=typeof _0x511fa8[_0x2466('0x1c')]==='undefined'&&typeof _0x511fa8[_0x2466('0x1d')]===_0x2466('0x1e');var _0x375922=_0x529fd7[_0x2466('0x1f')];var _0x576880=_0x2ed5ec?0x0:_0x511fa8[_0x2466('0x1c')];var _0x18b3ba=_0x2ed5ec?_0x529fd7[_0x2466('0x1f')]:_0x511fa8[_0x2466('0x1c')]+_0x511fa8[_0x2466('0x1d')];var _0x1e713e;if(_0x18b3ba>=_0x375922){_0x18b3ba=_0x375922;_0x1e713e=0xc8;}else{_0x1e713e=0xce;}_0x51c84c[_0x2466('0x1b')](_0x1e713e);return _0x51c84c[_0x2466('0x20')]('Content-Range',_0x576880+'-'+_0x18b3ba+'/'+_0x375922)[_0x2466('0x21')](_0x529fd7);}return null;};}function patchUpdates(_0x373fa5){return function(_0x517299){try{jsonpatch['apply'](_0x517299,_0x373fa5,!![]);}catch(_0x846881){return BPromise[_0x2466('0x22')](_0x846881);}return _0x517299[_0x2466('0x23')]();};}function saveUpdates(_0x4980af,_0x58676a){return function(_0x18a5a1){if(_0x18a5a1){return _0x18a5a1[_0x2466('0x24')](_0x4980af)['then'](function(_0x948277){return _0x948277;});}return null;};}function removeEntity(_0x5b47b0,_0x177752){return function(_0x1b6a99){if(_0x1b6a99){return _0x1b6a99[_0x2466('0x25')]()[_0x2466('0x26')](function(){_0x5b47b0[_0x2466('0x1b')](0xcc)[_0x2466('0x27')]();});}};}function handleEntityNotFound(_0x573961,_0x2f94bc){return function(_0x3976f2){if(!_0x3976f2){_0x573961['sendStatus'](0x194);}return _0x3976f2;};}function handleError(_0x204e5d,_0x44257a){_0x44257a=_0x44257a||0x1f4;return function(_0x11999a){logger[_0x2466('0x28')](_0x11999a['stack']);if(_0x11999a[_0x2466('0x29')]){delete _0x11999a[_0x2466('0x29')];}_0x204e5d['status'](_0x44257a)[_0x2466('0x2a')](_0x11999a);};}exports[_0x2466('0x2b')]=function(_0x4d71e0,_0x25de3e){var _0x130dce={},_0x167511={},_0x3ebbfd={'count':0x0,'rows':[]};var _0x218b94=_[_0x2466('0x2c')](db['FreshsalesAccount'][_0x2466('0x2d')],function(_0x13284c){return{'name':_0x13284c[_0x2466('0x2e')],'type':_0x13284c[_0x2466('0x2f')][_0x2466('0x30')]};});_0x167511['model']=_[_0x2466('0x2c')](_0x218b94,_0x2466('0x29'));_0x167511[_0x2466('0x31')]=_[_0x2466('0x32')](_0x4d71e0[_0x2466('0x31')]);_0x167511[_0x2466('0x33')]=_[_0x2466('0x34')](_0x167511['model'],_0x167511['query']);_0x130dce[_0x2466('0x35')]=_[_0x2466('0x34')](_0x167511[_0x2466('0x36')],qs[_0x2466('0x37')](_0x4d71e0[_0x2466('0x31')][_0x2466('0x37')]));_0x130dce[_0x2466('0x35')]=_0x130dce[_0x2466('0x35')]['length']?_0x130dce[_0x2466('0x35')]:_0x167511[_0x2466('0x36')];if(!_0x4d71e0[_0x2466('0x31')][_0x2466('0x38')](_0x2466('0x39'))){_0x130dce['limit']=qs['limit'](_0x4d71e0[_0x2466('0x31')][_0x2466('0x1d')]);_0x130dce['offset']=qs['offset'](_0x4d71e0['query']['offset']);}_0x130dce['order']=qs[_0x2466('0x3a')](_0x4d71e0[_0x2466('0x31')][_0x2466('0x3a')]);_0x130dce[_0x2466('0x3b')]=qs['filters'](_[_0x2466('0x3c')](_0x4d71e0[_0x2466('0x31')],_0x167511[_0x2466('0x33')]),_0x218b94);if(_0x4d71e0[_0x2466('0x31')][_0x2466('0x3d')]){_0x130dce['where']=_[_0x2466('0x3e')](_0x130dce['where'],{'$or':_[_0x2466('0x2c')](_0x218b94,function(_0x155442){if(_0x155442['type']!==_0x2466('0x3f')){var _0x20b460={};_0x20b460[_0x155442[_0x2466('0x29')]]={'$like':'%'+_0x4d71e0['query']['filter']+'%'};return _0x20b460;}})});}_0x130dce=_[_0x2466('0x3e')]({},_0x130dce,_0x4d71e0[_0x2466('0x40')]);var _0x26a629={'where':_0x130dce[_0x2466('0x3b')]};return db[_0x2466('0x41')][_0x2466('0x1f')](_0x26a629)[_0x2466('0x26')](function(_0x12ba98){_0x3ebbfd[_0x2466('0x1f')]=_0x12ba98;if(_0x4d71e0['query']['includeAll']){_0x130dce[_0x2466('0x42')]=[{'all':!![]}];}return db[_0x2466('0x41')][_0x2466('0x43')](_0x130dce);})[_0x2466('0x26')](function(_0x55c553){_0x3ebbfd[_0x2466('0x44')]=_0x55c553;return _0x3ebbfd;})['then'](respondWithFilteredResult(_0x25de3e,_0x130dce))[_0x2466('0x45')](handleError(_0x25de3e,null));};exports['show']=function(_0x47b325,_0x427a2d){var _0x5e85dc={'raw':![],'where':{'id':_0x47b325[_0x2466('0x46')]['id']}},_0x2442c8={};_0x2442c8['model']=_['keys'](db[_0x2466('0x41')][_0x2466('0x2d')]);_0x2442c8['query']=_['keys'](_0x47b325[_0x2466('0x31')]);_0x2442c8[_0x2466('0x33')]=_['intersection'](_0x2442c8[_0x2466('0x36')],_0x2442c8[_0x2466('0x31')]);_0x5e85dc[_0x2466('0x35')]=_[_0x2466('0x34')](_0x2442c8[_0x2466('0x36')],qs[_0x2466('0x37')](_0x47b325[_0x2466('0x31')][_0x2466('0x37')]));_0x5e85dc[_0x2466('0x35')]=_0x5e85dc[_0x2466('0x35')]['length']?_0x5e85dc[_0x2466('0x35')]:_0x2442c8[_0x2466('0x36')];if(_0x47b325[_0x2466('0x31')][_0x2466('0x47')]){_0x5e85dc[_0x2466('0x42')]=[{'all':!![]}];}_0x5e85dc=_[_0x2466('0x3e')]({},_0x5e85dc,_0x47b325[_0x2466('0x40')]);return db[_0x2466('0x41')]['find'](_0x5e85dc)[_0x2466('0x26')](handleEntityNotFound(_0x427a2d,null))[_0x2466('0x26')](respondWithResult(_0x427a2d,null))[_0x2466('0x45')](handleError(_0x427a2d,null));};exports['create']=function(_0x295e71,_0x5c6b8c){return db['FreshsalesAccount'][_0x2466('0x48')](_0x295e71['body'],{})[_0x2466('0x26')](respondWithResult(_0x5c6b8c,0xc9))['catch'](handleError(_0x5c6b8c,null));};exports[_0x2466('0x24')]=function(_0x9ee141,_0x4d233c){if(_0x9ee141['body']['id']){delete _0x9ee141[_0x2466('0x49')]['id'];}return db[_0x2466('0x41')]['find']({'where':{'id':_0x9ee141[_0x2466('0x46')]['id']}})[_0x2466('0x26')](handleEntityNotFound(_0x4d233c,null))[_0x2466('0x26')](saveUpdates(_0x9ee141[_0x2466('0x49')],null))[_0x2466('0x26')](respondWithResult(_0x4d233c,null))['catch'](handleError(_0x4d233c,null));};exports[_0x2466('0x25')]=function(_0x27a535,_0xb8b936){return db['FreshsalesAccount'][_0x2466('0x4a')]({'where':{'id':_0x27a535[_0x2466('0x46')]['id']}})[_0x2466('0x26')](handleEntityNotFound(_0xb8b936,null))[_0x2466('0x26')](removeEntity(_0xb8b936,null))[_0x2466('0x45')](handleError(_0xb8b936,null));};exports[_0x2466('0x4b')]=function(_0x16ecb7,_0x61e9be,_0x352c71){var _0x509146={};var _0x3682dd={};var _0x15ac30;var _0x504ac0;return db[_0x2466('0x41')]['findOne']({'where':{'id':_0x16ecb7[_0x2466('0x46')]['id']}})['then'](handleEntityNotFound(_0x61e9be,null))[_0x2466('0x26')](function(_0x1d8b03){if(_0x1d8b03){_0x15ac30=_0x1d8b03;_0x3682dd['model']=_['keys'](db[_0x2466('0x4c')][_0x2466('0x2d')]);_0x3682dd[_0x2466('0x31')]=_[_0x2466('0x32')](_0x16ecb7[_0x2466('0x31')]);_0x3682dd['filters']=_[_0x2466('0x34')](_0x3682dd['model'],_0x3682dd[_0x2466('0x31')]);_0x509146['attributes']=_[_0x2466('0x34')](_0x3682dd[_0x2466('0x36')],qs[_0x2466('0x37')](_0x16ecb7['query'][_0x2466('0x37')]));_0x509146[_0x2466('0x35')]=_0x509146['attributes'][_0x2466('0x4d')]?_0x509146[_0x2466('0x35')]:_0x3682dd[_0x2466('0x36')];_0x509146[_0x2466('0x4e')]=qs[_0x2466('0x3a')](_0x16ecb7[_0x2466('0x31')][_0x2466('0x3a')]);_0x509146[_0x2466('0x3b')]=qs[_0x2466('0x33')](_['pick'](_0x16ecb7[_0x2466('0x31')],_0x3682dd[_0x2466('0x33')]));if(_0x16ecb7[_0x2466('0x31')][_0x2466('0x3d')]){_0x509146['where']=_[_0x2466('0x3e')](_0x509146[_0x2466('0x3b')],{'$or':_[_0x2466('0x2c')](_0x509146[_0x2466('0x35')],function(_0x2ecf8d){var _0x28bb9f={};_0x28bb9f[_0x2ecf8d]={'$like':'%'+_0x16ecb7[_0x2466('0x31')][_0x2466('0x3d')]+'%'};return _0x28bb9f;})});}_0x509146=_[_0x2466('0x3e')]({},_0x509146,_0x16ecb7[_0x2466('0x40')]);return _0x15ac30[_0x2466('0x4b')](_0x509146);}})[_0x2466('0x26')](function(_0x2e6a06){if(_0x2e6a06){_0x504ac0=_0x2e6a06['length'];if(!_0x16ecb7['query'][_0x2466('0x38')](_0x2466('0x39'))){_0x509146[_0x2466('0x1d')]=qs[_0x2466('0x1d')](_0x16ecb7[_0x2466('0x31')][_0x2466('0x1d')]);_0x509146[_0x2466('0x1c')]=qs[_0x2466('0x1c')](_0x16ecb7[_0x2466('0x31')]['offset']);}return _0x15ac30[_0x2466('0x4b')](_0x509146);}})['then'](function(_0x51aa8b){if(_0x51aa8b){return _0x51aa8b?{'count':_0x504ac0,'rows':_0x51aa8b}:null;}})[_0x2466('0x26')](respondWithResult(_0x61e9be,null))['catch'](handleError(_0x61e9be,null));};exports['addConfiguration']=function(_0x33068a,_0x5f046b,_0x4a1b36){if(_0x33068a[_0x2466('0x49')]['id']){delete _0x33068a['body']['id'];}return db['FreshsalesAccount'][_0x2466('0x4f')]({'where':{'id':_0x33068a[_0x2466('0x46')]['id']}})['then'](handleEntityNotFound(_0x5f046b,null))[_0x2466('0x26')](function(_0x5c7807){if(_0x5c7807){_0x33068a[_0x2466('0x49')][_0x2466('0x50')]=_0x5c7807['id'];_0x33068a[_0x2466('0x49')][_0x2466('0x51')]=integrations[_0x2466('0x52')](_0x33068a['body'][_0x2466('0x53')],_0x33068a[_0x2466('0x49')][_0x2466('0x2f')]);_0x33068a[_0x2466('0x49')]['Descriptions']=integrations[_0x2466('0x54')](_0x33068a[_0x2466('0x49')][_0x2466('0x53')],_0x33068a[_0x2466('0x49')][_0x2466('0x2f')]);return db[_0x2466('0x4c')][_0x2466('0x48')](_0x33068a[_0x2466('0x49')],{'include':[{'model':db[_0x2466('0x55')],'as':_0x2466('0x51')},{'model':db[_0x2466('0x55')],'as':_0x2466('0x56')}]});}return null;})['then'](respondWithResult(_0x5f046b,null))['catch'](handleError(_0x5f046b,null));};exports[_0x2466('0x57')]=function(_0x50e46f,_0x2426d9,_0x5af1ce){var _0x3c3eed='';var _0x518172='';return db[_0x2466('0x41')]['findOne']({'where':{'id':_0x50e46f[_0x2466('0x46')]['id']},'attributes':['id',_0x2466('0x58'),_0x2466('0x59'),'apiKey']})[_0x2466('0x26')](handleEntityNotFound(_0x2426d9,null))[_0x2466('0x26')](function(_0x2acab3){if(_0x2acab3){_0x518172=_0x2acab3[_0x2466('0x58')];_0x3c3eed=_0x2acab3[_0x2466('0x59')];var _0x341bd4=_0x2acab3[_0x2466('0x59')]['slice'](-0x1);if(_0x341bd4==='/'){_0x3c3eed=_0x3c3eed['substring'](0x0,_0x3c3eed[_0x2466('0x5a')](_0x341bd4));}return rp({'method':'GET','uri':util[_0x2466('0x5b')](_0x2466('0x5c'),_0x3c3eed,_0x2466('0x5d')),'headers':{'Authorization':'Token\x20token='+_0x2acab3[_0x2466('0x5e')]},'json':!![]});}})[_0x2466('0x26')](function(_0x463646){if(_0x463646){var _0x5632da=_0x463646[_0x2466('0x5f')];var _0x232bc7=![];var _0x311662=null;for(_0x311662=0x0;_0x311662<_0x5632da[_0x2466('0x4d')];_0x311662++){if(_0x5632da[_0x311662][_0x2466('0x60')]===_0x518172){_0x232bc7=!![];}}if(_0x232bc7){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2466('0x61')});}}})[_0x2466('0x26')](respondWithResult(_0x2426d9,null))[_0x2466('0x45')](function(_0x1d44c7){var _0x99bf77=_0x50e46f[_0x2466('0x31')][_0x2466('0x62')]?0x1f4:_0x1d44c7[_0x2466('0x63')]||0x1f4;logger[_0x2466('0x28')](_0x2466('0x64'),_0x2466('0x57'),_0x99bf77,JSON[_0x2466('0x65')](_0x1d44c7));delete _0x1d44c7[_0x2466('0x29')];if(_0x99bf77===0x191){_0x99bf77=0x190;}_0x2426d9['status'](_0x99bf77)['send'](_0x50e46f['query']['test']?{'message':_0x2466('0x66'),'statusCode':_0x1d44c7[_0x2466('0x63')]}:_0x1d44c7);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 413fc80..6c1396d 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a55=['define','FreshsalesAccount','int_freshsales_accounts','lodash','moment','path','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0x6a55,0xdb));var _0x56a5=function(_0x47de9a,_0x40cf23){_0x47de9a=_0x47de9a-0x0;var _0x4b9d6c=_0x6a55[_0x47de9a];return _0x4b9d6c;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x56a5('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x56a5('0x2'));var rimraf=require('rimraf');var config=require(_0x56a5('0x3'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x56a5('0x4'));module[_0x56a5('0x5')]=function(_0x42d164,_0x293ea1){return _0x42d164[_0x56a5('0x6')](_0x56a5('0x7'),attributes,{'tableName':_0x56a5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c60=['exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','bluebird','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x265b28,_0x138b62){var _0xfe5f31=function(_0xa35006){while(--_0xa35006){_0x265b28['push'](_0x265b28['shift']());}};_0xfe5f31(++_0x138b62);}(_0x4c60,0xc1));var _0x04c6=function(_0x10c62d,_0x355286){_0x10c62d=_0x10c62d-0x0;var _0x403b7f=_0x4c60[_0x10c62d];return _0x403b7f;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('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(_0x04c6('0x5'));var integrations=require(_0x04c6('0x6'));module[_0x04c6('0x7')]=function(_0x12bd5d,_0x2b9041){return _0x12bd5d[_0x04c6('0x8')](_0x04c6('0x9'),attributes,{'tableName':'int_freshsales_accounts','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 f1f110b..a4a1ee5 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 _0x9f0e=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','limit','include','map','model','attributes','ShowFreshsalesAccount','find','where','lodash','util'];(function(_0x75df3d,_0x253316){var _0x1a866d=function(_0x109ebc){while(--_0x109ebc){_0x75df3d['push'](_0x75df3d['shift']());}};_0x1a866d(++_0x253316);}(_0x9f0e,0x116));var _0xe9f0=function(_0x591cb1,_0xc7ebe){_0x591cb1=_0x591cb1-0x0;var _0x262d0a=_0x9f0e[_0x591cb1];return _0x262d0a;};'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')]('FreshsalesAccount,\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);});});}exports[_0xe9f0('0x16')]=function(_0x2ab12b){var _0x3da237=this;return new Promise(function(_0x59bf5a,_0x15a33b){return db[_0xe9f0('0x17')][_0xe9f0('0x18')]({'raw':_0x2ab12b['options']?_0x2ab12b[_0xe9f0('0x19')][_0xe9f0('0x1a')]===undefined?!![]:![]:!![],'where':_0x2ab12b[_0xe9f0('0x19')]?_0x2ab12b[_0xe9f0('0x19')]['where']||null:null,'attributes':_0x2ab12b[_0xe9f0('0x19')]?_0x2ab12b[_0xe9f0('0x19')]['attributes']||null:null,'limit':_0x2ab12b['options']?_0x2ab12b['options'][_0xe9f0('0x1b')]||null:null,'include':_0x2ab12b[_0xe9f0('0x19')]?_0x2ab12b[_0xe9f0('0x19')][_0xe9f0('0x1c')]?_[_0xe9f0('0x1d')](_0x2ab12b['options'][_0xe9f0('0x1c')],function(_0x38b7ee){return{'model':db[_0x38b7ee[_0xe9f0('0x1e')]],'as':_0x38b7ee['as'],'attributes':_0x38b7ee[_0xe9f0('0x1f')],'include':_0x38b7ee[_0xe9f0('0x1c')]?_[_0xe9f0('0x1d')](_0x38b7ee[_0xe9f0('0x1c')],function(_0x1321bb){return{'model':db[_0x1321bb[_0xe9f0('0x1e')]],'as':_0x1321bb['as'],'attributes':_0x1321bb[_0xe9f0('0x1f')],'include':_0x1321bb['include']?_[_0xe9f0('0x1d')](_0x1321bb[_0xe9f0('0x1c')],function(_0x2ddfba){return{'model':db[_0x2ddfba[_0xe9f0('0x1e')]],'as':_0x2ddfba['as'],'attributes':_0x2ddfba['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9f0('0xb')](function(_0x2613fd){logger[_0xe9f0('0xc')](_0xe9f0('0x16'),_0x2ab12b);logger[_0xe9f0('0xf')]('GetFreshsalesAccount',_0x2ab12b,JSON[_0xe9f0('0x11')](_0x2613fd));_0x59bf5a(_0x2613fd);})[_0xe9f0('0x15')](function(_0x44fb5b){logger[_0xe9f0('0x12')](_0xe9f0('0x16'),_0x44fb5b[_0xe9f0('0x13')],_0x2ab12b);_0x15a33b(_0x3da237[_0xe9f0('0x12')](0x1f4,_0x44fb5b[_0xe9f0('0x13')]));});});};exports[_0xe9f0('0x20')]=function(_0x3dbe49){var _0x22806c=this;return new Promise(function(_0x617ad3,_0x445ad0){return db[_0xe9f0('0x17')][_0xe9f0('0x21')]({'raw':_0x3dbe49[_0xe9f0('0x19')]?_0x3dbe49[_0xe9f0('0x19')][_0xe9f0('0x1a')]===undefined?!![]:![]:!![],'where':_0x3dbe49[_0xe9f0('0x19')]?_0x3dbe49[_0xe9f0('0x19')][_0xe9f0('0x22')]||null:null,'attributes':_0x3dbe49[_0xe9f0('0x19')]?_0x3dbe49[_0xe9f0('0x19')][_0xe9f0('0x1f')]||null:null,'include':_0x3dbe49['options']?_0x3dbe49['options']['include']?_[_0xe9f0('0x1d')](_0x3dbe49['options'][_0xe9f0('0x1c')],function(_0xc5fa13){return{'model':db[_0xc5fa13['model']],'as':_0xc5fa13['as'],'attributes':_0xc5fa13[_0xe9f0('0x1f')],'include':_0xc5fa13['include']?_['map'](_0xc5fa13['include'],function(_0x165440){return{'model':db[_0x165440[_0xe9f0('0x1e')]],'as':_0x165440['as'],'attributes':_0x165440['attributes'],'include':_0x165440[_0xe9f0('0x1c')]?_[_0xe9f0('0x1d')](_0x165440[_0xe9f0('0x1c')],function(_0x4d4186){return{'model':db[_0x4d4186['model']],'as':_0x4d4186['as'],'attributes':_0x4d4186[_0xe9f0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe9f0('0xb')](function(_0x1917c8){logger['info'](_0xe9f0('0x20'),_0x3dbe49);logger[_0xe9f0('0xf')](_0xe9f0('0x20'),_0x3dbe49,JSON[_0xe9f0('0x11')](_0x1917c8));_0x617ad3(_0x1917c8);})[_0xe9f0('0x15')](function(_0x552ec2){logger[_0xe9f0('0x12')](_0xe9f0('0x20'),_0x552ec2[_0xe9f0('0x13')],_0x3dbe49);_0x445ad0(_0x22806c['error'](0x1f4,_0x552ec2[_0xe9f0('0x13')]));});});}; \ No newline at end of file +var _0xa46e=['model','attributes','GetFreshsalesAccount','ShowFreshsalesAccount','find','where','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','info','result','catch','FreshsalesAccount','findAll','options','raw','include','map'];(function(_0x566ef2,_0x217324){var _0xd50d4f=function(_0x1523ef){while(--_0x1523ef){_0x566ef2['push'](_0x566ef2['shift']());}};_0xd50d4f(++_0x217324);}(_0xa46e,0x8a));var _0xea46=function(_0x3b2244,_0x54873f){_0x3b2244=_0x3b2244-0x0;var _0x2dcc14=_0xa46e[_0x3b2244];return _0x2dcc14;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var moment=require('moment');var BPromise=require(_0xea46('0x2'));var rs=require(_0xea46('0x3'));var fs=require('fs');var Redis=require(_0xea46('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xea46('0x5'));var logger=require('../../config/logger')(_0xea46('0x6'));var config=require('../../config/environment');var jayson=require(_0xea46('0x7'));var client=jayson['client'][_0xea46('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dc26f,_0x5f1cd1,_0x2d1b30){return new BPromise(function(_0x42771a,_0xe7d428){return client[_0xea46('0x9')](_0x3dc26f,_0x2d1b30)[_0xea46('0xa')](function(_0x4cf206){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'));logger[_0xea46('0xc')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'),JSON[_0xea46('0xd')](_0x4cf206));if(_0x4cf206[_0xea46('0xe')]){if(_0x4cf206['error'][_0xea46('0xf')]===0x1f4){logger[_0xea46('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0xe7d428(_0x4cf206['error'][_0xea46('0x10')]);}logger['error'](_0xea46('0x11'),_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0x42771a(_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);}else{logger[_0xea46('0x12')](_0xea46('0x11'),_0x5f1cd1,_0xea46('0xb'));_0x42771a(_0x4cf206[_0xea46('0x13')]['message']);}})[_0xea46('0x14')](function(_0xbf225e){logger[_0xea46('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x5f1cd1,_0xbf225e);_0xe7d428(_0xbf225e);});});}exports['GetFreshsalesAccount']=function(_0x19d5c1){var _0x3f463d=this;return new Promise(function(_0x5cf5dd,_0x4b6745){return db[_0xea46('0x15')][_0xea46('0x16')]({'raw':_0x19d5c1['options']?_0x19d5c1[_0xea46('0x17')][_0xea46('0x18')]===undefined?!![]:![]:!![],'where':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1[_0xea46('0x17')]['where']||null:null,'attributes':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1['options']['attributes']||null:null,'limit':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1['options']['limit']||null:null,'include':_0x19d5c1['options']?_0x19d5c1[_0xea46('0x17')][_0xea46('0x19')]?_[_0xea46('0x1a')](_0x19d5c1['options'][_0xea46('0x19')],function(_0x59b10d){return{'model':db[_0x59b10d[_0xea46('0x1b')]],'as':_0x59b10d['as'],'attributes':_0x59b10d[_0xea46('0x1c')],'include':_0x59b10d['include']?_[_0xea46('0x1a')](_0x59b10d['include'],function(_0x2b3a8f){return{'model':db[_0x2b3a8f[_0xea46('0x1b')]],'as':_0x2b3a8f['as'],'attributes':_0x2b3a8f[_0xea46('0x1c')],'include':_0x2b3a8f['include']?_['map'](_0x2b3a8f[_0xea46('0x19')],function(_0x38ac07){return{'model':db[_0x38ac07['model']],'as':_0x38ac07['as'],'attributes':_0x38ac07[_0xea46('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11129d){logger['info'](_0xea46('0x1d'),_0x19d5c1);logger[_0xea46('0xc')](_0xea46('0x1d'),_0x19d5c1,JSON[_0xea46('0xd')](_0x11129d));_0x5cf5dd(_0x11129d);})[_0xea46('0x14')](function(_0x174345){logger['error'](_0xea46('0x1d'),_0x174345[_0xea46('0x10')],_0x19d5c1);_0x4b6745(_0x3f463d[_0xea46('0xe')](0x1f4,_0x174345['message']));});});};exports[_0xea46('0x1e')]=function(_0x3cdf96){var _0x38d631=this;return new Promise(function(_0x5a0fc0,_0x4a0635){return db['FreshsalesAccount'][_0xea46('0x1f')]({'raw':_0x3cdf96[_0xea46('0x17')]?_0x3cdf96[_0xea46('0x17')][_0xea46('0x18')]===undefined?!![]:![]:!![],'where':_0x3cdf96[_0xea46('0x17')]?_0x3cdf96[_0xea46('0x17')][_0xea46('0x20')]||null:null,'attributes':_0x3cdf96[_0xea46('0x17')]?_0x3cdf96[_0xea46('0x17')][_0xea46('0x1c')]||null:null,'include':_0x3cdf96[_0xea46('0x17')]?_0x3cdf96['options'][_0xea46('0x19')]?_[_0xea46('0x1a')](_0x3cdf96[_0xea46('0x17')][_0xea46('0x19')],function(_0x1472c0){return{'model':db[_0x1472c0[_0xea46('0x1b')]],'as':_0x1472c0['as'],'attributes':_0x1472c0[_0xea46('0x1c')],'include':_0x1472c0['include']?_[_0xea46('0x1a')](_0x1472c0[_0xea46('0x19')],function(_0x388449){return{'model':db[_0x388449[_0xea46('0x1b')]],'as':_0x388449['as'],'attributes':_0x388449[_0xea46('0x1c')],'include':_0x388449['include']?_['map'](_0x388449[_0xea46('0x19')],function(_0x343499){return{'model':db[_0x343499['model']],'as':_0x343499['as'],'attributes':_0x343499[_0xea46('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xea46('0xa')](function(_0x123aae){logger[_0xea46('0x12')]('ShowFreshsalesAccount',_0x3cdf96);logger['debug'](_0xea46('0x1e'),_0x3cdf96,JSON['stringify'](_0x123aae));_0x5a0fc0(_0x123aae);})[_0xea46('0x14')](function(_0xdec374){logger['error'](_0xea46('0x1e'),_0xdec374[_0xea46('0x10')],_0x3cdf96);_0x4a0635(_0x38d631['error'](0x1f4,_0xdec374[_0xea46('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index f892c9e..b56bb5f 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 _0xb894=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x2ebfee,_0x50d69a){var _0x2ff48=function(_0x3925a4){while(--_0x3925a4){_0x2ebfee['push'](_0x2ebfee['shift']());}};_0x2ff48(++_0x50d69a);}(_0xb894,0x91));var _0x4b89=function(_0x314431,_0x1de15b){_0x314431=_0x314431-0x0;var _0x83c3cf=_0xb894[_0x314431];return _0x83c3cf;};'use strict';var multer=require(_0x4b89('0x0'));var util=require(_0x4b89('0x1'));var path=require(_0x4b89('0x2'));var timeout=require(_0x4b89('0x3'));var express=require('express');var router=express[_0x4b89('0x4')]();var fs_extra=require(_0x4b89('0x5'));var auth=require(_0x4b89('0x6'));var interaction=require(_0x4b89('0x7'));var config=require(_0x4b89('0x8'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x4b89('0x9')]('/',auth[_0x4b89('0xa')](),controller['index']);router[_0x4b89('0x9')]('/:id',auth[_0x4b89('0xa')](),controller[_0x4b89('0xb')]);router[_0x4b89('0x9')](_0x4b89('0xc'),auth['isAuthenticated'](),controller[_0x4b89('0xd')]);router['get'](_0x4b89('0xe'),auth['isAuthenticated'](),controller[_0x4b89('0xf')]);router['get'](_0x4b89('0x10'),auth['isAuthenticated'](),controller[_0x4b89('0x11')]);router['post']('/',auth[_0x4b89('0xa')](),controller[_0x4b89('0x12')]);router[_0x4b89('0x13')](_0x4b89('0x14'),auth[_0x4b89('0xa')](),controller[_0x4b89('0x15')]);router[_0x4b89('0x16')](_0x4b89('0x14'),auth[_0x4b89('0xa')](),controller[_0x4b89('0x17')]);module[_0x4b89('0x18')]=router; \ No newline at end of file +var _0xf741=['isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xf741,0x1b0));var _0x1f74=function(_0x127c8e,_0x855936){_0x127c8e=_0x127c8e-0x0;var _0x52d845=_0xf741[_0x127c8e];return _0x52d845;};'use strict';var multer=require(_0x1f74('0x0'));var util=require(_0x1f74('0x1'));var path=require('path');var timeout=require(_0x1f74('0x2'));var express=require(_0x1f74('0x3'));var router=express[_0x1f74('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1f74('0x5'));var interaction=require(_0x1f74('0x6'));var config=require(_0x1f74('0x7'));var controller=require(_0x1f74('0x8'));router[_0x1f74('0x9')]('/',auth[_0x1f74('0xa')](),controller[_0x1f74('0xb')]);router['get'](_0x1f74('0xc'),auth['isAuthenticated'](),controller[_0x1f74('0xd')]);router[_0x1f74('0x9')](_0x1f74('0xe'),auth[_0x1f74('0xa')](),controller[_0x1f74('0xf')]);router[_0x1f74('0x9')](_0x1f74('0x10'),auth[_0x1f74('0xa')](),controller[_0x1f74('0x11')]);router[_0x1f74('0x9')](_0x1f74('0x12'),auth[_0x1f74('0xa')](),controller['getFields']);router[_0x1f74('0x13')]('/',auth['isAuthenticated'](),controller[_0x1f74('0x14')]);router[_0x1f74('0x15')](_0x1f74('0xc'),auth[_0x1f74('0xa')](),controller[_0x1f74('0x16')]);router[_0x1f74('0x17')](_0x1f74('0xc'),auth[_0x1f74('0xa')](),controller[_0x1f74('0x18')]);module[_0x1f74('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 7527387..df380fc 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 _0x1703=['STRING','sequelize','exports'];(function(_0x3217d3,_0xf66fcf){var _0x260f43=function(_0x2b4a34){while(--_0x2b4a34){_0x3217d3['push'](_0x3217d3['shift']());}};_0x260f43(++_0xf66fcf);}(_0x1703,0x163));var _0x3170=function(_0x2e544a,_0x301d95){_0x2e544a=_0x2e544a-0x0;var _0x4c627a=_0x1703[_0x2e544a];return _0x4c627a;};'use strict';var Sequelize=require(_0x3170('0x0'));module[_0x3170('0x1')]={'name':{'type':Sequelize[_0x3170('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3eaf=['exports','STRING','sequelize'];(function(_0x8dc2f5,_0x4c2245){var _0x4ca261=function(_0x7c9076){while(--_0x7c9076){_0x8dc2f5['push'](_0x8dc2f5['shift']());}};_0x4ca261(++_0x4c2245);}(_0x3eaf,0x155));var _0xf3ea=function(_0xe0b10b,_0xf88ba9){_0xe0b10b=_0xe0b10b-0x0;var _0x229d04=_0x3eaf[_0xe0b10b];return _0x229d04;};'use strict';var Sequelize=require(_0xf3ea('0x0'));module[_0xf3ea('0x1')]={'name':{'type':Sequelize[_0xf3ea('0x2')]},'description':{'type':Sequelize[_0xf3ea('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 02fe4ad..b520ef8 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 _0x0175=['count','set','apply','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','query','keys','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','filters','filter','type','merge','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','getSubjects','findOne','FreshsalesField','pick','options','nolimit','getDescriptions','getFields','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x17ed56,_0x18b11e){var _0x20517e=function(_0x21b89c){while(--_0x21b89c){_0x17ed56['push'](_0x17ed56['shift']());}};_0x20517e(++_0x18b11e);}(_0x0175,0x110));var _0x5017=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x0175[_0x4e9d3c];return _0x2d0825;};'use strict';var emlformat=require(_0x5017('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5017('0x1'));var rp=require(_0x5017('0x2'));var moment=require(_0x5017('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5017('0x4'));var util=require('util');var path=require(_0x5017('0x5'));var sox=require(_0x5017('0x6'));var csv=require(_0x5017('0x7'));var ejs=require(_0x5017('0x8'));var fs=require('fs');var fs_extra=require(_0x5017('0x9'));var _=require(_0x5017('0xa'));var squel=require(_0x5017('0xb'));var crypto=require(_0x5017('0xc'));var jsforce=require(_0x5017('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5017('0x7'));var querystring=require(_0x5017('0xe'));var Papa=require(_0x5017('0xf'));var Redis=require('ioredis');var authService=require(_0x5017('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5017('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5017('0x12'));var config=require(_0x5017('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5017('0x14'))['db'];function respondWithStatusCode(_0x55066a,_0x4449cd){_0x4449cd=_0x4449cd||0xcc;return function(_0x3c125d){if(_0x3c125d){return _0x55066a[_0x5017('0x15')](_0x4449cd);}return _0x55066a[_0x5017('0x16')](_0x4449cd)[_0x5017('0x17')]();};}function respondWithResult(_0xee15b,_0x3bde92){_0x3bde92=_0x3bde92||0xc8;return function(_0x168878){if(_0x168878){return _0xee15b['status'](_0x3bde92)[_0x5017('0x18')](_0x168878);}};}function respondWithFilteredResult(_0x341f03,_0x492bc8){return function(_0x5ca722){if(_0x5ca722){var _0x5a74f1=typeof _0x492bc8[_0x5017('0x19')]===_0x5017('0x1a')&&typeof _0x492bc8[_0x5017('0x1b')]===_0x5017('0x1a');var _0x53b1d1=_0x5ca722[_0x5017('0x1c')];var _0x379b12=_0x5a74f1?0x0:_0x492bc8['offset'];var _0x3af41a=_0x5a74f1?_0x5ca722[_0x5017('0x1c')]:_0x492bc8['offset']+_0x492bc8[_0x5017('0x1b')];var _0x25e229;if(_0x3af41a>=_0x53b1d1){_0x3af41a=_0x53b1d1;_0x25e229=0xc8;}else{_0x25e229=0xce;}_0x341f03[_0x5017('0x16')](_0x25e229);return _0x341f03[_0x5017('0x1d')]('Content-Range',_0x379b12+'-'+_0x3af41a+'/'+_0x53b1d1)[_0x5017('0x18')](_0x5ca722);}return null;};}function patchUpdates(_0x3dd003){return function(_0xac9be0){try{jsonpatch[_0x5017('0x1e')](_0xac9be0,_0x3dd003,!![]);}catch(_0x49016e){return BPromise['reject'](_0x49016e);}return _0xac9be0[_0x5017('0x1f')]();};}function saveUpdates(_0x2801fb,_0x42d7ed){return function(_0x5106fb){if(_0x5106fb){return _0x5106fb[_0x5017('0x20')](_0x2801fb)[_0x5017('0x21')](function(_0x11424a){return _0x11424a;});}return null;};}function removeEntity(_0x3723df,_0x210cfd){return function(_0x456d0b){if(_0x456d0b){return _0x456d0b[_0x5017('0x22')]()[_0x5017('0x21')](function(){_0x3723df[_0x5017('0x16')](0xcc)[_0x5017('0x17')]();});}};}function handleEntityNotFound(_0xc9fc8a,_0x27ce2c){return function(_0x59616c){if(!_0x59616c){_0xc9fc8a[_0x5017('0x15')](0x194);}return _0x59616c;};}function handleError(_0x2641cf,_0x245944){_0x245944=_0x245944||0x1f4;return function(_0x2f2bab){logger[_0x5017('0x23')](_0x2f2bab['stack']);if(_0x2f2bab['name']){delete _0x2f2bab[_0x5017('0x24')];}_0x2641cf[_0x5017('0x16')](_0x245944)[_0x5017('0x25')](_0x2f2bab);};}exports['index']=function(_0x1d0ee7,_0x40fbaa){var _0x276e92={},_0x5acc19={},_0x31bbcf={'count':0x0,'rows':[]};var _0x98a49b=_[_0x5017('0x26')](db['FreshsalesConfiguration'][_0x5017('0x27')],function(_0x594b0d){return{'name':_0x594b0d[_0x5017('0x28')],'type':_0x594b0d['type']['key']};});_0x5acc19['model']=_['map'](_0x98a49b,_0x5017('0x24'));_0x5acc19[_0x5017('0x29')]=_[_0x5017('0x2a')](_0x1d0ee7[_0x5017('0x29')]);_0x5acc19['filters']=_[_0x5017('0x2b')](_0x5acc19[_0x5017('0x2c')],_0x5acc19[_0x5017('0x29')]);_0x276e92['attributes']=_['intersection'](_0x5acc19[_0x5017('0x2c')],qs[_0x5017('0x2d')](_0x1d0ee7[_0x5017('0x29')][_0x5017('0x2d')]));_0x276e92['attributes']=_0x276e92[_0x5017('0x2e')]['length']?_0x276e92[_0x5017('0x2e')]:_0x5acc19['model'];if(!_0x1d0ee7[_0x5017('0x29')][_0x5017('0x2f')]('nolimit')){_0x276e92[_0x5017('0x1b')]=qs[_0x5017('0x1b')](_0x1d0ee7[_0x5017('0x29')][_0x5017('0x1b')]);_0x276e92[_0x5017('0x19')]=qs[_0x5017('0x19')](_0x1d0ee7[_0x5017('0x29')][_0x5017('0x19')]);}_0x276e92[_0x5017('0x30')]=qs[_0x5017('0x31')](_0x1d0ee7[_0x5017('0x29')]['sort']);_0x276e92[_0x5017('0x32')]=qs[_0x5017('0x33')](_['pick'](_0x1d0ee7[_0x5017('0x29')],_0x5acc19['filters']),_0x98a49b);if(_0x1d0ee7[_0x5017('0x29')][_0x5017('0x34')]){_0x276e92[_0x5017('0x32')]=_['merge'](_0x276e92[_0x5017('0x32')],{'$or':_[_0x5017('0x26')](_0x98a49b,function(_0x404fb3){if(_0x404fb3[_0x5017('0x35')]!=='VIRTUAL'){var _0x1eabc3={};_0x1eabc3[_0x404fb3['name']]={'$like':'%'+_0x1d0ee7[_0x5017('0x29')][_0x5017('0x34')]+'%'};return _0x1eabc3;}})});}_0x276e92=_[_0x5017('0x36')]({},_0x276e92,_0x1d0ee7['options']);var _0x1ed959={'where':_0x276e92[_0x5017('0x32')]};return db[_0x5017('0x37')]['count'](_0x1ed959)['then'](function(_0x5416be){_0x31bbcf[_0x5017('0x1c')]=_0x5416be;if(_0x1d0ee7['query'][_0x5017('0x38')]){_0x276e92[_0x5017('0x39')]=[{'all':!![]}];}return db[_0x5017('0x37')][_0x5017('0x3a')](_0x276e92);})[_0x5017('0x21')](function(_0xa8be8){_0x31bbcf[_0x5017('0x3b')]=_0xa8be8;return _0x31bbcf;})[_0x5017('0x21')](respondWithFilteredResult(_0x40fbaa,_0x276e92))[_0x5017('0x3c')](handleError(_0x40fbaa,null));};exports[_0x5017('0x3d')]=function(_0x2e1664,_0x6bda2d){var _0x34b4dc={'raw':![],'where':{'id':_0x2e1664[_0x5017('0x3e')]['id']}},_0x38eb30={};_0x38eb30[_0x5017('0x2c')]=_[_0x5017('0x2a')](db['FreshsalesConfiguration'][_0x5017('0x27')]);_0x38eb30[_0x5017('0x29')]=_[_0x5017('0x2a')](_0x2e1664['query']);_0x38eb30[_0x5017('0x33')]=_['intersection'](_0x38eb30['model'],_0x38eb30[_0x5017('0x29')]);_0x34b4dc['attributes']=_[_0x5017('0x2b')](_0x38eb30[_0x5017('0x2c')],qs[_0x5017('0x2d')](_0x2e1664[_0x5017('0x29')][_0x5017('0x2d')]));_0x34b4dc['attributes']=_0x34b4dc[_0x5017('0x2e')][_0x5017('0x3f')]?_0x34b4dc['attributes']:_0x38eb30['model'];if(_0x2e1664['query'][_0x5017('0x38')]){_0x34b4dc[_0x5017('0x39')]=[{'all':!![]}];}_0x34b4dc=_['merge']({},_0x34b4dc,_0x2e1664['options']);return db['FreshsalesConfiguration']['find'](_0x34b4dc)[_0x5017('0x21')](handleEntityNotFound(_0x6bda2d,null))[_0x5017('0x21')](respondWithResult(_0x6bda2d,null))[_0x5017('0x3c')](handleError(_0x6bda2d,null));};exports[_0x5017('0x40')]=function(_0x5c4793,_0x57e499){return db[_0x5017('0x37')][_0x5017('0x40')](_0x5c4793['body'],{})[_0x5017('0x21')](respondWithResult(_0x57e499,0xc9))['catch'](handleError(_0x57e499,null));};exports[_0x5017('0x20')]=function(_0x2d0843,_0x4c96d0){if(_0x2d0843[_0x5017('0x41')]['id']){delete _0x2d0843[_0x5017('0x41')]['id'];}return db['FreshsalesConfiguration'][_0x5017('0x42')]({'where':{'id':_0x2d0843[_0x5017('0x3e')]['id']}})[_0x5017('0x21')](handleEntityNotFound(_0x4c96d0,null))[_0x5017('0x21')](saveUpdates(_0x2d0843[_0x5017('0x41')],null))['then'](respondWithResult(_0x4c96d0,null))[_0x5017('0x3c')](handleError(_0x4c96d0,null));};exports[_0x5017('0x22')]=function(_0x2ba6ad,_0x52b53d){return db[_0x5017('0x37')][_0x5017('0x42')]({'where':{'id':_0x2ba6ad[_0x5017('0x3e')]['id']}})['then'](handleEntityNotFound(_0x52b53d,null))[_0x5017('0x21')](removeEntity(_0x52b53d,null))[_0x5017('0x3c')](handleError(_0x52b53d,null));};exports[_0x5017('0x43')]=function(_0x5a64a9,_0xd2f9e3,_0x253ea0){var _0x4a1575={};var _0xf6cf12={};var _0x279b4d;var _0x4771bb;return db[_0x5017('0x37')][_0x5017('0x44')]({'where':{'id':_0x5a64a9[_0x5017('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd2f9e3,null))[_0x5017('0x21')](function(_0x4aa6ff){if(_0x4aa6ff){_0x279b4d=_0x4aa6ff;_0xf6cf12[_0x5017('0x2c')]=_['keys'](db[_0x5017('0x45')][_0x5017('0x27')]);_0xf6cf12[_0x5017('0x29')]=_[_0x5017('0x2a')](_0x5a64a9[_0x5017('0x29')]);_0xf6cf12[_0x5017('0x33')]=_[_0x5017('0x2b')](_0xf6cf12[_0x5017('0x2c')],_0xf6cf12[_0x5017('0x29')]);_0x4a1575['attributes']=_['intersection'](_0xf6cf12[_0x5017('0x2c')],qs[_0x5017('0x2d')](_0x5a64a9[_0x5017('0x29')]['fields']));_0x4a1575[_0x5017('0x2e')]=_0x4a1575[_0x5017('0x2e')][_0x5017('0x3f')]?_0x4a1575[_0x5017('0x2e')]:_0xf6cf12[_0x5017('0x2c')];_0x4a1575[_0x5017('0x30')]=qs[_0x5017('0x31')](_0x5a64a9[_0x5017('0x29')][_0x5017('0x31')]);_0x4a1575[_0x5017('0x32')]=qs[_0x5017('0x33')](_[_0x5017('0x46')](_0x5a64a9[_0x5017('0x29')],_0xf6cf12['filters']));if(_0x5a64a9[_0x5017('0x29')][_0x5017('0x34')]){_0x4a1575[_0x5017('0x32')]=_[_0x5017('0x36')](_0x4a1575[_0x5017('0x32')],{'$or':_[_0x5017('0x26')](_0x4a1575['attributes'],function(_0x379e4e){var _0x2f79f8={};_0x2f79f8[_0x379e4e]={'$like':'%'+_0x5a64a9[_0x5017('0x29')][_0x5017('0x34')]+'%'};return _0x2f79f8;})});}_0x4a1575=_[_0x5017('0x36')]({},_0x4a1575,_0x5a64a9[_0x5017('0x47')]);return _0x279b4d[_0x5017('0x43')](_0x4a1575);}})['then'](function(_0x20c019){if(_0x20c019){_0x4771bb=_0x20c019[_0x5017('0x3f')];if(!_0x5a64a9[_0x5017('0x29')]['hasOwnProperty'](_0x5017('0x48'))){_0x4a1575[_0x5017('0x1b')]=qs[_0x5017('0x1b')](_0x5a64a9[_0x5017('0x29')][_0x5017('0x1b')]);_0x4a1575[_0x5017('0x19')]=qs[_0x5017('0x19')](_0x5a64a9[_0x5017('0x29')][_0x5017('0x19')]);}return _0x279b4d[_0x5017('0x43')](_0x4a1575);}})['then'](function(_0x253b2f){if(_0x253b2f){return _0x253b2f?{'count':_0x4771bb,'rows':_0x253b2f}:null;}})[_0x5017('0x21')](respondWithResult(_0xd2f9e3,null))[_0x5017('0x3c')](handleError(_0xd2f9e3,null));};exports['getDescriptions']=function(_0xf73cd3,_0x118303,_0x6d41c6){var _0x56f379={};var _0x4e5c62={};var _0x4bcaac;var _0xd05a9a;return db[_0x5017('0x37')]['findOne']({'where':{'id':_0xf73cd3[_0x5017('0x3e')]['id']}})[_0x5017('0x21')](handleEntityNotFound(_0x118303,null))[_0x5017('0x21')](function(_0x56ef30){if(_0x56ef30){_0x4bcaac=_0x56ef30;_0x4e5c62[_0x5017('0x2c')]=_['keys'](db[_0x5017('0x45')]['rawAttributes']);_0x4e5c62[_0x5017('0x29')]=_['keys'](_0xf73cd3[_0x5017('0x29')]);_0x4e5c62[_0x5017('0x33')]=_[_0x5017('0x2b')](_0x4e5c62[_0x5017('0x2c')],_0x4e5c62[_0x5017('0x29')]);_0x56f379[_0x5017('0x2e')]=_[_0x5017('0x2b')](_0x4e5c62[_0x5017('0x2c')],qs[_0x5017('0x2d')](_0xf73cd3[_0x5017('0x29')]['fields']));_0x56f379[_0x5017('0x2e')]=_0x56f379['attributes'][_0x5017('0x3f')]?_0x56f379[_0x5017('0x2e')]:_0x4e5c62[_0x5017('0x2c')];_0x56f379['order']=qs[_0x5017('0x31')](_0xf73cd3['query'][_0x5017('0x31')]);_0x56f379[_0x5017('0x32')]=qs[_0x5017('0x33')](_[_0x5017('0x46')](_0xf73cd3[_0x5017('0x29')],_0x4e5c62[_0x5017('0x33')]));if(_0xf73cd3[_0x5017('0x29')][_0x5017('0x34')]){_0x56f379[_0x5017('0x32')]=_['merge'](_0x56f379[_0x5017('0x32')],{'$or':_[_0x5017('0x26')](_0x56f379[_0x5017('0x2e')],function(_0x26b26e){var _0x329b5b={};_0x329b5b[_0x26b26e]={'$like':'%'+_0xf73cd3['query'][_0x5017('0x34')]+'%'};return _0x329b5b;})});}_0x56f379=_[_0x5017('0x36')]({},_0x56f379,_0xf73cd3[_0x5017('0x47')]);return _0x4bcaac['getDescriptions'](_0x56f379);}})['then'](function(_0x2d6d6c){if(_0x2d6d6c){_0xd05a9a=_0x2d6d6c['length'];if(!_0xf73cd3[_0x5017('0x29')]['hasOwnProperty']('nolimit')){_0x56f379['limit']=qs['limit'](_0xf73cd3[_0x5017('0x29')][_0x5017('0x1b')]);_0x56f379[_0x5017('0x19')]=qs[_0x5017('0x19')](_0xf73cd3[_0x5017('0x29')]['offset']);}return _0x4bcaac[_0x5017('0x49')](_0x56f379);}})[_0x5017('0x21')](function(_0x30027f){if(_0x30027f){return _0x30027f?{'count':_0xd05a9a,'rows':_0x30027f}:null;}})[_0x5017('0x21')](respondWithResult(_0x118303,null))[_0x5017('0x3c')](handleError(_0x118303,null));};exports[_0x5017('0x4a')]=function(_0x22867c,_0x1c2402,_0x2fa2ea){var _0x4f8061={};var _0x861731={};var _0x28d813;var _0x2e3e1b;return db['FreshsalesConfiguration'][_0x5017('0x44')]({'where':{'id':_0x22867c[_0x5017('0x3e')]['id']}})[_0x5017('0x21')](handleEntityNotFound(_0x1c2402,null))[_0x5017('0x21')](function(_0x2007b2){if(_0x2007b2){_0x28d813=_0x2007b2;_0x861731[_0x5017('0x2c')]=_['keys'](db[_0x5017('0x45')]['rawAttributes']);_0x861731[_0x5017('0x29')]=_[_0x5017('0x2a')](_0x22867c['query']);_0x861731[_0x5017('0x33')]=_['intersection'](_0x861731[_0x5017('0x2c')],_0x861731[_0x5017('0x29')]);_0x4f8061[_0x5017('0x2e')]=_[_0x5017('0x2b')](_0x861731['model'],qs[_0x5017('0x2d')](_0x22867c[_0x5017('0x29')][_0x5017('0x2d')]));_0x4f8061[_0x5017('0x2e')]=_0x4f8061[_0x5017('0x2e')]['length']?_0x4f8061[_0x5017('0x2e')]:_0x861731['model'];_0x4f8061[_0x5017('0x30')]=qs['sort'](_0x22867c[_0x5017('0x29')][_0x5017('0x31')]);_0x4f8061[_0x5017('0x32')]=qs[_0x5017('0x33')](_['pick'](_0x22867c['query'],_0x861731[_0x5017('0x33')]));if(_0x22867c[_0x5017('0x29')][_0x5017('0x34')]){_0x4f8061[_0x5017('0x32')]=_['merge'](_0x4f8061['where'],{'$or':_[_0x5017('0x26')](_0x4f8061[_0x5017('0x2e')],function(_0xaa3dd6){var _0x4696c5={};_0x4696c5[_0xaa3dd6]={'$like':'%'+_0x22867c[_0x5017('0x29')][_0x5017('0x34')]+'%'};return _0x4696c5;})});}_0x4f8061=_['merge']({},_0x4f8061,_0x22867c[_0x5017('0x47')]);return _0x28d813[_0x5017('0x4a')](_0x4f8061);}})[_0x5017('0x21')](function(_0x13a550){if(_0x13a550){_0x2e3e1b=_0x13a550[_0x5017('0x3f')];if(!_0x22867c[_0x5017('0x29')][_0x5017('0x2f')]('nolimit')){_0x4f8061[_0x5017('0x1b')]=qs['limit'](_0x22867c['query'][_0x5017('0x1b')]);_0x4f8061[_0x5017('0x19')]=qs[_0x5017('0x19')](_0x22867c[_0x5017('0x29')][_0x5017('0x19')]);}return _0x28d813[_0x5017('0x4a')](_0x4f8061);}})[_0x5017('0x21')](function(_0x1faf89){if(_0x1faf89){return _0x1faf89?{'count':_0x2e3e1b,'rows':_0x1faf89}:null;}})[_0x5017('0x21')](respondWithResult(_0x1c2402,null))['catch'](handleError(_0x1c2402,null));}; \ No newline at end of file +var _0x6dbe=['mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','save','then','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','findAll','rows','catch','show','params','length','includeAll','include','options','find','create','body','update','getSubjects','findOne','FreshsalesField','getDescriptions','pick','getFields','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x189076,_0x2edb0d){var _0x412014=function(_0x53fe0b){while(--_0x53fe0b){_0x189076['push'](_0x189076['shift']());}};_0x412014(++_0x2edb0d);}(_0x6dbe,0xa2));var _0xe6db=function(_0x23072b,_0x93d490){_0x23072b=_0x23072b-0x0;var _0x402583=_0x6dbe[_0x23072b];return _0x402583;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe6db('0x0'));var zipdir=require(_0xe6db('0x1'));var jsonpatch=require(_0xe6db('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe6db('0x3'));var Mustache=require(_0xe6db('0x4'));var util=require(_0xe6db('0x5'));var path=require('path');var sox=require(_0xe6db('0x6'));var csv=require(_0xe6db('0x7'));var ejs=require(_0xe6db('0x8'));var fs=require('fs');var fs_extra=require(_0xe6db('0x9'));var _=require('lodash');var squel=require(_0xe6db('0xa'));var crypto=require(_0xe6db('0xb'));var jsforce=require(_0xe6db('0xc'));var deskjs=require(_0xe6db('0xd'));var toCsv=require(_0xe6db('0x7'));var querystring=require(_0xe6db('0xe'));var Papa=require(_0xe6db('0xf'));var Redis=require(_0xe6db('0x10'));var authService=require(_0xe6db('0x11'));var qs=require(_0xe6db('0x12'));var as=require(_0xe6db('0x13'));var hardwareService=require(_0xe6db('0x14'));var logger=require(_0xe6db('0x15'))(_0xe6db('0x16'));var utils=require(_0xe6db('0x17'));var config=require(_0xe6db('0x18'));var licenseUtil=require(_0xe6db('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa86b40,_0x580d11){_0x580d11=_0x580d11||0xcc;return function(_0x5e7d56){if(_0x5e7d56){return _0xa86b40[_0xe6db('0x1a')](_0x580d11);}return _0xa86b40[_0xe6db('0x1b')](_0x580d11)[_0xe6db('0x1c')]();};}function respondWithResult(_0x1a6f67,_0x1ebdae){_0x1ebdae=_0x1ebdae||0xc8;return function(_0x10bdad){if(_0x10bdad){return _0x1a6f67[_0xe6db('0x1b')](_0x1ebdae)[_0xe6db('0x1d')](_0x10bdad);}};}function respondWithFilteredResult(_0x4488fe,_0x174991){return function(_0x2c877f){if(_0x2c877f){var _0x24a8db=typeof _0x174991['offset']===_0xe6db('0x1e')&&typeof _0x174991['limit']==='undefined';var _0x486e2c=_0x2c877f[_0xe6db('0x1f')];var _0x2298bc=_0x24a8db?0x0:_0x174991['offset'];var _0x173cc8=_0x24a8db?_0x2c877f[_0xe6db('0x1f')]:_0x174991[_0xe6db('0x20')]+_0x174991['limit'];var _0x2e3245;if(_0x173cc8>=_0x486e2c){_0x173cc8=_0x486e2c;_0x2e3245=0xc8;}else{_0x2e3245=0xce;}_0x4488fe[_0xe6db('0x1b')](_0x2e3245);return _0x4488fe[_0xe6db('0x21')](_0xe6db('0x22'),_0x2298bc+'-'+_0x173cc8+'/'+_0x486e2c)[_0xe6db('0x1d')](_0x2c877f);}return null;};}function patchUpdates(_0x2f543a){return function(_0x48e27d){try{jsonpatch['apply'](_0x48e27d,_0x2f543a,!![]);}catch(_0x4af2dc){return BPromise[_0xe6db('0x23')](_0x4af2dc);}return _0x48e27d[_0xe6db('0x24')]();};}function saveUpdates(_0x2a1315,_0x5846fe){return function(_0x3b3ad0){if(_0x3b3ad0){return _0x3b3ad0['update'](_0x2a1315)[_0xe6db('0x25')](function(_0x48a5e6){return _0x48a5e6;});}return null;};}function removeEntity(_0x1ed211,_0x5d7610){return function(_0x3d76f0){if(_0x3d76f0){return _0x3d76f0['destroy']()[_0xe6db('0x25')](function(){_0x1ed211[_0xe6db('0x1b')](0xcc)[_0xe6db('0x1c')]();});}};}function handleEntityNotFound(_0x38464c,_0x4bb4e0){return function(_0x4103f4){if(!_0x4103f4){_0x38464c['sendStatus'](0x194);}return _0x4103f4;};}function handleError(_0x3b93f6,_0x35381d){_0x35381d=_0x35381d||0x1f4;return function(_0x5b8804){logger[_0xe6db('0x26')](_0x5b8804[_0xe6db('0x27')]);if(_0x5b8804[_0xe6db('0x28')]){delete _0x5b8804[_0xe6db('0x28')];}_0x3b93f6[_0xe6db('0x1b')](_0x35381d)[_0xe6db('0x29')](_0x5b8804);};}exports[_0xe6db('0x2a')]=function(_0x51d5f5,_0x22d419){var _0x2869d6={},_0x50b146={},_0x26c2de={'count':0x0,'rows':[]};var _0x3cd3b9=_[_0xe6db('0x2b')](db[_0xe6db('0x2c')][_0xe6db('0x2d')],function(_0x17d597){return{'name':_0x17d597[_0xe6db('0x2e')],'type':_0x17d597['type'][_0xe6db('0x2f')]};});_0x50b146[_0xe6db('0x30')]=_[_0xe6db('0x2b')](_0x3cd3b9,'name');_0x50b146[_0xe6db('0x31')]=_[_0xe6db('0x32')](_0x51d5f5[_0xe6db('0x31')]);_0x50b146[_0xe6db('0x33')]=_[_0xe6db('0x34')](_0x50b146[_0xe6db('0x30')],_0x50b146['query']);_0x2869d6[_0xe6db('0x35')]=_['intersection'](_0x50b146[_0xe6db('0x30')],qs[_0xe6db('0x36')](_0x51d5f5['query'][_0xe6db('0x36')]));_0x2869d6[_0xe6db('0x35')]=_0x2869d6[_0xe6db('0x35')]['length']?_0x2869d6['attributes']:_0x50b146[_0xe6db('0x30')];if(!_0x51d5f5['query'][_0xe6db('0x37')](_0xe6db('0x38'))){_0x2869d6['limit']=qs[_0xe6db('0x39')](_0x51d5f5['query'][_0xe6db('0x39')]);_0x2869d6[_0xe6db('0x20')]=qs[_0xe6db('0x20')](_0x51d5f5[_0xe6db('0x31')][_0xe6db('0x20')]);}_0x2869d6[_0xe6db('0x3a')]=qs[_0xe6db('0x3b')](_0x51d5f5[_0xe6db('0x31')][_0xe6db('0x3b')]);_0x2869d6[_0xe6db('0x3c')]=qs[_0xe6db('0x33')](_['pick'](_0x51d5f5[_0xe6db('0x31')],_0x50b146[_0xe6db('0x33')]),_0x3cd3b9);if(_0x51d5f5[_0xe6db('0x31')][_0xe6db('0x3d')]){_0x2869d6['where']=_[_0xe6db('0x3e')](_0x2869d6[_0xe6db('0x3c')],{'$or':_['map'](_0x3cd3b9,function(_0x2647bf){if(_0x2647bf[_0xe6db('0x3f')]!=='VIRTUAL'){var _0x53443e={};_0x53443e[_0x2647bf[_0xe6db('0x28')]]={'$like':'%'+_0x51d5f5[_0xe6db('0x31')][_0xe6db('0x3d')]+'%'};return _0x53443e;}})});}_0x2869d6=_[_0xe6db('0x3e')]({},_0x2869d6,_0x51d5f5['options']);var _0x513d20={'where':_0x2869d6[_0xe6db('0x3c')]};return db['FreshsalesConfiguration'][_0xe6db('0x1f')](_0x513d20)[_0xe6db('0x25')](function(_0x529a98){_0x26c2de[_0xe6db('0x1f')]=_0x529a98;if(_0x51d5f5[_0xe6db('0x31')]['includeAll']){_0x2869d6['include']=[{'all':!![]}];}return db[_0xe6db('0x2c')][_0xe6db('0x40')](_0x2869d6);})[_0xe6db('0x25')](function(_0x574d25){_0x26c2de[_0xe6db('0x41')]=_0x574d25;return _0x26c2de;})[_0xe6db('0x25')](respondWithFilteredResult(_0x22d419,_0x2869d6))[_0xe6db('0x42')](handleError(_0x22d419,null));};exports[_0xe6db('0x43')]=function(_0x1cbfd0,_0x4275d1){var _0xe1b2e6={'raw':![],'where':{'id':_0x1cbfd0[_0xe6db('0x44')]['id']}},_0x59a8da={};_0x59a8da['model']=_[_0xe6db('0x32')](db['FreshsalesConfiguration'][_0xe6db('0x2d')]);_0x59a8da[_0xe6db('0x31')]=_['keys'](_0x1cbfd0['query']);_0x59a8da[_0xe6db('0x33')]=_[_0xe6db('0x34')](_0x59a8da[_0xe6db('0x30')],_0x59a8da[_0xe6db('0x31')]);_0xe1b2e6['attributes']=_[_0xe6db('0x34')](_0x59a8da[_0xe6db('0x30')],qs['fields'](_0x1cbfd0[_0xe6db('0x31')]['fields']));_0xe1b2e6['attributes']=_0xe1b2e6[_0xe6db('0x35')][_0xe6db('0x45')]?_0xe1b2e6[_0xe6db('0x35')]:_0x59a8da[_0xe6db('0x30')];if(_0x1cbfd0['query'][_0xe6db('0x46')]){_0xe1b2e6[_0xe6db('0x47')]=[{'all':!![]}];}_0xe1b2e6=_[_0xe6db('0x3e')]({},_0xe1b2e6,_0x1cbfd0[_0xe6db('0x48')]);return db[_0xe6db('0x2c')][_0xe6db('0x49')](_0xe1b2e6)['then'](handleEntityNotFound(_0x4275d1,null))['then'](respondWithResult(_0x4275d1,null))['catch'](handleError(_0x4275d1,null));};exports['create']=function(_0x118618,_0x315103){return db[_0xe6db('0x2c')][_0xe6db('0x4a')](_0x118618[_0xe6db('0x4b')],{})[_0xe6db('0x25')](respondWithResult(_0x315103,0xc9))[_0xe6db('0x42')](handleError(_0x315103,null));};exports[_0xe6db('0x4c')]=function(_0x183d13,_0x5570fd){if(_0x183d13['body']['id']){delete _0x183d13[_0xe6db('0x4b')]['id'];}return db[_0xe6db('0x2c')]['find']({'where':{'id':_0x183d13[_0xe6db('0x44')]['id']}})[_0xe6db('0x25')](handleEntityNotFound(_0x5570fd,null))['then'](saveUpdates(_0x183d13[_0xe6db('0x4b')],null))[_0xe6db('0x25')](respondWithResult(_0x5570fd,null))[_0xe6db('0x42')](handleError(_0x5570fd,null));};exports['destroy']=function(_0x59cbe6,_0xd72525){return db[_0xe6db('0x2c')][_0xe6db('0x49')]({'where':{'id':_0x59cbe6['params']['id']}})[_0xe6db('0x25')](handleEntityNotFound(_0xd72525,null))[_0xe6db('0x25')](removeEntity(_0xd72525,null))[_0xe6db('0x42')](handleError(_0xd72525,null));};exports[_0xe6db('0x4d')]=function(_0x2959bf,_0x23def8,_0x4e1a30){var _0x13f1fe={};var _0x3da3fd={};var _0x1eb416;var _0x339554;return db[_0xe6db('0x2c')][_0xe6db('0x4e')]({'where':{'id':_0x2959bf['params']['id']}})[_0xe6db('0x25')](handleEntityNotFound(_0x23def8,null))[_0xe6db('0x25')](function(_0x326b4e){if(_0x326b4e){_0x1eb416=_0x326b4e;_0x3da3fd[_0xe6db('0x30')]=_[_0xe6db('0x32')](db[_0xe6db('0x4f')][_0xe6db('0x2d')]);_0x3da3fd[_0xe6db('0x31')]=_['keys'](_0x2959bf[_0xe6db('0x31')]);_0x3da3fd[_0xe6db('0x33')]=_[_0xe6db('0x34')](_0x3da3fd[_0xe6db('0x30')],_0x3da3fd[_0xe6db('0x31')]);_0x13f1fe[_0xe6db('0x35')]=_[_0xe6db('0x34')](_0x3da3fd['model'],qs['fields'](_0x2959bf['query']['fields']));_0x13f1fe['attributes']=_0x13f1fe[_0xe6db('0x35')][_0xe6db('0x45')]?_0x13f1fe[_0xe6db('0x35')]:_0x3da3fd[_0xe6db('0x30')];_0x13f1fe[_0xe6db('0x3a')]=qs[_0xe6db('0x3b')](_0x2959bf['query'][_0xe6db('0x3b')]);_0x13f1fe[_0xe6db('0x3c')]=qs[_0xe6db('0x33')](_['pick'](_0x2959bf[_0xe6db('0x31')],_0x3da3fd[_0xe6db('0x33')]));if(_0x2959bf['query']['filter']){_0x13f1fe[_0xe6db('0x3c')]=_[_0xe6db('0x3e')](_0x13f1fe[_0xe6db('0x3c')],{'$or':_[_0xe6db('0x2b')](_0x13f1fe['attributes'],function(_0x287cf9){var _0xd5d579={};_0xd5d579[_0x287cf9]={'$like':'%'+_0x2959bf[_0xe6db('0x31')][_0xe6db('0x3d')]+'%'};return _0xd5d579;})});}_0x13f1fe=_[_0xe6db('0x3e')]({},_0x13f1fe,_0x2959bf[_0xe6db('0x48')]);return _0x1eb416[_0xe6db('0x4d')](_0x13f1fe);}})[_0xe6db('0x25')](function(_0x4e628f){if(_0x4e628f){_0x339554=_0x4e628f[_0xe6db('0x45')];if(!_0x2959bf[_0xe6db('0x31')]['hasOwnProperty'](_0xe6db('0x38'))){_0x13f1fe[_0xe6db('0x39')]=qs['limit'](_0x2959bf[_0xe6db('0x31')]['limit']);_0x13f1fe[_0xe6db('0x20')]=qs[_0xe6db('0x20')](_0x2959bf[_0xe6db('0x31')][_0xe6db('0x20')]);}return _0x1eb416[_0xe6db('0x4d')](_0x13f1fe);}})['then'](function(_0x34fd25){if(_0x34fd25){return _0x34fd25?{'count':_0x339554,'rows':_0x34fd25}:null;}})[_0xe6db('0x25')](respondWithResult(_0x23def8,null))[_0xe6db('0x42')](handleError(_0x23def8,null));};exports[_0xe6db('0x50')]=function(_0x15a623,_0xb2a6e4,_0xd5b0d){var _0x25338c={};var _0x120e09={};var _0x5318e4;var _0x1bcfe5;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x15a623[_0xe6db('0x44')]['id']}})[_0xe6db('0x25')](handleEntityNotFound(_0xb2a6e4,null))['then'](function(_0x43bc9d){if(_0x43bc9d){_0x5318e4=_0x43bc9d;_0x120e09[_0xe6db('0x30')]=_[_0xe6db('0x32')](db[_0xe6db('0x4f')][_0xe6db('0x2d')]);_0x120e09['query']=_[_0xe6db('0x32')](_0x15a623[_0xe6db('0x31')]);_0x120e09['filters']=_[_0xe6db('0x34')](_0x120e09[_0xe6db('0x30')],_0x120e09[_0xe6db('0x31')]);_0x25338c['attributes']=_[_0xe6db('0x34')](_0x120e09[_0xe6db('0x30')],qs[_0xe6db('0x36')](_0x15a623[_0xe6db('0x31')][_0xe6db('0x36')]));_0x25338c[_0xe6db('0x35')]=_0x25338c[_0xe6db('0x35')][_0xe6db('0x45')]?_0x25338c['attributes']:_0x120e09[_0xe6db('0x30')];_0x25338c[_0xe6db('0x3a')]=qs['sort'](_0x15a623[_0xe6db('0x31')][_0xe6db('0x3b')]);_0x25338c['where']=qs[_0xe6db('0x33')](_[_0xe6db('0x51')](_0x15a623[_0xe6db('0x31')],_0x120e09[_0xe6db('0x33')]));if(_0x15a623['query'][_0xe6db('0x3d')]){_0x25338c['where']=_[_0xe6db('0x3e')](_0x25338c[_0xe6db('0x3c')],{'$or':_[_0xe6db('0x2b')](_0x25338c[_0xe6db('0x35')],function(_0x1635a6){var _0x76bf11={};_0x76bf11[_0x1635a6]={'$like':'%'+_0x15a623[_0xe6db('0x31')][_0xe6db('0x3d')]+'%'};return _0x76bf11;})});}_0x25338c=_[_0xe6db('0x3e')]({},_0x25338c,_0x15a623[_0xe6db('0x48')]);return _0x5318e4['getDescriptions'](_0x25338c);}})[_0xe6db('0x25')](function(_0x35f576){if(_0x35f576){_0x1bcfe5=_0x35f576[_0xe6db('0x45')];if(!_0x15a623[_0xe6db('0x31')][_0xe6db('0x37')](_0xe6db('0x38'))){_0x25338c[_0xe6db('0x39')]=qs['limit'](_0x15a623[_0xe6db('0x31')]['limit']);_0x25338c[_0xe6db('0x20')]=qs[_0xe6db('0x20')](_0x15a623[_0xe6db('0x31')][_0xe6db('0x20')]);}return _0x5318e4[_0xe6db('0x50')](_0x25338c);}})[_0xe6db('0x25')](function(_0x5a5685){if(_0x5a5685){return _0x5a5685?{'count':_0x1bcfe5,'rows':_0x5a5685}:null;}})[_0xe6db('0x25')](respondWithResult(_0xb2a6e4,null))[_0xe6db('0x42')](handleError(_0xb2a6e4,null));};exports[_0xe6db('0x52')]=function(_0x131d67,_0x2a5cb6,_0x1244d1){var _0x34b85f={};var _0x39ec1a={};var _0x39db9d;var _0x1a9e1d;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x131d67['params']['id']}})[_0xe6db('0x25')](handleEntityNotFound(_0x2a5cb6,null))[_0xe6db('0x25')](function(_0x518f3c){if(_0x518f3c){_0x39db9d=_0x518f3c;_0x39ec1a[_0xe6db('0x30')]=_[_0xe6db('0x32')](db[_0xe6db('0x4f')][_0xe6db('0x2d')]);_0x39ec1a[_0xe6db('0x31')]=_[_0xe6db('0x32')](_0x131d67['query']);_0x39ec1a[_0xe6db('0x33')]=_[_0xe6db('0x34')](_0x39ec1a[_0xe6db('0x30')],_0x39ec1a[_0xe6db('0x31')]);_0x34b85f['attributes']=_['intersection'](_0x39ec1a[_0xe6db('0x30')],qs[_0xe6db('0x36')](_0x131d67[_0xe6db('0x31')][_0xe6db('0x36')]));_0x34b85f[_0xe6db('0x35')]=_0x34b85f['attributes']['length']?_0x34b85f['attributes']:_0x39ec1a[_0xe6db('0x30')];_0x34b85f[_0xe6db('0x3a')]=qs[_0xe6db('0x3b')](_0x131d67['query'][_0xe6db('0x3b')]);_0x34b85f[_0xe6db('0x3c')]=qs[_0xe6db('0x33')](_[_0xe6db('0x51')](_0x131d67['query'],_0x39ec1a['filters']));if(_0x131d67[_0xe6db('0x31')]['filter']){_0x34b85f[_0xe6db('0x3c')]=_['merge'](_0x34b85f['where'],{'$or':_[_0xe6db('0x2b')](_0x34b85f[_0xe6db('0x35')],function(_0x42a90a){var _0x2550b8={};_0x2550b8[_0x42a90a]={'$like':'%'+_0x131d67[_0xe6db('0x31')]['filter']+'%'};return _0x2550b8;})});}_0x34b85f=_[_0xe6db('0x3e')]({},_0x34b85f,_0x131d67['options']);return _0x39db9d[_0xe6db('0x52')](_0x34b85f);}})['then'](function(_0x106b13){if(_0x106b13){_0x1a9e1d=_0x106b13[_0xe6db('0x45')];if(!_0x131d67['query']['hasOwnProperty'](_0xe6db('0x38'))){_0x34b85f[_0xe6db('0x39')]=qs[_0xe6db('0x39')](_0x131d67[_0xe6db('0x31')][_0xe6db('0x39')]);_0x34b85f[_0xe6db('0x20')]=qs['offset'](_0x131d67[_0xe6db('0x31')]['offset']);}return _0x39db9d['getFields'](_0x34b85f);}})[_0xe6db('0x25')](function(_0x78a8a9){if(_0x78a8a9){return _0x78a8a9?{'count':_0x1a9e1d,'rows':_0x78a8a9}:null;}})['then'](respondWithResult(_0x2a5cb6,null))['catch'](handleError(_0x2a5cb6,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 9605663..94bde7c 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 _0x874d=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x574690,_0x31d173){var _0x4231ae=function(_0x2527c3){while(--_0x2527c3){_0x574690['push'](_0x574690['shift']());}};_0x4231ae(++_0x31d173);}(_0x874d,0x1ef));var _0xd874=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0x874d[_0x295314];return _0x584b0c;};'use strict';var _=require('lodash');var util=require(_0xd874('0x0'));var logger=require(_0xd874('0x1'))(_0xd874('0x2'));var moment=require(_0xd874('0x3'));var BPromise=require('bluebird');var rp=require(_0xd874('0x4'));var fs=require('fs');var path=require(_0xd874('0x5'));var rimraf=require('rimraf');var config=require(_0xd874('0x6'));var attributes=require(_0xd874('0x7'));module[_0xd874('0x8')]=function(_0x32c7e8,_0x194cbc){return _0x32c7e8[_0xd874('0x9')](_0xd874('0xa'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1d0=['FreshsalesConfiguration','util','api','moment','bluebird','./intFreshsalesConfiguration.attributes','exports','define'];(function(_0x218a8e,_0x3c3f79){var _0x2e8309=function(_0x2e7cf2){while(--_0x2e7cf2){_0x218a8e['push'](_0x218a8e['shift']());}};_0x2e8309(++_0x3c3f79);}(_0xe1d0,0x149));var _0x0e1d=function(_0x4df695,_0x2511a5){_0x4df695=_0x4df695-0x0;var _0x376fc9=_0xe1d0[_0x4df695];return _0x376fc9;};'use strict';var _=require('lodash');var util=require(_0x0e1d('0x0'));var logger=require('../../config/logger')(_0x0e1d('0x1'));var moment=require(_0x0e1d('0x2'));var BPromise=require(_0x0e1d('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(_0x0e1d('0x4'));module[_0x0e1d('0x5')]=function(_0x2671c4,_0x2e5cfd){return _0x2671c4[_0x0e1d('0x6')](_0x0e1d('0x7'),attributes,{'tableName':'int_freshsales_configurations','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 e952724..1c0e27d 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 _0x9fc2=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x467ae1,_0x191cc0){var _0x10fb79=function(_0x522e31){while(--_0x522e31){_0x467ae1['push'](_0x467ae1['shift']());}};_0x10fb79(++_0x191cc0);}(_0x9fc2,0x11a));var _0x29fc=function(_0x4ac04d,_0x3afda5){_0x4ac04d=_0x4ac04d-0x0;var _0x4c3c04=_0x9fc2[_0x4ac04d];return _0x4c3c04;};'use strict';var _=require(_0x29fc('0x0'));var util=require(_0x29fc('0x1'));var moment=require(_0x29fc('0x2'));var BPromise=require(_0x29fc('0x3'));var rs=require(_0x29fc('0x4'));var fs=require('fs');var Redis=require(_0x29fc('0x5'));var db=require(_0x29fc('0x6'))['db'];var utils=require(_0x29fc('0x7'));var logger=require(_0x29fc('0x8'))(_0x29fc('0x9'));var config=require('../../config/environment');var jayson=require(_0x29fc('0xa'));var client=jayson[_0x29fc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41cb72,_0x16bdc8,_0x360234){return new BPromise(function(_0x20497c,_0x178a12){return client[_0x29fc('0xc')](_0x41cb72,_0x360234)['then'](function(_0x3a2fba){logger[_0x29fc('0xd')](_0x29fc('0xe'),_0x16bdc8,_0x29fc('0xf'));logger[_0x29fc('0x10')](_0x29fc('0x11'),_0x16bdc8,'request\x20sent',JSON[_0x29fc('0x12')](_0x3a2fba));if(_0x3a2fba[_0x29fc('0x13')]){if(_0x3a2fba[_0x29fc('0x13')][_0x29fc('0x14')]===0x1f4){logger[_0x29fc('0x13')](_0x29fc('0xe'),_0x16bdc8,_0x3a2fba['error'][_0x29fc('0x15')]);return _0x178a12(_0x3a2fba[_0x29fc('0x13')][_0x29fc('0x15')]);}logger[_0x29fc('0x13')](_0x29fc('0xe'),_0x16bdc8,_0x3a2fba[_0x29fc('0x13')][_0x29fc('0x15')]);return _0x20497c(_0x3a2fba[_0x29fc('0x13')][_0x29fc('0x15')]);}else{logger[_0x29fc('0xd')](_0x29fc('0xe'),_0x16bdc8,_0x29fc('0xf'));_0x20497c(_0x3a2fba[_0x29fc('0x16')]['message']);}})[_0x29fc('0x17')](function(_0x4d2118){logger[_0x29fc('0x13')](_0x29fc('0xe'),_0x16bdc8,_0x4d2118);_0x178a12(_0x4d2118);});});} \ No newline at end of file +var _0xba21=['info','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request'];(function(_0x22cc80,_0x327b9d){var _0xb88d7a=function(_0x269bdc){while(--_0x269bdc){_0x22cc80['push'](_0x22cc80['shift']());}};_0xb88d7a(++_0x327b9d);}(_0xba21,0xbc));var _0x1ba2=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xba21[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x1ba2('0x0'));var util=require(_0x1ba2('0x1'));var moment=require(_0x1ba2('0x2'));var BPromise=require(_0x1ba2('0x3'));var rs=require(_0x1ba2('0x4'));var fs=require('fs');var Redis=require(_0x1ba2('0x5'));var db=require(_0x1ba2('0x6'))['db'];var utils=require(_0x1ba2('0x7'));var logger=require(_0x1ba2('0x8'))(_0x1ba2('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ba2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36deb2,_0x2c0ed4,_0x242e4e){return new BPromise(function(_0x360485,_0x1d7af1){return client[_0x1ba2('0xb')](_0x36deb2,_0x242e4e)['then'](function(_0xae7287){logger[_0x1ba2('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2c0ed4,'request\x20sent');logger[_0x1ba2('0xd')](_0x1ba2('0xe'),_0x2c0ed4,_0x1ba2('0xf'),JSON['stringify'](_0xae7287));if(_0xae7287['error']){if(_0xae7287[_0x1ba2('0x10')][_0x1ba2('0x11')]===0x1f4){logger[_0x1ba2('0x10')](_0x1ba2('0x12'),_0x2c0ed4,_0xae7287[_0x1ba2('0x10')]['message']);return _0x1d7af1(_0xae7287[_0x1ba2('0x10')][_0x1ba2('0x13')]);}logger[_0x1ba2('0x10')](_0x1ba2('0x12'),_0x2c0ed4,_0xae7287['error'][_0x1ba2('0x13')]);return _0x360485(_0xae7287[_0x1ba2('0x10')][_0x1ba2('0x13')]);}else{logger[_0x1ba2('0xc')](_0x1ba2('0x12'),_0x2c0ed4,_0x1ba2('0xf'));_0x360485(_0xae7287['result'][_0x1ba2('0x13')]);}})['catch'](function(_0x3b1b1b){logger[_0x1ba2('0x10')](_0x1ba2('0x12'),_0x2c0ed4,_0x3b1b1b);_0x1d7af1(_0x3b1b1b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 414dd8f..4a66150 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 _0x2f68=['create','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post'];(function(_0x410cd6,_0x329be5){var _0x559a64=function(_0x1d5bdd){while(--_0x1d5bdd){_0x410cd6['push'](_0x410cd6['shift']());}};_0x559a64(++_0x329be5);}(_0x2f68,0x9a));var _0x82f6=function(_0xc50580,_0x34041b){_0xc50580=_0xc50580-0x0;var _0xec67a9=_0x2f68[_0xc50580];return _0xec67a9;};'use strict';var multer=require('multer');var util=require(_0x82f6('0x0'));var path=require(_0x82f6('0x1'));var timeout=require(_0x82f6('0x2'));var express=require(_0x82f6('0x3'));var router=express['Router']();var fs_extra=require(_0x82f6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x82f6('0x5'));var config=require(_0x82f6('0x6'));var controller=require('./intFreshsalesField.controller');router[_0x82f6('0x7')]('/',auth[_0x82f6('0x8')](),controller['index']);router['get'](_0x82f6('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x82f6('0xa')]('/',auth[_0x82f6('0x8')](),controller[_0x82f6('0xb')]);router['put'](_0x82f6('0x9'),auth[_0x82f6('0x8')](),controller['update']);router[_0x82f6('0xc')](_0x82f6('0x9'),auth[_0x82f6('0x8')](),controller[_0x82f6('0xd')]);module[_0x82f6('0xe')]=router; \ No newline at end of file +var _0x3d9c=['destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','create','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d9c,0x134));var _0xc3d9=function(_0x13a7a4,_0x565bf0){_0x13a7a4=_0x13a7a4-0x0;var _0x2020fa=_0x3d9c[_0x13a7a4];return _0x2020fa;};'use strict';var multer=require(_0xc3d9('0x0'));var util=require('util');var path=require(_0xc3d9('0x1'));var timeout=require(_0xc3d9('0x2'));var express=require(_0xc3d9('0x3'));var router=express['Router']();var fs_extra=require(_0xc3d9('0x4'));var auth=require(_0xc3d9('0x5'));var interaction=require(_0xc3d9('0x6'));var config=require(_0xc3d9('0x7'));var controller=require(_0xc3d9('0x8'));router[_0xc3d9('0x9')]('/',auth[_0xc3d9('0xa')](),controller['index']);router[_0xc3d9('0x9')](_0xc3d9('0xb'),auth['isAuthenticated'](),controller[_0xc3d9('0xc')]);router['post']('/',auth[_0xc3d9('0xa')](),controller[_0xc3d9('0xd')]);router[_0xc3d9('0xe')]('/:id',auth[_0xc3d9('0xa')](),controller[_0xc3d9('0xf')]);router['delete'](_0xc3d9('0xb'),auth[_0xc3d9('0xa')](),controller[_0xc3d9('0x10')]);module[_0xc3d9('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 8473a1c..2f4d3aa 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 _0xfeee=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x5b0bc9,_0x32ea85){var _0xc11292=function(_0xa6ff97){while(--_0xa6ff97){_0x5b0bc9['push'](_0x5b0bc9['shift']());}};_0xc11292(++_0x32ea85);}(_0xfeee,0xbb));var _0xefee=function(_0x43ecc2,_0x109c8e){_0x43ecc2=_0x43ecc2-0x0;var _0x3490ed=_0xfeee[_0x43ecc2];return _0x3490ed;};'use strict';var Sequelize=require(_0xefee('0x0'));module[_0xefee('0x1')]={'type':{'type':Sequelize[_0xefee('0x2')](_0xefee('0x3'),_0xefee('0x4'),_0xefee('0x5'),_0xefee('0x6'),_0xefee('0x7')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xefee('0x8')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xefee('0x5'))},'keyContent':{'type':Sequelize[_0xefee('0x8')]},'idField':{'type':Sequelize[_0xefee('0x8')]},'nameField':{'type':Sequelize[_0xefee('0x8')]},'customField':{'type':Sequelize[_0xefee('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xefee('0x8')]}}; \ No newline at end of file +var _0x0c4e=['STRING','customVariable','BOOLEAN','sequelize','ENUM','string','variable','keyValue','picklist'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c4e,0xc0));var _0xe0c4=function(_0x512693,_0x72811e){_0x512693=_0x512693-0x0;var _0x4020d0=_0x0c4e[_0x512693];return _0x4020d0;};'use strict';var Sequelize=require(_0xe0c4('0x0'));module['exports']={'type':{'type':Sequelize[_0xe0c4('0x1')](_0xe0c4('0x2'),_0xe0c4('0x3'),'customVariable',_0xe0c4('0x4'),_0xe0c4('0x5')),'defaultValue':_0xe0c4('0x2')},'content':{'type':Sequelize[_0xe0c4('0x6')]},'key':{'type':Sequelize[_0xe0c4('0x6')]},'keyType':{'type':Sequelize[_0xe0c4('0x1')](_0xe0c4('0x2'),_0xe0c4('0x3'),_0xe0c4('0x7'))},'keyContent':{'type':Sequelize[_0xe0c4('0x6')]},'idField':{'type':Sequelize[_0xe0c4('0x6')]},'nameField':{'type':Sequelize[_0xe0c4('0x6')]},'customField':{'type':Sequelize[_0xe0c4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe0c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 09de154..0398884 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 _0x50f7=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','error','stack','name','send','index','FreshsalesField','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','include','findAll','rows','show','includeAll','options','catch','create','body','find','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring'];(function(_0x3b67fe,_0x3307a8){var _0x3ee0ae=function(_0x93188f){while(--_0x93188f){_0x3b67fe['push'](_0x3b67fe['shift']());}};_0x3ee0ae(++_0x3307a8);}(_0x50f7,0x124));var _0x750f=function(_0x5f0ce8,_0x2d02e4){_0x5f0ce8=_0x5f0ce8-0x0;var _0x33f448=_0x50f7[_0x5f0ce8];return _0x33f448;};'use strict';var emlformat=require(_0x750f('0x0'));var rimraf=require(_0x750f('0x1'));var zipdir=require(_0x750f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x750f('0x3'));var moment=require('moment');var BPromise=require(_0x750f('0x4'));var Mustache=require(_0x750f('0x5'));var util=require(_0x750f('0x6'));var path=require(_0x750f('0x7'));var sox=require(_0x750f('0x8'));var csv=require(_0x750f('0x9'));var ejs=require(_0x750f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x750f('0xb'));var squel=require(_0x750f('0xc'));var crypto=require(_0x750f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x750f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x750f('0xf'));var Papa=require(_0x750f('0x10'));var Redis=require(_0x750f('0x11'));var authService=require(_0x750f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x750f('0x13'));var hardwareService=require(_0x750f('0x14'));var logger=require(_0x750f('0x15'))('api');var utils=require(_0x750f('0x16'));var config=require(_0x750f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x750f('0x18'))['db'];function respondWithStatusCode(_0x5718f7,_0x37635a){_0x37635a=_0x37635a||0xcc;return function(_0x1cd972){if(_0x1cd972){return _0x5718f7[_0x750f('0x19')](_0x37635a);}return _0x5718f7[_0x750f('0x1a')](_0x37635a)[_0x750f('0x1b')]();};}function respondWithResult(_0x1f61a5,_0x3b4942){_0x3b4942=_0x3b4942||0xc8;return function(_0x86d773){if(_0x86d773){return _0x1f61a5['status'](_0x3b4942)[_0x750f('0x1c')](_0x86d773);}};}function respondWithFilteredResult(_0x4232c1,_0x593c46){return function(_0x4708ae){if(_0x4708ae){var _0x1aeaec=typeof _0x593c46[_0x750f('0x1d')]===_0x750f('0x1e')&&typeof _0x593c46[_0x750f('0x1f')]===_0x750f('0x1e');var _0x4d247a=_0x4708ae[_0x750f('0x20')];var _0x66c9c=_0x1aeaec?0x0:_0x593c46['offset'];var _0x3c3fda=_0x1aeaec?_0x4708ae['count']:_0x593c46[_0x750f('0x1d')]+_0x593c46[_0x750f('0x1f')];var _0x4c8a1b;if(_0x3c3fda>=_0x4d247a){_0x3c3fda=_0x4d247a;_0x4c8a1b=0xc8;}else{_0x4c8a1b=0xce;}_0x4232c1[_0x750f('0x1a')](_0x4c8a1b);return _0x4232c1['set'](_0x750f('0x21'),_0x66c9c+'-'+_0x3c3fda+'/'+_0x4d247a)['json'](_0x4708ae);}return null;};}function patchUpdates(_0x2dddbd){return function(_0x3ffdbb){try{jsonpatch['apply'](_0x3ffdbb,_0x2dddbd,!![]);}catch(_0x134324){return BPromise[_0x750f('0x22')](_0x134324);}return _0x3ffdbb[_0x750f('0x23')]();};}function saveUpdates(_0x15bead,_0x28b92f){return function(_0x2bfdfb){if(_0x2bfdfb){return _0x2bfdfb[_0x750f('0x24')](_0x15bead)['then'](function(_0x2c3965){return _0x2c3965;});}return null;};}function removeEntity(_0x30d15b,_0x3e7427){return function(_0x1517b7){if(_0x1517b7){return _0x1517b7['destroy']()[_0x750f('0x25')](function(){_0x30d15b['status'](0xcc)[_0x750f('0x1b')]();});}};}function handleEntityNotFound(_0x3ab5e6,_0x1e8cdf){return function(_0x3a47a6){if(!_0x3a47a6){_0x3ab5e6[_0x750f('0x19')](0x194);}return _0x3a47a6;};}function handleError(_0x47d894,_0x5b2f3c){_0x5b2f3c=_0x5b2f3c||0x1f4;return function(_0x59c1e3){logger[_0x750f('0x26')](_0x59c1e3[_0x750f('0x27')]);if(_0x59c1e3[_0x750f('0x28')]){delete _0x59c1e3[_0x750f('0x28')];}_0x47d894[_0x750f('0x1a')](_0x5b2f3c)[_0x750f('0x29')](_0x59c1e3);};}exports[_0x750f('0x2a')]=function(_0x497a2f,_0x337bea){var _0x290096={},_0x3c39de={},_0x206133={'count':0x0,'rows':[]};var _0x544440=_['map'](db[_0x750f('0x2b')][_0x750f('0x2c')],function(_0xfa4142){return{'name':_0xfa4142[_0x750f('0x2d')],'type':_0xfa4142[_0x750f('0x2e')][_0x750f('0x2f')]};});_0x3c39de[_0x750f('0x30')]=_[_0x750f('0x31')](_0x544440,'name');_0x3c39de[_0x750f('0x32')]=_[_0x750f('0x33')](_0x497a2f[_0x750f('0x32')]);_0x3c39de['filters']=_['intersection'](_0x3c39de[_0x750f('0x30')],_0x3c39de[_0x750f('0x32')]);_0x290096[_0x750f('0x34')]=_[_0x750f('0x35')](_0x3c39de[_0x750f('0x30')],qs[_0x750f('0x36')](_0x497a2f[_0x750f('0x32')][_0x750f('0x36')]));_0x290096[_0x750f('0x34')]=_0x290096[_0x750f('0x34')][_0x750f('0x37')]?_0x290096[_0x750f('0x34')]:_0x3c39de[_0x750f('0x30')];if(!_0x497a2f[_0x750f('0x32')][_0x750f('0x38')](_0x750f('0x39'))){_0x290096[_0x750f('0x1f')]=qs[_0x750f('0x1f')](_0x497a2f[_0x750f('0x32')]['limit']);_0x290096[_0x750f('0x1d')]=qs[_0x750f('0x1d')](_0x497a2f[_0x750f('0x32')][_0x750f('0x1d')]);}_0x290096[_0x750f('0x3a')]=qs[_0x750f('0x3b')](_0x497a2f[_0x750f('0x32')][_0x750f('0x3b')]);_0x290096[_0x750f('0x3c')]=qs['filters'](_[_0x750f('0x3d')](_0x497a2f[_0x750f('0x32')],_0x3c39de[_0x750f('0x3e')]),_0x544440);if(_0x497a2f['query'][_0x750f('0x3f')]){_0x290096[_0x750f('0x3c')]=_[_0x750f('0x40')](_0x290096[_0x750f('0x3c')],{'$or':_['map'](_0x544440,function(_0x5d98d9){if(_0x5d98d9[_0x750f('0x2e')]!==_0x750f('0x41')){var _0x304a73={};_0x304a73[_0x5d98d9[_0x750f('0x28')]]={'$like':'%'+_0x497a2f[_0x750f('0x32')][_0x750f('0x3f')]+'%'};return _0x304a73;}})});}_0x290096=_['merge']({},_0x290096,_0x497a2f['options']);var _0x2f3a12={'where':_0x290096['where']};return db['FreshsalesField'][_0x750f('0x20')](_0x2f3a12)[_0x750f('0x25')](function(_0xa7f2e4){_0x206133[_0x750f('0x20')]=_0xa7f2e4;if(_0x497a2f[_0x750f('0x32')]['includeAll']){_0x290096[_0x750f('0x42')]=[{'all':!![]}];}return db[_0x750f('0x2b')][_0x750f('0x43')](_0x290096);})[_0x750f('0x25')](function(_0x50dd43){_0x206133[_0x750f('0x44')]=_0x50dd43;return _0x206133;})[_0x750f('0x25')](respondWithFilteredResult(_0x337bea,_0x290096))['catch'](handleError(_0x337bea,null));};exports[_0x750f('0x45')]=function(_0x532168,_0x29f0d5){var _0x1fd444={'raw':!![],'where':{'id':_0x532168['params']['id']}},_0x362460={};_0x362460['model']=_[_0x750f('0x33')](db['FreshsalesField']['rawAttributes']);_0x362460['query']=_['keys'](_0x532168['query']);_0x362460[_0x750f('0x3e')]=_['intersection'](_0x362460[_0x750f('0x30')],_0x362460[_0x750f('0x32')]);_0x1fd444[_0x750f('0x34')]=_['intersection'](_0x362460[_0x750f('0x30')],qs['fields'](_0x532168[_0x750f('0x32')][_0x750f('0x36')]));_0x1fd444[_0x750f('0x34')]=_0x1fd444[_0x750f('0x34')][_0x750f('0x37')]?_0x1fd444['attributes']:_0x362460[_0x750f('0x30')];if(_0x532168[_0x750f('0x32')][_0x750f('0x46')]){_0x1fd444['include']=[{'all':!![]}];}_0x1fd444=_['merge']({},_0x1fd444,_0x532168[_0x750f('0x47')]);return db[_0x750f('0x2b')]['find'](_0x1fd444)[_0x750f('0x25')](handleEntityNotFound(_0x29f0d5,null))[_0x750f('0x25')](respondWithResult(_0x29f0d5,null))[_0x750f('0x48')](handleError(_0x29f0d5,null));};exports[_0x750f('0x49')]=function(_0x29ddf6,_0x5a3ff5){return db['FreshsalesField'][_0x750f('0x49')](_0x29ddf6[_0x750f('0x4a')],{})['then'](respondWithResult(_0x5a3ff5,0xc9))['catch'](handleError(_0x5a3ff5,null));};exports[_0x750f('0x24')]=function(_0x36d359,_0x5af7cb){if(_0x36d359[_0x750f('0x4a')]['id']){delete _0x36d359[_0x750f('0x4a')]['id'];}return db[_0x750f('0x2b')][_0x750f('0x4b')]({'where':{'id':_0x36d359[_0x750f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5af7cb,null))['then'](saveUpdates(_0x36d359[_0x750f('0x4a')],null))['then'](respondWithResult(_0x5af7cb,null))['catch'](handleError(_0x5af7cb,null));};exports['destroy']=function(_0x2e1bdc,_0x53ba92){return db[_0x750f('0x2b')]['find']({'where':{'id':_0x2e1bdc[_0x750f('0x4c')]['id']}})[_0x750f('0x25')](handleEntityNotFound(_0x53ba92,null))[_0x750f('0x25')](removeEntity(_0x53ba92,null))[_0x750f('0x48')](handleError(_0x53ba92,null));}; \ No newline at end of file +var _0x4ddc=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','map','FreshsalesField','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','length','find','catch','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x16b829,_0x6d861a){var _0xc8613b=function(_0x2f1416){while(--_0x2f1416){_0x16b829['push'](_0x16b829['shift']());}};_0xc8613b(++_0x6d861a);}(_0x4ddc,0x15c));var _0xc4dd=function(_0x316cef,_0x271591){_0x316cef=_0x316cef-0x0;var _0xa3ff61=_0x4ddc[_0x316cef];return _0xa3ff61;};'use strict';var emlformat=require(_0xc4dd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc4dd('0x1'));var jsonpatch=require(_0xc4dd('0x2'));var rp=require(_0xc4dd('0x3'));var moment=require(_0xc4dd('0x4'));var BPromise=require(_0xc4dd('0x5'));var Mustache=require('mustache');var util=require(_0xc4dd('0x6'));var path=require(_0xc4dd('0x7'));var sox=require(_0xc4dd('0x8'));var csv=require('to-csv');var ejs=require(_0xc4dd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4dd('0xa'));var squel=require(_0xc4dd('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc4dd('0xc'));var toCsv=require(_0xc4dd('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc4dd('0xe'));var authService=require(_0xc4dd('0xf'));var qs=require(_0xc4dd('0x10'));var as=require(_0xc4dd('0x11'));var hardwareService=require(_0xc4dd('0x12'));var logger=require(_0xc4dd('0x13'))(_0xc4dd('0x14'));var utils=require(_0xc4dd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc4dd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54f273,_0x3a1e0f){_0x3a1e0f=_0x3a1e0f||0xcc;return function(_0x57c527){if(_0x57c527){return _0x54f273[_0xc4dd('0x17')](_0x3a1e0f);}return _0x54f273[_0xc4dd('0x18')](_0x3a1e0f)['end']();};}function respondWithResult(_0x26fb59,_0x4d2f7c){_0x4d2f7c=_0x4d2f7c||0xc8;return function(_0x5e8bad){if(_0x5e8bad){return _0x26fb59['status'](_0x4d2f7c)[_0xc4dd('0x19')](_0x5e8bad);}};}function respondWithFilteredResult(_0x587e05,_0x52168c){return function(_0x17c54b){if(_0x17c54b){var _0x4ce7f8=typeof _0x52168c[_0xc4dd('0x1a')]===_0xc4dd('0x1b')&&typeof _0x52168c[_0xc4dd('0x1c')]===_0xc4dd('0x1b');var _0xb72b56=_0x17c54b[_0xc4dd('0x1d')];var _0x3fe5dd=_0x4ce7f8?0x0:_0x52168c[_0xc4dd('0x1a')];var _0x25327e=_0x4ce7f8?_0x17c54b[_0xc4dd('0x1d')]:_0x52168c[_0xc4dd('0x1a')]+_0x52168c[_0xc4dd('0x1c')];var _0x2305a3;if(_0x25327e>=_0xb72b56){_0x25327e=_0xb72b56;_0x2305a3=0xc8;}else{_0x2305a3=0xce;}_0x587e05[_0xc4dd('0x18')](_0x2305a3);return _0x587e05[_0xc4dd('0x1e')](_0xc4dd('0x1f'),_0x3fe5dd+'-'+_0x25327e+'/'+_0xb72b56)[_0xc4dd('0x19')](_0x17c54b);}return null;};}function patchUpdates(_0x16b462){return function(_0x31162c){try{jsonpatch[_0xc4dd('0x20')](_0x31162c,_0x16b462,!![]);}catch(_0x2da2ac){return BPromise[_0xc4dd('0x21')](_0x2da2ac);}return _0x31162c[_0xc4dd('0x22')]();};}function saveUpdates(_0x94b02a,_0x5e1fc7){return function(_0x446452){if(_0x446452){return _0x446452['update'](_0x94b02a)[_0xc4dd('0x23')](function(_0x34d9c9){return _0x34d9c9;});}return null;};}function removeEntity(_0x306f34,_0x3d8bf1){return function(_0x1f440f){if(_0x1f440f){return _0x1f440f[_0xc4dd('0x24')]()[_0xc4dd('0x23')](function(){_0x306f34['status'](0xcc)[_0xc4dd('0x25')]();});}};}function handleEntityNotFound(_0x53e9fb,_0x338d92){return function(_0x2e9057){if(!_0x2e9057){_0x53e9fb['sendStatus'](0x194);}return _0x2e9057;};}function handleError(_0x55aeee,_0x3c8ecc){_0x3c8ecc=_0x3c8ecc||0x1f4;return function(_0x11dff9){logger[_0xc4dd('0x26')](_0x11dff9[_0xc4dd('0x27')]);if(_0x11dff9['name']){delete _0x11dff9[_0xc4dd('0x28')];}_0x55aeee[_0xc4dd('0x18')](_0x3c8ecc)['send'](_0x11dff9);};}exports['index']=function(_0x5c044d,_0x175d8f){var _0x178422={},_0x54d716={},_0x46af27={'count':0x0,'rows':[]};var _0x330401=_[_0xc4dd('0x29')](db[_0xc4dd('0x2a')][_0xc4dd('0x2b')],function(_0x17dba5){return{'name':_0x17dba5[_0xc4dd('0x2c')],'type':_0x17dba5['type'][_0xc4dd('0x2d')]};});_0x54d716['model']=_[_0xc4dd('0x29')](_0x330401,'name');_0x54d716[_0xc4dd('0x2e')]=_[_0xc4dd('0x2f')](_0x5c044d[_0xc4dd('0x2e')]);_0x54d716[_0xc4dd('0x30')]=_[_0xc4dd('0x31')](_0x54d716[_0xc4dd('0x32')],_0x54d716[_0xc4dd('0x2e')]);_0x178422[_0xc4dd('0x33')]=_[_0xc4dd('0x31')](_0x54d716[_0xc4dd('0x32')],qs[_0xc4dd('0x34')](_0x5c044d['query'][_0xc4dd('0x34')]));_0x178422['attributes']=_0x178422[_0xc4dd('0x33')]['length']?_0x178422[_0xc4dd('0x33')]:_0x54d716['model'];if(!_0x5c044d['query'][_0xc4dd('0x35')](_0xc4dd('0x36'))){_0x178422[_0xc4dd('0x1c')]=qs[_0xc4dd('0x1c')](_0x5c044d[_0xc4dd('0x2e')][_0xc4dd('0x1c')]);_0x178422[_0xc4dd('0x1a')]=qs[_0xc4dd('0x1a')](_0x5c044d[_0xc4dd('0x2e')][_0xc4dd('0x1a')]);}_0x178422[_0xc4dd('0x37')]=qs[_0xc4dd('0x38')](_0x5c044d[_0xc4dd('0x2e')][_0xc4dd('0x38')]);_0x178422[_0xc4dd('0x39')]=qs[_0xc4dd('0x30')](_[_0xc4dd('0x3a')](_0x5c044d[_0xc4dd('0x2e')],_0x54d716[_0xc4dd('0x30')]),_0x330401);if(_0x5c044d['query']['filter']){_0x178422[_0xc4dd('0x39')]=_[_0xc4dd('0x3b')](_0x178422[_0xc4dd('0x39')],{'$or':_[_0xc4dd('0x29')](_0x330401,function(_0x1a6ead){if(_0x1a6ead[_0xc4dd('0x3c')]!=='VIRTUAL'){var _0x5400dd={};_0x5400dd[_0x1a6ead[_0xc4dd('0x28')]]={'$like':'%'+_0x5c044d['query'][_0xc4dd('0x3d')]+'%'};return _0x5400dd;}})});}_0x178422=_[_0xc4dd('0x3b')]({},_0x178422,_0x5c044d[_0xc4dd('0x3e')]);var _0x552bb8={'where':_0x178422['where']};return db[_0xc4dd('0x2a')]['count'](_0x552bb8)[_0xc4dd('0x23')](function(_0x1962e9){_0x46af27['count']=_0x1962e9;if(_0x5c044d[_0xc4dd('0x2e')][_0xc4dd('0x3f')]){_0x178422[_0xc4dd('0x40')]=[{'all':!![]}];}return db[_0xc4dd('0x2a')][_0xc4dd('0x41')](_0x178422);})[_0xc4dd('0x23')](function(_0x5ca4fc){_0x46af27['rows']=_0x5ca4fc;return _0x46af27;})[_0xc4dd('0x23')](respondWithFilteredResult(_0x175d8f,_0x178422))['catch'](handleError(_0x175d8f,null));};exports[_0xc4dd('0x42')]=function(_0x5d9c89,_0x465fff){var _0x209914={'raw':!![],'where':{'id':_0x5d9c89['params']['id']}},_0x3be891={};_0x3be891[_0xc4dd('0x32')]=_[_0xc4dd('0x2f')](db[_0xc4dd('0x2a')][_0xc4dd('0x2b')]);_0x3be891['query']=_[_0xc4dd('0x2f')](_0x5d9c89['query']);_0x3be891[_0xc4dd('0x30')]=_[_0xc4dd('0x31')](_0x3be891[_0xc4dd('0x32')],_0x3be891[_0xc4dd('0x2e')]);_0x209914[_0xc4dd('0x33')]=_[_0xc4dd('0x31')](_0x3be891['model'],qs[_0xc4dd('0x34')](_0x5d9c89[_0xc4dd('0x2e')]['fields']));_0x209914[_0xc4dd('0x33')]=_0x209914[_0xc4dd('0x33')][_0xc4dd('0x43')]?_0x209914['attributes']:_0x3be891[_0xc4dd('0x32')];if(_0x5d9c89[_0xc4dd('0x2e')][_0xc4dd('0x3f')]){_0x209914[_0xc4dd('0x40')]=[{'all':!![]}];}_0x209914=_['merge']({},_0x209914,_0x5d9c89[_0xc4dd('0x3e')]);return db['FreshsalesField'][_0xc4dd('0x44')](_0x209914)[_0xc4dd('0x23')](handleEntityNotFound(_0x465fff,null))[_0xc4dd('0x23')](respondWithResult(_0x465fff,null))[_0xc4dd('0x45')](handleError(_0x465fff,null));};exports[_0xc4dd('0x46')]=function(_0x5f0c25,_0x20c299){return db[_0xc4dd('0x2a')][_0xc4dd('0x46')](_0x5f0c25[_0xc4dd('0x47')],{})[_0xc4dd('0x23')](respondWithResult(_0x20c299,0xc9))[_0xc4dd('0x45')](handleError(_0x20c299,null));};exports['update']=function(_0xcaf92a,_0x340337){if(_0xcaf92a[_0xc4dd('0x47')]['id']){delete _0xcaf92a[_0xc4dd('0x47')]['id'];}return db[_0xc4dd('0x2a')][_0xc4dd('0x44')]({'where':{'id':_0xcaf92a['params']['id']}})[_0xc4dd('0x23')](handleEntityNotFound(_0x340337,null))['then'](saveUpdates(_0xcaf92a[_0xc4dd('0x47')],null))['then'](respondWithResult(_0x340337,null))[_0xc4dd('0x45')](handleError(_0x340337,null));};exports['destroy']=function(_0x22adde,_0x8549d0){return db['FreshsalesField'][_0xc4dd('0x44')]({'where':{'id':_0x22adde[_0xc4dd('0x48')]['id']}})[_0xc4dd('0x23')](handleEntityNotFound(_0x8549d0,null))['then'](removeEntity(_0x8549d0,null))[_0xc4dd('0x45')](handleError(_0x8549d0,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 123342f..a37d1d0 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 _0xb78e=['../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x32ed9e,_0x2243e1){var _0x19b2d5=function(_0x45c58a){while(--_0x45c58a){_0x32ed9e['push'](_0x32ed9e['shift']());}};_0x19b2d5(++_0x2243e1);}(_0xb78e,0x1c9));var _0xeb78=function(_0x21c1a3,_0x7eff8a){_0x21c1a3=_0x21c1a3-0x0;var _0x2e79f6=_0xb78e[_0x21c1a3];return _0x2e79f6;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var logger=require('../../config/logger')(_0xeb78('0x2'));var moment=require(_0xeb78('0x3'));var BPromise=require(_0xeb78('0x4'));var rp=require(_0xeb78('0x5'));var fs=require('fs');var path=require(_0xeb78('0x6'));var rimraf=require(_0xeb78('0x7'));var config=require(_0xeb78('0x8'));var attributes=require(_0xeb78('0x9'));module['exports']=function(_0x3c35e7,_0x17a736){return _0x3c35e7[_0xeb78('0xa')](_0xeb78('0xb'),attributes,{'tableName':_0xeb78('0xc'),'paranoid':![],'indexes':[{'name':_0xeb78('0xd'),'fields':[_0xeb78('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6901=['int_freshsales_fields','freshsales_unique_index','idField','lodash','../../config/logger','api','request-promise','path','./intFreshsalesField.attributes','define','FreshsalesField'];(function(_0x381724,_0x235fa3){var _0x32b9f9=function(_0x37576a){while(--_0x37576a){_0x381724['push'](_0x381724['shift']());}};_0x32b9f9(++_0x235fa3);}(_0x6901,0x100));var _0x1690=function(_0x21c83a,_0x2bd10f){_0x21c83a=_0x21c83a-0x0;var _0x21b2c9=_0x6901[_0x21c83a];return _0x21b2c9;};'use strict';var _=require(_0x1690('0x0'));var util=require('util');var logger=require(_0x1690('0x1'))(_0x1690('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1690('0x3'));var fs=require('fs');var path=require(_0x1690('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1690('0x5'));module['exports']=function(_0x5a1c50,_0x32f96e){return _0x5a1c50[_0x1690('0x6')](_0x1690('0x7'),attributes,{'tableName':_0x1690('0x8'),'paranoid':![],'indexes':[{'name':_0x1690('0x9'),'fields':[_0x1690('0xa'),'FieldId'],'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 aefe198..5e0276d 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 _0x9536=['request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesField,\x20%s,\x20%s'];(function(_0x15c064,_0x1b2680){var _0x5423bc=function(_0x349101){while(--_0x349101){_0x15c064['push'](_0x15c064['shift']());}};_0x5423bc(++_0x1b2680);}(_0x9536,0x179));var _0x6953=function(_0x4e0026,_0x2b52b6){_0x4e0026=_0x4e0026-0x0;var _0x3f8ee7=_0x9536[_0x4e0026];return _0x3f8ee7;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});} \ No newline at end of file +var _0x2675=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis'];(function(_0x5305aa,_0x3e9133){var _0x34fe6f=function(_0x310f6b){while(--_0x310f6b){_0x5305aa['push'](_0x5305aa['shift']());}};_0x34fe6f(++_0x3e9133);}(_0x2675,0x75));var _0x5267=function(_0x17f47e,_0x572193){_0x17f47e=_0x17f47e-0x0;var _0x4238bc=_0x2675[_0x17f47e];return _0x4238bc;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var Redis=require(_0x5267('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5267('0x3'));var logger=require(_0x5267('0x4'))('rpc');var config=require(_0x5267('0x5'));var jayson=require(_0x5267('0x6'));var client=jayson[_0x5267('0x7')][_0x5267('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20f065,_0xc56cd5,_0x527c16){return new BPromise(function(_0x9e0a27,_0x46bfdf){return client['request'](_0x20f065,_0x527c16)[_0x5267('0x9')](function(_0x5d6645){logger[_0x5267('0xa')](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));logger['debug'](_0x5267('0xd'),_0xc56cd5,'request\x20sent',JSON[_0x5267('0xe')](_0x5d6645));if(_0x5d6645['error']){if(_0x5d6645[_0x5267('0xf')][_0x5267('0x10')]===0x1f4){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x46bfdf(_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);}logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x9e0a27(_0x5d6645[_0x5267('0xf')]['message']);}else{logger['info'](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));_0x9e0a27(_0x5d6645[_0x5267('0x12')][_0x5267('0x11')]);}})[_0x5267('0x13')](function(_0x27e5c6){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x27e5c6);_0x46bfdf(_0x27e5c6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 1405606..0c43f82 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x32ff57,_0x468f0f){var _0x55f897=function(_0x3f3c42){while(--_0x3f3c42){_0x32ff57['push'](_0x32ff57['shift']());}};_0x55f897(++_0x468f0f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x2fc242,_0x3ca560){var _0x12aacf=function(_0x573892){while(--_0x573892){_0x2fc242['push'](_0x2fc242['shift']());}};_0x12aacf(++_0x3ca560);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index ba3e836..1aaef6c 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 _0x762e=['STRING','ENUM','newTab','integrationTab','sequelize'];(function(_0x565442,_0x5864c6){var _0x514c89=function(_0x4cdba9){while(--_0x4cdba9){_0x565442['push'](_0x565442['shift']());}};_0x514c89(++_0x5864c6);}(_0x762e,0xea));var _0xe762=function(_0x49b950,_0x5be899){_0x49b950=_0x49b950-0x0;var _0x321d95=_0x762e[_0x49b950];return _0x321d95;};'use strict';var Sequelize=require(_0xe762('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe762('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0xe762('0x1')]},'password':{'type':Sequelize[_0xe762('0x1')]},'clientId':{'type':Sequelize[_0xe762('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xe762('0x1')]},'serverUrl':{'type':Sequelize[_0xe762('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe762('0x2')]('integrationTab',_0xe762('0x3')),'defaultValue':_0xe762('0x4')}}; \ No newline at end of file +var _0xa24a=['STRING','username','ENUM','newTab','integrationTab','sequelize','exports'];(function(_0x55d510,_0x235ab8){var _0x503526=function(_0x471f7e){while(--_0x471f7e){_0x55d510['push'](_0x55d510['shift']());}};_0x503526(++_0x235ab8);}(_0xa24a,0x1a2));var _0xaa24=function(_0x5d8025,_0x52f2c0){_0x5d8025=_0x5d8025-0x0;var _0x450cf9=_0xa24a[_0x5d8025];return _0x450cf9;};'use strict';var Sequelize=require(_0xaa24('0x0'));module[_0xaa24('0x1')]={'name':{'type':Sequelize[_0xaa24('0x2')]},'description':{'type':Sequelize[_0xaa24('0x2')]},'username':{'type':Sequelize[_0xaa24('0x2')],'unique':_0xaa24('0x3')},'remoteUri':{'type':Sequelize[_0xaa24('0x2')]},'password':{'type':Sequelize[_0xaa24('0x2')]},'clientId':{'type':Sequelize[_0xaa24('0x2')]},'clientSecret':{'type':Sequelize[_0xaa24('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xaa24('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xaa24('0x4')]('integrationTab',_0xaa24('0x5')),'defaultValue':_0xaa24('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 57f3c60..20ddcfa 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 _0x1e84=['json','apply','save','update','then','destroy','end','error','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','filter','options','includeAll','findAll','catch','show','params','keys','include','find','create','body','order','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','securityToken','slice','substring','lastIndexOf','clientSecret','login','password','concat','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','picklist','boolean','textarea','phone','remove','includes','label','custom','picklistValues','True','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','offset','limit','count','set','Content-Range'];(function(_0x5285fd,_0x2d9144){var _0x4a9e11=function(_0x4583c2){while(--_0x4583c2){_0x5285fd['push'](_0x5285fd['shift']());}};_0x4a9e11(++_0x2d9144);}(_0x1e84,0xd4));var _0x41e8=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0x1e84[_0x46cf00];return _0x3974dc;};'use strict';var emlformat=require(_0x41e8('0x0'));var rimraf=require(_0x41e8('0x1'));var zipdir=require(_0x41e8('0x2'));var jsonpatch=require(_0x41e8('0x3'));var rp=require(_0x41e8('0x4'));var moment=require(_0x41e8('0x5'));var BPromise=require(_0x41e8('0x6'));var Mustache=require('mustache');var util=require(_0x41e8('0x7'));var path=require('path');var sox=require(_0x41e8('0x8'));var csv=require(_0x41e8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x41e8('0xa'));var crypto=require(_0x41e8('0xb'));var jsforce=require(_0x41e8('0xc'));var deskjs=require(_0x41e8('0xd'));var toCsv=require(_0x41e8('0x9'));var querystring=require(_0x41e8('0xe'));var Papa=require(_0x41e8('0xf'));var Redis=require('ioredis');var authService=require(_0x41e8('0x10'));var qs=require(_0x41e8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x41e8('0x12'));var logger=require(_0x41e8('0x13'))(_0x41e8('0x14'));var utils=require(_0x41e8('0x15'));var config=require(_0x41e8('0x16'));var licenseUtil=require(_0x41e8('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x41e8('0x18'));function respondWithStatusCode(_0x168917,_0x47f8b1){_0x47f8b1=_0x47f8b1||0xcc;return function(_0x44d11a){if(_0x44d11a){return _0x168917[_0x41e8('0x19')](_0x47f8b1);}return _0x168917[_0x41e8('0x1a')](_0x47f8b1)['end']();};}function respondWithResult(_0x5c9ddb,_0x473844){_0x473844=_0x473844||0xc8;return function(_0x266374){if(_0x266374){return _0x5c9ddb[_0x41e8('0x1a')](_0x473844)['json'](_0x266374);}};}function respondWithFilteredResult(_0x3792ae,_0x2c364f){return function(_0x38050a){if(_0x38050a){var _0x5366ea=typeof _0x2c364f[_0x41e8('0x1b')]==='undefined'&&typeof _0x2c364f[_0x41e8('0x1c')]==='undefined';var _0x48ed2c=_0x38050a[_0x41e8('0x1d')];var _0x4d78f6=_0x5366ea?0x0:_0x2c364f[_0x41e8('0x1b')];var _0x3ef8e6=_0x5366ea?_0x38050a[_0x41e8('0x1d')]:_0x2c364f[_0x41e8('0x1b')]+_0x2c364f[_0x41e8('0x1c')];var _0x33734a;if(_0x3ef8e6>=_0x48ed2c){_0x3ef8e6=_0x48ed2c;_0x33734a=0xc8;}else{_0x33734a=0xce;}_0x3792ae['status'](_0x33734a);return _0x3792ae[_0x41e8('0x1e')](_0x41e8('0x1f'),_0x4d78f6+'-'+_0x3ef8e6+'/'+_0x48ed2c)[_0x41e8('0x20')](_0x38050a);}return null;};}function patchUpdates(_0x454e38){return function(_0x31c25a){try{jsonpatch[_0x41e8('0x21')](_0x31c25a,_0x454e38,!![]);}catch(_0x2b9dca){return BPromise['reject'](_0x2b9dca);}return _0x31c25a[_0x41e8('0x22')]();};}function saveUpdates(_0xe28dae,_0x103712){return function(_0x12d0e2){if(_0x12d0e2){return _0x12d0e2[_0x41e8('0x23')](_0xe28dae)[_0x41e8('0x24')](function(_0x1b3422){return _0x1b3422;});}return null;};}function removeEntity(_0x370fbc,_0x3759ec){return function(_0x8a1644){if(_0x8a1644){return _0x8a1644[_0x41e8('0x25')]()['then'](function(){_0x370fbc[_0x41e8('0x1a')](0xcc)[_0x41e8('0x26')]();});}};}function handleEntityNotFound(_0x2cfb18,_0x132034){return function(_0x48c83f){if(!_0x48c83f){_0x2cfb18[_0x41e8('0x19')](0x194);}return _0x48c83f;};}function handleError(_0xc09c24,_0x29f17f){_0x29f17f=_0x29f17f||0x1f4;return function(_0x3c5d63){logger[_0x41e8('0x27')](_0x3c5d63['stack']);if(_0x3c5d63[_0x41e8('0x28')]){delete _0x3c5d63[_0x41e8('0x28')];}_0xc09c24[_0x41e8('0x1a')](_0x29f17f)['send'](_0x3c5d63);};}exports[_0x41e8('0x29')]=function(_0x2914eb,_0x1690b4){var _0xbe3ae4={},_0x261821={},_0x283562={'count':0x0,'rows':[]};var _0x4f7fe9=_[_0x41e8('0x2a')](db[_0x41e8('0x2b')][_0x41e8('0x2c')],function(_0x423ba7){return{'name':_0x423ba7[_0x41e8('0x2d')],'type':_0x423ba7[_0x41e8('0x2e')][_0x41e8('0x2f')]};});_0x261821['model']=_[_0x41e8('0x2a')](_0x4f7fe9,'name');_0x261821[_0x41e8('0x30')]=_['keys'](_0x2914eb[_0x41e8('0x30')]);_0x261821['filters']=_[_0x41e8('0x31')](_0x261821['model'],_0x261821[_0x41e8('0x30')]);_0xbe3ae4[_0x41e8('0x32')]=_[_0x41e8('0x31')](_0x261821[_0x41e8('0x33')],qs[_0x41e8('0x34')](_0x2914eb['query'][_0x41e8('0x34')]));_0xbe3ae4[_0x41e8('0x32')]=_0xbe3ae4['attributes'][_0x41e8('0x35')]?_0xbe3ae4[_0x41e8('0x32')]:_0x261821['model'];if(!_0x2914eb[_0x41e8('0x30')][_0x41e8('0x36')](_0x41e8('0x37'))){_0xbe3ae4[_0x41e8('0x1c')]=qs['limit'](_0x2914eb[_0x41e8('0x30')][_0x41e8('0x1c')]);_0xbe3ae4[_0x41e8('0x1b')]=qs[_0x41e8('0x1b')](_0x2914eb[_0x41e8('0x30')][_0x41e8('0x1b')]);}_0xbe3ae4['order']=qs[_0x41e8('0x38')](_0x2914eb[_0x41e8('0x30')][_0x41e8('0x38')]);_0xbe3ae4[_0x41e8('0x39')]=qs[_0x41e8('0x3a')](_[_0x41e8('0x3b')](_0x2914eb[_0x41e8('0x30')],_0x261821[_0x41e8('0x3a')]),_0x4f7fe9);if(_0x2914eb[_0x41e8('0x30')]['filter']){_0xbe3ae4[_0x41e8('0x39')]=_[_0x41e8('0x3c')](_0xbe3ae4[_0x41e8('0x39')],{'$or':_[_0x41e8('0x2a')](_0x4f7fe9,function(_0x529875){if(_0x529875[_0x41e8('0x2e')]!=='VIRTUAL'){var _0x560a24={};_0x560a24[_0x529875[_0x41e8('0x28')]]={'$like':'%'+_0x2914eb[_0x41e8('0x30')][_0x41e8('0x3d')]+'%'};return _0x560a24;}})});}_0xbe3ae4=_[_0x41e8('0x3c')]({},_0xbe3ae4,_0x2914eb[_0x41e8('0x3e')]);var _0x46ef65={'where':_0xbe3ae4[_0x41e8('0x39')]};return db[_0x41e8('0x2b')][_0x41e8('0x1d')](_0x46ef65)[_0x41e8('0x24')](function(_0xf9ac2){_0x283562[_0x41e8('0x1d')]=_0xf9ac2;if(_0x2914eb[_0x41e8('0x30')][_0x41e8('0x3f')]){_0xbe3ae4['include']=[{'all':!![]}];}return db[_0x41e8('0x2b')][_0x41e8('0x40')](_0xbe3ae4);})[_0x41e8('0x24')](function(_0x513a04){_0x283562['rows']=_0x513a04;return _0x283562;})[_0x41e8('0x24')](respondWithFilteredResult(_0x1690b4,_0xbe3ae4))[_0x41e8('0x41')](handleError(_0x1690b4,null));};exports[_0x41e8('0x42')]=function(_0x56e57c,_0x49c720){var _0x597a38={'raw':![],'where':{'id':_0x56e57c[_0x41e8('0x43')]['id']}},_0x200701={};_0x200701[_0x41e8('0x33')]=_[_0x41e8('0x44')](db[_0x41e8('0x2b')][_0x41e8('0x2c')]);_0x200701[_0x41e8('0x30')]=_['keys'](_0x56e57c[_0x41e8('0x30')]);_0x200701[_0x41e8('0x3a')]=_[_0x41e8('0x31')](_0x200701[_0x41e8('0x33')],_0x200701[_0x41e8('0x30')]);_0x597a38[_0x41e8('0x32')]=_[_0x41e8('0x31')](_0x200701[_0x41e8('0x33')],qs[_0x41e8('0x34')](_0x56e57c[_0x41e8('0x30')]['fields']));_0x597a38['attributes']=_0x597a38[_0x41e8('0x32')][_0x41e8('0x35')]?_0x597a38['attributes']:_0x200701[_0x41e8('0x33')];if(_0x56e57c[_0x41e8('0x30')][_0x41e8('0x3f')]){_0x597a38[_0x41e8('0x45')]=[{'all':!![]}];}_0x597a38=_[_0x41e8('0x3c')]({},_0x597a38,_0x56e57c[_0x41e8('0x3e')]);return db[_0x41e8('0x2b')][_0x41e8('0x46')](_0x597a38)[_0x41e8('0x24')](handleEntityNotFound(_0x49c720,null))['then'](respondWithResult(_0x49c720,null))[_0x41e8('0x41')](handleError(_0x49c720,null));};exports[_0x41e8('0x47')]=function(_0x46f70f,_0x7d5ac9){return db[_0x41e8('0x2b')][_0x41e8('0x47')](_0x46f70f[_0x41e8('0x48')],{})[_0x41e8('0x24')](respondWithResult(_0x7d5ac9,0xc9))[_0x41e8('0x41')](handleError(_0x7d5ac9,null));};exports[_0x41e8('0x23')]=function(_0x19a371,_0x4e2d1d){if(_0x19a371[_0x41e8('0x48')]['id']){delete _0x19a371['body']['id'];}return db[_0x41e8('0x2b')][_0x41e8('0x46')]({'where':{'id':_0x19a371[_0x41e8('0x43')]['id']}})[_0x41e8('0x24')](handleEntityNotFound(_0x4e2d1d,null))[_0x41e8('0x24')](saveUpdates(_0x19a371[_0x41e8('0x48')],null))[_0x41e8('0x24')](respondWithResult(_0x4e2d1d,null))[_0x41e8('0x41')](handleError(_0x4e2d1d,null));};exports[_0x41e8('0x25')]=function(_0x3d21f5,_0x578269){return db[_0x41e8('0x2b')][_0x41e8('0x46')]({'where':{'id':_0x3d21f5['params']['id']}})[_0x41e8('0x24')](handleEntityNotFound(_0x578269,null))[_0x41e8('0x24')](removeEntity(_0x578269,null))[_0x41e8('0x41')](handleError(_0x578269,null));};exports['getConfigurations']=function(_0x125a5a,_0x211398,_0x89b1b2){var _0x1559b5={};var _0x8d6990={};var _0x39f638;var _0x352e6c;return db[_0x41e8('0x2b')]['findOne']({'where':{'id':_0x125a5a[_0x41e8('0x43')]['id']}})['then'](handleEntityNotFound(_0x211398,null))[_0x41e8('0x24')](function(_0x3d93ea){if(_0x3d93ea){_0x39f638=_0x3d93ea;_0x8d6990[_0x41e8('0x33')]=_[_0x41e8('0x44')](db['SalesforceConfiguration'][_0x41e8('0x2c')]);_0x8d6990['query']=_[_0x41e8('0x44')](_0x125a5a[_0x41e8('0x30')]);_0x8d6990[_0x41e8('0x3a')]=_[_0x41e8('0x31')](_0x8d6990[_0x41e8('0x33')],_0x8d6990[_0x41e8('0x30')]);_0x1559b5[_0x41e8('0x32')]=_[_0x41e8('0x31')](_0x8d6990['model'],qs[_0x41e8('0x34')](_0x125a5a[_0x41e8('0x30')][_0x41e8('0x34')]));_0x1559b5[_0x41e8('0x32')]=_0x1559b5[_0x41e8('0x32')]['length']?_0x1559b5['attributes']:_0x8d6990['model'];_0x1559b5[_0x41e8('0x49')]=qs[_0x41e8('0x38')](_0x125a5a[_0x41e8('0x30')][_0x41e8('0x38')]);_0x1559b5['where']=qs['filters'](_[_0x41e8('0x3b')](_0x125a5a[_0x41e8('0x30')],_0x8d6990[_0x41e8('0x3a')]));if(_0x125a5a[_0x41e8('0x30')][_0x41e8('0x3d')]){_0x1559b5['where']=_['merge'](_0x1559b5[_0x41e8('0x39')],{'$or':_[_0x41e8('0x2a')](_0x1559b5[_0x41e8('0x32')],function(_0x189b94){var _0x584fb2={};_0x584fb2[_0x189b94]={'$like':'%'+_0x125a5a[_0x41e8('0x30')][_0x41e8('0x3d')]+'%'};return _0x584fb2;})});}_0x1559b5=_['merge']({},_0x1559b5,_0x125a5a[_0x41e8('0x3e')]);return _0x39f638[_0x41e8('0x4a')](_0x1559b5);}})['then'](function(_0x4c7a0a){if(_0x4c7a0a){_0x352e6c=_0x4c7a0a['length'];if(!_0x125a5a['query'][_0x41e8('0x36')](_0x41e8('0x37'))){_0x1559b5[_0x41e8('0x1c')]=qs[_0x41e8('0x1c')](_0x125a5a['query'][_0x41e8('0x1c')]);_0x1559b5[_0x41e8('0x1b')]=qs[_0x41e8('0x1b')](_0x125a5a[_0x41e8('0x30')][_0x41e8('0x1b')]);}return _0x39f638[_0x41e8('0x4a')](_0x1559b5);}})[_0x41e8('0x24')](function(_0x231ea5){if(_0x231ea5){return _0x231ea5?{'count':_0x352e6c,'rows':_0x231ea5}:null;}})[_0x41e8('0x24')](respondWithResult(_0x211398,null))[_0x41e8('0x41')](handleError(_0x211398,null));};exports[_0x41e8('0x4b')]=function(_0x31651c,_0x22d3c6,_0x1bc9e5){if(_0x31651c[_0x41e8('0x48')]['id']){delete _0x31651c[_0x41e8('0x48')]['id'];}return db[_0x41e8('0x2b')][_0x41e8('0x4c')]({'where':{'id':_0x31651c[_0x41e8('0x43')]['id']}})['then'](handleEntityNotFound(_0x22d3c6,null))['then'](function(_0x1798c3){if(_0x1798c3){_0x31651c['body'][_0x41e8('0x4d')]=_0x1798c3['id'];_0x31651c[_0x41e8('0x48')][_0x41e8('0x4e')]=integrations['getSubjects'](_0x31651c[_0x41e8('0x48')][_0x41e8('0x4f')],_0x31651c[_0x41e8('0x48')][_0x41e8('0x2e')]);_0x31651c[_0x41e8('0x48')][_0x41e8('0x50')]=integrations[_0x41e8('0x51')](_0x31651c[_0x41e8('0x48')][_0x41e8('0x4f')],_0x31651c[_0x41e8('0x48')][_0x41e8('0x2e')]);return db['SalesforceConfiguration']['create'](_0x31651c[_0x41e8('0x48')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x41e8('0x52')],'as':_0x41e8('0x50')}]});}return null;})['then'](respondWithResult(_0x22d3c6,null))[_0x41e8('0x41')](handleError(_0x22d3c6,null));};exports['getFields']=function(_0x7572b3,_0x547472,_0x120521){var _0x30426a;var _0xedc63c='';var _0x22f285=_0x41e8('0x53');return db[_0x41e8('0x2b')][_0x41e8('0x4c')]({'where':{'id':_0x7572b3[_0x41e8('0x43')]['id']},'attributes':['id',_0x41e8('0x54'),_0x41e8('0x55'),'clientSecret','username','password',_0x41e8('0x56')]})[_0x41e8('0x24')](handleEntityNotFound(_0x547472,null))[_0x41e8('0x24')](function(_0x268c26){if(_0x268c26){_0xedc63c=_0x268c26['remoteUri'];var _0x51d7ff=_0xedc63c[_0x41e8('0x57')](-0x1);if(_0x51d7ff==='/'){_0xedc63c=_0xedc63c[_0x41e8('0x58')](0x0,_0xedc63c[_0x41e8('0x59')](_0x51d7ff));}_0x30426a=new jsforce['Connection']({'oauth2':{'loginUrl':_0xedc63c,'clientId':_0x268c26[_0x41e8('0x55')],'clientSecret':_0x268c26[_0x41e8('0x5a')]}});return _0x30426a[_0x41e8('0x5b')](_0x268c26['username'],_0x268c26[_0x41e8('0x5c')][_0x41e8('0x5d')](_0x268c26[_0x41e8('0x56')]));}})['then'](function(_0x2cf7b6){if(_0x2cf7b6){if(!_['isNil'](_0x7572b3['query'][_0x41e8('0x5e')])){_0x22f285=_0x7572b3[_0x41e8('0x30')][_0x41e8('0x5e')];}return _0x30426a[_0x41e8('0x5f')](_0x22f285)['describe']();}})[_0x41e8('0x24')](function(_0x4234a4){var _0x28ff51=[_0x41e8('0x60'),_0x41e8('0x61'),_0x41e8('0x62'),_0x41e8('0x63'),_0x41e8('0x64'),_0x41e8('0x65')];var _0x22c5eb=['string',_0x41e8('0x66'),_0x41e8('0x67'),_0x41e8('0x68'),'email',_0x41e8('0x69'),_0x41e8('0x6a')];if(_0x4234a4){_[_0x41e8('0x6b')](_0x4234a4[_0x41e8('0x34')],function(_0xa21958){return _0x28ff51[_0x41e8('0x6c')](_0xa21958['name'])||!_0x22c5eb[_0x41e8('0x6c')](_0xa21958[_0x41e8('0x2e')]);});return{'count':_0x4234a4[_0x41e8('0x34')][_0x41e8('0x35')],'rows':_[_0x41e8('0x2a')](_0x4234a4[_0x41e8('0x34')],function(_0x144544){return{'id':_0x144544[_0x41e8('0x28')],'name':_0x144544[_0x41e8('0x6d')],'custom':_0x144544[_0x41e8('0x6e')],'options':_0x144544['picklistValues']['length']>0x0?_[_0x41e8('0x2a')](_0x144544[_0x41e8('0x6f')],function(_0x4cc670){return{'name':_0x4cc670[_0x41e8('0x6d')],'value':_0x4cc670['value']};}):_0x144544[_0x41e8('0x2e')]=='boolean'?[{'name':_0x41e8('0x70'),'value':_0x41e8('0x71')},{'name':'False','value':_0x41e8('0x72')}]:[]};})};}})[_0x41e8('0x24')](respondWithResult(_0x547472,null))['catch'](function(_0x5dd595){var _0x17dfeb=_0x7572b3['query'][_0x41e8('0x73')]?0x1f4:_0x5dd595[_0x41e8('0x74')]||0x1f4;logger['error'](_0x41e8('0x75'),_0x41e8('0x76'),_0x17dfeb,JSON[_0x41e8('0x77')](_0x5dd595));delete _0x5dd595[_0x41e8('0x28')];if(_0x17dfeb===0x191){_0x17dfeb=0x190;}_0x547472[_0x41e8('0x1a')](_0x17dfeb)[_0x41e8('0x78')](_0x7572b3[_0x41e8('0x30')][_0x41e8('0x73')]?{'message':_0x41e8('0x79'),'statusCode':_0x5dd595[_0x41e8('0x74')]}:_0x5dd595);});}; \ No newline at end of file +var _0xd148=['mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','error','stack','name','send','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','update','body','getConfigurations','SalesforceConfiguration','intersection','order','options','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','username','password','slice','lastIndexOf','clientSecret','login','concat','securityToken','isNil','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean','email','textarea','remove','includes','label','picklistValues','value','True','true','False','statusCode','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xd148,0x74));var _0x8d14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd148[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d14('0x0'));var zipdir=require(_0x8d14('0x1'));var jsonpatch=require(_0x8d14('0x2'));var rp=require(_0x8d14('0x3'));var moment=require(_0x8d14('0x4'));var BPromise=require(_0x8d14('0x5'));var Mustache=require(_0x8d14('0x6'));var util=require('util');var path=require(_0x8d14('0x7'));var sox=require('sox');var csv=require(_0x8d14('0x8'));var ejs=require(_0x8d14('0x9'));var fs=require('fs');var fs_extra=require(_0x8d14('0xa'));var _=require(_0x8d14('0xb'));var squel=require(_0x8d14('0xc'));var crypto=require('crypto');var jsforce=require(_0x8d14('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8d14('0xe'));var Papa=require(_0x8d14('0xf'));var Redis=require('ioredis');var authService=require(_0x8d14('0x10'));var qs=require(_0x8d14('0x11'));var as=require(_0x8d14('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8d14('0x13'));var utils=require('../../config/utils');var config=require(_0x8d14('0x14'));var licenseUtil=require(_0x8d14('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8d14('0x16'));function respondWithStatusCode(_0x4752fe,_0x5ef186){_0x5ef186=_0x5ef186||0xcc;return function(_0x924f9b){if(_0x924f9b){return _0x4752fe[_0x8d14('0x17')](_0x5ef186);}return _0x4752fe[_0x8d14('0x18')](_0x5ef186)[_0x8d14('0x19')]();};}function respondWithResult(_0x347330,_0x47ceec){_0x47ceec=_0x47ceec||0xc8;return function(_0x19d637){if(_0x19d637){return _0x347330[_0x8d14('0x18')](_0x47ceec)[_0x8d14('0x1a')](_0x19d637);}};}function respondWithFilteredResult(_0x2c004f,_0x1c526f){return function(_0x548eb5){if(_0x548eb5){var _0x28adac=typeof _0x1c526f[_0x8d14('0x1b')]===_0x8d14('0x1c')&&typeof _0x1c526f[_0x8d14('0x1d')]===_0x8d14('0x1c');var _0x47d455=_0x548eb5[_0x8d14('0x1e')];var _0x42c224=_0x28adac?0x0:_0x1c526f[_0x8d14('0x1b')];var _0x393604=_0x28adac?_0x548eb5[_0x8d14('0x1e')]:_0x1c526f['offset']+_0x1c526f[_0x8d14('0x1d')];var _0x525d0f;if(_0x393604>=_0x47d455){_0x393604=_0x47d455;_0x525d0f=0xc8;}else{_0x525d0f=0xce;}_0x2c004f[_0x8d14('0x18')](_0x525d0f);return _0x2c004f['set'](_0x8d14('0x1f'),_0x42c224+'-'+_0x393604+'/'+_0x47d455)['json'](_0x548eb5);}return null;};}function patchUpdates(_0xc187c1){return function(_0x448815){try{jsonpatch[_0x8d14('0x20')](_0x448815,_0xc187c1,!![]);}catch(_0x1530f1){return BPromise['reject'](_0x1530f1);}return _0x448815[_0x8d14('0x21')]();};}function saveUpdates(_0x12d785,_0xc24212){return function(_0x4a98af){if(_0x4a98af){return _0x4a98af['update'](_0x12d785)[_0x8d14('0x22')](function(_0x51f430){return _0x51f430;});}return null;};}function removeEntity(_0x5f228c,_0x2ee0b0){return function(_0x5d6bf2){if(_0x5d6bf2){return _0x5d6bf2[_0x8d14('0x23')]()[_0x8d14('0x22')](function(){_0x5f228c[_0x8d14('0x18')](0xcc)[_0x8d14('0x19')]();});}};}function handleEntityNotFound(_0xec71a2,_0xe2a02){return function(_0x26efc1){if(!_0x26efc1){_0xec71a2[_0x8d14('0x17')](0x194);}return _0x26efc1;};}function handleError(_0x319409,_0x462f52){_0x462f52=_0x462f52||0x1f4;return function(_0x4e64e9){logger[_0x8d14('0x24')](_0x4e64e9[_0x8d14('0x25')]);if(_0x4e64e9[_0x8d14('0x26')]){delete _0x4e64e9[_0x8d14('0x26')];}_0x319409[_0x8d14('0x18')](_0x462f52)[_0x8d14('0x27')](_0x4e64e9);};}exports['index']=function(_0x470332,_0x5ded58){var _0x5cb079={},_0x51a693={},_0x25fe35={'count':0x0,'rows':[]};var _0x52456f=_[_0x8d14('0x28')](db[_0x8d14('0x29')][_0x8d14('0x2a')],function(_0x15e112){return{'name':_0x15e112[_0x8d14('0x2b')],'type':_0x15e112[_0x8d14('0x2c')][_0x8d14('0x2d')]};});_0x51a693[_0x8d14('0x2e')]=_[_0x8d14('0x28')](_0x52456f,_0x8d14('0x26'));_0x51a693[_0x8d14('0x2f')]=_[_0x8d14('0x30')](_0x470332[_0x8d14('0x2f')]);_0x51a693['filters']=_['intersection'](_0x51a693['model'],_0x51a693[_0x8d14('0x2f')]);_0x5cb079[_0x8d14('0x31')]=_['intersection'](_0x51a693['model'],qs['fields'](_0x470332[_0x8d14('0x2f')]['fields']));_0x5cb079['attributes']=_0x5cb079['attributes']['length']?_0x5cb079['attributes']:_0x51a693[_0x8d14('0x2e')];if(!_0x470332[_0x8d14('0x2f')][_0x8d14('0x32')]('nolimit')){_0x5cb079[_0x8d14('0x1d')]=qs[_0x8d14('0x1d')](_0x470332['query'][_0x8d14('0x1d')]);_0x5cb079[_0x8d14('0x1b')]=qs[_0x8d14('0x1b')](_0x470332[_0x8d14('0x2f')][_0x8d14('0x1b')]);}_0x5cb079['order']=qs[_0x8d14('0x33')](_0x470332[_0x8d14('0x2f')][_0x8d14('0x33')]);_0x5cb079[_0x8d14('0x34')]=qs[_0x8d14('0x35')](_[_0x8d14('0x36')](_0x470332[_0x8d14('0x2f')],_0x51a693[_0x8d14('0x35')]),_0x52456f);if(_0x470332[_0x8d14('0x2f')][_0x8d14('0x37')]){_0x5cb079[_0x8d14('0x34')]=_[_0x8d14('0x38')](_0x5cb079[_0x8d14('0x34')],{'$or':_[_0x8d14('0x28')](_0x52456f,function(_0xfecd61){if(_0xfecd61[_0x8d14('0x2c')]!==_0x8d14('0x39')){var _0xcfab07={};_0xcfab07[_0xfecd61[_0x8d14('0x26')]]={'$like':'%'+_0x470332[_0x8d14('0x2f')][_0x8d14('0x37')]+'%'};return _0xcfab07;}})});}_0x5cb079=_[_0x8d14('0x38')]({},_0x5cb079,_0x470332['options']);var _0x1b4e70={'where':_0x5cb079[_0x8d14('0x34')]};return db['SalesforceAccount'][_0x8d14('0x1e')](_0x1b4e70)[_0x8d14('0x22')](function(_0x313a00){_0x25fe35['count']=_0x313a00;if(_0x470332[_0x8d14('0x2f')][_0x8d14('0x3a')]){_0x5cb079[_0x8d14('0x3b')]=[{'all':!![]}];}return db[_0x8d14('0x29')][_0x8d14('0x3c')](_0x5cb079);})[_0x8d14('0x22')](function(_0x4c6429){_0x25fe35[_0x8d14('0x3d')]=_0x4c6429;return _0x25fe35;})['then'](respondWithFilteredResult(_0x5ded58,_0x5cb079))[_0x8d14('0x3e')](handleError(_0x5ded58,null));};exports[_0x8d14('0x3f')]=function(_0x327132,_0x948871){var _0x49c1a9={'raw':![],'where':{'id':_0x327132[_0x8d14('0x40')]['id']}},_0x1b03fa={};_0x1b03fa['model']=_[_0x8d14('0x30')](db[_0x8d14('0x29')]['rawAttributes']);_0x1b03fa[_0x8d14('0x2f')]=_[_0x8d14('0x30')](_0x327132['query']);_0x1b03fa[_0x8d14('0x35')]=_['intersection'](_0x1b03fa[_0x8d14('0x2e')],_0x1b03fa[_0x8d14('0x2f')]);_0x49c1a9[_0x8d14('0x31')]=_['intersection'](_0x1b03fa[_0x8d14('0x2e')],qs['fields'](_0x327132['query'][_0x8d14('0x41')]));_0x49c1a9[_0x8d14('0x31')]=_0x49c1a9['attributes'][_0x8d14('0x42')]?_0x49c1a9['attributes']:_0x1b03fa[_0x8d14('0x2e')];if(_0x327132[_0x8d14('0x2f')][_0x8d14('0x3a')]){_0x49c1a9[_0x8d14('0x3b')]=[{'all':!![]}];}_0x49c1a9=_[_0x8d14('0x38')]({},_0x49c1a9,_0x327132['options']);return db['SalesforceAccount'][_0x8d14('0x43')](_0x49c1a9)[_0x8d14('0x22')](handleEntityNotFound(_0x948871,null))[_0x8d14('0x22')](respondWithResult(_0x948871,null))['catch'](handleError(_0x948871,null));};exports[_0x8d14('0x44')]=function(_0x2cd5b1,_0x4773f3){return db[_0x8d14('0x29')][_0x8d14('0x44')](_0x2cd5b1['body'],{})[_0x8d14('0x22')](respondWithResult(_0x4773f3,0xc9))[_0x8d14('0x3e')](handleError(_0x4773f3,null));};exports[_0x8d14('0x45')]=function(_0x50af3d,_0x5247af){if(_0x50af3d[_0x8d14('0x46')]['id']){delete _0x50af3d[_0x8d14('0x46')]['id'];}return db['SalesforceAccount'][_0x8d14('0x43')]({'where':{'id':_0x50af3d[_0x8d14('0x40')]['id']}})['then'](handleEntityNotFound(_0x5247af,null))[_0x8d14('0x22')](saveUpdates(_0x50af3d[_0x8d14('0x46')],null))[_0x8d14('0x22')](respondWithResult(_0x5247af,null))['catch'](handleError(_0x5247af,null));};exports[_0x8d14('0x23')]=function(_0x931067,_0x486c6a){return db[_0x8d14('0x29')][_0x8d14('0x43')]({'where':{'id':_0x931067[_0x8d14('0x40')]['id']}})[_0x8d14('0x22')](handleEntityNotFound(_0x486c6a,null))[_0x8d14('0x22')](removeEntity(_0x486c6a,null))['catch'](handleError(_0x486c6a,null));};exports[_0x8d14('0x47')]=function(_0x15a2b1,_0x325849,_0x1d68fa){var _0x12f692={};var _0x5a1ef6={};var _0x2afc99;var _0x3e16f9;return db[_0x8d14('0x29')]['findOne']({'where':{'id':_0x15a2b1[_0x8d14('0x40')]['id']}})[_0x8d14('0x22')](handleEntityNotFound(_0x325849,null))[_0x8d14('0x22')](function(_0x37cdcd){if(_0x37cdcd){_0x2afc99=_0x37cdcd;_0x5a1ef6[_0x8d14('0x2e')]=_[_0x8d14('0x30')](db[_0x8d14('0x48')][_0x8d14('0x2a')]);_0x5a1ef6[_0x8d14('0x2f')]=_[_0x8d14('0x30')](_0x15a2b1[_0x8d14('0x2f')]);_0x5a1ef6[_0x8d14('0x35')]=_[_0x8d14('0x49')](_0x5a1ef6[_0x8d14('0x2e')],_0x5a1ef6[_0x8d14('0x2f')]);_0x12f692[_0x8d14('0x31')]=_[_0x8d14('0x49')](_0x5a1ef6[_0x8d14('0x2e')],qs[_0x8d14('0x41')](_0x15a2b1['query']['fields']));_0x12f692[_0x8d14('0x31')]=_0x12f692[_0x8d14('0x31')][_0x8d14('0x42')]?_0x12f692[_0x8d14('0x31')]:_0x5a1ef6[_0x8d14('0x2e')];_0x12f692[_0x8d14('0x4a')]=qs[_0x8d14('0x33')](_0x15a2b1[_0x8d14('0x2f')][_0x8d14('0x33')]);_0x12f692[_0x8d14('0x34')]=qs[_0x8d14('0x35')](_['pick'](_0x15a2b1[_0x8d14('0x2f')],_0x5a1ef6[_0x8d14('0x35')]));if(_0x15a2b1['query'][_0x8d14('0x37')]){_0x12f692[_0x8d14('0x34')]=_[_0x8d14('0x38')](_0x12f692[_0x8d14('0x34')],{'$or':_[_0x8d14('0x28')](_0x12f692[_0x8d14('0x31')],function(_0x39bd6c){var _0x2d1384={};_0x2d1384[_0x39bd6c]={'$like':'%'+_0x15a2b1[_0x8d14('0x2f')][_0x8d14('0x37')]+'%'};return _0x2d1384;})});}_0x12f692=_[_0x8d14('0x38')]({},_0x12f692,_0x15a2b1[_0x8d14('0x4b')]);return _0x2afc99['getConfigurations'](_0x12f692);}})[_0x8d14('0x22')](function(_0x2ca6d3){if(_0x2ca6d3){_0x3e16f9=_0x2ca6d3[_0x8d14('0x42')];if(!_0x15a2b1[_0x8d14('0x2f')][_0x8d14('0x32')]('nolimit')){_0x12f692['limit']=qs['limit'](_0x15a2b1[_0x8d14('0x2f')][_0x8d14('0x1d')]);_0x12f692['offset']=qs[_0x8d14('0x1b')](_0x15a2b1['query'][_0x8d14('0x1b')]);}return _0x2afc99[_0x8d14('0x47')](_0x12f692);}})[_0x8d14('0x22')](function(_0x201c11){if(_0x201c11){return _0x201c11?{'count':_0x3e16f9,'rows':_0x201c11}:null;}})[_0x8d14('0x22')](respondWithResult(_0x325849,null))[_0x8d14('0x3e')](handleError(_0x325849,null));};exports[_0x8d14('0x4c')]=function(_0x5ffec0,_0x4ac13c,_0x4fb0d7){if(_0x5ffec0[_0x8d14('0x46')]['id']){delete _0x5ffec0[_0x8d14('0x46')]['id'];}return db[_0x8d14('0x29')][_0x8d14('0x4d')]({'where':{'id':_0x5ffec0[_0x8d14('0x40')]['id']}})['then'](handleEntityNotFound(_0x4ac13c,null))[_0x8d14('0x22')](function(_0x4af58d){if(_0x4af58d){_0x5ffec0[_0x8d14('0x46')][_0x8d14('0x4e')]=_0x4af58d['id'];_0x5ffec0[_0x8d14('0x46')][_0x8d14('0x4f')]=integrations[_0x8d14('0x50')](_0x5ffec0[_0x8d14('0x46')][_0x8d14('0x51')],_0x5ffec0['body'][_0x8d14('0x2c')]);_0x5ffec0[_0x8d14('0x46')][_0x8d14('0x52')]=integrations[_0x8d14('0x53')](_0x5ffec0[_0x8d14('0x46')][_0x8d14('0x51')],_0x5ffec0['body'][_0x8d14('0x2c')]);return db[_0x8d14('0x48')][_0x8d14('0x44')](_0x5ffec0[_0x8d14('0x46')],{'include':[{'model':db[_0x8d14('0x54')],'as':'Subjects'},{'model':db[_0x8d14('0x54')],'as':_0x8d14('0x52')}]});}return null;})[_0x8d14('0x22')](respondWithResult(_0x4ac13c,null))[_0x8d14('0x3e')](handleError(_0x4ac13c,null));};exports[_0x8d14('0x55')]=function(_0x25575b,_0x2ea80a,_0x404279){var _0x41a2df;var _0x5e0553='';var _0xee3b4c='Task';return db[_0x8d14('0x29')]['findOne']({'where':{'id':_0x25575b[_0x8d14('0x40')]['id']},'attributes':['id',_0x8d14('0x56'),_0x8d14('0x57'),'clientSecret',_0x8d14('0x58'),_0x8d14('0x59'),'securityToken']})[_0x8d14('0x22')](handleEntityNotFound(_0x2ea80a,null))[_0x8d14('0x22')](function(_0x5ca005){if(_0x5ca005){_0x5e0553=_0x5ca005[_0x8d14('0x56')];var _0x4ec767=_0x5e0553[_0x8d14('0x5a')](-0x1);if(_0x4ec767==='/'){_0x5e0553=_0x5e0553['substring'](0x0,_0x5e0553[_0x8d14('0x5b')](_0x4ec767));}_0x41a2df=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5e0553,'clientId':_0x5ca005[_0x8d14('0x57')],'clientSecret':_0x5ca005[_0x8d14('0x5c')]}});return _0x41a2df[_0x8d14('0x5d')](_0x5ca005[_0x8d14('0x58')],_0x5ca005[_0x8d14('0x59')][_0x8d14('0x5e')](_0x5ca005[_0x8d14('0x5f')]));}})[_0x8d14('0x22')](function(_0x3717d6){if(_0x3717d6){if(!_[_0x8d14('0x60')](_0x25575b['query']['ticketType'])){_0xee3b4c=_0x25575b[_0x8d14('0x2f')]['ticketType'];}return _0x41a2df[_0x8d14('0x61')](_0xee3b4c)[_0x8d14('0x62')]();}})[_0x8d14('0x22')](function(_0x3f9012){var _0x4ecee4=[_0x8d14('0x63'),_0x8d14('0x64'),_0x8d14('0x65'),_0x8d14('0x66'),_0x8d14('0x67'),'Description'];var _0x2dd490=[_0x8d14('0x68'),_0x8d14('0x69'),_0x8d14('0x6a'),_0x8d14('0x6b'),_0x8d14('0x6c'),_0x8d14('0x6d'),'phone'];if(_0x3f9012){_[_0x8d14('0x6e')](_0x3f9012['fields'],function(_0x1c6d14){return _0x4ecee4[_0x8d14('0x6f')](_0x1c6d14[_0x8d14('0x26')])||!_0x2dd490['includes'](_0x1c6d14[_0x8d14('0x2c')]);});return{'count':_0x3f9012[_0x8d14('0x41')][_0x8d14('0x42')],'rows':_['map'](_0x3f9012['fields'],function(_0x4cc123){return{'id':_0x4cc123[_0x8d14('0x26')],'name':_0x4cc123[_0x8d14('0x70')],'custom':_0x4cc123['custom'],'options':_0x4cc123[_0x8d14('0x71')][_0x8d14('0x42')]>0x0?_[_0x8d14('0x28')](_0x4cc123[_0x8d14('0x71')],function(_0x248457){return{'name':_0x248457[_0x8d14('0x70')],'value':_0x248457[_0x8d14('0x72')]};}):_0x4cc123[_0x8d14('0x2c')]==_0x8d14('0x6b')?[{'name':_0x8d14('0x73'),'value':_0x8d14('0x74')},{'name':_0x8d14('0x75'),'value':'false'}]:[]};})};}})[_0x8d14('0x22')](respondWithResult(_0x2ea80a,null))['catch'](function(_0x5af4ea){var _0x5c8df4=_0x25575b[_0x8d14('0x2f')]['test']?0x1f4:_0x5af4ea[_0x8d14('0x76')]||0x1f4;logger[_0x8d14('0x24')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5c8df4,JSON[_0x8d14('0x77')](_0x5af4ea));delete _0x5af4ea[_0x8d14('0x26')];if(_0x5c8df4===0x191){_0x5c8df4=0x190;}_0x2ea80a[_0x8d14('0x18')](_0x5c8df4)[_0x8d14('0x27')](_0x25575b[_0x8d14('0x2f')][_0x8d14('0x78')]?{'message':_0x8d14('0x79'),'statusCode':_0x5af4ea[_0x8d14('0x76')]}:_0x5af4ea);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 315240d..1f79d68 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 _0xa1c0=['util','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','lodash'];(function(_0x130766,_0x4d746e){var _0x3919fe=function(_0x563fd3){while(--_0x563fd3){_0x130766['push'](_0x130766['shift']());}};_0x3919fe(++_0x4d746e);}(_0xa1c0,0x1ac));var _0x0a1c=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xa1c0[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x0a1c('0x0'));var util=require(_0x0a1c('0x1'));var logger=require('../../config/logger')(_0x0a1c('0x2'));var moment=require(_0x0a1c('0x3'));var BPromise=require(_0x0a1c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a1c('0x5'));var rimraf=require(_0x0a1c('0x6'));var config=require(_0x0a1c('0x7'));var attributes=require(_0x0a1c('0x8'));var integrations=require(_0x0a1c('0x9'));module[_0x0a1c('0xa')]=function(_0x5b8f9a,_0x300325){return _0x5b8f9a['define'](_0x0a1c('0xb'),attributes,{'tableName':_0x0a1c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda51=['rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','util','request-promise','path'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0xda51,0x7f));var _0x1da5=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0xda51[_0xccf869];return _0x21a9db;};'use strict';var _=require('lodash');var util=require(_0x1da5('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1da5('0x1'));var fs=require('fs');var path=require(_0x1da5('0x2'));var rimraf=require(_0x1da5('0x3'));var config=require(_0x1da5('0x4'));var attributes=require(_0x1da5('0x5'));var integrations=require(_0x1da5('0x6'));module[_0x1da5('0x7')]=function(_0x5b191b,_0x24740c){return _0x5b191b['define'](_0x1da5('0x8'),attributes,{'tableName':_0x1da5('0x9'),'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 a0348cc..c2ea18f 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 _0xacfb=['GetSalesforceAccount','findAll','raw','options','where','attributes','include','model','map','then','ShowSalesforceAccount','SalesforceAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceAccount,\x20%s,\x20%s','message','info','result','catch'];(function(_0x554371,_0x327276){var _0x29165e=function(_0x483dbc){while(--_0x483dbc){_0x554371['push'](_0x554371['shift']());}};_0x29165e(++_0x327276);}(_0xacfb,0x95));var _0xbacf=function(_0xe5b43,_0x27e05c){_0xe5b43=_0xe5b43-0x0;var _0x423da8=_0xacfb[_0xe5b43];return _0x423da8;};'use strict';var _=require('lodash');var util=require(_0xbacf('0x0'));var moment=require('moment');var BPromise=require(_0xbacf('0x1'));var rs=require(_0xbacf('0x2'));var fs=require('fs');var Redis=require(_0xbacf('0x3'));var db=require(_0xbacf('0x4'))['db'];var utils=require(_0xbacf('0x5'));var logger=require(_0xbacf('0x6'))(_0xbacf('0x7'));var config=require(_0xbacf('0x8'));var jayson=require(_0xbacf('0x9'));var client=jayson[_0xbacf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a2535,_0xfc31df,_0x56dbf2){return new BPromise(function(_0x44c330,_0x3f4cc2){return client['request'](_0x1a2535,_0x56dbf2)['then'](function(_0x1c2478){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0xfc31df,_0xbacf('0xb'));logger[_0xbacf('0xc')](_0xbacf('0xd'),_0xfc31df,_0xbacf('0xb'),JSON[_0xbacf('0xe')](_0x1c2478));if(_0x1c2478['error']){if(_0x1c2478[_0xbacf('0xf')]['code']===0x1f4){logger[_0xbacf('0xf')](_0xbacf('0x10'),_0xfc31df,_0x1c2478[_0xbacf('0xf')][_0xbacf('0x11')]);return _0x3f4cc2(_0x1c2478[_0xbacf('0xf')][_0xbacf('0x11')]);}logger[_0xbacf('0xf')](_0xbacf('0x10'),_0xfc31df,_0x1c2478['error']['message']);return _0x44c330(_0x1c2478[_0xbacf('0xf')][_0xbacf('0x11')]);}else{logger[_0xbacf('0x12')](_0xbacf('0x10'),_0xfc31df,_0xbacf('0xb'));_0x44c330(_0x1c2478[_0xbacf('0x13')][_0xbacf('0x11')]);}})[_0xbacf('0x14')](function(_0x36ee55){logger[_0xbacf('0xf')](_0xbacf('0x10'),_0xfc31df,_0x36ee55);_0x3f4cc2(_0x36ee55);});});}exports[_0xbacf('0x15')]=function(_0x2266b8){var _0x3e33ea=this;return new Promise(function(_0x505ec5,_0x2439e3){return db['SalesforceAccount'][_0xbacf('0x16')]({'raw':_0x2266b8['options']?_0x2266b8['options'][_0xbacf('0x17')]===undefined?!![]:![]:!![],'where':_0x2266b8[_0xbacf('0x18')]?_0x2266b8['options'][_0xbacf('0x19')]||null:null,'attributes':_0x2266b8[_0xbacf('0x18')]?_0x2266b8['options'][_0xbacf('0x1a')]||null:null,'limit':_0x2266b8['options']?_0x2266b8['options']['limit']||null:null,'include':_0x2266b8['options']?_0x2266b8[_0xbacf('0x18')]['include']?_['map'](_0x2266b8[_0xbacf('0x18')][_0xbacf('0x1b')],function(_0xb55f7b){return{'model':db[_0xb55f7b[_0xbacf('0x1c')]],'as':_0xb55f7b['as'],'attributes':_0xb55f7b[_0xbacf('0x1a')],'include':_0xb55f7b[_0xbacf('0x1b')]?_[_0xbacf('0x1d')](_0xb55f7b[_0xbacf('0x1b')],function(_0x5ee6f){return{'model':db[_0x5ee6f[_0xbacf('0x1c')]],'as':_0x5ee6f['as'],'attributes':_0x5ee6f['attributes'],'include':_0x5ee6f[_0xbacf('0x1b')]?_[_0xbacf('0x1d')](_0x5ee6f['include'],function(_0x44f07c){return{'model':db[_0x44f07c[_0xbacf('0x1c')]],'as':_0x44f07c['as'],'attributes':_0x44f07c[_0xbacf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbacf('0x1e')](function(_0x981a4f){logger[_0xbacf('0x12')]('GetSalesforceAccount',_0x2266b8);logger[_0xbacf('0xc')](_0xbacf('0x15'),_0x2266b8,JSON[_0xbacf('0xe')](_0x981a4f));_0x505ec5(_0x981a4f);})[_0xbacf('0x14')](function(_0x16bd9e){logger['error']('GetSalesforceAccount',_0x16bd9e[_0xbacf('0x11')],_0x2266b8);_0x2439e3(_0x3e33ea[_0xbacf('0xf')](0x1f4,_0x16bd9e[_0xbacf('0x11')]));});});};exports[_0xbacf('0x1f')]=function(_0x1d7dae){var _0x4f54ca=this;return new Promise(function(_0x5e67cc,_0x25c999){return db[_0xbacf('0x20')][_0xbacf('0x21')]({'raw':_0x1d7dae[_0xbacf('0x18')]?_0x1d7dae['options'][_0xbacf('0x17')]===undefined?!![]:![]:!![],'where':_0x1d7dae[_0xbacf('0x18')]?_0x1d7dae[_0xbacf('0x18')][_0xbacf('0x19')]||null:null,'attributes':_0x1d7dae[_0xbacf('0x18')]?_0x1d7dae[_0xbacf('0x18')][_0xbacf('0x1a')]||null:null,'include':_0x1d7dae[_0xbacf('0x18')]?_0x1d7dae[_0xbacf('0x18')]['include']?_['map'](_0x1d7dae[_0xbacf('0x18')]['include'],function(_0x1274ec){return{'model':db[_0x1274ec[_0xbacf('0x1c')]],'as':_0x1274ec['as'],'attributes':_0x1274ec['attributes'],'include':_0x1274ec[_0xbacf('0x1b')]?_['map'](_0x1274ec[_0xbacf('0x1b')],function(_0x3f82a4){return{'model':db[_0x3f82a4[_0xbacf('0x1c')]],'as':_0x3f82a4['as'],'attributes':_0x3f82a4[_0xbacf('0x1a')],'include':_0x3f82a4[_0xbacf('0x1b')]?_[_0xbacf('0x1d')](_0x3f82a4[_0xbacf('0x1b')],function(_0x361a09){return{'model':db[_0x361a09['model']],'as':_0x361a09['as'],'attributes':_0x361a09[_0xbacf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbacf('0x1e')](function(_0x791920){logger[_0xbacf('0x12')](_0xbacf('0x1f'),_0x1d7dae);logger[_0xbacf('0xc')](_0xbacf('0x1f'),_0x1d7dae,JSON['stringify'](_0x791920));_0x5e67cc(_0x791920);})[_0xbacf('0x14')](function(_0x29240d){logger[_0xbacf('0xf')](_0xbacf('0x1f'),_0x29240d[_0xbacf('0x11')],_0x1d7dae);_0x25c999(_0x4f54ca[_0xbacf('0xf')](0x1f4,_0x29240d['message']));});});}; \ No newline at end of file +var _0x0470=['catch','GetSalesforceAccount','SalesforceAccount','options','raw','limit','include','attributes','model','map','then','find','where','ShowSalesforceAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3b326a,_0xc148a7){var _0x44de9b=function(_0x4c5840){while(--_0x4c5840){_0x3b326a['push'](_0x3b326a['shift']());}};_0x44de9b(++_0xc148a7);}(_0x0470,0xa6));var _0x0047=function(_0x803367,_0x5ba786){_0x803367=_0x803367-0x0;var _0x44d869=_0x0470[_0x803367];return _0x44d869;};'use strict';var _=require('lodash');var util=require(_0x0047('0x0'));var moment=require(_0x0047('0x1'));var BPromise=require(_0x0047('0x2'));var rs=require(_0x0047('0x3'));var fs=require('fs');var Redis=require(_0x0047('0x4'));var db=require(_0x0047('0x5'))['db'];var utils=require(_0x0047('0x6'));var logger=require(_0x0047('0x7'))(_0x0047('0x8'));var config=require(_0x0047('0x9'));var jayson=require(_0x0047('0xa'));var client=jayson[_0x0047('0xb')][_0x0047('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c4b13,_0x3cf7e8,_0x599282){return new BPromise(function(_0x45545d,_0x5d8037){return client[_0x0047('0xd')](_0x1c4b13,_0x599282)['then'](function(_0x133a4b){logger[_0x0047('0xe')](_0x0047('0xf'),_0x3cf7e8,_0x0047('0x10'));logger[_0x0047('0x11')](_0x0047('0x12'),_0x3cf7e8,'request\x20sent',JSON[_0x0047('0x13')](_0x133a4b));if(_0x133a4b['error']){if(_0x133a4b[_0x0047('0x14')][_0x0047('0x15')]===0x1f4){logger[_0x0047('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0x3cf7e8,_0x133a4b[_0x0047('0x14')][_0x0047('0x16')]);return _0x5d8037(_0x133a4b[_0x0047('0x14')]['message']);}logger[_0x0047('0x14')](_0x0047('0xf'),_0x3cf7e8,_0x133a4b[_0x0047('0x14')]['message']);return _0x45545d(_0x133a4b['error']['message']);}else{logger[_0x0047('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x3cf7e8,_0x0047('0x10'));_0x45545d(_0x133a4b[_0x0047('0x17')][_0x0047('0x16')]);}})[_0x0047('0x18')](function(_0x2f1af0){logger[_0x0047('0x14')](_0x0047('0xf'),_0x3cf7e8,_0x2f1af0);_0x5d8037(_0x2f1af0);});});}exports[_0x0047('0x19')]=function(_0x2f05e){var _0x61b57d=this;return new Promise(function(_0x15e57b,_0xb3b64a){return db[_0x0047('0x1a')]['findAll']({'raw':_0x2f05e['options']?_0x2f05e[_0x0047('0x1b')][_0x0047('0x1c')]===undefined?!![]:![]:!![],'where':_0x2f05e[_0x0047('0x1b')]?_0x2f05e[_0x0047('0x1b')]['where']||null:null,'attributes':_0x2f05e[_0x0047('0x1b')]?_0x2f05e['options']['attributes']||null:null,'limit':_0x2f05e[_0x0047('0x1b')]?_0x2f05e[_0x0047('0x1b')][_0x0047('0x1d')]||null:null,'include':_0x2f05e[_0x0047('0x1b')]?_0x2f05e[_0x0047('0x1b')][_0x0047('0x1e')]?_['map'](_0x2f05e[_0x0047('0x1b')][_0x0047('0x1e')],function(_0x462ed4){return{'model':db[_0x462ed4['model']],'as':_0x462ed4['as'],'attributes':_0x462ed4[_0x0047('0x1f')],'include':_0x462ed4['include']?_['map'](_0x462ed4['include'],function(_0xc60ae4){return{'model':db[_0xc60ae4[_0x0047('0x20')]],'as':_0xc60ae4['as'],'attributes':_0xc60ae4['attributes'],'include':_0xc60ae4[_0x0047('0x1e')]?_[_0x0047('0x21')](_0xc60ae4[_0x0047('0x1e')],function(_0xf9257f){return{'model':db[_0xf9257f['model']],'as':_0xf9257f['as'],'attributes':_0xf9257f[_0x0047('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0047('0x22')](function(_0x3504e2){logger[_0x0047('0xe')](_0x0047('0x19'),_0x2f05e);logger[_0x0047('0x11')](_0x0047('0x19'),_0x2f05e,JSON[_0x0047('0x13')](_0x3504e2));_0x15e57b(_0x3504e2);})[_0x0047('0x18')](function(_0x3b0ec5){logger[_0x0047('0x14')](_0x0047('0x19'),_0x3b0ec5[_0x0047('0x16')],_0x2f05e);_0xb3b64a(_0x61b57d[_0x0047('0x14')](0x1f4,_0x3b0ec5['message']));});});};exports['ShowSalesforceAccount']=function(_0x4d3f04){var _0x522db6=this;return new Promise(function(_0x1a08d8,_0x37d3fa){return db['SalesforceAccount'][_0x0047('0x23')]({'raw':_0x4d3f04[_0x0047('0x1b')]?_0x4d3f04[_0x0047('0x1b')][_0x0047('0x1c')]===undefined?!![]:![]:!![],'where':_0x4d3f04['options']?_0x4d3f04[_0x0047('0x1b')][_0x0047('0x24')]||null:null,'attributes':_0x4d3f04[_0x0047('0x1b')]?_0x4d3f04[_0x0047('0x1b')]['attributes']||null:null,'include':_0x4d3f04[_0x0047('0x1b')]?_0x4d3f04[_0x0047('0x1b')]['include']?_[_0x0047('0x21')](_0x4d3f04[_0x0047('0x1b')][_0x0047('0x1e')],function(_0x429206){return{'model':db[_0x429206['model']],'as':_0x429206['as'],'attributes':_0x429206[_0x0047('0x1f')],'include':_0x429206[_0x0047('0x1e')]?_[_0x0047('0x21')](_0x429206[_0x0047('0x1e')],function(_0x1f388a){return{'model':db[_0x1f388a['model']],'as':_0x1f388a['as'],'attributes':_0x1f388a[_0x0047('0x1f')],'include':_0x1f388a[_0x0047('0x1e')]?_[_0x0047('0x21')](_0x1f388a[_0x0047('0x1e')],function(_0x2d0aaf){return{'model':db[_0x2d0aaf[_0x0047('0x20')]],'as':_0x2d0aaf['as'],'attributes':_0x2d0aaf[_0x0047('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0047('0x22')](function(_0x513788){logger[_0x0047('0xe')](_0x0047('0x25'),_0x4d3f04);logger[_0x0047('0x11')](_0x0047('0x25'),_0x4d3f04,JSON[_0x0047('0x13')](_0x513788));_0x1a08d8(_0x513788);})[_0x0047('0x18')](function(_0x19ba8e){logger['error'](_0x0047('0x25'),_0x19ba8e['message'],_0x4d3f04);_0x37d3fa(_0x522db6[_0x0047('0x14')](0x1f4,_0x19ba8e[_0x0047('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 1a998c1..25a0d24 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 _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x2a6dca,_0x28df07){var _0x335f65=function(_0x1a7aba){while(--_0x1a7aba){_0x2a6dca['push'](_0x2a6dca['shift']());}};_0x335f65(++_0x28df07);}(_0x2ef3,0xba));var _0x32ef=function(_0x4b137d,_0x39b817){_0x4b137d=_0x4b137d-0x0;var _0x3d183e=_0x2ef3[_0x4b137d];return _0x3d183e;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x5c5c99,_0x16ef59){var _0x499dba=function(_0x5d040a){while(--_0x5d040a){_0x5c5c99['push'](_0x5c5c99['shift']());}};_0x499dba(++_0x16ef59);}(_0xadb5,0xad));var _0x5adb=function(_0x4bcf6b,_0x490ae8){_0x4bcf6b=_0x4bcf6b-0x0;var _0xb75bbe=_0xadb5[_0x4bcf6b];return _0xb75bbe;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 88342ac..e9debe0 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 _0x94df=['STRING','ENUM','Task','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','exports'];(function(_0x5c6337,_0x3b5e96){var _0x4aba56=function(_0x2af5f4){while(--_0x2af5f4){_0x5c6337['push'](_0x5c6337['shift']());}};_0x4aba56(++_0x3b5e96);}(_0x94df,0xa3));var _0xf94d=function(_0x9186ec,_0x344bd2){_0x9186ec=_0x9186ec-0x0;var _0x178b5b=_0x94df[_0x9186ec];return _0x178b5b;};'use strict';var Sequelize=require(_0xf94d('0x0'));module[_0xf94d('0x1')]={'name':{'type':Sequelize[_0xf94d('0x2')]},'description':{'type':Sequelize[_0xf94d('0x2')]},'ticketType':{'type':Sequelize[_0xf94d('0x3')](_0xf94d('0x4'),'Case'),'defaultValue':_0xf94d('0x4')},'moduleSearch':{'type':Sequelize[_0xf94d('0x3')](_0xf94d('0x5'),_0xf94d('0x6'),_0xf94d('0x7'),_0xf94d('0x8'),_0xf94d('0x9')),'defaultValue':_0xf94d('0x5')},'moduleCreate':{'type':Sequelize[_0xf94d('0x3')](_0xf94d('0xa'),_0xf94d('0x6'),'lead',_0xf94d('0x9')),'defaultValue':_0xf94d('0x7')},'leadId':{'type':Sequelize[_0xf94d('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xf94d('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xf94d('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xf94d('0x2')]}}; \ No newline at end of file +var _0xc2af=['contact','lead','account','sequelize','STRING','ENUM','Task','Case','contact_lead'];(function(_0x455431,_0x2ef8f6){var _0x868176=function(_0x305b49){while(--_0x305b49){_0x455431['push'](_0x455431['shift']());}};_0x868176(++_0x2ef8f6);}(_0xc2af,0x1bc));var _0xfc2a=function(_0x4e5dc8,_0xb5e524){_0x4e5dc8=_0x4e5dc8-0x0;var _0x2faef0=_0xc2af[_0x4e5dc8];return _0x2faef0;};'use strict';var Sequelize=require(_0xfc2a('0x0'));module['exports']={'name':{'type':Sequelize[_0xfc2a('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xfc2a('0x2')](_0xfc2a('0x3'),_0xfc2a('0x4')),'defaultValue':_0xfc2a('0x3')},'moduleSearch':{'type':Sequelize[_0xfc2a('0x2')](_0xfc2a('0x5'),_0xfc2a('0x6'),_0xfc2a('0x7'),'account_contact_lead',_0xfc2a('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xfc2a('0x2')]('nothing',_0xfc2a('0x6'),_0xfc2a('0x7'),_0xfc2a('0x8')),'defaultValue':_0xfc2a('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xfc2a('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xfc2a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 6ce6f53..a533f0b 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 _0xd19d=['Content-Range','reject','save','update','then','sendStatus','name','send','index','map','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','SalesforceConfiguration','includeAll','include','catch','show','params','rawAttributes','options','find','create','body','destroy','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','limit','count','offset','status','set'];(function(_0x26544f,_0x79f614){var _0x2fff64=function(_0x4d1a11){while(--_0x4d1a11){_0x26544f['push'](_0x26544f['shift']());}};_0x2fff64(++_0x79f614);}(_0xd19d,0x79));var _0xdd19=function(_0x2a3dd7,_0x49651d){_0x2a3dd7=_0x2a3dd7-0x0;var _0xe8b7df=_0xd19d[_0x2a3dd7];return _0xe8b7df;};'use strict';var emlformat=require(_0xdd19('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdd19('0x1'));var BPromise=require(_0xdd19('0x2'));var Mustache=require(_0xdd19('0x3'));var util=require('util');var path=require(_0xdd19('0x4'));var sox=require('sox');var csv=require(_0xdd19('0x5'));var ejs=require(_0xdd19('0x6'));var fs=require('fs');var fs_extra=require(_0xdd19('0x7'));var _=require(_0xdd19('0x8'));var squel=require(_0xdd19('0x9'));var crypto=require(_0xdd19('0xa'));var jsforce=require(_0xdd19('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdd19('0x5'));var querystring=require(_0xdd19('0xc'));var Papa=require(_0xdd19('0xd'));var Redis=require('ioredis');var authService=require(_0xdd19('0xe'));var qs=require(_0xdd19('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd19('0x10'))('api');var utils=require(_0xdd19('0x11'));var config=require(_0xdd19('0x12'));var licenseUtil=require(_0xdd19('0x13'));var db=require(_0xdd19('0x14'))['db'];function respondWithStatusCode(_0x4797d8,_0x139173){_0x139173=_0x139173||0xcc;return function(_0x234b48){if(_0x234b48){return _0x4797d8['sendStatus'](_0x139173);}return _0x4797d8['status'](_0x139173)[_0xdd19('0x15')]();};}function respondWithResult(_0x58b6d3,_0x131901){_0x131901=_0x131901||0xc8;return function(_0x5e5a5b){if(_0x5e5a5b){return _0x58b6d3['status'](_0x131901)[_0xdd19('0x16')](_0x5e5a5b);}};}function respondWithFilteredResult(_0xf96661,_0xdeee1f){return function(_0x56b0e7){if(_0x56b0e7){var _0x489da4=typeof _0xdeee1f['offset']===_0xdd19('0x17')&&typeof _0xdeee1f[_0xdd19('0x18')]===_0xdd19('0x17');var _0x34d3e9=_0x56b0e7[_0xdd19('0x19')];var _0xe3207a=_0x489da4?0x0:_0xdeee1f[_0xdd19('0x1a')];var _0x46d9cb=_0x489da4?_0x56b0e7['count']:_0xdeee1f['offset']+_0xdeee1f['limit'];var _0x42063f;if(_0x46d9cb>=_0x34d3e9){_0x46d9cb=_0x34d3e9;_0x42063f=0xc8;}else{_0x42063f=0xce;}_0xf96661[_0xdd19('0x1b')](_0x42063f);return _0xf96661[_0xdd19('0x1c')](_0xdd19('0x1d'),_0xe3207a+'-'+_0x46d9cb+'/'+_0x34d3e9)[_0xdd19('0x16')](_0x56b0e7);}return null;};}function patchUpdates(_0x50a964){return function(_0x351cc5){try{jsonpatch['apply'](_0x351cc5,_0x50a964,!![]);}catch(_0x440f15){return BPromise[_0xdd19('0x1e')](_0x440f15);}return _0x351cc5[_0xdd19('0x1f')]();};}function saveUpdates(_0x4754c7,_0x4d6994){return function(_0x5deaea){if(_0x5deaea){return _0x5deaea[_0xdd19('0x20')](_0x4754c7)[_0xdd19('0x21')](function(_0x3bc4ac){return _0x3bc4ac;});}return null;};}function removeEntity(_0x397fee,_0x329c93){return function(_0x3b669a){if(_0x3b669a){return _0x3b669a['destroy']()[_0xdd19('0x21')](function(){_0x397fee[_0xdd19('0x1b')](0xcc)[_0xdd19('0x15')]();});}};}function handleEntityNotFound(_0x4f83be,_0x4d59f9){return function(_0x26be6f){if(!_0x26be6f){_0x4f83be[_0xdd19('0x22')](0x194);}return _0x26be6f;};}function handleError(_0x10ef39,_0x5b0b70){_0x5b0b70=_0x5b0b70||0x1f4;return function(_0x5569ec){logger['error'](_0x5569ec['stack']);if(_0x5569ec[_0xdd19('0x23')]){delete _0x5569ec[_0xdd19('0x23')];}_0x10ef39[_0xdd19('0x1b')](_0x5b0b70)[_0xdd19('0x24')](_0x5569ec);};}exports[_0xdd19('0x25')]=function(_0x1b23fc,_0x259ef5){var _0x4a97e8={},_0x4d91f8={},_0x8cdf84={'count':0x0,'rows':[]};var _0x1dffee=_[_0xdd19('0x26')](db['SalesforceConfiguration']['rawAttributes'],function(_0x30ba22){return{'name':_0x30ba22[_0xdd19('0x27')],'type':_0x30ba22['type'][_0xdd19('0x28')]};});_0x4d91f8[_0xdd19('0x29')]=_['map'](_0x1dffee,_0xdd19('0x23'));_0x4d91f8['query']=_[_0xdd19('0x2a')](_0x1b23fc['query']);_0x4d91f8[_0xdd19('0x2b')]=_[_0xdd19('0x2c')](_0x4d91f8[_0xdd19('0x29')],_0x4d91f8[_0xdd19('0x2d')]);_0x4a97e8['attributes']=_[_0xdd19('0x2c')](_0x4d91f8['model'],qs[_0xdd19('0x2e')](_0x1b23fc[_0xdd19('0x2d')][_0xdd19('0x2e')]));_0x4a97e8[_0xdd19('0x2f')]=_0x4a97e8[_0xdd19('0x2f')][_0xdd19('0x30')]?_0x4a97e8[_0xdd19('0x2f')]:_0x4d91f8[_0xdd19('0x29')];if(!_0x1b23fc[_0xdd19('0x2d')][_0xdd19('0x31')](_0xdd19('0x32'))){_0x4a97e8[_0xdd19('0x18')]=qs['limit'](_0x1b23fc[_0xdd19('0x2d')][_0xdd19('0x18')]);_0x4a97e8[_0xdd19('0x1a')]=qs['offset'](_0x1b23fc['query'][_0xdd19('0x1a')]);}_0x4a97e8[_0xdd19('0x33')]=qs[_0xdd19('0x34')](_0x1b23fc[_0xdd19('0x2d')][_0xdd19('0x34')]);_0x4a97e8[_0xdd19('0x35')]=qs[_0xdd19('0x2b')](_[_0xdd19('0x36')](_0x1b23fc[_0xdd19('0x2d')],_0x4d91f8[_0xdd19('0x2b')]),_0x1dffee);if(_0x1b23fc['query']['filter']){_0x4a97e8['where']=_[_0xdd19('0x37')](_0x4a97e8['where'],{'$or':_[_0xdd19('0x26')](_0x1dffee,function(_0xb1a727){if(_0xb1a727['type']!==_0xdd19('0x38')){var _0x33b60a={};_0x33b60a[_0xb1a727[_0xdd19('0x23')]]={'$like':'%'+_0x1b23fc[_0xdd19('0x2d')][_0xdd19('0x39')]+'%'};return _0x33b60a;}})});}_0x4a97e8=_[_0xdd19('0x37')]({},_0x4a97e8,_0x1b23fc['options']);var _0x47009b={'where':_0x4a97e8[_0xdd19('0x35')]};return db[_0xdd19('0x3a')][_0xdd19('0x19')](_0x47009b)[_0xdd19('0x21')](function(_0x45425d){_0x8cdf84[_0xdd19('0x19')]=_0x45425d;if(_0x1b23fc['query'][_0xdd19('0x3b')]){_0x4a97e8[_0xdd19('0x3c')]=[{'all':!![]}];}return db[_0xdd19('0x3a')]['findAll'](_0x4a97e8);})['then'](function(_0x100cd1){_0x8cdf84['rows']=_0x100cd1;return _0x8cdf84;})[_0xdd19('0x21')](respondWithFilteredResult(_0x259ef5,_0x4a97e8))[_0xdd19('0x3d')](handleError(_0x259ef5,null));};exports[_0xdd19('0x3e')]=function(_0x576180,_0x20d887){var _0x426ced={'raw':![],'where':{'id':_0x576180[_0xdd19('0x3f')]['id']}},_0xf60653={};_0xf60653[_0xdd19('0x29')]=_[_0xdd19('0x2a')](db[_0xdd19('0x3a')][_0xdd19('0x40')]);_0xf60653[_0xdd19('0x2d')]=_[_0xdd19('0x2a')](_0x576180['query']);_0xf60653[_0xdd19('0x2b')]=_[_0xdd19('0x2c')](_0xf60653[_0xdd19('0x29')],_0xf60653[_0xdd19('0x2d')]);_0x426ced[_0xdd19('0x2f')]=_[_0xdd19('0x2c')](_0xf60653[_0xdd19('0x29')],qs[_0xdd19('0x2e')](_0x576180[_0xdd19('0x2d')]['fields']));_0x426ced[_0xdd19('0x2f')]=_0x426ced[_0xdd19('0x2f')][_0xdd19('0x30')]?_0x426ced[_0xdd19('0x2f')]:_0xf60653[_0xdd19('0x29')];if(_0x576180[_0xdd19('0x2d')][_0xdd19('0x3b')]){_0x426ced[_0xdd19('0x3c')]=[{'all':!![]}];}_0x426ced=_[_0xdd19('0x37')]({},_0x426ced,_0x576180[_0xdd19('0x41')]);return db[_0xdd19('0x3a')][_0xdd19('0x42')](_0x426ced)[_0xdd19('0x21')](handleEntityNotFound(_0x20d887,null))[_0xdd19('0x21')](respondWithResult(_0x20d887,null))[_0xdd19('0x3d')](handleError(_0x20d887,null));};exports[_0xdd19('0x43')]=function(_0x32c33e,_0x3f5244){return db['SalesforceConfiguration'][_0xdd19('0x43')](_0x32c33e[_0xdd19('0x44')],{})['then'](respondWithResult(_0x3f5244,0xc9))[_0xdd19('0x3d')](handleError(_0x3f5244,null));};exports[_0xdd19('0x20')]=function(_0x3a2b9,_0x31c072){if(_0x3a2b9[_0xdd19('0x44')]['id']){delete _0x3a2b9[_0xdd19('0x44')]['id'];}return db[_0xdd19('0x3a')][_0xdd19('0x42')]({'where':{'id':_0x3a2b9['params']['id']}})[_0xdd19('0x21')](handleEntityNotFound(_0x31c072,null))['then'](saveUpdates(_0x3a2b9[_0xdd19('0x44')],null))[_0xdd19('0x21')](respondWithResult(_0x31c072,null))['catch'](handleError(_0x31c072,null));};exports[_0xdd19('0x45')]=function(_0x1cb603,_0x5e7b69){return db['SalesforceConfiguration'][_0xdd19('0x42')]({'where':{'id':_0x1cb603[_0xdd19('0x3f')]['id']}})[_0xdd19('0x21')](handleEntityNotFound(_0x5e7b69,null))['then'](removeEntity(_0x5e7b69,null))[_0xdd19('0x3d')](handleError(_0x5e7b69,null));};exports[_0xdd19('0x46')]=function(_0x508cf1,_0x450c84,_0x30d497){var _0x482963={};var _0x4877d5={};var _0xe0dd05;var _0x4704de;return db['SalesforceConfiguration'][_0xdd19('0x47')]({'where':{'id':_0x508cf1[_0xdd19('0x3f')]['id']}})[_0xdd19('0x21')](handleEntityNotFound(_0x450c84,null))[_0xdd19('0x21')](function(_0x2f86bc){if(_0x2f86bc){_0xe0dd05=_0x2f86bc;_0x4877d5[_0xdd19('0x29')]=_[_0xdd19('0x2a')](db[_0xdd19('0x48')][_0xdd19('0x40')]);_0x4877d5[_0xdd19('0x2d')]=_[_0xdd19('0x2a')](_0x508cf1[_0xdd19('0x2d')]);_0x4877d5['filters']=_[_0xdd19('0x2c')](_0x4877d5['model'],_0x4877d5[_0xdd19('0x2d')]);_0x482963[_0xdd19('0x2f')]=_[_0xdd19('0x2c')](_0x4877d5[_0xdd19('0x29')],qs[_0xdd19('0x2e')](_0x508cf1[_0xdd19('0x2d')][_0xdd19('0x2e')]));_0x482963[_0xdd19('0x2f')]=_0x482963[_0xdd19('0x2f')]['length']?_0x482963[_0xdd19('0x2f')]:_0x4877d5['model'];_0x482963['order']=qs[_0xdd19('0x34')](_0x508cf1[_0xdd19('0x2d')]['sort']);_0x482963[_0xdd19('0x35')]=qs[_0xdd19('0x2b')](_['pick'](_0x508cf1[_0xdd19('0x2d')],_0x4877d5[_0xdd19('0x2b')]));if(_0x508cf1['query']['filter']){_0x482963['where']=_['merge'](_0x482963[_0xdd19('0x35')],{'$or':_['map'](_0x482963[_0xdd19('0x2f')],function(_0x45f417){var _0x33c3e6={};_0x33c3e6[_0x45f417]={'$like':'%'+_0x508cf1[_0xdd19('0x2d')][_0xdd19('0x39')]+'%'};return _0x33c3e6;})});}_0x482963=_[_0xdd19('0x37')]({},_0x482963,_0x508cf1[_0xdd19('0x41')]);return _0xe0dd05['getFields'](_0x482963);}})[_0xdd19('0x21')](function(_0xf6871b){if(_0xf6871b){_0x4704de=_0xf6871b[_0xdd19('0x30')];if(!_0x508cf1[_0xdd19('0x2d')][_0xdd19('0x31')](_0xdd19('0x32'))){_0x482963[_0xdd19('0x18')]=qs[_0xdd19('0x18')](_0x508cf1[_0xdd19('0x2d')][_0xdd19('0x18')]);_0x482963[_0xdd19('0x1a')]=qs[_0xdd19('0x1a')](_0x508cf1[_0xdd19('0x2d')][_0xdd19('0x1a')]);}return _0xe0dd05[_0xdd19('0x46')](_0x482963);}})[_0xdd19('0x21')](function(_0x49d60d){if(_0x49d60d){return _0x49d60d?{'count':_0x4704de,'rows':_0x49d60d}:null;}})[_0xdd19('0x21')](respondWithResult(_0x450c84,null))[_0xdd19('0x3d')](handleError(_0x450c84,null));};exports[_0xdd19('0x49')]=function(_0x39d480,_0xfdf40b,_0x4727ca){var _0x9f474d={};var _0xce7a0f={};var _0x19b4b2;var _0x44627d;return db[_0xdd19('0x3a')][_0xdd19('0x47')]({'where':{'id':_0x39d480[_0xdd19('0x3f')]['id']}})[_0xdd19('0x21')](handleEntityNotFound(_0xfdf40b,null))[_0xdd19('0x21')](function(_0x440e51){if(_0x440e51){_0x19b4b2=_0x440e51;_0xce7a0f['model']=_['keys'](db[_0xdd19('0x48')][_0xdd19('0x40')]);_0xce7a0f[_0xdd19('0x2d')]=_[_0xdd19('0x2a')](_0x39d480[_0xdd19('0x2d')]);_0xce7a0f[_0xdd19('0x2b')]=_[_0xdd19('0x2c')](_0xce7a0f[_0xdd19('0x29')],_0xce7a0f['query']);_0x9f474d[_0xdd19('0x2f')]=_['intersection'](_0xce7a0f['model'],qs[_0xdd19('0x2e')](_0x39d480[_0xdd19('0x2d')]['fields']));_0x9f474d['attributes']=_0x9f474d[_0xdd19('0x2f')][_0xdd19('0x30')]?_0x9f474d['attributes']:_0xce7a0f[_0xdd19('0x29')];_0x9f474d['order']=qs[_0xdd19('0x34')](_0x39d480[_0xdd19('0x2d')]['sort']);_0x9f474d[_0xdd19('0x35')]=qs[_0xdd19('0x2b')](_['pick'](_0x39d480[_0xdd19('0x2d')],_0xce7a0f[_0xdd19('0x2b')]));if(_0x39d480[_0xdd19('0x2d')]['filter']){_0x9f474d['where']=_[_0xdd19('0x37')](_0x9f474d[_0xdd19('0x35')],{'$or':_['map'](_0x9f474d[_0xdd19('0x2f')],function(_0x3ebed7){var _0xecf49a={};_0xecf49a[_0x3ebed7]={'$like':'%'+_0x39d480[_0xdd19('0x2d')][_0xdd19('0x39')]+'%'};return _0xecf49a;})});}_0x9f474d=_['merge']({},_0x9f474d,_0x39d480[_0xdd19('0x41')]);return _0x19b4b2['getSubjects'](_0x9f474d);}})['then'](function(_0x2f736a){if(_0x2f736a){_0x44627d=_0x2f736a[_0xdd19('0x30')];if(!_0x39d480[_0xdd19('0x2d')][_0xdd19('0x31')](_0xdd19('0x32'))){_0x9f474d[_0xdd19('0x18')]=qs[_0xdd19('0x18')](_0x39d480[_0xdd19('0x2d')][_0xdd19('0x18')]);_0x9f474d[_0xdd19('0x1a')]=qs[_0xdd19('0x1a')](_0x39d480[_0xdd19('0x2d')][_0xdd19('0x1a')]);}return _0x19b4b2[_0xdd19('0x49')](_0x9f474d);}})['then'](function(_0x513416){if(_0x513416){return _0x513416?{'count':_0x44627d,'rows':_0x513416}:null;}})[_0xdd19('0x21')](respondWithResult(_0xfdf40b,null))[_0xdd19('0x3d')](handleError(_0xfdf40b,null));};exports[_0xdd19('0x4a')]=function(_0xb6909a,_0x12b878,_0x26b9d6){var _0x49ab3c={};var _0x2254a6={};var _0x233461;var _0x52e418;return db['SalesforceConfiguration'][_0xdd19('0x47')]({'where':{'id':_0xb6909a[_0xdd19('0x3f')]['id']}})[_0xdd19('0x21')](handleEntityNotFound(_0x12b878,null))[_0xdd19('0x21')](function(_0x8ae049){if(_0x8ae049){_0x233461=_0x8ae049;_0x2254a6[_0xdd19('0x29')]=_[_0xdd19('0x2a')](db[_0xdd19('0x48')]['rawAttributes']);_0x2254a6[_0xdd19('0x2d')]=_[_0xdd19('0x2a')](_0xb6909a[_0xdd19('0x2d')]);_0x2254a6['filters']=_['intersection'](_0x2254a6[_0xdd19('0x29')],_0x2254a6[_0xdd19('0x2d')]);_0x49ab3c['attributes']=_[_0xdd19('0x2c')](_0x2254a6[_0xdd19('0x29')],qs['fields'](_0xb6909a[_0xdd19('0x2d')][_0xdd19('0x2e')]));_0x49ab3c[_0xdd19('0x2f')]=_0x49ab3c[_0xdd19('0x2f')][_0xdd19('0x30')]?_0x49ab3c['attributes']:_0x2254a6[_0xdd19('0x29')];_0x49ab3c[_0xdd19('0x33')]=qs[_0xdd19('0x34')](_0xb6909a[_0xdd19('0x2d')][_0xdd19('0x34')]);_0x49ab3c[_0xdd19('0x35')]=qs[_0xdd19('0x2b')](_['pick'](_0xb6909a[_0xdd19('0x2d')],_0x2254a6[_0xdd19('0x2b')]));if(_0xb6909a[_0xdd19('0x2d')][_0xdd19('0x39')]){_0x49ab3c[_0xdd19('0x35')]=_[_0xdd19('0x37')](_0x49ab3c[_0xdd19('0x35')],{'$or':_['map'](_0x49ab3c[_0xdd19('0x2f')],function(_0x55d68d){var _0x6943f2={};_0x6943f2[_0x55d68d]={'$like':'%'+_0xb6909a[_0xdd19('0x2d')]['filter']+'%'};return _0x6943f2;})});}_0x49ab3c=_[_0xdd19('0x37')]({},_0x49ab3c,_0xb6909a[_0xdd19('0x41')]);return _0x233461['getDescriptions'](_0x49ab3c);}})[_0xdd19('0x21')](function(_0xdc27af){if(_0xdc27af){_0x52e418=_0xdc27af[_0xdd19('0x30')];if(!_0xb6909a[_0xdd19('0x2d')]['hasOwnProperty']('nolimit')){_0x49ab3c[_0xdd19('0x18')]=qs[_0xdd19('0x18')](_0xb6909a[_0xdd19('0x2d')]['limit']);_0x49ab3c[_0xdd19('0x1a')]=qs[_0xdd19('0x1a')](_0xb6909a['query'][_0xdd19('0x1a')]);}return _0x233461[_0xdd19('0x4a')](_0x49ab3c);}})['then'](function(_0x244f96){if(_0x244f96){return _0x244f96?{'count':_0x52e418,'rows':_0x244f96}:null;}})[_0xdd19('0x21')](respondWithResult(_0x12b878,null))['catch'](handleError(_0x12b878,null));}; \ No newline at end of file +var _0x50a5=['findAll','rows','catch','params','include','find','create','body','getFields','findOne','SalesforceField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','SalesforceConfiguration','rawAttributes','type','key','query','keys','filters','intersection','attributes','fields','length','model','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll'];(function(_0x35d568,_0x4d47ae){var _0x5dac84=function(_0x265aaf){while(--_0x265aaf){_0x35d568['push'](_0x35d568['shift']());}};_0x5dac84(++_0x4d47ae);}(_0x50a5,0x1e8));var _0x550a=function(_0x39ce09,_0x27ec39){_0x39ce09=_0x39ce09-0x0;var _0x22007b=_0x50a5[_0x39ce09];return _0x22007b;};'use strict';var emlformat=require(_0x550a('0x0'));var rimraf=require(_0x550a('0x1'));var zipdir=require(_0x550a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x550a('0x3'));var moment=require(_0x550a('0x4'));var BPromise=require(_0x550a('0x5'));var Mustache=require(_0x550a('0x6'));var util=require(_0x550a('0x7'));var path=require(_0x550a('0x8'));var sox=require(_0x550a('0x9'));var csv=require(_0x550a('0xa'));var ejs=require(_0x550a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x550a('0xc'));var crypto=require('crypto');var jsforce=require(_0x550a('0xd'));var deskjs=require(_0x550a('0xe'));var toCsv=require(_0x550a('0xa'));var querystring=require(_0x550a('0xf'));var Papa=require(_0x550a('0x10'));var Redis=require(_0x550a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x550a('0x12'));var hardwareService=require(_0x550a('0x13'));var logger=require('../../config/logger')(_0x550a('0x14'));var utils=require(_0x550a('0x15'));var config=require(_0x550a('0x16'));var licenseUtil=require(_0x550a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe54489,_0x33231d){_0x33231d=_0x33231d||0xcc;return function(_0x2af334){if(_0x2af334){return _0xe54489[_0x550a('0x18')](_0x33231d);}return _0xe54489[_0x550a('0x19')](_0x33231d)['end']();};}function respondWithResult(_0xed8c,_0x175b24){_0x175b24=_0x175b24||0xc8;return function(_0x544753){if(_0x544753){return _0xed8c[_0x550a('0x19')](_0x175b24)[_0x550a('0x1a')](_0x544753);}};}function respondWithFilteredResult(_0x508616,_0x3d18cd){return function(_0x4a0649){if(_0x4a0649){var _0x143feb=typeof _0x3d18cd[_0x550a('0x1b')]==='undefined'&&typeof _0x3d18cd[_0x550a('0x1c')]===_0x550a('0x1d');var _0x2e7a76=_0x4a0649[_0x550a('0x1e')];var _0x397015=_0x143feb?0x0:_0x3d18cd[_0x550a('0x1b')];var _0x5c5efe=_0x143feb?_0x4a0649['count']:_0x3d18cd[_0x550a('0x1b')]+_0x3d18cd[_0x550a('0x1c')];var _0x438be4;if(_0x5c5efe>=_0x2e7a76){_0x5c5efe=_0x2e7a76;_0x438be4=0xc8;}else{_0x438be4=0xce;}_0x508616[_0x550a('0x19')](_0x438be4);return _0x508616[_0x550a('0x1f')](_0x550a('0x20'),_0x397015+'-'+_0x5c5efe+'/'+_0x2e7a76)['json'](_0x4a0649);}return null;};}function patchUpdates(_0x599b2d){return function(_0x2193af){try{jsonpatch[_0x550a('0x21')](_0x2193af,_0x599b2d,!![]);}catch(_0x204d2c){return BPromise['reject'](_0x204d2c);}return _0x2193af['save']();};}function saveUpdates(_0x14c7e3,_0x22da0c){return function(_0x29a713){if(_0x29a713){return _0x29a713[_0x550a('0x22')](_0x14c7e3)[_0x550a('0x23')](function(_0x2c2625){return _0x2c2625;});}return null;};}function removeEntity(_0x4b2ae4,_0x33da72){return function(_0x3056d7){if(_0x3056d7){return _0x3056d7[_0x550a('0x24')]()[_0x550a('0x23')](function(){_0x4b2ae4['status'](0xcc)[_0x550a('0x25')]();});}};}function handleEntityNotFound(_0x3de0aa,_0x5188b7){return function(_0x195d6b){if(!_0x195d6b){_0x3de0aa[_0x550a('0x18')](0x194);}return _0x195d6b;};}function handleError(_0x518151,_0x330506){_0x330506=_0x330506||0x1f4;return function(_0x3ed9cf){logger[_0x550a('0x26')](_0x3ed9cf['stack']);if(_0x3ed9cf[_0x550a('0x27')]){delete _0x3ed9cf[_0x550a('0x27')];}_0x518151[_0x550a('0x19')](_0x330506)[_0x550a('0x28')](_0x3ed9cf);};}exports[_0x550a('0x29')]=function(_0x3f921e,_0x41f79e){var _0x5e48ba={},_0x255710={},_0x25b505={'count':0x0,'rows':[]};var _0x11e766=_[_0x550a('0x2a')](db[_0x550a('0x2b')][_0x550a('0x2c')],function(_0x533083){return{'name':_0x533083['fieldName'],'type':_0x533083[_0x550a('0x2d')][_0x550a('0x2e')]};});_0x255710['model']=_[_0x550a('0x2a')](_0x11e766,_0x550a('0x27'));_0x255710[_0x550a('0x2f')]=_[_0x550a('0x30')](_0x3f921e['query']);_0x255710[_0x550a('0x31')]=_[_0x550a('0x32')](_0x255710['model'],_0x255710['query']);_0x5e48ba[_0x550a('0x33')]=_['intersection'](_0x255710['model'],qs['fields'](_0x3f921e[_0x550a('0x2f')][_0x550a('0x34')]));_0x5e48ba['attributes']=_0x5e48ba[_0x550a('0x33')][_0x550a('0x35')]?_0x5e48ba[_0x550a('0x33')]:_0x255710[_0x550a('0x36')];if(!_0x3f921e['query']['hasOwnProperty'](_0x550a('0x37'))){_0x5e48ba[_0x550a('0x1c')]=qs['limit'](_0x3f921e[_0x550a('0x2f')]['limit']);_0x5e48ba[_0x550a('0x1b')]=qs[_0x550a('0x1b')](_0x3f921e['query']['offset']);}_0x5e48ba[_0x550a('0x38')]=qs[_0x550a('0x39')](_0x3f921e[_0x550a('0x2f')]['sort']);_0x5e48ba[_0x550a('0x3a')]=qs['filters'](_[_0x550a('0x3b')](_0x3f921e['query'],_0x255710[_0x550a('0x31')]),_0x11e766);if(_0x3f921e[_0x550a('0x2f')][_0x550a('0x3c')]){_0x5e48ba[_0x550a('0x3a')]=_['merge'](_0x5e48ba[_0x550a('0x3a')],{'$or':_[_0x550a('0x2a')](_0x11e766,function(_0x567a69){if(_0x567a69[_0x550a('0x2d')]!==_0x550a('0x3d')){var _0x160f46={};_0x160f46[_0x567a69[_0x550a('0x27')]]={'$like':'%'+_0x3f921e[_0x550a('0x2f')][_0x550a('0x3c')]+'%'};return _0x160f46;}})});}_0x5e48ba=_[_0x550a('0x3e')]({},_0x5e48ba,_0x3f921e[_0x550a('0x3f')]);var _0x13ef87={'where':_0x5e48ba[_0x550a('0x3a')]};return db[_0x550a('0x2b')][_0x550a('0x1e')](_0x13ef87)[_0x550a('0x23')](function(_0x251b29){_0x25b505[_0x550a('0x1e')]=_0x251b29;if(_0x3f921e[_0x550a('0x2f')][_0x550a('0x40')]){_0x5e48ba['include']=[{'all':!![]}];}return db[_0x550a('0x2b')][_0x550a('0x41')](_0x5e48ba);})[_0x550a('0x23')](function(_0x2fa9dd){_0x25b505[_0x550a('0x42')]=_0x2fa9dd;return _0x25b505;})[_0x550a('0x23')](respondWithFilteredResult(_0x41f79e,_0x5e48ba))[_0x550a('0x43')](handleError(_0x41f79e,null));};exports['show']=function(_0x54ede4,_0x16f263){var _0x1dd973={'raw':![],'where':{'id':_0x54ede4[_0x550a('0x44')]['id']}},_0x394c04={};_0x394c04[_0x550a('0x36')]=_[_0x550a('0x30')](db[_0x550a('0x2b')][_0x550a('0x2c')]);_0x394c04[_0x550a('0x2f')]=_[_0x550a('0x30')](_0x54ede4['query']);_0x394c04[_0x550a('0x31')]=_[_0x550a('0x32')](_0x394c04[_0x550a('0x36')],_0x394c04['query']);_0x1dd973[_0x550a('0x33')]=_['intersection'](_0x394c04['model'],qs[_0x550a('0x34')](_0x54ede4[_0x550a('0x2f')][_0x550a('0x34')]));_0x1dd973['attributes']=_0x1dd973[_0x550a('0x33')][_0x550a('0x35')]?_0x1dd973['attributes']:_0x394c04[_0x550a('0x36')];if(_0x54ede4[_0x550a('0x2f')]['includeAll']){_0x1dd973[_0x550a('0x45')]=[{'all':!![]}];}_0x1dd973=_[_0x550a('0x3e')]({},_0x1dd973,_0x54ede4[_0x550a('0x3f')]);return db[_0x550a('0x2b')][_0x550a('0x46')](_0x1dd973)[_0x550a('0x23')](handleEntityNotFound(_0x16f263,null))[_0x550a('0x23')](respondWithResult(_0x16f263,null))[_0x550a('0x43')](handleError(_0x16f263,null));};exports[_0x550a('0x47')]=function(_0x4910f9,_0x2da269){return db['SalesforceConfiguration'][_0x550a('0x47')](_0x4910f9[_0x550a('0x48')],{})[_0x550a('0x23')](respondWithResult(_0x2da269,0xc9))['catch'](handleError(_0x2da269,null));};exports[_0x550a('0x22')]=function(_0x2fd974,_0x3649e0){if(_0x2fd974[_0x550a('0x48')]['id']){delete _0x2fd974[_0x550a('0x48')]['id'];}return db['SalesforceConfiguration'][_0x550a('0x46')]({'where':{'id':_0x2fd974[_0x550a('0x44')]['id']}})[_0x550a('0x23')](handleEntityNotFound(_0x3649e0,null))[_0x550a('0x23')](saveUpdates(_0x2fd974['body'],null))[_0x550a('0x23')](respondWithResult(_0x3649e0,null))[_0x550a('0x43')](handleError(_0x3649e0,null));};exports[_0x550a('0x24')]=function(_0x17c0dd,_0x83a812){return db['SalesforceConfiguration'][_0x550a('0x46')]({'where':{'id':_0x17c0dd['params']['id']}})[_0x550a('0x23')](handleEntityNotFound(_0x83a812,null))[_0x550a('0x23')](removeEntity(_0x83a812,null))['catch'](handleError(_0x83a812,null));};exports[_0x550a('0x49')]=function(_0x218a73,_0x2e0b73,_0x54f897){var _0x536c31={};var _0x5b2e5d={};var _0xa284a8;var _0x3a9ab8;return db[_0x550a('0x2b')][_0x550a('0x4a')]({'where':{'id':_0x218a73[_0x550a('0x44')]['id']}})['then'](handleEntityNotFound(_0x2e0b73,null))[_0x550a('0x23')](function(_0x1a7da0){if(_0x1a7da0){_0xa284a8=_0x1a7da0;_0x5b2e5d[_0x550a('0x36')]=_[_0x550a('0x30')](db[_0x550a('0x4b')]['rawAttributes']);_0x5b2e5d[_0x550a('0x2f')]=_[_0x550a('0x30')](_0x218a73[_0x550a('0x2f')]);_0x5b2e5d['filters']=_[_0x550a('0x32')](_0x5b2e5d[_0x550a('0x36')],_0x5b2e5d['query']);_0x536c31['attributes']=_[_0x550a('0x32')](_0x5b2e5d[_0x550a('0x36')],qs['fields'](_0x218a73[_0x550a('0x2f')][_0x550a('0x34')]));_0x536c31[_0x550a('0x33')]=_0x536c31['attributes'][_0x550a('0x35')]?_0x536c31[_0x550a('0x33')]:_0x5b2e5d['model'];_0x536c31['order']=qs[_0x550a('0x39')](_0x218a73[_0x550a('0x2f')]['sort']);_0x536c31[_0x550a('0x3a')]=qs['filters'](_[_0x550a('0x3b')](_0x218a73[_0x550a('0x2f')],_0x5b2e5d['filters']));if(_0x218a73[_0x550a('0x2f')][_0x550a('0x3c')]){_0x536c31[_0x550a('0x3a')]=_[_0x550a('0x3e')](_0x536c31['where'],{'$or':_['map'](_0x536c31['attributes'],function(_0x4b5104){var _0x3a9da0={};_0x3a9da0[_0x4b5104]={'$like':'%'+_0x218a73[_0x550a('0x2f')][_0x550a('0x3c')]+'%'};return _0x3a9da0;})});}_0x536c31=_[_0x550a('0x3e')]({},_0x536c31,_0x218a73['options']);return _0xa284a8[_0x550a('0x49')](_0x536c31);}})[_0x550a('0x23')](function(_0x5e214d){if(_0x5e214d){_0x3a9ab8=_0x5e214d[_0x550a('0x35')];if(!_0x218a73[_0x550a('0x2f')][_0x550a('0x4c')]('nolimit')){_0x536c31[_0x550a('0x1c')]=qs[_0x550a('0x1c')](_0x218a73[_0x550a('0x2f')]['limit']);_0x536c31[_0x550a('0x1b')]=qs[_0x550a('0x1b')](_0x218a73['query'][_0x550a('0x1b')]);}return _0xa284a8[_0x550a('0x49')](_0x536c31);}})['then'](function(_0xfe83ff){if(_0xfe83ff){return _0xfe83ff?{'count':_0x3a9ab8,'rows':_0xfe83ff}:null;}})[_0x550a('0x23')](respondWithResult(_0x2e0b73,null))[_0x550a('0x43')](handleError(_0x2e0b73,null));};exports[_0x550a('0x4d')]=function(_0x37d523,_0x405fc7,_0x293e11){var _0x90cdb0={};var _0x46acf1={};var _0x32db51;var _0x24647e;return db[_0x550a('0x2b')][_0x550a('0x4a')]({'where':{'id':_0x37d523[_0x550a('0x44')]['id']}})[_0x550a('0x23')](handleEntityNotFound(_0x405fc7,null))[_0x550a('0x23')](function(_0x4aac28){if(_0x4aac28){_0x32db51=_0x4aac28;_0x46acf1[_0x550a('0x36')]=_['keys'](db[_0x550a('0x4b')][_0x550a('0x2c')]);_0x46acf1[_0x550a('0x2f')]=_[_0x550a('0x30')](_0x37d523[_0x550a('0x2f')]);_0x46acf1[_0x550a('0x31')]=_[_0x550a('0x32')](_0x46acf1['model'],_0x46acf1['query']);_0x90cdb0[_0x550a('0x33')]=_[_0x550a('0x32')](_0x46acf1[_0x550a('0x36')],qs[_0x550a('0x34')](_0x37d523['query'][_0x550a('0x34')]));_0x90cdb0['attributes']=_0x90cdb0[_0x550a('0x33')][_0x550a('0x35')]?_0x90cdb0[_0x550a('0x33')]:_0x46acf1[_0x550a('0x36')];_0x90cdb0[_0x550a('0x38')]=qs['sort'](_0x37d523[_0x550a('0x2f')][_0x550a('0x39')]);_0x90cdb0[_0x550a('0x3a')]=qs['filters'](_['pick'](_0x37d523[_0x550a('0x2f')],_0x46acf1['filters']));if(_0x37d523[_0x550a('0x2f')]['filter']){_0x90cdb0[_0x550a('0x3a')]=_[_0x550a('0x3e')](_0x90cdb0[_0x550a('0x3a')],{'$or':_[_0x550a('0x2a')](_0x90cdb0[_0x550a('0x33')],function(_0x95f28b){var _0x74c3ff={};_0x74c3ff[_0x95f28b]={'$like':'%'+_0x37d523[_0x550a('0x2f')][_0x550a('0x3c')]+'%'};return _0x74c3ff;})});}_0x90cdb0=_[_0x550a('0x3e')]({},_0x90cdb0,_0x37d523[_0x550a('0x3f')]);return _0x32db51[_0x550a('0x4d')](_0x90cdb0);}})[_0x550a('0x23')](function(_0x19c71b){if(_0x19c71b){_0x24647e=_0x19c71b[_0x550a('0x35')];if(!_0x37d523[_0x550a('0x2f')][_0x550a('0x4c')](_0x550a('0x37'))){_0x90cdb0['limit']=qs[_0x550a('0x1c')](_0x37d523[_0x550a('0x2f')]['limit']);_0x90cdb0[_0x550a('0x1b')]=qs['offset'](_0x37d523[_0x550a('0x2f')][_0x550a('0x1b')]);}return _0x32db51[_0x550a('0x4d')](_0x90cdb0);}})[_0x550a('0x23')](function(_0x4be530){if(_0x4be530){return _0x4be530?{'count':_0x24647e,'rows':_0x4be530}:null;}})[_0x550a('0x23')](respondWithResult(_0x405fc7,null))[_0x550a('0x43')](handleError(_0x405fc7,null));};exports[_0x550a('0x4e')]=function(_0x487ae9,_0x5a679f,_0x57c1dd){var _0x4142d1={};var _0x59d396={};var _0x12a1e4;var _0x4ae3e0;return db[_0x550a('0x2b')][_0x550a('0x4a')]({'where':{'id':_0x487ae9[_0x550a('0x44')]['id']}})[_0x550a('0x23')](handleEntityNotFound(_0x5a679f,null))[_0x550a('0x23')](function(_0x23b861){if(_0x23b861){_0x12a1e4=_0x23b861;_0x59d396['model']=_['keys'](db['SalesforceField']['rawAttributes']);_0x59d396[_0x550a('0x2f')]=_['keys'](_0x487ae9['query']);_0x59d396[_0x550a('0x31')]=_[_0x550a('0x32')](_0x59d396[_0x550a('0x36')],_0x59d396[_0x550a('0x2f')]);_0x4142d1[_0x550a('0x33')]=_[_0x550a('0x32')](_0x59d396[_0x550a('0x36')],qs['fields'](_0x487ae9[_0x550a('0x2f')]['fields']));_0x4142d1[_0x550a('0x33')]=_0x4142d1[_0x550a('0x33')][_0x550a('0x35')]?_0x4142d1[_0x550a('0x33')]:_0x59d396[_0x550a('0x36')];_0x4142d1[_0x550a('0x38')]=qs[_0x550a('0x39')](_0x487ae9['query'][_0x550a('0x39')]);_0x4142d1['where']=qs[_0x550a('0x31')](_[_0x550a('0x3b')](_0x487ae9[_0x550a('0x2f')],_0x59d396['filters']));if(_0x487ae9[_0x550a('0x2f')][_0x550a('0x3c')]){_0x4142d1['where']=_['merge'](_0x4142d1[_0x550a('0x3a')],{'$or':_['map'](_0x4142d1['attributes'],function(_0x6d5652){var _0x66b08c={};_0x66b08c[_0x6d5652]={'$like':'%'+_0x487ae9[_0x550a('0x2f')]['filter']+'%'};return _0x66b08c;})});}_0x4142d1=_[_0x550a('0x3e')]({},_0x4142d1,_0x487ae9[_0x550a('0x3f')]);return _0x12a1e4[_0x550a('0x4e')](_0x4142d1);}})[_0x550a('0x23')](function(_0x64a3ec){if(_0x64a3ec){_0x4ae3e0=_0x64a3ec[_0x550a('0x35')];if(!_0x487ae9[_0x550a('0x2f')][_0x550a('0x4c')]('nolimit')){_0x4142d1[_0x550a('0x1c')]=qs[_0x550a('0x1c')](_0x487ae9[_0x550a('0x2f')]['limit']);_0x4142d1[_0x550a('0x1b')]=qs['offset'](_0x487ae9[_0x550a('0x2f')][_0x550a('0x1b')]);}return _0x12a1e4[_0x550a('0x4e')](_0x4142d1);}})[_0x550a('0x23')](function(_0x582d5a){if(_0x582d5a){return _0x582d5a?{'count':_0x4ae3e0,'rows':_0x582d5a}:null;}})[_0x550a('0x23')](respondWithResult(_0x5a679f,null))[_0x550a('0x43')](handleError(_0x5a679f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index a0eb1b8..9e2ef7c 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 _0xf927=['moment','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x29baac,_0x4d52b0){var _0x571188=function(_0x5d9681){while(--_0x5d9681){_0x29baac['push'](_0x29baac['shift']());}};_0x571188(++_0x4d52b0);}(_0xf927,0xef));var _0x7f92=function(_0x5592ad,_0x4bda66){_0x5592ad=_0x5592ad-0x0;var _0x243273=_0xf927[_0x5592ad];return _0x243273;};'use strict';var _=require(_0x7f92('0x0'));var util=require(_0x7f92('0x1'));var logger=require(_0x7f92('0x2'))('api');var moment=require(_0x7f92('0x3'));var BPromise=require('bluebird');var rp=require(_0x7f92('0x4'));var fs=require('fs');var path=require(_0x7f92('0x5'));var rimraf=require(_0x7f92('0x6'));var config=require(_0x7f92('0x7'));var attributes=require(_0x7f92('0x8'));module[_0x7f92('0x9')]=function(_0x4853cf,_0x442453){return _0x4853cf[_0x7f92('0xa')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2029=['request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','api','moment','bluebird'];(function(_0x404bc8,_0x2cc3f0){var _0x5a8c23=function(_0x41bc34){while(--_0x41bc34){_0x404bc8['push'](_0x404bc8['shift']());}};_0x5a8c23(++_0x2cc3f0);}(_0x2029,0xac));var _0x9202=function(_0x2b7c86,_0x3d3ab4){_0x2b7c86=_0x2b7c86-0x0;var _0x5d7cd3=_0x2029[_0x2b7c86];return _0x5d7cd3;};'use strict';var _=require(_0x9202('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9202('0x1'));var moment=require(_0x9202('0x2'));var BPromise=require(_0x9202('0x3'));var rp=require(_0x9202('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9202('0x5'));var config=require(_0x9202('0x6'));var attributes=require(_0x9202('0x7'));module[_0x9202('0x8')]=function(_0x5553b5,_0x578ada){return _0x5553b5[_0x9202('0x9')]('SalesforceConfiguration',attributes,{'tableName':_0x9202('0xa'),'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 ec37bd2..615ba6e 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 _0x14e8=['../../config/logger','rpc','jayson/promise','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis'];(function(_0x30e578,_0x2967ca){var _0x4f5d50=function(_0x538386){while(--_0x538386){_0x30e578['push'](_0x30e578['shift']());}};_0x4f5d50(++_0x2967ca);}(_0x14e8,0x1bf));var _0x814e=function(_0x4173aa,_0x48784a){_0x4173aa=_0x4173aa-0x0;var _0x3b4711=_0x14e8[_0x4173aa];return _0x3b4711;};'use strict';var _=require(_0x814e('0x0'));var util=require('util');var moment=require(_0x814e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x814e('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x814e('0x3'))(_0x814e('0x4'));var config=require('../../config/environment');var jayson=require(_0x814e('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x340efd,_0x2a3cc9,_0x2714d1){return new BPromise(function(_0x3417cb,_0x5ed297){return client[_0x814e('0x6')](_0x340efd,_0x2714d1)['then'](function(_0x6397d8){logger[_0x814e('0x7')](_0x814e('0x8'),_0x2a3cc9,_0x814e('0x9'));logger[_0x814e('0xa')](_0x814e('0xb'),_0x2a3cc9,_0x814e('0x9'),JSON[_0x814e('0xc')](_0x6397d8));if(_0x6397d8['error']){if(_0x6397d8[_0x814e('0xd')][_0x814e('0xe')]===0x1f4){logger[_0x814e('0xd')](_0x814e('0x8'),_0x2a3cc9,_0x6397d8['error'][_0x814e('0xf')]);return _0x5ed297(_0x6397d8[_0x814e('0xd')][_0x814e('0xf')]);}logger[_0x814e('0xd')](_0x814e('0x8'),_0x2a3cc9,_0x6397d8[_0x814e('0xd')]['message']);return _0x3417cb(_0x6397d8[_0x814e('0xd')]['message']);}else{logger[_0x814e('0x7')](_0x814e('0x8'),_0x2a3cc9,_0x814e('0x9'));_0x3417cb(_0x6397d8[_0x814e('0x10')][_0x814e('0xf')]);}})[_0x814e('0x11')](function(_0x582c82){logger[_0x814e('0xd')](_0x814e('0x8'),_0x2a3cc9,_0x582c82);_0x5ed297(_0x582c82);});});} \ No newline at end of file +var _0x5b0d=['randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x7698f5,_0x1be3dd){var _0x2039a6=function(_0x584369){while(--_0x584369){_0x7698f5['push'](_0x7698f5['shift']());}};_0x2039a6(++_0x1be3dd);}(_0x5b0d,0x1e0));var _0xd5b0=function(_0x16dc15,_0x5188db){_0x16dc15=_0x16dc15-0x0;var _0x58da19=_0x5b0d[_0x16dc15];return _0x58da19;};'use strict';var _=require(_0xd5b0('0x0'));var util=require(_0xd5b0('0x1'));var moment=require(_0xd5b0('0x2'));var BPromise=require('bluebird');var rs=require(_0xd5b0('0x3'));var fs=require('fs');var Redis=require(_0xd5b0('0x4'));var db=require(_0xd5b0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd5b0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd5b0('0x7')][_0xd5b0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b87bf,_0x1dcab1,_0x4034f6){return new BPromise(function(_0x20fc85,_0x1f360b){return client[_0xd5b0('0x9')](_0x2b87bf,_0x4034f6)[_0xd5b0('0xa')](function(_0x3572d6){logger[_0xd5b0('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1dcab1,_0xd5b0('0xc'));logger[_0xd5b0('0xd')](_0xd5b0('0xe'),_0x1dcab1,_0xd5b0('0xc'),JSON[_0xd5b0('0xf')](_0x3572d6));if(_0x3572d6['error']){if(_0x3572d6[_0xd5b0('0x10')]['code']===0x1f4){logger[_0xd5b0('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1dcab1,_0x3572d6[_0xd5b0('0x10')]['message']);return _0x1f360b(_0x3572d6[_0xd5b0('0x10')]['message']);}logger[_0xd5b0('0x10')](_0xd5b0('0x11'),_0x1dcab1,_0x3572d6['error'][_0xd5b0('0x12')]);return _0x20fc85(_0x3572d6[_0xd5b0('0x10')][_0xd5b0('0x12')]);}else{logger[_0xd5b0('0xb')](_0xd5b0('0x11'),_0x1dcab1,_0xd5b0('0xc'));_0x20fc85(_0x3572d6[_0xd5b0('0x13')][_0xd5b0('0x12')]);}})[_0xd5b0('0x14')](function(_0x50b9cc){logger[_0xd5b0('0x10')](_0xd5b0('0x11'),_0x1dcab1,_0x50b9cc);_0x1f360b(_0x50b9cc);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 1f7cfb0..0d5bb09 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 _0x3d73=['/:id','delete','destroy','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','show','post','create','put'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x3d73,0x18a));var _0x33d7=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x3d73[_0x29d94e];return _0x106237;};'use strict';var multer=require(_0x33d7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x33d7('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x33d7('0x2'));var interaction=require(_0x33d7('0x3'));var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0x33d7('0x4')]('/',auth['isAuthenticated'](),controller[_0x33d7('0x5')]);router[_0x33d7('0x4')]('/:id',auth[_0x33d7('0x6')](),controller[_0x33d7('0x7')]);router[_0x33d7('0x8')]('/',auth[_0x33d7('0x6')](),controller[_0x33d7('0x9')]);router[_0x33d7('0xa')](_0x33d7('0xb'),auth[_0x33d7('0x6')](),controller['update']);router[_0x33d7('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x33d7('0xd')]);module[_0x33d7('0xe')]=router; \ No newline at end of file +var _0xda20=['post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index'];(function(_0x167977,_0x557843){var _0x2e148a=function(_0x5ed05f){while(--_0x5ed05f){_0x167977['push'](_0x167977['shift']());}};_0x2e148a(++_0x557843);}(_0xda20,0x104));var _0x0da2=function(_0x4626bb,_0x16150e){_0x4626bb=_0x4626bb-0x0;var _0x50df8d=_0xda20[_0x4626bb];return _0x50df8d;};'use strict';var multer=require(_0x0da2('0x0'));var util=require('util');var path=require(_0x0da2('0x1'));var timeout=require(_0x0da2('0x2'));var express=require(_0x0da2('0x3'));var router=express[_0x0da2('0x4')]();var fs_extra=require(_0x0da2('0x5'));var auth=require(_0x0da2('0x6'));var interaction=require(_0x0da2('0x7'));var config=require(_0x0da2('0x8'));var controller=require(_0x0da2('0x9'));router[_0x0da2('0xa')]('/',auth[_0x0da2('0xb')](),controller[_0x0da2('0xc')]);router[_0x0da2('0xa')]('/:id',auth[_0x0da2('0xb')](),controller['show']);router[_0x0da2('0xd')]('/',auth[_0x0da2('0xb')](),controller[_0x0da2('0xe')]);router[_0x0da2('0xf')](_0x0da2('0x10'),auth['isAuthenticated'](),controller[_0x0da2('0x11')]);router[_0x0da2('0x12')](_0x0da2('0x10'),auth[_0x0da2('0xb')](),controller[_0x0da2('0x13')]);module[_0x0da2('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 15e5591..7eeb5bc 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 _0x3f26=['STRING','sequelize','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0x3f26,0x129));var _0x63f2=function(_0x1d6021,_0x1e7741){_0x1d6021=_0x1d6021-0x0;var _0x3c7336=_0x3f26[_0x1d6021];return _0x3c7336;};'use strict';var Sequelize=require(_0x63f2('0x0'));module[_0x63f2('0x1')]={'type':{'type':Sequelize[_0x63f2('0x2')](_0x63f2('0x3'),_0x63f2('0x4'),_0x63f2('0x5'),'keyValue',_0x63f2('0x6')),'defaultValue':_0x63f2('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x63f2('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x63f2('0x3'),_0x63f2('0x4'),_0x63f2('0x5'))},'keyContent':{'type':Sequelize[_0x63f2('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x63f2('0x7')]}}; \ No newline at end of file +var _0x5ce2=['ENUM','string','customVariable','picklist','STRING','variable','exports'];(function(_0x381db,_0x358cec){var _0x4386ae=function(_0x4803ea){while(--_0x4803ea){_0x381db['push'](_0x381db['shift']());}};_0x4386ae(++_0x358cec);}(_0x5ce2,0xca));var _0x25ce=function(_0x172feb,_0x4bb62f){_0x172feb=_0x172feb-0x0;var _0x5341af=_0x5ce2[_0x172feb];return _0x5341af;};'use strict';var Sequelize=require('sequelize');module[_0x25ce('0x0')]={'type':{'type':Sequelize[_0x25ce('0x1')](_0x25ce('0x2'),'variable',_0x25ce('0x3'),'keyValue',_0x25ce('0x4')),'defaultValue':_0x25ce('0x2')},'content':{'type':Sequelize[_0x25ce('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x25ce('0x2'),_0x25ce('0x6'),_0x25ce('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x25ce('0x5')]},'variableName':{'type':Sequelize[_0x25ce('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index ae487b8..546c31f 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 _0x2bc6=['offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','SalesforceField','includeAll','include','findAll','show','params','catch','create','body','find','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json'];(function(_0x53ee8f,_0x4c9ac7){var _0x1d00c8=function(_0x10fb79){while(--_0x10fb79){_0x53ee8f['push'](_0x53ee8f['shift']());}};_0x1d00c8(++_0x4c9ac7);}(_0x2bc6,0x1da));var _0x62bc=function(_0x3fb5c3,_0x5b134d){_0x3fb5c3=_0x3fb5c3-0x0;var _0x2f3dbc=_0x2bc6[_0x3fb5c3];return _0x2f3dbc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x62bc('0x0'));var jsonpatch=require(_0x62bc('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x62bc('0x2'));var Mustache=require(_0x62bc('0x3'));var util=require(_0x62bc('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x62bc('0x5'));var ejs=require(_0x62bc('0x6'));var fs=require('fs');var fs_extra=require(_0x62bc('0x7'));var _=require(_0x62bc('0x8'));var squel=require(_0x62bc('0x9'));var crypto=require(_0x62bc('0xa'));var jsforce=require(_0x62bc('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x62bc('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x62bc('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62bc('0xe'));var logger=require(_0x62bc('0xf'))(_0x62bc('0x10'));var utils=require(_0x62bc('0x11'));var config=require(_0x62bc('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x62bc('0x13'))['db'];function respondWithStatusCode(_0xae257e,_0xf02094){_0xf02094=_0xf02094||0xcc;return function(_0x391ee9){if(_0x391ee9){return _0xae257e[_0x62bc('0x14')](_0xf02094);}return _0xae257e[_0x62bc('0x15')](_0xf02094)['end']();};}function respondWithResult(_0x4fb10f,_0x176ada){_0x176ada=_0x176ada||0xc8;return function(_0x48a3b2){if(_0x48a3b2){return _0x4fb10f['status'](_0x176ada)[_0x62bc('0x16')](_0x48a3b2);}};}function respondWithFilteredResult(_0x2237e2,_0x1cbde1){return function(_0x103d71){if(_0x103d71){var _0x1e7894=typeof _0x1cbde1[_0x62bc('0x17')]===_0x62bc('0x18')&&typeof _0x1cbde1[_0x62bc('0x19')]===_0x62bc('0x18');var _0x10f671=_0x103d71[_0x62bc('0x1a')];var _0x4a12b0=_0x1e7894?0x0:_0x1cbde1[_0x62bc('0x17')];var _0xe064df=_0x1e7894?_0x103d71['count']:_0x1cbde1[_0x62bc('0x17')]+_0x1cbde1[_0x62bc('0x19')];var _0xc755f7;if(_0xe064df>=_0x10f671){_0xe064df=_0x10f671;_0xc755f7=0xc8;}else{_0xc755f7=0xce;}_0x2237e2[_0x62bc('0x15')](_0xc755f7);return _0x2237e2[_0x62bc('0x1b')]('Content-Range',_0x4a12b0+'-'+_0xe064df+'/'+_0x10f671)[_0x62bc('0x16')](_0x103d71);}return null;};}function patchUpdates(_0xbd2ff5){return function(_0x3d0bc5){try{jsonpatch[_0x62bc('0x1c')](_0x3d0bc5,_0xbd2ff5,!![]);}catch(_0x1a2685){return BPromise[_0x62bc('0x1d')](_0x1a2685);}return _0x3d0bc5[_0x62bc('0x1e')]();};}function saveUpdates(_0xac04f2,_0x3259c4){return function(_0x1766b1){if(_0x1766b1){return _0x1766b1[_0x62bc('0x1f')](_0xac04f2)[_0x62bc('0x20')](function(_0xcb4f9){return _0xcb4f9;});}return null;};}function removeEntity(_0x37232d,_0x4768bd){return function(_0x2e2e2d){if(_0x2e2e2d){return _0x2e2e2d[_0x62bc('0x21')]()[_0x62bc('0x20')](function(){_0x37232d[_0x62bc('0x15')](0xcc)[_0x62bc('0x22')]();});}};}function handleEntityNotFound(_0x50363f,_0x1c29b8){return function(_0x578f2b){if(!_0x578f2b){_0x50363f[_0x62bc('0x14')](0x194);}return _0x578f2b;};}function handleError(_0x1c534f,_0xf0b08f){_0xf0b08f=_0xf0b08f||0x1f4;return function(_0x12ee80){logger[_0x62bc('0x23')](_0x12ee80[_0x62bc('0x24')]);if(_0x12ee80[_0x62bc('0x25')]){delete _0x12ee80['name'];}_0x1c534f[_0x62bc('0x15')](_0xf0b08f)[_0x62bc('0x26')](_0x12ee80);};}exports[_0x62bc('0x27')]=function(_0x2bf1c5,_0x3a7ab6){var _0x3bf8d4={},_0x11f6ff={},_0x45e4d1={'count':0x0,'rows':[]};var _0x434879=_[_0x62bc('0x28')](db['SalesforceField'][_0x62bc('0x29')],function(_0x208c5d){return{'name':_0x208c5d[_0x62bc('0x2a')],'type':_0x208c5d['type']['key']};});_0x11f6ff['model']=_[_0x62bc('0x28')](_0x434879,_0x62bc('0x25'));_0x11f6ff[_0x62bc('0x2b')]=_[_0x62bc('0x2c')](_0x2bf1c5['query']);_0x11f6ff[_0x62bc('0x2d')]=_[_0x62bc('0x2e')](_0x11f6ff[_0x62bc('0x2f')],_0x11f6ff[_0x62bc('0x2b')]);_0x3bf8d4[_0x62bc('0x30')]=_[_0x62bc('0x2e')](_0x11f6ff['model'],qs[_0x62bc('0x31')](_0x2bf1c5['query'][_0x62bc('0x31')]));_0x3bf8d4[_0x62bc('0x30')]=_0x3bf8d4[_0x62bc('0x30')][_0x62bc('0x32')]?_0x3bf8d4['attributes']:_0x11f6ff[_0x62bc('0x2f')];if(!_0x2bf1c5[_0x62bc('0x2b')][_0x62bc('0x33')](_0x62bc('0x34'))){_0x3bf8d4['limit']=qs[_0x62bc('0x19')](_0x2bf1c5[_0x62bc('0x2b')][_0x62bc('0x19')]);_0x3bf8d4[_0x62bc('0x17')]=qs['offset'](_0x2bf1c5[_0x62bc('0x2b')][_0x62bc('0x17')]);}_0x3bf8d4[_0x62bc('0x35')]=qs[_0x62bc('0x36')](_0x2bf1c5[_0x62bc('0x2b')][_0x62bc('0x36')]);_0x3bf8d4['where']=qs['filters'](_[_0x62bc('0x37')](_0x2bf1c5['query'],_0x11f6ff['filters']),_0x434879);if(_0x2bf1c5[_0x62bc('0x2b')]['filter']){_0x3bf8d4[_0x62bc('0x38')]=_[_0x62bc('0x39')](_0x3bf8d4[_0x62bc('0x38')],{'$or':_[_0x62bc('0x28')](_0x434879,function(_0x35bd26){if(_0x35bd26['type']!==_0x62bc('0x3a')){var _0x589d31={};_0x589d31[_0x35bd26[_0x62bc('0x25')]]={'$like':'%'+_0x2bf1c5[_0x62bc('0x2b')][_0x62bc('0x3b')]+'%'};return _0x589d31;}})});}_0x3bf8d4=_['merge']({},_0x3bf8d4,_0x2bf1c5[_0x62bc('0x3c')]);var _0x3bc3fd={'where':_0x3bf8d4[_0x62bc('0x38')]};return db[_0x62bc('0x3d')][_0x62bc('0x1a')](_0x3bc3fd)[_0x62bc('0x20')](function(_0x229367){_0x45e4d1[_0x62bc('0x1a')]=_0x229367;if(_0x2bf1c5[_0x62bc('0x2b')][_0x62bc('0x3e')]){_0x3bf8d4[_0x62bc('0x3f')]=[{'all':!![]}];}return db['SalesforceField'][_0x62bc('0x40')](_0x3bf8d4);})[_0x62bc('0x20')](function(_0x4b9035){_0x45e4d1['rows']=_0x4b9035;return _0x45e4d1;})[_0x62bc('0x20')](respondWithFilteredResult(_0x3a7ab6,_0x3bf8d4))['catch'](handleError(_0x3a7ab6,null));};exports[_0x62bc('0x41')]=function(_0x11cc87,_0x3ced4e){var _0xb5e888={'raw':!![],'where':{'id':_0x11cc87[_0x62bc('0x42')]['id']}},_0x13e8fb={};_0x13e8fb[_0x62bc('0x2f')]=_[_0x62bc('0x2c')](db[_0x62bc('0x3d')][_0x62bc('0x29')]);_0x13e8fb['query']=_[_0x62bc('0x2c')](_0x11cc87['query']);_0x13e8fb[_0x62bc('0x2d')]=_[_0x62bc('0x2e')](_0x13e8fb[_0x62bc('0x2f')],_0x13e8fb[_0x62bc('0x2b')]);_0xb5e888[_0x62bc('0x30')]=_['intersection'](_0x13e8fb[_0x62bc('0x2f')],qs['fields'](_0x11cc87['query'][_0x62bc('0x31')]));_0xb5e888[_0x62bc('0x30')]=_0xb5e888[_0x62bc('0x30')][_0x62bc('0x32')]?_0xb5e888[_0x62bc('0x30')]:_0x13e8fb['model'];if(_0x11cc87[_0x62bc('0x2b')][_0x62bc('0x3e')]){_0xb5e888[_0x62bc('0x3f')]=[{'all':!![]}];}_0xb5e888=_[_0x62bc('0x39')]({},_0xb5e888,_0x11cc87[_0x62bc('0x3c')]);return db['SalesforceField']['find'](_0xb5e888)['then'](handleEntityNotFound(_0x3ced4e,null))['then'](respondWithResult(_0x3ced4e,null))[_0x62bc('0x43')](handleError(_0x3ced4e,null));};exports['create']=function(_0x1ee24c,_0x1fc7a4){return db[_0x62bc('0x3d')][_0x62bc('0x44')](_0x1ee24c[_0x62bc('0x45')],{})['then'](respondWithResult(_0x1fc7a4,0xc9))[_0x62bc('0x43')](handleError(_0x1fc7a4,null));};exports[_0x62bc('0x1f')]=function(_0x35d227,_0x55486f){if(_0x35d227[_0x62bc('0x45')]['id']){delete _0x35d227[_0x62bc('0x45')]['id'];}return db[_0x62bc('0x3d')][_0x62bc('0x46')]({'where':{'id':_0x35d227['params']['id']}})[_0x62bc('0x20')](handleEntityNotFound(_0x55486f,null))[_0x62bc('0x20')](saveUpdates(_0x35d227[_0x62bc('0x45')],null))[_0x62bc('0x20')](respondWithResult(_0x55486f,null))['catch'](handleError(_0x55486f,null));};exports['destroy']=function(_0x1b8a09,_0x3c620d){return db[_0x62bc('0x3d')][_0x62bc('0x46')]({'where':{'id':_0x1b8a09[_0x62bc('0x42')]['id']}})[_0x62bc('0x20')](handleEntityNotFound(_0x3c620d,null))[_0x62bc('0x20')](removeEntity(_0x3c620d,null))['catch'](handleError(_0x3c620d,null));}; \ No newline at end of file +var _0x6132=['fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','index','SalesforceField','rawAttributes','type','model','map','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','body','find','eml-format','zip-dir'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0x6132,0x166));var _0x2613=function(_0x345612,_0x555965){_0x345612=_0x345612-0x0;var _0x33d807=_0x6132[_0x345612];return _0x33d807;};'use strict';var emlformat=require(_0x2613('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2613('0x1'));var jsonpatch=require(_0x2613('0x2'));var rp=require(_0x2613('0x3'));var moment=require('moment');var BPromise=require(_0x2613('0x4'));var Mustache=require('mustache');var util=require(_0x2613('0x5'));var path=require(_0x2613('0x6'));var sox=require(_0x2613('0x7'));var csv=require('to-csv');var ejs=require(_0x2613('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2613('0x9'));var squel=require(_0x2613('0xa'));var crypto=require('crypto');var jsforce=require(_0x2613('0xb'));var deskjs=require(_0x2613('0xc'));var toCsv=require(_0x2613('0xd'));var querystring=require(_0x2613('0xe'));var Papa=require('papaparse');var Redis=require(_0x2613('0xf'));var authService=require(_0x2613('0x10'));var qs=require(_0x2613('0x11'));var as=require(_0x2613('0x12'));var hardwareService=require(_0x2613('0x13'));var logger=require(_0x2613('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x2613('0x15'));var licenseUtil=require(_0x2613('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b2206,_0x28c800){_0x28c800=_0x28c800||0xcc;return function(_0x3f9bea){if(_0x3f9bea){return _0x2b2206[_0x2613('0x17')](_0x28c800);}return _0x2b2206[_0x2613('0x18')](_0x28c800)[_0x2613('0x19')]();};}function respondWithResult(_0x2a8d88,_0x1102bc){_0x1102bc=_0x1102bc||0xc8;return function(_0x44426c){if(_0x44426c){return _0x2a8d88[_0x2613('0x18')](_0x1102bc)[_0x2613('0x1a')](_0x44426c);}};}function respondWithFilteredResult(_0xe787fc,_0x21ab7e){return function(_0x274dc5){if(_0x274dc5){var _0x535182=typeof _0x21ab7e[_0x2613('0x1b')]===_0x2613('0x1c')&&typeof _0x21ab7e[_0x2613('0x1d')]===_0x2613('0x1c');var _0x372e22=_0x274dc5[_0x2613('0x1e')];var _0x2e4f3f=_0x535182?0x0:_0x21ab7e[_0x2613('0x1b')];var _0x2319b5=_0x535182?_0x274dc5[_0x2613('0x1e')]:_0x21ab7e[_0x2613('0x1b')]+_0x21ab7e[_0x2613('0x1d')];var _0x590956;if(_0x2319b5>=_0x372e22){_0x2319b5=_0x372e22;_0x590956=0xc8;}else{_0x590956=0xce;}_0xe787fc[_0x2613('0x18')](_0x590956);return _0xe787fc[_0x2613('0x1f')]('Content-Range',_0x2e4f3f+'-'+_0x2319b5+'/'+_0x372e22)['json'](_0x274dc5);}return null;};}function patchUpdates(_0x3b97d4){return function(_0x4b2454){try{jsonpatch[_0x2613('0x20')](_0x4b2454,_0x3b97d4,!![]);}catch(_0x1b173c){return BPromise[_0x2613('0x21')](_0x1b173c);}return _0x4b2454[_0x2613('0x22')]();};}function saveUpdates(_0x595ed6,_0x5301f9){return function(_0x56f662){if(_0x56f662){return _0x56f662[_0x2613('0x23')](_0x595ed6)['then'](function(_0x2e69c8){return _0x2e69c8;});}return null;};}function removeEntity(_0x15dd98,_0x13ceb7){return function(_0x2c4592){if(_0x2c4592){return _0x2c4592[_0x2613('0x24')]()[_0x2613('0x25')](function(){_0x15dd98[_0x2613('0x18')](0xcc)[_0x2613('0x19')]();});}};}function handleEntityNotFound(_0x8d35fe,_0xce0733){return function(_0x18010d){if(!_0x18010d){_0x8d35fe[_0x2613('0x17')](0x194);}return _0x18010d;};}function handleError(_0x4fd4ea,_0x1d8e53){_0x1d8e53=_0x1d8e53||0x1f4;return function(_0x4b60c7){logger[_0x2613('0x26')](_0x4b60c7[_0x2613('0x27')]);if(_0x4b60c7['name']){delete _0x4b60c7[_0x2613('0x28')];}_0x4fd4ea[_0x2613('0x18')](_0x1d8e53)['send'](_0x4b60c7);};}exports[_0x2613('0x29')]=function(_0x52fcdf,_0x14df89){var _0x41a116={},_0x459e8c={},_0x257863={'count':0x0,'rows':[]};var _0x46cb0d=_['map'](db[_0x2613('0x2a')][_0x2613('0x2b')],function(_0x53da1d){return{'name':_0x53da1d['fieldName'],'type':_0x53da1d[_0x2613('0x2c')]['key']};});_0x459e8c[_0x2613('0x2d')]=_[_0x2613('0x2e')](_0x46cb0d,_0x2613('0x28'));_0x459e8c['query']=_[_0x2613('0x2f')](_0x52fcdf['query']);_0x459e8c[_0x2613('0x30')]=_[_0x2613('0x31')](_0x459e8c[_0x2613('0x2d')],_0x459e8c['query']);_0x41a116['attributes']=_[_0x2613('0x31')](_0x459e8c['model'],qs[_0x2613('0x32')](_0x52fcdf[_0x2613('0x33')][_0x2613('0x32')]));_0x41a116['attributes']=_0x41a116[_0x2613('0x34')][_0x2613('0x35')]?_0x41a116['attributes']:_0x459e8c['model'];if(!_0x52fcdf['query'][_0x2613('0x36')](_0x2613('0x37'))){_0x41a116[_0x2613('0x1d')]=qs[_0x2613('0x1d')](_0x52fcdf[_0x2613('0x33')][_0x2613('0x1d')]);_0x41a116[_0x2613('0x1b')]=qs[_0x2613('0x1b')](_0x52fcdf['query'][_0x2613('0x1b')]);}_0x41a116[_0x2613('0x38')]=qs[_0x2613('0x39')](_0x52fcdf[_0x2613('0x33')][_0x2613('0x39')]);_0x41a116[_0x2613('0x3a')]=qs['filters'](_[_0x2613('0x3b')](_0x52fcdf['query'],_0x459e8c[_0x2613('0x30')]),_0x46cb0d);if(_0x52fcdf[_0x2613('0x33')][_0x2613('0x3c')]){_0x41a116['where']=_[_0x2613('0x3d')](_0x41a116['where'],{'$or':_[_0x2613('0x2e')](_0x46cb0d,function(_0x19e4c5){if(_0x19e4c5[_0x2613('0x2c')]!==_0x2613('0x3e')){var _0x5dbcd3={};_0x5dbcd3[_0x19e4c5[_0x2613('0x28')]]={'$like':'%'+_0x52fcdf[_0x2613('0x33')][_0x2613('0x3c')]+'%'};return _0x5dbcd3;}})});}_0x41a116=_[_0x2613('0x3d')]({},_0x41a116,_0x52fcdf[_0x2613('0x3f')]);var _0x142d6c={'where':_0x41a116['where']};return db[_0x2613('0x2a')][_0x2613('0x1e')](_0x142d6c)[_0x2613('0x25')](function(_0x305681){_0x257863[_0x2613('0x1e')]=_0x305681;if(_0x52fcdf['query'][_0x2613('0x40')]){_0x41a116['include']=[{'all':!![]}];}return db['SalesforceField'][_0x2613('0x41')](_0x41a116);})['then'](function(_0x30555e){_0x257863[_0x2613('0x42')]=_0x30555e;return _0x257863;})[_0x2613('0x25')](respondWithFilteredResult(_0x14df89,_0x41a116))[_0x2613('0x43')](handleError(_0x14df89,null));};exports[_0x2613('0x44')]=function(_0x18d764,_0x350fef){var _0x58150c={'raw':!![],'where':{'id':_0x18d764[_0x2613('0x45')]['id']}},_0x3b534c={};_0x3b534c[_0x2613('0x2d')]=_['keys'](db[_0x2613('0x2a')][_0x2613('0x2b')]);_0x3b534c[_0x2613('0x33')]=_['keys'](_0x18d764['query']);_0x3b534c[_0x2613('0x30')]=_[_0x2613('0x31')](_0x3b534c[_0x2613('0x2d')],_0x3b534c['query']);_0x58150c[_0x2613('0x34')]=_[_0x2613('0x31')](_0x3b534c['model'],qs['fields'](_0x18d764[_0x2613('0x33')][_0x2613('0x32')]));_0x58150c[_0x2613('0x34')]=_0x58150c[_0x2613('0x34')][_0x2613('0x35')]?_0x58150c[_0x2613('0x34')]:_0x3b534c[_0x2613('0x2d')];if(_0x18d764[_0x2613('0x33')]['includeAll']){_0x58150c['include']=[{'all':!![]}];}_0x58150c=_[_0x2613('0x3d')]({},_0x58150c,_0x18d764['options']);return db['SalesforceField']['find'](_0x58150c)[_0x2613('0x25')](handleEntityNotFound(_0x350fef,null))[_0x2613('0x25')](respondWithResult(_0x350fef,null))[_0x2613('0x43')](handleError(_0x350fef,null));};exports['create']=function(_0x27acc1,_0x744297){return db[_0x2613('0x2a')]['create'](_0x27acc1[_0x2613('0x46')],{})['then'](respondWithResult(_0x744297,0xc9))['catch'](handleError(_0x744297,null));};exports[_0x2613('0x23')]=function(_0x496575,_0xd91fec){if(_0x496575[_0x2613('0x46')]['id']){delete _0x496575[_0x2613('0x46')]['id'];}return db[_0x2613('0x2a')][_0x2613('0x47')]({'where':{'id':_0x496575[_0x2613('0x45')]['id']}})[_0x2613('0x25')](handleEntityNotFound(_0xd91fec,null))[_0x2613('0x25')](saveUpdates(_0x496575[_0x2613('0x46')],null))[_0x2613('0x25')](respondWithResult(_0xd91fec,null))['catch'](handleError(_0xd91fec,null));};exports[_0x2613('0x24')]=function(_0x487360,_0x23d1db){return db[_0x2613('0x2a')][_0x2613('0x47')]({'where':{'id':_0x487360[_0x2613('0x45')]['id']}})[_0x2613('0x25')](handleEntityNotFound(_0x23d1db,null))[_0x2613('0x25')](removeEntity(_0x23d1db,null))[_0x2613('0x43')](handleError(_0x23d1db,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 170282b..ab6017e 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 _0xc5b1=['int_salesforce_fields','salesforce_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField'];(function(_0x5f08a3,_0x4147e9){var _0x3dc610=function(_0x3e1119){while(--_0x3e1119){_0x5f08a3['push'](_0x5f08a3['shift']());}};_0x3dc610(++_0x4147e9);}(_0xc5b1,0x7c));var _0x1c5b=function(_0x5b4385,_0x5a4906){_0x5b4385=_0x5b4385-0x0;var _0x2b1315=_0xc5b1[_0x5b4385];return _0x2b1315;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1c5b('0x0'))(_0x1c5b('0x1'));var moment=require(_0x1c5b('0x2'));var BPromise=require(_0x1c5b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c5b('0x4'));var rimraf=require(_0x1c5b('0x5'));var config=require(_0x1c5b('0x6'));var attributes=require(_0x1c5b('0x7'));module[_0x1c5b('0x8')]=function(_0x11432f,_0x1c1cfc){return _0x11432f[_0x1c5b('0x9')](_0x1c5b('0xa'),attributes,{'tableName':_0x1c5b('0xb'),'paranoid':![],'indexes':[{'name':_0x1c5b('0xc'),'fields':[_0x1c5b('0xd'),_0x1c5b('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2fe3=['int_salesforce_fields','salesforce_unique_index','FieldId','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2fe3,0xe0));var _0x32fe=function(_0x314cfb,_0x24b11f){_0x314cfb=_0x314cfb-0x0;var _0x3ef8bc=_0x2fe3[_0x314cfb];return _0x3ef8bc;};'use strict';var _=require('lodash');var util=require(_0x32fe('0x0'));var logger=require(_0x32fe('0x1'))(_0x32fe('0x2'));var moment=require(_0x32fe('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x32fe('0x4'));var rimraf=require(_0x32fe('0x5'));var config=require(_0x32fe('0x6'));var attributes=require(_0x32fe('0x7'));module['exports']=function(_0x2474f3,_0x555168){return _0x2474f3[_0x32fe('0x8')](_0x32fe('0x9'),attributes,{'tableName':_0x32fe('0xa'),'paranoid':![],'indexes':[{'name':_0x32fe('0xb'),'fields':['idField',_0x32fe('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index f368238..a13ec09 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 _0xebaa=['request','then','SalesforceField,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xebaa,0x69));var _0xaeba=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xebaa[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaeba('0x0'));var BPromise=require('bluebird');var rs=require(_0xaeba('0x1'));var fs=require('fs');var Redis=require(_0xaeba('0x2'));var db=require(_0xaeba('0x3'))['db'];var utils=require(_0xaeba('0x4'));var logger=require(_0xaeba('0x5'))('rpc');var config=require(_0xaeba('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xaeba('0x7')][_0xaeba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b0ff,_0x544ac,_0x1edb44){return new BPromise(function(_0x3b1e12,_0x1cc385){return client[_0xaeba('0x9')](_0x1b0ff,_0x1edb44)[_0xaeba('0xa')](function(_0x208bf1){logger['info'](_0xaeba('0xb'),_0x544ac,'request\x20sent');logger[_0xaeba('0xc')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x544ac,'request\x20sent',JSON['stringify'](_0x208bf1));if(_0x208bf1[_0xaeba('0xd')]){if(_0x208bf1['error'][_0xaeba('0xe')]===0x1f4){logger['error'](_0xaeba('0xb'),_0x544ac,_0x208bf1['error']['message']);return _0x1cc385(_0x208bf1[_0xaeba('0xd')]['message']);}logger[_0xaeba('0xd')](_0xaeba('0xb'),_0x544ac,_0x208bf1[_0xaeba('0xd')][_0xaeba('0xf')]);return _0x3b1e12(_0x208bf1['error']['message']);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x544ac,_0xaeba('0x10'));_0x3b1e12(_0x208bf1[_0xaeba('0x11')][_0xaeba('0xf')]);}})[_0xaeba('0x12')](function(_0x127d65){logger[_0xaeba('0xd')](_0xaeba('0xb'),_0x544ac,_0x127d65);_0x1cc385(_0x127d65);});});} \ No newline at end of file +var _0x0efa=['message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x16f61c,_0x6efd1e){var _0x207066=function(_0x400841){while(--_0x400841){_0x16f61c['push'](_0x16f61c['shift']());}};_0x207066(++_0x6efd1e);}(_0x0efa,0x10a));var _0xa0ef=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x0efa[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0xa0ef('0x0'));var util=require(_0xa0ef('0x1'));var moment=require(_0xa0ef('0x2'));var BPromise=require(_0xa0ef('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa0ef('0x4'))['db'];var utils=require(_0xa0ef('0x5'));var logger=require(_0xa0ef('0x6'))(_0xa0ef('0x7'));var config=require(_0xa0ef('0x8'));var jayson=require(_0xa0ef('0x9'));var client=jayson[_0xa0ef('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3815e2,_0x4784e7,_0x2c2f41){return new BPromise(function(_0x10ad5c,_0x147ef3){return client[_0xa0ef('0xb')](_0x3815e2,_0x2c2f41)[_0xa0ef('0xc')](function(_0x5c3ce2){logger[_0xa0ef('0xd')](_0xa0ef('0xe'),_0x4784e7,_0xa0ef('0xf'));logger[_0xa0ef('0x10')](_0xa0ef('0x11'),_0x4784e7,_0xa0ef('0xf'),JSON[_0xa0ef('0x12')](_0x5c3ce2));if(_0x5c3ce2[_0xa0ef('0x13')]){if(_0x5c3ce2['error']['code']===0x1f4){logger['error'](_0xa0ef('0xe'),_0x4784e7,_0x5c3ce2['error'][_0xa0ef('0x14')]);return _0x147ef3(_0x5c3ce2[_0xa0ef('0x13')]['message']);}logger[_0xa0ef('0x13')](_0xa0ef('0xe'),_0x4784e7,_0x5c3ce2[_0xa0ef('0x13')]['message']);return _0x10ad5c(_0x5c3ce2[_0xa0ef('0x13')][_0xa0ef('0x14')]);}else{logger[_0xa0ef('0xd')]('SalesforceField,\x20%s,\x20%s',_0x4784e7,'request\x20sent');_0x10ad5c(_0x5c3ce2['result'][_0xa0ef('0x14')]);}})[_0xa0ef('0x15')](function(_0x394c5c){logger[_0xa0ef('0x13')]('SalesforceField,\x20%s,\x20%s',_0x4784e7,_0x394c5c);_0x147ef3(_0x394c5c);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 3a7c030..47e125e 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 _0x9d6a=['create','/:id/configurations','addConfiguration','put','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','getFields','post'];(function(_0x4b7eab,_0x4af478){var _0x139298=function(_0x51dc35){while(--_0x51dc35){_0x4b7eab['push'](_0x4b7eab['shift']());}};_0x139298(++_0x4af478);}(_0x9d6a,0x1d0));var _0xa9d6=function(_0x15e366,_0x5d97bc){_0x15e366=_0x15e366-0x0;var _0x25ffd7=_0x9d6a[_0x15e366];return _0x25ffd7;};'use strict';var multer=require(_0xa9d6('0x0'));var util=require(_0xa9d6('0x1'));var path=require(_0xa9d6('0x2'));var timeout=require(_0xa9d6('0x3'));var express=require(_0xa9d6('0x4'));var router=express['Router']();var fs_extra=require(_0xa9d6('0x5'));var auth=require(_0xa9d6('0x6'));var interaction=require(_0xa9d6('0x7'));var config=require(_0xa9d6('0x8'));var controller=require(_0xa9d6('0x9'));router['get']('/',auth[_0xa9d6('0xa')](),controller[_0xa9d6('0xb')]);router[_0xa9d6('0xc')](_0xa9d6('0xd'),auth[_0xa9d6('0xa')](),controller[_0xa9d6('0xe')]);router[_0xa9d6('0xc')]('/:id/configurations',auth[_0xa9d6('0xa')](),controller[_0xa9d6('0xf')]);router[_0xa9d6('0xc')](_0xa9d6('0x10'),auth['isAuthenticated'](),controller[_0xa9d6('0x11')]);router[_0xa9d6('0x12')]('/',auth['isAuthenticated'](),controller[_0xa9d6('0x13')]);router[_0xa9d6('0x12')](_0xa9d6('0x14'),auth[_0xa9d6('0xa')](),controller[_0xa9d6('0x15')]);router[_0xa9d6('0x16')](_0xa9d6('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa9d6('0xd'),auth[_0xa9d6('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe205=['./intServicenowAccount.controller','get','isAuthenticated','index','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0xe205,0xa7));var _0x5e20=function(_0x33990e,_0x27b1f4){_0x33990e=_0x33990e-0x0;var _0x366423=_0xe205[_0x33990e];return _0x366423;};'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['get'](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller['getConfigurations']);router[_0x5e20('0xa')](_0x5e20('0xe'),auth[_0x5e20('0xb')](),controller[_0x5e20('0xf')]);router['post']('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0x10')]);router[_0x5e20('0x11')](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller[_0x5e20('0x12')]);router['put'](_0x5e20('0x13'),auth[_0x5e20('0xb')](),controller[_0x5e20('0x14')]);router['delete'](_0x5e20('0x13'),auth['isAuthenticated'](),controller[_0x5e20('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 59af873..b926d40 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 _0xc409=['sequelize','exports','STRING','username','remoteUri'];(function(_0x84bfd,_0x2ec337){var _0x277ebc=function(_0x9110ba){while(--_0x9110ba){_0x84bfd['push'](_0x84bfd['shift']());}};_0x277ebc(++_0x2ec337);}(_0xc409,0x13b));var _0x9c40=function(_0x2addad,_0x2345dc){_0x2addad=_0x2addad-0x0;var _0x466fde=_0xc409[_0x2addad];return _0x466fde;};'use strict';var Sequelize=require(_0x9c40('0x0'));module[_0x9c40('0x1')]={'name':{'type':Sequelize[_0x9c40('0x2')]},'description':{'type':Sequelize[_0x9c40('0x2')]},'username':{'type':Sequelize[_0x9c40('0x2')],'unique':_0x9c40('0x3')},'password':{'type':Sequelize[_0x9c40('0x2')]},'email':{'type':Sequelize[_0x9c40('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x9c40('0x4')},'serverUrl':{'type':Sequelize[_0x9c40('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x68b9=['STRING','username','remoteUri','sequelize','exports'];(function(_0x52510b,_0x3ad82f){var _0x2ee892=function(_0x164c2){while(--_0x164c2){_0x52510b['push'](_0x52510b['shift']());}};_0x2ee892(++_0x3ad82f);}(_0x68b9,0xd0));var _0x968b=function(_0x6b6340,_0x6302c4){_0x6b6340=_0x6b6340-0x0;var _0x3609bf=_0x68b9[_0x6b6340];return _0x3609bf;};'use strict';var Sequelize=require(_0x968b('0x0'));module[_0x968b('0x1')]={'name':{'type':Sequelize[_0x968b('0x2')]},'description':{'type':Sequelize[_0x968b('0x2')]},'username':{'type':Sequelize[_0x968b('0x2')],'unique':_0x968b('0x3')},'password':{'type':Sequelize[_0x968b('0x2')]},'email':{'type':Sequelize[_0x968b('0x2')]},'remoteUri':{'type':Sequelize[_0x968b('0x2')],'unique':_0x968b('0x4')},'serverUrl':{'type':Sequelize[_0x968b('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 6d071e8..a295f70 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 _0x1674=['%s/api/now/table/','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','name','internalType','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','test','statusCode','Wrong\x20credentials','boolean','True','sys_choice?sysparm_query=name=incident^element=','forEach','inactive','value','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','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','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','ServicenowAccount','include','findAll','rows','catch','show','params','options','find','create','body','update','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','channel','ServicenowField','Descriptions','made_sla','hold_reason','subcategory','close_code','notify','incident_state','category','parent','watch_list','upon_reject','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','expected_start','opened_at','business_duration','group_list','reopened_time','resolved_at','caller_id','work_notes','short_description','correlation_display','delivery_task','work_start','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','activity_due','assigned_to','comments','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','username','password','slice','substring','lastIndexOf','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1674,0x186));var _0x4167=function(_0x1cd577,_0x180f2a){_0x1cd577=_0x1cd577-0x0;var _0x790837=_0x1674[_0x1cd577];return _0x790837;};'use strict';var emlformat=require(_0x4167('0x0'));var rimraf=require(_0x4167('0x1'));var zipdir=require(_0x4167('0x2'));var jsonpatch=require(_0x4167('0x3'));var rp=require(_0x4167('0x4'));var moment=require('moment');var BPromise=require(_0x4167('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4167('0x6'));var sox=require(_0x4167('0x7'));var csv=require(_0x4167('0x8'));var ejs=require(_0x4167('0x9'));var fs=require('fs');var fs_extra=require(_0x4167('0xa'));var _=require(_0x4167('0xb'));var squel=require(_0x4167('0xc'));var crypto=require(_0x4167('0xd'));var jsforce=require(_0x4167('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4167('0x8'));var querystring=require(_0x4167('0xf'));var Papa=require('papaparse');var Redis=require(_0x4167('0x10'));var authService=require(_0x4167('0x11'));var qs=require(_0x4167('0x12'));var as=require(_0x4167('0x13'));var hardwareService=require(_0x4167('0x14'));var logger=require(_0x4167('0x15'))(_0x4167('0x16'));var utils=require(_0x4167('0x17'));var config=require(_0x4167('0x18'));var licenseUtil=require(_0x4167('0x19'));var db=require(_0x4167('0x1a'))['db'];var integrations=require(_0x4167('0x1b'));function respondWithStatusCode(_0x565dd9,_0x11655c){_0x11655c=_0x11655c||0xcc;return function(_0x311ae1){if(_0x311ae1){return _0x565dd9[_0x4167('0x1c')](_0x11655c);}return _0x565dd9[_0x4167('0x1d')](_0x11655c)[_0x4167('0x1e')]();};}function respondWithResult(_0x1813b9,_0x5d9889){_0x5d9889=_0x5d9889||0xc8;return function(_0x1f41dc){if(_0x1f41dc){return _0x1813b9[_0x4167('0x1d')](_0x5d9889)[_0x4167('0x1f')](_0x1f41dc);}};}function respondWithFilteredResult(_0x4eadbd,_0x90597a){return function(_0x6c7128){if(_0x6c7128){var _0x6908f5=typeof _0x90597a['offset']===_0x4167('0x20')&&typeof _0x90597a[_0x4167('0x21')]===_0x4167('0x20');var _0x59837d=_0x6c7128[_0x4167('0x22')];var _0x6ade3=_0x6908f5?0x0:_0x90597a[_0x4167('0x23')];var _0x50a1fc=_0x6908f5?_0x6c7128['count']:_0x90597a[_0x4167('0x23')]+_0x90597a[_0x4167('0x21')];var _0x13468c;if(_0x50a1fc>=_0x59837d){_0x50a1fc=_0x59837d;_0x13468c=0xc8;}else{_0x13468c=0xce;}_0x4eadbd[_0x4167('0x1d')](_0x13468c);return _0x4eadbd[_0x4167('0x24')](_0x4167('0x25'),_0x6ade3+'-'+_0x50a1fc+'/'+_0x59837d)[_0x4167('0x1f')](_0x6c7128);}return null;};}function patchUpdates(_0x411bae){return function(_0x57aaee){try{jsonpatch[_0x4167('0x26')](_0x57aaee,_0x411bae,!![]);}catch(_0x4473ce){return BPromise[_0x4167('0x27')](_0x4473ce);}return _0x57aaee[_0x4167('0x28')]();};}function saveUpdates(_0x573ee8,_0x4d9c04){return function(_0x34be43){if(_0x34be43){return _0x34be43['update'](_0x573ee8)['then'](function(_0x1d9559){return _0x1d9559;});}return null;};}function removeEntity(_0x3d198f,_0x31174f){return function(_0x2cd94d){if(_0x2cd94d){return _0x2cd94d[_0x4167('0x29')]()[_0x4167('0x2a')](function(){_0x3d198f[_0x4167('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e5c40,_0x2c676f){return function(_0x11e50a){if(!_0x11e50a){_0x5e5c40[_0x4167('0x1c')](0x194);}return _0x11e50a;};}function handleError(_0x5c5d63,_0x162faa){_0x162faa=_0x162faa||0x1f4;return function(_0x5c7854){logger[_0x4167('0x2b')](_0x5c7854[_0x4167('0x2c')]);if(_0x5c7854['name']){delete _0x5c7854['name'];}_0x5c5d63['status'](_0x162faa)[_0x4167('0x2d')](_0x5c7854);};}exports[_0x4167('0x2e')]=function(_0x24133f,_0x3725d4){var _0x4ad995={},_0x28bcb8={},_0x1d81fb={'count':0x0,'rows':[]};var _0x34e79b=_[_0x4167('0x2f')](db['ServicenowAccount'][_0x4167('0x30')],function(_0x8b91a3){return{'name':_0x8b91a3['fieldName'],'type':_0x8b91a3[_0x4167('0x31')][_0x4167('0x32')]};});_0x28bcb8[_0x4167('0x33')]=_[_0x4167('0x2f')](_0x34e79b,'name');_0x28bcb8[_0x4167('0x34')]=_[_0x4167('0x35')](_0x24133f['query']);_0x28bcb8['filters']=_[_0x4167('0x36')](_0x28bcb8['model'],_0x28bcb8[_0x4167('0x34')]);_0x4ad995[_0x4167('0x37')]=_[_0x4167('0x36')](_0x28bcb8[_0x4167('0x33')],qs[_0x4167('0x38')](_0x24133f['query'][_0x4167('0x38')]));_0x4ad995['attributes']=_0x4ad995['attributes'][_0x4167('0x39')]?_0x4ad995[_0x4167('0x37')]:_0x28bcb8[_0x4167('0x33')];if(!_0x24133f[_0x4167('0x34')][_0x4167('0x3a')]('nolimit')){_0x4ad995[_0x4167('0x21')]=qs[_0x4167('0x21')](_0x24133f[_0x4167('0x34')]['limit']);_0x4ad995[_0x4167('0x23')]=qs[_0x4167('0x23')](_0x24133f['query'][_0x4167('0x23')]);}_0x4ad995[_0x4167('0x3b')]=qs[_0x4167('0x3c')](_0x24133f[_0x4167('0x34')][_0x4167('0x3c')]);_0x4ad995[_0x4167('0x3d')]=qs[_0x4167('0x3e')](_[_0x4167('0x3f')](_0x24133f[_0x4167('0x34')],_0x28bcb8[_0x4167('0x3e')]),_0x34e79b);if(_0x24133f['query'][_0x4167('0x40')]){_0x4ad995[_0x4167('0x3d')]=_[_0x4167('0x41')](_0x4ad995[_0x4167('0x3d')],{'$or':_[_0x4167('0x2f')](_0x34e79b,function(_0x5bf11c){if(_0x5bf11c[_0x4167('0x31')]!==_0x4167('0x42')){var _0xf4eb4a={};_0xf4eb4a[_0x5bf11c['name']]={'$like':'%'+_0x24133f[_0x4167('0x34')][_0x4167('0x40')]+'%'};return _0xf4eb4a;}})});}_0x4ad995=_[_0x4167('0x41')]({},_0x4ad995,_0x24133f['options']);var _0x2d1b67={'where':_0x4ad995[_0x4167('0x3d')]};return db[_0x4167('0x43')][_0x4167('0x22')](_0x2d1b67)[_0x4167('0x2a')](function(_0x4432f4){_0x1d81fb['count']=_0x4432f4;if(_0x24133f['query']['includeAll']){_0x4ad995[_0x4167('0x44')]=[{'all':!![]}];}return db[_0x4167('0x43')][_0x4167('0x45')](_0x4ad995);})[_0x4167('0x2a')](function(_0x289899){_0x1d81fb[_0x4167('0x46')]=_0x289899;return _0x1d81fb;})[_0x4167('0x2a')](respondWithFilteredResult(_0x3725d4,_0x4ad995))[_0x4167('0x47')](handleError(_0x3725d4,null));};exports[_0x4167('0x48')]=function(_0x360a33,_0x595b76){var _0x57da0c={'raw':![],'where':{'id':_0x360a33[_0x4167('0x49')]['id']}},_0x5b2d4f={};_0x5b2d4f[_0x4167('0x33')]=_[_0x4167('0x35')](db[_0x4167('0x43')][_0x4167('0x30')]);_0x5b2d4f[_0x4167('0x34')]=_[_0x4167('0x35')](_0x360a33[_0x4167('0x34')]);_0x5b2d4f[_0x4167('0x3e')]=_[_0x4167('0x36')](_0x5b2d4f[_0x4167('0x33')],_0x5b2d4f[_0x4167('0x34')]);_0x57da0c['attributes']=_[_0x4167('0x36')](_0x5b2d4f['model'],qs['fields'](_0x360a33[_0x4167('0x34')]['fields']));_0x57da0c[_0x4167('0x37')]=_0x57da0c[_0x4167('0x37')][_0x4167('0x39')]?_0x57da0c[_0x4167('0x37')]:_0x5b2d4f[_0x4167('0x33')];if(_0x360a33[_0x4167('0x34')]['includeAll']){_0x57da0c['include']=[{'all':!![]}];}_0x57da0c=_[_0x4167('0x41')]({},_0x57da0c,_0x360a33[_0x4167('0x4a')]);return db['ServicenowAccount'][_0x4167('0x4b')](_0x57da0c)[_0x4167('0x2a')](handleEntityNotFound(_0x595b76,null))[_0x4167('0x2a')](respondWithResult(_0x595b76,null))[_0x4167('0x47')](handleError(_0x595b76,null));};exports[_0x4167('0x4c')]=function(_0x31899b,_0x1739a2){return db['ServicenowAccount'][_0x4167('0x4c')](_0x31899b[_0x4167('0x4d')],{})[_0x4167('0x2a')](respondWithResult(_0x1739a2,0xc9))[_0x4167('0x47')](handleError(_0x1739a2,null));};exports[_0x4167('0x4e')]=function(_0x58b0d9,_0x5af1e6){if(_0x58b0d9[_0x4167('0x4d')]['id']){delete _0x58b0d9[_0x4167('0x4d')]['id'];}return db[_0x4167('0x43')][_0x4167('0x4b')]({'where':{'id':_0x58b0d9[_0x4167('0x49')]['id']}})[_0x4167('0x2a')](handleEntityNotFound(_0x5af1e6,null))[_0x4167('0x2a')](saveUpdates(_0x58b0d9[_0x4167('0x4d')],null))[_0x4167('0x2a')](respondWithResult(_0x5af1e6,null))[_0x4167('0x47')](handleError(_0x5af1e6,null));};exports['destroy']=function(_0x43cb0a,_0x33daa3){return db[_0x4167('0x43')][_0x4167('0x4b')]({'where':{'id':_0x43cb0a[_0x4167('0x49')]['id']}})[_0x4167('0x2a')](handleEntityNotFound(_0x33daa3,null))[_0x4167('0x2a')](removeEntity(_0x33daa3,null))[_0x4167('0x47')](handleError(_0x33daa3,null));};exports['getConfigurations']=function(_0x2c8fad,_0x59f8ea,_0x4f4f52){var _0xdf3ccb={};var _0x5a6183={};var _0x4550b0;var _0x46b5e5;return db[_0x4167('0x43')][_0x4167('0x4f')]({'where':{'id':_0x2c8fad['params']['id']}})[_0x4167('0x2a')](handleEntityNotFound(_0x59f8ea,null))['then'](function(_0x548e43){if(_0x548e43){_0x4550b0=_0x548e43;_0x5a6183[_0x4167('0x33')]=_['keys'](db[_0x4167('0x50')][_0x4167('0x30')]);_0x5a6183[_0x4167('0x34')]=_[_0x4167('0x35')](_0x2c8fad[_0x4167('0x34')]);_0x5a6183[_0x4167('0x3e')]=_[_0x4167('0x36')](_0x5a6183[_0x4167('0x33')],_0x5a6183[_0x4167('0x34')]);_0xdf3ccb[_0x4167('0x37')]=_[_0x4167('0x36')](_0x5a6183[_0x4167('0x33')],qs['fields'](_0x2c8fad['query']['fields']));_0xdf3ccb[_0x4167('0x37')]=_0xdf3ccb[_0x4167('0x37')]['length']?_0xdf3ccb[_0x4167('0x37')]:_0x5a6183[_0x4167('0x33')];_0xdf3ccb[_0x4167('0x3b')]=qs[_0x4167('0x3c')](_0x2c8fad[_0x4167('0x34')]['sort']);_0xdf3ccb['where']=qs['filters'](_[_0x4167('0x3f')](_0x2c8fad[_0x4167('0x34')],_0x5a6183[_0x4167('0x3e')]));if(_0x2c8fad[_0x4167('0x34')]['filter']){_0xdf3ccb[_0x4167('0x3d')]=_[_0x4167('0x41')](_0xdf3ccb[_0x4167('0x3d')],{'$or':_['map'](_0xdf3ccb[_0x4167('0x37')],function(_0x5990ab){var _0x53fe72={};_0x53fe72[_0x5990ab]={'$like':'%'+_0x2c8fad[_0x4167('0x34')]['filter']+'%'};return _0x53fe72;})});}_0xdf3ccb=_['merge']({},_0xdf3ccb,_0x2c8fad['options']);return _0x4550b0['getConfigurations'](_0xdf3ccb);}})['then'](function(_0x5b4e74){if(_0x5b4e74){_0x46b5e5=_0x5b4e74[_0x4167('0x39')];if(!_0x2c8fad[_0x4167('0x34')][_0x4167('0x3a')]('nolimit')){_0xdf3ccb[_0x4167('0x21')]=qs['limit'](_0x2c8fad[_0x4167('0x34')]['limit']);_0xdf3ccb[_0x4167('0x23')]=qs[_0x4167('0x23')](_0x2c8fad['query'][_0x4167('0x23')]);}return _0x4550b0[_0x4167('0x51')](_0xdf3ccb);}})[_0x4167('0x2a')](function(_0x5728fa){if(_0x5728fa){return _0x5728fa?{'count':_0x46b5e5,'rows':_0x5728fa}:null;}})[_0x4167('0x2a')](respondWithResult(_0x59f8ea,null))[_0x4167('0x47')](handleError(_0x59f8ea,null));};exports[_0x4167('0x52')]=function(_0x4b3a24,_0xa743d7,_0x3c8f14){if(_0x4b3a24[_0x4167('0x4d')]['id']){delete _0x4b3a24['body']['id'];}return db['ServicenowAccount'][_0x4167('0x4f')]({'where':{'id':_0x4b3a24['params']['id']}})[_0x4167('0x2a')](handleEntityNotFound(_0xa743d7,null))[_0x4167('0x2a')](function(_0xfc4650){if(_0xfc4650){_0x4b3a24[_0x4167('0x4d')][_0x4167('0x53')]=_0xfc4650['id'];_0x4b3a24[_0x4167('0x4d')][_0x4167('0x54')]=integrations['getSubjects'](_0x4b3a24[_0x4167('0x4d')]['channel'],_0x4b3a24['body'][_0x4167('0x31')]);_0x4b3a24[_0x4167('0x4d')]['Descriptions']=integrations['getDescriptions'](_0x4b3a24[_0x4167('0x4d')][_0x4167('0x55')],_0x4b3a24[_0x4167('0x4d')][_0x4167('0x31')]);return db[_0x4167('0x50')]['create'](_0x4b3a24[_0x4167('0x4d')],{'include':[{'model':db[_0x4167('0x56')],'as':'Subjects'},{'model':db[_0x4167('0x56')],'as':_0x4167('0x57')}]});}return null;})[_0x4167('0x2a')](respondWithResult(_0xa743d7,null))['catch'](handleError(_0xa743d7,null));};exports['getFields']=function(_0x1d17b2,_0x460e1a,_0x5a0269){var _0x193211=[_0x4167('0x58'),_0x4167('0x59'),'knowledge',_0x4167('0x5a'),_0x4167('0x5b'),_0x4167('0x5c'),_0x4167('0x5d'),'severity',_0x4167('0x5e')];var _0x33c685=[_0x4167('0x5f'),'made_sla','caused_by',_0x4167('0x60'),_0x4167('0x61'),'sys_updated_on','child_incidents',_0x4167('0x59'),_0x4167('0x62'),_0x4167('0x63'),_0x4167('0x64'),_0x4167('0x65'),_0x4167('0x66'),'user_input',_0x4167('0x67'),_0x4167('0x68'),_0x4167('0x69'),_0x4167('0x6a'),'knowledge',_0x4167('0x3b'),'calendar_stc',_0x4167('0x6b'),_0x4167('0x6c'),_0x4167('0x6d'),'impact',_0x4167('0x6e'),_0x4167('0x6f'),_0x4167('0x70'),_0x4167('0x71'),_0x4167('0x72'),_0x4167('0x73'),'time_worked',_0x4167('0x74'),_0x4167('0x75'),_0x4167('0x76'),_0x4167('0x77'),'work_end',_0x4167('0x78'),_0x4167('0x79'),_0x4167('0x7a'),'approval_set',_0x4167('0x5a'),_0x4167('0x7b'),_0x4167('0x7c'),'close_code',_0x4167('0x7d'),_0x4167('0x7e'),_0x4167('0x7f'),'assignment_group','business_stc',_0x4167('0x80'),_0x4167('0x81'),_0x4167('0x82'),_0x4167('0x5c'),_0x4167('0x83'),_0x4167('0x84'),_0x4167('0x85'),_0x4167('0x86'),_0x4167('0x87'),_0x4167('0x88'),_0x4167('0x89'),_0x4167('0x8a'),'incident_state',_0x4167('0x8b'),_0x4167('0x8c'),_0x4167('0x8d'),'reassignment_count',_0x4167('0x8e'),_0x4167('0x8f'),'severity',_0x4167('0x90'),'sla_due','approval',_0x4167('0x91'),_0x4167('0x92'),_0x4167('0x93'),_0x4167('0x94'),_0x4167('0x95'),_0x4167('0x96'),_0x4167('0x97'),_0x4167('0x98'),'location',_0x4167('0x5e')];var _0x13f946='';var _0x3ecf77='';var _0x4fd9c0=[];var _0x17e91f='';var _0x54139b='';var _0x206ba2=[];var _0x557829='';var _0x6b84c='';var _0x3f1d38={};var _0x8a9588='';return db[_0x4167('0x43')][_0x4167('0x4f')]({'where':{'id':_0x1d17b2[_0x4167('0x49')]['id']},'attributes':['id',_0x4167('0x99'),_0x4167('0x9a'),'email','remoteUri','serverUrl']})[_0x4167('0x2a')](handleEntityNotFound(_0x460e1a,null))[_0x4167('0x2a')](function(_0x4661db){if(_0x4661db){_0x8a9588=_0x4661db['remoteUri'];var _0x509a5e=_0x8a9588[_0x4167('0x9b')](-0x1);if(_0x509a5e==='/'){_0x8a9588=_0x8a9588[_0x4167('0x9c')](0x0,_0x8a9588[_0x4167('0x9d')](_0x509a5e));}_0x6b84c=util[_0x4167('0x9e')]('%s/api/now/doc/table/schema/',_0x8a9588);_0x557829=util[_0x4167('0x9e')](_0x4167('0x9f'),_0x8a9588);_0x3f1d38={'user':_0x4661db['username'],'pass':_0x4661db[_0x4167('0x9a')]};var _0x2da928={'method':'GET','uri':_0x6b84c+_0x4167('0xa0'),'auth':_0x3f1d38,'json':!![]};return rp(_0x2da928);}})[_0x4167('0x2a')](function(_0x24168c){if(_0x24168c[_0x4167('0xa1')][_0x4167('0x39')]>0x0){_0x13f946=_0x24168c[_0x4167('0xa1')];}console[_0x4167('0xa2')](_0x4167('0xa3'),_0x13f946);_0x206ba2=[];_0x3ecf77=Object[_0x4167('0xa4')]([],_0x13f946);_['remove'](_0x3ecf77,function(_0x2855bf){return!_0x193211[_0x4167('0xa5')](_0x2855bf[_0x4167('0xa6')]);});_0x3ecf77['forEach'](function(_0x256e41){var _0x1043e7=createFieldObject(_0x557829,_0x3f1d38,_0x256e41[_0x4167('0xa7')],_0x256e41[_0x4167('0xa6')],_0x256e41['label'],![]);_0x206ba2['push'](_0x1043e7);});return Promise[_0x4167('0xa8')](_0x206ba2);})[_0x4167('0x2a')](function(_0x13b045){_0x4fd9c0=_0x13b045;_0x17e91f=Object[_0x4167('0xa4')]([],_0x13f946);console[_0x4167('0xa2')](_0x4167('0xa9'),_0x13f946);_[_0x4167('0xaa')](_0x17e91f,function(_0x42d83e){return _0x33c685[_0x4167('0xa5')](_0x42d83e[_0x4167('0xa6')]);});console[_0x4167('0xa2')](_0x4167('0xab'),_0x17e91f);_0x206ba2=[];_0x17e91f['forEach'](function(_0x122b98){var _0x53c876=createFieldObject(_0x557829,_0x3f1d38,_0x122b98[_0x4167('0xa7')],_0x122b98[_0x4167('0xa6')],_0x122b98[_0x4167('0xac')],!![]);_0x206ba2['push'](_0x53c876);});return Promise['all'](_0x206ba2);})['then'](function(_0x5aac7c){_0x54139b=_0x5aac7c;var _0x1ecbec=_0x4fd9c0['concat'](_0x54139b);return{'count':_0x1ecbec[_0x4167('0x39')],'rows':_0x1ecbec};})[_0x4167('0x2a')](respondWithResult(_0x460e1a,null))[_0x4167('0x47')](function(_0x7d25f6){console[_0x4167('0xa2')]('ServiceNow\x20error:\x20'+_0x7d25f6);var _0x29e2f3=_0x1d17b2[_0x4167('0x34')][_0x4167('0xad')]?0x1f4:_0x7d25f6[_0x4167('0xae')]||0x1f4;logger['error'](_0x7d25f6['stack']);delete _0x7d25f6[_0x4167('0xa6')];if(_0x29e2f3===0x191){_0x29e2f3=0x190;}_0x460e1a[_0x4167('0x1d')](_0x29e2f3)[_0x4167('0x2d')](_0x1d17b2[_0x4167('0x34')][_0x4167('0xad')]?{'message':_0x4167('0xaf'),'statusCode':_0x7d25f6['statusCode']}:_0x7d25f6);});};function createFieldObject(_0x4bcb20,_0x2de4fc,_0x458af6,_0x53e718,_0x1f9e9f,_0x224193){return new Promise(function(_0x3e30cd,_0x1201cf){var _0x298eb2={'id':_0x53e718,'name':_0x1f9e9f,'custom':_0x224193};if(_0x458af6===_0x4167('0xb0')){_0x298eb2[_0x4167('0x4a')]=[{'name':_0x4167('0xb1'),'value':'true'},{'name':'False','value':'false'}];_0x3e30cd(_0x298eb2);}else{var _0xc92931={'method':'GET','uri':_0x4bcb20+_0x4167('0xb2')+_0x53e718,'auth':_0x2de4fc,'json':!![]};return rp(_0xc92931)[_0x4167('0x2a')](function(_0x1dd1e6){var _0x106723=[];if(_0x1dd1e6[_0x4167('0xa1')][_0x4167('0x39')]>0x0){_0x1dd1e6[_0x4167('0xa1')][_0x4167('0xb3')](function(_0x3c6f44){if(_0x3c6f44[_0x4167('0xb4')]==='false'){var _0x3800bd={'name':_0x3c6f44['label'],'value':_0x3c6f44[_0x4167('0xb5')]};_0x106723[_0x4167('0xb6')](_0x3800bd);}});}_0x298eb2[_0x4167('0x4a')]=_0x106723;if(_0x298eb2[_0x4167('0x4a')][_0x4167('0x39')]>0x0){_0x3e30cd(_0x298eb2);}else{if(_0x224193==![]){_0x3e30cd();}else{_0x3e30cd(_0x298eb2);}}});}});} \ No newline at end of file +var _0x90b4=['work_end','reopened_time','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','calendar_duration','close_notes','closed_by','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','username','email','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','forEach','internalType','label','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','ServiceNow\x20error:\x20','statusCode','stack','test','boolean','true','false','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','rows','show','keys','catch','create','body','find','params','getConfigurations','findOne','pick','addConfiguration','AccountId','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','Subjects','made_sla','hold_reason','subcategory','close_code','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','child_incidents','approval_history','number','resolved_by','user_input','sys_created_on','sys_domain','state','knowledge','closed_at','cmdb_ci','impact','active','work_notes_list','priority','sys_domain_path','rfc','expected_start'];(function(_0x11980a,_0x29e162){var _0x1e480d=function(_0x1c2238){while(--_0x1c2238){_0x11980a['push'](_0x11980a['shift']());}};_0x1e480d(++_0x29e162);}(_0x90b4,0x195));var _0x490b=function(_0x250784,_0x3d2862){_0x250784=_0x250784-0x0;var _0x3bf248=_0x90b4[_0x250784];return _0x3bf248;};'use strict';var emlformat=require(_0x490b('0x0'));var rimraf=require(_0x490b('0x1'));var zipdir=require(_0x490b('0x2'));var jsonpatch=require(_0x490b('0x3'));var rp=require('request-promise');var moment=require(_0x490b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x490b('0x5'));var util=require(_0x490b('0x6'));var path=require('path');var sox=require(_0x490b('0x7'));var csv=require(_0x490b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x490b('0x9'));var _=require(_0x490b('0xa'));var squel=require(_0x490b('0xb'));var crypto=require(_0x490b('0xc'));var jsforce=require(_0x490b('0xd'));var deskjs=require(_0x490b('0xe'));var toCsv=require(_0x490b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x490b('0xf'));var authService=require(_0x490b('0x10'));var qs=require(_0x490b('0x11'));var as=require(_0x490b('0x12'));var hardwareService=require(_0x490b('0x13'));var logger=require(_0x490b('0x14'))('api');var utils=require(_0x490b('0x15'));var config=require(_0x490b('0x16'));var licenseUtil=require(_0x490b('0x17'));var db=require(_0x490b('0x18'))['db'];var integrations=require(_0x490b('0x19'));function respondWithStatusCode(_0x512b55,_0x433d4a){_0x433d4a=_0x433d4a||0xcc;return function(_0x314b3d){if(_0x314b3d){return _0x512b55[_0x490b('0x1a')](_0x433d4a);}return _0x512b55[_0x490b('0x1b')](_0x433d4a)[_0x490b('0x1c')]();};}function respondWithResult(_0x3ba8cb,_0x4927c9){_0x4927c9=_0x4927c9||0xc8;return function(_0x304cdf){if(_0x304cdf){return _0x3ba8cb[_0x490b('0x1b')](_0x4927c9)[_0x490b('0x1d')](_0x304cdf);}};}function respondWithFilteredResult(_0x4b56f4,_0x48156d){return function(_0x334688){if(_0x334688){var _0x33ef4a=typeof _0x48156d[_0x490b('0x1e')]==='undefined'&&typeof _0x48156d[_0x490b('0x1f')]===_0x490b('0x20');var _0x495704=_0x334688[_0x490b('0x21')];var _0x565f41=_0x33ef4a?0x0:_0x48156d[_0x490b('0x1e')];var _0x478cea=_0x33ef4a?_0x334688[_0x490b('0x21')]:_0x48156d[_0x490b('0x1e')]+_0x48156d['limit'];var _0x45c525;if(_0x478cea>=_0x495704){_0x478cea=_0x495704;_0x45c525=0xc8;}else{_0x45c525=0xce;}_0x4b56f4['status'](_0x45c525);return _0x4b56f4['set'](_0x490b('0x22'),_0x565f41+'-'+_0x478cea+'/'+_0x495704)['json'](_0x334688);}return null;};}function patchUpdates(_0x2ee92c){return function(_0x179f0c){try{jsonpatch[_0x490b('0x23')](_0x179f0c,_0x2ee92c,!![]);}catch(_0x2b46f4){return BPromise[_0x490b('0x24')](_0x2b46f4);}return _0x179f0c[_0x490b('0x25')]();};}function saveUpdates(_0x1c90c9,_0x11e55d){return function(_0x45c597){if(_0x45c597){return _0x45c597[_0x490b('0x26')](_0x1c90c9)['then'](function(_0x235a8e){return _0x235a8e;});}return null;};}function removeEntity(_0x1601f7,_0x172c9d){return function(_0x106abb){if(_0x106abb){return _0x106abb[_0x490b('0x27')]()[_0x490b('0x28')](function(){_0x1601f7[_0x490b('0x1b')](0xcc)[_0x490b('0x1c')]();});}};}function handleEntityNotFound(_0xef0d23,_0x4d7483){return function(_0x2b2274){if(!_0x2b2274){_0xef0d23[_0x490b('0x1a')](0x194);}return _0x2b2274;};}function handleError(_0x1b8cf4,_0x5b3455){_0x5b3455=_0x5b3455||0x1f4;return function(_0x543df9){logger[_0x490b('0x29')](_0x543df9['stack']);if(_0x543df9[_0x490b('0x2a')]){delete _0x543df9[_0x490b('0x2a')];}_0x1b8cf4[_0x490b('0x1b')](_0x5b3455)[_0x490b('0x2b')](_0x543df9);};}exports[_0x490b('0x2c')]=function(_0x2477e3,_0x371f65){var _0x25a149={},_0x215bb5={},_0x55bf9f={'count':0x0,'rows':[]};var _0x454a76=_[_0x490b('0x2d')](db[_0x490b('0x2e')][_0x490b('0x2f')],function(_0x53acc2){return{'name':_0x53acc2[_0x490b('0x30')],'type':_0x53acc2[_0x490b('0x31')]['key']};});_0x215bb5[_0x490b('0x32')]=_[_0x490b('0x2d')](_0x454a76,_0x490b('0x2a'));_0x215bb5[_0x490b('0x33')]=_['keys'](_0x2477e3[_0x490b('0x33')]);_0x215bb5['filters']=_[_0x490b('0x34')](_0x215bb5[_0x490b('0x32')],_0x215bb5[_0x490b('0x33')]);_0x25a149[_0x490b('0x35')]=_[_0x490b('0x34')](_0x215bb5[_0x490b('0x32')],qs[_0x490b('0x36')](_0x2477e3['query'][_0x490b('0x36')]));_0x25a149[_0x490b('0x35')]=_0x25a149['attributes'][_0x490b('0x37')]?_0x25a149[_0x490b('0x35')]:_0x215bb5['model'];if(!_0x2477e3['query']['hasOwnProperty'](_0x490b('0x38'))){_0x25a149['limit']=qs[_0x490b('0x1f')](_0x2477e3[_0x490b('0x33')][_0x490b('0x1f')]);_0x25a149[_0x490b('0x1e')]=qs[_0x490b('0x1e')](_0x2477e3[_0x490b('0x33')][_0x490b('0x1e')]);}_0x25a149[_0x490b('0x39')]=qs['sort'](_0x2477e3[_0x490b('0x33')][_0x490b('0x3a')]);_0x25a149['where']=qs[_0x490b('0x3b')](_['pick'](_0x2477e3[_0x490b('0x33')],_0x215bb5[_0x490b('0x3b')]),_0x454a76);if(_0x2477e3['query'][_0x490b('0x3c')]){_0x25a149[_0x490b('0x3d')]=_[_0x490b('0x3e')](_0x25a149[_0x490b('0x3d')],{'$or':_[_0x490b('0x2d')](_0x454a76,function(_0x12491f){if(_0x12491f[_0x490b('0x31')]!==_0x490b('0x3f')){var _0x4cadbc={};_0x4cadbc[_0x12491f[_0x490b('0x2a')]]={'$like':'%'+_0x2477e3[_0x490b('0x33')][_0x490b('0x3c')]+'%'};return _0x4cadbc;}})});}_0x25a149=_[_0x490b('0x3e')]({},_0x25a149,_0x2477e3[_0x490b('0x40')]);var _0x1295f0={'where':_0x25a149[_0x490b('0x3d')]};return db['ServicenowAccount'][_0x490b('0x21')](_0x1295f0)['then'](function(_0x54ec81){_0x55bf9f[_0x490b('0x21')]=_0x54ec81;if(_0x2477e3[_0x490b('0x33')]['includeAll']){_0x25a149[_0x490b('0x41')]=[{'all':!![]}];}return db[_0x490b('0x2e')]['findAll'](_0x25a149);})[_0x490b('0x28')](function(_0x4b9ab9){_0x55bf9f[_0x490b('0x42')]=_0x4b9ab9;return _0x55bf9f;})[_0x490b('0x28')](respondWithFilteredResult(_0x371f65,_0x25a149))['catch'](handleError(_0x371f65,null));};exports[_0x490b('0x43')]=function(_0x2d1caa,_0x572dc5){var _0x7ecc0c={'raw':![],'where':{'id':_0x2d1caa['params']['id']}},_0x1e23ad={};_0x1e23ad[_0x490b('0x32')]=_[_0x490b('0x44')](db[_0x490b('0x2e')][_0x490b('0x2f')]);_0x1e23ad['query']=_[_0x490b('0x44')](_0x2d1caa[_0x490b('0x33')]);_0x1e23ad[_0x490b('0x3b')]=_[_0x490b('0x34')](_0x1e23ad['model'],_0x1e23ad[_0x490b('0x33')]);_0x7ecc0c['attributes']=_[_0x490b('0x34')](_0x1e23ad[_0x490b('0x32')],qs[_0x490b('0x36')](_0x2d1caa['query'][_0x490b('0x36')]));_0x7ecc0c[_0x490b('0x35')]=_0x7ecc0c[_0x490b('0x35')][_0x490b('0x37')]?_0x7ecc0c[_0x490b('0x35')]:_0x1e23ad[_0x490b('0x32')];if(_0x2d1caa[_0x490b('0x33')]['includeAll']){_0x7ecc0c[_0x490b('0x41')]=[{'all':!![]}];}_0x7ecc0c=_[_0x490b('0x3e')]({},_0x7ecc0c,_0x2d1caa[_0x490b('0x40')]);return db['ServicenowAccount']['find'](_0x7ecc0c)[_0x490b('0x28')](handleEntityNotFound(_0x572dc5,null))[_0x490b('0x28')](respondWithResult(_0x572dc5,null))[_0x490b('0x45')](handleError(_0x572dc5,null));};exports[_0x490b('0x46')]=function(_0x4d712c,_0x5b965c){return db['ServicenowAccount']['create'](_0x4d712c['body'],{})[_0x490b('0x28')](respondWithResult(_0x5b965c,0xc9))[_0x490b('0x45')](handleError(_0x5b965c,null));};exports['update']=function(_0x48916b,_0x5294b0){if(_0x48916b[_0x490b('0x47')]['id']){delete _0x48916b['body']['id'];}return db[_0x490b('0x2e')][_0x490b('0x48')]({'where':{'id':_0x48916b[_0x490b('0x49')]['id']}})['then'](handleEntityNotFound(_0x5294b0,null))['then'](saveUpdates(_0x48916b[_0x490b('0x47')],null))[_0x490b('0x28')](respondWithResult(_0x5294b0,null))[_0x490b('0x45')](handleError(_0x5294b0,null));};exports[_0x490b('0x27')]=function(_0x3a24fb,_0xff30dd){return db[_0x490b('0x2e')][_0x490b('0x48')]({'where':{'id':_0x3a24fb['params']['id']}})['then'](handleEntityNotFound(_0xff30dd,null))[_0x490b('0x28')](removeEntity(_0xff30dd,null))[_0x490b('0x45')](handleError(_0xff30dd,null));};exports[_0x490b('0x4a')]=function(_0x19b94b,_0x3df5ca,_0x47a780){var _0x495cef={};var _0x25c17e={};var _0x55fca0;var _0x502c07;return db['ServicenowAccount'][_0x490b('0x4b')]({'where':{'id':_0x19b94b[_0x490b('0x49')]['id']}})['then'](handleEntityNotFound(_0x3df5ca,null))[_0x490b('0x28')](function(_0x10e4b6){if(_0x10e4b6){_0x55fca0=_0x10e4b6;_0x25c17e[_0x490b('0x32')]=_[_0x490b('0x44')](db['ServicenowConfiguration'][_0x490b('0x2f')]);_0x25c17e[_0x490b('0x33')]=_[_0x490b('0x44')](_0x19b94b['query']);_0x25c17e['filters']=_[_0x490b('0x34')](_0x25c17e[_0x490b('0x32')],_0x25c17e[_0x490b('0x33')]);_0x495cef['attributes']=_[_0x490b('0x34')](_0x25c17e[_0x490b('0x32')],qs[_0x490b('0x36')](_0x19b94b['query'][_0x490b('0x36')]));_0x495cef[_0x490b('0x35')]=_0x495cef['attributes'][_0x490b('0x37')]?_0x495cef[_0x490b('0x35')]:_0x25c17e[_0x490b('0x32')];_0x495cef['order']=qs[_0x490b('0x3a')](_0x19b94b[_0x490b('0x33')]['sort']);_0x495cef['where']=qs[_0x490b('0x3b')](_[_0x490b('0x4c')](_0x19b94b[_0x490b('0x33')],_0x25c17e[_0x490b('0x3b')]));if(_0x19b94b[_0x490b('0x33')][_0x490b('0x3c')]){_0x495cef[_0x490b('0x3d')]=_[_0x490b('0x3e')](_0x495cef[_0x490b('0x3d')],{'$or':_['map'](_0x495cef['attributes'],function(_0x406a56){var _0xd366e6={};_0xd366e6[_0x406a56]={'$like':'%'+_0x19b94b[_0x490b('0x33')][_0x490b('0x3c')]+'%'};return _0xd366e6;})});}_0x495cef=_[_0x490b('0x3e')]({},_0x495cef,_0x19b94b['options']);return _0x55fca0[_0x490b('0x4a')](_0x495cef);}})[_0x490b('0x28')](function(_0x2be503){if(_0x2be503){_0x502c07=_0x2be503[_0x490b('0x37')];if(!_0x19b94b[_0x490b('0x33')]['hasOwnProperty'](_0x490b('0x38'))){_0x495cef[_0x490b('0x1f')]=qs[_0x490b('0x1f')](_0x19b94b[_0x490b('0x33')][_0x490b('0x1f')]);_0x495cef['offset']=qs[_0x490b('0x1e')](_0x19b94b[_0x490b('0x33')][_0x490b('0x1e')]);}return _0x55fca0[_0x490b('0x4a')](_0x495cef);}})[_0x490b('0x28')](function(_0x5636c8){if(_0x5636c8){return _0x5636c8?{'count':_0x502c07,'rows':_0x5636c8}:null;}})[_0x490b('0x28')](respondWithResult(_0x3df5ca,null))['catch'](handleError(_0x3df5ca,null));};exports[_0x490b('0x4d')]=function(_0x3a9866,_0x356af9,_0x383185){if(_0x3a9866['body']['id']){delete _0x3a9866[_0x490b('0x47')]['id'];}return db[_0x490b('0x2e')][_0x490b('0x4b')]({'where':{'id':_0x3a9866[_0x490b('0x49')]['id']}})[_0x490b('0x28')](handleEntityNotFound(_0x356af9,null))[_0x490b('0x28')](function(_0x5df8f0){if(_0x5df8f0){_0x3a9866['body'][_0x490b('0x4e')]=_0x5df8f0['id'];_0x3a9866[_0x490b('0x47')]['Subjects']=integrations['getSubjects'](_0x3a9866[_0x490b('0x47')][_0x490b('0x4f')],_0x3a9866[_0x490b('0x47')][_0x490b('0x31')]);_0x3a9866['body'][_0x490b('0x50')]=integrations[_0x490b('0x51')](_0x3a9866[_0x490b('0x47')][_0x490b('0x4f')],_0x3a9866[_0x490b('0x47')][_0x490b('0x31')]);return db[_0x490b('0x52')][_0x490b('0x46')](_0x3a9866[_0x490b('0x47')],{'include':[{'model':db[_0x490b('0x53')],'as':_0x490b('0x54')},{'model':db[_0x490b('0x53')],'as':_0x490b('0x50')}]});}return null;})[_0x490b('0x28')](respondWithResult(_0x356af9,null))['catch'](handleError(_0x356af9,null));};exports['getFields']=function(_0x3232ef,_0x4ec5e8,_0x191260){var _0x517ffc=[_0x490b('0x55'),_0x490b('0x56'),'knowledge',_0x490b('0x57'),_0x490b('0x58'),_0x490b('0x59'),_0x490b('0x5a'),'severity',_0x490b('0x5b')];var _0x5059da=[_0x490b('0x5c'),_0x490b('0x55'),_0x490b('0x5d'),_0x490b('0x5e'),_0x490b('0x5f'),'sys_updated_on',_0x490b('0x60'),'hold_reason',_0x490b('0x61'),_0x490b('0x62'),_0x490b('0x63'),'sys_updated_by','opened_by',_0x490b('0x64'),_0x490b('0x65'),_0x490b('0x66'),_0x490b('0x67'),'sys_created_by',_0x490b('0x68'),_0x490b('0x39'),'calendar_stc',_0x490b('0x69'),_0x490b('0x6a'),'delivery_plan',_0x490b('0x6b'),_0x490b('0x6c'),_0x490b('0x6d'),'business_service',_0x490b('0x6e'),_0x490b('0x6f'),_0x490b('0x70'),'time_worked',_0x490b('0x71'),'opened_at','business_duration','group_list',_0x490b('0x72'),_0x490b('0x73'),'resolved_at',_0x490b('0x74'),_0x490b('0x75'),'subcategory',_0x490b('0x76'),_0x490b('0x77'),_0x490b('0x58'),_0x490b('0x78'),_0x490b('0x79'),'work_start','assignment_group','business_stc','additional_assignee_list','description',_0x490b('0x7a'),_0x490b('0x59'),'sys_class_name',_0x490b('0x7b'),_0x490b('0x7c'),'follow_up',_0x490b('0x7d'),_0x490b('0x7e'),_0x490b('0x7f'),_0x490b('0x80'),'incident_state',_0x490b('0x81'),_0x490b('0x82'),_0x490b('0x83'),'reassignment_count','activity_due',_0x490b('0x84'),_0x490b('0x85'),_0x490b('0x86'),_0x490b('0x87'),_0x490b('0x88'),_0x490b('0x89'),'due_date',_0x490b('0x8a'),_0x490b('0x8b'),_0x490b('0x8c'),_0x490b('0x8d'),'upon_approval','correlation_id','location',_0x490b('0x5b')];var _0x39efba='';var _0x15350c='';var _0x104957=[];var _0xb27ba7='';var _0x36da53='';var _0x2e906e=[];var _0x44f6f0='';var _0x509955='';var _0x3a0916={};var _0x33be02='';return db[_0x490b('0x2e')][_0x490b('0x4b')]({'where':{'id':_0x3232ef[_0x490b('0x49')]['id']},'attributes':['id',_0x490b('0x8e'),'password',_0x490b('0x8f'),_0x490b('0x90'),'serverUrl']})[_0x490b('0x28')](handleEntityNotFound(_0x4ec5e8,null))[_0x490b('0x28')](function(_0x3b393f){if(_0x3b393f){_0x33be02=_0x3b393f[_0x490b('0x90')];var _0x31b1af=_0x33be02[_0x490b('0x91')](-0x1);if(_0x31b1af==='/'){_0x33be02=_0x33be02['substring'](0x0,_0x33be02[_0x490b('0x92')](_0x31b1af));}_0x509955=util[_0x490b('0x93')](_0x490b('0x94'),_0x33be02);_0x44f6f0=util[_0x490b('0x93')]('%s/api/now/table/',_0x33be02);_0x3a0916={'user':_0x3b393f[_0x490b('0x8e')],'pass':_0x3b393f['password']};var _0x12bb4e={'method':_0x490b('0x95'),'uri':_0x509955+_0x490b('0x96'),'auth':_0x3a0916,'json':!![]};return rp(_0x12bb4e);}})[_0x490b('0x28')](function(_0x350ff4){if(_0x350ff4['result'][_0x490b('0x37')]>0x0){_0x39efba=_0x350ff4[_0x490b('0x97')];}console[_0x490b('0x98')](_0x490b('0x99'),_0x39efba);_0x2e906e=[];_0x15350c=Object['assign']([],_0x39efba);_[_0x490b('0x9a')](_0x15350c,function(_0x317cf1){return!_0x517ffc[_0x490b('0x9b')](_0x317cf1['name']);});_0x15350c[_0x490b('0x9c')](function(_0x5c090b){var _0x9ca1ee=createFieldObject(_0x44f6f0,_0x3a0916,_0x5c090b[_0x490b('0x9d')],_0x5c090b[_0x490b('0x2a')],_0x5c090b[_0x490b('0x9e')],![]);_0x2e906e['push'](_0x9ca1ee);});return Promise[_0x490b('0x9f')](_0x2e906e);})['then'](function(_0x342964){_0x104957=_0x342964;_0xb27ba7=Object[_0x490b('0xa0')]([],_0x39efba);console[_0x490b('0x98')](_0x490b('0xa1'),_0x39efba);_[_0x490b('0x9a')](_0xb27ba7,function(_0x17a5f3){return _0x5059da[_0x490b('0x9b')](_0x17a5f3['name']);});console['log'](_0x490b('0xa2'),_0xb27ba7);_0x2e906e=[];_0xb27ba7[_0x490b('0x9c')](function(_0x54f4aa){var _0xa92dae=createFieldObject(_0x44f6f0,_0x3a0916,_0x54f4aa[_0x490b('0x9d')],_0x54f4aa[_0x490b('0x2a')],_0x54f4aa[_0x490b('0x9e')],!![]);_0x2e906e[_0x490b('0xa3')](_0xa92dae);});return Promise['all'](_0x2e906e);})[_0x490b('0x28')](function(_0x186641){_0x36da53=_0x186641;var _0x441a3a=_0x104957['concat'](_0x36da53);return{'count':_0x441a3a['length'],'rows':_0x441a3a};})[_0x490b('0x28')](respondWithResult(_0x4ec5e8,null))['catch'](function(_0x58b909){console[_0x490b('0x98')](_0x490b('0xa4')+_0x58b909);var _0x41a161=_0x3232ef[_0x490b('0x33')]['test']?0x1f4:_0x58b909[_0x490b('0xa5')]||0x1f4;logger['error'](_0x58b909[_0x490b('0xa6')]);delete _0x58b909['name'];if(_0x41a161===0x191){_0x41a161=0x190;}_0x4ec5e8[_0x490b('0x1b')](_0x41a161)[_0x490b('0x2b')](_0x3232ef[_0x490b('0x33')][_0x490b('0xa7')]?{'message':'Wrong\x20credentials','statusCode':_0x58b909['statusCode']}:_0x58b909);});};function createFieldObject(_0xe586bc,_0x2e0cf8,_0x527208,_0x1610ad,_0x5d3047,_0x275371){return new Promise(function(_0x117511,_0xb99a81){var _0x3c1efd={'id':_0x1610ad,'name':_0x5d3047,'custom':_0x275371};if(_0x527208===_0x490b('0xa8')){_0x3c1efd[_0x490b('0x40')]=[{'name':'True','value':_0x490b('0xa9')},{'name':'False','value':_0x490b('0xaa')}];_0x117511(_0x3c1efd);}else{var _0x5be5fd={'method':_0x490b('0x95'),'uri':_0xe586bc+'sys_choice?sysparm_query=name=incident^element='+_0x1610ad,'auth':_0x2e0cf8,'json':!![]};return rp(_0x5be5fd)['then'](function(_0x3605c5){var _0x2ecad4=[];if(_0x3605c5[_0x490b('0x97')]['length']>0x0){_0x3605c5[_0x490b('0x97')][_0x490b('0x9c')](function(_0x2f356c){if(_0x2f356c[_0x490b('0xab')]==='false'){var _0x62b840={'name':_0x2f356c['label'],'value':_0x2f356c[_0x490b('0xac')]};_0x2ecad4[_0x490b('0xa3')](_0x62b840);}});}_0x3c1efd[_0x490b('0x40')]=_0x2ecad4;if(_0x3c1efd[_0x490b('0x40')][_0x490b('0x37')]>0x0){_0x117511(_0x3c1efd);}else{if(_0x275371==![]){_0x117511();}else{_0x117511(_0x3c1efd);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 434017f..513f3b2 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 _0x5d17=['lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts'];(function(_0x5e8dd0,_0x52a1a4){var _0x5d7345=function(_0x263a6d){while(--_0x263a6d){_0x5e8dd0['push'](_0x5e8dd0['shift']());}};_0x5d7345(++_0x52a1a4);}(_0x5d17,0x114));var _0x75d1=function(_0x13184d,_0x6bdeb0){_0x13184d=_0x13184d-0x0;var _0x384a96=_0x5d17[_0x13184d];return _0x384a96;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75d1('0x2'));var BPromise=require(_0x75d1('0x3'));var rp=require(_0x75d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var attributes=require(_0x75d1('0x7'));var integrations=require(_0x75d1('0x8'));module['exports']=function(_0x458681,_0x116a51){return _0x458681[_0x75d1('0x9')](_0x75d1('0xa'),attributes,{'tableName':_0x75d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba34=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x4e1ea3,_0x122950){var _0x3ad634=function(_0x35e917){while(--_0x35e917){_0x4e1ea3['push'](_0x4e1ea3['shift']());}};_0x3ad634(++_0x122950);}(_0xba34,0x119));var _0x4ba3=function(_0x49c068,_0x458032){_0x49c068=_0x49c068-0x0;var _0x4a865f=_0xba34[_0x49c068];return _0x4a865f;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));var integrations=require(_0x4ba3('0x8'));module[_0x4ba3('0x9')]=function(_0xb88621,_0xe5f99a){return _0xb88621['define'](_0x4ba3('0xa'),attributes,{'tableName':_0x4ba3('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 776a1f6..7014057 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 _0x62bc=['info','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','limit','map','model','include','debug','stringify','ShowServicenowAccount','find','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','message'];(function(_0xaa44f2,_0x421855){var _0x598d15=function(_0x5184f9){while(--_0x5184f9){_0xaa44f2['push'](_0xaa44f2['shift']());}};_0x598d15(++_0x421855);}(_0x62bc,0x91));var _0xc62b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc62b('0x0'));var rs=require(_0xc62b('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc62b('0x2'));var logger=require(_0xc62b('0x3'))(_0xc62b('0x4'));var config=require(_0xc62b('0x5'));var jayson=require(_0xc62b('0x6'));var client=jayson['client'][_0xc62b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xa2320b,_0x2d3fad,_0x1dc042){return new BPromise(function(_0x3597e0,_0x2b6aad){return client[_0xc62b('0x8')](_0xa2320b,_0x1dc042)[_0xc62b('0x9')](function(_0x58e4a0){logger['info'](_0xc62b('0xa'),_0x2d3fad,_0xc62b('0xb'));logger['debug'](_0xc62b('0xc'),_0x2d3fad,_0xc62b('0xb'),JSON['stringify'](_0x58e4a0));if(_0x58e4a0['error']){if(_0x58e4a0[_0xc62b('0xd')]['code']===0x1f4){logger[_0xc62b('0xd')](_0xc62b('0xa'),_0x2d3fad,_0x58e4a0[_0xc62b('0xd')]['message']);return _0x2b6aad(_0x58e4a0[_0xc62b('0xd')][_0xc62b('0xe')]);}logger[_0xc62b('0xd')](_0xc62b('0xa'),_0x2d3fad,_0x58e4a0['error'][_0xc62b('0xe')]);return _0x3597e0(_0x58e4a0[_0xc62b('0xd')][_0xc62b('0xe')]);}else{logger[_0xc62b('0xf')](_0xc62b('0xa'),_0x2d3fad,_0xc62b('0xb'));_0x3597e0(_0x58e4a0[_0xc62b('0x10')][_0xc62b('0xe')]);}})[_0xc62b('0x11')](function(_0x65e93b){logger[_0xc62b('0xd')](_0xc62b('0xa'),_0x2d3fad,_0x65e93b);_0x2b6aad(_0x65e93b);});});}exports[_0xc62b('0x12')]=function(_0xf72ce0){var _0xd0b77d=this;return new Promise(function(_0x6d0606,_0x573184){return db[_0xc62b('0x13')][_0xc62b('0x14')]({'raw':_0xf72ce0[_0xc62b('0x15')]?_0xf72ce0[_0xc62b('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0xf72ce0[_0xc62b('0x15')]?_0xf72ce0['options'][_0xc62b('0x16')]||null:null,'attributes':_0xf72ce0[_0xc62b('0x15')]?_0xf72ce0[_0xc62b('0x15')][_0xc62b('0x17')]||null:null,'limit':_0xf72ce0[_0xc62b('0x15')]?_0xf72ce0['options'][_0xc62b('0x18')]||null:null,'include':_0xf72ce0[_0xc62b('0x15')]?_0xf72ce0[_0xc62b('0x15')]['include']?_[_0xc62b('0x19')](_0xf72ce0[_0xc62b('0x15')]['include'],function(_0x5bab0c){return{'model':db[_0x5bab0c[_0xc62b('0x1a')]],'as':_0x5bab0c['as'],'attributes':_0x5bab0c['attributes'],'include':_0x5bab0c[_0xc62b('0x1b')]?_['map'](_0x5bab0c['include'],function(_0x5b4f3c){return{'model':db[_0x5b4f3c['model']],'as':_0x5b4f3c['as'],'attributes':_0x5b4f3c[_0xc62b('0x17')],'include':_0x5b4f3c[_0xc62b('0x1b')]?_[_0xc62b('0x19')](_0x5b4f3c['include'],function(_0x24c90a){return{'model':db[_0x24c90a[_0xc62b('0x1a')]],'as':_0x24c90a['as'],'attributes':_0x24c90a[_0xc62b('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc62b('0x9')](function(_0x3a2d9c){logger[_0xc62b('0xf')](_0xc62b('0x12'),_0xf72ce0);logger[_0xc62b('0x1c')](_0xc62b('0x12'),_0xf72ce0,JSON[_0xc62b('0x1d')](_0x3a2d9c));_0x6d0606(_0x3a2d9c);})[_0xc62b('0x11')](function(_0x3f9510){logger[_0xc62b('0xd')](_0xc62b('0x12'),_0x3f9510[_0xc62b('0xe')],_0xf72ce0);_0x573184(_0xd0b77d[_0xc62b('0xd')](0x1f4,_0x3f9510['message']));});});};exports[_0xc62b('0x1e')]=function(_0x13b691){var _0x4371f6=this;return new Promise(function(_0x5457d4,_0x510945){return db[_0xc62b('0x13')][_0xc62b('0x1f')]({'raw':_0x13b691[_0xc62b('0x15')]?_0x13b691['options']['raw']===undefined?!![]:![]:!![],'where':_0x13b691[_0xc62b('0x15')]?_0x13b691[_0xc62b('0x15')][_0xc62b('0x16')]||null:null,'attributes':_0x13b691[_0xc62b('0x15')]?_0x13b691['options']['attributes']||null:null,'include':_0x13b691['options']?_0x13b691[_0xc62b('0x15')][_0xc62b('0x1b')]?_[_0xc62b('0x19')](_0x13b691[_0xc62b('0x15')][_0xc62b('0x1b')],function(_0x341242){return{'model':db[_0x341242[_0xc62b('0x1a')]],'as':_0x341242['as'],'attributes':_0x341242['attributes'],'include':_0x341242[_0xc62b('0x1b')]?_['map'](_0x341242[_0xc62b('0x1b')],function(_0x420011){return{'model':db[_0x420011[_0xc62b('0x1a')]],'as':_0x420011['as'],'attributes':_0x420011[_0xc62b('0x17')],'include':_0x420011[_0xc62b('0x1b')]?_[_0xc62b('0x19')](_0x420011[_0xc62b('0x1b')],function(_0x129337){return{'model':db[_0x129337[_0xc62b('0x1a')]],'as':_0x129337['as'],'attributes':_0x129337[_0xc62b('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc62b('0x9')](function(_0x39fda6){logger[_0xc62b('0xf')](_0xc62b('0x1e'),_0x13b691);logger[_0xc62b('0x1c')](_0xc62b('0x1e'),_0x13b691,JSON['stringify'](_0x39fda6));_0x5457d4(_0x39fda6);})[_0xc62b('0x11')](function(_0x3a571d){logger['error']('ShowServicenowAccount',_0x3a571d[_0xc62b('0xe')],_0x13b691);_0x510945(_0x4371f6[_0xc62b('0xd')](0x1f4,_0x3a571d[_0xc62b('0xe')]));});});}; \ No newline at end of file +var _0xc6ca=['result','catch','ServicenowAccount','options','where','attributes','include','map','model','GetServicenowAccount','find','ShowServicenowAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message'];(function(_0x246e63,_0x158799){var _0xed3ced=function(_0x358dad){while(--_0x358dad){_0x246e63['push'](_0x246e63['shift']());}};_0xed3ced(++_0x158799);}(_0xc6ca,0x1a4));var _0xac6c=function(_0x5f3105,_0x24ba3a){_0x5f3105=_0x5f3105-0x0;var _0xeaf6bf=_0xc6ca[_0x5f3105];return _0xeaf6bf;};'use strict';var _=require(_0xac6c('0x0'));var util=require(_0xac6c('0x1'));var moment=require(_0xac6c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac6c('0x3'));var db=require(_0xac6c('0x4'))['db'];var utils=require(_0xac6c('0x5'));var logger=require(_0xac6c('0x6'))(_0xac6c('0x7'));var config=require(_0xac6c('0x8'));var jayson=require(_0xac6c('0x9'));var client=jayson[_0xac6c('0xa')][_0xac6c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20d5b8,_0x2987f6,_0x566734){return new BPromise(function(_0x27b4c9,_0x5f365d){return client['request'](_0x20d5b8,_0x566734)[_0xac6c('0xc')](function(_0x421dfb){logger[_0xac6c('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x2987f6,_0xac6c('0xe'));logger[_0xac6c('0xf')](_0xac6c('0x10'),_0x2987f6,_0xac6c('0xe'),JSON[_0xac6c('0x11')](_0x421dfb));if(_0x421dfb['error']){if(_0x421dfb[_0xac6c('0x12')][_0xac6c('0x13')]===0x1f4){logger[_0xac6c('0x12')](_0xac6c('0x14'),_0x2987f6,_0x421dfb[_0xac6c('0x12')]['message']);return _0x5f365d(_0x421dfb[_0xac6c('0x12')]['message']);}logger[_0xac6c('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x2987f6,_0x421dfb[_0xac6c('0x12')][_0xac6c('0x15')]);return _0x27b4c9(_0x421dfb[_0xac6c('0x12')]['message']);}else{logger[_0xac6c('0xd')](_0xac6c('0x14'),_0x2987f6,_0xac6c('0xe'));_0x27b4c9(_0x421dfb[_0xac6c('0x16')][_0xac6c('0x15')]);}})[_0xac6c('0x17')](function(_0x1ec9b1){logger['error'](_0xac6c('0x14'),_0x2987f6,_0x1ec9b1);_0x5f365d(_0x1ec9b1);});});}exports['GetServicenowAccount']=function(_0x5e1411){var _0x552f57=this;return new Promise(function(_0x2a7b33,_0x11db22){return db[_0xac6c('0x18')]['findAll']({'raw':_0x5e1411[_0xac6c('0x19')]?_0x5e1411[_0xac6c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5e1411[_0xac6c('0x19')]?_0x5e1411[_0xac6c('0x19')][_0xac6c('0x1a')]||null:null,'attributes':_0x5e1411[_0xac6c('0x19')]?_0x5e1411[_0xac6c('0x19')][_0xac6c('0x1b')]||null:null,'limit':_0x5e1411['options']?_0x5e1411[_0xac6c('0x19')]['limit']||null:null,'include':_0x5e1411['options']?_0x5e1411[_0xac6c('0x19')][_0xac6c('0x1c')]?_[_0xac6c('0x1d')](_0x5e1411[_0xac6c('0x19')][_0xac6c('0x1c')],function(_0x135c40){return{'model':db[_0x135c40[_0xac6c('0x1e')]],'as':_0x135c40['as'],'attributes':_0x135c40[_0xac6c('0x1b')],'include':_0x135c40[_0xac6c('0x1c')]?_[_0xac6c('0x1d')](_0x135c40[_0xac6c('0x1c')],function(_0x177eaf){return{'model':db[_0x177eaf[_0xac6c('0x1e')]],'as':_0x177eaf['as'],'attributes':_0x177eaf[_0xac6c('0x1b')],'include':_0x177eaf['include']?_['map'](_0x177eaf[_0xac6c('0x1c')],function(_0x5e8011){return{'model':db[_0x5e8011[_0xac6c('0x1e')]],'as':_0x5e8011['as'],'attributes':_0x5e8011['attributes']};}):[]};}):[]};}):[]:[]})[_0xac6c('0xc')](function(_0x33e30a){logger['info']('GetServicenowAccount',_0x5e1411);logger[_0xac6c('0xf')]('GetServicenowAccount',_0x5e1411,JSON['stringify'](_0x33e30a));_0x2a7b33(_0x33e30a);})[_0xac6c('0x17')](function(_0x2c2b1e){logger['error'](_0xac6c('0x1f'),_0x2c2b1e['message'],_0x5e1411);_0x11db22(_0x552f57[_0xac6c('0x12')](0x1f4,_0x2c2b1e[_0xac6c('0x15')]));});});};exports['ShowServicenowAccount']=function(_0x5ac4f2){var _0x3ffc4b=this;return new Promise(function(_0x53c6ff,_0x36661c){return db['ServicenowAccount'][_0xac6c('0x20')]({'raw':_0x5ac4f2[_0xac6c('0x19')]?_0x5ac4f2[_0xac6c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5ac4f2[_0xac6c('0x19')]?_0x5ac4f2[_0xac6c('0x19')][_0xac6c('0x1a')]||null:null,'attributes':_0x5ac4f2[_0xac6c('0x19')]?_0x5ac4f2[_0xac6c('0x19')]['attributes']||null:null,'include':_0x5ac4f2[_0xac6c('0x19')]?_0x5ac4f2[_0xac6c('0x19')][_0xac6c('0x1c')]?_[_0xac6c('0x1d')](_0x5ac4f2[_0xac6c('0x19')]['include'],function(_0x506493){return{'model':db[_0x506493[_0xac6c('0x1e')]],'as':_0x506493['as'],'attributes':_0x506493[_0xac6c('0x1b')],'include':_0x506493[_0xac6c('0x1c')]?_[_0xac6c('0x1d')](_0x506493[_0xac6c('0x1c')],function(_0x53007c){return{'model':db[_0x53007c[_0xac6c('0x1e')]],'as':_0x53007c['as'],'attributes':_0x53007c[_0xac6c('0x1b')],'include':_0x53007c[_0xac6c('0x1c')]?_['map'](_0x53007c[_0xac6c('0x1c')],function(_0x17207b){return{'model':db[_0x17207b['model']],'as':_0x17207b['as'],'attributes':_0x17207b[_0xac6c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xac6c('0xc')](function(_0x22d7f2){logger['info'](_0xac6c('0x21'),_0x5ac4f2);logger['debug'](_0xac6c('0x21'),_0x5ac4f2,JSON[_0xac6c('0x11')](_0x22d7f2));_0x53c6ff(_0x22d7f2);})['catch'](function(_0xcf9c56){logger['error'](_0xac6c('0x21'),_0xcf9c56[_0xac6c('0x15')],_0x5ac4f2);_0x36661c(_0x3ffc4b[_0xac6c('0x12')](0x1f4,_0xcf9c56[_0xac6c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index f5b979f..f1533c4 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 _0xca2b=['../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xcfce66,_0x415fd6){var _0x52468d=function(_0x5c4883){while(--_0x5c4883){_0xcfce66['push'](_0xcfce66['shift']());}};_0x52468d(++_0x415fd6);}(_0xca2b,0xd0));var _0xbca2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xca2b[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0xbca2('0x0'));var util=require(_0xbca2('0x1'));var path=require(_0xbca2('0x2'));var timeout=require('connect-timeout');var express=require(_0xbca2('0x3'));var router=express[_0xbca2('0x4')]();var fs_extra=require(_0xbca2('0x5'));var auth=require(_0xbca2('0x6'));var interaction=require(_0xbca2('0x7'));var config=require(_0xbca2('0x8'));var controller=require(_0xbca2('0x9'));router[_0xbca2('0xa')]('/',auth[_0xbca2('0xb')](),controller['index']);router['get'](_0xbca2('0xc'),auth[_0xbca2('0xb')](),controller[_0xbca2('0xd')]);router[_0xbca2('0xa')](_0xbca2('0xe'),auth['isAuthenticated'](),controller[_0xbca2('0xf')]);router[_0xbca2('0xa')](_0xbca2('0x10'),auth[_0xbca2('0xb')](),controller[_0xbca2('0x11')]);router[_0xbca2('0xa')](_0xbca2('0x12'),auth['isAuthenticated'](),controller[_0xbca2('0x13')]);router[_0xbca2('0x14')]('/',auth[_0xbca2('0xb')](),controller[_0xbca2('0x15')]);router[_0xbca2('0x16')]('/:id',auth[_0xbca2('0xb')](),controller[_0xbca2('0x17')]);router[_0xbca2('0x18')](_0xbca2('0xc'),auth[_0xbca2('0xb')](),controller[_0xbca2('0x19')]);module[_0xbca2('0x1a')]=router; \ No newline at end of file +var _0x9c7f=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects'];(function(_0x3843ee,_0x3b9df2){var _0x48e620=function(_0x4ad226){while(--_0x4ad226){_0x3843ee['push'](_0x3843ee['shift']());}};_0x48e620(++_0x3b9df2);}(_0x9c7f,0xd1));var _0xf9c7=function(_0xbdef67,_0x2130c4){_0xbdef67=_0xbdef67-0x0;var _0x477f2f=_0x9c7f[_0xbdef67];return _0x477f2f;};'use strict';var multer=require(_0xf9c7('0x0'));var util=require(_0xf9c7('0x1'));var path=require(_0xf9c7('0x2'));var timeout=require(_0xf9c7('0x3'));var express=require('express');var router=express[_0xf9c7('0x4')]();var fs_extra=require(_0xf9c7('0x5'));var auth=require(_0xf9c7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf9c7('0x7'));var controller=require(_0xf9c7('0x8'));router[_0xf9c7('0x9')]('/',auth[_0xf9c7('0xa')](),controller[_0xf9c7('0xb')]);router['get']('/:id',auth[_0xf9c7('0xa')](),controller[_0xf9c7('0xc')]);router[_0xf9c7('0x9')](_0xf9c7('0xd'),auth[_0xf9c7('0xa')](),controller[_0xf9c7('0xe')]);router[_0xf9c7('0x9')](_0xf9c7('0xf'),auth[_0xf9c7('0xa')](),controller[_0xf9c7('0x10')]);router[_0xf9c7('0x9')]('/:id/descriptions',auth[_0xf9c7('0xa')](),controller[_0xf9c7('0x11')]);router[_0xf9c7('0x12')]('/',auth[_0xf9c7('0xa')](),controller[_0xf9c7('0x13')]);router[_0xf9c7('0x14')]('/:id',auth[_0xf9c7('0xa')](),controller[_0xf9c7('0x15')]);router[_0xf9c7('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xf9c7('0x17')]);module[_0xf9c7('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index edd23e5..251f79d 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 _0xe133=['STRING','sequelize','exports'];(function(_0x340369,_0x2f7cd9){var _0x366547=function(_0x32795d){while(--_0x32795d){_0x340369['push'](_0x340369['shift']());}};_0x366547(++_0x2f7cd9);}(_0xe133,0x1cf));var _0x3e13=function(_0x100204,_0x48ab43){_0x100204=_0x100204-0x0;var _0x294901=_0xe133[_0x100204];return _0x294901;};'use strict';var Sequelize=require(_0x3e13('0x0'));module[_0x3e13('0x1')]={'name':{'type':Sequelize[_0x3e13('0x2')]},'description':{'type':Sequelize[_0x3e13('0x2')]}}; \ No newline at end of file +var _0xeb7a=['STRING','sequelize','exports'];(function(_0x18c60b,_0x3a046e){var _0x432c4d=function(_0x8840ad){while(--_0x8840ad){_0x18c60b['push'](_0x18c60b['shift']());}};_0x432c4d(++_0x3a046e);}(_0xeb7a,0x115));var _0xaeb7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb7a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xaeb7('0x0'));module[_0xaeb7('0x1')]={'name':{'type':Sequelize[_0xaeb7('0x2')]},'description':{'type':Sequelize[_0xaeb7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 2193b81..00eff9a 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 _0x25d7=['save','then','error','stack','name','index','ServicenowConfiguration','rawAttributes','fieldName','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','where','filters','pick','merge','filter','includeAll','rows','catch','show','params','length','include','options','create','body','find','destroy','order','sort','getFields','getSubjects','findOne','ServicenowField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x1b3001,_0x20af60){var _0x33a1ab=function(_0x3a9dc2){while(--_0x3a9dc2){_0x1b3001['push'](_0x1b3001['shift']());}};_0x33a1ab(++_0x20af60);}(_0x25d7,0x15b));var _0x725d=function(_0x2d8434,_0x43d781){_0x2d8434=_0x2d8434-0x0;var _0x26b9e4=_0x25d7[_0x2d8434];return _0x26b9e4;};'use strict';var emlformat=require(_0x725d('0x0'));var rimraf=require(_0x725d('0x1'));var zipdir=require(_0x725d('0x2'));var jsonpatch=require(_0x725d('0x3'));var rp=require(_0x725d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x725d('0x5'));var util=require('util');var path=require(_0x725d('0x6'));var sox=require(_0x725d('0x7'));var csv=require('to-csv');var ejs=require(_0x725d('0x8'));var fs=require('fs');var fs_extra=require(_0x725d('0x9'));var _=require(_0x725d('0xa'));var squel=require(_0x725d('0xb'));var crypto=require(_0x725d('0xc'));var jsforce=require(_0x725d('0xd'));var deskjs=require(_0x725d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x725d('0xf'));var Papa=require(_0x725d('0x10'));var Redis=require(_0x725d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x725d('0x12'));var logger=require(_0x725d('0x13'))('api');var utils=require(_0x725d('0x14'));var config=require(_0x725d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x725d('0x16'))['db'];function respondWithStatusCode(_0x3c8240,_0x119c5d){_0x119c5d=_0x119c5d||0xcc;return function(_0x498ae5){if(_0x498ae5){return _0x3c8240['sendStatus'](_0x119c5d);}return _0x3c8240[_0x725d('0x17')](_0x119c5d)['end']();};}function respondWithResult(_0xb5770f,_0x3ec2d8){_0x3ec2d8=_0x3ec2d8||0xc8;return function(_0x1e247f){if(_0x1e247f){return _0xb5770f[_0x725d('0x17')](_0x3ec2d8)[_0x725d('0x18')](_0x1e247f);}};}function respondWithFilteredResult(_0x577932,_0x2c7f30){return function(_0x59bc71){if(_0x59bc71){var _0x3cf5af=typeof _0x2c7f30[_0x725d('0x19')]===_0x725d('0x1a')&&typeof _0x2c7f30[_0x725d('0x1b')]===_0x725d('0x1a');var _0x4d239b=_0x59bc71['count'];var _0x56fbd4=_0x3cf5af?0x0:_0x2c7f30[_0x725d('0x19')];var _0xa3c924=_0x3cf5af?_0x59bc71[_0x725d('0x1c')]:_0x2c7f30['offset']+_0x2c7f30[_0x725d('0x1b')];var _0xd4c83f;if(_0xa3c924>=_0x4d239b){_0xa3c924=_0x4d239b;_0xd4c83f=0xc8;}else{_0xd4c83f=0xce;}_0x577932[_0x725d('0x17')](_0xd4c83f);return _0x577932[_0x725d('0x1d')](_0x725d('0x1e'),_0x56fbd4+'-'+_0xa3c924+'/'+_0x4d239b)[_0x725d('0x18')](_0x59bc71);}return null;};}function patchUpdates(_0x1638b7){return function(_0x2f0d78){try{jsonpatch[_0x725d('0x1f')](_0x2f0d78,_0x1638b7,!![]);}catch(_0x11cf5f){return BPromise[_0x725d('0x20')](_0x11cf5f);}return _0x2f0d78[_0x725d('0x21')]();};}function saveUpdates(_0x2b7728,_0x58f6eb){return function(_0x1ed155){if(_0x1ed155){return _0x1ed155['update'](_0x2b7728)[_0x725d('0x22')](function(_0x5a6f05){return _0x5a6f05;});}return null;};}function removeEntity(_0x362e8c,_0x461d13){return function(_0x4e5710){if(_0x4e5710){return _0x4e5710['destroy']()[_0x725d('0x22')](function(){_0x362e8c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c6ce7,_0x10b788){return function(_0x40a0c0){if(!_0x40a0c0){_0x1c6ce7['sendStatus'](0x194);}return _0x40a0c0;};}function handleError(_0xab5164,_0xefd972){_0xefd972=_0xefd972||0x1f4;return function(_0x100ed9){logger[_0x725d('0x23')](_0x100ed9[_0x725d('0x24')]);if(_0x100ed9[_0x725d('0x25')]){delete _0x100ed9[_0x725d('0x25')];}_0xab5164[_0x725d('0x17')](_0xefd972)['send'](_0x100ed9);};}exports[_0x725d('0x26')]=function(_0x49ae42,_0x15cbd0){var _0x19f0e5={},_0x29ff53={},_0x583e73={'count':0x0,'rows':[]};var _0x1003d4=_['map'](db[_0x725d('0x27')][_0x725d('0x28')],function(_0x5558e3){return{'name':_0x5558e3[_0x725d('0x29')],'type':_0x5558e3['type'][_0x725d('0x2a')]};});_0x29ff53[_0x725d('0x2b')]=_[_0x725d('0x2c')](_0x1003d4,'name');_0x29ff53[_0x725d('0x2d')]=_[_0x725d('0x2e')](_0x49ae42[_0x725d('0x2d')]);_0x29ff53['filters']=_['intersection'](_0x29ff53['model'],_0x29ff53[_0x725d('0x2d')]);_0x19f0e5[_0x725d('0x2f')]=_[_0x725d('0x30')](_0x29ff53[_0x725d('0x2b')],qs[_0x725d('0x31')](_0x49ae42[_0x725d('0x2d')][_0x725d('0x31')]));_0x19f0e5[_0x725d('0x2f')]=_0x19f0e5[_0x725d('0x2f')]['length']?_0x19f0e5[_0x725d('0x2f')]:_0x29ff53[_0x725d('0x2b')];if(!_0x49ae42[_0x725d('0x2d')][_0x725d('0x32')](_0x725d('0x33'))){_0x19f0e5[_0x725d('0x1b')]=qs['limit'](_0x49ae42['query']['limit']);_0x19f0e5['offset']=qs[_0x725d('0x19')](_0x49ae42[_0x725d('0x2d')]['offset']);}_0x19f0e5['order']=qs['sort'](_0x49ae42[_0x725d('0x2d')]['sort']);_0x19f0e5[_0x725d('0x34')]=qs[_0x725d('0x35')](_[_0x725d('0x36')](_0x49ae42[_0x725d('0x2d')],_0x29ff53[_0x725d('0x35')]),_0x1003d4);if(_0x49ae42[_0x725d('0x2d')]['filter']){_0x19f0e5[_0x725d('0x34')]=_[_0x725d('0x37')](_0x19f0e5[_0x725d('0x34')],{'$or':_[_0x725d('0x2c')](_0x1003d4,function(_0x4d086a){if(_0x4d086a['type']!=='VIRTUAL'){var _0x50e483={};_0x50e483[_0x4d086a[_0x725d('0x25')]]={'$like':'%'+_0x49ae42[_0x725d('0x2d')][_0x725d('0x38')]+'%'};return _0x50e483;}})});}_0x19f0e5=_[_0x725d('0x37')]({},_0x19f0e5,_0x49ae42['options']);var _0x18bfa7={'where':_0x19f0e5[_0x725d('0x34')]};return db['ServicenowConfiguration'][_0x725d('0x1c')](_0x18bfa7)[_0x725d('0x22')](function(_0x4ca76d){_0x583e73[_0x725d('0x1c')]=_0x4ca76d;if(_0x49ae42['query'][_0x725d('0x39')]){_0x19f0e5['include']=[{'all':!![]}];}return db[_0x725d('0x27')]['findAll'](_0x19f0e5);})['then'](function(_0x483a1e){_0x583e73[_0x725d('0x3a')]=_0x483a1e;return _0x583e73;})[_0x725d('0x22')](respondWithFilteredResult(_0x15cbd0,_0x19f0e5))[_0x725d('0x3b')](handleError(_0x15cbd0,null));};exports[_0x725d('0x3c')]=function(_0x3d5008,_0x598421){var _0x2ea349={'raw':![],'where':{'id':_0x3d5008[_0x725d('0x3d')]['id']}},_0x522244={};_0x522244[_0x725d('0x2b')]=_[_0x725d('0x2e')](db[_0x725d('0x27')][_0x725d('0x28')]);_0x522244[_0x725d('0x2d')]=_[_0x725d('0x2e')](_0x3d5008[_0x725d('0x2d')]);_0x522244[_0x725d('0x35')]=_[_0x725d('0x30')](_0x522244[_0x725d('0x2b')],_0x522244[_0x725d('0x2d')]);_0x2ea349['attributes']=_[_0x725d('0x30')](_0x522244[_0x725d('0x2b')],qs[_0x725d('0x31')](_0x3d5008[_0x725d('0x2d')]['fields']));_0x2ea349[_0x725d('0x2f')]=_0x2ea349[_0x725d('0x2f')][_0x725d('0x3e')]?_0x2ea349[_0x725d('0x2f')]:_0x522244['model'];if(_0x3d5008['query']['includeAll']){_0x2ea349[_0x725d('0x3f')]=[{'all':!![]}];}_0x2ea349=_[_0x725d('0x37')]({},_0x2ea349,_0x3d5008[_0x725d('0x40')]);return db[_0x725d('0x27')]['find'](_0x2ea349)[_0x725d('0x22')](handleEntityNotFound(_0x598421,null))[_0x725d('0x22')](respondWithResult(_0x598421,null))[_0x725d('0x3b')](handleError(_0x598421,null));};exports[_0x725d('0x41')]=function(_0x390f2e,_0x5e9414){return db['ServicenowConfiguration']['create'](_0x390f2e[_0x725d('0x42')],{})[_0x725d('0x22')](respondWithResult(_0x5e9414,0xc9))['catch'](handleError(_0x5e9414,null));};exports['update']=function(_0x320b01,_0x9d6e30){if(_0x320b01[_0x725d('0x42')]['id']){delete _0x320b01[_0x725d('0x42')]['id'];}return db[_0x725d('0x27')][_0x725d('0x43')]({'where':{'id':_0x320b01[_0x725d('0x3d')]['id']}})[_0x725d('0x22')](handleEntityNotFound(_0x9d6e30,null))[_0x725d('0x22')](saveUpdates(_0x320b01[_0x725d('0x42')],null))[_0x725d('0x22')](respondWithResult(_0x9d6e30,null))['catch'](handleError(_0x9d6e30,null));};exports[_0x725d('0x44')]=function(_0x1548fd,_0xe9a54){return db[_0x725d('0x27')]['find']({'where':{'id':_0x1548fd[_0x725d('0x3d')]['id']}})[_0x725d('0x22')](handleEntityNotFound(_0xe9a54,null))[_0x725d('0x22')](removeEntity(_0xe9a54,null))[_0x725d('0x3b')](handleError(_0xe9a54,null));};exports['getFields']=function(_0x191fcf,_0x26c2b6,_0x14d5cf){var _0x72588={};var _0xe30ef7={};var _0x370bba;var _0x1080a5;return db[_0x725d('0x27')]['findOne']({'where':{'id':_0x191fcf[_0x725d('0x3d')]['id']}})[_0x725d('0x22')](handleEntityNotFound(_0x26c2b6,null))[_0x725d('0x22')](function(_0x559103){if(_0x559103){_0x370bba=_0x559103;_0xe30ef7[_0x725d('0x2b')]=_[_0x725d('0x2e')](db['ServicenowField'][_0x725d('0x28')]);_0xe30ef7[_0x725d('0x2d')]=_['keys'](_0x191fcf[_0x725d('0x2d')]);_0xe30ef7[_0x725d('0x35')]=_[_0x725d('0x30')](_0xe30ef7['model'],_0xe30ef7[_0x725d('0x2d')]);_0x72588[_0x725d('0x2f')]=_[_0x725d('0x30')](_0xe30ef7[_0x725d('0x2b')],qs[_0x725d('0x31')](_0x191fcf[_0x725d('0x2d')][_0x725d('0x31')]));_0x72588[_0x725d('0x2f')]=_0x72588[_0x725d('0x2f')][_0x725d('0x3e')]?_0x72588[_0x725d('0x2f')]:_0xe30ef7[_0x725d('0x2b')];_0x72588[_0x725d('0x45')]=qs[_0x725d('0x46')](_0x191fcf['query'][_0x725d('0x46')]);_0x72588['where']=qs[_0x725d('0x35')](_[_0x725d('0x36')](_0x191fcf['query'],_0xe30ef7[_0x725d('0x35')]));if(_0x191fcf[_0x725d('0x2d')][_0x725d('0x38')]){_0x72588[_0x725d('0x34')]=_[_0x725d('0x37')](_0x72588[_0x725d('0x34')],{'$or':_[_0x725d('0x2c')](_0x72588[_0x725d('0x2f')],function(_0x597905){var _0x673ba8={};_0x673ba8[_0x597905]={'$like':'%'+_0x191fcf[_0x725d('0x2d')][_0x725d('0x38')]+'%'};return _0x673ba8;})});}_0x72588=_[_0x725d('0x37')]({},_0x72588,_0x191fcf['options']);return _0x370bba['getFields'](_0x72588);}})[_0x725d('0x22')](function(_0x533c76){if(_0x533c76){_0x1080a5=_0x533c76['length'];if(!_0x191fcf['query'][_0x725d('0x32')]('nolimit')){_0x72588[_0x725d('0x1b')]=qs[_0x725d('0x1b')](_0x191fcf['query'][_0x725d('0x1b')]);_0x72588[_0x725d('0x19')]=qs[_0x725d('0x19')](_0x191fcf[_0x725d('0x2d')][_0x725d('0x19')]);}return _0x370bba[_0x725d('0x47')](_0x72588);}})[_0x725d('0x22')](function(_0x431d6b){if(_0x431d6b){return _0x431d6b?{'count':_0x1080a5,'rows':_0x431d6b}:null;}})[_0x725d('0x22')](respondWithResult(_0x26c2b6,null))[_0x725d('0x3b')](handleError(_0x26c2b6,null));};exports[_0x725d('0x48')]=function(_0x571ddf,_0x23a201,_0x4c4f44){var _0x180ea5={};var _0x201ee0={};var _0x16b332;var _0x341ca4;return db[_0x725d('0x27')][_0x725d('0x49')]({'where':{'id':_0x571ddf[_0x725d('0x3d')]['id']}})['then'](handleEntityNotFound(_0x23a201,null))[_0x725d('0x22')](function(_0x5189c2){if(_0x5189c2){_0x16b332=_0x5189c2;_0x201ee0[_0x725d('0x2b')]=_[_0x725d('0x2e')](db[_0x725d('0x4a')][_0x725d('0x28')]);_0x201ee0['query']=_['keys'](_0x571ddf['query']);_0x201ee0['filters']=_[_0x725d('0x30')](_0x201ee0[_0x725d('0x2b')],_0x201ee0[_0x725d('0x2d')]);_0x180ea5[_0x725d('0x2f')]=_[_0x725d('0x30')](_0x201ee0['model'],qs[_0x725d('0x31')](_0x571ddf[_0x725d('0x2d')][_0x725d('0x31')]));_0x180ea5[_0x725d('0x2f')]=_0x180ea5[_0x725d('0x2f')][_0x725d('0x3e')]?_0x180ea5[_0x725d('0x2f')]:_0x201ee0[_0x725d('0x2b')];_0x180ea5[_0x725d('0x45')]=qs['sort'](_0x571ddf[_0x725d('0x2d')][_0x725d('0x46')]);_0x180ea5[_0x725d('0x34')]=qs[_0x725d('0x35')](_[_0x725d('0x36')](_0x571ddf['query'],_0x201ee0[_0x725d('0x35')]));if(_0x571ddf[_0x725d('0x2d')]['filter']){_0x180ea5[_0x725d('0x34')]=_[_0x725d('0x37')](_0x180ea5[_0x725d('0x34')],{'$or':_[_0x725d('0x2c')](_0x180ea5[_0x725d('0x2f')],function(_0x321963){var _0x451eeb={};_0x451eeb[_0x321963]={'$like':'%'+_0x571ddf[_0x725d('0x2d')][_0x725d('0x38')]+'%'};return _0x451eeb;})});}_0x180ea5=_['merge']({},_0x180ea5,_0x571ddf[_0x725d('0x40')]);return _0x16b332[_0x725d('0x48')](_0x180ea5);}})[_0x725d('0x22')](function(_0x3d9713){if(_0x3d9713){_0x341ca4=_0x3d9713[_0x725d('0x3e')];if(!_0x571ddf['query'][_0x725d('0x32')]('nolimit')){_0x180ea5[_0x725d('0x1b')]=qs['limit'](_0x571ddf[_0x725d('0x2d')][_0x725d('0x1b')]);_0x180ea5[_0x725d('0x19')]=qs[_0x725d('0x19')](_0x571ddf[_0x725d('0x2d')]['offset']);}return _0x16b332[_0x725d('0x48')](_0x180ea5);}})[_0x725d('0x22')](function(_0x5e9a84){if(_0x5e9a84){return _0x5e9a84?{'count':_0x341ca4,'rows':_0x5e9a84}:null;}})[_0x725d('0x22')](respondWithResult(_0x23a201,null))[_0x725d('0x3b')](handleError(_0x23a201,null));};exports[_0x725d('0x4b')]=function(_0x5475c2,_0x65ffde,_0x4527e2){var _0x3bf993={};var _0x1b1a60={};var _0x4970a6;var _0x251ce5;return db[_0x725d('0x27')][_0x725d('0x49')]({'where':{'id':_0x5475c2[_0x725d('0x3d')]['id']}})[_0x725d('0x22')](handleEntityNotFound(_0x65ffde,null))[_0x725d('0x22')](function(_0x4400d1){if(_0x4400d1){_0x4970a6=_0x4400d1;_0x1b1a60[_0x725d('0x2b')]=_[_0x725d('0x2e')](db[_0x725d('0x4a')][_0x725d('0x28')]);_0x1b1a60[_0x725d('0x2d')]=_[_0x725d('0x2e')](_0x5475c2[_0x725d('0x2d')]);_0x1b1a60[_0x725d('0x35')]=_['intersection'](_0x1b1a60[_0x725d('0x2b')],_0x1b1a60[_0x725d('0x2d')]);_0x3bf993['attributes']=_[_0x725d('0x30')](_0x1b1a60[_0x725d('0x2b')],qs[_0x725d('0x31')](_0x5475c2[_0x725d('0x2d')][_0x725d('0x31')]));_0x3bf993[_0x725d('0x2f')]=_0x3bf993[_0x725d('0x2f')][_0x725d('0x3e')]?_0x3bf993[_0x725d('0x2f')]:_0x1b1a60[_0x725d('0x2b')];_0x3bf993['order']=qs['sort'](_0x5475c2['query'][_0x725d('0x46')]);_0x3bf993['where']=qs['filters'](_[_0x725d('0x36')](_0x5475c2[_0x725d('0x2d')],_0x1b1a60[_0x725d('0x35')]));if(_0x5475c2['query']['filter']){_0x3bf993['where']=_[_0x725d('0x37')](_0x3bf993[_0x725d('0x34')],{'$or':_[_0x725d('0x2c')](_0x3bf993[_0x725d('0x2f')],function(_0x4df04f){var _0x3f36d5={};_0x3f36d5[_0x4df04f]={'$like':'%'+_0x5475c2[_0x725d('0x2d')][_0x725d('0x38')]+'%'};return _0x3f36d5;})});}_0x3bf993=_[_0x725d('0x37')]({},_0x3bf993,_0x5475c2[_0x725d('0x40')]);return _0x4970a6[_0x725d('0x4b')](_0x3bf993);}})[_0x725d('0x22')](function(_0x57a17c){if(_0x57a17c){_0x251ce5=_0x57a17c[_0x725d('0x3e')];if(!_0x5475c2['query']['hasOwnProperty'](_0x725d('0x33'))){_0x3bf993[_0x725d('0x1b')]=qs['limit'](_0x5475c2[_0x725d('0x2d')][_0x725d('0x1b')]);_0x3bf993[_0x725d('0x19')]=qs[_0x725d('0x19')](_0x5475c2['query']['offset']);}return _0x4970a6[_0x725d('0x4b')](_0x3bf993);}})['then'](function(_0x5e4bbf){if(_0x5e4bbf){return _0x5e4bbf?{'count':_0x251ce5,'rows':_0x5e4bbf}:null;}})[_0x725d('0x22')](respondWithResult(_0x65ffde,null))['catch'](handleError(_0x65ffde,null));}; \ No newline at end of file +var _0xaa66=['../../config/logger','api','../../config/environment','sendStatus','end','status','json','undefined','count','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','getFields','ServicenowField','getSubjects','findOne','getDescriptions','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x23ce69,_0x5b4b1e){var _0x2accdc=function(_0x56bc04){while(--_0x56bc04){_0x23ce69['push'](_0x23ce69['shift']());}};_0x2accdc(++_0x5b4b1e);}(_0xaa66,0xe0));var _0x6aa6=function(_0x13184d,_0x6bdeb0){_0x13184d=_0x13184d-0x0;var _0x384a96=_0xaa66[_0x13184d];return _0x384a96;};'use strict';var emlformat=require(_0x6aa6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6aa6('0x1'));var rp=require(_0x6aa6('0x2'));var moment=require('moment');var BPromise=require(_0x6aa6('0x3'));var Mustache=require(_0x6aa6('0x4'));var util=require(_0x6aa6('0x5'));var path=require(_0x6aa6('0x6'));var sox=require(_0x6aa6('0x7'));var csv=require('to-csv');var ejs=require(_0x6aa6('0x8'));var fs=require('fs');var fs_extra=require(_0x6aa6('0x9'));var _=require(_0x6aa6('0xa'));var squel=require(_0x6aa6('0xb'));var crypto=require(_0x6aa6('0xc'));var jsforce=require(_0x6aa6('0xd'));var deskjs=require(_0x6aa6('0xe'));var toCsv=require(_0x6aa6('0xf'));var querystring=require('querystring');var Papa=require(_0x6aa6('0x10'));var Redis=require(_0x6aa6('0x11'));var authService=require(_0x6aa6('0x12'));var qs=require(_0x6aa6('0x13'));var as=require(_0x6aa6('0x14'));var hardwareService=require(_0x6aa6('0x15'));var logger=require(_0x6aa6('0x16'))(_0x6aa6('0x17'));var utils=require('../../config/utils');var config=require(_0x6aa6('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fabd1,_0xd41f9){_0xd41f9=_0xd41f9||0xcc;return function(_0xf52400){if(_0xf52400){return _0x4fabd1[_0x6aa6('0x19')](_0xd41f9);}return _0x4fabd1['status'](_0xd41f9)[_0x6aa6('0x1a')]();};}function respondWithResult(_0x261ce1,_0x27e4eb){_0x27e4eb=_0x27e4eb||0xc8;return function(_0x419d28){if(_0x419d28){return _0x261ce1[_0x6aa6('0x1b')](_0x27e4eb)[_0x6aa6('0x1c')](_0x419d28);}};}function respondWithFilteredResult(_0x3e2d5e,_0x2f0af0){return function(_0x376105){if(_0x376105){var _0x33c3f6=typeof _0x2f0af0['offset']===_0x6aa6('0x1d')&&typeof _0x2f0af0['limit']===_0x6aa6('0x1d');var _0x2fe81e=_0x376105[_0x6aa6('0x1e')];var _0x5a5f21=_0x33c3f6?0x0:_0x2f0af0[_0x6aa6('0x1f')];var _0x1c0fdd=_0x33c3f6?_0x376105[_0x6aa6('0x1e')]:_0x2f0af0[_0x6aa6('0x1f')]+_0x2f0af0[_0x6aa6('0x20')];var _0x5baf45;if(_0x1c0fdd>=_0x2fe81e){_0x1c0fdd=_0x2fe81e;_0x5baf45=0xc8;}else{_0x5baf45=0xce;}_0x3e2d5e[_0x6aa6('0x1b')](_0x5baf45);return _0x3e2d5e[_0x6aa6('0x21')]('Content-Range',_0x5a5f21+'-'+_0x1c0fdd+'/'+_0x2fe81e)[_0x6aa6('0x1c')](_0x376105);}return null;};}function patchUpdates(_0x3078ed){return function(_0x10709d){try{jsonpatch[_0x6aa6('0x22')](_0x10709d,_0x3078ed,!![]);}catch(_0x35de17){return BPromise[_0x6aa6('0x23')](_0x35de17);}return _0x10709d[_0x6aa6('0x24')]();};}function saveUpdates(_0x511526,_0x4c2703){return function(_0xfac72e){if(_0xfac72e){return _0xfac72e['update'](_0x511526)[_0x6aa6('0x25')](function(_0x738a34){return _0x738a34;});}return null;};}function removeEntity(_0x2b458c,_0x2a9ee8){return function(_0x57770b){if(_0x57770b){return _0x57770b[_0x6aa6('0x26')]()[_0x6aa6('0x25')](function(){_0x2b458c[_0x6aa6('0x1b')](0xcc)[_0x6aa6('0x1a')]();});}};}function handleEntityNotFound(_0x21bb3f,_0x2eae48){return function(_0x7fc345){if(!_0x7fc345){_0x21bb3f[_0x6aa6('0x19')](0x194);}return _0x7fc345;};}function handleError(_0x38b67f,_0x4860e7){_0x4860e7=_0x4860e7||0x1f4;return function(_0x6bd12f){logger[_0x6aa6('0x27')](_0x6bd12f[_0x6aa6('0x28')]);if(_0x6bd12f[_0x6aa6('0x29')]){delete _0x6bd12f[_0x6aa6('0x29')];}_0x38b67f[_0x6aa6('0x1b')](_0x4860e7)[_0x6aa6('0x2a')](_0x6bd12f);};}exports[_0x6aa6('0x2b')]=function(_0x291d57,_0x2af33e){var _0x3c0be2={},_0x560583={},_0x17d564={'count':0x0,'rows':[]};var _0x4ee0f1=_[_0x6aa6('0x2c')](db[_0x6aa6('0x2d')][_0x6aa6('0x2e')],function(_0x5db7b5){return{'name':_0x5db7b5[_0x6aa6('0x2f')],'type':_0x5db7b5[_0x6aa6('0x30')]['key']};});_0x560583[_0x6aa6('0x31')]=_['map'](_0x4ee0f1,_0x6aa6('0x29'));_0x560583[_0x6aa6('0x32')]=_[_0x6aa6('0x33')](_0x291d57['query']);_0x560583[_0x6aa6('0x34')]=_['intersection'](_0x560583[_0x6aa6('0x31')],_0x560583[_0x6aa6('0x32')]);_0x3c0be2[_0x6aa6('0x35')]=_[_0x6aa6('0x36')](_0x560583[_0x6aa6('0x31')],qs['fields'](_0x291d57[_0x6aa6('0x32')][_0x6aa6('0x37')]));_0x3c0be2['attributes']=_0x3c0be2[_0x6aa6('0x35')][_0x6aa6('0x38')]?_0x3c0be2['attributes']:_0x560583[_0x6aa6('0x31')];if(!_0x291d57[_0x6aa6('0x32')][_0x6aa6('0x39')](_0x6aa6('0x3a'))){_0x3c0be2[_0x6aa6('0x20')]=qs[_0x6aa6('0x20')](_0x291d57[_0x6aa6('0x32')]['limit']);_0x3c0be2[_0x6aa6('0x1f')]=qs[_0x6aa6('0x1f')](_0x291d57[_0x6aa6('0x32')][_0x6aa6('0x1f')]);}_0x3c0be2[_0x6aa6('0x3b')]=qs['sort'](_0x291d57['query'][_0x6aa6('0x3c')]);_0x3c0be2[_0x6aa6('0x3d')]=qs[_0x6aa6('0x34')](_[_0x6aa6('0x3e')](_0x291d57[_0x6aa6('0x32')],_0x560583[_0x6aa6('0x34')]),_0x4ee0f1);if(_0x291d57[_0x6aa6('0x32')][_0x6aa6('0x3f')]){_0x3c0be2['where']=_[_0x6aa6('0x40')](_0x3c0be2[_0x6aa6('0x3d')],{'$or':_[_0x6aa6('0x2c')](_0x4ee0f1,function(_0x5f4ed2){if(_0x5f4ed2['type']!=='VIRTUAL'){var _0x279b3c={};_0x279b3c[_0x5f4ed2[_0x6aa6('0x29')]]={'$like':'%'+_0x291d57['query'][_0x6aa6('0x3f')]+'%'};return _0x279b3c;}})});}_0x3c0be2=_[_0x6aa6('0x40')]({},_0x3c0be2,_0x291d57[_0x6aa6('0x41')]);var _0x25f082={'where':_0x3c0be2['where']};return db[_0x6aa6('0x2d')][_0x6aa6('0x1e')](_0x25f082)['then'](function(_0x51f88d){_0x17d564[_0x6aa6('0x1e')]=_0x51f88d;if(_0x291d57[_0x6aa6('0x32')][_0x6aa6('0x42')]){_0x3c0be2[_0x6aa6('0x43')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x6aa6('0x44')](_0x3c0be2);})[_0x6aa6('0x25')](function(_0x2c8293){_0x17d564[_0x6aa6('0x45')]=_0x2c8293;return _0x17d564;})['then'](respondWithFilteredResult(_0x2af33e,_0x3c0be2))[_0x6aa6('0x46')](handleError(_0x2af33e,null));};exports[_0x6aa6('0x47')]=function(_0x2620b9,_0x48af68){var _0x3f6068={'raw':![],'where':{'id':_0x2620b9['params']['id']}},_0xaa2f50={};_0xaa2f50['model']=_[_0x6aa6('0x33')](db['ServicenowConfiguration']['rawAttributes']);_0xaa2f50[_0x6aa6('0x32')]=_[_0x6aa6('0x33')](_0x2620b9['query']);_0xaa2f50['filters']=_['intersection'](_0xaa2f50[_0x6aa6('0x31')],_0xaa2f50[_0x6aa6('0x32')]);_0x3f6068['attributes']=_[_0x6aa6('0x36')](_0xaa2f50[_0x6aa6('0x31')],qs[_0x6aa6('0x37')](_0x2620b9['query'][_0x6aa6('0x37')]));_0x3f6068[_0x6aa6('0x35')]=_0x3f6068['attributes'][_0x6aa6('0x38')]?_0x3f6068[_0x6aa6('0x35')]:_0xaa2f50[_0x6aa6('0x31')];if(_0x2620b9['query'][_0x6aa6('0x42')]){_0x3f6068[_0x6aa6('0x43')]=[{'all':!![]}];}_0x3f6068=_[_0x6aa6('0x40')]({},_0x3f6068,_0x2620b9[_0x6aa6('0x41')]);return db[_0x6aa6('0x2d')][_0x6aa6('0x48')](_0x3f6068)[_0x6aa6('0x25')](handleEntityNotFound(_0x48af68,null))[_0x6aa6('0x25')](respondWithResult(_0x48af68,null))[_0x6aa6('0x46')](handleError(_0x48af68,null));};exports[_0x6aa6('0x49')]=function(_0x3ee97d,_0xbd8c24){return db['ServicenowConfiguration']['create'](_0x3ee97d[_0x6aa6('0x4a')],{})[_0x6aa6('0x25')](respondWithResult(_0xbd8c24,0xc9))[_0x6aa6('0x46')](handleError(_0xbd8c24,null));};exports[_0x6aa6('0x4b')]=function(_0x1bb759,_0x1e4ca7){if(_0x1bb759['body']['id']){delete _0x1bb759[_0x6aa6('0x4a')]['id'];}return db[_0x6aa6('0x2d')]['find']({'where':{'id':_0x1bb759[_0x6aa6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1e4ca7,null))[_0x6aa6('0x25')](saveUpdates(_0x1bb759[_0x6aa6('0x4a')],null))[_0x6aa6('0x25')](respondWithResult(_0x1e4ca7,null))['catch'](handleError(_0x1e4ca7,null));};exports[_0x6aa6('0x26')]=function(_0x3efffc,_0x2231c1){return db['ServicenowConfiguration']['find']({'where':{'id':_0x3efffc[_0x6aa6('0x4c')]['id']}})[_0x6aa6('0x25')](handleEntityNotFound(_0x2231c1,null))[_0x6aa6('0x25')](removeEntity(_0x2231c1,null))[_0x6aa6('0x46')](handleError(_0x2231c1,null));};exports[_0x6aa6('0x4d')]=function(_0x5cfc7a,_0x496764,_0x220b26){var _0x3b8862={};var _0x325e7f={};var _0x129e7a;var _0x550642;return db[_0x6aa6('0x2d')]['findOne']({'where':{'id':_0x5cfc7a[_0x6aa6('0x4c')]['id']}})[_0x6aa6('0x25')](handleEntityNotFound(_0x496764,null))[_0x6aa6('0x25')](function(_0x4eab59){if(_0x4eab59){_0x129e7a=_0x4eab59;_0x325e7f[_0x6aa6('0x31')]=_[_0x6aa6('0x33')](db[_0x6aa6('0x4e')][_0x6aa6('0x2e')]);_0x325e7f[_0x6aa6('0x32')]=_[_0x6aa6('0x33')](_0x5cfc7a[_0x6aa6('0x32')]);_0x325e7f[_0x6aa6('0x34')]=_[_0x6aa6('0x36')](_0x325e7f['model'],_0x325e7f[_0x6aa6('0x32')]);_0x3b8862[_0x6aa6('0x35')]=_[_0x6aa6('0x36')](_0x325e7f[_0x6aa6('0x31')],qs[_0x6aa6('0x37')](_0x5cfc7a[_0x6aa6('0x32')][_0x6aa6('0x37')]));_0x3b8862[_0x6aa6('0x35')]=_0x3b8862[_0x6aa6('0x35')][_0x6aa6('0x38')]?_0x3b8862[_0x6aa6('0x35')]:_0x325e7f[_0x6aa6('0x31')];_0x3b8862[_0x6aa6('0x3b')]=qs[_0x6aa6('0x3c')](_0x5cfc7a['query']['sort']);_0x3b8862[_0x6aa6('0x3d')]=qs['filters'](_['pick'](_0x5cfc7a[_0x6aa6('0x32')],_0x325e7f[_0x6aa6('0x34')]));if(_0x5cfc7a[_0x6aa6('0x32')][_0x6aa6('0x3f')]){_0x3b8862[_0x6aa6('0x3d')]=_['merge'](_0x3b8862['where'],{'$or':_[_0x6aa6('0x2c')](_0x3b8862[_0x6aa6('0x35')],function(_0x559105){var _0x62e983={};_0x62e983[_0x559105]={'$like':'%'+_0x5cfc7a['query'][_0x6aa6('0x3f')]+'%'};return _0x62e983;})});}_0x3b8862=_[_0x6aa6('0x40')]({},_0x3b8862,_0x5cfc7a['options']);return _0x129e7a[_0x6aa6('0x4d')](_0x3b8862);}})['then'](function(_0x4a4637){if(_0x4a4637){_0x550642=_0x4a4637[_0x6aa6('0x38')];if(!_0x5cfc7a['query'][_0x6aa6('0x39')](_0x6aa6('0x3a'))){_0x3b8862[_0x6aa6('0x20')]=qs[_0x6aa6('0x20')](_0x5cfc7a[_0x6aa6('0x32')][_0x6aa6('0x20')]);_0x3b8862['offset']=qs[_0x6aa6('0x1f')](_0x5cfc7a[_0x6aa6('0x32')]['offset']);}return _0x129e7a[_0x6aa6('0x4d')](_0x3b8862);}})[_0x6aa6('0x25')](function(_0xb016df){if(_0xb016df){return _0xb016df?{'count':_0x550642,'rows':_0xb016df}:null;}})[_0x6aa6('0x25')](respondWithResult(_0x496764,null))[_0x6aa6('0x46')](handleError(_0x496764,null));};exports[_0x6aa6('0x4f')]=function(_0x254eaa,_0x58aea2,_0x19a9c3){var _0x263096={};var _0x39cfb8={};var _0x3f5a15;var _0x5a58af;return db[_0x6aa6('0x2d')][_0x6aa6('0x50')]({'where':{'id':_0x254eaa['params']['id']}})['then'](handleEntityNotFound(_0x58aea2,null))[_0x6aa6('0x25')](function(_0x374b80){if(_0x374b80){_0x3f5a15=_0x374b80;_0x39cfb8[_0x6aa6('0x31')]=_[_0x6aa6('0x33')](db[_0x6aa6('0x4e')][_0x6aa6('0x2e')]);_0x39cfb8['query']=_[_0x6aa6('0x33')](_0x254eaa[_0x6aa6('0x32')]);_0x39cfb8[_0x6aa6('0x34')]=_['intersection'](_0x39cfb8['model'],_0x39cfb8[_0x6aa6('0x32')]);_0x263096[_0x6aa6('0x35')]=_[_0x6aa6('0x36')](_0x39cfb8[_0x6aa6('0x31')],qs[_0x6aa6('0x37')](_0x254eaa[_0x6aa6('0x32')]['fields']));_0x263096[_0x6aa6('0x35')]=_0x263096['attributes'][_0x6aa6('0x38')]?_0x263096['attributes']:_0x39cfb8[_0x6aa6('0x31')];_0x263096[_0x6aa6('0x3b')]=qs[_0x6aa6('0x3c')](_0x254eaa[_0x6aa6('0x32')][_0x6aa6('0x3c')]);_0x263096[_0x6aa6('0x3d')]=qs[_0x6aa6('0x34')](_['pick'](_0x254eaa[_0x6aa6('0x32')],_0x39cfb8[_0x6aa6('0x34')]));if(_0x254eaa[_0x6aa6('0x32')][_0x6aa6('0x3f')]){_0x263096[_0x6aa6('0x3d')]=_[_0x6aa6('0x40')](_0x263096[_0x6aa6('0x3d')],{'$or':_[_0x6aa6('0x2c')](_0x263096['attributes'],function(_0x935279){var _0x14d41d={};_0x14d41d[_0x935279]={'$like':'%'+_0x254eaa[_0x6aa6('0x32')][_0x6aa6('0x3f')]+'%'};return _0x14d41d;})});}_0x263096=_['merge']({},_0x263096,_0x254eaa[_0x6aa6('0x41')]);return _0x3f5a15['getSubjects'](_0x263096);}})['then'](function(_0x38c531){if(_0x38c531){_0x5a58af=_0x38c531[_0x6aa6('0x38')];if(!_0x254eaa['query']['hasOwnProperty'](_0x6aa6('0x3a'))){_0x263096[_0x6aa6('0x20')]=qs['limit'](_0x254eaa[_0x6aa6('0x32')][_0x6aa6('0x20')]);_0x263096[_0x6aa6('0x1f')]=qs['offset'](_0x254eaa[_0x6aa6('0x32')]['offset']);}return _0x3f5a15[_0x6aa6('0x4f')](_0x263096);}})[_0x6aa6('0x25')](function(_0x26fe43){if(_0x26fe43){return _0x26fe43?{'count':_0x5a58af,'rows':_0x26fe43}:null;}})[_0x6aa6('0x25')](respondWithResult(_0x58aea2,null))[_0x6aa6('0x46')](handleError(_0x58aea2,null));};exports[_0x6aa6('0x51')]=function(_0x2e14fc,_0xf7ad9c,_0x3767ad){var _0x1020c9={};var _0x518dd0={};var _0x5a9e83;var _0xee47b8;return db[_0x6aa6('0x2d')]['findOne']({'where':{'id':_0x2e14fc[_0x6aa6('0x4c')]['id']}})['then'](handleEntityNotFound(_0xf7ad9c,null))[_0x6aa6('0x25')](function(_0x2fc49f){if(_0x2fc49f){_0x5a9e83=_0x2fc49f;_0x518dd0[_0x6aa6('0x31')]=_[_0x6aa6('0x33')](db[_0x6aa6('0x4e')][_0x6aa6('0x2e')]);_0x518dd0[_0x6aa6('0x32')]=_[_0x6aa6('0x33')](_0x2e14fc[_0x6aa6('0x32')]);_0x518dd0[_0x6aa6('0x34')]=_[_0x6aa6('0x36')](_0x518dd0[_0x6aa6('0x31')],_0x518dd0[_0x6aa6('0x32')]);_0x1020c9[_0x6aa6('0x35')]=_[_0x6aa6('0x36')](_0x518dd0[_0x6aa6('0x31')],qs[_0x6aa6('0x37')](_0x2e14fc['query'][_0x6aa6('0x37')]));_0x1020c9[_0x6aa6('0x35')]=_0x1020c9[_0x6aa6('0x35')]['length']?_0x1020c9[_0x6aa6('0x35')]:_0x518dd0[_0x6aa6('0x31')];_0x1020c9[_0x6aa6('0x3b')]=qs[_0x6aa6('0x3c')](_0x2e14fc['query'][_0x6aa6('0x3c')]);_0x1020c9[_0x6aa6('0x3d')]=qs[_0x6aa6('0x34')](_['pick'](_0x2e14fc[_0x6aa6('0x32')],_0x518dd0[_0x6aa6('0x34')]));if(_0x2e14fc[_0x6aa6('0x32')][_0x6aa6('0x3f')]){_0x1020c9[_0x6aa6('0x3d')]=_[_0x6aa6('0x40')](_0x1020c9[_0x6aa6('0x3d')],{'$or':_[_0x6aa6('0x2c')](_0x1020c9[_0x6aa6('0x35')],function(_0x79dee5){var _0x3026c2={};_0x3026c2[_0x79dee5]={'$like':'%'+_0x2e14fc[_0x6aa6('0x32')][_0x6aa6('0x3f')]+'%'};return _0x3026c2;})});}_0x1020c9=_[_0x6aa6('0x40')]({},_0x1020c9,_0x2e14fc[_0x6aa6('0x41')]);return _0x5a9e83['getDescriptions'](_0x1020c9);}})['then'](function(_0x41c599){if(_0x41c599){_0xee47b8=_0x41c599[_0x6aa6('0x38')];if(!_0x2e14fc[_0x6aa6('0x32')][_0x6aa6('0x39')](_0x6aa6('0x3a'))){_0x1020c9['limit']=qs['limit'](_0x2e14fc[_0x6aa6('0x32')][_0x6aa6('0x20')]);_0x1020c9[_0x6aa6('0x1f')]=qs['offset'](_0x2e14fc[_0x6aa6('0x32')]['offset']);}return _0x5a9e83[_0x6aa6('0x51')](_0x1020c9);}})[_0x6aa6('0x25')](function(_0x3514dc){if(_0x3514dc){return _0x3514dc?{'count':_0xee47b8,'rows':_0x3514dc}:null;}})[_0x6aa6('0x25')](respondWithResult(_0xf7ad9c,null))[_0x6aa6('0x46')](handleError(_0xf7ad9c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 0fb0d01..3787719 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 _0x96f9=['moment','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash','util','../../config/logger','api'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x96f9,0x64));var _0x996f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x96f9[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x996f('0x0'));var util=require(_0x996f('0x1'));var logger=require(_0x996f('0x2'))(_0x996f('0x3'));var moment=require(_0x996f('0x4'));var BPromise=require(_0x996f('0x5'));var rp=require(_0x996f('0x6'));var fs=require('fs');var path=require(_0x996f('0x7'));var rimraf=require(_0x996f('0x8'));var config=require('../../config/environment');var attributes=require(_0x996f('0x9'));module[_0x996f('0xa')]=function(_0x4846b8,_0x1e1b9d){return _0x4846b8[_0x996f('0xb')](_0x996f('0xc'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5d7=['int_servicenow_configurations','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports','ServicenowConfiguration'];(function(_0x5bac99,_0x59d088){var _0xc3ee9d=function(_0x14ea46){while(--_0x14ea46){_0x5bac99['push'](_0x5bac99['shift']());}};_0xc3ee9d(++_0x59d088);}(_0xa5d7,0x1c3));var _0x7a5d=function(_0x4335b1,_0x579fd4){_0x4335b1=_0x4335b1-0x0;var _0x5c4fb6=_0xa5d7[_0x4335b1];return _0x5c4fb6;};'use strict';var _=require(_0x7a5d('0x0'));var util=require(_0x7a5d('0x1'));var logger=require(_0x7a5d('0x2'))(_0x7a5d('0x3'));var moment=require('moment');var BPromise=require(_0x7a5d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a5d('0x5'));var rimraf=require('rimraf');var config=require(_0x7a5d('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x7a5d('0x7')]=function(_0x42a143,_0x251ef5){return _0x42a143['define'](_0x7a5d('0x8'),attributes,{'tableName':_0x7a5d('0x9'),'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 86afc9e..be6e0d2 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 _0xb6c8=['info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xace0ff,_0x297504){var _0x57efad=function(_0xe2e0ca){while(--_0xe2e0ca){_0xace0ff['push'](_0xace0ff['shift']());}};_0x57efad(++_0x297504);}(_0xb6c8,0x180));var _0x8b6c=function(_0x172a35,_0x16dc04){_0x172a35=_0x172a35-0x0;var _0x562871=_0xb6c8[_0x172a35];return _0x562871;};'use strict';var _=require(_0x8b6c('0x0'));var util=require('util');var moment=require(_0x8b6c('0x1'));var BPromise=require(_0x8b6c('0x2'));var rs=require(_0x8b6c('0x3'));var fs=require('fs');var Redis=require(_0x8b6c('0x4'));var db=require(_0x8b6c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8b6c('0x6'));var jayson=require(_0x8b6c('0x7'));var client=jayson[_0x8b6c('0x8')][_0x8b6c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x210e9a,_0x4cc4de,_0x2bcfd9){return new BPromise(function(_0x252dd0,_0x3458c0){return client[_0x8b6c('0xa')](_0x210e9a,_0x2bcfd9)[_0x8b6c('0xb')](function(_0x5907e8){logger[_0x8b6c('0xc')](_0x8b6c('0xd'),_0x4cc4de,_0x8b6c('0xe'));logger[_0x8b6c('0xf')](_0x8b6c('0x10'),_0x4cc4de,'request\x20sent',JSON[_0x8b6c('0x11')](_0x5907e8));if(_0x5907e8[_0x8b6c('0x12')]){if(_0x5907e8[_0x8b6c('0x12')]['code']===0x1f4){logger[_0x8b6c('0x12')](_0x8b6c('0xd'),_0x4cc4de,_0x5907e8['error'][_0x8b6c('0x13')]);return _0x3458c0(_0x5907e8[_0x8b6c('0x12')][_0x8b6c('0x13')]);}logger[_0x8b6c('0x12')](_0x8b6c('0xd'),_0x4cc4de,_0x5907e8[_0x8b6c('0x12')]['message']);return _0x252dd0(_0x5907e8['error'][_0x8b6c('0x13')]);}else{logger[_0x8b6c('0xc')](_0x8b6c('0xd'),_0x4cc4de,_0x8b6c('0xe'));_0x252dd0(_0x5907e8[_0x8b6c('0x14')][_0x8b6c('0x13')]);}})[_0x8b6c('0x15')](function(_0x3409c3){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x4cc4de,_0x3409c3);_0x3458c0(_0x3409c3);});});} \ No newline at end of file +var _0xa909=['then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xa909,0x95));var _0x9a90=function(_0x3c3ac5,_0xba68a){_0x3c3ac5=_0x3c3ac5-0x0;var _0x15e518=_0xa909[_0x3c3ac5];return _0x15e518;};'use strict';var _=require(_0x9a90('0x0'));var util=require(_0x9a90('0x1'));var moment=require(_0x9a90('0x2'));var BPromise=require('bluebird');var rs=require(_0x9a90('0x3'));var fs=require('fs');var Redis=require(_0x9a90('0x4'));var db=require(_0x9a90('0x5'))['db'];var utils=require(_0x9a90('0x6'));var logger=require('../../config/logger')(_0x9a90('0x7'));var config=require('../../config/environment');var jayson=require(_0x9a90('0x8'));var client=jayson[_0x9a90('0x9')][_0x9a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36a062,_0x1a0fcd,_0x113021){return new BPromise(function(_0x2ae772,_0x48ad2e){return client['request'](_0x36a062,_0x113021)[_0x9a90('0xb')](function(_0x5ea454){logger[_0x9a90('0xc')](_0x9a90('0xd'),_0x1a0fcd,_0x9a90('0xe'));logger[_0x9a90('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x1a0fcd,_0x9a90('0xe'),JSON['stringify'](_0x5ea454));if(_0x5ea454[_0x9a90('0x10')]){if(_0x5ea454[_0x9a90('0x10')][_0x9a90('0x11')]===0x1f4){logger[_0x9a90('0x10')](_0x9a90('0xd'),_0x1a0fcd,_0x5ea454['error'][_0x9a90('0x12')]);return _0x48ad2e(_0x5ea454[_0x9a90('0x10')][_0x9a90('0x12')]);}logger[_0x9a90('0x10')](_0x9a90('0xd'),_0x1a0fcd,_0x5ea454[_0x9a90('0x10')][_0x9a90('0x12')]);return _0x2ae772(_0x5ea454[_0x9a90('0x10')][_0x9a90('0x12')]);}else{logger[_0x9a90('0xc')](_0x9a90('0xd'),_0x1a0fcd,'request\x20sent');_0x2ae772(_0x5ea454['result']['message']);}})[_0x9a90('0x13')](function(_0x198033){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x1a0fcd,_0x198033);_0x48ad2e(_0x198033);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index bbb17f7..294b211 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 _0x7d4f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','post','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x2e5f48,_0x5e0276){var _0x3ed9b0=function(_0x139905){while(--_0x139905){_0x2e5f48['push'](_0x2e5f48['shift']());}};_0x3ed9b0(++_0x5e0276);}(_0x7d4f,0x17c));var _0xf7d4=function(_0x2d7827,_0x5afb3d){_0x2d7827=_0x2d7827-0x0;var _0x2ef080=_0x7d4f[_0x2d7827];return _0x2ef080;};'use strict';var multer=require(_0xf7d4('0x0'));var util=require(_0xf7d4('0x1'));var path=require(_0xf7d4('0x2'));var timeout=require(_0xf7d4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf7d4('0x4'));var auth=require(_0xf7d4('0x5'));var interaction=require(_0xf7d4('0x6'));var config=require(_0xf7d4('0x7'));var controller=require('./intServicenowField.controller');router[_0xf7d4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf7d4('0x8')](_0xf7d4('0x9'),auth[_0xf7d4('0xa')](),controller['show']);router[_0xf7d4('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf7d4('0xc')](_0xf7d4('0x9'),auth['isAuthenticated'](),controller[_0xf7d4('0xd')]);router[_0xf7d4('0xe')](_0xf7d4('0x9'),auth[_0xf7d4('0xa')](),controller['destroy']);module[_0xf7d4('0xf')]=router; \ No newline at end of file +var _0x78a5=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index'];(function(_0x3d5ecf,_0x17e709){var _0x21f2aa=function(_0x402cc2){while(--_0x402cc2){_0x3d5ecf['push'](_0x3d5ecf['shift']());}};_0x21f2aa(++_0x17e709);}(_0x78a5,0xb1));var _0x578a=function(_0x146be0,_0x39a85e){_0x146be0=_0x146be0-0x0;var _0x1bcc25=_0x78a5[_0x146be0];return _0x1bcc25;};'use strict';var multer=require(_0x578a('0x0'));var util=require(_0x578a('0x1'));var path=require('path');var timeout=require(_0x578a('0x2'));var express=require('express');var router=express[_0x578a('0x3')]();var fs_extra=require(_0x578a('0x4'));var auth=require(_0x578a('0x5'));var interaction=require(_0x578a('0x6'));var config=require(_0x578a('0x7'));var controller=require(_0x578a('0x8'));router[_0x578a('0x9')]('/',auth[_0x578a('0xa')](),controller[_0x578a('0xb')]);router['get'](_0x578a('0xc'),auth[_0x578a('0xa')](),controller[_0x578a('0xd')]);router[_0x578a('0xe')]('/',auth['isAuthenticated'](),controller[_0x578a('0xf')]);router[_0x578a('0x10')](_0x578a('0xc'),auth['isAuthenticated'](),controller[_0x578a('0x11')]);router[_0x578a('0x12')](_0x578a('0xc'),auth['isAuthenticated'](),controller[_0x578a('0x13')]);module[_0x578a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 7b05d89..34616f4 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 _0xb02a=['keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb02a,0x176));var _0xab02=function(_0x184642,_0x6c23d8){_0x184642=_0x184642-0x0;var _0x5bb270=_0xb02a[_0x184642];return _0x5bb270;};'use strict';var Sequelize=require(_0xab02('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xab02('0x1'),_0xab02('0x2'),_0xab02('0x3'),_0xab02('0x4'),_0xab02('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xab02('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xab02('0x7')](_0xab02('0x1'),_0xab02('0x2'),_0xab02('0x3'))},'keyContent':{'type':Sequelize[_0xab02('0x6')]},'idField':{'type':Sequelize[_0xab02('0x6')]},'nameField':{'type':Sequelize[_0xab02('0x6')]},'customField':{'type':Sequelize[_0xab02('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xab02('0x6')]}}; \ No newline at end of file +var _0x298a=['string','variable','customVariable','picklist','STRING','ENUM','BOOLEAN','sequelize'];(function(_0x5585a6,_0x1ad47d){var _0x36a760=function(_0x1b4367){while(--_0x1b4367){_0x5585a6['push'](_0x5585a6['shift']());}};_0x36a760(++_0x1ad47d);}(_0x298a,0x1a7));var _0xa298=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x298a[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xa298('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa298('0x1'),_0xa298('0x2'),_0xa298('0x3'),'keyValue',_0xa298('0x4')),'defaultValue':_0xa298('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa298('0x5')]},'keyType':{'type':Sequelize[_0xa298('0x6')](_0xa298('0x1'),_0xa298('0x2'),_0xa298('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa298('0x5')]},'nameField':{'type':Sequelize[_0xa298('0x5')]},'customField':{'type':Sequelize[_0xa298('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa298('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index f63af8c..d0796b3 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 _0xd7b8=['count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','ServicenowField','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit'];(function(_0x404e3a,_0x4d020b){var _0x3acf8f=function(_0x2a7af3){while(--_0x2a7af3){_0x404e3a['push'](_0x404e3a['shift']());}};_0x3acf8f(++_0x4d020b);}(_0xd7b8,0x1aa));var _0x8d7b=function(_0x4ebbc8,_0x155642){_0x4ebbc8=_0x4ebbc8-0x0;var _0x3e3916=_0xd7b8[_0x4ebbc8];return _0x3e3916;};'use strict';var emlformat=require(_0x8d7b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8d7b('0x1'));var jsonpatch=require(_0x8d7b('0x2'));var rp=require(_0x8d7b('0x3'));var moment=require('moment');var BPromise=require(_0x8d7b('0x4'));var Mustache=require(_0x8d7b('0x5'));var util=require(_0x8d7b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x8d7b('0x7'));var ejs=require(_0x8d7b('0x8'));var fs=require('fs');var fs_extra=require(_0x8d7b('0x9'));var _=require(_0x8d7b('0xa'));var squel=require(_0x8d7b('0xb'));var crypto=require(_0x8d7b('0xc'));var jsforce=require(_0x8d7b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8d7b('0x7'));var querystring=require(_0x8d7b('0xe'));var Papa=require(_0x8d7b('0xf'));var Redis=require(_0x8d7b('0x10'));var authService=require(_0x8d7b('0x11'));var qs=require(_0x8d7b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d7b('0x13'));var logger=require(_0x8d7b('0x14'))(_0x8d7b('0x15'));var utils=require(_0x8d7b('0x16'));var config=require(_0x8d7b('0x17'));var licenseUtil=require(_0x8d7b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11b582,_0x40a599){_0x40a599=_0x40a599||0xcc;return function(_0x595d17){if(_0x595d17){return _0x11b582[_0x8d7b('0x19')](_0x40a599);}return _0x11b582['status'](_0x40a599)[_0x8d7b('0x1a')]();};}function respondWithResult(_0x70ccce,_0x8d4cf2){_0x8d4cf2=_0x8d4cf2||0xc8;return function(_0x28c71f){if(_0x28c71f){return _0x70ccce[_0x8d7b('0x1b')](_0x8d4cf2)['json'](_0x28c71f);}};}function respondWithFilteredResult(_0x592ed7,_0x1a898b){return function(_0x256bab){if(_0x256bab){var _0x33cf44=typeof _0x1a898b['offset']===_0x8d7b('0x1c')&&typeof _0x1a898b[_0x8d7b('0x1d')]===_0x8d7b('0x1c');var _0x3b3085=_0x256bab[_0x8d7b('0x1e')];var _0x2e9ebd=_0x33cf44?0x0:_0x1a898b[_0x8d7b('0x1f')];var _0x449a32=_0x33cf44?_0x256bab[_0x8d7b('0x1e')]:_0x1a898b[_0x8d7b('0x1f')]+_0x1a898b[_0x8d7b('0x1d')];var _0x325d17;if(_0x449a32>=_0x3b3085){_0x449a32=_0x3b3085;_0x325d17=0xc8;}else{_0x325d17=0xce;}_0x592ed7['status'](_0x325d17);return _0x592ed7[_0x8d7b('0x20')](_0x8d7b('0x21'),_0x2e9ebd+'-'+_0x449a32+'/'+_0x3b3085)['json'](_0x256bab);}return null;};}function patchUpdates(_0x3f2bff){return function(_0x450614){try{jsonpatch[_0x8d7b('0x22')](_0x450614,_0x3f2bff,!![]);}catch(_0x1b48e0){return BPromise[_0x8d7b('0x23')](_0x1b48e0);}return _0x450614[_0x8d7b('0x24')]();};}function saveUpdates(_0x111b0e,_0x196b22){return function(_0x54a96f){if(_0x54a96f){return _0x54a96f[_0x8d7b('0x25')](_0x111b0e)[_0x8d7b('0x26')](function(_0x1a20be){return _0x1a20be;});}return null;};}function removeEntity(_0x1a758c,_0x415a55){return function(_0x4b061b){if(_0x4b061b){return _0x4b061b[_0x8d7b('0x27')]()[_0x8d7b('0x26')](function(){_0x1a758c[_0x8d7b('0x1b')](0xcc)[_0x8d7b('0x1a')]();});}};}function handleEntityNotFound(_0x5ae719,_0x2a627c){return function(_0x35c857){if(!_0x35c857){_0x5ae719[_0x8d7b('0x19')](0x194);}return _0x35c857;};}function handleError(_0x2ab461,_0x3facd0){_0x3facd0=_0x3facd0||0x1f4;return function(_0x716c28){logger[_0x8d7b('0x28')](_0x716c28[_0x8d7b('0x29')]);if(_0x716c28['name']){delete _0x716c28[_0x8d7b('0x2a')];}_0x2ab461[_0x8d7b('0x1b')](_0x3facd0)[_0x8d7b('0x2b')](_0x716c28);};}exports['index']=function(_0x4be76f,_0x38055e){var _0xb0f01f={},_0x1f95fa={},_0x5da0df={'count':0x0,'rows':[]};var _0x46adc9=_['map'](db[_0x8d7b('0x2c')][_0x8d7b('0x2d')],function(_0x143d1a){return{'name':_0x143d1a[_0x8d7b('0x2e')],'type':_0x143d1a[_0x8d7b('0x2f')][_0x8d7b('0x30')]};});_0x1f95fa[_0x8d7b('0x31')]=_[_0x8d7b('0x32')](_0x46adc9,'name');_0x1f95fa[_0x8d7b('0x33')]=_[_0x8d7b('0x34')](_0x4be76f[_0x8d7b('0x33')]);_0x1f95fa['filters']=_[_0x8d7b('0x35')](_0x1f95fa[_0x8d7b('0x31')],_0x1f95fa[_0x8d7b('0x33')]);_0xb0f01f['attributes']=_['intersection'](_0x1f95fa[_0x8d7b('0x31')],qs[_0x8d7b('0x36')](_0x4be76f[_0x8d7b('0x33')][_0x8d7b('0x36')]));_0xb0f01f[_0x8d7b('0x37')]=_0xb0f01f[_0x8d7b('0x37')][_0x8d7b('0x38')]?_0xb0f01f['attributes']:_0x1f95fa['model'];if(!_0x4be76f[_0x8d7b('0x33')][_0x8d7b('0x39')]('nolimit')){_0xb0f01f[_0x8d7b('0x1d')]=qs[_0x8d7b('0x1d')](_0x4be76f['query'][_0x8d7b('0x1d')]);_0xb0f01f[_0x8d7b('0x1f')]=qs['offset'](_0x4be76f['query'][_0x8d7b('0x1f')]);}_0xb0f01f[_0x8d7b('0x3a')]=qs[_0x8d7b('0x3b')](_0x4be76f[_0x8d7b('0x33')][_0x8d7b('0x3b')]);_0xb0f01f[_0x8d7b('0x3c')]=qs[_0x8d7b('0x3d')](_[_0x8d7b('0x3e')](_0x4be76f[_0x8d7b('0x33')],_0x1f95fa[_0x8d7b('0x3d')]),_0x46adc9);if(_0x4be76f[_0x8d7b('0x33')][_0x8d7b('0x3f')]){_0xb0f01f['where']=_[_0x8d7b('0x40')](_0xb0f01f[_0x8d7b('0x3c')],{'$or':_['map'](_0x46adc9,function(_0x295c44){if(_0x295c44[_0x8d7b('0x2f')]!==_0x8d7b('0x41')){var _0x249ae3={};_0x249ae3[_0x295c44[_0x8d7b('0x2a')]]={'$like':'%'+_0x4be76f['query'][_0x8d7b('0x3f')]+'%'};return _0x249ae3;}})});}_0xb0f01f=_[_0x8d7b('0x40')]({},_0xb0f01f,_0x4be76f['options']);var _0x1236b6={'where':_0xb0f01f[_0x8d7b('0x3c')]};return db['ServicenowField'][_0x8d7b('0x1e')](_0x1236b6)['then'](function(_0x2b8f85){_0x5da0df[_0x8d7b('0x1e')]=_0x2b8f85;if(_0x4be76f['query'][_0x8d7b('0x42')]){_0xb0f01f[_0x8d7b('0x43')]=[{'all':!![]}];}return db[_0x8d7b('0x2c')]['findAll'](_0xb0f01f);})['then'](function(_0x4c84e7){_0x5da0df[_0x8d7b('0x44')]=_0x4c84e7;return _0x5da0df;})[_0x8d7b('0x26')](respondWithFilteredResult(_0x38055e,_0xb0f01f))[_0x8d7b('0x45')](handleError(_0x38055e,null));};exports[_0x8d7b('0x46')]=function(_0x43585d,_0x407159){var _0xfbc41a={'raw':!![],'where':{'id':_0x43585d[_0x8d7b('0x47')]['id']}},_0x24c797={};_0x24c797[_0x8d7b('0x31')]=_['keys'](db[_0x8d7b('0x2c')][_0x8d7b('0x2d')]);_0x24c797['query']=_['keys'](_0x43585d[_0x8d7b('0x33')]);_0x24c797['filters']=_[_0x8d7b('0x35')](_0x24c797[_0x8d7b('0x31')],_0x24c797[_0x8d7b('0x33')]);_0xfbc41a[_0x8d7b('0x37')]=_[_0x8d7b('0x35')](_0x24c797['model'],qs[_0x8d7b('0x36')](_0x43585d['query'][_0x8d7b('0x36')]));_0xfbc41a[_0x8d7b('0x37')]=_0xfbc41a[_0x8d7b('0x37')][_0x8d7b('0x38')]?_0xfbc41a[_0x8d7b('0x37')]:_0x24c797[_0x8d7b('0x31')];if(_0x43585d[_0x8d7b('0x33')][_0x8d7b('0x42')]){_0xfbc41a[_0x8d7b('0x43')]=[{'all':!![]}];}_0xfbc41a=_['merge']({},_0xfbc41a,_0x43585d[_0x8d7b('0x48')]);return db['ServicenowField']['find'](_0xfbc41a)[_0x8d7b('0x26')](handleEntityNotFound(_0x407159,null))[_0x8d7b('0x26')](respondWithResult(_0x407159,null))['catch'](handleError(_0x407159,null));};exports[_0x8d7b('0x49')]=function(_0x29d7cd,_0x2f1ba9){return db[_0x8d7b('0x2c')][_0x8d7b('0x49')](_0x29d7cd[_0x8d7b('0x4a')],{})[_0x8d7b('0x26')](respondWithResult(_0x2f1ba9,0xc9))[_0x8d7b('0x45')](handleError(_0x2f1ba9,null));};exports['update']=function(_0x3e3816,_0x20de9a){if(_0x3e3816[_0x8d7b('0x4a')]['id']){delete _0x3e3816[_0x8d7b('0x4a')]['id'];}return db['ServicenowField']['find']({'where':{'id':_0x3e3816[_0x8d7b('0x47')]['id']}})[_0x8d7b('0x26')](handleEntityNotFound(_0x20de9a,null))[_0x8d7b('0x26')](saveUpdates(_0x3e3816[_0x8d7b('0x4a')],null))[_0x8d7b('0x26')](respondWithResult(_0x20de9a,null))[_0x8d7b('0x45')](handleError(_0x20de9a,null));};exports[_0x8d7b('0x27')]=function(_0x119547,_0x1e0dd0){return db[_0x8d7b('0x2c')][_0x8d7b('0x4b')]({'where':{'id':_0x119547[_0x8d7b('0x47')]['id']}})[_0x8d7b('0x26')](handleEntityNotFound(_0x1e0dd0,null))['then'](removeEntity(_0x1e0dd0,null))[_0x8d7b('0x45')](handleError(_0x1e0dd0,null));}; \ No newline at end of file +var _0xda89=['intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','find','catch','create','body','params','eml-format','request-promise','moment','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','ServicenowField','rawAttributes','type','key','model','query','keys','filters'];(function(_0x563f91,_0x206b3e){var _0x10c8a6=function(_0x4b542b){while(--_0x4b542b){_0x563f91['push'](_0x563f91['shift']());}};_0x10c8a6(++_0x206b3e);}(_0xda89,0xea));var _0x9da8=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xda89[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x9da8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9da8('0x1'));var moment=require(_0x9da8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9da8('0x3'));var util=require(_0x9da8('0x4'));var path=require(_0x9da8('0x5'));var sox=require(_0x9da8('0x6'));var csv=require('to-csv');var ejs=require(_0x9da8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9da8('0x8'));var jsforce=require(_0x9da8('0x9'));var deskjs=require(_0x9da8('0xa'));var toCsv=require(_0x9da8('0xb'));var querystring=require('querystring');var Papa=require(_0x9da8('0xc'));var Redis=require(_0x9da8('0xd'));var authService=require(_0x9da8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9da8('0xf'));var hardwareService=require(_0x9da8('0x10'));var logger=require(_0x9da8('0x11'))(_0x9da8('0x12'));var utils=require(_0x9da8('0x13'));var config=require(_0x9da8('0x14'));var licenseUtil=require(_0x9da8('0x15'));var db=require(_0x9da8('0x16'))['db'];function respondWithStatusCode(_0x49c0b7,_0x101407){_0x101407=_0x101407||0xcc;return function(_0x3a9d1c){if(_0x3a9d1c){return _0x49c0b7['sendStatus'](_0x101407);}return _0x49c0b7[_0x9da8('0x17')](_0x101407)[_0x9da8('0x18')]();};}function respondWithResult(_0x26d75d,_0x3bbdfc){_0x3bbdfc=_0x3bbdfc||0xc8;return function(_0x477390){if(_0x477390){return _0x26d75d[_0x9da8('0x17')](_0x3bbdfc)[_0x9da8('0x19')](_0x477390);}};}function respondWithFilteredResult(_0x4a9c12,_0x66ce6b){return function(_0x4e7b40){if(_0x4e7b40){var _0x4d5447=typeof _0x66ce6b[_0x9da8('0x1a')]===_0x9da8('0x1b')&&typeof _0x66ce6b[_0x9da8('0x1c')]===_0x9da8('0x1b');var _0x349b55=_0x4e7b40[_0x9da8('0x1d')];var _0x5aa54e=_0x4d5447?0x0:_0x66ce6b[_0x9da8('0x1a')];var _0x2b8f4d=_0x4d5447?_0x4e7b40[_0x9da8('0x1d')]:_0x66ce6b['offset']+_0x66ce6b[_0x9da8('0x1c')];var _0x38b818;if(_0x2b8f4d>=_0x349b55){_0x2b8f4d=_0x349b55;_0x38b818=0xc8;}else{_0x38b818=0xce;}_0x4a9c12[_0x9da8('0x17')](_0x38b818);return _0x4a9c12['set'](_0x9da8('0x1e'),_0x5aa54e+'-'+_0x2b8f4d+'/'+_0x349b55)[_0x9da8('0x19')](_0x4e7b40);}return null;};}function patchUpdates(_0x24f2aa){return function(_0x1775e2){try{jsonpatch[_0x9da8('0x1f')](_0x1775e2,_0x24f2aa,!![]);}catch(_0x355d3d){return BPromise[_0x9da8('0x20')](_0x355d3d);}return _0x1775e2['save']();};}function saveUpdates(_0x4d72e4,_0x4214a3){return function(_0x36c223){if(_0x36c223){return _0x36c223[_0x9da8('0x21')](_0x4d72e4)[_0x9da8('0x22')](function(_0x1c7ce6){return _0x1c7ce6;});}return null;};}function removeEntity(_0x4baeb8,_0x119ae4){return function(_0x268393){if(_0x268393){return _0x268393[_0x9da8('0x23')]()[_0x9da8('0x22')](function(){_0x4baeb8[_0x9da8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42ccf0,_0x2736a1){return function(_0x1836d7){if(!_0x1836d7){_0x42ccf0[_0x9da8('0x24')](0x194);}return _0x1836d7;};}function handleError(_0x3224f4,_0x267d08){_0x267d08=_0x267d08||0x1f4;return function(_0x2cc508){logger['error'](_0x2cc508[_0x9da8('0x25')]);if(_0x2cc508[_0x9da8('0x26')]){delete _0x2cc508['name'];}_0x3224f4[_0x9da8('0x17')](_0x267d08)[_0x9da8('0x27')](_0x2cc508);};}exports[_0x9da8('0x28')]=function(_0xe389f8,_0x2459cb){var _0xc3ebe5={},_0x2c4737={},_0x3d610c={'count':0x0,'rows':[]};var _0x5ce44c=_[_0x9da8('0x29')](db[_0x9da8('0x2a')][_0x9da8('0x2b')],function(_0x3bee9d){return{'name':_0x3bee9d['fieldName'],'type':_0x3bee9d[_0x9da8('0x2c')][_0x9da8('0x2d')]};});_0x2c4737[_0x9da8('0x2e')]=_[_0x9da8('0x29')](_0x5ce44c,_0x9da8('0x26'));_0x2c4737[_0x9da8('0x2f')]=_[_0x9da8('0x30')](_0xe389f8[_0x9da8('0x2f')]);_0x2c4737[_0x9da8('0x31')]=_[_0x9da8('0x32')](_0x2c4737[_0x9da8('0x2e')],_0x2c4737[_0x9da8('0x2f')]);_0xc3ebe5[_0x9da8('0x33')]=_[_0x9da8('0x32')](_0x2c4737[_0x9da8('0x2e')],qs[_0x9da8('0x34')](_0xe389f8[_0x9da8('0x2f')][_0x9da8('0x34')]));_0xc3ebe5[_0x9da8('0x33')]=_0xc3ebe5[_0x9da8('0x33')][_0x9da8('0x35')]?_0xc3ebe5['attributes']:_0x2c4737[_0x9da8('0x2e')];if(!_0xe389f8[_0x9da8('0x2f')][_0x9da8('0x36')]('nolimit')){_0xc3ebe5[_0x9da8('0x1c')]=qs['limit'](_0xe389f8['query']['limit']);_0xc3ebe5[_0x9da8('0x1a')]=qs[_0x9da8('0x1a')](_0xe389f8[_0x9da8('0x2f')][_0x9da8('0x1a')]);}_0xc3ebe5[_0x9da8('0x37')]=qs[_0x9da8('0x38')](_0xe389f8['query']['sort']);_0xc3ebe5[_0x9da8('0x39')]=qs[_0x9da8('0x31')](_[_0x9da8('0x3a')](_0xe389f8[_0x9da8('0x2f')],_0x2c4737[_0x9da8('0x31')]),_0x5ce44c);if(_0xe389f8['query'][_0x9da8('0x3b')]){_0xc3ebe5[_0x9da8('0x39')]=_[_0x9da8('0x3c')](_0xc3ebe5[_0x9da8('0x39')],{'$or':_[_0x9da8('0x29')](_0x5ce44c,function(_0x2425b2){if(_0x2425b2[_0x9da8('0x2c')]!==_0x9da8('0x3d')){var _0x422a5d={};_0x422a5d[_0x2425b2[_0x9da8('0x26')]]={'$like':'%'+_0xe389f8['query'][_0x9da8('0x3b')]+'%'};return _0x422a5d;}})});}_0xc3ebe5=_[_0x9da8('0x3c')]({},_0xc3ebe5,_0xe389f8['options']);var _0x455c66={'where':_0xc3ebe5['where']};return db[_0x9da8('0x2a')][_0x9da8('0x1d')](_0x455c66)[_0x9da8('0x22')](function(_0x15dbf8){_0x3d610c[_0x9da8('0x1d')]=_0x15dbf8;if(_0xe389f8['query'][_0x9da8('0x3e')]){_0xc3ebe5[_0x9da8('0x3f')]=[{'all':!![]}];}return db[_0x9da8('0x2a')][_0x9da8('0x40')](_0xc3ebe5);})[_0x9da8('0x22')](function(_0x22064e){_0x3d610c['rows']=_0x22064e;return _0x3d610c;})[_0x9da8('0x22')](respondWithFilteredResult(_0x2459cb,_0xc3ebe5))['catch'](handleError(_0x2459cb,null));};exports[_0x9da8('0x41')]=function(_0x404972,_0x4b29ee){var _0x423cb1={'raw':!![],'where':{'id':_0x404972['params']['id']}},_0x4d2295={};_0x4d2295[_0x9da8('0x2e')]=_[_0x9da8('0x30')](db[_0x9da8('0x2a')][_0x9da8('0x2b')]);_0x4d2295[_0x9da8('0x2f')]=_[_0x9da8('0x30')](_0x404972[_0x9da8('0x2f')]);_0x4d2295['filters']=_[_0x9da8('0x32')](_0x4d2295[_0x9da8('0x2e')],_0x4d2295[_0x9da8('0x2f')]);_0x423cb1[_0x9da8('0x33')]=_['intersection'](_0x4d2295[_0x9da8('0x2e')],qs['fields'](_0x404972[_0x9da8('0x2f')][_0x9da8('0x34')]));_0x423cb1[_0x9da8('0x33')]=_0x423cb1['attributes'][_0x9da8('0x35')]?_0x423cb1[_0x9da8('0x33')]:_0x4d2295[_0x9da8('0x2e')];if(_0x404972[_0x9da8('0x2f')][_0x9da8('0x3e')]){_0x423cb1['include']=[{'all':!![]}];}_0x423cb1=_[_0x9da8('0x3c')]({},_0x423cb1,_0x404972['options']);return db['ServicenowField'][_0x9da8('0x42')](_0x423cb1)[_0x9da8('0x22')](handleEntityNotFound(_0x4b29ee,null))['then'](respondWithResult(_0x4b29ee,null))[_0x9da8('0x43')](handleError(_0x4b29ee,null));};exports[_0x9da8('0x44')]=function(_0xe8a135,_0x546421){return db[_0x9da8('0x2a')]['create'](_0xe8a135[_0x9da8('0x45')],{})[_0x9da8('0x22')](respondWithResult(_0x546421,0xc9))['catch'](handleError(_0x546421,null));};exports['update']=function(_0x2239bf,_0x596d86){if(_0x2239bf[_0x9da8('0x45')]['id']){delete _0x2239bf[_0x9da8('0x45')]['id'];}return db['ServicenowField'][_0x9da8('0x42')]({'where':{'id':_0x2239bf[_0x9da8('0x46')]['id']}})[_0x9da8('0x22')](handleEntityNotFound(_0x596d86,null))[_0x9da8('0x22')](saveUpdates(_0x2239bf[_0x9da8('0x45')],null))['then'](respondWithResult(_0x596d86,null))[_0x9da8('0x43')](handleError(_0x596d86,null));};exports[_0x9da8('0x23')]=function(_0x3df026,_0x225dcc){return db['ServicenowField'][_0x9da8('0x42')]({'where':{'id':_0x3df026['params']['id']}})[_0x9da8('0x22')](handleEntityNotFound(_0x225dcc,null))[_0x9da8('0x22')](removeEntity(_0x225dcc,null))[_0x9da8('0x43')](handleError(_0x225dcc,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 71520dd..d86df9d 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 _0x1361=['../../config/logger','api','moment','bluebird','path','../../config/environment','./intServicenowField.attributes','define','idField','FieldId','util'];(function(_0x35e6d3,_0x1da972){var _0x5e8fb7=function(_0x461fd0){while(--_0x461fd0){_0x35e6d3['push'](_0x35e6d3['shift']());}};_0x5e8fb7(++_0x1da972);}(_0x1361,0x149));var _0x1136=function(_0x3c0193,_0x244546){_0x3c0193=_0x3c0193-0x0;var _0x2f5535=_0x1361[_0x3c0193];return _0x2f5535;};'use strict';var _=require('lodash');var util=require(_0x1136('0x0'));var logger=require(_0x1136('0x1'))(_0x1136('0x2'));var moment=require(_0x1136('0x3'));var BPromise=require(_0x1136('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1136('0x5'));var rimraf=require('rimraf');var config=require(_0x1136('0x6'));var attributes=require(_0x1136('0x7'));module['exports']=function(_0x12ff88,_0x7a2c8c){return _0x12ff88[_0x1136('0x8')]('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x1136('0x9'),_0x1136('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd08c=['int_servicenow_fields','servicenow_unique_index','idField','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','define','ServicenowField'];(function(_0x907c3d,_0x1e8850){var _0x16684c=function(_0x1ee01b){while(--_0x1ee01b){_0x907c3d['push'](_0x907c3d['shift']());}};_0x16684c(++_0x1e8850);}(_0xd08c,0x13b));var _0xcd08=function(_0x51b6cf,_0x27efd4){_0x51b6cf=_0x51b6cf-0x0;var _0xc8f82a=_0xd08c[_0x51b6cf];return _0xc8f82a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcd08('0x0'))('api');var moment=require(_0xcd08('0x1'));var BPromise=require('bluebird');var rp=require(_0xcd08('0x2'));var fs=require('fs');var path=require(_0xcd08('0x3'));var rimraf=require(_0xcd08('0x4'));var config=require(_0xcd08('0x5'));var attributes=require(_0xcd08('0x6'));module['exports']=function(_0x558ad9,_0x41d22d){return _0x558ad9[_0xcd08('0x7')](_0xcd08('0x8'),attributes,{'tableName':_0xcd08('0x9'),'paranoid':![],'indexes':[{'name':_0xcd08('0xa'),'fields':[_0xcd08('0xb'),'FieldId'],'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 32ec0e9..702517f 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4bcb3f,_0x479d9b){var _0x198c16=function(_0x19cd07){while(--_0x19cd07){_0x4bcb3f['push'](_0x4bcb3f['shift']());}};_0x198c16(++_0x479d9b);}(_0x70e0,0x17b));var _0x070e=function(_0x526b8b,_0x191d39){_0x526b8b=_0x526b8b-0x0;var _0x48ef64=_0x70e0[_0x526b8b];return _0x48ef64;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xbaf0=['client','http','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x154940,_0x4a448a){var _0x401409=function(_0x45cdcf){while(--_0x45cdcf){_0x154940['push'](_0x154940['shift']());}};_0x401409(++_0x4a448a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 6d3df2c..60dbf03 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(_0x1bb6c6,_0x4dce82){var _0x297d7c=function(_0x464c5f){while(--_0x464c5f){_0x1bb6c6['push'](_0x1bb6c6['shift']());}};_0x297d7c(++_0x4dce82);}(_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','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x18cca5,_0x462f3){var _0x10d960=function(_0x5b2ae8){while(--_0x5b2ae8){_0x18cca5['push'](_0x18cca5['shift']());}};_0x10d960(++_0x462f3);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 5ed4104..8f2454c 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(_0xd80d25,_0x1a403b){var _0x258763=function(_0x4669c1){while(--_0x4669c1){_0xd80d25['push'](_0xd80d25['shift']());}};_0x258763(++_0x1a403b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x5d2aaa,_0x55f0c2){var _0x50cec8=function(_0x52d733){while(--_0x52d733){_0x5d2aaa['push'](_0x5d2aaa['shift']());}};_0x50cec8(++_0x55f0c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 15ae3b4..634e8aa 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 _0xe349=['password','remoteUri','slice','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','Invalid\x20Login','Password\x20Expired','values','module_fields','remove','includes','label','endsWith','value','statusCode','error','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','stack','name','send','map','SugarcrmAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','type','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','update','body','getConfigurations','SugarcrmConfiguration','pick','addConfiguration','findOne','AccountId','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username'];(function(_0x475191,_0x5bce86){var _0x189e96=function(_0x46d6a2){while(--_0x46d6a2){_0x475191['push'](_0x475191['shift']());}};_0x189e96(++_0x5bce86);}(_0xe349,0x107));var _0x9e34=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0xe349[_0x1c34e7];return _0x378cb1;};'use strict';var emlformat=require(_0x9e34('0x0'));var rimraf=require(_0x9e34('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e34('0x2'));var rp=require(_0x9e34('0x3'));var moment=require(_0x9e34('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9e34('0x5'));var util=require(_0x9e34('0x6'));var path=require(_0x9e34('0x7'));var sox=require(_0x9e34('0x8'));var csv=require('to-csv');var ejs=require(_0x9e34('0x9'));var fs=require('fs');var fs_extra=require(_0x9e34('0xa'));var _=require('lodash');var squel=require(_0x9e34('0xb'));var crypto=require(_0x9e34('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9e34('0xd'));var toCsv=require(_0x9e34('0xe'));var querystring=require(_0x9e34('0xf'));var Papa=require('papaparse');var Redis=require(_0x9e34('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9e34('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e34('0x12'))(_0x9e34('0x13'));var utils=require(_0x9e34('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9e34('0x15'));var db=require(_0x9e34('0x16'))['db'];var integrations=require(_0x9e34('0x17'));function respondWithStatusCode(_0x390228,_0x29b7fc){_0x29b7fc=_0x29b7fc||0xcc;return function(_0x1aed53){if(_0x1aed53){return _0x390228[_0x9e34('0x18')](_0x29b7fc);}return _0x390228[_0x9e34('0x19')](_0x29b7fc)[_0x9e34('0x1a')]();};}function respondWithResult(_0x46714e,_0x50fd8f){_0x50fd8f=_0x50fd8f||0xc8;return function(_0x3f9730){if(_0x3f9730){return _0x46714e[_0x9e34('0x19')](_0x50fd8f)[_0x9e34('0x1b')](_0x3f9730);}};}function respondWithFilteredResult(_0x1ba415,_0x58105f){return function(_0x56d17e){if(_0x56d17e){var _0x37f585=typeof _0x58105f[_0x9e34('0x1c')]===_0x9e34('0x1d')&&typeof _0x58105f[_0x9e34('0x1e')]===_0x9e34('0x1d');var _0x246de6=_0x56d17e[_0x9e34('0x1f')];var _0x53dd0b=_0x37f585?0x0:_0x58105f[_0x9e34('0x1c')];var _0x1f37da=_0x37f585?_0x56d17e[_0x9e34('0x1f')]:_0x58105f[_0x9e34('0x1c')]+_0x58105f[_0x9e34('0x1e')];var _0x274239;if(_0x1f37da>=_0x246de6){_0x1f37da=_0x246de6;_0x274239=0xc8;}else{_0x274239=0xce;}_0x1ba415[_0x9e34('0x19')](_0x274239);return _0x1ba415['set'](_0x9e34('0x20'),_0x53dd0b+'-'+_0x1f37da+'/'+_0x246de6)[_0x9e34('0x1b')](_0x56d17e);}return null;};}function patchUpdates(_0x3ffb79){return function(_0x39148a){try{jsonpatch[_0x9e34('0x21')](_0x39148a,_0x3ffb79,!![]);}catch(_0x199000){return BPromise[_0x9e34('0x22')](_0x199000);}return _0x39148a[_0x9e34('0x23')]();};}function saveUpdates(_0x284f59,_0x5823cc){return function(_0x387236){if(_0x387236){return _0x387236['update'](_0x284f59)['then'](function(_0x249abb){return _0x249abb;});}return null;};}function removeEntity(_0x54238d,_0x17f078){return function(_0x3313c6){if(_0x3313c6){return _0x3313c6[_0x9e34('0x24')]()[_0x9e34('0x25')](function(){_0x54238d[_0x9e34('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x567f70,_0x13b556){return function(_0x495922){if(!_0x495922){_0x567f70[_0x9e34('0x18')](0x194);}return _0x495922;};}function handleError(_0x310bb2,_0x13d274){_0x13d274=_0x13d274||0x1f4;return function(_0x3c9c61){logger['error'](_0x3c9c61[_0x9e34('0x26')]);if(_0x3c9c61['name']){delete _0x3c9c61[_0x9e34('0x27')];}_0x310bb2['status'](_0x13d274)[_0x9e34('0x28')](_0x3c9c61);};}exports['index']=function(_0x25a439,_0x2b9adf){var _0x26135f={},_0x23fe2b={},_0x5f01b8={'count':0x0,'rows':[]};var _0x1e48bd=_[_0x9e34('0x29')](db[_0x9e34('0x2a')][_0x9e34('0x2b')],function(_0x1eab3a){return{'name':_0x1eab3a['fieldName'],'type':_0x1eab3a['type'][_0x9e34('0x2c')]};});_0x23fe2b[_0x9e34('0x2d')]=_[_0x9e34('0x29')](_0x1e48bd,'name');_0x23fe2b[_0x9e34('0x2e')]=_[_0x9e34('0x2f')](_0x25a439[_0x9e34('0x2e')]);_0x23fe2b[_0x9e34('0x30')]=_[_0x9e34('0x31')](_0x23fe2b['model'],_0x23fe2b[_0x9e34('0x2e')]);_0x26135f[_0x9e34('0x32')]=_[_0x9e34('0x31')](_0x23fe2b[_0x9e34('0x2d')],qs[_0x9e34('0x33')](_0x25a439[_0x9e34('0x2e')][_0x9e34('0x33')]));_0x26135f[_0x9e34('0x32')]=_0x26135f['attributes'][_0x9e34('0x34')]?_0x26135f[_0x9e34('0x32')]:_0x23fe2b[_0x9e34('0x2d')];if(!_0x25a439[_0x9e34('0x2e')][_0x9e34('0x35')](_0x9e34('0x36'))){_0x26135f[_0x9e34('0x1e')]=qs[_0x9e34('0x1e')](_0x25a439[_0x9e34('0x2e')][_0x9e34('0x1e')]);_0x26135f[_0x9e34('0x1c')]=qs[_0x9e34('0x1c')](_0x25a439[_0x9e34('0x2e')][_0x9e34('0x1c')]);}_0x26135f['order']=qs[_0x9e34('0x37')](_0x25a439[_0x9e34('0x2e')][_0x9e34('0x37')]);_0x26135f['where']=qs['filters'](_['pick'](_0x25a439[_0x9e34('0x2e')],_0x23fe2b[_0x9e34('0x30')]),_0x1e48bd);if(_0x25a439[_0x9e34('0x2e')][_0x9e34('0x38')]){_0x26135f[_0x9e34('0x39')]=_['merge'](_0x26135f[_0x9e34('0x39')],{'$or':_[_0x9e34('0x29')](_0x1e48bd,function(_0x2b9b90){if(_0x2b9b90[_0x9e34('0x3a')]!=='VIRTUAL'){var _0x3e03f4={};_0x3e03f4[_0x2b9b90['name']]={'$like':'%'+_0x25a439[_0x9e34('0x2e')]['filter']+'%'};return _0x3e03f4;}})});}_0x26135f=_[_0x9e34('0x3b')]({},_0x26135f,_0x25a439[_0x9e34('0x3c')]);var _0x329ddd={'where':_0x26135f[_0x9e34('0x39')]};return db[_0x9e34('0x2a')][_0x9e34('0x1f')](_0x329ddd)[_0x9e34('0x25')](function(_0x15fc8b){_0x5f01b8[_0x9e34('0x1f')]=_0x15fc8b;if(_0x25a439[_0x9e34('0x2e')][_0x9e34('0x3d')]){_0x26135f['include']=[{'all':!![]}];}return db[_0x9e34('0x2a')][_0x9e34('0x3e')](_0x26135f);})[_0x9e34('0x25')](function(_0xd6156d){_0x5f01b8[_0x9e34('0x3f')]=_0xd6156d;return _0x5f01b8;})[_0x9e34('0x25')](respondWithFilteredResult(_0x2b9adf,_0x26135f))[_0x9e34('0x40')](handleError(_0x2b9adf,null));};exports[_0x9e34('0x41')]=function(_0x45ebe6,_0x53cc80){var _0x13318a={'raw':![],'where':{'id':_0x45ebe6[_0x9e34('0x42')]['id']}},_0x5d576e={};_0x5d576e[_0x9e34('0x2d')]=_['keys'](db['SugarcrmAccount']['rawAttributes']);_0x5d576e[_0x9e34('0x2e')]=_[_0x9e34('0x2f')](_0x45ebe6[_0x9e34('0x2e')]);_0x5d576e[_0x9e34('0x30')]=_[_0x9e34('0x31')](_0x5d576e[_0x9e34('0x2d')],_0x5d576e[_0x9e34('0x2e')]);_0x13318a['attributes']=_[_0x9e34('0x31')](_0x5d576e[_0x9e34('0x2d')],qs['fields'](_0x45ebe6['query'][_0x9e34('0x33')]));_0x13318a[_0x9e34('0x32')]=_0x13318a[_0x9e34('0x32')]['length']?_0x13318a[_0x9e34('0x32')]:_0x5d576e[_0x9e34('0x2d')];if(_0x45ebe6['query'][_0x9e34('0x3d')]){_0x13318a[_0x9e34('0x43')]=[{'all':!![]}];}_0x13318a=_[_0x9e34('0x3b')]({},_0x13318a,_0x45ebe6[_0x9e34('0x3c')]);return db['SugarcrmAccount'][_0x9e34('0x44')](_0x13318a)[_0x9e34('0x25')](handleEntityNotFound(_0x53cc80,null))['then'](respondWithResult(_0x53cc80,null))[_0x9e34('0x40')](handleError(_0x53cc80,null));};exports[_0x9e34('0x45')]=function(_0x3bf177,_0x243792){return db[_0x9e34('0x2a')][_0x9e34('0x45')](_0x3bf177['body'],{})[_0x9e34('0x25')](respondWithResult(_0x243792,0xc9))[_0x9e34('0x40')](handleError(_0x243792,null));};exports[_0x9e34('0x46')]=function(_0x35f012,_0x105cc9){if(_0x35f012[_0x9e34('0x47')]['id']){delete _0x35f012[_0x9e34('0x47')]['id'];}return db[_0x9e34('0x2a')][_0x9e34('0x44')]({'where':{'id':_0x35f012[_0x9e34('0x42')]['id']}})['then'](handleEntityNotFound(_0x105cc9,null))[_0x9e34('0x25')](saveUpdates(_0x35f012['body'],null))[_0x9e34('0x25')](respondWithResult(_0x105cc9,null))['catch'](handleError(_0x105cc9,null));};exports['destroy']=function(_0xc60d09,_0x5ed69b){return db['SugarcrmAccount']['find']({'where':{'id':_0xc60d09[_0x9e34('0x42')]['id']}})[_0x9e34('0x25')](handleEntityNotFound(_0x5ed69b,null))[_0x9e34('0x25')](removeEntity(_0x5ed69b,null))['catch'](handleError(_0x5ed69b,null));};exports[_0x9e34('0x48')]=function(_0x5e61e1,_0x293f57,_0x158152){var _0x1b5220={};var _0x47112e={};var _0x520115;var _0xe06678;return db[_0x9e34('0x2a')]['findOne']({'where':{'id':_0x5e61e1[_0x9e34('0x42')]['id']}})[_0x9e34('0x25')](handleEntityNotFound(_0x293f57,null))['then'](function(_0xfc5f8d){if(_0xfc5f8d){_0x520115=_0xfc5f8d;_0x47112e['model']=_['keys'](db[_0x9e34('0x49')][_0x9e34('0x2b')]);_0x47112e[_0x9e34('0x2e')]=_['keys'](_0x5e61e1[_0x9e34('0x2e')]);_0x47112e[_0x9e34('0x30')]=_[_0x9e34('0x31')](_0x47112e[_0x9e34('0x2d')],_0x47112e[_0x9e34('0x2e')]);_0x1b5220[_0x9e34('0x32')]=_['intersection'](_0x47112e['model'],qs[_0x9e34('0x33')](_0x5e61e1['query']['fields']));_0x1b5220[_0x9e34('0x32')]=_0x1b5220[_0x9e34('0x32')][_0x9e34('0x34')]?_0x1b5220[_0x9e34('0x32')]:_0x47112e[_0x9e34('0x2d')];_0x1b5220['order']=qs[_0x9e34('0x37')](_0x5e61e1[_0x9e34('0x2e')][_0x9e34('0x37')]);_0x1b5220[_0x9e34('0x39')]=qs[_0x9e34('0x30')](_[_0x9e34('0x4a')](_0x5e61e1[_0x9e34('0x2e')],_0x47112e[_0x9e34('0x30')]));if(_0x5e61e1[_0x9e34('0x2e')][_0x9e34('0x38')]){_0x1b5220[_0x9e34('0x39')]=_[_0x9e34('0x3b')](_0x1b5220['where'],{'$or':_[_0x9e34('0x29')](_0x1b5220[_0x9e34('0x32')],function(_0x275514){var _0x48843b={};_0x48843b[_0x275514]={'$like':'%'+_0x5e61e1[_0x9e34('0x2e')][_0x9e34('0x38')]+'%'};return _0x48843b;})});}_0x1b5220=_['merge']({},_0x1b5220,_0x5e61e1[_0x9e34('0x3c')]);return _0x520115[_0x9e34('0x48')](_0x1b5220);}})[_0x9e34('0x25')](function(_0x42ed51){if(_0x42ed51){_0xe06678=_0x42ed51[_0x9e34('0x34')];if(!_0x5e61e1[_0x9e34('0x2e')][_0x9e34('0x35')](_0x9e34('0x36'))){_0x1b5220[_0x9e34('0x1e')]=qs[_0x9e34('0x1e')](_0x5e61e1[_0x9e34('0x2e')][_0x9e34('0x1e')]);_0x1b5220[_0x9e34('0x1c')]=qs[_0x9e34('0x1c')](_0x5e61e1[_0x9e34('0x2e')][_0x9e34('0x1c')]);}return _0x520115['getConfigurations'](_0x1b5220);}})[_0x9e34('0x25')](function(_0x20be34){if(_0x20be34){return _0x20be34?{'count':_0xe06678,'rows':_0x20be34}:null;}})[_0x9e34('0x25')](respondWithResult(_0x293f57,null))[_0x9e34('0x40')](handleError(_0x293f57,null));};exports[_0x9e34('0x4b')]=function(_0x12582f,_0x1ac39b,_0x2b0a29){if(_0x12582f[_0x9e34('0x47')]['id']){delete _0x12582f[_0x9e34('0x47')]['id'];}return db[_0x9e34('0x2a')][_0x9e34('0x4c')]({'where':{'id':_0x12582f[_0x9e34('0x42')]['id']}})[_0x9e34('0x25')](handleEntityNotFound(_0x1ac39b,null))[_0x9e34('0x25')](function(_0x5cca66){if(_0x5cca66){_0x12582f[_0x9e34('0x47')][_0x9e34('0x4d')]=_0x5cca66['id'];_0x12582f[_0x9e34('0x47')]['Subjects']=integrations[_0x9e34('0x4e')](_0x12582f[_0x9e34('0x47')]['channel'],_0x12582f[_0x9e34('0x47')]['type']);_0x12582f['body'][_0x9e34('0x4f')]=integrations[_0x9e34('0x50')](_0x12582f[_0x9e34('0x47')][_0x9e34('0x51')],_0x12582f['body'][_0x9e34('0x3a')]);return db['SugarcrmConfiguration'][_0x9e34('0x45')](_0x12582f[_0x9e34('0x47')],{'include':[{'model':db[_0x9e34('0x52')],'as':'Subjects'},{'model':db[_0x9e34('0x52')],'as':_0x9e34('0x4f')}]});}return null;})[_0x9e34('0x25')](respondWithResult(_0x1ac39b,null))[_0x9e34('0x40')](handleError(_0x1ac39b,null));};exports[_0x9e34('0x53')]=function(_0x487093,_0x4e2732,_0x4d3d0e){var _0x5b93f4='';var _0x18e829=['id',_0x9e34('0x27'),_0x9e34('0x54'),_0x9e34('0x55'),_0x9e34('0x56'),_0x9e34('0x57'),_0x9e34('0x58'),_0x9e34('0x59'),_0x9e34('0x5a'),_0x9e34('0x5b'),_0x9e34('0x5c'),'direction'];return db[_0x9e34('0x2a')]['findOne']({'where':{'id':_0x487093[_0x9e34('0x42')]['id']},'attributes':['id',_0x9e34('0x5d'),_0x9e34('0x5e'),_0x9e34('0x5f')]})[_0x9e34('0x25')](handleEntityNotFound(_0x4e2732,null))[_0x9e34('0x25')](function(_0x63477a){if(_0x63477a){_0x5b93f4=_0x63477a[_0x9e34('0x5f')];var _0x47942f=_0x5b93f4[_0x9e34('0x60')](-0x1);if(_0x47942f==='/'){_0x5b93f4=_0x5b93f4['substring'](0x0,_0x5b93f4[_0x9e34('0x61')](_0x47942f));}return rp({'method':_0x9e34('0x62'),'uri':util[_0x9e34('0x63')](_0x9e34('0x64'),_0x5b93f4,_0x9e34('0x65')),'json':!![],'form':{'method':_0x9e34('0x66'),'input_type':_0x9e34('0x67'),'response_type':'JSON','rest_data':JSON[_0x9e34('0x68')]({'user_auth':{'user_name':_0x63477a['username'],'password':_0x63477a[_0x9e34('0x5e')],'encryption':_0x9e34('0x69')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x9e34('0x25')](function(_0x398385){if(_0x398385&&_0x398385[_0x9e34('0x27')]!==_0x9e34('0x6a')&&_0x398385[_0x9e34('0x27')]!==_0x9e34('0x6b')){return rp({'method':_0x9e34('0x62'),'uri':util[_0x9e34('0x63')]('%s%s',_0x5b93f4,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0x9e34('0x67'),'response_type':_0x9e34('0x67'),'rest_data':JSON['stringify']({'session':_0x398385['id'],'module_name':'Calls'})}})[_0x9e34('0x25')](function(_0x1304cb){if(_0x1304cb){var _0x1637d6=_[_0x9e34('0x6c')](_0x1304cb[_0x9e34('0x6d')]);_[_0x9e34('0x6e')](_0x1637d6,function(_0xd59d9c){return _0x18e829[_0x9e34('0x6f')](_0xd59d9c['name']);});return{'count':_0x1637d6[_0x9e34('0x34')],'rows':_[_0x9e34('0x29')](_0x1637d6,function(_0x852a5f){return{'id':_0x852a5f[_0x9e34('0x27')],'name':_0x852a5f[_0x9e34('0x70')],'custom':_[_0x9e34('0x71')](_0x852a5f[_0x9e34('0x27')],'_c')?!![]:![],'options':_0x852a5f['options']?_[_0x9e34('0x29')](_[_0x9e34('0x6c')](_0x852a5f['options']),function(_0x445d5a){return{'name':_0x445d5a[_0x9e34('0x72')],'value':_0x445d5a[_0x9e34('0x27')]};}):[]};})};}})['then'](respondWithResult(_0x4e2732,null))[_0x9e34('0x40')](function(_0x3ac154){var _0x7c1ced=_0x487093['query']['test']?0x1f4:_0x3ac154[_0x9e34('0x73')]||0x1f4;logger[_0x9e34('0x74')]('getFields,\x20%s,\x20%s,\x20%s',_0x9e34('0x53'),_0x7c1ced,JSON[_0x9e34('0x68')](_0x3ac154));delete _0x3ac154[_0x9e34('0x27')];if(_0x7c1ced===0x191){_0x7c1ced=0x190;}_0x4e2732[_0x9e34('0x19')](_0x7c1ced)[_0x9e34('0x28')](_0x487093[_0x9e34('0x2e')][_0x9e34('0x75')]?{'message':_0x9e34('0x76'),'statusCode':_0x3ac154[_0x9e34('0x73')]}:_0x3ac154);});}else{var _0x17ce0b=0x1f4;_0x4e2732[_0x9e34('0x19')](_0x17ce0b)[_0x9e34('0x28')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x8669=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','stack','name','index','map','SugarcrmAccount','rawAttributes','type','key','model','attributes','intersection','fields','query','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','pick','addConfiguration','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','created_by','description','duration_minutes','parent_id','parent_type','parent_name','direction','remoteUri','slice','substring','POST','format','%s%s','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','/service/v4_1/rest.php','get_module_fields','Calls','module_fields','remove','includes','label','endsWith','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','send','eml-format','rimraf','zip-dir','fast-json-patch','moment','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'];(function(_0x5f380e,_0xac6fe9){var _0x180742=function(_0x28ca47){while(--_0x28ca47){_0x5f380e['push'](_0x5f380e['shift']());}};_0x180742(++_0xac6fe9);}(_0x8669,0xdc));var _0x9866=function(_0x37dde0,_0x3905ed){_0x37dde0=_0x37dde0-0x0;var _0x3988d9=_0x8669[_0x37dde0];return _0x3988d9;};'use strict';var emlformat=require(_0x9866('0x0'));var rimraf=require(_0x9866('0x1'));var zipdir=require(_0x9866('0x2'));var jsonpatch=require(_0x9866('0x3'));var rp=require('request-promise');var moment=require(_0x9866('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9866('0x5'));var util=require('util');var path=require(_0x9866('0x6'));var sox=require(_0x9866('0x7'));var csv=require(_0x9866('0x8'));var ejs=require(_0x9866('0x9'));var fs=require('fs');var fs_extra=require(_0x9866('0xa'));var _=require(_0x9866('0xb'));var squel=require(_0x9866('0xc'));var crypto=require(_0x9866('0xd'));var jsforce=require(_0x9866('0xe'));var deskjs=require(_0x9866('0xf'));var toCsv=require(_0x9866('0x8'));var querystring=require(_0x9866('0x10'));var Papa=require(_0x9866('0x11'));var Redis=require(_0x9866('0x12'));var authService=require(_0x9866('0x13'));var qs=require(_0x9866('0x14'));var as=require(_0x9866('0x15'));var hardwareService=require(_0x9866('0x16'));var logger=require('../../config/logger')(_0x9866('0x17'));var utils=require(_0x9866('0x18'));var config=require(_0x9866('0x19'));var licenseUtil=require(_0x9866('0x1a'));var db=require(_0x9866('0x1b'))['db'];var integrations=require(_0x9866('0x1c'));function respondWithStatusCode(_0x46032b,_0x285df0){_0x285df0=_0x285df0||0xcc;return function(_0x2a7395){if(_0x2a7395){return _0x46032b[_0x9866('0x1d')](_0x285df0);}return _0x46032b[_0x9866('0x1e')](_0x285df0)[_0x9866('0x1f')]();};}function respondWithResult(_0x37f052,_0xbe02c0){_0xbe02c0=_0xbe02c0||0xc8;return function(_0xe3abfe){if(_0xe3abfe){return _0x37f052[_0x9866('0x1e')](_0xbe02c0)[_0x9866('0x20')](_0xe3abfe);}};}function respondWithFilteredResult(_0x479360,_0x4a82d8){return function(_0x367224){if(_0x367224){var _0xc5db97=typeof _0x4a82d8[_0x9866('0x21')]===_0x9866('0x22')&&typeof _0x4a82d8[_0x9866('0x23')]===_0x9866('0x22');var _0x3eefbd=_0x367224[_0x9866('0x24')];var _0x5b8444=_0xc5db97?0x0:_0x4a82d8[_0x9866('0x21')];var _0x597061=_0xc5db97?_0x367224[_0x9866('0x24')]:_0x4a82d8[_0x9866('0x21')]+_0x4a82d8[_0x9866('0x23')];var _0x29610b;if(_0x597061>=_0x3eefbd){_0x597061=_0x3eefbd;_0x29610b=0xc8;}else{_0x29610b=0xce;}_0x479360['status'](_0x29610b);return _0x479360['set']('Content-Range',_0x5b8444+'-'+_0x597061+'/'+_0x3eefbd)[_0x9866('0x20')](_0x367224);}return null;};}function patchUpdates(_0x1ecb8c){return function(_0x57965e){try{jsonpatch[_0x9866('0x25')](_0x57965e,_0x1ecb8c,!![]);}catch(_0x50bd86){return BPromise[_0x9866('0x26')](_0x50bd86);}return _0x57965e[_0x9866('0x27')]();};}function saveUpdates(_0x19a5d8,_0x5c64b5){return function(_0x3f79ca){if(_0x3f79ca){return _0x3f79ca[_0x9866('0x28')](_0x19a5d8)['then'](function(_0x2b0c90){return _0x2b0c90;});}return null;};}function removeEntity(_0x356992,_0x4dc627){return function(_0x4341da){if(_0x4341da){return _0x4341da[_0x9866('0x29')]()[_0x9866('0x2a')](function(){_0x356992['status'](0xcc)[_0x9866('0x1f')]();});}};}function handleEntityNotFound(_0x1004f1,_0x20a7ce){return function(_0x5f467d){if(!_0x5f467d){_0x1004f1[_0x9866('0x1d')](0x194);}return _0x5f467d;};}function handleError(_0x3f2ea6,_0x40d24e){_0x40d24e=_0x40d24e||0x1f4;return function(_0x5e0c10){logger['error'](_0x5e0c10[_0x9866('0x2b')]);if(_0x5e0c10[_0x9866('0x2c')]){delete _0x5e0c10['name'];}_0x3f2ea6['status'](_0x40d24e)['send'](_0x5e0c10);};}exports[_0x9866('0x2d')]=function(_0x54f0a5,_0x27106f){var _0x2dbaae={},_0x4ae3c1={},_0x3859d9={'count':0x0,'rows':[]};var _0x248dd2=_[_0x9866('0x2e')](db[_0x9866('0x2f')][_0x9866('0x30')],function(_0xe3d3d9){return{'name':_0xe3d3d9['fieldName'],'type':_0xe3d3d9[_0x9866('0x31')][_0x9866('0x32')]};});_0x4ae3c1[_0x9866('0x33')]=_[_0x9866('0x2e')](_0x248dd2,_0x9866('0x2c'));_0x4ae3c1['query']=_['keys'](_0x54f0a5['query']);_0x4ae3c1['filters']=_['intersection'](_0x4ae3c1['model'],_0x4ae3c1['query']);_0x2dbaae[_0x9866('0x34')]=_[_0x9866('0x35')](_0x4ae3c1[_0x9866('0x33')],qs[_0x9866('0x36')](_0x54f0a5[_0x9866('0x37')]['fields']));_0x2dbaae[_0x9866('0x34')]=_0x2dbaae[_0x9866('0x34')]['length']?_0x2dbaae[_0x9866('0x34')]:_0x4ae3c1[_0x9866('0x33')];if(!_0x54f0a5[_0x9866('0x37')][_0x9866('0x38')](_0x9866('0x39'))){_0x2dbaae[_0x9866('0x23')]=qs['limit'](_0x54f0a5[_0x9866('0x37')]['limit']);_0x2dbaae[_0x9866('0x21')]=qs[_0x9866('0x21')](_0x54f0a5['query'][_0x9866('0x21')]);}_0x2dbaae[_0x9866('0x3a')]=qs[_0x9866('0x3b')](_0x54f0a5[_0x9866('0x37')][_0x9866('0x3b')]);_0x2dbaae[_0x9866('0x3c')]=qs['filters'](_['pick'](_0x54f0a5['query'],_0x4ae3c1[_0x9866('0x3d')]),_0x248dd2);if(_0x54f0a5['query']['filter']){_0x2dbaae[_0x9866('0x3c')]=_[_0x9866('0x3e')](_0x2dbaae[_0x9866('0x3c')],{'$or':_[_0x9866('0x2e')](_0x248dd2,function(_0x1def9d){if(_0x1def9d[_0x9866('0x31')]!==_0x9866('0x3f')){var _0x8f07c2={};_0x8f07c2[_0x1def9d[_0x9866('0x2c')]]={'$like':'%'+_0x54f0a5[_0x9866('0x37')][_0x9866('0x40')]+'%'};return _0x8f07c2;}})});}_0x2dbaae=_[_0x9866('0x3e')]({},_0x2dbaae,_0x54f0a5[_0x9866('0x41')]);var _0x203d25={'where':_0x2dbaae[_0x9866('0x3c')]};return db[_0x9866('0x2f')][_0x9866('0x24')](_0x203d25)[_0x9866('0x2a')](function(_0x512b35){_0x3859d9[_0x9866('0x24')]=_0x512b35;if(_0x54f0a5[_0x9866('0x37')][_0x9866('0x42')]){_0x2dbaae[_0x9866('0x43')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x9866('0x44')](_0x2dbaae);})[_0x9866('0x2a')](function(_0x4d28d0){_0x3859d9[_0x9866('0x45')]=_0x4d28d0;return _0x3859d9;})['then'](respondWithFilteredResult(_0x27106f,_0x2dbaae))[_0x9866('0x46')](handleError(_0x27106f,null));};exports[_0x9866('0x47')]=function(_0x25722d,_0x4d432b){var _0x1fe3a8={'raw':![],'where':{'id':_0x25722d[_0x9866('0x48')]['id']}},_0x3e7c67={};_0x3e7c67[_0x9866('0x33')]=_[_0x9866('0x49')](db[_0x9866('0x2f')]['rawAttributes']);_0x3e7c67[_0x9866('0x37')]=_['keys'](_0x25722d[_0x9866('0x37')]);_0x3e7c67['filters']=_['intersection'](_0x3e7c67[_0x9866('0x33')],_0x3e7c67['query']);_0x1fe3a8[_0x9866('0x34')]=_[_0x9866('0x35')](_0x3e7c67['model'],qs[_0x9866('0x36')](_0x25722d['query'][_0x9866('0x36')]));_0x1fe3a8[_0x9866('0x34')]=_0x1fe3a8[_0x9866('0x34')][_0x9866('0x4a')]?_0x1fe3a8[_0x9866('0x34')]:_0x3e7c67[_0x9866('0x33')];if(_0x25722d['query'][_0x9866('0x42')]){_0x1fe3a8[_0x9866('0x43')]=[{'all':!![]}];}_0x1fe3a8=_['merge']({},_0x1fe3a8,_0x25722d['options']);return db['SugarcrmAccount']['find'](_0x1fe3a8)[_0x9866('0x2a')](handleEntityNotFound(_0x4d432b,null))[_0x9866('0x2a')](respondWithResult(_0x4d432b,null))[_0x9866('0x46')](handleError(_0x4d432b,null));};exports[_0x9866('0x4b')]=function(_0x37f1e3,_0xa12751){return db[_0x9866('0x2f')][_0x9866('0x4b')](_0x37f1e3[_0x9866('0x4c')],{})[_0x9866('0x2a')](respondWithResult(_0xa12751,0xc9))[_0x9866('0x46')](handleError(_0xa12751,null));};exports[_0x9866('0x28')]=function(_0x5af074,_0x51cbce){if(_0x5af074[_0x9866('0x4c')]['id']){delete _0x5af074[_0x9866('0x4c')]['id'];}return db[_0x9866('0x2f')][_0x9866('0x4d')]({'where':{'id':_0x5af074[_0x9866('0x48')]['id']}})[_0x9866('0x2a')](handleEntityNotFound(_0x51cbce,null))[_0x9866('0x2a')](saveUpdates(_0x5af074[_0x9866('0x4c')],null))[_0x9866('0x2a')](respondWithResult(_0x51cbce,null))[_0x9866('0x46')](handleError(_0x51cbce,null));};exports[_0x9866('0x29')]=function(_0x5e4678,_0x3dd467){return db[_0x9866('0x2f')][_0x9866('0x4d')]({'where':{'id':_0x5e4678[_0x9866('0x48')]['id']}})[_0x9866('0x2a')](handleEntityNotFound(_0x3dd467,null))['then'](removeEntity(_0x3dd467,null))[_0x9866('0x46')](handleError(_0x3dd467,null));};exports[_0x9866('0x4e')]=function(_0x106ed5,_0x48c167,_0x23f641){var _0x592da3={};var _0x35a27b={};var _0x3779e3;var _0x5b4bb7;return db[_0x9866('0x2f')][_0x9866('0x4f')]({'where':{'id':_0x106ed5['params']['id']}})[_0x9866('0x2a')](handleEntityNotFound(_0x48c167,null))[_0x9866('0x2a')](function(_0x558bcd){if(_0x558bcd){_0x3779e3=_0x558bcd;_0x35a27b[_0x9866('0x33')]=_['keys'](db[_0x9866('0x50')][_0x9866('0x30')]);_0x35a27b['query']=_['keys'](_0x106ed5[_0x9866('0x37')]);_0x35a27b[_0x9866('0x3d')]=_[_0x9866('0x35')](_0x35a27b[_0x9866('0x33')],_0x35a27b[_0x9866('0x37')]);_0x592da3[_0x9866('0x34')]=_[_0x9866('0x35')](_0x35a27b[_0x9866('0x33')],qs[_0x9866('0x36')](_0x106ed5[_0x9866('0x37')][_0x9866('0x36')]));_0x592da3[_0x9866('0x34')]=_0x592da3['attributes'][_0x9866('0x4a')]?_0x592da3['attributes']:_0x35a27b[_0x9866('0x33')];_0x592da3[_0x9866('0x3a')]=qs[_0x9866('0x3b')](_0x106ed5[_0x9866('0x37')]['sort']);_0x592da3[_0x9866('0x3c')]=qs[_0x9866('0x3d')](_[_0x9866('0x51')](_0x106ed5[_0x9866('0x37')],_0x35a27b['filters']));if(_0x106ed5[_0x9866('0x37')][_0x9866('0x40')]){_0x592da3['where']=_[_0x9866('0x3e')](_0x592da3[_0x9866('0x3c')],{'$or':_[_0x9866('0x2e')](_0x592da3[_0x9866('0x34')],function(_0x55a791){var _0x418493={};_0x418493[_0x55a791]={'$like':'%'+_0x106ed5['query'][_0x9866('0x40')]+'%'};return _0x418493;})});}_0x592da3=_[_0x9866('0x3e')]({},_0x592da3,_0x106ed5[_0x9866('0x41')]);return _0x3779e3[_0x9866('0x4e')](_0x592da3);}})[_0x9866('0x2a')](function(_0x3c6c1b){if(_0x3c6c1b){_0x5b4bb7=_0x3c6c1b['length'];if(!_0x106ed5[_0x9866('0x37')][_0x9866('0x38')](_0x9866('0x39'))){_0x592da3[_0x9866('0x23')]=qs['limit'](_0x106ed5[_0x9866('0x37')][_0x9866('0x23')]);_0x592da3[_0x9866('0x21')]=qs[_0x9866('0x21')](_0x106ed5[_0x9866('0x37')][_0x9866('0x21')]);}return _0x3779e3['getConfigurations'](_0x592da3);}})['then'](function(_0x5abb87){if(_0x5abb87){return _0x5abb87?{'count':_0x5b4bb7,'rows':_0x5abb87}:null;}})[_0x9866('0x2a')](respondWithResult(_0x48c167,null))[_0x9866('0x46')](handleError(_0x48c167,null));};exports[_0x9866('0x52')]=function(_0x985e0f,_0x213cd1,_0x3a4ba8){if(_0x985e0f[_0x9866('0x4c')]['id']){delete _0x985e0f[_0x9866('0x4c')]['id'];}return db['SugarcrmAccount'][_0x9866('0x4f')]({'where':{'id':_0x985e0f[_0x9866('0x48')]['id']}})[_0x9866('0x2a')](handleEntityNotFound(_0x213cd1,null))['then'](function(_0x257bab){if(_0x257bab){_0x985e0f[_0x9866('0x4c')]['AccountId']=_0x257bab['id'];_0x985e0f[_0x9866('0x4c')]['Subjects']=integrations['getSubjects'](_0x985e0f[_0x9866('0x4c')][_0x9866('0x53')],_0x985e0f[_0x9866('0x4c')][_0x9866('0x31')]);_0x985e0f['body'][_0x9866('0x54')]=integrations[_0x9866('0x55')](_0x985e0f[_0x9866('0x4c')][_0x9866('0x53')],_0x985e0f[_0x9866('0x4c')][_0x9866('0x31')]);return db[_0x9866('0x50')][_0x9866('0x4b')](_0x985e0f[_0x9866('0x4c')],{'include':[{'model':db[_0x9866('0x56')],'as':_0x9866('0x57')},{'model':db[_0x9866('0x56')],'as':_0x9866('0x54')}]});}return null;})[_0x9866('0x2a')](respondWithResult(_0x213cd1,null))[_0x9866('0x46')](handleError(_0x213cd1,null));};exports['getFields']=function(_0x11ea97,_0x2b2e81,_0x4de587){var _0x59cf77='';var _0x182ac4=['id',_0x9866('0x2c'),'assigned_user_id',_0x9866('0x58'),_0x9866('0x59'),'date_start','duration_hours',_0x9866('0x5a'),_0x9866('0x5b'),_0x9866('0x5c'),_0x9866('0x5d'),_0x9866('0x5e')];return db[_0x9866('0x2f')]['findOne']({'where':{'id':_0x11ea97[_0x9866('0x48')]['id']},'attributes':['id','username','password',_0x9866('0x5f')]})['then'](handleEntityNotFound(_0x2b2e81,null))['then'](function(_0x39c624){if(_0x39c624){_0x59cf77=_0x39c624[_0x9866('0x5f')];var _0x3c6111=_0x59cf77[_0x9866('0x60')](-0x1);if(_0x3c6111==='/'){_0x59cf77=_0x59cf77[_0x9866('0x61')](0x0,_0x59cf77['lastIndexOf'](_0x3c6111));}return rp({'method':_0x9866('0x62'),'uri':util[_0x9866('0x63')](_0x9866('0x64'),_0x59cf77,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x9866('0x65'),'response_type':_0x9866('0x65'),'rest_data':JSON[_0x9866('0x66')]({'user_auth':{'user_name':_0x39c624['username'],'password':_0x39c624['password'],'encryption':'PLAIN'},'application':_0x9866('0x67')})}});}})[_0x9866('0x2a')](function(_0x5d5b9f){if(_0x5d5b9f&&_0x5d5b9f['name']!==_0x9866('0x68')&&_0x5d5b9f[_0x9866('0x2c')]!=='Password\x20Expired'){return rp({'method':_0x9866('0x62'),'uri':util[_0x9866('0x63')](_0x9866('0x64'),_0x59cf77,_0x9866('0x69')),'json':!![],'form':{'method':_0x9866('0x6a'),'input_type':_0x9866('0x65'),'response_type':_0x9866('0x65'),'rest_data':JSON[_0x9866('0x66')]({'session':_0x5d5b9f['id'],'module_name':_0x9866('0x6b')})}})[_0x9866('0x2a')](function(_0x2d80c5){if(_0x2d80c5){var _0x54095e=_['values'](_0x2d80c5[_0x9866('0x6c')]);_[_0x9866('0x6d')](_0x54095e,function(_0x3161e7){return _0x182ac4[_0x9866('0x6e')](_0x3161e7[_0x9866('0x2c')]);});return{'count':_0x54095e[_0x9866('0x4a')],'rows':_[_0x9866('0x2e')](_0x54095e,function(_0x2eba70){return{'id':_0x2eba70[_0x9866('0x2c')],'name':_0x2eba70[_0x9866('0x6f')],'custom':_[_0x9866('0x70')](_0x2eba70[_0x9866('0x2c')],'_c')?!![]:![],'options':_0x2eba70[_0x9866('0x41')]?_[_0x9866('0x2e')](_['values'](_0x2eba70[_0x9866('0x41')]),function(_0x38a720){return{'name':_0x38a720[_0x9866('0x71')],'value':_0x38a720[_0x9866('0x2c')]};}):[]};})};}})['then'](respondWithResult(_0x2b2e81,null))[_0x9866('0x46')](function(_0x5bff75){var _0x464948=_0x11ea97[_0x9866('0x37')][_0x9866('0x72')]?0x1f4:_0x5bff75[_0x9866('0x73')]||0x1f4;logger[_0x9866('0x74')](_0x9866('0x75'),_0x9866('0x76'),_0x464948,JSON['stringify'](_0x5bff75));delete _0x5bff75[_0x9866('0x2c')];if(_0x464948===0x191){_0x464948=0x190;}_0x2b2e81[_0x9866('0x1e')](_0x464948)['send'](_0x11ea97[_0x9866('0x37')][_0x9866('0x72')]?{'message':_0x9866('0x77'),'statusCode':_0x5bff75[_0x9866('0x73')]}:_0x5bff75);});}else{var _0x48e757=0x1f4;_0x2b2e81[_0x9866('0x1e')](_0x48e757)[_0x9866('0x78')]({'message':_0x9866('0x77'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 4a54d25..a6b9ffc 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 _0x2ea1=['../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x314079,_0x2b98a0){var _0x423351=function(_0x501dcc){while(--_0x501dcc){_0x314079['push'](_0x314079['shift']());}};_0x423351(++_0x2b98a0);}(_0x2ea1,0xca));var _0x12ea=function(_0x149bb2,_0x5510a1){_0x149bb2=_0x149bb2-0x0;var _0x4700a2=_0x2ea1[_0x149bb2];return _0x4700a2;};'use strict';var _=require(_0x12ea('0x0'));var util=require(_0x12ea('0x1'));var logger=require(_0x12ea('0x2'))(_0x12ea('0x3'));var moment=require(_0x12ea('0x4'));var BPromise=require(_0x12ea('0x5'));var rp=require(_0x12ea('0x6'));var fs=require('fs');var path=require(_0x12ea('0x7'));var rimraf=require('rimraf');var config=require(_0x12ea('0x8'));var attributes=require(_0x12ea('0x9'));var integrations=require(_0x12ea('0xa'));module['exports']=function(_0x132217,_0x242d90){return _0x132217[_0x12ea('0xb')](_0x12ea('0xc'),attributes,{'tableName':_0x12ea('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0ba=['moment','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api'];(function(_0xa04212,_0x10d7ec){var _0x3a2837=function(_0x1e2812){while(--_0x1e2812){_0xa04212['push'](_0xa04212['shift']());}};_0x3a2837(++_0x10d7ec);}(_0xf0ba,0x7a));var _0xaf0b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf0ba[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaf0b('0x0'));var util=require(_0xaf0b('0x1'));var logger=require(_0xaf0b('0x2'))(_0xaf0b('0x3'));var moment=require(_0xaf0b('0x4'));var BPromise=require('bluebird');var rp=require(_0xaf0b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf0b('0x6'));var config=require(_0xaf0b('0x7'));var attributes=require(_0xaf0b('0x8'));var integrations=require(_0xaf0b('0x9'));module[_0xaf0b('0xa')]=function(_0x2fb7b7,_0x284ed6){return _0x2fb7b7[_0xaf0b('0xb')](_0xaf0b('0xc'),attributes,{'tableName':_0xaf0b('0xd'),'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 cb1f1a6..00c60fc 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 _0x0a28=['error','code','message','result','SugarcrmAccount','findAll','options','where','attributes','limit','model','include','map','GetSugarcrmAccount','ShowSugarcrmAccount','find','raw','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0a28,0x122));var _0x80a2=function(_0x67c4,_0x1d47fe){_0x67c4=_0x67c4-0x0;var _0x1ffd99=_0x0a28[_0x67c4];return _0x1ffd99;};'use strict';var _=require(_0x80a2('0x0'));var util=require('util');var moment=require(_0x80a2('0x1'));var BPromise=require(_0x80a2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x80a2('0x3'));var db=require(_0x80a2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x80a2('0x5'))(_0x80a2('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x80a2('0x7')][_0x80a2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x61ad65,_0x526183,_0x349b79){return new BPromise(function(_0x40af92,_0x539aba){return client[_0x80a2('0x9')](_0x61ad65,_0x349b79)[_0x80a2('0xa')](function(_0x18855b){logger[_0x80a2('0xb')](_0x80a2('0xc'),_0x526183,_0x80a2('0xd'));logger[_0x80a2('0xe')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x526183,_0x80a2('0xd'),JSON[_0x80a2('0xf')](_0x18855b));if(_0x18855b[_0x80a2('0x10')]){if(_0x18855b[_0x80a2('0x10')][_0x80a2('0x11')]===0x1f4){logger[_0x80a2('0x10')](_0x80a2('0xc'),_0x526183,_0x18855b[_0x80a2('0x10')][_0x80a2('0x12')]);return _0x539aba(_0x18855b[_0x80a2('0x10')][_0x80a2('0x12')]);}logger[_0x80a2('0x10')](_0x80a2('0xc'),_0x526183,_0x18855b[_0x80a2('0x10')][_0x80a2('0x12')]);return _0x40af92(_0x18855b[_0x80a2('0x10')][_0x80a2('0x12')]);}else{logger[_0x80a2('0xb')](_0x80a2('0xc'),_0x526183,'request\x20sent');_0x40af92(_0x18855b[_0x80a2('0x13')][_0x80a2('0x12')]);}})['catch'](function(_0x57999d){logger[_0x80a2('0x10')](_0x80a2('0xc'),_0x526183,_0x57999d);_0x539aba(_0x57999d);});});}exports['GetSugarcrmAccount']=function(_0x10c8f4){var _0x2916bd=this;return new Promise(function(_0x467f33,_0x502e47){return db[_0x80a2('0x14')][_0x80a2('0x15')]({'raw':_0x10c8f4['options']?_0x10c8f4['options']['raw']===undefined?!![]:![]:!![],'where':_0x10c8f4[_0x80a2('0x16')]?_0x10c8f4[_0x80a2('0x16')][_0x80a2('0x17')]||null:null,'attributes':_0x10c8f4['options']?_0x10c8f4[_0x80a2('0x16')][_0x80a2('0x18')]||null:null,'limit':_0x10c8f4[_0x80a2('0x16')]?_0x10c8f4[_0x80a2('0x16')][_0x80a2('0x19')]||null:null,'include':_0x10c8f4[_0x80a2('0x16')]?_0x10c8f4[_0x80a2('0x16')]['include']?_['map'](_0x10c8f4[_0x80a2('0x16')]['include'],function(_0x2e1004){return{'model':db[_0x2e1004[_0x80a2('0x1a')]],'as':_0x2e1004['as'],'attributes':_0x2e1004[_0x80a2('0x18')],'include':_0x2e1004[_0x80a2('0x1b')]?_[_0x80a2('0x1c')](_0x2e1004[_0x80a2('0x1b')],function(_0x5cc297){return{'model':db[_0x5cc297['model']],'as':_0x5cc297['as'],'attributes':_0x5cc297[_0x80a2('0x18')],'include':_0x5cc297['include']?_[_0x80a2('0x1c')](_0x5cc297[_0x80a2('0x1b')],function(_0x3656bc){return{'model':db[_0x3656bc[_0x80a2('0x1a')]],'as':_0x3656bc['as'],'attributes':_0x3656bc['attributes']};}):[]};}):[]};}):[]:[]})[_0x80a2('0xa')](function(_0x2fb909){logger[_0x80a2('0xb')](_0x80a2('0x1d'),_0x10c8f4);logger['debug'](_0x80a2('0x1d'),_0x10c8f4,JSON[_0x80a2('0xf')](_0x2fb909));_0x467f33(_0x2fb909);})['catch'](function(_0x533ddf){logger['error']('GetSugarcrmAccount',_0x533ddf['message'],_0x10c8f4);_0x502e47(_0x2916bd[_0x80a2('0x10')](0x1f4,_0x533ddf[_0x80a2('0x12')]));});});};exports[_0x80a2('0x1e')]=function(_0x2cf97f){var _0xbd651d=this;return new Promise(function(_0x222e40,_0x2d7029){return db[_0x80a2('0x14')][_0x80a2('0x1f')]({'raw':_0x2cf97f[_0x80a2('0x16')]?_0x2cf97f[_0x80a2('0x16')][_0x80a2('0x20')]===undefined?!![]:![]:!![],'where':_0x2cf97f[_0x80a2('0x16')]?_0x2cf97f['options']['where']||null:null,'attributes':_0x2cf97f[_0x80a2('0x16')]?_0x2cf97f[_0x80a2('0x16')][_0x80a2('0x18')]||null:null,'include':_0x2cf97f['options']?_0x2cf97f['options']['include']?_[_0x80a2('0x1c')](_0x2cf97f[_0x80a2('0x16')][_0x80a2('0x1b')],function(_0x47dc37){return{'model':db[_0x47dc37[_0x80a2('0x1a')]],'as':_0x47dc37['as'],'attributes':_0x47dc37[_0x80a2('0x18')],'include':_0x47dc37['include']?_['map'](_0x47dc37[_0x80a2('0x1b')],function(_0x8a6d71){return{'model':db[_0x8a6d71[_0x80a2('0x1a')]],'as':_0x8a6d71['as'],'attributes':_0x8a6d71['attributes'],'include':_0x8a6d71[_0x80a2('0x1b')]?_[_0x80a2('0x1c')](_0x8a6d71[_0x80a2('0x1b')],function(_0x5cecb8){return{'model':db[_0x5cecb8['model']],'as':_0x5cecb8['as'],'attributes':_0x5cecb8[_0x80a2('0x18')]};}):[]};}):[]};}):[]:[]})[_0x80a2('0xa')](function(_0x169db4){logger[_0x80a2('0xb')]('ShowSugarcrmAccount',_0x2cf97f);logger[_0x80a2('0xe')](_0x80a2('0x1e'),_0x2cf97f,JSON[_0x80a2('0xf')](_0x169db4));_0x222e40(_0x169db4);})[_0x80a2('0x21')](function(_0x30ac96){logger['error']('ShowSugarcrmAccount',_0x30ac96['message'],_0x2cf97f);_0x2d7029(_0xbd651d[_0x80a2('0x10')](0x1f4,_0x30ac96[_0x80a2('0x12')]));});});}; \ No newline at end of file +var _0x173b=['find','raw','catch','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSugarcrmAccount','findAll','options','attributes','include','model','map','ShowSugarcrmAccount','SugarcrmAccount'];(function(_0x4d5721,_0x51a33d){var _0x88a224=function(_0x2b2609){while(--_0x2b2609){_0x4d5721['push'](_0x4d5721['shift']());}};_0x88a224(++_0x51a33d);}(_0x173b,0x12c));var _0xb173=function(_0x3bcf38,_0x290cc0){_0x3bcf38=_0x3bcf38-0x0;var _0x49d42e=_0x173b[_0x3bcf38];return _0x49d42e;};'use strict';var _=require('lodash');var util=require(_0xb173('0x0'));var moment=require(_0xb173('0x1'));var BPromise=require('bluebird');var rs=require(_0xb173('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb173('0x3'))['db'];var utils=require(_0xb173('0x4'));var logger=require('../../config/logger')(_0xb173('0x5'));var config=require(_0xb173('0x6'));var jayson=require(_0xb173('0x7'));var client=jayson[_0xb173('0x8')][_0xb173('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a4d86,_0x2c879d,_0xc8bef4){return new BPromise(function(_0x2d2331,_0x8f7333){return client['request'](_0x1a4d86,_0xc8bef4)[_0xb173('0xa')](function(_0x75b026){logger[_0xb173('0xb')](_0xb173('0xc'),_0x2c879d,_0xb173('0xd'));logger[_0xb173('0xe')](_0xb173('0xf'),_0x2c879d,'request\x20sent',JSON[_0xb173('0x10')](_0x75b026));if(_0x75b026[_0xb173('0x11')]){if(_0x75b026[_0xb173('0x11')][_0xb173('0x12')]===0x1f4){logger[_0xb173('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x2c879d,_0x75b026[_0xb173('0x11')][_0xb173('0x13')]);return _0x8f7333(_0x75b026['error'][_0xb173('0x13')]);}logger[_0xb173('0x11')](_0xb173('0xc'),_0x2c879d,_0x75b026['error'][_0xb173('0x13')]);return _0x2d2331(_0x75b026[_0xb173('0x11')][_0xb173('0x13')]);}else{logger['info'](_0xb173('0xc'),_0x2c879d,_0xb173('0xd'));_0x2d2331(_0x75b026[_0xb173('0x14')][_0xb173('0x13')]);}})['catch'](function(_0x2c16ec){logger['error'](_0xb173('0xc'),_0x2c879d,_0x2c16ec);_0x8f7333(_0x2c16ec);});});}exports[_0xb173('0x15')]=function(_0x140f2b){var _0x554ab8=this;return new Promise(function(_0xf422e0,_0x900a69){return db['SugarcrmAccount'][_0xb173('0x16')]({'raw':_0x140f2b[_0xb173('0x17')]?_0x140f2b[_0xb173('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x140f2b['options']?_0x140f2b[_0xb173('0x17')]['where']||null:null,'attributes':_0x140f2b[_0xb173('0x17')]?_0x140f2b['options'][_0xb173('0x18')]||null:null,'limit':_0x140f2b[_0xb173('0x17')]?_0x140f2b[_0xb173('0x17')]['limit']||null:null,'include':_0x140f2b[_0xb173('0x17')]?_0x140f2b['options'][_0xb173('0x19')]?_['map'](_0x140f2b[_0xb173('0x17')][_0xb173('0x19')],function(_0x52ceec){return{'model':db[_0x52ceec[_0xb173('0x1a')]],'as':_0x52ceec['as'],'attributes':_0x52ceec[_0xb173('0x18')],'include':_0x52ceec['include']?_['map'](_0x52ceec[_0xb173('0x19')],function(_0x19b864){return{'model':db[_0x19b864[_0xb173('0x1a')]],'as':_0x19b864['as'],'attributes':_0x19b864[_0xb173('0x18')],'include':_0x19b864[_0xb173('0x19')]?_[_0xb173('0x1b')](_0x19b864[_0xb173('0x19')],function(_0x23ef94){return{'model':db[_0x23ef94[_0xb173('0x1a')]],'as':_0x23ef94['as'],'attributes':_0x23ef94[_0xb173('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a10b1){logger[_0xb173('0xb')]('GetSugarcrmAccount',_0x140f2b);logger[_0xb173('0xe')](_0xb173('0x15'),_0x140f2b,JSON[_0xb173('0x10')](_0x3a10b1));_0xf422e0(_0x3a10b1);})['catch'](function(_0x165565){logger[_0xb173('0x11')]('GetSugarcrmAccount',_0x165565[_0xb173('0x13')],_0x140f2b);_0x900a69(_0x554ab8[_0xb173('0x11')](0x1f4,_0x165565[_0xb173('0x13')]));});});};exports[_0xb173('0x1c')]=function(_0xa29b21){var _0x1179b0=this;return new Promise(function(_0x2f2da9,_0x2d93e7){return db[_0xb173('0x1d')][_0xb173('0x1e')]({'raw':_0xa29b21[_0xb173('0x17')]?_0xa29b21[_0xb173('0x17')][_0xb173('0x1f')]===undefined?!![]:![]:!![],'where':_0xa29b21[_0xb173('0x17')]?_0xa29b21[_0xb173('0x17')]['where']||null:null,'attributes':_0xa29b21[_0xb173('0x17')]?_0xa29b21[_0xb173('0x17')][_0xb173('0x18')]||null:null,'include':_0xa29b21[_0xb173('0x17')]?_0xa29b21[_0xb173('0x17')][_0xb173('0x19')]?_[_0xb173('0x1b')](_0xa29b21['options'][_0xb173('0x19')],function(_0xe1ebd0){return{'model':db[_0xe1ebd0[_0xb173('0x1a')]],'as':_0xe1ebd0['as'],'attributes':_0xe1ebd0['attributes'],'include':_0xe1ebd0[_0xb173('0x19')]?_[_0xb173('0x1b')](_0xe1ebd0['include'],function(_0x33af55){return{'model':db[_0x33af55[_0xb173('0x1a')]],'as':_0x33af55['as'],'attributes':_0x33af55[_0xb173('0x18')],'include':_0x33af55[_0xb173('0x19')]?_[_0xb173('0x1b')](_0x33af55[_0xb173('0x19')],function(_0x431724){return{'model':db[_0x431724['model']],'as':_0x431724['as'],'attributes':_0x431724['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x101448){logger[_0xb173('0xb')](_0xb173('0x1c'),_0xa29b21);logger[_0xb173('0xe')](_0xb173('0x1c'),_0xa29b21,JSON[_0xb173('0x10')](_0x101448));_0x2f2da9(_0x101448);})[_0xb173('0x20')](function(_0x5d42d6){logger['error']('ShowSugarcrmAccount',_0x5d42d6[_0xb173('0x13')],_0xa29b21);_0x2d93e7(_0x1179b0[_0xb173('0x11')](0x1f4,_0x5d42d6[_0xb173('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 611f9e4..deac4cd 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 _0x8bcc=['index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated'];(function(_0x30c2ae,_0x4c98a2){var _0x1ee1cc=function(_0x165922){while(--_0x165922){_0x30c2ae['push'](_0x30c2ae['shift']());}};_0x1ee1cc(++_0x4c98a2);}(_0x8bcc,0x1b6));var _0xc8bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bcc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc8bc('0x0'));var util=require(_0xc8bc('0x1'));var path=require('path');var timeout=require(_0xc8bc('0x2'));var express=require(_0xc8bc('0x3'));var router=express[_0xc8bc('0x4')]();var fs_extra=require(_0xc8bc('0x5'));var auth=require(_0xc8bc('0x6'));var interaction=require(_0xc8bc('0x7'));var config=require(_0xc8bc('0x8'));var controller=require(_0xc8bc('0x9'));router[_0xc8bc('0xa')]('/',auth[_0xc8bc('0xb')](),controller[_0xc8bc('0xc')]);router[_0xc8bc('0xa')](_0xc8bc('0xd'),auth[_0xc8bc('0xb')](),controller[_0xc8bc('0xe')]);router[_0xc8bc('0xa')](_0xc8bc('0xf'),auth[_0xc8bc('0xb')](),controller['getFields']);router['get']('/:id/subjects',auth[_0xc8bc('0xb')](),controller[_0xc8bc('0x10')]);router[_0xc8bc('0xa')](_0xc8bc('0x11'),auth['isAuthenticated'](),controller[_0xc8bc('0x12')]);router[_0xc8bc('0x13')]('/',auth[_0xc8bc('0xb')](),controller[_0xc8bc('0x14')]);router[_0xc8bc('0x15')](_0xc8bc('0xd'),auth[_0xc8bc('0xb')](),controller[_0xc8bc('0x16')]);router[_0xc8bc('0x17')](_0xc8bc('0xd'),auth[_0xc8bc('0xb')](),controller[_0xc8bc('0x18')]);module['exports']=router; \ No newline at end of file +var _0x8446=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','isAuthenticated','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','/:id'];(function(_0x2c0d34,_0x5abdc3){var _0x2d67a3=function(_0x3bb8fe){while(--_0x3bb8fe){_0x2c0d34['push'](_0x2c0d34['shift']());}};_0x2d67a3(++_0x5abdc3);}(_0x8446,0x9d));var _0x6844=function(_0x522c30,_0x55d91c){_0x522c30=_0x522c30-0x0;var _0x10f547=_0x8446[_0x522c30];return _0x10f547;};'use strict';var multer=require(_0x6844('0x0'));var util=require(_0x6844('0x1'));var path=require(_0x6844('0x2'));var timeout=require(_0x6844('0x3'));var express=require(_0x6844('0x4'));var router=express[_0x6844('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6844('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6844('0x7'));var controller=require(_0x6844('0x8'));router[_0x6844('0x9')]('/',auth['isAuthenticated'](),controller[_0x6844('0xa')]);router[_0x6844('0x9')]('/:id',auth[_0x6844('0xb')](),controller[_0x6844('0xc')]);router[_0x6844('0x9')]('/:id/fields',auth[_0x6844('0xb')](),controller[_0x6844('0xd')]);router[_0x6844('0x9')](_0x6844('0xe'),auth[_0x6844('0xb')](),controller['getSubjects']);router[_0x6844('0x9')](_0x6844('0xf'),auth[_0x6844('0xb')](),controller[_0x6844('0x10')]);router[_0x6844('0x11')]('/',auth[_0x6844('0xb')](),controller['create']);router['put'](_0x6844('0x12'),auth[_0x6844('0xb')](),controller[_0x6844('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6844('0x14')]);module[_0x6844('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index d234842..dc76c3f 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 _0xea66=['STRING','exports'];(function(_0x5e3204,_0x23a83a){var _0x1f010d=function(_0x36ba7c){while(--_0x36ba7c){_0x5e3204['push'](_0x5e3204['shift']());}};_0x1f010d(++_0x23a83a);}(_0xea66,0xaf));var _0x6ea6=function(_0x1f7839,_0x2a26e6){_0x1f7839=_0x1f7839-0x0;var _0x36b42e=_0xea66[_0x1f7839];return _0x36b42e;};'use strict';var Sequelize=require('sequelize');module[_0x6ea6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6ea6('0x1')]}}; \ No newline at end of file +var _0xa504=['exports','STRING','sequelize'];(function(_0x2e0554,_0x3e44b5){var _0x409f04=function(_0x3d67ca){while(--_0x3d67ca){_0x2e0554['push'](_0x2e0554['shift']());}};_0x409f04(++_0x3e44b5);}(_0xa504,0x1d0));var _0x4a50=function(_0x384bc8,_0x2493f3){_0x384bc8=_0x384bc8-0x0;var _0x5339e3=_0xa504[_0x384bc8];return _0x5339e3;};'use strict';var Sequelize=require(_0x4a50('0x0'));module[_0x4a50('0x1')]={'name':{'type':Sequelize[_0x4a50('0x2')]},'description':{'type':Sequelize[_0x4a50('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 02c95ee..023cf1a 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 _0x48ab=['index','map','SugarcrmConfiguration','rawAttributes','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send'];(function(_0x5c5f52,_0x54c941){var _0x2881a6=function(_0x5c4e3e){while(--_0x5c4e3e){_0x5c5f52['push'](_0x5c5f52['shift']());}};_0x2881a6(++_0x54c941);}(_0x48ab,0xc8));var _0xb48a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x48ab[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0xb48a('0x0'));var rimraf=require(_0xb48a('0x1'));var zipdir=require(_0xb48a('0x2'));var jsonpatch=require(_0xb48a('0x3'));var rp=require('request-promise');var moment=require(_0xb48a('0x4'));var BPromise=require(_0xb48a('0x5'));var Mustache=require('mustache');var util=require(_0xb48a('0x6'));var path=require(_0xb48a('0x7'));var sox=require(_0xb48a('0x8'));var csv=require(_0xb48a('0x9'));var ejs=require(_0xb48a('0xa'));var fs=require('fs');var fs_extra=require(_0xb48a('0xb'));var _=require(_0xb48a('0xc'));var squel=require('squel');var crypto=require(_0xb48a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb48a('0xe'));var toCsv=require(_0xb48a('0x9'));var querystring=require(_0xb48a('0xf'));var Papa=require(_0xb48a('0x10'));var Redis=require(_0xb48a('0x11'));var authService=require(_0xb48a('0x12'));var qs=require(_0xb48a('0x13'));var as=require(_0xb48a('0x14'));var hardwareService=require(_0xb48a('0x15'));var logger=require(_0xb48a('0x16'))('api');var utils=require(_0xb48a('0x17'));var config=require(_0xb48a('0x18'));var licenseUtil=require(_0xb48a('0x19'));var db=require(_0xb48a('0x1a'))['db'];function respondWithStatusCode(_0x44d7bc,_0x57075c){_0x57075c=_0x57075c||0xcc;return function(_0x4db50e){if(_0x4db50e){return _0x44d7bc['sendStatus'](_0x57075c);}return _0x44d7bc[_0xb48a('0x1b')](_0x57075c)['end']();};}function respondWithResult(_0x59836d,_0x127b78){_0x127b78=_0x127b78||0xc8;return function(_0x73fa41){if(_0x73fa41){return _0x59836d[_0xb48a('0x1b')](_0x127b78)[_0xb48a('0x1c')](_0x73fa41);}};}function respondWithFilteredResult(_0x2d7b12,_0x17fc65){return function(_0x2a3f5d){if(_0x2a3f5d){var _0x3af11a=typeof _0x17fc65[_0xb48a('0x1d')]==='undefined'&&typeof _0x17fc65[_0xb48a('0x1e')]===_0xb48a('0x1f');var _0x428f85=_0x2a3f5d[_0xb48a('0x20')];var _0x43b76e=_0x3af11a?0x0:_0x17fc65[_0xb48a('0x1d')];var _0x547eef=_0x3af11a?_0x2a3f5d[_0xb48a('0x20')]:_0x17fc65['offset']+_0x17fc65['limit'];var _0x4d3e6b;if(_0x547eef>=_0x428f85){_0x547eef=_0x428f85;_0x4d3e6b=0xc8;}else{_0x4d3e6b=0xce;}_0x2d7b12[_0xb48a('0x1b')](_0x4d3e6b);return _0x2d7b12[_0xb48a('0x21')](_0xb48a('0x22'),_0x43b76e+'-'+_0x547eef+'/'+_0x428f85)[_0xb48a('0x1c')](_0x2a3f5d);}return null;};}function patchUpdates(_0x442a2e){return function(_0x698cb4){try{jsonpatch[_0xb48a('0x23')](_0x698cb4,_0x442a2e,!![]);}catch(_0x1dade4){return BPromise[_0xb48a('0x24')](_0x1dade4);}return _0x698cb4[_0xb48a('0x25')]();};}function saveUpdates(_0x3befca,_0x2818e5){return function(_0x4ac817){if(_0x4ac817){return _0x4ac817['update'](_0x3befca)[_0xb48a('0x26')](function(_0x1be871){return _0x1be871;});}return null;};}function removeEntity(_0x543758,_0x35639d){return function(_0x31d216){if(_0x31d216){return _0x31d216[_0xb48a('0x27')]()[_0xb48a('0x26')](function(){_0x543758[_0xb48a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f2a13,_0x7edcc7){return function(_0xd9ece){if(!_0xd9ece){_0x5f2a13['sendStatus'](0x194);}return _0xd9ece;};}function handleError(_0xa1010b,_0x5cb1e4){_0x5cb1e4=_0x5cb1e4||0x1f4;return function(_0x70a575){logger['error'](_0x70a575[_0xb48a('0x28')]);if(_0x70a575[_0xb48a('0x29')]){delete _0x70a575['name'];}_0xa1010b[_0xb48a('0x1b')](_0x5cb1e4)[_0xb48a('0x2a')](_0x70a575);};}exports[_0xb48a('0x2b')]=function(_0x2e55b8,_0x387def){var _0x2f85d4={},_0x248921={},_0x785f34={'count':0x0,'rows':[]};var _0x2e85d4=_[_0xb48a('0x2c')](db[_0xb48a('0x2d')][_0xb48a('0x2e')],function(_0x3ac75b){return{'name':_0x3ac75b['fieldName'],'type':_0x3ac75b['type']['key']};});_0x248921['model']=_[_0xb48a('0x2c')](_0x2e85d4,_0xb48a('0x29'));_0x248921[_0xb48a('0x2f')]=_[_0xb48a('0x30')](_0x2e55b8[_0xb48a('0x2f')]);_0x248921[_0xb48a('0x31')]=_['intersection'](_0x248921[_0xb48a('0x32')],_0x248921[_0xb48a('0x2f')]);_0x2f85d4['attributes']=_[_0xb48a('0x33')](_0x248921[_0xb48a('0x32')],qs[_0xb48a('0x34')](_0x2e55b8['query'][_0xb48a('0x34')]));_0x2f85d4[_0xb48a('0x35')]=_0x2f85d4[_0xb48a('0x35')][_0xb48a('0x36')]?_0x2f85d4['attributes']:_0x248921[_0xb48a('0x32')];if(!_0x2e55b8[_0xb48a('0x2f')][_0xb48a('0x37')](_0xb48a('0x38'))){_0x2f85d4['limit']=qs[_0xb48a('0x1e')](_0x2e55b8[_0xb48a('0x2f')][_0xb48a('0x1e')]);_0x2f85d4[_0xb48a('0x1d')]=qs[_0xb48a('0x1d')](_0x2e55b8[_0xb48a('0x2f')][_0xb48a('0x1d')]);}_0x2f85d4[_0xb48a('0x39')]=qs[_0xb48a('0x3a')](_0x2e55b8['query']['sort']);_0x2f85d4['where']=qs[_0xb48a('0x31')](_[_0xb48a('0x3b')](_0x2e55b8[_0xb48a('0x2f')],_0x248921[_0xb48a('0x31')]),_0x2e85d4);if(_0x2e55b8[_0xb48a('0x2f')][_0xb48a('0x3c')]){_0x2f85d4[_0xb48a('0x3d')]=_[_0xb48a('0x3e')](_0x2f85d4['where'],{'$or':_['map'](_0x2e85d4,function(_0x43515a){if(_0x43515a['type']!==_0xb48a('0x3f')){var _0x4c1a20={};_0x4c1a20[_0x43515a[_0xb48a('0x29')]]={'$like':'%'+_0x2e55b8[_0xb48a('0x2f')][_0xb48a('0x3c')]+'%'};return _0x4c1a20;}})});}_0x2f85d4=_[_0xb48a('0x3e')]({},_0x2f85d4,_0x2e55b8[_0xb48a('0x40')]);var _0x3e8075={'where':_0x2f85d4['where']};return db[_0xb48a('0x2d')][_0xb48a('0x20')](_0x3e8075)[_0xb48a('0x26')](function(_0x59c939){_0x785f34[_0xb48a('0x20')]=_0x59c939;if(_0x2e55b8['query'][_0xb48a('0x41')]){_0x2f85d4[_0xb48a('0x42')]=[{'all':!![]}];}return db[_0xb48a('0x2d')][_0xb48a('0x43')](_0x2f85d4);})['then'](function(_0x107bde){_0x785f34[_0xb48a('0x44')]=_0x107bde;return _0x785f34;})[_0xb48a('0x26')](respondWithFilteredResult(_0x387def,_0x2f85d4))[_0xb48a('0x45')](handleError(_0x387def,null));};exports[_0xb48a('0x46')]=function(_0x1bc3d1,_0x5c6a43){var _0x377bc9={'raw':![],'where':{'id':_0x1bc3d1[_0xb48a('0x47')]['id']}},_0x3113e9={};_0x3113e9[_0xb48a('0x32')]=_[_0xb48a('0x30')](db[_0xb48a('0x2d')]['rawAttributes']);_0x3113e9['query']=_[_0xb48a('0x30')](_0x1bc3d1[_0xb48a('0x2f')]);_0x3113e9[_0xb48a('0x31')]=_[_0xb48a('0x33')](_0x3113e9['model'],_0x3113e9['query']);_0x377bc9[_0xb48a('0x35')]=_[_0xb48a('0x33')](_0x3113e9[_0xb48a('0x32')],qs[_0xb48a('0x34')](_0x1bc3d1[_0xb48a('0x2f')][_0xb48a('0x34')]));_0x377bc9[_0xb48a('0x35')]=_0x377bc9[_0xb48a('0x35')][_0xb48a('0x36')]?_0x377bc9['attributes']:_0x3113e9[_0xb48a('0x32')];if(_0x1bc3d1[_0xb48a('0x2f')]['includeAll']){_0x377bc9[_0xb48a('0x42')]=[{'all':!![]}];}_0x377bc9=_[_0xb48a('0x3e')]({},_0x377bc9,_0x1bc3d1['options']);return db[_0xb48a('0x2d')][_0xb48a('0x48')](_0x377bc9)[_0xb48a('0x26')](handleEntityNotFound(_0x5c6a43,null))['then'](respondWithResult(_0x5c6a43,null))[_0xb48a('0x45')](handleError(_0x5c6a43,null));};exports['create']=function(_0x27b8a5,_0x31c793){return db[_0xb48a('0x2d')][_0xb48a('0x49')](_0x27b8a5['body'],{})[_0xb48a('0x26')](respondWithResult(_0x31c793,0xc9))[_0xb48a('0x45')](handleError(_0x31c793,null));};exports[_0xb48a('0x4a')]=function(_0x537ce6,_0x21a1f3){if(_0x537ce6[_0xb48a('0x4b')]['id']){delete _0x537ce6['body']['id'];}return db[_0xb48a('0x2d')]['find']({'where':{'id':_0x537ce6['params']['id']}})[_0xb48a('0x26')](handleEntityNotFound(_0x21a1f3,null))[_0xb48a('0x26')](saveUpdates(_0x537ce6[_0xb48a('0x4b')],null))[_0xb48a('0x26')](respondWithResult(_0x21a1f3,null))[_0xb48a('0x45')](handleError(_0x21a1f3,null));};exports['destroy']=function(_0x9032f5,_0x5f2318){return db[_0xb48a('0x2d')][_0xb48a('0x48')]({'where':{'id':_0x9032f5['params']['id']}})[_0xb48a('0x26')](handleEntityNotFound(_0x5f2318,null))['then'](removeEntity(_0x5f2318,null))[_0xb48a('0x45')](handleError(_0x5f2318,null));};exports[_0xb48a('0x4c')]=function(_0x6b1121,_0x59d4ab,_0x43d41b){var _0x435617={};var _0x42a11b={};var _0x1b5882;var _0x4bcd0a;return db['SugarcrmConfiguration'][_0xb48a('0x4d')]({'where':{'id':_0x6b1121[_0xb48a('0x47')]['id']}})['then'](handleEntityNotFound(_0x59d4ab,null))[_0xb48a('0x26')](function(_0x2964a3){if(_0x2964a3){_0x1b5882=_0x2964a3;_0x42a11b[_0xb48a('0x32')]=_['keys'](db[_0xb48a('0x4e')]['rawAttributes']);_0x42a11b[_0xb48a('0x2f')]=_[_0xb48a('0x30')](_0x6b1121[_0xb48a('0x2f')]);_0x42a11b['filters']=_[_0xb48a('0x33')](_0x42a11b[_0xb48a('0x32')],_0x42a11b[_0xb48a('0x2f')]);_0x435617['attributes']=_[_0xb48a('0x33')](_0x42a11b[_0xb48a('0x32')],qs[_0xb48a('0x34')](_0x6b1121['query'][_0xb48a('0x34')]));_0x435617['attributes']=_0x435617[_0xb48a('0x35')][_0xb48a('0x36')]?_0x435617[_0xb48a('0x35')]:_0x42a11b[_0xb48a('0x32')];_0x435617[_0xb48a('0x39')]=qs[_0xb48a('0x3a')](_0x6b1121['query'][_0xb48a('0x3a')]);_0x435617[_0xb48a('0x3d')]=qs[_0xb48a('0x31')](_[_0xb48a('0x3b')](_0x6b1121[_0xb48a('0x2f')],_0x42a11b[_0xb48a('0x31')]));if(_0x6b1121[_0xb48a('0x2f')][_0xb48a('0x3c')]){_0x435617[_0xb48a('0x3d')]=_['merge'](_0x435617[_0xb48a('0x3d')],{'$or':_['map'](_0x435617[_0xb48a('0x35')],function(_0x4226cb){var _0x3fe08c={};_0x3fe08c[_0x4226cb]={'$like':'%'+_0x6b1121[_0xb48a('0x2f')][_0xb48a('0x3c')]+'%'};return _0x3fe08c;})});}_0x435617=_[_0xb48a('0x3e')]({},_0x435617,_0x6b1121[_0xb48a('0x40')]);return _0x1b5882[_0xb48a('0x4c')](_0x435617);}})[_0xb48a('0x26')](function(_0x6bd584){if(_0x6bd584){_0x4bcd0a=_0x6bd584[_0xb48a('0x36')];if(!_0x6b1121[_0xb48a('0x2f')][_0xb48a('0x37')](_0xb48a('0x38'))){_0x435617[_0xb48a('0x1e')]=qs[_0xb48a('0x1e')](_0x6b1121[_0xb48a('0x2f')]['limit']);_0x435617[_0xb48a('0x1d')]=qs['offset'](_0x6b1121[_0xb48a('0x2f')][_0xb48a('0x1d')]);}return _0x1b5882[_0xb48a('0x4c')](_0x435617);}})[_0xb48a('0x26')](function(_0x10eea9){if(_0x10eea9){return _0x10eea9?{'count':_0x4bcd0a,'rows':_0x10eea9}:null;}})[_0xb48a('0x26')](respondWithResult(_0x59d4ab,null))[_0xb48a('0x45')](handleError(_0x59d4ab,null));};exports['getSubjects']=function(_0x21ef62,_0x8fbb7b,_0x10761d){var _0xf0b5f4={};var _0x484202={};var _0x917fad;var _0x43dc8b;return db[_0xb48a('0x2d')]['findOne']({'where':{'id':_0x21ef62[_0xb48a('0x47')]['id']}})[_0xb48a('0x26')](handleEntityNotFound(_0x8fbb7b,null))[_0xb48a('0x26')](function(_0x3260c3){if(_0x3260c3){_0x917fad=_0x3260c3;_0x484202[_0xb48a('0x32')]=_[_0xb48a('0x30')](db[_0xb48a('0x4e')]['rawAttributes']);_0x484202[_0xb48a('0x2f')]=_[_0xb48a('0x30')](_0x21ef62[_0xb48a('0x2f')]);_0x484202[_0xb48a('0x31')]=_[_0xb48a('0x33')](_0x484202['model'],_0x484202[_0xb48a('0x2f')]);_0xf0b5f4[_0xb48a('0x35')]=_['intersection'](_0x484202['model'],qs[_0xb48a('0x34')](_0x21ef62[_0xb48a('0x2f')][_0xb48a('0x34')]));_0xf0b5f4[_0xb48a('0x35')]=_0xf0b5f4[_0xb48a('0x35')][_0xb48a('0x36')]?_0xf0b5f4[_0xb48a('0x35')]:_0x484202[_0xb48a('0x32')];_0xf0b5f4[_0xb48a('0x39')]=qs[_0xb48a('0x3a')](_0x21ef62[_0xb48a('0x2f')][_0xb48a('0x3a')]);_0xf0b5f4[_0xb48a('0x3d')]=qs[_0xb48a('0x31')](_[_0xb48a('0x3b')](_0x21ef62[_0xb48a('0x2f')],_0x484202[_0xb48a('0x31')]));if(_0x21ef62[_0xb48a('0x2f')][_0xb48a('0x3c')]){_0xf0b5f4[_0xb48a('0x3d')]=_[_0xb48a('0x3e')](_0xf0b5f4[_0xb48a('0x3d')],{'$or':_[_0xb48a('0x2c')](_0xf0b5f4['attributes'],function(_0x15fbc3){var _0x392219={};_0x392219[_0x15fbc3]={'$like':'%'+_0x21ef62['query']['filter']+'%'};return _0x392219;})});}_0xf0b5f4=_[_0xb48a('0x3e')]({},_0xf0b5f4,_0x21ef62[_0xb48a('0x40')]);return _0x917fad[_0xb48a('0x4f')](_0xf0b5f4);}})[_0xb48a('0x26')](function(_0x4f76df){if(_0x4f76df){_0x43dc8b=_0x4f76df['length'];if(!_0x21ef62[_0xb48a('0x2f')][_0xb48a('0x37')]('nolimit')){_0xf0b5f4['limit']=qs[_0xb48a('0x1e')](_0x21ef62[_0xb48a('0x2f')][_0xb48a('0x1e')]);_0xf0b5f4[_0xb48a('0x1d')]=qs[_0xb48a('0x1d')](_0x21ef62[_0xb48a('0x2f')][_0xb48a('0x1d')]);}return _0x917fad['getSubjects'](_0xf0b5f4);}})[_0xb48a('0x26')](function(_0x38669e){if(_0x38669e){return _0x38669e?{'count':_0x43dc8b,'rows':_0x38669e}:null;}})['then'](respondWithResult(_0x8fbb7b,null))[_0xb48a('0x45')](handleError(_0x8fbb7b,null));};exports['getDescriptions']=function(_0x3241f1,_0xa3c39b,_0x49daeb){var _0x53326c={};var _0x28bf4d={};var _0x3020ec;var _0x2bda6c;return db[_0xb48a('0x2d')][_0xb48a('0x4d')]({'where':{'id':_0x3241f1[_0xb48a('0x47')]['id']}})[_0xb48a('0x26')](handleEntityNotFound(_0xa3c39b,null))['then'](function(_0x269621){if(_0x269621){_0x3020ec=_0x269621;_0x28bf4d[_0xb48a('0x32')]=_[_0xb48a('0x30')](db[_0xb48a('0x4e')][_0xb48a('0x2e')]);_0x28bf4d[_0xb48a('0x2f')]=_['keys'](_0x3241f1[_0xb48a('0x2f')]);_0x28bf4d[_0xb48a('0x31')]=_[_0xb48a('0x33')](_0x28bf4d[_0xb48a('0x32')],_0x28bf4d[_0xb48a('0x2f')]);_0x53326c[_0xb48a('0x35')]=_[_0xb48a('0x33')](_0x28bf4d[_0xb48a('0x32')],qs[_0xb48a('0x34')](_0x3241f1['query'][_0xb48a('0x34')]));_0x53326c[_0xb48a('0x35')]=_0x53326c[_0xb48a('0x35')][_0xb48a('0x36')]?_0x53326c[_0xb48a('0x35')]:_0x28bf4d[_0xb48a('0x32')];_0x53326c[_0xb48a('0x39')]=qs[_0xb48a('0x3a')](_0x3241f1['query'][_0xb48a('0x3a')]);_0x53326c[_0xb48a('0x3d')]=qs[_0xb48a('0x31')](_[_0xb48a('0x3b')](_0x3241f1['query'],_0x28bf4d[_0xb48a('0x31')]));if(_0x3241f1[_0xb48a('0x2f')][_0xb48a('0x3c')]){_0x53326c['where']=_['merge'](_0x53326c[_0xb48a('0x3d')],{'$or':_[_0xb48a('0x2c')](_0x53326c[_0xb48a('0x35')],function(_0x3c395c){var _0x3a64eb={};_0x3a64eb[_0x3c395c]={'$like':'%'+_0x3241f1[_0xb48a('0x2f')][_0xb48a('0x3c')]+'%'};return _0x3a64eb;})});}_0x53326c=_[_0xb48a('0x3e')]({},_0x53326c,_0x3241f1[_0xb48a('0x40')]);return _0x3020ec[_0xb48a('0x50')](_0x53326c);}})[_0xb48a('0x26')](function(_0x92236d){if(_0x92236d){_0x2bda6c=_0x92236d[_0xb48a('0x36')];if(!_0x3241f1['query'][_0xb48a('0x37')](_0xb48a('0x38'))){_0x53326c[_0xb48a('0x1e')]=qs[_0xb48a('0x1e')](_0x3241f1[_0xb48a('0x2f')][_0xb48a('0x1e')]);_0x53326c['offset']=qs[_0xb48a('0x1d')](_0x3241f1[_0xb48a('0x2f')][_0xb48a('0x1d')]);}return _0x3020ec[_0xb48a('0x50')](_0x53326c);}})[_0xb48a('0x26')](function(_0x28d00f){if(_0x28d00f){return _0x28d00f?{'count':_0x2bda6c,'rows':_0x28d00f}:null;}})[_0xb48a('0x26')](respondWithResult(_0xa3c39b,null))[_0xb48a('0x45')](handleError(_0xa3c39b,null));}; \ No newline at end of file +var _0x0f2d=['find','create','body','getFields','findOne','SugarcrmField','order','nolimit','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','sort','filters','pick','filter','merge','where','VIRTUAL','options','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','length'];(function(_0x2cc7cb,_0x343e9d){var _0x30baf1=function(_0x530c91){while(--_0x530c91){_0x2cc7cb['push'](_0x2cc7cb['shift']());}};_0x30baf1(++_0x343e9d);}(_0x0f2d,0x19a));var _0xd0f2=function(_0x1b71c3,_0x3d1dfe){_0x1b71c3=_0x1b71c3-0x0;var _0x3887fa=_0x0f2d[_0x1b71c3];return _0x3887fa;};'use strict';var emlformat=require(_0xd0f2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd0f2('0x1'));var rp=require(_0xd0f2('0x2'));var moment=require(_0xd0f2('0x3'));var BPromise=require(_0xd0f2('0x4'));var Mustache=require('mustache');var util=require(_0xd0f2('0x5'));var path=require(_0xd0f2('0x6'));var sox=require(_0xd0f2('0x7'));var csv=require(_0xd0f2('0x8'));var ejs=require(_0xd0f2('0x9'));var fs=require('fs');var fs_extra=require(_0xd0f2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd0f2('0xb'));var jsforce=require(_0xd0f2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd0f2('0x8'));var querystring=require('querystring');var Papa=require(_0xd0f2('0xd'));var Redis=require(_0xd0f2('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd0f2('0xf'));var hardwareService=require(_0xd0f2('0x10'));var logger=require(_0xd0f2('0x11'))(_0xd0f2('0x12'));var utils=require(_0xd0f2('0x13'));var config=require(_0xd0f2('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aa50c,_0x2a4b08){_0x2a4b08=_0x2a4b08||0xcc;return function(_0x183a42){if(_0x183a42){return _0x1aa50c['sendStatus'](_0x2a4b08);}return _0x1aa50c[_0xd0f2('0x15')](_0x2a4b08)[_0xd0f2('0x16')]();};}function respondWithResult(_0x2336f4,_0x1b9822){_0x1b9822=_0x1b9822||0xc8;return function(_0x55843a){if(_0x55843a){return _0x2336f4[_0xd0f2('0x15')](_0x1b9822)[_0xd0f2('0x17')](_0x55843a);}};}function respondWithFilteredResult(_0x25de9b,_0x526615){return function(_0x419109){if(_0x419109){var _0x36fe9f=typeof _0x526615[_0xd0f2('0x18')]===_0xd0f2('0x19')&&typeof _0x526615[_0xd0f2('0x1a')]===_0xd0f2('0x19');var _0x47954b=_0x419109[_0xd0f2('0x1b')];var _0x135963=_0x36fe9f?0x0:_0x526615[_0xd0f2('0x18')];var _0x40616c=_0x36fe9f?_0x419109[_0xd0f2('0x1b')]:_0x526615['offset']+_0x526615[_0xd0f2('0x1a')];var _0xb02b4c;if(_0x40616c>=_0x47954b){_0x40616c=_0x47954b;_0xb02b4c=0xc8;}else{_0xb02b4c=0xce;}_0x25de9b[_0xd0f2('0x15')](_0xb02b4c);return _0x25de9b[_0xd0f2('0x1c')](_0xd0f2('0x1d'),_0x135963+'-'+_0x40616c+'/'+_0x47954b)[_0xd0f2('0x17')](_0x419109);}return null;};}function patchUpdates(_0xa0c60a){return function(_0x314d86){try{jsonpatch[_0xd0f2('0x1e')](_0x314d86,_0xa0c60a,!![]);}catch(_0x14f15d){return BPromise[_0xd0f2('0x1f')](_0x14f15d);}return _0x314d86[_0xd0f2('0x20')]();};}function saveUpdates(_0x5efd24,_0x5b10c1){return function(_0x35582b){if(_0x35582b){return _0x35582b[_0xd0f2('0x21')](_0x5efd24)[_0xd0f2('0x22')](function(_0x14f302){return _0x14f302;});}return null;};}function removeEntity(_0x1cc010,_0x21bbc1){return function(_0x1cb881){if(_0x1cb881){return _0x1cb881[_0xd0f2('0x23')]()[_0xd0f2('0x22')](function(){_0x1cc010[_0xd0f2('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f581d,_0x5bca2f){return function(_0x3c746d){if(!_0x3c746d){_0x3f581d[_0xd0f2('0x24')](0x194);}return _0x3c746d;};}function handleError(_0x22e754,_0x3b7761){_0x3b7761=_0x3b7761||0x1f4;return function(_0x3f2a5f){logger['error'](_0x3f2a5f[_0xd0f2('0x25')]);if(_0x3f2a5f[_0xd0f2('0x26')]){delete _0x3f2a5f[_0xd0f2('0x26')];}_0x22e754['status'](_0x3b7761)[_0xd0f2('0x27')](_0x3f2a5f);};}exports[_0xd0f2('0x28')]=function(_0x5e83d7,_0x379882){var _0x2df7a8={},_0x42f2ba={},_0x58de83={'count':0x0,'rows':[]};var _0x2be1fa=_[_0xd0f2('0x29')](db['SugarcrmConfiguration'][_0xd0f2('0x2a')],function(_0x598119){return{'name':_0x598119[_0xd0f2('0x2b')],'type':_0x598119[_0xd0f2('0x2c')][_0xd0f2('0x2d')]};});_0x42f2ba[_0xd0f2('0x2e')]=_[_0xd0f2('0x29')](_0x2be1fa,_0xd0f2('0x26'));_0x42f2ba[_0xd0f2('0x2f')]=_['keys'](_0x5e83d7['query']);_0x42f2ba['filters']=_[_0xd0f2('0x30')](_0x42f2ba['model'],_0x42f2ba[_0xd0f2('0x2f')]);_0x2df7a8[_0xd0f2('0x31')]=_['intersection'](_0x42f2ba[_0xd0f2('0x2e')],qs[_0xd0f2('0x32')](_0x5e83d7[_0xd0f2('0x2f')][_0xd0f2('0x32')]));_0x2df7a8[_0xd0f2('0x31')]=_0x2df7a8['attributes']['length']?_0x2df7a8[_0xd0f2('0x31')]:_0x42f2ba[_0xd0f2('0x2e')];if(!_0x5e83d7[_0xd0f2('0x2f')][_0xd0f2('0x33')]('nolimit')){_0x2df7a8[_0xd0f2('0x1a')]=qs['limit'](_0x5e83d7[_0xd0f2('0x2f')][_0xd0f2('0x1a')]);_0x2df7a8[_0xd0f2('0x18')]=qs[_0xd0f2('0x18')](_0x5e83d7[_0xd0f2('0x2f')]['offset']);}_0x2df7a8['order']=qs['sort'](_0x5e83d7['query'][_0xd0f2('0x34')]);_0x2df7a8['where']=qs[_0xd0f2('0x35')](_[_0xd0f2('0x36')](_0x5e83d7[_0xd0f2('0x2f')],_0x42f2ba[_0xd0f2('0x35')]),_0x2be1fa);if(_0x5e83d7[_0xd0f2('0x2f')][_0xd0f2('0x37')]){_0x2df7a8['where']=_[_0xd0f2('0x38')](_0x2df7a8[_0xd0f2('0x39')],{'$or':_[_0xd0f2('0x29')](_0x2be1fa,function(_0x1a99cc){if(_0x1a99cc[_0xd0f2('0x2c')]!==_0xd0f2('0x3a')){var _0x2d4c21={};_0x2d4c21[_0x1a99cc[_0xd0f2('0x26')]]={'$like':'%'+_0x5e83d7[_0xd0f2('0x2f')][_0xd0f2('0x37')]+'%'};return _0x2d4c21;}})});}_0x2df7a8=_[_0xd0f2('0x38')]({},_0x2df7a8,_0x5e83d7[_0xd0f2('0x3b')]);var _0x598cd6={'where':_0x2df7a8[_0xd0f2('0x39')]};return db[_0xd0f2('0x3c')][_0xd0f2('0x1b')](_0x598cd6)[_0xd0f2('0x22')](function(_0xd97e10){_0x58de83[_0xd0f2('0x1b')]=_0xd97e10;if(_0x5e83d7[_0xd0f2('0x2f')][_0xd0f2('0x3d')]){_0x2df7a8[_0xd0f2('0x3e')]=[{'all':!![]}];}return db[_0xd0f2('0x3c')][_0xd0f2('0x3f')](_0x2df7a8);})[_0xd0f2('0x22')](function(_0x15f8a1){_0x58de83[_0xd0f2('0x40')]=_0x15f8a1;return _0x58de83;})[_0xd0f2('0x22')](respondWithFilteredResult(_0x379882,_0x2df7a8))[_0xd0f2('0x41')](handleError(_0x379882,null));};exports[_0xd0f2('0x42')]=function(_0x3f991b,_0x51a00d){var _0x50db48={'raw':![],'where':{'id':_0x3f991b[_0xd0f2('0x43')]['id']}},_0x1650dd={};_0x1650dd['model']=_[_0xd0f2('0x44')](db[_0xd0f2('0x3c')][_0xd0f2('0x2a')]);_0x1650dd[_0xd0f2('0x2f')]=_[_0xd0f2('0x44')](_0x3f991b['query']);_0x1650dd[_0xd0f2('0x35')]=_['intersection'](_0x1650dd['model'],_0x1650dd[_0xd0f2('0x2f')]);_0x50db48[_0xd0f2('0x31')]=_[_0xd0f2('0x30')](_0x1650dd['model'],qs[_0xd0f2('0x32')](_0x3f991b[_0xd0f2('0x2f')][_0xd0f2('0x32')]));_0x50db48['attributes']=_0x50db48[_0xd0f2('0x31')][_0xd0f2('0x45')]?_0x50db48[_0xd0f2('0x31')]:_0x1650dd['model'];if(_0x3f991b[_0xd0f2('0x2f')][_0xd0f2('0x3d')]){_0x50db48[_0xd0f2('0x3e')]=[{'all':!![]}];}_0x50db48=_['merge']({},_0x50db48,_0x3f991b[_0xd0f2('0x3b')]);return db[_0xd0f2('0x3c')][_0xd0f2('0x46')](_0x50db48)[_0xd0f2('0x22')](handleEntityNotFound(_0x51a00d,null))[_0xd0f2('0x22')](respondWithResult(_0x51a00d,null))[_0xd0f2('0x41')](handleError(_0x51a00d,null));};exports['create']=function(_0x1d75d6,_0x7801fc){return db[_0xd0f2('0x3c')][_0xd0f2('0x47')](_0x1d75d6['body'],{})[_0xd0f2('0x22')](respondWithResult(_0x7801fc,0xc9))['catch'](handleError(_0x7801fc,null));};exports['update']=function(_0x4521ba,_0x3922de){if(_0x4521ba['body']['id']){delete _0x4521ba[_0xd0f2('0x48')]['id'];}return db[_0xd0f2('0x3c')][_0xd0f2('0x46')]({'where':{'id':_0x4521ba['params']['id']}})['then'](handleEntityNotFound(_0x3922de,null))[_0xd0f2('0x22')](saveUpdates(_0x4521ba[_0xd0f2('0x48')],null))['then'](respondWithResult(_0x3922de,null))[_0xd0f2('0x41')](handleError(_0x3922de,null));};exports[_0xd0f2('0x23')]=function(_0x471cc6,_0x593899){return db[_0xd0f2('0x3c')]['find']({'where':{'id':_0x471cc6[_0xd0f2('0x43')]['id']}})[_0xd0f2('0x22')](handleEntityNotFound(_0x593899,null))[_0xd0f2('0x22')](removeEntity(_0x593899,null))[_0xd0f2('0x41')](handleError(_0x593899,null));};exports[_0xd0f2('0x49')]=function(_0xba7240,_0x3ab6f1,_0xec57ea){var _0x3e9fbe={};var _0x2fe957={};var _0xfc7251;var _0x4c97e4;return db[_0xd0f2('0x3c')][_0xd0f2('0x4a')]({'where':{'id':_0xba7240['params']['id']}})[_0xd0f2('0x22')](handleEntityNotFound(_0x3ab6f1,null))[_0xd0f2('0x22')](function(_0x12960f){if(_0x12960f){_0xfc7251=_0x12960f;_0x2fe957[_0xd0f2('0x2e')]=_[_0xd0f2('0x44')](db[_0xd0f2('0x4b')]['rawAttributes']);_0x2fe957['query']=_['keys'](_0xba7240['query']);_0x2fe957['filters']=_[_0xd0f2('0x30')](_0x2fe957[_0xd0f2('0x2e')],_0x2fe957[_0xd0f2('0x2f')]);_0x3e9fbe[_0xd0f2('0x31')]=_[_0xd0f2('0x30')](_0x2fe957['model'],qs[_0xd0f2('0x32')](_0xba7240[_0xd0f2('0x2f')][_0xd0f2('0x32')]));_0x3e9fbe[_0xd0f2('0x31')]=_0x3e9fbe['attributes'][_0xd0f2('0x45')]?_0x3e9fbe[_0xd0f2('0x31')]:_0x2fe957['model'];_0x3e9fbe[_0xd0f2('0x4c')]=qs[_0xd0f2('0x34')](_0xba7240[_0xd0f2('0x2f')][_0xd0f2('0x34')]);_0x3e9fbe['where']=qs['filters'](_[_0xd0f2('0x36')](_0xba7240['query'],_0x2fe957['filters']));if(_0xba7240['query'][_0xd0f2('0x37')]){_0x3e9fbe[_0xd0f2('0x39')]=_[_0xd0f2('0x38')](_0x3e9fbe[_0xd0f2('0x39')],{'$or':_[_0xd0f2('0x29')](_0x3e9fbe[_0xd0f2('0x31')],function(_0x1d54c3){var _0x47c3ae={};_0x47c3ae[_0x1d54c3]={'$like':'%'+_0xba7240['query']['filter']+'%'};return _0x47c3ae;})});}_0x3e9fbe=_[_0xd0f2('0x38')]({},_0x3e9fbe,_0xba7240[_0xd0f2('0x3b')]);return _0xfc7251[_0xd0f2('0x49')](_0x3e9fbe);}})[_0xd0f2('0x22')](function(_0x4500af){if(_0x4500af){_0x4c97e4=_0x4500af['length'];if(!_0xba7240[_0xd0f2('0x2f')]['hasOwnProperty'](_0xd0f2('0x4d'))){_0x3e9fbe[_0xd0f2('0x1a')]=qs['limit'](_0xba7240['query'][_0xd0f2('0x1a')]);_0x3e9fbe[_0xd0f2('0x18')]=qs['offset'](_0xba7240[_0xd0f2('0x2f')][_0xd0f2('0x18')]);}return _0xfc7251['getFields'](_0x3e9fbe);}})[_0xd0f2('0x22')](function(_0x54876f){if(_0x54876f){return _0x54876f?{'count':_0x4c97e4,'rows':_0x54876f}:null;}})['then'](respondWithResult(_0x3ab6f1,null))[_0xd0f2('0x41')](handleError(_0x3ab6f1,null));};exports[_0xd0f2('0x4e')]=function(_0x102898,_0x2de6f9,_0x317573){var _0x85c085={};var _0x7532fc={};var _0x461801;var _0x35bba0;return db[_0xd0f2('0x3c')][_0xd0f2('0x4a')]({'where':{'id':_0x102898[_0xd0f2('0x43')]['id']}})[_0xd0f2('0x22')](handleEntityNotFound(_0x2de6f9,null))['then'](function(_0x420f9b){if(_0x420f9b){_0x461801=_0x420f9b;_0x7532fc[_0xd0f2('0x2e')]=_[_0xd0f2('0x44')](db[_0xd0f2('0x4b')][_0xd0f2('0x2a')]);_0x7532fc['query']=_[_0xd0f2('0x44')](_0x102898[_0xd0f2('0x2f')]);_0x7532fc[_0xd0f2('0x35')]=_['intersection'](_0x7532fc[_0xd0f2('0x2e')],_0x7532fc[_0xd0f2('0x2f')]);_0x85c085['attributes']=_[_0xd0f2('0x30')](_0x7532fc['model'],qs[_0xd0f2('0x32')](_0x102898['query'][_0xd0f2('0x32')]));_0x85c085['attributes']=_0x85c085[_0xd0f2('0x31')]['length']?_0x85c085[_0xd0f2('0x31')]:_0x7532fc['model'];_0x85c085['order']=qs[_0xd0f2('0x34')](_0x102898[_0xd0f2('0x2f')][_0xd0f2('0x34')]);_0x85c085['where']=qs[_0xd0f2('0x35')](_[_0xd0f2('0x36')](_0x102898[_0xd0f2('0x2f')],_0x7532fc[_0xd0f2('0x35')]));if(_0x102898[_0xd0f2('0x2f')]['filter']){_0x85c085[_0xd0f2('0x39')]=_[_0xd0f2('0x38')](_0x85c085[_0xd0f2('0x39')],{'$or':_[_0xd0f2('0x29')](_0x85c085[_0xd0f2('0x31')],function(_0x8546bf){var _0x10226d={};_0x10226d[_0x8546bf]={'$like':'%'+_0x102898[_0xd0f2('0x2f')]['filter']+'%'};return _0x10226d;})});}_0x85c085=_[_0xd0f2('0x38')]({},_0x85c085,_0x102898[_0xd0f2('0x3b')]);return _0x461801[_0xd0f2('0x4e')](_0x85c085);}})[_0xd0f2('0x22')](function(_0x2c0374){if(_0x2c0374){_0x35bba0=_0x2c0374[_0xd0f2('0x45')];if(!_0x102898[_0xd0f2('0x2f')][_0xd0f2('0x33')]('nolimit')){_0x85c085[_0xd0f2('0x1a')]=qs[_0xd0f2('0x1a')](_0x102898[_0xd0f2('0x2f')][_0xd0f2('0x1a')]);_0x85c085['offset']=qs[_0xd0f2('0x18')](_0x102898[_0xd0f2('0x2f')][_0xd0f2('0x18')]);}return _0x461801[_0xd0f2('0x4e')](_0x85c085);}})[_0xd0f2('0x22')](function(_0x27eccf){if(_0x27eccf){return _0x27eccf?{'count':_0x35bba0,'rows':_0x27eccf}:null;}})[_0xd0f2('0x22')](respondWithResult(_0x2de6f9,null))[_0xd0f2('0x41')](handleError(_0x2de6f9,null));};exports[_0xd0f2('0x4f')]=function(_0x5e34d,_0x20a30c,_0x58b118){var _0x59c7ed={};var _0x37b8a9={};var _0x127112;var _0x5015bb;return db[_0xd0f2('0x3c')]['findOne']({'where':{'id':_0x5e34d['params']['id']}})[_0xd0f2('0x22')](handleEntityNotFound(_0x20a30c,null))[_0xd0f2('0x22')](function(_0x1b9323){if(_0x1b9323){_0x127112=_0x1b9323;_0x37b8a9['model']=_[_0xd0f2('0x44')](db[_0xd0f2('0x4b')]['rawAttributes']);_0x37b8a9['query']=_['keys'](_0x5e34d['query']);_0x37b8a9[_0xd0f2('0x35')]=_[_0xd0f2('0x30')](_0x37b8a9[_0xd0f2('0x2e')],_0x37b8a9['query']);_0x59c7ed[_0xd0f2('0x31')]=_['intersection'](_0x37b8a9[_0xd0f2('0x2e')],qs['fields'](_0x5e34d[_0xd0f2('0x2f')][_0xd0f2('0x32')]));_0x59c7ed[_0xd0f2('0x31')]=_0x59c7ed[_0xd0f2('0x31')]['length']?_0x59c7ed[_0xd0f2('0x31')]:_0x37b8a9['model'];_0x59c7ed['order']=qs[_0xd0f2('0x34')](_0x5e34d[_0xd0f2('0x2f')][_0xd0f2('0x34')]);_0x59c7ed[_0xd0f2('0x39')]=qs[_0xd0f2('0x35')](_[_0xd0f2('0x36')](_0x5e34d[_0xd0f2('0x2f')],_0x37b8a9[_0xd0f2('0x35')]));if(_0x5e34d[_0xd0f2('0x2f')][_0xd0f2('0x37')]){_0x59c7ed[_0xd0f2('0x39')]=_[_0xd0f2('0x38')](_0x59c7ed['where'],{'$or':_['map'](_0x59c7ed[_0xd0f2('0x31')],function(_0x4e1da0){var _0x4ca61e={};_0x4ca61e[_0x4e1da0]={'$like':'%'+_0x5e34d[_0xd0f2('0x2f')][_0xd0f2('0x37')]+'%'};return _0x4ca61e;})});}_0x59c7ed=_[_0xd0f2('0x38')]({},_0x59c7ed,_0x5e34d[_0xd0f2('0x3b')]);return _0x127112[_0xd0f2('0x4f')](_0x59c7ed);}})[_0xd0f2('0x22')](function(_0x39ce67){if(_0x39ce67){_0x5015bb=_0x39ce67[_0xd0f2('0x45')];if(!_0x5e34d['query'][_0xd0f2('0x33')]('nolimit')){_0x59c7ed[_0xd0f2('0x1a')]=qs[_0xd0f2('0x1a')](_0x5e34d['query'][_0xd0f2('0x1a')]);_0x59c7ed[_0xd0f2('0x18')]=qs[_0xd0f2('0x18')](_0x5e34d[_0xd0f2('0x2f')][_0xd0f2('0x18')]);}return _0x127112[_0xd0f2('0x4f')](_0x59c7ed);}})['then'](function(_0x244ab7){if(_0x244ab7){return _0x244ab7?{'count':_0x5015bb,'rows':_0x244ab7}:null;}})['then'](respondWithResult(_0x20a30c,null))[_0xd0f2('0x41')](handleError(_0x20a30c,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index d943d34..f93a1e9 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 _0x4649=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','define','util'];(function(_0x5279bf,_0x3f7234){var _0xe12d32=function(_0x402fb9){while(--_0x402fb9){_0x5279bf['push'](_0x5279bf['shift']());}};_0xe12d32(++_0x3f7234);}(_0x4649,0x117));var _0x9464=function(_0xa59425,_0x35949f){_0xa59425=_0xa59425-0x0;var _0x32a331=_0x4649[_0xa59425];return _0x32a331;};'use strict';var _=require('lodash');var util=require(_0x9464('0x0'));var logger=require(_0x9464('0x1'))(_0x9464('0x2'));var moment=require(_0x9464('0x3'));var BPromise=require(_0x9464('0x4'));var rp=require(_0x9464('0x5'));var fs=require('fs');var path=require(_0x9464('0x6'));var rimraf=require(_0x9464('0x7'));var config=require('../../config/environment');var attributes=require(_0x9464('0x8'));module['exports']=function(_0x3e76a0,_0x4541e5){return _0x3e76a0[_0x9464('0x9')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bb6=['./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','lodash','util','api','request-promise','path'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x2bb6,0x163));var _0x62bb=function(_0x449a38,_0x3f8271){_0x449a38=_0x449a38-0x0;var _0x38a415=_0x2bb6[_0x449a38];return _0x38a415;};'use strict';var _=require(_0x62bb('0x0'));var util=require(_0x62bb('0x1'));var logger=require('../../config/logger')(_0x62bb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x62bb('0x3'));var fs=require('fs');var path=require(_0x62bb('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x62bb('0x5'));module[_0x62bb('0x6')]=function(_0x25f167,_0x25fc43){return _0x25f167[_0x62bb('0x7')](_0x62bb('0x8'),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 7883ae8..70ca7fc 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 _0xabef=['jayson/promise','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment'];(function(_0x3f1097,_0x4630a5){var _0x408580=function(_0x2cd524){while(--_0x2cd524){_0x3f1097['push'](_0x3f1097['shift']());}};_0x408580(++_0x4630a5);}(_0xabef,0x10a));var _0xfabe=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xabef[_0x122096];return _0x3d1966;};'use strict';var _=require(_0xfabe('0x0'));var util=require('util');var moment=require(_0xfabe('0x1'));var BPromise=require(_0xfabe('0x2'));var rs=require(_0xfabe('0x3'));var fs=require('fs');var Redis=require(_0xfabe('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfabe('0x5'))('rpc');var config=require(_0xfabe('0x6'));var jayson=require(_0xfabe('0x7'));var client=jayson['client'][_0xfabe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50cb6a,_0x1721a8,_0x321206){return new BPromise(function(_0x187fb1,_0x5b1f5b){return client[_0xfabe('0x9')](_0x50cb6a,_0x321206)['then'](function(_0x39b471){logger[_0xfabe('0xa')](_0xfabe('0xb'),_0x1721a8,_0xfabe('0xc'));logger[_0xfabe('0xd')](_0xfabe('0xe'),_0x1721a8,_0xfabe('0xc'),JSON[_0xfabe('0xf')](_0x39b471));if(_0x39b471[_0xfabe('0x10')]){if(_0x39b471[_0xfabe('0x10')][_0xfabe('0x11')]===0x1f4){logger[_0xfabe('0x10')](_0xfabe('0xb'),_0x1721a8,_0x39b471[_0xfabe('0x10')][_0xfabe('0x12')]);return _0x5b1f5b(_0x39b471[_0xfabe('0x10')][_0xfabe('0x12')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x1721a8,_0x39b471[_0xfabe('0x10')]['message']);return _0x187fb1(_0x39b471[_0xfabe('0x10')][_0xfabe('0x12')]);}else{logger[_0xfabe('0xa')](_0xfabe('0xb'),_0x1721a8,_0xfabe('0xc'));_0x187fb1(_0x39b471[_0xfabe('0x13')]['message']);}})[_0xfabe('0x14')](function(_0x6e0d6){logger[_0xfabe('0x10')](_0xfabe('0xb'),_0x1721a8,_0x6e0d6);_0x5b1f5b(_0x6e0d6);});});} \ No newline at end of file +var _0xbbaa=['rpc','../../config/environment','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0xac0ca3,_0x4b9710){var _0x23a86e=function(_0x5a240d){while(--_0x5a240d){_0xac0ca3['push'](_0xac0ca3['shift']());}};_0x23a86e(++_0x4b9710);}(_0xbbaa,0x1db));var _0xabba=function(_0x472376,_0x33795f){_0x472376=_0x472376-0x0;var _0x3848ee=_0xbbaa[_0x472376];return _0x3848ee;};'use strict';var _=require(_0xabba('0x0'));var util=require(_0xabba('0x1'));var moment=require(_0xabba('0x2'));var BPromise=require(_0xabba('0x3'));var rs=require(_0xabba('0x4'));var fs=require('fs');var Redis=require(_0xabba('0x5'));var db=require(_0xabba('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xabba('0x7'))(_0xabba('0x8'));var config=require(_0xabba('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xabba('0xa')][_0xabba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x412293,_0x58807d,_0x3e6b70){return new BPromise(function(_0x458964,_0x4fc034){return client[_0xabba('0xc')](_0x412293,_0x3e6b70)['then'](function(_0x8ab62d){logger['info'](_0xabba('0xd'),_0x58807d,_0xabba('0xe'));logger[_0xabba('0xf')](_0xabba('0x10'),_0x58807d,_0xabba('0xe'),JSON[_0xabba('0x11')](_0x8ab62d));if(_0x8ab62d[_0xabba('0x12')]){if(_0x8ab62d['error']['code']===0x1f4){logger['error'](_0xabba('0xd'),_0x58807d,_0x8ab62d['error']['message']);return _0x4fc034(_0x8ab62d[_0xabba('0x12')][_0xabba('0x13')]);}logger[_0xabba('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x58807d,_0x8ab62d[_0xabba('0x12')][_0xabba('0x13')]);return _0x458964(_0x8ab62d[_0xabba('0x12')]['message']);}else{logger['info'](_0xabba('0xd'),_0x58807d,_0xabba('0xe'));_0x458964(_0x8ab62d['result'][_0xabba('0x13')]);}})[_0xabba('0x14')](function(_0x13f673){logger[_0xabba('0x12')](_0xabba('0xd'),_0x58807d,_0x13f673);_0x4fc034(_0x13f673);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index e7df38f..f2e9a75 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 _0xb8f9=['isAuthenticated','show','create','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index'];(function(_0x559f3c,_0x38a42a){var _0xa4a879=function(_0x370102){while(--_0x370102){_0x559f3c['push'](_0x559f3c['shift']());}};_0xa4a879(++_0x38a42a);}(_0xb8f9,0x1aa));var _0x9b8f=function(_0x35d568,_0x4d47ae){_0x35d568=_0x35d568-0x0;var _0x5dac84=_0xb8f9[_0x35d568];return _0x5dac84;};'use strict';var multer=require(_0x9b8f('0x0'));var util=require(_0x9b8f('0x1'));var path=require(_0x9b8f('0x2'));var timeout=require(_0x9b8f('0x3'));var express=require(_0x9b8f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9b8f('0x5'));var interaction=require(_0x9b8f('0x6'));var config=require(_0x9b8f('0x7'));var controller=require(_0x9b8f('0x8'));router[_0x9b8f('0x9')]('/',auth['isAuthenticated'](),controller[_0x9b8f('0xa')]);router[_0x9b8f('0x9')]('/:id',auth[_0x9b8f('0xb')](),controller[_0x9b8f('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9b8f('0xd')]);router[_0x9b8f('0xe')]('/:id',auth[_0x9b8f('0xb')](),controller['update']);router[_0x9b8f('0xf')](_0x9b8f('0x10'),auth['isAuthenticated'](),controller[_0x9b8f('0x11')]);module[_0x9b8f('0x12')]=router; \ No newline at end of file +var _0x0b00=['create','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','post'];(function(_0x136a23,_0x507cda){var _0x48e69b=function(_0x4aefdb){while(--_0x4aefdb){_0x136a23['push'](_0x136a23['shift']());}};_0x48e69b(++_0x507cda);}(_0x0b00,0x144));var _0x00b0=function(_0x1b2e4e,_0x3ee8bf){_0x1b2e4e=_0x1b2e4e-0x0;var _0x1a9aa1=_0x0b00[_0x1b2e4e];return _0x1a9aa1;};'use strict';var multer=require(_0x00b0('0x0'));var util=require(_0x00b0('0x1'));var path=require(_0x00b0('0x2'));var timeout=require(_0x00b0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x00b0('0x4'));var auth=require(_0x00b0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0x00b0('0x6')]('/',auth[_0x00b0('0x7')](),controller[_0x00b0('0x8')]);router[_0x00b0('0x6')](_0x00b0('0x9'),auth[_0x00b0('0x7')](),controller[_0x00b0('0xa')]);router[_0x00b0('0xb')]('/',auth['isAuthenticated'](),controller[_0x00b0('0xc')]);router['put'](_0x00b0('0x9'),auth[_0x00b0('0x7')](),controller[_0x00b0('0xd')]);router[_0x00b0('0xe')](_0x00b0('0x9'),auth[_0x00b0('0x7')](),controller['destroy']);module[_0x00b0('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 4e06544..3e99146 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 _0x90cb=['exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize'];(function(_0x364b42,_0x3923a3){var _0x1ff800=function(_0x25b055){while(--_0x25b055){_0x364b42['push'](_0x364b42['shift']());}};_0x1ff800(++_0x3923a3);}(_0x90cb,0x12b));var _0xb90c=function(_0xeee8f2,_0x351024){_0xeee8f2=_0xeee8f2-0x0;var _0x16102b=_0x90cb[_0xeee8f2];return _0x16102b;};'use strict';var Sequelize=require(_0xb90c('0x0'));module[_0xb90c('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb90c('0x2'),_0xb90c('0x3'),_0xb90c('0x4'),_0xb90c('0x5'),_0xb90c('0x6')),'defaultValue':_0xb90c('0x2')},'content':{'type':Sequelize[_0xb90c('0x7')]},'key':{'type':Sequelize[_0xb90c('0x7')]},'keyType':{'type':Sequelize[_0xb90c('0x8')]('string',_0xb90c('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xb90c('0x7')]},'idField':{'type':Sequelize[_0xb90c('0x7')]},'nameField':{'type':Sequelize[_0xb90c('0x7')]},'customField':{'type':Sequelize[_0xb90c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb90c('0x7')]}}; \ No newline at end of file +var _0xe136=['ENUM','customVariable','keyValue','string','STRING','BOOLEAN','sequelize','exports'];(function(_0x191b1a,_0x48e0e6){var _0x283089=function(_0x4f6574){while(--_0x4f6574){_0x191b1a['push'](_0x191b1a['shift']());}};_0x283089(++_0x48e0e6);}(_0xe136,0xee));var _0x6e13=function(_0x44a982,_0x29ea67){_0x44a982=_0x44a982-0x0;var _0x32a6d6=_0xe136[_0x44a982];return _0x32a6d6;};'use strict';var Sequelize=require(_0x6e13('0x0'));module[_0x6e13('0x1')]={'type':{'type':Sequelize[_0x6e13('0x2')]('string','variable',_0x6e13('0x3'),_0x6e13('0x4'),'picklist'),'defaultValue':_0x6e13('0x5')},'content':{'type':Sequelize[_0x6e13('0x6')]},'key':{'type':Sequelize[_0x6e13('0x6')]},'keyType':{'type':Sequelize[_0x6e13('0x2')](_0x6e13('0x5'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x6e13('0x6')]},'idField':{'type':Sequelize[_0x6e13('0x6')]},'nameField':{'type':Sequelize[_0x6e13('0x6')]},'customField':{'type':Sequelize[_0x6e13('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6e13('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 39f247e..29561cc 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 _0xbb9a=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','SugarcrmField','findAll','catch','show','params','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xbb9a,0x81));var _0xabb9=function(_0x5ee163,_0x188290){_0x5ee163=_0x5ee163-0x0;var _0x4fe0a7=_0xbb9a[_0x5ee163];return _0x4fe0a7;};'use strict';var emlformat=require(_0xabb9('0x0'));var rimraf=require(_0xabb9('0x1'));var zipdir=require(_0xabb9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabb9('0x3'));var moment=require(_0xabb9('0x4'));var BPromise=require(_0xabb9('0x5'));var Mustache=require(_0xabb9('0x6'));var util=require('util');var path=require(_0xabb9('0x7'));var sox=require('sox');var csv=require(_0xabb9('0x8'));var ejs=require(_0xabb9('0x9'));var fs=require('fs');var fs_extra=require(_0xabb9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xabb9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xabb9('0xc'));var toCsv=require('to-csv');var querystring=require(_0xabb9('0xd'));var Papa=require('papaparse');var Redis=require(_0xabb9('0xe'));var authService=require(_0xabb9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xabb9('0x10'));var hardwareService=require(_0xabb9('0x11'));var logger=require(_0xabb9('0x12'))(_0xabb9('0x13'));var utils=require(_0xabb9('0x14'));var config=require(_0xabb9('0x15'));var licenseUtil=require(_0xabb9('0x16'));var db=require(_0xabb9('0x17'))['db'];function respondWithStatusCode(_0x64e9dd,_0xa23d64){_0xa23d64=_0xa23d64||0xcc;return function(_0x1ca9b5){if(_0x1ca9b5){return _0x64e9dd[_0xabb9('0x18')](_0xa23d64);}return _0x64e9dd['status'](_0xa23d64)[_0xabb9('0x19')]();};}function respondWithResult(_0x2810e7,_0xc711b1){_0xc711b1=_0xc711b1||0xc8;return function(_0x2e9fa5){if(_0x2e9fa5){return _0x2810e7['status'](_0xc711b1)[_0xabb9('0x1a')](_0x2e9fa5);}};}function respondWithFilteredResult(_0x237ed6,_0x3da9f0){return function(_0x1dc02a){if(_0x1dc02a){var _0x3ac35a=typeof _0x3da9f0[_0xabb9('0x1b')]===_0xabb9('0x1c')&&typeof _0x3da9f0[_0xabb9('0x1d')]==='undefined';var _0x325c1f=_0x1dc02a[_0xabb9('0x1e')];var _0x266ffc=_0x3ac35a?0x0:_0x3da9f0['offset'];var _0x445865=_0x3ac35a?_0x1dc02a['count']:_0x3da9f0[_0xabb9('0x1b')]+_0x3da9f0[_0xabb9('0x1d')];var _0xd2c9e5;if(_0x445865>=_0x325c1f){_0x445865=_0x325c1f;_0xd2c9e5=0xc8;}else{_0xd2c9e5=0xce;}_0x237ed6[_0xabb9('0x1f')](_0xd2c9e5);return _0x237ed6['set'](_0xabb9('0x20'),_0x266ffc+'-'+_0x445865+'/'+_0x325c1f)[_0xabb9('0x1a')](_0x1dc02a);}return null;};}function patchUpdates(_0x2db6ab){return function(_0x41888b){try{jsonpatch[_0xabb9('0x21')](_0x41888b,_0x2db6ab,!![]);}catch(_0x18af16){return BPromise['reject'](_0x18af16);}return _0x41888b[_0xabb9('0x22')]();};}function saveUpdates(_0x36697a,_0x2c15b2){return function(_0x3c77ff){if(_0x3c77ff){return _0x3c77ff[_0xabb9('0x23')](_0x36697a)[_0xabb9('0x24')](function(_0x3fe677){return _0x3fe677;});}return null;};}function removeEntity(_0x3f1c1c,_0x51127b){return function(_0x36a8d9){if(_0x36a8d9){return _0x36a8d9[_0xabb9('0x25')]()[_0xabb9('0x24')](function(){_0x3f1c1c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5acb31,_0x1578f5){return function(_0x4a8325){if(!_0x4a8325){_0x5acb31[_0xabb9('0x18')](0x194);}return _0x4a8325;};}function handleError(_0x756fcd,_0x2a8b87){_0x2a8b87=_0x2a8b87||0x1f4;return function(_0x2dde40){logger[_0xabb9('0x26')](_0x2dde40[_0xabb9('0x27')]);if(_0x2dde40['name']){delete _0x2dde40[_0xabb9('0x28')];}_0x756fcd['status'](_0x2a8b87)[_0xabb9('0x29')](_0x2dde40);};}exports['index']=function(_0x399a25,_0x33f2b3){var _0x3dd4d7={},_0x5e1a4c={},_0x934fec={'count':0x0,'rows':[]};var _0x157294=_[_0xabb9('0x2a')](db['SugarcrmField'][_0xabb9('0x2b')],function(_0x5d64e1){return{'name':_0x5d64e1[_0xabb9('0x2c')],'type':_0x5d64e1[_0xabb9('0x2d')][_0xabb9('0x2e')]};});_0x5e1a4c[_0xabb9('0x2f')]=_['map'](_0x157294,_0xabb9('0x28'));_0x5e1a4c[_0xabb9('0x30')]=_[_0xabb9('0x31')](_0x399a25[_0xabb9('0x30')]);_0x5e1a4c[_0xabb9('0x32')]=_[_0xabb9('0x33')](_0x5e1a4c['model'],_0x5e1a4c['query']);_0x3dd4d7[_0xabb9('0x34')]=_['intersection'](_0x5e1a4c[_0xabb9('0x2f')],qs[_0xabb9('0x35')](_0x399a25[_0xabb9('0x30')][_0xabb9('0x35')]));_0x3dd4d7[_0xabb9('0x34')]=_0x3dd4d7[_0xabb9('0x34')][_0xabb9('0x36')]?_0x3dd4d7[_0xabb9('0x34')]:_0x5e1a4c['model'];if(!_0x399a25['query'][_0xabb9('0x37')](_0xabb9('0x38'))){_0x3dd4d7[_0xabb9('0x1d')]=qs['limit'](_0x399a25[_0xabb9('0x30')][_0xabb9('0x1d')]);_0x3dd4d7[_0xabb9('0x1b')]=qs[_0xabb9('0x1b')](_0x399a25[_0xabb9('0x30')][_0xabb9('0x1b')]);}_0x3dd4d7[_0xabb9('0x39')]=qs[_0xabb9('0x3a')](_0x399a25[_0xabb9('0x30')][_0xabb9('0x3a')]);_0x3dd4d7[_0xabb9('0x3b')]=qs[_0xabb9('0x32')](_[_0xabb9('0x3c')](_0x399a25[_0xabb9('0x30')],_0x5e1a4c['filters']),_0x157294);if(_0x399a25[_0xabb9('0x30')][_0xabb9('0x3d')]){_0x3dd4d7[_0xabb9('0x3b')]=_[_0xabb9('0x3e')](_0x3dd4d7[_0xabb9('0x3b')],{'$or':_[_0xabb9('0x2a')](_0x157294,function(_0x4c11c2){if(_0x4c11c2[_0xabb9('0x2d')]!==_0xabb9('0x3f')){var _0x23bd99={};_0x23bd99[_0x4c11c2[_0xabb9('0x28')]]={'$like':'%'+_0x399a25[_0xabb9('0x30')][_0xabb9('0x3d')]+'%'};return _0x23bd99;}})});}_0x3dd4d7=_['merge']({},_0x3dd4d7,_0x399a25[_0xabb9('0x40')]);var _0x43b5f7={'where':_0x3dd4d7[_0xabb9('0x3b')]};return db['SugarcrmField'][_0xabb9('0x1e')](_0x43b5f7)[_0xabb9('0x24')](function(_0x40a6e5){_0x934fec[_0xabb9('0x1e')]=_0x40a6e5;if(_0x399a25['query'][_0xabb9('0x41')]){_0x3dd4d7[_0xabb9('0x42')]=[{'all':!![]}];}return db[_0xabb9('0x43')][_0xabb9('0x44')](_0x3dd4d7);})['then'](function(_0x29dca2){_0x934fec['rows']=_0x29dca2;return _0x934fec;})[_0xabb9('0x24')](respondWithFilteredResult(_0x33f2b3,_0x3dd4d7))[_0xabb9('0x45')](handleError(_0x33f2b3,null));};exports[_0xabb9('0x46')]=function(_0x38a8bf,_0x2c50ad){var _0x48498d={'raw':!![],'where':{'id':_0x38a8bf[_0xabb9('0x47')]['id']}},_0x2a8103={};_0x2a8103[_0xabb9('0x2f')]=_[_0xabb9('0x31')](db[_0xabb9('0x43')][_0xabb9('0x2b')]);_0x2a8103[_0xabb9('0x30')]=_[_0xabb9('0x31')](_0x38a8bf[_0xabb9('0x30')]);_0x2a8103[_0xabb9('0x32')]=_[_0xabb9('0x33')](_0x2a8103[_0xabb9('0x2f')],_0x2a8103[_0xabb9('0x30')]);_0x48498d['attributes']=_['intersection'](_0x2a8103['model'],qs[_0xabb9('0x35')](_0x38a8bf[_0xabb9('0x30')][_0xabb9('0x35')]));_0x48498d['attributes']=_0x48498d[_0xabb9('0x34')][_0xabb9('0x36')]?_0x48498d[_0xabb9('0x34')]:_0x2a8103[_0xabb9('0x2f')];if(_0x38a8bf['query'][_0xabb9('0x41')]){_0x48498d[_0xabb9('0x42')]=[{'all':!![]}];}_0x48498d=_[_0xabb9('0x3e')]({},_0x48498d,_0x38a8bf[_0xabb9('0x40')]);return db[_0xabb9('0x43')]['find'](_0x48498d)['then'](handleEntityNotFound(_0x2c50ad,null))[_0xabb9('0x24')](respondWithResult(_0x2c50ad,null))['catch'](handleError(_0x2c50ad,null));};exports['create']=function(_0x4c4987,_0x234623){return db[_0xabb9('0x43')]['create'](_0x4c4987['body'],{})['then'](respondWithResult(_0x234623,0xc9))[_0xabb9('0x45')](handleError(_0x234623,null));};exports[_0xabb9('0x23')]=function(_0x133bcf,_0x172229){if(_0x133bcf[_0xabb9('0x48')]['id']){delete _0x133bcf[_0xabb9('0x48')]['id'];}return db['SugarcrmField'][_0xabb9('0x49')]({'where':{'id':_0x133bcf[_0xabb9('0x47')]['id']}})['then'](handleEntityNotFound(_0x172229,null))['then'](saveUpdates(_0x133bcf[_0xabb9('0x48')],null))['then'](respondWithResult(_0x172229,null))[_0xabb9('0x45')](handleError(_0x172229,null));};exports[_0xabb9('0x25')]=function(_0x335379,_0xaa7fbc){return db[_0xabb9('0x43')][_0xabb9('0x49')]({'where':{'id':_0x335379[_0xabb9('0x47')]['id']}})[_0xabb9('0x24')](handleEntityNotFound(_0xaa7fbc,null))['then'](removeEntity(_0xaa7fbc,null))['catch'](handleError(_0xaa7fbc,null));}; \ No newline at end of file +var _0x5c9b=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SugarcrmField','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','includeAll','rows','catch','show','keys','include','options','find','create','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x108b23,_0x2bfcff){var _0x593ac8=function(_0x1d2953){while(--_0x1d2953){_0x108b23['push'](_0x108b23['shift']());}};_0x593ac8(++_0x2bfcff);}(_0x5c9b,0xd3));var _0xb5c9=function(_0x423ff6,_0x167bdc){_0x423ff6=_0x423ff6-0x0;var _0xc7c9db=_0x5c9b[_0x423ff6];return _0xc7c9db;};'use strict';var emlformat=require(_0xb5c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb5c9('0x1'));var jsonpatch=require(_0xb5c9('0x2'));var rp=require('request-promise');var moment=require(_0xb5c9('0x3'));var BPromise=require(_0xb5c9('0x4'));var Mustache=require(_0xb5c9('0x5'));var util=require(_0xb5c9('0x6'));var path=require(_0xb5c9('0x7'));var sox=require('sox');var csv=require(_0xb5c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb5c9('0x9'));var _=require(_0xb5c9('0xa'));var squel=require(_0xb5c9('0xb'));var crypto=require('crypto');var jsforce=require(_0xb5c9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb5c9('0x8'));var querystring=require(_0xb5c9('0xd'));var Papa=require(_0xb5c9('0xe'));var Redis=require(_0xb5c9('0xf'));var authService=require(_0xb5c9('0x10'));var qs=require(_0xb5c9('0x11'));var as=require(_0xb5c9('0x12'));var hardwareService=require(_0xb5c9('0x13'));var logger=require('../../config/logger')(_0xb5c9('0x14'));var utils=require(_0xb5c9('0x15'));var config=require(_0xb5c9('0x16'));var licenseUtil=require(_0xb5c9('0x17'));var db=require(_0xb5c9('0x18'))['db'];function respondWithStatusCode(_0x1494af,_0x391098){_0x391098=_0x391098||0xcc;return function(_0x15c4f2){if(_0x15c4f2){return _0x1494af[_0xb5c9('0x19')](_0x391098);}return _0x1494af['status'](_0x391098)[_0xb5c9('0x1a')]();};}function respondWithResult(_0x3f9e65,_0x2b1736){_0x2b1736=_0x2b1736||0xc8;return function(_0x38107d){if(_0x38107d){return _0x3f9e65[_0xb5c9('0x1b')](_0x2b1736)[_0xb5c9('0x1c')](_0x38107d);}};}function respondWithFilteredResult(_0x43344e,_0x1a13c4){return function(_0x4cc220){if(_0x4cc220){var _0x4b3d29=typeof _0x1a13c4[_0xb5c9('0x1d')]===_0xb5c9('0x1e')&&typeof _0x1a13c4['limit']===_0xb5c9('0x1e');var _0x4dd476=_0x4cc220[_0xb5c9('0x1f')];var _0x40019b=_0x4b3d29?0x0:_0x1a13c4[_0xb5c9('0x1d')];var _0x5a481c=_0x4b3d29?_0x4cc220[_0xb5c9('0x1f')]:_0x1a13c4['offset']+_0x1a13c4[_0xb5c9('0x20')];var _0x3efc3b;if(_0x5a481c>=_0x4dd476){_0x5a481c=_0x4dd476;_0x3efc3b=0xc8;}else{_0x3efc3b=0xce;}_0x43344e[_0xb5c9('0x1b')](_0x3efc3b);return _0x43344e[_0xb5c9('0x21')](_0xb5c9('0x22'),_0x40019b+'-'+_0x5a481c+'/'+_0x4dd476)[_0xb5c9('0x1c')](_0x4cc220);}return null;};}function patchUpdates(_0xa63861){return function(_0x54189c){try{jsonpatch[_0xb5c9('0x23')](_0x54189c,_0xa63861,!![]);}catch(_0x478863){return BPromise[_0xb5c9('0x24')](_0x478863);}return _0x54189c[_0xb5c9('0x25')]();};}function saveUpdates(_0x3ba98e,_0x4724bc){return function(_0x4c7f49){if(_0x4c7f49){return _0x4c7f49[_0xb5c9('0x26')](_0x3ba98e)[_0xb5c9('0x27')](function(_0x1b597f){return _0x1b597f;});}return null;};}function removeEntity(_0x36448e,_0x269d98){return function(_0x17ead1){if(_0x17ead1){return _0x17ead1[_0xb5c9('0x28')]()[_0xb5c9('0x27')](function(){_0x36448e[_0xb5c9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ec545,_0x217fa7){return function(_0x5c1ec8){if(!_0x5c1ec8){_0x3ec545['sendStatus'](0x194);}return _0x5c1ec8;};}function handleError(_0x49288b,_0x2d6e31){_0x2d6e31=_0x2d6e31||0x1f4;return function(_0x4b0509){logger[_0xb5c9('0x29')](_0x4b0509[_0xb5c9('0x2a')]);if(_0x4b0509[_0xb5c9('0x2b')]){delete _0x4b0509[_0xb5c9('0x2b')];}_0x49288b[_0xb5c9('0x1b')](_0x2d6e31)['send'](_0x4b0509);};}exports[_0xb5c9('0x2c')]=function(_0x42a6ec,_0x363936){var _0x55b404={},_0x2aba18={},_0x31910b={'count':0x0,'rows':[]};var _0xcda3de=_[_0xb5c9('0x2d')](db[_0xb5c9('0x2e')]['rawAttributes'],function(_0x57b20f){return{'name':_0x57b20f[_0xb5c9('0x2f')],'type':_0x57b20f[_0xb5c9('0x30')][_0xb5c9('0x31')]};});_0x2aba18[_0xb5c9('0x32')]=_['map'](_0xcda3de,_0xb5c9('0x2b'));_0x2aba18['query']=_['keys'](_0x42a6ec[_0xb5c9('0x33')]);_0x2aba18[_0xb5c9('0x34')]=_[_0xb5c9('0x35')](_0x2aba18[_0xb5c9('0x32')],_0x2aba18[_0xb5c9('0x33')]);_0x55b404['attributes']=_[_0xb5c9('0x35')](_0x2aba18['model'],qs['fields'](_0x42a6ec[_0xb5c9('0x33')][_0xb5c9('0x36')]));_0x55b404['attributes']=_0x55b404[_0xb5c9('0x37')][_0xb5c9('0x38')]?_0x55b404['attributes']:_0x2aba18[_0xb5c9('0x32')];if(!_0x42a6ec[_0xb5c9('0x33')][_0xb5c9('0x39')](_0xb5c9('0x3a'))){_0x55b404['limit']=qs['limit'](_0x42a6ec[_0xb5c9('0x33')]['limit']);_0x55b404[_0xb5c9('0x1d')]=qs[_0xb5c9('0x1d')](_0x42a6ec[_0xb5c9('0x33')]['offset']);}_0x55b404[_0xb5c9('0x3b')]=qs[_0xb5c9('0x3c')](_0x42a6ec[_0xb5c9('0x33')][_0xb5c9('0x3c')]);_0x55b404['where']=qs['filters'](_[_0xb5c9('0x3d')](_0x42a6ec['query'],_0x2aba18[_0xb5c9('0x34')]),_0xcda3de);if(_0x42a6ec[_0xb5c9('0x33')]['filter']){_0x55b404[_0xb5c9('0x3e')]=_['merge'](_0x55b404[_0xb5c9('0x3e')],{'$or':_[_0xb5c9('0x2d')](_0xcda3de,function(_0x4df536){if(_0x4df536[_0xb5c9('0x30')]!==_0xb5c9('0x3f')){var _0x4a1f42={};_0x4a1f42[_0x4df536[_0xb5c9('0x2b')]]={'$like':'%'+_0x42a6ec['query'][_0xb5c9('0x40')]+'%'};return _0x4a1f42;}})});}_0x55b404=_['merge']({},_0x55b404,_0x42a6ec['options']);var _0x4a9dd6={'where':_0x55b404[_0xb5c9('0x3e')]};return db[_0xb5c9('0x2e')][_0xb5c9('0x1f')](_0x4a9dd6)[_0xb5c9('0x27')](function(_0x2636f5){_0x31910b[_0xb5c9('0x1f')]=_0x2636f5;if(_0x42a6ec[_0xb5c9('0x33')][_0xb5c9('0x41')]){_0x55b404['include']=[{'all':!![]}];}return db[_0xb5c9('0x2e')]['findAll'](_0x55b404);})[_0xb5c9('0x27')](function(_0x10439a){_0x31910b[_0xb5c9('0x42')]=_0x10439a;return _0x31910b;})[_0xb5c9('0x27')](respondWithFilteredResult(_0x363936,_0x55b404))[_0xb5c9('0x43')](handleError(_0x363936,null));};exports[_0xb5c9('0x44')]=function(_0x5ca97e,_0x2f924e){var _0x31a200={'raw':!![],'where':{'id':_0x5ca97e['params']['id']}},_0x2a2957={};_0x2a2957['model']=_['keys'](db['SugarcrmField']['rawAttributes']);_0x2a2957[_0xb5c9('0x33')]=_[_0xb5c9('0x45')](_0x5ca97e[_0xb5c9('0x33')]);_0x2a2957[_0xb5c9('0x34')]=_[_0xb5c9('0x35')](_0x2a2957['model'],_0x2a2957['query']);_0x31a200[_0xb5c9('0x37')]=_[_0xb5c9('0x35')](_0x2a2957[_0xb5c9('0x32')],qs[_0xb5c9('0x36')](_0x5ca97e[_0xb5c9('0x33')][_0xb5c9('0x36')]));_0x31a200[_0xb5c9('0x37')]=_0x31a200['attributes'][_0xb5c9('0x38')]?_0x31a200[_0xb5c9('0x37')]:_0x2a2957[_0xb5c9('0x32')];if(_0x5ca97e['query']['includeAll']){_0x31a200[_0xb5c9('0x46')]=[{'all':!![]}];}_0x31a200=_['merge']({},_0x31a200,_0x5ca97e[_0xb5c9('0x47')]);return db[_0xb5c9('0x2e')][_0xb5c9('0x48')](_0x31a200)[_0xb5c9('0x27')](handleEntityNotFound(_0x2f924e,null))[_0xb5c9('0x27')](respondWithResult(_0x2f924e,null))[_0xb5c9('0x43')](handleError(_0x2f924e,null));};exports[_0xb5c9('0x49')]=function(_0x127da7,_0xe8f50b){return db[_0xb5c9('0x2e')][_0xb5c9('0x49')](_0x127da7[_0xb5c9('0x4a')],{})[_0xb5c9('0x27')](respondWithResult(_0xe8f50b,0xc9))[_0xb5c9('0x43')](handleError(_0xe8f50b,null));};exports[_0xb5c9('0x26')]=function(_0x48949b,_0x1e43c3){if(_0x48949b['body']['id']){delete _0x48949b[_0xb5c9('0x4a')]['id'];}return db[_0xb5c9('0x2e')][_0xb5c9('0x48')]({'where':{'id':_0x48949b[_0xb5c9('0x4b')]['id']}})[_0xb5c9('0x27')](handleEntityNotFound(_0x1e43c3,null))['then'](saveUpdates(_0x48949b[_0xb5c9('0x4a')],null))[_0xb5c9('0x27')](respondWithResult(_0x1e43c3,null))[_0xb5c9('0x43')](handleError(_0x1e43c3,null));};exports[_0xb5c9('0x28')]=function(_0x16d52a,_0x4fd918){return db[_0xb5c9('0x2e')]['find']({'where':{'id':_0x16d52a[_0xb5c9('0x4b')]['id']}})[_0xb5c9('0x27')](handleEntityNotFound(_0x4fd918,null))[_0xb5c9('0x27')](removeEntity(_0x4fd918,null))[_0xb5c9('0x43')](handleError(_0x4fd918,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 2f30f2f..578bd25 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 _0xb957=['bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','idField','lodash','util','../../config/logger','api','moment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb957,0x145));var _0x7b95=function(_0x3fdbdc,_0x3d0ffb){_0x3fdbdc=_0x3fdbdc-0x0;var _0x1e2c47=_0xb957[_0x3fdbdc];return _0x1e2c47;};'use strict';var _=require(_0x7b95('0x0'));var util=require(_0x7b95('0x1'));var logger=require(_0x7b95('0x2'))(_0x7b95('0x3'));var moment=require(_0x7b95('0x4'));var BPromise=require(_0x7b95('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b95('0x6'));var rimraf=require(_0x7b95('0x7'));var config=require(_0x7b95('0x8'));var attributes=require(_0x7b95('0x9'));module[_0x7b95('0xa')]=function(_0x51ba05,_0x585fe0){return _0x51ba05[_0x7b95('0xb')](_0x7b95('0xc'),attributes,{'tableName':_0x7b95('0xd'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x7b95('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0c92=['api','request-promise','rimraf','../../config/environment','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x0c92,0x183));var _0x20c9=function(_0x450076,_0x10983b){_0x450076=_0x450076-0x0;var _0x2029cc=_0x0c92[_0x450076];return _0x2029cc;};'use strict';var _=require(_0x20c9('0x0'));var util=require(_0x20c9('0x1'));var logger=require(_0x20c9('0x2'))(_0x20c9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x20c9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x20c9('0x5'));var config=require(_0x20c9('0x6'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x2e8399,_0x41a7d2){return _0x2e8399[_0x20c9('0x7')](_0x20c9('0x8'),attributes,{'tableName':_0x20c9('0x9'),'paranoid':![],'indexes':[{'name':_0x20c9('0xa'),'fields':[_0x20c9('0xb'),_0x20c9('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index bc56f20..7bddc6b 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 _0x6d73=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6d73,0x66));var _0x36d7=function(_0xf75663,_0x181505){_0xf75663=_0xf75663-0x0;var _0x38e6e9=_0x6d73[_0xf75663];return _0x38e6e9;};'use strict';var _=require(_0x36d7('0x0'));var util=require(_0x36d7('0x1'));var moment=require(_0x36d7('0x2'));var BPromise=require(_0x36d7('0x3'));var rs=require(_0x36d7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x36d7('0x5'))['db'];var utils=require(_0x36d7('0x6'));var logger=require(_0x36d7('0x7'))(_0x36d7('0x8'));var config=require(_0x36d7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x36d7('0xa')][_0x36d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x574db2,_0x4b9867,_0x306491){return new BPromise(function(_0x41dc94,_0x95a645){return client[_0x36d7('0xc')](_0x574db2,_0x306491)[_0x36d7('0xd')](function(_0x104d6c){logger[_0x36d7('0xe')](_0x36d7('0xf'),_0x4b9867,_0x36d7('0x10'));logger[_0x36d7('0x11')](_0x36d7('0x12'),_0x4b9867,_0x36d7('0x10'),JSON[_0x36d7('0x13')](_0x104d6c));if(_0x104d6c[_0x36d7('0x14')]){if(_0x104d6c['error'][_0x36d7('0x15')]===0x1f4){logger[_0x36d7('0x14')](_0x36d7('0xf'),_0x4b9867,_0x104d6c['error'][_0x36d7('0x16')]);return _0x95a645(_0x104d6c['error'][_0x36d7('0x16')]);}logger[_0x36d7('0x14')](_0x36d7('0xf'),_0x4b9867,_0x104d6c[_0x36d7('0x14')][_0x36d7('0x16')]);return _0x41dc94(_0x104d6c['error'][_0x36d7('0x16')]);}else{logger[_0x36d7('0xe')](_0x36d7('0xf'),_0x4b9867,_0x36d7('0x10'));_0x41dc94(_0x104d6c[_0x36d7('0x17')][_0x36d7('0x16')]);}})[_0x36d7('0x18')](function(_0xa63d53){logger[_0x36d7('0x14')]('SugarcrmField,\x20%s,\x20%s',_0x4b9867,_0xa63d53);_0x95a645(_0xa63d53);});});} \ No newline at end of file +var _0xf033=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch'];(function(_0x32b2df,_0x3c4f0e){var _0x6ad5ba=function(_0x49df89){while(--_0x49df89){_0x32b2df['push'](_0x32b2df['shift']());}};_0x6ad5ba(++_0x3c4f0e);}(_0xf033,0xa1));var _0x3f03=function(_0x132d9e,_0x4a0839){_0x132d9e=_0x132d9e-0x0;var _0x40b733=_0xf033[_0x132d9e];return _0x40b733;};'use strict';var _=require(_0x3f03('0x0'));var util=require('util');var moment=require(_0x3f03('0x1'));var BPromise=require('bluebird');var rs=require(_0x3f03('0x2'));var fs=require('fs');var Redis=require(_0x3f03('0x3'));var db=require(_0x3f03('0x4'))['db'];var utils=require(_0x3f03('0x5'));var logger=require(_0x3f03('0x6'))(_0x3f03('0x7'));var config=require(_0x3f03('0x8'));var jayson=require(_0x3f03('0x9'));var client=jayson[_0x3f03('0xa')][_0x3f03('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f94ea,_0x8f6d23,_0x2d23d5){return new BPromise(function(_0x19f75a,_0x3467db){return client[_0x3f03('0xc')](_0x2f94ea,_0x2d23d5)[_0x3f03('0xd')](function(_0x426028){logger['info'](_0x3f03('0xe'),_0x8f6d23,_0x3f03('0xf'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x8f6d23,'request\x20sent',JSON[_0x3f03('0x10')](_0x426028));if(_0x426028['error']){if(_0x426028['error'][_0x3f03('0x11')]===0x1f4){logger[_0x3f03('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x8f6d23,_0x426028[_0x3f03('0x12')][_0x3f03('0x13')]);return _0x3467db(_0x426028[_0x3f03('0x12')][_0x3f03('0x13')]);}logger[_0x3f03('0x12')](_0x3f03('0xe'),_0x8f6d23,_0x426028[_0x3f03('0x12')][_0x3f03('0x13')]);return _0x19f75a(_0x426028[_0x3f03('0x12')][_0x3f03('0x13')]);}else{logger[_0x3f03('0x14')](_0x3f03('0xe'),_0x8f6d23,_0x3f03('0xf'));_0x19f75a(_0x426028[_0x3f03('0x15')]['message']);}})[_0x3f03('0x16')](function(_0x41ab8c){logger[_0x3f03('0x12')](_0x3f03('0xe'),_0x8f6d23,_0x41ab8c);_0x3467db(_0x41ab8c);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index f6fef0b..3290b2f 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 _0xd73a=['getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x57d058,_0xb58cfe){var _0x312d74=function(_0x44e969){while(--_0x44e969){_0x57d058['push'](_0x57d058['shift']());}};_0x312d74(++_0xb58cfe);}(_0xd73a,0x171));var _0xad73=function(_0x2f7c1e,_0x490fae){_0x2f7c1e=_0x2f7c1e-0x0;var _0x1fc665=_0xd73a[_0x2f7c1e];return _0x1fc665;};'use strict';var multer=require(_0xad73('0x0'));var util=require(_0xad73('0x1'));var path=require(_0xad73('0x2'));var timeout=require(_0xad73('0x3'));var express=require(_0xad73('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xad73('0x5'));var interaction=require(_0xad73('0x6'));var config=require(_0xad73('0x7'));var controller=require(_0xad73('0x8'));router[_0xad73('0x9')]('/',auth[_0xad73('0xa')](),controller[_0xad73('0xb')]);router[_0xad73('0x9')](_0xad73('0xc'),auth[_0xad73('0xa')](),controller[_0xad73('0xd')]);router['get'](_0xad73('0xe'),auth['isAuthenticated'](),controller[_0xad73('0xf')]);router[_0xad73('0x9')](_0xad73('0x10'),auth['isAuthenticated'](),controller[_0xad73('0x11')]);router['post']('/',auth[_0xad73('0xa')](),controller['create']);router[_0xad73('0x12')](_0xad73('0xe'),auth[_0xad73('0xa')](),controller['addConfiguration']);router[_0xad73('0x13')](_0xad73('0xc'),auth['isAuthenticated'](),controller[_0xad73('0x14')]);router[_0xad73('0x15')](_0xad73('0xc'),auth[_0xad73('0xa')](),controller[_0xad73('0x16')]);module[_0xad73('0x17')]=router; \ No newline at end of file +var _0xbec5=['/:id','isAuthenticated','show','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','index'];(function(_0x53e997,_0x19ea9f){var _0xfb83dc=function(_0xc8b92a){while(--_0xc8b92a){_0x53e997['push'](_0x53e997['shift']());}};_0xfb83dc(++_0x19ea9f);}(_0xbec5,0xe5));var _0x5bec=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xbec5[_0x2642cb];return _0xe6e41;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0xd')]);router[_0x5bec('0x9')](_0x5bec('0xe'),auth[_0x5bec('0xc')](),controller['getConfigurations']);router[_0x5bec('0x9')]('/:id/fields',auth[_0x5bec('0xc')](),controller[_0x5bec('0xf')]);router[_0x5bec('0x10')]('/',auth['isAuthenticated'](),controller[_0x5bec('0x11')]);router[_0x5bec('0x10')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x12')]);router[_0x5bec('0x13')]('/:id',auth[_0x5bec('0xc')](),controller[_0x5bec('0x14')]);router[_0x5bec('0x15')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0x16')]);module[_0x5bec('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index cee18ec..535b22c 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 _0xa958=['STRING','HelpDesk','sequelize','exports'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xa958,0xaa));var _0x8a95=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa958[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0x8a95('0x0'));module[_0x8a95('0x1')]={'name':{'type':Sequelize[_0x8a95('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8a95('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8a95('0x2')],'allowNull':![],'defaultValue':_0x8a95('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8a95('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x04fd=['STRING','exports'];(function(_0xabd41c,_0x171457){var _0x96399d=function(_0x46bcfe){while(--_0x46bcfe){_0xabd41c['push'](_0xabd41c['shift']());}};_0x96399d(++_0x171457);}(_0x04fd,0x1a7));var _0xd04f=function(_0x1cf67e,_0x1321f5){_0x1cf67e=_0x1cf67e-0x0;var _0x5a8fc9=_0x04fd[_0x1cf67e];return _0x5a8fc9;};'use strict';var Sequelize=require('sequelize');module[_0xd04f('0x0')]={'name':{'type':Sequelize[_0xd04f('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd04f('0x1')]},'username':{'type':Sequelize[_0xd04f('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xd04f('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xd04f('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xd04f('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xd04f('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 299533d..eaf5071 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 _0xceaf=['VtigerConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','%s/webservice.php','success','result','GET','describe','owner','remove','editable','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','catch','body','find','getConfigurations'];(function(_0x3370aa,_0x282cfc){var _0xa5801a=function(_0x22144e){while(--_0x22144e){_0x3370aa['push'](_0x3370aa['shift']());}};_0xa5801a(++_0x282cfc);}(_0xceaf,0x10e));var _0xfcea=function(_0x171259,_0x45bdc3){_0x171259=_0x171259-0x0;var _0x42223d=_0xceaf[_0x171259];return _0x42223d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfcea('0x0'));var zipdir=require(_0xfcea('0x1'));var jsonpatch=require(_0xfcea('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfcea('0x3'));var Mustache=require(_0xfcea('0x4'));var util=require(_0xfcea('0x5'));var path=require(_0xfcea('0x6'));var sox=require(_0xfcea('0x7'));var csv=require(_0xfcea('0x8'));var ejs=require(_0xfcea('0x9'));var fs=require('fs');var fs_extra=require(_0xfcea('0xa'));var _=require('lodash');var squel=require(_0xfcea('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfcea('0xc'));var toCsv=require(_0xfcea('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfcea('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xfcea('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcea('0xf'));var logger=require(_0xfcea('0x10'))(_0xfcea('0x11'));var utils=require(_0xfcea('0x12'));var config=require(_0xfcea('0x13'));var licenseUtil=require(_0xfcea('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfcea('0x15'));function respondWithStatusCode(_0x4beeff,_0x5c414e){_0x5c414e=_0x5c414e||0xcc;return function(_0x527b73){if(_0x527b73){return _0x4beeff['sendStatus'](_0x5c414e);}return _0x4beeff[_0xfcea('0x16')](_0x5c414e)[_0xfcea('0x17')]();};}function respondWithResult(_0x17592c,_0x5b0669){_0x5b0669=_0x5b0669||0xc8;return function(_0x2fdb6e){if(_0x2fdb6e){return _0x17592c['status'](_0x5b0669)['json'](_0x2fdb6e);}};}function respondWithFilteredResult(_0x7fa2d,_0xdb55b4){return function(_0x5b153){if(_0x5b153){var _0x97633d=typeof _0xdb55b4[_0xfcea('0x18')]===_0xfcea('0x19')&&typeof _0xdb55b4[_0xfcea('0x1a')]===_0xfcea('0x19');var _0x5c17ec=_0x5b153[_0xfcea('0x1b')];var _0x15ab1d=_0x97633d?0x0:_0xdb55b4[_0xfcea('0x18')];var _0x4c2cb4=_0x97633d?_0x5b153[_0xfcea('0x1b')]:_0xdb55b4['offset']+_0xdb55b4[_0xfcea('0x1a')];var _0x2dba7a;if(_0x4c2cb4>=_0x5c17ec){_0x4c2cb4=_0x5c17ec;_0x2dba7a=0xc8;}else{_0x2dba7a=0xce;}_0x7fa2d[_0xfcea('0x16')](_0x2dba7a);return _0x7fa2d[_0xfcea('0x1c')](_0xfcea('0x1d'),_0x15ab1d+'-'+_0x4c2cb4+'/'+_0x5c17ec)['json'](_0x5b153);}return null;};}function patchUpdates(_0xe7f838){return function(_0xf992f7){try{jsonpatch[_0xfcea('0x1e')](_0xf992f7,_0xe7f838,!![]);}catch(_0x237d6b){return BPromise[_0xfcea('0x1f')](_0x237d6b);}return _0xf992f7[_0xfcea('0x20')]();};}function saveUpdates(_0x1ba120,_0x450d2b){return function(_0x585aa1){if(_0x585aa1){return _0x585aa1[_0xfcea('0x21')](_0x1ba120)[_0xfcea('0x22')](function(_0x4dbb1e){return _0x4dbb1e;});}return null;};}function removeEntity(_0x251e9b,_0x2b7d8d){return function(_0x1f3f6d){if(_0x1f3f6d){return _0x1f3f6d[_0xfcea('0x23')]()[_0xfcea('0x22')](function(){_0x251e9b[_0xfcea('0x16')](0xcc)[_0xfcea('0x17')]();});}};}function handleEntityNotFound(_0x1dc7ae,_0x3ca7bd){return function(_0x1b2ec0){if(!_0x1b2ec0){_0x1dc7ae['sendStatus'](0x194);}return _0x1b2ec0;};}function handleError(_0x465d76,_0x3af2b1){_0x3af2b1=_0x3af2b1||0x1f4;return function(_0x4a8986){logger[_0xfcea('0x24')](_0x4a8986[_0xfcea('0x25')]);if(_0x4a8986[_0xfcea('0x26')]){delete _0x4a8986[_0xfcea('0x26')];}_0x465d76[_0xfcea('0x16')](_0x3af2b1)[_0xfcea('0x27')](_0x4a8986);};}exports[_0xfcea('0x28')]=function(_0x43798e,_0x372263){var _0x52493f={},_0xeb02e7={},_0x522261={'count':0x0,'rows':[]};var _0x376172=_[_0xfcea('0x29')](db[_0xfcea('0x2a')][_0xfcea('0x2b')],function(_0x3ea23b){return{'name':_0x3ea23b[_0xfcea('0x2c')],'type':_0x3ea23b['type'][_0xfcea('0x2d')]};});_0xeb02e7['model']=_[_0xfcea('0x29')](_0x376172,'name');_0xeb02e7[_0xfcea('0x2e')]=_[_0xfcea('0x2f')](_0x43798e[_0xfcea('0x2e')]);_0xeb02e7[_0xfcea('0x30')]=_[_0xfcea('0x31')](_0xeb02e7['model'],_0xeb02e7[_0xfcea('0x2e')]);_0x52493f['attributes']=_[_0xfcea('0x31')](_0xeb02e7[_0xfcea('0x32')],qs[_0xfcea('0x33')](_0x43798e[_0xfcea('0x2e')][_0xfcea('0x33')]));_0x52493f[_0xfcea('0x34')]=_0x52493f[_0xfcea('0x34')][_0xfcea('0x35')]?_0x52493f[_0xfcea('0x34')]:_0xeb02e7[_0xfcea('0x32')];if(!_0x43798e['query']['hasOwnProperty'](_0xfcea('0x36'))){_0x52493f['limit']=qs[_0xfcea('0x1a')](_0x43798e[_0xfcea('0x2e')][_0xfcea('0x1a')]);_0x52493f[_0xfcea('0x18')]=qs[_0xfcea('0x18')](_0x43798e[_0xfcea('0x2e')][_0xfcea('0x18')]);}_0x52493f[_0xfcea('0x37')]=qs[_0xfcea('0x38')](_0x43798e['query'][_0xfcea('0x38')]);_0x52493f['where']=qs[_0xfcea('0x30')](_[_0xfcea('0x39')](_0x43798e['query'],_0xeb02e7[_0xfcea('0x30')]),_0x376172);if(_0x43798e['query'][_0xfcea('0x3a')]){_0x52493f[_0xfcea('0x3b')]=_[_0xfcea('0x3c')](_0x52493f[_0xfcea('0x3b')],{'$or':_[_0xfcea('0x29')](_0x376172,function(_0x247447){if(_0x247447[_0xfcea('0x3d')]!==_0xfcea('0x3e')){var _0x3be3c7={};_0x3be3c7[_0x247447[_0xfcea('0x26')]]={'$like':'%'+_0x43798e[_0xfcea('0x2e')][_0xfcea('0x3a')]+'%'};return _0x3be3c7;}})});}_0x52493f=_['merge']({},_0x52493f,_0x43798e[_0xfcea('0x3f')]);var _0x194e25={'where':_0x52493f[_0xfcea('0x3b')]};return db['VtigerAccount'][_0xfcea('0x1b')](_0x194e25)[_0xfcea('0x22')](function(_0x560704){_0x522261['count']=_0x560704;if(_0x43798e['query'][_0xfcea('0x40')]){_0x52493f[_0xfcea('0x41')]=[{'all':!![]}];}return db[_0xfcea('0x2a')][_0xfcea('0x42')](_0x52493f);})['then'](function(_0x3ee5e5){_0x522261[_0xfcea('0x43')]=_0x3ee5e5;return _0x522261;})[_0xfcea('0x22')](respondWithFilteredResult(_0x372263,_0x52493f))['catch'](handleError(_0x372263,null));};exports[_0xfcea('0x44')]=function(_0x2fe028,_0x367079){var _0x196100={'raw':![],'where':{'id':_0x2fe028[_0xfcea('0x45')]['id']}},_0x550556={};_0x550556['model']=_[_0xfcea('0x2f')](db[_0xfcea('0x2a')][_0xfcea('0x2b')]);_0x550556[_0xfcea('0x2e')]=_['keys'](_0x2fe028['query']);_0x550556[_0xfcea('0x30')]=_['intersection'](_0x550556['model'],_0x550556[_0xfcea('0x2e')]);_0x196100[_0xfcea('0x34')]=_[_0xfcea('0x31')](_0x550556['model'],qs[_0xfcea('0x33')](_0x2fe028[_0xfcea('0x2e')][_0xfcea('0x33')]));_0x196100['attributes']=_0x196100[_0xfcea('0x34')][_0xfcea('0x35')]?_0x196100[_0xfcea('0x34')]:_0x550556[_0xfcea('0x32')];if(_0x2fe028[_0xfcea('0x2e')]['includeAll']){_0x196100[_0xfcea('0x41')]=[{'all':!![]}];}_0x196100=_[_0xfcea('0x3c')]({},_0x196100,_0x2fe028['options']);return db[_0xfcea('0x2a')]['find'](_0x196100)[_0xfcea('0x22')](handleEntityNotFound(_0x367079,null))['then'](respondWithResult(_0x367079,null))['catch'](handleError(_0x367079,null));};exports[_0xfcea('0x46')]=function(_0x7f229a,_0x5324d0){return db[_0xfcea('0x2a')][_0xfcea('0x46')](_0x7f229a['body'],{})['then'](respondWithResult(_0x5324d0,0xc9))[_0xfcea('0x47')](handleError(_0x5324d0,null));};exports[_0xfcea('0x21')]=function(_0x4b4067,_0x2f9fb2){if(_0x4b4067[_0xfcea('0x48')]['id']){delete _0x4b4067[_0xfcea('0x48')]['id'];}return db[_0xfcea('0x2a')]['find']({'where':{'id':_0x4b4067[_0xfcea('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f9fb2,null))[_0xfcea('0x22')](saveUpdates(_0x4b4067[_0xfcea('0x48')],null))[_0xfcea('0x22')](respondWithResult(_0x2f9fb2,null))['catch'](handleError(_0x2f9fb2,null));};exports[_0xfcea('0x23')]=function(_0x49c25f,_0x3763cd){return db[_0xfcea('0x2a')][_0xfcea('0x49')]({'where':{'id':_0x49c25f['params']['id']}})[_0xfcea('0x22')](handleEntityNotFound(_0x3763cd,null))[_0xfcea('0x22')](removeEntity(_0x3763cd,null))[_0xfcea('0x47')](handleError(_0x3763cd,null));};exports[_0xfcea('0x4a')]=function(_0x5cc0d9,_0x2c29cc,_0x3de487){var _0x383e50={};var _0x281fb2={};var _0x150640;var _0x5ce854;return db[_0xfcea('0x2a')]['findOne']({'where':{'id':_0x5cc0d9[_0xfcea('0x45')]['id']}})[_0xfcea('0x22')](handleEntityNotFound(_0x2c29cc,null))[_0xfcea('0x22')](function(_0x54ebc2){if(_0x54ebc2){_0x150640=_0x54ebc2;_0x281fb2[_0xfcea('0x32')]=_[_0xfcea('0x2f')](db[_0xfcea('0x4b')][_0xfcea('0x2b')]);_0x281fb2[_0xfcea('0x2e')]=_['keys'](_0x5cc0d9[_0xfcea('0x2e')]);_0x281fb2[_0xfcea('0x30')]=_['intersection'](_0x281fb2[_0xfcea('0x32')],_0x281fb2[_0xfcea('0x2e')]);_0x383e50[_0xfcea('0x34')]=_[_0xfcea('0x31')](_0x281fb2[_0xfcea('0x32')],qs['fields'](_0x5cc0d9[_0xfcea('0x2e')][_0xfcea('0x33')]));_0x383e50[_0xfcea('0x34')]=_0x383e50[_0xfcea('0x34')][_0xfcea('0x35')]?_0x383e50[_0xfcea('0x34')]:_0x281fb2[_0xfcea('0x32')];_0x383e50[_0xfcea('0x37')]=qs[_0xfcea('0x38')](_0x5cc0d9[_0xfcea('0x2e')][_0xfcea('0x38')]);_0x383e50[_0xfcea('0x3b')]=qs[_0xfcea('0x30')](_[_0xfcea('0x39')](_0x5cc0d9[_0xfcea('0x2e')],_0x281fb2[_0xfcea('0x30')]));if(_0x5cc0d9['query'][_0xfcea('0x3a')]){_0x383e50['where']=_[_0xfcea('0x3c')](_0x383e50['where'],{'$or':_['map'](_0x383e50['attributes'],function(_0x5adc8e){var _0x216d59={};_0x216d59[_0x5adc8e]={'$like':'%'+_0x5cc0d9[_0xfcea('0x2e')]['filter']+'%'};return _0x216d59;})});}_0x383e50=_[_0xfcea('0x3c')]({},_0x383e50,_0x5cc0d9[_0xfcea('0x3f')]);return _0x150640['getConfigurations'](_0x383e50);}})[_0xfcea('0x22')](function(_0x4ce307){if(_0x4ce307){_0x5ce854=_0x4ce307[_0xfcea('0x35')];if(!_0x5cc0d9[_0xfcea('0x2e')][_0xfcea('0x4c')](_0xfcea('0x36'))){_0x383e50['limit']=qs['limit'](_0x5cc0d9[_0xfcea('0x2e')][_0xfcea('0x1a')]);_0x383e50[_0xfcea('0x18')]=qs[_0xfcea('0x18')](_0x5cc0d9[_0xfcea('0x2e')][_0xfcea('0x18')]);}return _0x150640[_0xfcea('0x4a')](_0x383e50);}})[_0xfcea('0x22')](function(_0x3ccdba){if(_0x3ccdba){return _0x3ccdba?{'count':_0x5ce854,'rows':_0x3ccdba}:null;}})[_0xfcea('0x22')](respondWithResult(_0x2c29cc,null))['catch'](handleError(_0x2c29cc,null));};exports[_0xfcea('0x4d')]=function(_0x30575d,_0x27adc0,_0x3da60d){if(_0x30575d[_0xfcea('0x48')]['id']){delete _0x30575d['body']['id'];}return db[_0xfcea('0x2a')][_0xfcea('0x4e')]({'where':{'id':_0x30575d[_0xfcea('0x45')]['id']}})[_0xfcea('0x22')](handleEntityNotFound(_0x27adc0,null))['then'](function(_0x13f46d){if(_0x13f46d){_0x30575d[_0xfcea('0x48')][_0xfcea('0x4f')]=_0x13f46d['id'];_0x30575d[_0xfcea('0x48')][_0xfcea('0x50')]=integrations[_0xfcea('0x51')](_0x30575d[_0xfcea('0x48')][_0xfcea('0x52')],_0x30575d[_0xfcea('0x48')][_0xfcea('0x3d')]);_0x30575d[_0xfcea('0x48')][_0xfcea('0x53')]=integrations[_0xfcea('0x54')](_0x30575d['body'][_0xfcea('0x52')],_0x30575d[_0xfcea('0x48')]['type']);return db[_0xfcea('0x4b')][_0xfcea('0x46')](_0x30575d[_0xfcea('0x48')],{'include':[{'model':db[_0xfcea('0x55')],'as':_0xfcea('0x50')},{'model':db[_0xfcea('0x55')],'as':_0xfcea('0x53')}]});}return null;})['then'](respondWithResult(_0x27adc0,null))['catch'](handleError(_0x27adc0,null));};var md5=require('md5');exports[_0xfcea('0x56')]=function(_0x5001e8,_0x4936f1,_0x1b5794){var _0x2d2d38=null;var _0x50639b=null;var _0xe7a95d=null;var _0x3a30e1=null;var _0x32c7c1='';return db['VtigerAccount'][_0xfcea('0x4e')]({'where':{'id':_0x5001e8[_0xfcea('0x45')]['id']},'attributes':['id','name',_0xfcea('0x57'),'description',_0xfcea('0x58'),_0xfcea('0x59'),_0xfcea('0x5a'),'accessKey']})['then'](handleEntityNotFound(_0x4936f1,null))[_0xfcea('0x22')](function(_0x5dd9b2){if(_0x5dd9b2){_0x2d2d38=_0x5dd9b2[_0xfcea('0x57')];_0x50639b=_0x5dd9b2[_0xfcea('0x5b')];_0xe7a95d=_0x5dd9b2[_0xfcea('0x58')];_0x32c7c1=_0x5dd9b2[_0xfcea('0x59')];var _0x565fda=_0x32c7c1[_0xfcea('0x5c')](-0x1);if(_0x565fda==='/'){_0x32c7c1=_0x32c7c1[_0xfcea('0x5d')](0x0,_0x32c7c1[_0xfcea('0x5e')](_0x565fda));}_0x3a30e1=util['format'](_0xfcea('0x5f'),_0x32c7c1);var _0x3d51a3={'method':'GET','uri':_0x3a30e1,'qs':{'operation':'getchallenge','username':_0x5dd9b2[_0xfcea('0x57')]},'json':!![]};return rp(_0x3d51a3);}})[_0xfcea('0x22')](function(_0x458c5e){if(_0x458c5e[_0xfcea('0x60')]){var _0x623541={'method':'POST','uri':_0x3a30e1,'form':{'operation':'login','username':_0x2d2d38,'accessKey':md5(_0x458c5e[_0xfcea('0x61')]['token']+_0x50639b)},'json':!![]};return rp(_0x623541);}})[_0xfcea('0x22')](function(_0xab45e2){if(_0xab45e2[_0xfcea('0x60')]){var _0x50d70a={'method':_0xfcea('0x62'),'uri':_0x3a30e1,'qs':{'operation':_0xfcea('0x63'),'username':_0x2d2d38,'sessionName':_0xab45e2[_0xfcea('0x61')]['sessionName'],'elementType':_0xe7a95d},'json':!![]};return rp(_0x50d70a);}})[_0xfcea('0x22')](function(_0x43fad0){if(_0x43fad0['success']){var _0x2c26ee=['autogenerated','reference',_0xfcea('0x64')];_[_0xfcea('0x65')](_0x43fad0[_0xfcea('0x61')][_0xfcea('0x33')],function(_0x2976cb){return _0x2c26ee['includes'](_0x2976cb[_0xfcea('0x3d')][_0xfcea('0x26')]);});_[_0xfcea('0x65')](_0x43fad0[_0xfcea('0x61')][_0xfcea('0x33')],function(_0x539110){return _0x539110[_0xfcea('0x66')]==='false';});return{'count':_0x43fad0['result'][_0xfcea('0x33')][_0xfcea('0x35')],'rows':_[_0xfcea('0x29')](_0x43fad0[_0xfcea('0x61')]['fields'],function(_0x4c76a0){return{'id':_0x4c76a0[_0xfcea('0x26')],'name':_0x4c76a0[_0xfcea('0x67')],'custom':_[_0xfcea('0x68')](_0x4c76a0[_0xfcea('0x26')],_0xfcea('0x69'))?!![]:![],'options':_0x4c76a0[_0xfcea('0x3d')][_0xfcea('0x26')]===_0xfcea('0x6a')&&_0x4c76a0[_0xfcea('0x3d')][_0xfcea('0x6b')][_0xfcea('0x35')]>0x0?_[_0xfcea('0x29')](_0x4c76a0[_0xfcea('0x3d')]['picklistValues'],function(_0xa661e1){return{'name':_0xa661e1[_0xfcea('0x67')],'value':_0xa661e1[_0xfcea('0x6c')]};}):[]};})};}})[_0xfcea('0x22')](respondWithResult(_0x4936f1,null))[_0xfcea('0x47')](function(_0x3e754e){console[_0xfcea('0x6d')](_0xfcea('0x6e')+_0x3e754e);var _0x5eaf77=_0x5001e8[_0xfcea('0x2e')][_0xfcea('0x6f')]?0x1f4:_0x3e754e['statusCode']||0x1f4;logger[_0xfcea('0x24')](_0xfcea('0x70'),'getFields',_0x5eaf77,JSON['stringify'](_0x3e754e));delete _0x3e754e[_0xfcea('0x26')];if(_0x5eaf77===0x191){_0x5eaf77=0x190;}_0x4936f1[_0xfcea('0x16')](_0x5eaf77)[_0xfcea('0x27')](_0x5001e8[_0xfcea('0x2e')][_0xfcea('0x6f')]?{'message':_0xfcea('0x71'),'statusCode':_0x3e754e[_0xfcea('0x72')]}:_0x3e754e);});}; \ No newline at end of file +var _0x92eb=['sort','pick','where','type','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','intersection','include','create','body','find','getConfigurations','findOne','VtigerConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','format','GET','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','reference','remove','includes','editable','false','label','startsWith','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x2788e5,_0x562bf4){var _0x7b12fd=function(_0x462a59){while(--_0x462a59){_0x2788e5['push'](_0x2788e5['shift']());}};_0x7b12fd(++_0x562bf4);}(_0x92eb,0xbf));var _0xb92e=function(_0x494101,_0x411e3b){_0x494101=_0x494101-0x0;var _0x41d64c=_0x92eb[_0x494101];return _0x41d64c;};'use strict';var emlformat=require(_0xb92e('0x0'));var rimraf=require(_0xb92e('0x1'));var zipdir=require(_0xb92e('0x2'));var jsonpatch=require(_0xb92e('0x3'));var rp=require(_0xb92e('0x4'));var moment=require('moment');var BPromise=require(_0xb92e('0x5'));var Mustache=require(_0xb92e('0x6'));var util=require(_0xb92e('0x7'));var path=require(_0xb92e('0x8'));var sox=require(_0xb92e('0x9'));var csv=require(_0xb92e('0xa'));var ejs=require(_0xb92e('0xb'));var fs=require('fs');var fs_extra=require(_0xb92e('0xc'));var _=require(_0xb92e('0xd'));var squel=require(_0xb92e('0xe'));var crypto=require(_0xb92e('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xb92e('0x10'));var toCsv=require(_0xb92e('0xa'));var querystring=require(_0xb92e('0x11'));var Papa=require('papaparse');var Redis=require(_0xb92e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb92e('0x13'));var as=require(_0xb92e('0x14'));var hardwareService=require(_0xb92e('0x15'));var logger=require('../../config/logger')(_0xb92e('0x16'));var utils=require('../../config/utils');var config=require(_0xb92e('0x17'));var licenseUtil=require(_0xb92e('0x18'));var db=require(_0xb92e('0x19'))['db'];var integrations=require(_0xb92e('0x1a'));function respondWithStatusCode(_0x200195,_0x7505ff){_0x7505ff=_0x7505ff||0xcc;return function(_0x4fee7a){if(_0x4fee7a){return _0x200195['sendStatus'](_0x7505ff);}return _0x200195[_0xb92e('0x1b')](_0x7505ff)['end']();};}function respondWithResult(_0x558b22,_0x6b3606){_0x6b3606=_0x6b3606||0xc8;return function(_0x483d1b){if(_0x483d1b){return _0x558b22[_0xb92e('0x1b')](_0x6b3606)[_0xb92e('0x1c')](_0x483d1b);}};}function respondWithFilteredResult(_0x31ed3f,_0x4d9d22){return function(_0x408815){if(_0x408815){var _0x1ef8e1=typeof _0x4d9d22[_0xb92e('0x1d')]===_0xb92e('0x1e')&&typeof _0x4d9d22['limit']===_0xb92e('0x1e');var _0x29d6bd=_0x408815['count'];var _0x3cf4bb=_0x1ef8e1?0x0:_0x4d9d22[_0xb92e('0x1d')];var _0x31b0c1=_0x1ef8e1?_0x408815[_0xb92e('0x1f')]:_0x4d9d22[_0xb92e('0x1d')]+_0x4d9d22[_0xb92e('0x20')];var _0x1967ba;if(_0x31b0c1>=_0x29d6bd){_0x31b0c1=_0x29d6bd;_0x1967ba=0xc8;}else{_0x1967ba=0xce;}_0x31ed3f[_0xb92e('0x1b')](_0x1967ba);return _0x31ed3f['set'](_0xb92e('0x21'),_0x3cf4bb+'-'+_0x31b0c1+'/'+_0x29d6bd)[_0xb92e('0x1c')](_0x408815);}return null;};}function patchUpdates(_0x367e90){return function(_0xa8c19c){try{jsonpatch['apply'](_0xa8c19c,_0x367e90,!![]);}catch(_0x34b9c0){return BPromise[_0xb92e('0x22')](_0x34b9c0);}return _0xa8c19c[_0xb92e('0x23')]();};}function saveUpdates(_0x1f1838,_0x10de97){return function(_0x47dbe8){if(_0x47dbe8){return _0x47dbe8[_0xb92e('0x24')](_0x1f1838)[_0xb92e('0x25')](function(_0x1823e0){return _0x1823e0;});}return null;};}function removeEntity(_0x5a2b4d,_0x450942){return function(_0x84c23d){if(_0x84c23d){return _0x84c23d[_0xb92e('0x26')]()[_0xb92e('0x25')](function(){_0x5a2b4d[_0xb92e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33aa64,_0x32179b){return function(_0x4c96e4){if(!_0x4c96e4){_0x33aa64[_0xb92e('0x27')](0x194);}return _0x4c96e4;};}function handleError(_0x428190,_0x55ec02){_0x55ec02=_0x55ec02||0x1f4;return function(_0x2dbeed){logger['error'](_0x2dbeed[_0xb92e('0x28')]);if(_0x2dbeed[_0xb92e('0x29')]){delete _0x2dbeed['name'];}_0x428190[_0xb92e('0x1b')](_0x55ec02)[_0xb92e('0x2a')](_0x2dbeed);};}exports[_0xb92e('0x2b')]=function(_0x2b3a11,_0x304713){var _0x510fc9={},_0x136004={},_0x283016={'count':0x0,'rows':[]};var _0x6b1342=_['map'](db[_0xb92e('0x2c')][_0xb92e('0x2d')],function(_0x481227){return{'name':_0x481227[_0xb92e('0x2e')],'type':_0x481227['type'][_0xb92e('0x2f')]};});_0x136004[_0xb92e('0x30')]=_[_0xb92e('0x31')](_0x6b1342,_0xb92e('0x29'));_0x136004[_0xb92e('0x32')]=_[_0xb92e('0x33')](_0x2b3a11[_0xb92e('0x32')]);_0x136004[_0xb92e('0x34')]=_['intersection'](_0x136004[_0xb92e('0x30')],_0x136004[_0xb92e('0x32')]);_0x510fc9[_0xb92e('0x35')]=_['intersection'](_0x136004[_0xb92e('0x30')],qs[_0xb92e('0x36')](_0x2b3a11['query'][_0xb92e('0x36')]));_0x510fc9[_0xb92e('0x35')]=_0x510fc9[_0xb92e('0x35')][_0xb92e('0x37')]?_0x510fc9['attributes']:_0x136004[_0xb92e('0x30')];if(!_0x2b3a11['query'][_0xb92e('0x38')](_0xb92e('0x39'))){_0x510fc9['limit']=qs[_0xb92e('0x20')](_0x2b3a11[_0xb92e('0x32')][_0xb92e('0x20')]);_0x510fc9['offset']=qs[_0xb92e('0x1d')](_0x2b3a11[_0xb92e('0x32')]['offset']);}_0x510fc9[_0xb92e('0x3a')]=qs[_0xb92e('0x3b')](_0x2b3a11['query'][_0xb92e('0x3b')]);_0x510fc9['where']=qs['filters'](_[_0xb92e('0x3c')](_0x2b3a11[_0xb92e('0x32')],_0x136004['filters']),_0x6b1342);if(_0x2b3a11['query']['filter']){_0x510fc9['where']=_['merge'](_0x510fc9[_0xb92e('0x3d')],{'$or':_[_0xb92e('0x31')](_0x6b1342,function(_0xc47965){if(_0xc47965[_0xb92e('0x3e')]!==_0xb92e('0x3f')){var _0x127588={};_0x127588[_0xc47965[_0xb92e('0x29')]]={'$like':'%'+_0x2b3a11[_0xb92e('0x32')][_0xb92e('0x40')]+'%'};return _0x127588;}})});}_0x510fc9=_[_0xb92e('0x41')]({},_0x510fc9,_0x2b3a11[_0xb92e('0x42')]);var _0x4b3eaf={'where':_0x510fc9[_0xb92e('0x3d')]};return db[_0xb92e('0x2c')][_0xb92e('0x1f')](_0x4b3eaf)['then'](function(_0x484f59){_0x283016[_0xb92e('0x1f')]=_0x484f59;if(_0x2b3a11['query'][_0xb92e('0x43')]){_0x510fc9['include']=[{'all':!![]}];}return db[_0xb92e('0x2c')][_0xb92e('0x44')](_0x510fc9);})['then'](function(_0x8e503d){_0x283016[_0xb92e('0x45')]=_0x8e503d;return _0x283016;})[_0xb92e('0x25')](respondWithFilteredResult(_0x304713,_0x510fc9))[_0xb92e('0x46')](handleError(_0x304713,null));};exports[_0xb92e('0x47')]=function(_0x1bb26c,_0x478c2f){var _0x14ad3b={'raw':![],'where':{'id':_0x1bb26c[_0xb92e('0x48')]['id']}},_0x219e3c={};_0x219e3c[_0xb92e('0x30')]=_['keys'](db[_0xb92e('0x2c')][_0xb92e('0x2d')]);_0x219e3c[_0xb92e('0x32')]=_['keys'](_0x1bb26c[_0xb92e('0x32')]);_0x219e3c[_0xb92e('0x34')]=_[_0xb92e('0x49')](_0x219e3c['model'],_0x219e3c[_0xb92e('0x32')]);_0x14ad3b['attributes']=_[_0xb92e('0x49')](_0x219e3c['model'],qs[_0xb92e('0x36')](_0x1bb26c[_0xb92e('0x32')]['fields']));_0x14ad3b[_0xb92e('0x35')]=_0x14ad3b['attributes']['length']?_0x14ad3b[_0xb92e('0x35')]:_0x219e3c[_0xb92e('0x30')];if(_0x1bb26c[_0xb92e('0x32')][_0xb92e('0x43')]){_0x14ad3b[_0xb92e('0x4a')]=[{'all':!![]}];}_0x14ad3b=_['merge']({},_0x14ad3b,_0x1bb26c[_0xb92e('0x42')]);return db[_0xb92e('0x2c')]['find'](_0x14ad3b)[_0xb92e('0x25')](handleEntityNotFound(_0x478c2f,null))[_0xb92e('0x25')](respondWithResult(_0x478c2f,null))[_0xb92e('0x46')](handleError(_0x478c2f,null));};exports[_0xb92e('0x4b')]=function(_0x20d1b2,_0x5411fe){return db[_0xb92e('0x2c')][_0xb92e('0x4b')](_0x20d1b2[_0xb92e('0x4c')],{})[_0xb92e('0x25')](respondWithResult(_0x5411fe,0xc9))[_0xb92e('0x46')](handleError(_0x5411fe,null));};exports[_0xb92e('0x24')]=function(_0x11f078,_0x2e6c62){if(_0x11f078['body']['id']){delete _0x11f078[_0xb92e('0x4c')]['id'];}return db[_0xb92e('0x2c')][_0xb92e('0x4d')]({'where':{'id':_0x11f078[_0xb92e('0x48')]['id']}})[_0xb92e('0x25')](handleEntityNotFound(_0x2e6c62,null))[_0xb92e('0x25')](saveUpdates(_0x11f078[_0xb92e('0x4c')],null))[_0xb92e('0x25')](respondWithResult(_0x2e6c62,null))[_0xb92e('0x46')](handleError(_0x2e6c62,null));};exports[_0xb92e('0x26')]=function(_0x483f5f,_0x401d79){return db[_0xb92e('0x2c')][_0xb92e('0x4d')]({'where':{'id':_0x483f5f[_0xb92e('0x48')]['id']}})['then'](handleEntityNotFound(_0x401d79,null))[_0xb92e('0x25')](removeEntity(_0x401d79,null))[_0xb92e('0x46')](handleError(_0x401d79,null));};exports[_0xb92e('0x4e')]=function(_0x812ae1,_0x33fc57,_0x3790a0){var _0x28ca15={};var _0x505c33={};var _0x41e32f;var _0x357269;return db[_0xb92e('0x2c')][_0xb92e('0x4f')]({'where':{'id':_0x812ae1[_0xb92e('0x48')]['id']}})[_0xb92e('0x25')](handleEntityNotFound(_0x33fc57,null))[_0xb92e('0x25')](function(_0x5d092b){if(_0x5d092b){_0x41e32f=_0x5d092b;_0x505c33['model']=_[_0xb92e('0x33')](db[_0xb92e('0x50')][_0xb92e('0x2d')]);_0x505c33[_0xb92e('0x32')]=_['keys'](_0x812ae1['query']);_0x505c33[_0xb92e('0x34')]=_['intersection'](_0x505c33[_0xb92e('0x30')],_0x505c33['query']);_0x28ca15['attributes']=_[_0xb92e('0x49')](_0x505c33[_0xb92e('0x30')],qs['fields'](_0x812ae1[_0xb92e('0x32')][_0xb92e('0x36')]));_0x28ca15[_0xb92e('0x35')]=_0x28ca15[_0xb92e('0x35')]['length']?_0x28ca15[_0xb92e('0x35')]:_0x505c33[_0xb92e('0x30')];_0x28ca15[_0xb92e('0x3a')]=qs['sort'](_0x812ae1[_0xb92e('0x32')][_0xb92e('0x3b')]);_0x28ca15['where']=qs[_0xb92e('0x34')](_['pick'](_0x812ae1['query'],_0x505c33[_0xb92e('0x34')]));if(_0x812ae1[_0xb92e('0x32')][_0xb92e('0x40')]){_0x28ca15[_0xb92e('0x3d')]=_[_0xb92e('0x41')](_0x28ca15[_0xb92e('0x3d')],{'$or':_['map'](_0x28ca15[_0xb92e('0x35')],function(_0x401380){var _0xf636ed={};_0xf636ed[_0x401380]={'$like':'%'+_0x812ae1[_0xb92e('0x32')][_0xb92e('0x40')]+'%'};return _0xf636ed;})});}_0x28ca15=_[_0xb92e('0x41')]({},_0x28ca15,_0x812ae1['options']);return _0x41e32f['getConfigurations'](_0x28ca15);}})[_0xb92e('0x25')](function(_0x2ec616){if(_0x2ec616){_0x357269=_0x2ec616[_0xb92e('0x37')];if(!_0x812ae1[_0xb92e('0x32')][_0xb92e('0x38')](_0xb92e('0x39'))){_0x28ca15[_0xb92e('0x20')]=qs['limit'](_0x812ae1['query'][_0xb92e('0x20')]);_0x28ca15[_0xb92e('0x1d')]=qs[_0xb92e('0x1d')](_0x812ae1[_0xb92e('0x32')][_0xb92e('0x1d')]);}return _0x41e32f['getConfigurations'](_0x28ca15);}})[_0xb92e('0x25')](function(_0x3667c5){if(_0x3667c5){return _0x3667c5?{'count':_0x357269,'rows':_0x3667c5}:null;}})[_0xb92e('0x25')](respondWithResult(_0x33fc57,null))[_0xb92e('0x46')](handleError(_0x33fc57,null));};exports['addConfiguration']=function(_0x411080,_0x10f0b3,_0x288a10){if(_0x411080[_0xb92e('0x4c')]['id']){delete _0x411080[_0xb92e('0x4c')]['id'];}return db[_0xb92e('0x2c')][_0xb92e('0x4f')]({'where':{'id':_0x411080[_0xb92e('0x48')]['id']}})[_0xb92e('0x25')](handleEntityNotFound(_0x10f0b3,null))[_0xb92e('0x25')](function(_0x152529){if(_0x152529){_0x411080[_0xb92e('0x4c')][_0xb92e('0x51')]=_0x152529['id'];_0x411080[_0xb92e('0x4c')][_0xb92e('0x52')]=integrations['getSubjects'](_0x411080[_0xb92e('0x4c')]['channel'],_0x411080[_0xb92e('0x4c')]['type']);_0x411080['body'][_0xb92e('0x53')]=integrations[_0xb92e('0x54')](_0x411080['body'][_0xb92e('0x55')],_0x411080[_0xb92e('0x4c')]['type']);return db[_0xb92e('0x50')][_0xb92e('0x4b')](_0x411080[_0xb92e('0x4c')],{'include':[{'model':db[_0xb92e('0x56')],'as':_0xb92e('0x52')},{'model':db[_0xb92e('0x56')],'as':'Descriptions'}]});}return null;})[_0xb92e('0x25')](respondWithResult(_0x10f0b3,null))[_0xb92e('0x46')](handleError(_0x10f0b3,null));};var md5=require(_0xb92e('0x57'));exports[_0xb92e('0x58')]=function(_0x368121,_0x55a150,_0x27b568){var _0x24a8bd=null;var _0x3f5522=null;var _0x13577c=null;var _0x2f9d7b=null;var _0x14d3d0='';return db[_0xb92e('0x2c')]['findOne']({'where':{'id':_0x368121['params']['id']},'attributes':['id',_0xb92e('0x29'),'username',_0xb92e('0x59'),_0xb92e('0x5a'),_0xb92e('0x5b'),_0xb92e('0x5c'),_0xb92e('0x5d')]})[_0xb92e('0x25')](handleEntityNotFound(_0x55a150,null))[_0xb92e('0x25')](function(_0x1c8201){if(_0x1c8201){_0x24a8bd=_0x1c8201[_0xb92e('0x5e')];_0x3f5522=_0x1c8201[_0xb92e('0x5d')];_0x13577c=_0x1c8201[_0xb92e('0x5a')];_0x14d3d0=_0x1c8201['remoteUri'];var _0x2e62a9=_0x14d3d0[_0xb92e('0x5f')](-0x1);if(_0x2e62a9==='/'){_0x14d3d0=_0x14d3d0[_0xb92e('0x60')](0x0,_0x14d3d0[_0xb92e('0x61')](_0x2e62a9));}_0x2f9d7b=util[_0xb92e('0x62')]('%s/webservice.php',_0x14d3d0);var _0x25973b={'method':_0xb92e('0x63'),'uri':_0x2f9d7b,'qs':{'operation':_0xb92e('0x64'),'username':_0x1c8201['username']},'json':!![]};return rp(_0x25973b);}})[_0xb92e('0x25')](function(_0x3a24c3){if(_0x3a24c3[_0xb92e('0x65')]){var _0x6ee899={'method':_0xb92e('0x66'),'uri':_0x2f9d7b,'form':{'operation':_0xb92e('0x67'),'username':_0x24a8bd,'accessKey':md5(_0x3a24c3[_0xb92e('0x68')][_0xb92e('0x69')]+_0x3f5522)},'json':!![]};return rp(_0x6ee899);}})[_0xb92e('0x25')](function(_0x3058b6){if(_0x3058b6['success']){var _0x1eb6f3={'method':_0xb92e('0x63'),'uri':_0x2f9d7b,'qs':{'operation':_0xb92e('0x6a'),'username':_0x24a8bd,'sessionName':_0x3058b6[_0xb92e('0x68')][_0xb92e('0x6b')],'elementType':_0x13577c},'json':!![]};return rp(_0x1eb6f3);}})[_0xb92e('0x25')](function(_0x2171d6){if(_0x2171d6['success']){var _0x2c0b04=[_0xb92e('0x6c'),_0xb92e('0x6d'),'owner'];_[_0xb92e('0x6e')](_0x2171d6[_0xb92e('0x68')][_0xb92e('0x36')],function(_0x308182){return _0x2c0b04[_0xb92e('0x6f')](_0x308182['type'][_0xb92e('0x29')]);});_[_0xb92e('0x6e')](_0x2171d6[_0xb92e('0x68')][_0xb92e('0x36')],function(_0x1b8a91){return _0x1b8a91[_0xb92e('0x70')]===_0xb92e('0x71');});return{'count':_0x2171d6[_0xb92e('0x68')][_0xb92e('0x36')][_0xb92e('0x37')],'rows':_[_0xb92e('0x31')](_0x2171d6[_0xb92e('0x68')][_0xb92e('0x36')],function(_0x12b536){return{'id':_0x12b536[_0xb92e('0x29')],'name':_0x12b536[_0xb92e('0x72')],'custom':_[_0xb92e('0x73')](_0x12b536[_0xb92e('0x29')],'cf_')?!![]:![],'options':_0x12b536[_0xb92e('0x3e')][_0xb92e('0x29')]===_0xb92e('0x74')&&_0x12b536[_0xb92e('0x3e')][_0xb92e('0x75')][_0xb92e('0x37')]>0x0?_['map'](_0x12b536[_0xb92e('0x3e')][_0xb92e('0x75')],function(_0x4ac88f){return{'name':_0x4ac88f[_0xb92e('0x72')],'value':_0x4ac88f['value']};}):[]};})};}})[_0xb92e('0x25')](respondWithResult(_0x55a150,null))['catch'](function(_0x470dd){console[_0xb92e('0x76')](_0xb92e('0x77')+_0x470dd);var _0xdc9d39=_0x368121['query'][_0xb92e('0x78')]?0x1f4:_0x470dd[_0xb92e('0x79')]||0x1f4;logger[_0xb92e('0x7a')]('getFields,\x20%s,\x20%s,\x20%s',_0xb92e('0x58'),_0xdc9d39,JSON[_0xb92e('0x7b')](_0x470dd));delete _0x470dd['name'];if(_0xdc9d39===0x191){_0xdc9d39=0x190;}_0x55a150[_0xb92e('0x1b')](_0xdc9d39)[_0xb92e('0x2a')](_0x368121[_0xb92e('0x32')][_0xb92e('0x78')]?{'message':_0xb92e('0x7c'),'statusCode':_0x470dd['statusCode']}:_0x470dd);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 080430c..8bb3209 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 _0xd2b6=['path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount','int_vtiger_accounts','lodash','util','api','request-promise'];(function(_0x40837d,_0x5822e1){var _0x21d214=function(_0x2e18c7){while(--_0x2e18c7){_0x40837d['push'](_0x40837d['shift']());}};_0x21d214(++_0x5822e1);}(_0xd2b6,0xf9));var _0x6d2b=function(_0x1776a6,_0x56b498){_0x1776a6=_0x1776a6-0x0;var _0x50a07e=_0xd2b6[_0x1776a6];return _0x50a07e;};'use strict';var _=require(_0x6d2b('0x0'));var util=require(_0x6d2b('0x1'));var logger=require('../../config/logger')(_0x6d2b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6d2b('0x3'));var fs=require('fs');var path=require(_0x6d2b('0x4'));var rimraf=require('rimraf');var config=require(_0x6d2b('0x5'));var attributes=require(_0x6d2b('0x6'));var integrations=require(_0x6d2b('0x7'));module[_0x6d2b('0x8')]=function(_0x2f11ee,_0x503730){return _0x2f11ee['define'](_0x6d2b('0x9'),attributes,{'tableName':_0x6d2b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x137e=['rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x137e,0xe8));var _0xe137=function(_0x418c07,_0x2a2929){_0x418c07=_0x418c07-0x0;var _0xb8a0ea=_0x137e[_0x418c07];return _0xb8a0ea;};'use strict';var _=require('lodash');var util=require(_0xe137('0x0'));var logger=require(_0xe137('0x1'))(_0xe137('0x2'));var moment=require(_0xe137('0x3'));var BPromise=require(_0xe137('0x4'));var rp=require(_0xe137('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe137('0x6'));var config=require(_0xe137('0x7'));var attributes=require(_0xe137('0x8'));var integrations=require(_0xe137('0x9'));module[_0xe137('0xa')]=function(_0x398413,_0x4002c5){return _0x398413[_0xe137('0xb')](_0xe137('0xc'),attributes,{'tableName':_0xe137('0xd'),'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 43aea95..6d4b3d7 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 _0x84a0=['bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','VtigerAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetVtigerAccount','ShowVtigerAccount','find','lodash','util','moment'];(function(_0x47ca66,_0xbf920a){var _0x742c57=function(_0x2f1ac1){while(--_0x2f1ac1){_0x47ca66['push'](_0x47ca66['shift']());}};_0x742c57(++_0xbf920a);}(_0x84a0,0x66));var _0x084a=function(_0xea27ad,_0x2364c1){_0xea27ad=_0xea27ad-0x0;var _0x23e858=_0x84a0[_0xea27ad];return _0x23e858;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var moment=require(_0x084a('0x2'));var BPromise=require(_0x084a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x084a('0x4'));var db=require(_0x084a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x084a('0x6'));var config=require(_0x084a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x084a('0x8')][_0x084a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e6810,_0x373d2,_0x2b30bc){return new BPromise(function(_0x58d419,_0x1051a9){return client[_0x084a('0xa')](_0x2e6810,_0x2b30bc)[_0x084a('0xb')](function(_0x2888e3){logger[_0x084a('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x373d2,'request\x20sent');logger[_0x084a('0xd')](_0x084a('0xe'),_0x373d2,_0x084a('0xf'),JSON[_0x084a('0x10')](_0x2888e3));if(_0x2888e3[_0x084a('0x11')]){if(_0x2888e3['error']['code']===0x1f4){logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x2888e3[_0x084a('0x11')][_0x084a('0x13')]);return _0x1051a9(_0x2888e3[_0x084a('0x11')][_0x084a('0x13')]);}logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x2888e3['error'][_0x084a('0x13')]);return _0x58d419(_0x2888e3['error'][_0x084a('0x13')]);}else{logger[_0x084a('0xc')](_0x084a('0x12'),_0x373d2,_0x084a('0xf'));_0x58d419(_0x2888e3[_0x084a('0x14')]['message']);}})[_0x084a('0x15')](function(_0x4abd81){logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x4abd81);_0x1051a9(_0x4abd81);});});}exports['GetVtigerAccount']=function(_0xf2c333){var _0x32c729=this;return new Promise(function(_0x4134b9,_0x14bb19){return db[_0x084a('0x16')][_0x084a('0x17')]({'raw':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x19')]===undefined?!![]:![]:!![],'where':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x1a')]||null:null,'attributes':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x1b')]||null:null,'limit':_0xf2c333['options']?_0xf2c333[_0x084a('0x18')][_0x084a('0x1c')]||null:null,'include':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x1d')]?_['map'](_0xf2c333[_0x084a('0x18')][_0x084a('0x1d')],function(_0x6346a5){return{'model':db[_0x6346a5[_0x084a('0x1e')]],'as':_0x6346a5['as'],'attributes':_0x6346a5[_0x084a('0x1b')],'include':_0x6346a5[_0x084a('0x1d')]?_['map'](_0x6346a5[_0x084a('0x1d')],function(_0x2af138){return{'model':db[_0x2af138[_0x084a('0x1e')]],'as':_0x2af138['as'],'attributes':_0x2af138['attributes'],'include':_0x2af138[_0x084a('0x1d')]?_[_0x084a('0x1f')](_0x2af138[_0x084a('0x1d')],function(_0x4c5658){return{'model':db[_0x4c5658['model']],'as':_0x4c5658['as'],'attributes':_0x4c5658['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x33b88f){logger['info']('GetVtigerAccount',_0xf2c333);logger['debug'](_0x084a('0x20'),_0xf2c333,JSON[_0x084a('0x10')](_0x33b88f));_0x4134b9(_0x33b88f);})[_0x084a('0x15')](function(_0x2c4149){logger[_0x084a('0x11')](_0x084a('0x20'),_0x2c4149[_0x084a('0x13')],_0xf2c333);_0x14bb19(_0x32c729[_0x084a('0x11')](0x1f4,_0x2c4149['message']));});});};exports[_0x084a('0x21')]=function(_0x3b2b38){var _0x501a16=this;return new Promise(function(_0xe1980b,_0x24bcf5){return db[_0x084a('0x16')][_0x084a('0x22')]({'raw':_0x3b2b38[_0x084a('0x18')]?_0x3b2b38[_0x084a('0x18')][_0x084a('0x19')]===undefined?!![]:![]:!![],'where':_0x3b2b38[_0x084a('0x18')]?_0x3b2b38[_0x084a('0x18')][_0x084a('0x1a')]||null:null,'attributes':_0x3b2b38[_0x084a('0x18')]?_0x3b2b38[_0x084a('0x18')][_0x084a('0x1b')]||null:null,'include':_0x3b2b38['options']?_0x3b2b38['options'][_0x084a('0x1d')]?_[_0x084a('0x1f')](_0x3b2b38[_0x084a('0x18')][_0x084a('0x1d')],function(_0x83f94f){return{'model':db[_0x83f94f['model']],'as':_0x83f94f['as'],'attributes':_0x83f94f[_0x084a('0x1b')],'include':_0x83f94f[_0x084a('0x1d')]?_[_0x084a('0x1f')](_0x83f94f['include'],function(_0x109593){return{'model':db[_0x109593[_0x084a('0x1e')]],'as':_0x109593['as'],'attributes':_0x109593[_0x084a('0x1b')],'include':_0x109593['include']?_['map'](_0x109593['include'],function(_0xf97d1b){return{'model':db[_0xf97d1b[_0x084a('0x1e')]],'as':_0xf97d1b['as'],'attributes':_0xf97d1b[_0x084a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c09c3){logger[_0x084a('0xc')](_0x084a('0x21'),_0x3b2b38);logger[_0x084a('0xd')](_0x084a('0x21'),_0x3b2b38,JSON[_0x084a('0x10')](_0x3c09c3));_0xe1980b(_0x3c09c3);})[_0x084a('0x15')](function(_0x19354f){logger[_0x084a('0x11')](_0x084a('0x21'),_0x19354f[_0x084a('0x13')],_0x3b2b38);_0x24bcf5(_0x501a16[_0x084a('0x11')](0x1f4,_0x19354f[_0x084a('0x13')]));});});}; \ No newline at end of file +var _0x6b20=['../../config/environment','jayson/promise','client','http','request','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','map','attributes','include','model','then','debug','stringify','catch','ShowVtigerAccount','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x6b20,0xd1));var _0x06b2=function(_0x417838,_0xa7347b){_0x417838=_0x417838-0x0;var _0xb49ed6=_0x6b20[_0x417838];return _0xb49ed6;};'use strict';var _=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var moment=require('moment');var BPromise=require(_0x06b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06b2('0x3'));var db=require(_0x06b2('0x4'))['db'];var utils=require(_0x06b2('0x5'));var logger=require('../../config/logger')(_0x06b2('0x6'));var config=require(_0x06b2('0x7'));var jayson=require(_0x06b2('0x8'));var client=jayson[_0x06b2('0x9')][_0x06b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37b825,_0x26a325,_0x4e6d3b){return new BPromise(function(_0x21cd31,_0x1828e4){return client[_0x06b2('0xb')](_0x37b825,_0x4e6d3b)['then'](function(_0x37ace0){logger['info'](_0x06b2('0xc'),_0x26a325,'request\x20sent');logger['debug'](_0x06b2('0xd'),_0x26a325,_0x06b2('0xe'),JSON['stringify'](_0x37ace0));if(_0x37ace0[_0x06b2('0xf')]){if(_0x37ace0[_0x06b2('0xf')][_0x06b2('0x10')]===0x1f4){logger[_0x06b2('0xf')](_0x06b2('0xc'),_0x26a325,_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);return _0x1828e4(_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);}logger[_0x06b2('0xf')](_0x06b2('0xc'),_0x26a325,_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);return _0x21cd31(_0x37ace0['error'][_0x06b2('0x11')]);}else{logger[_0x06b2('0x12')](_0x06b2('0xc'),_0x26a325,_0x06b2('0xe'));_0x21cd31(_0x37ace0[_0x06b2('0x13')][_0x06b2('0x11')]);}})['catch'](function(_0x17e69b){logger[_0x06b2('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x26a325,_0x17e69b);_0x1828e4(_0x17e69b);});});}exports[_0x06b2('0x14')]=function(_0x594b48){var _0x4c9cae=this;return new Promise(function(_0x192270,_0x1b4ab0){return db[_0x06b2('0x15')][_0x06b2('0x16')]({'raw':_0x594b48['options']?_0x594b48[_0x06b2('0x17')][_0x06b2('0x18')]===undefined?!![]:![]:!![],'where':_0x594b48[_0x06b2('0x17')]?_0x594b48[_0x06b2('0x17')][_0x06b2('0x19')]||null:null,'attributes':_0x594b48[_0x06b2('0x17')]?_0x594b48[_0x06b2('0x17')]['attributes']||null:null,'limit':_0x594b48[_0x06b2('0x17')]?_0x594b48[_0x06b2('0x17')][_0x06b2('0x1a')]||null:null,'include':_0x594b48[_0x06b2('0x17')]?_0x594b48['options']['include']?_[_0x06b2('0x1b')](_0x594b48[_0x06b2('0x17')]['include'],function(_0x39659f){return{'model':db[_0x39659f['model']],'as':_0x39659f['as'],'attributes':_0x39659f[_0x06b2('0x1c')],'include':_0x39659f[_0x06b2('0x1d')]?_[_0x06b2('0x1b')](_0x39659f['include'],function(_0x4382ce){return{'model':db[_0x4382ce[_0x06b2('0x1e')]],'as':_0x4382ce['as'],'attributes':_0x4382ce[_0x06b2('0x1c')],'include':_0x4382ce[_0x06b2('0x1d')]?_[_0x06b2('0x1b')](_0x4382ce['include'],function(_0xbb00ea){return{'model':db[_0xbb00ea[_0x06b2('0x1e')]],'as':_0xbb00ea['as'],'attributes':_0xbb00ea[_0x06b2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x06b2('0x1f')](function(_0x1976ac){logger[_0x06b2('0x12')]('GetVtigerAccount',_0x594b48);logger[_0x06b2('0x20')](_0x06b2('0x14'),_0x594b48,JSON[_0x06b2('0x21')](_0x1976ac));_0x192270(_0x1976ac);})[_0x06b2('0x22')](function(_0x1f02d8){logger[_0x06b2('0xf')](_0x06b2('0x14'),_0x1f02d8['message'],_0x594b48);_0x1b4ab0(_0x4c9cae[_0x06b2('0xf')](0x1f4,_0x1f02d8[_0x06b2('0x11')]));});});};exports[_0x06b2('0x23')]=function(_0x15a78b){var _0x1cc725=this;return new Promise(function(_0x37d391,_0x401551){return db[_0x06b2('0x15')]['find']({'raw':_0x15a78b[_0x06b2('0x17')]?_0x15a78b[_0x06b2('0x17')][_0x06b2('0x18')]===undefined?!![]:![]:!![],'where':_0x15a78b[_0x06b2('0x17')]?_0x15a78b[_0x06b2('0x17')][_0x06b2('0x19')]||null:null,'attributes':_0x15a78b[_0x06b2('0x17')]?_0x15a78b['options']['attributes']||null:null,'include':_0x15a78b[_0x06b2('0x17')]?_0x15a78b[_0x06b2('0x17')][_0x06b2('0x1d')]?_['map'](_0x15a78b[_0x06b2('0x17')][_0x06b2('0x1d')],function(_0x37bfb5){return{'model':db[_0x37bfb5[_0x06b2('0x1e')]],'as':_0x37bfb5['as'],'attributes':_0x37bfb5[_0x06b2('0x1c')],'include':_0x37bfb5[_0x06b2('0x1d')]?_['map'](_0x37bfb5[_0x06b2('0x1d')],function(_0x1e66f1){return{'model':db[_0x1e66f1[_0x06b2('0x1e')]],'as':_0x1e66f1['as'],'attributes':_0x1e66f1['attributes'],'include':_0x1e66f1[_0x06b2('0x1d')]?_[_0x06b2('0x1b')](_0x1e66f1['include'],function(_0x45ea67){return{'model':db[_0x45ea67[_0x06b2('0x1e')]],'as':_0x45ea67['as'],'attributes':_0x45ea67[_0x06b2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x06b2('0x1f')](function(_0x2e49df){logger[_0x06b2('0x12')](_0x06b2('0x23'),_0x15a78b);logger[_0x06b2('0x20')](_0x06b2('0x23'),_0x15a78b,JSON[_0x06b2('0x21')](_0x2e49df));_0x37d391(_0x2e49df);})[_0x06b2('0x22')](function(_0x1cc7b6){logger['error'](_0x06b2('0x23'),_0x1cc7b6['message'],_0x15a78b);_0x401551(_0x1cc725['error'](0x1f4,_0x1cc7b6[_0x06b2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 8b446cd..0fe1111 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 _0xf737=['destroy','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update'];(function(_0x26606f,_0x10d393){var _0x1d8bf3=function(_0x3a65e0){while(--_0x3a65e0){_0x26606f['push'](_0x26606f['shift']());}};_0x1d8bf3(++_0x10d393);}(_0xf737,0x1b7));var _0x7f73=function(_0x324bf4,_0x1056b5){_0x324bf4=_0x324bf4-0x0;var _0xa44411=_0xf737[_0x324bf4];return _0xa44411;};'use strict';var multer=require(_0x7f73('0x0'));var util=require('util');var path=require(_0x7f73('0x1'));var timeout=require(_0x7f73('0x2'));var express=require(_0x7f73('0x3'));var router=express['Router']();var fs_extra=require(_0x7f73('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7f73('0x5'));var controller=require(_0x7f73('0x6'));router[_0x7f73('0x7')]('/',auth[_0x7f73('0x8')](),controller[_0x7f73('0x9')]);router[_0x7f73('0x7')](_0x7f73('0xa'),auth[_0x7f73('0x8')](),controller[_0x7f73('0xb')]);router['get'](_0x7f73('0xc'),auth[_0x7f73('0x8')](),controller[_0x7f73('0xd')]);router[_0x7f73('0x7')](_0x7f73('0xe'),auth[_0x7f73('0x8')](),controller['getSubjects']);router[_0x7f73('0x7')](_0x7f73('0xf'),auth['isAuthenticated'](),controller[_0x7f73('0x10')]);router[_0x7f73('0x11')]('/',auth[_0x7f73('0x8')](),controller[_0x7f73('0x12')]);router[_0x7f73('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7f73('0x14')]);router['delete'](_0x7f73('0xa'),auth[_0x7f73('0x8')](),controller[_0x7f73('0x15')]);module[_0x7f73('0x16')]=router; \ No newline at end of file +var _0x9dd5=['index','get','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','./intVtigerConfiguration.controller','isAuthenticated'];(function(_0x4d97da,_0x140c79){var _0x263877=function(_0x1954e1){while(--_0x1954e1){_0x4d97da['push'](_0x4d97da['shift']());}};_0x263877(++_0x140c79);}(_0x9dd5,0x1c6));var _0x59dd=function(_0x25a0a2,_0x4a1176){_0x25a0a2=_0x25a0a2-0x0;var _0x19e750=_0x9dd5[_0x25a0a2];return _0x19e750;};'use strict';var multer=require(_0x59dd('0x0'));var util=require(_0x59dd('0x1'));var path=require(_0x59dd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x59dd('0x3')]();var fs_extra=require(_0x59dd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x59dd('0x5'));var config=require('../../config/environment');var controller=require(_0x59dd('0x6'));router['get']('/',auth[_0x59dd('0x7')](),controller[_0x59dd('0x8')]);router[_0x59dd('0x9')](_0x59dd('0xa'),auth[_0x59dd('0x7')](),controller[_0x59dd('0xb')]);router[_0x59dd('0x9')]('/:id/fields',auth[_0x59dd('0x7')](),controller[_0x59dd('0xc')]);router[_0x59dd('0x9')](_0x59dd('0xd'),auth['isAuthenticated'](),controller[_0x59dd('0xe')]);router[_0x59dd('0x9')](_0x59dd('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x59dd('0x10')]('/',auth[_0x59dd('0x7')](),controller['create']);router[_0x59dd('0x11')](_0x59dd('0xa'),auth[_0x59dd('0x7')](),controller[_0x59dd('0x12')]);router[_0x59dd('0x13')](_0x59dd('0xa'),auth[_0x59dd('0x7')](),controller[_0x59dd('0x14')]);module[_0x59dd('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 c78dca9..2ddce3c 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 _0x2087=['exports','STRING','sequelize'];(function(_0x3cb731,_0x207931){var _0x5566e9=function(_0x1e64b2){while(--_0x1e64b2){_0x3cb731['push'](_0x3cb731['shift']());}};_0x5566e9(++_0x207931);}(_0x2087,0x6b));var _0x7208=function(_0x2af268,_0x8049a3){_0x2af268=_0x2af268-0x0;var _0x922a96=_0x2087[_0x2af268];return _0x922a96;};'use strict';var Sequelize=require(_0x7208('0x0'));module[_0x7208('0x1')]={'name':{'type':Sequelize[_0x7208('0x2')]},'description':{'type':Sequelize[_0x7208('0x2')]}}; \ No newline at end of file +var _0xae2b=['sequelize','exports','STRING'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xae2b,0x183));var _0xbae2=function(_0xca0b6,_0x264434){_0xca0b6=_0xca0b6-0x0;var _0xa7817e=_0xae2b[_0xca0b6];return _0xa7817e;};'use strict';var Sequelize=require(_0xbae2('0x0'));module[_0xbae2('0x1')]={'name':{'type':Sequelize[_0xbae2('0x2')]},'description':{'type':Sequelize[_0xbae2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index add88df..328f570 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 _0x74b8=['Content-Range','json','apply','save','then','destroy','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','merge','where','VIRTUAL','options','includeAll','findAll','catch','show','params','include','create','update','body','find','getFields','findOne','filter','hasOwnProperty','getSubjects','VtigerField','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','count','limit','set'];(function(_0x46f3b5,_0x2568e3){var _0x1431eb=function(_0x5e371c){while(--_0x5e371c){_0x46f3b5['push'](_0x46f3b5['shift']());}};_0x1431eb(++_0x2568e3);}(_0x74b8,0x86));var _0x874b=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x74b8[_0x2160a9];return _0xa88cf7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x874b('0x0'));var jsonpatch=require(_0x874b('0x1'));var rp=require(_0x874b('0x2'));var moment=require(_0x874b('0x3'));var BPromise=require(_0x874b('0x4'));var Mustache=require(_0x874b('0x5'));var util=require(_0x874b('0x6'));var path=require(_0x874b('0x7'));var sox=require(_0x874b('0x8'));var csv=require(_0x874b('0x9'));var ejs=require(_0x874b('0xa'));var fs=require('fs');var fs_extra=require(_0x874b('0xb'));var _=require(_0x874b('0xc'));var squel=require(_0x874b('0xd'));var crypto=require(_0x874b('0xe'));var jsforce=require(_0x874b('0xf'));var deskjs=require(_0x874b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x874b('0x11'));var Papa=require(_0x874b('0x12'));var Redis=require(_0x874b('0x13'));var authService=require(_0x874b('0x14'));var qs=require(_0x874b('0x15'));var as=require(_0x874b('0x16'));var hardwareService=require(_0x874b('0x17'));var logger=require('../../config/logger')(_0x874b('0x18'));var utils=require(_0x874b('0x19'));var config=require(_0x874b('0x1a'));var licenseUtil=require(_0x874b('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41fbcf,_0x406c92){_0x406c92=_0x406c92||0xcc;return function(_0x228cb9){if(_0x228cb9){return _0x41fbcf[_0x874b('0x1c')](_0x406c92);}return _0x41fbcf['status'](_0x406c92)[_0x874b('0x1d')]();};}function respondWithResult(_0x7d8b82,_0x12599f){_0x12599f=_0x12599f||0xc8;return function(_0x3ee409){if(_0x3ee409){return _0x7d8b82[_0x874b('0x1e')](_0x12599f)['json'](_0x3ee409);}};}function respondWithFilteredResult(_0x400ba2,_0x9a140c){return function(_0x3eb081){if(_0x3eb081){var _0x4c327e=typeof _0x9a140c[_0x874b('0x1f')]===_0x874b('0x20')&&typeof _0x9a140c['limit']===_0x874b('0x20');var _0x230612=_0x3eb081[_0x874b('0x21')];var _0x27d943=_0x4c327e?0x0:_0x9a140c['offset'];var _0x14ad57=_0x4c327e?_0x3eb081['count']:_0x9a140c['offset']+_0x9a140c[_0x874b('0x22')];var _0x4c701a;if(_0x14ad57>=_0x230612){_0x14ad57=_0x230612;_0x4c701a=0xc8;}else{_0x4c701a=0xce;}_0x400ba2[_0x874b('0x1e')](_0x4c701a);return _0x400ba2[_0x874b('0x23')](_0x874b('0x24'),_0x27d943+'-'+_0x14ad57+'/'+_0x230612)[_0x874b('0x25')](_0x3eb081);}return null;};}function patchUpdates(_0x1d2ff7){return function(_0x5a6e95){try{jsonpatch[_0x874b('0x26')](_0x5a6e95,_0x1d2ff7,!![]);}catch(_0x5972fd){return BPromise['reject'](_0x5972fd);}return _0x5a6e95[_0x874b('0x27')]();};}function saveUpdates(_0x56496d,_0x3a1589){return function(_0x3c7bb3){if(_0x3c7bb3){return _0x3c7bb3['update'](_0x56496d)[_0x874b('0x28')](function(_0x233dec){return _0x233dec;});}return null;};}function removeEntity(_0x185d6a,_0x28dfb6){return function(_0x30b18c){if(_0x30b18c){return _0x30b18c[_0x874b('0x29')]()[_0x874b('0x28')](function(){_0x185d6a[_0x874b('0x1e')](0xcc)[_0x874b('0x1d')]();});}};}function handleEntityNotFound(_0x5bcb28,_0x52aa2f){return function(_0x570243){if(!_0x570243){_0x5bcb28[_0x874b('0x1c')](0x194);}return _0x570243;};}function handleError(_0x2c4f66,_0xf1a73a){_0xf1a73a=_0xf1a73a||0x1f4;return function(_0x4f8d74){logger['error'](_0x4f8d74[_0x874b('0x2a')]);if(_0x4f8d74['name']){delete _0x4f8d74[_0x874b('0x2b')];}_0x2c4f66[_0x874b('0x1e')](_0xf1a73a)[_0x874b('0x2c')](_0x4f8d74);};}exports[_0x874b('0x2d')]=function(_0xc95305,_0x38cfa0){var _0x41c7ef={},_0xc87f74={},_0x55c3ad={'count':0x0,'rows':[]};var _0x1a2ff5=_[_0x874b('0x2e')](db[_0x874b('0x2f')][_0x874b('0x30')],function(_0x1f97db){return{'name':_0x1f97db[_0x874b('0x31')],'type':_0x1f97db[_0x874b('0x32')][_0x874b('0x33')]};});_0xc87f74[_0x874b('0x34')]=_[_0x874b('0x2e')](_0x1a2ff5,_0x874b('0x2b'));_0xc87f74[_0x874b('0x35')]=_[_0x874b('0x36')](_0xc95305['query']);_0xc87f74[_0x874b('0x37')]=_[_0x874b('0x38')](_0xc87f74[_0x874b('0x34')],_0xc87f74['query']);_0x41c7ef['attributes']=_['intersection'](_0xc87f74['model'],qs['fields'](_0xc95305[_0x874b('0x35')][_0x874b('0x39')]));_0x41c7ef['attributes']=_0x41c7ef[_0x874b('0x3a')][_0x874b('0x3b')]?_0x41c7ef[_0x874b('0x3a')]:_0xc87f74['model'];if(!_0xc95305[_0x874b('0x35')]['hasOwnProperty'](_0x874b('0x3c'))){_0x41c7ef['limit']=qs[_0x874b('0x22')](_0xc95305['query'][_0x874b('0x22')]);_0x41c7ef[_0x874b('0x1f')]=qs[_0x874b('0x1f')](_0xc95305[_0x874b('0x35')]['offset']);}_0x41c7ef[_0x874b('0x3d')]=qs[_0x874b('0x3e')](_0xc95305[_0x874b('0x35')][_0x874b('0x3e')]);_0x41c7ef['where']=qs[_0x874b('0x37')](_[_0x874b('0x3f')](_0xc95305[_0x874b('0x35')],_0xc87f74[_0x874b('0x37')]),_0x1a2ff5);if(_0xc95305[_0x874b('0x35')]['filter']){_0x41c7ef['where']=_[_0x874b('0x40')](_0x41c7ef[_0x874b('0x41')],{'$or':_['map'](_0x1a2ff5,function(_0x592344){if(_0x592344[_0x874b('0x32')]!==_0x874b('0x42')){var _0x42d600={};_0x42d600[_0x592344[_0x874b('0x2b')]]={'$like':'%'+_0xc95305['query']['filter']+'%'};return _0x42d600;}})});}_0x41c7ef=_[_0x874b('0x40')]({},_0x41c7ef,_0xc95305[_0x874b('0x43')]);var _0x7762fe={'where':_0x41c7ef[_0x874b('0x41')]};return db[_0x874b('0x2f')]['count'](_0x7762fe)[_0x874b('0x28')](function(_0x828dc9){_0x55c3ad[_0x874b('0x21')]=_0x828dc9;if(_0xc95305[_0x874b('0x35')][_0x874b('0x44')]){_0x41c7ef['include']=[{'all':!![]}];}return db[_0x874b('0x2f')][_0x874b('0x45')](_0x41c7ef);})['then'](function(_0x3499a6){_0x55c3ad['rows']=_0x3499a6;return _0x55c3ad;})[_0x874b('0x28')](respondWithFilteredResult(_0x38cfa0,_0x41c7ef))[_0x874b('0x46')](handleError(_0x38cfa0,null));};exports[_0x874b('0x47')]=function(_0x1744f7,_0x13d477){var _0x3c58cb={'raw':![],'where':{'id':_0x1744f7[_0x874b('0x48')]['id']}},_0x1616d8={};_0x1616d8[_0x874b('0x34')]=_['keys'](db['VtigerConfiguration'][_0x874b('0x30')]);_0x1616d8['query']=_[_0x874b('0x36')](_0x1744f7[_0x874b('0x35')]);_0x1616d8[_0x874b('0x37')]=_['intersection'](_0x1616d8[_0x874b('0x34')],_0x1616d8['query']);_0x3c58cb['attributes']=_[_0x874b('0x38')](_0x1616d8[_0x874b('0x34')],qs[_0x874b('0x39')](_0x1744f7[_0x874b('0x35')][_0x874b('0x39')]));_0x3c58cb[_0x874b('0x3a')]=_0x3c58cb['attributes']['length']?_0x3c58cb[_0x874b('0x3a')]:_0x1616d8[_0x874b('0x34')];if(_0x1744f7[_0x874b('0x35')][_0x874b('0x44')]){_0x3c58cb[_0x874b('0x49')]=[{'all':!![]}];}_0x3c58cb=_[_0x874b('0x40')]({},_0x3c58cb,_0x1744f7['options']);return db[_0x874b('0x2f')]['find'](_0x3c58cb)[_0x874b('0x28')](handleEntityNotFound(_0x13d477,null))[_0x874b('0x28')](respondWithResult(_0x13d477,null))[_0x874b('0x46')](handleError(_0x13d477,null));};exports[_0x874b('0x4a')]=function(_0x3d5171,_0x71742d){return db[_0x874b('0x2f')][_0x874b('0x4a')](_0x3d5171['body'],{})['then'](respondWithResult(_0x71742d,0xc9))['catch'](handleError(_0x71742d,null));};exports[_0x874b('0x4b')]=function(_0x59c2e4,_0x4f9dc5){if(_0x59c2e4[_0x874b('0x4c')]['id']){delete _0x59c2e4[_0x874b('0x4c')]['id'];}return db[_0x874b('0x2f')][_0x874b('0x4d')]({'where':{'id':_0x59c2e4[_0x874b('0x48')]['id']}})[_0x874b('0x28')](handleEntityNotFound(_0x4f9dc5,null))[_0x874b('0x28')](saveUpdates(_0x59c2e4['body'],null))[_0x874b('0x28')](respondWithResult(_0x4f9dc5,null))[_0x874b('0x46')](handleError(_0x4f9dc5,null));};exports[_0x874b('0x29')]=function(_0x4fcb18,_0x163502){return db[_0x874b('0x2f')][_0x874b('0x4d')]({'where':{'id':_0x4fcb18[_0x874b('0x48')]['id']}})[_0x874b('0x28')](handleEntityNotFound(_0x163502,null))[_0x874b('0x28')](removeEntity(_0x163502,null))[_0x874b('0x46')](handleError(_0x163502,null));};exports[_0x874b('0x4e')]=function(_0x19204f,_0x45a03f,_0x77a9ec){var _0x402120={};var _0x419482={};var _0x569836;var _0x3b7f6a;return db[_0x874b('0x2f')][_0x874b('0x4f')]({'where':{'id':_0x19204f[_0x874b('0x48')]['id']}})['then'](handleEntityNotFound(_0x45a03f,null))['then'](function(_0x4ffbc8){if(_0x4ffbc8){_0x569836=_0x4ffbc8;_0x419482[_0x874b('0x34')]=_[_0x874b('0x36')](db['VtigerField'][_0x874b('0x30')]);_0x419482['query']=_[_0x874b('0x36')](_0x19204f[_0x874b('0x35')]);_0x419482[_0x874b('0x37')]=_[_0x874b('0x38')](_0x419482[_0x874b('0x34')],_0x419482[_0x874b('0x35')]);_0x402120['attributes']=_[_0x874b('0x38')](_0x419482[_0x874b('0x34')],qs['fields'](_0x19204f[_0x874b('0x35')]['fields']));_0x402120[_0x874b('0x3a')]=_0x402120[_0x874b('0x3a')]['length']?_0x402120[_0x874b('0x3a')]:_0x419482[_0x874b('0x34')];_0x402120[_0x874b('0x3d')]=qs[_0x874b('0x3e')](_0x19204f['query'][_0x874b('0x3e')]);_0x402120[_0x874b('0x41')]=qs['filters'](_[_0x874b('0x3f')](_0x19204f[_0x874b('0x35')],_0x419482['filters']));if(_0x19204f[_0x874b('0x35')][_0x874b('0x50')]){_0x402120[_0x874b('0x41')]=_[_0x874b('0x40')](_0x402120['where'],{'$or':_['map'](_0x402120['attributes'],function(_0x370a69){var _0x2afcfa={};_0x2afcfa[_0x370a69]={'$like':'%'+_0x19204f[_0x874b('0x35')][_0x874b('0x50')]+'%'};return _0x2afcfa;})});}_0x402120=_['merge']({},_0x402120,_0x19204f['options']);return _0x569836['getFields'](_0x402120);}})['then'](function(_0x6bad76){if(_0x6bad76){_0x3b7f6a=_0x6bad76[_0x874b('0x3b')];if(!_0x19204f['query'][_0x874b('0x51')](_0x874b('0x3c'))){_0x402120[_0x874b('0x22')]=qs[_0x874b('0x22')](_0x19204f[_0x874b('0x35')][_0x874b('0x22')]);_0x402120[_0x874b('0x1f')]=qs[_0x874b('0x1f')](_0x19204f[_0x874b('0x35')]['offset']);}return _0x569836[_0x874b('0x4e')](_0x402120);}})['then'](function(_0x4b1c78){if(_0x4b1c78){return _0x4b1c78?{'count':_0x3b7f6a,'rows':_0x4b1c78}:null;}})[_0x874b('0x28')](respondWithResult(_0x45a03f,null))[_0x874b('0x46')](handleError(_0x45a03f,null));};exports[_0x874b('0x52')]=function(_0x58c848,_0x407c9f,_0x26760e){var _0x25c0ba={};var _0x5918b2={};var _0x48f9b2;var _0xf44bf7;return db[_0x874b('0x2f')][_0x874b('0x4f')]({'where':{'id':_0x58c848[_0x874b('0x48')]['id']}})[_0x874b('0x28')](handleEntityNotFound(_0x407c9f,null))[_0x874b('0x28')](function(_0x55264c){if(_0x55264c){_0x48f9b2=_0x55264c;_0x5918b2[_0x874b('0x34')]=_['keys'](db[_0x874b('0x53')]['rawAttributes']);_0x5918b2['query']=_[_0x874b('0x36')](_0x58c848[_0x874b('0x35')]);_0x5918b2['filters']=_['intersection'](_0x5918b2[_0x874b('0x34')],_0x5918b2['query']);_0x25c0ba['attributes']=_['intersection'](_0x5918b2['model'],qs[_0x874b('0x39')](_0x58c848[_0x874b('0x35')][_0x874b('0x39')]));_0x25c0ba[_0x874b('0x3a')]=_0x25c0ba[_0x874b('0x3a')][_0x874b('0x3b')]?_0x25c0ba[_0x874b('0x3a')]:_0x5918b2[_0x874b('0x34')];_0x25c0ba[_0x874b('0x3d')]=qs['sort'](_0x58c848['query']['sort']);_0x25c0ba['where']=qs[_0x874b('0x37')](_[_0x874b('0x3f')](_0x58c848[_0x874b('0x35')],_0x5918b2[_0x874b('0x37')]));if(_0x58c848[_0x874b('0x35')][_0x874b('0x50')]){_0x25c0ba['where']=_[_0x874b('0x40')](_0x25c0ba[_0x874b('0x41')],{'$or':_[_0x874b('0x2e')](_0x25c0ba[_0x874b('0x3a')],function(_0xd75247){var _0x3bcf2f={};_0x3bcf2f[_0xd75247]={'$like':'%'+_0x58c848[_0x874b('0x35')]['filter']+'%'};return _0x3bcf2f;})});}_0x25c0ba=_[_0x874b('0x40')]({},_0x25c0ba,_0x58c848[_0x874b('0x43')]);return _0x48f9b2[_0x874b('0x52')](_0x25c0ba);}})[_0x874b('0x28')](function(_0x229e71){if(_0x229e71){_0xf44bf7=_0x229e71[_0x874b('0x3b')];if(!_0x58c848['query'][_0x874b('0x51')]('nolimit')){_0x25c0ba[_0x874b('0x22')]=qs['limit'](_0x58c848['query'][_0x874b('0x22')]);_0x25c0ba[_0x874b('0x1f')]=qs[_0x874b('0x1f')](_0x58c848[_0x874b('0x35')][_0x874b('0x1f')]);}return _0x48f9b2[_0x874b('0x52')](_0x25c0ba);}})[_0x874b('0x28')](function(_0x13c6e4){if(_0x13c6e4){return _0x13c6e4?{'count':_0xf44bf7,'rows':_0x13c6e4}:null;}})[_0x874b('0x28')](respondWithResult(_0x407c9f,null))[_0x874b('0x46')](handleError(_0x407c9f,null));};exports[_0x874b('0x54')]=function(_0x1cd369,_0x3e48aa,_0x4d6bbf){var _0x5c925c={};var _0x5a5b20={};var _0xfc87aa;var _0x1b007e;return db[_0x874b('0x2f')]['findOne']({'where':{'id':_0x1cd369[_0x874b('0x48')]['id']}})[_0x874b('0x28')](handleEntityNotFound(_0x3e48aa,null))['then'](function(_0x3c4d4a){if(_0x3c4d4a){_0xfc87aa=_0x3c4d4a;_0x5a5b20[_0x874b('0x34')]=_[_0x874b('0x36')](db[_0x874b('0x53')][_0x874b('0x30')]);_0x5a5b20['query']=_[_0x874b('0x36')](_0x1cd369[_0x874b('0x35')]);_0x5a5b20[_0x874b('0x37')]=_[_0x874b('0x38')](_0x5a5b20[_0x874b('0x34')],_0x5a5b20[_0x874b('0x35')]);_0x5c925c[_0x874b('0x3a')]=_[_0x874b('0x38')](_0x5a5b20[_0x874b('0x34')],qs['fields'](_0x1cd369[_0x874b('0x35')][_0x874b('0x39')]));_0x5c925c['attributes']=_0x5c925c[_0x874b('0x3a')][_0x874b('0x3b')]?_0x5c925c[_0x874b('0x3a')]:_0x5a5b20[_0x874b('0x34')];_0x5c925c['order']=qs[_0x874b('0x3e')](_0x1cd369[_0x874b('0x35')][_0x874b('0x3e')]);_0x5c925c['where']=qs['filters'](_[_0x874b('0x3f')](_0x1cd369['query'],_0x5a5b20[_0x874b('0x37')]));if(_0x1cd369['query'][_0x874b('0x50')]){_0x5c925c[_0x874b('0x41')]=_[_0x874b('0x40')](_0x5c925c[_0x874b('0x41')],{'$or':_[_0x874b('0x2e')](_0x5c925c['attributes'],function(_0x20131e){var _0x5f28fd={};_0x5f28fd[_0x20131e]={'$like':'%'+_0x1cd369['query']['filter']+'%'};return _0x5f28fd;})});}_0x5c925c=_[_0x874b('0x40')]({},_0x5c925c,_0x1cd369[_0x874b('0x43')]);return _0xfc87aa[_0x874b('0x54')](_0x5c925c);}})[_0x874b('0x28')](function(_0x4986d6){if(_0x4986d6){_0x1b007e=_0x4986d6[_0x874b('0x3b')];if(!_0x1cd369['query'][_0x874b('0x51')](_0x874b('0x3c'))){_0x5c925c[_0x874b('0x22')]=qs[_0x874b('0x22')](_0x1cd369[_0x874b('0x35')]['limit']);_0x5c925c[_0x874b('0x1f')]=qs[_0x874b('0x1f')](_0x1cd369[_0x874b('0x35')]['offset']);}return _0xfc87aa[_0x874b('0x54')](_0x5c925c);}})['then'](function(_0x3d529e){if(_0x3d529e){return _0x3d529e?{'count':_0x1b007e,'rows':_0x3d529e}:null;}})[_0x874b('0x28')](respondWithResult(_0x3e48aa,null))[_0x874b('0x46')](handleError(_0x3e48aa,null));}; \ No newline at end of file +var _0xa74d=['json','reject','save','then','destroy','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','update','getFields','findOne','VtigerField','pick','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range'];(function(_0x2b7339,_0x2c57be){var _0x1f9d16=function(_0x4c9b32){while(--_0x4c9b32){_0x2b7339['push'](_0x2b7339['shift']());}};_0x1f9d16(++_0x2c57be);}(_0xa74d,0x1cf));var _0xda74=function(_0x3ca892,_0x483075){_0x3ca892=_0x3ca892-0x0;var _0x1e144f=_0xa74d[_0x3ca892];return _0x1e144f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda74('0x0'));var zipdir=require(_0xda74('0x1'));var jsonpatch=require(_0xda74('0x2'));var rp=require(_0xda74('0x3'));var moment=require(_0xda74('0x4'));var BPromise=require(_0xda74('0x5'));var Mustache=require('mustache');var util=require(_0xda74('0x6'));var path=require(_0xda74('0x7'));var sox=require(_0xda74('0x8'));var csv=require(_0xda74('0x9'));var ejs=require(_0xda74('0xa'));var fs=require('fs');var fs_extra=require(_0xda74('0xb'));var _=require(_0xda74('0xc'));var squel=require(_0xda74('0xd'));var crypto=require('crypto');var jsforce=require(_0xda74('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xda74('0xf'));var Papa=require(_0xda74('0x10'));var Redis=require('ioredis');var authService=require(_0xda74('0x11'));var qs=require(_0xda74('0x12'));var as=require(_0xda74('0x13'));var hardwareService=require(_0xda74('0x14'));var logger=require(_0xda74('0x15'))(_0xda74('0x16'));var utils=require(_0xda74('0x17'));var config=require(_0xda74('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xda74('0x19'))['db'];function respondWithStatusCode(_0x406f23,_0x4236ed){_0x4236ed=_0x4236ed||0xcc;return function(_0x4ebe0f){if(_0x4ebe0f){return _0x406f23[_0xda74('0x1a')](_0x4236ed);}return _0x406f23[_0xda74('0x1b')](_0x4236ed)[_0xda74('0x1c')]();};}function respondWithResult(_0x251200,_0x447135){_0x447135=_0x447135||0xc8;return function(_0x159383){if(_0x159383){return _0x251200[_0xda74('0x1b')](_0x447135)['json'](_0x159383);}};}function respondWithFilteredResult(_0x392ab4,_0x375e14){return function(_0xa4990){if(_0xa4990){var _0x150e9a=typeof _0x375e14[_0xda74('0x1d')]==='undefined'&&typeof _0x375e14[_0xda74('0x1e')]===_0xda74('0x1f');var _0x1cef55=_0xa4990[_0xda74('0x20')];var _0x28baa9=_0x150e9a?0x0:_0x375e14[_0xda74('0x1d')];var _0x179a63=_0x150e9a?_0xa4990['count']:_0x375e14[_0xda74('0x1d')]+_0x375e14[_0xda74('0x1e')];var _0x26cf31;if(_0x179a63>=_0x1cef55){_0x179a63=_0x1cef55;_0x26cf31=0xc8;}else{_0x26cf31=0xce;}_0x392ab4[_0xda74('0x1b')](_0x26cf31);return _0x392ab4[_0xda74('0x21')](_0xda74('0x22'),_0x28baa9+'-'+_0x179a63+'/'+_0x1cef55)[_0xda74('0x23')](_0xa4990);}return null;};}function patchUpdates(_0x291dd6){return function(_0x4f4efb){try{jsonpatch['apply'](_0x4f4efb,_0x291dd6,!![]);}catch(_0x58ed24){return BPromise[_0xda74('0x24')](_0x58ed24);}return _0x4f4efb[_0xda74('0x25')]();};}function saveUpdates(_0x16ba3c,_0x4494ad){return function(_0x4adae1){if(_0x4adae1){return _0x4adae1['update'](_0x16ba3c)[_0xda74('0x26')](function(_0x2b5c0d){return _0x2b5c0d;});}return null;};}function removeEntity(_0x33a414,_0x20371e){return function(_0x34e2c9){if(_0x34e2c9){return _0x34e2c9[_0xda74('0x27')]()[_0xda74('0x26')](function(){_0x33a414[_0xda74('0x1b')](0xcc)[_0xda74('0x1c')]();});}};}function handleEntityNotFound(_0x42168e,_0x46dd65){return function(_0x5a01d4){if(!_0x5a01d4){_0x42168e[_0xda74('0x1a')](0x194);}return _0x5a01d4;};}function handleError(_0xf9e34a,_0x4fea29){_0x4fea29=_0x4fea29||0x1f4;return function(_0x41f6c7){logger[_0xda74('0x28')](_0x41f6c7[_0xda74('0x29')]);if(_0x41f6c7[_0xda74('0x2a')]){delete _0x41f6c7[_0xda74('0x2a')];}_0xf9e34a['status'](_0x4fea29)['send'](_0x41f6c7);};}exports[_0xda74('0x2b')]=function(_0x4d0098,_0x1651aa){var _0x250e50={},_0x54788b={},_0x2e0bdb={'count':0x0,'rows':[]};var _0x58e113=_[_0xda74('0x2c')](db[_0xda74('0x2d')][_0xda74('0x2e')],function(_0x5aa785){return{'name':_0x5aa785[_0xda74('0x2f')],'type':_0x5aa785[_0xda74('0x30')][_0xda74('0x31')]};});_0x54788b[_0xda74('0x32')]=_['map'](_0x58e113,_0xda74('0x2a'));_0x54788b[_0xda74('0x33')]=_['keys'](_0x4d0098[_0xda74('0x33')]);_0x54788b[_0xda74('0x34')]=_[_0xda74('0x35')](_0x54788b[_0xda74('0x32')],_0x54788b[_0xda74('0x33')]);_0x250e50['attributes']=_[_0xda74('0x35')](_0x54788b[_0xda74('0x32')],qs['fields'](_0x4d0098['query'][_0xda74('0x36')]));_0x250e50[_0xda74('0x37')]=_0x250e50[_0xda74('0x37')][_0xda74('0x38')]?_0x250e50[_0xda74('0x37')]:_0x54788b[_0xda74('0x32')];if(!_0x4d0098['query'][_0xda74('0x39')](_0xda74('0x3a'))){_0x250e50[_0xda74('0x1e')]=qs[_0xda74('0x1e')](_0x4d0098[_0xda74('0x33')]['limit']);_0x250e50[_0xda74('0x1d')]=qs[_0xda74('0x1d')](_0x4d0098[_0xda74('0x33')][_0xda74('0x1d')]);}_0x250e50[_0xda74('0x3b')]=qs[_0xda74('0x3c')](_0x4d0098[_0xda74('0x33')][_0xda74('0x3c')]);_0x250e50[_0xda74('0x3d')]=qs[_0xda74('0x34')](_['pick'](_0x4d0098[_0xda74('0x33')],_0x54788b[_0xda74('0x34')]),_0x58e113);if(_0x4d0098[_0xda74('0x33')][_0xda74('0x3e')]){_0x250e50[_0xda74('0x3d')]=_['merge'](_0x250e50[_0xda74('0x3d')],{'$or':_['map'](_0x58e113,function(_0x3dcd87){if(_0x3dcd87[_0xda74('0x30')]!==_0xda74('0x3f')){var _0x21b48c={};_0x21b48c[_0x3dcd87[_0xda74('0x2a')]]={'$like':'%'+_0x4d0098[_0xda74('0x33')][_0xda74('0x3e')]+'%'};return _0x21b48c;}})});}_0x250e50=_[_0xda74('0x40')]({},_0x250e50,_0x4d0098[_0xda74('0x41')]);var _0x26f8f8={'where':_0x250e50[_0xda74('0x3d')]};return db[_0xda74('0x2d')]['count'](_0x26f8f8)[_0xda74('0x26')](function(_0x5a3503){_0x2e0bdb[_0xda74('0x20')]=_0x5a3503;if(_0x4d0098[_0xda74('0x33')][_0xda74('0x42')]){_0x250e50[_0xda74('0x43')]=[{'all':!![]}];}return db[_0xda74('0x2d')][_0xda74('0x44')](_0x250e50);})['then'](function(_0x3175d0){_0x2e0bdb['rows']=_0x3175d0;return _0x2e0bdb;})[_0xda74('0x26')](respondWithFilteredResult(_0x1651aa,_0x250e50))[_0xda74('0x45')](handleError(_0x1651aa,null));};exports[_0xda74('0x46')]=function(_0x50f690,_0x4100c7){var _0x50d74b={'raw':![],'where':{'id':_0x50f690[_0xda74('0x47')]['id']}},_0x12a54a={};_0x12a54a[_0xda74('0x32')]=_[_0xda74('0x48')](db[_0xda74('0x2d')][_0xda74('0x2e')]);_0x12a54a['query']=_['keys'](_0x50f690[_0xda74('0x33')]);_0x12a54a[_0xda74('0x34')]=_[_0xda74('0x35')](_0x12a54a[_0xda74('0x32')],_0x12a54a[_0xda74('0x33')]);_0x50d74b[_0xda74('0x37')]=_[_0xda74('0x35')](_0x12a54a[_0xda74('0x32')],qs[_0xda74('0x36')](_0x50f690[_0xda74('0x33')]['fields']));_0x50d74b['attributes']=_0x50d74b['attributes'][_0xda74('0x38')]?_0x50d74b[_0xda74('0x37')]:_0x12a54a[_0xda74('0x32')];if(_0x50f690[_0xda74('0x33')][_0xda74('0x42')]){_0x50d74b[_0xda74('0x43')]=[{'all':!![]}];}_0x50d74b=_[_0xda74('0x40')]({},_0x50d74b,_0x50f690[_0xda74('0x41')]);return db[_0xda74('0x2d')][_0xda74('0x49')](_0x50d74b)['then'](handleEntityNotFound(_0x4100c7,null))[_0xda74('0x26')](respondWithResult(_0x4100c7,null))[_0xda74('0x45')](handleError(_0x4100c7,null));};exports['create']=function(_0x3d04a6,_0x5b6ebd){return db['VtigerConfiguration'][_0xda74('0x4a')](_0x3d04a6[_0xda74('0x4b')],{})[_0xda74('0x26')](respondWithResult(_0x5b6ebd,0xc9))[_0xda74('0x45')](handleError(_0x5b6ebd,null));};exports[_0xda74('0x4c')]=function(_0x5164c0,_0x13c583){if(_0x5164c0[_0xda74('0x4b')]['id']){delete _0x5164c0[_0xda74('0x4b')]['id'];}return db[_0xda74('0x2d')][_0xda74('0x49')]({'where':{'id':_0x5164c0[_0xda74('0x47')]['id']}})['then'](handleEntityNotFound(_0x13c583,null))['then'](saveUpdates(_0x5164c0[_0xda74('0x4b')],null))[_0xda74('0x26')](respondWithResult(_0x13c583,null))[_0xda74('0x45')](handleError(_0x13c583,null));};exports['destroy']=function(_0x4b5874,_0xe68542){return db[_0xda74('0x2d')][_0xda74('0x49')]({'where':{'id':_0x4b5874[_0xda74('0x47')]['id']}})[_0xda74('0x26')](handleEntityNotFound(_0xe68542,null))[_0xda74('0x26')](removeEntity(_0xe68542,null))[_0xda74('0x45')](handleError(_0xe68542,null));};exports[_0xda74('0x4d')]=function(_0x50ed00,_0x40307e,_0x1ca4d3){var _0x1d6f5f={};var _0x5c3709={};var _0x3755fc;var _0x214175;return db[_0xda74('0x2d')][_0xda74('0x4e')]({'where':{'id':_0x50ed00[_0xda74('0x47')]['id']}})[_0xda74('0x26')](handleEntityNotFound(_0x40307e,null))[_0xda74('0x26')](function(_0x24253b){if(_0x24253b){_0x3755fc=_0x24253b;_0x5c3709[_0xda74('0x32')]=_[_0xda74('0x48')](db[_0xda74('0x4f')][_0xda74('0x2e')]);_0x5c3709[_0xda74('0x33')]=_[_0xda74('0x48')](_0x50ed00[_0xda74('0x33')]);_0x5c3709[_0xda74('0x34')]=_[_0xda74('0x35')](_0x5c3709['model'],_0x5c3709[_0xda74('0x33')]);_0x1d6f5f['attributes']=_[_0xda74('0x35')](_0x5c3709['model'],qs[_0xda74('0x36')](_0x50ed00[_0xda74('0x33')][_0xda74('0x36')]));_0x1d6f5f[_0xda74('0x37')]=_0x1d6f5f[_0xda74('0x37')]['length']?_0x1d6f5f[_0xda74('0x37')]:_0x5c3709[_0xda74('0x32')];_0x1d6f5f['order']=qs[_0xda74('0x3c')](_0x50ed00[_0xda74('0x33')][_0xda74('0x3c')]);_0x1d6f5f[_0xda74('0x3d')]=qs[_0xda74('0x34')](_[_0xda74('0x50')](_0x50ed00[_0xda74('0x33')],_0x5c3709[_0xda74('0x34')]));if(_0x50ed00[_0xda74('0x33')][_0xda74('0x3e')]){_0x1d6f5f[_0xda74('0x3d')]=_[_0xda74('0x40')](_0x1d6f5f[_0xda74('0x3d')],{'$or':_[_0xda74('0x2c')](_0x1d6f5f[_0xda74('0x37')],function(_0x585e66){var _0xe7d10c={};_0xe7d10c[_0x585e66]={'$like':'%'+_0x50ed00['query']['filter']+'%'};return _0xe7d10c;})});}_0x1d6f5f=_[_0xda74('0x40')]({},_0x1d6f5f,_0x50ed00['options']);return _0x3755fc[_0xda74('0x4d')](_0x1d6f5f);}})[_0xda74('0x26')](function(_0x31e0b4){if(_0x31e0b4){_0x214175=_0x31e0b4[_0xda74('0x38')];if(!_0x50ed00[_0xda74('0x33')][_0xda74('0x39')](_0xda74('0x3a'))){_0x1d6f5f[_0xda74('0x1e')]=qs[_0xda74('0x1e')](_0x50ed00[_0xda74('0x33')][_0xda74('0x1e')]);_0x1d6f5f[_0xda74('0x1d')]=qs[_0xda74('0x1d')](_0x50ed00[_0xda74('0x33')][_0xda74('0x1d')]);}return _0x3755fc[_0xda74('0x4d')](_0x1d6f5f);}})['then'](function(_0x135938){if(_0x135938){return _0x135938?{'count':_0x214175,'rows':_0x135938}:null;}})[_0xda74('0x26')](respondWithResult(_0x40307e,null))['catch'](handleError(_0x40307e,null));};exports[_0xda74('0x51')]=function(_0x35b7d4,_0x5e3700,_0x2d8cb5){var _0x35d1ea={};var _0x4aaad6={};var _0x1fdf7b;var _0x240864;return db[_0xda74('0x2d')][_0xda74('0x4e')]({'where':{'id':_0x35b7d4[_0xda74('0x47')]['id']}})[_0xda74('0x26')](handleEntityNotFound(_0x5e3700,null))[_0xda74('0x26')](function(_0x36dbf7){if(_0x36dbf7){_0x1fdf7b=_0x36dbf7;_0x4aaad6[_0xda74('0x32')]=_['keys'](db['VtigerField'][_0xda74('0x2e')]);_0x4aaad6[_0xda74('0x33')]=_[_0xda74('0x48')](_0x35b7d4[_0xda74('0x33')]);_0x4aaad6[_0xda74('0x34')]=_['intersection'](_0x4aaad6[_0xda74('0x32')],_0x4aaad6[_0xda74('0x33')]);_0x35d1ea[_0xda74('0x37')]=_[_0xda74('0x35')](_0x4aaad6[_0xda74('0x32')],qs[_0xda74('0x36')](_0x35b7d4[_0xda74('0x33')]['fields']));_0x35d1ea[_0xda74('0x37')]=_0x35d1ea['attributes']['length']?_0x35d1ea['attributes']:_0x4aaad6[_0xda74('0x32')];_0x35d1ea[_0xda74('0x3b')]=qs[_0xda74('0x3c')](_0x35b7d4['query'][_0xda74('0x3c')]);_0x35d1ea[_0xda74('0x3d')]=qs[_0xda74('0x34')](_[_0xda74('0x50')](_0x35b7d4[_0xda74('0x33')],_0x4aaad6['filters']));if(_0x35b7d4[_0xda74('0x33')][_0xda74('0x3e')]){_0x35d1ea[_0xda74('0x3d')]=_[_0xda74('0x40')](_0x35d1ea[_0xda74('0x3d')],{'$or':_['map'](_0x35d1ea['attributes'],function(_0x34dffb){var _0x567b34={};_0x567b34[_0x34dffb]={'$like':'%'+_0x35b7d4[_0xda74('0x33')]['filter']+'%'};return _0x567b34;})});}_0x35d1ea=_[_0xda74('0x40')]({},_0x35d1ea,_0x35b7d4[_0xda74('0x41')]);return _0x1fdf7b[_0xda74('0x51')](_0x35d1ea);}})[_0xda74('0x26')](function(_0x266cd8){if(_0x266cd8){_0x240864=_0x266cd8[_0xda74('0x38')];if(!_0x35b7d4[_0xda74('0x33')]['hasOwnProperty'](_0xda74('0x3a'))){_0x35d1ea[_0xda74('0x1e')]=qs['limit'](_0x35b7d4['query'][_0xda74('0x1e')]);_0x35d1ea[_0xda74('0x1d')]=qs[_0xda74('0x1d')](_0x35b7d4[_0xda74('0x33')]['offset']);}return _0x1fdf7b[_0xda74('0x51')](_0x35d1ea);}})[_0xda74('0x26')](function(_0x16eaff){if(_0x16eaff){return _0x16eaff?{'count':_0x240864,'rows':_0x16eaff}:null;}})[_0xda74('0x26')](respondWithResult(_0x5e3700,null))[_0xda74('0x45')](handleError(_0x5e3700,null));};exports[_0xda74('0x52')]=function(_0x115c38,_0x3870ac,_0x1fa5c9){var _0x4d4f4c={};var _0xae2cd3={};var _0x5f1dce;var _0x165beb;return db[_0xda74('0x2d')]['findOne']({'where':{'id':_0x115c38[_0xda74('0x47')]['id']}})[_0xda74('0x26')](handleEntityNotFound(_0x3870ac,null))[_0xda74('0x26')](function(_0x293860){if(_0x293860){_0x5f1dce=_0x293860;_0xae2cd3[_0xda74('0x32')]=_[_0xda74('0x48')](db[_0xda74('0x4f')][_0xda74('0x2e')]);_0xae2cd3[_0xda74('0x33')]=_[_0xda74('0x48')](_0x115c38[_0xda74('0x33')]);_0xae2cd3[_0xda74('0x34')]=_[_0xda74('0x35')](_0xae2cd3['model'],_0xae2cd3[_0xda74('0x33')]);_0x4d4f4c[_0xda74('0x37')]=_['intersection'](_0xae2cd3[_0xda74('0x32')],qs[_0xda74('0x36')](_0x115c38['query']['fields']));_0x4d4f4c['attributes']=_0x4d4f4c[_0xda74('0x37')][_0xda74('0x38')]?_0x4d4f4c[_0xda74('0x37')]:_0xae2cd3['model'];_0x4d4f4c[_0xda74('0x3b')]=qs[_0xda74('0x3c')](_0x115c38[_0xda74('0x33')]['sort']);_0x4d4f4c[_0xda74('0x3d')]=qs['filters'](_['pick'](_0x115c38[_0xda74('0x33')],_0xae2cd3['filters']));if(_0x115c38[_0xda74('0x33')]['filter']){_0x4d4f4c['where']=_[_0xda74('0x40')](_0x4d4f4c[_0xda74('0x3d')],{'$or':_[_0xda74('0x2c')](_0x4d4f4c['attributes'],function(_0xa06f56){var _0x3cc31d={};_0x3cc31d[_0xa06f56]={'$like':'%'+_0x115c38[_0xda74('0x33')][_0xda74('0x3e')]+'%'};return _0x3cc31d;})});}_0x4d4f4c=_[_0xda74('0x40')]({},_0x4d4f4c,_0x115c38[_0xda74('0x41')]);return _0x5f1dce['getDescriptions'](_0x4d4f4c);}})[_0xda74('0x26')](function(_0x35ad3f){if(_0x35ad3f){_0x165beb=_0x35ad3f[_0xda74('0x38')];if(!_0x115c38['query'][_0xda74('0x39')]('nolimit')){_0x4d4f4c[_0xda74('0x1e')]=qs['limit'](_0x115c38[_0xda74('0x33')]['limit']);_0x4d4f4c[_0xda74('0x1d')]=qs[_0xda74('0x1d')](_0x115c38[_0xda74('0x33')][_0xda74('0x1d')]);}return _0x5f1dce['getDescriptions'](_0x4d4f4c);}})['then'](function(_0x73a592){if(_0x73a592){return _0x73a592?{'count':_0x165beb,'rows':_0x73a592}:null;}})[_0xda74('0x26')](respondWithResult(_0x3870ac,null))['catch'](handleError(_0x3870ac,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index dd5911f..34afdd5 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 _0x1d33=['moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash','util','../../config/logger','api'];(function(_0x3699c6,_0x4f21c7){var _0x4be66c=function(_0x28322f){while(--_0x28322f){_0x3699c6['push'](_0x3699c6['shift']());}};_0x4be66c(++_0x4f21c7);}(_0x1d33,0x1dd));var _0x31d3=function(_0x2fca24,_0x2fd185){_0x2fca24=_0x2fca24-0x0;var _0x3a42fb=_0x1d33[_0x2fca24];return _0x3a42fb;};'use strict';var _=require(_0x31d3('0x0'));var util=require(_0x31d3('0x1'));var logger=require(_0x31d3('0x2'))(_0x31d3('0x3'));var moment=require(_0x31d3('0x4'));var BPromise=require(_0x31d3('0x5'));var rp=require(_0x31d3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31d3('0x7'));var config=require(_0x31d3('0x8'));var attributes=require(_0x31d3('0x9'));module[_0x31d3('0xa')]=function(_0x50b49f,_0x1a165f){return _0x50b49f[_0x31d3('0xb')](_0x31d3('0xc'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a4f=['rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3ab6f2,_0x374698){var _0x39c3ab=function(_0x127723){while(--_0x127723){_0x3ab6f2['push'](_0x3ab6f2['shift']());}};_0x39c3ab(++_0x374698);}(_0x8a4f,0x1db));var _0xf8a4=function(_0x3af9c5,_0x42796b){_0x3af9c5=_0x3af9c5-0x0;var _0x46d46d=_0x8a4f[_0x3af9c5];return _0x46d46d;};'use strict';var _=require(_0xf8a4('0x0'));var util=require(_0xf8a4('0x1'));var logger=require('../../config/logger')(_0xf8a4('0x2'));var moment=require(_0xf8a4('0x3'));var BPromise=require(_0xf8a4('0x4'));var rp=require(_0xf8a4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8a4('0x6'));var config=require(_0xf8a4('0x7'));var attributes=require(_0xf8a4('0x8'));module[_0xf8a4('0x9')]=function(_0x156683,_0x7ec01e){return _0x156683[_0xf8a4('0xa')](_0xf8a4('0xb'),attributes,{'tableName':_0xf8a4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index c8da1e3..bb54dde 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 _0x2f51=['error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x415bbe,_0x2d79c7){var _0x42ebc7=function(_0x272efb){while(--_0x272efb){_0x415bbe['push'](_0x415bbe['shift']());}};_0x42ebc7(++_0x2d79c7);}(_0x2f51,0x154));var _0x12f5=function(_0x30c92b,_0x154324){_0x30c92b=_0x30c92b-0x0;var _0x33837b=_0x2f51[_0x30c92b];return _0x33837b;};'use strict';var _=require(_0x12f5('0x0'));var util=require(_0x12f5('0x1'));var moment=require(_0x12f5('0x2'));var BPromise=require(_0x12f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x12f5('0x4'));var db=require(_0x12f5('0x5'))['db'];var utils=require(_0x12f5('0x6'));var logger=require(_0x12f5('0x7'))(_0x12f5('0x8'));var config=require(_0x12f5('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x12f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x285e90,_0x3833a5,_0x203466){return new BPromise(function(_0x35d274,_0x2cee65){return client['request'](_0x285e90,_0x203466)['then'](function(_0x414aff){logger[_0x12f5('0xb')](_0x12f5('0xc'),_0x3833a5,_0x12f5('0xd'));logger[_0x12f5('0xe')](_0x12f5('0xf'),_0x3833a5,'request\x20sent',JSON[_0x12f5('0x10')](_0x414aff));if(_0x414aff[_0x12f5('0x11')]){if(_0x414aff[_0x12f5('0x11')][_0x12f5('0x12')]===0x1f4){logger[_0x12f5('0x11')](_0x12f5('0xc'),_0x3833a5,_0x414aff['error']['message']);return _0x2cee65(_0x414aff[_0x12f5('0x11')][_0x12f5('0x13')]);}logger[_0x12f5('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x3833a5,_0x414aff[_0x12f5('0x11')]['message']);return _0x35d274(_0x414aff['error']['message']);}else{logger[_0x12f5('0xb')](_0x12f5('0xc'),_0x3833a5,'request\x20sent');_0x35d274(_0x414aff[_0x12f5('0x14')]['message']);}})['catch'](function(_0x32151b){logger[_0x12f5('0x11')](_0x12f5('0xc'),_0x3833a5,_0x32151b);_0x2cee65(_0x32151b);});});} \ No newline at end of file +var _0x0633=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x258146,_0x21dbf2){var _0x5b7f90=function(_0x3f571e){while(--_0x3f571e){_0x258146['push'](_0x258146['shift']());}};_0x5b7f90(++_0x21dbf2);}(_0x0633,0xc6));var _0x3063=function(_0x3f0599,_0xc820ba){_0x3f0599=_0x3f0599-0x0;var _0x304a01=_0x0633[_0x3f0599];return _0x304a01;};'use strict';var _=require(_0x3063('0x0'));var util=require(_0x3063('0x1'));var moment=require(_0x3063('0x2'));var BPromise=require(_0x3063('0x3'));var rs=require(_0x3063('0x4'));var fs=require('fs');var Redis=require(_0x3063('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3063('0x6'));var logger=require(_0x3063('0x7'))(_0x3063('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3063('0x9')][_0x3063('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11037e,_0x38af2f,_0x401063){return new BPromise(function(_0x298ae8,_0x4f2646){return client[_0x3063('0xb')](_0x11037e,_0x401063)[_0x3063('0xc')](function(_0x24a7ef){logger['info'](_0x3063('0xd'),_0x38af2f,_0x3063('0xe'));logger[_0x3063('0xf')](_0x3063('0x10'),_0x38af2f,_0x3063('0xe'),JSON[_0x3063('0x11')](_0x24a7ef));if(_0x24a7ef[_0x3063('0x12')]){if(_0x24a7ef[_0x3063('0x12')]['code']===0x1f4){logger[_0x3063('0x12')](_0x3063('0xd'),_0x38af2f,_0x24a7ef[_0x3063('0x12')][_0x3063('0x13')]);return _0x4f2646(_0x24a7ef[_0x3063('0x12')][_0x3063('0x13')]);}logger['error'](_0x3063('0xd'),_0x38af2f,_0x24a7ef['error']['message']);return _0x298ae8(_0x24a7ef[_0x3063('0x12')]['message']);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x38af2f,_0x3063('0xe'));_0x298ae8(_0x24a7ef[_0x3063('0x14')][_0x3063('0x13')]);}})[_0x3063('0x15')](function(_0x139356){logger[_0x3063('0x12')](_0x3063('0xd'),_0x38af2f,_0x139356);_0x4f2646(_0x139356);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 1ed8aa1..e64eb7a 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 _0xc9ef=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','/:id','show','post','create','update','destroy','exports'];(function(_0x1977cb,_0x2fd982){var _0x3ceded=function(_0x3a004d){while(--_0x3a004d){_0x1977cb['push'](_0x1977cb['shift']());}};_0x3ceded(++_0x2fd982);}(_0xc9ef,0x198));var _0xfc9e=function(_0x141a1b,_0x48ce01){_0x141a1b=_0x141a1b-0x0;var _0x54319f=_0xc9ef[_0x141a1b];return _0x54319f;};'use strict';var multer=require(_0xfc9e('0x0'));var util=require(_0xfc9e('0x1'));var path=require(_0xfc9e('0x2'));var timeout=require('connect-timeout');var express=require(_0xfc9e('0x3'));var router=express[_0xfc9e('0x4')]();var fs_extra=require(_0xfc9e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfc9e('0x6'));var config=require(_0xfc9e('0x7'));var controller=require(_0xfc9e('0x8'));router['get']('/',auth[_0xfc9e('0x9')](),controller['index']);router['get'](_0xfc9e('0xa'),auth[_0xfc9e('0x9')](),controller[_0xfc9e('0xb')]);router[_0xfc9e('0xc')]('/',auth[_0xfc9e('0x9')](),controller[_0xfc9e('0xd')]);router['put'](_0xfc9e('0xa'),auth[_0xfc9e('0x9')](),controller[_0xfc9e('0xe')]);router['delete'](_0xfc9e('0xa'),auth[_0xfc9e('0x9')](),controller[_0xfc9e('0xf')]);module[_0xfc9e('0x10')]=router; \ No newline at end of file +var _0x844a=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','util','path'];(function(_0x2e81a5,_0x52e9ba){var _0x147d36=function(_0x289160){while(--_0x289160){_0x2e81a5['push'](_0x2e81a5['shift']());}};_0x147d36(++_0x52e9ba);}(_0x844a,0x1c9));var _0xa844=function(_0x2a6d98,_0x4ea1e1){_0x2a6d98=_0x2a6d98-0x0;var _0x6f2e49=_0x844a[_0x2a6d98];return _0x6f2e49;};'use strict';var multer=require('multer');var util=require(_0xa844('0x0'));var path=require(_0xa844('0x1'));var timeout=require(_0xa844('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa844('0x3'));var auth=require(_0xa844('0x4'));var interaction=require(_0xa844('0x5'));var config=require(_0xa844('0x6'));var controller=require(_0xa844('0x7'));router[_0xa844('0x8')]('/',auth[_0xa844('0x9')](),controller['index']);router[_0xa844('0x8')](_0xa844('0xa'),auth[_0xa844('0x9')](),controller[_0xa844('0xb')]);router[_0xa844('0xc')]('/',auth[_0xa844('0x9')](),controller['create']);router[_0xa844('0xd')](_0xa844('0xa'),auth[_0xa844('0x9')](),controller['update']);router[_0xa844('0xe')](_0xa844('0xa'),auth[_0xa844('0x9')](),controller[_0xa844('0xf')]);module[_0xa844('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index a7bce88..8bc04c4 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 _0xfa52=['picklist','string','STRING','BOOLEAN','ENUM','variable','customVariable'];(function(_0x272d90,_0x5e70ff){var _0x2bf4a2=function(_0x544da6){while(--_0x544da6){_0x272d90['push'](_0x272d90['shift']());}};_0x2bf4a2(++_0x5e70ff);}(_0xfa52,0x74));var _0x2fa5=function(_0x144175,_0x1c27a3){_0x144175=_0x144175-0x0;var _0x5d3ba9=_0xfa52[_0x144175];return _0x5d3ba9;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x2fa5('0x0')]('string',_0x2fa5('0x1'),_0x2fa5('0x2'),'keyValue',_0x2fa5('0x3')),'defaultValue':_0x2fa5('0x4')},'content':{'type':Sequelize[_0x2fa5('0x5')]},'key':{'type':Sequelize[_0x2fa5('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x2fa5('0x4'),_0x2fa5('0x1'),_0x2fa5('0x2'))},'keyContent':{'type':Sequelize[_0x2fa5('0x5')]},'idField':{'type':Sequelize[_0x2fa5('0x5')]},'nameField':{'type':Sequelize[_0x2fa5('0x5')]},'customField':{'type':Sequelize[_0x2fa5('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2fa5('0x5')]}}; \ No newline at end of file +var _0x695c=['ENUM','variable','exports','string','customVariable','keyValue','picklist','STRING'];(function(_0xb2a1f4,_0x494e38){var _0x5d9cb2=function(_0x5613a4){while(--_0x5613a4){_0xb2a1f4['push'](_0xb2a1f4['shift']());}};_0x5d9cb2(++_0x494e38);}(_0x695c,0x1ea));var _0xc695=function(_0x4b4bdd,_0x3bdf87){_0x4b4bdd=_0x4b4bdd-0x0;var _0x177da5=_0x695c[_0x4b4bdd];return _0x177da5;};'use strict';var Sequelize=require('sequelize');module[_0xc695('0x0')]={'type':{'type':Sequelize['ENUM'](_0xc695('0x1'),'variable',_0xc695('0x2'),_0xc695('0x3'),_0xc695('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc695('0x5')]},'keyType':{'type':Sequelize[_0xc695('0x6')](_0xc695('0x1'),_0xc695('0x7'),_0xc695('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc695('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 7bcabb6..9266399 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 _0x7ab9=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','VtigerField','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','type','filter','options','where','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ab9,0x11b));var _0x97ab=function(_0x25fded,_0x34216e){_0x25fded=_0x25fded-0x0;var _0x269156=_0x7ab9[_0x25fded];return _0x269156;};'use strict';var emlformat=require(_0x97ab('0x0'));var rimraf=require(_0x97ab('0x1'));var zipdir=require(_0x97ab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97ab('0x3'));var moment=require(_0x97ab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x97ab('0x5'));var util=require(_0x97ab('0x6'));var path=require(_0x97ab('0x7'));var sox=require(_0x97ab('0x8'));var csv=require(_0x97ab('0x9'));var ejs=require(_0x97ab('0xa'));var fs=require('fs');var fs_extra=require(_0x97ab('0xb'));var _=require(_0x97ab('0xc'));var squel=require(_0x97ab('0xd'));var crypto=require(_0x97ab('0xe'));var jsforce=require(_0x97ab('0xf'));var deskjs=require(_0x97ab('0x10'));var toCsv=require(_0x97ab('0x9'));var querystring=require('querystring');var Papa=require(_0x97ab('0x11'));var Redis=require(_0x97ab('0x12'));var authService=require(_0x97ab('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x97ab('0x14'));var hardwareService=require(_0x97ab('0x15'));var logger=require(_0x97ab('0x16'))(_0x97ab('0x17'));var utils=require(_0x97ab('0x18'));var config=require(_0x97ab('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x97ab('0x1a'))['db'];function respondWithStatusCode(_0x5c9f54,_0x38e755){_0x38e755=_0x38e755||0xcc;return function(_0xb459b5){if(_0xb459b5){return _0x5c9f54[_0x97ab('0x1b')](_0x38e755);}return _0x5c9f54[_0x97ab('0x1c')](_0x38e755)[_0x97ab('0x1d')]();};}function respondWithResult(_0x47a185,_0x17b6a1){_0x17b6a1=_0x17b6a1||0xc8;return function(_0x46cc23){if(_0x46cc23){return _0x47a185['status'](_0x17b6a1)[_0x97ab('0x1e')](_0x46cc23);}};}function respondWithFilteredResult(_0x4159fc,_0x53407e){return function(_0x308f52){if(_0x308f52){var _0xbc5d87=typeof _0x53407e[_0x97ab('0x1f')]===_0x97ab('0x20')&&typeof _0x53407e[_0x97ab('0x21')]===_0x97ab('0x20');var _0x456018=_0x308f52[_0x97ab('0x22')];var _0xcd3473=_0xbc5d87?0x0:_0x53407e[_0x97ab('0x1f')];var _0x19ad69=_0xbc5d87?_0x308f52['count']:_0x53407e[_0x97ab('0x1f')]+_0x53407e[_0x97ab('0x21')];var _0x528b90;if(_0x19ad69>=_0x456018){_0x19ad69=_0x456018;_0x528b90=0xc8;}else{_0x528b90=0xce;}_0x4159fc['status'](_0x528b90);return _0x4159fc[_0x97ab('0x23')](_0x97ab('0x24'),_0xcd3473+'-'+_0x19ad69+'/'+_0x456018)[_0x97ab('0x1e')](_0x308f52);}return null;};}function patchUpdates(_0x7905d3){return function(_0x1dd63f){try{jsonpatch[_0x97ab('0x25')](_0x1dd63f,_0x7905d3,!![]);}catch(_0x413bfc){return BPromise[_0x97ab('0x26')](_0x413bfc);}return _0x1dd63f['save']();};}function saveUpdates(_0x215752,_0x1ed8b3){return function(_0x1e7918){if(_0x1e7918){return _0x1e7918[_0x97ab('0x27')](_0x215752)[_0x97ab('0x28')](function(_0x6f8249){return _0x6f8249;});}return null;};}function removeEntity(_0x2ff2b1,_0x206171){return function(_0x53c3a9){if(_0x53c3a9){return _0x53c3a9[_0x97ab('0x29')]()[_0x97ab('0x28')](function(){_0x2ff2b1[_0x97ab('0x1c')](0xcc)[_0x97ab('0x1d')]();});}};}function handleEntityNotFound(_0x1c4fde,_0x33be1b){return function(_0x2c841c){if(!_0x2c841c){_0x1c4fde[_0x97ab('0x1b')](0x194);}return _0x2c841c;};}function handleError(_0x3171b9,_0x3dcb17){_0x3dcb17=_0x3dcb17||0x1f4;return function(_0x3c4737){logger['error'](_0x3c4737[_0x97ab('0x2a')]);if(_0x3c4737['name']){delete _0x3c4737[_0x97ab('0x2b')];}_0x3171b9[_0x97ab('0x1c')](_0x3dcb17)[_0x97ab('0x2c')](_0x3c4737);};}exports[_0x97ab('0x2d')]=function(_0x31f930,_0x1dce77){var _0x58808e={},_0x4c8dac={},_0x1ae7eb={'count':0x0,'rows':[]};var _0x41a07f=_[_0x97ab('0x2e')](db[_0x97ab('0x2f')]['rawAttributes'],function(_0x5a5ec8){return{'name':_0x5a5ec8[_0x97ab('0x30')],'type':_0x5a5ec8['type']['key']};});_0x4c8dac[_0x97ab('0x31')]=_[_0x97ab('0x2e')](_0x41a07f,'name');_0x4c8dac[_0x97ab('0x32')]=_[_0x97ab('0x33')](_0x31f930[_0x97ab('0x32')]);_0x4c8dac[_0x97ab('0x34')]=_[_0x97ab('0x35')](_0x4c8dac[_0x97ab('0x31')],_0x4c8dac[_0x97ab('0x32')]);_0x58808e[_0x97ab('0x36')]=_['intersection'](_0x4c8dac['model'],qs[_0x97ab('0x37')](_0x31f930['query'][_0x97ab('0x37')]));_0x58808e['attributes']=_0x58808e[_0x97ab('0x36')][_0x97ab('0x38')]?_0x58808e[_0x97ab('0x36')]:_0x4c8dac['model'];if(!_0x31f930['query'][_0x97ab('0x39')]('nolimit')){_0x58808e[_0x97ab('0x21')]=qs['limit'](_0x31f930[_0x97ab('0x32')][_0x97ab('0x21')]);_0x58808e[_0x97ab('0x1f')]=qs[_0x97ab('0x1f')](_0x31f930['query']['offset']);}_0x58808e[_0x97ab('0x3a')]=qs['sort'](_0x31f930['query'][_0x97ab('0x3b')]);_0x58808e['where']=qs['filters'](_[_0x97ab('0x3c')](_0x31f930[_0x97ab('0x32')],_0x4c8dac[_0x97ab('0x34')]),_0x41a07f);if(_0x31f930[_0x97ab('0x32')]['filter']){_0x58808e['where']=_[_0x97ab('0x3d')](_0x58808e['where'],{'$or':_[_0x97ab('0x2e')](_0x41a07f,function(_0x4310fe){if(_0x4310fe[_0x97ab('0x3e')]!=='VIRTUAL'){var _0x3affde={};_0x3affde[_0x4310fe[_0x97ab('0x2b')]]={'$like':'%'+_0x31f930['query'][_0x97ab('0x3f')]+'%'};return _0x3affde;}})});}_0x58808e=_[_0x97ab('0x3d')]({},_0x58808e,_0x31f930[_0x97ab('0x40')]);var _0x5d6769={'where':_0x58808e[_0x97ab('0x41')]};return db[_0x97ab('0x2f')][_0x97ab('0x22')](_0x5d6769)[_0x97ab('0x28')](function(_0x568161){_0x1ae7eb[_0x97ab('0x22')]=_0x568161;if(_0x31f930[_0x97ab('0x32')]['includeAll']){_0x58808e[_0x97ab('0x42')]=[{'all':!![]}];}return db[_0x97ab('0x2f')]['findAll'](_0x58808e);})[_0x97ab('0x28')](function(_0x187373){_0x1ae7eb[_0x97ab('0x43')]=_0x187373;return _0x1ae7eb;})[_0x97ab('0x28')](respondWithFilteredResult(_0x1dce77,_0x58808e))[_0x97ab('0x44')](handleError(_0x1dce77,null));};exports[_0x97ab('0x45')]=function(_0x3b129e,_0x442ac3){var _0x240ac4={'raw':!![],'where':{'id':_0x3b129e[_0x97ab('0x46')]['id']}},_0x7094ef={};_0x7094ef['model']=_[_0x97ab('0x33')](db[_0x97ab('0x2f')][_0x97ab('0x47')]);_0x7094ef[_0x97ab('0x32')]=_[_0x97ab('0x33')](_0x3b129e[_0x97ab('0x32')]);_0x7094ef[_0x97ab('0x34')]=_[_0x97ab('0x35')](_0x7094ef['model'],_0x7094ef[_0x97ab('0x32')]);_0x240ac4[_0x97ab('0x36')]=_[_0x97ab('0x35')](_0x7094ef[_0x97ab('0x31')],qs[_0x97ab('0x37')](_0x3b129e[_0x97ab('0x32')][_0x97ab('0x37')]));_0x240ac4[_0x97ab('0x36')]=_0x240ac4[_0x97ab('0x36')][_0x97ab('0x38')]?_0x240ac4[_0x97ab('0x36')]:_0x7094ef[_0x97ab('0x31')];if(_0x3b129e['query'][_0x97ab('0x48')]){_0x240ac4[_0x97ab('0x42')]=[{'all':!![]}];}_0x240ac4=_[_0x97ab('0x3d')]({},_0x240ac4,_0x3b129e[_0x97ab('0x40')]);return db[_0x97ab('0x2f')][_0x97ab('0x49')](_0x240ac4)['then'](handleEntityNotFound(_0x442ac3,null))[_0x97ab('0x28')](respondWithResult(_0x442ac3,null))[_0x97ab('0x44')](handleError(_0x442ac3,null));};exports[_0x97ab('0x4a')]=function(_0x2202c6,_0x4faf26){return db[_0x97ab('0x2f')]['create'](_0x2202c6[_0x97ab('0x4b')],{})[_0x97ab('0x28')](respondWithResult(_0x4faf26,0xc9))[_0x97ab('0x44')](handleError(_0x4faf26,null));};exports[_0x97ab('0x27')]=function(_0x38e6d4,_0x34b3e5){if(_0x38e6d4[_0x97ab('0x4b')]['id']){delete _0x38e6d4[_0x97ab('0x4b')]['id'];}return db[_0x97ab('0x2f')]['find']({'where':{'id':_0x38e6d4['params']['id']}})[_0x97ab('0x28')](handleEntityNotFound(_0x34b3e5,null))[_0x97ab('0x28')](saveUpdates(_0x38e6d4[_0x97ab('0x4b')],null))[_0x97ab('0x28')](respondWithResult(_0x34b3e5,null))[_0x97ab('0x44')](handleError(_0x34b3e5,null));};exports[_0x97ab('0x29')]=function(_0x5a2585,_0xe46d7c){return db[_0x97ab('0x2f')][_0x97ab('0x49')]({'where':{'id':_0x5a2585['params']['id']}})[_0x97ab('0x28')](handleEntityNotFound(_0xe46d7c,null))['then'](removeEntity(_0xe46d7c,null))[_0x97ab('0x44')](handleError(_0xe46d7c,null));}; \ No newline at end of file +var _0x2b82=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','findAll','rows','catch','show','params','keys','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x5a19ff,_0x4e3e85){var _0xbca111=function(_0x21650b){while(--_0x21650b){_0x5a19ff['push'](_0x5a19ff['shift']());}};_0xbca111(++_0x4e3e85);}(_0x2b82,0x123));var _0x22b8=function(_0x499185,_0x9342ce){_0x499185=_0x499185-0x0;var _0x232a15=_0x2b82[_0x499185];return _0x232a15;};'use strict';var emlformat=require(_0x22b8('0x0'));var rimraf=require(_0x22b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x22b8('0x2'));var rp=require(_0x22b8('0x3'));var moment=require(_0x22b8('0x4'));var BPromise=require(_0x22b8('0x5'));var Mustache=require(_0x22b8('0x6'));var util=require(_0x22b8('0x7'));var path=require('path');var sox=require(_0x22b8('0x8'));var csv=require(_0x22b8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x22b8('0xa'));var _=require('lodash');var squel=require(_0x22b8('0xb'));var crypto=require(_0x22b8('0xc'));var jsforce=require(_0x22b8('0xd'));var deskjs=require(_0x22b8('0xe'));var toCsv=require(_0x22b8('0x9'));var querystring=require(_0x22b8('0xf'));var Papa=require('papaparse');var Redis=require(_0x22b8('0x10'));var authService=require(_0x22b8('0x11'));var qs=require(_0x22b8('0x12'));var as=require(_0x22b8('0x13'));var hardwareService=require(_0x22b8('0x14'));var logger=require(_0x22b8('0x15'))('api');var utils=require(_0x22b8('0x16'));var config=require(_0x22b8('0x17'));var licenseUtil=require(_0x22b8('0x18'));var db=require(_0x22b8('0x19'))['db'];function respondWithStatusCode(_0x15a005,_0x2b1f26){_0x2b1f26=_0x2b1f26||0xcc;return function(_0x15f7d5){if(_0x15f7d5){return _0x15a005[_0x22b8('0x1a')](_0x2b1f26);}return _0x15a005[_0x22b8('0x1b')](_0x2b1f26)[_0x22b8('0x1c')]();};}function respondWithResult(_0x47e916,_0x42b1a1){_0x42b1a1=_0x42b1a1||0xc8;return function(_0x31084f){if(_0x31084f){return _0x47e916[_0x22b8('0x1b')](_0x42b1a1)[_0x22b8('0x1d')](_0x31084f);}};}function respondWithFilteredResult(_0x12c19b,_0x4c7624){return function(_0x155f58){if(_0x155f58){var _0x27c031=typeof _0x4c7624[_0x22b8('0x1e')]===_0x22b8('0x1f')&&typeof _0x4c7624[_0x22b8('0x20')]==='undefined';var _0x376ac7=_0x155f58[_0x22b8('0x21')];var _0x26ec16=_0x27c031?0x0:_0x4c7624['offset'];var _0x43ab2b=_0x27c031?_0x155f58[_0x22b8('0x21')]:_0x4c7624[_0x22b8('0x1e')]+_0x4c7624[_0x22b8('0x20')];var _0x1eaf3a;if(_0x43ab2b>=_0x376ac7){_0x43ab2b=_0x376ac7;_0x1eaf3a=0xc8;}else{_0x1eaf3a=0xce;}_0x12c19b[_0x22b8('0x1b')](_0x1eaf3a);return _0x12c19b['set'](_0x22b8('0x22'),_0x26ec16+'-'+_0x43ab2b+'/'+_0x376ac7)[_0x22b8('0x1d')](_0x155f58);}return null;};}function patchUpdates(_0x384917){return function(_0x1282dd){try{jsonpatch['apply'](_0x1282dd,_0x384917,!![]);}catch(_0x22b41d){return BPromise[_0x22b8('0x23')](_0x22b41d);}return _0x1282dd[_0x22b8('0x24')]();};}function saveUpdates(_0x208f62,_0x46b85d){return function(_0x405e70){if(_0x405e70){return _0x405e70[_0x22b8('0x25')](_0x208f62)[_0x22b8('0x26')](function(_0x2b0646){return _0x2b0646;});}return null;};}function removeEntity(_0x327e4b,_0x493e43){return function(_0x4292df){if(_0x4292df){return _0x4292df[_0x22b8('0x27')]()['then'](function(){_0x327e4b[_0x22b8('0x1b')](0xcc)[_0x22b8('0x1c')]();});}};}function handleEntityNotFound(_0x971328,_0x8caf4){return function(_0x66a515){if(!_0x66a515){_0x971328[_0x22b8('0x1a')](0x194);}return _0x66a515;};}function handleError(_0x1f291d,_0x9dd393){_0x9dd393=_0x9dd393||0x1f4;return function(_0x4eb732){logger[_0x22b8('0x28')](_0x4eb732[_0x22b8('0x29')]);if(_0x4eb732[_0x22b8('0x2a')]){delete _0x4eb732['name'];}_0x1f291d[_0x22b8('0x1b')](_0x9dd393)[_0x22b8('0x2b')](_0x4eb732);};}exports[_0x22b8('0x2c')]=function(_0x19ea6e,_0x1b6b81){var _0x5dcec8={},_0x1fa36f={},_0x361c47={'count':0x0,'rows':[]};var _0x1d09a4=_[_0x22b8('0x2d')](db[_0x22b8('0x2e')][_0x22b8('0x2f')],function(_0x4300da){return{'name':_0x4300da[_0x22b8('0x30')],'type':_0x4300da['type'][_0x22b8('0x31')]};});_0x1fa36f[_0x22b8('0x32')]=_[_0x22b8('0x2d')](_0x1d09a4,_0x22b8('0x2a'));_0x1fa36f[_0x22b8('0x33')]=_['keys'](_0x19ea6e['query']);_0x1fa36f[_0x22b8('0x34')]=_[_0x22b8('0x35')](_0x1fa36f[_0x22b8('0x32')],_0x1fa36f[_0x22b8('0x33')]);_0x5dcec8[_0x22b8('0x36')]=_[_0x22b8('0x35')](_0x1fa36f['model'],qs[_0x22b8('0x37')](_0x19ea6e[_0x22b8('0x33')][_0x22b8('0x37')]));_0x5dcec8['attributes']=_0x5dcec8[_0x22b8('0x36')][_0x22b8('0x38')]?_0x5dcec8[_0x22b8('0x36')]:_0x1fa36f['model'];if(!_0x19ea6e[_0x22b8('0x33')][_0x22b8('0x39')](_0x22b8('0x3a'))){_0x5dcec8[_0x22b8('0x20')]=qs['limit'](_0x19ea6e[_0x22b8('0x33')][_0x22b8('0x20')]);_0x5dcec8[_0x22b8('0x1e')]=qs[_0x22b8('0x1e')](_0x19ea6e[_0x22b8('0x33')]['offset']);}_0x5dcec8[_0x22b8('0x3b')]=qs['sort'](_0x19ea6e['query'][_0x22b8('0x3c')]);_0x5dcec8[_0x22b8('0x3d')]=qs['filters'](_[_0x22b8('0x3e')](_0x19ea6e[_0x22b8('0x33')],_0x1fa36f[_0x22b8('0x34')]),_0x1d09a4);if(_0x19ea6e[_0x22b8('0x33')][_0x22b8('0x3f')]){_0x5dcec8[_0x22b8('0x3d')]=_['merge'](_0x5dcec8[_0x22b8('0x3d')],{'$or':_[_0x22b8('0x2d')](_0x1d09a4,function(_0x269d01){if(_0x269d01[_0x22b8('0x40')]!==_0x22b8('0x41')){var _0x3c63ff={};_0x3c63ff[_0x269d01[_0x22b8('0x2a')]]={'$like':'%'+_0x19ea6e[_0x22b8('0x33')]['filter']+'%'};return _0x3c63ff;}})});}_0x5dcec8=_[_0x22b8('0x42')]({},_0x5dcec8,_0x19ea6e[_0x22b8('0x43')]);var _0x344d0b={'where':_0x5dcec8[_0x22b8('0x3d')]};return db[_0x22b8('0x2e')]['count'](_0x344d0b)[_0x22b8('0x26')](function(_0x334f3d){_0x361c47[_0x22b8('0x21')]=_0x334f3d;if(_0x19ea6e[_0x22b8('0x33')]['includeAll']){_0x5dcec8['include']=[{'all':!![]}];}return db[_0x22b8('0x2e')][_0x22b8('0x44')](_0x5dcec8);})[_0x22b8('0x26')](function(_0x3d1d32){_0x361c47[_0x22b8('0x45')]=_0x3d1d32;return _0x361c47;})[_0x22b8('0x26')](respondWithFilteredResult(_0x1b6b81,_0x5dcec8))[_0x22b8('0x46')](handleError(_0x1b6b81,null));};exports[_0x22b8('0x47')]=function(_0x29b7c9,_0x5823c8){var _0x31256b={'raw':!![],'where':{'id':_0x29b7c9[_0x22b8('0x48')]['id']}},_0x12c410={};_0x12c410[_0x22b8('0x32')]=_[_0x22b8('0x49')](db['VtigerField'][_0x22b8('0x2f')]);_0x12c410[_0x22b8('0x33')]=_[_0x22b8('0x49')](_0x29b7c9[_0x22b8('0x33')]);_0x12c410[_0x22b8('0x34')]=_[_0x22b8('0x35')](_0x12c410[_0x22b8('0x32')],_0x12c410[_0x22b8('0x33')]);_0x31256b[_0x22b8('0x36')]=_[_0x22b8('0x35')](_0x12c410[_0x22b8('0x32')],qs[_0x22b8('0x37')](_0x29b7c9[_0x22b8('0x33')][_0x22b8('0x37')]));_0x31256b[_0x22b8('0x36')]=_0x31256b['attributes']['length']?_0x31256b[_0x22b8('0x36')]:_0x12c410[_0x22b8('0x32')];if(_0x29b7c9[_0x22b8('0x33')]['includeAll']){_0x31256b['include']=[{'all':!![]}];}_0x31256b=_[_0x22b8('0x42')]({},_0x31256b,_0x29b7c9[_0x22b8('0x43')]);return db[_0x22b8('0x2e')]['find'](_0x31256b)['then'](handleEntityNotFound(_0x5823c8,null))[_0x22b8('0x26')](respondWithResult(_0x5823c8,null))[_0x22b8('0x46')](handleError(_0x5823c8,null));};exports[_0x22b8('0x4a')]=function(_0x4ecf12,_0x2fba68){return db[_0x22b8('0x2e')][_0x22b8('0x4a')](_0x4ecf12[_0x22b8('0x4b')],{})['then'](respondWithResult(_0x2fba68,0xc9))[_0x22b8('0x46')](handleError(_0x2fba68,null));};exports[_0x22b8('0x25')]=function(_0xf66260,_0xb9229a){if(_0xf66260['body']['id']){delete _0xf66260[_0x22b8('0x4b')]['id'];}return db[_0x22b8('0x2e')]['find']({'where':{'id':_0xf66260[_0x22b8('0x48')]['id']}})[_0x22b8('0x26')](handleEntityNotFound(_0xb9229a,null))[_0x22b8('0x26')](saveUpdates(_0xf66260['body'],null))['then'](respondWithResult(_0xb9229a,null))[_0x22b8('0x46')](handleError(_0xb9229a,null));};exports['destroy']=function(_0xd3e727,_0x4ee4e6){return db[_0x22b8('0x2e')][_0x22b8('0x4c')]({'where':{'id':_0xd3e727[_0x22b8('0x48')]['id']}})[_0x22b8('0x26')](handleEntityNotFound(_0x4ee4e6,null))['then'](removeEntity(_0x4ee4e6,null))[_0x22b8('0x46')](handleError(_0x4ee4e6,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 0eb2eef..57d3d2e 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 _0x8b84=['vtiger_unique_index','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields'];(function(_0x4b0be5,_0x1ed1aa){var _0x4b2c39=function(_0x27bb94){while(--_0x27bb94){_0x4b0be5['push'](_0x4b0be5['shift']());}};_0x4b2c39(++_0x1ed1aa);}(_0x8b84,0x179));var _0x48b8=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x8b84[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x48b8('0x0'));var util=require(_0x48b8('0x1'));var logger=require(_0x48b8('0x2'))(_0x48b8('0x3'));var moment=require(_0x48b8('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x48b8('0x5'));var rimraf=require(_0x48b8('0x6'));var config=require(_0x48b8('0x7'));var attributes=require(_0x48b8('0x8'));module[_0x48b8('0x9')]=function(_0x3f6889,_0x572901){return _0x3f6889[_0x48b8('0xa')](_0x48b8('0xb'),attributes,{'tableName':_0x48b8('0xc'),'paranoid':![],'indexes':[{'name':_0x48b8('0xd'),'fields':['idField',_0x48b8('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9391=['path','rimraf','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x27f146,_0x5515bf){var _0xd45e2a=function(_0x51dce2){while(--_0x51dce2){_0x27f146['push'](_0x27f146['shift']());}};_0xd45e2a(++_0x5515bf);}(_0x9391,0x126));var _0x1939=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9391[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1939('0x0'));var util=require(_0x1939('0x1'));var logger=require(_0x1939('0x2'))(_0x1939('0x3'));var moment=require(_0x1939('0x4'));var BPromise=require(_0x1939('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1939('0x6'));var rimraf=require(_0x1939('0x7'));var config=require('../../config/environment');var attributes=require(_0x1939('0x8'));module[_0x1939('0x9')]=function(_0x24864e,_0x3449a8){return _0x24864e['define'](_0x1939('0xa'),attributes,{'tableName':_0x1939('0xb'),'paranoid':![],'indexes':[{'name':_0x1939('0xc'),'fields':[_0x1939('0xd'),_0x1939('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 972149b..9b09aa0 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 _0xfa15=['request','then','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x447307,_0x17f67e){var _0x503f4e=function(_0x6061cb){while(--_0x6061cb){_0x447307['push'](_0x447307['shift']());}};_0x503f4e(++_0x17f67e);}(_0xfa15,0x151));var _0x5fa1=function(_0x56fea2,_0x5501bd){_0x56fea2=_0x56fea2-0x0;var _0x362102=_0xfa15[_0x56fea2];return _0x362102;};'use strict';var _=require(_0x5fa1('0x0'));var util=require('util');var moment=require(_0x5fa1('0x1'));var BPromise=require(_0x5fa1('0x2'));var rs=require(_0x5fa1('0x3'));var fs=require('fs');var Redis=require(_0x5fa1('0x4'));var db=require(_0x5fa1('0x5'))['db'];var utils=require(_0x5fa1('0x6'));var logger=require(_0x5fa1('0x7'))(_0x5fa1('0x8'));var config=require(_0x5fa1('0x9'));var jayson=require(_0x5fa1('0xa'));var client=jayson[_0x5fa1('0xb')][_0x5fa1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5caa5e,_0x13f7cf,_0x31748f){return new BPromise(function(_0x21d2f0,_0xdb8470){return client[_0x5fa1('0xd')](_0x5caa5e,_0x31748f)[_0x5fa1('0xe')](function(_0x4dd8f1){logger['info']('VtigerField,\x20%s,\x20%s',_0x13f7cf,_0x5fa1('0xf'));logger['debug'](_0x5fa1('0x10'),_0x13f7cf,_0x5fa1('0xf'),JSON[_0x5fa1('0x11')](_0x4dd8f1));if(_0x4dd8f1[_0x5fa1('0x12')]){if(_0x4dd8f1[_0x5fa1('0x12')][_0x5fa1('0x13')]===0x1f4){logger[_0x5fa1('0x12')](_0x5fa1('0x14'),_0x13f7cf,_0x4dd8f1[_0x5fa1('0x12')][_0x5fa1('0x15')]);return _0xdb8470(_0x4dd8f1[_0x5fa1('0x12')][_0x5fa1('0x15')]);}logger[_0x5fa1('0x12')](_0x5fa1('0x14'),_0x13f7cf,_0x4dd8f1[_0x5fa1('0x12')][_0x5fa1('0x15')]);return _0x21d2f0(_0x4dd8f1[_0x5fa1('0x12')][_0x5fa1('0x15')]);}else{logger[_0x5fa1('0x16')](_0x5fa1('0x14'),_0x13f7cf,_0x5fa1('0xf'));_0x21d2f0(_0x4dd8f1[_0x5fa1('0x17')]['message']);}})[_0x5fa1('0x18')](function(_0x2cd78d){logger[_0x5fa1('0x12')](_0x5fa1('0x14'),_0x13f7cf,_0x2cd78d);_0xdb8470(_0x2cd78d);});});} \ No newline at end of file +var _0x3945=['http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3945,0x6f));var _0x5394=function(_0x338a96,_0x451ead){_0x338a96=_0x338a96-0x0;var _0x4a3c65=_0x3945[_0x338a96];return _0x4a3c65;};'use strict';var _=require(_0x5394('0x0'));var util=require(_0x5394('0x1'));var moment=require(_0x5394('0x2'));var BPromise=require('bluebird');var rs=require(_0x5394('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5394('0x4'))(_0x5394('0x5'));var config=require(_0x5394('0x6'));var jayson=require(_0x5394('0x7'));var client=jayson[_0x5394('0x8')][_0x5394('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbbafef,_0x142485,_0x570844){return new BPromise(function(_0x14bee0,_0x2c1273){return client[_0x5394('0xa')](_0xbbafef,_0x570844)['then'](function(_0x18806e){logger[_0x5394('0xb')](_0x5394('0xc'),_0x142485,_0x5394('0xd'));logger[_0x5394('0xe')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x142485,'request\x20sent',JSON['stringify'](_0x18806e));if(_0x18806e[_0x5394('0xf')]){if(_0x18806e['error'][_0x5394('0x10')]===0x1f4){logger[_0x5394('0xf')](_0x5394('0xc'),_0x142485,_0x18806e[_0x5394('0xf')]['message']);return _0x2c1273(_0x18806e['error'][_0x5394('0x11')]);}logger['error'](_0x5394('0xc'),_0x142485,_0x18806e['error'][_0x5394('0x11')]);return _0x14bee0(_0x18806e['error'][_0x5394('0x11')]);}else{logger[_0x5394('0xb')](_0x5394('0xc'),_0x142485,_0x5394('0xd'));_0x14bee0(_0x18806e[_0x5394('0x12')][_0x5394('0x11')]);}})[_0x5394('0x13')](function(_0x45f254){logger[_0x5394('0xf')](_0x5394('0xc'),_0x142485,_0x45f254);_0x2c1273(_0x45f254);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index a00e6bf..5fc8712 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 _0x0309=['destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intZendeskAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','delete','/:id'];(function(_0x106d8e,_0x5b3888){var _0x4b8576=function(_0x43b6f7){while(--_0x43b6f7){_0x106d8e['push'](_0x106d8e['shift']());}};_0x4b8576(++_0x5b3888);}(_0x0309,0x8d));var _0x9030=function(_0x1b3302,_0x925acf){_0x1b3302=_0x1b3302-0x0;var _0x2ef449=_0x0309[_0x1b3302];return _0x2ef449;};'use strict';var multer=require(_0x9030('0x0'));var util=require(_0x9030('0x1'));var path=require(_0x9030('0x2'));var timeout=require(_0x9030('0x3'));var express=require(_0x9030('0x4'));var router=express['Router']();var fs_extra=require(_0x9030('0x5'));var auth=require(_0x9030('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9030('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9030('0x8')]('/:id',auth[_0x9030('0x9')](),controller[_0x9030('0xa')]);router[_0x9030('0x8')](_0x9030('0xb'),auth[_0x9030('0x9')](),controller[_0x9030('0xc')]);router[_0x9030('0x8')](_0x9030('0xd'),auth[_0x9030('0x9')](),controller['getFields']);router[_0x9030('0xe')]('/',auth['isAuthenticated'](),controller[_0x9030('0xf')]);router[_0x9030('0xe')]('/:id/configurations',auth[_0x9030('0x9')](),controller['addConfiguration']);router[_0x9030('0x10')]('/:id',auth[_0x9030('0x9')](),controller['update']);router[_0x9030('0x11')](_0x9030('0x12'),auth[_0x9030('0x9')](),controller[_0x9030('0x13')]);module['exports']=router; \ No newline at end of file +var _0x65aa=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put','/:id','destroy','exports','multer','path'];(function(_0x5bb4a7,_0x4941b9){var _0x13cb3f=function(_0x2c59e9){while(--_0x2c59e9){_0x5bb4a7['push'](_0x5bb4a7['shift']());}};_0x13cb3f(++_0x4941b9);}(_0x65aa,0x185));var _0xa65a=function(_0xae77cc,_0x4f8083){_0xae77cc=_0xae77cc-0x0;var _0x476ae1=_0x65aa[_0xae77cc];return _0x476ae1;};'use strict';var multer=require(_0xa65a('0x0'));var util=require('util');var path=require(_0xa65a('0x1'));var timeout=require(_0xa65a('0x2'));var express=require(_0xa65a('0x3'));var router=express[_0xa65a('0x4')]();var fs_extra=require(_0xa65a('0x5'));var auth=require(_0xa65a('0x6'));var interaction=require(_0xa65a('0x7'));var config=require(_0xa65a('0x8'));var controller=require(_0xa65a('0x9'));router[_0xa65a('0xa')]('/',auth[_0xa65a('0xb')](),controller[_0xa65a('0xc')]);router[_0xa65a('0xa')]('/:id',auth[_0xa65a('0xb')](),controller['show']);router[_0xa65a('0xa')](_0xa65a('0xd'),auth['isAuthenticated'](),controller[_0xa65a('0xe')]);router[_0xa65a('0xa')](_0xa65a('0xf'),auth[_0xa65a('0xb')](),controller[_0xa65a('0x10')]);router['post']('/',auth[_0xa65a('0xb')](),controller[_0xa65a('0x11')]);router[_0xa65a('0x12')](_0xa65a('0xd'),auth[_0xa65a('0xb')](),controller['addConfiguration']);router[_0xa65a('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xa65a('0x14'),auth[_0xa65a('0xb')](),controller[_0xa65a('0x15')]);module[_0xa65a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index e331a7a..9b849f3 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 _0x1122=['newTab','sequelize','STRING','username','remoteUri','password','token','ENUM','integrationTab'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1122,0xac));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2112('0x0'));module['exports']={'name':{'type':Sequelize[_0x2112('0x1')]},'description':{'type':Sequelize[_0x2112('0x1')]},'username':{'type':Sequelize[_0x2112('0x1')],'unique':_0x2112('0x2')},'password':{'type':Sequelize[_0x2112('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2112('0x3')},'authType':{'type':Sequelize['ENUM'](_0x2112('0x4'),_0x2112('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x2112('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2112('0x6')](_0x2112('0x7'),_0x2112('0x8')),'defaultValue':_0x2112('0x7')}}; \ No newline at end of file +var _0xc0d7=['integrationTab','STRING','username','remoteUri','ENUM','password'];(function(_0x365c07,_0x3ef179){var _0x348481=function(_0x2323ec){while(--_0x2323ec){_0x365c07['push'](_0x365c07['shift']());}};_0x348481(++_0x3ef179);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x50e516,_0x2bb60a){_0x50e516=_0x50e516-0x0;var _0x4f3548=_0xc0d7[_0x50e516];return _0x4f3548;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7c0d('0x0')]},'username':{'type':Sequelize[_0x7c0d('0x0')],'unique':_0x7c0d('0x1')},'password':{'type':Sequelize[_0x7c0d('0x0')]},'token':{'type':Sequelize[_0x7c0d('0x0')]},'remoteUri':{'type':Sequelize[_0x7c0d('0x0')],'unique':_0x7c0d('0x2')},'authType':{'type':Sequelize[_0x7c0d('0x3')](_0x7c0d('0x4'),'token'),'defaultValue':_0x7c0d('0x4')},'serverUrl':{'type':Sequelize[_0x7c0d('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x7c0d('0x3')](_0x7c0d('0x5'),'newTab'),'defaultValue':_0x7c0d('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index f774c18..c338b5e 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 _0xae60=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','getConfigurations','findOne','ZendeskConfiguration','order','sort','nolimit','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','assignee','remove','position','title','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','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','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x14fab1,_0x19245f){var _0x475547=function(_0x1d4958){while(--_0x1d4958){_0x14fab1['push'](_0x14fab1['shift']());}};_0x475547(++_0x19245f);}(_0xae60,0x1c7));var _0x0ae6=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xae60[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x0ae6('0x0'));var rimraf=require(_0x0ae6('0x1'));var zipdir=require(_0x0ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ae6('0x3'));var moment=require(_0x0ae6('0x4'));var BPromise=require(_0x0ae6('0x5'));var Mustache=require('mustache');var util=require(_0x0ae6('0x6'));var path=require(_0x0ae6('0x7'));var sox=require('sox');var csv=require(_0x0ae6('0x8'));var ejs=require(_0x0ae6('0x9'));var fs=require('fs');var fs_extra=require(_0x0ae6('0xa'));var _=require(_0x0ae6('0xb'));var squel=require(_0x0ae6('0xc'));var crypto=require(_0x0ae6('0xd'));var jsforce=require(_0x0ae6('0xe'));var deskjs=require(_0x0ae6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ae6('0x10'));var Papa=require(_0x0ae6('0x11'));var Redis=require(_0x0ae6('0x12'));var authService=require(_0x0ae6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ae6('0x14'));var hardwareService=require(_0x0ae6('0x15'));var logger=require(_0x0ae6('0x16'))(_0x0ae6('0x17'));var utils=require(_0x0ae6('0x18'));var config=require(_0x0ae6('0x19'));var licenseUtil=require(_0x0ae6('0x1a'));var db=require(_0x0ae6('0x1b'))['db'];var integrations=require(_0x0ae6('0x1c'));function respondWithStatusCode(_0x30f8f9,_0x1aefd5){_0x1aefd5=_0x1aefd5||0xcc;return function(_0xf86cad){if(_0xf86cad){return _0x30f8f9[_0x0ae6('0x1d')](_0x1aefd5);}return _0x30f8f9[_0x0ae6('0x1e')](_0x1aefd5)['end']();};}function respondWithResult(_0x3809c6,_0x10c3bc){_0x10c3bc=_0x10c3bc||0xc8;return function(_0x1c997a){if(_0x1c997a){return _0x3809c6[_0x0ae6('0x1e')](_0x10c3bc)[_0x0ae6('0x1f')](_0x1c997a);}};}function respondWithFilteredResult(_0x3a1e26,_0x151144){return function(_0x3b64ac){if(_0x3b64ac){var _0xa797bb=typeof _0x151144[_0x0ae6('0x20')]===_0x0ae6('0x21')&&typeof _0x151144[_0x0ae6('0x22')]===_0x0ae6('0x21');var _0xd0362c=_0x3b64ac[_0x0ae6('0x23')];var _0x3f5c41=_0xa797bb?0x0:_0x151144[_0x0ae6('0x20')];var _0x1735ba=_0xa797bb?_0x3b64ac[_0x0ae6('0x23')]:_0x151144[_0x0ae6('0x20')]+_0x151144[_0x0ae6('0x22')];var _0x191eaf;if(_0x1735ba>=_0xd0362c){_0x1735ba=_0xd0362c;_0x191eaf=0xc8;}else{_0x191eaf=0xce;}_0x3a1e26['status'](_0x191eaf);return _0x3a1e26[_0x0ae6('0x24')](_0x0ae6('0x25'),_0x3f5c41+'-'+_0x1735ba+'/'+_0xd0362c)[_0x0ae6('0x1f')](_0x3b64ac);}return null;};}function patchUpdates(_0x1027c2){return function(_0x9c4075){try{jsonpatch[_0x0ae6('0x26')](_0x9c4075,_0x1027c2,!![]);}catch(_0x210ca4){return BPromise[_0x0ae6('0x27')](_0x210ca4);}return _0x9c4075['save']();};}function saveUpdates(_0x39b22e,_0x2a6484){return function(_0x2e86e8){if(_0x2e86e8){return _0x2e86e8[_0x0ae6('0x28')](_0x39b22e)[_0x0ae6('0x29')](function(_0x4eba72){return _0x4eba72;});}return null;};}function removeEntity(_0x296a9d,_0x4e1242){return function(_0xccd1c5){if(_0xccd1c5){return _0xccd1c5[_0x0ae6('0x2a')]()[_0x0ae6('0x29')](function(){_0x296a9d[_0x0ae6('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3630e6,_0x2dcdb7){return function(_0x519f17){if(!_0x519f17){_0x3630e6['sendStatus'](0x194);}return _0x519f17;};}function handleError(_0x44eb95,_0x3255a7){_0x3255a7=_0x3255a7||0x1f4;return function(_0x17360e){logger['error'](_0x17360e[_0x0ae6('0x2b')]);if(_0x17360e[_0x0ae6('0x2c')]){delete _0x17360e[_0x0ae6('0x2c')];}_0x44eb95['status'](_0x3255a7)[_0x0ae6('0x2d')](_0x17360e);};}exports[_0x0ae6('0x2e')]=function(_0x449c33,_0x232fbd){var _0x14eed5={},_0x257af5={},_0x4fc7bd={'count':0x0,'rows':[]};var _0x5b2ad6=_[_0x0ae6('0x2f')](db[_0x0ae6('0x30')]['rawAttributes'],function(_0x4a06f1){return{'name':_0x4a06f1[_0x0ae6('0x31')],'type':_0x4a06f1[_0x0ae6('0x32')][_0x0ae6('0x33')]};});_0x257af5[_0x0ae6('0x34')]=_['map'](_0x5b2ad6,_0x0ae6('0x2c'));_0x257af5[_0x0ae6('0x35')]=_[_0x0ae6('0x36')](_0x449c33['query']);_0x257af5[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x257af5[_0x0ae6('0x34')],_0x257af5[_0x0ae6('0x35')]);_0x14eed5[_0x0ae6('0x39')]=_[_0x0ae6('0x38')](_0x257af5[_0x0ae6('0x34')],qs[_0x0ae6('0x3a')](_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3a')]));_0x14eed5['attributes']=_0x14eed5[_0x0ae6('0x39')][_0x0ae6('0x3b')]?_0x14eed5['attributes']:_0x257af5[_0x0ae6('0x34')];if(!_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3c')]('nolimit')){_0x14eed5[_0x0ae6('0x22')]=qs['limit'](_0x449c33['query'][_0x0ae6('0x22')]);_0x14eed5[_0x0ae6('0x20')]=qs[_0x0ae6('0x20')](_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x20')]);}_0x14eed5['order']=qs['sort'](_0x449c33[_0x0ae6('0x35')]['sort']);_0x14eed5[_0x0ae6('0x3d')]=qs['filters'](_[_0x0ae6('0x3e')](_0x449c33['query'],_0x257af5[_0x0ae6('0x37')]),_0x5b2ad6);if(_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3f')]){_0x14eed5[_0x0ae6('0x3d')]=_['merge'](_0x14eed5['where'],{'$or':_[_0x0ae6('0x2f')](_0x5b2ad6,function(_0x34b547){if(_0x34b547[_0x0ae6('0x32')]!=='VIRTUAL'){var _0xaeb354={};_0xaeb354[_0x34b547['name']]={'$like':'%'+_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3f')]+'%'};return _0xaeb354;}})});}_0x14eed5=_[_0x0ae6('0x40')]({},_0x14eed5,_0x449c33[_0x0ae6('0x41')]);var _0x450f00={'where':_0x14eed5[_0x0ae6('0x3d')]};return db['ZendeskAccount'][_0x0ae6('0x23')](_0x450f00)[_0x0ae6('0x29')](function(_0x24d9ec){_0x4fc7bd[_0x0ae6('0x23')]=_0x24d9ec;if(_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x42')]){_0x14eed5[_0x0ae6('0x43')]=[{'all':!![]}];}return db[_0x0ae6('0x30')]['findAll'](_0x14eed5);})[_0x0ae6('0x29')](function(_0xba3183){_0x4fc7bd[_0x0ae6('0x44')]=_0xba3183;return _0x4fc7bd;})[_0x0ae6('0x29')](respondWithFilteredResult(_0x232fbd,_0x14eed5))[_0x0ae6('0x45')](handleError(_0x232fbd,null));};exports[_0x0ae6('0x46')]=function(_0x24c021,_0x21431e){var _0xb38cbb={'raw':![],'where':{'id':_0x24c021[_0x0ae6('0x47')]['id']}},_0x156841={};_0x156841[_0x0ae6('0x34')]=_[_0x0ae6('0x36')](db[_0x0ae6('0x30')][_0x0ae6('0x48')]);_0x156841[_0x0ae6('0x35')]=_[_0x0ae6('0x36')](_0x24c021[_0x0ae6('0x35')]);_0x156841['filters']=_[_0x0ae6('0x38')](_0x156841[_0x0ae6('0x34')],_0x156841[_0x0ae6('0x35')]);_0xb38cbb[_0x0ae6('0x39')]=_[_0x0ae6('0x38')](_0x156841[_0x0ae6('0x34')],qs['fields'](_0x24c021[_0x0ae6('0x35')][_0x0ae6('0x3a')]));_0xb38cbb[_0x0ae6('0x39')]=_0xb38cbb[_0x0ae6('0x39')]['length']?_0xb38cbb['attributes']:_0x156841['model'];if(_0x24c021[_0x0ae6('0x35')][_0x0ae6('0x42')]){_0xb38cbb[_0x0ae6('0x43')]=[{'all':!![]}];}_0xb38cbb=_['merge']({},_0xb38cbb,_0x24c021[_0x0ae6('0x41')]);return db[_0x0ae6('0x30')]['find'](_0xb38cbb)[_0x0ae6('0x29')](handleEntityNotFound(_0x21431e,null))[_0x0ae6('0x29')](respondWithResult(_0x21431e,null))['catch'](handleError(_0x21431e,null));};exports[_0x0ae6('0x49')]=function(_0x3d1e75,_0x587ab4){return db[_0x0ae6('0x30')][_0x0ae6('0x49')](_0x3d1e75[_0x0ae6('0x4a')],{})['then'](respondWithResult(_0x587ab4,0xc9))[_0x0ae6('0x45')](handleError(_0x587ab4,null));};exports[_0x0ae6('0x28')]=function(_0x46075a,_0x3b1af0){if(_0x46075a[_0x0ae6('0x4a')]['id']){delete _0x46075a[_0x0ae6('0x4a')]['id'];}return db[_0x0ae6('0x30')]['find']({'where':{'id':_0x46075a['params']['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x3b1af0,null))[_0x0ae6('0x29')](saveUpdates(_0x46075a[_0x0ae6('0x4a')],null))['then'](respondWithResult(_0x3b1af0,null))[_0x0ae6('0x45')](handleError(_0x3b1af0,null));};exports['destroy']=function(_0x582a5e,_0x23454a){return db[_0x0ae6('0x30')][_0x0ae6('0x4b')]({'where':{'id':_0x582a5e['params']['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x23454a,null))[_0x0ae6('0x29')](removeEntity(_0x23454a,null))[_0x0ae6('0x45')](handleError(_0x23454a,null));};exports[_0x0ae6('0x4c')]=function(_0x173acd,_0x2e5ea6,_0x9a64b8){var _0x36be39={};var _0x102573={};var _0x117d24;var _0x1cc515;return db[_0x0ae6('0x30')][_0x0ae6('0x4d')]({'where':{'id':_0x173acd[_0x0ae6('0x47')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x2e5ea6,null))['then'](function(_0x4cbe19){if(_0x4cbe19){_0x117d24=_0x4cbe19;_0x102573[_0x0ae6('0x34')]=_[_0x0ae6('0x36')](db[_0x0ae6('0x4e')][_0x0ae6('0x48')]);_0x102573[_0x0ae6('0x35')]=_[_0x0ae6('0x36')](_0x173acd[_0x0ae6('0x35')]);_0x102573[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x102573[_0x0ae6('0x34')],_0x102573[_0x0ae6('0x35')]);_0x36be39[_0x0ae6('0x39')]=_[_0x0ae6('0x38')](_0x102573[_0x0ae6('0x34')],qs[_0x0ae6('0x3a')](_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x3a')]));_0x36be39[_0x0ae6('0x39')]=_0x36be39['attributes'][_0x0ae6('0x3b')]?_0x36be39[_0x0ae6('0x39')]:_0x102573[_0x0ae6('0x34')];_0x36be39[_0x0ae6('0x4f')]=qs[_0x0ae6('0x50')](_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x50')]);_0x36be39[_0x0ae6('0x3d')]=qs[_0x0ae6('0x37')](_[_0x0ae6('0x3e')](_0x173acd['query'],_0x102573[_0x0ae6('0x37')]));if(_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x3f')]){_0x36be39[_0x0ae6('0x3d')]=_[_0x0ae6('0x40')](_0x36be39[_0x0ae6('0x3d')],{'$or':_[_0x0ae6('0x2f')](_0x36be39[_0x0ae6('0x39')],function(_0x1cbada){var _0x59acf0={};_0x59acf0[_0x1cbada]={'$like':'%'+_0x173acd['query'][_0x0ae6('0x3f')]+'%'};return _0x59acf0;})});}_0x36be39=_[_0x0ae6('0x40')]({},_0x36be39,_0x173acd['options']);return _0x117d24['getConfigurations'](_0x36be39);}})[_0x0ae6('0x29')](function(_0x160dcf){if(_0x160dcf){_0x1cc515=_0x160dcf[_0x0ae6('0x3b')];if(!_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x3c')](_0x0ae6('0x51'))){_0x36be39[_0x0ae6('0x22')]=qs['limit'](_0x173acd[_0x0ae6('0x35')]['limit']);_0x36be39[_0x0ae6('0x20')]=qs[_0x0ae6('0x20')](_0x173acd['query'][_0x0ae6('0x20')]);}return _0x117d24[_0x0ae6('0x4c')](_0x36be39);}})[_0x0ae6('0x29')](function(_0x593667){if(_0x593667){return _0x593667?{'count':_0x1cc515,'rows':_0x593667}:null;}})[_0x0ae6('0x29')](respondWithResult(_0x2e5ea6,null))['catch'](handleError(_0x2e5ea6,null));};exports[_0x0ae6('0x52')]=function(_0x2e0a75,_0x19f63f,_0x12c43d){if(_0x2e0a75['body']['id']){delete _0x2e0a75['body']['id'];}return db[_0x0ae6('0x30')][_0x0ae6('0x4d')]({'where':{'id':_0x2e0a75[_0x0ae6('0x47')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x19f63f,null))[_0x0ae6('0x29')](function(_0x2d9f33){if(_0x2d9f33){_0x2e0a75['body']['AccountId']=_0x2d9f33['id'];_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x53')]=integrations[_0x0ae6('0x54')](_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x55')],_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x32')]);_0x2e0a75[_0x0ae6('0x4a')]['Descriptions']=integrations[_0x0ae6('0x56')](_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x55')],_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x32')]);return db[_0x0ae6('0x4e')]['create'](_0x2e0a75['body'],{'include':[{'model':db[_0x0ae6('0x57')],'as':_0x0ae6('0x53')},{'model':db['ZendeskField'],'as':_0x0ae6('0x58')}]});}return null;})[_0x0ae6('0x29')](respondWithResult(_0x19f63f,null))[_0x0ae6('0x45')](handleError(_0x19f63f,null));};exports[_0x0ae6('0x59')]=function(_0x5cd03b,_0x2d9ec4,_0x243e86){var _0x42470='';return db[_0x0ae6('0x30')][_0x0ae6('0x4d')]({'where':{'id':_0x5cd03b[_0x0ae6('0x47')]['id']},'attributes':['id',_0x0ae6('0x5a'),_0x0ae6('0x5b'),'token',_0x0ae6('0x5c'),_0x0ae6('0x5d')]})[_0x0ae6('0x29')](handleEntityNotFound(_0x2d9ec4,null))[_0x0ae6('0x29')](function(_0x206021){if(_0x206021){_0x42470=_0x206021[_0x0ae6('0x5d')];var _0x20032f=_0x42470[_0x0ae6('0x5e')](-0x1);if(_0x20032f==='/'){_0x42470=_0x42470[_0x0ae6('0x5f')](0x0,_0x42470[_0x0ae6('0x60')](_0x20032f));}var _0x3db11f={'method':_0x0ae6('0x61'),'uri':util[_0x0ae6('0x62')](_0x0ae6('0x63'),_0x42470,_0x0ae6('0x64')),'json':!![]};switch(_0x206021[_0x0ae6('0x5c')]){case _0x0ae6('0x5b'):_0x3db11f[_0x0ae6('0x65')]={'Authorization':util[_0x0ae6('0x62')](_0x0ae6('0x66'),new Buffer(util[_0x0ae6('0x62')]('%s:%s',_0x206021[_0x0ae6('0x5a')],_0x206021[_0x0ae6('0x5b')]))[_0x0ae6('0x67')](_0x0ae6('0x68')))};break;case'token':_0x3db11f[_0x0ae6('0x65')]={'Authorization':util[_0x0ae6('0x62')](_0x0ae6('0x66'),new Buffer(util[_0x0ae6('0x62')](_0x0ae6('0x69'),_0x206021[_0x0ae6('0x5a')],_0x206021['token']))[_0x0ae6('0x67')]('base64'))};break;default:throw new db[(_0x0ae6('0x6a'))][(_0x0ae6('0x6b'))](_0x0ae6('0x6c'));}return rp(_0x3db11f);}})[_0x0ae6('0x29')](function(_0x1f0b9e){if(_0x1f0b9e){var _0x15003f=[_0x0ae6('0x6d'),'description','group',_0x0ae6('0x6e')];_[_0x0ae6('0x6f')](_0x1f0b9e[_0x0ae6('0x64')],function(_0x104625){return _0x15003f['includes'](_0x104625[_0x0ae6('0x32')]);});return{'count':_0x1f0b9e[_0x0ae6('0x64')]['length'],'rows':_[_0x0ae6('0x2f')](_0x1f0b9e[_0x0ae6('0x64')],function(_0x1af034){return{'id':_0x1af034['id'],'name':_0x1af034[_0x0ae6('0x70')]>0x7?_0x1af034[_0x0ae6('0x71')]:_0x1af034[_0x0ae6('0x32')],'custom':_0x1af034['position']>0x7?!![]:![],'options':_0x1af034['system_field_options']?_0x1af034['system_field_options']:_0x1af034[_0x0ae6('0x72')]?_0x1af034['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x2d9ec4,null))['catch'](function(_0x58517f){var _0xc69e9d=_0x5cd03b['query'][_0x0ae6('0x73')]?0x1f4:_0x58517f['statusCode']||0x1f4;logger[_0x0ae6('0x74')](_0x0ae6('0x75'),_0x0ae6('0x59'),_0xc69e9d,JSON[_0x0ae6('0x76')](_0x58517f));delete _0x58517f[_0x0ae6('0x2c')];if(_0xc69e9d===0x191){_0xc69e9d=0x190;}_0x2d9ec4['status'](_0xc69e9d)[_0x0ae6('0x2d')](_0x5cd03b[_0x0ae6('0x35')][_0x0ae6('0x73')]?{'message':_0x0ae6('0x77'),'statusCode':_0x58517f[_0x0ae6('0x78')]}:_0x58517f);});}; \ No newline at end of file +var _0x1c7c=['moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','name','send','index','map','ZendeskAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','toString','base64','headers','Unknown\x20authentication\x20type','subject','remove','includes','title','position','system_field_options','custom_field_options','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x1e870d,_0x54ad01){var _0x44ad69=function(_0x1a5de1){while(--_0x1a5de1){_0x1e870d['push'](_0x1e870d['shift']());}};_0x44ad69(++_0x54ad01);}(_0x1c7c,0x164));var _0xc1c7=function(_0x2adf35,_0x263453){_0x2adf35=_0x2adf35-0x0;var _0x45d2e4=_0x1c7c[_0x2adf35];return _0x45d2e4;};'use strict';var emlformat=require(_0xc1c7('0x0'));var rimraf=require(_0xc1c7('0x1'));var zipdir=require(_0xc1c7('0x2'));var jsonpatch=require(_0xc1c7('0x3'));var rp=require('request-promise');var moment=require(_0xc1c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1c7('0x5'));var util=require(_0xc1c7('0x6'));var path=require(_0xc1c7('0x7'));var sox=require(_0xc1c7('0x8'));var csv=require(_0xc1c7('0x9'));var ejs=require(_0xc1c7('0xa'));var fs=require('fs');var fs_extra=require(_0xc1c7('0xb'));var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0x9'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1c7('0x1a'))['db'];var integrations=require(_0xc1c7('0x1b'));function respondWithStatusCode(_0x376cab,_0x35feaa){_0x35feaa=_0x35feaa||0xcc;return function(_0x2dad6e){if(_0x2dad6e){return _0x376cab[_0xc1c7('0x1c')](_0x35feaa);}return _0x376cab[_0xc1c7('0x1d')](_0x35feaa)[_0xc1c7('0x1e')]();};}function respondWithResult(_0xdfc7d9,_0x1b6905){_0x1b6905=_0x1b6905||0xc8;return function(_0x99b874){if(_0x99b874){return _0xdfc7d9[_0xc1c7('0x1d')](_0x1b6905)['json'](_0x99b874);}};}function respondWithFilteredResult(_0x3e1f0e,_0x335600){return function(_0x21911c){if(_0x21911c){var _0x555b59=typeof _0x335600[_0xc1c7('0x1f')]===_0xc1c7('0x20')&&typeof _0x335600[_0xc1c7('0x21')]===_0xc1c7('0x20');var _0x20439e=_0x21911c[_0xc1c7('0x22')];var _0x21758a=_0x555b59?0x0:_0x335600[_0xc1c7('0x1f')];var _0x5d44e9=_0x555b59?_0x21911c[_0xc1c7('0x22')]:_0x335600[_0xc1c7('0x1f')]+_0x335600[_0xc1c7('0x21')];var _0x1bc9d;if(_0x5d44e9>=_0x20439e){_0x5d44e9=_0x20439e;_0x1bc9d=0xc8;}else{_0x1bc9d=0xce;}_0x3e1f0e['status'](_0x1bc9d);return _0x3e1f0e[_0xc1c7('0x23')]('Content-Range',_0x21758a+'-'+_0x5d44e9+'/'+_0x20439e)[_0xc1c7('0x24')](_0x21911c);}return null;};}function patchUpdates(_0x195c5f){return function(_0x567cd4){try{jsonpatch['apply'](_0x567cd4,_0x195c5f,!![]);}catch(_0x2d006f){return BPromise[_0xc1c7('0x25')](_0x2d006f);}return _0x567cd4[_0xc1c7('0x26')]();};}function saveUpdates(_0x4c6b34,_0x813853){return function(_0x341b41){if(_0x341b41){return _0x341b41[_0xc1c7('0x27')](_0x4c6b34)[_0xc1c7('0x28')](function(_0x2e64c4){return _0x2e64c4;});}return null;};}function removeEntity(_0x3a2483,_0x3180fd){return function(_0x120168){if(_0x120168){return _0x120168[_0xc1c7('0x29')]()[_0xc1c7('0x28')](function(){_0x3a2483[_0xc1c7('0x1d')](0xcc)[_0xc1c7('0x1e')]();});}};}function handleEntityNotFound(_0x33aac7,_0x260a3f){return function(_0xf1c405){if(!_0xf1c405){_0x33aac7[_0xc1c7('0x1c')](0x194);}return _0xf1c405;};}function handleError(_0x5edb34,_0xf0ab9c){_0xf0ab9c=_0xf0ab9c||0x1f4;return function(_0x13a1f9){logger['error'](_0x13a1f9['stack']);if(_0x13a1f9[_0xc1c7('0x2a')]){delete _0x13a1f9['name'];}_0x5edb34['status'](_0xf0ab9c)[_0xc1c7('0x2b')](_0x13a1f9);};}exports[_0xc1c7('0x2c')]=function(_0x46d045,_0x243450){var _0x461360={},_0x4adb81={},_0x574e1c={'count':0x0,'rows':[]};var _0x1b6f97=_[_0xc1c7('0x2d')](db[_0xc1c7('0x2e')][_0xc1c7('0x2f')],function(_0x2e35f1){return{'name':_0x2e35f1['fieldName'],'type':_0x2e35f1['type'][_0xc1c7('0x30')]};});_0x4adb81[_0xc1c7('0x31')]=_['map'](_0x1b6f97,_0xc1c7('0x2a'));_0x4adb81[_0xc1c7('0x32')]=_[_0xc1c7('0x33')](_0x46d045[_0xc1c7('0x32')]);_0x4adb81[_0xc1c7('0x34')]=_[_0xc1c7('0x35')](_0x4adb81[_0xc1c7('0x31')],_0x4adb81['query']);_0x461360[_0xc1c7('0x36')]=_[_0xc1c7('0x35')](_0x4adb81[_0xc1c7('0x31')],qs[_0xc1c7('0x37')](_0x46d045[_0xc1c7('0x32')][_0xc1c7('0x37')]));_0x461360[_0xc1c7('0x36')]=_0x461360[_0xc1c7('0x36')][_0xc1c7('0x38')]?_0x461360['attributes']:_0x4adb81['model'];if(!_0x46d045[_0xc1c7('0x32')][_0xc1c7('0x39')](_0xc1c7('0x3a'))){_0x461360[_0xc1c7('0x21')]=qs[_0xc1c7('0x21')](_0x46d045[_0xc1c7('0x32')][_0xc1c7('0x21')]);_0x461360[_0xc1c7('0x1f')]=qs[_0xc1c7('0x1f')](_0x46d045[_0xc1c7('0x32')][_0xc1c7('0x1f')]);}_0x461360[_0xc1c7('0x3b')]=qs[_0xc1c7('0x3c')](_0x46d045[_0xc1c7('0x32')][_0xc1c7('0x3c')]);_0x461360[_0xc1c7('0x3d')]=qs[_0xc1c7('0x34')](_[_0xc1c7('0x3e')](_0x46d045[_0xc1c7('0x32')],_0x4adb81[_0xc1c7('0x34')]),_0x1b6f97);if(_0x46d045[_0xc1c7('0x32')]['filter']){_0x461360['where']=_['merge'](_0x461360[_0xc1c7('0x3d')],{'$or':_['map'](_0x1b6f97,function(_0x53bf70){if(_0x53bf70[_0xc1c7('0x3f')]!==_0xc1c7('0x40')){var _0x2cd728={};_0x2cd728[_0x53bf70[_0xc1c7('0x2a')]]={'$like':'%'+_0x46d045['query'][_0xc1c7('0x41')]+'%'};return _0x2cd728;}})});}_0x461360=_[_0xc1c7('0x42')]({},_0x461360,_0x46d045[_0xc1c7('0x43')]);var _0x3e5a61={'where':_0x461360[_0xc1c7('0x3d')]};return db[_0xc1c7('0x2e')][_0xc1c7('0x22')](_0x3e5a61)[_0xc1c7('0x28')](function(_0x1d4621){_0x574e1c[_0xc1c7('0x22')]=_0x1d4621;if(_0x46d045[_0xc1c7('0x32')][_0xc1c7('0x44')]){_0x461360[_0xc1c7('0x45')]=[{'all':!![]}];}return db['ZendeskAccount'][_0xc1c7('0x46')](_0x461360);})[_0xc1c7('0x28')](function(_0x508b32){_0x574e1c[_0xc1c7('0x47')]=_0x508b32;return _0x574e1c;})[_0xc1c7('0x28')](respondWithFilteredResult(_0x243450,_0x461360))[_0xc1c7('0x48')](handleError(_0x243450,null));};exports[_0xc1c7('0x49')]=function(_0x46a1b5,_0x2c09de){var _0xd5e06a={'raw':![],'where':{'id':_0x46a1b5[_0xc1c7('0x4a')]['id']}},_0x1e0248={};_0x1e0248[_0xc1c7('0x31')]=_['keys'](db[_0xc1c7('0x2e')][_0xc1c7('0x2f')]);_0x1e0248['query']=_['keys'](_0x46a1b5[_0xc1c7('0x32')]);_0x1e0248[_0xc1c7('0x34')]=_[_0xc1c7('0x35')](_0x1e0248[_0xc1c7('0x31')],_0x1e0248[_0xc1c7('0x32')]);_0xd5e06a['attributes']=_[_0xc1c7('0x35')](_0x1e0248[_0xc1c7('0x31')],qs['fields'](_0x46a1b5['query']['fields']));_0xd5e06a[_0xc1c7('0x36')]=_0xd5e06a[_0xc1c7('0x36')][_0xc1c7('0x38')]?_0xd5e06a['attributes']:_0x1e0248[_0xc1c7('0x31')];if(_0x46a1b5[_0xc1c7('0x32')]['includeAll']){_0xd5e06a[_0xc1c7('0x45')]=[{'all':!![]}];}_0xd5e06a=_[_0xc1c7('0x42')]({},_0xd5e06a,_0x46a1b5[_0xc1c7('0x43')]);return db[_0xc1c7('0x2e')][_0xc1c7('0x4b')](_0xd5e06a)[_0xc1c7('0x28')](handleEntityNotFound(_0x2c09de,null))[_0xc1c7('0x28')](respondWithResult(_0x2c09de,null))[_0xc1c7('0x48')](handleError(_0x2c09de,null));};exports[_0xc1c7('0x4c')]=function(_0x3ec5de,_0xa49f73){return db[_0xc1c7('0x2e')][_0xc1c7('0x4c')](_0x3ec5de[_0xc1c7('0x4d')],{})[_0xc1c7('0x28')](respondWithResult(_0xa49f73,0xc9))[_0xc1c7('0x48')](handleError(_0xa49f73,null));};exports[_0xc1c7('0x27')]=function(_0x1addc8,_0x5da115){if(_0x1addc8[_0xc1c7('0x4d')]['id']){delete _0x1addc8['body']['id'];}return db[_0xc1c7('0x2e')][_0xc1c7('0x4b')]({'where':{'id':_0x1addc8[_0xc1c7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5da115,null))[_0xc1c7('0x28')](saveUpdates(_0x1addc8[_0xc1c7('0x4d')],null))['then'](respondWithResult(_0x5da115,null))['catch'](handleError(_0x5da115,null));};exports['destroy']=function(_0x302185,_0x415416){return db['ZendeskAccount'][_0xc1c7('0x4b')]({'where':{'id':_0x302185[_0xc1c7('0x4a')]['id']}})[_0xc1c7('0x28')](handleEntityNotFound(_0x415416,null))[_0xc1c7('0x28')](removeEntity(_0x415416,null))[_0xc1c7('0x48')](handleError(_0x415416,null));};exports[_0xc1c7('0x4e')]=function(_0x4cad6a,_0x259e55,_0x568377){var _0x307b5e={};var _0x456ac1={};var _0x37dca9;var _0x557cb6;return db[_0xc1c7('0x2e')][_0xc1c7('0x4f')]({'where':{'id':_0x4cad6a[_0xc1c7('0x4a')]['id']}})[_0xc1c7('0x28')](handleEntityNotFound(_0x259e55,null))[_0xc1c7('0x28')](function(_0x45dfa2){if(_0x45dfa2){_0x37dca9=_0x45dfa2;_0x456ac1[_0xc1c7('0x31')]=_[_0xc1c7('0x33')](db['ZendeskConfiguration'][_0xc1c7('0x2f')]);_0x456ac1[_0xc1c7('0x32')]=_[_0xc1c7('0x33')](_0x4cad6a['query']);_0x456ac1['filters']=_[_0xc1c7('0x35')](_0x456ac1[_0xc1c7('0x31')],_0x456ac1[_0xc1c7('0x32')]);_0x307b5e['attributes']=_[_0xc1c7('0x35')](_0x456ac1['model'],qs[_0xc1c7('0x37')](_0x4cad6a[_0xc1c7('0x32')][_0xc1c7('0x37')]));_0x307b5e[_0xc1c7('0x36')]=_0x307b5e[_0xc1c7('0x36')][_0xc1c7('0x38')]?_0x307b5e[_0xc1c7('0x36')]:_0x456ac1['model'];_0x307b5e[_0xc1c7('0x3b')]=qs[_0xc1c7('0x3c')](_0x4cad6a[_0xc1c7('0x32')]['sort']);_0x307b5e[_0xc1c7('0x3d')]=qs['filters'](_[_0xc1c7('0x3e')](_0x4cad6a['query'],_0x456ac1[_0xc1c7('0x34')]));if(_0x4cad6a[_0xc1c7('0x32')][_0xc1c7('0x41')]){_0x307b5e[_0xc1c7('0x3d')]=_[_0xc1c7('0x42')](_0x307b5e['where'],{'$or':_['map'](_0x307b5e['attributes'],function(_0xbce766){var _0x28231b={};_0x28231b[_0xbce766]={'$like':'%'+_0x4cad6a[_0xc1c7('0x32')][_0xc1c7('0x41')]+'%'};return _0x28231b;})});}_0x307b5e=_[_0xc1c7('0x42')]({},_0x307b5e,_0x4cad6a[_0xc1c7('0x43')]);return _0x37dca9['getConfigurations'](_0x307b5e);}})[_0xc1c7('0x28')](function(_0xe5882){if(_0xe5882){_0x557cb6=_0xe5882[_0xc1c7('0x38')];if(!_0x4cad6a[_0xc1c7('0x32')]['hasOwnProperty'](_0xc1c7('0x3a'))){_0x307b5e[_0xc1c7('0x21')]=qs[_0xc1c7('0x21')](_0x4cad6a['query'][_0xc1c7('0x21')]);_0x307b5e[_0xc1c7('0x1f')]=qs[_0xc1c7('0x1f')](_0x4cad6a[_0xc1c7('0x32')]['offset']);}return _0x37dca9['getConfigurations'](_0x307b5e);}})[_0xc1c7('0x28')](function(_0x203790){if(_0x203790){return _0x203790?{'count':_0x557cb6,'rows':_0x203790}:null;}})['then'](respondWithResult(_0x259e55,null))[_0xc1c7('0x48')](handleError(_0x259e55,null));};exports[_0xc1c7('0x50')]=function(_0x4b27f5,_0x12aaac,_0x6eec68){if(_0x4b27f5['body']['id']){delete _0x4b27f5[_0xc1c7('0x4d')]['id'];}return db[_0xc1c7('0x2e')][_0xc1c7('0x4f')]({'where':{'id':_0x4b27f5[_0xc1c7('0x4a')]['id']}})[_0xc1c7('0x28')](handleEntityNotFound(_0x12aaac,null))[_0xc1c7('0x28')](function(_0x1ed9fc){if(_0x1ed9fc){_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x51')]=_0x1ed9fc['id'];_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x52')]=integrations[_0xc1c7('0x53')](_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x54')],_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x3f')]);_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x55')]=integrations[_0xc1c7('0x56')](_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x54')],_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x3f')]);return db[_0xc1c7('0x57')][_0xc1c7('0x4c')](_0x4b27f5[_0xc1c7('0x4d')],{'include':[{'model':db[_0xc1c7('0x58')],'as':_0xc1c7('0x52')},{'model':db['ZendeskField'],'as':_0xc1c7('0x55')}]});}return null;})[_0xc1c7('0x28')](respondWithResult(_0x12aaac,null))[_0xc1c7('0x48')](handleError(_0x12aaac,null));};exports[_0xc1c7('0x59')]=function(_0x268de7,_0x1cd622,_0x1ccd7d){var _0x29181f='';return db['ZendeskAccount'][_0xc1c7('0x4f')]({'where':{'id':_0x268de7[_0xc1c7('0x4a')]['id']},'attributes':['id',_0xc1c7('0x5a'),_0xc1c7('0x5b'),_0xc1c7('0x5c'),_0xc1c7('0x5d'),_0xc1c7('0x5e')]})[_0xc1c7('0x28')](handleEntityNotFound(_0x1cd622,null))['then'](function(_0x378f7f){if(_0x378f7f){_0x29181f=_0x378f7f[_0xc1c7('0x5e')];var _0x32ed03=_0x29181f[_0xc1c7('0x5f')](-0x1);if(_0x32ed03==='/'){_0x29181f=_0x29181f[_0xc1c7('0x60')](0x0,_0x29181f[_0xc1c7('0x61')](_0x32ed03));}var _0x426698={'method':_0xc1c7('0x62'),'uri':util[_0xc1c7('0x63')](_0xc1c7('0x64'),_0x29181f,_0xc1c7('0x65')),'json':!![]};switch(_0x378f7f[_0xc1c7('0x5d')]){case'password':_0x426698['headers']={'Authorization':util[_0xc1c7('0x63')](_0xc1c7('0x66'),new Buffer(util[_0xc1c7('0x63')](_0xc1c7('0x67'),_0x378f7f[_0xc1c7('0x5a')],_0x378f7f[_0xc1c7('0x5b')]))[_0xc1c7('0x68')](_0xc1c7('0x69')))};break;case _0xc1c7('0x5c'):_0x426698[_0xc1c7('0x6a')]={'Authorization':util[_0xc1c7('0x63')](_0xc1c7('0x66'),new Buffer(util[_0xc1c7('0x63')]('%s/token:%s',_0x378f7f[_0xc1c7('0x5a')],_0x378f7f[_0xc1c7('0x5c')]))[_0xc1c7('0x68')]('base64'))};break;default:throw new db['Sequelize']['ValidationError'](_0xc1c7('0x6b'));}return rp(_0x426698);}})[_0xc1c7('0x28')](function(_0x51dfb2){if(_0x51dfb2){var _0x1f2940=[_0xc1c7('0x6c'),'description','group','assignee'];_[_0xc1c7('0x6d')](_0x51dfb2['ticket_fields'],function(_0x219d44){return _0x1f2940[_0xc1c7('0x6e')](_0x219d44[_0xc1c7('0x3f')]);});return{'count':_0x51dfb2['ticket_fields'][_0xc1c7('0x38')],'rows':_['map'](_0x51dfb2[_0xc1c7('0x65')],function(_0x16832c){return{'id':_0x16832c['id'],'name':_0x16832c['position']>0x7?_0x16832c[_0xc1c7('0x6f')]:_0x16832c[_0xc1c7('0x3f')],'custom':_0x16832c[_0xc1c7('0x70')]>0x7?!![]:![],'options':_0x16832c[_0xc1c7('0x71')]?_0x16832c[_0xc1c7('0x71')]:_0x16832c[_0xc1c7('0x72')]?_0x16832c[_0xc1c7('0x72')]:[]};})};}})[_0xc1c7('0x28')](respondWithResult(_0x1cd622,null))[_0xc1c7('0x48')](function(_0x3eba33){var _0x4bb9bc=_0x268de7[_0xc1c7('0x32')][_0xc1c7('0x73')]?0x1f4:_0x3eba33[_0xc1c7('0x74')]||0x1f4;logger[_0xc1c7('0x75')]('getFields,\x20%s,\x20%s,\x20%s',_0xc1c7('0x59'),_0x4bb9bc,JSON[_0xc1c7('0x76')](_0x3eba33));delete _0x3eba33['name'];if(_0x4bb9bc===0x191){_0x4bb9bc=0x190;}_0x1cd622['status'](_0x4bb9bc)[_0xc1c7('0x2b')](_0x268de7[_0xc1c7('0x32')][_0xc1c7('0x73')]?{'message':_0xc1c7('0x77'),'statusCode':_0x3eba33[_0xc1c7('0x74')]}:_0x3eba33);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index e28aede..9e34c16 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 _0x28a1=['path','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define','ZendeskAccount','util','../../config/logger','api','bluebird'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x28a1,0xb7));var _0x128a=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x28a1[_0x5a6644];return _0x3a2a5d;};'use strict';var _=require('lodash');var util=require(_0x128a('0x0'));var logger=require(_0x128a('0x1'))(_0x128a('0x2'));var moment=require('moment');var BPromise=require(_0x128a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x128a('0x4'));var rimraf=require(_0x128a('0x5'));var config=require(_0x128a('0x6'));var attributes=require(_0x128a('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x128a('0x8')]=function(_0x23891a,_0x105cb8){return _0x23891a[_0x128a('0x9')](_0x128a('0xa'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x677b=['ZendeskAccount','int_zendesk_accounts','bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x44721b,_0x16cc82){var _0x20cd74=function(_0x5af97b){while(--_0x5af97b){_0x44721b['push'](_0x44721b['shift']());}};_0x20cd74(++_0x16cc82);}(_0x677b,0x8e));var _0xb677=function(_0x114d1f,_0x55548e){_0x114d1f=_0x114d1f-0x0;var _0x5b91d4=_0x677b[_0x114d1f];return _0x5b91d4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb677('0x0'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb677('0x1'));var rimraf=require(_0xb677('0x2'));var config=require(_0xb677('0x3'));var attributes=require(_0xb677('0x4'));var integrations=require(_0xb677('0x5'));module[_0xb677('0x6')]=function(_0x35b0b6,_0x3e5f35){return _0x35b0b6[_0xb677('0x7')](_0xb677('0x8'),attributes,{'tableName':_0xb677('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index b91d1e8..3a6115c 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 _0x4cdc=['rpc','jayson/promise','client','http','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetZendeskAccount','options','raw','where','attributes','limit','include','map','model','ShowZendeskAccount','then','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0x4cdc,0x1eb));var _0xc4cd=function(_0x12388a,_0x7cfeaf){_0x12388a=_0x12388a-0x0;var _0x4e96d8=_0x4cdc[_0x12388a];return _0x4e96d8;};'use strict';var _=require(_0xc4cd('0x0'));var util=require(_0xc4cd('0x1'));var moment=require(_0xc4cd('0x2'));var BPromise=require(_0xc4cd('0x3'));var rs=require(_0xc4cd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc4cd('0x5'));var config=require('../../config/environment');var jayson=require(_0xc4cd('0x6'));var client=jayson[_0xc4cd('0x7')][_0xc4cd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21c001,_0x5199ca,_0x2a34c7){return new BPromise(function(_0x463215,_0x3551c3){return client['request'](_0x21c001,_0x2a34c7)['then'](function(_0x31f076){logger[_0xc4cd('0x9')](_0xc4cd('0xa'),_0x5199ca,'request\x20sent');logger[_0xc4cd('0xb')](_0xc4cd('0xc'),_0x5199ca,_0xc4cd('0xd'),JSON[_0xc4cd('0xe')](_0x31f076));if(_0x31f076[_0xc4cd('0xf')]){if(_0x31f076[_0xc4cd('0xf')][_0xc4cd('0x10')]===0x1f4){logger[_0xc4cd('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x5199ca,_0x31f076[_0xc4cd('0xf')]['message']);return _0x3551c3(_0x31f076[_0xc4cd('0xf')][_0xc4cd('0x11')]);}logger['error'](_0xc4cd('0xa'),_0x5199ca,_0x31f076[_0xc4cd('0xf')][_0xc4cd('0x11')]);return _0x463215(_0x31f076[_0xc4cd('0xf')]['message']);}else{logger['info'](_0xc4cd('0xa'),_0x5199ca,_0xc4cd('0xd'));_0x463215(_0x31f076[_0xc4cd('0x12')]['message']);}})['catch'](function(_0x4f1dbc){logger[_0xc4cd('0xf')](_0xc4cd('0xa'),_0x5199ca,_0x4f1dbc);_0x3551c3(_0x4f1dbc);});});}exports[_0xc4cd('0x13')]=function(_0xb7eb86){var _0x167bd3=this;return new Promise(function(_0x450596,_0x567650){return db['ZendeskAccount']['findAll']({'raw':_0xb7eb86['options']?_0xb7eb86[_0xc4cd('0x14')][_0xc4cd('0x15')]===undefined?!![]:![]:!![],'where':_0xb7eb86[_0xc4cd('0x14')]?_0xb7eb86[_0xc4cd('0x14')][_0xc4cd('0x16')]||null:null,'attributes':_0xb7eb86[_0xc4cd('0x14')]?_0xb7eb86[_0xc4cd('0x14')][_0xc4cd('0x17')]||null:null,'limit':_0xb7eb86[_0xc4cd('0x14')]?_0xb7eb86[_0xc4cd('0x14')][_0xc4cd('0x18')]||null:null,'include':_0xb7eb86['options']?_0xb7eb86['options'][_0xc4cd('0x19')]?_[_0xc4cd('0x1a')](_0xb7eb86[_0xc4cd('0x14')][_0xc4cd('0x19')],function(_0x23cbe5){return{'model':db[_0x23cbe5[_0xc4cd('0x1b')]],'as':_0x23cbe5['as'],'attributes':_0x23cbe5[_0xc4cd('0x17')],'include':_0x23cbe5['include']?_[_0xc4cd('0x1a')](_0x23cbe5['include'],function(_0x5d6c69){return{'model':db[_0x5d6c69['model']],'as':_0x5d6c69['as'],'attributes':_0x5d6c69['attributes'],'include':_0x5d6c69[_0xc4cd('0x19')]?_[_0xc4cd('0x1a')](_0x5d6c69[_0xc4cd('0x19')],function(_0x7577b6){return{'model':db[_0x7577b6[_0xc4cd('0x1b')]],'as':_0x7577b6['as'],'attributes':_0x7577b6[_0xc4cd('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26d4d8){logger[_0xc4cd('0x9')](_0xc4cd('0x13'),_0xb7eb86);logger[_0xc4cd('0xb')](_0xc4cd('0x13'),_0xb7eb86,JSON[_0xc4cd('0xe')](_0x26d4d8));_0x450596(_0x26d4d8);})['catch'](function(_0x14c8b8){logger[_0xc4cd('0xf')](_0xc4cd('0x13'),_0x14c8b8[_0xc4cd('0x11')],_0xb7eb86);_0x567650(_0x167bd3['error'](0x1f4,_0x14c8b8[_0xc4cd('0x11')]));});});};exports[_0xc4cd('0x1c')]=function(_0x43c693){var _0x544768=this;return new Promise(function(_0x274396,_0x33ce9b){return db['ZendeskAccount']['find']({'raw':_0x43c693[_0xc4cd('0x14')]?_0x43c693[_0xc4cd('0x14')][_0xc4cd('0x15')]===undefined?!![]:![]:!![],'where':_0x43c693[_0xc4cd('0x14')]?_0x43c693[_0xc4cd('0x14')]['where']||null:null,'attributes':_0x43c693[_0xc4cd('0x14')]?_0x43c693[_0xc4cd('0x14')]['attributes']||null:null,'include':_0x43c693['options']?_0x43c693[_0xc4cd('0x14')]['include']?_[_0xc4cd('0x1a')](_0x43c693['options'][_0xc4cd('0x19')],function(_0x9d05f9){return{'model':db[_0x9d05f9[_0xc4cd('0x1b')]],'as':_0x9d05f9['as'],'attributes':_0x9d05f9[_0xc4cd('0x17')],'include':_0x9d05f9[_0xc4cd('0x19')]?_[_0xc4cd('0x1a')](_0x9d05f9['include'],function(_0x396f2b){return{'model':db[_0x396f2b[_0xc4cd('0x1b')]],'as':_0x396f2b['as'],'attributes':_0x396f2b[_0xc4cd('0x17')],'include':_0x396f2b['include']?_[_0xc4cd('0x1a')](_0x396f2b[_0xc4cd('0x19')],function(_0x43edb9){return{'model':db[_0x43edb9[_0xc4cd('0x1b')]],'as':_0x43edb9['as'],'attributes':_0x43edb9['attributes']};}):[]};}):[]};}):[]:[]})[_0xc4cd('0x1d')](function(_0x22e51d){logger[_0xc4cd('0x9')]('ShowZendeskAccount',_0x43c693);logger[_0xc4cd('0xb')](_0xc4cd('0x1c'),_0x43c693,JSON[_0xc4cd('0xe')](_0x22e51d));_0x274396(_0x22e51d);})[_0xc4cd('0x1e')](function(_0x2dfc75){logger[_0xc4cd('0xf')](_0xc4cd('0x1c'),_0x2dfc75[_0xc4cd('0x11')],_0x43c693);_0x33ce9b(_0x544768['error'](0x1f4,_0x2dfc75[_0xc4cd('0x11')]));});});}; \ No newline at end of file +var _0x5bea=['ZendeskAccount','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','ZendeskAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','options','raw','where','attributes','limit','include','map','model','then','info','GetZendeskAccount','ShowZendeskAccount'];(function(_0x52f975,_0x305404){var _0x1b15a3=function(_0x5e9a63){while(--_0x5e9a63){_0x52f975['push'](_0x52f975['shift']());}};_0x1b15a3(++_0x305404);}(_0x5bea,0x141));var _0xa5be=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5bea[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0xa5be('0x0'));var moment=require(_0xa5be('0x1'));var BPromise=require('bluebird');var rs=require(_0xa5be('0x2'));var fs=require('fs');var Redis=require(_0xa5be('0x3'));var db=require(_0xa5be('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa5be('0x5'))(_0xa5be('0x6'));var config=require(_0xa5be('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa5be('0x8')][_0xa5be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cdab3,_0x4e1e41,_0x4af23f){return new BPromise(function(_0x4a9787,_0x2b13ef){return client[_0xa5be('0xa')](_0x2cdab3,_0x4af23f)['then'](function(_0x105041){logger['info'](_0xa5be('0xb'),_0x4e1e41,'request\x20sent');logger[_0xa5be('0xc')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x4e1e41,'request\x20sent',JSON[_0xa5be('0xd')](_0x105041));if(_0x105041[_0xa5be('0xe')]){if(_0x105041['error'][_0xa5be('0xf')]===0x1f4){logger['error'](_0xa5be('0xb'),_0x4e1e41,_0x105041[_0xa5be('0xe')][_0xa5be('0x10')]);return _0x2b13ef(_0x105041[_0xa5be('0xe')][_0xa5be('0x10')]);}logger['error'](_0xa5be('0xb'),_0x4e1e41,_0x105041[_0xa5be('0xe')]['message']);return _0x4a9787(_0x105041['error'][_0xa5be('0x10')]);}else{logger['info'](_0xa5be('0xb'),_0x4e1e41,_0xa5be('0x11'));_0x4a9787(_0x105041['result'][_0xa5be('0x10')]);}})[_0xa5be('0x12')](function(_0x5cbf7b){logger[_0xa5be('0xe')](_0xa5be('0xb'),_0x4e1e41,_0x5cbf7b);_0x2b13ef(_0x5cbf7b);});});}exports['GetZendeskAccount']=function(_0x433403){var _0x253eb0=this;return new Promise(function(_0x1bbe5e,_0x1d094b){return db['ZendeskAccount']['findAll']({'raw':_0x433403[_0xa5be('0x13')]?_0x433403['options'][_0xa5be('0x14')]===undefined?!![]:![]:!![],'where':_0x433403[_0xa5be('0x13')]?_0x433403['options'][_0xa5be('0x15')]||null:null,'attributes':_0x433403[_0xa5be('0x13')]?_0x433403[_0xa5be('0x13')][_0xa5be('0x16')]||null:null,'limit':_0x433403['options']?_0x433403['options'][_0xa5be('0x17')]||null:null,'include':_0x433403[_0xa5be('0x13')]?_0x433403['options'][_0xa5be('0x18')]?_[_0xa5be('0x19')](_0x433403[_0xa5be('0x13')][_0xa5be('0x18')],function(_0x229e0f){return{'model':db[_0x229e0f[_0xa5be('0x1a')]],'as':_0x229e0f['as'],'attributes':_0x229e0f['attributes'],'include':_0x229e0f[_0xa5be('0x18')]?_[_0xa5be('0x19')](_0x229e0f['include'],function(_0x4dd31a){return{'model':db[_0x4dd31a['model']],'as':_0x4dd31a['as'],'attributes':_0x4dd31a['attributes'],'include':_0x4dd31a[_0xa5be('0x18')]?_[_0xa5be('0x19')](_0x4dd31a[_0xa5be('0x18')],function(_0x2cec12){return{'model':db[_0x2cec12['model']],'as':_0x2cec12['as'],'attributes':_0x2cec12[_0xa5be('0x16')]};}):[]};}):[]};}):[]:[]})[_0xa5be('0x1b')](function(_0x472718){logger[_0xa5be('0x1c')]('GetZendeskAccount',_0x433403);logger[_0xa5be('0xc')]('GetZendeskAccount',_0x433403,JSON[_0xa5be('0xd')](_0x472718));_0x1bbe5e(_0x472718);})[_0xa5be('0x12')](function(_0xf7b26f){logger['error'](_0xa5be('0x1d'),_0xf7b26f['message'],_0x433403);_0x1d094b(_0x253eb0[_0xa5be('0xe')](0x1f4,_0xf7b26f[_0xa5be('0x10')]));});});};exports[_0xa5be('0x1e')]=function(_0x5ba53a){var _0x2bf4cf=this;return new Promise(function(_0x1c9ad2,_0x47e094){return db[_0xa5be('0x1f')]['find']({'raw':_0x5ba53a[_0xa5be('0x13')]?_0x5ba53a['options']['raw']===undefined?!![]:![]:!![],'where':_0x5ba53a['options']?_0x5ba53a[_0xa5be('0x13')][_0xa5be('0x15')]||null:null,'attributes':_0x5ba53a[_0xa5be('0x13')]?_0x5ba53a[_0xa5be('0x13')]['attributes']||null:null,'include':_0x5ba53a[_0xa5be('0x13')]?_0x5ba53a[_0xa5be('0x13')][_0xa5be('0x18')]?_['map'](_0x5ba53a[_0xa5be('0x13')][_0xa5be('0x18')],function(_0x2c9827){return{'model':db[_0x2c9827['model']],'as':_0x2c9827['as'],'attributes':_0x2c9827[_0xa5be('0x16')],'include':_0x2c9827[_0xa5be('0x18')]?_['map'](_0x2c9827[_0xa5be('0x18')],function(_0xdc24ca){return{'model':db[_0xdc24ca[_0xa5be('0x1a')]],'as':_0xdc24ca['as'],'attributes':_0xdc24ca[_0xa5be('0x16')],'include':_0xdc24ca[_0xa5be('0x18')]?_[_0xa5be('0x19')](_0xdc24ca[_0xa5be('0x18')],function(_0x1739ab){return{'model':db[_0x1739ab[_0xa5be('0x1a')]],'as':_0x1739ab['as'],'attributes':_0x1739ab[_0xa5be('0x16')]};}):[]};}):[]};}):[]:[]})[_0xa5be('0x1b')](function(_0x5ee924){logger['info'](_0xa5be('0x1e'),_0x5ba53a);logger[_0xa5be('0xc')](_0xa5be('0x1e'),_0x5ba53a,JSON[_0xa5be('0xd')](_0x5ee924));_0x1c9ad2(_0x5ee924);})[_0xa5be('0x12')](function(_0x733227){logger['error']('ShowZendeskAccount',_0x733227['message'],_0x5ba53a);_0x47e094(_0x2bf4cf[_0xa5be('0xe')](0x1f4,_0x733227[_0xa5be('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 643f88f..5fb8a2d 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 _0xb10b=['getFields','/:id/subjects','/:id/descriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields'];(function(_0x4f56d3,_0x30adbb){var _0x159373=function(_0x3d054a){while(--_0x3d054a){_0x4f56d3['push'](_0x4f56d3['shift']());}};_0x159373(++_0x30adbb);}(_0xb10b,0x12a));var _0xbb10=function(_0x324661,_0x3fb798){_0x324661=_0x324661-0x0;var _0x135bed=_0xb10b[_0x324661];return _0x135bed;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getDescriptions']);router[_0xbb10('0x9')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x12')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x12')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x15')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);module['exports']=router; \ No newline at end of file +var _0x750a=['getTags','post','setTags','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/tags'];(function(_0x21ef62,_0x4d7b8c){var _0x56e76d=function(_0x4a030e){while(--_0x4a030e){_0x21ef62['push'](_0x21ef62['shift']());}};_0x56e76d(++_0x4d7b8c);}(_0x750a,0x140));var _0xa750=function(_0x58d5a3,_0x1a2f5a){_0x58d5a3=_0x58d5a3-0x0;var _0x597721=_0x750a[_0x58d5a3];return _0x597721;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['show']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x8')]('/:id/subjects',auth[_0xa750('0x9')](),controller[_0xa750('0xe')]);router['get']('/:id/descriptions',auth[_0xa750('0x9')](),controller['getDescriptions']);router[_0xa750('0x8')](_0xa750('0xf'),auth['isAuthenticated'](),controller[_0xa750('0x10')]);router[_0xa750('0x11')]('/',auth[_0xa750('0x9')](),controller['create']);router[_0xa750('0x11')](_0xa750('0xf'),auth[_0xa750('0x9')](),controller[_0xa750('0x12')]);router[_0xa750('0x13')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x14')]);router[_0xa750('0x15')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x16')]);module[_0xa750('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 00993fa..0ec46cd 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 _0xd580=['exports','STRING','sequelize'];(function(_0x2e0bed,_0x24b28d){var _0x45e74e=function(_0x36166d){while(--_0x36166d){_0x2e0bed['push'](_0x2e0bed['shift']());}};_0x45e74e(++_0x24b28d);}(_0xd580,0x164));var _0x0d58=function(_0x4924c1,_0x515188){_0x4924c1=_0x4924c1-0x0;var _0x2bce54=_0xd580[_0x4924c1];return _0x2bce54;};'use strict';var Sequelize=require(_0x0d58('0x0'));module[_0x0d58('0x1')]={'name':{'type':Sequelize[_0x0d58('0x2')]},'description':{'type':Sequelize[_0x0d58('0x2')]}}; \ No newline at end of file +var _0xb28c=['sequelize','STRING'];(function(_0x39dd10,_0x134622){var _0x35bd8a=function(_0x156710){while(--_0x156710){_0x39dd10['push'](_0x39dd10['shift']());}};_0x35bd8a(++_0x134622);}(_0xb28c,0x1b8));var _0xcb28=function(_0x3048e8,_0x6b1292){_0x3048e8=_0x3048e8-0x0;var _0x4dd508=_0xb28c[_0x3048e8];return _0x4dd508;};'use strict';var Sequelize=require(_0xcb28('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcb28('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 624fb79..801d3db 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 _0x1902=['destroy','then','sendStatus','error','stack','name','index','ZendeskConfiguration','rawAttributes','fieldName','model','map','query','filters','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getFields','ZendeskField','intersection','length','nolimit','getSubjects','getDescriptions','findOne','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update'];(function(_0x32a326,_0x343f45){var _0x48cd14=function(_0x370d9f){while(--_0x370d9f){_0x32a326['push'](_0x32a326['shift']());}};_0x48cd14(++_0x343f45);}(_0x1902,0x84));var _0x2190=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1902[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2190('0x0'));var rimraf=require(_0x2190('0x1'));var zipdir=require(_0x2190('0x2'));var jsonpatch=require(_0x2190('0x3'));var rp=require(_0x2190('0x4'));var moment=require(_0x2190('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2190('0x6'));var util=require(_0x2190('0x7'));var path=require('path');var sox=require(_0x2190('0x8'));var csv=require(_0x2190('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2190('0xa'));var _=require(_0x2190('0xb'));var squel=require(_0x2190('0xc'));var crypto=require(_0x2190('0xd'));var jsforce=require(_0x2190('0xe'));var deskjs=require(_0x2190('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2190('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2190('0x11'));var as=require(_0x2190('0x12'));var hardwareService=require(_0x2190('0x13'));var logger=require(_0x2190('0x14'))(_0x2190('0x15'));var utils=require(_0x2190('0x16'));var config=require(_0x2190('0x17'));var licenseUtil=require(_0x2190('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd5b163,_0x5517ee){_0x5517ee=_0x5517ee||0xcc;return function(_0x57f57e){if(_0x57f57e){return _0xd5b163['sendStatus'](_0x5517ee);}return _0xd5b163[_0x2190('0x19')](_0x5517ee)[_0x2190('0x1a')]();};}function respondWithResult(_0x2eff5e,_0x5a9160){_0x5a9160=_0x5a9160||0xc8;return function(_0x2d4ca4){if(_0x2d4ca4){return _0x2eff5e[_0x2190('0x19')](_0x5a9160)[_0x2190('0x1b')](_0x2d4ca4);}};}function respondWithFilteredResult(_0x28d857,_0x203c7f){return function(_0x13e2c8){if(_0x13e2c8){var _0x43d4ea=typeof _0x203c7f[_0x2190('0x1c')]===_0x2190('0x1d')&&typeof _0x203c7f[_0x2190('0x1e')]===_0x2190('0x1d');var _0xac95b4=_0x13e2c8[_0x2190('0x1f')];var _0x519dfc=_0x43d4ea?0x0:_0x203c7f[_0x2190('0x1c')];var _0x14c6f6=_0x43d4ea?_0x13e2c8[_0x2190('0x1f')]:_0x203c7f[_0x2190('0x1c')]+_0x203c7f['limit'];var _0x8db504;if(_0x14c6f6>=_0xac95b4){_0x14c6f6=_0xac95b4;_0x8db504=0xc8;}else{_0x8db504=0xce;}_0x28d857['status'](_0x8db504);return _0x28d857[_0x2190('0x20')](_0x2190('0x21'),_0x519dfc+'-'+_0x14c6f6+'/'+_0xac95b4)['json'](_0x13e2c8);}return null;};}function patchUpdates(_0x2e3894){return function(_0x1eb553){try{jsonpatch['apply'](_0x1eb553,_0x2e3894,!![]);}catch(_0x5a92f1){return BPromise[_0x2190('0x22')](_0x5a92f1);}return _0x1eb553['save']();};}function saveUpdates(_0x47c25d,_0xe6e656){return function(_0x142181){if(_0x142181){return _0x142181[_0x2190('0x23')](_0x47c25d)['then'](function(_0x1a9bf9){return _0x1a9bf9;});}return null;};}function removeEntity(_0x7c5e8d,_0x284fa6){return function(_0x509a61){if(_0x509a61){return _0x509a61[_0x2190('0x24')]()[_0x2190('0x25')](function(){_0x7c5e8d[_0x2190('0x19')](0xcc)[_0x2190('0x1a')]();});}};}function handleEntityNotFound(_0xe9e6d9,_0x10580d){return function(_0x5e982b){if(!_0x5e982b){_0xe9e6d9[_0x2190('0x26')](0x194);}return _0x5e982b;};}function handleError(_0x2bfda4,_0x268ce3){_0x268ce3=_0x268ce3||0x1f4;return function(_0x537c79){logger[_0x2190('0x27')](_0x537c79[_0x2190('0x28')]);if(_0x537c79[_0x2190('0x29')]){delete _0x537c79['name'];}_0x2bfda4['status'](_0x268ce3)['send'](_0x537c79);};}exports[_0x2190('0x2a')]=function(_0x4fb7f0,_0x264ab4){var _0x3c5c72={},_0xe721a3={},_0x4e43ac={'count':0x0,'rows':[]};var _0x290c56=_['map'](db[_0x2190('0x2b')][_0x2190('0x2c')],function(_0x2ea568){return{'name':_0x2ea568[_0x2190('0x2d')],'type':_0x2ea568['type']['key']};});_0xe721a3[_0x2190('0x2e')]=_[_0x2190('0x2f')](_0x290c56,'name');_0xe721a3[_0x2190('0x30')]=_['keys'](_0x4fb7f0[_0x2190('0x30')]);_0xe721a3[_0x2190('0x31')]=_['intersection'](_0xe721a3[_0x2190('0x2e')],_0xe721a3[_0x2190('0x30')]);_0x3c5c72[_0x2190('0x32')]=_['intersection'](_0xe721a3[_0x2190('0x2e')],qs[_0x2190('0x33')](_0x4fb7f0['query'][_0x2190('0x33')]));_0x3c5c72[_0x2190('0x32')]=_0x3c5c72[_0x2190('0x32')]['length']?_0x3c5c72[_0x2190('0x32')]:_0xe721a3[_0x2190('0x2e')];if(!_0x4fb7f0[_0x2190('0x30')][_0x2190('0x34')]('nolimit')){_0x3c5c72[_0x2190('0x1e')]=qs[_0x2190('0x1e')](_0x4fb7f0[_0x2190('0x30')]['limit']);_0x3c5c72[_0x2190('0x1c')]=qs[_0x2190('0x1c')](_0x4fb7f0['query'][_0x2190('0x1c')]);}_0x3c5c72[_0x2190('0x35')]=qs[_0x2190('0x36')](_0x4fb7f0[_0x2190('0x30')][_0x2190('0x36')]);_0x3c5c72['where']=qs['filters'](_[_0x2190('0x37')](_0x4fb7f0['query'],_0xe721a3[_0x2190('0x31')]),_0x290c56);if(_0x4fb7f0[_0x2190('0x30')][_0x2190('0x38')]){_0x3c5c72['where']=_[_0x2190('0x39')](_0x3c5c72[_0x2190('0x3a')],{'$or':_[_0x2190('0x2f')](_0x290c56,function(_0x539da1){if(_0x539da1[_0x2190('0x3b')]!==_0x2190('0x3c')){var _0x2a5e17={};_0x2a5e17[_0x539da1[_0x2190('0x29')]]={'$like':'%'+_0x4fb7f0[_0x2190('0x30')][_0x2190('0x38')]+'%'};return _0x2a5e17;}})});}_0x3c5c72=_[_0x2190('0x39')]({},_0x3c5c72,_0x4fb7f0[_0x2190('0x3d')]);var _0x57c3e7={'where':_0x3c5c72['where']};return db[_0x2190('0x2b')][_0x2190('0x1f')](_0x57c3e7)['then'](function(_0x312516){_0x4e43ac[_0x2190('0x1f')]=_0x312516;if(_0x4fb7f0[_0x2190('0x30')][_0x2190('0x3e')]){_0x3c5c72[_0x2190('0x3f')]=[{'all':!![]}];}return db[_0x2190('0x2b')][_0x2190('0x40')](_0x3c5c72);})['then'](function(_0x147596){_0x4e43ac[_0x2190('0x41')]=_0x147596;return _0x4e43ac;})[_0x2190('0x25')](respondWithFilteredResult(_0x264ab4,_0x3c5c72))[_0x2190('0x42')](handleError(_0x264ab4,null));};exports[_0x2190('0x43')]=function(_0x6c05f,_0x1aa527){var _0x243438={'raw':![],'where':{'id':_0x6c05f[_0x2190('0x44')]['id']}},_0x388f0d={};_0x388f0d[_0x2190('0x2e')]=_[_0x2190('0x45')](db[_0x2190('0x2b')][_0x2190('0x2c')]);_0x388f0d['query']=_[_0x2190('0x45')](_0x6c05f[_0x2190('0x30')]);_0x388f0d['filters']=_['intersection'](_0x388f0d[_0x2190('0x2e')],_0x388f0d[_0x2190('0x30')]);_0x243438[_0x2190('0x32')]=_['intersection'](_0x388f0d['model'],qs[_0x2190('0x33')](_0x6c05f[_0x2190('0x30')][_0x2190('0x33')]));_0x243438['attributes']=_0x243438[_0x2190('0x32')]['length']?_0x243438[_0x2190('0x32')]:_0x388f0d[_0x2190('0x2e')];if(_0x6c05f[_0x2190('0x30')][_0x2190('0x3e')]){_0x243438[_0x2190('0x3f')]=[{'all':!![]}];}_0x243438=_['merge']({},_0x243438,_0x6c05f[_0x2190('0x3d')]);return db[_0x2190('0x2b')][_0x2190('0x46')](_0x243438)[_0x2190('0x25')](handleEntityNotFound(_0x1aa527,null))[_0x2190('0x25')](respondWithResult(_0x1aa527,null))[_0x2190('0x42')](handleError(_0x1aa527,null));};exports[_0x2190('0x47')]=function(_0x5553c1,_0x8c7610){return db[_0x2190('0x2b')]['create'](_0x5553c1[_0x2190('0x48')],{})[_0x2190('0x25')](respondWithResult(_0x8c7610,0xc9))[_0x2190('0x42')](handleError(_0x8c7610,null));};exports[_0x2190('0x23')]=function(_0x986b53,_0x246ae2){if(_0x986b53[_0x2190('0x48')]['id']){delete _0x986b53[_0x2190('0x48')]['id'];}return db['ZendeskConfiguration'][_0x2190('0x46')]({'where':{'id':_0x986b53[_0x2190('0x44')]['id']}})[_0x2190('0x25')](handleEntityNotFound(_0x246ae2,null))[_0x2190('0x25')](saveUpdates(_0x986b53[_0x2190('0x48')],null))[_0x2190('0x25')](respondWithResult(_0x246ae2,null))[_0x2190('0x42')](handleError(_0x246ae2,null));};exports['destroy']=function(_0x44b5dc,_0x18db23){return db[_0x2190('0x2b')][_0x2190('0x46')]({'where':{'id':_0x44b5dc[_0x2190('0x44')]['id']}})[_0x2190('0x25')](handleEntityNotFound(_0x18db23,null))[_0x2190('0x25')](removeEntity(_0x18db23,null))['catch'](handleError(_0x18db23,null));};exports[_0x2190('0x49')]=function(_0x1bdcc9,_0x28107a,_0x238547){var _0x404bca={};var _0x48a6bc={};var _0x523cae;var _0x2e3d08;return db[_0x2190('0x2b')]['findOne']({'where':{'id':_0x1bdcc9[_0x2190('0x44')]['id']}})[_0x2190('0x25')](handleEntityNotFound(_0x28107a,null))[_0x2190('0x25')](function(_0x24574b){if(_0x24574b){_0x523cae=_0x24574b;_0x48a6bc[_0x2190('0x2e')]=_[_0x2190('0x45')](db[_0x2190('0x4a')][_0x2190('0x2c')]);_0x48a6bc['query']=_['keys'](_0x1bdcc9[_0x2190('0x30')]);_0x48a6bc[_0x2190('0x31')]=_['intersection'](_0x48a6bc[_0x2190('0x2e')],_0x48a6bc[_0x2190('0x30')]);_0x404bca[_0x2190('0x32')]=_[_0x2190('0x4b')](_0x48a6bc[_0x2190('0x2e')],qs['fields'](_0x1bdcc9['query'][_0x2190('0x33')]));_0x404bca[_0x2190('0x32')]=_0x404bca[_0x2190('0x32')][_0x2190('0x4c')]?_0x404bca[_0x2190('0x32')]:_0x48a6bc[_0x2190('0x2e')];_0x404bca[_0x2190('0x35')]=qs[_0x2190('0x36')](_0x1bdcc9[_0x2190('0x30')]['sort']);_0x404bca[_0x2190('0x3a')]=qs[_0x2190('0x31')](_[_0x2190('0x37')](_0x1bdcc9['query'],_0x48a6bc['filters']));if(_0x1bdcc9[_0x2190('0x30')][_0x2190('0x38')]){_0x404bca[_0x2190('0x3a')]=_[_0x2190('0x39')](_0x404bca['where'],{'$or':_[_0x2190('0x2f')](_0x404bca[_0x2190('0x32')],function(_0x41bd66){var _0x27475e={};_0x27475e[_0x41bd66]={'$like':'%'+_0x1bdcc9['query'][_0x2190('0x38')]+'%'};return _0x27475e;})});}_0x404bca=_[_0x2190('0x39')]({},_0x404bca,_0x1bdcc9[_0x2190('0x3d')]);return _0x523cae[_0x2190('0x49')](_0x404bca);}})[_0x2190('0x25')](function(_0x5a0fa2){if(_0x5a0fa2){_0x2e3d08=_0x5a0fa2['length'];if(!_0x1bdcc9[_0x2190('0x30')][_0x2190('0x34')](_0x2190('0x4d'))){_0x404bca[_0x2190('0x1e')]=qs[_0x2190('0x1e')](_0x1bdcc9[_0x2190('0x30')][_0x2190('0x1e')]);_0x404bca['offset']=qs['offset'](_0x1bdcc9[_0x2190('0x30')]['offset']);}return _0x523cae[_0x2190('0x49')](_0x404bca);}})[_0x2190('0x25')](function(_0x77c1d0){if(_0x77c1d0){return _0x77c1d0?{'count':_0x2e3d08,'rows':_0x77c1d0}:null;}})[_0x2190('0x25')](respondWithResult(_0x28107a,null))[_0x2190('0x42')](handleError(_0x28107a,null));};exports[_0x2190('0x4e')]=function(_0x17b06b,_0x3f5dab,_0x248ec2){var _0x599da6={};var _0x14286e={};var _0x28c3d6;var _0x38a6a2;return db[_0x2190('0x2b')]['findOne']({'where':{'id':_0x17b06b[_0x2190('0x44')]['id']}})[_0x2190('0x25')](handleEntityNotFound(_0x3f5dab,null))[_0x2190('0x25')](function(_0x2520fe){if(_0x2520fe){_0x28c3d6=_0x2520fe;_0x14286e[_0x2190('0x2e')]=_['keys'](db['ZendeskField'][_0x2190('0x2c')]);_0x14286e['query']=_['keys'](_0x17b06b[_0x2190('0x30')]);_0x14286e[_0x2190('0x31')]=_['intersection'](_0x14286e[_0x2190('0x2e')],_0x14286e[_0x2190('0x30')]);_0x599da6[_0x2190('0x32')]=_[_0x2190('0x4b')](_0x14286e['model'],qs['fields'](_0x17b06b['query']['fields']));_0x599da6[_0x2190('0x32')]=_0x599da6[_0x2190('0x32')][_0x2190('0x4c')]?_0x599da6[_0x2190('0x32')]:_0x14286e[_0x2190('0x2e')];_0x599da6[_0x2190('0x35')]=qs[_0x2190('0x36')](_0x17b06b['query'][_0x2190('0x36')]);_0x599da6[_0x2190('0x3a')]=qs['filters'](_[_0x2190('0x37')](_0x17b06b[_0x2190('0x30')],_0x14286e[_0x2190('0x31')]));if(_0x17b06b[_0x2190('0x30')]['filter']){_0x599da6[_0x2190('0x3a')]=_[_0x2190('0x39')](_0x599da6[_0x2190('0x3a')],{'$or':_[_0x2190('0x2f')](_0x599da6[_0x2190('0x32')],function(_0x257d5a){var _0x1056ce={};_0x1056ce[_0x257d5a]={'$like':'%'+_0x17b06b[_0x2190('0x30')][_0x2190('0x38')]+'%'};return _0x1056ce;})});}_0x599da6=_['merge']({},_0x599da6,_0x17b06b[_0x2190('0x3d')]);return _0x28c3d6[_0x2190('0x4e')](_0x599da6);}})['then'](function(_0x309a8b){if(_0x309a8b){_0x38a6a2=_0x309a8b['length'];if(!_0x17b06b['query'][_0x2190('0x34')]('nolimit')){_0x599da6[_0x2190('0x1e')]=qs['limit'](_0x17b06b[_0x2190('0x30')][_0x2190('0x1e')]);_0x599da6[_0x2190('0x1c')]=qs['offset'](_0x17b06b[_0x2190('0x30')][_0x2190('0x1c')]);}return _0x28c3d6[_0x2190('0x4e')](_0x599da6);}})[_0x2190('0x25')](function(_0x556f5b){if(_0x556f5b){return _0x556f5b?{'count':_0x38a6a2,'rows':_0x556f5b}:null;}})[_0x2190('0x25')](respondWithResult(_0x3f5dab,null))['catch'](handleError(_0x3f5dab,null));};exports[_0x2190('0x4f')]=function(_0x57c953,_0x381b1f,_0x37cc39){var _0x51da27={};var _0x114e06={};var _0xbc422a;var _0x3906d0;return db[_0x2190('0x2b')][_0x2190('0x50')]({'where':{'id':_0x57c953['params']['id']}})['then'](handleEntityNotFound(_0x381b1f,null))[_0x2190('0x25')](function(_0xd91a56){if(_0xd91a56){_0xbc422a=_0xd91a56;_0x114e06['model']=_[_0x2190('0x45')](db['ZendeskField'][_0x2190('0x2c')]);_0x114e06[_0x2190('0x30')]=_[_0x2190('0x45')](_0x57c953[_0x2190('0x30')]);_0x114e06['filters']=_[_0x2190('0x4b')](_0x114e06['model'],_0x114e06[_0x2190('0x30')]);_0x51da27[_0x2190('0x32')]=_[_0x2190('0x4b')](_0x114e06[_0x2190('0x2e')],qs[_0x2190('0x33')](_0x57c953[_0x2190('0x30')][_0x2190('0x33')]));_0x51da27[_0x2190('0x32')]=_0x51da27[_0x2190('0x32')][_0x2190('0x4c')]?_0x51da27[_0x2190('0x32')]:_0x114e06[_0x2190('0x2e')];_0x51da27[_0x2190('0x35')]=qs['sort'](_0x57c953[_0x2190('0x30')]['sort']);_0x51da27[_0x2190('0x3a')]=qs[_0x2190('0x31')](_['pick'](_0x57c953[_0x2190('0x30')],_0x114e06['filters']));if(_0x57c953[_0x2190('0x30')][_0x2190('0x38')]){_0x51da27[_0x2190('0x3a')]=_['merge'](_0x51da27['where'],{'$or':_[_0x2190('0x2f')](_0x51da27[_0x2190('0x32')],function(_0x4290ca){var _0xa51279={};_0xa51279[_0x4290ca]={'$like':'%'+_0x57c953[_0x2190('0x30')][_0x2190('0x38')]+'%'};return _0xa51279;})});}_0x51da27=_[_0x2190('0x39')]({},_0x51da27,_0x57c953[_0x2190('0x3d')]);return _0xbc422a[_0x2190('0x4f')](_0x51da27);}})[_0x2190('0x25')](function(_0x50ff3e){if(_0x50ff3e){_0x3906d0=_0x50ff3e['length'];if(!_0x57c953[_0x2190('0x30')]['hasOwnProperty'](_0x2190('0x4d'))){_0x51da27[_0x2190('0x1e')]=qs['limit'](_0x57c953['query'][_0x2190('0x1e')]);_0x51da27['offset']=qs[_0x2190('0x1c')](_0x57c953[_0x2190('0x30')][_0x2190('0x1c')]);}return _0xbc422a[_0x2190('0x4f')](_0x51da27);}})['then'](function(_0x434e89){if(_0x434e89){return _0x434e89?{'count':_0x3906d0,'rows':_0x434e89}:null;}})[_0x2190('0x25')](respondWithResult(_0x381b1f,null))[_0x2190('0x42')](handleError(_0x381b1f,null));};exports[_0x2190('0x51')]=function(_0x1f684f,_0x1b230d,_0x33920a){var _0x11582a={};var _0x3fa271={};var _0x527066;var _0x59cca3;return db['ZendeskConfiguration'][_0x2190('0x50')]({'where':{'id':_0x1f684f[_0x2190('0x44')]['id']}})[_0x2190('0x25')](handleEntityNotFound(_0x1b230d,null))[_0x2190('0x25')](function(_0x48a9cb){if(_0x48a9cb){_0x527066=_0x48a9cb;_0x3fa271[_0x2190('0x2e')]=_[_0x2190('0x45')](db[_0x2190('0x52')][_0x2190('0x2c')]);_0x3fa271['query']=_[_0x2190('0x45')](_0x1f684f[_0x2190('0x30')]);_0x3fa271[_0x2190('0x31')]=_[_0x2190('0x4b')](_0x3fa271['model'],_0x3fa271[_0x2190('0x30')]);_0x11582a[_0x2190('0x32')]=_['intersection'](_0x3fa271[_0x2190('0x2e')],qs[_0x2190('0x33')](_0x1f684f['query'][_0x2190('0x33')]));_0x11582a[_0x2190('0x32')]=_0x11582a[_0x2190('0x32')][_0x2190('0x4c')]?_0x11582a[_0x2190('0x32')]:_0x3fa271[_0x2190('0x2e')];_0x11582a[_0x2190('0x35')]=qs[_0x2190('0x36')](_0x1f684f[_0x2190('0x30')][_0x2190('0x36')]);_0x11582a[_0x2190('0x3a')]=qs['filters'](_[_0x2190('0x37')](_0x1f684f[_0x2190('0x30')],_0x3fa271[_0x2190('0x31')]));if(_0x1f684f[_0x2190('0x30')][_0x2190('0x38')]){_0x11582a[_0x2190('0x3a')]=_[_0x2190('0x39')](_0x11582a[_0x2190('0x3a')],{'$or':_[_0x2190('0x2f')](_0x11582a[_0x2190('0x32')],function(_0x45ece3){var _0x3e8ce4={};_0x3e8ce4[_0x45ece3]={'$like':'%'+_0x1f684f[_0x2190('0x30')]['filter']+'%'};return _0x3e8ce4;})});}_0x11582a=_[_0x2190('0x39')]({},_0x11582a,_0x1f684f[_0x2190('0x3d')]);return _0x527066['getTags'](_0x11582a);}})[_0x2190('0x25')](function(_0x720c07){if(_0x720c07){_0x59cca3=_0x720c07['length'];if(!_0x1f684f[_0x2190('0x30')][_0x2190('0x34')](_0x2190('0x4d'))){_0x11582a[_0x2190('0x1e')]=qs[_0x2190('0x1e')](_0x1f684f[_0x2190('0x30')][_0x2190('0x1e')]);_0x11582a[_0x2190('0x1c')]=qs['offset'](_0x1f684f[_0x2190('0x30')]['offset']);}return _0x527066['getTags'](_0x11582a);}})[_0x2190('0x25')](function(_0x3fc3c6){if(_0x3fc3c6){return _0x3fc3c6?{'count':_0x59cca3,'rows':_0x3fc3c6}:null;}})[_0x2190('0x25')](respondWithResult(_0x1b230d,null))[_0x2190('0x42')](handleError(_0x1b230d,null));};exports['setTags']=function(_0x5323d3,_0x3aef16,_0x114da8){if(_0x5323d3[_0x2190('0x48')]['id']){delete _0x5323d3[_0x2190('0x48')]['id'];}return db[_0x2190('0x2b')]['findOne']({'where':{'id':_0x5323d3[_0x2190('0x44')]['id']}})[_0x2190('0x25')](handleEntityNotFound(_0x3aef16,null))['then'](function(_0x2d2a04){if(_0x2d2a04){return _0x2d2a04[_0x2190('0x53')](_0x5323d3[_0x2190('0x48')]['ids']||[]);}return null;})[_0x2190('0x25')](respondWithResult(_0x3aef16,null))[_0x2190('0x42')](handleError(_0x3aef16,null));}; \ No newline at end of file +var _0xfec8=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','ZendeskConfiguration','create','body','catch','find','getFields','ZendeskField','order','pick','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service'];(function(_0x5559f8,_0x156269){var _0x581e39=function(_0x3bb84b){while(--_0x3bb84b){_0x5559f8['push'](_0x5559f8['shift']());}};_0x581e39(++_0x156269);}(_0xfec8,0x1ec));var _0x8fec=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0xfec8[_0x35b18a];return _0x4db1bd;};'use strict';var emlformat=require(_0x8fec('0x0'));var rimraf=require(_0x8fec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8fec('0x2'));var moment=require(_0x8fec('0x3'));var BPromise=require(_0x8fec('0x4'));var Mustache=require('mustache');var util=require(_0x8fec('0x5'));var path=require(_0x8fec('0x6'));var sox=require(_0x8fec('0x7'));var csv=require('to-csv');var ejs=require(_0x8fec('0x8'));var fs=require('fs');var fs_extra=require(_0x8fec('0x9'));var _=require(_0x8fec('0xa'));var squel=require('squel');var crypto=require(_0x8fec('0xb'));var jsforce=require(_0x8fec('0xc'));var deskjs=require(_0x8fec('0xd'));var toCsv=require(_0x8fec('0xe'));var querystring=require(_0x8fec('0xf'));var Papa=require(_0x8fec('0x10'));var Redis=require('ioredis');var authService=require(_0x8fec('0x11'));var qs=require(_0x8fec('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8fec('0x13'));var logger=require(_0x8fec('0x14'))(_0x8fec('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8fec('0x16'));var db=require(_0x8fec('0x17'))['db'];function respondWithStatusCode(_0x562369,_0x329fe3){_0x329fe3=_0x329fe3||0xcc;return function(_0xa46fe){if(_0xa46fe){return _0x562369['sendStatus'](_0x329fe3);}return _0x562369['status'](_0x329fe3)['end']();};}function respondWithResult(_0x33b164,_0x150949){_0x150949=_0x150949||0xc8;return function(_0xf1837d){if(_0xf1837d){return _0x33b164[_0x8fec('0x18')](_0x150949)['json'](_0xf1837d);}};}function respondWithFilteredResult(_0x276c00,_0x3282e0){return function(_0x375839){if(_0x375839){var _0x10fd6d=typeof _0x3282e0[_0x8fec('0x19')]===_0x8fec('0x1a')&&typeof _0x3282e0[_0x8fec('0x1b')]===_0x8fec('0x1a');var _0x4d243e=_0x375839[_0x8fec('0x1c')];var _0x13bb72=_0x10fd6d?0x0:_0x3282e0[_0x8fec('0x19')];var _0x2b9672=_0x10fd6d?_0x375839[_0x8fec('0x1c')]:_0x3282e0[_0x8fec('0x19')]+_0x3282e0[_0x8fec('0x1b')];var _0x45c2bb;if(_0x2b9672>=_0x4d243e){_0x2b9672=_0x4d243e;_0x45c2bb=0xc8;}else{_0x45c2bb=0xce;}_0x276c00['status'](_0x45c2bb);return _0x276c00['set'](_0x8fec('0x1d'),_0x13bb72+'-'+_0x2b9672+'/'+_0x4d243e)[_0x8fec('0x1e')](_0x375839);}return null;};}function patchUpdates(_0x3ceb1c){return function(_0x48f38c){try{jsonpatch[_0x8fec('0x1f')](_0x48f38c,_0x3ceb1c,!![]);}catch(_0x5b9106){return BPromise[_0x8fec('0x20')](_0x5b9106);}return _0x48f38c[_0x8fec('0x21')]();};}function saveUpdates(_0x187805,_0xae10c8){return function(_0x2c8e27){if(_0x2c8e27){return _0x2c8e27[_0x8fec('0x22')](_0x187805)[_0x8fec('0x23')](function(_0x486166){return _0x486166;});}return null;};}function removeEntity(_0x3780da,_0x39b01d){return function(_0x1f50b0){if(_0x1f50b0){return _0x1f50b0[_0x8fec('0x24')]()[_0x8fec('0x23')](function(){_0x3780da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a3d3c,_0x422ddb){return function(_0x143515){if(!_0x143515){_0x2a3d3c['sendStatus'](0x194);}return _0x143515;};}function handleError(_0x33b740,_0x5a1892){_0x5a1892=_0x5a1892||0x1f4;return function(_0xcbaa44){logger[_0x8fec('0x25')](_0xcbaa44[_0x8fec('0x26')]);if(_0xcbaa44[_0x8fec('0x27')]){delete _0xcbaa44[_0x8fec('0x27')];}_0x33b740[_0x8fec('0x18')](_0x5a1892)[_0x8fec('0x28')](_0xcbaa44);};}exports[_0x8fec('0x29')]=function(_0x151680,_0x183f9f){var _0x39beae={},_0x2590ed={},_0x2c1e03={'count':0x0,'rows':[]};var _0xe6eb96=_[_0x8fec('0x2a')](db['ZendeskConfiguration'][_0x8fec('0x2b')],function(_0x3bf587){return{'name':_0x3bf587[_0x8fec('0x2c')],'type':_0x3bf587[_0x8fec('0x2d')][_0x8fec('0x2e')]};});_0x2590ed[_0x8fec('0x2f')]=_[_0x8fec('0x2a')](_0xe6eb96,_0x8fec('0x27'));_0x2590ed[_0x8fec('0x30')]=_['keys'](_0x151680[_0x8fec('0x30')]);_0x2590ed[_0x8fec('0x31')]=_['intersection'](_0x2590ed[_0x8fec('0x2f')],_0x2590ed['query']);_0x39beae['attributes']=_[_0x8fec('0x32')](_0x2590ed[_0x8fec('0x2f')],qs[_0x8fec('0x33')](_0x151680[_0x8fec('0x30')][_0x8fec('0x33')]));_0x39beae[_0x8fec('0x34')]=_0x39beae[_0x8fec('0x34')][_0x8fec('0x35')]?_0x39beae[_0x8fec('0x34')]:_0x2590ed['model'];if(!_0x151680[_0x8fec('0x30')][_0x8fec('0x36')](_0x8fec('0x37'))){_0x39beae[_0x8fec('0x1b')]=qs['limit'](_0x151680[_0x8fec('0x30')][_0x8fec('0x1b')]);_0x39beae[_0x8fec('0x19')]=qs[_0x8fec('0x19')](_0x151680[_0x8fec('0x30')][_0x8fec('0x19')]);}_0x39beae['order']=qs[_0x8fec('0x38')](_0x151680[_0x8fec('0x30')][_0x8fec('0x38')]);_0x39beae['where']=qs[_0x8fec('0x31')](_['pick'](_0x151680[_0x8fec('0x30')],_0x2590ed[_0x8fec('0x31')]),_0xe6eb96);if(_0x151680[_0x8fec('0x30')]['filter']){_0x39beae[_0x8fec('0x39')]=_['merge'](_0x39beae[_0x8fec('0x39')],{'$or':_[_0x8fec('0x2a')](_0xe6eb96,function(_0x287e9a){if(_0x287e9a['type']!==_0x8fec('0x3a')){var _0x29601a={};_0x29601a[_0x287e9a[_0x8fec('0x27')]]={'$like':'%'+_0x151680['query'][_0x8fec('0x3b')]+'%'};return _0x29601a;}})});}_0x39beae=_[_0x8fec('0x3c')]({},_0x39beae,_0x151680[_0x8fec('0x3d')]);var _0x26e903={'where':_0x39beae['where']};return db['ZendeskConfiguration'][_0x8fec('0x1c')](_0x26e903)[_0x8fec('0x23')](function(_0x163e7d){_0x2c1e03[_0x8fec('0x1c')]=_0x163e7d;if(_0x151680[_0x8fec('0x30')][_0x8fec('0x3e')]){_0x39beae[_0x8fec('0x3f')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x8fec('0x40')](_0x39beae);})[_0x8fec('0x23')](function(_0x63cd63){_0x2c1e03[_0x8fec('0x41')]=_0x63cd63;return _0x2c1e03;})['then'](respondWithFilteredResult(_0x183f9f,_0x39beae))['catch'](handleError(_0x183f9f,null));};exports[_0x8fec('0x42')]=function(_0x481eca,_0x4dffc7){var _0x47141a={'raw':![],'where':{'id':_0x481eca[_0x8fec('0x43')]['id']}},_0x1b0358={};_0x1b0358[_0x8fec('0x2f')]=_[_0x8fec('0x44')](db['ZendeskConfiguration']['rawAttributes']);_0x1b0358['query']=_[_0x8fec('0x44')](_0x481eca[_0x8fec('0x30')]);_0x1b0358[_0x8fec('0x31')]=_[_0x8fec('0x32')](_0x1b0358[_0x8fec('0x2f')],_0x1b0358[_0x8fec('0x30')]);_0x47141a[_0x8fec('0x34')]=_[_0x8fec('0x32')](_0x1b0358[_0x8fec('0x2f')],qs['fields'](_0x481eca[_0x8fec('0x30')][_0x8fec('0x33')]));_0x47141a['attributes']=_0x47141a['attributes'][_0x8fec('0x35')]?_0x47141a['attributes']:_0x1b0358[_0x8fec('0x2f')];if(_0x481eca[_0x8fec('0x30')][_0x8fec('0x3e')]){_0x47141a['include']=[{'all':!![]}];}_0x47141a=_['merge']({},_0x47141a,_0x481eca[_0x8fec('0x3d')]);return db[_0x8fec('0x45')]['find'](_0x47141a)[_0x8fec('0x23')](handleEntityNotFound(_0x4dffc7,null))['then'](respondWithResult(_0x4dffc7,null))['catch'](handleError(_0x4dffc7,null));};exports['create']=function(_0x4785a4,_0x30b589){return db[_0x8fec('0x45')][_0x8fec('0x46')](_0x4785a4[_0x8fec('0x47')],{})[_0x8fec('0x23')](respondWithResult(_0x30b589,0xc9))[_0x8fec('0x48')](handleError(_0x30b589,null));};exports['update']=function(_0x1133e1,_0x390920){if(_0x1133e1[_0x8fec('0x47')]['id']){delete _0x1133e1[_0x8fec('0x47')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x1133e1['params']['id']}})[_0x8fec('0x23')](handleEntityNotFound(_0x390920,null))[_0x8fec('0x23')](saveUpdates(_0x1133e1[_0x8fec('0x47')],null))[_0x8fec('0x23')](respondWithResult(_0x390920,null))[_0x8fec('0x48')](handleError(_0x390920,null));};exports[_0x8fec('0x24')]=function(_0x2b19f3,_0x3d5204){return db[_0x8fec('0x45')][_0x8fec('0x49')]({'where':{'id':_0x2b19f3[_0x8fec('0x43')]['id']}})['then'](handleEntityNotFound(_0x3d5204,null))[_0x8fec('0x23')](removeEntity(_0x3d5204,null))[_0x8fec('0x48')](handleError(_0x3d5204,null));};exports[_0x8fec('0x4a')]=function(_0x2a30b8,_0x466d0f,_0x2c219e){var _0x10e4b7={};var _0x50a5ab={};var _0x18ac81;var _0x598594;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x2a30b8[_0x8fec('0x43')]['id']}})[_0x8fec('0x23')](handleEntityNotFound(_0x466d0f,null))[_0x8fec('0x23')](function(_0x508356){if(_0x508356){_0x18ac81=_0x508356;_0x50a5ab[_0x8fec('0x2f')]=_[_0x8fec('0x44')](db[_0x8fec('0x4b')]['rawAttributes']);_0x50a5ab[_0x8fec('0x30')]=_[_0x8fec('0x44')](_0x2a30b8['query']);_0x50a5ab[_0x8fec('0x31')]=_[_0x8fec('0x32')](_0x50a5ab[_0x8fec('0x2f')],_0x50a5ab[_0x8fec('0x30')]);_0x10e4b7[_0x8fec('0x34')]=_[_0x8fec('0x32')](_0x50a5ab[_0x8fec('0x2f')],qs[_0x8fec('0x33')](_0x2a30b8[_0x8fec('0x30')][_0x8fec('0x33')]));_0x10e4b7['attributes']=_0x10e4b7['attributes'][_0x8fec('0x35')]?_0x10e4b7[_0x8fec('0x34')]:_0x50a5ab[_0x8fec('0x2f')];_0x10e4b7[_0x8fec('0x4c')]=qs['sort'](_0x2a30b8[_0x8fec('0x30')]['sort']);_0x10e4b7[_0x8fec('0x39')]=qs[_0x8fec('0x31')](_[_0x8fec('0x4d')](_0x2a30b8[_0x8fec('0x30')],_0x50a5ab[_0x8fec('0x31')]));if(_0x2a30b8[_0x8fec('0x30')][_0x8fec('0x3b')]){_0x10e4b7[_0x8fec('0x39')]=_[_0x8fec('0x3c')](_0x10e4b7['where'],{'$or':_[_0x8fec('0x2a')](_0x10e4b7[_0x8fec('0x34')],function(_0x2bd352){var _0x7e6f0b={};_0x7e6f0b[_0x2bd352]={'$like':'%'+_0x2a30b8['query'][_0x8fec('0x3b')]+'%'};return _0x7e6f0b;})});}_0x10e4b7=_[_0x8fec('0x3c')]({},_0x10e4b7,_0x2a30b8[_0x8fec('0x3d')]);return _0x18ac81['getFields'](_0x10e4b7);}})[_0x8fec('0x23')](function(_0x2640e1){if(_0x2640e1){_0x598594=_0x2640e1[_0x8fec('0x35')];if(!_0x2a30b8[_0x8fec('0x30')][_0x8fec('0x36')](_0x8fec('0x37'))){_0x10e4b7['limit']=qs['limit'](_0x2a30b8['query']['limit']);_0x10e4b7[_0x8fec('0x19')]=qs[_0x8fec('0x19')](_0x2a30b8[_0x8fec('0x30')][_0x8fec('0x19')]);}return _0x18ac81[_0x8fec('0x4a')](_0x10e4b7);}})[_0x8fec('0x23')](function(_0x118d49){if(_0x118d49){return _0x118d49?{'count':_0x598594,'rows':_0x118d49}:null;}})['then'](respondWithResult(_0x466d0f,null))['catch'](handleError(_0x466d0f,null));};exports[_0x8fec('0x4e')]=function(_0x408af4,_0x72897c,_0x5c4e94){var _0x2ee9ca={};var _0x3430dc={};var _0x4563ad;var _0x2fd890;return db['ZendeskConfiguration'][_0x8fec('0x4f')]({'where':{'id':_0x408af4[_0x8fec('0x43')]['id']}})[_0x8fec('0x23')](handleEntityNotFound(_0x72897c,null))[_0x8fec('0x23')](function(_0x352334){if(_0x352334){_0x4563ad=_0x352334;_0x3430dc[_0x8fec('0x2f')]=_[_0x8fec('0x44')](db['ZendeskField'][_0x8fec('0x2b')]);_0x3430dc[_0x8fec('0x30')]=_[_0x8fec('0x44')](_0x408af4[_0x8fec('0x30')]);_0x3430dc[_0x8fec('0x31')]=_[_0x8fec('0x32')](_0x3430dc[_0x8fec('0x2f')],_0x3430dc['query']);_0x2ee9ca[_0x8fec('0x34')]=_[_0x8fec('0x32')](_0x3430dc['model'],qs[_0x8fec('0x33')](_0x408af4[_0x8fec('0x30')][_0x8fec('0x33')]));_0x2ee9ca[_0x8fec('0x34')]=_0x2ee9ca[_0x8fec('0x34')][_0x8fec('0x35')]?_0x2ee9ca[_0x8fec('0x34')]:_0x3430dc[_0x8fec('0x2f')];_0x2ee9ca[_0x8fec('0x4c')]=qs[_0x8fec('0x38')](_0x408af4['query']['sort']);_0x2ee9ca[_0x8fec('0x39')]=qs[_0x8fec('0x31')](_[_0x8fec('0x4d')](_0x408af4[_0x8fec('0x30')],_0x3430dc[_0x8fec('0x31')]));if(_0x408af4[_0x8fec('0x30')][_0x8fec('0x3b')]){_0x2ee9ca[_0x8fec('0x39')]=_['merge'](_0x2ee9ca[_0x8fec('0x39')],{'$or':_[_0x8fec('0x2a')](_0x2ee9ca[_0x8fec('0x34')],function(_0x193ff3){var _0x570cfc={};_0x570cfc[_0x193ff3]={'$like':'%'+_0x408af4['query'][_0x8fec('0x3b')]+'%'};return _0x570cfc;})});}_0x2ee9ca=_[_0x8fec('0x3c')]({},_0x2ee9ca,_0x408af4[_0x8fec('0x3d')]);return _0x4563ad[_0x8fec('0x4e')](_0x2ee9ca);}})[_0x8fec('0x23')](function(_0x40d4ce){if(_0x40d4ce){_0x2fd890=_0x40d4ce[_0x8fec('0x35')];if(!_0x408af4[_0x8fec('0x30')][_0x8fec('0x36')]('nolimit')){_0x2ee9ca[_0x8fec('0x1b')]=qs[_0x8fec('0x1b')](_0x408af4['query'][_0x8fec('0x1b')]);_0x2ee9ca[_0x8fec('0x19')]=qs[_0x8fec('0x19')](_0x408af4['query'][_0x8fec('0x19')]);}return _0x4563ad[_0x8fec('0x4e')](_0x2ee9ca);}})['then'](function(_0x572584){if(_0x572584){return _0x572584?{'count':_0x2fd890,'rows':_0x572584}:null;}})[_0x8fec('0x23')](respondWithResult(_0x72897c,null))[_0x8fec('0x48')](handleError(_0x72897c,null));};exports[_0x8fec('0x50')]=function(_0x3c1a40,_0x504a6a,_0x1651fd){var _0x22729c={};var _0x505c35={};var _0x26580b;var _0x24f06c;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x3c1a40[_0x8fec('0x43')]['id']}})[_0x8fec('0x23')](handleEntityNotFound(_0x504a6a,null))['then'](function(_0x15bcb9){if(_0x15bcb9){_0x26580b=_0x15bcb9;_0x505c35[_0x8fec('0x2f')]=_[_0x8fec('0x44')](db[_0x8fec('0x4b')][_0x8fec('0x2b')]);_0x505c35[_0x8fec('0x30')]=_[_0x8fec('0x44')](_0x3c1a40['query']);_0x505c35[_0x8fec('0x31')]=_[_0x8fec('0x32')](_0x505c35[_0x8fec('0x2f')],_0x505c35['query']);_0x22729c[_0x8fec('0x34')]=_['intersection'](_0x505c35[_0x8fec('0x2f')],qs[_0x8fec('0x33')](_0x3c1a40['query'][_0x8fec('0x33')]));_0x22729c[_0x8fec('0x34')]=_0x22729c[_0x8fec('0x34')][_0x8fec('0x35')]?_0x22729c['attributes']:_0x505c35['model'];_0x22729c[_0x8fec('0x4c')]=qs[_0x8fec('0x38')](_0x3c1a40[_0x8fec('0x30')]['sort']);_0x22729c[_0x8fec('0x39')]=qs['filters'](_[_0x8fec('0x4d')](_0x3c1a40['query'],_0x505c35['filters']));if(_0x3c1a40['query'][_0x8fec('0x3b')]){_0x22729c['where']=_['merge'](_0x22729c['where'],{'$or':_[_0x8fec('0x2a')](_0x22729c['attributes'],function(_0x36d0b6){var _0x162e16={};_0x162e16[_0x36d0b6]={'$like':'%'+_0x3c1a40[_0x8fec('0x30')]['filter']+'%'};return _0x162e16;})});}_0x22729c=_[_0x8fec('0x3c')]({},_0x22729c,_0x3c1a40[_0x8fec('0x3d')]);return _0x26580b[_0x8fec('0x50')](_0x22729c);}})[_0x8fec('0x23')](function(_0x17390c){if(_0x17390c){_0x24f06c=_0x17390c[_0x8fec('0x35')];if(!_0x3c1a40[_0x8fec('0x30')][_0x8fec('0x36')](_0x8fec('0x37'))){_0x22729c[_0x8fec('0x1b')]=qs[_0x8fec('0x1b')](_0x3c1a40[_0x8fec('0x30')][_0x8fec('0x1b')]);_0x22729c['offset']=qs[_0x8fec('0x19')](_0x3c1a40['query'][_0x8fec('0x19')]);}return _0x26580b[_0x8fec('0x50')](_0x22729c);}})[_0x8fec('0x23')](function(_0xd0dc64){if(_0xd0dc64){return _0xd0dc64?{'count':_0x24f06c,'rows':_0xd0dc64}:null;}})[_0x8fec('0x23')](respondWithResult(_0x504a6a,null))[_0x8fec('0x48')](handleError(_0x504a6a,null));};exports[_0x8fec('0x51')]=function(_0xd922ee,_0x298eea,_0x52d8c0){var _0x473f7c={};var _0x4f93f8={};var _0x1b332e;var _0x50ea2a;return db[_0x8fec('0x45')][_0x8fec('0x4f')]({'where':{'id':_0xd922ee['params']['id']}})[_0x8fec('0x23')](handleEntityNotFound(_0x298eea,null))[_0x8fec('0x23')](function(_0x94e0e3){if(_0x94e0e3){_0x1b332e=_0x94e0e3;_0x4f93f8[_0x8fec('0x2f')]=_[_0x8fec('0x44')](db[_0x8fec('0x52')]['rawAttributes']);_0x4f93f8['query']=_[_0x8fec('0x44')](_0xd922ee[_0x8fec('0x30')]);_0x4f93f8[_0x8fec('0x31')]=_[_0x8fec('0x32')](_0x4f93f8[_0x8fec('0x2f')],_0x4f93f8['query']);_0x473f7c[_0x8fec('0x34')]=_[_0x8fec('0x32')](_0x4f93f8[_0x8fec('0x2f')],qs[_0x8fec('0x33')](_0xd922ee['query'][_0x8fec('0x33')]));_0x473f7c[_0x8fec('0x34')]=_0x473f7c[_0x8fec('0x34')]['length']?_0x473f7c['attributes']:_0x4f93f8['model'];_0x473f7c[_0x8fec('0x4c')]=qs['sort'](_0xd922ee[_0x8fec('0x30')][_0x8fec('0x38')]);_0x473f7c[_0x8fec('0x39')]=qs['filters'](_[_0x8fec('0x4d')](_0xd922ee['query'],_0x4f93f8[_0x8fec('0x31')]));if(_0xd922ee[_0x8fec('0x30')][_0x8fec('0x3b')]){_0x473f7c[_0x8fec('0x39')]=_[_0x8fec('0x3c')](_0x473f7c[_0x8fec('0x39')],{'$or':_[_0x8fec('0x2a')](_0x473f7c['attributes'],function(_0x5342f4){var _0xa66260={};_0xa66260[_0x5342f4]={'$like':'%'+_0xd922ee[_0x8fec('0x30')][_0x8fec('0x3b')]+'%'};return _0xa66260;})});}_0x473f7c=_[_0x8fec('0x3c')]({},_0x473f7c,_0xd922ee[_0x8fec('0x3d')]);return _0x1b332e[_0x8fec('0x51')](_0x473f7c);}})[_0x8fec('0x23')](function(_0x3703ff){if(_0x3703ff){_0x50ea2a=_0x3703ff[_0x8fec('0x35')];if(!_0xd922ee[_0x8fec('0x30')][_0x8fec('0x36')](_0x8fec('0x37'))){_0x473f7c[_0x8fec('0x1b')]=qs['limit'](_0xd922ee[_0x8fec('0x30')][_0x8fec('0x1b')]);_0x473f7c[_0x8fec('0x19')]=qs[_0x8fec('0x19')](_0xd922ee['query']['offset']);}return _0x1b332e[_0x8fec('0x51')](_0x473f7c);}})[_0x8fec('0x23')](function(_0x4810b7){if(_0x4810b7){return _0x4810b7?{'count':_0x50ea2a,'rows':_0x4810b7}:null;}})[_0x8fec('0x23')](respondWithResult(_0x298eea,null))['catch'](handleError(_0x298eea,null));};exports['setTags']=function(_0x2b5010,_0x5a8979,_0x3c93c1){if(_0x2b5010[_0x8fec('0x47')]['id']){delete _0x2b5010[_0x8fec('0x47')]['id'];}return db['ZendeskConfiguration'][_0x8fec('0x4f')]({'where':{'id':_0x2b5010[_0x8fec('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a8979,null))['then'](function(_0x469c8b){if(_0x469c8b){return _0x469c8b[_0x8fec('0x53')](_0x2b5010[_0x8fec('0x47')][_0x8fec('0x54')]||[]);}return null;})['then'](respondWithResult(_0x5a8979,null))[_0x8fec('0x48')](handleError(_0x5a8979,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index cb862b4..ee346ad 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 _0xdd4f=['exports','define','ZendeskConfiguration','lodash','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x3621df,_0x11b448){_0x3621df=_0x3621df-0x0;var _0x416581=_0xdd4f[_0x3621df];return _0x416581;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfdd4('0x1'));var BPromise=require(_0xfdd4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdd4('0x3'));var rimraf=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xfdd4('0x6')]=function(_0x43cbcf,_0x30e080){return _0x43cbcf[_0xfdd4('0x7')](_0xfdd4('0x8'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5eb8=['request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','../../config/logger','api','moment','bluebird'];(function(_0x24f6da,_0x32e1c1){var _0x424088=function(_0x281f34){while(--_0x281f34){_0x24f6da['push'](_0x24f6da['shift']());}};_0x424088(++_0x32e1c1);}(_0x5eb8,0xb0));var _0x85eb=function(_0xaf025d,_0x586d7a){_0xaf025d=_0xaf025d-0x0;var _0x1c77cb=_0x5eb8[_0xaf025d];return _0x1c77cb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x85eb('0x0'))(_0x85eb('0x1'));var moment=require(_0x85eb('0x2'));var BPromise=require(_0x85eb('0x3'));var rp=require(_0x85eb('0x4'));var fs=require('fs');var path=require(_0x85eb('0x5'));var rimraf=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var attributes=require(_0x85eb('0x8'));module[_0x85eb('0x9')]=function(_0x2bf83c,_0x1ba1d8){return _0x2bf83c['define'](_0x85eb('0xa'),attributes,{'tableName':_0x85eb('0xb'),'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 4f2ad74..9f2e585 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 _0x35ea=['ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xa7662e,_0x22304d){var _0x425053=function(_0x3e24a6){while(--_0x3e24a6){_0xa7662e['push'](_0xa7662e['shift']());}};_0x425053(++_0x22304d);}(_0x35ea,0xcc));var _0xa35e=function(_0x470170,_0x454483){_0x470170=_0x470170-0x0;var _0x2cc1cc=_0x35ea[_0x470170];return _0x2cc1cc;};'use strict';var _=require(_0xa35e('0x0'));var util=require(_0xa35e('0x1'));var moment=require(_0xa35e('0x2'));var BPromise=require(_0xa35e('0x3'));var rs=require(_0xa35e('0x4'));var fs=require('fs');var Redis=require(_0xa35e('0x5'));var db=require(_0xa35e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa35e('0x7'))(_0xa35e('0x8'));var config=require(_0xa35e('0x9'));var jayson=require(_0xa35e('0xa'));var client=jayson[_0xa35e('0xb')][_0xa35e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57a56a,_0x50e479,_0x16f8c0){return new BPromise(function(_0x338653,_0x20c112){return client[_0xa35e('0xd')](_0x57a56a,_0x16f8c0)['then'](function(_0xfe2d45){logger[_0xa35e('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x50e479,'request\x20sent');logger[_0xa35e('0xf')](_0xa35e('0x10'),_0x50e479,_0xa35e('0x11'),JSON[_0xa35e('0x12')](_0xfe2d45));if(_0xfe2d45[_0xa35e('0x13')]){if(_0xfe2d45[_0xa35e('0x13')][_0xa35e('0x14')]===0x1f4){logger[_0xa35e('0x13')](_0xa35e('0x15'),_0x50e479,_0xfe2d45[_0xa35e('0x13')][_0xa35e('0x16')]);return _0x20c112(_0xfe2d45[_0xa35e('0x13')]['message']);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x50e479,_0xfe2d45['error'][_0xa35e('0x16')]);return _0x338653(_0xfe2d45[_0xa35e('0x13')][_0xa35e('0x16')]);}else{logger[_0xa35e('0xe')](_0xa35e('0x15'),_0x50e479,_0xa35e('0x11'));_0x338653(_0xfe2d45[_0xa35e('0x17')][_0xa35e('0x16')]);}})[_0xa35e('0x18')](function(_0x5c0a2b){logger[_0xa35e('0x13')](_0xa35e('0x15'),_0x50e479,_0x5c0a2b);_0x20c112(_0x5c0a2b);});});} \ No newline at end of file +var _0x45da=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x616ee1,_0x6c3156){var _0x57827=function(_0x98d3e2){while(--_0x98d3e2){_0x616ee1['push'](_0x616ee1['shift']());}};_0x57827(++_0x6c3156);}(_0x45da,0xca));var _0xa45d=function(_0x43b01e,_0x101984){_0x43b01e=_0x43b01e-0x0;var _0xc66e26=_0x45da[_0x43b01e];return _0xc66e26;};'use strict';var _=require('lodash');var util=require(_0xa45d('0x0'));var moment=require(_0xa45d('0x1'));var BPromise=require(_0xa45d('0x2'));var rs=require(_0xa45d('0x3'));var fs=require('fs');var Redis=require(_0xa45d('0x4'));var db=require(_0xa45d('0x5'))['db'];var utils=require(_0xa45d('0x6'));var logger=require(_0xa45d('0x7'))(_0xa45d('0x8'));var config=require(_0xa45d('0x9'));var jayson=require(_0xa45d('0xa'));var client=jayson['client'][_0xa45d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdb751,_0x566f6b,_0xc16eea){return new BPromise(function(_0x54b30e,_0x12e464){return client[_0xa45d('0xc')](_0xdb751,_0xc16eea)['then'](function(_0x28ecb3){logger[_0xa45d('0xd')](_0xa45d('0xe'),_0x566f6b,_0xa45d('0xf'));logger['debug'](_0xa45d('0x10'),_0x566f6b,_0xa45d('0xf'),JSON[_0xa45d('0x11')](_0x28ecb3));if(_0x28ecb3[_0xa45d('0x12')]){if(_0x28ecb3['error'][_0xa45d('0x13')]===0x1f4){logger['error'](_0xa45d('0xe'),_0x566f6b,_0x28ecb3[_0xa45d('0x12')][_0xa45d('0x14')]);return _0x12e464(_0x28ecb3[_0xa45d('0x12')][_0xa45d('0x14')]);}logger[_0xa45d('0x12')](_0xa45d('0xe'),_0x566f6b,_0x28ecb3[_0xa45d('0x12')][_0xa45d('0x14')]);return _0x54b30e(_0x28ecb3['error']['message']);}else{logger[_0xa45d('0xd')](_0xa45d('0xe'),_0x566f6b,'request\x20sent');_0x54b30e(_0x28ecb3[_0xa45d('0x15')][_0xa45d('0x14')]);}})[_0xa45d('0x16')](function(_0x5655f6){logger[_0xa45d('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x566f6b,_0x5655f6);_0x12e464(_0x5655f6);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 70ace02..cddbfad 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 _0x1b64=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','util','connect-timeout','express'];(function(_0x55a595,_0x3ad966){var _0x46d9d0=function(_0x5bfe9e){while(--_0x5bfe9e){_0x55a595['push'](_0x55a595['shift']());}};_0x46d9d0(++_0x3ad966);}(_0x1b64,0x12e));var _0x41b6=function(_0x6439bc,_0x3612a6){_0x6439bc=_0x6439bc-0x0;var _0x22e865=_0x1b64[_0x6439bc];return _0x22e865;};'use strict';var multer=require(_0x41b6('0x0'));var util=require(_0x41b6('0x1'));var path=require('path');var timeout=require(_0x41b6('0x2'));var express=require(_0x41b6('0x3'));var router=express[_0x41b6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x41b6('0x5'));var interaction=require(_0x41b6('0x6'));var config=require(_0x41b6('0x7'));var controller=require('./intZendeskField.controller');router[_0x41b6('0x8')]('/',auth[_0x41b6('0x9')](),controller[_0x41b6('0xa')]);router['get'](_0x41b6('0xb'),auth[_0x41b6('0x9')](),controller[_0x41b6('0xc')]);router[_0x41b6('0xd')]('/',auth['isAuthenticated'](),controller[_0x41b6('0xe')]);router[_0x41b6('0xf')](_0x41b6('0xb'),auth[_0x41b6('0x9')](),controller[_0x41b6('0x10')]);router['delete'](_0x41b6('0xb'),auth['isAuthenticated'](),controller[_0x41b6('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc55d=['../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','post','create','update','delete','exports','multer','util','express','fs-extra','../../components/auth/service'];(function(_0x56db0b,_0x2ad459){var _0x5b9636=function(_0x3f9167){while(--_0x3f9167){_0x56db0b['push'](_0x56db0b['shift']());}};_0x5b9636(++_0x2ad459);}(_0xc55d,0x91));var _0xdc55=function(_0x3d233c,_0x592d00){_0x3d233c=_0x3d233c-0x0;var _0x4a0cd6=_0xc55d[_0x3d233c];return _0x4a0cd6;};'use strict';var multer=require(_0xdc55('0x0'));var util=require(_0xdc55('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdc55('0x2'));var router=express['Router']();var fs_extra=require(_0xdc55('0x3'));var auth=require(_0xdc55('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdc55('0x5'));var controller=require(_0xdc55('0x6'));router[_0xdc55('0x7')]('/',auth[_0xdc55('0x8')](),controller['index']);router['get'](_0xdc55('0x9'),auth[_0xdc55('0x8')](),controller['show']);router[_0xdc55('0xa')]('/',auth['isAuthenticated'](),controller[_0xdc55('0xb')]);router['put'](_0xdc55('0x9'),auth[_0xdc55('0x8')](),controller[_0xdc55('0xc')]);router[_0xdc55('0xd')](_0xdc55('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xdc55('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 6b5532f..5490adc 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 _0x9a43=['string','STRING','variable','BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','picklist'];(function(_0x15f754,_0x413846){var _0x35f3fe=function(_0x4bced5){while(--_0x4bced5){_0x15f754['push'](_0x15f754['shift']());}};_0x35f3fe(++_0x413846);}(_0x9a43,0x1ee));var _0x39a4=function(_0x412dd8,_0x355780){_0x412dd8=_0x412dd8-0x0;var _0x47b96=_0x9a43[_0x412dd8];return _0x47b96;};'use strict';var Sequelize=require(_0x39a4('0x0'));module[_0x39a4('0x1')]={'type':{'type':Sequelize[_0x39a4('0x2')]('string','variable',_0x39a4('0x3'),_0x39a4('0x4'),_0x39a4('0x5')),'defaultValue':_0x39a4('0x6')},'content':{'type':Sequelize[_0x39a4('0x7')]},'key':{'type':Sequelize[_0x39a4('0x7')]},'keyType':{'type':Sequelize[_0x39a4('0x2')](_0x39a4('0x6'),_0x39a4('0x8'),_0x39a4('0x3'))},'keyContent':{'type':Sequelize[_0x39a4('0x7')]},'idField':{'type':Sequelize[_0x39a4('0x7')]},'nameField':{'type':Sequelize[_0x39a4('0x7')]},'customField':{'type':Sequelize[_0x39a4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x39a4('0x7')]}}; \ No newline at end of file +var _0x784e=['sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN'];(function(_0x5b8b50,_0x387b9f){var _0x1dd959=function(_0x11979c){while(--_0x11979c){_0x5b8b50['push'](_0x5b8b50['shift']());}};_0x1dd959(++_0x387b9f);}(_0x784e,0x64));var _0xe784=function(_0x25f565,_0x79fe7c){_0x25f565=_0x25f565-0x0;var _0x2677e2=_0x784e[_0x25f565];return _0x2677e2;};'use strict';var Sequelize=require(_0xe784('0x0'));module[_0xe784('0x1')]={'type':{'type':Sequelize['ENUM'](_0xe784('0x2'),_0xe784('0x3'),_0xe784('0x4'),_0xe784('0x5'),_0xe784('0x6')),'defaultValue':_0xe784('0x2')},'content':{'type':Sequelize[_0xe784('0x7')]},'key':{'type':Sequelize[_0xe784('0x7')]},'keyType':{'type':Sequelize[_0xe784('0x8')]('string',_0xe784('0x3'),_0xe784('0x4'))},'keyContent':{'type':Sequelize[_0xe784('0x7')]},'idField':{'type':Sequelize[_0xe784('0x7')]},'nameField':{'type':Sequelize[_0xe784('0x7')]},'customField':{'type':Sequelize[_0xe784('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index f83e321..e91a784 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 _0x014b=['set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','create','find','body','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','crypto','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','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x014b,0x7a));var _0xb014=function(_0x5bf03a,_0x26d063){_0x5bf03a=_0x5bf03a-0x0;var _0x10a83e=_0x014b[_0x5bf03a];return _0x10a83e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb014('0x0'));var jsonpatch=require(_0xb014('0x1'));var rp=require(_0xb014('0x2'));var moment=require(_0xb014('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb014('0x4'));var util=require('util');var path=require('path');var sox=require(_0xb014('0x5'));var csv=require('to-csv');var ejs=require(_0xb014('0x6'));var fs=require('fs');var fs_extra=require(_0xb014('0x7'));var _=require(_0xb014('0x8'));var squel=require('squel');var crypto=require(_0xb014('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb014('0xa'));var toCsv=require(_0xb014('0xb'));var querystring=require(_0xb014('0xc'));var Papa=require(_0xb014('0xd'));var Redis=require(_0xb014('0xe'));var authService=require(_0xb014('0xf'));var qs=require(_0xb014('0x10'));var as=require(_0xb014('0x11'));var hardwareService=require(_0xb014('0x12'));var logger=require(_0xb014('0x13'))(_0xb014('0x14'));var utils=require(_0xb014('0x15'));var config=require(_0xb014('0x16'));var licenseUtil=require(_0xb014('0x17'));var db=require(_0xb014('0x18'))['db'];function respondWithStatusCode(_0xf7d31f,_0x135068){_0x135068=_0x135068||0xcc;return function(_0x165017){if(_0x165017){return _0xf7d31f['sendStatus'](_0x135068);}return _0xf7d31f[_0xb014('0x19')](_0x135068)[_0xb014('0x1a')]();};}function respondWithResult(_0x2ba3b7,_0x82880d){_0x82880d=_0x82880d||0xc8;return function(_0x3fd6db){if(_0x3fd6db){return _0x2ba3b7[_0xb014('0x19')](_0x82880d)[_0xb014('0x1b')](_0x3fd6db);}};}function respondWithFilteredResult(_0x5d6457,_0x48de1d){return function(_0x3db1da){if(_0x3db1da){var _0x52773a=typeof _0x48de1d[_0xb014('0x1c')]===_0xb014('0x1d')&&typeof _0x48de1d[_0xb014('0x1e')]===_0xb014('0x1d');var _0x36a540=_0x3db1da[_0xb014('0x1f')];var _0x484f57=_0x52773a?0x0:_0x48de1d['offset'];var _0x3022c6=_0x52773a?_0x3db1da[_0xb014('0x1f')]:_0x48de1d[_0xb014('0x1c')]+_0x48de1d['limit'];var _0x28ef19;if(_0x3022c6>=_0x36a540){_0x3022c6=_0x36a540;_0x28ef19=0xc8;}else{_0x28ef19=0xce;}_0x5d6457['status'](_0x28ef19);return _0x5d6457[_0xb014('0x20')](_0xb014('0x21'),_0x484f57+'-'+_0x3022c6+'/'+_0x36a540)[_0xb014('0x1b')](_0x3db1da);}return null;};}function patchUpdates(_0x92f046){return function(_0x265792){try{jsonpatch[_0xb014('0x22')](_0x265792,_0x92f046,!![]);}catch(_0x53e2f1){return BPromise[_0xb014('0x23')](_0x53e2f1);}return _0x265792[_0xb014('0x24')]();};}function saveUpdates(_0x273019,_0x1249b4){return function(_0x33ad51){if(_0x33ad51){return _0x33ad51[_0xb014('0x25')](_0x273019)[_0xb014('0x26')](function(_0x575d41){return _0x575d41;});}return null;};}function removeEntity(_0x388797,_0x304b7c){return function(_0x55f626){if(_0x55f626){return _0x55f626[_0xb014('0x27')]()[_0xb014('0x26')](function(){_0x388797[_0xb014('0x19')](0xcc)[_0xb014('0x1a')]();});}};}function handleEntityNotFound(_0x14396c,_0x2c72bf){return function(_0x28457b){if(!_0x28457b){_0x14396c[_0xb014('0x28')](0x194);}return _0x28457b;};}function handleError(_0x4a472d,_0x49d093){_0x49d093=_0x49d093||0x1f4;return function(_0x1fbe6a){logger[_0xb014('0x29')](_0x1fbe6a[_0xb014('0x2a')]);if(_0x1fbe6a[_0xb014('0x2b')]){delete _0x1fbe6a[_0xb014('0x2b')];}_0x4a472d[_0xb014('0x19')](_0x49d093)[_0xb014('0x2c')](_0x1fbe6a);};}exports[_0xb014('0x2d')]=function(_0x49d9ed,_0x8ffed5){var _0x2dc505={},_0x3f43d3={},_0x450c93={'count':0x0,'rows':[]};var _0x55ad43=_[_0xb014('0x2e')](db[_0xb014('0x2f')][_0xb014('0x30')],function(_0x261c9a){return{'name':_0x261c9a[_0xb014('0x31')],'type':_0x261c9a['type']['key']};});_0x3f43d3[_0xb014('0x32')]=_[_0xb014('0x2e')](_0x55ad43,_0xb014('0x2b'));_0x3f43d3[_0xb014('0x33')]=_[_0xb014('0x34')](_0x49d9ed['query']);_0x3f43d3['filters']=_[_0xb014('0x35')](_0x3f43d3[_0xb014('0x32')],_0x3f43d3[_0xb014('0x33')]);_0x2dc505[_0xb014('0x36')]=_['intersection'](_0x3f43d3[_0xb014('0x32')],qs['fields'](_0x49d9ed[_0xb014('0x33')][_0xb014('0x37')]));_0x2dc505[_0xb014('0x36')]=_0x2dc505['attributes'][_0xb014('0x38')]?_0x2dc505[_0xb014('0x36')]:_0x3f43d3[_0xb014('0x32')];if(!_0x49d9ed[_0xb014('0x33')][_0xb014('0x39')]('nolimit')){_0x2dc505[_0xb014('0x1e')]=qs['limit'](_0x49d9ed[_0xb014('0x33')][_0xb014('0x1e')]);_0x2dc505['offset']=qs[_0xb014('0x1c')](_0x49d9ed[_0xb014('0x33')]['offset']);}_0x2dc505[_0xb014('0x3a')]=qs['sort'](_0x49d9ed[_0xb014('0x33')][_0xb014('0x3b')]);_0x2dc505[_0xb014('0x3c')]=qs[_0xb014('0x3d')](_[_0xb014('0x3e')](_0x49d9ed[_0xb014('0x33')],_0x3f43d3['filters']),_0x55ad43);if(_0x49d9ed[_0xb014('0x33')]['filter']){_0x2dc505[_0xb014('0x3c')]=_[_0xb014('0x3f')](_0x2dc505[_0xb014('0x3c')],{'$or':_['map'](_0x55ad43,function(_0x21a3ac){if(_0x21a3ac[_0xb014('0x40')]!==_0xb014('0x41')){var _0x291b73={};_0x291b73[_0x21a3ac['name']]={'$like':'%'+_0x49d9ed[_0xb014('0x33')][_0xb014('0x42')]+'%'};return _0x291b73;}})});}_0x2dc505=_[_0xb014('0x3f')]({},_0x2dc505,_0x49d9ed[_0xb014('0x43')]);var _0x558265={'where':_0x2dc505[_0xb014('0x3c')]};return db[_0xb014('0x2f')][_0xb014('0x1f')](_0x558265)['then'](function(_0x57b513){_0x450c93[_0xb014('0x1f')]=_0x57b513;if(_0x49d9ed['query'][_0xb014('0x44')]){_0x2dc505[_0xb014('0x45')]=[{'all':!![]}];}return db[_0xb014('0x2f')][_0xb014('0x46')](_0x2dc505);})['then'](function(_0x507f48){_0x450c93['rows']=_0x507f48;return _0x450c93;})[_0xb014('0x26')](respondWithFilteredResult(_0x8ffed5,_0x2dc505))[_0xb014('0x47')](handleError(_0x8ffed5,null));};exports[_0xb014('0x48')]=function(_0x563a16,_0x2de42f){var _0x36da0e={'raw':!![],'where':{'id':_0x563a16[_0xb014('0x49')]['id']}},_0x201854={};_0x201854[_0xb014('0x32')]=_[_0xb014('0x34')](db[_0xb014('0x2f')][_0xb014('0x30')]);_0x201854[_0xb014('0x33')]=_[_0xb014('0x34')](_0x563a16[_0xb014('0x33')]);_0x201854[_0xb014('0x3d')]=_['intersection'](_0x201854[_0xb014('0x32')],_0x201854[_0xb014('0x33')]);_0x36da0e['attributes']=_[_0xb014('0x35')](_0x201854[_0xb014('0x32')],qs[_0xb014('0x37')](_0x563a16['query'][_0xb014('0x37')]));_0x36da0e[_0xb014('0x36')]=_0x36da0e['attributes'][_0xb014('0x38')]?_0x36da0e[_0xb014('0x36')]:_0x201854[_0xb014('0x32')];if(_0x563a16[_0xb014('0x33')]['includeAll']){_0x36da0e[_0xb014('0x45')]=[{'all':!![]}];}_0x36da0e=_[_0xb014('0x3f')]({},_0x36da0e,_0x563a16[_0xb014('0x43')]);return db[_0xb014('0x2f')]['find'](_0x36da0e)['then'](handleEntityNotFound(_0x2de42f,null))[_0xb014('0x26')](respondWithResult(_0x2de42f,null))[_0xb014('0x47')](handleError(_0x2de42f,null));};exports['create']=function(_0x33665f,_0x1b8a73){return db[_0xb014('0x2f')][_0xb014('0x4a')](_0x33665f['body'],{})[_0xb014('0x26')](respondWithResult(_0x1b8a73,0xc9))[_0xb014('0x47')](handleError(_0x1b8a73,null));};exports[_0xb014('0x25')]=function(_0x920fc9,_0x40a4c4){if(_0x920fc9['body']['id']){delete _0x920fc9['body']['id'];}return db[_0xb014('0x2f')][_0xb014('0x4b')]({'where':{'id':_0x920fc9[_0xb014('0x49')]['id']}})[_0xb014('0x26')](handleEntityNotFound(_0x40a4c4,null))[_0xb014('0x26')](saveUpdates(_0x920fc9[_0xb014('0x4c')],null))[_0xb014('0x26')](respondWithResult(_0x40a4c4,null))[_0xb014('0x47')](handleError(_0x40a4c4,null));};exports[_0xb014('0x27')]=function(_0x12a43c,_0x2f92e7){return db[_0xb014('0x2f')][_0xb014('0x4b')]({'where':{'id':_0x12a43c[_0xb014('0x49')]['id']}})['then'](handleEntityNotFound(_0x2f92e7,null))[_0xb014('0x26')](removeEntity(_0x2f92e7,null))[_0xb014('0x47')](handleError(_0x2f92e7,null));}; \ No newline at end of file +var _0x1d17=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','send','index','map','ZendeskField','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring'];(function(_0x4695ba,_0x5a7f2a){var _0x524b7d=function(_0xfc9707){while(--_0xfc9707){_0x4695ba['push'](_0x4695ba['shift']());}};_0x524b7d(++_0x5a7f2a);}(_0x1d17,0x123));var _0x71d1=function(_0x25a7b5,_0x37f6a6){_0x25a7b5=_0x25a7b5-0x0;var _0x449687=_0x1d17[_0x25a7b5];return _0x449687;};'use strict';var emlformat=require(_0x71d1('0x0'));var rimraf=require(_0x71d1('0x1'));var zipdir=require(_0x71d1('0x2'));var jsonpatch=require(_0x71d1('0x3'));var rp=require(_0x71d1('0x4'));var moment=require(_0x71d1('0x5'));var BPromise=require(_0x71d1('0x6'));var Mustache=require(_0x71d1('0x7'));var util=require(_0x71d1('0x8'));var path=require(_0x71d1('0x9'));var sox=require(_0x71d1('0xa'));var csv=require(_0x71d1('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x71d1('0xc'));var crypto=require(_0x71d1('0xd'));var jsforce=require(_0x71d1('0xe'));var deskjs=require(_0x71d1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x71d1('0x10'));var Papa=require(_0x71d1('0x11'));var Redis=require(_0x71d1('0x12'));var authService=require(_0x71d1('0x13'));var qs=require(_0x71d1('0x14'));var as=require(_0x71d1('0x15'));var hardwareService=require(_0x71d1('0x16'));var logger=require('../../config/logger')(_0x71d1('0x17'));var utils=require('../../config/utils');var config=require(_0x71d1('0x18'));var licenseUtil=require(_0x71d1('0x19'));var db=require(_0x71d1('0x1a'))['db'];function respondWithStatusCode(_0x4ba6f2,_0x371f69){_0x371f69=_0x371f69||0xcc;return function(_0x17a02f){if(_0x17a02f){return _0x4ba6f2[_0x71d1('0x1b')](_0x371f69);}return _0x4ba6f2['status'](_0x371f69)[_0x71d1('0x1c')]();};}function respondWithResult(_0x473c4d,_0x77bd91){_0x77bd91=_0x77bd91||0xc8;return function(_0x101042){if(_0x101042){return _0x473c4d[_0x71d1('0x1d')](_0x77bd91)['json'](_0x101042);}};}function respondWithFilteredResult(_0x4e18ab,_0x3d507e){return function(_0x14169e){if(_0x14169e){var _0x44ab91=typeof _0x3d507e['offset']===_0x71d1('0x1e')&&typeof _0x3d507e[_0x71d1('0x1f')]===_0x71d1('0x1e');var _0x46cc2f=_0x14169e['count'];var _0x2928b4=_0x44ab91?0x0:_0x3d507e[_0x71d1('0x20')];var _0x1b1719=_0x44ab91?_0x14169e[_0x71d1('0x21')]:_0x3d507e[_0x71d1('0x20')]+_0x3d507e['limit'];var _0x296063;if(_0x1b1719>=_0x46cc2f){_0x1b1719=_0x46cc2f;_0x296063=0xc8;}else{_0x296063=0xce;}_0x4e18ab[_0x71d1('0x1d')](_0x296063);return _0x4e18ab[_0x71d1('0x22')](_0x71d1('0x23'),_0x2928b4+'-'+_0x1b1719+'/'+_0x46cc2f)[_0x71d1('0x24')](_0x14169e);}return null;};}function patchUpdates(_0x393524){return function(_0x3a27c8){try{jsonpatch[_0x71d1('0x25')](_0x3a27c8,_0x393524,!![]);}catch(_0x569239){return BPromise[_0x71d1('0x26')](_0x569239);}return _0x3a27c8['save']();};}function saveUpdates(_0x2a4bb3,_0x5012b5){return function(_0x3c5938){if(_0x3c5938){return _0x3c5938[_0x71d1('0x27')](_0x2a4bb3)['then'](function(_0x284b69){return _0x284b69;});}return null;};}function removeEntity(_0x14cad6,_0x1c072c){return function(_0x582b45){if(_0x582b45){return _0x582b45[_0x71d1('0x28')]()[_0x71d1('0x29')](function(){_0x14cad6[_0x71d1('0x1d')](0xcc)[_0x71d1('0x1c')]();});}};}function handleEntityNotFound(_0x3efdec,_0x5c33d2){return function(_0x54dcdc){if(!_0x54dcdc){_0x3efdec['sendStatus'](0x194);}return _0x54dcdc;};}function handleError(_0x2d3568,_0x146885){_0x146885=_0x146885||0x1f4;return function(_0x1cc1ba){logger[_0x71d1('0x2a')](_0x1cc1ba[_0x71d1('0x2b')]);if(_0x1cc1ba['name']){delete _0x1cc1ba['name'];}_0x2d3568[_0x71d1('0x1d')](_0x146885)[_0x71d1('0x2c')](_0x1cc1ba);};}exports[_0x71d1('0x2d')]=function(_0x1d0607,_0x8f156b){var _0x182fca={},_0x2f3438={},_0x1312dc={'count':0x0,'rows':[]};var _0x51d016=_[_0x71d1('0x2e')](db[_0x71d1('0x2f')][_0x71d1('0x30')],function(_0x4e7e5f){return{'name':_0x4e7e5f[_0x71d1('0x31')],'type':_0x4e7e5f['type'][_0x71d1('0x32')]};});_0x2f3438['model']=_[_0x71d1('0x2e')](_0x51d016,'name');_0x2f3438['query']=_[_0x71d1('0x33')](_0x1d0607[_0x71d1('0x34')]);_0x2f3438[_0x71d1('0x35')]=_[_0x71d1('0x36')](_0x2f3438[_0x71d1('0x37')],_0x2f3438[_0x71d1('0x34')]);_0x182fca[_0x71d1('0x38')]=_['intersection'](_0x2f3438[_0x71d1('0x37')],qs[_0x71d1('0x39')](_0x1d0607[_0x71d1('0x34')]['fields']));_0x182fca[_0x71d1('0x38')]=_0x182fca['attributes'][_0x71d1('0x3a')]?_0x182fca[_0x71d1('0x38')]:_0x2f3438['model'];if(!_0x1d0607['query'][_0x71d1('0x3b')](_0x71d1('0x3c'))){_0x182fca[_0x71d1('0x1f')]=qs[_0x71d1('0x1f')](_0x1d0607['query'][_0x71d1('0x1f')]);_0x182fca[_0x71d1('0x20')]=qs[_0x71d1('0x20')](_0x1d0607[_0x71d1('0x34')][_0x71d1('0x20')]);}_0x182fca['order']=qs[_0x71d1('0x3d')](_0x1d0607['query']['sort']);_0x182fca['where']=qs[_0x71d1('0x35')](_['pick'](_0x1d0607[_0x71d1('0x34')],_0x2f3438[_0x71d1('0x35')]),_0x51d016);if(_0x1d0607[_0x71d1('0x34')]['filter']){_0x182fca[_0x71d1('0x3e')]=_[_0x71d1('0x3f')](_0x182fca[_0x71d1('0x3e')],{'$or':_[_0x71d1('0x2e')](_0x51d016,function(_0x2c440a){if(_0x2c440a['type']!==_0x71d1('0x40')){var _0x344c9a={};_0x344c9a[_0x2c440a[_0x71d1('0x41')]]={'$like':'%'+_0x1d0607[_0x71d1('0x34')]['filter']+'%'};return _0x344c9a;}})});}_0x182fca=_[_0x71d1('0x3f')]({},_0x182fca,_0x1d0607[_0x71d1('0x42')]);var _0x39e74b={'where':_0x182fca[_0x71d1('0x3e')]};return db[_0x71d1('0x2f')][_0x71d1('0x21')](_0x39e74b)['then'](function(_0x16800d){_0x1312dc[_0x71d1('0x21')]=_0x16800d;if(_0x1d0607[_0x71d1('0x34')][_0x71d1('0x43')]){_0x182fca[_0x71d1('0x44')]=[{'all':!![]}];}return db[_0x71d1('0x2f')][_0x71d1('0x45')](_0x182fca);})[_0x71d1('0x29')](function(_0x132110){_0x1312dc[_0x71d1('0x46')]=_0x132110;return _0x1312dc;})[_0x71d1('0x29')](respondWithFilteredResult(_0x8f156b,_0x182fca))[_0x71d1('0x47')](handleError(_0x8f156b,null));};exports[_0x71d1('0x48')]=function(_0x2899be,_0x53e67c){var _0x359024={'raw':!![],'where':{'id':_0x2899be[_0x71d1('0x49')]['id']}},_0x8e5aa0={};_0x8e5aa0['model']=_[_0x71d1('0x33')](db['ZendeskField']['rawAttributes']);_0x8e5aa0[_0x71d1('0x34')]=_[_0x71d1('0x33')](_0x2899be[_0x71d1('0x34')]);_0x8e5aa0['filters']=_[_0x71d1('0x36')](_0x8e5aa0['model'],_0x8e5aa0[_0x71d1('0x34')]);_0x359024[_0x71d1('0x38')]=_['intersection'](_0x8e5aa0[_0x71d1('0x37')],qs[_0x71d1('0x39')](_0x2899be[_0x71d1('0x34')][_0x71d1('0x39')]));_0x359024[_0x71d1('0x38')]=_0x359024['attributes'][_0x71d1('0x3a')]?_0x359024[_0x71d1('0x38')]:_0x8e5aa0[_0x71d1('0x37')];if(_0x2899be[_0x71d1('0x34')][_0x71d1('0x43')]){_0x359024[_0x71d1('0x44')]=[{'all':!![]}];}_0x359024=_[_0x71d1('0x3f')]({},_0x359024,_0x2899be[_0x71d1('0x42')]);return db[_0x71d1('0x2f')][_0x71d1('0x4a')](_0x359024)[_0x71d1('0x29')](handleEntityNotFound(_0x53e67c,null))[_0x71d1('0x29')](respondWithResult(_0x53e67c,null))[_0x71d1('0x47')](handleError(_0x53e67c,null));};exports[_0x71d1('0x4b')]=function(_0x5289b8,_0x21652d){return db[_0x71d1('0x2f')]['create'](_0x5289b8[_0x71d1('0x4c')],{})[_0x71d1('0x29')](respondWithResult(_0x21652d,0xc9))['catch'](handleError(_0x21652d,null));};exports[_0x71d1('0x27')]=function(_0x54f4f1,_0x374e0c){if(_0x54f4f1['body']['id']){delete _0x54f4f1[_0x71d1('0x4c')]['id'];}return db[_0x71d1('0x2f')][_0x71d1('0x4a')]({'where':{'id':_0x54f4f1[_0x71d1('0x49')]['id']}})[_0x71d1('0x29')](handleEntityNotFound(_0x374e0c,null))[_0x71d1('0x29')](saveUpdates(_0x54f4f1[_0x71d1('0x4c')],null))['then'](respondWithResult(_0x374e0c,null))[_0x71d1('0x47')](handleError(_0x374e0c,null));};exports['destroy']=function(_0x2e989f,_0x56fe11){return db[_0x71d1('0x2f')][_0x71d1('0x4a')]({'where':{'id':_0x2e989f[_0x71d1('0x49')]['id']}})['then'](handleEntityNotFound(_0x56fe11,null))['then'](removeEntity(_0x56fe11,null))[_0x71d1('0x47')](handleError(_0x56fe11,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index b0dff31..95d813e 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 _0xeb3a=['zendesk_unique_index','idField','FieldId','util','../../config/logger','api','path','rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0xeb3a,0x12e));var _0xaeb3=function(_0x28a8c5,_0x29e9b7){_0x28a8c5=_0x28a8c5-0x0;var _0x46bc7e=_0xeb3a[_0x28a8c5];return _0x46bc7e;};'use strict';var _=require('lodash');var util=require(_0xaeb3('0x0'));var logger=require(_0xaeb3('0x1'))(_0xaeb3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaeb3('0x3'));var rimraf=require(_0xaeb3('0x4'));var config=require(_0xaeb3('0x5'));var attributes=require(_0xaeb3('0x6'));module['exports']=function(_0x4fb3d1,_0x5753eb){return _0x4fb3d1[_0xaeb3('0x7')](_0xaeb3('0x8'),attributes,{'tableName':_0xaeb3('0x9'),'paranoid':![],'indexes':[{'name':_0xaeb3('0xa'),'fields':[_0xaeb3('0xb'),_0xaeb3('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7627=['request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField','zendesk_unique_index','idField','util','../../config/logger','api','moment','bluebird'];(function(_0x2bdc23,_0x20528c){var _0x5db186=function(_0x5b6504){while(--_0x5b6504){_0x2bdc23['push'](_0x2bdc23['shift']());}};_0x5db186(++_0x20528c);}(_0x7627,0x1bb));var _0x7762=function(_0x515771,_0x39fe40){_0x515771=_0x515771-0x0;var _0x4f166a=_0x7627[_0x515771];return _0x4f166a;};'use strict';var _=require('lodash');var util=require(_0x7762('0x0'));var logger=require(_0x7762('0x1'))(_0x7762('0x2'));var moment=require(_0x7762('0x3'));var BPromise=require(_0x7762('0x4'));var rp=require(_0x7762('0x5'));var fs=require('fs');var path=require(_0x7762('0x6'));var rimraf=require(_0x7762('0x7'));var config=require(_0x7762('0x8'));var attributes=require(_0x7762('0x9'));module['exports']=function(_0x1a7356,_0x546bd9){return _0x1a7356[_0x7762('0xa')](_0x7762('0xb'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x7762('0xc'),'fields':[_0x7762('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 7542ec8..7ea2657 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 _0x1abc=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','code','error','message'];(function(_0x1b07c7,_0x1d9749){var _0x49c081=function(_0x24d7ab){while(--_0x24d7ab){_0x1b07c7['push'](_0x1b07c7['shift']());}};_0x49c081(++_0x1d9749);}(_0x1abc,0x114));var _0xc1ab=function(_0x347f53,_0x34eee3){_0x347f53=_0x347f53-0x0;var _0x33ecde=_0x1abc[_0x347f53];return _0x33ecde;};'use strict';var _=require(_0xc1ab('0x0'));var util=require(_0xc1ab('0x1'));var moment=require('moment');var BPromise=require(_0xc1ab('0x2'));var rs=require(_0xc1ab('0x3'));var fs=require('fs');var Redis=require(_0xc1ab('0x4'));var db=require(_0xc1ab('0x5'))['db'];var utils=require(_0xc1ab('0x6'));var logger=require(_0xc1ab('0x7'))(_0xc1ab('0x8'));var config=require(_0xc1ab('0x9'));var jayson=require(_0xc1ab('0xa'));var client=jayson[_0xc1ab('0xb')][_0xc1ab('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b3d4f,_0x5ec257,_0x127413){return new BPromise(function(_0x1ce8f6,_0x170a02){return client[_0xc1ab('0xd')](_0x1b3d4f,_0x127413)[_0xc1ab('0xe')](function(_0x3e99f1){logger[_0xc1ab('0xf')](_0xc1ab('0x10'),_0x5ec257,_0xc1ab('0x11'));logger[_0xc1ab('0x12')](_0xc1ab('0x13'),_0x5ec257,_0xc1ab('0x11'),JSON['stringify'](_0x3e99f1));if(_0x3e99f1['error']){if(_0x3e99f1['error'][_0xc1ab('0x14')]===0x1f4){logger[_0xc1ab('0x15')]('ZendeskField,\x20%s,\x20%s',_0x5ec257,_0x3e99f1['error'][_0xc1ab('0x16')]);return _0x170a02(_0x3e99f1[_0xc1ab('0x15')]['message']);}logger[_0xc1ab('0x15')](_0xc1ab('0x10'),_0x5ec257,_0x3e99f1['error'][_0xc1ab('0x16')]);return _0x1ce8f6(_0x3e99f1['error']['message']);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x5ec257,'request\x20sent');_0x1ce8f6(_0x3e99f1['result'][_0xc1ab('0x16')]);}})['catch'](function(_0x407f34){logger[_0xc1ab('0x15')](_0xc1ab('0x10'),_0x5ec257,_0x407f34);_0x170a02(_0x407f34);});});} \ No newline at end of file +var _0x42ff=['request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x1edcca,_0x3a0c7b){var _0x1e55b1=function(_0x4d9414){while(--_0x4d9414){_0x1edcca['push'](_0x1edcca['shift']());}};_0x1e55b1(++_0x3a0c7b);}(_0x42ff,0xdd));var _0xf42f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x42ff[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xf42f('0x0'));var util=require(_0xf42f('0x1'));var moment=require(_0xf42f('0x2'));var BPromise=require('bluebird');var rs=require(_0xf42f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf42f('0x4'))['db'];var utils=require(_0xf42f('0x5'));var logger=require('../../config/logger')(_0xf42f('0x6'));var config=require(_0xf42f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf42f('0x8')][_0xf42f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59bc05,_0x5a8552,_0xd8e0bd){return new BPromise(function(_0x3749c8,_0x1e86e1){return client[_0xf42f('0xa')](_0x59bc05,_0xd8e0bd)['then'](function(_0x4dc44c){logger[_0xf42f('0xb')](_0xf42f('0xc'),_0x5a8552,_0xf42f('0xd'));logger[_0xf42f('0xe')](_0xf42f('0xf'),_0x5a8552,'request\x20sent',JSON[_0xf42f('0x10')](_0x4dc44c));if(_0x4dc44c['error']){if(_0x4dc44c[_0xf42f('0x11')][_0xf42f('0x12')]===0x1f4){logger[_0xf42f('0x11')](_0xf42f('0xc'),_0x5a8552,_0x4dc44c[_0xf42f('0x11')][_0xf42f('0x13')]);return _0x1e86e1(_0x4dc44c['error'][_0xf42f('0x13')]);}logger[_0xf42f('0x11')](_0xf42f('0xc'),_0x5a8552,_0x4dc44c['error'][_0xf42f('0x13')]);return _0x3749c8(_0x4dc44c[_0xf42f('0x11')][_0xf42f('0x13')]);}else{logger[_0xf42f('0xb')]('ZendeskField,\x20%s,\x20%s',_0x5a8552,_0xf42f('0xd'));_0x3749c8(_0x4dc44c['result']['message']);}})[_0xf42f('0x14')](function(_0x3fc166){logger[_0xf42f('0x11')](_0xf42f('0xc'),_0x5a8552,_0x3fc166);_0x1e86e1(_0x3fc166);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 4683f1e..81abfea 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 _0x87b3=['multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports'];(function(_0xa84f31,_0x261b6f){var _0x4cc842=function(_0x33a31d){while(--_0x33a31d){_0xa84f31['push'](_0xa84f31['shift']());}};_0x4cc842(++_0x261b6f);}(_0x87b3,0x180));var _0x387b=function(_0x3dbf0a,_0x54530a){_0x3dbf0a=_0x3dbf0a-0x0;var _0x4ec977=_0x87b3[_0x3dbf0a];return _0x4ec977;};'use strict';var multer=require(_0x387b('0x0'));var util=require(_0x387b('0x1'));var path=require(_0x387b('0x2'));var timeout=require('connect-timeout');var express=require(_0x387b('0x3'));var router=express['Router']();var fs_extra=require(_0x387b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x387b('0x5'));var config=require(_0x387b('0x6'));var controller=require(_0x387b('0x7'));router[_0x387b('0x8')]('/',auth[_0x387b('0x9')](),controller[_0x387b('0xa')]);router[_0x387b('0x8')](_0x387b('0xb'),auth[_0x387b('0x9')](),controller[_0x387b('0xc')]);router[_0x387b('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x387b('0xd')]);router[_0x387b('0x8')](_0x387b('0xe'),auth[_0x387b('0x9')](),controller[_0x387b('0xf')]);router[_0x387b('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x387b('0x10')](_0x387b('0x11'),auth[_0x387b('0x9')](),controller[_0x387b('0x12')]);router[_0x387b('0x13')](_0x387b('0xb'),auth['isAuthenticated'](),controller[_0x387b('0x14')]);router[_0x387b('0x15')]('/:id',auth[_0x387b('0x9')](),controller[_0x387b('0x16')]);module[_0x387b('0x17')]=router; \ No newline at end of file +var _0x63bc=['isAuthenticated','get','show','/:id/configurations','getConfigurations','post','create','addConfiguration','put','/:id','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller'];(function(_0x34fdd0,_0x237cc2){var _0x58aaa7=function(_0xdc5440){while(--_0xdc5440){_0x34fdd0['push'](_0x34fdd0['shift']());}};_0x58aaa7(++_0x237cc2);}(_0x63bc,0xc9));var _0xc63b=function(_0x2b2d0f,_0x2a0e2d){_0x2b2d0f=_0x2b2d0f-0x0;var _0x663655=_0x63bc[_0x2b2d0f];return _0x663655;};'use strict';var multer=require(_0xc63b('0x0'));var util=require(_0xc63b('0x1'));var path=require('path');var timeout=require(_0xc63b('0x2'));var express=require(_0xc63b('0x3'));var router=express[_0xc63b('0x4')]();var fs_extra=require(_0xc63b('0x5'));var auth=require(_0xc63b('0x6'));var interaction=require(_0xc63b('0x7'));var config=require('../../config/environment');var controller=require(_0xc63b('0x8'));router['get']('/',auth[_0xc63b('0x9')](),controller['index']);router[_0xc63b('0xa')]('/:id',auth[_0xc63b('0x9')](),controller[_0xc63b('0xb')]);router['get'](_0xc63b('0xc'),auth[_0xc63b('0x9')](),controller[_0xc63b('0xd')]);router['get']('/:id/fields',auth[_0xc63b('0x9')](),controller['getFields']);router[_0xc63b('0xe')]('/',auth[_0xc63b('0x9')](),controller[_0xc63b('0xf')]);router['post'](_0xc63b('0xc'),auth[_0xc63b('0x9')](),controller[_0xc63b('0x10')]);router[_0xc63b('0x11')](_0xc63b('0x12'),auth[_0xc63b('0x9')](),controller[_0xc63b('0x13')]);router['delete'](_0xc63b('0x12'),auth[_0xc63b('0x9')](),controller['destroy']);module[_0xc63b('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index c8b711a..a5a5de1 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 _0x008c=['exports','STRING','sequelize'];(function(_0x28bc24,_0x2d36ac){var _0x5e8445=function(_0x4dba80){while(--_0x4dba80){_0x28bc24['push'](_0x28bc24['shift']());}};_0x5e8445(++_0x2d36ac);}(_0x008c,0x188));var _0xc008=function(_0x22d1ef,_0x4a5152){_0x22d1ef=_0x22d1ef-0x0;var _0x47c5a3=_0x008c[_0x22d1ef];return _0x47c5a3;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'name':{'type':Sequelize[_0xc008('0x2')]},'description':{'type':Sequelize[_0xc008('0x2')]},'host':{'type':Sequelize[_0xc008('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xc008('0x2')]},'clientSecret':{'type':Sequelize[_0xc008('0x2')]},'serverUrl':{'type':Sequelize[_0xc008('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xc008('0x2')]},'refreshToken':{'type':Sequelize[_0xc008('0x2')]}}; \ No newline at end of file +var _0x70e0=['STRING','sequelize','exports'];(function(_0x4d50c8,_0x39efd0){var _0x5afb72=function(_0x22c09d){while(--_0x22c09d){_0x4d50c8['push'](_0x4d50c8['shift']());}};_0x5afb72(++_0x39efd0);}(_0x70e0,0x17b));var _0x070e=function(_0x4d3597,_0x1f86c2){_0x4d3597=_0x4d3597-0x0;var _0x2a7d6a=_0x70e0[_0x4d3597];return _0x2a7d6a;};'use strict';var Sequelize=require(_0x070e('0x0'));module[_0x070e('0x1')]={'name':{'type':Sequelize[_0x070e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x070e('0x2')]},'clientId':{'type':Sequelize[_0x070e('0x2')]},'clientSecret':{'type':Sequelize[_0x070e('0x2')]},'serverUrl':{'type':Sequelize[_0x070e('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x070e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 9fe6f7a..c4fc1bb 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 _0x8daa=['Calls','Zoho-oauthtoken\x20','response','error','message','Subject','WhoId','Call_Result','Call_Start_Time','remove','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','fast-json-patch','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','end','stack','name','index','ZohoAccount','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','include','find','catch','create','body','destroy','getConfigurations','findOne','ZohoConfiguration','rawAttributes','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','getFields','host','clientSecret','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields'];(function(_0x2e7c1b,_0x232f79){var _0x42f565=function(_0x31ee5a){while(--_0x31ee5a){_0x2e7c1b['push'](_0x2e7c1b['shift']());}};_0x42f565(++_0x232f79);}(_0x8daa,0x1ee));var _0xa8da=function(_0x37ae26,_0x2ecd70){_0x37ae26=_0x37ae26-0x0;var _0x1b1902=_0x8daa[_0x37ae26];return _0x1b1902;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa8da('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa8da('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa8da('0x2'));var path=require(_0xa8da('0x3'));var sox=require('sox');var csv=require(_0xa8da('0x4'));var ejs=require(_0xa8da('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa8da('0x6'));var squel=require(_0xa8da('0x7'));var crypto=require(_0xa8da('0x8'));var jsforce=require(_0xa8da('0x9'));var deskjs=require(_0xa8da('0xa'));var toCsv=require('to-csv');var querystring=require(_0xa8da('0xb'));var Papa=require('papaparse');var Redis=require(_0xa8da('0xc'));var authService=require(_0xa8da('0xd'));var qs=require(_0xa8da('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa8da('0xf'))(_0xa8da('0x10'));var utils=require(_0xa8da('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xa8da('0x12'));var db=require(_0xa8da('0x13'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x50d534,_0x2387ef){_0x2387ef=_0x2387ef||0xcc;return function(_0x32b57d){if(_0x32b57d){return _0x50d534[_0xa8da('0x14')](_0x2387ef);}return _0x50d534['status'](_0x2387ef)['end']();};}function respondWithResult(_0x3add56,_0x5e5e75){_0x5e5e75=_0x5e5e75||0xc8;return function(_0x4066f7){if(_0x4066f7){return _0x3add56[_0xa8da('0x15')](_0x5e5e75)[_0xa8da('0x16')](_0x4066f7);}};}function respondWithFilteredResult(_0x5f1064,_0x5eeff7){return function(_0x4f6238){if(_0x4f6238){var _0xd492b4=typeof _0x5eeff7[_0xa8da('0x17')]===_0xa8da('0x18')&&typeof _0x5eeff7[_0xa8da('0x19')]==='undefined';var _0x281eb2=_0x4f6238[_0xa8da('0x1a')];var _0x38b180=_0xd492b4?0x0:_0x5eeff7[_0xa8da('0x17')];var _0xa8d9c0=_0xd492b4?_0x4f6238[_0xa8da('0x1a')]:_0x5eeff7[_0xa8da('0x17')]+_0x5eeff7['limit'];var _0xc9d858;if(_0xa8d9c0>=_0x281eb2){_0xa8d9c0=_0x281eb2;_0xc9d858=0xc8;}else{_0xc9d858=0xce;}_0x5f1064[_0xa8da('0x15')](_0xc9d858);return _0x5f1064[_0xa8da('0x1b')]('Content-Range',_0x38b180+'-'+_0xa8d9c0+'/'+_0x281eb2)[_0xa8da('0x16')](_0x4f6238);}return null;};}function patchUpdates(_0x331f8c){return function(_0x331281){try{jsonpatch[_0xa8da('0x1c')](_0x331281,_0x331f8c,!![]);}catch(_0x5db83a){return BPromise['reject'](_0x5db83a);}return _0x331281[_0xa8da('0x1d')]();};}function saveUpdates(_0x46c601,_0x45cdf6){return function(_0x22b9e5){if(_0x22b9e5){return _0x22b9e5[_0xa8da('0x1e')](_0x46c601)[_0xa8da('0x1f')](function(_0x4b1cdf){return _0x4b1cdf;});}return null;};}function removeEntity(_0x23cb2e,_0x3a329d){return function(_0x1fc759){if(_0x1fc759){return _0x1fc759['destroy']()[_0xa8da('0x1f')](function(){_0x23cb2e[_0xa8da('0x15')](0xcc)[_0xa8da('0x20')]();});}};}function handleEntityNotFound(_0x186f93,_0x56fb48){return function(_0xe3e0a5){if(!_0xe3e0a5){_0x186f93[_0xa8da('0x14')](0x194);}return _0xe3e0a5;};}function handleError(_0x76e53a,_0x4299a7){_0x4299a7=_0x4299a7||0x1f4;return function(_0x36f07d){logger['error'](_0x36f07d[_0xa8da('0x21')]);if(_0x36f07d[_0xa8da('0x22')]){delete _0x36f07d['name'];}_0x76e53a[_0xa8da('0x15')](_0x4299a7)['send'](_0x36f07d);};}exports[_0xa8da('0x23')]=function(_0x1ffac3,_0x278cf2){var _0x1f275d={},_0x4680c5={},_0x5d727e={'count':0x0,'rows':[]};var _0x37b56c=_['map'](db[_0xa8da('0x24')]['rawAttributes'],function(_0x49ae55){return{'name':_0x49ae55[_0xa8da('0x25')],'type':_0x49ae55[_0xa8da('0x26')]['key']};});_0x4680c5[_0xa8da('0x27')]=_[_0xa8da('0x28')](_0x37b56c,'name');_0x4680c5[_0xa8da('0x29')]=_[_0xa8da('0x2a')](_0x1ffac3[_0xa8da('0x29')]);_0x4680c5[_0xa8da('0x2b')]=_[_0xa8da('0x2c')](_0x4680c5[_0xa8da('0x27')],_0x4680c5['query']);_0x1f275d['attributes']=_[_0xa8da('0x2c')](_0x4680c5[_0xa8da('0x27')],qs[_0xa8da('0x2d')](_0x1ffac3[_0xa8da('0x29')][_0xa8da('0x2d')]));_0x1f275d[_0xa8da('0x2e')]=_0x1f275d[_0xa8da('0x2e')][_0xa8da('0x2f')]?_0x1f275d['attributes']:_0x4680c5['model'];if(!_0x1ffac3['query'][_0xa8da('0x30')]('nolimit')){_0x1f275d['limit']=qs[_0xa8da('0x19')](_0x1ffac3[_0xa8da('0x29')][_0xa8da('0x19')]);_0x1f275d[_0xa8da('0x17')]=qs[_0xa8da('0x17')](_0x1ffac3[_0xa8da('0x29')]['offset']);}_0x1f275d[_0xa8da('0x31')]=qs['sort'](_0x1ffac3[_0xa8da('0x29')][_0xa8da('0x32')]);_0x1f275d[_0xa8da('0x33')]=qs[_0xa8da('0x2b')](_[_0xa8da('0x34')](_0x1ffac3[_0xa8da('0x29')],_0x4680c5[_0xa8da('0x2b')]),_0x37b56c);if(_0x1ffac3[_0xa8da('0x29')][_0xa8da('0x35')]){_0x1f275d[_0xa8da('0x33')]=_[_0xa8da('0x36')](_0x1f275d[_0xa8da('0x33')],{'$or':_[_0xa8da('0x28')](_0x37b56c,function(_0x34dc62){if(_0x34dc62[_0xa8da('0x26')]!==_0xa8da('0x37')){var _0x4228c9={};_0x4228c9[_0x34dc62['name']]={'$like':'%'+_0x1ffac3[_0xa8da('0x29')][_0xa8da('0x35')]+'%'};return _0x4228c9;}})});}_0x1f275d=_[_0xa8da('0x36')]({},_0x1f275d,_0x1ffac3[_0xa8da('0x38')]);var _0x924332={'where':_0x1f275d[_0xa8da('0x33')]};return db[_0xa8da('0x24')][_0xa8da('0x1a')](_0x924332)[_0xa8da('0x1f')](function(_0x1ca739){_0x5d727e['count']=_0x1ca739;if(_0x1ffac3['query'][_0xa8da('0x39')]){_0x1f275d['include']=[{'all':!![]}];}return db[_0xa8da('0x24')][_0xa8da('0x3a')](_0x1f275d);})['then'](function(_0x59af04){_0x5d727e['rows']=_0x59af04;return _0x5d727e;})['then'](respondWithFilteredResult(_0x278cf2,_0x1f275d))['catch'](handleError(_0x278cf2,null));};exports[_0xa8da('0x3b')]=function(_0x1785e8,_0x7f20b3){var _0x3cb755={'raw':![],'where':{'id':_0x1785e8[_0xa8da('0x3c')]['id']}},_0x190d74={};_0x190d74[_0xa8da('0x27')]=_[_0xa8da('0x2a')](db['ZohoAccount']['rawAttributes']);_0x190d74[_0xa8da('0x29')]=_[_0xa8da('0x2a')](_0x1785e8[_0xa8da('0x29')]);_0x190d74[_0xa8da('0x2b')]=_[_0xa8da('0x2c')](_0x190d74['model'],_0x190d74[_0xa8da('0x29')]);_0x3cb755['attributes']=_[_0xa8da('0x2c')](_0x190d74[_0xa8da('0x27')],qs['fields'](_0x1785e8[_0xa8da('0x29')][_0xa8da('0x2d')]));_0x3cb755[_0xa8da('0x2e')]=_0x3cb755['attributes'][_0xa8da('0x2f')]?_0x3cb755['attributes']:_0x190d74[_0xa8da('0x27')];if(_0x1785e8[_0xa8da('0x29')]['includeAll']){_0x3cb755[_0xa8da('0x3d')]=[{'all':!![]}];}_0x3cb755=_[_0xa8da('0x36')]({},_0x3cb755,_0x1785e8[_0xa8da('0x38')]);return db[_0xa8da('0x24')][_0xa8da('0x3e')](_0x3cb755)[_0xa8da('0x1f')](handleEntityNotFound(_0x7f20b3,null))[_0xa8da('0x1f')](respondWithResult(_0x7f20b3,null))[_0xa8da('0x3f')](handleError(_0x7f20b3,null));};exports[_0xa8da('0x40')]=function(_0x4f5071,_0x402fd6){return db[_0xa8da('0x24')][_0xa8da('0x40')](_0x4f5071[_0xa8da('0x41')],{})[_0xa8da('0x1f')](respondWithResult(_0x402fd6,0xc9))[_0xa8da('0x3f')](handleError(_0x402fd6,null));};exports[_0xa8da('0x1e')]=function(_0x37485e,_0x5d0589){if(_0x37485e[_0xa8da('0x41')]['id']){delete _0x37485e[_0xa8da('0x41')]['id'];}return db[_0xa8da('0x24')][_0xa8da('0x3e')]({'where':{'id':_0x37485e[_0xa8da('0x3c')]['id']}})[_0xa8da('0x1f')](handleEntityNotFound(_0x5d0589,null))[_0xa8da('0x1f')](saveUpdates(_0x37485e[_0xa8da('0x41')],null))['then'](respondWithResult(_0x5d0589,null))[_0xa8da('0x3f')](handleError(_0x5d0589,null));};exports[_0xa8da('0x42')]=function(_0x1d2d3a,_0x45b72a){return db[_0xa8da('0x24')][_0xa8da('0x3e')]({'where':{'id':_0x1d2d3a[_0xa8da('0x3c')]['id']}})['then'](handleEntityNotFound(_0x45b72a,null))['then'](removeEntity(_0x45b72a,null))[_0xa8da('0x3f')](handleError(_0x45b72a,null));};exports[_0xa8da('0x43')]=function(_0x22d36b,_0x8fd24b,_0x10301){var _0x3538f0={};var _0x203d62={};var _0x1cae1d;var _0x57196b;return db['ZohoAccount'][_0xa8da('0x44')]({'where':{'id':_0x22d36b[_0xa8da('0x3c')]['id']}})[_0xa8da('0x1f')](handleEntityNotFound(_0x8fd24b,null))['then'](function(_0x20c35c){if(_0x20c35c){_0x1cae1d=_0x20c35c;_0x203d62['model']=_[_0xa8da('0x2a')](db[_0xa8da('0x45')][_0xa8da('0x46')]);_0x203d62['query']=_['keys'](_0x22d36b[_0xa8da('0x29')]);_0x203d62[_0xa8da('0x2b')]=_[_0xa8da('0x2c')](_0x203d62[_0xa8da('0x27')],_0x203d62[_0xa8da('0x29')]);_0x3538f0[_0xa8da('0x2e')]=_[_0xa8da('0x2c')](_0x203d62[_0xa8da('0x27')],qs[_0xa8da('0x2d')](_0x22d36b[_0xa8da('0x29')][_0xa8da('0x2d')]));_0x3538f0[_0xa8da('0x2e')]=_0x3538f0[_0xa8da('0x2e')]['length']?_0x3538f0[_0xa8da('0x2e')]:_0x203d62[_0xa8da('0x27')];_0x3538f0[_0xa8da('0x31')]=qs[_0xa8da('0x32')](_0x22d36b[_0xa8da('0x29')]['sort']);_0x3538f0[_0xa8da('0x33')]=qs[_0xa8da('0x2b')](_['pick'](_0x22d36b['query'],_0x203d62[_0xa8da('0x2b')]));if(_0x22d36b['query'][_0xa8da('0x35')]){_0x3538f0[_0xa8da('0x33')]=_[_0xa8da('0x36')](_0x3538f0['where'],{'$or':_[_0xa8da('0x28')](_0x3538f0['attributes'],function(_0x311044){var _0x14ed1f={};_0x14ed1f[_0x311044]={'$like':'%'+_0x22d36b[_0xa8da('0x29')]['filter']+'%'};return _0x14ed1f;})});}_0x3538f0=_[_0xa8da('0x36')]({},_0x3538f0,_0x22d36b[_0xa8da('0x38')]);return _0x1cae1d[_0xa8da('0x43')](_0x3538f0);}})[_0xa8da('0x1f')](function(_0x16fd1b){if(_0x16fd1b){_0x57196b=_0x16fd1b['length'];if(!_0x22d36b[_0xa8da('0x29')][_0xa8da('0x30')](_0xa8da('0x47'))){_0x3538f0[_0xa8da('0x19')]=qs[_0xa8da('0x19')](_0x22d36b[_0xa8da('0x29')][_0xa8da('0x19')]);_0x3538f0['offset']=qs['offset'](_0x22d36b[_0xa8da('0x29')][_0xa8da('0x17')]);}return _0x1cae1d[_0xa8da('0x43')](_0x3538f0);}})[_0xa8da('0x1f')](function(_0x5f0a65){if(_0x5f0a65){return _0x5f0a65?{'count':_0x57196b,'rows':_0x5f0a65}:null;}})[_0xa8da('0x1f')](respondWithResult(_0x8fd24b,null))['catch'](handleError(_0x8fd24b,null));};exports[_0xa8da('0x48')]=function(_0x319c12,_0x5be9f2,_0x2a888d){if(_0x319c12[_0xa8da('0x41')]['id']){delete _0x319c12[_0xa8da('0x41')]['id'];}return db[_0xa8da('0x24')][_0xa8da('0x44')]({'where':{'id':_0x319c12[_0xa8da('0x3c')]['id']}})[_0xa8da('0x1f')](handleEntityNotFound(_0x5be9f2,null))['then'](function(_0x479fc5){if(_0x479fc5){_0x319c12[_0xa8da('0x41')][_0xa8da('0x49')]=_0x479fc5['id'];_0x319c12['body'][_0xa8da('0x4a')]=integrations[_0xa8da('0x4b')](_0x319c12[_0xa8da('0x41')][_0xa8da('0x4c')],_0x319c12[_0xa8da('0x41')][_0xa8da('0x26')]);_0x319c12['body']['Descriptions']=integrations['getDescriptions'](_0x319c12[_0xa8da('0x41')][_0xa8da('0x4c')],_0x319c12[_0xa8da('0x41')][_0xa8da('0x26')]);return db[_0xa8da('0x45')]['create'](_0x319c12[_0xa8da('0x41')],{'include':[{'model':db[_0xa8da('0x4d')],'as':_0xa8da('0x4a')},{'model':db[_0xa8da('0x4d')],'as':_0xa8da('0x4e')}]});}return null;})['then'](respondWithResult(_0x5be9f2,null))['catch'](handleError(_0x5be9f2,null));};function getAccessToken(_0x5af686){return new Promise(function(_0x3f604b,_0x445d22){var _0x21378a;switch(_0x5af686[_0xa8da('0x4f')]){case'US':_0x21378a=_0xa8da('0x50');break;case'AU':_0x21378a=_0xa8da('0x51');break;case'EU':_0x21378a='https://accounts.zoho.eu';break;case'IN':_0x21378a='https://accounts.zoho.in';break;case'CN':_0x21378a='https://accounts.zoho.com.cn';break;default:_0x21378a=_0xa8da('0x52');break;}var _0x193fa2={'method':'POST','uri':_0x21378a+_0xa8da('0x53'),'qs':{'refresh_token':_0x5af686[_0xa8da('0x54')],'client_id':_0x5af686[_0xa8da('0x55')],'client_secret':_0x5af686['clientSecret'],'grant_type':_0xa8da('0x56')},'json':!![]};return rp(_0x193fa2)[_0xa8da('0x1f')](function(_0x26cb43){if(_0x26cb43[_0xa8da('0x57')]){_0x3f604b(_0x26cb43[_0xa8da('0x57')]);}else{_0x445d22('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xa8da('0x3f')](function(_0x4d450e){_0x445d22(_0x4d450e);});});}exports[_0xa8da('0x58')]=function(_0x437721,_0x634755,_0x2077b3){var _0x30d30e,_0x8a1a00,_0x67160b,_0x479332,_0x4bd82f;return db[_0xa8da('0x24')][_0xa8da('0x44')]({'where':{'id':_0x437721[_0xa8da('0x3c')]['id']},'attributes':['id',_0xa8da('0x59'),'zone',_0xa8da('0x55'),_0xa8da('0x5a'),_0xa8da('0x5b'),_0xa8da('0x5c'),_0xa8da('0x54')]})[_0xa8da('0x1f')](handleEntityNotFound(_0x634755,null))[_0xa8da('0x1f')](function(_0x1b064f){_0x4bd82f=_0x1b064f;_0x30d30e=_0x4bd82f[_0xa8da('0x59')];_0x8a1a00=_0x30d30e===_0xa8da('0x5d')?'eu':_0xa8da('0x5e');_0x67160b=_0x4bd82f[_0xa8da('0x5b')];var _0x4ec045=_0x67160b[_0xa8da('0x5f')](-0x1);if(_0x4ec045==='/'||_0x4ec045==='\x5c'||_0x4ec045===':'){_0x67160b=_0x67160b[_0xa8da('0x60')](0x0,_0x67160b[_0xa8da('0x61')](_0x4ec045));}if(!_0x4bd82f[_0xa8da('0x54')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x4bd82f);})['then'](function(_0x36899a){if(_0x36899a){return rp({'method':_0xa8da('0x62'),'uri':util[_0xa8da('0x63')](_0xa8da('0x64'),_0x8a1a00),'qs':{'module':_0xa8da('0x65')},'headers':{'Authorization':_0xa8da('0x66')+_0x36899a},'json':!![]});}})[_0xa8da('0x1f')](function(_0x3ae2fa){if(_0x3ae2fa){if(_0x3ae2fa[_0xa8da('0x67')]&&_0x3ae2fa[_0xa8da('0x67')][_0xa8da('0x68')]){throw new Error(_0x3ae2fa[_0xa8da('0x67')][_0xa8da('0x68')][_0xa8da('0x69')]);}var _0x29af79=[];var _0x17e38b=[];var _0x3a412a=['Owner',_0xa8da('0x6a'),'Description',_0xa8da('0x6b'),'Call_Duration',_0xa8da('0x6c'),_0xa8da('0x6d'),'Call_Type'];_0x17e38b=_[_0xa8da('0x6e')](_0x3ae2fa[_0xa8da('0x2d')],function(_0x1a62a6){return _0x3a412a['includes'](_0x1a62a6['api_name']);});for(var _0x18d165=0x0;_0x18d165<_0x17e38b[_0xa8da('0x2f')];_0x18d165++){if(_0x17e38b[_0x18d165]['system_mandatory']===![]){_0x29af79['push']({'id':_0x17e38b[_0x18d165]['id'],'name':_0x17e38b[_0x18d165][_0xa8da('0x6f')],'custom':_0x17e38b[_0x18d165][_0xa8da('0x70')],'options':_0x17e38b[_0x18d165][_0xa8da('0x71')]===_0xa8da('0x72')&&_0x17e38b[_0x18d165][_0xa8da('0x73')]['length']>-0x1?_[_0xa8da('0x28')](_0x17e38b[_0x18d165][_0xa8da('0x73')],function(_0x3f1a52){return{'name':_0x3f1a52,'value':_0x3f1a52};}):[]});}}return{'count':_0x29af79['length'],'rows':_0x29af79};}else{return{'count':0x0,'rows':[]};}})[_0xa8da('0x1f')](respondWithResult(_0x634755,null))[_0xa8da('0x3f')](function(_0x57a3bf){var _0x3d7617=_0x437721[_0xa8da('0x29')]['test']?0x1f4:_0x57a3bf[_0xa8da('0x74')]||0x1f4;logger['error'](_0xa8da('0x75'),_0xa8da('0x58'),_0x3d7617,JSON[_0xa8da('0x76')](_0x57a3bf));delete _0x57a3bf['name'];if(_0x3d7617===0x191){_0x3d7617=0x190;}_0x634755[_0xa8da('0x15')](_0x3d7617)['send'](_0x437721[_0xa8da('0x29')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x57a3bf[_0xa8da('0x74')]}:_0x57a3bf);});}; \ No newline at end of file +var _0x7b8b=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','limit','count','set','Content-Range','json','save','destroy','then','end','error','stack','name','send','index','ZohoAccount','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','intersection','length','includeAll','find','create','body','update','findOne','ZohoConfiguration','getConfigurations','AccountId','Subjects','getSubjects','channel','getDescriptions','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','clientId','clientSecret','refresh_token','access_token','getFields','host','code','refreshToken','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Subject','Description','WhoId','Call_Duration','Call_Type','remove','includes','api_name','system_mandatory','display_label','custom_field','picklist','map','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x31c7a6,_0x242b12){var _0x189ee1=function(_0x20a242){while(--_0x20a242){_0x31c7a6['push'](_0x31c7a6['shift']());}};_0x189ee1(++_0x242b12);}(_0x7b8b,0xf3));var _0xb7b8=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0x7b8b[_0x162780];return _0x1ea2dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb7b8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7b8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb7b8('0x2'));var Mustache=require(_0xb7b8('0x3'));var util=require(_0xb7b8('0x4'));var path=require('path');var sox=require(_0xb7b8('0x5'));var csv=require(_0xb7b8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb7b8('0x7'));var squel=require(_0xb7b8('0x8'));var crypto=require(_0xb7b8('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb7b8('0x6'));var querystring=require(_0xb7b8('0xa'));var Papa=require(_0xb7b8('0xb'));var Redis=require(_0xb7b8('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xb7b8('0xd'));var as=require(_0xb7b8('0xe'));var hardwareService=require(_0xb7b8('0xf'));var logger=require(_0xb7b8('0x10'))(_0xb7b8('0x11'));var utils=require(_0xb7b8('0x12'));var config=require(_0xb7b8('0x13'));var licenseUtil=require(_0xb7b8('0x14'));var db=require(_0xb7b8('0x15'))['db'];var integrations=require(_0xb7b8('0x16'));function respondWithStatusCode(_0x30c8fb,_0x1be0e3){_0x1be0e3=_0x1be0e3||0xcc;return function(_0x28b532){if(_0x28b532){return _0x30c8fb[_0xb7b8('0x17')](_0x1be0e3);}return _0x30c8fb['status'](_0x1be0e3)['end']();};}function respondWithResult(_0x243c85,_0x989058){_0x989058=_0x989058||0xc8;return function(_0x33a56a){if(_0x33a56a){return _0x243c85[_0xb7b8('0x18')](_0x989058)['json'](_0x33a56a);}};}function respondWithFilteredResult(_0x25dd25,_0x278525){return function(_0x35ecd2){if(_0x35ecd2){var _0x336ad0=typeof _0x278525[_0xb7b8('0x19')]==='undefined'&&typeof _0x278525[_0xb7b8('0x1a')]==='undefined';var _0x33e25d=_0x35ecd2['count'];var _0x25239b=_0x336ad0?0x0:_0x278525['offset'];var _0x17c2ea=_0x336ad0?_0x35ecd2[_0xb7b8('0x1b')]:_0x278525[_0xb7b8('0x19')]+_0x278525[_0xb7b8('0x1a')];var _0x116f59;if(_0x17c2ea>=_0x33e25d){_0x17c2ea=_0x33e25d;_0x116f59=0xc8;}else{_0x116f59=0xce;}_0x25dd25[_0xb7b8('0x18')](_0x116f59);return _0x25dd25[_0xb7b8('0x1c')](_0xb7b8('0x1d'),_0x25239b+'-'+_0x17c2ea+'/'+_0x33e25d)[_0xb7b8('0x1e')](_0x35ecd2);}return null;};}function patchUpdates(_0x2bd737){return function(_0x1ad956){try{jsonpatch['apply'](_0x1ad956,_0x2bd737,!![]);}catch(_0x30742f){return BPromise['reject'](_0x30742f);}return _0x1ad956[_0xb7b8('0x1f')]();};}function saveUpdates(_0x4fbc84,_0x340b89){return function(_0x24aeac){if(_0x24aeac){return _0x24aeac['update'](_0x4fbc84)['then'](function(_0x10633b){return _0x10633b;});}return null;};}function removeEntity(_0x2793b8,_0x332abc){return function(_0x3dc3e3){if(_0x3dc3e3){return _0x3dc3e3[_0xb7b8('0x20')]()[_0xb7b8('0x21')](function(){_0x2793b8['status'](0xcc)[_0xb7b8('0x22')]();});}};}function handleEntityNotFound(_0x13b5e8,_0x26a786){return function(_0x3309a3){if(!_0x3309a3){_0x13b5e8[_0xb7b8('0x17')](0x194);}return _0x3309a3;};}function handleError(_0x340e9c,_0x22cbd7){_0x22cbd7=_0x22cbd7||0x1f4;return function(_0x3bde98){logger[_0xb7b8('0x23')](_0x3bde98[_0xb7b8('0x24')]);if(_0x3bde98[_0xb7b8('0x25')]){delete _0x3bde98[_0xb7b8('0x25')];}_0x340e9c['status'](_0x22cbd7)[_0xb7b8('0x26')](_0x3bde98);};}exports[_0xb7b8('0x27')]=function(_0x14a664,_0x11b25d){var _0x1492ca={},_0x47495e={},_0x41ac0e={'count':0x0,'rows':[]};var _0x3cafa4=_['map'](db[_0xb7b8('0x28')][_0xb7b8('0x29')],function(_0x5916ec){return{'name':_0x5916ec[_0xb7b8('0x2a')],'type':_0x5916ec[_0xb7b8('0x2b')]['key']};});_0x47495e[_0xb7b8('0x2c')]=_['map'](_0x3cafa4,_0xb7b8('0x25'));_0x47495e['query']=_[_0xb7b8('0x2d')](_0x14a664[_0xb7b8('0x2e')]);_0x47495e[_0xb7b8('0x2f')]=_['intersection'](_0x47495e[_0xb7b8('0x2c')],_0x47495e['query']);_0x1492ca[_0xb7b8('0x30')]=_['intersection'](_0x47495e['model'],qs[_0xb7b8('0x31')](_0x14a664[_0xb7b8('0x2e')][_0xb7b8('0x31')]));_0x1492ca[_0xb7b8('0x30')]=_0x1492ca[_0xb7b8('0x30')]['length']?_0x1492ca[_0xb7b8('0x30')]:_0x47495e[_0xb7b8('0x2c')];if(!_0x14a664[_0xb7b8('0x2e')][_0xb7b8('0x32')](_0xb7b8('0x33'))){_0x1492ca[_0xb7b8('0x1a')]=qs[_0xb7b8('0x1a')](_0x14a664[_0xb7b8('0x2e')][_0xb7b8('0x1a')]);_0x1492ca[_0xb7b8('0x19')]=qs['offset'](_0x14a664[_0xb7b8('0x2e')][_0xb7b8('0x19')]);}_0x1492ca[_0xb7b8('0x34')]=qs[_0xb7b8('0x35')](_0x14a664['query'][_0xb7b8('0x35')]);_0x1492ca[_0xb7b8('0x36')]=qs['filters'](_[_0xb7b8('0x37')](_0x14a664[_0xb7b8('0x2e')],_0x47495e['filters']),_0x3cafa4);if(_0x14a664[_0xb7b8('0x2e')][_0xb7b8('0x38')]){_0x1492ca[_0xb7b8('0x36')]=_[_0xb7b8('0x39')](_0x1492ca[_0xb7b8('0x36')],{'$or':_['map'](_0x3cafa4,function(_0x567674){if(_0x567674[_0xb7b8('0x2b')]!==_0xb7b8('0x3a')){var _0x288c94={};_0x288c94[_0x567674[_0xb7b8('0x25')]]={'$like':'%'+_0x14a664[_0xb7b8('0x2e')][_0xb7b8('0x38')]+'%'};return _0x288c94;}})});}_0x1492ca=_['merge']({},_0x1492ca,_0x14a664[_0xb7b8('0x3b')]);var _0x4191f6={'where':_0x1492ca[_0xb7b8('0x36')]};return db['ZohoAccount']['count'](_0x4191f6)[_0xb7b8('0x21')](function(_0x3d99d7){_0x41ac0e[_0xb7b8('0x1b')]=_0x3d99d7;if(_0x14a664[_0xb7b8('0x2e')]['includeAll']){_0x1492ca[_0xb7b8('0x3c')]=[{'all':!![]}];}return db[_0xb7b8('0x28')][_0xb7b8('0x3d')](_0x1492ca);})[_0xb7b8('0x21')](function(_0x1c5086){_0x41ac0e[_0xb7b8('0x3e')]=_0x1c5086;return _0x41ac0e;})[_0xb7b8('0x21')](respondWithFilteredResult(_0x11b25d,_0x1492ca))[_0xb7b8('0x3f')](handleError(_0x11b25d,null));};exports['show']=function(_0x5becad,_0x7bd9d3){var _0x40eb87={'raw':![],'where':{'id':_0x5becad[_0xb7b8('0x40')]['id']}},_0xb3ba26={};_0xb3ba26['model']=_[_0xb7b8('0x2d')](db[_0xb7b8('0x28')][_0xb7b8('0x29')]);_0xb3ba26[_0xb7b8('0x2e')]=_[_0xb7b8('0x2d')](_0x5becad[_0xb7b8('0x2e')]);_0xb3ba26[_0xb7b8('0x2f')]=_['intersection'](_0xb3ba26[_0xb7b8('0x2c')],_0xb3ba26[_0xb7b8('0x2e')]);_0x40eb87[_0xb7b8('0x30')]=_[_0xb7b8('0x41')](_0xb3ba26[_0xb7b8('0x2c')],qs[_0xb7b8('0x31')](_0x5becad['query'][_0xb7b8('0x31')]));_0x40eb87[_0xb7b8('0x30')]=_0x40eb87[_0xb7b8('0x30')][_0xb7b8('0x42')]?_0x40eb87[_0xb7b8('0x30')]:_0xb3ba26[_0xb7b8('0x2c')];if(_0x5becad[_0xb7b8('0x2e')][_0xb7b8('0x43')]){_0x40eb87[_0xb7b8('0x3c')]=[{'all':!![]}];}_0x40eb87=_[_0xb7b8('0x39')]({},_0x40eb87,_0x5becad[_0xb7b8('0x3b')]);return db['ZohoAccount'][_0xb7b8('0x44')](_0x40eb87)[_0xb7b8('0x21')](handleEntityNotFound(_0x7bd9d3,null))[_0xb7b8('0x21')](respondWithResult(_0x7bd9d3,null))[_0xb7b8('0x3f')](handleError(_0x7bd9d3,null));};exports[_0xb7b8('0x45')]=function(_0x8fd4e7,_0x425ffc){return db[_0xb7b8('0x28')][_0xb7b8('0x45')](_0x8fd4e7[_0xb7b8('0x46')],{})['then'](respondWithResult(_0x425ffc,0xc9))[_0xb7b8('0x3f')](handleError(_0x425ffc,null));};exports[_0xb7b8('0x47')]=function(_0xd04ccf,_0xd75de){if(_0xd04ccf[_0xb7b8('0x46')]['id']){delete _0xd04ccf[_0xb7b8('0x46')]['id'];}return db[_0xb7b8('0x28')][_0xb7b8('0x44')]({'where':{'id':_0xd04ccf[_0xb7b8('0x40')]['id']}})['then'](handleEntityNotFound(_0xd75de,null))[_0xb7b8('0x21')](saveUpdates(_0xd04ccf[_0xb7b8('0x46')],null))[_0xb7b8('0x21')](respondWithResult(_0xd75de,null))[_0xb7b8('0x3f')](handleError(_0xd75de,null));};exports['destroy']=function(_0x7aa2fd,_0x27ccc8){return db[_0xb7b8('0x28')]['find']({'where':{'id':_0x7aa2fd[_0xb7b8('0x40')]['id']}})[_0xb7b8('0x21')](handleEntityNotFound(_0x27ccc8,null))[_0xb7b8('0x21')](removeEntity(_0x27ccc8,null))[_0xb7b8('0x3f')](handleError(_0x27ccc8,null));};exports['getConfigurations']=function(_0x113615,_0x2e879b,_0x3046b9){var _0x375f4b={};var _0x3b1233={};var _0x407e6d;var _0xbcb304;return db[_0xb7b8('0x28')][_0xb7b8('0x48')]({'where':{'id':_0x113615[_0xb7b8('0x40')]['id']}})[_0xb7b8('0x21')](handleEntityNotFound(_0x2e879b,null))[_0xb7b8('0x21')](function(_0x1f681d){if(_0x1f681d){_0x407e6d=_0x1f681d;_0x3b1233[_0xb7b8('0x2c')]=_[_0xb7b8('0x2d')](db[_0xb7b8('0x49')][_0xb7b8('0x29')]);_0x3b1233[_0xb7b8('0x2e')]=_[_0xb7b8('0x2d')](_0x113615[_0xb7b8('0x2e')]);_0x3b1233[_0xb7b8('0x2f')]=_[_0xb7b8('0x41')](_0x3b1233[_0xb7b8('0x2c')],_0x3b1233[_0xb7b8('0x2e')]);_0x375f4b['attributes']=_[_0xb7b8('0x41')](_0x3b1233[_0xb7b8('0x2c')],qs['fields'](_0x113615[_0xb7b8('0x2e')][_0xb7b8('0x31')]));_0x375f4b['attributes']=_0x375f4b['attributes'][_0xb7b8('0x42')]?_0x375f4b[_0xb7b8('0x30')]:_0x3b1233[_0xb7b8('0x2c')];_0x375f4b[_0xb7b8('0x34')]=qs[_0xb7b8('0x35')](_0x113615[_0xb7b8('0x2e')][_0xb7b8('0x35')]);_0x375f4b[_0xb7b8('0x36')]=qs[_0xb7b8('0x2f')](_[_0xb7b8('0x37')](_0x113615[_0xb7b8('0x2e')],_0x3b1233[_0xb7b8('0x2f')]));if(_0x113615[_0xb7b8('0x2e')][_0xb7b8('0x38')]){_0x375f4b[_0xb7b8('0x36')]=_[_0xb7b8('0x39')](_0x375f4b[_0xb7b8('0x36')],{'$or':_['map'](_0x375f4b[_0xb7b8('0x30')],function(_0x51242a){var _0x4037fb={};_0x4037fb[_0x51242a]={'$like':'%'+_0x113615[_0xb7b8('0x2e')][_0xb7b8('0x38')]+'%'};return _0x4037fb;})});}_0x375f4b=_['merge']({},_0x375f4b,_0x113615[_0xb7b8('0x3b')]);return _0x407e6d[_0xb7b8('0x4a')](_0x375f4b);}})[_0xb7b8('0x21')](function(_0x2edd97){if(_0x2edd97){_0xbcb304=_0x2edd97[_0xb7b8('0x42')];if(!_0x113615[_0xb7b8('0x2e')][_0xb7b8('0x32')](_0xb7b8('0x33'))){_0x375f4b[_0xb7b8('0x1a')]=qs['limit'](_0x113615[_0xb7b8('0x2e')][_0xb7b8('0x1a')]);_0x375f4b['offset']=qs['offset'](_0x113615[_0xb7b8('0x2e')][_0xb7b8('0x19')]);}return _0x407e6d[_0xb7b8('0x4a')](_0x375f4b);}})['then'](function(_0x8b8958){if(_0x8b8958){return _0x8b8958?{'count':_0xbcb304,'rows':_0x8b8958}:null;}})['then'](respondWithResult(_0x2e879b,null))[_0xb7b8('0x3f')](handleError(_0x2e879b,null));};exports['addConfiguration']=function(_0x4c0a16,_0x3854ea,_0x1f0f9){if(_0x4c0a16['body']['id']){delete _0x4c0a16[_0xb7b8('0x46')]['id'];}return db['ZohoAccount'][_0xb7b8('0x48')]({'where':{'id':_0x4c0a16[_0xb7b8('0x40')]['id']}})['then'](handleEntityNotFound(_0x3854ea,null))[_0xb7b8('0x21')](function(_0xbc9ec4){if(_0xbc9ec4){_0x4c0a16[_0xb7b8('0x46')][_0xb7b8('0x4b')]=_0xbc9ec4['id'];_0x4c0a16[_0xb7b8('0x46')][_0xb7b8('0x4c')]=integrations[_0xb7b8('0x4d')](_0x4c0a16[_0xb7b8('0x46')][_0xb7b8('0x4e')],_0x4c0a16[_0xb7b8('0x46')]['type']);_0x4c0a16[_0xb7b8('0x46')]['Descriptions']=integrations[_0xb7b8('0x4f')](_0x4c0a16[_0xb7b8('0x46')][_0xb7b8('0x4e')],_0x4c0a16[_0xb7b8('0x46')][_0xb7b8('0x2b')]);return db[_0xb7b8('0x49')][_0xb7b8('0x45')](_0x4c0a16[_0xb7b8('0x46')],{'include':[{'model':db[_0xb7b8('0x50')],'as':_0xb7b8('0x4c')},{'model':db[_0xb7b8('0x50')],'as':_0xb7b8('0x51')}]});}return null;})[_0xb7b8('0x21')](respondWithResult(_0x3854ea,null))['catch'](handleError(_0x3854ea,null));};function getAccessToken(_0x27f742){return new Promise(function(_0x5bb124,_0xe5012d){var _0x387fae;switch(_0x27f742[_0xb7b8('0x52')]){case'US':_0x387fae=_0xb7b8('0x53');break;case'AU':_0x387fae=_0xb7b8('0x54');break;case'EU':_0x387fae=_0xb7b8('0x55');break;case'IN':_0x387fae=_0xb7b8('0x56');break;case'CN':_0x387fae=_0xb7b8('0x57');break;default:_0x387fae=_0xb7b8('0x55');break;}var _0x18c5f6={'method':_0xb7b8('0x58'),'uri':_0x387fae+'/oauth/v2/token','qs':{'refresh_token':_0x27f742['refreshToken'],'client_id':_0x27f742[_0xb7b8('0x59')],'client_secret':_0x27f742[_0xb7b8('0x5a')],'grant_type':_0xb7b8('0x5b')},'json':!![]};return rp(_0x18c5f6)[_0xb7b8('0x21')](function(_0x2594d7){if(_0x2594d7[_0xb7b8('0x5c')]){_0x5bb124(_0x2594d7['access_token']);}else{_0xe5012d('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x5254ed){_0xe5012d(_0x5254ed);});});}exports[_0xb7b8('0x5d')]=function(_0x456b7d,_0x31e7af,_0x3c3d48){var _0x17a009,_0x694803,_0x2584d2,_0x240317,_0x4f036b;return db[_0xb7b8('0x28')][_0xb7b8('0x48')]({'where':{'id':_0x456b7d['params']['id']},'attributes':['id',_0xb7b8('0x5e'),_0xb7b8('0x52'),_0xb7b8('0x59'),_0xb7b8('0x5a'),'serverUrl',_0xb7b8('0x5f'),_0xb7b8('0x60')]})[_0xb7b8('0x21')](handleEntityNotFound(_0x31e7af,null))[_0xb7b8('0x21')](function(_0x3bc297){_0x4f036b=_0x3bc297;_0x17a009=_0x4f036b[_0xb7b8('0x5e')];_0x694803=_0x17a009===_0xb7b8('0x61')?'eu':_0xb7b8('0x62');_0x2584d2=_0x4f036b[_0xb7b8('0x63')];var _0x5e519b=_0x2584d2[_0xb7b8('0x64')](-0x1);if(_0x5e519b==='/'||_0x5e519b==='\x5c'||_0x5e519b===':'){_0x2584d2=_0x2584d2[_0xb7b8('0x65')](0x0,_0x2584d2[_0xb7b8('0x66')](_0x5e519b));}if(!_0x4f036b['refreshToken']){throw new Error(_0xb7b8('0x67'));}return getAccessToken(_0x4f036b);})[_0xb7b8('0x21')](function(_0x272625){if(_0x272625){return rp({'method':_0xb7b8('0x68'),'uri':util[_0xb7b8('0x69')](_0xb7b8('0x6a'),_0x694803),'qs':{'module':_0xb7b8('0x6b')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x272625},'json':!![]});}})[_0xb7b8('0x21')](function(_0x1e8ae3){if(_0x1e8ae3){if(_0x1e8ae3[_0xb7b8('0x6c')]&&_0x1e8ae3[_0xb7b8('0x6c')][_0xb7b8('0x23')]){throw new Error(_0x1e8ae3[_0xb7b8('0x6c')][_0xb7b8('0x23')][_0xb7b8('0x6d')]);}var _0x366fae=[];var _0x1822a0=[];var _0x1f9c83=['Owner',_0xb7b8('0x6e'),_0xb7b8('0x6f'),_0xb7b8('0x70'),_0xb7b8('0x71'),'Call_Result','Call_Start_Time',_0xb7b8('0x72')];_0x1822a0=_[_0xb7b8('0x73')](_0x1e8ae3[_0xb7b8('0x31')],function(_0x4821ca){return _0x1f9c83[_0xb7b8('0x74')](_0x4821ca[_0xb7b8('0x75')]);});for(var _0x28d553=0x0;_0x28d553<_0x1822a0[_0xb7b8('0x42')];_0x28d553++){if(_0x1822a0[_0x28d553][_0xb7b8('0x76')]===![]){_0x366fae['push']({'id':_0x1822a0[_0x28d553]['id'],'name':_0x1822a0[_0x28d553][_0xb7b8('0x77')],'custom':_0x1822a0[_0x28d553][_0xb7b8('0x78')],'options':_0x1822a0[_0x28d553]['data_type']===_0xb7b8('0x79')&&_0x1822a0[_0x28d553]['pick_list_values'][_0xb7b8('0x42')]>-0x1?_[_0xb7b8('0x7a')](_0x1822a0[_0x28d553][_0xb7b8('0x7b')],function(_0x1157c5){return{'name':_0x1157c5,'value':_0x1157c5};}):[]});}}return{'count':_0x366fae['length'],'rows':_0x366fae};}else{return{'count':0x0,'rows':[]};}})[_0xb7b8('0x21')](respondWithResult(_0x31e7af,null))[_0xb7b8('0x3f')](function(_0x197a42){var _0x4dca1e=_0x456b7d[_0xb7b8('0x2e')][_0xb7b8('0x7c')]?0x1f4:_0x197a42['statusCode']||0x1f4;logger[_0xb7b8('0x23')](_0xb7b8('0x7d'),_0xb7b8('0x5d'),_0x4dca1e,JSON[_0xb7b8('0x7e')](_0x197a42));delete _0x197a42[_0xb7b8('0x25')];if(_0x4dca1e===0x191){_0x4dca1e=0x190;}_0x31e7af[_0xb7b8('0x18')](_0x4dca1e)['send'](_0x456b7d[_0xb7b8('0x2e')]['test']?{'message':_0xb7b8('0x7f'),'statusCode':_0x197a42[_0xb7b8('0x80')]}:_0x197a42);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 1589adc..c290351 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 _0x71bc=['substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','parse','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','error','slice','refresh_token','refreshToken','info','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','host','serverUrl'];(function(_0x4b49c1,_0x40f2d2){var _0x3696f3=function(_0x4a733e){while(--_0x4a733e){_0x4b49c1['push'](_0x4b49c1['shift']());}};_0x3696f3(++_0x40f2d2);}(_0x71bc,0x96));var _0xc71b=function(_0x221661,_0x3be585){_0x221661=_0x221661-0x0;var _0x41bcf9=_0x71bc[_0x221661];return _0x41bcf9;};'use strict';var _=require(_0xc71b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc71b('0x1'));var moment=require(_0xc71b('0x2'));var BPromise=require(_0xc71b('0x3'));var rp=require(_0xc71b('0x4'));var fs=require('fs');var path=require(_0xc71b('0x5'));var rimraf=require(_0xc71b('0x6'));var config=require(_0xc71b('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xc71b('0x8'));module[_0xc71b('0x9')]=function(_0x311845,_0x2ffa2f){return _0x311845['define'](_0xc71b('0xa'),attributes,{'tableName':_0xc71b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2b6e08,_0x2b59da,_0x4ce0d2){if(_0x2b6e08[_0xc71b('0xc')](_0xc71b('0xd'))||_0x2b6e08['changed']('serverUrl')||_0x2b6e08[_0xc71b('0xc')](_0xc71b('0xe'))||_0x2b6e08[_0xc71b('0xc')](_0xc71b('0xf'))||_0x2b6e08['changed']('code')||_0x2b6e08[_0xc71b('0xc')](_0xc71b('0x10'))){var _0x2c97db,_0xdb5396;_0x2c97db=_0x2b6e08[_0xc71b('0x11')];var _0x16449b=_0x2c97db['slice'](-0x1);if(_0x16449b==='/'||_0x16449b==='\x5c'||_0x16449b===':'){_0x2c97db=_0x2c97db[_0xc71b('0x12')](0x0,_0x2c97db[_0xc71b('0x13')](_0x16449b));}switch(_0x2b6e08['zone']){case'US':_0xdb5396=_0xc71b('0x14');break;case'AU':_0xdb5396='https://accounts.zoho.com.au';break;case'IN':_0xdb5396=_0xc71b('0x15');break;case'CN':_0xdb5396=_0xc71b('0x16');break;default:_0xdb5396=_0xc71b('0x17');break;}var _0x57fa62={'method':_0xc71b('0x18'),'uri':_0xdb5396+_0xc71b('0x19'),'form':{'grant_type':_0xc71b('0x1a'),'client_id':_0x2b6e08[_0xc71b('0xe')],'client_secret':_0x2b6e08['clientSecret'],'redirect_uri':_0x2b6e08['serverUrl'],'code':_0x2b6e08[_0xc71b('0x1b')]},'headers':{'Content-Type':_0xc71b('0x1c')}};return rp(_0x57fa62)[_0xc71b('0x1d')](function(_0xf22530){var _0x3095cb=JSON[_0xc71b('0x1e')](_0xf22530);if(_0x3095cb['refresh_token']){_0x2b6e08['refreshToken']=_0x3095cb['refresh_token'];logger['info'](util['format'](_0xc71b('0x1f'),_0x2b6e08[_0xc71b('0x20')],_0x2b6e08['id']));}else{logger['error'](util[_0xc71b('0x21')](_0xc71b('0x22'),_0x2b6e08[_0xc71b('0x20')],_0x2b6e08['id']),util[_0xc71b('0x23')](_0x3095cb,{'showHidden':![],'depth':null}));}return _0x4ce0d2(null,_0x2b59da);})[_0xc71b('0x24')](function(_0xe64554){logger[_0xc71b('0x25')](util[_0xc71b('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2b6e08['name'],_0x2b6e08['id']),util[_0xc71b('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x4ce0d2(_0xe64554);});}else{return _0x4ce0d2(null,_0x2b59da);}},'beforeUpdate':function(_0x5c225c,_0x512849,_0x47ade0){if(_0x5c225c['changed'](_0xc71b('0xd'))||_0x5c225c[_0xc71b('0xc')]('serverUrl')||_0x5c225c[_0xc71b('0xc')](_0xc71b('0xe'))||_0x5c225c[_0xc71b('0xc')]('clientSecret')||_0x5c225c[_0xc71b('0xc')](_0xc71b('0x1b'))||_0x5c225c['changed'](_0xc71b('0x10'))){var _0x2f6457,_0x42d536;_0x2f6457=_0x5c225c['serverUrl'];var _0x26d6d3=_0x2f6457[_0xc71b('0x26')](-0x1);if(_0x26d6d3==='/'||_0x26d6d3==='\x5c'||_0x26d6d3===':'){_0x2f6457=_0x2f6457[_0xc71b('0x12')](0x0,_0x2f6457['lastIndexOf'](_0x26d6d3));}switch(_0x5c225c[_0xc71b('0xd')]){case'US':_0x42d536=_0xc71b('0x14');break;case'AU':_0x42d536='https://accounts.zoho.com.au';break;case'IN':_0x42d536=_0xc71b('0x15');break;case'CN':_0x42d536=_0xc71b('0x16');break;default:_0x42d536=_0xc71b('0x17');break;}var _0x2a03a4={'method':_0xc71b('0x18'),'uri':_0x42d536+_0xc71b('0x19'),'form':{'grant_type':_0xc71b('0x1a'),'client_id':_0x5c225c[_0xc71b('0xe')],'client_secret':_0x5c225c[_0xc71b('0xf')],'redirect_uri':_0x5c225c[_0xc71b('0x11')],'code':_0x5c225c[_0xc71b('0x1b')]},'headers':{'Content-Type':_0xc71b('0x1c')}};return rp(_0x2a03a4)[_0xc71b('0x1d')](function(_0x26b349){var _0x541ca6=JSON[_0xc71b('0x1e')](_0x26b349);if(_0x541ca6[_0xc71b('0x27')]){_0x5c225c[_0xc71b('0x28')]=_0x541ca6[_0xc71b('0x27')];logger[_0xc71b('0x29')](util[_0xc71b('0x21')](_0xc71b('0x1f'),_0x5c225c[_0xc71b('0x20')],_0x5c225c['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5c225c[_0xc71b('0x20')],_0x5c225c['id']),util['inspect'](_0x541ca6,{'showHidden':![],'depth':null}));}return _0x47ade0(null,_0x512849);})[_0xc71b('0x24')](function(_0x2f3495){logger[_0xc71b('0x25')](util[_0xc71b('0x21')](_0xc71b('0x22'),_0x5c225c[_0xc71b('0x20')],_0x5c225c['id']),util[_0xc71b('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x47ade0(_0x2f3495);});}else{return _0x47ade0(null,_0x512849);}}}});}; \ No newline at end of file +var _0x25fb=['exports','define','int_zoho_accounts','zone','changed','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','serverUrl','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','format','name','catch','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','https://accounts.zoho.com.au','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x6d394d,_0x185b80){var _0x1f0621=function(_0x2e5c81){while(--_0x2e5c81){_0x6d394d['push'](_0x6d394d['shift']());}};_0x1f0621(++_0x185b80);}(_0x25fb,0x132));var _0xb25f=function(_0x102c89,_0x3a04b8){_0x102c89=_0x102c89-0x0;var _0x5e35e6=_0x25fb[_0x102c89];return _0x5e35e6;};'use strict';var _=require('lodash');var util=require(_0xb25f('0x0'));var logger=require(_0xb25f('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb25f('0x2'));var rp=require(_0xb25f('0x3'));var fs=require('fs');var path=require(_0xb25f('0x4'));var rimraf=require(_0xb25f('0x5'));var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xb25f('0x6')]=function(_0x1d8ee4,_0x22feaa){return _0x1d8ee4[_0xb25f('0x7')]('ZohoAccount',attributes,{'tableName':_0xb25f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x814617,_0x2e7462,_0x5ba3d3){if(_0x814617['changed'](_0xb25f('0x9'))||_0x814617[_0xb25f('0xa')]('serverUrl')||_0x814617[_0xb25f('0xa')](_0xb25f('0xb'))||_0x814617[_0xb25f('0xa')](_0xb25f('0xc'))||_0x814617[_0xb25f('0xa')](_0xb25f('0xd'))||_0x814617['changed'](_0xb25f('0xe'))){var _0x13579a,_0x379144;_0x13579a=_0x814617['serverUrl'];var _0x3c760b=_0x13579a[_0xb25f('0xf')](-0x1);if(_0x3c760b==='/'||_0x3c760b==='\x5c'||_0x3c760b===':'){_0x13579a=_0x13579a[_0xb25f('0x10')](0x0,_0x13579a[_0xb25f('0x11')](_0x3c760b));}switch(_0x814617[_0xb25f('0x9')]){case'US':_0x379144=_0xb25f('0x12');break;case'AU':_0x379144='https://accounts.zoho.com.au';break;case'IN':_0x379144=_0xb25f('0x13');break;case'CN':_0x379144=_0xb25f('0x14');break;default:_0x379144=_0xb25f('0x15');break;}var _0x5c2b52={'method':_0xb25f('0x16'),'uri':_0x379144+'/oauth/v2/token','form':{'grant_type':_0xb25f('0x17'),'client_id':_0x814617[_0xb25f('0xb')],'client_secret':_0x814617[_0xb25f('0xc')],'redirect_uri':_0x814617[_0xb25f('0x18')],'code':_0x814617[_0xb25f('0xd')]},'headers':{'Content-Type':_0xb25f('0x19')}};return rp(_0x5c2b52)[_0xb25f('0x1a')](function(_0x1a4e12){var _0x20048a=JSON[_0xb25f('0x1b')](_0x1a4e12);if(_0x20048a['refresh_token']){_0x814617[_0xb25f('0x1c')]=_0x20048a[_0xb25f('0x1d')];logger['info'](util[_0xb25f('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x814617[_0xb25f('0x1f')],_0x814617['id']));}else{logger['error'](util[_0xb25f('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x814617['name'],_0x814617['id']),util['inspect'](_0x20048a,{'showHidden':![],'depth':null}));}return _0x5ba3d3(null,_0x2e7462);})[_0xb25f('0x20')](function(_0x173f9d){logger[_0xb25f('0x21')](util[_0xb25f('0x1e')](_0xb25f('0x22'),_0x814617[_0xb25f('0x1f')],_0x814617['id']),util[_0xb25f('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x5ba3d3(_0x173f9d);});}else{return _0x5ba3d3(null,_0x2e7462);}},'beforeUpdate':function(_0x46c05f,_0x109a42,_0x1dd3c8){if(_0x46c05f[_0xb25f('0xa')](_0xb25f('0x9'))||_0x46c05f[_0xb25f('0xa')](_0xb25f('0x18'))||_0x46c05f[_0xb25f('0xa')](_0xb25f('0xb'))||_0x46c05f[_0xb25f('0xa')]('clientSecret')||_0x46c05f[_0xb25f('0xa')](_0xb25f('0xd'))||_0x46c05f[_0xb25f('0xa')](_0xb25f('0xe'))){var _0x1a5656,_0x33fab1;_0x1a5656=_0x46c05f[_0xb25f('0x18')];var _0x19d357=_0x1a5656[_0xb25f('0xf')](-0x1);if(_0x19d357==='/'||_0x19d357==='\x5c'||_0x19d357===':'){_0x1a5656=_0x1a5656[_0xb25f('0x10')](0x0,_0x1a5656[_0xb25f('0x11')](_0x19d357));}switch(_0x46c05f[_0xb25f('0x9')]){case'US':_0x33fab1=_0xb25f('0x12');break;case'AU':_0x33fab1=_0xb25f('0x24');break;case'IN':_0x33fab1=_0xb25f('0x13');break;case'CN':_0x33fab1=_0xb25f('0x14');break;default:_0x33fab1=_0xb25f('0x15');break;}var _0x21c1fa={'method':'POST','uri':_0x33fab1+'/oauth/v2/token','form':{'grant_type':_0xb25f('0x17'),'client_id':_0x46c05f['clientId'],'client_secret':_0x46c05f[_0xb25f('0xc')],'redirect_uri':_0x46c05f[_0xb25f('0x18')],'code':_0x46c05f['code']},'headers':{'Content-Type':_0xb25f('0x19')}};return rp(_0x21c1fa)[_0xb25f('0x1a')](function(_0x1f63bd){var _0x317ab3=JSON[_0xb25f('0x1b')](_0x1f63bd);if(_0x317ab3[_0xb25f('0x1d')]){_0x46c05f[_0xb25f('0x1c')]=_0x317ab3[_0xb25f('0x1d')];logger[_0xb25f('0x25')](util['format'](_0xb25f('0x26'),_0x46c05f[_0xb25f('0x1f')],_0x46c05f['id']));}else{logger[_0xb25f('0x21')](util[_0xb25f('0x1e')](_0xb25f('0x22'),_0x46c05f['name'],_0x46c05f['id']),util[_0xb25f('0x23')](_0x317ab3,{'showHidden':![],'depth':null}));}return _0x1dd3c8(null,_0x109a42);})['catch'](function(_0x2aa906){logger[_0xb25f('0x21')](util[_0xb25f('0x1e')](_0xb25f('0x22'),_0x46c05f['name'],_0x46c05f['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1dd3c8(_0x2aa906);});}else{return _0x1dd3c8(null,_0x109a42);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 84ae3a3..0ff2862 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 _0xfb11=['catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','include','map','model','attributes','debug','ShowZohoAccount','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x40cc0b,_0x1e0385){var _0x1400c5=function(_0x3bb3b2){while(--_0x3bb3b2){_0x40cc0b['push'](_0x40cc0b['shift']());}};_0x1400c5(++_0x1e0385);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xfb11[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var moment=require(_0x1fb1('0x1'));var BPromise=require(_0x1fb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fb1('0x4'));var logger=require('../../config/logger')(_0x1fb1('0x5'));var config=require(_0x1fb1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1fb1('0x7')][_0x1fb1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c098d,_0x1859da,_0x2596c2){return new BPromise(function(_0x34e61a,_0x236b20){return client[_0x1fb1('0x9')](_0x4c098d,_0x2596c2)[_0x1fb1('0xa')](function(_0x438d15){logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,_0x1fb1('0xd'));logger['debug'](_0x1fb1('0xe'),_0x1859da,'request\x20sent',JSON[_0x1fb1('0xf')](_0x438d15));if(_0x438d15['error']){if(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x11')]===0x1f4){logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x236b20(_0x438d15['error'][_0x1fb1('0x12')]);}logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x34e61a(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);}else{logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,'request\x20sent');_0x34e61a(_0x438d15['result'][_0x1fb1('0x12')]);}})[_0x1fb1('0x13')](function(_0x3924ab){logger['error'](_0x1fb1('0xc'),_0x1859da,_0x3924ab);_0x236b20(_0x3924ab);});});}exports[_0x1fb1('0x14')]=function(_0x24d4df){var _0x34076b=this;return new Promise(function(_0x33c6b6,_0x27d71f){return db[_0x1fb1('0x15')][_0x1fb1('0x16')]({'raw':_0x24d4df[_0x1fb1('0x17')]?_0x24d4df['options'][_0x1fb1('0x18')]===undefined?!![]:![]:!![],'where':_0x24d4df['options']?_0x24d4df['options'][_0x1fb1('0x19')]||null:null,'attributes':_0x24d4df[_0x1fb1('0x17')]?_0x24d4df[_0x1fb1('0x17')]['attributes']||null:null,'limit':_0x24d4df[_0x1fb1('0x17')]?_0x24d4df['options']['limit']||null:null,'include':_0x24d4df['options']?_0x24d4df[_0x1fb1('0x17')][_0x1fb1('0x1a')]?_[_0x1fb1('0x1b')](_0x24d4df[_0x1fb1('0x17')][_0x1fb1('0x1a')],function(_0x53b8af){return{'model':db[_0x53b8af[_0x1fb1('0x1c')]],'as':_0x53b8af['as'],'attributes':_0x53b8af[_0x1fb1('0x1d')],'include':_0x53b8af[_0x1fb1('0x1a')]?_[_0x1fb1('0x1b')](_0x53b8af[_0x1fb1('0x1a')],function(_0x1353a4){return{'model':db[_0x1353a4[_0x1fb1('0x1c')]],'as':_0x1353a4['as'],'attributes':_0x1353a4[_0x1fb1('0x1d')],'include':_0x1353a4['include']?_[_0x1fb1('0x1b')](_0x1353a4[_0x1fb1('0x1a')],function(_0x46ff60){return{'model':db[_0x46ff60[_0x1fb1('0x1c')]],'as':_0x46ff60['as'],'attributes':_0x46ff60[_0x1fb1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1fb1('0xa')](function(_0x1a74c4){logger[_0x1fb1('0xb')](_0x1fb1('0x14'),_0x24d4df);logger[_0x1fb1('0x1e')](_0x1fb1('0x14'),_0x24d4df,JSON[_0x1fb1('0xf')](_0x1a74c4));_0x33c6b6(_0x1a74c4);})[_0x1fb1('0x13')](function(_0xe8ec0a){logger[_0x1fb1('0x10')]('GetZohoAccount',_0xe8ec0a[_0x1fb1('0x12')],_0x24d4df);_0x27d71f(_0x34076b[_0x1fb1('0x10')](0x1f4,_0xe8ec0a[_0x1fb1('0x12')]));});});};exports[_0x1fb1('0x1f')]=function(_0x5402e9){var _0x245f84=this;return new Promise(function(_0x30c8eb,_0x5d45a5){return db[_0x1fb1('0x15')]['find']({'raw':_0x5402e9['options']?_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x18')]===undefined?!![]:![]:!![],'where':_0x5402e9['options']?_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x19')]||null:null,'attributes':_0x5402e9[_0x1fb1('0x17')]?_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x1d')]||null:null,'include':_0x5402e9['options']?_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x1a')]?_[_0x1fb1('0x1b')](_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x1a')],function(_0x307700){return{'model':db[_0x307700[_0x1fb1('0x1c')]],'as':_0x307700['as'],'attributes':_0x307700[_0x1fb1('0x1d')],'include':_0x307700[_0x1fb1('0x1a')]?_['map'](_0x307700[_0x1fb1('0x1a')],function(_0x4b4271){return{'model':db[_0x4b4271[_0x1fb1('0x1c')]],'as':_0x4b4271['as'],'attributes':_0x4b4271['attributes'],'include':_0x4b4271[_0x1fb1('0x1a')]?_['map'](_0x4b4271['include'],function(_0x25ac36){return{'model':db[_0x25ac36[_0x1fb1('0x1c')]],'as':_0x25ac36['as'],'attributes':_0x25ac36[_0x1fb1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1fb1('0xa')](function(_0x564ed9){logger[_0x1fb1('0xb')](_0x1fb1('0x1f'),_0x5402e9);logger[_0x1fb1('0x1e')]('ShowZohoAccount',_0x5402e9,JSON[_0x1fb1('0xf')](_0x564ed9));_0x30c8eb(_0x564ed9);})[_0x1fb1('0x13')](function(_0x228235){logger[_0x1fb1('0x10')](_0x1fb1('0x1f'),_0x228235[_0x1fb1('0x12')],_0x5402e9);_0x5d45a5(_0x245f84[_0x1fb1('0x10')](0x1f4,_0x228235['message']));});});}; \ No newline at end of file +var _0x70e3=['message','result','catch','GetZohoAccount','findAll','options','where','attributes','limit','include','map','model','debug','ShowZohoAccount','ZohoAccount','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x175288,_0x4a479f){var _0x293840=function(_0x597437){while(--_0x597437){_0x175288['push'](_0x175288['shift']());}};_0x293840(++_0x4a479f);}(_0x70e3,0x9d));var _0x370e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x70e3[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x370e('0x0'));var util=require(_0x370e('0x1'));var moment=require(_0x370e('0x2'));var BPromise=require(_0x370e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x370e('0x4'));var db=require(_0x370e('0x5'))['db'];var utils=require(_0x370e('0x6'));var logger=require('../../config/logger')(_0x370e('0x7'));var config=require(_0x370e('0x8'));var jayson=require(_0x370e('0x9'));var client=jayson[_0x370e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a2aaf,_0x5f57ea,_0x4a6884){return new BPromise(function(_0x5e5c79,_0x4086c4){return client['request'](_0x3a2aaf,_0x4a6884)[_0x370e('0xb')](function(_0x52d611){logger[_0x370e('0xc')](_0x370e('0xd'),_0x5f57ea,'request\x20sent');logger['debug'](_0x370e('0xe'),_0x5f57ea,_0x370e('0xf'),JSON[_0x370e('0x10')](_0x52d611));if(_0x52d611[_0x370e('0x11')]){if(_0x52d611[_0x370e('0x11')]['code']===0x1f4){logger[_0x370e('0x11')](_0x370e('0xd'),_0x5f57ea,_0x52d611[_0x370e('0x11')][_0x370e('0x12')]);return _0x4086c4(_0x52d611[_0x370e('0x11')][_0x370e('0x12')]);}logger[_0x370e('0x11')](_0x370e('0xd'),_0x5f57ea,_0x52d611[_0x370e('0x11')][_0x370e('0x12')]);return _0x5e5c79(_0x52d611[_0x370e('0x11')]['message']);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0x5f57ea,_0x370e('0xf'));_0x5e5c79(_0x52d611[_0x370e('0x13')][_0x370e('0x12')]);}})[_0x370e('0x14')](function(_0xb8381f){logger[_0x370e('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x5f57ea,_0xb8381f);_0x4086c4(_0xb8381f);});});}exports[_0x370e('0x15')]=function(_0x2e394a){var _0x4f8b38=this;return new Promise(function(_0x407789,_0x343371){return db['ZohoAccount'][_0x370e('0x16')]({'raw':_0x2e394a[_0x370e('0x17')]?_0x2e394a[_0x370e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2e394a[_0x370e('0x17')]?_0x2e394a[_0x370e('0x17')][_0x370e('0x18')]||null:null,'attributes':_0x2e394a['options']?_0x2e394a[_0x370e('0x17')][_0x370e('0x19')]||null:null,'limit':_0x2e394a['options']?_0x2e394a[_0x370e('0x17')][_0x370e('0x1a')]||null:null,'include':_0x2e394a['options']?_0x2e394a[_0x370e('0x17')][_0x370e('0x1b')]?_[_0x370e('0x1c')](_0x2e394a[_0x370e('0x17')][_0x370e('0x1b')],function(_0x18c058){return{'model':db[_0x18c058['model']],'as':_0x18c058['as'],'attributes':_0x18c058[_0x370e('0x19')],'include':_0x18c058[_0x370e('0x1b')]?_[_0x370e('0x1c')](_0x18c058['include'],function(_0x2f7d1f){return{'model':db[_0x2f7d1f[_0x370e('0x1d')]],'as':_0x2f7d1f['as'],'attributes':_0x2f7d1f[_0x370e('0x19')],'include':_0x2f7d1f['include']?_[_0x370e('0x1c')](_0x2f7d1f[_0x370e('0x1b')],function(_0x210a46){return{'model':db[_0x210a46[_0x370e('0x1d')]],'as':_0x210a46['as'],'attributes':_0x210a46[_0x370e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x370e('0xb')](function(_0x3e9660){logger['info'](_0x370e('0x15'),_0x2e394a);logger[_0x370e('0x1e')](_0x370e('0x15'),_0x2e394a,JSON[_0x370e('0x10')](_0x3e9660));_0x407789(_0x3e9660);})[_0x370e('0x14')](function(_0x5a7c26){logger['error'](_0x370e('0x15'),_0x5a7c26[_0x370e('0x12')],_0x2e394a);_0x343371(_0x4f8b38[_0x370e('0x11')](0x1f4,_0x5a7c26['message']));});});};exports[_0x370e('0x1f')]=function(_0x1a453f){var _0x3dc4d0=this;return new Promise(function(_0x2134bd,_0x281259){return db[_0x370e('0x20')][_0x370e('0x21')]({'raw':_0x1a453f['options']?_0x1a453f['options'][_0x370e('0x22')]===undefined?!![]:![]:!![],'where':_0x1a453f[_0x370e('0x17')]?_0x1a453f[_0x370e('0x17')][_0x370e('0x18')]||null:null,'attributes':_0x1a453f['options']?_0x1a453f[_0x370e('0x17')][_0x370e('0x19')]||null:null,'include':_0x1a453f[_0x370e('0x17')]?_0x1a453f[_0x370e('0x17')]['include']?_[_0x370e('0x1c')](_0x1a453f[_0x370e('0x17')][_0x370e('0x1b')],function(_0x1c11a8){return{'model':db[_0x1c11a8[_0x370e('0x1d')]],'as':_0x1c11a8['as'],'attributes':_0x1c11a8[_0x370e('0x19')],'include':_0x1c11a8['include']?_[_0x370e('0x1c')](_0x1c11a8[_0x370e('0x1b')],function(_0x479124){return{'model':db[_0x479124['model']],'as':_0x479124['as'],'attributes':_0x479124['attributes'],'include':_0x479124[_0x370e('0x1b')]?_['map'](_0x479124['include'],function(_0x4740cd){return{'model':db[_0x4740cd['model']],'as':_0x4740cd['as'],'attributes':_0x4740cd[_0x370e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x370e('0xb')](function(_0x38d5a1){logger[_0x370e('0xc')](_0x370e('0x1f'),_0x1a453f);logger[_0x370e('0x1e')](_0x370e('0x1f'),_0x1a453f,JSON['stringify'](_0x38d5a1));_0x2134bd(_0x38d5a1);})[_0x370e('0x14')](function(_0x309990){logger[_0x370e('0x11')](_0x370e('0x1f'),_0x309990['message'],_0x1a453f);_0x281259(_0x3dc4d0['error'](0x1f4,_0x309990[_0x370e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 248ea15..b09582e 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 _0xd692=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x41d383,_0x4fad5e){var _0x23bd94=function(_0x1da648){while(--_0x1da648){_0x41d383['push'](_0x41d383['shift']());}};_0x23bd94(++_0x4fad5e);}(_0xd692,0xa2));var _0x2d69=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd692[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x2d69('0x0'));var util=require(_0x2d69('0x1'));var path=require(_0x2d69('0x2'));var timeout=require(_0x2d69('0x3'));var express=require(_0x2d69('0x4'));var router=express['Router']();var fs_extra=require(_0x2d69('0x5'));var auth=require(_0x2d69('0x6'));var interaction=require(_0x2d69('0x7'));var config=require(_0x2d69('0x8'));var controller=require(_0x2d69('0x9'));router[_0x2d69('0xa')]('/',auth[_0x2d69('0xb')](),controller['index']);router['get'](_0x2d69('0xc'),auth[_0x2d69('0xb')](),controller['show']);router['get'](_0x2d69('0xd'),auth[_0x2d69('0xb')](),controller[_0x2d69('0xe')]);router[_0x2d69('0xa')]('/:id/subjects',auth[_0x2d69('0xb')](),controller[_0x2d69('0xf')]);router['get'](_0x2d69('0x10'),auth[_0x2d69('0xb')](),controller[_0x2d69('0x11')]);router['post']('/',auth[_0x2d69('0xb')](),controller[_0x2d69('0x12')]);router[_0x2d69('0x13')](_0x2d69('0xc'),auth[_0x2d69('0xb')](),controller[_0x2d69('0x14')]);router[_0x2d69('0x15')](_0x2d69('0xc'),auth[_0x2d69('0xb')](),controller[_0x2d69('0x16')]);module[_0x2d69('0x17')]=router; \ No newline at end of file +var _0x2d01=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x511210,_0x28d2c1){var _0x1938f4=function(_0x4ad604){while(--_0x4ad604){_0x511210['push'](_0x511210['shift']());}};_0x1938f4(++_0x28d2c1);}(_0x2d01,0x149));var _0x12d0=function(_0x2526e3,_0x5f22f8){_0x2526e3=_0x2526e3-0x0;var _0xcf6f48=_0x2d01[_0x2526e3];return _0xcf6f48;};'use strict';var multer=require('multer');var util=require(_0x12d0('0x0'));var path=require(_0x12d0('0x1'));var timeout=require(_0x12d0('0x2'));var express=require(_0x12d0('0x3'));var router=express[_0x12d0('0x4')]();var fs_extra=require(_0x12d0('0x5'));var auth=require(_0x12d0('0x6'));var interaction=require(_0x12d0('0x7'));var config=require(_0x12d0('0x8'));var controller=require(_0x12d0('0x9'));router[_0x12d0('0xa')]('/',auth[_0x12d0('0xb')](),controller[_0x12d0('0xc')]);router[_0x12d0('0xa')](_0x12d0('0xd'),auth[_0x12d0('0xb')](),controller[_0x12d0('0xe')]);router[_0x12d0('0xa')](_0x12d0('0xf'),auth[_0x12d0('0xb')](),controller[_0x12d0('0x10')]);router['get']('/:id/subjects',auth[_0x12d0('0xb')](),controller[_0x12d0('0x11')]);router['get'](_0x12d0('0x12'),auth[_0x12d0('0xb')](),controller[_0x12d0('0x13')]);router[_0x12d0('0x14')]('/',auth['isAuthenticated'](),controller[_0x12d0('0x15')]);router[_0x12d0('0x16')](_0x12d0('0xd'),auth['isAuthenticated'](),controller[_0x12d0('0x17')]);router[_0x12d0('0x18')]('/:id',auth[_0x12d0('0xb')](),controller[_0x12d0('0x19')]);module[_0x12d0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 46f03fd..f65e51b 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 _0x1efe=['lead','contact','nothing','contact_lead','sequelize','exports','STRING','ENUM'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1efe,0xfc));var _0xe1ef=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x1efe[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0xe1ef('0x0'));module[_0xe1ef('0x1')]={'name':{'type':Sequelize[_0xe1ef('0x2')]},'moduleCreate':{'type':Sequelize[_0xe1ef('0x3')](_0xe1ef('0x4'),_0xe1ef('0x5'),_0xe1ef('0x6')),'defaultValue':_0xe1ef('0x4')},'moduleSearch':{'type':Sequelize[_0xe1ef('0x3')](_0xe1ef('0x7'),_0xe1ef('0x5'),_0xe1ef('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xe1ef('0x2')]}}; \ No newline at end of file +var _0x460c=['ENUM','lead','contact','contact_lead','exports','STRING'];(function(_0x4da78d,_0x2b9add){var _0x194496=function(_0x789401){while(--_0x789401){_0x4da78d['push'](_0x4da78d['shift']());}};_0x194496(++_0x2b9add);}(_0x460c,0xe8));var _0xc460=function(_0x1a8a27,_0x438e22){_0x1a8a27=_0x1a8a27-0x0;var _0x102615=_0x460c[_0x1a8a27];return _0x102615;};'use strict';var Sequelize=require('sequelize');module[_0xc460('0x0')]={'name':{'type':Sequelize[_0xc460('0x1')]},'moduleCreate':{'type':Sequelize[_0xc460('0x2')](_0xc460('0x3'),_0xc460('0x4'),'nothing'),'defaultValue':_0xc460('0x3')},'moduleSearch':{'type':Sequelize[_0xc460('0x2')](_0xc460('0x5'),_0xc460('0x4'),'lead'),'defaultValue':_0xc460('0x5')},'description':{'type':Sequelize[_0xc460('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index d018bfb..a74dbb2 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 _0x98dc=['map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','intersection','find','create','body','getFields','findOne','order','ZohoField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x98dc,0x77));var _0xc98d=function(_0x423615,_0x134890){_0x423615=_0x423615-0x0;var _0x5512c1=_0x98dc[_0x423615];return _0x5512c1;};'use strict';var emlformat=require(_0xc98d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc98d('0x1'));var jsonpatch=require(_0xc98d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc98d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc98d('0x4'));var sox=require(_0xc98d('0x5'));var csv=require('to-csv');var ejs=require(_0xc98d('0x6'));var fs=require('fs');var fs_extra=require(_0xc98d('0x7'));var _=require(_0xc98d('0x8'));var squel=require(_0xc98d('0x9'));var crypto=require(_0xc98d('0xa'));var jsforce=require(_0xc98d('0xb'));var deskjs=require(_0xc98d('0xc'));var toCsv=require(_0xc98d('0xd'));var querystring=require(_0xc98d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc98d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc98d('0x10'));var hardwareService=require(_0xc98d('0x11'));var logger=require(_0xc98d('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xc98d('0x13'));var licenseUtil=require(_0xc98d('0x14'));var db=require(_0xc98d('0x15'))['db'];function respondWithStatusCode(_0x2167c5,_0x145adb){_0x145adb=_0x145adb||0xcc;return function(_0x5abef4){if(_0x5abef4){return _0x2167c5[_0xc98d('0x16')](_0x145adb);}return _0x2167c5['status'](_0x145adb)[_0xc98d('0x17')]();};}function respondWithResult(_0x150757,_0x239c01){_0x239c01=_0x239c01||0xc8;return function(_0x3998af){if(_0x3998af){return _0x150757[_0xc98d('0x18')](_0x239c01)['json'](_0x3998af);}};}function respondWithFilteredResult(_0x1a72f4,_0x1d48e9){return function(_0x3e3c3a){if(_0x3e3c3a){var _0x239eb6=typeof _0x1d48e9[_0xc98d('0x19')]===_0xc98d('0x1a')&&typeof _0x1d48e9[_0xc98d('0x1b')]===_0xc98d('0x1a');var _0x3841be=_0x3e3c3a['count'];var _0x33d661=_0x239eb6?0x0:_0x1d48e9[_0xc98d('0x19')];var _0x12c022=_0x239eb6?_0x3e3c3a[_0xc98d('0x1c')]:_0x1d48e9[_0xc98d('0x19')]+_0x1d48e9['limit'];var _0x3cca25;if(_0x12c022>=_0x3841be){_0x12c022=_0x3841be;_0x3cca25=0xc8;}else{_0x3cca25=0xce;}_0x1a72f4[_0xc98d('0x18')](_0x3cca25);return _0x1a72f4[_0xc98d('0x1d')](_0xc98d('0x1e'),_0x33d661+'-'+_0x12c022+'/'+_0x3841be)['json'](_0x3e3c3a);}return null;};}function patchUpdates(_0x5a69a8){return function(_0x51036b){try{jsonpatch[_0xc98d('0x1f')](_0x51036b,_0x5a69a8,!![]);}catch(_0x9f4fe3){return BPromise[_0xc98d('0x20')](_0x9f4fe3);}return _0x51036b['save']();};}function saveUpdates(_0x25370c,_0x1d23bc){return function(_0x11f216){if(_0x11f216){return _0x11f216[_0xc98d('0x21')](_0x25370c)['then'](function(_0x2013d4){return _0x2013d4;});}return null;};}function removeEntity(_0x24ea6b,_0x54ede2){return function(_0x50270d){if(_0x50270d){return _0x50270d[_0xc98d('0x22')]()[_0xc98d('0x23')](function(){_0x24ea6b[_0xc98d('0x18')](0xcc)[_0xc98d('0x17')]();});}};}function handleEntityNotFound(_0x57f8d3,_0x28468d){return function(_0x33832f){if(!_0x33832f){_0x57f8d3[_0xc98d('0x16')](0x194);}return _0x33832f;};}function handleError(_0x5470b1,_0x1a1f36){_0x1a1f36=_0x1a1f36||0x1f4;return function(_0x246e66){logger[_0xc98d('0x24')](_0x246e66[_0xc98d('0x25')]);if(_0x246e66['name']){delete _0x246e66[_0xc98d('0x26')];}_0x5470b1[_0xc98d('0x18')](_0x1a1f36)[_0xc98d('0x27')](_0x246e66);};}exports[_0xc98d('0x28')]=function(_0x3db5d5,_0x1443d9){var _0x1e73d1={},_0x4ab81c={},_0x1c0bec={'count':0x0,'rows':[]};var _0x923a30=_[_0xc98d('0x29')](db[_0xc98d('0x2a')][_0xc98d('0x2b')],function(_0x306a73){return{'name':_0x306a73[_0xc98d('0x2c')],'type':_0x306a73[_0xc98d('0x2d')][_0xc98d('0x2e')]};});_0x4ab81c[_0xc98d('0x2f')]=_[_0xc98d('0x29')](_0x923a30,_0xc98d('0x26'));_0x4ab81c[_0xc98d('0x30')]=_[_0xc98d('0x31')](_0x3db5d5[_0xc98d('0x30')]);_0x4ab81c['filters']=_['intersection'](_0x4ab81c[_0xc98d('0x2f')],_0x4ab81c[_0xc98d('0x30')]);_0x1e73d1[_0xc98d('0x32')]=_['intersection'](_0x4ab81c[_0xc98d('0x2f')],qs[_0xc98d('0x33')](_0x3db5d5[_0xc98d('0x30')]['fields']));_0x1e73d1['attributes']=_0x1e73d1[_0xc98d('0x32')][_0xc98d('0x34')]?_0x1e73d1[_0xc98d('0x32')]:_0x4ab81c[_0xc98d('0x2f')];if(!_0x3db5d5[_0xc98d('0x30')][_0xc98d('0x35')](_0xc98d('0x36'))){_0x1e73d1[_0xc98d('0x1b')]=qs[_0xc98d('0x1b')](_0x3db5d5[_0xc98d('0x30')][_0xc98d('0x1b')]);_0x1e73d1['offset']=qs[_0xc98d('0x19')](_0x3db5d5[_0xc98d('0x30')]['offset']);}_0x1e73d1['order']=qs[_0xc98d('0x37')](_0x3db5d5[_0xc98d('0x30')][_0xc98d('0x37')]);_0x1e73d1[_0xc98d('0x38')]=qs['filters'](_[_0xc98d('0x39')](_0x3db5d5[_0xc98d('0x30')],_0x4ab81c['filters']),_0x923a30);if(_0x3db5d5['query'][_0xc98d('0x3a')]){_0x1e73d1[_0xc98d('0x38')]=_[_0xc98d('0x3b')](_0x1e73d1[_0xc98d('0x38')],{'$or':_[_0xc98d('0x29')](_0x923a30,function(_0x5e4f14){if(_0x5e4f14[_0xc98d('0x2d')]!==_0xc98d('0x3c')){var _0x4da6eb={};_0x4da6eb[_0x5e4f14[_0xc98d('0x26')]]={'$like':'%'+_0x3db5d5[_0xc98d('0x30')][_0xc98d('0x3a')]+'%'};return _0x4da6eb;}})});}_0x1e73d1=_[_0xc98d('0x3b')]({},_0x1e73d1,_0x3db5d5[_0xc98d('0x3d')]);var _0x58b82a={'where':_0x1e73d1['where']};return db['ZohoConfiguration'][_0xc98d('0x1c')](_0x58b82a)['then'](function(_0x281232){_0x1c0bec[_0xc98d('0x1c')]=_0x281232;if(_0x3db5d5[_0xc98d('0x30')][_0xc98d('0x3e')]){_0x1e73d1[_0xc98d('0x3f')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xc98d('0x40')](_0x1e73d1);})['then'](function(_0x2e314f){_0x1c0bec[_0xc98d('0x41')]=_0x2e314f;return _0x1c0bec;})[_0xc98d('0x23')](respondWithFilteredResult(_0x1443d9,_0x1e73d1))[_0xc98d('0x42')](handleError(_0x1443d9,null));};exports[_0xc98d('0x43')]=function(_0x2346f9,_0x94ac0b){var _0x4ac1c3={'raw':![],'where':{'id':_0x2346f9[_0xc98d('0x44')]['id']}},_0x378987={};_0x378987[_0xc98d('0x2f')]=_[_0xc98d('0x31')](db[_0xc98d('0x2a')][_0xc98d('0x2b')]);_0x378987['query']=_[_0xc98d('0x31')](_0x2346f9[_0xc98d('0x30')]);_0x378987[_0xc98d('0x45')]=_[_0xc98d('0x46')](_0x378987['model'],_0x378987[_0xc98d('0x30')]);_0x4ac1c3[_0xc98d('0x32')]=_['intersection'](_0x378987['model'],qs[_0xc98d('0x33')](_0x2346f9[_0xc98d('0x30')][_0xc98d('0x33')]));_0x4ac1c3[_0xc98d('0x32')]=_0x4ac1c3[_0xc98d('0x32')]['length']?_0x4ac1c3[_0xc98d('0x32')]:_0x378987[_0xc98d('0x2f')];if(_0x2346f9[_0xc98d('0x30')][_0xc98d('0x3e')]){_0x4ac1c3[_0xc98d('0x3f')]=[{'all':!![]}];}_0x4ac1c3=_[_0xc98d('0x3b')]({},_0x4ac1c3,_0x2346f9[_0xc98d('0x3d')]);return db['ZohoConfiguration'][_0xc98d('0x47')](_0x4ac1c3)[_0xc98d('0x23')](handleEntityNotFound(_0x94ac0b,null))[_0xc98d('0x23')](respondWithResult(_0x94ac0b,null))[_0xc98d('0x42')](handleError(_0x94ac0b,null));};exports[_0xc98d('0x48')]=function(_0x31870b,_0x477823){return db['ZohoConfiguration'][_0xc98d('0x48')](_0x31870b[_0xc98d('0x49')],{})['then'](respondWithResult(_0x477823,0xc9))[_0xc98d('0x42')](handleError(_0x477823,null));};exports[_0xc98d('0x21')]=function(_0xd1981c,_0xa0781a){if(_0xd1981c[_0xc98d('0x49')]['id']){delete _0xd1981c[_0xc98d('0x49')]['id'];}return db[_0xc98d('0x2a')]['find']({'where':{'id':_0xd1981c[_0xc98d('0x44')]['id']}})[_0xc98d('0x23')](handleEntityNotFound(_0xa0781a,null))['then'](saveUpdates(_0xd1981c[_0xc98d('0x49')],null))[_0xc98d('0x23')](respondWithResult(_0xa0781a,null))[_0xc98d('0x42')](handleError(_0xa0781a,null));};exports[_0xc98d('0x22')]=function(_0x201cfb,_0x52183e){return db[_0xc98d('0x2a')][_0xc98d('0x47')]({'where':{'id':_0x201cfb[_0xc98d('0x44')]['id']}})[_0xc98d('0x23')](handleEntityNotFound(_0x52183e,null))[_0xc98d('0x23')](removeEntity(_0x52183e,null))[_0xc98d('0x42')](handleError(_0x52183e,null));};exports[_0xc98d('0x4a')]=function(_0x1e888e,_0x1a380a,_0x269cfa){var _0x39e2db={};var _0x48cc61={};var _0x31308d;var _0x372467;return db['ZohoConfiguration'][_0xc98d('0x4b')]({'where':{'id':_0x1e888e[_0xc98d('0x44')]['id']}})['then'](handleEntityNotFound(_0x1a380a,null))[_0xc98d('0x23')](function(_0x25a3b7){if(_0x25a3b7){_0x31308d=_0x25a3b7;_0x48cc61['model']=_[_0xc98d('0x31')](db['ZohoField'][_0xc98d('0x2b')]);_0x48cc61[_0xc98d('0x30')]=_['keys'](_0x1e888e[_0xc98d('0x30')]);_0x48cc61[_0xc98d('0x45')]=_['intersection'](_0x48cc61['model'],_0x48cc61[_0xc98d('0x30')]);_0x39e2db[_0xc98d('0x32')]=_[_0xc98d('0x46')](_0x48cc61['model'],qs[_0xc98d('0x33')](_0x1e888e['query'][_0xc98d('0x33')]));_0x39e2db[_0xc98d('0x32')]=_0x39e2db['attributes'][_0xc98d('0x34')]?_0x39e2db['attributes']:_0x48cc61[_0xc98d('0x2f')];_0x39e2db[_0xc98d('0x4c')]=qs[_0xc98d('0x37')](_0x1e888e['query'][_0xc98d('0x37')]);_0x39e2db[_0xc98d('0x38')]=qs[_0xc98d('0x45')](_[_0xc98d('0x39')](_0x1e888e[_0xc98d('0x30')],_0x48cc61[_0xc98d('0x45')]));if(_0x1e888e[_0xc98d('0x30')][_0xc98d('0x3a')]){_0x39e2db[_0xc98d('0x38')]=_['merge'](_0x39e2db[_0xc98d('0x38')],{'$or':_[_0xc98d('0x29')](_0x39e2db[_0xc98d('0x32')],function(_0x296edf){var _0x315eba={};_0x315eba[_0x296edf]={'$like':'%'+_0x1e888e[_0xc98d('0x30')]['filter']+'%'};return _0x315eba;})});}_0x39e2db=_[_0xc98d('0x3b')]({},_0x39e2db,_0x1e888e[_0xc98d('0x3d')]);return _0x31308d['getFields'](_0x39e2db);}})[_0xc98d('0x23')](function(_0x19b84c){if(_0x19b84c){_0x372467=_0x19b84c[_0xc98d('0x34')];if(!_0x1e888e[_0xc98d('0x30')][_0xc98d('0x35')](_0xc98d('0x36'))){_0x39e2db[_0xc98d('0x1b')]=qs['limit'](_0x1e888e['query'][_0xc98d('0x1b')]);_0x39e2db[_0xc98d('0x19')]=qs['offset'](_0x1e888e[_0xc98d('0x30')][_0xc98d('0x19')]);}return _0x31308d[_0xc98d('0x4a')](_0x39e2db);}})[_0xc98d('0x23')](function(_0x50fb81){if(_0x50fb81){return _0x50fb81?{'count':_0x372467,'rows':_0x50fb81}:null;}})[_0xc98d('0x23')](respondWithResult(_0x1a380a,null))['catch'](handleError(_0x1a380a,null));};exports['getSubjects']=function(_0x2bf7d0,_0xd25d7b,_0x36689b){var _0x1469d0={};var _0xbca07d={};var _0x3dd0eb;var _0x242ac8;return db[_0xc98d('0x2a')][_0xc98d('0x4b')]({'where':{'id':_0x2bf7d0['params']['id']}})[_0xc98d('0x23')](handleEntityNotFound(_0xd25d7b,null))[_0xc98d('0x23')](function(_0x168c9b){if(_0x168c9b){_0x3dd0eb=_0x168c9b;_0xbca07d['model']=_['keys'](db[_0xc98d('0x4d')][_0xc98d('0x2b')]);_0xbca07d[_0xc98d('0x30')]=_[_0xc98d('0x31')](_0x2bf7d0[_0xc98d('0x30')]);_0xbca07d[_0xc98d('0x45')]=_[_0xc98d('0x46')](_0xbca07d[_0xc98d('0x2f')],_0xbca07d[_0xc98d('0x30')]);_0x1469d0[_0xc98d('0x32')]=_[_0xc98d('0x46')](_0xbca07d[_0xc98d('0x2f')],qs[_0xc98d('0x33')](_0x2bf7d0[_0xc98d('0x30')][_0xc98d('0x33')]));_0x1469d0[_0xc98d('0x32')]=_0x1469d0[_0xc98d('0x32')][_0xc98d('0x34')]?_0x1469d0[_0xc98d('0x32')]:_0xbca07d[_0xc98d('0x2f')];_0x1469d0[_0xc98d('0x4c')]=qs[_0xc98d('0x37')](_0x2bf7d0[_0xc98d('0x30')][_0xc98d('0x37')]);_0x1469d0['where']=qs[_0xc98d('0x45')](_['pick'](_0x2bf7d0['query'],_0xbca07d[_0xc98d('0x45')]));if(_0x2bf7d0[_0xc98d('0x30')][_0xc98d('0x3a')]){_0x1469d0[_0xc98d('0x38')]=_[_0xc98d('0x3b')](_0x1469d0[_0xc98d('0x38')],{'$or':_['map'](_0x1469d0[_0xc98d('0x32')],function(_0x48076f){var _0x3ecba5={};_0x3ecba5[_0x48076f]={'$like':'%'+_0x2bf7d0['query']['filter']+'%'};return _0x3ecba5;})});}_0x1469d0=_[_0xc98d('0x3b')]({},_0x1469d0,_0x2bf7d0[_0xc98d('0x3d')]);return _0x3dd0eb[_0xc98d('0x4e')](_0x1469d0);}})[_0xc98d('0x23')](function(_0xe88c14){if(_0xe88c14){_0x242ac8=_0xe88c14[_0xc98d('0x34')];if(!_0x2bf7d0[_0xc98d('0x30')][_0xc98d('0x35')]('nolimit')){_0x1469d0[_0xc98d('0x1b')]=qs[_0xc98d('0x1b')](_0x2bf7d0[_0xc98d('0x30')][_0xc98d('0x1b')]);_0x1469d0[_0xc98d('0x19')]=qs[_0xc98d('0x19')](_0x2bf7d0[_0xc98d('0x30')][_0xc98d('0x19')]);}return _0x3dd0eb['getSubjects'](_0x1469d0);}})[_0xc98d('0x23')](function(_0x494701){if(_0x494701){return _0x494701?{'count':_0x242ac8,'rows':_0x494701}:null;}})[_0xc98d('0x23')](respondWithResult(_0xd25d7b,null))[_0xc98d('0x42')](handleError(_0xd25d7b,null));};exports[_0xc98d('0x4f')]=function(_0x589a9d,_0x8e5860,_0x5512c2){var _0x34fdc3={};var _0x4a61c2={};var _0x5369f7;var _0x27b367;return db[_0xc98d('0x2a')][_0xc98d('0x4b')]({'where':{'id':_0x589a9d['params']['id']}})[_0xc98d('0x23')](handleEntityNotFound(_0x8e5860,null))[_0xc98d('0x23')](function(_0x3d68b5){if(_0x3d68b5){_0x5369f7=_0x3d68b5;_0x4a61c2[_0xc98d('0x2f')]=_[_0xc98d('0x31')](db[_0xc98d('0x4d')][_0xc98d('0x2b')]);_0x4a61c2[_0xc98d('0x30')]=_[_0xc98d('0x31')](_0x589a9d['query']);_0x4a61c2['filters']=_[_0xc98d('0x46')](_0x4a61c2[_0xc98d('0x2f')],_0x4a61c2[_0xc98d('0x30')]);_0x34fdc3[_0xc98d('0x32')]=_[_0xc98d('0x46')](_0x4a61c2[_0xc98d('0x2f')],qs[_0xc98d('0x33')](_0x589a9d[_0xc98d('0x30')][_0xc98d('0x33')]));_0x34fdc3[_0xc98d('0x32')]=_0x34fdc3['attributes'][_0xc98d('0x34')]?_0x34fdc3[_0xc98d('0x32')]:_0x4a61c2[_0xc98d('0x2f')];_0x34fdc3[_0xc98d('0x4c')]=qs['sort'](_0x589a9d[_0xc98d('0x30')]['sort']);_0x34fdc3['where']=qs[_0xc98d('0x45')](_[_0xc98d('0x39')](_0x589a9d[_0xc98d('0x30')],_0x4a61c2[_0xc98d('0x45')]));if(_0x589a9d[_0xc98d('0x30')][_0xc98d('0x3a')]){_0x34fdc3[_0xc98d('0x38')]=_['merge'](_0x34fdc3[_0xc98d('0x38')],{'$or':_[_0xc98d('0x29')](_0x34fdc3[_0xc98d('0x32')],function(_0x3f7879){var _0x3a53d8={};_0x3a53d8[_0x3f7879]={'$like':'%'+_0x589a9d[_0xc98d('0x30')]['filter']+'%'};return _0x3a53d8;})});}_0x34fdc3=_['merge']({},_0x34fdc3,_0x589a9d['options']);return _0x5369f7[_0xc98d('0x4f')](_0x34fdc3);}})[_0xc98d('0x23')](function(_0x1384e0){if(_0x1384e0){_0x27b367=_0x1384e0['length'];if(!_0x589a9d['query'][_0xc98d('0x35')](_0xc98d('0x36'))){_0x34fdc3['limit']=qs[_0xc98d('0x1b')](_0x589a9d['query'][_0xc98d('0x1b')]);_0x34fdc3[_0xc98d('0x19')]=qs[_0xc98d('0x19')](_0x589a9d[_0xc98d('0x30')][_0xc98d('0x19')]);}return _0x5369f7[_0xc98d('0x4f')](_0x34fdc3);}})[_0xc98d('0x23')](function(_0x44c78b){if(_0x44c78b){return _0x44c78b?{'count':_0x27b367,'rows':_0x44c78b}:null;}})['then'](respondWithResult(_0x8e5860,null))[_0xc98d('0x42')](handleError(_0x8e5860,null));}; \ No newline at end of file +var _0x53fa=['end','name','send','index','ZohoConfiguration','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','getFields','findOne','ZohoField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','json','save','then','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53fa,0xc5));var _0xa53f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53fa[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa53f('0x0'));var rimraf=require(_0xa53f('0x1'));var zipdir=require(_0xa53f('0x2'));var jsonpatch=require(_0xa53f('0x3'));var rp=require('request-promise');var moment=require(_0xa53f('0x4'));var BPromise=require(_0xa53f('0x5'));var Mustache=require('mustache');var util=require(_0xa53f('0x6'));var path=require('path');var sox=require(_0xa53f('0x7'));var csv=require(_0xa53f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa53f('0x9'));var _=require(_0xa53f('0xa'));var squel=require(_0xa53f('0xb'));var crypto=require('crypto');var jsforce=require(_0xa53f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa53f('0x8'));var querystring=require(_0xa53f('0xd'));var Papa=require(_0xa53f('0xe'));var Redis=require(_0xa53f('0xf'));var authService=require(_0xa53f('0x10'));var qs=require(_0xa53f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa53f('0x12'))(_0xa53f('0x13'));var utils=require('../../config/utils');var config=require(_0xa53f('0x14'));var licenseUtil=require(_0xa53f('0x15'));var db=require(_0xa53f('0x16'))['db'];function respondWithStatusCode(_0x1072ac,_0x47993a){_0x47993a=_0x47993a||0xcc;return function(_0x4be04a){if(_0x4be04a){return _0x1072ac[_0xa53f('0x17')](_0x47993a);}return _0x1072ac[_0xa53f('0x18')](_0x47993a)['end']();};}function respondWithResult(_0x5de41f,_0x42b6e8){_0x42b6e8=_0x42b6e8||0xc8;return function(_0x35a8ad){if(_0x35a8ad){return _0x5de41f[_0xa53f('0x18')](_0x42b6e8)['json'](_0x35a8ad);}};}function respondWithFilteredResult(_0x5cd293,_0x32fc4d){return function(_0x19a607){if(_0x19a607){var _0xf7049b=typeof _0x32fc4d[_0xa53f('0x19')]==='undefined'&&typeof _0x32fc4d[_0xa53f('0x1a')]===_0xa53f('0x1b');var _0x1aa533=_0x19a607[_0xa53f('0x1c')];var _0x3dd25c=_0xf7049b?0x0:_0x32fc4d[_0xa53f('0x19')];var _0xa34c99=_0xf7049b?_0x19a607[_0xa53f('0x1c')]:_0x32fc4d[_0xa53f('0x19')]+_0x32fc4d['limit'];var _0x1ce689;if(_0xa34c99>=_0x1aa533){_0xa34c99=_0x1aa533;_0x1ce689=0xc8;}else{_0x1ce689=0xce;}_0x5cd293[_0xa53f('0x18')](_0x1ce689);return _0x5cd293[_0xa53f('0x1d')]('Content-Range',_0x3dd25c+'-'+_0xa34c99+'/'+_0x1aa533)[_0xa53f('0x1e')](_0x19a607);}return null;};}function patchUpdates(_0xf7e569){return function(_0x1a4223){try{jsonpatch['apply'](_0x1a4223,_0xf7e569,!![]);}catch(_0x457144){return BPromise['reject'](_0x457144);}return _0x1a4223[_0xa53f('0x1f')]();};}function saveUpdates(_0x5e378e,_0x3fb574){return function(_0x4c0cb7){if(_0x4c0cb7){return _0x4c0cb7['update'](_0x5e378e)[_0xa53f('0x20')](function(_0x25e041){return _0x25e041;});}return null;};}function removeEntity(_0x1740b5,_0x1ca83b){return function(_0x4b7ed3){if(_0x4b7ed3){return _0x4b7ed3[_0xa53f('0x21')]()[_0xa53f('0x20')](function(){_0x1740b5[_0xa53f('0x18')](0xcc)[_0xa53f('0x22')]();});}};}function handleEntityNotFound(_0x5ceb8b,_0x42a819){return function(_0xb36d60){if(!_0xb36d60){_0x5ceb8b[_0xa53f('0x17')](0x194);}return _0xb36d60;};}function handleError(_0x1f4977,_0xb5f767){_0xb5f767=_0xb5f767||0x1f4;return function(_0x5f35cc){logger['error'](_0x5f35cc['stack']);if(_0x5f35cc['name']){delete _0x5f35cc[_0xa53f('0x23')];}_0x1f4977['status'](_0xb5f767)[_0xa53f('0x24')](_0x5f35cc);};}exports[_0xa53f('0x25')]=function(_0x17b3ed,_0x5ad08f){var _0x2d8f94={},_0x2cc12b={},_0x76a8e0={'count':0x0,'rows':[]};var _0x37d28b=_['map'](db[_0xa53f('0x26')][_0xa53f('0x27')],function(_0x287db1){return{'name':_0x287db1[_0xa53f('0x28')],'type':_0x287db1['type'][_0xa53f('0x29')]};});_0x2cc12b['model']=_[_0xa53f('0x2a')](_0x37d28b,_0xa53f('0x23'));_0x2cc12b['query']=_[_0xa53f('0x2b')](_0x17b3ed[_0xa53f('0x2c')]);_0x2cc12b[_0xa53f('0x2d')]=_[_0xa53f('0x2e')](_0x2cc12b[_0xa53f('0x2f')],_0x2cc12b['query']);_0x2d8f94[_0xa53f('0x30')]=_['intersection'](_0x2cc12b[_0xa53f('0x2f')],qs[_0xa53f('0x31')](_0x17b3ed[_0xa53f('0x2c')]['fields']));_0x2d8f94[_0xa53f('0x30')]=_0x2d8f94['attributes'][_0xa53f('0x32')]?_0x2d8f94[_0xa53f('0x30')]:_0x2cc12b['model'];if(!_0x17b3ed[_0xa53f('0x2c')][_0xa53f('0x33')](_0xa53f('0x34'))){_0x2d8f94[_0xa53f('0x1a')]=qs[_0xa53f('0x1a')](_0x17b3ed[_0xa53f('0x2c')][_0xa53f('0x1a')]);_0x2d8f94[_0xa53f('0x19')]=qs[_0xa53f('0x19')](_0x17b3ed['query'][_0xa53f('0x19')]);}_0x2d8f94[_0xa53f('0x35')]=qs['sort'](_0x17b3ed[_0xa53f('0x2c')][_0xa53f('0x36')]);_0x2d8f94[_0xa53f('0x37')]=qs[_0xa53f('0x2d')](_['pick'](_0x17b3ed['query'],_0x2cc12b[_0xa53f('0x2d')]),_0x37d28b);if(_0x17b3ed['query'][_0xa53f('0x38')]){_0x2d8f94[_0xa53f('0x37')]=_[_0xa53f('0x39')](_0x2d8f94[_0xa53f('0x37')],{'$or':_[_0xa53f('0x2a')](_0x37d28b,function(_0x30ab64){if(_0x30ab64[_0xa53f('0x3a')]!=='VIRTUAL'){var _0x4687a1={};_0x4687a1[_0x30ab64[_0xa53f('0x23')]]={'$like':'%'+_0x17b3ed[_0xa53f('0x2c')][_0xa53f('0x38')]+'%'};return _0x4687a1;}})});}_0x2d8f94=_['merge']({},_0x2d8f94,_0x17b3ed[_0xa53f('0x3b')]);var _0xe80f69={'where':_0x2d8f94['where']};return db[_0xa53f('0x26')][_0xa53f('0x1c')](_0xe80f69)['then'](function(_0x149e44){_0x76a8e0[_0xa53f('0x1c')]=_0x149e44;if(_0x17b3ed[_0xa53f('0x2c')][_0xa53f('0x3c')]){_0x2d8f94['include']=[{'all':!![]}];}return db['ZohoConfiguration'][_0xa53f('0x3d')](_0x2d8f94);})['then'](function(_0x4ed986){_0x76a8e0[_0xa53f('0x3e')]=_0x4ed986;return _0x76a8e0;})['then'](respondWithFilteredResult(_0x5ad08f,_0x2d8f94))[_0xa53f('0x3f')](handleError(_0x5ad08f,null));};exports[_0xa53f('0x40')]=function(_0x2b7e82,_0x3e055d){var _0x4d1014={'raw':![],'where':{'id':_0x2b7e82[_0xa53f('0x41')]['id']}},_0x4064d6={};_0x4064d6[_0xa53f('0x2f')]=_[_0xa53f('0x2b')](db[_0xa53f('0x26')][_0xa53f('0x27')]);_0x4064d6[_0xa53f('0x2c')]=_[_0xa53f('0x2b')](_0x2b7e82[_0xa53f('0x2c')]);_0x4064d6[_0xa53f('0x2d')]=_[_0xa53f('0x2e')](_0x4064d6[_0xa53f('0x2f')],_0x4064d6[_0xa53f('0x2c')]);_0x4d1014[_0xa53f('0x30')]=_[_0xa53f('0x2e')](_0x4064d6[_0xa53f('0x2f')],qs['fields'](_0x2b7e82[_0xa53f('0x2c')]['fields']));_0x4d1014['attributes']=_0x4d1014['attributes'][_0xa53f('0x32')]?_0x4d1014['attributes']:_0x4064d6['model'];if(_0x2b7e82[_0xa53f('0x2c')][_0xa53f('0x3c')]){_0x4d1014[_0xa53f('0x42')]=[{'all':!![]}];}_0x4d1014=_[_0xa53f('0x39')]({},_0x4d1014,_0x2b7e82['options']);return db[_0xa53f('0x26')][_0xa53f('0x43')](_0x4d1014)[_0xa53f('0x20')](handleEntityNotFound(_0x3e055d,null))[_0xa53f('0x20')](respondWithResult(_0x3e055d,null))[_0xa53f('0x3f')](handleError(_0x3e055d,null));};exports[_0xa53f('0x44')]=function(_0x89fdd8,_0x2b0127){return db[_0xa53f('0x26')][_0xa53f('0x44')](_0x89fdd8[_0xa53f('0x45')],{})[_0xa53f('0x20')](respondWithResult(_0x2b0127,0xc9))[_0xa53f('0x3f')](handleError(_0x2b0127,null));};exports[_0xa53f('0x46')]=function(_0x236568,_0x26939c){if(_0x236568[_0xa53f('0x45')]['id']){delete _0x236568[_0xa53f('0x45')]['id'];}return db[_0xa53f('0x26')]['find']({'where':{'id':_0x236568[_0xa53f('0x41')]['id']}})[_0xa53f('0x20')](handleEntityNotFound(_0x26939c,null))['then'](saveUpdates(_0x236568[_0xa53f('0x45')],null))['then'](respondWithResult(_0x26939c,null))[_0xa53f('0x3f')](handleError(_0x26939c,null));};exports[_0xa53f('0x21')]=function(_0x401921,_0xc2ee09){return db[_0xa53f('0x26')][_0xa53f('0x43')]({'where':{'id':_0x401921[_0xa53f('0x41')]['id']}})[_0xa53f('0x20')](handleEntityNotFound(_0xc2ee09,null))[_0xa53f('0x20')](removeEntity(_0xc2ee09,null))[_0xa53f('0x3f')](handleError(_0xc2ee09,null));};exports[_0xa53f('0x47')]=function(_0xd7ee6b,_0x407e2b,_0x5c2fa1){var _0x44bc4f={};var _0x1e1e31={};var _0x52a3da;var _0x11e989;return db[_0xa53f('0x26')][_0xa53f('0x48')]({'where':{'id':_0xd7ee6b[_0xa53f('0x41')]['id']}})['then'](handleEntityNotFound(_0x407e2b,null))['then'](function(_0x41d77d){if(_0x41d77d){_0x52a3da=_0x41d77d;_0x1e1e31[_0xa53f('0x2f')]=_[_0xa53f('0x2b')](db[_0xa53f('0x49')][_0xa53f('0x27')]);_0x1e1e31[_0xa53f('0x2c')]=_[_0xa53f('0x2b')](_0xd7ee6b[_0xa53f('0x2c')]);_0x1e1e31[_0xa53f('0x2d')]=_[_0xa53f('0x2e')](_0x1e1e31[_0xa53f('0x2f')],_0x1e1e31[_0xa53f('0x2c')]);_0x44bc4f[_0xa53f('0x30')]=_[_0xa53f('0x2e')](_0x1e1e31[_0xa53f('0x2f')],qs['fields'](_0xd7ee6b[_0xa53f('0x2c')]['fields']));_0x44bc4f[_0xa53f('0x30')]=_0x44bc4f[_0xa53f('0x30')][_0xa53f('0x32')]?_0x44bc4f[_0xa53f('0x30')]:_0x1e1e31['model'];_0x44bc4f[_0xa53f('0x35')]=qs[_0xa53f('0x36')](_0xd7ee6b['query'][_0xa53f('0x36')]);_0x44bc4f['where']=qs[_0xa53f('0x2d')](_[_0xa53f('0x4a')](_0xd7ee6b['query'],_0x1e1e31['filters']));if(_0xd7ee6b[_0xa53f('0x2c')][_0xa53f('0x38')]){_0x44bc4f['where']=_[_0xa53f('0x39')](_0x44bc4f['where'],{'$or':_[_0xa53f('0x2a')](_0x44bc4f[_0xa53f('0x30')],function(_0x3d44cd){var _0x5965da={};_0x5965da[_0x3d44cd]={'$like':'%'+_0xd7ee6b[_0xa53f('0x2c')]['filter']+'%'};return _0x5965da;})});}_0x44bc4f=_[_0xa53f('0x39')]({},_0x44bc4f,_0xd7ee6b[_0xa53f('0x3b')]);return _0x52a3da[_0xa53f('0x47')](_0x44bc4f);}})[_0xa53f('0x20')](function(_0x58f33d){if(_0x58f33d){_0x11e989=_0x58f33d['length'];if(!_0xd7ee6b['query'][_0xa53f('0x33')](_0xa53f('0x34'))){_0x44bc4f[_0xa53f('0x1a')]=qs[_0xa53f('0x1a')](_0xd7ee6b[_0xa53f('0x2c')][_0xa53f('0x1a')]);_0x44bc4f[_0xa53f('0x19')]=qs[_0xa53f('0x19')](_0xd7ee6b[_0xa53f('0x2c')][_0xa53f('0x19')]);}return _0x52a3da[_0xa53f('0x47')](_0x44bc4f);}})[_0xa53f('0x20')](function(_0x10b0b8){if(_0x10b0b8){return _0x10b0b8?{'count':_0x11e989,'rows':_0x10b0b8}:null;}})['then'](respondWithResult(_0x407e2b,null))['catch'](handleError(_0x407e2b,null));};exports[_0xa53f('0x4b')]=function(_0x248fe7,_0x18ff27,_0x52b3e8){var _0x52cf95={};var _0x3b5011={};var _0x9cb56f;var _0x531a3e;return db[_0xa53f('0x26')]['findOne']({'where':{'id':_0x248fe7[_0xa53f('0x41')]['id']}})[_0xa53f('0x20')](handleEntityNotFound(_0x18ff27,null))['then'](function(_0x29b9e7){if(_0x29b9e7){_0x9cb56f=_0x29b9e7;_0x3b5011[_0xa53f('0x2f')]=_['keys'](db[_0xa53f('0x49')][_0xa53f('0x27')]);_0x3b5011[_0xa53f('0x2c')]=_[_0xa53f('0x2b')](_0x248fe7[_0xa53f('0x2c')]);_0x3b5011[_0xa53f('0x2d')]=_[_0xa53f('0x2e')](_0x3b5011[_0xa53f('0x2f')],_0x3b5011['query']);_0x52cf95[_0xa53f('0x30')]=_[_0xa53f('0x2e')](_0x3b5011['model'],qs[_0xa53f('0x31')](_0x248fe7[_0xa53f('0x2c')][_0xa53f('0x31')]));_0x52cf95[_0xa53f('0x30')]=_0x52cf95[_0xa53f('0x30')][_0xa53f('0x32')]?_0x52cf95[_0xa53f('0x30')]:_0x3b5011['model'];_0x52cf95[_0xa53f('0x35')]=qs['sort'](_0x248fe7[_0xa53f('0x2c')][_0xa53f('0x36')]);_0x52cf95[_0xa53f('0x37')]=qs[_0xa53f('0x2d')](_[_0xa53f('0x4a')](_0x248fe7[_0xa53f('0x2c')],_0x3b5011['filters']));if(_0x248fe7['query'][_0xa53f('0x38')]){_0x52cf95['where']=_[_0xa53f('0x39')](_0x52cf95[_0xa53f('0x37')],{'$or':_[_0xa53f('0x2a')](_0x52cf95[_0xa53f('0x30')],function(_0x320ca9){var _0x127c46={};_0x127c46[_0x320ca9]={'$like':'%'+_0x248fe7[_0xa53f('0x2c')][_0xa53f('0x38')]+'%'};return _0x127c46;})});}_0x52cf95=_[_0xa53f('0x39')]({},_0x52cf95,_0x248fe7[_0xa53f('0x3b')]);return _0x9cb56f[_0xa53f('0x4b')](_0x52cf95);}})[_0xa53f('0x20')](function(_0x49a5d9){if(_0x49a5d9){_0x531a3e=_0x49a5d9[_0xa53f('0x32')];if(!_0x248fe7[_0xa53f('0x2c')]['hasOwnProperty'](_0xa53f('0x34'))){_0x52cf95[_0xa53f('0x1a')]=qs[_0xa53f('0x1a')](_0x248fe7[_0xa53f('0x2c')][_0xa53f('0x1a')]);_0x52cf95['offset']=qs[_0xa53f('0x19')](_0x248fe7['query'][_0xa53f('0x19')]);}return _0x9cb56f[_0xa53f('0x4b')](_0x52cf95);}})[_0xa53f('0x20')](function(_0x5a3b59){if(_0x5a3b59){return _0x5a3b59?{'count':_0x531a3e,'rows':_0x5a3b59}:null;}})[_0xa53f('0x20')](respondWithResult(_0x18ff27,null))[_0xa53f('0x3f')](handleError(_0x18ff27,null));};exports[_0xa53f('0x4c')]=function(_0x4babc7,_0x539047,_0x13dbdf){var _0x7308a1={};var _0xd23985={};var _0x1388dd;var _0x33c5b2;return db[_0xa53f('0x26')][_0xa53f('0x48')]({'where':{'id':_0x4babc7[_0xa53f('0x41')]['id']}})[_0xa53f('0x20')](handleEntityNotFound(_0x539047,null))['then'](function(_0x4ab8af){if(_0x4ab8af){_0x1388dd=_0x4ab8af;_0xd23985[_0xa53f('0x2f')]=_[_0xa53f('0x2b')](db[_0xa53f('0x49')]['rawAttributes']);_0xd23985[_0xa53f('0x2c')]=_[_0xa53f('0x2b')](_0x4babc7['query']);_0xd23985['filters']=_['intersection'](_0xd23985['model'],_0xd23985[_0xa53f('0x2c')]);_0x7308a1[_0xa53f('0x30')]=_[_0xa53f('0x2e')](_0xd23985[_0xa53f('0x2f')],qs[_0xa53f('0x31')](_0x4babc7[_0xa53f('0x2c')]['fields']));_0x7308a1[_0xa53f('0x30')]=_0x7308a1[_0xa53f('0x30')][_0xa53f('0x32')]?_0x7308a1[_0xa53f('0x30')]:_0xd23985[_0xa53f('0x2f')];_0x7308a1[_0xa53f('0x35')]=qs[_0xa53f('0x36')](_0x4babc7['query'][_0xa53f('0x36')]);_0x7308a1[_0xa53f('0x37')]=qs['filters'](_[_0xa53f('0x4a')](_0x4babc7[_0xa53f('0x2c')],_0xd23985[_0xa53f('0x2d')]));if(_0x4babc7[_0xa53f('0x2c')][_0xa53f('0x38')]){_0x7308a1['where']=_[_0xa53f('0x39')](_0x7308a1['where'],{'$or':_['map'](_0x7308a1[_0xa53f('0x30')],function(_0x333083){var _0x14dfcd={};_0x14dfcd[_0x333083]={'$like':'%'+_0x4babc7[_0xa53f('0x2c')][_0xa53f('0x38')]+'%'};return _0x14dfcd;})});}_0x7308a1=_[_0xa53f('0x39')]({},_0x7308a1,_0x4babc7[_0xa53f('0x3b')]);return _0x1388dd[_0xa53f('0x4c')](_0x7308a1);}})[_0xa53f('0x20')](function(_0x223cc1){if(_0x223cc1){_0x33c5b2=_0x223cc1[_0xa53f('0x32')];if(!_0x4babc7[_0xa53f('0x2c')]['hasOwnProperty']('nolimit')){_0x7308a1[_0xa53f('0x1a')]=qs[_0xa53f('0x1a')](_0x4babc7['query'][_0xa53f('0x1a')]);_0x7308a1[_0xa53f('0x19')]=qs[_0xa53f('0x19')](_0x4babc7[_0xa53f('0x2c')][_0xa53f('0x19')]);}return _0x1388dd[_0xa53f('0x4c')](_0x7308a1);}})['then'](function(_0x1cc39f){if(_0x1cc39f){return _0x1cc39f?{'count':_0x33c5b2,'rows':_0x1cc39f}:null;}})[_0xa53f('0x20')](respondWithResult(_0x539047,null))[_0xa53f('0x3f')](handleError(_0x539047,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index deba406..dfc6352 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 _0xf746=['util','../../config/logger','bluebird','request-promise','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','lodash'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xf746,0x18f));var _0x6f74=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xf746[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x6f74('0x0'));var util=require(_0x6f74('0x1'));var logger=require(_0x6f74('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6f74('0x3'));var rp=require(_0x6f74('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6f74('0x5'));var attributes=require(_0x6f74('0x6'));module[_0x6f74('0x7')]=function(_0x44440d,_0x50bb8a){return _0x44440d[_0x6f74('0x8')](_0x6f74('0x9'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51a0=['moment','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api'];(function(_0x560408,_0x45c914){var _0x3fd4da=function(_0x47e9a9){while(--_0x47e9a9){_0x560408['push'](_0x560408['shift']());}};_0x3fd4da(++_0x45c914);}(_0x51a0,0x7f));var _0x051a=function(_0x384447,_0x41669a){_0x384447=_0x384447-0x0;var _0x3810db=_0x51a0[_0x384447];return _0x3810db;};'use strict';var _=require('lodash');var util=require(_0x051a('0x0'));var logger=require(_0x051a('0x1'))(_0x051a('0x2'));var moment=require(_0x051a('0x3'));var BPromise=require('bluebird');var rp=require(_0x051a('0x4'));var fs=require('fs');var path=require(_0x051a('0x5'));var rimraf=require(_0x051a('0x6'));var config=require(_0x051a('0x7'));var attributes=require(_0x051a('0x8'));module[_0x051a('0x9')]=function(_0x3830a8,_0x503539){return _0x3830a8[_0x051a('0xa')](_0x051a('0xb'),attributes,{'tableName':_0x051a('0xc'),'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 0c56487..cdaaef2 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 _0xa6ba=['jayson/promise','client','request','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x1ae2f3,_0x23b31f){var _0x38b8d5=function(_0x1a8df6){while(--_0x1a8df6){_0x1ae2f3['push'](_0x1ae2f3['shift']());}};_0x38b8d5(++_0x23b31f);}(_0xa6ba,0x176));var _0xaa6b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa6ba[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xaa6b('0x0'));var util=require('util');var moment=require(_0xaa6b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa6b('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaa6b('0x3'))(_0xaa6b('0x4'));var config=require(_0xaa6b('0x5'));var jayson=require(_0xaa6b('0x6'));var client=jayson[_0xaa6b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf8a78b,_0x302c60,_0x3323df){return new BPromise(function(_0x158091,_0x74651){return client[_0xaa6b('0x8')](_0xf8a78b,_0x3323df)['then'](function(_0x93af3b){logger[_0xaa6b('0x9')](_0xaa6b('0xa'),_0x302c60,'request\x20sent');logger[_0xaa6b('0xb')](_0xaa6b('0xc'),_0x302c60,_0xaa6b('0xd'),JSON[_0xaa6b('0xe')](_0x93af3b));if(_0x93af3b[_0xaa6b('0xf')]){if(_0x93af3b['error'][_0xaa6b('0x10')]===0x1f4){logger[_0xaa6b('0xf')](_0xaa6b('0xa'),_0x302c60,_0x93af3b[_0xaa6b('0xf')]['message']);return _0x74651(_0x93af3b[_0xaa6b('0xf')][_0xaa6b('0x11')]);}logger['error'](_0xaa6b('0xa'),_0x302c60,_0x93af3b['error']['message']);return _0x158091(_0x93af3b['error'][_0xaa6b('0x11')]);}else{logger[_0xaa6b('0x9')]('ZohoConfiguration,\x20%s,\x20%s',_0x302c60,_0xaa6b('0xd'));_0x158091(_0x93af3b[_0xaa6b('0x12')][_0xaa6b('0x11')]);}})[_0xaa6b('0x13')](function(_0x1c06ed){logger[_0xaa6b('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x302c60,_0x1c06ed);_0x74651(_0x1c06ed);});});} \ No newline at end of file +var _0x8b47=['stringify','error','code','message','ZohoConfiguration,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8b47,0x93));var _0x78b4=function(_0x212052,_0xa2d8c0){_0x212052=_0x212052-0x0;var _0x135135=_0x8b47[_0x212052];return _0x135135;};'use strict';var _=require('lodash');var util=require(_0x78b4('0x0'));var moment=require(_0x78b4('0x1'));var BPromise=require(_0x78b4('0x2'));var rs=require(_0x78b4('0x3'));var fs=require('fs');var Redis=require(_0x78b4('0x4'));var db=require(_0x78b4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x78b4('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21a36a,_0x41c289,_0x167d94){return new BPromise(function(_0x2c612d,_0x4e3f67){return client[_0x78b4('0x7')](_0x21a36a,_0x167d94)[_0x78b4('0x8')](function(_0x6d837f){logger[_0x78b4('0x9')]('ZohoConfiguration,\x20%s,\x20%s',_0x41c289,_0x78b4('0xa'));logger[_0x78b4('0xb')](_0x78b4('0xc'),_0x41c289,_0x78b4('0xa'),JSON[_0x78b4('0xd')](_0x6d837f));if(_0x6d837f[_0x78b4('0xe')]){if(_0x6d837f[_0x78b4('0xe')][_0x78b4('0xf')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x41c289,_0x6d837f[_0x78b4('0xe')]['message']);return _0x4e3f67(_0x6d837f[_0x78b4('0xe')][_0x78b4('0x10')]);}logger[_0x78b4('0xe')](_0x78b4('0x11'),_0x41c289,_0x6d837f[_0x78b4('0xe')][_0x78b4('0x10')]);return _0x2c612d(_0x6d837f[_0x78b4('0xe')][_0x78b4('0x10')]);}else{logger[_0x78b4('0x9')](_0x78b4('0x11'),_0x41c289,_0x78b4('0xa'));_0x2c612d(_0x6d837f[_0x78b4('0x12')][_0x78b4('0x10')]);}})[_0x78b4('0x13')](function(_0x2b9bfd){logger[_0x78b4('0xe')](_0x78b4('0x11'),_0x41c289,_0x2b9bfd);_0x4e3f67(_0x2b9bfd);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 7550224..50d6f3a 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 _0xd304=['show','post','create','delete','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','isAuthenticated','index','get','/:id'];(function(_0x768458,_0x3d0933){var _0x31385c=function(_0xf11dad){while(--_0xf11dad){_0x768458['push'](_0x768458['shift']());}};_0x31385c(++_0x3d0933);}(_0xd304,0x1b7));var _0x4d30=function(_0xc0adfc,_0x11c8b3){_0xc0adfc=_0xc0adfc-0x0;var _0x3514bf=_0xd304[_0xc0adfc];return _0x3514bf;};'use strict';var multer=require('multer');var util=require(_0x4d30('0x0'));var path=require('path');var timeout=require(_0x4d30('0x1'));var express=require(_0x4d30('0x2'));var router=express[_0x4d30('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4d30('0x4'));var interaction=require(_0x4d30('0x5'));var config=require('../../config/environment');var controller=require(_0x4d30('0x6'));router['get']('/',auth[_0x4d30('0x7')](),controller[_0x4d30('0x8')]);router[_0x4d30('0x9')](_0x4d30('0xa'),auth[_0x4d30('0x7')](),controller[_0x4d30('0xb')]);router[_0x4d30('0xc')]('/',auth['isAuthenticated'](),controller[_0x4d30('0xd')]);router['put'](_0x4d30('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x4d30('0xe')](_0x4d30('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xff5f=['show','post','create','put','/:id','update','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xff5f,0x128));var _0xfff5=function(_0x3e9d3b,_0x17fa42){_0x3e9d3b=_0x3e9d3b-0x0;var _0x39b3ce=_0xff5f[_0x3e9d3b];return _0x39b3ce;};'use strict';var multer=require(_0xfff5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfff5('0x1'));var express=require(_0xfff5('0x2'));var router=express['Router']();var fs_extra=require(_0xfff5('0x3'));var auth=require(_0xfff5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfff5('0x5'));var controller=require(_0xfff5('0x6'));router[_0xfff5('0x7')]('/',auth[_0xfff5('0x8')](),controller[_0xfff5('0x9')]);router[_0xfff5('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xfff5('0xa')]);router[_0xfff5('0xb')]('/',auth[_0xfff5('0x8')](),controller[_0xfff5('0xc')]);router[_0xfff5('0xd')](_0xfff5('0xe'),auth[_0xfff5('0x8')](),controller[_0xfff5('0xf')]);router['delete']('/:id',auth[_0xfff5('0x8')](),controller['destroy']);module[_0xfff5('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 20fab10..15d245a 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 _0x1bf5=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x581f56,_0x161d2f){var _0x5dd57f=function(_0x5774c9){while(--_0x5774c9){_0x581f56['push'](_0x581f56['shift']());}};_0x5dd57f(++_0x161d2f);}(_0x1bf5,0xeb));var _0x51bf=function(_0x38864a,_0x2871f3){_0x38864a=_0x38864a-0x0;var _0x484fb9=_0x1bf5[_0x38864a];return _0x484fb9;};'use strict';var Sequelize=require(_0x51bf('0x0'));module[_0x51bf('0x1')]={'type':{'type':Sequelize[_0x51bf('0x2')](_0x51bf('0x3'),_0x51bf('0x4'),_0x51bf('0x5'),_0x51bf('0x6'),_0x51bf('0x7')),'defaultValue':_0x51bf('0x3')},'content':{'type':Sequelize[_0x51bf('0x8')]},'key':{'type':Sequelize[_0x51bf('0x8')]},'keyType':{'type':Sequelize[_0x51bf('0x2')](_0x51bf('0x3'),_0x51bf('0x4'),_0x51bf('0x5'))},'keyContent':{'type':Sequelize[_0x51bf('0x8')]},'idField':{'type':Sequelize[_0x51bf('0x8')]},'nameField':{'type':Sequelize[_0x51bf('0x8')]},'customField':{'type':Sequelize[_0x51bf('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x51bf('0x8')]}}; \ No newline at end of file +var _0xcdd0=['picklist','string','STRING','BOOLEAN','exports','ENUM','customVariable','keyValue'];(function(_0x30b14f,_0x3d0c49){var _0x38c663=function(_0x354638){while(--_0x354638){_0x30b14f['push'](_0x30b14f['shift']());}};_0x38c663(++_0x3d0c49);}(_0xcdd0,0x1dc));var _0x0cdd=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xcdd0[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require('sequelize');module[_0x0cdd('0x0')]={'type':{'type':Sequelize[_0x0cdd('0x1')]('string','variable',_0x0cdd('0x2'),_0x0cdd('0x3'),_0x0cdd('0x4')),'defaultValue':_0x0cdd('0x5')},'content':{'type':Sequelize[_0x0cdd('0x6')]},'key':{'type':Sequelize[_0x0cdd('0x6')]},'keyType':{'type':Sequelize[_0x0cdd('0x1')](_0x0cdd('0x5'),'variable',_0x0cdd('0x2'))},'keyContent':{'type':Sequelize[_0x0cdd('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0cdd('0x6')]},'customField':{'type':Sequelize[_0x0cdd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0cdd('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 6222228..4f39ccd 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 _0x0598=['merge','VIRTUAL','options','include','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','json','undefined','limit','count','offset','set','apply','update','destroy','then','end','error','stack','name','index','map','ZohoField','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter'];(function(_0x56138f,_0x1e9ebb){var _0x1acaf7=function(_0x48690d){while(--_0x48690d){_0x56138f['push'](_0x56138f['shift']());}};_0x1acaf7(++_0x1e9ebb);}(_0x0598,0x92));var _0x8059=function(_0x4ef401,_0x41403d){_0x4ef401=_0x4ef401-0x0;var _0x2b25fb=_0x0598[_0x4ef401];return _0x2b25fb;};'use strict';var emlformat=require(_0x8059('0x0'));var rimraf=require(_0x8059('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8059('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8059('0x3'));var Mustache=require(_0x8059('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8059('0x5'));var ejs=require(_0x8059('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8059('0x7'));var crypto=require(_0x8059('0x8'));var jsforce=require(_0x8059('0x9'));var deskjs=require(_0x8059('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8059('0xb'));var Redis=require(_0x8059('0xc'));var authService=require(_0x8059('0xd'));var qs=require(_0x8059('0xe'));var as=require(_0x8059('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8059('0x10'));var utils=require(_0x8059('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ead10,_0x2d26e2){_0x2d26e2=_0x2d26e2||0xcc;return function(_0x306467){if(_0x306467){return _0x1ead10[_0x8059('0x12')](_0x2d26e2);}return _0x1ead10[_0x8059('0x13')](_0x2d26e2)['end']();};}function respondWithResult(_0x11218f,_0x5480a5){_0x5480a5=_0x5480a5||0xc8;return function(_0x346b23){if(_0x346b23){return _0x11218f['status'](_0x5480a5)[_0x8059('0x14')](_0x346b23);}};}function respondWithFilteredResult(_0x13bf07,_0x4810fd){return function(_0x4d3873){if(_0x4d3873){var _0x516c1f=typeof _0x4810fd['offset']===_0x8059('0x15')&&typeof _0x4810fd[_0x8059('0x16')]===_0x8059('0x15');var _0x246c9d=_0x4d3873[_0x8059('0x17')];var _0x4b6d55=_0x516c1f?0x0:_0x4810fd[_0x8059('0x18')];var _0x2bb670=_0x516c1f?_0x4d3873[_0x8059('0x17')]:_0x4810fd[_0x8059('0x18')]+_0x4810fd['limit'];var _0x5456a9;if(_0x2bb670>=_0x246c9d){_0x2bb670=_0x246c9d;_0x5456a9=0xc8;}else{_0x5456a9=0xce;}_0x13bf07['status'](_0x5456a9);return _0x13bf07[_0x8059('0x19')]('Content-Range',_0x4b6d55+'-'+_0x2bb670+'/'+_0x246c9d)[_0x8059('0x14')](_0x4d3873);}return null;};}function patchUpdates(_0x56d794){return function(_0x466a88){try{jsonpatch[_0x8059('0x1a')](_0x466a88,_0x56d794,!![]);}catch(_0x1e9ac5){return BPromise['reject'](_0x1e9ac5);}return _0x466a88['save']();};}function saveUpdates(_0x21a80f,_0x232f1b){return function(_0x32aeda){if(_0x32aeda){return _0x32aeda[_0x8059('0x1b')](_0x21a80f)['then'](function(_0x3bc226){return _0x3bc226;});}return null;};}function removeEntity(_0x21ac82,_0x3da080){return function(_0x5449d9){if(_0x5449d9){return _0x5449d9[_0x8059('0x1c')]()[_0x8059('0x1d')](function(){_0x21ac82[_0x8059('0x13')](0xcc)[_0x8059('0x1e')]();});}};}function handleEntityNotFound(_0x59d3a6,_0x140f64){return function(_0x2cd179){if(!_0x2cd179){_0x59d3a6[_0x8059('0x12')](0x194);}return _0x2cd179;};}function handleError(_0x3e2d2b,_0x202b30){_0x202b30=_0x202b30||0x1f4;return function(_0x54b88b){logger[_0x8059('0x1f')](_0x54b88b[_0x8059('0x20')]);if(_0x54b88b[_0x8059('0x21')]){delete _0x54b88b['name'];}_0x3e2d2b['status'](_0x202b30)['send'](_0x54b88b);};}exports[_0x8059('0x22')]=function(_0xbebe0e,_0xc32b1f){var _0x1009af={},_0x59abe9={},_0x1eb71b={'count':0x0,'rows':[]};var _0x50b737=_[_0x8059('0x23')](db[_0x8059('0x24')]['rawAttributes'],function(_0x3814f5){return{'name':_0x3814f5[_0x8059('0x25')],'type':_0x3814f5[_0x8059('0x26')][_0x8059('0x27')]};});_0x59abe9[_0x8059('0x28')]=_[_0x8059('0x23')](_0x50b737,_0x8059('0x21'));_0x59abe9[_0x8059('0x29')]=_['keys'](_0xbebe0e[_0x8059('0x29')]);_0x59abe9[_0x8059('0x2a')]=_[_0x8059('0x2b')](_0x59abe9[_0x8059('0x28')],_0x59abe9[_0x8059('0x29')]);_0x1009af['attributes']=_[_0x8059('0x2b')](_0x59abe9[_0x8059('0x28')],qs[_0x8059('0x2c')](_0xbebe0e[_0x8059('0x29')][_0x8059('0x2c')]));_0x1009af[_0x8059('0x2d')]=_0x1009af[_0x8059('0x2d')][_0x8059('0x2e')]?_0x1009af[_0x8059('0x2d')]:_0x59abe9[_0x8059('0x28')];if(!_0xbebe0e['query'][_0x8059('0x2f')]('nolimit')){_0x1009af[_0x8059('0x16')]=qs['limit'](_0xbebe0e['query'][_0x8059('0x16')]);_0x1009af['offset']=qs[_0x8059('0x18')](_0xbebe0e['query'][_0x8059('0x18')]);}_0x1009af['order']=qs[_0x8059('0x30')](_0xbebe0e[_0x8059('0x29')]['sort']);_0x1009af[_0x8059('0x31')]=qs[_0x8059('0x2a')](_[_0x8059('0x32')](_0xbebe0e['query'],_0x59abe9[_0x8059('0x2a')]),_0x50b737);if(_0xbebe0e['query'][_0x8059('0x33')]){_0x1009af['where']=_[_0x8059('0x34')](_0x1009af[_0x8059('0x31')],{'$or':_[_0x8059('0x23')](_0x50b737,function(_0xb3b3c1){if(_0xb3b3c1['type']!==_0x8059('0x35')){var _0x55aaec={};_0x55aaec[_0xb3b3c1['name']]={'$like':'%'+_0xbebe0e[_0x8059('0x29')][_0x8059('0x33')]+'%'};return _0x55aaec;}})});}_0x1009af=_[_0x8059('0x34')]({},_0x1009af,_0xbebe0e[_0x8059('0x36')]);var _0x2f68b0={'where':_0x1009af['where']};return db['ZohoField']['count'](_0x2f68b0)['then'](function(_0x373e10){_0x1eb71b[_0x8059('0x17')]=_0x373e10;if(_0xbebe0e[_0x8059('0x29')]['includeAll']){_0x1009af[_0x8059('0x37')]=[{'all':!![]}];}return db[_0x8059('0x24')]['findAll'](_0x1009af);})[_0x8059('0x1d')](function(_0x2980cb){_0x1eb71b[_0x8059('0x38')]=_0x2980cb;return _0x1eb71b;})['then'](respondWithFilteredResult(_0xc32b1f,_0x1009af))[_0x8059('0x39')](handleError(_0xc32b1f,null));};exports[_0x8059('0x3a')]=function(_0x57eb56,_0x338493){var _0x280047={'raw':!![],'where':{'id':_0x57eb56[_0x8059('0x3b')]['id']}},_0x3f00de={};_0x3f00de[_0x8059('0x28')]=_[_0x8059('0x3c')](db[_0x8059('0x24')][_0x8059('0x3d')]);_0x3f00de[_0x8059('0x29')]=_[_0x8059('0x3c')](_0x57eb56[_0x8059('0x29')]);_0x3f00de[_0x8059('0x2a')]=_[_0x8059('0x2b')](_0x3f00de[_0x8059('0x28')],_0x3f00de[_0x8059('0x29')]);_0x280047[_0x8059('0x2d')]=_[_0x8059('0x2b')](_0x3f00de[_0x8059('0x28')],qs[_0x8059('0x2c')](_0x57eb56[_0x8059('0x29')][_0x8059('0x2c')]));_0x280047[_0x8059('0x2d')]=_0x280047[_0x8059('0x2d')]['length']?_0x280047[_0x8059('0x2d')]:_0x3f00de['model'];if(_0x57eb56['query'][_0x8059('0x3e')]){_0x280047['include']=[{'all':!![]}];}_0x280047=_[_0x8059('0x34')]({},_0x280047,_0x57eb56['options']);return db[_0x8059('0x24')][_0x8059('0x3f')](_0x280047)[_0x8059('0x1d')](handleEntityNotFound(_0x338493,null))[_0x8059('0x1d')](respondWithResult(_0x338493,null))[_0x8059('0x39')](handleError(_0x338493,null));};exports[_0x8059('0x40')]=function(_0x538ab6,_0x301dca){return db['ZohoField'][_0x8059('0x40')](_0x538ab6[_0x8059('0x41')],{})[_0x8059('0x1d')](respondWithResult(_0x301dca,0xc9))['catch'](handleError(_0x301dca,null));};exports[_0x8059('0x1b')]=function(_0x120665,_0x46bec8){if(_0x120665[_0x8059('0x41')]['id']){delete _0x120665['body']['id'];}return db[_0x8059('0x24')][_0x8059('0x3f')]({'where':{'id':_0x120665[_0x8059('0x3b')]['id']}})['then'](handleEntityNotFound(_0x46bec8,null))[_0x8059('0x1d')](saveUpdates(_0x120665['body'],null))['then'](respondWithResult(_0x46bec8,null))[_0x8059('0x39')](handleError(_0x46bec8,null));};exports['destroy']=function(_0x20caa3,_0x54d2d2){return db[_0x8059('0x24')][_0x8059('0x3f')]({'where':{'id':_0x20caa3['params']['id']}})[_0x8059('0x1d')](handleEntityNotFound(_0x54d2d2,null))['then'](removeEntity(_0x54d2d2,null))[_0x8059('0x39')](handleError(_0x54d2d2,null));}; \ No newline at end of file +var _0x4a81=['then','error','stack','name','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','merge','filter','options','where','findAll','rows','catch','show','params','keys','length','includeAll','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','update'];(function(_0x21e6e7,_0x23e6bc){var _0x57c03d=function(_0x14412a){while(--_0x14412a){_0x21e6e7['push'](_0x21e6e7['shift']());}};_0x57c03d(++_0x23e6bc);}(_0x4a81,0x1e1));var _0x14a8=function(_0xee9673,_0x29b03a){_0xee9673=_0xee9673-0x0;var _0x506173=_0x4a81[_0xee9673];return _0x506173;};'use strict';var emlformat=require(_0x14a8('0x0'));var rimraf=require(_0x14a8('0x1'));var zipdir=require(_0x14a8('0x2'));var jsonpatch=require(_0x14a8('0x3'));var rp=require(_0x14a8('0x4'));var moment=require('moment');var BPromise=require(_0x14a8('0x5'));var Mustache=require(_0x14a8('0x6'));var util=require(_0x14a8('0x7'));var path=require(_0x14a8('0x8'));var sox=require(_0x14a8('0x9'));var csv=require(_0x14a8('0xa'));var ejs=require(_0x14a8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x14a8('0xc'));var jsforce=require(_0x14a8('0xd'));var deskjs=require(_0x14a8('0xe'));var toCsv=require(_0x14a8('0xa'));var querystring=require(_0x14a8('0xf'));var Papa=require('papaparse');var Redis=require(_0x14a8('0x10'));var authService=require(_0x14a8('0x11'));var qs=require(_0x14a8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x14a8('0x13'))(_0x14a8('0x14'));var utils=require(_0x14a8('0x15'));var config=require(_0x14a8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x14a8('0x17'))['db'];function respondWithStatusCode(_0x56bea9,_0x256613){_0x256613=_0x256613||0xcc;return function(_0x53409f){if(_0x53409f){return _0x56bea9[_0x14a8('0x18')](_0x256613);}return _0x56bea9[_0x14a8('0x19')](_0x256613)[_0x14a8('0x1a')]();};}function respondWithResult(_0x3d3b91,_0x1574c8){_0x1574c8=_0x1574c8||0xc8;return function(_0x3ee50b){if(_0x3ee50b){return _0x3d3b91['status'](_0x1574c8)[_0x14a8('0x1b')](_0x3ee50b);}};}function respondWithFilteredResult(_0x4a5f35,_0x19e5d0){return function(_0x36816e){if(_0x36816e){var _0x3a5125=typeof _0x19e5d0['offset']===_0x14a8('0x1c')&&typeof _0x19e5d0[_0x14a8('0x1d')]===_0x14a8('0x1c');var _0x4aec65=_0x36816e['count'];var _0x2f2b79=_0x3a5125?0x0:_0x19e5d0[_0x14a8('0x1e')];var _0x47e412=_0x3a5125?_0x36816e[_0x14a8('0x1f')]:_0x19e5d0[_0x14a8('0x1e')]+_0x19e5d0[_0x14a8('0x1d')];var _0x521113;if(_0x47e412>=_0x4aec65){_0x47e412=_0x4aec65;_0x521113=0xc8;}else{_0x521113=0xce;}_0x4a5f35[_0x14a8('0x19')](_0x521113);return _0x4a5f35[_0x14a8('0x20')](_0x14a8('0x21'),_0x2f2b79+'-'+_0x47e412+'/'+_0x4aec65)[_0x14a8('0x1b')](_0x36816e);}return null;};}function patchUpdates(_0x20474c){return function(_0x1d8b74){try{jsonpatch[_0x14a8('0x22')](_0x1d8b74,_0x20474c,!![]);}catch(_0x18d360){return BPromise['reject'](_0x18d360);}return _0x1d8b74[_0x14a8('0x23')]();};}function saveUpdates(_0x2711ef,_0x1acb54){return function(_0xcd0813){if(_0xcd0813){return _0xcd0813[_0x14a8('0x24')](_0x2711ef)[_0x14a8('0x25')](function(_0xbeeffe){return _0xbeeffe;});}return null;};}function removeEntity(_0x3d562c,_0x1bef52){return function(_0x1fb31c){if(_0x1fb31c){return _0x1fb31c['destroy']()[_0x14a8('0x25')](function(){_0x3d562c[_0x14a8('0x19')](0xcc)[_0x14a8('0x1a')]();});}};}function handleEntityNotFound(_0x32155f,_0x431253){return function(_0x3e3791){if(!_0x3e3791){_0x32155f[_0x14a8('0x18')](0x194);}return _0x3e3791;};}function handleError(_0xd840c7,_0x50fdd2){_0x50fdd2=_0x50fdd2||0x1f4;return function(_0x10e5df){logger[_0x14a8('0x26')](_0x10e5df[_0x14a8('0x27')]);if(_0x10e5df[_0x14a8('0x28')]){delete _0x10e5df['name'];}_0xd840c7['status'](_0x50fdd2)['send'](_0x10e5df);};}exports[_0x14a8('0x29')]=function(_0xd59dc,_0x33bbce){var _0xb27fc8={},_0x2323a5={},_0x26d91c={'count':0x0,'rows':[]};var _0x4741e5=_[_0x14a8('0x2a')](db[_0x14a8('0x2b')][_0x14a8('0x2c')],function(_0xc0ac58){return{'name':_0xc0ac58[_0x14a8('0x2d')],'type':_0xc0ac58[_0x14a8('0x2e')][_0x14a8('0x2f')]};});_0x2323a5[_0x14a8('0x30')]=_['map'](_0x4741e5,_0x14a8('0x28'));_0x2323a5[_0x14a8('0x31')]=_['keys'](_0xd59dc[_0x14a8('0x31')]);_0x2323a5[_0x14a8('0x32')]=_[_0x14a8('0x33')](_0x2323a5[_0x14a8('0x30')],_0x2323a5[_0x14a8('0x31')]);_0xb27fc8['attributes']=_['intersection'](_0x2323a5[_0x14a8('0x30')],qs[_0x14a8('0x34')](_0xd59dc[_0x14a8('0x31')]['fields']));_0xb27fc8[_0x14a8('0x35')]=_0xb27fc8[_0x14a8('0x35')]['length']?_0xb27fc8[_0x14a8('0x35')]:_0x2323a5[_0x14a8('0x30')];if(!_0xd59dc['query'][_0x14a8('0x36')](_0x14a8('0x37'))){_0xb27fc8[_0x14a8('0x1d')]=qs[_0x14a8('0x1d')](_0xd59dc[_0x14a8('0x31')][_0x14a8('0x1d')]);_0xb27fc8['offset']=qs[_0x14a8('0x1e')](_0xd59dc['query'][_0x14a8('0x1e')]);}_0xb27fc8['order']=qs[_0x14a8('0x38')](_0xd59dc[_0x14a8('0x31')][_0x14a8('0x38')]);_0xb27fc8['where']=qs[_0x14a8('0x32')](_['pick'](_0xd59dc[_0x14a8('0x31')],_0x2323a5['filters']),_0x4741e5);if(_0xd59dc[_0x14a8('0x31')]['filter']){_0xb27fc8['where']=_[_0x14a8('0x39')](_0xb27fc8['where'],{'$or':_[_0x14a8('0x2a')](_0x4741e5,function(_0x368a59){if(_0x368a59[_0x14a8('0x2e')]!=='VIRTUAL'){var _0x5e50db={};_0x5e50db[_0x368a59[_0x14a8('0x28')]]={'$like':'%'+_0xd59dc[_0x14a8('0x31')][_0x14a8('0x3a')]+'%'};return _0x5e50db;}})});}_0xb27fc8=_[_0x14a8('0x39')]({},_0xb27fc8,_0xd59dc[_0x14a8('0x3b')]);var _0x564ea1={'where':_0xb27fc8[_0x14a8('0x3c')]};return db[_0x14a8('0x2b')][_0x14a8('0x1f')](_0x564ea1)[_0x14a8('0x25')](function(_0x19b197){_0x26d91c['count']=_0x19b197;if(_0xd59dc[_0x14a8('0x31')]['includeAll']){_0xb27fc8['include']=[{'all':!![]}];}return db[_0x14a8('0x2b')][_0x14a8('0x3d')](_0xb27fc8);})[_0x14a8('0x25')](function(_0xb52d24){_0x26d91c[_0x14a8('0x3e')]=_0xb52d24;return _0x26d91c;})[_0x14a8('0x25')](respondWithFilteredResult(_0x33bbce,_0xb27fc8))[_0x14a8('0x3f')](handleError(_0x33bbce,null));};exports[_0x14a8('0x40')]=function(_0x33689e,_0x353ea7){var _0x2fbf9f={'raw':!![],'where':{'id':_0x33689e[_0x14a8('0x41')]['id']}},_0x215a6d={};_0x215a6d[_0x14a8('0x30')]=_[_0x14a8('0x42')](db[_0x14a8('0x2b')]['rawAttributes']);_0x215a6d[_0x14a8('0x31')]=_[_0x14a8('0x42')](_0x33689e[_0x14a8('0x31')]);_0x215a6d[_0x14a8('0x32')]=_[_0x14a8('0x33')](_0x215a6d[_0x14a8('0x30')],_0x215a6d[_0x14a8('0x31')]);_0x2fbf9f[_0x14a8('0x35')]=_[_0x14a8('0x33')](_0x215a6d['model'],qs[_0x14a8('0x34')](_0x33689e[_0x14a8('0x31')]['fields']));_0x2fbf9f[_0x14a8('0x35')]=_0x2fbf9f[_0x14a8('0x35')][_0x14a8('0x43')]?_0x2fbf9f[_0x14a8('0x35')]:_0x215a6d[_0x14a8('0x30')];if(_0x33689e[_0x14a8('0x31')][_0x14a8('0x44')]){_0x2fbf9f[_0x14a8('0x45')]=[{'all':!![]}];}_0x2fbf9f=_[_0x14a8('0x39')]({},_0x2fbf9f,_0x33689e[_0x14a8('0x3b')]);return db[_0x14a8('0x2b')][_0x14a8('0x46')](_0x2fbf9f)[_0x14a8('0x25')](handleEntityNotFound(_0x353ea7,null))[_0x14a8('0x25')](respondWithResult(_0x353ea7,null))['catch'](handleError(_0x353ea7,null));};exports[_0x14a8('0x47')]=function(_0x4e7b5d,_0xc12e68){return db[_0x14a8('0x2b')][_0x14a8('0x47')](_0x4e7b5d[_0x14a8('0x48')],{})['then'](respondWithResult(_0xc12e68,0xc9))[_0x14a8('0x3f')](handleError(_0xc12e68,null));};exports[_0x14a8('0x24')]=function(_0x3c26e7,_0x465042){if(_0x3c26e7['body']['id']){delete _0x3c26e7[_0x14a8('0x48')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x3c26e7[_0x14a8('0x41')]['id']}})[_0x14a8('0x25')](handleEntityNotFound(_0x465042,null))[_0x14a8('0x25')](saveUpdates(_0x3c26e7[_0x14a8('0x48')],null))['then'](respondWithResult(_0x465042,null))[_0x14a8('0x3f')](handleError(_0x465042,null));};exports[_0x14a8('0x49')]=function(_0x1e0c7b,_0x46751e){return db[_0x14a8('0x2b')]['find']({'where':{'id':_0x1e0c7b[_0x14a8('0x41')]['id']}})[_0x14a8('0x25')](handleEntityNotFound(_0x46751e,null))[_0x14a8('0x25')](removeEntity(_0x46751e,null))['catch'](handleError(_0x46751e,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index cab6808..0e6735d 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 _0x7046=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','ZohoField','idField'];(function(_0x3c0c99,_0x97ad9e){var _0x2c5fa0=function(_0x497c9a){while(--_0x497c9a){_0x3c0c99['push'](_0x3c0c99['shift']());}};_0x2c5fa0(++_0x97ad9e);}(_0x7046,0x144));var _0x6704=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7046[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));module[_0x6704('0x9')]=function(_0x626a14,_0x2917be){return _0x626a14['define'](_0x6704('0xa'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x6704('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe2fe=['zoho_unique_index','FieldId','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZohoField'];(function(_0x34a4fd,_0x5c07f2){var _0xf89bcb=function(_0x575bbe){while(--_0x575bbe){_0x34a4fd['push'](_0x34a4fd['shift']());}};_0xf89bcb(++_0x5c07f2);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intZohoField.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xee2f('0xa'),'fields':['idField',_0xee2f('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index dbb330e..e6308c3 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 _0xacd9=['http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x52761a,_0x5e3bcf){var _0x63a58f=function(_0x17aad0){while(--_0x17aad0){_0x52761a['push'](_0x52761a['shift']());}};_0x63a58f(++_0x5e3bcf);}(_0xacd9,0x170));var _0x9acd=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xacd9[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x9acd('0x0'));var util=require(_0x9acd('0x1'));var moment=require(_0x9acd('0x2'));var BPromise=require('bluebird');var rs=require(_0x9acd('0x3'));var fs=require('fs');var Redis=require(_0x9acd('0x4'));var db=require(_0x9acd('0x5'))['db'];var utils=require(_0x9acd('0x6'));var logger=require(_0x9acd('0x7'))(_0x9acd('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9acd('0x9')][_0x9acd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36b746,_0x2871d6,_0x15fbc6){return new BPromise(function(_0x249746,_0x1e7d3a){return client['request'](_0x36b746,_0x15fbc6)[_0x9acd('0xb')](function(_0x49a600){logger[_0x9acd('0xc')](_0x9acd('0xd'),_0x2871d6,_0x9acd('0xe'));logger[_0x9acd('0xf')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x2871d6,'request\x20sent',JSON[_0x9acd('0x10')](_0x49a600));if(_0x49a600[_0x9acd('0x11')]){if(_0x49a600[_0x9acd('0x11')][_0x9acd('0x12')]===0x1f4){logger[_0x9acd('0x11')](_0x9acd('0xd'),_0x2871d6,_0x49a600[_0x9acd('0x11')][_0x9acd('0x13')]);return _0x1e7d3a(_0x49a600[_0x9acd('0x11')][_0x9acd('0x13')]);}logger[_0x9acd('0x11')](_0x9acd('0xd'),_0x2871d6,_0x49a600[_0x9acd('0x11')]['message']);return _0x249746(_0x49a600[_0x9acd('0x11')][_0x9acd('0x13')]);}else{logger[_0x9acd('0xc')](_0x9acd('0xd'),_0x2871d6,_0x9acd('0xe'));_0x249746(_0x49a600['result'][_0x9acd('0x13')]);}})[_0x9acd('0x14')](function(_0x4476af){logger['error'](_0x9acd('0xd'),_0x2871d6,_0x4476af);_0x1e7d3a(_0x4476af);});});} \ No newline at end of file +var _0x6834=['request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s'];(function(_0x27d2f6,_0x290a26){var _0x3281c7=function(_0x139a45){while(--_0x139a45){_0x27d2f6['push'](_0x27d2f6['shift']());}};_0x3281c7(++_0x290a26);}(_0x6834,0x15b));var _0x4683=function(_0x5cd7fe,_0x382ebf){_0x5cd7fe=_0x5cd7fe-0x0;var _0x36fc08=_0x6834[_0x5cd7fe];return _0x36fc08;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4683('0x0'));var BPromise=require(_0x4683('0x1'));var rs=require(_0x4683('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4683('0x3'))['db'];var utils=require(_0x4683('0x4'));var logger=require(_0x4683('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4683('0x6'));var client=jayson[_0x4683('0x7')][_0x4683('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40f849,_0x496d04,_0x6cfd38){return new BPromise(function(_0x38ad12,_0x26a1cc){return client[_0x4683('0x9')](_0x40f849,_0x6cfd38)[_0x4683('0xa')](function(_0x12e6c1){logger[_0x4683('0xb')](_0x4683('0xc'),_0x496d04,'request\x20sent');logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x496d04,_0x4683('0xd'),JSON[_0x4683('0xe')](_0x12e6c1));if(_0x12e6c1[_0x4683('0xf')]){if(_0x12e6c1[_0x4683('0xf')][_0x4683('0x10')]===0x1f4){logger[_0x4683('0xf')](_0x4683('0xc'),_0x496d04,_0x12e6c1[_0x4683('0xf')][_0x4683('0x11')]);return _0x26a1cc(_0x12e6c1['error']['message']);}logger[_0x4683('0xf')]('ZohoField,\x20%s,\x20%s',_0x496d04,_0x12e6c1['error'][_0x4683('0x11')]);return _0x38ad12(_0x12e6c1[_0x4683('0xf')][_0x4683('0x11')]);}else{logger[_0x4683('0xb')]('ZohoField,\x20%s,\x20%s',_0x496d04,_0x4683('0xd'));_0x38ad12(_0x12e6c1[_0x4683('0x12')][_0x4683('0x11')]);}})[_0x4683('0x13')](function(_0x43f412){logger['error'](_0x4683('0xc'),_0x496d04,_0x43f412);_0x26a1cc(_0x43f412);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 626cd69..1dbd78b 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1840b7,_0x2509a0){var _0x333ae3=function(_0x3c0f3f){while(--_0x3c0f3f){_0x1840b7['push'](_0x1840b7['shift']());}};_0x333ae3(++_0x2509a0);}(_0xedd9,0xfc));var _0x9edd=function(_0x12b95a,_0x38c1a2){_0x12b95a=_0x12b95a-0x0;var _0x52eb24=_0xedd9[_0x12b95a];return _0x52eb24;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x35fb7c,_0x4ee512){var _0x3b319e=function(_0x381eaa){while(--_0x381eaa){_0x35fb7c['push'](_0x35fb7c['shift']());}};_0x3b319e(++_0x4ee512);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 5bd9e3b..7d7c9c8 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 _0x78f5=['STRING','unique_name_and_version','state','sequelize','exports'];(function(_0x421a66,_0x75318f){var _0x20dc34=function(_0x1921c9){while(--_0x1921c9){_0x421a66['push'](_0x421a66['shift']());}};_0x20dc34(++_0x75318f);}(_0x78f5,0xbc));var _0x578f=function(_0x1353bc,_0x432b07){_0x1353bc=_0x1353bc-0x0;var _0x3097a6=_0x78f5[_0x1353bc];return _0x3097a6;};'use strict';var Sequelize=require(_0x578f('0x0'));module[_0x578f('0x1')]={'name':{'type':Sequelize[_0x578f('0x2')],'allowNull':![],'unique':_0x578f('0x3')},'version':{'type':Sequelize[_0x578f('0x2')],'allowNull':![],'unique':_0x578f('0x3')},'main':{'type':Sequelize[_0x578f('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x578f('0x2')]},'path':{'type':Sequelize[_0x578f('0x2')]},'type':{'type':Sequelize[_0x578f('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x578f('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x578f('0x2')],'unique':_0x578f('0x4')},'description':{'type':Sequelize[_0x578f('0x2')]},'title':{'type':Sequelize[_0x578f('0x2')]},'remoteUri':{'type':Sequelize[_0x578f('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xc6fe=['app.js','INTEGER','BOOLEAN','state','sequelize','exports','unique_name_and_version','STRING'];(function(_0x420b27,_0x1fbc09){var _0x5ef401=function(_0xea9016){while(--_0xea9016){_0x420b27['push'](_0x420b27['shift']());}};_0x5ef401(++_0x1fbc09);}(_0xc6fe,0xbc));var _0xec6f=function(_0x1196c0,_0xbbaef){_0x1196c0=_0x1196c0-0x0;var _0x54c3b7=_0xc6fe[_0x1196c0];return _0x54c3b7;};'use strict';var Sequelize=require(_0xec6f('0x0'));module[_0xec6f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xec6f('0x2')},'version':{'type':Sequelize[_0xec6f('0x3')],'allowNull':![],'unique':_0xec6f('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xec6f('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xec6f('0x3')]},'type':{'type':Sequelize[_0xec6f('0x3')]},'size':{'type':Sequelize[_0xec6f('0x5')]},'active':{'type':Sequelize[_0xec6f('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xec6f('0x3')]},'logo':{'type':Sequelize[_0xec6f('0x3')]},'state':{'type':Sequelize[_0xec6f('0x3')],'unique':_0xec6f('0x7')},'description':{'type':Sequelize[_0xec6f('0x3')]},'title':{'type':Sequelize[_0xec6f('0x3')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xec6f('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 52c927a..e8b96f2 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb016=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','Integration','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','find','body'];(function(_0x16c638,_0x20a774){var _0x1700b7=function(_0x3d6a2b){while(--_0x3d6a2b){_0x16c638['push'](_0x16c638['shift']());}};_0x1700b7(++_0x20a774);}(_0xb016,0x159));var _0x6b01=function(_0x366e64,_0x47f720){_0x366e64=_0x366e64-0x0;var _0x175ca0=_0xb016[_0x366e64];return _0x175ca0;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['create']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['create'](_0x408bb0['body'],{})['then'](respondWithResult(_0x27442e,0xc9))[_0x6b01('0x40')](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x518d94,_0x34cef6){if(_0x518d94['body']['id']){delete _0x518d94['body']['id'];}return db['Integration'][_0x6b01('0x43')]({'where':{'id':_0x518d94[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x34cef6,null))['then'](saveUpdates(_0x518d94[_0x6b01('0x44')],null))['then'](respondWithResult(_0x34cef6,null))[_0x6b01('0x40')](handleError(_0x34cef6,null));};exports[_0x6b01('0x22')]=function(_0x32d446,_0x172a56){return db[_0x6b01('0x29')]['find']({'where':{'id':_0x32d446[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x172a56,null))[_0x6b01('0x21')](removeEntity(_0x172a56,null))['catch'](handleError(_0x172a56,null));}; \ No newline at end of file +var _0x430c=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2fca92,_0x42aa4f){var _0x3138c7=function(_0x19f425){while(--_0x19f425){_0x2fca92['push'](_0x2fca92['shift']());}};_0x3138c7(++_0x42aa4f);}(_0x430c,0x1a1));var _0xc430=function(_0x45ee03,_0x2f5319){_0x45ee03=_0x45ee03-0x0;var _0x13d535=_0x430c[_0x45ee03];return _0x13d535;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){_0x23425d['status'](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x59c498,_0x3aa85e){return function(_0x4b5280){if(!_0x4b5280){_0x59c498[_0xc430('0x14')](0x194);}return _0x4b5280;};}function handleError(_0x21e28a,_0x50110b){_0x50110b=_0x50110b||0x1f4;return function(_0x33433f){logger[_0xc430('0x20')](_0x33433f[_0xc430('0x21')]);if(_0x33433f[_0xc430('0x22')]){delete _0x33433f[_0xc430('0x22')];}_0x21e28a['status'](_0x50110b)[_0xc430('0x23')](_0x33433f);};}exports[_0xc430('0x24')]=function(_0x1c1da9,_0x1591e3){var _0x542cba={},_0x1f8086={},_0x4cf56c={'count':0x0,'rows':[]};var _0x1d65ee=_['map'](db[_0xc430('0x25')][_0xc430('0x26')],function(_0xfc8767){return{'name':_0xfc8767[_0xc430('0x27')],'type':_0xfc8767['type'][_0xc430('0x28')]};});_0x1f8086[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1d65ee,_0xc430('0x22'));_0x1f8086['query']=_[_0xc430('0x2b')](_0x1c1da9[_0xc430('0x2c')]);_0x1f8086['filters']=_[_0xc430('0x2d')](_0x1f8086['model'],_0x1f8086['query']);_0x542cba[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x1f8086[_0xc430('0x29')],qs[_0xc430('0x2f')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x2f')]));_0x542cba[_0xc430('0x2e')]=_0x542cba[_0xc430('0x2e')]['length']?_0x542cba[_0xc430('0x2e')]:_0x1f8086['model'];if(!_0x1c1da9[_0xc430('0x2c')][_0xc430('0x30')](_0xc430('0x31'))){_0x542cba[_0xc430('0x18')]=qs['limit'](_0x1c1da9[_0xc430('0x2c')]['limit']);_0x542cba['offset']=qs[_0xc430('0x1a')](_0x1c1da9[_0xc430('0x2c')]['offset']);}_0x542cba[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x33')]);_0x542cba[_0xc430('0x34')]=qs[_0xc430('0x35')](_[_0xc430('0x36')](_0x1c1da9[_0xc430('0x2c')],_0x1f8086[_0xc430('0x35')]),_0x1d65ee);if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x37')]){_0x542cba[_0xc430('0x34')]=_[_0xc430('0x38')](_0x542cba[_0xc430('0x34')],{'$or':_[_0xc430('0x2a')](_0x1d65ee,function(_0x537e4c){if(_0x537e4c[_0xc430('0x39')]!==_0xc430('0x3a')){var _0x24363b={};_0x24363b[_0x537e4c[_0xc430('0x22')]]={'$like':'%'+_0x1c1da9['query'][_0xc430('0x37')]+'%'};return _0x24363b;}})});}_0x542cba=_[_0xc430('0x38')]({},_0x542cba,_0x1c1da9[_0xc430('0x3b')]);var _0x45b3dc={'where':_0x542cba[_0xc430('0x34')]};return db[_0xc430('0x25')]['count'](_0x45b3dc)[_0xc430('0x1e')](function(_0x348f2f){_0x4cf56c[_0xc430('0x1b')]=_0x348f2f;if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x3c')]){_0x542cba[_0xc430('0x3d')]=[{'all':!![]}];}return db[_0xc430('0x25')][_0xc430('0x3e')](_0x542cba);})[_0xc430('0x1e')](function(_0x4174d2){_0x4cf56c[_0xc430('0x3f')]=_0x4174d2;return _0x4cf56c;})[_0xc430('0x1e')](respondWithFilteredResult(_0x1591e3,_0x542cba))[_0xc430('0x40')](handleError(_0x1591e3,null));};exports[_0xc430('0x41')]=function(_0x5a9c4b,_0x47edb0){var _0x4983e0={'raw':![],'where':{'id':_0x5a9c4b[_0xc430('0x42')]['id']}},_0x262063={};_0x262063[_0xc430('0x29')]=_[_0xc430('0x2b')](db[_0xc430('0x25')][_0xc430('0x26')]);_0x262063[_0xc430('0x2c')]=_[_0xc430('0x2b')](_0x5a9c4b[_0xc430('0x2c')]);_0x262063[_0xc430('0x35')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],_0x262063[_0xc430('0x2c')]);_0x4983e0[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],qs['fields'](_0x5a9c4b[_0xc430('0x2c')][_0xc430('0x2f')]));_0x4983e0[_0xc430('0x2e')]=_0x4983e0[_0xc430('0x2e')][_0xc430('0x43')]?_0x4983e0[_0xc430('0x2e')]:_0x262063[_0xc430('0x29')];if(_0x5a9c4b[_0xc430('0x2c')]['includeAll']){_0x4983e0[_0xc430('0x3d')]=[{'all':!![]}];}_0x4983e0=_['merge']({},_0x4983e0,_0x5a9c4b[_0xc430('0x3b')]);return db[_0xc430('0x25')]['find'](_0x4983e0)['then'](handleEntityNotFound(_0x47edb0,null))[_0xc430('0x1e')](respondWithResult(_0x47edb0,null))['catch'](handleError(_0x47edb0,null));};exports['create']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')](_0x10db27[_0xc430('0x45')],{})['then'](respondWithResult(_0x4eafae,0xc9))[_0xc430('0x40')](handleError(_0x4eafae,null));};exports[_0xc430('0x46')]=function(_0x19e563,_0x549400){if(_0x19e563[_0xc430('0x45')]['id']){delete _0x19e563[_0xc430('0x45')]['id'];}return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x19e563[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x549400,null))[_0xc430('0x1e')](saveUpdates(_0x19e563['body'],null))[_0xc430('0x1e')](respondWithResult(_0x549400,null))[_0xc430('0x40')](handleError(_0x549400,null));};exports[_0xc430('0x1f')]=function(_0x4e9aff,_0x23cb41){return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x4e9aff[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x23cb41,null))[_0xc430('0x1e')](removeEntity(_0x23cb41,null))['catch'](handleError(_0x23cb41,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 6e5fb82..496ee77 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 _0x2d7e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','Integration','integrations','lodash'];(function(_0x299f92,_0x220e6f){var _0x5eac69=function(_0x3cd695){while(--_0x3cd695){_0x299f92['push'](_0x299f92['shift']());}};_0x5eac69(++_0x220e6f);}(_0x2d7e,0x16b));var _0xe2d7=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0x2d7e[_0xf0bc07];return _0x1c50c2;};'use strict';var _=require(_0xe2d7('0x0'));var util=require(_0xe2d7('0x1'));var logger=require(_0xe2d7('0x2'))(_0xe2d7('0x3'));var moment=require(_0xe2d7('0x4'));var BPromise=require(_0xe2d7('0x5'));var rp=require(_0xe2d7('0x6'));var fs=require('fs');var path=require(_0xe2d7('0x7'));var rimraf=require(_0xe2d7('0x8'));var config=require(_0xe2d7('0x9'));var attributes=require(_0xe2d7('0xa'));module[_0xe2d7('0xb')]=function(_0x1f7821,_0x1a532f){return _0x1f7821['define'](_0xe2d7('0xc'),attributes,{'tableName':_0xe2d7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5a2=['define','Integration','lodash','util','api','moment','request-promise','path'];(function(_0x4b8df9,_0x296c4e){var _0x536d22=function(_0x332fe0){while(--_0x332fe0){_0x4b8df9['push'](_0x4b8df9['shift']());}};_0x536d22(++_0x296c4e);}(_0xa5a2,0x13a));var _0x2a5a=function(_0x3ded2b,_0x5b811c){_0x3ded2b=_0x3ded2b-0x0;var _0x15c09a=_0xa5a2[_0x3ded2b];return _0x15c09a;};'use strict';var _=require(_0x2a5a('0x0'));var util=require(_0x2a5a('0x1'));var logger=require('../../config/logger')(_0x2a5a('0x2'));var moment=require(_0x2a5a('0x3'));var BPromise=require('bluebird');var rp=require(_0x2a5a('0x4'));var fs=require('fs');var path=require(_0x2a5a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integration.attributes');module['exports']=function(_0x440e54,_0x376e58){return _0x440e54[_0x2a5a('0x6')](_0x2a5a('0x7'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 4cfccba..d2c9307 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x3d8240,_0x2663d4){var _0x3d0372=function(_0xc47c6b){while(--_0xc47c6b){_0x3d8240['push'](_0x3d8240['shift']());}};_0x3d0372(++_0x2663d4);}(_0x524e,0x15e));var _0xe524=function(_0x28c39a,_0x5e7bcf){_0x28c39a=_0x28c39a-0x0;var _0x21aa0c=_0x524e[_0x28c39a];return _0x21aa0c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('Integration,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('Integration,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('Integration,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0xd7d1=['info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x30f030,_0xd03b7a){var _0xf7614f=function(_0x261cac){while(--_0x261cac){_0x30f030['push'](_0x30f030['shift']());}};_0xf7614f(++_0xd03b7a);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x5ebcf7,_0x329709){_0x5ebcf7=_0x5ebcf7-0x0;var _0x1b657a=_0xd7d1[_0x5ebcf7];return _0x1b657a;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var BPromise=require(_0x1d7d('0x3'));var rs=require(_0x1d7d('0x4'));var fs=require('fs');var Redis=require(_0x1d7d('0x5'));var db=require(_0x1d7d('0x6'))['db'];var utils=require(_0x1d7d('0x7'));var logger=require(_0x1d7d('0x8'))(_0x1d7d('0x9'));var config=require(_0x1d7d('0xa'));var jayson=require(_0x1d7d('0xb'));var client=jayson[_0x1d7d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462ef8,_0x1aa456,_0x14dbf6){return new BPromise(function(_0x3675a2,_0xd6189e){return client[_0x1d7d('0xd')](_0x462ef8,_0x14dbf6)[_0x1d7d('0xe')](function(_0xa44223){logger[_0x1d7d('0xf')](_0x1d7d('0x10'),_0x1aa456,_0x1d7d('0x11'));logger['debug'](_0x1d7d('0x12'),_0x1aa456,'request\x20sent',JSON[_0x1d7d('0x13')](_0xa44223));if(_0xa44223[_0x1d7d('0x14')]){if(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x15')]===0x1f4){logger['error'](_0x1d7d('0x10'),_0x1aa456,_0xa44223['error']['message']);return _0xd6189e(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}logger['error']('Integration,\x20%s,\x20%s',_0x1aa456,_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);return _0x3675a2(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}else{logger[_0x1d7d('0xf')]('Integration,\x20%s,\x20%s',_0x1aa456,_0x1d7d('0x11'));_0x3675a2(_0xa44223[_0x1d7d('0x17')]['message']);}})[_0x1d7d('0x18')](function(_0x162c3a){logger[_0x1d7d('0x14')](_0x1d7d('0x10'),_0x1aa456,_0x162c3a);_0xd6189e(_0x162c3a);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 4ac6e8e..4326d85 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 _0x4137=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x4137,0xf8));var _0x7413=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4137[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x15')]=router; \ No newline at end of file +var _0x4137=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x4137,0xf8));var _0x7413=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4137[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 9db0c80..2f18a84 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 _0xf7c3=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED'];(function(_0x22ca5c,_0x5b957b){var _0x4a4557=function(_0x467029){while(--_0x467029){_0x22ca5c['push'](_0x22ca5c['shift']());}};_0x4a4557(++_0x5b957b);}(_0xf7c3,0x154));var _0x3f7c=function(_0x20bb9f,_0x236103){_0x20bb9f=_0x20bb9f-0x0;var _0x4d450f=_0xf7c3[_0x20bb9f];return _0x4d450f;};'use strict';var Sequelize=require(_0x3f7c('0x0'));module[_0x3f7c('0x1')]={'integration':{'type':Sequelize[_0x3f7c('0x2')]},'eventChannel':{'type':Sequelize[_0x3f7c('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x3f7c('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x3f7c('0x2')]},'uniqueid':{'type':Sequelize[_0x3f7c('0x2')]},'calleridnum':{'type':Sequelize[_0x3f7c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3f7c('0x2')]},'interface':{'type':Sequelize[_0x3f7c('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x3f7c('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x3f7c('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3f7c('0x3')]},'talktime':{'type':Sequelize[_0x3f7c('0x4')]},'agentacw':{'type':Sequelize[_0x3f7c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x3f7c('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x3f7c('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3f7c('0x3')]},'agentdump':{'type':Sequelize[_0x3f7c('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3f7c('0x2')]},'channelstate':{'type':Sequelize[_0x3f7c('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x3f7c('0x2')]},'connectedlinename':{'type':Sequelize[_0x3f7c('0x2')]},'language':{'type':Sequelize[_0x3f7c('0x2')]},'accountcode':{'type':Sequelize[_0x3f7c('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3f7c('0x2')]},'priority':{'type':Sequelize[_0x3f7c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x3f7c('0x2')]},'destcalleridname':{'type':Sequelize[_0x3f7c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x3f7c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3f7c('0x2')]},'destlanguage':{'type':Sequelize[_0x3f7c('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x3f7c('0x2')]},'destexten':{'type':Sequelize[_0x3f7c('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x3f7c('0x2')]},'inReplyTo':{'type':Sequelize[_0x3f7c('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x3f7c('0x2')]},'to':{'type':Sequelize[_0x3f7c('0x2')]},'cc':{'type':Sequelize[_0x3f7c('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x3f7c('0x6')]},'text':{'type':Sequelize[_0x3f7c('0x6')]},'status':{'type':Sequelize[_0x3f7c('0x7')]('SENT',_0x3f7c('0x8'),_0x3f7c('0x9'),'FAILED')},'url':{'type':Sequelize[_0x3f7c('0x2')]},'app':{'type':Sequelize[_0x3f7c('0x2')]},'appdata':{'type':Sequelize[_0x3f7c('0x2')]},'projectId':{'type':Sequelize[_0x3f7c('0x4')]}}; \ No newline at end of file +var _0x3068=['BOOLEAN','TEXT','RECEIVED','FAILED','sequelize','STRING','INTEGER','DATE'];(function(_0x26e87e,_0x1b3266){var _0x267985=function(_0x47efae){while(--_0x47efae){_0x26e87e['push'](_0x26e87e['shift']());}};_0x267985(++_0x1b3266);}(_0x3068,0xc4));var _0x8306=function(_0x41274e,_0x6dbb80){_0x41274e=_0x41274e-0x0;var _0x4af4ac=_0x3068[_0x41274e];return _0x4af4ac;};'use strict';var Sequelize=require(_0x8306('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x8306('0x1')]},'exitStatus':{'type':Sequelize[_0x8306('0x1')]},'ticketId':{'type':Sequelize[_0x8306('0x1')]},'integrationId':{'type':Sequelize[_0x8306('0x2')]},'contacts':{'type':Sequelize[_0x8306('0x1')]},'uniqueid':{'type':Sequelize[_0x8306('0x1')]},'calleridnum':{'type':Sequelize[_0x8306('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x8306('0x1')]},'interface':{'type':Sequelize[_0x8306('0x1')]},'membername':{'type':Sequelize[_0x8306('0x1')]},'agentcalledAt':{'type':Sequelize[_0x8306('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x8306('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x8306('0x3')]},'talktime':{'type':Sequelize[_0x8306('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8306('0x2')]},'reason':{'type':Sequelize[_0x8306('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x8306('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x8306('0x3')]},'agentdump':{'type':Sequelize[_0x8306('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x8306('0x3')]},'lastevent':{'type':Sequelize[_0x8306('0x1')]},'channel':{'type':Sequelize[_0x8306('0x1')]},'channelstate':{'type':Sequelize[_0x8306('0x2')]},'channelstatedesc':{'type':Sequelize[_0x8306('0x1')]},'connectedlinenum':{'type':Sequelize[_0x8306('0x1')]},'connectedlinename':{'type':Sequelize[_0x8306('0x1')]},'language':{'type':Sequelize[_0x8306('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8306('0x1')]},'exten':{'type':Sequelize[_0x8306('0x1')]},'priority':{'type':Sequelize[_0x8306('0x1')]},'destchannel':{'type':Sequelize[_0x8306('0x1')]},'destchannelstate':{'type':Sequelize[_0x8306('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x8306('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x8306('0x1')]},'destlanguage':{'type':Sequelize[_0x8306('0x1')]},'destaccountcode':{'type':Sequelize[_0x8306('0x1')]},'destcontext':{'type':Sequelize[_0x8306('0x1')]},'destexten':{'type':Sequelize[_0x8306('0x1')]},'destpriority':{'type':Sequelize[_0x8306('0x1')]},'destuniqueid':{'type':Sequelize[_0x8306('0x1')]},'messageId':{'type':Sequelize[_0x8306('0x1')]},'inReplyTo':{'type':Sequelize[_0x8306('0x1')]},'subject':{'type':Sequelize[_0x8306('0x1')]},'from':{'type':Sequelize[_0x8306('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x8306('0x1')]},'attachment':{'type':Sequelize[_0x8306('0x5')]},'html':{'type':Sequelize[_0x8306('0x5')]},'text':{'type':Sequelize[_0x8306('0x5')]},'status':{'type':Sequelize['ENUM']('SENT','SENDING',_0x8306('0x6'),_0x8306('0x7'))},'url':{'type':Sequelize[_0x8306('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x8306('0x1')]},'projectId':{'type':Sequelize[_0x8306('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 3d5e3d4..3bb95b3 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 _0xaa98=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','error','name','send','IntegrationReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0xff54c2,_0x3ef6b1){var _0x4bf365=function(_0x2635bb){while(--_0x2635bb){_0xff54c2['push'](_0xff54c2['shift']());}};_0x4bf365(++_0x3ef6b1);}(_0xaa98,0x88));var _0x8aa9=function(_0x1add9f,_0x4a5014){_0x1add9f=_0x1add9f-0x0;var _0x5250f1=_0xaa98[_0x1add9f];return _0x5250f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8aa9('0x0'));var zipdir=require(_0x8aa9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8aa9('0x2'));var moment=require('moment');var BPromise=require(_0x8aa9('0x3'));var Mustache=require('mustache');var util=require(_0x8aa9('0x4'));var path=require(_0x8aa9('0x5'));var sox=require(_0x8aa9('0x6'));var csv=require(_0x8aa9('0x7'));var ejs=require(_0x8aa9('0x8'));var fs=require('fs');var fs_extra=require(_0x8aa9('0x9'));var _=require(_0x8aa9('0xa'));var squel=require(_0x8aa9('0xb'));var crypto=require(_0x8aa9('0xc'));var jsforce=require(_0x8aa9('0xd'));var deskjs=require(_0x8aa9('0xe'));var toCsv=require(_0x8aa9('0x7'));var querystring=require(_0x8aa9('0xf'));var Papa=require(_0x8aa9('0x10'));var Redis=require(_0x8aa9('0x11'));var authService=require(_0x8aa9('0x12'));var qs=require(_0x8aa9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8aa9('0x14'))(_0x8aa9('0x15'));var utils=require(_0x8aa9('0x16'));var config=require(_0x8aa9('0x17'));var licenseUtil=require(_0x8aa9('0x18'));var db=require(_0x8aa9('0x19'))['db'];function respondWithStatusCode(_0x329290,_0x3bee8a){_0x3bee8a=_0x3bee8a||0xcc;return function(_0xa7f98d){if(_0xa7f98d){return _0x329290[_0x8aa9('0x1a')](_0x3bee8a);}return _0x329290['status'](_0x3bee8a)['end']();};}function respondWithResult(_0xa937da,_0x526afd){_0x526afd=_0x526afd||0xc8;return function(_0x180663){if(_0x180663){return _0xa937da['status'](_0x526afd)[_0x8aa9('0x1b')](_0x180663);}};}function respondWithFilteredResult(_0x49f737,_0x56cadc){return function(_0x121ab6){if(_0x121ab6){var _0x1fe89f=typeof _0x56cadc['offset']===_0x8aa9('0x1c')&&typeof _0x56cadc[_0x8aa9('0x1d')]===_0x8aa9('0x1c');var _0x2ed63e=_0x121ab6[_0x8aa9('0x1e')];var _0x4a7534=_0x1fe89f?0x0:_0x56cadc[_0x8aa9('0x1f')];var _0x4a98e9=_0x1fe89f?_0x121ab6[_0x8aa9('0x1e')]:_0x56cadc[_0x8aa9('0x1f')]+_0x56cadc[_0x8aa9('0x1d')];var _0x4e4ded;if(_0x4a98e9>=_0x2ed63e){_0x4a98e9=_0x2ed63e;_0x4e4ded=0xc8;}else{_0x4e4ded=0xce;}_0x49f737[_0x8aa9('0x20')](_0x4e4ded);return _0x49f737[_0x8aa9('0x21')](_0x8aa9('0x22'),_0x4a7534+'-'+_0x4a98e9+'/'+_0x2ed63e)[_0x8aa9('0x1b')](_0x121ab6);}return null;};}function patchUpdates(_0x261961){return function(_0x262c89){try{jsonpatch[_0x8aa9('0x23')](_0x262c89,_0x261961,!![]);}catch(_0x1b25c0){return BPromise[_0x8aa9('0x24')](_0x1b25c0);}return _0x262c89[_0x8aa9('0x25')]();};}function saveUpdates(_0x5ba369,_0x3fce38){return function(_0x29a6fc){if(_0x29a6fc){return _0x29a6fc[_0x8aa9('0x26')](_0x5ba369)[_0x8aa9('0x27')](function(_0x21c28b){return _0x21c28b;});}return null;};}function removeEntity(_0x2e042f,_0x4423e8){return function(_0x544772){if(_0x544772){return _0x544772['destroy']()[_0x8aa9('0x27')](function(){_0x2e042f[_0x8aa9('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27b7e5,_0x10a115){return function(_0x165ed6){if(!_0x165ed6){_0x27b7e5['sendStatus'](0x194);}return _0x165ed6;};}function handleError(_0x2e3157,_0x260586){_0x260586=_0x260586||0x1f4;return function(_0x45ee11){logger[_0x8aa9('0x28')](_0x45ee11['stack']);if(_0x45ee11[_0x8aa9('0x29')]){delete _0x45ee11[_0x8aa9('0x29')];}_0x2e3157['status'](_0x260586)[_0x8aa9('0x2a')](_0x45ee11);};}exports['index']=function(_0x2eccbd,_0x5a8c93){var _0x47d0cc={},_0x4eb4ed={},_0x562ec7={'count':0x0,'rows':[]};var _0x2362d5=_['map'](db[_0x8aa9('0x2b')][_0x8aa9('0x2c')],function(_0x55d265){return{'name':_0x55d265[_0x8aa9('0x2d')],'type':_0x55d265['type'][_0x8aa9('0x2e')]};});_0x4eb4ed['model']=_['map'](_0x2362d5,_0x8aa9('0x29'));_0x4eb4ed[_0x8aa9('0x2f')]=_[_0x8aa9('0x30')](_0x2eccbd[_0x8aa9('0x2f')]);_0x4eb4ed[_0x8aa9('0x31')]=_[_0x8aa9('0x32')](_0x4eb4ed[_0x8aa9('0x33')],_0x4eb4ed[_0x8aa9('0x2f')]);_0x47d0cc[_0x8aa9('0x34')]=_[_0x8aa9('0x32')](_0x4eb4ed[_0x8aa9('0x33')],qs[_0x8aa9('0x35')](_0x2eccbd[_0x8aa9('0x2f')]['fields']));_0x47d0cc['attributes']=_0x47d0cc[_0x8aa9('0x34')][_0x8aa9('0x36')]?_0x47d0cc['attributes']:_0x4eb4ed[_0x8aa9('0x33')];if(!_0x2eccbd[_0x8aa9('0x2f')][_0x8aa9('0x37')](_0x8aa9('0x38'))){_0x47d0cc[_0x8aa9('0x1d')]=qs['limit'](_0x2eccbd[_0x8aa9('0x2f')]['limit']);_0x47d0cc[_0x8aa9('0x1f')]=qs[_0x8aa9('0x1f')](_0x2eccbd[_0x8aa9('0x2f')][_0x8aa9('0x1f')]);}_0x47d0cc['order']=qs[_0x8aa9('0x39')](_0x2eccbd['query'][_0x8aa9('0x39')]);_0x47d0cc[_0x8aa9('0x3a')]=qs[_0x8aa9('0x31')](_['pick'](_0x2eccbd[_0x8aa9('0x2f')],_0x4eb4ed[_0x8aa9('0x31')]),_0x2362d5);if(_0x2eccbd['query'][_0x8aa9('0x3b')]){_0x47d0cc[_0x8aa9('0x3a')]=_[_0x8aa9('0x3c')](_0x47d0cc[_0x8aa9('0x3a')],{'$or':_['map'](_0x2362d5,function(_0x108826){if(_0x108826['type']!==_0x8aa9('0x3d')){var _0x494aef={};_0x494aef[_0x108826[_0x8aa9('0x29')]]={'$like':'%'+_0x2eccbd[_0x8aa9('0x2f')][_0x8aa9('0x3b')]+'%'};return _0x494aef;}})});}_0x47d0cc=_[_0x8aa9('0x3c')]({},_0x47d0cc,_0x2eccbd[_0x8aa9('0x3e')]);var _0x308fac={'where':_0x47d0cc[_0x8aa9('0x3a')]};return db['IntegrationReport'][_0x8aa9('0x1e')](_0x308fac)[_0x8aa9('0x27')](function(_0x1c175e){_0x562ec7[_0x8aa9('0x1e')]=_0x1c175e;if(_0x2eccbd[_0x8aa9('0x2f')][_0x8aa9('0x3f')]){_0x47d0cc[_0x8aa9('0x40')]=[{'all':!![]}];}return db[_0x8aa9('0x2b')][_0x8aa9('0x41')](_0x47d0cc);})['then'](function(_0x562eeb){_0x562ec7[_0x8aa9('0x42')]=_0x562eeb;return _0x562ec7;})[_0x8aa9('0x27')](respondWithFilteredResult(_0x5a8c93,_0x47d0cc))['catch'](handleError(_0x5a8c93,null));};exports[_0x8aa9('0x43')]=function(_0x47944a,_0xae3be0){var _0x1eb8a0={'raw':![],'where':{'id':_0x47944a[_0x8aa9('0x44')]['id']}},_0x860cac={};_0x860cac[_0x8aa9('0x33')]=_[_0x8aa9('0x30')](db[_0x8aa9('0x2b')]['rawAttributes']);_0x860cac['query']=_[_0x8aa9('0x30')](_0x47944a[_0x8aa9('0x2f')]);_0x860cac['filters']=_['intersection'](_0x860cac[_0x8aa9('0x33')],_0x860cac[_0x8aa9('0x2f')]);_0x1eb8a0[_0x8aa9('0x34')]=_['intersection'](_0x860cac['model'],qs[_0x8aa9('0x35')](_0x47944a[_0x8aa9('0x2f')][_0x8aa9('0x35')]));_0x1eb8a0[_0x8aa9('0x34')]=_0x1eb8a0[_0x8aa9('0x34')][_0x8aa9('0x36')]?_0x1eb8a0[_0x8aa9('0x34')]:_0x860cac[_0x8aa9('0x33')];if(_0x47944a[_0x8aa9('0x2f')][_0x8aa9('0x3f')]){_0x1eb8a0['include']=[{'all':!![]}];}_0x1eb8a0=_[_0x8aa9('0x3c')]({},_0x1eb8a0,_0x47944a[_0x8aa9('0x3e')]);return db['IntegrationReport'][_0x8aa9('0x45')](_0x1eb8a0)['then'](handleEntityNotFound(_0xae3be0,null))[_0x8aa9('0x27')](respondWithResult(_0xae3be0,null))[_0x8aa9('0x46')](handleError(_0xae3be0,null));};exports[_0x8aa9('0x47')]=function(_0x28d032,_0x3c465d){return db[_0x8aa9('0x2b')][_0x8aa9('0x47')](_0x28d032[_0x8aa9('0x48')],{})[_0x8aa9('0x27')](respondWithResult(_0x3c465d,0xc9))[_0x8aa9('0x46')](handleError(_0x3c465d,null));};exports['update']=function(_0x359f9d,_0x309bd4){if(_0x359f9d[_0x8aa9('0x48')]['id']){delete _0x359f9d[_0x8aa9('0x48')]['id'];}return db[_0x8aa9('0x2b')][_0x8aa9('0x45')]({'where':{'id':_0x359f9d[_0x8aa9('0x44')]['id']}})[_0x8aa9('0x27')](handleEntityNotFound(_0x309bd4,null))[_0x8aa9('0x27')](saveUpdates(_0x359f9d['body'],null))['then'](respondWithResult(_0x309bd4,null))[_0x8aa9('0x46')](handleError(_0x309bd4,null));};exports[_0x8aa9('0x49')]=function(_0x4e1cf0,_0x30ef6f){return db[_0x8aa9('0x2b')][_0x8aa9('0x45')]({'where':{'id':_0x4e1cf0['params']['id']}})[_0x8aa9('0x27')](handleEntityNotFound(_0x30ef6f,null))['then'](removeEntity(_0x30ef6f,null))['catch'](handleError(_0x30ef6f,null));};exports['describe']=function(_0xc0e71b,_0x5c5b0f){return db[_0x8aa9('0x2b')]['describe']()[_0x8aa9('0x27')](respondWithResult(_0x5c5b0f,null))['catch'](handleError(_0x5c5b0f,null));}; \ No newline at end of file +var _0x05fd=['Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','map','IntegrationReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','include','options','catch','create','body','update','find','describe','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x05fd,0x107));var _0xd05f=function(_0x15f694,_0x302bd3){_0x15f694=_0x15f694-0x0;var _0x108252=_0x05fd[_0x15f694];return _0x108252;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd05f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd05f('0x1'));var moment=require(_0xd05f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xd05f('0x3'));var util=require(_0xd05f('0x4'));var path=require(_0xd05f('0x5'));var sox=require(_0xd05f('0x6'));var csv=require(_0xd05f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd05f('0x8'));var _=require(_0xd05f('0x9'));var squel=require(_0xd05f('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd05f('0x7'));var querystring=require(_0xd05f('0xb'));var Papa=require(_0xd05f('0xc'));var Redis=require(_0xd05f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd05f('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd05f('0xf'));var logger=require(_0xd05f('0x10'))(_0xd05f('0x11'));var utils=require(_0xd05f('0x12'));var config=require(_0xd05f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd05f('0x14'))['db'];function respondWithStatusCode(_0x3a3e10,_0x287284){_0x287284=_0x287284||0xcc;return function(_0x3ffa41){if(_0x3ffa41){return _0x3a3e10['sendStatus'](_0x287284);}return _0x3a3e10['status'](_0x287284)[_0xd05f('0x15')]();};}function respondWithResult(_0x300a9f,_0xb97455){_0xb97455=_0xb97455||0xc8;return function(_0x495158){if(_0x495158){return _0x300a9f[_0xd05f('0x16')](_0xb97455)[_0xd05f('0x17')](_0x495158);}};}function respondWithFilteredResult(_0x489f39,_0x4f76a9){return function(_0x816e75){if(_0x816e75){var _0x3857d8=typeof _0x4f76a9[_0xd05f('0x18')]===_0xd05f('0x19')&&typeof _0x4f76a9[_0xd05f('0x1a')]===_0xd05f('0x19');var _0x509279=_0x816e75[_0xd05f('0x1b')];var _0x5cc946=_0x3857d8?0x0:_0x4f76a9[_0xd05f('0x18')];var _0x142c82=_0x3857d8?_0x816e75[_0xd05f('0x1b')]:_0x4f76a9[_0xd05f('0x18')]+_0x4f76a9[_0xd05f('0x1a')];var _0x1355e6;if(_0x142c82>=_0x509279){_0x142c82=_0x509279;_0x1355e6=0xc8;}else{_0x1355e6=0xce;}_0x489f39['status'](_0x1355e6);return _0x489f39[_0xd05f('0x1c')](_0xd05f('0x1d'),_0x5cc946+'-'+_0x142c82+'/'+_0x509279)['json'](_0x816e75);}return null;};}function patchUpdates(_0x3814f3){return function(_0x273fc4){try{jsonpatch[_0xd05f('0x1e')](_0x273fc4,_0x3814f3,!![]);}catch(_0x2dc736){return BPromise[_0xd05f('0x1f')](_0x2dc736);}return _0x273fc4['save']();};}function saveUpdates(_0x2c8549,_0x2a980e){return function(_0x4ab013){if(_0x4ab013){return _0x4ab013['update'](_0x2c8549)[_0xd05f('0x20')](function(_0x379dec){return _0x379dec;});}return null;};}function removeEntity(_0x4344e8,_0x22b46a){return function(_0x294c5d){if(_0x294c5d){return _0x294c5d[_0xd05f('0x21')]()[_0xd05f('0x20')](function(){_0x4344e8[_0xd05f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3724e8,_0x52efeb){return function(_0x2d3076){if(!_0x2d3076){_0x3724e8[_0xd05f('0x22')](0x194);}return _0x2d3076;};}function handleError(_0x3297b6,_0x4676bc){_0x4676bc=_0x4676bc||0x1f4;return function(_0x5e3ba0){logger[_0xd05f('0x23')](_0x5e3ba0[_0xd05f('0x24')]);if(_0x5e3ba0[_0xd05f('0x25')]){delete _0x5e3ba0[_0xd05f('0x25')];}_0x3297b6[_0xd05f('0x16')](_0x4676bc)[_0xd05f('0x26')](_0x5e3ba0);};}exports['index']=function(_0x2834c7,_0x1e915a){var _0x239be7={},_0x5224e5={},_0x19af50={'count':0x0,'rows':[]};var _0x1574b7=_[_0xd05f('0x27')](db[_0xd05f('0x28')][_0xd05f('0x29')],function(_0x466d47){return{'name':_0x466d47['fieldName'],'type':_0x466d47[_0xd05f('0x2a')][_0xd05f('0x2b')]};});_0x5224e5[_0xd05f('0x2c')]=_[_0xd05f('0x27')](_0x1574b7,'name');_0x5224e5[_0xd05f('0x2d')]=_[_0xd05f('0x2e')](_0x2834c7[_0xd05f('0x2d')]);_0x5224e5[_0xd05f('0x2f')]=_[_0xd05f('0x30')](_0x5224e5[_0xd05f('0x2c')],_0x5224e5[_0xd05f('0x2d')]);_0x239be7['attributes']=_[_0xd05f('0x30')](_0x5224e5[_0xd05f('0x2c')],qs[_0xd05f('0x31')](_0x2834c7[_0xd05f('0x2d')][_0xd05f('0x31')]));_0x239be7['attributes']=_0x239be7[_0xd05f('0x32')][_0xd05f('0x33')]?_0x239be7['attributes']:_0x5224e5[_0xd05f('0x2c')];if(!_0x2834c7['query']['hasOwnProperty'](_0xd05f('0x34'))){_0x239be7[_0xd05f('0x1a')]=qs[_0xd05f('0x1a')](_0x2834c7[_0xd05f('0x2d')][_0xd05f('0x1a')]);_0x239be7['offset']=qs[_0xd05f('0x18')](_0x2834c7[_0xd05f('0x2d')][_0xd05f('0x18')]);}_0x239be7[_0xd05f('0x35')]=qs[_0xd05f('0x36')](_0x2834c7[_0xd05f('0x2d')][_0xd05f('0x36')]);_0x239be7[_0xd05f('0x37')]=qs['filters'](_[_0xd05f('0x38')](_0x2834c7['query'],_0x5224e5[_0xd05f('0x2f')]),_0x1574b7);if(_0x2834c7[_0xd05f('0x2d')][_0xd05f('0x39')]){_0x239be7[_0xd05f('0x37')]=_['merge'](_0x239be7[_0xd05f('0x37')],{'$or':_[_0xd05f('0x27')](_0x1574b7,function(_0x2517c8){if(_0x2517c8['type']!==_0xd05f('0x3a')){var _0x233587={};_0x233587[_0x2517c8[_0xd05f('0x25')]]={'$like':'%'+_0x2834c7['query'][_0xd05f('0x39')]+'%'};return _0x233587;}})});}_0x239be7=_[_0xd05f('0x3b')]({},_0x239be7,_0x2834c7['options']);var _0x5ed94c={'where':_0x239be7[_0xd05f('0x37')]};return db[_0xd05f('0x28')][_0xd05f('0x1b')](_0x5ed94c)[_0xd05f('0x20')](function(_0x28b250){_0x19af50[_0xd05f('0x1b')]=_0x28b250;if(_0x2834c7['query'][_0xd05f('0x3c')]){_0x239be7['include']=[{'all':!![]}];}return db[_0xd05f('0x28')][_0xd05f('0x3d')](_0x239be7);})[_0xd05f('0x20')](function(_0x530432){_0x19af50[_0xd05f('0x3e')]=_0x530432;return _0x19af50;})[_0xd05f('0x20')](respondWithFilteredResult(_0x1e915a,_0x239be7))['catch'](handleError(_0x1e915a,null));};exports[_0xd05f('0x3f')]=function(_0x46b48f,_0x5c43a4){var _0x51b8e2={'raw':![],'where':{'id':_0x46b48f[_0xd05f('0x40')]['id']}},_0x5339a9={};_0x5339a9['model']=_['keys'](db['IntegrationReport'][_0xd05f('0x29')]);_0x5339a9[_0xd05f('0x2d')]=_['keys'](_0x46b48f[_0xd05f('0x2d')]);_0x5339a9[_0xd05f('0x2f')]=_[_0xd05f('0x30')](_0x5339a9[_0xd05f('0x2c')],_0x5339a9[_0xd05f('0x2d')]);_0x51b8e2['attributes']=_['intersection'](_0x5339a9['model'],qs[_0xd05f('0x31')](_0x46b48f[_0xd05f('0x2d')][_0xd05f('0x31')]));_0x51b8e2[_0xd05f('0x32')]=_0x51b8e2[_0xd05f('0x32')][_0xd05f('0x33')]?_0x51b8e2[_0xd05f('0x32')]:_0x5339a9[_0xd05f('0x2c')];if(_0x46b48f[_0xd05f('0x2d')][_0xd05f('0x3c')]){_0x51b8e2[_0xd05f('0x41')]=[{'all':!![]}];}_0x51b8e2=_[_0xd05f('0x3b')]({},_0x51b8e2,_0x46b48f[_0xd05f('0x42')]);return db['IntegrationReport']['find'](_0x51b8e2)[_0xd05f('0x20')](handleEntityNotFound(_0x5c43a4,null))[_0xd05f('0x20')](respondWithResult(_0x5c43a4,null))[_0xd05f('0x43')](handleError(_0x5c43a4,null));};exports['create']=function(_0x27f3d5,_0x31f90e){return db[_0xd05f('0x28')][_0xd05f('0x44')](_0x27f3d5[_0xd05f('0x45')],{})['then'](respondWithResult(_0x31f90e,0xc9))['catch'](handleError(_0x31f90e,null));};exports[_0xd05f('0x46')]=function(_0xaadbce,_0x93764d){if(_0xaadbce[_0xd05f('0x45')]['id']){delete _0xaadbce[_0xd05f('0x45')]['id'];}return db[_0xd05f('0x28')][_0xd05f('0x47')]({'where':{'id':_0xaadbce[_0xd05f('0x40')]['id']}})[_0xd05f('0x20')](handleEntityNotFound(_0x93764d,null))[_0xd05f('0x20')](saveUpdates(_0xaadbce[_0xd05f('0x45')],null))['then'](respondWithResult(_0x93764d,null))['catch'](handleError(_0x93764d,null));};exports['destroy']=function(_0x512967,_0x10ad2e){return db[_0xd05f('0x28')][_0xd05f('0x47')]({'where':{'id':_0x512967['params']['id']}})[_0xd05f('0x20')](handleEntityNotFound(_0x10ad2e,null))['then'](removeEntity(_0x10ad2e,null))['catch'](handleError(_0x10ad2e,null));};exports[_0xd05f('0x48')]=function(_0x23b7fd,_0x5e2e0d){return db[_0xd05f('0x28')][_0xd05f('0x48')]()[_0xd05f('0x20')](respondWithResult(_0x5e2e0d,null))[_0xd05f('0x43')](handleError(_0x5e2e0d,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 5bde7ae..5834ba5 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 _0x11d8=['util','api','moment','bluebird','path','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash'];(function(_0x48d9c3,_0x255030){var _0x346bde=function(_0x295f83){while(--_0x295f83){_0x48d9c3['push'](_0x48d9c3['shift']());}};_0x346bde(++_0x255030);}(_0x11d8,0x99));var _0x811d=function(_0x56f4ff,_0xef419d){_0x56f4ff=_0x56f4ff-0x0;var _0x19d3d2=_0x11d8[_0x56f4ff];return _0x19d3d2;};'use strict';var _=require(_0x811d('0x0'));var util=require(_0x811d('0x1'));var logger=require('../../config/logger')(_0x811d('0x2'));var moment=require(_0x811d('0x3'));var BPromise=require(_0x811d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x811d('0x5'));var rimraf=require('rimraf');var config=require(_0x811d('0x6'));var attributes=require(_0x811d('0x7'));module[_0x811d('0x8')]=function(_0x3985f2,_0x53e254){return _0x3985f2['define'](_0x811d('0x9'),attributes,{'tableName':_0x811d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d78=['moment','bluebird','path','rimraf','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api'];(function(_0x112cbf,_0x2f77eb){var _0xd8bee5=function(_0x18bbd0){while(--_0x18bbd0){_0x112cbf['push'](_0x112cbf['shift']());}};_0xd8bee5(++_0x2f77eb);}(_0x7d78,0xcc));var _0x87d7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7d78[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x87d7('0x0'));var util=require(_0x87d7('0x1'));var logger=require(_0x87d7('0x2'))(_0x87d7('0x3'));var moment=require(_0x87d7('0x4'));var BPromise=require(_0x87d7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x87d7('0x6'));var rimraf=require(_0x87d7('0x7'));var config=require('../../config/environment');var attributes=require(_0x87d7('0x8'));module[_0x87d7('0x9')]=function(_0x51ff90,_0x2bf839){return _0x51ff90[_0x87d7('0xa')](_0x87d7('0xb'),attributes,{'tableName':_0x87d7('0xc'),'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 cf599fc..7965864 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 _0x57ca=['client','http','request','info','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','IntegrationReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x223414,_0x50feba){var _0x2f1d62=function(_0x1942cd){while(--_0x1942cd){_0x223414['push'](_0x223414['shift']());}};_0x2f1d62(++_0x50feba);}(_0x57ca,0x108));var _0xa57c=function(_0x3e738d,_0x449d6f){_0x3e738d=_0x3e738d-0x0;var _0x255862=_0x57ca[_0x3e738d];return _0x255862;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0x6d38=['request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1e05c7,_0x4dd86a){var _0x4ff096=function(_0x58d3a4){while(--_0x58d3a4){_0x1e05c7['push'](_0x1e05c7['shift']());}};_0x4ff096(++_0x4dd86a);}(_0x6d38,0x1ef));var _0x86d3=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x6d38[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index daee5c1..370366d 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 _0x43a2=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','get','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','destroy','util','path'];(function(_0x35e54a,_0x46953a){var _0x35c2b0=function(_0x3c0ab9){while(--_0x3c0ab9){_0x35e54a['push'](_0x35e54a['shift']());}};_0x35c2b0(++_0x46953a);}(_0x43a2,0xd0));var _0x243a=function(_0x424e24,_0x295bfe){_0x424e24=_0x424e24-0x0;var _0x2f52cd=_0x43a2[_0x424e24];return _0x2f52cd;};'use strict';var multer=require('multer');var util=require(_0x243a('0x0'));var path=require(_0x243a('0x1'));var timeout=require(_0x243a('0x2'));var express=require('express');var router=express[_0x243a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x243a('0x4'));var interaction=require(_0x243a('0x5'));var config=require(_0x243a('0x6'));var controller=require(_0x243a('0x7'));router['get']('/',auth[_0x243a('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x243a('0x9')](_0x243a('0xa'),auth[_0x243a('0x8')](),controller[_0x243a('0xb')]);router[_0x243a('0xc')]('/',auth[_0x243a('0x8')](),controller['create']);router['post'](_0x243a('0xa'),auth[_0x243a('0x8')](),controller[_0x243a('0xd')]);router[_0x243a('0xc')](_0x243a('0xe'),auth[_0x243a('0x8')](),controller[_0x243a('0xf')]);router[_0x243a('0x10')](_0x243a('0x11'),auth[_0x243a('0x8')](),controller[_0x243a('0x12')]);router[_0x243a('0x13')](_0x243a('0x11'),auth[_0x243a('0x8')](),controller[_0x243a('0x14')]);module['exports']=router; \ No newline at end of file +var _0xdbce=['index','/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','./interval.controller','get','isAuthenticated'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xdbce,0x1f1));var _0xedbc=function(_0x380e75,_0x486360){_0x380e75=_0x380e75-0x0;var _0x444d96=_0xdbce[_0x380e75];return _0x444d96;};'use strict';var multer=require(_0xedbc('0x0'));var util=require('util');var path=require(_0xedbc('0x1'));var timeout=require('connect-timeout');var express=require(_0xedbc('0x2'));var router=express[_0xedbc('0x3')]();var fs_extra=require(_0xedbc('0x4'));var auth=require(_0xedbc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xedbc('0x6'));router[_0xedbc('0x7')]('/',auth[_0xedbc('0x8')](),controller[_0xedbc('0x9')]);router[_0xedbc('0x7')](_0xedbc('0xa'),auth[_0xedbc('0x8')](),controller[_0xedbc('0xb')]);router['get'](_0xedbc('0xc'),auth[_0xedbc('0x8')](),controller[_0xedbc('0xd')]);router[_0xedbc('0xe')]('/',auth[_0xedbc('0x8')](),controller[_0xedbc('0xf')]);router[_0xedbc('0xe')](_0xedbc('0xc'),auth[_0xedbc('0x8')](),controller[_0xedbc('0x10')]);router[_0xedbc('0xe')](_0xedbc('0x11'),auth[_0xedbc('0x8')](),controller[_0xedbc('0x12')]);router[_0xedbc('0x13')](_0xedbc('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xedbc('0xa'),auth[_0xedbc('0x8')](),controller[_0xedbc('0x14')]);module[_0xedbc('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 7f6124a..71eab86 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 _0x6b89=['STRING','sequelize'];(function(_0x1a80db,_0x3fa121){var _0x5b4c90=function(_0x3296cc){while(--_0x3296cc){_0x1a80db['push'](_0x1a80db['shift']());}};_0x5b4c90(++_0x3fa121);}(_0x6b89,0xc5));var _0x96b8=function(_0x56e57a,_0x36c1b7){_0x56e57a=_0x56e57a-0x0;var _0x259012=_0x6b89[_0x56e57a];return _0x259012;};'use strict';var Sequelize=require(_0x96b8('0x0'));module['exports']={'name':{'type':Sequelize[_0x96b8('0x1')]},'description':{'type':Sequelize[_0x96b8('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xbe99=['STRING','sequelize','exports'];(function(_0x384b50,_0x7cab4a){var _0x5ac70e=function(_0x477a0b){while(--_0x477a0b){_0x384b50['push'](_0x384b50['shift']());}};_0x5ac70e(++_0x7cab4a);}(_0xbe99,0x1f3));var _0x9be9=function(_0x3198a8,_0x49a00a){_0x3198a8=_0x3198a8-0x0;var _0x1e1400=_0xbe99[_0x3198a8];return _0x1e1400;};'use strict';var Sequelize=require(_0x9be9('0x0'));module[_0x9be9('0x1')]={'name':{'type':Sequelize[_0x9be9('0x2')]},'description':{'type':Sequelize[_0x9be9('0x2')]},'interval':{'type':Sequelize[_0x9be9('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 baf9a91..5c528fc 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 _0xb84e=['api','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','offset','undefined','limit','count','set','json','apply','save','update','then','get','Intervals','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','Interval','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','transaction','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x21cfdb,_0x5d681b){var _0x246033=function(_0x326c7f){while(--_0x326c7f){_0x21cfdb['push'](_0x21cfdb['shift']());}};_0x246033(++_0x5d681b);}(_0xb84e,0xf8));var _0xeb84=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0xb84e[_0x547add];return _0x2ed1f3;};'use strict';var emlformat=require(_0xeb84('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeb84('0x1'));var jsonpatch=require(_0xeb84('0x2'));var rp=require(_0xeb84('0x3'));var moment=require(_0xeb84('0x4'));var BPromise=require(_0xeb84('0x5'));var Mustache=require('mustache');var util=require(_0xeb84('0x6'));var path=require(_0xeb84('0x7'));var sox=require(_0xeb84('0x8'));var csv=require('to-csv');var ejs=require(_0xeb84('0x9'));var fs=require('fs');var fs_extra=require(_0xeb84('0xa'));var _=require(_0xeb84('0xb'));var squel=require(_0xeb84('0xc'));var crypto=require(_0xeb84('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeb84('0xe'));var Redis=require(_0xeb84('0xf'));var authService=require(_0xeb84('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb84('0x11'));var logger=require(_0xeb84('0x12'))(_0xeb84('0x13'));var utils=require('../../config/utils');var config=require(_0xeb84('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xeb84('0x15'))['db'];var extensions=require(_0xeb84('0x16'));function respondWithStatusCode(_0x50f9e8,_0x89c593){_0x89c593=_0x89c593||0xcc;return function(_0xeed508){if(_0xeed508){return _0x50f9e8[_0xeb84('0x17')](_0x89c593);}return _0x50f9e8[_0xeb84('0x18')](_0x89c593)['end']();};}function respondWithResult(_0x10d6a1,_0xb6bd57){_0xb6bd57=_0xb6bd57||0xc8;return function(_0x45afd1){if(_0x45afd1){return _0x10d6a1[_0xeb84('0x18')](_0xb6bd57)['json'](_0x45afd1);}};}function respondWithFilteredResult(_0x51f829,_0x49cb13){return function(_0x1459b5){if(_0x1459b5){var _0xa7493d=typeof _0x49cb13[_0xeb84('0x19')]===_0xeb84('0x1a')&&typeof _0x49cb13[_0xeb84('0x1b')]===_0xeb84('0x1a');var _0x7ea92e=_0x1459b5[_0xeb84('0x1c')];var _0x337731=_0xa7493d?0x0:_0x49cb13['offset'];var _0x44905c=_0xa7493d?_0x1459b5['count']:_0x49cb13[_0xeb84('0x19')]+_0x49cb13[_0xeb84('0x1b')];var _0x2a6c27;if(_0x44905c>=_0x7ea92e){_0x44905c=_0x7ea92e;_0x2a6c27=0xc8;}else{_0x2a6c27=0xce;}_0x51f829[_0xeb84('0x18')](_0x2a6c27);return _0x51f829[_0xeb84('0x1d')]('Content-Range',_0x337731+'-'+_0x44905c+'/'+_0x7ea92e)[_0xeb84('0x1e')](_0x1459b5);}return null;};}function patchUpdates(_0x3adc82){return function(_0x415978){try{jsonpatch[_0xeb84('0x1f')](_0x415978,_0x3adc82,!![]);}catch(_0x18add9){return BPromise['reject'](_0x18add9);}return _0x415978[_0xeb84('0x20')]();};}function saveUpdates(_0x1c765a,_0x5cc3f0){return function(_0x1355de){if(_0x1355de){return _0x1355de[_0xeb84('0x21')](_0x1c765a)[_0xeb84('0x22')](function(_0x3703a1){return _0x3703a1;});}return null;};}function removeEntity(_0x4dc0d9,_0x4be1b4){return function(_0x5270a4){if(_0x5270a4){return _0x5270a4['destroy']()[_0xeb84('0x22')](function(){var _0x123bf5=_0x5270a4[_0xeb84('0x23')]({'plain':!![]});var _0xdfbcb0=_0xeb84('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0xdfbcb0,'resourceId':_0x123bf5['id']}})[_0xeb84('0x22')](function(){return _0x5270a4;});})['then'](function(){_0x4dc0d9[_0xeb84('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x376228,_0x5d595e){return function(_0x3612ca){if(!_0x3612ca){_0x376228[_0xeb84('0x17')](0x194);}return _0x3612ca;};}function handleError(_0x9d0a93,_0x5547be){_0x5547be=_0x5547be||0x1f4;return function(_0x32b78e){logger[_0xeb84('0x25')](_0x32b78e[_0xeb84('0x26')]);if(_0x32b78e[_0xeb84('0x27')]){delete _0x32b78e[_0xeb84('0x27')];}_0x9d0a93[_0xeb84('0x18')](_0x5547be)[_0xeb84('0x28')](_0x32b78e);};}exports['index']=function(_0x4b265d,_0x11ae1b){var _0x2d9588={},_0xff9f22={},_0x568f5e={'count':0x0,'rows':[]};var _0x34b7a3=_[_0xeb84('0x29')](db['Interval'][_0xeb84('0x2a')],function(_0x2f9027){return{'name':_0x2f9027[_0xeb84('0x2b')],'type':_0x2f9027['type'][_0xeb84('0x2c')]};});_0xff9f22[_0xeb84('0x2d')]=_[_0xeb84('0x29')](_0x34b7a3,_0xeb84('0x27'));_0xff9f22[_0xeb84('0x2e')]=_[_0xeb84('0x2f')](_0x4b265d['query']);_0xff9f22[_0xeb84('0x30')]=_[_0xeb84('0x31')](_0xff9f22[_0xeb84('0x2d')],_0xff9f22['query']);_0x2d9588[_0xeb84('0x32')]=_[_0xeb84('0x31')](_0xff9f22[_0xeb84('0x2d')],qs[_0xeb84('0x33')](_0x4b265d['query'][_0xeb84('0x33')]));_0x2d9588['attributes']=_0x2d9588[_0xeb84('0x32')][_0xeb84('0x34')]?_0x2d9588['attributes']:_0xff9f22[_0xeb84('0x2d')];if(!_0x4b265d[_0xeb84('0x2e')][_0xeb84('0x35')](_0xeb84('0x36'))){_0x2d9588[_0xeb84('0x1b')]=qs['limit'](_0x4b265d[_0xeb84('0x2e')][_0xeb84('0x1b')]);_0x2d9588[_0xeb84('0x19')]=qs['offset'](_0x4b265d[_0xeb84('0x2e')]['offset']);}_0x2d9588[_0xeb84('0x37')]=qs['sort'](_0x4b265d[_0xeb84('0x2e')][_0xeb84('0x38')]);_0x2d9588[_0xeb84('0x39')]=qs['filters'](_[_0xeb84('0x3a')](_0x4b265d['query'],_0xff9f22[_0xeb84('0x30')]),_0x34b7a3);if(_0x4b265d[_0xeb84('0x2e')][_0xeb84('0x3b')]){_0x2d9588[_0xeb84('0x39')]=_['merge'](_0x2d9588['where'],{'$or':_[_0xeb84('0x29')](_0x34b7a3,function(_0x522af9){if(_0x522af9[_0xeb84('0x3c')]!==_0xeb84('0x3d')){var _0x147780={};_0x147780[_0x522af9['name']]={'$like':'%'+_0x4b265d['query']['filter']+'%'};return _0x147780;}})});}_0x2d9588=_[_0xeb84('0x3e')]({},_0x2d9588,_0x4b265d[_0xeb84('0x3f')]);var _0x281a5c={'where':_0x2d9588[_0xeb84('0x39')]};return db[_0xeb84('0x40')][_0xeb84('0x1c')](_0x281a5c)[_0xeb84('0x22')](function(_0x4c35d2){_0x568f5e[_0xeb84('0x1c')]=_0x4c35d2;if(_0x4b265d[_0xeb84('0x2e')][_0xeb84('0x41')]){_0x2d9588[_0xeb84('0x42')]=[{'all':!![]}];}return db[_0xeb84('0x40')][_0xeb84('0x43')](_0x2d9588);})[_0xeb84('0x22')](function(_0x36d296){_0x568f5e[_0xeb84('0x44')]=_0x36d296;return _0x568f5e;})['then'](respondWithFilteredResult(_0x11ae1b,_0x2d9588))[_0xeb84('0x45')](handleError(_0x11ae1b,null));};exports[_0xeb84('0x46')]=function(_0x41705a,_0x21ba8d){var _0x2f7a52={'raw':!![],'where':{'id':_0x41705a[_0xeb84('0x47')]['id']}},_0x368888={};_0x368888['model']=_[_0xeb84('0x2f')](db['Interval']['rawAttributes']);_0x368888[_0xeb84('0x2e')]=_[_0xeb84('0x2f')](_0x41705a['query']);_0x368888[_0xeb84('0x30')]=_['intersection'](_0x368888[_0xeb84('0x2d')],_0x368888[_0xeb84('0x2e')]);_0x2f7a52['attributes']=_['intersection'](_0x368888[_0xeb84('0x2d')],qs['fields'](_0x41705a[_0xeb84('0x2e')][_0xeb84('0x33')]));_0x2f7a52[_0xeb84('0x32')]=_0x2f7a52[_0xeb84('0x32')][_0xeb84('0x34')]?_0x2f7a52[_0xeb84('0x32')]:_0x368888[_0xeb84('0x2d')];if(_0x41705a[_0xeb84('0x2e')][_0xeb84('0x41')]){_0x2f7a52[_0xeb84('0x42')]=[{'all':!![]}];}_0x2f7a52=_[_0xeb84('0x3e')]({},_0x2f7a52,_0x41705a[_0xeb84('0x3f')]);return db[_0xeb84('0x40')][_0xeb84('0x48')](_0x2f7a52)[_0xeb84('0x22')](handleEntityNotFound(_0x21ba8d,null))[_0xeb84('0x22')](respondWithResult(_0x21ba8d,null))['catch'](handleError(_0x21ba8d,null));};exports['create']=function(_0x55c283,_0x5e0b18){return db['Interval'][_0xeb84('0x49')](_0x55c283['body'],{})[_0xeb84('0x22')](function(_0xba4ff9){var _0x4b01a4=_0x55c283['user']['get']({'plain':!![]});if(!_0x4b01a4)throw new Error(_0xeb84('0x4a'));if(_0x4b01a4[_0xeb84('0x4b')]===_0xeb84('0x4c')){var _0x485eb5=_0xba4ff9['get']({'plain':!![]});var _0x2667c8=_0xeb84('0x24');return db['UserProfileSection'][_0xeb84('0x48')]({'where':{'name':_0x2667c8,'userProfileId':_0x4b01a4['userProfileId']},'raw':!![]})['then'](function(_0x24b45b){if(_0x24b45b&&_0x24b45b['autoAssociation']===0x0){return db[_0xeb84('0x4d')][_0xeb84('0x49')]({'name':_0x485eb5['name'],'resourceId':_0x485eb5['id'],'type':_0x24b45b[_0xeb84('0x27')],'sectionId':_0x24b45b['id']},{})['then'](function(){return _0xba4ff9;});}else{return _0xba4ff9;}})['catch'](function(_0x2c68ef){logger[_0xeb84('0x25')](_0xeb84('0x4e'),_0x2c68ef);throw _0x2c68ef;});}return _0xba4ff9;})[_0xeb84('0x22')](respondWithResult(_0x5e0b18,0xc9))[_0xeb84('0x45')](handleError(_0x5e0b18,null));};exports[_0xeb84('0x21')]=function(_0x44c168,_0x538450){if(_0x44c168[_0xeb84('0x4f')]['id']){delete _0x44c168['body']['id'];}return db['Interval'][_0xeb84('0x48')]({'where':{'id':_0x44c168[_0xeb84('0x47')]['id']}})['then'](handleEntityNotFound(_0x538450,null))[_0xeb84('0x22')](saveUpdates(_0x44c168[_0xeb84('0x4f')],null))[_0xeb84('0x22')](respondWithResult(_0x538450,null))[_0xeb84('0x45')](handleError(_0x538450,null));};exports[_0xeb84('0x50')]=function(_0x251e99,_0x43c13e){return db[_0xeb84('0x40')][_0xeb84('0x48')]({'where':{'id':_0x251e99[_0xeb84('0x47')]['id']}})[_0xeb84('0x22')](handleEntityNotFound(_0x43c13e,null))['then'](removeEntity(_0x43c13e,null))['catch'](handleError(_0x43c13e,null));};exports[_0xeb84('0x51')]=function(_0x3f886a,_0x4fb6c5,_0x2d1968){if(_0x3f886a['body']['id']){delete _0x3f886a['body']['id'];}return db['Interval']['find']({'where':{'id':_0x3f886a['params']['id']}})[_0xeb84('0x22')](handleEntityNotFound(_0x4fb6c5,null))['then'](function(_0x368106){if(_0x368106){_0x3f886a['body'][_0xeb84('0x52')]=_0x368106['id'];return db['Interval']['create'](_0x3f886a[_0xeb84('0x4f')]);}})[_0xeb84('0x22')](respondWithResult(_0x4fb6c5,null))[_0xeb84('0x45')](handleError(_0x4fb6c5,null));};exports[_0xeb84('0x53')]=function(_0x20c327,_0xadba1e,_0x3fe2a2){var _0x5f4d26={};var _0x341921={};var _0x5ac2fa;var _0x1616c2;return db[_0xeb84('0x40')][_0xeb84('0x54')]({'where':{'id':_0x20c327[_0xeb84('0x47')]['id']}})[_0xeb84('0x22')](handleEntityNotFound(_0xadba1e,null))[_0xeb84('0x22')](function(_0x1f3dde){if(_0x1f3dde){_0x5ac2fa=_0x1f3dde;_0x341921['model']=_[_0xeb84('0x2f')](db[_0xeb84('0x40')]['rawAttributes']);_0x341921[_0xeb84('0x2e')]=_['keys'](_0x20c327[_0xeb84('0x2e')]);_0x341921[_0xeb84('0x30')]=_[_0xeb84('0x31')](_0x341921[_0xeb84('0x2d')],_0x341921[_0xeb84('0x2e')]);_0x5f4d26[_0xeb84('0x32')]=_[_0xeb84('0x31')](_0x341921[_0xeb84('0x2d')],qs['fields'](_0x20c327['query'][_0xeb84('0x33')]));_0x5f4d26[_0xeb84('0x32')]=_0x5f4d26[_0xeb84('0x32')][_0xeb84('0x34')]?_0x5f4d26['attributes']:_0x341921['model'];_0x5f4d26[_0xeb84('0x37')]=qs[_0xeb84('0x38')](_0x20c327[_0xeb84('0x2e')][_0xeb84('0x38')]);_0x5f4d26[_0xeb84('0x39')]=qs[_0xeb84('0x30')](_[_0xeb84('0x3a')](_0x20c327[_0xeb84('0x2e')],_0x341921[_0xeb84('0x30')]));if(_0x20c327[_0xeb84('0x2e')][_0xeb84('0x3b')]){_0x5f4d26[_0xeb84('0x39')]=_['merge'](_0x5f4d26[_0xeb84('0x39')],{'$or':_[_0xeb84('0x29')](_0x5f4d26[_0xeb84('0x32')],function(_0x10b74d){var _0x511776={};_0x511776[_0x10b74d]={'$like':'%'+_0x20c327[_0xeb84('0x2e')][_0xeb84('0x3b')]+'%'};return _0x511776;})});}_0x5f4d26=_[_0xeb84('0x3e')]({},_0x5f4d26,_0x20c327[_0xeb84('0x3f')]);return _0x5ac2fa[_0xeb84('0x53')](_0x5f4d26);}})['then'](function(_0x494754){if(_0x494754){_0x1616c2=_0x494754[_0xeb84('0x34')];if(!_0x20c327['query'][_0xeb84('0x35')]('nolimit')){_0x5f4d26['limit']=qs[_0xeb84('0x1b')](_0x20c327[_0xeb84('0x2e')]['limit']);_0x5f4d26[_0xeb84('0x19')]=qs['offset'](_0x20c327['query']['offset']);}return _0x5ac2fa[_0xeb84('0x53')](_0x5f4d26);}})[_0xeb84('0x22')](function(_0x1ad601){if(_0x1ad601){return _0x1ad601?{'count':_0x1616c2,'rows':_0x1ad601}:null;}})['then'](respondWithResult(_0xadba1e,null))[_0xeb84('0x45')](handleError(_0xadba1e,null));};exports[_0xeb84('0x55')]=function(_0x4c0448,_0x54bc3b,_0x150e8d){return db[_0xeb84('0x40')]['findOne']({'where':{'id':_0x4c0448[_0xeb84('0x47')]['id']}})[_0xeb84('0x22')](handleEntityNotFound(_0x54bc3b,null))[_0xeb84('0x22')](function(_0x4ab49e){if(_0x4ab49e){return db[_0xeb84('0x56')][_0xeb84('0x57')](function(_0x2d7847){return db[_0xeb84('0x40')]['destroy']({'where':{'IntervalId':_0x4c0448[_0xeb84('0x47')]['id']},'transaction':_0x2d7847})[_0xeb84('0x22')](function(_0x2e2aa8){var _0x31fa23=_['map'](_0x4c0448[_0xeb84('0x4f')],function(_0x268753){delete _0x268753['id'];_0x268753[_0xeb84('0x52')]=_0x4c0448['params']['id'];return _0x268753;});return db[_0xeb84('0x40')][_0xeb84('0x58')](_0x31fa23,{'transaction':_0x2d7847});});})[_0xeb84('0x22')](function(){return db[_0xeb84('0x40')][_0xeb84('0x43')]({'where':{'IntervalId':_0x4c0448[_0xeb84('0x47')]['id']}});});}})[_0xeb84('0x22')](respondWithResult(_0x54bc3b,null))[_0xeb84('0x45')](handleError(_0x54bc3b,null));}; \ No newline at end of file +var _0x1236=['apply','save','update','then','get','Intervals','destroy','end','error','stack','name','send','map','Interval','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','getIntervals','findOne','length','hasOwnProperty','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','undefined','limit','count','offset','set'];(function(_0x5da791,_0x1ec17d){var _0x248c76=function(_0x128ea3){while(--_0x128ea3){_0x5da791['push'](_0x5da791['shift']());}};_0x248c76(++_0x1ec17d);}(_0x1236,0xeb));var _0x6123=function(_0x46511a,_0x28311c){_0x46511a=_0x46511a-0x0;var _0x2f2191=_0x1236[_0x46511a];return _0x2f2191;};'use strict';var emlformat=require(_0x6123('0x0'));var rimraf=require(_0x6123('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6123('0x2'));var rp=require(_0x6123('0x3'));var moment=require(_0x6123('0x4'));var BPromise=require(_0x6123('0x5'));var Mustache=require(_0x6123('0x6'));var util=require('util');var path=require(_0x6123('0x7'));var sox=require(_0x6123('0x8'));var csv=require(_0x6123('0x9'));var ejs=require(_0x6123('0xa'));var fs=require('fs');var fs_extra=require(_0x6123('0xb'));var _=require(_0x6123('0xc'));var squel=require('squel');var crypto=require(_0x6123('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6123('0x9'));var querystring=require('querystring');var Papa=require(_0x6123('0xe'));var Redis=require('ioredis');var authService=require(_0x6123('0xf'));var qs=require(_0x6123('0x10'));var as=require(_0x6123('0x11'));var hardwareService=require(_0x6123('0x12'));var logger=require(_0x6123('0x13'))(_0x6123('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6123('0x15'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x2a4a00,_0xdbd8c2){_0xdbd8c2=_0xdbd8c2||0xcc;return function(_0x386d24){if(_0x386d24){return _0x2a4a00[_0x6123('0x16')](_0xdbd8c2);}return _0x2a4a00[_0x6123('0x17')](_0xdbd8c2)['end']();};}function respondWithResult(_0x38cbc0,_0x4e661b){_0x4e661b=_0x4e661b||0xc8;return function(_0x3e688c){if(_0x3e688c){return _0x38cbc0[_0x6123('0x17')](_0x4e661b)['json'](_0x3e688c);}};}function respondWithFilteredResult(_0x28a2d3,_0x986b29){return function(_0x24f5f6){if(_0x24f5f6){var _0x50dd34=typeof _0x986b29['offset']===_0x6123('0x18')&&typeof _0x986b29[_0x6123('0x19')]==='undefined';var _0x10fac3=_0x24f5f6[_0x6123('0x1a')];var _0x3a2d8f=_0x50dd34?0x0:_0x986b29[_0x6123('0x1b')];var _0x595866=_0x50dd34?_0x24f5f6[_0x6123('0x1a')]:_0x986b29['offset']+_0x986b29['limit'];var _0x504230;if(_0x595866>=_0x10fac3){_0x595866=_0x10fac3;_0x504230=0xc8;}else{_0x504230=0xce;}_0x28a2d3['status'](_0x504230);return _0x28a2d3[_0x6123('0x1c')]('Content-Range',_0x3a2d8f+'-'+_0x595866+'/'+_0x10fac3)['json'](_0x24f5f6);}return null;};}function patchUpdates(_0x2966c6){return function(_0xd30048){try{jsonpatch[_0x6123('0x1d')](_0xd30048,_0x2966c6,!![]);}catch(_0x8244f0){return BPromise['reject'](_0x8244f0);}return _0xd30048[_0x6123('0x1e')]();};}function saveUpdates(_0x10a4d4,_0x3b4d95){return function(_0xbbe875){if(_0xbbe875){return _0xbbe875[_0x6123('0x1f')](_0x10a4d4)[_0x6123('0x20')](function(_0x3250dc){return _0x3250dc;});}return null;};}function removeEntity(_0x62f1d,_0x534ac6){return function(_0x459c7f){if(_0x459c7f){return _0x459c7f['destroy']()['then'](function(){var _0x4f620b=_0x459c7f[_0x6123('0x21')]({'plain':!![]});var _0x554cc4=_0x6123('0x22');return db['UserProfileResource'][_0x6123('0x23')]({'where':{'type':_0x554cc4,'resourceId':_0x4f620b['id']}})['then'](function(){return _0x459c7f;});})[_0x6123('0x20')](function(){_0x62f1d[_0x6123('0x17')](0xcc)[_0x6123('0x24')]();});}};}function handleEntityNotFound(_0x585295,_0x26972a){return function(_0x33ebc4){if(!_0x33ebc4){_0x585295[_0x6123('0x16')](0x194);}return _0x33ebc4;};}function handleError(_0x41d464,_0x1816b1){_0x1816b1=_0x1816b1||0x1f4;return function(_0x59265a){logger[_0x6123('0x25')](_0x59265a[_0x6123('0x26')]);if(_0x59265a[_0x6123('0x27')]){delete _0x59265a[_0x6123('0x27')];}_0x41d464[_0x6123('0x17')](_0x1816b1)[_0x6123('0x28')](_0x59265a);};}exports['index']=function(_0x1cb36a,_0x5b535e){var _0x25e8c5={},_0x1507db={},_0x45a6bd={'count':0x0,'rows':[]};var _0x3d9dcd=_[_0x6123('0x29')](db[_0x6123('0x2a')][_0x6123('0x2b')],function(_0x5d2280){return{'name':_0x5d2280['fieldName'],'type':_0x5d2280['type'][_0x6123('0x2c')]};});_0x1507db['model']=_[_0x6123('0x29')](_0x3d9dcd,'name');_0x1507db[_0x6123('0x2d')]=_[_0x6123('0x2e')](_0x1cb36a[_0x6123('0x2d')]);_0x1507db[_0x6123('0x2f')]=_[_0x6123('0x30')](_0x1507db[_0x6123('0x31')],_0x1507db[_0x6123('0x2d')]);_0x25e8c5[_0x6123('0x32')]=_[_0x6123('0x30')](_0x1507db['model'],qs[_0x6123('0x33')](_0x1cb36a[_0x6123('0x2d')][_0x6123('0x33')]));_0x25e8c5[_0x6123('0x32')]=_0x25e8c5[_0x6123('0x32')]['length']?_0x25e8c5[_0x6123('0x32')]:_0x1507db[_0x6123('0x31')];if(!_0x1cb36a[_0x6123('0x2d')]['hasOwnProperty'](_0x6123('0x34'))){_0x25e8c5[_0x6123('0x19')]=qs[_0x6123('0x19')](_0x1cb36a[_0x6123('0x2d')][_0x6123('0x19')]);_0x25e8c5[_0x6123('0x1b')]=qs[_0x6123('0x1b')](_0x1cb36a[_0x6123('0x2d')][_0x6123('0x1b')]);}_0x25e8c5[_0x6123('0x35')]=qs[_0x6123('0x36')](_0x1cb36a[_0x6123('0x2d')][_0x6123('0x36')]);_0x25e8c5['where']=qs[_0x6123('0x2f')](_[_0x6123('0x37')](_0x1cb36a[_0x6123('0x2d')],_0x1507db[_0x6123('0x2f')]),_0x3d9dcd);if(_0x1cb36a[_0x6123('0x2d')][_0x6123('0x38')]){_0x25e8c5[_0x6123('0x39')]=_[_0x6123('0x3a')](_0x25e8c5[_0x6123('0x39')],{'$or':_[_0x6123('0x29')](_0x3d9dcd,function(_0x4b738f){if(_0x4b738f[_0x6123('0x3b')]!==_0x6123('0x3c')){var _0x19660b={};_0x19660b[_0x4b738f['name']]={'$like':'%'+_0x1cb36a['query'][_0x6123('0x38')]+'%'};return _0x19660b;}})});}_0x25e8c5=_[_0x6123('0x3a')]({},_0x25e8c5,_0x1cb36a[_0x6123('0x3d')]);var _0x8c1211={'where':_0x25e8c5['where']};return db['Interval'][_0x6123('0x1a')](_0x8c1211)[_0x6123('0x20')](function(_0x44003d){_0x45a6bd['count']=_0x44003d;if(_0x1cb36a[_0x6123('0x2d')][_0x6123('0x3e')]){_0x25e8c5['include']=[{'all':!![]}];}return db[_0x6123('0x2a')][_0x6123('0x3f')](_0x25e8c5);})[_0x6123('0x20')](function(_0x4e50a1){_0x45a6bd['rows']=_0x4e50a1;return _0x45a6bd;})[_0x6123('0x20')](respondWithFilteredResult(_0x5b535e,_0x25e8c5))[_0x6123('0x40')](handleError(_0x5b535e,null));};exports[_0x6123('0x41')]=function(_0x1e9419,_0x3713ec){var _0x5d3239={'raw':!![],'where':{'id':_0x1e9419['params']['id']}},_0x4b9377={};_0x4b9377[_0x6123('0x31')]=_[_0x6123('0x2e')](db[_0x6123('0x2a')]['rawAttributes']);_0x4b9377[_0x6123('0x2d')]=_['keys'](_0x1e9419[_0x6123('0x2d')]);_0x4b9377[_0x6123('0x2f')]=_['intersection'](_0x4b9377[_0x6123('0x31')],_0x4b9377[_0x6123('0x2d')]);_0x5d3239[_0x6123('0x32')]=_[_0x6123('0x30')](_0x4b9377['model'],qs[_0x6123('0x33')](_0x1e9419[_0x6123('0x2d')][_0x6123('0x33')]));_0x5d3239[_0x6123('0x32')]=_0x5d3239['attributes']['length']?_0x5d3239['attributes']:_0x4b9377[_0x6123('0x31')];if(_0x1e9419[_0x6123('0x2d')][_0x6123('0x3e')]){_0x5d3239[_0x6123('0x42')]=[{'all':!![]}];}_0x5d3239=_['merge']({},_0x5d3239,_0x1e9419[_0x6123('0x3d')]);return db[_0x6123('0x2a')][_0x6123('0x43')](_0x5d3239)['then'](handleEntityNotFound(_0x3713ec,null))[_0x6123('0x20')](respondWithResult(_0x3713ec,null))[_0x6123('0x40')](handleError(_0x3713ec,null));};exports[_0x6123('0x44')]=function(_0x1bc520,_0x237f15){return db[_0x6123('0x2a')][_0x6123('0x44')](_0x1bc520[_0x6123('0x45')],{})[_0x6123('0x20')](function(_0x2009a2){var _0x45001b=_0x1bc520[_0x6123('0x46')]['get']({'plain':!![]});if(!_0x45001b)throw new Error(_0x6123('0x47'));if(_0x45001b[_0x6123('0x48')]===_0x6123('0x46')){var _0x2e53ef=_0x2009a2[_0x6123('0x21')]({'plain':!![]});var _0x4a4a95=_0x6123('0x22');return db[_0x6123('0x49')][_0x6123('0x43')]({'where':{'name':_0x4a4a95,'userProfileId':_0x45001b[_0x6123('0x4a')]},'raw':!![]})[_0x6123('0x20')](function(_0x1ebedf){if(_0x1ebedf&&_0x1ebedf[_0x6123('0x4b')]===0x0){return db['UserProfileResource'][_0x6123('0x44')]({'name':_0x2e53ef[_0x6123('0x27')],'resourceId':_0x2e53ef['id'],'type':_0x1ebedf[_0x6123('0x27')],'sectionId':_0x1ebedf['id']},{})[_0x6123('0x20')](function(){return _0x2009a2;});}else{return _0x2009a2;}})[_0x6123('0x40')](function(_0x3988d2){logger['error'](_0x6123('0x4c'),_0x3988d2);throw _0x3988d2;});}return _0x2009a2;})[_0x6123('0x20')](respondWithResult(_0x237f15,0xc9))[_0x6123('0x40')](handleError(_0x237f15,null));};exports[_0x6123('0x1f')]=function(_0xa659d4,_0x210610){if(_0xa659d4['body']['id']){delete _0xa659d4[_0x6123('0x45')]['id'];}return db[_0x6123('0x2a')][_0x6123('0x43')]({'where':{'id':_0xa659d4[_0x6123('0x4d')]['id']}})['then'](handleEntityNotFound(_0x210610,null))[_0x6123('0x20')](saveUpdates(_0xa659d4[_0x6123('0x45')],null))['then'](respondWithResult(_0x210610,null))['catch'](handleError(_0x210610,null));};exports[_0x6123('0x23')]=function(_0x59b3ed,_0x37a0a2){return db[_0x6123('0x2a')][_0x6123('0x43')]({'where':{'id':_0x59b3ed[_0x6123('0x4d')]['id']}})[_0x6123('0x20')](handleEntityNotFound(_0x37a0a2,null))[_0x6123('0x20')](removeEntity(_0x37a0a2,null))[_0x6123('0x40')](handleError(_0x37a0a2,null));};exports[_0x6123('0x4e')]=function(_0x19f06c,_0x468845,_0x5db835){if(_0x19f06c['body']['id']){delete _0x19f06c['body']['id'];}return db[_0x6123('0x2a')][_0x6123('0x43')]({'where':{'id':_0x19f06c['params']['id']}})[_0x6123('0x20')](handleEntityNotFound(_0x468845,null))['then'](function(_0x5436c8){if(_0x5436c8){_0x19f06c['body'][_0x6123('0x4f')]=_0x5436c8['id'];return db[_0x6123('0x2a')]['create'](_0x19f06c[_0x6123('0x45')]);}})[_0x6123('0x20')](respondWithResult(_0x468845,null))[_0x6123('0x40')](handleError(_0x468845,null));};exports[_0x6123('0x50')]=function(_0x21e68f,_0x39d269,_0x25a25a){var _0x4c87aa={};var _0x1cb8c8={};var _0x1a7260;var _0x1e1f94;return db['Interval'][_0x6123('0x51')]({'where':{'id':_0x21e68f[_0x6123('0x4d')]['id']}})[_0x6123('0x20')](handleEntityNotFound(_0x39d269,null))[_0x6123('0x20')](function(_0x3bf3a3){if(_0x3bf3a3){_0x1a7260=_0x3bf3a3;_0x1cb8c8['model']=_[_0x6123('0x2e')](db[_0x6123('0x2a')][_0x6123('0x2b')]);_0x1cb8c8[_0x6123('0x2d')]=_[_0x6123('0x2e')](_0x21e68f[_0x6123('0x2d')]);_0x1cb8c8[_0x6123('0x2f')]=_[_0x6123('0x30')](_0x1cb8c8[_0x6123('0x31')],_0x1cb8c8[_0x6123('0x2d')]);_0x4c87aa['attributes']=_[_0x6123('0x30')](_0x1cb8c8[_0x6123('0x31')],qs[_0x6123('0x33')](_0x21e68f[_0x6123('0x2d')]['fields']));_0x4c87aa['attributes']=_0x4c87aa[_0x6123('0x32')][_0x6123('0x52')]?_0x4c87aa[_0x6123('0x32')]:_0x1cb8c8['model'];_0x4c87aa['order']=qs[_0x6123('0x36')](_0x21e68f[_0x6123('0x2d')]['sort']);_0x4c87aa[_0x6123('0x39')]=qs[_0x6123('0x2f')](_[_0x6123('0x37')](_0x21e68f[_0x6123('0x2d')],_0x1cb8c8['filters']));if(_0x21e68f[_0x6123('0x2d')][_0x6123('0x38')]){_0x4c87aa['where']=_[_0x6123('0x3a')](_0x4c87aa[_0x6123('0x39')],{'$or':_[_0x6123('0x29')](_0x4c87aa[_0x6123('0x32')],function(_0x465952){var _0x438dca={};_0x438dca[_0x465952]={'$like':'%'+_0x21e68f['query'][_0x6123('0x38')]+'%'};return _0x438dca;})});}_0x4c87aa=_[_0x6123('0x3a')]({},_0x4c87aa,_0x21e68f[_0x6123('0x3d')]);return _0x1a7260[_0x6123('0x50')](_0x4c87aa);}})[_0x6123('0x20')](function(_0x513d36){if(_0x513d36){_0x1e1f94=_0x513d36[_0x6123('0x52')];if(!_0x21e68f['query'][_0x6123('0x53')](_0x6123('0x34'))){_0x4c87aa[_0x6123('0x19')]=qs[_0x6123('0x19')](_0x21e68f[_0x6123('0x2d')]['limit']);_0x4c87aa[_0x6123('0x1b')]=qs[_0x6123('0x1b')](_0x21e68f[_0x6123('0x2d')][_0x6123('0x1b')]);}return _0x1a7260['getIntervals'](_0x4c87aa);}})[_0x6123('0x20')](function(_0x5b6dab){if(_0x5b6dab){return _0x5b6dab?{'count':_0x1e1f94,'rows':_0x5b6dab}:null;}})[_0x6123('0x20')](respondWithResult(_0x39d269,null))[_0x6123('0x40')](handleError(_0x39d269,null));};exports[_0x6123('0x54')]=function(_0x13bb60,_0x35d662,_0x19985d){return db['Interval'][_0x6123('0x51')]({'where':{'id':_0x13bb60[_0x6123('0x4d')]['id']}})[_0x6123('0x20')](handleEntityNotFound(_0x35d662,null))[_0x6123('0x20')](function(_0x81e346){if(_0x81e346){return db[_0x6123('0x55')][_0x6123('0x56')](function(_0x5829e2){return db[_0x6123('0x2a')]['destroy']({'where':{'IntervalId':_0x13bb60['params']['id']},'transaction':_0x5829e2})[_0x6123('0x20')](function(_0x28e609){var _0x3098ce=_['map'](_0x13bb60[_0x6123('0x45')],function(_0x1e4899){delete _0x1e4899['id'];_0x1e4899[_0x6123('0x4f')]=_0x13bb60[_0x6123('0x4d')]['id'];return _0x1e4899;});return db['Interval'][_0x6123('0x57')](_0x3098ce,{'transaction':_0x5829e2});});})[_0x6123('0x20')](function(){return db[_0x6123('0x2a')][_0x6123('0x3f')]({'where':{'IntervalId':_0x13bb60['params']['id']}});});}})['then'](respondWithResult(_0x35d662,null))[_0x6123('0x40')](handleError(_0x35d662,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index be80b7b..ca67434 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 _0xa80c=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','rewrite','lodash'];(function(_0x5d5071,_0x1e4773){var _0x367d9f=function(_0x383ac7){while(--_0x383ac7){_0x5d5071['push'](_0x5d5071['shift']());}};_0x367d9f(++_0x1e4773);}(_0xa80c,0x1af));var _0xca80=function(_0x26329e,_0x1e7d8e){_0x26329e=_0x26329e-0x0;var _0x252b5c=_0xa80c[_0x26329e];return _0x252b5c;};'use strict';var _=require(_0xca80('0x0'));var util=require(_0xca80('0x1'));var logger=require('../../config/logger')(_0xca80('0x2'));var moment=require('moment');var BPromise=require(_0xca80('0x3'));var rp=require(_0xca80('0x4'));var fs=require('fs');var path=require(_0xca80('0x5'));var rimraf=require(_0xca80('0x6'));var config=require(_0xca80('0x7'));var attributes=require(_0xca80('0x8'));var extensions=require(_0xca80('0x9'));module[_0xca80('0xa')]=function(_0x3156d3,_0xde0486){return _0x3156d3['define']('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x258836,_0x1d0eb4){extensions[_0xca80('0xb')](_0x3156d3,_0x258836);},'afterBulkCreate':function(_0x2c7eb8,_0x4e2c22,_0x1ad162){_0x1ad162();extensions[_0xca80('0xb')](_0x3156d3,_0x2c7eb8[0x0]);},'afterUpdate':function(_0x21faa0,_0x3edbfa){extensions[_0xca80('0xb')](_0x3156d3,_0x21faa0);},'afterDestroy':function(_0x5eba58,_0x180c65){extensions['rewrite'](_0x3156d3,_0x5eba58);}}});}; \ No newline at end of file +var _0xc73f=['tools_intervals','rewrite','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./interval.attributes','exports','define','Interval'];(function(_0x156901,_0x3546db){var _0x23fa05=function(_0x31a688){while(--_0x31a688){_0x156901['push'](_0x156901['shift']());}};_0x23fa05(++_0x3546db);}(_0xc73f,0xe2));var _0xfc73=function(_0x2828b4,_0x21fed0){_0x2828b4=_0x2828b4-0x0;var _0x3bcb34=_0xc73f[_0x2828b4];return _0x3bcb34;};'use strict';var _=require(_0xfc73('0x0'));var util=require(_0xfc73('0x1'));var logger=require('../../config/logger')(_0xfc73('0x2'));var moment=require(_0xfc73('0x3'));var BPromise=require(_0xfc73('0x4'));var rp=require(_0xfc73('0x5'));var fs=require('fs');var path=require(_0xfc73('0x6'));var rimraf=require(_0xfc73('0x7'));var config=require('../../config/environment');var attributes=require(_0xfc73('0x8'));var extensions=require('../../components/extensions/rewrite');module[_0xfc73('0x9')]=function(_0x3e6d1a,_0x47580a){return _0x3e6d1a[_0xfc73('0xa')](_0xfc73('0xb'),attributes,{'tableName':_0xfc73('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x43b9c7,_0x506ba9){extensions[_0xfc73('0xd')](_0x3e6d1a,_0x43b9c7);},'afterBulkCreate':function(_0x2f680d,_0x4128a8,_0x50dfa1){_0x50dfa1();extensions[_0xfc73('0xd')](_0x3e6d1a,_0x2f680d[0x0]);},'afterUpdate':function(_0x5d8f35,_0x3dca97){extensions[_0xfc73('0xd')](_0x3e6d1a,_0x5d8f35);},'afterDestroy':function(_0x4b4ac9,_0x5e69bb){extensions[_0xfc73('0xd')](_0x3e6d1a,_0x4b4ac9);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index c43e9b4..5862b63 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 _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x4eaa4c,_0x2f7422){var _0x15aec6=function(_0x23efc9){while(--_0x23efc9){_0x4eaa4c['push'](_0x4eaa4c['shift']());}};_0x15aec6(++_0x2f7422);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x3a04ab,_0x31b9fd){var _0x4bff6d=function(_0x125f7e){while(--_0x125f7e){_0x3a04ab['push'](_0x3a04ab['shift']());}};_0x4bff6d(++_0x31b9fd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index ef20864..a080e05 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(_0x6922a0,_0xcbdb9f){var _0x39c598=function(_0x3c4123){while(--_0x3c4123){_0x6922a0['push'](_0x6922a0['shift']());}};_0x39c598(++_0xcbdb9f);}(_0xadb5,0xad));var _0x5adb=function(_0x38644e,_0x277397){_0x38644e=_0x38644e-0x0;var _0x3aa8ee=_0xadb5[_0x38644e];return _0x3aa8ee;};'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 _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x1e05c1,_0x3cffa3){var _0x15f1ca=function(_0x3a9594){while(--_0x3a9594){_0x1e05c1['push'](_0x1e05c1['shift']());}};_0x15f1ca(++_0x3cffa3);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 6b7810d..c1d9974 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 _0x5668=['socket','connection','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','email','oldToken','customfield_11502','customfield_11503','customfield_11504','reason','/rest/api/2/issue','application/json','Basic\x20','toString','base64','utf8','end','statusCode','status','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','openIssue','body','headers','x-forwarded-for','remoteAddress'];(function(_0x52024d,_0x103ef6){var _0x3922a2=function(_0x236386){while(--_0x236386){_0x52024d['push'](_0x52024d['shift']());}};_0x3922a2(++_0x103ef6);}(_0x5668,0x113));var _0x8566=function(_0x10c466,_0x3ae4eb){_0x10c466=_0x10c466-0x0;var _0x54e7fe=_0x5668[_0x10c466];return _0x54e7fe;};'use strict';var BPromise=require(_0x8566('0x0'));var https=require(_0x8566('0x1'));var logger=require(_0x8566('0x2'))(_0x8566('0x3'));var USERNAME=_0x8566('0x4');var PASSWORD=_0x8566('0x5');function openIssue(_0x4361aa,_0x3c71be){var _0x38fec8={'fields':{'project':{'key':_0x4361aa['key']||_0x8566('0x6')},'summary':(_0x4361aa[_0x8566('0x7')]||_0x8566('0x8'))+_0x8566('0x9')+_0x4361aa['ip'],'description':_0x4361aa['description']||JSON[_0x8566('0xa')](_0x4361aa),'issuetype':{'name':_0x4361aa[_0x8566('0xb')]||_0x8566('0xc')}}};_0x38fec8[_0x8566('0xd')][_0x8566('0xe')]=_0x4361aa[_0x8566('0xf')];_0x38fec8[_0x8566('0xd')]['customfield_11501']=_0x4361aa[_0x8566('0x10')];_0x38fec8[_0x8566('0xd')][_0x8566('0x11')]=_0x4361aa['newToken'];_0x38fec8[_0x8566('0xd')][_0x8566('0x12')]=_0x4361aa['name'];_0x38fec8[_0x8566('0xd')][_0x8566('0x13')]=_0x4361aa[_0x8566('0x14')];_0x38fec8[_0x8566('0xd')]['customfield_10102']=_0x4361aa['ip'];var _0x50df82={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x8566('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x8566('0x16'),'Authorization':_0x8566('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x8566('0x18')](_0x8566('0x19'))}};var _0x3a8d42=JSON['stringify'](_0x38fec8);var _0x200a61=https['request'](_0x50df82,function(_0x1f6f51){_0x1f6f51['setEncoding'](_0x8566('0x1a'));var _0x343265='';_0x1f6f51['on']('data',function(_0x1753a7){_0x343265+=_0x1753a7;});_0x1f6f51['on'](_0x8566('0x1b'),function(){if(_0x3c71be){return _0x3c71be['status'](_0x1f6f51[_0x8566('0x1c')])['json'](JSON['parse'](_0x343265));}});});_0x200a61['on']('error',function(_0x5dd8f9){if(_0x3c71be){return _0x3c71be[_0x8566('0x1d')](0x1f4)[_0x8566('0x1e')]({'errors':[{'message':_0x8566('0x1f'),'type':'api.jira'}]});}});_0x200a61['write'](_0x3a8d42);_0x200a61['end']();}exports[_0x8566('0x20')]=openIssue;exports['send']=function(_0x41f92,_0x2b537c){_0x41f92[_0x8566('0x21')]['ip']=_0x41f92[_0x8566('0x22')][_0x8566('0x23')]||_0x41f92['connection'][_0x8566('0x24')]||_0x41f92[_0x8566('0x25')][_0x8566('0x24')]||_0x41f92[_0x8566('0x26')]['socket'][_0x8566('0x24')];return openIssue(_0x41f92[_0x8566('0x21')],_0x2b537c);}; \ No newline at end of file +var _0xec11=['customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','setEncoding','utf8','end','status','statusCode','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','body','headers','remoteAddress','socket','connection','https','../../config/logger','api','support','3eAmWpBVP0','key','summary','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','newToken','name'];(function(_0x29aa7a,_0x5f5d74){var _0x2da942=function(_0x20621c){while(--_0x20621c){_0x29aa7a['push'](_0x29aa7a['shift']());}};_0x2da942(++_0x5f5d74);}(_0xec11,0xf0));var _0x1ec1=function(_0x33f380,_0x473e1b){_0x33f380=_0x33f380-0x0;var _0x17c61a=_0xec11[_0x33f380];return _0x17c61a;};'use strict';var BPromise=require('bluebird');var https=require(_0x1ec1('0x0'));var logger=require(_0x1ec1('0x1'))(_0x1ec1('0x2'));var USERNAME=_0x1ec1('0x3');var PASSWORD=_0x1ec1('0x4');function openIssue(_0x384639,_0x1f00ca){var _0x5b9769={'fields':{'project':{'key':_0x384639[_0x1ec1('0x5')]||'MOTGUI'},'summary':(_0x384639[_0x1ec1('0x6')]||'Report')+'\x20from\x20'+_0x384639['ip'],'description':_0x384639[_0x1ec1('0x7')]||JSON[_0x1ec1('0x8')](_0x384639),'issuetype':{'name':_0x384639[_0x1ec1('0x9')]||_0x1ec1('0xa')}}};_0x5b9769[_0x1ec1('0xb')][_0x1ec1('0xc')]=_0x384639[_0x1ec1('0xd')];_0x5b9769[_0x1ec1('0xb')][_0x1ec1('0xe')]=_0x384639[_0x1ec1('0xf')];_0x5b9769[_0x1ec1('0xb')]['customfield_11502']=_0x384639[_0x1ec1('0x10')];_0x5b9769['fields']['customfield_11503']=_0x384639[_0x1ec1('0x11')];_0x5b9769[_0x1ec1('0xb')][_0x1ec1('0x12')]=_0x384639[_0x1ec1('0x13')];_0x5b9769[_0x1ec1('0xb')][_0x1ec1('0x14')]=_0x384639['ip'];var _0x2b85de={'host':_0x1ec1('0x15'),'port':0x1bb,'path':_0x1ec1('0x16'),'method':_0x1ec1('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x1ec1('0x18'),'Authorization':_0x1ec1('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x1ec1('0x1a')]('base64')}};var _0x3ee14d=JSON['stringify'](_0x5b9769);var _0x4325b5=https['request'](_0x2b85de,function(_0x5b31c0){_0x5b31c0[_0x1ec1('0x1b')](_0x1ec1('0x1c'));var _0x260514='';_0x5b31c0['on']('data',function(_0x4b005b){_0x260514+=_0x4b005b;});_0x5b31c0['on'](_0x1ec1('0x1d'),function(){if(_0x1f00ca){return _0x1f00ca[_0x1ec1('0x1e')](_0x5b31c0[_0x1ec1('0x1f')])['json'](JSON[_0x1ec1('0x20')](_0x260514));}});});_0x4325b5['on'](_0x1ec1('0x21'),function(_0x30e349){if(_0x1f00ca){return _0x1f00ca['status'](0x1f4)['json']({'errors':[{'message':_0x1ec1('0x22'),'type':_0x1ec1('0x23')}]});}});_0x4325b5[_0x1ec1('0x24')](_0x3ee14d);_0x4325b5['end']();}exports['openIssue']=openIssue;exports[_0x1ec1('0x25')]=function(_0x58a84a,_0x15690b){_0x58a84a[_0x1ec1('0x26')]['ip']=_0x58a84a[_0x1ec1('0x27')]['x-forwarded-for']||_0x58a84a['connection'][_0x1ec1('0x28')]||_0x58a84a[_0x1ec1('0x29')][_0x1ec1('0x28')]||_0x58a84a[_0x1ec1('0x2a')][_0x1ec1('0x29')][_0x1ec1('0x28')];return openIssue(_0x58a84a[_0x1ec1('0x26')],_0x15690b);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 1440476..6b3e030 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 _0x6324=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','create','put','/:id','update','delete','exports','multer','util'];(function(_0x1950e2,_0x1e4dae){var _0xf3d1a4=function(_0x28c529){while(--_0x28c529){_0x1950e2['push'](_0x1950e2['shift']());}};_0xf3d1a4(++_0x1e4dae);}(_0x6324,0x142));var _0x4632=function(_0x3f2228,_0x3b27d5){_0x3f2228=_0x3f2228-0x0;var _0x285ae4=_0x6324[_0x3f2228];return _0x285ae4;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/describe',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4632('0xc')]);router[_0x4632('0xd')](_0x4632('0xe'),auth[_0x4632('0x8')](),controller[_0x4632('0xf')]);router[_0x4632('0x10')](_0x4632('0xe'),auth[_0x4632('0x8')](),controller['destroy']);module[_0x4632('0x11')]=router; \ No newline at end of file +var _0xb43b=['../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','index','/describe','isAuthenticated','describe','get','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x139428,_0x3912ad){var _0x5aec05=function(_0x23f78e){while(--_0x23f78e){_0x139428['push'](_0x139428['shift']());}};_0x5aec05(++_0x3912ad);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5ec45a,_0x1a5dcd){_0x5ec45a=_0x5ec45a-0x0;var _0x1f7f1c=_0xb43b[_0x5ec45a];return _0x1f7f1c;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb43('0x5'));var interaction=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var controller=require(_0xbb43('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb43('0x9')]);router['get'](_0xbb43('0xa'),auth[_0xbb43('0xb')](),controller[_0xbb43('0xc')]);router[_0xbb43('0xd')](_0xbb43('0xe'),auth['isAuthenticated'](),controller[_0xbb43('0xf')]);router[_0xbb43('0x10')]('/',auth['isAuthenticated'](),controller[_0xbb43('0x11')]);router[_0xbb43('0x12')](_0xbb43('0xe'),auth[_0xbb43('0xb')](),controller[_0xbb43('0x13')]);router[_0xbb43('0x14')]('/:id',auth[_0xbb43('0xb')](),controller[_0xbb43('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 1b62a41..8945fe0 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(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x7a54,0x106));var _0x47a5=function(_0x49d47b,_0x2434ed){_0x49d47b=_0x49d47b-0x0;var _0x2ba2a0=_0x7a54[_0x49d47b];return _0x2ba2a0;};'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(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x7a54,0x106));var _0x47a5=function(_0x259609,_0x312bdf){_0x259609=_0x259609-0x0;var _0x1784b5=_0x7a54[_0x259609];return _0x1784b5;};'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 25bdc00..56bc67e 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 _0x5d58=['undefined','limit','count','set','apply','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','JscriptyAnswerReport','include','findAll','rows','show','params','rawAttributes','keys','length','includeAll','merge','create','update','find','catch','destroy','describe','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x29bf80,_0x4af855){var _0x932096=function(_0x1528d7){while(--_0x1528d7){_0x29bf80['push'](_0x29bf80['shift']());}};_0x932096(++_0x4af855);}(_0x5d58,0x187));var _0x85d5=function(_0x248ddf,_0x189889){_0x248ddf=_0x248ddf-0x0;var _0x383b4f=_0x5d58[_0x248ddf];return _0x383b4f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x85d5('0x0'));var BPromise=require(_0x85d5('0x1'));var Mustache=require('mustache');var util=require(_0x85d5('0x2'));var path=require(_0x85d5('0x3'));var sox=require('sox');var csv=require(_0x85d5('0x4'));var ejs=require(_0x85d5('0x5'));var fs=require('fs');var fs_extra=require(_0x85d5('0x6'));var _=require(_0x85d5('0x7'));var squel=require('squel');var crypto=require(_0x85d5('0x8'));var jsforce=require(_0x85d5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x85d5('0x4'));var querystring=require('querystring');var Papa=require(_0x85d5('0xa'));var Redis=require(_0x85d5('0xb'));var authService=require(_0x85d5('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d5('0xd'))(_0x85d5('0xe'));var utils=require(_0x85d5('0xf'));var config=require(_0x85d5('0x10'));var licenseUtil=require(_0x85d5('0x11'));var db=require(_0x85d5('0x12'))['db'];function respondWithStatusCode(_0x31409d,_0x5897af){_0x5897af=_0x5897af||0xcc;return function(_0x4bbf2a){if(_0x4bbf2a){return _0x31409d['sendStatus'](_0x5897af);}return _0x31409d[_0x85d5('0x13')](_0x5897af)[_0x85d5('0x14')]();};}function respondWithResult(_0x339d4f,_0x1704f0){_0x1704f0=_0x1704f0||0xc8;return function(_0x18a20c){if(_0x18a20c){return _0x339d4f[_0x85d5('0x13')](_0x1704f0)[_0x85d5('0x15')](_0x18a20c);}};}function respondWithFilteredResult(_0x586382,_0x18e977){return function(_0x2d7c95){if(_0x2d7c95){var _0x1621ed=typeof _0x18e977[_0x85d5('0x16')]===_0x85d5('0x17')&&typeof _0x18e977[_0x85d5('0x18')]===_0x85d5('0x17');var _0x12bef9=_0x2d7c95[_0x85d5('0x19')];var _0x17acb0=_0x1621ed?0x0:_0x18e977[_0x85d5('0x16')];var _0x432bd6=_0x1621ed?_0x2d7c95[_0x85d5('0x19')]:_0x18e977[_0x85d5('0x16')]+_0x18e977[_0x85d5('0x18')];var _0x26981b;if(_0x432bd6>=_0x12bef9){_0x432bd6=_0x12bef9;_0x26981b=0xc8;}else{_0x26981b=0xce;}_0x586382[_0x85d5('0x13')](_0x26981b);return _0x586382[_0x85d5('0x1a')]('Content-Range',_0x17acb0+'-'+_0x432bd6+'/'+_0x12bef9)[_0x85d5('0x15')](_0x2d7c95);}return null;};}function patchUpdates(_0x133fa9){return function(_0x5f5755){try{jsonpatch[_0x85d5('0x1b')](_0x5f5755,_0x133fa9,!![]);}catch(_0x1264ca){return BPromise['reject'](_0x1264ca);}return _0x5f5755['save']();};}function saveUpdates(_0x347337,_0x5a1b9a){return function(_0x2f2bae){if(_0x2f2bae){return _0x2f2bae['update'](_0x347337)[_0x85d5('0x1c')](function(_0x1f8d27){return _0x1f8d27;});}return null;};}function removeEntity(_0x560b3a,_0x4e11c4){return function(_0x4da71b){if(_0x4da71b){return _0x4da71b['destroy']()[_0x85d5('0x1c')](function(){_0x560b3a[_0x85d5('0x13')](0xcc)[_0x85d5('0x14')]();});}};}function handleEntityNotFound(_0x466bbd,_0x12fea3){return function(_0xef2405){if(!_0xef2405){_0x466bbd['sendStatus'](0x194);}return _0xef2405;};}function handleError(_0x7e9a11,_0x4f8c66){_0x4f8c66=_0x4f8c66||0x1f4;return function(_0x1b3fae){logger[_0x85d5('0x1d')](_0x1b3fae[_0x85d5('0x1e')]);if(_0x1b3fae['name']){delete _0x1b3fae[_0x85d5('0x1f')];}_0x7e9a11[_0x85d5('0x13')](_0x4f8c66)[_0x85d5('0x20')](_0x1b3fae);};}exports[_0x85d5('0x21')]=function(_0x4605c5,_0x56031f){var _0x1cbef1={},_0x476c8b={},_0x330f8a={'count':0x0,'rows':[]};var _0x22a961=_[_0x85d5('0x22')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x2ce7a9){return{'name':_0x2ce7a9[_0x85d5('0x23')],'type':_0x2ce7a9[_0x85d5('0x24')][_0x85d5('0x25')]};});_0x476c8b[_0x85d5('0x26')]=_['map'](_0x22a961,_0x85d5('0x1f'));_0x476c8b[_0x85d5('0x27')]=_['keys'](_0x4605c5['query']);_0x476c8b[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x476c8b['model'],_0x476c8b[_0x85d5('0x27')]);_0x1cbef1['attributes']=_[_0x85d5('0x29')](_0x476c8b[_0x85d5('0x26')],qs['fields'](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x1cbef1[_0x85d5('0x2b')]=_0x1cbef1[_0x85d5('0x2b')]['length']?_0x1cbef1['attributes']:_0x476c8b[_0x85d5('0x26')];if(!_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2c')](_0x85d5('0x2d'))){_0x1cbef1[_0x85d5('0x18')]=qs[_0x85d5('0x18')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x18')]);_0x1cbef1[_0x85d5('0x16')]=qs['offset'](_0x4605c5['query'][_0x85d5('0x16')]);}_0x1cbef1[_0x85d5('0x2e')]=qs[_0x85d5('0x2f')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2f')]);_0x1cbef1[_0x85d5('0x30')]=qs[_0x85d5('0x28')](_[_0x85d5('0x31')](_0x4605c5['query'],_0x476c8b[_0x85d5('0x28')]),_0x22a961);if(_0x4605c5[_0x85d5('0x27')][_0x85d5('0x32')]){_0x1cbef1[_0x85d5('0x30')]=_['merge'](_0x1cbef1[_0x85d5('0x30')],{'$or':_[_0x85d5('0x22')](_0x22a961,function(_0x3282d3){if(_0x3282d3[_0x85d5('0x24')]!=='VIRTUAL'){var _0x34caed={};_0x34caed[_0x3282d3['name']]={'$like':'%'+_0x4605c5['query'][_0x85d5('0x32')]+'%'};return _0x34caed;}})});}_0x1cbef1=_['merge']({},_0x1cbef1,_0x4605c5[_0x85d5('0x33')]);var _0x5ddba7={'where':_0x1cbef1['where']};return db[_0x85d5('0x34')][_0x85d5('0x19')](_0x5ddba7)[_0x85d5('0x1c')](function(_0x1beffc){_0x330f8a[_0x85d5('0x19')]=_0x1beffc;if(_0x4605c5['query']['includeAll']){_0x1cbef1[_0x85d5('0x35')]=[{'all':!![]}];}return db[_0x85d5('0x34')][_0x85d5('0x36')](_0x1cbef1);})[_0x85d5('0x1c')](function(_0xdd8b3e){_0x330f8a[_0x85d5('0x37')]=_0xdd8b3e;return _0x330f8a;})['then'](respondWithFilteredResult(_0x56031f,_0x1cbef1))['catch'](handleError(_0x56031f,null));};exports[_0x85d5('0x38')]=function(_0x52c99b,_0xfbf466){var _0x18e94d={'raw':!![],'where':{'id':_0x52c99b[_0x85d5('0x39')]['id']}},_0x7dd430={};_0x7dd430[_0x85d5('0x26')]=_['keys'](db['JscriptyAnswerReport'][_0x85d5('0x3a')]);_0x7dd430[_0x85d5('0x27')]=_[_0x85d5('0x3b')](_0x52c99b[_0x85d5('0x27')]);_0x7dd430[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],_0x7dd430[_0x85d5('0x27')]);_0x18e94d[_0x85d5('0x2b')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],qs[_0x85d5('0x2a')](_0x52c99b[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x18e94d[_0x85d5('0x2b')]=_0x18e94d[_0x85d5('0x2b')][_0x85d5('0x3c')]?_0x18e94d['attributes']:_0x7dd430['model'];if(_0x52c99b[_0x85d5('0x27')][_0x85d5('0x3d')]){_0x18e94d[_0x85d5('0x35')]=[{'all':!![]}];}_0x18e94d=_[_0x85d5('0x3e')]({},_0x18e94d,_0x52c99b[_0x85d5('0x33')]);return db[_0x85d5('0x34')]['find'](_0x18e94d)[_0x85d5('0x1c')](handleEntityNotFound(_0xfbf466,null))['then'](respondWithResult(_0xfbf466,null))['catch'](handleError(_0xfbf466,null));};exports[_0x85d5('0x3f')]=function(_0x13ab32,_0x12a03){return db[_0x85d5('0x34')][_0x85d5('0x3f')](_0x13ab32['body'],{})[_0x85d5('0x1c')](respondWithResult(_0x12a03,0xc9))['catch'](handleError(_0x12a03,null));};exports[_0x85d5('0x40')]=function(_0xd8db57,_0x219154){if(_0xd8db57['body']['id']){delete _0xd8db57['body']['id'];}return db['JscriptyAnswerReport'][_0x85d5('0x41')]({'where':{'id':_0xd8db57[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x219154,null))['then'](saveUpdates(_0xd8db57['body'],null))[_0x85d5('0x1c')](respondWithResult(_0x219154,null))[_0x85d5('0x42')](handleError(_0x219154,null));};exports[_0x85d5('0x43')]=function(_0x288b56,_0x4b2dce){return db[_0x85d5('0x34')][_0x85d5('0x41')]({'where':{'id':_0x288b56[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x4b2dce,null))[_0x85d5('0x1c')](removeEntity(_0x4b2dce,null))[_0x85d5('0x42')](handleError(_0x4b2dce,null));};exports[_0x85d5('0x44')]=function(_0x34b784,_0x185a70){return db[_0x85d5('0x34')][_0x85d5('0x44')]()[_0x85d5('0x1c')](respondWithResult(_0x185a70,null))[_0x85d5('0x42')](handleError(_0x185a70,null));}; \ No newline at end of file +var _0x24ca=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','JscriptyAnswerReport','includeAll','findAll','catch','show','params','keys','include','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x24ca,0x1bc));var _0xa24c=function(_0x7c0074,_0x1ffdcf){_0x7c0074=_0x7c0074-0x0;var _0x13e95b=_0x24ca[_0x7c0074];return _0x13e95b;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){_0x346ee8['status'](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x5cc9cb,_0x2365f9){return function(_0x3951ae){if(!_0x3951ae){_0x5cc9cb[_0xa24c('0x29')](0x194);}return _0x3951ae;};}function handleError(_0x51dc3f,_0x1beb55){_0x1beb55=_0x1beb55||0x1f4;return function(_0x31c4d9){logger[_0xa24c('0x2a')](_0x31c4d9[_0xa24c('0x2b')]);if(_0x31c4d9[_0xa24c('0x2c')]){delete _0x31c4d9[_0xa24c('0x2c')];}_0x51dc3f[_0xa24c('0x1b')](_0x1beb55)['send'](_0x31c4d9);};}exports[_0xa24c('0x2d')]=function(_0x28675f,_0x152120){var _0x12dbdc={},_0x5e491e={},_0x21d2a8={'count':0x0,'rows':[]};var _0xc96ce7=_[_0xa24c('0x2e')](db['JscriptyAnswerReport'][_0xa24c('0x2f')],function(_0x3dcb1b){return{'name':_0x3dcb1b[_0xa24c('0x30')],'type':_0x3dcb1b['type'][_0xa24c('0x31')]};});_0x5e491e['model']=_[_0xa24c('0x2e')](_0xc96ce7,_0xa24c('0x2c'));_0x5e491e[_0xa24c('0x32')]=_['keys'](_0x28675f[_0xa24c('0x32')]);_0x5e491e[_0xa24c('0x33')]=_[_0xa24c('0x34')](_0x5e491e['model'],_0x5e491e[_0xa24c('0x32')]);_0x12dbdc['attributes']=_[_0xa24c('0x34')](_0x5e491e[_0xa24c('0x35')],qs['fields'](_0x28675f['query'][_0xa24c('0x36')]));_0x12dbdc[_0xa24c('0x37')]=_0x12dbdc[_0xa24c('0x37')][_0xa24c('0x38')]?_0x12dbdc[_0xa24c('0x37')]:_0x5e491e[_0xa24c('0x35')];if(!_0x28675f[_0xa24c('0x32')]['hasOwnProperty'](_0xa24c('0x39'))){_0x12dbdc[_0xa24c('0x1e')]=qs[_0xa24c('0x1e')](_0x28675f[_0xa24c('0x32')][_0xa24c('0x1e')]);_0x12dbdc[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x28675f[_0xa24c('0x32')][_0xa24c('0x21')]);}_0x12dbdc[_0xa24c('0x3a')]=qs['sort'](_0x28675f[_0xa24c('0x32')][_0xa24c('0x3b')]);_0x12dbdc[_0xa24c('0x3c')]=qs[_0xa24c('0x33')](_['pick'](_0x28675f['query'],_0x5e491e[_0xa24c('0x33')]),_0xc96ce7);if(_0x28675f['query'][_0xa24c('0x3d')]){_0x12dbdc[_0xa24c('0x3c')]=_[_0xa24c('0x3e')](_0x12dbdc[_0xa24c('0x3c')],{'$or':_[_0xa24c('0x2e')](_0xc96ce7,function(_0x4c0fb9){if(_0x4c0fb9['type']!==_0xa24c('0x3f')){var _0xc661c7={};_0xc661c7[_0x4c0fb9[_0xa24c('0x2c')]]={'$like':'%'+_0x28675f[_0xa24c('0x32')][_0xa24c('0x3d')]+'%'};return _0xc661c7;}})});}_0x12dbdc=_[_0xa24c('0x3e')]({},_0x12dbdc,_0x28675f['options']);var _0x56f392={'where':_0x12dbdc[_0xa24c('0x3c')]};return db[_0xa24c('0x40')][_0xa24c('0x20')](_0x56f392)[_0xa24c('0x27')](function(_0x43beff){_0x21d2a8['count']=_0x43beff;if(_0x28675f[_0xa24c('0x32')][_0xa24c('0x41')]){_0x12dbdc['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xa24c('0x42')](_0x12dbdc);})[_0xa24c('0x27')](function(_0x231eea){_0x21d2a8['rows']=_0x231eea;return _0x21d2a8;})['then'](respondWithFilteredResult(_0x152120,_0x12dbdc))[_0xa24c('0x43')](handleError(_0x152120,null));};exports[_0xa24c('0x44')]=function(_0x31048c,_0x3ccc37){var _0x3f640e={'raw':!![],'where':{'id':_0x31048c[_0xa24c('0x45')]['id']}},_0x1b7faf={};_0x1b7faf[_0xa24c('0x35')]=_['keys'](db['JscriptyAnswerReport'][_0xa24c('0x2f')]);_0x1b7faf[_0xa24c('0x32')]=_[_0xa24c('0x46')](_0x31048c['query']);_0x1b7faf[_0xa24c('0x33')]=_[_0xa24c('0x34')](_0x1b7faf[_0xa24c('0x35')],_0x1b7faf[_0xa24c('0x32')]);_0x3f640e[_0xa24c('0x37')]=_[_0xa24c('0x34')](_0x1b7faf[_0xa24c('0x35')],qs[_0xa24c('0x36')](_0x31048c[_0xa24c('0x32')][_0xa24c('0x36')]));_0x3f640e['attributes']=_0x3f640e[_0xa24c('0x37')][_0xa24c('0x38')]?_0x3f640e[_0xa24c('0x37')]:_0x1b7faf['model'];if(_0x31048c[_0xa24c('0x32')][_0xa24c('0x41')]){_0x3f640e[_0xa24c('0x47')]=[{'all':!![]}];}_0x3f640e=_[_0xa24c('0x3e')]({},_0x3f640e,_0x31048c[_0xa24c('0x48')]);return db[_0xa24c('0x40')][_0xa24c('0x49')](_0x3f640e)[_0xa24c('0x27')](handleEntityNotFound(_0x3ccc37,null))[_0xa24c('0x27')](respondWithResult(_0x3ccc37,null))[_0xa24c('0x43')](handleError(_0x3ccc37,null));};exports[_0xa24c('0x4a')]=function(_0x54dc72,_0x29a84d){return db[_0xa24c('0x40')][_0xa24c('0x4a')](_0x54dc72[_0xa24c('0x4b')],{})[_0xa24c('0x27')](respondWithResult(_0x29a84d,0xc9))[_0xa24c('0x43')](handleError(_0x29a84d,null));};exports[_0xa24c('0x26')]=function(_0x2250b9,_0x184179){if(_0x2250b9['body']['id']){delete _0x2250b9['body']['id'];}return db[_0xa24c('0x40')]['find']({'where':{'id':_0x2250b9[_0xa24c('0x45')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x184179,null))['then'](saveUpdates(_0x2250b9[_0xa24c('0x4b')],null))[_0xa24c('0x27')](respondWithResult(_0x184179,null))[_0xa24c('0x43')](handleError(_0x184179,null));};exports['destroy']=function(_0x55978e,_0x87347c){return db['JscriptyAnswerReport'][_0xa24c('0x49')]({'where':{'id':_0x55978e[_0xa24c('0x45')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x87347c,null))[_0xa24c('0x27')](removeEntity(_0x87347c,null))[_0xa24c('0x43')](handleError(_0x87347c,null));};exports[_0xa24c('0x4c')]=function(_0x3f3ce6,_0x286d57){return db[_0xa24c('0x40')][_0xa24c('0x4c')]()['then'](respondWithResult(_0x286d57,null))[_0xa24c('0x43')](handleError(_0x286d57,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index a069bb0..67b26b3 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 _0xd6d7=['report_jscripty_answers','lodash','util','api','bluebird','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0xd6d7,0xe5));var _0x7d6d=function(_0x5b593b,_0x5d859f){_0x5b593b=_0x5b593b-0x0;var _0x4d9790=_0xd6d7[_0x5b593b];return _0x4d9790;};'use strict';var _=require(_0x7d6d('0x0'));var util=require(_0x7d6d('0x1'));var logger=require('../../config/logger')(_0x7d6d('0x2'));var moment=require('moment');var BPromise=require(_0x7d6d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d6d('0x4'));var rimraf=require(_0x7d6d('0x5'));var config=require(_0x7d6d('0x6'));var attributes=require(_0x7d6d('0x7'));module[_0x7d6d('0x8')]=function(_0x161706,_0x186e67){return _0x161706[_0x7d6d('0x9')](_0x7d6d('0xa'),attributes,{'tableName':_0x7d6d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c78=['../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util'];(function(_0x510a2a,_0x11fcfe){var _0x5311c4=function(_0x5b4ef3){while(--_0x5b4ef3){_0x510a2a['push'](_0x510a2a['shift']());}};_0x5311c4(++_0x11fcfe);}(_0x5c78,0x172));var _0x85c7=function(_0xb05d5a,_0x54bcde){_0xb05d5a=_0xb05d5a-0x0;var _0x3cf890=_0x5c78[_0xb05d5a];return _0x3cf890;};'use strict';var _=require(_0x85c7('0x0'));var util=require(_0x85c7('0x1'));var logger=require(_0x85c7('0x2'))(_0x85c7('0x3'));var moment=require(_0x85c7('0x4'));var BPromise=require('bluebird');var rp=require(_0x85c7('0x5'));var fs=require('fs');var path=require(_0x85c7('0x6'));var rimraf=require('rimraf');var config=require(_0x85c7('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x85c7('0x8')]=function(_0xa99cb5,_0x5c6dc3){return _0xa99cb5[_0x85c7('0x9')](_0x85c7('0xa'),attributes,{'tableName':_0x85c7('0xb'),'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 7a43cb7..b6f8ea7 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 _0x6069=['info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6069,0x1c1));var _0x9606=function(_0x529046,_0x323c1b){_0x529046=_0x529046-0x0;var _0x39e373=_0x6069[_0x529046];return _0x39e373;};'use strict';var _=require(_0x9606('0x0'));var util=require(_0x9606('0x1'));var moment=require('moment');var BPromise=require(_0x9606('0x2'));var rs=require(_0x9606('0x3'));var fs=require('fs');var Redis=require(_0x9606('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9606('0x5'));var logger=require(_0x9606('0x6'))(_0x9606('0x7'));var config=require(_0x9606('0x8'));var jayson=require(_0x9606('0x9'));var client=jayson[_0x9606('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56661e,_0x7ce7f0,_0xcb9c7a){return new BPromise(function(_0x5ed357,_0x538479){return client[_0x9606('0xb')](_0x56661e,_0xcb9c7a)[_0x9606('0xc')](function(_0x1a0d7c){logger[_0x9606('0xd')](_0x9606('0xe'),_0x7ce7f0,_0x9606('0xf'));logger[_0x9606('0x10')](_0x9606('0x11'),_0x7ce7f0,_0x9606('0xf'),JSON[_0x9606('0x12')](_0x1a0d7c));if(_0x1a0d7c[_0x9606('0x13')]){if(_0x1a0d7c['error']['code']===0x1f4){logger[_0x9606('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x7ce7f0,_0x1a0d7c[_0x9606('0x13')][_0x9606('0x14')]);return _0x538479(_0x1a0d7c[_0x9606('0x13')][_0x9606('0x14')]);}logger[_0x9606('0x13')](_0x9606('0xe'),_0x7ce7f0,_0x1a0d7c['error']['message']);return _0x5ed357(_0x1a0d7c[_0x9606('0x13')][_0x9606('0x14')]);}else{logger['info'](_0x9606('0xe'),_0x7ce7f0,_0x9606('0xf'));_0x5ed357(_0x1a0d7c['result'][_0x9606('0x14')]);}})[_0x9606('0x15')](function(_0x36eb78){logger[_0x9606('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x7ce7f0,_0x36eb78);_0x538479(_0x36eb78);});});} \ No newline at end of file +var _0x5b78=['stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent'];(function(_0x46f841,_0x578e64){var _0x549813=function(_0x3ffa82){while(--_0x3ffa82){_0x46f841['push'](_0x46f841['shift']());}};_0x549813(++_0x578e64);}(_0x5b78,0x18f));var _0x85b7=function(_0x4323f1,_0x316c77){_0x4323f1=_0x4323f1-0x0;var _0x255a0d=_0x5b78[_0x4323f1];return _0x255a0d;};'use strict';var _=require(_0x85b7('0x0'));var util=require(_0x85b7('0x1'));var moment=require(_0x85b7('0x2'));var BPromise=require(_0x85b7('0x3'));var rs=require(_0x85b7('0x4'));var fs=require('fs');var Redis=require(_0x85b7('0x5'));var db=require(_0x85b7('0x6'))['db'];var utils=require(_0x85b7('0x7'));var logger=require('../../config/logger')(_0x85b7('0x8'));var config=require(_0x85b7('0x9'));var jayson=require(_0x85b7('0xa'));var client=jayson['client'][_0x85b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x585614,_0x166b72,_0xcdf1bf){return new BPromise(function(_0xfc94c3,_0x5858f1){return client[_0x85b7('0xc')](_0x585614,_0xcdf1bf)[_0x85b7('0xd')](function(_0x19372e){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x166b72,_0x85b7('0xe'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x166b72,'request\x20sent',JSON[_0x85b7('0xf')](_0x19372e));if(_0x19372e[_0x85b7('0x10')]){if(_0x19372e[_0x85b7('0x10')][_0x85b7('0x11')]===0x1f4){logger[_0x85b7('0x10')](_0x85b7('0x12'),_0x166b72,_0x19372e['error'][_0x85b7('0x13')]);return _0x5858f1(_0x19372e[_0x85b7('0x10')][_0x85b7('0x13')]);}logger[_0x85b7('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x166b72,_0x19372e['error'][_0x85b7('0x13')]);return _0xfc94c3(_0x19372e['error'][_0x85b7('0x13')]);}else{logger[_0x85b7('0x14')](_0x85b7('0x12'),_0x166b72,_0x85b7('0xe'));_0xfc94c3(_0x19372e[_0x85b7('0x15')][_0x85b7('0x13')]);}})[_0x85b7('0x16')](function(_0x248c86){logger[_0x85b7('0x10')](_0x85b7('0x12'),_0x166b72,_0x248c86);_0x5858f1(_0x248c86);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index d059ce5..ff6af86 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 _0x954b=['/:id/summary','30s','post','create','/:id/clone','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','get','getAnswers'];(function(_0x5a011c,_0x4214bc){var _0x1ebbf1=function(_0x2c119b){while(--_0x2c119b){_0x5a011c['push'](_0x5a011c['shift']());}};_0x1ebbf1(++_0x4214bc);}(_0x954b,0x1a0));var _0xb954=function(_0x47adb8,_0x591ccc){_0x47adb8=_0x47adb8-0x0;var _0x4689a8=_0x954b[_0x47adb8];return _0x4689a8;};'use strict';var multer=require(_0xb954('0x0'));var util=require(_0xb954('0x1'));var path=require(_0xb954('0x2'));var timeout=require(_0xb954('0x3'));var express=require(_0xb954('0x4'));var router=express['Router']();var fs_extra=require(_0xb954('0x5'));var auth=require(_0xb954('0x6'));var interaction=require(_0xb954('0x7'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0xb954('0x8')](),controller[_0xb954('0x9')]);router['get'](_0xb954('0xa'),auth['isAuthenticated'](),controller[_0xb954('0xb')]);router['get'](_0xb954('0xc'),auth['isAuthenticated'](),controller[_0xb954('0xd')]);router[_0xb954('0xe')]('/:id/answers',auth[_0xb954('0x8')](),controller[_0xb954('0xf')]);router['get'](_0xb954('0x10'),auth['isAuthenticated'](),timeout(_0xb954('0x11')),controller['getSummary']);router[_0xb954('0x12')]('/',auth['isAuthenticated'](),controller[_0xb954('0x13')]);router[_0xb954('0x12')](_0xb954('0x14'),auth[_0xb954('0x8')](),controller['clone']);router['put'](_0xb954('0xa'),auth[_0xb954('0x8')](),controller[_0xb954('0x15')]);router[_0xb954('0x16')]('/:id',auth[_0xb954('0x8')](),controller[_0xb954('0x17')]);module['exports']=router; \ No newline at end of file +var _0x5f67=['/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','post','create','/:id/clone','clone','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','show'];(function(_0x42a34c,_0x233b38){var _0x4d8319=function(_0x5da0a2){while(--_0x5da0a2){_0x42a34c['push'](_0x42a34c['shift']());}};_0x4d8319(++_0x233b38);}(_0x5f67,0x1aa));var _0x75f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f67[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x75f6('0x0'));var util=require('util');var path=require(_0x75f6('0x1'));var timeout=require(_0x75f6('0x2'));var express=require(_0x75f6('0x3'));var router=express[_0x75f6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x75f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x75f6('0x6'));var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0x75f6('0x7')](),controller['index']);router[_0x75f6('0x8')](_0x75f6('0x9'),auth[_0x75f6('0x7')](),controller[_0x75f6('0xa')]);router[_0x75f6('0x8')](_0x75f6('0xb'),auth[_0x75f6('0x7')](),controller[_0x75f6('0xc')]);router[_0x75f6('0x8')](_0x75f6('0xd'),auth[_0x75f6('0x7')](),controller['getAnswers']);router[_0x75f6('0x8')](_0x75f6('0xe'),auth['isAuthenticated'](),timeout(_0x75f6('0xf')),controller['getSummary']);router[_0x75f6('0x10')]('/',auth[_0x75f6('0x7')](),controller[_0x75f6('0x11')]);router[_0x75f6('0x10')](_0x75f6('0x12'),auth[_0x75f6('0x7')](),controller[_0x75f6('0x13')]);router['put'](_0x75f6('0x9'),auth[_0x75f6('0x7')](),controller[_0x75f6('0x14')]);router['delete'](_0x75f6('0x9'),auth[_0x75f6('0x7')](),controller[_0x75f6('0x15')]);module[_0x75f6('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index a2fb790..e5b8896 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 _0x9d17=['description','sequelize','lodash','util','name','STRING','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0xf12290,_0x1883bb){var _0x2383e5=function(_0x32f0ee){while(--_0x32f0ee){_0xf12290['push'](_0xf12290['shift']());}};_0x2383e5(++_0x1883bb);}(_0x9d17,0x91));var _0x79d1=function(_0x956c1c,_0x5bde4e){_0x956c1c=_0x956c1c-0x0;var _0x43ddbb=_0x9d17[_0x956c1c];return _0x43ddbb;};'use strict';var Sequelize=require(_0x79d1('0x0'));var _=require(_0x79d1('0x1'));var util=require(_0x79d1('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x79d1('0x3')},'description':{'type':Sequelize[_0x79d1('0x4')]},'formData':{'type':Sequelize[_0x79d1('0x5')](_0x79d1('0x6')),'set':function(_0x130a51){if(_[_0x79d1('0x7')](_0x130a51)){this[_0x79d1('0x8')]('formData',JSON[_0x79d1('0x9')](_0x130a51));}else if(_[_0x79d1('0xa')](_0x130a51)){this[_0x79d1('0x8')](_0x79d1('0xb'),_0x130a51);}else{this[_0x79d1('0x8')]('formData',util[_0x79d1('0xc')](_0x79d1('0xd'),this[_0x79d1('0xe')](_0x79d1('0x3'))||'',this[_0x79d1('0xe')](_0x79d1('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x09ef=['exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','util'];(function(_0x1a158a,_0xdd344c){var _0x3b319a=function(_0x2df342){while(--_0x2df342){_0x1a158a['push'](_0x1a158a['shift']());}};_0x3b319a(++_0xdd344c);}(_0x09ef,0x18e));var _0xf09e=function(_0x13f9dc,_0x28b0e3){_0x13f9dc=_0x13f9dc-0x0;var _0x46ecb8=_0x09ef[_0x13f9dc];return _0x46ecb8;};'use strict';var Sequelize=require('sequelize');var _=require(_0xf09e('0x0'));var util=require(_0xf09e('0x1'));module[_0xf09e('0x2')]={'name':{'type':Sequelize[_0xf09e('0x3')],'unique':_0xf09e('0x4')},'description':{'type':Sequelize[_0xf09e('0x3')]},'formData':{'type':Sequelize[_0xf09e('0x5')](_0xf09e('0x6')),'set':function(_0x261ec3){if(_[_0xf09e('0x7')](_0x261ec3)){this[_0xf09e('0x8')](_0xf09e('0x9'),JSON[_0xf09e('0xa')](_0x261ec3));}else if(_[_0xf09e('0xb')](_0x261ec3)){this[_0xf09e('0x8')]('formData',_0x261ec3);}else{this['setDataValue'](_0xf09e('0x9'),util['format'](_0xf09e('0xc'),this[_0xf09e('0xd')]('name')||'',this['getDataValue'](_0xf09e('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf09e('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 04828a5..e1b0598 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 _0xb921=['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/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','UserProfileResource','error','name','index','map','JscriptyProject','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','includeAll','omit','updatedAt','createdAt','userProfileId','getSessions','findOne','JscriptySessionReport','order','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','indexOf','toString','replace','getSummary','startTime','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x4c97c3,_0x38dd8d){var _0x46b69c=function(_0xf8b524){while(--_0xf8b524){_0x4c97c3['push'](_0x4c97c3['shift']());}};_0x46b69c(++_0x38dd8d);}(_0xb921,0x16a));var _0x1b92=function(_0x489187,_0x3f382b){_0x489187=_0x489187-0x0;var _0x4a332e=_0xb921[_0x489187];return _0x4a332e;};'use strict';var emlformat=require(_0x1b92('0x0'));var rimraf=require(_0x1b92('0x1'));var zipdir=require(_0x1b92('0x2'));var jsonpatch=require(_0x1b92('0x3'));var rp=require(_0x1b92('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1b92('0x5'));var util=require(_0x1b92('0x6'));var path=require(_0x1b92('0x7'));var sox=require(_0x1b92('0x8'));var csv=require(_0x1b92('0x9'));var ejs=require(_0x1b92('0xa'));var fs=require('fs');var fs_extra=require(_0x1b92('0xb'));var _=require(_0x1b92('0xc'));var squel=require(_0x1b92('0xd'));var crypto=require(_0x1b92('0xe'));var jsforce=require(_0x1b92('0xf'));var deskjs=require(_0x1b92('0x10'));var toCsv=require(_0x1b92('0x9'));var querystring=require(_0x1b92('0x11'));var Papa=require(_0x1b92('0x12'));var Redis=require('ioredis');var authService=require(_0x1b92('0x13'));var qs=require(_0x1b92('0x14'));var as=require(_0x1b92('0x15'));var hardwareService=require(_0x1b92('0x16'));var logger=require(_0x1b92('0x17'))(_0x1b92('0x18'));var utils=require(_0x1b92('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1b92('0x1a'));var db=require(_0x1b92('0x1b'))['db'];function respondWithStatusCode(_0x5a1ca5,_0x81cbe0){_0x81cbe0=_0x81cbe0||0xcc;return function(_0x29a7ed){if(_0x29a7ed){return _0x5a1ca5[_0x1b92('0x1c')](_0x81cbe0);}return _0x5a1ca5[_0x1b92('0x1d')](_0x81cbe0)[_0x1b92('0x1e')]();};}function respondWithResult(_0x290be6,_0x1d33bf){_0x1d33bf=_0x1d33bf||0xc8;return function(_0x4bbb76){if(_0x4bbb76){return _0x290be6[_0x1b92('0x1d')](_0x1d33bf)['json'](_0x4bbb76);}};}function respondWithFilteredResult(_0x1a559b,_0x511a97){return function(_0x694d4f){if(_0x694d4f){var _0x523285=typeof _0x511a97[_0x1b92('0x1f')]===_0x1b92('0x20')&&typeof _0x511a97[_0x1b92('0x21')]==='undefined';var _0x2d171f=_0x694d4f[_0x1b92('0x22')];var _0x289523=_0x523285?0x0:_0x511a97[_0x1b92('0x1f')];var _0x4368dc=_0x523285?_0x694d4f['count']:_0x511a97[_0x1b92('0x1f')]+_0x511a97[_0x1b92('0x21')];var _0x30b0d8;if(_0x4368dc>=_0x2d171f){_0x4368dc=_0x2d171f;_0x30b0d8=0xc8;}else{_0x30b0d8=0xce;}_0x1a559b['status'](_0x30b0d8);return _0x1a559b[_0x1b92('0x23')](_0x1b92('0x24'),_0x289523+'-'+_0x4368dc+'/'+_0x2d171f)[_0x1b92('0x25')](_0x694d4f);}return null;};}function patchUpdates(_0x4bfc51){return function(_0x1d9d28){try{jsonpatch['apply'](_0x1d9d28,_0x4bfc51,!![]);}catch(_0x39ef4e){return BPromise[_0x1b92('0x26')](_0x39ef4e);}return _0x1d9d28['save']();};}function saveUpdates(_0x4ea25f,_0x34c5c9){return function(_0x311487){if(_0x311487){return _0x311487[_0x1b92('0x27')](_0x4ea25f)[_0x1b92('0x28')](function(_0x41fc82){return _0x41fc82;});}return null;};}function removeEntity(_0x186030,_0x48cdf1){return function(_0x3be220){if(_0x3be220){return _0x3be220[_0x1b92('0x29')]()[_0x1b92('0x28')](function(){var _0x39dcaa=_0x3be220['get']({'plain':!![]});var _0x3f0e1b='Projects';return db[_0x1b92('0x2a')][_0x1b92('0x29')]({'where':{'type':_0x3f0e1b,'resourceId':_0x39dcaa['id']}})[_0x1b92('0x28')](function(){return _0x3be220;});})[_0x1b92('0x28')](function(){_0x186030[_0x1b92('0x1d')](0xcc)[_0x1b92('0x1e')]();});}};}function handleEntityNotFound(_0xa56a28,_0x44f379){return function(_0x4edbce){if(!_0x4edbce){_0xa56a28['sendStatus'](0x194);}return _0x4edbce;};}function handleError(_0x54d92c,_0x229c44){_0x229c44=_0x229c44||0x1f4;return function(_0x525d05){logger[_0x1b92('0x2b')](_0x525d05['stack']);if(_0x525d05[_0x1b92('0x2c')]){delete _0x525d05[_0x1b92('0x2c')];}_0x54d92c[_0x1b92('0x1d')](_0x229c44)['send'](_0x525d05);};}exports[_0x1b92('0x2d')]=function(_0x6f9678,_0x55eafd){var _0x544105={},_0x477498={},_0x3740e1={'count':0x0,'rows':[]};var _0x165f93=_[_0x1b92('0x2e')](db[_0x1b92('0x2f')]['rawAttributes'],function(_0x1f38f3){return{'name':_0x1f38f3[_0x1b92('0x30')],'type':_0x1f38f3[_0x1b92('0x31')][_0x1b92('0x32')]};});_0x477498[_0x1b92('0x33')]=_[_0x1b92('0x2e')](_0x165f93,_0x1b92('0x2c'));_0x477498['query']=_[_0x1b92('0x34')](_0x6f9678[_0x1b92('0x35')]);_0x477498['filters']=_[_0x1b92('0x36')](_0x477498[_0x1b92('0x33')],_0x477498[_0x1b92('0x35')]);_0x544105['attributes']=_[_0x1b92('0x36')](_0x477498[_0x1b92('0x33')],qs['fields'](_0x6f9678['query'][_0x1b92('0x37')]));_0x544105[_0x1b92('0x38')]=_0x544105[_0x1b92('0x38')][_0x1b92('0x39')]?_0x544105['attributes']:_0x477498['model'];if(!_0x6f9678['query'][_0x1b92('0x3a')](_0x1b92('0x3b'))){_0x544105[_0x1b92('0x21')]=qs[_0x1b92('0x21')](_0x6f9678[_0x1b92('0x35')][_0x1b92('0x21')]);_0x544105[_0x1b92('0x1f')]=qs['offset'](_0x6f9678[_0x1b92('0x35')][_0x1b92('0x1f')]);}_0x544105['order']=qs[_0x1b92('0x3c')](_0x6f9678[_0x1b92('0x35')][_0x1b92('0x3c')]);_0x544105[_0x1b92('0x3d')]=qs[_0x1b92('0x3e')](_[_0x1b92('0x3f')](_0x6f9678[_0x1b92('0x35')],_0x477498[_0x1b92('0x3e')]),_0x165f93);if(_0x6f9678[_0x1b92('0x35')][_0x1b92('0x40')]){_0x544105['where']=_[_0x1b92('0x41')](_0x544105['where'],{'$or':_[_0x1b92('0x2e')](_0x165f93,function(_0x588b3c){if(_0x588b3c[_0x1b92('0x31')]!==_0x1b92('0x42')){var _0x25e709={};_0x25e709[_0x588b3c[_0x1b92('0x2c')]]={'$like':'%'+_0x6f9678[_0x1b92('0x35')][_0x1b92('0x40')]+'%'};return _0x25e709;}})});}_0x544105=_[_0x1b92('0x41')]({},_0x544105,_0x6f9678[_0x1b92('0x43')]);var _0x46b06b={'where':_0x544105['where']};return db[_0x1b92('0x2f')]['count'](_0x46b06b)[_0x1b92('0x28')](function(_0x1e945){_0x3740e1[_0x1b92('0x22')]=_0x1e945;if(_0x6f9678[_0x1b92('0x35')]['includeAll']){_0x544105[_0x1b92('0x44')]=[{'all':!![]}];}return db[_0x1b92('0x2f')][_0x1b92('0x45')](_0x544105);})[_0x1b92('0x28')](function(_0xd3f7b0){_0x3740e1[_0x1b92('0x46')]=_0xd3f7b0;return _0x3740e1;})['then'](respondWithFilteredResult(_0x55eafd,_0x544105))[_0x1b92('0x47')](handleError(_0x55eafd,null));};exports[_0x1b92('0x48')]=function(_0x2dcd14,_0x1cb316){var _0x3f77c3={'raw':![],'where':{'id':_0x2dcd14['params']['id']}},_0x2bb12f={};_0x2bb12f[_0x1b92('0x33')]=_[_0x1b92('0x34')](db['JscriptyProject'][_0x1b92('0x49')]);_0x2bb12f['query']=_[_0x1b92('0x34')](_0x2dcd14[_0x1b92('0x35')]);_0x2bb12f[_0x1b92('0x3e')]=_['intersection'](_0x2bb12f[_0x1b92('0x33')],_0x2bb12f[_0x1b92('0x35')]);_0x3f77c3['attributes']=_['intersection'](_0x2bb12f['model'],qs[_0x1b92('0x37')](_0x2dcd14[_0x1b92('0x35')][_0x1b92('0x37')]));_0x3f77c3[_0x1b92('0x38')]=_0x3f77c3[_0x1b92('0x38')][_0x1b92('0x39')]?_0x3f77c3['attributes']:_0x2bb12f[_0x1b92('0x33')];if(_0x2dcd14[_0x1b92('0x35')]['includeAll']){_0x3f77c3[_0x1b92('0x44')]=[{'all':!![]}];}_0x3f77c3=_[_0x1b92('0x41')]({},_0x3f77c3,_0x2dcd14[_0x1b92('0x43')]);return db['JscriptyProject'][_0x1b92('0x4a')](_0x3f77c3)[_0x1b92('0x28')](handleEntityNotFound(_0x1cb316,null))[_0x1b92('0x28')](respondWithResult(_0x1cb316,null))[_0x1b92('0x47')](handleError(_0x1cb316,null));};exports[_0x1b92('0x4b')]=function(_0x5ac096,_0x142d28){return db[_0x1b92('0x2f')][_0x1b92('0x4b')](_0x5ac096[_0x1b92('0x4c')],{})[_0x1b92('0x28')](function(_0x515292){var _0x5c5ebf=_0x5ac096[_0x1b92('0x4d')][_0x1b92('0x4e')]({'plain':!![]});if(!_0x5c5ebf)throw new Error(_0x1b92('0x4f'));if(_0x5c5ebf[_0x1b92('0x50')]==='user'){var _0x4e0954=_0x515292[_0x1b92('0x4e')]({'plain':!![]});var _0x5e10fa=_0x1b92('0x51');return db[_0x1b92('0x52')][_0x1b92('0x4a')]({'where':{'name':_0x5e10fa,'userProfileId':_0x5c5ebf['userProfileId']},'raw':!![]})[_0x1b92('0x28')](function(_0x559e3c){if(_0x559e3c&&_0x559e3c[_0x1b92('0x53')]===0x0){return db[_0x1b92('0x2a')][_0x1b92('0x4b')]({'name':_0x4e0954[_0x1b92('0x2c')],'resourceId':_0x4e0954['id'],'type':_0x559e3c[_0x1b92('0x2c')],'sectionId':_0x559e3c['id']},{})[_0x1b92('0x28')](function(){return _0x515292;});}else{return _0x515292;}})['catch'](function(_0x140202){logger['error'](_0x1b92('0x54'),_0x140202);throw _0x140202;});}return _0x515292;})[_0x1b92('0x28')](respondWithResult(_0x142d28,0xc9))[_0x1b92('0x47')](handleError(_0x142d28,null));};exports[_0x1b92('0x55')]=function(_0x376a9c,_0x3cab8e){var _0x306395={'where':{'id':_0x376a9c[_0x1b92('0x56')]['id']}},_0x32d994={};_0x32d994[_0x1b92('0x33')]=_[_0x1b92('0x34')](db[_0x1b92('0x2f')][_0x1b92('0x49')]);_0x306395[_0x1b92('0x38')]=_[_0x1b92('0x36')](_0x32d994[_0x1b92('0x33')],qs[_0x1b92('0x37')](_0x376a9c[_0x1b92('0x35')][_0x1b92('0x37')]));_0x306395[_0x1b92('0x38')]=_0x306395['attributes'][_0x1b92('0x39')]?_0x306395[_0x1b92('0x38')]:_0x32d994['model'];if(_0x376a9c[_0x1b92('0x35')][_0x1b92('0x57')]){_0x306395['include']=[{'all':!![]}];}_0x306395=_['merge']({},_0x306395,_0x376a9c[_0x1b92('0x43')]);return db[_0x1b92('0x2f')]['find'](_0x306395)[_0x1b92('0x28')](handleEntityNotFound(_0x3cab8e,null))[_0x1b92('0x28')](function(_0x1519d7){if(_0x1519d7){var _0x33069d=_0x1519d7[_0x1b92('0x4e')]({'plain':!![]});_0x33069d=qs[_0x1b92('0x58')](_0x33069d,['id','createdAt',_0x1b92('0x59')]);_0x376a9c['body']=_['omit'](_0x376a9c[_0x1b92('0x4c')],['id',_0x1b92('0x5a'),_0x1b92('0x59')]);return db[_0x1b92('0x2f')][_0x1b92('0x4b')](_[_0x1b92('0x41')](_0x33069d,_0x376a9c[_0x1b92('0x4c')]),{'include':_0x376a9c[_0x1b92('0x35')][_0x1b92('0x57')]?[{'all':!![]}]:undefined})[_0x1b92('0x28')](function(_0x587956){var _0x3ad925=_0x376a9c[_0x1b92('0x4d')][_0x1b92('0x4e')]({'plain':!![]});if(!_0x3ad925)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ad925['role']===_0x1b92('0x4d')){var _0x1b5c91=_0x587956[_0x1b92('0x4e')]({'plain':!![]});var _0x456f8c=_0x1b92('0x51');return db[_0x1b92('0x52')][_0x1b92('0x4a')]({'where':{'name':_0x456f8c,'userProfileId':_0x3ad925[_0x1b92('0x5b')]},'raw':!![]})[_0x1b92('0x28')](function(_0x406dd4){if(_0x406dd4&&_0x406dd4[_0x1b92('0x53')]===0x0){return db[_0x1b92('0x2a')]['create']({'name':_0x1b5c91[_0x1b92('0x2c')],'resourceId':_0x1b5c91['id'],'type':_0x406dd4[_0x1b92('0x2c')],'sectionId':_0x406dd4['id']},{})['then'](function(){return _0x587956;});}else{return _0x587956;}})[_0x1b92('0x47')](function(_0x46d1e9){logger['error'](_0x1b92('0x54'),_0x46d1e9);throw _0x46d1e9;});}return _0x587956;});}})[_0x1b92('0x28')](respondWithResult(_0x3cab8e,0xc9))[_0x1b92('0x47')](handleError(_0x3cab8e,null));};exports[_0x1b92('0x27')]=function(_0x2540d2,_0x590426){if(_0x2540d2['body']['id']){delete _0x2540d2['body']['id'];}return db['JscriptyProject'][_0x1b92('0x4a')]({'where':{'id':_0x2540d2[_0x1b92('0x56')]['id']}})[_0x1b92('0x28')](handleEntityNotFound(_0x590426,null))[_0x1b92('0x28')](saveUpdates(_0x2540d2['body'],null))[_0x1b92('0x28')](respondWithResult(_0x590426,null))[_0x1b92('0x47')](handleError(_0x590426,null));};exports['destroy']=function(_0x31977e,_0x51a2a1){return db['JscriptyProject'][_0x1b92('0x4a')]({'where':{'id':_0x31977e['params']['id']}})[_0x1b92('0x28')](handleEntityNotFound(_0x51a2a1,null))[_0x1b92('0x28')](removeEntity(_0x51a2a1,null))[_0x1b92('0x47')](handleError(_0x51a2a1,null));};exports[_0x1b92('0x5c')]=function(_0x197a4b,_0xd092bb,_0x5b408e){var _0x1e5951={'raw':!![],'where':{}};var _0x1bab85={};var _0xc0a853={'count':0x0,'rows':[]};return db[_0x1b92('0x2f')][_0x1b92('0x5d')]({'where':{'id':_0x197a4b['params']['id']}})['then'](handleEntityNotFound(_0xd092bb,null))[_0x1b92('0x28')](function(_0x22e1b2){if(_0x22e1b2){_0x1bab85[_0x1b92('0x33')]=_[_0x1b92('0x34')](db[_0x1b92('0x5e')][_0x1b92('0x49')]);_0x1bab85[_0x1b92('0x35')]=_[_0x1b92('0x34')](_0x197a4b[_0x1b92('0x35')]);_0x1bab85['filters']=_[_0x1b92('0x36')](_0x1bab85[_0x1b92('0x33')],_0x1bab85[_0x1b92('0x35')]);_0x1e5951[_0x1b92('0x38')]=_[_0x1b92('0x36')](_0x1bab85[_0x1b92('0x33')],qs[_0x1b92('0x37')](_0x197a4b['query'][_0x1b92('0x37')]));_0x1e5951['attributes']=_0x1e5951['attributes'][_0x1b92('0x39')]?_0x1e5951[_0x1b92('0x38')]:_0x1bab85[_0x1b92('0x33')];if(!_0x197a4b[_0x1b92('0x35')]['hasOwnProperty']('nolimit')){_0x1e5951[_0x1b92('0x21')]=qs[_0x1b92('0x21')](_0x197a4b['query'][_0x1b92('0x21')]);_0x1e5951[_0x1b92('0x1f')]=qs[_0x1b92('0x1f')](_0x197a4b[_0x1b92('0x35')][_0x1b92('0x1f')]);}_0x1e5951[_0x1b92('0x5f')]=qs['sort'](_0x197a4b[_0x1b92('0x35')][_0x1b92('0x3c')]);_0x1e5951[_0x1b92('0x3d')]=qs[_0x1b92('0x3e')](_[_0x1b92('0x3f')](_0x197a4b['query'],_0x1bab85[_0x1b92('0x3e')]));_0x1e5951[_0x1b92('0x3d')][_0x1b92('0x60')]=_0x22e1b2['id'];if(_0x197a4b[_0x1b92('0x35')]['filter']){_0x1e5951[_0x1b92('0x3d')]=_[_0x1b92('0x41')](_0x1e5951['where'],{'$or':_[_0x1b92('0x2e')](_0x1e5951[_0x1b92('0x38')],function(_0x23958a){var _0x2fb82b={};_0x2fb82b[_0x23958a]={'$like':'%'+_0x197a4b[_0x1b92('0x35')][_0x1b92('0x40')]+'%'};return _0x2fb82b;})});}_0x1e5951=_['merge']({},_0x1e5951,_0x197a4b[_0x1b92('0x43')]);return db[_0x1b92('0x5e')][_0x1b92('0x22')]({'where':_0x1e5951[_0x1b92('0x3d')]})[_0x1b92('0x28')](function(_0x2fa5d9){_0xc0a853[_0x1b92('0x22')]=_0x2fa5d9;if(_0x197a4b['query'][_0x1b92('0x57')]){_0x1e5951[_0x1b92('0x44')]=[{'all':!![]}];}return db[_0x1b92('0x5e')]['findAll'](_0x1e5951);})[_0x1b92('0x28')](function(_0x17bde5){_0xc0a853[_0x1b92('0x46')]=_0x17bde5;return _0xc0a853;});}})[_0x1b92('0x28')](respondWithFilteredResult(_0xd092bb,_0x1e5951))[_0x1b92('0x47')](handleError(_0xd092bb,null));};exports[_0x1b92('0x61')]=function(_0x685d82,_0x452284,_0x5c6586){var _0x334e3a={'raw':!![],'where':{}};var _0x558978={};var _0x22b84e={'count':0x0,'rows':[]};return db[_0x1b92('0x2f')][_0x1b92('0x5d')]({'where':{'id':_0x685d82[_0x1b92('0x56')]['id']}})[_0x1b92('0x28')](handleEntityNotFound(_0x452284,null))['then'](function(_0x1b74f3){if(_0x1b74f3){_0x558978[_0x1b92('0x33')]=_[_0x1b92('0x34')](db[_0x1b92('0x62')][_0x1b92('0x49')]);_0x558978[_0x1b92('0x35')]=_[_0x1b92('0x34')](_0x685d82[_0x1b92('0x35')]);_0x558978[_0x1b92('0x3e')]=_[_0x1b92('0x36')](_0x558978['model'],_0x558978[_0x1b92('0x35')]);_0x334e3a[_0x1b92('0x38')]=_[_0x1b92('0x36')](_0x558978['model'],qs[_0x1b92('0x37')](_0x685d82[_0x1b92('0x35')]['fields']));_0x334e3a[_0x1b92('0x38')]=_0x334e3a['attributes'][_0x1b92('0x39')]?_0x334e3a['attributes']:_0x558978['model'];if(!_0x685d82['query'][_0x1b92('0x3a')](_0x1b92('0x3b'))){_0x334e3a[_0x1b92('0x21')]=qs[_0x1b92('0x21')](_0x685d82[_0x1b92('0x35')]['limit']);_0x334e3a[_0x1b92('0x1f')]=qs[_0x1b92('0x1f')](_0x685d82[_0x1b92('0x35')][_0x1b92('0x1f')]);}_0x334e3a[_0x1b92('0x5f')]=qs['sort'](_0x685d82[_0x1b92('0x35')][_0x1b92('0x3c')]);_0x334e3a[_0x1b92('0x3d')]=qs[_0x1b92('0x3e')](_[_0x1b92('0x3f')](_0x685d82[_0x1b92('0x35')],_0x558978[_0x1b92('0x3e')]));_0x334e3a[_0x1b92('0x3d')]['ProjectId']=_0x1b74f3['id'];if(_0x685d82[_0x1b92('0x35')]['filter']){_0x334e3a[_0x1b92('0x3d')]=_['merge'](_0x334e3a[_0x1b92('0x3d')],{'$or':_[_0x1b92('0x2e')](_0x334e3a['attributes'],function(_0xb08603){var _0x21466a={};_0x21466a[_0xb08603]={'$like':'%'+_0x685d82[_0x1b92('0x35')][_0x1b92('0x40')]+'%'};return _0x21466a;})});}_0x334e3a=_[_0x1b92('0x41')]({},_0x334e3a,_0x685d82[_0x1b92('0x43')]);return db[_0x1b92('0x62')][_0x1b92('0x22')]({'where':_0x334e3a[_0x1b92('0x3d')]})['then'](function(_0x159bc8){_0x22b84e[_0x1b92('0x22')]=_0x159bc8;if(_0x685d82[_0x1b92('0x35')]['includeAll']){_0x334e3a['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x334e3a);})[_0x1b92('0x28')](function(_0x22ea06){_0x22b84e[_0x1b92('0x46')]=_0x22ea06;return _0x22b84e;});}})['then'](respondWithFilteredResult(_0x452284,_0x334e3a))[_0x1b92('0x47')](handleError(_0x452284,null));};function char(_0x121aac){return _0x1b92('0x63')===typeof _0x121aac?String[_0x1b92('0x64')][_0x1b92('0x65')](null,arguments):_0x121aac;}function needsEncapsulation(_0x341b0d){return!!_0x341b0d&&(_0x341b0d['toString']()[_0x1b92('0x66')](char(0xd))>=0x0||_0x341b0d[_0x1b92('0x67')]()[_0x1b92('0x66')](char(0xa))>=0x0||_0x341b0d['toString']()[_0x1b92('0x66')](char(0x2c))>=0x0||_0x341b0d[_0x1b92('0x67')]()[_0x1b92('0x66')](char(0x22))>=0x0);}function encapsulate(_0x41b264){var _0x550cb4=char(0x22),_0x4d8dd1='\x5c'+char(0x22),_0x9fd44d=_0x41b264[_0x1b92('0x67')]()[_0x1b92('0x68')](new RegExp(_0x550cb4,'g'),_0x4d8dd1);return _0x550cb4+_0x9fd44d+_0x550cb4;}exports[_0x1b92('0x69')]=function(_0x2624ef,_0x5befe5,_0x43f256){var _0xf2629a,_0x40b0a3;var _0x186d97={'where':{'ProjectId':_0x2624ef[_0x1b92('0x56')]['id']}};if(_0x2624ef[_0x1b92('0x35')][_0x1b92('0x6a')]){_0x186d97[_0x1b92('0x3d')][_0x1b92('0x6b')]=JSON[_0x1b92('0x6c')](_0x2624ef[_0x1b92('0x35')][_0x1b92('0x6a')]);}return db[_0x1b92('0x5e')][_0x1b92('0x45')](_0x186d97)['then'](handleEntityNotFound(_0x5befe5,null))[_0x1b92('0x28')](function(_0x3ab527){if(_0x3ab527){_0xf2629a=_0x3ab527;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_['map'](_0xf2629a,'id')},'ProjectId':_0x2624ef[_0x1b92('0x56')]['id']},'order':_0x1b92('0x6d')});}})['then'](handleEntityNotFound(_0x5befe5,null))[_0x1b92('0x28')](function(_0x37c820){if(_0x37c820){_0x40b0a3=_0x37c820;var _0x319aca={};for(var _0x51133b=0x0,_0xdfaaff=_0x40b0a3[_0x1b92('0x39')];_0x51133b<_0xdfaaff;_0x51133b++){if(!_0x319aca[_0x1b92('0x3a')](_0x40b0a3[_0x51133b][_0x1b92('0x6e')])){_0x319aca[_0x40b0a3[_0x51133b][_0x1b92('0x6e')]]=needsEncapsulation(_0x40b0a3[_0x51133b][_0x1b92('0x6f')])?encapsulate(_0x40b0a3[_0x51133b]['question']):_0x40b0a3[_0x51133b][_0x1b92('0x6f')];}}var _0x172083=[],_0x1d7232={};for(var _0x51cd82=0x0,_0x418a0c=_0xf2629a[_0x1b92('0x39')];_0x51cd82<_0x418a0c;_0x51cd82++){_0x1d7232={'ProjectId':_0x2624ef['params']['id'],'SessionId':_0xf2629a[_0x51cd82]['id'],'StartTime':moment(_0xf2629a[_0x51cd82][_0x1b92('0x6b')])[_0x1b92('0x70')](_0x1b92('0x71'))};for(var _0x2b3fa0=0x0,_0x7e13b0=_0x40b0a3[_0x1b92('0x39')];_0x2b3fa0<_0x7e13b0;_0x2b3fa0++){if(_0x40b0a3[_0x2b3fa0][_0x1b92('0x72')]==_0xf2629a[_0x51cd82]['id']&&_0x319aca[_0x1b92('0x3a')](_0x40b0a3[_0x2b3fa0]['questionId'])){_0x1d7232[_0x319aca[_0x40b0a3[_0x2b3fa0][_0x1b92('0x6e')]]]=_0x40b0a3[_0x2b3fa0]['answer'];}}for(var _0x34ad43 in _0x319aca){if(!_0x1d7232['hasOwnProperty'](_0x319aca[_0x34ad43])){_0x1d7232[_0x319aca[_0x34ad43]]=null;}}_0x172083[_0x1b92('0x73')](_0x1d7232);}return _0x172083;}})[_0x1b92('0x28')](function(_0x1bbdb1){if(!_[_0x1b92('0x74')](_0x1bbdb1)){var _0x1b4733=toCsv(_0x1bbdb1);var _0x3573fb=Date['now']();fs[_0x1b92('0x75')](util[_0x1b92('0x70')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2624ef[_0x1b92('0x56')]['id'],_0x3573fb),_0x1b4733);_0x5befe5[_0x1b92('0x76')](_0x1b92('0x77'),_0x1b92('0x78')+util['format'](_0x1b92('0x79'),_0x2624ef[_0x1b92('0x56')]['id'],_0x3573fb));_0x5befe5[_0x1b92('0x76')](_0x1b92('0x7a'),_0x1b92('0x7b'));return _0x5befe5['download'](util[_0x1b92('0x70')](_0x1b92('0x7c'),_0x2624ef['params']['id'],_0x3573fb));}else{return _0x5befe5[_0x1b92('0x1c')](0xcc);}})['catch'](handleError(_0x5befe5,null));}; \ No newline at end of file +var _0x2e1d=['get','Projects','UserProfileResource','status','error','name','send','map','JscriptyProject','rawAttributes','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','findAll','rows','catch','show','params','intersection','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','update','getSessions','findOne','JscriptySessionReport','order','getAnswers','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','Content-Range','apply','save','then','destroy'];(function(_0x2438b0,_0x5411b5){var _0x152bd5=function(_0x500bdd){while(--_0x500bdd){_0x2438b0['push'](_0x2438b0['shift']());}};_0x152bd5(++_0x5411b5);}(_0x2e1d,0xc8));var _0xd2e1=function(_0x5beda8,_0x1e8554){_0x5beda8=_0x5beda8-0x0;var _0x2aa042=_0x2e1d[_0x5beda8];return _0x2aa042;};'use strict';var emlformat=require(_0xd2e1('0x0'));var rimraf=require(_0xd2e1('0x1'));var zipdir=require(_0xd2e1('0x2'));var jsonpatch=require(_0xd2e1('0x3'));var rp=require(_0xd2e1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd2e1('0x5'));var util=require(_0xd2e1('0x6'));var path=require('path');var sox=require(_0xd2e1('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd2e1('0x8'));var _=require(_0xd2e1('0x9'));var squel=require('squel');var crypto=require(_0xd2e1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd2e1('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd2e1('0xc'));var Papa=require(_0xd2e1('0xd'));var Redis=require(_0xd2e1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd2e1('0xf'));var as=require(_0xd2e1('0x10'));var hardwareService=require(_0xd2e1('0x11'));var logger=require(_0xd2e1('0x12'))('api');var utils=require(_0xd2e1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd2e1('0x14'));var db=require(_0xd2e1('0x15'))['db'];function respondWithStatusCode(_0x2b84ba,_0x10cf73){_0x10cf73=_0x10cf73||0xcc;return function(_0x504a0a){if(_0x504a0a){return _0x2b84ba[_0xd2e1('0x16')](_0x10cf73);}return _0x2b84ba['status'](_0x10cf73)[_0xd2e1('0x17')]();};}function respondWithResult(_0x3ffe4d,_0x46726d){_0x46726d=_0x46726d||0xc8;return function(_0x13b58b){if(_0x13b58b){return _0x3ffe4d['status'](_0x46726d)[_0xd2e1('0x18')](_0x13b58b);}};}function respondWithFilteredResult(_0x3b8cd3,_0x25ae9e){return function(_0x18785f){if(_0x18785f){var _0xe2a98e=typeof _0x25ae9e['offset']===_0xd2e1('0x19')&&typeof _0x25ae9e[_0xd2e1('0x1a')]===_0xd2e1('0x19');var _0x51c19e=_0x18785f[_0xd2e1('0x1b')];var _0x261d61=_0xe2a98e?0x0:_0x25ae9e[_0xd2e1('0x1c')];var _0x2a226e=_0xe2a98e?_0x18785f[_0xd2e1('0x1b')]:_0x25ae9e[_0xd2e1('0x1c')]+_0x25ae9e['limit'];var _0x1be561;if(_0x2a226e>=_0x51c19e){_0x2a226e=_0x51c19e;_0x1be561=0xc8;}else{_0x1be561=0xce;}_0x3b8cd3['status'](_0x1be561);return _0x3b8cd3['set'](_0xd2e1('0x1d'),_0x261d61+'-'+_0x2a226e+'/'+_0x51c19e)[_0xd2e1('0x18')](_0x18785f);}return null;};}function patchUpdates(_0x10da88){return function(_0x2e620f){try{jsonpatch[_0xd2e1('0x1e')](_0x2e620f,_0x10da88,!![]);}catch(_0x1ae099){return BPromise['reject'](_0x1ae099);}return _0x2e620f[_0xd2e1('0x1f')]();};}function saveUpdates(_0xad969e,_0xb350c6){return function(_0x43ea9b){if(_0x43ea9b){return _0x43ea9b['update'](_0xad969e)[_0xd2e1('0x20')](function(_0x30d004){return _0x30d004;});}return null;};}function removeEntity(_0x30f5d3,_0x233d16){return function(_0x42723b){if(_0x42723b){return _0x42723b[_0xd2e1('0x21')]()[_0xd2e1('0x20')](function(){var _0x1b365e=_0x42723b[_0xd2e1('0x22')]({'plain':!![]});var _0x2018ee=_0xd2e1('0x23');return db[_0xd2e1('0x24')][_0xd2e1('0x21')]({'where':{'type':_0x2018ee,'resourceId':_0x1b365e['id']}})[_0xd2e1('0x20')](function(){return _0x42723b;});})[_0xd2e1('0x20')](function(){_0x30f5d3[_0xd2e1('0x25')](0xcc)[_0xd2e1('0x17')]();});}};}function handleEntityNotFound(_0x58b227,_0x20560f){return function(_0xfd1226){if(!_0xfd1226){_0x58b227['sendStatus'](0x194);}return _0xfd1226;};}function handleError(_0x124976,_0x297cf3){_0x297cf3=_0x297cf3||0x1f4;return function(_0x81ad18){logger[_0xd2e1('0x26')](_0x81ad18['stack']);if(_0x81ad18[_0xd2e1('0x27')]){delete _0x81ad18['name'];}_0x124976[_0xd2e1('0x25')](_0x297cf3)[_0xd2e1('0x28')](_0x81ad18);};}exports['index']=function(_0x2259fc,_0x1f8331){var _0x3f2f8e={},_0xeab12a={},_0x10dadd={'count':0x0,'rows':[]};var _0x5d6f99=_[_0xd2e1('0x29')](db[_0xd2e1('0x2a')][_0xd2e1('0x2b')],function(_0x51ba14){return{'name':_0x51ba14['fieldName'],'type':_0x51ba14[_0xd2e1('0x2c')][_0xd2e1('0x2d')]};});_0xeab12a['model']=_['map'](_0x5d6f99,'name');_0xeab12a[_0xd2e1('0x2e')]=_[_0xd2e1('0x2f')](_0x2259fc['query']);_0xeab12a[_0xd2e1('0x30')]=_['intersection'](_0xeab12a[_0xd2e1('0x31')],_0xeab12a['query']);_0x3f2f8e[_0xd2e1('0x32')]=_['intersection'](_0xeab12a[_0xd2e1('0x31')],qs[_0xd2e1('0x33')](_0x2259fc[_0xd2e1('0x2e')][_0xd2e1('0x33')]));_0x3f2f8e[_0xd2e1('0x32')]=_0x3f2f8e['attributes'][_0xd2e1('0x34')]?_0x3f2f8e[_0xd2e1('0x32')]:_0xeab12a[_0xd2e1('0x31')];if(!_0x2259fc[_0xd2e1('0x2e')][_0xd2e1('0x35')](_0xd2e1('0x36'))){_0x3f2f8e['limit']=qs['limit'](_0x2259fc[_0xd2e1('0x2e')][_0xd2e1('0x1a')]);_0x3f2f8e[_0xd2e1('0x1c')]=qs[_0xd2e1('0x1c')](_0x2259fc[_0xd2e1('0x2e')]['offset']);}_0x3f2f8e['order']=qs[_0xd2e1('0x37')](_0x2259fc[_0xd2e1('0x2e')][_0xd2e1('0x37')]);_0x3f2f8e[_0xd2e1('0x38')]=qs['filters'](_[_0xd2e1('0x39')](_0x2259fc['query'],_0xeab12a[_0xd2e1('0x30')]),_0x5d6f99);if(_0x2259fc[_0xd2e1('0x2e')][_0xd2e1('0x3a')]){_0x3f2f8e[_0xd2e1('0x38')]=_['merge'](_0x3f2f8e['where'],{'$or':_[_0xd2e1('0x29')](_0x5d6f99,function(_0x17d469){if(_0x17d469['type']!==_0xd2e1('0x3b')){var _0x39c84b={};_0x39c84b[_0x17d469['name']]={'$like':'%'+_0x2259fc[_0xd2e1('0x2e')]['filter']+'%'};return _0x39c84b;}})});}_0x3f2f8e=_[_0xd2e1('0x3c')]({},_0x3f2f8e,_0x2259fc['options']);var _0x326145={'where':_0x3f2f8e[_0xd2e1('0x38')]};return db[_0xd2e1('0x2a')][_0xd2e1('0x1b')](_0x326145)[_0xd2e1('0x20')](function(_0x21a54b){_0x10dadd['count']=_0x21a54b;if(_0x2259fc[_0xd2e1('0x2e')]['includeAll']){_0x3f2f8e['include']=[{'all':!![]}];}return db[_0xd2e1('0x2a')][_0xd2e1('0x3d')](_0x3f2f8e);})[_0xd2e1('0x20')](function(_0x9b2349){_0x10dadd[_0xd2e1('0x3e')]=_0x9b2349;return _0x10dadd;})['then'](respondWithFilteredResult(_0x1f8331,_0x3f2f8e))[_0xd2e1('0x3f')](handleError(_0x1f8331,null));};exports[_0xd2e1('0x40')]=function(_0x122721,_0x9e3c08){var _0x8386d8={'raw':![],'where':{'id':_0x122721[_0xd2e1('0x41')]['id']}},_0x413a9a={};_0x413a9a[_0xd2e1('0x31')]=_[_0xd2e1('0x2f')](db[_0xd2e1('0x2a')][_0xd2e1('0x2b')]);_0x413a9a[_0xd2e1('0x2e')]=_[_0xd2e1('0x2f')](_0x122721[_0xd2e1('0x2e')]);_0x413a9a[_0xd2e1('0x30')]=_[_0xd2e1('0x42')](_0x413a9a[_0xd2e1('0x31')],_0x413a9a[_0xd2e1('0x2e')]);_0x8386d8[_0xd2e1('0x32')]=_['intersection'](_0x413a9a[_0xd2e1('0x31')],qs[_0xd2e1('0x33')](_0x122721[_0xd2e1('0x2e')][_0xd2e1('0x33')]));_0x8386d8[_0xd2e1('0x32')]=_0x8386d8[_0xd2e1('0x32')]['length']?_0x8386d8['attributes']:_0x413a9a[_0xd2e1('0x31')];if(_0x122721[_0xd2e1('0x2e')][_0xd2e1('0x43')]){_0x8386d8[_0xd2e1('0x44')]=[{'all':!![]}];}_0x8386d8=_[_0xd2e1('0x3c')]({},_0x8386d8,_0x122721[_0xd2e1('0x45')]);return db[_0xd2e1('0x2a')][_0xd2e1('0x46')](_0x8386d8)[_0xd2e1('0x20')](handleEntityNotFound(_0x9e3c08,null))[_0xd2e1('0x20')](respondWithResult(_0x9e3c08,null))[_0xd2e1('0x3f')](handleError(_0x9e3c08,null));};exports[_0xd2e1('0x47')]=function(_0x1176ea,_0x3f9e53){return db['JscriptyProject']['create'](_0x1176ea[_0xd2e1('0x48')],{})['then'](function(_0x489dd1){var _0x798e81=_0x1176ea[_0xd2e1('0x49')]['get']({'plain':!![]});if(!_0x798e81)throw new Error(_0xd2e1('0x4a'));if(_0x798e81[_0xd2e1('0x4b')]==='user'){var _0x10fa1e=_0x489dd1[_0xd2e1('0x22')]({'plain':!![]});var _0x4a5aa7=_0xd2e1('0x23');return db[_0xd2e1('0x4c')][_0xd2e1('0x46')]({'where':{'name':_0x4a5aa7,'userProfileId':_0x798e81[_0xd2e1('0x4d')]},'raw':!![]})[_0xd2e1('0x20')](function(_0x57c20a){if(_0x57c20a&&_0x57c20a[_0xd2e1('0x4e')]===0x0){return db['UserProfileResource'][_0xd2e1('0x47')]({'name':_0x10fa1e[_0xd2e1('0x27')],'resourceId':_0x10fa1e['id'],'type':_0x57c20a[_0xd2e1('0x27')],'sectionId':_0x57c20a['id']},{})[_0xd2e1('0x20')](function(){return _0x489dd1;});}else{return _0x489dd1;}})['catch'](function(_0x4c1cf8){logger[_0xd2e1('0x26')](_0xd2e1('0x4f'),_0x4c1cf8);throw _0x4c1cf8;});}return _0x489dd1;})[_0xd2e1('0x20')](respondWithResult(_0x3f9e53,0xc9))[_0xd2e1('0x3f')](handleError(_0x3f9e53,null));};exports[_0xd2e1('0x50')]=function(_0x2b9fe0,_0x5aac94){var _0x17b76e={'where':{'id':_0x2b9fe0['params']['id']}},_0x50b381={};_0x50b381['model']=_[_0xd2e1('0x2f')](db[_0xd2e1('0x2a')][_0xd2e1('0x2b')]);_0x17b76e[_0xd2e1('0x32')]=_[_0xd2e1('0x42')](_0x50b381[_0xd2e1('0x31')],qs[_0xd2e1('0x33')](_0x2b9fe0[_0xd2e1('0x2e')][_0xd2e1('0x33')]));_0x17b76e[_0xd2e1('0x32')]=_0x17b76e['attributes']['length']?_0x17b76e['attributes']:_0x50b381['model'];if(_0x2b9fe0[_0xd2e1('0x2e')][_0xd2e1('0x43')]){_0x17b76e[_0xd2e1('0x44')]=[{'all':!![]}];}_0x17b76e=_[_0xd2e1('0x3c')]({},_0x17b76e,_0x2b9fe0['options']);return db[_0xd2e1('0x2a')][_0xd2e1('0x46')](_0x17b76e)[_0xd2e1('0x20')](handleEntityNotFound(_0x5aac94,null))[_0xd2e1('0x20')](function(_0x4b8321){if(_0x4b8321){var _0x310ce7=_0x4b8321[_0xd2e1('0x22')]({'plain':!![]});_0x310ce7=qs[_0xd2e1('0x51')](_0x310ce7,['id',_0xd2e1('0x52'),_0xd2e1('0x53')]);_0x2b9fe0[_0xd2e1('0x48')]=_['omit'](_0x2b9fe0['body'],['id',_0xd2e1('0x52'),_0xd2e1('0x53')]);return db[_0xd2e1('0x2a')]['create'](_['merge'](_0x310ce7,_0x2b9fe0[_0xd2e1('0x48')]),{'include':_0x2b9fe0[_0xd2e1('0x2e')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x380cb0){var _0x49a746=_0x2b9fe0['user'][_0xd2e1('0x22')]({'plain':!![]});if(!_0x49a746)throw new Error(_0xd2e1('0x4a'));if(_0x49a746[_0xd2e1('0x4b')]==='user'){var _0x20100e=_0x380cb0[_0xd2e1('0x22')]({'plain':!![]});var _0x17cc03=_0xd2e1('0x23');return db[_0xd2e1('0x4c')][_0xd2e1('0x46')]({'where':{'name':_0x17cc03,'userProfileId':_0x49a746[_0xd2e1('0x4d')]},'raw':!![]})[_0xd2e1('0x20')](function(_0x54cffc){if(_0x54cffc&&_0x54cffc[_0xd2e1('0x4e')]===0x0){return db[_0xd2e1('0x24')]['create']({'name':_0x20100e[_0xd2e1('0x27')],'resourceId':_0x20100e['id'],'type':_0x54cffc[_0xd2e1('0x27')],'sectionId':_0x54cffc['id']},{})[_0xd2e1('0x20')](function(){return _0x380cb0;});}else{return _0x380cb0;}})['catch'](function(_0x2ed90e){logger['error'](_0xd2e1('0x4f'),_0x2ed90e);throw _0x2ed90e;});}return _0x380cb0;});}})[_0xd2e1('0x20')](respondWithResult(_0x5aac94,0xc9))[_0xd2e1('0x3f')](handleError(_0x5aac94,null));};exports[_0xd2e1('0x54')]=function(_0x574066,_0x1926b9){if(_0x574066['body']['id']){delete _0x574066[_0xd2e1('0x48')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x574066[_0xd2e1('0x41')]['id']}})['then'](handleEntityNotFound(_0x1926b9,null))[_0xd2e1('0x20')](saveUpdates(_0x574066[_0xd2e1('0x48')],null))['then'](respondWithResult(_0x1926b9,null))[_0xd2e1('0x3f')](handleError(_0x1926b9,null));};exports['destroy']=function(_0x14f555,_0x321956){return db['JscriptyProject']['find']({'where':{'id':_0x14f555[_0xd2e1('0x41')]['id']}})[_0xd2e1('0x20')](handleEntityNotFound(_0x321956,null))[_0xd2e1('0x20')](removeEntity(_0x321956,null))[_0xd2e1('0x3f')](handleError(_0x321956,null));};exports[_0xd2e1('0x55')]=function(_0x3e63dc,_0x222226,_0x1013e7){var _0x1db089={'raw':!![],'where':{}};var _0x348a10={};var _0xc0db64={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xd2e1('0x56')]({'where':{'id':_0x3e63dc['params']['id']}})[_0xd2e1('0x20')](handleEntityNotFound(_0x222226,null))[_0xd2e1('0x20')](function(_0x2a9372){if(_0x2a9372){_0x348a10[_0xd2e1('0x31')]=_[_0xd2e1('0x2f')](db[_0xd2e1('0x57')][_0xd2e1('0x2b')]);_0x348a10['query']=_[_0xd2e1('0x2f')](_0x3e63dc[_0xd2e1('0x2e')]);_0x348a10['filters']=_[_0xd2e1('0x42')](_0x348a10[_0xd2e1('0x31')],_0x348a10[_0xd2e1('0x2e')]);_0x1db089['attributes']=_[_0xd2e1('0x42')](_0x348a10[_0xd2e1('0x31')],qs[_0xd2e1('0x33')](_0x3e63dc[_0xd2e1('0x2e')]['fields']));_0x1db089[_0xd2e1('0x32')]=_0x1db089[_0xd2e1('0x32')][_0xd2e1('0x34')]?_0x1db089['attributes']:_0x348a10[_0xd2e1('0x31')];if(!_0x3e63dc[_0xd2e1('0x2e')][_0xd2e1('0x35')](_0xd2e1('0x36'))){_0x1db089[_0xd2e1('0x1a')]=qs[_0xd2e1('0x1a')](_0x3e63dc['query'][_0xd2e1('0x1a')]);_0x1db089[_0xd2e1('0x1c')]=qs[_0xd2e1('0x1c')](_0x3e63dc['query'][_0xd2e1('0x1c')]);}_0x1db089[_0xd2e1('0x58')]=qs['sort'](_0x3e63dc[_0xd2e1('0x2e')][_0xd2e1('0x37')]);_0x1db089[_0xd2e1('0x38')]=qs['filters'](_[_0xd2e1('0x39')](_0x3e63dc[_0xd2e1('0x2e')],_0x348a10['filters']));_0x1db089['where']['ProjectId']=_0x2a9372['id'];if(_0x3e63dc[_0xd2e1('0x2e')][_0xd2e1('0x3a')]){_0x1db089['where']=_[_0xd2e1('0x3c')](_0x1db089['where'],{'$or':_[_0xd2e1('0x29')](_0x1db089[_0xd2e1('0x32')],function(_0x106872){var _0x5b2340={};_0x5b2340[_0x106872]={'$like':'%'+_0x3e63dc[_0xd2e1('0x2e')][_0xd2e1('0x3a')]+'%'};return _0x5b2340;})});}_0x1db089=_[_0xd2e1('0x3c')]({},_0x1db089,_0x3e63dc['options']);return db[_0xd2e1('0x57')][_0xd2e1('0x1b')]({'where':_0x1db089[_0xd2e1('0x38')]})['then'](function(_0x3e6a7c){_0xc0db64['count']=_0x3e6a7c;if(_0x3e63dc[_0xd2e1('0x2e')][_0xd2e1('0x43')]){_0x1db089[_0xd2e1('0x44')]=[{'all':!![]}];}return db[_0xd2e1('0x57')][_0xd2e1('0x3d')](_0x1db089);})[_0xd2e1('0x20')](function(_0x741e70){_0xc0db64['rows']=_0x741e70;return _0xc0db64;});}})['then'](respondWithFilteredResult(_0x222226,_0x1db089))[_0xd2e1('0x3f')](handleError(_0x222226,null));};exports[_0xd2e1('0x59')]=function(_0x4db82d,_0xf25213,_0x52d05e){var _0x594a03={'raw':!![],'where':{}};var _0x1ee647={};var _0x2cf1c8={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xd2e1('0x56')]({'where':{'id':_0x4db82d['params']['id']}})[_0xd2e1('0x20')](handleEntityNotFound(_0xf25213,null))[_0xd2e1('0x20')](function(_0x20d078){if(_0x20d078){_0x1ee647[_0xd2e1('0x31')]=_[_0xd2e1('0x2f')](db['JscriptyAnswerReport'][_0xd2e1('0x2b')]);_0x1ee647[_0xd2e1('0x2e')]=_[_0xd2e1('0x2f')](_0x4db82d[_0xd2e1('0x2e')]);_0x1ee647[_0xd2e1('0x30')]=_[_0xd2e1('0x42')](_0x1ee647[_0xd2e1('0x31')],_0x1ee647[_0xd2e1('0x2e')]);_0x594a03[_0xd2e1('0x32')]=_[_0xd2e1('0x42')](_0x1ee647[_0xd2e1('0x31')],qs[_0xd2e1('0x33')](_0x4db82d['query'][_0xd2e1('0x33')]));_0x594a03[_0xd2e1('0x32')]=_0x594a03[_0xd2e1('0x32')]['length']?_0x594a03[_0xd2e1('0x32')]:_0x1ee647['model'];if(!_0x4db82d['query'][_0xd2e1('0x35')]('nolimit')){_0x594a03[_0xd2e1('0x1a')]=qs[_0xd2e1('0x1a')](_0x4db82d['query'][_0xd2e1('0x1a')]);_0x594a03['offset']=qs['offset'](_0x4db82d['query']['offset']);}_0x594a03[_0xd2e1('0x58')]=qs['sort'](_0x4db82d[_0xd2e1('0x2e')][_0xd2e1('0x37')]);_0x594a03['where']=qs['filters'](_[_0xd2e1('0x39')](_0x4db82d[_0xd2e1('0x2e')],_0x1ee647[_0xd2e1('0x30')]));_0x594a03[_0xd2e1('0x38')][_0xd2e1('0x5a')]=_0x20d078['id'];if(_0x4db82d[_0xd2e1('0x2e')][_0xd2e1('0x3a')]){_0x594a03[_0xd2e1('0x38')]=_[_0xd2e1('0x3c')](_0x594a03['where'],{'$or':_[_0xd2e1('0x29')](_0x594a03[_0xd2e1('0x32')],function(_0x4b7d11){var _0x4e017a={};_0x4e017a[_0x4b7d11]={'$like':'%'+_0x4db82d[_0xd2e1('0x2e')][_0xd2e1('0x3a')]+'%'};return _0x4e017a;})});}_0x594a03=_[_0xd2e1('0x3c')]({},_0x594a03,_0x4db82d[_0xd2e1('0x45')]);return db[_0xd2e1('0x5b')][_0xd2e1('0x1b')]({'where':_0x594a03[_0xd2e1('0x38')]})[_0xd2e1('0x20')](function(_0x4da6ba){_0x2cf1c8[_0xd2e1('0x1b')]=_0x4da6ba;if(_0x4db82d['query'][_0xd2e1('0x43')]){_0x594a03['include']=[{'all':!![]}];}return db[_0xd2e1('0x5b')]['findAll'](_0x594a03);})['then'](function(_0x58a8b9){_0x2cf1c8['rows']=_0x58a8b9;return _0x2cf1c8;});}})['then'](respondWithFilteredResult(_0xf25213,_0x594a03))[_0xd2e1('0x3f')](handleError(_0xf25213,null));};function char(_0x583bf1){return _0xd2e1('0x5c')===typeof _0x583bf1?String[_0xd2e1('0x5d')][_0xd2e1('0x1e')](null,arguments):_0x583bf1;}function needsEncapsulation(_0x7aadb1){return!!_0x7aadb1&&(_0x7aadb1[_0xd2e1('0x5e')]()[_0xd2e1('0x5f')](char(0xd))>=0x0||_0x7aadb1[_0xd2e1('0x5e')]()[_0xd2e1('0x5f')](char(0xa))>=0x0||_0x7aadb1[_0xd2e1('0x5e')]()[_0xd2e1('0x5f')](char(0x2c))>=0x0||_0x7aadb1['toString']()[_0xd2e1('0x5f')](char(0x22))>=0x0);}function encapsulate(_0xd4d0e5){var _0x198271=char(0x22),_0x129688='\x5c'+char(0x22),_0x14f0d0=_0xd4d0e5[_0xd2e1('0x5e')]()[_0xd2e1('0x60')](new RegExp(_0x198271,'g'),_0x129688);return _0x198271+_0x14f0d0+_0x198271;}exports[_0xd2e1('0x61')]=function(_0x1b79d9,_0x495014,_0x39aa6b){var _0x4865e1,_0x2ea8aa;var _0x4ec58f={'where':{'ProjectId':_0x1b79d9['params']['id']}};if(_0x1b79d9[_0xd2e1('0x2e')][_0xd2e1('0x62')]){_0x4ec58f[_0xd2e1('0x38')][_0xd2e1('0x63')]=JSON[_0xd2e1('0x64')](_0x1b79d9[_0xd2e1('0x2e')][_0xd2e1('0x62')]);}return db[_0xd2e1('0x57')][_0xd2e1('0x3d')](_0x4ec58f)['then'](handleEntityNotFound(_0x495014,null))[_0xd2e1('0x20')](function(_0x43d9e1){if(_0x43d9e1){_0x4865e1=_0x43d9e1;return db[_0xd2e1('0x65')][_0xd2e1('0x3d')]({'where':{'SessionId':{'$in':_[_0xd2e1('0x29')](_0x4865e1,'id')},'ProjectId':_0x1b79d9[_0xd2e1('0x41')]['id']},'order':_0xd2e1('0x66')});}})[_0xd2e1('0x20')](handleEntityNotFound(_0x495014,null))['then'](function(_0x56a143){if(_0x56a143){_0x2ea8aa=_0x56a143;var _0x4e9113={};for(var _0x41d043=0x0,_0x8de343=_0x2ea8aa[_0xd2e1('0x34')];_0x41d043<_0x8de343;_0x41d043++){if(!_0x4e9113['hasOwnProperty'](_0x2ea8aa[_0x41d043]['questionId'])){_0x4e9113[_0x2ea8aa[_0x41d043][_0xd2e1('0x67')]]=needsEncapsulation(_0x2ea8aa[_0x41d043][_0xd2e1('0x68')])?encapsulate(_0x2ea8aa[_0x41d043][_0xd2e1('0x68')]):_0x2ea8aa[_0x41d043][_0xd2e1('0x68')];}}var _0x2e2e93=[],_0xb74fb9={};for(var _0x5cd957=0x0,_0x4a514c=_0x4865e1[_0xd2e1('0x34')];_0x5cd957<_0x4a514c;_0x5cd957++){_0xb74fb9={'ProjectId':_0x1b79d9[_0xd2e1('0x41')]['id'],'SessionId':_0x4865e1[_0x5cd957]['id'],'StartTime':moment(_0x4865e1[_0x5cd957][_0xd2e1('0x63')])[_0xd2e1('0x69')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x4e7aa4=0x0,_0x14c893=_0x2ea8aa['length'];_0x4e7aa4<_0x14c893;_0x4e7aa4++){if(_0x2ea8aa[_0x4e7aa4]['SessionId']==_0x4865e1[_0x5cd957]['id']&&_0x4e9113[_0xd2e1('0x35')](_0x2ea8aa[_0x4e7aa4][_0xd2e1('0x67')])){_0xb74fb9[_0x4e9113[_0x2ea8aa[_0x4e7aa4][_0xd2e1('0x67')]]]=_0x2ea8aa[_0x4e7aa4][_0xd2e1('0x6a')];}}for(var _0x49f6ad in _0x4e9113){if(!_0xb74fb9[_0xd2e1('0x35')](_0x4e9113[_0x49f6ad])){_0xb74fb9[_0x4e9113[_0x49f6ad]]=null;}}_0x2e2e93[_0xd2e1('0x6b')](_0xb74fb9);}return _0x2e2e93;}})['then'](function(_0x3cd1e4){if(!_[_0xd2e1('0x6c')](_0x3cd1e4)){var _0x568a27=toCsv(_0x3cd1e4);var _0xa69dde=Date[_0xd2e1('0x6d')]();fs[_0xd2e1('0x6e')](util[_0xd2e1('0x69')](_0xd2e1('0x6f'),_0x1b79d9[_0xd2e1('0x41')]['id'],_0xa69dde),_0x568a27);_0x495014[_0xd2e1('0x70')]('Content-disposition',_0xd2e1('0x71')+util[_0xd2e1('0x69')](_0xd2e1('0x72'),_0x1b79d9[_0xd2e1('0x41')]['id'],_0xa69dde));_0x495014[_0xd2e1('0x70')](_0xd2e1('0x73'),_0xd2e1('0x74'));return _0x495014['download'](util[_0xd2e1('0x69')](_0xd2e1('0x6f'),_0x1b79d9[_0xd2e1('0x41')]['id'],_0xa69dde));}else{return _0x495014[_0xd2e1('0x16')](0xcc);}})[_0xd2e1('0x3f')](handleError(_0x495014,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 8dca35d..859a832 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 _0x8403=['rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x8403,0x1a5));var _0x3840=function(_0x181f26,_0x2aab0e){_0x181f26=_0x181f26-0x0;var _0x9e938=_0x8403[_0x181f26];return _0x9e938;};'use strict';var _=require(_0x3840('0x0'));var util=require(_0x3840('0x1'));var logger=require(_0x3840('0x2'))(_0x3840('0x3'));var moment=require(_0x3840('0x4'));var BPromise=require(_0x3840('0x5'));var rp=require(_0x3840('0x6'));var fs=require('fs');var path=require(_0x3840('0x7'));var rimraf=require(_0x3840('0x8'));var config=require('../../config/environment');var attributes=require(_0x3840('0x9'));module[_0x3840('0xa')]=function(_0x1cd658,_0x233be3){return _0x1cd658[_0x3840('0xb')](_0x3840('0xc'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x873a=['lodash','util','../../config/logger','moment','path','rimraf','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects'];(function(_0x565438,_0x52f592){var _0x2f3809=function(_0x59404a){while(--_0x59404a){_0x565438['push'](_0x565438['shift']());}};_0x2f3809(++_0x52f592);}(_0x873a,0x1c2));var _0xa873=function(_0x1f030e,_0x583d6c){_0x1f030e=_0x1f030e-0x0;var _0x2ed9d8=_0x873a[_0x1f030e];return _0x2ed9d8;};'use strict';var _=require(_0xa873('0x0'));var util=require(_0xa873('0x1'));var logger=require(_0xa873('0x2'))('api');var moment=require(_0xa873('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa873('0x4'));var rimraf=require(_0xa873('0x5'));var config=require('../../config/environment');var attributes=require(_0xa873('0x6'));module[_0xa873('0x7')]=function(_0x5c0d74,_0x370b8a){return _0x5c0d74['define'](_0xa873('0x8'),attributes,{'tableName':_0xa873('0x9'),'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 a78c2c8..aaec60b 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 _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x470a27,_0x5d5e32){var _0xfe1ad1=function(_0x455995){while(--_0x455995){_0x470a27['push'](_0x470a27['shift']());}};_0xfe1ad1(++_0x5d5e32);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x44cfc9,_0x37148a){var _0xfbd631=function(_0x5843c0){while(--_0x5843c0){_0x44cfc9['push'](_0x44cfc9['shift']());}};_0xfbd631(++_0x37148a);}(_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')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 55722f8..4d900b8 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 _0x9248=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe','describe','isAuthenticated','put','/:id','update','delete','exports','multer','util','path','express'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9248,0x74));var _0x8924=function(_0x4ab429,_0x3e278d){_0x4ab429=_0x4ab429-0x0;var _0x35b72a=_0x9248[_0x4ab429];return _0x35b72a;};'use strict';var multer=require(_0x8924('0x0'));var util=require(_0x8924('0x1'));var path=require(_0x8924('0x2'));var timeout=require('connect-timeout');var express=require(_0x8924('0x3'));var router=express[_0x8924('0x4')]();var fs_extra=require(_0x8924('0x5'));var auth=require(_0x8924('0x6'));var interaction=require(_0x8924('0x7'));var config=require(_0x8924('0x8'));var controller=require(_0x8924('0x9'));router[_0x8924('0xa')]('/',auth['isAuthenticated'](),controller[_0x8924('0xb')]);router[_0x8924('0xa')](_0x8924('0xc'),auth['isAuthenticated'](),controller[_0x8924('0xd')]);router[_0x8924('0xa')]('/:id',auth[_0x8924('0xe')](),controller['show']);router['post']('/',auth[_0x8924('0xe')](),controller['create']);router[_0x8924('0xf')](_0x8924('0x10'),auth[_0x8924('0xe')](),controller[_0x8924('0x11')]);router[_0x8924('0x12')](_0x8924('0x10'),auth[_0x8924('0xe')](),controller['destroy']);module[_0x8924('0x13')]=router; \ No newline at end of file +var _0x1dcf=['get','/describe','describe','/:id','post','create','put','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index'];(function(_0xd44b9c,_0x3efd97){var _0x3a655e=function(_0xe2d025){while(--_0xe2d025){_0xd44b9c['push'](_0xd44b9c['shift']());}};_0x3a655e(++_0x3efd97);}(_0x1dcf,0x11f));var _0xf1dc=function(_0x6a6e6b,_0x2b90fc){_0x6a6e6b=_0x6a6e6b-0x0;var _0x5156a0=_0x1dcf[_0x6a6e6b];return _0x5156a0;};'use strict';var multer=require(_0xf1dc('0x0'));var util=require(_0xf1dc('0x1'));var path=require(_0xf1dc('0x2'));var timeout=require(_0xf1dc('0x3'));var express=require(_0xf1dc('0x4'));var router=express[_0xf1dc('0x5')]();var fs_extra=require(_0xf1dc('0x6'));var auth=require(_0xf1dc('0x7'));var interaction=require(_0xf1dc('0x8'));var config=require(_0xf1dc('0x9'));var controller=require(_0xf1dc('0xa'));router['get']('/',auth[_0xf1dc('0xb')](),controller[_0xf1dc('0xc')]);router[_0xf1dc('0xd')](_0xf1dc('0xe'),auth['isAuthenticated'](),controller[_0xf1dc('0xf')]);router[_0xf1dc('0xd')](_0xf1dc('0x10'),auth[_0xf1dc('0xb')](),controller['show']);router[_0xf1dc('0x11')]('/',auth[_0xf1dc('0xb')](),controller[_0xf1dc('0x12')]);router[_0xf1dc('0x13')]('/:id',auth[_0xf1dc('0xb')](),controller['update']);router['delete']('/:id',auth[_0xf1dc('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index ad8232e..3eaa20a 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7a54,0x106));var _0x47a5=function(_0x9aa5b9,_0x1a1700){_0x9aa5b9=_0x9aa5b9-0x0;var _0x49c7ba=_0x7a54[_0x9aa5b9];return _0x49c7ba;};'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(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7a54,0x106));var _0x47a5=function(_0x783e4e,_0x1517d6){_0x783e4e=_0x783e4e-0x0;var _0x2472f3=_0x7a54[_0x783e4e];return _0x2472f3;};'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 ca253dc..6e0508c 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 _0x08d9=['reject','save','update','then','destroy','error','stack','name','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../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(_0x9c6e38,_0x1fc24e){var _0x148e08=function(_0x415b66){while(--_0x415b66){_0x9c6e38['push'](_0x9c6e38['shift']());}};_0x148e08(++_0x1fc24e);}(_0x08d9,0x1a2));var _0x908d=function(_0x2d9699,_0x209ef6){_0x2d9699=_0x2d9699-0x0;var _0x582a26=_0x08d9[_0x2d9699];return _0x582a26;};'use strict';var emlformat=require(_0x908d('0x0'));var rimraf=require(_0x908d('0x1'));var zipdir=require(_0x908d('0x2'));var jsonpatch=require(_0x908d('0x3'));var rp=require('request-promise');var moment=require(_0x908d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x908d('0x5'));var util=require('util');var path=require(_0x908d('0x6'));var sox=require(_0x908d('0x7'));var csv=require(_0x908d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x908d('0x9'));var _=require(_0x908d('0xa'));var squel=require(_0x908d('0xb'));var crypto=require(_0x908d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x908d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x908d('0xe'));var Papa=require(_0x908d('0xf'));var Redis=require('ioredis');var authService=require(_0x908d('0x10'));var qs=require(_0x908d('0x11'));var as=require(_0x908d('0x12'));var hardwareService=require(_0x908d('0x13'));var logger=require(_0x908d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x908d('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1da248,_0x4536c8){_0x4536c8=_0x4536c8||0xcc;return function(_0x24f847){if(_0x24f847){return _0x1da248[_0x908d('0x16')](_0x4536c8);}return _0x1da248[_0x908d('0x17')](_0x4536c8)[_0x908d('0x18')]();};}function respondWithResult(_0x2dbd87,_0x371b9b){_0x371b9b=_0x371b9b||0xc8;return function(_0x22ea46){if(_0x22ea46){return _0x2dbd87['status'](_0x371b9b)[_0x908d('0x19')](_0x22ea46);}};}function respondWithFilteredResult(_0x4bc57e,_0x5f5405){return function(_0x126c70){if(_0x126c70){var _0xcc44ca=typeof _0x5f5405[_0x908d('0x1a')]===_0x908d('0x1b')&&typeof _0x5f5405[_0x908d('0x1c')]===_0x908d('0x1b');var _0xd7a20e=_0x126c70['count'];var _0x2ef8de=_0xcc44ca?0x0:_0x5f5405[_0x908d('0x1a')];var _0x6b145e=_0xcc44ca?_0x126c70[_0x908d('0x1d')]:_0x5f5405[_0x908d('0x1a')]+_0x5f5405['limit'];var _0x31953d;if(_0x6b145e>=_0xd7a20e){_0x6b145e=_0xd7a20e;_0x31953d=0xc8;}else{_0x31953d=0xce;}_0x4bc57e[_0x908d('0x17')](_0x31953d);return _0x4bc57e[_0x908d('0x1e')](_0x908d('0x1f'),_0x2ef8de+'-'+_0x6b145e+'/'+_0xd7a20e)['json'](_0x126c70);}return null;};}function patchUpdates(_0x2aa5fb){return function(_0x233546){try{jsonpatch['apply'](_0x233546,_0x2aa5fb,!![]);}catch(_0x44b85e){return BPromise[_0x908d('0x20')](_0x44b85e);}return _0x233546[_0x908d('0x21')]();};}function saveUpdates(_0x2086b0,_0x231f93){return function(_0x4da94e){if(_0x4da94e){return _0x4da94e[_0x908d('0x22')](_0x2086b0)[_0x908d('0x23')](function(_0x377480){return _0x377480;});}return null;};}function removeEntity(_0xa71508,_0x447600){return function(_0x535855){if(_0x535855){return _0x535855[_0x908d('0x24')]()[_0x908d('0x23')](function(){_0xa71508[_0x908d('0x17')](0xcc)[_0x908d('0x18')]();});}};}function handleEntityNotFound(_0x543ece,_0x1ce027){return function(_0x957401){if(!_0x957401){_0x543ece[_0x908d('0x16')](0x194);}return _0x957401;};}function handleError(_0x3d18dc,_0x48450f){_0x48450f=_0x48450f||0x1f4;return function(_0x10aeb3){logger[_0x908d('0x25')](_0x10aeb3[_0x908d('0x26')]);if(_0x10aeb3['name']){delete _0x10aeb3[_0x908d('0x27')];}_0x3d18dc[_0x908d('0x17')](_0x48450f)['send'](_0x10aeb3);};}exports['index']=function(_0x2b8e3d,_0x24816c){var _0x3ff7de={},_0x247789={},_0x48fd1b={'count':0x0,'rows':[]};var _0x3848e9=_[_0x908d('0x28')](db[_0x908d('0x29')][_0x908d('0x2a')],function(_0x23fc1a){return{'name':_0x23fc1a[_0x908d('0x2b')],'type':_0x23fc1a[_0x908d('0x2c')][_0x908d('0x2d')]};});_0x247789[_0x908d('0x2e')]=_['map'](_0x3848e9,'name');_0x247789[_0x908d('0x2f')]=_[_0x908d('0x30')](_0x2b8e3d[_0x908d('0x2f')]);_0x247789[_0x908d('0x31')]=_['intersection'](_0x247789[_0x908d('0x2e')],_0x247789[_0x908d('0x2f')]);_0x3ff7de['attributes']=_[_0x908d('0x32')](_0x247789[_0x908d('0x2e')],qs['fields'](_0x2b8e3d[_0x908d('0x2f')]['fields']));_0x3ff7de[_0x908d('0x33')]=_0x3ff7de[_0x908d('0x33')][_0x908d('0x34')]?_0x3ff7de['attributes']:_0x247789[_0x908d('0x2e')];if(!_0x2b8e3d[_0x908d('0x2f')][_0x908d('0x35')](_0x908d('0x36'))){_0x3ff7de[_0x908d('0x1c')]=qs[_0x908d('0x1c')](_0x2b8e3d['query']['limit']);_0x3ff7de['offset']=qs['offset'](_0x2b8e3d[_0x908d('0x2f')][_0x908d('0x1a')]);}_0x3ff7de[_0x908d('0x37')]=qs[_0x908d('0x38')](_0x2b8e3d[_0x908d('0x2f')][_0x908d('0x38')]);_0x3ff7de[_0x908d('0x39')]=qs[_0x908d('0x31')](_[_0x908d('0x3a')](_0x2b8e3d[_0x908d('0x2f')],_0x247789['filters']),_0x3848e9);if(_0x2b8e3d['query'][_0x908d('0x3b')]){_0x3ff7de[_0x908d('0x39')]=_[_0x908d('0x3c')](_0x3ff7de[_0x908d('0x39')],{'$or':_[_0x908d('0x28')](_0x3848e9,function(_0x1ec162){if(_0x1ec162['type']!==_0x908d('0x3d')){var _0x37a5b0={};_0x37a5b0[_0x1ec162['name']]={'$like':'%'+_0x2b8e3d['query'][_0x908d('0x3b')]+'%'};return _0x37a5b0;}})});}_0x3ff7de=_[_0x908d('0x3c')]({},_0x3ff7de,_0x2b8e3d[_0x908d('0x3e')]);var _0x124f7e={'where':_0x3ff7de['where']};return db[_0x908d('0x29')][_0x908d('0x1d')](_0x124f7e)[_0x908d('0x23')](function(_0x276e3a){_0x48fd1b[_0x908d('0x1d')]=_0x276e3a;if(_0x2b8e3d[_0x908d('0x2f')][_0x908d('0x3f')]){_0x3ff7de[_0x908d('0x40')]=[{'all':!![]}];}return db[_0x908d('0x29')][_0x908d('0x41')](_0x3ff7de);})[_0x908d('0x23')](function(_0x121a36){_0x48fd1b[_0x908d('0x42')]=_0x121a36;return _0x48fd1b;})[_0x908d('0x23')](respondWithFilteredResult(_0x24816c,_0x3ff7de))[_0x908d('0x43')](handleError(_0x24816c,null));};exports[_0x908d('0x44')]=function(_0x73f16a,_0xd670e4){var _0x290061={'raw':!![],'where':{'id':_0x73f16a[_0x908d('0x45')]['id']}},_0x4ab054={};_0x4ab054[_0x908d('0x2e')]=_['keys'](db['JscriptyQuestionReport'][_0x908d('0x2a')]);_0x4ab054[_0x908d('0x2f')]=_[_0x908d('0x30')](_0x73f16a[_0x908d('0x2f')]);_0x4ab054[_0x908d('0x31')]=_['intersection'](_0x4ab054['model'],_0x4ab054['query']);_0x290061[_0x908d('0x33')]=_[_0x908d('0x32')](_0x4ab054['model'],qs[_0x908d('0x46')](_0x73f16a[_0x908d('0x2f')][_0x908d('0x46')]));_0x290061[_0x908d('0x33')]=_0x290061[_0x908d('0x33')][_0x908d('0x34')]?_0x290061[_0x908d('0x33')]:_0x4ab054[_0x908d('0x2e')];if(_0x73f16a[_0x908d('0x2f')]['includeAll']){_0x290061[_0x908d('0x40')]=[{'all':!![]}];}_0x290061=_['merge']({},_0x290061,_0x73f16a[_0x908d('0x3e')]);return db['JscriptyQuestionReport'][_0x908d('0x47')](_0x290061)[_0x908d('0x23')](handleEntityNotFound(_0xd670e4,null))[_0x908d('0x23')](respondWithResult(_0xd670e4,null))[_0x908d('0x43')](handleError(_0xd670e4,null));};exports['create']=function(_0x4e352f,_0x5adc0c){return db[_0x908d('0x29')][_0x908d('0x48')](_0x4e352f[_0x908d('0x49')],{})[_0x908d('0x23')](respondWithResult(_0x5adc0c,0xc9))[_0x908d('0x43')](handleError(_0x5adc0c,null));};exports['update']=function(_0x17236a,_0x38ddc2){if(_0x17236a[_0x908d('0x49')]['id']){delete _0x17236a[_0x908d('0x49')]['id'];}return db[_0x908d('0x29')]['find']({'where':{'id':_0x17236a['params']['id']}})[_0x908d('0x23')](handleEntityNotFound(_0x38ddc2,null))[_0x908d('0x23')](saveUpdates(_0x17236a[_0x908d('0x49')],null))[_0x908d('0x23')](respondWithResult(_0x38ddc2,null))[_0x908d('0x43')](handleError(_0x38ddc2,null));};exports[_0x908d('0x24')]=function(_0x89e5a8,_0x3adc19){return db[_0x908d('0x29')][_0x908d('0x47')]({'where':{'id':_0x89e5a8[_0x908d('0x45')]['id']}})[_0x908d('0x23')](handleEntityNotFound(_0x3adc19,null))[_0x908d('0x23')](removeEntity(_0x3adc19,null))['catch'](handleError(_0x3adc19,null));};exports[_0x908d('0x4a')]=function(_0x6c45f3,_0x560499){return db[_0x908d('0x29')]['describe']()[_0x908d('0x23')](respondWithResult(_0x560499,null))[_0x908d('0x43')](handleError(_0x560499,null));}; \ No newline at end of file +var _0xad4d=['update','then','destroy','end','sendStatus','error','name','send','map','JscriptyQuestionReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save'];(function(_0x24d279,_0x27556f){var _0x5075be=function(_0x2650bd){while(--_0x2650bd){_0x24d279['push'](_0x24d279['shift']());}};_0x5075be(++_0x27556f);}(_0xad4d,0x194));var _0xdad4=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xad4d[_0x5f309e];return _0x487b5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdad4('0x0'));var zipdir=require(_0xdad4('0x1'));var jsonpatch=require(_0xdad4('0x2'));var rp=require(_0xdad4('0x3'));var moment=require(_0xdad4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdad4('0x5'));var util=require(_0xdad4('0x6'));var path=require(_0xdad4('0x7'));var sox=require(_0xdad4('0x8'));var csv=require(_0xdad4('0x9'));var ejs=require(_0xdad4('0xa'));var fs=require('fs');var fs_extra=require(_0xdad4('0xb'));var _=require(_0xdad4('0xc'));var squel=require('squel');var crypto=require(_0xdad4('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdad4('0x9'));var querystring=require(_0xdad4('0xe'));var Papa=require('papaparse');var Redis=require(_0xdad4('0xf'));var authService=require(_0xdad4('0x10'));var qs=require(_0xdad4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdad4('0x12'));var logger=require(_0xdad4('0x13'))(_0xdad4('0x14'));var utils=require(_0xdad4('0x15'));var config=require(_0xdad4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdad4('0x17'))['db'];function respondWithStatusCode(_0x1c17a5,_0x38ad65){_0x38ad65=_0x38ad65||0xcc;return function(_0x1e88f1){if(_0x1e88f1){return _0x1c17a5['sendStatus'](_0x38ad65);}return _0x1c17a5[_0xdad4('0x18')](_0x38ad65)['end']();};}function respondWithResult(_0x275e4a,_0x2ca2dc){_0x2ca2dc=_0x2ca2dc||0xc8;return function(_0x58a8ce){if(_0x58a8ce){return _0x275e4a[_0xdad4('0x18')](_0x2ca2dc)[_0xdad4('0x19')](_0x58a8ce);}};}function respondWithFilteredResult(_0x4f354a,_0x1e7d4b){return function(_0x36ff1b){if(_0x36ff1b){var _0x28f8df=typeof _0x1e7d4b[_0xdad4('0x1a')]===_0xdad4('0x1b')&&typeof _0x1e7d4b['limit']===_0xdad4('0x1b');var _0xcdc68b=_0x36ff1b[_0xdad4('0x1c')];var _0x2836d7=_0x28f8df?0x0:_0x1e7d4b[_0xdad4('0x1a')];var _0x56b3cf=_0x28f8df?_0x36ff1b['count']:_0x1e7d4b[_0xdad4('0x1a')]+_0x1e7d4b[_0xdad4('0x1d')];var _0x2067ff;if(_0x56b3cf>=_0xcdc68b){_0x56b3cf=_0xcdc68b;_0x2067ff=0xc8;}else{_0x2067ff=0xce;}_0x4f354a[_0xdad4('0x18')](_0x2067ff);return _0x4f354a['set'](_0xdad4('0x1e'),_0x2836d7+'-'+_0x56b3cf+'/'+_0xcdc68b)['json'](_0x36ff1b);}return null;};}function patchUpdates(_0x302445){return function(_0x419ffb){try{jsonpatch[_0xdad4('0x1f')](_0x419ffb,_0x302445,!![]);}catch(_0x90710c){return BPromise[_0xdad4('0x20')](_0x90710c);}return _0x419ffb[_0xdad4('0x21')]();};}function saveUpdates(_0x5b8840,_0x4a0521){return function(_0x2be1bf){if(_0x2be1bf){return _0x2be1bf[_0xdad4('0x22')](_0x5b8840)[_0xdad4('0x23')](function(_0x4ee282){return _0x4ee282;});}return null;};}function removeEntity(_0x59653f,_0x20d02d){return function(_0x4d09ff){if(_0x4d09ff){return _0x4d09ff[_0xdad4('0x24')]()[_0xdad4('0x23')](function(){_0x59653f[_0xdad4('0x18')](0xcc)[_0xdad4('0x25')]();});}};}function handleEntityNotFound(_0xb78c25,_0xd239eb){return function(_0x53dff8){if(!_0x53dff8){_0xb78c25[_0xdad4('0x26')](0x194);}return _0x53dff8;};}function handleError(_0x702316,_0x38c85e){_0x38c85e=_0x38c85e||0x1f4;return function(_0x4c892f){logger[_0xdad4('0x27')](_0x4c892f['stack']);if(_0x4c892f[_0xdad4('0x28')]){delete _0x4c892f[_0xdad4('0x28')];}_0x702316[_0xdad4('0x18')](_0x38c85e)[_0xdad4('0x29')](_0x4c892f);};}exports['index']=function(_0x101edb,_0xcb322c){var _0x471b9d={},_0x3efb48={},_0x35a517={'count':0x0,'rows':[]};var _0x3c66fe=_[_0xdad4('0x2a')](db[_0xdad4('0x2b')]['rawAttributes'],function(_0x4f0373){return{'name':_0x4f0373[_0xdad4('0x2c')],'type':_0x4f0373[_0xdad4('0x2d')][_0xdad4('0x2e')]};});_0x3efb48['model']=_['map'](_0x3c66fe,_0xdad4('0x28'));_0x3efb48[_0xdad4('0x2f')]=_[_0xdad4('0x30')](_0x101edb[_0xdad4('0x2f')]);_0x3efb48[_0xdad4('0x31')]=_[_0xdad4('0x32')](_0x3efb48[_0xdad4('0x33')],_0x3efb48[_0xdad4('0x2f')]);_0x471b9d[_0xdad4('0x34')]=_[_0xdad4('0x32')](_0x3efb48['model'],qs[_0xdad4('0x35')](_0x101edb[_0xdad4('0x2f')][_0xdad4('0x35')]));_0x471b9d[_0xdad4('0x34')]=_0x471b9d[_0xdad4('0x34')]['length']?_0x471b9d[_0xdad4('0x34')]:_0x3efb48[_0xdad4('0x33')];if(!_0x101edb[_0xdad4('0x2f')][_0xdad4('0x36')]('nolimit')){_0x471b9d['limit']=qs['limit'](_0x101edb[_0xdad4('0x2f')]['limit']);_0x471b9d[_0xdad4('0x1a')]=qs[_0xdad4('0x1a')](_0x101edb[_0xdad4('0x2f')][_0xdad4('0x1a')]);}_0x471b9d['order']=qs[_0xdad4('0x37')](_0x101edb['query'][_0xdad4('0x37')]);_0x471b9d[_0xdad4('0x38')]=qs[_0xdad4('0x31')](_[_0xdad4('0x39')](_0x101edb[_0xdad4('0x2f')],_0x3efb48[_0xdad4('0x31')]),_0x3c66fe);if(_0x101edb[_0xdad4('0x2f')][_0xdad4('0x3a')]){_0x471b9d[_0xdad4('0x38')]=_['merge'](_0x471b9d['where'],{'$or':_[_0xdad4('0x2a')](_0x3c66fe,function(_0x93d5a6){if(_0x93d5a6[_0xdad4('0x2d')]!==_0xdad4('0x3b')){var _0x1679b9={};_0x1679b9[_0x93d5a6[_0xdad4('0x28')]]={'$like':'%'+_0x101edb['query'][_0xdad4('0x3a')]+'%'};return _0x1679b9;}})});}_0x471b9d=_[_0xdad4('0x3c')]({},_0x471b9d,_0x101edb[_0xdad4('0x3d')]);var _0x242c5c={'where':_0x471b9d[_0xdad4('0x38')]};return db['JscriptyQuestionReport'][_0xdad4('0x1c')](_0x242c5c)[_0xdad4('0x23')](function(_0x3f753e){_0x35a517[_0xdad4('0x1c')]=_0x3f753e;if(_0x101edb[_0xdad4('0x2f')]['includeAll']){_0x471b9d['include']=[{'all':!![]}];}return db[_0xdad4('0x2b')][_0xdad4('0x3e')](_0x471b9d);})[_0xdad4('0x23')](function(_0x58ef07){_0x35a517[_0xdad4('0x3f')]=_0x58ef07;return _0x35a517;})[_0xdad4('0x23')](respondWithFilteredResult(_0xcb322c,_0x471b9d))[_0xdad4('0x40')](handleError(_0xcb322c,null));};exports[_0xdad4('0x41')]=function(_0x5b5e11,_0x4bed39){var _0x114b7f={'raw':!![],'where':{'id':_0x5b5e11[_0xdad4('0x42')]['id']}},_0x3da042={};_0x3da042[_0xdad4('0x33')]=_[_0xdad4('0x30')](db[_0xdad4('0x2b')][_0xdad4('0x43')]);_0x3da042[_0xdad4('0x2f')]=_[_0xdad4('0x30')](_0x5b5e11[_0xdad4('0x2f')]);_0x3da042['filters']=_[_0xdad4('0x32')](_0x3da042[_0xdad4('0x33')],_0x3da042[_0xdad4('0x2f')]);_0x114b7f[_0xdad4('0x34')]=_[_0xdad4('0x32')](_0x3da042['model'],qs[_0xdad4('0x35')](_0x5b5e11[_0xdad4('0x2f')][_0xdad4('0x35')]));_0x114b7f[_0xdad4('0x34')]=_0x114b7f[_0xdad4('0x34')]['length']?_0x114b7f[_0xdad4('0x34')]:_0x3da042[_0xdad4('0x33')];if(_0x5b5e11['query']['includeAll']){_0x114b7f[_0xdad4('0x44')]=[{'all':!![]}];}_0x114b7f=_[_0xdad4('0x3c')]({},_0x114b7f,_0x5b5e11[_0xdad4('0x3d')]);return db[_0xdad4('0x2b')][_0xdad4('0x45')](_0x114b7f)[_0xdad4('0x23')](handleEntityNotFound(_0x4bed39,null))[_0xdad4('0x23')](respondWithResult(_0x4bed39,null))[_0xdad4('0x40')](handleError(_0x4bed39,null));};exports[_0xdad4('0x46')]=function(_0x190446,_0x40d99f){return db[_0xdad4('0x2b')][_0xdad4('0x46')](_0x190446[_0xdad4('0x47')],{})['then'](respondWithResult(_0x40d99f,0xc9))[_0xdad4('0x40')](handleError(_0x40d99f,null));};exports[_0xdad4('0x22')]=function(_0x57ca0f,_0x39c3ff){if(_0x57ca0f[_0xdad4('0x47')]['id']){delete _0x57ca0f[_0xdad4('0x47')]['id'];}return db['JscriptyQuestionReport'][_0xdad4('0x45')]({'where':{'id':_0x57ca0f['params']['id']}})[_0xdad4('0x23')](handleEntityNotFound(_0x39c3ff,null))[_0xdad4('0x23')](saveUpdates(_0x57ca0f['body'],null))['then'](respondWithResult(_0x39c3ff,null))[_0xdad4('0x40')](handleError(_0x39c3ff,null));};exports[_0xdad4('0x24')]=function(_0x50280d,_0x55025c){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x50280d[_0xdad4('0x42')]['id']}})['then'](handleEntityNotFound(_0x55025c,null))[_0xdad4('0x23')](removeEntity(_0x55025c,null))[_0xdad4('0x40')](handleError(_0x55025c,null));};exports[_0xdad4('0x48')]=function(_0x424784,_0x387a61){return db[_0xdad4('0x2b')][_0xdad4('0x48')]()['then'](respondWithResult(_0x387a61,null))[_0xdad4('0x40')](handleError(_0x387a61,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index e3d8da3..0cb8758 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 _0xbeff=['./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','../../config/environment'];(function(_0x359377,_0x1a63ef){var _0x8be18a=function(_0x246390){while(--_0x246390){_0x359377['push'](_0x359377['shift']());}};_0x8be18a(++_0x1a63ef);}(_0xbeff,0x7c));var _0xfbef=function(_0x579b89,_0xa0349d){_0x579b89=_0x579b89-0x0;var _0xd65608=_0xbeff[_0x579b89];return _0xd65608;};'use strict';var _=require(_0xfbef('0x0'));var util=require(_0xfbef('0x1'));var logger=require(_0xfbef('0x2'))(_0xfbef('0x3'));var moment=require(_0xfbef('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfbef('0x5'));var attributes=require(_0xfbef('0x6'));module[_0xfbef('0x7')]=function(_0x265622,_0x44d00c){return _0x265622['define'](_0xfbef('0x8'),attributes,{'tableName':_0xfbef('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd23c=['exports','define','report_jscripty_questions','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x14634f,_0x5ed190){var _0x5021f9=function(_0x1f4a14){while(--_0x1f4a14){_0x14634f['push'](_0x14634f['shift']());}};_0x5021f9(++_0x5ed190);}(_0xd23c,0xff));var _0xcd23=function(_0x4b2f8a,_0x25c50b){_0x4b2f8a=_0x4b2f8a-0x0;var _0x5bc064=_0xd23c[_0x4b2f8a];return _0x5bc064;};'use strict';var _=require(_0xcd23('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcd23('0x1'));var moment=require(_0xcd23('0x2'));var BPromise=require(_0xcd23('0x3'));var rp=require(_0xcd23('0x4'));var fs=require('fs');var path=require(_0xcd23('0x5'));var rimraf=require(_0xcd23('0x6'));var config=require(_0xcd23('0x7'));var attributes=require(_0xcd23('0x8'));module[_0xcd23('0x9')]=function(_0x5cb416,_0x18f406){return _0x5cb416[_0xcd23('0xa')]('JscriptyQuestionReport',attributes,{'tableName':_0xcd23('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 51ab1c7..769db66 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 _0xbf81=['../../config/environment','jayson/promise','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xbf81,0x1ef));var _0x1bf8=function(_0x41642e,_0x97f901){_0x41642e=_0x41642e-0x0;var _0x39ec15=_0xbf81[_0x41642e];return _0x39ec15;};'use strict';var _=require(_0x1bf8('0x0'));var util=require(_0x1bf8('0x1'));var moment=require('moment');var BPromise=require(_0x1bf8('0x2'));var rs=require(_0x1bf8('0x3'));var fs=require('fs');var Redis=require(_0x1bf8('0x4'));var db=require(_0x1bf8('0x5'))['db'];var utils=require(_0x1bf8('0x6'));var logger=require(_0x1bf8('0x7'))(_0x1bf8('0x8'));var config=require(_0x1bf8('0x9'));var jayson=require(_0x1bf8('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38a1ef,_0x326377,_0x1dd508){return new BPromise(function(_0x2d645e,_0x14650e){return client[_0x1bf8('0xb')](_0x38a1ef,_0x1dd508)[_0x1bf8('0xc')](function(_0x25fa63){logger[_0x1bf8('0xd')](_0x1bf8('0xe'),_0x326377,_0x1bf8('0xf'));logger[_0x1bf8('0x10')](_0x1bf8('0x11'),_0x326377,'request\x20sent',JSON[_0x1bf8('0x12')](_0x25fa63));if(_0x25fa63[_0x1bf8('0x13')]){if(_0x25fa63[_0x1bf8('0x13')][_0x1bf8('0x14')]===0x1f4){logger[_0x1bf8('0x13')](_0x1bf8('0xe'),_0x326377,_0x25fa63['error'][_0x1bf8('0x15')]);return _0x14650e(_0x25fa63[_0x1bf8('0x13')][_0x1bf8('0x15')]);}logger[_0x1bf8('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x326377,_0x25fa63[_0x1bf8('0x13')][_0x1bf8('0x15')]);return _0x2d645e(_0x25fa63['error']['message']);}else{logger[_0x1bf8('0xd')](_0x1bf8('0xe'),_0x326377,_0x1bf8('0xf'));_0x2d645e(_0x25fa63[_0x1bf8('0x16')][_0x1bf8('0x15')]);}})[_0x1bf8('0x17')](function(_0x3692e1){logger[_0x1bf8('0x13')](_0x1bf8('0xe'),_0x326377,_0x3692e1);_0x14650e(_0x3692e1);});});} \ No newline at end of file +var _0x75ff=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x75ff,0x15e));var _0xf75f=function(_0x2c3a47,_0x170687){_0x2c3a47=_0x2c3a47-0x0;var _0x1c04de=_0x75ff[_0x2c3a47];return _0x1c04de;};'use strict';var _=require(_0xf75f('0x0'));var util=require(_0xf75f('0x1'));var moment=require('moment');var BPromise=require(_0xf75f('0x2'));var rs=require(_0xf75f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf75f('0x4'))['db'];var utils=require(_0xf75f('0x5'));var logger=require(_0xf75f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf75f('0x7'));var client=jayson['client'][_0xf75f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c535e,_0x1f5948,_0x18b45c){return new BPromise(function(_0x4ac495,_0x1af9b4){return client[_0xf75f('0x9')](_0x1c535e,_0x18b45c)[_0xf75f('0xa')](function(_0x260bf7){logger['info'](_0xf75f('0xb'),_0x1f5948,'request\x20sent');logger[_0xf75f('0xc')](_0xf75f('0xd'),_0x1f5948,'request\x20sent',JSON[_0xf75f('0xe')](_0x260bf7));if(_0x260bf7[_0xf75f('0xf')]){if(_0x260bf7[_0xf75f('0xf')][_0xf75f('0x10')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x1f5948,_0x260bf7['error']['message']);return _0x1af9b4(_0x260bf7[_0xf75f('0xf')][_0xf75f('0x11')]);}logger['error'](_0xf75f('0xb'),_0x1f5948,_0x260bf7[_0xf75f('0xf')][_0xf75f('0x11')]);return _0x4ac495(_0x260bf7[_0xf75f('0xf')][_0xf75f('0x11')]);}else{logger[_0xf75f('0x12')](_0xf75f('0xb'),_0x1f5948,_0xf75f('0x13'));_0x4ac495(_0x260bf7[_0xf75f('0x14')][_0xf75f('0x11')]);}})[_0xf75f('0x15')](function(_0x440696){logger[_0xf75f('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1f5948,_0x440696);_0x1af9b4(_0x440696);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index f8f82c7..2cb2bb3 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 _0xdf66=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','index','/describe','isAuthenticated','describe','get','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xdf66,0xca));var _0x6df6=function(_0x7261e6,_0x3e3bf7){_0x7261e6=_0x7261e6-0x0;var _0x20d5ed=_0xdf66[_0x7261e6];return _0x20d5ed;};'use strict';var multer=require(_0x6df6('0x0'));var util=require(_0x6df6('0x1'));var path=require(_0x6df6('0x2'));var timeout=require(_0x6df6('0x3'));var express=require(_0x6df6('0x4'));var router=express[_0x6df6('0x5')]();var fs_extra=require(_0x6df6('0x6'));var auth=require(_0x6df6('0x7'));var interaction=require(_0x6df6('0x8'));var config=require(_0x6df6('0x9'));var controller=require(_0x6df6('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x6df6('0xb')]);router['get'](_0x6df6('0xc'),auth[_0x6df6('0xd')](),controller[_0x6df6('0xe')]);router[_0x6df6('0xf')](_0x6df6('0x10'),auth[_0x6df6('0xd')](),controller[_0x6df6('0x11')]);router[_0x6df6('0xf')]('/:id/questions',auth[_0x6df6('0xd')](),controller['getQuestions']);router[_0x6df6('0x12')]('/',auth[_0x6df6('0xd')](),controller['create']);router['put']('/:id',auth[_0x6df6('0xd')](),controller[_0x6df6('0x13')]);router[_0x6df6('0x14')](_0x6df6('0x10'),auth['isAuthenticated'](),controller[_0x6df6('0x15')]);module[_0x6df6('0x16')]=router; \ No newline at end of file +var _0x33a8=['exports','express','Router','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','show','/:id/questions','getQuestions','create','put','update','destroy'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x33a8,0x141));var _0x833a=function(_0x73f29c,_0x2455dd){_0x73f29c=_0x73f29c-0x0;var _0x35fd8d=_0x33a8[_0x73f29c];return _0x35fd8d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x833a('0x0'));var router=express[_0x833a('0x1')]();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(_0x833a('0x2'));router[_0x833a('0x3')]('/',auth[_0x833a('0x4')](),controller[_0x833a('0x5')]);router[_0x833a('0x3')]('/describe',auth['isAuthenticated'](),controller[_0x833a('0x6')]);router[_0x833a('0x3')](_0x833a('0x7'),auth[_0x833a('0x4')](),controller[_0x833a('0x8')]);router['get'](_0x833a('0x9'),auth['isAuthenticated'](),controller[_0x833a('0xa')]);router['post']('/',auth[_0x833a('0x4')](),controller[_0x833a('0xb')]);router[_0x833a('0xc')](_0x833a('0x7'),auth[_0x833a('0x4')](),controller[_0x833a('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x833a('0xe')]);module[_0x833a('0xf')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index ef95985..5e2ed99 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 _0x0eee=['DATE','STRING','BOOLEAN','moment','sequelize','exports','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x0eee,0xb3));var _0xe0ee=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0x0eee[_0x2601b4];return _0x3e3661;};'use strict';var moment=require(_0xe0ee('0x0'));var Sequelize=require(_0xe0ee('0x1'));module[_0xe0ee('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x24332b){this[_0xe0ee('0x3')](_0xe0ee('0x4'),_0x24332b);this[_0xe0ee('0x3')](_0xe0ee('0x5'),moment()[_0xe0ee('0x6')](_0xe0ee('0x7')));}},'endtime':{'type':Sequelize[_0xe0ee('0x8')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xe0ee('0x9')]},'queue':{'type':Sequelize[_0xe0ee('0x9')]},'uniqueid':{'type':Sequelize[_0xe0ee('0x9')]},'calleridname':{'type':Sequelize[_0xe0ee('0x9')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xe0ee('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0xb876=['exports','starttime','setDataValue','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING'];(function(_0x212d2f,_0x5a7a54){var _0x3773ca=function(_0x46777d){while(--_0x46777d){_0x212d2f['push'](_0x212d2f['shift']());}};_0x3773ca(++_0x5a7a54);}(_0xb876,0xee));var _0x6b87=function(_0x48f878,_0x383bf7){_0x48f878=_0x48f878-0x0;var _0x167c7f=_0xb876[_0x48f878];return _0x167c7f;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x6b87('0x0')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x15dbe0){this['setDataValue'](_0x6b87('0x1'),_0x15dbe0);this[_0x6b87('0x2')]('endtime',moment()[_0x6b87('0x3')](_0x6b87('0x4')));}},'endtime':{'type':Sequelize[_0x6b87('0x5')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x6b87('0x6')]},'queue':{'type':Sequelize[_0x6b87('0x6')]},'uniqueid':{'type':Sequelize[_0x6b87('0x6')]},'calleridname':{'type':Sequelize[_0x6b87('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index a897d9d..ca341ab 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 _0xf50f=['length','includeAll','find','create','body','update','params','describe','findOne','JscriptyQuestionReport','rawAttributes','pick','SessionId','findAll','eml-format','zip-dir','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','stack','name','send','index','map','JscriptySessionReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','order','sort','where','filter','merge','options','include','rows','catch','show'];(function(_0x19b736,_0xd3fb5){var _0x571df7=function(_0x4ce62c){while(--_0x4ce62c){_0x19b736['push'](_0x19b736['shift']());}};_0x571df7(++_0xd3fb5);}(_0xf50f,0x136));var _0xff50=function(_0x1b0545,_0x4b6371){_0x1b0545=_0x1b0545-0x0;var _0x2f0675=_0xf50f[_0x1b0545];return _0x2f0675;};'use strict';var emlformat=require(_0xff50('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff50('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xff50('0x2'));var Mustache=require(_0xff50('0x3'));var util=require(_0xff50('0x4'));var path=require(_0xff50('0x5'));var sox=require('sox');var csv=require(_0xff50('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff50('0x7'));var squel=require('squel');var crypto=require(_0xff50('0x8'));var jsforce=require(_0xff50('0x9'));var deskjs=require(_0xff50('0xa'));var toCsv=require(_0xff50('0x6'));var querystring=require('querystring');var Papa=require(_0xff50('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xff50('0xc'));var as=require(_0xff50('0xd'));var hardwareService=require(_0xff50('0xe'));var logger=require(_0xff50('0xf'))(_0xff50('0x10'));var utils=require(_0xff50('0x11'));var config=require(_0xff50('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xff50('0x13'))['db'];function respondWithStatusCode(_0x3fcf01,_0x4df81c){_0x4df81c=_0x4df81c||0xcc;return function(_0x46a1d3){if(_0x46a1d3){return _0x3fcf01[_0xff50('0x14')](_0x4df81c);}return _0x3fcf01[_0xff50('0x15')](_0x4df81c)[_0xff50('0x16')]();};}function respondWithResult(_0x33de14,_0x594694){_0x594694=_0x594694||0xc8;return function(_0x1c2d29){if(_0x1c2d29){return _0x33de14[_0xff50('0x15')](_0x594694)[_0xff50('0x17')](_0x1c2d29);}};}function respondWithFilteredResult(_0xd41b51,_0x44ff85){return function(_0x443ce1){if(_0x443ce1){var _0xe226be=typeof _0x44ff85[_0xff50('0x18')]===_0xff50('0x19')&&typeof _0x44ff85['limit']===_0xff50('0x19');var _0x48f8f4=_0x443ce1[_0xff50('0x1a')];var _0x25e7b1=_0xe226be?0x0:_0x44ff85[_0xff50('0x18')];var _0x57bac8=_0xe226be?_0x443ce1['count']:_0x44ff85[_0xff50('0x18')]+_0x44ff85[_0xff50('0x1b')];var _0x59207b;if(_0x57bac8>=_0x48f8f4){_0x57bac8=_0x48f8f4;_0x59207b=0xc8;}else{_0x59207b=0xce;}_0xd41b51[_0xff50('0x15')](_0x59207b);return _0xd41b51[_0xff50('0x1c')]('Content-Range',_0x25e7b1+'-'+_0x57bac8+'/'+_0x48f8f4)[_0xff50('0x17')](_0x443ce1);}return null;};}function patchUpdates(_0x162413){return function(_0x2e5539){try{jsonpatch[_0xff50('0x1d')](_0x2e5539,_0x162413,!![]);}catch(_0x139f37){return BPromise[_0xff50('0x1e')](_0x139f37);}return _0x2e5539[_0xff50('0x1f')]();};}function saveUpdates(_0x37c7a6,_0x33fe6f){return function(_0x2f17cf){if(_0x2f17cf){return _0x2f17cf['update'](_0x37c7a6)[_0xff50('0x20')](function(_0xbe1778){return _0xbe1778;});}return null;};}function removeEntity(_0xc47f3b,_0x99949b){return function(_0xb6b12e){if(_0xb6b12e){return _0xb6b12e[_0xff50('0x21')]()['then'](function(){_0xc47f3b[_0xff50('0x15')](0xcc)[_0xff50('0x16')]();});}};}function handleEntityNotFound(_0x1307aa,_0x427762){return function(_0x120d0b){if(!_0x120d0b){_0x1307aa[_0xff50('0x14')](0x194);}return _0x120d0b;};}function handleError(_0x23a285,_0xec661){_0xec661=_0xec661||0x1f4;return function(_0x2f2cfb){logger['error'](_0x2f2cfb[_0xff50('0x22')]);if(_0x2f2cfb[_0xff50('0x23')]){delete _0x2f2cfb[_0xff50('0x23')];}_0x23a285[_0xff50('0x15')](_0xec661)[_0xff50('0x24')](_0x2f2cfb);};}exports[_0xff50('0x25')]=function(_0x3561c1,_0x3774ff){var _0x29d1cf={},_0x46d3e4={},_0x2feb27={'count':0x0,'rows':[]};var _0x350d79=_[_0xff50('0x26')](db[_0xff50('0x27')]['rawAttributes'],function(_0x30d711){return{'name':_0x30d711[_0xff50('0x28')],'type':_0x30d711[_0xff50('0x29')][_0xff50('0x2a')]};});_0x46d3e4[_0xff50('0x2b')]=_['map'](_0x350d79,_0xff50('0x23'));_0x46d3e4['query']=_[_0xff50('0x2c')](_0x3561c1[_0xff50('0x2d')]);_0x46d3e4[_0xff50('0x2e')]=_[_0xff50('0x2f')](_0x46d3e4[_0xff50('0x2b')],_0x46d3e4[_0xff50('0x2d')]);_0x29d1cf[_0xff50('0x30')]=_[_0xff50('0x2f')](_0x46d3e4[_0xff50('0x2b')],qs[_0xff50('0x31')](_0x3561c1[_0xff50('0x2d')][_0xff50('0x31')]));_0x29d1cf[_0xff50('0x30')]=_0x29d1cf['attributes']['length']?_0x29d1cf[_0xff50('0x30')]:_0x46d3e4['model'];if(!_0x3561c1[_0xff50('0x2d')]['hasOwnProperty']('nolimit')){_0x29d1cf[_0xff50('0x1b')]=qs[_0xff50('0x1b')](_0x3561c1[_0xff50('0x2d')][_0xff50('0x1b')]);_0x29d1cf[_0xff50('0x18')]=qs[_0xff50('0x18')](_0x3561c1['query'][_0xff50('0x18')]);}_0x29d1cf[_0xff50('0x32')]=qs[_0xff50('0x33')](_0x3561c1[_0xff50('0x2d')][_0xff50('0x33')]);_0x29d1cf[_0xff50('0x34')]=qs[_0xff50('0x2e')](_['pick'](_0x3561c1[_0xff50('0x2d')],_0x46d3e4[_0xff50('0x2e')]),_0x350d79);if(_0x3561c1[_0xff50('0x2d')][_0xff50('0x35')]){_0x29d1cf[_0xff50('0x34')]=_[_0xff50('0x36')](_0x29d1cf['where'],{'$or':_[_0xff50('0x26')](_0x350d79,function(_0x3f520c){if(_0x3f520c[_0xff50('0x29')]!=='VIRTUAL'){var _0x3cae51={};_0x3cae51[_0x3f520c[_0xff50('0x23')]]={'$like':'%'+_0x3561c1[_0xff50('0x2d')]['filter']+'%'};return _0x3cae51;}})});}_0x29d1cf=_['merge']({},_0x29d1cf,_0x3561c1[_0xff50('0x37')]);var _0x5d79e3={'where':_0x29d1cf['where']};return db[_0xff50('0x27')][_0xff50('0x1a')](_0x5d79e3)['then'](function(_0x258745){_0x2feb27[_0xff50('0x1a')]=_0x258745;if(_0x3561c1['query']['includeAll']){_0x29d1cf[_0xff50('0x38')]=[{'all':!![]}];}return db[_0xff50('0x27')]['findAll'](_0x29d1cf);})['then'](function(_0x31fd3a){_0x2feb27[_0xff50('0x39')]=_0x31fd3a;return _0x2feb27;})['then'](respondWithFilteredResult(_0x3774ff,_0x29d1cf))[_0xff50('0x3a')](handleError(_0x3774ff,null));};exports[_0xff50('0x3b')]=function(_0x1726d7,_0x5cfa40){var _0x50469f={'raw':!![],'where':{'id':_0x1726d7['params']['id']}},_0x23a3fd={};_0x23a3fd[_0xff50('0x2b')]=_[_0xff50('0x2c')](db[_0xff50('0x27')]['rawAttributes']);_0x23a3fd[_0xff50('0x2d')]=_[_0xff50('0x2c')](_0x1726d7['query']);_0x23a3fd[_0xff50('0x2e')]=_[_0xff50('0x2f')](_0x23a3fd['model'],_0x23a3fd[_0xff50('0x2d')]);_0x50469f['attributes']=_[_0xff50('0x2f')](_0x23a3fd['model'],qs[_0xff50('0x31')](_0x1726d7[_0xff50('0x2d')][_0xff50('0x31')]));_0x50469f['attributes']=_0x50469f[_0xff50('0x30')][_0xff50('0x3c')]?_0x50469f[_0xff50('0x30')]:_0x23a3fd['model'];if(_0x1726d7[_0xff50('0x2d')][_0xff50('0x3d')]){_0x50469f[_0xff50('0x38')]=[{'all':!![]}];}_0x50469f=_[_0xff50('0x36')]({},_0x50469f,_0x1726d7[_0xff50('0x37')]);return db['JscriptySessionReport'][_0xff50('0x3e')](_0x50469f)[_0xff50('0x20')](handleEntityNotFound(_0x5cfa40,null))[_0xff50('0x20')](respondWithResult(_0x5cfa40,null))[_0xff50('0x3a')](handleError(_0x5cfa40,null));};exports['create']=function(_0x303cbb,_0xcd2cdc){return db[_0xff50('0x27')][_0xff50('0x3f')](_0x303cbb[_0xff50('0x40')],{})[_0xff50('0x20')](respondWithResult(_0xcd2cdc,0xc9))[_0xff50('0x3a')](handleError(_0xcd2cdc,null));};exports[_0xff50('0x41')]=function(_0x4bca0f,_0x46869c){if(_0x4bca0f['body']['id']){delete _0x4bca0f[_0xff50('0x40')]['id'];}return db[_0xff50('0x27')]['find']({'where':{'id':_0x4bca0f[_0xff50('0x42')]['id']}})[_0xff50('0x20')](handleEntityNotFound(_0x46869c,null))[_0xff50('0x20')](saveUpdates(_0x4bca0f[_0xff50('0x40')],null))[_0xff50('0x20')](respondWithResult(_0x46869c,null))[_0xff50('0x3a')](handleError(_0x46869c,null));};exports[_0xff50('0x21')]=function(_0x114c28,_0x3e369c){return db[_0xff50('0x27')][_0xff50('0x3e')]({'where':{'id':_0x114c28['params']['id']}})[_0xff50('0x20')](handleEntityNotFound(_0x3e369c,null))[_0xff50('0x20')](removeEntity(_0x3e369c,null))[_0xff50('0x3a')](handleError(_0x3e369c,null));};exports[_0xff50('0x43')]=function(_0x5dc9d3,_0x5cc0be){return db[_0xff50('0x27')][_0xff50('0x43')]()['then'](respondWithResult(_0x5cc0be,null))[_0xff50('0x3a')](handleError(_0x5cc0be,null));};exports['getQuestions']=function(_0x5ad05f,_0x324704,_0x512ce5){var _0x5bab76={'raw':!![],'where':{}};var _0x159c43={};var _0x330ac0={'count':0x0,'rows':[]};return db[_0xff50('0x27')][_0xff50('0x44')]({'where':{'id':_0x5ad05f[_0xff50('0x42')]['id']}})[_0xff50('0x20')](handleEntityNotFound(_0x324704,null))[_0xff50('0x20')](function(_0x527986){if(_0x527986){_0x159c43[_0xff50('0x2b')]=_[_0xff50('0x2c')](db[_0xff50('0x45')][_0xff50('0x46')]);_0x159c43['query']=_[_0xff50('0x2c')](_0x5ad05f[_0xff50('0x2d')]);_0x159c43[_0xff50('0x2e')]=_[_0xff50('0x2f')](_0x159c43[_0xff50('0x2b')],_0x159c43[_0xff50('0x2d')]);_0x5bab76[_0xff50('0x30')]=_['intersection'](_0x159c43[_0xff50('0x2b')],qs[_0xff50('0x31')](_0x5ad05f[_0xff50('0x2d')][_0xff50('0x31')]));_0x5bab76[_0xff50('0x30')]=_0x5bab76['attributes'][_0xff50('0x3c')]?_0x5bab76[_0xff50('0x30')]:_0x159c43['model'];if(!_0x5ad05f['query']['hasOwnProperty']('nolimit')){_0x5bab76[_0xff50('0x1b')]=qs[_0xff50('0x1b')](_0x5ad05f[_0xff50('0x2d')][_0xff50('0x1b')]);_0x5bab76['offset']=qs[_0xff50('0x18')](_0x5ad05f[_0xff50('0x2d')][_0xff50('0x18')]);}_0x5bab76['order']=qs[_0xff50('0x33')](_0x5ad05f['query'][_0xff50('0x33')]);_0x5bab76[_0xff50('0x34')]=qs[_0xff50('0x2e')](_[_0xff50('0x47')](_0x5ad05f[_0xff50('0x2d')],_0x159c43['filters']));_0x5bab76[_0xff50('0x34')][_0xff50('0x48')]=_0x527986['id'];if(_0x5ad05f[_0xff50('0x2d')][_0xff50('0x35')]){_0x5bab76['where']=_[_0xff50('0x36')](_0x5bab76[_0xff50('0x34')],{'$or':_[_0xff50('0x26')](_0x5bab76['attributes'],function(_0x1c2fcb){var _0xdf3c75={};_0xdf3c75[_0x1c2fcb]={'$like':'%'+_0x5ad05f['query'][_0xff50('0x35')]+'%'};return _0xdf3c75;})});}_0x5bab76=_[_0xff50('0x36')]({},_0x5bab76,_0x5ad05f[_0xff50('0x37')]);return db[_0xff50('0x45')][_0xff50('0x1a')]({'where':_0x5bab76[_0xff50('0x34')]})[_0xff50('0x20')](function(_0x11679f){_0x330ac0[_0xff50('0x1a')]=_0x11679f;if(_0x5ad05f[_0xff50('0x2d')]['includeAll']){_0x5bab76[_0xff50('0x38')]=[{'all':!![]}];}return db[_0xff50('0x45')][_0xff50('0x49')](_0x5bab76);})['then'](function(_0x3754e6){_0x330ac0[_0xff50('0x39')]=_0x3754e6;return _0x330ac0;});}})[_0xff50('0x20')](respondWithFilteredResult(_0x324704,_0x5bab76))['catch'](handleError(_0x324704,null));}; \ No newline at end of file +var _0x92f7=['moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','map','JscriptySessionReport','rawAttributes','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','intersection','options','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x566089,_0x3dc283){var _0x517519=function(_0x44c516){while(--_0x44c516){_0x566089['push'](_0x566089['shift']());}};_0x517519(++_0x3dc283);}(_0x92f7,0x17d));var _0x792f=function(_0x1c3736,_0x34662d){_0x1c3736=_0x1c3736-0x0;var _0x2a3fd6=_0x92f7[_0x1c3736];return _0x2a3fd6;};'use strict';var emlformat=require(_0x792f('0x0'));var rimraf=require(_0x792f('0x1'));var zipdir=require(_0x792f('0x2'));var jsonpatch=require(_0x792f('0x3'));var rp=require('request-promise');var moment=require(_0x792f('0x4'));var BPromise=require(_0x792f('0x5'));var Mustache=require(_0x792f('0x6'));var util=require('util');var path=require('path');var sox=require(_0x792f('0x7'));var csv=require(_0x792f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x792f('0x9'));var _=require(_0x792f('0xa'));var squel=require('squel');var crypto=require(_0x792f('0xb'));var jsforce=require(_0x792f('0xc'));var deskjs=require(_0x792f('0xd'));var toCsv=require(_0x792f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x792f('0xe'));var qs=require(_0x792f('0xf'));var as=require(_0x792f('0x10'));var hardwareService=require(_0x792f('0x11'));var logger=require(_0x792f('0x12'))('api');var utils=require(_0x792f('0x13'));var config=require(_0x792f('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20cb2f,_0x2e1d24){_0x2e1d24=_0x2e1d24||0xcc;return function(_0x53dce0){if(_0x53dce0){return _0x20cb2f[_0x792f('0x15')](_0x2e1d24);}return _0x20cb2f[_0x792f('0x16')](_0x2e1d24)[_0x792f('0x17')]();};}function respondWithResult(_0xbd6c69,_0x1607a7){_0x1607a7=_0x1607a7||0xc8;return function(_0xb43e58){if(_0xb43e58){return _0xbd6c69[_0x792f('0x16')](_0x1607a7)['json'](_0xb43e58);}};}function respondWithFilteredResult(_0x30437a,_0xbe6f54){return function(_0x174c74){if(_0x174c74){var _0x4a84b1=typeof _0xbe6f54['offset']==='undefined'&&typeof _0xbe6f54[_0x792f('0x18')]===_0x792f('0x19');var _0x15aa78=_0x174c74[_0x792f('0x1a')];var _0x38a52e=_0x4a84b1?0x0:_0xbe6f54[_0x792f('0x1b')];var _0x27908a=_0x4a84b1?_0x174c74[_0x792f('0x1a')]:_0xbe6f54[_0x792f('0x1b')]+_0xbe6f54[_0x792f('0x18')];var _0x243389;if(_0x27908a>=_0x15aa78){_0x27908a=_0x15aa78;_0x243389=0xc8;}else{_0x243389=0xce;}_0x30437a['status'](_0x243389);return _0x30437a[_0x792f('0x1c')](_0x792f('0x1d'),_0x38a52e+'-'+_0x27908a+'/'+_0x15aa78)[_0x792f('0x1e')](_0x174c74);}return null;};}function patchUpdates(_0x2cf929){return function(_0x2fa1d5){try{jsonpatch[_0x792f('0x1f')](_0x2fa1d5,_0x2cf929,!![]);}catch(_0x49e132){return BPromise[_0x792f('0x20')](_0x49e132);}return _0x2fa1d5[_0x792f('0x21')]();};}function saveUpdates(_0xe6e5a0,_0x3b6478){return function(_0x43ec02){if(_0x43ec02){return _0x43ec02[_0x792f('0x22')](_0xe6e5a0)[_0x792f('0x23')](function(_0xc90d21){return _0xc90d21;});}return null;};}function removeEntity(_0x420d59,_0x2e2691){return function(_0x93e882){if(_0x93e882){return _0x93e882['destroy']()[_0x792f('0x23')](function(){_0x420d59[_0x792f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e7394,_0x18c402){return function(_0x4f8fc3){if(!_0x4f8fc3){_0x5e7394[_0x792f('0x15')](0x194);}return _0x4f8fc3;};}function handleError(_0x4fdc5a,_0xc723b8){_0xc723b8=_0xc723b8||0x1f4;return function(_0x3323b4){logger[_0x792f('0x24')](_0x3323b4[_0x792f('0x25')]);if(_0x3323b4[_0x792f('0x26')]){delete _0x3323b4['name'];}_0x4fdc5a[_0x792f('0x16')](_0xc723b8)[_0x792f('0x27')](_0x3323b4);};}exports['index']=function(_0x2aeb1d,_0x59decb){var _0x110f76={},_0x739fd8={},_0x318f7e={'count':0x0,'rows':[]};var _0x131a53=_[_0x792f('0x28')](db[_0x792f('0x29')][_0x792f('0x2a')],function(_0xc27798){return{'name':_0xc27798['fieldName'],'type':_0xc27798['type'][_0x792f('0x2b')]};});_0x739fd8[_0x792f('0x2c')]=_[_0x792f('0x28')](_0x131a53,_0x792f('0x26'));_0x739fd8[_0x792f('0x2d')]=_[_0x792f('0x2e')](_0x2aeb1d['query']);_0x739fd8[_0x792f('0x2f')]=_['intersection'](_0x739fd8[_0x792f('0x2c')],_0x739fd8['query']);_0x110f76[_0x792f('0x30')]=_['intersection'](_0x739fd8['model'],qs[_0x792f('0x31')](_0x2aeb1d[_0x792f('0x2d')]['fields']));_0x110f76[_0x792f('0x30')]=_0x110f76[_0x792f('0x30')][_0x792f('0x32')]?_0x110f76[_0x792f('0x30')]:_0x739fd8[_0x792f('0x2c')];if(!_0x2aeb1d[_0x792f('0x2d')][_0x792f('0x33')](_0x792f('0x34'))){_0x110f76[_0x792f('0x18')]=qs['limit'](_0x2aeb1d[_0x792f('0x2d')]['limit']);_0x110f76[_0x792f('0x1b')]=qs[_0x792f('0x1b')](_0x2aeb1d['query'][_0x792f('0x1b')]);}_0x110f76[_0x792f('0x35')]=qs[_0x792f('0x36')](_0x2aeb1d['query'][_0x792f('0x36')]);_0x110f76[_0x792f('0x37')]=qs[_0x792f('0x2f')](_[_0x792f('0x38')](_0x2aeb1d[_0x792f('0x2d')],_0x739fd8[_0x792f('0x2f')]),_0x131a53);if(_0x2aeb1d[_0x792f('0x2d')][_0x792f('0x39')]){_0x110f76[_0x792f('0x37')]=_[_0x792f('0x3a')](_0x110f76['where'],{'$or':_[_0x792f('0x28')](_0x131a53,function(_0x5104d4){if(_0x5104d4['type']!==_0x792f('0x3b')){var _0x3b7689={};_0x3b7689[_0x5104d4['name']]={'$like':'%'+_0x2aeb1d[_0x792f('0x2d')][_0x792f('0x39')]+'%'};return _0x3b7689;}})});}_0x110f76=_['merge']({},_0x110f76,_0x2aeb1d['options']);var _0x6f90bc={'where':_0x110f76[_0x792f('0x37')]};return db[_0x792f('0x29')]['count'](_0x6f90bc)[_0x792f('0x23')](function(_0x5badbd){_0x318f7e['count']=_0x5badbd;if(_0x2aeb1d[_0x792f('0x2d')][_0x792f('0x3c')]){_0x110f76[_0x792f('0x3d')]=[{'all':!![]}];}return db[_0x792f('0x29')]['findAll'](_0x110f76);})[_0x792f('0x23')](function(_0x156dbd){_0x318f7e[_0x792f('0x3e')]=_0x156dbd;return _0x318f7e;})[_0x792f('0x23')](respondWithFilteredResult(_0x59decb,_0x110f76))[_0x792f('0x3f')](handleError(_0x59decb,null));};exports[_0x792f('0x40')]=function(_0x2f1915,_0x1e34f4){var _0x248e03={'raw':!![],'where':{'id':_0x2f1915[_0x792f('0x41')]['id']}},_0x27ab32={};_0x27ab32[_0x792f('0x2c')]=_['keys'](db[_0x792f('0x29')][_0x792f('0x2a')]);_0x27ab32[_0x792f('0x2d')]=_['keys'](_0x2f1915[_0x792f('0x2d')]);_0x27ab32[_0x792f('0x2f')]=_[_0x792f('0x42')](_0x27ab32[_0x792f('0x2c')],_0x27ab32['query']);_0x248e03[_0x792f('0x30')]=_[_0x792f('0x42')](_0x27ab32['model'],qs[_0x792f('0x31')](_0x2f1915[_0x792f('0x2d')]['fields']));_0x248e03[_0x792f('0x30')]=_0x248e03[_0x792f('0x30')][_0x792f('0x32')]?_0x248e03[_0x792f('0x30')]:_0x27ab32[_0x792f('0x2c')];if(_0x2f1915['query'][_0x792f('0x3c')]){_0x248e03[_0x792f('0x3d')]=[{'all':!![]}];}_0x248e03=_['merge']({},_0x248e03,_0x2f1915[_0x792f('0x43')]);return db[_0x792f('0x29')][_0x792f('0x44')](_0x248e03)[_0x792f('0x23')](handleEntityNotFound(_0x1e34f4,null))[_0x792f('0x23')](respondWithResult(_0x1e34f4,null))[_0x792f('0x3f')](handleError(_0x1e34f4,null));};exports[_0x792f('0x45')]=function(_0x2fe8d2,_0xb24353){return db[_0x792f('0x29')][_0x792f('0x45')](_0x2fe8d2['body'],{})['then'](respondWithResult(_0xb24353,0xc9))[_0x792f('0x3f')](handleError(_0xb24353,null));};exports[_0x792f('0x22')]=function(_0x39a518,_0x12bc36){if(_0x39a518[_0x792f('0x46')]['id']){delete _0x39a518[_0x792f('0x46')]['id'];}return db['JscriptySessionReport'][_0x792f('0x44')]({'where':{'id':_0x39a518[_0x792f('0x41')]['id']}})[_0x792f('0x23')](handleEntityNotFound(_0x12bc36,null))['then'](saveUpdates(_0x39a518['body'],null))[_0x792f('0x23')](respondWithResult(_0x12bc36,null))[_0x792f('0x3f')](handleError(_0x12bc36,null));};exports[_0x792f('0x47')]=function(_0x29e2fc,_0x4a320e){return db[_0x792f('0x29')][_0x792f('0x44')]({'where':{'id':_0x29e2fc['params']['id']}})['then'](handleEntityNotFound(_0x4a320e,null))['then'](removeEntity(_0x4a320e,null))[_0x792f('0x3f')](handleError(_0x4a320e,null));};exports[_0x792f('0x48')]=function(_0x5cdf0a,_0x532a6e){return db[_0x792f('0x29')][_0x792f('0x48')]()[_0x792f('0x23')](respondWithResult(_0x532a6e,null))['catch'](handleError(_0x532a6e,null));};exports[_0x792f('0x49')]=function(_0x3f4fba,_0x5eb272,_0x29b2ee){var _0x17c3d0={'raw':!![],'where':{}};var _0x5235d0={};var _0x2730d9={'count':0x0,'rows':[]};return db[_0x792f('0x29')][_0x792f('0x4a')]({'where':{'id':_0x3f4fba['params']['id']}})[_0x792f('0x23')](handleEntityNotFound(_0x5eb272,null))['then'](function(_0x297485){if(_0x297485){_0x5235d0[_0x792f('0x2c')]=_[_0x792f('0x2e')](db[_0x792f('0x4b')][_0x792f('0x2a')]);_0x5235d0[_0x792f('0x2d')]=_[_0x792f('0x2e')](_0x3f4fba['query']);_0x5235d0[_0x792f('0x2f')]=_['intersection'](_0x5235d0[_0x792f('0x2c')],_0x5235d0[_0x792f('0x2d')]);_0x17c3d0[_0x792f('0x30')]=_[_0x792f('0x42')](_0x5235d0[_0x792f('0x2c')],qs[_0x792f('0x31')](_0x3f4fba[_0x792f('0x2d')][_0x792f('0x31')]));_0x17c3d0[_0x792f('0x30')]=_0x17c3d0[_0x792f('0x30')][_0x792f('0x32')]?_0x17c3d0[_0x792f('0x30')]:_0x5235d0[_0x792f('0x2c')];if(!_0x3f4fba[_0x792f('0x2d')][_0x792f('0x33')]('nolimit')){_0x17c3d0['limit']=qs[_0x792f('0x18')](_0x3f4fba['query'][_0x792f('0x18')]);_0x17c3d0[_0x792f('0x1b')]=qs[_0x792f('0x1b')](_0x3f4fba[_0x792f('0x2d')][_0x792f('0x1b')]);}_0x17c3d0[_0x792f('0x35')]=qs[_0x792f('0x36')](_0x3f4fba[_0x792f('0x2d')][_0x792f('0x36')]);_0x17c3d0['where']=qs[_0x792f('0x2f')](_[_0x792f('0x38')](_0x3f4fba[_0x792f('0x2d')],_0x5235d0['filters']));_0x17c3d0[_0x792f('0x37')][_0x792f('0x4c')]=_0x297485['id'];if(_0x3f4fba[_0x792f('0x2d')][_0x792f('0x39')]){_0x17c3d0[_0x792f('0x37')]=_[_0x792f('0x3a')](_0x17c3d0[_0x792f('0x37')],{'$or':_[_0x792f('0x28')](_0x17c3d0[_0x792f('0x30')],function(_0x1f5107){var _0x1ed2b4={};_0x1ed2b4[_0x1f5107]={'$like':'%'+_0x3f4fba[_0x792f('0x2d')][_0x792f('0x39')]+'%'};return _0x1ed2b4;})});}_0x17c3d0=_[_0x792f('0x3a')]({},_0x17c3d0,_0x3f4fba[_0x792f('0x43')]);return db[_0x792f('0x4b')]['count']({'where':_0x17c3d0['where']})['then'](function(_0x5adf20){_0x2730d9[_0x792f('0x1a')]=_0x5adf20;if(_0x3f4fba['query'][_0x792f('0x3c')]){_0x17c3d0[_0x792f('0x3d')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x17c3d0);})[_0x792f('0x23')](function(_0x1f0a46){_0x2730d9['rows']=_0x1f0a46;return _0x2730d9;});}})[_0x792f('0x23')](respondWithFilteredResult(_0x5eb272,_0x17c3d0))['catch'](handleError(_0x5eb272,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 0a4c8ea..128c0a0 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 _0x9fd4=['rimraf','exports','define','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9fd4,0x16c));var _0x49fd=function(_0x3f0d76,_0x378fed){_0x3f0d76=_0x3f0d76-0x0;var _0x12c12e=_0x9fd4[_0x3f0d76];return _0x12c12e;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var logger=require(_0x49fd('0x2'))(_0x49fd('0x3'));var moment=require(_0x49fd('0x4'));var BPromise=require(_0x49fd('0x5'));var rp=require(_0x49fd('0x6'));var fs=require('fs');var path=require(_0x49fd('0x7'));var rimraf=require(_0x49fd('0x8'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x49fd('0x9')]=function(_0x42fdc7,_0x1bc16e){return _0x42fdc7[_0x49fd('0xa')]('JscriptySessionReport',attributes,{'tableName':_0x49fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x885a=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x885a,0x180));var _0xa885=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x885a[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0xa885('0x0'));var logger=require(_0xa885('0x1'))(_0xa885('0x2'));var moment=require(_0xa885('0x3'));var BPromise=require('bluebird');var rp=require(_0xa885('0x4'));var fs=require('fs');var path=require(_0xa885('0x5'));var rimraf=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var attributes=require(_0xa885('0x8'));module[_0xa885('0x9')]=function(_0x5dfd7e,_0x7ac6bd){return _0x5dfd7e[_0xa885('0xa')](_0xa885('0xb'),attributes,{'tableName':'report_jscripty_sessions','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 81bc464..2869adf 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 _0x6455=['client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2031a8,_0x4b96d4){var _0x4d622c=function(_0x480fd0){while(--_0x480fd0){_0x2031a8['push'](_0x2031a8['shift']());}};_0x4d622c(++_0x4b96d4);}(_0x6455,0x97));var _0x5645=function(_0x68799c,_0x1d4033){_0x68799c=_0x68799c-0x0;var _0x3b0476=_0x6455[_0x68799c];return _0x3b0476;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var moment=require(_0x5645('0x1'));var BPromise=require(_0x5645('0x2'));var rs=require(_0x5645('0x3'));var fs=require('fs');var Redis=require(_0x5645('0x4'));var db=require(_0x5645('0x5'))['db'];var utils=require(_0x5645('0x6'));var logger=require('../../config/logger')(_0x5645('0x7'));var config=require(_0x5645('0x8'));var jayson=require(_0x5645('0x9'));var client=jayson[_0x5645('0xa')][_0x5645('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37d672,_0xa14a06,_0x278d86){return new BPromise(function(_0x518a28,_0x5f4037){return client[_0x5645('0xc')](_0x37d672,_0x278d86)[_0x5645('0xd')](function(_0x38c07a){logger[_0x5645('0xe')](_0x5645('0xf'),_0xa14a06,_0x5645('0x10'));logger['debug'](_0x5645('0x11'),_0xa14a06,_0x5645('0x10'),JSON[_0x5645('0x12')](_0x38c07a));if(_0x38c07a[_0x5645('0x13')]){if(_0x38c07a['error'][_0x5645('0x14')]===0x1f4){logger['error'](_0x5645('0xf'),_0xa14a06,_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);return _0x5f4037(_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);}logger[_0x5645('0x13')](_0x5645('0xf'),_0xa14a06,_0x38c07a[_0x5645('0x13')]['message']);return _0x518a28(_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);}else{logger[_0x5645('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0xa14a06,'request\x20sent');_0x518a28(_0x38c07a[_0x5645('0x16')][_0x5645('0x15')]);}})['catch'](function(_0x35e0c7){logger[_0x5645('0x13')](_0x5645('0xf'),_0xa14a06,_0x35e0c7);_0x5f4037(_0x35e0c7);});});} \ No newline at end of file +var _0x25e7=['JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info'];(function(_0x4508bf,_0x1d1edf){var _0x30e70e=function(_0x5aac4b){while(--_0x5aac4b){_0x4508bf['push'](_0x4508bf['shift']());}};_0x30e70e(++_0x1d1edf);}(_0x25e7,0x1d6));var _0x725e=function(_0xa4a9b3,_0x3b271c){_0xa4a9b3=_0xa4a9b3-0x0;var _0xb7a49e=_0x25e7[_0xa4a9b3];return _0xb7a49e;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var BPromise=require(_0x725e('0x3'));var rs=require(_0x725e('0x4'));var fs=require('fs');var Redis=require(_0x725e('0x5'));var db=require(_0x725e('0x6'))['db'];var utils=require(_0x725e('0x7'));var logger=require(_0x725e('0x8'))(_0x725e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x725e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481316,_0x111a50,_0x192c27){return new BPromise(function(_0x216b33,_0x67de0c){return client[_0x725e('0xb')](_0x481316,_0x192c27)[_0x725e('0xc')](function(_0x39858a){logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,_0x725e('0xf'));logger[_0x725e('0x10')](_0x725e('0x11'),_0x111a50,'request\x20sent',JSON['stringify'](_0x39858a));if(_0x39858a[_0x725e('0x12')]){if(_0x39858a[_0x725e('0x12')]['code']===0x1f4){logger['error'](_0x725e('0xe'),_0x111a50,_0x39858a[_0x725e('0x12')]['message']);return _0x67de0c(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}logger[_0x725e('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x111a50,_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);return _0x216b33(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}else{logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,'request\x20sent');_0x216b33(_0x39858a[_0x725e('0x14')][_0x725e('0x13')]);}})[_0x725e('0x15')](function(_0x54ac0f){logger[_0x725e('0x12')](_0x725e('0xe'),_0x111a50,_0x54ac0f);_0x67de0c(_0x54ac0f);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index df0220f..f7537a7 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 _0xdbf7=['index','put','/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4df356,_0x2070df){var _0x1d732c=function(_0x46742a){while(--_0x46742a){_0x4df356['push'](_0x4df356['shift']());}};_0x1d732c(++_0x2070df);}(_0xdbf7,0x8d));var _0x7dbf=function(_0x4c0a9d,_0x554b77){_0x4c0a9d=_0x4c0a9d-0x0;var _0x2bb384=_0xdbf7[_0x4c0a9d];return _0x2bb384;};'use strict';var multer=require(_0x7dbf('0x0'));var util=require(_0x7dbf('0x1'));var path=require(_0x7dbf('0x2'));var timeout=require(_0x7dbf('0x3'));var express=require(_0x7dbf('0x4'));var router=express[_0x7dbf('0x5')]();var fs_extra=require(_0x7dbf('0x6'));var auth=require(_0x7dbf('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7dbf('0x8'));var controller=require('./license.controller');router['get']('/',controller[_0x7dbf('0x9')]);router[_0x7dbf('0xa')](_0x7dbf('0xb'),auth[_0x7dbf('0xc')](),controller[_0x7dbf('0xd')]);module[_0x7dbf('0xe')]=router; \ No newline at end of file +var _0xcb06=['../../components/auth/service','../../config/environment','get','index','put','/:id','isAuthenticated','update','exports','connect-timeout','Router'];(function(_0xb0f711,_0x5165fd){var _0xb711b0=function(_0x36dc5e){while(--_0x36dc5e){_0xb0f711['push'](_0xb0f711['shift']());}};_0xb711b0(++_0x5165fd);}(_0xcb06,0x127));var _0x6cb0=function(_0xe6ce5f,_0x24a05a){_0xe6ce5f=_0xe6ce5f-0x0;var _0x2af5a9=_0xcb06[_0xe6ce5f];return _0x2af5a9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x6cb0('0x0'));var express=require('express');var router=express[_0x6cb0('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x6cb0('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x6cb0('0x3'));var controller=require('./license.controller');router[_0x6cb0('0x4')]('/',controller[_0x6cb0('0x5')]);router[_0x6cb0('0x6')](_0x6cb0('0x7'),auth[_0x6cb0('0x8')](),controller[_0x6cb0('0x9')]);module[_0x6cb0('0xa')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 206b07e..638a351 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 _0xd163=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd163,0x18d));var _0x3d16=function(_0x5f5cce,_0x138cc5){_0x5f5cce=_0x5f5cce-0x0;var _0x705ecf=_0xd163[_0x5f5cce];return _0x705ecf;};'use strict';var Sequelize=require(_0x3d16('0x0'));module[_0x3d16('0x1')]={'license':{'type':Sequelize[_0x3d16('0x2')]},'data1':{'type':Sequelize[_0x3d16('0x3')]},'data2':{'type':Sequelize[_0x3d16('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x3d16('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9f29=['exports','STRING','INTEGER','sequelize'];(function(_0x249511,_0x2799b6){var _0x3c7eed=function(_0x10857b){while(--_0x10857b){_0x249511['push'](_0x249511['shift']());}};_0x3c7eed(++_0x2799b6);}(_0x9f29,0x83));var _0x99f2=function(_0x1d64e2,_0x5d243b){_0x1d64e2=_0x1d64e2-0x0;var _0x1f6e2d=_0x9f29[_0x1d64e2];return _0x1f6e2d;};'use strict';var Sequelize=require(_0x99f2('0x0'));module[_0x99f2('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x99f2('0x2')]},'data2':{'type':Sequelize[_0x99f2('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x99f2('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 7c29d7d..37f967b 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 _0xabce=['status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','model','keys','License','rawAttributes','query','intersection','attributes','fields','merge','getLicense','catch','find','get','body','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x2b6766,_0x36d14c){var _0x4db1a2=function(_0x3bffb7){while(--_0x3bffb7){_0x2b6766['push'](_0x2b6766['shift']());}};_0x4db1a2(++_0x36d14c);}(_0xabce,0x103));var _0xeabc=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xabce[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];function respondWithStatusCode(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=typeof _0x53d5cb['offset']==='undefined'&&typeof _0x53d5cb[_0xeabc('0x1d')]==='undefined';var _0x3d0e21=_0xf913d7[_0xeabc('0x1e')];var _0x58a3c0=_0x638976?0x0:_0x53d5cb[_0xeabc('0x1f')];var _0x31dd53=_0x638976?_0xf913d7[_0xeabc('0x1e')]:_0x53d5cb[_0xeabc('0x1f')]+_0x53d5cb[_0xeabc('0x1d')];var _0x5d92e5;if(_0x31dd53>=_0x3d0e21){_0x31dd53=_0x3d0e21;_0x5d92e5=0xc8;}else{_0x5d92e5=0xce;}_0x326bac[_0xeabc('0x1a')](_0x5d92e5);return _0x326bac['set'](_0xeabc('0x20'),_0x58a3c0+'-'+_0x31dd53+'/'+_0x3d0e21)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x502947){return function(_0x28063a){try{jsonpatch[_0xeabc('0x21')](_0x28063a,_0x502947,!![]);}catch(_0x254590){return BPromise[_0xeabc('0x22')](_0x254590);}return _0x28063a[_0xeabc('0x23')]();};}function saveUpdates(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x24')](_0x4e99a4)['then'](function(_0x457f27){return _0x457f27;});}return null;};}function removeEntity(_0x3854d2,_0x214953){return function(_0x319119){if(_0x319119){return _0x319119['destroy']()[_0xeabc('0x25')](function(){_0x3854d2['status'](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4d4e29,_0x811f0d){return function(_0x12acbd){if(!_0x12acbd){_0x4d4e29[_0xeabc('0x26')](0x194);}return _0x12acbd;};}function handleError(_0x3f194e,_0x3a1a04){_0x3a1a04=_0x3a1a04||0x1f4;return function(_0x137293){logger[_0xeabc('0x27')](_0x137293['stack']);if(_0x137293['name']){delete _0x137293[_0xeabc('0x28')];}_0x3f194e['status'](_0x3a1a04)[_0xeabc('0x29')](_0x137293);};}var utilLicense=require(_0xeabc('0x18'));exports['index']=function(_0x2163e6,_0x38572d){var _0x2b568f={'raw':!![],'where':{'id':0x1}},_0x2f8633={};_0x2f8633[_0xeabc('0x2a')]=_[_0xeabc('0x2b')](db[_0xeabc('0x2c')][_0xeabc('0x2d')]);_0x2f8633[_0xeabc('0x2e')]=_['keys'](_0x2163e6[_0xeabc('0x2e')]);_0x2f8633['filters']=_[_0xeabc('0x2f')](_0x2f8633[_0xeabc('0x2a')],_0x2f8633[_0xeabc('0x2e')]);_0x2b568f[_0xeabc('0x30')]=_[_0xeabc('0x2f')](_0x2f8633[_0xeabc('0x2a')],qs[_0xeabc('0x31')](_0x2163e6['query'][_0xeabc('0x31')]));_0x2b568f[_0xeabc('0x30')]=_0x2b568f[_0xeabc('0x30')]['length']?_0x2b568f[_0xeabc('0x30')]:_0x2f8633[_0xeabc('0x2a')];_0x2b568f=_[_0xeabc('0x32')]({},_0x2b568f,_0x2163e6['options']);return utilLicense[_0xeabc('0x33')](_0x2b568f)[_0xeabc('0x25')](respondWithResult(_0x38572d,null))[_0xeabc('0x34')](handleError(_0x38572d,null));};exports['update']=function(_0xf98c7c,_0x286203){if(_0xf98c7c['body']['id']){delete _0xf98c7c['body']['id'];}return db[_0xeabc('0x2c')][_0xeabc('0x35')]({'where':{'id':_0xf98c7c['params']['id']}})[_0xeabc('0x25')](handleEntityNotFound(_0x286203,null))[_0xeabc('0x25')](function(_0x3edee7){var _0x10434e=_0x3edee7[_0xeabc('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0x10434e,_0xf98c7c[_0xeabc('0x37')]['key']);})[_0xeabc('0x25')](function(_0x2bda29){if(!_0x2bda29[_0xeabc('0x38')]){return saveUpdates(_0xf98c7c['body'],null);}return _0x2bda29;})['then'](respondWithResult(_0x286203,null))[_0xeabc('0x34')](handleError(_0x286203,null));}; \ No newline at end of file +var _0x814b=['json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','model','keys','rawAttributes','intersection','query','attributes','fields','length','merge','options','getLicense','catch','body','License','params','get','key','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x47beda,_0xf71fef){var _0x3a744f=function(_0x461e63){while(--_0x461e63){_0x47beda['push'](_0x47beda['shift']());}};_0x3a744f(++_0xf71fef);}(_0x814b,0x1a2));var _0xb814=function(_0x20d54d,_0x1adc8e){_0x20d54d=_0x20d54d-0x0;var _0x516e8b=_0x814b[_0x20d54d];return _0x516e8b;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}var utilLicense=require(_0xb814('0x19'));exports['index']=function(_0x9008b2,_0x37d24d){var _0x530744={'raw':!![],'where':{'id':0x1}},_0x499f22={};_0x499f22[_0xb814('0x2e')]=_[_0xb814('0x2f')](db['License'][_0xb814('0x30')]);_0x499f22['query']=_[_0xb814('0x2f')](_0x9008b2['query']);_0x499f22['filters']=_[_0xb814('0x31')](_0x499f22['model'],_0x499f22[_0xb814('0x32')]);_0x530744[_0xb814('0x33')]=_[_0xb814('0x31')](_0x499f22['model'],qs['fields'](_0x9008b2[_0xb814('0x32')][_0xb814('0x34')]));_0x530744['attributes']=_0x530744[_0xb814('0x33')][_0xb814('0x35')]?_0x530744[_0xb814('0x33')]:_0x499f22[_0xb814('0x2e')];_0x530744=_[_0xb814('0x36')]({},_0x530744,_0x9008b2[_0xb814('0x37')]);return utilLicense[_0xb814('0x38')](_0x530744)['then'](respondWithResult(_0x37d24d,null))[_0xb814('0x39')](handleError(_0x37d24d,null));};exports[_0xb814('0x27')]=function(_0x30de5a,_0x424e2b){if(_0x30de5a[_0xb814('0x3a')]['id']){delete _0x30de5a['body']['id'];}return db[_0xb814('0x3b')]['find']({'where':{'id':_0x30de5a[_0xb814('0x3c')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x424e2b,null))[_0xb814('0x28')](function(_0x492d5e){var _0x40b885=_0x492d5e[_0xb814('0x3d')]({'plain':!![]});return utilLicense['checkLicense'](_0x40b885,_0x30de5a[_0xb814('0x3a')][_0xb814('0x3e')]);})[_0xb814('0x28')](function(_0x1f7cd8){if(!_0x1f7cd8[_0xb814('0x3f')]){return saveUpdates(_0x30de5a[_0xb814('0x3a')],null);}return _0x1f7cd8;})['then'](respondWithResult(_0x424e2b,null))[_0xb814('0x39')](handleError(_0x424e2b,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index f60b116..5cc2fb4 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 _0x6834=['api','bluebird','path','rimraf','exports','License','util','../../config/logger'];(function(_0x46a634,_0x439b70){var _0x42007a=function(_0x2a9e29){while(--_0x2a9e29){_0x46a634['push'](_0x46a634['shift']());}};_0x42007a(++_0x439b70);}(_0x6834,0x1d6));var _0x4683=function(_0x3c236c,_0x59ba97){_0x3c236c=_0x3c236c-0x0;var _0xe3a3e3=_0x6834[_0x3c236c];return _0xe3a3e3;};'use strict';var _=require('lodash');var util=require(_0x4683('0x0'));var logger=require(_0x4683('0x1'))(_0x4683('0x2'));var moment=require('moment');var BPromise=require(_0x4683('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4683('0x4'));var rimraf=require(_0x4683('0x5'));var config=require('../../config/environment');var attributes=require('./license.attributes');module[_0x4683('0x6')]=function(_0x4631c1,_0x1f7b16){return _0x4631c1['define'](_0x4683('0x7'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0deb=['exports','define','License','license','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes'];(function(_0x3bfdde,_0x306be4){var _0x3f752a=function(_0x3b6751){while(--_0x3b6751){_0x3bfdde['push'](_0x3bfdde['shift']());}};_0x3f752a(++_0x306be4);}(_0x0deb,0x1e5));var _0xb0de=function(_0x593bba,_0x494c82){_0x593bba=_0x593bba-0x0;var _0x470307=_0x0deb[_0x593bba];return _0x470307;};'use strict';var _=require(_0xb0de('0x0'));var util=require(_0xb0de('0x1'));var logger=require(_0xb0de('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb0de('0x3'));var rp=require(_0xb0de('0x4'));var fs=require('fs');var path=require(_0xb0de('0x5'));var rimraf=require(_0xb0de('0x6'));var config=require(_0xb0de('0x7'));var attributes=require(_0xb0de('0x8'));module[_0xb0de('0x9')]=function(_0x131525,_0xe5f793){return _0x131525[_0xb0de('0xa')](_0xb0de('0xb'),attributes,{'tableName':_0xb0de('0xc'),'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 9d4723f..e46d0e2 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 _0x2be7=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','moment'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x2be7,0x1c7));var _0x72be=function(_0x4ded50,_0x4a6af3){_0x4ded50=_0x4ded50-0x0;var _0xa92135=_0x2be7[_0x4ded50];return _0xa92135;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x72be('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72be('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x72be('0x2'));var logger=require('../../config/logger')(_0x72be('0x3'));var config=require(_0x72be('0x4'));var jayson=require(_0x72be('0x5'));var client=jayson[_0x72be('0x6')][_0x72be('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d99dc,_0x13ca58,_0x19eec3){return new BPromise(function(_0x17ebb1,_0x24af5b){return client[_0x72be('0x8')](_0x5d99dc,_0x19eec3)[_0x72be('0x9')](function(_0x2cbbe9){logger['info'](_0x72be('0xa'),_0x13ca58,'request\x20sent');logger[_0x72be('0xb')](_0x72be('0xc'),_0x13ca58,_0x72be('0xd'),JSON['stringify'](_0x2cbbe9));if(_0x2cbbe9[_0x72be('0xe')]){if(_0x2cbbe9[_0x72be('0xe')][_0x72be('0xf')]===0x1f4){logger[_0x72be('0xe')](_0x72be('0xa'),_0x13ca58,_0x2cbbe9[_0x72be('0xe')]['message']);return _0x24af5b(_0x2cbbe9[_0x72be('0xe')][_0x72be('0x10')]);}logger['error'](_0x72be('0xa'),_0x13ca58,_0x2cbbe9[_0x72be('0xe')][_0x72be('0x10')]);return _0x17ebb1(_0x2cbbe9[_0x72be('0xe')][_0x72be('0x10')]);}else{logger[_0x72be('0x11')](_0x72be('0xa'),_0x13ca58,'request\x20sent');_0x17ebb1(_0x2cbbe9['result'][_0x72be('0x10')]);}})[_0x72be('0x12')](function(_0x30b79d){logger[_0x72be('0xe')](_0x72be('0xa'),_0x13ca58,_0x30b79d);_0x24af5b(_0x30b79d);});});} \ No newline at end of file +var _0x820f=['then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x820f,0x9a));var _0xf820=function(_0x1fcf30,_0x221e1b){_0x1fcf30=_0x1fcf30-0x0;var _0x3c7c3d=_0x820f[_0x1fcf30];return _0x3c7c3d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf820('0x0'));var BPromise=require(_0xf820('0x1'));var rs=require(_0xf820('0x2'));var fs=require('fs');var Redis=require(_0xf820('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf820('0x4'))(_0xf820('0x5'));var config=require(_0xf820('0x6'));var jayson=require(_0xf820('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x106a64,_0x1248f9,_0x173854){return new BPromise(function(_0xa0ca65,_0x170455){return client['request'](_0x106a64,_0x173854)[_0xf820('0x8')](function(_0x11e56b){logger[_0xf820('0x9')](_0xf820('0xa'),_0x1248f9,_0xf820('0xb'));logger[_0xf820('0xc')](_0xf820('0xd'),_0x1248f9,_0xf820('0xb'),JSON[_0xf820('0xe')](_0x11e56b));if(_0x11e56b[_0xf820('0xf')]){if(_0x11e56b[_0xf820('0xf')][_0xf820('0x10')]===0x1f4){logger[_0xf820('0xf')]('License,\x20%s,\x20%s',_0x1248f9,_0x11e56b[_0xf820('0xf')]['message']);return _0x170455(_0x11e56b[_0xf820('0xf')][_0xf820('0x11')]);}logger[_0xf820('0xf')]('License,\x20%s,\x20%s',_0x1248f9,_0x11e56b[_0xf820('0xf')]['message']);return _0xa0ca65(_0x11e56b[_0xf820('0xf')][_0xf820('0x11')]);}else{logger['info'](_0xf820('0xa'),_0x1248f9,_0xf820('0xb'));_0xa0ca65(_0x11e56b['result'][_0xf820('0x11')]);}})['catch'](function(_0x9be989){logger[_0xf820('0xf')](_0xf820('0xa'),_0x1248f9,_0x9be989);_0x170455(_0x9be989);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 78193c6..faa315d 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 _0xd95f=['/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','verifySmtp','getAgents','post','addDisposition','addAnswer','addImap','addInteraction','/:id/applications','addApplications','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','removeImap','/:id','destroy','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','show','/:id/dispositions','getDispositions'];(function(_0x181135,_0x1bf463){var _0x32a29c=function(_0x508d3f){while(--_0x508d3f){_0x181135['push'](_0x181135['shift']());}};_0x32a29c(++_0x1bf463);}(_0xd95f,0x110));var _0xfd95=function(_0x542add,_0x55194d){_0x542add=_0x542add-0x0;var _0x51840f=_0xd95f[_0x542add];return _0x51840f;};'use strict';var multer=require(_0xfd95('0x0'));var util=require(_0xfd95('0x1'));var path=require(_0xfd95('0x2'));var timeout=require(_0xfd95('0x3'));var express=require(_0xfd95('0x4'));var router=express[_0xfd95('0x5')]();var fs_extra=require(_0xfd95('0x6'));var auth=require(_0xfd95('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xfd95('0x8'));var controller=require(_0xfd95('0x9'));router[_0xfd95('0xa')]('/',auth[_0xfd95('0xb')](),controller[_0xfd95('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xfd95('0xa')]('/:id',auth[_0xfd95('0xb')](),controller[_0xfd95('0xd')]);router[_0xfd95('0xa')](_0xfd95('0xe'),auth[_0xfd95('0xb')](),controller[_0xfd95('0xf')]);router['get'](_0xfd95('0x10'),auth[_0xfd95('0xb')](),controller[_0xfd95('0x11')]);router[_0xfd95('0xa')](_0xfd95('0x12'),auth[_0xfd95('0xb')](),controller['getImap']);router[_0xfd95('0xa')](_0xfd95('0x13'),auth[_0xfd95('0xb')](),controller[_0xfd95('0x14')]);router['get'](_0xfd95('0x15'),auth['isAuthenticated'](),controller[_0xfd95('0x16')]);router[_0xfd95('0xa')]('/:id/applications',auth[_0xfd95('0xb')](),controller[_0xfd95('0x17')]);router[_0xfd95('0xa')](_0xfd95('0x18'),auth['isAuthenticated'](),controller[_0xfd95('0x19')]);router[_0xfd95('0xa')]('/:id/verify',auth[_0xfd95('0xb')](),controller[_0xfd95('0x1a')]);router[_0xfd95('0xa')]('/:id/users',auth[_0xfd95('0xb')](),controller[_0xfd95('0x1b')]);router[_0xfd95('0x1c')](_0xfd95('0xe'),auth[_0xfd95('0xb')](),controller[_0xfd95('0x1d')]);router[_0xfd95('0x1c')](_0xfd95('0x10'),auth[_0xfd95('0xb')](),controller[_0xfd95('0x1e')]);router[_0xfd95('0x1c')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfd95('0x1c')](_0xfd95('0x12'),auth[_0xfd95('0xb')](),controller[_0xfd95('0x1f')]);router[_0xfd95('0x1c')]('/:id/out_servers',auth[_0xfd95('0xb')](),controller['addSmtp']);router[_0xfd95('0x1c')](_0xfd95('0x15'),auth['isAuthenticated'](),controller[_0xfd95('0x20')]);router['post'](_0xfd95('0x21'),auth[_0xfd95('0xb')](),controller[_0xfd95('0x22')]);router[_0xfd95('0x1c')](_0xfd95('0x23'),auth[_0xfd95('0xb')](),controller[_0xfd95('0x24')]);router['post']('/:id/users',auth[_0xfd95('0xb')](),controller['addAgents']);router[_0xfd95('0x25')]('/:id',auth[_0xfd95('0xb')](),controller[_0xfd95('0x26')]);router[_0xfd95('0x27')](_0xfd95('0xe'),auth[_0xfd95('0xb')](),controller[_0xfd95('0x28')]);router[_0xfd95('0x27')](_0xfd95('0x10'),auth['isAuthenticated'](),controller[_0xfd95('0x29')]);router[_0xfd95('0x27')](_0xfd95('0x12'),auth[_0xfd95('0xb')](),controller[_0xfd95('0x2a')]);router['delete'](_0xfd95('0x13'),auth[_0xfd95('0xb')](),controller['removeSmtp']);router[_0xfd95('0x27')](_0xfd95('0x2b'),auth[_0xfd95('0xb')](),controller[_0xfd95('0x2c')]);router['delete'](_0xfd95('0x2d'),auth[_0xfd95('0xb')](),controller[_0xfd95('0x2e')]);module[_0xfd95('0x2f')]=router; \ No newline at end of file +var _0xebae=['addAgents','put','update','delete','/:id/dispositions','removeDispositions','removeAnswers','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addSmtp','addInteraction','addApplications','/:id/send','send'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xebae,0x143));var _0xeeba=function(_0x24eb2f,_0x361426){_0x24eb2f=_0x24eb2f-0x0;var _0x231c1b=_0xebae[_0x24eb2f];return _0x231c1b;};'use strict';var multer=require(_0xeeba('0x0'));var util=require(_0xeeba('0x1'));var path=require(_0xeeba('0x2'));var timeout=require(_0xeeba('0x3'));var express=require(_0xeeba('0x4'));var router=express[_0xeeba('0x5')]();var fs_extra=require(_0xeeba('0x6'));var auth=require(_0xeeba('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xeeba('0x8'));var controller=require(_0xeeba('0x9'));router[_0xeeba('0xa')]('/',auth[_0xeeba('0xb')](),controller[_0xeeba('0xc')]);router[_0xeeba('0xa')](_0xeeba('0xd'),auth['isAuthenticated'](),controller[_0xeeba('0xe')]);router[_0xeeba('0xa')](_0xeeba('0xf'),auth[_0xeeba('0xb')](),controller['show']);router[_0xeeba('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xeeba('0x10')]);router[_0xeeba('0xa')](_0xeeba('0x11'),auth[_0xeeba('0xb')](),controller[_0xeeba('0x12')]);router['get'](_0xeeba('0x13'),auth[_0xeeba('0xb')](),controller[_0xeeba('0x14')]);router['get'](_0xeeba('0x15'),auth[_0xeeba('0xb')](),controller['getSmtp']);router[_0xeeba('0xa')](_0xeeba('0x16'),auth[_0xeeba('0xb')](),controller[_0xeeba('0x17')]);router[_0xeeba('0xa')](_0xeeba('0x18'),auth[_0xeeba('0xb')](),controller[_0xeeba('0x19')]);router['get'](_0xeeba('0x1a'),auth[_0xeeba('0xb')](),controller[_0xeeba('0x1b')]);router[_0xeeba('0xa')](_0xeeba('0x1c'),auth[_0xeeba('0xb')](),controller[_0xeeba('0x1d')]);router['get'](_0xeeba('0x1e'),auth[_0xeeba('0xb')](),controller[_0xeeba('0x1f')]);router[_0xeeba('0x20')]('/:id/dispositions',auth[_0xeeba('0xb')](),controller[_0xeeba('0x21')]);router[_0xeeba('0x20')]('/:id/canned_answers',auth[_0xeeba('0xb')](),controller[_0xeeba('0x22')]);router['post']('/',auth[_0xeeba('0xb')](),controller[_0xeeba('0x23')]);router[_0xeeba('0x20')](_0xeeba('0x13'),auth[_0xeeba('0xb')](),controller['addImap']);router[_0xeeba('0x20')](_0xeeba('0x15'),auth[_0xeeba('0xb')](),controller[_0xeeba('0x24')]);router[_0xeeba('0x20')](_0xeeba('0x16'),auth['isAuthenticated'](),controller[_0xeeba('0x25')]);router[_0xeeba('0x20')](_0xeeba('0x18'),auth['isAuthenticated'](),controller[_0xeeba('0x26')]);router['post'](_0xeeba('0x27'),auth[_0xeeba('0xb')](),controller[_0xeeba('0x28')]);router['post'](_0xeeba('0x1e'),auth['isAuthenticated'](),controller[_0xeeba('0x29')]);router[_0xeeba('0x2a')](_0xeeba('0xf'),auth['isAuthenticated'](),controller[_0xeeba('0x2b')]);router[_0xeeba('0x2c')](_0xeeba('0x2d'),auth[_0xeeba('0xb')](),controller[_0xeeba('0x2e')]);router[_0xeeba('0x2c')](_0xeeba('0x11'),auth['isAuthenticated'](),controller[_0xeeba('0x2f')]);router[_0xeeba('0x2c')](_0xeeba('0x13'),auth[_0xeeba('0xb')](),controller['removeImap']);router[_0xeeba('0x2c')](_0xeeba('0x15'),auth['isAuthenticated'](),controller[_0xeeba('0x30')]);router[_0xeeba('0x2c')](_0xeeba('0xf'),auth[_0xeeba('0xb')](),controller[_0xeeba('0x31')]);router[_0xeeba('0x2c')](_0xeeba('0x1e'),auth[_0xeeba('0xb')](),controller[_0xeeba('0x32')]);module[_0xeeba('0x33')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index b006b16..abe8950 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 _0xc23a=['mandatoryDisposition','exports','STRING','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue'];(function(_0x5bf25f,_0x22a6aa){var _0x2e2cfb=function(_0x3385f0){while(--_0x3385f0){_0x5bf25f['push'](_0x5bf25f['shift']());}};_0x2e2cfb(++_0x22a6aa);}(_0xc23a,0xd2));var _0xac23=function(_0x503564,_0x55867e){_0x503564=_0x503564-0x0;var _0x4be9fd=_0xc23a[_0x503564];return _0x4be9fd;};'use strict';var Sequelize=require('sequelize');module[_0xac23('0x0')]={'description':{'type':Sequelize[_0xac23('0x1')]},'name':{'type':Sequelize[_0xac23('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xac23('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xac23('0x2')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xac23('0x1')],'allowNull':![],'defaultValue':_0xac23('0x3')},'fontSize':{'type':Sequelize[_0xac23('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xac23('0x5');}},'notificationSound':{'type':Sequelize[_0xac23('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xac23('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xac23('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xac23('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xac23('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xac23('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xac23('0x7'),'set':function(_0x7d1836){if(!_0x7d1836)this['setDataValue'](_0xac23('0x8'),null);this[_0xac23('0x9')](_0xac23('0xa'),_0x7d1836);}}}; \ No newline at end of file +var _0xcb66=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x1b5f5a,_0x3d0419){var _0x562267=function(_0x497168){while(--_0x497168){_0x1b5f5a['push'](_0x1b5f5a['shift']());}};_0x562267(++_0x3d0419);}(_0xcb66,0x19f));var _0x6cb6=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xcb66[_0x12fc8d];return _0x3f9d04;};'use strict';var Sequelize=require('sequelize');module[_0x6cb6('0x0')]={'description':{'type':Sequelize[_0x6cb6('0x1')]},'name':{'type':Sequelize[_0x6cb6('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x6cb6('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x6cb6('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x6cb6('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x6cb6('0x3')]},'markAsUnread':{'type':Sequelize[_0x6cb6('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x6cb6('0x1')],'allowNull':![],'defaultValue':_0x6cb6('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x6cb6('0x3')],'defaultValue':function(){return _0x6cb6('0x5');}},'notificationSound':{'type':Sequelize[_0x6cb6('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6cb6('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6cb6('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6cb6('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6cb6('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6cb6('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6cb6('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6cb6('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x6cb6('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x6cb6('0x2')],'defaultValue':![],'comment':_0x6cb6('0x8'),'set':function(_0x592c78){if(!_0x592c78)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x6cb6('0x9'),_0x592c78);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index bf0e462..268494a 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 _0x55f8=['MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','end','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','merge','options','MailAccount','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','length','body','describe','addDisposition','find','MailAccountId','Disposition','create','getDispositions','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','hasOwnProperty','removeAnswers','ids','email','ListId','isNil','active','description','cservice','cauthentication','user','pass','cpassword','authentication','host','port','service','password','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','getInteractions','MailInteraction','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','priority','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','split','CmList','List','Contacts','updatedAt','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','secure','auth','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','emit','removeAgents','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','crypto','jsforce','querystring','papaparse','juice','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','request','info','debug'];(function(_0x2de753,_0x4a544d){var _0x8e70a5=function(_0x498455){while(--_0x498455){_0x2de753['push'](_0x2de753['shift']());}};_0x8e70a5(++_0x4a544d);}(_0x55f8,0x15b));var _0x855f=function(_0x377eba,_0x381435){_0x377eba=_0x377eba-0x0;var _0x4d707e=_0x55f8[_0x377eba];return _0x4d707e;};'use strict';var emlformat=require(_0x855f('0x0'));var rimraf=require(_0x855f('0x1'));var zipdir=require(_0x855f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x855f('0x3'));var moment=require(_0x855f('0x4'));var BPromise=require(_0x855f('0x5'));var Mustache=require('mustache');var util=require(_0x855f('0x6'));var path=require(_0x855f('0x7'));var sox=require('sox');var csv=require(_0x855f('0x8'));var ejs=require(_0x855f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x855f('0xa'));var jsforce=require(_0x855f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x855f('0x8'));var querystring=require(_0x855f('0xc'));var Papa=require(_0x855f('0xd'));var htmlToText=require('html-to-text');var juice=require(_0x855f('0xe'));var Redis=require('ioredis');var authService=require(_0x855f('0xf'));var qs=require(_0x855f('0x10'));var as=require(_0x855f('0x11'));var hardwareService=require(_0x855f('0x12'));var logger=require(_0x855f('0x13'))(_0x855f('0x14'));var utils=require(_0x855f('0x15'));var config=require(_0x855f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x855f('0x17'))['db'];config[_0x855f('0x18')]=_[_0x855f('0x19')](config[_0x855f('0x18')],{'host':_0x855f('0x1a'),'port':0x18eb});var socket=require(_0x855f('0x1b'))(new Redis(config[_0x855f('0x18')]));require(_0x855f('0x1c'))[_0x855f('0x1d')](socket);var jayson=require(_0x855f('0x1e'));var client=jayson['client'][_0x855f('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x16cf8d,_0x49fdc0,_0xda659d,_0x13b8d1){return new BPromise(function(_0x50ec23,_0x178492){var _0x21828f=_0x13b8d1||client;return _0x21828f[_0x855f('0x20')](_0x16cf8d,_0xda659d)['then'](function(_0x23a5d0){logger[_0x855f('0x21')]('MailAccount,\x20%s,\x20%s',_0x49fdc0,'request\x20sent');logger[_0x855f('0x22')](_0x855f('0x23'),_0x49fdc0,'request\x20sent',JSON['stringify'](_0x23a5d0));if(_0x23a5d0[_0x855f('0x24')]){if(_0x23a5d0[_0x855f('0x24')][_0x855f('0x25')]===0x1f4){logger['error'](_0x855f('0x26'),_0x49fdc0,_0x23a5d0[_0x855f('0x24')]['message']);return _0x178492(_0x23a5d0['error']['message']);}logger[_0x855f('0x24')](_0x855f('0x26'),_0x49fdc0,_0x23a5d0[_0x855f('0x24')]['message']);return _0x50ec23(_0x23a5d0[_0x855f('0x24')]['message']);}else{logger[_0x855f('0x21')]('MailAccount,\x20%s,\x20%s',_0x49fdc0,'request\x20sent');_0x50ec23(_0x23a5d0['result'][_0x855f('0x27')]);}})['catch'](function(_0x3d7c66){logger['error'](_0x855f('0x26'),_0x49fdc0,_0x3d7c66);_0x178492(_0x3d7c66);});});}function respondWithStatusCode(_0x48c8e0,_0x3b8ec6){_0x3b8ec6=_0x3b8ec6||0xcc;return function(_0x551a86){if(_0x551a86){return _0x48c8e0[_0x855f('0x28')](_0x3b8ec6);}return _0x48c8e0[_0x855f('0x29')](_0x3b8ec6)['end']();};}function respondWithResult(_0x4522f2,_0x97deb3){_0x97deb3=_0x97deb3||0xc8;return function(_0x2d0e80){if(_0x2d0e80){return _0x4522f2[_0x855f('0x29')](_0x97deb3)[_0x855f('0x2a')](_0x2d0e80);}};}function respondWithFilteredResult(_0x156049,_0x10f4ee){return function(_0x3d8e10){if(_0x3d8e10){var _0x3759d6=typeof _0x10f4ee[_0x855f('0x2b')]===_0x855f('0x2c')&&typeof _0x10f4ee[_0x855f('0x2d')]===_0x855f('0x2c');var _0x3bc1c2=_0x3d8e10[_0x855f('0x2e')];var _0xcb5730=_0x3759d6?0x0:_0x10f4ee[_0x855f('0x2b')];var _0x4e4595=_0x3759d6?_0x3d8e10['count']:_0x10f4ee[_0x855f('0x2b')]+_0x10f4ee[_0x855f('0x2d')];var _0x4f6616;if(_0x4e4595>=_0x3bc1c2){_0x4e4595=_0x3bc1c2;_0x4f6616=0xc8;}else{_0x4f6616=0xce;}_0x156049['status'](_0x4f6616);return _0x156049['set'](_0x855f('0x2f'),_0xcb5730+'-'+_0x4e4595+'/'+_0x3bc1c2)[_0x855f('0x2a')](_0x3d8e10);}return null;};}function patchUpdates(_0xbe191d){return function(_0x3f7a50){try{jsonpatch[_0x855f('0x30')](_0x3f7a50,_0xbe191d,!![]);}catch(_0x525646){return BPromise[_0x855f('0x31')](_0x525646);}return _0x3f7a50['save']();};}function saveUpdates(_0x2ffad6,_0xbfb59d){return function(_0x2fdda0){if(_0x2fdda0){return _0x2fdda0[_0x855f('0x32')](_0x2ffad6)[_0x855f('0x33')](function(_0xf9b9b1){return _0xf9b9b1;});}return null;};}function removeEntity(_0x3e7a8f,_0x1cded7){return function(_0x183280){if(_0x183280){return _0x183280[_0x855f('0x34')]()['then'](function(){var _0x292718=_0x183280[_0x855f('0x35')]({'plain':!![]});var _0x47bbd1='MailAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x47bbd1,'resourceId':_0x292718['id']}})[_0x855f('0x33')](function(){return _0x183280;});})[_0x855f('0x33')](function(){_0x3e7a8f[_0x855f('0x29')](0xcc)[_0x855f('0x36')]();});}};}function handleEntityNotFound(_0x1487fd,_0x337e21){return function(_0x177895){if(!_0x177895){_0x1487fd[_0x855f('0x28')](0x194);}return _0x177895;};}function handleError(_0x48e3c8,_0x74f78b){_0x74f78b=_0x74f78b||0x1f4;return function(_0x5a47e0){logger[_0x855f('0x24')](_0x5a47e0['stack']);if(_0x5a47e0[_0x855f('0x37')]){delete _0x5a47e0[_0x855f('0x37')];}_0x48e3c8[_0x855f('0x29')](_0x74f78b)[_0x855f('0x38')](_0x5a47e0);};}exports[_0x855f('0x39')]=function(_0x8e9458,_0x54478f){var _0x229340={'include':[{'model':db[_0x855f('0x3a')],'as':_0x855f('0x3b')},{'model':db[_0x855f('0x3c')],'as':_0x855f('0x3d')},{'model':db[_0x855f('0x3e')],'as':'mandatoryDispositionPause'}]},_0x5ba1f3={},_0x38bc01={'count':0x0,'rows':[]};var _0x4f0c67=_[_0x855f('0x3f')](db['MailAccount']['rawAttributes'],function(_0x177360){return{'name':_0x177360[_0x855f('0x40')],'type':_0x177360[_0x855f('0x41')][_0x855f('0x42')]};});_0x5ba1f3[_0x855f('0x43')]=_['map'](_0x4f0c67,'name');_0x5ba1f3[_0x855f('0x44')]=_[_0x855f('0x45')](_0x8e9458[_0x855f('0x44')]);_0x5ba1f3[_0x855f('0x46')]=_['intersection'](_0x5ba1f3[_0x855f('0x43')],_0x5ba1f3[_0x855f('0x44')]);_0x229340[_0x855f('0x47')]=_[_0x855f('0x48')](_0x5ba1f3[_0x855f('0x43')],qs[_0x855f('0x49')](_0x8e9458[_0x855f('0x44')][_0x855f('0x49')]));_0x229340[_0x855f('0x47')]=_0x229340['attributes']['length']?_0x229340[_0x855f('0x47')]:_0x5ba1f3[_0x855f('0x43')];if(!_0x8e9458[_0x855f('0x44')]['hasOwnProperty'](_0x855f('0x4a'))){_0x229340[_0x855f('0x2d')]=qs[_0x855f('0x2d')](_0x8e9458[_0x855f('0x44')][_0x855f('0x2d')]);_0x229340['offset']=qs[_0x855f('0x2b')](_0x8e9458[_0x855f('0x44')][_0x855f('0x2b')]);}_0x229340[_0x855f('0x4b')]=qs[_0x855f('0x4c')](_0x8e9458[_0x855f('0x44')]['sort']);_0x229340['where']=qs[_0x855f('0x46')](_[_0x855f('0x4d')](_0x8e9458[_0x855f('0x44')],_0x5ba1f3['filters']),_0x4f0c67);if(_0x8e9458['query'][_0x855f('0x4e')]){_0x229340[_0x855f('0x4f')]=_[_0x855f('0x50')](_0x229340[_0x855f('0x4f')],{'$or':_['map'](_0x4f0c67,function(_0x27cc14){if(_0x27cc14[_0x855f('0x41')]!=='VIRTUAL'){var _0x6e799e={};_0x6e799e[_0x27cc14[_0x855f('0x37')]]={'$like':'%'+_0x8e9458['query'][_0x855f('0x4e')]+'%'};return _0x6e799e;}})});}_0x229340=_[_0x855f('0x50')]({},_0x229340,_0x8e9458[_0x855f('0x51')]);var _0x3183e4={'where':_0x229340[_0x855f('0x4f')]};return db[_0x855f('0x52')][_0x855f('0x2e')](_0x3183e4)[_0x855f('0x33')](function(_0x346858){_0x38bc01['count']=_0x346858;if(_0x8e9458[_0x855f('0x44')][_0x855f('0x53')]){_0x229340[_0x855f('0x54')]=[{'all':!![]}];}return db[_0x855f('0x52')][_0x855f('0x55')](_0x229340);})['then'](function(_0x59f367){_0x38bc01[_0x855f('0x56')]=_0x59f367;return _0x38bc01;})[_0x855f('0x33')](respondWithFilteredResult(_0x54478f,_0x229340))[_0x855f('0x57')](handleError(_0x54478f,null));};exports[_0x855f('0x58')]=function(_0x2befdf,_0x1a5ca4){var _0xb4e2e={'raw':![],'where':{'id':_0x2befdf[_0x855f('0x59')]['id']},'include':[{'model':db[_0x855f('0x3a')],'as':'Imap'},{'model':db[_0x855f('0x3c')],'as':_0x855f('0x3d')},{'model':db[_0x855f('0x3e')],'as':_0x855f('0x5a')}]},_0x220469={};_0x220469[_0x855f('0x43')]=_[_0x855f('0x45')](db[_0x855f('0x52')][_0x855f('0x5b')]);_0x220469[_0x855f('0x44')]=_[_0x855f('0x45')](_0x2befdf[_0x855f('0x44')]);_0x220469[_0x855f('0x46')]=_[_0x855f('0x48')](_0x220469[_0x855f('0x43')],_0x220469['query']);_0xb4e2e['attributes']=_[_0x855f('0x48')](_0x220469['model'],qs[_0x855f('0x49')](_0x2befdf[_0x855f('0x44')][_0x855f('0x49')]));_0xb4e2e['attributes']=_0xb4e2e['attributes'][_0x855f('0x5c')]?_0xb4e2e[_0x855f('0x47')]:_0x220469[_0x855f('0x43')];if(_0x2befdf['query'][_0x855f('0x53')]){_0xb4e2e[_0x855f('0x54')]=[{'all':!![]}];}_0xb4e2e=_[_0x855f('0x50')]({},_0xb4e2e,_0x2befdf[_0x855f('0x51')]);return db[_0x855f('0x52')]['find'](_0xb4e2e)[_0x855f('0x33')](handleEntityNotFound(_0x1a5ca4,null))['then'](respondWithResult(_0x1a5ca4,null))[_0x855f('0x57')](handleError(_0x1a5ca4,null));};exports[_0x855f('0x32')]=function(_0x54d1cd,_0x5bb6c8){if(_0x54d1cd[_0x855f('0x5d')]['id']){delete _0x54d1cd[_0x855f('0x5d')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x54d1cd[_0x855f('0x59')]['id']},'include':[{'model':db[_0x855f('0x3a')],'as':_0x855f('0x3b')},{'model':db[_0x855f('0x3c')],'as':_0x855f('0x3d')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x855f('0x33')](handleEntityNotFound(_0x5bb6c8,null))[_0x855f('0x33')](saveUpdates(_0x54d1cd[_0x855f('0x5d')],null))[_0x855f('0x33')](function(_0x42cbc4){if(_0x42cbc4&&_0x54d1cd[_0x855f('0x5d')][_0x855f('0x3b')]){return db[_0x855f('0x3a')][_0x855f('0x32')](_0x54d1cd[_0x855f('0x5d')]['Imap'],{'where':{'MailAccountId':_0x42cbc4['id']}})[_0x855f('0x33')](function(){return _0x42cbc4;});}return _0x42cbc4;})['then'](function(_0x5bb04a){if(_0x5bb04a&&_0x54d1cd[_0x855f('0x5d')][_0x855f('0x3d')]){return db[_0x855f('0x3c')][_0x855f('0x32')](_0x54d1cd['body'][_0x855f('0x3d')],{'where':{'MailAccountId':_0x5bb04a['id']}})[_0x855f('0x33')](function(){return _0x5bb04a;});}return _0x5bb04a;})[_0x855f('0x33')](respondWithResult(_0x5bb6c8,null))[_0x855f('0x57')](handleError(_0x5bb6c8,null));};exports[_0x855f('0x5e')]=function(_0xf07b67,_0x23a32b){return db['MailAccount'][_0x855f('0x5e')]()[_0x855f('0x33')](respondWithResult(_0x23a32b,null))[_0x855f('0x57')](handleError(_0x23a32b,null));};exports[_0x855f('0x5f')]=function(_0x196a40,_0x20d7ac,_0x3390a2){if(_0x196a40[_0x855f('0x5d')]['id']){delete _0x196a40[_0x855f('0x5d')]['id'];}return db[_0x855f('0x52')][_0x855f('0x60')]({'where':{'id':_0x196a40[_0x855f('0x59')]['id']}})['then'](handleEntityNotFound(_0x20d7ac,null))[_0x855f('0x33')](function(_0x190c0e){if(_0x190c0e){_0x196a40[_0x855f('0x5d')][_0x855f('0x61')]=_0x190c0e['id'];return db[_0x855f('0x62')][_0x855f('0x63')](_0x196a40[_0x855f('0x5d')]);}})['then'](respondWithResult(_0x20d7ac,null))[_0x855f('0x57')](handleError(_0x20d7ac,null));};exports[_0x855f('0x64')]=function(_0x2a1b9f,_0x46bd70,_0x35f80c){var _0x4a2dd9={'raw':![],'where':{}};var _0x66f806={};var _0xf71b3b={'count':0x0,'rows':[]};return db[_0x855f('0x52')]['findOne']({'where':{'id':_0x2a1b9f[_0x855f('0x59')]['id']}})['then'](handleEntityNotFound(_0x46bd70,null))[_0x855f('0x33')](function(_0x2288ed){if(_0x2288ed){_0x66f806[_0x855f('0x43')]=_['keys'](db[_0x855f('0x62')][_0x855f('0x5b')]);_0x66f806[_0x855f('0x44')]=_[_0x855f('0x45')](_0x2a1b9f[_0x855f('0x44')]);_0x66f806[_0x855f('0x46')]=_['intersection'](_0x66f806[_0x855f('0x43')],_0x66f806[_0x855f('0x44')]);_0x4a2dd9['attributes']=_[_0x855f('0x48')](_0x66f806[_0x855f('0x43')],qs['fields'](_0x2a1b9f[_0x855f('0x44')][_0x855f('0x49')]));_0x4a2dd9[_0x855f('0x47')]=_0x4a2dd9[_0x855f('0x47')][_0x855f('0x5c')]?_0x4a2dd9['attributes']:_0x66f806['model'];if(!_0x2a1b9f[_0x855f('0x44')]['hasOwnProperty']('nolimit')){_0x4a2dd9[_0x855f('0x2d')]=qs['limit'](_0x2a1b9f[_0x855f('0x44')]['limit']);_0x4a2dd9[_0x855f('0x2b')]=qs[_0x855f('0x2b')](_0x2a1b9f[_0x855f('0x44')]['offset']);}_0x4a2dd9[_0x855f('0x4b')]=qs[_0x855f('0x4c')](_0x2a1b9f[_0x855f('0x44')][_0x855f('0x4c')]);_0x4a2dd9['where']=qs[_0x855f('0x46')](_[_0x855f('0x4d')](_0x2a1b9f[_0x855f('0x44')],_0x66f806[_0x855f('0x46')]));_0x4a2dd9['where']['MailAccountId']=_0x2288ed['id'];if(_0x2a1b9f[_0x855f('0x44')]['filter']){_0x4a2dd9[_0x855f('0x4f')]=_[_0x855f('0x50')](_0x4a2dd9[_0x855f('0x4f')],{'$or':_[_0x855f('0x3f')](_0x4a2dd9[_0x855f('0x47')],function(_0x49ba07){var _0x1f15d4={};_0x1f15d4[_0x49ba07]={'$like':'%'+_0x2a1b9f[_0x855f('0x44')][_0x855f('0x4e')]+'%'};return _0x1f15d4;})});}_0x4a2dd9=_[_0x855f('0x50')]({},_0x4a2dd9,_0x2a1b9f['options']);return db['Disposition'][_0x855f('0x2e')]({'where':_0x4a2dd9[_0x855f('0x4f')]})[_0x855f('0x33')](function(_0x5600af){_0xf71b3b['count']=_0x5600af;if(_0x2a1b9f[_0x855f('0x44')][_0x855f('0x53')]){_0x4a2dd9[_0x855f('0x54')]=[{'all':!![]}];}return db[_0x855f('0x62')][_0x855f('0x55')](_0x4a2dd9);})['then'](function(_0x18a37f){_0xf71b3b[_0x855f('0x56')]=_0x18a37f;return _0xf71b3b;});}})[_0x855f('0x33')](respondWithFilteredResult(_0x46bd70,_0x4a2dd9))[_0x855f('0x57')](handleError(_0x46bd70,null));};exports[_0x855f('0x65')]=function(_0x127880,_0x17d727,_0x5c2f82){return db['MailAccount']['find']({'where':{'id':_0x127880[_0x855f('0x59')]['id']}})[_0x855f('0x33')](handleEntityNotFound(_0x17d727,null))[_0x855f('0x33')](function(_0x5ece52){if(_0x5ece52){return _0x5ece52[_0x855f('0x65')](_0x127880[_0x855f('0x44')]['ids']);}})[_0x855f('0x33')](respondWithStatusCode(_0x17d727,null))[_0x855f('0x57')](handleError(_0x17d727,null));};exports[_0x855f('0x66')]=function(_0x1db95d,_0x27019d,_0x36ecd5){if(_0x1db95d[_0x855f('0x5d')]['id']){delete _0x1db95d[_0x855f('0x5d')]['id'];}return db[_0x855f('0x52')][_0x855f('0x60')]({'where':{'id':_0x1db95d['params']['id']}})[_0x855f('0x33')](handleEntityNotFound(_0x27019d,null))['then'](function(_0x350ec9){if(_0x350ec9){_0x1db95d[_0x855f('0x5d')][_0x855f('0x61')]=_0x350ec9['id'];return db[_0x855f('0x67')][_0x855f('0x63')](_0x1db95d[_0x855f('0x5d')]);}})[_0x855f('0x33')](respondWithResult(_0x27019d,null))[_0x855f('0x57')](handleError(_0x27019d,null));};exports[_0x855f('0x68')]=function(_0x55b874,_0x2ff48d,_0x1b5b37){var _0x4ad0be={'raw':![],'where':{}};var _0xdfc4c9={};var _0x40ff9f={'count':0x0,'rows':[]};return db[_0x855f('0x52')][_0x855f('0x69')]({'where':{'id':_0x55b874[_0x855f('0x59')]['id']}})[_0x855f('0x33')](handleEntityNotFound(_0x2ff48d,null))[_0x855f('0x33')](function(_0x36705a){if(_0x36705a){_0xdfc4c9[_0x855f('0x43')]=_['keys'](db[_0x855f('0x67')][_0x855f('0x5b')]);_0xdfc4c9[_0x855f('0x44')]=_[_0x855f('0x45')](_0x55b874[_0x855f('0x44')]);_0xdfc4c9['filters']=_[_0x855f('0x48')](_0xdfc4c9['model'],_0xdfc4c9['query']);_0x4ad0be[_0x855f('0x47')]=_[_0x855f('0x48')](_0xdfc4c9['model'],qs[_0x855f('0x49')](_0x55b874[_0x855f('0x44')]['fields']));_0x4ad0be[_0x855f('0x47')]=_0x4ad0be[_0x855f('0x47')]['length']?_0x4ad0be['attributes']:_0xdfc4c9[_0x855f('0x43')];if(!_0x55b874['query'][_0x855f('0x6a')]('nolimit')){_0x4ad0be['limit']=qs['limit'](_0x55b874[_0x855f('0x44')][_0x855f('0x2d')]);_0x4ad0be[_0x855f('0x2b')]=qs[_0x855f('0x2b')](_0x55b874[_0x855f('0x44')][_0x855f('0x2b')]);}_0x4ad0be[_0x855f('0x4b')]=qs['sort'](_0x55b874[_0x855f('0x44')][_0x855f('0x4c')]);_0x4ad0be[_0x855f('0x4f')]=qs[_0x855f('0x46')](_[_0x855f('0x4d')](_0x55b874[_0x855f('0x44')],_0xdfc4c9[_0x855f('0x46')]));_0x4ad0be[_0x855f('0x4f')]['MailAccountId']=_0x36705a['id'];if(_0x55b874[_0x855f('0x44')][_0x855f('0x4e')]){_0x4ad0be[_0x855f('0x4f')]=_[_0x855f('0x50')](_0x4ad0be[_0x855f('0x4f')],{'$or':_[_0x855f('0x3f')](_0x4ad0be[_0x855f('0x47')],function(_0x4e3007){var _0x458760={};_0x458760[_0x4e3007]={'$like':'%'+_0x55b874[_0x855f('0x44')][_0x855f('0x4e')]+'%'};return _0x458760;})});}_0x4ad0be=_['merge']({},_0x4ad0be,_0x55b874[_0x855f('0x51')]);return db[_0x855f('0x67')]['count']({'where':_0x4ad0be['where']})['then'](function(_0x2dcf60){_0x40ff9f[_0x855f('0x2e')]=_0x2dcf60;if(_0x55b874[_0x855f('0x44')][_0x855f('0x53')]){_0x4ad0be[_0x855f('0x54')]=[{'all':!![]}];}return db[_0x855f('0x67')][_0x855f('0x55')](_0x4ad0be);})[_0x855f('0x33')](function(_0x184ba5){_0x40ff9f[_0x855f('0x56')]=_0x184ba5;return _0x40ff9f;});}})[_0x855f('0x33')](respondWithFilteredResult(_0x2ff48d,_0x4ad0be))[_0x855f('0x57')](handleError(_0x2ff48d,null));};exports[_0x855f('0x6b')]=function(_0x2294ff,_0x203a19,_0x1d5a91){return db[_0x855f('0x52')][_0x855f('0x60')]({'where':{'id':_0x2294ff[_0x855f('0x59')]['id']}})[_0x855f('0x33')](handleEntityNotFound(_0x203a19,null))[_0x855f('0x33')](function(_0x4924af){if(_0x4924af){return _0x4924af[_0x855f('0x6b')](_0x2294ff['query'][_0x855f('0x6c')]);}})[_0x855f('0x33')](respondWithStatusCode(_0x203a19,null))[_0x855f('0x57')](handleError(_0x203a19,null));};exports[_0x855f('0x63')]=function(_0x4c2dcd,_0x159088){var _0xa27e90={'name':_0x4c2dcd[_0x855f('0x5d')]['name'],'key':_0x4c2dcd[_0x855f('0x5d')]['key'],'email':_0x4c2dcd[_0x855f('0x5d')][_0x855f('0x6d')],'ListId':_0x4c2dcd[_0x855f('0x5d')][_0x855f('0x6e')],'active':!_[_0x855f('0x6f')](_0x4c2dcd[_0x855f('0x5d')]['active'])?_0x4c2dcd[_0x855f('0x5d')][_0x855f('0x70')]:!![],'description':_0x4c2dcd[_0x855f('0x5d')][_0x855f('0x71')]||null,'Imap':{},'Smtp':{}};if(_[_0x855f('0x6f')](_0x4c2dcd[_0x855f('0x5d')][_0x855f('0x72')])){if(_0x4c2dcd[_0x855f('0x5d')][_0x855f('0x73')]){_0xa27e90[_0x855f('0x3b')][_0x855f('0x74')]=_0xa27e90[_0x855f('0x3d')][_0x855f('0x74')]=_0x4c2dcd[_0x855f('0x5d')]['cuser'];_0xa27e90[_0x855f('0x3b')]['password']=_0xa27e90[_0x855f('0x3d')][_0x855f('0x75')]=_0x4c2dcd[_0x855f('0x5d')][_0x855f('0x76')];}else{_0xa27e90['Imap'][_0x855f('0x77')]=_0xa27e90[_0x855f('0x3d')][_0x855f('0x77')]=![];}_0xa27e90[_0x855f('0x3b')]['host']=_0x4c2dcd[_0x855f('0x5d')]['Imap'][_0x855f('0x78')];_0xa27e90[_0x855f('0x3b')][_0x855f('0x79')]=_0x4c2dcd[_0x855f('0x5d')][_0x855f('0x3b')]['port'];_0xa27e90[_0x855f('0x3d')][_0x855f('0x78')]=_0x4c2dcd[_0x855f('0x5d')]['Smtp'][_0x855f('0x78')];_0xa27e90[_0x855f('0x3d')][_0x855f('0x79')]=_0x4c2dcd[_0x855f('0x5d')][_0x855f('0x3d')][_0x855f('0x79')];}else{_0xa27e90['Imap'][_0x855f('0x7a')]=_0xa27e90[_0x855f('0x3d')][_0x855f('0x7a')]=_0x4c2dcd['body']['cservice'];_0xa27e90[_0x855f('0x3b')]['user']=_0xa27e90[_0x855f('0x3d')][_0x855f('0x74')]=_0x4c2dcd[_0x855f('0x5d')]['cuser'];_0xa27e90[_0x855f('0x3b')][_0x855f('0x7b')]=_0xa27e90['Smtp']['pass']=_0x4c2dcd[_0x855f('0x5d')]['cpassword'];}return db[_0x855f('0x52')][_0x855f('0x63')](_0xa27e90,{'include':[{'model':db[_0x855f('0x3c')],'as':_0x855f('0x3d')},{'model':db[_0x855f('0x3a')],'as':_0x855f('0x3b')}]})[_0x855f('0x33')](function(_0xab3d60){var _0x457a08=_0x4c2dcd[_0x855f('0x74')][_0x855f('0x35')]({'plain':!![]});if(!_0x457a08)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x457a08[_0x855f('0x7c')]===_0x855f('0x74')){var _0x529d2a=_0xab3d60['get']({'plain':!![]});return db[_0x855f('0x7d')][_0x855f('0x60')]({'where':{'name':'MailAccounts','userProfileId':_0x457a08[_0x855f('0x7e')]},'raw':!![]})['then'](function(_0x263e13){if(_0x263e13&&_0x263e13['autoAssociation']===0x0){return db['UserProfileResource'][_0x855f('0x63')]({'name':_0x529d2a[_0x855f('0x37')],'resourceId':_0x529d2a['id'],'type':_0x263e13[_0x855f('0x37')],'sectionId':_0x263e13['id']},{})[_0x855f('0x33')](function(){return _0xab3d60;});}else{return _0xab3d60;}})[_0x855f('0x57')](function(_0x125cef){logger[_0x855f('0x24')](_0x855f('0x7f'),_0x125cef);throw _0x125cef;});}return _0xab3d60;})[_0x855f('0x33')](respondWithResult(_0x159088,0xc9))[_0x855f('0x57')](handleError(_0x159088,null));};exports['getImap']=function(_0x1ea38a,_0x16072c,_0x2a8c65){return db['MailAccount']['findOne']({'where':{'id':_0x1ea38a[_0x855f('0x59')]['id']}})[_0x855f('0x33')](handleEntityNotFound(_0x16072c,null))[_0x855f('0x33')](function(_0x30ba4c){if(_0x30ba4c){return _0x30ba4c['getImap']();}return null;})[_0x855f('0x33')](respondWithResult(_0x16072c,null))[_0x855f('0x57')](handleError(_0x16072c,null));};exports[_0x855f('0x80')]=function(_0x3f370e,_0x19bb75,_0x1c577f){if(_0x3f370e[_0x855f('0x5d')]['id']){delete _0x3f370e['body']['id'];}return db[_0x855f('0x52')][_0x855f('0x60')]({'where':{'id':_0x3f370e[_0x855f('0x59')]['id']}})[_0x855f('0x33')](handleEntityNotFound(_0x19bb75,null))[_0x855f('0x33')](function(_0x30e515){if(_0x30e515){_0x3f370e[_0x855f('0x5d')][_0x855f('0x61')]=_0x30e515['id'];return db[_0x855f('0x3a')]['create'](_0x3f370e[_0x855f('0x5d')]);}})[_0x855f('0x33')](respondWithResult(_0x19bb75,null))[_0x855f('0x57')](handleError(_0x19bb75,null));};exports['removeImap']=function(_0x1f9557,_0x678453,_0x19b14c){return db['MailAccount']['findOne']({'where':{'id':_0x1f9557[_0x855f('0x59')]['id']}})[_0x855f('0x33')](handleEntityNotFound(_0x678453,null))[_0x855f('0x33')](function(_0x5bc1bb){if(_0x5bc1bb){return _0x5bc1bb[_0x855f('0x81')](null);}return null;})['then'](respondWithStatusCode(_0x678453,null))[_0x855f('0x57')](handleError(_0x678453,null));};exports[_0x855f('0x82')]=function(_0x5febf6,_0x448ee6,_0x4588cc){return db[_0x855f('0x52')][_0x855f('0x69')]({'where':{'id':_0x5febf6[_0x855f('0x59')]['id']}})['then'](handleEntityNotFound(_0x448ee6,null))[_0x855f('0x33')](function(_0x2b6c7a){if(_0x2b6c7a){return _0x2b6c7a[_0x855f('0x82')]();}return null;})[_0x855f('0x33')](respondWithResult(_0x448ee6,null))[_0x855f('0x57')](handleError(_0x448ee6,null));};exports[_0x855f('0x83')]=function(_0x185ac3,_0x44142a,_0x3fe851){if(_0x185ac3[_0x855f('0x5d')]['id']){delete _0x185ac3[_0x855f('0x5d')]['id'];}return db['MailAccount'][_0x855f('0x60')]({'where':{'id':_0x185ac3[_0x855f('0x59')]['id']}})[_0x855f('0x33')](handleEntityNotFound(_0x44142a,null))[_0x855f('0x33')](function(_0x57d033){if(_0x57d033){_0x185ac3[_0x855f('0x5d')]['MailAccountId']=_0x57d033['id'];return db[_0x855f('0x3c')][_0x855f('0x63')](_0x185ac3['body']);}})[_0x855f('0x33')](respondWithResult(_0x44142a,null))['catch'](handleError(_0x44142a,null));};exports['removeSmtp']=function(_0x3bc8aa,_0x21e32e,_0x2b4e9b){return db[_0x855f('0x52')][_0x855f('0x69')]({'where':{'id':_0x3bc8aa['params']['id']}})['then'](handleEntityNotFound(_0x21e32e,null))['then'](function(_0x37bed0){if(_0x37bed0){return _0x37bed0[_0x855f('0x84')](null);}return null;})[_0x855f('0x33')](respondWithStatusCode(_0x21e32e,null))[_0x855f('0x57')](handleError(_0x21e32e,null));};exports[_0x855f('0x85')]=function(_0x1ca913,_0x103435,_0x4c4c04){return db['MailInteraction'][_0x855f('0x60')]({'where':{'id':_0x1ca913[_0x855f('0x59')]['id']}})[_0x855f('0x33')](handleEntityNotFound(_0x103435,null))[_0x855f('0x33')](function(_0x341f8c){if(_0x341f8c){return _0x341f8c[_0x855f('0x85')](_0x1ca913['body']['ids'],_['omit'](_0x1ca913[_0x855f('0x5d')],[_0x855f('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x103435,null))['catch'](handleError(_0x103435,null));};exports[_0x855f('0x86')]=function(_0x1aa6bb,_0x6573ab,_0x176ea2){var _0x2c3ae7={'raw':![],'where':{}};var _0x263be8={};var _0x51a19a={'count':0x0,'rows':[]};return db[_0x855f('0x52')][_0x855f('0x69')]({'where':{'id':_0x1aa6bb[_0x855f('0x59')]['id']}})[_0x855f('0x33')](handleEntityNotFound(_0x6573ab,null))[_0x855f('0x33')](function(_0x233c5a){if(_0x233c5a){_0x263be8[_0x855f('0x43')]=_['keys'](db[_0x855f('0x87')][_0x855f('0x5b')]);_0x263be8[_0x855f('0x44')]=_['keys'](_0x1aa6bb['query']);_0x263be8['filters']=_['intersection'](_0x263be8['model'],_0x263be8[_0x855f('0x44')]);_0x2c3ae7['attributes']=_[_0x855f('0x48')](_0x263be8[_0x855f('0x43')],qs[_0x855f('0x49')](_0x1aa6bb[_0x855f('0x44')][_0x855f('0x49')]));_0x2c3ae7[_0x855f('0x47')]=_0x2c3ae7[_0x855f('0x47')][_0x855f('0x5c')]?_0x2c3ae7[_0x855f('0x47')]:_0x263be8[_0x855f('0x43')];if(!_0x1aa6bb[_0x855f('0x44')]['hasOwnProperty'](_0x855f('0x4a'))){_0x2c3ae7[_0x855f('0x2d')]=qs['limit'](_0x1aa6bb[_0x855f('0x44')]['limit']);_0x2c3ae7[_0x855f('0x2b')]=qs[_0x855f('0x2b')](_0x1aa6bb[_0x855f('0x44')]['offset']);}_0x2c3ae7[_0x855f('0x4b')]=qs[_0x855f('0x4c')](_0x1aa6bb[_0x855f('0x44')]['sort']);_0x2c3ae7[_0x855f('0x4f')]=qs[_0x855f('0x46')](_[_0x855f('0x4d')](_0x1aa6bb[_0x855f('0x44')],_0x263be8['filters']));_0x2c3ae7[_0x855f('0x4f')]['MailAccountId']=_0x233c5a['id'];if(_0x1aa6bb[_0x855f('0x44')][_0x855f('0x4e')]){_0x2c3ae7[_0x855f('0x4f')]=_[_0x855f('0x50')](_0x2c3ae7[_0x855f('0x4f')],{'$or':_[_0x855f('0x3f')](_0x2c3ae7[_0x855f('0x47')],function(_0x5dd575){var _0x44df43={};_0x44df43[_0x5dd575]={'$like':'%'+_0x1aa6bb[_0x855f('0x44')][_0x855f('0x4e')]+'%'};return _0x44df43;})});}_0x2c3ae7=_[_0x855f('0x50')]({},_0x2c3ae7,_0x1aa6bb[_0x855f('0x51')]);return db[_0x855f('0x87')][_0x855f('0x2e')]({'where':_0x2c3ae7[_0x855f('0x4f')]})['then'](function(_0x296611){_0x51a19a['count']=_0x296611;if(_0x1aa6bb[_0x855f('0x44')][_0x855f('0x53')]){_0x2c3ae7[_0x855f('0x54')]=[{'model':db[_0x855f('0x88')],'as':_0x855f('0x89'),'required':![]},{'model':db[_0x855f('0x8a')],'as':'Owner','attributes':['name',_0x855f('0x8b'),_0x855f('0x8c')],'required':![]},{'model':db[_0x855f('0x8d')],'as':_0x855f('0x8e'),'attributes':['id',_0x855f('0x37'),_0x855f('0x8f')],'where':_0x1aa6bb[_0x855f('0x44')]['tag']?{'id':_0x1aa6bb['query'][_0x855f('0x90')]}:undefined,'required':_0x1aa6bb[_0x855f('0x44')][_0x855f('0x90')]?!![]:![]}];}return db[_0x855f('0x87')][_0x855f('0x55')](_0x2c3ae7);})[_0x855f('0x33')](function(_0x2f8f60){_0x51a19a['rows']=_0x2f8f60;return _0x51a19a;});}})['then'](respondWithFilteredResult(_0x6573ab,_0x2c3ae7))[_0x855f('0x57')](handleError(_0x6573ab,null));};exports[_0x855f('0x91')]=function(_0x4106dd,_0x24b86a,_0xf0a2ad){return db[_0x855f('0x52')]['findOne']({'where':{'id':_0x4106dd[_0x855f('0x59')]['id']}})['then'](handleEntityNotFound(_0x24b86a,null))[_0x855f('0x33')](function(_0x15175d){if(_0x15175d){return db[_0x855f('0x92')][_0x855f('0x93')](function(_0x205647){return db['MailApplication'][_0x855f('0x34')]({'where':{'MailAccountId':_0x4106dd[_0x855f('0x59')]['id']},'transaction':_0x205647})[_0x855f('0x33')](function(_0x301f63){var _0x4f287a=_[_0x855f('0x3f')](_0x4106dd[_0x855f('0x5d')],function(_0x524886){_0x524886['MailAccountId']=_0x4106dd['params']['id'];return _0x524886;});return db[_0x855f('0x94')][_0x855f('0x95')](_0x4f287a,{'transaction':_0x205647});});})['then'](function(){return db[_0x855f('0x94')]['findAndCountAll']({'where':{'MailAccountId':_0x4106dd[_0x855f('0x59')]['id']},'order':_0x855f('0x96')});});}})[_0x855f('0x33')](respondWithResult(_0x24b86a,null))[_0x855f('0x57')](handleError(_0x24b86a,null));};exports[_0x855f('0x97')]=function(_0x366c61,_0x1b8116,_0x30a669){var _0x556aa3={};var _0x5e204b={};var _0x5a2e51;var _0x46c757;return db[_0x855f('0x52')][_0x855f('0x69')]({'where':{'id':_0x366c61[_0x855f('0x59')]['id']}})[_0x855f('0x33')](handleEntityNotFound(_0x1b8116,null))[_0x855f('0x33')](function(_0x1869cc){if(_0x1869cc){_0x5a2e51=_0x1869cc;_0x5e204b[_0x855f('0x43')]=_[_0x855f('0x45')](db[_0x855f('0x94')][_0x855f('0x5b')]);_0x5e204b[_0x855f('0x44')]=_['keys'](_0x366c61['query']);_0x5e204b[_0x855f('0x46')]=_[_0x855f('0x48')](_0x5e204b[_0x855f('0x43')],_0x5e204b[_0x855f('0x44')]);_0x556aa3[_0x855f('0x47')]=_[_0x855f('0x48')](_0x5e204b[_0x855f('0x43')],qs[_0x855f('0x49')](_0x366c61['query'][_0x855f('0x49')]));_0x556aa3[_0x855f('0x47')]=_0x556aa3['attributes'][_0x855f('0x5c')]?_0x556aa3[_0x855f('0x47')]:_0x5e204b[_0x855f('0x43')];_0x556aa3[_0x855f('0x4b')]=qs['sort'](_0x366c61[_0x855f('0x44')][_0x855f('0x4c')]);_0x556aa3[_0x855f('0x4f')]=qs['filters'](_['pick'](_0x366c61['query'],_0x5e204b[_0x855f('0x46')]));if(_0x366c61['query'][_0x855f('0x4e')]){_0x556aa3['where']=_['merge'](_0x556aa3['where'],{'$or':_[_0x855f('0x3f')](_0x556aa3[_0x855f('0x47')],function(_0x4b9a4e){var _0x40c8ac={};_0x40c8ac[_0x4b9a4e]={'$like':'%'+_0x366c61[_0x855f('0x44')][_0x855f('0x4e')]+'%'};return _0x40c8ac;})});}_0x556aa3=_['merge']({},_0x556aa3,_0x366c61[_0x855f('0x51')]);return _0x5a2e51['getApplications'](_0x556aa3);}})[_0x855f('0x33')](function(_0x271050){if(_0x271050){_0x46c757=_0x271050['length'];if(!_0x366c61[_0x855f('0x44')]['hasOwnProperty'](_0x855f('0x4a'))){_0x556aa3[_0x855f('0x2d')]=qs[_0x855f('0x2d')](_0x366c61[_0x855f('0x44')][_0x855f('0x2d')]);_0x556aa3[_0x855f('0x2b')]=qs[_0x855f('0x2b')](_0x366c61['query'][_0x855f('0x2b')]);}return _0x5a2e51[_0x855f('0x97')](_0x556aa3);}})[_0x855f('0x33')](function(_0x375123){if(_0x375123){return _0x375123?{'count':_0x46c757,'rows':_0x375123}:null;}})[_0x855f('0x33')](respondWithResult(_0x1b8116,null))[_0x855f('0x57')](handleError(_0x1b8116,null));};exports[_0x855f('0x98')]=function(_0x5d9c51,_0x5767e0,_0xefcd90){var _0x53fb71={'raw':!![],'where':{}};var _0x1f88d1={};var _0x56a4d6={'count':0x0,'rows':[]};return db[_0x855f('0x52')][_0x855f('0x69')]({'where':{'id':_0x5d9c51['params']['id']}})['then'](handleEntityNotFound(_0x5767e0,null))['then'](function(_0x4b5122){if(_0x4b5122){_0x1f88d1[_0x855f('0x43')]=_['keys'](db[_0x855f('0x99')][_0x855f('0x5b')]);_0x1f88d1[_0x855f('0x44')]=_[_0x855f('0x45')](_0x5d9c51[_0x855f('0x44')]);_0x1f88d1[_0x855f('0x46')]=_[_0x855f('0x48')](_0x1f88d1[_0x855f('0x43')],_0x1f88d1['query']);_0x53fb71[_0x855f('0x47')]=_[_0x855f('0x48')](_0x1f88d1[_0x855f('0x43')],qs[_0x855f('0x49')](_0x5d9c51[_0x855f('0x44')]['fields']));_0x53fb71[_0x855f('0x47')]=_0x53fb71[_0x855f('0x47')][_0x855f('0x5c')]?_0x53fb71['attributes']:_0x1f88d1[_0x855f('0x43')];if(!_0x5d9c51['query'][_0x855f('0x6a')]('nolimit')){_0x53fb71['limit']=qs['limit'](_0x5d9c51[_0x855f('0x44')][_0x855f('0x2d')]);_0x53fb71[_0x855f('0x2b')]=qs['offset'](_0x5d9c51[_0x855f('0x44')][_0x855f('0x2b')]);}_0x53fb71[_0x855f('0x4b')]=qs[_0x855f('0x4c')](_0x5d9c51[_0x855f('0x44')][_0x855f('0x4c')]);_0x53fb71['where']=qs[_0x855f('0x46')](_[_0x855f('0x4d')](_0x5d9c51[_0x855f('0x44')],_0x1f88d1[_0x855f('0x46')]));_0x53fb71[_0x855f('0x4f')][_0x855f('0x61')]=_0x4b5122['id'];if(_0x5d9c51[_0x855f('0x44')]['filter']){_0x53fb71[_0x855f('0x4f')]=_[_0x855f('0x50')](_0x53fb71['where'],{'$or':_['map'](_0x53fb71['attributes'],function(_0x125497){var _0x53fb29={};_0x53fb29[_0x125497]={'$like':'%'+_0x5d9c51[_0x855f('0x44')]['filter']+'%'};return _0x53fb29;})});}if(_0x5d9c51[_0x855f('0x44')][_0x855f('0x9a')]){var _0x3c60ec=_0x5d9c51[_0x855f('0x44')][_0x855f('0x9a')]['split'](',');var _0x2971f4={};_0x2971f4[_0x3c60ec[0x0]]={'$gte':moment(_0x3c60ec[0x1])[_0x855f('0x9b')](_0x855f('0x9c'))};_0x53fb71[_0x855f('0x4f')]=_[_0x855f('0x50')](_0x53fb71[_0x855f('0x4f')],_0x2971f4);}_0x53fb71=_[_0x855f('0x50')]({},_0x53fb71,_0x5d9c51[_0x855f('0x51')]);return db['MailMessage'][_0x855f('0x2e')]({'where':_0x53fb71['where']})[_0x855f('0x33')](function(_0x374048){_0x56a4d6[_0x855f('0x2e')]=_0x374048;if(_0x5d9c51['query'][_0x855f('0x53')]){_0x53fb71['include']=[{'all':!![]}];}return db[_0x855f('0x99')][_0x855f('0x55')](_0x53fb71);})['then'](function(_0x20704f){if(_0x5d9c51['query'][_0x855f('0x9d')]==='true'){for(var _0x2744a6=0x0;_0x2744a6<_0x20704f[_0x855f('0x5c')];_0x2744a6++){_0x20704f[_0x2744a6][_0x855f('0x5d')]=juice(_0x20704f[_0x2744a6][_0x855f('0x5d')]);}}_0x56a4d6['rows']=_0x20704f;return _0x56a4d6;});}})[_0x855f('0x33')](respondWithFilteredResult(_0x5767e0,_0x53fb71))['catch'](handleError(_0x5767e0,null));};exports[_0x855f('0x38')]=function(_0x3dee07,_0x3b4302,_0x4acb36){var _0x29f680,_0x35fed4={},_0x5661ee;if(_0x3dee07[_0x855f('0x5d')]['to']){_0x5661ee=_0x3dee07['body']['to'][_0x855f('0x9e')](',')[0x0];}return db[_0x855f('0x52')]['find']({'where':{'id':_0x3dee07[_0x855f('0x59')]['id']},'include':[{'model':db[_0x855f('0x9f')],'as':_0x855f('0xa0'),'include':[{'model':db[_0x855f('0x88')],'as':_0x855f('0xa1'),'where':{'email':_0x5661ee},'limit':0x1,'order':[[_0x855f('0xa2'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x855f('0x3d'),'raw':!![]}]})[_0x855f('0x33')](handleEntityNotFound(_0x3b4302,null))['then'](function(_0x33721e){if(_0x33721e){_0x29f680=_0x33721e;if(_0x33721e[_0x855f('0x3d')]){if(_['isNil'](_0x3dee07['body'][_0x855f('0xa3')])){_0x3dee07[_0x855f('0x5d')][_0x855f('0xa3')]=util['format'](_0x855f('0xa4'),_0x33721e[_0x855f('0x37')],_0x33721e[_0x855f('0x6d')]||_0x33721e[_0x855f('0x3d')][_0x855f('0x74')]);}if(_0x3dee07[_0x855f('0x5d')][_0x855f('0xa5')]&&_0x3dee07[_0x855f('0x5d')]['attachments'][_0x855f('0x5c')]){for(var _0xa062cc=0x0;_0xa062cc<_0x3dee07[_0x855f('0x5d')][_0x855f('0xa5')]['length'];_0xa062cc+=0x1){_0x3dee07[_0x855f('0x5d')][_0x855f('0xa5')][_0xa062cc]={'filename':_0x3dee07[_0x855f('0x5d')][_0x855f('0xa5')][_0xa062cc]['name'],'path':path[_0x855f('0xa6')](config[_0x855f('0xa7')],_0x855f('0xa8'),_0x3dee07['body']['attachments'][_0xa062cc][_0x855f('0xa9')])};}}var _0x3f5ca5={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x33721e[_0x855f('0x3d')]['service'])){if(_0x33721e[_0x855f('0x3d')][_0x855f('0x77')]){_0x3f5ca5['auth']={'user':_0x33721e['Smtp'][_0x855f('0x74')],'pass':_0x33721e[_0x855f('0x3d')][_0x855f('0x75')]};}_0x3f5ca5['host']=_0x33721e[_0x855f('0x3d')]['host'];_0x3f5ca5['port']=_0x33721e[_0x855f('0x3d')][_0x855f('0x79')];_0x3f5ca5[_0x855f('0xaa')]=_0x33721e[_0x855f('0x3d')][_0x855f('0xaa')];}else{_0x3f5ca5['service']=_0x33721e[_0x855f('0x3d')][_0x855f('0x7a')];_0x3f5ca5[_0x855f('0xab')]={'user':_0x33721e[_0x855f('0x3d')]['user'],'pass':_0x33721e[_0x855f('0x3d')][_0x855f('0x75')]};}return respondWithRpcPromise(_0x855f('0xac'),_0x855f('0xad'),{'account':_0x3f5ca5,'message':_0x3dee07[_0x855f('0x5d')]});}else{throw new Error(_0x855f('0xae'));}}})[_0x855f('0x33')](function(_0x4efec2){if(_0x4efec2){_0x35fed4=_0x4efec2;if(_0x29f680[_0x855f('0xa0')]){if(_0x29f680[_0x855f('0xa0')][_0x855f('0xa1')][_0x855f('0x5c')]){return _0x29f680[_0x855f('0xa0')][_0x855f('0xa1')][0x0];}else{return db[_0x855f('0x88')][_0x855f('0x63')](_[_0x855f('0x19')](_0x3dee07[_0x855f('0x5d')],{'firstName':_0x3dee07[_0x855f('0x5d')]['to'],'email':_0x3dee07[_0x855f('0x5d')]['to'],'phone':_0x3dee07['body']['to'],'ListId':_0x29f680['ListId']}));}}else{throw new Error(_0x855f('0xae'));}}})[_0x855f('0x33')](function(_0x561902){if(_0x561902){var _0x387e0e={'UserId':_0x3dee07['user']['id'],'ContactId':_0x561902['id'],'MailAccountId':_0x29f680['id'],'inReplyTo':_0x35fed4[_0x855f('0xaf')],'to':_0x3dee07['body'][_0x855f('0xa3')],'cc':_0x3dee07['body']['cc'],'subject':_0x3dee07['body'][_0x855f('0xb0')],'attach':_0x3dee07[_0x855f('0x5d')][_0x855f('0xb1')],'firstMsgDirection':_0x855f('0xb2'),'lastMsgAt':moment()[_0x855f('0x9b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x855f('0xb2'),'Messages':[_[_0x855f('0x50')](_0x3dee07[_0x855f('0x5d')],{'messageId':_0x35fed4[_0x855f('0xaf')],'sentAt':moment()[_0x855f('0x9b')](_0x855f('0x9c')),'read':!![],'MailAccountId':_0x29f680['id'],'UserId':_0x3dee07[_0x855f('0x74')]['id'],'ContactId':_0x561902['id']})]};if(_0x3dee07['body'][_0x855f('0xb3')]){_0x387e0e=_[_0x855f('0x50')](_0x387e0e,_0x3dee07[_0x855f('0x5d')]['Interaction']);}return db[_0x855f('0x87')][_0x855f('0x63')](_0x387e0e,{'include':[{'model':db[_0x855f('0x99')],'as':'Messages'}]});}})[_0x855f('0x33')](respondWithResult(_0x3b4302,null))['catch'](handleError(_0x3b4302,null));};exports['verifySmtp']=function(_0x335594,_0x681e57,_0x27c78f){return db[_0x855f('0x52')][_0x855f('0x60')]({'where':{'id':_0x335594[_0x855f('0x59')]['id']},'include':[{'model':db[_0x855f('0x3c')],'as':_0x855f('0x3d'),'raw':!![]}]})[_0x855f('0x33')](handleEntityNotFound(_0x681e57,null))['then'](function(_0x2b73df){if(_0x2b73df&&_0x2b73df[_0x855f('0x3d')]){var _0x489cd9={'id':_0x2b73df['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2b73df[_0x855f('0x3d')][_0x855f('0x7a')]){_0x489cd9[_0x855f('0x7a')]=_0x2b73df[_0x855f('0x3d')][_0x855f('0x7a')];}else{_0x489cd9[_0x855f('0x78')]=_0x2b73df[_0x855f('0x3d')][_0x855f('0x78')];_0x489cd9['port']=_0x2b73df[_0x855f('0x3d')]['port'];_0x489cd9['secure']=_0x2b73df[_0x855f('0x3d')][_0x855f('0xaa')];}if(_0x2b73df[_0x855f('0x3d')][_0x855f('0x77')]){_0x489cd9['auth']={'user':_0x2b73df['Smtp'][_0x855f('0x74')],'pass':_0x2b73df[_0x855f('0x3d')][_0x855f('0x75')]};}return respondWithRpcPromise(_0x855f('0xb4'),_0x855f('0xb5'),{'account':_0x489cd9});}})[_0x855f('0x33')](respondWithResult(_0x681e57,null))['catch'](handleError(_0x681e57,null));};exports['destroy']=function(_0xc68ef3,_0x14888b){return db['MailAccount'][_0x855f('0x60')]({'where':{'id':_0xc68ef3[_0x855f('0x59')]['id']}})['then'](handleEntityNotFound(_0x14888b,null))[_0x855f('0x33')](function(_0x2c45ec){if(_0x2c45ec&&_0x2c45ec[_0x855f('0x7a')]){throw new db[(_0x855f('0xb6'))][(_0x855f('0xb7'))](_0x855f('0xb8'));}return _0x2c45ec;})[_0x855f('0x33')](removeEntity(_0x14888b,null))['catch'](handleError(_0x14888b,null));};exports[_0x855f('0xb9')]=function(_0x1b007e,_0x3a8f68,_0x65ddc){return db[_0x855f('0x52')][_0x855f('0x60')]({'where':{'id':_0x1b007e[_0x855f('0x59')]['id']}})[_0x855f('0x33')](handleEntityNotFound(_0x3a8f68,null))[_0x855f('0x33')](function(_0xc05b42){if(_0xc05b42){return _0xc05b42[_0x855f('0xb9')](_0x1b007e[_0x855f('0x5d')]['ids'],_[_0x855f('0xba')](_0x1b007e['body'],[_0x855f('0x6c'),'id'])||{})['spread'](function(_0xa22a22){for(var _0x230d7e=0x0;_0x230d7e<_0x1b007e[_0x855f('0x5d')]['ids'][_0x855f('0x5c')];_0x230d7e+=0x1){socket[_0x855f('0xbb')]('userMailAccount:save',{'UserId':Number(_0x1b007e[_0x855f('0x5d')]['ids'][_0x230d7e]),'MailAccountId':Number(_0x1b007e[_0x855f('0x59')]['id'])});}return _0xa22a22;});}})[_0x855f('0x33')](respondWithResult(_0x3a8f68,null))['catch'](handleError(_0x3a8f68,null));};exports['removeAgents']=function(_0x2a7154,_0x29ae41,_0x115953){return db['MailAccount'][_0x855f('0x60')]({'where':{'id':_0x2a7154['params']['id']}})[_0x855f('0x33')](handleEntityNotFound(_0x29ae41,null))[_0x855f('0x33')](function(_0x275f3d){if(_0x275f3d){return _0x275f3d[_0x855f('0xbc')](_0x2a7154['query'][_0x855f('0x6c')])[_0x855f('0x33')](function(){if(_['isArray'](_0x2a7154[_0x855f('0x44')][_0x855f('0x6c')])){for(var _0x47d69d=0x0;_0x47d69d<_0x2a7154[_0x855f('0x44')][_0x855f('0x6c')][_0x855f('0x5c')];_0x47d69d+=0x1){socket['emit'](_0x855f('0xbd'),{'UserId':Number(_0x2a7154[_0x855f('0x44')][_0x855f('0x6c')][_0x47d69d]),'MailAccountId':Number(_0x2a7154[_0x855f('0x59')]['id'])});}}else{socket[_0x855f('0xbb')]('userMailAccount:remove',{'UserId':Number(_0x2a7154[_0x855f('0x44')][_0x855f('0x6c')]),'MailAccountId':Number(_0x2a7154[_0x855f('0x59')]['id'])});}});}})[_0x855f('0x33')](respondWithStatusCode(_0x29ae41,null))['catch'](handleError(_0x29ae41,null));};exports[_0x855f('0xbe')]=function(_0x31bf83,_0x34cc15,_0x2c370b){var _0x15c4f2={};var _0x1f36df={};var _0x519a05;var _0x2ce325;return db[_0x855f('0x52')][_0x855f('0x69')]({'where':{'id':_0x31bf83['params']['id']}})[_0x855f('0x33')](handleEntityNotFound(_0x34cc15,null))[_0x855f('0x33')](function(_0x384633){if(_0x384633){_0x519a05=_0x384633;_0x1f36df['model']=_['keys'](db['User'][_0x855f('0x5b')]);_0x1f36df[_0x855f('0x44')]=_[_0x855f('0x45')](_0x31bf83[_0x855f('0x44')]);_0x1f36df[_0x855f('0x46')]=_[_0x855f('0x48')](_0x1f36df['model'],_0x1f36df['query']);_0x15c4f2[_0x855f('0x47')]=_['intersection'](_0x1f36df['model'],qs[_0x855f('0x49')](_0x31bf83['query']['fields']));_0x15c4f2['attributes']=_0x15c4f2[_0x855f('0x47')][_0x855f('0x5c')]?_0x15c4f2[_0x855f('0x47')]:_0x1f36df['model'];_0x15c4f2[_0x855f('0x4b')]=qs['sort'](_0x31bf83[_0x855f('0x44')][_0x855f('0x4c')]);_0x15c4f2[_0x855f('0x4f')]=qs[_0x855f('0x46')](_[_0x855f('0x4d')](_0x31bf83[_0x855f('0x44')],_0x1f36df[_0x855f('0x46')]));if(_0x31bf83[_0x855f('0x44')][_0x855f('0x4e')]){_0x15c4f2['where']=_[_0x855f('0x50')](_0x15c4f2[_0x855f('0x4f')],{'$or':_[_0x855f('0x3f')](_0x15c4f2[_0x855f('0x47')],function(_0x57e098){var _0x2343dd={};_0x2343dd[_0x57e098]={'$like':'%'+_0x31bf83[_0x855f('0x44')][_0x855f('0x4e')]+'%'};return _0x2343dd;})});}_0x15c4f2=_[_0x855f('0x50')]({},_0x15c4f2,_0x31bf83[_0x855f('0x51')]);return _0x519a05[_0x855f('0xbe')](_0x15c4f2);}})['then'](function(_0x4a2cb5){if(_0x4a2cb5){_0x2ce325=_0x4a2cb5[_0x855f('0x5c')];if(!_0x31bf83[_0x855f('0x44')][_0x855f('0x6a')](_0x855f('0x4a'))){_0x15c4f2[_0x855f('0x2d')]=qs[_0x855f('0x2d')](_0x31bf83[_0x855f('0x44')][_0x855f('0x2d')]);_0x15c4f2[_0x855f('0x2b')]=qs[_0x855f('0x2b')](_0x31bf83[_0x855f('0x44')][_0x855f('0x2b')]);}return _0x519a05[_0x855f('0xbe')](_0x15c4f2);}})['then'](function(_0x50f620){if(_0x50f620){return _0x50f620?{'count':_0x2ce325,'rows':_0x50f620}:null;}})[_0x855f('0x33')](respondWithResult(_0x34cc15,null))['catch'](handleError(_0x34cc15,null));}; \ No newline at end of file +var _0x73cb=['authentication','host','port','service','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','findAndCountAll','priority','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','send','CmList','List','CmContact','Contacts','updatedAt','DESC','isNil','attachments','join','server/files/attachments','auth','secure','sendMail','List\x20not\x20found','messageId','from','subject','attach','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','emit','userMailAccount:save','removeAgents','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','UserProfileResource','destroy','stack','name','index','MailServerIn','Smtp','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','Imap','MailServerOut','keys','find','body','describe','addDisposition','MailAccountId','create','getDispositions','findOne','order','Disposition','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','email','ListId','active','description','cservice','cauthentication','user','cuser','password','cpassword'];(function(_0x4fd89e,_0x22f444){var _0x2b1c6e=function(_0x2c0ee1){while(--_0x2c0ee1){_0x4fd89e['push'](_0x4fd89e['shift']());}};_0x2b1c6e(++_0x22f444);}(_0x73cb,0x1d6));var _0xb73c=function(_0x5cb84a,_0x38808f){_0x5cb84a=_0x5cb84a-0x0;var _0x3f493c=_0x73cb[_0x5cb84a];return _0x3f493c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb73c('0x0'));var jsonpatch=require(_0xb73c('0x1'));var rp=require(_0xb73c('0x2'));var moment=require(_0xb73c('0x3'));var BPromise=require(_0xb73c('0x4'));var Mustache=require(_0xb73c('0x5'));var util=require(_0xb73c('0x6'));var path=require(_0xb73c('0x7'));var sox=require(_0xb73c('0x8'));var csv=require(_0xb73c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb73c('0xa'));var _=require(_0xb73c('0xb'));var squel=require('squel');var crypto=require(_0xb73c('0xc'));var jsforce=require(_0xb73c('0xd'));var deskjs=require(_0xb73c('0xe'));var toCsv=require(_0xb73c('0x9'));var querystring=require('querystring');var Papa=require(_0xb73c('0xf'));var htmlToText=require('html-to-text');var juice=require('juice');var Redis=require(_0xb73c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb73c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb73c('0x12'))(_0xb73c('0x13'));var utils=require(_0xb73c('0x14'));var config=require(_0xb73c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb73c('0x16'))['db'];config[_0xb73c('0x17')]=_[_0xb73c('0x18')](config[_0xb73c('0x17')],{'host':_0xb73c('0x19'),'port':0x18eb});var socket=require(_0xb73c('0x1a'))(new Redis(config[_0xb73c('0x17')]));require('./mailAccount.socket')[_0xb73c('0x1b')](socket);var jayson=require(_0xb73c('0x1c'));var client=jayson[_0xb73c('0x1d')][_0xb73c('0x1e')]({'port':0x232b});function respondWithRpcPromise(_0x5ed215,_0x3258b6,_0x163e3c,_0x4fe3ca){return new BPromise(function(_0x30c872,_0x92ab21){var _0x1deb2d=_0x4fe3ca||client;return _0x1deb2d[_0xb73c('0x1f')](_0x5ed215,_0x163e3c)[_0xb73c('0x20')](function(_0xb9733d){logger[_0xb73c('0x21')]('MailAccount,\x20%s,\x20%s',_0x3258b6,'request\x20sent');logger['debug'](_0xb73c('0x22'),_0x3258b6,_0xb73c('0x23'),JSON[_0xb73c('0x24')](_0xb9733d));if(_0xb9733d[_0xb73c('0x25')]){if(_0xb9733d['error'][_0xb73c('0x26')]===0x1f4){logger['error'](_0xb73c('0x27'),_0x3258b6,_0xb9733d[_0xb73c('0x25')][_0xb73c('0x28')]);return _0x92ab21(_0xb9733d[_0xb73c('0x25')]['message']);}logger['error']('MailAccount,\x20%s,\x20%s',_0x3258b6,_0xb9733d[_0xb73c('0x25')][_0xb73c('0x28')]);return _0x30c872(_0xb9733d[_0xb73c('0x25')][_0xb73c('0x28')]);}else{logger['info'](_0xb73c('0x27'),_0x3258b6,_0xb73c('0x23'));_0x30c872(_0xb9733d[_0xb73c('0x29')][_0xb73c('0x28')]);}})['catch'](function(_0x49ffdf){logger[_0xb73c('0x25')](_0xb73c('0x27'),_0x3258b6,_0x49ffdf);_0x92ab21(_0x49ffdf);});});}function respondWithStatusCode(_0x4f44fc,_0x28c63b){_0x28c63b=_0x28c63b||0xcc;return function(_0x140946){if(_0x140946){return _0x4f44fc[_0xb73c('0x2a')](_0x28c63b);}return _0x4f44fc[_0xb73c('0x2b')](_0x28c63b)[_0xb73c('0x2c')]();};}function respondWithResult(_0x58f46a,_0x1b27e3){_0x1b27e3=_0x1b27e3||0xc8;return function(_0x333048){if(_0x333048){return _0x58f46a[_0xb73c('0x2b')](_0x1b27e3)['json'](_0x333048);}};}function respondWithFilteredResult(_0xcf43c4,_0x5076af){return function(_0x36d272){if(_0x36d272){var _0x1f5abc=typeof _0x5076af[_0xb73c('0x2d')]===_0xb73c('0x2e')&&typeof _0x5076af[_0xb73c('0x2f')]===_0xb73c('0x2e');var _0x42e172=_0x36d272[_0xb73c('0x30')];var _0x245472=_0x1f5abc?0x0:_0x5076af[_0xb73c('0x2d')];var _0x578025=_0x1f5abc?_0x36d272['count']:_0x5076af[_0xb73c('0x2d')]+_0x5076af[_0xb73c('0x2f')];var _0x4cddea;if(_0x578025>=_0x42e172){_0x578025=_0x42e172;_0x4cddea=0xc8;}else{_0x4cddea=0xce;}_0xcf43c4[_0xb73c('0x2b')](_0x4cddea);return _0xcf43c4['set'](_0xb73c('0x31'),_0x245472+'-'+_0x578025+'/'+_0x42e172)[_0xb73c('0x32')](_0x36d272);}return null;};}function patchUpdates(_0x4dc0c6){return function(_0x160763){try{jsonpatch['apply'](_0x160763,_0x4dc0c6,!![]);}catch(_0x8b5d7b){return BPromise[_0xb73c('0x33')](_0x8b5d7b);}return _0x160763[_0xb73c('0x34')]();};}function saveUpdates(_0x511237,_0x194c1f){return function(_0x275422){if(_0x275422){return _0x275422[_0xb73c('0x35')](_0x511237)['then'](function(_0x5c1be3){return _0x5c1be3;});}return null;};}function removeEntity(_0x4661fd,_0x4228fe){return function(_0x2439b2){if(_0x2439b2){return _0x2439b2['destroy']()[_0xb73c('0x20')](function(){var _0x48a6c2=_0x2439b2['get']({'plain':!![]});var _0x36b1de='MailAccounts';return db[_0xb73c('0x36')][_0xb73c('0x37')]({'where':{'type':_0x36b1de,'resourceId':_0x48a6c2['id']}})['then'](function(){return _0x2439b2;});})['then'](function(){_0x4661fd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ba8a4,_0x1cf561){return function(_0x5da125){if(!_0x5da125){_0x2ba8a4[_0xb73c('0x2a')](0x194);}return _0x5da125;};}function handleError(_0x27deaa,_0x554160){_0x554160=_0x554160||0x1f4;return function(_0x16a521){logger[_0xb73c('0x25')](_0x16a521[_0xb73c('0x38')]);if(_0x16a521[_0xb73c('0x39')]){delete _0x16a521[_0xb73c('0x39')];}_0x27deaa[_0xb73c('0x2b')](_0x554160)['send'](_0x16a521);};}exports[_0xb73c('0x3a')]=function(_0x3c5126,_0x1a2e46){var _0x234014={'include':[{'model':db[_0xb73c('0x3b')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xb73c('0x3c')},{'model':db[_0xb73c('0x3d')],'as':_0xb73c('0x3e')}]},_0x23e75f={},_0x2138fa={'count':0x0,'rows':[]};var _0x1f590d=_['map'](db[_0xb73c('0x3f')][_0xb73c('0x40')],function(_0x168eab){return{'name':_0x168eab[_0xb73c('0x41')],'type':_0x168eab['type'][_0xb73c('0x42')]};});_0x23e75f[_0xb73c('0x43')]=_[_0xb73c('0x44')](_0x1f590d,_0xb73c('0x39'));_0x23e75f[_0xb73c('0x45')]=_['keys'](_0x3c5126[_0xb73c('0x45')]);_0x23e75f[_0xb73c('0x46')]=_['intersection'](_0x23e75f[_0xb73c('0x43')],_0x23e75f['query']);_0x234014['attributes']=_[_0xb73c('0x47')](_0x23e75f['model'],qs[_0xb73c('0x48')](_0x3c5126[_0xb73c('0x45')][_0xb73c('0x48')]));_0x234014[_0xb73c('0x49')]=_0x234014[_0xb73c('0x49')][_0xb73c('0x4a')]?_0x234014[_0xb73c('0x49')]:_0x23e75f[_0xb73c('0x43')];if(!_0x3c5126[_0xb73c('0x45')][_0xb73c('0x4b')](_0xb73c('0x4c'))){_0x234014[_0xb73c('0x2f')]=qs['limit'](_0x3c5126[_0xb73c('0x45')][_0xb73c('0x2f')]);_0x234014['offset']=qs[_0xb73c('0x2d')](_0x3c5126[_0xb73c('0x45')][_0xb73c('0x2d')]);}_0x234014['order']=qs['sort'](_0x3c5126[_0xb73c('0x45')][_0xb73c('0x4d')]);_0x234014[_0xb73c('0x4e')]=qs[_0xb73c('0x46')](_[_0xb73c('0x4f')](_0x3c5126['query'],_0x23e75f['filters']),_0x1f590d);if(_0x3c5126[_0xb73c('0x45')][_0xb73c('0x50')]){_0x234014[_0xb73c('0x4e')]=_[_0xb73c('0x51')](_0x234014['where'],{'$or':_[_0xb73c('0x44')](_0x1f590d,function(_0x351622){if(_0x351622[_0xb73c('0x52')]!==_0xb73c('0x53')){var _0x3ff8ce={};_0x3ff8ce[_0x351622['name']]={'$like':'%'+_0x3c5126['query'][_0xb73c('0x50')]+'%'};return _0x3ff8ce;}})});}_0x234014=_[_0xb73c('0x51')]({},_0x234014,_0x3c5126[_0xb73c('0x54')]);var _0x3c54ab={'where':_0x234014[_0xb73c('0x4e')]};return db[_0xb73c('0x3f')][_0xb73c('0x30')](_0x3c54ab)[_0xb73c('0x20')](function(_0x5db3ec){_0x2138fa['count']=_0x5db3ec;if(_0x3c5126[_0xb73c('0x45')][_0xb73c('0x55')]){_0x234014[_0xb73c('0x56')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x234014);})[_0xb73c('0x20')](function(_0x34b853){_0x2138fa['rows']=_0x34b853;return _0x2138fa;})[_0xb73c('0x20')](respondWithFilteredResult(_0x1a2e46,_0x234014))[_0xb73c('0x57')](handleError(_0x1a2e46,null));};exports[_0xb73c('0x58')]=function(_0xcaadce,_0xec16f1){var _0x5c2432={'raw':![],'where':{'id':_0xcaadce[_0xb73c('0x59')]['id']},'include':[{'model':db[_0xb73c('0x3b')],'as':_0xb73c('0x5a')},{'model':db[_0xb73c('0x5b')],'as':_0xb73c('0x3c')},{'model':db[_0xb73c('0x3d')],'as':_0xb73c('0x3e')}]},_0x309c40={};_0x309c40[_0xb73c('0x43')]=_[_0xb73c('0x5c')](db[_0xb73c('0x3f')][_0xb73c('0x40')]);_0x309c40[_0xb73c('0x45')]=_[_0xb73c('0x5c')](_0xcaadce[_0xb73c('0x45')]);_0x309c40[_0xb73c('0x46')]=_[_0xb73c('0x47')](_0x309c40['model'],_0x309c40[_0xb73c('0x45')]);_0x5c2432[_0xb73c('0x49')]=_[_0xb73c('0x47')](_0x309c40[_0xb73c('0x43')],qs['fields'](_0xcaadce['query'][_0xb73c('0x48')]));_0x5c2432[_0xb73c('0x49')]=_0x5c2432[_0xb73c('0x49')][_0xb73c('0x4a')]?_0x5c2432[_0xb73c('0x49')]:_0x309c40['model'];if(_0xcaadce[_0xb73c('0x45')][_0xb73c('0x55')]){_0x5c2432[_0xb73c('0x56')]=[{'all':!![]}];}_0x5c2432=_[_0xb73c('0x51')]({},_0x5c2432,_0xcaadce[_0xb73c('0x54')]);return db[_0xb73c('0x3f')][_0xb73c('0x5d')](_0x5c2432)['then'](handleEntityNotFound(_0xec16f1,null))['then'](respondWithResult(_0xec16f1,null))[_0xb73c('0x57')](handleError(_0xec16f1,null));};exports['update']=function(_0x8b3f20,_0x1a0b7c){if(_0x8b3f20[_0xb73c('0x5e')]['id']){delete _0x8b3f20[_0xb73c('0x5e')]['id'];}return db[_0xb73c('0x3f')][_0xb73c('0x5d')]({'where':{'id':_0x8b3f20[_0xb73c('0x59')]['id']},'include':[{'model':db[_0xb73c('0x3b')],'as':_0xb73c('0x5a')},{'model':db[_0xb73c('0x5b')],'as':_0xb73c('0x3c')},{'model':db['Pause'],'as':_0xb73c('0x3e')}]})['then'](handleEntityNotFound(_0x1a0b7c,null))['then'](saveUpdates(_0x8b3f20[_0xb73c('0x5e')],null))[_0xb73c('0x20')](function(_0x1e0124){if(_0x1e0124&&_0x8b3f20[_0xb73c('0x5e')][_0xb73c('0x5a')]){return db[_0xb73c('0x3b')][_0xb73c('0x35')](_0x8b3f20[_0xb73c('0x5e')][_0xb73c('0x5a')],{'where':{'MailAccountId':_0x1e0124['id']}})['then'](function(){return _0x1e0124;});}return _0x1e0124;})[_0xb73c('0x20')](function(_0x43bf87){if(_0x43bf87&&_0x8b3f20['body'][_0xb73c('0x3c')]){return db['MailServerOut'][_0xb73c('0x35')](_0x8b3f20[_0xb73c('0x5e')][_0xb73c('0x3c')],{'where':{'MailAccountId':_0x43bf87['id']}})[_0xb73c('0x20')](function(){return _0x43bf87;});}return _0x43bf87;})['then'](respondWithResult(_0x1a0b7c,null))[_0xb73c('0x57')](handleError(_0x1a0b7c,null));};exports[_0xb73c('0x5f')]=function(_0x2d4683,_0x46c4de){return db[_0xb73c('0x3f')][_0xb73c('0x5f')]()[_0xb73c('0x20')](respondWithResult(_0x46c4de,null))[_0xb73c('0x57')](handleError(_0x46c4de,null));};exports[_0xb73c('0x60')]=function(_0x52c7ef,_0x1fbd3b,_0xd51750){if(_0x52c7ef[_0xb73c('0x5e')]['id']){delete _0x52c7ef[_0xb73c('0x5e')]['id'];}return db[_0xb73c('0x3f')][_0xb73c('0x5d')]({'where':{'id':_0x52c7ef[_0xb73c('0x59')]['id']}})[_0xb73c('0x20')](handleEntityNotFound(_0x1fbd3b,null))['then'](function(_0x84a1b6){if(_0x84a1b6){_0x52c7ef[_0xb73c('0x5e')][_0xb73c('0x61')]=_0x84a1b6['id'];return db['Disposition'][_0xb73c('0x62')](_0x52c7ef[_0xb73c('0x5e')]);}})[_0xb73c('0x20')](respondWithResult(_0x1fbd3b,null))[_0xb73c('0x57')](handleError(_0x1fbd3b,null));};exports[_0xb73c('0x63')]=function(_0x4c1817,_0x4d2e69,_0xa1e4fa){var _0xc958d6={'raw':![],'where':{}};var _0xeba68b={};var _0x441b8b={'count':0x0,'rows':[]};return db[_0xb73c('0x3f')][_0xb73c('0x64')]({'where':{'id':_0x4c1817[_0xb73c('0x59')]['id']}})[_0xb73c('0x20')](handleEntityNotFound(_0x4d2e69,null))[_0xb73c('0x20')](function(_0x1615e5){if(_0x1615e5){_0xeba68b[_0xb73c('0x43')]=_[_0xb73c('0x5c')](db['Disposition'][_0xb73c('0x40')]);_0xeba68b[_0xb73c('0x45')]=_[_0xb73c('0x5c')](_0x4c1817[_0xb73c('0x45')]);_0xeba68b[_0xb73c('0x46')]=_[_0xb73c('0x47')](_0xeba68b[_0xb73c('0x43')],_0xeba68b['query']);_0xc958d6[_0xb73c('0x49')]=_['intersection'](_0xeba68b[_0xb73c('0x43')],qs[_0xb73c('0x48')](_0x4c1817[_0xb73c('0x45')][_0xb73c('0x48')]));_0xc958d6['attributes']=_0xc958d6[_0xb73c('0x49')][_0xb73c('0x4a')]?_0xc958d6[_0xb73c('0x49')]:_0xeba68b[_0xb73c('0x43')];if(!_0x4c1817[_0xb73c('0x45')]['hasOwnProperty'](_0xb73c('0x4c'))){_0xc958d6[_0xb73c('0x2f')]=qs[_0xb73c('0x2f')](_0x4c1817[_0xb73c('0x45')][_0xb73c('0x2f')]);_0xc958d6[_0xb73c('0x2d')]=qs[_0xb73c('0x2d')](_0x4c1817[_0xb73c('0x45')][_0xb73c('0x2d')]);}_0xc958d6[_0xb73c('0x65')]=qs[_0xb73c('0x4d')](_0x4c1817[_0xb73c('0x45')][_0xb73c('0x4d')]);_0xc958d6['where']=qs['filters'](_[_0xb73c('0x4f')](_0x4c1817[_0xb73c('0x45')],_0xeba68b[_0xb73c('0x46')]));_0xc958d6[_0xb73c('0x4e')][_0xb73c('0x61')]=_0x1615e5['id'];if(_0x4c1817[_0xb73c('0x45')][_0xb73c('0x50')]){_0xc958d6[_0xb73c('0x4e')]=_[_0xb73c('0x51')](_0xc958d6[_0xb73c('0x4e')],{'$or':_[_0xb73c('0x44')](_0xc958d6[_0xb73c('0x49')],function(_0x399924){var _0x2c9d14={};_0x2c9d14[_0x399924]={'$like':'%'+_0x4c1817['query'][_0xb73c('0x50')]+'%'};return _0x2c9d14;})});}_0xc958d6=_['merge']({},_0xc958d6,_0x4c1817[_0xb73c('0x54')]);return db[_0xb73c('0x66')][_0xb73c('0x30')]({'where':_0xc958d6[_0xb73c('0x4e')]})[_0xb73c('0x20')](function(_0x3efb20){_0x441b8b[_0xb73c('0x30')]=_0x3efb20;if(_0x4c1817[_0xb73c('0x45')][_0xb73c('0x55')]){_0xc958d6[_0xb73c('0x56')]=[{'all':!![]}];}return db[_0xb73c('0x66')]['findAll'](_0xc958d6);})[_0xb73c('0x20')](function(_0x5f1e98){_0x441b8b[_0xb73c('0x67')]=_0x5f1e98;return _0x441b8b;});}})[_0xb73c('0x20')](respondWithFilteredResult(_0x4d2e69,_0xc958d6))['catch'](handleError(_0x4d2e69,null));};exports[_0xb73c('0x68')]=function(_0x9dd755,_0x539b4d,_0x310a5f){return db[_0xb73c('0x3f')]['find']({'where':{'id':_0x9dd755['params']['id']}})['then'](handleEntityNotFound(_0x539b4d,null))[_0xb73c('0x20')](function(_0x195702){if(_0x195702){return _0x195702[_0xb73c('0x68')](_0x9dd755[_0xb73c('0x45')][_0xb73c('0x69')]);}})['then'](respondWithStatusCode(_0x539b4d,null))[_0xb73c('0x57')](handleError(_0x539b4d,null));};exports[_0xb73c('0x6a')]=function(_0x53998d,_0x59bd6e,_0xff3172){if(_0x53998d[_0xb73c('0x5e')]['id']){delete _0x53998d[_0xb73c('0x5e')]['id'];}return db[_0xb73c('0x3f')][_0xb73c('0x5d')]({'where':{'id':_0x53998d[_0xb73c('0x59')]['id']}})[_0xb73c('0x20')](handleEntityNotFound(_0x59bd6e,null))['then'](function(_0x229494){if(_0x229494){_0x53998d['body'][_0xb73c('0x61')]=_0x229494['id'];return db[_0xb73c('0x6b')][_0xb73c('0x62')](_0x53998d[_0xb73c('0x5e')]);}})['then'](respondWithResult(_0x59bd6e,null))[_0xb73c('0x57')](handleError(_0x59bd6e,null));};exports[_0xb73c('0x6c')]=function(_0x363a35,_0x38ba68,_0x545c36){var _0x1ef6c4={'raw':![],'where':{}};var _0x258c34={};var _0x4b326d={'count':0x0,'rows':[]};return db['MailAccount'][_0xb73c('0x64')]({'where':{'id':_0x363a35[_0xb73c('0x59')]['id']}})[_0xb73c('0x20')](handleEntityNotFound(_0x38ba68,null))[_0xb73c('0x20')](function(_0x32d6a8){if(_0x32d6a8){_0x258c34[_0xb73c('0x43')]=_[_0xb73c('0x5c')](db[_0xb73c('0x6b')][_0xb73c('0x40')]);_0x258c34[_0xb73c('0x45')]=_[_0xb73c('0x5c')](_0x363a35[_0xb73c('0x45')]);_0x258c34['filters']=_[_0xb73c('0x47')](_0x258c34['model'],_0x258c34['query']);_0x1ef6c4[_0xb73c('0x49')]=_[_0xb73c('0x47')](_0x258c34[_0xb73c('0x43')],qs['fields'](_0x363a35[_0xb73c('0x45')][_0xb73c('0x48')]));_0x1ef6c4[_0xb73c('0x49')]=_0x1ef6c4[_0xb73c('0x49')]['length']?_0x1ef6c4['attributes']:_0x258c34[_0xb73c('0x43')];if(!_0x363a35['query']['hasOwnProperty'](_0xb73c('0x4c'))){_0x1ef6c4['limit']=qs[_0xb73c('0x2f')](_0x363a35[_0xb73c('0x45')][_0xb73c('0x2f')]);_0x1ef6c4['offset']=qs[_0xb73c('0x2d')](_0x363a35[_0xb73c('0x45')][_0xb73c('0x2d')]);}_0x1ef6c4[_0xb73c('0x65')]=qs[_0xb73c('0x4d')](_0x363a35[_0xb73c('0x45')][_0xb73c('0x4d')]);_0x1ef6c4['where']=qs['filters'](_[_0xb73c('0x4f')](_0x363a35[_0xb73c('0x45')],_0x258c34[_0xb73c('0x46')]));_0x1ef6c4['where']['MailAccountId']=_0x32d6a8['id'];if(_0x363a35['query'][_0xb73c('0x50')]){_0x1ef6c4['where']=_[_0xb73c('0x51')](_0x1ef6c4[_0xb73c('0x4e')],{'$or':_[_0xb73c('0x44')](_0x1ef6c4['attributes'],function(_0x38641f){var _0x446b3c={};_0x446b3c[_0x38641f]={'$like':'%'+_0x363a35[_0xb73c('0x45')][_0xb73c('0x50')]+'%'};return _0x446b3c;})});}_0x1ef6c4=_[_0xb73c('0x51')]({},_0x1ef6c4,_0x363a35[_0xb73c('0x54')]);return db['CannedAnswer'][_0xb73c('0x30')]({'where':_0x1ef6c4[_0xb73c('0x4e')]})['then'](function(_0x1f7c3a){_0x4b326d[_0xb73c('0x30')]=_0x1f7c3a;if(_0x363a35['query']['includeAll']){_0x1ef6c4[_0xb73c('0x56')]=[{'all':!![]}];}return db[_0xb73c('0x6b')][_0xb73c('0x6d')](_0x1ef6c4);})[_0xb73c('0x20')](function(_0x1e177f){_0x4b326d[_0xb73c('0x67')]=_0x1e177f;return _0x4b326d;});}})[_0xb73c('0x20')](respondWithFilteredResult(_0x38ba68,_0x1ef6c4))[_0xb73c('0x57')](handleError(_0x38ba68,null));};exports['removeAnswers']=function(_0x5e0c1f,_0x248b67,_0xbc7f96){return db['MailAccount']['find']({'where':{'id':_0x5e0c1f['params']['id']}})[_0xb73c('0x20')](handleEntityNotFound(_0x248b67,null))[_0xb73c('0x20')](function(_0x218ed0){if(_0x218ed0){return _0x218ed0[_0xb73c('0x6e')](_0x5e0c1f['query']['ids']);}})[_0xb73c('0x20')](respondWithStatusCode(_0x248b67,null))['catch'](handleError(_0x248b67,null));};exports[_0xb73c('0x62')]=function(_0x57419e,_0xcfb7a9){var _0x156f86={'name':_0x57419e[_0xb73c('0x5e')][_0xb73c('0x39')],'key':_0x57419e[_0xb73c('0x5e')]['key'],'email':_0x57419e[_0xb73c('0x5e')][_0xb73c('0x6f')],'ListId':_0x57419e['body'][_0xb73c('0x70')],'active':!_['isNil'](_0x57419e[_0xb73c('0x5e')][_0xb73c('0x71')])?_0x57419e[_0xb73c('0x5e')][_0xb73c('0x71')]:!![],'description':_0x57419e[_0xb73c('0x5e')][_0xb73c('0x72')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x57419e[_0xb73c('0x5e')][_0xb73c('0x73')])){if(_0x57419e[_0xb73c('0x5e')][_0xb73c('0x74')]){_0x156f86[_0xb73c('0x5a')]['user']=_0x156f86[_0xb73c('0x3c')][_0xb73c('0x75')]=_0x57419e['body'][_0xb73c('0x76')];_0x156f86[_0xb73c('0x5a')][_0xb73c('0x77')]=_0x156f86[_0xb73c('0x3c')]['pass']=_0x57419e[_0xb73c('0x5e')][_0xb73c('0x78')];}else{_0x156f86['Imap'][_0xb73c('0x79')]=_0x156f86[_0xb73c('0x3c')][_0xb73c('0x79')]=![];}_0x156f86['Imap'][_0xb73c('0x7a')]=_0x57419e[_0xb73c('0x5e')][_0xb73c('0x5a')][_0xb73c('0x7a')];_0x156f86[_0xb73c('0x5a')][_0xb73c('0x7b')]=_0x57419e[_0xb73c('0x5e')][_0xb73c('0x5a')][_0xb73c('0x7b')];_0x156f86[_0xb73c('0x3c')][_0xb73c('0x7a')]=_0x57419e[_0xb73c('0x5e')][_0xb73c('0x3c')][_0xb73c('0x7a')];_0x156f86[_0xb73c('0x3c')][_0xb73c('0x7b')]=_0x57419e['body'][_0xb73c('0x3c')][_0xb73c('0x7b')];}else{_0x156f86[_0xb73c('0x5a')]['service']=_0x156f86[_0xb73c('0x3c')][_0xb73c('0x7c')]=_0x57419e[_0xb73c('0x5e')][_0xb73c('0x73')];_0x156f86[_0xb73c('0x5a')]['user']=_0x156f86[_0xb73c('0x3c')][_0xb73c('0x75')]=_0x57419e[_0xb73c('0x5e')][_0xb73c('0x76')];_0x156f86[_0xb73c('0x5a')][_0xb73c('0x77')]=_0x156f86[_0xb73c('0x3c')][_0xb73c('0x7d')]=_0x57419e[_0xb73c('0x5e')]['cpassword'];}return db[_0xb73c('0x3f')][_0xb73c('0x62')](_0x156f86,{'include':[{'model':db[_0xb73c('0x5b')],'as':_0xb73c('0x3c')},{'model':db[_0xb73c('0x3b')],'as':'Imap'}]})['then'](function(_0x5af01d){var _0x3ffbb8=_0x57419e[_0xb73c('0x75')]['get']({'plain':!![]});if(!_0x3ffbb8)throw new Error(_0xb73c('0x7e'));if(_0x3ffbb8['role']===_0xb73c('0x75')){var _0x3faa30=_0x5af01d[_0xb73c('0x7f')]({'plain':!![]});return db[_0xb73c('0x80')][_0xb73c('0x5d')]({'where':{'name':'MailAccounts','userProfileId':_0x3ffbb8[_0xb73c('0x81')]},'raw':!![]})['then'](function(_0x3e5b39){if(_0x3e5b39&&_0x3e5b39['autoAssociation']===0x0){return db['UserProfileResource'][_0xb73c('0x62')]({'name':_0x3faa30[_0xb73c('0x39')],'resourceId':_0x3faa30['id'],'type':_0x3e5b39[_0xb73c('0x39')],'sectionId':_0x3e5b39['id']},{})[_0xb73c('0x20')](function(){return _0x5af01d;});}else{return _0x5af01d;}})[_0xb73c('0x57')](function(_0x2d615b){logger['error'](_0xb73c('0x82'),_0x2d615b);throw _0x2d615b;});}return _0x5af01d;})[_0xb73c('0x20')](respondWithResult(_0xcfb7a9,0xc9))[_0xb73c('0x57')](handleError(_0xcfb7a9,null));};exports[_0xb73c('0x83')]=function(_0x35981b,_0x17d9b3,_0x1620ab){return db[_0xb73c('0x3f')][_0xb73c('0x64')]({'where':{'id':_0x35981b[_0xb73c('0x59')]['id']}})['then'](handleEntityNotFound(_0x17d9b3,null))[_0xb73c('0x20')](function(_0x57699b){if(_0x57699b){return _0x57699b[_0xb73c('0x83')]();}return null;})[_0xb73c('0x20')](respondWithResult(_0x17d9b3,null))[_0xb73c('0x57')](handleError(_0x17d9b3,null));};exports['addImap']=function(_0x52f3af,_0x388aaa,_0x52351d){if(_0x52f3af['body']['id']){delete _0x52f3af[_0xb73c('0x5e')]['id'];}return db[_0xb73c('0x3f')][_0xb73c('0x5d')]({'where':{'id':_0x52f3af['params']['id']}})[_0xb73c('0x20')](handleEntityNotFound(_0x388aaa,null))[_0xb73c('0x20')](function(_0x5a8dbe){if(_0x5a8dbe){_0x52f3af[_0xb73c('0x5e')][_0xb73c('0x61')]=_0x5a8dbe['id'];return db[_0xb73c('0x3b')][_0xb73c('0x62')](_0x52f3af['body']);}})[_0xb73c('0x20')](respondWithResult(_0x388aaa,null))[_0xb73c('0x57')](handleError(_0x388aaa,null));};exports[_0xb73c('0x84')]=function(_0x3447ef,_0xb2ad57,_0x18f1d1){return db[_0xb73c('0x3f')][_0xb73c('0x64')]({'where':{'id':_0x3447ef[_0xb73c('0x59')]['id']}})[_0xb73c('0x20')](handleEntityNotFound(_0xb2ad57,null))[_0xb73c('0x20')](function(_0x45f1c3){if(_0x45f1c3){return _0x45f1c3[_0xb73c('0x85')](null);}return null;})['then'](respondWithStatusCode(_0xb2ad57,null))[_0xb73c('0x57')](handleError(_0xb2ad57,null));};exports[_0xb73c('0x86')]=function(_0x109404,_0x2aef27,_0x52c76d){return db['MailAccount'][_0xb73c('0x64')]({'where':{'id':_0x109404['params']['id']}})[_0xb73c('0x20')](handleEntityNotFound(_0x2aef27,null))['then'](function(_0x33386d){if(_0x33386d){return _0x33386d['getSmtp']();}return null;})[_0xb73c('0x20')](respondWithResult(_0x2aef27,null))[_0xb73c('0x57')](handleError(_0x2aef27,null));};exports[_0xb73c('0x87')]=function(_0x1ddbc0,_0x22ee25,_0x2136fc){if(_0x1ddbc0[_0xb73c('0x5e')]['id']){delete _0x1ddbc0[_0xb73c('0x5e')]['id'];}return db[_0xb73c('0x3f')]['find']({'where':{'id':_0x1ddbc0['params']['id']}})[_0xb73c('0x20')](handleEntityNotFound(_0x22ee25,null))[_0xb73c('0x20')](function(_0x2482c2){if(_0x2482c2){_0x1ddbc0[_0xb73c('0x5e')][_0xb73c('0x61')]=_0x2482c2['id'];return db[_0xb73c('0x5b')][_0xb73c('0x62')](_0x1ddbc0[_0xb73c('0x5e')]);}})[_0xb73c('0x20')](respondWithResult(_0x22ee25,null))[_0xb73c('0x57')](handleError(_0x22ee25,null));};exports[_0xb73c('0x88')]=function(_0x338767,_0x4bbc5f,_0x37a63e){return db[_0xb73c('0x3f')][_0xb73c('0x64')]({'where':{'id':_0x338767[_0xb73c('0x59')]['id']}})[_0xb73c('0x20')](handleEntityNotFound(_0x4bbc5f,null))[_0xb73c('0x20')](function(_0x87b526){if(_0x87b526){return _0x87b526['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x4bbc5f,null))['catch'](handleError(_0x4bbc5f,null));};exports[_0xb73c('0x89')]=function(_0xf373c4,_0x1a6f2e,_0x110454){return db[_0xb73c('0x8a')][_0xb73c('0x5d')]({'where':{'id':_0xf373c4[_0xb73c('0x59')]['id']}})[_0xb73c('0x20')](handleEntityNotFound(_0x1a6f2e,null))[_0xb73c('0x20')](function(_0x2961f7){if(_0x2961f7){return _0x2961f7[_0xb73c('0x89')](_0xf373c4['body'][_0xb73c('0x69')],_['omit'](_0xf373c4['body'],['ids','id'])||{});}})[_0xb73c('0x20')](respondWithResult(_0x1a6f2e,null))[_0xb73c('0x57')](handleError(_0x1a6f2e,null));};exports[_0xb73c('0x8b')]=function(_0x398a78,_0x59cb06,_0x5ace04){var _0x35d0af={'raw':![],'where':{}};var _0x7b36ee={};var _0x103d2d={'count':0x0,'rows':[]};return db[_0xb73c('0x3f')]['findOne']({'where':{'id':_0x398a78[_0xb73c('0x59')]['id']}})[_0xb73c('0x20')](handleEntityNotFound(_0x59cb06,null))[_0xb73c('0x20')](function(_0x31c436){if(_0x31c436){_0x7b36ee[_0xb73c('0x43')]=_[_0xb73c('0x5c')](db['MailInteraction'][_0xb73c('0x40')]);_0x7b36ee['query']=_['keys'](_0x398a78[_0xb73c('0x45')]);_0x7b36ee[_0xb73c('0x46')]=_[_0xb73c('0x47')](_0x7b36ee['model'],_0x7b36ee['query']);_0x35d0af[_0xb73c('0x49')]=_['intersection'](_0x7b36ee[_0xb73c('0x43')],qs[_0xb73c('0x48')](_0x398a78[_0xb73c('0x45')][_0xb73c('0x48')]));_0x35d0af[_0xb73c('0x49')]=_0x35d0af['attributes'][_0xb73c('0x4a')]?_0x35d0af[_0xb73c('0x49')]:_0x7b36ee['model'];if(!_0x398a78[_0xb73c('0x45')][_0xb73c('0x4b')]('nolimit')){_0x35d0af[_0xb73c('0x2f')]=qs[_0xb73c('0x2f')](_0x398a78[_0xb73c('0x45')]['limit']);_0x35d0af[_0xb73c('0x2d')]=qs[_0xb73c('0x2d')](_0x398a78[_0xb73c('0x45')][_0xb73c('0x2d')]);}_0x35d0af[_0xb73c('0x65')]=qs[_0xb73c('0x4d')](_0x398a78[_0xb73c('0x45')][_0xb73c('0x4d')]);_0x35d0af[_0xb73c('0x4e')]=qs[_0xb73c('0x46')](_['pick'](_0x398a78[_0xb73c('0x45')],_0x7b36ee[_0xb73c('0x46')]));_0x35d0af[_0xb73c('0x4e')]['MailAccountId']=_0x31c436['id'];if(_0x398a78['query'][_0xb73c('0x50')]){_0x35d0af['where']=_['merge'](_0x35d0af[_0xb73c('0x4e')],{'$or':_[_0xb73c('0x44')](_0x35d0af[_0xb73c('0x49')],function(_0x16db51){var _0x368279={};_0x368279[_0x16db51]={'$like':'%'+_0x398a78[_0xb73c('0x45')][_0xb73c('0x50')]+'%'};return _0x368279;})});}_0x35d0af=_['merge']({},_0x35d0af,_0x398a78[_0xb73c('0x54')]);return db[_0xb73c('0x8a')][_0xb73c('0x30')]({'where':_0x35d0af[_0xb73c('0x4e')]})[_0xb73c('0x20')](function(_0x18123f){_0x103d2d[_0xb73c('0x30')]=_0x18123f;if(_0x398a78[_0xb73c('0x45')]['includeAll']){_0x35d0af[_0xb73c('0x56')]=[{'model':db['CmContact'],'as':_0xb73c('0x8c'),'required':![]},{'model':db[_0xb73c('0x8d')],'as':_0xb73c('0x8e'),'attributes':[_0xb73c('0x39'),_0xb73c('0x8f'),_0xb73c('0x90')],'required':![]},{'model':db[_0xb73c('0x91')],'as':_0xb73c('0x92'),'attributes':['id',_0xb73c('0x39'),_0xb73c('0x93')],'where':_0x398a78[_0xb73c('0x45')][_0xb73c('0x94')]?{'id':_0x398a78[_0xb73c('0x45')][_0xb73c('0x94')]}:undefined,'required':_0x398a78[_0xb73c('0x45')][_0xb73c('0x94')]?!![]:![]}];}return db[_0xb73c('0x8a')]['findAll'](_0x35d0af);})[_0xb73c('0x20')](function(_0x44b4b2){_0x103d2d[_0xb73c('0x67')]=_0x44b4b2;return _0x103d2d;});}})[_0xb73c('0x20')](respondWithFilteredResult(_0x59cb06,_0x35d0af))[_0xb73c('0x57')](handleError(_0x59cb06,null));};exports[_0xb73c('0x95')]=function(_0xe0922e,_0x3c5f8c,_0x3eb2aa){return db[_0xb73c('0x3f')][_0xb73c('0x64')]({'where':{'id':_0xe0922e['params']['id']}})[_0xb73c('0x20')](handleEntityNotFound(_0x3c5f8c,null))[_0xb73c('0x20')](function(_0x1c297d){if(_0x1c297d){return db[_0xb73c('0x96')][_0xb73c('0x97')](function(_0x16db6b){return db[_0xb73c('0x98')][_0xb73c('0x37')]({'where':{'MailAccountId':_0xe0922e[_0xb73c('0x59')]['id']},'transaction':_0x16db6b})[_0xb73c('0x20')](function(_0x4dacd1){var _0x573a42=_[_0xb73c('0x44')](_0xe0922e[_0xb73c('0x5e')],function(_0x4da77c){_0x4da77c[_0xb73c('0x61')]=_0xe0922e[_0xb73c('0x59')]['id'];return _0x4da77c;});return db[_0xb73c('0x98')]['bulkCreate'](_0x573a42,{'transaction':_0x16db6b});});})[_0xb73c('0x20')](function(){return db[_0xb73c('0x98')][_0xb73c('0x99')]({'where':{'MailAccountId':_0xe0922e[_0xb73c('0x59')]['id']},'order':_0xb73c('0x9a')});});}})[_0xb73c('0x20')](respondWithResult(_0x3c5f8c,null))[_0xb73c('0x57')](handleError(_0x3c5f8c,null));};exports[_0xb73c('0x9b')]=function(_0x217a0a,_0xcd158c,_0x33a792){var _0x15d2d3={};var _0x37ca7e={};var _0x33b2b5;var _0xb409d1;return db[_0xb73c('0x3f')][_0xb73c('0x64')]({'where':{'id':_0x217a0a[_0xb73c('0x59')]['id']}})[_0xb73c('0x20')](handleEntityNotFound(_0xcd158c,null))[_0xb73c('0x20')](function(_0x59b528){if(_0x59b528){_0x33b2b5=_0x59b528;_0x37ca7e[_0xb73c('0x43')]=_[_0xb73c('0x5c')](db['MailApplication']['rawAttributes']);_0x37ca7e[_0xb73c('0x45')]=_[_0xb73c('0x5c')](_0x217a0a['query']);_0x37ca7e['filters']=_[_0xb73c('0x47')](_0x37ca7e[_0xb73c('0x43')],_0x37ca7e[_0xb73c('0x45')]);_0x15d2d3['attributes']=_[_0xb73c('0x47')](_0x37ca7e[_0xb73c('0x43')],qs[_0xb73c('0x48')](_0x217a0a[_0xb73c('0x45')][_0xb73c('0x48')]));_0x15d2d3[_0xb73c('0x49')]=_0x15d2d3[_0xb73c('0x49')][_0xb73c('0x4a')]?_0x15d2d3['attributes']:_0x37ca7e[_0xb73c('0x43')];_0x15d2d3[_0xb73c('0x65')]=qs['sort'](_0x217a0a[_0xb73c('0x45')][_0xb73c('0x4d')]);_0x15d2d3['where']=qs[_0xb73c('0x46')](_[_0xb73c('0x4f')](_0x217a0a['query'],_0x37ca7e['filters']));if(_0x217a0a[_0xb73c('0x45')][_0xb73c('0x50')]){_0x15d2d3[_0xb73c('0x4e')]=_[_0xb73c('0x51')](_0x15d2d3[_0xb73c('0x4e')],{'$or':_[_0xb73c('0x44')](_0x15d2d3[_0xb73c('0x49')],function(_0x5e50ae){var _0x58c4a8={};_0x58c4a8[_0x5e50ae]={'$like':'%'+_0x217a0a[_0xb73c('0x45')]['filter']+'%'};return _0x58c4a8;})});}_0x15d2d3=_[_0xb73c('0x51')]({},_0x15d2d3,_0x217a0a[_0xb73c('0x54')]);return _0x33b2b5[_0xb73c('0x9b')](_0x15d2d3);}})['then'](function(_0x11533c){if(_0x11533c){_0xb409d1=_0x11533c[_0xb73c('0x4a')];if(!_0x217a0a[_0xb73c('0x45')][_0xb73c('0x4b')](_0xb73c('0x4c'))){_0x15d2d3['limit']=qs['limit'](_0x217a0a[_0xb73c('0x45')][_0xb73c('0x2f')]);_0x15d2d3[_0xb73c('0x2d')]=qs['offset'](_0x217a0a[_0xb73c('0x45')][_0xb73c('0x2d')]);}return _0x33b2b5[_0xb73c('0x9b')](_0x15d2d3);}})[_0xb73c('0x20')](function(_0x2b599e){if(_0x2b599e){return _0x2b599e?{'count':_0xb409d1,'rows':_0x2b599e}:null;}})[_0xb73c('0x20')](respondWithResult(_0xcd158c,null))['catch'](handleError(_0xcd158c,null));};exports[_0xb73c('0x9c')]=function(_0x5783f9,_0x2c04b7,_0x3ed0ed){var _0x1bed76={'raw':!![],'where':{}};var _0x323121={};var _0x5bf400={'count':0x0,'rows':[]};return db[_0xb73c('0x3f')]['findOne']({'where':{'id':_0x5783f9[_0xb73c('0x59')]['id']}})[_0xb73c('0x20')](handleEntityNotFound(_0x2c04b7,null))['then'](function(_0x1268b){if(_0x1268b){_0x323121[_0xb73c('0x43')]=_[_0xb73c('0x5c')](db['MailMessage'][_0xb73c('0x40')]);_0x323121['query']=_[_0xb73c('0x5c')](_0x5783f9['query']);_0x323121['filters']=_[_0xb73c('0x47')](_0x323121['model'],_0x323121['query']);_0x1bed76[_0xb73c('0x49')]=_[_0xb73c('0x47')](_0x323121[_0xb73c('0x43')],qs[_0xb73c('0x48')](_0x5783f9[_0xb73c('0x45')]['fields']));_0x1bed76[_0xb73c('0x49')]=_0x1bed76[_0xb73c('0x49')][_0xb73c('0x4a')]?_0x1bed76[_0xb73c('0x49')]:_0x323121[_0xb73c('0x43')];if(!_0x5783f9[_0xb73c('0x45')][_0xb73c('0x4b')](_0xb73c('0x4c'))){_0x1bed76[_0xb73c('0x2f')]=qs[_0xb73c('0x2f')](_0x5783f9[_0xb73c('0x45')][_0xb73c('0x2f')]);_0x1bed76[_0xb73c('0x2d')]=qs['offset'](_0x5783f9[_0xb73c('0x45')][_0xb73c('0x2d')]);}_0x1bed76['order']=qs[_0xb73c('0x4d')](_0x5783f9[_0xb73c('0x45')][_0xb73c('0x4d')]);_0x1bed76[_0xb73c('0x4e')]=qs['filters'](_['pick'](_0x5783f9[_0xb73c('0x45')],_0x323121[_0xb73c('0x46')]));_0x1bed76['where'][_0xb73c('0x61')]=_0x1268b['id'];if(_0x5783f9['query'][_0xb73c('0x50')]){_0x1bed76[_0xb73c('0x4e')]=_[_0xb73c('0x51')](_0x1bed76[_0xb73c('0x4e')],{'$or':_[_0xb73c('0x44')](_0x1bed76[_0xb73c('0x49')],function(_0x59367e){var _0x7e092={};_0x7e092[_0x59367e]={'$like':'%'+_0x5783f9[_0xb73c('0x45')][_0xb73c('0x50')]+'%'};return _0x7e092;})});}if(_0x5783f9[_0xb73c('0x45')][_0xb73c('0x9d')]){var _0x35a291=_0x5783f9[_0xb73c('0x45')][_0xb73c('0x9d')][_0xb73c('0x9e')](',');var _0x3b188c={};_0x3b188c[_0x35a291[0x0]]={'$gte':moment(_0x35a291[0x1])[_0xb73c('0x9f')](_0xb73c('0xa0'))};_0x1bed76['where']=_[_0xb73c('0x51')](_0x1bed76[_0xb73c('0x4e')],_0x3b188c);}_0x1bed76=_[_0xb73c('0x51')]({},_0x1bed76,_0x5783f9[_0xb73c('0x54')]);return db[_0xb73c('0xa1')][_0xb73c('0x30')]({'where':_0x1bed76[_0xb73c('0x4e')]})[_0xb73c('0x20')](function(_0x421ca9){_0x5bf400[_0xb73c('0x30')]=_0x421ca9;if(_0x5783f9['query'][_0xb73c('0x55')]){_0x1bed76[_0xb73c('0x56')]=[{'all':!![]}];}return db[_0xb73c('0xa1')][_0xb73c('0x6d')](_0x1bed76);})[_0xb73c('0x20')](function(_0x354cf7){if(_0x5783f9['query'][_0xb73c('0xa2')]===_0xb73c('0xa3')){for(var _0xec61f5=0x0;_0xec61f5<_0x354cf7[_0xb73c('0x4a')];_0xec61f5++){_0x354cf7[_0xec61f5]['body']=juice(_0x354cf7[_0xec61f5][_0xb73c('0x5e')]);}}_0x5bf400[_0xb73c('0x67')]=_0x354cf7;return _0x5bf400;});}})[_0xb73c('0x20')](respondWithFilteredResult(_0x2c04b7,_0x1bed76))[_0xb73c('0x57')](handleError(_0x2c04b7,null));};exports[_0xb73c('0xa4')]=function(_0x5971a2,_0x4be3b6,_0x2a9546){var _0x3cba28,_0x465428={},_0x26f05e;if(_0x5971a2[_0xb73c('0x5e')]['to']){_0x26f05e=_0x5971a2[_0xb73c('0x5e')]['to']['split'](',')[0x0];}return db[_0xb73c('0x3f')][_0xb73c('0x5d')]({'where':{'id':_0x5971a2[_0xb73c('0x59')]['id']},'include':[{'model':db[_0xb73c('0xa5')],'as':_0xb73c('0xa6'),'include':[{'model':db[_0xb73c('0xa7')],'as':_0xb73c('0xa8'),'where':{'email':_0x26f05e},'limit':0x1,'order':[[_0xb73c('0xa9'),_0xb73c('0xaa')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0xb73c('0x20')](handleEntityNotFound(_0x4be3b6,null))[_0xb73c('0x20')](function(_0x37188c){if(_0x37188c){_0x3cba28=_0x37188c;if(_0x37188c[_0xb73c('0x3c')]){if(_[_0xb73c('0xab')](_0x5971a2['body']['from'])){_0x5971a2[_0xb73c('0x5e')]['from']=util['format']('%s\x20<%s>',_0x37188c[_0xb73c('0x39')],_0x37188c['email']||_0x37188c[_0xb73c('0x3c')]['user']);}if(_0x5971a2['body'][_0xb73c('0xac')]&&_0x5971a2[_0xb73c('0x5e')][_0xb73c('0xac')][_0xb73c('0x4a')]){for(var _0x297c91=0x0;_0x297c91<_0x5971a2[_0xb73c('0x5e')][_0xb73c('0xac')][_0xb73c('0x4a')];_0x297c91+=0x1){_0x5971a2[_0xb73c('0x5e')]['attachments'][_0x297c91]={'filename':_0x5971a2['body'][_0xb73c('0xac')][_0x297c91]['name'],'path':path[_0xb73c('0xad')](config['root'],_0xb73c('0xae'),_0x5971a2[_0xb73c('0x5e')]['attachments'][_0x297c91]['basename'])};}}var _0x15484e={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x37188c['Smtp'][_0xb73c('0x7c')])){if(_0x37188c[_0xb73c('0x3c')][_0xb73c('0x79')]){_0x15484e[_0xb73c('0xaf')]={'user':_0x37188c[_0xb73c('0x3c')][_0xb73c('0x75')],'pass':_0x37188c[_0xb73c('0x3c')][_0xb73c('0x7d')]};}_0x15484e['host']=_0x37188c[_0xb73c('0x3c')][_0xb73c('0x7a')];_0x15484e['port']=_0x37188c[_0xb73c('0x3c')][_0xb73c('0x7b')];_0x15484e['secure']=_0x37188c[_0xb73c('0x3c')][_0xb73c('0xb0')];}else{_0x15484e['service']=_0x37188c[_0xb73c('0x3c')][_0xb73c('0x7c')];_0x15484e[_0xb73c('0xaf')]={'user':_0x37188c[_0xb73c('0x3c')][_0xb73c('0x75')],'pass':_0x37188c[_0xb73c('0x3c')]['pass']};}return respondWithRpcPromise('SendMail',_0xb73c('0xb1'),{'account':_0x15484e,'message':_0x5971a2[_0xb73c('0x5e')]});}else{throw new Error(_0xb73c('0xb2'));}}})[_0xb73c('0x20')](function(_0x5eb0b2){if(_0x5eb0b2){_0x465428=_0x5eb0b2;if(_0x3cba28['List']){if(_0x3cba28[_0xb73c('0xa6')][_0xb73c('0xa8')][_0xb73c('0x4a')]){return _0x3cba28[_0xb73c('0xa6')][_0xb73c('0xa8')][0x0];}else{return db[_0xb73c('0xa7')][_0xb73c('0x62')](_['defaults'](_0x5971a2[_0xb73c('0x5e')],{'firstName':_0x5971a2[_0xb73c('0x5e')]['to'],'email':_0x5971a2[_0xb73c('0x5e')]['to'],'phone':_0x5971a2['body']['to'],'ListId':_0x3cba28[_0xb73c('0x70')]}));}}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x495b4b){if(_0x495b4b){var _0x58d91b={'UserId':_0x5971a2['user']['id'],'ContactId':_0x495b4b['id'],'MailAccountId':_0x3cba28['id'],'inReplyTo':_0x465428[_0xb73c('0xb3')],'to':_0x5971a2[_0xb73c('0x5e')][_0xb73c('0xb4')],'cc':_0x5971a2[_0xb73c('0x5e')]['cc'],'subject':_0x5971a2[_0xb73c('0x5e')][_0xb73c('0xb5')],'attach':_0x5971a2[_0xb73c('0x5e')][_0xb73c('0xb6')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xb73c('0x9f')](_0xb73c('0xa0')),'lastMsgDirection':'out','Messages':[_['merge'](_0x5971a2[_0xb73c('0x5e')],{'messageId':_0x465428[_0xb73c('0xb3')],'sentAt':moment()[_0xb73c('0x9f')](_0xb73c('0xa0')),'read':!![],'MailAccountId':_0x3cba28['id'],'UserId':_0x5971a2[_0xb73c('0x75')]['id'],'ContactId':_0x495b4b['id']})]};if(_0x5971a2[_0xb73c('0x5e')][_0xb73c('0xb7')]){_0x58d91b=_[_0xb73c('0x51')](_0x58d91b,_0x5971a2[_0xb73c('0x5e')][_0xb73c('0xb7')]);}return db['MailInteraction'][_0xb73c('0x62')](_0x58d91b,{'include':[{'model':db['MailMessage'],'as':_0xb73c('0xb8')}]});}})[_0xb73c('0x20')](respondWithResult(_0x4be3b6,null))[_0xb73c('0x57')](handleError(_0x4be3b6,null));};exports[_0xb73c('0xb9')]=function(_0x24a8d7,_0x575159,_0x55f06c){return db['MailAccount'][_0xb73c('0x5d')]({'where':{'id':_0x24a8d7[_0xb73c('0x59')]['id']},'include':[{'model':db[_0xb73c('0x5b')],'as':_0xb73c('0x3c'),'raw':!![]}]})['then'](handleEntityNotFound(_0x575159,null))['then'](function(_0x4085cf){if(_0x4085cf&&_0x4085cf['Smtp']){var _0x1743e9={'id':_0x4085cf['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4085cf[_0xb73c('0x3c')][_0xb73c('0x7c')]){_0x1743e9[_0xb73c('0x7c')]=_0x4085cf[_0xb73c('0x3c')][_0xb73c('0x7c')];}else{_0x1743e9[_0xb73c('0x7a')]=_0x4085cf[_0xb73c('0x3c')][_0xb73c('0x7a')];_0x1743e9[_0xb73c('0x7b')]=_0x4085cf['Smtp'][_0xb73c('0x7b')];_0x1743e9[_0xb73c('0xb0')]=_0x4085cf['Smtp'][_0xb73c('0xb0')];}if(_0x4085cf[_0xb73c('0x3c')][_0xb73c('0x79')]){_0x1743e9[_0xb73c('0xaf')]={'user':_0x4085cf[_0xb73c('0x3c')]['user'],'pass':_0x4085cf[_0xb73c('0x3c')][_0xb73c('0x7d')]};}return respondWithRpcPromise(_0xb73c('0xba'),_0xb73c('0xb9'),{'account':_0x1743e9});}})['then'](respondWithResult(_0x575159,null))[_0xb73c('0x57')](handleError(_0x575159,null));};exports['destroy']=function(_0x49499c,_0x1eb690){return db[_0xb73c('0x3f')][_0xb73c('0x5d')]({'where':{'id':_0x49499c[_0xb73c('0x59')]['id']}})['then'](handleEntityNotFound(_0x1eb690,null))[_0xb73c('0x20')](function(_0x4d1d81){if(_0x4d1d81&&_0x4d1d81['service']){throw new db[(_0xb73c('0xbb'))][(_0xb73c('0xbc'))](_0xb73c('0xbd'));}return _0x4d1d81;})[_0xb73c('0x20')](removeEntity(_0x1eb690,null))['catch'](handleError(_0x1eb690,null));};exports[_0xb73c('0xbe')]=function(_0x450c1c,_0xdc8cb4,_0x269a23){return db[_0xb73c('0x3f')][_0xb73c('0x5d')]({'where':{'id':_0x450c1c[_0xb73c('0x59')]['id']}})['then'](handleEntityNotFound(_0xdc8cb4,null))[_0xb73c('0x20')](function(_0x52160a){if(_0x52160a){return _0x52160a[_0xb73c('0xbe')](_0x450c1c['body'][_0xb73c('0x69')],_[_0xb73c('0xbf')](_0x450c1c[_0xb73c('0x5e')],['ids','id'])||{})['spread'](function(_0x4afa2d){for(var _0x261fef=0x0;_0x261fef<_0x450c1c[_0xb73c('0x5e')][_0xb73c('0x69')]['length'];_0x261fef+=0x1){socket[_0xb73c('0xc0')](_0xb73c('0xc1'),{'UserId':Number(_0x450c1c[_0xb73c('0x5e')][_0xb73c('0x69')][_0x261fef]),'MailAccountId':Number(_0x450c1c['params']['id'])});}return _0x4afa2d;});}})[_0xb73c('0x20')](respondWithResult(_0xdc8cb4,null))[_0xb73c('0x57')](handleError(_0xdc8cb4,null));};exports[_0xb73c('0xc2')]=function(_0x291417,_0x1f489a,_0x249249){return db[_0xb73c('0x3f')][_0xb73c('0x5d')]({'where':{'id':_0x291417[_0xb73c('0x59')]['id']}})[_0xb73c('0x20')](handleEntityNotFound(_0x1f489a,null))[_0xb73c('0x20')](function(_0xf15724){if(_0xf15724){return _0xf15724[_0xb73c('0xc2')](_0x291417[_0xb73c('0x45')][_0xb73c('0x69')])[_0xb73c('0x20')](function(){if(_[_0xb73c('0xc3')](_0x291417['query'][_0xb73c('0x69')])){for(var _0x153b08=0x0;_0x153b08<_0x291417[_0xb73c('0x45')][_0xb73c('0x69')][_0xb73c('0x4a')];_0x153b08+=0x1){socket[_0xb73c('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x291417['query']['ids'][_0x153b08]),'MailAccountId':Number(_0x291417[_0xb73c('0x59')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x291417[_0xb73c('0x45')]['ids']),'MailAccountId':Number(_0x291417['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1f489a,null))[_0xb73c('0x57')](handleError(_0x1f489a,null));};exports[_0xb73c('0xc4')]=function(_0x4bc018,_0x383129,_0x13d41b){var _0x102e49={};var _0xd0ee1={};var _0x39f3a5;var _0x4aaa72;return db[_0xb73c('0x3f')][_0xb73c('0x64')]({'where':{'id':_0x4bc018[_0xb73c('0x59')]['id']}})['then'](handleEntityNotFound(_0x383129,null))[_0xb73c('0x20')](function(_0x3550fc){if(_0x3550fc){_0x39f3a5=_0x3550fc;_0xd0ee1[_0xb73c('0x43')]=_[_0xb73c('0x5c')](db[_0xb73c('0x8d')][_0xb73c('0x40')]);_0xd0ee1[_0xb73c('0x45')]=_[_0xb73c('0x5c')](_0x4bc018[_0xb73c('0x45')]);_0xd0ee1[_0xb73c('0x46')]=_[_0xb73c('0x47')](_0xd0ee1['model'],_0xd0ee1['query']);_0x102e49[_0xb73c('0x49')]=_[_0xb73c('0x47')](_0xd0ee1[_0xb73c('0x43')],qs['fields'](_0x4bc018[_0xb73c('0x45')][_0xb73c('0x48')]));_0x102e49[_0xb73c('0x49')]=_0x102e49['attributes']['length']?_0x102e49['attributes']:_0xd0ee1[_0xb73c('0x43')];_0x102e49['order']=qs[_0xb73c('0x4d')](_0x4bc018[_0xb73c('0x45')][_0xb73c('0x4d')]);_0x102e49[_0xb73c('0x4e')]=qs[_0xb73c('0x46')](_[_0xb73c('0x4f')](_0x4bc018[_0xb73c('0x45')],_0xd0ee1[_0xb73c('0x46')]));if(_0x4bc018['query'][_0xb73c('0x50')]){_0x102e49[_0xb73c('0x4e')]=_[_0xb73c('0x51')](_0x102e49[_0xb73c('0x4e')],{'$or':_[_0xb73c('0x44')](_0x102e49[_0xb73c('0x49')],function(_0x2e0144){var _0x49938c={};_0x49938c[_0x2e0144]={'$like':'%'+_0x4bc018['query'][_0xb73c('0x50')]+'%'};return _0x49938c;})});}_0x102e49=_['merge']({},_0x102e49,_0x4bc018[_0xb73c('0x54')]);return _0x39f3a5[_0xb73c('0xc4')](_0x102e49);}})[_0xb73c('0x20')](function(_0x4a4fbf){if(_0x4a4fbf){_0x4aaa72=_0x4a4fbf['length'];if(!_0x4bc018['query'][_0xb73c('0x4b')](_0xb73c('0x4c'))){_0x102e49[_0xb73c('0x2f')]=qs[_0xb73c('0x2f')](_0x4bc018['query'][_0xb73c('0x2f')]);_0x102e49[_0xb73c('0x2d')]=qs['offset'](_0x4bc018[_0xb73c('0x45')][_0xb73c('0x2d')]);}return _0x39f3a5['getAgents'](_0x102e49);}})[_0xb73c('0x20')](function(_0x25b2f3){if(_0x25b2f3){return _0x25b2f3?{'count':_0x4aaa72,'rows':_0x25b2f3}:null;}})[_0xb73c('0x20')](respondWithResult(_0x383129,null))[_0xb73c('0x57')](handleError(_0x383129,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 73a8e69..0ddcdf8 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 _0x1a62=['MailAccount','save','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x545bed,_0x221e96){var _0x16c79c=function(_0x465346){while(--_0x465346){_0x545bed['push'](_0x545bed['shift']());}};_0x16c79c(++_0x221e96);}(_0x1a62,0x176));var _0x21a6=function(_0x995fd8,_0x25cc4d){_0x995fd8=_0x995fd8-0x0;var _0x1ed791=_0x1a62[_0x995fd8];return _0x1ed791;};'use strict';var EventEmitter=require(_0x21a6('0x0'));var MailAccount=require(_0x21a6('0x1'))['db'][_0x21a6('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x21a6('0x3'),'afterUpdate':_0x21a6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4bc340){return function(_0x488e08,_0x59d6e3,_0x44bbac){MailAccountEvents[_0x21a6('0x5')](_0x4bc340+':'+_0x488e08['id'],_0x488e08);MailAccountEvents[_0x21a6('0x5')](_0x4bc340,_0x488e08);_0x44bbac(null);};}for(var e in events){if(events[_0x21a6('0x6')](e)){var event=events[e];MailAccount[_0x21a6('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x55c3=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x1e7796,_0xd886d7){var _0x23c245=function(_0x184b0a){while(--_0x184b0a){_0x1e7796['push'](_0x1e7796['shift']());}};_0x23c245(++_0xd886d7);}(_0x55c3,0x189));var _0x355c=function(_0x1d6765,_0x163c76){_0x1d6765=_0x1d6765-0x0;var _0x51c104=_0x55c3[_0x1d6765];return _0x51c104;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x355c('0x0'))['db'][_0x355c('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x355c('0x2')](0x0);var events={'afterCreate':_0x355c('0x3'),'afterUpdate':_0x355c('0x4'),'afterDestroy':_0x355c('0x5')};function emitEvent(_0x1f5257){return function(_0x132c7a,_0x1655c1,_0x1c7a4f){MailAccountEvents[_0x355c('0x6')](_0x1f5257+':'+_0x132c7a['id'],_0x132c7a);MailAccountEvents[_0x355c('0x6')](_0x1f5257,_0x132c7a);_0x1c7a4f(null);};}for(var e in events){if(events[_0x355c('0x7')](e)){var event=events[e];MailAccount[_0x355c('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index bc1cbc4..94fa6c8 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 _0x3961=['request-promise','path','rimraf','./mailAccount.attributes','exports','MailAccount','mail_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x39409a,_0x54f60c){var _0xc2aab8=function(_0x45f166){while(--_0x45f166){_0x39409a['push'](_0x39409a['shift']());}};_0xc2aab8(++_0x54f60c);}(_0x3961,0x6f));var _0x1396=function(_0x1f5a63,_0x511504){_0x1f5a63=_0x1f5a63-0x0;var _0x30bb7a=_0x3961[_0x1f5a63];return _0x30bb7a;};'use strict';var _=require(_0x1396('0x0'));var util=require(_0x1396('0x1'));var logger=require(_0x1396('0x2'))(_0x1396('0x3'));var moment=require(_0x1396('0x4'));var BPromise=require(_0x1396('0x5'));var rp=require(_0x1396('0x6'));var fs=require('fs');var path=require(_0x1396('0x7'));var rimraf=require(_0x1396('0x8'));var config=require('../../config/environment');var attributes=require(_0x1396('0x9'));module[_0x1396('0xa')]=function(_0x5eaf9f,_0x2a29b7){return _0x5eaf9f['define'](_0x1396('0xb'),attributes,{'tableName':_0x1396('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6749=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailAccount','mail_accounts','../../config/logger','api'];(function(_0x316c9e,_0x52194f){var _0x19f209=function(_0x4edce7){while(--_0x4edce7){_0x316c9e['push'](_0x316c9e['shift']());}};_0x19f209(++_0x52194f);}(_0x6749,0xae));var _0x9674=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6749[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9674('0x0'))(_0x9674('0x1'));var moment=require('moment');var BPromise=require(_0x9674('0x2'));var rp=require(_0x9674('0x3'));var fs=require('fs');var path=require(_0x9674('0x4'));var rimraf=require(_0x9674('0x5'));var config=require(_0x9674('0x6'));var attributes=require('./mailAccount.attributes');module[_0x9674('0x7')]=function(_0x6fef3b,_0xf33303){return _0x6fef3b[_0x9674('0x8')](_0x9674('0x9'),attributes,{'tableName':_0x9674('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 7afcc22..9bd4904 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 _0x1e6c=['difference','keys','rawAttributes','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','List','CmContact','MailApplication','MailServerOut','get','omit','applications','Applications','list','orderBy','asc','account','autoclose','push','length','close','*,*,*,*','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','update','interaction','create','attachments','originTo','originCc','bcc','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','name','unshift','waitForTheAssignedAgent','startRouting','Start','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetMailAccount','MailAccount','findAll','options','raw','where','limit','include','model','map','attributes','stringify','find','info','ShowMailAccount','body','mail'];(function(_0x5bd4f6,_0xf4e45c){var _0x33a165=function(_0x37eef6){while(--_0x37eef6){_0x5bd4f6['push'](_0x5bd4f6['shift']());}};_0x33a165(++_0xf4e45c);}(_0x1e6c,0x102));var _0xc1e6=function(_0x2114e3,_0x2c3028){_0x2114e3=_0x2114e3-0x0;var _0x6bff25=_0x1e6c[_0x2114e3];return _0x6bff25;};'use strict';var _=require(_0xc1e6('0x0'));var util=require('util');var moment=require(_0xc1e6('0x1'));var BPromise=require(_0xc1e6('0x2'));var rs=require(_0xc1e6('0x3'));var fs=require('fs');var Redis=require(_0xc1e6('0x4'));var db=require(_0xc1e6('0x5'))['db'];var utils=require(_0xc1e6('0x6'));var logger=require(_0xc1e6('0x7'))(_0xc1e6('0x8'));var config=require('../../config/environment');var jayson=require(_0xc1e6('0x9'));var client=jayson[_0xc1e6('0xa')]['http']({'port':0x232c});config['redis']=_[_0xc1e6('0xb')](config[_0xc1e6('0xc')],{'host':_0xc1e6('0xd'),'port':0x18eb});var socket=require(_0xc1e6('0xe'))(new Redis(config[_0xc1e6('0xc')]));require('./mailAccount.socket')[_0xc1e6('0xf')](socket);function respondWithRpcPromise(_0x402fd1,_0x5f196a,_0x504830){return new BPromise(function(_0x368268,_0x559943){return client[_0xc1e6('0x10')](_0x402fd1,_0x504830)[_0xc1e6('0x11')](function(_0x52bcff){logger['info'](_0xc1e6('0x12'),_0x5f196a,_0xc1e6('0x13'));logger[_0xc1e6('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x5f196a,_0xc1e6('0x13'),JSON['stringify'](_0x52bcff));if(_0x52bcff['error']){if(_0x52bcff[_0xc1e6('0x15')][_0xc1e6('0x16')]===0x1f4){logger[_0xc1e6('0x15')]('MailAccount,\x20%s,\x20%s',_0x5f196a,_0x52bcff[_0xc1e6('0x15')][_0xc1e6('0x17')]);return _0x559943(_0x52bcff['error']['message']);}logger[_0xc1e6('0x15')](_0xc1e6('0x12'),_0x5f196a,_0x52bcff[_0xc1e6('0x15')][_0xc1e6('0x17')]);return _0x368268(_0x52bcff[_0xc1e6('0x15')][_0xc1e6('0x17')]);}else{logger['info'](_0xc1e6('0x12'),_0x5f196a,_0xc1e6('0x13'));_0x368268(_0x52bcff[_0xc1e6('0x18')]['message']);}})['catch'](function(_0x105874){logger['error']('MailAccount,\x20%s,\x20%s',_0x5f196a,_0x105874);_0x559943(_0x105874);});});}exports[_0xc1e6('0x19')]=function(_0x4ca0a4){var _0x157fa4=this;return new Promise(function(_0x3f7468,_0x3d3c74){return db[_0xc1e6('0x1a')][_0xc1e6('0x1b')]({'raw':_0x4ca0a4[_0xc1e6('0x1c')]?_0x4ca0a4['options'][_0xc1e6('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ca0a4['options']?_0x4ca0a4[_0xc1e6('0x1c')][_0xc1e6('0x1e')]||null:null,'attributes':_0x4ca0a4[_0xc1e6('0x1c')]?_0x4ca0a4['options']['attributes']||null:null,'limit':_0x4ca0a4[_0xc1e6('0x1c')]?_0x4ca0a4[_0xc1e6('0x1c')][_0xc1e6('0x1f')]||null:null,'include':_0x4ca0a4[_0xc1e6('0x1c')]?_0x4ca0a4['options'][_0xc1e6('0x20')]?_['map'](_0x4ca0a4[_0xc1e6('0x1c')][_0xc1e6('0x20')],function(_0x34ef91){return{'model':db[_0x34ef91[_0xc1e6('0x21')]],'as':_0x34ef91['as'],'attributes':_0x34ef91['attributes'],'include':_0x34ef91['include']?_['map'](_0x34ef91[_0xc1e6('0x20')],function(_0x5db3ef){return{'model':db[_0x5db3ef['model']],'as':_0x5db3ef['as'],'attributes':_0x5db3ef['attributes'],'include':_0x5db3ef['include']?_[_0xc1e6('0x22')](_0x5db3ef[_0xc1e6('0x20')],function(_0x288ad4){return{'model':db[_0x288ad4[_0xc1e6('0x21')]],'as':_0x288ad4['as'],'attributes':_0x288ad4[_0xc1e6('0x23')]};}):[]};}):[]};}):[]:[]})[_0xc1e6('0x11')](function(_0x5c5425){logger['info'](_0xc1e6('0x19'),_0x4ca0a4);logger['debug']('GetMailAccount',_0x4ca0a4,JSON[_0xc1e6('0x24')](_0x5c5425));_0x3f7468(_0x5c5425);})['catch'](function(_0x5bbeb7){logger[_0xc1e6('0x15')](_0xc1e6('0x19'),_0x5bbeb7[_0xc1e6('0x17')],_0x4ca0a4);_0x3d3c74(_0x157fa4[_0xc1e6('0x15')](0x1f4,_0x5bbeb7[_0xc1e6('0x17')]));});});};exports['ShowMailAccount']=function(_0x49a9ae){var _0x55e44e=this;return new Promise(function(_0x28cca6,_0x4799df){return db[_0xc1e6('0x1a')][_0xc1e6('0x25')]({'raw':_0x49a9ae[_0xc1e6('0x1c')]?_0x49a9ae[_0xc1e6('0x1c')][_0xc1e6('0x1d')]===undefined?!![]:![]:!![],'where':_0x49a9ae[_0xc1e6('0x1c')]?_0x49a9ae[_0xc1e6('0x1c')][_0xc1e6('0x1e')]||null:null,'attributes':_0x49a9ae[_0xc1e6('0x1c')]?_0x49a9ae['options'][_0xc1e6('0x23')]||null:null,'include':_0x49a9ae[_0xc1e6('0x1c')]?_0x49a9ae[_0xc1e6('0x1c')][_0xc1e6('0x20')]?_['map'](_0x49a9ae[_0xc1e6('0x1c')]['include'],function(_0x2508df){return{'model':db[_0x2508df[_0xc1e6('0x21')]],'as':_0x2508df['as'],'attributes':_0x2508df[_0xc1e6('0x23')],'include':_0x2508df[_0xc1e6('0x20')]?_['map'](_0x2508df[_0xc1e6('0x20')],function(_0x10862f){return{'model':db[_0x10862f[_0xc1e6('0x21')]],'as':_0x10862f['as'],'attributes':_0x10862f[_0xc1e6('0x23')],'include':_0x10862f[_0xc1e6('0x20')]?_[_0xc1e6('0x22')](_0x10862f[_0xc1e6('0x20')],function(_0x51c0c9){return{'model':db[_0x51c0c9[_0xc1e6('0x21')]],'as':_0x51c0c9['as'],'attributes':_0x51c0c9[_0xc1e6('0x23')]};}):[]};}):[]};}):[]:[]})[_0xc1e6('0x11')](function(_0x2246e3){logger[_0xc1e6('0x26')](_0xc1e6('0x27'),_0x49a9ae);logger[_0xc1e6('0x14')](_0xc1e6('0x27'),_0x49a9ae,JSON[_0xc1e6('0x24')](_0x2246e3));_0x28cca6(_0x2246e3);})['catch'](function(_0x333913){logger[_0xc1e6('0x15')]('ShowMailAccount',_0x333913[_0xc1e6('0x17')],_0x49a9ae);_0x4799df(_0x55e44e[_0xc1e6('0x15')](0x1f4,_0x333913[_0xc1e6('0x17')]));});});};exports['NotifyMailAccount']=function(_0x17ab0a){var _0x4e28b2=this;return new Promise(function(_0x78b4c4,_0x1264ae){var _0x4aa69b={'body':_0x17ab0a[_0xc1e6('0x28')],'channel':_0xc1e6('0x29')};var _0x5c6403=_[_0xc1e6('0x2a')](_[_0xc1e6('0x2b')](db['CmContact'][_0xc1e6('0x2c')]),[_0xc1e6('0x2d'),_0xc1e6('0x2e'),'CompanyId',_0xc1e6('0x2f')]);var _0x3c071b=![];if(_0x17ab0a['body']['id']){delete _0x17ab0a[_0xc1e6('0x28')]['id'];}if(_[_0xc1e6('0x30')](_0x17ab0a[_0xc1e6('0x28')][_0xc1e6('0x31')])){return _0x1264ae(_0x4e28b2['error'](0x1f4,_0xc1e6('0x32')));}if(_[_0xc1e6('0x30')](_0x17ab0a['body']['body'])||_0x17ab0a[_0xc1e6('0x28')][_0xc1e6('0x28')]===''){return _0x1264ae(_0x4e28b2[_0xc1e6('0x15')](0x1f4,_0xc1e6('0x33')));}if(_[_0xc1e6('0x30')](_0x17ab0a[_0xc1e6('0x28')][_0xc1e6('0x34')])){return _0x1264ae(_0x4e28b2[_0xc1e6('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5c6403));}if(!_[_0xc1e6('0x35')](_0x5c6403,_0x17ab0a['body'][_0xc1e6('0x34')])){return _0x1264ae(_0x4e28b2[_0xc1e6('0x15')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5c6403));}var _0x2df1de={};_0x2df1de[_0x17ab0a['body'][_0xc1e6('0x34')]]=_0x17ab0a[_0xc1e6('0x28')][_0xc1e6('0x31')];return db['MailAccount'][_0xc1e6('0x25')]({'where':{'id':_0x17ab0a['account']['id']},'include':[{'model':db[_0xc1e6('0x36')],'as':_0xc1e6('0x37'),'include':[{'model':db[_0xc1e6('0x38')],'as':'Contacts','where':_0x2df1de,'limit':0x1,'order':[[_0xc1e6('0x2e'),'DESC']]}]},{'model':db[_0xc1e6('0x39')],'as':'Applications'},{'model':db[_0xc1e6('0x3a')],'as':'Smtp'}]})[_0xc1e6('0x11')](function(_0x3b4593){if(_0x3b4593&&_0x3b4593[_0xc1e6('0x37')]){var _0x15e0b9=_0x3b4593[_0xc1e6('0x3b')]({'plain':!![]});_0x4aa69b['account']=_[_0xc1e6('0x3c')](_0x15e0b9,['Applications','List']);_0x4aa69b[_0xc1e6('0x3d')]=_0x15e0b9[_0xc1e6('0x3e')];_0x4aa69b[_0xc1e6('0x3f')]=_0x15e0b9[_0xc1e6('0x37')];_0x4aa69b[_0xc1e6('0x3d')]=_[_0xc1e6('0x40')](_0x4aa69b[_0xc1e6('0x3d')],['priority'],[_0xc1e6('0x41')]);if(_0x4aa69b[_0xc1e6('0x42')]&&_0x4aa69b[_0xc1e6('0x42')][_0xc1e6('0x43')]){_0x4aa69b[_0xc1e6('0x3d')][_0xc1e6('0x44')]({'id':0x0,'priority':_0x4aa69b[_0xc1e6('0x3d')][_0xc1e6('0x45')]+0x1,'app':_0xc1e6('0x46'),'appdata':_0xc1e6('0x43'),'interval':_0xc1e6('0x47')});}if(_0x4aa69b[_0xc1e6('0x42')][_0xc1e6('0x3e')]){delete _0x4aa69b['account']['Applications'];}if(_0x4aa69b[_0xc1e6('0x42')][_0xc1e6('0x37')]){delete _0x4aa69b[_0xc1e6('0x42')][_0xc1e6('0x37')];}if(_0x15e0b9[_0xc1e6('0x37')]['Contacts'][_0xc1e6('0x45')]){return _0x15e0b9['List']['Contacts'][0x0];}var _0x32cc4d=_['defaults'](_0x17ab0a[_0xc1e6('0x28')],{'firstName':_0x17ab0a[_0xc1e6('0x28')][_0xc1e6('0x31')],'ListId':_0x15e0b9[_0xc1e6('0x2f')]});_0x32cc4d[_0x17ab0a[_0xc1e6('0x28')][_0xc1e6('0x34')]]=_0x17ab0a[_0xc1e6('0x28')][_0xc1e6('0x31')];return db['CmContact']['create'](_0x32cc4d);}else{throw new Error(_0xc1e6('0x48'));}})[_0xc1e6('0x11')](function(_0x5d0a5e){_0x4aa69b[_0xc1e6('0x49')]=_0x5d0a5e;if(_0x5d0a5e){if(!_0x17ab0a[_0xc1e6('0x28')][_0xc1e6('0x17')][_0xc1e6('0x4a')]){_0x17ab0a[_0xc1e6('0x28')][_0xc1e6('0x17')]['messageId']=rs[_0xc1e6('0x4b')]()+'\x20'+_0x17ab0a[_0xc1e6('0x28')]['message'][_0xc1e6('0x31')];}var _0x4e685f={'ContactId':_0x5d0a5e['id'],'MailAccountId':_0x17ab0a[_0xc1e6('0x42')]['id'],'inReplyTo':_0x17ab0a[_0xc1e6('0x28')][_0xc1e6('0x17')][_0xc1e6('0x4a')],'to':_0x17ab0a['body'][_0xc1e6('0x17')][_0xc1e6('0x31')],'cc':_0x17ab0a[_0xc1e6('0x28')]['message']['cc'],'subject':_0x17ab0a[_0xc1e6('0x28')][_0xc1e6('0x17')][_0xc1e6('0x4c')],'attach':_0x17ab0a[_0xc1e6('0x28')][_0xc1e6('0x17')][_0xc1e6('0x4d')],'lastMsgAt':moment()[_0xc1e6('0x4e')](_0xc1e6('0x4f')),'lastMsgDirection':'in'};return db[_0xc1e6('0x50')]['find']({'where':{'closed':![],'MailAccountId':_0x17ab0a[_0xc1e6('0x42')]['id']},'include':[{'model':db[_0xc1e6('0x51')],'as':_0xc1e6('0x52'),'attributes':[_0xc1e6('0x4a')],'where':{'messageId':_0x17ab0a[_0xc1e6('0x28')][_0xc1e6('0x17')]['inReplyTo']}}]})['then'](function(_0x407ed5){if(_0x407ed5){return[_0x407ed5,![]];}return db[_0xc1e6('0x50')]['create'](_0x4e685f)[_0xc1e6('0x11')](function(_0x2f9a20){return[_0x2f9a20,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2df9ac,_0x282337){if(_0x2df9ac){_0x3c071b=_0x282337;if(!_0x282337){return _0x2df9ac[_0xc1e6('0x53')]({'inReplyTo':_0x17ab0a[_0xc1e6('0x28')]['message'][_0xc1e6('0x4a')],'to':_0x17ab0a['body'][_0xc1e6('0x17')]['from'],'cc':_0x17ab0a[_0xc1e6('0x28')]['message']['cc'],'subject':_0x17ab0a[_0xc1e6('0x28')][_0xc1e6('0x17')]['subject'],'attach':_0x2df9ac[_0xc1e6('0x4d')]?_0x2df9ac['attach']:_0x17ab0a[_0xc1e6('0x28')][_0xc1e6('0x17')]['attach'],'substatus':null,'substatusAt':moment()[_0xc1e6('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xc1e6('0x4e')](_0xc1e6('0x4f')),'lastMsgDirection':'in'});}else{return _0x2df9ac;}}})['then'](function(_0x4b1bd8){_0x4aa69b[_0xc1e6('0x54')]=_0x4b1bd8[_0xc1e6('0x3b')]({'plain':!![]});_0x4aa69b['interaction']['created']=_0x3c071b;return db['MailMessage'][_0xc1e6('0x55')]({'body':_0x17ab0a['body'][_0xc1e6('0x28')],'MailAccountId':_0x17ab0a[_0xc1e6('0x42')]['id'],'MailInteractionId':_0x4b1bd8['id'],'direction':'in','ContactId':_0x4aa69b['contact']['id'],'messageId':_0x17ab0a['body'][_0xc1e6('0x17')]['messageId'],'from':_0x17ab0a[_0xc1e6('0x28')]['message'][_0xc1e6('0x31')],'to':_0x17ab0a[_0xc1e6('0x28')]['message']['to'],'cc':_0x17ab0a[_0xc1e6('0x28')]['message']['cc'],'subject':_0x17ab0a['body'][_0xc1e6('0x17')][_0xc1e6('0x4c')],'attach':_0x17ab0a[_0xc1e6('0x28')]['message'][_0xc1e6('0x4d')],'Attachments':_0x17ab0a[_0xc1e6('0x28')][_0xc1e6('0x17')][_0xc1e6('0x56')],'originTo':_0x17ab0a['body'][_0xc1e6('0x17')][_0xc1e6('0x57')],'originCc':_0x17ab0a[_0xc1e6('0x28')][_0xc1e6('0x17')][_0xc1e6('0x58')],'bcc':_0x17ab0a['body'][_0xc1e6('0x17')][_0xc1e6('0x59')],'ChatWebsiteId':_0x17ab0a['body'][_0xc1e6('0x17')]['ChatWebsiteId']||null,'originChannel':_0x17ab0a[_0xc1e6('0x28')][_0xc1e6('0x17')][_0xc1e6('0x5a')]||'Email','ChatOfflineMessageId':_0x17ab0a[_0xc1e6('0x28')][_0xc1e6('0x17')][_0xc1e6('0x5b')]||null},{'include':[{'model':db[_0xc1e6('0x5c')],'as':_0xc1e6('0x5d')}]});})[_0xc1e6('0x11')](function(_0x76df0a){_0x4aa69b['message']=_0x76df0a;if(_0x4aa69b[_0xc1e6('0x54')][_0xc1e6('0x5e')]){return db['User'][_0xc1e6('0x25')]({'attributes':['id',_0xc1e6('0x5f')],'where':{'id':_0x4aa69b[_0xc1e6('0x54')][_0xc1e6('0x5e')]}})[_0xc1e6('0x11')](function(_0x3d31ea){if(_0x3d31ea){_0x4aa69b[_0xc1e6('0x3d')][_0xc1e6('0x60')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3d31ea[_0xc1e6('0x5f')]+','+(_0x4aa69b[_0xc1e6('0x42')][_0xc1e6('0x61')]||0xa),'interval':_0xc1e6('0x47')});}return respondWithRpcPromise('Start',_0xc1e6('0x62'),_0x4aa69b);});}return respondWithRpcPromise(_0xc1e6('0x63'),_0xc1e6('0x62'),_0x4aa69b);})[_0xc1e6('0x11')](function(_0x3aeee0){_0x78b4c4(_0x3aeee0);})['catch'](function(_0x5ef7c4){_0x1264ae(_0x4e28b2[_0xc1e6('0x15')](0x1f4,_0x5ef7c4[_0xc1e6('0x17')]));});});}; \ No newline at end of file +var _0x58b9=['NotifyMailAccount','mail','difference','keys','CmContact','createdAt','CompanyId','ListId','body','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','updatedAt','DESC','MailApplication','Applications','MailServerOut','Smtp','get','applications','orderBy','priority','asc','autoclose','push','length','close','Contacts','List\x20not\x20found','contact','messageId','generate','format','inReplyTo','create','spread','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','created','subject','attachments','originTo','originCc','bcc','ChatWebsiteId','ChatOfflineMessageId','Attachment','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x58b9,0xa1));var _0x958b=function(_0x1b2f46,_0x3cf323){_0x1b2f46=_0x1b2f46-0x0;var _0x3c13de=_0x58b9[_0x1b2f46];return _0x3c13de;};'use strict';var _=require(_0x958b('0x0'));var util=require(_0x958b('0x1'));var moment=require(_0x958b('0x2'));var BPromise=require(_0x958b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x958b('0x4'))('rpc');var config=require(_0x958b('0x5'));var jayson=require(_0x958b('0x6'));var client=jayson[_0x958b('0x7')]['http']({'port':0x232c});config[_0x958b('0x8')]=_[_0x958b('0x9')](config[_0x958b('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x958b('0xa'))[_0x958b('0xb')](socket);function respondWithRpcPromise(_0x54af98,_0x3b59e8,_0x473b38){return new BPromise(function(_0x5728e0,_0x214532){return client[_0x958b('0xc')](_0x54af98,_0x473b38)[_0x958b('0xd')](function(_0x75e7cc){logger[_0x958b('0xe')](_0x958b('0xf'),_0x3b59e8,'request\x20sent');logger[_0x958b('0x10')](_0x958b('0x11'),_0x3b59e8,_0x958b('0x12'),JSON[_0x958b('0x13')](_0x75e7cc));if(_0x75e7cc['error']){if(_0x75e7cc['error'][_0x958b('0x14')]===0x1f4){logger[_0x958b('0x15')]('MailAccount,\x20%s,\x20%s',_0x3b59e8,_0x75e7cc[_0x958b('0x15')][_0x958b('0x16')]);return _0x214532(_0x75e7cc[_0x958b('0x15')][_0x958b('0x16')]);}logger[_0x958b('0x15')](_0x958b('0xf'),_0x3b59e8,_0x75e7cc[_0x958b('0x15')][_0x958b('0x16')]);return _0x5728e0(_0x75e7cc[_0x958b('0x15')][_0x958b('0x16')]);}else{logger[_0x958b('0xe')](_0x958b('0xf'),_0x3b59e8,'request\x20sent');_0x5728e0(_0x75e7cc[_0x958b('0x17')][_0x958b('0x16')]);}})[_0x958b('0x18')](function(_0x5791a5){logger[_0x958b('0x15')](_0x958b('0xf'),_0x3b59e8,_0x5791a5);_0x214532(_0x5791a5);});});}exports[_0x958b('0x19')]=function(_0x326cf6){var _0x5ae56f=this;return new Promise(function(_0x1030d5,_0x6f481d){return db[_0x958b('0x1a')]['findAll']({'raw':_0x326cf6[_0x958b('0x1b')]?_0x326cf6[_0x958b('0x1b')][_0x958b('0x1c')]===undefined?!![]:![]:!![],'where':_0x326cf6[_0x958b('0x1b')]?_0x326cf6['options'][_0x958b('0x1d')]||null:null,'attributes':_0x326cf6[_0x958b('0x1b')]?_0x326cf6[_0x958b('0x1b')][_0x958b('0x1e')]||null:null,'limit':_0x326cf6[_0x958b('0x1b')]?_0x326cf6[_0x958b('0x1b')][_0x958b('0x1f')]||null:null,'include':_0x326cf6[_0x958b('0x1b')]?_0x326cf6[_0x958b('0x1b')][_0x958b('0x20')]?_[_0x958b('0x21')](_0x326cf6[_0x958b('0x1b')][_0x958b('0x20')],function(_0x19076c){return{'model':db[_0x19076c['model']],'as':_0x19076c['as'],'attributes':_0x19076c[_0x958b('0x1e')],'include':_0x19076c[_0x958b('0x20')]?_[_0x958b('0x21')](_0x19076c[_0x958b('0x20')],function(_0x42a8e7){return{'model':db[_0x42a8e7[_0x958b('0x22')]],'as':_0x42a8e7['as'],'attributes':_0x42a8e7[_0x958b('0x1e')],'include':_0x42a8e7['include']?_['map'](_0x42a8e7[_0x958b('0x20')],function(_0x4b5a79){return{'model':db[_0x4b5a79[_0x958b('0x22')]],'as':_0x4b5a79['as'],'attributes':_0x4b5a79[_0x958b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x958b('0xd')](function(_0x4cd371){logger[_0x958b('0xe')](_0x958b('0x19'),_0x326cf6);logger['debug'](_0x958b('0x19'),_0x326cf6,JSON[_0x958b('0x13')](_0x4cd371));_0x1030d5(_0x4cd371);})[_0x958b('0x18')](function(_0x3a5d9c){logger[_0x958b('0x15')](_0x958b('0x19'),_0x3a5d9c[_0x958b('0x16')],_0x326cf6);_0x6f481d(_0x5ae56f[_0x958b('0x15')](0x1f4,_0x3a5d9c['message']));});});};exports[_0x958b('0x23')]=function(_0x4b4ef4){var _0x3df76c=this;return new Promise(function(_0x1f1fca,_0x938d0c){return db[_0x958b('0x1a')][_0x958b('0x24')]({'raw':_0x4b4ef4['options']?_0x4b4ef4[_0x958b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4b4ef4[_0x958b('0x1b')]?_0x4b4ef4[_0x958b('0x1b')]['where']||null:null,'attributes':_0x4b4ef4[_0x958b('0x1b')]?_0x4b4ef4[_0x958b('0x1b')][_0x958b('0x1e')]||null:null,'include':_0x4b4ef4[_0x958b('0x1b')]?_0x4b4ef4['options'][_0x958b('0x20')]?_['map'](_0x4b4ef4[_0x958b('0x1b')][_0x958b('0x20')],function(_0x4332ba){return{'model':db[_0x4332ba[_0x958b('0x22')]],'as':_0x4332ba['as'],'attributes':_0x4332ba[_0x958b('0x1e')],'include':_0x4332ba['include']?_[_0x958b('0x21')](_0x4332ba[_0x958b('0x20')],function(_0x428d77){return{'model':db[_0x428d77[_0x958b('0x22')]],'as':_0x428d77['as'],'attributes':_0x428d77[_0x958b('0x1e')],'include':_0x428d77[_0x958b('0x20')]?_['map'](_0x428d77[_0x958b('0x20')],function(_0x47f24a){return{'model':db[_0x47f24a[_0x958b('0x22')]],'as':_0x47f24a['as'],'attributes':_0x47f24a['attributes']};}):[]};}):[]};}):[]:[]})[_0x958b('0xd')](function(_0x587446){logger[_0x958b('0xe')](_0x958b('0x23'),_0x4b4ef4);logger['debug'](_0x958b('0x23'),_0x4b4ef4,JSON[_0x958b('0x13')](_0x587446));_0x1f1fca(_0x587446);})['catch'](function(_0x52f794){logger['error'](_0x958b('0x23'),_0x52f794['message'],_0x4b4ef4);_0x938d0c(_0x3df76c[_0x958b('0x15')](0x1f4,_0x52f794['message']));});});};exports[_0x958b('0x25')]=function(_0x78e8c0){var _0x4a7964=this;return new Promise(function(_0x30218b,_0x725ed5){var _0x10a4a8={'body':_0x78e8c0['body'],'channel':_0x958b('0x26')};var _0x1ef53c=_[_0x958b('0x27')](_[_0x958b('0x28')](db[_0x958b('0x29')]['rawAttributes']),[_0x958b('0x2a'),'updatedAt',_0x958b('0x2b'),_0x958b('0x2c')]);var _0x21cf8e=![];if(_0x78e8c0['body']['id']){delete _0x78e8c0[_0x958b('0x2d')]['id'];}if(_['isNil'](_0x78e8c0['body'][_0x958b('0x2e')])){return _0x725ed5(_0x4a7964[_0x958b('0x15')](0x1f4,_0x958b('0x2f')));}if(_[_0x958b('0x30')](_0x78e8c0['body'][_0x958b('0x2d')])||_0x78e8c0[_0x958b('0x2d')][_0x958b('0x2d')]===''){return _0x725ed5(_0x4a7964[_0x958b('0x15')](0x1f4,_0x958b('0x31')));}if(_['isNil'](_0x78e8c0[_0x958b('0x2d')][_0x958b('0x32')])){return _0x725ed5(_0x4a7964[_0x958b('0x15')](0x1f4,_0x958b('0x33')+_0x1ef53c));}if(!_[_0x958b('0x34')](_0x1ef53c,_0x78e8c0[_0x958b('0x2d')]['mapKey'])){return _0x725ed5(_0x4a7964[_0x958b('0x15')](0x1f4,_0x958b('0x35')+_0x1ef53c));}var _0x5d606b={};_0x5d606b[_0x78e8c0[_0x958b('0x2d')][_0x958b('0x32')]]=_0x78e8c0[_0x958b('0x2d')][_0x958b('0x2e')];return db['MailAccount']['find']({'where':{'id':_0x78e8c0[_0x958b('0x36')]['id']},'include':[{'model':db[_0x958b('0x37')],'as':_0x958b('0x38'),'include':[{'model':db[_0x958b('0x29')],'as':'Contacts','where':_0x5d606b,'limit':0x1,'order':[[_0x958b('0x39'),_0x958b('0x3a')]]}]},{'model':db[_0x958b('0x3b')],'as':_0x958b('0x3c')},{'model':db[_0x958b('0x3d')],'as':_0x958b('0x3e')}]})[_0x958b('0xd')](function(_0x5f5928){if(_0x5f5928&&_0x5f5928['List']){var _0x1fc82d=_0x5f5928[_0x958b('0x3f')]({'plain':!![]});_0x10a4a8['account']=_['omit'](_0x1fc82d,[_0x958b('0x3c'),_0x958b('0x38')]);_0x10a4a8['applications']=_0x1fc82d[_0x958b('0x3c')];_0x10a4a8['list']=_0x1fc82d['List'];_0x10a4a8[_0x958b('0x40')]=_[_0x958b('0x41')](_0x10a4a8['applications'],[_0x958b('0x42')],[_0x958b('0x43')]);if(_0x10a4a8[_0x958b('0x36')]&&_0x10a4a8[_0x958b('0x36')][_0x958b('0x44')]){_0x10a4a8[_0x958b('0x40')][_0x958b('0x45')]({'id':0x0,'priority':_0x10a4a8[_0x958b('0x40')][_0x958b('0x46')]+0x1,'app':_0x958b('0x47'),'appdata':'autoclose','interval':'*,*,*,*'});}if(_0x10a4a8['account'][_0x958b('0x3c')]){delete _0x10a4a8[_0x958b('0x36')][_0x958b('0x3c')];}if(_0x10a4a8[_0x958b('0x36')][_0x958b('0x38')]){delete _0x10a4a8['account'][_0x958b('0x38')];}if(_0x1fc82d[_0x958b('0x38')][_0x958b('0x48')][_0x958b('0x46')]){return _0x1fc82d[_0x958b('0x38')][_0x958b('0x48')][0x0];}var _0x53d6b8=_[_0x958b('0x9')](_0x78e8c0[_0x958b('0x2d')],{'firstName':_0x78e8c0[_0x958b('0x2d')][_0x958b('0x2e')],'ListId':_0x1fc82d[_0x958b('0x2c')]});_0x53d6b8[_0x78e8c0['body']['mapKey']]=_0x78e8c0[_0x958b('0x2d')][_0x958b('0x2e')];return db[_0x958b('0x29')]['create'](_0x53d6b8);}else{throw new Error(_0x958b('0x49'));}})[_0x958b('0xd')](function(_0x139688){_0x10a4a8[_0x958b('0x4a')]=_0x139688;if(_0x139688){if(!_0x78e8c0['body'][_0x958b('0x16')][_0x958b('0x4b')]){_0x78e8c0['body'][_0x958b('0x16')][_0x958b('0x4b')]=rs[_0x958b('0x4c')]()+'\x20'+_0x78e8c0[_0x958b('0x2d')][_0x958b('0x16')][_0x958b('0x2e')];}var _0x488ca5={'ContactId':_0x139688['id'],'MailAccountId':_0x78e8c0['account']['id'],'inReplyTo':_0x78e8c0['body'][_0x958b('0x16')]['messageId'],'to':_0x78e8c0[_0x958b('0x2d')]['message'][_0x958b('0x2e')],'cc':_0x78e8c0[_0x958b('0x2d')][_0x958b('0x16')]['cc'],'subject':_0x78e8c0[_0x958b('0x2d')][_0x958b('0x16')]['subject'],'attach':_0x78e8c0['body']['message']['attach'],'lastMsgAt':moment()[_0x958b('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0x958b('0x24')]({'where':{'closed':![],'MailAccountId':_0x78e8c0['account']['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x958b('0x4b')],'where':{'messageId':_0x78e8c0[_0x958b('0x2d')][_0x958b('0x16')][_0x958b('0x4e')]}}]})['then'](function(_0x1e647e){if(_0x1e647e){return[_0x1e647e,![]];}return db['MailInteraction'][_0x958b('0x4f')](_0x488ca5)[_0x958b('0xd')](function(_0x10f72e){return[_0x10f72e,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x958b('0x50')](function(_0x2f0a03,_0x50b9bc){if(_0x2f0a03){_0x21cf8e=_0x50b9bc;if(!_0x50b9bc){return _0x2f0a03['update']({'inReplyTo':_0x78e8c0[_0x958b('0x2d')][_0x958b('0x16')][_0x958b('0x4b')],'to':_0x78e8c0[_0x958b('0x2d')]['message']['from'],'cc':_0x78e8c0[_0x958b('0x2d')][_0x958b('0x16')]['cc'],'subject':_0x78e8c0[_0x958b('0x2d')][_0x958b('0x16')]['subject'],'attach':_0x2f0a03['attach']?_0x2f0a03[_0x958b('0x51')]:_0x78e8c0[_0x958b('0x2d')][_0x958b('0x16')][_0x958b('0x51')],'substatus':null,'substatusAt':moment()['format'](_0x958b('0x52')),'lastMsgAt':moment()[_0x958b('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x2f0a03;}}})[_0x958b('0xd')](function(_0x5299ad){_0x10a4a8[_0x958b('0x53')]=_0x5299ad['get']({'plain':!![]});_0x10a4a8['interaction'][_0x958b('0x54')]=_0x21cf8e;return db['MailMessage'][_0x958b('0x4f')]({'body':_0x78e8c0[_0x958b('0x2d')][_0x958b('0x2d')],'MailAccountId':_0x78e8c0['account']['id'],'MailInteractionId':_0x5299ad['id'],'direction':'in','ContactId':_0x10a4a8['contact']['id'],'messageId':_0x78e8c0[_0x958b('0x2d')][_0x958b('0x16')][_0x958b('0x4b')],'from':_0x78e8c0[_0x958b('0x2d')][_0x958b('0x16')][_0x958b('0x2e')],'to':_0x78e8c0[_0x958b('0x2d')][_0x958b('0x16')]['to'],'cc':_0x78e8c0['body'][_0x958b('0x16')]['cc'],'subject':_0x78e8c0['body'][_0x958b('0x16')][_0x958b('0x55')],'attach':_0x78e8c0[_0x958b('0x2d')][_0x958b('0x16')]['attach'],'Attachments':_0x78e8c0[_0x958b('0x2d')][_0x958b('0x16')][_0x958b('0x56')],'originTo':_0x78e8c0[_0x958b('0x2d')][_0x958b('0x16')][_0x958b('0x57')],'originCc':_0x78e8c0['body'][_0x958b('0x16')][_0x958b('0x58')],'bcc':_0x78e8c0[_0x958b('0x2d')][_0x958b('0x16')][_0x958b('0x59')],'ChatWebsiteId':_0x78e8c0[_0x958b('0x2d')]['message'][_0x958b('0x5a')]||null,'originChannel':_0x78e8c0[_0x958b('0x2d')][_0x958b('0x16')]['originChannel']||'Email','ChatOfflineMessageId':_0x78e8c0[_0x958b('0x2d')][_0x958b('0x16')][_0x958b('0x5b')]||null},{'include':[{'model':db[_0x958b('0x5c')],'as':'Attachments'}]});})[_0x958b('0xd')](function(_0x5c9d16){_0x10a4a8['message']=_0x5c9d16;if(_0x10a4a8['interaction'][_0x958b('0x5d')]){return db['User'][_0x958b('0x24')]({'attributes':['id','name'],'where':{'id':_0x10a4a8[_0x958b('0x53')][_0x958b('0x5d')]}})[_0x958b('0xd')](function(_0x44a7fe){if(_0x44a7fe){_0x10a4a8[_0x958b('0x40')][_0x958b('0x5e')]({'id':0x0,'priority':0x0,'app':_0x958b('0x5f'),'appdata':_0x44a7fe['name']+','+(_0x10a4a8[_0x958b('0x36')][_0x958b('0x60')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x958b('0x61'),_0x958b('0x62'),_0x10a4a8);});}return respondWithRpcPromise('Start',_0x958b('0x62'),_0x10a4a8);})['then'](function(_0x440479){_0x30218b(_0x440479);})[_0x958b('0x18')](function(_0x432eb2){_0x725ed5(_0x4a7964['error'](0x1f4,_0x432eb2[_0x958b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 042ddf7..4be0701 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 _0x51f9=['update','emit','removeListener','register','mailAccount:','./mailAccount.events'];(function(_0x22a5ab,_0x36efee){var _0x3d183c=function(_0x1f2814){while(--_0x1f2814){_0x22a5ab['push'](_0x22a5ab['shift']());}};_0x3d183c(++_0x36efee);}(_0x51f9,0x1eb));var _0x951f=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0x51f9[_0x37e886];return _0x57c5cd;};'use strict';var MailAccountEvents=require(_0x951f('0x0'));var events=['save','remove',_0x951f('0x1')];function createListener(_0x5bb784,_0x554fab){return function(_0x163d1c){_0x554fab[_0x951f('0x2')](_0x5bb784,_0x163d1c);};}function removeListener(_0x57efe5,_0x59a9f1){return function(){MailAccountEvents[_0x951f('0x3')](_0x57efe5,_0x59a9f1);};}exports[_0x951f('0x4')]=function(_0x13afb9){for(var _0x275c1f=0x0,_0x5813a1=events['length'];_0x275c1f<_0x5813a1;_0x275c1f++){var _0x14f2a7=events[_0x275c1f];var _0x14377b=createListener(_0x951f('0x5')+_0x14f2a7,_0x13afb9);MailAccountEvents['on'](_0x14f2a7,_0x14377b);}}; \ No newline at end of file +var _0xaebe=['emit','removeListener','register','./mailAccount.events','save','remove'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xaebe,0xed));var _0xeaeb=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xaebe[_0xa148b7];return _0x51efd3;};'use strict';var MailAccountEvents=require(_0xeaeb('0x0'));var events=[_0xeaeb('0x1'),_0xeaeb('0x2'),'update'];function createListener(_0x5df6de,_0x27ddc8){return function(_0xd4fde){_0x27ddc8[_0xeaeb('0x3')](_0x5df6de,_0xd4fde);};}function removeListener(_0x32642a,_0x4e6464){return function(){MailAccountEvents[_0xeaeb('0x4')](_0x32642a,_0x4e6464);};}exports[_0xeaeb('0x5')]=function(_0x2d542c){for(var _0x1a1a6c=0x0,_0x21fd10=events['length'];_0x1a1a6c<_0x21fd10;_0x1a1a6c++){var _0x2fb29c=events[_0x1a1a6c];var _0x4a479c=createListener('mailAccount:'+_0x2fb29c,_0x2d542c);MailAccountEvents['on'](_0x2fb29c,_0x4a479c);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index e176d7b..eea35b2 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 _0xc06d=['../../components/interaction/service','./mailApplication.controller','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','path','express','fs-extra'];(function(_0x1401d9,_0xaf8767){var _0x5dc753=function(_0x4aef50){while(--_0x4aef50){_0x1401d9['push'](_0x1401d9['shift']());}};_0x5dc753(++_0xaf8767);}(_0xc06d,0x1b6));var _0xdc06=function(_0x28e166,_0x12408b){_0x28e166=_0x28e166-0x0;var _0x24d020=_0xc06d[_0x28e166];return _0x24d020;};'use strict';var multer=require(_0xdc06('0x0'));var util=require('util');var path=require(_0xdc06('0x1'));var timeout=require('connect-timeout');var express=require(_0xdc06('0x2'));var router=express['Router']();var fs_extra=require(_0xdc06('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdc06('0x4'));var config=require('../../config/environment');var controller=require(_0xdc06('0x5'));router['get']('/:id',auth[_0xdc06('0x6')](),controller['show']);router[_0xdc06('0x7')](_0xdc06('0x8'),auth['isAuthenticated'](),controller[_0xdc06('0x9')]);router[_0xdc06('0xa')]('/:id',auth[_0xdc06('0x6')](),controller[_0xdc06('0xb')]);module[_0xdc06('0xc')]=router; \ No newline at end of file +var _0xb836=['../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x280f7c,_0x45afab){var _0x5117d7=function(_0x660ffb){while(--_0x660ffb){_0x280f7c['push'](_0x280f7c['shift']());}};_0x5117d7(++_0x45afab);}(_0xb836,0x6a));var _0x6b83=function(_0x30aa79,_0x361fb1){_0x30aa79=_0x30aa79-0x0;var _0x297a74=_0xb836[_0x30aa79];return _0x297a74;};'use strict';var multer=require(_0x6b83('0x0'));var util=require(_0x6b83('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b83('0x2'));var router=express[_0x6b83('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6b83('0x4'));var interaction=require(_0x6b83('0x5'));var config=require(_0x6b83('0x6'));var controller=require(_0x6b83('0x7'));router[_0x6b83('0x8')](_0x6b83('0x9'),auth[_0x6b83('0xa')](),controller['show']);router[_0x6b83('0xb')](_0x6b83('0x9'),auth[_0x6b83('0xa')](),controller[_0x6b83('0xc')]);router[_0x6b83('0xd')]('/:id',auth[_0x6b83('0xa')](),controller[_0x6b83('0xe')]);module[_0x6b83('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 26dff6a..b0c6d1d 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 _0x20e0=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x20e0,0x77));var _0x020e=function(_0x49a99b,_0xa11c2b){_0x49a99b=_0x49a99b-0x0;var _0x4e4409=_0x20e0[_0x49a99b];return _0x4e4409;};'use strict';var Sequelize=require(_0x020e('0x0'));module[_0x020e('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x020e('0x2')],'allowNull':![],'defaultValue':_0x020e('0x3')},'appdata':{'type':Sequelize[_0x020e('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x020e('0x2')],'defaultValue':_0x020e('0x5')}}; \ No newline at end of file +var _0xcbf1=['*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x487a75,_0x55046d){var _0x507103=function(_0x307abb){while(--_0x307abb){_0x487a75['push'](_0x487a75['shift']());}};_0x507103(++_0x55046d);}(_0xcbf1,0x196));var _0x1cbf=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xcbf1[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x1cbf('0x0'));module[_0x1cbf('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x1cbf('0x2')],'allowNull':![],'defaultValue':_0x1cbf('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1cbf('0x2')],'defaultValue':_0x1cbf('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 38e674d..0b7ad7f 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x145e9e,_0x2e6dd4){var _0x2264c2=function(_0x57d209){while(--_0x57d209){_0x145e9e['push'](_0x145e9e['shift']());}};_0x2264c2(++_0x2e6dd4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file +var _0xa9e0=['includeAll','merge','options','find','catch','body','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','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x4084c3,_0x158ffa){var _0x52c325=function(_0x35fa30){while(--_0x35fa30){_0x4084c3['push'](_0x4084c3['shift']());}};_0x52c325(++_0x158ffa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index c6c4c17..0a651ac 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 _0x7bdb=['util','api','bluebird','request-promise','rimraf','./mailApplication.attributes','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x5c3f83,_0x55e38d){var _0x2fa920=function(_0x35b4e1){while(--_0x35b4e1){_0x5c3f83['push'](_0x5c3f83['shift']());}};_0x2fa920(++_0x55e38d);}(_0x7bdb,0x154));var _0xb7bd=function(_0xcc69c5,_0x5b35b2){_0xcc69c5=_0xcc69c5-0x0;var _0x14ec59=_0x7bdb[_0xcc69c5];return _0x14ec59;};'use strict';var _=require(_0xb7bd('0x0'));var util=require(_0xb7bd('0x1'));var logger=require('../../config/logger')(_0xb7bd('0x2'));var moment=require('moment');var BPromise=require(_0xb7bd('0x3'));var rp=require(_0xb7bd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7bd('0x5'));var config=require('../../config/environment');var attributes=require(_0xb7bd('0x6'));module['exports']=function(_0x1613b7,_0xe79c23){return _0x1613b7['define'](_0xb7bd('0x7'),attributes,{'tableName':_0xb7bd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb7bd('0x9'),'collate':_0xb7bd('0xa')});}; \ No newline at end of file +var _0x874c=['mail_applications','utf8mb4','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define'];(function(_0x50d103,_0x1b5a53){var _0x4c766b=function(_0x379fd4){while(--_0x379fd4){_0x50d103['push'](_0x50d103['shift']());}};_0x4c766b(++_0x1b5a53);}(_0x874c,0x91));var _0xc874=function(_0x5c3f4f,_0x49ab76){_0x5c3f4f=_0x5c3f4f-0x0;var _0x229c94=_0x874c[_0x5c3f4f];return _0x229c94;};'use strict';var _=require(_0xc874('0x0'));var util=require(_0xc874('0x1'));var logger=require('../../config/logger')(_0xc874('0x2'));var moment=require('moment');var BPromise=require(_0xc874('0x3'));var rp=require(_0xc874('0x4'));var fs=require('fs');var path=require(_0xc874('0x5'));var rimraf=require(_0xc874('0x6'));var config=require(_0xc874('0x7'));var attributes=require(_0xc874('0x8'));module[_0xc874('0x9')]=function(_0x281ae3,_0x24054f){return _0x281ae3[_0xc874('0xa')]('MailApplication',attributes,{'tableName':_0xc874('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc874('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 52b62be..424bdf0 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 _0x8988=['info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailApplication','MailApplication','update','body','options','raw','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','then'];(function(_0x341b82,_0x2daf5e){var _0x31a84a=function(_0x28d23c){while(--_0x28d23c){_0x341b82['push'](_0x341b82['shift']());}};_0x31a84a(++_0x2daf5e);}(_0x8988,0xcf));var _0x8898=function(_0x4810b6,_0x30a0f4){_0x4810b6=_0x4810b6-0x0;var _0x273ee4=_0x8988[_0x4810b6];return _0x273ee4;};'use strict';var _=require(_0x8898('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8898('0x1'));var rs=require(_0x8898('0x2'));var fs=require('fs');var Redis=require(_0x8898('0x3'));var db=require(_0x8898('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8898('0x5'));var config=require('../../config/environment');var jayson=require(_0x8898('0x6'));var client=jayson['client'][_0x8898('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x163ed8,_0x4d9f6e,_0x38d76d){return new BPromise(function(_0x51ab3b,_0x301c4f){return client['request'](_0x163ed8,_0x38d76d)[_0x8898('0x8')](function(_0x2d04f0){logger[_0x8898('0x9')](_0x8898('0xa'),_0x4d9f6e,_0x8898('0xb'));logger[_0x8898('0xc')](_0x8898('0xd'),_0x4d9f6e,_0x8898('0xb'),JSON[_0x8898('0xe')](_0x2d04f0));if(_0x2d04f0[_0x8898('0xf')]){if(_0x2d04f0[_0x8898('0xf')][_0x8898('0x10')]===0x1f4){logger[_0x8898('0xf')](_0x8898('0xa'),_0x4d9f6e,_0x2d04f0[_0x8898('0xf')]['message']);return _0x301c4f(_0x2d04f0[_0x8898('0xf')][_0x8898('0x11')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x4d9f6e,_0x2d04f0[_0x8898('0xf')][_0x8898('0x11')]);return _0x51ab3b(_0x2d04f0[_0x8898('0xf')][_0x8898('0x11')]);}else{logger[_0x8898('0x9')](_0x8898('0xa'),_0x4d9f6e,_0x8898('0xb'));_0x51ab3b(_0x2d04f0[_0x8898('0x12')]['message']);}})['catch'](function(_0x5c3cf2){logger[_0x8898('0xf')](_0x8898('0xa'),_0x4d9f6e,_0x5c3cf2);_0x301c4f(_0x5c3cf2);});});}exports[_0x8898('0x13')]=function(_0x29ec26){var _0x51e979=this;return new Promise(function(_0x186cd5,_0x4e8555){return db[_0x8898('0x14')][_0x8898('0x15')](_0x29ec26[_0x8898('0x16')],{'raw':_0x29ec26['options']?_0x29ec26[_0x8898('0x17')][_0x8898('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29ec26[_0x8898('0x17')]?_0x29ec26[_0x8898('0x17')]['where']||null:null,'attributes':_0x29ec26[_0x8898('0x17')]?_0x29ec26[_0x8898('0x17')][_0x8898('0x19')]||null:null,'limit':_0x29ec26['options']?_0x29ec26[_0x8898('0x17')][_0x8898('0x1a')]||null:null})[_0x8898('0x8')](function(_0x39fe82){logger[_0x8898('0x9')](_0x8898('0x13'),_0x29ec26);logger[_0x8898('0xc')](_0x8898('0x13'),_0x29ec26,JSON['stringify'](_0x39fe82));_0x186cd5(_0x39fe82);})['catch'](function(_0xa6fd8f){logger[_0x8898('0xf')](_0x8898('0x13'),_0xa6fd8f[_0x8898('0x11')],_0x29ec26);_0x4e8555(_0x51e979['error'](0x1f4,_0xa6fd8f[_0x8898('0x11')]));});});}; \ No newline at end of file +var _0xef18=['where','attributes','limit','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailApplication','MailApplication','update','options','raw'];(function(_0x322a8a,_0x17c1bd){var _0x2ed749=function(_0x3cca34){while(--_0x3cca34){_0x322a8a['push'](_0x322a8a['shift']());}};_0x2ed749(++_0x17c1bd);}(_0xef18,0x197));var _0x8ef1=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xef18[_0x56916d];return _0x2b7f1f;};'use strict';var _=require(_0x8ef1('0x0'));var util=require(_0x8ef1('0x1'));var moment=require('moment');var BPromise=require(_0x8ef1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ef1('0x3'));var db=require(_0x8ef1('0x4'))['db'];var utils=require(_0x8ef1('0x5'));var logger=require('../../config/logger')(_0x8ef1('0x6'));var config=require(_0x8ef1('0x7'));var jayson=require(_0x8ef1('0x8'));var client=jayson[_0x8ef1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26e78b,_0x2adc10,_0x40a866){return new BPromise(function(_0x5dab1b,_0x5a2e24){return client[_0x8ef1('0xa')](_0x26e78b,_0x40a866)[_0x8ef1('0xb')](function(_0x2d77cd){logger[_0x8ef1('0xc')](_0x8ef1('0xd'),_0x2adc10,_0x8ef1('0xe'));logger[_0x8ef1('0xf')](_0x8ef1('0x10'),_0x2adc10,'request\x20sent',JSON[_0x8ef1('0x11')](_0x2d77cd));if(_0x2d77cd[_0x8ef1('0x12')]){if(_0x2d77cd[_0x8ef1('0x12')][_0x8ef1('0x13')]===0x1f4){logger[_0x8ef1('0x12')](_0x8ef1('0xd'),_0x2adc10,_0x2d77cd[_0x8ef1('0x12')][_0x8ef1('0x14')]);return _0x5a2e24(_0x2d77cd[_0x8ef1('0x12')][_0x8ef1('0x14')]);}logger[_0x8ef1('0x12')]('MailApplication,\x20%s,\x20%s',_0x2adc10,_0x2d77cd[_0x8ef1('0x12')]['message']);return _0x5dab1b(_0x2d77cd['error'][_0x8ef1('0x14')]);}else{logger[_0x8ef1('0xc')](_0x8ef1('0xd'),_0x2adc10,'request\x20sent');_0x5dab1b(_0x2d77cd[_0x8ef1('0x15')]['message']);}})['catch'](function(_0x4c1ff3){logger[_0x8ef1('0x12')](_0x8ef1('0xd'),_0x2adc10,_0x4c1ff3);_0x5a2e24(_0x4c1ff3);});});}exports[_0x8ef1('0x16')]=function(_0x27c233){var _0x46751f=this;return new Promise(function(_0x56578b,_0x4c7ba7){return db[_0x8ef1('0x17')][_0x8ef1('0x18')](_0x27c233['body'],{'raw':_0x27c233[_0x8ef1('0x19')]?_0x27c233['options'][_0x8ef1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27c233[_0x8ef1('0x19')]?_0x27c233['options'][_0x8ef1('0x1b')]||null:null,'attributes':_0x27c233[_0x8ef1('0x19')]?_0x27c233[_0x8ef1('0x19')][_0x8ef1('0x1c')]||null:null,'limit':_0x27c233[_0x8ef1('0x19')]?_0x27c233[_0x8ef1('0x19')][_0x8ef1('0x1d')]||null:null})[_0x8ef1('0xb')](function(_0x2cc789){logger[_0x8ef1('0xc')](_0x8ef1('0x16'),_0x27c233);logger[_0x8ef1('0xf')]('UpdateMailApplication',_0x27c233,JSON[_0x8ef1('0x11')](_0x2cc789));_0x56578b(_0x2cc789);})[_0x8ef1('0x1e')](function(_0x168bb8){logger[_0x8ef1('0x12')](_0x8ef1('0x16'),_0x168bb8[_0x8ef1('0x14')],_0x27c233);_0x4c7ba7(_0x46751f[_0x8ef1('0x12')](0x1f4,_0x168bb8[_0x8ef1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index e3f15f0..18ba0ce 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 _0x49c0=['mail','mailinteraction:addtags','addTags','put','/:id','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','describe','show','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','tracked'];(function(_0xc8befc,_0x3fc134){var _0x4ffbee=function(_0x4d81a1){while(--_0x4d81a1){_0xc8befc['push'](_0xc8befc['shift']());}};_0x4ffbee(++_0x3fc134);}(_0x49c0,0x12e));var _0x049c=function(_0x360686,_0x44cd8f){_0x360686=_0x360686-0x0;var _0x5bfcf4=_0x49c0[_0x360686];return _0x5bfcf4;};'use strict';var express=require(_0x049c('0x0'));var router=express[_0x049c('0x1')]();var auth=require(_0x049c('0x2'));var interaction=require(_0x049c('0x3'));var controller=require(_0x049c('0x4'));router[_0x049c('0x5')]('/',auth[_0x049c('0x6')](),controller[_0x049c('0x7')]);router[_0x049c('0x5')]('/describe',auth[_0x049c('0x6')](),controller[_0x049c('0x8')]);router[_0x049c('0x5')]('/:id',auth[_0x049c('0x6')](),controller[_0x049c('0x9')]);router[_0x049c('0x5')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x049c('0x5')](_0x049c('0xa'),auth[_0x049c('0x6')](),controller[_0x049c('0xb')]);router[_0x049c('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x049c('0xc')](_0x049c('0xd'),auth[_0x049c('0x6')](),controller[_0x049c('0xe')]);router[_0x049c('0xc')](_0x049c('0xf'),auth['isAuthenticated'](),interaction[_0x049c('0x10')](_0x049c('0x11'),_0x049c('0x12')),controller[_0x049c('0x13')]);router[_0x049c('0x14')](_0x049c('0x15'),auth[_0x049c('0x6')](),interaction[_0x049c('0x10')]('mail',_0x049c('0x16')),controller[_0x049c('0x17')]);router[_0x049c('0x18')](_0x049c('0x15'),auth[_0x049c('0x6')](),interaction['tracked'](_0x049c('0x11'),_0x049c('0x19')),controller[_0x049c('0x1a')]);router[_0x049c('0x18')](_0x049c('0xf'),auth[_0x049c('0x6')](),controller[_0x049c('0x1b')]);module[_0x049c('0x1c')]=router; \ No newline at end of file +var _0x70eb=['mailinteraction:destroy','destroy','exports','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','create','post','/:id/tags','tracked','mail','addTags','mailinteraction:update','update','delete'];(function(_0x3b3596,_0x17939f){var _0x20c7ab=function(_0x326f0a){while(--_0x326f0a){_0x3b3596['push'](_0x3b3596['shift']());}};_0x20c7ab(++_0x17939f);}(_0x70eb,0x153));var _0xb70e=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x70eb[_0x3de8a4];return _0x4635cf;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xb70e('0x0'));var interaction=require(_0xb70e('0x1'));var controller=require('./mailInteraction.controller');router[_0xb70e('0x2')]('/',auth[_0xb70e('0x3')](),controller[_0xb70e('0x4')]);router['get'](_0xb70e('0x5'),auth[_0xb70e('0x3')](),controller[_0xb70e('0x6')]);router[_0xb70e('0x2')](_0xb70e('0x7'),auth[_0xb70e('0x3')](),controller[_0xb70e('0x8')]);router[_0xb70e('0x2')](_0xb70e('0x9'),auth[_0xb70e('0x3')](),controller['getMessages']);router['get'](_0xb70e('0xa'),auth['isAuthenticated'](),controller[_0xb70e('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb70e('0xc')]);router[_0xb70e('0xd')]('/:id/messages',auth[_0xb70e('0x3')](),controller['addMessage']);router[_0xb70e('0xd')](_0xb70e('0xe'),auth[_0xb70e('0x3')](),interaction[_0xb70e('0xf')](_0xb70e('0x10'),'mailinteraction:addtags'),controller[_0xb70e('0x11')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0xb70e('0xf')](_0xb70e('0x10'),_0xb70e('0x12')),controller[_0xb70e('0x13')]);router[_0xb70e('0x14')]('/:id',auth['isAuthenticated'](),interaction[_0xb70e('0xf')](_0xb70e('0x10'),_0xb70e('0x15')),controller[_0xb70e('0x16')]);router[_0xb70e('0x14')](_0xb70e('0xe'),auth['isAuthenticated'](),controller['removeTags']);module[_0xb70e('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 190ba84..ead91b4 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 _0x93a0=['ENUM','out','BOOLEAN','sequelize','iconv','DATE','STRING','TEXT','long'];(function(_0x4d1ea1,_0x14dea7){var _0x451c5c=function(_0x3fe973){while(--_0x3fe973){_0x4d1ea1['push'](_0x4d1ea1['shift']());}};_0x451c5c(++_0x14dea7);}(_0x93a0,0x1f2));var _0x093a=function(_0x1ebbaf,_0x3d787b){_0x1ebbaf=_0x1ebbaf-0x0;var _0x26eddc=_0x93a0[_0x1ebbaf];return _0x26eddc;};'use strict';var Sequelize=require(_0x093a('0x0'));var iconv=require(_0x093a('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x093a('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x093a('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x093a('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x093a('0x3')]},'cc':{'type':Sequelize[_0x093a('0x4')](_0x093a('0x5'))},'subject':{'type':Sequelize[_0x093a('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x093a('0x2')]},'substatus':{'type':Sequelize[_0x093a('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x093a('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x093a('0x6')]('in',_0x093a('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x093a('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x093a('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x093a('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x6981=['DATE','ENUM','out','sequelize','iconv','exports','BOOLEAN','STRING','TEXT','long'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6981,0x14d));var _0x1698=function(_0x35de19,_0x49aab5){_0x35de19=_0x35de19-0x0;var _0x10e435=_0x6981[_0x35de19];return _0x10e435;};'use strict';var Sequelize=require(_0x1698('0x0'));var iconv=require(_0x1698('0x1'));module[_0x1698('0x2')]={'closed':{'type':Sequelize[_0x1698('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1698('0x4')]},'secondDisposition':{'type':Sequelize[_0x1698('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1698('0x4')]},'inReplyTo':{'type':Sequelize[_0x1698('0x4')](0x1fe)},'to':{'type':Sequelize[_0x1698('0x4')]},'cc':{'type':Sequelize[_0x1698('0x5')](_0x1698('0x6'))},'subject':{'type':Sequelize[_0x1698('0x5')]()},'attach':{'type':Sequelize[_0x1698('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x1698('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x1698('0x7')]},'firstMsgDirection':{'type':Sequelize[_0x1698('0x8')]('in',_0x1698('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1698('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x1698('0x8')]('in',_0x1698('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1698('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index e58a05b..f441c05 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 _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x4f8d9c,_0x3cd167){var _0x2cbc6e=function(_0x53066e){while(--_0x53066e){_0x4f8d9c['push'](_0x4f8d9c['shift']());}};_0x2cbc6e(++_0x3cd167);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_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');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file +var _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x5e919c,_0x2931d5){var _0x25fbde=function(_0x286bfc){while(--_0x286bfc){_0x5e919c['push'](_0x5e919c['shift']());}};_0x25fbde(++_0x2931d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_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');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 9a11aba..3eddcc3 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 _0x8bc3=['unreadMessages','length','emit','catch','events','MailInteraction','MailMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','findAll'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x8bc3,0x82));var _0x38bc=function(_0x2e8a6e,_0x18e64f){_0x2e8a6e=_0x2e8a6e-0x0;var _0x259829=_0x8bc3[_0x2e8a6e];return _0x259829;};'use strict';var EventEmitter=require(_0x38bc('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x38bc('0x1')];var MailMessage=require('../../mysqldb')['db'][_0x38bc('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x38bc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x38bc('0x4'),'afterDestroy':_0x38bc('0x5')};function emitEvent(_0x20d785){return function(_0x265fd7,_0x4a646b,_0x29ac4e){_0x265fd7[_0x38bc('0x6')]({'attributes':['id'],'raw':!![]})[_0x38bc('0x7')](function(_0x214b39){_0x265fd7[_0x38bc('0x8')]('Users',_0x214b39['map'](function(_0x131199){return{'id':_0x131199['id']};}));return MailMessage[_0x38bc('0x9')]({'where':{'MailInteractionId':_0x265fd7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x38bc('0x7')](function(_0x35ca89){_0x265fd7[_0x38bc('0x8')](_0x38bc('0xa'),_0x35ca89[_0x38bc('0xb')]);MailInteractionEvents[_0x38bc('0xc')](_0x20d785+':'+_0x265fd7['id'],_0x265fd7);MailInteractionEvents[_0x38bc('0xc')](_0x20d785,_0x265fd7);_0x29ac4e(null);})[_0x38bc('0xd')](_0x29ac4e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xb640=['emit','hasOwnProperty','hook','events','../../mysqldb','MailInteraction','MailMessage','save','update','remove','setDataValue','Users','findAll','then','unreadMessages','length'];(function(_0x33f31e,_0x22475b){var _0x55593f=function(_0x5e23a0){while(--_0x5e23a0){_0x33f31e['push'](_0x33f31e['shift']());}};_0x55593f(++_0x22475b);}(_0xb640,0x1b3));var _0x0b64=function(_0x53fb12,_0x327dd0){_0x53fb12=_0x53fb12-0x0;var _0x1ee597=_0xb640[_0x53fb12];return _0x1ee597;};'use strict';var EventEmitter=require(_0x0b64('0x0'));var MailInteraction=require(_0x0b64('0x1'))['db'][_0x0b64('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x0b64('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0b64('0x4'),'afterUpdate':_0x0b64('0x5'),'afterDestroy':_0x0b64('0x6')};function emitEvent(_0x53a5b0){return function(_0x4720b2,_0x118476,_0x38ee8c){_0x4720b2['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x686069){_0x4720b2[_0x0b64('0x7')](_0x0b64('0x8'),_0x686069['map'](function(_0x41ea0f){return{'id':_0x41ea0f['id']};}));return MailMessage[_0x0b64('0x9')]({'where':{'MailInteractionId':_0x4720b2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0b64('0xa')](function(_0x1e3eb1){_0x4720b2[_0x0b64('0x7')](_0x0b64('0xb'),_0x1e3eb1[_0x0b64('0xc')]);MailInteractionEvents[_0x0b64('0xd')](_0x53a5b0+':'+_0x4720b2['id'],_0x4720b2);MailInteractionEvents[_0x0b64('0xd')](_0x53a5b0,_0x4720b2);_0x38ee8c(null);})['catch'](_0x38ee8c(null));};}for(var e in events){if(events[_0x0b64('0xe')](e)){var event=events[e];MailInteraction[_0x0b64('0xf')](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 6f3503e..9a81930 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 _0xf9e5=['exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','substatus','closedAt','models','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4be4bb,_0x294060){var _0x288771=function(_0x5bdf98){while(--_0x5bdf98){_0x4be4bb['push'](_0x4be4bb['shift']());}};_0x288771(++_0x294060);}(_0xf9e5,0x119));var _0x5f9e=function(_0x2a4c62,_0x4ccb78){_0x2a4c62=_0x2a4c62-0x0;var _0x361b16=_0xf9e5[_0x2a4c62];return _0x361b16;};'use strict';var _=require(_0x5f9e('0x0'));var util=require(_0x5f9e('0x1'));var logger=require(_0x5f9e('0x2'))(_0x5f9e('0x3'));var moment=require(_0x5f9e('0x4'));var BPromise=require(_0x5f9e('0x5'));var rp=require(_0x5f9e('0x6'));var fs=require('fs');var path=require(_0x5f9e('0x7'));var rimraf=require(_0x5f9e('0x8'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0x5f9e('0x9')]=function(_0x348294,_0x16965a){return _0x348294[_0x5f9e('0xa')](_0x5f9e('0xb'),attributes,{'tableName':_0x5f9e('0xc'),'paranoid':![],'indexes':[{'name':_0x5f9e('0xd'),'fields':[_0x5f9e('0xe'),'to'],'type':_0x5f9e('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x20bee3,_0x550a07,_0x216834){if(_0x20bee3['substatus']){_0x20bee3[_0x5f9e('0x10')]=moment()[_0x5f9e('0x11')](_0x5f9e('0x12'));}if(_0x20bee3[_0x5f9e('0x13')]){_0x20bee3['closedAt']=moment()[_0x5f9e('0x11')](_0x5f9e('0x12'));}_0x216834(null,_0x550a07);},'beforeUpdate':function(_0x36981d,_0x1e5e87,_0x58e385){if(_0x36981d[_0x5f9e('0x14')](_0x5f9e('0x15'))){_0x36981d[_0x5f9e('0x10')]=_0x36981d[_0x5f9e('0x15')]?moment()[_0x5f9e('0x11')](_0x5f9e('0x12')):null;}if(_0x36981d[_0x5f9e('0x14')]('closed')){_0x36981d[_0x5f9e('0x16')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x36981d[_0x5f9e('0x15')]=null;_0x36981d['substatusAt']=null;}_0x58e385(null,_0x36981d);},'afterUpdate':function(_0x26dcfa,_0x381620,_0x1da19b){var _0x509587=_0x348294[_0x5f9e('0x17')];var _0x1553d9=_0x26dcfa['get']({'plain':!![]});if(_0x1553d9['closed']){return _0x509587[_0x5f9e('0x18')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x1553d9['id']}})[_0x5f9e('0x19')](function(){_0x1da19b();})[_0x5f9e('0x1a')](function(_0x4018ae){_0x1da19b(_0x4018ae);});}else{_0x1da19b();}}},'charset':_0x5f9e('0x1b'),'collate':_0x5f9e('0x1c')});}; \ No newline at end of file +var _0x180c=['then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','models','get','MailMessage','update'];(function(_0x3a04c6,_0x12a482){var _0xf4131a=function(_0x413ea2){while(--_0x413ea2){_0x3a04c6['push'](_0x3a04c6['shift']());}};_0xf4131a(++_0x12a482);}(_0x180c,0x143));var _0xc180=function(_0x580303,_0x5ce5c8){_0x580303=_0x580303-0x0;var _0x34e22e=_0x180c[_0x580303];return _0x34e22e;};'use strict';var _=require(_0xc180('0x0'));var util=require(_0xc180('0x1'));var logger=require(_0xc180('0x2'))(_0xc180('0x3'));var moment=require('moment');var BPromise=require(_0xc180('0x4'));var rp=require(_0xc180('0x5'));var fs=require('fs');var path=require(_0xc180('0x6'));var rimraf=require(_0xc180('0x7'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0xc180('0x8')]=function(_0x234120,_0x4be527){return _0x234120[_0xc180('0x9')](_0xc180('0xa'),attributes,{'tableName':_0xc180('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xc180('0xc'),'to'],'type':_0xc180('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x59d7dc,_0x343222,_0xc9b76f){if(_0x59d7dc['substatus']){_0x59d7dc[_0xc180('0xe')]=moment()[_0xc180('0xf')](_0xc180('0x10'));}if(_0x59d7dc[_0xc180('0x11')]){_0x59d7dc[_0xc180('0x12')]=moment()[_0xc180('0xf')](_0xc180('0x10'));}_0xc9b76f(null,_0x343222);},'beforeUpdate':function(_0x51e58b,_0x54397a,_0x8fbac8){if(_0x51e58b[_0xc180('0x13')](_0xc180('0x14'))){_0x51e58b['substatusAt']=_0x51e58b[_0xc180('0x14')]?moment()[_0xc180('0xf')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x51e58b[_0xc180('0x13')]('closed')){_0x51e58b[_0xc180('0x12')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x51e58b[_0xc180('0x14')]=null;_0x51e58b['substatusAt']=null;}_0x8fbac8(null,_0x51e58b);},'afterUpdate':function(_0x28ae26,_0x41455e,_0x8bf379){var _0x565c71=_0x234120[_0xc180('0x15')];var _0x3512e6=_0x28ae26[_0xc180('0x16')]({'plain':!![]});if(_0x3512e6[_0xc180('0x11')]){return _0x565c71[_0xc180('0x17')][_0xc180('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x3512e6['id']}})[_0xc180('0x19')](function(){_0x8bf379();})[_0xc180('0x1a')](function(_0xf8ad8a){_0x8bf379(_0xf8ad8a);});}else{_0x8bf379();}}},'charset':_0xc180('0x1b'),'collate':_0xc180('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index a634347..1fb9377 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 _0xd047=['client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','MailInteraction','options','raw','where','attributes','limit','then','UpdateMailInteraction','catch','find','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd047,0x77));var _0x7d04=function(_0x2541a6,_0x4cbcf4){_0x2541a6=_0x2541a6-0x0;var _0x34c215=_0xd047[_0x2541a6];return _0x34c215;};'use strict';var _=require(_0x7d04('0x0'));var util=require('util');var moment=require(_0x7d04('0x1'));var BPromise=require(_0x7d04('0x2'));var rs=require(_0x7d04('0x3'));var fs=require('fs');var Redis=require(_0x7d04('0x4'));var db=require(_0x7d04('0x5'))['db'];var utils=require(_0x7d04('0x6'));var logger=require(_0x7d04('0x7'))(_0x7d04('0x8'));var config=require(_0x7d04('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7d04('0xa')][_0x7d04('0xb')]({'port':0x232a});config[_0x7d04('0xc')]=_[_0x7d04('0xd')](config[_0x7d04('0xc')],{'host':_0x7d04('0xe'),'port':0x18eb});var socket=require(_0x7d04('0xf'))(new Redis(config[_0x7d04('0xc')]));require(_0x7d04('0x10'))[_0x7d04('0x11')](socket);function respondWithRpcPromise(_0x1b8789,_0x2da292,_0x3969d4){return new BPromise(function(_0x439ad8,_0x2db7a4){return client[_0x7d04('0x12')](_0x1b8789,_0x3969d4)['then'](function(_0x3e8298){logger[_0x7d04('0x13')](_0x7d04('0x14'),_0x2da292,'request\x20sent');logger[_0x7d04('0x15')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x2da292,_0x7d04('0x16'),JSON[_0x7d04('0x17')](_0x3e8298));if(_0x3e8298[_0x7d04('0x18')]){if(_0x3e8298['error'][_0x7d04('0x19')]===0x1f4){logger[_0x7d04('0x18')](_0x7d04('0x14'),_0x2da292,_0x3e8298['error'][_0x7d04('0x1a')]);return _0x2db7a4(_0x3e8298[_0x7d04('0x18')][_0x7d04('0x1a')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x2da292,_0x3e8298['error'][_0x7d04('0x1a')]);return _0x439ad8(_0x3e8298[_0x7d04('0x18')][_0x7d04('0x1a')]);}else{logger[_0x7d04('0x13')](_0x7d04('0x14'),_0x2da292,_0x7d04('0x16'));_0x439ad8(_0x3e8298[_0x7d04('0x1b')][_0x7d04('0x1a')]);}})['catch'](function(_0x58ffc3){logger[_0x7d04('0x18')]('MailInteraction,\x20%s,\x20%s',_0x2da292,_0x58ffc3);_0x2db7a4(_0x58ffc3);});});}exports['UpdateMailInteraction']=function(_0xe98dde){var _0x2111ad=this;return new Promise(function(_0x4f3e2d,_0x5aee3c){return db[_0x7d04('0x1c')]['update'](_0xe98dde['body'],{'raw':_0xe98dde[_0x7d04('0x1d')]?_0xe98dde['options'][_0x7d04('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe98dde[_0x7d04('0x1d')]?_0xe98dde['options'][_0x7d04('0x1f')]||null:null,'attributes':_0xe98dde[_0x7d04('0x1d')]?_0xe98dde[_0x7d04('0x1d')][_0x7d04('0x20')]||null:null,'limit':_0xe98dde['options']?_0xe98dde[_0x7d04('0x1d')][_0x7d04('0x21')]||null:null})[_0x7d04('0x22')](function(_0x1678eb){logger[_0x7d04('0x13')](_0x7d04('0x23'),_0xe98dde);logger['debug'](_0x7d04('0x23'),_0xe98dde,JSON['stringify'](_0x1678eb));_0x4f3e2d(_0x1678eb);})[_0x7d04('0x24')](function(_0x1f3860){logger[_0x7d04('0x18')](_0x7d04('0x23'),_0x1f3860[_0x7d04('0x1a')],_0xe98dde);_0x5aee3c(_0x2111ad[_0x7d04('0x18')](0x1f4,_0x1f3860['message']));});});};exports['AddTagsToMailInteraction']=function(_0x4483cc){return new Promise(function(_0x33c7e8,_0x21b835){return db[_0x7d04('0x1c')][_0x7d04('0x25')]({'where':_0x4483cc['options']?_0x4483cc[_0x7d04('0x1d')][_0x7d04('0x1f')]||null:null})[_0x7d04('0x22')](function(_0x40c9fc){if(_0x40c9fc){return _0x40c9fc[_0x7d04('0x26')](_0x4483cc['body']['ids'],_[_0x7d04('0x27')](_0x4483cc['body'],[_0x7d04('0x28'),'id'])||{});}})[_0x7d04('0x29')](function(_0x29be7b){logger[_0x7d04('0x13')](_0x7d04('0x2a'),_0x4483cc);logger[_0x7d04('0x15')](_0x7d04('0x2a'),_0x4483cc,JSON[_0x7d04('0x17')](_0x29be7b));_0x33c7e8(_0x29be7b);})['catch'](function(_0x120a1a){logger[_0x7d04('0x18')](_0x7d04('0x2a'),_0x120a1a[_0x7d04('0x1a')],_0x4483cc);_0x21b835(_this[_0x7d04('0x18')](0x1f4,_0x120a1a[_0x7d04('0x1a')]));});});}; \ No newline at end of file +var _0xd2d9=['ids','omit','spread','AddTags','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','update','options','raw','where','attributes','limit','catch','MailInteraction','find','addTags'];(function(_0xeee8f2,_0x351024){var _0x16102b=function(_0x1617cc){while(--_0x1617cc){_0xeee8f2['push'](_0xeee8f2['shift']());}};_0x16102b(++_0x351024);}(_0xd2d9,0x16c));var _0x9d2d=function(_0x5e77db,_0x356d1c){_0x5e77db=_0x5e77db-0x0;var _0x34b675=_0xd2d9[_0x5e77db];return _0x34b675;};'use strict';var _=require(_0x9d2d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9d2d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d2d('0x2'));var db=require(_0x9d2d('0x3'))['db'];var utils=require(_0x9d2d('0x4'));var logger=require(_0x9d2d('0x5'))(_0x9d2d('0x6'));var config=require(_0x9d2d('0x7'));var jayson=require(_0x9d2d('0x8'));var client=jayson[_0x9d2d('0x9')][_0x9d2d('0xa')]({'port':0x232a});config[_0x9d2d('0xb')]=_[_0x9d2d('0xc')](config[_0x9d2d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9d2d('0xd'))(new Redis(config[_0x9d2d('0xb')]));require(_0x9d2d('0xe'))['register'](socket);function respondWithRpcPromise(_0x185002,_0x4542c5,_0x448e3e){return new BPromise(function(_0x124eaf,_0x4989e8){return client[_0x9d2d('0xf')](_0x185002,_0x448e3e)[_0x9d2d('0x10')](function(_0x5d5ef0){logger[_0x9d2d('0x11')](_0x9d2d('0x12'),_0x4542c5,_0x9d2d('0x13'));logger[_0x9d2d('0x14')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x4542c5,_0x9d2d('0x13'),JSON[_0x9d2d('0x15')](_0x5d5ef0));if(_0x5d5ef0[_0x9d2d('0x16')]){if(_0x5d5ef0[_0x9d2d('0x16')][_0x9d2d('0x17')]===0x1f4){logger[_0x9d2d('0x16')](_0x9d2d('0x12'),_0x4542c5,_0x5d5ef0['error']['message']);return _0x4989e8(_0x5d5ef0['error'][_0x9d2d('0x18')]);}logger['error'](_0x9d2d('0x12'),_0x4542c5,_0x5d5ef0[_0x9d2d('0x16')]['message']);return _0x124eaf(_0x5d5ef0[_0x9d2d('0x16')]['message']);}else{logger['info'](_0x9d2d('0x12'),_0x4542c5,_0x9d2d('0x13'));_0x124eaf(_0x5d5ef0[_0x9d2d('0x19')][_0x9d2d('0x18')]);}})['catch'](function(_0x5a85d5){logger[_0x9d2d('0x16')](_0x9d2d('0x12'),_0x4542c5,_0x5a85d5);_0x4989e8(_0x5a85d5);});});}exports['UpdateMailInteraction']=function(_0x3d9338){var _0x4708b8=this;return new Promise(function(_0x2b7a7a,_0x5539ba){return db['MailInteraction'][_0x9d2d('0x1a')](_0x3d9338['body'],{'raw':_0x3d9338[_0x9d2d('0x1b')]?_0x3d9338[_0x9d2d('0x1b')][_0x9d2d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d9338[_0x9d2d('0x1b')]?_0x3d9338[_0x9d2d('0x1b')][_0x9d2d('0x1d')]||null:null,'attributes':_0x3d9338[_0x9d2d('0x1b')]?_0x3d9338['options'][_0x9d2d('0x1e')]||null:null,'limit':_0x3d9338[_0x9d2d('0x1b')]?_0x3d9338[_0x9d2d('0x1b')][_0x9d2d('0x1f')]||null:null})[_0x9d2d('0x10')](function(_0x39784d){logger[_0x9d2d('0x11')]('UpdateMailInteraction',_0x3d9338);logger['debug']('UpdateMailInteraction',_0x3d9338,JSON[_0x9d2d('0x15')](_0x39784d));_0x2b7a7a(_0x39784d);})[_0x9d2d('0x20')](function(_0x39765f){logger[_0x9d2d('0x16')]('UpdateMailInteraction',_0x39765f['message'],_0x3d9338);_0x5539ba(_0x4708b8[_0x9d2d('0x16')](0x1f4,_0x39765f['message']));});});};exports['AddTagsToMailInteraction']=function(_0x3f0cef){return new Promise(function(_0x7ab38f,_0x86970d){return db[_0x9d2d('0x21')][_0x9d2d('0x22')]({'where':_0x3f0cef[_0x9d2d('0x1b')]?_0x3f0cef['options'][_0x9d2d('0x1d')]||null:null})[_0x9d2d('0x10')](function(_0x49fb98){if(_0x49fb98){return _0x49fb98[_0x9d2d('0x23')](_0x3f0cef['body'][_0x9d2d('0x24')],_[_0x9d2d('0x25')](_0x3f0cef['body'],[_0x9d2d('0x24'),'id'])||{});}})[_0x9d2d('0x26')](function(_0x382057){logger[_0x9d2d('0x11')](_0x9d2d('0x27'),_0x3f0cef);logger[_0x9d2d('0x14')]('AddTags',_0x3f0cef,JSON[_0x9d2d('0x15')](_0x382057));_0x7ab38f(_0x382057);})[_0x9d2d('0x20')](function(_0x5de56d){logger[_0x9d2d('0x16')](_0x9d2d('0x27'),_0x5de56d['message'],_0x3f0cef);_0x86970d(_this[_0x9d2d('0x16')](0x1f4,_0x5de56d[_0x9d2d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index ff25cd7..dfc91a5 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 _0xb3d5=['save','update','removeListener','register','mailInteraction:','./mailInteraction.events'];(function(_0x186945,_0xf6aa17){var _0x31c8e1=function(_0xb2b171){while(--_0xb2b171){_0x186945['push'](_0x186945['shift']());}};_0x31c8e1(++_0xf6aa17);}(_0xb3d5,0xe9));var _0x5b3d=function(_0x12c9aa,_0x1ce89b){_0x12c9aa=_0x12c9aa-0x0;var _0x1b0043=_0xb3d5[_0x12c9aa];return _0x1b0043;};'use strict';var MailInteractionEvents=require(_0x5b3d('0x0'));var events=[_0x5b3d('0x1'),'remove',_0x5b3d('0x2')];function createListener(_0x1775dd,_0x4f382d){return function(_0x4a7d70){_0x4f382d['emit'](_0x1775dd,_0x4a7d70);};}function removeListener(_0x268ca4,_0x274f4a){return function(){MailInteractionEvents[_0x5b3d('0x3')](_0x268ca4,_0x274f4a);};}exports[_0x5b3d('0x4')]=function(_0x59e967){for(var _0x1b7b4a=0x0,_0x29ef8e=events['length'];_0x1b7b4a<_0x29ef8e;_0x1b7b4a++){var _0x266c3e=events[_0x1b7b4a];var _0x1c0a55=createListener(_0x5b3d('0x5')+_0x266c3e,_0x59e967);MailInteractionEvents['on'](_0x266c3e,_0x1c0a55);}}; \ No newline at end of file +var _0x83d8=['length','save','remove','removeListener','register'];(function(_0x133d5a,_0x570674){var _0x3beb71=function(_0x243d5a){while(--_0x243d5a){_0x133d5a['push'](_0x133d5a['shift']());}};_0x3beb71(++_0x570674);}(_0x83d8,0x15f));var _0x883d=function(_0x17fa16,_0x10029c){_0x17fa16=_0x17fa16-0x0;var _0x3bace6=_0x83d8[_0x17fa16];return _0x3bace6;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x883d('0x0'),_0x883d('0x1'),'update'];function createListener(_0x3d015a,_0x20ebdb){return function(_0x573623){_0x20ebdb['emit'](_0x3d015a,_0x573623);};}function removeListener(_0x16e66d,_0x4dc710){return function(){MailInteractionEvents[_0x883d('0x2')](_0x16e66d,_0x4dc710);};}exports[_0x883d('0x3')]=function(_0x3d3036){for(var _0x301465=0x0,_0x1134e4=events[_0x883d('0x4')];_0x301465<_0x1134e4;_0x301465++){var _0x5ce776=events[_0x301465];var _0x2e2d70=createListener('mailInteraction:'+_0x5ce776,_0x3d3036);MailInteractionEvents['on'](_0x5ce776,_0x2e2d70);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 7fb5e15..363a418 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 _0x950a=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','/:id/accept','delete','destroy','multer','util','path'];(function(_0x191b49,_0x32feb2){var _0x1a1209=function(_0x8ce89b){while(--_0x8ce89b){_0x191b49['push'](_0x191b49['shift']());}};_0x1a1209(++_0x32feb2);}(_0x950a,0x174));var _0xa950=function(_0x4a0e80,_0x4fecee){_0x4a0e80=_0x4a0e80-0x0;var _0x453b30=_0x950a[_0x4a0e80];return _0x453b30;};'use strict';var multer=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var path=require(_0xa950('0x2'));var timeout=require('connect-timeout');var express=require(_0xa950('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa950('0x4'));var interaction=require(_0xa950('0x5'));var config=require(_0xa950('0x6'));var controller=require(_0xa950('0x7'));router[_0xa950('0x8')]('/',auth[_0xa950('0x9')](),controller[_0xa950('0xa')]);router['get'](_0xa950('0xb'),auth[_0xa950('0x9')](),controller[_0xa950('0xc')]);router[_0xa950('0x8')](_0xa950('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0xa950('0xe'),auth[_0xa950('0x9')](),controller[_0xa950('0xf')]);router[_0xa950('0x10')]('/',auth[_0xa950('0x9')](),interaction[_0xa950('0x11')](_0xa950('0x12'),_0xa950('0x13')),controller[_0xa950('0x14')]);router[_0xa950('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa950('0x15')](_0xa950('0x16'),auth[_0xa950('0x9')](),controller['accept']);router[_0xa950('0x15')]('/:id/reject',auth[_0xa950('0x9')](),controller['reject']);router[_0xa950('0x17')](_0xa950('0xd'),auth[_0xa950('0x9')](),controller[_0xa950('0x18')]);module['exports']=router; \ No newline at end of file +var _0x9651=['../../config/environment','./mailMessage.controller','get','index','describe','/:id','isAuthenticated','show','download','post','tracked','mail','mailmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4fe37c,_0x1c902e){var _0x416049=function(_0x56c8f8){while(--_0x56c8f8){_0x4fe37c['push'](_0x4fe37c['shift']());}};_0x416049(++_0x1c902e);}(_0x9651,0x166));var _0x1965=function(_0x5c40fc,_0x4dcb75){_0x5c40fc=_0x5c40fc-0x0;var _0x332818=_0x9651[_0x5c40fc];return _0x332818;};'use strict';var multer=require('multer');var util=require(_0x1965('0x0'));var path=require('path');var timeout=require(_0x1965('0x1'));var express=require(_0x1965('0x2'));var router=express['Router']();var fs_extra=require(_0x1965('0x3'));var auth=require(_0x1965('0x4'));var interaction=require(_0x1965('0x5'));var config=require(_0x1965('0x6'));var controller=require(_0x1965('0x7'));router[_0x1965('0x8')]('/',auth['isAuthenticated'](),controller[_0x1965('0x9')]);router[_0x1965('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x1965('0xa')]);router[_0x1965('0x8')](_0x1965('0xb'),auth[_0x1965('0xc')](),controller[_0x1965('0xd')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x1965('0xe')]);router[_0x1965('0xf')]('/',auth[_0x1965('0xc')](),interaction[_0x1965('0x10')](_0x1965('0x11'),_0x1965('0x12')),controller[_0x1965('0x13')]);router['put'](_0x1965('0xb'),auth[_0x1965('0xc')](),controller['update']);router[_0x1965('0x14')](_0x1965('0x15'),auth[_0x1965('0xc')](),controller[_0x1965('0x16')]);router['put'](_0x1965('0x17'),auth[_0x1965('0xc')](),controller[_0x1965('0x18')]);router[_0x1965('0x19')](_0x1965('0xb'),auth[_0x1965('0xc')](),controller[_0x1965('0x1a')]);module[_0x1965('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 1048eea..73e01e0 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 _0xf39c=['out','STRING','long','DATE','Email','sequelize','lodash','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x396e2f,_0x4a5e7d){var _0x40f790=function(_0x2587f7){while(--_0x2587f7){_0x396e2f['push'](_0x396e2f['shift']());}};_0x40f790(++_0x4a5e7d);}(_0xf39c,0x19d));var _0xcf39=function(_0x114c57,_0x407fda){_0x114c57=_0x114c57-0x0;var _0x4585a3=_0xf39c[_0x114c57];return _0x4585a3;};'use strict';var Sequelize=require(_0xcf39('0x0'));var _=require(_0xcf39('0x1'));module[_0xcf39('0x2')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xcf39('0x3')](_0xcf39('0x4'))},'read':{'type':Sequelize[_0xcf39('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcf39('0x6')]('in',_0xcf39('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xcf39('0x8')](0x1fe)},'from':{'type':Sequelize[_0xcf39('0x8')]},'to':{'type':Sequelize['TEXT'](_0xcf39('0x9'))},'cc':{'type':Sequelize[_0xcf39('0x3')](_0xcf39('0x9'))},'bcc':{'type':Sequelize[_0xcf39('0x3')]('long')},'subject':{'type':Sequelize[_0xcf39('0x3')]},'sentAt':{'type':Sequelize[_0xcf39('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xcf39('0xa')]},'originTo':{'type':Sequelize[_0xcf39('0x3')](_0xcf39('0x9'))},'originCc':{'type':Sequelize[_0xcf39('0x3')](_0xcf39('0x9'))},'originChannel':{'type':Sequelize[_0xcf39('0x6')]('Email','Chat'),'defaultValue':_0xcf39('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x7c07=['long','medium','ENUM','out','STRING','DATE','INTEGER','Email','Chat','lodash','exports','TEXT'];(function(_0x1f7839,_0x2a26e6){var _0x36b42e=function(_0x553222){while(--_0x553222){_0x1f7839['push'](_0x1f7839['shift']());}};_0x36b42e(++_0x2a26e6);}(_0x7c07,0x111));var _0x77c0=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x7c07[_0x298ed3];return _0x5aad28;};'use strict';var Sequelize=require('sequelize');var _=require(_0x77c0('0x0'));module[_0x77c0('0x1')]={'body':{'type':Sequelize[_0x77c0('0x2')](_0x77c0('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x77c0('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x77c0('0x5')]('in',_0x77c0('0x6')),'defaultValue':_0x77c0('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x77c0('0x7')](0x1fe)},'from':{'type':Sequelize[_0x77c0('0x7')]},'to':{'type':Sequelize[_0x77c0('0x2')](_0x77c0('0x3'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize['TEXT'](_0x77c0('0x3'))},'subject':{'type':Sequelize[_0x77c0('0x2')]},'sentAt':{'type':Sequelize[_0x77c0('0x8')]},'attach':{'type':Sequelize[_0x77c0('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0x77c0('0x2')]('long')},'originChannel':{'type':Sequelize['ENUM'](_0x77c0('0xa'),_0x77c0('0xb')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 5433972..07b77a3 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 _0x008c=['pass','attachments','join','root','server/files/attachments','basename','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','UserId','agent','get','MailInteraction','update','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','email','manual','channel','event','fromString','EventManager','acceptmessage','reject','MailInteractionId','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','sequelize','fullname','interface','SIP/%s','rejectmessage','download','unix','toString','tmp','server','files','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','existsSync','push','readFileSync','build','writeFileSync','eml-format','moment','bluebird','util','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','localhost','./mailMessage.socket','register','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','status','json','offset','undefined','limit','count','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','find','body','destroy','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','secure','authentication','auth','user'];(function(_0x1dd398,_0x235e70){var _0x5846cf=function(_0x43efef){while(--_0x43efef){_0x1dd398['push'](_0x1dd398['shift']());}};_0x5846cf(++_0x235e70);}(_0x008c,0x188));var _0xc008=function(_0x3d4864,_0x10ff93){_0x3d4864=_0x3d4864-0x0;var _0x489010=_0x008c[_0x3d4864];return _0x489010;};'use strict';var emlformat=require(_0xc008('0x0'));var moment=require(_0xc008('0x1'));var BPromise=require(_0xc008('0x2'));var util=require(_0xc008('0x3'));var path=require(_0xc008('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xc008('0x5'));var htmlToText=require(_0xc008('0x6'));var qs=require(_0xc008('0x7'));var logger=require(_0xc008('0x8'))(_0xc008('0x9'));var interaction_log=require(_0xc008('0x8'))(_0xc008('0xa'));var config=require(_0xc008('0xb'));var db=require(_0xc008('0xc'))['db'];config['redis']=_[_0xc008('0xd')](config['redis'],{'host':_0xc008('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc008('0xf'))[_0xc008('0x10')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0xc008('0x11')][_0xc008('0x12')]({'port':0x232b});var client9002=jayson['client'][_0xc008('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x332fd4,_0x2ea200,_0x2a5b4e,_0x9ffa93){return new BPromise(function(_0x1819c6,_0x69726e){var _0x593f7a=_0x9ffa93||client;return _0x593f7a['request'](_0x332fd4,_0x2a5b4e)[_0xc008('0x13')](function(_0x50c1ab){logger[_0xc008('0x14')](_0xc008('0x15'),_0x2ea200,_0xc008('0x16'));logger[_0xc008('0x17')](_0xc008('0x18'),_0x2ea200,'request\x20sent',JSON['stringify'](_0x50c1ab));if(_0x50c1ab['error']){if(_0x50c1ab[_0xc008('0x19')][_0xc008('0x1a')]===0x1f4){logger[_0xc008('0x19')](_0xc008('0x15'),_0x2ea200,_0x50c1ab['error']['message']);return _0x69726e(_0x50c1ab['error']['message']);}logger[_0xc008('0x19')](_0xc008('0x15'),_0x2ea200,_0x50c1ab['error'][_0xc008('0x1b')]);return _0x1819c6(_0x50c1ab['error']['message']);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x2ea200,_0xc008('0x16'));_0x1819c6(_0x50c1ab['result']['message']);}})['catch'](function(_0x4a582d){logger['error'](_0xc008('0x15'),_0x2ea200,_0x4a582d);_0x69726e(_0x4a582d);});});}function respondWithResult(_0x4777a6,_0x251db2){_0x251db2=_0x251db2||0xc8;return function(_0x415af3){if(_0x415af3){return _0x4777a6[_0xc008('0x1c')](_0x251db2)[_0xc008('0x1d')](_0x415af3);}};}function respondWithFilteredResult(_0x4f43e2,_0x459fd9){return function(_0x5c85f2){if(_0x5c85f2){var _0x58a6ea=typeof _0x459fd9[_0xc008('0x1e')]===_0xc008('0x1f')&&typeof _0x459fd9[_0xc008('0x20')]===_0xc008('0x1f');var _0x5410f5=_0x5c85f2['count'];var _0x5de1e9=_0x58a6ea?0x0:_0x459fd9[_0xc008('0x1e')];var _0x15dade=_0x58a6ea?_0x5c85f2[_0xc008('0x21')]:_0x459fd9[_0xc008('0x1e')]+_0x459fd9['limit'];var _0x5e2aca;if(_0x15dade>=_0x5410f5){_0x15dade=_0x5410f5;_0x5e2aca=0xc8;}else{_0x5e2aca=0xce;}_0x4f43e2['status'](_0x5e2aca);return _0x4f43e2['set']('Content-Range',_0x5de1e9+'-'+_0x15dade+'/'+_0x5410f5)[_0xc008('0x1d')](_0x5c85f2);}return null;};}function saveUpdates(_0x29ba43){return function(_0x25eae4){if(_0x25eae4){return _0x25eae4['update'](_0x29ba43)[_0xc008('0x13')](function(_0x32390d){return _0x32390d;});}return null;};}function removeEntity(_0x209591){return function(_0x2a7d4f){if(_0x2a7d4f){return _0x2a7d4f['destroy']()[_0xc008('0x13')](function(){_0x209591[_0xc008('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58db82){return function(_0x539766){if(!_0x539766){_0x58db82[_0xc008('0x22')](0x194);}return _0x539766;};}function handleError(_0x267abd,_0xf831f2){_0xf831f2=_0xf831f2||0x1f4;return function(_0x10889f){logger[_0xc008('0x19')](_0x10889f[_0xc008('0x23')]);if(_0x10889f[_0xc008('0x24')]){delete _0x10889f[_0xc008('0x24')];}_0x267abd[_0xc008('0x1c')](_0xf831f2)[_0xc008('0x25')](_0x10889f);};}exports[_0xc008('0x26')]=function(_0x1ac7c8,_0x596ee8){var _0x334a09={},_0x4b7fd4={},_0x499754={'count':0x0,'rows':[]};var _0xaf4b84=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xd0e05a){return{'name':_0xd0e05a[_0xc008('0x2a')],'type':_0xd0e05a[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x4b7fd4[_0xc008('0x2d')]=_['map'](_0xaf4b84,_0xc008('0x24'));_0x4b7fd4[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x1ac7c8[_0xc008('0x2e')]);_0x4b7fd4[_0xc008('0x30')]=_[_0xc008('0x31')](_0x4b7fd4[_0xc008('0x2d')],_0x4b7fd4['query']);_0x334a09[_0xc008('0x32')]=_[_0xc008('0x31')](_0x4b7fd4['model'],qs[_0xc008('0x33')](_0x1ac7c8[_0xc008('0x2e')]['fields']));_0x334a09[_0xc008('0x32')]=_0x334a09[_0xc008('0x32')][_0xc008('0x34')]?_0x334a09['attributes']:_0x4b7fd4['model'];if(!_0x1ac7c8['query'][_0xc008('0x35')]('nolimit')){_0x334a09[_0xc008('0x20')]=qs[_0xc008('0x20')](_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x20')]);_0x334a09[_0xc008('0x1e')]=qs[_0xc008('0x1e')](_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x1e')]);}_0x334a09[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x37')]);_0x334a09[_0xc008('0x38')]=qs[_0xc008('0x30')](_['pick'](_0x1ac7c8[_0xc008('0x2e')],_0x4b7fd4[_0xc008('0x30')]),_0xaf4b84);if(_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x39')]){_0x334a09['where']=_[_0xc008('0x3a')](_0x334a09[_0xc008('0x38')],{'$or':_[_0xc008('0x27')](_0xaf4b84,function(_0x36e7ae){if(_0x36e7ae[_0xc008('0x2b')]!=='VIRTUAL'){var _0x398cdd={};_0x398cdd[_0x36e7ae[_0xc008('0x24')]]={'$like':'%'+_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x39')]+'%'};return _0x398cdd;}})});}_0x334a09=_[_0xc008('0x3a')]({},_0x334a09,_0x1ac7c8['options']);var _0xf4cc4b={'where':_0x334a09[_0xc008('0x38')]};return db[_0xc008('0x28')][_0xc008('0x21')](_0xf4cc4b)['then'](function(_0x26cd05){_0x499754[_0xc008('0x21')]=_0x26cd05;if(_0x1ac7c8[_0xc008('0x2e')]['includeAll']){_0x334a09[_0xc008('0x3b')]=[{'all':!![]}];}return db['MailMessage'][_0xc008('0x3c')](_0x334a09);})['then'](function(_0x46fa8f){_0x499754[_0xc008('0x3d')]=_0x46fa8f;return _0x499754;})['then'](respondWithFilteredResult(_0x596ee8,_0x334a09))[_0xc008('0x3e')](handleError(_0x596ee8,null));};exports[_0xc008('0x3f')]=function(_0x6d6d4c,_0x5caaa2){var _0x1cec64={'raw':!![],'where':{'id':_0x6d6d4c[_0xc008('0x40')]['id']}},_0x2a9b5c={};_0x2a9b5c[_0xc008('0x2d')]=_[_0xc008('0x2f')](db[_0xc008('0x28')]['rawAttributes']);_0x2a9b5c['query']=_['keys'](_0x6d6d4c[_0xc008('0x2e')]);_0x2a9b5c[_0xc008('0x30')]=_[_0xc008('0x31')](_0x2a9b5c[_0xc008('0x2d')],_0x2a9b5c[_0xc008('0x2e')]);_0x1cec64[_0xc008('0x32')]=_[_0xc008('0x31')](_0x2a9b5c[_0xc008('0x2d')],qs['fields'](_0x6d6d4c['query']['fields']));_0x1cec64[_0xc008('0x32')]=_0x1cec64[_0xc008('0x32')][_0xc008('0x34')]?_0x1cec64['attributes']:_0x2a9b5c[_0xc008('0x2d')];if(_0x6d6d4c[_0xc008('0x2e')][_0xc008('0x41')]){_0x1cec64[_0xc008('0x3b')]=[{'all':!![]}];}_0x1cec64=_[_0xc008('0x3a')]({},_0x1cec64,_0x6d6d4c[_0xc008('0x42')]);return db[_0xc008('0x28')][_0xc008('0x43')](_0x1cec64)[_0xc008('0x13')](handleEntityNotFound(_0x5caaa2,null))[_0xc008('0x13')](respondWithResult(_0x5caaa2,null))['catch'](handleError(_0x5caaa2,null));};exports['update']=function(_0x223056,_0x51cb14){if(_0x223056[_0xc008('0x44')]['id']){delete _0x223056[_0xc008('0x44')]['id'];}return db[_0xc008('0x28')]['find']({'where':{'id':_0x223056[_0xc008('0x40')]['id']}})[_0xc008('0x13')](handleEntityNotFound(_0x51cb14,null))[_0xc008('0x13')](saveUpdates(_0x223056[_0xc008('0x44')],null))[_0xc008('0x13')](respondWithResult(_0x51cb14,null))['catch'](handleError(_0x51cb14,null));};exports[_0xc008('0x45')]=function(_0x27b022,_0x4b4c6d){return db[_0xc008('0x28')][_0xc008('0x43')]({'where':{'id':_0x27b022['params']['id']}})['then'](handleEntityNotFound(_0x4b4c6d,null))[_0xc008('0x13')](removeEntity(_0x4b4c6d,null))[_0xc008('0x3e')](handleError(_0x4b4c6d,null));};exports[_0xc008('0x46')]=function(_0x30d0aa,_0x14b6a0){return db['MailMessage']['describe']()[_0xc008('0x13')](respondWithResult(_0x14b6a0,null))['catch'](handleError(_0x14b6a0,null));};exports[_0xc008('0x47')]=function(_0x25d351,_0xf94fcb){return db[_0xc008('0x28')][_0xc008('0x47')](_0x25d351[_0xc008('0x44')])['then'](function(_0x2ea742){if(_0x2ea742){if(_0x2ea742[_0xc008('0x48')]===_0xc008('0x49')&&!_0x2ea742[_0xc008('0x4a')]){var _0x4424f5,_0x5aa385,_0x41fae3;if(_0x25d351['body']['to']){_0x5aa385=_0x25d351['body']['to']['split'](',')[0x0];}return db[_0xc008('0x4b')][_0xc008('0x4c')]({'where':{'id':_0x2ea742[_0xc008('0x4d')]},'include':[{'model':db['CmList'],'as':_0xc008('0x4e'),'include':[{'model':db[_0xc008('0x4f')],'as':_0xc008('0x50'),'where':{'email':_0x5aa385},'limit':0x1,'order':[['updatedAt',_0xc008('0x51')]]}]},{'model':db[_0xc008('0x52')],'as':_0xc008('0x53'),'raw':!![]}]})[_0xc008('0x13')](function(_0x5baff1){_0x4424f5=_0x5baff1;if(_0x4424f5&&_0x4424f5[_0xc008('0x53')]){var _0x4eaa6d={'tls':{'rejectUnauthorized':![]}};if(_[_0xc008('0x54')](_0x4424f5[_0xc008('0x53')][_0xc008('0x55')])){_0x4eaa6d[_0xc008('0x56')]=_0x4424f5[_0xc008('0x53')][_0xc008('0x56')];_0x4eaa6d['port']=_0x4424f5[_0xc008('0x53')]['port'];_0x4eaa6d['secure']=_0x4424f5[_0xc008('0x53')][_0xc008('0x57')];if(_0x4424f5['Smtp'][_0xc008('0x58')]){_0x4eaa6d[_0xc008('0x59')]={'user':_0x4424f5[_0xc008('0x53')][_0xc008('0x5a')],'pass':_0x4424f5[_0xc008('0x53')][_0xc008('0x5b')]};}}else{_0x4eaa6d[_0xc008('0x55')]=_0x4424f5['Smtp'][_0xc008('0x55')];_0x4eaa6d[_0xc008('0x59')]={'user':_0x4424f5[_0xc008('0x53')][_0xc008('0x5a')],'pass':_0x4424f5[_0xc008('0x53')][_0xc008('0x5b')]};_0x4eaa6d[_0xc008('0x57')]=_0x4424f5[_0xc008('0x53')][_0xc008('0x57')];}if(_0x25d351[_0xc008('0x44')][_0xc008('0x5c')]&&_0x25d351[_0xc008('0x44')][_0xc008('0x5c')][_0xc008('0x34')]){for(var _0x4e0251=0x0;_0x4e0251<_0x25d351[_0xc008('0x44')][_0xc008('0x5c')][_0xc008('0x34')];_0x4e0251+=0x1){_0x25d351['body'][_0xc008('0x5c')][_0x4e0251]={'filename':_0x25d351[_0xc008('0x44')]['attachments'][_0x4e0251]['name'],'path':path[_0xc008('0x5d')](config[_0xc008('0x5e')],_0xc008('0x5f'),_0x25d351[_0xc008('0x44')][_0xc008('0x5c')][_0x4e0251][_0xc008('0x60')])};}}_0x41fae3={'account':_0x4eaa6d,'message':_0x25d351[_0xc008('0x44')]};return;}})[_0xc008('0x13')](function(){if(_0x4424f5[_0xc008('0x4e')]){if(_0x4424f5[_0xc008('0x4e')][_0xc008('0x50')]['length']){return _0x4424f5[_0xc008('0x4e')][_0xc008('0x50')][0x0];}else{return db[_0xc008('0x4f')][_0xc008('0x47')](_['defaults'](_0x25d351[_0xc008('0x44')],{'firstName':_0x25d351['body']['to'],'email':_0x25d351[_0xc008('0x44')]['to'],'phone':_0x25d351[_0xc008('0x44')]['to'],'ListId':_0x4424f5[_0xc008('0x61')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xc008('0x13')](function(){if(_0x41fae3){return respondWithRpcPromise(_0xc008('0x62'),_0xc008('0x63'),_0x41fae3,client9003)['then'](function(_0x35b28a){return _0x2ea742['update']({'read':!![],'messageId':_0x35b28a[_0xc008('0x64')],'sentAt':moment()[_0xc008('0x65')](_0xc008('0x66'))});})[_0xc008('0x3e')](function(_0x295ec7){logger['error']('%s',JSON[_0xc008('0x67')](_0x295ec7));return _0x2ea742;});}return _0x2ea742;});}return _0x2ea742;}})[_0xc008('0x13')](respondWithResult(_0xf94fcb,0xc9))['catch'](handleError(_0xf94fcb,null));};exports[_0xc008('0x68')]=function(_0x5233bb,_0x278cbe){var _0x50bfe5={'agent':{},'channel':_0xc008('0x69')};if(_0x5233bb['body']['id']){delete _0x5233bb[_0xc008('0x44')]['id'];}_0x5233bb[_0xc008('0x44')][_0xc008('0x6a')]=!![];_0x5233bb[_0xc008('0x44')]['readAt']=moment()[_0xc008('0x65')](_0xc008('0x66'));_0x5233bb[_0xc008('0x44')][_0xc008('0x6b')]=_0x5233bb[_0xc008('0x44')][_0xc008('0x6b')]||_0x5233bb[_0xc008('0x5a')]['id'];_0x50bfe5[_0xc008('0x6c')]['id']=_0x5233bb['body'][_0xc008('0x6b')];return db['MailMessage']['find']({'where':{'id':_0x5233bb['params']['id'],'UserId':null}})[_0xc008('0x13')](handleEntityNotFound(_0x278cbe,null))[_0xc008('0x13')](saveUpdates(_0x5233bb[_0xc008('0x44')],null))[_0xc008('0x13')](function(_0xc2f684){if(_0xc2f684){_0x50bfe5[_0xc008('0x1b')]=_0xc2f684[_0xc008('0x6d')]({'plain':!![]});return db[_0xc008('0x6e')][_0xc008('0x43')]({'where':{'id':_0xc2f684['MailInteractionId']}});}return null;})[_0xc008('0x13')](handleEntityNotFound(_0x278cbe,null))[_0xc008('0x13')](function(_0x2b1b26){if(_0x2b1b26){return _0x2b1b26[_0xc008('0x6f')]({'UserId':_0x5233bb[_0xc008('0x44')][_0xc008('0x6b')],'read1stAt':_[_0xc008('0x54')](_0x2b1b26[_0xc008('0x70')])?moment()[_0xc008('0x65')](_0xc008('0x66')):undefined});}return null;})[_0xc008('0x13')](function(_0x1dd9fe){if(_0x1dd9fe){_0x50bfe5['interaction']=_0x1dd9fe['get']({'plain':!![]});interaction_log[_0xc008('0x14')](_0xc008('0x71'),_0x5233bb[_0xc008('0x5a')]['id'],_0x5233bb['user'][_0xc008('0x24')],_0x5233bb[_0xc008('0x5a')]['role'],_0x50bfe5['interaction']['id'],_0x5233bb['body']?JSON[_0xc008('0x67')](_0x5233bb[_0xc008('0x44')]):_0xc008('0x72'));return respondWithRpcPromise(_0xc008('0x73'),_0xc008('0x74'),_0x50bfe5);}return null;})[_0xc008('0x13')](function(_0x285c09){var _0x43ba59=_0xc008('0x75')+_0x285c09[_0xc008('0x1b')]['ContactId'];return db['sequelize'][_0xc008('0x2e')](_0x43ba59,{'type':db[_0xc008('0x76')][_0xc008('0x77')][_0xc008('0x78')],'raw':!![]})[_0xc008('0x13')](function(_0x37fc2c){return _0x37fc2c;});})['then'](function(_0x5794fe){if(_0x5794fe){_0x50bfe5[_0xc008('0x1b')][_0xc008('0x79')]=_0x5794fe[0x0];if(!_0x5233bb[_0xc008('0x44')]['UserId'])return;return db['User']['find']({'where':{'id':_0x5233bb['body']['UserId'],'role':'agent'},'attributes':['id',_0xc008('0x24'),'fullname',_0xc008('0x7a'),'internal'],'raw':!![]});}return null;})[_0xc008('0x13')](function(_0x41151e){if(!_0x41151e)return null;_0x50bfe5[_0xc008('0x1b')]['agent']=_0x41151e;return _0x50bfe5;})['then'](function(_0x2ff671){if(_0x2ff671){if(_0x5233bb['body'][_0xc008('0x7b')]){_0x50bfe5[_0xc008('0x1b')]['interface']=util[_0xc008('0x65')]('SIP/%s',_0x5233bb['user'][_0xc008('0x24')]);_0x50bfe5[_0xc008('0x1b')]['channel']=_0x50bfe5[_0xc008('0x7c')];_0x50bfe5[_0xc008('0x1b')][_0xc008('0x7d')]='accept';_0x50bfe5[_0xc008('0x1b')][_0xc008('0x44')]=htmlToText[_0xc008('0x7e')](_0x50bfe5[_0xc008('0x1b')][_0xc008('0x44')]);return respondWithRpcPromise(_0xc008('0x7f'),'EventManager',{'event':_0xc008('0x80'),'message':_0x50bfe5[_0xc008('0x1b')]},client9002)[_0xc008('0x13')](function(){return _0x50bfe5;});}return _0x50bfe5;}return null;})['then'](respondWithResult(_0x278cbe,null))[_0xc008('0x3e')](handleError(_0x278cbe,null));};exports[_0xc008('0x81')]=function(_0x4452a8,_0x4914ed){var _0x48c38b={'agent':{},'channel':'mail'};if(_0x4452a8[_0xc008('0x44')]['id']){delete _0x4452a8[_0xc008('0x44')]['id'];}_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')]=_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')]||_0x4452a8[_0xc008('0x5a')]['id'];_0x48c38b[_0xc008('0x6c')]['id']=_0x4452a8['body'][_0xc008('0x6b')];return db[_0xc008('0x28')]['find']({'where':{'id':_0x4452a8['params']['id'],'UserId':null}})[_0xc008('0x13')](handleEntityNotFound(_0x4914ed,null))[_0xc008('0x13')](function(_0x2be063){if(_0x2be063){_0x48c38b[_0xc008('0x1b')]=_0x2be063[_0xc008('0x6d')]({'plain':!![]});return db['MailInteraction'][_0xc008('0x43')]({'where':{'id':_0x2be063[_0xc008('0x82')]}});}return null;})['then'](handleEntityNotFound(_0x4914ed,null))[_0xc008('0x13')](function(_0x1cc68f){if(_0x1cc68f){_0x48c38b[_0xc008('0x83')]=_0x1cc68f[_0xc008('0x6d')]({'plain':!![]});interaction_log['info'](_0xc008('0x84'),_0x4452a8[_0xc008('0x5a')]['id'],_0x4452a8[_0xc008('0x5a')][_0xc008('0x24')],_0x4452a8['user'][_0xc008('0x85')],_0x48c38b[_0xc008('0x83')]['id'],_0x4452a8['body']?JSON['stringify'](_0x4452a8[_0xc008('0x44')]):'null');return respondWithRpcPromise(_0xc008('0x86'),_0xc008('0x87'),_0x48c38b);}return null;})['then'](function(_0x1b6858){var _0x201ffa=_0xc008('0x75')+_0x1b6858[_0xc008('0x1b')][_0xc008('0x88')];return db[_0xc008('0x89')][_0xc008('0x2e')](_0x201ffa,{'type':db[_0xc008('0x76')][_0xc008('0x77')][_0xc008('0x78')],'raw':!![]})['then'](function(_0x49e6d5){return _0x49e6d5;});})[_0xc008('0x13')](function(_0x3d6f70){if(_0x3d6f70){_0x48c38b['message'][_0xc008('0x79')]=_0x3d6f70[0x0];if(!_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')])return;return db['User'][_0xc008('0x43')]({'where':{'id':_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')],'role':_0xc008('0x6c')},'attributes':['id',_0xc008('0x24'),_0xc008('0x8a'),_0xc008('0x7a'),'internal'],'raw':!![]});}return null;})[_0xc008('0x13')](function(_0x49cd29){if(!_0x49cd29)return null;_0x48c38b[_0xc008('0x1b')][_0xc008('0x6c')]=_0x49cd29;return _0x48c38b;})[_0xc008('0x13')](function(_0x583077){if(_0x583077){_0x583077[_0xc008('0x1b')][_0xc008('0x8b')]=util[_0xc008('0x65')](_0xc008('0x8c'),_0x4452a8[_0xc008('0x5a')][_0xc008('0x24')]);_0x583077[_0xc008('0x1b')][_0xc008('0x7c')]=_0x48c38b[_0xc008('0x7c')];_0x583077[_0xc008('0x1b')]['event']=_0xc008('0x81');_0x583077[_0xc008('0x1b')][_0xc008('0x44')]=htmlToText[_0xc008('0x7e')](_0x48c38b[_0xc008('0x1b')]['body']);respondWithRpcPromise(_0xc008('0x7f'),_0xc008('0x7f'),{'event':_0xc008('0x8d'),'message':_0x583077[_0xc008('0x1b')]},client9002);return _0x48c38b;}return null;})[_0xc008('0x13')](respondWithResult(_0x4914ed,null))[_0xc008('0x3e')](handleError(_0x4914ed,null));};exports[_0xc008('0x8e')]=function(_0x220170,_0x2cc170){var _0x3e200b=moment()[_0xc008('0x8f')]()[_0xc008('0x90')]();var _0x2e2c2a=path[_0xc008('0x5d')](config[_0xc008('0x5e')],'server','files',_0xc008('0x91'));var _0x276ced=path[_0xc008('0x5d')](config[_0xc008('0x5e')],_0xc008('0x92'),_0xc008('0x93'),_0xc008('0x5c'));var _0x3eb3de=util[_0xc008('0x65')]('message-%s.eml',_0x3e200b);return db[_0xc008('0x28')][_0xc008('0x43')]({'where':{'id':_0x220170['params']['id']},'attributes':['id',_0xc008('0x44'),_0xc008('0x94'),'to','cc',_0xc008('0x95'),_0xc008('0x96'),_0xc008('0x97')],'include':_0x220170[_0xc008('0x2e')]['attachments']?[{'model':db[_0xc008('0x98')],'as':_0xc008('0x99')}]:undefined})[_0xc008('0x13')](handleEntityNotFound(_0x2cc170,null))[_0xc008('0x13')](function(_0x59e3d0){if(_0x59e3d0){var _0x13a0bd=_0x59e3d0;var _0x5d5d2f={'from':_0x13a0bd[_0xc008('0x94')],'to':_0x13a0bd['to'],'subject':_0x13a0bd[_0xc008('0x96')],'html':_0x13a0bd['body'],'headers':{'Date':moment(_0x13a0bd[_0xc008('0x97')])['format'](_0xc008('0x9a'))},'attachments':[]};if(_0x59e3d0['cc']){_0x5d5d2f['headers']['Cc']=_0x59e3d0['cc'];}if(_0x59e3d0['bcc']){_0x5d5d2f['headers'][_0xc008('0x9b')]=_0x59e3d0[_0xc008('0x95')];}return new BPromise(function(_0x48f40f,_0x4fda8){if(_0x59e3d0[_0xc008('0x99')]){for(var _0x4a7692=0x0;_0x4a7692<_0x59e3d0[_0xc008('0x99')][_0xc008('0x34')];_0x4a7692++){var _0x1564a9=_0x59e3d0['Attachments'][_0x4a7692];var _0x33cad3=path[_0xc008('0x5d')](_0x276ced,_0x1564a9[_0xc008('0x60')]);if(fs[_0xc008('0x9c')](_0x33cad3)){_0x5d5d2f[_0xc008('0x5c')][_0xc008('0x9d')]({'name':_0x1564a9[_0xc008('0x24')],'contentType':_0x1564a9[_0xc008('0x2b')],'data':fs[_0xc008('0x9e')](_0x33cad3)});}}}emlformat[_0xc008('0x9f')](_0x5d5d2f,function(_0x427fd2,_0x4ea18b){if(_0x427fd2)return _0x4fda8(_0x427fd2);fs[_0xc008('0xa0')](path[_0xc008('0x5d')](_0x2e2c2a,_0x3eb3de),_0x4ea18b);return _0x48f40f(_0x4ea18b);});});}})[_0xc008('0x13')](function(_0x4b946a){if(_0x4b946a){return _0x2cc170[_0xc008('0x8e')](path[_0xc008('0x5d')](_0x2e2c2a,_0x3eb3de),_0x3eb3de,function(_0x3f6018){if(!_0x3f6018)fs['unlinkSync'](path[_0xc008('0x5d')](_0x2e2c2a,_0x3eb3de));});}})['catch'](handleError(_0x2cc170,null));}; \ No newline at end of file +var _0x008c=['pass','attachments','join','root','server/files/attachments','basename','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','UserId','agent','get','MailInteraction','update','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','email','manual','channel','event','fromString','EventManager','acceptmessage','reject','MailInteractionId','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','sequelize','fullname','interface','SIP/%s','rejectmessage','download','unix','toString','tmp','server','files','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','existsSync','push','readFileSync','build','writeFileSync','eml-format','moment','bluebird','util','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','localhost','./mailMessage.socket','register','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','status','json','offset','undefined','limit','count','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','find','body','destroy','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','secure','authentication','auth','user'];(function(_0x379e12,_0x1ca3cd){var _0x1cbe01=function(_0x126071){while(--_0x126071){_0x379e12['push'](_0x379e12['shift']());}};_0x1cbe01(++_0x1ca3cd);}(_0x008c,0x188));var _0xc008=function(_0x5f23d9,_0x431d9a){_0x5f23d9=_0x5f23d9-0x0;var _0x68fb9e=_0x008c[_0x5f23d9];return _0x68fb9e;};'use strict';var emlformat=require(_0xc008('0x0'));var moment=require(_0xc008('0x1'));var BPromise=require(_0xc008('0x2'));var util=require(_0xc008('0x3'));var path=require(_0xc008('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xc008('0x5'));var htmlToText=require(_0xc008('0x6'));var qs=require(_0xc008('0x7'));var logger=require(_0xc008('0x8'))(_0xc008('0x9'));var interaction_log=require(_0xc008('0x8'))(_0xc008('0xa'));var config=require(_0xc008('0xb'));var db=require(_0xc008('0xc'))['db'];config['redis']=_[_0xc008('0xd')](config['redis'],{'host':_0xc008('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc008('0xf'))[_0xc008('0x10')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0xc008('0x11')][_0xc008('0x12')]({'port':0x232b});var client9002=jayson['client'][_0xc008('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x332fd4,_0x2ea200,_0x2a5b4e,_0x9ffa93){return new BPromise(function(_0x1819c6,_0x69726e){var _0x593f7a=_0x9ffa93||client;return _0x593f7a['request'](_0x332fd4,_0x2a5b4e)[_0xc008('0x13')](function(_0x50c1ab){logger[_0xc008('0x14')](_0xc008('0x15'),_0x2ea200,_0xc008('0x16'));logger[_0xc008('0x17')](_0xc008('0x18'),_0x2ea200,'request\x20sent',JSON['stringify'](_0x50c1ab));if(_0x50c1ab['error']){if(_0x50c1ab[_0xc008('0x19')][_0xc008('0x1a')]===0x1f4){logger[_0xc008('0x19')](_0xc008('0x15'),_0x2ea200,_0x50c1ab['error']['message']);return _0x69726e(_0x50c1ab['error']['message']);}logger[_0xc008('0x19')](_0xc008('0x15'),_0x2ea200,_0x50c1ab['error'][_0xc008('0x1b')]);return _0x1819c6(_0x50c1ab['error']['message']);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x2ea200,_0xc008('0x16'));_0x1819c6(_0x50c1ab['result']['message']);}})['catch'](function(_0x4a582d){logger['error'](_0xc008('0x15'),_0x2ea200,_0x4a582d);_0x69726e(_0x4a582d);});});}function respondWithResult(_0x4777a6,_0x251db2){_0x251db2=_0x251db2||0xc8;return function(_0x415af3){if(_0x415af3){return _0x4777a6[_0xc008('0x1c')](_0x251db2)[_0xc008('0x1d')](_0x415af3);}};}function respondWithFilteredResult(_0x4f43e2,_0x459fd9){return function(_0x5c85f2){if(_0x5c85f2){var _0x58a6ea=typeof _0x459fd9[_0xc008('0x1e')]===_0xc008('0x1f')&&typeof _0x459fd9[_0xc008('0x20')]===_0xc008('0x1f');var _0x5410f5=_0x5c85f2['count'];var _0x5de1e9=_0x58a6ea?0x0:_0x459fd9[_0xc008('0x1e')];var _0x15dade=_0x58a6ea?_0x5c85f2[_0xc008('0x21')]:_0x459fd9[_0xc008('0x1e')]+_0x459fd9['limit'];var _0x5e2aca;if(_0x15dade>=_0x5410f5){_0x15dade=_0x5410f5;_0x5e2aca=0xc8;}else{_0x5e2aca=0xce;}_0x4f43e2['status'](_0x5e2aca);return _0x4f43e2['set']('Content-Range',_0x5de1e9+'-'+_0x15dade+'/'+_0x5410f5)[_0xc008('0x1d')](_0x5c85f2);}return null;};}function saveUpdates(_0x29ba43){return function(_0x25eae4){if(_0x25eae4){return _0x25eae4['update'](_0x29ba43)[_0xc008('0x13')](function(_0x32390d){return _0x32390d;});}return null;};}function removeEntity(_0x209591){return function(_0x2a7d4f){if(_0x2a7d4f){return _0x2a7d4f['destroy']()[_0xc008('0x13')](function(){_0x209591[_0xc008('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58db82){return function(_0x539766){if(!_0x539766){_0x58db82[_0xc008('0x22')](0x194);}return _0x539766;};}function handleError(_0x267abd,_0xf831f2){_0xf831f2=_0xf831f2||0x1f4;return function(_0x10889f){logger[_0xc008('0x19')](_0x10889f[_0xc008('0x23')]);if(_0x10889f[_0xc008('0x24')]){delete _0x10889f[_0xc008('0x24')];}_0x267abd[_0xc008('0x1c')](_0xf831f2)[_0xc008('0x25')](_0x10889f);};}exports[_0xc008('0x26')]=function(_0x1ac7c8,_0x596ee8){var _0x334a09={},_0x4b7fd4={},_0x499754={'count':0x0,'rows':[]};var _0xaf4b84=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xd0e05a){return{'name':_0xd0e05a[_0xc008('0x2a')],'type':_0xd0e05a[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x4b7fd4[_0xc008('0x2d')]=_['map'](_0xaf4b84,_0xc008('0x24'));_0x4b7fd4[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x1ac7c8[_0xc008('0x2e')]);_0x4b7fd4[_0xc008('0x30')]=_[_0xc008('0x31')](_0x4b7fd4[_0xc008('0x2d')],_0x4b7fd4['query']);_0x334a09[_0xc008('0x32')]=_[_0xc008('0x31')](_0x4b7fd4['model'],qs[_0xc008('0x33')](_0x1ac7c8[_0xc008('0x2e')]['fields']));_0x334a09[_0xc008('0x32')]=_0x334a09[_0xc008('0x32')][_0xc008('0x34')]?_0x334a09['attributes']:_0x4b7fd4['model'];if(!_0x1ac7c8['query'][_0xc008('0x35')]('nolimit')){_0x334a09[_0xc008('0x20')]=qs[_0xc008('0x20')](_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x20')]);_0x334a09[_0xc008('0x1e')]=qs[_0xc008('0x1e')](_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x1e')]);}_0x334a09[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x37')]);_0x334a09[_0xc008('0x38')]=qs[_0xc008('0x30')](_['pick'](_0x1ac7c8[_0xc008('0x2e')],_0x4b7fd4[_0xc008('0x30')]),_0xaf4b84);if(_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x39')]){_0x334a09['where']=_[_0xc008('0x3a')](_0x334a09[_0xc008('0x38')],{'$or':_[_0xc008('0x27')](_0xaf4b84,function(_0x36e7ae){if(_0x36e7ae[_0xc008('0x2b')]!=='VIRTUAL'){var _0x398cdd={};_0x398cdd[_0x36e7ae[_0xc008('0x24')]]={'$like':'%'+_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x39')]+'%'};return _0x398cdd;}})});}_0x334a09=_[_0xc008('0x3a')]({},_0x334a09,_0x1ac7c8['options']);var _0xf4cc4b={'where':_0x334a09[_0xc008('0x38')]};return db[_0xc008('0x28')][_0xc008('0x21')](_0xf4cc4b)['then'](function(_0x26cd05){_0x499754[_0xc008('0x21')]=_0x26cd05;if(_0x1ac7c8[_0xc008('0x2e')]['includeAll']){_0x334a09[_0xc008('0x3b')]=[{'all':!![]}];}return db['MailMessage'][_0xc008('0x3c')](_0x334a09);})['then'](function(_0x46fa8f){_0x499754[_0xc008('0x3d')]=_0x46fa8f;return _0x499754;})['then'](respondWithFilteredResult(_0x596ee8,_0x334a09))[_0xc008('0x3e')](handleError(_0x596ee8,null));};exports[_0xc008('0x3f')]=function(_0x6d6d4c,_0x5caaa2){var _0x1cec64={'raw':!![],'where':{'id':_0x6d6d4c[_0xc008('0x40')]['id']}},_0x2a9b5c={};_0x2a9b5c[_0xc008('0x2d')]=_[_0xc008('0x2f')](db[_0xc008('0x28')]['rawAttributes']);_0x2a9b5c['query']=_['keys'](_0x6d6d4c[_0xc008('0x2e')]);_0x2a9b5c[_0xc008('0x30')]=_[_0xc008('0x31')](_0x2a9b5c[_0xc008('0x2d')],_0x2a9b5c[_0xc008('0x2e')]);_0x1cec64[_0xc008('0x32')]=_[_0xc008('0x31')](_0x2a9b5c[_0xc008('0x2d')],qs['fields'](_0x6d6d4c['query']['fields']));_0x1cec64[_0xc008('0x32')]=_0x1cec64[_0xc008('0x32')][_0xc008('0x34')]?_0x1cec64['attributes']:_0x2a9b5c[_0xc008('0x2d')];if(_0x6d6d4c[_0xc008('0x2e')][_0xc008('0x41')]){_0x1cec64[_0xc008('0x3b')]=[{'all':!![]}];}_0x1cec64=_[_0xc008('0x3a')]({},_0x1cec64,_0x6d6d4c[_0xc008('0x42')]);return db[_0xc008('0x28')][_0xc008('0x43')](_0x1cec64)[_0xc008('0x13')](handleEntityNotFound(_0x5caaa2,null))[_0xc008('0x13')](respondWithResult(_0x5caaa2,null))['catch'](handleError(_0x5caaa2,null));};exports['update']=function(_0x223056,_0x51cb14){if(_0x223056[_0xc008('0x44')]['id']){delete _0x223056[_0xc008('0x44')]['id'];}return db[_0xc008('0x28')]['find']({'where':{'id':_0x223056[_0xc008('0x40')]['id']}})[_0xc008('0x13')](handleEntityNotFound(_0x51cb14,null))[_0xc008('0x13')](saveUpdates(_0x223056[_0xc008('0x44')],null))[_0xc008('0x13')](respondWithResult(_0x51cb14,null))['catch'](handleError(_0x51cb14,null));};exports[_0xc008('0x45')]=function(_0x27b022,_0x4b4c6d){return db[_0xc008('0x28')][_0xc008('0x43')]({'where':{'id':_0x27b022['params']['id']}})['then'](handleEntityNotFound(_0x4b4c6d,null))[_0xc008('0x13')](removeEntity(_0x4b4c6d,null))[_0xc008('0x3e')](handleError(_0x4b4c6d,null));};exports[_0xc008('0x46')]=function(_0x30d0aa,_0x14b6a0){return db['MailMessage']['describe']()[_0xc008('0x13')](respondWithResult(_0x14b6a0,null))['catch'](handleError(_0x14b6a0,null));};exports[_0xc008('0x47')]=function(_0x25d351,_0xf94fcb){return db[_0xc008('0x28')][_0xc008('0x47')](_0x25d351[_0xc008('0x44')])['then'](function(_0x2ea742){if(_0x2ea742){if(_0x2ea742[_0xc008('0x48')]===_0xc008('0x49')&&!_0x2ea742[_0xc008('0x4a')]){var _0x4424f5,_0x5aa385,_0x41fae3;if(_0x25d351['body']['to']){_0x5aa385=_0x25d351['body']['to']['split'](',')[0x0];}return db[_0xc008('0x4b')][_0xc008('0x4c')]({'where':{'id':_0x2ea742[_0xc008('0x4d')]},'include':[{'model':db['CmList'],'as':_0xc008('0x4e'),'include':[{'model':db[_0xc008('0x4f')],'as':_0xc008('0x50'),'where':{'email':_0x5aa385},'limit':0x1,'order':[['updatedAt',_0xc008('0x51')]]}]},{'model':db[_0xc008('0x52')],'as':_0xc008('0x53'),'raw':!![]}]})[_0xc008('0x13')](function(_0x5baff1){_0x4424f5=_0x5baff1;if(_0x4424f5&&_0x4424f5[_0xc008('0x53')]){var _0x4eaa6d={'tls':{'rejectUnauthorized':![]}};if(_[_0xc008('0x54')](_0x4424f5[_0xc008('0x53')][_0xc008('0x55')])){_0x4eaa6d[_0xc008('0x56')]=_0x4424f5[_0xc008('0x53')][_0xc008('0x56')];_0x4eaa6d['port']=_0x4424f5[_0xc008('0x53')]['port'];_0x4eaa6d['secure']=_0x4424f5[_0xc008('0x53')][_0xc008('0x57')];if(_0x4424f5['Smtp'][_0xc008('0x58')]){_0x4eaa6d[_0xc008('0x59')]={'user':_0x4424f5[_0xc008('0x53')][_0xc008('0x5a')],'pass':_0x4424f5[_0xc008('0x53')][_0xc008('0x5b')]};}}else{_0x4eaa6d[_0xc008('0x55')]=_0x4424f5['Smtp'][_0xc008('0x55')];_0x4eaa6d[_0xc008('0x59')]={'user':_0x4424f5[_0xc008('0x53')][_0xc008('0x5a')],'pass':_0x4424f5[_0xc008('0x53')][_0xc008('0x5b')]};_0x4eaa6d[_0xc008('0x57')]=_0x4424f5[_0xc008('0x53')][_0xc008('0x57')];}if(_0x25d351[_0xc008('0x44')][_0xc008('0x5c')]&&_0x25d351[_0xc008('0x44')][_0xc008('0x5c')][_0xc008('0x34')]){for(var _0x4e0251=0x0;_0x4e0251<_0x25d351[_0xc008('0x44')][_0xc008('0x5c')][_0xc008('0x34')];_0x4e0251+=0x1){_0x25d351['body'][_0xc008('0x5c')][_0x4e0251]={'filename':_0x25d351[_0xc008('0x44')]['attachments'][_0x4e0251]['name'],'path':path[_0xc008('0x5d')](config[_0xc008('0x5e')],_0xc008('0x5f'),_0x25d351[_0xc008('0x44')][_0xc008('0x5c')][_0x4e0251][_0xc008('0x60')])};}}_0x41fae3={'account':_0x4eaa6d,'message':_0x25d351[_0xc008('0x44')]};return;}})[_0xc008('0x13')](function(){if(_0x4424f5[_0xc008('0x4e')]){if(_0x4424f5[_0xc008('0x4e')][_0xc008('0x50')]['length']){return _0x4424f5[_0xc008('0x4e')][_0xc008('0x50')][0x0];}else{return db[_0xc008('0x4f')][_0xc008('0x47')](_['defaults'](_0x25d351[_0xc008('0x44')],{'firstName':_0x25d351['body']['to'],'email':_0x25d351[_0xc008('0x44')]['to'],'phone':_0x25d351[_0xc008('0x44')]['to'],'ListId':_0x4424f5[_0xc008('0x61')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xc008('0x13')](function(){if(_0x41fae3){return respondWithRpcPromise(_0xc008('0x62'),_0xc008('0x63'),_0x41fae3,client9003)['then'](function(_0x35b28a){return _0x2ea742['update']({'read':!![],'messageId':_0x35b28a[_0xc008('0x64')],'sentAt':moment()[_0xc008('0x65')](_0xc008('0x66'))});})[_0xc008('0x3e')](function(_0x295ec7){logger['error']('%s',JSON[_0xc008('0x67')](_0x295ec7));return _0x2ea742;});}return _0x2ea742;});}return _0x2ea742;}})[_0xc008('0x13')](respondWithResult(_0xf94fcb,0xc9))['catch'](handleError(_0xf94fcb,null));};exports[_0xc008('0x68')]=function(_0x5233bb,_0x278cbe){var _0x50bfe5={'agent':{},'channel':_0xc008('0x69')};if(_0x5233bb['body']['id']){delete _0x5233bb[_0xc008('0x44')]['id'];}_0x5233bb[_0xc008('0x44')][_0xc008('0x6a')]=!![];_0x5233bb[_0xc008('0x44')]['readAt']=moment()[_0xc008('0x65')](_0xc008('0x66'));_0x5233bb[_0xc008('0x44')][_0xc008('0x6b')]=_0x5233bb[_0xc008('0x44')][_0xc008('0x6b')]||_0x5233bb[_0xc008('0x5a')]['id'];_0x50bfe5[_0xc008('0x6c')]['id']=_0x5233bb['body'][_0xc008('0x6b')];return db['MailMessage']['find']({'where':{'id':_0x5233bb['params']['id'],'UserId':null}})[_0xc008('0x13')](handleEntityNotFound(_0x278cbe,null))[_0xc008('0x13')](saveUpdates(_0x5233bb[_0xc008('0x44')],null))[_0xc008('0x13')](function(_0xc2f684){if(_0xc2f684){_0x50bfe5[_0xc008('0x1b')]=_0xc2f684[_0xc008('0x6d')]({'plain':!![]});return db[_0xc008('0x6e')][_0xc008('0x43')]({'where':{'id':_0xc2f684['MailInteractionId']}});}return null;})[_0xc008('0x13')](handleEntityNotFound(_0x278cbe,null))[_0xc008('0x13')](function(_0x2b1b26){if(_0x2b1b26){return _0x2b1b26[_0xc008('0x6f')]({'UserId':_0x5233bb[_0xc008('0x44')][_0xc008('0x6b')],'read1stAt':_[_0xc008('0x54')](_0x2b1b26[_0xc008('0x70')])?moment()[_0xc008('0x65')](_0xc008('0x66')):undefined});}return null;})[_0xc008('0x13')](function(_0x1dd9fe){if(_0x1dd9fe){_0x50bfe5['interaction']=_0x1dd9fe['get']({'plain':!![]});interaction_log[_0xc008('0x14')](_0xc008('0x71'),_0x5233bb[_0xc008('0x5a')]['id'],_0x5233bb['user'][_0xc008('0x24')],_0x5233bb[_0xc008('0x5a')]['role'],_0x50bfe5['interaction']['id'],_0x5233bb['body']?JSON[_0xc008('0x67')](_0x5233bb[_0xc008('0x44')]):_0xc008('0x72'));return respondWithRpcPromise(_0xc008('0x73'),_0xc008('0x74'),_0x50bfe5);}return null;})[_0xc008('0x13')](function(_0x285c09){var _0x43ba59=_0xc008('0x75')+_0x285c09[_0xc008('0x1b')]['ContactId'];return db['sequelize'][_0xc008('0x2e')](_0x43ba59,{'type':db[_0xc008('0x76')][_0xc008('0x77')][_0xc008('0x78')],'raw':!![]})[_0xc008('0x13')](function(_0x37fc2c){return _0x37fc2c;});})['then'](function(_0x5794fe){if(_0x5794fe){_0x50bfe5[_0xc008('0x1b')][_0xc008('0x79')]=_0x5794fe[0x0];if(!_0x5233bb[_0xc008('0x44')]['UserId'])return;return db['User']['find']({'where':{'id':_0x5233bb['body']['UserId'],'role':'agent'},'attributes':['id',_0xc008('0x24'),'fullname',_0xc008('0x7a'),'internal'],'raw':!![]});}return null;})[_0xc008('0x13')](function(_0x41151e){if(!_0x41151e)return null;_0x50bfe5[_0xc008('0x1b')]['agent']=_0x41151e;return _0x50bfe5;})['then'](function(_0x2ff671){if(_0x2ff671){if(_0x5233bb['body'][_0xc008('0x7b')]){_0x50bfe5[_0xc008('0x1b')]['interface']=util[_0xc008('0x65')]('SIP/%s',_0x5233bb['user'][_0xc008('0x24')]);_0x50bfe5[_0xc008('0x1b')]['channel']=_0x50bfe5[_0xc008('0x7c')];_0x50bfe5[_0xc008('0x1b')][_0xc008('0x7d')]='accept';_0x50bfe5[_0xc008('0x1b')][_0xc008('0x44')]=htmlToText[_0xc008('0x7e')](_0x50bfe5[_0xc008('0x1b')][_0xc008('0x44')]);return respondWithRpcPromise(_0xc008('0x7f'),'EventManager',{'event':_0xc008('0x80'),'message':_0x50bfe5[_0xc008('0x1b')]},client9002)[_0xc008('0x13')](function(){return _0x50bfe5;});}return _0x50bfe5;}return null;})['then'](respondWithResult(_0x278cbe,null))[_0xc008('0x3e')](handleError(_0x278cbe,null));};exports[_0xc008('0x81')]=function(_0x4452a8,_0x4914ed){var _0x48c38b={'agent':{},'channel':'mail'};if(_0x4452a8[_0xc008('0x44')]['id']){delete _0x4452a8[_0xc008('0x44')]['id'];}_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')]=_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')]||_0x4452a8[_0xc008('0x5a')]['id'];_0x48c38b[_0xc008('0x6c')]['id']=_0x4452a8['body'][_0xc008('0x6b')];return db[_0xc008('0x28')]['find']({'where':{'id':_0x4452a8['params']['id'],'UserId':null}})[_0xc008('0x13')](handleEntityNotFound(_0x4914ed,null))[_0xc008('0x13')](function(_0x2be063){if(_0x2be063){_0x48c38b[_0xc008('0x1b')]=_0x2be063[_0xc008('0x6d')]({'plain':!![]});return db['MailInteraction'][_0xc008('0x43')]({'where':{'id':_0x2be063[_0xc008('0x82')]}});}return null;})['then'](handleEntityNotFound(_0x4914ed,null))[_0xc008('0x13')](function(_0x1cc68f){if(_0x1cc68f){_0x48c38b[_0xc008('0x83')]=_0x1cc68f[_0xc008('0x6d')]({'plain':!![]});interaction_log['info'](_0xc008('0x84'),_0x4452a8[_0xc008('0x5a')]['id'],_0x4452a8[_0xc008('0x5a')][_0xc008('0x24')],_0x4452a8['user'][_0xc008('0x85')],_0x48c38b[_0xc008('0x83')]['id'],_0x4452a8['body']?JSON['stringify'](_0x4452a8[_0xc008('0x44')]):'null');return respondWithRpcPromise(_0xc008('0x86'),_0xc008('0x87'),_0x48c38b);}return null;})['then'](function(_0x1b6858){var _0x201ffa=_0xc008('0x75')+_0x1b6858[_0xc008('0x1b')][_0xc008('0x88')];return db[_0xc008('0x89')][_0xc008('0x2e')](_0x201ffa,{'type':db[_0xc008('0x76')][_0xc008('0x77')][_0xc008('0x78')],'raw':!![]})['then'](function(_0x49e6d5){return _0x49e6d5;});})[_0xc008('0x13')](function(_0x3d6f70){if(_0x3d6f70){_0x48c38b['message'][_0xc008('0x79')]=_0x3d6f70[0x0];if(!_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')])return;return db['User'][_0xc008('0x43')]({'where':{'id':_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')],'role':_0xc008('0x6c')},'attributes':['id',_0xc008('0x24'),_0xc008('0x8a'),_0xc008('0x7a'),'internal'],'raw':!![]});}return null;})[_0xc008('0x13')](function(_0x49cd29){if(!_0x49cd29)return null;_0x48c38b[_0xc008('0x1b')][_0xc008('0x6c')]=_0x49cd29;return _0x48c38b;})[_0xc008('0x13')](function(_0x583077){if(_0x583077){_0x583077[_0xc008('0x1b')][_0xc008('0x8b')]=util[_0xc008('0x65')](_0xc008('0x8c'),_0x4452a8[_0xc008('0x5a')][_0xc008('0x24')]);_0x583077[_0xc008('0x1b')][_0xc008('0x7c')]=_0x48c38b[_0xc008('0x7c')];_0x583077[_0xc008('0x1b')]['event']=_0xc008('0x81');_0x583077[_0xc008('0x1b')][_0xc008('0x44')]=htmlToText[_0xc008('0x7e')](_0x48c38b[_0xc008('0x1b')]['body']);respondWithRpcPromise(_0xc008('0x7f'),_0xc008('0x7f'),{'event':_0xc008('0x8d'),'message':_0x583077[_0xc008('0x1b')]},client9002);return _0x48c38b;}return null;})[_0xc008('0x13')](respondWithResult(_0x4914ed,null))[_0xc008('0x3e')](handleError(_0x4914ed,null));};exports[_0xc008('0x8e')]=function(_0x220170,_0x2cc170){var _0x3e200b=moment()[_0xc008('0x8f')]()[_0xc008('0x90')]();var _0x2e2c2a=path[_0xc008('0x5d')](config[_0xc008('0x5e')],'server','files',_0xc008('0x91'));var _0x276ced=path[_0xc008('0x5d')](config[_0xc008('0x5e')],_0xc008('0x92'),_0xc008('0x93'),_0xc008('0x5c'));var _0x3eb3de=util[_0xc008('0x65')]('message-%s.eml',_0x3e200b);return db[_0xc008('0x28')][_0xc008('0x43')]({'where':{'id':_0x220170['params']['id']},'attributes':['id',_0xc008('0x44'),_0xc008('0x94'),'to','cc',_0xc008('0x95'),_0xc008('0x96'),_0xc008('0x97')],'include':_0x220170[_0xc008('0x2e')]['attachments']?[{'model':db[_0xc008('0x98')],'as':_0xc008('0x99')}]:undefined})[_0xc008('0x13')](handleEntityNotFound(_0x2cc170,null))[_0xc008('0x13')](function(_0x59e3d0){if(_0x59e3d0){var _0x13a0bd=_0x59e3d0;var _0x5d5d2f={'from':_0x13a0bd[_0xc008('0x94')],'to':_0x13a0bd['to'],'subject':_0x13a0bd[_0xc008('0x96')],'html':_0x13a0bd['body'],'headers':{'Date':moment(_0x13a0bd[_0xc008('0x97')])['format'](_0xc008('0x9a'))},'attachments':[]};if(_0x59e3d0['cc']){_0x5d5d2f['headers']['Cc']=_0x59e3d0['cc'];}if(_0x59e3d0['bcc']){_0x5d5d2f['headers'][_0xc008('0x9b')]=_0x59e3d0[_0xc008('0x95')];}return new BPromise(function(_0x48f40f,_0x4fda8){if(_0x59e3d0[_0xc008('0x99')]){for(var _0x4a7692=0x0;_0x4a7692<_0x59e3d0[_0xc008('0x99')][_0xc008('0x34')];_0x4a7692++){var _0x1564a9=_0x59e3d0['Attachments'][_0x4a7692];var _0x33cad3=path[_0xc008('0x5d')](_0x276ced,_0x1564a9[_0xc008('0x60')]);if(fs[_0xc008('0x9c')](_0x33cad3)){_0x5d5d2f[_0xc008('0x5c')][_0xc008('0x9d')]({'name':_0x1564a9[_0xc008('0x24')],'contentType':_0x1564a9[_0xc008('0x2b')],'data':fs[_0xc008('0x9e')](_0x33cad3)});}}}emlformat[_0xc008('0x9f')](_0x5d5d2f,function(_0x427fd2,_0x4ea18b){if(_0x427fd2)return _0x4fda8(_0x427fd2);fs[_0xc008('0xa0')](path[_0xc008('0x5d')](_0x2e2c2a,_0x3eb3de),_0x4ea18b);return _0x48f40f(_0x4ea18b);});});}})[_0xc008('0x13')](function(_0x4b946a){if(_0x4b946a){return _0x2cc170[_0xc008('0x8e')](path[_0xc008('0x5d')](_0x2e2c2a,_0x3eb3de),_0x3eb3de,function(_0x3f6018){if(!_0x3f6018)fs['unlinkSync'](path[_0xc008('0x5d')](_0x2e2c2a,_0x3eb3de));});}})['catch'](handleError(_0x2cc170,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 464354a..4dae19b 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 _0x52c0=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x52c0,0x1a1));var _0x052c=function(_0x234252,_0x5ac2dc){_0x234252=_0x234252-0x0;var _0x37f193=_0x52c0[_0x234252];return _0x37f193;};'use strict';var EventEmitter=require(_0x052c('0x0'));var MailMessage=require(_0x052c('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x052c('0x2')](0x0);var events={'afterCreate':_0x052c('0x3'),'afterUpdate':_0x052c('0x4'),'afterDestroy':_0x052c('0x5')};function emitEvent(_0x559069){return function(_0x3c4358,_0x171082,_0x9a3019){MailMessageEvents[_0x052c('0x6')](_0x559069+':'+_0x3c4358['id'],_0x3c4358);MailMessageEvents[_0x052c('0x6')](_0x559069,_0x3c4358);_0x9a3019(null);};}for(var e in events){if(events[_0x052c('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x052c('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x612c=['events','MailMessage','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x3005a6,_0x320826){var _0x2f7399=function(_0x210e82){while(--_0x210e82){_0x3005a6['push'](_0x3005a6['shift']());}};_0x2f7399(++_0x320826);}(_0x612c,0x186));var _0xc612=function(_0x2a4cda,_0x5f2fca){_0x2a4cda=_0x2a4cda-0x0;var _0x3a1167=_0x612c[_0x2a4cda];return _0x3a1167;};'use strict';var EventEmitter=require(_0xc612('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xc612('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xc612('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc612('0x3'),'afterDestroy':'remove'};function emitEvent(_0x83393e){return function(_0x57a379,_0x4bed88,_0x5e440e){MailMessageEvents[_0xc612('0x4')](_0x83393e+':'+_0x57a379['id'],_0x57a379);MailMessageEvents['emit'](_0x83393e,_0x57a379);_0x5e440e(null);};}for(var e in events){if(events[_0xc612('0x5')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 77997e1..0c72726 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 _0x1b2b=['./mailMessage.attributes','define','messageId','fti_mail_messages','plainBody','fromString','body','models','get','direction','toLowerCase','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','html-to-text','path','rimraf'];(function(_0x654e84,_0x431ca2){var _0xc77c75=function(_0x5c6e48){while(--_0x5c6e48){_0x654e84['push'](_0x654e84['shift']());}};_0xc77c75(++_0x431ca2);}(_0x1b2b,0x1ab));var _0xb1b2=function(_0x22608f,_0x1ce6dd){_0x22608f=_0x22608f-0x0;var _0x3439b2=_0x1b2b[_0x22608f];return _0x3439b2;};'use strict';var _=require(_0xb1b2('0x0'));var util=require(_0xb1b2('0x1'));var logger=require('../../config/logger')(_0xb1b2('0x2'));var moment=require(_0xb1b2('0x3'));var BPromise=require(_0xb1b2('0x4'));var rp=require('request-promise');var htmlToText=require(_0xb1b2('0x5'));var fs=require('fs');var path=require(_0xb1b2('0x6'));var rimraf=require(_0xb1b2('0x7'));var config=require('../../config/environment');var attributes=require(_0xb1b2('0x8'));module['exports']=function(_0x5ba31b,_0x204d99){return _0x5ba31b[_0xb1b2('0x9')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xb1b2('0xa'),'fields':[_0xb1b2('0xa')]},{'name':_0xb1b2('0xb'),'fields':[_0xb1b2('0xc'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x46a08f,_0x344bca,_0x148ba0){if(_0x46a08f['body']){_0x46a08f[_0xb1b2('0xc')]=htmlToText[_0xb1b2('0xd')](_0x46a08f[_0xb1b2('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x148ba0(null,_0x344bca);},'afterCreate':function(_0xf1ec57,_0x552dcf,_0x3d4f8d){var _0x86d4c7=_0x5ba31b[_0xb1b2('0xf')];var _0x3e6918=_0xf1ec57[_0xb1b2('0x10')]({'plain':!![]});if(_0x3e6918['direction']['toLowerCase']()==='in'||_0x3e6918[_0xb1b2('0x11')][_0xb1b2('0x12')]()==='out'&&!_0x3e6918['secret']&&!_['isNil'](_0x3e6918['UserId'])){_0x86d4c7[_0xb1b2('0x13')][_0xb1b2('0x14')]({'where':{'id':_0x3e6918[_0xb1b2('0x15')]}})[_0xb1b2('0x16')](function(_0x26327f){if(_0x26327f){_0x26327f[_0xb1b2('0x17')]({'lastMsgAt':_0x3e6918[_0xb1b2('0x18')],'lastMsgDirection':_0x3e6918[_0xb1b2('0x11')][_0xb1b2('0x12')]()});}})[_0xb1b2('0x19')](function(_0x450ac1){console[_0xb1b2('0x1a')](_0x450ac1);});}_0x3d4f8d();}},'charset':_0xb1b2('0x1b'),'collate':_0xb1b2('0x1c')});}; \ No newline at end of file +var _0xe4ac=['MailInteraction','MailInteractionId','then','createdAt','catch','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','messageId','fti_mail_messages','subject','FULLTEXT','plainBody','fromString','body','models','get','direction','toLowerCase','secret','UserId'];(function(_0x1bdac5,_0x48b95c){var _0x3bc727=function(_0x3107e3){while(--_0x3107e3){_0x1bdac5['push'](_0x1bdac5['shift']());}};_0x3bc727(++_0x48b95c);}(_0xe4ac,0x1aa));var _0xce4a=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0xe4ac[_0x1e6659];return _0x4d16e4;};'use strict';var _=require(_0xce4a('0x0'));var util=require('util');var logger=require(_0xce4a('0x1'))(_0xce4a('0x2'));var moment=require('moment');var BPromise=require(_0xce4a('0x3'));var rp=require(_0xce4a('0x4'));var htmlToText=require(_0xce4a('0x5'));var fs=require('fs');var path=require(_0xce4a('0x6'));var rimraf=require(_0xce4a('0x7'));var config=require(_0xce4a('0x8'));var attributes=require(_0xce4a('0x9'));module['exports']=function(_0x247b67,_0x23a661){return _0x247b67[_0xce4a('0xa')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xce4a('0xb'),'fields':[_0xce4a('0xb')]},{'name':_0xce4a('0xc'),'fields':['plainBody',_0xce4a('0xd')],'type':_0xce4a('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x46da59,_0x223e83,_0x41287f){if(_0x46da59['body']){_0x46da59[_0xce4a('0xf')]=htmlToText[_0xce4a('0x10')](_0x46da59[_0xce4a('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x41287f(null,_0x223e83);},'afterCreate':function(_0x5052db,_0x49f844,_0x2095fc){var _0x54053b=_0x247b67[_0xce4a('0x12')];var _0x413286=_0x5052db[_0xce4a('0x13')]({'plain':!![]});if(_0x413286[_0xce4a('0x14')][_0xce4a('0x15')]()==='in'||_0x413286[_0xce4a('0x14')][_0xce4a('0x15')]()==='out'&&!_0x413286[_0xce4a('0x16')]&&!_['isNil'](_0x413286[_0xce4a('0x17')])){_0x54053b[_0xce4a('0x18')]['findOne']({'where':{'id':_0x413286[_0xce4a('0x19')]}})[_0xce4a('0x1a')](function(_0x18bd65){if(_0x18bd65){_0x18bd65['update']({'lastMsgAt':_0x413286[_0xce4a('0x1b')],'lastMsgDirection':_0x413286[_0xce4a('0x14')]['toLowerCase']()});}})[_0xce4a('0x1c')](function(_0x53e846){console['error'](_0x53e846);});}_0x2095fc();}},'charset':'utf8mb4','collate':_0xce4a('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index d742c28..075d10e 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 _0xb574=['../../config/environment','http','socket.io-emitter','redis','./mailMessage.socket','register','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','info','catch','CreateMailMessage','MailMessage','body','options','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x37c07d,_0xdbdb5f){var _0x10dadc=function(_0x2bafb7){while(--_0x2bafb7){_0x37c07d['push'](_0x37c07d['shift']());}};_0x10dadc(++_0xdbdb5f);}(_0xb574,0x106));var _0x4b57=function(_0x569498,_0x497bfb){_0x569498=_0x569498-0x0;var _0x291efa=_0xb574[_0x569498];return _0x291efa;};'use strict';var _=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var moment=require('moment');var BPromise=require(_0x4b57('0x2'));var rs=require(_0x4b57('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b57('0x4'))['db'];var utils=require(_0x4b57('0x5'));var logger=require(_0x4b57('0x6'))(_0x4b57('0x7'));var config=require(_0x4b57('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4b57('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4b57('0xa'))(new Redis(config[_0x4b57('0xb')]));require(_0x4b57('0xc'))[_0x4b57('0xd')](socket);function respondWithRpcPromise(_0xce47ad,_0x116958,_0x1db79a){return new BPromise(function(_0x43b108,_0x5593b8){return client[_0x4b57('0xe')](_0xce47ad,_0x1db79a)[_0x4b57('0xf')](function(_0x274912){logger['info']('MailMessage,\x20%s,\x20%s',_0x116958,_0x4b57('0x10'));logger[_0x4b57('0x11')](_0x4b57('0x12'),_0x116958,_0x4b57('0x10'),JSON[_0x4b57('0x13')](_0x274912));if(_0x274912[_0x4b57('0x14')]){if(_0x274912[_0x4b57('0x14')][_0x4b57('0x15')]===0x1f4){logger[_0x4b57('0x14')]('MailMessage,\x20%s,\x20%s',_0x116958,_0x274912['error'][_0x4b57('0x16')]);return _0x5593b8(_0x274912[_0x4b57('0x14')][_0x4b57('0x16')]);}logger['error'](_0x4b57('0x17'),_0x116958,_0x274912['error'][_0x4b57('0x16')]);return _0x43b108(_0x274912[_0x4b57('0x14')][_0x4b57('0x16')]);}else{logger[_0x4b57('0x18')](_0x4b57('0x17'),_0x116958,_0x4b57('0x10'));_0x43b108(_0x274912['result'][_0x4b57('0x16')]);}})[_0x4b57('0x19')](function(_0x53f29a){logger[_0x4b57('0x14')]('MailMessage,\x20%s,\x20%s',_0x116958,_0x53f29a);_0x5593b8(_0x53f29a);});});}exports[_0x4b57('0x1a')]=function(_0x1ca49e){var _0xad9165=this;return new Promise(function(_0x2682d6,_0xef1eae){return db[_0x4b57('0x1b')]['create'](_0x1ca49e[_0x4b57('0x1c')],{'raw':_0x1ca49e[_0x4b57('0x1d')]?_0x1ca49e[_0x4b57('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x4b57('0xf')](function(_0x4a34b2){logger[_0x4b57('0x18')](_0x4b57('0x1a'),_0x1ca49e);logger['debug'](_0x4b57('0x1a'),_0x1ca49e,JSON[_0x4b57('0x13')](_0x4a34b2));_0x2682d6(_0x4a34b2);})['catch'](function(_0x3e7b96){logger[_0x4b57('0x14')](_0x4b57('0x1a'),_0x3e7b96[_0x4b57('0x16')],_0x1ca49e);_0xef1eae(_0xad9165['error'](0x1f4,_0x3e7b96[_0x4b57('0x16')]));});});}; \ No newline at end of file +var _0xb9be=['redis','localhost','socket.io-emitter','./mailMessage.socket','register','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateMailMessage','MailMessage','create','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0xb9be,0xc5));var _0xeb9b=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0xb9be[_0x4b91c4];return _0x25cb80;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var moment=require(_0xeb9b('0x2'));var BPromise=require(_0xeb9b('0x3'));var rs=require(_0xeb9b('0x4'));var fs=require('fs');var Redis=require(_0xeb9b('0x5'));var db=require(_0xeb9b('0x6'))['db'];var utils=require(_0xeb9b('0x7'));var logger=require(_0xeb9b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeb9b('0x9'));var client=jayson[_0xeb9b('0xa')][_0xeb9b('0xb')]({'port':0x232a});config['redis']=_[_0xeb9b('0xc')](config[_0xeb9b('0xd')],{'host':_0xeb9b('0xe'),'port':0x18eb});var socket=require(_0xeb9b('0xf'))(new Redis(config[_0xeb9b('0xd')]));require(_0xeb9b('0x10'))[_0xeb9b('0x11')](socket);function respondWithRpcPromise(_0x16761a,_0x32f0c4,_0x4f4952){return new BPromise(function(_0x20c855,_0x58d6a4){return client['request'](_0x16761a,_0x4f4952)[_0xeb9b('0x12')](function(_0x4236c0){logger['info'](_0xeb9b('0x13'),_0x32f0c4,_0xeb9b('0x14'));logger[_0xeb9b('0x15')](_0xeb9b('0x16'),_0x32f0c4,'request\x20sent',JSON['stringify'](_0x4236c0));if(_0x4236c0['error']){if(_0x4236c0[_0xeb9b('0x17')][_0xeb9b('0x18')]===0x1f4){logger[_0xeb9b('0x17')]('MailMessage,\x20%s,\x20%s',_0x32f0c4,_0x4236c0['error']['message']);return _0x58d6a4(_0x4236c0[_0xeb9b('0x17')][_0xeb9b('0x19')]);}logger[_0xeb9b('0x17')](_0xeb9b('0x13'),_0x32f0c4,_0x4236c0[_0xeb9b('0x17')][_0xeb9b('0x19')]);return _0x20c855(_0x4236c0[_0xeb9b('0x17')]['message']);}else{logger[_0xeb9b('0x1a')](_0xeb9b('0x13'),_0x32f0c4,_0xeb9b('0x14'));_0x20c855(_0x4236c0[_0xeb9b('0x1b')][_0xeb9b('0x19')]);}})[_0xeb9b('0x1c')](function(_0x21010e){logger[_0xeb9b('0x17')](_0xeb9b('0x13'),_0x32f0c4,_0x21010e);_0x58d6a4(_0x21010e);});});}exports[_0xeb9b('0x1d')]=function(_0x4f436e){var _0x43dc48=this;return new Promise(function(_0x5a7ffd,_0x5d5f54){return db[_0xeb9b('0x1e')][_0xeb9b('0x1f')](_0x4f436e['body'],{'raw':_0x4f436e[_0xeb9b('0x20')]?_0x4f436e[_0xeb9b('0x20')][_0xeb9b('0x21')]===undefined?!![]:![]:!![]})[_0xeb9b('0x12')](function(_0x3c8be7){logger[_0xeb9b('0x1a')](_0xeb9b('0x1d'),_0x4f436e);logger[_0xeb9b('0x15')](_0xeb9b('0x1d'),_0x4f436e,JSON[_0xeb9b('0x22')](_0x3c8be7));_0x5a7ffd(_0x3c8be7);})[_0xeb9b('0x1c')](function(_0x296f95){logger[_0xeb9b('0x17')](_0xeb9b('0x1d'),_0x296f95[_0xeb9b('0x19')],_0x4f436e);_0x5d5f54(_0x43dc48[_0xeb9b('0x17')](0x1f4,_0x296f95['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 77c1fb4..9cb40f9 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 _0xb73c=['removeListener','register','length','mailMessage:','./mailMessage.events','save','remove','update','emit'];(function(_0x410046,_0x57f2d8){var _0x19d054=function(_0x19583c){while(--_0x19583c){_0x410046['push'](_0x410046['shift']());}};_0x19d054(++_0x57f2d8);}(_0xb73c,0x175));var _0xcb73=function(_0x2406f4,_0x52a3a5){_0x2406f4=_0x2406f4-0x0;var _0x3aeb5b=_0xb73c[_0x2406f4];return _0x3aeb5b;};'use strict';var MailMessageEvents=require(_0xcb73('0x0'));var events=[_0xcb73('0x1'),_0xcb73('0x2'),_0xcb73('0x3')];function createListener(_0x541aa8,_0x2ef655){return function(_0x12ac57){_0x2ef655[_0xcb73('0x4')](_0x541aa8,_0x12ac57);};}function removeListener(_0xafe9bb,_0x41f240){return function(){MailMessageEvents[_0xcb73('0x5')](_0xafe9bb,_0x41f240);};}exports[_0xcb73('0x6')]=function(_0x26b184){for(var _0x3988f8=0x0,_0x3aa1a9=events[_0xcb73('0x7')];_0x3988f8<_0x3aa1a9;_0x3988f8++){var _0x136024=events[_0x3988f8];var _0x4a94c5=createListener(_0xcb73('0x8')+_0x136024,_0x26b184);MailMessageEvents['on'](_0x136024,_0x4a94c5);}}; \ No newline at end of file +var _0xed8a=['save','remove','update','length','mailMessage:','./mailMessage.events'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xed8a,0xc5));var _0xaed8=function(_0x469d1c,_0x47c801){_0x469d1c=_0x469d1c-0x0;var _0x33a919=_0xed8a[_0x469d1c];return _0x33a919;};'use strict';var MailMessageEvents=require(_0xaed8('0x0'));var events=[_0xaed8('0x1'),_0xaed8('0x2'),_0xaed8('0x3')];function createListener(_0x568d05,_0x395bb7){return function(_0x3888ee){_0x395bb7['emit'](_0x568d05,_0x3888ee);};}function removeListener(_0x35da54,_0x2b330f){return function(){MailMessageEvents['removeListener'](_0x35da54,_0x2b330f);};}exports['register']=function(_0x347ca1){for(var _0x7e6c5e=0x0,_0x3db036=events[_0xaed8('0x4')];_0x7e6c5e<_0x3db036;_0x7e6c5e++){var _0x291304=events[_0x7e6c5e];var _0x42bc11=createListener(_0xaed8('0x5')+_0x291304,_0x347ca1);MailMessageEvents['on'](_0x291304,_0x42bc11);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index be760b2..cd29cd4 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 _0xb92a=['index','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','delete','destroy','removeTeams','removeAgents','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated'];(function(_0x4e7af4,_0x758572){var _0x2548f1=function(_0xa849c){while(--_0xa849c){_0x4e7af4['push'](_0x4e7af4['shift']());}};_0x2548f1(++_0x758572);}(_0xb92a,0xa0));var _0xab92=function(_0xa7c515,_0x315b37){_0xa7c515=_0xa7c515-0x0;var _0x32b4dc=_0xb92a[_0xa7c515];return _0x32b4dc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab92('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xab92('0x1'));var auth=require(_0xab92('0x2'));var interaction=require(_0xab92('0x3'));var config=require(_0xab92('0x4'));var controller=require(_0xab92('0x5'));router[_0xab92('0x6')]('/',auth[_0xab92('0x7')](),controller[_0xab92('0x8')]);router[_0xab92('0x6')](_0xab92('0x9'),auth[_0xab92('0x7')](),controller[_0xab92('0xa')]);router[_0xab92('0x6')](_0xab92('0xb'),auth[_0xab92('0x7')](),controller['show']);router[_0xab92('0x6')](_0xab92('0xc'),auth[_0xab92('0x7')](),controller['getMembers']);router[_0xab92('0x6')](_0xab92('0xd'),auth[_0xab92('0x7')](),controller[_0xab92('0xe')]);router[_0xab92('0x6')](_0xab92('0xf'),auth[_0xab92('0x7')](),controller[_0xab92('0x10')]);router['post']('/',auth[_0xab92('0x7')](),controller['create']);router[_0xab92('0x11')](_0xab92('0xd'),auth['isAuthenticated'](),controller[_0xab92('0x12')]);router['post'](_0xab92('0xf'),auth['isAuthenticated'](),controller['addAgents']);router[_0xab92('0x13')](_0xab92('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xab92('0x14')]('/:id',auth[_0xab92('0x7')](),controller[_0xab92('0x15')]);router['delete'](_0xab92('0xd'),auth[_0xab92('0x7')](),controller[_0xab92('0x16')]);router['delete'](_0xab92('0xf'),auth[_0xab92('0x7')](),controller[_0xab92('0x17')]);module['exports']=router; \ No newline at end of file +var _0x563b=['describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','isAuthenticated','index','get','/describe'];(function(_0x290062,_0x97edf3){var _0x1f520e=function(_0x1d09b8){while(--_0x1d09b8){_0x290062['push'](_0x290062['shift']());}};_0x1f520e(++_0x97edf3);}(_0x563b,0x199));var _0xb563=function(_0x2984c4,_0x68d3b0){_0x2984c4=_0x2984c4-0x0;var _0x6d19ff=_0x563b[_0x2984c4];return _0x6d19ff;};'use strict';var multer=require(_0xb563('0x0'));var util=require('util');var path=require(_0xb563('0x1'));var timeout=require('connect-timeout');var express=require(_0xb563('0x2'));var router=express[_0xb563('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb563('0x4'));var interaction=require(_0xb563('0x5'));var config=require('../../config/environment');var controller=require(_0xb563('0x6'));router['get']('/',auth[_0xb563('0x7')](),controller[_0xb563('0x8')]);router[_0xb563('0x9')](_0xb563('0xa'),auth[_0xb563('0x7')](),controller[_0xb563('0xb')]);router[_0xb563('0x9')](_0xb563('0xc'),auth[_0xb563('0x7')](),controller['show']);router[_0xb563('0x9')](_0xb563('0xd'),auth[_0xb563('0x7')](),controller[_0xb563('0xe')]);router[_0xb563('0x9')](_0xb563('0xf'),auth[_0xb563('0x7')](),controller[_0xb563('0x10')]);router[_0xb563('0x9')](_0xb563('0x11'),auth[_0xb563('0x7')](),controller[_0xb563('0x12')]);router[_0xb563('0x13')]('/',auth['isAuthenticated'](),controller[_0xb563('0x14')]);router[_0xb563('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0xb563('0x15')]);router[_0xb563('0x13')]('/:id/users',auth[_0xb563('0x7')](),controller[_0xb563('0x16')]);router[_0xb563('0x17')](_0xb563('0xc'),auth[_0xb563('0x7')](),controller[_0xb563('0x18')]);router[_0xb563('0x19')](_0xb563('0xc'),auth[_0xb563('0x7')](),controller[_0xb563('0x1a')]);router[_0xb563('0x19')](_0xb563('0xf'),auth[_0xb563('0x7')](),controller[_0xb563('0x1b')]);router['delete'](_0xb563('0x11'),auth[_0xb563('0x7')](),controller[_0xb563('0x1c')]);module[_0xb563('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 852761b..b375c30 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 _0x9095=['rrmemory','beepall','roundrobin','sequelize','exports','ENUM'];(function(_0x546c68,_0x5c0116){var _0x4a2389=function(_0x5aa205){while(--_0x5aa205){_0x546c68['push'](_0x546c68['shift']());}};_0x4a2389(++_0x5c0116);}(_0x9095,0xc3));var _0x5909=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x9095[_0x5a6644];return _0x3a2a5d;};'use strict';var Sequelize=require(_0x5909('0x0'));module[_0x5909('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5909('0x2')](_0x5909('0x3'),_0x5909('0x4'),_0x5909('0x5'))}}; \ No newline at end of file +var _0xaf82=['rrmemory','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaf82,0x158));var _0x2af8=function(_0x5958c2,_0x43d00a){_0x5958c2=_0x5958c2-0x0;var _0x1ccd13=_0xaf82[_0x5958c2];return _0x1ccd13;};'use strict';var Sequelize=require(_0x2af8('0x0'));module['exports']={'name':{'type':Sequelize[_0x2af8('0x1')],'unique':_0x2af8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2af8('0x1')]},'timeout':{'type':Sequelize[_0x2af8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2af8('0x4'),'beepall',_0x2af8('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 11185da..c61f54b 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 _0x3678=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./mailQueue.socket','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','get','MailQueues','UserProfileResource','sendStatus','error','stack','name','send','map','MailQueue','type','key','model','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','format','%s/%s','getTeams','hasOwnProperty','addTeams','ids','Team','Agents','flatMap','sequelize','each','emit','userMailQueue:save','removeTeams','select','field','team_has_mail_queues','join','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x17cebb,_0x39b50c){var _0x1936fe=function(_0x4e3e6a){while(--_0x4e3e6a){_0x17cebb['push'](_0x17cebb['shift']());}};_0x1936fe(++_0x39b50c);}(_0x3678,0x81));var _0x8367=function(_0x2b737c,_0x274adf){_0x2b737c=_0x2b737c-0x0;var _0x466ed5=_0x3678[_0x2b737c];return _0x466ed5;};'use strict';var emlformat=require(_0x8367('0x0'));var rimraf=require(_0x8367('0x1'));var zipdir=require(_0x8367('0x2'));var jsonpatch=require(_0x8367('0x3'));var rp=require(_0x8367('0x4'));var moment=require(_0x8367('0x5'));var BPromise=require(_0x8367('0x6'));var Mustache=require(_0x8367('0x7'));var util=require(_0x8367('0x8'));var path=require(_0x8367('0x9'));var sox=require(_0x8367('0xa'));var csv=require(_0x8367('0xb'));var ejs=require(_0x8367('0xc'));var fs=require('fs');var fs_extra=require(_0x8367('0xd'));var _=require(_0x8367('0xe'));var squel=require(_0x8367('0xf'));var crypto=require('crypto');var jsforce=require(_0x8367('0x10'));var deskjs=require(_0x8367('0x11'));var toCsv=require(_0x8367('0xb'));var querystring=require(_0x8367('0x12'));var Papa=require(_0x8367('0x13'));var Redis=require(_0x8367('0x14'));var authService=require(_0x8367('0x15'));var qs=require(_0x8367('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8367('0x17'));var logger=require(_0x8367('0x18'))(_0x8367('0x19'));var utils=require('../../config/utils');var config=require(_0x8367('0x1a'));var licenseUtil=require(_0x8367('0x1b'));var db=require(_0x8367('0x1c'))['db'];config['redis']=_[_0x8367('0x1d')](config[_0x8367('0x1e')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8367('0x1e')]));require(_0x8367('0x1f'))['register'](socket);function respondWithStatusCode(_0x2548d8,_0x148aa6){_0x148aa6=_0x148aa6||0xcc;return function(_0xf8b8a7){if(_0xf8b8a7){return _0x2548d8['sendStatus'](_0x148aa6);}return _0x2548d8['status'](_0x148aa6)[_0x8367('0x20')]();};}function respondWithResult(_0x3f378d,_0x322bbc){_0x322bbc=_0x322bbc||0xc8;return function(_0x392dd6){if(_0x392dd6){return _0x3f378d[_0x8367('0x21')](_0x322bbc)[_0x8367('0x22')](_0x392dd6);}};}function respondWithFilteredResult(_0x246f0e,_0x36356a){return function(_0x32da6f){if(_0x32da6f){var _0x33c076=typeof _0x36356a[_0x8367('0x23')]===_0x8367('0x24')&&typeof _0x36356a[_0x8367('0x25')]===_0x8367('0x24');var _0x5b2e72=_0x32da6f[_0x8367('0x26')];var _0x22d81e=_0x33c076?0x0:_0x36356a['offset'];var _0x229a99=_0x33c076?_0x32da6f[_0x8367('0x26')]:_0x36356a[_0x8367('0x23')]+_0x36356a[_0x8367('0x25')];var _0x60c6af;if(_0x229a99>=_0x5b2e72){_0x229a99=_0x5b2e72;_0x60c6af=0xc8;}else{_0x60c6af=0xce;}_0x246f0e[_0x8367('0x21')](_0x60c6af);return _0x246f0e['set'](_0x8367('0x27'),_0x22d81e+'-'+_0x229a99+'/'+_0x5b2e72)['json'](_0x32da6f);}return null;};}function patchUpdates(_0x276eab){return function(_0x2f0c6b){try{jsonpatch[_0x8367('0x28')](_0x2f0c6b,_0x276eab,!![]);}catch(_0xb1386d){return BPromise['reject'](_0xb1386d);}return _0x2f0c6b[_0x8367('0x29')]();};}function saveUpdates(_0x985b7,_0x2d5361){return function(_0x1753ad){if(_0x1753ad){return _0x1753ad['update'](_0x985b7)[_0x8367('0x2a')](function(_0x39951d){return _0x39951d;});}return null;};}function removeEntity(_0x223aaa,_0x22993d){return function(_0x272bbe){if(_0x272bbe){return _0x272bbe[_0x8367('0x2b')]()[_0x8367('0x2a')](function(){var _0x4b065f=_0x272bbe[_0x8367('0x2c')]({'plain':!![]});var _0x534d4b=_0x8367('0x2d');return db[_0x8367('0x2e')][_0x8367('0x2b')]({'where':{'type':_0x534d4b,'resourceId':_0x4b065f['id']}})[_0x8367('0x2a')](function(){return _0x272bbe;});})[_0x8367('0x2a')](function(){_0x223aaa[_0x8367('0x21')](0xcc)[_0x8367('0x20')]();});}};}function handleEntityNotFound(_0x438c33,_0x305c41){return function(_0x5ec8fa){if(!_0x5ec8fa){_0x438c33[_0x8367('0x2f')](0x194);}return _0x5ec8fa;};}function handleError(_0x164475,_0x25e7ad){_0x25e7ad=_0x25e7ad||0x1f4;return function(_0x4dcece){logger[_0x8367('0x30')](_0x4dcece[_0x8367('0x31')]);if(_0x4dcece['name']){delete _0x4dcece[_0x8367('0x32')];}_0x164475['status'](_0x25e7ad)[_0x8367('0x33')](_0x4dcece);};}exports['index']=function(_0xcdcf28,_0x31b40b){var _0x4bc1fb={},_0x489c94={},_0x35294b={'count':0x0,'rows':[]};var _0x46c5d6=_[_0x8367('0x34')](db[_0x8367('0x35')]['rawAttributes'],function(_0x5ee272){return{'name':_0x5ee272['fieldName'],'type':_0x5ee272[_0x8367('0x36')][_0x8367('0x37')]};});_0x489c94[_0x8367('0x38')]=_['map'](_0x46c5d6,'name');_0x489c94['query']=_[_0x8367('0x39')](_0xcdcf28['query']);_0x489c94[_0x8367('0x3a')]=_[_0x8367('0x3b')](_0x489c94[_0x8367('0x38')],_0x489c94[_0x8367('0x3c')]);_0x4bc1fb[_0x8367('0x3d')]=_[_0x8367('0x3b')](_0x489c94[_0x8367('0x38')],qs['fields'](_0xcdcf28[_0x8367('0x3c')][_0x8367('0x3e')]));_0x4bc1fb['attributes']=_0x4bc1fb[_0x8367('0x3d')]['length']?_0x4bc1fb[_0x8367('0x3d')]:_0x489c94[_0x8367('0x38')];if(!_0xcdcf28[_0x8367('0x3c')]['hasOwnProperty'](_0x8367('0x3f'))){_0x4bc1fb[_0x8367('0x25')]=qs[_0x8367('0x25')](_0xcdcf28['query'][_0x8367('0x25')]);_0x4bc1fb[_0x8367('0x23')]=qs[_0x8367('0x23')](_0xcdcf28[_0x8367('0x3c')][_0x8367('0x23')]);}_0x4bc1fb[_0x8367('0x40')]=qs[_0x8367('0x41')](_0xcdcf28[_0x8367('0x3c')][_0x8367('0x41')]);_0x4bc1fb['where']=qs['filters'](_[_0x8367('0x42')](_0xcdcf28[_0x8367('0x3c')],_0x489c94['filters']),_0x46c5d6);if(_0xcdcf28[_0x8367('0x3c')][_0x8367('0x43')]){_0x4bc1fb[_0x8367('0x44')]=_[_0x8367('0x45')](_0x4bc1fb[_0x8367('0x44')],{'$or':_[_0x8367('0x34')](_0x46c5d6,function(_0x1c12e6){if(_0x1c12e6[_0x8367('0x36')]!=='VIRTUAL'){var _0x17d249={};_0x17d249[_0x1c12e6[_0x8367('0x32')]]={'$like':'%'+_0xcdcf28[_0x8367('0x3c')]['filter']+'%'};return _0x17d249;}})});}_0x4bc1fb=_[_0x8367('0x45')]({},_0x4bc1fb,_0xcdcf28[_0x8367('0x46')]);var _0x55de01={'where':_0x4bc1fb[_0x8367('0x44')]};return db[_0x8367('0x35')][_0x8367('0x26')](_0x55de01)['then'](function(_0x1edcc3){_0x35294b[_0x8367('0x26')]=_0x1edcc3;if(_0xcdcf28[_0x8367('0x3c')]['includeAll']){_0x4bc1fb[_0x8367('0x47')]=[{'all':!![]}];}return db['MailQueue'][_0x8367('0x48')](_0x4bc1fb);})[_0x8367('0x2a')](function(_0x45e490){_0x35294b[_0x8367('0x49')]=_0x45e490;return _0x35294b;})['then'](respondWithFilteredResult(_0x31b40b,_0x4bc1fb))[_0x8367('0x4a')](handleError(_0x31b40b,null));};exports[_0x8367('0x4b')]=function(_0x3f645b,_0x4a30ba){var _0x268f75={'raw':!![],'where':{'id':_0x3f645b[_0x8367('0x4c')]['id']}},_0x40e90a={};_0x40e90a[_0x8367('0x38')]=_[_0x8367('0x39')](db[_0x8367('0x35')][_0x8367('0x4d')]);_0x40e90a[_0x8367('0x3c')]=_[_0x8367('0x39')](_0x3f645b['query']);_0x40e90a[_0x8367('0x3a')]=_['intersection'](_0x40e90a[_0x8367('0x38')],_0x40e90a['query']);_0x268f75[_0x8367('0x3d')]=_[_0x8367('0x3b')](_0x40e90a['model'],qs[_0x8367('0x3e')](_0x3f645b['query']['fields']));_0x268f75[_0x8367('0x3d')]=_0x268f75[_0x8367('0x3d')][_0x8367('0x4e')]?_0x268f75['attributes']:_0x40e90a[_0x8367('0x38')];if(_0x3f645b[_0x8367('0x3c')]['includeAll']){_0x268f75[_0x8367('0x47')]=[{'all':!![]}];}_0x268f75=_[_0x8367('0x45')]({},_0x268f75,_0x3f645b[_0x8367('0x46')]);return db['MailQueue'][_0x8367('0x4f')](_0x268f75)[_0x8367('0x2a')](handleEntityNotFound(_0x4a30ba,null))[_0x8367('0x2a')](respondWithResult(_0x4a30ba,null))[_0x8367('0x4a')](handleError(_0x4a30ba,null));};exports[_0x8367('0x50')]=function(_0x515f5e,_0x4c2402){return db[_0x8367('0x35')][_0x8367('0x50')](_0x515f5e[_0x8367('0x51')],{})[_0x8367('0x2a')](function(_0x173121){var _0x2e0f46=_0x515f5e[_0x8367('0x52')][_0x8367('0x2c')]({'plain':!![]});if(!_0x2e0f46)throw new Error(_0x8367('0x53'));if(_0x2e0f46['role']===_0x8367('0x52')){var _0x180bf8=_0x173121[_0x8367('0x2c')]({'plain':!![]});var _0x10362c=_0x8367('0x2d');return db[_0x8367('0x54')][_0x8367('0x4f')]({'where':{'name':_0x10362c,'userProfileId':_0x2e0f46['userProfileId']},'raw':!![]})[_0x8367('0x2a')](function(_0x4b1594){if(_0x4b1594&&_0x4b1594[_0x8367('0x55')]===0x0){return db[_0x8367('0x2e')]['create']({'name':_0x180bf8['name'],'resourceId':_0x180bf8['id'],'type':_0x4b1594[_0x8367('0x32')],'sectionId':_0x4b1594['id']},{})[_0x8367('0x2a')](function(){return _0x173121;});}else{return _0x173121;}})[_0x8367('0x4a')](function(_0x4abd0c){logger[_0x8367('0x30')](_0x8367('0x56'),_0x4abd0c);throw _0x4abd0c;});}return _0x173121;})[_0x8367('0x2a')](respondWithResult(_0x4c2402,0xc9))[_0x8367('0x4a')](handleError(_0x4c2402,null));};exports['update']=function(_0xa82877,_0x54329c){if(_0xa82877['body']['id']){delete _0xa82877[_0x8367('0x51')]['id'];}return db['MailQueue'][_0x8367('0x4f')]({'where':{'id':_0xa82877['params']['id']}})[_0x8367('0x2a')](handleEntityNotFound(_0x54329c,null))[_0x8367('0x2a')](saveUpdates(_0xa82877[_0x8367('0x51')],null))['then'](respondWithResult(_0x54329c,null))[_0x8367('0x4a')](handleError(_0x54329c,null));};exports['destroy']=function(_0x54f7e8,_0x579c67){return db[_0x8367('0x35')][_0x8367('0x4f')]({'where':{'id':_0x54f7e8[_0x8367('0x4c')]['id']}})[_0x8367('0x2a')](handleEntityNotFound(_0x579c67,null))[_0x8367('0x2a')](removeEntity(_0x579c67,null))['catch'](handleError(_0x579c67,null));};exports[_0x8367('0x57')]=function(_0x4315f4,_0x53914f){return db[_0x8367('0x35')]['describe']()[_0x8367('0x2a')](respondWithResult(_0x53914f,null))[_0x8367('0x4a')](handleError(_0x53914f,null));};exports[_0x8367('0x58')]=function(_0x218fdf,_0x5d8223,_0x4c0374){var _0x26b242={'raw':!![],'where':{}},_0x46ad20={},_0x4a178a;return db[_0x8367('0x35')][_0x8367('0x59')]({'where':{'id':_0x218fdf[_0x8367('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5d8223,null))[_0x8367('0x2a')](function(_0x455f99){if(_0x455f99){_0x4a178a=_0x455f99[_0x8367('0x2c')]({'plain':!![]});_0x46ad20[_0x8367('0x38')]=_[_0x8367('0x39')](db[_0x8367('0x5a')][_0x8367('0x4d')]);_0x46ad20[_0x8367('0x3c')]=_[_0x8367('0x39')](_0x218fdf[_0x8367('0x3c')]);_0x46ad20[_0x8367('0x3a')]=_['intersection'](_0x46ad20[_0x8367('0x38')],_0x46ad20[_0x8367('0x3c')]);_0x26b242[_0x8367('0x3d')]=_['intersection'](_0x46ad20[_0x8367('0x38')],qs[_0x8367('0x3e')](_0x218fdf[_0x8367('0x3c')][_0x8367('0x3e')]));_0x26b242[_0x8367('0x3d')]=_0x26b242['attributes'][_0x8367('0x4e')]?_0x26b242[_0x8367('0x3d')]:_0x46ad20['model'];if(!_0x218fdf[_0x8367('0x3c')]['hasOwnProperty'](_0x8367('0x3f'))){_0x26b242[_0x8367('0x25')]=qs[_0x8367('0x25')](_0x218fdf[_0x8367('0x3c')][_0x8367('0x25')]);_0x26b242[_0x8367('0x23')]=qs[_0x8367('0x23')](_0x218fdf['query'][_0x8367('0x23')]);}_0x26b242[_0x8367('0x40')]=qs[_0x8367('0x41')](_0x218fdf[_0x8367('0x3c')][_0x8367('0x41')]);_0x26b242[_0x8367('0x44')]=qs[_0x8367('0x3a')](_[_0x8367('0x42')](_0x218fdf[_0x8367('0x3c')],_0x46ad20[_0x8367('0x3a')]));_0x26b242[_0x8367('0x44')][_0x8367('0x5b')]=_0x455f99['id'];if(_0x218fdf[_0x8367('0x3c')]['filter']){_0x26b242[_0x8367('0x44')]=_[_0x8367('0x45')](_0x26b242['where'],{'$or':_['map'](_0x26b242['attributes'],function(_0x2db789){var _0x1d61f6={};_0x1d61f6[_0x2db789]={'$like':'%'+_0x218fdf['query'][_0x8367('0x43')]+'%'};return _0x1d61f6;})});}_0x26b242=_[_0x8367('0x45')]({},_0x26b242,_0x218fdf[_0x8367('0x46')]);return db['UserMailQueue'][_0x8367('0x48')](_0x26b242);}})[_0x8367('0x2a')](function(_0x5f10c7){if(_0x5f10c7){return db[_0x8367('0x5c')][_0x8367('0x5d')]({'where':{'id':_[_0x8367('0x34')](_0x5f10c7,_0x8367('0x5e')),'role':_0x8367('0x5f')},'attributes':['id',_0x8367('0x32'),_0x8367('0x60'),_0x8367('0x61'),'createdAt']});}})[_0x8367('0x2a')](function(_0x24d0d2){if(_0x24d0d2){return{'count':_0x24d0d2['count'],'rows':_[_0x8367('0x34')](_0x24d0d2['rows'],function(_0xb39a4c){return{'membername':_0xb39a4c['name'],'UserId':_0xb39a4c['id'],'queue_name':_0x4a178a[_0x8367('0x32')],'MailQueueId':_0x4a178a['id'],'interface':util[_0x8367('0x62')](_0x8367('0x63'),'SIP',_0xb39a4c['name']),'penalty':0x0,'paused':_0xb39a4c[_0x8367('0x60')],'createdAt':_0xb39a4c['createdAt'],'updatedAt':_0xb39a4c[_0x8367('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8367('0x2a')](respondWithFilteredResult(_0x5d8223,_0x26b242))[_0x8367('0x4a')](handleError(_0x5d8223,null));};exports[_0x8367('0x64')]=function(_0x28b52c,_0xd128f3,_0x3980ac){var _0x208430={};var _0x1278bc={};var _0xfb69c;var _0x37718c;return db[_0x8367('0x35')][_0x8367('0x59')]({'where':{'id':_0x28b52c['params']['id']}})[_0x8367('0x2a')](handleEntityNotFound(_0xd128f3,null))[_0x8367('0x2a')](function(_0x3dfb5e){if(_0x3dfb5e){_0xfb69c=_0x3dfb5e;_0x1278bc[_0x8367('0x38')]=_[_0x8367('0x39')](db['Team'][_0x8367('0x4d')]);_0x1278bc[_0x8367('0x3c')]=_[_0x8367('0x39')](_0x28b52c[_0x8367('0x3c')]);_0x1278bc[_0x8367('0x3a')]=_[_0x8367('0x3b')](_0x1278bc[_0x8367('0x38')],_0x1278bc[_0x8367('0x3c')]);_0x208430[_0x8367('0x3d')]=_['intersection'](_0x1278bc[_0x8367('0x38')],qs[_0x8367('0x3e')](_0x28b52c['query'][_0x8367('0x3e')]));_0x208430[_0x8367('0x3d')]=_0x208430[_0x8367('0x3d')][_0x8367('0x4e')]?_0x208430[_0x8367('0x3d')]:_0x1278bc[_0x8367('0x38')];_0x208430['order']=qs[_0x8367('0x41')](_0x28b52c[_0x8367('0x3c')]['sort']);_0x208430['where']=qs[_0x8367('0x3a')](_[_0x8367('0x42')](_0x28b52c[_0x8367('0x3c')],_0x1278bc[_0x8367('0x3a')]));if(_0x28b52c[_0x8367('0x3c')]['filter']){_0x208430[_0x8367('0x44')]=_['merge'](_0x208430[_0x8367('0x44')],{'$or':_[_0x8367('0x34')](_0x208430[_0x8367('0x3d')],function(_0x4417ef){var _0x43b720={};_0x43b720[_0x4417ef]={'$like':'%'+_0x28b52c[_0x8367('0x3c')][_0x8367('0x43')]+'%'};return _0x43b720;})});}_0x208430=_[_0x8367('0x45')]({},_0x208430,_0x28b52c['options']);return _0xfb69c[_0x8367('0x64')](_0x208430);}})[_0x8367('0x2a')](function(_0x1f6ad0){if(_0x1f6ad0){_0x37718c=_0x1f6ad0[_0x8367('0x4e')];if(!_0x28b52c['query'][_0x8367('0x65')](_0x8367('0x3f'))){_0x208430[_0x8367('0x25')]=qs['limit'](_0x28b52c[_0x8367('0x3c')][_0x8367('0x25')]);_0x208430['offset']=qs[_0x8367('0x23')](_0x28b52c[_0x8367('0x3c')]['offset']);}return _0xfb69c['getTeams'](_0x208430);}})[_0x8367('0x2a')](function(_0x756145){if(_0x756145){return _0x756145?{'count':_0x37718c,'rows':_0x756145}:null;}})[_0x8367('0x2a')](respondWithResult(_0xd128f3,null))[_0x8367('0x4a')](handleError(_0xd128f3,null));};exports[_0x8367('0x66')]=function(_0x10b355,_0x3f40b2,_0x322b3c){var _0x4c7005=_0x10b355['body'][_0x8367('0x67')];return db[_0x8367('0x68')][_0x8367('0x48')]({'where':{'id':_0x4c7005},'attributes':['id'],'include':[{'model':db[_0x8367('0x5c')],'as':_0x8367('0x69'),'attributes':['id',_0x8367('0x32'),'online','voicePause','interface'],'raw':!![]}]})[_0x8367('0x2a')](function(_0x10d2d7){if(_0x10d2d7){var _0x8889e7=_[_0x8367('0x6a')](_0x10d2d7,function(_0x69aed6){var _0xdc64a9=_0x69aed6[_0x8367('0x2c')]({'plain':!![]});return _0xdc64a9[_0x8367('0x69')];});return db[_0x8367('0x35')][_0x8367('0x4f')]({'where':{'id':_0x10b355[_0x8367('0x4c')]['id']}})['then'](function(_0x37b726){return db[_0x8367('0x6b')]['transaction'](function(_0x17195e){return _0x37b726[_0x8367('0x66')](_0x4c7005,{'transaction':_0x17195e})[_0x8367('0x2a')](function(){return BPromise[_0x8367('0x6c')](_0x8889e7,function(_0x265ed4){return db[_0x8367('0x5a')]['findOrCreate']({'where':{'UserId':_0x265ed4['id'],'MailQueueId':_0x10b355[_0x8367('0x4c')]['id']},'transaction':_0x17195e});});})[_0x8367('0x2a')](function(){_0x8889e7['forEach'](function(_0x4c90fd){socket[_0x8367('0x6d')](_0x8367('0x6e'),{'UserId':_0x4c90fd['id'],'MailQueueId':_0x37b726['id']});});});});});}})[_0x8367('0x2a')](respondWithStatusCode(_0x3f40b2,null))[_0x8367('0x4a')](handleError(_0x3f40b2,null));};exports[_0x8367('0x6f')]=function(_0x11b689,_0x5f013f,_0xfa3c3c){return db[_0x8367('0x68')][_0x8367('0x48')]({'where':{'id':_0x11b689[_0x8367('0x3c')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8367('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5f013f,null))[_0x8367('0x2a')](function(_0x564725){var _0x59150d=_[_0x8367('0x34')](_0x564725,'id');var _0x1fddb6=[];var _0x292287=[];var _0x2f7669=squel[_0x8367('0x70')]();_0x2f7669[_0x8367('0x71')]('tq.TeamId')['from'](_0x8367('0x72'),'tq')[_0x8367('0x73')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8367('0x44')](_0x8367('0x74'),_0x11b689[_0x8367('0x4c')]['id']);for(var _0x207bea=0x0;_0x207bea<_0x564725['length'];_0x207bea+=0x1){let _0x469672=_0x564725[_0x207bea];for(var _0x258a40=0x0;_0x258a40<_0x469672[_0x8367('0x69')][_0x8367('0x4e')];_0x258a40+=0x1){let _0x41e95f=_0x469672['Agents'][_0x258a40];var _0x45d942=_0x2f7669[_0x8367('0x75')]();_0x45d942['where'](_0x8367('0x76'),_0x41e95f['id']);_0x292287[_0x8367('0x77')](db['sequelize'][_0x8367('0x3c')](_0x45d942[_0x8367('0x78')](),{'type':db[_0x8367('0x6b')]['QueryTypes'][_0x8367('0x79')]})['then'](function(_0x49690f){if(_0x49690f[_0x8367('0x4e')]===0x1){return _0x41e95f['id'];}else{var _0x53eab7=_[_0x8367('0x7a')](_[_0x8367('0x34')](_0x49690f,_0x8367('0x7b')),function(_0x24c74d){return _[_0x8367('0x7c')](_0x59150d,_0x24c74d);});if(_0x53eab7){return _0x41e95f['id'];}}}));}}return BPromise[_0x8367('0x7d')](_0x292287)[_0x8367('0x2a')](function(_0x122ddc){_0x1fddb6=_(_0x1fddb6)[_0x8367('0x7e')](_0x122ddc)[_0x8367('0x7f')]()[_0x8367('0x80')]();return db[_0x8367('0x35')][_0x8367('0x4f')]({'where':{'id':_0x11b689['params']['id']}})['then'](function(_0xe3010e){return db[_0x8367('0x6b')]['transaction'](function(_0x1ccb1d){return _0xe3010e[_0x8367('0x6f')](_0x11b689[_0x8367('0x3c')][_0x8367('0x67')],{'transaction':_0x1ccb1d})['then'](function(){if(!_[_0x8367('0x81')](_0x1fddb6)){return _0xe3010e[_0x8367('0x82')](_0x1fddb6,{'transaction':_0x1ccb1d});}})[_0x8367('0x2a')](function(){_0x1fddb6['forEach'](function(_0x2858c0){socket[_0x8367('0x6d')](_0x8367('0x83'),{'UserId':_0x2858c0,'MailQueueId':_0xe3010e['id']});});});});});});})[_0x8367('0x2a')](respondWithStatusCode(_0x5f013f,null))['catch'](handleError(_0x5f013f,null));};exports[_0x8367('0x84')]=function(_0x47eb6a,_0x384a0e,_0x3c1dd3){return db[_0x8367('0x35')][_0x8367('0x4f')]({'where':{'id':_0x47eb6a[_0x8367('0x4c')]['id']}})[_0x8367('0x2a')](handleEntityNotFound(_0x384a0e,null))[_0x8367('0x2a')](function(_0x4b1303){if(_0x4b1303){return _0x4b1303[_0x8367('0x84')](_0x47eb6a[_0x8367('0x51')][_0x8367('0x67')],_[_0x8367('0x85')](_0x47eb6a[_0x8367('0x51')],[_0x8367('0x67'),'id'])||{})['spread'](function(_0x318622){for(var _0x3a774b=0x0;_0x3a774b<_0x47eb6a[_0x8367('0x51')][_0x8367('0x67')][_0x8367('0x4e')];_0x3a774b+=0x1){socket['emit'](_0x8367('0x6e'),{'UserId':Number(_0x47eb6a[_0x8367('0x51')][_0x8367('0x67')][_0x3a774b]),'MailQueueId':Number(_0x47eb6a[_0x8367('0x4c')]['id'])});}return _0x318622;});}})[_0x8367('0x2a')](respondWithResult(_0x384a0e,null))[_0x8367('0x4a')](handleError(_0x384a0e,null));};exports[_0x8367('0x82')]=function(_0x21e329,_0x11796f,_0x1160ad){return db[_0x8367('0x35')][_0x8367('0x4f')]({'where':{'id':_0x21e329[_0x8367('0x4c')]['id']}})[_0x8367('0x2a')](handleEntityNotFound(_0x11796f,null))[_0x8367('0x2a')](function(_0x3a10b5){if(_0x3a10b5){return _0x3a10b5[_0x8367('0x82')](_0x21e329[_0x8367('0x3c')]['ids'])[_0x8367('0x2a')](function(){if(_[_0x8367('0x86')](_0x21e329[_0x8367('0x3c')][_0x8367('0x67')])){for(var _0x54be0b=0x0;_0x54be0b<_0x21e329[_0x8367('0x3c')][_0x8367('0x67')][_0x8367('0x4e')];_0x54be0b+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x21e329[_0x8367('0x3c')]['ids'][_0x54be0b]),'MailQueueId':Number(_0x21e329[_0x8367('0x4c')]['id'])});}}else{socket[_0x8367('0x6d')]('userMailQueue:remove',{'UserId':Number(_0x21e329[_0x8367('0x3c')][_0x8367('0x67')]),'MailQueueId':Number(_0x21e329[_0x8367('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x11796f,null))['catch'](handleError(_0x11796f,null));};exports[_0x8367('0x87')]=function(_0x134b12,_0x315e90,_0x10e6a8){var _0x3fb392={};var _0x1ef162={};var _0x8b9ebb;var _0x2099e6;return db[_0x8367('0x35')][_0x8367('0x59')]({'where':{'id':_0x134b12[_0x8367('0x4c')]['id']}})['then'](handleEntityNotFound(_0x315e90,null))[_0x8367('0x2a')](function(_0x5b4219){if(_0x5b4219){_0x8b9ebb=_0x5b4219;_0x1ef162[_0x8367('0x38')]=_[_0x8367('0x39')](db[_0x8367('0x5c')][_0x8367('0x4d')]);_0x1ef162[_0x8367('0x3c')]=_['keys'](_0x134b12[_0x8367('0x3c')]);_0x1ef162[_0x8367('0x3a')]=_[_0x8367('0x3b')](_0x1ef162[_0x8367('0x38')],_0x1ef162[_0x8367('0x3c')]);_0x3fb392[_0x8367('0x3d')]=_[_0x8367('0x3b')](_0x1ef162[_0x8367('0x38')],qs['fields'](_0x134b12['query'][_0x8367('0x3e')]));_0x3fb392[_0x8367('0x3d')]=_0x3fb392[_0x8367('0x3d')][_0x8367('0x4e')]?_0x3fb392[_0x8367('0x3d')]:_0x1ef162[_0x8367('0x38')];_0x3fb392[_0x8367('0x40')]=qs[_0x8367('0x41')](_0x134b12['query']['sort']);_0x3fb392[_0x8367('0x44')]=qs[_0x8367('0x3a')](_[_0x8367('0x42')](_0x134b12[_0x8367('0x3c')],_0x1ef162[_0x8367('0x3a')]));if(_0x134b12[_0x8367('0x3c')]['filter']){_0x3fb392[_0x8367('0x44')]=_[_0x8367('0x45')](_0x3fb392[_0x8367('0x44')],{'$or':_[_0x8367('0x34')](_0x3fb392['attributes'],function(_0x382e22){var _0x22878c={};_0x22878c[_0x382e22]={'$like':'%'+_0x134b12[_0x8367('0x3c')]['filter']+'%'};return _0x22878c;})});}_0x3fb392=_[_0x8367('0x45')]({},_0x3fb392,_0x134b12['options']);return _0x8b9ebb[_0x8367('0x87')](_0x3fb392);}})['then'](function(_0x4d1f52){if(_0x4d1f52){_0x2099e6=_0x4d1f52[_0x8367('0x4e')];if(!_0x134b12[_0x8367('0x3c')][_0x8367('0x65')](_0x8367('0x3f'))){_0x3fb392[_0x8367('0x25')]=qs['limit'](_0x134b12['query'][_0x8367('0x25')]);_0x3fb392[_0x8367('0x23')]=qs['offset'](_0x134b12[_0x8367('0x3c')][_0x8367('0x23')]);}return _0x8b9ebb[_0x8367('0x87')](_0x3fb392);}})[_0x8367('0x2a')](function(_0x4ca9d2){if(_0x4ca9d2){return _0x4ca9d2?{'count':_0x2099e6,'rows':_0x4ca9d2}:null;}})[_0x8367('0x2a')](respondWithResult(_0x315e90,null))[_0x8367('0x4a')](handleError(_0x315e90,null));}; \ No newline at end of file +var _0xd0ba=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','MailQueues','UserProfileResource','error','stack','name','index','map','MailQueue','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','find','create','body','user','role','get','UserProfileSection','params','describe','getMembers','MailQueueId','User','agent','mailPause','rows','format','%s/%s','SIP','createdAt','updatedAt','getTeams','findOne','Team','ids','Agents','online','voicePause','interface','flatMap','each','UserMailQueue','findOrCreate','forEach','emit','userMailQueue:save','select','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','TeamId','includes','all','union','compact','transaction','removeTeams','addAgents','omit','spread','removeAgents','isArray','userMailQueue:remove','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status'];(function(_0x688c0e,_0xc9e8e8){var _0x351de9=function(_0x5ac96d){while(--_0x5ac96d){_0x688c0e['push'](_0x688c0e['shift']());}};_0x351de9(++_0xc9e8e8);}(_0xd0ba,0x17c));var _0xad0b=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xd0ba[_0x28d18d];return _0x470640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad0b('0x0'));var zipdir=require(_0xad0b('0x1'));var jsonpatch=require(_0xad0b('0x2'));var rp=require(_0xad0b('0x3'));var moment=require(_0xad0b('0x4'));var BPromise=require(_0xad0b('0x5'));var Mustache=require(_0xad0b('0x6'));var util=require(_0xad0b('0x7'));var path=require(_0xad0b('0x8'));var sox=require('sox');var csv=require(_0xad0b('0x9'));var ejs=require(_0xad0b('0xa'));var fs=require('fs');var fs_extra=require(_0xad0b('0xb'));var _=require('lodash');var squel=require(_0xad0b('0xc'));var crypto=require(_0xad0b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xad0b('0xe'));var Redis=require('ioredis');var authService=require(_0xad0b('0xf'));var qs=require(_0xad0b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad0b('0x11'));var logger=require(_0xad0b('0x12'))(_0xad0b('0x13'));var utils=require(_0xad0b('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xad0b('0x15'))['db'];config[_0xad0b('0x16')]=_[_0xad0b('0x17')](config[_0xad0b('0x16')],{'host':_0xad0b('0x18'),'port':0x18eb});var socket=require(_0xad0b('0x19'))(new Redis(config[_0xad0b('0x16')]));require(_0xad0b('0x1a'))[_0xad0b('0x1b')](socket);function respondWithStatusCode(_0x1b858d,_0x53d4a3){_0x53d4a3=_0x53d4a3||0xcc;return function(_0x2cb103){if(_0x2cb103){return _0x1b858d[_0xad0b('0x1c')](_0x53d4a3);}return _0x1b858d['status'](_0x53d4a3)[_0xad0b('0x1d')]();};}function respondWithResult(_0x5b171e,_0x3d41f4){_0x3d41f4=_0x3d41f4||0xc8;return function(_0x43fb48){if(_0x43fb48){return _0x5b171e[_0xad0b('0x1e')](_0x3d41f4)['json'](_0x43fb48);}};}function respondWithFilteredResult(_0x48b3d0,_0x7da87f){return function(_0x5d612b){if(_0x5d612b){var _0x56374b=typeof _0x7da87f[_0xad0b('0x1f')]===_0xad0b('0x20')&&typeof _0x7da87f[_0xad0b('0x21')]===_0xad0b('0x20');var _0x183b3e=_0x5d612b['count'];var _0x55a656=_0x56374b?0x0:_0x7da87f[_0xad0b('0x1f')];var _0x3e97e1=_0x56374b?_0x5d612b[_0xad0b('0x22')]:_0x7da87f[_0xad0b('0x1f')]+_0x7da87f[_0xad0b('0x21')];var _0x2db19c;if(_0x3e97e1>=_0x183b3e){_0x3e97e1=_0x183b3e;_0x2db19c=0xc8;}else{_0x2db19c=0xce;}_0x48b3d0[_0xad0b('0x1e')](_0x2db19c);return _0x48b3d0[_0xad0b('0x23')](_0xad0b('0x24'),_0x55a656+'-'+_0x3e97e1+'/'+_0x183b3e)[_0xad0b('0x25')](_0x5d612b);}return null;};}function patchUpdates(_0x1a48a8){return function(_0xada76a){try{jsonpatch[_0xad0b('0x26')](_0xada76a,_0x1a48a8,!![]);}catch(_0x2cb5cf){return BPromise[_0xad0b('0x27')](_0x2cb5cf);}return _0xada76a[_0xad0b('0x28')]();};}function saveUpdates(_0x3179fd,_0x19de9a){return function(_0x14d7e7){if(_0x14d7e7){return _0x14d7e7[_0xad0b('0x29')](_0x3179fd)[_0xad0b('0x2a')](function(_0x68ac23){return _0x68ac23;});}return null;};}function removeEntity(_0x3a20f2,_0x40425a){return function(_0x2d6339){if(_0x2d6339){return _0x2d6339[_0xad0b('0x2b')]()[_0xad0b('0x2a')](function(){var _0x54918b=_0x2d6339['get']({'plain':!![]});var _0x38a527=_0xad0b('0x2c');return db[_0xad0b('0x2d')][_0xad0b('0x2b')]({'where':{'type':_0x38a527,'resourceId':_0x54918b['id']}})[_0xad0b('0x2a')](function(){return _0x2d6339;});})[_0xad0b('0x2a')](function(){_0x3a20f2[_0xad0b('0x1e')](0xcc)[_0xad0b('0x1d')]();});}};}function handleEntityNotFound(_0x8b828b,_0x59c600){return function(_0x13ff80){if(!_0x13ff80){_0x8b828b[_0xad0b('0x1c')](0x194);}return _0x13ff80;};}function handleError(_0x4970b5,_0x2a16b9){_0x2a16b9=_0x2a16b9||0x1f4;return function(_0x3f048e){logger[_0xad0b('0x2e')](_0x3f048e[_0xad0b('0x2f')]);if(_0x3f048e[_0xad0b('0x30')]){delete _0x3f048e[_0xad0b('0x30')];}_0x4970b5['status'](_0x2a16b9)['send'](_0x3f048e);};}exports[_0xad0b('0x31')]=function(_0x331e98,_0x5e6caf){var _0x4eed33={},_0x2255b7={},_0x47a454={'count':0x0,'rows':[]};var _0x34da52=_[_0xad0b('0x32')](db[_0xad0b('0x33')][_0xad0b('0x34')],function(_0x8ff29e){return{'name':_0x8ff29e['fieldName'],'type':_0x8ff29e[_0xad0b('0x35')][_0xad0b('0x36')]};});_0x2255b7[_0xad0b('0x37')]=_[_0xad0b('0x32')](_0x34da52,_0xad0b('0x30'));_0x2255b7[_0xad0b('0x38')]=_[_0xad0b('0x39')](_0x331e98[_0xad0b('0x38')]);_0x2255b7[_0xad0b('0x3a')]=_[_0xad0b('0x3b')](_0x2255b7[_0xad0b('0x37')],_0x2255b7[_0xad0b('0x38')]);_0x4eed33['attributes']=_[_0xad0b('0x3b')](_0x2255b7[_0xad0b('0x37')],qs[_0xad0b('0x3c')](_0x331e98[_0xad0b('0x38')][_0xad0b('0x3c')]));_0x4eed33[_0xad0b('0x3d')]=_0x4eed33['attributes'][_0xad0b('0x3e')]?_0x4eed33[_0xad0b('0x3d')]:_0x2255b7['model'];if(!_0x331e98[_0xad0b('0x38')][_0xad0b('0x3f')](_0xad0b('0x40'))){_0x4eed33['limit']=qs['limit'](_0x331e98[_0xad0b('0x38')][_0xad0b('0x21')]);_0x4eed33[_0xad0b('0x1f')]=qs['offset'](_0x331e98[_0xad0b('0x38')]['offset']);}_0x4eed33[_0xad0b('0x41')]=qs[_0xad0b('0x42')](_0x331e98[_0xad0b('0x38')][_0xad0b('0x42')]);_0x4eed33[_0xad0b('0x43')]=qs['filters'](_[_0xad0b('0x44')](_0x331e98[_0xad0b('0x38')],_0x2255b7[_0xad0b('0x3a')]),_0x34da52);if(_0x331e98[_0xad0b('0x38')][_0xad0b('0x45')]){_0x4eed33['where']=_[_0xad0b('0x46')](_0x4eed33['where'],{'$or':_['map'](_0x34da52,function(_0x3bc582){if(_0x3bc582[_0xad0b('0x35')]!==_0xad0b('0x47')){var _0x5d12e0={};_0x5d12e0[_0x3bc582['name']]={'$like':'%'+_0x331e98[_0xad0b('0x38')][_0xad0b('0x45')]+'%'};return _0x5d12e0;}})});}_0x4eed33=_['merge']({},_0x4eed33,_0x331e98[_0xad0b('0x48')]);var _0x3f8b13={'where':_0x4eed33[_0xad0b('0x43')]};return db[_0xad0b('0x33')][_0xad0b('0x22')](_0x3f8b13)['then'](function(_0xc45d27){_0x47a454[_0xad0b('0x22')]=_0xc45d27;if(_0x331e98[_0xad0b('0x38')][_0xad0b('0x49')]){_0x4eed33[_0xad0b('0x4a')]=[{'all':!![]}];}return db[_0xad0b('0x33')][_0xad0b('0x4b')](_0x4eed33);})['then'](function(_0x22f5dc){_0x47a454['rows']=_0x22f5dc;return _0x47a454;})[_0xad0b('0x2a')](respondWithFilteredResult(_0x5e6caf,_0x4eed33))[_0xad0b('0x4c')](handleError(_0x5e6caf,null));};exports['show']=function(_0x304443,_0x254239){var _0xe7f43b={'raw':!![],'where':{'id':_0x304443['params']['id']}},_0x495582={};_0x495582[_0xad0b('0x37')]=_['keys'](db[_0xad0b('0x33')][_0xad0b('0x34')]);_0x495582[_0xad0b('0x38')]=_[_0xad0b('0x39')](_0x304443[_0xad0b('0x38')]);_0x495582['filters']=_['intersection'](_0x495582['model'],_0x495582[_0xad0b('0x38')]);_0xe7f43b[_0xad0b('0x3d')]=_[_0xad0b('0x3b')](_0x495582[_0xad0b('0x37')],qs[_0xad0b('0x3c')](_0x304443['query']['fields']));_0xe7f43b[_0xad0b('0x3d')]=_0xe7f43b[_0xad0b('0x3d')][_0xad0b('0x3e')]?_0xe7f43b[_0xad0b('0x3d')]:_0x495582[_0xad0b('0x37')];if(_0x304443[_0xad0b('0x38')][_0xad0b('0x49')]){_0xe7f43b[_0xad0b('0x4a')]=[{'all':!![]}];}_0xe7f43b=_[_0xad0b('0x46')]({},_0xe7f43b,_0x304443['options']);return db[_0xad0b('0x33')][_0xad0b('0x4d')](_0xe7f43b)[_0xad0b('0x2a')](handleEntityNotFound(_0x254239,null))[_0xad0b('0x2a')](respondWithResult(_0x254239,null))[_0xad0b('0x4c')](handleError(_0x254239,null));};exports[_0xad0b('0x4e')]=function(_0x5c6770,_0x1b3048){return db[_0xad0b('0x33')][_0xad0b('0x4e')](_0x5c6770[_0xad0b('0x4f')],{})[_0xad0b('0x2a')](function(_0x418114){var _0x4295b3=_0x5c6770[_0xad0b('0x50')]['get']({'plain':!![]});if(!_0x4295b3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4295b3[_0xad0b('0x51')]==='user'){var _0x7ccfaf=_0x418114[_0xad0b('0x52')]({'plain':!![]});var _0x36ef5a=_0xad0b('0x2c');return db[_0xad0b('0x53')][_0xad0b('0x4d')]({'where':{'name':_0x36ef5a,'userProfileId':_0x4295b3['userProfileId']},'raw':!![]})['then'](function(_0x35f3f9){if(_0x35f3f9&&_0x35f3f9['autoAssociation']===0x0){return db['UserProfileResource'][_0xad0b('0x4e')]({'name':_0x7ccfaf['name'],'resourceId':_0x7ccfaf['id'],'type':_0x35f3f9[_0xad0b('0x30')],'sectionId':_0x35f3f9['id']},{})[_0xad0b('0x2a')](function(){return _0x418114;});}else{return _0x418114;}})[_0xad0b('0x4c')](function(_0x250eb6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x250eb6);throw _0x250eb6;});}return _0x418114;})[_0xad0b('0x2a')](respondWithResult(_0x1b3048,0xc9))['catch'](handleError(_0x1b3048,null));};exports['update']=function(_0x3a9b34,_0x1fa88a){if(_0x3a9b34[_0xad0b('0x4f')]['id']){delete _0x3a9b34[_0xad0b('0x4f')]['id'];}return db[_0xad0b('0x33')][_0xad0b('0x4d')]({'where':{'id':_0x3a9b34['params']['id']}})[_0xad0b('0x2a')](handleEntityNotFound(_0x1fa88a,null))[_0xad0b('0x2a')](saveUpdates(_0x3a9b34[_0xad0b('0x4f')],null))[_0xad0b('0x2a')](respondWithResult(_0x1fa88a,null))[_0xad0b('0x4c')](handleError(_0x1fa88a,null));};exports['destroy']=function(_0x4e874c,_0x10ab51){return db[_0xad0b('0x33')][_0xad0b('0x4d')]({'where':{'id':_0x4e874c[_0xad0b('0x54')]['id']}})[_0xad0b('0x2a')](handleEntityNotFound(_0x10ab51,null))[_0xad0b('0x2a')](removeEntity(_0x10ab51,null))[_0xad0b('0x4c')](handleError(_0x10ab51,null));};exports[_0xad0b('0x55')]=function(_0xe49e80,_0x22b092){return db[_0xad0b('0x33')]['describe']()['then'](respondWithResult(_0x22b092,null))[_0xad0b('0x4c')](handleError(_0x22b092,null));};exports[_0xad0b('0x56')]=function(_0x50d5fd,_0xf81164,_0x3d5ff1){var _0x5917a5={'raw':!![],'where':{}},_0x270b36={},_0x527bbe;return db[_0xad0b('0x33')]['findOne']({'where':{'id':_0x50d5fd[_0xad0b('0x54')]['id']}})[_0xad0b('0x2a')](handleEntityNotFound(_0xf81164,null))[_0xad0b('0x2a')](function(_0x5d02a8){if(_0x5d02a8){_0x527bbe=_0x5d02a8[_0xad0b('0x52')]({'plain':!![]});_0x270b36['model']=_['keys'](db['UserMailQueue'][_0xad0b('0x34')]);_0x270b36['query']=_[_0xad0b('0x39')](_0x50d5fd[_0xad0b('0x38')]);_0x270b36['filters']=_[_0xad0b('0x3b')](_0x270b36[_0xad0b('0x37')],_0x270b36['query']);_0x5917a5[_0xad0b('0x3d')]=_['intersection'](_0x270b36[_0xad0b('0x37')],qs['fields'](_0x50d5fd[_0xad0b('0x38')][_0xad0b('0x3c')]));_0x5917a5[_0xad0b('0x3d')]=_0x5917a5[_0xad0b('0x3d')][_0xad0b('0x3e')]?_0x5917a5[_0xad0b('0x3d')]:_0x270b36['model'];if(!_0x50d5fd[_0xad0b('0x38')][_0xad0b('0x3f')](_0xad0b('0x40'))){_0x5917a5[_0xad0b('0x21')]=qs[_0xad0b('0x21')](_0x50d5fd[_0xad0b('0x38')][_0xad0b('0x21')]);_0x5917a5[_0xad0b('0x1f')]=qs[_0xad0b('0x1f')](_0x50d5fd[_0xad0b('0x38')][_0xad0b('0x1f')]);}_0x5917a5[_0xad0b('0x41')]=qs[_0xad0b('0x42')](_0x50d5fd[_0xad0b('0x38')][_0xad0b('0x42')]);_0x5917a5[_0xad0b('0x43')]=qs[_0xad0b('0x3a')](_[_0xad0b('0x44')](_0x50d5fd[_0xad0b('0x38')],_0x270b36[_0xad0b('0x3a')]));_0x5917a5[_0xad0b('0x43')][_0xad0b('0x57')]=_0x5d02a8['id'];if(_0x50d5fd[_0xad0b('0x38')][_0xad0b('0x45')]){_0x5917a5[_0xad0b('0x43')]=_[_0xad0b('0x46')](_0x5917a5[_0xad0b('0x43')],{'$or':_['map'](_0x5917a5[_0xad0b('0x3d')],function(_0x3832f0){var _0x40e74e={};_0x40e74e[_0x3832f0]={'$like':'%'+_0x50d5fd[_0xad0b('0x38')][_0xad0b('0x45')]+'%'};return _0x40e74e;})});}_0x5917a5=_[_0xad0b('0x46')]({},_0x5917a5,_0x50d5fd['options']);return db['UserMailQueue'][_0xad0b('0x4b')](_0x5917a5);}})[_0xad0b('0x2a')](function(_0x39be36){if(_0x39be36){return db[_0xad0b('0x58')]['findAndCountAll']({'where':{'id':_[_0xad0b('0x32')](_0x39be36,'UserId'),'role':_0xad0b('0x59')},'attributes':['id',_0xad0b('0x30'),_0xad0b('0x5a'),'updatedAt','createdAt']});}})[_0xad0b('0x2a')](function(_0x4907fd){if(_0x4907fd){return{'count':_0x4907fd[_0xad0b('0x22')],'rows':_['map'](_0x4907fd[_0xad0b('0x5b')],function(_0x2c6f06){return{'membername':_0x2c6f06[_0xad0b('0x30')],'UserId':_0x2c6f06['id'],'queue_name':_0x527bbe[_0xad0b('0x30')],'MailQueueId':_0x527bbe['id'],'interface':util[_0xad0b('0x5c')](_0xad0b('0x5d'),_0xad0b('0x5e'),_0x2c6f06[_0xad0b('0x30')]),'penalty':0x0,'paused':_0x2c6f06[_0xad0b('0x5a')],'createdAt':_0x2c6f06[_0xad0b('0x5f')],'updatedAt':_0x2c6f06[_0xad0b('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xad0b('0x2a')](respondWithFilteredResult(_0xf81164,_0x5917a5))[_0xad0b('0x4c')](handleError(_0xf81164,null));};exports[_0xad0b('0x61')]=function(_0x17ad8a,_0x26482d,_0x34ecb0){var _0x3bdc59={};var _0x3b4be3={};var _0x118c41;var _0xbb891f;return db['MailQueue'][_0xad0b('0x62')]({'where':{'id':_0x17ad8a['params']['id']}})['then'](handleEntityNotFound(_0x26482d,null))[_0xad0b('0x2a')](function(_0x5015a1){if(_0x5015a1){_0x118c41=_0x5015a1;_0x3b4be3['model']=_['keys'](db[_0xad0b('0x63')]['rawAttributes']);_0x3b4be3['query']=_[_0xad0b('0x39')](_0x17ad8a['query']);_0x3b4be3[_0xad0b('0x3a')]=_[_0xad0b('0x3b')](_0x3b4be3[_0xad0b('0x37')],_0x3b4be3[_0xad0b('0x38')]);_0x3bdc59[_0xad0b('0x3d')]=_[_0xad0b('0x3b')](_0x3b4be3['model'],qs['fields'](_0x17ad8a[_0xad0b('0x38')][_0xad0b('0x3c')]));_0x3bdc59['attributes']=_0x3bdc59[_0xad0b('0x3d')][_0xad0b('0x3e')]?_0x3bdc59['attributes']:_0x3b4be3[_0xad0b('0x37')];_0x3bdc59[_0xad0b('0x41')]=qs[_0xad0b('0x42')](_0x17ad8a[_0xad0b('0x38')]['sort']);_0x3bdc59[_0xad0b('0x43')]=qs[_0xad0b('0x3a')](_[_0xad0b('0x44')](_0x17ad8a[_0xad0b('0x38')],_0x3b4be3[_0xad0b('0x3a')]));if(_0x17ad8a[_0xad0b('0x38')][_0xad0b('0x45')]){_0x3bdc59[_0xad0b('0x43')]=_[_0xad0b('0x46')](_0x3bdc59[_0xad0b('0x43')],{'$or':_['map'](_0x3bdc59['attributes'],function(_0x9f481c){var _0x90941d={};_0x90941d[_0x9f481c]={'$like':'%'+_0x17ad8a[_0xad0b('0x38')][_0xad0b('0x45')]+'%'};return _0x90941d;})});}_0x3bdc59=_[_0xad0b('0x46')]({},_0x3bdc59,_0x17ad8a[_0xad0b('0x48')]);return _0x118c41['getTeams'](_0x3bdc59);}})['then'](function(_0x2e1694){if(_0x2e1694){_0xbb891f=_0x2e1694[_0xad0b('0x3e')];if(!_0x17ad8a[_0xad0b('0x38')][_0xad0b('0x3f')](_0xad0b('0x40'))){_0x3bdc59['limit']=qs[_0xad0b('0x21')](_0x17ad8a['query'][_0xad0b('0x21')]);_0x3bdc59[_0xad0b('0x1f')]=qs[_0xad0b('0x1f')](_0x17ad8a[_0xad0b('0x38')]['offset']);}return _0x118c41['getTeams'](_0x3bdc59);}})[_0xad0b('0x2a')](function(_0x351b86){if(_0x351b86){return _0x351b86?{'count':_0xbb891f,'rows':_0x351b86}:null;}})[_0xad0b('0x2a')](respondWithResult(_0x26482d,null))['catch'](handleError(_0x26482d,null));};exports['addTeams']=function(_0x787604,_0x4d08b0,_0x4aae30){var _0x4610f5=_0x787604[_0xad0b('0x4f')][_0xad0b('0x64')];return db['Team'][_0xad0b('0x4b')]({'where':{'id':_0x4610f5},'attributes':['id'],'include':[{'model':db[_0xad0b('0x58')],'as':_0xad0b('0x65'),'attributes':['id',_0xad0b('0x30'),_0xad0b('0x66'),_0xad0b('0x67'),_0xad0b('0x68')],'raw':!![]}]})[_0xad0b('0x2a')](function(_0x1908e6){if(_0x1908e6){var _0x1d85c4=_[_0xad0b('0x69')](_0x1908e6,function(_0x36c067){var _0xa7fc8e=_0x36c067[_0xad0b('0x52')]({'plain':!![]});return _0xa7fc8e[_0xad0b('0x65')];});return db['MailQueue'][_0xad0b('0x4d')]({'where':{'id':_0x787604[_0xad0b('0x54')]['id']}})[_0xad0b('0x2a')](function(_0xe1fb79){return db['sequelize']['transaction'](function(_0x4b67d7){return _0xe1fb79['addTeams'](_0x4610f5,{'transaction':_0x4b67d7})['then'](function(){return BPromise[_0xad0b('0x6a')](_0x1d85c4,function(_0x221818){return db[_0xad0b('0x6b')][_0xad0b('0x6c')]({'where':{'UserId':_0x221818['id'],'MailQueueId':_0x787604[_0xad0b('0x54')]['id']},'transaction':_0x4b67d7});});})[_0xad0b('0x2a')](function(){_0x1d85c4[_0xad0b('0x6d')](function(_0x1bfd95){socket[_0xad0b('0x6e')](_0xad0b('0x6f'),{'UserId':_0x1bfd95['id'],'MailQueueId':_0xe1fb79['id']});});});});});}})[_0xad0b('0x2a')](respondWithStatusCode(_0x4d08b0,null))[_0xad0b('0x4c')](handleError(_0x4d08b0,null));};exports['removeTeams']=function(_0x2004f1,_0x18d048,_0x271c74){return db['Team'][_0xad0b('0x4b')]({'where':{'id':_0x2004f1[_0xad0b('0x38')][_0xad0b('0x64')]},'attributes':['id'],'include':[{'model':db[_0xad0b('0x58')],'as':_0xad0b('0x65'),'attributes':['id'],'raw':!![]}]})[_0xad0b('0x2a')](handleEntityNotFound(_0x18d048,null))[_0xad0b('0x2a')](function(_0x14fc0b){var _0x32e86e=_[_0xad0b('0x32')](_0x14fc0b,'id');var _0xb8bd5d=[];var _0x296eea=[];var _0x3eea84=squel[_0xad0b('0x70')]();_0x3eea84['field'](_0xad0b('0x71'))[_0xad0b('0x72')](_0xad0b('0x73'),'tq')[_0xad0b('0x74')](_0xad0b('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xad0b('0x43')]('MailQueueId\x20=\x20?',_0x2004f1[_0xad0b('0x54')]['id']);for(var _0x2c3ee0=0x0;_0x2c3ee0<_0x14fc0b[_0xad0b('0x3e')];_0x2c3ee0+=0x1){let _0x410ace=_0x14fc0b[_0x2c3ee0];for(var _0x62d73a=0x0;_0x62d73a<_0x410ace[_0xad0b('0x65')][_0xad0b('0x3e')];_0x62d73a+=0x1){let _0x31a57c=_0x410ace['Agents'][_0x62d73a];var _0x359057=_0x3eea84[_0xad0b('0x76')]();_0x359057[_0xad0b('0x43')](_0xad0b('0x77'),_0x31a57c['id']);_0x296eea[_0xad0b('0x78')](db[_0xad0b('0x79')][_0xad0b('0x38')](_0x359057['toString'](),{'type':db['sequelize'][_0xad0b('0x7a')][_0xad0b('0x7b')]})[_0xad0b('0x2a')](function(_0xb1fdf6){if(_0xb1fdf6[_0xad0b('0x3e')]===0x1){return _0x31a57c['id'];}else{var _0x2463d7=_['every'](_[_0xad0b('0x32')](_0xb1fdf6,_0xad0b('0x7c')),function(_0x5c4be5){return _[_0xad0b('0x7d')](_0x32e86e,_0x5c4be5);});if(_0x2463d7){return _0x31a57c['id'];}}}));}}return BPromise[_0xad0b('0x7e')](_0x296eea)[_0xad0b('0x2a')](function(_0x132a33){_0xb8bd5d=_(_0xb8bd5d)[_0xad0b('0x7f')](_0x132a33)[_0xad0b('0x80')]()['value']();return db[_0xad0b('0x33')][_0xad0b('0x4d')]({'where':{'id':_0x2004f1[_0xad0b('0x54')]['id']}})[_0xad0b('0x2a')](function(_0xa05e0d){return db['sequelize'][_0xad0b('0x81')](function(_0x360da6){return _0xa05e0d[_0xad0b('0x82')](_0x2004f1[_0xad0b('0x38')]['ids'],{'transaction':_0x360da6})[_0xad0b('0x2a')](function(){if(!_['isEmpty'](_0xb8bd5d)){return _0xa05e0d['removeAgents'](_0xb8bd5d,{'transaction':_0x360da6});}})['then'](function(){_0xb8bd5d[_0xad0b('0x6d')](function(_0x4c542d){socket[_0xad0b('0x6e')]('userMailQueue:remove',{'UserId':_0x4c542d,'MailQueueId':_0xa05e0d['id']});});});});});});})['then'](respondWithStatusCode(_0x18d048,null))['catch'](handleError(_0x18d048,null));};exports[_0xad0b('0x83')]=function(_0x428c1f,_0x5b424c,_0x4051ec){return db[_0xad0b('0x33')]['find']({'where':{'id':_0x428c1f[_0xad0b('0x54')]['id']}})[_0xad0b('0x2a')](handleEntityNotFound(_0x5b424c,null))[_0xad0b('0x2a')](function(_0x41c5e0){if(_0x41c5e0){return _0x41c5e0[_0xad0b('0x83')](_0x428c1f[_0xad0b('0x4f')][_0xad0b('0x64')],_[_0xad0b('0x84')](_0x428c1f[_0xad0b('0x4f')],[_0xad0b('0x64'),'id'])||{})[_0xad0b('0x85')](function(_0x46435f){for(var _0xca4bef=0x0;_0xca4bef<_0x428c1f[_0xad0b('0x4f')][_0xad0b('0x64')]['length'];_0xca4bef+=0x1){socket[_0xad0b('0x6e')](_0xad0b('0x6f'),{'UserId':Number(_0x428c1f[_0xad0b('0x4f')]['ids'][_0xca4bef]),'MailQueueId':Number(_0x428c1f[_0xad0b('0x54')]['id'])});}return _0x46435f;});}})['then'](respondWithResult(_0x5b424c,null))[_0xad0b('0x4c')](handleError(_0x5b424c,null));};exports[_0xad0b('0x86')]=function(_0x2e885c,_0x15aa88,_0x3017f3){return db[_0xad0b('0x33')][_0xad0b('0x4d')]({'where':{'id':_0x2e885c[_0xad0b('0x54')]['id']}})[_0xad0b('0x2a')](handleEntityNotFound(_0x15aa88,null))['then'](function(_0x27b55e){if(_0x27b55e){return _0x27b55e[_0xad0b('0x86')](_0x2e885c[_0xad0b('0x38')][_0xad0b('0x64')])[_0xad0b('0x2a')](function(){if(_[_0xad0b('0x87')](_0x2e885c['query']['ids'])){for(var _0x770672=0x0;_0x770672<_0x2e885c[_0xad0b('0x38')][_0xad0b('0x64')][_0xad0b('0x3e')];_0x770672+=0x1){socket[_0xad0b('0x6e')](_0xad0b('0x88'),{'UserId':Number(_0x2e885c[_0xad0b('0x38')][_0xad0b('0x64')][_0x770672]),'MailQueueId':Number(_0x2e885c[_0xad0b('0x54')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x2e885c[_0xad0b('0x38')][_0xad0b('0x64')]),'MailQueueId':Number(_0x2e885c[_0xad0b('0x54')]['id'])});}});}})[_0xad0b('0x2a')](respondWithStatusCode(_0x15aa88,null))['catch'](handleError(_0x15aa88,null));};exports['getAgents']=function(_0x1acdbb,_0x43ba51,_0x1cc96e){var _0x111a3e={};var _0x1bbf88={};var _0x217d10;var _0x17e6c6;return db[_0xad0b('0x33')]['findOne']({'where':{'id':_0x1acdbb[_0xad0b('0x54')]['id']}})[_0xad0b('0x2a')](handleEntityNotFound(_0x43ba51,null))[_0xad0b('0x2a')](function(_0x91de8c){if(_0x91de8c){_0x217d10=_0x91de8c;_0x1bbf88[_0xad0b('0x37')]=_[_0xad0b('0x39')](db[_0xad0b('0x58')][_0xad0b('0x34')]);_0x1bbf88['query']=_[_0xad0b('0x39')](_0x1acdbb[_0xad0b('0x38')]);_0x1bbf88[_0xad0b('0x3a')]=_[_0xad0b('0x3b')](_0x1bbf88[_0xad0b('0x37')],_0x1bbf88[_0xad0b('0x38')]);_0x111a3e['attributes']=_[_0xad0b('0x3b')](_0x1bbf88[_0xad0b('0x37')],qs[_0xad0b('0x3c')](_0x1acdbb[_0xad0b('0x38')][_0xad0b('0x3c')]));_0x111a3e['attributes']=_0x111a3e[_0xad0b('0x3d')]['length']?_0x111a3e[_0xad0b('0x3d')]:_0x1bbf88['model'];_0x111a3e[_0xad0b('0x41')]=qs[_0xad0b('0x42')](_0x1acdbb[_0xad0b('0x38')][_0xad0b('0x42')]);_0x111a3e[_0xad0b('0x43')]=qs[_0xad0b('0x3a')](_[_0xad0b('0x44')](_0x1acdbb[_0xad0b('0x38')],_0x1bbf88[_0xad0b('0x3a')]));if(_0x1acdbb['query'][_0xad0b('0x45')]){_0x111a3e[_0xad0b('0x43')]=_['merge'](_0x111a3e[_0xad0b('0x43')],{'$or':_['map'](_0x111a3e[_0xad0b('0x3d')],function(_0x43408e){var _0x43b370={};_0x43b370[_0x43408e]={'$like':'%'+_0x1acdbb[_0xad0b('0x38')][_0xad0b('0x45')]+'%'};return _0x43b370;})});}_0x111a3e=_[_0xad0b('0x46')]({},_0x111a3e,_0x1acdbb[_0xad0b('0x48')]);return _0x217d10['getAgents'](_0x111a3e);}})[_0xad0b('0x2a')](function(_0x1302f7){if(_0x1302f7){_0x17e6c6=_0x1302f7[_0xad0b('0x3e')];if(!_0x1acdbb['query'][_0xad0b('0x3f')]('nolimit')){_0x111a3e['limit']=qs[_0xad0b('0x21')](_0x1acdbb[_0xad0b('0x38')][_0xad0b('0x21')]);_0x111a3e['offset']=qs['offset'](_0x1acdbb[_0xad0b('0x38')][_0xad0b('0x1f')]);}return _0x217d10['getAgents'](_0x111a3e);}})[_0xad0b('0x2a')](function(_0x2a8810){if(_0x2a8810){return _0x2a8810?{'count':_0x17e6c6,'rows':_0x2a8810}:null;}})['then'](respondWithResult(_0x43ba51,null))['catch'](handleError(_0x43ba51,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 731731b..28833b3 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 _0x5ffe=['../../mysqldb','MailQueue','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x282ea6,_0x332264){var _0x1c4ba7=function(_0x41003d){while(--_0x41003d){_0x282ea6['push'](_0x282ea6['shift']());}};_0x1c4ba7(++_0x332264);}(_0x5ffe,0x67));var _0xe5ff=function(_0x35dc6a,_0x273cf4){_0x35dc6a=_0x35dc6a-0x0;var _0x38425c=_0x5ffe[_0x35dc6a];return _0x38425c;};'use strict';var EventEmitter=require(_0xe5ff('0x0'));var MailQueue=require(_0xe5ff('0x1'))['db'][_0xe5ff('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe5ff('0x3'),'afterUpdate':'update','afterDestroy':_0xe5ff('0x4')};function emitEvent(_0x44e9c7){return function(_0x116ec0,_0x56b0e6,_0x378521){MailQueueEvents[_0xe5ff('0x5')](_0x44e9c7+':'+_0x116ec0['id'],_0x116ec0);MailQueueEvents[_0xe5ff('0x5')](_0x44e9c7,_0x116ec0);_0x378521(null);};}for(var e in events){if(events[_0xe5ff('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xe5ff('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x86e5=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailQueue','update'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0x86e5,0x184));var _0x586e=function(_0x11874d,_0x480002){_0x11874d=_0x11874d-0x0;var _0x40475c=_0x86e5[_0x11874d];return _0x40475c;};'use strict';var EventEmitter=require(_0x586e('0x0'));var MailQueue=require(_0x586e('0x1'))['db'][_0x586e('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x586e('0x3'),'afterDestroy':_0x586e('0x4')};function emitEvent(_0x4b0a6f){return function(_0x13ac85,_0x262d80,_0xb34a3f){MailQueueEvents[_0x586e('0x5')](_0x4b0a6f+':'+_0x13ac85['id'],_0x13ac85);MailQueueEvents[_0x586e('0x5')](_0x4b0a6f,_0x13ac85);_0xb34a3f(null);};}for(var e in events){if(events[_0x586e('0x6')](e)){var event=events[e];MailQueue[_0x586e('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 9d10581..82543f7 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 _0x6c5a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailQueue.attributes','exports','define','mail_queues'];(function(_0x132706,_0x190447){var _0x4c37cc=function(_0x566533){while(--_0x566533){_0x132706['push'](_0x132706['shift']());}};_0x4c37cc(++_0x190447);}(_0x6c5a,0x145));var _0xa6c5=function(_0x1fdb72,_0x23cb0b){_0x1fdb72=_0x1fdb72-0x0;var _0x50dc4b=_0x6c5a[_0x1fdb72];return _0x50dc4b;};'use strict';var _=require(_0xa6c5('0x0'));var util=require(_0xa6c5('0x1'));var logger=require(_0xa6c5('0x2'))(_0xa6c5('0x3'));var moment=require(_0xa6c5('0x4'));var BPromise=require(_0xa6c5('0x5'));var rp=require(_0xa6c5('0x6'));var fs=require('fs');var path=require(_0xa6c5('0x7'));var rimraf=require(_0xa6c5('0x8'));var config=require('../../config/environment');var attributes=require(_0xa6c5('0x9'));module[_0xa6c5('0xa')]=function(_0x10d80e,_0x149788){return _0x10d80e[_0xa6c5('0xb')]('MailQueue',attributes,{'tableName':_0xa6c5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c8d=['mail_queues','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports','define'];(function(_0x3b7462,_0x2003e6){var _0x3a8e70=function(_0x48abd7){while(--_0x48abd7){_0x3b7462['push'](_0x3b7462['shift']());}};_0x3a8e70(++_0x2003e6);}(_0x2c8d,0x1cf));var _0xd2c8=function(_0x1895df,_0x37e2fc){_0x1895df=_0x1895df-0x0;var _0x2627d5=_0x2c8d[_0x1895df];return _0x2627d5;};'use strict';var _=require(_0xd2c8('0x0'));var util=require('util');var logger=require(_0xd2c8('0x1'))('api');var moment=require(_0xd2c8('0x2'));var BPromise=require(_0xd2c8('0x3'));var rp=require(_0xd2c8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd2c8('0x5'));var config=require(_0xd2c8('0x6'));var attributes=require(_0xd2c8('0x7'));module[_0xd2c8('0x8')]=function(_0x22c316,_0x119a7b){return _0x22c316[_0xd2c8('0x9')]('MailQueue',attributes,{'tableName':_0xd2c8('0xa'),'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 1e0e041..ee25e47 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 _0xedd7=['socket.io-emitter','./mailQueue.socket','register','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','include','map','model','ShowMailQueue','find','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0xedd7,0x90));var _0x7edd=function(_0x3c5924,_0x4d295f){_0x3c5924=_0x3c5924-0x0;var _0x576958=_0xedd7[_0x3c5924];return _0x576958;};'use strict';var _=require('lodash');var util=require(_0x7edd('0x0'));var moment=require(_0x7edd('0x1'));var BPromise=require(_0x7edd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7edd('0x3'));var db=require(_0x7edd('0x4'))['db'];var utils=require(_0x7edd('0x5'));var logger=require(_0x7edd('0x6'))('rpc');var config=require(_0x7edd('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7edd('0x8')]({'port':0x232a});config[_0x7edd('0x9')]=_[_0x7edd('0xa')](config['redis'],{'host':_0x7edd('0xb'),'port':0x18eb});var socket=require(_0x7edd('0xc'))(new Redis(config[_0x7edd('0x9')]));require(_0x7edd('0xd'))[_0x7edd('0xe')](socket);function respondWithRpcPromise(_0x56953f,_0x49dae0,_0x332aa6){return new BPromise(function(_0x1e64d4,_0x111194){return client['request'](_0x56953f,_0x332aa6)[_0x7edd('0xf')](function(_0x211388){logger[_0x7edd('0x10')]('MailQueue,\x20%s,\x20%s',_0x49dae0,_0x7edd('0x11'));logger[_0x7edd('0x12')](_0x7edd('0x13'),_0x49dae0,_0x7edd('0x11'),JSON[_0x7edd('0x14')](_0x211388));if(_0x211388[_0x7edd('0x15')]){if(_0x211388[_0x7edd('0x15')][_0x7edd('0x16')]===0x1f4){logger['error'](_0x7edd('0x17'),_0x49dae0,_0x211388[_0x7edd('0x15')][_0x7edd('0x18')]);return _0x111194(_0x211388[_0x7edd('0x15')][_0x7edd('0x18')]);}logger[_0x7edd('0x15')](_0x7edd('0x17'),_0x49dae0,_0x211388[_0x7edd('0x15')][_0x7edd('0x18')]);return _0x1e64d4(_0x211388['error']['message']);}else{logger['info'](_0x7edd('0x17'),_0x49dae0,_0x7edd('0x11'));_0x1e64d4(_0x211388[_0x7edd('0x19')][_0x7edd('0x18')]);}})[_0x7edd('0x1a')](function(_0x275cb9){logger[_0x7edd('0x15')](_0x7edd('0x17'),_0x49dae0,_0x275cb9);_0x111194(_0x275cb9);});});}exports[_0x7edd('0x1b')]=function(_0x3fa85f){var _0x486346=this;return new Promise(function(_0x3fbc7d,_0x4eae45){return db[_0x7edd('0x1c')][_0x7edd('0x1d')]({'raw':_0x3fa85f[_0x7edd('0x1e')]?_0x3fa85f[_0x7edd('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3fa85f['options']?_0x3fa85f['options'][_0x7edd('0x1f')]||null:null,'attributes':_0x3fa85f[_0x7edd('0x1e')]?_0x3fa85f['options'][_0x7edd('0x20')]||null:null,'limit':_0x3fa85f[_0x7edd('0x1e')]?_0x3fa85f[_0x7edd('0x1e')]['limit']||null:null,'include':_0x3fa85f[_0x7edd('0x1e')]?_0x3fa85f[_0x7edd('0x1e')][_0x7edd('0x21')]?_[_0x7edd('0x22')](_0x3fa85f[_0x7edd('0x1e')][_0x7edd('0x21')],function(_0x1b5515){return{'model':db[_0x1b5515[_0x7edd('0x23')]],'as':_0x1b5515['as'],'attributes':_0x1b5515['attributes'],'include':_0x1b5515[_0x7edd('0x21')]?_[_0x7edd('0x22')](_0x1b5515[_0x7edd('0x21')],function(_0x45b6c1){return{'model':db[_0x45b6c1[_0x7edd('0x23')]],'as':_0x45b6c1['as'],'attributes':_0x45b6c1[_0x7edd('0x20')],'include':_0x45b6c1[_0x7edd('0x21')]?_[_0x7edd('0x22')](_0x45b6c1[_0x7edd('0x21')],function(_0x5cb2eb){return{'model':db[_0x5cb2eb[_0x7edd('0x23')]],'as':_0x5cb2eb['as'],'attributes':_0x5cb2eb[_0x7edd('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36cbe0){logger['info'](_0x7edd('0x1b'),_0x3fa85f);logger['debug'](_0x7edd('0x1b'),_0x3fa85f,JSON[_0x7edd('0x14')](_0x36cbe0));_0x3fbc7d(_0x36cbe0);})['catch'](function(_0x192dda){logger[_0x7edd('0x15')]('GetMailQueue',_0x192dda[_0x7edd('0x18')],_0x3fa85f);_0x4eae45(_0x486346[_0x7edd('0x15')](0x1f4,_0x192dda[_0x7edd('0x18')]));});});};exports[_0x7edd('0x24')]=function(_0x50b710){var _0x22a003=this;return new Promise(function(_0x5895b6,_0x3eda1d){return db[_0x7edd('0x1c')][_0x7edd('0x25')]({'raw':_0x50b710[_0x7edd('0x1e')]?_0x50b710['options'][_0x7edd('0x26')]===undefined?!![]:![]:!![],'where':_0x50b710['options']?_0x50b710[_0x7edd('0x1e')][_0x7edd('0x1f')]||null:null,'attributes':_0x50b710['options']?_0x50b710['options'][_0x7edd('0x20')]||null:null,'include':_0x50b710['options']?_0x50b710['options'][_0x7edd('0x21')]?_[_0x7edd('0x22')](_0x50b710[_0x7edd('0x1e')][_0x7edd('0x21')],function(_0x11c87f){return{'model':db[_0x11c87f[_0x7edd('0x23')]],'as':_0x11c87f['as'],'attributes':_0x11c87f[_0x7edd('0x20')],'include':_0x11c87f[_0x7edd('0x21')]?_[_0x7edd('0x22')](_0x11c87f[_0x7edd('0x21')],function(_0x2d049d){return{'model':db[_0x2d049d['model']],'as':_0x2d049d['as'],'attributes':_0x2d049d[_0x7edd('0x20')],'include':_0x2d049d[_0x7edd('0x21')]?_[_0x7edd('0x22')](_0x2d049d[_0x7edd('0x21')],function(_0x284bb1){return{'model':db[_0x284bb1[_0x7edd('0x23')]],'as':_0x284bb1['as'],'attributes':_0x284bb1[_0x7edd('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7edd('0xf')](function(_0x3b7cd5){logger[_0x7edd('0x10')](_0x7edd('0x24'),_0x50b710);logger[_0x7edd('0x12')](_0x7edd('0x24'),_0x50b710,JSON[_0x7edd('0x14')](_0x3b7cd5));_0x5895b6(_0x3b7cd5);})[_0x7edd('0x1a')](function(_0x4af4f7){logger[_0x7edd('0x15')](_0x7edd('0x24'),_0x4af4f7['message'],_0x50b710);_0x3eda1d(_0x22a003[_0x7edd('0x15')](0x1f4,_0x4af4f7[_0x7edd('0x18')]));});});}; \ No newline at end of file +var _0x072f=['info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','findAll','options','raw','where','attributes','include','map','model','then','GetMailQueue','stringify','catch','ShowMailQueue','find','debug','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request'];(function(_0x22089b,_0x2e9648){var _0x403a74=function(_0x528813){while(--_0x528813){_0x22089b['push'](_0x22089b['shift']());}};_0x403a74(++_0x2e9648);}(_0x072f,0x1a7));var _0xf072=function(_0x2f7145,_0x50b97a){_0x2f7145=_0x2f7145-0x0;var _0x19e240=_0x072f[_0x2f7145];return _0x19e240;};'use strict';var _=require('lodash');var util=require(_0xf072('0x0'));var moment=require(_0xf072('0x1'));var BPromise=require(_0xf072('0x2'));var rs=require(_0xf072('0x3'));var fs=require('fs');var Redis=require(_0xf072('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf072('0x5'))(_0xf072('0x6'));var config=require(_0xf072('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf072('0x8')][_0xf072('0x9')]({'port':0x232a});config[_0xf072('0xa')]=_[_0xf072('0xb')](config[_0xf072('0xa')],{'host':_0xf072('0xc'),'port':0x18eb});var socket=require(_0xf072('0xd'))(new Redis(config['redis']));require(_0xf072('0xe'))[_0xf072('0xf')](socket);function respondWithRpcPromise(_0x1cb683,_0x5b29b3,_0x34d914){return new BPromise(function(_0x4feb10,_0x26163d){return client[_0xf072('0x10')](_0x1cb683,_0x34d914)['then'](function(_0x480354){logger[_0xf072('0x11')](_0xf072('0x12'),_0x5b29b3,_0xf072('0x13'));logger['debug'](_0xf072('0x14'),_0x5b29b3,_0xf072('0x13'),JSON['stringify'](_0x480354));if(_0x480354[_0xf072('0x15')]){if(_0x480354['error'][_0xf072('0x16')]===0x1f4){logger[_0xf072('0x15')]('MailQueue,\x20%s,\x20%s',_0x5b29b3,_0x480354[_0xf072('0x15')]['message']);return _0x26163d(_0x480354[_0xf072('0x15')][_0xf072('0x17')]);}logger[_0xf072('0x15')](_0xf072('0x12'),_0x5b29b3,_0x480354[_0xf072('0x15')][_0xf072('0x17')]);return _0x4feb10(_0x480354[_0xf072('0x15')]['message']);}else{logger[_0xf072('0x11')](_0xf072('0x12'),_0x5b29b3,'request\x20sent');_0x4feb10(_0x480354[_0xf072('0x18')][_0xf072('0x17')]);}})['catch'](function(_0x5f09bb){logger[_0xf072('0x15')](_0xf072('0x12'),_0x5b29b3,_0x5f09bb);_0x26163d(_0x5f09bb);});});}exports['GetMailQueue']=function(_0x197af5){var _0x4d0e74=this;return new Promise(function(_0x44724f,_0x524c2c){return db['MailQueue'][_0xf072('0x19')]({'raw':_0x197af5['options']?_0x197af5[_0xf072('0x1a')][_0xf072('0x1b')]===undefined?!![]:![]:!![],'where':_0x197af5[_0xf072('0x1a')]?_0x197af5[_0xf072('0x1a')][_0xf072('0x1c')]||null:null,'attributes':_0x197af5['options']?_0x197af5[_0xf072('0x1a')][_0xf072('0x1d')]||null:null,'limit':_0x197af5[_0xf072('0x1a')]?_0x197af5[_0xf072('0x1a')]['limit']||null:null,'include':_0x197af5['options']?_0x197af5[_0xf072('0x1a')][_0xf072('0x1e')]?_[_0xf072('0x1f')](_0x197af5[_0xf072('0x1a')]['include'],function(_0x379261){return{'model':db[_0x379261[_0xf072('0x20')]],'as':_0x379261['as'],'attributes':_0x379261[_0xf072('0x1d')],'include':_0x379261[_0xf072('0x1e')]?_[_0xf072('0x1f')](_0x379261['include'],function(_0x30ae99){return{'model':db[_0x30ae99[_0xf072('0x20')]],'as':_0x30ae99['as'],'attributes':_0x30ae99['attributes'],'include':_0x30ae99[_0xf072('0x1e')]?_['map'](_0x30ae99[_0xf072('0x1e')],function(_0x36362a){return{'model':db[_0x36362a[_0xf072('0x20')]],'as':_0x36362a['as'],'attributes':_0x36362a[_0xf072('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf072('0x21')](function(_0x29ef25){logger[_0xf072('0x11')](_0xf072('0x22'),_0x197af5);logger['debug'](_0xf072('0x22'),_0x197af5,JSON[_0xf072('0x23')](_0x29ef25));_0x44724f(_0x29ef25);})[_0xf072('0x24')](function(_0x5b0453){logger['error'](_0xf072('0x22'),_0x5b0453['message'],_0x197af5);_0x524c2c(_0x4d0e74[_0xf072('0x15')](0x1f4,_0x5b0453['message']));});});};exports[_0xf072('0x25')]=function(_0xadd541){var _0x28890e=this;return new Promise(function(_0x11cbff,_0x4ba352){return db['MailQueue'][_0xf072('0x26')]({'raw':_0xadd541['options']?_0xadd541[_0xf072('0x1a')][_0xf072('0x1b')]===undefined?!![]:![]:!![],'where':_0xadd541['options']?_0xadd541[_0xf072('0x1a')][_0xf072('0x1c')]||null:null,'attributes':_0xadd541[_0xf072('0x1a')]?_0xadd541[_0xf072('0x1a')][_0xf072('0x1d')]||null:null,'include':_0xadd541[_0xf072('0x1a')]?_0xadd541['options']['include']?_[_0xf072('0x1f')](_0xadd541['options']['include'],function(_0x14980a){return{'model':db[_0x14980a[_0xf072('0x20')]],'as':_0x14980a['as'],'attributes':_0x14980a[_0xf072('0x1d')],'include':_0x14980a[_0xf072('0x1e')]?_[_0xf072('0x1f')](_0x14980a[_0xf072('0x1e')],function(_0x4e0321){return{'model':db[_0x4e0321[_0xf072('0x20')]],'as':_0x4e0321['as'],'attributes':_0x4e0321[_0xf072('0x1d')],'include':_0x4e0321[_0xf072('0x1e')]?_['map'](_0x4e0321[_0xf072('0x1e')],function(_0x566de1){return{'model':db[_0x566de1['model']],'as':_0x566de1['as'],'attributes':_0x566de1[_0xf072('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x918828){logger['info'](_0xf072('0x25'),_0xadd541);logger[_0xf072('0x27')](_0xf072('0x25'),_0xadd541,JSON['stringify'](_0x918828));_0x11cbff(_0x918828);})[_0xf072('0x24')](function(_0x52446a){logger[_0xf072('0x15')]('ShowMailQueue',_0x52446a[_0xf072('0x17')],_0xadd541);_0x4ba352(_0x28890e[_0xf072('0x15')](0x1f4,_0x52446a['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index f81c0fa..3f63171 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 _0x373d=['emit','length','./mailQueue.events','remove','update'];(function(_0x1ba9c5,_0x2059a2){var _0x35911b=function(_0x2b669a){while(--_0x2b669a){_0x1ba9c5['push'](_0x1ba9c5['shift']());}};_0x35911b(++_0x2059a2);}(_0x373d,0x1e2));var _0xd373=function(_0x9647da,_0x1f7117){_0x9647da=_0x9647da-0x0;var _0x25c414=_0x373d[_0x9647da];return _0x25c414;};'use strict';var MailQueueEvents=require(_0xd373('0x0'));var events=['save',_0xd373('0x1'),_0xd373('0x2')];function createListener(_0x30e9ce,_0x79d21f){return function(_0x50ed19){_0x79d21f[_0xd373('0x3')](_0x30e9ce,_0x50ed19);};}function removeListener(_0x547fca,_0x2b6e64){return function(){MailQueueEvents['removeListener'](_0x547fca,_0x2b6e64);};}exports['register']=function(_0x31a0fb){for(var _0x3e4443=0x0,_0x446be6=events[_0xd373('0x4')];_0x3e4443<_0x446be6;_0x3e4443++){var _0x48d977=events[_0x3e4443];var _0xe79819=createListener('mailQueue:'+_0x48d977,_0x31a0fb);MailQueueEvents['on'](_0x48d977,_0xe79819);}}; \ No newline at end of file +var _0x1cf1=['update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','remove'];(function(_0x434f34,_0x37ce54){var _0x11e459=function(_0x1c4982){while(--_0x1c4982){_0x434f34['push'](_0x434f34['shift']());}};_0x11e459(++_0x37ce54);}(_0x1cf1,0x10e));var _0x11cf=function(_0x2803e0,_0x4658c8){_0x2803e0=_0x2803e0-0x0;var _0x5e9de8=_0x1cf1[_0x2803e0];return _0x5e9de8;};'use strict';var MailQueueEvents=require(_0x11cf('0x0'));var events=['save',_0x11cf('0x1'),_0x11cf('0x2')];function createListener(_0x443b96,_0x2db10c){return function(_0x4b2f31){_0x2db10c[_0x11cf('0x3')](_0x443b96,_0x4b2f31);};}function removeListener(_0x549e2d,_0x569c49){return function(){MailQueueEvents[_0x11cf('0x4')](_0x549e2d,_0x569c49);};}exports[_0x11cf('0x5')]=function(_0x3eb73b){for(var _0x34aa85=0x0,_0x53484f=events[_0x11cf('0x6')];_0x34aa85<_0x53484f;_0x34aa85++){var _0xc0fcc9=events[_0x34aa85];var _0x5dad93=createListener(_0x11cf('0x7')+_0xc0fcc9,_0x3eb73b);MailQueueEvents['on'](_0xc0fcc9,_0x5dad93);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 1eb6b91..60afeaf 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 _0x9f75=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','/describe','describe','get','/:id','post','create','put'];(function(_0x55e605,_0x162ddb){var _0x20c0cc=function(_0x5737cb){while(--_0x5737cb){_0x55e605['push'](_0x55e605['shift']());}};_0x20c0cc(++_0x162ddb);}(_0x9f75,0xe0));var _0x59f7=function(_0x2c3f52,_0x2c2e34){_0x2c3f52=_0x2c3f52-0x0;var _0xf4c843=_0x9f75[_0x2c3f52];return _0xf4c843;};'use strict';var multer=require(_0x59f7('0x0'));var util=require(_0x59f7('0x1'));var path=require(_0x59f7('0x2'));var timeout=require(_0x59f7('0x3'));var express=require('express');var router=express[_0x59f7('0x4')]();var fs_extra=require(_0x59f7('0x5'));var auth=require(_0x59f7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x59f7('0x7'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x59f7('0x8')](),controller['index']);router['get'](_0x59f7('0x9'),auth[_0x59f7('0x8')](),controller[_0x59f7('0xa')]);router[_0x59f7('0xb')](_0x59f7('0xc'),auth[_0x59f7('0x8')](),controller['show']);router[_0x59f7('0xd')]('/',auth['isAuthenticated'](),controller[_0x59f7('0xe')]);router[_0x59f7('0xf')](_0x59f7('0xc'),auth[_0x59f7('0x8')](),controller[_0x59f7('0x10')]);router[_0x59f7('0x11')](_0x59f7('0xc'),auth[_0x59f7('0x8')](),controller[_0x59f7('0x12')]);module[_0x59f7('0x13')]=router; \ No newline at end of file +var _0xa4d8=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x5f5132,_0x102eb2){var _0x34c5da=function(_0x10d661){while(--_0x10d661){_0x5f5132['push'](_0x5f5132['shift']());}};_0x34c5da(++_0x102eb2);}(_0xa4d8,0x157));var _0x8a4d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa4d8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8a4d('0x0'));var util=require(_0x8a4d('0x1'));var path=require(_0x8a4d('0x2'));var timeout=require(_0x8a4d('0x3'));var express=require(_0x8a4d('0x4'));var router=express[_0x8a4d('0x5')]();var fs_extra=require(_0x8a4d('0x6'));var auth=require(_0x8a4d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8a4d('0x8'));var controller=require('./mailQueueReport.controller');router[_0x8a4d('0x9')]('/',auth[_0x8a4d('0xa')](),controller[_0x8a4d('0xb')]);router[_0x8a4d('0x9')](_0x8a4d('0xc'),auth[_0x8a4d('0xa')](),controller[_0x8a4d('0xd')]);router[_0x8a4d('0x9')](_0x8a4d('0xe'),auth[_0x8a4d('0xa')](),controller[_0x8a4d('0xf')]);router[_0x8a4d('0x10')]('/',auth['isAuthenticated'](),controller[_0x8a4d('0x11')]);router[_0x8a4d('0x12')]('/:id',auth[_0x8a4d('0xa')](),controller[_0x8a4d('0x13')]);router[_0x8a4d('0x14')](_0x8a4d('0xe'),auth[_0x8a4d('0xa')](),controller[_0x8a4d('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 9689712..b064ab7 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 _0x5c06=['moment','exports','STRING','DATE'];(function(_0x11f249,_0x4ca4a8){var _0x5c3656=function(_0x27c9f8){while(--_0x27c9f8){_0x11f249['push'](_0x11f249['shift']());}};_0x5c3656(++_0x4ca4a8);}(_0x5c06,0x6c));var _0x65c0=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x5c06[_0x2d7f0e];return _0x110b07;};'use strict';var moment=require(_0x65c0('0x0'));var Sequelize=require('sequelize');module[_0x65c0('0x1')]={'uniqueid':{'type':Sequelize[_0x65c0('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x65c0('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x65c0('0x3')]},'acceptAt':{'type':Sequelize[_0x65c0('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x65c0('0x2')]}}; \ No newline at end of file +var _0xa831=['exports','STRING','DATE','moment','sequelize'];(function(_0x5c1ac8,_0x3268e7){var _0x6c564=function(_0x27e765){while(--_0x27e765){_0x5c1ac8['push'](_0x5c1ac8['shift']());}};_0x6c564(++_0x3268e7);}(_0xa831,0xbc));var _0x1a83=function(_0x1709e7,_0x2ced21){_0x1709e7=_0x1709e7-0x0;var _0x402819=_0xa831[_0x1709e7];return _0x402819;};'use strict';var moment=require(_0x1a83('0x0'));var Sequelize=require(_0x1a83('0x1'));module[_0x1a83('0x2')]={'uniqueid':{'type':Sequelize[_0x1a83('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x1a83('0x3')]},'joinAt':{'type':Sequelize[_0x1a83('0x4')]},'leaveAt':{'type':Sequelize[_0x1a83('0x4')]},'acceptAt':{'type':Sequelize[_0x1a83('0x4')]},'exitAt':{'type':Sequelize[_0x1a83('0x4')]},'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 b9a7031..178e189 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 _0x5204=['fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','destroy','error','stack','name','send','map','MailQueueReport','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','then','rows','params','keys','rawAttributes','catch','create','body','find','describe','eml-format','rimraf'];(function(_0x20e62e,_0x39ad84){var _0x408c13=function(_0x5bb2cf){while(--_0x5bb2cf){_0x20e62e['push'](_0x20e62e['shift']());}};_0x408c13(++_0x39ad84);}(_0x5204,0xdf));var _0x4520=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5204[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require(_0x4520('0x0'));var rimraf=require(_0x4520('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4520('0x2'));var rp=require(_0x4520('0x3'));var moment=require(_0x4520('0x4'));var BPromise=require(_0x4520('0x5'));var Mustache=require(_0x4520('0x6'));var util=require('util');var path=require(_0x4520('0x7'));var sox=require('sox');var csv=require(_0x4520('0x8'));var ejs=require(_0x4520('0x9'));var fs=require('fs');var fs_extra=require(_0x4520('0xa'));var _=require(_0x4520('0xb'));var squel=require(_0x4520('0xc'));var crypto=require(_0x4520('0xd'));var jsforce=require(_0x4520('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4520('0x8'));var querystring=require('querystring');var Papa=require(_0x4520('0xf'));var Redis=require(_0x4520('0x10'));var authService=require(_0x4520('0x11'));var qs=require(_0x4520('0x12'));var as=require(_0x4520('0x13'));var hardwareService=require(_0x4520('0x14'));var logger=require(_0x4520('0x15'))(_0x4520('0x16'));var utils=require(_0x4520('0x17'));var config=require(_0x4520('0x18'));var licenseUtil=require(_0x4520('0x19'));var db=require(_0x4520('0x1a'))['db'];function respondWithStatusCode(_0x3c7a5d,_0x508ea6){_0x508ea6=_0x508ea6||0xcc;return function(_0x2e3c64){if(_0x2e3c64){return _0x3c7a5d[_0x4520('0x1b')](_0x508ea6);}return _0x3c7a5d[_0x4520('0x1c')](_0x508ea6)[_0x4520('0x1d')]();};}function respondWithResult(_0x426836,_0x34d383){_0x34d383=_0x34d383||0xc8;return function(_0x32950a){if(_0x32950a){return _0x426836['status'](_0x34d383)[_0x4520('0x1e')](_0x32950a);}};}function respondWithFilteredResult(_0x20de6b,_0x1ab841){return function(_0x15a31f){if(_0x15a31f){var _0x32d8aa=typeof _0x1ab841['offset']===_0x4520('0x1f')&&typeof _0x1ab841[_0x4520('0x20')]===_0x4520('0x1f');var _0x283ad4=_0x15a31f[_0x4520('0x21')];var _0x2e00f4=_0x32d8aa?0x0:_0x1ab841[_0x4520('0x22')];var _0x4ba69f=_0x32d8aa?_0x15a31f[_0x4520('0x21')]:_0x1ab841[_0x4520('0x22')]+_0x1ab841[_0x4520('0x20')];var _0x460521;if(_0x4ba69f>=_0x283ad4){_0x4ba69f=_0x283ad4;_0x460521=0xc8;}else{_0x460521=0xce;}_0x20de6b['status'](_0x460521);return _0x20de6b[_0x4520('0x23')]('Content-Range',_0x2e00f4+'-'+_0x4ba69f+'/'+_0x283ad4)['json'](_0x15a31f);}return null;};}function patchUpdates(_0x4c46c5){return function(_0x2b9456){try{jsonpatch['apply'](_0x2b9456,_0x4c46c5,!![]);}catch(_0x39e196){return BPromise[_0x4520('0x24')](_0x39e196);}return _0x2b9456[_0x4520('0x25')]();};}function saveUpdates(_0x534b15,_0x3199a9){return function(_0x4000d4){if(_0x4000d4){return _0x4000d4[_0x4520('0x26')](_0x534b15)['then'](function(_0x198c34){return _0x198c34;});}return null;};}function removeEntity(_0x847d15,_0x24eacd){return function(_0x3a4680){if(_0x3a4680){return _0x3a4680[_0x4520('0x27')]()['then'](function(){_0x847d15[_0x4520('0x1c')](0xcc)[_0x4520('0x1d')]();});}};}function handleEntityNotFound(_0x3532aa,_0x3e2906){return function(_0x57306b){if(!_0x57306b){_0x3532aa[_0x4520('0x1b')](0x194);}return _0x57306b;};}function handleError(_0x4602a4,_0x92168b){_0x92168b=_0x92168b||0x1f4;return function(_0x21e1f3){logger[_0x4520('0x28')](_0x21e1f3[_0x4520('0x29')]);if(_0x21e1f3[_0x4520('0x2a')]){delete _0x21e1f3[_0x4520('0x2a')];}_0x4602a4[_0x4520('0x1c')](_0x92168b)[_0x4520('0x2b')](_0x21e1f3);};}exports['index']=function(_0x222dbd,_0x5c1a0b){var _0x7ce8d2={},_0x14778a={},_0x43b4a2={'count':0x0,'rows':[]};var _0x157293=_[_0x4520('0x2c')](db[_0x4520('0x2d')]['rawAttributes'],function(_0x2c32ce){return{'name':_0x2c32ce['fieldName'],'type':_0x2c32ce[_0x4520('0x2e')]['key']};});_0x14778a[_0x4520('0x2f')]=_['map'](_0x157293,_0x4520('0x2a'));_0x14778a['query']=_['keys'](_0x222dbd[_0x4520('0x30')]);_0x14778a[_0x4520('0x31')]=_[_0x4520('0x32')](_0x14778a['model'],_0x14778a[_0x4520('0x30')]);_0x7ce8d2[_0x4520('0x33')]=_[_0x4520('0x32')](_0x14778a[_0x4520('0x2f')],qs['fields'](_0x222dbd['query'][_0x4520('0x34')]));_0x7ce8d2[_0x4520('0x33')]=_0x7ce8d2['attributes'][_0x4520('0x35')]?_0x7ce8d2[_0x4520('0x33')]:_0x14778a[_0x4520('0x2f')];if(!_0x222dbd[_0x4520('0x30')][_0x4520('0x36')](_0x4520('0x37'))){_0x7ce8d2['limit']=qs[_0x4520('0x20')](_0x222dbd[_0x4520('0x30')]['limit']);_0x7ce8d2[_0x4520('0x22')]=qs['offset'](_0x222dbd[_0x4520('0x30')][_0x4520('0x22')]);}_0x7ce8d2['order']=qs['sort'](_0x222dbd['query'][_0x4520('0x38')]);_0x7ce8d2[_0x4520('0x39')]=qs[_0x4520('0x31')](_[_0x4520('0x3a')](_0x222dbd[_0x4520('0x30')],_0x14778a[_0x4520('0x31')]),_0x157293);if(_0x222dbd[_0x4520('0x30')]['filter']){_0x7ce8d2[_0x4520('0x39')]=_[_0x4520('0x3b')](_0x7ce8d2[_0x4520('0x39')],{'$or':_['map'](_0x157293,function(_0x16d489){if(_0x16d489[_0x4520('0x2e')]!=='VIRTUAL'){var _0x57b155={};_0x57b155[_0x16d489[_0x4520('0x2a')]]={'$like':'%'+_0x222dbd[_0x4520('0x30')][_0x4520('0x3c')]+'%'};return _0x57b155;}})});}_0x7ce8d2=_[_0x4520('0x3b')]({},_0x7ce8d2,_0x222dbd[_0x4520('0x3d')]);var _0x5ca832={'where':_0x7ce8d2['where']};return db['MailQueueReport'][_0x4520('0x21')](_0x5ca832)['then'](function(_0x43dc36){_0x43b4a2['count']=_0x43dc36;if(_0x222dbd['query'][_0x4520('0x3e')]){_0x7ce8d2[_0x4520('0x3f')]=[{'all':!![]}];}return db[_0x4520('0x2d')][_0x4520('0x40')](_0x7ce8d2);})[_0x4520('0x41')](function(_0x59d646){_0x43b4a2[_0x4520('0x42')]=_0x59d646;return _0x43b4a2;})[_0x4520('0x41')](respondWithFilteredResult(_0x5c1a0b,_0x7ce8d2))['catch'](handleError(_0x5c1a0b,null));};exports['show']=function(_0x3780e4,_0x2ff306){var _0x500c45={'raw':!![],'where':{'id':_0x3780e4[_0x4520('0x43')]['id']}},_0x2978d5={};_0x2978d5[_0x4520('0x2f')]=_[_0x4520('0x44')](db['MailQueueReport'][_0x4520('0x45')]);_0x2978d5[_0x4520('0x30')]=_[_0x4520('0x44')](_0x3780e4[_0x4520('0x30')]);_0x2978d5[_0x4520('0x31')]=_[_0x4520('0x32')](_0x2978d5[_0x4520('0x2f')],_0x2978d5[_0x4520('0x30')]);_0x500c45[_0x4520('0x33')]=_[_0x4520('0x32')](_0x2978d5[_0x4520('0x2f')],qs[_0x4520('0x34')](_0x3780e4[_0x4520('0x30')][_0x4520('0x34')]));_0x500c45[_0x4520('0x33')]=_0x500c45[_0x4520('0x33')][_0x4520('0x35')]?_0x500c45['attributes']:_0x2978d5[_0x4520('0x2f')];if(_0x3780e4[_0x4520('0x30')]['includeAll']){_0x500c45['include']=[{'all':!![]}];}_0x500c45=_['merge']({},_0x500c45,_0x3780e4['options']);return db[_0x4520('0x2d')]['find'](_0x500c45)[_0x4520('0x41')](handleEntityNotFound(_0x2ff306,null))[_0x4520('0x41')](respondWithResult(_0x2ff306,null))[_0x4520('0x46')](handleError(_0x2ff306,null));};exports[_0x4520('0x47')]=function(_0x177c4e,_0x5e3eef){return db[_0x4520('0x2d')][_0x4520('0x47')](_0x177c4e[_0x4520('0x48')],{})[_0x4520('0x41')](respondWithResult(_0x5e3eef,0xc9))[_0x4520('0x46')](handleError(_0x5e3eef,null));};exports[_0x4520('0x26')]=function(_0x737ba4,_0x1e4821){if(_0x737ba4[_0x4520('0x48')]['id']){delete _0x737ba4[_0x4520('0x48')]['id'];}return db[_0x4520('0x2d')][_0x4520('0x49')]({'where':{'id':_0x737ba4['params']['id']}})['then'](handleEntityNotFound(_0x1e4821,null))[_0x4520('0x41')](saveUpdates(_0x737ba4[_0x4520('0x48')],null))[_0x4520('0x41')](respondWithResult(_0x1e4821,null))['catch'](handleError(_0x1e4821,null));};exports[_0x4520('0x27')]=function(_0x2288a7,_0x3f9a4c){return db['MailQueueReport'][_0x4520('0x49')]({'where':{'id':_0x2288a7[_0x4520('0x43')]['id']}})[_0x4520('0x41')](handleEntityNotFound(_0x3f9a4c,null))['then'](removeEntity(_0x3f9a4c,null))['catch'](handleError(_0x3f9a4c,null));};exports[_0x4520('0x4a')]=function(_0x24a6a4,_0x24269e){return db[_0x4520('0x2d')][_0x4520('0x4a')]()[_0x4520('0x41')](respondWithResult(_0x24269e,null))[_0x4520('0x46')](handleError(_0x24269e,null));}; \ No newline at end of file +var _0xc2c7=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','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','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0xb94c02,_0x3edede){var _0x1d25e8=function(_0x46d963){while(--_0x46d963){_0xb94c02['push'](_0xb94c02['shift']());}};_0x1d25e8(++_0x3edede);}(_0xc2c7,0x134));var _0x7c2c=function(_0x252f23,_0x1452c4){_0x252f23=_0x252f23-0x0;var _0x54bbcc=_0xc2c7[_0x252f23];return _0x54bbcc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['MailQueueReport'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':!![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['MailQueueReport'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['create']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['create'](_0xeb067b['body'],{})[_0x7c2c('0x26')](respondWithResult(_0x3091bd,0xc9))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x2b79d5,_0x5f3de8){if(_0x2b79d5['body']['id']){delete _0x2b79d5['body']['id'];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x2b79d5[_0x7c2c('0x48')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x5f3de8,null))[_0x7c2c('0x26')](saveUpdates(_0x2b79d5['body'],null))[_0x7c2c('0x26')](respondWithResult(_0x5f3de8,null))[_0x7c2c('0x45')](handleError(_0x5f3de8,null));};exports['destroy']=function(_0x19621a,_0x56e09d){return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x19621a[_0x7c2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x56e09d,null))['then'](removeEntity(_0x56e09d,null))[_0x7c2c('0x45')](handleError(_0x56e09d,null));};exports['describe']=function(_0x13e0bf,_0x11d337){return db['MailQueueReport'][_0x7c2c('0x49')]()[_0x7c2c('0x26')](respondWithResult(_0x11d337,null))['catch'](handleError(_0x11d337,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 8475c18..dc460fc 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 _0xcc8e=['../../config/environment','./mailQueueReport.attributes','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x586fd9,_0x3c97a0){var _0x364867=function(_0x5a1ea6){while(--_0x5a1ea6){_0x586fd9['push'](_0x586fd9['shift']());}};_0x364867(++_0x3c97a0);}(_0xcc8e,0x6d));var _0xecc8=function(_0x444877,_0x53c6ea){_0x444877=_0x444877-0x0;var _0x10aa63=_0xcc8e[_0x444877];return _0x10aa63;};'use strict';var _=require(_0xecc8('0x0'));var util=require(_0xecc8('0x1'));var logger=require(_0xecc8('0x2'))(_0xecc8('0x3'));var moment=require(_0xecc8('0x4'));var BPromise=require(_0xecc8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xecc8('0x6'));var rimraf=require(_0xecc8('0x7'));var config=require(_0xecc8('0x8'));var attributes=require(_0xecc8('0x9'));module['exports']=function(_0x95843,_0x5a6132){return _0x95843['define'](_0xecc8('0xa'),attributes,{'tableName':_0xecc8('0xb'),'paranoid':![],'indexes':[{'name':_0xecc8('0xc'),'fields':[_0xecc8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x461c=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x139746,_0x437c08){var _0x4180b4=function(_0x109216){while(--_0x109216){_0x139746['push'](_0x139746['shift']());}};_0x4180b4(++_0x437c08);}(_0x461c,0x111));var _0xc461=function(_0x3274db,_0x5be162){_0x3274db=_0x3274db-0x0;var _0x563ac1=_0x461c[_0x3274db];return _0x563ac1;};'use strict';var _=require(_0xc461('0x0'));var util=require(_0xc461('0x1'));var logger=require(_0xc461('0x2'))(_0xc461('0x3'));var moment=require('moment');var BPromise=require(_0xc461('0x4'));var rp=require(_0xc461('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc461('0x6'));var config=require(_0xc461('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0xc461('0x8')]=function(_0x510504,_0x3de5f2){return _0x510504[_0xc461('0x9')](_0xc461('0xa'),attributes,{'tableName':_0xc461('0xb'),'paranoid':![],'indexes':[{'name':_0xc461('0xc'),'fields':[_0xc461('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 7ce1fc0..fbc93ab 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 _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(_0x316e19,_0x1205bb){var _0x122082=function(_0x3fb5ed){while(--_0x3fb5ed){_0x316e19['push'](_0x316e19['shift']());}};_0x122082(++_0x1205bb);}(_0xadb5,0xad));var _0x5adb=function(_0x8d94b9,_0x27db17){_0x8d94b9=_0x8d94b9-0x0;var _0x3db1c0=_0xadb5[_0x8d94b9];return _0x3db1c0;};'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 +var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x1eeb45,_0x526bf0){var _0x541ed5=function(_0x588dff){while(--_0x588dff){_0x1eeb45['push'](_0x1eeb45['shift']());}};_0x541ed5(++_0x526bf0);}(_0x2ef3,0xba));var _0x32ef=function(_0x19831b,_0x58ca40){_0x19831b=_0x19831b-0x0;var _0x5e1958=_0x2ef3[_0x19831b];return _0x5e1958;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 23e5d58..f1c4969 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x33fe9c,_0x3e1d1a){var _0x3dde83=function(_0x1a79f1){while(--_0x1a79f1){_0x33fe9c['push'](_0x33fe9c['shift']());}};_0x3dde83(++_0x3e1d1a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xcb91[_0xd09668];return _0x68726;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x18a546,_0x5553b8){var _0x5e2846=function(_0xd3fba7){while(--_0xd3fba7){_0x18a546['push'](_0x18a546['shift']());}};_0x5e2846(++_0x5553b8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb91[_0x3dd15e];return _0x231fd0;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index fcca92f..6090468 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 _0x5c00=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x129878,_0x1fa6b5){var _0x21c002=function(_0x1b8698){while(--_0x1b8698){_0x129878['push'](_0x129878['shift']());}};_0x21c002(++_0x1fa6b5);}(_0x5c00,0x17e));var _0x05c0=function(_0x2fe7b0,_0x39c02b){_0x2fe7b0=_0x2fe7b0-0x0;var _0x456c3d=_0x5c00[_0x2fe7b0];return _0x456c3d;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'description':{'type':Sequelize[_0x05c0('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x05c0('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x05c0('0x2')]},'port':{'type':Sequelize[_0x05c0('0x4')]},'tls':{'type':Sequelize[_0x05c0('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x05c0('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x05c0('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x05c0('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x05c0('0x2')]}}; \ No newline at end of file +var _0x1bca=['INTEGER','INBOX','exports','BOOLEAN','STRING'];(function(_0x2e7ee0,_0x37c6ac){var _0x6453fb=function(_0x4c4964){while(--_0x4c4964){_0x2e7ee0['push'](_0x2e7ee0['shift']());}};_0x6453fb(++_0x37c6ac);}(_0x1bca,0xb6));var _0xa1bc=function(_0x3b8235,_0x33066e){_0x3b8235=_0x3b8235-0x0;var _0x519321=_0x1bca[_0x3b8235];return _0x519321;};'use strict';var Sequelize=require('sequelize');module[_0xa1bc('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xa1bc('0x1')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa1bc('0x2')]},'port':{'type':Sequelize[_0xa1bc('0x3')]},'tls':{'type':Sequelize[_0xa1bc('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xa1bc('0x4')},'connTimeout':{'type':Sequelize[_0xa1bc('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xa1bc('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xa1bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 2b4590d..7bf1ba7 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 _0xc1a1=['request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','api','moment','bluebird'];(function(_0x33bc0d,_0x57aa0d){var _0x97447a=function(_0x16191a){while(--_0x16191a){_0x33bc0d['push'](_0x33bc0d['shift']());}};_0x97447a(++_0x57aa0d);}(_0xc1a1,0xf7));var _0x1c1a=function(_0x1dcacc,_0x1a1fec){_0x1dcacc=_0x1dcacc-0x0;var _0x1aae9b=_0xc1a1[_0x1dcacc];return _0x1aae9b;};'use strict';var _=require(_0x1c1a('0x0'));var util=require(_0x1c1a('0x1'));var logger=require('../../config/logger')(_0x1c1a('0x2'));var moment=require(_0x1c1a('0x3'));var BPromise=require(_0x1c1a('0x4'));var rp=require(_0x1c1a('0x5'));var fs=require('fs');var path=require(_0x1c1a('0x6'));var rimraf=require(_0x1c1a('0x7'));var config=require(_0x1c1a('0x8'));var attributes=require(_0x1c1a('0x9'));module[_0x1c1a('0xa')]=function(_0x30c6d3,_0x1675e8){return _0x30c6d3[_0x1c1a('0xb')](_0x1c1a('0xc'),attributes,{'tableName':_0x1c1a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe806=['mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','MailServerIn'];(function(_0x1abda7,_0x2f008c){var _0x408cbf=function(_0x482e28){while(--_0x482e28){_0x1abda7['push'](_0x1abda7['shift']());}};_0x408cbf(++_0x2f008c);}(_0xe806,0x139));var _0x6e80=function(_0x4505e3,_0x5af75b){_0x4505e3=_0x4505e3-0x0;var _0x586652=_0xe806[_0x4505e3];return _0x586652;};'use strict';var _=require(_0x6e80('0x0'));var util=require(_0x6e80('0x1'));var logger=require(_0x6e80('0x2'))(_0x6e80('0x3'));var moment=require(_0x6e80('0x4'));var BPromise=require(_0x6e80('0x5'));var rp=require(_0x6e80('0x6'));var fs=require('fs');var path=require(_0x6e80('0x7'));var rimraf=require(_0x6e80('0x8'));var config=require(_0x6e80('0x9'));var attributes=require('./mailServerIn.attributes');module[_0x6e80('0xa')]=function(_0x148979,_0x1f4612){return _0x148979['define'](_0x6e80('0xb'),attributes,{'tableName':_0x6e80('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 7c47a5b..fafe49c 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 _0x6b1c=['result','MailServerIn','findAll','options','raw','attributes','limit','include','map','model','GetMailServerIn','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x433c1a,_0x594cdf){var _0x56dae6=function(_0x33d55f){while(--_0x33d55f){_0x433c1a['push'](_0x433c1a['shift']());}};_0x56dae6(++_0x594cdf);}(_0x6b1c,0xf3));var _0xc6b1=function(_0x557886,_0x525a5e){_0x557886=_0x557886-0x0;var _0x3026ba=_0x6b1c[_0x557886];return _0x3026ba;};'use strict';var _=require(_0xc6b1('0x0'));var util=require('util');var moment=require(_0xc6b1('0x1'));var BPromise=require(_0xc6b1('0x2'));var rs=require(_0xc6b1('0x3'));var fs=require('fs');var Redis=require(_0xc6b1('0x4'));var db=require(_0xc6b1('0x5'))['db'];var utils=require(_0xc6b1('0x6'));var logger=require('../../config/logger')(_0xc6b1('0x7'));var config=require('../../config/environment');var jayson=require(_0xc6b1('0x8'));var client=jayson[_0xc6b1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f8295,_0x1de8b5,_0x362814){return new BPromise(function(_0x1e0dfb,_0x4f6509){return client[_0xc6b1('0xa')](_0x1f8295,_0x362814)[_0xc6b1('0xb')](function(_0x5a8dac){logger['info'](_0xc6b1('0xc'),_0x1de8b5,_0xc6b1('0xd'));logger[_0xc6b1('0xe')](_0xc6b1('0xf'),_0x1de8b5,_0xc6b1('0xd'),JSON[_0xc6b1('0x10')](_0x5a8dac));if(_0x5a8dac['error']){if(_0x5a8dac[_0xc6b1('0x11')][_0xc6b1('0x12')]===0x1f4){logger[_0xc6b1('0x11')](_0xc6b1('0xc'),_0x1de8b5,_0x5a8dac[_0xc6b1('0x11')]['message']);return _0x4f6509(_0x5a8dac[_0xc6b1('0x11')][_0xc6b1('0x13')]);}logger[_0xc6b1('0x11')](_0xc6b1('0xc'),_0x1de8b5,_0x5a8dac['error']['message']);return _0x1e0dfb(_0x5a8dac[_0xc6b1('0x11')][_0xc6b1('0x13')]);}else{logger[_0xc6b1('0x14')](_0xc6b1('0xc'),_0x1de8b5,_0xc6b1('0xd'));_0x1e0dfb(_0x5a8dac[_0xc6b1('0x15')]['message']);}})['catch'](function(_0xaed550){logger[_0xc6b1('0x11')](_0xc6b1('0xc'),_0x1de8b5,_0xaed550);_0x4f6509(_0xaed550);});});}exports['GetMailServerIn']=function(_0x2c4bae){var _0x40a267=this;return new Promise(function(_0x5d732e,_0x41370b){return db[_0xc6b1('0x16')][_0xc6b1('0x17')]({'raw':_0x2c4bae['options']?_0x2c4bae[_0xc6b1('0x18')][_0xc6b1('0x19')]===undefined?!![]:![]:!![],'where':_0x2c4bae[_0xc6b1('0x18')]?_0x2c4bae[_0xc6b1('0x18')]['where']||null:null,'attributes':_0x2c4bae['options']?_0x2c4bae[_0xc6b1('0x18')][_0xc6b1('0x1a')]||null:null,'limit':_0x2c4bae[_0xc6b1('0x18')]?_0x2c4bae[_0xc6b1('0x18')][_0xc6b1('0x1b')]||null:null,'include':_0x2c4bae[_0xc6b1('0x18')]?_0x2c4bae[_0xc6b1('0x18')][_0xc6b1('0x1c')]?_[_0xc6b1('0x1d')](_0x2c4bae[_0xc6b1('0x18')][_0xc6b1('0x1c')],function(_0x673d7f){return{'model':db[_0x673d7f[_0xc6b1('0x1e')]],'as':_0x673d7f['as'],'attributes':_0x673d7f[_0xc6b1('0x1a')],'include':_0x673d7f[_0xc6b1('0x1c')]?_[_0xc6b1('0x1d')](_0x673d7f['include'],function(_0x2d2f13){return{'model':db[_0x2d2f13['model']],'as':_0x2d2f13['as'],'attributes':_0x2d2f13[_0xc6b1('0x1a')],'include':_0x2d2f13[_0xc6b1('0x1c')]?_[_0xc6b1('0x1d')](_0x2d2f13[_0xc6b1('0x1c')],function(_0x50e052){return{'model':db[_0x50e052[_0xc6b1('0x1e')]],'as':_0x50e052['as'],'attributes':_0x50e052[_0xc6b1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc6b1('0xb')](function(_0x71ce3e){logger[_0xc6b1('0x14')](_0xc6b1('0x1f'),_0x2c4bae);logger[_0xc6b1('0xe')]('GetMailServerIn',_0x2c4bae,JSON[_0xc6b1('0x10')](_0x71ce3e));_0x5d732e(_0x71ce3e);})[_0xc6b1('0x20')](function(_0x284f6c){logger[_0xc6b1('0x11')](_0xc6b1('0x1f'),_0x284f6c[_0xc6b1('0x13')],_0x2c4bae);_0x41370b(_0x40a267['error'](0x1f4,_0x284f6c[_0xc6b1('0x13')]));});});}; \ No newline at end of file +var _0xd398=['request\x20sent','error','message','catch','MailServerIn','options','raw','where','limit','map','include','attributes','model','GetMailServerIn','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s'];(function(_0x51cc4f,_0x38f15f){var _0x24a3a1=function(_0x53a93c){while(--_0x53a93c){_0x51cc4f['push'](_0x51cc4f['shift']());}};_0x24a3a1(++_0x38f15f);}(_0xd398,0x1dd));var _0x8d39=function(_0x57c83a,_0x5866e4){_0x57c83a=_0x57c83a-0x0;var _0x21b624=_0xd398[_0x57c83a];return _0x21b624;};'use strict';var _=require(_0x8d39('0x0'));var util=require(_0x8d39('0x1'));var moment=require(_0x8d39('0x2'));var BPromise=require(_0x8d39('0x3'));var rs=require(_0x8d39('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d39('0x5'))['db'];var utils=require(_0x8d39('0x6'));var logger=require(_0x8d39('0x7'))(_0x8d39('0x8'));var config=require(_0x8d39('0x9'));var jayson=require(_0x8d39('0xa'));var client=jayson[_0x8d39('0xb')][_0x8d39('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38dd94,_0x1d8081,_0x41fe53){return new BPromise(function(_0x3405f3,_0x4711c7){return client['request'](_0x38dd94,_0x41fe53)[_0x8d39('0xd')](function(_0x3392e3){logger[_0x8d39('0xe')](_0x8d39('0xf'),_0x1d8081,'request\x20sent');logger[_0x8d39('0x10')](_0x8d39('0x11'),_0x1d8081,_0x8d39('0x12'),JSON['stringify'](_0x3392e3));if(_0x3392e3[_0x8d39('0x13')]){if(_0x3392e3[_0x8d39('0x13')]['code']===0x1f4){logger['error'](_0x8d39('0xf'),_0x1d8081,_0x3392e3[_0x8d39('0x13')][_0x8d39('0x14')]);return _0x4711c7(_0x3392e3[_0x8d39('0x13')]['message']);}logger['error'](_0x8d39('0xf'),_0x1d8081,_0x3392e3[_0x8d39('0x13')][_0x8d39('0x14')]);return _0x3405f3(_0x3392e3[_0x8d39('0x13')]['message']);}else{logger[_0x8d39('0xe')](_0x8d39('0xf'),_0x1d8081,'request\x20sent');_0x3405f3(_0x3392e3['result'][_0x8d39('0x14')]);}})[_0x8d39('0x15')](function(_0x182980){logger[_0x8d39('0x13')](_0x8d39('0xf'),_0x1d8081,_0x182980);_0x4711c7(_0x182980);});});}exports['GetMailServerIn']=function(_0x1eabfa){var _0x295ae5=this;return new Promise(function(_0x1e5f95,_0x531e41){return db[_0x8d39('0x16')]['findAll']({'raw':_0x1eabfa[_0x8d39('0x17')]?_0x1eabfa[_0x8d39('0x17')][_0x8d39('0x18')]===undefined?!![]:![]:!![],'where':_0x1eabfa['options']?_0x1eabfa['options'][_0x8d39('0x19')]||null:null,'attributes':_0x1eabfa[_0x8d39('0x17')]?_0x1eabfa[_0x8d39('0x17')]['attributes']||null:null,'limit':_0x1eabfa['options']?_0x1eabfa[_0x8d39('0x17')][_0x8d39('0x1a')]||null:null,'include':_0x1eabfa['options']?_0x1eabfa['options']['include']?_[_0x8d39('0x1b')](_0x1eabfa[_0x8d39('0x17')][_0x8d39('0x1c')],function(_0x170f1e){return{'model':db[_0x170f1e['model']],'as':_0x170f1e['as'],'attributes':_0x170f1e[_0x8d39('0x1d')],'include':_0x170f1e['include']?_['map'](_0x170f1e[_0x8d39('0x1c')],function(_0x7f887e){return{'model':db[_0x7f887e[_0x8d39('0x1e')]],'as':_0x7f887e['as'],'attributes':_0x7f887e[_0x8d39('0x1d')],'include':_0x7f887e['include']?_[_0x8d39('0x1b')](_0x7f887e[_0x8d39('0x1c')],function(_0x1c637d){return{'model':db[_0x1c637d[_0x8d39('0x1e')]],'as':_0x1c637d['as'],'attributes':_0x1c637d[_0x8d39('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8d39('0xd')](function(_0x581555){logger['info'](_0x8d39('0x1f'),_0x1eabfa);logger[_0x8d39('0x10')](_0x8d39('0x1f'),_0x1eabfa,JSON[_0x8d39('0x20')](_0x581555));_0x1e5f95(_0x581555);})[_0x8d39('0x15')](function(_0x7f61a3){logger[_0x8d39('0x13')](_0x8d39('0x1f'),_0x7f61a3[_0x8d39('0x14')],_0x1eabfa);_0x531e41(_0x295ae5[_0x8d39('0x13')](0x1f4,_0x7f61a3['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 1327eb3..4bcdd64 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x7a54,0x106));var _0x47a5=function(_0x137a97,_0x8d093b){_0x137a97=_0x137a97-0x0;var _0x34661f=_0x7a54[_0x137a97];return _0x34661f;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x7a54,0x106));var _0x47a5=function(_0x1e281f,_0x5af5b6){_0x1e281f=_0x1e281f-0x0;var _0x1396e1=_0x7a54[_0x1e281f];return _0x1396e1;};'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 bc6861f..a7ebb05 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 _0xfa63=['sequelize','exports','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfa63,0xf0));var _0x3fa6=function(_0x3f21a1,_0x3d8c0a){_0x3f21a1=_0x3f21a1-0x0;var _0x259f20=_0xfa63[_0x3f21a1];return _0x259f20;};'use strict';var Sequelize=require(_0x3fa6('0x0'));module[_0x3fa6('0x1')]={'description':{'type':Sequelize[_0x3fa6('0x2')]},'host':{'type':Sequelize[_0x3fa6('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x3fa6('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x3fa6('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x68d9=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x3a3c17,_0x5b7b7e){var _0xd07f21=function(_0xeaad44){while(--_0xeaad44){_0x3a3c17['push'](_0x3a3c17['shift']());}};_0xd07f21(++_0x5b7b7e);}(_0x68d9,0x1c6));var _0x968d=function(_0x1ecdca,_0x2792e8){_0x1ecdca=_0x1ecdca-0x0;var _0x50adc3=_0x68d9[_0x1ecdca];return _0x50adc3;};'use strict';var Sequelize=require('sequelize');module[_0x968d('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x968d('0x1')]},'user':{'type':Sequelize[_0x968d('0x1')]},'pass':{'type':Sequelize[_0x968d('0x1')]},'port':{'type':Sequelize[_0x968d('0x2')]},'secure':{'type':Sequelize[_0x968d('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x968d('0x1')]},'authentication':{'type':Sequelize[_0x968d('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 9674268..6d68faa 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 _0x5291=['json','offset','undefined','count','limit','set','Content-Range','save','update','then','status','error','stack','name','send','index','map','MailServerOut','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','end'];(function(_0x59b58e,_0xc801c2){var _0x2fae76=function(_0x24df70){while(--_0x24df70){_0x59b58e['push'](_0x59b58e['shift']());}};_0x2fae76(++_0xc801c2);}(_0x5291,0x193));var _0x1529=function(_0x55f799,_0x23dbfd){_0x55f799=_0x55f799-0x0;var _0xddaa19=_0x5291[_0x55f799];return _0xddaa19;};'use strict';var emlformat=require(_0x1529('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1529('0x1'));var jsonpatch=require(_0x1529('0x2'));var rp=require(_0x1529('0x3'));var moment=require('moment');var BPromise=require(_0x1529('0x4'));var Mustache=require(_0x1529('0x5'));var util=require(_0x1529('0x6'));var path=require(_0x1529('0x7'));var sox=require(_0x1529('0x8'));var csv=require('to-csv');var ejs=require(_0x1529('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1529('0xa'));var crypto=require(_0x1529('0xb'));var jsforce=require(_0x1529('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1529('0xd'));var Papa=require(_0x1529('0xe'));var Redis=require(_0x1529('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1529('0x10'));var as=require(_0x1529('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1529('0x12'));var utils=require('../../config/utils');var config=require(_0x1529('0x13'));var licenseUtil=require(_0x1529('0x14'));var db=require(_0x1529('0x15'))['db'];function respondWithStatusCode(_0x52ceac,_0x1e0eca){_0x1e0eca=_0x1e0eca||0xcc;return function(_0x2b89ba){if(_0x2b89ba){return _0x52ceac['sendStatus'](_0x1e0eca);}return _0x52ceac['status'](_0x1e0eca)[_0x1529('0x16')]();};}function respondWithResult(_0x1013eb,_0x5262f8){_0x5262f8=_0x5262f8||0xc8;return function(_0x5e4a11){if(_0x5e4a11){return _0x1013eb['status'](_0x5262f8)[_0x1529('0x17')](_0x5e4a11);}};}function respondWithFilteredResult(_0x100ca9,_0x8856cb){return function(_0x2bdad3){if(_0x2bdad3){var _0x2fd8f2=typeof _0x8856cb[_0x1529('0x18')]==='undefined'&&typeof _0x8856cb['limit']===_0x1529('0x19');var _0xb243aa=_0x2bdad3[_0x1529('0x1a')];var _0x38d13a=_0x2fd8f2?0x0:_0x8856cb['offset'];var _0xf6b711=_0x2fd8f2?_0x2bdad3[_0x1529('0x1a')]:_0x8856cb[_0x1529('0x18')]+_0x8856cb[_0x1529('0x1b')];var _0x3cbaaf;if(_0xf6b711>=_0xb243aa){_0xf6b711=_0xb243aa;_0x3cbaaf=0xc8;}else{_0x3cbaaf=0xce;}_0x100ca9['status'](_0x3cbaaf);return _0x100ca9[_0x1529('0x1c')](_0x1529('0x1d'),_0x38d13a+'-'+_0xf6b711+'/'+_0xb243aa)[_0x1529('0x17')](_0x2bdad3);}return null;};}function patchUpdates(_0x1c4eed){return function(_0x454987){try{jsonpatch['apply'](_0x454987,_0x1c4eed,!![]);}catch(_0x289a16){return BPromise['reject'](_0x289a16);}return _0x454987[_0x1529('0x1e')]();};}function saveUpdates(_0x2977ab,_0x4d7761){return function(_0x1349af){if(_0x1349af){return _0x1349af[_0x1529('0x1f')](_0x2977ab)[_0x1529('0x20')](function(_0x462659){return _0x462659;});}return null;};}function removeEntity(_0x827400,_0x1955b8){return function(_0x284cb1){if(_0x284cb1){return _0x284cb1['destroy']()[_0x1529('0x20')](function(){_0x827400[_0x1529('0x21')](0xcc)[_0x1529('0x16')]();});}};}function handleEntityNotFound(_0x1c0935,_0x1c45a0){return function(_0x464ea9){if(!_0x464ea9){_0x1c0935['sendStatus'](0x194);}return _0x464ea9;};}function handleError(_0x476117,_0x2956d6){_0x2956d6=_0x2956d6||0x1f4;return function(_0x50b7a2){logger[_0x1529('0x22')](_0x50b7a2[_0x1529('0x23')]);if(_0x50b7a2[_0x1529('0x24')]){delete _0x50b7a2[_0x1529('0x24')];}_0x476117[_0x1529('0x21')](_0x2956d6)[_0x1529('0x25')](_0x50b7a2);};}exports[_0x1529('0x26')]=function(_0x4829a7,_0x2b5e8b){var _0x45fb99={},_0x59c328={},_0x40af70={'count':0x0,'rows':[]};var _0x18c268=_[_0x1529('0x27')](db[_0x1529('0x28')]['rawAttributes'],function(_0x56e2c5){return{'name':_0x56e2c5[_0x1529('0x29')],'type':_0x56e2c5[_0x1529('0x2a')][_0x1529('0x2b')]};});_0x59c328[_0x1529('0x2c')]=_[_0x1529('0x27')](_0x18c268,'name');_0x59c328['query']=_[_0x1529('0x2d')](_0x4829a7[_0x1529('0x2e')]);_0x59c328[_0x1529('0x2f')]=_[_0x1529('0x30')](_0x59c328[_0x1529('0x2c')],_0x59c328['query']);_0x45fb99['attributes']=_[_0x1529('0x30')](_0x59c328[_0x1529('0x2c')],qs[_0x1529('0x31')](_0x4829a7[_0x1529('0x2e')][_0x1529('0x31')]));_0x45fb99[_0x1529('0x32')]=_0x45fb99['attributes'][_0x1529('0x33')]?_0x45fb99[_0x1529('0x32')]:_0x59c328['model'];if(!_0x4829a7[_0x1529('0x2e')][_0x1529('0x34')](_0x1529('0x35'))){_0x45fb99[_0x1529('0x1b')]=qs[_0x1529('0x1b')](_0x4829a7['query']['limit']);_0x45fb99['offset']=qs[_0x1529('0x18')](_0x4829a7[_0x1529('0x2e')][_0x1529('0x18')]);}_0x45fb99[_0x1529('0x36')]=qs[_0x1529('0x37')](_0x4829a7[_0x1529('0x2e')][_0x1529('0x37')]);_0x45fb99[_0x1529('0x38')]=qs['filters'](_[_0x1529('0x39')](_0x4829a7['query'],_0x59c328[_0x1529('0x2f')]),_0x18c268);if(_0x4829a7[_0x1529('0x2e')][_0x1529('0x3a')]){_0x45fb99[_0x1529('0x38')]=_[_0x1529('0x3b')](_0x45fb99[_0x1529('0x38')],{'$or':_[_0x1529('0x27')](_0x18c268,function(_0x267d1e){if(_0x267d1e[_0x1529('0x2a')]!==_0x1529('0x3c')){var _0x33b59e={};_0x33b59e[_0x267d1e[_0x1529('0x24')]]={'$like':'%'+_0x4829a7[_0x1529('0x2e')][_0x1529('0x3a')]+'%'};return _0x33b59e;}})});}_0x45fb99=_[_0x1529('0x3b')]({},_0x45fb99,_0x4829a7[_0x1529('0x3d')]);var _0x574e6f={'where':_0x45fb99[_0x1529('0x38')]};return db[_0x1529('0x28')][_0x1529('0x1a')](_0x574e6f)['then'](function(_0x52c506){_0x40af70[_0x1529('0x1a')]=_0x52c506;if(_0x4829a7[_0x1529('0x2e')][_0x1529('0x3e')]){_0x45fb99['include']=[{'all':!![]}];}return db[_0x1529('0x28')][_0x1529('0x3f')](_0x45fb99);})['then'](function(_0x41ab5e){_0x40af70[_0x1529('0x40')]=_0x41ab5e;return _0x40af70;})[_0x1529('0x20')](respondWithFilteredResult(_0x2b5e8b,_0x45fb99))[_0x1529('0x41')](handleError(_0x2b5e8b,null));};exports['show']=function(_0x2fe445,_0x10c144){var _0x21394d={'raw':!![],'where':{'id':_0x2fe445[_0x1529('0x42')]['id']}},_0x4194c4={};_0x4194c4[_0x1529('0x2c')]=_['keys'](db[_0x1529('0x28')]['rawAttributes']);_0x4194c4['query']=_[_0x1529('0x2d')](_0x2fe445[_0x1529('0x2e')]);_0x4194c4[_0x1529('0x2f')]=_['intersection'](_0x4194c4[_0x1529('0x2c')],_0x4194c4['query']);_0x21394d[_0x1529('0x32')]=_[_0x1529('0x30')](_0x4194c4[_0x1529('0x2c')],qs[_0x1529('0x31')](_0x2fe445[_0x1529('0x2e')][_0x1529('0x31')]));_0x21394d[_0x1529('0x32')]=_0x21394d[_0x1529('0x32')][_0x1529('0x33')]?_0x21394d['attributes']:_0x4194c4[_0x1529('0x2c')];if(_0x2fe445['query'][_0x1529('0x3e')]){_0x21394d[_0x1529('0x43')]=[{'all':!![]}];}_0x21394d=_[_0x1529('0x3b')]({},_0x21394d,_0x2fe445['options']);return db[_0x1529('0x28')][_0x1529('0x44')](_0x21394d)[_0x1529('0x20')](handleEntityNotFound(_0x10c144,null))[_0x1529('0x20')](respondWithResult(_0x10c144,null))[_0x1529('0x41')](handleError(_0x10c144,null));};exports['create']=function(_0x23f504,_0x202175){return db[_0x1529('0x28')]['create'](_0x23f504[_0x1529('0x45')],{})[_0x1529('0x20')](respondWithResult(_0x202175,0xc9))[_0x1529('0x41')](handleError(_0x202175,null));};exports[_0x1529('0x1f')]=function(_0x4ccda4,_0x5a4a56){if(_0x4ccda4[_0x1529('0x45')]['id']){delete _0x4ccda4[_0x1529('0x45')]['id'];}return db[_0x1529('0x28')]['find']({'where':{'id':_0x4ccda4['params']['id']}})[_0x1529('0x20')](handleEntityNotFound(_0x5a4a56,null))[_0x1529('0x20')](saveUpdates(_0x4ccda4[_0x1529('0x45')],null))[_0x1529('0x20')](respondWithResult(_0x5a4a56,null))[_0x1529('0x41')](handleError(_0x5a4a56,null));};exports[_0x1529('0x46')]=function(_0x822e2c,_0x518b78){return db[_0x1529('0x28')][_0x1529('0x44')]({'where':{'id':_0x822e2c[_0x1529('0x42')]['id']}})[_0x1529('0x20')](handleEntityNotFound(_0x518b78,null))[_0x1529('0x20')](removeEntity(_0x518b78,null))['catch'](handleError(_0x518b78,null));}; \ No newline at end of file +var _0xb455=['intersection','attributes','length','order','sort','where','filters','pick','filter','merge','options','include','rows','catch','show','fields','includeAll','create','body','find','params','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','type','key','model','query','keys'];(function(_0x39b0e9,_0x46bfe8){var _0x46da66=function(_0x2f255e){while(--_0x2f255e){_0x39b0e9['push'](_0x39b0e9['shift']());}};_0x46da66(++_0x46bfe8);}(_0xb455,0x169));var _0x5b45=function(_0x4b2cc7,_0x45bd80){_0x4b2cc7=_0x4b2cc7-0x0;var _0x22126d=_0xb455[_0x4b2cc7];return _0x22126d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5b45('0x0'));var rp=require(_0x5b45('0x1'));var moment=require(_0x5b45('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5b45('0x3'));var path=require(_0x5b45('0x4'));var sox=require(_0x5b45('0x5'));var csv=require('to-csv');var ejs=require(_0x5b45('0x6'));var fs=require('fs');var fs_extra=require(_0x5b45('0x7'));var _=require(_0x5b45('0x8'));var squel=require('squel');var crypto=require(_0x5b45('0x9'));var jsforce=require(_0x5b45('0xa'));var deskjs=require(_0x5b45('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5b45('0xc'));var Redis=require(_0x5b45('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5b45('0xe'));var as=require(_0x5b45('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b45('0x10'))(_0x5b45('0x11'));var utils=require('../../config/utils');var config=require(_0x5b45('0x12'));var licenseUtil=require(_0x5b45('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f8385,_0x148d5d){_0x148d5d=_0x148d5d||0xcc;return function(_0x7f9c96){if(_0x7f9c96){return _0x2f8385[_0x5b45('0x14')](_0x148d5d);}return _0x2f8385[_0x5b45('0x15')](_0x148d5d)[_0x5b45('0x16')]();};}function respondWithResult(_0x429f66,_0x162214){_0x162214=_0x162214||0xc8;return function(_0x3e05d8){if(_0x3e05d8){return _0x429f66[_0x5b45('0x15')](_0x162214)[_0x5b45('0x17')](_0x3e05d8);}};}function respondWithFilteredResult(_0x4d8f3a,_0x2b746a){return function(_0x30befa){if(_0x30befa){var _0x407987=typeof _0x2b746a[_0x5b45('0x18')]===_0x5b45('0x19')&&typeof _0x2b746a['limit']===_0x5b45('0x19');var _0x3778d2=_0x30befa[_0x5b45('0x1a')];var _0x1bef74=_0x407987?0x0:_0x2b746a[_0x5b45('0x18')];var _0x19d388=_0x407987?_0x30befa[_0x5b45('0x1a')]:_0x2b746a[_0x5b45('0x18')]+_0x2b746a[_0x5b45('0x1b')];var _0x41a676;if(_0x19d388>=_0x3778d2){_0x19d388=_0x3778d2;_0x41a676=0xc8;}else{_0x41a676=0xce;}_0x4d8f3a[_0x5b45('0x15')](_0x41a676);return _0x4d8f3a[_0x5b45('0x1c')](_0x5b45('0x1d'),_0x1bef74+'-'+_0x19d388+'/'+_0x3778d2)[_0x5b45('0x17')](_0x30befa);}return null;};}function patchUpdates(_0x504ab6){return function(_0x2adc3f){try{jsonpatch[_0x5b45('0x1e')](_0x2adc3f,_0x504ab6,!![]);}catch(_0x560245){return BPromise['reject'](_0x560245);}return _0x2adc3f['save']();};}function saveUpdates(_0x1b9cbb,_0x33cf42){return function(_0x5c32e7){if(_0x5c32e7){return _0x5c32e7[_0x5b45('0x1f')](_0x1b9cbb)[_0x5b45('0x20')](function(_0x37f681){return _0x37f681;});}return null;};}function removeEntity(_0x5af618,_0x3568ce){return function(_0x39d3e6){if(_0x39d3e6){return _0x39d3e6[_0x5b45('0x21')]()[_0x5b45('0x20')](function(){_0x5af618['status'](0xcc)[_0x5b45('0x16')]();});}};}function handleEntityNotFound(_0x401e36,_0x428e7d){return function(_0x4729b5){if(!_0x4729b5){_0x401e36['sendStatus'](0x194);}return _0x4729b5;};}function handleError(_0xd5127d,_0x289f84){_0x289f84=_0x289f84||0x1f4;return function(_0x526b87){logger[_0x5b45('0x22')](_0x526b87[_0x5b45('0x23')]);if(_0x526b87[_0x5b45('0x24')]){delete _0x526b87[_0x5b45('0x24')];}_0xd5127d[_0x5b45('0x15')](_0x289f84)[_0x5b45('0x25')](_0x526b87);};}exports[_0x5b45('0x26')]=function(_0x3535a7,_0x11f151){var _0x4fa7f0={},_0x1adf8f={},_0x2230b1={'count':0x0,'rows':[]};var _0x56254=_[_0x5b45('0x27')](db[_0x5b45('0x28')][_0x5b45('0x29')],function(_0xf13445){return{'name':_0xf13445['fieldName'],'type':_0xf13445[_0x5b45('0x2a')][_0x5b45('0x2b')]};});_0x1adf8f[_0x5b45('0x2c')]=_[_0x5b45('0x27')](_0x56254,_0x5b45('0x24'));_0x1adf8f[_0x5b45('0x2d')]=_[_0x5b45('0x2e')](_0x3535a7['query']);_0x1adf8f['filters']=_[_0x5b45('0x2f')](_0x1adf8f['model'],_0x1adf8f[_0x5b45('0x2d')]);_0x4fa7f0[_0x5b45('0x30')]=_[_0x5b45('0x2f')](_0x1adf8f[_0x5b45('0x2c')],qs['fields'](_0x3535a7[_0x5b45('0x2d')]['fields']));_0x4fa7f0[_0x5b45('0x30')]=_0x4fa7f0[_0x5b45('0x30')][_0x5b45('0x31')]?_0x4fa7f0['attributes']:_0x1adf8f[_0x5b45('0x2c')];if(!_0x3535a7[_0x5b45('0x2d')]['hasOwnProperty']('nolimit')){_0x4fa7f0['limit']=qs[_0x5b45('0x1b')](_0x3535a7['query']['limit']);_0x4fa7f0[_0x5b45('0x18')]=qs['offset'](_0x3535a7[_0x5b45('0x2d')][_0x5b45('0x18')]);}_0x4fa7f0[_0x5b45('0x32')]=qs[_0x5b45('0x33')](_0x3535a7[_0x5b45('0x2d')][_0x5b45('0x33')]);_0x4fa7f0[_0x5b45('0x34')]=qs[_0x5b45('0x35')](_[_0x5b45('0x36')](_0x3535a7[_0x5b45('0x2d')],_0x1adf8f[_0x5b45('0x35')]),_0x56254);if(_0x3535a7[_0x5b45('0x2d')][_0x5b45('0x37')]){_0x4fa7f0[_0x5b45('0x34')]=_[_0x5b45('0x38')](_0x4fa7f0[_0x5b45('0x34')],{'$or':_[_0x5b45('0x27')](_0x56254,function(_0x2f4fac){if(_0x2f4fac[_0x5b45('0x2a')]!=='VIRTUAL'){var _0x52743f={};_0x52743f[_0x2f4fac[_0x5b45('0x24')]]={'$like':'%'+_0x3535a7[_0x5b45('0x2d')][_0x5b45('0x37')]+'%'};return _0x52743f;}})});}_0x4fa7f0=_[_0x5b45('0x38')]({},_0x4fa7f0,_0x3535a7[_0x5b45('0x39')]);var _0x4bf360={'where':_0x4fa7f0['where']};return db[_0x5b45('0x28')][_0x5b45('0x1a')](_0x4bf360)[_0x5b45('0x20')](function(_0x5520e9){_0x2230b1[_0x5b45('0x1a')]=_0x5520e9;if(_0x3535a7[_0x5b45('0x2d')]['includeAll']){_0x4fa7f0[_0x5b45('0x3a')]=[{'all':!![]}];}return db[_0x5b45('0x28')]['findAll'](_0x4fa7f0);})[_0x5b45('0x20')](function(_0x4931aa){_0x2230b1[_0x5b45('0x3b')]=_0x4931aa;return _0x2230b1;})['then'](respondWithFilteredResult(_0x11f151,_0x4fa7f0))[_0x5b45('0x3c')](handleError(_0x11f151,null));};exports[_0x5b45('0x3d')]=function(_0x4bceb3,_0x25709f){var _0x14b999={'raw':!![],'where':{'id':_0x4bceb3['params']['id']}},_0x39501e={};_0x39501e[_0x5b45('0x2c')]=_[_0x5b45('0x2e')](db[_0x5b45('0x28')][_0x5b45('0x29')]);_0x39501e[_0x5b45('0x2d')]=_[_0x5b45('0x2e')](_0x4bceb3[_0x5b45('0x2d')]);_0x39501e[_0x5b45('0x35')]=_[_0x5b45('0x2f')](_0x39501e[_0x5b45('0x2c')],_0x39501e['query']);_0x14b999[_0x5b45('0x30')]=_[_0x5b45('0x2f')](_0x39501e[_0x5b45('0x2c')],qs['fields'](_0x4bceb3['query'][_0x5b45('0x3e')]));_0x14b999[_0x5b45('0x30')]=_0x14b999[_0x5b45('0x30')][_0x5b45('0x31')]?_0x14b999[_0x5b45('0x30')]:_0x39501e[_0x5b45('0x2c')];if(_0x4bceb3[_0x5b45('0x2d')][_0x5b45('0x3f')]){_0x14b999[_0x5b45('0x3a')]=[{'all':!![]}];}_0x14b999=_[_0x5b45('0x38')]({},_0x14b999,_0x4bceb3[_0x5b45('0x39')]);return db['MailServerOut']['find'](_0x14b999)[_0x5b45('0x20')](handleEntityNotFound(_0x25709f,null))[_0x5b45('0x20')](respondWithResult(_0x25709f,null))[_0x5b45('0x3c')](handleError(_0x25709f,null));};exports['create']=function(_0xad8049,_0x14e7db){return db['MailServerOut'][_0x5b45('0x40')](_0xad8049[_0x5b45('0x41')],{})[_0x5b45('0x20')](respondWithResult(_0x14e7db,0xc9))[_0x5b45('0x3c')](handleError(_0x14e7db,null));};exports['update']=function(_0x1f959e,_0x4bdbe8){if(_0x1f959e[_0x5b45('0x41')]['id']){delete _0x1f959e[_0x5b45('0x41')]['id'];}return db[_0x5b45('0x28')][_0x5b45('0x42')]({'where':{'id':_0x1f959e[_0x5b45('0x43')]['id']}})['then'](handleEntityNotFound(_0x4bdbe8,null))[_0x5b45('0x20')](saveUpdates(_0x1f959e[_0x5b45('0x41')],null))['then'](respondWithResult(_0x4bdbe8,null))[_0x5b45('0x3c')](handleError(_0x4bdbe8,null));};exports[_0x5b45('0x21')]=function(_0x4a6cd7,_0x3a095d){return db[_0x5b45('0x28')][_0x5b45('0x42')]({'where':{'id':_0x4a6cd7['params']['id']}})[_0x5b45('0x20')](handleEntityNotFound(_0x3a095d,null))[_0x5b45('0x20')](removeEntity(_0x3a095d,null))[_0x5b45('0x3c')](handleError(_0x3a095d,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index d30c423..3b5de36 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 _0x71bd=['MailServerOut','mail_servers_out','util','../../config/logger','api','path','rimraf','../../config/environment','define'];(function(_0xf3f796,_0x1dcba3){var _0x37eec9=function(_0x2e57ef){while(--_0x2e57ef){_0xf3f796['push'](_0xf3f796['shift']());}};_0x37eec9(++_0x1dcba3);}(_0x71bd,0xbf));var _0xd71b=function(_0x4565ed,_0x40a5a6){_0x4565ed=_0x4565ed-0x0;var _0x372d5d=_0x71bd[_0x4565ed];return _0x372d5d;};'use strict';var _=require('lodash');var util=require(_0xd71b('0x0'));var logger=require(_0xd71b('0x1'))(_0xd71b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd71b('0x3'));var rimraf=require(_0xd71b('0x4'));var config=require(_0xd71b('0x5'));var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x5070f2,_0x5d7bdc){return _0x5070f2[_0xd71b('0x6')](_0xd71b('0x7'),attributes,{'tableName':_0xd71b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1fcc=['path','../../config/environment','exports','define','MailServerOut','mail_servers_out','lodash','../../config/logger','api','request-promise'];(function(_0x36f45f,_0x2162b6){var _0x3d75e7=function(_0x340f80){while(--_0x340f80){_0x36f45f['push'](_0x36f45f['shift']());}};_0x3d75e7(++_0x2162b6);}(_0x1fcc,0xf6));var _0xc1fc=function(_0x323d87,_0x4ef3f9){_0x323d87=_0x323d87-0x0;var _0x5e8f74=_0x1fcc[_0x323d87];return _0x5e8f74;};'use strict';var _=require(_0xc1fc('0x0'));var util=require('util');var logger=require(_0xc1fc('0x1'))(_0xc1fc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc1fc('0x3'));var fs=require('fs');var path=require(_0xc1fc('0x4'));var rimraf=require('rimraf');var config=require(_0xc1fc('0x5'));var attributes=require('./mailServerOut.attributes');module[_0xc1fc('0x6')]=function(_0x4d3ceb,_0x2cfb71){return _0x4d3ceb[_0xc1fc('0x7')](_0xc1fc('0x8'),attributes,{'tableName':_0xc1fc('0x9'),'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 6a265ee..5d76457 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 _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(_0x26c314,_0x2b406f){var _0x406f22=function(_0x33ad53){while(--_0x33ad53){_0x26c314['push'](_0x26c314['shift']());}};_0x406f22(++_0x2b406f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'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 +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xf1402a,_0x187f5c){var _0x4f7ead=function(_0x57dfd9){while(--_0x57dfd9){_0xf1402a['push'](_0xf1402a['shift']());}};_0x4f7ead(++_0x187f5c);}(_0xadb5,0xad));var _0x5adb=function(_0x5a484f,_0x26e276){_0x5a484f=_0x5a484f-0x0;var _0x4106eb=_0xadb5[_0x5a484f];return _0x4106eb;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index d41a2d6..9441a00 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 _0x2daf=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','/:id','update','destroy','exports','multer'];(function(_0x559a4e,_0xc539cf){var _0x39e0b6=function(_0xe4d99d){while(--_0xe4d99d){_0x559a4e['push'](_0x559a4e['shift']());}};_0x39e0b6(++_0xc539cf);}(_0x2daf,0x1c7));var _0xf2da=function(_0xfe5403,_0x1628b1){_0xfe5403=_0xfe5403-0x0;var _0x2d1e48=_0x2daf[_0xfe5403];return _0x2d1e48;};'use strict';var multer=require(_0xf2da('0x0'));var util=require(_0xf2da('0x1'));var path=require(_0xf2da('0x2'));var timeout=require(_0xf2da('0x3'));var express=require(_0xf2da('0x4'));var router=express[_0xf2da('0x5')]();var fs_extra=require(_0xf2da('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf2da('0x7'));var config=require(_0xf2da('0x8'));var controller=require('./mailSubstatus.controller');router[_0xf2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xf2da('0xa')]);router[_0xf2da('0x9')](_0xf2da('0xb'),auth[_0xf2da('0xc')](),controller[_0xf2da('0xd')]);router[_0xf2da('0x9')]('/:id',auth[_0xf2da('0xc')](),controller[_0xf2da('0xe')]);router['post']('/',auth[_0xf2da('0xc')](),controller['create']);router['put'](_0xf2da('0xf'),auth['isAuthenticated'](),controller[_0xf2da('0x10')]);router['delete'](_0xf2da('0xf'),auth[_0xf2da('0xc')](),controller[_0xf2da('0x11')]);module[_0xf2da('0x12')]=router; \ No newline at end of file +var _0x70d4=['index','/describe','describe','/:id','post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated'];(function(_0x168484,_0x531442){var _0x5207ec=function(_0x5a071d){while(--_0x5a071d){_0x168484['push'](_0x168484['shift']());}};_0x5207ec(++_0x531442);}(_0x70d4,0x1ae));var _0x470d=function(_0x5ad771,_0x34186f){_0x5ad771=_0x5ad771-0x0;var _0x5b5dce=_0x70d4[_0x5ad771];return _0x5b5dce;};'use strict';var multer=require(_0x470d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x470d('0x1'));var express=require(_0x470d('0x2'));var router=express[_0x470d('0x3')]();var fs_extra=require(_0x470d('0x4'));var auth=require(_0x470d('0x5'));var interaction=require(_0x470d('0x6'));var config=require(_0x470d('0x7'));var controller=require(_0x470d('0x8'));router[_0x470d('0x9')]('/',auth[_0x470d('0xa')](),controller[_0x470d('0xb')]);router[_0x470d('0x9')](_0x470d('0xc'),auth[_0x470d('0xa')](),controller[_0x470d('0xd')]);router[_0x470d('0x9')](_0x470d('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x470d('0xf')]('/',auth['isAuthenticated'](),controller[_0x470d('0x10')]);router['put']('/:id',auth[_0x470d('0xa')](),controller[_0x470d('0x11')]);router[_0x470d('0x12')](_0x470d('0xe'),auth[_0x470d('0xa')](),controller[_0x470d('0x13')]);module[_0x470d('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 8e4d125..7a762ea 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 _0x9fd4=['sequelize','exports','STRING','name'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x9fd4,0x16c));var _0x49fd=function(_0x5d9c37,_0x518b93){_0x5d9c37=_0x5d9c37-0x0;var _0x1ba9eb=_0x9fd4[_0x5d9c37];return _0x1ba9eb;};'use strict';var Sequelize=require(_0x49fd('0x0'));module[_0x49fd('0x1')]={'name':{'type':Sequelize[_0x49fd('0x2')],'unique':_0x49fd('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x49fd('0x2')]}}; \ No newline at end of file +var _0xa46e=['name','STRING','sequelize','exports'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xa46e,0x8a));var _0xea46=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0xa46e[_0x562f3b];return _0x1edd55;};'use strict';var Sequelize=require(_0xea46('0x0'));module[_0xea46('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xea46('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xea46('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 609cd05..67a5471 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 _0x1dfc=['nolimit','sort','where','filters','pick','merge','count','includeAll','include','catch','params','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x339823,_0x4b05c4){var _0x4be445=function(_0x1e3416){while(--_0x1e3416){_0x339823['push'](_0x339823['shift']());}};_0x4be445(++_0x4b05c4);}(_0x1dfc,0x1e5));var _0xc1df=function(_0x233488,_0x2e2c08){_0x233488=_0x233488-0x0;var _0x49827f=_0x1dfc[_0x233488];return _0x49827f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1df('0x0'));var zipdir=require(_0xc1df('0x1'));var jsonpatch=require(_0xc1df('0x2'));var rp=require('request-promise');var moment=require(_0xc1df('0x3'));var BPromise=require(_0xc1df('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc1df('0x5'));var sox=require('sox');var csv=require(_0xc1df('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1df('0x7'));var _=require(_0xc1df('0x8'));var squel=require(_0xc1df('0x9'));var crypto=require('crypto');var jsforce=require(_0xc1df('0xa'));var deskjs=require(_0xc1df('0xb'));var toCsv=require(_0xc1df('0x6'));var querystring=require('querystring');var Papa=require(_0xc1df('0xc'));var Redis=require('ioredis');var authService=require(_0xc1df('0xd'));var qs=require(_0xc1df('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc1df('0xf'))(_0xc1df('0x10'));var utils=require(_0xc1df('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xc1df('0x12'));var db=require(_0xc1df('0x13'))['db'];function respondWithStatusCode(_0x553fb2,_0x17b2ad){_0x17b2ad=_0x17b2ad||0xcc;return function(_0x2d0ff1){if(_0x2d0ff1){return _0x553fb2[_0xc1df('0x14')](_0x17b2ad);}return _0x553fb2[_0xc1df('0x15')](_0x17b2ad)[_0xc1df('0x16')]();};}function respondWithResult(_0x11409e,_0x12ab2b){_0x12ab2b=_0x12ab2b||0xc8;return function(_0x16c77c){if(_0x16c77c){return _0x11409e[_0xc1df('0x15')](_0x12ab2b)[_0xc1df('0x17')](_0x16c77c);}};}function respondWithFilteredResult(_0x3aa194,_0x773b5e){return function(_0x5d4acb){if(_0x5d4acb){var _0x349409=typeof _0x773b5e['offset']==='undefined'&&typeof _0x773b5e[_0xc1df('0x18')]==='undefined';var _0x15cf28=_0x5d4acb['count'];var _0x1288e4=_0x349409?0x0:_0x773b5e[_0xc1df('0x19')];var _0x541af4=_0x349409?_0x5d4acb['count']:_0x773b5e[_0xc1df('0x19')]+_0x773b5e['limit'];var _0x37b9f8;if(_0x541af4>=_0x15cf28){_0x541af4=_0x15cf28;_0x37b9f8=0xc8;}else{_0x37b9f8=0xce;}_0x3aa194[_0xc1df('0x15')](_0x37b9f8);return _0x3aa194[_0xc1df('0x1a')](_0xc1df('0x1b'),_0x1288e4+'-'+_0x541af4+'/'+_0x15cf28)[_0xc1df('0x17')](_0x5d4acb);}return null;};}function patchUpdates(_0x38e6a4){return function(_0x2f99ac){try{jsonpatch[_0xc1df('0x1c')](_0x2f99ac,_0x38e6a4,!![]);}catch(_0x3e4f63){return BPromise['reject'](_0x3e4f63);}return _0x2f99ac[_0xc1df('0x1d')]();};}function saveUpdates(_0x44bcd1,_0x5a250f){return function(_0x2bd268){if(_0x2bd268){return _0x2bd268[_0xc1df('0x1e')](_0x44bcd1)[_0xc1df('0x1f')](function(_0x388f38){return _0x388f38;});}return null;};}function removeEntity(_0x5f1c5,_0x50bd9d){return function(_0x50707f){if(_0x50707f){return _0x50707f[_0xc1df('0x20')]()['then'](function(){_0x5f1c5[_0xc1df('0x15')](0xcc)[_0xc1df('0x16')]();});}};}function handleEntityNotFound(_0x7f94b7,_0x18be56){return function(_0x2b8ca8){if(!_0x2b8ca8){_0x7f94b7['sendStatus'](0x194);}return _0x2b8ca8;};}function handleError(_0x285406,_0x504a0c){_0x504a0c=_0x504a0c||0x1f4;return function(_0x4f2f9b){logger[_0xc1df('0x21')](_0x4f2f9b[_0xc1df('0x22')]);if(_0x4f2f9b[_0xc1df('0x23')]){delete _0x4f2f9b[_0xc1df('0x23')];}_0x285406['status'](_0x504a0c)['send'](_0x4f2f9b);};}exports[_0xc1df('0x24')]=function(_0x20e7e8,_0x31e59f){var _0x269711={},_0x3d19c0={},_0x3fc469={'count':0x0,'rows':[]};var _0x5c7756=_[_0xc1df('0x25')](db[_0xc1df('0x26')][_0xc1df('0x27')],function(_0x6174){return{'name':_0x6174[_0xc1df('0x28')],'type':_0x6174[_0xc1df('0x29')][_0xc1df('0x2a')]};});_0x3d19c0[_0xc1df('0x2b')]=_['map'](_0x5c7756,_0xc1df('0x23'));_0x3d19c0[_0xc1df('0x2c')]=_[_0xc1df('0x2d')](_0x20e7e8['query']);_0x3d19c0['filters']=_[_0xc1df('0x2e')](_0x3d19c0[_0xc1df('0x2b')],_0x3d19c0[_0xc1df('0x2c')]);_0x269711[_0xc1df('0x2f')]=_['intersection'](_0x3d19c0[_0xc1df('0x2b')],qs[_0xc1df('0x30')](_0x20e7e8['query'][_0xc1df('0x30')]));_0x269711[_0xc1df('0x2f')]=_0x269711[_0xc1df('0x2f')][_0xc1df('0x31')]?_0x269711[_0xc1df('0x2f')]:_0x3d19c0[_0xc1df('0x2b')];if(!_0x20e7e8[_0xc1df('0x2c')][_0xc1df('0x32')](_0xc1df('0x33'))){_0x269711[_0xc1df('0x18')]=qs[_0xc1df('0x18')](_0x20e7e8[_0xc1df('0x2c')][_0xc1df('0x18')]);_0x269711[_0xc1df('0x19')]=qs[_0xc1df('0x19')](_0x20e7e8[_0xc1df('0x2c')][_0xc1df('0x19')]);}_0x269711['order']=qs[_0xc1df('0x34')](_0x20e7e8[_0xc1df('0x2c')][_0xc1df('0x34')]);_0x269711[_0xc1df('0x35')]=qs[_0xc1df('0x36')](_[_0xc1df('0x37')](_0x20e7e8[_0xc1df('0x2c')],_0x3d19c0['filters']),_0x5c7756);if(_0x20e7e8[_0xc1df('0x2c')]['filter']){_0x269711[_0xc1df('0x35')]=_[_0xc1df('0x38')](_0x269711[_0xc1df('0x35')],{'$or':_[_0xc1df('0x25')](_0x5c7756,function(_0x2288fa){if(_0x2288fa['type']!=='VIRTUAL'){var _0x1cd485={};_0x1cd485[_0x2288fa['name']]={'$like':'%'+_0x20e7e8['query']['filter']+'%'};return _0x1cd485;}})});}_0x269711=_[_0xc1df('0x38')]({},_0x269711,_0x20e7e8['options']);var _0x24f7f5={'where':_0x269711[_0xc1df('0x35')]};return db['MailSubstatus'][_0xc1df('0x39')](_0x24f7f5)[_0xc1df('0x1f')](function(_0x7a7b92){_0x3fc469['count']=_0x7a7b92;if(_0x20e7e8[_0xc1df('0x2c')][_0xc1df('0x3a')]){_0x269711[_0xc1df('0x3b')]=[{'all':!![]}];}return db[_0xc1df('0x26')]['findAll'](_0x269711);})['then'](function(_0x46b417){_0x3fc469['rows']=_0x46b417;return _0x3fc469;})[_0xc1df('0x1f')](respondWithFilteredResult(_0x31e59f,_0x269711))[_0xc1df('0x3c')](handleError(_0x31e59f,null));};exports['show']=function(_0x592c57,_0x3ec83e){var _0x3664be={'raw':!![],'where':{'id':_0x592c57[_0xc1df('0x3d')]['id']}},_0x39162d={};_0x39162d[_0xc1df('0x2b')]=_[_0xc1df('0x2d')](db[_0xc1df('0x26')]['rawAttributes']);_0x39162d[_0xc1df('0x2c')]=_[_0xc1df('0x2d')](_0x592c57[_0xc1df('0x2c')]);_0x39162d[_0xc1df('0x36')]=_[_0xc1df('0x2e')](_0x39162d['model'],_0x39162d['query']);_0x3664be[_0xc1df('0x2f')]=_['intersection'](_0x39162d[_0xc1df('0x2b')],qs[_0xc1df('0x30')](_0x592c57[_0xc1df('0x2c')][_0xc1df('0x30')]));_0x3664be[_0xc1df('0x2f')]=_0x3664be[_0xc1df('0x2f')]['length']?_0x3664be[_0xc1df('0x2f')]:_0x39162d['model'];if(_0x592c57['query']['includeAll']){_0x3664be[_0xc1df('0x3b')]=[{'all':!![]}];}_0x3664be=_[_0xc1df('0x38')]({},_0x3664be,_0x592c57[_0xc1df('0x3e')]);return db['MailSubstatus'][_0xc1df('0x3f')](_0x3664be)[_0xc1df('0x1f')](handleEntityNotFound(_0x3ec83e,null))[_0xc1df('0x1f')](respondWithResult(_0x3ec83e,null))['catch'](handleError(_0x3ec83e,null));};exports[_0xc1df('0x40')]=function(_0xb1a390,_0x49bfe9){return db[_0xc1df('0x26')][_0xc1df('0x40')](_0xb1a390[_0xc1df('0x41')],{})[_0xc1df('0x1f')](respondWithResult(_0x49bfe9,0xc9))[_0xc1df('0x3c')](handleError(_0x49bfe9,null));};exports[_0xc1df('0x1e')]=function(_0x1d6284,_0x1c1531){if(_0x1d6284[_0xc1df('0x41')]['id']){delete _0x1d6284['body']['id'];}return db[_0xc1df('0x26')][_0xc1df('0x3f')]({'where':{'id':_0x1d6284['params']['id']}})[_0xc1df('0x1f')](handleEntityNotFound(_0x1c1531,null))[_0xc1df('0x1f')](saveUpdates(_0x1d6284[_0xc1df('0x41')],null))['then'](respondWithResult(_0x1c1531,null))[_0xc1df('0x3c')](handleError(_0x1c1531,null));};exports[_0xc1df('0x20')]=function(_0x484a4a,_0x163d2d){return db[_0xc1df('0x26')][_0xc1df('0x3f')]({'where':{'id':_0x484a4a[_0xc1df('0x3d')]['id']}})['then'](handleEntityNotFound(_0x163d2d,null))[_0xc1df('0x1f')](removeEntity(_0x163d2d,null))['catch'](handleError(_0x163d2d,null));};exports[_0xc1df('0x42')]=function(_0x2035ee,_0x48f93e){return db[_0xc1df('0x26')]['describe']()[_0xc1df('0x1f')](respondWithResult(_0x48f93e,null))[_0xc1df('0x3c')](handleError(_0x48f93e,null));}; \ No newline at end of file +var _0xfb88=['find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','MailSubstatus','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','options'];(function(_0xf6b79b,_0x988e7e){var _0x40f212=function(_0x1dc32b){while(--_0x1dc32b){_0xf6b79b['push'](_0xf6b79b['shift']());}};_0x40f212(++_0x988e7e);}(_0xfb88,0x1df));var _0x8fb8=function(_0x5e554c,_0x387755){_0x5e554c=_0x5e554c-0x0;var _0x57ebfa=_0xfb88[_0x5e554c];return _0x57ebfa;};'use strict';var emlformat=require(_0x8fb8('0x0'));var rimraf=require(_0x8fb8('0x1'));var zipdir=require(_0x8fb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8fb8('0x3'));var BPromise=require(_0x8fb8('0x4'));var Mustache=require('mustache');var util=require(_0x8fb8('0x5'));var path=require('path');var sox=require(_0x8fb8('0x6'));var csv=require('to-csv');var ejs=require(_0x8fb8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8fb8('0x8'));var crypto=require(_0x8fb8('0x9'));var jsforce=require(_0x8fb8('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8fb8('0xb'));var querystring=require('querystring');var Papa=require(_0x8fb8('0xc'));var Redis=require(_0x8fb8('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8fb8('0xe'));var hardwareService=require(_0x8fb8('0xf'));var logger=require(_0x8fb8('0x10'))('api');var utils=require(_0x8fb8('0x11'));var config=require(_0x8fb8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x8fb8('0x13'))['db'];function respondWithStatusCode(_0x2f41b3,_0x37174e){_0x37174e=_0x37174e||0xcc;return function(_0x2d7f6f){if(_0x2d7f6f){return _0x2f41b3[_0x8fb8('0x14')](_0x37174e);}return _0x2f41b3['status'](_0x37174e)[_0x8fb8('0x15')]();};}function respondWithResult(_0x522ce7,_0x3547e8){_0x3547e8=_0x3547e8||0xc8;return function(_0x4fffb2){if(_0x4fffb2){return _0x522ce7[_0x8fb8('0x16')](_0x3547e8)['json'](_0x4fffb2);}};}function respondWithFilteredResult(_0x472847,_0x366ddf){return function(_0x415a60){if(_0x415a60){var _0x1bd26a=typeof _0x366ddf[_0x8fb8('0x17')]===_0x8fb8('0x18')&&typeof _0x366ddf[_0x8fb8('0x19')]===_0x8fb8('0x18');var _0x58874f=_0x415a60[_0x8fb8('0x1a')];var _0x5e5716=_0x1bd26a?0x0:_0x366ddf['offset'];var _0x19615b=_0x1bd26a?_0x415a60[_0x8fb8('0x1a')]:_0x366ddf['offset']+_0x366ddf['limit'];var _0x312a26;if(_0x19615b>=_0x58874f){_0x19615b=_0x58874f;_0x312a26=0xc8;}else{_0x312a26=0xce;}_0x472847[_0x8fb8('0x16')](_0x312a26);return _0x472847['set'](_0x8fb8('0x1b'),_0x5e5716+'-'+_0x19615b+'/'+_0x58874f)[_0x8fb8('0x1c')](_0x415a60);}return null;};}function patchUpdates(_0x456e38){return function(_0x5b0dd1){try{jsonpatch[_0x8fb8('0x1d')](_0x5b0dd1,_0x456e38,!![]);}catch(_0x151d7a){return BPromise[_0x8fb8('0x1e')](_0x151d7a);}return _0x5b0dd1[_0x8fb8('0x1f')]();};}function saveUpdates(_0x13af45,_0x5f2c5b){return function(_0x5e9f0c){if(_0x5e9f0c){return _0x5e9f0c[_0x8fb8('0x20')](_0x13af45)[_0x8fb8('0x21')](function(_0x3f57f5){return _0x3f57f5;});}return null;};}function removeEntity(_0x1134e3,_0xe517fa){return function(_0x2d37c4){if(_0x2d37c4){return _0x2d37c4[_0x8fb8('0x22')]()[_0x8fb8('0x21')](function(){_0x1134e3[_0x8fb8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9cc1c2,_0x557f2a){return function(_0x415e57){if(!_0x415e57){_0x9cc1c2[_0x8fb8('0x14')](0x194);}return _0x415e57;};}function handleError(_0x78754a,_0x28a8e5){_0x28a8e5=_0x28a8e5||0x1f4;return function(_0x55c0b3){logger[_0x8fb8('0x23')](_0x55c0b3[_0x8fb8('0x24')]);if(_0x55c0b3[_0x8fb8('0x25')]){delete _0x55c0b3[_0x8fb8('0x25')];}_0x78754a['status'](_0x28a8e5)[_0x8fb8('0x26')](_0x55c0b3);};}exports['index']=function(_0x114e3d,_0xe98c8c){var _0x5b524f={},_0x3a6930={},_0xe4a60b={'count':0x0,'rows':[]};var _0x358a95=_['map'](db[_0x8fb8('0x27')][_0x8fb8('0x28')],function(_0x30fb9d){return{'name':_0x30fb9d[_0x8fb8('0x29')],'type':_0x30fb9d['type']['key']};});_0x3a6930[_0x8fb8('0x2a')]=_[_0x8fb8('0x2b')](_0x358a95,_0x8fb8('0x25'));_0x3a6930[_0x8fb8('0x2c')]=_[_0x8fb8('0x2d')](_0x114e3d['query']);_0x3a6930['filters']=_[_0x8fb8('0x2e')](_0x3a6930[_0x8fb8('0x2a')],_0x3a6930[_0x8fb8('0x2c')]);_0x5b524f[_0x8fb8('0x2f')]=_[_0x8fb8('0x2e')](_0x3a6930[_0x8fb8('0x2a')],qs[_0x8fb8('0x30')](_0x114e3d['query'][_0x8fb8('0x30')]));_0x5b524f[_0x8fb8('0x2f')]=_0x5b524f[_0x8fb8('0x2f')]['length']?_0x5b524f[_0x8fb8('0x2f')]:_0x3a6930[_0x8fb8('0x2a')];if(!_0x114e3d[_0x8fb8('0x2c')][_0x8fb8('0x31')](_0x8fb8('0x32'))){_0x5b524f['limit']=qs[_0x8fb8('0x19')](_0x114e3d['query']['limit']);_0x5b524f['offset']=qs[_0x8fb8('0x17')](_0x114e3d[_0x8fb8('0x2c')][_0x8fb8('0x17')]);}_0x5b524f['order']=qs[_0x8fb8('0x33')](_0x114e3d[_0x8fb8('0x2c')][_0x8fb8('0x33')]);_0x5b524f[_0x8fb8('0x34')]=qs[_0x8fb8('0x35')](_[_0x8fb8('0x36')](_0x114e3d[_0x8fb8('0x2c')],_0x3a6930[_0x8fb8('0x35')]),_0x358a95);if(_0x114e3d[_0x8fb8('0x2c')]['filter']){_0x5b524f['where']=_[_0x8fb8('0x37')](_0x5b524f['where'],{'$or':_['map'](_0x358a95,function(_0x2948d5){if(_0x2948d5['type']!==_0x8fb8('0x38')){var _0x54f55a={};_0x54f55a[_0x2948d5[_0x8fb8('0x25')]]={'$like':'%'+_0x114e3d[_0x8fb8('0x2c')][_0x8fb8('0x39')]+'%'};return _0x54f55a;}})});}_0x5b524f=_[_0x8fb8('0x37')]({},_0x5b524f,_0x114e3d['options']);var _0x3a13c0={'where':_0x5b524f[_0x8fb8('0x34')]};return db[_0x8fb8('0x27')][_0x8fb8('0x1a')](_0x3a13c0)[_0x8fb8('0x21')](function(_0x39ae23){_0xe4a60b[_0x8fb8('0x1a')]=_0x39ae23;if(_0x114e3d[_0x8fb8('0x2c')][_0x8fb8('0x3a')]){_0x5b524f[_0x8fb8('0x3b')]=[{'all':!![]}];}return db[_0x8fb8('0x27')][_0x8fb8('0x3c')](_0x5b524f);})[_0x8fb8('0x21')](function(_0x91a29e){_0xe4a60b['rows']=_0x91a29e;return _0xe4a60b;})['then'](respondWithFilteredResult(_0xe98c8c,_0x5b524f))[_0x8fb8('0x3d')](handleError(_0xe98c8c,null));};exports[_0x8fb8('0x3e')]=function(_0x1a4dac,_0x40c506){var _0x37c2d7={'raw':!![],'where':{'id':_0x1a4dac[_0x8fb8('0x3f')]['id']}},_0x5377c0={};_0x5377c0[_0x8fb8('0x2a')]=_[_0x8fb8('0x2d')](db[_0x8fb8('0x27')][_0x8fb8('0x28')]);_0x5377c0[_0x8fb8('0x2c')]=_[_0x8fb8('0x2d')](_0x1a4dac[_0x8fb8('0x2c')]);_0x5377c0[_0x8fb8('0x35')]=_[_0x8fb8('0x2e')](_0x5377c0['model'],_0x5377c0[_0x8fb8('0x2c')]);_0x37c2d7[_0x8fb8('0x2f')]=_[_0x8fb8('0x2e')](_0x5377c0[_0x8fb8('0x2a')],qs[_0x8fb8('0x30')](_0x1a4dac[_0x8fb8('0x2c')][_0x8fb8('0x30')]));_0x37c2d7['attributes']=_0x37c2d7[_0x8fb8('0x2f')]['length']?_0x37c2d7['attributes']:_0x5377c0[_0x8fb8('0x2a')];if(_0x1a4dac['query'][_0x8fb8('0x3a')]){_0x37c2d7[_0x8fb8('0x3b')]=[{'all':!![]}];}_0x37c2d7=_['merge']({},_0x37c2d7,_0x1a4dac[_0x8fb8('0x40')]);return db['MailSubstatus'][_0x8fb8('0x41')](_0x37c2d7)[_0x8fb8('0x21')](handleEntityNotFound(_0x40c506,null))[_0x8fb8('0x21')](respondWithResult(_0x40c506,null))[_0x8fb8('0x3d')](handleError(_0x40c506,null));};exports['create']=function(_0x5c9d12,_0x769de0){return db[_0x8fb8('0x27')][_0x8fb8('0x42')](_0x5c9d12[_0x8fb8('0x43')],{})['then'](respondWithResult(_0x769de0,0xc9))[_0x8fb8('0x3d')](handleError(_0x769de0,null));};exports[_0x8fb8('0x20')]=function(_0x30f436,_0x254244){if(_0x30f436[_0x8fb8('0x43')]['id']){delete _0x30f436[_0x8fb8('0x43')]['id'];}return db[_0x8fb8('0x27')][_0x8fb8('0x41')]({'where':{'id':_0x30f436[_0x8fb8('0x3f')]['id']}})[_0x8fb8('0x21')](handleEntityNotFound(_0x254244,null))['then'](saveUpdates(_0x30f436[_0x8fb8('0x43')],null))[_0x8fb8('0x21')](respondWithResult(_0x254244,null))[_0x8fb8('0x3d')](handleError(_0x254244,null));};exports[_0x8fb8('0x22')]=function(_0x37a33a,_0x125a83){return db[_0x8fb8('0x27')][_0x8fb8('0x41')]({'where':{'id':_0x37a33a[_0x8fb8('0x3f')]['id']}})[_0x8fb8('0x21')](handleEntityNotFound(_0x125a83,null))['then'](removeEntity(_0x125a83,null))[_0x8fb8('0x3d')](handleError(_0x125a83,null));};exports['describe']=function(_0x2e83e6,_0x5519b4){return db[_0x8fb8('0x27')]['describe']()[_0x8fb8('0x21')](respondWithResult(_0x5519b4,null))['catch'](handleError(_0x5519b4,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index cfa2625..e52029a 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 _0x98ea=['mail_substatuses','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./mailSubstatus.attributes'];(function(_0x5608c8,_0x5cd32a){var _0x34572d=function(_0x52483d){while(--_0x52483d){_0x5608c8['push'](_0x5608c8['shift']());}};_0x34572d(++_0x5cd32a);}(_0x98ea,0x1f0));var _0xa98e=function(_0x4751a1,_0x2395bc){_0x4751a1=_0x4751a1-0x0;var _0x17ed84=_0x98ea[_0x4751a1];return _0x17ed84;};'use strict';var _=require(_0xa98e('0x0'));var util=require(_0xa98e('0x1'));var logger=require(_0xa98e('0x2'))('api');var moment=require(_0xa98e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa98e('0x4'));var rimraf=require(_0xa98e('0x5'));var config=require(_0xa98e('0x6'));var attributes=require(_0xa98e('0x7'));module['exports']=function(_0x3ae1dc,_0x1ffea9){return _0x3ae1dc['define']('MailSubstatus',attributes,{'tableName':_0xa98e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81ce=['../../config/environment','exports','MailSubstatus','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5fe7ce,_0x1a0d39){var _0x3b5793=function(_0x221d2a){while(--_0x221d2a){_0x5fe7ce['push'](_0x5fe7ce['shift']());}};_0x3b5793(++_0x1a0d39);}(_0x81ce,0x7b));var _0xe81c=function(_0x3d14d1,_0x23aa69){_0x3d14d1=_0x3d14d1-0x0;var _0xc78d1f=_0x81ce[_0x3d14d1];return _0xc78d1f;};'use strict';var _=require(_0xe81c('0x0'));var util=require(_0xe81c('0x1'));var logger=require(_0xe81c('0x2'))(_0xe81c('0x3'));var moment=require(_0xe81c('0x4'));var BPromise=require(_0xe81c('0x5'));var rp=require(_0xe81c('0x6'));var fs=require('fs');var path=require(_0xe81c('0x7'));var rimraf=require(_0xe81c('0x8'));var config=require(_0xe81c('0x9'));var attributes=require('./mailSubstatus.attributes');module[_0xe81c('0xa')]=function(_0x5616f6,_0x1e02b7){return _0x5616f6['define'](_0xe81c('0xb'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index a527ec3..60bea42 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 _0x17d0=['stringify','error','code','message','result','catch','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x17d0,0x1a8));var _0x017d=function(_0x272d90,_0x5e70ff){_0x272d90=_0x272d90-0x0;var _0x2bf4a2=_0x17d0[_0x272d90];return _0x2bf4a2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x017d('0x0'));var BPromise=require('bluebird');var rs=require(_0x017d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x017d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x017d('0x3'))(_0x017d('0x4'));var config=require(_0x017d('0x5'));var jayson=require(_0x017d('0x6'));var client=jayson['client'][_0x017d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xd73a93,_0x46466d,_0x57e41b){return new BPromise(function(_0x456965,_0x30d0e0){return client['request'](_0xd73a93,_0x57e41b)['then'](function(_0x3f3e93){logger[_0x017d('0x8')](_0x017d('0x9'),_0x46466d,'request\x20sent');logger[_0x017d('0xa')](_0x017d('0xb'),_0x46466d,_0x017d('0xc'),JSON[_0x017d('0xd')](_0x3f3e93));if(_0x3f3e93[_0x017d('0xe')]){if(_0x3f3e93[_0x017d('0xe')][_0x017d('0xf')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x46466d,_0x3f3e93[_0x017d('0xe')]['message']);return _0x30d0e0(_0x3f3e93[_0x017d('0xe')][_0x017d('0x10')]);}logger[_0x017d('0xe')](_0x017d('0x9'),_0x46466d,_0x3f3e93[_0x017d('0xe')][_0x017d('0x10')]);return _0x456965(_0x3f3e93[_0x017d('0xe')][_0x017d('0x10')]);}else{logger[_0x017d('0x8')](_0x017d('0x9'),_0x46466d,_0x017d('0xc'));_0x456965(_0x3f3e93[_0x017d('0x11')][_0x017d('0x10')]);}})[_0x017d('0x12')](function(_0x5ec139){logger[_0x017d('0xe')](_0x017d('0x9'),_0x46466d,_0x5ec139);_0x30d0e0(_0x5ec139);});});} \ No newline at end of file +var _0x771c=['rpc','jayson/promise','client','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x771c,0x10d));var _0xc771=function(_0x865486,_0x334972){_0x865486=_0x865486-0x0;var _0x165dec=_0x771c[_0x865486];return _0x165dec;};'use strict';var _=require(_0xc771('0x0'));var util=require(_0xc771('0x1'));var moment=require('moment');var BPromise=require(_0xc771('0x2'));var rs=require(_0xc771('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc771('0x4'))['db'];var utils=require(_0xc771('0x5'));var logger=require(_0xc771('0x6'))(_0xc771('0x7'));var config=require('../../config/environment');var jayson=require(_0xc771('0x8'));var client=jayson[_0xc771('0x9')][_0xc771('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a7d86,_0x121e8f,_0x74e8b4){return new BPromise(function(_0x4247e1,_0x41b47c){return client[_0xc771('0xb')](_0x5a7d86,_0x74e8b4)[_0xc771('0xc')](function(_0x2dd470){logger['info'](_0xc771('0xd'),_0x121e8f,_0xc771('0xe'));logger[_0xc771('0xf')](_0xc771('0x10'),_0x121e8f,_0xc771('0xe'),JSON['stringify'](_0x2dd470));if(_0x2dd470[_0xc771('0x11')]){if(_0x2dd470[_0xc771('0x11')][_0xc771('0x12')]===0x1f4){logger['error'](_0xc771('0xd'),_0x121e8f,_0x2dd470[_0xc771('0x11')][_0xc771('0x13')]);return _0x41b47c(_0x2dd470[_0xc771('0x11')]['message']);}logger[_0xc771('0x11')](_0xc771('0xd'),_0x121e8f,_0x2dd470[_0xc771('0x11')]['message']);return _0x4247e1(_0x2dd470[_0xc771('0x11')][_0xc771('0x13')]);}else{logger[_0xc771('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x121e8f,_0xc771('0xe'));_0x4247e1(_0x2dd470[_0xc771('0x15')][_0xc771('0x13')]);}})[_0xc771('0x16')](function(_0xb3c6e3){logger[_0xc771('0x11')](_0xc771('0xd'),_0x121e8f,_0xb3c6e3);_0x41b47c(_0xb3c6e3);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index d199a40..a0cdf2d 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 _0x91fb=['path','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x5af5a8,_0x10ce33){var _0x414545=function(_0xb57b5c){while(--_0xb57b5c){_0x5af5a8['push'](_0x5af5a8['shift']());}};_0x414545(++_0x10ce33);}(_0x91fb,0xa9));var _0xb91f=function(_0x4d08b8,_0x34c445){_0x4d08b8=_0x4d08b8-0x0;var _0x70214a=_0x91fb[_0x4d08b8];return _0x70214a;};'use strict';var multer=require(_0xb91f('0x0'));var util=require(_0xb91f('0x1'));var path=require(_0xb91f('0x2'));var timeout=require('connect-timeout');var express=require(_0xb91f('0x3'));var router=express['Router']();var fs_extra=require(_0xb91f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb91f('0x5'));var config=require(_0xb91f('0x6'));var controller=require('./mailTransferReport.controller');router[_0xb91f('0x7')]('/',auth[_0xb91f('0x8')](),controller['index']);router[_0xb91f('0x7')](_0xb91f('0x9'),auth[_0xb91f('0x8')](),controller['describe']);router['get'](_0xb91f('0xa'),auth[_0xb91f('0x8')](),controller[_0xb91f('0xb')]);router[_0xb91f('0xc')]('/',auth[_0xb91f('0x8')](),controller[_0xb91f('0xd')]);router[_0xb91f('0xe')](_0xb91f('0xa'),auth['isAuthenticated'](),controller[_0xb91f('0xf')]);router[_0xb91f('0x10')](_0xb91f('0xa'),auth[_0xb91f('0x8')](),controller[_0xb91f('0x11')]);module[_0xb91f('0x12')]=router; \ No newline at end of file +var _0x84c7=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','put','delete','destroy','exports'];(function(_0x2364ab,_0x3b2c76){var _0x4ce4a1=function(_0x32ace4){while(--_0x32ace4){_0x2364ab['push'](_0x2364ab['shift']());}};_0x4ce4a1(++_0x3b2c76);}(_0x84c7,0x90));var _0x784c=function(_0x438bb9,_0x497786){_0x438bb9=_0x438bb9-0x0;var _0x375c80=_0x84c7[_0x438bb9];return _0x375c80;};'use strict';var multer=require(_0x784c('0x0'));var util=require(_0x784c('0x1'));var path=require(_0x784c('0x2'));var timeout=require(_0x784c('0x3'));var express=require(_0x784c('0x4'));var router=express[_0x784c('0x5')]();var fs_extra=require(_0x784c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x784c('0x7'));var config=require(_0x784c('0x8'));var controller=require('./mailTransferReport.controller');router[_0x784c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x784c('0x9')]('/describe',auth[_0x784c('0xa')](),controller['describe']);router[_0x784c('0x9')](_0x784c('0xb'),auth[_0x784c('0xa')](),controller['show']);router[_0x784c('0xc')]('/',auth[_0x784c('0xa')](),controller[_0x784c('0xd')]);router[_0x784c('0xe')](_0x784c('0xb'),auth[_0x784c('0xa')](),controller['update']);router[_0x784c('0xf')](_0x784c('0xb'),auth[_0x784c('0xa')](),controller[_0x784c('0x10')]);module[_0x784c('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 f4ab8aa..91f6850 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x49d3cd,_0x4ceef3){var _0x2654c3=function(_0x3dea7f){while(--_0x3dea7f){_0x49d3cd['push'](_0x49d3cd['shift']());}};_0x2654c3(++_0x4ceef3);}(_0xe706,0xa3));var _0x6e70=function(_0x24af20,_0xb1b03b){_0x24af20=_0x24af20-0x0;var _0x20bbc5=_0xe706[_0x24af20];return _0x20bbc5;};'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 +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x447be1,_0x26785d){var _0x252ebc=function(_0x12d7a7){while(--_0x12d7a7){_0x447be1['push'](_0x447be1['shift']());}};_0x252ebc(++_0x26785d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0xcb91[_0xc55d64];return _0x4194f6;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 604dd93..f349524 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 _0xbc8e=['key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','MailTransferReport','rawAttributes','fieldName','type'];(function(_0x557ac1,_0x845e21){var _0x2c5f12=function(_0x35627c){while(--_0x35627c){_0x557ac1['push'](_0x557ac1['shift']());}};_0x2c5f12(++_0x845e21);}(_0xbc8e,0x10f));var _0xebc8=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xbc8e[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0xebc8('0x0'));var rimraf=require(_0xebc8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xebc8('0x2'));var moment=require(_0xebc8('0x3'));var BPromise=require(_0xebc8('0x4'));var Mustache=require(_0xebc8('0x5'));var util=require(_0xebc8('0x6'));var path=require('path');var sox=require(_0xebc8('0x7'));var csv=require(_0xebc8('0x8'));var ejs=require(_0xebc8('0x9'));var fs=require('fs');var fs_extra=require(_0xebc8('0xa'));var _=require(_0xebc8('0xb'));var squel=require(_0xebc8('0xc'));var crypto=require(_0xebc8('0xd'));var jsforce=require(_0xebc8('0xe'));var deskjs=require(_0xebc8('0xf'));var toCsv=require(_0xebc8('0x8'));var querystring=require(_0xebc8('0x10'));var Papa=require(_0xebc8('0x11'));var Redis=require(_0xebc8('0x12'));var authService=require(_0xebc8('0x13'));var qs=require(_0xebc8('0x14'));var as=require(_0xebc8('0x15'));var hardwareService=require(_0xebc8('0x16'));var logger=require('../../config/logger')(_0xebc8('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xebc8('0x18'));var db=require(_0xebc8('0x19'))['db'];function respondWithStatusCode(_0x233426,_0x3345bf){_0x3345bf=_0x3345bf||0xcc;return function(_0x285bf1){if(_0x285bf1){return _0x233426['sendStatus'](_0x3345bf);}return _0x233426[_0xebc8('0x1a')](_0x3345bf)[_0xebc8('0x1b')]();};}function respondWithResult(_0x22f3f4,_0x41d84c){_0x41d84c=_0x41d84c||0xc8;return function(_0x47952b){if(_0x47952b){return _0x22f3f4[_0xebc8('0x1a')](_0x41d84c)[_0xebc8('0x1c')](_0x47952b);}};}function respondWithFilteredResult(_0x273dbd,_0x504bc1){return function(_0x115372){if(_0x115372){var _0x3479a5=typeof _0x504bc1[_0xebc8('0x1d')]===_0xebc8('0x1e')&&typeof _0x504bc1[_0xebc8('0x1f')]===_0xebc8('0x1e');var _0x35abc5=_0x115372[_0xebc8('0x20')];var _0x4b6851=_0x3479a5?0x0:_0x504bc1[_0xebc8('0x1d')];var _0x51661e=_0x3479a5?_0x115372[_0xebc8('0x20')]:_0x504bc1['offset']+_0x504bc1[_0xebc8('0x1f')];var _0x4cddbd;if(_0x51661e>=_0x35abc5){_0x51661e=_0x35abc5;_0x4cddbd=0xc8;}else{_0x4cddbd=0xce;}_0x273dbd[_0xebc8('0x1a')](_0x4cddbd);return _0x273dbd[_0xebc8('0x21')](_0xebc8('0x22'),_0x4b6851+'-'+_0x51661e+'/'+_0x35abc5)[_0xebc8('0x1c')](_0x115372);}return null;};}function patchUpdates(_0x30279b){return function(_0x517174){try{jsonpatch[_0xebc8('0x23')](_0x517174,_0x30279b,!![]);}catch(_0x18c11b){return BPromise[_0xebc8('0x24')](_0x18c11b);}return _0x517174[_0xebc8('0x25')]();};}function saveUpdates(_0x431e06,_0x3ed946){return function(_0x3b7e43){if(_0x3b7e43){return _0x3b7e43[_0xebc8('0x26')](_0x431e06)[_0xebc8('0x27')](function(_0x19b81a){return _0x19b81a;});}return null;};}function removeEntity(_0xba54f9,_0x26fbe3){return function(_0x795803){if(_0x795803){return _0x795803['destroy']()['then'](function(){_0xba54f9[_0xebc8('0x1a')](0xcc)[_0xebc8('0x1b')]();});}};}function handleEntityNotFound(_0x5d2ea1,_0xfc41c6){return function(_0x568a6b){if(!_0x568a6b){_0x5d2ea1[_0xebc8('0x28')](0x194);}return _0x568a6b;};}function handleError(_0x4a87c4,_0x3b7d6d){_0x3b7d6d=_0x3b7d6d||0x1f4;return function(_0x3a47a2){logger[_0xebc8('0x29')](_0x3a47a2[_0xebc8('0x2a')]);if(_0x3a47a2[_0xebc8('0x2b')]){delete _0x3a47a2[_0xebc8('0x2b')];}_0x4a87c4[_0xebc8('0x1a')](_0x3b7d6d)[_0xebc8('0x2c')](_0x3a47a2);};}exports['index']=function(_0x2d776d,_0x396bb0){var _0x243112={},_0x502d63={},_0x133f14={'count':0x0,'rows':[]};var _0xd35b1a=_['map'](db[_0xebc8('0x2d')][_0xebc8('0x2e')],function(_0x2d5b40){return{'name':_0x2d5b40[_0xebc8('0x2f')],'type':_0x2d5b40[_0xebc8('0x30')][_0xebc8('0x31')]};});_0x502d63[_0xebc8('0x32')]=_[_0xebc8('0x33')](_0xd35b1a,'name');_0x502d63[_0xebc8('0x34')]=_['keys'](_0x2d776d[_0xebc8('0x34')]);_0x502d63[_0xebc8('0x35')]=_[_0xebc8('0x36')](_0x502d63[_0xebc8('0x32')],_0x502d63[_0xebc8('0x34')]);_0x243112[_0xebc8('0x37')]=_[_0xebc8('0x36')](_0x502d63[_0xebc8('0x32')],qs['fields'](_0x2d776d[_0xebc8('0x34')][_0xebc8('0x38')]));_0x243112[_0xebc8('0x37')]=_0x243112['attributes'][_0xebc8('0x39')]?_0x243112[_0xebc8('0x37')]:_0x502d63['model'];if(!_0x2d776d[_0xebc8('0x34')][_0xebc8('0x3a')](_0xebc8('0x3b'))){_0x243112[_0xebc8('0x1f')]=qs['limit'](_0x2d776d['query'][_0xebc8('0x1f')]);_0x243112[_0xebc8('0x1d')]=qs[_0xebc8('0x1d')](_0x2d776d[_0xebc8('0x34')][_0xebc8('0x1d')]);}_0x243112[_0xebc8('0x3c')]=qs[_0xebc8('0x3d')](_0x2d776d[_0xebc8('0x34')][_0xebc8('0x3d')]);_0x243112[_0xebc8('0x3e')]=qs[_0xebc8('0x35')](_[_0xebc8('0x3f')](_0x2d776d['query'],_0x502d63[_0xebc8('0x35')]),_0xd35b1a);if(_0x2d776d[_0xebc8('0x34')][_0xebc8('0x40')]){_0x243112[_0xebc8('0x3e')]=_[_0xebc8('0x41')](_0x243112[_0xebc8('0x3e')],{'$or':_[_0xebc8('0x33')](_0xd35b1a,function(_0x37b719){if(_0x37b719[_0xebc8('0x30')]!==_0xebc8('0x42')){var _0x37d458={};_0x37d458[_0x37b719[_0xebc8('0x2b')]]={'$like':'%'+_0x2d776d[_0xebc8('0x34')][_0xebc8('0x40')]+'%'};return _0x37d458;}})});}_0x243112=_[_0xebc8('0x41')]({},_0x243112,_0x2d776d[_0xebc8('0x43')]);var _0x9267e0={'where':_0x243112[_0xebc8('0x3e')]};return db[_0xebc8('0x2d')]['count'](_0x9267e0)[_0xebc8('0x27')](function(_0x981b75){_0x133f14[_0xebc8('0x20')]=_0x981b75;if(_0x2d776d[_0xebc8('0x34')][_0xebc8('0x44')]){_0x243112[_0xebc8('0x45')]=[{'all':!![]}];}return db[_0xebc8('0x2d')]['findAll'](_0x243112);})[_0xebc8('0x27')](function(_0x4c6454){_0x133f14[_0xebc8('0x46')]=_0x4c6454;return _0x133f14;})['then'](respondWithFilteredResult(_0x396bb0,_0x243112))[_0xebc8('0x47')](handleError(_0x396bb0,null));};exports[_0xebc8('0x48')]=function(_0x539681,_0x19da95){var _0x22d74e={'raw':!![],'where':{'id':_0x539681[_0xebc8('0x49')]['id']}},_0x6427b9={};_0x6427b9[_0xebc8('0x32')]=_[_0xebc8('0x4a')](db['MailTransferReport'][_0xebc8('0x2e')]);_0x6427b9['query']=_[_0xebc8('0x4a')](_0x539681[_0xebc8('0x34')]);_0x6427b9[_0xebc8('0x35')]=_[_0xebc8('0x36')](_0x6427b9['model'],_0x6427b9['query']);_0x22d74e[_0xebc8('0x37')]=_[_0xebc8('0x36')](_0x6427b9['model'],qs[_0xebc8('0x38')](_0x539681[_0xebc8('0x34')][_0xebc8('0x38')]));_0x22d74e[_0xebc8('0x37')]=_0x22d74e[_0xebc8('0x37')][_0xebc8('0x39')]?_0x22d74e['attributes']:_0x6427b9[_0xebc8('0x32')];if(_0x539681[_0xebc8('0x34')][_0xebc8('0x44')]){_0x22d74e['include']=[{'all':!![]}];}_0x22d74e=_[_0xebc8('0x41')]({},_0x22d74e,_0x539681[_0xebc8('0x43')]);return db['MailTransferReport'][_0xebc8('0x4b')](_0x22d74e)[_0xebc8('0x27')](handleEntityNotFound(_0x19da95,null))[_0xebc8('0x27')](respondWithResult(_0x19da95,null))[_0xebc8('0x47')](handleError(_0x19da95,null));};exports[_0xebc8('0x4c')]=function(_0x34a74a,_0x3fedd7){return db[_0xebc8('0x2d')]['create'](_0x34a74a[_0xebc8('0x4d')],{})['then'](respondWithResult(_0x3fedd7,0xc9))['catch'](handleError(_0x3fedd7,null));};exports[_0xebc8('0x26')]=function(_0x1d1e55,_0x1c652c){if(_0x1d1e55[_0xebc8('0x4d')]['id']){delete _0x1d1e55['body']['id'];}return db[_0xebc8('0x2d')][_0xebc8('0x4b')]({'where':{'id':_0x1d1e55[_0xebc8('0x49')]['id']}})[_0xebc8('0x27')](handleEntityNotFound(_0x1c652c,null))[_0xebc8('0x27')](saveUpdates(_0x1d1e55['body'],null))['then'](respondWithResult(_0x1c652c,null))[_0xebc8('0x47')](handleError(_0x1c652c,null));};exports[_0xebc8('0x4e')]=function(_0x59ad63,_0x3fabc6){return db[_0xebc8('0x2d')][_0xebc8('0x4b')]({'where':{'id':_0x59ad63[_0xebc8('0x49')]['id']}})[_0xebc8('0x27')](handleEntityNotFound(_0x3fabc6,null))[_0xebc8('0x27')](removeEntity(_0x3fabc6,null))[_0xebc8('0x47')](handleError(_0x3fabc6,null));};exports[_0xebc8('0x4f')]=function(_0xc8267,_0x41b433){return db[_0xebc8('0x2d')][_0xebc8('0x4f')]()['then'](respondWithResult(_0x41b433,null))[_0xebc8('0x47')](handleError(_0x41b433,null));}; \ No newline at end of file +var _0x25a8=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','MailTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','catch','params','describe','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x25a8,0xd2));var _0x825a=function(_0x552871,_0x87cd12){_0x552871=_0x552871-0x0;var _0x5da6eb=_0x25a8[_0x552871];return _0x5da6eb;};'use strict';var emlformat=require(_0x825a('0x0'));var rimraf=require(_0x825a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x825a('0x2'));var moment=require(_0x825a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x825a('0x4'));var util=require(_0x825a('0x5'));var path=require('path');var sox=require(_0x825a('0x6'));var csv=require(_0x825a('0x7'));var ejs=require(_0x825a('0x8'));var fs=require('fs');var fs_extra=require(_0x825a('0x9'));var _=require(_0x825a('0xa'));var squel=require(_0x825a('0xb'));var crypto=require(_0x825a('0xc'));var jsforce=require(_0x825a('0xd'));var deskjs=require(_0x825a('0xe'));var toCsv=require(_0x825a('0x7'));var querystring=require(_0x825a('0xf'));var Papa=require(_0x825a('0x10'));var Redis=require(_0x825a('0x11'));var authService=require(_0x825a('0x12'));var qs=require(_0x825a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x825a('0x14'));var logger=require(_0x825a('0x15'))(_0x825a('0x16'));var utils=require(_0x825a('0x17'));var config=require(_0x825a('0x18'));var licenseUtil=require(_0x825a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2920e5,_0x5472c4){_0x5472c4=_0x5472c4||0xcc;return function(_0x418888){if(_0x418888){return _0x2920e5[_0x825a('0x1a')](_0x5472c4);}return _0x2920e5[_0x825a('0x1b')](_0x5472c4)['end']();};}function respondWithResult(_0x451c7b,_0x3e65b3){_0x3e65b3=_0x3e65b3||0xc8;return function(_0x4c2a82){if(_0x4c2a82){return _0x451c7b[_0x825a('0x1b')](_0x3e65b3)[_0x825a('0x1c')](_0x4c2a82);}};}function respondWithFilteredResult(_0x1e9c6d,_0x49400d){return function(_0x15f7fc){if(_0x15f7fc){var _0x581e48=typeof _0x49400d[_0x825a('0x1d')]===_0x825a('0x1e')&&typeof _0x49400d['limit']===_0x825a('0x1e');var _0x4ad416=_0x15f7fc[_0x825a('0x1f')];var _0x4eca44=_0x581e48?0x0:_0x49400d['offset'];var _0x4fc674=_0x581e48?_0x15f7fc['count']:_0x49400d['offset']+_0x49400d[_0x825a('0x20')];var _0x590603;if(_0x4fc674>=_0x4ad416){_0x4fc674=_0x4ad416;_0x590603=0xc8;}else{_0x590603=0xce;}_0x1e9c6d['status'](_0x590603);return _0x1e9c6d['set'](_0x825a('0x21'),_0x4eca44+'-'+_0x4fc674+'/'+_0x4ad416)['json'](_0x15f7fc);}return null;};}function patchUpdates(_0x1d60ff){return function(_0x204f23){try{jsonpatch[_0x825a('0x22')](_0x204f23,_0x1d60ff,!![]);}catch(_0x31a3b4){return BPromise[_0x825a('0x23')](_0x31a3b4);}return _0x204f23['save']();};}function saveUpdates(_0x49a228,_0x6100dc){return function(_0x1638a7){if(_0x1638a7){return _0x1638a7[_0x825a('0x24')](_0x49a228)[_0x825a('0x25')](function(_0x26a5e6){return _0x26a5e6;});}return null;};}function removeEntity(_0x37db9d,_0x3359e4){return function(_0x57eab0){if(_0x57eab0){return _0x57eab0[_0x825a('0x26')]()[_0x825a('0x25')](function(){_0x37db9d[_0x825a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e444a,_0x280b88){return function(_0x532f6a){if(!_0x532f6a){_0x1e444a[_0x825a('0x1a')](0x194);}return _0x532f6a;};}function handleError(_0x227d5e,_0x400866){_0x400866=_0x400866||0x1f4;return function(_0x472663){logger[_0x825a('0x27')](_0x472663['stack']);if(_0x472663[_0x825a('0x28')]){delete _0x472663[_0x825a('0x28')];}_0x227d5e[_0x825a('0x1b')](_0x400866)[_0x825a('0x29')](_0x472663);};}exports[_0x825a('0x2a')]=function(_0x486c33,_0x3d308b){var _0x50dc60={},_0x314353={},_0xd7d3={'count':0x0,'rows':[]};var _0x410f91=_[_0x825a('0x2b')](db[_0x825a('0x2c')][_0x825a('0x2d')],function(_0x4c95b7){return{'name':_0x4c95b7[_0x825a('0x2e')],'type':_0x4c95b7['type'][_0x825a('0x2f')]};});_0x314353[_0x825a('0x30')]=_[_0x825a('0x2b')](_0x410f91,_0x825a('0x28'));_0x314353[_0x825a('0x31')]=_[_0x825a('0x32')](_0x486c33[_0x825a('0x31')]);_0x314353['filters']=_[_0x825a('0x33')](_0x314353['model'],_0x314353[_0x825a('0x31')]);_0x50dc60[_0x825a('0x34')]=_[_0x825a('0x33')](_0x314353[_0x825a('0x30')],qs[_0x825a('0x35')](_0x486c33[_0x825a('0x31')][_0x825a('0x35')]));_0x50dc60[_0x825a('0x34')]=_0x50dc60[_0x825a('0x34')][_0x825a('0x36')]?_0x50dc60[_0x825a('0x34')]:_0x314353[_0x825a('0x30')];if(!_0x486c33['query'][_0x825a('0x37')](_0x825a('0x38'))){_0x50dc60['limit']=qs[_0x825a('0x20')](_0x486c33[_0x825a('0x31')]['limit']);_0x50dc60[_0x825a('0x1d')]=qs[_0x825a('0x1d')](_0x486c33[_0x825a('0x31')][_0x825a('0x1d')]);}_0x50dc60[_0x825a('0x39')]=qs['sort'](_0x486c33[_0x825a('0x31')][_0x825a('0x3a')]);_0x50dc60['where']=qs[_0x825a('0x3b')](_[_0x825a('0x3c')](_0x486c33[_0x825a('0x31')],_0x314353[_0x825a('0x3b')]),_0x410f91);if(_0x486c33[_0x825a('0x31')][_0x825a('0x3d')]){_0x50dc60['where']=_[_0x825a('0x3e')](_0x50dc60[_0x825a('0x3f')],{'$or':_[_0x825a('0x2b')](_0x410f91,function(_0x404cfc){if(_0x404cfc[_0x825a('0x40')]!==_0x825a('0x41')){var _0x1cc716={};_0x1cc716[_0x404cfc['name']]={'$like':'%'+_0x486c33[_0x825a('0x31')][_0x825a('0x3d')]+'%'};return _0x1cc716;}})});}_0x50dc60=_[_0x825a('0x3e')]({},_0x50dc60,_0x486c33[_0x825a('0x42')]);var _0x5ad93c={'where':_0x50dc60[_0x825a('0x3f')]};return db['MailTransferReport'][_0x825a('0x1f')](_0x5ad93c)['then'](function(_0x33ea92){_0xd7d3[_0x825a('0x1f')]=_0x33ea92;if(_0x486c33[_0x825a('0x31')][_0x825a('0x43')]){_0x50dc60[_0x825a('0x44')]=[{'all':!![]}];}return db[_0x825a('0x2c')][_0x825a('0x45')](_0x50dc60);})[_0x825a('0x25')](function(_0xfc16ab){_0xd7d3[_0x825a('0x46')]=_0xfc16ab;return _0xd7d3;})[_0x825a('0x25')](respondWithFilteredResult(_0x3d308b,_0x50dc60))['catch'](handleError(_0x3d308b,null));};exports[_0x825a('0x47')]=function(_0xd6bc81,_0x5a5150){var _0x4bb228={'raw':!![],'where':{'id':_0xd6bc81['params']['id']}},_0x57e353={};_0x57e353[_0x825a('0x30')]=_[_0x825a('0x32')](db[_0x825a('0x2c')][_0x825a('0x2d')]);_0x57e353[_0x825a('0x31')]=_['keys'](_0xd6bc81[_0x825a('0x31')]);_0x57e353[_0x825a('0x3b')]=_[_0x825a('0x33')](_0x57e353[_0x825a('0x30')],_0x57e353[_0x825a('0x31')]);_0x4bb228['attributes']=_[_0x825a('0x33')](_0x57e353['model'],qs[_0x825a('0x35')](_0xd6bc81[_0x825a('0x31')][_0x825a('0x35')]));_0x4bb228['attributes']=_0x4bb228[_0x825a('0x34')]['length']?_0x4bb228[_0x825a('0x34')]:_0x57e353[_0x825a('0x30')];if(_0xd6bc81[_0x825a('0x31')]['includeAll']){_0x4bb228[_0x825a('0x44')]=[{'all':!![]}];}_0x4bb228=_[_0x825a('0x3e')]({},_0x4bb228,_0xd6bc81['options']);return db[_0x825a('0x2c')][_0x825a('0x48')](_0x4bb228)[_0x825a('0x25')](handleEntityNotFound(_0x5a5150,null))[_0x825a('0x25')](respondWithResult(_0x5a5150,null))['catch'](handleError(_0x5a5150,null));};exports['create']=function(_0x40e5d2,_0x39400d){return db['MailTransferReport'][_0x825a('0x49')](_0x40e5d2['body'],{})['then'](respondWithResult(_0x39400d,0xc9))[_0x825a('0x4a')](handleError(_0x39400d,null));};exports[_0x825a('0x24')]=function(_0x43a7d3,_0x46655d){if(_0x43a7d3['body']['id']){delete _0x43a7d3['body']['id'];}return db[_0x825a('0x2c')][_0x825a('0x48')]({'where':{'id':_0x43a7d3[_0x825a('0x4b')]['id']}})[_0x825a('0x25')](handleEntityNotFound(_0x46655d,null))['then'](saveUpdates(_0x43a7d3['body'],null))[_0x825a('0x25')](respondWithResult(_0x46655d,null))[_0x825a('0x4a')](handleError(_0x46655d,null));};exports[_0x825a('0x26')]=function(_0x41e77c,_0x3125d0){return db['MailTransferReport'][_0x825a('0x48')]({'where':{'id':_0x41e77c['params']['id']}})[_0x825a('0x25')](handleEntityNotFound(_0x3125d0,null))[_0x825a('0x25')](removeEntity(_0x3125d0,null))[_0x825a('0x4a')](handleError(_0x3125d0,null));};exports[_0x825a('0x4c')]=function(_0xf11a15,_0x502d6a){return db[_0x825a('0x2c')]['describe']()[_0x825a('0x25')](respondWithResult(_0x502d6a,null))[_0x825a('0x4a')](handleError(_0x502d6a,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index bc8d30b..ed3481d 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 _0xbbfa=['bluebird','request-promise','path','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x4d4689,_0x3dc0a0){var _0x1f53fc=function(_0x5c5069){while(--_0x5c5069){_0x4d4689['push'](_0x4d4689['shift']());}};_0x1f53fc(++_0x3dc0a0);}(_0xbbfa,0x175));var _0xabbf=function(_0x30584f,_0x4a1f96){_0x30584f=_0x30584f-0x0;var _0x2a31e1=_0xbbfa[_0x30584f];return _0x2a31e1;};'use strict';var _=require(_0xabbf('0x0'));var util=require(_0xabbf('0x1'));var logger=require(_0xabbf('0x2'))('api');var moment=require(_0xabbf('0x3'));var BPromise=require(_0xabbf('0x4'));var rp=require(_0xabbf('0x5'));var fs=require('fs');var path=require(_0xabbf('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xabbf('0x7'));module[_0xabbf('0x8')]=function(_0x15a3b6,_0x1c59e5){return _0x15a3b6[_0xabbf('0x9')](_0xabbf('0xa'),attributes,{'tableName':_0xabbf('0xb'),'paranoid':![],'indexes':[{'name':_0xabbf('0xc'),'fields':[_0xabbf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c79=['path','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','uniqueid','lodash','../../config/logger','api','bluebird'];(function(_0xec0b88,_0xf0122){var _0x50c2ec=function(_0x49cc74){while(--_0x49cc74){_0xec0b88['push'](_0xec0b88['shift']());}};_0x50c2ec(++_0xf0122);}(_0x2c79,0x164));var _0x92c7=function(_0x1f5831,_0x1c83c4){_0x1f5831=_0x1f5831-0x0;var _0x4ecc1a=_0x2c79[_0x1f5831];return _0x4ecc1a;};'use strict';var _=require(_0x92c7('0x0'));var util=require('util');var logger=require(_0x92c7('0x1'))(_0x92c7('0x2'));var moment=require('moment');var BPromise=require(_0x92c7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92c7('0x4'));var rimraf=require('rimraf');var config=require(_0x92c7('0x5'));var attributes=require(_0x92c7('0x6'));module['exports']=function(_0x42a70d,_0x4d2d3a){return _0x42a70d[_0x92c7('0x7')](_0x92c7('0x8'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x92c7('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 60942a8..c7c3997 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 _0xcf39=['../../config/environment','jayson/promise','client','http','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../config/utils','rpc'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0xcf39,0x112));var _0x9cf3=function(_0x1e203a,_0x397111){_0x1e203a=_0x1e203a-0x0;var _0x2a5006=_0xcf39[_0x1e203a];return _0x2a5006;};'use strict';var _=require('lodash');var util=require(_0x9cf3('0x0'));var moment=require(_0x9cf3('0x1'));var BPromise=require(_0x9cf3('0x2'));var rs=require(_0x9cf3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9cf3('0x4'));var logger=require('../../config/logger')(_0x9cf3('0x5'));var config=require(_0x9cf3('0x6'));var jayson=require(_0x9cf3('0x7'));var client=jayson[_0x9cf3('0x8')][_0x9cf3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x217dc4,_0x4dfe37,_0xd34015){return new BPromise(function(_0x3c1c5c,_0x2d2f13){return client['request'](_0x217dc4,_0xd34015)['then'](function(_0x29e51f){logger[_0x9cf3('0xa')](_0x9cf3('0xb'),_0x4dfe37,_0x9cf3('0xc'));logger[_0x9cf3('0xd')](_0x9cf3('0xe'),_0x4dfe37,_0x9cf3('0xc'),JSON[_0x9cf3('0xf')](_0x29e51f));if(_0x29e51f[_0x9cf3('0x10')]){if(_0x29e51f['error'][_0x9cf3('0x11')]===0x1f4){logger['error'](_0x9cf3('0xb'),_0x4dfe37,_0x29e51f[_0x9cf3('0x10')]['message']);return _0x2d2f13(_0x29e51f['error']['message']);}logger[_0x9cf3('0x10')](_0x9cf3('0xb'),_0x4dfe37,_0x29e51f[_0x9cf3('0x10')]['message']);return _0x3c1c5c(_0x29e51f[_0x9cf3('0x10')][_0x9cf3('0x12')]);}else{logger['info'](_0x9cf3('0xb'),_0x4dfe37,_0x9cf3('0xc'));_0x3c1c5c(_0x29e51f[_0x9cf3('0x13')][_0x9cf3('0x12')]);}})['catch'](function(_0x3cfd50){logger[_0x9cf3('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x4dfe37,_0x3cfd50);_0x2d2f13(_0x3cfd50);});});} \ No newline at end of file +var _0x05bd=['MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2d3721,_0x2f6bc8){var _0x15c85f=function(_0x4ed791){while(--_0x4ed791){_0x2d3721['push'](_0x2d3721['shift']());}};_0x15c85f(++_0x2f6bc8);}(_0x05bd,0x103));var _0xd05b=function(_0x2a9e6f,_0x216211){_0x2a9e6f=_0x2a9e6f-0x0;var _0x1159d1=_0x05bd[_0x2a9e6f];return _0x1159d1;};'use strict';var _=require('lodash');var util=require(_0xd05b('0x0'));var moment=require(_0xd05b('0x1'));var BPromise=require(_0xd05b('0x2'));var rs=require(_0xd05b('0x3'));var fs=require('fs');var Redis=require(_0xd05b('0x4'));var db=require(_0xd05b('0x5'))['db'];var utils=require(_0xd05b('0x6'));var logger=require(_0xd05b('0x7'))(_0xd05b('0x8'));var config=require(_0xd05b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd05b('0xa')][_0xd05b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32d301,_0x2c46db,_0x6ef7ac){return new BPromise(function(_0x194c46,_0xea6589){return client['request'](_0x32d301,_0x6ef7ac)[_0xd05b('0xc')](function(_0x39df3b){logger[_0xd05b('0xd')](_0xd05b('0xe'),_0x2c46db,_0xd05b('0xf'));logger[_0xd05b('0x10')](_0xd05b('0x11'),_0x2c46db,_0xd05b('0xf'),JSON[_0xd05b('0x12')](_0x39df3b));if(_0x39df3b['error']){if(_0x39df3b[_0xd05b('0x13')][_0xd05b('0x14')]===0x1f4){logger[_0xd05b('0x13')](_0xd05b('0xe'),_0x2c46db,_0x39df3b['error']['message']);return _0xea6589(_0x39df3b[_0xd05b('0x13')][_0xd05b('0x15')]);}logger[_0xd05b('0x13')](_0xd05b('0xe'),_0x2c46db,_0x39df3b[_0xd05b('0x13')][_0xd05b('0x15')]);return _0x194c46(_0x39df3b['error'][_0xd05b('0x15')]);}else{logger[_0xd05b('0xd')](_0xd05b('0xe'),_0x2c46db,_0xd05b('0xf'));_0x194c46(_0x39df3b[_0xd05b('0x16')][_0xd05b('0x15')]);}})['catch'](function(_0x131481){logger[_0xd05b('0x13')](_0xd05b('0xe'),_0x2c46db,_0x131481);_0xea6589(_0x131481);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 4618853..648497a 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 _0x62c4=['describe','/:id','isAuthenticated','put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./memberReport.controller','get','/describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x62c4,0x6e));var _0x462c=function(_0x358b4f,_0x260d31){_0x358b4f=_0x358b4f-0x0;var _0x37d84d=_0x62c4[_0x358b4f];return _0x37d84d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x462c('0x0'));var timeout=require('connect-timeout');var express=require(_0x462c('0x1'));var router=express[_0x462c('0x2')]();var fs_extra=require(_0x462c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x462c('0x4'));var config=require(_0x462c('0x5'));var controller=require(_0x462c('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x462c('0x7')](_0x462c('0x8'),auth['isAuthenticated'](),controller[_0x462c('0x9')]);router[_0x462c('0x7')](_0x462c('0xa'),auth[_0x462c('0xb')](),controller['show']);router['post']('/',auth[_0x462c('0xb')](),controller['create']);router[_0x462c('0xc')](_0x462c('0xa'),auth[_0x462c('0xb')](),controller[_0x462c('0xd')]);router[_0x462c('0xe')](_0x462c('0xa'),auth[_0x462c('0xb')](),controller[_0x462c('0xf')]);module[_0x462c('0x10')]=router; \ No newline at end of file +var _0xe5f2=['../../components/auth/service','./memberReport.controller','get','isAuthenticated','index','describe','show','post','put','/:id','destroy','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0xfbe3a0,_0x5ee7eb){var _0x2ff665=function(_0x471c4b){while(--_0x471c4b){_0xfbe3a0['push'](_0xfbe3a0['shift']());}};_0x2ff665(++_0x5ee7eb);}(_0xe5f2,0xd8));var _0x2e5f=function(_0x2f96fb,_0x2f7b5b){_0x2f96fb=_0x2f96fb-0x0;var _0x584ecf=_0xe5f2[_0x2f96fb];return _0x584ecf;};'use strict';var multer=require(_0x2e5f('0x0'));var util=require(_0x2e5f('0x1'));var path=require('path');var timeout=require(_0x2e5f('0x2'));var express=require(_0x2e5f('0x3'));var router=express['Router']();var fs_extra=require(_0x2e5f('0x4'));var auth=require(_0x2e5f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2e5f('0x6'));router[_0x2e5f('0x7')]('/',auth[_0x2e5f('0x8')](),controller[_0x2e5f('0x9')]);router[_0x2e5f('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x2e5f('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2e5f('0xb')]);router[_0x2e5f('0xc')]('/',auth[_0x2e5f('0x8')](),controller['create']);router[_0x2e5f('0xd')](_0x2e5f('0xe'),auth[_0x2e5f('0x8')](),controller['update']);router['delete'](_0x2e5f('0xe'),auth[_0x2e5f('0x8')](),controller[_0x2e5f('0xf')]);module[_0x2e5f('0x10')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index bcd4206..069e612 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 _0x2746=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','exports','STRING','DEFAULT\x20PAUSE','DATE','getDataValue','enterAt','diff','setDataValue'];(function(_0x47bc5e,_0x6fc500){var _0x323a59=function(_0x32df89){while(--_0x32df89){_0x47bc5e['push'](_0x47bc5e['shift']());}};_0x323a59(++_0x6fc500);}(_0x2746,0x19c));var _0x6274=function(_0x71ceb8,_0x38c724){_0x71ceb8=_0x71ceb8-0x0;var _0x26c2a1=_0x2746[_0x71ceb8];return _0x26c2a1;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x6274('0x0')]={'channel':{'type':Sequelize[_0x6274('0x1')]},'membername':{'type':Sequelize[_0x6274('0x1')]},'interface':{'type':Sequelize[_0x6274('0x1')]},'type':{'type':Sequelize[_0x6274('0x1')],'defaultValue':_0x6274('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x6274('0x3')]},'exitAt':{'type':Sequelize[_0x6274('0x3')],'set':function(_0x1978ff){var _0x534aee=moment(_0x1978ff);var _0x1d22fb=moment(this[_0x6274('0x4')](_0x6274('0x5')));var _0x3158f6=_0x534aee[_0x6274('0x6')](_0x1d22fb,'seconds');this[_0x6274('0x7')]('exitAt',_0x1978ff);this[_0x6274('0x7')](_0x6274('0x8'),_0x3158f6||null);}},'data1':{'type':Sequelize[_0x6274('0x1')],'comment':_0x6274('0x9')},'data2':{'type':Sequelize[_0x6274('0x1')],'comment':_0x6274('0xa')},'data3':{'type':Sequelize[_0x6274('0x1')],'comment':_0x6274('0xb')},'data4':{'type':Sequelize[_0x6274('0x1')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x6274('0x1')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x6274('0x1')]}}; \ No newline at end of file +var _0x3036=['diff','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[queue]','INTEGER','exports','STRING','DATE','enterAt'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3036,0x1a9));var _0x6303=function(_0x1d73cc,_0x50a0b5){_0x1d73cc=_0x1d73cc-0x0;var _0x33a3ae=_0x3036[_0x1d73cc];return _0x33a3ae;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x6303('0x0')]={'channel':{'type':Sequelize[_0x6303('0x1')]},'membername':{'type':Sequelize[_0x6303('0x1')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6303('0x1')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x6303('0x2')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x464b99){var _0xaa32ef=moment(_0x464b99);var _0x25a0ce=moment(this['getDataValue'](_0x6303('0x3')));var _0x420da8=_0xaa32ef[_0x6303('0x4')](_0x25a0ce,_0x6303('0x5'));this[_0x6303('0x6')](_0x6303('0x7'),_0x464b99);this[_0x6303('0x6')](_0x6303('0x8'),_0x420da8||null);}},'data1':{'type':Sequelize[_0x6303('0x1')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x6303('0x1')],'comment':_0x6303('0x9')},'data3':{'type':Sequelize[_0x6303('0x1')],'comment':_0x6303('0xa')},'data4':{'type':Sequelize[_0x6303('0x1')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x6303('0x1')],'comment':_0x6303('0xb')},'role':{'type':Sequelize[_0x6303('0x1')]},'internal':{'type':Sequelize[_0x6303('0xc')]},'uniqueid':{'type':Sequelize[_0x6303('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 860a9ea..5df4f66 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 _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(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xedd9,0xfc));var _0x9edd=function(_0xbcd9be,_0x395408){_0xbcd9be=_0xbcd9be-0x0;var _0x37dd20=_0xedd9[_0xbcd9be];return _0x37dd20;};'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 +var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0xe3fb68,_0x357e5b){var _0x1ba0a3=function(_0x3c3c79){while(--_0x3c3c79){_0xe3fb68['push'](_0xe3fb68['shift']());}};_0x1ba0a3(++_0x357e5b);}(_0x3e74,0x175));var _0x43e7=function(_0x1b94d2,_0x3a84bc){_0x1b94d2=_0x1b94d2-0x0;var _0x44f357=_0x3e74[_0x1b94d2];return _0x44f357;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 1230b43..240edc4 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 _0x525d=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','interface','lodash','util'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x525d,0x15c));var _0xd525=function(_0x29521c,_0x3a9408){_0x29521c=_0x29521c-0x0;var _0x662147=_0x525d[_0x29521c];return _0x662147;};'use strict';var _=require(_0xd525('0x0'));var util=require(_0xd525('0x1'));var logger=require(_0xd525('0x2'))(_0xd525('0x3'));var moment=require(_0xd525('0x4'));var BPromise=require(_0xd525('0x5'));var rp=require(_0xd525('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd525('0x7'));var attributes=require(_0xd525('0x8'));module[_0xd525('0x9')]=function(_0x546f4a,_0x16f88b){return _0x546f4a['define'](_0xd525('0xa'),attributes,{'tableName':_0xd525('0xb'),'paranoid':![],'indexes':[{'name':_0xd525('0xc'),'fields':['membername',_0xd525('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5418=['./memberReport.attributes','define','MemberReport','membername_interface','membername','interface','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x594c6d,_0x4d984f){var _0x522757=function(_0x4ec408){while(--_0x4ec408){_0x594c6d['push'](_0x594c6d['shift']());}};_0x522757(++_0x4d984f);}(_0x5418,0x7e));var _0x8541=function(_0x15ba03,_0x18bcc6){_0x15ba03=_0x15ba03-0x0;var _0x51da14=_0x5418[_0x15ba03];return _0x51da14;};'use strict';var _=require(_0x8541('0x0'));var util=require(_0x8541('0x1'));var logger=require(_0x8541('0x2'))('api');var moment=require(_0x8541('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8541('0x4'));var rimraf=require(_0x8541('0x5'));var config=require('../../config/environment');var attributes=require(_0x8541('0x6'));module['exports']=function(_0x352d7d,_0x5382a5){return _0x352d7d[_0x8541('0x7')](_0x8541('0x8'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x8541('0x9'),'fields':[_0x8541('0xa'),_0x8541('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 9abae55..f58f80e 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 _0xfe91=['stringify','error','code','message','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','then','CreateMemberReport','create','body','update','UpdateMemberReport','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0xfe91,0xd4));var _0x1fe9=function(_0x57d370,_0x3ed0f6){_0x57d370=_0x57d370-0x0;var _0x550fd2=_0xfe91[_0x57d370];return _0x550fd2;};'use strict';var _=require(_0x1fe9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1fe9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fe9('0x2'));var db=require(_0x1fe9('0x3'))['db'];var utils=require(_0x1fe9('0x4'));var logger=require(_0x1fe9('0x5'))(_0x1fe9('0x6'));var config=require(_0x1fe9('0x7'));var jayson=require(_0x1fe9('0x8'));var client=jayson['client'][_0x1fe9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a7f10,_0x92b169,_0x548aeb){return new BPromise(function(_0x5a8fdd,_0x3a7562){return client[_0x1fe9('0xa')](_0x2a7f10,_0x548aeb)['then'](function(_0x1fd0fe){logger[_0x1fe9('0xb')](_0x1fe9('0xc'),_0x92b169,_0x1fe9('0xd'));logger[_0x1fe9('0xe')](_0x1fe9('0xf'),_0x92b169,_0x1fe9('0xd'),JSON[_0x1fe9('0x10')](_0x1fd0fe));if(_0x1fd0fe['error']){if(_0x1fd0fe[_0x1fe9('0x11')][_0x1fe9('0x12')]===0x1f4){logger['error'](_0x1fe9('0xc'),_0x92b169,_0x1fd0fe[_0x1fe9('0x11')][_0x1fe9('0x13')]);return _0x3a7562(_0x1fd0fe[_0x1fe9('0x11')][_0x1fe9('0x13')]);}logger['error'](_0x1fe9('0xc'),_0x92b169,_0x1fd0fe[_0x1fe9('0x11')][_0x1fe9('0x13')]);return _0x5a8fdd(_0x1fd0fe[_0x1fe9('0x11')]['message']);}else{logger[_0x1fe9('0xb')](_0x1fe9('0xc'),_0x92b169,_0x1fe9('0xd'));_0x5a8fdd(_0x1fd0fe['result'][_0x1fe9('0x13')]);}})[_0x1fe9('0x14')](function(_0x827331){logger['error'](_0x1fe9('0xc'),_0x92b169,_0x827331);_0x3a7562(_0x827331);});});}exports[_0x1fe9('0x15')]=function(_0x2085ac){var _0x4cd11f=this;return new Promise(function(_0x2070a3,_0x4c7cc9){return db[_0x1fe9('0x16')][_0x1fe9('0x17')]({'raw':_0x2085ac['options']?_0x2085ac[_0x1fe9('0x18')][_0x1fe9('0x19')]===undefined?!![]:![]:!![],'where':_0x2085ac[_0x1fe9('0x18')]?_0x2085ac[_0x1fe9('0x18')][_0x1fe9('0x1a')]||null:null,'attributes':_0x2085ac[_0x1fe9('0x18')]?_0x2085ac['options'][_0x1fe9('0x1b')]||null:null,'limit':_0x2085ac['options']?_0x2085ac['options'][_0x1fe9('0x1c')]||null:null,'include':_0x2085ac[_0x1fe9('0x18')]?_0x2085ac[_0x1fe9('0x18')][_0x1fe9('0x1d')]?_[_0x1fe9('0x1e')](_0x2085ac[_0x1fe9('0x18')]['include'],function(_0x18afe2){return{'model':db[_0x18afe2[_0x1fe9('0x1f')]],'as':_0x18afe2['as'],'attributes':_0x18afe2['attributes'],'include':_0x18afe2[_0x1fe9('0x1d')]?_[_0x1fe9('0x1e')](_0x18afe2['include'],function(_0x2e492f){return{'model':db[_0x2e492f[_0x1fe9('0x1f')]],'as':_0x2e492f['as'],'attributes':_0x2e492f['attributes'],'include':_0x2e492f[_0x1fe9('0x1d')]?_[_0x1fe9('0x1e')](_0x2e492f['include'],function(_0x297c4b){return{'model':db[_0x297c4b[_0x1fe9('0x1f')]],'as':_0x297c4b['as'],'attributes':_0x297c4b[_0x1fe9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1fe9('0x20')](function(_0x36b7f4){logger[_0x1fe9('0xb')](_0x1fe9('0x15'),_0x2085ac);logger[_0x1fe9('0xe')](_0x1fe9('0x15'),_0x2085ac,JSON[_0x1fe9('0x10')](_0x36b7f4));_0x2070a3(_0x36b7f4);})[_0x1fe9('0x14')](function(_0x11f374){logger[_0x1fe9('0x11')]('GetMemberReport',_0x11f374[_0x1fe9('0x13')],_0x2085ac);_0x4c7cc9(_0x4cd11f[_0x1fe9('0x11')](0x1f4,_0x11f374[_0x1fe9('0x13')]));});});};exports[_0x1fe9('0x21')]=function(_0x216ed4){var _0x43331c=this;return new Promise(function(_0x4865f9,_0x3f1439){return db['MemberReport'][_0x1fe9('0x22')](_0x216ed4[_0x1fe9('0x23')],{'raw':_0x216ed4[_0x1fe9('0x18')]?_0x216ed4[_0x1fe9('0x18')][_0x1fe9('0x19')]===undefined?!![]:![]:!![]})[_0x1fe9('0x20')](function(_0x40f53d){logger[_0x1fe9('0xb')](_0x1fe9('0x21'),_0x216ed4);logger['debug'](_0x1fe9('0x21'),_0x216ed4,JSON[_0x1fe9('0x10')](_0x40f53d));_0x4865f9(_0x40f53d);})['catch'](function(_0x37fda5){logger[_0x1fe9('0x11')](_0x1fe9('0x21'),_0x37fda5[_0x1fe9('0x13')],_0x216ed4);_0x3f1439(_0x43331c[_0x1fe9('0x11')](0x1f4,_0x37fda5[_0x1fe9('0x13')]));});});};exports['UpdateMemberReport']=function(_0x5ba591){var _0xd6c911=this;return new Promise(function(_0x4e9e97,_0x4b14cd){return db[_0x1fe9('0x16')][_0x1fe9('0x24')](_0x5ba591[_0x1fe9('0x23')],{'raw':_0x5ba591[_0x1fe9('0x18')]?_0x5ba591['options'][_0x1fe9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ba591['options']?_0x5ba591[_0x1fe9('0x18')][_0x1fe9('0x1a')]||null:null,'attributes':_0x5ba591['options']?_0x5ba591[_0x1fe9('0x18')]['attributes']||null:null,'limit':_0x5ba591[_0x1fe9('0x18')]?_0x5ba591[_0x1fe9('0x18')][_0x1fe9('0x1c')]||null:null})['then'](function(_0x166908){logger[_0x1fe9('0xb')](_0x1fe9('0x25'),_0x5ba591);logger['debug'](_0x1fe9('0x25'),_0x5ba591,JSON[_0x1fe9('0x10')](_0x166908));_0x4e9e97(_0x166908);})['catch'](function(_0x782f5b){logger[_0x1fe9('0x11')](_0x1fe9('0x25'),_0x782f5b[_0x1fe9('0x13')],_0x5ba591);_0x4b14cd(_0xd6c911[_0x1fe9('0x11')](0x1f4,_0x782f5b['message']));});});}; \ No newline at end of file +var _0xbf4e=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','map','include','model','CreateMemberReport','create','body','UpdateMemberReport'];(function(_0xa6e935,_0x3d456d){var _0x876264=function(_0x4622d1){while(--_0x4622d1){_0xa6e935['push'](_0xa6e935['shift']());}};_0x876264(++_0x3d456d);}(_0xbf4e,0x172));var _0xebf4=function(_0x3576c7,_0x13e9bf){_0x3576c7=_0x3576c7-0x0;var _0x12cbf0=_0xbf4e[_0x3576c7];return _0x12cbf0;};'use strict';var _=require(_0xebf4('0x0'));var util=require(_0xebf4('0x1'));var moment=require(_0xebf4('0x2'));var BPromise=require(_0xebf4('0x3'));var rs=require(_0xebf4('0x4'));var fs=require('fs');var Redis=require(_0xebf4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xebf4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xebf4('0x7'));var jayson=require(_0xebf4('0x8'));var client=jayson['client'][_0xebf4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x995254,_0x33ff2b,_0x48764f){return new BPromise(function(_0x2f17c0,_0xcfaf52){return client[_0xebf4('0xa')](_0x995254,_0x48764f)[_0xebf4('0xb')](function(_0x50df01){logger[_0xebf4('0xc')](_0xebf4('0xd'),_0x33ff2b,_0xebf4('0xe'));logger[_0xebf4('0xf')](_0xebf4('0x10'),_0x33ff2b,_0xebf4('0xe'),JSON[_0xebf4('0x11')](_0x50df01));if(_0x50df01[_0xebf4('0x12')]){if(_0x50df01[_0xebf4('0x12')]['code']===0x1f4){logger[_0xebf4('0x12')](_0xebf4('0xd'),_0x33ff2b,_0x50df01[_0xebf4('0x12')]['message']);return _0xcfaf52(_0x50df01['error'][_0xebf4('0x13')]);}logger[_0xebf4('0x12')](_0xebf4('0xd'),_0x33ff2b,_0x50df01[_0xebf4('0x12')][_0xebf4('0x13')]);return _0x2f17c0(_0x50df01[_0xebf4('0x12')][_0xebf4('0x13')]);}else{logger[_0xebf4('0xc')](_0xebf4('0xd'),_0x33ff2b,_0xebf4('0xe'));_0x2f17c0(_0x50df01[_0xebf4('0x14')][_0xebf4('0x13')]);}})[_0xebf4('0x15')](function(_0x2b0259){logger[_0xebf4('0x12')](_0xebf4('0xd'),_0x33ff2b,_0x2b0259);_0xcfaf52(_0x2b0259);});});}exports[_0xebf4('0x16')]=function(_0x4e83a8){var _0x5e1b61=this;return new Promise(function(_0x5db628,_0x4256a3){return db[_0xebf4('0x17')][_0xebf4('0x18')]({'raw':_0x4e83a8[_0xebf4('0x19')]?_0x4e83a8[_0xebf4('0x19')][_0xebf4('0x1a')]===undefined?!![]:![]:!![],'where':_0x4e83a8[_0xebf4('0x19')]?_0x4e83a8[_0xebf4('0x19')][_0xebf4('0x1b')]||null:null,'attributes':_0x4e83a8['options']?_0x4e83a8[_0xebf4('0x19')][_0xebf4('0x1c')]||null:null,'limit':_0x4e83a8[_0xebf4('0x19')]?_0x4e83a8[_0xebf4('0x19')][_0xebf4('0x1d')]||null:null,'include':_0x4e83a8[_0xebf4('0x19')]?_0x4e83a8[_0xebf4('0x19')]['include']?_[_0xebf4('0x1e')](_0x4e83a8[_0xebf4('0x19')]['include'],function(_0x526034){return{'model':db[_0x526034['model']],'as':_0x526034['as'],'attributes':_0x526034['attributes'],'include':_0x526034[_0xebf4('0x1f')]?_[_0xebf4('0x1e')](_0x526034[_0xebf4('0x1f')],function(_0x31c070){return{'model':db[_0x31c070[_0xebf4('0x20')]],'as':_0x31c070['as'],'attributes':_0x31c070[_0xebf4('0x1c')],'include':_0x31c070[_0xebf4('0x1f')]?_[_0xebf4('0x1e')](_0x31c070['include'],function(_0x19527e){return{'model':db[_0x19527e['model']],'as':_0x19527e['as'],'attributes':_0x19527e[_0xebf4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xebf4('0xb')](function(_0x534272){logger[_0xebf4('0xc')](_0xebf4('0x16'),_0x4e83a8);logger['debug'](_0xebf4('0x16'),_0x4e83a8,JSON['stringify'](_0x534272));_0x5db628(_0x534272);})[_0xebf4('0x15')](function(_0x3632c9){logger['error'](_0xebf4('0x16'),_0x3632c9['message'],_0x4e83a8);_0x4256a3(_0x5e1b61['error'](0x1f4,_0x3632c9['message']));});});};exports[_0xebf4('0x21')]=function(_0x329804){var _0x4a3b36=this;return new Promise(function(_0x416b66,_0x24f35a){return db['MemberReport'][_0xebf4('0x22')](_0x329804[_0xebf4('0x23')],{'raw':_0x329804[_0xebf4('0x19')]?_0x329804[_0xebf4('0x19')][_0xebf4('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1580ea){logger[_0xebf4('0xc')](_0xebf4('0x21'),_0x329804);logger[_0xebf4('0xf')](_0xebf4('0x21'),_0x329804,JSON[_0xebf4('0x11')](_0x1580ea));_0x416b66(_0x1580ea);})[_0xebf4('0x15')](function(_0x1e253d){logger['error'](_0xebf4('0x21'),_0x1e253d[_0xebf4('0x13')],_0x329804);_0x24f35a(_0x4a3b36[_0xebf4('0x12')](0x1f4,_0x1e253d[_0xebf4('0x13')]));});});};exports['UpdateMemberReport']=function(_0x4b2a98){var _0x2e84e1=this;return new Promise(function(_0x8bd741,_0xd982a0){return db['MemberReport']['update'](_0x4b2a98[_0xebf4('0x23')],{'raw':_0x4b2a98[_0xebf4('0x19')]?_0x4b2a98['options'][_0xebf4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b2a98['options']?_0x4b2a98[_0xebf4('0x19')][_0xebf4('0x1b')]||null:null,'attributes':_0x4b2a98[_0xebf4('0x19')]?_0x4b2a98['options'][_0xebf4('0x1c')]||null:null,'limit':_0x4b2a98['options']?_0x4b2a98[_0xebf4('0x19')][_0xebf4('0x1d')]||null:null})[_0xebf4('0xb')](function(_0xf6da9a){logger[_0xebf4('0xc')](_0xebf4('0x24'),_0x4b2a98);logger[_0xebf4('0xf')](_0xebf4('0x24'),_0x4b2a98,JSON[_0xebf4('0x11')](_0xf6da9a));_0x8bd741(_0xf6da9a);})['catch'](function(_0x5b8d85){logger[_0xebf4('0x12')](_0xebf4('0x24'),_0x5b8d85[_0xebf4('0x13')],_0x4b2a98);_0xd982a0(_0x2e84e1['error'](0x1f4,_0x5b8d85[_0xebf4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 81c35f9..b465085 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 _0x3fa4=['multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','exports'];(function(_0x2f3f6f,_0x501a1d){var _0x186bd8=function(_0x26b86c){while(--_0x26b86c){_0x2f3f6f['push'](_0x2f3f6f['shift']());}};_0x186bd8(++_0x501a1d);}(_0x3fa4,0xf0));var _0x43fa=function(_0x4a11ae,_0x32abad){_0x4a11ae=_0x4a11ae-0x0;var _0x97474f=_0x3fa4[_0x4a11ae];return _0x97474f;};'use strict';var multer=require(_0x43fa('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x43fa('0x1'));var router=express[_0x43fa('0x2')]();var fs_extra=require(_0x43fa('0x3'));var auth=require(_0x43fa('0x4'));var interaction=require(_0x43fa('0x5'));var config=require(_0x43fa('0x6'));var controller=require(_0x43fa('0x7'));router['get']('/',controller[_0x43fa('0x8')]);module[_0x43fa('0x9')]=router; \ No newline at end of file +var _0xf749=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./migration.controller','get','index','exports'];(function(_0x364d75,_0x4721f0){var _0x198ad7=function(_0x3cc0fd){while(--_0x3cc0fd){_0x364d75['push'](_0x364d75['shift']());}};_0x198ad7(++_0x4721f0);}(_0xf749,0x155));var _0x9f74=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xf749[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x9f74('0x0'));var util=require(_0x9f74('0x1'));var path=require(_0x9f74('0x2'));var timeout=require(_0x9f74('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9f74('0x4'));var auth=require(_0x9f74('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9f74('0x6'));var controller=require(_0x9f74('0x7'));router[_0x9f74('0x8')]('/',controller[_0x9f74('0x9')]);module[_0x9f74('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 3304703..9c96314 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 _0x14c9=['exports','STRING','version'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x14c9,0x1b6));var _0x914c=function(_0x21d9ba,_0x236b71){_0x21d9ba=_0x21d9ba-0x0;var _0x23a8db=_0x14c9[_0x21d9ba];return _0x23a8db;};'use strict';var Sequelize=require('sequelize');module[_0x914c('0x0')]={'version':{'type':Sequelize[_0x914c('0x1')],'unique':_0x914c('0x2')}}; \ No newline at end of file +var _0x4fe5=['STRING','version','sequelize'];(function(_0x1ae268,_0x39a618){var _0x473d71=function(_0x327bbb){while(--_0x327bbb){_0x1ae268['push'](_0x1ae268['shift']());}};_0x473d71(++_0x39a618);}(_0x4fe5,0x113));var _0x54fe=function(_0x68c817,_0x475417){_0x68c817=_0x68c817-0x0;var _0x436ff8=_0x4fe5[_0x68c817];return _0x436ff8;};'use strict';var Sequelize=require(_0x54fe('0x0'));module['exports']={'version':{'type':Sequelize[_0x54fe('0x1')],'unique':_0x54fe('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index d0b2752..47e930a 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 _0xeccb=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','then','end','sendStatus','error','stack','name','send','index','map','Migration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x195d70,_0xed56eb){var _0x50fc01=function(_0x273291){while(--_0x273291){_0x195d70['push'](_0x195d70['shift']());}};_0x50fc01(++_0xed56eb);}(_0xeccb,0x76));var _0xbecc=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xeccb[_0x2cfb58];return _0xd99951;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbecc('0x0'));var zipdir=require(_0xbecc('0x1'));var jsonpatch=require(_0xbecc('0x2'));var rp=require(_0xbecc('0x3'));var moment=require(_0xbecc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbecc('0x5'));var util=require(_0xbecc('0x6'));var path=require(_0xbecc('0x7'));var sox=require(_0xbecc('0x8'));var csv=require(_0xbecc('0x9'));var ejs=require(_0xbecc('0xa'));var fs=require('fs');var fs_extra=require(_0xbecc('0xb'));var _=require(_0xbecc('0xc'));var squel=require(_0xbecc('0xd'));var crypto=require(_0xbecc('0xe'));var jsforce=require(_0xbecc('0xf'));var deskjs=require(_0xbecc('0x10'));var toCsv=require(_0xbecc('0x9'));var querystring=require(_0xbecc('0x11'));var Papa=require('papaparse');var Redis=require(_0xbecc('0x12'));var authService=require(_0xbecc('0x13'));var qs=require(_0xbecc('0x14'));var as=require(_0xbecc('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbecc('0x16'))('api');var utils=require(_0xbecc('0x17'));var config=require(_0xbecc('0x18'));var licenseUtil=require(_0xbecc('0x19'));var db=require(_0xbecc('0x1a'))['db'];function respondWithStatusCode(_0x245be5,_0x276a65){_0x276a65=_0x276a65||0xcc;return function(_0x2246a0){if(_0x2246a0){return _0x245be5['sendStatus'](_0x276a65);}return _0x245be5['status'](_0x276a65)['end']();};}function respondWithResult(_0x4d77e6,_0x3eea8f){_0x3eea8f=_0x3eea8f||0xc8;return function(_0x73eecf){if(_0x73eecf){return _0x4d77e6[_0xbecc('0x1b')](_0x3eea8f)[_0xbecc('0x1c')](_0x73eecf);}};}function respondWithFilteredResult(_0x3a85fa,_0x1fc6b8){return function(_0x149201){if(_0x149201){var _0x5a10e9=typeof _0x1fc6b8['offset']===_0xbecc('0x1d')&&typeof _0x1fc6b8[_0xbecc('0x1e')]===_0xbecc('0x1d');var _0x56c01d=_0x149201[_0xbecc('0x1f')];var _0x34ccea=_0x5a10e9?0x0:_0x1fc6b8[_0xbecc('0x20')];var _0x47e3a0=_0x5a10e9?_0x149201[_0xbecc('0x1f')]:_0x1fc6b8[_0xbecc('0x20')]+_0x1fc6b8['limit'];var _0x4cf0be;if(_0x47e3a0>=_0x56c01d){_0x47e3a0=_0x56c01d;_0x4cf0be=0xc8;}else{_0x4cf0be=0xce;}_0x3a85fa[_0xbecc('0x1b')](_0x4cf0be);return _0x3a85fa[_0xbecc('0x21')]('Content-Range',_0x34ccea+'-'+_0x47e3a0+'/'+_0x56c01d)['json'](_0x149201);}return null;};}function patchUpdates(_0x5d457c){return function(_0x40e89e){try{jsonpatch[_0xbecc('0x22')](_0x40e89e,_0x5d457c,!![]);}catch(_0xfec0d3){return BPromise[_0xbecc('0x23')](_0xfec0d3);}return _0x40e89e['save']();};}function saveUpdates(_0xca3f0,_0x4ae385){return function(_0x3f7acd){if(_0x3f7acd){return _0x3f7acd['update'](_0xca3f0)[_0xbecc('0x24')](function(_0x48879e){return _0x48879e;});}return null;};}function removeEntity(_0x3d4e9e,_0x1e9729){return function(_0x215a46){if(_0x215a46){return _0x215a46['destroy']()['then'](function(){_0x3d4e9e[_0xbecc('0x1b')](0xcc)[_0xbecc('0x25')]();});}};}function handleEntityNotFound(_0x1853df,_0xfdcf34){return function(_0x361c74){if(!_0x361c74){_0x1853df[_0xbecc('0x26')](0x194);}return _0x361c74;};}function handleError(_0x29e444,_0x4294b5){_0x4294b5=_0x4294b5||0x1f4;return function(_0x5bdc9a){logger[_0xbecc('0x27')](_0x5bdc9a[_0xbecc('0x28')]);if(_0x5bdc9a['name']){delete _0x5bdc9a[_0xbecc('0x29')];}_0x29e444[_0xbecc('0x1b')](_0x4294b5)[_0xbecc('0x2a')](_0x5bdc9a);};}exports[_0xbecc('0x2b')]=function(_0x31b453,_0x2bf4c7){var _0x505fda={},_0x1a40aa={},_0x4c62eb={'count':0x0,'rows':[]};var _0x1ce335=_[_0xbecc('0x2c')](db[_0xbecc('0x2d')][_0xbecc('0x2e')],function(_0x1f4ac5){return{'name':_0x1f4ac5['fieldName'],'type':_0x1f4ac5[_0xbecc('0x2f')][_0xbecc('0x30')]};});_0x1a40aa[_0xbecc('0x31')]=_[_0xbecc('0x2c')](_0x1ce335,_0xbecc('0x29'));_0x1a40aa[_0xbecc('0x32')]=_['keys'](_0x31b453[_0xbecc('0x32')]);_0x1a40aa[_0xbecc('0x33')]=_[_0xbecc('0x34')](_0x1a40aa['model'],_0x1a40aa['query']);_0x505fda[_0xbecc('0x35')]=_['intersection'](_0x1a40aa[_0xbecc('0x31')],qs[_0xbecc('0x36')](_0x31b453['query'][_0xbecc('0x36')]));_0x505fda['attributes']=_0x505fda['attributes']['length']?_0x505fda['attributes']:_0x1a40aa[_0xbecc('0x31')];if(!_0x31b453[_0xbecc('0x32')][_0xbecc('0x37')]('nolimit')){_0x505fda[_0xbecc('0x1e')]=qs[_0xbecc('0x1e')](_0x31b453[_0xbecc('0x32')][_0xbecc('0x1e')]);_0x505fda['offset']=qs['offset'](_0x31b453[_0xbecc('0x32')][_0xbecc('0x20')]);}_0x505fda['order']=qs[_0xbecc('0x38')](_0x31b453[_0xbecc('0x32')][_0xbecc('0x38')]);_0x505fda['where']=qs['filters'](_[_0xbecc('0x39')](_0x31b453[_0xbecc('0x32')],_0x1a40aa[_0xbecc('0x33')]),_0x1ce335);if(_0x31b453[_0xbecc('0x32')][_0xbecc('0x3a')]){_0x505fda[_0xbecc('0x3b')]=_[_0xbecc('0x3c')](_0x505fda[_0xbecc('0x3b')],{'$or':_[_0xbecc('0x2c')](_0x1ce335,function(_0x5ec73a){if(_0x5ec73a['type']!=='VIRTUAL'){var _0x2a7592={};_0x2a7592[_0x5ec73a['name']]={'$like':'%'+_0x31b453[_0xbecc('0x32')][_0xbecc('0x3a')]+'%'};return _0x2a7592;}})});}_0x505fda=_[_0xbecc('0x3c')]({},_0x505fda,_0x31b453[_0xbecc('0x3d')]);var _0x6b5eff={'where':_0x505fda[_0xbecc('0x3b')]};return db[_0xbecc('0x2d')][_0xbecc('0x1f')](_0x6b5eff)[_0xbecc('0x24')](function(_0x4f8d5b){_0x4c62eb[_0xbecc('0x1f')]=_0x4f8d5b;if(_0x31b453['query'][_0xbecc('0x3e')]){_0x505fda[_0xbecc('0x3f')]=[{'all':!![]}];}return db[_0xbecc('0x2d')][_0xbecc('0x40')](_0x505fda);})['then'](function(_0x1a2107){_0x4c62eb['rows']=_0x1a2107;return _0x4c62eb;})[_0xbecc('0x24')](respondWithFilteredResult(_0x2bf4c7,_0x505fda))[_0xbecc('0x41')](handleError(_0x2bf4c7,null));}; \ No newline at end of file +var _0xf2ca=['model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','error','stack','name','send','index','map','Migration','rawAttributes','type','key'];(function(_0x324a2e,_0x4beea6){var _0x49801d=function(_0x4fff88){while(--_0x4fff88){_0x324a2e['push'](_0x324a2e['shift']());}};_0x49801d(++_0x4beea6);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x27a3cb,_0x4af597){_0x27a3cb=_0x27a3cb-0x0;var _0x54ff38=_0xf2ca[_0x27a3cb];return _0x54ff38;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x3c1ae6,_0xe929b5){return function(_0xff396f){if(!_0xff396f){_0x3c1ae6[_0xaf2c('0x18')](0x194);}return _0xff396f;};}function handleError(_0x4a8dd8,_0x29f8b0){_0x29f8b0=_0x29f8b0||0x1f4;return function(_0x2051be){logger[_0xaf2c('0x24')](_0x2051be[_0xaf2c('0x25')]);if(_0x2051be['name']){delete _0x2051be[_0xaf2c('0x26')];}_0x4a8dd8['status'](_0x29f8b0)[_0xaf2c('0x27')](_0x2051be);};}exports[_0xaf2c('0x28')]=function(_0x15466b,_0x5d685a){var _0x2747bb={},_0x2ea490={},_0x3baee2={'count':0x0,'rows':[]};var _0x4a96d2=_[_0xaf2c('0x29')](db[_0xaf2c('0x2a')][_0xaf2c('0x2b')],function(_0x19364e){return{'name':_0x19364e['fieldName'],'type':_0x19364e[_0xaf2c('0x2c')][_0xaf2c('0x2d')]};});_0x2ea490[_0xaf2c('0x2e')]=_['map'](_0x4a96d2,'name');_0x2ea490[_0xaf2c('0x2f')]=_['keys'](_0x15466b[_0xaf2c('0x2f')]);_0x2ea490['filters']=_[_0xaf2c('0x30')](_0x2ea490[_0xaf2c('0x2e')],_0x2ea490['query']);_0x2747bb[_0xaf2c('0x31')]=_[_0xaf2c('0x30')](_0x2ea490['model'],qs[_0xaf2c('0x32')](_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x32')]));_0x2747bb[_0xaf2c('0x31')]=_0x2747bb[_0xaf2c('0x31')][_0xaf2c('0x33')]?_0x2747bb['attributes']:_0x2ea490[_0xaf2c('0x2e')];if(!_0x15466b['query'][_0xaf2c('0x34')]('nolimit')){_0x2747bb[_0xaf2c('0x1e')]=qs['limit'](_0x15466b[_0xaf2c('0x2f')]['limit']);_0x2747bb[_0xaf2c('0x1c')]=qs['offset'](_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x1c')]);}_0x2747bb[_0xaf2c('0x35')]=qs[_0xaf2c('0x36')](_0x15466b[_0xaf2c('0x2f')]['sort']);_0x2747bb['where']=qs[_0xaf2c('0x37')](_[_0xaf2c('0x38')](_0x15466b[_0xaf2c('0x2f')],_0x2ea490[_0xaf2c('0x37')]),_0x4a96d2);if(_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x39')]){_0x2747bb['where']=_[_0xaf2c('0x3a')](_0x2747bb[_0xaf2c('0x3b')],{'$or':_['map'](_0x4a96d2,function(_0x36081a){if(_0x36081a[_0xaf2c('0x2c')]!==_0xaf2c('0x3c')){var _0x71c597={};_0x71c597[_0x36081a[_0xaf2c('0x26')]]={'$like':'%'+_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x39')]+'%'};return _0x71c597;}})});}_0x2747bb=_[_0xaf2c('0x3a')]({},_0x2747bb,_0x15466b[_0xaf2c('0x3d')]);var _0x106eb9={'where':_0x2747bb[_0xaf2c('0x3b')]};return db[_0xaf2c('0x2a')][_0xaf2c('0x3e')](_0x106eb9)['then'](function(_0x54a953){_0x3baee2['count']=_0x54a953;if(_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x3f')]){_0x2747bb[_0xaf2c('0x40')]=[{'all':!![]}];}return db[_0xaf2c('0x2a')][_0xaf2c('0x41')](_0x2747bb);})[_0xaf2c('0x23')](function(_0x51c441){_0x3baee2[_0xaf2c('0x42')]=_0x51c441;return _0x3baee2;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x5d685a,_0x2747bb))[_0xaf2c('0x43')](handleError(_0x5d685a,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index ce4a857..5b1b40a 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 _0x25ea=['bluebird','path','../../config/environment','exports','define','Migration','lodash','util','../../config/logger','moment'];(function(_0x39bb28,_0x3e86c6){var _0x218f07=function(_0x34ce6b){while(--_0x34ce6b){_0x39bb28['push'](_0x39bb28['shift']());}};_0x218f07(++_0x3e86c6);}(_0x25ea,0x6a));var _0xa25e=function(_0x43aee5,_0x11268b){_0x43aee5=_0x43aee5-0x0;var _0x76d1d0=_0x25ea[_0x43aee5];return _0x76d1d0;};'use strict';var _=require(_0xa25e('0x0'));var util=require(_0xa25e('0x1'));var logger=require(_0xa25e('0x2'))('api');var moment=require(_0xa25e('0x3'));var BPromise=require(_0xa25e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa25e('0x5'));var rimraf=require('rimraf');var config=require(_0xa25e('0x6'));var attributes=require('./migration.attributes');module[_0xa25e('0x7')]=function(_0x1798c2,_0xd6e7bd){return _0x1798c2[_0xa25e('0x8')](_0xa25e('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa534=['request-promise','path','rimraf','../../config/environment','exports','Migration','migrations','lodash','bluebird'];(function(_0x2efd1d,_0x44f696){var _0x1ef3f6=function(_0x25da5f){while(--_0x25da5f){_0x2efd1d['push'](_0x2efd1d['shift']());}};_0x1ef3f6(++_0x44f696);}(_0xa534,0x73));var _0x4a53=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xa534[_0x166742];return _0xb7814a;};'use strict';var _=require(_0x4a53('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4a53('0x1'));var rp=require(_0x4a53('0x2'));var fs=require('fs');var path=require(_0x4a53('0x3'));var rimraf=require(_0x4a53('0x4'));var config=require(_0x4a53('0x5'));var attributes=require('./migration.attributes');module[_0x4a53('0x6')]=function(_0x595aa4,_0xe027f){return _0x595aa4['define'](_0x4a53('0x7'),attributes,{'tableName':_0x4a53('0x8'),'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 d86e71f..3351d4f 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 _0x2333=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','randomstring','ioredis'];(function(_0x51674a,_0x77ccff){var _0x13fca6=function(_0x3d6c27){while(--_0x3d6c27){_0x51674a['push'](_0x51674a['shift']());}};_0x13fca6(++_0x77ccff);}(_0x2333,0x11a));var _0x3233=function(_0x472089,_0x312426){_0x472089=_0x472089-0x0;var _0x274b4b=_0x2333[_0x472089];return _0x274b4b;};'use strict';var _=require(_0x3233('0x0'));var util=require(_0x3233('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3233('0x2'));var fs=require('fs');var Redis=require(_0x3233('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3233('0x4'));var logger=require(_0x3233('0x5'))(_0x3233('0x6'));var config=require(_0x3233('0x7'));var jayson=require(_0x3233('0x8'));var client=jayson[_0x3233('0x9')][_0x3233('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33a56d,_0x1e93e8,_0x1842a1){return new BPromise(function(_0x1837b6,_0x2ee6df){return client[_0x3233('0xb')](_0x33a56d,_0x1842a1)[_0x3233('0xc')](function(_0x7ff4bd){logger[_0x3233('0xd')](_0x3233('0xe'),_0x1e93e8,_0x3233('0xf'));logger[_0x3233('0x10')](_0x3233('0x11'),_0x1e93e8,_0x3233('0xf'),JSON['stringify'](_0x7ff4bd));if(_0x7ff4bd[_0x3233('0x12')]){if(_0x7ff4bd[_0x3233('0x12')][_0x3233('0x13')]===0x1f4){logger[_0x3233('0x12')](_0x3233('0xe'),_0x1e93e8,_0x7ff4bd[_0x3233('0x12')][_0x3233('0x14')]);return _0x2ee6df(_0x7ff4bd[_0x3233('0x12')][_0x3233('0x14')]);}logger[_0x3233('0x12')](_0x3233('0xe'),_0x1e93e8,_0x7ff4bd[_0x3233('0x12')][_0x3233('0x14')]);return _0x1837b6(_0x7ff4bd['error']['message']);}else{logger[_0x3233('0xd')](_0x3233('0xe'),_0x1e93e8,_0x3233('0xf'));_0x1837b6(_0x7ff4bd['result'][_0x3233('0x14')]);}})[_0x3233('0x15')](function(_0x127227){logger['error'](_0x3233('0xe'),_0x1e93e8,_0x127227);_0x2ee6df(_0x127227);});});} \ No newline at end of file +var _0x9d9b=['stringify','error','code','Migration,\x20%s,\x20%s','message','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','Migration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x355f43,_0x2c743e){_0x355f43=_0x355f43-0x0;var _0xe38d35=_0x9d9b[_0x355f43];return _0xe38d35;};'use strict';var _=require('lodash');var util=require(_0xb9d9('0x0'));var moment=require(_0xb9d9('0x1'));var BPromise=require('bluebird');var rs=require(_0xb9d9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9d9('0x3'))['db'];var utils=require(_0xb9d9('0x4'));var logger=require(_0xb9d9('0x5'))('rpc');var config=require(_0xb9d9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb9d9('0x7')][_0xb9d9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51af61,_0x13743f,_0x20e0e5){return new BPromise(function(_0x184896,_0x6ee523){return client[_0xb9d9('0x9')](_0x51af61,_0x20e0e5)[_0xb9d9('0xa')](function(_0x1bfec3){logger['info']('Migration,\x20%s,\x20%s',_0x13743f,'request\x20sent');logger['debug'](_0xb9d9('0xb'),_0x13743f,_0xb9d9('0xc'),JSON[_0xb9d9('0xd')](_0x1bfec3));if(_0x1bfec3['error']){if(_0x1bfec3[_0xb9d9('0xe')][_0xb9d9('0xf')]===0x1f4){logger['error'](_0xb9d9('0x10'),_0x13743f,_0x1bfec3['error'][_0xb9d9('0x11')]);return _0x6ee523(_0x1bfec3[_0xb9d9('0xe')][_0xb9d9('0x11')]);}logger[_0xb9d9('0xe')](_0xb9d9('0x10'),_0x13743f,_0x1bfec3[_0xb9d9('0xe')][_0xb9d9('0x11')]);return _0x184896(_0x1bfec3[_0xb9d9('0xe')]['message']);}else{logger['info'](_0xb9d9('0x10'),_0x13743f,_0xb9d9('0xc'));_0x184896(_0x1bfec3[_0xb9d9('0x12')][_0xb9d9('0x11')]);}})['catch'](function(_0x5ab03a){logger[_0xb9d9('0xe')]('Migration,\x20%s,\x20%s',_0x13743f,_0x5ab03a);_0x6ee523(_0x5ab03a);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 6d018e3..033e9d2 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 _0xb89c=['get','/:id','show','post','put','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','index'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0xb89c,0x198));var _0xcb89=function(_0xa4547e,_0x5334f9){_0xa4547e=_0xa4547e-0x0;var _0x58ec2f=_0xb89c[_0xa4547e];return _0x58ec2f;};'use strict';var multer=require(_0xcb89('0x0'));var util=require(_0xcb89('0x1'));var path=require(_0xcb89('0x2'));var timeout=require(_0xcb89('0x3'));var express=require('express');var router=express[_0xcb89('0x4')]();var fs_extra=require(_0xcb89('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcb89('0x6'));var config=require(_0xcb89('0x7'));var controller=require(_0xcb89('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xcb89('0x9')]);router[_0xcb89('0xa')](_0xcb89('0xb'),auth['isAuthenticated'](),controller[_0xcb89('0xc')]);router[_0xcb89('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcb89('0xe')]('/:id',auth[_0xcb89('0xf')](),controller[_0xcb89('0x10')]);router[_0xcb89('0x11')](_0xcb89('0xb'),auth[_0xcb89('0xf')](),controller[_0xcb89('0x12')]);module['exports']=router; \ No newline at end of file +var _0xed0b=['isAuthenticated','show','create','put','delete','exports','multer','path','connect-timeout','express','../../components/interaction/service','./network.controller','index','get','/:id'];(function(_0x405385,_0x56f573){var _0x43837b=function(_0x30e20e){while(--_0x30e20e){_0x405385['push'](_0x405385['shift']());}};_0x43837b(++_0x56f573);}(_0xed0b,0x15f));var _0xbed0=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0xed0b[_0x3f0b30];return _0x2748a5;};'use strict';var multer=require(_0xbed0('0x0'));var util=require('util');var path=require(_0xbed0('0x1'));var timeout=require(_0xbed0('0x2'));var express=require(_0xbed0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbed0('0x4'));var config=require('../../config/environment');var controller=require(_0xbed0('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xbed0('0x6')]);router[_0xbed0('0x7')](_0xbed0('0x8'),auth[_0xbed0('0x9')](),controller[_0xbed0('0xa')]);router['post']('/',auth[_0xbed0('0x9')](),controller[_0xbed0('0xb')]);router[_0xbed0('0xc')](_0xbed0('0x8'),auth[_0xbed0('0x9')](),controller['update']);router[_0xbed0('0xd')](_0xbed0('0x8'),auth[_0xbed0('0x9')](),controller['destroy']);module[_0xbed0('0xe')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index b00c905..84ef912 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 _0x09b7=['externip','stun','turn','STRING','exports','ENUM'];(function(_0x297d26,_0x181c70){var _0x386f9f=function(_0xd5114){while(--_0xd5114){_0x297d26['push'](_0x297d26['shift']());}};_0x386f9f(++_0x181c70);}(_0x09b7,0x1c0));var _0x709b=function(_0x476705,_0x34fe4c){_0x476705=_0x476705-0x0;var _0x520734=_0x09b7[_0x476705];return _0x520734;};'use strict';var Sequelize=require('sequelize');module[_0x709b('0x0')]={'type':{'type':Sequelize[_0x709b('0x1')]('localnet',_0x709b('0x2'),_0x709b('0x3'),_0x709b('0x4'))},'value':{'type':Sequelize[_0x709b('0x5')]},'username':{'type':Sequelize[_0x709b('0x5')]},'password':{'type':Sequelize[_0x709b('0x5')]}}; \ No newline at end of file +var _0xdbb2=['sequelize','ENUM','localnet','stun','STRING'];(function(_0x39d469,_0x2586eb){var _0xc12b7f=function(_0x1c61ea){while(--_0x1c61ea){_0x39d469['push'](_0x39d469['shift']());}};_0xc12b7f(++_0x2586eb);}(_0xdbb2,0x12c));var _0x2dbb=function(_0x34bbd5,_0x3c810a){_0x34bbd5=_0x34bbd5-0x0;var _0x46244f=_0xdbb2[_0x34bbd5];return _0x46244f;};'use strict';var Sequelize=require(_0x2dbb('0x0'));module['exports']={'type':{'type':Sequelize[_0x2dbb('0x1')](_0x2dbb('0x2'),'externip',_0x2dbb('0x3'),'turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2dbb('0x4')]},'password':{'type':Sequelize[_0x2dbb('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 657024c..b0a018e 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 _0x661a=['toUpperCase','TURN','writeFileSync','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','server/files/templates/stun_multiple.ejs','server/files/templates/turn_multiple.ejs','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','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','../../config/license/util','../../mysqldb','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','Network','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','merge','create','sequelize','transaction','body','STUN','readFileSync','join','root','utf8','render','/etc/asterisk/stun_xcally.conf','Reload'];(function(_0x478984,_0x3c1e96){var _0x599f33=function(_0xf3abce){while(--_0xf3abce){_0x478984['push'](_0x478984['shift']());}};_0x599f33(++_0x3c1e96);}(_0x661a,0x1c9));var _0xa661=function(_0x4314d7,_0x355218){_0x4314d7=_0x4314d7-0x0;var _0x5c599b=_0x661a[_0x4314d7];return _0x5c599b;};'use strict';var emlformat=require(_0xa661('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa661('0x1'));var jsonpatch=require(_0xa661('0x2'));var rp=require(_0xa661('0x3'));var moment=require('moment');var BPromise=require(_0xa661('0x4'));var Mustache=require(_0xa661('0x5'));var util=require(_0xa661('0x6'));var path=require('path');var sox=require(_0xa661('0x7'));var csv=require('to-csv');var ejs=require(_0xa661('0x8'));var fs=require('fs');var fs_extra=require(_0xa661('0x9'));var _=require(_0xa661('0xa'));var squel=require(_0xa661('0xb'));var crypto=require(_0xa661('0xc'));var jsforce=require(_0xa661('0xd'));var deskjs=require(_0xa661('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa661('0xf'));var Papa=require('papaparse');var Redis=require(_0xa661('0x10'));var authService=require(_0xa661('0x11'));var qs=require(_0xa661('0x12'));var as=require(_0xa661('0x13'));var hardwareService=require(_0xa661('0x14'));var logger=require(_0xa661('0x15'))(_0xa661('0x16'));var utils=require(_0xa661('0x17'));var config=require(_0xa661('0x18'));var licenseUtil=require(_0xa661('0x19'));var db=require(_0xa661('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa661('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3033e4,_0x46e634,_0x5882ef,_0x4f756a){return new BPromise(function(_0x319b82,_0x3e7ed7){var _0x1b11b2=_0x4f756a||client;return _0x1b11b2[_0xa661('0x1c')](_0x3033e4,_0x5882ef)[_0xa661('0x1d')](function(_0x282002){logger[_0xa661('0x1e')](_0xa661('0x1f'),_0x46e634,_0xa661('0x20'));logger[_0xa661('0x21')](_0xa661('0x22'),_0x46e634,_0xa661('0x20'),JSON[_0xa661('0x23')](_0x282002));if(_0x282002[_0xa661('0x24')]){if(_0x282002['error'][_0xa661('0x25')]===0x1f4){logger[_0xa661('0x24')](_0xa661('0x1f'),_0x46e634,_0x282002[_0xa661('0x24')]['message']);return _0x3e7ed7(_0x282002[_0xa661('0x24')]['message']);}logger[_0xa661('0x24')]('Network,\x20%s,\x20%s',_0x46e634,_0x282002[_0xa661('0x24')]['message']);return _0x319b82(_0x282002[_0xa661('0x24')][_0xa661('0x26')]);}else{logger[_0xa661('0x1e')](_0xa661('0x1f'),_0x46e634,'request\x20sent');_0x319b82(_0x282002[_0xa661('0x27')][_0xa661('0x26')]);}})['catch'](function(_0x2890a5){logger[_0xa661('0x24')]('Network,\x20%s,\x20%s',_0x46e634,_0x2890a5);_0x3e7ed7(_0x2890a5);});});}function respondWithStatusCode(_0x405e46,_0x4b06bf){_0x4b06bf=_0x4b06bf||0xcc;return function(_0x51b69a){if(_0x51b69a){return _0x405e46[_0xa661('0x28')](_0x4b06bf);}return _0x405e46[_0xa661('0x29')](_0x4b06bf)[_0xa661('0x2a')]();};}function respondWithResult(_0x4bf9ef,_0x11b6f2){_0x11b6f2=_0x11b6f2||0xc8;return function(_0x479577){if(_0x479577){return _0x4bf9ef[_0xa661('0x29')](_0x11b6f2)[_0xa661('0x2b')](_0x479577);}};}function respondWithFilteredResult(_0x3715a9,_0x2d275b){return function(_0x954273){if(_0x954273){var _0x31ee05=typeof _0x2d275b[_0xa661('0x2c')]===_0xa661('0x2d')&&typeof _0x2d275b['limit']===_0xa661('0x2d');var _0xae3203=_0x954273[_0xa661('0x2e')];var _0x165413=_0x31ee05?0x0:_0x2d275b['offset'];var _0x2e61ba=_0x31ee05?_0x954273[_0xa661('0x2e')]:_0x2d275b[_0xa661('0x2c')]+_0x2d275b[_0xa661('0x2f')];var _0x86105a;if(_0x2e61ba>=_0xae3203){_0x2e61ba=_0xae3203;_0x86105a=0xc8;}else{_0x86105a=0xce;}_0x3715a9['status'](_0x86105a);return _0x3715a9[_0xa661('0x30')](_0xa661('0x31'),_0x165413+'-'+_0x2e61ba+'/'+_0xae3203)[_0xa661('0x2b')](_0x954273);}return null;};}function patchUpdates(_0x33bf85){return function(_0xdb0cbc){try{jsonpatch[_0xa661('0x32')](_0xdb0cbc,_0x33bf85,!![]);}catch(_0x31ef0b){return BPromise['reject'](_0x31ef0b);}return _0xdb0cbc[_0xa661('0x33')]();};}function saveUpdates(_0x575b7f,_0x4e1b44){return function(_0x25f680){if(_0x25f680){return _0x25f680[_0xa661('0x34')](_0x575b7f)[_0xa661('0x1d')](function(_0x10cfda){return _0x10cfda;});}return null;};}function removeEntity(_0x11323a,_0x9d8b1e){return function(_0x51cfa2){if(_0x51cfa2){return _0x51cfa2[_0xa661('0x35')]()[_0xa661('0x1d')](function(){_0x11323a[_0xa661('0x29')](0xcc)[_0xa661('0x2a')]();});}};}function handleEntityNotFound(_0x3feb6e,_0x518fdb){return function(_0x4fdf4f){if(!_0x4fdf4f){_0x3feb6e[_0xa661('0x28')](0x194);}return _0x4fdf4f;};}function handleError(_0x41f2d2,_0x207953){_0x207953=_0x207953||0x1f4;return function(_0x25b5e9){logger[_0xa661('0x24')](_0x25b5e9[_0xa661('0x36')]);if(_0x25b5e9[_0xa661('0x37')]){delete _0x25b5e9[_0xa661('0x37')];}_0x41f2d2[_0xa661('0x29')](_0x207953)[_0xa661('0x38')](_0x25b5e9);};}exports[_0xa661('0x39')]=function(_0x5a6d4d,_0x4fa85a){var _0x5a3182={},_0x182748={},_0x1817be={'count':0x0,'rows':[]};var _0x1b52a9=_['map'](db[_0xa661('0x3a')][_0xa661('0x3b')],function(_0xa59891){return{'name':_0xa59891[_0xa661('0x3c')],'type':_0xa59891[_0xa661('0x3d')][_0xa661('0x3e')]};});_0x182748['model']=_['map'](_0x1b52a9,_0xa661('0x37'));_0x182748[_0xa661('0x3f')]=_[_0xa661('0x40')](_0x5a6d4d['query']);_0x182748[_0xa661('0x41')]=_[_0xa661('0x42')](_0x182748[_0xa661('0x43')],_0x182748[_0xa661('0x3f')]);_0x5a3182['attributes']=_[_0xa661('0x42')](_0x182748['model'],qs[_0xa661('0x44')](_0x5a6d4d[_0xa661('0x3f')][_0xa661('0x44')]));_0x5a3182[_0xa661('0x45')]=_0x5a3182[_0xa661('0x45')]['length']?_0x5a3182[_0xa661('0x45')]:_0x182748['model'];if(!_0x5a6d4d[_0xa661('0x3f')][_0xa661('0x46')](_0xa661('0x47'))){_0x5a3182[_0xa661('0x2f')]=qs[_0xa661('0x2f')](_0x5a6d4d[_0xa661('0x3f')][_0xa661('0x2f')]);_0x5a3182[_0xa661('0x2c')]=qs[_0xa661('0x2c')](_0x5a6d4d[_0xa661('0x3f')]['offset']);}_0x5a3182['order']=qs[_0xa661('0x48')](_0x5a6d4d['query'][_0xa661('0x48')]);_0x5a3182['where']=qs[_0xa661('0x41')](_[_0xa661('0x49')](_0x5a6d4d[_0xa661('0x3f')],_0x182748[_0xa661('0x41')]),_0x1b52a9);if(_0x5a6d4d[_0xa661('0x3f')][_0xa661('0x4a')]){_0x5a3182[_0xa661('0x4b')]=_['merge'](_0x5a3182[_0xa661('0x4b')],{'$or':_['map'](_0x1b52a9,function(_0x2bedab){if(_0x2bedab[_0xa661('0x3d')]!==_0xa661('0x4c')){var _0x2209dd={};_0x2209dd[_0x2bedab[_0xa661('0x37')]]={'$like':'%'+_0x5a6d4d[_0xa661('0x3f')]['filter']+'%'};return _0x2209dd;}})});}_0x5a3182=_['merge']({},_0x5a3182,_0x5a6d4d[_0xa661('0x4d')]);var _0x538ff8={'where':_0x5a3182[_0xa661('0x4b')]};return db['Network'][_0xa661('0x2e')](_0x538ff8)[_0xa661('0x1d')](function(_0x1392e3){_0x1817be[_0xa661('0x2e')]=_0x1392e3;if(_0x5a6d4d[_0xa661('0x3f')][_0xa661('0x4e')]){_0x5a3182[_0xa661('0x4f')]=[{'all':!![]}];}return db['Network'][_0xa661('0x50')](_0x5a3182);})[_0xa661('0x1d')](function(_0x5a4b27){_0x1817be[_0xa661('0x51')]=_0x5a4b27;return _0x1817be;})[_0xa661('0x1d')](respondWithFilteredResult(_0x4fa85a,_0x5a3182))[_0xa661('0x52')](handleError(_0x4fa85a,null));};exports['show']=function(_0x221892,_0x3c7a97){var _0x4342c1={'raw':!![],'where':{'id':_0x221892[_0xa661('0x53')]['id']}},_0x364f30={};_0x364f30[_0xa661('0x43')]=_[_0xa661('0x40')](db[_0xa661('0x3a')][_0xa661('0x3b')]);_0x364f30[_0xa661('0x3f')]=_[_0xa661('0x40')](_0x221892[_0xa661('0x3f')]);_0x364f30[_0xa661('0x41')]=_[_0xa661('0x42')](_0x364f30['model'],_0x364f30[_0xa661('0x3f')]);_0x4342c1[_0xa661('0x45')]=_[_0xa661('0x42')](_0x364f30[_0xa661('0x43')],qs[_0xa661('0x44')](_0x221892[_0xa661('0x3f')]['fields']));_0x4342c1[_0xa661('0x45')]=_0x4342c1[_0xa661('0x45')][_0xa661('0x54')]?_0x4342c1[_0xa661('0x45')]:_0x364f30[_0xa661('0x43')];if(_0x221892['query'][_0xa661('0x4e')]){_0x4342c1['include']=[{'all':!![]}];}_0x4342c1=_[_0xa661('0x55')]({},_0x4342c1,_0x221892['options']);return db[_0xa661('0x3a')]['find'](_0x4342c1)['then'](handleEntityNotFound(_0x3c7a97,null))['then'](respondWithResult(_0x3c7a97,null))[_0xa661('0x52')](handleError(_0x3c7a97,null));};exports[_0xa661('0x56')]=function(_0x228a45,_0x3c9ee5,_0x59270d){var _0x4e3b93;return db[_0xa661('0x57')][_0xa661('0x58')](function(_0x34cf5d){return db[_0xa661('0x3a')][_0xa661('0x56')](_0x228a45[_0xa661('0x59')],{'raw':!![]})[_0xa661('0x1d')](function(_0x280a45){_0x4e3b93=_0x280a45;return db[_0xa661('0x3a')][_0xa661('0x50')]({'where':{'type':_0x228a45[_0xa661('0x59')][_0xa661('0x3d')]},'raw':!![]});})[_0xa661('0x1d')](function(_0x4b73ee){if(_0x4e3b93[_0xa661('0x3d')]['toUpperCase']()==_0xa661('0x5a')){var _0x2999b7=fs[_0xa661('0x5b')](path[_0xa661('0x5c')](config[_0xa661('0x5d')],'server/files/templates/stun_multiple.ejs'),_0xa661('0x5e'));var _0x225de2=ejs[_0xa661('0x5f')](_0x2999b7,{'networks':_0x4b73ee||[]});fs['writeFileSync'](_0xa661('0x60'),_0x225de2);return respondWithRpcPromise(_0xa661('0x61'),'create',{'module':'res_stun_monitor.so'});}else if(_0x4e3b93[_0xa661('0x3d')][_0xa661('0x62')]()==_0xa661('0x63')){var _0x3ff1bd=fs[_0xa661('0x5b')](path[_0xa661('0x5c')](config[_0xa661('0x5d')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0xde5e9c=ejs['render'](_0x3ff1bd,{'networks':_0x4b73ee||[]});fs[_0xa661('0x64')](_0xa661('0x65'),_0xde5e9c);return respondWithRpcPromise(_0xa661('0x61'),_0xa661('0x56'),{'module':_0xa661('0x66')});}else{var _0x867df4=fs[_0xa661('0x5b')](path['join'](config['root'],_0xa661('0x67')),_0xa661('0x5e'));var _0x5e25d9=ejs[_0xa661('0x5f')](_0x867df4,{'networks':_0x4b73ee||[]});fs[_0xa661('0x64')](util[_0xa661('0x68')](_0xa661('0x69'),_0x228a45[_0xa661('0x59')][_0xa661('0x3d')][_0xa661('0x6a')]()),_0x5e25d9);return respondWithRpcPromise('Reload',_0xa661('0x56'),{'module':_0xa661('0x6b')});}return null;})[_0xa661('0x1d')](function(){return _0x4e3b93;});})[_0xa661('0x1d')](respondWithResult(_0x3c9ee5,0xc9))[_0xa661('0x52')](handleError(_0x3c9ee5,null));};exports[_0xa661('0x34')]=function(_0xb41f27,_0x3e4cab,_0x3e8c8f){var _0x5a6860;return db['sequelize'][_0xa661('0x58')](function(_0x30cc8d){return db[_0xa661('0x3a')][_0xa661('0x6c')]({'where':{'id':_0xb41f27['params']['id']}})[_0xa661('0x1d')](handleEntityNotFound(_0x3e4cab,null))[_0xa661('0x1d')](saveUpdates(_0xb41f27['body'],null))[_0xa661('0x1d')](function(_0x343de5){if(_0x343de5){_0x5a6860=_0x343de5;return db[_0xa661('0x3a')][_0xa661('0x50')]({'where':{'type':_0x5a6860[_0xa661('0x3d')]},'raw':!![]});}return null;})[_0xa661('0x1d')](function(_0x383580){if(_0x5a6860[_0xa661('0x3d')]['toUpperCase']()==_0xa661('0x5a')){var _0x49276b=fs[_0xa661('0x5b')](path[_0xa661('0x5c')](config[_0xa661('0x5d')],_0xa661('0x6d')),_0xa661('0x5e'));var _0x345f42=ejs[_0xa661('0x5f')](_0x49276b,{'networks':_0x383580||[]});fs[_0xa661('0x64')](_0xa661('0x60'),_0x345f42);return respondWithRpcPromise(_0xa661('0x61'),'update',{'module':'res_stun_monitor.so'});}else if(_0x5a6860['type']['toUpperCase']()==_0xa661('0x63')){var _0x917a65=fs[_0xa661('0x5b')](path[_0xa661('0x5c')](config[_0xa661('0x5d')],'server/files/templates/turn_multiple.ejs'),_0xa661('0x5e'));var _0x1befee=ejs[_0xa661('0x5f')](_0x917a65,{'networks':_0x383580||[]});fs['writeFileSync'](_0xa661('0x65'),_0x1befee);return respondWithRpcPromise('Reload',_0xa661('0x34'),{'module':_0xa661('0x66')});}else{var _0x3f530f=fs[_0xa661('0x5b')](path[_0xa661('0x5c')](config['root'],'server/files/templates/network.ejs'),_0xa661('0x5e'));var _0xf07ccd=ejs['render'](_0x3f530f,{'networks':_0x383580||[]});fs[_0xa661('0x64')](util['format'](_0xa661('0x69'),_0xb41f27[_0xa661('0x59')][_0xa661('0x3d')][_0xa661('0x6a')]()),_0xf07ccd);return respondWithRpcPromise(_0xa661('0x61'),_0xa661('0x34'),{'module':_0xa661('0x6b')});}return null;})[_0xa661('0x1d')](function(_0x54f6cd){if(_0x54f6cd){return _0x5a6860;}return null;});})[_0xa661('0x1d')](respondWithResult(_0x3e4cab,null))[_0xa661('0x52')](handleError(_0x3e4cab,null));};exports[_0xa661('0x35')]=function(_0xe41651,_0x29aa03,_0x2646e8){var _0x566ae1;return db[_0xa661('0x3a')][_0xa661('0x6c')]({'where':{'id':_0xe41651[_0xa661('0x53')]['id']}})[_0xa661('0x1d')](function(_0x2c8db1){_0x566ae1=_0x2c8db1;return _0x2c8db1;})[_0xa661('0x1d')](handleEntityNotFound(_0x29aa03,null))[_0xa661('0x1d')](removeEntity(_0x29aa03,null))['then'](function(){if(_0x566ae1){return db[_0xa661('0x3a')]['findAll']({'where':{'type':_0x566ae1['type']},'raw':!![]});}})[_0xa661('0x1d')](function(_0x5d30d0){if(_0x566ae1[_0xa661('0x3d')]['toUpperCase']()=='STUN'){var _0x1dd3ec=fs[_0xa661('0x5b')](path[_0xa661('0x5c')](config[_0xa661('0x5d')],_0xa661('0x6d')),_0xa661('0x5e'));var _0x46b235=ejs[_0xa661('0x5f')](_0x1dd3ec,{'networks':_0x5d30d0||[]});fs[_0xa661('0x64')]('/etc/asterisk/stun_xcally.conf',_0x46b235);return respondWithRpcPromise('Reload',_0xa661('0x35'),{'module':_0xa661('0x66')});}else if(_0x566ae1[_0xa661('0x3d')][_0xa661('0x62')]()=='TURN'){var _0x52c344=fs['readFileSync'](path[_0xa661('0x5c')](config[_0xa661('0x5d')],_0xa661('0x6e')),_0xa661('0x5e'));var _0x47c7ff=ejs[_0xa661('0x5f')](_0x52c344,{'networks':_0x5d30d0||[]});fs[_0xa661('0x64')](_0xa661('0x65'),_0x47c7ff);return respondWithRpcPromise(_0xa661('0x61'),_0xa661('0x35'),{'module':_0xa661('0x66')});}else{var _0x292cc7=fs[_0xa661('0x5b')](path[_0xa661('0x5c')](config[_0xa661('0x5d')],'server/files/templates/network.ejs'),_0xa661('0x5e'));var _0x4c692e=ejs[_0xa661('0x5f')](_0x292cc7,{'networks':_0x5d30d0||[]});fs[_0xa661('0x64')](util[_0xa661('0x68')]('/etc/asterisk/sip_xcally_%s.conf',_0xe41651[_0xa661('0x59')]['type'][_0xa661('0x6a')]()),_0x4c692e);return respondWithRpcPromise('Reload',_0xa661('0x35'),{'module':_0xa661('0x6b')});}return null;})[_0xa661('0x52')](handleError(_0x29aa03,null));}; \ No newline at end of file +var _0x14f6=['type','key','query','keys','filters','intersection','model','fields','length','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','find','create','transaction','body','toUpperCase','STUN','readFileSync','join','root','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','update','server/files/templates/stun_multiple.ejs','/etc/asterisk/turn_xcally.conf','/etc/asterisk/sip_xcally_%s.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','destroy','stack','name','index','map','Network','rawAttributes','fieldName'];(function(_0x45891c,_0x14a191){var _0x392ca9=function(_0x2a1897){while(--_0x2a1897){_0x45891c['push'](_0x45891c['shift']());}};_0x392ca9(++_0x14a191);}(_0x14f6,0x170));var _0x614f=function(_0x1537d5,_0x597d2b){_0x1537d5=_0x1537d5-0x0;var _0x3c40a8=_0x14f6[_0x1537d5];return _0x3c40a8;};'use strict';var emlformat=require(_0x614f('0x0'));var rimraf=require(_0x614f('0x1'));var zipdir=require(_0x614f('0x2'));var jsonpatch=require(_0x614f('0x3'));var rp=require(_0x614f('0x4'));var moment=require(_0x614f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x614f('0x6'));var path=require(_0x614f('0x7'));var sox=require(_0x614f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x614f('0x9'));var _=require(_0x614f('0xa'));var squel=require('squel');var crypto=require(_0x614f('0xb'));var jsforce=require(_0x614f('0xc'));var deskjs=require(_0x614f('0xd'));var toCsv=require(_0x614f('0xe'));var querystring=require(_0x614f('0xf'));var Papa=require(_0x614f('0x10'));var Redis=require(_0x614f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x614f('0x12'));var hardwareService=require(_0x614f('0x13'));var logger=require(_0x614f('0x14'))(_0x614f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x614f('0x16'));var db=require(_0x614f('0x17'))['db'];var jayson=require(_0x614f('0x18'));var client=jayson['client'][_0x614f('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4325fc,_0x117538,_0x2c860c,_0x479d29){return new BPromise(function(_0x2d8c74,_0x3cb101){var _0x28b2d5=_0x479d29||client;return _0x28b2d5['request'](_0x4325fc,_0x2c860c)[_0x614f('0x1a')](function(_0x3065b9){logger[_0x614f('0x1b')](_0x614f('0x1c'),_0x117538,_0x614f('0x1d'));logger[_0x614f('0x1e')](_0x614f('0x1f'),_0x117538,'request\x20sent',JSON[_0x614f('0x20')](_0x3065b9));if(_0x3065b9['error']){if(_0x3065b9['error']['code']===0x1f4){logger[_0x614f('0x21')]('Network,\x20%s,\x20%s',_0x117538,_0x3065b9[_0x614f('0x21')][_0x614f('0x22')]);return _0x3cb101(_0x3065b9['error'][_0x614f('0x22')]);}logger[_0x614f('0x21')](_0x614f('0x1c'),_0x117538,_0x3065b9[_0x614f('0x21')]['message']);return _0x2d8c74(_0x3065b9[_0x614f('0x21')][_0x614f('0x22')]);}else{logger[_0x614f('0x1b')](_0x614f('0x1c'),_0x117538,_0x614f('0x1d'));_0x2d8c74(_0x3065b9['result'][_0x614f('0x22')]);}})[_0x614f('0x23')](function(_0x4427c4){logger[_0x614f('0x21')](_0x614f('0x1c'),_0x117538,_0x4427c4);_0x3cb101(_0x4427c4);});});}function respondWithStatusCode(_0x2b32ff,_0xae6e6c){_0xae6e6c=_0xae6e6c||0xcc;return function(_0x77bc63){if(_0x77bc63){return _0x2b32ff[_0x614f('0x24')](_0xae6e6c);}return _0x2b32ff['status'](_0xae6e6c)[_0x614f('0x25')]();};}function respondWithResult(_0x2a9952,_0x35005f){_0x35005f=_0x35005f||0xc8;return function(_0x2fb362){if(_0x2fb362){return _0x2a9952['status'](_0x35005f)[_0x614f('0x26')](_0x2fb362);}};}function respondWithFilteredResult(_0x232782,_0x3dd401){return function(_0x23ab24){if(_0x23ab24){var _0x3e7bc3=typeof _0x3dd401[_0x614f('0x27')]===_0x614f('0x28')&&typeof _0x3dd401[_0x614f('0x29')]===_0x614f('0x28');var _0x2299dd=_0x23ab24[_0x614f('0x2a')];var _0x19773e=_0x3e7bc3?0x0:_0x3dd401[_0x614f('0x27')];var _0x544c09=_0x3e7bc3?_0x23ab24[_0x614f('0x2a')]:_0x3dd401['offset']+_0x3dd401['limit'];var _0x1a5e8c;if(_0x544c09>=_0x2299dd){_0x544c09=_0x2299dd;_0x1a5e8c=0xc8;}else{_0x1a5e8c=0xce;}_0x232782[_0x614f('0x2b')](_0x1a5e8c);return _0x232782[_0x614f('0x2c')](_0x614f('0x2d'),_0x19773e+'-'+_0x544c09+'/'+_0x2299dd)[_0x614f('0x26')](_0x23ab24);}return null;};}function patchUpdates(_0x32d671){return function(_0xf88b3c){try{jsonpatch[_0x614f('0x2e')](_0xf88b3c,_0x32d671,!![]);}catch(_0x2f3c36){return BPromise[_0x614f('0x2f')](_0x2f3c36);}return _0xf88b3c['save']();};}function saveUpdates(_0x113208,_0x480808){return function(_0x2989e8){if(_0x2989e8){return _0x2989e8['update'](_0x113208)[_0x614f('0x1a')](function(_0x376770){return _0x376770;});}return null;};}function removeEntity(_0x4abd20,_0x525265){return function(_0x405b9a){if(_0x405b9a){return _0x405b9a[_0x614f('0x30')]()['then'](function(){_0x4abd20[_0x614f('0x2b')](0xcc)[_0x614f('0x25')]();});}};}function handleEntityNotFound(_0x1403e3,_0x590719){return function(_0x531c7b){if(!_0x531c7b){_0x1403e3[_0x614f('0x24')](0x194);}return _0x531c7b;};}function handleError(_0x27c4ea,_0x2d98e6){_0x2d98e6=_0x2d98e6||0x1f4;return function(_0x36e0b6){logger[_0x614f('0x21')](_0x36e0b6[_0x614f('0x31')]);if(_0x36e0b6[_0x614f('0x32')]){delete _0x36e0b6['name'];}_0x27c4ea[_0x614f('0x2b')](_0x2d98e6)['send'](_0x36e0b6);};}exports[_0x614f('0x33')]=function(_0x522272,_0x4890f4){var _0x100c46={},_0x40c749={},_0x5cf9fd={'count':0x0,'rows':[]};var _0x2d1b2b=_[_0x614f('0x34')](db[_0x614f('0x35')][_0x614f('0x36')],function(_0x3d7bbc){return{'name':_0x3d7bbc[_0x614f('0x37')],'type':_0x3d7bbc[_0x614f('0x38')][_0x614f('0x39')]};});_0x40c749['model']=_[_0x614f('0x34')](_0x2d1b2b,'name');_0x40c749[_0x614f('0x3a')]=_[_0x614f('0x3b')](_0x522272[_0x614f('0x3a')]);_0x40c749[_0x614f('0x3c')]=_[_0x614f('0x3d')](_0x40c749[_0x614f('0x3e')],_0x40c749[_0x614f('0x3a')]);_0x100c46['attributes']=_[_0x614f('0x3d')](_0x40c749[_0x614f('0x3e')],qs[_0x614f('0x3f')](_0x522272[_0x614f('0x3a')][_0x614f('0x3f')]));_0x100c46['attributes']=_0x100c46['attributes'][_0x614f('0x40')]?_0x100c46[_0x614f('0x41')]:_0x40c749[_0x614f('0x3e')];if(!_0x522272[_0x614f('0x3a')]['hasOwnProperty'](_0x614f('0x42'))){_0x100c46[_0x614f('0x29')]=qs[_0x614f('0x29')](_0x522272[_0x614f('0x3a')][_0x614f('0x29')]);_0x100c46[_0x614f('0x27')]=qs['offset'](_0x522272[_0x614f('0x3a')][_0x614f('0x27')]);}_0x100c46[_0x614f('0x43')]=qs[_0x614f('0x44')](_0x522272['query']['sort']);_0x100c46[_0x614f('0x45')]=qs[_0x614f('0x3c')](_[_0x614f('0x46')](_0x522272[_0x614f('0x3a')],_0x40c749[_0x614f('0x3c')]),_0x2d1b2b);if(_0x522272[_0x614f('0x3a')]['filter']){_0x100c46[_0x614f('0x45')]=_[_0x614f('0x47')](_0x100c46[_0x614f('0x45')],{'$or':_[_0x614f('0x34')](_0x2d1b2b,function(_0x258219){if(_0x258219[_0x614f('0x38')]!==_0x614f('0x48')){var _0x2f5beb={};_0x2f5beb[_0x258219[_0x614f('0x32')]]={'$like':'%'+_0x522272[_0x614f('0x3a')][_0x614f('0x49')]+'%'};return _0x2f5beb;}})});}_0x100c46=_[_0x614f('0x47')]({},_0x100c46,_0x522272[_0x614f('0x4a')]);var _0x2a0ca9={'where':_0x100c46[_0x614f('0x45')]};return db['Network'][_0x614f('0x2a')](_0x2a0ca9)[_0x614f('0x1a')](function(_0xfc629c){_0x5cf9fd[_0x614f('0x2a')]=_0xfc629c;if(_0x522272['query']['includeAll']){_0x100c46[_0x614f('0x4b')]=[{'all':!![]}];}return db[_0x614f('0x35')][_0x614f('0x4c')](_0x100c46);})['then'](function(_0x5c48d3){_0x5cf9fd[_0x614f('0x4d')]=_0x5c48d3;return _0x5cf9fd;})[_0x614f('0x1a')](respondWithFilteredResult(_0x4890f4,_0x100c46))[_0x614f('0x23')](handleError(_0x4890f4,null));};exports[_0x614f('0x4e')]=function(_0x34f432,_0x65bf8a){var _0x576e97={'raw':!![],'where':{'id':_0x34f432[_0x614f('0x4f')]['id']}},_0x11017f={};_0x11017f['model']=_['keys'](db[_0x614f('0x35')][_0x614f('0x36')]);_0x11017f['query']=_[_0x614f('0x3b')](_0x34f432['query']);_0x11017f[_0x614f('0x3c')]=_['intersection'](_0x11017f[_0x614f('0x3e')],_0x11017f['query']);_0x576e97[_0x614f('0x41')]=_[_0x614f('0x3d')](_0x11017f[_0x614f('0x3e')],qs[_0x614f('0x3f')](_0x34f432[_0x614f('0x3a')][_0x614f('0x3f')]));_0x576e97['attributes']=_0x576e97[_0x614f('0x41')][_0x614f('0x40')]?_0x576e97['attributes']:_0x11017f[_0x614f('0x3e')];if(_0x34f432['query'][_0x614f('0x50')]){_0x576e97[_0x614f('0x4b')]=[{'all':!![]}];}_0x576e97=_[_0x614f('0x47')]({},_0x576e97,_0x34f432['options']);return db[_0x614f('0x35')][_0x614f('0x51')](_0x576e97)[_0x614f('0x1a')](handleEntityNotFound(_0x65bf8a,null))['then'](respondWithResult(_0x65bf8a,null))[_0x614f('0x23')](handleError(_0x65bf8a,null));};exports[_0x614f('0x52')]=function(_0x3df1f9,_0x2dd089,_0x527cd8){var _0x463163;return db['sequelize'][_0x614f('0x53')](function(_0x7ddd71){return db[_0x614f('0x35')][_0x614f('0x52')](_0x3df1f9['body'],{'raw':!![]})[_0x614f('0x1a')](function(_0x747aa8){_0x463163=_0x747aa8;return db[_0x614f('0x35')][_0x614f('0x4c')]({'where':{'type':_0x3df1f9[_0x614f('0x54')][_0x614f('0x38')]},'raw':!![]});})[_0x614f('0x1a')](function(_0x89a600){if(_0x463163['type'][_0x614f('0x55')]()==_0x614f('0x56')){var _0x1c2e8d=fs[_0x614f('0x57')](path[_0x614f('0x58')](config[_0x614f('0x59')],'server/files/templates/stun_multiple.ejs'),_0x614f('0x5a'));var _0x114aa3=ejs[_0x614f('0x5b')](_0x1c2e8d,{'networks':_0x89a600||[]});fs['writeFileSync'](_0x614f('0x5c'),_0x114aa3);return respondWithRpcPromise(_0x614f('0x5d'),'create',{'module':_0x614f('0x5e')});}else if(_0x463163[_0x614f('0x38')][_0x614f('0x55')]()==_0x614f('0x5f')){var _0x1672a1=fs[_0x614f('0x57')](path[_0x614f('0x58')](config[_0x614f('0x59')],_0x614f('0x60')),'utf8');var _0x350749=ejs[_0x614f('0x5b')](_0x1672a1,{'networks':_0x89a600||[]});fs[_0x614f('0x61')]('/etc/asterisk/turn_xcally.conf',_0x350749);return respondWithRpcPromise(_0x614f('0x5d'),'create',{'module':_0x614f('0x5e')});}else{var _0x32919f=fs[_0x614f('0x57')](path[_0x614f('0x58')](config[_0x614f('0x59')],_0x614f('0x62')),_0x614f('0x5a'));var _0x5959ee=ejs[_0x614f('0x5b')](_0x32919f,{'networks':_0x89a600||[]});fs[_0x614f('0x61')](util[_0x614f('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0x3df1f9[_0x614f('0x54')][_0x614f('0x38')][_0x614f('0x64')]()),_0x5959ee);return respondWithRpcPromise(_0x614f('0x5d'),_0x614f('0x52'),{'module':_0x614f('0x65')});}return null;})[_0x614f('0x1a')](function(){return _0x463163;});})['then'](respondWithResult(_0x2dd089,0xc9))['catch'](handleError(_0x2dd089,null));};exports[_0x614f('0x66')]=function(_0x514640,_0x6743a6,_0x108f84){var _0x407d2f;return db['sequelize']['transaction'](function(_0x27fddc){return db[_0x614f('0x35')][_0x614f('0x51')]({'where':{'id':_0x514640[_0x614f('0x4f')]['id']}})[_0x614f('0x1a')](handleEntityNotFound(_0x6743a6,null))[_0x614f('0x1a')](saveUpdates(_0x514640[_0x614f('0x54')],null))['then'](function(_0x33ef17){if(_0x33ef17){_0x407d2f=_0x33ef17;return db['Network'][_0x614f('0x4c')]({'where':{'type':_0x407d2f[_0x614f('0x38')]},'raw':!![]});}return null;})['then'](function(_0x46c72f){if(_0x407d2f['type'][_0x614f('0x55')]()==_0x614f('0x56')){var _0x11372b=fs[_0x614f('0x57')](path['join'](config['root'],_0x614f('0x67')),'utf8');var _0x47b7d1=ejs['render'](_0x11372b,{'networks':_0x46c72f||[]});fs[_0x614f('0x61')]('/etc/asterisk/stun_xcally.conf',_0x47b7d1);return respondWithRpcPromise(_0x614f('0x5d'),_0x614f('0x66'),{'module':_0x614f('0x5e')});}else if(_0x407d2f[_0x614f('0x38')][_0x614f('0x55')]()==_0x614f('0x5f')){var _0x4f5cc6=fs[_0x614f('0x57')](path[_0x614f('0x58')](config[_0x614f('0x59')],_0x614f('0x60')),_0x614f('0x5a'));var _0x5b5499=ejs['render'](_0x4f5cc6,{'networks':_0x46c72f||[]});fs[_0x614f('0x61')](_0x614f('0x68'),_0x5b5499);return respondWithRpcPromise(_0x614f('0x5d'),_0x614f('0x66'),{'module':'res_stun_monitor.so'});}else{var _0x1bf416=fs[_0x614f('0x57')](path[_0x614f('0x58')](config[_0x614f('0x59')],_0x614f('0x62')),_0x614f('0x5a'));var _0x33a87b=ejs['render'](_0x1bf416,{'networks':_0x46c72f||[]});fs[_0x614f('0x61')](util[_0x614f('0x63')](_0x614f('0x69'),_0x514640['body']['type'][_0x614f('0x64')]()),_0x33a87b);return respondWithRpcPromise(_0x614f('0x5d'),_0x614f('0x66'),{'module':'chan_sip.so'});}return null;})[_0x614f('0x1a')](function(_0x51911){if(_0x51911){return _0x407d2f;}return null;});})[_0x614f('0x1a')](respondWithResult(_0x6743a6,null))[_0x614f('0x23')](handleError(_0x6743a6,null));};exports[_0x614f('0x30')]=function(_0xfa9903,_0x4a4de0,_0x169b71){var _0x3f036d;return db['Network'][_0x614f('0x51')]({'where':{'id':_0xfa9903[_0x614f('0x4f')]['id']}})[_0x614f('0x1a')](function(_0x1da617){_0x3f036d=_0x1da617;return _0x1da617;})['then'](handleEntityNotFound(_0x4a4de0,null))[_0x614f('0x1a')](removeEntity(_0x4a4de0,null))['then'](function(){if(_0x3f036d){return db[_0x614f('0x35')][_0x614f('0x4c')]({'where':{'type':_0x3f036d['type']},'raw':!![]});}})[_0x614f('0x1a')](function(_0x2a5224){if(_0x3f036d[_0x614f('0x38')]['toUpperCase']()==_0x614f('0x56')){var _0x50da54=fs[_0x614f('0x57')](path[_0x614f('0x58')](config[_0x614f('0x59')],_0x614f('0x67')),_0x614f('0x5a'));var _0x1909f2=ejs['render'](_0x50da54,{'networks':_0x2a5224||[]});fs['writeFileSync'](_0x614f('0x5c'),_0x1909f2);return respondWithRpcPromise(_0x614f('0x5d'),_0x614f('0x30'),{'module':_0x614f('0x5e')});}else if(_0x3f036d[_0x614f('0x38')][_0x614f('0x55')]()==_0x614f('0x5f')){var _0x2ab0a3=fs[_0x614f('0x57')](path['join'](config[_0x614f('0x59')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x5daf04=ejs[_0x614f('0x5b')](_0x2ab0a3,{'networks':_0x2a5224||[]});fs[_0x614f('0x61')](_0x614f('0x68'),_0x5daf04);return respondWithRpcPromise('Reload',_0x614f('0x30'),{'module':_0x614f('0x5e')});}else{var _0x2d368c=fs['readFileSync'](path[_0x614f('0x58')](config[_0x614f('0x59')],'server/files/templates/network.ejs'),_0x614f('0x5a'));var _0x13f9e6=ejs[_0x614f('0x5b')](_0x2d368c,{'networks':_0x2a5224||[]});fs['writeFileSync'](util[_0x614f('0x63')](_0x614f('0x69'),_0xfa9903['body'][_0x614f('0x38')]['toLowerCase']()),_0x13f9e6);return respondWithRpcPromise(_0x614f('0x5d'),'destroy',{'module':_0x614f('0x65')});}return null;})['catch'](handleError(_0x4a4de0,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 8dc4255..5fa55c3 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 _0x5ec6=['network','lodash','util','../../config/logger','moment','request-promise','rimraf','./network.attributes','Network'];(function(_0x29352f,_0x458a13){var _0x217e89=function(_0x54ec85){while(--_0x54ec85){_0x29352f['push'](_0x29352f['shift']());}};_0x217e89(++_0x458a13);}(_0x5ec6,0x7f));var _0x65ec=function(_0x3592cb,_0x3b1ca3){_0x3592cb=_0x3592cb-0x0;var _0x1ec291=_0x5ec6[_0x3592cb];return _0x1ec291;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var logger=require(_0x65ec('0x2'))('api');var moment=require(_0x65ec('0x3'));var BPromise=require('bluebird');var rp=require(_0x65ec('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x65ec('0x5'));var config=require('../../config/environment');var attributes=require(_0x65ec('0x6'));module['exports']=function(_0x2fc973,_0xbb2e56){return _0x2fc973['define'](_0x65ec('0x7'),attributes,{'tableName':_0x65ec('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bb0=['exports','define','Network','lodash','util','../../config/logger','moment','path','../../config/environment','./network.attributes'];(function(_0x147554,_0x5f061d){var _0xd3806d=function(_0x34f856){while(--_0x34f856){_0x147554['push'](_0x147554['shift']());}};_0xd3806d(++_0x5f061d);}(_0x2bb0,0xf3));var _0x02bb=function(_0x4e2c64,_0x5fc4b9){_0x4e2c64=_0x4e2c64-0x0;var _0x853289=_0x2bb0[_0x4e2c64];return _0x853289;};'use strict';var _=require(_0x02bb('0x0'));var util=require(_0x02bb('0x1'));var logger=require(_0x02bb('0x2'))('api');var moment=require(_0x02bb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x02bb('0x4'));var rimraf=require('rimraf');var config=require(_0x02bb('0x5'));var attributes=require(_0x02bb('0x6'));module[_0x02bb('0x7')]=function(_0x390ff7,_0x43dbb7){return _0x390ff7[_0x02bb('0x8')](_0x02bb('0x9'),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 957bd24..a3380ea 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x154257,_0x4bd86b){var _0x2bac70=function(_0x22cdcc){while(--_0x22cdcc){_0x154257['push'](_0x154257['shift']());}};_0x2bac70(++_0x4bd86b);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x2a51e1,_0x598ce1){_0x2a51e1=_0x2a51e1-0x0;var _0x4dcfb5=_0x7a54[_0x2a51e1];return _0x4dcfb5;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 2914705..37aa03d 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 _0x9059=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','getAgents','create','post','addDisposition','/:id/notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeAnswers','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2c8328,_0x21548a){var _0x10a892=function(_0xf5c587){while(--_0xf5c587){_0x2c8328['push'](_0x2c8328['shift']());}};_0x10a892(++_0x21548a);}(_0x9059,0x77));var _0x9905=function(_0x4abb36,_0x22c779){_0x4abb36=_0x4abb36-0x0;var _0xd32caf=_0x9059[_0x4abb36];return _0xd32caf;};'use strict';var multer=require(_0x9905('0x0'));var util=require(_0x9905('0x1'));var path=require(_0x9905('0x2'));var timeout=require(_0x9905('0x3'));var express=require(_0x9905('0x4'));var router=express[_0x9905('0x5')]();var fs_extra=require(_0x9905('0x6'));var auth=require(_0x9905('0x7'));var interaction=require(_0x9905('0x8'));var config=require(_0x9905('0x9'));var controller=require(_0x9905('0xa'));router[_0x9905('0xb')]('/',auth[_0x9905('0xc')](),controller[_0x9905('0xd')]);router['get'](_0x9905('0xe'),auth[_0x9905('0xc')](),controller[_0x9905('0xf')]);router[_0x9905('0xb')](_0x9905('0x10'),auth['isAuthenticated'](),controller[_0x9905('0x11')]);router[_0x9905('0xb')](_0x9905('0x12'),auth[_0x9905('0xc')](),controller[_0x9905('0x13')]);router[_0x9905('0xb')](_0x9905('0x14'),auth[_0x9905('0xc')](),controller[_0x9905('0x15')]);router[_0x9905('0xb')]('/:id/applications',auth[_0x9905('0xc')](),controller[_0x9905('0x16')]);router['get'](_0x9905('0x17'),auth[_0x9905('0xc')](),controller[_0x9905('0x18')]);router[_0x9905('0xb')]('/:id/users',auth[_0x9905('0xc')](),controller[_0x9905('0x19')]);router['post']('/',auth[_0x9905('0xc')](),controller[_0x9905('0x1a')]);router[_0x9905('0x1b')](_0x9905('0x12'),auth[_0x9905('0xc')](),controller[_0x9905('0x1c')]);router[_0x9905('0x1b')](_0x9905('0x14'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x9905('0x1b')](_0x9905('0x1d'),controller['notify']);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x9905('0x1e')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x9905('0x1f')]);router[_0x9905('0x1b')](_0x9905('0x20'),auth[_0x9905('0xc')](),controller[_0x9905('0x21')]);router[_0x9905('0x22')](_0x9905('0x10'),auth[_0x9905('0xc')](),controller[_0x9905('0x23')]);router[_0x9905('0x24')](_0x9905('0x10'),auth['isAuthenticated'](),controller[_0x9905('0x25')]);router[_0x9905('0x24')](_0x9905('0x12'),auth[_0x9905('0xc')](),controller['removeDispositions']);router[_0x9905('0x24')]('/:id/canned_answers',auth[_0x9905('0xc')](),controller[_0x9905('0x26')]);router['delete'](_0x9905('0x27'),auth[_0x9905('0xc')](),controller[_0x9905('0x28')]);module[_0x9905('0x29')]=router; \ No newline at end of file +var _0xde38=['send','put','update','delete','removeDispositions','removeAnswers','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','getAgents','post','create','addDisposition','notify','/:id/users','/:id/send'];(function(_0x5426e4,_0x22189e){var _0x138e24=function(_0x35ede2){while(--_0x35ede2){_0x5426e4['push'](_0x5426e4['shift']());}};_0x138e24(++_0x22189e);}(_0xde38,0xfc));var _0x8de3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde38[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8de3('0x0'));var util=require('util');var path=require(_0x8de3('0x1'));var timeout=require(_0x8de3('0x2'));var express=require('express');var router=express[_0x8de3('0x3')]();var fs_extra=require(_0x8de3('0x4'));var auth=require(_0x8de3('0x5'));var interaction=require(_0x8de3('0x6'));var config=require(_0x8de3('0x7'));var controller=require('./openchannelAccount.controller');router[_0x8de3('0x8')]('/',auth['isAuthenticated'](),controller[_0x8de3('0x9')]);router[_0x8de3('0x8')]('/describe',auth[_0x8de3('0xa')](),controller[_0x8de3('0xb')]);router[_0x8de3('0x8')](_0x8de3('0xc'),auth[_0x8de3('0xa')](),controller[_0x8de3('0xd')]);router[_0x8de3('0x8')](_0x8de3('0xe'),auth['isAuthenticated'](),controller[_0x8de3('0xf')]);router[_0x8de3('0x8')](_0x8de3('0x10'),auth['isAuthenticated'](),controller[_0x8de3('0x11')]);router[_0x8de3('0x8')]('/:id/applications',auth[_0x8de3('0xa')](),controller[_0x8de3('0x12')]);router[_0x8de3('0x8')](_0x8de3('0x13'),auth[_0x8de3('0xa')](),controller[_0x8de3('0x14')]);router['get']('/:id/users',auth[_0x8de3('0xa')](),controller[_0x8de3('0x15')]);router[_0x8de3('0x16')]('/',auth[_0x8de3('0xa')](),controller[_0x8de3('0x17')]);router['post'](_0x8de3('0xe'),auth[_0x8de3('0xa')](),controller[_0x8de3('0x18')]);router[_0x8de3('0x16')](_0x8de3('0x10'),auth[_0x8de3('0xa')](),controller['addAnswer']);router[_0x8de3('0x16')]('/:id/notify',controller[_0x8de3('0x19')]);router[_0x8de3('0x16')]('/:id/applications',auth[_0x8de3('0xa')](),controller['addApplications']);router['post'](_0x8de3('0x1a'),auth['isAuthenticated'](),controller['addAgents']);router[_0x8de3('0x16')](_0x8de3('0x1b'),auth[_0x8de3('0xa')](),controller[_0x8de3('0x1c')]);router[_0x8de3('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0x8de3('0x1e')]);router[_0x8de3('0x1f')](_0x8de3('0xc'),auth[_0x8de3('0xa')](),controller['destroy']);router[_0x8de3('0x1f')](_0x8de3('0xe'),auth['isAuthenticated'](),controller[_0x8de3('0x20')]);router['delete'](_0x8de3('0x10'),auth[_0x8de3('0xa')](),controller[_0x8de3('0x21')]);router[_0x8de3('0x1f')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x8de3('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 422d721..e47eac6 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 _0x0663=['exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring'];(function(_0x17a114,_0xdc8a5c){var _0x9fd649=function(_0x5f5452){while(--_0x5f5452){_0x17a114['push'](_0x17a114['shift']());}};_0x9fd649(++_0xdc8a5c);}(_0x0663,0x18a));var _0x3066=function(_0xf9e67a,_0x55be97){_0xf9e67a=_0xf9e67a-0x0;var _0x30e578=_0x0663[_0xf9e67a];return _0x30e578;};'use strict';var Sequelize=require(_0x3066('0x0'));var rs=require(_0x3066('0x1'));module[_0x3066('0x2')]={'name':{'type':Sequelize[_0x3066('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x3066('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x3066('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3066('0x5')],'defaultValue':function(){return _0x3066('0x6');}},'notificationSound':{'type':Sequelize[_0x3066('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3066('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x3066('0x3')]},'queueTransfer':{'type':Sequelize[_0x3066('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3066('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3066('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3066('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3066('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x3066('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x3066('0x7')],'defaultValue':![],'comment':_0x3066('0xa'),'set':function(_0x6d7afb){if(!_0x6d7afb)this[_0x3066('0xb')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x6d7afb);}}}; \ No newline at end of file +var _0xb30c=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x4dcf1d,_0xd74d17){var _0x2f273a=function(_0x281c9f){while(--_0x281c9f){_0x4dcf1d['push'](_0x4dcf1d['shift']());}};_0x2f273a(++_0xd74d17);}(_0xb30c,0x95));var _0xcb30=function(_0x21f93b,_0x593743){_0x21f93b=_0x21f93b-0x0;var _0x4b120a=_0xb30c[_0x21f93b];return _0x4b120a;};'use strict';var Sequelize=require(_0xcb30('0x0'));var rs=require('randomstring');module[_0xcb30('0x1')]={'name':{'type':Sequelize[_0xcb30('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xcb30('0x2')]},'token':{'type':Sequelize[_0xcb30('0x2')],'defaultValue':function(){return rs[_0xcb30('0x3')]();}},'replyUri':{'type':Sequelize[_0xcb30('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xcb30('0x4')],'defaultValue':function(){return _0xcb30('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcb30('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcb30('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xcb30('0x2')]},'queueTransfer':{'type':Sequelize[_0xcb30('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcb30('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcb30('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcb30('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xcb30('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xcb30('0x9'),'set':function(_0x38ede7){if(!_0x38ede7)this['setDataValue'](_0xcb30('0xa'),null);this[_0xcb30('0xb')](_0xcb30('0xc'),_0x38ede7);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index b6298a0..79c1eed 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 _0x1e6b=['getDispositions','findOne','hasOwnProperty','sort','pick','removeDispositions','ids','addAnswer','CannedAnswer','rows','removeAnswers','notify','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','applications','list','orderBy','account','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','addApplications','transaction','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','emit','getAgents','send','out','Messages','dataValues','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','destroy','OpenchannelAccounts','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','where','filters','merge','filter','includeAll','include','findAll','show','rawAttributes','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','Disposition'];(function(_0x5030a4,_0x897564){var _0x34594e=function(_0x13d1e5){while(--_0x13d1e5){_0x5030a4['push'](_0x5030a4['shift']());}};_0x34594e(++_0x897564);}(_0x1e6b,0x1dc));var _0xb1e6=function(_0x384b9b,_0x44f02a){_0x384b9b=_0x384b9b-0x0;var _0x1a911c=_0x1e6b[_0x384b9b];return _0x1a911c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1e6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1e6('0x1'));var rp=require(_0xb1e6('0x2'));var moment=require(_0xb1e6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb1e6('0x4'));var util=require(_0xb1e6('0x5'));var path=require(_0xb1e6('0x6'));var sox=require(_0xb1e6('0x7'));var csv=require('to-csv');var ejs=require(_0xb1e6('0x8'));var fs=require('fs');var fs_extra=require(_0xb1e6('0x9'));var _=require(_0xb1e6('0xa'));var squel=require(_0xb1e6('0xb'));var crypto=require('crypto');var jsforce=require(_0xb1e6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb1e6('0xd'));var Papa=require(_0xb1e6('0xe'));var Redis=require(_0xb1e6('0xf'));var authService=require(_0xb1e6('0x10'));var qs=require(_0xb1e6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb1e6('0x12'));var utils=require(_0xb1e6('0x13'));var config=require(_0xb1e6('0x14'));var licenseUtil=require(_0xb1e6('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb1e6('0x16')](config[_0xb1e6('0x17')],{'host':_0xb1e6('0x18'),'port':0x18eb});var socket=require(_0xb1e6('0x19'))(new Redis(config[_0xb1e6('0x17')]));require('./openchannelAccount.socket')[_0xb1e6('0x1a')](socket);var jayson=require(_0xb1e6('0x1b'));var client=jayson[_0xb1e6('0x1c')][_0xb1e6('0x1d')]({'port':0x232c});var client9002=jayson[_0xb1e6('0x1c')][_0xb1e6('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x433036,_0x4ac651,_0x9be51e,_0x1218a1){return new BPromise(function(_0x1a7592,_0xba33e3){var _0x357b0a=_0x1218a1||client;return _0x357b0a[_0xb1e6('0x1e')](_0x433036,_0x9be51e)[_0xb1e6('0x1f')](function(_0x26ac48){logger['info'](_0xb1e6('0x20'),_0x4ac651,_0xb1e6('0x21'));logger[_0xb1e6('0x22')](_0xb1e6('0x23'),_0x4ac651,'request\x20sent',JSON[_0xb1e6('0x24')](_0x26ac48));if(_0x26ac48[_0xb1e6('0x25')]){if(_0x26ac48[_0xb1e6('0x25')][_0xb1e6('0x26')]===0x1f4){logger[_0xb1e6('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x4ac651,_0x26ac48[_0xb1e6('0x25')]['message']);return _0xba33e3(_0x26ac48[_0xb1e6('0x25')]['message']);}logger[_0xb1e6('0x25')](_0xb1e6('0x20'),_0x4ac651,_0x26ac48[_0xb1e6('0x25')]['message']);return _0x1a7592(_0x26ac48[_0xb1e6('0x25')][_0xb1e6('0x27')]);}else{logger[_0xb1e6('0x28')](_0xb1e6('0x20'),_0x4ac651,'request\x20sent');_0x1a7592(_0x26ac48['result'][_0xb1e6('0x27')]);}})[_0xb1e6('0x29')](function(_0x55fd8b){logger[_0xb1e6('0x25')](_0xb1e6('0x20'),_0x4ac651,_0x55fd8b);_0xba33e3(_0x55fd8b);});});}function respondWithStatusCode(_0x11417f,_0x3e6be8){_0x3e6be8=_0x3e6be8||0xcc;return function(_0x26f0ff){if(_0x26f0ff){return _0x11417f[_0xb1e6('0x2a')](_0x3e6be8);}return _0x11417f[_0xb1e6('0x2b')](_0x3e6be8)[_0xb1e6('0x2c')]();};}function respondWithResult(_0xa888bf,_0x4b311e){_0x4b311e=_0x4b311e||0xc8;return function(_0x306264){if(_0x306264){return _0xa888bf[_0xb1e6('0x2b')](_0x4b311e)['json'](_0x306264);}};}function respondWithFilteredResult(_0x503f3d,_0x5caf1a){return function(_0x998f46){if(_0x998f46){var _0x4b3b38=typeof _0x5caf1a[_0xb1e6('0x2d')]==='undefined'&&typeof _0x5caf1a[_0xb1e6('0x2e')]===_0xb1e6('0x2f');var _0x1c652b=_0x998f46[_0xb1e6('0x30')];var _0x5acd5f=_0x4b3b38?0x0:_0x5caf1a['offset'];var _0x6b8c9c=_0x4b3b38?_0x998f46[_0xb1e6('0x30')]:_0x5caf1a['offset']+_0x5caf1a['limit'];var _0x9e6b5;if(_0x6b8c9c>=_0x1c652b){_0x6b8c9c=_0x1c652b;_0x9e6b5=0xc8;}else{_0x9e6b5=0xce;}_0x503f3d[_0xb1e6('0x2b')](_0x9e6b5);return _0x503f3d[_0xb1e6('0x31')](_0xb1e6('0x32'),_0x5acd5f+'-'+_0x6b8c9c+'/'+_0x1c652b)[_0xb1e6('0x33')](_0x998f46);}return null;};}function patchUpdates(_0x36fd8a){return function(_0x86533c){try{jsonpatch['apply'](_0x86533c,_0x36fd8a,!![]);}catch(_0x1bef76){return BPromise[_0xb1e6('0x34')](_0x1bef76);}return _0x86533c[_0xb1e6('0x35')]();};}function saveUpdates(_0x258b30,_0x3940ed){return function(_0x3126a1){if(_0x3126a1){return _0x3126a1[_0xb1e6('0x36')](_0x258b30)[_0xb1e6('0x1f')](function(_0x11c0d6){return _0x11c0d6;});}return null;};}function removeEntity(_0x506399,_0x3f4d2b){return function(_0x2e254b){if(_0x2e254b){return _0x2e254b[_0xb1e6('0x37')]()[_0xb1e6('0x1f')](function(){var _0x436ce6=_0x2e254b['get']({'plain':!![]});var _0x3b0bd1=_0xb1e6('0x38');return db['UserProfileResource'][_0xb1e6('0x37')]({'where':{'type':_0x3b0bd1,'resourceId':_0x436ce6['id']}})['then'](function(){return _0x2e254b;});})['then'](function(){_0x506399[_0xb1e6('0x2b')](0xcc)[_0xb1e6('0x2c')]();});}};}function handleEntityNotFound(_0x270f10,_0x57488b){return function(_0x2523cc){if(!_0x2523cc){_0x270f10[_0xb1e6('0x2a')](0x194);}return _0x2523cc;};}function handleError(_0x287d79,_0x563b12){_0x563b12=_0x563b12||0x1f4;return function(_0x5fe5c1){logger['error'](_0x5fe5c1[_0xb1e6('0x39')]);if(_0x5fe5c1[_0xb1e6('0x3a')]){delete _0x5fe5c1[_0xb1e6('0x3a')];}_0x287d79['status'](_0x563b12)['send'](_0x5fe5c1);};}exports[_0xb1e6('0x3b')]=function(_0x3456cf,_0x320b7f){var _0x5f4e94={'include':[{'model':db[_0xb1e6('0x3c')],'as':_0xb1e6('0x3d')}]},_0x265e5e={},_0x4f613f={'count':0x0,'rows':[]};var _0x2a0598=_[_0xb1e6('0x3e')](db[_0xb1e6('0x3f')]['rawAttributes'],function(_0x2a9bdc){return{'name':_0x2a9bdc['fieldName'],'type':_0x2a9bdc[_0xb1e6('0x40')][_0xb1e6('0x41')]};});_0x265e5e[_0xb1e6('0x42')]=_[_0xb1e6('0x3e')](_0x2a0598,_0xb1e6('0x3a'));_0x265e5e[_0xb1e6('0x43')]=_[_0xb1e6('0x44')](_0x3456cf[_0xb1e6('0x43')]);_0x265e5e['filters']=_[_0xb1e6('0x45')](_0x265e5e[_0xb1e6('0x42')],_0x265e5e[_0xb1e6('0x43')]);_0x5f4e94[_0xb1e6('0x46')]=_[_0xb1e6('0x45')](_0x265e5e[_0xb1e6('0x42')],qs['fields'](_0x3456cf[_0xb1e6('0x43')][_0xb1e6('0x47')]));_0x5f4e94[_0xb1e6('0x46')]=_0x5f4e94[_0xb1e6('0x46')][_0xb1e6('0x48')]?_0x5f4e94[_0xb1e6('0x46')]:_0x265e5e[_0xb1e6('0x42')];if(!_0x3456cf[_0xb1e6('0x43')]['hasOwnProperty'](_0xb1e6('0x49'))){_0x5f4e94[_0xb1e6('0x2e')]=qs[_0xb1e6('0x2e')](_0x3456cf['query'][_0xb1e6('0x2e')]);_0x5f4e94[_0xb1e6('0x2d')]=qs[_0xb1e6('0x2d')](_0x3456cf['query'][_0xb1e6('0x2d')]);}_0x5f4e94[_0xb1e6('0x4a')]=qs['sort'](_0x3456cf[_0xb1e6('0x43')]['sort']);_0x5f4e94[_0xb1e6('0x4b')]=qs[_0xb1e6('0x4c')](_['pick'](_0x3456cf['query'],_0x265e5e['filters']),_0x2a0598);if(_0x3456cf['query']['filter']){_0x5f4e94[_0xb1e6('0x4b')]=_[_0xb1e6('0x4d')](_0x5f4e94['where'],{'$or':_[_0xb1e6('0x3e')](_0x2a0598,function(_0x2f80d1){if(_0x2f80d1[_0xb1e6('0x40')]!=='VIRTUAL'){var _0x4b7751={};_0x4b7751[_0x2f80d1[_0xb1e6('0x3a')]]={'$like':'%'+_0x3456cf[_0xb1e6('0x43')][_0xb1e6('0x4e')]+'%'};return _0x4b7751;}})});}_0x5f4e94=_[_0xb1e6('0x4d')]({},_0x5f4e94,_0x3456cf['options']);var _0x27fb55={'where':_0x5f4e94['where']};return db[_0xb1e6('0x3f')][_0xb1e6('0x30')](_0x27fb55)['then'](function(_0x2e72c1){_0x4f613f['count']=_0x2e72c1;if(_0x3456cf[_0xb1e6('0x43')][_0xb1e6('0x4f')]){_0x5f4e94[_0xb1e6('0x50')]=[{'all':!![]}];}return db[_0xb1e6('0x3f')][_0xb1e6('0x51')](_0x5f4e94);})[_0xb1e6('0x1f')](function(_0x499c92){_0x4f613f['rows']=_0x499c92;return _0x4f613f;})[_0xb1e6('0x1f')](respondWithFilteredResult(_0x320b7f,_0x5f4e94))['catch'](handleError(_0x320b7f,null));};exports[_0xb1e6('0x52')]=function(_0x2962f8,_0x4b427e){var _0x1f728c={'raw':![],'where':{'id':_0x2962f8['params']['id']},'include':[{'model':db['Pause'],'as':_0xb1e6('0x3d')}]},_0x17e8ad={};_0x17e8ad['model']=_['keys'](db[_0xb1e6('0x3f')][_0xb1e6('0x53')]);_0x17e8ad[_0xb1e6('0x43')]=_[_0xb1e6('0x44')](_0x2962f8[_0xb1e6('0x43')]);_0x17e8ad['filters']=_[_0xb1e6('0x45')](_0x17e8ad['model'],_0x17e8ad['query']);_0x1f728c[_0xb1e6('0x46')]=_[_0xb1e6('0x45')](_0x17e8ad[_0xb1e6('0x42')],qs['fields'](_0x2962f8[_0xb1e6('0x43')]['fields']));_0x1f728c[_0xb1e6('0x46')]=_0x1f728c['attributes'][_0xb1e6('0x48')]?_0x1f728c[_0xb1e6('0x46')]:_0x17e8ad[_0xb1e6('0x42')];if(_0x2962f8[_0xb1e6('0x43')]['includeAll']){_0x1f728c[_0xb1e6('0x50')]=[{'all':!![]}];}_0x1f728c=_[_0xb1e6('0x4d')]({},_0x1f728c,_0x2962f8[_0xb1e6('0x54')]);return db[_0xb1e6('0x3f')]['find'](_0x1f728c)[_0xb1e6('0x1f')](handleEntityNotFound(_0x4b427e,null))[_0xb1e6('0x1f')](respondWithResult(_0x4b427e,null))[_0xb1e6('0x29')](handleError(_0x4b427e,null));};exports[_0xb1e6('0x55')]=function(_0x48778,_0x558c78){return db[_0xb1e6('0x3f')][_0xb1e6('0x55')](_0x48778[_0xb1e6('0x56')],{})[_0xb1e6('0x1f')](function(_0x5a805f){var _0x18af4a=_0x48778[_0xb1e6('0x57')][_0xb1e6('0x58')]({'plain':!![]});if(!_0x18af4a)throw new Error(_0xb1e6('0x59'));if(_0x18af4a[_0xb1e6('0x5a')]==='user'){var _0xeb2d17=_0x5a805f[_0xb1e6('0x58')]({'plain':!![]});var _0x1632f2=_0xb1e6('0x38');return db['UserProfileSection'][_0xb1e6('0x5b')]({'where':{'name':_0x1632f2,'userProfileId':_0x18af4a[_0xb1e6('0x5c')]},'raw':!![]})[_0xb1e6('0x1f')](function(_0x343800){if(_0x343800&&_0x343800[_0xb1e6('0x5d')]===0x0){return db['UserProfileResource'][_0xb1e6('0x55')]({'name':_0xeb2d17['name'],'resourceId':_0xeb2d17['id'],'type':_0x343800[_0xb1e6('0x3a')],'sectionId':_0x343800['id']},{})['then'](function(){return _0x5a805f;});}else{return _0x5a805f;}})[_0xb1e6('0x29')](function(_0xdc4b13){logger[_0xb1e6('0x25')](_0xb1e6('0x5e'),_0xdc4b13);throw _0xdc4b13;});}return _0x5a805f;})[_0xb1e6('0x1f')](respondWithResult(_0x558c78,0xc9))[_0xb1e6('0x29')](handleError(_0x558c78,null));};exports[_0xb1e6('0x36')]=function(_0x4fc02e,_0x41ddd7){if(_0x4fc02e[_0xb1e6('0x56')]['id']){delete _0x4fc02e['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x4fc02e[_0xb1e6('0x5f')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xb1e6('0x1f')](handleEntityNotFound(_0x41ddd7,null))['then'](saveUpdates(_0x4fc02e[_0xb1e6('0x56')],null))['then'](respondWithResult(_0x41ddd7,null))[_0xb1e6('0x29')](handleError(_0x41ddd7,null));};exports[_0xb1e6('0x37')]=function(_0x525d88,_0xd910d1){return db[_0xb1e6('0x3f')][_0xb1e6('0x5b')]({'where':{'id':_0x525d88[_0xb1e6('0x5f')]['id']}})['then'](handleEntityNotFound(_0xd910d1,null))['then'](removeEntity(_0xd910d1,null))[_0xb1e6('0x29')](handleError(_0xd910d1,null));};exports[_0xb1e6('0x60')]=function(_0x76f11f,_0x947f9f){return db[_0xb1e6('0x3f')][_0xb1e6('0x60')]()[_0xb1e6('0x1f')](respondWithResult(_0x947f9f,null))['catch'](handleError(_0x947f9f,null));};exports[_0xb1e6('0x61')]=function(_0x42f713,_0x57a736,_0x56abeb){if(_0x42f713[_0xb1e6('0x56')]['id']){delete _0x42f713[_0xb1e6('0x56')]['id'];}return db['OpenchannelAccount'][_0xb1e6('0x5b')]({'where':{'id':_0x42f713['params']['id']}})[_0xb1e6('0x1f')](handleEntityNotFound(_0x57a736,null))[_0xb1e6('0x1f')](function(_0x53fd28){if(_0x53fd28){_0x42f713[_0xb1e6('0x56')][_0xb1e6('0x62')]=_0x53fd28['id'];return db[_0xb1e6('0x63')]['create'](_0x42f713[_0xb1e6('0x56')]);}})[_0xb1e6('0x1f')](respondWithResult(_0x57a736,null))['catch'](handleError(_0x57a736,null));};exports[_0xb1e6('0x64')]=function(_0x21ff46,_0x13e1ae,_0x598523){var _0x53918f={'raw':![],'where':{}};var _0x56de57={};var _0x2a47bc={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xb1e6('0x65')]({'where':{'id':_0x21ff46[_0xb1e6('0x5f')]['id']}})[_0xb1e6('0x1f')](handleEntityNotFound(_0x13e1ae,null))[_0xb1e6('0x1f')](function(_0x47737b){if(_0x47737b){_0x56de57[_0xb1e6('0x42')]=_[_0xb1e6('0x44')](db[_0xb1e6('0x63')]['rawAttributes']);_0x56de57[_0xb1e6('0x43')]=_['keys'](_0x21ff46[_0xb1e6('0x43')]);_0x56de57[_0xb1e6('0x4c')]=_[_0xb1e6('0x45')](_0x56de57[_0xb1e6('0x42')],_0x56de57[_0xb1e6('0x43')]);_0x53918f[_0xb1e6('0x46')]=_[_0xb1e6('0x45')](_0x56de57[_0xb1e6('0x42')],qs[_0xb1e6('0x47')](_0x21ff46[_0xb1e6('0x43')]['fields']));_0x53918f[_0xb1e6('0x46')]=_0x53918f[_0xb1e6('0x46')][_0xb1e6('0x48')]?_0x53918f[_0xb1e6('0x46')]:_0x56de57[_0xb1e6('0x42')];if(!_0x21ff46['query'][_0xb1e6('0x66')]('nolimit')){_0x53918f[_0xb1e6('0x2e')]=qs[_0xb1e6('0x2e')](_0x21ff46[_0xb1e6('0x43')]['limit']);_0x53918f[_0xb1e6('0x2d')]=qs['offset'](_0x21ff46[_0xb1e6('0x43')][_0xb1e6('0x2d')]);}_0x53918f[_0xb1e6('0x4a')]=qs[_0xb1e6('0x67')](_0x21ff46[_0xb1e6('0x43')]['sort']);_0x53918f[_0xb1e6('0x4b')]=qs['filters'](_[_0xb1e6('0x68')](_0x21ff46[_0xb1e6('0x43')],_0x56de57[_0xb1e6('0x4c')]));_0x53918f[_0xb1e6('0x4b')][_0xb1e6('0x62')]=_0x47737b['id'];if(_0x21ff46[_0xb1e6('0x43')][_0xb1e6('0x4e')]){_0x53918f[_0xb1e6('0x4b')]=_[_0xb1e6('0x4d')](_0x53918f[_0xb1e6('0x4b')],{'$or':_[_0xb1e6('0x3e')](_0x53918f[_0xb1e6('0x46')],function(_0x4c0329){var _0x3abb40={};_0x3abb40[_0x4c0329]={'$like':'%'+_0x21ff46['query'][_0xb1e6('0x4e')]+'%'};return _0x3abb40;})});}_0x53918f=_['merge']({},_0x53918f,_0x21ff46[_0xb1e6('0x54')]);return db['Disposition'][_0xb1e6('0x30')]({'where':_0x53918f['where']})[_0xb1e6('0x1f')](function(_0x168d37){_0x2a47bc['count']=_0x168d37;if(_0x21ff46[_0xb1e6('0x43')][_0xb1e6('0x4f')]){_0x53918f[_0xb1e6('0x50')]=[{'all':!![]}];}return db['Disposition'][_0xb1e6('0x51')](_0x53918f);})[_0xb1e6('0x1f')](function(_0x54bb34){_0x2a47bc['rows']=_0x54bb34;return _0x2a47bc;});}})['then'](respondWithFilteredResult(_0x13e1ae,_0x53918f))['catch'](handleError(_0x13e1ae,null));};exports[_0xb1e6('0x69')]=function(_0x101cef,_0x252d0f,_0xec11f3){return db[_0xb1e6('0x3f')][_0xb1e6('0x5b')]({'where':{'id':_0x101cef['params']['id']}})[_0xb1e6('0x1f')](handleEntityNotFound(_0x252d0f,null))[_0xb1e6('0x1f')](function(_0x25c2ab){if(_0x25c2ab){return _0x25c2ab[_0xb1e6('0x69')](_0x101cef['query'][_0xb1e6('0x6a')]);}})[_0xb1e6('0x1f')](respondWithStatusCode(_0x252d0f,null))[_0xb1e6('0x29')](handleError(_0x252d0f,null));};exports[_0xb1e6('0x6b')]=function(_0x567b55,_0x57b7f8,_0x1b373d){if(_0x567b55[_0xb1e6('0x56')]['id']){delete _0x567b55['body']['id'];}return db[_0xb1e6('0x3f')]['find']({'where':{'id':_0x567b55[_0xb1e6('0x5f')]['id']}})[_0xb1e6('0x1f')](handleEntityNotFound(_0x57b7f8,null))[_0xb1e6('0x1f')](function(_0x8be3ac){if(_0x8be3ac){_0x567b55['body']['OpenchannelAccountId']=_0x8be3ac['id'];return db['CannedAnswer'][_0xb1e6('0x55')](_0x567b55[_0xb1e6('0x56')]);}})[_0xb1e6('0x1f')](respondWithResult(_0x57b7f8,null))[_0xb1e6('0x29')](handleError(_0x57b7f8,null));};exports['getAnswers']=function(_0x4ca10e,_0x2cd5d8,_0x2764bc){var _0x40e712={'raw':![],'where':{}};var _0x49f53c={};var _0x42997d={'count':0x0,'rows':[]};return db[_0xb1e6('0x3f')][_0xb1e6('0x65')]({'where':{'id':_0x4ca10e[_0xb1e6('0x5f')]['id']}})[_0xb1e6('0x1f')](handleEntityNotFound(_0x2cd5d8,null))[_0xb1e6('0x1f')](function(_0x4250f8){if(_0x4250f8){_0x49f53c['model']=_[_0xb1e6('0x44')](db[_0xb1e6('0x6c')][_0xb1e6('0x53')]);_0x49f53c[_0xb1e6('0x43')]=_[_0xb1e6('0x44')](_0x4ca10e[_0xb1e6('0x43')]);_0x49f53c['filters']=_[_0xb1e6('0x45')](_0x49f53c['model'],_0x49f53c[_0xb1e6('0x43')]);_0x40e712['attributes']=_['intersection'](_0x49f53c[_0xb1e6('0x42')],qs[_0xb1e6('0x47')](_0x4ca10e[_0xb1e6('0x43')]['fields']));_0x40e712[_0xb1e6('0x46')]=_0x40e712[_0xb1e6('0x46')]['length']?_0x40e712[_0xb1e6('0x46')]:_0x49f53c[_0xb1e6('0x42')];if(!_0x4ca10e[_0xb1e6('0x43')]['hasOwnProperty'](_0xb1e6('0x49'))){_0x40e712[_0xb1e6('0x2e')]=qs[_0xb1e6('0x2e')](_0x4ca10e[_0xb1e6('0x43')][_0xb1e6('0x2e')]);_0x40e712[_0xb1e6('0x2d')]=qs[_0xb1e6('0x2d')](_0x4ca10e[_0xb1e6('0x43')][_0xb1e6('0x2d')]);}_0x40e712[_0xb1e6('0x4a')]=qs[_0xb1e6('0x67')](_0x4ca10e[_0xb1e6('0x43')][_0xb1e6('0x67')]);_0x40e712[_0xb1e6('0x4b')]=qs['filters'](_[_0xb1e6('0x68')](_0x4ca10e[_0xb1e6('0x43')],_0x49f53c[_0xb1e6('0x4c')]));_0x40e712['where']['OpenchannelAccountId']=_0x4250f8['id'];if(_0x4ca10e['query'][_0xb1e6('0x4e')]){_0x40e712[_0xb1e6('0x4b')]=_[_0xb1e6('0x4d')](_0x40e712[_0xb1e6('0x4b')],{'$or':_[_0xb1e6('0x3e')](_0x40e712['attributes'],function(_0x46f6b3){var _0xd3136={};_0xd3136[_0x46f6b3]={'$like':'%'+_0x4ca10e['query'][_0xb1e6('0x4e')]+'%'};return _0xd3136;})});}_0x40e712=_[_0xb1e6('0x4d')]({},_0x40e712,_0x4ca10e[_0xb1e6('0x54')]);return db['CannedAnswer'][_0xb1e6('0x30')]({'where':_0x40e712['where']})[_0xb1e6('0x1f')](function(_0x46755e){_0x42997d['count']=_0x46755e;if(_0x4ca10e[_0xb1e6('0x43')][_0xb1e6('0x4f')]){_0x40e712[_0xb1e6('0x50')]=[{'all':!![]}];}return db[_0xb1e6('0x6c')][_0xb1e6('0x51')](_0x40e712);})['then'](function(_0x4c8dd4){_0x42997d[_0xb1e6('0x6d')]=_0x4c8dd4;return _0x42997d;});}})['then'](respondWithFilteredResult(_0x2cd5d8,_0x40e712))[_0xb1e6('0x29')](handleError(_0x2cd5d8,null));};exports[_0xb1e6('0x6e')]=function(_0x27fe15,_0x2c4b83,_0x5434d7){return db[_0xb1e6('0x3f')][_0xb1e6('0x5b')]({'where':{'id':_0x27fe15[_0xb1e6('0x5f')]['id']}})[_0xb1e6('0x1f')](handleEntityNotFound(_0x2c4b83,null))['then'](function(_0x42b61a){if(_0x42b61a){return _0x42b61a[_0xb1e6('0x6e')](_0x27fe15[_0xb1e6('0x43')][_0xb1e6('0x6a')]);}})['then'](respondWithStatusCode(_0x2c4b83,null))[_0xb1e6('0x29')](handleError(_0x2c4b83,null));};exports[_0xb1e6('0x6f')]=function(_0x3635d8,_0x558f28,_0x1cdb01){var _0x44bf00={'body':_0x3635d8['body'],'channel':'openchannel'};var _0x448939=[];var _0x245609=[];var _0x3ac630={};var _0x1c0920=![];return db[_0xb1e6('0x70')][_0xb1e6('0x60')]()[_0xb1e6('0x1f')](function(_0x4a0dd8){if(!_0x4a0dd8){throw new db['Sequelize'][(_0xb1e6('0x71'))](_0xb1e6('0x72'));}_0x448939=_[_0xb1e6('0x73')](_[_0xb1e6('0x44')](_0x4a0dd8),['createdAt','updatedAt']);_0x245609=_[_0xb1e6('0x73')](_['keys'](_0x4a0dd8),[_0xb1e6('0x74'),_0xb1e6('0x75'),_0xb1e6('0x76'),_0xb1e6('0x77')]);if(_0x3635d8[_0xb1e6('0x56')]['id']){delete _0x3635d8['body']['id'];}if(_[_0xb1e6('0x78')](_0x3635d8['body'][_0xb1e6('0x79')])){throw new db[(_0xb1e6('0x7a'))]['ValidationError'](_0xb1e6('0x7b'));}if(_[_0xb1e6('0x78')](_0x3635d8[_0xb1e6('0x56')][_0xb1e6('0x56')])||_0x3635d8[_0xb1e6('0x56')][_0xb1e6('0x56')]===''){throw new db[(_0xb1e6('0x7a'))][(_0xb1e6('0x71'))](_0xb1e6('0x7c'));}if(_[_0xb1e6('0x78')](_0x3635d8['body'][_0xb1e6('0x7d')])){throw new db['Sequelize']['ValidationError'](_0xb1e6('0x7e')+_0x245609);}if(!_[_0xb1e6('0x7f')](_0x245609,_0x3635d8[_0xb1e6('0x56')]['mapKey'])){throw new db[(_0xb1e6('0x7a'))][(_0xb1e6('0x71'))](_0xb1e6('0x80')+_0x245609);}_0x3ac630[_0x3635d8[_0xb1e6('0x56')]['mapKey']]=_0x3635d8[_0xb1e6('0x56')][_0xb1e6('0x79')];})[_0xb1e6('0x1f')](function(){return db['OpenchannelAccount'][_0xb1e6('0x5b')]({'where':{'id':_0x3635d8['params']['id']},'include':[{'model':db[_0xb1e6('0x81')],'as':_0xb1e6('0x82'),'include':[{'model':db[_0xb1e6('0x70')],'as':_0xb1e6('0x83'),'where':_0x3ac630,'limit':0x1,'order':[['updatedAt',_0xb1e6('0x84')]]}]},{'model':db[_0xb1e6('0x85')],'as':_0xb1e6('0x86')}]});})['then'](handleEntityNotFound(_0x558f28,null))[_0xb1e6('0x1f')](function(_0x19c9a6){if(_0x19c9a6&&_0x19c9a6['List']){_0x44bf00['account']=_0x19c9a6;_0x44bf00[_0xb1e6('0x87')]=_0x19c9a6[_0xb1e6('0x86')];_0x44bf00[_0xb1e6('0x88')]=_0x19c9a6[_0xb1e6('0x82')];_0x44bf00[_0xb1e6('0x87')]=_[_0xb1e6('0x89')](_0x44bf00[_0xb1e6('0x87')],['priority'],['asc']);if(_0x44bf00[_0xb1e6('0x8a')][_0xb1e6('0x86')]){delete _0x44bf00[_0xb1e6('0x8a')][_0xb1e6('0x86')];}if(_0x44bf00[_0xb1e6('0x8a')]['List']&&_0x44bf00['account']['List'][_0xb1e6('0x83')][_0xb1e6('0x48')]){return _0x44bf00[_0xb1e6('0x8a')][_0xb1e6('0x82')][_0xb1e6('0x83')][0x0];}var _0x4a8867=_[_0xb1e6('0x16')](_0x3635d8[_0xb1e6('0x56')],{'firstName':_0x3635d8[_0xb1e6('0x56')]['from'],'ListId':_0x19c9a6['ListId']});_0x4a8867[_0x3635d8[_0xb1e6('0x56')]['mapKey']]=_0x3635d8['body'][_0xb1e6('0x79')];return db[_0xb1e6('0x70')][_0xb1e6('0x55')](_0x4a8867,{'fields':_0x448939,'raw':!![]});}})[_0xb1e6('0x1f')](handleEntityNotFound(_0x558f28,null))[_0xb1e6('0x1f')](function(_0x172f2e){_0x44bf00[_0xb1e6('0x8b')]=_0x172f2e;if(_0x172f2e){var _0x315299={'ContactId':_0x172f2e['id'],'OpenchannelAccountId':_0x3635d8[_0xb1e6('0x5f')]['id'],'from':(_0x172f2e[_0xb1e6('0x8c')]||'')+'\x20'+(_0x172f2e[_0xb1e6('0x8d')]||'')};var _0x2dbca0={'OpenchannelAccountId':_0x3635d8[_0xb1e6('0x5f')]['id'],'closed':![]};if(_0x3635d8[_0xb1e6('0x56')][_0xb1e6('0x8e')]){_0x2dbca0[_0xb1e6('0x8e')]=_0x3635d8['body'][_0xb1e6('0x8e')];return db[_0xb1e6('0x8f')][_0xb1e6('0x5b')]({'where':_0x2dbca0})[_0xb1e6('0x1f')](function(_0x20dda1){if(_0x20dda1){return[_0x20dda1,![]];}_0x315299['threadId']=_0x3635d8[_0xb1e6('0x56')]['threadId'];_0x315299['externalUrl']=_0x3635d8[_0xb1e6('0x56')][_0xb1e6('0x90')];return db[_0xb1e6('0x8f')][_0xb1e6('0x55')](_0x315299)[_0xb1e6('0x1f')](function(_0x494547){return[_0x494547,!![]];});});}else{_0x2dbca0[_0xb1e6('0x8e')]=null;}_0x2dbca0[_0xb1e6('0x91')]=_0x172f2e['id'];return db[_0xb1e6('0x8f')][_0xb1e6('0x5b')]({'where':_0x2dbca0})[_0xb1e6('0x1f')](function(_0x5adcf4){if(_0x5adcf4){return[_0x5adcf4,![]];}return db[_0xb1e6('0x8f')][_0xb1e6('0x55')](_0x315299)[_0xb1e6('0x1f')](function(_0x1a17ff){return[_0x1a17ff,!![]];});});}})[_0xb1e6('0x92')](function(_0x59c8d9,_0x5e2154){if(_0x59c8d9){_0x1c0920=_0x5e2154;if(!_0x5e2154){var _0x56b0c2={'from':(_0x44bf00[_0xb1e6('0x8b')]['firstName']||'')+'\x20'+(_0x44bf00['contact'][_0xb1e6('0x8d')]||'')};if(_0x3635d8[_0xb1e6('0x56')][_0xb1e6('0x8e')]&&_0x3635d8[_0xb1e6('0x56')][_0xb1e6('0x93')]&&_0x3635d8['body'][_0xb1e6('0x8e')]!=_0x3635d8[_0xb1e6('0x56')][_0xb1e6('0x93')]){_0x56b0c2[_0xb1e6('0x8e')]=_0x3635d8[_0xb1e6('0x56')][_0xb1e6('0x93')];}return _0x59c8d9[_0xb1e6('0x36')](_0x56b0c2);}else{return _0x59c8d9;}}})[_0xb1e6('0x1f')](function(_0x3b1d98){_0x44bf00[_0xb1e6('0x94')]=_0x3b1d98[_0xb1e6('0x58')]({'plain':!![]});_0x44bf00[_0xb1e6('0x94')][_0xb1e6('0x95')]=_0x1c0920;if(_0x44bf00[_0xb1e6('0x94')][_0xb1e6('0x95')]){if(_0x44bf00['account'][_0xb1e6('0x96')]){_0x44bf00[_0xb1e6('0x87')][_0xb1e6('0x97')]({'id':0x0,'priority':_0x44bf00['applications'][_0xb1e6('0x48')]+0x1,'app':_0xb1e6('0x98'),'appdata':_0xb1e6('0x99'),'interval':_0xb1e6('0x9a')});}}return db[_0xb1e6('0x9b')][_0xb1e6('0x55')]({'body':_0x3635d8[_0xb1e6('0x56')][_0xb1e6('0x56')],'OpenchannelAccountId':_0x3635d8[_0xb1e6('0x5f')]['id'],'OpenchannelInteractionId':_0x3b1d98['id'],'direction':'in','ContactId':_0x44bf00[_0xb1e6('0x8b')]['id'],'AttachmentId':_0x3635d8[_0xb1e6('0x56')][_0xb1e6('0x9c')]});})[_0xb1e6('0x1f')](function(_0x100db7){_0x44bf00['message']=_0x100db7;if(_0x44bf00[_0xb1e6('0x94')][_0xb1e6('0x9d')]){return db[_0xb1e6('0x9e')]['find']({'attributes':['id',_0xb1e6('0x3a')],'where':{'id':_0x44bf00[_0xb1e6('0x94')][_0xb1e6('0x9d')]}})[_0xb1e6('0x1f')](function(_0x35c54b){if(_0x35c54b){_0x44bf00[_0xb1e6('0x87')][_0xb1e6('0x9f')]({'id':0x0,'priority':0x0,'app':_0xb1e6('0xa0'),'appdata':_0x35c54b[_0xb1e6('0x3a')]+','+(_0x44bf00[_0xb1e6('0x8a')][_0xb1e6('0xa1')]||0xa),'interval':_0xb1e6('0x9a')});_0x44bf00['forcedOwnership']=![];}return respondWithRpcPromise(_0xb1e6('0xa2'),_0xb1e6('0xa3'),_0x44bf00);});}return respondWithRpcPromise('Start','startRouting',_0x44bf00);})[_0xb1e6('0x1f')](function(_0x439a98){respondWithRpcPromise(_0xb1e6('0xa4'),'EventManager',{'event':_0xb1e6('0x6f'),'message':_0x439a98},client9002);return _0x439a98;})['then'](respondWithResult(_0x558f28,null))[_0xb1e6('0x29')](handleError(_0x558f28,null));};exports[_0xb1e6('0xa5')]=function(_0x598dc3,_0x11bf10,_0x9717c3){return db[_0xb1e6('0x3f')][_0xb1e6('0x65')]({'where':{'id':_0x598dc3[_0xb1e6('0x5f')]['id']}})['then'](handleEntityNotFound(_0x11bf10,null))['then'](function(_0x599657){if(_0x599657){return db['sequelize'][_0xb1e6('0xa6')](function(_0x92c9b){return db[_0xb1e6('0x85')]['destroy']({'where':{'OpenchannelAccountId':_0x598dc3[_0xb1e6('0x5f')]['id']},'transaction':_0x92c9b})['then'](function(_0x5543b2){var _0x1674b5=_['map'](_0x598dc3['body'],function(_0x4dec89){_0x4dec89[_0xb1e6('0x62')]=_0x598dc3['params']['id'];return _0x4dec89;});return db[_0xb1e6('0x85')][_0xb1e6('0xa7')](_0x1674b5,{'transaction':_0x92c9b});});})[_0xb1e6('0x1f')](function(){return db[_0xb1e6('0x85')][_0xb1e6('0xa8')]({'where':{'OpenchannelAccountId':_0x598dc3[_0xb1e6('0x5f')]['id']},'order':_0xb1e6('0xa9')});});}})['then'](respondWithResult(_0x11bf10,null))['catch'](handleError(_0x11bf10,null));};exports[_0xb1e6('0xaa')]=function(_0x10724b,_0x39983b,_0xbb4d86){var _0x3b2252={};var _0x5987ba={};var _0x1f43ad;var _0x48f586;return db['OpenchannelAccount'][_0xb1e6('0x65')]({'where':{'id':_0x10724b[_0xb1e6('0x5f')]['id']}})[_0xb1e6('0x1f')](handleEntityNotFound(_0x39983b,null))['then'](function(_0x10b677){if(_0x10b677){_0x1f43ad=_0x10b677;_0x5987ba[_0xb1e6('0x42')]=_[_0xb1e6('0x44')](db['OpenchannelApplication'][_0xb1e6('0x53')]);_0x5987ba[_0xb1e6('0x43')]=_[_0xb1e6('0x44')](_0x10724b[_0xb1e6('0x43')]);_0x5987ba['filters']=_['intersection'](_0x5987ba[_0xb1e6('0x42')],_0x5987ba[_0xb1e6('0x43')]);_0x3b2252['attributes']=_[_0xb1e6('0x45')](_0x5987ba[_0xb1e6('0x42')],qs[_0xb1e6('0x47')](_0x10724b[_0xb1e6('0x43')][_0xb1e6('0x47')]));_0x3b2252[_0xb1e6('0x46')]=_0x3b2252[_0xb1e6('0x46')][_0xb1e6('0x48')]?_0x3b2252[_0xb1e6('0x46')]:_0x5987ba[_0xb1e6('0x42')];_0x3b2252[_0xb1e6('0x4a')]=qs['sort'](_0x10724b[_0xb1e6('0x43')][_0xb1e6('0x67')]);_0x3b2252[_0xb1e6('0x4b')]=qs[_0xb1e6('0x4c')](_[_0xb1e6('0x68')](_0x10724b['query'],_0x5987ba['filters']));if(_0x10724b[_0xb1e6('0x43')][_0xb1e6('0x4e')]){_0x3b2252[_0xb1e6('0x4b')]=_['merge'](_0x3b2252['where'],{'$or':_['map'](_0x3b2252[_0xb1e6('0x46')],function(_0x17a37e){var _0xbed532={};_0xbed532[_0x17a37e]={'$like':'%'+_0x10724b[_0xb1e6('0x43')][_0xb1e6('0x4e')]+'%'};return _0xbed532;})});}_0x3b2252=_[_0xb1e6('0x4d')]({},_0x3b2252,_0x10724b[_0xb1e6('0x54')]);return _0x1f43ad[_0xb1e6('0xaa')](_0x3b2252);}})[_0xb1e6('0x1f')](function(_0x288f50){if(_0x288f50){_0x48f586=_0x288f50['length'];if(!_0x10724b[_0xb1e6('0x43')][_0xb1e6('0x66')](_0xb1e6('0x49'))){_0x3b2252[_0xb1e6('0x2e')]=qs[_0xb1e6('0x2e')](_0x10724b[_0xb1e6('0x43')][_0xb1e6('0x2e')]);_0x3b2252[_0xb1e6('0x2d')]=qs['offset'](_0x10724b['query']['offset']);}return _0x1f43ad[_0xb1e6('0xaa')](_0x3b2252);}})[_0xb1e6('0x1f')](function(_0x5abc37){if(_0x5abc37){return _0x5abc37?{'count':_0x48f586,'rows':_0x5abc37}:null;}})[_0xb1e6('0x1f')](respondWithResult(_0x39983b,null))['catch'](handleError(_0x39983b,null));};exports[_0xb1e6('0xab')]=function(_0x5d530e,_0x304d3c,_0x1f9628){var _0x155727={'raw':![],'where':{}};var _0x2aef7b={};var _0x53b987={'count':0x0,'rows':[]};return db[_0xb1e6('0x3f')][_0xb1e6('0x65')]({'where':{'id':_0x5d530e[_0xb1e6('0x5f')]['id']}})[_0xb1e6('0x1f')](handleEntityNotFound(_0x304d3c,null))[_0xb1e6('0x1f')](function(_0x133d13){if(_0x133d13){_0x2aef7b['model']=_[_0xb1e6('0x44')](db[_0xb1e6('0x8f')]['rawAttributes']);_0x2aef7b[_0xb1e6('0x43')]=_['keys'](_0x5d530e[_0xb1e6('0x43')]);_0x2aef7b[_0xb1e6('0x4c')]=_[_0xb1e6('0x45')](_0x2aef7b['model'],_0x2aef7b[_0xb1e6('0x43')]);_0x155727[_0xb1e6('0x46')]=_[_0xb1e6('0x45')](_0x2aef7b['model'],qs[_0xb1e6('0x47')](_0x5d530e['query'][_0xb1e6('0x47')]));_0x155727['attributes']=_0x155727[_0xb1e6('0x46')][_0xb1e6('0x48')]?_0x155727['attributes']:_0x2aef7b['model'];if(!_0x5d530e[_0xb1e6('0x43')][_0xb1e6('0x66')](_0xb1e6('0x49'))){_0x155727[_0xb1e6('0x2e')]=qs[_0xb1e6('0x2e')](_0x5d530e[_0xb1e6('0x43')]['limit']);_0x155727[_0xb1e6('0x2d')]=qs[_0xb1e6('0x2d')](_0x5d530e[_0xb1e6('0x43')][_0xb1e6('0x2d')]);}_0x155727['order']=qs[_0xb1e6('0x67')](_0x5d530e[_0xb1e6('0x43')][_0xb1e6('0x67')]);_0x155727[_0xb1e6('0x4b')]=qs[_0xb1e6('0x4c')](_[_0xb1e6('0x68')](_0x5d530e[_0xb1e6('0x43')],_0x2aef7b[_0xb1e6('0x4c')]));_0x155727[_0xb1e6('0x4b')][_0xb1e6('0x62')]=_0x133d13['id'];if(_0x5d530e[_0xb1e6('0x43')][_0xb1e6('0x4e')]){_0x155727[_0xb1e6('0x4b')]=_[_0xb1e6('0x4d')](_0x155727['where'],{'$or':_[_0xb1e6('0x3e')](_0x155727[_0xb1e6('0x46')],function(_0x419123){var _0x1d4c50={};_0x1d4c50[_0x419123]={'$like':'%'+_0x5d530e[_0xb1e6('0x43')][_0xb1e6('0x4e')]+'%'};return _0x1d4c50;})});}_0x155727=_['merge']({},_0x155727,_0x5d530e[_0xb1e6('0x54')]);return db[_0xb1e6('0x8f')][_0xb1e6('0x30')]({'where':_0x155727[_0xb1e6('0x4b')]})[_0xb1e6('0x1f')](function(_0x53a652){_0x53b987[_0xb1e6('0x30')]=_0x53a652;if(_0x5d530e[_0xb1e6('0x43')][_0xb1e6('0x4f')]){_0x155727['include']=[{'model':db[_0xb1e6('0x70')],'as':_0xb1e6('0xac'),'required':![]},{'model':db[_0xb1e6('0x9e')],'as':_0xb1e6('0xad'),'attributes':['name',_0xb1e6('0xae'),_0xb1e6('0xaf')],'required':![]},{'model':db[_0xb1e6('0xb0')],'as':_0xb1e6('0xb1'),'attributes':['id',_0xb1e6('0x3a'),_0xb1e6('0xb2')],'where':_0x5d530e['query']['tag']?{'id':_0x5d530e[_0xb1e6('0x43')][_0xb1e6('0xb3')]}:undefined,'required':_0x5d530e[_0xb1e6('0x43')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xb1e6('0x51')](_0x155727);})['then'](function(_0x388608){_0x53b987[_0xb1e6('0x6d')]=_0x388608;return _0x53b987;});}})[_0xb1e6('0x1f')](respondWithFilteredResult(_0x304d3c,_0x155727))[_0xb1e6('0x29')](handleError(_0x304d3c,null));};exports[_0xb1e6('0xb4')]=function(_0x57867a,_0x7060ce,_0x5e66fe){return db[_0xb1e6('0x3f')][_0xb1e6('0x5b')]({'where':{'id':_0x57867a[_0xb1e6('0x5f')]['id']}})['then'](handleEntityNotFound(_0x7060ce,null))[_0xb1e6('0x1f')](function(_0x52c7a5){if(_0x52c7a5){return _0x52c7a5[_0xb1e6('0xb4')](_0x57867a['body'][_0xb1e6('0x6a')],_[_0xb1e6('0xb5')](_0x57867a['body'],[_0xb1e6('0x6a'),'id'])||{})[_0xb1e6('0x92')](function(_0x5bb975){for(var _0x2e40a3=0x0;_0x2e40a3<_0x57867a['body']['ids'][_0xb1e6('0x48')];_0x2e40a3+=0x1){socket['emit'](_0xb1e6('0xb6'),{'UserId':Number(_0x57867a[_0xb1e6('0x56')][_0xb1e6('0x6a')][_0x2e40a3]),'OpenchannelAccountId':Number(_0x57867a['params']['id'])});}return _0x5bb975;});}})[_0xb1e6('0x1f')](respondWithResult(_0x7060ce,null))[_0xb1e6('0x29')](handleError(_0x7060ce,null));};exports[_0xb1e6('0xb7')]=function(_0x11e46d,_0x152980,_0x9b9d88){return db[_0xb1e6('0x3f')][_0xb1e6('0x5b')]({'where':{'id':_0x11e46d[_0xb1e6('0x5f')]['id']}})['then'](handleEntityNotFound(_0x152980,null))[_0xb1e6('0x1f')](function(_0x3ab55f){if(_0x3ab55f){return _0x3ab55f[_0xb1e6('0xb7')](_0x11e46d[_0xb1e6('0x43')]['ids'])[_0xb1e6('0x1f')](function(){if(_[_0xb1e6('0xb8')](_0x11e46d[_0xb1e6('0x43')][_0xb1e6('0x6a')])){for(var _0x55ad2d=0x0;_0x55ad2d<_0x11e46d[_0xb1e6('0x43')]['ids'][_0xb1e6('0x48')];_0x55ad2d+=0x1){socket['emit'](_0xb1e6('0xb9'),{'UserId':Number(_0x11e46d[_0xb1e6('0x43')][_0xb1e6('0x6a')][_0x55ad2d]),'OpenchannelAccountId':Number(_0x11e46d[_0xb1e6('0x5f')]['id'])});}}else{socket[_0xb1e6('0xba')](_0xb1e6('0xb9'),{'UserId':Number(_0x11e46d[_0xb1e6('0x43')]['ids']),'OpenchannelAccountId':Number(_0x11e46d[_0xb1e6('0x5f')]['id'])});}});}})[_0xb1e6('0x1f')](respondWithStatusCode(_0x152980,null))[_0xb1e6('0x29')](handleError(_0x152980,null));};exports[_0xb1e6('0xbb')]=function(_0x106057,_0x5f3d67,_0x187b58){var _0x398251={};var _0x5ad9dd={};var _0x462e74;var _0x1bc870;return db[_0xb1e6('0x3f')]['findOne']({'where':{'id':_0x106057[_0xb1e6('0x5f')]['id']}})[_0xb1e6('0x1f')](handleEntityNotFound(_0x5f3d67,null))['then'](function(_0x55ca5a){if(_0x55ca5a){_0x462e74=_0x55ca5a;_0x5ad9dd[_0xb1e6('0x42')]=_['keys'](db['User'][_0xb1e6('0x53')]);_0x5ad9dd[_0xb1e6('0x43')]=_[_0xb1e6('0x44')](_0x106057[_0xb1e6('0x43')]);_0x5ad9dd[_0xb1e6('0x4c')]=_[_0xb1e6('0x45')](_0x5ad9dd[_0xb1e6('0x42')],_0x5ad9dd[_0xb1e6('0x43')]);_0x398251['attributes']=_[_0xb1e6('0x45')](_0x5ad9dd[_0xb1e6('0x42')],qs[_0xb1e6('0x47')](_0x106057[_0xb1e6('0x43')][_0xb1e6('0x47')]));_0x398251['attributes']=_0x398251['attributes'][_0xb1e6('0x48')]?_0x398251['attributes']:_0x5ad9dd['model'];_0x398251[_0xb1e6('0x4a')]=qs['sort'](_0x106057[_0xb1e6('0x43')][_0xb1e6('0x67')]);_0x398251[_0xb1e6('0x4b')]=qs[_0xb1e6('0x4c')](_[_0xb1e6('0x68')](_0x106057[_0xb1e6('0x43')],_0x5ad9dd[_0xb1e6('0x4c')]));if(_0x106057[_0xb1e6('0x43')][_0xb1e6('0x4e')]){_0x398251['where']=_[_0xb1e6('0x4d')](_0x398251[_0xb1e6('0x4b')],{'$or':_['map'](_0x398251[_0xb1e6('0x46')],function(_0x216ae7){var _0x1a1958={};_0x1a1958[_0x216ae7]={'$like':'%'+_0x106057[_0xb1e6('0x43')][_0xb1e6('0x4e')]+'%'};return _0x1a1958;})});}_0x398251=_[_0xb1e6('0x4d')]({},_0x398251,_0x106057[_0xb1e6('0x54')]);return _0x462e74[_0xb1e6('0xbb')](_0x398251);}})[_0xb1e6('0x1f')](function(_0x1def14){if(_0x1def14){_0x1bc870=_0x1def14[_0xb1e6('0x48')];if(!_0x106057['query'][_0xb1e6('0x66')](_0xb1e6('0x49'))){_0x398251[_0xb1e6('0x2e')]=qs[_0xb1e6('0x2e')](_0x106057[_0xb1e6('0x43')]['limit']);_0x398251[_0xb1e6('0x2d')]=qs[_0xb1e6('0x2d')](_0x106057[_0xb1e6('0x43')]['offset']);}return _0x462e74['getAgents'](_0x398251);}})[_0xb1e6('0x1f')](function(_0x53d78a){if(_0x53d78a){return _0x53d78a?{'count':_0x1bc870,'rows':_0x53d78a}:null;}})['then'](respondWithResult(_0x5f3d67,null))['catch'](handleError(_0x5f3d67,null));};exports[_0xb1e6('0xbc')]=function(_0x598f8b,_0xdc579c,_0x57a9b0){var _0x3c6c90,_0x3e1ea7,_0x502628;if(_[_0xb1e6('0x78')](_0x598f8b[_0xb1e6('0x56')][_0xb1e6('0x56')])||_0x598f8b['body'][_0xb1e6('0x56')]===''){throw new db[(_0xb1e6('0x7a'))]['ValidationError'](_0xb1e6('0x7c'));}if(_[_0xb1e6('0x78')](_0x598f8b[_0xb1e6('0x56')]['to'])){}_0x3c6c90=_0x598f8b['body']['to'];return db['OpenchannelAccount'][_0xb1e6('0x65')]({'where':{'id':_0x598f8b[_0xb1e6('0x5f')]['id']}})[_0xb1e6('0x1f')](handleEntityNotFound(_0xdc579c,null))[_0xb1e6('0x1f')](function(_0x3f2dd4){if(_0x3f2dd4){return db[_0xb1e6('0x3f')][_0xb1e6('0x5b')]({'where':{'id':_0x3f2dd4['id']},'include':[{'model':db[_0xb1e6('0x81')],'as':_0xb1e6('0x82'),'include':[{'model':db[_0xb1e6('0x70')],'as':'Contacts','where':{[_0x3f2dd4['mapKey']]:_0x3c6c90},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xb1e6('0x1f')](handleEntityNotFound(_0xdc579c,null))[_0xb1e6('0x1f')](function(_0x82447c){if(_0x82447c&&_0x82447c[_0xb1e6('0x82')]){_0x3e1ea7=_0x82447c['get']({'plain':!![]});if(_0x3e1ea7[_0xb1e6('0x82')]&&_0x3e1ea7[_0xb1e6('0x82')][_0xb1e6('0x83')][_0xb1e6('0x48')]){return _0x3e1ea7[_0xb1e6('0x82')][_0xb1e6('0x83')][0x0];}return db[_0xb1e6('0x70')][_0xb1e6('0x55')](_[_0xb1e6('0x16')](_0x598f8b[_0xb1e6('0x56')],{'firstName':_0x3c6c90,[_0x82447c[_0xb1e6('0x7d')]]:_0x3c6c90,'phone':_0x3c6c90,'ListId':_0x3e1ea7[_0xb1e6('0x77')]}));}})['then'](handleEntityNotFound(_0xdc579c,null))['then'](function(_0x402070){if(_0x402070){_0x502628=_0x402070;return db[_0xb1e6('0x8f')][_0xb1e6('0x5b')]({'where':{'ContactId':_0x502628['id'],'closed':![],'OpenchannelAccountId':_0x3e1ea7['id']}})[_0xb1e6('0x1f')](function(_0x5a945e){if(_0x5a945e){return[_0x5a945e,![]];}return db[_0xb1e6('0x8f')][_0xb1e6('0x55')]({'UserId':_0x598f8b[_0xb1e6('0x57')]['id'],'ContactId':_0x502628['id'],'OpenchannelAccountId':_0x3e1ea7['id'],'lastMsgDirection':_0xb1e6('0xbd'),'Messages':[_[_0xb1e6('0x4d')](_0x598f8b[_0xb1e6('0x56')],{'read':![],'body':_0x598f8b[_0xb1e6('0x56')][_0xb1e6('0x56')],'OpenchannelAccountId':_0x3e1ea7['id'],'UserId':_0x598f8b['user']['id'],'ContactId':_0x502628['id']})]},{'include':[{'model':db[_0xb1e6('0x9b')],'as':_0xb1e6('0xbe')}]})['then'](function(_0xde3744){return[_0xde3744,!![]];});});}})[_0xb1e6('0x92')](function(_0x37bf20,_0x13139c){if(_0x13139c){return _0x37bf20;}return db['OpenchannelMessage']['create'](_[_0xb1e6('0x4d')](_0x598f8b[_0xb1e6('0x56')],{'read':![],'body':_0x598f8b['body'][_0xb1e6('0x56')],'OpenchannelAccountId':_0x3e1ea7['id'],'OpenchannelInteractionId':_0x37bf20['id'],'UserId':_0x598f8b[_0xb1e6('0x57')]['id'],'ContactId':_0x502628['id']}))[_0xb1e6('0x1f')](function(_0x3437c5){_0x37bf20['dataValues'][_0xb1e6('0xbe')]=[];_0x37bf20[_0xb1e6('0xbf')][_0xb1e6('0xbe')][_0xb1e6('0x97')](_0x3437c5['dataValues']);return _0x37bf20;});});}})[_0xb1e6('0x1f')](respondWithResult(_0xdc579c,null))[_0xb1e6('0x29')](handleError(_0xdc579c,null));}; \ No newline at end of file +var _0x9593=['order','sort','where','filter','merge','VIRTUAL','options','OpenchannelAccount','findAll','rows','catch','show','params','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','OpenchannelAccountId','Disposition','getDispositions','intersection','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','hasOwnProperty','removeAnswers','notify','ValidationError','difference','createdAt','updatedAt','ListId','from','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','Applications','applications','list','orderBy','asc','account','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','autoclose','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','OpenchannelApplication','bulkCreate','getApplications','getInteractions','fullname','internal','Tag','Tags','color','tag','userOpenchannelAccount:save','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','stack','status','send','Pause','mandatoryDispositionPause','map','rawAttributes','type','model','name','query','keys','filters','fields','attributes','length','nolimit'];(function(_0x5617e2,_0x1ffcd7){var _0x27b60d=function(_0xf3f7a2){while(--_0xf3f7a2){_0x5617e2['push'](_0x5617e2['shift']());}};_0x27b60d(++_0x1ffcd7);}(_0x9593,0x126));var _0x3959=function(_0x28e2cd,_0x153b42){_0x28e2cd=_0x28e2cd-0x0;var _0x11fd46=_0x9593[_0x28e2cd];return _0x11fd46;};'use strict';var emlformat=require(_0x3959('0x0'));var rimraf=require(_0x3959('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3959('0x2'));var rp=require('request-promise');var moment=require(_0x3959('0x3'));var BPromise=require(_0x3959('0x4'));var Mustache=require('mustache');var util=require(_0x3959('0x5'));var path=require(_0x3959('0x6'));var sox=require(_0x3959('0x7'));var csv=require(_0x3959('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3959('0x9'));var _=require(_0x3959('0xa'));var squel=require(_0x3959('0xb'));var crypto=require(_0x3959('0xc'));var jsforce=require(_0x3959('0xd'));var deskjs=require(_0x3959('0xe'));var toCsv=require(_0x3959('0x8'));var querystring=require(_0x3959('0xf'));var Papa=require(_0x3959('0x10'));var Redis=require(_0x3959('0x11'));var authService=require(_0x3959('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3959('0x13'));var hardwareService=require(_0x3959('0x14'));var logger=require(_0x3959('0x15'))(_0x3959('0x16'));var utils=require('../../config/utils');var config=require(_0x3959('0x17'));var licenseUtil=require(_0x3959('0x18'));var db=require(_0x3959('0x19'))['db'];config[_0x3959('0x1a')]=_[_0x3959('0x1b')](config[_0x3959('0x1a')],{'host':_0x3959('0x1c'),'port':0x18eb});var socket=require(_0x3959('0x1d'))(new Redis(config[_0x3959('0x1a')]));require(_0x3959('0x1e'))[_0x3959('0x1f')](socket);var jayson=require(_0x3959('0x20'));var client=jayson['client'][_0x3959('0x21')]({'port':0x232c});var client9002=jayson[_0x3959('0x22')][_0x3959('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x2abde7,_0x687f1e,_0x4a0b11,_0x42bb9e){return new BPromise(function(_0x59427a,_0xe74e33){var _0x5821b8=_0x42bb9e||client;return _0x5821b8[_0x3959('0x23')](_0x2abde7,_0x4a0b11)[_0x3959('0x24')](function(_0xfe6bbb){logger[_0x3959('0x25')](_0x3959('0x26'),_0x687f1e,'request\x20sent');logger[_0x3959('0x27')](_0x3959('0x28'),_0x687f1e,_0x3959('0x29'),JSON[_0x3959('0x2a')](_0xfe6bbb));if(_0xfe6bbb['error']){if(_0xfe6bbb[_0x3959('0x2b')][_0x3959('0x2c')]===0x1f4){logger[_0x3959('0x2b')](_0x3959('0x26'),_0x687f1e,_0xfe6bbb['error'][_0x3959('0x2d')]);return _0xe74e33(_0xfe6bbb[_0x3959('0x2b')]['message']);}logger[_0x3959('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x687f1e,_0xfe6bbb[_0x3959('0x2b')][_0x3959('0x2d')]);return _0x59427a(_0xfe6bbb[_0x3959('0x2b')][_0x3959('0x2d')]);}else{logger[_0x3959('0x25')](_0x3959('0x26'),_0x687f1e,'request\x20sent');_0x59427a(_0xfe6bbb['result'][_0x3959('0x2d')]);}})['catch'](function(_0x3b3597){logger[_0x3959('0x2b')](_0x3959('0x26'),_0x687f1e,_0x3b3597);_0xe74e33(_0x3b3597);});});}function respondWithStatusCode(_0x1fe996,_0x330817){_0x330817=_0x330817||0xcc;return function(_0x14d32d){if(_0x14d32d){return _0x1fe996[_0x3959('0x2e')](_0x330817);}return _0x1fe996['status'](_0x330817)[_0x3959('0x2f')]();};}function respondWithResult(_0x10cb92,_0x323b26){_0x323b26=_0x323b26||0xc8;return function(_0x2b0f33){if(_0x2b0f33){return _0x10cb92['status'](_0x323b26)[_0x3959('0x30')](_0x2b0f33);}};}function respondWithFilteredResult(_0x598043,_0x35b21c){return function(_0x1edc1c){if(_0x1edc1c){var _0xdb0e0b=typeof _0x35b21c[_0x3959('0x31')]==='undefined'&&typeof _0x35b21c[_0x3959('0x32')]===_0x3959('0x33');var _0x5929ad=_0x1edc1c['count'];var _0x238cda=_0xdb0e0b?0x0:_0x35b21c[_0x3959('0x31')];var _0x4da782=_0xdb0e0b?_0x1edc1c[_0x3959('0x34')]:_0x35b21c[_0x3959('0x31')]+_0x35b21c[_0x3959('0x32')];var _0x5afa3e;if(_0x4da782>=_0x5929ad){_0x4da782=_0x5929ad;_0x5afa3e=0xc8;}else{_0x5afa3e=0xce;}_0x598043['status'](_0x5afa3e);return _0x598043[_0x3959('0x35')](_0x3959('0x36'),_0x238cda+'-'+_0x4da782+'/'+_0x5929ad)[_0x3959('0x30')](_0x1edc1c);}return null;};}function patchUpdates(_0x15cfb9){return function(_0x40e65c){try{jsonpatch['apply'](_0x40e65c,_0x15cfb9,!![]);}catch(_0x45c59b){return BPromise[_0x3959('0x37')](_0x45c59b);}return _0x40e65c[_0x3959('0x38')]();};}function saveUpdates(_0xcd4e6d,_0x39759e){return function(_0xd086f4){if(_0xd086f4){return _0xd086f4[_0x3959('0x39')](_0xcd4e6d)['then'](function(_0x5eae20){return _0x5eae20;});}return null;};}function removeEntity(_0xfb62a0,_0x236c1b){return function(_0x52c82b){if(_0x52c82b){return _0x52c82b[_0x3959('0x3a')]()[_0x3959('0x24')](function(){var _0x1015a3=_0x52c82b['get']({'plain':!![]});var _0x923fdf=_0x3959('0x3b');return db[_0x3959('0x3c')][_0x3959('0x3a')]({'where':{'type':_0x923fdf,'resourceId':_0x1015a3['id']}})[_0x3959('0x24')](function(){return _0x52c82b;});})['then'](function(){_0xfb62a0['status'](0xcc)[_0x3959('0x2f')]();});}};}function handleEntityNotFound(_0x4a8815,_0x1c8bd2){return function(_0x37abc8){if(!_0x37abc8){_0x4a8815[_0x3959('0x2e')](0x194);}return _0x37abc8;};}function handleError(_0x5bd7e9,_0x27bfdf){_0x27bfdf=_0x27bfdf||0x1f4;return function(_0x20231e){logger[_0x3959('0x2b')](_0x20231e[_0x3959('0x3d')]);if(_0x20231e['name']){delete _0x20231e['name'];}_0x5bd7e9[_0x3959('0x3e')](_0x27bfdf)[_0x3959('0x3f')](_0x20231e);};}exports['index']=function(_0x5e9d32,_0x43116d){var _0x3ae659={'include':[{'model':db[_0x3959('0x40')],'as':_0x3959('0x41')}]},_0x547779={},_0x57ed99={'count':0x0,'rows':[]};var _0x20dd76=_[_0x3959('0x42')](db['OpenchannelAccount'][_0x3959('0x43')],function(_0x3dfb98){return{'name':_0x3dfb98['fieldName'],'type':_0x3dfb98[_0x3959('0x44')]['key']};});_0x547779[_0x3959('0x45')]=_[_0x3959('0x42')](_0x20dd76,_0x3959('0x46'));_0x547779[_0x3959('0x47')]=_[_0x3959('0x48')](_0x5e9d32[_0x3959('0x47')]);_0x547779[_0x3959('0x49')]=_['intersection'](_0x547779[_0x3959('0x45')],_0x547779[_0x3959('0x47')]);_0x3ae659['attributes']=_['intersection'](_0x547779['model'],qs[_0x3959('0x4a')](_0x5e9d32['query']['fields']));_0x3ae659[_0x3959('0x4b')]=_0x3ae659[_0x3959('0x4b')][_0x3959('0x4c')]?_0x3ae659[_0x3959('0x4b')]:_0x547779[_0x3959('0x45')];if(!_0x5e9d32[_0x3959('0x47')]['hasOwnProperty'](_0x3959('0x4d'))){_0x3ae659[_0x3959('0x32')]=qs['limit'](_0x5e9d32[_0x3959('0x47')][_0x3959('0x32')]);_0x3ae659['offset']=qs[_0x3959('0x31')](_0x5e9d32[_0x3959('0x47')]['offset']);}_0x3ae659[_0x3959('0x4e')]=qs[_0x3959('0x4f')](_0x5e9d32['query'][_0x3959('0x4f')]);_0x3ae659[_0x3959('0x50')]=qs[_0x3959('0x49')](_['pick'](_0x5e9d32[_0x3959('0x47')],_0x547779[_0x3959('0x49')]),_0x20dd76);if(_0x5e9d32['query'][_0x3959('0x51')]){_0x3ae659[_0x3959('0x50')]=_[_0x3959('0x52')](_0x3ae659['where'],{'$or':_[_0x3959('0x42')](_0x20dd76,function(_0x30b8d4){if(_0x30b8d4[_0x3959('0x44')]!==_0x3959('0x53')){var _0x306ac1={};_0x306ac1[_0x30b8d4[_0x3959('0x46')]]={'$like':'%'+_0x5e9d32['query'][_0x3959('0x51')]+'%'};return _0x306ac1;}})});}_0x3ae659=_[_0x3959('0x52')]({},_0x3ae659,_0x5e9d32[_0x3959('0x54')]);var _0x570316={'where':_0x3ae659[_0x3959('0x50')]};return db[_0x3959('0x55')]['count'](_0x570316)['then'](function(_0x4c92cd){_0x57ed99['count']=_0x4c92cd;if(_0x5e9d32[_0x3959('0x47')]['includeAll']){_0x3ae659['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0x3959('0x56')](_0x3ae659);})[_0x3959('0x24')](function(_0x312505){_0x57ed99[_0x3959('0x57')]=_0x312505;return _0x57ed99;})[_0x3959('0x24')](respondWithFilteredResult(_0x43116d,_0x3ae659))[_0x3959('0x58')](handleError(_0x43116d,null));};exports[_0x3959('0x59')]=function(_0x7d1b2b,_0x407337){var _0x1d5f1a={'raw':![],'where':{'id':_0x7d1b2b[_0x3959('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x3959('0x41')}]},_0x42b195={};_0x42b195[_0x3959('0x45')]=_[_0x3959('0x48')](db['OpenchannelAccount'][_0x3959('0x43')]);_0x42b195[_0x3959('0x47')]=_['keys'](_0x7d1b2b['query']);_0x42b195[_0x3959('0x49')]=_['intersection'](_0x42b195['model'],_0x42b195[_0x3959('0x47')]);_0x1d5f1a['attributes']=_['intersection'](_0x42b195['model'],qs[_0x3959('0x4a')](_0x7d1b2b[_0x3959('0x47')]['fields']));_0x1d5f1a[_0x3959('0x4b')]=_0x1d5f1a[_0x3959('0x4b')][_0x3959('0x4c')]?_0x1d5f1a[_0x3959('0x4b')]:_0x42b195[_0x3959('0x45')];if(_0x7d1b2b[_0x3959('0x47')][_0x3959('0x5b')]){_0x1d5f1a[_0x3959('0x5c')]=[{'all':!![]}];}_0x1d5f1a=_['merge']({},_0x1d5f1a,_0x7d1b2b[_0x3959('0x54')]);return db['OpenchannelAccount'][_0x3959('0x5d')](_0x1d5f1a)[_0x3959('0x24')](handleEntityNotFound(_0x407337,null))[_0x3959('0x24')](respondWithResult(_0x407337,null))[_0x3959('0x58')](handleError(_0x407337,null));};exports[_0x3959('0x5e')]=function(_0x1887e5,_0x2c8730){return db[_0x3959('0x55')][_0x3959('0x5e')](_0x1887e5['body'],{})[_0x3959('0x24')](function(_0x437b36){var _0x298b96=_0x1887e5[_0x3959('0x5f')]['get']({'plain':!![]});if(!_0x298b96)throw new Error(_0x3959('0x60'));if(_0x298b96['role']===_0x3959('0x5f')){var _0x52ceca=_0x437b36[_0x3959('0x61')]({'plain':!![]});var _0xe4f4d1=_0x3959('0x3b');return db[_0x3959('0x62')][_0x3959('0x5d')]({'where':{'name':_0xe4f4d1,'userProfileId':_0x298b96[_0x3959('0x63')]},'raw':!![]})['then'](function(_0x2a94d1){if(_0x2a94d1&&_0x2a94d1[_0x3959('0x64')]===0x0){return db[_0x3959('0x3c')][_0x3959('0x5e')]({'name':_0x52ceca[_0x3959('0x46')],'resourceId':_0x52ceca['id'],'type':_0x2a94d1[_0x3959('0x46')],'sectionId':_0x2a94d1['id']},{})[_0x3959('0x24')](function(){return _0x437b36;});}else{return _0x437b36;}})[_0x3959('0x58')](function(_0x5576e4){logger[_0x3959('0x2b')](_0x3959('0x65'),_0x5576e4);throw _0x5576e4;});}return _0x437b36;})[_0x3959('0x24')](respondWithResult(_0x2c8730,0xc9))['catch'](handleError(_0x2c8730,null));};exports['update']=function(_0x2ca091,_0x660df3){if(_0x2ca091[_0x3959('0x66')]['id']){delete _0x2ca091[_0x3959('0x66')]['id'];}return db[_0x3959('0x55')][_0x3959('0x5d')]({'where':{'id':_0x2ca091[_0x3959('0x5a')]['id']},'include':[{'model':db[_0x3959('0x40')],'as':_0x3959('0x41')}]})[_0x3959('0x24')](handleEntityNotFound(_0x660df3,null))[_0x3959('0x24')](saveUpdates(_0x2ca091[_0x3959('0x66')],null))[_0x3959('0x24')](respondWithResult(_0x660df3,null))[_0x3959('0x58')](handleError(_0x660df3,null));};exports[_0x3959('0x3a')]=function(_0x90f5b,_0x5d064f){return db[_0x3959('0x55')][_0x3959('0x5d')]({'where':{'id':_0x90f5b[_0x3959('0x5a')]['id']}})[_0x3959('0x24')](handleEntityNotFound(_0x5d064f,null))[_0x3959('0x24')](removeEntity(_0x5d064f,null))['catch'](handleError(_0x5d064f,null));};exports['describe']=function(_0x54460b,_0x15bfe8){return db[_0x3959('0x55')][_0x3959('0x67')]()['then'](respondWithResult(_0x15bfe8,null))[_0x3959('0x58')](handleError(_0x15bfe8,null));};exports['addDisposition']=function(_0xf309e7,_0x58dd6a,_0x108ccb){if(_0xf309e7['body']['id']){delete _0xf309e7['body']['id'];}return db[_0x3959('0x55')][_0x3959('0x5d')]({'where':{'id':_0xf309e7[_0x3959('0x5a')]['id']}})[_0x3959('0x24')](handleEntityNotFound(_0x58dd6a,null))['then'](function(_0x21e302){if(_0x21e302){_0xf309e7[_0x3959('0x66')][_0x3959('0x68')]=_0x21e302['id'];return db[_0x3959('0x69')]['create'](_0xf309e7['body']);}})[_0x3959('0x24')](respondWithResult(_0x58dd6a,null))['catch'](handleError(_0x58dd6a,null));};exports[_0x3959('0x6a')]=function(_0x284cd8,_0x5bbf20,_0xbb33f1){var _0x2e1bc1={'raw':![],'where':{}};var _0x5a625c={};var _0x48c582={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x284cd8[_0x3959('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5bbf20,null))[_0x3959('0x24')](function(_0x2cd3fa){if(_0x2cd3fa){_0x5a625c[_0x3959('0x45')]=_['keys'](db['Disposition']['rawAttributes']);_0x5a625c[_0x3959('0x47')]=_[_0x3959('0x48')](_0x284cd8['query']);_0x5a625c[_0x3959('0x49')]=_[_0x3959('0x6b')](_0x5a625c['model'],_0x5a625c[_0x3959('0x47')]);_0x2e1bc1[_0x3959('0x4b')]=_['intersection'](_0x5a625c[_0x3959('0x45')],qs[_0x3959('0x4a')](_0x284cd8[_0x3959('0x47')][_0x3959('0x4a')]));_0x2e1bc1[_0x3959('0x4b')]=_0x2e1bc1[_0x3959('0x4b')]['length']?_0x2e1bc1['attributes']:_0x5a625c[_0x3959('0x45')];if(!_0x284cd8[_0x3959('0x47')]['hasOwnProperty']('nolimit')){_0x2e1bc1[_0x3959('0x32')]=qs['limit'](_0x284cd8[_0x3959('0x47')]['limit']);_0x2e1bc1[_0x3959('0x31')]=qs[_0x3959('0x31')](_0x284cd8[_0x3959('0x47')][_0x3959('0x31')]);}_0x2e1bc1['order']=qs[_0x3959('0x4f')](_0x284cd8[_0x3959('0x47')][_0x3959('0x4f')]);_0x2e1bc1[_0x3959('0x50')]=qs[_0x3959('0x49')](_[_0x3959('0x6c')](_0x284cd8['query'],_0x5a625c[_0x3959('0x49')]));_0x2e1bc1[_0x3959('0x50')][_0x3959('0x68')]=_0x2cd3fa['id'];if(_0x284cd8[_0x3959('0x47')]['filter']){_0x2e1bc1[_0x3959('0x50')]=_[_0x3959('0x52')](_0x2e1bc1[_0x3959('0x50')],{'$or':_[_0x3959('0x42')](_0x2e1bc1['attributes'],function(_0x43be2c){var _0x363922={};_0x363922[_0x43be2c]={'$like':'%'+_0x284cd8[_0x3959('0x47')]['filter']+'%'};return _0x363922;})});}_0x2e1bc1=_[_0x3959('0x52')]({},_0x2e1bc1,_0x284cd8[_0x3959('0x54')]);return db['Disposition']['count']({'where':_0x2e1bc1[_0x3959('0x50')]})[_0x3959('0x24')](function(_0x26fb65){_0x48c582[_0x3959('0x34')]=_0x26fb65;if(_0x284cd8[_0x3959('0x47')]['includeAll']){_0x2e1bc1['include']=[{'all':!![]}];}return db[_0x3959('0x69')][_0x3959('0x56')](_0x2e1bc1);})[_0x3959('0x24')](function(_0x1f7fd5){_0x48c582[_0x3959('0x57')]=_0x1f7fd5;return _0x48c582;});}})[_0x3959('0x24')](respondWithFilteredResult(_0x5bbf20,_0x2e1bc1))[_0x3959('0x58')](handleError(_0x5bbf20,null));};exports[_0x3959('0x6d')]=function(_0x4bb6f2,_0x3a2a39,_0x5da5e8){return db['OpenchannelAccount'][_0x3959('0x5d')]({'where':{'id':_0x4bb6f2[_0x3959('0x5a')]['id']}})[_0x3959('0x24')](handleEntityNotFound(_0x3a2a39,null))['then'](function(_0x587e07){if(_0x587e07){return _0x587e07[_0x3959('0x6d')](_0x4bb6f2[_0x3959('0x47')][_0x3959('0x6e')]);}})[_0x3959('0x24')](respondWithStatusCode(_0x3a2a39,null))[_0x3959('0x58')](handleError(_0x3a2a39,null));};exports[_0x3959('0x6f')]=function(_0xbdb949,_0x3a13b7,_0x27531b){if(_0xbdb949[_0x3959('0x66')]['id']){delete _0xbdb949[_0x3959('0x66')]['id'];}return db[_0x3959('0x55')][_0x3959('0x5d')]({'where':{'id':_0xbdb949[_0x3959('0x5a')]['id']}})[_0x3959('0x24')](handleEntityNotFound(_0x3a13b7,null))[_0x3959('0x24')](function(_0x2f5a7f){if(_0x2f5a7f){_0xbdb949['body']['OpenchannelAccountId']=_0x2f5a7f['id'];return db[_0x3959('0x70')][_0x3959('0x5e')](_0xbdb949[_0x3959('0x66')]);}})[_0x3959('0x24')](respondWithResult(_0x3a13b7,null))[_0x3959('0x58')](handleError(_0x3a13b7,null));};exports[_0x3959('0x71')]=function(_0x33e5c5,_0x4f4473,_0x269627){var _0x5bba42={'raw':![],'where':{}};var _0x3752cc={};var _0x21da58={'count':0x0,'rows':[]};return db[_0x3959('0x55')][_0x3959('0x72')]({'where':{'id':_0x33e5c5[_0x3959('0x5a')]['id']}})[_0x3959('0x24')](handleEntityNotFound(_0x4f4473,null))[_0x3959('0x24')](function(_0x289f61){if(_0x289f61){_0x3752cc[_0x3959('0x45')]=_[_0x3959('0x48')](db[_0x3959('0x70')]['rawAttributes']);_0x3752cc['query']=_[_0x3959('0x48')](_0x33e5c5[_0x3959('0x47')]);_0x3752cc['filters']=_[_0x3959('0x6b')](_0x3752cc[_0x3959('0x45')],_0x3752cc[_0x3959('0x47')]);_0x5bba42[_0x3959('0x4b')]=_[_0x3959('0x6b')](_0x3752cc[_0x3959('0x45')],qs[_0x3959('0x4a')](_0x33e5c5[_0x3959('0x47')]['fields']));_0x5bba42[_0x3959('0x4b')]=_0x5bba42[_0x3959('0x4b')][_0x3959('0x4c')]?_0x5bba42[_0x3959('0x4b')]:_0x3752cc[_0x3959('0x45')];if(!_0x33e5c5[_0x3959('0x47')][_0x3959('0x73')]('nolimit')){_0x5bba42['limit']=qs[_0x3959('0x32')](_0x33e5c5[_0x3959('0x47')][_0x3959('0x32')]);_0x5bba42[_0x3959('0x31')]=qs[_0x3959('0x31')](_0x33e5c5['query'][_0x3959('0x31')]);}_0x5bba42[_0x3959('0x4e')]=qs[_0x3959('0x4f')](_0x33e5c5['query']['sort']);_0x5bba42[_0x3959('0x50')]=qs[_0x3959('0x49')](_[_0x3959('0x6c')](_0x33e5c5[_0x3959('0x47')],_0x3752cc[_0x3959('0x49')]));_0x5bba42[_0x3959('0x50')][_0x3959('0x68')]=_0x289f61['id'];if(_0x33e5c5[_0x3959('0x47')][_0x3959('0x51')]){_0x5bba42[_0x3959('0x50')]=_[_0x3959('0x52')](_0x5bba42[_0x3959('0x50')],{'$or':_[_0x3959('0x42')](_0x5bba42['attributes'],function(_0x29cae1){var _0x3eefdc={};_0x3eefdc[_0x29cae1]={'$like':'%'+_0x33e5c5[_0x3959('0x47')][_0x3959('0x51')]+'%'};return _0x3eefdc;})});}_0x5bba42=_[_0x3959('0x52')]({},_0x5bba42,_0x33e5c5['options']);return db['CannedAnswer'][_0x3959('0x34')]({'where':_0x5bba42[_0x3959('0x50')]})[_0x3959('0x24')](function(_0x372463){_0x21da58['count']=_0x372463;if(_0x33e5c5[_0x3959('0x47')][_0x3959('0x5b')]){_0x5bba42['include']=[{'all':!![]}];}return db[_0x3959('0x70')][_0x3959('0x56')](_0x5bba42);})[_0x3959('0x24')](function(_0x429b7e){_0x21da58[_0x3959('0x57')]=_0x429b7e;return _0x21da58;});}})[_0x3959('0x24')](respondWithFilteredResult(_0x4f4473,_0x5bba42))[_0x3959('0x58')](handleError(_0x4f4473,null));};exports['removeAnswers']=function(_0xa7c829,_0x5a743e,_0x7a6918){return db[_0x3959('0x55')][_0x3959('0x5d')]({'where':{'id':_0xa7c829[_0x3959('0x5a')]['id']}})[_0x3959('0x24')](handleEntityNotFound(_0x5a743e,null))[_0x3959('0x24')](function(_0x4e20cf){if(_0x4e20cf){return _0x4e20cf[_0x3959('0x74')](_0xa7c829['query'][_0x3959('0x6e')]);}})['then'](respondWithStatusCode(_0x5a743e,null))[_0x3959('0x58')](handleError(_0x5a743e,null));};exports[_0x3959('0x75')]=function(_0x149020,_0x2df881,_0x78afa5){var _0x2735b3={'body':_0x149020[_0x3959('0x66')],'channel':'openchannel'};var _0x1f67b5=[];var _0x13965b=[];var _0x577997={};var _0x170236=![];return db['CmContact']['describe']()['then'](function(_0x572cd3){if(!_0x572cd3){throw new db['Sequelize'][(_0x3959('0x76'))]('no\x20available\x20attributes');}_0x1f67b5=_[_0x3959('0x77')](_[_0x3959('0x48')](_0x572cd3),[_0x3959('0x78'),'updatedAt']);_0x13965b=_[_0x3959('0x77')](_[_0x3959('0x48')](_0x572cd3),[_0x3959('0x78'),_0x3959('0x79'),'CompanyId',_0x3959('0x7a')]);if(_0x149020[_0x3959('0x66')]['id']){delete _0x149020['body']['id'];}if(_['isNil'](_0x149020[_0x3959('0x66')][_0x3959('0x7b')])){throw new db[(_0x3959('0x7c'))][(_0x3959('0x76'))](_0x3959('0x7d'));}if(_[_0x3959('0x7e')](_0x149020[_0x3959('0x66')][_0x3959('0x66')])||_0x149020['body'][_0x3959('0x66')]===''){throw new db[(_0x3959('0x7c'))][(_0x3959('0x76'))](_0x3959('0x7f'));}if(_[_0x3959('0x7e')](_0x149020[_0x3959('0x66')][_0x3959('0x80')])){throw new db['Sequelize'][(_0x3959('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x13965b);}if(!_['includes'](_0x13965b,_0x149020['body']['mapKey'])){throw new db['Sequelize'][(_0x3959('0x76'))](_0x3959('0x81')+_0x13965b);}_0x577997[_0x149020[_0x3959('0x66')][_0x3959('0x80')]]=_0x149020[_0x3959('0x66')]['from'];})[_0x3959('0x24')](function(){return db['OpenchannelAccount'][_0x3959('0x5d')]({'where':{'id':_0x149020[_0x3959('0x5a')]['id']},'include':[{'model':db[_0x3959('0x82')],'as':_0x3959('0x83'),'include':[{'model':db[_0x3959('0x84')],'as':_0x3959('0x85'),'where':_0x577997,'limit':0x1,'order':[[_0x3959('0x79'),_0x3959('0x86')]]}]},{'model':db['OpenchannelApplication'],'as':_0x3959('0x87')}]});})[_0x3959('0x24')](handleEntityNotFound(_0x2df881,null))['then'](function(_0x18d475){if(_0x18d475&&_0x18d475['List']){_0x2735b3['account']=_0x18d475;_0x2735b3[_0x3959('0x88')]=_0x18d475[_0x3959('0x87')];_0x2735b3[_0x3959('0x89')]=_0x18d475[_0x3959('0x83')];_0x2735b3[_0x3959('0x88')]=_[_0x3959('0x8a')](_0x2735b3[_0x3959('0x88')],['priority'],[_0x3959('0x8b')]);if(_0x2735b3[_0x3959('0x8c')][_0x3959('0x87')]){delete _0x2735b3['account']['Applications'];}if(_0x2735b3[_0x3959('0x8c')]['List']&&_0x2735b3[_0x3959('0x8c')][_0x3959('0x83')][_0x3959('0x85')]['length']){return _0x2735b3['account'][_0x3959('0x83')][_0x3959('0x85')][0x0];}var _0x264558=_[_0x3959('0x1b')](_0x149020[_0x3959('0x66')],{'firstName':_0x149020['body']['from'],'ListId':_0x18d475[_0x3959('0x7a')]});_0x264558[_0x149020[_0x3959('0x66')][_0x3959('0x80')]]=_0x149020[_0x3959('0x66')]['from'];return db[_0x3959('0x84')][_0x3959('0x5e')](_0x264558,{'fields':_0x1f67b5,'raw':!![]});}})[_0x3959('0x24')](handleEntityNotFound(_0x2df881,null))['then'](function(_0x1284ab){_0x2735b3['contact']=_0x1284ab;if(_0x1284ab){var _0x3a0167={'ContactId':_0x1284ab['id'],'OpenchannelAccountId':_0x149020[_0x3959('0x5a')]['id'],'from':(_0x1284ab[_0x3959('0x8d')]||'')+'\x20'+(_0x1284ab[_0x3959('0x8e')]||'')};var _0x3b775b={'OpenchannelAccountId':_0x149020[_0x3959('0x5a')]['id'],'closed':![]};if(_0x149020['body'][_0x3959('0x8f')]){_0x3b775b['threadId']=_0x149020[_0x3959('0x66')][_0x3959('0x8f')];return db[_0x3959('0x90')][_0x3959('0x5d')]({'where':_0x3b775b})['then'](function(_0x1bb30b){if(_0x1bb30b){return[_0x1bb30b,![]];}_0x3a0167['threadId']=_0x149020['body'][_0x3959('0x8f')];_0x3a0167[_0x3959('0x91')]=_0x149020[_0x3959('0x66')]['externalUrl'];return db['OpenchannelInteraction'][_0x3959('0x5e')](_0x3a0167)[_0x3959('0x24')](function(_0x5e90ec){return[_0x5e90ec,!![]];});});}else{_0x3b775b[_0x3959('0x8f')]=null;}_0x3b775b[_0x3959('0x92')]=_0x1284ab['id'];return db[_0x3959('0x90')][_0x3959('0x5d')]({'where':_0x3b775b})[_0x3959('0x24')](function(_0x1c2209){if(_0x1c2209){return[_0x1c2209,![]];}return db[_0x3959('0x90')][_0x3959('0x5e')](_0x3a0167)[_0x3959('0x24')](function(_0x142975){return[_0x142975,!![]];});});}})[_0x3959('0x93')](function(_0x4d4dde,_0x1b60df){if(_0x4d4dde){_0x170236=_0x1b60df;if(!_0x1b60df){var _0x3f213d={'from':(_0x2735b3[_0x3959('0x94')]['firstName']||'')+'\x20'+(_0x2735b3[_0x3959('0x94')][_0x3959('0x8e')]||'')};if(_0x149020[_0x3959('0x66')]['threadId']&&_0x149020[_0x3959('0x66')][_0x3959('0x95')]&&_0x149020[_0x3959('0x66')]['threadId']!=_0x149020['body'][_0x3959('0x95')]){_0x3f213d[_0x3959('0x8f')]=_0x149020[_0x3959('0x66')]['messageId'];}return _0x4d4dde['update'](_0x3f213d);}else{return _0x4d4dde;}}})[_0x3959('0x24')](function(_0x3b7e99){_0x2735b3[_0x3959('0x96')]=_0x3b7e99[_0x3959('0x61')]({'plain':!![]});_0x2735b3[_0x3959('0x96')][_0x3959('0x97')]=_0x170236;if(_0x2735b3[_0x3959('0x96')][_0x3959('0x97')]){if(_0x2735b3[_0x3959('0x8c')][_0x3959('0x98')]){_0x2735b3['applications'][_0x3959('0x99')]({'id':0x0,'priority':_0x2735b3[_0x3959('0x88')][_0x3959('0x4c')]+0x1,'app':_0x3959('0x9a'),'appdata':'unmanaged','interval':_0x3959('0x9b')});}}return db[_0x3959('0x9c')]['create']({'body':_0x149020[_0x3959('0x66')]['body'],'OpenchannelAccountId':_0x149020[_0x3959('0x5a')]['id'],'OpenchannelInteractionId':_0x3b7e99['id'],'direction':'in','ContactId':_0x2735b3[_0x3959('0x94')]['id'],'AttachmentId':_0x149020[_0x3959('0x66')][_0x3959('0x9d')]});})[_0x3959('0x24')](function(_0x47464a){_0x2735b3[_0x3959('0x2d')]=_0x47464a;if(_0x2735b3[_0x3959('0x96')][_0x3959('0x9e')]){return db[_0x3959('0x9f')][_0x3959('0x5d')]({'attributes':['id',_0x3959('0x46')],'where':{'id':_0x2735b3[_0x3959('0x96')][_0x3959('0x9e')]}})[_0x3959('0x24')](function(_0x55ffd4){if(_0x55ffd4){_0x2735b3['applications'][_0x3959('0xa0')]({'id':0x0,'priority':0x0,'app':_0x3959('0xa1'),'appdata':_0x55ffd4[_0x3959('0x46')]+','+(_0x2735b3['account'][_0x3959('0xa2')]||0xa),'interval':'*,*,*,*'});_0x2735b3[_0x3959('0xa3')]=![];}return respondWithRpcPromise(_0x3959('0xa4'),_0x3959('0xa5'),_0x2735b3);});}return respondWithRpcPromise(_0x3959('0xa4'),'startRouting',_0x2735b3);})[_0x3959('0x24')](function(_0x5d8e65){respondWithRpcPromise('EventManager',_0x3959('0xa6'),{'event':_0x3959('0x75'),'message':_0x5d8e65},client9002);return _0x5d8e65;})['then'](respondWithResult(_0x2df881,null))[_0x3959('0x58')](handleError(_0x2df881,null));};exports[_0x3959('0xa7')]=function(_0x31c792,_0x34aa65,_0x340cbb){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x31c792['params']['id']}})[_0x3959('0x24')](handleEntityNotFound(_0x34aa65,null))[_0x3959('0x24')](function(_0x5554f6){if(_0x5554f6){return db[_0x3959('0xa8')][_0x3959('0xa9')](function(_0x185ed4){return db[_0x3959('0xaa')]['destroy']({'where':{'OpenchannelAccountId':_0x31c792['params']['id']},'transaction':_0x185ed4})[_0x3959('0x24')](function(_0x2471b0){var _0x5f2e8d=_[_0x3959('0x42')](_0x31c792[_0x3959('0x66')],function(_0x2aa83f){_0x2aa83f[_0x3959('0x68')]=_0x31c792[_0x3959('0x5a')]['id'];return _0x2aa83f;});return db[_0x3959('0xaa')][_0x3959('0xab')](_0x5f2e8d,{'transaction':_0x185ed4});});})['then'](function(){return db[_0x3959('0xaa')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x31c792[_0x3959('0x5a')]['id']},'order':'priority'});});}})[_0x3959('0x24')](respondWithResult(_0x34aa65,null))['catch'](handleError(_0x34aa65,null));};exports[_0x3959('0xac')]=function(_0x51607b,_0x2df72f,_0x5d4d89){var _0xc6ab25={};var _0x2b6964={};var _0x176fc0;var _0x199382;return db[_0x3959('0x55')]['findOne']({'where':{'id':_0x51607b[_0x3959('0x5a')]['id']}})[_0x3959('0x24')](handleEntityNotFound(_0x2df72f,null))[_0x3959('0x24')](function(_0x41f2a0){if(_0x41f2a0){_0x176fc0=_0x41f2a0;_0x2b6964[_0x3959('0x45')]=_[_0x3959('0x48')](db[_0x3959('0xaa')][_0x3959('0x43')]);_0x2b6964[_0x3959('0x47')]=_[_0x3959('0x48')](_0x51607b[_0x3959('0x47')]);_0x2b6964['filters']=_[_0x3959('0x6b')](_0x2b6964[_0x3959('0x45')],_0x2b6964[_0x3959('0x47')]);_0xc6ab25[_0x3959('0x4b')]=_['intersection'](_0x2b6964[_0x3959('0x45')],qs[_0x3959('0x4a')](_0x51607b[_0x3959('0x47')][_0x3959('0x4a')]));_0xc6ab25[_0x3959('0x4b')]=_0xc6ab25[_0x3959('0x4b')][_0x3959('0x4c')]?_0xc6ab25[_0x3959('0x4b')]:_0x2b6964[_0x3959('0x45')];_0xc6ab25['order']=qs[_0x3959('0x4f')](_0x51607b[_0x3959('0x47')][_0x3959('0x4f')]);_0xc6ab25['where']=qs[_0x3959('0x49')](_[_0x3959('0x6c')](_0x51607b[_0x3959('0x47')],_0x2b6964['filters']));if(_0x51607b[_0x3959('0x47')][_0x3959('0x51')]){_0xc6ab25[_0x3959('0x50')]=_[_0x3959('0x52')](_0xc6ab25[_0x3959('0x50')],{'$or':_[_0x3959('0x42')](_0xc6ab25[_0x3959('0x4b')],function(_0x2a405b){var _0x4b63c9={};_0x4b63c9[_0x2a405b]={'$like':'%'+_0x51607b[_0x3959('0x47')][_0x3959('0x51')]+'%'};return _0x4b63c9;})});}_0xc6ab25=_[_0x3959('0x52')]({},_0xc6ab25,_0x51607b[_0x3959('0x54')]);return _0x176fc0['getApplications'](_0xc6ab25);}})[_0x3959('0x24')](function(_0x39e94f){if(_0x39e94f){_0x199382=_0x39e94f[_0x3959('0x4c')];if(!_0x51607b['query']['hasOwnProperty'](_0x3959('0x4d'))){_0xc6ab25[_0x3959('0x32')]=qs[_0x3959('0x32')](_0x51607b['query'][_0x3959('0x32')]);_0xc6ab25['offset']=qs['offset'](_0x51607b[_0x3959('0x47')][_0x3959('0x31')]);}return _0x176fc0[_0x3959('0xac')](_0xc6ab25);}})[_0x3959('0x24')](function(_0x3cfd66){if(_0x3cfd66){return _0x3cfd66?{'count':_0x199382,'rows':_0x3cfd66}:null;}})[_0x3959('0x24')](respondWithResult(_0x2df72f,null))[_0x3959('0x58')](handleError(_0x2df72f,null));};exports[_0x3959('0xad')]=function(_0x37e600,_0x1cfd1d,_0x5aa4f5){var _0x59a1d3={'raw':![],'where':{}};var _0x5784c9={};var _0x285678={'count':0x0,'rows':[]};return db[_0x3959('0x55')][_0x3959('0x72')]({'where':{'id':_0x37e600['params']['id']}})[_0x3959('0x24')](handleEntityNotFound(_0x1cfd1d,null))['then'](function(_0x2e59b7){if(_0x2e59b7){_0x5784c9[_0x3959('0x45')]=_[_0x3959('0x48')](db[_0x3959('0x90')][_0x3959('0x43')]);_0x5784c9[_0x3959('0x47')]=_[_0x3959('0x48')](_0x37e600[_0x3959('0x47')]);_0x5784c9[_0x3959('0x49')]=_[_0x3959('0x6b')](_0x5784c9[_0x3959('0x45')],_0x5784c9[_0x3959('0x47')]);_0x59a1d3['attributes']=_[_0x3959('0x6b')](_0x5784c9[_0x3959('0x45')],qs[_0x3959('0x4a')](_0x37e600[_0x3959('0x47')][_0x3959('0x4a')]));_0x59a1d3[_0x3959('0x4b')]=_0x59a1d3[_0x3959('0x4b')]['length']?_0x59a1d3[_0x3959('0x4b')]:_0x5784c9[_0x3959('0x45')];if(!_0x37e600[_0x3959('0x47')]['hasOwnProperty'](_0x3959('0x4d'))){_0x59a1d3[_0x3959('0x32')]=qs[_0x3959('0x32')](_0x37e600[_0x3959('0x47')]['limit']);_0x59a1d3[_0x3959('0x31')]=qs[_0x3959('0x31')](_0x37e600['query']['offset']);}_0x59a1d3[_0x3959('0x4e')]=qs[_0x3959('0x4f')](_0x37e600['query'][_0x3959('0x4f')]);_0x59a1d3[_0x3959('0x50')]=qs[_0x3959('0x49')](_[_0x3959('0x6c')](_0x37e600[_0x3959('0x47')],_0x5784c9['filters']));_0x59a1d3[_0x3959('0x50')][_0x3959('0x68')]=_0x2e59b7['id'];if(_0x37e600[_0x3959('0x47')][_0x3959('0x51')]){_0x59a1d3[_0x3959('0x50')]=_[_0x3959('0x52')](_0x59a1d3[_0x3959('0x50')],{'$or':_[_0x3959('0x42')](_0x59a1d3['attributes'],function(_0x3f90ff){var _0x392bbf={};_0x392bbf[_0x3f90ff]={'$like':'%'+_0x37e600[_0x3959('0x47')][_0x3959('0x51')]+'%'};return _0x392bbf;})});}_0x59a1d3=_['merge']({},_0x59a1d3,_0x37e600[_0x3959('0x54')]);return db[_0x3959('0x90')]['count']({'where':_0x59a1d3[_0x3959('0x50')]})['then'](function(_0x1575e1){_0x285678[_0x3959('0x34')]=_0x1575e1;if(_0x37e600[_0x3959('0x47')][_0x3959('0x5b')]){_0x59a1d3['include']=[{'model':db[_0x3959('0x84')],'as':'Contact','required':![]},{'model':db[_0x3959('0x9f')],'as':'Owner','attributes':['name',_0x3959('0xae'),_0x3959('0xaf')],'required':![]},{'model':db[_0x3959('0xb0')],'as':_0x3959('0xb1'),'attributes':['id',_0x3959('0x46'),_0x3959('0xb2')],'where':_0x37e600[_0x3959('0x47')][_0x3959('0xb3')]?{'id':_0x37e600['query'][_0x3959('0xb3')]}:undefined,'required':_0x37e600['query']['tag']?!![]:![]}];}return db[_0x3959('0x90')]['findAll'](_0x59a1d3);})['then'](function(_0x36dcda){_0x285678[_0x3959('0x57')]=_0x36dcda;return _0x285678;});}})[_0x3959('0x24')](respondWithFilteredResult(_0x1cfd1d,_0x59a1d3))[_0x3959('0x58')](handleError(_0x1cfd1d,null));};exports['addAgents']=function(_0x4893a2,_0x1787ea,_0x4e8391){return db[_0x3959('0x55')]['find']({'where':{'id':_0x4893a2[_0x3959('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1787ea,null))[_0x3959('0x24')](function(_0x797d2c){if(_0x797d2c){return _0x797d2c['addAgents'](_0x4893a2[_0x3959('0x66')][_0x3959('0x6e')],_['omit'](_0x4893a2[_0x3959('0x66')],[_0x3959('0x6e'),'id'])||{})[_0x3959('0x93')](function(_0x3df333){for(var _0x180765=0x0;_0x180765<_0x4893a2[_0x3959('0x66')][_0x3959('0x6e')][_0x3959('0x4c')];_0x180765+=0x1){socket['emit'](_0x3959('0xb4'),{'UserId':Number(_0x4893a2['body'][_0x3959('0x6e')][_0x180765]),'OpenchannelAccountId':Number(_0x4893a2['params']['id'])});}return _0x3df333;});}})[_0x3959('0x24')](respondWithResult(_0x1787ea,null))[_0x3959('0x58')](handleError(_0x1787ea,null));};exports['removeAgents']=function(_0x1c62dc,_0x51bdde,_0x2cc578){return db[_0x3959('0x55')]['find']({'where':{'id':_0x1c62dc[_0x3959('0x5a')]['id']}})[_0x3959('0x24')](handleEntityNotFound(_0x51bdde,null))[_0x3959('0x24')](function(_0x4faaa3){if(_0x4faaa3){return _0x4faaa3['removeAgents'](_0x1c62dc[_0x3959('0x47')]['ids'])['then'](function(){if(_['isArray'](_0x1c62dc[_0x3959('0x47')]['ids'])){for(var _0x10310e=0x0;_0x10310e<_0x1c62dc[_0x3959('0x47')][_0x3959('0x6e')][_0x3959('0x4c')];_0x10310e+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x1c62dc[_0x3959('0x47')][_0x3959('0x6e')][_0x10310e]),'OpenchannelAccountId':Number(_0x1c62dc['params']['id'])});}}else{socket['emit'](_0x3959('0xb5'),{'UserId':Number(_0x1c62dc[_0x3959('0x47')]['ids']),'OpenchannelAccountId':Number(_0x1c62dc[_0x3959('0x5a')]['id'])});}});}})[_0x3959('0x24')](respondWithStatusCode(_0x51bdde,null))[_0x3959('0x58')](handleError(_0x51bdde,null));};exports['getAgents']=function(_0x3a3823,_0x16a750,_0x55cda3){var _0x1ecec4={};var _0x3b36c2={};var _0x3c0926;var _0x37666a;return db[_0x3959('0x55')]['findOne']({'where':{'id':_0x3a3823[_0x3959('0x5a')]['id']}})[_0x3959('0x24')](handleEntityNotFound(_0x16a750,null))[_0x3959('0x24')](function(_0x545a30){if(_0x545a30){_0x3c0926=_0x545a30;_0x3b36c2[_0x3959('0x45')]=_['keys'](db[_0x3959('0x9f')][_0x3959('0x43')]);_0x3b36c2[_0x3959('0x47')]=_['keys'](_0x3a3823[_0x3959('0x47')]);_0x3b36c2[_0x3959('0x49')]=_[_0x3959('0x6b')](_0x3b36c2[_0x3959('0x45')],_0x3b36c2[_0x3959('0x47')]);_0x1ecec4[_0x3959('0x4b')]=_[_0x3959('0x6b')](_0x3b36c2[_0x3959('0x45')],qs[_0x3959('0x4a')](_0x3a3823['query'][_0x3959('0x4a')]));_0x1ecec4[_0x3959('0x4b')]=_0x1ecec4[_0x3959('0x4b')][_0x3959('0x4c')]?_0x1ecec4[_0x3959('0x4b')]:_0x3b36c2[_0x3959('0x45')];_0x1ecec4['order']=qs[_0x3959('0x4f')](_0x3a3823[_0x3959('0x47')][_0x3959('0x4f')]);_0x1ecec4['where']=qs['filters'](_[_0x3959('0x6c')](_0x3a3823[_0x3959('0x47')],_0x3b36c2[_0x3959('0x49')]));if(_0x3a3823[_0x3959('0x47')]['filter']){_0x1ecec4[_0x3959('0x50')]=_[_0x3959('0x52')](_0x1ecec4['where'],{'$or':_[_0x3959('0x42')](_0x1ecec4[_0x3959('0x4b')],function(_0x4d5e10){var _0x57caeb={};_0x57caeb[_0x4d5e10]={'$like':'%'+_0x3a3823[_0x3959('0x47')]['filter']+'%'};return _0x57caeb;})});}_0x1ecec4=_['merge']({},_0x1ecec4,_0x3a3823[_0x3959('0x54')]);return _0x3c0926[_0x3959('0xb6')](_0x1ecec4);}})[_0x3959('0x24')](function(_0x2187ee){if(_0x2187ee){_0x37666a=_0x2187ee[_0x3959('0x4c')];if(!_0x3a3823[_0x3959('0x47')][_0x3959('0x73')](_0x3959('0x4d'))){_0x1ecec4[_0x3959('0x32')]=qs[_0x3959('0x32')](_0x3a3823['query']['limit']);_0x1ecec4[_0x3959('0x31')]=qs[_0x3959('0x31')](_0x3a3823[_0x3959('0x47')]['offset']);}return _0x3c0926[_0x3959('0xb6')](_0x1ecec4);}})['then'](function(_0x213d0a){if(_0x213d0a){return _0x213d0a?{'count':_0x37666a,'rows':_0x213d0a}:null;}})['then'](respondWithResult(_0x16a750,null))[_0x3959('0x58')](handleError(_0x16a750,null));};exports[_0x3959('0x3f')]=function(_0xaa9b5c,_0x3d8e44,_0x120ba1){var _0x1328af,_0x234bda,_0x149ffc;if(_['isNil'](_0xaa9b5c[_0x3959('0x66')][_0x3959('0x66')])||_0xaa9b5c[_0x3959('0x66')][_0x3959('0x66')]===''){throw new db[(_0x3959('0x7c'))][(_0x3959('0x76'))](_0x3959('0x7f'));}if(_[_0x3959('0x7e')](_0xaa9b5c[_0x3959('0x66')]['to'])){}_0x1328af=_0xaa9b5c[_0x3959('0x66')]['to'];return db[_0x3959('0x55')][_0x3959('0x72')]({'where':{'id':_0xaa9b5c['params']['id']}})[_0x3959('0x24')](handleEntityNotFound(_0x3d8e44,null))[_0x3959('0x24')](function(_0x181b6d){if(_0x181b6d){return db[_0x3959('0x55')]['find']({'where':{'id':_0x181b6d['id']},'include':[{'model':db['CmList'],'as':_0x3959('0x83'),'include':[{'model':db[_0x3959('0x84')],'as':_0x3959('0x85'),'where':{[_0x181b6d['mapKey']]:_0x1328af},'limit':0x1,'order':[['updatedAt',_0x3959('0x86')]]}]}]})[_0x3959('0x24')](handleEntityNotFound(_0x3d8e44,null))[_0x3959('0x24')](function(_0x3be9ab){if(_0x3be9ab&&_0x3be9ab[_0x3959('0x83')]){_0x234bda=_0x3be9ab[_0x3959('0x61')]({'plain':!![]});if(_0x234bda[_0x3959('0x83')]&&_0x234bda['List'][_0x3959('0x85')]['length']){return _0x234bda[_0x3959('0x83')][_0x3959('0x85')][0x0];}return db[_0x3959('0x84')][_0x3959('0x5e')](_[_0x3959('0x1b')](_0xaa9b5c[_0x3959('0x66')],{'firstName':_0x1328af,[_0x3be9ab[_0x3959('0x80')]]:_0x1328af,'phone':_0x1328af,'ListId':_0x234bda[_0x3959('0x7a')]}));}})['then'](handleEntityNotFound(_0x3d8e44,null))[_0x3959('0x24')](function(_0x4255c8){if(_0x4255c8){_0x149ffc=_0x4255c8;return db['OpenchannelInteraction'][_0x3959('0x5d')]({'where':{'ContactId':_0x149ffc['id'],'closed':![],'OpenchannelAccountId':_0x234bda['id']}})[_0x3959('0x24')](function(_0x33e887){if(_0x33e887){return[_0x33e887,![]];}return db[_0x3959('0x90')]['create']({'UserId':_0xaa9b5c[_0x3959('0x5f')]['id'],'ContactId':_0x149ffc['id'],'OpenchannelAccountId':_0x234bda['id'],'lastMsgDirection':_0x3959('0xb7'),'Messages':[_[_0x3959('0x52')](_0xaa9b5c[_0x3959('0x66')],{'read':![],'body':_0xaa9b5c[_0x3959('0x66')]['body'],'OpenchannelAccountId':_0x234bda['id'],'UserId':_0xaa9b5c[_0x3959('0x5f')]['id'],'ContactId':_0x149ffc['id']})]},{'include':[{'model':db[_0x3959('0x9c')],'as':_0x3959('0xb8')}]})[_0x3959('0x24')](function(_0x59ccec){return[_0x59ccec,!![]];});});}})[_0x3959('0x93')](function(_0x41badf,_0x580ba8){if(_0x580ba8){return _0x41badf;}return db[_0x3959('0x9c')]['create'](_[_0x3959('0x52')](_0xaa9b5c[_0x3959('0x66')],{'read':![],'body':_0xaa9b5c[_0x3959('0x66')]['body'],'OpenchannelAccountId':_0x234bda['id'],'OpenchannelInteractionId':_0x41badf['id'],'UserId':_0xaa9b5c[_0x3959('0x5f')]['id'],'ContactId':_0x149ffc['id']}))[_0x3959('0x24')](function(_0x526e9a){_0x41badf[_0x3959('0xb9')][_0x3959('0xb8')]=[];_0x41badf[_0x3959('0xb9')]['Messages']['push'](_0x526e9a['dataValues']);return _0x41badf;});});}})[_0x3959('0x24')](respondWithResult(_0x3d8e44,null))['catch'](handleError(_0x3d8e44,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 312f769..81d1cec 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 _0xb688=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x511577,_0x2ec0cf){var _0x1b9201=function(_0x334aac){while(--_0x334aac){_0x511577['push'](_0x511577['shift']());}};_0x1b9201(++_0x2ec0cf);}(_0xb688,0xcf));var _0x8b68=function(_0x5dcfbb,_0x5a1090){_0x5dcfbb=_0x5dcfbb-0x0;var _0x1bbdd6=_0xb688[_0x5dcfbb];return _0x1bbdd6;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x8b68('0x0'))['db'][_0x8b68('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8b68('0x2')](0x0);var events={'afterCreate':_0x8b68('0x3'),'afterUpdate':_0x8b68('0x4'),'afterDestroy':_0x8b68('0x5')};function emitEvent(_0x4e281c){return function(_0x41030e,_0x27925d,_0x30f33d){OpenchannelAccountEvents[_0x8b68('0x6')](_0x4e281c+':'+_0x41030e['id'],_0x41030e);OpenchannelAccountEvents['emit'](_0x4e281c,_0x41030e);_0x30f33d(null);};}for(var e in events){if(events[_0x8b68('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x8b68('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x41bb=['../../mysqldb','setMaxListeners','update','remove','emit','events'];(function(_0x38fc53,_0x56dce5){var _0x33111e=function(_0x43adba){while(--_0x43adba){_0x38fc53['push'](_0x38fc53['shift']());}};_0x33111e(++_0x56dce5);}(_0x41bb,0xc5));var _0xb41b=function(_0x59079a,_0x53c526){_0x59079a=_0x59079a-0x0;var _0x6857=_0x41bb[_0x59079a];return _0x6857;};'use strict';var EventEmitter=require(_0xb41b('0x0'));var OpenchannelAccount=require(_0xb41b('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb41b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb41b('0x3'),'afterDestroy':_0xb41b('0x4')};function emitEvent(_0x148333){return function(_0x448c8e,_0x4ee21b,_0x12cea3){OpenchannelAccountEvents[_0xb41b('0x5')](_0x148333+':'+_0x448c8e['id'],_0x448c8e);OpenchannelAccountEvents[_0xb41b('0x5')](_0x148333,_0x448c8e);_0x12cea3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 00f25eb..a1893df 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(_0x14af42,_0x523098){var _0xfe7c02=function(_0x10b241){while(--_0x10b241){_0x14af42['push'](_0x14af42['shift']());}};_0xfe7c02(++_0x523098);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x4fc0fb,_0x2d6310){var _0x47ef45=function(_0x1b0f99){while(--_0x1b0f99){_0x4fc0fb['push'](_0x4fc0fb['shift']());}};_0x47ef45(++_0x2d6310);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 7707358..3a335f3 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 _0xbfcc=['redis','localhost','socket.io-emitter','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client'];(function(_0x254081,_0x20731a){var _0x5d1e2a=function(_0x597854){while(--_0x597854){_0x254081['push'](_0x254081['shift']());}};_0x5d1e2a(++_0x20731a);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0xbfcc[_0x5ce3c8];return _0xa76867;};'use strict';var _=require(_0xcbfc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcbfc('0x1'));var rs=require(_0xcbfc('0x2'));var fs=require('fs');var Redis=require(_0xcbfc('0x3'));var db=require(_0xcbfc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcbfc('0x5'));var client=jayson[_0xcbfc('0x6')]['http']({'port':0x232a});config[_0xcbfc('0x7')]=_['defaults'](config[_0xcbfc('0x7')],{'host':_0xcbfc('0x8'),'port':0x18eb});var socket=require(_0xcbfc('0x9'))(new Redis(config[_0xcbfc('0x7')]));require('./openchannelAccount.socket')[_0xcbfc('0xa')](socket);function respondWithRpcPromise(_0x3be6f9,_0x36bdb8,_0x25786f){return new BPromise(function(_0x20c7c6,_0x3498c7){return client['request'](_0x3be6f9,_0x25786f)[_0xcbfc('0xb')](function(_0x376a4c){logger[_0xcbfc('0xc')](_0xcbfc('0xd'),_0x36bdb8,_0xcbfc('0xe'));logger['debug'](_0xcbfc('0xf'),_0x36bdb8,_0xcbfc('0xe'),JSON[_0xcbfc('0x10')](_0x376a4c));if(_0x376a4c['error']){if(_0x376a4c[_0xcbfc('0x11')][_0xcbfc('0x12')]===0x1f4){logger[_0xcbfc('0x11')](_0xcbfc('0xd'),_0x36bdb8,_0x376a4c[_0xcbfc('0x11')]['message']);return _0x3498c7(_0x376a4c[_0xcbfc('0x11')][_0xcbfc('0x13')]);}logger[_0xcbfc('0x11')](_0xcbfc('0xd'),_0x36bdb8,_0x376a4c['error']['message']);return _0x20c7c6(_0x376a4c[_0xcbfc('0x11')][_0xcbfc('0x13')]);}else{logger[_0xcbfc('0xc')]('OpenchannelAccount,\x20%s,\x20%s',_0x36bdb8,'request\x20sent');_0x20c7c6(_0x376a4c[_0xcbfc('0x14')][_0xcbfc('0x13')]);}})[_0xcbfc('0x15')](function(_0x4beb87){logger[_0xcbfc('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x36bdb8,_0x4beb87);_0x3498c7(_0x4beb87);});});} \ No newline at end of file +var _0x4ded=['request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','OpenchannelAccount,\x20%s,\x20%s'];(function(_0x1ac8fe,_0xc0578f){var _0x4c6db2=function(_0x8f635e){while(--_0x8f635e){_0x1ac8fe['push'](_0x1ac8fe['shift']());}};_0x4c6db2(++_0xc0578f);}(_0x4ded,0x116));var _0xd4de=function(_0x16c237,_0x5b5a06){_0x16c237=_0x16c237-0x0;var _0x22783e=_0x4ded[_0x16c237];return _0x22783e;};'use strict';var _=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var moment=require(_0xd4de('0x2'));var BPromise=require(_0xd4de('0x3'));var rs=require(_0xd4de('0x4'));var fs=require('fs');var Redis=require(_0xd4de('0x5'));var db=require(_0xd4de('0x6'))['db'];var utils=require(_0xd4de('0x7'));var logger=require(_0xd4de('0x8'))(_0xd4de('0x9'));var config=require(_0xd4de('0xa'));var jayson=require(_0xd4de('0xb'));var client=jayson['client'][_0xd4de('0xc')]({'port':0x232a});config[_0xd4de('0xd')]=_[_0xd4de('0xe')](config[_0xd4de('0xd')],{'host':_0xd4de('0xf'),'port':0x18eb});var socket=require(_0xd4de('0x10'))(new Redis(config['redis']));require(_0xd4de('0x11'))['register'](socket);function respondWithRpcPromise(_0x4ab822,_0x4b0876,_0x176b31){return new BPromise(function(_0x459a46,_0x4e5b10){return client['request'](_0x4ab822,_0x176b31)['then'](function(_0x29e265){logger['info'](_0xd4de('0x12'),_0x4b0876,_0xd4de('0x13'));logger[_0xd4de('0x14')](_0xd4de('0x15'),_0x4b0876,_0xd4de('0x13'),JSON[_0xd4de('0x16')](_0x29e265));if(_0x29e265[_0xd4de('0x17')]){if(_0x29e265[_0xd4de('0x17')][_0xd4de('0x18')]===0x1f4){logger[_0xd4de('0x17')](_0xd4de('0x12'),_0x4b0876,_0x29e265[_0xd4de('0x17')][_0xd4de('0x19')]);return _0x4e5b10(_0x29e265[_0xd4de('0x17')][_0xd4de('0x19')]);}logger[_0xd4de('0x17')](_0xd4de('0x12'),_0x4b0876,_0x29e265['error']['message']);return _0x459a46(_0x29e265[_0xd4de('0x17')][_0xd4de('0x19')]);}else{logger[_0xd4de('0x1a')](_0xd4de('0x12'),_0x4b0876,'request\x20sent');_0x459a46(_0x29e265['result'][_0xd4de('0x19')]);}})['catch'](function(_0xeaaefa){logger[_0xd4de('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x4b0876,_0xeaaefa);_0x4e5b10(_0xeaaefa);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index ee9b7a5..154a951 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 _0x33a4=['removeListener','register','length','openchannelAccount:','save','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x33a4,0x88));var _0x433a=function(_0x431eae,_0xc1ef29){_0x431eae=_0x431eae-0x0;var _0x5c07b2=_0x33a4[_0x431eae];return _0x5c07b2;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x433a('0x0'),'remove',_0x433a('0x1')];function createListener(_0x4786e1,_0x1917aa){return function(_0x4909a4){_0x1917aa['emit'](_0x4786e1,_0x4909a4);};}function removeListener(_0x4f5bc0,_0x19166b){return function(){OpenchannelAccountEvents[_0x433a('0x2')](_0x4f5bc0,_0x19166b);};}exports[_0x433a('0x3')]=function(_0x60b6b3){for(var _0x1b6f5a=0x0,_0x4fcc88=events[_0x433a('0x4')];_0x1b6f5a<_0x4fcc88;_0x1b6f5a++){var _0x58e65c=events[_0x1b6f5a];var _0x2c2404=createListener(_0x433a('0x5')+_0x58e65c,_0x60b6b3);OpenchannelAccountEvents['on'](_0x58e65c,_0x2c2404);}}; \ No newline at end of file +var _0xd3d1=['save','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x1d00f4,_0x44e0d3){var _0x250c6b=function(_0x315be0){while(--_0x315be0){_0x1d00f4['push'](_0x1d00f4['shift']());}};_0x250c6b(++_0x44e0d3);}(_0xd3d1,0x172));var _0x1d3d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd3d1[_0x4565bf];return _0x5610ba;};'use strict';var OpenchannelAccountEvents=require(_0x1d3d('0x0'));var events=[_0x1d3d('0x1'),'remove','update'];function createListener(_0x2d0605,_0x12bffe){return function(_0x1b8ea2){_0x12bffe[_0x1d3d('0x2')](_0x2d0605,_0x1b8ea2);};}function removeListener(_0x41a806,_0x328a4e){return function(){OpenchannelAccountEvents[_0x1d3d('0x3')](_0x41a806,_0x328a4e);};}exports[_0x1d3d('0x4')]=function(_0x1cbe06){for(var _0x449475=0x0,_0x3831ce=events[_0x1d3d('0x5')];_0x449475<_0x3831ce;_0x449475++){var _0xe10bca=events[_0x449475];var _0x2c377c=createListener(_0x1d3d('0x6')+_0xe10bca,_0x1cbe06);OpenchannelAccountEvents['on'](_0xe10bca,_0x2c377c);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 546a6c0..1e26f95 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 _0x7326=['exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','show','post','put','/:id','update','delete'];(function(_0x4960ed,_0x3cf3c8){var _0xbb82a3=function(_0x51258a){while(--_0x51258a){_0x4960ed['push'](_0x4960ed['shift']());}};_0xbb82a3(++_0x3cf3c8);}(_0x7326,0x188));var _0x6732=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x7326[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0x6732('0x0'));var util=require('util');var path=require(_0x6732('0x1'));var timeout=require('connect-timeout');var express=require(_0x6732('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6732('0x3'));var interaction=require(_0x6732('0x4'));var config=require(_0x6732('0x5'));var controller=require(_0x6732('0x6'));router['get']('/',auth[_0x6732('0x7')](),controller[_0x6732('0x8')]);router[_0x6732('0x9')]('/:id',auth[_0x6732('0x7')](),controller[_0x6732('0xa')]);router[_0x6732('0xb')]('/',auth[_0x6732('0x7')](),controller['create']);router[_0x6732('0xc')](_0x6732('0xd'),auth[_0x6732('0x7')](),controller[_0x6732('0xe')]);router[_0x6732('0xf')](_0x6732('0xd'),auth[_0x6732('0x7')](),controller['destroy']);module[_0x6732('0x10')]=router; \ No newline at end of file +var _0x9a1e=['/:id','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0x9a1e,0x147));var _0xe9a1=function(_0x11c6a3,_0x4c45fb){_0x11c6a3=_0x11c6a3-0x0;var _0xac0396=_0x9a1e[_0x11c6a3];return _0xac0396;};'use strict';var multer=require(_0xe9a1('0x0'));var util=require('util');var path=require(_0xe9a1('0x1'));var timeout=require(_0xe9a1('0x2'));var express=require(_0xe9a1('0x3'));var router=express[_0xe9a1('0x4')]();var fs_extra=require(_0xe9a1('0x5'));var auth=require(_0xe9a1('0x6'));var interaction=require(_0xe9a1('0x7'));var config=require(_0xe9a1('0x8'));var controller=require(_0xe9a1('0x9'));router[_0xe9a1('0xa')]('/',auth[_0xe9a1('0xb')](),controller[_0xe9a1('0xc')]);router[_0xe9a1('0xa')](_0xe9a1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe9a1('0xe')]('/',auth['isAuthenticated'](),controller[_0xe9a1('0xf')]);router['put'](_0xe9a1('0xd'),auth['isAuthenticated'](),controller[_0xe9a1('0x10')]);router[_0xe9a1('0x11')](_0xe9a1('0xd'),auth[_0xe9a1('0xb')](),controller[_0xe9a1('0x12')]);module[_0xe9a1('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 9d53a24..453835d 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 _0xa960=['INTEGER','STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x1f936c,_0x14a812){var _0x58c95d=function(_0xa2872e){while(--_0xa2872e){_0x1f936c['push'](_0x1f936c['shift']());}};_0x58c95d(++_0x14a812);}(_0xa960,0x124));var _0x0a96=function(_0x5b692e,_0x1c3e54){_0x5b692e=_0x5b692e-0x0;var _0x3bd7ab=_0xa960[_0x5b692e];return _0x3bd7ab;};'use strict';var Sequelize=require(_0x0a96('0x0'));module[_0x0a96('0x1')]={'priority':{'type':Sequelize[_0x0a96('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0a96('0x3')],'allowNull':![],'defaultValue':_0x0a96('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0a96('0x5')}}; \ No newline at end of file +var _0xeded=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x2f8642,_0x33cd3b){var _0x28a7f8=function(_0x29b195){while(--_0x29b195){_0x2f8642['push'](_0x2f8642['shift']());}};_0x28a7f8(++_0x33cd3b);}(_0xeded,0x13f));var _0xdede=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeded[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xdede('0x0'));module[_0xdede('0x1')]={'priority':{'type':Sequelize[_0xdede('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xdede('0x3')],'allowNull':![],'defaultValue':_0xdede('0x4')},'appdata':{'type':Sequelize[_0xdede('0x5')]()},'description':{'type':Sequelize[_0xdede('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xdede('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index d3d768e..c2b2667 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 _0xb774=['fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../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','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','create','catch','body','find','destroy','rimraf','zip-dir'];(function(_0x4de1b5,_0x2a7626){var _0xed55cf=function(_0x5f1115){while(--_0x5f1115){_0x4de1b5['push'](_0x4de1b5['shift']());}};_0xed55cf(++_0x2a7626);}(_0xb774,0x9a));var _0x4b77=function(_0x4f4d07,_0x3f640c){_0x4f4d07=_0x4f4d07-0x0;var _0x4308fd=_0xb774[_0x4f4d07];return _0x4308fd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4b77('0x0'));var zipdir=require(_0x4b77('0x1'));var jsonpatch=require(_0x4b77('0x2'));var rp=require('request-promise');var moment=require(_0x4b77('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4b77('0x4'));var util=require(_0x4b77('0x5'));var path=require(_0x4b77('0x6'));var sox=require(_0x4b77('0x7'));var csv=require('to-csv');var ejs=require(_0x4b77('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b77('0x9'));var squel=require(_0x4b77('0xa'));var crypto=require(_0x4b77('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4b77('0xc'));var toCsv=require(_0x4b77('0xd'));var querystring=require(_0x4b77('0xe'));var Papa=require(_0x4b77('0xf'));var Redis=require(_0x4b77('0x10'));var authService=require(_0x4b77('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b77('0x12'));var logger=require(_0x4b77('0x13'))(_0x4b77('0x14'));var utils=require('../../config/utils');var config=require(_0x4b77('0x15'));var licenseUtil=require(_0x4b77('0x16'));var db=require(_0x4b77('0x17'))['db'];function respondWithStatusCode(_0x427fa1,_0x1324b2){_0x1324b2=_0x1324b2||0xcc;return function(_0x5bc544){if(_0x5bc544){return _0x427fa1[_0x4b77('0x18')](_0x1324b2);}return _0x427fa1[_0x4b77('0x19')](_0x1324b2)[_0x4b77('0x1a')]();};}function respondWithResult(_0x551f23,_0x5c68f7){_0x5c68f7=_0x5c68f7||0xc8;return function(_0x12007b){if(_0x12007b){return _0x551f23[_0x4b77('0x19')](_0x5c68f7)[_0x4b77('0x1b')](_0x12007b);}};}function respondWithFilteredResult(_0x17cbcf,_0x30c03b){return function(_0x9e1166){if(_0x9e1166){var _0x48f37c=typeof _0x30c03b[_0x4b77('0x1c')]===_0x4b77('0x1d')&&typeof _0x30c03b[_0x4b77('0x1e')]===_0x4b77('0x1d');var _0x5087cc=_0x9e1166[_0x4b77('0x1f')];var _0x2e0dd3=_0x48f37c?0x0:_0x30c03b['offset'];var _0x107e39=_0x48f37c?_0x9e1166[_0x4b77('0x1f')]:_0x30c03b[_0x4b77('0x1c')]+_0x30c03b[_0x4b77('0x1e')];var _0x355b1e;if(_0x107e39>=_0x5087cc){_0x107e39=_0x5087cc;_0x355b1e=0xc8;}else{_0x355b1e=0xce;}_0x17cbcf['status'](_0x355b1e);return _0x17cbcf[_0x4b77('0x20')](_0x4b77('0x21'),_0x2e0dd3+'-'+_0x107e39+'/'+_0x5087cc)[_0x4b77('0x1b')](_0x9e1166);}return null;};}function patchUpdates(_0x1bc0db){return function(_0x409b17){try{jsonpatch[_0x4b77('0x22')](_0x409b17,_0x1bc0db,!![]);}catch(_0x27258f){return BPromise[_0x4b77('0x23')](_0x27258f);}return _0x409b17[_0x4b77('0x24')]();};}function saveUpdates(_0x290fdc,_0x36cb75){return function(_0x4a422d){if(_0x4a422d){return _0x4a422d[_0x4b77('0x25')](_0x290fdc)[_0x4b77('0x26')](function(_0x5deba1){return _0x5deba1;});}return null;};}function removeEntity(_0x14106e,_0x221e6a){return function(_0x17f642){if(_0x17f642){return _0x17f642['destroy']()['then'](function(){_0x14106e[_0x4b77('0x19')](0xcc)[_0x4b77('0x1a')]();});}};}function handleEntityNotFound(_0xd2e300,_0x551257){return function(_0x1552ef){if(!_0x1552ef){_0xd2e300[_0x4b77('0x18')](0x194);}return _0x1552ef;};}function handleError(_0x198c85,_0x36e07f){_0x36e07f=_0x36e07f||0x1f4;return function(_0x133dd9){logger[_0x4b77('0x27')](_0x133dd9[_0x4b77('0x28')]);if(_0x133dd9['name']){delete _0x133dd9[_0x4b77('0x29')];}_0x198c85[_0x4b77('0x19')](_0x36e07f)[_0x4b77('0x2a')](_0x133dd9);};}exports[_0x4b77('0x2b')]=function(_0x3f925c,_0x5281fa){var _0x4aa33a={},_0x98706a={},_0x23d0eb={'count':0x0,'rows':[]};var _0x1ba717=_[_0x4b77('0x2c')](db[_0x4b77('0x2d')][_0x4b77('0x2e')],function(_0x5b8e25){return{'name':_0x5b8e25[_0x4b77('0x2f')],'type':_0x5b8e25[_0x4b77('0x30')][_0x4b77('0x31')]};});_0x98706a[_0x4b77('0x32')]=_['map'](_0x1ba717,_0x4b77('0x29'));_0x98706a[_0x4b77('0x33')]=_['keys'](_0x3f925c[_0x4b77('0x33')]);_0x98706a[_0x4b77('0x34')]=_['intersection'](_0x98706a[_0x4b77('0x32')],_0x98706a[_0x4b77('0x33')]);_0x4aa33a['attributes']=_[_0x4b77('0x35')](_0x98706a[_0x4b77('0x32')],qs[_0x4b77('0x36')](_0x3f925c['query'][_0x4b77('0x36')]));_0x4aa33a[_0x4b77('0x37')]=_0x4aa33a[_0x4b77('0x37')][_0x4b77('0x38')]?_0x4aa33a[_0x4b77('0x37')]:_0x98706a[_0x4b77('0x32')];if(!_0x3f925c[_0x4b77('0x33')][_0x4b77('0x39')](_0x4b77('0x3a'))){_0x4aa33a[_0x4b77('0x1e')]=qs[_0x4b77('0x1e')](_0x3f925c[_0x4b77('0x33')]['limit']);_0x4aa33a['offset']=qs[_0x4b77('0x1c')](_0x3f925c['query'][_0x4b77('0x1c')]);}_0x4aa33a[_0x4b77('0x3b')]=qs[_0x4b77('0x3c')](_0x3f925c[_0x4b77('0x33')][_0x4b77('0x3c')]);_0x4aa33a[_0x4b77('0x3d')]=qs[_0x4b77('0x34')](_[_0x4b77('0x3e')](_0x3f925c['query'],_0x98706a[_0x4b77('0x34')]),_0x1ba717);if(_0x3f925c[_0x4b77('0x33')][_0x4b77('0x3f')]){_0x4aa33a['where']=_['merge'](_0x4aa33a[_0x4b77('0x3d')],{'$or':_[_0x4b77('0x2c')](_0x1ba717,function(_0x480eac){if(_0x480eac[_0x4b77('0x30')]!==_0x4b77('0x40')){var _0x2a4cda={};_0x2a4cda[_0x480eac[_0x4b77('0x29')]]={'$like':'%'+_0x3f925c[_0x4b77('0x33')][_0x4b77('0x3f')]+'%'};return _0x2a4cda;}})});}_0x4aa33a=_['merge']({},_0x4aa33a,_0x3f925c[_0x4b77('0x41')]);var _0x47648d={'where':_0x4aa33a[_0x4b77('0x3d')]};return db['OpenchannelApplication'][_0x4b77('0x1f')](_0x47648d)[_0x4b77('0x26')](function(_0x727f15){_0x23d0eb[_0x4b77('0x1f')]=_0x727f15;if(_0x3f925c['query'][_0x4b77('0x42')]){_0x4aa33a['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x4b77('0x43')](_0x4aa33a);})[_0x4b77('0x26')](function(_0x56ad80){_0x23d0eb[_0x4b77('0x44')]=_0x56ad80;return _0x23d0eb;})[_0x4b77('0x26')](respondWithFilteredResult(_0x5281fa,_0x4aa33a))['catch'](handleError(_0x5281fa,null));};exports[_0x4b77('0x45')]=function(_0x42fe49,_0x12e1a7){var _0x15c2f1={'raw':!![],'where':{'id':_0x42fe49[_0x4b77('0x46')]['id']}},_0x4e5909={};_0x4e5909[_0x4b77('0x32')]=_[_0x4b77('0x47')](db['OpenchannelApplication']['rawAttributes']);_0x4e5909[_0x4b77('0x33')]=_[_0x4b77('0x47')](_0x42fe49['query']);_0x4e5909[_0x4b77('0x34')]=_['intersection'](_0x4e5909[_0x4b77('0x32')],_0x4e5909[_0x4b77('0x33')]);_0x15c2f1[_0x4b77('0x37')]=_[_0x4b77('0x35')](_0x4e5909['model'],qs[_0x4b77('0x36')](_0x42fe49[_0x4b77('0x33')][_0x4b77('0x36')]));_0x15c2f1[_0x4b77('0x37')]=_0x15c2f1[_0x4b77('0x37')][_0x4b77('0x38')]?_0x15c2f1[_0x4b77('0x37')]:_0x4e5909[_0x4b77('0x32')];if(_0x42fe49[_0x4b77('0x33')]['includeAll']){_0x15c2f1[_0x4b77('0x48')]=[{'all':!![]}];}_0x15c2f1=_['merge']({},_0x15c2f1,_0x42fe49[_0x4b77('0x41')]);return db['OpenchannelApplication']['find'](_0x15c2f1)[_0x4b77('0x26')](handleEntityNotFound(_0x12e1a7,null))[_0x4b77('0x26')](respondWithResult(_0x12e1a7,null))['catch'](handleError(_0x12e1a7,null));};exports[_0x4b77('0x49')]=function(_0xbc813d,_0x4714b0){return db['OpenchannelApplication'][_0x4b77('0x49')](_0xbc813d['body'],{})[_0x4b77('0x26')](respondWithResult(_0x4714b0,0xc9))[_0x4b77('0x4a')](handleError(_0x4714b0,null));};exports[_0x4b77('0x25')]=function(_0x2473a6,_0x5e0df9){if(_0x2473a6[_0x4b77('0x4b')]['id']){delete _0x2473a6['body']['id'];}return db[_0x4b77('0x2d')][_0x4b77('0x4c')]({'where':{'id':_0x2473a6[_0x4b77('0x46')]['id']}})[_0x4b77('0x26')](handleEntityNotFound(_0x5e0df9,null))['then'](saveUpdates(_0x2473a6['body'],null))[_0x4b77('0x26')](respondWithResult(_0x5e0df9,null))[_0x4b77('0x4a')](handleError(_0x5e0df9,null));};exports[_0x4b77('0x4d')]=function(_0xc11f59,_0x3dbad2){return db[_0x4b77('0x2d')][_0x4b77('0x4c')]({'where':{'id':_0xc11f59[_0x4b77('0x46')]['id']}})[_0x4b77('0x26')](handleEntityNotFound(_0x3dbad2,null))['then'](removeEntity(_0x3dbad2,null))[_0x4b77('0x4a')](handleError(_0x3dbad2,null));}; \ No newline at end of file +var _0x7fa8=['map','merge','includeAll','rows','params','fields','length','include','catch','create','body','find','rimraf','zip-dir','request-promise','moment','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/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x32db67,_0x316ea4){var _0x3c7f78=function(_0x1cdf5a){while(--_0x1cdf5a){_0x32db67['push'](_0x32db67['shift']());}};_0x3c7f78(++_0x316ea4);}(_0x7fa8,0x1c2));var _0x87fa=function(_0x3ea5e1,_0x17c486){_0x3ea5e1=_0x3ea5e1-0x0;var _0x1b81d7=_0x7fa8[_0x3ea5e1];return _0x1b81d7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x87fa('0x0'));var zipdir=require(_0x87fa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x87fa('0x2'));var moment=require(_0x87fa('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x87fa('0x4'));var path=require(_0x87fa('0x5'));var sox=require(_0x87fa('0x6'));var csv=require(_0x87fa('0x7'));var ejs=require(_0x87fa('0x8'));var fs=require('fs');var fs_extra=require(_0x87fa('0x9'));var _=require(_0x87fa('0xa'));var squel=require(_0x87fa('0xb'));var crypto=require(_0x87fa('0xc'));var jsforce=require(_0x87fa('0xd'));var deskjs=require(_0x87fa('0xe'));var toCsv=require(_0x87fa('0x7'));var querystring=require(_0x87fa('0xf'));var Papa=require('papaparse');var Redis=require(_0x87fa('0x10'));var authService=require(_0x87fa('0x11'));var qs=require(_0x87fa('0x12'));var as=require(_0x87fa('0x13'));var hardwareService=require(_0x87fa('0x14'));var logger=require(_0x87fa('0x15'))(_0x87fa('0x16'));var utils=require(_0x87fa('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x87fa('0x18'));var db=require(_0x87fa('0x19'))['db'];function respondWithStatusCode(_0x2ab37f,_0x568509){_0x568509=_0x568509||0xcc;return function(_0xc39746){if(_0xc39746){return _0x2ab37f['sendStatus'](_0x568509);}return _0x2ab37f[_0x87fa('0x1a')](_0x568509)[_0x87fa('0x1b')]();};}function respondWithResult(_0x343f8a,_0x40edc4){_0x40edc4=_0x40edc4||0xc8;return function(_0x493c2a){if(_0x493c2a){return _0x343f8a['status'](_0x40edc4)[_0x87fa('0x1c')](_0x493c2a);}};}function respondWithFilteredResult(_0xd2e8ab,_0x90b258){return function(_0x1f7a56){if(_0x1f7a56){var _0x49b3dd=typeof _0x90b258[_0x87fa('0x1d')]===_0x87fa('0x1e')&&typeof _0x90b258[_0x87fa('0x1f')]===_0x87fa('0x1e');var _0x370fdd=_0x1f7a56[_0x87fa('0x20')];var _0x5caba5=_0x49b3dd?0x0:_0x90b258[_0x87fa('0x1d')];var _0x24de48=_0x49b3dd?_0x1f7a56[_0x87fa('0x20')]:_0x90b258[_0x87fa('0x1d')]+_0x90b258['limit'];var _0x4e123d;if(_0x24de48>=_0x370fdd){_0x24de48=_0x370fdd;_0x4e123d=0xc8;}else{_0x4e123d=0xce;}_0xd2e8ab[_0x87fa('0x1a')](_0x4e123d);return _0xd2e8ab[_0x87fa('0x21')](_0x87fa('0x22'),_0x5caba5+'-'+_0x24de48+'/'+_0x370fdd)[_0x87fa('0x1c')](_0x1f7a56);}return null;};}function patchUpdates(_0x584a11){return function(_0x152063){try{jsonpatch[_0x87fa('0x23')](_0x152063,_0x584a11,!![]);}catch(_0x4d6d01){return BPromise[_0x87fa('0x24')](_0x4d6d01);}return _0x152063[_0x87fa('0x25')]();};}function saveUpdates(_0x521c04,_0x52633a){return function(_0x9fb5f3){if(_0x9fb5f3){return _0x9fb5f3['update'](_0x521c04)[_0x87fa('0x26')](function(_0x335607){return _0x335607;});}return null;};}function removeEntity(_0x5e447b,_0x429d8c){return function(_0x219ca9){if(_0x219ca9){return _0x219ca9[_0x87fa('0x27')]()[_0x87fa('0x26')](function(){_0x5e447b[_0x87fa('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1065b8,_0x9fabcc){return function(_0x2be8cf){if(!_0x2be8cf){_0x1065b8[_0x87fa('0x28')](0x194);}return _0x2be8cf;};}function handleError(_0x11bff6,_0x20c755){_0x20c755=_0x20c755||0x1f4;return function(_0x3ac43e){logger[_0x87fa('0x29')](_0x3ac43e['stack']);if(_0x3ac43e[_0x87fa('0x2a')]){delete _0x3ac43e[_0x87fa('0x2a')];}_0x11bff6[_0x87fa('0x1a')](_0x20c755)[_0x87fa('0x2b')](_0x3ac43e);};}exports['index']=function(_0x3648e3,_0x5210a1){var _0x3cd3c9={},_0x3d88b4={},_0x385eb7={'count':0x0,'rows':[]};var _0xcef877=_['map'](db[_0x87fa('0x2c')][_0x87fa('0x2d')],function(_0x41442f){return{'name':_0x41442f[_0x87fa('0x2e')],'type':_0x41442f[_0x87fa('0x2f')][_0x87fa('0x30')]};});_0x3d88b4[_0x87fa('0x31')]=_['map'](_0xcef877,'name');_0x3d88b4[_0x87fa('0x32')]=_[_0x87fa('0x33')](_0x3648e3[_0x87fa('0x32')]);_0x3d88b4[_0x87fa('0x34')]=_[_0x87fa('0x35')](_0x3d88b4[_0x87fa('0x31')],_0x3d88b4['query']);_0x3cd3c9['attributes']=_[_0x87fa('0x35')](_0x3d88b4[_0x87fa('0x31')],qs['fields'](_0x3648e3[_0x87fa('0x32')]['fields']));_0x3cd3c9['attributes']=_0x3cd3c9[_0x87fa('0x36')]['length']?_0x3cd3c9[_0x87fa('0x36')]:_0x3d88b4['model'];if(!_0x3648e3[_0x87fa('0x32')][_0x87fa('0x37')](_0x87fa('0x38'))){_0x3cd3c9[_0x87fa('0x1f')]=qs[_0x87fa('0x1f')](_0x3648e3['query'][_0x87fa('0x1f')]);_0x3cd3c9[_0x87fa('0x1d')]=qs[_0x87fa('0x1d')](_0x3648e3['query']['offset']);}_0x3cd3c9[_0x87fa('0x39')]=qs[_0x87fa('0x3a')](_0x3648e3[_0x87fa('0x32')][_0x87fa('0x3a')]);_0x3cd3c9[_0x87fa('0x3b')]=qs[_0x87fa('0x34')](_[_0x87fa('0x3c')](_0x3648e3['query'],_0x3d88b4['filters']),_0xcef877);if(_0x3648e3['query']['filter']){_0x3cd3c9[_0x87fa('0x3b')]=_['merge'](_0x3cd3c9[_0x87fa('0x3b')],{'$or':_[_0x87fa('0x3d')](_0xcef877,function(_0x59350d){if(_0x59350d[_0x87fa('0x2f')]!=='VIRTUAL'){var _0x4e8a5c={};_0x4e8a5c[_0x59350d[_0x87fa('0x2a')]]={'$like':'%'+_0x3648e3[_0x87fa('0x32')]['filter']+'%'};return _0x4e8a5c;}})});}_0x3cd3c9=_[_0x87fa('0x3e')]({},_0x3cd3c9,_0x3648e3['options']);var _0x4debcf={'where':_0x3cd3c9['where']};return db[_0x87fa('0x2c')][_0x87fa('0x20')](_0x4debcf)[_0x87fa('0x26')](function(_0x4f8619){_0x385eb7['count']=_0x4f8619;if(_0x3648e3[_0x87fa('0x32')][_0x87fa('0x3f')]){_0x3cd3c9['include']=[{'all':!![]}];}return db[_0x87fa('0x2c')]['findAll'](_0x3cd3c9);})['then'](function(_0x3308e0){_0x385eb7[_0x87fa('0x40')]=_0x3308e0;return _0x385eb7;})[_0x87fa('0x26')](respondWithFilteredResult(_0x5210a1,_0x3cd3c9))['catch'](handleError(_0x5210a1,null));};exports['show']=function(_0x3a704b,_0x5bc4a6){var _0x47bf5c={'raw':!![],'where':{'id':_0x3a704b[_0x87fa('0x41')]['id']}},_0x37facb={};_0x37facb[_0x87fa('0x31')]=_[_0x87fa('0x33')](db[_0x87fa('0x2c')][_0x87fa('0x2d')]);_0x37facb['query']=_['keys'](_0x3a704b[_0x87fa('0x32')]);_0x37facb[_0x87fa('0x34')]=_[_0x87fa('0x35')](_0x37facb['model'],_0x37facb[_0x87fa('0x32')]);_0x47bf5c['attributes']=_[_0x87fa('0x35')](_0x37facb['model'],qs[_0x87fa('0x42')](_0x3a704b[_0x87fa('0x32')][_0x87fa('0x42')]));_0x47bf5c[_0x87fa('0x36')]=_0x47bf5c[_0x87fa('0x36')][_0x87fa('0x43')]?_0x47bf5c[_0x87fa('0x36')]:_0x37facb['model'];if(_0x3a704b[_0x87fa('0x32')]['includeAll']){_0x47bf5c[_0x87fa('0x44')]=[{'all':!![]}];}_0x47bf5c=_[_0x87fa('0x3e')]({},_0x47bf5c,_0x3a704b['options']);return db[_0x87fa('0x2c')]['find'](_0x47bf5c)[_0x87fa('0x26')](handleEntityNotFound(_0x5bc4a6,null))[_0x87fa('0x26')](respondWithResult(_0x5bc4a6,null))[_0x87fa('0x45')](handleError(_0x5bc4a6,null));};exports[_0x87fa('0x46')]=function(_0x5de08a,_0x76ce5c){return db[_0x87fa('0x2c')][_0x87fa('0x46')](_0x5de08a[_0x87fa('0x47')],{})['then'](respondWithResult(_0x76ce5c,0xc9))[_0x87fa('0x45')](handleError(_0x76ce5c,null));};exports['update']=function(_0x3e5b00,_0x38a7ff){if(_0x3e5b00[_0x87fa('0x47')]['id']){delete _0x3e5b00[_0x87fa('0x47')]['id'];}return db['OpenchannelApplication'][_0x87fa('0x48')]({'where':{'id':_0x3e5b00[_0x87fa('0x41')]['id']}})[_0x87fa('0x26')](handleEntityNotFound(_0x38a7ff,null))[_0x87fa('0x26')](saveUpdates(_0x3e5b00[_0x87fa('0x47')],null))['then'](respondWithResult(_0x38a7ff,null))[_0x87fa('0x45')](handleError(_0x38a7ff,null));};exports[_0x87fa('0x27')]=function(_0x2877fd,_0x2ba2da){return db[_0x87fa('0x2c')]['find']({'where':{'id':_0x2877fd[_0x87fa('0x41')]['id']}})['then'](handleEntityNotFound(_0x2ba2da,null))['then'](removeEntity(_0x2ba2da,null))[_0x87fa('0x45')](handleError(_0x2ba2da,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index e8d453b..42df521 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 _0x7f88=['../../config/logger','api','moment','bluebird','request-promise','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x25bbdd,_0x4137ed){var _0x20ec55=function(_0x37f6db){while(--_0x37f6db){_0x25bbdd['push'](_0x25bbdd['shift']());}};_0x20ec55(++_0x4137ed);}(_0x7f88,0x98));var _0x87f8=function(_0x5c9cf4,_0x16481d){_0x5c9cf4=_0x5c9cf4-0x0;var _0x1cced0=_0x7f88[_0x5c9cf4];return _0x1cced0;};'use strict';var _=require(_0x87f8('0x0'));var util=require(_0x87f8('0x1'));var logger=require(_0x87f8('0x2'))(_0x87f8('0x3'));var moment=require(_0x87f8('0x4'));var BPromise=require(_0x87f8('0x5'));var rp=require(_0x87f8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x87f8('0x7'));module[_0x87f8('0x8')]=function(_0x3b783f,_0x478572){return _0x3b783f[_0x87f8('0x9')](_0x87f8('0xa'),attributes,{'tableName':_0x87f8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x87f8('0xc'),'collate':_0x87f8('0xd')});}; \ No newline at end of file +var _0xe1ae=['openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','OpenchannelApplication'];(function(_0x7d631d,_0x5c20ab){var _0x561141=function(_0x2a0a61){while(--_0x2a0a61){_0x7d631d['push'](_0x7d631d['shift']());}};_0x561141(++_0x5c20ab);}(_0xe1ae,0xb6));var _0xee1a=function(_0x2757fc,_0xfbd23){_0x2757fc=_0x2757fc-0x0;var _0x58efc4=_0xe1ae[_0x2757fc];return _0x58efc4;};'use strict';var _=require(_0xee1a('0x0'));var util=require(_0xee1a('0x1'));var logger=require(_0xee1a('0x2'))(_0xee1a('0x3'));var moment=require(_0xee1a('0x4'));var BPromise=require(_0xee1a('0x5'));var rp=require(_0xee1a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee1a('0x7'));var config=require(_0xee1a('0x8'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x171145,_0x3018d5){return _0x171145['define'](_0xee1a('0x9'),attributes,{'tableName':_0xee1a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xee1a('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 1673d7a..19a4996 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 _0x65fc=['catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result'];(function(_0x507496,_0x3b00ed){var _0x1b28c7=function(_0x950dd0){while(--_0x950dd0){_0x507496['push'](_0x507496['shift']());}};_0x1b28c7(++_0x3b00ed);}(_0x65fc,0x85));var _0xc65f=function(_0x44389b,_0x5e35e9){_0x44389b=_0x44389b-0x0;var _0x387b67=_0x65fc[_0x44389b];return _0x387b67;};'use strict';var _=require(_0xc65f('0x0'));var util=require(_0xc65f('0x1'));var moment=require(_0xc65f('0x2'));var BPromise=require(_0xc65f('0x3'));var rs=require(_0xc65f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc65f('0x5'))['db'];var utils=require(_0xc65f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc65f('0x7'));var jayson=require(_0xc65f('0x8'));var client=jayson['client'][_0xc65f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16ab55,_0x463f29,_0x199980){return new BPromise(function(_0x347354,_0x26a4ee){return client[_0xc65f('0xa')](_0x16ab55,_0x199980)[_0xc65f('0xb')](function(_0x2193ab){logger[_0xc65f('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x463f29,_0xc65f('0xd'));logger[_0xc65f('0xe')](_0xc65f('0xf'),_0x463f29,_0xc65f('0xd'),JSON[_0xc65f('0x10')](_0x2193ab));if(_0x2193ab['error']){if(_0x2193ab[_0xc65f('0x11')][_0xc65f('0x12')]===0x1f4){logger['error'](_0xc65f('0x13'),_0x463f29,_0x2193ab[_0xc65f('0x11')][_0xc65f('0x14')]);return _0x26a4ee(_0x2193ab[_0xc65f('0x11')][_0xc65f('0x14')]);}logger[_0xc65f('0x11')](_0xc65f('0x13'),_0x463f29,_0x2193ab[_0xc65f('0x11')][_0xc65f('0x14')]);return _0x347354(_0x2193ab['error'][_0xc65f('0x14')]);}else{logger[_0xc65f('0xc')](_0xc65f('0x13'),_0x463f29,_0xc65f('0xd'));_0x347354(_0x2193ab[_0xc65f('0x15')][_0xc65f('0x14')]);}})[_0xc65f('0x16')](function(_0x5613e2){logger[_0xc65f('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x463f29,_0x5613e2);_0x26a4ee(_0x5613e2);});});}exports[_0xc65f('0x17')]=function(_0x15700b){var _0x256820=this;return new Promise(function(_0x5e472f,_0x10d592){return db[_0xc65f('0x18')][_0xc65f('0x19')](_0x15700b[_0xc65f('0x1a')],{'raw':_0x15700b[_0xc65f('0x1b')]?_0x15700b['options'][_0xc65f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15700b[_0xc65f('0x1b')]?_0x15700b[_0xc65f('0x1b')]['where']||null:null,'attributes':_0x15700b[_0xc65f('0x1b')]?_0x15700b['options'][_0xc65f('0x1d')]||null:null,'limit':_0x15700b[_0xc65f('0x1b')]?_0x15700b[_0xc65f('0x1b')][_0xc65f('0x1e')]||null:null})[_0xc65f('0xb')](function(_0x2953ae){logger[_0xc65f('0xc')](_0xc65f('0x17'),_0x15700b);logger[_0xc65f('0xe')](_0xc65f('0x17'),_0x15700b,JSON[_0xc65f('0x10')](_0x2953ae));_0x5e472f(_0x2953ae);})[_0xc65f('0x16')](function(_0x146476){logger[_0xc65f('0x11')](_0xc65f('0x17'),_0x146476[_0xc65f('0x14')],_0x15700b);_0x10d592(_0x256820[_0xc65f('0x11')](0x1f4,_0x146476['message']));});});}; \ No newline at end of file +var _0x4f4c=['attributes','limit','debug','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where'];(function(_0x40db43,_0x3b5276){var _0x53e152=function(_0x1171be){while(--_0x1171be){_0x40db43['push'](_0x40db43['shift']());}};_0x53e152(++_0x3b5276);}(_0x4f4c,0x1f3));var _0xc4f4=function(_0x110841,_0x24eb3f){_0x110841=_0x110841-0x0;var _0xa3578d=_0x4f4c[_0x110841];return _0xa3578d;};'use strict';var _=require(_0xc4f4('0x0'));var util=require(_0xc4f4('0x1'));var moment=require('moment');var BPromise=require(_0xc4f4('0x2'));var rs=require(_0xc4f4('0x3'));var fs=require('fs');var Redis=require(_0xc4f4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc4f4('0x5'));var logger=require(_0xc4f4('0x6'))('rpc');var config=require(_0xc4f4('0x7'));var jayson=require(_0xc4f4('0x8'));var client=jayson[_0xc4f4('0x9')][_0xc4f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ea129,_0x543848,_0x47b8f4){return new BPromise(function(_0x4f6a49,_0x368c56){return client['request'](_0x4ea129,_0x47b8f4)[_0xc4f4('0xb')](function(_0x596bfc){logger[_0xc4f4('0xc')](_0xc4f4('0xd'),_0x543848,'request\x20sent');logger['debug'](_0xc4f4('0xe'),_0x543848,_0xc4f4('0xf'),JSON[_0xc4f4('0x10')](_0x596bfc));if(_0x596bfc[_0xc4f4('0x11')]){if(_0x596bfc[_0xc4f4('0x11')][_0xc4f4('0x12')]===0x1f4){logger['error'](_0xc4f4('0xd'),_0x543848,_0x596bfc[_0xc4f4('0x11')][_0xc4f4('0x13')]);return _0x368c56(_0x596bfc[_0xc4f4('0x11')][_0xc4f4('0x13')]);}logger[_0xc4f4('0x11')](_0xc4f4('0xd'),_0x543848,_0x596bfc[_0xc4f4('0x11')][_0xc4f4('0x13')]);return _0x4f6a49(_0x596bfc['error'][_0xc4f4('0x13')]);}else{logger[_0xc4f4('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x543848,_0xc4f4('0xf'));_0x4f6a49(_0x596bfc['result']['message']);}})[_0xc4f4('0x14')](function(_0x3f8713){logger['error'](_0xc4f4('0xd'),_0x543848,_0x3f8713);_0x368c56(_0x3f8713);});});}exports[_0xc4f4('0x15')]=function(_0x2b9b62){var _0x28b06c=this;return new Promise(function(_0x41f51b,_0x3ec844){return db[_0xc4f4('0x16')][_0xc4f4('0x17')](_0x2b9b62[_0xc4f4('0x18')],{'raw':_0x2b9b62[_0xc4f4('0x19')]?_0x2b9b62[_0xc4f4('0x19')][_0xc4f4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b9b62[_0xc4f4('0x19')]?_0x2b9b62[_0xc4f4('0x19')][_0xc4f4('0x1b')]||null:null,'attributes':_0x2b9b62[_0xc4f4('0x19')]?_0x2b9b62['options'][_0xc4f4('0x1c')]||null:null,'limit':_0x2b9b62['options']?_0x2b9b62['options'][_0xc4f4('0x1d')]||null:null})[_0xc4f4('0xb')](function(_0x1c1a45){logger[_0xc4f4('0xc')]('UpdateOpenchannelApplication',_0x2b9b62);logger[_0xc4f4('0x1e')](_0xc4f4('0x15'),_0x2b9b62,JSON[_0xc4f4('0x10')](_0x1c1a45));_0x41f51b(_0x1c1a45);})['catch'](function(_0x38156e){logger[_0xc4f4('0x11')](_0xc4f4('0x15'),_0x38156e[_0xc4f4('0x13')],_0x2b9b62);_0x3ec844(_0x28b06c[_0xc4f4('0x11')](0x1f4,_0x38156e[_0xc4f4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 41b3c10..40d23e4 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 _0x9832=['getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages'];(function(_0x462fe4,_0x394d3e){var _0x82b23a=function(_0x2c071f){while(--_0x2c071f){_0x462fe4['push'](_0x462fe4['shift']());}};_0x82b23a(++_0x394d3e);}(_0x9832,0x1e0));var _0x2983=function(_0x189c81,_0xa204d3){_0x189c81=_0x189c81-0x0;var _0x18f178=_0x9832[_0x189c81];return _0x18f178;};'use strict';var multer=require(_0x2983('0x0'));var util=require(_0x2983('0x1'));var path=require('path');var timeout=require(_0x2983('0x2'));var express=require(_0x2983('0x3'));var router=express[_0x2983('0x4')]();var fs_extra=require(_0x2983('0x5'));var auth=require(_0x2983('0x6'));var interaction=require(_0x2983('0x7'));var config=require('../../config/environment');var controller=require(_0x2983('0x8'));router[_0x2983('0x9')]('/',auth[_0x2983('0xa')](),controller[_0x2983('0xb')]);router['get'](_0x2983('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x2983('0x9')](_0x2983('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x2983('0xe'),auth[_0x2983('0xa')](),controller[_0x2983('0xf')]);router[_0x2983('0x9')](_0x2983('0x10'),auth['isAuthenticated'](),controller[_0x2983('0x11')]);router[_0x2983('0x12')]('/',auth['isAuthenticated'](),controller[_0x2983('0x13')]);router[_0x2983('0x12')](_0x2983('0xe'),auth['isAuthenticated'](),controller[_0x2983('0x14')]);router['post'](_0x2983('0x15'),auth['isAuthenticated'](),interaction[_0x2983('0x16')](_0x2983('0x17'),_0x2983('0x18')),controller[_0x2983('0x19')]);router[_0x2983('0x1a')](_0x2983('0xd'),auth['isAuthenticated'](),interaction[_0x2983('0x16')](_0x2983('0x17'),_0x2983('0x1b')),controller[_0x2983('0x1c')]);router[_0x2983('0x1d')]('/:id',auth[_0x2983('0xa')](),interaction['tracked']('openchannel',_0x2983('0x1e')),controller[_0x2983('0x1f')]);router[_0x2983('0x1d')](_0x2983('0x15'),auth[_0x2983('0xa')](),controller['removeTags']);module[_0x2983('0x20')]=router; \ No newline at end of file +var _0x37cd=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','index','isAuthenticated','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked','openchannel','addTags','put','/:id','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','connect-timeout'];(function(_0x423970,_0x45b20d){var _0x3f1af5=function(_0x46c106){while(--_0x46c106){_0x423970['push'](_0x423970['shift']());}};_0x3f1af5(++_0x45b20d);}(_0x37cd,0x6f));var _0xd37c=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x37cd[_0x47e7cb];return _0x2a8874;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd37c('0x0'));var express=require(_0xd37c('0x1'));var router=express['Router']();var fs_extra=require(_0xd37c('0x2'));var auth=require(_0xd37c('0x3'));var interaction=require(_0xd37c('0x4'));var config=require('../../config/environment');var controller=require(_0xd37c('0x5'));router[_0xd37c('0x6')]('/',auth['isAuthenticated'](),controller[_0xd37c('0x7')]);router['get']('/describe',auth[_0xd37c('0x8')](),controller['describe']);router['get']('/:id',auth[_0xd37c('0x8')](),controller[_0xd37c('0x9')]);router[_0xd37c('0x6')](_0xd37c('0xa'),auth['isAuthenticated'](),controller[_0xd37c('0xb')]);router[_0xd37c('0x6')]('/:id/download',auth[_0xd37c('0x8')](),controller[_0xd37c('0xc')]);router[_0xd37c('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd37c('0xd')](_0xd37c('0xa'),auth['isAuthenticated'](),controller[_0xd37c('0xe')]);router[_0xd37c('0xd')](_0xd37c('0xf'),auth['isAuthenticated'](),interaction[_0xd37c('0x10')](_0xd37c('0x11'),'openchannelinteraction:addtags'),controller[_0xd37c('0x12')]);router[_0xd37c('0x13')](_0xd37c('0x14'),auth[_0xd37c('0x8')](),interaction[_0xd37c('0x10')](_0xd37c('0x11'),_0xd37c('0x15')),controller[_0xd37c('0x16')]);router[_0xd37c('0x17')](_0xd37c('0x14'),auth[_0xd37c('0x8')](),interaction[_0xd37c('0x10')]('openchannel',_0xd37c('0x18')),controller[_0xd37c('0x19')]);router['delete'](_0xd37c('0xf'),auth[_0xd37c('0x8')](),controller[_0xd37c('0x1a')]);module[_0xd37c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index c862bc7..e3cd17a 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 _0x1c55=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x458edc,_0x9baf98){var _0x44af29=function(_0x41929c){while(--_0x41929c){_0x458edc['push'](_0x458edc['shift']());}};_0x44af29(++_0x9baf98);}(_0x1c55,0x1e3));var _0x51c5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1c55[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x51c5('0x0'));module[_0x51c5('0x1')]={'closed':{'type':Sequelize[_0x51c5('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x51c5('0x3')]},'disposition':{'type':Sequelize[_0x51c5('0x4')]},'secondDisposition':{'type':Sequelize[_0x51c5('0x4')]},'thirdDisposition':{'type':Sequelize[_0x51c5('0x4')]},'note':{'type':Sequelize[_0x51c5('0x4')]},'read1stAt':{'type':Sequelize[_0x51c5('0x3')]},'threadId':{'type':Sequelize[_0x51c5('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x51c5('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x51c5('0x5')]('in',_0x51c5('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x51c5('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x51c5('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x0a62=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x52713c,_0x5eee67){var _0x54d575=function(_0x3dc4f6){while(--_0x3dc4f6){_0x52713c['push'](_0x52713c['shift']());}};_0x54d575(++_0x5eee67);}(_0x0a62,0x119));var _0x20a6=function(_0x331639,_0x3ceeaa){_0x331639=_0x331639-0x0;var _0x5420ea=_0x0a62[_0x331639];return _0x5420ea;};'use strict';var Sequelize=require(_0x20a6('0x0'));module[_0x20a6('0x1')]={'closed':{'type':Sequelize[_0x20a6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x20a6('0x3')]},'disposition':{'type':Sequelize[_0x20a6('0x4')]},'secondDisposition':{'type':Sequelize[_0x20a6('0x4')]},'thirdDisposition':{'type':Sequelize[_0x20a6('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x20a6('0x4')]},'externalUrl':{'type':Sequelize[_0x20a6('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x20a6('0x5')]('in',_0x20a6('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x20a6('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x20a6('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 753e02f..68e3495 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 _0x4c13=['closed','YYYY-MM-DD\x20HH:mm:ss','disposition','threadId','Public','Private','basename','existsSync','pipe','createWriteStream','System','lastName','renderFile','views','transcript-','.pdf','Openchannel','createPdfFromHTML','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','map','fullname','Tags','TagIds','split','forEach','catch','index','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','field','from','tools_tags','select','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','parseSearch','search','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','OpenchannelInteraction','a.key','Account.key','a.mandatoryDisposition','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','push','show','params','rawAttributes','keys','includeAll','include','merge','options','create','body','describe','OpenchannelMessage','addMessage','omit','ids','format','findAll','rows','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','CmContact','firstName','Attachment','Messages','direction','secret','read','OpenchannelAccount','Account','get','mkdirSync','Owner','N.A.'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4c13,0x102));var _0x34c1=function(_0x20499e,_0x47ccd6){_0x20499e=_0x20499e-0x0;var _0x255050=_0x4c13[_0x20499e];return _0x255050;};'use strict';var emlformat=require(_0x34c1('0x0'));var rimraf=require(_0x34c1('0x1'));var zipdir=require(_0x34c1('0x2'));var jsonpatch=require(_0x34c1('0x3'));var rp=require(_0x34c1('0x4'));var moment=require(_0x34c1('0x5'));var BPromise=require(_0x34c1('0x6'));var Mustache=require(_0x34c1('0x7'));var util=require('util');var path=require(_0x34c1('0x8'));var sox=require(_0x34c1('0x9'));var csv=require(_0x34c1('0xa'));var ejs=require(_0x34c1('0xb'));var fs=require('fs');var fs_extra=require(_0x34c1('0xc'));var _=require(_0x34c1('0xd'));var squel=require(_0x34c1('0xe'));var crypto=require('crypto');var jsforce=require(_0x34c1('0xf'));var deskjs=require(_0x34c1('0x10'));var toCsv=require(_0x34c1('0xa'));var querystring=require('querystring');var Papa=require(_0x34c1('0x11'));var Redis=require('ioredis');var authService=require(_0x34c1('0x12'));var qs=require(_0x34c1('0x13'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x34c1('0x14'));var hardwareService=require(_0x34c1('0x15'));var logger=require(_0x34c1('0x16'))('api');var utils=require(_0x34c1('0x17'));var config=require(_0x34c1('0x18'));var licenseUtil=require(_0x34c1('0x19'));var db=require(_0x34c1('0x1a'))['db'];config['redis']=_[_0x34c1('0x1b')](config[_0x34c1('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x34c1('0x1d'))(new Redis(config[_0x34c1('0x1c')]));require('./openchannelInteraction.socket')[_0x34c1('0x1e')](socket);function respondWithStatusCode(_0x2ab663,_0x2e7779){_0x2e7779=_0x2e7779||0xcc;return function(_0x4d256e){if(_0x4d256e){return _0x2ab663[_0x34c1('0x1f')](_0x2e7779);}return _0x2ab663[_0x34c1('0x20')](_0x2e7779)[_0x34c1('0x21')]();};}function respondWithResult(_0x40c764,_0x435625){_0x435625=_0x435625||0xc8;return function(_0x5a6b96){if(_0x5a6b96){return _0x40c764[_0x34c1('0x20')](_0x435625)[_0x34c1('0x22')](_0x5a6b96);}};}function respondWithFilteredResult(_0x1b6d57,_0x42d4ee){return function(_0x5e01d3){if(_0x5e01d3){var _0x1ed199=typeof _0x42d4ee[_0x34c1('0x23')]==='undefined'&&typeof _0x42d4ee['limit']==='undefined';var _0x5cbb42=_0x5e01d3[_0x34c1('0x24')];var _0x340e99=_0x1ed199?0x0:_0x42d4ee['offset'];var _0xd4c99b=_0x1ed199?_0x5e01d3[_0x34c1('0x24')]:_0x42d4ee[_0x34c1('0x23')]+_0x42d4ee['limit'];var _0x1f7085;if(_0xd4c99b>=_0x5cbb42){_0xd4c99b=_0x5cbb42;_0x1f7085=0xc8;}else{_0x1f7085=0xce;}_0x1b6d57[_0x34c1('0x20')](_0x1f7085);return _0x1b6d57[_0x34c1('0x25')](_0x34c1('0x26'),_0x340e99+'-'+_0xd4c99b+'/'+_0x5cbb42)[_0x34c1('0x22')](_0x5e01d3);}return null;};}function patchUpdates(_0x558234){return function(_0x24114b){try{jsonpatch[_0x34c1('0x27')](_0x24114b,_0x558234,!![]);}catch(_0x484b99){return BPromise[_0x34c1('0x28')](_0x484b99);}return _0x24114b[_0x34c1('0x29')]();};}function saveUpdates(_0x12ed9d,_0x415ea0){return function(_0x2959f6){if(_0x2959f6){return _0x2959f6[_0x34c1('0x2a')](_0x12ed9d)[_0x34c1('0x2b')](function(_0x43d397){return _0x43d397;});}return null;};}function removeEntity(_0x3337e8,_0x5f0962){return function(_0x2f11e5){if(_0x2f11e5){return _0x2f11e5[_0x34c1('0x2c')]()[_0x34c1('0x2b')](function(){_0x3337e8[_0x34c1('0x20')](0xcc)[_0x34c1('0x21')]();});}};}function handleEntityNotFound(_0x4bf751,_0x158be7){return function(_0x125665){if(!_0x125665){_0x4bf751['sendStatus'](0x194);}return _0x125665;};}function handleError(_0x96a3c5,_0x5ba572){_0x5ba572=_0x5ba572||0x1f4;return function(_0xbd85e){logger['error'](_0xbd85e['stack']);if(_0xbd85e[_0x34c1('0x2d')]){delete _0xbd85e[_0x34c1('0x2d')];}_0x96a3c5[_0x34c1('0x20')](_0x5ba572)[_0x34c1('0x2e')](_0xbd85e);};}function getInteractionUsers(_0x5293f7,_0x59120a){return new BPromise(function(_0x1866d7,_0xcf2f4b){try{if(_0x59120a[_0x5293f7['id']]){_0x5293f7['Users']=_[_0x34c1('0x2f')](_0x59120a[_0x5293f7['id']],function(_0x29fd7b){return{'id':_0x29fd7b['id'],'fullname':_0x29fd7b[_0x34c1('0x30')]};});}}catch(_0x2e1cc0){_0xcf2f4b(_0x2e1cc0);}_0x1866d7(_0x5293f7);});}function getInteractionTags(_0x399609,_0x4ee8b3){return new BPromise(function(_0xb53b2,_0x5cd60e){try{if(_0x399609['TagIds']){_0x399609[_0x34c1('0x31')]=[];_0x399609[_0x34c1('0x32')][_0x34c1('0x33')](',')[_0x34c1('0x34')](function(_0x2c4541){_0x399609['Tags']['push'](_0x4ee8b3[_0x2c4541]);});}delete _0x399609[_0x34c1('0x32')];}catch(_0x218709){_0x5cd60e(_0x218709);}_0xb53b2(_0x399609);});}function updateOpenchannelInteraction(_0x30c54f,_0xdf1765,_0x46f8fb){return new BPromise(function(_0x35d7a8,_0x17223a){return getInteractionUsers(_0x30c54f,_0x46f8fb)[_0x34c1('0x2b')](function(_0x588722){return getInteractionTags(_0x588722,_0xdf1765);})[_0x34c1('0x2b')](function(_0x248ef4){_0x35d7a8(_0x248ef4);})[_0x34c1('0x35')](function(_0x164ce7){_0x17223a(_0x164ce7);});});}exports[_0x34c1('0x36')]=function(_0x40ebb9,_0x1004cb){var _0x1de541={},_0x5b6460={},_0x37652e={'count':0x0,'rows':[]};var _0x3eecec=_[_0x34c1('0x2f')](db['OpenchannelInteraction']['rawAttributes'],function(_0x3df992){return{'name':_0x3df992[_0x34c1('0x37')],'type':_0x3df992['type'][_0x34c1('0x38')]};});_0x5b6460[_0x34c1('0x39')]=_[_0x34c1('0x2f')](_0x3eecec,_0x34c1('0x2d'));_0x5b6460[_0x34c1('0x3a')]=_['keys'](_0x40ebb9[_0x34c1('0x3a')]);_0x5b6460[_0x34c1('0x3b')]=_['intersection'](_0x5b6460[_0x34c1('0x39')],_0x5b6460[_0x34c1('0x3a')]);_0x1de541[_0x34c1('0x3c')]=_[_0x34c1('0x3d')](_0x5b6460['model'],qs[_0x34c1('0x3e')](_0x40ebb9[_0x34c1('0x3a')][_0x34c1('0x3e')]));_0x1de541['attributes']=_0x1de541[_0x34c1('0x3c')][_0x34c1('0x3f')]?_0x1de541[_0x34c1('0x3c')]:_0x5b6460['model'];if(!_0x40ebb9[_0x34c1('0x3a')][_0x34c1('0x40')](_0x34c1('0x41'))){_0x1de541['limit']=qs['limit'](_0x40ebb9[_0x34c1('0x3a')][_0x34c1('0x42')]);_0x1de541[_0x34c1('0x23')]=qs[_0x34c1('0x23')](_0x40ebb9[_0x34c1('0x3a')][_0x34c1('0x23')]);}_0x1de541[_0x34c1('0x43')]=qs['sort'](_0x40ebb9[_0x34c1('0x3a')][_0x34c1('0x44')]);_0x1de541[_0x34c1('0x45')]=qs[_0x34c1('0x3b')](_['pick'](_0x40ebb9[_0x34c1('0x3a')],_0x5b6460[_0x34c1('0x3b')]),_0x3eecec);var _0x9cd75b=[];var _0x52fbd2=squel['select']()[_0x34c1('0x46')]('id')[_0x34c1('0x46')](_0x34c1('0x2d'))[_0x34c1('0x46')]('color')[_0x34c1('0x47')](_0x34c1('0x48'));var _0x56f464=squel[_0x34c1('0x49')]()[_0x34c1('0x46')]('u.id')[_0x34c1('0x46')](_0x34c1('0x4a'))['field'](_0x34c1('0x4b'))[_0x34c1('0x47')](_0x34c1('0x4c'),'ui')[_0x34c1('0x4d')](_0x34c1('0x4e'),'u',_0x34c1('0x4f'));var _0x3ac3e7=squel['select']()[_0x34c1('0x47')]('openchannel_interactions','i')[_0x34c1('0x4d')]('cm_contacts','c',_0x34c1('0x50'))[_0x34c1('0x4d')](_0x34c1('0x4e'),'o',_0x34c1('0x51'))['left_join']('openchannel_accounts','a',_0x34c1('0x52'))[_0x34c1('0x4d')]('openchannel_messages','me',_0x34c1('0x53'))[_0x34c1('0x4d')](_0x34c1('0x54'),'it',_0x34c1('0x55'))[_0x34c1('0x4d')](_0x34c1('0x48'),'t','t.id\x20=\x20it.TagId');var _0x2d77f3=squel['expr']();var _0x3b30ac=[];var _0x43c735=squel['expr']();var _0x589d09;if(_0x40ebb9[_0x34c1('0x3a')]['search']){_0x589d09=as[_0x34c1('0x56')](_0x40ebb9[_0x34c1('0x3a')][_0x34c1('0x57')]);var _0x5a8e05=_0x589d09[_0x34c1('0x58')];for(var _0x5ca16a=0x0;_0x5ca16a<_0x589d09['conditions'][_0x34c1('0x3f')];_0x5ca16a++){var _0x5f0a86=_0x589d09[_0x34c1('0x59')][_0x5ca16a];var _0x1db76='i';var _0x106790=_[_0x34c1('0x5a')](_0x3eecec,[_0x34c1('0x2d'),_0x5f0a86['field']]);if(!_0x106790){switch(_0x5f0a86[_0x34c1('0x46')]){case _0x34c1('0x5b'):if(_0x5f0a86['value']==0x1){_0x3ac3e7[_0x34c1('0x5c')]('`'+_0x5f0a86[_0x34c1('0x46')]+_0x34c1('0x5d'));}else{_0x3ac3e7['having']('`'+_0x5f0a86[_0x34c1('0x46')]+_0x34c1('0x5e'));}break;case _0x34c1('0x5f'):if(_0x5f0a86[_0x34c1('0x60')]===_0x34c1('0x61')){if(_0x5f0a86['value'][_0x34c1('0x33')]('\x20')['length']>0x1){_0x2d77f3[_0x5a8e05](_0x34c1('0x62'),qs['getFullTextValue'](_0x5f0a86[_0x34c1('0x63')]),null);}else{var _0xbfd5d3='%'+_0x5f0a86[_0x34c1('0x63')]+'%';_0x2d77f3[_0x5a8e05](_0x34c1('0x64'),_0xbfd5d3,_0xbfd5d3,_0xbfd5d3);}}else{_0x106790=_[_0x34c1('0x5a')](_0x3eecec,['name','ContactId']);_0x5f0a86[_0x34c1('0x46')]=_0x34c1('0x65');_0x31cbd7=as[_0x34c1('0x66')](_0x1db76,_0x106790[_0x34c1('0x67')],_0x5f0a86);_0x2d77f3[_0x5a8e05](_0x31cbd7[_0x34c1('0x68')],_0x31cbd7[_0x34c1('0x63')]['start'],_0x31cbd7[_0x34c1('0x63')][_0x34c1('0x21')]);}break;case _0x34c1('0x69'):var _0x358c3b=_0x5f0a86[_0x34c1('0x63')][_0x34c1('0x33')](',')[_0x34c1('0x2f')](function(_0x35afc8){return Number(_0x35afc8);});_0x358c3b[_0x34c1('0x34')](function(_0x3f0ca1){_0x43c735['or'](_0x34c1('0x6a'),'%,'+_0x3f0ca1+',%');});_0x3b30ac=_['union'](_0x3b30ac,_0x358c3b);break;case _0x34c1('0x6b'):if(_0x5f0a86[_0x34c1('0x60')]===_0x34c1('0x61')){_0x2d77f3[_0x5a8e05](_0x34c1('0x6c'),'%'+_0x5f0a86[_0x34c1('0x63')]+'%',null);}else{_0x106790=_[_0x34c1('0x5a')](_0x3eecec,['name',_0x34c1('0x6d')]);_0x5f0a86[_0x34c1('0x46')]=_0x34c1('0x6d');_0x31cbd7=as[_0x34c1('0x66')](_0x1db76,_0x106790[_0x34c1('0x67')],_0x5f0a86);_0x2d77f3[_0x5a8e05](_0x31cbd7[_0x34c1('0x68')],_0x31cbd7['value']['start'],_0x31cbd7[_0x34c1('0x63')][_0x34c1('0x21')]);}break;case'body':_0x31cbd7=as[_0x34c1('0x66')]('me',null,_0x5f0a86);_0x2d77f3[_0x5a8e05](_0x31cbd7[_0x34c1('0x68')],_0x31cbd7['value'][_0x34c1('0x6e')],_0x31cbd7[_0x34c1('0x63')][_0x34c1('0x21')]);break;}}else{var _0x31cbd7=as['buildExpression'](_0x1db76,_0x106790['type'],_0x5f0a86);_0x2d77f3[_0x5a8e05](_0x31cbd7[_0x34c1('0x68')],_0x31cbd7[_0x34c1('0x63')][_0x34c1('0x6e')],_0x31cbd7[_0x34c1('0x63')][_0x34c1('0x21')]);}}}else{var _0x21ac76=_(_0x40ebb9[_0x34c1('0x3a')])['keys']()[_0x34c1('0x2f')](function(_0x9422c3){return _[_0x34c1('0x6f')](_0x3eecec,[_0x34c1('0x2d'),_0x9422c3])?_0x9422c3:undefined;})[_0x34c1('0x70')]()['value']();if(!_[_0x34c1('0x71')](_0x21ac76)){_0x21ac76[_0x34c1('0x34')](function(_0xf4d00e){if(_0xf4d00e===_0x34c1('0x72')){_0x3ac3e7[_0x34c1('0x45')](_0x34c1('0x73'),[][_0x34c1('0x74')](_0x40ebb9[_0x34c1('0x3a')][_0xf4d00e]));}else if(_0xf4d00e===_0x34c1('0x75')){var _0x10a6b3=JSON[_0x34c1('0x76')](_0x40ebb9[_0x34c1('0x3a')][_0xf4d00e])[_0x34c1('0x77')];var _0x536e73=JSON[_0x34c1('0x76')](_0x40ebb9[_0x34c1('0x3a')][_0xf4d00e])[_0x34c1('0x78')];_0x3ac3e7[_0x34c1('0x45')](_0x34c1('0x79'),_0x10a6b3,_0x536e73);}else{if(_0x40ebb9['query'][_0xf4d00e]===_0x34c1('0x7a')){_0x3ac3e7[_0x34c1('0x45')]('i.'+_0xf4d00e+_0x34c1('0x7b'));}else{_0x3ac3e7[_0x34c1('0x45')]('i.'+_0xf4d00e+_0x34c1('0x7c'),_0x40ebb9['query'][_0xf4d00e]);}}});}if(_0x40ebb9[_0x34c1('0x3a')]['read']){if(_0x40ebb9[_0x34c1('0x3a')]['read']==0x1){_0x3ac3e7[_0x34c1('0x5c')](_0x34c1('0x7d'));}else{_0x3ac3e7[_0x34c1('0x5c')](_0x34c1('0x7e'));}}if(_0x40ebb9[_0x34c1('0x3a')][_0x34c1('0x7f')]){_0x3b30ac=_[_0x34c1('0x80')](_0x40ebb9[_0x34c1('0x3a')][_0x34c1('0x7f')])?_0x40ebb9['query'][_0x34c1('0x7f')]:new Array(_0x40ebb9[_0x34c1('0x3a')]['tag']);_0x3b30ac[_0x34c1('0x34')](function(_0x4ce33f){_0x43c735['or'](_0x34c1('0x6a'),'%,'+_0x4ce33f+',%');});}if(_0x40ebb9[_0x34c1('0x3a')]['filter']){var _0x3a7718=_0x40ebb9[_0x34c1('0x3a')][_0x34c1('0x81')][_0x34c1('0x82')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x34c1('0x83')](_0x3a7718)){_0x2d77f3['or'](_0x34c1('0x84'),_0x3a7718+'%');}else{_0x2d77f3['or'](_0x34c1('0x85'),qs['getFullTextValue'](_0x3a7718))['or'](_0x34c1('0x86'),_0x3a7718+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3a7718+'%');}}}_0x3ac3e7['where'](_0x2d77f3);_0x3ac3e7[_0x34c1('0x87')]('i.id');var _0x2484de={'type':db[_0x34c1('0x88')]['QueryTypes']['SELECT'],'raw':!![]};var _0x33d2d7=_0x3ac3e7[_0x34c1('0x89')]();_0x33d2d7[_0x34c1('0x46')]('i.id');_0x33d2d7[_0x34c1('0x46')](_0x34c1('0x8a'),_0x34c1('0x5b'));if(_0x1de541[_0x34c1('0x43')]){_0x1de541[_0x34c1('0x43')]['forEach'](function(_0x321e72){var _0x3d4906=_0x321e72[0x0]==='contactName'?_0x321e72[0x0]:'i.'+_0x321e72[0x0];_0x3ac3e7['order'](_0x3d4906,_0x321e72[0x1]===_0x34c1('0x8b')?![]:!![]);});}if(!_[_0x34c1('0x71')](_0x3b30ac)){_0x3ac3e7[_0x34c1('0x5c')](_0x43c735);_0x33d2d7['where']('t.id\x20IN\x20?',_0x3b30ac);}BPromise[_0x34c1('0x8c')]()[_0x34c1('0x2b')](function(){if(!_0x589d09){if(_0x40ebb9[_0x34c1('0x3a')][_0x34c1('0x72')])return;_0x33d2d7[_0x34c1('0x45')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x3ac3e7[_0x34c1('0x45')](_0x34c1('0x8d'));return;}if(_0x40ebb9[_0x34c1('0x8e')][_0x34c1('0x8f')]!==_0x34c1('0x90'))return;return _0x40ebb9[_0x34c1('0x8e')][_0x34c1('0x91')]({'attributes':['id'],'raw':!![]})[_0x34c1('0x2b')](function(_0x138799){if(_['isEmpty'](_0x138799)){_0x33d2d7['where'](_0x34c1('0x92'));_0x3ac3e7['where'](_0x34c1('0x92'));}else{_0x33d2d7[_0x34c1('0x45')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x138799,'id'));_0x3ac3e7['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x34c1('0x2f')](_0x138799,'id'));}});})[_0x34c1('0x2b')](function(){if(_0x40ebb9[_0x34c1('0x8e')]['role']==='agent'&&!_0x589d09&&!_0x40ebb9[_0x34c1('0x3a')]['OpenchannelAccountId'])return[];return db[_0x34c1('0x93')][_0x34c1('0x3a')](_0x33d2d7[_0x34c1('0x94')](),_0x2484de);})['then'](function(_0x4010c8){_0x37652e[_0x34c1('0x24')]=_0x4010c8[_0x34c1('0x3f')];if(_0x37652e[_0x34c1('0x24')]===0x0)return[];return db[_0x34c1('0x93')][_0x34c1('0x3a')](_0x52fbd2[_0x34c1('0x94')](),_0x2484de)['then'](function(_0xfc7e28){_0x9cd75b=_[_0x34c1('0x95')](_0xfc7e28,'id');_0x2484de=_['merge'](_0x2484de,{'model':db[_0x34c1('0x96')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x40ebb9[_0x34c1('0x3a')][_0x34c1('0x3e')]){_0x1de541['attributes'][_0x34c1('0x34')](function(_0x28f087){_0x3ac3e7['field']('i.'+_0x28f087);});}else{_0x3ac3e7[_0x34c1('0x46')](_0x34c1('0x8a'),'unreadMessages');_0x3ac3e7[_0x34c1('0x46')](_0x34c1('0x97'),_0x34c1('0x98'));_0x3ac3e7[_0x34c1('0x46')](_0x34c1('0x99'),'Account.mandatoryDisposition');_0x3ac3e7[_0x34c1('0x46')]('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',_0x34c1('0x9a'));_0x3ac3e7[_0x34c1('0x46')](_0x34c1('0x9b'));_0x3ac3e7[_0x34c1('0x46')](_0x34c1('0x9c'),_0x34c1('0x9d'));_0x3ac3e7[_0x34c1('0x46')](_0x34c1('0x9e'),_0x34c1('0x9f'));_0x3ac3e7[_0x34c1('0x46')](_0x34c1('0xa0'),_0x34c1('0xa1'));_0x3ac3e7[_0x34c1('0x46')](_0x34c1('0xa2'),_0x34c1('0xa3'));_0x3ac3e7[_0x34c1('0x46')](_0x34c1('0xa4'),_0x34c1('0xa5'));_0x3ac3e7[_0x34c1('0x46')](_0x34c1('0xa6'),'Contact.fax');_0x3ac3e7[_0x34c1('0x46')](_0x34c1('0xa7'),_0x34c1('0xa8'));_0x3ac3e7[_0x34c1('0x46')](_0x34c1('0xa9'),_0x34c1('0xaa'));_0x3ac3e7[_0x34c1('0x46')](_0x34c1('0xab'),_0x34c1('0x32'));}if(_0x1de541[_0x34c1('0x42')])_0x3ac3e7[_0x34c1('0x42')](_0x1de541[_0x34c1('0x42')]);if(_0x1de541[_0x34c1('0x23')])_0x3ac3e7[_0x34c1('0x23')](_0x1de541[_0x34c1('0x23')]);return db['sequelize'][_0x34c1('0x3a')](_0x3ac3e7[_0x34c1('0x94')](),_0x2484de);})[_0x34c1('0x2b')](function(_0x3ee43a){if(_0x3ee43a[_0x34c1('0x3f')]>0x0)_0x56f464['where'](_0x34c1('0xac'),_[_0x34c1('0x2f')](_0x3ee43a,'id'));return db[_0x34c1('0x93')][_0x34c1('0x3a')](_0x56f464['toString'](),_0x2484de)[_0x34c1('0x2b')](function(_0x101b15){var _0x134071=_['groupBy'](_0x101b15,_0x34c1('0xad'));var _0x4b08cd=[];_0x3ee43a[_0x34c1('0x34')](function(_0x7c234f){_0x4b08cd[_0x34c1('0xae')](updateOpenchannelInteraction(_0x7c234f,_0x9cd75b,_0x134071));});return BPromise['all'](_0x4b08cd);});});})['then'](function(_0x1feea8){_0x37652e['rows']=_0x1feea8;return _0x37652e;})[_0x34c1('0x2b')](respondWithFilteredResult(_0x1004cb,_0x1de541))[_0x34c1('0x35')](handleError(_0x1004cb,null));};exports[_0x34c1('0xaf')]=function(_0x438c17,_0x31dfc2){var _0x5484a8={};if(_0x438c17['query'][_0x34c1('0x67')]&&_0x438c17[_0x34c1('0x3a')]['type']==='from'){_0x5484a8[_0x34c1('0x47')]=_0x438c17[_0x34c1('0xb0')]['id'];}else{_0x5484a8['id']=_0x438c17[_0x34c1('0xb0')]['id'];}var _0x11f8e6={'raw':![],'where':_0x5484a8},_0x598548={};_0x598548[_0x34c1('0x39')]=_['keys'](db['OpenchannelInteraction'][_0x34c1('0xb1')]);_0x598548['query']=_[_0x34c1('0xb2')](_0x438c17[_0x34c1('0x3a')]);_0x598548[_0x34c1('0x3b')]=_[_0x34c1('0x3d')](_0x598548['model'],_0x598548[_0x34c1('0x3a')]);_0x11f8e6[_0x34c1('0x3c')]=_[_0x34c1('0x3d')](_0x598548[_0x34c1('0x39')],qs[_0x34c1('0x3e')](_0x438c17[_0x34c1('0x3a')]['fields']));_0x11f8e6[_0x34c1('0x3c')]=_0x11f8e6[_0x34c1('0x3c')][_0x34c1('0x3f')]?_0x11f8e6[_0x34c1('0x3c')]:_0x598548[_0x34c1('0x39')];if(_0x438c17[_0x34c1('0x3a')][_0x34c1('0xb3')]){_0x11f8e6[_0x34c1('0xb4')]=[{'all':!![]}];}_0x11f8e6=_[_0x34c1('0xb5')]({},_0x11f8e6,_0x438c17[_0x34c1('0xb6')]);return db[_0x34c1('0x96')]['find'](_0x11f8e6)[_0x34c1('0x2b')](handleEntityNotFound(_0x31dfc2,null))['then'](respondWithResult(_0x31dfc2,null))[_0x34c1('0x35')](handleError(_0x31dfc2,null));};exports[_0x34c1('0xb7')]=function(_0x4c3c28,_0x4ee8a6){return db['OpenchannelInteraction']['create'](_0x4c3c28['body'],{})[_0x34c1('0x2b')](respondWithResult(_0x4ee8a6,0xc9))[_0x34c1('0x35')](handleError(_0x4ee8a6,null));};exports['update']=function(_0x5b33f4,_0x331c39){if(_0x5b33f4[_0x34c1('0xb8')]['id']){delete _0x5b33f4['body']['id'];}return db[_0x34c1('0x96')]['find']({'where':{'id':_0x5b33f4[_0x34c1('0xb0')]['id']}})[_0x34c1('0x2b')](handleEntityNotFound(_0x331c39,null))[_0x34c1('0x2b')](saveUpdates(_0x5b33f4[_0x34c1('0xb8')],null))[_0x34c1('0x2b')](respondWithResult(_0x331c39,null))[_0x34c1('0x35')](handleError(_0x331c39,null));};exports[_0x34c1('0x2c')]=function(_0x175c9e,_0x10f903){return db[_0x34c1('0x96')]['find']({'where':{'id':_0x175c9e[_0x34c1('0xb0')]['id']}})['then'](handleEntityNotFound(_0x10f903,null))[_0x34c1('0x2b')](removeEntity(_0x10f903,null))[_0x34c1('0x35')](handleError(_0x10f903,null));};exports[_0x34c1('0xb9')]=function(_0x86b3ad,_0x3fd583){return db[_0x34c1('0x96')][_0x34c1('0xb9')]()[_0x34c1('0x2b')](respondWithResult(_0x3fd583,null))[_0x34c1('0x35')](handleError(_0x3fd583,null));};exports['addMessage']=function(_0x1cf437,_0x31b27e,_0xdf75e7){return db[_0x34c1('0xba')]['find']({'where':{'id':_0x1cf437[_0x34c1('0xb0')]['id']}})[_0x34c1('0x2b')](handleEntityNotFound(_0x31b27e,null))['then'](function(_0x558851){if(_0x558851){return _0x558851[_0x34c1('0xbb')](_0x1cf437[_0x34c1('0xb8')]['ids'],_[_0x34c1('0xbc')](_0x1cf437[_0x34c1('0xb8')],[_0x34c1('0xbd'),'id'])||{});}})[_0x34c1('0x2b')](respondWithResult(_0x31b27e,null))[_0x34c1('0x35')](handleError(_0x31b27e,null));};exports['getMessages']=function(_0x13a712,_0x4b0a7f,_0x4778bb){var _0x138f0f={'raw':![],'where':{}};var _0x1cb06a={};var _0x268442={'count':0x0,'rows':[]};return db[_0x34c1('0x96')]['findOne']({'where':{'id':_0x13a712[_0x34c1('0xb0')]['id']}})[_0x34c1('0x2b')](handleEntityNotFound(_0x4b0a7f,null))['then'](function(_0x295287){if(_0x295287){_0x1cb06a[_0x34c1('0x39')]=_['keys'](db[_0x34c1('0xba')][_0x34c1('0xb1')]);_0x1cb06a[_0x34c1('0x3a')]=_[_0x34c1('0xb2')](_0x13a712[_0x34c1('0x3a')]);_0x1cb06a[_0x34c1('0x3b')]=_[_0x34c1('0x3d')](_0x1cb06a['model'],_0x1cb06a[_0x34c1('0x3a')]);_0x138f0f[_0x34c1('0x3c')]=_[_0x34c1('0x3d')](_0x1cb06a[_0x34c1('0x39')],qs['fields'](_0x13a712[_0x34c1('0x3a')][_0x34c1('0x3e')]));_0x138f0f[_0x34c1('0x3c')]=_0x138f0f[_0x34c1('0x3c')][_0x34c1('0x3f')]?_0x138f0f[_0x34c1('0x3c')]:_0x1cb06a['model'];if(!_0x13a712[_0x34c1('0x3a')][_0x34c1('0x40')]('nolimit')){_0x138f0f[_0x34c1('0x42')]=qs['limit'](_0x13a712[_0x34c1('0x3a')]['limit']);_0x138f0f[_0x34c1('0x23')]=qs['offset'](_0x13a712[_0x34c1('0x3a')][_0x34c1('0x23')]);}_0x138f0f[_0x34c1('0x43')]=qs[_0x34c1('0x44')](_0x13a712[_0x34c1('0x3a')][_0x34c1('0x44')]);_0x138f0f[_0x34c1('0x45')]=qs[_0x34c1('0x3b')](_['pick'](_0x13a712[_0x34c1('0x3a')],_0x1cb06a[_0x34c1('0x3b')]));_0x138f0f[_0x34c1('0x45')][_0x34c1('0xad')]=_0x295287['id'];if(_0x13a712['query']['filter']){_0x138f0f[_0x34c1('0x45')]=_['merge'](_0x138f0f['where'],{'$or':_['map'](_0x138f0f['attributes'],function(_0x49adbf){var _0x3a83e0={};_0x3a83e0[_0x49adbf]={'$like':'%'+_0x13a712[_0x34c1('0x3a')][_0x34c1('0x81')]+'%'};return _0x3a83e0;})});}if(_0x13a712['query'][_0x34c1('0x77')]){var _0x3d0864=_0x13a712[_0x34c1('0x3a')][_0x34c1('0x77')][_0x34c1('0x33')](',');var _0x5651b7={};_0x5651b7[_0x3d0864[0x0]]={'$gte':moment(_0x3d0864[0x1])[_0x34c1('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x138f0f[_0x34c1('0x45')]=_[_0x34c1('0xb5')](_0x138f0f['where'],_0x5651b7);}_0x138f0f=_['merge']({},_0x138f0f,_0x13a712[_0x34c1('0xb6')]);return db['OpenchannelMessage'][_0x34c1('0x24')]({'where':_0x138f0f['where']})[_0x34c1('0x2b')](function(_0x8db203){_0x268442[_0x34c1('0x24')]=_0x8db203;if(_0x13a712[_0x34c1('0x3a')][_0x34c1('0xb3')]){_0x138f0f['include']=[{'all':!![]}];}return db[_0x34c1('0xba')][_0x34c1('0xbf')](_0x138f0f);})['then'](function(_0x5ca9fd){_0x268442[_0x34c1('0xc0')]=_0x5ca9fd;return _0x268442;});}})[_0x34c1('0x2b')](respondWithFilteredResult(_0x4b0a7f,_0x138f0f))['catch'](handleError(_0x4b0a7f,null));};exports['addTags']=function(_0x164c70,_0x4b9714,_0x332da4){return db[_0x34c1('0x96')][_0x34c1('0x5a')]({'where':{'id':_0x164c70[_0x34c1('0xb0')]['id']}})[_0x34c1('0x2b')](handleEntityNotFound(_0x4b9714,null))[_0x34c1('0x2b')](function(_0xe70c06){if(_0xe70c06){return _0xe70c06[_0x34c1('0xc1')](_0x164c70['body'][_0x34c1('0xbd')],_[_0x34c1('0xbc')](_0x164c70[_0x34c1('0xb8')],[_0x34c1('0xbd'),'id'])||{})[_0x34c1('0xc2')](function(){return db['Tag'][_0x34c1('0xbf')]({'attributes':['id',_0x34c1('0x2d'),_0x34c1('0xc3')],'where':{'id':_0x164c70[_0x34c1('0xb8')]['ids']}});})[_0x34c1('0x2b')](function(_0x1e3e49){socket[_0x34c1('0xc4')](_0x34c1('0xc5'),{'id':Number(_0x164c70[_0x34c1('0xb0')]['id']),'tags':_0x1e3e49||[]});return{'id':Number(_0x164c70[_0x34c1('0xb0')]['id']),'tags':_0x1e3e49||[]};});}})[_0x34c1('0x2b')](respondWithResult(_0x4b9714,null))['catch'](handleError(_0x4b9714,null));};exports[_0x34c1('0xc6')]=function(_0x89ca15,_0x40c69b,_0x422f63){return db[_0x34c1('0x96')][_0x34c1('0x5a')]({'where':{'id':_0x89ca15[_0x34c1('0xb0')]['id']}})[_0x34c1('0x2b')](handleEntityNotFound(_0x40c69b,null))['then'](function(_0x4cad95){if(_0x4cad95){return _0x4cad95['removeTags'](_0x89ca15[_0x34c1('0x3a')]['ids']);}})[_0x34c1('0x2b')](respondWithStatusCode(_0x40c69b,null))[_0x34c1('0x35')](handleError(_0x40c69b,null));};exports[_0x34c1('0xc7')]=function(_0x5f8d2c,_0x55e515){var _0x4d75ed=moment()[_0x34c1('0xc8')]()[_0x34c1('0x94')]();var _0x194b10=path[_0x34c1('0xc9')](config[_0x34c1('0xca')],_0x34c1('0xcb'),_0x34c1('0xcc'),'tmp');var _0xf263cf=path[_0x34c1('0xc9')](config[_0x34c1('0xca')],'server','files',_0x34c1('0xcd'));var _0x5bf427=path[_0x34c1('0xc9')](_0x194b10,_0x4d75ed);var _0x4f1bd6=util[_0x34c1('0xbe')](_0x34c1('0xce'),_0x5f8d2c['params']['id'],_0x4d75ed);var _0x1cbe7=path['join'](_0x194b10,_0x4f1bd6);var _0x1bfc88=[];_0x1bfc88[_0x34c1('0xae')]({'model':db[_0x34c1('0x6b')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x1bfc88[_0x34c1('0xae')]({'model':db[_0x34c1('0xcf')],'as':_0x34c1('0x5f'),'attributes':['id',_0x34c1('0xd0'),'lastName'],'raw':!![]});if(_0x5f8d2c[_0x34c1('0x3a')][_0x34c1('0xcd')]){_0x1bfc88['push']({'model':db['Attachment'],'as':_0x34c1('0xd1'),'raw':!![]});}var _0x1ee022=[{'model':db['OpenchannelMessage'],'as':_0x34c1('0xd2'),'attributes':['id',_0x34c1('0xb8'),_0x34c1('0x75'),_0x34c1('0xd3'),_0x34c1('0xd4'),_0x34c1('0xd5')],'include':_0x1bfc88}];_0x1ee022['push']({'model':db[_0x34c1('0xd6')],'as':_0x34c1('0xd7'),'attributes':['id',_0x34c1('0x2d')]});_0x1ee022[_0x34c1('0xae')]({'model':db[_0x34c1('0x6b')],'as':'Owner','attributes':['id',_0x34c1('0x30')]});return db[_0x34c1('0x96')]['find']({'where':{'id':_0x5f8d2c[_0x34c1('0xb0')]['id']},'include':_0x1ee022})['then'](handleEntityNotFound(_0x55e515,null))['then'](function(_0x18a54b){if(_0x18a54b){var _0x322473=_0x18a54b[_0x34c1('0xd8')]({'plain':!![]});fs[_0x34c1('0xd9')](_0x5bf427);var _0x12043c={'channel':'Openchannel','account':_0x322473['Account'][_0x34c1('0x2d')],'agent':_0x322473[_0x34c1('0xda')]?_0x322473[_0x34c1('0xda')][_0x34c1('0x30')]:_0x34c1('0xdb'),'createdAt':moment(_0x322473[_0x34c1('0x75')])[_0x34c1('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x34c1('0x94')](),'closedAt':_0x322473[_0x34c1('0xdc')]?moment(_0x322473['closedAt'])['format'](_0x34c1('0xdd'))[_0x34c1('0x94')]():'','disposition':_0x322473[_0x34c1('0xde')],'visibility':_0x322473[_0x34c1('0xdf')]?_0x34c1('0xe0'):_0x34c1('0xe1'),'messages':_(_0x322473[_0x34c1('0xd2')])[_0x34c1('0x81')]({'secret':![]})[_0x34c1('0x2f')](function(_0x5dcc20){if(_0x5dcc20[_0x34c1('0xd1')]){var _0x210c98=path['join'](_0xf263cf,_0x5dcc20['Attachment'][_0x34c1('0xe2')]);if(fs[_0x34c1('0xe3')](_0x210c98)){fs['createReadStream'](_0x210c98)[_0x34c1('0xe4')](fs[_0x34c1('0xe5')](path[_0x34c1('0xc9')](_0x5bf427,_0x5dcc20[_0x34c1('0xd1')][_0x34c1('0xe2')])));}}return{'date':moment(_0x5dcc20[_0x34c1('0x75')])[_0x34c1('0xbe')](_0x34c1('0xdd'))[_0x34c1('0x94')](),'sender':_0x5dcc20[_0x34c1('0xd3')]==='out'?_0x5dcc20[_0x34c1('0x6b')]?_0x5dcc20[_0x34c1('0x6b')]['fullname']:_0x34c1('0xe6'):_0x5dcc20['Contact'][_0x34c1('0xd0')]+(_0x5dcc20[_0x34c1('0x5f')][_0x34c1('0xe7')]?'\x20'+_0x5dcc20[_0x34c1('0x5f')][_0x34c1('0xe7')]:''),'body':_0x5dcc20[_0x34c1('0xd1')]?_0x5dcc20['Attachment'][_0x34c1('0xe2')]:_0x5dcc20['body'],'direction':_0x5dcc20[_0x34c1('0xd3')]==='out'?'A':'C','secret':_0x5dcc20[_0x34c1('0xd4')],'read':_0x5dcc20[_0x34c1('0xd5')],'attachment':_0x5dcc20['Attachment']};})[_0x34c1('0x63')]()};return ejs[_0x34c1('0xe8')](path[_0x34c1('0xc9')](config[_0x34c1('0xca')],_0x34c1('0xcb'),_0x34c1('0xe9'),'downloadInteraction.ejs'),{'interaction':_0x12043c})[_0x34c1('0x2b')](function(_0x54d8ac){var _0x2ffc9a=path[_0x34c1('0xc9')](_0x5bf427,_0x34c1('0xea')+_0x322473['id']+'-'+_0x4d75ed+_0x34c1('0xeb'));var _0x675490={'path':_0x2ffc9a,'channel':_0x34c1('0xec'),'interactionId':_0x322473['id']};return pdf[_0x34c1('0xed')](_0x54d8ac,_0x675490);})['then'](function(){return new BPromise(function(_0x1fa907,_0x539481){zipdir(_0x5bf427,{'saveTo':_0x1cbe7},function(_0x266590,_0x27130c){if(_0x266590)return _0x539481(_0x266590);return _0x1fa907(_0x27130c);});})['then'](function(){return new BPromise(function(_0xe1ea91,_0x2d98f4){rimraf(_0x5bf427,function(_0x42480a){if(_0x42480a)_0x2d98f4(_0x42480a);return _0xe1ea91();});});})[_0x34c1('0x2b')](function(){return _0x55e515[_0x34c1('0xc7')](_0x1cbe7,_0x4f1bd6,function(_0x301dba){if(_0x301dba){console['log'](_0x34c1('0xee'),_0x301dba);}else{fs['unlinkSync'](_0x1cbe7);}});});});}else{return _0x55e515[_0x34c1('0x1f')](0xc8);}})[_0x34c1('0x35')](handleError(_0x55e515,null));}; \ No newline at end of file +var _0x0b6a=['DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','OpenchannelInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','rows','params','includeAll','include','options','create','update','destroy','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','filter','YYYY-MM-DD\x20HH:mm:ss','findAll','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','files','join','attachments','format','transcript-%d-%s.zip','push','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','N.A.','closed','closedAt','disposition','threadId','Public','Private','existsSync','createReadStream','pipe','basename','out','System','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','catch','index','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','select','color','from','tools_tags','field','u.fullname','ui.OpenchannelInteractionId','left_join','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','type','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','body','isEmpty','where','concat','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','replace','isNumeric','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName'];(function(_0x3484c8,_0x13a58a){var _0x8f47e6=function(_0x171e8c){while(--_0x171e8c){_0x3484c8['push'](_0x3484c8['shift']());}};_0x8f47e6(++_0x13a58a);}(_0x0b6a,0x152));var _0xa0b6=function(_0x58f254,_0x307a96){_0x58f254=_0x58f254-0x0;var _0x58429b=_0x0b6a[_0x58f254];return _0x58429b;};'use strict';var emlformat=require(_0xa0b6('0x0'));var rimraf=require(_0xa0b6('0x1'));var zipdir=require(_0xa0b6('0x2'));var jsonpatch=require(_0xa0b6('0x3'));var rp=require(_0xa0b6('0x4'));var moment=require(_0xa0b6('0x5'));var BPromise=require(_0xa0b6('0x6'));var Mustache=require(_0xa0b6('0x7'));var util=require(_0xa0b6('0x8'));var path=require('path');var sox=require(_0xa0b6('0x9'));var csv=require(_0xa0b6('0xa'));var ejs=require(_0xa0b6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa0b6('0xc'));var crypto=require(_0xa0b6('0xd'));var jsforce=require(_0xa0b6('0xe'));var deskjs=require(_0xa0b6('0xf'));var toCsv=require(_0xa0b6('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa0b6('0x10'));var authService=require(_0xa0b6('0x11'));var qs=require(_0xa0b6('0x12'));var as=require(_0xa0b6('0x13'));var pdf=require(_0xa0b6('0x14'));var hardwareService=require(_0xa0b6('0x15'));var logger=require(_0xa0b6('0x16'))(_0xa0b6('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa0b6('0x18'));var db=require(_0xa0b6('0x19'))['db'];config[_0xa0b6('0x1a')]=_['defaults'](config[_0xa0b6('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xa0b6('0x1b'))(new Redis(config[_0xa0b6('0x1a')]));require('./openchannelInteraction.socket')[_0xa0b6('0x1c')](socket);function respondWithStatusCode(_0x4c68af,_0x1e43ae){_0x1e43ae=_0x1e43ae||0xcc;return function(_0x1ba112){if(_0x1ba112){return _0x4c68af[_0xa0b6('0x1d')](_0x1e43ae);}return _0x4c68af[_0xa0b6('0x1e')](_0x1e43ae)[_0xa0b6('0x1f')]();};}function respondWithResult(_0x7bcaff,_0x21a923){_0x21a923=_0x21a923||0xc8;return function(_0x1ae08c){if(_0x1ae08c){return _0x7bcaff[_0xa0b6('0x1e')](_0x21a923)['json'](_0x1ae08c);}};}function respondWithFilteredResult(_0x240552,_0x2a461b){return function(_0x281def){if(_0x281def){var _0x6695f4=typeof _0x2a461b[_0xa0b6('0x20')]==='undefined'&&typeof _0x2a461b[_0xa0b6('0x21')]===_0xa0b6('0x22');var _0x23a24c=_0x281def[_0xa0b6('0x23')];var _0xfbc630=_0x6695f4?0x0:_0x2a461b[_0xa0b6('0x20')];var _0x182e53=_0x6695f4?_0x281def[_0xa0b6('0x23')]:_0x2a461b['offset']+_0x2a461b[_0xa0b6('0x21')];var _0x3e0ac9;if(_0x182e53>=_0x23a24c){_0x182e53=_0x23a24c;_0x3e0ac9=0xc8;}else{_0x3e0ac9=0xce;}_0x240552['status'](_0x3e0ac9);return _0x240552[_0xa0b6('0x24')](_0xa0b6('0x25'),_0xfbc630+'-'+_0x182e53+'/'+_0x23a24c)[_0xa0b6('0x26')](_0x281def);}return null;};}function patchUpdates(_0xa07ae5){return function(_0x548652){try{jsonpatch[_0xa0b6('0x27')](_0x548652,_0xa07ae5,!![]);}catch(_0x13bcdd){return BPromise['reject'](_0x13bcdd);}return _0x548652[_0xa0b6('0x28')]();};}function saveUpdates(_0x4d9c76,_0x533071){return function(_0x12e8ea){if(_0x12e8ea){return _0x12e8ea['update'](_0x4d9c76)[_0xa0b6('0x29')](function(_0x418d9b){return _0x418d9b;});}return null;};}function removeEntity(_0x40f940,_0x23a23d){return function(_0x465f9b){if(_0x465f9b){return _0x465f9b['destroy']()[_0xa0b6('0x29')](function(){_0x40f940[_0xa0b6('0x1e')](0xcc)[_0xa0b6('0x1f')]();});}};}function handleEntityNotFound(_0x1be9d4,_0x2db70a){return function(_0x48a1f6){if(!_0x48a1f6){_0x1be9d4[_0xa0b6('0x1d')](0x194);}return _0x48a1f6;};}function handleError(_0x4a753c,_0x10b4a7){_0x10b4a7=_0x10b4a7||0x1f4;return function(_0x9c575e){logger[_0xa0b6('0x2a')](_0x9c575e[_0xa0b6('0x2b')]);if(_0x9c575e[_0xa0b6('0x2c')]){delete _0x9c575e[_0xa0b6('0x2c')];}_0x4a753c[_0xa0b6('0x1e')](_0x10b4a7)[_0xa0b6('0x2d')](_0x9c575e);};}function getInteractionUsers(_0x5c9791,_0x5ed9d7){return new BPromise(function(_0x47bc2e,_0x2e2774){try{if(_0x5ed9d7[_0x5c9791['id']]){_0x5c9791[_0xa0b6('0x2e')]=_[_0xa0b6('0x2f')](_0x5ed9d7[_0x5c9791['id']],function(_0x2e1e33){return{'id':_0x2e1e33['id'],'fullname':_0x2e1e33[_0xa0b6('0x30')]};});}}catch(_0x15f01f){_0x2e2774(_0x15f01f);}_0x47bc2e(_0x5c9791);});}function getInteractionTags(_0x4b39b5,_0x175583){return new BPromise(function(_0x5170e8,_0x4522c5){try{if(_0x4b39b5[_0xa0b6('0x31')]){_0x4b39b5[_0xa0b6('0x32')]=[];_0x4b39b5[_0xa0b6('0x31')][_0xa0b6('0x33')](',')['forEach'](function(_0x48ea8a){_0x4b39b5[_0xa0b6('0x32')]['push'](_0x175583[_0x48ea8a]);});}delete _0x4b39b5[_0xa0b6('0x31')];}catch(_0xc0bcbf){_0x4522c5(_0xc0bcbf);}_0x5170e8(_0x4b39b5);});}function updateOpenchannelInteraction(_0x184f23,_0x599795,_0x2b5679){return new BPromise(function(_0x40217d,_0x246ed1){return getInteractionUsers(_0x184f23,_0x2b5679)[_0xa0b6('0x29')](function(_0x20ef08){return getInteractionTags(_0x20ef08,_0x599795);})[_0xa0b6('0x29')](function(_0x1ccc2a){_0x40217d(_0x1ccc2a);})[_0xa0b6('0x34')](function(_0x1fcb73){_0x246ed1(_0x1fcb73);});});}exports[_0xa0b6('0x35')]=function(_0x15c25d,_0x416876){var _0x508586={},_0x2f77a9={},_0x20e448={'count':0x0,'rows':[]};var _0x422f69=_[_0xa0b6('0x2f')](db['OpenchannelInteraction'][_0xa0b6('0x36')],function(_0xa164c){return{'name':_0xa164c[_0xa0b6('0x37')],'type':_0xa164c['type'][_0xa0b6('0x38')]};});_0x2f77a9[_0xa0b6('0x39')]=_['map'](_0x422f69,_0xa0b6('0x2c'));_0x2f77a9['query']=_[_0xa0b6('0x3a')](_0x15c25d[_0xa0b6('0x3b')]);_0x2f77a9[_0xa0b6('0x3c')]=_[_0xa0b6('0x3d')](_0x2f77a9[_0xa0b6('0x39')],_0x2f77a9['query']);_0x508586[_0xa0b6('0x3e')]=_[_0xa0b6('0x3d')](_0x2f77a9[_0xa0b6('0x39')],qs[_0xa0b6('0x3f')](_0x15c25d[_0xa0b6('0x3b')][_0xa0b6('0x3f')]));_0x508586[_0xa0b6('0x3e')]=_0x508586[_0xa0b6('0x3e')][_0xa0b6('0x40')]?_0x508586[_0xa0b6('0x3e')]:_0x2f77a9['model'];if(!_0x15c25d[_0xa0b6('0x3b')][_0xa0b6('0x41')](_0xa0b6('0x42'))){_0x508586[_0xa0b6('0x21')]=qs[_0xa0b6('0x21')](_0x15c25d[_0xa0b6('0x3b')][_0xa0b6('0x21')]);_0x508586[_0xa0b6('0x20')]=qs['offset'](_0x15c25d[_0xa0b6('0x3b')][_0xa0b6('0x20')]);}_0x508586[_0xa0b6('0x43')]=qs[_0xa0b6('0x44')](_0x15c25d[_0xa0b6('0x3b')]['sort']);_0x508586['where']=qs[_0xa0b6('0x3c')](_['pick'](_0x15c25d[_0xa0b6('0x3b')],_0x2f77a9[_0xa0b6('0x3c')]),_0x422f69);var _0x52e4e6=[];var _0x38940b=squel[_0xa0b6('0x45')]()['field']('id')['field'](_0xa0b6('0x2c'))['field'](_0xa0b6('0x46'))[_0xa0b6('0x47')](_0xa0b6('0x48'));var _0x3a15f9=squel[_0xa0b6('0x45')]()['field']('u.id')[_0xa0b6('0x49')](_0xa0b6('0x4a'))['field'](_0xa0b6('0x4b'))[_0xa0b6('0x47')]('user_has_openchannel_interactions','ui')[_0xa0b6('0x4c')]('users','u','u.id\x20=\x20ui.UserId');var _0x2efd35=squel[_0xa0b6('0x45')]()[_0xa0b6('0x47')](_0xa0b6('0x4d'),'i')['left_join']('cm_contacts','c',_0xa0b6('0x4e'))[_0xa0b6('0x4c')](_0xa0b6('0x4f'),'o','o.id\x20=\x20i.UserId')['left_join'](_0xa0b6('0x50'),'a',_0xa0b6('0x51'))[_0xa0b6('0x4c')](_0xa0b6('0x52'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0xa0b6('0x4c')](_0xa0b6('0x53'),'it',_0xa0b6('0x54'))[_0xa0b6('0x4c')](_0xa0b6('0x48'),'t',_0xa0b6('0x55'));var _0x4c7303=squel[_0xa0b6('0x56')]();var _0x32ba2c=[];var _0x6d94c7=squel['expr']();var _0x385a86;if(_0x15c25d[_0xa0b6('0x3b')][_0xa0b6('0x57')]){_0x385a86=as[_0xa0b6('0x58')](_0x15c25d[_0xa0b6('0x3b')][_0xa0b6('0x57')]);var _0x1d3eef=_0x385a86['sqlOperator'];for(var _0x588166=0x0;_0x588166<_0x385a86[_0xa0b6('0x59')][_0xa0b6('0x40')];_0x588166++){var _0x26b112=_0x385a86[_0xa0b6('0x59')][_0x588166];var _0xdf70af='i';var _0x3c58dc=_['find'](_0x422f69,[_0xa0b6('0x2c'),_0x26b112[_0xa0b6('0x49')]]);if(!_0x3c58dc){switch(_0x26b112['field']){case _0xa0b6('0x5a'):if(_0x26b112[_0xa0b6('0x5b')]==0x1){_0x2efd35['having']('`'+_0x26b112['field']+_0xa0b6('0x5c'));}else{_0x2efd35[_0xa0b6('0x5d')]('`'+_0x26b112[_0xa0b6('0x49')]+_0xa0b6('0x5e'));}break;case'Contact':if(_0x26b112[_0xa0b6('0x5f')]===_0xa0b6('0x60')){if(_0x26b112[_0xa0b6('0x5b')]['split']('\x20')['length']>0x1){_0x4c7303[_0x1d3eef](_0xa0b6('0x61'),qs[_0xa0b6('0x62')](_0x26b112[_0xa0b6('0x5b')]),null);}else{var _0x26956f='%'+_0x26b112[_0xa0b6('0x5b')]+'%';_0x4c7303[_0x1d3eef]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26956f,_0x26956f,_0x26956f);}}else{_0x3c58dc=_[_0xa0b6('0x63')](_0x422f69,[_0xa0b6('0x2c'),_0xa0b6('0x64')]);_0x26b112[_0xa0b6('0x49')]=_0xa0b6('0x64');_0x44a467=as[_0xa0b6('0x65')](_0xdf70af,_0x3c58dc[_0xa0b6('0x66')],_0x26b112);_0x4c7303[_0x1d3eef](_0x44a467['text'],_0x44a467[_0xa0b6('0x5b')]['start'],_0x44a467['value'][_0xa0b6('0x1f')]);}break;case _0xa0b6('0x67'):var _0x5529ba=_0x26b112['value'][_0xa0b6('0x33')](',')[_0xa0b6('0x2f')](function(_0x2d7c09){return Number(_0x2d7c09);});_0x5529ba[_0xa0b6('0x68')](function(_0x590e93){_0x6d94c7['or'](_0xa0b6('0x69'),'%,'+_0x590e93+',%');});_0x32ba2c=_[_0xa0b6('0x6a')](_0x32ba2c,_0x5529ba);break;case _0xa0b6('0x6b'):if(_0x26b112[_0xa0b6('0x5f')]===_0xa0b6('0x60')){_0x4c7303[_0x1d3eef](_0xa0b6('0x6c'),'%'+_0x26b112[_0xa0b6('0x5b')]+'%',null);}else{_0x3c58dc=_[_0xa0b6('0x63')](_0x422f69,[_0xa0b6('0x2c'),_0xa0b6('0x6d')]);_0x26b112['field']=_0xa0b6('0x6d');_0x44a467=as[_0xa0b6('0x65')](_0xdf70af,_0x3c58dc[_0xa0b6('0x66')],_0x26b112);_0x4c7303[_0x1d3eef](_0x44a467[_0xa0b6('0x6e')],_0x44a467['value'][_0xa0b6('0x6f')],_0x44a467['value'][_0xa0b6('0x1f')]);}break;case _0xa0b6('0x70'):_0x44a467=as[_0xa0b6('0x65')]('me',null,_0x26b112);_0x4c7303[_0x1d3eef](_0x44a467[_0xa0b6('0x6e')],_0x44a467[_0xa0b6('0x5b')][_0xa0b6('0x6f')],_0x44a467[_0xa0b6('0x5b')][_0xa0b6('0x1f')]);break;}}else{var _0x44a467=as[_0xa0b6('0x65')](_0xdf70af,_0x3c58dc[_0xa0b6('0x66')],_0x26b112);_0x4c7303[_0x1d3eef](_0x44a467['text'],_0x44a467['value'][_0xa0b6('0x6f')],_0x44a467[_0xa0b6('0x5b')][_0xa0b6('0x1f')]);}}}else{var _0x437c4d=_(_0x15c25d['query'])['keys']()[_0xa0b6('0x2f')](function(_0x1cfdbe){return _['some'](_0x422f69,['name',_0x1cfdbe])?_0x1cfdbe:undefined;})['compact']()[_0xa0b6('0x5b')]();if(!_[_0xa0b6('0x71')](_0x437c4d)){_0x437c4d[_0xa0b6('0x68')](function(_0x296eed){if(_0x296eed==='OpenchannelAccountId'){_0x2efd35[_0xa0b6('0x72')]('i.OpenchannelAccountId\x20IN\x20?',[][_0xa0b6('0x73')](_0x15c25d['query'][_0x296eed]));}else if(_0x296eed==='createdAt'){var _0x2de284=JSON['parse'](_0x15c25d[_0xa0b6('0x3b')][_0x296eed])[_0xa0b6('0x74')];var _0x9b77e7=JSON[_0xa0b6('0x75')](_0x15c25d[_0xa0b6('0x3b')][_0x296eed])['$lte'];_0x2efd35[_0xa0b6('0x72')](_0xa0b6('0x76'),_0x2de284,_0x9b77e7);}else{if(_0x15c25d[_0xa0b6('0x3b')][_0x296eed]==='null'){_0x2efd35[_0xa0b6('0x72')]('i.'+_0x296eed+_0xa0b6('0x77'));}else{_0x2efd35[_0xa0b6('0x72')]('i.'+_0x296eed+_0xa0b6('0x78'),_0x15c25d[_0xa0b6('0x3b')][_0x296eed]);}}});}if(_0x15c25d[_0xa0b6('0x3b')]['read']){if(_0x15c25d[_0xa0b6('0x3b')][_0xa0b6('0x79')]==0x1){_0x2efd35[_0xa0b6('0x5d')](_0xa0b6('0x7a'));}else{_0x2efd35[_0xa0b6('0x5d')](_0xa0b6('0x7b'));}}if(_0x15c25d[_0xa0b6('0x3b')]['tag']){_0x32ba2c=_[_0xa0b6('0x7c')](_0x15c25d[_0xa0b6('0x3b')][_0xa0b6('0x7d')])?_0x15c25d[_0xa0b6('0x3b')][_0xa0b6('0x7d')]:new Array(_0x15c25d[_0xa0b6('0x3b')][_0xa0b6('0x7d')]);_0x32ba2c[_0xa0b6('0x68')](function(_0x1c79a4){_0x6d94c7['or'](_0xa0b6('0x69'),'%,'+_0x1c79a4+',%');});}if(_0x15c25d[_0xa0b6('0x3b')]['filter']){var _0x2733ad=_0x15c25d[_0xa0b6('0x3b')]['filter']['replace']('\x5c','\x5c\x5c')[_0xa0b6('0x7e')](/'/g,'\x27\x27');if(qs[_0xa0b6('0x7f')](_0x2733ad)){_0x4c7303['or']('i.id\x20LIKE\x20?',_0x2733ad+'%');}else{_0x4c7303['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa0b6('0x62')](_0x2733ad))['or'](_0xa0b6('0x80'),_0x2733ad+'%')['or'](_0xa0b6('0x81'),_0x2733ad+'%');}}}_0x2efd35[_0xa0b6('0x72')](_0x4c7303);_0x2efd35[_0xa0b6('0x82')]('i.id');var _0x2698e7={'type':db[_0xa0b6('0x83')][_0xa0b6('0x84')][_0xa0b6('0x85')],'raw':!![]};var _0x512e8b=_0x2efd35['clone']();_0x512e8b[_0xa0b6('0x49')]('i.id');_0x512e8b[_0xa0b6('0x49')](_0xa0b6('0x86'),_0xa0b6('0x5a'));if(_0x508586[_0xa0b6('0x43')]){_0x508586[_0xa0b6('0x43')][_0xa0b6('0x68')](function(_0x28febf){var _0x1b2479=_0x28febf[0x0]===_0xa0b6('0x87')?_0x28febf[0x0]:'i.'+_0x28febf[0x0];_0x2efd35[_0xa0b6('0x43')](_0x1b2479,_0x28febf[0x1]===_0xa0b6('0x88')?![]:!![]);});}if(!_[_0xa0b6('0x71')](_0x32ba2c)){_0x2efd35['having'](_0x6d94c7);_0x512e8b[_0xa0b6('0x72')](_0xa0b6('0x89'),_0x32ba2c);}BPromise[_0xa0b6('0x8a')]()[_0xa0b6('0x29')](function(){if(!_0x385a86){if(_0x15c25d[_0xa0b6('0x3b')][_0xa0b6('0x8b')])return;_0x512e8b['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x2efd35[_0xa0b6('0x72')](_0xa0b6('0x8c'));return;}if(_0x15c25d[_0xa0b6('0x8d')][_0xa0b6('0x8e')]!==_0xa0b6('0x8f'))return;return _0x15c25d['user'][_0xa0b6('0x90')]({'attributes':['id'],'raw':!![]})[_0xa0b6('0x29')](function(_0xbc5624){if(_[_0xa0b6('0x71')](_0xbc5624)){_0x512e8b[_0xa0b6('0x72')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x2efd35['where'](_0xa0b6('0x91'));}else{_0x512e8b['where'](_0xa0b6('0x92'),_[_0xa0b6('0x2f')](_0xbc5624,'id'));_0x2efd35[_0xa0b6('0x72')](_0xa0b6('0x92'),_[_0xa0b6('0x2f')](_0xbc5624,'id'));}});})['then'](function(){if(_0x15c25d[_0xa0b6('0x8d')][_0xa0b6('0x8e')]==='agent'&&!_0x385a86&&!_0x15c25d['query'][_0xa0b6('0x8b')])return[];return db[_0xa0b6('0x93')][_0xa0b6('0x3b')](_0x512e8b['toString'](),_0x2698e7);})[_0xa0b6('0x29')](function(_0x14a876){_0x20e448[_0xa0b6('0x23')]=_0x14a876['length'];if(_0x20e448[_0xa0b6('0x23')]===0x0)return[];return db[_0xa0b6('0x93')][_0xa0b6('0x3b')](_0x38940b[_0xa0b6('0x94')](),_0x2698e7)[_0xa0b6('0x29')](function(_0x1cfea8){_0x52e4e6=_[_0xa0b6('0x95')](_0x1cfea8,'id');_0x2698e7=_[_0xa0b6('0x96')](_0x2698e7,{'model':db[_0xa0b6('0x97')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x15c25d[_0xa0b6('0x3b')][_0xa0b6('0x3f')]){_0x508586[_0xa0b6('0x3e')][_0xa0b6('0x68')](function(_0x200edf){_0x2efd35[_0xa0b6('0x49')]('i.'+_0x200edf);});}else{_0x2efd35[_0xa0b6('0x49')](_0xa0b6('0x86'),_0xa0b6('0x5a'));_0x2efd35[_0xa0b6('0x49')](_0xa0b6('0x98'),_0xa0b6('0x99'));_0x2efd35[_0xa0b6('0x49')](_0xa0b6('0x9a'),_0xa0b6('0x9b'));_0x2efd35[_0xa0b6('0x49')](_0xa0b6('0x9c'),_0xa0b6('0x87'));_0x2efd35[_0xa0b6('0x49')](_0xa0b6('0x9d'));_0x2efd35[_0xa0b6('0x49')](_0xa0b6('0x9e'),_0xa0b6('0x9f'));_0x2efd35['field']('c.lastName',_0xa0b6('0xa0'));_0x2efd35[_0xa0b6('0x49')](_0xa0b6('0xa1'),'Contact.email');_0x2efd35[_0xa0b6('0x49')]('c.phone','Contact.phone');_0x2efd35[_0xa0b6('0x49')]('c.mobile',_0xa0b6('0xa2'));_0x2efd35[_0xa0b6('0x49')](_0xa0b6('0xa3'),'Contact.fax');_0x2efd35['field'](_0xa0b6('0xa4'),'Owner.fullname');_0x2efd35[_0xa0b6('0x49')](_0xa0b6('0xa5'),_0xa0b6('0xa6'));_0x2efd35['field'](_0xa0b6('0xa7'),_0xa0b6('0x31'));}if(_0x508586['limit'])_0x2efd35[_0xa0b6('0x21')](_0x508586[_0xa0b6('0x21')]);if(_0x508586['offset'])_0x2efd35[_0xa0b6('0x20')](_0x508586[_0xa0b6('0x20')]);return db[_0xa0b6('0x93')][_0xa0b6('0x3b')](_0x2efd35['toString'](),_0x2698e7);})['then'](function(_0x4f4616){if(_0x4f4616['length']>0x0)_0x3a15f9[_0xa0b6('0x72')](_0xa0b6('0xa8'),_['map'](_0x4f4616,'id'));return db[_0xa0b6('0x93')][_0xa0b6('0x3b')](_0x3a15f9['toString'](),_0x2698e7)[_0xa0b6('0x29')](function(_0x4517c7){var _0x3ebd18=_['groupBy'](_0x4517c7,_0xa0b6('0xa9'));var _0x38571b=[];_0x4f4616[_0xa0b6('0x68')](function(_0x88de6f){_0x38571b['push'](updateOpenchannelInteraction(_0x88de6f,_0x52e4e6,_0x3ebd18));});return BPromise[_0xa0b6('0xaa')](_0x38571b);});});})[_0xa0b6('0x29')](function(_0x4c1b4f){_0x20e448[_0xa0b6('0xab')]=_0x4c1b4f;return _0x20e448;})['then'](respondWithFilteredResult(_0x416876,_0x508586))[_0xa0b6('0x34')](handleError(_0x416876,null));};exports['show']=function(_0x2cdc58,_0x4ebad5){var _0x991342={};if(_0x2cdc58[_0xa0b6('0x3b')][_0xa0b6('0x66')]&&_0x2cdc58[_0xa0b6('0x3b')][_0xa0b6('0x66')]===_0xa0b6('0x47')){_0x991342[_0xa0b6('0x47')]=_0x2cdc58['params']['id'];}else{_0x991342['id']=_0x2cdc58[_0xa0b6('0xac')]['id'];}var _0x1ddc4f={'raw':![],'where':_0x991342},_0x37b3a9={};_0x37b3a9[_0xa0b6('0x39')]=_['keys'](db['OpenchannelInteraction'][_0xa0b6('0x36')]);_0x37b3a9[_0xa0b6('0x3b')]=_[_0xa0b6('0x3a')](_0x2cdc58[_0xa0b6('0x3b')]);_0x37b3a9[_0xa0b6('0x3c')]=_[_0xa0b6('0x3d')](_0x37b3a9[_0xa0b6('0x39')],_0x37b3a9[_0xa0b6('0x3b')]);_0x1ddc4f['attributes']=_[_0xa0b6('0x3d')](_0x37b3a9[_0xa0b6('0x39')],qs[_0xa0b6('0x3f')](_0x2cdc58['query']['fields']));_0x1ddc4f[_0xa0b6('0x3e')]=_0x1ddc4f[_0xa0b6('0x3e')][_0xa0b6('0x40')]?_0x1ddc4f[_0xa0b6('0x3e')]:_0x37b3a9['model'];if(_0x2cdc58[_0xa0b6('0x3b')][_0xa0b6('0xad')]){_0x1ddc4f[_0xa0b6('0xae')]=[{'all':!![]}];}_0x1ddc4f=_[_0xa0b6('0x96')]({},_0x1ddc4f,_0x2cdc58[_0xa0b6('0xaf')]);return db[_0xa0b6('0x97')][_0xa0b6('0x63')](_0x1ddc4f)['then'](handleEntityNotFound(_0x4ebad5,null))[_0xa0b6('0x29')](respondWithResult(_0x4ebad5,null))[_0xa0b6('0x34')](handleError(_0x4ebad5,null));};exports[_0xa0b6('0xb0')]=function(_0x1a8b1b,_0x52060e){return db[_0xa0b6('0x97')][_0xa0b6('0xb0')](_0x1a8b1b[_0xa0b6('0x70')],{})[_0xa0b6('0x29')](respondWithResult(_0x52060e,0xc9))['catch'](handleError(_0x52060e,null));};exports[_0xa0b6('0xb1')]=function(_0x1f2319,_0x5db2a8){if(_0x1f2319[_0xa0b6('0x70')]['id']){delete _0x1f2319['body']['id'];}return db[_0xa0b6('0x97')][_0xa0b6('0x63')]({'where':{'id':_0x1f2319['params']['id']}})[_0xa0b6('0x29')](handleEntityNotFound(_0x5db2a8,null))[_0xa0b6('0x29')](saveUpdates(_0x1f2319[_0xa0b6('0x70')],null))['then'](respondWithResult(_0x5db2a8,null))['catch'](handleError(_0x5db2a8,null));};exports[_0xa0b6('0xb2')]=function(_0x337636,_0x45e8c7){return db[_0xa0b6('0x97')][_0xa0b6('0x63')]({'where':{'id':_0x337636['params']['id']}})['then'](handleEntityNotFound(_0x45e8c7,null))[_0xa0b6('0x29')](removeEntity(_0x45e8c7,null))[_0xa0b6('0x34')](handleError(_0x45e8c7,null));};exports[_0xa0b6('0xb3')]=function(_0x1f451a,_0x1313c1){return db[_0xa0b6('0x97')][_0xa0b6('0xb3')]()['then'](respondWithResult(_0x1313c1,null))[_0xa0b6('0x34')](handleError(_0x1313c1,null));};exports['addMessage']=function(_0x528904,_0x2c7d0d,_0x3911a5){return db[_0xa0b6('0xb4')]['find']({'where':{'id':_0x528904[_0xa0b6('0xac')]['id']}})[_0xa0b6('0x29')](handleEntityNotFound(_0x2c7d0d,null))[_0xa0b6('0x29')](function(_0x417a44){if(_0x417a44){return _0x417a44[_0xa0b6('0xb5')](_0x528904['body'][_0xa0b6('0xb6')],_[_0xa0b6('0xb7')](_0x528904[_0xa0b6('0x70')],[_0xa0b6('0xb6'),'id'])||{});}})[_0xa0b6('0x29')](respondWithResult(_0x2c7d0d,null))['catch'](handleError(_0x2c7d0d,null));};exports[_0xa0b6('0xb8')]=function(_0x286893,_0x5d352c,_0x4e0a8a){var _0x50d97a={'raw':![],'where':{}};var _0x331be8={};var _0x5dd5e2={'count':0x0,'rows':[]};return db[_0xa0b6('0x97')][_0xa0b6('0xb9')]({'where':{'id':_0x286893[_0xa0b6('0xac')]['id']}})[_0xa0b6('0x29')](handleEntityNotFound(_0x5d352c,null))[_0xa0b6('0x29')](function(_0x539f53){if(_0x539f53){_0x331be8[_0xa0b6('0x39')]=_[_0xa0b6('0x3a')](db[_0xa0b6('0xb4')]['rawAttributes']);_0x331be8[_0xa0b6('0x3b')]=_['keys'](_0x286893[_0xa0b6('0x3b')]);_0x331be8[_0xa0b6('0x3c')]=_[_0xa0b6('0x3d')](_0x331be8['model'],_0x331be8[_0xa0b6('0x3b')]);_0x50d97a['attributes']=_[_0xa0b6('0x3d')](_0x331be8['model'],qs[_0xa0b6('0x3f')](_0x286893[_0xa0b6('0x3b')][_0xa0b6('0x3f')]));_0x50d97a['attributes']=_0x50d97a['attributes']['length']?_0x50d97a[_0xa0b6('0x3e')]:_0x331be8[_0xa0b6('0x39')];if(!_0x286893[_0xa0b6('0x3b')]['hasOwnProperty']('nolimit')){_0x50d97a[_0xa0b6('0x21')]=qs[_0xa0b6('0x21')](_0x286893[_0xa0b6('0x3b')][_0xa0b6('0x21')]);_0x50d97a['offset']=qs['offset'](_0x286893['query'][_0xa0b6('0x20')]);}_0x50d97a['order']=qs[_0xa0b6('0x44')](_0x286893[_0xa0b6('0x3b')]['sort']);_0x50d97a['where']=qs[_0xa0b6('0x3c')](_['pick'](_0x286893[_0xa0b6('0x3b')],_0x331be8['filters']));_0x50d97a[_0xa0b6('0x72')][_0xa0b6('0xa9')]=_0x539f53['id'];if(_0x286893['query'][_0xa0b6('0xba')]){_0x50d97a[_0xa0b6('0x72')]=_[_0xa0b6('0x96')](_0x50d97a[_0xa0b6('0x72')],{'$or':_[_0xa0b6('0x2f')](_0x50d97a[_0xa0b6('0x3e')],function(_0x4fa973){var _0x46183e={};_0x46183e[_0x4fa973]={'$like':'%'+_0x286893[_0xa0b6('0x3b')]['filter']+'%'};return _0x46183e;})});}if(_0x286893['query'][_0xa0b6('0x74')]){var _0x392331=_0x286893[_0xa0b6('0x3b')]['$gte']['split'](',');var _0x44553c={};_0x44553c[_0x392331[0x0]]={'$gte':moment(_0x392331[0x1])['format'](_0xa0b6('0xbb'))};_0x50d97a[_0xa0b6('0x72')]=_[_0xa0b6('0x96')](_0x50d97a[_0xa0b6('0x72')],_0x44553c);}_0x50d97a=_[_0xa0b6('0x96')]({},_0x50d97a,_0x286893[_0xa0b6('0xaf')]);return db['OpenchannelMessage']['count']({'where':_0x50d97a[_0xa0b6('0x72')]})[_0xa0b6('0x29')](function(_0x178f45){_0x5dd5e2[_0xa0b6('0x23')]=_0x178f45;if(_0x286893[_0xa0b6('0x3b')][_0xa0b6('0xad')]){_0x50d97a[_0xa0b6('0xae')]=[{'all':!![]}];}return db[_0xa0b6('0xb4')][_0xa0b6('0xbc')](_0x50d97a);})[_0xa0b6('0x29')](function(_0x9000db){_0x5dd5e2['rows']=_0x9000db;return _0x5dd5e2;});}})[_0xa0b6('0x29')](respondWithFilteredResult(_0x5d352c,_0x50d97a))[_0xa0b6('0x34')](handleError(_0x5d352c,null));};exports['addTags']=function(_0x25b1be,_0x3572c9,_0x409762){return db[_0xa0b6('0x97')][_0xa0b6('0x63')]({'where':{'id':_0x25b1be[_0xa0b6('0xac')]['id']}})[_0xa0b6('0x29')](handleEntityNotFound(_0x3572c9,null))['then'](function(_0x48ed20){if(_0x48ed20){return _0x48ed20['setTags'](_0x25b1be[_0xa0b6('0x70')][_0xa0b6('0xb6')],_[_0xa0b6('0xb7')](_0x25b1be[_0xa0b6('0x70')],[_0xa0b6('0xb6'),'id'])||{})[_0xa0b6('0xbd')](function(){return db[_0xa0b6('0x67')][_0xa0b6('0xbc')]({'attributes':['id',_0xa0b6('0x2c'),'color'],'where':{'id':_0x25b1be[_0xa0b6('0x70')]['ids']}});})[_0xa0b6('0x29')](function(_0x34f41c){socket[_0xa0b6('0xbe')](_0xa0b6('0xbf'),{'id':Number(_0x25b1be[_0xa0b6('0xac')]['id']),'tags':_0x34f41c||[]});return{'id':Number(_0x25b1be[_0xa0b6('0xac')]['id']),'tags':_0x34f41c||[]};});}})[_0xa0b6('0x29')](respondWithResult(_0x3572c9,null))[_0xa0b6('0x34')](handleError(_0x3572c9,null));};exports[_0xa0b6('0xc0')]=function(_0x52cf2b,_0x3fb39e,_0x15962d){return db['OpenchannelInteraction'][_0xa0b6('0x63')]({'where':{'id':_0x52cf2b['params']['id']}})['then'](handleEntityNotFound(_0x3fb39e,null))[_0xa0b6('0x29')](function(_0x56055a){if(_0x56055a){return _0x56055a[_0xa0b6('0xc0')](_0x52cf2b['query'][_0xa0b6('0xb6')]);}})['then'](respondWithStatusCode(_0x3fb39e,null))[_0xa0b6('0x34')](handleError(_0x3fb39e,null));};exports[_0xa0b6('0xc1')]=function(_0x45c0b5,_0x23bc3b){var _0x4a5e86=moment()[_0xa0b6('0xc2')]()[_0xa0b6('0x94')]();var _0x5eda6a=path['join'](config[_0xa0b6('0xc3')],_0xa0b6('0xc4'),_0xa0b6('0xc5'),'tmp');var _0x1527d6=path[_0xa0b6('0xc6')](config[_0xa0b6('0xc3')],'server',_0xa0b6('0xc5'),_0xa0b6('0xc7'));var _0xc0bff=path[_0xa0b6('0xc6')](_0x5eda6a,_0x4a5e86);var _0x3b9cdb=util[_0xa0b6('0xc8')](_0xa0b6('0xc9'),_0x45c0b5['params']['id'],_0x4a5e86);var _0x13f983=path[_0xa0b6('0xc6')](_0x5eda6a,_0x3b9cdb);var _0x54153d=[];_0x54153d[_0xa0b6('0xca')]({'model':db[_0xa0b6('0x6b')],'as':_0xa0b6('0x6b'),'attributes':['id','fullname'],'raw':!![]});_0x54153d[_0xa0b6('0xca')]({'model':db['CmContact'],'as':_0xa0b6('0xcb'),'attributes':['id',_0xa0b6('0xcc'),_0xa0b6('0xcd')],'raw':!![]});if(_0x45c0b5['query'][_0xa0b6('0xc7')]){_0x54153d[_0xa0b6('0xca')]({'model':db['Attachment'],'as':_0xa0b6('0xce'),'raw':!![]});}var _0x3cf489=[{'model':db['OpenchannelMessage'],'as':_0xa0b6('0xcf'),'attributes':['id',_0xa0b6('0x70'),_0xa0b6('0xd0'),_0xa0b6('0xd1'),'secret',_0xa0b6('0x79')],'include':_0x54153d}];_0x3cf489['push']({'model':db[_0xa0b6('0xd2')],'as':'Account','attributes':['id',_0xa0b6('0x2c')]});_0x3cf489[_0xa0b6('0xca')]({'model':db[_0xa0b6('0x6b')],'as':_0xa0b6('0xd3'),'attributes':['id','fullname']});return db[_0xa0b6('0x97')][_0xa0b6('0x63')]({'where':{'id':_0x45c0b5[_0xa0b6('0xac')]['id']},'include':_0x3cf489})['then'](handleEntityNotFound(_0x23bc3b,null))[_0xa0b6('0x29')](function(_0x4deb39){if(_0x4deb39){var _0x165f07=_0x4deb39[_0xa0b6('0xd4')]({'plain':!![]});fs[_0xa0b6('0xd5')](_0xc0bff);var _0x52aa61={'channel':_0xa0b6('0xd6'),'account':_0x165f07[_0xa0b6('0xd7')][_0xa0b6('0x2c')],'agent':_0x165f07[_0xa0b6('0xd3')]?_0x165f07[_0xa0b6('0xd3')][_0xa0b6('0x30')]:_0xa0b6('0xd8'),'createdAt':moment(_0x165f07[_0xa0b6('0xd0')])[_0xa0b6('0xc8')](_0xa0b6('0xbb'))[_0xa0b6('0x94')](),'closedAt':_0x165f07[_0xa0b6('0xd9')]?moment(_0x165f07[_0xa0b6('0xda')])[_0xa0b6('0xc8')](_0xa0b6('0xbb'))[_0xa0b6('0x94')]():'','disposition':_0x165f07[_0xa0b6('0xdb')],'visibility':_0x165f07[_0xa0b6('0xdc')]?_0xa0b6('0xdd'):_0xa0b6('0xde'),'messages':_(_0x165f07[_0xa0b6('0xcf')])[_0xa0b6('0xba')]({'secret':![]})['map'](function(_0x8aa0c5){if(_0x8aa0c5[_0xa0b6('0xce')]){var _0xbc20c2=path['join'](_0x1527d6,_0x8aa0c5['Attachment']['basename']);if(fs[_0xa0b6('0xdf')](_0xbc20c2)){fs[_0xa0b6('0xe0')](_0xbc20c2)[_0xa0b6('0xe1')](fs['createWriteStream'](path[_0xa0b6('0xc6')](_0xc0bff,_0x8aa0c5[_0xa0b6('0xce')][_0xa0b6('0xe2')])));}}return{'date':moment(_0x8aa0c5[_0xa0b6('0xd0')])[_0xa0b6('0xc8')](_0xa0b6('0xbb'))[_0xa0b6('0x94')](),'sender':_0x8aa0c5[_0xa0b6('0xd1')]===_0xa0b6('0xe3')?_0x8aa0c5[_0xa0b6('0x6b')]?_0x8aa0c5[_0xa0b6('0x6b')][_0xa0b6('0x30')]:_0xa0b6('0xe4'):_0x8aa0c5[_0xa0b6('0xcb')][_0xa0b6('0xcc')]+(_0x8aa0c5[_0xa0b6('0xcb')][_0xa0b6('0xcd')]?'\x20'+_0x8aa0c5[_0xa0b6('0xcb')][_0xa0b6('0xcd')]:''),'body':_0x8aa0c5[_0xa0b6('0xce')]?_0x8aa0c5[_0xa0b6('0xce')][_0xa0b6('0xe2')]:_0x8aa0c5[_0xa0b6('0x70')],'direction':_0x8aa0c5[_0xa0b6('0xd1')]==='out'?'A':'C','secret':_0x8aa0c5[_0xa0b6('0xe5')],'read':_0x8aa0c5[_0xa0b6('0x79')],'attachment':_0x8aa0c5[_0xa0b6('0xce')]};})[_0xa0b6('0x5b')]()};return ejs[_0xa0b6('0xe6')](path[_0xa0b6('0xc6')](config[_0xa0b6('0xc3')],'server',_0xa0b6('0xe7'),_0xa0b6('0xe8')),{'interaction':_0x52aa61})['then'](function(_0xb7d28c){var _0x3b7069=path['join'](_0xc0bff,_0xa0b6('0xe9')+_0x165f07['id']+'-'+_0x4a5e86+_0xa0b6('0xea'));var _0x34dbe7={'path':_0x3b7069,'channel':'Openchannel','interactionId':_0x165f07['id']};return pdf[_0xa0b6('0xeb')](_0xb7d28c,_0x34dbe7);})[_0xa0b6('0x29')](function(){return new BPromise(function(_0x50440b,_0x4f27b3){zipdir(_0xc0bff,{'saveTo':_0x13f983},function(_0x33d93f,_0x361d1c){if(_0x33d93f)return _0x4f27b3(_0x33d93f);return _0x50440b(_0x361d1c);});})[_0xa0b6('0x29')](function(){return new BPromise(function(_0x379c3d,_0x46dd89){rimraf(_0xc0bff,function(_0x30aaff){if(_0x30aaff)_0x46dd89(_0x30aaff);return _0x379c3d();});});})['then'](function(){return _0x23bc3b[_0xa0b6('0xc1')](_0x13f983,_0x3b9cdb,function(_0x4b7016){if(_0x4b7016){console[_0xa0b6('0xec')]('err',_0x4b7016);}else{fs['unlinkSync'](_0x13f983);}});});});}else{return _0x23bc3b[_0xa0b6('0x1d')](0xc8);}})['catch'](handleError(_0x23bc3b,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 5d3bc9e..374b75d 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 _0xf64d=['hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x61c5bb,_0x4605f1){var _0x1d37a0=function(_0x13bfc3){while(--_0x13bfc3){_0x61c5bb['push'](_0x61c5bb['shift']());}};_0x1d37a0(++_0x4605f1);}(_0xf64d,0xd2));var _0xdf64=function(_0x31b425,_0x35bda9){_0x31b425=_0x31b425-0x0;var _0xa8588e=_0xf64d[_0x31b425];return _0xa8588e;};'use strict';var EventEmitter=require(_0xdf64('0x0'));var OpenchannelInteraction=require(_0xdf64('0x1'))['db'][_0xdf64('0x2')];var OpenchannelMessage=require(_0xdf64('0x1'))['db'][_0xdf64('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xdf64('0x4')](0x0);var events={'afterCreate':_0xdf64('0x5'),'afterUpdate':_0xdf64('0x6'),'afterDestroy':_0xdf64('0x7')};function emitEvent(_0xf48e80){return function(_0x2491d5,_0x2024a6,_0x5b68b5){_0x2491d5[_0xdf64('0x8')]({'attributes':['id'],'raw':!![]})[_0xdf64('0x9')](function(_0x4b92f8){_0x2491d5[_0xdf64('0xa')](_0xdf64('0xb'),_0x4b92f8[_0xdf64('0xc')](function(_0x5720f3){return{'id':_0x5720f3['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x2491d5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdf64('0x9')](function(_0x5a2ca5){_0x2491d5['setDataValue'](_0xdf64('0xd'),_0x5a2ca5[_0xdf64('0xe')]);OpenchannelInteractionEvents[_0xdf64('0xf')](_0xf48e80+':'+_0x2491d5['id'],_0x2491d5);OpenchannelInteractionEvents['emit'](_0xf48e80,_0x2491d5);_0x5b68b5(null);})[_0xdf64('0x10')](_0x5b68b5(null));};}for(var e in events){if(events[_0xdf64('0x11')](e)){var event=events[e];OpenchannelInteraction[_0xdf64('0x12')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x820d=['map','unreadMessages','length','emit','catch','hasOwnProperty','exports','../../mysqldb','OpenchannelInteraction','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x5e1f39,_0x377f81){var _0x453e6d=function(_0x4046a0){while(--_0x4046a0){_0x5e1f39['push'](_0x5e1f39['shift']());}};_0x453e6d(++_0x377f81);}(_0x820d,0xf7));var _0xd820=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x820d[_0x397cfb];return _0x15fed9;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xd820('0x0'))['db'][_0xd820('0x1')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd820('0x2'),'afterUpdate':_0xd820('0x3'),'afterDestroy':_0xd820('0x4')};function emitEvent(_0x592418){return function(_0x19c6c5,_0x4b0fd8,_0x2591b4){_0x19c6c5[_0xd820('0x5')]({'attributes':['id'],'raw':!![]})[_0xd820('0x6')](function(_0x30b74c){_0x19c6c5[_0xd820('0x7')](_0xd820('0x8'),_0x30b74c[_0xd820('0x9')](function(_0x57db11){return{'id':_0x57db11['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x19c6c5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1b04e3){_0x19c6c5[_0xd820('0x7')](_0xd820('0xa'),_0x1b04e3[_0xd820('0xb')]);OpenchannelInteractionEvents[_0xd820('0xc')](_0x592418+':'+_0x19c6c5['id'],_0x19c6c5);OpenchannelInteractionEvents[_0xd820('0xc')](_0x592418,_0x19c6c5);_0x2591b4(null);})[_0xd820('0xd')](_0x2591b4(null));};}for(var e in events){if(events[_0xd820('0xe')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xd820('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 958b0e3..c5c4149 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 _0xc965=['closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','moment','path','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4_unicode_ci'];(function(_0x54ef75,_0x9a36d4){var _0x3b84df=function(_0x5d764f){while(--_0x5d764f){_0x54ef75['push'](_0x54ef75['shift']());}};_0x3b84df(++_0x9a36d4);}(_0xc965,0x6f));var _0x5c96=function(_0x5e2b34,_0x58385c){_0x5e2b34=_0x5e2b34-0x0;var _0x4859f9=_0xc965[_0x5e2b34];return _0x4859f9;};'use strict';var _=require(_0x5c96('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5c96('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c96('0x2'));var rimraf=require(_0x5c96('0x3'));var config=require('../../config/environment');var attributes=require(_0x5c96('0x4'));module[_0x5c96('0x5')]=function(_0xb9c889,_0x5d957b){return _0xb9c889[_0x5c96('0x6')](_0x5c96('0x7'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5c96('0x8'),'hooks':{'beforeUpdate':function(_0x4bef69,_0x285427,_0x16ddbb){if(_0x4bef69['changed'](_0x5c96('0x9'))){_0x4bef69['closedAt']=moment()[_0x5c96('0xa')](_0x5c96('0xb'));}_0x16ddbb(null,_0x4bef69);}}});}; \ No newline at end of file +var _0x70fc=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closed','closedAt','format'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x70fc,0x13c));var _0xc70f=function(_0x132c95,_0x5c52c4){_0x132c95=_0x132c95-0x0;var _0x4f7c3b=_0x70fc[_0x132c95];return _0x4f7c3b;};'use strict';var _=require(_0xc70f('0x0'));var util=require(_0xc70f('0x1'));var logger=require(_0xc70f('0x2'))(_0xc70f('0x3'));var moment=require(_0xc70f('0x4'));var BPromise=require(_0xc70f('0x5'));var rp=require(_0xc70f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x5c13d2,_0x2349ae){return _0x5c13d2['define'](_0xc70f('0x7'),attributes,{'tableName':_0xc70f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc70f('0x9'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x51c23c,_0x54999c,_0x11489e){if(_0x51c23c[_0xc70f('0xa')](_0xc70f('0xb'))){_0x51c23c[_0xc70f('0xc')]=moment()[_0xc70f('0xd')](_0xc70f('0xe'));}_0x11489e(null,_0x51c23c);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 46c0b68..6cfc3b4 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 _0x43a6=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','where','attributes','limit','debug','find','ids','omit','spread','AddTags'];(function(_0x58cf07,_0x2e3858){var _0x42afe0=function(_0x3c71ff){while(--_0x3c71ff){_0x58cf07['push'](_0x58cf07['shift']());}};_0x42afe0(++_0x2e3858);}(_0x43a6,0x7b));var _0x643a=function(_0x2c1e7a,_0x155f86){_0x2c1e7a=_0x2c1e7a-0x0;var _0xcacb4f=_0x43a6[_0x2c1e7a];return _0xcacb4f;};'use strict';var _=require(_0x643a('0x0'));var util=require('util');var moment=require(_0x643a('0x1'));var BPromise=require('bluebird');var rs=require(_0x643a('0x2'));var fs=require('fs');var Redis=require(_0x643a('0x3'));var db=require(_0x643a('0x4'))['db'];var utils=require(_0x643a('0x5'));var logger=require(_0x643a('0x6'))(_0x643a('0x7'));var config=require(_0x643a('0x8'));var jayson=require(_0x643a('0x9'));var client=jayson[_0x643a('0xa')][_0x643a('0xb')]({'port':0x232a});config[_0x643a('0xc')]=_[_0x643a('0xd')](config[_0x643a('0xc')],{'host':_0x643a('0xe'),'port':0x18eb});var socket=require(_0x643a('0xf'))(new Redis(config['redis']));require(_0x643a('0x10'))['register'](socket);function respondWithRpcPromise(_0x575afa,_0x550233,_0x564677){return new BPromise(function(_0xecdf7c,_0x16dd9e){return client[_0x643a('0x11')](_0x575afa,_0x564677)[_0x643a('0x12')](function(_0x480002){logger[_0x643a('0x13')](_0x643a('0x14'),_0x550233,_0x643a('0x15'));logger['debug'](_0x643a('0x16'),_0x550233,_0x643a('0x15'),JSON[_0x643a('0x17')](_0x480002));if(_0x480002['error']){if(_0x480002[_0x643a('0x18')]['code']===0x1f4){logger[_0x643a('0x18')](_0x643a('0x14'),_0x550233,_0x480002['error'][_0x643a('0x19')]);return _0x16dd9e(_0x480002[_0x643a('0x18')][_0x643a('0x19')]);}logger['error'](_0x643a('0x14'),_0x550233,_0x480002[_0x643a('0x18')][_0x643a('0x19')]);return _0xecdf7c(_0x480002[_0x643a('0x18')][_0x643a('0x19')]);}else{logger[_0x643a('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x550233,_0x643a('0x15'));_0xecdf7c(_0x480002[_0x643a('0x1a')][_0x643a('0x19')]);}})[_0x643a('0x1b')](function(_0x37c6a4){logger[_0x643a('0x18')](_0x643a('0x14'),_0x550233,_0x37c6a4);_0x16dd9e(_0x37c6a4);});});}exports[_0x643a('0x1c')]=function(_0x5824f4){var _0x2a085a=this;return new Promise(function(_0xf6f31b,_0x3e5444){return db[_0x643a('0x1d')]['update'](_0x5824f4[_0x643a('0x1e')],{'raw':_0x5824f4[_0x643a('0x1f')]?_0x5824f4[_0x643a('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5824f4[_0x643a('0x1f')]?_0x5824f4['options'][_0x643a('0x20')]||null:null,'attributes':_0x5824f4[_0x643a('0x1f')]?_0x5824f4[_0x643a('0x1f')][_0x643a('0x21')]||null:null,'limit':_0x5824f4[_0x643a('0x1f')]?_0x5824f4['options'][_0x643a('0x22')]||null:null})[_0x643a('0x12')](function(_0x4208fc){logger[_0x643a('0x13')]('UpdateOpenchannelInteraction',_0x5824f4);logger[_0x643a('0x23')]('UpdateOpenchannelInteraction',_0x5824f4,JSON[_0x643a('0x17')](_0x4208fc));_0xf6f31b(_0x4208fc);})['catch'](function(_0x4a0308){logger[_0x643a('0x18')]('UpdateOpenchannelInteraction',_0x4a0308[_0x643a('0x19')],_0x5824f4);_0x3e5444(_0x2a085a['error'](0x1f4,_0x4a0308['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x2224d4){return new Promise(function(_0x324f8e,_0x27a26f){return db[_0x643a('0x1d')][_0x643a('0x24')]({'where':_0x2224d4['options']?_0x2224d4['options']['where']||null:null})[_0x643a('0x12')](function(_0x18c071){if(_0x18c071){return _0x18c071['addTags'](_0x2224d4[_0x643a('0x1e')][_0x643a('0x25')],_[_0x643a('0x26')](_0x2224d4['body'],['ids','id'])||{});}})[_0x643a('0x27')](function(_0x838492){logger[_0x643a('0x13')]('AddTags',_0x2224d4);logger[_0x643a('0x23')](_0x643a('0x28'),_0x2224d4,JSON[_0x643a('0x17')](_0x838492));_0x324f8e(_0x838492);})[_0x643a('0x1b')](function(_0x1945fe){logger[_0x643a('0x18')]('AddTags',_0x1945fe[_0x643a('0x19')],_0x2224d4);_0x27a26f(_this['error'](0x1f4,_0x1945fe[_0x643a('0x19')]));});});}; \ No newline at end of file +var _0x2e3b=['request\x20sent','debug','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','limit','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','info','OpenchannelInteraction,\x20%s,\x20%s'];(function(_0x32c86c,_0x15bc88){var _0x5c12bd=function(_0x44f0b6){while(--_0x44f0b6){_0x32c86c['push'](_0x32c86c['shift']());}};_0x5c12bd(++_0x15bc88);}(_0x2e3b,0x14e));var _0xb2e3=function(_0x415f56,_0x2268f6){_0x415f56=_0x415f56-0x0;var _0x405dfc=_0x2e3b[_0x415f56];return _0x405dfc;};'use strict';var _=require(_0xb2e3('0x0'));var util=require(_0xb2e3('0x1'));var moment=require(_0xb2e3('0x2'));var BPromise=require(_0xb2e3('0x3'));var rs=require(_0xb2e3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb2e3('0x6'))('rpc');var config=require(_0xb2e3('0x7'));var jayson=require(_0xb2e3('0x8'));var client=jayson['client'][_0xb2e3('0x9')]({'port':0x232a});config[_0xb2e3('0xa')]=_[_0xb2e3('0xb')](config[_0xb2e3('0xa')],{'host':_0xb2e3('0xc'),'port':0x18eb});var socket=require(_0xb2e3('0xd'))(new Redis(config['redis']));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x5e5f87,_0x5208e8,_0x24ffbd){return new BPromise(function(_0x3477ea,_0x325ce1){return client[_0xb2e3('0xe')](_0x5e5f87,_0x24ffbd)['then'](function(_0x12c2e7){logger[_0xb2e3('0xf')](_0xb2e3('0x10'),_0x5208e8,_0xb2e3('0x11'));logger[_0xb2e3('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x5208e8,_0xb2e3('0x11'),JSON[_0xb2e3('0x13')](_0x12c2e7));if(_0x12c2e7[_0xb2e3('0x14')]){if(_0x12c2e7[_0xb2e3('0x14')][_0xb2e3('0x15')]===0x1f4){logger['error'](_0xb2e3('0x10'),_0x5208e8,_0x12c2e7[_0xb2e3('0x14')]['message']);return _0x325ce1(_0x12c2e7[_0xb2e3('0x14')][_0xb2e3('0x16')]);}logger[_0xb2e3('0x14')](_0xb2e3('0x10'),_0x5208e8,_0x12c2e7['error'][_0xb2e3('0x16')]);return _0x3477ea(_0x12c2e7[_0xb2e3('0x14')][_0xb2e3('0x16')]);}else{logger[_0xb2e3('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5208e8,_0xb2e3('0x11'));_0x3477ea(_0x12c2e7[_0xb2e3('0x17')]['message']);}})[_0xb2e3('0x18')](function(_0x3fa966){logger[_0xb2e3('0x14')](_0xb2e3('0x10'),_0x5208e8,_0x3fa966);_0x325ce1(_0x3fa966);});});}exports[_0xb2e3('0x19')]=function(_0x5e517a){var _0xcde1fe=this;return new Promise(function(_0x1e36b0,_0x5a2029){return db[_0xb2e3('0x1a')][_0xb2e3('0x1b')](_0x5e517a[_0xb2e3('0x1c')],{'raw':_0x5e517a[_0xb2e3('0x1d')]?_0x5e517a[_0xb2e3('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e517a[_0xb2e3('0x1d')]?_0x5e517a[_0xb2e3('0x1d')][_0xb2e3('0x1e')]||null:null,'attributes':_0x5e517a[_0xb2e3('0x1d')]?_0x5e517a[_0xb2e3('0x1d')][_0xb2e3('0x1f')]||null:null,'limit':_0x5e517a['options']?_0x5e517a[_0xb2e3('0x1d')][_0xb2e3('0x20')]||null:null})['then'](function(_0x509732){logger[_0xb2e3('0xf')](_0xb2e3('0x19'),_0x5e517a);logger[_0xb2e3('0x12')]('UpdateOpenchannelInteraction',_0x5e517a,JSON[_0xb2e3('0x13')](_0x509732));_0x1e36b0(_0x509732);})[_0xb2e3('0x18')](function(_0x2e2ba4){logger['error'](_0xb2e3('0x19'),_0x2e2ba4[_0xb2e3('0x16')],_0x5e517a);_0x5a2029(_0xcde1fe[_0xb2e3('0x14')](0x1f4,_0x2e2ba4['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x4e0eb0){return new Promise(function(_0x1e8991,_0x23bb75){return db[_0xb2e3('0x1a')][_0xb2e3('0x21')]({'where':_0x4e0eb0[_0xb2e3('0x1d')]?_0x4e0eb0['options'][_0xb2e3('0x1e')]||null:null})['then'](function(_0x293b06){if(_0x293b06){return _0x293b06[_0xb2e3('0x22')](_0x4e0eb0[_0xb2e3('0x1c')][_0xb2e3('0x23')],_[_0xb2e3('0x24')](_0x4e0eb0[_0xb2e3('0x1c')],[_0xb2e3('0x23'),'id'])||{});}})[_0xb2e3('0x25')](function(_0x19eb2a){logger[_0xb2e3('0xf')](_0xb2e3('0x26'),_0x4e0eb0);logger[_0xb2e3('0x12')](_0xb2e3('0x26'),_0x4e0eb0,JSON[_0xb2e3('0x13')](_0x19eb2a));_0x1e8991(_0x19eb2a);})[_0xb2e3('0x18')](function(_0x3645bd){logger['error'](_0xb2e3('0x26'),_0x3645bd[_0xb2e3('0x16')],_0x4e0eb0);_0x23bb75(_this[_0xb2e3('0x14')](0x1f4,_0x3645bd['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index c9b62ec..8344c05 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 _0x076b=['update','emit','removeListener','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x55c0a6,_0x107fb6){var _0xb55015=function(_0x36be03){while(--_0x36be03){_0x55c0a6['push'](_0x55c0a6['shift']());}};_0xb55015(++_0x107fb6);}(_0x076b,0xd0));var _0xb076=function(_0x1a973f,_0x2bf776){_0x1a973f=_0x1a973f-0x0;var _0xc51b32=_0x076b[_0x1a973f];return _0xc51b32;};'use strict';var OpenchannelInteractionEvents=require(_0xb076('0x0'));var events=[_0xb076('0x1'),'remove',_0xb076('0x2')];function createListener(_0x580d82,_0x1e24d7){return function(_0x1dd649){_0x1e24d7[_0xb076('0x3')](_0x580d82,_0x1dd649);};}function removeListener(_0x2b47bc,_0x113981){return function(){OpenchannelInteractionEvents[_0xb076('0x4')](_0x2b47bc,_0x113981);};}exports['register']=function(_0x33fd52){for(var _0x193b04=0x0,_0x23f554=events[_0xb076('0x5')];_0x193b04<_0x23f554;_0x193b04++){var _0x4feb24=events[_0x193b04];var _0x3c7d8e=createListener(_0xb076('0x6')+_0x4feb24,_0x33fd52);OpenchannelInteractionEvents['on'](_0x4feb24,_0x3c7d8e);}}; \ No newline at end of file +var _0xd9fa=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x4e0c31,_0x208e9f){var _0x3fd7df=function(_0x5ee817){while(--_0x5ee817){_0x4e0c31['push'](_0x4e0c31['shift']());}};_0x3fd7df(++_0x208e9f);}(_0xd9fa,0xf5));var _0xad9f=function(_0x54523e,_0x4662b6){_0x54523e=_0x54523e-0x0;var _0x3d9f60=_0xd9fa[_0x54523e];return _0x3d9f60;};'use strict';var OpenchannelInteractionEvents=require(_0xad9f('0x0'));var events=[_0xad9f('0x1'),_0xad9f('0x2'),_0xad9f('0x3')];function createListener(_0x24bbee,_0x82d7b5){return function(_0x5ec013){_0x82d7b5[_0xad9f('0x4')](_0x24bbee,_0x5ec013);};}function removeListener(_0x363182,_0x4309aa){return function(){OpenchannelInteractionEvents[_0xad9f('0x5')](_0x363182,_0x4309aa);};}exports[_0xad9f('0x6')]=function(_0x1b9eb7){for(var _0x4d36c4=0x0,_0x15a086=events[_0xad9f('0x7')];_0x4d36c4<_0x15a086;_0x4d36c4++){var _0x589bc1=events[_0x4d36c4];var _0x12af10=createListener(_0xad9f('0x8')+_0x589bc1,_0x1b9eb7);OpenchannelInteractionEvents['on'](_0x589bc1,_0x12af10);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index ce8082a..0df5fc3 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 _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70e0,0x17b));var _0x070e=function(_0x80e7d9,_0x428952){_0x80e7d9=_0x80e7d9-0x0;var _0x1cf0aa=_0x70e0[_0x80e7d9];return _0x1cf0aa;};'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');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);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(_0x1e0d60,_0x503460){var _0x5b9564=function(_0x331935){while(--_0x331935){_0x1e0d60['push'](_0x1e0d60['shift']());}};_0x5b9564(++_0x503460);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0xcb91[_0x40dd56];return _0x4f850f;};'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 7089f5f..a6c3645 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 _0xceb0=['ENUM','out','TEXT','BOOLEAN'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0xceb0,0x173));var _0x0ceb=function(_0xe794ca,_0x8f929b){_0xe794ca=_0xe794ca-0x0;var _0x3ade83=_0xceb0[_0xe794ca];return _0x3ade83;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x0ceb('0x0')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0ceb('0x1')]('in',_0x0ceb('0x2')),'defaultValue':_0x0ceb('0x2'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x0ceb('0x3')]}}; \ No newline at end of file +var _0xaf4c=['out','DATE','STRING','exports','TEXT','BOOLEAN','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x10f41f,_0x1d6c7b){_0x10f41f=_0x10f41f-0x0;var _0x5adb76=_0xaf4c[_0x10f41f];return _0x5adb76;};'use strict';var Sequelize=require('sequelize');module[_0xcaf4('0x0')]={'body':{'type':Sequelize[_0xcaf4('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xcaf4('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xcaf4('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcaf4('0x3')]('in','out'),'defaultValue':_0xcaf4('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xcaf4('0x5')]},'providerName':{'type':Sequelize[_0xcaf4('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 0dad983..2eb38e9 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 _0x8542=['error','message','info','result','catch','sendStatus','status','end','offset','limit','undefined','count','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','OpenchannelMessage','rawAttributes','options','find','create','body','update','describe','../../config/logger','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','manual','interface','channel','event','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','contact','EventManager','rejectmessage','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','http','client','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x8542,0x1e4));var _0x2854=function(_0x44e201,_0x2477f9){_0x44e201=_0x44e201-0x0;var _0xb720a9=_0x8542[_0x44e201];return _0xb720a9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2854('0x0'));var jsonpatch=require(_0x2854('0x1'));var rp=require(_0x2854('0x2'));var moment=require(_0x2854('0x3'));var BPromise=require(_0x2854('0x4'));var Mustache=require(_0x2854('0x5'));var util=require(_0x2854('0x6'));var path=require(_0x2854('0x7'));var sox=require(_0x2854('0x8'));var csv=require(_0x2854('0x9'));var ejs=require(_0x2854('0xa'));var fs=require('fs');var fs_extra=require(_0x2854('0xb'));var _=require('lodash');var squel=require(_0x2854('0xc'));var crypto=require(_0x2854('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2854('0xe'));var toCsv=require(_0x2854('0x9'));var querystring=require('querystring');var Papa=require(_0x2854('0xf'));var Redis=require(_0x2854('0x10'));var authService=require(_0x2854('0x11'));var qs=require(_0x2854('0x12'));var as=require(_0x2854('0x13'));var hardwareService=require(_0x2854('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2854('0x15'));var db=require(_0x2854('0x16'))['db'];config['redis']=_['defaults'](config[_0x2854('0x17')],{'host':_0x2854('0x18'),'port':0x18eb});var socket=require(_0x2854('0x19'))(new Redis(config[_0x2854('0x17')]));require('./openchannelMessage.socket')[_0x2854('0x1a')](socket);var jayson=require(_0x2854('0x1b'));var client=jayson['client'][_0x2854('0x1c')]({'port':0x232c});var client9002=jayson[_0x2854('0x1d')][_0x2854('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x414057,_0x57726b,_0x3ac2ad,_0x158373){return new BPromise(function(_0x17bdbc,_0x11721c){var _0x57d3a5=_0x158373||client;return _0x57d3a5['request'](_0x414057,_0x3ac2ad)[_0x2854('0x1e')](function(_0x5f2109){logger['info'](_0x2854('0x1f'),_0x57726b,_0x2854('0x20'));logger[_0x2854('0x21')](_0x2854('0x22'),_0x57726b,_0x2854('0x20'),JSON[_0x2854('0x23')](_0x5f2109));if(_0x5f2109[_0x2854('0x24')]){if(_0x5f2109[_0x2854('0x24')]['code']===0x1f4){logger['error'](_0x2854('0x1f'),_0x57726b,_0x5f2109[_0x2854('0x24')][_0x2854('0x25')]);return _0x11721c(_0x5f2109['error']['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x57726b,_0x5f2109[_0x2854('0x24')][_0x2854('0x25')]);return _0x17bdbc(_0x5f2109['error'][_0x2854('0x25')]);}else{logger[_0x2854('0x26')](_0x2854('0x1f'),_0x57726b,'request\x20sent');_0x17bdbc(_0x5f2109[_0x2854('0x27')][_0x2854('0x25')]);}})[_0x2854('0x28')](function(_0x166fa9){logger[_0x2854('0x24')](_0x2854('0x1f'),_0x57726b,_0x166fa9);_0x11721c(_0x166fa9);});});}function respondWithStatusCode(_0x44cdd7,_0x6fcc4b){_0x6fcc4b=_0x6fcc4b||0xcc;return function(_0x5d4380){if(_0x5d4380){return _0x44cdd7[_0x2854('0x29')](_0x6fcc4b);}return _0x44cdd7[_0x2854('0x2a')](_0x6fcc4b)[_0x2854('0x2b')]();};}function respondWithResult(_0x348e14,_0x1185a7){_0x1185a7=_0x1185a7||0xc8;return function(_0x2964b6){if(_0x2964b6){return _0x348e14['status'](_0x1185a7)['json'](_0x2964b6);}};}function respondWithFilteredResult(_0x6f6919,_0x49f5a8){return function(_0x5b5bda){if(_0x5b5bda){var _0xf8b01=typeof _0x49f5a8[_0x2854('0x2c')]==='undefined'&&typeof _0x49f5a8[_0x2854('0x2d')]===_0x2854('0x2e');var _0x85b0a8=_0x5b5bda[_0x2854('0x2f')];var _0x3b178c=_0xf8b01?0x0:_0x49f5a8[_0x2854('0x2c')];var _0x5806c9=_0xf8b01?_0x5b5bda[_0x2854('0x2f')]:_0x49f5a8[_0x2854('0x2c')]+_0x49f5a8[_0x2854('0x2d')];var _0x259d3d;if(_0x5806c9>=_0x85b0a8){_0x5806c9=_0x85b0a8;_0x259d3d=0xc8;}else{_0x259d3d=0xce;}_0x6f6919[_0x2854('0x2a')](_0x259d3d);return _0x6f6919['set'](_0x2854('0x30'),_0x3b178c+'-'+_0x5806c9+'/'+_0x85b0a8)['json'](_0x5b5bda);}return null;};}function patchUpdates(_0x7100cd){return function(_0x1bb606){try{jsonpatch[_0x2854('0x31')](_0x1bb606,_0x7100cd,!![]);}catch(_0x327725){return BPromise[_0x2854('0x32')](_0x327725);}return _0x1bb606[_0x2854('0x33')]();};}function saveUpdates(_0x3e4ebf,_0x19a701){return function(_0x377def){if(_0x377def){return _0x377def['update'](_0x3e4ebf)[_0x2854('0x1e')](function(_0x1dc30f){return _0x1dc30f;});}return null;};}function removeEntity(_0x128c44,_0x473e79){return function(_0x2f0066){if(_0x2f0066){return _0x2f0066[_0x2854('0x34')]()['then'](function(){_0x128c44[_0x2854('0x2a')](0xcc)[_0x2854('0x2b')]();});}};}function handleEntityNotFound(_0x5da213,_0x2acbc6){return function(_0x5ccd80){if(!_0x5ccd80){_0x5da213[_0x2854('0x29')](0x194);}return _0x5ccd80;};}function handleError(_0x520089,_0x5cb86a){_0x5cb86a=_0x5cb86a||0x1f4;return function(_0x158f52){logger[_0x2854('0x24')](_0x158f52[_0x2854('0x35')]);if(_0x158f52['name']){delete _0x158f52[_0x2854('0x36')];}_0x520089[_0x2854('0x2a')](_0x5cb86a)[_0x2854('0x37')](_0x158f52);};}exports[_0x2854('0x38')]=function(_0x12e21f,_0x393573){var _0x36648e={},_0x56c045={},_0x5ce07d={'count':0x0,'rows':[]};var _0xf15359=_[_0x2854('0x39')](db['OpenchannelMessage']['rawAttributes'],function(_0x244ac4){return{'name':_0x244ac4[_0x2854('0x3a')],'type':_0x244ac4[_0x2854('0x3b')][_0x2854('0x3c')]};});_0x56c045[_0x2854('0x3d')]=_[_0x2854('0x39')](_0xf15359,_0x2854('0x36'));_0x56c045[_0x2854('0x3e')]=_[_0x2854('0x3f')](_0x12e21f['query']);_0x56c045[_0x2854('0x40')]=_[_0x2854('0x41')](_0x56c045[_0x2854('0x3d')],_0x56c045[_0x2854('0x3e')]);_0x36648e[_0x2854('0x42')]=_[_0x2854('0x41')](_0x56c045['model'],qs[_0x2854('0x43')](_0x12e21f[_0x2854('0x3e')][_0x2854('0x43')]));_0x36648e[_0x2854('0x42')]=_0x36648e[_0x2854('0x42')][_0x2854('0x44')]?_0x36648e[_0x2854('0x42')]:_0x56c045['model'];if(!_0x12e21f[_0x2854('0x3e')][_0x2854('0x45')](_0x2854('0x46'))){_0x36648e[_0x2854('0x2d')]=qs['limit'](_0x12e21f[_0x2854('0x3e')][_0x2854('0x2d')]);_0x36648e[_0x2854('0x2c')]=qs['offset'](_0x12e21f[_0x2854('0x3e')][_0x2854('0x2c')]);}_0x36648e['order']=qs[_0x2854('0x47')](_0x12e21f[_0x2854('0x3e')]['sort']);_0x36648e[_0x2854('0x48')]=qs[_0x2854('0x40')](_[_0x2854('0x49')](_0x12e21f[_0x2854('0x3e')],_0x56c045[_0x2854('0x40')]),_0xf15359);if(_0x12e21f[_0x2854('0x3e')][_0x2854('0x4a')]){_0x36648e[_0x2854('0x48')]=_[_0x2854('0x4b')](_0x36648e[_0x2854('0x48')],{'$or':_[_0x2854('0x39')](_0xf15359,function(_0x1cf693){if(_0x1cf693[_0x2854('0x3b')]!==_0x2854('0x4c')){var _0x3d5e91={};_0x3d5e91[_0x1cf693[_0x2854('0x36')]]={'$like':'%'+_0x12e21f[_0x2854('0x3e')][_0x2854('0x4a')]+'%'};return _0x3d5e91;}})});}_0x36648e=_[_0x2854('0x4b')]({},_0x36648e,_0x12e21f['options']);var _0x133670={'where':_0x36648e[_0x2854('0x48')]};return db['OpenchannelMessage']['count'](_0x133670)[_0x2854('0x1e')](function(_0xf09a39){_0x5ce07d[_0x2854('0x2f')]=_0xf09a39;if(_0x12e21f['query'][_0x2854('0x4d')]){_0x36648e['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x2854('0x4e')](_0x36648e);})[_0x2854('0x1e')](function(_0x4abc1a){_0x5ce07d[_0x2854('0x4f')]=_0x4abc1a;return _0x5ce07d;})['then'](respondWithFilteredResult(_0x393573,_0x36648e))[_0x2854('0x28')](handleError(_0x393573,null));};exports[_0x2854('0x50')]=function(_0x31f535,_0xd65c1d){var _0x5a552a={'raw':!![],'where':{'id':_0x31f535[_0x2854('0x51')]['id']}},_0x47df59={};_0x47df59[_0x2854('0x3d')]=_['keys'](db[_0x2854('0x52')][_0x2854('0x53')]);_0x47df59[_0x2854('0x3e')]=_['keys'](_0x31f535[_0x2854('0x3e')]);_0x47df59[_0x2854('0x40')]=_[_0x2854('0x41')](_0x47df59[_0x2854('0x3d')],_0x47df59[_0x2854('0x3e')]);_0x5a552a[_0x2854('0x42')]=_['intersection'](_0x47df59[_0x2854('0x3d')],qs[_0x2854('0x43')](_0x31f535[_0x2854('0x3e')][_0x2854('0x43')]));_0x5a552a[_0x2854('0x42')]=_0x5a552a[_0x2854('0x42')][_0x2854('0x44')]?_0x5a552a[_0x2854('0x42')]:_0x47df59[_0x2854('0x3d')];if(_0x31f535[_0x2854('0x3e')][_0x2854('0x4d')]){_0x5a552a['include']=[{'all':!![]}];}_0x5a552a=_[_0x2854('0x4b')]({},_0x5a552a,_0x31f535[_0x2854('0x54')]);return db[_0x2854('0x52')][_0x2854('0x55')](_0x5a552a)['then'](handleEntityNotFound(_0xd65c1d,null))['then'](respondWithResult(_0xd65c1d,null))[_0x2854('0x28')](handleError(_0xd65c1d,null));};exports[_0x2854('0x56')]=function(_0x57fbbb,_0x5f01d9){return db[_0x2854('0x52')][_0x2854('0x56')](_0x57fbbb[_0x2854('0x57')],{})[_0x2854('0x1e')](respondWithResult(_0x5f01d9,0xc9))[_0x2854('0x28')](handleError(_0x5f01d9,null));};exports[_0x2854('0x58')]=function(_0x5aae21,_0xca6f35){if(_0x5aae21['body']['id']){delete _0x5aae21[_0x2854('0x57')]['id'];}return db[_0x2854('0x52')][_0x2854('0x55')]({'where':{'id':_0x5aae21[_0x2854('0x51')]['id']}})['then'](handleEntityNotFound(_0xca6f35,null))[_0x2854('0x1e')](saveUpdates(_0x5aae21[_0x2854('0x57')],null))[_0x2854('0x1e')](respondWithResult(_0xca6f35,null))[_0x2854('0x28')](handleError(_0xca6f35,null));};exports['destroy']=function(_0x304a6d,_0x5f460f){return db[_0x2854('0x52')][_0x2854('0x55')]({'where':{'id':_0x304a6d[_0x2854('0x51')]['id']}})['then'](handleEntityNotFound(_0x5f460f,null))['then'](removeEntity(_0x5f460f,null))[_0x2854('0x28')](handleError(_0x5f460f,null));};exports['describe']=function(_0x3ca206,_0x3d7991){return db[_0x2854('0x52')][_0x2854('0x59')]()[_0x2854('0x1e')](respondWithResult(_0x3d7991,null))[_0x2854('0x28')](handleError(_0x3d7991,null));};var interaction_log=require(_0x2854('0x5a'))('openchannel-interactions');exports[_0x2854('0x5b')]=function(_0x4affa2,_0x137e08,_0x46a39c){var _0x19b0e8={'agent':{},'channel':_0x2854('0x5c')};if(_0x4affa2[_0x2854('0x57')]['id']){delete _0x4affa2[_0x2854('0x57')]['id'];}_0x4affa2['body'][_0x2854('0x5d')]=!![];_0x4affa2['body'][_0x2854('0x5e')]=moment()[_0x2854('0x5f')](_0x2854('0x60'));_0x4affa2[_0x2854('0x57')][_0x2854('0x61')]=_0x4affa2[_0x2854('0x57')][_0x2854('0x61')]||_0x4affa2[_0x2854('0x62')]['id'];_0x19b0e8[_0x2854('0x63')]['id']=_0x4affa2['body'][_0x2854('0x61')];return db['OpenchannelMessage']['find']({'where':{'id':_0x4affa2['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x137e08,null))['then'](saveUpdates(_0x4affa2['body'],null))[_0x2854('0x1e')](function(_0x223d23){if(_0x223d23){_0x19b0e8[_0x2854('0x25')]=_0x223d23[_0x2854('0x64')]({'plain':!![]});return db[_0x2854('0x65')][_0x2854('0x55')]({'where':{'id':_0x223d23[_0x2854('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x137e08,null))['then'](function(_0x1680d2){if(_0x1680d2){return _0x1680d2[_0x2854('0x58')]({'UserId':_0x4affa2[_0x2854('0x57')][_0x2854('0x61')],'read1stAt':_[_0x2854('0x67')](_0x1680d2[_0x2854('0x68')])?moment()[_0x2854('0x5f')](_0x2854('0x60')):undefined});}return null;})[_0x2854('0x1e')](function(_0x53df44){if(_0x53df44){_0x19b0e8[_0x2854('0x69')]=_0x53df44[_0x2854('0x64')]({'plain':!![]});interaction_log[_0x2854('0x26')](_0x2854('0x6a'),_0x4affa2[_0x2854('0x62')]['id'],_0x4affa2[_0x2854('0x62')]['name'],_0x4affa2['user'][_0x2854('0x6b')],_0x19b0e8[_0x2854('0x69')]['id'],_0x4affa2['body']?JSON[_0x2854('0x23')](_0x4affa2[_0x2854('0x57')]):_0x2854('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x2854('0x6d'),_0x19b0e8);}return null;})[_0x2854('0x1e')](function(_0x8b82b9){var _0x20a988='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x8b82b9[_0x2854('0x25')][_0x2854('0x6e')];return db[_0x2854('0x6f')][_0x2854('0x3e')](_0x20a988,{'type':db[_0x2854('0x70')][_0x2854('0x71')]['SELECT'],'raw':!![]})[_0x2854('0x1e')](function(_0x2a8c9d){return _0x2a8c9d;});})[_0x2854('0x1e')](function(_0x1b28ea){if(_0x1b28ea){_0x19b0e8[_0x2854('0x25')]['contact']=_0x1b28ea[0x0];if(!_0x4affa2['body'][_0x2854('0x61')])return;return db[_0x2854('0x72')][_0x2854('0x55')]({'where':{'id':_0x4affa2[_0x2854('0x57')][_0x2854('0x61')],'role':_0x2854('0x63')},'attributes':['id',_0x2854('0x36'),_0x2854('0x73'),_0x2854('0x74'),_0x2854('0x75')],'raw':!![]});}return null;})['then'](function(_0x493f4b){if(!_0x493f4b)return null;_0x19b0e8['message'][_0x2854('0x63')]=_0x493f4b;return _0x19b0e8;})[_0x2854('0x1e')](function(_0x2e2a5a){if(_0x2e2a5a){if(_0x4affa2[_0x2854('0x57')][_0x2854('0x76')]){_0x19b0e8['message'][_0x2854('0x77')]=util['format']('SIP/%s',_0x4affa2[_0x2854('0x62')][_0x2854('0x36')]);_0x19b0e8[_0x2854('0x25')][_0x2854('0x78')]=_0x19b0e8[_0x2854('0x78')];_0x19b0e8[_0x2854('0x25')][_0x2854('0x79')]=_0x2854('0x5b');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x19b0e8[_0x2854('0x25')]},client9002)[_0x2854('0x1e')](function(){return _0x19b0e8;});}return _0x19b0e8;}return null;})[_0x2854('0x1e')](respondWithResult(_0x137e08,null))['catch'](handleError(_0x137e08,null));};var interaction_log=require(_0x2854('0x5a'))('openchannel-interactions');exports['reject']=function(_0x29497a,_0x447df7,_0x28bcea){var _0x323b95={'agent':{},'channel':_0x2854('0x5c')};if(_0x29497a['body']['id']){delete _0x29497a[_0x2854('0x57')]['id'];}_0x29497a['body']['UserId']=_0x29497a[_0x2854('0x57')][_0x2854('0x61')]||_0x29497a['user']['id'];_0x323b95[_0x2854('0x63')]['id']=_0x29497a['body'][_0x2854('0x61')];return db[_0x2854('0x52')]['find']({'where':{'id':_0x29497a[_0x2854('0x51')]['id'],'UserId':null}})[_0x2854('0x1e')](handleEntityNotFound(_0x447df7,null))[_0x2854('0x1e')](function(_0x463d1d){if(_0x463d1d){_0x323b95['message']=_0x463d1d[_0x2854('0x64')]({'plain':!![]});return db[_0x2854('0x65')][_0x2854('0x55')]({'where':{'id':_0x463d1d[_0x2854('0x66')]}});}return null;})[_0x2854('0x1e')](handleEntityNotFound(_0x447df7,null))[_0x2854('0x1e')](function(_0x5549ad){if(_0x5549ad){_0x323b95[_0x2854('0x69')]=_0x5549ad[_0x2854('0x64')]({'plain':!![]});interaction_log[_0x2854('0x26')](_0x2854('0x7a'),_0x29497a[_0x2854('0x62')]['id'],_0x29497a[_0x2854('0x62')][_0x2854('0x36')],_0x29497a[_0x2854('0x62')][_0x2854('0x6b')],_0x323b95['interaction']['id'],_0x29497a[_0x2854('0x57')]?JSON['stringify'](_0x29497a[_0x2854('0x57')]):_0x2854('0x6c'));return respondWithRpcPromise(_0x2854('0x7b'),_0x2854('0x7c'),_0x323b95);}return null;})[_0x2854('0x1e')](function(_0x23281f){var _0xf0a4fc=_0x2854('0x7d')+_0x23281f['message']['ContactId'];return db[_0x2854('0x6f')]['query'](_0xf0a4fc,{'type':db[_0x2854('0x70')][_0x2854('0x71')][_0x2854('0x7e')],'raw':!![]})['then'](function(_0x56b250){return _0x56b250;});})[_0x2854('0x1e')](function(_0x1a1171){if(_0x1a1171){_0x323b95[_0x2854('0x25')][_0x2854('0x7f')]=_0x1a1171[0x0];if(!_0x29497a[_0x2854('0x57')]['UserId'])return;return db[_0x2854('0x72')][_0x2854('0x55')]({'where':{'id':_0x29497a[_0x2854('0x57')][_0x2854('0x61')],'role':'agent'},'attributes':['id',_0x2854('0x36'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x2854('0x1e')](function(_0x4f7ae8){if(!_0x4f7ae8)return null;_0x323b95['message'][_0x2854('0x63')]=_0x4f7ae8;return _0x323b95;})[_0x2854('0x1e')](function(_0x4ca587){if(_0x4ca587){_0x4ca587['message'][_0x2854('0x77')]=util['format']('SIP/%s',_0x29497a[_0x2854('0x62')][_0x2854('0x36')]);_0x4ca587['message'][_0x2854('0x78')]=_0x323b95[_0x2854('0x78')];_0x4ca587[_0x2854('0x25')][_0x2854('0x79')]=_0x2854('0x32');respondWithRpcPromise(_0x2854('0x80'),_0x2854('0x80'),{'event':_0x2854('0x81'),'message':_0x4ca587[_0x2854('0x25')]},client9002);return _0x323b95;}return null;})[_0x2854('0x1e')](respondWithResult(_0x447df7,null))[_0x2854('0x28')](handleError(_0x447df7,null));}; \ No newline at end of file +var _0xb99f=['api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','client','http','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','save','destroy','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','params','find','create','body','update','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','user','agent','get','OpenchannelInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x41e3ab,_0x5066fb){var _0x4d69ef=function(_0x560ebf){while(--_0x560ebf){_0x41e3ab['push'](_0x41e3ab['shift']());}};_0x4d69ef(++_0x5066fb);}(_0xb99f,0x1e8));var _0xfb99=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0xb99f[_0x43f881];return _0x365c14;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfb99('0x0'));var zipdir=require(_0xfb99('0x1'));var jsonpatch=require(_0xfb99('0x2'));var rp=require(_0xfb99('0x3'));var moment=require(_0xfb99('0x4'));var BPromise=require(_0xfb99('0x5'));var Mustache=require('mustache');var util=require(_0xfb99('0x6'));var path=require('path');var sox=require(_0xfb99('0x7'));var csv=require(_0xfb99('0x8'));var ejs=require(_0xfb99('0x9'));var fs=require('fs');var fs_extra=require(_0xfb99('0xa'));var _=require(_0xfb99('0xb'));var squel=require(_0xfb99('0xc'));var crypto=require(_0xfb99('0xd'));var jsforce=require(_0xfb99('0xe'));var deskjs=require(_0xfb99('0xf'));var toCsv=require(_0xfb99('0x8'));var querystring=require('querystring');var Papa=require(_0xfb99('0x10'));var Redis=require('ioredis');var authService=require(_0xfb99('0x11'));var qs=require(_0xfb99('0x12'));var as=require(_0xfb99('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfb99('0x14'));var utils=require('../../config/utils');var config=require(_0xfb99('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xfb99('0x16')]=_[_0xfb99('0x17')](config[_0xfb99('0x16')],{'host':_0xfb99('0x18'),'port':0x18eb});var socket=require(_0xfb99('0x19'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0xfb99('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xfb99('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0xfb99('0x1b')][_0xfb99('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4721bd,_0x285773,_0x2f43c0,_0x524f2e){return new BPromise(function(_0x475e0e,_0x2ed5fc){var _0x1cb0e5=_0x524f2e||client;return _0x1cb0e5['request'](_0x4721bd,_0x2f43c0)[_0xfb99('0x1d')](function(_0x3143ed){logger['info'](_0xfb99('0x1e'),_0x285773,_0xfb99('0x1f'));logger[_0xfb99('0x20')](_0xfb99('0x21'),_0x285773,'request\x20sent',JSON[_0xfb99('0x22')](_0x3143ed));if(_0x3143ed[_0xfb99('0x23')]){if(_0x3143ed[_0xfb99('0x23')][_0xfb99('0x24')]===0x1f4){logger[_0xfb99('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x285773,_0x3143ed['error'][_0xfb99('0x25')]);return _0x2ed5fc(_0x3143ed['error'][_0xfb99('0x25')]);}logger['error'](_0xfb99('0x1e'),_0x285773,_0x3143ed['error'][_0xfb99('0x25')]);return _0x475e0e(_0x3143ed[_0xfb99('0x23')]['message']);}else{logger[_0xfb99('0x26')](_0xfb99('0x1e'),_0x285773,_0xfb99('0x1f'));_0x475e0e(_0x3143ed[_0xfb99('0x27')][_0xfb99('0x25')]);}})[_0xfb99('0x28')](function(_0x593c26){logger['error'](_0xfb99('0x1e'),_0x285773,_0x593c26);_0x2ed5fc(_0x593c26);});});}function respondWithStatusCode(_0x404abb,_0xcaf36c){_0xcaf36c=_0xcaf36c||0xcc;return function(_0xf12b45){if(_0xf12b45){return _0x404abb[_0xfb99('0x29')](_0xcaf36c);}return _0x404abb[_0xfb99('0x2a')](_0xcaf36c)[_0xfb99('0x2b')]();};}function respondWithResult(_0x13d48a,_0x1ec913){_0x1ec913=_0x1ec913||0xc8;return function(_0x128097){if(_0x128097){return _0x13d48a[_0xfb99('0x2a')](_0x1ec913)[_0xfb99('0x2c')](_0x128097);}};}function respondWithFilteredResult(_0x5556ed,_0x506e18){return function(_0x1b4df6){if(_0x1b4df6){var _0x2777a8=typeof _0x506e18['offset']===_0xfb99('0x2d')&&typeof _0x506e18[_0xfb99('0x2e')]===_0xfb99('0x2d');var _0x5ee87d=_0x1b4df6['count'];var _0x1de1ae=_0x2777a8?0x0:_0x506e18[_0xfb99('0x2f')];var _0x3a1acd=_0x2777a8?_0x1b4df6[_0xfb99('0x30')]:_0x506e18[_0xfb99('0x2f')]+_0x506e18[_0xfb99('0x2e')];var _0x13163e;if(_0x3a1acd>=_0x5ee87d){_0x3a1acd=_0x5ee87d;_0x13163e=0xc8;}else{_0x13163e=0xce;}_0x5556ed[_0xfb99('0x2a')](_0x13163e);return _0x5556ed[_0xfb99('0x31')]('Content-Range',_0x1de1ae+'-'+_0x3a1acd+'/'+_0x5ee87d)[_0xfb99('0x2c')](_0x1b4df6);}return null;};}function patchUpdates(_0x2df864){return function(_0x778775){try{jsonpatch[_0xfb99('0x32')](_0x778775,_0x2df864,!![]);}catch(_0x499d9a){return BPromise['reject'](_0x499d9a);}return _0x778775[_0xfb99('0x33')]();};}function saveUpdates(_0x13cdbd,_0x4afa32){return function(_0x542e8b){if(_0x542e8b){return _0x542e8b['update'](_0x13cdbd)[_0xfb99('0x1d')](function(_0x3409a9){return _0x3409a9;});}return null;};}function removeEntity(_0x2fca7b,_0x5212e4){return function(_0xd2d02a){if(_0xd2d02a){return _0xd2d02a[_0xfb99('0x34')]()[_0xfb99('0x1d')](function(){_0x2fca7b[_0xfb99('0x2a')](0xcc)[_0xfb99('0x2b')]();});}};}function handleEntityNotFound(_0x220da9,_0x26adee){return function(_0x488869){if(!_0x488869){_0x220da9['sendStatus'](0x194);}return _0x488869;};}function handleError(_0xc2ff06,_0x5be0b3){_0x5be0b3=_0x5be0b3||0x1f4;return function(_0x2cddca){logger['error'](_0x2cddca[_0xfb99('0x35')]);if(_0x2cddca[_0xfb99('0x36')]){delete _0x2cddca[_0xfb99('0x36')];}_0xc2ff06[_0xfb99('0x2a')](_0x5be0b3)[_0xfb99('0x37')](_0x2cddca);};}exports[_0xfb99('0x38')]=function(_0x28c78a,_0x4eabe8){var _0x1bdf6b={},_0x11b9e5={},_0x2417be={'count':0x0,'rows':[]};var _0x303bcf=_['map'](db[_0xfb99('0x39')][_0xfb99('0x3a')],function(_0x2c4097){return{'name':_0x2c4097[_0xfb99('0x3b')],'type':_0x2c4097[_0xfb99('0x3c')][_0xfb99('0x3d')]};});_0x11b9e5[_0xfb99('0x3e')]=_[_0xfb99('0x3f')](_0x303bcf,_0xfb99('0x36'));_0x11b9e5[_0xfb99('0x40')]=_['keys'](_0x28c78a['query']);_0x11b9e5['filters']=_['intersection'](_0x11b9e5['model'],_0x11b9e5[_0xfb99('0x40')]);_0x1bdf6b[_0xfb99('0x41')]=_[_0xfb99('0x42')](_0x11b9e5[_0xfb99('0x3e')],qs['fields'](_0x28c78a[_0xfb99('0x40')][_0xfb99('0x43')]));_0x1bdf6b[_0xfb99('0x41')]=_0x1bdf6b['attributes']['length']?_0x1bdf6b[_0xfb99('0x41')]:_0x11b9e5['model'];if(!_0x28c78a[_0xfb99('0x40')][_0xfb99('0x44')](_0xfb99('0x45'))){_0x1bdf6b[_0xfb99('0x2e')]=qs[_0xfb99('0x2e')](_0x28c78a[_0xfb99('0x40')][_0xfb99('0x2e')]);_0x1bdf6b[_0xfb99('0x2f')]=qs['offset'](_0x28c78a[_0xfb99('0x40')][_0xfb99('0x2f')]);}_0x1bdf6b[_0xfb99('0x46')]=qs['sort'](_0x28c78a[_0xfb99('0x40')]['sort']);_0x1bdf6b[_0xfb99('0x47')]=qs[_0xfb99('0x48')](_[_0xfb99('0x49')](_0x28c78a['query'],_0x11b9e5[_0xfb99('0x48')]),_0x303bcf);if(_0x28c78a[_0xfb99('0x40')]['filter']){_0x1bdf6b[_0xfb99('0x47')]=_[_0xfb99('0x4a')](_0x1bdf6b[_0xfb99('0x47')],{'$or':_[_0xfb99('0x3f')](_0x303bcf,function(_0x393fa8){if(_0x393fa8[_0xfb99('0x3c')]!==_0xfb99('0x4b')){var _0x34b6e0={};_0x34b6e0[_0x393fa8[_0xfb99('0x36')]]={'$like':'%'+_0x28c78a[_0xfb99('0x40')][_0xfb99('0x4c')]+'%'};return _0x34b6e0;}})});}_0x1bdf6b=_['merge']({},_0x1bdf6b,_0x28c78a[_0xfb99('0x4d')]);var _0x155120={'where':_0x1bdf6b[_0xfb99('0x47')]};return db[_0xfb99('0x39')][_0xfb99('0x30')](_0x155120)[_0xfb99('0x1d')](function(_0x3113fd){_0x2417be[_0xfb99('0x30')]=_0x3113fd;if(_0x28c78a[_0xfb99('0x40')][_0xfb99('0x4e')]){_0x1bdf6b[_0xfb99('0x4f')]=[{'all':!![]}];}return db[_0xfb99('0x39')][_0xfb99('0x50')](_0x1bdf6b);})['then'](function(_0x1305d3){_0x2417be['rows']=_0x1305d3;return _0x2417be;})[_0xfb99('0x1d')](respondWithFilteredResult(_0x4eabe8,_0x1bdf6b))['catch'](handleError(_0x4eabe8,null));};exports['show']=function(_0x2d1466,_0x4582b9){var _0x25bafa={'raw':!![],'where':{'id':_0x2d1466[_0xfb99('0x51')]['id']}},_0xaf16c4={};_0xaf16c4[_0xfb99('0x3e')]=_['keys'](db['OpenchannelMessage'][_0xfb99('0x3a')]);_0xaf16c4[_0xfb99('0x40')]=_['keys'](_0x2d1466['query']);_0xaf16c4[_0xfb99('0x48')]=_[_0xfb99('0x42')](_0xaf16c4[_0xfb99('0x3e')],_0xaf16c4[_0xfb99('0x40')]);_0x25bafa[_0xfb99('0x41')]=_[_0xfb99('0x42')](_0xaf16c4[_0xfb99('0x3e')],qs[_0xfb99('0x43')](_0x2d1466[_0xfb99('0x40')][_0xfb99('0x43')]));_0x25bafa[_0xfb99('0x41')]=_0x25bafa['attributes']['length']?_0x25bafa[_0xfb99('0x41')]:_0xaf16c4[_0xfb99('0x3e')];if(_0x2d1466[_0xfb99('0x40')][_0xfb99('0x4e')]){_0x25bafa[_0xfb99('0x4f')]=[{'all':!![]}];}_0x25bafa=_[_0xfb99('0x4a')]({},_0x25bafa,_0x2d1466[_0xfb99('0x4d')]);return db[_0xfb99('0x39')][_0xfb99('0x52')](_0x25bafa)[_0xfb99('0x1d')](handleEntityNotFound(_0x4582b9,null))[_0xfb99('0x1d')](respondWithResult(_0x4582b9,null))['catch'](handleError(_0x4582b9,null));};exports[_0xfb99('0x53')]=function(_0x4347f0,_0x126ccd){return db[_0xfb99('0x39')]['create'](_0x4347f0[_0xfb99('0x54')],{})[_0xfb99('0x1d')](respondWithResult(_0x126ccd,0xc9))['catch'](handleError(_0x126ccd,null));};exports[_0xfb99('0x55')]=function(_0x33da06,_0x3d6b52){if(_0x33da06[_0xfb99('0x54')]['id']){delete _0x33da06[_0xfb99('0x54')]['id'];}return db[_0xfb99('0x39')][_0xfb99('0x52')]({'where':{'id':_0x33da06['params']['id']}})[_0xfb99('0x1d')](handleEntityNotFound(_0x3d6b52,null))[_0xfb99('0x1d')](saveUpdates(_0x33da06[_0xfb99('0x54')],null))[_0xfb99('0x1d')](respondWithResult(_0x3d6b52,null))[_0xfb99('0x28')](handleError(_0x3d6b52,null));};exports['destroy']=function(_0x1960d6,_0x5c3e50){return db[_0xfb99('0x39')]['find']({'where':{'id':_0x1960d6[_0xfb99('0x51')]['id']}})[_0xfb99('0x1d')](handleEntityNotFound(_0x5c3e50,null))[_0xfb99('0x1d')](removeEntity(_0x5c3e50,null))['catch'](handleError(_0x5c3e50,null));};exports[_0xfb99('0x56')]=function(_0x3e47c1,_0x15f8f9){return db[_0xfb99('0x39')][_0xfb99('0x56')]()[_0xfb99('0x1d')](respondWithResult(_0x15f8f9,null))['catch'](handleError(_0x15f8f9,null));};var interaction_log=require(_0xfb99('0x57'))(_0xfb99('0x58'));exports[_0xfb99('0x59')]=function(_0x17c617,_0x402791,_0x1f11fa){var _0x449c9f={'agent':{},'channel':_0xfb99('0x5a')};if(_0x17c617['body']['id']){delete _0x17c617['body']['id'];}_0x17c617['body'][_0xfb99('0x5b')]=!![];_0x17c617[_0xfb99('0x54')][_0xfb99('0x5c')]=moment()[_0xfb99('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x17c617['body'][_0xfb99('0x5e')]=_0x17c617[_0xfb99('0x54')][_0xfb99('0x5e')]||_0x17c617[_0xfb99('0x5f')]['id'];_0x449c9f[_0xfb99('0x60')]['id']=_0x17c617[_0xfb99('0x54')][_0xfb99('0x5e')];return db[_0xfb99('0x39')][_0xfb99('0x52')]({'where':{'id':_0x17c617[_0xfb99('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x402791,null))[_0xfb99('0x1d')](saveUpdates(_0x17c617[_0xfb99('0x54')],null))['then'](function(_0x29f81c){if(_0x29f81c){_0x449c9f[_0xfb99('0x25')]=_0x29f81c[_0xfb99('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0xfb99('0x52')]({'where':{'id':_0x29f81c[_0xfb99('0x62')]}});}return null;})[_0xfb99('0x1d')](handleEntityNotFound(_0x402791,null))['then'](function(_0x2b928b){if(_0x2b928b){return _0x2b928b['update']({'UserId':_0x17c617[_0xfb99('0x54')][_0xfb99('0x5e')],'read1stAt':_[_0xfb99('0x63')](_0x2b928b['read1stAt'])?moment()['format'](_0xfb99('0x64')):undefined});}return null;})[_0xfb99('0x1d')](function(_0xba1c10){if(_0xba1c10){_0x449c9f[_0xfb99('0x65')]=_0xba1c10[_0xfb99('0x61')]({'plain':!![]});interaction_log[_0xfb99('0x26')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x17c617[_0xfb99('0x5f')]['id'],_0x17c617[_0xfb99('0x5f')][_0xfb99('0x36')],_0x17c617['user'][_0xfb99('0x66')],_0x449c9f[_0xfb99('0x65')]['id'],_0x17c617['body']?JSON['stringify'](_0x17c617[_0xfb99('0x54')]):_0xfb99('0x67'));return respondWithRpcPromise(_0xfb99('0x68'),_0xfb99('0x69'),_0x449c9f);}return null;})[_0xfb99('0x1d')](function(_0x23f082){var _0x26dd91=_0xfb99('0x6a')+_0x23f082['message'][_0xfb99('0x6b')];return db[_0xfb99('0x6c')][_0xfb99('0x40')](_0x26dd91,{'type':db[_0xfb99('0x6d')][_0xfb99('0x6e')][_0xfb99('0x6f')],'raw':!![]})[_0xfb99('0x1d')](function(_0x40ebb8){return _0x40ebb8;});})[_0xfb99('0x1d')](function(_0x5a72d2){if(_0x5a72d2){_0x449c9f[_0xfb99('0x25')]['contact']=_0x5a72d2[0x0];if(!_0x17c617[_0xfb99('0x54')]['UserId'])return;return db[_0xfb99('0x70')][_0xfb99('0x52')]({'where':{'id':_0x17c617['body']['UserId'],'role':_0xfb99('0x60')},'attributes':['id',_0xfb99('0x36'),_0xfb99('0x71'),_0xfb99('0x72'),_0xfb99('0x73')],'raw':!![]});}return null;})['then'](function(_0x4e7817){if(!_0x4e7817)return null;_0x449c9f['message']['agent']=_0x4e7817;return _0x449c9f;})['then'](function(_0xd3070f){if(_0xd3070f){if(_0x17c617[_0xfb99('0x54')][_0xfb99('0x74')]){_0x449c9f[_0xfb99('0x25')]['interface']=util['format'](_0xfb99('0x75'),_0x17c617['user'][_0xfb99('0x36')]);_0x449c9f[_0xfb99('0x25')][_0xfb99('0x76')]=_0x449c9f[_0xfb99('0x76')];_0x449c9f[_0xfb99('0x25')][_0xfb99('0x77')]=_0xfb99('0x59');return respondWithRpcPromise(_0xfb99('0x78'),_0xfb99('0x78'),{'event':_0xfb99('0x79'),'message':_0x449c9f[_0xfb99('0x25')]},client9002)['then'](function(){return _0x449c9f;});}return _0x449c9f;}return null;})[_0xfb99('0x1d')](respondWithResult(_0x402791,null))[_0xfb99('0x28')](handleError(_0x402791,null));};var interaction_log=require('../../config/logger')(_0xfb99('0x58'));exports['reject']=function(_0x189896,_0x58e709,_0x5d37b5){var _0x297e07={'agent':{},'channel':_0xfb99('0x5a')};if(_0x189896[_0xfb99('0x54')]['id']){delete _0x189896[_0xfb99('0x54')]['id'];}_0x189896['body'][_0xfb99('0x5e')]=_0x189896[_0xfb99('0x54')]['UserId']||_0x189896['user']['id'];_0x297e07[_0xfb99('0x60')]['id']=_0x189896[_0xfb99('0x54')][_0xfb99('0x5e')];return db['OpenchannelMessage'][_0xfb99('0x52')]({'where':{'id':_0x189896[_0xfb99('0x51')]['id'],'UserId':null}})[_0xfb99('0x1d')](handleEntityNotFound(_0x58e709,null))['then'](function(_0x5afa40){if(_0x5afa40){_0x297e07[_0xfb99('0x25')]=_0x5afa40[_0xfb99('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0xfb99('0x52')]({'where':{'id':_0x5afa40[_0xfb99('0x62')]}});}return null;})[_0xfb99('0x1d')](handleEntityNotFound(_0x58e709,null))['then'](function(_0x3999e9){if(_0x3999e9){_0x297e07['interaction']=_0x3999e9[_0xfb99('0x61')]({'plain':!![]});interaction_log[_0xfb99('0x26')](_0xfb99('0x7a'),_0x189896['user']['id'],_0x189896['user']['name'],_0x189896[_0xfb99('0x5f')][_0xfb99('0x66')],_0x297e07[_0xfb99('0x65')]['id'],_0x189896[_0xfb99('0x54')]?JSON['stringify'](_0x189896[_0xfb99('0x54')]):_0xfb99('0x67'));return respondWithRpcPromise(_0xfb99('0x7b'),_0xfb99('0x7c'),_0x297e07);}return null;})[_0xfb99('0x1d')](function(_0x1161d4){var _0x3ce28e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1161d4[_0xfb99('0x25')][_0xfb99('0x6b')];return db[_0xfb99('0x6c')][_0xfb99('0x40')](_0x3ce28e,{'type':db[_0xfb99('0x6d')][_0xfb99('0x6e')][_0xfb99('0x6f')],'raw':!![]})['then'](function(_0x466e67){return _0x466e67;});})[_0xfb99('0x1d')](function(_0x143dca){if(_0x143dca){_0x297e07[_0xfb99('0x25')][_0xfb99('0x7d')]=_0x143dca[0x0];if(!_0x189896[_0xfb99('0x54')][_0xfb99('0x5e')])return;return db[_0xfb99('0x70')][_0xfb99('0x52')]({'where':{'id':_0x189896[_0xfb99('0x54')][_0xfb99('0x5e')],'role':_0xfb99('0x60')},'attributes':['id',_0xfb99('0x36'),_0xfb99('0x71'),'email',_0xfb99('0x73')],'raw':!![]});}return null;})[_0xfb99('0x1d')](function(_0x1edc71){if(!_0x1edc71)return null;_0x297e07[_0xfb99('0x25')][_0xfb99('0x60')]=_0x1edc71;return _0x297e07;})[_0xfb99('0x1d')](function(_0x20bec1){if(_0x20bec1){_0x20bec1[_0xfb99('0x25')]['interface']=util[_0xfb99('0x5d')]('SIP/%s',_0x189896[_0xfb99('0x5f')][_0xfb99('0x36')]);_0x20bec1[_0xfb99('0x25')][_0xfb99('0x76')]=_0x297e07[_0xfb99('0x76')];_0x20bec1[_0xfb99('0x25')]['event']='reject';respondWithRpcPromise(_0xfb99('0x78'),_0xfb99('0x78'),{'event':_0xfb99('0x7e'),'message':_0x20bec1[_0xfb99('0x25')]},client9002);return _0x297e07;}return null;})['then'](respondWithResult(_0x58e709,null))['catch'](handleError(_0x58e709,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 845f09f..d231f7a 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 _0xc0f0=['emit','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x195f6c,_0xd406c0){var _0x42a80c=function(_0x34424b){while(--_0x34424b){_0x195f6c['push'](_0x195f6c['shift']());}};_0x42a80c(++_0xd406c0);}(_0xc0f0,0x1b3));var _0x0c0f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc0f0[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x0c0f('0x0'));var OpenchannelMessage=require(_0x0c0f('0x1'))['db'][_0x0c0f('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x0c0f('0x3')](0x0);var events={'afterCreate':_0x0c0f('0x4'),'afterUpdate':_0x0c0f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x123b55){return function(_0x26ed44,_0x4bb2aa,_0x5dc004){OpenchannelMessageEvents['emit'](_0x123b55+':'+_0x26ed44['id'],_0x26ed44);OpenchannelMessageEvents[_0x0c0f('0x6')](_0x123b55,_0x26ed44);_0x5dc004(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x0c0f('0x7')](e,emitEvent(event));}}module[_0x0c0f('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x231f=['OpenchannelMessage','setMaxListeners','save','update','remove','emit','hook','../../mysqldb'];(function(_0x8d244d,_0x49c04a){var _0x30fcd2=function(_0x167302){while(--_0x167302){_0x8d244d['push'](_0x8d244d['shift']());}};_0x30fcd2(++_0x49c04a);}(_0x231f,0x1ef));var _0xf231=function(_0x488fe4,_0x546803){_0x488fe4=_0x488fe4-0x0;var _0x3a7832=_0x231f[_0x488fe4];return _0x3a7832;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xf231('0x0'))['db'][_0xf231('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xf231('0x2')](0x0);var events={'afterCreate':_0xf231('0x3'),'afterUpdate':_0xf231('0x4'),'afterDestroy':_0xf231('0x5')};function emitEvent(_0x38f61a){return function(_0x2ea68f,_0x2fe94c,_0x4c1a29){OpenchannelMessageEvents['emit'](_0x38f61a+':'+_0x2ea68f['id'],_0x2ea68f);OpenchannelMessageEvents[_0xf231('0x6')](_0x38f61a,_0x2ea68f);_0x4c1a29(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xf231('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 49d17e8..0668411 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 _0xf4f4=['Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','omit','POST','method','Message\x20%d\x20forwarded\x20to\x20%s','Interaction','threadId','error','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','update','createdAt','catch','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId'];(function(_0x4dbe11,_0x12b87c){var _0x52f66c=function(_0x293c38){while(--_0x293c38){_0x4dbe11['push'](_0x4dbe11['shift']());}};_0x52f66c(++_0x12b87c);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x570845,_0x4935ca){_0x570845=_0x570845-0x0;var _0x393e6c=_0xf4f4[_0x570845];return _0x393e6c;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var logger=require('../../config/logger')(_0x4f4f('0x2'));var moment=require(_0x4f4f('0x3'));var BPromise=require(_0x4f4f('0x4'));var rp=require(_0x4f4f('0x5'));var fs=require('fs');var path=require(_0x4f4f('0x6'));var rimraf=require('rimraf');var config=require(_0x4f4f('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0x4f4f('0x8')]=function(_0x132d5c,_0x20ee6e){return _0x132d5c[_0x4f4f('0x9')](_0x4f4f('0xa'),attributes,{'tableName':_0x4f4f('0xb'),'paranoid':![],'indexes':[{'name':_0x4f4f('0xc'),'fields':[_0x4f4f('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xc066a4,_0x38d110,_0x39e36b){var _0x2d86d1=_0x132d5c[_0x4f4f('0xe')];var _0x11940f=_0xc066a4[_0x4f4f('0xf')]({'plain':!![]});if(_0x11940f[_0x4f4f('0x10')]['toLowerCase']()==='in'||_0x11940f['direction'][_0x4f4f('0x11')]()===_0x4f4f('0x12')&&!_0x11940f[_0x4f4f('0x13')]&&!_[_0x4f4f('0x14')](_0x11940f[_0x4f4f('0x15')])){_0x2d86d1[_0x4f4f('0x16')]['findOne']({'where':{'id':_0x11940f[_0x4f4f('0x17')]}})['then'](function(_0x216ba8){if(_0x216ba8){_0x216ba8[_0x4f4f('0x18')]({'lastMsgAt':_0x11940f[_0x4f4f('0x19')],'lastMsgDirection':_0x11940f[_0x4f4f('0x10')]['toLowerCase']()});}})[_0x4f4f('0x1a')](function(_0x4c68f4){console['error'](_0x4c68f4);});}if(_0x11940f['direction']===_0x4f4f('0x12')&&!_0x11940f[_0x4f4f('0x13')]){var _0x2d21ed;_0x2d86d1[_0x4f4f('0x1b')][_0x4f4f('0x1c')]()[_0x4f4f('0x1d')](function(_0x1245c4){return _0x2d86d1[_0x4f4f('0x1e')][_0x4f4f('0x1f')]({'where':{'id':_0x11940f[_0x4f4f('0x20')]},'include':[{'model':_0x2d86d1[_0x4f4f('0x16')],'as':_0x4f4f('0x21'),'where':{'id':_0x11940f['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x2d86d1[_0x4f4f('0x1b')],'as':_0x4f4f('0x22'),'attributes':_[_0x4f4f('0x23')](_0x1245c4)}]}]});})[_0x4f4f('0x1d')](function(_0x302a79){_0x2d21ed=_0x302a79[_0x4f4f('0xf')]({'plain':!![]});if(_0x2d21ed&&_0x2d21ed[_0x4f4f('0x24')]){logger[_0x4f4f('0x25')](_0x4f4f('0x26'),_0x4f4f('0x27'),util[_0x4f4f('0x28')](_0x4f4f('0x29'),_0x11940f['id'],_0x2d21ed[_0x4f4f('0x24')]));if(_0x2d21ed[_0x4f4f('0x21')]&&_0x2d21ed['Interactions']['length']){_0x11940f['Interaction']=_[_0x4f4f('0x2a')](_0x2d21ed[_0x4f4f('0x21')][0x0],'Contact');_0x11940f[_0x4f4f('0x22')]=_0x2d21ed[_0x4f4f('0x21')][0x0][_0x4f4f('0x22')];}var _0x38d110={'method':_0x4f4f('0x2b'),'uri':encodeURI(_0x2d21ed[_0x4f4f('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x38d110[_0x4f4f('0x2c')]){case'GET':_0x38d110['qs']=_0x11940f;break;case _0x4f4f('0x2b'):_0x38d110[_0x4f4f('0xd')]=_0x11940f;break;}return rp(_0x38d110)[_0x4f4f('0x1d')](function(_0x15c79c){logger[_0x4f4f('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x4f4f('0x27'),util[_0x4f4f('0x28')](_0x4f4f('0x2d'),_0x11940f['id'],_0x2d21ed['replyUri']));if(_0x15c79c['body']['threadId']&&_0x15c79c[_0x4f4f('0xd')]['threadId']!=_0x11940f[_0x4f4f('0x2e')][_0x4f4f('0x2f')]){return _0x2d86d1[_0x4f4f('0x16')]['update']({'threadId':_0x15c79c[_0x4f4f('0xd')][_0x4f4f('0x2f')]},{'logging':!![],'where':{'id':_0x11940f['Interaction']['id']}});}else{return;}})[_0x4f4f('0x1d')](function(){return _0xc066a4[_0x4f4f('0x18')]({'read':!![]});})[_0x4f4f('0x1a')](function(_0x5b937e){logger[_0x4f4f('0x30')](_0x4f4f('0x26'),'afterCreate',util['inspect'](_0x5b937e,{'showHidden':![],'depth':null}));_0x39e36b();});}else{_0x39e36b();}})[_0x4f4f('0x31')](function(){_0x39e36b();});}else{_0x39e36b();}}},'charset':_0x4f4f('0x32'),'collate':_0x4f4f('0x33')});}; \ No newline at end of file +var _0x0b0e=['get','toLowerCase','direction','secret','isNil','UserId','OpenchannelInteraction','findOne','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','Interactions','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','omit','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','body','FULLTEXT'];(function(_0x1304c6,_0x6bb485){var _0x2e6654=function(_0x2b623c){while(--_0x2b623c){_0x1304c6['push'](_0x1304c6['shift']());}};_0x2e6654(++_0x6bb485);}(_0x0b0e,0x187));var _0xe0b0=function(_0x52b7b9,_0x43ed4b){_0x52b7b9=_0x52b7b9-0x0;var _0x5b5d30=_0x0b0e[_0x52b7b9];return _0x5b5d30;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xe0b0('0xb'),'fields':[_0xe0b0('0xc')],'type':_0xe0b0('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ac27e,_0x4c24f9,_0x338e7c){var _0x1dd3b8=_0x30e20d['models'];var _0x1fef28=_0x2ac27e[_0xe0b0('0xe')]({'plain':!![]});if(_0x1fef28['direction'][_0xe0b0('0xf')]()==='in'||_0x1fef28[_0xe0b0('0x10')][_0xe0b0('0xf')]()==='out'&&!_0x1fef28[_0xe0b0('0x11')]&&!_[_0xe0b0('0x12')](_0x1fef28[_0xe0b0('0x13')])){_0x1dd3b8[_0xe0b0('0x14')][_0xe0b0('0x15')]({'where':{'id':_0x1fef28['OpenchannelInteractionId']}})[_0xe0b0('0x16')](function(_0x154de6){if(_0x154de6){_0x154de6[_0xe0b0('0x17')]({'lastMsgAt':_0x1fef28[_0xe0b0('0x18')],'lastMsgDirection':_0x1fef28[_0xe0b0('0x10')]['toLowerCase']()});}})[_0xe0b0('0x19')](function(_0x5adb01){console[_0xe0b0('0x1a')](_0x5adb01);});}if(_0x1fef28[_0xe0b0('0x10')]==='out'&&!_0x1fef28[_0xe0b0('0x11')]){var _0x4a4cc0;_0x1dd3b8[_0xe0b0('0x1b')][_0xe0b0('0x1c')]()['then'](function(_0x54a3eb){return _0x1dd3b8[_0xe0b0('0x1d')]['find']({'where':{'id':_0x1fef28['OpenchannelAccountId']},'include':[{'model':_0x1dd3b8['OpenchannelInteraction'],'as':_0xe0b0('0x1e'),'where':{'id':_0x1fef28['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x1dd3b8['CmContact'],'as':_0xe0b0('0x1f'),'attributes':_['keys'](_0x54a3eb)}]}]});})[_0xe0b0('0x16')](function(_0x5dba2f){_0x4a4cc0=_0x5dba2f[_0xe0b0('0xe')]({'plain':!![]});if(_0x4a4cc0&&_0x4a4cc0[_0xe0b0('0x20')]){logger[_0xe0b0('0x21')](_0xe0b0('0x22'),_0xe0b0('0x23'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x1fef28['id'],_0x4a4cc0[_0xe0b0('0x20')]));if(_0x4a4cc0['Interactions']&&_0x4a4cc0[_0xe0b0('0x1e')][_0xe0b0('0x24')]){_0x1fef28['Interaction']=_[_0xe0b0('0x25')](_0x4a4cc0['Interactions'][0x0],_0xe0b0('0x1f'));_0x1fef28['Contact']=_0x4a4cc0[_0xe0b0('0x1e')][0x0]['Contact'];}var _0x4c24f9={'method':'POST','uri':encodeURI(_0x4a4cc0[_0xe0b0('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4c24f9['method']){case _0xe0b0('0x26'):_0x4c24f9['qs']=_0x1fef28;break;case'POST':_0x4c24f9[_0xe0b0('0xc')]=_0x1fef28;break;}return rp(_0x4c24f9)[_0xe0b0('0x16')](function(_0x1f1ebd){logger[_0xe0b0('0x21')](_0xe0b0('0x22'),_0xe0b0('0x23'),util['format'](_0xe0b0('0x27'),_0x1fef28['id'],_0x4a4cc0[_0xe0b0('0x20')]));if(_0x1f1ebd['body'][_0xe0b0('0x28')]&&_0x1f1ebd[_0xe0b0('0xc')][_0xe0b0('0x28')]!=_0x1fef28[_0xe0b0('0x29')][_0xe0b0('0x28')]){return _0x1dd3b8[_0xe0b0('0x14')][_0xe0b0('0x17')]({'threadId':_0x1f1ebd['body'][_0xe0b0('0x28')]},{'logging':!![],'where':{'id':_0x1fef28[_0xe0b0('0x29')]['id']}});}else{return;}})['then'](function(){return _0x2ac27e['update']({'read':!![]});})[_0xe0b0('0x19')](function(_0x33e672){logger[_0xe0b0('0x1a')](_0xe0b0('0x22'),_0xe0b0('0x23'),util['inspect'](_0x33e672,{'showHidden':![],'depth':null}));_0x338e7c();});}else{_0x338e7c();}})[_0xe0b0('0x2a')](function(){_0x338e7c();});}else{_0x338e7c();}}},'charset':_0xe0b0('0x2b'),'collate':_0xe0b0('0x2c')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 830aa0a..a6bcd81 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 _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x3086e3,_0x42bab4){var _0x46369a=function(_0x17c8c6){while(--_0x17c8c6){_0x3086e3['push'](_0x3086e3['shift']());}};_0x46369a(++_0x42bab4);}(_0xdb28,0x106));var _0x8db2=function(_0x375c79,_0x333c48){_0x375c79=_0x375c79-0x0;var _0x5332f1=_0xdb28[_0x375c79];return _0x5332f1;};'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});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file +var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x33d138,_0xe77cd6){var _0x1c7aa0=function(_0x385b58){while(--_0x385b58){_0x33d138['push'](_0x33d138['shift']());}};_0x1c7aa0(++_0xe77cd6);}(_0x2ef3,0xba));var _0x32ef=function(_0x31d552,_0x2d18ac){_0x31d552=_0x31d552-0x0;var _0x4788b5=_0x2ef3[_0x31d552];return _0x4788b5;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 29caf4a..e943f76 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 _0x04f7=['update','length','./openchannelMessage.events','remove'];(function(_0x12a66f,_0x564a7c){var _0x46e14b=function(_0xf59596){while(--_0xf59596){_0x12a66f['push'](_0x12a66f['shift']());}};_0x46e14b(++_0x564a7c);}(_0x04f7,0x1f2));var _0x704f=function(_0x2336a1,_0x3c2c16){_0x2336a1=_0x2336a1-0x0;var _0x494312=_0x04f7[_0x2336a1];return _0x494312;};'use strict';var OpenchannelMessageEvents=require(_0x704f('0x0'));var events=['save',_0x704f('0x1'),_0x704f('0x2')];function createListener(_0x3fc397,_0x215238){return function(_0x3f4474){_0x215238['emit'](_0x3fc397,_0x3f4474);};}function removeListener(_0x3acf30,_0x550c27){return function(){OpenchannelMessageEvents['removeListener'](_0x3acf30,_0x550c27);};}exports['register']=function(_0x1d17f7){for(var _0x32bf45=0x0,_0xfea3e0=events[_0x704f('0x3')];_0x32bf45<_0xfea3e0;_0x32bf45++){var _0x3fa1e6=events[_0x32bf45];var _0xc41786=createListener('openchannelMessage:'+_0x3fa1e6,_0x1d17f7);OpenchannelMessageEvents['on'](_0x3fa1e6,_0xc41786);}}; \ No newline at end of file +var _0x6fc8=['save','remove','update','emit','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x6fc8,0x156));var _0x86fc=function(_0x541a42,_0x105d52){_0x541a42=_0x541a42-0x0;var _0x1b43f8=_0x6fc8[_0x541a42];return _0x1b43f8;};'use strict';var OpenchannelMessageEvents=require(_0x86fc('0x0'));var events=[_0x86fc('0x1'),_0x86fc('0x2'),_0x86fc('0x3')];function createListener(_0x178b2b,_0x17abee){return function(_0x12cc4e){_0x17abee[_0x86fc('0x4')](_0x178b2b,_0x12cc4e);};}function removeListener(_0x58e7e2,_0xc953ad){return function(){OpenchannelMessageEvents['removeListener'](_0x58e7e2,_0xc953ad);};}exports['register']=function(_0x296553){for(var _0x5ac2ef=0x0,_0x493f4a=events[_0x86fc('0x5')];_0x5ac2ef<_0x493f4a;_0x5ac2ef++){var _0x56d6df=events[_0x5ac2ef];var _0x1f031d=createListener(_0x86fc('0x6')+_0x56d6df,_0x296553);OpenchannelMessageEvents['on'](_0x56d6df,_0x1f031d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 12266e1..a0b3744 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 _0x9751=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x18a50a,_0x5617a8){var _0x11f37e=function(_0x1a3f65){while(--_0x1a3f65){_0x18a50a['push'](_0x18a50a['shift']());}};_0x11f37e(++_0x5617a8);}(_0x9751,0x133));var _0x1975=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9751[_0x543084];return _0x306a57;};'use strict';var multer=require(_0x1975('0x0'));var util=require(_0x1975('0x1'));var path=require('path');var timeout=require(_0x1975('0x2'));var express=require(_0x1975('0x3'));var router=express['Router']();var fs_extra=require(_0x1975('0x4'));var auth=require(_0x1975('0x5'));var interaction=require(_0x1975('0x6'));var config=require(_0x1975('0x7'));var controller=require('./openchannelQueue.controller');router[_0x1975('0x8')]('/',auth[_0x1975('0x9')](),controller['index']);router[_0x1975('0x8')]('/describe',auth[_0x1975('0x9')](),controller[_0x1975('0xa')]);router[_0x1975('0x8')](_0x1975('0xb'),auth[_0x1975('0x9')](),controller[_0x1975('0xc')]);router[_0x1975('0x8')](_0x1975('0xd'),auth[_0x1975('0x9')](),controller['getMembers']);router[_0x1975('0x8')](_0x1975('0xe'),auth[_0x1975('0x9')](),controller[_0x1975('0xf')]);router[_0x1975('0x8')]('/:id/users',auth[_0x1975('0x9')](),controller[_0x1975('0x10')]);router[_0x1975('0x11')]('/',auth[_0x1975('0x9')](),controller['create']);router['post'](_0x1975('0xe'),auth['isAuthenticated'](),controller[_0x1975('0x12')]);router['post'](_0x1975('0x13'),auth[_0x1975('0x9')](),controller['addAgents']);router['put'](_0x1975('0xb'),auth['isAuthenticated'](),controller[_0x1975('0x14')]);router[_0x1975('0x15')](_0x1975('0xb'),auth[_0x1975('0x9')](),controller[_0x1975('0x16')]);router[_0x1975('0x15')]('/:id/teams',auth[_0x1975('0x9')](),controller[_0x1975('0x17')]);router[_0x1975('0x15')](_0x1975('0x13'),auth[_0x1975('0x9')](),controller[_0x1975('0x18')]);module[_0x1975('0x19')]=router; \ No newline at end of file +var _0x4569=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','/:id','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','update','delete','destroy','removeAgents','exports','util','path'];(function(_0x3e57ef,_0x388fab){var _0x5ade66=function(_0xcbbd3){while(--_0xcbbd3){_0x3e57ef['push'](_0x3e57ef['shift']());}};_0x5ade66(++_0x388fab);}(_0x4569,0x9a));var _0x9456=function(_0x478eb7,_0x19906e){_0x478eb7=_0x478eb7-0x0;var _0x1b3fda=_0x4569[_0x478eb7];return _0x1b3fda;};'use strict';var multer=require('multer');var util=require(_0x9456('0x0'));var path=require(_0x9456('0x1'));var timeout=require('connect-timeout');var express=require(_0x9456('0x2'));var router=express[_0x9456('0x3')]();var fs_extra=require(_0x9456('0x4'));var auth=require(_0x9456('0x5'));var interaction=require(_0x9456('0x6'));var config=require(_0x9456('0x7'));var controller=require(_0x9456('0x8'));router[_0x9456('0x9')]('/',auth[_0x9456('0xa')](),controller['index']);router['get'](_0x9456('0xb'),auth[_0x9456('0xa')](),controller[_0x9456('0xc')]);router[_0x9456('0x9')](_0x9456('0xd'),auth[_0x9456('0xa')](),controller['show']);router[_0x9456('0x9')]('/:id/members',auth[_0x9456('0xa')](),controller[_0x9456('0xe')]);router[_0x9456('0x9')]('/:id/teams',auth[_0x9456('0xa')](),controller[_0x9456('0xf')]);router[_0x9456('0x9')](_0x9456('0x10'),auth['isAuthenticated'](),controller[_0x9456('0x11')]);router[_0x9456('0x12')]('/',auth[_0x9456('0xa')](),controller['create']);router[_0x9456('0x12')](_0x9456('0x13'),auth[_0x9456('0xa')](),controller[_0x9456('0x14')]);router[_0x9456('0x12')](_0x9456('0x10'),auth[_0x9456('0xa')](),controller['addAgents']);router['put']('/:id',auth[_0x9456('0xa')](),controller[_0x9456('0x15')]);router[_0x9456('0x16')](_0x9456('0xd'),auth[_0x9456('0xa')](),controller[_0x9456('0x17')]);router[_0x9456('0x16')](_0x9456('0x13'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x9456('0x16')]('/:id/users',auth[_0x9456('0xa')](),controller[_0x9456('0x18')]);module[_0x9456('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ea2a50d..34a096a 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 _0x6b5c=['STRING','INTEGER','ENUM','rrmemory','roundrobin','exports'];(function(_0x3831ee,_0x41a8e0){var _0x5f300b=function(_0x2a46ca){while(--_0x2a46ca){_0x3831ee['push'](_0x3831ee['shift']());}};_0x5f300b(++_0x41a8e0);}(_0x6b5c,0x77));var _0xc6b5=function(_0x3d9ba7,_0x1c8b5f){_0x3d9ba7=_0x3d9ba7-0x0;var _0x4621ce=_0x6b5c[_0x3d9ba7];return _0x4621ce;};'use strict';var Sequelize=require('sequelize');module[_0xc6b5('0x0')]={'name':{'type':Sequelize[_0xc6b5('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc6b5('0x1')]},'timeout':{'type':Sequelize[_0xc6b5('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc6b5('0x3')](_0xc6b5('0x4'),'beepall',_0xc6b5('0x5'))}}; \ No newline at end of file +var _0x2acc=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x31b5b2,_0x5ab927){var _0x364f13=function(_0x163bd0){while(--_0x163bd0){_0x31b5b2['push'](_0x31b5b2['shift']());}};_0x364f13(++_0x5ab927);}(_0x2acc,0x193));var _0xc2ac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2acc[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xc2ac('0x0'));module[_0xc2ac('0x1')]={'name':{'type':Sequelize[_0xc2ac('0x2')],'unique':_0xc2ac('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc2ac('0x2')]},'timeout':{'type':Sequelize[_0xc2ac('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc2ac('0x5')](_0xc2ac('0x6'),_0xc2ac('0x7'),_0xc2ac('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 24c2dc7..8952d9a 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 _0x5a00=['nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','params','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','OpenchannelQueueId','findAll','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','voicePause','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','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','../../mysqldb','redis','localhost','./openchannelQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x20fecd,_0x177d38){var _0x508ef7=function(_0x156a59){while(--_0x156a59){_0x20fecd['push'](_0x20fecd['shift']());}};_0x508ef7(++_0x177d38);}(_0x5a00,0x17b));var _0x05a0=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x5a00[_0x166d93];return _0xba708;};'use strict';var emlformat=require(_0x05a0('0x0'));var rimraf=require(_0x05a0('0x1'));var zipdir=require(_0x05a0('0x2'));var jsonpatch=require(_0x05a0('0x3'));var rp=require('request-promise');var moment=require(_0x05a0('0x4'));var BPromise=require(_0x05a0('0x5'));var Mustache=require('mustache');var util=require(_0x05a0('0x6'));var path=require(_0x05a0('0x7'));var sox=require(_0x05a0('0x8'));var csv=require(_0x05a0('0x9'));var ejs=require(_0x05a0('0xa'));var fs=require('fs');var fs_extra=require(_0x05a0('0xb'));var _=require(_0x05a0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x05a0('0xd'));var deskjs=require(_0x05a0('0xe'));var toCsv=require(_0x05a0('0x9'));var querystring=require(_0x05a0('0xf'));var Papa=require(_0x05a0('0x10'));var Redis=require(_0x05a0('0x11'));var authService=require(_0x05a0('0x12'));var qs=require(_0x05a0('0x13'));var as=require(_0x05a0('0x14'));var hardwareService=require(_0x05a0('0x15'));var logger=require(_0x05a0('0x16'))(_0x05a0('0x17'));var utils=require(_0x05a0('0x18'));var config=require(_0x05a0('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x05a0('0x1a'))['db'];config[_0x05a0('0x1b')]=_['defaults'](config['redis'],{'host':_0x05a0('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x05a0('0x1b')]));require(_0x05a0('0x1d'))['register'](socket);function respondWithStatusCode(_0x2eed2a,_0x470ed7){_0x470ed7=_0x470ed7||0xcc;return function(_0x2b3dfd){if(_0x2b3dfd){return _0x2eed2a[_0x05a0('0x1e')](_0x470ed7);}return _0x2eed2a[_0x05a0('0x1f')](_0x470ed7)[_0x05a0('0x20')]();};}function respondWithResult(_0x5ebfd7,_0x2e9544){_0x2e9544=_0x2e9544||0xc8;return function(_0x3514b7){if(_0x3514b7){return _0x5ebfd7['status'](_0x2e9544)[_0x05a0('0x21')](_0x3514b7);}};}function respondWithFilteredResult(_0xb7198d,_0x58a91b){return function(_0x2c86fb){if(_0x2c86fb){var _0x498c39=typeof _0x58a91b['offset']===_0x05a0('0x22')&&typeof _0x58a91b[_0x05a0('0x23')]==='undefined';var _0x5a842c=_0x2c86fb[_0x05a0('0x24')];var _0xeaa70f=_0x498c39?0x0:_0x58a91b['offset'];var _0x41f94a=_0x498c39?_0x2c86fb['count']:_0x58a91b[_0x05a0('0x25')]+_0x58a91b[_0x05a0('0x23')];var _0x4314f1;if(_0x41f94a>=_0x5a842c){_0x41f94a=_0x5a842c;_0x4314f1=0xc8;}else{_0x4314f1=0xce;}_0xb7198d['status'](_0x4314f1);return _0xb7198d['set'](_0x05a0('0x26'),_0xeaa70f+'-'+_0x41f94a+'/'+_0x5a842c)[_0x05a0('0x21')](_0x2c86fb);}return null;};}function patchUpdates(_0x9d5178){return function(_0x46c286){try{jsonpatch[_0x05a0('0x27')](_0x46c286,_0x9d5178,!![]);}catch(_0x296462){return BPromise[_0x05a0('0x28')](_0x296462);}return _0x46c286[_0x05a0('0x29')]();};}function saveUpdates(_0x3be3b0,_0x1d975f){return function(_0x52e9cb){if(_0x52e9cb){return _0x52e9cb[_0x05a0('0x2a')](_0x3be3b0)[_0x05a0('0x2b')](function(_0x11c721){return _0x11c721;});}return null;};}function removeEntity(_0x33a026,_0x1f643b){return function(_0x596c40){if(_0x596c40){return _0x596c40[_0x05a0('0x2c')]()[_0x05a0('0x2b')](function(){var _0x313964=_0x596c40['get']({'plain':!![]});var _0x11aed8=_0x05a0('0x2d');return db[_0x05a0('0x2e')][_0x05a0('0x2c')]({'where':{'type':_0x11aed8,'resourceId':_0x313964['id']}})[_0x05a0('0x2b')](function(){return _0x596c40;});})[_0x05a0('0x2b')](function(){_0x33a026[_0x05a0('0x1f')](0xcc)[_0x05a0('0x20')]();});}};}function handleEntityNotFound(_0x313b05,_0x5c3e7f){return function(_0xb8d55f){if(!_0xb8d55f){_0x313b05[_0x05a0('0x1e')](0x194);}return _0xb8d55f;};}function handleError(_0x45437f,_0x1b6d5f){_0x1b6d5f=_0x1b6d5f||0x1f4;return function(_0x4170eb){logger[_0x05a0('0x2f')](_0x4170eb[_0x05a0('0x30')]);if(_0x4170eb[_0x05a0('0x31')]){delete _0x4170eb[_0x05a0('0x31')];}_0x45437f['status'](_0x1b6d5f)[_0x05a0('0x32')](_0x4170eb);};}exports[_0x05a0('0x33')]=function(_0x5c974e,_0x3ae8a2){var _0x2d37f5={},_0x442858={},_0x3c6c79={'count':0x0,'rows':[]};var _0x4a52ae=_[_0x05a0('0x34')](db[_0x05a0('0x35')][_0x05a0('0x36')],function(_0xfab777){return{'name':_0xfab777[_0x05a0('0x37')],'type':_0xfab777[_0x05a0('0x38')]['key']};});_0x442858['model']=_[_0x05a0('0x34')](_0x4a52ae,_0x05a0('0x31'));_0x442858[_0x05a0('0x39')]=_[_0x05a0('0x3a')](_0x5c974e[_0x05a0('0x39')]);_0x442858[_0x05a0('0x3b')]=_[_0x05a0('0x3c')](_0x442858[_0x05a0('0x3d')],_0x442858[_0x05a0('0x39')]);_0x2d37f5[_0x05a0('0x3e')]=_['intersection'](_0x442858[_0x05a0('0x3d')],qs[_0x05a0('0x3f')](_0x5c974e[_0x05a0('0x39')][_0x05a0('0x3f')]));_0x2d37f5['attributes']=_0x2d37f5[_0x05a0('0x3e')][_0x05a0('0x40')]?_0x2d37f5['attributes']:_0x442858['model'];if(!_0x5c974e[_0x05a0('0x39')]['hasOwnProperty'](_0x05a0('0x41'))){_0x2d37f5[_0x05a0('0x23')]=qs[_0x05a0('0x23')](_0x5c974e[_0x05a0('0x39')][_0x05a0('0x23')]);_0x2d37f5[_0x05a0('0x25')]=qs[_0x05a0('0x25')](_0x5c974e[_0x05a0('0x39')][_0x05a0('0x25')]);}_0x2d37f5[_0x05a0('0x42')]=qs[_0x05a0('0x43')](_0x5c974e[_0x05a0('0x39')]['sort']);_0x2d37f5[_0x05a0('0x44')]=qs['filters'](_[_0x05a0('0x45')](_0x5c974e[_0x05a0('0x39')],_0x442858[_0x05a0('0x3b')]),_0x4a52ae);if(_0x5c974e[_0x05a0('0x39')][_0x05a0('0x46')]){_0x2d37f5[_0x05a0('0x44')]=_[_0x05a0('0x47')](_0x2d37f5[_0x05a0('0x44')],{'$or':_[_0x05a0('0x34')](_0x4a52ae,function(_0x190c39){if(_0x190c39[_0x05a0('0x38')]!=='VIRTUAL'){var _0x25a73e={};_0x25a73e[_0x190c39['name']]={'$like':'%'+_0x5c974e[_0x05a0('0x39')][_0x05a0('0x46')]+'%'};return _0x25a73e;}})});}_0x2d37f5=_[_0x05a0('0x47')]({},_0x2d37f5,_0x5c974e['options']);var _0x3ced9a={'where':_0x2d37f5[_0x05a0('0x44')]};return db['OpenchannelQueue']['count'](_0x3ced9a)['then'](function(_0x4d5184){_0x3c6c79[_0x05a0('0x24')]=_0x4d5184;if(_0x5c974e[_0x05a0('0x39')][_0x05a0('0x48')]){_0x2d37f5[_0x05a0('0x49')]=[{'all':!![]}];}return db[_0x05a0('0x35')]['findAll'](_0x2d37f5);})[_0x05a0('0x2b')](function(_0x456666){_0x3c6c79[_0x05a0('0x4a')]=_0x456666;return _0x3c6c79;})['then'](respondWithFilteredResult(_0x3ae8a2,_0x2d37f5))[_0x05a0('0x4b')](handleError(_0x3ae8a2,null));};exports['show']=function(_0x1ccc97,_0x1a0010){var _0x6fd3ce={'raw':!![],'where':{'id':_0x1ccc97[_0x05a0('0x4c')]['id']}},_0x1fbd8e={};_0x1fbd8e[_0x05a0('0x3d')]=_[_0x05a0('0x3a')](db['OpenchannelQueue'][_0x05a0('0x36')]);_0x1fbd8e[_0x05a0('0x39')]=_[_0x05a0('0x3a')](_0x1ccc97[_0x05a0('0x39')]);_0x1fbd8e[_0x05a0('0x3b')]=_[_0x05a0('0x3c')](_0x1fbd8e[_0x05a0('0x3d')],_0x1fbd8e[_0x05a0('0x39')]);_0x6fd3ce[_0x05a0('0x3e')]=_[_0x05a0('0x3c')](_0x1fbd8e['model'],qs[_0x05a0('0x3f')](_0x1ccc97[_0x05a0('0x39')][_0x05a0('0x3f')]));_0x6fd3ce[_0x05a0('0x3e')]=_0x6fd3ce[_0x05a0('0x3e')][_0x05a0('0x40')]?_0x6fd3ce[_0x05a0('0x3e')]:_0x1fbd8e[_0x05a0('0x3d')];if(_0x1ccc97['query'][_0x05a0('0x48')]){_0x6fd3ce[_0x05a0('0x49')]=[{'all':!![]}];}_0x6fd3ce=_[_0x05a0('0x47')]({},_0x6fd3ce,_0x1ccc97[_0x05a0('0x4d')]);return db[_0x05a0('0x35')][_0x05a0('0x4e')](_0x6fd3ce)[_0x05a0('0x2b')](handleEntityNotFound(_0x1a0010,null))[_0x05a0('0x2b')](respondWithResult(_0x1a0010,null))['catch'](handleError(_0x1a0010,null));};exports[_0x05a0('0x4f')]=function(_0x14f5be,_0x1415c6){return db[_0x05a0('0x35')][_0x05a0('0x4f')](_0x14f5be['body'],{})['then'](function(_0xe8c879){var _0xdbe120=_0x14f5be[_0x05a0('0x50')][_0x05a0('0x51')]({'plain':!![]});if(!_0xdbe120)throw new Error(_0x05a0('0x52'));if(_0xdbe120[_0x05a0('0x53')]===_0x05a0('0x50')){var _0x29c64c=_0xe8c879[_0x05a0('0x51')]({'plain':!![]});var _0x4d6d99=_0x05a0('0x2d');return db[_0x05a0('0x54')][_0x05a0('0x4e')]({'where':{'name':_0x4d6d99,'userProfileId':_0xdbe120[_0x05a0('0x55')]},'raw':!![]})['then'](function(_0x51a963){if(_0x51a963&&_0x51a963[_0x05a0('0x56')]===0x0){return db[_0x05a0('0x2e')][_0x05a0('0x4f')]({'name':_0x29c64c[_0x05a0('0x31')],'resourceId':_0x29c64c['id'],'type':_0x51a963[_0x05a0('0x31')],'sectionId':_0x51a963['id']},{})[_0x05a0('0x2b')](function(){return _0xe8c879;});}else{return _0xe8c879;}})[_0x05a0('0x4b')](function(_0x1c34e6){logger[_0x05a0('0x2f')](_0x05a0('0x57'),_0x1c34e6);throw _0x1c34e6;});}return _0xe8c879;})['then'](respondWithResult(_0x1415c6,0xc9))[_0x05a0('0x4b')](handleError(_0x1415c6,null));};exports[_0x05a0('0x2a')]=function(_0x19c965,_0x5b16bb){if(_0x19c965[_0x05a0('0x58')]['id']){delete _0x19c965[_0x05a0('0x58')]['id'];}return db[_0x05a0('0x35')]['find']({'where':{'id':_0x19c965[_0x05a0('0x4c')]['id']}})[_0x05a0('0x2b')](handleEntityNotFound(_0x5b16bb,null))[_0x05a0('0x2b')](saveUpdates(_0x19c965[_0x05a0('0x58')],null))[_0x05a0('0x2b')](respondWithResult(_0x5b16bb,null))[_0x05a0('0x4b')](handleError(_0x5b16bb,null));};exports['destroy']=function(_0x46b126,_0x347b2d){return db[_0x05a0('0x35')][_0x05a0('0x4e')]({'where':{'id':_0x46b126[_0x05a0('0x4c')]['id']}})[_0x05a0('0x2b')](handleEntityNotFound(_0x347b2d,null))[_0x05a0('0x2b')](removeEntity(_0x347b2d,null))['catch'](handleError(_0x347b2d,null));};exports[_0x05a0('0x59')]=function(_0x3560a4,_0x344fa0){return db[_0x05a0('0x35')][_0x05a0('0x59')]()['then'](respondWithResult(_0x344fa0,null))['catch'](handleError(_0x344fa0,null));};exports[_0x05a0('0x5a')]=function(_0x525611,_0x2e8972,_0x230e7a){var _0x1d1cda={'raw':!![],'where':{}},_0x327b24={},_0x3332c9;return db[_0x05a0('0x35')][_0x05a0('0x5b')]({'where':{'id':_0x525611[_0x05a0('0x4c')]['id']}})[_0x05a0('0x2b')](handleEntityNotFound(_0x2e8972,null))[_0x05a0('0x2b')](function(_0x5697ee){if(_0x5697ee){_0x3332c9=_0x5697ee[_0x05a0('0x51')]({'plain':!![]});_0x327b24['model']=_[_0x05a0('0x3a')](db[_0x05a0('0x5c')]['rawAttributes']);_0x327b24[_0x05a0('0x39')]=_[_0x05a0('0x3a')](_0x525611[_0x05a0('0x39')]);_0x327b24[_0x05a0('0x3b')]=_[_0x05a0('0x3c')](_0x327b24['model'],_0x327b24[_0x05a0('0x39')]);_0x1d1cda[_0x05a0('0x3e')]=_['intersection'](_0x327b24[_0x05a0('0x3d')],qs[_0x05a0('0x3f')](_0x525611[_0x05a0('0x39')][_0x05a0('0x3f')]));_0x1d1cda[_0x05a0('0x3e')]=_0x1d1cda[_0x05a0('0x3e')]['length']?_0x1d1cda['attributes']:_0x327b24['model'];if(!_0x525611[_0x05a0('0x39')][_0x05a0('0x5d')](_0x05a0('0x41'))){_0x1d1cda[_0x05a0('0x23')]=qs['limit'](_0x525611[_0x05a0('0x39')][_0x05a0('0x23')]);_0x1d1cda[_0x05a0('0x25')]=qs['offset'](_0x525611[_0x05a0('0x39')][_0x05a0('0x25')]);}_0x1d1cda['order']=qs[_0x05a0('0x43')](_0x525611[_0x05a0('0x39')][_0x05a0('0x43')]);_0x1d1cda[_0x05a0('0x44')]=qs[_0x05a0('0x3b')](_[_0x05a0('0x45')](_0x525611['query'],_0x327b24[_0x05a0('0x3b')]));_0x1d1cda[_0x05a0('0x44')][_0x05a0('0x5e')]=_0x5697ee['id'];if(_0x525611[_0x05a0('0x39')][_0x05a0('0x46')]){_0x1d1cda[_0x05a0('0x44')]=_[_0x05a0('0x47')](_0x1d1cda[_0x05a0('0x44')],{'$or':_[_0x05a0('0x34')](_0x1d1cda[_0x05a0('0x3e')],function(_0x2c8907){var _0x32448c={};_0x32448c[_0x2c8907]={'$like':'%'+_0x525611[_0x05a0('0x39')]['filter']+'%'};return _0x32448c;})});}_0x1d1cda=_[_0x05a0('0x47')]({},_0x1d1cda,_0x525611['options']);return db[_0x05a0('0x5c')][_0x05a0('0x5f')](_0x1d1cda);}})[_0x05a0('0x2b')](function(_0x11c388){if(_0x11c388){return db[_0x05a0('0x60')][_0x05a0('0x61')]({'where':{'id':_['map'](_0x11c388,_0x05a0('0x62')),'role':_0x05a0('0x63')},'attributes':['id',_0x05a0('0x31'),_0x05a0('0x64'),_0x05a0('0x65'),_0x05a0('0x66')]});}})[_0x05a0('0x2b')](function(_0x4ca913){if(_0x4ca913){return{'count':_0x4ca913[_0x05a0('0x24')],'rows':_[_0x05a0('0x34')](_0x4ca913['rows'],function(_0x579e13){return{'membername':_0x579e13[_0x05a0('0x31')],'UserId':_0x579e13['id'],'queue_name':_0x3332c9[_0x05a0('0x31')],'OpenchannelQueueId':_0x3332c9['id'],'interface':util[_0x05a0('0x67')](_0x05a0('0x68'),_0x05a0('0x69'),_0x579e13[_0x05a0('0x31')]),'penalty':0x0,'paused':_0x579e13['openchannelPause'],'createdAt':_0x579e13[_0x05a0('0x66')],'updatedAt':_0x579e13[_0x05a0('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x05a0('0x2b')](respondWithFilteredResult(_0x2e8972,_0x1d1cda))[_0x05a0('0x4b')](handleError(_0x2e8972,null));};exports[_0x05a0('0x6a')]=function(_0xa2ee9f,_0x16ee3e,_0x5f712c){var _0xab4736={};var _0x56868a={};var _0x11052d;var _0x32b9e5;return db['OpenchannelQueue'][_0x05a0('0x5b')]({'where':{'id':_0xa2ee9f[_0x05a0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x16ee3e,null))[_0x05a0('0x2b')](function(_0x4926d7){if(_0x4926d7){_0x11052d=_0x4926d7;_0x56868a[_0x05a0('0x3d')]=_[_0x05a0('0x3a')](db[_0x05a0('0x6b')][_0x05a0('0x36')]);_0x56868a[_0x05a0('0x39')]=_['keys'](_0xa2ee9f[_0x05a0('0x39')]);_0x56868a[_0x05a0('0x3b')]=_[_0x05a0('0x3c')](_0x56868a[_0x05a0('0x3d')],_0x56868a[_0x05a0('0x39')]);_0xab4736[_0x05a0('0x3e')]=_[_0x05a0('0x3c')](_0x56868a[_0x05a0('0x3d')],qs[_0x05a0('0x3f')](_0xa2ee9f['query']['fields']));_0xab4736[_0x05a0('0x3e')]=_0xab4736['attributes']['length']?_0xab4736['attributes']:_0x56868a[_0x05a0('0x3d')];_0xab4736['order']=qs[_0x05a0('0x43')](_0xa2ee9f['query']['sort']);_0xab4736[_0x05a0('0x44')]=qs[_0x05a0('0x3b')](_[_0x05a0('0x45')](_0xa2ee9f[_0x05a0('0x39')],_0x56868a[_0x05a0('0x3b')]));if(_0xa2ee9f[_0x05a0('0x39')][_0x05a0('0x46')]){_0xab4736[_0x05a0('0x44')]=_[_0x05a0('0x47')](_0xab4736[_0x05a0('0x44')],{'$or':_['map'](_0xab4736[_0x05a0('0x3e')],function(_0x4cccb5){var _0x5177f5={};_0x5177f5[_0x4cccb5]={'$like':'%'+_0xa2ee9f[_0x05a0('0x39')][_0x05a0('0x46')]+'%'};return _0x5177f5;})});}_0xab4736=_['merge']({},_0xab4736,_0xa2ee9f['options']);return _0x11052d[_0x05a0('0x6a')](_0xab4736);}})[_0x05a0('0x2b')](function(_0x389049){if(_0x389049){_0x32b9e5=_0x389049[_0x05a0('0x40')];if(!_0xa2ee9f[_0x05a0('0x39')][_0x05a0('0x5d')](_0x05a0('0x41'))){_0xab4736[_0x05a0('0x23')]=qs[_0x05a0('0x23')](_0xa2ee9f[_0x05a0('0x39')][_0x05a0('0x23')]);_0xab4736[_0x05a0('0x25')]=qs['offset'](_0xa2ee9f['query'][_0x05a0('0x25')]);}return _0x11052d[_0x05a0('0x6a')](_0xab4736);}})[_0x05a0('0x2b')](function(_0x2f442c){if(_0x2f442c){return _0x2f442c?{'count':_0x32b9e5,'rows':_0x2f442c}:null;}})[_0x05a0('0x2b')](respondWithResult(_0x16ee3e,null))[_0x05a0('0x4b')](handleError(_0x16ee3e,null));};exports[_0x05a0('0x6c')]=function(_0x207b82,_0x437bc3,_0x5205da){var _0x22e997=_0x207b82[_0x05a0('0x58')][_0x05a0('0x6d')];return db[_0x05a0('0x6b')][_0x05a0('0x5f')]({'where':{'id':_0x22e997},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x05a0('0x31'),_0x05a0('0x6e'),_0x05a0('0x6f'),'interface'],'raw':!![]}]})['then'](function(_0x4619ce){if(_0x4619ce){var _0x5bd1cd=_[_0x05a0('0x70')](_0x4619ce,function(_0xa167db){var _0x352e07=_0xa167db[_0x05a0('0x51')]({'plain':!![]});return _0x352e07[_0x05a0('0x71')];});return db[_0x05a0('0x35')][_0x05a0('0x4e')]({'where':{'id':_0x207b82[_0x05a0('0x4c')]['id']}})['then'](function(_0x265c15){return db[_0x05a0('0x72')][_0x05a0('0x73')](function(_0x32ab54){return _0x265c15[_0x05a0('0x6c')](_0x22e997,{'transaction':_0x32ab54})[_0x05a0('0x2b')](function(){return BPromise[_0x05a0('0x74')](_0x5bd1cd,function(_0x1c96a5){return db[_0x05a0('0x5c')][_0x05a0('0x75')]({'where':{'UserId':_0x1c96a5['id'],'OpenchannelQueueId':_0x207b82[_0x05a0('0x4c')]['id']},'transaction':_0x32ab54});});})[_0x05a0('0x2b')](function(){_0x5bd1cd[_0x05a0('0x76')](function(_0x54cac1){socket['emit'](_0x05a0('0x77'),{'UserId':_0x54cac1['id'],'OpenchannelQueueId':_0x265c15['id']});});});});});}})[_0x05a0('0x2b')](respondWithStatusCode(_0x437bc3,null))[_0x05a0('0x4b')](handleError(_0x437bc3,null));};exports['removeTeams']=function(_0x1c9973,_0xe85ac0,_0x50a2e4){return db[_0x05a0('0x6b')][_0x05a0('0x5f')]({'where':{'id':_0x1c9973[_0x05a0('0x39')][_0x05a0('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x05a0('0x60')],'as':_0x05a0('0x71'),'attributes':['id'],'raw':!![]}]})[_0x05a0('0x2b')](handleEntityNotFound(_0xe85ac0,null))[_0x05a0('0x2b')](function(_0x3d52e7){var _0x44e8d1=_[_0x05a0('0x34')](_0x3d52e7,'id');var _0x3e3f5c=[];var _0x36b9dd=[];var _0x29c7cc=squel[_0x05a0('0x78')]();_0x29c7cc[_0x05a0('0x79')](_0x05a0('0x7a'))[_0x05a0('0x7b')](_0x05a0('0x7c'),'tq')[_0x05a0('0x7d')](_0x05a0('0x7e'),'ut',_0x05a0('0x7f'))[_0x05a0('0x44')](_0x05a0('0x80'),_0x1c9973['params']['id']);for(var _0x104171=0x0;_0x104171<_0x3d52e7['length'];_0x104171+=0x1){let _0x20efdb=_0x3d52e7[_0x104171];for(var _0x2d4a3b=0x0;_0x2d4a3b<_0x20efdb[_0x05a0('0x71')]['length'];_0x2d4a3b+=0x1){let _0x342739=_0x20efdb[_0x05a0('0x71')][_0x2d4a3b];var _0x522426=_0x29c7cc[_0x05a0('0x81')]();_0x522426[_0x05a0('0x44')]('ut.UserId\x20=\x20?',_0x342739['id']);_0x36b9dd[_0x05a0('0x82')](db[_0x05a0('0x72')]['query'](_0x522426[_0x05a0('0x83')](),{'type':db[_0x05a0('0x72')][_0x05a0('0x84')]['SELECT']})[_0x05a0('0x2b')](function(_0x40b15b){if(_0x40b15b[_0x05a0('0x40')]===0x1){return _0x342739['id'];}else{var _0x4b63c2=_[_0x05a0('0x85')](_['map'](_0x40b15b,_0x05a0('0x86')),function(_0x21f4dc){return _[_0x05a0('0x87')](_0x44e8d1,_0x21f4dc);});if(_0x4b63c2){return _0x342739['id'];}}}));}}return BPromise[_0x05a0('0x88')](_0x36b9dd)['then'](function(_0x16e984){_0x3e3f5c=_(_0x3e3f5c)[_0x05a0('0x89')](_0x16e984)[_0x05a0('0x8a')]()[_0x05a0('0x8b')]();return db[_0x05a0('0x35')][_0x05a0('0x4e')]({'where':{'id':_0x1c9973[_0x05a0('0x4c')]['id']}})[_0x05a0('0x2b')](function(_0x3cac01){return db[_0x05a0('0x72')][_0x05a0('0x73')](function(_0x7394e6){return _0x3cac01[_0x05a0('0x8c')](_0x1c9973[_0x05a0('0x39')][_0x05a0('0x6d')],{'transaction':_0x7394e6})[_0x05a0('0x2b')](function(){if(!_['isEmpty'](_0x3e3f5c)){return _0x3cac01[_0x05a0('0x8d')](_0x3e3f5c,{'transaction':_0x7394e6});}})['then'](function(){_0x3e3f5c['forEach'](function(_0xd023fe){socket['emit'](_0x05a0('0x8e'),{'UserId':_0xd023fe,'OpenchannelQueueId':_0x3cac01['id']});});});});});});})[_0x05a0('0x2b')](respondWithStatusCode(_0xe85ac0,null))[_0x05a0('0x4b')](handleError(_0xe85ac0,null));};exports[_0x05a0('0x8f')]=function(_0x5b518a,_0x2c32eb,_0x3a7fac){return db[_0x05a0('0x35')][_0x05a0('0x4e')]({'where':{'id':_0x5b518a[_0x05a0('0x4c')]['id']}})[_0x05a0('0x2b')](handleEntityNotFound(_0x2c32eb,null))[_0x05a0('0x2b')](function(_0x14449e){if(_0x14449e){return _0x14449e[_0x05a0('0x8f')](_0x5b518a[_0x05a0('0x58')]['ids'],_[_0x05a0('0x90')](_0x5b518a[_0x05a0('0x58')],[_0x05a0('0x6d'),'id'])||{})[_0x05a0('0x91')](function(_0x3430b4){for(var _0x3300d1=0x0;_0x3300d1<_0x5b518a[_0x05a0('0x58')]['ids'][_0x05a0('0x40')];_0x3300d1+=0x1){socket[_0x05a0('0x92')](_0x05a0('0x77'),{'UserId':Number(_0x5b518a[_0x05a0('0x58')][_0x05a0('0x6d')][_0x3300d1]),'OpenchannelQueueId':Number(_0x5b518a[_0x05a0('0x4c')]['id'])});}return _0x3430b4;});}})['then'](respondWithResult(_0x2c32eb,null))[_0x05a0('0x4b')](handleError(_0x2c32eb,null));};exports[_0x05a0('0x8d')]=function(_0x2f988e,_0x35420d,_0x29b7cc){return db[_0x05a0('0x35')]['find']({'where':{'id':_0x2f988e[_0x05a0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x35420d,null))['then'](function(_0x4fc447){if(_0x4fc447){return _0x4fc447['removeAgents'](_0x2f988e[_0x05a0('0x39')][_0x05a0('0x6d')])[_0x05a0('0x2b')](function(){if(_['isArray'](_0x2f988e[_0x05a0('0x39')]['ids'])){for(var _0x34b926=0x0;_0x34b926<_0x2f988e[_0x05a0('0x39')][_0x05a0('0x6d')][_0x05a0('0x40')];_0x34b926+=0x1){socket[_0x05a0('0x92')]('userOpenchannelQueue:remove',{'UserId':Number(_0x2f988e['query'][_0x05a0('0x6d')][_0x34b926]),'OpenchannelQueueId':Number(_0x2f988e['params']['id'])});}}else{socket[_0x05a0('0x92')](_0x05a0('0x8e'),{'UserId':Number(_0x2f988e[_0x05a0('0x39')][_0x05a0('0x6d')]),'OpenchannelQueueId':Number(_0x2f988e[_0x05a0('0x4c')]['id'])});}});}})[_0x05a0('0x2b')](respondWithStatusCode(_0x35420d,null))['catch'](handleError(_0x35420d,null));};exports[_0x05a0('0x93')]=function(_0x1e00c6,_0x28762f,_0x1430ce){var _0x4c3c61={};var _0x1db535={};var _0xce216e;var _0x283afd;return db['OpenchannelQueue'][_0x05a0('0x5b')]({'where':{'id':_0x1e00c6['params']['id']}})['then'](handleEntityNotFound(_0x28762f,null))[_0x05a0('0x2b')](function(_0x2edeee){if(_0x2edeee){_0xce216e=_0x2edeee;_0x1db535[_0x05a0('0x3d')]=_['keys'](db[_0x05a0('0x60')][_0x05a0('0x36')]);_0x1db535[_0x05a0('0x39')]=_[_0x05a0('0x3a')](_0x1e00c6[_0x05a0('0x39')]);_0x1db535[_0x05a0('0x3b')]=_[_0x05a0('0x3c')](_0x1db535['model'],_0x1db535[_0x05a0('0x39')]);_0x4c3c61[_0x05a0('0x3e')]=_[_0x05a0('0x3c')](_0x1db535[_0x05a0('0x3d')],qs[_0x05a0('0x3f')](_0x1e00c6[_0x05a0('0x39')][_0x05a0('0x3f')]));_0x4c3c61[_0x05a0('0x3e')]=_0x4c3c61[_0x05a0('0x3e')][_0x05a0('0x40')]?_0x4c3c61[_0x05a0('0x3e')]:_0x1db535[_0x05a0('0x3d')];_0x4c3c61[_0x05a0('0x42')]=qs['sort'](_0x1e00c6['query'][_0x05a0('0x43')]);_0x4c3c61['where']=qs[_0x05a0('0x3b')](_[_0x05a0('0x45')](_0x1e00c6[_0x05a0('0x39')],_0x1db535[_0x05a0('0x3b')]));if(_0x1e00c6[_0x05a0('0x39')][_0x05a0('0x46')]){_0x4c3c61[_0x05a0('0x44')]=_['merge'](_0x4c3c61[_0x05a0('0x44')],{'$or':_[_0x05a0('0x34')](_0x4c3c61[_0x05a0('0x3e')],function(_0x557451){var _0x762a70={};_0x762a70[_0x557451]={'$like':'%'+_0x1e00c6['query'][_0x05a0('0x46')]+'%'};return _0x762a70;})});}_0x4c3c61=_['merge']({},_0x4c3c61,_0x1e00c6[_0x05a0('0x4d')]);return _0xce216e[_0x05a0('0x93')](_0x4c3c61);}})[_0x05a0('0x2b')](function(_0x3c5434){if(_0x3c5434){_0x283afd=_0x3c5434[_0x05a0('0x40')];if(!_0x1e00c6[_0x05a0('0x39')][_0x05a0('0x5d')](_0x05a0('0x41'))){_0x4c3c61[_0x05a0('0x23')]=qs[_0x05a0('0x23')](_0x1e00c6[_0x05a0('0x39')][_0x05a0('0x23')]);_0x4c3c61[_0x05a0('0x25')]=qs[_0x05a0('0x25')](_0x1e00c6[_0x05a0('0x39')][_0x05a0('0x25')]);}return _0xce216e[_0x05a0('0x93')](_0x4c3c61);}})[_0x05a0('0x2b')](function(_0x468134){if(_0x468134){return _0x468134?{'count':_0x283afd,'rows':_0x468134}:null;}})[_0x05a0('0x2b')](respondWithResult(_0x28762f,null))[_0x05a0('0x4b')](handleError(_0x28762f,null));}; \ No newline at end of file +var _0xcd38=['findOrCreate','emit','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','value','removeAgents','forEach','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','get','UserProfileResource','error','stack','name','send','map','OpenchannelQueue','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','length','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelQueues','UserProfileSection','find','autoAssociation','destroy','describe','getMembers','UserOpenchannelQueue','order','User','UserId','agent','createdAt','format','%s/%s','SIP','openchannelPause','updatedAt','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xcd38,0xa3));var _0x8cd3=function(_0xf81e7c,_0x232e70){_0xf81e7c=_0xf81e7c-0x0;var _0x5547ed=_0xcd38[_0xf81e7c];return _0x5547ed;};'use strict';var emlformat=require(_0x8cd3('0x0'));var rimraf=require(_0x8cd3('0x1'));var zipdir=require(_0x8cd3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8cd3('0x3'));var moment=require('moment');var BPromise=require(_0x8cd3('0x4'));var Mustache=require(_0x8cd3('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8cd3('0x6'));var ejs=require(_0x8cd3('0x7'));var fs=require('fs');var fs_extra=require(_0x8cd3('0x8'));var _=require('lodash');var squel=require(_0x8cd3('0x9'));var crypto=require(_0x8cd3('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8cd3('0xb'));var toCsv=require(_0x8cd3('0x6'));var querystring=require('querystring');var Papa=require(_0x8cd3('0xc'));var Redis=require('ioredis');var authService=require(_0x8cd3('0xd'));var qs=require(_0x8cd3('0xe'));var as=require(_0x8cd3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8cd3('0x10'))(_0x8cd3('0x11'));var utils=require('../../config/utils');var config=require(_0x8cd3('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8cd3('0x13')]=_[_0x8cd3('0x14')](config['redis'],{'host':_0x8cd3('0x15'),'port':0x18eb});var socket=require(_0x8cd3('0x16'))(new Redis(config[_0x8cd3('0x13')]));require(_0x8cd3('0x17'))[_0x8cd3('0x18')](socket);function respondWithStatusCode(_0x2663f7,_0x2273bd){_0x2273bd=_0x2273bd||0xcc;return function(_0x1f9671){if(_0x1f9671){return _0x2663f7[_0x8cd3('0x19')](_0x2273bd);}return _0x2663f7[_0x8cd3('0x1a')](_0x2273bd)[_0x8cd3('0x1b')]();};}function respondWithResult(_0x2ba4d8,_0x4c6b08){_0x4c6b08=_0x4c6b08||0xc8;return function(_0x1b2232){if(_0x1b2232){return _0x2ba4d8[_0x8cd3('0x1a')](_0x4c6b08)[_0x8cd3('0x1c')](_0x1b2232);}};}function respondWithFilteredResult(_0x5fb218,_0x3ca5c3){return function(_0x3004b9){if(_0x3004b9){var _0x50e0d9=typeof _0x3ca5c3['offset']===_0x8cd3('0x1d')&&typeof _0x3ca5c3[_0x8cd3('0x1e')]===_0x8cd3('0x1d');var _0x249fa3=_0x3004b9[_0x8cd3('0x1f')];var _0x4eb7d2=_0x50e0d9?0x0:_0x3ca5c3[_0x8cd3('0x20')];var _0x42c30a=_0x50e0d9?_0x3004b9[_0x8cd3('0x1f')]:_0x3ca5c3[_0x8cd3('0x20')]+_0x3ca5c3[_0x8cd3('0x1e')];var _0x4d8e32;if(_0x42c30a>=_0x249fa3){_0x42c30a=_0x249fa3;_0x4d8e32=0xc8;}else{_0x4d8e32=0xce;}_0x5fb218[_0x8cd3('0x1a')](_0x4d8e32);return _0x5fb218[_0x8cd3('0x21')](_0x8cd3('0x22'),_0x4eb7d2+'-'+_0x42c30a+'/'+_0x249fa3)[_0x8cd3('0x1c')](_0x3004b9);}return null;};}function patchUpdates(_0x5b4477){return function(_0x4dd970){try{jsonpatch[_0x8cd3('0x23')](_0x4dd970,_0x5b4477,!![]);}catch(_0x24f99e){return BPromise[_0x8cd3('0x24')](_0x24f99e);}return _0x4dd970['save']();};}function saveUpdates(_0x2954a8,_0x3f57a6){return function(_0x30451c){if(_0x30451c){return _0x30451c[_0x8cd3('0x25')](_0x2954a8)[_0x8cd3('0x26')](function(_0x2d65da){return _0x2d65da;});}return null;};}function removeEntity(_0x2ad3c7,_0x2b18d0){return function(_0x1decb3){if(_0x1decb3){return _0x1decb3['destroy']()[_0x8cd3('0x26')](function(){var _0x51c936=_0x1decb3[_0x8cd3('0x27')]({'plain':!![]});var _0x4a21e6='OpenchannelQueues';return db[_0x8cd3('0x28')]['destroy']({'where':{'type':_0x4a21e6,'resourceId':_0x51c936['id']}})[_0x8cd3('0x26')](function(){return _0x1decb3;});})['then'](function(){_0x2ad3c7['status'](0xcc)[_0x8cd3('0x1b')]();});}};}function handleEntityNotFound(_0x42848c,_0x316345){return function(_0x2d028c){if(!_0x2d028c){_0x42848c[_0x8cd3('0x19')](0x194);}return _0x2d028c;};}function handleError(_0x460df7,_0x33e356){_0x33e356=_0x33e356||0x1f4;return function(_0x22dde2){logger[_0x8cd3('0x29')](_0x22dde2[_0x8cd3('0x2a')]);if(_0x22dde2[_0x8cd3('0x2b')]){delete _0x22dde2['name'];}_0x460df7[_0x8cd3('0x1a')](_0x33e356)[_0x8cd3('0x2c')](_0x22dde2);};}exports['index']=function(_0xef9679,_0x36d6b6){var _0x4e5910={},_0x46e573={},_0x367b9b={'count':0x0,'rows':[]};var _0x27e169=_[_0x8cd3('0x2d')](db[_0x8cd3('0x2e')][_0x8cd3('0x2f')],function(_0x156020){return{'name':_0x156020[_0x8cd3('0x30')],'type':_0x156020[_0x8cd3('0x31')]['key']};});_0x46e573[_0x8cd3('0x32')]=_['map'](_0x27e169,'name');_0x46e573[_0x8cd3('0x33')]=_['keys'](_0xef9679['query']);_0x46e573[_0x8cd3('0x34')]=_[_0x8cd3('0x35')](_0x46e573['model'],_0x46e573[_0x8cd3('0x33')]);_0x4e5910[_0x8cd3('0x36')]=_[_0x8cd3('0x35')](_0x46e573[_0x8cd3('0x32')],qs[_0x8cd3('0x37')](_0xef9679['query'][_0x8cd3('0x37')]));_0x4e5910['attributes']=_0x4e5910[_0x8cd3('0x36')]['length']?_0x4e5910[_0x8cd3('0x36')]:_0x46e573[_0x8cd3('0x32')];if(!_0xef9679[_0x8cd3('0x33')][_0x8cd3('0x38')](_0x8cd3('0x39'))){_0x4e5910[_0x8cd3('0x1e')]=qs[_0x8cd3('0x1e')](_0xef9679['query'][_0x8cd3('0x1e')]);_0x4e5910[_0x8cd3('0x20')]=qs[_0x8cd3('0x20')](_0xef9679['query'][_0x8cd3('0x20')]);}_0x4e5910['order']=qs[_0x8cd3('0x3a')](_0xef9679[_0x8cd3('0x33')][_0x8cd3('0x3a')]);_0x4e5910[_0x8cd3('0x3b')]=qs['filters'](_[_0x8cd3('0x3c')](_0xef9679[_0x8cd3('0x33')],_0x46e573[_0x8cd3('0x34')]),_0x27e169);if(_0xef9679[_0x8cd3('0x33')]['filter']){_0x4e5910[_0x8cd3('0x3b')]=_['merge'](_0x4e5910[_0x8cd3('0x3b')],{'$or':_[_0x8cd3('0x2d')](_0x27e169,function(_0x2246ba){if(_0x2246ba[_0x8cd3('0x31')]!==_0x8cd3('0x3d')){var _0x4bfc31={};_0x4bfc31[_0x2246ba[_0x8cd3('0x2b')]]={'$like':'%'+_0xef9679['query'][_0x8cd3('0x3e')]+'%'};return _0x4bfc31;}})});}_0x4e5910=_[_0x8cd3('0x3f')]({},_0x4e5910,_0xef9679[_0x8cd3('0x40')]);var _0x56d8dc={'where':_0x4e5910['where']};return db[_0x8cd3('0x2e')][_0x8cd3('0x1f')](_0x56d8dc)[_0x8cd3('0x26')](function(_0x1f5112){_0x367b9b[_0x8cd3('0x1f')]=_0x1f5112;if(_0xef9679[_0x8cd3('0x33')][_0x8cd3('0x41')]){_0x4e5910[_0x8cd3('0x42')]=[{'all':!![]}];}return db[_0x8cd3('0x2e')][_0x8cd3('0x43')](_0x4e5910);})[_0x8cd3('0x26')](function(_0x4ac7a2){_0x367b9b[_0x8cd3('0x44')]=_0x4ac7a2;return _0x367b9b;})['then'](respondWithFilteredResult(_0x36d6b6,_0x4e5910))['catch'](handleError(_0x36d6b6,null));};exports[_0x8cd3('0x45')]=function(_0x102a36,_0x22eab8){var _0x4e3672={'raw':!![],'where':{'id':_0x102a36[_0x8cd3('0x46')]['id']}},_0x1f26c1={};_0x1f26c1[_0x8cd3('0x32')]=_[_0x8cd3('0x47')](db[_0x8cd3('0x2e')][_0x8cd3('0x2f')]);_0x1f26c1[_0x8cd3('0x33')]=_[_0x8cd3('0x47')](_0x102a36['query']);_0x1f26c1[_0x8cd3('0x34')]=_[_0x8cd3('0x35')](_0x1f26c1[_0x8cd3('0x32')],_0x1f26c1[_0x8cd3('0x33')]);_0x4e3672[_0x8cd3('0x36')]=_[_0x8cd3('0x35')](_0x1f26c1['model'],qs[_0x8cd3('0x37')](_0x102a36['query']['fields']));_0x4e3672[_0x8cd3('0x36')]=_0x4e3672[_0x8cd3('0x36')][_0x8cd3('0x48')]?_0x4e3672[_0x8cd3('0x36')]:_0x1f26c1[_0x8cd3('0x32')];if(_0x102a36['query'][_0x8cd3('0x41')]){_0x4e3672[_0x8cd3('0x42')]=[{'all':!![]}];}_0x4e3672=_[_0x8cd3('0x3f')]({},_0x4e3672,_0x102a36[_0x8cd3('0x40')]);return db[_0x8cd3('0x2e')]['find'](_0x4e3672)[_0x8cd3('0x26')](handleEntityNotFound(_0x22eab8,null))[_0x8cd3('0x26')](respondWithResult(_0x22eab8,null))[_0x8cd3('0x49')](handleError(_0x22eab8,null));};exports[_0x8cd3('0x4a')]=function(_0x222472,_0x155d35){return db[_0x8cd3('0x2e')][_0x8cd3('0x4a')](_0x222472[_0x8cd3('0x4b')],{})[_0x8cd3('0x26')](function(_0x46af35){var _0xf3fa99=_0x222472[_0x8cd3('0x4c')]['get']({'plain':!![]});if(!_0xf3fa99)throw new Error(_0x8cd3('0x4d'));if(_0xf3fa99['role']===_0x8cd3('0x4c')){var _0x4d4b27=_0x46af35[_0x8cd3('0x27')]({'plain':!![]});var _0x2c61a3=_0x8cd3('0x4e');return db[_0x8cd3('0x4f')][_0x8cd3('0x50')]({'where':{'name':_0x2c61a3,'userProfileId':_0xf3fa99['userProfileId']},'raw':!![]})[_0x8cd3('0x26')](function(_0x39e4b1){if(_0x39e4b1&&_0x39e4b1[_0x8cd3('0x51')]===0x0){return db['UserProfileResource'][_0x8cd3('0x4a')]({'name':_0x4d4b27[_0x8cd3('0x2b')],'resourceId':_0x4d4b27['id'],'type':_0x39e4b1[_0x8cd3('0x2b')],'sectionId':_0x39e4b1['id']},{})[_0x8cd3('0x26')](function(){return _0x46af35;});}else{return _0x46af35;}})[_0x8cd3('0x49')](function(_0x53f82e){logger[_0x8cd3('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f82e);throw _0x53f82e;});}return _0x46af35;})[_0x8cd3('0x26')](respondWithResult(_0x155d35,0xc9))[_0x8cd3('0x49')](handleError(_0x155d35,null));};exports[_0x8cd3('0x25')]=function(_0x20d9cc,_0x853c7a){if(_0x20d9cc['body']['id']){delete _0x20d9cc[_0x8cd3('0x4b')]['id'];}return db[_0x8cd3('0x2e')][_0x8cd3('0x50')]({'where':{'id':_0x20d9cc[_0x8cd3('0x46')]['id']}})['then'](handleEntityNotFound(_0x853c7a,null))[_0x8cd3('0x26')](saveUpdates(_0x20d9cc[_0x8cd3('0x4b')],null))[_0x8cd3('0x26')](respondWithResult(_0x853c7a,null))[_0x8cd3('0x49')](handleError(_0x853c7a,null));};exports[_0x8cd3('0x52')]=function(_0x25907e,_0x4dd781){return db['OpenchannelQueue'][_0x8cd3('0x50')]({'where':{'id':_0x25907e['params']['id']}})['then'](handleEntityNotFound(_0x4dd781,null))[_0x8cd3('0x26')](removeEntity(_0x4dd781,null))['catch'](handleError(_0x4dd781,null));};exports[_0x8cd3('0x53')]=function(_0x840af6,_0x336a85){return db[_0x8cd3('0x2e')][_0x8cd3('0x53')]()[_0x8cd3('0x26')](respondWithResult(_0x336a85,null))[_0x8cd3('0x49')](handleError(_0x336a85,null));};exports[_0x8cd3('0x54')]=function(_0x5e5d55,_0x4c53bb,_0x187f2f){var _0x36875d={'raw':!![],'where':{}},_0x30e4e0={},_0xe2174f;return db[_0x8cd3('0x2e')]['findOne']({'where':{'id':_0x5e5d55[_0x8cd3('0x46')]['id']}})['then'](handleEntityNotFound(_0x4c53bb,null))['then'](function(_0x14ff25){if(_0x14ff25){_0xe2174f=_0x14ff25[_0x8cd3('0x27')]({'plain':!![]});_0x30e4e0[_0x8cd3('0x32')]=_[_0x8cd3('0x47')](db[_0x8cd3('0x55')]['rawAttributes']);_0x30e4e0['query']=_[_0x8cd3('0x47')](_0x5e5d55[_0x8cd3('0x33')]);_0x30e4e0[_0x8cd3('0x34')]=_[_0x8cd3('0x35')](_0x30e4e0[_0x8cd3('0x32')],_0x30e4e0[_0x8cd3('0x33')]);_0x36875d[_0x8cd3('0x36')]=_[_0x8cd3('0x35')](_0x30e4e0[_0x8cd3('0x32')],qs[_0x8cd3('0x37')](_0x5e5d55[_0x8cd3('0x33')][_0x8cd3('0x37')]));_0x36875d['attributes']=_0x36875d[_0x8cd3('0x36')]['length']?_0x36875d[_0x8cd3('0x36')]:_0x30e4e0[_0x8cd3('0x32')];if(!_0x5e5d55[_0x8cd3('0x33')]['hasOwnProperty'](_0x8cd3('0x39'))){_0x36875d[_0x8cd3('0x1e')]=qs[_0x8cd3('0x1e')](_0x5e5d55[_0x8cd3('0x33')][_0x8cd3('0x1e')]);_0x36875d[_0x8cd3('0x20')]=qs[_0x8cd3('0x20')](_0x5e5d55[_0x8cd3('0x33')][_0x8cd3('0x20')]);}_0x36875d[_0x8cd3('0x56')]=qs['sort'](_0x5e5d55['query'][_0x8cd3('0x3a')]);_0x36875d[_0x8cd3('0x3b')]=qs[_0x8cd3('0x34')](_[_0x8cd3('0x3c')](_0x5e5d55[_0x8cd3('0x33')],_0x30e4e0[_0x8cd3('0x34')]));_0x36875d[_0x8cd3('0x3b')]['OpenchannelQueueId']=_0x14ff25['id'];if(_0x5e5d55[_0x8cd3('0x33')][_0x8cd3('0x3e')]){_0x36875d[_0x8cd3('0x3b')]=_[_0x8cd3('0x3f')](_0x36875d['where'],{'$or':_[_0x8cd3('0x2d')](_0x36875d[_0x8cd3('0x36')],function(_0x2453f0){var _0x397209={};_0x397209[_0x2453f0]={'$like':'%'+_0x5e5d55['query']['filter']+'%'};return _0x397209;})});}_0x36875d=_[_0x8cd3('0x3f')]({},_0x36875d,_0x5e5d55[_0x8cd3('0x40')]);return db[_0x8cd3('0x55')][_0x8cd3('0x43')](_0x36875d);}})['then'](function(_0x16cc21){if(_0x16cc21){return db[_0x8cd3('0x57')]['findAndCountAll']({'where':{'id':_[_0x8cd3('0x2d')](_0x16cc21,_0x8cd3('0x58')),'role':_0x8cd3('0x59')},'attributes':['id',_0x8cd3('0x2b'),'openchannelPause','updatedAt',_0x8cd3('0x5a')]});}})[_0x8cd3('0x26')](function(_0x4c7312){if(_0x4c7312){return{'count':_0x4c7312[_0x8cd3('0x1f')],'rows':_['map'](_0x4c7312[_0x8cd3('0x44')],function(_0x1e1f83){return{'membername':_0x1e1f83['name'],'UserId':_0x1e1f83['id'],'queue_name':_0xe2174f[_0x8cd3('0x2b')],'OpenchannelQueueId':_0xe2174f['id'],'interface':util[_0x8cd3('0x5b')](_0x8cd3('0x5c'),_0x8cd3('0x5d'),_0x1e1f83[_0x8cd3('0x2b')]),'penalty':0x0,'paused':_0x1e1f83[_0x8cd3('0x5e')],'createdAt':_0x1e1f83[_0x8cd3('0x5a')],'updatedAt':_0x1e1f83[_0x8cd3('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8cd3('0x26')](respondWithFilteredResult(_0x4c53bb,_0x36875d))[_0x8cd3('0x49')](handleError(_0x4c53bb,null));};exports[_0x8cd3('0x60')]=function(_0x4dfedd,_0x162eea,_0x492afc){var _0x51c1b2={};var _0x1fccd8={};var _0x1b6458;var _0x20e90b;return db[_0x8cd3('0x2e')][_0x8cd3('0x61')]({'where':{'id':_0x4dfedd['params']['id']}})[_0x8cd3('0x26')](handleEntityNotFound(_0x162eea,null))[_0x8cd3('0x26')](function(_0x166799){if(_0x166799){_0x1b6458=_0x166799;_0x1fccd8['model']=_['keys'](db[_0x8cd3('0x62')][_0x8cd3('0x2f')]);_0x1fccd8[_0x8cd3('0x33')]=_[_0x8cd3('0x47')](_0x4dfedd[_0x8cd3('0x33')]);_0x1fccd8[_0x8cd3('0x34')]=_[_0x8cd3('0x35')](_0x1fccd8['model'],_0x1fccd8[_0x8cd3('0x33')]);_0x51c1b2[_0x8cd3('0x36')]=_[_0x8cd3('0x35')](_0x1fccd8[_0x8cd3('0x32')],qs[_0x8cd3('0x37')](_0x4dfedd[_0x8cd3('0x33')][_0x8cd3('0x37')]));_0x51c1b2[_0x8cd3('0x36')]=_0x51c1b2[_0x8cd3('0x36')][_0x8cd3('0x48')]?_0x51c1b2[_0x8cd3('0x36')]:_0x1fccd8['model'];_0x51c1b2[_0x8cd3('0x56')]=qs[_0x8cd3('0x3a')](_0x4dfedd['query'][_0x8cd3('0x3a')]);_0x51c1b2[_0x8cd3('0x3b')]=qs[_0x8cd3('0x34')](_[_0x8cd3('0x3c')](_0x4dfedd[_0x8cd3('0x33')],_0x1fccd8['filters']));if(_0x4dfedd['query']['filter']){_0x51c1b2['where']=_[_0x8cd3('0x3f')](_0x51c1b2[_0x8cd3('0x3b')],{'$or':_[_0x8cd3('0x2d')](_0x51c1b2[_0x8cd3('0x36')],function(_0x32a791){var _0x3ff010={};_0x3ff010[_0x32a791]={'$like':'%'+_0x4dfedd['query'][_0x8cd3('0x3e')]+'%'};return _0x3ff010;})});}_0x51c1b2=_[_0x8cd3('0x3f')]({},_0x51c1b2,_0x4dfedd['options']);return _0x1b6458['getTeams'](_0x51c1b2);}})[_0x8cd3('0x26')](function(_0x37f517){if(_0x37f517){_0x20e90b=_0x37f517[_0x8cd3('0x48')];if(!_0x4dfedd['query'][_0x8cd3('0x38')]('nolimit')){_0x51c1b2['limit']=qs[_0x8cd3('0x1e')](_0x4dfedd['query']['limit']);_0x51c1b2[_0x8cd3('0x20')]=qs[_0x8cd3('0x20')](_0x4dfedd[_0x8cd3('0x33')][_0x8cd3('0x20')]);}return _0x1b6458['getTeams'](_0x51c1b2);}})['then'](function(_0x32f195){if(_0x32f195){return _0x32f195?{'count':_0x20e90b,'rows':_0x32f195}:null;}})[_0x8cd3('0x26')](respondWithResult(_0x162eea,null))[_0x8cd3('0x49')](handleError(_0x162eea,null));};exports[_0x8cd3('0x63')]=function(_0x168bfd,_0x13dad1,_0x134673){var _0x138835=_0x168bfd[_0x8cd3('0x4b')][_0x8cd3('0x64')];return db['Team'][_0x8cd3('0x43')]({'where':{'id':_0x138835},'attributes':['id'],'include':[{'model':db[_0x8cd3('0x57')],'as':_0x8cd3('0x65'),'attributes':['id',_0x8cd3('0x2b'),_0x8cd3('0x66'),_0x8cd3('0x67'),_0x8cd3('0x68')],'raw':!![]}]})[_0x8cd3('0x26')](function(_0x44d265){if(_0x44d265){var _0x56cea8=_[_0x8cd3('0x69')](_0x44d265,function(_0x45f0cd){var _0x4fea78=_0x45f0cd[_0x8cd3('0x27')]({'plain':!![]});return _0x4fea78[_0x8cd3('0x65')];});return db[_0x8cd3('0x2e')]['find']({'where':{'id':_0x168bfd[_0x8cd3('0x46')]['id']}})[_0x8cd3('0x26')](function(_0x17302c){return db[_0x8cd3('0x6a')][_0x8cd3('0x6b')](function(_0x2bf27e){return _0x17302c['addTeams'](_0x138835,{'transaction':_0x2bf27e})[_0x8cd3('0x26')](function(){return BPromise[_0x8cd3('0x6c')](_0x56cea8,function(_0x27ab1a){return db[_0x8cd3('0x55')][_0x8cd3('0x6d')]({'where':{'UserId':_0x27ab1a['id'],'OpenchannelQueueId':_0x168bfd['params']['id']},'transaction':_0x2bf27e});});})['then'](function(){_0x56cea8['forEach'](function(_0x58d102){socket[_0x8cd3('0x6e')](_0x8cd3('0x6f'),{'UserId':_0x58d102['id'],'OpenchannelQueueId':_0x17302c['id']});});});});});}})[_0x8cd3('0x26')](respondWithStatusCode(_0x13dad1,null))[_0x8cd3('0x49')](handleError(_0x13dad1,null));};exports[_0x8cd3('0x70')]=function(_0x42afcd,_0x5b34ca,_0xde3f78){return db['Team'][_0x8cd3('0x43')]({'where':{'id':_0x42afcd['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x8cd3('0x57')],'as':_0x8cd3('0x65'),'attributes':['id'],'raw':!![]}]})[_0x8cd3('0x26')](handleEntityNotFound(_0x5b34ca,null))[_0x8cd3('0x26')](function(_0x44cbec){var _0x497b6b=_[_0x8cd3('0x2d')](_0x44cbec,'id');var _0xf5eb57=[];var _0xe8c8eb=[];var _0x34bbe8=squel['select']();_0x34bbe8[_0x8cd3('0x71')](_0x8cd3('0x72'))[_0x8cd3('0x73')](_0x8cd3('0x74'),'tq')[_0x8cd3('0x75')]('user_has_teams','ut',_0x8cd3('0x76'))[_0x8cd3('0x3b')](_0x8cd3('0x77'),_0x42afcd[_0x8cd3('0x46')]['id']);for(var _0xbf0cfa=0x0;_0xbf0cfa<_0x44cbec['length'];_0xbf0cfa+=0x1){let _0xdcb04f=_0x44cbec[_0xbf0cfa];for(var _0x49a662=0x0;_0x49a662<_0xdcb04f['Agents']['length'];_0x49a662+=0x1){let _0xf28c2=_0xdcb04f[_0x8cd3('0x65')][_0x49a662];var _0x1c5aef=_0x34bbe8['clone']();_0x1c5aef[_0x8cd3('0x3b')]('ut.UserId\x20=\x20?',_0xf28c2['id']);_0xe8c8eb[_0x8cd3('0x78')](db['sequelize'][_0x8cd3('0x33')](_0x1c5aef[_0x8cd3('0x79')](),{'type':db[_0x8cd3('0x6a')][_0x8cd3('0x7a')][_0x8cd3('0x7b')]})[_0x8cd3('0x26')](function(_0x125725){if(_0x125725[_0x8cd3('0x48')]===0x1){return _0xf28c2['id'];}else{var _0x2ad244=_[_0x8cd3('0x7c')](_[_0x8cd3('0x2d')](_0x125725,_0x8cd3('0x7d')),function(_0x3a4733){return _[_0x8cd3('0x7e')](_0x497b6b,_0x3a4733);});if(_0x2ad244){return _0xf28c2['id'];}}}));}}return BPromise['all'](_0xe8c8eb)[_0x8cd3('0x26')](function(_0x32b8df){_0xf5eb57=_(_0xf5eb57)['union'](_0x32b8df)['compact']()[_0x8cd3('0x7f')]();return db[_0x8cd3('0x2e')][_0x8cd3('0x50')]({'where':{'id':_0x42afcd[_0x8cd3('0x46')]['id']}})[_0x8cd3('0x26')](function(_0x2a5de9){return db['sequelize']['transaction'](function(_0x289d02){return _0x2a5de9[_0x8cd3('0x70')](_0x42afcd[_0x8cd3('0x33')]['ids'],{'transaction':_0x289d02})[_0x8cd3('0x26')](function(){if(!_['isEmpty'](_0xf5eb57)){return _0x2a5de9[_0x8cd3('0x80')](_0xf5eb57,{'transaction':_0x289d02});}})[_0x8cd3('0x26')](function(){_0xf5eb57[_0x8cd3('0x81')](function(_0x593259){socket[_0x8cd3('0x6e')]('userOpenchannelQueue:remove',{'UserId':_0x593259,'OpenchannelQueueId':_0x2a5de9['id']});});});});});});})[_0x8cd3('0x26')](respondWithStatusCode(_0x5b34ca,null))[_0x8cd3('0x49')](handleError(_0x5b34ca,null));};exports['addAgents']=function(_0x44a164,_0x2afe92,_0x2e1007){return db[_0x8cd3('0x2e')][_0x8cd3('0x50')]({'where':{'id':_0x44a164[_0x8cd3('0x46')]['id']}})['then'](handleEntityNotFound(_0x2afe92,null))[_0x8cd3('0x26')](function(_0x534cb5){if(_0x534cb5){return _0x534cb5[_0x8cd3('0x82')](_0x44a164[_0x8cd3('0x4b')][_0x8cd3('0x64')],_[_0x8cd3('0x83')](_0x44a164['body'],['ids','id'])||{})[_0x8cd3('0x84')](function(_0x42c073){for(var _0x590eb0=0x0;_0x590eb0<_0x44a164[_0x8cd3('0x4b')][_0x8cd3('0x64')]['length'];_0x590eb0+=0x1){socket['emit'](_0x8cd3('0x6f'),{'UserId':Number(_0x44a164[_0x8cd3('0x4b')][_0x8cd3('0x64')][_0x590eb0]),'OpenchannelQueueId':Number(_0x44a164[_0x8cd3('0x46')]['id'])});}return _0x42c073;});}})[_0x8cd3('0x26')](respondWithResult(_0x2afe92,null))['catch'](handleError(_0x2afe92,null));};exports['removeAgents']=function(_0x24511b,_0x192aab,_0x148ef8){return db[_0x8cd3('0x2e')][_0x8cd3('0x50')]({'where':{'id':_0x24511b[_0x8cd3('0x46')]['id']}})[_0x8cd3('0x26')](handleEntityNotFound(_0x192aab,null))['then'](function(_0xce1a7){if(_0xce1a7){return _0xce1a7['removeAgents'](_0x24511b[_0x8cd3('0x33')][_0x8cd3('0x64')])['then'](function(){if(_[_0x8cd3('0x85')](_0x24511b[_0x8cd3('0x33')][_0x8cd3('0x64')])){for(var _0x1a1b78=0x0;_0x1a1b78<_0x24511b[_0x8cd3('0x33')][_0x8cd3('0x64')][_0x8cd3('0x48')];_0x1a1b78+=0x1){socket['emit'](_0x8cd3('0x86'),{'UserId':Number(_0x24511b[_0x8cd3('0x33')][_0x8cd3('0x64')][_0x1a1b78]),'OpenchannelQueueId':Number(_0x24511b[_0x8cd3('0x46')]['id'])});}}else{socket[_0x8cd3('0x6e')]('userOpenchannelQueue:remove',{'UserId':Number(_0x24511b['query']['ids']),'OpenchannelQueueId':Number(_0x24511b[_0x8cd3('0x46')]['id'])});}});}})[_0x8cd3('0x26')](respondWithStatusCode(_0x192aab,null))[_0x8cd3('0x49')](handleError(_0x192aab,null));};exports[_0x8cd3('0x87')]=function(_0xe3852e,_0x3da576,_0x3b549f){var _0x4b66e5={};var _0x4be934={};var _0x48757f;var _0xd6d526;return db[_0x8cd3('0x2e')][_0x8cd3('0x61')]({'where':{'id':_0xe3852e['params']['id']}})['then'](handleEntityNotFound(_0x3da576,null))['then'](function(_0x5cc2e8){if(_0x5cc2e8){_0x48757f=_0x5cc2e8;_0x4be934[_0x8cd3('0x32')]=_[_0x8cd3('0x47')](db['User'][_0x8cd3('0x2f')]);_0x4be934['query']=_[_0x8cd3('0x47')](_0xe3852e[_0x8cd3('0x33')]);_0x4be934[_0x8cd3('0x34')]=_[_0x8cd3('0x35')](_0x4be934[_0x8cd3('0x32')],_0x4be934['query']);_0x4b66e5[_0x8cd3('0x36')]=_[_0x8cd3('0x35')](_0x4be934[_0x8cd3('0x32')],qs[_0x8cd3('0x37')](_0xe3852e[_0x8cd3('0x33')][_0x8cd3('0x37')]));_0x4b66e5[_0x8cd3('0x36')]=_0x4b66e5[_0x8cd3('0x36')][_0x8cd3('0x48')]?_0x4b66e5[_0x8cd3('0x36')]:_0x4be934[_0x8cd3('0x32')];_0x4b66e5['order']=qs['sort'](_0xe3852e['query'][_0x8cd3('0x3a')]);_0x4b66e5['where']=qs[_0x8cd3('0x34')](_['pick'](_0xe3852e['query'],_0x4be934[_0x8cd3('0x34')]));if(_0xe3852e[_0x8cd3('0x33')][_0x8cd3('0x3e')]){_0x4b66e5[_0x8cd3('0x3b')]=_[_0x8cd3('0x3f')](_0x4b66e5['where'],{'$or':_[_0x8cd3('0x2d')](_0x4b66e5[_0x8cd3('0x36')],function(_0x2d28c8){var _0x1a7949={};_0x1a7949[_0x2d28c8]={'$like':'%'+_0xe3852e[_0x8cd3('0x33')][_0x8cd3('0x3e')]+'%'};return _0x1a7949;})});}_0x4b66e5=_['merge']({},_0x4b66e5,_0xe3852e[_0x8cd3('0x40')]);return _0x48757f['getAgents'](_0x4b66e5);}})['then'](function(_0x1b4e5e){if(_0x1b4e5e){_0xd6d526=_0x1b4e5e['length'];if(!_0xe3852e[_0x8cd3('0x33')][_0x8cd3('0x38')]('nolimit')){_0x4b66e5['limit']=qs[_0x8cd3('0x1e')](_0xe3852e[_0x8cd3('0x33')][_0x8cd3('0x1e')]);_0x4b66e5[_0x8cd3('0x20')]=qs[_0x8cd3('0x20')](_0xe3852e[_0x8cd3('0x33')][_0x8cd3('0x20')]);}return _0x48757f[_0x8cd3('0x87')](_0x4b66e5);}})[_0x8cd3('0x26')](function(_0x1c2b0e){if(_0x1c2b0e){return _0x1c2b0e?{'count':_0xd6d526,'rows':_0x1c2b0e}:null;}})['then'](respondWithResult(_0x3da576,null))['catch'](handleError(_0x3da576,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 77c165b..ab13ebb 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 _0x7fca=['emit','hasOwnProperty','hook','exports','events','OpenchannelQueue','setMaxListeners','save','update','remove'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x7fca,0xcc));var _0xa7fc=function(_0x415f3d,_0x17a9f4){_0x415f3d=_0x415f3d-0x0;var _0xb2c2d8=_0x7fca[_0x415f3d];return _0xb2c2d8;};'use strict';var EventEmitter=require(_0xa7fc('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xa7fc('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xa7fc('0x2')](0x0);var events={'afterCreate':_0xa7fc('0x3'),'afterUpdate':_0xa7fc('0x4'),'afterDestroy':_0xa7fc('0x5')};function emitEvent(_0x2dbaa5){return function(_0x4ea4ed,_0x31c052,_0x3f262c){OpenchannelQueueEvents['emit'](_0x2dbaa5+':'+_0x4ea4ed['id'],_0x4ea4ed);OpenchannelQueueEvents[_0xa7fc('0x6')](_0x2dbaa5,_0x4ea4ed);_0x3f262c(null);};}for(var e in events){if(events[_0xa7fc('0x7')](e)){var event=events[e];OpenchannelQueue[_0xa7fc('0x8')](e,emitEvent(event));}}module[_0xa7fc('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xa42b=['OpenchannelQueue','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2666e4,_0x2f1697){var _0x1fa31e=function(_0x8fc569){while(--_0x8fc569){_0x2666e4['push'](_0x2666e4['shift']());}};_0x1fa31e(++_0x2f1697);}(_0xa42b,0xc6));var _0xba42=function(_0x44ee17,_0xa7eaa2){_0x44ee17=_0x44ee17-0x0;var _0x22e84a=_0xa42b[_0x44ee17];return _0x22e84a;};'use strict';var EventEmitter=require(_0xba42('0x0'));var OpenchannelQueue=require(_0xba42('0x1'))['db'][_0xba42('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xba42('0x3'),'afterUpdate':_0xba42('0x4'),'afterDestroy':_0xba42('0x5')};function emitEvent(_0x79113e){return function(_0x19e58f,_0x221204,_0x2aa135){OpenchannelQueueEvents[_0xba42('0x6')](_0x79113e+':'+_0x19e58f['id'],_0x19e58f);OpenchannelQueueEvents['emit'](_0x79113e,_0x19e58f);_0x2aa135(null);};}for(var e in events){if(events[_0xba42('0x7')](e)){var event=events[e];OpenchannelQueue[_0xba42('0x8')](e,emitEvent(event));}}module[_0xba42('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index a93ce76..c241bbd 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 _0x0b30=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util'];(function(_0x58cbde,_0x4b0f62){var _0x5799f3=function(_0x326eca){while(--_0x326eca){_0x58cbde['push'](_0x58cbde['shift']());}};_0x5799f3(++_0x4b0f62);}(_0x0b30,0x1b0));var _0x00b3=function(_0x1bdf3b,_0x4b3f93){_0x1bdf3b=_0x1bdf3b-0x0;var _0x5d8b96=_0x0b30[_0x1bdf3b];return _0x5d8b96;};'use strict';var _=require(_0x00b3('0x0'));var util=require(_0x00b3('0x1'));var logger=require(_0x00b3('0x2'))(_0x00b3('0x3'));var moment=require(_0x00b3('0x4'));var BPromise=require(_0x00b3('0x5'));var rp=require(_0x00b3('0x6'));var fs=require('fs');var path=require(_0x00b3('0x7'));var rimraf=require(_0x00b3('0x8'));var config=require('../../config/environment');var attributes=require(_0x00b3('0x9'));module[_0x00b3('0xa')]=function(_0x24f9c2,_0x1fa11d){return _0x24f9c2[_0x00b3('0xb')](_0x00b3('0xc'),attributes,{'tableName':_0x00b3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb553=['moment','bluebird','path','../../config/environment','exports','define','OpenchannelQueue','openchannel_queues','lodash','../../config/logger','api'];(function(_0x284a31,_0x19e943){var _0x51b780=function(_0x5a0caa){while(--_0x5a0caa){_0x284a31['push'](_0x284a31['shift']());}};_0x51b780(++_0x19e943);}(_0xb553,0x19f));var _0x3b55=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xb553[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x3b55('0x0'));var util=require('util');var logger=require(_0x3b55('0x1'))(_0x3b55('0x2'));var moment=require(_0x3b55('0x3'));var BPromise=require(_0x3b55('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b55('0x5'));var rimraf=require('rimraf');var config=require(_0x3b55('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0x3b55('0x7')]=function(_0x5919cc,_0x41969b){return _0x5919cc[_0x3b55('0x8')](_0x3b55('0x9'),attributes,{'tableName':_0x3b55('0xa'),'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 a16a5a5..6528e3d 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 _0x7ff0=['./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','stringify','error','message','result','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit','map','model','include','catch','ShowOpenchannelQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x6ce872,_0x17c45d){var _0x4abf55=function(_0x2c13a7){while(--_0x2c13a7){_0x6ce872['push'](_0x6ce872['shift']());}};_0x4abf55(++_0x17c45d);}(_0x7ff0,0x121));var _0x07ff=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0x7ff0[_0x55fa03];return _0x2cd7cd;};'use strict';var _=require(_0x07ff('0x0'));var util=require('util');var moment=require(_0x07ff('0x1'));var BPromise=require(_0x07ff('0x2'));var rs=require(_0x07ff('0x3'));var fs=require('fs');var Redis=require(_0x07ff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x07ff('0x5'));var logger=require(_0x07ff('0x6'))('rpc');var config=require(_0x07ff('0x7'));var jayson=require(_0x07ff('0x8'));var client=jayson[_0x07ff('0x9')][_0x07ff('0xa')]({'port':0x232a});config[_0x07ff('0xb')]=_[_0x07ff('0xc')](config[_0x07ff('0xb')],{'host':_0x07ff('0xd'),'port':0x18eb});var socket=require(_0x07ff('0xe'))(new Redis(config[_0x07ff('0xb')]));require(_0x07ff('0xf'))['register'](socket);function respondWithRpcPromise(_0x59e2ad,_0x2c6466,_0x399f5d){return new BPromise(function(_0x4dd674,_0xa63391){return client[_0x07ff('0x10')](_0x59e2ad,_0x399f5d)[_0x07ff('0x11')](function(_0x237784){logger[_0x07ff('0x12')](_0x07ff('0x13'),_0x2c6466,'request\x20sent');logger[_0x07ff('0x14')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2c6466,'request\x20sent',JSON[_0x07ff('0x15')](_0x237784));if(_0x237784[_0x07ff('0x16')]){if(_0x237784[_0x07ff('0x16')]['code']===0x1f4){logger[_0x07ff('0x16')](_0x07ff('0x13'),_0x2c6466,_0x237784['error'][_0x07ff('0x17')]);return _0xa63391(_0x237784[_0x07ff('0x16')][_0x07ff('0x17')]);}logger[_0x07ff('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x2c6466,_0x237784[_0x07ff('0x16')][_0x07ff('0x17')]);return _0x4dd674(_0x237784[_0x07ff('0x16')][_0x07ff('0x17')]);}else{logger[_0x07ff('0x12')](_0x07ff('0x13'),_0x2c6466,'request\x20sent');_0x4dd674(_0x237784[_0x07ff('0x18')][_0x07ff('0x17')]);}})['catch'](function(_0x1b09f6){logger[_0x07ff('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x2c6466,_0x1b09f6);_0xa63391(_0x1b09f6);});});}exports[_0x07ff('0x19')]=function(_0x319a0c){var _0xe4376a=this;return new Promise(function(_0x2ea712,_0x2423c1){return db[_0x07ff('0x1a')]['findAll']({'raw':_0x319a0c[_0x07ff('0x1b')]?_0x319a0c['options'][_0x07ff('0x1c')]===undefined?!![]:![]:!![],'where':_0x319a0c[_0x07ff('0x1b')]?_0x319a0c[_0x07ff('0x1b')][_0x07ff('0x1d')]||null:null,'attributes':_0x319a0c[_0x07ff('0x1b')]?_0x319a0c[_0x07ff('0x1b')][_0x07ff('0x1e')]||null:null,'limit':_0x319a0c[_0x07ff('0x1b')]?_0x319a0c[_0x07ff('0x1b')][_0x07ff('0x1f')]||null:null,'include':_0x319a0c[_0x07ff('0x1b')]?_0x319a0c[_0x07ff('0x1b')]['include']?_[_0x07ff('0x20')](_0x319a0c[_0x07ff('0x1b')]['include'],function(_0x19c367){return{'model':db[_0x19c367[_0x07ff('0x21')]],'as':_0x19c367['as'],'attributes':_0x19c367[_0x07ff('0x1e')],'include':_0x19c367[_0x07ff('0x22')]?_[_0x07ff('0x20')](_0x19c367[_0x07ff('0x22')],function(_0x3ddf29){return{'model':db[_0x3ddf29[_0x07ff('0x21')]],'as':_0x3ddf29['as'],'attributes':_0x3ddf29[_0x07ff('0x1e')],'include':_0x3ddf29[_0x07ff('0x22')]?_[_0x07ff('0x20')](_0x3ddf29[_0x07ff('0x22')],function(_0x532ee8){return{'model':db[_0x532ee8[_0x07ff('0x21')]],'as':_0x532ee8['as'],'attributes':_0x532ee8[_0x07ff('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x07ff('0x11')](function(_0x54c08f){logger['info']('GetOpenchannelQueue',_0x319a0c);logger['debug']('GetOpenchannelQueue',_0x319a0c,JSON[_0x07ff('0x15')](_0x54c08f));_0x2ea712(_0x54c08f);})[_0x07ff('0x23')](function(_0xf09d22){logger[_0x07ff('0x16')](_0x07ff('0x19'),_0xf09d22[_0x07ff('0x17')],_0x319a0c);_0x2423c1(_0xe4376a['error'](0x1f4,_0xf09d22[_0x07ff('0x17')]));});});};exports[_0x07ff('0x24')]=function(_0x31408e){var _0x2b8e39=this;return new Promise(function(_0x38145b,_0xb2259e){return db[_0x07ff('0x1a')][_0x07ff('0x25')]({'raw':_0x31408e[_0x07ff('0x1b')]?_0x31408e[_0x07ff('0x1b')][_0x07ff('0x1c')]===undefined?!![]:![]:!![],'where':_0x31408e['options']?_0x31408e[_0x07ff('0x1b')][_0x07ff('0x1d')]||null:null,'attributes':_0x31408e[_0x07ff('0x1b')]?_0x31408e[_0x07ff('0x1b')][_0x07ff('0x1e')]||null:null,'include':_0x31408e[_0x07ff('0x1b')]?_0x31408e[_0x07ff('0x1b')][_0x07ff('0x22')]?_[_0x07ff('0x20')](_0x31408e[_0x07ff('0x1b')][_0x07ff('0x22')],function(_0x5ff2d4){return{'model':db[_0x5ff2d4[_0x07ff('0x21')]],'as':_0x5ff2d4['as'],'attributes':_0x5ff2d4['attributes'],'include':_0x5ff2d4['include']?_[_0x07ff('0x20')](_0x5ff2d4[_0x07ff('0x22')],function(_0x397cd7){return{'model':db[_0x397cd7[_0x07ff('0x21')]],'as':_0x397cd7['as'],'attributes':_0x397cd7['attributes'],'include':_0x397cd7['include']?_[_0x07ff('0x20')](_0x397cd7[_0x07ff('0x22')],function(_0x4d4437){return{'model':db[_0x4d4437[_0x07ff('0x21')]],'as':_0x4d4437['as'],'attributes':_0x4d4437[_0x07ff('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2586c4){logger[_0x07ff('0x12')](_0x07ff('0x24'),_0x31408e);logger[_0x07ff('0x14')]('ShowOpenchannelQueue',_0x31408e,JSON[_0x07ff('0x15')](_0x2586c4));_0x38145b(_0x2586c4);})[_0x07ff('0x23')](function(_0x3ff3b3){logger[_0x07ff('0x16')](_0x07ff('0x24'),_0x3ff3b3[_0x07ff('0x17')],_0x31408e);_0xb2259e(_0x2b8e39[_0x07ff('0x16')](0x1f4,_0x3ff3b3[_0x07ff('0x17')]));});});}; \ No newline at end of file +var _0x6d4a=['attributes','limit','include','map','model','then','stringify','catch','ShowOpenchannelQueue','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetOpenchannelQueue','OpenchannelQueue','options','raw'];(function(_0x205856,_0x3c6816){var _0x28e673=function(_0x427515){while(--_0x427515){_0x205856['push'](_0x205856['shift']());}};_0x28e673(++_0x3c6816);}(_0x6d4a,0x86));var _0xa6d4=function(_0x50fd58,_0x23f602){_0x50fd58=_0x50fd58-0x0;var _0x2ca3be=_0x6d4a[_0x50fd58];return _0x2ca3be;};'use strict';var _=require(_0xa6d4('0x0'));var util=require('util');var moment=require(_0xa6d4('0x1'));var BPromise=require(_0xa6d4('0x2'));var rs=require(_0xa6d4('0x3'));var fs=require('fs');var Redis=require(_0xa6d4('0x4'));var db=require(_0xa6d4('0x5'))['db'];var utils=require(_0xa6d4('0x6'));var logger=require('../../config/logger')(_0xa6d4('0x7'));var config=require(_0xa6d4('0x8'));var jayson=require(_0xa6d4('0x9'));var client=jayson['client'][_0xa6d4('0xa')]({'port':0x232a});config[_0xa6d4('0xb')]=_[_0xa6d4('0xc')](config[_0xa6d4('0xb')],{'host':_0xa6d4('0xd'),'port':0x18eb});var socket=require(_0xa6d4('0xe'))(new Redis(config[_0xa6d4('0xb')]));require(_0xa6d4('0xf'))['register'](socket);function respondWithRpcPromise(_0x138adb,_0xfb011f,_0x169dcd){return new BPromise(function(_0x14b07a,_0x2558b9){return client[_0xa6d4('0x10')](_0x138adb,_0x169dcd)['then'](function(_0x295b29){logger[_0xa6d4('0x11')](_0xa6d4('0x12'),_0xfb011f,_0xa6d4('0x13'));logger[_0xa6d4('0x14')](_0xa6d4('0x15'),_0xfb011f,_0xa6d4('0x13'),JSON['stringify'](_0x295b29));if(_0x295b29[_0xa6d4('0x16')]){if(_0x295b29[_0xa6d4('0x16')][_0xa6d4('0x17')]===0x1f4){logger[_0xa6d4('0x16')](_0xa6d4('0x12'),_0xfb011f,_0x295b29[_0xa6d4('0x16')][_0xa6d4('0x18')]);return _0x2558b9(_0x295b29[_0xa6d4('0x16')]['message']);}logger['error'](_0xa6d4('0x12'),_0xfb011f,_0x295b29['error'][_0xa6d4('0x18')]);return _0x14b07a(_0x295b29[_0xa6d4('0x16')]['message']);}else{logger[_0xa6d4('0x11')](_0xa6d4('0x12'),_0xfb011f,_0xa6d4('0x13'));_0x14b07a(_0x295b29[_0xa6d4('0x19')][_0xa6d4('0x18')]);}})['catch'](function(_0x45aff7){logger[_0xa6d4('0x16')](_0xa6d4('0x12'),_0xfb011f,_0x45aff7);_0x2558b9(_0x45aff7);});});}exports[_0xa6d4('0x1a')]=function(_0x241634){var _0x1cffc1=this;return new Promise(function(_0x483b18,_0x5d8561){return db[_0xa6d4('0x1b')]['findAll']({'raw':_0x241634[_0xa6d4('0x1c')]?_0x241634['options'][_0xa6d4('0x1d')]===undefined?!![]:![]:!![],'where':_0x241634['options']?_0x241634['options']['where']||null:null,'attributes':_0x241634['options']?_0x241634['options'][_0xa6d4('0x1e')]||null:null,'limit':_0x241634[_0xa6d4('0x1c')]?_0x241634[_0xa6d4('0x1c')][_0xa6d4('0x1f')]||null:null,'include':_0x241634[_0xa6d4('0x1c')]?_0x241634[_0xa6d4('0x1c')][_0xa6d4('0x20')]?_[_0xa6d4('0x21')](_0x241634[_0xa6d4('0x1c')][_0xa6d4('0x20')],function(_0x3303e5){return{'model':db[_0x3303e5[_0xa6d4('0x22')]],'as':_0x3303e5['as'],'attributes':_0x3303e5[_0xa6d4('0x1e')],'include':_0x3303e5[_0xa6d4('0x20')]?_[_0xa6d4('0x21')](_0x3303e5['include'],function(_0x7416ca){return{'model':db[_0x7416ca[_0xa6d4('0x22')]],'as':_0x7416ca['as'],'attributes':_0x7416ca['attributes'],'include':_0x7416ca[_0xa6d4('0x20')]?_[_0xa6d4('0x21')](_0x7416ca[_0xa6d4('0x20')],function(_0x32f3b7){return{'model':db[_0x32f3b7['model']],'as':_0x32f3b7['as'],'attributes':_0x32f3b7[_0xa6d4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa6d4('0x23')](function(_0x34ccf4){logger[_0xa6d4('0x11')](_0xa6d4('0x1a'),_0x241634);logger[_0xa6d4('0x14')](_0xa6d4('0x1a'),_0x241634,JSON[_0xa6d4('0x24')](_0x34ccf4));_0x483b18(_0x34ccf4);})[_0xa6d4('0x25')](function(_0x536337){logger[_0xa6d4('0x16')]('GetOpenchannelQueue',_0x536337['message'],_0x241634);_0x5d8561(_0x1cffc1['error'](0x1f4,_0x536337[_0xa6d4('0x18')]));});});};exports[_0xa6d4('0x26')]=function(_0x2ca9c1){var _0x20b194=this;return new Promise(function(_0x4e3442,_0x4fd7ee){return db['OpenchannelQueue'][_0xa6d4('0x27')]({'raw':_0x2ca9c1[_0xa6d4('0x1c')]?_0x2ca9c1[_0xa6d4('0x1c')][_0xa6d4('0x1d')]===undefined?!![]:![]:!![],'where':_0x2ca9c1['options']?_0x2ca9c1[_0xa6d4('0x1c')][_0xa6d4('0x28')]||null:null,'attributes':_0x2ca9c1[_0xa6d4('0x1c')]?_0x2ca9c1['options'][_0xa6d4('0x1e')]||null:null,'include':_0x2ca9c1[_0xa6d4('0x1c')]?_0x2ca9c1[_0xa6d4('0x1c')]['include']?_[_0xa6d4('0x21')](_0x2ca9c1[_0xa6d4('0x1c')][_0xa6d4('0x20')],function(_0x2dcebb){return{'model':db[_0x2dcebb['model']],'as':_0x2dcebb['as'],'attributes':_0x2dcebb['attributes'],'include':_0x2dcebb['include']?_[_0xa6d4('0x21')](_0x2dcebb[_0xa6d4('0x20')],function(_0x1cec2d){return{'model':db[_0x1cec2d[_0xa6d4('0x22')]],'as':_0x1cec2d['as'],'attributes':_0x1cec2d[_0xa6d4('0x1e')],'include':_0x1cec2d['include']?_['map'](_0x1cec2d[_0xa6d4('0x20')],function(_0x2b33f1){return{'model':db[_0x2b33f1[_0xa6d4('0x22')]],'as':_0x2b33f1['as'],'attributes':_0x2b33f1[_0xa6d4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa6d4('0x23')](function(_0x34de04){logger[_0xa6d4('0x11')]('ShowOpenchannelQueue',_0x2ca9c1);logger['debug'](_0xa6d4('0x26'),_0x2ca9c1,JSON[_0xa6d4('0x24')](_0x34de04));_0x4e3442(_0x34de04);})[_0xa6d4('0x25')](function(_0x16b35f){logger[_0xa6d4('0x16')]('ShowOpenchannelQueue',_0x16b35f[_0xa6d4('0x18')],_0x2ca9c1);_0x4fd7ee(_0x20b194[_0xa6d4('0x16')](0x1f4,_0x16b35f[_0xa6d4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 5b1fe54..ac3af68 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 _0x019c=['update','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x2cbec0,_0x262fef){var _0x3d4101=function(_0x549a36){while(--_0x549a36){_0x2cbec0['push'](_0x2cbec0['shift']());}};_0x3d4101(++_0x262fef);}(_0x019c,0x10d));var _0xc019=function(_0x5d8f,_0x14d9d3){_0x5d8f=_0x5d8f-0x0;var _0x252a50=_0x019c[_0x5d8f];return _0x252a50;};'use strict';var OpenchannelQueueEvents=require(_0xc019('0x0'));var events=[_0xc019('0x1'),_0xc019('0x2'),_0xc019('0x3')];function createListener(_0x50606c,_0x10fde3){return function(_0x106cf3){_0x10fde3['emit'](_0x50606c,_0x106cf3);};}function removeListener(_0x1beff5,_0xc1b68){return function(){OpenchannelQueueEvents[_0xc019('0x4')](_0x1beff5,_0xc1b68);};}exports[_0xc019('0x5')]=function(_0x50c482){for(var _0x196707=0x0,_0x1b5bf4=events[_0xc019('0x6')];_0x196707<_0x1b5bf4;_0x196707++){var _0x382e91=events[_0x196707];var _0x2bf096=createListener(_0xc019('0x7')+_0x382e91,_0x50c482);OpenchannelQueueEvents['on'](_0x382e91,_0x2bf096);}}; \ No newline at end of file +var _0xbb23=['./openchannelQueue.events','save','remove','update','emit','removeListener','openchannelQueue:'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xbb23,0x1c0));var _0x3bb2=function(_0x80ef71,_0x33b7e5){_0x80ef71=_0x80ef71-0x0;var _0x2d2f45=_0xbb23[_0x80ef71];return _0x2d2f45;};'use strict';var OpenchannelQueueEvents=require(_0x3bb2('0x0'));var events=[_0x3bb2('0x1'),_0x3bb2('0x2'),_0x3bb2('0x3')];function createListener(_0x11f6ed,_0x46762d){return function(_0x3a1577){_0x46762d[_0x3bb2('0x4')](_0x11f6ed,_0x3a1577);};}function removeListener(_0x121dcf,_0x480768){return function(){OpenchannelQueueEvents[_0x3bb2('0x5')](_0x121dcf,_0x480768);};}exports['register']=function(_0x3059c9){for(var _0x54b3fd=0x0,_0x261db5=events['length'];_0x54b3fd<_0x261db5;_0x54b3fd++){var _0x5c8c71=events[_0x54b3fd];var _0x4d17ff=createListener(_0x3bb2('0x6')+_0x5c8c71,_0x3059c9);OpenchannelQueueEvents['on'](_0x5c8c71,_0x4d17ff);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index b8d7367..f95f732 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 _0xf086=['get','/describe','isAuthenticated','describe','post','create','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x11cd46,_0x2b708e){var _0x497e19=function(_0x3f46a6){while(--_0x3f46a6){_0x11cd46['push'](_0x11cd46['shift']());}};_0x497e19(++_0x2b708e);}(_0xf086,0x172));var _0x6f08=function(_0x2f3810,_0xd81355){_0x2f3810=_0x2f3810-0x0;var _0x18938c=_0xf086[_0x2f3810];return _0x18938c;};'use strict';var multer=require(_0x6f08('0x0'));var util=require(_0x6f08('0x1'));var path=require(_0x6f08('0x2'));var timeout=require(_0x6f08('0x3'));var express=require(_0x6f08('0x4'));var router=express[_0x6f08('0x5')]();var fs_extra=require(_0x6f08('0x6'));var auth=require(_0x6f08('0x7'));var interaction=require(_0x6f08('0x8'));var config=require(_0x6f08('0x9'));var controller=require('./openchannelQueueReport.controller');router[_0x6f08('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6f08('0xa')](_0x6f08('0xb'),auth[_0x6f08('0xc')](),controller[_0x6f08('0xd')]);router['get']('/:id',auth[_0x6f08('0xc')](),controller['show']);router[_0x6f08('0xe')]('/',auth[_0x6f08('0xc')](),controller[_0x6f08('0xf')]);router['put'](_0x6f08('0x10'),auth[_0x6f08('0xc')](),controller[_0x6f08('0x11')]);router[_0x6f08('0x12')](_0x6f08('0x10'),auth[_0x6f08('0xc')](),controller['destroy']);module[_0x6f08('0x13')]=router; \ No newline at end of file +var _0x9bb1=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','put','delete','multer','path'];(function(_0x4a0f16,_0x21ba18){var _0x45d653=function(_0x137e2c){while(--_0x137e2c){_0x4a0f16['push'](_0x4a0f16['shift']());}};_0x45d653(++_0x21ba18);}(_0x9bb1,0xc1));var _0x19bb=function(_0x882864,_0x161d77){_0x882864=_0x882864-0x0;var _0x26d811=_0x9bb1[_0x882864];return _0x26d811;};'use strict';var multer=require(_0x19bb('0x0'));var util=require('util');var path=require(_0x19bb('0x1'));var timeout=require(_0x19bb('0x2'));var express=require(_0x19bb('0x3'));var router=express[_0x19bb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x19bb('0x5'));var interaction=require(_0x19bb('0x6'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router[_0x19bb('0x7')]('/',auth[_0x19bb('0x8')](),controller[_0x19bb('0x9')]);router[_0x19bb('0x7')]('/describe',auth[_0x19bb('0x8')](),controller[_0x19bb('0xa')]);router[_0x19bb('0x7')](_0x19bb('0xb'),auth[_0x19bb('0x8')](),controller[_0x19bb('0xc')]);router['post']('/',auth[_0x19bb('0x8')](),controller['create']);router[_0x19bb('0xd')](_0x19bb('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x19bb('0xe')](_0x19bb('0xb'),auth[_0x19bb('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 212f456..4ffae00 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 _0x8786=['STRING','DATE','moment','sequelize','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8786,0x7a));var _0x6878=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8786[_0x167cc1];return _0x10bc4b;};'use strict';var moment=require(_0x6878('0x0'));var Sequelize=require(_0x6878('0x1'));module[_0x6878('0x2')]={'uniqueid':{'type':Sequelize[_0x6878('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x6878('0x3')]},'joinAt':{'type':Sequelize[_0x6878('0x4')]},'leaveAt':{'type':Sequelize[_0x6878('0x4')]},'acceptAt':{'type':Sequelize[_0x6878('0x4')]},'exitAt':{'type':Sequelize[_0x6878('0x4')]},'reason':{'type':Sequelize[_0x6878('0x3')]}}; \ No newline at end of file +var _0x4ea5=['DATE','moment','STRING'];(function(_0x209bea,_0x52de74){var _0x2da3dc=function(_0x3cac23){while(--_0x3cac23){_0x209bea['push'](_0x209bea['shift']());}};_0x2da3dc(++_0x52de74);}(_0x4ea5,0xd3));var _0x54ea=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0x4ea5[_0x295314];return _0x584b0c;};'use strict';var moment=require(_0x54ea('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x54ea('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x54ea('0x1')]},'joinAt':{'type':Sequelize[_0x54ea('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x54ea('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index fe38300..deda703 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 _0xeba7=['VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','json','reject','save','then','error','stack','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge'];(function(_0x12edf9,_0x4751e3){var _0x591aa4=function(_0x19a206){while(--_0x19a206){_0x12edf9['push'](_0x12edf9['shift']());}};_0x591aa4(++_0x4751e3);}(_0xeba7,0xa3));var _0x7eba=function(_0x3bb0d6,_0x519062){_0x3bb0d6=_0x3bb0d6-0x0;var _0x2df72f=_0xeba7[_0x3bb0d6];return _0x2df72f;};'use strict';var emlformat=require(_0x7eba('0x0'));var rimraf=require(_0x7eba('0x1'));var zipdir=require(_0x7eba('0x2'));var jsonpatch=require(_0x7eba('0x3'));var rp=require(_0x7eba('0x4'));var moment=require(_0x7eba('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7eba('0x6'));var path=require(_0x7eba('0x7'));var sox=require(_0x7eba('0x8'));var csv=require(_0x7eba('0x9'));var ejs=require(_0x7eba('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7eba('0xb'));var crypto=require(_0x7eba('0xc'));var jsforce=require(_0x7eba('0xd'));var deskjs=require(_0x7eba('0xe'));var toCsv=require(_0x7eba('0x9'));var querystring=require('querystring');var Papa=require(_0x7eba('0xf'));var Redis=require(_0x7eba('0x10'));var authService=require(_0x7eba('0x11'));var qs=require(_0x7eba('0x12'));var as=require(_0x7eba('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7eba('0x14'))(_0x7eba('0x15'));var utils=require(_0x7eba('0x16'));var config=require(_0x7eba('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7eba('0x18'))['db'];function respondWithStatusCode(_0x1996aa,_0x33903b){_0x33903b=_0x33903b||0xcc;return function(_0x2b592f){if(_0x2b592f){return _0x1996aa[_0x7eba('0x19')](_0x33903b);}return _0x1996aa[_0x7eba('0x1a')](_0x33903b)[_0x7eba('0x1b')]();};}function respondWithResult(_0x48b870,_0x41974){_0x41974=_0x41974||0xc8;return function(_0x5f543e){if(_0x5f543e){return _0x48b870[_0x7eba('0x1a')](_0x41974)['json'](_0x5f543e);}};}function respondWithFilteredResult(_0x3f79b1,_0x6bbc83){return function(_0x7ac620){if(_0x7ac620){var _0x271097=typeof _0x6bbc83[_0x7eba('0x1c')]==='undefined'&&typeof _0x6bbc83[_0x7eba('0x1d')]===_0x7eba('0x1e');var _0x234174=_0x7ac620['count'];var _0x51a001=_0x271097?0x0:_0x6bbc83['offset'];var _0x405e93=_0x271097?_0x7ac620[_0x7eba('0x1f')]:_0x6bbc83['offset']+_0x6bbc83[_0x7eba('0x1d')];var _0x2769c1;if(_0x405e93>=_0x234174){_0x405e93=_0x234174;_0x2769c1=0xc8;}else{_0x2769c1=0xce;}_0x3f79b1[_0x7eba('0x1a')](_0x2769c1);return _0x3f79b1['set']('Content-Range',_0x51a001+'-'+_0x405e93+'/'+_0x234174)[_0x7eba('0x20')](_0x7ac620);}return null;};}function patchUpdates(_0x4e7208){return function(_0x295cba){try{jsonpatch['apply'](_0x295cba,_0x4e7208,!![]);}catch(_0x8635df){return BPromise[_0x7eba('0x21')](_0x8635df);}return _0x295cba[_0x7eba('0x22')]();};}function saveUpdates(_0x15fb6a,_0x144d56){return function(_0x5c0ace){if(_0x5c0ace){return _0x5c0ace['update'](_0x15fb6a)[_0x7eba('0x23')](function(_0x5386a6){return _0x5386a6;});}return null;};}function removeEntity(_0x5a411b,_0x111ade){return function(_0x3a424d){if(_0x3a424d){return _0x3a424d['destroy']()[_0x7eba('0x23')](function(){_0x5a411b[_0x7eba('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x789edd,_0x4ea857){return function(_0x52596f){if(!_0x52596f){_0x789edd['sendStatus'](0x194);}return _0x52596f;};}function handleError(_0x205a9c,_0x3be693){_0x3be693=_0x3be693||0x1f4;return function(_0x25e340){logger[_0x7eba('0x24')](_0x25e340[_0x7eba('0x25')]);if(_0x25e340[_0x7eba('0x26')]){delete _0x25e340[_0x7eba('0x26')];}_0x205a9c['status'](_0x3be693)[_0x7eba('0x27')](_0x25e340);};}exports[_0x7eba('0x28')]=function(_0x396647,_0xedc307){var _0x317a4d={},_0x2444d2={},_0x53737c={'count':0x0,'rows':[]};var _0x5922d6=_[_0x7eba('0x29')](db[_0x7eba('0x2a')]['rawAttributes'],function(_0x3f2620){return{'name':_0x3f2620[_0x7eba('0x2b')],'type':_0x3f2620[_0x7eba('0x2c')][_0x7eba('0x2d')]};});_0x2444d2[_0x7eba('0x2e')]=_['map'](_0x5922d6,'name');_0x2444d2[_0x7eba('0x2f')]=_[_0x7eba('0x30')](_0x396647[_0x7eba('0x2f')]);_0x2444d2['filters']=_[_0x7eba('0x31')](_0x2444d2['model'],_0x2444d2[_0x7eba('0x2f')]);_0x317a4d[_0x7eba('0x32')]=_[_0x7eba('0x31')](_0x2444d2[_0x7eba('0x2e')],qs[_0x7eba('0x33')](_0x396647[_0x7eba('0x2f')][_0x7eba('0x33')]));_0x317a4d[_0x7eba('0x32')]=_0x317a4d[_0x7eba('0x32')][_0x7eba('0x34')]?_0x317a4d[_0x7eba('0x32')]:_0x2444d2['model'];if(!_0x396647[_0x7eba('0x2f')][_0x7eba('0x35')]('nolimit')){_0x317a4d[_0x7eba('0x1d')]=qs[_0x7eba('0x1d')](_0x396647[_0x7eba('0x2f')][_0x7eba('0x1d')]);_0x317a4d['offset']=qs[_0x7eba('0x1c')](_0x396647['query'][_0x7eba('0x1c')]);}_0x317a4d['order']=qs[_0x7eba('0x36')](_0x396647[_0x7eba('0x2f')]['sort']);_0x317a4d[_0x7eba('0x37')]=qs[_0x7eba('0x38')](_[_0x7eba('0x39')](_0x396647['query'],_0x2444d2[_0x7eba('0x38')]),_0x5922d6);if(_0x396647[_0x7eba('0x2f')]['filter']){_0x317a4d[_0x7eba('0x37')]=_[_0x7eba('0x3a')](_0x317a4d[_0x7eba('0x37')],{'$or':_[_0x7eba('0x29')](_0x5922d6,function(_0x5f4cbb){if(_0x5f4cbb['type']!==_0x7eba('0x3b')){var _0x3a6737={};_0x3a6737[_0x5f4cbb[_0x7eba('0x26')]]={'$like':'%'+_0x396647[_0x7eba('0x2f')][_0x7eba('0x3c')]+'%'};return _0x3a6737;}})});}_0x317a4d=_[_0x7eba('0x3a')]({},_0x317a4d,_0x396647['options']);var _0x5cdc25={'where':_0x317a4d[_0x7eba('0x37')]};return db[_0x7eba('0x2a')][_0x7eba('0x1f')](_0x5cdc25)[_0x7eba('0x23')](function(_0x1c8f73){_0x53737c[_0x7eba('0x1f')]=_0x1c8f73;if(_0x396647[_0x7eba('0x2f')][_0x7eba('0x3d')]){_0x317a4d[_0x7eba('0x3e')]=[{'all':!![]}];}return db[_0x7eba('0x2a')][_0x7eba('0x3f')](_0x317a4d);})[_0x7eba('0x23')](function(_0x417d13){_0x53737c[_0x7eba('0x40')]=_0x417d13;return _0x53737c;})[_0x7eba('0x23')](respondWithFilteredResult(_0xedc307,_0x317a4d))[_0x7eba('0x41')](handleError(_0xedc307,null));};exports['show']=function(_0x46d14f,_0x4f11d7){var _0x1bf805={'raw':!![],'where':{'id':_0x46d14f[_0x7eba('0x42')]['id']}},_0x93663f={};_0x93663f[_0x7eba('0x2e')]=_[_0x7eba('0x30')](db[_0x7eba('0x2a')][_0x7eba('0x43')]);_0x93663f[_0x7eba('0x2f')]=_[_0x7eba('0x30')](_0x46d14f[_0x7eba('0x2f')]);_0x93663f[_0x7eba('0x38')]=_['intersection'](_0x93663f['model'],_0x93663f[_0x7eba('0x2f')]);_0x1bf805['attributes']=_[_0x7eba('0x31')](_0x93663f[_0x7eba('0x2e')],qs[_0x7eba('0x33')](_0x46d14f[_0x7eba('0x2f')][_0x7eba('0x33')]));_0x1bf805[_0x7eba('0x32')]=_0x1bf805[_0x7eba('0x32')]['length']?_0x1bf805[_0x7eba('0x32')]:_0x93663f[_0x7eba('0x2e')];if(_0x46d14f[_0x7eba('0x2f')][_0x7eba('0x3d')]){_0x1bf805[_0x7eba('0x3e')]=[{'all':!![]}];}_0x1bf805=_[_0x7eba('0x3a')]({},_0x1bf805,_0x46d14f['options']);return db[_0x7eba('0x2a')][_0x7eba('0x44')](_0x1bf805)[_0x7eba('0x23')](handleEntityNotFound(_0x4f11d7,null))[_0x7eba('0x23')](respondWithResult(_0x4f11d7,null))[_0x7eba('0x41')](handleError(_0x4f11d7,null));};exports[_0x7eba('0x45')]=function(_0x2260fe,_0x2c9829){return db[_0x7eba('0x2a')][_0x7eba('0x45')](_0x2260fe[_0x7eba('0x46')],{})['then'](respondWithResult(_0x2c9829,0xc9))[_0x7eba('0x41')](handleError(_0x2c9829,null));};exports[_0x7eba('0x47')]=function(_0x59d661,_0x1a65df){if(_0x59d661[_0x7eba('0x46')]['id']){delete _0x59d661[_0x7eba('0x46')]['id'];}return db[_0x7eba('0x2a')]['find']({'where':{'id':_0x59d661[_0x7eba('0x42')]['id']}})[_0x7eba('0x23')](handleEntityNotFound(_0x1a65df,null))[_0x7eba('0x23')](saveUpdates(_0x59d661['body'],null))['then'](respondWithResult(_0x1a65df,null))[_0x7eba('0x41')](handleError(_0x1a65df,null));};exports[_0x7eba('0x48')]=function(_0x1d6f8d,_0x3b8829){return db[_0x7eba('0x2a')]['find']({'where':{'id':_0x1d6f8d[_0x7eba('0x42')]['id']}})[_0x7eba('0x23')](handleEntityNotFound(_0x3b8829,null))['then'](removeEntity(_0x3b8829,null))[_0x7eba('0x41')](handleError(_0x3b8829,null));};exports[_0x7eba('0x49')]=function(_0x172b86,_0x5dd10d){return db[_0x7eba('0x2a')][_0x7eba('0x49')]()[_0x7eba('0x23')](respondWithResult(_0x5dd10d,null))['catch'](handleError(_0x5dd10d,null));}; \ No newline at end of file +var _0x8e90=['rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','then','show','params','find','catch','create','body','describe','eml-format','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','apply','save','update','destroy','stack','name','index','OpenchannelQueueReport'];(function(_0x1567d4,_0xcb86e1){var _0x1905ce=function(_0x599df2){while(--_0x599df2){_0x1567d4['push'](_0x1567d4['shift']());}};_0x1905ce(++_0xcb86e1);}(_0x8e90,0x130));var _0x08e9=function(_0x9fb081,_0x48f480){_0x9fb081=_0x9fb081-0x0;var _0x43f8b0=_0x8e90[_0x9fb081];return _0x43f8b0;};'use strict';var emlformat=require(_0x08e9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x08e9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x08e9('0x2'));var BPromise=require(_0x08e9('0x3'));var Mustache=require(_0x08e9('0x4'));var util=require(_0x08e9('0x5'));var path=require('path');var sox=require(_0x08e9('0x6'));var csv=require(_0x08e9('0x7'));var ejs=require(_0x08e9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x08e9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x08e9('0xa'));var deskjs=require(_0x08e9('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x08e9('0xc'));var Redis=require(_0x08e9('0xd'));var authService=require(_0x08e9('0xe'));var qs=require(_0x08e9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x08e9('0x10'));var licenseUtil=require(_0x08e9('0x11'));var db=require(_0x08e9('0x12'))['db'];function respondWithStatusCode(_0x34b675,_0x17775c){_0x17775c=_0x17775c||0xcc;return function(_0x15c947){if(_0x15c947){return _0x34b675[_0x08e9('0x13')](_0x17775c);}return _0x34b675['status'](_0x17775c)[_0x08e9('0x14')]();};}function respondWithResult(_0x6f7493,_0x477081){_0x477081=_0x477081||0xc8;return function(_0xbc14b6){if(_0xbc14b6){return _0x6f7493['status'](_0x477081)[_0x08e9('0x15')](_0xbc14b6);}};}function respondWithFilteredResult(_0x4d712f,_0x4f6643){return function(_0x4562cc){if(_0x4562cc){var _0x2e8e96=typeof _0x4f6643[_0x08e9('0x16')]===_0x08e9('0x17')&&typeof _0x4f6643['limit']==='undefined';var _0x5d94a5=_0x4562cc[_0x08e9('0x18')];var _0x26e643=_0x2e8e96?0x0:_0x4f6643[_0x08e9('0x16')];var _0xaacab4=_0x2e8e96?_0x4562cc['count']:_0x4f6643[_0x08e9('0x16')]+_0x4f6643[_0x08e9('0x19')];var _0x2c107a;if(_0xaacab4>=_0x5d94a5){_0xaacab4=_0x5d94a5;_0x2c107a=0xc8;}else{_0x2c107a=0xce;}_0x4d712f[_0x08e9('0x1a')](_0x2c107a);return _0x4d712f[_0x08e9('0x1b')]('Content-Range',_0x26e643+'-'+_0xaacab4+'/'+_0x5d94a5)[_0x08e9('0x15')](_0x4562cc);}return null;};}function patchUpdates(_0x4743a6){return function(_0x14c3ab){try{jsonpatch[_0x08e9('0x1c')](_0x14c3ab,_0x4743a6,!![]);}catch(_0x1457c9){return BPromise['reject'](_0x1457c9);}return _0x14c3ab[_0x08e9('0x1d')]();};}function saveUpdates(_0xbe60ce,_0x530854){return function(_0xc85cac){if(_0xc85cac){return _0xc85cac[_0x08e9('0x1e')](_0xbe60ce)['then'](function(_0x2aefea){return _0x2aefea;});}return null;};}function removeEntity(_0x4e60b8,_0x239761){return function(_0x4e6adb){if(_0x4e6adb){return _0x4e6adb[_0x08e9('0x1f')]()['then'](function(){_0x4e60b8[_0x08e9('0x1a')](0xcc)[_0x08e9('0x14')]();});}};}function handleEntityNotFound(_0x4608ae,_0x262481){return function(_0xcbe3b9){if(!_0xcbe3b9){_0x4608ae[_0x08e9('0x13')](0x194);}return _0xcbe3b9;};}function handleError(_0x498065,_0x9f9f9){_0x9f9f9=_0x9f9f9||0x1f4;return function(_0x36a664){logger['error'](_0x36a664[_0x08e9('0x20')]);if(_0x36a664[_0x08e9('0x21')]){delete _0x36a664[_0x08e9('0x21')];}_0x498065[_0x08e9('0x1a')](_0x9f9f9)['send'](_0x36a664);};}exports[_0x08e9('0x22')]=function(_0x3e96b3,_0x35f38c){var _0x20c743={},_0x11e9a5={},_0x3b2607={'count':0x0,'rows':[]};var _0x507c55=_['map'](db[_0x08e9('0x23')][_0x08e9('0x24')],function(_0x5242c8){return{'name':_0x5242c8[_0x08e9('0x25')],'type':_0x5242c8['type'][_0x08e9('0x26')]};});_0x11e9a5[_0x08e9('0x27')]=_[_0x08e9('0x28')](_0x507c55,_0x08e9('0x21'));_0x11e9a5[_0x08e9('0x29')]=_[_0x08e9('0x2a')](_0x3e96b3[_0x08e9('0x29')]);_0x11e9a5['filters']=_[_0x08e9('0x2b')](_0x11e9a5['model'],_0x11e9a5[_0x08e9('0x29')]);_0x20c743['attributes']=_[_0x08e9('0x2b')](_0x11e9a5[_0x08e9('0x27')],qs['fields'](_0x3e96b3['query'][_0x08e9('0x2c')]));_0x20c743['attributes']=_0x20c743['attributes']['length']?_0x20c743[_0x08e9('0x2d')]:_0x11e9a5[_0x08e9('0x27')];if(!_0x3e96b3['query'][_0x08e9('0x2e')](_0x08e9('0x2f'))){_0x20c743[_0x08e9('0x19')]=qs['limit'](_0x3e96b3[_0x08e9('0x29')][_0x08e9('0x19')]);_0x20c743[_0x08e9('0x16')]=qs['offset'](_0x3e96b3[_0x08e9('0x29')]['offset']);}_0x20c743[_0x08e9('0x30')]=qs[_0x08e9('0x31')](_0x3e96b3[_0x08e9('0x29')][_0x08e9('0x31')]);_0x20c743['where']=qs[_0x08e9('0x32')](_[_0x08e9('0x33')](_0x3e96b3[_0x08e9('0x29')],_0x11e9a5[_0x08e9('0x32')]),_0x507c55);if(_0x3e96b3[_0x08e9('0x29')][_0x08e9('0x34')]){_0x20c743[_0x08e9('0x35')]=_['merge'](_0x20c743[_0x08e9('0x35')],{'$or':_['map'](_0x507c55,function(_0x543d47){if(_0x543d47[_0x08e9('0x36')]!==_0x08e9('0x37')){var _0x13b757={};_0x13b757[_0x543d47[_0x08e9('0x21')]]={'$like':'%'+_0x3e96b3[_0x08e9('0x29')][_0x08e9('0x34')]+'%'};return _0x13b757;}})});}_0x20c743=_[_0x08e9('0x38')]({},_0x20c743,_0x3e96b3[_0x08e9('0x39')]);var _0xd9a4e5={'where':_0x20c743[_0x08e9('0x35')]};return db['OpenchannelQueueReport'][_0x08e9('0x18')](_0xd9a4e5)['then'](function(_0x71b6bb){_0x3b2607[_0x08e9('0x18')]=_0x71b6bb;if(_0x3e96b3[_0x08e9('0x29')][_0x08e9('0x3a')]){_0x20c743['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x08e9('0x3b')](_0x20c743);})[_0x08e9('0x3c')](function(_0x349edf){_0x3b2607['rows']=_0x349edf;return _0x3b2607;})[_0x08e9('0x3c')](respondWithFilteredResult(_0x35f38c,_0x20c743))['catch'](handleError(_0x35f38c,null));};exports[_0x08e9('0x3d')]=function(_0x44f058,_0x21f24f){var _0x5796d5={'raw':!![],'where':{'id':_0x44f058[_0x08e9('0x3e')]['id']}},_0x452ad8={};_0x452ad8[_0x08e9('0x27')]=_[_0x08e9('0x2a')](db[_0x08e9('0x23')][_0x08e9('0x24')]);_0x452ad8[_0x08e9('0x29')]=_['keys'](_0x44f058['query']);_0x452ad8[_0x08e9('0x32')]=_[_0x08e9('0x2b')](_0x452ad8[_0x08e9('0x27')],_0x452ad8['query']);_0x5796d5[_0x08e9('0x2d')]=_[_0x08e9('0x2b')](_0x452ad8[_0x08e9('0x27')],qs[_0x08e9('0x2c')](_0x44f058[_0x08e9('0x29')]['fields']));_0x5796d5[_0x08e9('0x2d')]=_0x5796d5[_0x08e9('0x2d')]['length']?_0x5796d5['attributes']:_0x452ad8[_0x08e9('0x27')];if(_0x44f058[_0x08e9('0x29')]['includeAll']){_0x5796d5['include']=[{'all':!![]}];}_0x5796d5=_[_0x08e9('0x38')]({},_0x5796d5,_0x44f058['options']);return db[_0x08e9('0x23')][_0x08e9('0x3f')](_0x5796d5)['then'](handleEntityNotFound(_0x21f24f,null))[_0x08e9('0x3c')](respondWithResult(_0x21f24f,null))[_0x08e9('0x40')](handleError(_0x21f24f,null));};exports['create']=function(_0x247cb7,_0x4e71b5){return db[_0x08e9('0x23')][_0x08e9('0x41')](_0x247cb7[_0x08e9('0x42')],{})[_0x08e9('0x3c')](respondWithResult(_0x4e71b5,0xc9))[_0x08e9('0x40')](handleError(_0x4e71b5,null));};exports[_0x08e9('0x1e')]=function(_0x5d1b8d,_0x14f085){if(_0x5d1b8d[_0x08e9('0x42')]['id']){delete _0x5d1b8d[_0x08e9('0x42')]['id'];}return db[_0x08e9('0x23')][_0x08e9('0x3f')]({'where':{'id':_0x5d1b8d[_0x08e9('0x3e')]['id']}})[_0x08e9('0x3c')](handleEntityNotFound(_0x14f085,null))[_0x08e9('0x3c')](saveUpdates(_0x5d1b8d[_0x08e9('0x42')],null))[_0x08e9('0x3c')](respondWithResult(_0x14f085,null))['catch'](handleError(_0x14f085,null));};exports[_0x08e9('0x1f')]=function(_0x69dd4d,_0x362fcc){return db[_0x08e9('0x23')][_0x08e9('0x3f')]({'where':{'id':_0x69dd4d[_0x08e9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x362fcc,null))['then'](removeEntity(_0x362fcc,null))[_0x08e9('0x40')](handleError(_0x362fcc,null));};exports[_0x08e9('0x43')]=function(_0x5885b0,_0x231c82){return db[_0x08e9('0x23')][_0x08e9('0x43')]()[_0x08e9('0x3c')](respondWithResult(_0x231c82,null))[_0x08e9('0x40')](handleError(_0x231c82,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index ddcf235..b796746 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x1ff8ef,_0x5c53e3){var _0x380553=function(_0x530393){while(--_0x530393){_0x1ff8ef['push'](_0x1ff8ef['shift']());}};_0x380553(++_0x5c53e3);}(_0x326f,0xd1));var _0xf326=function(_0x421c6f,_0x3b8b6e){_0x421c6f=_0x421c6f-0x0;var _0x3936c6=_0x326f[_0x421c6f];return _0x3936c6;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x814b,0x1a2));var _0xb814=function(_0x179c89,_0x3a69b2){_0x179c89=_0x179c89-0x0;var _0x4b87e5=_0x814b[_0x179c89];return _0x4b87e5;};'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 f39d81d..3e53576 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 _0x02a7=['raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','where','attributes','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','create','body','options'];(function(_0x1057a3,_0x28d9b7){var _0x131cdb=function(_0x47a386){while(--_0x47a386){_0x1057a3['push'](_0x1057a3['shift']());}};_0x131cdb(++_0x28d9b7);}(_0x02a7,0x1a6));var _0x702a=function(_0xf68e20,_0x14afb8){_0xf68e20=_0xf68e20-0x0;var _0x528a9=_0x02a7[_0xf68e20];return _0x528a9;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var moment=require(_0x702a('0x1'));var BPromise=require(_0x702a('0x2'));var rs=require(_0x702a('0x3'));var fs=require('fs');var Redis=require(_0x702a('0x4'));var db=require(_0x702a('0x5'))['db'];var utils=require(_0x702a('0x6'));var logger=require(_0x702a('0x7'))(_0x702a('0x8'));var config=require(_0x702a('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x702a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b6736,_0x27bfc7,_0x3f5ff8){return new BPromise(function(_0x51bf52,_0x562fdb){return client['request'](_0x4b6736,_0x3f5ff8)['then'](function(_0x3cb569){logger[_0x702a('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x27bfc7,_0x702a('0xc'));logger[_0x702a('0xd')](_0x702a('0xe'),_0x27bfc7,_0x702a('0xc'),JSON[_0x702a('0xf')](_0x3cb569));if(_0x3cb569[_0x702a('0x10')]){if(_0x3cb569[_0x702a('0x10')][_0x702a('0x11')]===0x1f4){logger['error'](_0x702a('0x12'),_0x27bfc7,_0x3cb569[_0x702a('0x10')][_0x702a('0x13')]);return _0x562fdb(_0x3cb569[_0x702a('0x10')]['message']);}logger[_0x702a('0x10')](_0x702a('0x12'),_0x27bfc7,_0x3cb569[_0x702a('0x10')][_0x702a('0x13')]);return _0x51bf52(_0x3cb569[_0x702a('0x10')]['message']);}else{logger[_0x702a('0xb')](_0x702a('0x12'),_0x27bfc7,_0x702a('0xc'));_0x51bf52(_0x3cb569[_0x702a('0x14')][_0x702a('0x13')]);}})[_0x702a('0x15')](function(_0x451881){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x27bfc7,_0x451881);_0x562fdb(_0x451881);});});}exports[_0x702a('0x16')]=function(_0x340dc2){var _0x2071ad=this;return new Promise(function(_0x3d1550,_0x1885eb){return db['OpenchannelQueueReport'][_0x702a('0x17')](_0x340dc2[_0x702a('0x18')],{'raw':_0x340dc2[_0x702a('0x19')]?_0x340dc2[_0x702a('0x19')][_0x702a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5b2998){logger['info'](_0x702a('0x16'),_0x340dc2);logger['debug'](_0x702a('0x16'),_0x340dc2,JSON[_0x702a('0xf')](_0x5b2998));_0x3d1550(_0x5b2998);})['catch'](function(_0x2ca064){logger[_0x702a('0x10')](_0x702a('0x16'),_0x2ca064[_0x702a('0x13')],_0x340dc2);_0x1885eb(_0x2071ad[_0x702a('0x10')](0x1f4,_0x2ca064['message']));});});};exports[_0x702a('0x1b')]=function(_0x544be5){var _0x5e6cce=this;return new Promise(function(_0x57d897,_0xa2be1d){return db[_0x702a('0x1c')]['update'](_0x544be5[_0x702a('0x18')],{'raw':_0x544be5[_0x702a('0x19')]?_0x544be5[_0x702a('0x19')][_0x702a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x544be5[_0x702a('0x19')]?_0x544be5[_0x702a('0x19')][_0x702a('0x1d')]||null:null,'attributes':_0x544be5[_0x702a('0x19')]?_0x544be5[_0x702a('0x19')][_0x702a('0x1e')]||null:null,'limit':_0x544be5['options']?_0x544be5[_0x702a('0x19')]['limit']||null:null})[_0x702a('0x1f')](function(_0x51867d){logger[_0x702a('0xb')](_0x702a('0x1b'),_0x544be5);logger[_0x702a('0xd')]('UpdateOpenchannelQueueReport',_0x544be5,JSON[_0x702a('0xf')](_0x51867d));_0x57d897(_0x51867d);})[_0x702a('0x15')](function(_0x26e1d1){logger['error'](_0x702a('0x1b'),_0x26e1d1['message'],_0x544be5);_0xa2be1d(_0x5e6cce[_0x702a('0x10')](0x1f4,_0x26e1d1[_0x702a('0x13')]));});});}; \ No newline at end of file +var _0xaebd=['rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelQueueReport,\x20%s,\x20%s','catch','CreateOpenchannelQueueReport','create','options','raw','debug','OpenchannelQueueReport','update','body','limit','UpdateOpenchannelQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x58cd4c,_0x4387ba){var _0x19d852=function(_0x36dbf8){while(--_0x36dbf8){_0x58cd4c['push'](_0x58cd4c['shift']());}};_0x19d852(++_0x4387ba);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x349048,_0x4670e0){_0x349048=_0x349048-0x0;var _0x385a3e=_0xaebd[_0x349048];return _0x385a3e;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var moment=require(_0xdaeb('0x1'));var BPromise=require(_0xdaeb('0x2'));var rs=require(_0xdaeb('0x3'));var fs=require('fs');var Redis=require(_0xdaeb('0x4'));var db=require(_0xdaeb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaeb('0x6'))(_0xdaeb('0x7'));var config=require(_0xdaeb('0x8'));var jayson=require(_0xdaeb('0x9'));var client=jayson[_0xdaeb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea090,_0x3f7ba1,_0x52c717){return new BPromise(function(_0x550bd9,_0x1b9d37){return client[_0xdaeb('0xb')](_0x3ea090,_0x52c717)[_0xdaeb('0xc')](function(_0x5e0ae9){logger[_0xdaeb('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3f7ba1,_0xdaeb('0xe'));logger['debug'](_0xdaeb('0xf'),_0x3f7ba1,'request\x20sent',JSON[_0xdaeb('0x10')](_0x5e0ae9));if(_0x5e0ae9[_0xdaeb('0x11')]){if(_0x5e0ae9['error']['code']===0x1f4){logger[_0xdaeb('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);return _0x1b9d37(_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);}logger[_0xdaeb('0x11')](_0xdaeb('0x13'),_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')]['message']);return _0x550bd9(_0x5e0ae9['error'][_0xdaeb('0x12')]);}else{logger[_0xdaeb('0xd')](_0xdaeb('0x13'),_0x3f7ba1,_0xdaeb('0xe'));_0x550bd9(_0x5e0ae9['result']['message']);}})[_0xdaeb('0x14')](function(_0x4dd803){logger['error'](_0xdaeb('0x13'),_0x3f7ba1,_0x4dd803);_0x1b9d37(_0x4dd803);});});}exports[_0xdaeb('0x15')]=function(_0x1b5243){var _0x1fe84e=this;return new Promise(function(_0x2d8f11,_0x36f9ac){return db['OpenchannelQueueReport'][_0xdaeb('0x16')](_0x1b5243['body'],{'raw':_0x1b5243[_0xdaeb('0x17')]?_0x1b5243[_0xdaeb('0x17')][_0xdaeb('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4e97e0){logger[_0xdaeb('0xd')](_0xdaeb('0x15'),_0x1b5243);logger[_0xdaeb('0x19')](_0xdaeb('0x15'),_0x1b5243,JSON[_0xdaeb('0x10')](_0x4e97e0));_0x2d8f11(_0x4e97e0);})['catch'](function(_0x597bb7){logger[_0xdaeb('0x11')](_0xdaeb('0x15'),_0x597bb7[_0xdaeb('0x12')],_0x1b5243);_0x36f9ac(_0x1fe84e[_0xdaeb('0x11')](0x1f4,_0x597bb7[_0xdaeb('0x12')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x254c3b){var _0x4dc25f=this;return new Promise(function(_0x130c35,_0x398616){return db[_0xdaeb('0x1a')][_0xdaeb('0x1b')](_0x254c3b[_0xdaeb('0x1c')],{'raw':_0x254c3b['options']?_0x254c3b[_0xdaeb('0x17')][_0xdaeb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x254c3b[_0xdaeb('0x17')]?_0x254c3b['options']['where']||null:null,'attributes':_0x254c3b[_0xdaeb('0x17')]?_0x254c3b['options']['attributes']||null:null,'limit':_0x254c3b[_0xdaeb('0x17')]?_0x254c3b[_0xdaeb('0x17')][_0xdaeb('0x1d')]||null:null})['then'](function(_0x5e6f97){logger[_0xdaeb('0xd')](_0xdaeb('0x1e'),_0x254c3b);logger[_0xdaeb('0x19')]('UpdateOpenchannelQueueReport',_0x254c3b,JSON[_0xdaeb('0x10')](_0x5e6f97));_0x130c35(_0x5e6f97);})['catch'](function(_0x4da82d){logger[_0xdaeb('0x11')](_0xdaeb('0x1e'),_0x4da82d[_0xdaeb('0x12')],_0x254c3b);_0x398616(_0x4dc25f[_0xdaeb('0x11')](0x1f4,_0x4da82d[_0xdaeb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 28a3360..8444cf8 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 _0x3f2d=['put','destroy','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x3f2d,0x134));var _0xd3f2=function(_0x6b25ac,_0x14390e){_0x6b25ac=_0x6b25ac-0x0;var _0x15932a=_0x3f2d[_0x6b25ac];return _0x15932a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd3f2('0x0'));var express=require(_0xd3f2('0x1'));var router=express[_0xd3f2('0x2')]();var fs_extra=require(_0xd3f2('0x3'));var auth=require(_0xd3f2('0x4'));var interaction=require(_0xd3f2('0x5'));var config=require(_0xd3f2('0x6'));var controller=require(_0xd3f2('0x7'));router['get']('/',auth[_0xd3f2('0x8')](),controller[_0xd3f2('0x9')]);router[_0xd3f2('0xa')](_0xd3f2('0xb'),auth[_0xd3f2('0x8')](),controller[_0xd3f2('0xc')]);router[_0xd3f2('0xa')](_0xd3f2('0xd'),auth[_0xd3f2('0x8')](),controller[_0xd3f2('0xe')]);router['post']('/',auth[_0xd3f2('0x8')](),controller['create']);router[_0xd3f2('0xf')](_0xd3f2('0xd'),auth[_0xd3f2('0x8')](),controller['update']);router['delete']('/:id',auth[_0xd3f2('0x8')](),controller[_0xd3f2('0x10')]);module['exports']=router; \ No newline at end of file +var _0xd3ac=['put','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','describe','/:id','show'];(function(_0x403220,_0x51111e){var _0x365652=function(_0x46f00f){while(--_0x46f00f){_0x403220['push'](_0x403220['shift']());}};_0x365652(++_0x51111e);}(_0xd3ac,0x164));var _0xcd3a=function(_0x47b728,_0x1bd8e2){_0x47b728=_0x47b728-0x0;var _0x4e62d4=_0xd3ac[_0x47b728];return _0x4e62d4;};'use strict';var multer=require(_0xcd3a('0x0'));var util=require(_0xcd3a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcd3a('0x2'));var router=express[_0xcd3a('0x3')]();var fs_extra=require(_0xcd3a('0x4'));var auth=require(_0xcd3a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router[_0xcd3a('0x6')]('/',auth[_0xcd3a('0x7')](),controller[_0xcd3a('0x8')]);router[_0xcd3a('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xcd3a('0x9')]);router[_0xcd3a('0x6')](_0xcd3a('0xa'),auth[_0xcd3a('0x7')](),controller[_0xcd3a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xcd3a('0xc')](_0xcd3a('0xa'),auth[_0xcd3a('0x7')](),controller[_0xcd3a('0xd')]);router['delete'](_0xcd3a('0xa'),auth['isAuthenticated'](),controller[_0xcd3a('0xe')]);module[_0xcd3a('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 38aa2a8..6422005 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x823a0b,_0x5824ff){var _0x162120=function(_0x472388){while(--_0x472388){_0x823a0b['push'](_0x823a0b['shift']());}};_0x162120(++_0x5824ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x57786b,_0x4f5172){var _0x3dfbc6=function(_0x33eddf){while(--_0x33eddf){_0x57786b['push'](_0x57786b['shift']());}};_0x3dfbc6(++_0x4f5172);}(_0xaa88,0x137));var _0x8aa8=function(_0x28407a,_0x2a7269){_0x28407a=_0x28407a-0x0;var _0x8bd6ef=_0xaa88[_0x28407a];return _0x8bd6ef;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index b6f7920..8d5a7f9 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 _0x6658=['destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','name','send','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','show','params','filters','options','find','create','body','catch','update'];(function(_0x4067ac,_0x363603){var _0x53d74d=function(_0x492ad4){while(--_0x492ad4){_0x4067ac['push'](_0x4067ac['shift']());}};_0x53d74d(++_0x363603);}(_0x6658,0x9a));var _0x8665=function(_0x109514,_0x37329e){_0x109514=_0x109514-0x0;var _0x1b0e18=_0x6658[_0x109514];return _0x1b0e18;};'use strict';var emlformat=require(_0x8665('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8665('0x1'));var jsonpatch=require(_0x8665('0x2'));var rp=require(_0x8665('0x3'));var moment=require(_0x8665('0x4'));var BPromise=require(_0x8665('0x5'));var Mustache=require('mustache');var util=require(_0x8665('0x6'));var path=require('path');var sox=require(_0x8665('0x7'));var csv=require('to-csv');var ejs=require(_0x8665('0x8'));var fs=require('fs');var fs_extra=require(_0x8665('0x9'));var _=require(_0x8665('0xa'));var squel=require('squel');var crypto=require(_0x8665('0xb'));var jsforce=require(_0x8665('0xc'));var deskjs=require(_0x8665('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8665('0xe'));var Papa=require('papaparse');var Redis=require(_0x8665('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8665('0x10'));var as=require(_0x8665('0x11'));var hardwareService=require(_0x8665('0x12'));var logger=require(_0x8665('0x13'))(_0x8665('0x14'));var utils=require(_0x8665('0x15'));var config=require(_0x8665('0x16'));var licenseUtil=require(_0x8665('0x17'));var db=require(_0x8665('0x18'))['db'];function respondWithStatusCode(_0x56f72a,_0x4facf3){_0x4facf3=_0x4facf3||0xcc;return function(_0x3200ab){if(_0x3200ab){return _0x56f72a[_0x8665('0x19')](_0x4facf3);}return _0x56f72a[_0x8665('0x1a')](_0x4facf3)[_0x8665('0x1b')]();};}function respondWithResult(_0x1abe06,_0x5ce710){_0x5ce710=_0x5ce710||0xc8;return function(_0x33806c){if(_0x33806c){return _0x1abe06[_0x8665('0x1a')](_0x5ce710)[_0x8665('0x1c')](_0x33806c);}};}function respondWithFilteredResult(_0x141115,_0x1bfb1c){return function(_0x25d7ea){if(_0x25d7ea){var _0x1834bf=typeof _0x1bfb1c[_0x8665('0x1d')]===_0x8665('0x1e')&&typeof _0x1bfb1c[_0x8665('0x1f')]==='undefined';var _0x2b2eaf=_0x25d7ea[_0x8665('0x20')];var _0x53ce8b=_0x1834bf?0x0:_0x1bfb1c[_0x8665('0x1d')];var _0x536d6e=_0x1834bf?_0x25d7ea['count']:_0x1bfb1c[_0x8665('0x1d')]+_0x1bfb1c[_0x8665('0x1f')];var _0x781638;if(_0x536d6e>=_0x2b2eaf){_0x536d6e=_0x2b2eaf;_0x781638=0xc8;}else{_0x781638=0xce;}_0x141115[_0x8665('0x1a')](_0x781638);return _0x141115[_0x8665('0x21')](_0x8665('0x22'),_0x53ce8b+'-'+_0x536d6e+'/'+_0x2b2eaf)['json'](_0x25d7ea);}return null;};}function patchUpdates(_0x12f24a){return function(_0x1e57ab){try{jsonpatch[_0x8665('0x23')](_0x1e57ab,_0x12f24a,!![]);}catch(_0x446645){return BPromise[_0x8665('0x24')](_0x446645);}return _0x1e57ab[_0x8665('0x25')]();};}function saveUpdates(_0x1898f2,_0x53ec31){return function(_0x133547){if(_0x133547){return _0x133547['update'](_0x1898f2)[_0x8665('0x26')](function(_0x18c262){return _0x18c262;});}return null;};}function removeEntity(_0x31dd24,_0x4fdc99){return function(_0x39c7d6){if(_0x39c7d6){return _0x39c7d6['destroy']()[_0x8665('0x26')](function(){_0x31dd24['status'](0xcc)[_0x8665('0x1b')]();});}};}function handleEntityNotFound(_0x1e8392,_0x293a71){return function(_0x3dcb76){if(!_0x3dcb76){_0x1e8392['sendStatus'](0x194);}return _0x3dcb76;};}function handleError(_0xbaea45,_0x258234){_0x258234=_0x258234||0x1f4;return function(_0x1560fa){logger[_0x8665('0x27')](_0x1560fa['stack']);if(_0x1560fa[_0x8665('0x28')]){delete _0x1560fa['name'];}_0xbaea45[_0x8665('0x1a')](_0x258234)[_0x8665('0x29')](_0x1560fa);};}exports['index']=function(_0x5bf825,_0xe83a0a){var _0x5ba2e4={},_0x5d1c57={},_0x3489ce={'count':0x0,'rows':[]};var _0x26075b=_[_0x8665('0x2a')](db[_0x8665('0x2b')][_0x8665('0x2c')],function(_0xc79f79){return{'name':_0xc79f79['fieldName'],'type':_0xc79f79[_0x8665('0x2d')][_0x8665('0x2e')]};});_0x5d1c57[_0x8665('0x2f')]=_[_0x8665('0x2a')](_0x26075b,_0x8665('0x28'));_0x5d1c57[_0x8665('0x30')]=_[_0x8665('0x31')](_0x5bf825[_0x8665('0x30')]);_0x5d1c57['filters']=_['intersection'](_0x5d1c57[_0x8665('0x2f')],_0x5d1c57[_0x8665('0x30')]);_0x5ba2e4[_0x8665('0x32')]=_[_0x8665('0x33')](_0x5d1c57[_0x8665('0x2f')],qs[_0x8665('0x34')](_0x5bf825[_0x8665('0x30')]['fields']));_0x5ba2e4['attributes']=_0x5ba2e4[_0x8665('0x32')][_0x8665('0x35')]?_0x5ba2e4['attributes']:_0x5d1c57[_0x8665('0x2f')];if(!_0x5bf825[_0x8665('0x30')][_0x8665('0x36')](_0x8665('0x37'))){_0x5ba2e4[_0x8665('0x1f')]=qs[_0x8665('0x1f')](_0x5bf825[_0x8665('0x30')][_0x8665('0x1f')]);_0x5ba2e4[_0x8665('0x1d')]=qs[_0x8665('0x1d')](_0x5bf825['query'][_0x8665('0x1d')]);}_0x5ba2e4[_0x8665('0x38')]=qs[_0x8665('0x39')](_0x5bf825['query'][_0x8665('0x39')]);_0x5ba2e4[_0x8665('0x3a')]=qs['filters'](_[_0x8665('0x3b')](_0x5bf825[_0x8665('0x30')],_0x5d1c57['filters']),_0x26075b);if(_0x5bf825['query']['filter']){_0x5ba2e4['where']=_[_0x8665('0x3c')](_0x5ba2e4['where'],{'$or':_['map'](_0x26075b,function(_0x6dc88f){if(_0x6dc88f[_0x8665('0x2d')]!==_0x8665('0x3d')){var _0x568d13={};_0x568d13[_0x6dc88f[_0x8665('0x28')]]={'$like':'%'+_0x5bf825[_0x8665('0x30')][_0x8665('0x3e')]+'%'};return _0x568d13;}})});}_0x5ba2e4=_['merge']({},_0x5ba2e4,_0x5bf825['options']);var _0x4bc300={'where':_0x5ba2e4[_0x8665('0x3a')]};return db[_0x8665('0x2b')]['count'](_0x4bc300)[_0x8665('0x26')](function(_0x5ba880){_0x3489ce[_0x8665('0x20')]=_0x5ba880;if(_0x5bf825[_0x8665('0x30')][_0x8665('0x3f')]){_0x5ba2e4[_0x8665('0x40')]=[{'all':!![]}];}return db[_0x8665('0x2b')]['findAll'](_0x5ba2e4);})[_0x8665('0x26')](function(_0x17b138){_0x3489ce['rows']=_0x17b138;return _0x3489ce;})[_0x8665('0x26')](respondWithFilteredResult(_0xe83a0a,_0x5ba2e4))['catch'](handleError(_0xe83a0a,null));};exports[_0x8665('0x41')]=function(_0x4c63fe,_0x36faa8){var _0x4d5f7e={'raw':!![],'where':{'id':_0x4c63fe[_0x8665('0x42')]['id']}},_0x2a58bf={};_0x2a58bf['model']=_[_0x8665('0x31')](db[_0x8665('0x2b')][_0x8665('0x2c')]);_0x2a58bf[_0x8665('0x30')]=_[_0x8665('0x31')](_0x4c63fe[_0x8665('0x30')]);_0x2a58bf[_0x8665('0x43')]=_[_0x8665('0x33')](_0x2a58bf[_0x8665('0x2f')],_0x2a58bf[_0x8665('0x30')]);_0x4d5f7e['attributes']=_['intersection'](_0x2a58bf[_0x8665('0x2f')],qs[_0x8665('0x34')](_0x4c63fe['query'][_0x8665('0x34')]));_0x4d5f7e[_0x8665('0x32')]=_0x4d5f7e[_0x8665('0x32')][_0x8665('0x35')]?_0x4d5f7e[_0x8665('0x32')]:_0x2a58bf[_0x8665('0x2f')];if(_0x4c63fe[_0x8665('0x30')][_0x8665('0x3f')]){_0x4d5f7e['include']=[{'all':!![]}];}_0x4d5f7e=_[_0x8665('0x3c')]({},_0x4d5f7e,_0x4c63fe[_0x8665('0x44')]);return db['OpenchannelTransferReport'][_0x8665('0x45')](_0x4d5f7e)[_0x8665('0x26')](handleEntityNotFound(_0x36faa8,null))[_0x8665('0x26')](respondWithResult(_0x36faa8,null))['catch'](handleError(_0x36faa8,null));};exports['create']=function(_0x57cbbc,_0x56705e){return db['OpenchannelTransferReport'][_0x8665('0x46')](_0x57cbbc[_0x8665('0x47')],{})[_0x8665('0x26')](respondWithResult(_0x56705e,0xc9))[_0x8665('0x48')](handleError(_0x56705e,null));};exports[_0x8665('0x49')]=function(_0x2daed0,_0x191988){if(_0x2daed0['body']['id']){delete _0x2daed0[_0x8665('0x47')]['id'];}return db[_0x8665('0x2b')]['find']({'where':{'id':_0x2daed0[_0x8665('0x42')]['id']}})[_0x8665('0x26')](handleEntityNotFound(_0x191988,null))[_0x8665('0x26')](saveUpdates(_0x2daed0['body'],null))[_0x8665('0x26')](respondWithResult(_0x191988,null))[_0x8665('0x48')](handleError(_0x191988,null));};exports[_0x8665('0x4a')]=function(_0x560579,_0x4f440d){return db['OpenchannelTransferReport'][_0x8665('0x45')]({'where':{'id':_0x560579[_0x8665('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f440d,null))[_0x8665('0x26')](removeEntity(_0x4f440d,null))[_0x8665('0x48')](handleError(_0x4f440d,null));};exports[_0x8665('0x4b')]=function(_0x2cc1a9,_0x4d6864){return db[_0x8665('0x2b')]['describe']()[_0x8665('0x26')](respondWithResult(_0x4d6864,null))[_0x8665('0x48')](handleError(_0x4d6864,null));}; \ No newline at end of file +var _0x86ef=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','fieldName','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','params','length','includeAll','find','create','body','describe','rimraf','zip-dir'];(function(_0x2bfc2d,_0x1ef653){var _0x539b82=function(_0x55be01){while(--_0x55be01){_0x2bfc2d['push'](_0x2bfc2d['shift']());}};_0x539b82(++_0x1ef653);}(_0x86ef,0x136));var _0xf86e=function(_0x3d51e,_0x1f36aa){_0x3d51e=_0x3d51e-0x0;var _0x284f6f=_0x86ef[_0x3d51e];return _0x284f6f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf86e('0x0'));var zipdir=require(_0xf86e('0x1'));var jsonpatch=require(_0xf86e('0x2'));var rp=require(_0xf86e('0x3'));var moment=require(_0xf86e('0x4'));var BPromise=require(_0xf86e('0x5'));var Mustache=require(_0xf86e('0x6'));var util=require(_0xf86e('0x7'));var path=require(_0xf86e('0x8'));var sox=require(_0xf86e('0x9'));var csv=require('to-csv');var ejs=require(_0xf86e('0xa'));var fs=require('fs');var fs_extra=require(_0xf86e('0xb'));var _=require(_0xf86e('0xc'));var squel=require('squel');var crypto=require(_0xf86e('0xd'));var jsforce=require(_0xf86e('0xe'));var deskjs=require(_0xf86e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf86e('0x10'));var Redis=require(_0xf86e('0x11'));var authService=require(_0xf86e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf86e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf86e('0x14'))(_0xf86e('0x15'));var utils=require(_0xf86e('0x16'));var config=require(_0xf86e('0x17'));var licenseUtil=require(_0xf86e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x502a09,_0x6b8619){_0x6b8619=_0x6b8619||0xcc;return function(_0x50561b){if(_0x50561b){return _0x502a09[_0xf86e('0x19')](_0x6b8619);}return _0x502a09[_0xf86e('0x1a')](_0x6b8619)[_0xf86e('0x1b')]();};}function respondWithResult(_0x4a5b35,_0x115518){_0x115518=_0x115518||0xc8;return function(_0xa84e2a){if(_0xa84e2a){return _0x4a5b35['status'](_0x115518)[_0xf86e('0x1c')](_0xa84e2a);}};}function respondWithFilteredResult(_0x86392c,_0x1712d8){return function(_0x4c6cdf){if(_0x4c6cdf){var _0x3b4274=typeof _0x1712d8[_0xf86e('0x1d')]===_0xf86e('0x1e')&&typeof _0x1712d8['limit']===_0xf86e('0x1e');var _0x3a2113=_0x4c6cdf[_0xf86e('0x1f')];var _0x54b3f7=_0x3b4274?0x0:_0x1712d8['offset'];var _0x1e84a2=_0x3b4274?_0x4c6cdf[_0xf86e('0x1f')]:_0x1712d8['offset']+_0x1712d8[_0xf86e('0x20')];var _0xd6051e;if(_0x1e84a2>=_0x3a2113){_0x1e84a2=_0x3a2113;_0xd6051e=0xc8;}else{_0xd6051e=0xce;}_0x86392c['status'](_0xd6051e);return _0x86392c[_0xf86e('0x21')](_0xf86e('0x22'),_0x54b3f7+'-'+_0x1e84a2+'/'+_0x3a2113)[_0xf86e('0x1c')](_0x4c6cdf);}return null;};}function patchUpdates(_0x56c04d){return function(_0x29a89c){try{jsonpatch[_0xf86e('0x23')](_0x29a89c,_0x56c04d,!![]);}catch(_0x1894eb){return BPromise[_0xf86e('0x24')](_0x1894eb);}return _0x29a89c['save']();};}function saveUpdates(_0x327308,_0x47bb26){return function(_0xb69ae){if(_0xb69ae){return _0xb69ae[_0xf86e('0x25')](_0x327308)[_0xf86e('0x26')](function(_0x5dd5d3){return _0x5dd5d3;});}return null;};}function removeEntity(_0x3673ba,_0x2438bf){return function(_0x8e90eb){if(_0x8e90eb){return _0x8e90eb[_0xf86e('0x27')]()[_0xf86e('0x26')](function(){_0x3673ba[_0xf86e('0x1a')](0xcc)[_0xf86e('0x1b')]();});}};}function handleEntityNotFound(_0x31763b,_0x2d4a0c){return function(_0x2d3912){if(!_0x2d3912){_0x31763b[_0xf86e('0x19')](0x194);}return _0x2d3912;};}function handleError(_0x21532c,_0x4d5977){_0x4d5977=_0x4d5977||0x1f4;return function(_0x28b25d){logger[_0xf86e('0x28')](_0x28b25d[_0xf86e('0x29')]);if(_0x28b25d[_0xf86e('0x2a')]){delete _0x28b25d[_0xf86e('0x2a')];}_0x21532c[_0xf86e('0x1a')](_0x4d5977)[_0xf86e('0x2b')](_0x28b25d);};}exports[_0xf86e('0x2c')]=function(_0x3237c0,_0x1060ea){var _0x53e748={},_0x48a493={},_0x25c9e8={'count':0x0,'rows':[]};var _0x4e77de=_[_0xf86e('0x2d')](db[_0xf86e('0x2e')]['rawAttributes'],function(_0x1c7dfb){return{'name':_0x1c7dfb[_0xf86e('0x2f')],'type':_0x1c7dfb['type'][_0xf86e('0x30')]};});_0x48a493['model']=_[_0xf86e('0x2d')](_0x4e77de,_0xf86e('0x2a'));_0x48a493[_0xf86e('0x31')]=_[_0xf86e('0x32')](_0x3237c0[_0xf86e('0x31')]);_0x48a493[_0xf86e('0x33')]=_[_0xf86e('0x34')](_0x48a493[_0xf86e('0x35')],_0x48a493[_0xf86e('0x31')]);_0x53e748['attributes']=_[_0xf86e('0x34')](_0x48a493[_0xf86e('0x35')],qs[_0xf86e('0x36')](_0x3237c0['query'][_0xf86e('0x36')]));_0x53e748[_0xf86e('0x37')]=_0x53e748[_0xf86e('0x37')]['length']?_0x53e748['attributes']:_0x48a493[_0xf86e('0x35')];if(!_0x3237c0[_0xf86e('0x31')][_0xf86e('0x38')](_0xf86e('0x39'))){_0x53e748[_0xf86e('0x20')]=qs[_0xf86e('0x20')](_0x3237c0[_0xf86e('0x31')]['limit']);_0x53e748['offset']=qs[_0xf86e('0x1d')](_0x3237c0[_0xf86e('0x31')][_0xf86e('0x1d')]);}_0x53e748[_0xf86e('0x3a')]=qs[_0xf86e('0x3b')](_0x3237c0[_0xf86e('0x31')][_0xf86e('0x3b')]);_0x53e748[_0xf86e('0x3c')]=qs[_0xf86e('0x33')](_[_0xf86e('0x3d')](_0x3237c0[_0xf86e('0x31')],_0x48a493['filters']),_0x4e77de);if(_0x3237c0[_0xf86e('0x31')][_0xf86e('0x3e')]){_0x53e748[_0xf86e('0x3c')]=_[_0xf86e('0x3f')](_0x53e748[_0xf86e('0x3c')],{'$or':_[_0xf86e('0x2d')](_0x4e77de,function(_0x2a9098){if(_0x2a9098[_0xf86e('0x40')]!==_0xf86e('0x41')){var _0x574b01={};_0x574b01[_0x2a9098[_0xf86e('0x2a')]]={'$like':'%'+_0x3237c0[_0xf86e('0x31')][_0xf86e('0x3e')]+'%'};return _0x574b01;}})});}_0x53e748=_[_0xf86e('0x3f')]({},_0x53e748,_0x3237c0[_0xf86e('0x42')]);var _0x3a08f1={'where':_0x53e748[_0xf86e('0x3c')]};return db['OpenchannelTransferReport'][_0xf86e('0x1f')](_0x3a08f1)[_0xf86e('0x26')](function(_0x5e9307){_0x25c9e8[_0xf86e('0x1f')]=_0x5e9307;if(_0x3237c0[_0xf86e('0x31')]['includeAll']){_0x53e748[_0xf86e('0x43')]=[{'all':!![]}];}return db[_0xf86e('0x2e')][_0xf86e('0x44')](_0x53e748);})[_0xf86e('0x26')](function(_0x4f1586){_0x25c9e8['rows']=_0x4f1586;return _0x25c9e8;})[_0xf86e('0x26')](respondWithFilteredResult(_0x1060ea,_0x53e748))[_0xf86e('0x45')](handleError(_0x1060ea,null));};exports[_0xf86e('0x46')]=function(_0x1cc12d,_0xc7730c){var _0x4428b7={'raw':!![],'where':{'id':_0x1cc12d[_0xf86e('0x47')]['id']}},_0x2e245e={};_0x2e245e[_0xf86e('0x35')]=_['keys'](db[_0xf86e('0x2e')]['rawAttributes']);_0x2e245e[_0xf86e('0x31')]=_['keys'](_0x1cc12d[_0xf86e('0x31')]);_0x2e245e[_0xf86e('0x33')]=_[_0xf86e('0x34')](_0x2e245e[_0xf86e('0x35')],_0x2e245e[_0xf86e('0x31')]);_0x4428b7[_0xf86e('0x37')]=_[_0xf86e('0x34')](_0x2e245e[_0xf86e('0x35')],qs[_0xf86e('0x36')](_0x1cc12d[_0xf86e('0x31')][_0xf86e('0x36')]));_0x4428b7['attributes']=_0x4428b7[_0xf86e('0x37')][_0xf86e('0x48')]?_0x4428b7['attributes']:_0x2e245e[_0xf86e('0x35')];if(_0x1cc12d[_0xf86e('0x31')][_0xf86e('0x49')]){_0x4428b7[_0xf86e('0x43')]=[{'all':!![]}];}_0x4428b7=_[_0xf86e('0x3f')]({},_0x4428b7,_0x1cc12d[_0xf86e('0x42')]);return db[_0xf86e('0x2e')][_0xf86e('0x4a')](_0x4428b7)[_0xf86e('0x26')](handleEntityNotFound(_0xc7730c,null))[_0xf86e('0x26')](respondWithResult(_0xc7730c,null))[_0xf86e('0x45')](handleError(_0xc7730c,null));};exports['create']=function(_0x5440d4,_0x454e5f){return db[_0xf86e('0x2e')][_0xf86e('0x4b')](_0x5440d4[_0xf86e('0x4c')],{})[_0xf86e('0x26')](respondWithResult(_0x454e5f,0xc9))['catch'](handleError(_0x454e5f,null));};exports[_0xf86e('0x25')]=function(_0xf21cb1,_0x41c3c8){if(_0xf21cb1[_0xf86e('0x4c')]['id']){delete _0xf21cb1[_0xf86e('0x4c')]['id'];}return db[_0xf86e('0x2e')][_0xf86e('0x4a')]({'where':{'id':_0xf21cb1[_0xf86e('0x47')]['id']}})[_0xf86e('0x26')](handleEntityNotFound(_0x41c3c8,null))[_0xf86e('0x26')](saveUpdates(_0xf21cb1[_0xf86e('0x4c')],null))[_0xf86e('0x26')](respondWithResult(_0x41c3c8,null))[_0xf86e('0x45')](handleError(_0x41c3c8,null));};exports[_0xf86e('0x27')]=function(_0x532a0c,_0x377b45){return db[_0xf86e('0x2e')][_0xf86e('0x4a')]({'where':{'id':_0x532a0c[_0xf86e('0x47')]['id']}})['then'](handleEntityNotFound(_0x377b45,null))[_0xf86e('0x26')](removeEntity(_0x377b45,null))['catch'](handleError(_0x377b45,null));};exports[_0xf86e('0x4d')]=function(_0x34e3f1,_0x5bce8c){return db[_0xf86e('0x2e')][_0xf86e('0x4d')]()[_0xf86e('0x26')](respondWithResult(_0x5bce8c,null))['catch'](handleError(_0x5bce8c,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 33fcf92..63a56d8 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 _0xff8f=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0x3ba753,_0x2f3216){var _0x2f469a=function(_0x3c0c23){while(--_0x3c0c23){_0x3ba753['push'](_0x3ba753['shift']());}};_0x2f469a(++_0x2f3216);}(_0xff8f,0x181));var _0xfff8=function(_0x538736,_0x43d1cc){_0x538736=_0x538736-0x0;var _0x3cb4ee=_0xff8f[_0x538736];return _0x3cb4ee;};'use strict';var _=require(_0xfff8('0x0'));var util=require(_0xfff8('0x1'));var logger=require(_0xfff8('0x2'))('api');var moment=require(_0xfff8('0x3'));var BPromise=require(_0xfff8('0x4'));var rp=require(_0xfff8('0x5'));var fs=require('fs');var path=require(_0xfff8('0x6'));var rimraf=require(_0xfff8('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0xfff8('0x8')]=function(_0x4728e9,_0x418931){return _0x4728e9['define'](_0xfff8('0x9'),attributes,{'tableName':_0xfff8('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd85b=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd85b,0x13f));var _0xbd85=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd85b[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xbd85('0x0'));var logger=require(_0xbd85('0x1'))(_0xbd85('0x2'));var moment=require(_0xbd85('0x3'));var BPromise=require(_0xbd85('0x4'));var rp=require(_0xbd85('0x5'));var fs=require('fs');var path=require(_0xbd85('0x6'));var rimraf=require(_0xbd85('0x7'));var config=require(_0xbd85('0x8'));var attributes=require(_0xbd85('0x9'));module[_0xbd85('0xa')]=function(_0x3b58bf,_0x388395){return _0x3b58bf['define'](_0xbd85('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xbd85('0xc'),'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 236d292..aa68b34 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 _0x4ab0=['jayson/promise','client','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0xe58e43,_0x49468c){var _0x25ad9b=function(_0x41b312){while(--_0x41b312){_0xe58e43['push'](_0xe58e43['shift']());}};_0x25ad9b(++_0x49468c);}(_0x4ab0,0xd5));var _0x04ab=function(_0x30a2e9,_0x3804fa){_0x30a2e9=_0x30a2e9-0x0;var _0x1076b8=_0x4ab0[_0x30a2e9];return _0x1076b8;};'use strict';var _=require('lodash');var util=require(_0x04ab('0x0'));var moment=require(_0x04ab('0x1'));var BPromise=require(_0x04ab('0x2'));var rs=require(_0x04ab('0x3'));var fs=require('fs');var Redis=require(_0x04ab('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x04ab('0x5'))(_0x04ab('0x6'));var config=require('../../config/environment');var jayson=require(_0x04ab('0x7'));var client=jayson[_0x04ab('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f5901,_0x293f1d,_0x1ff7f6){return new BPromise(function(_0x4bc05e,_0x101d6b){return client[_0x04ab('0x9')](_0x3f5901,_0x1ff7f6)[_0x04ab('0xa')](function(_0x41ce1e){logger['info'](_0x04ab('0xb'),_0x293f1d,_0x04ab('0xc'));logger[_0x04ab('0xd')](_0x04ab('0xe'),_0x293f1d,'request\x20sent',JSON[_0x04ab('0xf')](_0x41ce1e));if(_0x41ce1e[_0x04ab('0x10')]){if(_0x41ce1e[_0x04ab('0x10')][_0x04ab('0x11')]===0x1f4){logger[_0x04ab('0x10')](_0x04ab('0xb'),_0x293f1d,_0x41ce1e['error'][_0x04ab('0x12')]);return _0x101d6b(_0x41ce1e['error'][_0x04ab('0x12')]);}logger[_0x04ab('0x10')](_0x04ab('0xb'),_0x293f1d,_0x41ce1e[_0x04ab('0x10')]['message']);return _0x4bc05e(_0x41ce1e['error']['message']);}else{logger[_0x04ab('0x13')](_0x04ab('0xb'),_0x293f1d,_0x04ab('0xc'));_0x4bc05e(_0x41ce1e[_0x04ab('0x14')][_0x04ab('0x12')]);}})[_0x04ab('0x15')](function(_0x42c937){logger[_0x04ab('0x10')](_0x04ab('0xb'),_0x293f1d,_0x42c937);_0x101d6b(_0x42c937);});});} \ No newline at end of file +var _0x0207=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','util','randomstring','ioredis'];(function(_0x4272a9,_0x36c4ea){var _0x19cc26=function(_0x4eb224){while(--_0x4eb224){_0x4272a9['push'](_0x4272a9['shift']());}};_0x19cc26(++_0x36c4ea);}(_0x0207,0x162));var _0x7020=function(_0x25920b,_0x1870f5){_0x25920b=_0x25920b-0x0;var _0x7d2116=_0x0207[_0x25920b];return _0x7d2116;};'use strict';var _=require('lodash');var util=require(_0x7020('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7020('0x1'));var fs=require('fs');var Redis=require(_0x7020('0x2'));var db=require(_0x7020('0x3'))['db'];var utils=require(_0x7020('0x4'));var logger=require(_0x7020('0x5'))(_0x7020('0x6'));var config=require(_0x7020('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7020('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39263c,_0x3c6c11,_0x17deac){return new BPromise(function(_0x42bc79,_0x22ba3e){return client[_0x7020('0x9')](_0x39263c,_0x17deac)['then'](function(_0x5e86b5){logger[_0x7020('0xa')](_0x7020('0xb'),_0x3c6c11,_0x7020('0xc'));logger['debug'](_0x7020('0xd'),_0x3c6c11,_0x7020('0xc'),JSON['stringify'](_0x5e86b5));if(_0x5e86b5[_0x7020('0xe')]){if(_0x5e86b5[_0x7020('0xe')][_0x7020('0xf')]===0x1f4){logger['error'](_0x7020('0xb'),_0x3c6c11,_0x5e86b5[_0x7020('0xe')][_0x7020('0x10')]);return _0x22ba3e(_0x5e86b5[_0x7020('0xe')][_0x7020('0x10')]);}logger['error'](_0x7020('0xb'),_0x3c6c11,_0x5e86b5['error'][_0x7020('0x10')]);return _0x42bc79(_0x5e86b5[_0x7020('0xe')][_0x7020('0x10')]);}else{logger[_0x7020('0xa')](_0x7020('0xb'),_0x3c6c11,_0x7020('0xc'));_0x42bc79(_0x5e86b5['result'][_0x7020('0x10')]);}})['catch'](function(_0x2f4db5){logger[_0x7020('0xe')](_0x7020('0xb'),_0x3c6c11,_0x2f4db5);_0x22ba3e(_0x2f4db5);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 209ebca..a69b315 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 _0x2f22=['create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2f22,0x156));var _0x22f2=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2f22[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0x22f2('0x0'));var util=require(_0x22f2('0x1'));var path=require(_0x22f2('0x2'));var timeout=require('connect-timeout');var express=require(_0x22f2('0x3'));var router=express[_0x22f2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x22f2('0x5'));var interaction=require(_0x22f2('0x6'));var config=require(_0x22f2('0x7'));var controller=require(_0x22f2('0x8'));router[_0x22f2('0x9')]('/',auth[_0x22f2('0xa')](),controller[_0x22f2('0xb')]);router['get'](_0x22f2('0xc'),auth[_0x22f2('0xa')](),controller[_0x22f2('0xd')]);router[_0x22f2('0xe')]('/',auth['isAuthenticated'](),controller[_0x22f2('0xf')]);router[_0x22f2('0x10')]('/:id',auth[_0x22f2('0xa')](),controller[_0x22f2('0x11')]);router[_0x22f2('0x12')](_0x22f2('0xc'),auth[_0x22f2('0xa')](),controller[_0x22f2('0x13')]);module[_0x22f2('0x14')]=router; \ No newline at end of file +var _0x1371=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x5b6fe5,_0x5ddf47){var _0x5928d4=function(_0x3e0846){while(--_0x3e0846){_0x5b6fe5['push'](_0x5b6fe5['shift']());}};_0x5928d4(++_0x5ddf47);}(_0x1371,0x91));var _0x1137=function(_0x5cff43,_0x5e0171){_0x5cff43=_0x5cff43-0x0;var _0x1633d3=_0x1371[_0x5cff43];return _0x1633d3;};'use strict';var multer=require(_0x1137('0x0'));var util=require(_0x1137('0x1'));var path=require(_0x1137('0x2'));var timeout=require('connect-timeout');var express=require(_0x1137('0x3'));var router=express[_0x1137('0x4')]();var fs_extra=require(_0x1137('0x5'));var auth=require(_0x1137('0x6'));var interaction=require(_0x1137('0x7'));var config=require(_0x1137('0x8'));var controller=require(_0x1137('0x9'));router[_0x1137('0xa')]('/',auth['isAuthenticated'](),controller[_0x1137('0xb')]);router['get'](_0x1137('0xc'),auth[_0x1137('0xd')](),controller[_0x1137('0xe')]);router[_0x1137('0xf')]('/',auth['isAuthenticated'](),controller[_0x1137('0x10')]);router[_0x1137('0x11')](_0x1137('0xc'),auth[_0x1137('0xd')](),controller['update']);router[_0x1137('0x12')]('/:id',auth[_0x1137('0xd')](),controller[_0x1137('0x13')]);module[_0x1137('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 907f597..d393ed0 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 _0xb822=['sequelize','exports','STRING'];(function(_0x2039f7,_0x2a781b){var _0x41c7a8=function(_0x331f7c){while(--_0x331f7c){_0x2039f7['push'](_0x2039f7['shift']());}};_0x41c7a8(++_0x2a781b);}(_0xb822,0x93));var _0x2b82=function(_0x5eda14,_0x978e53){_0x5eda14=_0x5eda14-0x0;var _0x3c526c=_0xb822[_0x5eda14];return _0x3c526c;};'use strict';var Sequelize=require(_0x2b82('0x0'));module[_0x2b82('0x1')]={'name':{'type':Sequelize[_0x2b82('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x2b82('0x2')]}}; \ No newline at end of file +var _0xe8ab=['sequelize','exports','name','STRING'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xe8ab,0x144));var _0xbe8a=function(_0x1ddf2d,_0x2ed4da){_0x1ddf2d=_0x1ddf2d-0x0;var _0x414e9b=_0xe8ab[_0x1ddf2d];return _0x414e9b;};'use strict';var Sequelize=require(_0xbe8a('0x0'));module[_0xbe8a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xbe8a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xbe8a('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 9e17a22..00af6f2 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 _0xe9b4=['Pause','fieldName','type','model','query','keys','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','attributes','include','merge','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','Pauses','UserProfileResource','error','stack','name','send','map'];(function(_0x5c5dd2,_0x5b8f50){var _0x4dcb33=function(_0x3e15e5){while(--_0x3e15e5){_0x5c5dd2['push'](_0x5c5dd2['shift']());}};_0x4dcb33(++_0x5b8f50);}(_0xe9b4,0xbd));var _0x4e9b=function(_0x28bc9e,_0x333f2b){_0x28bc9e=_0x28bc9e-0x0;var _0x5d1a43=_0xe9b4[_0x28bc9e];return _0x5d1a43;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4e9b('0x0'));var jsonpatch=require(_0x4e9b('0x1'));var rp=require(_0x4e9b('0x2'));var moment=require('moment');var BPromise=require(_0x4e9b('0x3'));var Mustache=require(_0x4e9b('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4e9b('0x5'));var ejs=require(_0x4e9b('0x6'));var fs=require('fs');var fs_extra=require(_0x4e9b('0x7'));var _=require(_0x4e9b('0x8'));var squel=require(_0x4e9b('0x9'));var crypto=require('crypto');var jsforce=require(_0x4e9b('0xa'));var deskjs=require(_0x4e9b('0xb'));var toCsv=require(_0x4e9b('0x5'));var querystring=require('querystring');var Papa=require(_0x4e9b('0xc'));var Redis=require('ioredis');var authService=require(_0x4e9b('0xd'));var qs=require(_0x4e9b('0xe'));var as=require(_0x4e9b('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4e9b('0x10'));var licenseUtil=require(_0x4e9b('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48ce0a,_0x26904a){_0x26904a=_0x26904a||0xcc;return function(_0x4549af){if(_0x4549af){return _0x48ce0a[_0x4e9b('0x12')](_0x26904a);}return _0x48ce0a['status'](_0x26904a)[_0x4e9b('0x13')]();};}function respondWithResult(_0x2a3717,_0x319e64){_0x319e64=_0x319e64||0xc8;return function(_0x32b556){if(_0x32b556){return _0x2a3717[_0x4e9b('0x14')](_0x319e64)[_0x4e9b('0x15')](_0x32b556);}};}function respondWithFilteredResult(_0x5687a6,_0x555f73){return function(_0x2ad664){if(_0x2ad664){var _0x84c552=typeof _0x555f73[_0x4e9b('0x16')]===_0x4e9b('0x17')&&typeof _0x555f73[_0x4e9b('0x18')]===_0x4e9b('0x17');var _0x2f7340=_0x2ad664[_0x4e9b('0x19')];var _0x46fdc6=_0x84c552?0x0:_0x555f73[_0x4e9b('0x16')];var _0x1892bb=_0x84c552?_0x2ad664['count']:_0x555f73['offset']+_0x555f73['limit'];var _0x338024;if(_0x1892bb>=_0x2f7340){_0x1892bb=_0x2f7340;_0x338024=0xc8;}else{_0x338024=0xce;}_0x5687a6[_0x4e9b('0x14')](_0x338024);return _0x5687a6['set'](_0x4e9b('0x1a'),_0x46fdc6+'-'+_0x1892bb+'/'+_0x2f7340)[_0x4e9b('0x15')](_0x2ad664);}return null;};}function patchUpdates(_0x359df9){return function(_0x474a21){try{jsonpatch['apply'](_0x474a21,_0x359df9,!![]);}catch(_0x499af4){return BPromise[_0x4e9b('0x1b')](_0x499af4);}return _0x474a21[_0x4e9b('0x1c')]();};}function saveUpdates(_0x112677,_0x56ad16){return function(_0x9468f9){if(_0x9468f9){return _0x9468f9[_0x4e9b('0x1d')](_0x112677)[_0x4e9b('0x1e')](function(_0x31bd32){return _0x31bd32;});}return null;};}function removeEntity(_0x5aad44,_0x3d77a6){return function(_0x1b93dc){if(_0x1b93dc){return _0x1b93dc[_0x4e9b('0x1f')]()[_0x4e9b('0x1e')](function(){var _0x3ae30a=_0x1b93dc['get']({'plain':!![]});var _0x4e9393=_0x4e9b('0x20');return db[_0x4e9b('0x21')]['destroy']({'where':{'type':_0x4e9393,'resourceId':_0x3ae30a['id']}})[_0x4e9b('0x1e')](function(){return _0x1b93dc;});})[_0x4e9b('0x1e')](function(){_0x5aad44[_0x4e9b('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a8a5e,_0xc7c84c){return function(_0x1c90c6){if(!_0x1c90c6){_0x3a8a5e['sendStatus'](0x194);}return _0x1c90c6;};}function handleError(_0xb0e3d7,_0x136e93){_0x136e93=_0x136e93||0x1f4;return function(_0x41a315){logger[_0x4e9b('0x22')](_0x41a315[_0x4e9b('0x23')]);if(_0x41a315['name']){delete _0x41a315[_0x4e9b('0x24')];}_0xb0e3d7[_0x4e9b('0x14')](_0x136e93)[_0x4e9b('0x25')](_0x41a315);};}exports['index']=function(_0x49f00a,_0x58b898){var _0x32c1e2={},_0x57526a={},_0x24c386={'count':0x0,'rows':[]};var _0x85d003=_[_0x4e9b('0x26')](db[_0x4e9b('0x27')]['rawAttributes'],function(_0x31139a){return{'name':_0x31139a[_0x4e9b('0x28')],'type':_0x31139a[_0x4e9b('0x29')]['key']};});_0x57526a[_0x4e9b('0x2a')]=_[_0x4e9b('0x26')](_0x85d003,'name');_0x57526a[_0x4e9b('0x2b')]=_[_0x4e9b('0x2c')](_0x49f00a[_0x4e9b('0x2b')]);_0x57526a['filters']=_[_0x4e9b('0x2d')](_0x57526a['model'],_0x57526a[_0x4e9b('0x2b')]);_0x32c1e2['attributes']=_[_0x4e9b('0x2d')](_0x57526a[_0x4e9b('0x2a')],qs[_0x4e9b('0x2e')](_0x49f00a['query'][_0x4e9b('0x2e')]));_0x32c1e2['attributes']=_0x32c1e2['attributes'][_0x4e9b('0x2f')]?_0x32c1e2['attributes']:_0x57526a[_0x4e9b('0x2a')];if(!_0x49f00a[_0x4e9b('0x2b')][_0x4e9b('0x30')](_0x4e9b('0x31'))){_0x32c1e2['limit']=qs[_0x4e9b('0x18')](_0x49f00a['query'][_0x4e9b('0x18')]);_0x32c1e2[_0x4e9b('0x16')]=qs[_0x4e9b('0x16')](_0x49f00a[_0x4e9b('0x2b')]['offset']);}_0x32c1e2[_0x4e9b('0x32')]=qs[_0x4e9b('0x33')](_0x49f00a[_0x4e9b('0x2b')][_0x4e9b('0x33')]);_0x32c1e2[_0x4e9b('0x34')]=qs[_0x4e9b('0x35')](_[_0x4e9b('0x36')](_0x49f00a[_0x4e9b('0x2b')],_0x57526a[_0x4e9b('0x35')]),_0x85d003);if(_0x49f00a[_0x4e9b('0x2b')]['filter']){_0x32c1e2[_0x4e9b('0x34')]=_['merge'](_0x32c1e2[_0x4e9b('0x34')],{'$or':_[_0x4e9b('0x26')](_0x85d003,function(_0x89d29d){if(_0x89d29d[_0x4e9b('0x29')]!==_0x4e9b('0x37')){var _0x58f129={};_0x58f129[_0x89d29d[_0x4e9b('0x24')]]={'$like':'%'+_0x49f00a[_0x4e9b('0x2b')][_0x4e9b('0x38')]+'%'};return _0x58f129;}})});}_0x32c1e2=_['merge']({},_0x32c1e2,_0x49f00a[_0x4e9b('0x39')]);var _0x5c1619={'where':_0x32c1e2[_0x4e9b('0x34')]};return db['Pause'][_0x4e9b('0x19')](_0x5c1619)[_0x4e9b('0x1e')](function(_0x153740){_0x24c386['count']=_0x153740;if(_0x49f00a[_0x4e9b('0x2b')][_0x4e9b('0x3a')]){_0x32c1e2['include']=[{'all':!![]}];}return db[_0x4e9b('0x27')][_0x4e9b('0x3b')](_0x32c1e2);})['then'](function(_0x17de3a){_0x24c386[_0x4e9b('0x3c')]=_0x17de3a;return _0x24c386;})[_0x4e9b('0x1e')](respondWithFilteredResult(_0x58b898,_0x32c1e2))[_0x4e9b('0x3d')](handleError(_0x58b898,null));};exports[_0x4e9b('0x3e')]=function(_0x143314,_0x5abb8b){var _0x19e1a9={'raw':!![],'where':{'id':_0x143314[_0x4e9b('0x3f')]['id']}},_0x1aeec2={};_0x1aeec2[_0x4e9b('0x2a')]=_[_0x4e9b('0x2c')](db[_0x4e9b('0x27')]['rawAttributes']);_0x1aeec2[_0x4e9b('0x2b')]=_[_0x4e9b('0x2c')](_0x143314[_0x4e9b('0x2b')]);_0x1aeec2[_0x4e9b('0x35')]=_[_0x4e9b('0x2d')](_0x1aeec2['model'],_0x1aeec2[_0x4e9b('0x2b')]);_0x19e1a9[_0x4e9b('0x40')]=_[_0x4e9b('0x2d')](_0x1aeec2[_0x4e9b('0x2a')],qs[_0x4e9b('0x2e')](_0x143314[_0x4e9b('0x2b')][_0x4e9b('0x2e')]));_0x19e1a9[_0x4e9b('0x40')]=_0x19e1a9[_0x4e9b('0x40')][_0x4e9b('0x2f')]?_0x19e1a9['attributes']:_0x1aeec2[_0x4e9b('0x2a')];if(_0x143314[_0x4e9b('0x2b')][_0x4e9b('0x3a')]){_0x19e1a9[_0x4e9b('0x41')]=[{'all':!![]}];}_0x19e1a9=_[_0x4e9b('0x42')]({},_0x19e1a9,_0x143314[_0x4e9b('0x39')]);return db[_0x4e9b('0x27')]['find'](_0x19e1a9)['then'](handleEntityNotFound(_0x5abb8b,null))[_0x4e9b('0x1e')](respondWithResult(_0x5abb8b,null))[_0x4e9b('0x3d')](handleError(_0x5abb8b,null));};exports[_0x4e9b('0x43')]=function(_0x74ec76,_0x4dda0e){return db[_0x4e9b('0x27')][_0x4e9b('0x43')](_0x74ec76[_0x4e9b('0x44')],{})['then'](function(_0x2c436b){var _0x360adf=_0x74ec76[_0x4e9b('0x45')][_0x4e9b('0x46')]({'plain':!![]});if(!_0x360adf)throw new Error(_0x4e9b('0x47'));if(_0x360adf['role']===_0x4e9b('0x45')){var _0x1c649f=_0x2c436b['get']({'plain':!![]});var _0x251b98=_0x4e9b('0x20');return db[_0x4e9b('0x48')][_0x4e9b('0x49')]({'where':{'name':_0x251b98,'userProfileId':_0x360adf['userProfileId']},'raw':!![]})['then'](function(_0x40c2d5){if(_0x40c2d5&&_0x40c2d5[_0x4e9b('0x4a')]===0x0){return db[_0x4e9b('0x21')][_0x4e9b('0x43')]({'name':_0x1c649f[_0x4e9b('0x24')],'resourceId':_0x1c649f['id'],'type':_0x40c2d5[_0x4e9b('0x24')],'sectionId':_0x40c2d5['id']},{})[_0x4e9b('0x1e')](function(){return _0x2c436b;});}else{return _0x2c436b;}})[_0x4e9b('0x3d')](function(_0x3cfc19){logger[_0x4e9b('0x22')](_0x4e9b('0x4b'),_0x3cfc19);throw _0x3cfc19;});}return _0x2c436b;})[_0x4e9b('0x1e')](respondWithResult(_0x4dda0e,0xc9))['catch'](handleError(_0x4dda0e,null));};exports['update']=function(_0xed36bd,_0x23b9b5){if(_0xed36bd['body']['id']){delete _0xed36bd[_0x4e9b('0x44')]['id'];}return db[_0x4e9b('0x27')]['find']({'where':{'id':_0xed36bd[_0x4e9b('0x3f')]['id']}})[_0x4e9b('0x1e')](handleEntityNotFound(_0x23b9b5,null))[_0x4e9b('0x1e')](saveUpdates(_0xed36bd[_0x4e9b('0x44')],null))[_0x4e9b('0x1e')](respondWithResult(_0x23b9b5,null))[_0x4e9b('0x3d')](handleError(_0x23b9b5,null));};exports['destroy']=function(_0x2849d6,_0x6a33d0){return db['Pause']['find']({'where':{'id':_0x2849d6['params']['id']}})[_0x4e9b('0x1e')](handleEntityNotFound(_0x6a33d0,null))[_0x4e9b('0x1e')](removeEntity(_0x6a33d0,null))[_0x4e9b('0x3d')](handleError(_0x6a33d0,null));}; \ No newline at end of file +var _0x82d2=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','save','then','destroy','get','Pauses','UserProfileResource','sendStatus','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','fields','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x2a6fd5,_0x3d6deb){var _0x43c6a4=function(_0x3aecb3){while(--_0x3aecb3){_0x2a6fd5['push'](_0x2a6fd5['shift']());}};_0x43c6a4(++_0x3d6deb);}(_0x82d2,0xed));var _0x282d=function(_0x1e2fba,_0x4dd7d3){_0x1e2fba=_0x1e2fba-0x0;var _0x596a72=_0x82d2[_0x1e2fba];return _0x596a72;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x282d('0x0'));var zipdir=require(_0x282d('0x1'));var jsonpatch=require(_0x282d('0x2'));var rp=require(_0x282d('0x3'));var moment=require(_0x282d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x282d('0x5'));var util=require(_0x282d('0x6'));var path=require(_0x282d('0x7'));var sox=require(_0x282d('0x8'));var csv=require('to-csv');var ejs=require(_0x282d('0x9'));var fs=require('fs');var fs_extra=require(_0x282d('0xa'));var _=require(_0x282d('0xb'));var squel=require(_0x282d('0xc'));var crypto=require(_0x282d('0xd'));var jsforce=require(_0x282d('0xe'));var deskjs=require(_0x282d('0xf'));var toCsv=require(_0x282d('0x10'));var querystring=require(_0x282d('0x11'));var Papa=require(_0x282d('0x12'));var Redis=require(_0x282d('0x13'));var authService=require(_0x282d('0x14'));var qs=require(_0x282d('0x15'));var as=require(_0x282d('0x16'));var hardwareService=require(_0x282d('0x17'));var logger=require(_0x282d('0x18'))('api');var utils=require(_0x282d('0x19'));var config=require(_0x282d('0x1a'));var licenseUtil=require(_0x282d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d7ba0,_0x3f26b5){_0x3f26b5=_0x3f26b5||0xcc;return function(_0x2c1069){if(_0x2c1069){return _0x2d7ba0['sendStatus'](_0x3f26b5);}return _0x2d7ba0[_0x282d('0x1c')](_0x3f26b5)[_0x282d('0x1d')]();};}function respondWithResult(_0x589384,_0x5a19f1){_0x5a19f1=_0x5a19f1||0xc8;return function(_0x582250){if(_0x582250){return _0x589384[_0x282d('0x1c')](_0x5a19f1)[_0x282d('0x1e')](_0x582250);}};}function respondWithFilteredResult(_0x44c9e1,_0x1cbb5b){return function(_0x51a8fe){if(_0x51a8fe){var _0x1267ec=typeof _0x1cbb5b['offset']===_0x282d('0x1f')&&typeof _0x1cbb5b[_0x282d('0x20')]==='undefined';var _0x3e4e02=_0x51a8fe['count'];var _0x2fc5d0=_0x1267ec?0x0:_0x1cbb5b['offset'];var _0x42a863=_0x1267ec?_0x51a8fe[_0x282d('0x21')]:_0x1cbb5b[_0x282d('0x22')]+_0x1cbb5b[_0x282d('0x20')];var _0x4a7ad8;if(_0x42a863>=_0x3e4e02){_0x42a863=_0x3e4e02;_0x4a7ad8=0xc8;}else{_0x4a7ad8=0xce;}_0x44c9e1[_0x282d('0x1c')](_0x4a7ad8);return _0x44c9e1[_0x282d('0x23')](_0x282d('0x24'),_0x2fc5d0+'-'+_0x42a863+'/'+_0x3e4e02)[_0x282d('0x1e')](_0x51a8fe);}return null;};}function patchUpdates(_0x2b7bcb){return function(_0x49a7ab){try{jsonpatch['apply'](_0x49a7ab,_0x2b7bcb,!![]);}catch(_0x44a3f7){return BPromise['reject'](_0x44a3f7);}return _0x49a7ab[_0x282d('0x25')]();};}function saveUpdates(_0x300f3e,_0x4cdf42){return function(_0xde5900){if(_0xde5900){return _0xde5900['update'](_0x300f3e)[_0x282d('0x26')](function(_0x290612){return _0x290612;});}return null;};}function removeEntity(_0x542b1a,_0x1656d2){return function(_0x26c413){if(_0x26c413){return _0x26c413[_0x282d('0x27')]()[_0x282d('0x26')](function(){var _0x5f532c=_0x26c413[_0x282d('0x28')]({'plain':!![]});var _0x58e98f=_0x282d('0x29');return db[_0x282d('0x2a')][_0x282d('0x27')]({'where':{'type':_0x58e98f,'resourceId':_0x5f532c['id']}})[_0x282d('0x26')](function(){return _0x26c413;});})[_0x282d('0x26')](function(){_0x542b1a[_0x282d('0x1c')](0xcc)[_0x282d('0x1d')]();});}};}function handleEntityNotFound(_0x4a68f1,_0x5539b2){return function(_0x5d0fce){if(!_0x5d0fce){_0x4a68f1[_0x282d('0x2b')](0x194);}return _0x5d0fce;};}function handleError(_0x4e3944,_0xbab2c0){_0xbab2c0=_0xbab2c0||0x1f4;return function(_0x4ee408){logger[_0x282d('0x2c')](_0x4ee408[_0x282d('0x2d')]);if(_0x4ee408['name']){delete _0x4ee408[_0x282d('0x2e')];}_0x4e3944['status'](_0xbab2c0)[_0x282d('0x2f')](_0x4ee408);};}exports[_0x282d('0x30')]=function(_0x3e7cf4,_0x9b4460){var _0x448ebf={},_0x12ddee={},_0x1136a6={'count':0x0,'rows':[]};var _0x4dfa32=_[_0x282d('0x31')](db[_0x282d('0x32')][_0x282d('0x33')],function(_0x4085fa){return{'name':_0x4085fa[_0x282d('0x34')],'type':_0x4085fa[_0x282d('0x35')][_0x282d('0x36')]};});_0x12ddee['model']=_[_0x282d('0x31')](_0x4dfa32,'name');_0x12ddee['query']=_['keys'](_0x3e7cf4[_0x282d('0x37')]);_0x12ddee[_0x282d('0x38')]=_[_0x282d('0x39')](_0x12ddee['model'],_0x12ddee[_0x282d('0x37')]);_0x448ebf[_0x282d('0x3a')]=_[_0x282d('0x39')](_0x12ddee[_0x282d('0x3b')],qs['fields'](_0x3e7cf4[_0x282d('0x37')]['fields']));_0x448ebf['attributes']=_0x448ebf[_0x282d('0x3a')][_0x282d('0x3c')]?_0x448ebf[_0x282d('0x3a')]:_0x12ddee[_0x282d('0x3b')];if(!_0x3e7cf4['query']['hasOwnProperty'](_0x282d('0x3d'))){_0x448ebf['limit']=qs[_0x282d('0x20')](_0x3e7cf4[_0x282d('0x37')][_0x282d('0x20')]);_0x448ebf[_0x282d('0x22')]=qs['offset'](_0x3e7cf4[_0x282d('0x37')][_0x282d('0x22')]);}_0x448ebf['order']=qs[_0x282d('0x3e')](_0x3e7cf4[_0x282d('0x37')][_0x282d('0x3e')]);_0x448ebf['where']=qs[_0x282d('0x38')](_[_0x282d('0x3f')](_0x3e7cf4['query'],_0x12ddee[_0x282d('0x38')]),_0x4dfa32);if(_0x3e7cf4[_0x282d('0x37')][_0x282d('0x40')]){_0x448ebf[_0x282d('0x41')]=_[_0x282d('0x42')](_0x448ebf[_0x282d('0x41')],{'$or':_[_0x282d('0x31')](_0x4dfa32,function(_0x1d5905){if(_0x1d5905[_0x282d('0x35')]!==_0x282d('0x43')){var _0x40fc0e={};_0x40fc0e[_0x1d5905[_0x282d('0x2e')]]={'$like':'%'+_0x3e7cf4[_0x282d('0x37')][_0x282d('0x40')]+'%'};return _0x40fc0e;}})});}_0x448ebf=_[_0x282d('0x42')]({},_0x448ebf,_0x3e7cf4[_0x282d('0x44')]);var _0x4d21c3={'where':_0x448ebf[_0x282d('0x41')]};return db['Pause'][_0x282d('0x21')](_0x4d21c3)['then'](function(_0x4617df){_0x1136a6[_0x282d('0x21')]=_0x4617df;if(_0x3e7cf4['query'][_0x282d('0x45')]){_0x448ebf['include']=[{'all':!![]}];}return db['Pause'][_0x282d('0x46')](_0x448ebf);})[_0x282d('0x26')](function(_0xee9a84){_0x1136a6[_0x282d('0x47')]=_0xee9a84;return _0x1136a6;})[_0x282d('0x26')](respondWithFilteredResult(_0x9b4460,_0x448ebf))[_0x282d('0x48')](handleError(_0x9b4460,null));};exports['show']=function(_0x2d454d,_0x1dfd6b){var _0x517517={'raw':!![],'where':{'id':_0x2d454d[_0x282d('0x49')]['id']}},_0xafac5d={};_0xafac5d['model']=_[_0x282d('0x4a')](db[_0x282d('0x32')][_0x282d('0x33')]);_0xafac5d[_0x282d('0x37')]=_[_0x282d('0x4a')](_0x2d454d[_0x282d('0x37')]);_0xafac5d[_0x282d('0x38')]=_['intersection'](_0xafac5d['model'],_0xafac5d[_0x282d('0x37')]);_0x517517['attributes']=_[_0x282d('0x39')](_0xafac5d['model'],qs['fields'](_0x2d454d[_0x282d('0x37')][_0x282d('0x4b')]));_0x517517[_0x282d('0x3a')]=_0x517517[_0x282d('0x3a')][_0x282d('0x3c')]?_0x517517['attributes']:_0xafac5d[_0x282d('0x3b')];if(_0x2d454d['query'][_0x282d('0x45')]){_0x517517[_0x282d('0x4c')]=[{'all':!![]}];}_0x517517=_[_0x282d('0x42')]({},_0x517517,_0x2d454d['options']);return db[_0x282d('0x32')][_0x282d('0x4d')](_0x517517)[_0x282d('0x26')](handleEntityNotFound(_0x1dfd6b,null))[_0x282d('0x26')](respondWithResult(_0x1dfd6b,null))[_0x282d('0x48')](handleError(_0x1dfd6b,null));};exports[_0x282d('0x4e')]=function(_0x1396f5,_0x4855d0){return db[_0x282d('0x32')][_0x282d('0x4e')](_0x1396f5[_0x282d('0x4f')],{})[_0x282d('0x26')](function(_0x5cb34d){var _0x1a5e24=_0x1396f5[_0x282d('0x50')][_0x282d('0x28')]({'plain':!![]});if(!_0x1a5e24)throw new Error(_0x282d('0x51'));if(_0x1a5e24['role']===_0x282d('0x50')){var _0x2a02f9=_0x5cb34d[_0x282d('0x28')]({'plain':!![]});var _0x49907e='Pauses';return db['UserProfileSection']['find']({'where':{'name':_0x49907e,'userProfileId':_0x1a5e24['userProfileId']},'raw':!![]})[_0x282d('0x26')](function(_0x52329b){if(_0x52329b&&_0x52329b[_0x282d('0x52')]===0x0){return db[_0x282d('0x2a')][_0x282d('0x4e')]({'name':_0x2a02f9['name'],'resourceId':_0x2a02f9['id'],'type':_0x52329b[_0x282d('0x2e')],'sectionId':_0x52329b['id']},{})['then'](function(){return _0x5cb34d;});}else{return _0x5cb34d;}})[_0x282d('0x48')](function(_0x17574c){logger[_0x282d('0x2c')](_0x282d('0x53'),_0x17574c);throw _0x17574c;});}return _0x5cb34d;})[_0x282d('0x26')](respondWithResult(_0x4855d0,0xc9))[_0x282d('0x48')](handleError(_0x4855d0,null));};exports[_0x282d('0x54')]=function(_0x1e9504,_0x4bb9a8){if(_0x1e9504[_0x282d('0x4f')]['id']){delete _0x1e9504[_0x282d('0x4f')]['id'];}return db['Pause'][_0x282d('0x4d')]({'where':{'id':_0x1e9504[_0x282d('0x49')]['id']}})[_0x282d('0x26')](handleEntityNotFound(_0x4bb9a8,null))[_0x282d('0x26')](saveUpdates(_0x1e9504[_0x282d('0x4f')],null))[_0x282d('0x26')](respondWithResult(_0x4bb9a8,null))[_0x282d('0x48')](handleError(_0x4bb9a8,null));};exports[_0x282d('0x27')]=function(_0x2c0eaf,_0x3de850){return db[_0x282d('0x32')][_0x282d('0x4d')]({'where':{'id':_0x2c0eaf[_0x282d('0x49')]['id']}})[_0x282d('0x26')](handleEntityNotFound(_0x3de850,null))['then'](removeEntity(_0x3de850,null))['catch'](handleError(_0x3de850,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 7208967..d572956 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x428c50,_0x49dc7a){_0x428c50=_0x428c50-0x0;var _0x3779b6=_0x7fbe[_0x428c50];return _0x3779b6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc4aa[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 662cb57..e6e3535 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(_0x5e5dbc,_0x3cefe8){var _0x5df6b4=function(_0x2e2b1f){while(--_0x2e2b1f){_0x5e5dbc['push'](_0x5e5dbc['shift']());}};_0x5df6b4(++_0x3cefe8);}(_0xb10b,0x12a));var _0xbb10=function(_0xef9edb,_0x406d7b){_0xef9edb=_0xef9edb-0x0;var _0x3583e3=_0xb10b[_0xef9edb];return _0x3583e3;};'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(_0x15bc1b,_0x5433aa){var _0x1550df=function(_0x463804){while(--_0x463804){_0x15bc1b['push'](_0x15bc1b['shift']());}};_0x1550df(++_0x5433aa);}(_0x7a54,0x106));var _0x47a5=function(_0x2ec2d9,_0x5e4d56){_0x2ec2d9=_0x2ec2d9-0x0;var _0x225147=_0x7a54[_0x2ec2d9];return _0x225147;};'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 3f993fe..a1b0af5 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 _0x0c02=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/:id','show','/:id/download','join','root','server/files/plugins','replace','format','%s-%s%s','basename','originalname','extname','now','post','single','file','upload','/webhook','update','delete','exports'];(function(_0x3828c3,_0x429e9a){var _0x3929f5=function(_0x5e9b1c){while(--_0x5e9b1c){_0x3828c3['push'](_0x3828c3['shift']());}};_0x3929f5(++_0x429e9a);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x20c0('0x0'));var path=require(_0x20c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x20c0('0x2'));var router=express[_0x20c0('0x3')]();var fs_extra=require(_0x20c0('0x4'));var auth=require(_0x20c0('0x5'));var interaction=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var controller=require(_0x20c0('0x8'));router[_0x20c0('0x9')]('/',auth[_0x20c0('0xa')](),controller[_0x20c0('0xb')]);router['get']('/webhook',controller['webhookGet']);router['get'](_0x20c0('0xc'),auth[_0x20c0('0xa')](),controller[_0x20c0('0xd')]);router[_0x20c0('0x9')](_0x20c0('0xe'),auth[_0x20c0('0xa')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x52eb0d,_0x578592,_0x56770a){_0x56770a(null,path[_0x20c0('0xf')](config[_0x20c0('0x10')],_0x20c0('0x11')));},'filename':function(_0x207b1e,_0x4ed79e,_0x56fa09){_0x4ed79e['originalname']=_0x4ed79e['originalname'][_0x20c0('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x56fa09(null,util[_0x20c0('0x13')](_0x20c0('0x14'),path[_0x20c0('0x15')](_0x4ed79e[_0x20c0('0x16')],path[_0x20c0('0x17')](_0x4ed79e[_0x20c0('0x16')])),Date[_0x20c0('0x18')](),path[_0x20c0('0x17')](_0x4ed79e['originalname'])));}})});router[_0x20c0('0x19')]('/',upload[_0x20c0('0x1a')](_0x20c0('0x1b')),controller[_0x20c0('0x1c')]);router[_0x20c0('0x19')](_0x20c0('0x1d'),controller['webhookPost']);router['put']('/:id',auth[_0x20c0('0xa')](),controller[_0x20c0('0x1e')]);router[_0x20c0('0x1f')](_0x20c0('0xc'),auth['isAuthenticated'](),controller[_0x20c0('0x1f')]);module[_0x20c0('0x20')]=router; \ No newline at end of file +var _0x99e9=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','index','get','/webhook','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','post','single','file','upload','update','delete'];(function(_0x24a29f,_0x243d0e){var _0x52b241=function(_0x190e30){while(--_0x190e30){_0x24a29f['push'](_0x24a29f['shift']());}};_0x52b241(++_0x243d0e);}(_0x99e9,0xb4));var _0x999e=function(_0x359d3e,_0x9d9e5b){_0x359d3e=_0x359d3e-0x0;var _0x533931=_0x99e9[_0x359d3e];return _0x533931;};'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'),controller['webhookGet']);router[_0x999e('0xa')](_0x999e('0xc'),auth[_0x999e('0x8')](),controller[_0x999e('0xd')]);router[_0x999e('0xa')](_0x999e('0xe'),auth[_0x999e('0x8')](),controller[_0x999e('0xf')]);var upload=multer({'storage':multer[_0x999e('0x10')]({'destination':function(_0xf40130,_0x9368cf,_0x1d19b0){_0x1d19b0(null,path[_0x999e('0x11')](config[_0x999e('0x12')],_0x999e('0x13')));},'filename':function(_0xdb587b,_0x26b55a,_0x47a3c1){_0x26b55a[_0x999e('0x14')]=_0x26b55a['originalname'][_0x999e('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x47a3c1(null,util[_0x999e('0x16')](_0x999e('0x17'),path['basename'](_0x26b55a[_0x999e('0x14')],path['extname'](_0x26b55a[_0x999e('0x14')])),Date['now'](),path['extname'](_0x26b55a[_0x999e('0x14')])));}})});router[_0x999e('0x18')]('/',upload[_0x999e('0x19')](_0x999e('0x1a')),controller[_0x999e('0x1b')]);router[_0x999e('0x18')]('/webhook',controller['webhookPost']);router['put'](_0x999e('0xc'),auth[_0x999e('0x8')](),controller[_0x999e('0x1c')]);router[_0x999e('0x1d')](_0x999e('0xc'),auth[_0x999e('0x8')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 8277059..51caf11 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 _0xd6cb=['ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','STRING'];(function(_0x4a3eef,_0x16388a){var _0x2d5b79=function(_0x530975){while(--_0x530975){_0x4a3eef['push'](_0x4a3eef['shift']());}};_0x2d5b79(++_0x16388a);}(_0xd6cb,0xe6));var _0xbd6c=function(_0x5e56de,_0x189fa7){_0x5e56de=_0x5e56de-0x0;var _0x26c6ec=_0xd6cb[_0x5e56de];return _0x26c6ec;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbd6c('0x0')]},'type':{'type':Sequelize[_0xbd6c('0x1')](_0xbd6c('0x2'),'script')},'description':{'type':Sequelize[_0xbd6c('0x3')]},'version':{'type':Sequelize[_0xbd6c('0x3')]},'path':{'type':Sequelize['STRING'],'comment':_0xbd6c('0x4')},'active':{'type':Sequelize[_0xbd6c('0x5')],'defaultValue':0x0,'comment':_0xbd6c('0x6')},'sidebar':{'type':Sequelize['ENUM'](_0xbd6c('0x7'),_0xbd6c('0x8'),_0xbd6c('0x9'),_0xbd6c('0xa')),'defaultValue':_0xbd6c('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xbd6c('0x0')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xbd6c('0x0')]},'scriptName':{'type':Sequelize[_0xbd6c('0x0')]},'scriptPath':{'type':Sequelize[_0xbd6c('0x0')]}}; \ No newline at end of file +var _0xa4ec=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xa4ec,0x16f));var _0xca4e=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xa4ec[_0x2cf2e9];return _0xd3670d;};'use strict';var Sequelize=require(_0xca4e('0x0'));module[_0xca4e('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xca4e('0x2')]('html',_0xca4e('0x3'))},'description':{'type':Sequelize[_0xca4e('0x4')]},'version':{'type':Sequelize[_0xca4e('0x4')]},'path':{'type':Sequelize[_0xca4e('0x5')],'comment':_0xca4e('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xca4e('0x7')},'sidebar':{'type':Sequelize[_0xca4e('0x2')]('adminOnly',_0xca4e('0x8'),_0xca4e('0x9'),'never'),'defaultValue':'always','comment':_0xca4e('0xa')},'icon':{'type':Sequelize[_0xca4e('0x5')]},'adminUrl':{'type':Sequelize[_0xca4e('0x5')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xca4e('0x5')]},'scriptPath':{'type':Sequelize[_0xca4e('0x5')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 74081c4..cec6549 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 _0x7d16=['destroy','get','Plugins','UserProfileResource','sendStatus','error','stack','name','index','map','Plugin','rawAttributes','type','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','download','find','join','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','length','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','method','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then'];(function(_0x18c99c,_0x330b28){var _0x28575e=function(_0x5c6851){while(--_0x5c6851){_0x18c99c['push'](_0x18c99c['shift']());}};_0x28575e(++_0x330b28);}(_0x7d16,0x1e0));var _0x67d1=function(_0x4fb377,_0x3210e3){_0x4fb377=_0x4fb377-0x0;var _0x592919=_0x7d16[_0x4fb377];return _0x592919;};'use strict';var emlformat=require(_0x67d1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x67d1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x67d1('0x2'));var moment=require(_0x67d1('0x3'));var BPromise=require(_0x67d1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x67d1('0x5'));var sox=require(_0x67d1('0x6'));var csv=require('to-csv');var ejs=require(_0x67d1('0x7'));var fs=require('fs');var fs_extra=require(_0x67d1('0x8'));var _=require(_0x67d1('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x67d1('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x67d1('0xb'));var querystring=require(_0x67d1('0xc'));var Papa=require(_0x67d1('0xd'));var extract=require(_0x67d1('0xe'));var rimraf=require(_0x67d1('0xf'));var archiver=require(_0x67d1('0x10'));var Redis=require(_0x67d1('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x67d1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x67d1('0x13'))(_0x67d1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x67d1('0x15'));var db=require(_0x67d1('0x16'))['db'];config['redis']=_[_0x67d1('0x17')](config[_0x67d1('0x18')],{'host':_0x67d1('0x19'),'port':0x18eb});var socket=require(_0x67d1('0x1a'))(new Redis(config[_0x67d1('0x18')]));require(_0x67d1('0x1b'))['register'](socket);function respondWithStatusCode(_0x48dfda,_0x41bc55){_0x41bc55=_0x41bc55||0xcc;return function(_0x3cf959){if(_0x3cf959){return _0x48dfda['sendStatus'](_0x41bc55);}return _0x48dfda[_0x67d1('0x1c')](_0x41bc55)[_0x67d1('0x1d')]();};}function respondWithResult(_0x1c9f17,_0x23bff1){_0x23bff1=_0x23bff1||0xc8;return function(_0x29f75d){if(_0x29f75d){return _0x1c9f17[_0x67d1('0x1c')](_0x23bff1)[_0x67d1('0x1e')](_0x29f75d);}};}function respondWithFilteredResult(_0x5654ef,_0x5ea7c2){return function(_0x5e8d78){if(_0x5e8d78){var _0x331817=typeof _0x5ea7c2[_0x67d1('0x1f')]===_0x67d1('0x20')&&typeof _0x5ea7c2[_0x67d1('0x21')]===_0x67d1('0x20');var _0x3bac99=_0x5e8d78['count'];var _0x18e7dd=_0x331817?0x0:_0x5ea7c2[_0x67d1('0x1f')];var _0x10c1ad=_0x331817?_0x5e8d78[_0x67d1('0x22')]:_0x5ea7c2[_0x67d1('0x1f')]+_0x5ea7c2['limit'];var _0x59adff;if(_0x10c1ad>=_0x3bac99){_0x10c1ad=_0x3bac99;_0x59adff=0xc8;}else{_0x59adff=0xce;}_0x5654ef[_0x67d1('0x1c')](_0x59adff);return _0x5654ef[_0x67d1('0x23')](_0x67d1('0x24'),_0x18e7dd+'-'+_0x10c1ad+'/'+_0x3bac99)['json'](_0x5e8d78);}return null;};}function patchUpdates(_0x45c9e4){return function(_0x3d87af){try{jsonpatch['apply'](_0x3d87af,_0x45c9e4,!![]);}catch(_0xecbbcd){return BPromise['reject'](_0xecbbcd);}return _0x3d87af['save']();};}function saveUpdates(_0x4bf234,_0x4f304b){return function(_0x2940ef){if(_0x2940ef){return _0x2940ef[_0x67d1('0x25')](_0x4bf234)[_0x67d1('0x26')](function(_0x273717){return _0x273717;});}return null;};}function removeEntity(_0x15188a,_0x10b167){return function(_0x572442){if(_0x572442){return _0x572442[_0x67d1('0x27')]()[_0x67d1('0x26')](function(){var _0x4c83a2=_0x572442[_0x67d1('0x28')]({'plain':!![]});var _0x43a97f=_0x67d1('0x29');return db[_0x67d1('0x2a')]['destroy']({'where':{'type':_0x43a97f,'resourceId':_0x4c83a2['id']}})[_0x67d1('0x26')](function(){return _0x572442;});})[_0x67d1('0x26')](function(){_0x15188a['status'](0xcc)[_0x67d1('0x1d')]();});}};}function handleEntityNotFound(_0x3c3d28,_0x494af4){return function(_0x509188){if(!_0x509188){_0x3c3d28[_0x67d1('0x2b')](0x194);}return _0x509188;};}function handleError(_0x4e65dc,_0x5c78d4){_0x5c78d4=_0x5c78d4||0x1f4;return function(_0x207de7){logger[_0x67d1('0x2c')](_0x207de7[_0x67d1('0x2d')]);if(_0x207de7[_0x67d1('0x2e')]){delete _0x207de7[_0x67d1('0x2e')];}_0x4e65dc[_0x67d1('0x1c')](_0x5c78d4)['send'](_0x207de7);};}exports[_0x67d1('0x2f')]=function(_0x2b855e,_0x55bc6d){var _0x50aa6a={},_0x199367={},_0x38d0ce={'count':0x0,'rows':[]};var _0x2a9d7d=_[_0x67d1('0x30')](db[_0x67d1('0x31')][_0x67d1('0x32')],function(_0x5a561c){return{'name':_0x5a561c['fieldName'],'type':_0x5a561c[_0x67d1('0x33')]['key']};});_0x199367['model']=_['map'](_0x2a9d7d,_0x67d1('0x2e'));_0x199367[_0x67d1('0x34')]=_[_0x67d1('0x35')](_0x2b855e[_0x67d1('0x34')]);_0x199367[_0x67d1('0x36')]=_[_0x67d1('0x37')](_0x199367['model'],_0x199367[_0x67d1('0x34')]);_0x50aa6a[_0x67d1('0x38')]=_[_0x67d1('0x37')](_0x199367['model'],qs[_0x67d1('0x39')](_0x2b855e[_0x67d1('0x34')][_0x67d1('0x39')]));_0x50aa6a[_0x67d1('0x38')]=_0x50aa6a[_0x67d1('0x38')]['length']?_0x50aa6a[_0x67d1('0x38')]:_0x199367[_0x67d1('0x3a')];if(!_0x2b855e[_0x67d1('0x34')][_0x67d1('0x3b')](_0x67d1('0x3c'))){_0x50aa6a[_0x67d1('0x21')]=qs['limit'](_0x2b855e[_0x67d1('0x34')][_0x67d1('0x21')]);_0x50aa6a[_0x67d1('0x1f')]=qs['offset'](_0x2b855e[_0x67d1('0x34')][_0x67d1('0x1f')]);}_0x50aa6a[_0x67d1('0x3d')]=qs[_0x67d1('0x3e')](_0x2b855e[_0x67d1('0x34')][_0x67d1('0x3e')]);_0x50aa6a[_0x67d1('0x3f')]=qs[_0x67d1('0x36')](_['pick'](_0x2b855e[_0x67d1('0x34')],_0x199367[_0x67d1('0x36')]),_0x2a9d7d);if(_0x2b855e[_0x67d1('0x34')][_0x67d1('0x40')]){_0x50aa6a[_0x67d1('0x3f')]=_[_0x67d1('0x41')](_0x50aa6a[_0x67d1('0x3f')],{'$or':_[_0x67d1('0x30')](_0x2a9d7d,function(_0x3b1944){if(_0x3b1944[_0x67d1('0x33')]!==_0x67d1('0x42')){var _0x5afc78={};_0x5afc78[_0x3b1944['name']]={'$like':'%'+_0x2b855e['query'][_0x67d1('0x40')]+'%'};return _0x5afc78;}})});}_0x50aa6a=_[_0x67d1('0x41')]({},_0x50aa6a,_0x2b855e[_0x67d1('0x43')]);var _0x2ba4ab={'where':_0x50aa6a['where']};return db[_0x67d1('0x31')]['count'](_0x2ba4ab)[_0x67d1('0x26')](function(_0x19a653){_0x38d0ce['count']=_0x19a653;if(_0x2b855e[_0x67d1('0x34')][_0x67d1('0x44')]){_0x50aa6a['include']=[{'all':!![]}];}return db[_0x67d1('0x31')][_0x67d1('0x45')](_0x50aa6a);})[_0x67d1('0x26')](function(_0x8a6570){_0x38d0ce[_0x67d1('0x46')]=_0x8a6570;return _0x38d0ce;})[_0x67d1('0x26')](respondWithFilteredResult(_0x55bc6d,_0x50aa6a))[_0x67d1('0x47')](handleError(_0x55bc6d,null));};exports[_0x67d1('0x48')]=function(_0x1aa877,_0x159057){var _0x16cf69={'raw':!![],'where':{'id':_0x1aa877[_0x67d1('0x49')]['id']}},_0x4b13ed={};_0x4b13ed[_0x67d1('0x3a')]=_[_0x67d1('0x35')](db[_0x67d1('0x31')][_0x67d1('0x32')]);_0x4b13ed[_0x67d1('0x34')]=_[_0x67d1('0x35')](_0x1aa877[_0x67d1('0x34')]);_0x4b13ed[_0x67d1('0x36')]=_[_0x67d1('0x37')](_0x4b13ed[_0x67d1('0x3a')],_0x4b13ed[_0x67d1('0x34')]);_0x16cf69[_0x67d1('0x38')]=_[_0x67d1('0x37')](_0x4b13ed[_0x67d1('0x3a')],qs['fields'](_0x1aa877[_0x67d1('0x34')][_0x67d1('0x39')]));_0x16cf69['attributes']=_0x16cf69[_0x67d1('0x38')]['length']?_0x16cf69[_0x67d1('0x38')]:_0x4b13ed[_0x67d1('0x3a')];if(_0x1aa877[_0x67d1('0x34')][_0x67d1('0x44')]){_0x16cf69[_0x67d1('0x4a')]=[{'all':!![]}];}_0x16cf69=_['merge']({},_0x16cf69,_0x1aa877['options']);return db[_0x67d1('0x31')]['find'](_0x16cf69)[_0x67d1('0x26')](handleEntityNotFound(_0x159057,null))[_0x67d1('0x26')](respondWithResult(_0x159057,null))['catch'](handleError(_0x159057,null));};exports[_0x67d1('0x4b')]=function(_0xb515c9,_0x4917b3,_0x3984d0){return db[_0x67d1('0x31')][_0x67d1('0x4c')]({'where':{'id':_0xb515c9['params']['id']},'attributes':['name','path'],'raw':!![]})[_0x67d1('0x26')](handleEntityNotFound(_0x4917b3,null))['then'](function(_0x5dc3d8){if(_0x5dc3d8){var _0x4a9c3f=path[_0x67d1('0x4d')](config[_0x67d1('0x4e')],_0x67d1('0x4f'),util['format'](_0x67d1('0x50'),path[_0x67d1('0x51')](_0x5dc3d8[_0x67d1('0x5')])));var _0x28dfaf=fs[_0x67d1('0x52')](_0x4a9c3f);var _0x23233a=archiver(_0x67d1('0x53'),{'zlib':{'level':0x9}});_0x23233a['on']('warning',function(_0x417d93){if(_0x417d93[_0x67d1('0x54')]==='ENOENT'){logger['error'](_0x417d93);}else{throw new db[(_0x67d1('0x55'))][(_0x67d1('0x56'))](_0x67d1('0x57'));}});_0x23233a['on'](_0x67d1('0x2c'),function(_0x52ddd4){throw new db[(_0x67d1('0x55'))]['Error'](_0x67d1('0x57'));});_0x23233a[_0x67d1('0x58')](_0x28dfaf);_0x23233a[_0x67d1('0x59')](_0x67d1('0x5a'),{'cwd':path['join'](config[_0x67d1('0x4e')],_0x67d1('0x4f'),path[_0x67d1('0x5b')](_0x5dc3d8[_0x67d1('0x5')])),'ignore':[path[_0x67d1('0x4d')](path[_0x67d1('0x51')](_0x5dc3d8[_0x67d1('0x5')]),_0x67d1('0x5c')),path[_0x67d1('0x4d')](path[_0x67d1('0x51')](_0x5dc3d8[_0x67d1('0x5')]),_0x67d1('0x5d'))],'nodir':!![]})[_0x67d1('0x5e')]();_0x28dfaf['on'](_0x67d1('0x5f'),function(){if(!fs[_0x67d1('0x60')](_0x4a9c3f)){throw new db[(_0x67d1('0x55'))]['Error'](_0x67d1('0x61'));}return _0x4917b3[_0x67d1('0x4b')](_0x4a9c3f,util[_0x67d1('0x62')](_0x67d1('0x50'),path['basename'](_0x5dc3d8[_0x67d1('0x5')])),function(_0x4cd837){if(_0x4cd837){throw new db[(_0x67d1('0x55'))][(_0x67d1('0x56'))](_0x67d1('0x63'));}fs[_0x67d1('0x64')](_0x4a9c3f);logger['info'](_0x67d1('0x65'));logger[_0x67d1('0x66')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x4917b3,null));};exports[_0x67d1('0x67')]=function(_0x4c5562,_0x1074c3,_0x38972a){var _0x2800cb=path[_0x67d1('0x51')](_0x4c5562[_0x67d1('0x68')][_0x67d1('0x69')],path[_0x67d1('0x6a')](_0x4c5562['file'][_0x67d1('0x69')]));var _0x4b9b17=path[_0x67d1('0x4d')](config[_0x67d1('0x4e')],_0x67d1('0x4f'),_0x4c5562[_0x67d1('0x68')][_0x67d1('0x69')]);var _0x125ce6=path[_0x67d1('0x4d')](config['root'],_0x67d1('0x4f'),_0x2800cb);logger['info'](_0x67d1('0x6b'),_0x4b9b17);logger['info'](_0x67d1('0x6c'),_0x125ce6);try{fs['chmodSync'](_0x4b9b17,parseInt(_0x67d1('0x6d'),0x8));extract(_0x4b9b17,{'dir':_0x125ce6},function(_0x17f574){if(_0x17f574){logger['error'](_0x17f574);handleError(_0x17f574,!![]);};var _0x1162cd=fs['readdirSync'](_0x125ce6);if(_0x1162cd[_0x67d1('0x6e')]>0x1){removeReferences(_0x4b9b17,_0x125ce6);logger[_0x67d1('0x2c')]('Invalid\x20plugin\x20structure');return _0x38972a(new Error(_0x67d1('0x6f')));}var _0x28f1ff=fs[_0x67d1('0x70')](path[_0x67d1('0x4d')](_0x125ce6,_0x1162cd[0x0]));if(_0x28f1ff[_0x67d1('0x71')]()){removeReferences(_0x4b9b17,_0x125ce6);logger[_0x67d1('0x2c')](_0x67d1('0x6f'));return _0x38972a(new Error('Invalid\x20plugin\x20structure'));}if(_0x28f1ff[_0x67d1('0x72')]()){var _0xfe2737=fs[_0x67d1('0x73')](path['join'](_0x125ce6,_0x1162cd[0x0]));if(_0xfe2737[_0x67d1('0x6e')]===0x0){removeReferences(_0x4b9b17,_0x125ce6);logger[_0x67d1('0x2c')](_0x67d1('0x6f'));return _0x38972a(new Error(_0x67d1('0x6f')));}var _0x53a6db=_0xfe2737[_0x67d1('0x74')](function(_0x10bc51){return _0x10bc51===_0x67d1('0x75');});if(!_0x53a6db){return _0x38972a(new Error(_0x67d1('0x76')));}var _0x1f6bec=fs[_0x67d1('0x77')](path['join'](_0x125ce6,_0x1162cd[0x0],_0x67d1('0x75')));var _0x394e2b=JSON[_0x67d1('0x78')](_0x1f6bec);if(_0x67d1('0x20')==typeof _0x394e2b[_0x67d1('0x2e')]){return _0x38972a(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x67d1('0x20')==typeof _0x394e2b[_0x67d1('0x33')]){return _0x38972a(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x67d1('0x20')==typeof _0x394e2b['version']){return _0x38972a(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x67d1('0x20')==typeof _0x394e2b[_0x67d1('0x79')]){return _0x38972a(new Error(_0x67d1('0x7a')));}if(_0x394e2b[_0x67d1('0x33')]===_0x67d1('0x7b')){if(_0x67d1('0x20')==typeof _0x394e2b[_0x67d1('0x79')]['views']){return _0x38972a(new Error(_0x67d1('0x7c')));}if(_0x67d1('0x20')==typeof _0x394e2b[_0x67d1('0x79')][_0x67d1('0x7d')][_0x67d1('0x7e')]&&_0x67d1('0x20')==typeof _0x394e2b[_0x67d1('0x79')][_0x67d1('0x7d')][_0x67d1('0x7f')]){return _0x38972a(new Error(_0x67d1('0x80')));}}else if(_0x394e2b[_0x67d1('0x33')]==='script'){if('undefined'==typeof _0x394e2b[_0x67d1('0x79')][_0x67d1('0x81')]){return _0x38972a(new Error(_0x67d1('0x82')));}if(_0x67d1('0x20')==typeof _0x394e2b[_0x67d1('0x79')][_0x67d1('0x83')]){return _0x38972a(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x38972a(new Error(_0x67d1('0x84')));}var _0x283a79=_0x394e2b['name'];var _0x34bbda=_0x394e2b[_0x67d1('0x85')];var _0x232ee6=_0x394e2b['type'];var _0x2ee3ec=_0x394e2b[_0x67d1('0x86')]?_0x394e2b['sidebar']:_0x67d1('0x87');var _0x2106d2=_0x394e2b[_0x67d1('0x88')]?_0x394e2b['icon']:_0x67d1('0x89');var _0x5d2cc3='';var _0x35a85e='';var _0x15982b='';var _0x45cf9c='';var _0x33ca19=_0x394e2b[_0x67d1('0x8a')];if(_0x232ee6===_0x67d1('0x7b')){if(_0x67d1('0x20')!=typeof _0x394e2b[_0x67d1('0x79')][_0x67d1('0x7d')][_0x67d1('0x7e')]){var _0x38d929=_0x394e2b[_0x67d1('0x79')][_0x67d1('0x7d')][_0x67d1('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x67d1('0x8b')](_0x38d929)){_0x5d2cc3=path[_0x67d1('0x4d')](_0x67d1('0x8c'),_0x2800cb,_0x1162cd[0x0],_0x38d929);}else{_0x5d2cc3=_0x38d929;}}else{logger[_0x67d1('0x66')](_0x67d1('0x8d'));}if(_0x67d1('0x20')!=typeof _0x394e2b[_0x67d1('0x79')][_0x67d1('0x7d')]['agent']){var _0x4fa1d5=_0x394e2b['parameters'][_0x67d1('0x7d')][_0x67d1('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x67d1('0x8b')](_0x4fa1d5)){_0x35a85e=path[_0x67d1('0x4d')]('plugins',_0x2800cb,_0x1162cd[0x0],_0x4fa1d5);}else{_0x35a85e=_0x4fa1d5;}}else{logger[_0x67d1('0x66')](_0x67d1('0x8e'));}}else if(_0x232ee6===_0x67d1('0x8f')){_0x15982b=_0x394e2b[_0x67d1('0x79')]['scriptName'];_0x45cf9c=_0x394e2b[_0x67d1('0x79')]['scriptPath'];if('undefined'!=typeof _0x394e2b[_0x67d1('0x79')]['views']){if(_0x67d1('0x20')!=typeof _0x394e2b[_0x67d1('0x79')]['views'][_0x67d1('0x7e')]){var _0x38d929=_0x394e2b[_0x67d1('0x79')][_0x67d1('0x7d')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x67d1('0x8b')](_0x38d929)){_0x5d2cc3=path['join'](_0x67d1('0x8c'),_0x2800cb,_0x1162cd[0x0],_0x38d929);}else{_0x5d2cc3=_0x38d929;}}if(_0x67d1('0x20')!=typeof _0x394e2b[_0x67d1('0x79')][_0x67d1('0x7d')][_0x67d1('0x7f')]){var _0x4fa1d5=_0x394e2b['parameters'][_0x67d1('0x7d')][_0x67d1('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x67d1('0x8b')](_0x4fa1d5)){_0x35a85e=path[_0x67d1('0x4d')](_0x67d1('0x8c'),_0x2800cb,_0x1162cd[0x0],_0x4fa1d5);}else{_0x35a85e=_0x4fa1d5;}}}}var _0x4c2a1c={'name':_0x283a79,'description':_0x34bbda,'path':path[_0x67d1('0x4d')](_0x2800cb,_0x1162cd[0x0]),'type':_0x232ee6,'sidebar':_0x2ee3ec,'icon':_0x2106d2,'adminUrl':_0x5d2cc3,'agentUrl':_0x35a85e,'scriptName':_0x15982b,'scriptPath':_0x45cf9c,'version':_0x33ca19};removeReferences(_0x4b9b17,null);return db[_0x67d1('0x31')][_0x67d1('0x90')](_0x4c2a1c)[_0x67d1('0x26')](function(_0xed357){var _0x44c96a={'role':_0x4c5562[_0x67d1('0x91')][_0x67d1('0x92')],'userProfileId':_0x4c5562[_0x67d1('0x91')][_0x67d1('0x93')]};if(!_0x44c96a)throw new Error(_0x67d1('0x94'));if(_0x44c96a[_0x67d1('0x92')]===_0x67d1('0x95')){var _0x54f6fa=_0xed357[_0x67d1('0x28')]({'plain':!![]});return db[_0x67d1('0x96')][_0x67d1('0x4c')]({'where':{'name':_0x67d1('0x29'),'userProfileId':_0x44c96a[_0x67d1('0x93')]},'raw':!![]})[_0x67d1('0x26')](function(_0x312e85){if(_0x312e85&&_0x312e85[_0x67d1('0x97')]===0x0){return db['UserProfileResource'][_0x67d1('0x90')]({'name':_0x54f6fa[_0x67d1('0x2e')],'resourceId':_0x54f6fa['id'],'type':_0x312e85[_0x67d1('0x2e')],'sectionId':_0x312e85['id']},{})['then'](function(){return _0xed357;});}else{return _0xed357;}})[_0x67d1('0x47')](function(_0x32a9cc){logger['error'](_0x67d1('0x98'),_0x32a9cc);throw _0x32a9cc;});}return _0xed357;})[_0x67d1('0x26')](respondWithResult(_0x1074c3,null))[_0x67d1('0x47')](handleError(_0x1074c3,null));}});}catch(_0x5870cb){_0x1074c3[_0x67d1('0x1c')](0x1f4)[_0x67d1('0x99')](_0x5870cb);}};function removeReferences(_0x1eb810,_0xbcf016){try{if(_0x1eb810){fs[_0x67d1('0x64')](_0x1eb810);logger['info'](_0x67d1('0x9a'));}if(_0xbcf016){rimraf(_0xbcf016,function(){});logger[_0x67d1('0x66')](_0x67d1('0x9b'));}}catch(_0x2e340e){logger[_0x67d1('0x2c')](_0x2e340e);}}exports[_0x67d1('0x25')]=function(_0xebb0b,_0x3215d0,_0x3d7935){return db['Plugin'][_0x67d1('0x4c')]({'where':{'id':_0xebb0b[_0x67d1('0x49')]['id']}})[_0x67d1('0x26')](handleEntityNotFound(_0x3215d0,null))[_0x67d1('0x26')](saveUpdates(_0xebb0b[_0x67d1('0x91')],null))[_0x67d1('0x26')](respondWithResult(_0x3215d0,null))[_0x67d1('0x47')](handleError(_0x3215d0,null));};exports[_0x67d1('0x9c')]=function(_0x177512,_0x4f9aae,_0x4388aa){return db['Plugin']['find']({'where':{'id':_0x177512['params']['id']}})[_0x67d1('0x26')](function(_0x5434c4){if(_0x5434c4){return _0x5434c4[_0x67d1('0x27')]();}})['then'](function(_0x429d11){rimraf(path['join'](config[_0x67d1('0x4e')],_0x67d1('0x4f'),path[_0x67d1('0x5b')](_0x429d11[_0x67d1('0x5')])),function(){});return _0x429d11;})[_0x67d1('0x26')](handleEntityNotFound(_0x4f9aae,null))['then'](respondWithStatusCode(_0x4f9aae,null))['catch'](handleError(_0x4f9aae,null));};exports[_0x67d1('0x9d')]=function(_0x5d6f27,_0x3c8287,_0x24e09f){return BPromise[_0x67d1('0x9e')]()['then'](function(){if(!_0x5d6f27[_0x67d1('0x34')][_0x67d1('0x5')]){throw new Error(_0x67d1('0x9f'));}if(!_0x5d6f27['query']['port']){throw new Error(_0x67d1('0xa0'));}var _0x482674=_0x5d6f27['query']['hostname']?_0x5d6f27[_0x67d1('0x34')][_0x67d1('0xa1')]+':'+_0x5d6f27[_0x67d1('0x34')][_0x67d1('0xa2')]:_0x67d1('0xa3')+_0x5d6f27[_0x67d1('0x34')][_0x67d1('0xa2')];var _0x1c67d0=_0x5d6f27['query'][_0x67d1('0x1e')]?_0x5d6f27['query'][_0x67d1('0x1e')]:!![];var _0x5e149c=_0x5d6f27[_0x67d1('0x34')][_0x67d1('0xa4')]?_0x5d6f27[_0x67d1('0x34')][_0x67d1('0xa4')]:null;var _0x5ad7fa={'method':_0x5d6f27['method'],'uri':util['format'](_0x67d1('0xa5'),_0x482674,_0x5d6f27['query']['path']),'json':_0x1c67d0,'resolveWithFullResponse':!![],'encoding':_0x5e149c,'qs':_0x5d6f27[_0x67d1('0x34')]};if(_0x5d6f27[_0x67d1('0xa6')]){_0x5ad7fa['headers']=_0x5d6f27[_0x67d1('0xa6')];if(_0x5ad7fa['headers']['content-length']){delete _0x5ad7fa[_0x67d1('0xa6')][_0x67d1('0xa7')];}}if(_0x5ad7fa[_0x67d1('0xa6')][_0x67d1('0xa8')]){delete _0x5ad7fa['headers'][_0x67d1('0xa8')];}return rp(_0x5ad7fa);})[_0x67d1('0x26')](function(_0x1e8eeb){if(_0x1e8eeb){_0x3c8287[_0x67d1('0x23')](_0x1e8eeb['headers']);logger['info'](_0x1e8eeb[_0x67d1('0x91')]);if(_[_0x67d1('0xa9')](_0x5d6f27[_0x67d1('0x34')]['path'],_0x67d1('0x4b'))&&_0x1e8eeb[_0x67d1('0xaa')]==0x1f4){return _0x3c8287['sendStatus'](_0x1e8eeb['statusCode']);}else{return _0x3c8287[_0x67d1('0x1c')](_0x1e8eeb[_0x67d1('0xaa')])[_0x67d1('0x99')](_0x1e8eeb['body']);}}else{return _0x3c8287[_0x67d1('0x2b')](0xc8);}})[_0x67d1('0x47')](handleError(_0x3c8287,null));};exports[_0x67d1('0xab')]=function(_0x5acda6,_0x5aa365,_0x57141c){return BPromise['resolve']()[_0x67d1('0x26')](function(){if(!_0x5acda6[_0x67d1('0x34')][_0x67d1('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x5acda6[_0x67d1('0x34')][_0x67d1('0xa2')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x2f30b2=_0x5acda6[_0x67d1('0x34')][_0x67d1('0xa1')]?_0x5acda6['query'][_0x67d1('0xa1')]+':'+_0x5acda6[_0x67d1('0x34')][_0x67d1('0xa2')]:_0x67d1('0xa3')+_0x5acda6[_0x67d1('0x34')][_0x67d1('0xa2')];var _0x42fb62=_0x5acda6[_0x67d1('0x34')][_0x67d1('0x1e')]?_0x5acda6['query']['json']:!![];var _0xa33a7b=_0x5acda6[_0x67d1('0x34')][_0x67d1('0xa4')]?_0x5acda6[_0x67d1('0x34')][_0x67d1('0xa4')]:null;var _0x36b708={'method':_0x5acda6[_0x67d1('0xac')],'uri':util['format'](_0x67d1('0xa5'),_0x2f30b2,_0x5acda6[_0x67d1('0x34')][_0x67d1('0x5')]),'json':_0x42fb62,'resolveWithFullResponse':!![],'encoding':_0xa33a7b,'body':_0x5acda6['body']};if(_0x5acda6[_0x67d1('0xa6')]){_0x36b708[_0x67d1('0xa6')]=_0x5acda6[_0x67d1('0xa6')];if(_0x36b708['headers'][_0x67d1('0xa7')]){delete _0x36b708[_0x67d1('0xa6')][_0x67d1('0xa7')];}}if(_0x36b708['headers'][_0x67d1('0xa8')]){delete _0x36b708['headers'][_0x67d1('0xa8')];}return rp(_0x36b708);})[_0x67d1('0x26')](function(_0x3025bd){if(_0x3025bd){_0x5aa365[_0x67d1('0x23')](_0x3025bd[_0x67d1('0xa6')]);logger[_0x67d1('0x66')](_0x3025bd[_0x67d1('0x91')]);return _0x5aa365[_0x67d1('0x1c')](_0x3025bd[_0x67d1('0xaa')])[_0x67d1('0x99')](_0x3025bd['body']);}else{return _0x5aa365[_0x67d1('0x2b')](0xc8);}})[_0x67d1('0x47')](handleError(_0x5aa365,null));}; \ No newline at end of file +var _0xe68d=['agent','plugins','scriptName','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','method','%s%s','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','update','destroy','then','get','UserProfileResource','end','error','stack','name','send','index','map','Plugin','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','download','root','server/files/plugins','format','%s.zip','zip','warning','code','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','join','basename','finalize','close','existsSync','Error','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','info','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified'];(function(_0x2af78f,_0x6abb52){var _0x15f48a=function(_0x409f8f){while(--_0x409f8f){_0x2af78f['push'](_0x2af78f['shift']());}};_0x15f48a(++_0x6abb52);}(_0xe68d,0xcc));var _0xde68=function(_0x1c7137,_0x4c7c26){_0x1c7137=_0x1c7137-0x0;var _0xeb4432=_0xe68d[_0x1c7137];return _0xeb4432;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xde68('0x0'));var rp=require(_0xde68('0x1'));var moment=require(_0xde68('0x2'));var BPromise=require(_0xde68('0x3'));var Mustache=require(_0xde68('0x4'));var util=require(_0xde68('0x5'));var path=require(_0xde68('0x6'));var sox=require(_0xde68('0x7'));var csv=require('to-csv');var ejs=require(_0xde68('0x8'));var fs=require('fs');var fs_extra=require(_0xde68('0x9'));var _=require('lodash');var squel=require(_0xde68('0xa'));var crypto=require(_0xde68('0xb'));var jsforce=require(_0xde68('0xc'));var deskjs=require(_0xde68('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xde68('0xe'));var extract=require(_0xde68('0xf'));var rimraf=require('rimraf');var archiver=require(_0xde68('0x10'));var Redis=require(_0xde68('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xde68('0x12'));var hardwareService=require(_0xde68('0x13'));var logger=require(_0xde68('0x14'))(_0xde68('0x15'));var utils=require(_0xde68('0x16'));var config=require(_0xde68('0x17'));var licenseUtil=require(_0xde68('0x18'));var db=require(_0xde68('0x19'))['db'];config[_0xde68('0x1a')]=_[_0xde68('0x1b')](config[_0xde68('0x1a')],{'host':_0xde68('0x1c'),'port':0x18eb});var socket=require(_0xde68('0x1d'))(new Redis(config[_0xde68('0x1a')]));require(_0xde68('0x1e'))[_0xde68('0x1f')](socket);function respondWithStatusCode(_0x20c15c,_0x3a59b3){_0x3a59b3=_0x3a59b3||0xcc;return function(_0x278eae){if(_0x278eae){return _0x20c15c[_0xde68('0x20')](_0x3a59b3);}return _0x20c15c['status'](_0x3a59b3)['end']();};}function respondWithResult(_0x3b6135,_0x3b45a9){_0x3b45a9=_0x3b45a9||0xc8;return function(_0x3233b0){if(_0x3233b0){return _0x3b6135[_0xde68('0x21')](_0x3b45a9)[_0xde68('0x22')](_0x3233b0);}};}function respondWithFilteredResult(_0x11f414,_0x45e09){return function(_0x517692){if(_0x517692){var _0x13f2d4=typeof _0x45e09[_0xde68('0x23')]===_0xde68('0x24')&&typeof _0x45e09[_0xde68('0x25')]===_0xde68('0x24');var _0x37b700=_0x517692['count'];var _0xb1113e=_0x13f2d4?0x0:_0x45e09[_0xde68('0x23')];var _0x3b794b=_0x13f2d4?_0x517692['count']:_0x45e09[_0xde68('0x23')]+_0x45e09['limit'];var _0x52435f;if(_0x3b794b>=_0x37b700){_0x3b794b=_0x37b700;_0x52435f=0xc8;}else{_0x52435f=0xce;}_0x11f414[_0xde68('0x21')](_0x52435f);return _0x11f414['set'](_0xde68('0x26'),_0xb1113e+'-'+_0x3b794b+'/'+_0x37b700)[_0xde68('0x22')](_0x517692);}return null;};}function patchUpdates(_0x5f461f){return function(_0x567ba5){try{jsonpatch[_0xde68('0x27')](_0x567ba5,_0x5f461f,!![]);}catch(_0x12f44f){return BPromise['reject'](_0x12f44f);}return _0x567ba5['save']();};}function saveUpdates(_0x1718e4,_0x138560){return function(_0x14883d){if(_0x14883d){return _0x14883d[_0xde68('0x28')](_0x1718e4)['then'](function(_0x482c50){return _0x482c50;});}return null;};}function removeEntity(_0x32a7ee,_0x582a2f){return function(_0x8a73d0){if(_0x8a73d0){return _0x8a73d0[_0xde68('0x29')]()[_0xde68('0x2a')](function(){var _0x205197=_0x8a73d0[_0xde68('0x2b')]({'plain':!![]});var _0x23bb94='Plugins';return db[_0xde68('0x2c')]['destroy']({'where':{'type':_0x23bb94,'resourceId':_0x205197['id']}})[_0xde68('0x2a')](function(){return _0x8a73d0;});})[_0xde68('0x2a')](function(){_0x32a7ee[_0xde68('0x21')](0xcc)[_0xde68('0x2d')]();});}};}function handleEntityNotFound(_0x1d3519,_0xb8ebfe){return function(_0x196865){if(!_0x196865){_0x1d3519[_0xde68('0x20')](0x194);}return _0x196865;};}function handleError(_0x10a823,_0x24fcff){_0x24fcff=_0x24fcff||0x1f4;return function(_0x5e1244){logger[_0xde68('0x2e')](_0x5e1244[_0xde68('0x2f')]);if(_0x5e1244['name']){delete _0x5e1244[_0xde68('0x30')];}_0x10a823[_0xde68('0x21')](_0x24fcff)[_0xde68('0x31')](_0x5e1244);};}exports[_0xde68('0x32')]=function(_0x45b030,_0x1abb7b){var _0x2e5f6a={},_0x2e208f={},_0x279606={'count':0x0,'rows':[]};var _0x421593=_[_0xde68('0x33')](db[_0xde68('0x34')][_0xde68('0x35')],function(_0x2d8fb3){return{'name':_0x2d8fb3['fieldName'],'type':_0x2d8fb3[_0xde68('0x36')][_0xde68('0x37')]};});_0x2e208f[_0xde68('0x38')]=_['map'](_0x421593,_0xde68('0x30'));_0x2e208f[_0xde68('0x39')]=_['keys'](_0x45b030['query']);_0x2e208f['filters']=_[_0xde68('0x3a')](_0x2e208f['model'],_0x2e208f[_0xde68('0x39')]);_0x2e5f6a[_0xde68('0x3b')]=_['intersection'](_0x2e208f[_0xde68('0x38')],qs[_0xde68('0x3c')](_0x45b030['query'][_0xde68('0x3c')]));_0x2e5f6a['attributes']=_0x2e5f6a[_0xde68('0x3b')][_0xde68('0x3d')]?_0x2e5f6a[_0xde68('0x3b')]:_0x2e208f['model'];if(!_0x45b030[_0xde68('0x39')][_0xde68('0x3e')](_0xde68('0x3f'))){_0x2e5f6a['limit']=qs[_0xde68('0x25')](_0x45b030['query']['limit']);_0x2e5f6a[_0xde68('0x23')]=qs[_0xde68('0x23')](_0x45b030[_0xde68('0x39')]['offset']);}_0x2e5f6a[_0xde68('0x40')]=qs[_0xde68('0x41')](_0x45b030['query'][_0xde68('0x41')]);_0x2e5f6a[_0xde68('0x42')]=qs[_0xde68('0x43')](_[_0xde68('0x44')](_0x45b030[_0xde68('0x39')],_0x2e208f[_0xde68('0x43')]),_0x421593);if(_0x45b030[_0xde68('0x39')][_0xde68('0x45')]){_0x2e5f6a[_0xde68('0x42')]=_['merge'](_0x2e5f6a[_0xde68('0x42')],{'$or':_[_0xde68('0x33')](_0x421593,function(_0xe09c1f){if(_0xe09c1f[_0xde68('0x36')]!=='VIRTUAL'){var _0x1ba63f={};_0x1ba63f[_0xe09c1f[_0xde68('0x30')]]={'$like':'%'+_0x45b030[_0xde68('0x39')]['filter']+'%'};return _0x1ba63f;}})});}_0x2e5f6a=_[_0xde68('0x46')]({},_0x2e5f6a,_0x45b030[_0xde68('0x47')]);var _0x41ede4={'where':_0x2e5f6a[_0xde68('0x42')]};return db[_0xde68('0x34')][_0xde68('0x48')](_0x41ede4)[_0xde68('0x2a')](function(_0x310ed6){_0x279606['count']=_0x310ed6;if(_0x45b030[_0xde68('0x39')][_0xde68('0x49')]){_0x2e5f6a[_0xde68('0x4a')]=[{'all':!![]}];}return db['Plugin'][_0xde68('0x4b')](_0x2e5f6a);})[_0xde68('0x2a')](function(_0x5e2293){_0x279606[_0xde68('0x4c')]=_0x5e2293;return _0x279606;})[_0xde68('0x2a')](respondWithFilteredResult(_0x1abb7b,_0x2e5f6a))[_0xde68('0x4d')](handleError(_0x1abb7b,null));};exports[_0xde68('0x4e')]=function(_0x1bb8d6,_0x3f73c8){var _0xbf19c8={'raw':!![],'where':{'id':_0x1bb8d6[_0xde68('0x4f')]['id']}},_0x126837={};_0x126837[_0xde68('0x38')]=_['keys'](db[_0xde68('0x34')][_0xde68('0x35')]);_0x126837['query']=_['keys'](_0x1bb8d6['query']);_0x126837[_0xde68('0x43')]=_['intersection'](_0x126837[_0xde68('0x38')],_0x126837[_0xde68('0x39')]);_0xbf19c8[_0xde68('0x3b')]=_['intersection'](_0x126837[_0xde68('0x38')],qs[_0xde68('0x3c')](_0x1bb8d6[_0xde68('0x39')][_0xde68('0x3c')]));_0xbf19c8['attributes']=_0xbf19c8[_0xde68('0x3b')]['length']?_0xbf19c8[_0xde68('0x3b')]:_0x126837['model'];if(_0x1bb8d6['query'][_0xde68('0x49')]){_0xbf19c8[_0xde68('0x4a')]=[{'all':!![]}];}_0xbf19c8=_[_0xde68('0x46')]({},_0xbf19c8,_0x1bb8d6['options']);return db[_0xde68('0x34')][_0xde68('0x50')](_0xbf19c8)['then'](handleEntityNotFound(_0x3f73c8,null))[_0xde68('0x2a')](respondWithResult(_0x3f73c8,null))[_0xde68('0x4d')](handleError(_0x3f73c8,null));};exports[_0xde68('0x51')]=function(_0x845109,_0x364400,_0x50f90b){return db[_0xde68('0x34')][_0xde68('0x50')]({'where':{'id':_0x845109[_0xde68('0x4f')]['id']},'attributes':['name',_0xde68('0x6')],'raw':!![]})[_0xde68('0x2a')](handleEntityNotFound(_0x364400,null))[_0xde68('0x2a')](function(_0x5cefef){if(_0x5cefef){var _0xa2a508=path['join'](config[_0xde68('0x52')],_0xde68('0x53'),util[_0xde68('0x54')](_0xde68('0x55'),path['basename'](_0x5cefef[_0xde68('0x6')])));var _0x442355=fs['createWriteStream'](_0xa2a508);var _0x6ffc55=archiver(_0xde68('0x56'),{'zlib':{'level':0x9}});_0x6ffc55['on'](_0xde68('0x57'),function(_0x42a82b){if(_0x42a82b[_0xde68('0x58')]==='ENOENT'){logger[_0xde68('0x2e')](_0x42a82b);}else{throw new db[(_0xde68('0x59'))]['Error'](_0xde68('0x5a'));}});_0x6ffc55['on'](_0xde68('0x2e'),function(_0x3b6cb6){throw new db[(_0xde68('0x59'))]['Error'](_0xde68('0x5a'));});_0x6ffc55[_0xde68('0x5b')](_0x442355);_0x6ffc55[_0xde68('0x5c')](_0xde68('0x5d'),{'cwd':path['join'](config[_0xde68('0x52')],'server/files/plugins',path[_0xde68('0x5e')](_0x5cefef[_0xde68('0x6')])),'ignore':[path[_0xde68('0x5f')](path['basename'](_0x5cefef[_0xde68('0x6')]),'node_modules/**/*'),path['join'](path[_0xde68('0x60')](_0x5cefef[_0xde68('0x6')]),'attachments/**/*')],'nodir':!![]})[_0xde68('0x61')]();_0x442355['on'](_0xde68('0x62'),function(){if(!fs[_0xde68('0x63')](_0xa2a508)){throw new db[(_0xde68('0x59'))][(_0xde68('0x64'))](_0xde68('0x65'));}return _0x364400['download'](_0xa2a508,util[_0xde68('0x54')]('%s.zip',path[_0xde68('0x60')](_0x5cefef[_0xde68('0x6')])),function(_0x1539b8){if(_0x1539b8){throw new db[(_0xde68('0x59'))]['Error'](_0xde68('0x66'));}fs[_0xde68('0x67')](_0xa2a508);logger['info'](_0xde68('0x68'));logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0xde68('0x4d')](handleError(_0x364400,null));};exports['upload']=function(_0x1bd4ad,_0x3a7177,_0x3ebca5){var _0x5be5d2=path[_0xde68('0x60')](_0x1bd4ad[_0xde68('0x69')][_0xde68('0x6a')],path[_0xde68('0x6b')](_0x1bd4ad[_0xde68('0x69')]['filename']));var _0x12dbf1=path[_0xde68('0x5f')](config[_0xde68('0x52')],_0xde68('0x53'),_0x1bd4ad[_0xde68('0x69')]['filename']);var _0x278ccd=path['join'](config[_0xde68('0x52')],_0xde68('0x53'),_0x5be5d2);logger['info'](_0xde68('0x6c'),_0x12dbf1);logger[_0xde68('0x6d')]('Plugin\x20upload\x20destination:\x20%s',_0x278ccd);try{fs[_0xde68('0x6e')](_0x12dbf1,parseInt(_0xde68('0x6f'),0x8));extract(_0x12dbf1,{'dir':_0x278ccd},function(_0x178b60){if(_0x178b60){logger[_0xde68('0x2e')](_0x178b60);handleError(_0x178b60,!![]);};var _0x531c10=fs[_0xde68('0x70')](_0x278ccd);if(_0x531c10[_0xde68('0x3d')]>0x1){removeReferences(_0x12dbf1,_0x278ccd);logger[_0xde68('0x2e')](_0xde68('0x71'));return _0x3ebca5(new Error(_0xde68('0x71')));}var _0x2f2c07=fs[_0xde68('0x72')](path[_0xde68('0x5f')](_0x278ccd,_0x531c10[0x0]));if(_0x2f2c07[_0xde68('0x73')]()){removeReferences(_0x12dbf1,_0x278ccd);logger[_0xde68('0x2e')](_0xde68('0x71'));return _0x3ebca5(new Error(_0xde68('0x71')));}if(_0x2f2c07['isDirectory']()){var _0x4f65b5=fs[_0xde68('0x70')](path[_0xde68('0x5f')](_0x278ccd,_0x531c10[0x0]));if(_0x4f65b5[_0xde68('0x3d')]===0x0){removeReferences(_0x12dbf1,_0x278ccd);logger[_0xde68('0x2e')]('Invalid\x20plugin\x20structure');return _0x3ebca5(new Error('Invalid\x20plugin\x20structure'));}var _0x482192=_0x4f65b5[_0xde68('0x74')](function(_0x300131){return _0x300131===_0xde68('0x75');});if(!_0x482192){return _0x3ebca5(new Error('Plugin\x20manifest\x20missing'));}var _0x5f4165=fs[_0xde68('0x76')](path['join'](_0x278ccd,_0x531c10[0x0],'manifest.json'));var _0x40db7c=JSON[_0xde68('0x77')](_0x5f4165);if('undefined'==typeof _0x40db7c[_0xde68('0x30')]){return _0x3ebca5(new Error(_0xde68('0x78')));}if('undefined'==typeof _0x40db7c['type']){return _0x3ebca5(new Error(_0xde68('0x79')));}if(_0xde68('0x24')==typeof _0x40db7c[_0xde68('0x7a')]){return _0x3ebca5(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xde68('0x24')==typeof _0x40db7c['parameters']){return _0x3ebca5(new Error(_0xde68('0x7b')));}if(_0x40db7c[_0xde68('0x36')]===_0xde68('0x7c')){if(_0xde68('0x24')==typeof _0x40db7c[_0xde68('0x7d')][_0xde68('0x7e')]){return _0x3ebca5(new Error(_0xde68('0x7f')));}if('undefined'==typeof _0x40db7c[_0xde68('0x7d')][_0xde68('0x7e')][_0xde68('0x80')]&&'undefined'==typeof _0x40db7c[_0xde68('0x7d')]['views']['agent']){return _0x3ebca5(new Error(_0xde68('0x81')));}}else if(_0x40db7c[_0xde68('0x36')]===_0xde68('0x82')){if(_0xde68('0x24')==typeof _0x40db7c[_0xde68('0x7d')]['scriptName']){return _0x3ebca5(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x40db7c[_0xde68('0x7d')][_0xde68('0x83')]){return _0x3ebca5(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x3ebca5(new Error(_0xde68('0x84')));}var _0x362b8d=_0x40db7c[_0xde68('0x30')];var _0x19f70a=_0x40db7c[_0xde68('0x85')];var _0x1cbfa6=_0x40db7c[_0xde68('0x36')];var _0x2a0c6d=_0x40db7c[_0xde68('0x86')]?_0x40db7c[_0xde68('0x86')]:_0xde68('0x87');var _0x306a3a=_0x40db7c[_0xde68('0x88')]?_0x40db7c[_0xde68('0x88')]:_0xde68('0x89');var _0x322df5='';var _0x141319='';var _0x3d30f6='';var _0x4a78f8='';var _0xc19553=_0x40db7c[_0xde68('0x7a')];if(_0x1cbfa6===_0xde68('0x7c')){if(_0xde68('0x24')!=typeof _0x40db7c[_0xde68('0x7d')][_0xde68('0x7e')][_0xde68('0x80')]){var _0x15aef0=_0x40db7c['parameters'][_0xde68('0x7e')][_0xde68('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xde68('0x8a')](_0x15aef0)){_0x322df5=path[_0xde68('0x5f')]('plugins',_0x5be5d2,_0x531c10[0x0],_0x15aef0);}else{_0x322df5=_0x15aef0;}}else{logger[_0xde68('0x6d')](_0xde68('0x8b'));}if(_0xde68('0x24')!=typeof _0x40db7c['parameters']['views']['agent']){var _0x2d48df=_0x40db7c[_0xde68('0x7d')][_0xde68('0x7e')][_0xde68('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0xde68('0x8a')](_0x2d48df)){_0x141319=path[_0xde68('0x5f')](_0xde68('0x8d'),_0x5be5d2,_0x531c10[0x0],_0x2d48df);}else{_0x141319=_0x2d48df;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x1cbfa6===_0xde68('0x82')){_0x3d30f6=_0x40db7c[_0xde68('0x7d')][_0xde68('0x8e')];_0x4a78f8=_0x40db7c[_0xde68('0x7d')][_0xde68('0x83')];if(_0xde68('0x24')!=typeof _0x40db7c[_0xde68('0x7d')][_0xde68('0x7e')]){if(_0xde68('0x24')!=typeof _0x40db7c['parameters'][_0xde68('0x7e')][_0xde68('0x80')]){var _0x15aef0=_0x40db7c[_0xde68('0x7d')][_0xde68('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xde68('0x8a')](_0x15aef0)){_0x322df5=path[_0xde68('0x5f')]('plugins',_0x5be5d2,_0x531c10[0x0],_0x15aef0);}else{_0x322df5=_0x15aef0;}}if('undefined'!=typeof _0x40db7c[_0xde68('0x7d')][_0xde68('0x7e')][_0xde68('0x8c')]){var _0x2d48df=_0x40db7c['parameters'][_0xde68('0x7e')][_0xde68('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0xde68('0x8a')](_0x2d48df)){_0x141319=path[_0xde68('0x5f')]('plugins',_0x5be5d2,_0x531c10[0x0],_0x2d48df);}else{_0x141319=_0x2d48df;}}}}var _0x83a918={'name':_0x362b8d,'description':_0x19f70a,'path':path[_0xde68('0x5f')](_0x5be5d2,_0x531c10[0x0]),'type':_0x1cbfa6,'sidebar':_0x2a0c6d,'icon':_0x306a3a,'adminUrl':_0x322df5,'agentUrl':_0x141319,'scriptName':_0x3d30f6,'scriptPath':_0x4a78f8,'version':_0xc19553};removeReferences(_0x12dbf1,null);return db[_0xde68('0x34')][_0xde68('0x8f')](_0x83a918)['then'](function(_0xe8d5a0){var _0x154494={'role':_0x1bd4ad[_0xde68('0x90')][_0xde68('0x91')],'userProfileId':_0x1bd4ad['body'][_0xde68('0x92')]};if(!_0x154494)throw new Error(_0xde68('0x93'));if(_0x154494['role']===_0xde68('0x94')){var _0x5019e8=_0xe8d5a0[_0xde68('0x2b')]({'plain':!![]});return db[_0xde68('0x95')][_0xde68('0x50')]({'where':{'name':_0xde68('0x96'),'userProfileId':_0x154494[_0xde68('0x92')]},'raw':!![]})['then'](function(_0x1eb8e3){if(_0x1eb8e3&&_0x1eb8e3[_0xde68('0x97')]===0x0){return db[_0xde68('0x2c')][_0xde68('0x8f')]({'name':_0x5019e8['name'],'resourceId':_0x5019e8['id'],'type':_0x1eb8e3['name'],'sectionId':_0x1eb8e3['id']},{})[_0xde68('0x2a')](function(){return _0xe8d5a0;});}else{return _0xe8d5a0;}})['catch'](function(_0x472860){logger[_0xde68('0x2e')](_0xde68('0x98'),_0x472860);throw _0x472860;});}return _0xe8d5a0;})['then'](respondWithResult(_0x3a7177,null))[_0xde68('0x4d')](handleError(_0x3a7177,null));}});}catch(_0x38fc9d){_0x3a7177['status'](0x1f4)[_0xde68('0x31')](_0x38fc9d);}};function removeReferences(_0x525e37,_0x56e357){try{if(_0x525e37){fs[_0xde68('0x67')](_0x525e37);logger[_0xde68('0x6d')](_0xde68('0x99'));}if(_0x56e357){rimraf(_0x56e357,function(){});logger[_0xde68('0x6d')](_0xde68('0x9a'));}}catch(_0x2f4445){logger[_0xde68('0x2e')](_0x2f4445);}}exports[_0xde68('0x28')]=function(_0x1a100a,_0x1ad67d,_0xdbf3a2){return db[_0xde68('0x34')][_0xde68('0x50')]({'where':{'id':_0x1a100a[_0xde68('0x4f')]['id']}})[_0xde68('0x2a')](handleEntityNotFound(_0x1ad67d,null))['then'](saveUpdates(_0x1a100a[_0xde68('0x90')],null))[_0xde68('0x2a')](respondWithResult(_0x1ad67d,null))[_0xde68('0x4d')](handleError(_0x1ad67d,null));};exports[_0xde68('0x9b')]=function(_0x2e929a,_0x1f834b,_0x4342bf){return db[_0xde68('0x34')][_0xde68('0x50')]({'where':{'id':_0x2e929a[_0xde68('0x4f')]['id']}})['then'](function(_0x302429){if(_0x302429){return _0x302429[_0xde68('0x29')]();}})[_0xde68('0x2a')](function(_0x2530ac){rimraf(path[_0xde68('0x5f')](config['root'],'server/files/plugins',path[_0xde68('0x5e')](_0x2530ac['path'])),function(){});return _0x2530ac;})[_0xde68('0x2a')](handleEntityNotFound(_0x1f834b,null))[_0xde68('0x2a')](respondWithStatusCode(_0x1f834b,null))[_0xde68('0x4d')](handleError(_0x1f834b,null));};exports['webhookGet']=function(_0xe01519,_0x16c966,_0x5bf5a5){return BPromise['resolve']()[_0xde68('0x2a')](function(){if(!_0xe01519[_0xde68('0x39')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xe01519[_0xde68('0x39')][_0xde68('0x9c')]){throw new Error(_0xde68('0x9d'));}var _0x41864a=_0xe01519['query'][_0xde68('0x9e')]?_0xe01519[_0xde68('0x39')][_0xde68('0x9e')]+':'+_0xe01519['query']['port']:_0xde68('0x9f')+_0xe01519[_0xde68('0x39')][_0xde68('0x9c')];var _0x19725=_0xe01519[_0xde68('0x39')][_0xde68('0x22')]?_0xe01519['query'][_0xde68('0x22')]:!![];var _0x21e03a=_0xe01519[_0xde68('0x39')][_0xde68('0xa0')]?_0xe01519['query'][_0xde68('0xa0')]:null;var _0x764a87={'method':_0xe01519['method'],'uri':util[_0xde68('0x54')]('%s%s',_0x41864a,_0xe01519['query']['path']),'json':_0x19725,'resolveWithFullResponse':!![],'encoding':_0x21e03a,'qs':_0xe01519[_0xde68('0x39')]};if(_0xe01519[_0xde68('0xa1')]){_0x764a87[_0xde68('0xa1')]=_0xe01519[_0xde68('0xa1')];if(_0x764a87[_0xde68('0xa1')][_0xde68('0xa2')]){delete _0x764a87[_0xde68('0xa1')][_0xde68('0xa2')];}}if(_0x764a87[_0xde68('0xa1')]['content-type']){delete _0x764a87[_0xde68('0xa1')][_0xde68('0xa3')];}return rp(_0x764a87);})['then'](function(_0x2b2e75){if(_0x2b2e75){_0x16c966[_0xde68('0xa4')](_0x2b2e75[_0xde68('0xa1')]);logger[_0xde68('0x6d')](_0x2b2e75[_0xde68('0x90')]);if(_[_0xde68('0xa5')](_0xe01519[_0xde68('0x39')][_0xde68('0x6')],_0xde68('0x51'))&&_0x2b2e75['statusCode']==0x1f4){return _0x16c966[_0xde68('0x20')](_0x2b2e75['statusCode']);}else{return _0x16c966[_0xde68('0x21')](_0x2b2e75[_0xde68('0xa6')])[_0xde68('0x31')](_0x2b2e75[_0xde68('0x90')]);}}else{return _0x16c966[_0xde68('0x20')](0xc8);}})[_0xde68('0x4d')](handleError(_0x16c966,null));};exports[_0xde68('0xa7')]=function(_0x2590d5,_0x22396d,_0x12c5bf){return BPromise[_0xde68('0xa8')]()[_0xde68('0x2a')](function(){if(!_0x2590d5[_0xde68('0x39')]['path']){throw new Error(_0xde68('0xa9'));}if(!_0x2590d5[_0xde68('0x39')][_0xde68('0x9c')]){throw new Error(_0xde68('0x9d'));}var _0x136c38=_0x2590d5[_0xde68('0x39')][_0xde68('0x9e')]?_0x2590d5[_0xde68('0x39')]['hostname']+':'+_0x2590d5[_0xde68('0x39')][_0xde68('0x9c')]:_0xde68('0x9f')+_0x2590d5[_0xde68('0x39')][_0xde68('0x9c')];var _0x53315a=_0x2590d5['query'][_0xde68('0x22')]?_0x2590d5[_0xde68('0x39')][_0xde68('0x22')]:!![];var _0x2f30f5=_0x2590d5['query']['encoding']?_0x2590d5['query'][_0xde68('0xa0')]:null;var _0x1fd80d={'method':_0x2590d5[_0xde68('0xaa')],'uri':util[_0xde68('0x54')](_0xde68('0xab'),_0x136c38,_0x2590d5[_0xde68('0x39')][_0xde68('0x6')]),'json':_0x53315a,'resolveWithFullResponse':!![],'encoding':_0x2f30f5,'body':_0x2590d5[_0xde68('0x90')]};if(_0x2590d5[_0xde68('0xa1')]){_0x1fd80d[_0xde68('0xa1')]=_0x2590d5['headers'];if(_0x1fd80d[_0xde68('0xa1')][_0xde68('0xa2')]){delete _0x1fd80d[_0xde68('0xa1')][_0xde68('0xa2')];}}if(_0x1fd80d[_0xde68('0xa1')][_0xde68('0xa3')]){delete _0x1fd80d[_0xde68('0xa1')][_0xde68('0xa3')];}return rp(_0x1fd80d);})[_0xde68('0x2a')](function(_0x3d61b2){if(_0x3d61b2){_0x22396d[_0xde68('0xa4')](_0x3d61b2[_0xde68('0xa1')]);logger[_0xde68('0x6d')](_0x3d61b2[_0xde68('0x90')]);return _0x22396d[_0xde68('0x21')](_0x3d61b2[_0xde68('0xa6')])[_0xde68('0x31')](_0x3d61b2[_0xde68('0x90')]);}else{return _0x22396d[_0xde68('0x20')](0xc8);}})[_0xde68('0x4d')](handleError(_0x22396d,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 8432ad3..2533bf5 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 _0x1a44=['update','remove','emit','hasOwnProperty','events','Plugin','setMaxListeners','save'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x1a44,0xc4));var _0x41a4=function(_0x3fcbca,_0x95c30){_0x3fcbca=_0x3fcbca-0x0;var _0x3ba8fd=_0x1a44[_0x3fcbca];return _0x3ba8fd;};'use strict';var EventEmitter=require(_0x41a4('0x0'));var Plugin=require('../../mysqldb')['db'][_0x41a4('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x41a4('0x2')](0x0);var events={'afterCreate':_0x41a4('0x3'),'afterUpdate':_0x41a4('0x4'),'afterDestroy':_0x41a4('0x5')};function emitEvent(_0x3c3c23){return function(_0x397cb2,_0x529244,_0x20ab2d){PluginEvents[_0x41a4('0x6')](_0x3c3c23+':'+_0x397cb2['id'],_0x397cb2);PluginEvents[_0x41a4('0x6')](_0x3c3c23,_0x397cb2);_0x20ab2d(null);};}for(var e in events){if(events[_0x41a4('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xbc1c=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xbc1c,0xd8));var _0xcbc1=function(_0x53f897,_0x539857){_0x53f897=_0x53f897-0x0;var _0x6879f8=_0xbc1c[_0x53f897];return _0x6879f8;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xcbc1('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xcbc1('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcbc1('0x2'),'afterDestroy':_0xcbc1('0x3')};function emitEvent(_0x39e45b){return function(_0x2d19b9,_0x55e7ed,_0x148560){PluginEvents[_0xcbc1('0x4')](_0x39e45b+':'+_0x2d19b9['id'],_0x2d19b9);PluginEvents[_0xcbc1('0x4')](_0x39e45b,_0x2d19b9);_0x148560(null);};}for(var e in events){if(events[_0xcbc1('0x5')](e)){var event=events[e];Plugin[_0xcbc1('0x6')](e,emitEvent(event));}}module[_0xcbc1('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 8e266cd..20c4f63 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 _0x9312=['./plugin.attributes','exports','define','util','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0x431a58,_0x22f689){var _0x17f42b=function(_0x2fd333){while(--_0x2fd333){_0x431a58['push'](_0x431a58['shift']());}};_0x17f42b(++_0x22f689);}(_0x9312,0x1aa));var _0x2931=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0x9312[_0x13843f];return _0x1063ae;};'use strict';var _=require('lodash');var util=require(_0x2931('0x0'));var logger=require(_0x2931('0x1'))('api');var moment=require(_0x2931('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2931('0x3'));var rimraf=require(_0x2931('0x4'));var config=require(_0x2931('0x5'));var attributes=require(_0x2931('0x6'));module[_0x2931('0x7')]=function(_0x15e76f,_0x17e18a){return _0x15e76f[_0x2931('0x8')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb06c=['./plugin.attributes','exports','define','Plugin','plugins','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x2434f2,_0x5502b6){var _0x17c702=function(_0x434ae1){while(--_0x434ae1){_0x2434f2['push'](_0x2434f2['shift']());}};_0x17c702(++_0x5502b6);}(_0xb06c,0x123));var _0xcb06=function(_0x3e8cf2,_0x5c0c3d){_0x3e8cf2=_0x3e8cf2-0x0;var _0x44315a=_0xb06c[_0x3e8cf2];return _0x44315a;};'use strict';var _=require('lodash');var util=require(_0xcb06('0x0'));var logger=require(_0xcb06('0x1'))('api');var moment=require(_0xcb06('0x2'));var BPromise=require(_0xcb06('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb06('0x4'));var rimraf=require('rimraf');var config=require(_0xcb06('0x5'));var attributes=require(_0xcb06('0x6'));module[_0xcb06('0x7')]=function(_0x4fd7d9,_0x3f7c42){return _0x4fd7d9[_0xcb06('0x8')](_0xcb06('0x9'),attributes,{'tableName':_0xcb06('0xa'),'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 a864e34..074f9b2 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 _0xeeca=['create','body','options','raw','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreatePlugin','Plugin'];(function(_0x895358,_0x32f914){var _0x26e26e=function(_0xf2da4a){while(--_0xf2da4a){_0x895358['push'](_0x895358['shift']());}};_0x26e26e(++_0x32f914);}(_0xeeca,0x1e1));var _0xaeec=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0xeeca[_0x469a3c];return _0x968f4;};'use strict';var _=require(_0xaeec('0x0'));var util=require(_0xaeec('0x1'));var moment=require('moment');var BPromise=require(_0xaeec('0x2'));var rs=require(_0xaeec('0x3'));var fs=require('fs');var Redis=require(_0xaeec('0x4'));var db=require(_0xaeec('0x5'))['db'];var utils=require(_0xaeec('0x6'));var logger=require('../../config/logger')(_0xaeec('0x7'));var config=require(_0xaeec('0x8'));var jayson=require(_0xaeec('0x9'));var client=jayson['client'][_0xaeec('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xaeec('0xb')],{'host':_0xaeec('0xc'),'port':0x18eb});var socket=require(_0xaeec('0xd'))(new Redis(config[_0xaeec('0xb')]));require(_0xaeec('0xe'))[_0xaeec('0xf')](socket);function respondWithRpcPromise(_0x31f28f,_0x5701f0,_0x1f726a){return new BPromise(function(_0x4cb64e,_0x4582e6){return client[_0xaeec('0x10')](_0x31f28f,_0x1f726a)['then'](function(_0x14cbcc){logger[_0xaeec('0x11')](_0xaeec('0x12'),_0x5701f0,'request\x20sent');logger['debug'](_0xaeec('0x13'),_0x5701f0,_0xaeec('0x14'),JSON[_0xaeec('0x15')](_0x14cbcc));if(_0x14cbcc['error']){if(_0x14cbcc[_0xaeec('0x16')][_0xaeec('0x17')]===0x1f4){logger[_0xaeec('0x16')]('Plugin,\x20%s,\x20%s',_0x5701f0,_0x14cbcc['error'][_0xaeec('0x18')]);return _0x4582e6(_0x14cbcc[_0xaeec('0x16')][_0xaeec('0x18')]);}logger[_0xaeec('0x16')](_0xaeec('0x12'),_0x5701f0,_0x14cbcc[_0xaeec('0x16')][_0xaeec('0x18')]);return _0x4cb64e(_0x14cbcc[_0xaeec('0x16')][_0xaeec('0x18')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x5701f0,'request\x20sent');_0x4cb64e(_0x14cbcc[_0xaeec('0x19')]['message']);}})[_0xaeec('0x1a')](function(_0x4a5cda){logger[_0xaeec('0x16')](_0xaeec('0x12'),_0x5701f0,_0x4a5cda);_0x4582e6(_0x4a5cda);});});}exports[_0xaeec('0x1b')]=function(_0x5a3780){var _0x1cc273=this;return new Promise(function(_0x571e7b,_0x488a9e){return db[_0xaeec('0x1c')][_0xaeec('0x1d')](_0x5a3780[_0xaeec('0x1e')],{'raw':_0x5a3780['options']?_0x5a3780[_0xaeec('0x1f')][_0xaeec('0x20')]===undefined?!![]:![]:!![]})[_0xaeec('0x21')](function(_0x3c0528){logger[_0xaeec('0x11')]('CreatePlugin',_0x5a3780);logger['debug'](_0xaeec('0x1b'),_0x5a3780,JSON[_0xaeec('0x15')](_0x3c0528));_0x571e7b(_0x3c0528);})[_0xaeec('0x1a')](function(_0x54c56b){logger[_0xaeec('0x16')](_0xaeec('0x1b'),_0x54c56b['message'],_0x5a3780);_0x488a9e(_0x1cc273[_0xaeec('0x16')](0x1f4,_0x54c56b['message']));});});}; \ No newline at end of file +var _0x2e7e=['raw','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','./plugin.socket','register','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','result','CreatePlugin','body','options'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x2e7e,0x1d3));var _0xe2e7=function(_0x3d792a,_0x5ce72d){_0x3d792a=_0x3d792a-0x0;var _0x2af23e=_0x2e7e[_0x3d792a];return _0x2af23e;};'use strict';var _=require(_0xe2e7('0x0'));var util=require(_0xe2e7('0x1'));var moment=require(_0xe2e7('0x2'));var BPromise=require(_0xe2e7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe2e7('0x4'));var db=require(_0xe2e7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2e7('0x6'))('rpc');var config=require(_0xe2e7('0x7'));var jayson=require(_0xe2e7('0x8'));var client=jayson[_0xe2e7('0x9')][_0xe2e7('0xa')]({'port':0x232a});config['redis']=_[_0xe2e7('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe2e7('0xc'))(new Redis(config[_0xe2e7('0xd')]));require(_0xe2e7('0xe'))[_0xe2e7('0xf')](socket);function respondWithRpcPromise(_0x4156bb,_0x1b74c6,_0x47780b){return new BPromise(function(_0x54c561,_0x3005cf){return client['request'](_0x4156bb,_0x47780b)['then'](function(_0x33ac92){logger[_0xe2e7('0x10')]('Plugin,\x20%s,\x20%s',_0x1b74c6,_0xe2e7('0x11'));logger[_0xe2e7('0x12')](_0xe2e7('0x13'),_0x1b74c6,_0xe2e7('0x11'),JSON[_0xe2e7('0x14')](_0x33ac92));if(_0x33ac92[_0xe2e7('0x15')]){if(_0x33ac92[_0xe2e7('0x15')][_0xe2e7('0x16')]===0x1f4){logger[_0xe2e7('0x15')](_0xe2e7('0x17'),_0x1b74c6,_0x33ac92['error'][_0xe2e7('0x18')]);return _0x3005cf(_0x33ac92[_0xe2e7('0x15')][_0xe2e7('0x18')]);}logger['error'](_0xe2e7('0x17'),_0x1b74c6,_0x33ac92['error']['message']);return _0x54c561(_0x33ac92[_0xe2e7('0x15')][_0xe2e7('0x18')]);}else{logger[_0xe2e7('0x10')](_0xe2e7('0x17'),_0x1b74c6,_0xe2e7('0x11'));_0x54c561(_0x33ac92[_0xe2e7('0x19')][_0xe2e7('0x18')]);}})['catch'](function(_0x1190de){logger['error'](_0xe2e7('0x17'),_0x1b74c6,_0x1190de);_0x3005cf(_0x1190de);});});}exports[_0xe2e7('0x1a')]=function(_0x478f73){var _0x31dd7d=this;return new Promise(function(_0x52a8e2,_0x300690){return db['Plugin']['create'](_0x478f73[_0xe2e7('0x1b')],{'raw':_0x478f73[_0xe2e7('0x1c')]?_0x478f73['options'][_0xe2e7('0x1d')]===undefined?!![]:![]:!![]})[_0xe2e7('0x1e')](function(_0x114d7b){logger['info'](_0xe2e7('0x1a'),_0x478f73);logger[_0xe2e7('0x12')](_0xe2e7('0x1a'),_0x478f73,JSON['stringify'](_0x114d7b));_0x52a8e2(_0x114d7b);})['catch'](function(_0xc39e05){logger[_0xe2e7('0x15')](_0xe2e7('0x1a'),_0xc39e05[_0xe2e7('0x18')],_0x478f73);_0x300690(_0x31dd7d[_0xe2e7('0x15')](0x1f4,_0xc39e05['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 03686f5..85a66ce 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 _0xc26c=['length','plugin:','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc26c,0x1ca));var _0xcc26=function(_0x2c10c4,_0x5d7c73){_0x2c10c4=_0x2c10c4-0x0;var _0x36f92e=_0xc26c[_0x2c10c4];return _0x36f92e;};'use strict';var PluginEvents=require(_0xcc26('0x0'));var events=[_0xcc26('0x1'),_0xcc26('0x2'),_0xcc26('0x3')];function createListener(_0x3ca3d1,_0x11f529){return function(_0x4f4af7){_0x11f529[_0xcc26('0x4')](_0x3ca3d1,_0x4f4af7);};}function removeListener(_0x216f49,_0x267b86){return function(){PluginEvents[_0xcc26('0x5')](_0x216f49,_0x267b86);};}exports['register']=function(_0x4dd732){for(var _0x53c222=0x0,_0x49a075=events[_0xcc26('0x6')];_0x53c222<_0x49a075;_0x53c222++){var _0x14d17d=events[_0x53c222];var _0x224346=createListener(_0xcc26('0x7')+_0x14d17d,_0x4dd732);PluginEvents['on'](_0x14d17d,_0x224346);}}; \ No newline at end of file +var _0x1336=['plugin:','./plugin.events','save','remove','update','removeListener','register','length'];(function(_0x4e08d8,_0x4a9f8d){var _0x58fa0a=function(_0x1f74ea){while(--_0x1f74ea){_0x4e08d8['push'](_0x4e08d8['shift']());}};_0x58fa0a(++_0x4a9f8d);}(_0x1336,0xe9));var _0x6133=function(_0x5eebf4,_0x2cfc39){_0x5eebf4=_0x5eebf4-0x0;var _0x12b4d3=_0x1336[_0x5eebf4];return _0x12b4d3;};'use strict';var PluginEvents=require(_0x6133('0x0'));var events=[_0x6133('0x1'),_0x6133('0x2'),_0x6133('0x3')];function createListener(_0x36e487,_0x51da44){return function(_0x57891e){_0x51da44['emit'](_0x36e487,_0x57891e);};}function removeListener(_0x3d4d95,_0x1498e8){return function(){PluginEvents[_0x6133('0x4')](_0x3d4d95,_0x1498e8);};}exports[_0x6133('0x5')]=function(_0x40209a){for(var _0xd47214=0x0,_0x44f159=events[_0x6133('0x6')];_0xd47214<_0x44f159;_0xd47214++){var _0x3d28d7=events[_0xd47214];var _0x309c68=createListener(_0x6133('0x7')+_0x3d28d7,_0x40209a);PluginEvents['on'](_0x3d28d7,_0x309c68);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index f1bebc4..b9c5d70 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(_0x45af40,_0x27a579){var _0x293367=function(_0xbd4f52){while(--_0xbd4f52){_0x45af40['push'](_0x45af40['shift']());}};_0x293367(++_0x27a579);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x2b6124,_0x4d25f2){var _0x44c3f4=function(_0x11075c){while(--_0x11075c){_0x2b6124['push'](_0x2b6124['shift']());}};_0x44c3f4(++_0x4d25f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 3b34356..219801b 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 _0x04b8=['join','../../files/plugins','cwd','chdir','start','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','params','delete','dump','Unknown\x20id','../../config/pm2','api','path','exec','bluebird','sendStatus','status','error','stack','name','npm\x20install','info','index','list','reject','express','length','catch','show','describe','then','create','body','script'];(function(_0x3b632f,_0x453380){var _0x10e788=function(_0x2228a4){while(--_0x2228a4){_0x3b632f['push'](_0x3b632f['shift']());}};_0x10e788(++_0x453380);}(_0x04b8,0x159));var _0x804b=function(_0x30fe0e,_0x5941f4){_0x30fe0e=_0x30fe0e-0x0;var _0x5c9413=_0x04b8[_0x30fe0e];return _0x5c9413;};'use strict';var _=require('lodash');var pm2=require(_0x804b('0x0'));var logger=require('../../config/logger')(_0x804b('0x1'));var path=require(_0x804b('0x2'));var exec=require('child_process')[_0x804b('0x3')];var BPromise=require(_0x804b('0x4'));function handleEntityNotFound(_0x5857dc,_0x3530f6){return function(_0x1c3474){if(!_0x1c3474){_0x5857dc[_0x804b('0x5')](0x194);;}return _0x1c3474;};}function respondWithResult(_0x5a8a5b,_0x2c22e3){_0x2c22e3=_0x2c22e3||0xc8;return function(_0x3c5404){if(_0x3c5404){return _0x5a8a5b[_0x804b('0x6')](_0x2c22e3)['json'](_0x3c5404);}return null;};}function handleError(_0x27e950,_0x1071b4){_0x1071b4=_0x1071b4||0x1f4;return function(_0x592e14){logger[_0x804b('0x7')](_0x592e14[_0x804b('0x8')]);if(_0x592e14[_0x804b('0x9')]){delete _0x592e14[_0x804b('0x9')];}_0x27e950[_0x804b('0x6')](_0x1071b4)['send'](_0x592e14);};}function execChildProcess(){return new BPromise(function(_0x22c98d,_0x3338ba){exec(_0x804b('0xa'),function(_0x7029e7,_0x2d13ba,_0x12e7b4){logger['info'](_0x2d13ba);logger[_0x804b('0xb')](_0x12e7b4);if(_0x7029e7){logger['error'](_0x7029e7);return _0x3338ba(_0x7029e7);}return _0x22c98d(_0x2d13ba);});});}exports[_0x804b('0xc')]=function(_0x3a2702,_0xfa2ddd){return pm2[_0x804b('0xd')]()['then'](function(_0x215825){if(_0x215825){var _0x1b01a7=_[_0x804b('0xe')](_0x215825,function(_0x236a85){return _0x236a85['name']===_0x804b('0xf')||_0x236a85[_0x804b('0x9')]==='motion2';});return{'rows':_0x1b01a7,'count':_0x1b01a7[_0x804b('0x10')]};}return null;})['then'](respondWithResult(_0xfa2ddd,null))[_0x804b('0x11')](handleError(_0xfa2ddd,null));};exports[_0x804b('0x12')]=function(_0x13662e,_0x1760f8){return pm2[_0x804b('0x13')](_0x13662e['params']['id'])[_0x804b('0x14')](respondWithResult(_0x1760f8,null))['then'](handleEntityNotFound(_0x1760f8,null))[_0x804b('0x11')](handleError(_0x1760f8,null));};exports[_0x804b('0x15')]=function(_0x42cceb,_0x469251){if(_0x42cceb['body'][_0x804b('0x9')]&&_0x42cceb[_0x804b('0x16')][_0x804b('0x17')]){var _0x11eaf6=path[_0x804b('0x18')](__dirname,_0x804b('0x19'),_0x42cceb[_0x804b('0x16')][_0x804b('0x17')]);var _0xaa9521=process[_0x804b('0x1a')]();process[_0x804b('0x1b')](path['dirname'](_0x11eaf6));return execChildProcess()[_0x804b('0x14')](function(_0x5a77e0){process['chdir'](_0xaa9521);return pm2[_0x804b('0x1c')]({'name':_0x42cceb[_0x804b('0x16')][_0x804b('0x9')],'script':_0x11eaf6});})[_0x804b('0x14')](function(_0x9080c2){pm2['dump']();return _0x9080c2[0x0];})[_0x804b('0x14')](respondWithResult(_0x469251,0xc9))[_0x804b('0x11')](handleError(_0x469251,null));}else{return _0x469251['status'](0x1f4)[_0x804b('0x1d')]({'message':_0x804b('0x1e')});}};exports[_0x804b('0x1f')]=function(_0x27d5ec,_0x2d88da){if(_0x27d5ec['body']['id']){delete _0x27d5ec[_0x804b('0x16')]['id'];}var _0x22f822={'online':_0x804b('0x20'),'stopped':_0x804b('0x21')};if(_0x22f822[_0x804b('0x22')](_0x27d5ec['body'][_0x804b('0x6')])){return pm2[_0x22f822[_0x27d5ec[_0x804b('0x16')][_0x804b('0x6')]]](_0x27d5ec['params']['id'])[_0x804b('0x14')](respondWithResult(_0x2d88da,0xc8))[_0x804b('0x11')](handleError(_0x2d88da,null));}else{return _0x2d88da[_0x804b('0x6')](0x1f4)['send']({'message':_0x804b('0x23')});}};exports[_0x804b('0x24')]=function(_0x5e8f85,_0x391376){if(_0x5e8f85[_0x804b('0x16')]['id']){delete _0x5e8f85[_0x804b('0x16')]['id'];}if(_0x5e8f85[_0x804b('0x25')]['id']){return pm2[_0x804b('0x26')](_0x5e8f85[_0x804b('0x25')]['id'])['then'](function(_0x3b0692){pm2[_0x804b('0x27')]();return _0x3b0692[0x0];})[_0x804b('0x14')](respondWithResult(_0x391376,null))[_0x804b('0x11')](handleError(_0x391376,null));}else{return _0x391376[_0x804b('0x6')](0x1f4)[_0x804b('0x1d')]({'message':_0x804b('0x28')});}}; \ No newline at end of file +var _0x3667=['lodash','../../config/pm2','../../config/logger','api','path','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','create','body','join','script','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty','params','destroy','delete'];(function(_0x4b0f0b,_0x8785d1){var _0x13514=function(_0x3a50b5){while(--_0x3a50b5){_0x4b0f0b['push'](_0x4b0f0b['shift']());}};_0x13514(++_0x8785d1);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7366('0x0'));var pm2=require(_0x7366('0x1'));var logger=require(_0x7366('0x2'))(_0x7366('0x3'));var path=require(_0x7366('0x4'));var exec=require('child_process')[_0x7366('0x5')];var BPromise=require(_0x7366('0x6'));function handleEntityNotFound(_0x4b32a7,_0x27726b){return function(_0x22bfc0){if(!_0x22bfc0){_0x4b32a7[_0x7366('0x7')](0x194);;}return _0x22bfc0;};}function respondWithResult(_0x1c0cf4,_0x101e3d){_0x101e3d=_0x101e3d||0xc8;return function(_0x589397){if(_0x589397){return _0x1c0cf4[_0x7366('0x8')](_0x101e3d)[_0x7366('0x9')](_0x589397);}return null;};}function handleError(_0x2dd32b,_0x26e9a9){_0x26e9a9=_0x26e9a9||0x1f4;return function(_0x171fe2){logger[_0x7366('0xa')](_0x171fe2[_0x7366('0xb')]);if(_0x171fe2[_0x7366('0xc')]){delete _0x171fe2[_0x7366('0xc')];}_0x2dd32b[_0x7366('0x8')](_0x26e9a9)[_0x7366('0xd')](_0x171fe2);};}function execChildProcess(){return new BPromise(function(_0x2d7e38,_0x57ea7f){exec(_0x7366('0xe'),function(_0x2694fc,_0xbcd488,_0x4718db){logger[_0x7366('0xf')](_0xbcd488);logger[_0x7366('0xf')](_0x4718db);if(_0x2694fc){logger[_0x7366('0xa')](_0x2694fc);return _0x57ea7f(_0x2694fc);}return _0x2d7e38(_0xbcd488);});});}exports[_0x7366('0x10')]=function(_0x37e47e,_0x1813b7){return pm2[_0x7366('0x11')]()[_0x7366('0x12')](function(_0x27500c){if(_0x27500c){var _0x22562f=_[_0x7366('0x13')](_0x27500c,function(_0x4dd111){return _0x4dd111[_0x7366('0xc')]===_0x7366('0x14')||_0x4dd111[_0x7366('0xc')]===_0x7366('0x15');});return{'rows':_0x22562f,'count':_0x22562f[_0x7366('0x16')]};}return null;})[_0x7366('0x12')](respondWithResult(_0x1813b7,null))[_0x7366('0x17')](handleError(_0x1813b7,null));};exports[_0x7366('0x18')]=function(_0x83e5d5,_0x41113f){return pm2[_0x7366('0x19')](_0x83e5d5['params']['id'])[_0x7366('0x12')](respondWithResult(_0x41113f,null))['then'](handleEntityNotFound(_0x41113f,null))[_0x7366('0x17')](handleError(_0x41113f,null));};exports[_0x7366('0x1a')]=function(_0x3f23cd,_0x52b43e){if(_0x3f23cd[_0x7366('0x1b')][_0x7366('0xc')]&&_0x3f23cd[_0x7366('0x1b')]['script']){var _0x16e038=path[_0x7366('0x1c')](__dirname,'../../files/plugins',_0x3f23cd[_0x7366('0x1b')][_0x7366('0x1d')]);var _0xaab659=process[_0x7366('0x1e')]();process[_0x7366('0x1f')](path[_0x7366('0x20')](_0x16e038));return execChildProcess()[_0x7366('0x12')](function(_0x22ed7e){process[_0x7366('0x1f')](_0xaab659);return pm2[_0x7366('0x21')]({'name':_0x3f23cd[_0x7366('0x1b')][_0x7366('0xc')],'script':_0x16e038});})[_0x7366('0x12')](function(_0x563b22){pm2[_0x7366('0x22')]();return _0x563b22[0x0];})['then'](respondWithResult(_0x52b43e,0xc9))[_0x7366('0x17')](handleError(_0x52b43e,null));}else{return _0x52b43e['status'](0x1f4)['send']({'message':_0x7366('0x23')});}};exports['update']=function(_0x254374,_0x4ac138){if(_0x254374[_0x7366('0x1b')]['id']){delete _0x254374[_0x7366('0x1b')]['id'];}var _0x5c37e2={'online':_0x7366('0x24'),'stopped':'stop'};if(_0x5c37e2[_0x7366('0x25')](_0x254374[_0x7366('0x1b')]['status'])){return pm2[_0x5c37e2[_0x254374[_0x7366('0x1b')]['status']]](_0x254374[_0x7366('0x26')]['id'])[_0x7366('0x12')](respondWithResult(_0x4ac138,0xc8))[_0x7366('0x17')](handleError(_0x4ac138,null));}else{return _0x4ac138[_0x7366('0x8')](0x1f4)[_0x7366('0xd')]({'message':'Unknown\x20status'});}};exports[_0x7366('0x27')]=function(_0x447807,_0x538d42){if(_0x447807['body']['id']){delete _0x447807['body']['id'];}if(_0x447807['params']['id']){return pm2[_0x7366('0x28')](_0x447807[_0x7366('0x26')]['id'])[_0x7366('0x12')](function(_0x15286a){pm2['dump']();return _0x15286a[0x0];})[_0x7366('0x12')](respondWithResult(_0x538d42,null))[_0x7366('0x17')](handleError(_0x538d42,null));}else{return _0x538d42[_0x7366('0x8')](0x1f4)[_0x7366('0xd')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index bfe9658..5821a96 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 _0x023e=['exports','express','/queues','isAuthenticated'];(function(_0x586db9,_0x1ba4f8){var _0x29f15d=function(_0x1b39c7){while(--_0x1b39c7){_0x586db9['push'](_0x586db9['shift']());}};_0x29f15d(++_0x1ba4f8);}(_0x023e,0xc5));var _0xe023=function(_0x419022,_0x47cd8d){_0x419022=_0x419022-0x0;var _0x53a1a7=_0x023e[_0x419022];return _0x53a1a7;};'use strict';var express=require(_0xe023('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router['get'](_0xe023('0x1'),auth[_0xe023('0x2')](),controller['getQueues']);module[_0xe023('0x3')]=router; \ No newline at end of file +var _0x1dcd=['express','Router','../../components/auth/service','./realtime.controller','get','/queues','isAuthenticated','exports'];(function(_0x4430d0,_0x39d0ce){var _0x2f8488=function(_0x23da6c){while(--_0x23da6c){_0x4430d0['push'](_0x4430d0['shift']());}};_0x2f8488(++_0x39d0ce);}(_0x1dcd,0x100));var _0xd1dc=function(_0x3f8e39,_0x5e795a){_0x3f8e39=_0x3f8e39-0x0;var _0xfb6c1b=_0x1dcd[_0x3f8e39];return _0xfb6c1b;};'use strict';var express=require(_0xd1dc('0x0'));var router=express[_0xd1dc('0x1')]();var auth=require(_0xd1dc('0x2'));var controller=require(_0xd1dc('0x3'));router[_0xd1dc('0x4')](_0xd1dc('0x5'),auth[_0xd1dc('0x6')](),controller['getQueues']);module[_0xd1dc('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index a946841..63446f3 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 _0x7096=['pick','getAgents','online','getMembers','UserId','Pause','findAll','QueueId','User','agent','length','all','catch','lodash','../../components/parsers/qs','api','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','json','error','name','send','chat','sms','openchannel','fax','then','query','channel','toLowerCase','Invalid\x20channel','startCase','Queue','map','rawAttributes','fieldName','type','key','user','role','userProfileId','voice','outbound','QueueCampaigns','Queues','UserProfile','findAndCountAll','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','waiting','talking','paused','push','originated','message','dialActive','dialMethod','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','get','pTalking','agents','merge'];(function(_0x123423,_0x4a6dd9){var _0x4022da=function(_0x15ecd7){while(--_0x15ecd7){_0x123423['push'](_0x123423['shift']());}};_0x4022da(++_0x4a6dd9);}(_0x7096,0x10c));var _0x6709=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x7096[_0x2b7764];return _0x848dcb;};'use strict';var util=require('util');var _=require(_0x6709('0x0'));var jayson=require('jayson/promise');var qs=require(_0x6709('0x1'));var logger=require('../../config/logger')(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];var client=jayson[_0x6709('0x4')][_0x6709('0x5')]({'port':0x232a});var routingClient=jayson[_0x6709('0x4')][_0x6709('0x5')]({'port':0x232c});function respondWithFilteredResult(_0xb8fe6d,_0x9d630f){return function(_0xa35832){if(_0xa35832){var _0x3e2223=typeof _0x9d630f[_0x6709('0x6')]===_0x6709('0x7')&&typeof _0x9d630f[_0x6709('0x8')]==='undefined';var _0x5af380=_0xa35832[_0x6709('0x9')];var _0x2d8c0b=_0x3e2223?0x0:_0x9d630f[_0x6709('0x6')];var _0x1aa476=_0x3e2223?_0xa35832[_0x6709('0x9')]:_0x9d630f[_0x6709('0x6')]+_0x9d630f['limit'];var _0x5b9f26;if(_0x1aa476>=_0x5af380){_0x1aa476=_0x5af380;_0x5b9f26=0xc8;}else{_0x5b9f26=0xce;}_0xb8fe6d[_0x6709('0xa')](_0x5b9f26);return _0xb8fe6d[_0x6709('0xb')](_0x6709('0xc'),_0x2d8c0b+'-'+_0x1aa476+'/'+_0x5af380)[_0x6709('0xd')](_0xa35832);}return null;};}function handleError(_0x31ac88,_0x288f51){_0x288f51=_0x288f51||0x1f4;return function(_0x1d56a5){logger[_0x6709('0xe')](_0x1d56a5['stack']);if(_0x1d56a5[_0x6709('0xf')]){delete _0x1d56a5[_0x6709('0xf')];}_0x31ac88[_0x6709('0xa')](_0x288f51)[_0x6709('0x10')](_0x1d56a5);};}exports['getQueues']=function(_0xc728aa,_0x5c667c){var _0x41af1f=['mail',_0x6709('0x11'),_0x6709('0x12'),_0x6709('0x13'),_0x6709('0x14'),'whatsapp','voice'];var _0x5c4f94={'count':0x0,'rows':[]},_0x3fa5b1={},_0x235a54;Promise['resolve']()[_0x6709('0x15')](function(){if(_0xc728aa[_0x6709('0x16')][_0x6709('0x17')]){if(!_['includes'](_0x41af1f,_0xc728aa[_0x6709('0x16')][_0x6709('0x17')][_0x6709('0x18')]()))throw new Error(_0x6709('0x19'));_0x235a54=_0xc728aa['query'][_0x6709('0x17')][_0x6709('0x18')]();}var _0x373047=_[_0x6709('0x1a')](_0x235a54)+_0x6709('0x1b');var _0x224e8a=_[_0x6709('0x1c')](db[_0x373047][_0x6709('0x1d')],function(_0x386224){return{'name':_0x386224[_0x6709('0x1e')],'type':_0x386224[_0x6709('0x1f')][_0x6709('0x20')]};});_0x3fa5b1=qs['getOptions'](_0x224e8a,_0xc728aa);if(_0xc728aa[_0x6709('0x21')][_0x6709('0x22')]===_0x6709('0x21')){var _0x5c7982={'params':{'id':_0xc728aa[_0x6709('0x21')][_0x6709('0x23')]},'query':{'section':_0x235a54===_0x6709('0x24')&&_0xc728aa[_0x6709('0x16')]['type']===_0x6709('0x25')?_0x6709('0x26'):_['startCase'](_0x235a54)+_0x6709('0x27'),'type':_0xc728aa[_0x6709('0x16')]['type'],'nolimit':!![],'sort':_0x6709('0xf'),'filter':_0xc728aa[_0x6709('0x16')]['filter']}};return db[_0x6709('0x28')]['getResources'](_0x5c7982);}return db[_0x373047][_0x6709('0x29')](_0x3fa5b1);})[_0x6709('0x15')](function(_0x5b6906){_0x5c4f94[_0x6709('0x9')]=_0x5b6906['count'];var _0xe066d8=_0x235a54===_0x6709('0x24')?client:routingClient;return _0xe066d8['request'](_[_0x6709('0x1a')](_0x235a54)+'Queues',_0xc728aa)[_0x6709('0x15')](function(_0x135f46){if(_0x135f46['error'])throw new Error(util['format'](_0x6709('0x2a'),_0x235a54));var _0x2a0cb0=_0x135f46[_0x6709('0x2b')];var _0x3f2b5e=[_0x6709('0x2c'),_0x6709('0x2d'),_0x6709('0x2e'),_0x6709('0x2f'),_0x6709('0x30')];if(_0x235a54==='voice'&&_0xc728aa[_0x6709('0x16')][_0x6709('0x1f')]===_0x6709('0x25')){_0x3f2b5e[_0x6709('0x31')]('pTalking',_0x6709('0x32'),_0x6709('0x33'),_0x6709('0x34'),_0x6709('0x35'),'Trunk',_0x6709('0x36'),_0x6709('0x37'),'erlangCalls',_0x6709('0x38'),_0x6709('0x39'),'erlangBusyFactor',_0x6709('0x3a'),_0x6709('0x3b'),_0x6709('0x3c'),_0x6709('0x3d'),_0x6709('0x3e'),_0x6709('0x3f'),_0x6709('0x40'),'predictiveIntervalDroppedCallsCallersExit',_0x6709('0x41'),_0x6709('0x42'));}var _0x4fad54=_0x5b6906[_0x6709('0x43')][_0x6709('0x1c')](function(_0x6b5f39){var _0x2bb89c=_0x6b5f39[_0x6709('0x44')]({'plain':!![]});_0x2bb89c[_0x6709('0x30')]=0x0;_0x2bb89c['loggedInDb']=0x0;_0x2bb89c[_0x6709('0x2c')]=0x0;_0x2bb89c['available']=0x0;_0x2bb89c[_0x6709('0x30')]=0x0;_0x2bb89c[_0x6709('0x2e')]=0x0;if(_0x235a54===_0x6709('0x24')){_0x2bb89c['talking']=0x0;if(_0xc728aa[_0x6709('0x16')][_0x6709('0x1f')]===_0x6709('0x25')){_0x2bb89c[_0x6709('0x45')]=0x0;_0x2bb89c[_0x6709('0x32')]=0x0;}}_0x2bb89c[_0x6709('0x46')]=[];var _0x450654=_['find'](_0x2a0cb0[_0x6709('0x43')],['id',_0x2bb89c['id']]);if(_0x450654)_[_0x6709('0x47')](_0x2bb89c,_[_0x6709('0x48')](_0x450654,_0x3f2b5e));if(_0x235a54===_0x6709('0x24')){return _0x6b5f39[_0x6709('0x49')]({'attributes':['id',_0x6709('0xf'),_0x6709('0x4a')],'joinTableAttributes':[],'raw':!![]})['then'](function(_0x5abb53){return _0x6b5f39[_0x6709('0x4b')]({'raw':!![]})[_0x6709('0x15')](function(_0x98a12c){for(var _0x42790d=0x0;_0x42790d<_0x5abb53['length'];_0x42790d++){var _0x5afebc=_['find'](_0x98a12c,[_0x6709('0x4c'),_0x5abb53[_0x42790d]['id']]);var _0x293577={'id':_0x5abb53[_0x42790d]['id'],'name':_0x5abb53[_0x42790d]['name'],'online':Boolean(_0x5abb53[_0x42790d][_0x6709('0x4a')]),'paused':_0x5afebc?Boolean(_0x5afebc[_0x6709('0x30')]):![]};if(_0x293577['online'])_0x2bb89c['loggedInDb']++;if(_0x293577[_0x6709('0x30')])_0x2bb89c[_0x6709('0x30')]++;_0x2bb89c[_0x6709('0x46')][_0x6709('0x31')](_0x293577);}return _0x2bb89c;});});}else{var _0x13877a='User'+_[_0x6709('0x1a')](_0x235a54)+'Queue';var _0x26e871=_0x235a54+_0x6709('0x4d');return db[_0x13877a][_0x6709('0x4e')]({'where':{[_['startCase'](_0x235a54)+_0x6709('0x4f')]:_0x6b5f39['id']},'raw':!![]})['then'](function(_0x57c5bf){return db[_0x6709('0x50')][_0x6709('0x4e')]({'attributes':['id',_0x6709('0xf'),_0x6709('0x4a'),_0x26e871],'where':{'id':_[_0x6709('0x1c')](_0x57c5bf,_0x6709('0x4c')),'role':_0x6709('0x51')},'raw':!![]});})[_0x6709('0x15')](function(_0x123793){for(var _0xe999aa=0x0;_0xe999aa<_0x123793[_0x6709('0x52')];_0xe999aa++){var _0x17f95d={'id':_0x123793[_0xe999aa]['id'],'name':_0x123793[_0xe999aa][_0x6709('0xf')],'online':Boolean(_0x123793[_0xe999aa][_0x6709('0x4a')]),'paused':Boolean(_0x123793[_0xe999aa][_0x26e871])};if(_0x17f95d[_0x6709('0x4a')])_0x2bb89c['loggedInDb']++;if(_0x17f95d[_0x6709('0x30')])_0x2bb89c['paused']++;_0x2bb89c['agents'][_0x6709('0x31')](_0x17f95d);}return _0x2bb89c;});}});return Promise[_0x6709('0x53')](_0x4fad54);});})[_0x6709('0x15')](function(_0xe8dd1){_0x5c4f94[_0x6709('0x43')]=_0xe8dd1;return _0x5c4f94;})[_0x6709('0x15')](respondWithFilteredResult(_0x5c667c,_0x3fa5b1))[_0x6709('0x54')](handleError(_0x5c667c,null));}; \ No newline at end of file +var _0xfb65=['filter','UserProfile','findAndCountAll','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','waiting','talking','paused','push','pTalking','message','dialActive','Trunk','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','loggedInDb','originated','find','merge','getAgents','online','length','UserId','agents','User','Pause','findAll','QueueId','agent','all','catch','lodash','jayson/promise','../../config/logger','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','json','error','stack','name','send','chat','sms','openchannel','whatsapp','voice','resolve','query','includes','channel','toLowerCase','Invalid\x20channel','map','fieldName','type','key','user','role','userProfileId','outbound','QueueCampaigns','startCase','Queues'];(function(_0x575c7a,_0x205e8b){var _0x1455fa=function(_0x4f4b1d){while(--_0x4f4b1d){_0x575c7a['push'](_0x575c7a['shift']());}};_0x1455fa(++_0x205e8b);}(_0xfb65,0x82));var _0x5fb6=function(_0x3287c0,_0x24165a){_0x3287c0=_0x3287c0-0x0;var _0x5316e3=_0xfb65[_0x3287c0];return _0x5316e3;};'use strict';var util=require('util');var _=require(_0x5fb6('0x0'));var jayson=require(_0x5fb6('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x5fb6('0x2'))('api');var db=require(_0x5fb6('0x3'))['db'];var client=jayson[_0x5fb6('0x4')][_0x5fb6('0x5')]({'port':0x232a});var routingClient=jayson[_0x5fb6('0x4')][_0x5fb6('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x1fefe3,_0x4dec8f){return function(_0x50782b){if(_0x50782b){var _0x238914=typeof _0x4dec8f[_0x5fb6('0x6')]===_0x5fb6('0x7')&&typeof _0x4dec8f[_0x5fb6('0x8')]==='undefined';var _0x381710=_0x50782b[_0x5fb6('0x9')];var _0x46e061=_0x238914?0x0:_0x4dec8f[_0x5fb6('0x6')];var _0x4ff5d2=_0x238914?_0x50782b[_0x5fb6('0x9')]:_0x4dec8f[_0x5fb6('0x6')]+_0x4dec8f['limit'];var _0x6c3565;if(_0x4ff5d2>=_0x381710){_0x4ff5d2=_0x381710;_0x6c3565=0xc8;}else{_0x6c3565=0xce;}_0x1fefe3[_0x5fb6('0xa')](_0x6c3565);return _0x1fefe3[_0x5fb6('0xb')](_0x5fb6('0xc'),_0x46e061+'-'+_0x4ff5d2+'/'+_0x381710)[_0x5fb6('0xd')](_0x50782b);}return null;};}function handleError(_0x507d88,_0x1927d0){_0x1927d0=_0x1927d0||0x1f4;return function(_0x15b296){logger[_0x5fb6('0xe')](_0x15b296[_0x5fb6('0xf')]);if(_0x15b296[_0x5fb6('0x10')]){delete _0x15b296[_0x5fb6('0x10')];}_0x507d88[_0x5fb6('0xa')](_0x1927d0)[_0x5fb6('0x11')](_0x15b296);};}exports['getQueues']=function(_0x47a197,_0x46f1cf){var _0xfaea56=['mail',_0x5fb6('0x12'),_0x5fb6('0x13'),_0x5fb6('0x14'),'fax',_0x5fb6('0x15'),_0x5fb6('0x16')];var _0x27bd8b={'count':0x0,'rows':[]},_0x182af5={},_0x167354;Promise[_0x5fb6('0x17')]()['then'](function(){if(_0x47a197[_0x5fb6('0x18')]['channel']){if(!_[_0x5fb6('0x19')](_0xfaea56,_0x47a197['query'][_0x5fb6('0x1a')][_0x5fb6('0x1b')]()))throw new Error(_0x5fb6('0x1c'));_0x167354=_0x47a197[_0x5fb6('0x18')][_0x5fb6('0x1a')][_0x5fb6('0x1b')]();}var _0x11c21b=_['startCase'](_0x167354)+'Queue';var _0xfd8d78=_[_0x5fb6('0x1d')](db[_0x11c21b]['rawAttributes'],function(_0xdf1794){return{'name':_0xdf1794[_0x5fb6('0x1e')],'type':_0xdf1794[_0x5fb6('0x1f')][_0x5fb6('0x20')]};});_0x182af5=qs['getOptions'](_0xfd8d78,_0x47a197);if(_0x47a197[_0x5fb6('0x21')][_0x5fb6('0x22')]===_0x5fb6('0x21')){var _0x20de69={'params':{'id':_0x47a197[_0x5fb6('0x21')][_0x5fb6('0x23')]},'query':{'section':_0x167354==='voice'&&_0x47a197['query'][_0x5fb6('0x1f')]===_0x5fb6('0x24')?_0x5fb6('0x25'):_[_0x5fb6('0x26')](_0x167354)+_0x5fb6('0x27'),'type':_0x47a197[_0x5fb6('0x18')][_0x5fb6('0x1f')],'nolimit':!![],'sort':'name','filter':_0x47a197[_0x5fb6('0x18')][_0x5fb6('0x28')]}};return db[_0x5fb6('0x29')]['getResources'](_0x20de69);}return db[_0x11c21b][_0x5fb6('0x2a')](_0x182af5);})[_0x5fb6('0x2b')](function(_0x49a828){_0x27bd8b[_0x5fb6('0x9')]=_0x49a828[_0x5fb6('0x9')];var _0x52afd7=_0x167354===_0x5fb6('0x16')?client:routingClient;return _0x52afd7['request'](_[_0x5fb6('0x26')](_0x167354)+'Queues',_0x47a197)['then'](function(_0x159971){if(_0x159971[_0x5fb6('0xe')])throw new Error(util[_0x5fb6('0x2c')](_0x5fb6('0x2d'),_0x167354));var _0x36fc09=_0x159971[_0x5fb6('0x2e')];var _0x585658=[_0x5fb6('0x2f'),_0x5fb6('0x30'),_0x5fb6('0x31'),_0x5fb6('0x32'),_0x5fb6('0x33')];if(_0x167354===_0x5fb6('0x16')&&_0x47a197[_0x5fb6('0x18')][_0x5fb6('0x1f')]===_0x5fb6('0x24')){_0x585658[_0x5fb6('0x34')](_0x5fb6('0x35'),'originated',_0x5fb6('0x36'),_0x5fb6('0x37'),'dialMethod',_0x5fb6('0x38'),'startPredictive','startProgressive',_0x5fb6('0x39'),_0x5fb6('0x3a'),_0x5fb6('0x3b'),'erlangBusyFactor',_0x5fb6('0x3c'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x5fb6('0x3d'),_0x5fb6('0x3e'),_0x5fb6('0x3f'),_0x5fb6('0x40'),_0x5fb6('0x41'),_0x5fb6('0x42'),_0x5fb6('0x43'));}var _0x236e4e=_0x49a828[_0x5fb6('0x44')][_0x5fb6('0x1d')](function(_0x8446db){var _0x6bfdc2=_0x8446db['get']({'plain':!![]});_0x6bfdc2[_0x5fb6('0x33')]=0x0;_0x6bfdc2[_0x5fb6('0x45')]=0x0;_0x6bfdc2[_0x5fb6('0x2f')]=0x0;_0x6bfdc2['available']=0x0;_0x6bfdc2[_0x5fb6('0x33')]=0x0;_0x6bfdc2['waiting']=0x0;if(_0x167354===_0x5fb6('0x16')){_0x6bfdc2['talking']=0x0;if(_0x47a197[_0x5fb6('0x18')][_0x5fb6('0x1f')]===_0x5fb6('0x24')){_0x6bfdc2[_0x5fb6('0x35')]=0x0;_0x6bfdc2[_0x5fb6('0x46')]=0x0;}}_0x6bfdc2['agents']=[];var _0x1a6518=_[_0x5fb6('0x47')](_0x36fc09[_0x5fb6('0x44')],['id',_0x6bfdc2['id']]);if(_0x1a6518)_[_0x5fb6('0x48')](_0x6bfdc2,_['pick'](_0x1a6518,_0x585658));if(_0x167354===_0x5fb6('0x16')){return _0x8446db[_0x5fb6('0x49')]({'attributes':['id',_0x5fb6('0x10'),_0x5fb6('0x4a')],'joinTableAttributes':[],'raw':!![]})[_0x5fb6('0x2b')](function(_0x26962b){return _0x8446db['getMembers']({'raw':!![]})[_0x5fb6('0x2b')](function(_0x18c88c){for(var _0x290714=0x0;_0x290714<_0x26962b[_0x5fb6('0x4b')];_0x290714++){var _0xb7651f=_[_0x5fb6('0x47')](_0x18c88c,[_0x5fb6('0x4c'),_0x26962b[_0x290714]['id']]);var _0x529c2d={'id':_0x26962b[_0x290714]['id'],'name':_0x26962b[_0x290714][_0x5fb6('0x10')],'online':Boolean(_0x26962b[_0x290714][_0x5fb6('0x4a')]),'paused':_0xb7651f?Boolean(_0xb7651f[_0x5fb6('0x33')]):![]};if(_0x529c2d['online'])_0x6bfdc2[_0x5fb6('0x45')]++;if(_0x529c2d['paused'])_0x6bfdc2[_0x5fb6('0x33')]++;_0x6bfdc2[_0x5fb6('0x4d')]['push'](_0x529c2d);}return _0x6bfdc2;});});}else{var _0x116119=_0x5fb6('0x4e')+_[_0x5fb6('0x26')](_0x167354)+'Queue';var _0x53343d=_0x167354+_0x5fb6('0x4f');return db[_0x116119][_0x5fb6('0x50')]({'where':{[_[_0x5fb6('0x26')](_0x167354)+_0x5fb6('0x51')]:_0x8446db['id']},'raw':!![]})[_0x5fb6('0x2b')](function(_0x9fee51){return db[_0x5fb6('0x4e')][_0x5fb6('0x50')]({'attributes':['id',_0x5fb6('0x10'),_0x5fb6('0x4a'),_0x53343d],'where':{'id':_[_0x5fb6('0x1d')](_0x9fee51,'UserId'),'role':_0x5fb6('0x52')},'raw':!![]});})['then'](function(_0x54eedf){for(var _0x2d8b10=0x0;_0x2d8b10<_0x54eedf[_0x5fb6('0x4b')];_0x2d8b10++){var _0x18cfb1={'id':_0x54eedf[_0x2d8b10]['id'],'name':_0x54eedf[_0x2d8b10][_0x5fb6('0x10')],'online':Boolean(_0x54eedf[_0x2d8b10][_0x5fb6('0x4a')]),'paused':Boolean(_0x54eedf[_0x2d8b10][_0x53343d])};if(_0x18cfb1[_0x5fb6('0x4a')])_0x6bfdc2[_0x5fb6('0x45')]++;if(_0x18cfb1['paused'])_0x6bfdc2[_0x5fb6('0x33')]++;_0x6bfdc2[_0x5fb6('0x4d')]['push'](_0x18cfb1);}return _0x6bfdc2;});}});return Promise[_0x5fb6('0x53')](_0x236e4e);});})[_0x5fb6('0x2b')](function(_0x1d6188){_0x27bd8b[_0x5fb6('0x44')]=_0x1d6188;return _0x27bd8b;})[_0x5fb6('0x2b')](respondWithFilteredResult(_0x46f1cf,_0x182af5))[_0x5fb6('0x54')](handleError(_0x46f1cf,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 77ab56a..e06a7b2 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2f9f2e,_0x803bef){var _0x2b78c9=function(_0xdee88c){while(--_0xdee88c){_0x2f9f2e['push'](_0x2f9f2e['shift']());}};_0x2b78c9(++_0x803bef);}(_0x70e0,0x17b));var _0x070e=function(_0x5d4b5d,_0x57e58e){_0x5d4b5d=_0x5d4b5d-0x0;var _0x1e1e36=_0x70e0[_0x5d4b5d];return _0x1e1e36;};'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(_0x2081aa,_0x31d653){var _0x36485d=function(_0x4381f5){while(--_0x4381f5){_0x2081aa['push'](_0x2081aa['shift']());}};_0x36485d(++_0x31d653);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 790dbb2..5f7e2c7 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 _0xbe2a=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x47ddbb,_0x1b11ea){var _0x139542=function(_0x318bba){while(--_0x318bba){_0x47ddbb['push'](_0x47ddbb['shift']());}};_0x139542(++_0x1b11ea);}(_0xbe2a,0x1d9));var _0xabe2=function(_0x367c86,_0x5a361b){_0x367c86=_0x367c86-0x0;var _0x1243da=_0xbe2a[_0x367c86];return _0x1243da;};'use strict';var Sequelize=require(_0xabe2('0x0'));module[_0xabe2('0x1')]={'state':{'type':Sequelize[_0xabe2('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xabe2('0x3')]},'scheduledat':{'type':Sequelize[_0xabe2('0x4')]},'uniqueid':{'type':Sequelize[_0xabe2('0x3')]},'starttime':{'type':Sequelize[_0xabe2('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xabe2('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xabe2('0x3')]},'membername':{'type':Sequelize[_0xabe2('0x3')]}}; \ No newline at end of file +var _0x5581=['DATE','sequelize','INTEGER','STRING'];(function(_0x100095,_0x2fe3de){var _0x5935e2=function(_0x4e427e){while(--_0x4e427e){_0x100095['push'](_0x100095['shift']());}};_0x5935e2(++_0x2fe3de);}(_0x5581,0x115));var _0x1558=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x5581[_0x209941];return _0x1e8729;};'use strict';var Sequelize=require(_0x1558('0x0'));module['exports']={'state':{'type':Sequelize[_0x1558('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x1558('0x2')]},'scheduledat':{'type':Sequelize[_0x1558('0x3')]},'uniqueid':{'type':Sequelize[_0x1558('0x2')]},'starttime':{'type':Sequelize[_0x1558('0x3')]},'responsetime':{'type':Sequelize[_0x1558('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x1558('0x2')]},'campaigntype':{'type':Sequelize[_0x1558('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 30c1769..2fc09e4 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 _0x0bb9=['path','rimraf','./reportAgentPreview.attributes','exports','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x5b6a9d,_0x2e6019){var _0x1dc718=function(_0x53663c){while(--_0x53663c){_0x5b6a9d['push'](_0x5b6a9d['shift']());}};_0x1dc718(++_0x2e6019);}(_0x0bb9,0x109));var _0x90bb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0bb9[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x90bb('0x0'));var util=require(_0x90bb('0x1'));var logger=require(_0x90bb('0x2'))('api');var moment=require('moment');var BPromise=require(_0x90bb('0x3'));var rp=require(_0x90bb('0x4'));var fs=require('fs');var path=require(_0x90bb('0x5'));var rimraf=require(_0x90bb('0x6'));var config=require('../../config/environment');var attributes=require(_0x90bb('0x7'));module[_0x90bb('0x8')]=function(_0x2bb785,_0x1db292){return _0x2bb785['define']('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3237=['./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0x3237,0x149));var _0x7323=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x3237[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7323('0x0'));var util=require(_0x7323('0x1'));var logger=require(_0x7323('0x2'))(_0x7323('0x3'));var moment=require(_0x7323('0x4'));var BPromise=require(_0x7323('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7323('0x6'));var rimraf=require(_0x7323('0x7'));var config=require(_0x7323('0x8'));var attributes=require(_0x7323('0x9'));module[_0x7323('0xa')]=function(_0x353615,_0x4cc2ad){return _0x353615[_0x7323('0xb')]('ReportAgentPreview',attributes,{'tableName':_0x7323('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 5ea7765..847560b 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 _0x4ed7=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','create','body','options','raw','CreateReportAgentPreview','stringify','util','moment','bluebird'];(function(_0x395872,_0x36626f){var _0x574871=function(_0x1fda6e){while(--_0x1fda6e){_0x395872['push'](_0x395872['shift']());}};_0x574871(++_0x36626f);}(_0x4ed7,0x69));var _0x74ed=function(_0x500785,_0x15e5ff){_0x500785=_0x500785-0x0;var _0x1f8bcc=_0x4ed7[_0x500785];return _0x1f8bcc;};'use strict';var _=require('lodash');var util=require(_0x74ed('0x0'));var moment=require(_0x74ed('0x1'));var BPromise=require(_0x74ed('0x2'));var rs=require(_0x74ed('0x3'));var fs=require('fs');var Redis=require(_0x74ed('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x74ed('0x5'));var logger=require(_0x74ed('0x6'))(_0x74ed('0x7'));var config=require(_0x74ed('0x8'));var jayson=require(_0x74ed('0x9'));var client=jayson['client'][_0x74ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b34bb,_0x30620e,_0x6fe331){return new BPromise(function(_0x11e3f7,_0x2cd605){return client['request'](_0x5b34bb,_0x6fe331)[_0x74ed('0xb')](function(_0x425642){logger[_0x74ed('0xc')](_0x74ed('0xd'),_0x30620e,_0x74ed('0xe'));logger['debug'](_0x74ed('0xf'),_0x30620e,_0x74ed('0xe'),JSON['stringify'](_0x425642));if(_0x425642[_0x74ed('0x10')]){if(_0x425642[_0x74ed('0x10')][_0x74ed('0x11')]===0x1f4){logger['error'](_0x74ed('0xd'),_0x30620e,_0x425642['error'][_0x74ed('0x12')]);return _0x2cd605(_0x425642[_0x74ed('0x10')][_0x74ed('0x12')]);}logger[_0x74ed('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x30620e,_0x425642['error'][_0x74ed('0x12')]);return _0x11e3f7(_0x425642[_0x74ed('0x10')][_0x74ed('0x12')]);}else{logger[_0x74ed('0xc')](_0x74ed('0xd'),_0x30620e,_0x74ed('0xe'));_0x11e3f7(_0x425642[_0x74ed('0x13')]['message']);}})[_0x74ed('0x14')](function(_0x4cdf67){logger[_0x74ed('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x30620e,_0x4cdf67);_0x2cd605(_0x4cdf67);});});}exports['CreateReportAgentPreview']=function(_0x1dd005){var _0x3d6316=this;return new Promise(function(_0x11351a,_0x33ac8a){return db['ReportAgentPreview'][_0x74ed('0x15')](_0x1dd005[_0x74ed('0x16')],{'raw':_0x1dd005[_0x74ed('0x17')]?_0x1dd005['options'][_0x74ed('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x5871af){logger[_0x74ed('0xc')](_0x74ed('0x19'),_0x1dd005);logger['debug'](_0x74ed('0x19'),_0x1dd005,JSON[_0x74ed('0x1a')](_0x5871af));_0x11351a(_0x5871af);})[_0x74ed('0x14')](function(_0x2bfaec){logger[_0x74ed('0x10')](_0x74ed('0x19'),_0x2bfaec[_0x74ed('0x12')],_0x1dd005);_0x33ac8a(_0x3d6316[_0x74ed('0x10')](0x1f4,_0x2bfaec[_0x74ed('0x12')]));});});}; \ No newline at end of file +var _0x0d9d=['util','moment','bluebird','rpc','../../config/environment','jayson/promise','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CreateReportAgentPreview','ReportAgentPreview','body','options','catch'];(function(_0x4f3086,_0x338cb4){var _0x4ba6dd=function(_0x1a6b48){while(--_0x1a6b48){_0x4f3086['push'](_0x4f3086['shift']());}};_0x4ba6dd(++_0x338cb4);}(_0x0d9d,0xb8));var _0xd0d9=function(_0x3b8e89,_0xc371ce){_0x3b8e89=_0x3b8e89-0x0;var _0xab8aec=_0x0d9d[_0x3b8e89];return _0xab8aec;};'use strict';var _=require('lodash');var util=require(_0xd0d9('0x0'));var moment=require(_0xd0d9('0x1'));var BPromise=require(_0xd0d9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd0d9('0x3'));var config=require(_0xd0d9('0x4'));var jayson=require(_0xd0d9('0x5'));var client=jayson['client'][_0xd0d9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x24e1df,_0x361a49,_0x32940e){return new BPromise(function(_0x38dc52,_0x1fab3a){return client[_0xd0d9('0x7')](_0x24e1df,_0x32940e)[_0xd0d9('0x8')](function(_0x205c34){logger['info'](_0xd0d9('0x9'),_0x361a49,_0xd0d9('0xa'));logger[_0xd0d9('0xb')](_0xd0d9('0xc'),_0x361a49,_0xd0d9('0xa'),JSON[_0xd0d9('0xd')](_0x205c34));if(_0x205c34[_0xd0d9('0xe')]){if(_0x205c34[_0xd0d9('0xe')][_0xd0d9('0xf')]===0x1f4){logger[_0xd0d9('0xe')](_0xd0d9('0x9'),_0x361a49,_0x205c34[_0xd0d9('0xe')]['message']);return _0x1fab3a(_0x205c34[_0xd0d9('0xe')]['message']);}logger['error'](_0xd0d9('0x9'),_0x361a49,_0x205c34[_0xd0d9('0xe')]['message']);return _0x38dc52(_0x205c34['error'][_0xd0d9('0x10')]);}else{logger[_0xd0d9('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x361a49,_0xd0d9('0xa'));_0x38dc52(_0x205c34['result']['message']);}})['catch'](function(_0x35a0d0){logger[_0xd0d9('0xe')](_0xd0d9('0x9'),_0x361a49,_0x35a0d0);_0x1fab3a(_0x35a0d0);});});}exports[_0xd0d9('0x12')]=function(_0x53297d){var _0x301bf2=this;return new Promise(function(_0x457366,_0x4a55d8){return db[_0xd0d9('0x13')]['create'](_0x53297d[_0xd0d9('0x14')],{'raw':_0x53297d[_0xd0d9('0x15')]?_0x53297d['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5412f0){logger['info'](_0xd0d9('0x12'),_0x53297d);logger[_0xd0d9('0xb')](_0xd0d9('0x12'),_0x53297d,JSON[_0xd0d9('0xd')](_0x5412f0));_0x457366(_0x5412f0);})[_0xd0d9('0x16')](function(_0x5a696){logger[_0xd0d9('0xe')](_0xd0d9('0x12'),_0x5a696['message'],_0x53297d);_0x4a55d8(_0x301bf2[_0xd0d9('0xe')](0x1f4,_0x5a696[_0xd0d9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 799e3f4..d6eca18 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 _0x27ce=['whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','outbound','/outbound/channels','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x27ce,0x1d8));var _0xe27c=function(_0x4145a2,_0x4770b6){_0x4145a2=_0x4145a2-0x0;var _0x578557=_0x27ce[_0x4145a2];return _0x578557;};'use strict';var multer=require(_0xe27c('0x0'));var util=require(_0xe27c('0x1'));var path=require(_0xe27c('0x2'));var express=require(_0xe27c('0x3'));var router=express[_0xe27c('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0xe27c('0x5'));router[_0xe27c('0x6')](_0xe27c('0x7'),auth[_0xe27c('0x8')](),controller['voiceChannels']);router[_0xe27c('0x6')](_0xe27c('0x9'),auth[_0xe27c('0x8')](),controller['voiceChannelMixMonitor']);router[_0xe27c('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xe27c('0x8')](),controller[_0xe27c('0xa')]);router[_0xe27c('0x6')](_0xe27c('0xb'),auth['isAuthenticated'](),controller[_0xe27c('0xc')]);router[_0xe27c('0x6')](_0xe27c('0xd'),auth[_0xe27c('0x8')](),controller['chatQueues']);router['get'](_0xe27c('0xe'),auth[_0xe27c('0x8')](),controller[_0xe27c('0xf')]);router[_0xe27c('0x6')]('/mail/accounts',auth['isAuthenticated'](),controller['mailAccounts']);router['get'](_0xe27c('0x10'),auth[_0xe27c('0x8')](),controller[_0xe27c('0x11')]);router['get']('/sms/queues',auth['isAuthenticated'](),controller[_0xe27c('0x12')]);router[_0xe27c('0x6')](_0xe27c('0x13'),auth[_0xe27c('0x8')](),controller[_0xe27c('0x14')]);router[_0xe27c('0x6')]('/fax/queues',auth[_0xe27c('0x8')](),controller[_0xe27c('0x15')]);router['get'](_0xe27c('0x16'),auth[_0xe27c('0x8')](),controller[_0xe27c('0x17')]);router[_0xe27c('0x6')](_0xe27c('0x18'),auth['isAuthenticated'](),controller[_0xe27c('0x19')]);router[_0xe27c('0x6')](_0xe27c('0x1a'),auth[_0xe27c('0x8')](),controller[_0xe27c('0x1b')]);router[_0xe27c('0x6')](_0xe27c('0x1c'),auth[_0xe27c('0x8')](),controller['voiceQueuesChannelHangup']);router[_0xe27c('0x6')](_0xe27c('0x1d'),auth[_0xe27c('0x8')](),controller[_0xe27c('0x1e')]);router[_0xe27c('0x6')](_0xe27c('0x1f'),auth[_0xe27c('0x8')](),controller[_0xe27c('0x20')]);router[_0xe27c('0x21')](_0xe27c('0x1f'),auth[_0xe27c('0x8')](),controller[_0xe27c('0x22')]);router['get']('/outbound',auth[_0xe27c('0x8')](),controller[_0xe27c('0x23')]);router[_0xe27c('0x6')](_0xe27c('0x24'),auth[_0xe27c('0x8')](),controller['outboundChannels']);router[_0xe27c('0x6')]('/agents',auth['isAuthenticated'](),controller[_0xe27c('0x25')]);router[_0xe27c('0x21')](_0xe27c('0x26'),auth['isAuthenticated'](),controller[_0xe27c('0x27')]);router[_0xe27c('0x6')]('/telephones',auth[_0xe27c('0x8')](),controller[_0xe27c('0x28')]);router[_0xe27c('0x6')](_0xe27c('0x29'),auth['isAuthenticated'](),controller[_0xe27c('0x2a')]);router[_0xe27c('0x6')]('/campaigns',auth['isAuthenticated'](),controller['campaigns']);router[_0xe27c('0x6')](_0xe27c('0x2b'),auth['isAuthenticated'](),controller[_0xe27c('0x2c')]);router[_0xe27c('0x6')](_0xe27c('0x2d'),auth['isAuthenticated'](),controller[_0xe27c('0x2e')]);router[_0xe27c('0x6')](_0xe27c('0x2f'),auth['isAuthenticated'](),controller[_0xe27c('0x30')]);router[_0xe27c('0x6')](_0xe27c('0x31'),auth[_0xe27c('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0xe27c('0x6')](_0xe27c('0x32'),auth[_0xe27c('0x8')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xe27c('0x6')](_0xe27c('0x33'),auth[_0xe27c('0x8')](),controller[_0xe27c('0x34')]);router[_0xe27c('0x6')](_0xe27c('0x35'),auth[_0xe27c('0x8')](),controller['whatsappQueuesWaitingInteractions']);router[_0xe27c('0x6')](_0xe27c('0x36'),auth['isAuthenticated'](),controller[_0xe27c('0x37')]);router[_0xe27c('0x38')](_0xe27c('0x39'),auth[_0xe27c('0x8')](),controller[_0xe27c('0x3a')](_0xe27c('0x3b')));router[_0xe27c('0x6')](_0xe27c('0x3c'),auth['isAuthenticated'](),controller[_0xe27c('0x3d')]);router[_0xe27c('0x38')](_0xe27c('0x3e'),auth['isAuthenticated'](),controller[_0xe27c('0x3a')](_0xe27c('0x3f')));router['get']('/chat/queues/:id',auth['isAuthenticated'](),controller['showChatQueues']);router[_0xe27c('0x38')]('/fax/queues/:id/notify',auth[_0xe27c('0x8')](),controller[_0xe27c('0x3a')](_0xe27c('0x40')));router[_0xe27c('0x6')](_0xe27c('0x41'),auth[_0xe27c('0x8')](),controller[_0xe27c('0x42')]);router[_0xe27c('0x38')](_0xe27c('0x43'),auth[_0xe27c('0x8')](),controller[_0xe27c('0x3a')](_0xe27c('0x44')));router[_0xe27c('0x6')](_0xe27c('0x45'),auth[_0xe27c('0x8')](),controller[_0xe27c('0x46')]);router[_0xe27c('0x38')](_0xe27c('0x47'),auth[_0xe27c('0x8')](),controller['queueNotify'](_0xe27c('0x48')));router['post'](_0xe27c('0x49'),auth[_0xe27c('0x8')](),controller[_0xe27c('0x3a')](_0xe27c('0x4a')));router[_0xe27c('0x6')](_0xe27c('0x4b'),auth[_0xe27c('0x8')](),controller[_0xe27c('0x4c')]);router[_0xe27c('0x6')](_0xe27c('0x4d'),auth['isAuthenticated'](),controller[_0xe27c('0x4e')]);router[_0xe27c('0x38')](_0xe27c('0x4f'),auth['isAuthenticated'](),controller[_0xe27c('0x50')]);module[_0xe27c('0x51')]=router; \ No newline at end of file +var _0xbc1b=['openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','showChatQueues','post','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','express','../../components/auth/service','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceQueues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','smsQueues','/whatsapp/queues','faxQueues','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','outboundChannels','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions'];(function(_0x539840,_0x30437b){var _0x1de8d5=function(_0x2cf0c7){while(--_0x2cf0c7){_0x539840['push'](_0x539840['shift']());}};_0x1de8d5(++_0x30437b);}(_0xbc1b,0xb2));var _0xbbc1=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xbc1b[_0x22f8ab];return _0x2a70e5;};'use strict';var multer=require(_0xbbc1('0x0'));var util=require(_0xbbc1('0x1'));var path=require(_0xbbc1('0x2'));var express=require(_0xbbc1('0x3'));var router=express['Router']();var auth=require(_0xbbc1('0x4'));var controller=require('./rpc.controller');router[_0xbbc1('0x5')]('/voice/channels',auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x7')]);router[_0xbbc1('0x5')](_0xbbc1('0x8'),auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x9')]);router[_0xbbc1('0x5')](_0xbbc1('0xa'),auth[_0xbbc1('0x6')](),controller['voiceChannelStopMixMonitor']);router[_0xbbc1('0x5')]('/voice/queues',auth[_0xbbc1('0x6')](),controller[_0xbbc1('0xb')]);router['get']('/chat/queues',auth['isAuthenticated'](),controller[_0xbbc1('0xc')]);router[_0xbbc1('0x5')](_0xbbc1('0xd'),auth[_0xbbc1('0x6')](),controller[_0xbbc1('0xe')]);router[_0xbbc1('0x5')]('/mail/accounts',auth[_0xbbc1('0x6')](),controller[_0xbbc1('0xf')]);router['get'](_0xbbc1('0x10'),auth[_0xbbc1('0x6')](),controller['openchannelQueues']);router['get']('/sms/queues',auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x11')]);router['get'](_0xbbc1('0x12'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0xbbc1('0x5')]('/fax/queues',auth['isAuthenticated'](),controller[_0xbbc1('0x13')]);router[_0xbbc1('0x5')]('/voice/queues/preview/:id',auth[_0xbbc1('0x6')](),controller['voiceQueuesPreview']);router[_0xbbc1('0x5')](_0xbbc1('0x14'),auth['isAuthenticated'](),controller[_0xbbc1('0x15')]);router[_0xbbc1('0x5')](_0xbbc1('0x16'),auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x17')]);router[_0xbbc1('0x5')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x18')]);router[_0xbbc1('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x19')]);router['get'](_0xbbc1('0x1a'),auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x1b')]);router[_0xbbc1('0x1c')](_0xbbc1('0x1a'),auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x1d')]);router[_0xbbc1('0x5')](_0xbbc1('0x1e'),auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x1f')]);router[_0xbbc1('0x5')]('/outbound/channels',auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x20')]);router[_0xbbc1('0x5')]('/agents',auth['isAuthenticated'](),controller[_0xbbc1('0x21')]);router[_0xbbc1('0x1c')](_0xbbc1('0x22'),auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x23')]);router['get'](_0xbbc1('0x24'),auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x25')]);router['get']('/trunks',auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x26')]);router[_0xbbc1('0x5')]('/campaigns',auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x27')]);router[_0xbbc1('0x5')](_0xbbc1('0x28'),auth['isAuthenticated'](),controller[_0xbbc1('0x29')]);router[_0xbbc1('0x5')](_0xbbc1('0x2a'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0xbbc1('0x5')](_0xbbc1('0x2b'),auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x2c')]);router[_0xbbc1('0x5')]('/openchannel/queues/waitinginteractions',auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x2d')]);router[_0xbbc1('0x5')](_0xbbc1('0x2e'),auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x2f')]);router[_0xbbc1('0x5')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xbbc1('0x30')]);router['get'](_0xbbc1('0x31'),auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x32')]);router[_0xbbc1('0x5')](_0xbbc1('0x33'),auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x34')]);router['post'](_0xbbc1('0x35'),auth[_0xbbc1('0x6')](),controller['queueNotify']('mail'));router[_0xbbc1('0x5')](_0xbbc1('0x36'),auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x37')]);router['post'](_0xbbc1('0x38'),auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x39')](_0xbbc1('0x3a')));router[_0xbbc1('0x5')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0xbbc1('0x3b')]);router[_0xbbc1('0x3c')]('/fax/queues/:id/notify',auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x39')](_0xbbc1('0x3d')));router[_0xbbc1('0x5')](_0xbbc1('0x3e'),auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x3f')]);router[_0xbbc1('0x3c')]('/openchannel/queues/:id/notify',auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x39')](_0xbbc1('0x40')));router[_0xbbc1('0x5')](_0xbbc1('0x41'),auth['isAuthenticated'](),controller[_0xbbc1('0x42')]);router[_0xbbc1('0x3c')](_0xbbc1('0x43'),auth['isAuthenticated'](),controller[_0xbbc1('0x39')](_0xbbc1('0x44')));router[_0xbbc1('0x3c')](_0xbbc1('0x45'),auth[_0xbbc1('0x6')](),controller['queueNotify']('whatsapp'));router[_0xbbc1('0x5')]('/sms/queues/:id',auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x46')]);router[_0xbbc1('0x5')](_0xbbc1('0x47'),auth[_0xbbc1('0x6')](),controller[_0xbbc1('0x48')]);router[_0xbbc1('0x3c')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0xbbc1('0x49')]);module[_0xbbc1('0x4a')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 7266dc4..4f3b682 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 _0xf2ca=['voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','findAll','INTERACTION','length','findOrCreate','interface','format','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','map','uniq','value','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','QueueId','*,*,*,*','agentNotify','channel','User','Agent\x20not\x20found','Message','TransferReport','create','Start','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','find','rows','VoiceChannels','query','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0xf2ca[_0x5a60ce];return _0x393e5e;};'use strict';var BPromise=require(_0xaf2c('0x0'));var moment=require(_0xaf2c('0x1'));var _=require(_0xaf2c('0x2'));var util=require('util');var db=require(_0xaf2c('0x3'))['db'];var logger=require(_0xaf2c('0x4'))(_0xaf2c('0x5'));var jayson=require(_0xaf2c('0x6'));var amiClient=jayson[_0xaf2c('0x7')][_0xaf2c('0x8')]({'port':0x232a});var mailClient=jayson['client'][_0xaf2c('0x8')]({'port':0x232b});var routingClient=jayson[_0xaf2c('0x7')][_0xaf2c('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1f9531,_0x58351f,_0x37fedd){return new BPromise(function(_0x3c0421,_0x4a7397){var _0x2a011d=_0x37fedd?_0x37fedd:amiClient;return _0x2a011d['request'](_0x1f9531,_0x58351f)[_0xaf2c('0x9')](function(_0x4a0064){if(_0x4a0064[_0xaf2c('0xa')]){if(_0x4a0064[_0xaf2c('0xa')][_0xaf2c('0xb')]===0x1f4){return _0x4a7397(_0x4a0064[_0xaf2c('0xa')]['message']);}return _0x3c0421(_0x4a0064['error'][_0xaf2c('0xc')]);}else{_0x3c0421(_0x4a0064[_0xaf2c('0xd')]);}})[_0xaf2c('0xe')](function(_0xd56a5d){_0x4a7397(_0xd56a5d);});});}function respondWithResult(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xc8;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0xf')](_0x59a59b)[_0xaf2c('0x10')](_0x590126);}return _0x285dac[_0xaf2c('0x11')](0x194);};}function handleError(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0x1f4;return function(_0x152c73){logger[_0xaf2c('0xa')](_0x152c73[_0xaf2c('0x12')]);if(_0x152c73[_0xaf2c('0x13')]){delete _0x152c73[_0xaf2c('0x13')];}_0x18a8a5[_0xaf2c('0xf')](_0x293ca6)[_0xaf2c('0x14')](_0x152c73);};}function findById(_0x26bf7b){return function(_0x3432e4){if(!_[_0xaf2c('0x15')](_0x26bf7b)&&!_['isNil'](_0x3432e4)&&!_[_0xaf2c('0x15')](_0x3432e4['rows'])){return _[_0xaf2c('0x16')](_0x3432e4[_0xaf2c('0x17')],function(_0x1d544a){return _0x1d544a['id']==_0x26bf7b;});}return null;};}exports['voiceChannels']=function(_0x28ae7b,_0x297bcd){return respondWithRpcPromise(_0xaf2c('0x18'),_0x28ae7b[_0xaf2c('0x19')])[_0xaf2c('0x9')](respondWithResult(_0x297bcd,null))[_0xaf2c('0xe')](handleError(_0x297bcd,null));};exports['voiceChannelMixMonitor']=function(_0x35e712,_0x164bcb){return respondWithRpcPromise(_0xaf2c('0x1a'),_[_0xaf2c('0x1b')](_0x35e712[_0xaf2c('0x19')],_0x35e712['params']))[_0xaf2c('0x9')](respondWithResult(_0x164bcb,null))[_0xaf2c('0xe')](handleError(_0x164bcb,null));};exports[_0xaf2c('0x1c')]=function(_0x4be6ed,_0x59b113){return respondWithRpcPromise(_0xaf2c('0x1d'),_[_0xaf2c('0x1b')](_0x4be6ed[_0xaf2c('0x19')],_0x4be6ed[_0xaf2c('0x1e')]))['then'](respondWithResult(_0x59b113,null))[_0xaf2c('0xe')](handleError(_0x59b113,null));};exports[_0xaf2c('0x1f')]=function(_0x3a0145,_0x3c1ae6){return respondWithRpcPromise(_0xaf2c('0x20'),_0x3a0145[_0xaf2c('0x19')])[_0xaf2c('0x9')](respondWithResult(_0x3c1ae6,null))['catch'](handleError(_0x3c1ae6,null));};exports[_0xaf2c('0x21')]=function(_0x2051be,_0x36f37c){return respondWithRpcPromise(_0xaf2c('0x20'),_0x2051be['query'])[_0xaf2c('0x9')](findById(_0x2051be['params']['id']))[_0xaf2c('0x9')](respondWithResult(_0x36f37c,null))[_0xaf2c('0xe')](handleError(_0x36f37c,null));};exports[_0xaf2c('0x22')]=function(_0x5d685a,_0x2747bb){return respondWithRpcPromise(_0xaf2c('0x23'),_[_0xaf2c('0x1b')](_0x5d685a['body'],_0x5d685a[_0xaf2c('0x1e')]))[_0xaf2c('0x9')](respondWithResult(_0x2747bb,null))[_0xaf2c('0xe')](handleError(_0x2747bb,null));};exports[_0xaf2c('0x24')]=function(_0x59d858,_0x3da072){return respondWithRpcPromise(_0xaf2c('0x25'),_[_0xaf2c('0x1b')](_0x59d858['query'],_0x59d858['params']))[_0xaf2c('0x9')](respondWithResult(_0x3da072,null))['catch'](handleError(_0x3da072,null));};exports[_0xaf2c('0x26')]=function(_0x5e7247,_0x337cea){return respondWithRpcPromise(_0xaf2c('0x27'),_0x5e7247['query'])[_0xaf2c('0x9')](respondWithResult(_0x337cea,null))[_0xaf2c('0xe')](handleError(_0x337cea,null));};exports['voiceQueuesChannel']=function(_0x13ced2,_0xbec302){return respondWithRpcPromise(_0xaf2c('0x28'),_[_0xaf2c('0x1b')](_0x13ced2[_0xaf2c('0x19')],_0x13ced2[_0xaf2c('0x1e')]))['then'](respondWithResult(_0xbec302,null))[_0xaf2c('0xe')](handleError(_0xbec302,null));};exports['voiceQueuesChannelHangup']=function(_0x321f7c,_0x514bff){return respondWithRpcPromise(_0xaf2c('0x29'),_['merge'](_0x321f7c[_0xaf2c('0x19')],_0x321f7c['params']))[_0xaf2c('0x9')](respondWithResult(_0x514bff,null))['catch'](handleError(_0x514bff,null));};exports[_0xaf2c('0x2a')]=function(_0x356402,_0x1a6929){return respondWithRpcPromise(_0xaf2c('0x2b'),_[_0xaf2c('0x1b')](_0x356402['query'],_0x356402['params']))[_0xaf2c('0x9')](respondWithResult(_0x1a6929,null))[_0xaf2c('0xe')](handleError(_0x1a6929,null));};exports[_0xaf2c('0x2c')]=function(_0xa44813,_0x4eeecf){return respondWithRpcPromise(_0xaf2c('0x2d'),_0xa44813['query'])[_0xaf2c('0x9')](respondWithResult(_0x4eeecf,null))[_0xaf2c('0xe')](handleError(_0x4eeecf,null));};exports['outboundChannels']=function(_0x36081a,_0x24668d){return respondWithRpcPromise(_0xaf2c('0x2e'),_0x36081a[_0xaf2c('0x19')])[_0xaf2c('0x9')](respondWithResult(_0x24668d,null))[_0xaf2c('0xe')](handleError(_0x24668d,null));};exports[_0xaf2c('0x2f')]=function(_0x310d3b,_0x296ca8){var _0x106eb9;return respondWithRpcPromise(_0xaf2c('0x30'),_0x310d3b[_0xaf2c('0x19')])[_0xaf2c('0x9')](function(_0x4b524d){_0x106eb9=_0x4b524d;return respondWithRpcPromise('Agents',_0x310d3b['query'],routingClient);})[_0xaf2c('0x9')](function(_0x3cb075){return _[_0xaf2c('0x1b')]({},_0x3cb075,_0x106eb9);})[_0xaf2c('0x9')](respondWithResult(_0x296ca8,null))[_0xaf2c('0xe')](handleError(_0x296ca8,null));};exports[_0xaf2c('0x31')]=function(_0x51c441,_0x1d58bd){if(_0x51c441[_0xaf2c('0x32')]&&_0x51c441[_0xaf2c('0x32')]['interaction']&&_0x51c441['user']&&_0x51c441[_0xaf2c('0x33')]['name']){for(var _0x181787 in _0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')]){if(_0x51c441[_0xaf2c('0x32')]['interaction'][_0xaf2c('0x35')](_0x181787)){db['MemberReport'][_0xaf2c('0x36')]({'where':{'channel':_0x181787,'membername':_0x51c441[_0xaf2c('0x33')]['name'],'type':_0xaf2c('0x37'),'exitAt':null,'uniqueid':_0x51c441['body'][_0xaf2c('0x34')][_0x181787]&&_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787][_0xaf2c('0x38')]?{'$notIn':_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787]}:{'$ne':null}}})[_0xaf2c('0x9')](function(_0x16b469){var _0x922b9=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x18e62b=0x0,_0x4d0977=_0x16b469['length'];_0x18e62b<_0x4d0977;_0x18e62b+=0x1){_0x16b469[_0x18e62b]['updateAttributes']({'exitAt':_0x922b9});}});for(var _0x11a90a=0x0;_0x11a90a<_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787][_0xaf2c('0x38')];_0x11a90a+=0x1){db['MemberReport'][_0xaf2c('0x39')]({'where':{'channel':_0x181787,'membername':_0x51c441['user'][_0xaf2c('0x13')],'type':'INTERACTION','uniqueid':_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787][_0x11a90a],'exitAt':null},'defaults':{'channel':_0x181787,'membername':_0x51c441[_0xaf2c('0x33')][_0xaf2c('0x13')],'interface':_[_0xaf2c('0x15')](_0x51c441['user'][_0xaf2c('0x3a')])?util[_0xaf2c('0x3b')]('SIP/%s',_0x51c441['user'][_0xaf2c('0x13')]):_0x51c441['user'][_0xaf2c('0x3a')],'type':_0xaf2c('0x37'),'enterAt':moment()[_0xaf2c('0x3b')](_0xaf2c('0x3c')),'role':_0xaf2c('0x3d'),'internal':_0x51c441[_0xaf2c('0x33')][_0xaf2c('0x3e')],'uniqueid':_0x51c441[_0xaf2c('0x32')][_0xaf2c('0x34')][_0x181787][_0x11a90a]}});}}}}return respondWithRpcPromise(_0xaf2c('0x3f'),{'id':_0x51c441[_0xaf2c('0x1e')]['id'],'capacity':_0x51c441['body'][_0xaf2c('0x40')]},routingClient)[_0xaf2c('0x9')](respondWithResult(_0x1d58bd,null))['catch'](handleError(_0x1d58bd,null));};exports['telephones']=function(_0x56d7ce,_0x7ddca0){return respondWithRpcPromise(_0xaf2c('0x41'),_0x56d7ce['query'])[_0xaf2c('0x9')](respondWithResult(_0x7ddca0,null))[_0xaf2c('0xe')](handleError(_0x7ddca0,null));};exports[_0xaf2c('0x42')]=function(_0x3085e5,_0x265748){return respondWithRpcPromise(_0xaf2c('0x43'),_0x3085e5[_0xaf2c('0x19')])['then'](respondWithResult(_0x265748,null))[_0xaf2c('0xe')](handleError(_0x265748,null));};exports[_0xaf2c('0x44')]=function(_0x5771e5,_0x245797){return respondWithRpcPromise(_0xaf2c('0x45'),_0x5771e5[_0xaf2c('0x19')])[_0xaf2c('0x9')](respondWithResult(_0x245797,null))[_0xaf2c('0xe')](handleError(_0x245797,null));};exports[_0xaf2c('0x46')]=function(_0x332340,_0x15a335){return respondWithRpcPromise(_0xaf2c('0x47'),_0x332340[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x15a335,null))[_0xaf2c('0xe')](handleError(_0x15a335,null));};exports[_0xaf2c('0x48')]=function(_0x2356a0,_0x297a22){return respondWithRpcPromise(_0xaf2c('0x47'),_0x2356a0[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0x2356a0[_0xaf2c('0x1e')]['id']))[_0xaf2c('0x9')](respondWithResult(_0x297a22,null))['catch'](handleError(_0x297a22,null));};exports[_0xaf2c('0x49')]=function(_0x3ac79c,_0xfe5928){return respondWithRpcPromise('MailQueues',_0x3ac79c[_0xaf2c('0x19')],routingClient)['then'](respondWithResult(_0xfe5928,null))[_0xaf2c('0xe')](handleError(_0xfe5928,null));};exports[_0xaf2c('0x4a')]=function(_0xb3ad9,_0x45918b){return respondWithRpcPromise(_0xaf2c('0x4b'),_0xb3ad9[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0xb3ad9[_0xaf2c('0x1e')]['id']))[_0xaf2c('0x9')](respondWithResult(_0x45918b,null))['catch'](handleError(_0x45918b,null));};exports[_0xaf2c('0x4c')]=function(_0x400dcd,_0x262937){return respondWithRpcPromise(_0xaf2c('0x4d'),_0x400dcd[_0xaf2c('0x19')],mailClient)['then'](respondWithResult(_0x262937,null))[_0xaf2c('0xe')](handleError(_0x262937,null));};exports[_0xaf2c('0x4e')]=function(_0x506000,_0x33aa67){return respondWithRpcPromise(_0xaf2c('0x4f'),_0x506000['query'],routingClient)['then'](respondWithResult(_0x33aa67,null))[_0xaf2c('0xe')](handleError(_0x33aa67,null));};exports[_0xaf2c('0x50')]=function(_0xc83d19,_0x39c5d2){return respondWithRpcPromise('OpenchannelQueues',_0xc83d19[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0xc83d19['params']['id']))[_0xaf2c('0x9')](respondWithResult(_0x39c5d2,null))['catch'](handleError(_0x39c5d2,null));};exports[_0xaf2c('0x51')]=function(_0xe6a251,_0x16e9f4){return respondWithRpcPromise(_0xaf2c('0x52'),_0xe6a251[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x16e9f4,null))[_0xaf2c('0xe')](handleError(_0x16e9f4,null));};exports[_0xaf2c('0x53')]=function(_0x1520ec,_0xc27601){return respondWithRpcPromise('SmsQueues',_0x1520ec[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0x1520ec[_0xaf2c('0x1e')]['id']))[_0xaf2c('0x9')](respondWithResult(_0xc27601,null))[_0xaf2c('0xe')](handleError(_0xc27601,null));};exports['whatsappQueues']=function(_0xbfb776,_0x28b09f){return respondWithRpcPromise(_0xaf2c('0x54'),_0xbfb776[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x28b09f,null))['catch'](handleError(_0x28b09f,null));};exports['showWhatsappQueues']=function(_0x1166c9,_0x1ead61){return respondWithRpcPromise('WhatsappQueues',_0x1166c9[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0x1166c9[_0xaf2c('0x1e')]['id']))['then'](respondWithResult(_0x1ead61,null))[_0xaf2c('0xe')](handleError(_0x1ead61,null));};exports[_0xaf2c('0x55')]=function(_0x18dcde,_0x2aae3a){return respondWithRpcPromise('FaxQueues',_0x18dcde[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x2aae3a,null))[_0xaf2c('0xe')](handleError(_0x2aae3a,null));};exports[_0xaf2c('0x56')]=function(_0x20c120,_0x1ecf97){return respondWithRpcPromise(_0xaf2c('0x57'),_0x20c120[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](findById(_0x20c120[_0xaf2c('0x1e')]['id']))[_0xaf2c('0x9')](respondWithResult(_0x1ecf97,null))['catch'](handleError(_0x1ecf97,null));};exports[_0xaf2c('0x58')]=function(_0x5d965c,_0x1a0795){return respondWithRpcPromise(_0xaf2c('0x59'),_0x5d965c['query'])[_0xaf2c('0x9')](respondWithResult(_0x1a0795,null))['catch'](handleError(_0x1a0795,null));};exports['chatQueuesWaitingInteractions']=function(_0x316333,_0x1d73ef){return respondWithRpcPromise(_0xaf2c('0x5a'),_0x316333['query'],routingClient)['then'](respondWithResult(_0x1d73ef,null))['catch'](handleError(_0x1d73ef,null));};exports[_0xaf2c('0x5b')]=function(_0x3e972c,_0x517f8d){return respondWithRpcPromise(_0xaf2c('0x5c'),_0x3e972c[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x517f8d,null))[_0xaf2c('0xe')](handleError(_0x517f8d,null));};exports[_0xaf2c('0x5d')]=function(_0x44303c,_0x4be47b){return respondWithRpcPromise(_0xaf2c('0x5e'),_0x44303c[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x4be47b,null))['catch'](handleError(_0x4be47b,null));};exports[_0xaf2c('0x5f')]=function(_0x3c53ff,_0x37ee02){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x3c53ff[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](function(_0x433f9e){if(_0x3c53ff[_0xaf2c('0x19')]['type']!==undefined){var _0x286a40=_(_0x433f9e[_0xaf2c('0x17')])[_0xaf2c('0x60')]([_0x3c53ff['query']['type'],_0x3c53ff[_0xaf2c('0x1e')]['id']])[_0xaf2c('0x61')]('queue_id')[_0xaf2c('0x62')]()[_0xaf2c('0x63')]();return _0x433f9e['rows'][_0xaf2c('0x60')](function(_0x31cf3e){return _0x286a40[_0xaf2c('0x64')](_0x31cf3e[_0xaf2c('0x65')])>-0x1;});}else{return _0x433f9e[_0xaf2c('0x17')]['filter'](function(_0x5831c9){return _0x5831c9[_0xaf2c('0x65')]===parseInt(_0x3c53ff[_0xaf2c('0x1e')]['id']);});}})[_0xaf2c('0x9')](respondWithResult(_0x37ee02,null))['catch'](handleError(_0x37ee02,null));};exports[_0xaf2c('0x66')]=function(_0x467a36,_0x3d8471){return respondWithRpcPromise(_0xaf2c('0x67'),_0x467a36[_0xaf2c('0x19')],routingClient)['then'](respondWithResult(_0x3d8471,null))[_0xaf2c('0xe')](handleError(_0x3d8471,null));};exports[_0xaf2c('0x68')]=function(_0x154f69,_0x1ef61f){return respondWithRpcPromise(_0xaf2c('0x69'),_0x154f69[_0xaf2c('0x19')],routingClient)['then'](respondWithResult(_0x1ef61f,null))[_0xaf2c('0xe')](handleError(_0x1ef61f,null));};exports[_0xaf2c('0x6a')]=function(_0x483774,_0x5beb89){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x483774[_0xaf2c('0x19')],routingClient)[_0xaf2c('0x9')](respondWithResult(_0x5beb89,null))[_0xaf2c('0xe')](handleError(_0x5beb89,null));};exports[_0xaf2c('0x6b')]=function(_0x499bbe){return function(_0x19fbd5,_0x2d7ca5){var _0x2b57d2,_0x430567;var _0x4ddf95=_[_0xaf2c('0x6c')](_0x499bbe);var _0x23aeac=_0x499bbe===_0xaf2c('0x6d')?_0xaf2c('0x6e'):_0xaf2c('0x6f');return db[_0x4ddf95+'Queue'][_0xaf2c('0x70')]({'raw':!![],'where':{'id':_0x19fbd5[_0xaf2c('0x1e')]['id']}})['then'](function(_0x516193){if(_[_0xaf2c('0x15')](_0x516193)){throw new Error(_0x4ddf95+_0xaf2c('0x71'));}_0x2b57d2=_0x516193;return db[_0x4ddf95+'Message'][_0xaf2c('0x70')]({'where':{'id':_0x19fbd5[_0xaf2c('0x32')][_0xaf2c('0x72')]},'include':[{'model':db[_0x4ddf95+_0xaf2c('0x73')],'as':_0xaf2c('0x73')},{'model':db[_0x4ddf95+_0x23aeac],'as':_0xaf2c('0x6f')}]});})[_0xaf2c('0x9')](function(_0x43c174){if(_['isNil'](_0x43c174)){throw new Error(_0x4ddf95+_0xaf2c('0x74'));}_0x430567=_0x43c174;return _0x43c174['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xaf2c('0x9')](function(){var _0x7724cc={'uniqueid':_0x499bbe+'.'+_0x430567['id']+'.'+_0x430567['Interaction']['id'],'FromUserId':_0x19fbd5['user']['id'],'type':_0xaf2c('0x75')};_0x7724cc[_0x4ddf95+_0xaf2c('0x76')]=_0x430567['id'];_0x7724cc[_0x4ddf95+_0xaf2c('0x77')]=_0x430567['Interaction']['id'];_0x7724cc[_0xaf2c('0x78')+_0x4ddf95+_0x23aeac+'Id']=_0x430567[_0xaf2c('0x6f')]['id'];_0x7724cc['To'+_0x4ddf95+_0xaf2c('0x79')]=_0x2b57d2['id'];return db[_0x4ddf95+'TransferReport']['create'](_0x7724cc);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x499bbe,'interaction':_0x430567[_0xaf2c('0x73')],'message':_0x430567,'account':_0x430567[_0xaf2c('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0xaf2c('0x75'),'appdata':_0x2b57d2[_0xaf2c('0x13')]+','+(_0x430567[_0xaf2c('0x6f')]['queueTransferTimeout']||0x12c),'interval':_0xaf2c('0x7a')}]},routingClient);})[_0xaf2c('0x9')](respondWithResult(_0x2d7ca5,null))['catch'](handleError(_0x2d7ca5,null));};};exports[_0xaf2c('0x7b')]=function(_0x4a3a61,_0x31f1d3){var _0x25d49c,_0x1e403a;if(_[_0xaf2c('0x15')](_0x4a3a61[_0xaf2c('0x32')][_0xaf2c('0x7c')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x47b971=_0x4a3a61[_0xaf2c('0x32')][_0xaf2c('0x7c')];var _0x1bc548=_[_0xaf2c('0x6c')](_0x47b971);var _0x118e78=_0x47b971===_0xaf2c('0x6d')?'Website':'Account';return db[_0xaf2c('0x7d')]['findOne']({'raw':!![],'where':{'id':_0x4a3a61[_0xaf2c('0x1e')]['id'],'role':'agent'}})[_0xaf2c('0x9')](function(_0x639b4b){if(_['isNil'](_0x639b4b)){throw new Error(_0xaf2c('0x7e'));}_0x25d49c=_0x639b4b;return db[_0x1bc548+_0xaf2c('0x7f')][_0xaf2c('0x70')]({'where':{'id':_0x4a3a61['body'][_0xaf2c('0x72')]},'include':[{'model':db[_0x1bc548+_0xaf2c('0x73')],'as':_0xaf2c('0x73')},{'model':db[_0x1bc548+_0x118e78],'as':_0xaf2c('0x6f')}]});})[_0xaf2c('0x9')](function(_0xb311e1){if(_['isNil'](_0xb311e1)){throw new Error(_0x1bc548+'\x20Message\x20not\x20found');}_0x1e403a=_0xb311e1;return _0xb311e1['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2db412={'uniqueid':_0x47b971+'.'+_0x1e403a['id']+'.'+_0x1e403a['Interaction']['id'],'FromUserId':_0x4a3a61[_0xaf2c('0x33')]['id'],'type':'queue','ToUserId':_0x25d49c['id']};_0x2db412[_0x1bc548+'MessageId']=_0x1e403a['id'];_0x2db412[_0x1bc548+_0xaf2c('0x77')]=_0x1e403a[_0xaf2c('0x73')]['id'];_0x2db412['From'+_0x1bc548+_0x118e78+'Id']=_0x1e403a[_0xaf2c('0x6f')]['id'];return db[_0x1bc548+_0xaf2c('0x80')][_0xaf2c('0x81')](_0x2db412);})[_0xaf2c('0x9')](function(){return respondWithRpcPromise(_0xaf2c('0x82'),{'channel':_0x47b971,'interaction':_0x1e403a[_0xaf2c('0x73')],'message':_0x1e403a,'account':_0x1e403a[_0xaf2c('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0xaf2c('0x3d'),'appdata':_0x25d49c[_0xaf2c('0x13')]+','+(_0x1e403a[_0xaf2c('0x6f')]['agentTransferTimeout']||0x12c),'interval':_0xaf2c('0x7a')}]},routingClient);})['then'](respondWithResult(_0x31f1d3,null))[_0xaf2c('0xe')](handleError(_0x31f1d3,null));}; \ No newline at end of file +var _0x5075=['api','client','http','then','error','message','result','status','json','name','send','isNil','rows','find','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','SIP/%s','interface','agent','internal','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','queue','InteractionId','From','QueueId','TransferReport','create','Start','agentNotify','Channel\x20field\x20is\x20mandatory','channel','chat','Agent\x20not\x20found','MessageId','agentTransferTimeout','*,*,*,*','bluebird','moment','lodash','util','../../mysqldb','../../config/logger'];(function(_0x4efb4a,_0x43bd7a){var _0x265085=function(_0x268a2a){while(--_0x268a2a){_0x4efb4a['push'](_0x4efb4a['shift']());}};_0x265085(++_0x43bd7a);}(_0x5075,0x73));var _0x5507=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0x5075[_0x5f519b];return _0x2461e2;};'use strict';var BPromise=require(_0x5507('0x0'));var moment=require(_0x5507('0x1'));var _=require(_0x5507('0x2'));var util=require(_0x5507('0x3'));var db=require(_0x5507('0x4'))['db'];var logger=require(_0x5507('0x5'))(_0x5507('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0x5507('0x7')][_0x5507('0x8')]({'port':0x232a});var mailClient=jayson[_0x5507('0x7')]['http']({'port':0x232b});var routingClient=jayson['client'][_0x5507('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x773559,_0x4c2d6d,_0x42c232){return new BPromise(function(_0x7cc84c,_0xbf4b50){var _0x504e05=_0x42c232?_0x42c232:amiClient;return _0x504e05['request'](_0x773559,_0x4c2d6d)[_0x5507('0x9')](function(_0x441bdc){if(_0x441bdc[_0x5507('0xa')]){if(_0x441bdc[_0x5507('0xa')]['code']===0x1f4){return _0xbf4b50(_0x441bdc[_0x5507('0xa')][_0x5507('0xb')]);}return _0x7cc84c(_0x441bdc['error'][_0x5507('0xb')]);}else{_0x7cc84c(_0x441bdc[_0x5507('0xc')]);}})['catch'](function(_0x37a1de){_0xbf4b50(_0x37a1de);});});}function respondWithResult(_0x2a2ea0,_0x32c872){_0x32c872=_0x32c872||0xc8;return function(_0x267f27){if(_0x267f27){return _0x2a2ea0[_0x5507('0xd')](_0x32c872)[_0x5507('0xe')](_0x267f27);}return _0x2a2ea0['sendStatus'](0x194);};}function handleError(_0x9cc3f9,_0x2b7c43){_0x2b7c43=_0x2b7c43||0x1f4;return function(_0xc828e5){logger[_0x5507('0xa')](_0xc828e5['stack']);if(_0xc828e5[_0x5507('0xf')]){delete _0xc828e5[_0x5507('0xf')];}_0x9cc3f9[_0x5507('0xd')](_0x2b7c43)[_0x5507('0x10')](_0xc828e5);};}function findById(_0xa6e4b3){return function(_0x2ede34){if(!_[_0x5507('0x11')](_0xa6e4b3)&&!_[_0x5507('0x11')](_0x2ede34)&&!_[_0x5507('0x11')](_0x2ede34[_0x5507('0x12')])){return _[_0x5507('0x13')](_0x2ede34[_0x5507('0x12')],function(_0x3822dd){return _0x3822dd['id']==_0xa6e4b3;});}return null;};}exports['voiceChannels']=function(_0x14dab0,_0x276a81){return respondWithRpcPromise(_0x5507('0x14'),_0x14dab0[_0x5507('0x15')])['then'](respondWithResult(_0x276a81,null))[_0x5507('0x16')](handleError(_0x276a81,null));};exports[_0x5507('0x17')]=function(_0x1a54b0,_0x3ca1f7){return respondWithRpcPromise(_0x5507('0x18'),_[_0x5507('0x19')](_0x1a54b0['query'],_0x1a54b0[_0x5507('0x1a')]))[_0x5507('0x9')](respondWithResult(_0x3ca1f7,null))[_0x5507('0x16')](handleError(_0x3ca1f7,null));};exports[_0x5507('0x1b')]=function(_0x141d22,_0x2de482){return respondWithRpcPromise(_0x5507('0x1c'),_[_0x5507('0x19')](_0x141d22[_0x5507('0x15')],_0x141d22[_0x5507('0x1a')]))[_0x5507('0x9')](respondWithResult(_0x2de482,null))[_0x5507('0x16')](handleError(_0x2de482,null));};exports[_0x5507('0x1d')]=function(_0x2ee6ed,_0x1a2203){return respondWithRpcPromise('VoiceQueues',_0x2ee6ed[_0x5507('0x15')])['then'](respondWithResult(_0x1a2203,null))[_0x5507('0x16')](handleError(_0x1a2203,null));};exports['showVoiceQueues']=function(_0xa66a01,_0x24668b){return respondWithRpcPromise('VoiceQueues',_0xa66a01['query'])[_0x5507('0x9')](findById(_0xa66a01[_0x5507('0x1a')]['id']))['then'](respondWithResult(_0x24668b,null))[_0x5507('0x16')](handleError(_0x24668b,null));};exports[_0x5507('0x1e')]=function(_0x85d383,_0x38f4d9){return respondWithRpcPromise(_0x5507('0x1f'),_[_0x5507('0x19')](_0x85d383['body'],_0x85d383[_0x5507('0x1a')]))[_0x5507('0x9')](respondWithResult(_0x38f4d9,null))[_0x5507('0x16')](handleError(_0x38f4d9,null));};exports[_0x5507('0x20')]=function(_0x29dd58,_0x495bbe){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x5507('0x19')](_0x29dd58[_0x5507('0x15')],_0x29dd58[_0x5507('0x1a')]))[_0x5507('0x9')](respondWithResult(_0x495bbe,null))['catch'](handleError(_0x495bbe,null));};exports[_0x5507('0x21')]=function(_0x13b6e5,_0xab91bc){return respondWithRpcPromise(_0x5507('0x22'),_0x13b6e5[_0x5507('0x15')])[_0x5507('0x9')](respondWithResult(_0xab91bc,null))[_0x5507('0x16')](handleError(_0xab91bc,null));};exports[_0x5507('0x23')]=function(_0x5ede36,_0xf61ba7){return respondWithRpcPromise(_0x5507('0x24'),_[_0x5507('0x19')](_0x5ede36['query'],_0x5ede36['params']))[_0x5507('0x9')](respondWithResult(_0xf61ba7,null))[_0x5507('0x16')](handleError(_0xf61ba7,null));};exports[_0x5507('0x25')]=function(_0x17d01c,_0x143d97){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x17d01c[_0x5507('0x15')],_0x17d01c[_0x5507('0x1a')]))[_0x5507('0x9')](respondWithResult(_0x143d97,null))[_0x5507('0x16')](handleError(_0x143d97,null));};exports['voiceQueuesChannelRedirect']=function(_0x54e4bd,_0x23ea7c){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x5507('0x19')](_0x54e4bd[_0x5507('0x15')],_0x54e4bd[_0x5507('0x1a')]))[_0x5507('0x9')](respondWithResult(_0x23ea7c,null))[_0x5507('0x16')](handleError(_0x23ea7c,null));};exports[_0x5507('0x26')]=function(_0x1c8506,_0x2b962d){return respondWithRpcPromise(_0x5507('0x27'),_0x1c8506[_0x5507('0x15')])['then'](respondWithResult(_0x2b962d,null))['catch'](handleError(_0x2b962d,null));};exports['outboundChannels']=function(_0x570eee,_0x526022){return respondWithRpcPromise(_0x5507('0x28'),_0x570eee[_0x5507('0x15')])[_0x5507('0x9')](respondWithResult(_0x526022,null))[_0x5507('0x16')](handleError(_0x526022,null));};exports[_0x5507('0x29')]=function(_0xbef058,_0x101de3){var _0xbc9f93;return respondWithRpcPromise(_0x5507('0x2a'),_0xbef058[_0x5507('0x15')])[_0x5507('0x9')](function(_0x2db0b2){_0xbc9f93=_0x2db0b2;return respondWithRpcPromise(_0x5507('0x2a'),_0xbef058['query'],routingClient);})['then'](function(_0x50eb32){return _[_0x5507('0x19')]({},_0x50eb32,_0xbc9f93);})[_0x5507('0x9')](respondWithResult(_0x101de3,null))[_0x5507('0x16')](handleError(_0x101de3,null));};exports[_0x5507('0x2b')]=function(_0xcd4df5,_0x17d7db){if(_0xcd4df5[_0x5507('0x2c')]&&_0xcd4df5[_0x5507('0x2c')][_0x5507('0x2d')]&&_0xcd4df5[_0x5507('0x2e')]&&_0xcd4df5[_0x5507('0x2e')][_0x5507('0xf')]){for(var _0x24d7b5 in _0xcd4df5[_0x5507('0x2c')][_0x5507('0x2d')]){if(_0xcd4df5[_0x5507('0x2c')][_0x5507('0x2d')][_0x5507('0x2f')](_0x24d7b5)){db[_0x5507('0x30')]['findAll']({'where':{'channel':_0x24d7b5,'membername':_0xcd4df5[_0x5507('0x2e')][_0x5507('0xf')],'type':'INTERACTION','exitAt':null,'uniqueid':_0xcd4df5['body'][_0x5507('0x2d')][_0x24d7b5]&&_0xcd4df5[_0x5507('0x2c')][_0x5507('0x2d')][_0x24d7b5][_0x5507('0x31')]?{'$notIn':_0xcd4df5[_0x5507('0x2c')]['interaction'][_0x24d7b5]}:{'$ne':null}}})[_0x5507('0x9')](function(_0x39ac17){var _0x1dfc9c=moment()['format'](_0x5507('0x32'));for(var _0x33022e=0x0,_0xadea4c=_0x39ac17[_0x5507('0x31')];_0x33022e<_0xadea4c;_0x33022e+=0x1){_0x39ac17[_0x33022e][_0x5507('0x33')]({'exitAt':_0x1dfc9c});}});for(var _0x48d72b=0x0;_0x48d72b<_0xcd4df5[_0x5507('0x2c')]['interaction'][_0x24d7b5][_0x5507('0x31')];_0x48d72b+=0x1){db[_0x5507('0x30')][_0x5507('0x34')]({'where':{'channel':_0x24d7b5,'membername':_0xcd4df5[_0x5507('0x2e')][_0x5507('0xf')],'type':_0x5507('0x35'),'uniqueid':_0xcd4df5[_0x5507('0x2c')][_0x5507('0x2d')][_0x24d7b5][_0x48d72b],'exitAt':null},'defaults':{'channel':_0x24d7b5,'membername':_0xcd4df5['user'][_0x5507('0xf')],'interface':_[_0x5507('0x11')](_0xcd4df5['user']['interface'])?util['format'](_0x5507('0x36'),_0xcd4df5['user'][_0x5507('0xf')]):_0xcd4df5['user'][_0x5507('0x37')],'type':'INTERACTION','enterAt':moment()['format'](_0x5507('0x32')),'role':_0x5507('0x38'),'internal':_0xcd4df5[_0x5507('0x2e')][_0x5507('0x39')],'uniqueid':_0xcd4df5[_0x5507('0x2c')][_0x5507('0x2d')][_0x24d7b5][_0x48d72b]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0xcd4df5[_0x5507('0x1a')]['id'],'capacity':_0xcd4df5[_0x5507('0x2c')][_0x5507('0x3a')]},routingClient)['then'](respondWithResult(_0x17d7db,null))[_0x5507('0x16')](handleError(_0x17d7db,null));};exports[_0x5507('0x3b')]=function(_0x505e71,_0x2e0cfc){return respondWithRpcPromise(_0x5507('0x3c'),_0x505e71[_0x5507('0x15')])[_0x5507('0x9')](respondWithResult(_0x2e0cfc,null))[_0x5507('0x16')](handleError(_0x2e0cfc,null));};exports[_0x5507('0x3d')]=function(_0x245456,_0x1bb575){return respondWithRpcPromise('Trunks',_0x245456['query'])[_0x5507('0x9')](respondWithResult(_0x1bb575,null))[_0x5507('0x16')](handleError(_0x1bb575,null));};exports[_0x5507('0x3e')]=function(_0x1b34c8,_0xce851d){return respondWithRpcPromise(_0x5507('0x3f'),_0x1b34c8[_0x5507('0x15')])[_0x5507('0x9')](respondWithResult(_0xce851d,null))[_0x5507('0x16')](handleError(_0xce851d,null));};exports[_0x5507('0x40')]=function(_0x40cda2,_0x13dc8b){return respondWithRpcPromise(_0x5507('0x41'),_0x40cda2[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x13dc8b,null))[_0x5507('0x16')](handleError(_0x13dc8b,null));};exports['showChatQueues']=function(_0x3f47af,_0x56e0cd){return respondWithRpcPromise('ChatQueues',_0x3f47af[_0x5507('0x15')],routingClient)[_0x5507('0x9')](findById(_0x3f47af[_0x5507('0x1a')]['id']))[_0x5507('0x9')](respondWithResult(_0x56e0cd,null))['catch'](handleError(_0x56e0cd,null));};exports[_0x5507('0x42')]=function(_0x2f41a9,_0x314d4e){return respondWithRpcPromise(_0x5507('0x43'),_0x2f41a9[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x314d4e,null))['catch'](handleError(_0x314d4e,null));};exports[_0x5507('0x44')]=function(_0x46e589,_0x3a2f9f){return respondWithRpcPromise('MailQueues',_0x46e589['query'],routingClient)[_0x5507('0x9')](findById(_0x46e589['params']['id']))[_0x5507('0x9')](respondWithResult(_0x3a2f9f,null))[_0x5507('0x16')](handleError(_0x3a2f9f,null));};exports['mailAccounts']=function(_0x3e796d,_0x1b622f){return respondWithRpcPromise(_0x5507('0x45'),_0x3e796d[_0x5507('0x15')],mailClient)[_0x5507('0x9')](respondWithResult(_0x1b622f,null))[_0x5507('0x16')](handleError(_0x1b622f,null));};exports[_0x5507('0x46')]=function(_0x2928f2,_0x737d39){return respondWithRpcPromise(_0x5507('0x47'),_0x2928f2[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x737d39,null))['catch'](handleError(_0x737d39,null));};exports[_0x5507('0x48')]=function(_0x2e904b,_0x219e34){return respondWithRpcPromise(_0x5507('0x47'),_0x2e904b[_0x5507('0x15')],routingClient)['then'](findById(_0x2e904b[_0x5507('0x1a')]['id']))['then'](respondWithResult(_0x219e34,null))[_0x5507('0x16')](handleError(_0x219e34,null));};exports[_0x5507('0x49')]=function(_0x241733,_0x54c009){return respondWithRpcPromise(_0x5507('0x4a'),_0x241733[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x54c009,null))['catch'](handleError(_0x54c009,null));};exports[_0x5507('0x4b')]=function(_0x5cfdb0,_0x3dca7d){return respondWithRpcPromise('SmsQueues',_0x5cfdb0['query'],routingClient)[_0x5507('0x9')](findById(_0x5cfdb0[_0x5507('0x1a')]['id']))[_0x5507('0x9')](respondWithResult(_0x3dca7d,null))[_0x5507('0x16')](handleError(_0x3dca7d,null));};exports[_0x5507('0x4c')]=function(_0x31cc0d,_0x4bf567){return respondWithRpcPromise('WhatsappQueues',_0x31cc0d[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x4bf567,null))[_0x5507('0x16')](handleError(_0x4bf567,null));};exports[_0x5507('0x4d')]=function(_0x5e3e73,_0x388faa){return respondWithRpcPromise(_0x5507('0x4e'),_0x5e3e73[_0x5507('0x15')],routingClient)[_0x5507('0x9')](findById(_0x5e3e73[_0x5507('0x1a')]['id']))[_0x5507('0x9')](respondWithResult(_0x388faa,null))[_0x5507('0x16')](handleError(_0x388faa,null));};exports['faxQueues']=function(_0x3802dd,_0xfdbbe5){return respondWithRpcPromise(_0x5507('0x4f'),_0x3802dd['query'],routingClient)[_0x5507('0x9')](respondWithResult(_0xfdbbe5,null))['catch'](handleError(_0xfdbbe5,null));};exports['showFaxQueues']=function(_0x55c257,_0x1fef49){return respondWithRpcPromise(_0x5507('0x4f'),_0x55c257[_0x5507('0x15')],routingClient)[_0x5507('0x9')](findById(_0x55c257[_0x5507('0x1a')]['id']))[_0x5507('0x9')](respondWithResult(_0x1fef49,null))[_0x5507('0x16')](handleError(_0x1fef49,null));};exports['faxAccounts']=function(_0x1812d7,_0x48ed80){return respondWithRpcPromise(_0x5507('0x50'),_0x1812d7[_0x5507('0x15')])[_0x5507('0x9')](respondWithResult(_0x48ed80,null))[_0x5507('0x16')](handleError(_0x48ed80,null));};exports[_0x5507('0x51')]=function(_0x120108,_0x4423a8){return respondWithRpcPromise(_0x5507('0x52'),_0x120108[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x4423a8,null))[_0x5507('0x16')](handleError(_0x4423a8,null));};exports['mailQueuesWaitingInteractions']=function(_0x94b11c,_0xbb0a62){return respondWithRpcPromise(_0x5507('0x53'),_0x94b11c['query'],routingClient)[_0x5507('0x9')](respondWithResult(_0xbb0a62,null))[_0x5507('0x16')](handleError(_0xbb0a62,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x26e777,_0x5815fb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x26e777[_0x5507('0x15')],routingClient)['then'](respondWithResult(_0x5815fb,null))[_0x5507('0x16')](handleError(_0x5815fb,null));};exports[_0x5507('0x54')]=function(_0xfb59be,_0xda51d5){return respondWithRpcPromise(_0x5507('0x55'),_0xfb59be[_0x5507('0x15')],routingClient)['then'](function(_0x43fccf){if(_0xfb59be[_0x5507('0x15')][_0x5507('0x56')]!==undefined){var _0x75aa3c=_(_0x43fccf[_0x5507('0x12')])[_0x5507('0x57')]([_0xfb59be[_0x5507('0x15')][_0x5507('0x56')],_0xfb59be[_0x5507('0x1a')]['id']])[_0x5507('0x58')](_0x5507('0x59'))[_0x5507('0x5a')]()['value']();return _0x43fccf[_0x5507('0x12')][_0x5507('0x57')](function(_0x10f066){return _0x75aa3c[_0x5507('0x5b')](_0x10f066[_0x5507('0x59')])>-0x1;});}else{return _0x43fccf[_0x5507('0x12')]['filter'](function(_0x1dad83){return _0x1dad83['queue_id']===parseInt(_0xfb59be[_0x5507('0x1a')]['id']);});}})['then'](respondWithResult(_0xda51d5,null))['catch'](handleError(_0xda51d5,null));};exports[_0x5507('0x5c')]=function(_0x20274e,_0x2979b1){return respondWithRpcPromise(_0x5507('0x5d'),_0x20274e[_0x5507('0x15')],routingClient)['then'](respondWithResult(_0x2979b1,null))[_0x5507('0x16')](handleError(_0x2979b1,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x410c16,_0x471142){return respondWithRpcPromise(_0x5507('0x5e'),_0x410c16[_0x5507('0x15')],routingClient)['then'](respondWithResult(_0x471142,null))[_0x5507('0x16')](handleError(_0x471142,null));};exports[_0x5507('0x5f')]=function(_0x42bef4,_0x5a8a1b){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x42bef4[_0x5507('0x15')],routingClient)[_0x5507('0x9')](respondWithResult(_0x5a8a1b,null))[_0x5507('0x16')](handleError(_0x5a8a1b,null));};exports[_0x5507('0x60')]=function(_0x77a772){return function(_0x26f796,_0x3d7e21){var _0x10b62e,_0x18bed6;var _0x27265e=_[_0x5507('0x61')](_0x77a772);var _0x160e54=_0x77a772==='chat'?_0x5507('0x62'):_0x5507('0x63');return db[_0x27265e+_0x5507('0x64')][_0x5507('0x65')]({'raw':!![],'where':{'id':_0x26f796[_0x5507('0x1a')]['id']}})[_0x5507('0x9')](function(_0x33717e){if(_['isNil'](_0x33717e)){throw new Error(_0x27265e+_0x5507('0x66'));}_0x10b62e=_0x33717e;return db[_0x27265e+_0x5507('0x67')][_0x5507('0x65')]({'where':{'id':_0x26f796[_0x5507('0x2c')]['messageId']},'include':[{'model':db[_0x27265e+_0x5507('0x68')],'as':_0x5507('0x68')},{'model':db[_0x27265e+_0x160e54],'as':_0x5507('0x63')}]});})[_0x5507('0x9')](function(_0x1a5d2e){if(_[_0x5507('0x11')](_0x1a5d2e)){throw new Error(_0x27265e+_0x5507('0x69'));}_0x18bed6=_0x1a5d2e;return _0x1a5d2e['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x5507('0x9')](function(){var _0x38144b={'uniqueid':_0x77a772+'.'+_0x18bed6['id']+'.'+_0x18bed6[_0x5507('0x68')]['id'],'FromUserId':_0x26f796[_0x5507('0x2e')]['id'],'type':_0x5507('0x6a')};_0x38144b[_0x27265e+'MessageId']=_0x18bed6['id'];_0x38144b[_0x27265e+_0x5507('0x6b')]=_0x18bed6[_0x5507('0x68')]['id'];_0x38144b[_0x5507('0x6c')+_0x27265e+_0x160e54+'Id']=_0x18bed6[_0x5507('0x63')]['id'];_0x38144b['To'+_0x27265e+_0x5507('0x6d')]=_0x10b62e['id'];return db[_0x27265e+_0x5507('0x6e')][_0x5507('0x6f')](_0x38144b);})[_0x5507('0x9')](function(){return respondWithRpcPromise(_0x5507('0x70'),{'channel':_0x77a772,'interaction':_0x18bed6[_0x5507('0x68')],'message':_0x18bed6,'account':_0x18bed6[_0x5507('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x5507('0x6a'),'appdata':_0x10b62e[_0x5507('0xf')]+','+(_0x18bed6['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x5507('0x9')](respondWithResult(_0x3d7e21,null))[_0x5507('0x16')](handleError(_0x3d7e21,null));};};exports[_0x5507('0x71')]=function(_0x3b04a7,_0x1e913a){var _0x4e1578,_0x2339c7;if(_[_0x5507('0x11')](_0x3b04a7[_0x5507('0x2c')]['channel'])){throw new Error(_0x5507('0x72'));}var _0x5808d9=_0x3b04a7['body'][_0x5507('0x73')];var _0x58b56c=_[_0x5507('0x61')](_0x5808d9);var _0x5c6043=_0x5808d9===_0x5507('0x74')?_0x5507('0x62'):_0x5507('0x63');return db['User']['findOne']({'raw':!![],'where':{'id':_0x3b04a7[_0x5507('0x1a')]['id'],'role':_0x5507('0x38')}})[_0x5507('0x9')](function(_0x51bec0){if(_[_0x5507('0x11')](_0x51bec0)){throw new Error(_0x5507('0x75'));}_0x4e1578=_0x51bec0;return db[_0x58b56c+_0x5507('0x67')][_0x5507('0x65')]({'where':{'id':_0x3b04a7['body']['messageId']},'include':[{'model':db[_0x58b56c+_0x5507('0x68')],'as':_0x5507('0x68')},{'model':db[_0x58b56c+_0x5c6043],'as':'Account'}]});})[_0x5507('0x9')](function(_0x13c0f5){if(_[_0x5507('0x11')](_0x13c0f5)){throw new Error(_0x58b56c+_0x5507('0x69'));}_0x2339c7=_0x13c0f5;return _0x13c0f5['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x5507('0x9')](function(){var _0x3a2b0f={'uniqueid':_0x5808d9+'.'+_0x2339c7['id']+'.'+_0x2339c7['Interaction']['id'],'FromUserId':_0x3b04a7[_0x5507('0x2e')]['id'],'type':_0x5507('0x6a'),'ToUserId':_0x4e1578['id']};_0x3a2b0f[_0x58b56c+_0x5507('0x76')]=_0x2339c7['id'];_0x3a2b0f[_0x58b56c+'InteractionId']=_0x2339c7[_0x5507('0x68')]['id'];_0x3a2b0f[_0x5507('0x6c')+_0x58b56c+_0x5c6043+'Id']=_0x2339c7['Account']['id'];return db[_0x58b56c+_0x5507('0x6e')][_0x5507('0x6f')](_0x3a2b0f);})['then'](function(){return respondWithRpcPromise(_0x5507('0x70'),{'channel':_0x5808d9,'interaction':_0x2339c7[_0x5507('0x68')],'message':_0x2339c7,'account':_0x2339c7[_0x5507('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x4e1578[_0x5507('0xf')]+','+(_0x2339c7[_0x5507('0x63')][_0x5507('0x77')]||0x12c),'interval':_0x5507('0x78')}]},routingClient);})[_0x5507('0x9')](respondWithResult(_0x1e913a,null))[_0x5507('0x16')](handleError(_0x1e913a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index b463337..f5609a4 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 _0x300b=['post','create','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','./schedule.controller','get','isAuthenticated','/:id','show','/:id/run','run'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x300b,0x149));var _0xb300=function(_0x15fb8e,_0x510e48){_0x15fb8e=_0x15fb8e-0x0;var _0x56d327=_0x300b[_0x15fb8e];return _0x56d327;};'use strict';var multer=require(_0xb300('0x0'));var util=require('util');var path=require(_0xb300('0x1'));var timeout=require('connect-timeout');var express=require(_0xb300('0x2'));var router=express[_0xb300('0x3')]();var fs_extra=require(_0xb300('0x4'));var auth=require(_0xb300('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb300('0x6'));router[_0xb300('0x7')]('/',auth[_0xb300('0x8')](),controller['index']);router[_0xb300('0x7')](_0xb300('0x9'),auth[_0xb300('0x8')](),controller[_0xb300('0xa')]);router[_0xb300('0x7')](_0xb300('0xb'),auth[_0xb300('0x8')](),controller[_0xb300('0xc')]);router[_0xb300('0xd')]('/',auth[_0xb300('0x8')](),controller[_0xb300('0xe')]);router[_0xb300('0xf')](_0xb300('0x9'),auth[_0xb300('0x8')](),controller[_0xb300('0x10')]);router[_0xb300('0x11')](_0xb300('0x9'),auth[_0xb300('0x8')](),controller[_0xb300('0x12')]);module['exports']=router; \ No newline at end of file +var _0x86ef=['../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run','run','post','create','put','update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x22bbb6,_0x1d1b47){var _0x16d557=function(_0x390923){while(--_0x390923){_0x22bbb6['push'](_0x22bbb6['shift']());}};_0x16d557(++_0x1d1b47);}(_0x86ef,0x188));var _0xf86e=function(_0x30062a,_0x3ac0be){_0x30062a=_0x30062a-0x0;var _0xcea95e=_0x86ef[_0x30062a];return _0xcea95e;};'use strict';var multer=require('multer');var util=require(_0xf86e('0x0'));var path=require(_0xf86e('0x1'));var timeout=require('connect-timeout');var express=require(_0xf86e('0x2'));var router=express[_0xf86e('0x3')]();var fs_extra=require(_0xf86e('0x4'));var auth=require(_0xf86e('0x5'));var interaction=require(_0xf86e('0x6'));var config=require(_0xf86e('0x7'));var controller=require(_0xf86e('0x8'));router[_0xf86e('0x9')]('/',auth[_0xf86e('0xa')](),controller[_0xf86e('0xb')]);router[_0xf86e('0x9')](_0xf86e('0xc'),auth[_0xf86e('0xa')](),controller['show']);router[_0xf86e('0x9')](_0xf86e('0xd'),auth['isAuthenticated'](),controller[_0xf86e('0xe')]);router[_0xf86e('0xf')]('/',auth[_0xf86e('0xa')](),controller[_0xf86e('0x10')]);router[_0xf86e('0x11')](_0xf86e('0xc'),auth[_0xf86e('0xa')](),controller[_0xf86e('0x12')]);router[_0xf86e('0x13')](_0xf86e('0xc'),auth[_0xf86e('0xa')](),controller[_0xf86e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 8e95c07..c5c21f1 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 _0xc9a6=['pdf','xlsx','custom','default','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','months','weeks','days','hours','minutes','ENUM','csv'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc9a6,0xb9));var _0x6c9a=function(_0x4c3edf,_0x2ce2fe){_0x4c3edf=_0x4c3edf-0x0;var _0x214e71=_0xc9a6[_0x4c3edf];return _0x214e71;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6c9a('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x6c9a('0x0')]},'active':{'type':Sequelize[_0x6c9a('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x6c9a('0x0')],'allowNull':![],'defaultValue':_0x6c9a('0x2')},'startAt':{'type':Sequelize[_0x6c9a('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x6c9a('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x6c9a('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x6c9a('0x5'),'quarters',_0x6c9a('0x6'),_0x6c9a('0x7'),_0x6c9a('0x8'),_0x6c9a('0x9'),_0x6c9a('0xa')),'allowNull':![],'defaultValue':_0x6c9a('0x8')},'output':{'type':Sequelize[_0x6c9a('0xb')](_0x6c9a('0xc'),_0x6c9a('0xd'),_0x6c9a('0xe')),'allowNull':![],'defaultValue':_0x6c9a('0xc')},'type':{'type':Sequelize[_0x6c9a('0xb')](_0x6c9a('0xf'),_0x6c9a('0x10')),'allowNull':![],'defaultValue':_0x6c9a('0xf')},'sendMail':{'type':Sequelize[_0x6c9a('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x6c9a('0x0')]},'cc':{'type':Sequelize[_0x6c9a('0x11')]},'bcc':{'type':Sequelize[_0x6c9a('0x11')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xd929=['csv','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING','DATE','INTEGER','ENUM','years','quarters','weeks','days','minutes','xlsx'];(function(_0x301dab,_0x38050a){var _0x2500a2=function(_0x4d3dff){while(--_0x4d3dff){_0x301dab['push'](_0x301dab['shift']());}};_0x2500a2(++_0x38050a);}(_0xd929,0x16a));var _0x9d92=function(_0x62f5b9,_0x4c4178){_0x62f5b9=_0x62f5b9-0x0;var _0x581fbd=_0xd929[_0x62f5b9];return _0x581fbd;};'use strict';var Sequelize=require(_0x9d92('0x0'));module[_0x9d92('0x1')]={'name':{'type':Sequelize[_0x9d92('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9d92('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x9d92('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x9d92('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x9d92('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x9d92('0x5')](_0x9d92('0x6'),_0x9d92('0x7'),'months',_0x9d92('0x8'),_0x9d92('0x9'),'hours',_0x9d92('0xa')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x9d92('0x5')]('csv','pdf',_0x9d92('0xb')),'allowNull':![],'defaultValue':_0x9d92('0xc')},'type':{'type':Sequelize[_0x9d92('0x5')](_0x9d92('0xd'),_0x9d92('0xe')),'allowNull':![],'defaultValue':_0x9d92('0xd')},'sendMail':{'type':Sequelize[_0x9d92('0xf')],'defaultValue':![]},'email':{'type':Sequelize[_0x9d92('0x2')]},'cc':{'type':Sequelize[_0x9d92('0x10')]},'bcc':{'type':Sequelize[_0x9d92('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index c55bb0e..04dc4a4 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 _0x294f=['util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','stack','name','send','index','Schedule','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','count','include','findAll','catch','params','intersection','includeAll','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x1a809b,_0x4c15e3){var _0x5d90e6=function(_0x5dd2e1){while(--_0x5dd2e1){_0x1a809b['push'](_0x1a809b['shift']());}};_0x5d90e6(++_0x4c15e3);}(_0x294f,0xfa));var _0xf294=function(_0x4f96a3,_0xe68556){_0x4f96a3=_0x4f96a3-0x0;var _0x44529e=_0x294f[_0x4f96a3];return _0x44529e;};'use strict';var emlformat=require(_0xf294('0x0'));var rimraf=require(_0xf294('0x1'));var zipdir=require(_0xf294('0x2'));var jsonpatch=require(_0xf294('0x3'));var rp=require(_0xf294('0x4'));var moment=require(_0xf294('0x5'));var BPromise=require(_0xf294('0x6'));var Mustache=require(_0xf294('0x7'));var util=require(_0xf294('0x8'));var path=require(_0xf294('0x9'));var sox=require(_0xf294('0xa'));var csv=require(_0xf294('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf294('0xc'));var squel=require(_0xf294('0xd'));var crypto=require(_0xf294('0xe'));var jsforce=require(_0xf294('0xf'));var deskjs=require(_0xf294('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf294('0x11'));var Papa=require(_0xf294('0x12'));var Redis=require('ioredis');var authService=require(_0xf294('0x13'));var qs=require(_0xf294('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf294('0x15'))('api');var utils=require(_0xf294('0x16'));var config=require(_0xf294('0x17'));var licenseUtil=require(_0xf294('0x18'));var db=require(_0xf294('0x19'))['db'];function respondWithStatusCode(_0x21dc06,_0x2e70da){_0x2e70da=_0x2e70da||0xcc;return function(_0x155933){if(_0x155933){return _0x21dc06['sendStatus'](_0x2e70da);}return _0x21dc06[_0xf294('0x1a')](_0x2e70da)['end']();};}function respondWithResult(_0x145e73,_0x2bade3){_0x2bade3=_0x2bade3||0xc8;return function(_0x2d08ce){if(_0x2d08ce){return _0x145e73[_0xf294('0x1a')](_0x2bade3)[_0xf294('0x1b')](_0x2d08ce);}};}function respondWithFilteredResult(_0x18d50b,_0x574bf3){return function(_0x12efc4){if(_0x12efc4){var _0x31669d=typeof _0x574bf3[_0xf294('0x1c')]===_0xf294('0x1d')&&typeof _0x574bf3[_0xf294('0x1e')]===_0xf294('0x1d');var _0xa4d1bf=_0x12efc4['count'];var _0x29a9a8=_0x31669d?0x0:_0x574bf3[_0xf294('0x1c')];var _0x18f97c=_0x31669d?_0x12efc4['count']:_0x574bf3[_0xf294('0x1c')]+_0x574bf3[_0xf294('0x1e')];var _0x5677fe;if(_0x18f97c>=_0xa4d1bf){_0x18f97c=_0xa4d1bf;_0x5677fe=0xc8;}else{_0x5677fe=0xce;}_0x18d50b[_0xf294('0x1a')](_0x5677fe);return _0x18d50b[_0xf294('0x1f')]('Content-Range',_0x29a9a8+'-'+_0x18f97c+'/'+_0xa4d1bf)[_0xf294('0x1b')](_0x12efc4);}return null;};}function patchUpdates(_0x49b7c9){return function(_0x122236){try{jsonpatch[_0xf294('0x20')](_0x122236,_0x49b7c9,!![]);}catch(_0x381785){return BPromise[_0xf294('0x21')](_0x381785);}return _0x122236[_0xf294('0x22')]();};}function saveUpdates(_0x31403f,_0x46b1ad){return function(_0x14e099){if(_0x14e099){return _0x14e099[_0xf294('0x23')](_0x31403f)[_0xf294('0x24')](function(_0x14a410){return _0x14a410;});}return null;};}function removeEntity(_0x58afa1,_0x3a4f8d){return function(_0x485f95){if(_0x485f95){return _0x485f95[_0xf294('0x25')]()[_0xf294('0x24')](function(){var _0x110807=_0x485f95[_0xf294('0x26')]({'plain':!![]});var _0x523215=_0xf294('0x27');return db[_0xf294('0x28')][_0xf294('0x25')]({'where':{'type':_0x523215,'resourceId':_0x110807['id']}})[_0xf294('0x24')](function(){return _0x485f95;});})[_0xf294('0x24')](function(){_0x58afa1[_0xf294('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x116498,_0x14a4be){return function(_0xc42cae){if(!_0xc42cae){_0x116498[_0xf294('0x29')](0x194);}return _0xc42cae;};}function handleError(_0x9bc432,_0x8a5597){_0x8a5597=_0x8a5597||0x1f4;return function(_0x21f29b){logger[_0xf294('0x2a')](_0x21f29b[_0xf294('0x2b')]);if(_0x21f29b['name']){delete _0x21f29b[_0xf294('0x2c')];}_0x9bc432[_0xf294('0x1a')](_0x8a5597)[_0xf294('0x2d')](_0x21f29b);};}exports[_0xf294('0x2e')]=function(_0x31fde,_0x5df5c2){var _0x6c65b2={},_0x3071dd={},_0x735e47={'count':0x0,'rows':[]};var _0x50d79d=_['map'](db[_0xf294('0x2f')][_0xf294('0x30')],function(_0x1ae7f2){return{'name':_0x1ae7f2[_0xf294('0x31')],'type':_0x1ae7f2[_0xf294('0x32')][_0xf294('0x33')]};});_0x3071dd[_0xf294('0x34')]=_[_0xf294('0x35')](_0x50d79d,'name');_0x3071dd['query']=_[_0xf294('0x36')](_0x31fde[_0xf294('0x37')]);_0x3071dd[_0xf294('0x38')]=_['intersection'](_0x3071dd[_0xf294('0x34')],_0x3071dd[_0xf294('0x37')]);_0x6c65b2[_0xf294('0x39')]=_['intersection'](_0x3071dd[_0xf294('0x34')],qs[_0xf294('0x3a')](_0x31fde[_0xf294('0x37')]['fields']));_0x6c65b2['attributes']=_0x6c65b2['attributes'][_0xf294('0x3b')]?_0x6c65b2[_0xf294('0x39')]:_0x3071dd[_0xf294('0x34')];if(!_0x31fde[_0xf294('0x37')]['hasOwnProperty'](_0xf294('0x3c'))){_0x6c65b2[_0xf294('0x1e')]=qs[_0xf294('0x1e')](_0x31fde[_0xf294('0x37')][_0xf294('0x1e')]);_0x6c65b2[_0xf294('0x1c')]=qs[_0xf294('0x1c')](_0x31fde[_0xf294('0x37')]['offset']);}_0x6c65b2[_0xf294('0x3d')]=qs[_0xf294('0x3e')](_0x31fde[_0xf294('0x37')][_0xf294('0x3e')]);_0x6c65b2[_0xf294('0x3f')]=qs[_0xf294('0x38')](_['pick'](_0x31fde[_0xf294('0x37')],_0x3071dd[_0xf294('0x38')]),_0x50d79d);if(_0x31fde[_0xf294('0x37')][_0xf294('0x40')]){_0x6c65b2[_0xf294('0x3f')]=_['merge'](_0x6c65b2['where'],{'$or':_[_0xf294('0x35')](_0x50d79d,function(_0x42fc4c){if(_0x42fc4c[_0xf294('0x32')]!==_0xf294('0x41')){var _0x45a611={};_0x45a611[_0x42fc4c[_0xf294('0x2c')]]={'$like':'%'+_0x31fde['query'][_0xf294('0x40')]+'%'};return _0x45a611;}})});}_0x6c65b2=_['merge']({},_0x6c65b2,_0x31fde['options']);var _0x27e903={'where':_0x6c65b2[_0xf294('0x3f')]};return db[_0xf294('0x2f')]['count'](_0x27e903)['then'](function(_0x445c19){_0x735e47[_0xf294('0x42')]=_0x445c19;if(_0x31fde['query']['includeAll']){_0x6c65b2[_0xf294('0x43')]=[{'all':!![]}];}return db[_0xf294('0x2f')][_0xf294('0x44')](_0x6c65b2);})[_0xf294('0x24')](function(_0x4e8563){_0x735e47['rows']=_0x4e8563;return _0x735e47;})['then'](respondWithFilteredResult(_0x5df5c2,_0x6c65b2))[_0xf294('0x45')](handleError(_0x5df5c2,null));};exports['show']=function(_0x3751be,_0x406e49){var _0x167ec6={'raw':![],'where':{'id':_0x3751be[_0xf294('0x46')]['id']}},_0x382e83={};_0x382e83[_0xf294('0x34')]=_[_0xf294('0x36')](db[_0xf294('0x2f')][_0xf294('0x30')]);_0x382e83[_0xf294('0x37')]=_[_0xf294('0x36')](_0x3751be[_0xf294('0x37')]);_0x382e83[_0xf294('0x38')]=_[_0xf294('0x47')](_0x382e83[_0xf294('0x34')],_0x382e83[_0xf294('0x37')]);_0x167ec6[_0xf294('0x39')]=_[_0xf294('0x47')](_0x382e83[_0xf294('0x34')],qs[_0xf294('0x3a')](_0x3751be[_0xf294('0x37')][_0xf294('0x3a')]));_0x167ec6[_0xf294('0x39')]=_0x167ec6[_0xf294('0x39')][_0xf294('0x3b')]?_0x167ec6[_0xf294('0x39')]:_0x382e83[_0xf294('0x34')];if(_0x3751be[_0xf294('0x37')][_0xf294('0x48')]){_0x167ec6[_0xf294('0x43')]=[{'all':!![]}];}_0x167ec6=_[_0xf294('0x49')]({},_0x167ec6,_0x3751be['options']);return db['Schedule'][_0xf294('0x4a')](_0x167ec6)[_0xf294('0x24')](handleEntityNotFound(_0x406e49,null))[_0xf294('0x24')](respondWithResult(_0x406e49,null))[_0xf294('0x45')](handleError(_0x406e49,null));};exports[_0xf294('0x4b')]=function(_0x112da,_0x5b438a){return db[_0xf294('0x2f')][_0xf294('0x4b')](_0x112da['body'],{})[_0xf294('0x24')](function(_0x397ed9){var _0x4cc73d=_0x112da[_0xf294('0x4c')][_0xf294('0x26')]({'plain':!![]});if(!_0x4cc73d)throw new Error(_0xf294('0x4d'));if(_0x4cc73d[_0xf294('0x4e')]==='user'){var _0x5099e8=_0x397ed9[_0xf294('0x26')]({'plain':!![]});var _0x22a4bc=_0xf294('0x27');return db[_0xf294('0x4f')][_0xf294('0x4a')]({'where':{'name':_0x22a4bc,'userProfileId':_0x4cc73d[_0xf294('0x50')]},'raw':!![]})[_0xf294('0x24')](function(_0x4d4578){if(_0x4d4578&&_0x4d4578[_0xf294('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x5099e8[_0xf294('0x2c')],'resourceId':_0x5099e8['id'],'type':_0x4d4578[_0xf294('0x2c')],'sectionId':_0x4d4578['id']},{})['then'](function(){return _0x397ed9;});}else{return _0x397ed9;}})[_0xf294('0x45')](function(_0x118719){logger['error'](_0xf294('0x52'),_0x118719);throw _0x118719;});}return _0x397ed9;})['then'](respondWithResult(_0x5b438a,0xc9))['catch'](handleError(_0x5b438a,null));};exports['update']=function(_0x8ba848,_0x16dbb1){if(_0x8ba848[_0xf294('0x53')]['id']){delete _0x8ba848[_0xf294('0x53')]['id'];}return db[_0xf294('0x2f')]['find']({'where':{'id':_0x8ba848['params']['id']}})[_0xf294('0x24')](handleEntityNotFound(_0x16dbb1,null))[_0xf294('0x24')](saveUpdates(_0x8ba848[_0xf294('0x53')],null))['then'](respondWithResult(_0x16dbb1,null))[_0xf294('0x45')](handleError(_0x16dbb1,null));};exports[_0xf294('0x25')]=function(_0x1f7fce,_0x21a6b4){return db[_0xf294('0x2f')][_0xf294('0x4a')]({'where':{'id':_0x1f7fce[_0xf294('0x46')]['id']}})['then'](handleEntityNotFound(_0x21a6b4,null))[_0xf294('0x24')](removeEntity(_0x21a6b4,null))[_0xf294('0x45')](handleError(_0x21a6b4,null));};exports['run']=function(_0x10ded0,_0x598345,_0x39d01e){var _0x35b393=require(_0xf294('0x54'));return db[_0xf294('0x2f')][_0xf294('0x4a')]({'where':{'id':_0x10ded0['params']['id']},'raw':!![]})[_0xf294('0x24')](handleEntityNotFound(_0x598345,null))[_0xf294('0x24')](function(){_0x35b393[_0xf294('0x55')](_0x10ded0['params']['id']);})[_0xf294('0x24')](respondWithStatusCode(_0x598345,null))[_0xf294('0x45')](handleError(_0x598345,null));}; \ No newline at end of file +var _0x2b57=['VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','rimraf','fast-json-patch','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','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','Content-Range','save','update','destroy','then','Scheduler','error','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','merge'];(function(_0x2d66fd,_0x3c9415){var _0x322f24=function(_0x3aa4cc){while(--_0x3aa4cc){_0x2d66fd['push'](_0x2d66fd['shift']());}};_0x322f24(++_0x3c9415);}(_0x2b57,0x178));var _0x72b5=function(_0x587e0e,_0x3337a3){_0x587e0e=_0x587e0e-0x0;var _0x394ed4=_0x2b57[_0x587e0e];return _0x394ed4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x72b5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x72b5('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x72b5('0x2'));var Mustache=require(_0x72b5('0x3'));var util=require(_0x72b5('0x4'));var path=require(_0x72b5('0x5'));var sox=require(_0x72b5('0x6'));var csv=require(_0x72b5('0x7'));var ejs=require(_0x72b5('0x8'));var fs=require('fs');var fs_extra=require(_0x72b5('0x9'));var _=require(_0x72b5('0xa'));var squel=require(_0x72b5('0xb'));var crypto=require(_0x72b5('0xc'));var jsforce=require(_0x72b5('0xd'));var deskjs=require(_0x72b5('0xe'));var toCsv=require(_0x72b5('0x7'));var querystring=require(_0x72b5('0xf'));var Papa=require(_0x72b5('0x10'));var Redis=require(_0x72b5('0x11'));var authService=require(_0x72b5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x72b5('0x13'));var hardwareService=require(_0x72b5('0x14'));var logger=require(_0x72b5('0x15'))(_0x72b5('0x16'));var utils=require(_0x72b5('0x17'));var config=require(_0x72b5('0x18'));var licenseUtil=require(_0x72b5('0x19'));var db=require(_0x72b5('0x1a'))['db'];function respondWithStatusCode(_0x15e02e,_0x48e1d7){_0x48e1d7=_0x48e1d7||0xcc;return function(_0x3f31d7){if(_0x3f31d7){return _0x15e02e[_0x72b5('0x1b')](_0x48e1d7);}return _0x15e02e[_0x72b5('0x1c')](_0x48e1d7)['end']();};}function respondWithResult(_0x40d815,_0x585f49){_0x585f49=_0x585f49||0xc8;return function(_0x58d8b6){if(_0x58d8b6){return _0x40d815[_0x72b5('0x1c')](_0x585f49)[_0x72b5('0x1d')](_0x58d8b6);}};}function respondWithFilteredResult(_0x1063de,_0x5d393e){return function(_0x4d0152){if(_0x4d0152){var _0x53c9ef=typeof _0x5d393e['offset']===_0x72b5('0x1e')&&typeof _0x5d393e['limit']===_0x72b5('0x1e');var _0xd130fe=_0x4d0152[_0x72b5('0x1f')];var _0x51e9d1=_0x53c9ef?0x0:_0x5d393e[_0x72b5('0x20')];var _0x2c9813=_0x53c9ef?_0x4d0152[_0x72b5('0x1f')]:_0x5d393e[_0x72b5('0x20')]+_0x5d393e['limit'];var _0x3288c3;if(_0x2c9813>=_0xd130fe){_0x2c9813=_0xd130fe;_0x3288c3=0xc8;}else{_0x3288c3=0xce;}_0x1063de[_0x72b5('0x1c')](_0x3288c3);return _0x1063de['set'](_0x72b5('0x21'),_0x51e9d1+'-'+_0x2c9813+'/'+_0xd130fe)[_0x72b5('0x1d')](_0x4d0152);}return null;};}function patchUpdates(_0x5228bd){return function(_0x1a1208){try{jsonpatch['apply'](_0x1a1208,_0x5228bd,!![]);}catch(_0x6f0519){return BPromise['reject'](_0x6f0519);}return _0x1a1208[_0x72b5('0x22')]();};}function saveUpdates(_0x2c79ff,_0x2249fb){return function(_0x49912c){if(_0x49912c){return _0x49912c[_0x72b5('0x23')](_0x2c79ff)['then'](function(_0x25a802){return _0x25a802;});}return null;};}function removeEntity(_0xcb6847,_0x373b80){return function(_0x4a6c37){if(_0x4a6c37){return _0x4a6c37[_0x72b5('0x24')]()[_0x72b5('0x25')](function(){var _0x5c2729=_0x4a6c37['get']({'plain':!![]});var _0x79448d=_0x72b5('0x26');return db['UserProfileResource'][_0x72b5('0x24')]({'where':{'type':_0x79448d,'resourceId':_0x5c2729['id']}})[_0x72b5('0x25')](function(){return _0x4a6c37;});})[_0x72b5('0x25')](function(){_0xcb6847['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x173b15,_0x25248f){return function(_0x423e8b){if(!_0x423e8b){_0x173b15[_0x72b5('0x1b')](0x194);}return _0x423e8b;};}function handleError(_0x266f2f,_0x5332df){_0x5332df=_0x5332df||0x1f4;return function(_0x1fb3d4){logger[_0x72b5('0x27')](_0x1fb3d4['stack']);if(_0x1fb3d4[_0x72b5('0x28')]){delete _0x1fb3d4[_0x72b5('0x28')];}_0x266f2f[_0x72b5('0x1c')](_0x5332df)[_0x72b5('0x29')](_0x1fb3d4);};}exports[_0x72b5('0x2a')]=function(_0x3014e4,_0x2c9b77){var _0x50d7bb={},_0x4fd5b2={},_0x1ad447={'count':0x0,'rows':[]};var _0x486f11=_[_0x72b5('0x2b')](db[_0x72b5('0x2c')][_0x72b5('0x2d')],function(_0x28dc88){return{'name':_0x28dc88[_0x72b5('0x2e')],'type':_0x28dc88[_0x72b5('0x2f')][_0x72b5('0x30')]};});_0x4fd5b2[_0x72b5('0x31')]=_['map'](_0x486f11,_0x72b5('0x28'));_0x4fd5b2[_0x72b5('0x32')]=_[_0x72b5('0x33')](_0x3014e4['query']);_0x4fd5b2[_0x72b5('0x34')]=_[_0x72b5('0x35')](_0x4fd5b2[_0x72b5('0x31')],_0x4fd5b2[_0x72b5('0x32')]);_0x50d7bb['attributes']=_['intersection'](_0x4fd5b2[_0x72b5('0x31')],qs[_0x72b5('0x36')](_0x3014e4[_0x72b5('0x32')][_0x72b5('0x36')]));_0x50d7bb[_0x72b5('0x37')]=_0x50d7bb[_0x72b5('0x37')][_0x72b5('0x38')]?_0x50d7bb[_0x72b5('0x37')]:_0x4fd5b2[_0x72b5('0x31')];if(!_0x3014e4[_0x72b5('0x32')]['hasOwnProperty'](_0x72b5('0x39'))){_0x50d7bb[_0x72b5('0x3a')]=qs[_0x72b5('0x3a')](_0x3014e4[_0x72b5('0x32')][_0x72b5('0x3a')]);_0x50d7bb[_0x72b5('0x20')]=qs[_0x72b5('0x20')](_0x3014e4[_0x72b5('0x32')][_0x72b5('0x20')]);}_0x50d7bb[_0x72b5('0x3b')]=qs[_0x72b5('0x3c')](_0x3014e4[_0x72b5('0x32')]['sort']);_0x50d7bb[_0x72b5('0x3d')]=qs[_0x72b5('0x34')](_[_0x72b5('0x3e')](_0x3014e4['query'],_0x4fd5b2[_0x72b5('0x34')]),_0x486f11);if(_0x3014e4[_0x72b5('0x32')]['filter']){_0x50d7bb[_0x72b5('0x3d')]=_[_0x72b5('0x3f')](_0x50d7bb[_0x72b5('0x3d')],{'$or':_[_0x72b5('0x2b')](_0x486f11,function(_0x40ded3){if(_0x40ded3[_0x72b5('0x2f')]!==_0x72b5('0x40')){var _0x3e25c6={};_0x3e25c6[_0x40ded3['name']]={'$like':'%'+_0x3014e4[_0x72b5('0x32')][_0x72b5('0x41')]+'%'};return _0x3e25c6;}})});}_0x50d7bb=_['merge']({},_0x50d7bb,_0x3014e4[_0x72b5('0x42')]);var _0x55a02f={'where':_0x50d7bb[_0x72b5('0x3d')]};return db[_0x72b5('0x2c')][_0x72b5('0x1f')](_0x55a02f)[_0x72b5('0x25')](function(_0x52ff37){_0x1ad447['count']=_0x52ff37;if(_0x3014e4[_0x72b5('0x32')][_0x72b5('0x43')]){_0x50d7bb[_0x72b5('0x44')]=[{'all':!![]}];}return db[_0x72b5('0x2c')][_0x72b5('0x45')](_0x50d7bb);})['then'](function(_0x4624be){_0x1ad447[_0x72b5('0x46')]=_0x4624be;return _0x1ad447;})[_0x72b5('0x25')](respondWithFilteredResult(_0x2c9b77,_0x50d7bb))['catch'](handleError(_0x2c9b77,null));};exports[_0x72b5('0x47')]=function(_0x42ebd4,_0xce9b12){var _0x4864d8={'raw':![],'where':{'id':_0x42ebd4[_0x72b5('0x48')]['id']}},_0x44ddb2={};_0x44ddb2[_0x72b5('0x31')]=_['keys'](db[_0x72b5('0x2c')][_0x72b5('0x2d')]);_0x44ddb2['query']=_[_0x72b5('0x33')](_0x42ebd4['query']);_0x44ddb2[_0x72b5('0x34')]=_[_0x72b5('0x35')](_0x44ddb2[_0x72b5('0x31')],_0x44ddb2['query']);_0x4864d8['attributes']=_[_0x72b5('0x35')](_0x44ddb2[_0x72b5('0x31')],qs[_0x72b5('0x36')](_0x42ebd4['query'][_0x72b5('0x36')]));_0x4864d8[_0x72b5('0x37')]=_0x4864d8[_0x72b5('0x37')][_0x72b5('0x38')]?_0x4864d8['attributes']:_0x44ddb2[_0x72b5('0x31')];if(_0x42ebd4[_0x72b5('0x32')][_0x72b5('0x43')]){_0x4864d8[_0x72b5('0x44')]=[{'all':!![]}];}_0x4864d8=_[_0x72b5('0x3f')]({},_0x4864d8,_0x42ebd4['options']);return db[_0x72b5('0x2c')]['find'](_0x4864d8)['then'](handleEntityNotFound(_0xce9b12,null))['then'](respondWithResult(_0xce9b12,null))[_0x72b5('0x49')](handleError(_0xce9b12,null));};exports[_0x72b5('0x4a')]=function(_0x940d64,_0x37770f){return db[_0x72b5('0x2c')][_0x72b5('0x4a')](_0x940d64[_0x72b5('0x4b')],{})[_0x72b5('0x25')](function(_0x1dda01){var _0x457370=_0x940d64[_0x72b5('0x4c')]['get']({'plain':!![]});if(!_0x457370)throw new Error(_0x72b5('0x4d'));if(_0x457370[_0x72b5('0x4e')]===_0x72b5('0x4c')){var _0x2f36f4=_0x1dda01[_0x72b5('0x4f')]({'plain':!![]});var _0x54f35c='Scheduler';return db[_0x72b5('0x50')][_0x72b5('0x51')]({'where':{'name':_0x54f35c,'userProfileId':_0x457370[_0x72b5('0x52')]},'raw':!![]})[_0x72b5('0x25')](function(_0x5efa51){if(_0x5efa51&&_0x5efa51[_0x72b5('0x53')]===0x0){return db[_0x72b5('0x54')][_0x72b5('0x4a')]({'name':_0x2f36f4[_0x72b5('0x28')],'resourceId':_0x2f36f4['id'],'type':_0x5efa51[_0x72b5('0x28')],'sectionId':_0x5efa51['id']},{})[_0x72b5('0x25')](function(){return _0x1dda01;});}else{return _0x1dda01;}})[_0x72b5('0x49')](function(_0x44afe2){logger[_0x72b5('0x27')](_0x72b5('0x55'),_0x44afe2);throw _0x44afe2;});}return _0x1dda01;})[_0x72b5('0x25')](respondWithResult(_0x37770f,0xc9))[_0x72b5('0x49')](handleError(_0x37770f,null));};exports['update']=function(_0x2fab8c,_0x54e086){if(_0x2fab8c[_0x72b5('0x4b')]['id']){delete _0x2fab8c[_0x72b5('0x4b')]['id'];}return db['Schedule'][_0x72b5('0x51')]({'where':{'id':_0x2fab8c[_0x72b5('0x48')]['id']}})[_0x72b5('0x25')](handleEntityNotFound(_0x54e086,null))['then'](saveUpdates(_0x2fab8c[_0x72b5('0x4b')],null))[_0x72b5('0x25')](respondWithResult(_0x54e086,null))[_0x72b5('0x49')](handleError(_0x54e086,null));};exports[_0x72b5('0x24')]=function(_0x294e94,_0x36285e){return db['Schedule'][_0x72b5('0x51')]({'where':{'id':_0x294e94['params']['id']}})[_0x72b5('0x25')](handleEntityNotFound(_0x36285e,null))[_0x72b5('0x25')](removeEntity(_0x36285e,null))[_0x72b5('0x49')](handleError(_0x36285e,null));};exports[_0x72b5('0x56')]=function(_0x26cecd,_0x47a304,_0x278568){var _0x32ea55=require(_0x72b5('0x57'));return db[_0x72b5('0x2c')]['find']({'where':{'id':_0x26cecd[_0x72b5('0x48')]['id']},'raw':!![]})[_0x72b5('0x25')](handleEntityNotFound(_0x47a304,null))[_0x72b5('0x25')](function(){_0x32ea55[_0x72b5('0x56')](_0x26cecd[_0x72b5('0x48')]['id']);})[_0x72b5('0x25')](respondWithStatusCode(_0x47a304,null))[_0x72b5('0x49')](handleError(_0x47a304,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 0d3e057..d05a805 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 _0xa21e=['path','rimraf','../../config/environment','exports','define','Schedule','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x4aa9ed,_0x93e3a2){var _0x14c0a5=function(_0x22a359){while(--_0x22a359){_0x4aa9ed['push'](_0x4aa9ed['shift']());}};_0x14c0a5(++_0x93e3a2);}(_0xa21e,0x156));var _0xea21=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0xa21e[_0x1b6c6d];return _0x290d9d;};'use strict';var _=require(_0xea21('0x0'));var util=require(_0xea21('0x1'));var logger=require(_0xea21('0x2'))(_0xea21('0x3'));var moment=require(_0xea21('0x4'));var BPromise=require('bluebird');var rp=require(_0xea21('0x5'));var fs=require('fs');var path=require(_0xea21('0x6'));var rimraf=require(_0xea21('0x7'));var config=require(_0xea21('0x8'));var attributes=require('./schedule.attributes');module[_0xea21('0x9')]=function(_0x4dc433,_0x3191ea){return _0x4dc433[_0xea21('0xa')](_0xea21('0xb'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90ce=['path','rimraf','../../config/environment','exports','Schedule','tools_schedules','lodash','../../config/logger','api','moment','request-promise'];(function(_0x2a568f,_0x55c70d){var _0x4a341b=function(_0x346ef4){while(--_0x346ef4){_0x2a568f['push'](_0x2a568f['shift']());}};_0x4a341b(++_0x55c70d);}(_0x90ce,0x74));var _0xe90c=function(_0x393d69,_0x3a8c83){_0x393d69=_0x393d69-0x0;var _0x3cee37=_0x90ce[_0x393d69];return _0x3cee37;};'use strict';var _=require(_0xe90c('0x0'));var util=require('util');var logger=require(_0xe90c('0x1'))(_0xe90c('0x2'));var moment=require(_0xe90c('0x3'));var BPromise=require('bluebird');var rp=require(_0xe90c('0x4'));var fs=require('fs');var path=require(_0xe90c('0x5'));var rimraf=require(_0xe90c('0x6'));var config=require(_0xe90c('0x7'));var attributes=require('./schedule.attributes');module[_0xe90c('0x8')]=function(_0x511c4d,_0x502774){return _0x511c4d['define'](_0xe90c('0x9'),attributes,{'tableName':_0xe90c('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 31be1e4..f5f2cda 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 _0x334a=['code','message','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x6c16a4,_0x3f6dca){var _0x547541=function(_0x56d3cf){while(--_0x56d3cf){_0x6c16a4['push'](_0x6c16a4['shift']());}};_0x547541(++_0x3f6dca);}(_0x334a,0xde));var _0xa334=function(_0x9e518f,_0x790a44){_0x9e518f=_0x9e518f-0x0;var _0x2fc150=_0x334a[_0x9e518f];return _0x2fc150;};'use strict';var _=require(_0xa334('0x0'));var util=require(_0xa334('0x1'));var moment=require('moment');var BPromise=require(_0xa334('0x2'));var rs=require(_0xa334('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa334('0x4'))['db'];var utils=require(_0xa334('0x5'));var logger=require(_0xa334('0x6'))(_0xa334('0x7'));var config=require(_0xa334('0x8'));var jayson=require(_0xa334('0x9'));var client=jayson[_0xa334('0xa')][_0xa334('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1112ec,_0x4bffc3,_0x664ca5){return new BPromise(function(_0x3fce41,_0x2082f5){return client[_0xa334('0xc')](_0x1112ec,_0x664ca5)[_0xa334('0xd')](function(_0x59f84d){logger[_0xa334('0xe')](_0xa334('0xf'),_0x4bffc3,'request\x20sent');logger['debug'](_0xa334('0x10'),_0x4bffc3,_0xa334('0x11'),JSON[_0xa334('0x12')](_0x59f84d));if(_0x59f84d[_0xa334('0x13')]){if(_0x59f84d[_0xa334('0x13')][_0xa334('0x14')]===0x1f4){logger[_0xa334('0x13')]('Schedule,\x20%s,\x20%s',_0x4bffc3,_0x59f84d['error']['message']);return _0x2082f5(_0x59f84d[_0xa334('0x13')][_0xa334('0x15')]);}logger['error'](_0xa334('0xf'),_0x4bffc3,_0x59f84d[_0xa334('0x13')][_0xa334('0x15')]);return _0x3fce41(_0x59f84d[_0xa334('0x13')]['message']);}else{logger[_0xa334('0xe')]('Schedule,\x20%s,\x20%s',_0x4bffc3,_0xa334('0x11'));_0x3fce41(_0x59f84d['result'][_0xa334('0x15')]);}})['catch'](function(_0x799c1){logger[_0xa334('0x13')](_0xa334('0xf'),_0x4bffc3,_0x799c1);_0x2082f5(_0x799c1);});});} \ No newline at end of file +var _0x6ef6=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x29065b,_0x197461){var _0x4e1752=function(_0x54da2c){while(--_0x54da2c){_0x29065b['push'](_0x29065b['shift']());}};_0x4e1752(++_0x197461);}(_0x6ef6,0xf2));var _0x66ef=function(_0x339b2f,_0xf4081c){_0x339b2f=_0x339b2f-0x0;var _0x203fa2=_0x6ef6[_0x339b2f];return _0x203fa2;};'use strict';var _=require(_0x66ef('0x0'));var util=require(_0x66ef('0x1'));var moment=require(_0x66ef('0x2'));var BPromise=require('bluebird');var rs=require(_0x66ef('0x3'));var fs=require('fs');var Redis=require(_0x66ef('0x4'));var db=require(_0x66ef('0x5'))['db'];var utils=require(_0x66ef('0x6'));var logger=require(_0x66ef('0x7'))(_0x66ef('0x8'));var config=require(_0x66ef('0x9'));var jayson=require(_0x66ef('0xa'));var client=jayson['client'][_0x66ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d930d,_0x4e3aaa,_0x44f6c7){return new BPromise(function(_0xbbe394,_0x4b1600){return client['request'](_0x1d930d,_0x44f6c7)[_0x66ef('0xc')](function(_0x2d49d9){logger[_0x66ef('0xd')](_0x66ef('0xe'),_0x4e3aaa,_0x66ef('0xf'));logger[_0x66ef('0x10')](_0x66ef('0x11'),_0x4e3aaa,_0x66ef('0xf'),JSON[_0x66ef('0x12')](_0x2d49d9));if(_0x2d49d9['error']){if(_0x2d49d9[_0x66ef('0x13')][_0x66ef('0x14')]===0x1f4){logger[_0x66ef('0x13')](_0x66ef('0xe'),_0x4e3aaa,_0x2d49d9[_0x66ef('0x13')][_0x66ef('0x15')]);return _0x4b1600(_0x2d49d9[_0x66ef('0x13')][_0x66ef('0x15')]);}logger[_0x66ef('0x13')](_0x66ef('0xe'),_0x4e3aaa,_0x2d49d9['error'][_0x66ef('0x15')]);return _0xbbe394(_0x2d49d9[_0x66ef('0x13')][_0x66ef('0x15')]);}else{logger['info'](_0x66ef('0xe'),_0x4e3aaa,_0x66ef('0xf'));_0xbbe394(_0x2d49d9['result'][_0x66ef('0x15')]);}})['catch'](function(_0xf889c5){logger[_0x66ef('0x13')](_0x66ef('0xe'),_0x4e3aaa,_0xf889c5);_0x4b1600(_0xf889c5);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 220c461..fa8c885 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 _0x2a25=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','index','describe','/:id','show','download','post','create','put','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a25,0x79));var _0x52a2=function(_0x5a0c94,_0x1b06fe){_0x5a0c94=_0x5a0c94-0x0;var _0x1832e0=_0x2a25[_0x5a0c94];return _0x1832e0;};'use strict';var multer=require(_0x52a2('0x0'));var util=require(_0x52a2('0x1'));var path=require('path');var timeout=require(_0x52a2('0x2'));var express=require(_0x52a2('0x3'));var router=express['Router']();var fs_extra=require(_0x52a2('0x4'));var auth=require(_0x52a2('0x5'));var interaction=require(_0x52a2('0x6'));var config=require('../../config/environment');var controller=require(_0x52a2('0x7'));router[_0x52a2('0x8')]('/',auth[_0x52a2('0x9')](),controller[_0x52a2('0xa')]);router['get']('/describe',auth[_0x52a2('0x9')](),controller[_0x52a2('0xb')]);router[_0x52a2('0x8')](_0x52a2('0xc'),auth[_0x52a2('0x9')](),controller[_0x52a2('0xd')]);router[_0x52a2('0x8')]('/:id/download',auth[_0x52a2('0x9')](),controller[_0x52a2('0xe')]);router[_0x52a2('0xf')]('/',auth['isAuthenticated'](),controller[_0x52a2('0x10')]);router[_0x52a2('0x11')](_0x52a2('0xc'),auth[_0x52a2('0x9')](),controller['update']);router['delete'](_0x52a2('0xc'),auth[_0x52a2('0x9')](),controller[_0x52a2('0x12')]);module[_0x52a2('0x13')]=router; \ No newline at end of file +var _0x6688=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','update','delete','destroy','multer','util','connect-timeout'];(function(_0x4ee5d3,_0x432589){var _0x3a0562=function(_0x442e4a){while(--_0x442e4a){_0x4ee5d3['push'](_0x4ee5d3['shift']());}};_0x3a0562(++_0x432589);}(_0x6688,0xfa));var _0x8668=function(_0x5629b7,_0xc15702){_0x5629b7=_0x5629b7-0x0;var _0xb27bdd=_0x6688[_0x5629b7];return _0xb27bdd;};'use strict';var multer=require(_0x8668('0x0'));var util=require(_0x8668('0x1'));var path=require('path');var timeout=require(_0x8668('0x2'));var express=require(_0x8668('0x3'));var router=express[_0x8668('0x4')]();var fs_extra=require(_0x8668('0x5'));var auth=require(_0x8668('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8668('0x7'));var controller=require(_0x8668('0x8'));router[_0x8668('0x9')]('/',auth[_0x8668('0xa')](),controller[_0x8668('0xb')]);router[_0x8668('0x9')](_0x8668('0xc'),auth[_0x8668('0xa')](),controller[_0x8668('0xd')]);router[_0x8668('0x9')](_0x8668('0xe'),auth[_0x8668('0xa')](),controller[_0x8668('0xf')]);router[_0x8668('0x9')](_0x8668('0x10'),auth[_0x8668('0xa')](),controller[_0x8668('0x11')]);router[_0x8668('0x12')]('/',auth[_0x8668('0xa')](),controller[_0x8668('0x13')]);router['put'](_0x8668('0xe'),auth[_0x8668('0xa')](),controller[_0x8668('0x14')]);router[_0x8668('0x15')](_0x8668('0xe'),auth[_0x8668('0xa')](),controller[_0x8668('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 6e1b1cd..2ae4685 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 _0x8ff9=['closedAt','duration','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','format','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8ff9,0x1a6));var _0x98ff=function(_0x4818f0,_0x35d99e){_0x4818f0=_0x4818f0-0x0;var _0x5f9ba4=_0x8ff9[_0x4818f0];return _0x5f9ba4;};'use strict';var Sequelize=require(_0x98ff('0x0'));var moment=require(_0x98ff('0x1'));var path=require(_0x98ff('0x2'));var config=require(_0x98ff('0x3'));module[_0x98ff('0x4')]={'format':{'type':Sequelize[_0x98ff('0x5')],'get':function(){return this[_0x98ff('0x6')](_0x98ff('0x7'))?path[_0x98ff('0x8')](this[_0x98ff('0x6')](_0x98ff('0x7'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x98ff('0x9')]},'value':{'type':Sequelize[_0x98ff('0x9')],'set':function(_0x13537e){var _0x21d840=_0x13537e[_0x98ff('0xa')](/\\/g,'/');this[_0x98ff('0xb')]('value',_0x21d840);}},'rating':{'type':Sequelize[_0x98ff('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x4bbf37){this[_0x98ff('0xb')](_0x98ff('0xd'),moment()[_0x98ff('0xe')](_0x4bbf37,'ms'));this[_0x98ff('0xb')](_0x98ff('0xf'),moment());this['setDataValue'](_0x98ff('0x10'),_0x4bbf37);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x98ff('0x6')]('startedAt'))['format'](_0x98ff('0x11'))[_0x98ff('0x12')]();}},'closedAt':{'type':Sequelize[_0x98ff('0x13')],'get':function(){return moment(this['getDataValue'](_0x98ff('0xf')))['format'](_0x98ff('0x11'))[_0x98ff('0x12')]();}},'createdAt':{'type':Sequelize[_0x98ff('0x13')],'get':function(){return moment(this[_0x98ff('0x6')](_0x98ff('0x14')))[_0x98ff('0x15')]('MM-DD-YYYY\x20HH:mm')[_0x98ff('0x12')]();}},'updatedAt':{'type':Sequelize[_0x98ff('0x13')],'get':function(){return moment(this[_0x98ff('0x6')](_0x98ff('0x16')))[_0x98ff('0x15')](_0x98ff('0x11'))[_0x98ff('0x12')]();}}}; \ No newline at end of file +var _0x9b09=['startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','createdAt','toString','sequelize','moment','../../config/environment','exports','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER'];(function(_0x32f9e6,_0x55ed80){var _0x11a5ea=function(_0x1862ab){while(--_0x1862ab){_0x32f9e6['push'](_0x32f9e6['shift']());}};_0x11a5ea(++_0x55ed80);}(_0x9b09,0x1ad));var _0x99b0=function(_0x3c8f26,_0x453699){_0x3c8f26=_0x3c8f26-0x0;var _0x5a4dd7=_0x9b09[_0x3c8f26];return _0x5a4dd7;};'use strict';var Sequelize=require(_0x99b0('0x0'));var moment=require(_0x99b0('0x1'));var path=require('path');var config=require(_0x99b0('0x2'));module[_0x99b0('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x99b0('0x4')]('value')?path[_0x99b0('0x5')](this['getDataValue'](_0x99b0('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x99b0('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x99b0('0x7')],'set':function(_0x220c95){var _0x5cfd09=_0x220c95[_0x99b0('0x8')](/\\/g,'/');this[_0x99b0('0x9')](_0x99b0('0x6'),_0x5cfd09);}},'rating':{'type':Sequelize[_0x99b0('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x99b0('0xa')],'set':function(_0x4affe4){this[_0x99b0('0x9')](_0x99b0('0xb'),moment()[_0x99b0('0xc')](_0x4affe4,'ms'));this[_0x99b0('0x9')](_0x99b0('0xd'),moment());this['setDataValue'](_0x99b0('0xe'),_0x4affe4);}},'startedAt':{'type':Sequelize[_0x99b0('0xf')],'get':function(){return moment(this[_0x99b0('0x4')](_0x99b0('0xb')))[_0x99b0('0x10')](_0x99b0('0x11'))['toString']();}},'closedAt':{'type':Sequelize[_0x99b0('0xf')],'get':function(){return moment(this['getDataValue'](_0x99b0('0xd')))[_0x99b0('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0x99b0('0xf')],'get':function(){return moment(this[_0x99b0('0x4')](_0x99b0('0x12')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0x99b0('0xf')],'get':function(){return moment(this[_0x99b0('0x4')]('updatedAt'))[_0x99b0('0x10')](_0x99b0('0x11'))[_0x99b0('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index a53486c..ee1e23f 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 _0xd6d6=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','catch','find','create','body','duration','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x531586,_0x19f51a){var _0x3e6748=function(_0x287912){while(--_0x287912){_0x531586['push'](_0x531586['shift']());}};_0x3e6748(++_0x19f51a);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x28c6cc,_0x44487c){_0x28c6cc=_0x28c6cc-0x0;var _0x2c3014=_0xd6d6[_0x28c6cc];return _0x2c3014;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0xf0df7f,_0x12fab2){return function(_0x554f8e){if(!_0x554f8e){_0xf0df7f[_0x6d6d('0x19')](0x194);}return _0x554f8e;};}function handleError(_0x2b5e31,_0x235451){_0x235451=_0x235451||0x1f4;return function(_0x126ac8){logger[_0x6d6d('0x29')](_0x126ac8[_0x6d6d('0x2a')]);if(_0x126ac8[_0x6d6d('0x2b')]){delete _0x126ac8['name'];}_0x2b5e31[_0x6d6d('0x1a')](_0x235451)[_0x6d6d('0x2c')](_0x126ac8);};}exports['index']=function(_0x553645,_0x3edcce){var _0x5273cd={},_0x8a9a84={},_0x57341f={'count':0x0,'rows':[]};var _0xde3272=_[_0x6d6d('0x2d')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')],function(_0x64d1f7){return{'name':_0x64d1f7[_0x6d6d('0x30')],'type':_0x64d1f7[_0x6d6d('0x31')][_0x6d6d('0x32')]};});_0x8a9a84[_0x6d6d('0x33')]=_[_0x6d6d('0x34')](_['map'](_0xde3272,_0x6d6d('0x2b')),['format']);_0x8a9a84[_0x6d6d('0x35')]=_[_0x6d6d('0x36')](_0x553645[_0x6d6d('0x35')]);_0x8a9a84[_0x6d6d('0x37')]=_['intersection'](_0x8a9a84[_0x6d6d('0x33')],_0x8a9a84['query']);_0x5273cd[_0x6d6d('0x38')]=_[_0x6d6d('0x39')](_0x8a9a84['model'],qs[_0x6d6d('0x3a')](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3a')]));_0x5273cd[_0x6d6d('0x38')]=_0x5273cd[_0x6d6d('0x38')][_0x6d6d('0x3b')]?_0x5273cd[_0x6d6d('0x38')]:_0x8a9a84[_0x6d6d('0x33')];if(!_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3c')](_0x6d6d('0x3d'))){_0x5273cd[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x553645[_0x6d6d('0x35')]['limit']);_0x5273cd[_0x6d6d('0x1f')]=qs[_0x6d6d('0x1f')](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x1f')]);}_0x5273cd['order']=qs['sort'](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3e')]);_0x5273cd[_0x6d6d('0x3f')]=qs['filters'](_[_0x6d6d('0x40')](_0x553645[_0x6d6d('0x35')],_0x8a9a84[_0x6d6d('0x37')]),_0xde3272);if(_0x553645[_0x6d6d('0x35')]['filter']){_0x5273cd['where']=_['merge'](_0x5273cd[_0x6d6d('0x3f')],{'$or':_[_0x6d6d('0x2d')](_0xde3272,function(_0x33c8f2){if(_0x33c8f2[_0x6d6d('0x31')]!=='VIRTUAL'){var _0x253416={};_0x253416[_0x33c8f2[_0x6d6d('0x2b')]]={'$like':'%'+_0x553645[_0x6d6d('0x35')][_0x6d6d('0x41')]+'%'};return _0x253416;}})});}_0x5273cd=_[_0x6d6d('0x42')]({},_0x5273cd,_0x553645[_0x6d6d('0x43')]);var _0x4b457d={'where':_0x5273cd[_0x6d6d('0x3f')]};return db[_0x6d6d('0x2e')][_0x6d6d('0x20')](_0x4b457d)[_0x6d6d('0x27')](function(_0x32275b){_0x57341f[_0x6d6d('0x20')]=_0x32275b;if(_0x553645[_0x6d6d('0x35')]['includeAll']){_0x5273cd[_0x6d6d('0x44')]=[{'all':!![]}];}return db[_0x6d6d('0x2e')][_0x6d6d('0x45')](_0x5273cd);})[_0x6d6d('0x27')](function(_0xe1aa77){_0x57341f['rows']=_0xe1aa77;return _0x57341f;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x3edcce,_0x5273cd))[_0x6d6d('0x46')](handleError(_0x3edcce,null));};exports['show']=function(_0x452de2,_0x50dc17){var _0x15bf62={'raw':![],'where':{'id':_0x452de2['params']['id']}},_0x43c03c={};_0x43c03c[_0x6d6d('0x33')]=_[_0x6d6d('0x36')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')]);_0x43c03c[_0x6d6d('0x35')]=_['keys'](_0x452de2['query']);_0x43c03c[_0x6d6d('0x37')]=_['intersection'](_0x43c03c['model'],_0x43c03c[_0x6d6d('0x35')]);_0x15bf62[_0x6d6d('0x38')]=_[_0x6d6d('0x39')](_0x43c03c['model'],qs[_0x6d6d('0x3a')](_0x452de2['query'][_0x6d6d('0x3a')]));_0x15bf62[_0x6d6d('0x38')]=_0x15bf62[_0x6d6d('0x38')][_0x6d6d('0x3b')]?_0x15bf62[_0x6d6d('0x38')]:_0x43c03c[_0x6d6d('0x33')];if(_0x452de2[_0x6d6d('0x35')]['includeAll']){_0x15bf62[_0x6d6d('0x44')]=[{'all':!![]}];}_0x15bf62=_[_0x6d6d('0x42')]({},_0x15bf62,_0x452de2[_0x6d6d('0x43')]);return db[_0x6d6d('0x2e')][_0x6d6d('0x47')](_0x15bf62)[_0x6d6d('0x27')](handleEntityNotFound(_0x50dc17,null))[_0x6d6d('0x27')](respondWithResult(_0x50dc17,null))[_0x6d6d('0x46')](handleError(_0x50dc17,null));};exports[_0x6d6d('0x48')]=function(_0x5e4c04,_0x4d78bb){return db[_0x6d6d('0x2e')][_0x6d6d('0x48')](_0x5e4c04[_0x6d6d('0x49')],{})[_0x6d6d('0x27')](respondWithResult(_0x4d78bb,0xc9))[_0x6d6d('0x46')](handleError(_0x4d78bb,null));};exports['update']=function(_0x47170d,_0x27b396){if(_0x47170d[_0x6d6d('0x49')]['id']){delete _0x47170d[_0x6d6d('0x49')]['id'];}delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4a')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4b')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4c')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4d')];return db['ScreenRecording'][_0x6d6d('0x47')]({'where':{'id':_0x47170d[_0x6d6d('0x4e')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x27b396,null))[_0x6d6d('0x27')](saveUpdates(_0x47170d[_0x6d6d('0x49')],null))['then'](respondWithResult(_0x27b396,null))[_0x6d6d('0x46')](handleError(_0x27b396,null));};exports[_0x6d6d('0x4f')]=function(_0x45340b,_0x4e4c3e){return db['ScreenRecording'][_0x6d6d('0x4f')]()['then'](respondWithResult(_0x4e4c3e,null))[_0x6d6d('0x46')](handleError(_0x4e4c3e,null));};exports[_0x6d6d('0x50')]=function(_0x32aaae,_0x268361,_0x4777a5){var _0x18e2de=require(_0x6d6d('0x51'));var _0x26c23a=![];var _0x1a8f33={};if(_0x32aaae[_0x6d6d('0x35')]['type']&&_0x32aaae[_0x6d6d('0x35')][_0x6d6d('0x31')]===_0x6d6d('0x52')){_0x1a8f33[_0x6d6d('0x52')]=_0x32aaae[_0x6d6d('0x4e')]['id'];}else{_0x1a8f33['id']=_0x32aaae[_0x6d6d('0x4e')]['id'];}return db[_0x6d6d('0x2e')]['find']({'where':_0x1a8f33,'attributes':['id','value'],'raw':!![]})[_0x6d6d('0x27')](handleEntityNotFound(_0x268361,null))[_0x6d6d('0x27')](function(_0x5cc644){if(_0x5cc644){var _0x3e98a0=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],_0x6d6d('0x55'),_0x5cc644[_0x6d6d('0x4d')]);var _0xc6b96e=util[_0x6d6d('0x56')](_0x6d6d('0x57'),_0x3e98a0);if(fs[_0x6d6d('0x58')](_0xc6b96e)){_0x26c23a=!![];return _0x18e2de[_0x6d6d('0x59')](_0xc6b96e,_0x3e98a0,config[_0x6d6d('0x5a')][_0x6d6d('0x5b')])[_0x6d6d('0x27')](function(){return _0x5cc644;});}return _0x5cc644;}})[_0x6d6d('0x27')](function(_0x3065ea){if(_0x3065ea){var _0x50d8dd=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],'server/files/screen_recordings',_0x3065ea[_0x6d6d('0x4d')]);if(!fs[_0x6d6d('0x58')](_0x50d8dd)){throw new db[(_0x6d6d('0x5c'))][(_0x6d6d('0x5d'))](_0x6d6d('0x5e'));}if(_0x3065ea[_0x6d6d('0x5f')]){return _0x268361[_0x6d6d('0x50')](_0x50d8dd,_0x3065ea[_0x6d6d('0x5f')]+path[_0x6d6d('0x60')](_0x50d8dd),function(){if(_0x26c23a){fs['unlink'](_0x50d8dd);}});}else{return _0x268361['download'](_0x50d8dd,function(_0x22c3a1){if(_0x26c23a){fs[_0x6d6d('0x61')](_0x50d8dd);}});}}})[_0x6d6d('0x46')](function(_0x5de33f){if(_0x5de33f['message']===_0x6d6d('0x5e')){_0x268361['status'](0x194)[_0x6d6d('0x2c')]('Not\x20found');}else{return handleError(_0x268361,null);}});};exports[_0x6d6d('0x28')]=function(_0x367a6f,_0x21f14c){return db[_0x6d6d('0x2e')][_0x6d6d('0x47')]({'where':{'id':_0x367a6f[_0x6d6d('0x4e')]['id']}})['then'](function(_0x41e576){if(_['isNil'](_0x41e576)){throw new ReferenceError(_0x6d6d('0x62'));}return _0x41e576;})['then'](function(_0x2a21d8){var _0x3e48f7=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],_0x6d6d('0x55'),_0x2a21d8[_0x6d6d('0x4d')]);logger[_0x6d6d('0x63')]('cancellazione\x20fisica\x20documento\x20%s',_0x3e48f7);if(!_['isNil'](_0x2a21d8[_0x6d6d('0x4d')])&&fs['existsSync'](_0x3e48f7)){logger[_0x6d6d('0x63')]('File:\x20\x22'+_0x3e48f7+_0x6d6d('0x64'));fs[_0x6d6d('0x65')](_0x3e48f7);}_0x3e48f7=_0x3e48f7+_0x6d6d('0x66');if(!_[_0x6d6d('0x67')](_0x2a21d8[_0x6d6d('0x4d')])&&fs[_0x6d6d('0x58')](_0x3e48f7)){logger['info'](_0x6d6d('0x68')+_0x3e48f7+_0x6d6d('0x64'));fs[_0x6d6d('0x65')](_0x3e48f7);}return _0x2a21d8;})[_0x6d6d('0x27')](function(_0x1ba731){if(!_0x1ba731)throw new InternalError();return _0x1ba731[_0x6d6d('0x28')]();})[_0x6d6d('0x27')](function(){_0x21f14c['status'](0xcc)[_0x6d6d('0x1b')]();})[_0x6d6d('0x46')](handleError(_0x21f14c,null));}; \ No newline at end of file +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(_0x3caecc,_0x55c576){var _0x2aef84=function(_0x79c6ff){while(--_0x79c6ff){_0x3caecc['push'](_0x3caecc['shift']());}};_0x2aef84(++_0x55c576);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0x4b84[_0x3cb6dc];return _0x47ec89;};'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 diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 64b3d5f..39fffd5 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 _0xddb3=['./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x56899e,_0x5b2729){var _0x50261b=function(_0x259b08){while(--_0x259b08){_0x56899e['push'](_0x56899e['shift']());}};_0x50261b(++_0x5b2729);}(_0xddb3,0x1d7));var _0x3ddb=function(_0x5ec21a,_0x19a8c8){_0x5ec21a=_0x5ec21a-0x0;var _0x151db5=_0xddb3[_0x5ec21a];return _0x151db5;};'use strict';var _=require(_0x3ddb('0x0'));var util=require(_0x3ddb('0x1'));var logger=require(_0x3ddb('0x2'))(_0x3ddb('0x3'));var moment=require(_0x3ddb('0x4'));var BPromise=require(_0x3ddb('0x5'));var rp=require(_0x3ddb('0x6'));var fs=require('fs');var path=require(_0x3ddb('0x7'));var rimraf=require('rimraf');var config=require(_0x3ddb('0x8'));var attributes=require(_0x3ddb('0x9'));module[_0x3ddb('0xa')]=function(_0x371792,_0x3215ba){return _0x371792[_0x3ddb('0xb')](_0x3ddb('0xc'),attributes,{'tableName':_0x3ddb('0xd'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x3ddb('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbecd=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid'];(function(_0x22eb96,_0x3c2d8d){var _0x5e1adf=function(_0x22e392){while(--_0x22e392){_0x22eb96['push'](_0x22eb96['shift']());}};_0x5e1adf(++_0x3c2d8d);}(_0xbecd,0x113));var _0xdbec=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbecd[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xdbec('0x0'));var util=require('util');var logger=require(_0xdbec('0x1'))(_0xdbec('0x2'));var moment=require('moment');var BPromise=require(_0xdbec('0x3'));var rp=require(_0xdbec('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdbec('0x5'));var config=require('../../config/environment');var attributes=require(_0xdbec('0x6'));module[_0xdbec('0x7')]=function(_0x4cfcf1,_0x3f0ea5){return _0x4cfcf1['define'](_0xdbec('0x8'),attributes,{'tableName':_0xdbec('0x9'),'paranoid':![],'indexes':[{'name':_0xdbec('0xa'),'fields':[_0xdbec('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 75b275f..e5f84ec 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 _0x9767=['lodash','util','moment','ioredis','../../config/logger','rpc','jayson/promise','client','request','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ScreenRecording,\x20%s,\x20%s','catch'];(function(_0x544d66,_0xabcbd9){var _0x46a80d=function(_0x48311d){while(--_0x48311d){_0x544d66['push'](_0x544d66['shift']());}};_0x46a80d(++_0xabcbd9);}(_0x9767,0x1db));var _0x7976=function(_0x1933f9,_0x239e5f){_0x1933f9=_0x1933f9-0x0;var _0x5b1657=_0x9767[_0x1933f9];return _0x5b1657;};'use strict';var _=require(_0x7976('0x0'));var util=require(_0x7976('0x1'));var moment=require(_0x7976('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7976('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7976('0x4'))(_0x7976('0x5'));var config=require('../../config/environment');var jayson=require(_0x7976('0x6'));var client=jayson[_0x7976('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b3bc3,_0x14a210,_0x2de536){return new BPromise(function(_0x4d2e39,_0x4b42ee){return client[_0x7976('0x8')](_0x3b3bc3,_0x2de536)['then'](function(_0x39ef3d){logger[_0x7976('0x9')]('ScreenRecording,\x20%s,\x20%s',_0x14a210,_0x7976('0xa'));logger[_0x7976('0xb')](_0x7976('0xc'),_0x14a210,_0x7976('0xa'),JSON[_0x7976('0xd')](_0x39ef3d));if(_0x39ef3d[_0x7976('0xe')]){if(_0x39ef3d['error'][_0x7976('0xf')]===0x1f4){logger[_0x7976('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x14a210,_0x39ef3d[_0x7976('0xe')][_0x7976('0x10')]);return _0x4b42ee(_0x39ef3d[_0x7976('0xe')][_0x7976('0x10')]);}logger[_0x7976('0xe')](_0x7976('0x11'),_0x14a210,_0x39ef3d[_0x7976('0xe')]['message']);return _0x4d2e39(_0x39ef3d[_0x7976('0xe')]['message']);}else{logger[_0x7976('0x9')](_0x7976('0x11'),_0x14a210,_0x7976('0xa'));_0x4d2e39(_0x39ef3d['result']['message']);}})[_0x7976('0x12')](function(_0x3f142f){logger[_0x7976('0xe')](_0x7976('0x11'),_0x14a210,_0x3f142f);_0x4b42ee(_0x3f142f);});});} \ No newline at end of file +var _0x18a7=['request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ScreenRecording,\x20%s,\x20%s'];(function(_0xb0de07,_0x3ca2a0){var _0x4633d8=function(_0x2368e0){while(--_0x2368e0){_0xb0de07['push'](_0xb0de07['shift']());}};_0x4633d8(++_0x3ca2a0);}(_0x18a7,0x7c));var _0x718a=function(_0x2db946,_0x13b577){_0x2db946=_0x2db946-0x0;var _0x2283df=_0x18a7[_0x2db946];return _0x2283df;};'use strict';var _=require(_0x718a('0x0'));var util=require('util');var moment=require(_0x718a('0x1'));var BPromise=require(_0x718a('0x2'));var rs=require(_0x718a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x718a('0x4'));var logger=require(_0x718a('0x5'))(_0x718a('0x6'));var config=require(_0x718a('0x7'));var jayson=require(_0x718a('0x8'));var client=jayson[_0x718a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x291206,_0x4dc53e,_0xaec635){return new BPromise(function(_0xb9d56a,_0x2600d2){return client[_0x718a('0xa')](_0x291206,_0xaec635)[_0x718a('0xb')](function(_0x2fccf5){logger[_0x718a('0xc')](_0x718a('0xd'),_0x4dc53e,_0x718a('0xe'));logger[_0x718a('0xf')](_0x718a('0x10'),_0x4dc53e,_0x718a('0xe'),JSON[_0x718a('0x11')](_0x2fccf5));if(_0x2fccf5[_0x718a('0x12')]){if(_0x2fccf5[_0x718a('0x12')][_0x718a('0x13')]===0x1f4){logger[_0x718a('0x12')](_0x718a('0xd'),_0x4dc53e,_0x2fccf5[_0x718a('0x12')][_0x718a('0x14')]);return _0x2600d2(_0x2fccf5[_0x718a('0x12')][_0x718a('0x14')]);}logger[_0x718a('0x12')](_0x718a('0xd'),_0x4dc53e,_0x2fccf5[_0x718a('0x12')][_0x718a('0x14')]);return _0xb9d56a(_0x2fccf5[_0x718a('0x12')][_0x718a('0x14')]);}else{logger['info'](_0x718a('0xd'),_0x4dc53e,_0x718a('0xe'));_0xb9d56a(_0x2fccf5[_0x718a('0x15')][_0x718a('0x14')]);}})[_0x718a('0x16')](function(_0x411970){logger[_0x718a('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x4dc53e,_0x411970);_0x2600d2(_0x411970);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 13b4e5b..0182aa9 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 _0xe497=['server/files/images/logos/','format','%s%s','extname','originalname','post','/:id/logo','file','addLogo','diskStorage','logologin','addLogoLogin','preferred','single','addPreferred','favicon','addFavicon','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','get','index','getDate','/:id','getLogo','/:id/logo_login','getLogoLogin','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root'];(function(_0x33ccd5,_0x475e53){var _0x8cb1b2=function(_0x5c0b25){while(--_0x5c0b25){_0x33ccd5['push'](_0x33ccd5['shift']());}};_0x8cb1b2(++_0x475e53);}(_0xe497,0x139));var _0x7e49=function(_0x26855a,_0x2dea5a){_0x26855a=_0x26855a-0x0;var _0x5c061f=_0xe497[_0x26855a];return _0x5c061f;};'use strict';var multer=require(_0x7e49('0x0'));var util=require(_0x7e49('0x1'));var path=require(_0x7e49('0x2'));var timeout=require(_0x7e49('0x3'));var express=require(_0x7e49('0x4'));var router=express[_0x7e49('0x5')]();var fs_extra=require(_0x7e49('0x6'));var auth=require(_0x7e49('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7e49('0x8'));var controller=require(_0x7e49('0x9'));router[_0x7e49('0xa')]('/',auth['isAuthenticated'](),controller[_0x7e49('0xb')]);router['get']('/now',controller[_0x7e49('0xc')]);router[_0x7e49('0xa')](_0x7e49('0xd'),controller['show']);router[_0x7e49('0xa')]('/:id/logo',controller[_0x7e49('0xe')]);router[_0x7e49('0xa')](_0x7e49('0xf'),controller[_0x7e49('0x10')]);router[_0x7e49('0xa')]('/:id/gdpr',controller['gdpr']);router['get'](_0x7e49('0x11'),controller[_0x7e49('0x12')]);router[_0x7e49('0xa')](_0x7e49('0x13'),controller[_0x7e49('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2f1dff,_0x1172aa,_0xfb49d4){_0xfb49d4(null,path[_0x7e49('0x15')](config[_0x7e49('0x16')],_0x7e49('0x17')));},'filename':function(_0x1a923c,_0x2971c8,_0x55816c){_0x55816c(null,util[_0x7e49('0x18')](_0x7e49('0x19'),'logo',path[_0x7e49('0x1a')](_0x2971c8[_0x7e49('0x1b')])));}})});router[_0x7e49('0x1c')](_0x7e49('0x1d'),upload['single'](_0x7e49('0x1e')),controller[_0x7e49('0x1f')]);var upload=multer({'storage':multer[_0x7e49('0x20')]({'destination':function(_0x1d60d3,_0x4a14a7,_0x31c708){_0x31c708(null,path[_0x7e49('0x15')](config['root'],_0x7e49('0x17')));},'filename':function(_0x231638,_0x3f6c89,_0x6da3ed){_0x6da3ed(null,util['format'](_0x7e49('0x19'),_0x7e49('0x21'),path[_0x7e49('0x1a')](_0x3f6c89[_0x7e49('0x1b')])));}})});router[_0x7e49('0x1c')]('/:id/logo_login',upload['single'](_0x7e49('0x1e')),controller[_0x7e49('0x22')]);var upload=multer({'storage':multer[_0x7e49('0x20')]({'destination':function(_0x237074,_0x42057b,_0x39dbbc){_0x39dbbc(null,path[_0x7e49('0x15')](config[_0x7e49('0x16')],_0x7e49('0x17')));},'filename':function(_0x5c6b44,_0x20d5a3,_0x144230){_0x144230(null,util[_0x7e49('0x18')](_0x7e49('0x19'),_0x7e49('0x23'),path['extname'](_0x20d5a3[_0x7e49('0x1b')])));}})});router[_0x7e49('0x1c')](_0x7e49('0x11'),upload[_0x7e49('0x24')](_0x7e49('0x1e')),controller[_0x7e49('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x18872b,_0x27db00,_0x104ecb){_0x104ecb(null,path[_0x7e49('0x15')](config[_0x7e49('0x16')],_0x7e49('0x17')));},'filename':function(_0x39d935,_0x11c308,_0x4e6830){_0x4e6830(null,util[_0x7e49('0x18')](_0x7e49('0x19'),_0x7e49('0x26'),path['extname'](_0x11c308[_0x7e49('0x1b')])));}})});router[_0x7e49('0x1c')](_0x7e49('0x13'),upload[_0x7e49('0x24')](_0x7e49('0x1e')),controller[_0x7e49('0x27')]);router[_0x7e49('0x28')](_0x7e49('0xd'),auth['isAuthenticated'](),controller[_0x7e49('0x29')]);module['exports']=router; \ No newline at end of file +var _0x566a=['getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s','logo','extname','originalname','single','addLogo','root','post','file','addLogoLogin','preferred','addPreferred','favicon','put','/:id','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred'];(function(_0x1c2f29,_0x5a2668){var _0x258465=function(_0x30332f){while(--_0x30332f){_0x1c2f29['push'](_0x1c2f29['shift']());}};_0x258465(++_0x5a2668);}(_0x566a,0x9a));var _0xa566=function(_0x4f0c87,_0xb3b6c0){_0x4f0c87=_0x4f0c87-0x0;var _0x4ea2cc=_0x566a[_0x4f0c87];return _0x4ea2cc;};'use strict';var multer=require(_0xa566('0x0'));var util=require(_0xa566('0x1'));var path=require(_0xa566('0x2'));var timeout=require('connect-timeout');var express=require(_0xa566('0x3'));var router=express[_0xa566('0x4')]();var fs_extra=require(_0xa566('0x5'));var auth=require(_0xa566('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa566('0x7'));var controller=require(_0xa566('0x8'));router[_0xa566('0x9')]('/',auth[_0xa566('0xa')](),controller[_0xa566('0xb')]);router[_0xa566('0x9')](_0xa566('0xc'),controller[_0xa566('0xd')]);router['get']('/:id',controller[_0xa566('0xe')]);router[_0xa566('0x9')](_0xa566('0xf'),controller['getLogo']);router['get'](_0xa566('0x10'),controller[_0xa566('0x11')]);router[_0xa566('0x9')](_0xa566('0x12'),controller[_0xa566('0x13')]);router['get'](_0xa566('0x14'),controller[_0xa566('0x15')]);router[_0xa566('0x9')]('/:id/favicon',controller[_0xa566('0x16')]);var upload=multer({'storage':multer[_0xa566('0x17')]({'destination':function(_0x4b633e,_0x1f6101,_0xad830c){_0xad830c(null,path[_0xa566('0x18')](config['root'],_0xa566('0x19')));},'filename':function(_0x3fcef2,_0x57050a,_0x5c7cf5){_0x5c7cf5(null,util[_0xa566('0x1a')](_0xa566('0x1b'),_0xa566('0x1c'),path[_0xa566('0x1d')](_0x57050a[_0xa566('0x1e')])));}})});router['post'](_0xa566('0xf'),upload[_0xa566('0x1f')]('file'),controller[_0xa566('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x38625e,_0x3fa588,_0xb7f55e){_0xb7f55e(null,path['join'](config[_0xa566('0x21')],_0xa566('0x19')));},'filename':function(_0x2cf53f,_0x3cd155,_0x30af5c){_0x30af5c(null,util[_0xa566('0x1a')](_0xa566('0x1b'),'logologin',path[_0xa566('0x1d')](_0x3cd155[_0xa566('0x1e')])));}})});router[_0xa566('0x22')](_0xa566('0x10'),upload[_0xa566('0x1f')](_0xa566('0x23')),controller[_0xa566('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4bb9a2,_0x58b78f,_0x1f1b22){_0x1f1b22(null,path[_0xa566('0x18')](config[_0xa566('0x21')],_0xa566('0x19')));},'filename':function(_0x18cb35,_0x33c630,_0x4b040b){_0x4b040b(null,util[_0xa566('0x1a')](_0xa566('0x1b'),_0xa566('0x25'),path[_0xa566('0x1d')](_0x33c630[_0xa566('0x1e')])));}})});router[_0xa566('0x22')]('/:id/preferred',upload['single'](_0xa566('0x23')),controller[_0xa566('0x26')]);var upload=multer({'storage':multer[_0xa566('0x17')]({'destination':function(_0x302910,_0x1e5c50,_0x41c3cf){_0x41c3cf(null,path['join'](config[_0xa566('0x21')],_0xa566('0x19')));},'filename':function(_0x15dc1c,_0x2c4eb3,_0x24fcb){_0x24fcb(null,util[_0xa566('0x1a')](_0xa566('0x1b'),_0xa566('0x27'),path['extname'](_0x2c4eb3[_0xa566('0x1e')])));}})});router[_0xa566('0x22')]('/:id/favicon',upload[_0xa566('0x1f')]('file'),controller['addFavicon']);router[_0xa566('0x28')](_0xa566('0x29'),auth[_0xa566('0xa')](),controller[_0xa566('0x2a')]);module[_0xa566('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 68532bf..a0f05b5 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 _0xdb28=['INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdb28,0x106));var _0x8db2=function(_0x5905a4,_0x546ab){_0x5905a4=_0x5905a4-0x0;var _0x2c4d8f=_0xdb28[_0x5905a4];return _0x2c4d8f;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'min_internal':{'type':Sequelize[_0x8db2('0x2')](0xb),'unique':_0x8db2('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x8db2('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x8db2('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x8db2('0x5')],'defaultValue':_0x8db2('0x6')},'logo':{'type':Sequelize[_0x8db2('0x5')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x8db2('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x8db2('0x5')]},'turnaddr':{'type':Sequelize[_0x8db2('0x5')]},'turnusername':{'type':Sequelize[_0x8db2('0x5')]},'turnpassword':{'type':Sequelize[_0x8db2('0x5')]},'pageTitle':{'type':Sequelize[_0x8db2('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x8db2('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x8db2('0x8')},'enableEmailPreview':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x8db2('0x5')],'defaultValue':_0x8db2('0x9')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x8db2('0x5')]},'defaultPreferred':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x8db2('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x8db2('0x5')]},'defaultFavicon':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x8db2('0x2')]},'transcribeRegion':{'type':Sequelize[_0x8db2('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x8db2('0x2')]},'sentimentRegion':{'type':Sequelize[_0x8db2('0x5')]},'language':{'type':Sequelize[_0x8db2('0x5')]},'bucket':{'type':Sequelize[_0x8db2('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x8db2('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x8db2('0x2')](0x2)[_0x8db2('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x8db2('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x8db2('0x2')](0x2)[_0x8db2('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x5f2f=['INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','alternate','UNSIGNED','sequelize','exports'];(function(_0x53c94d,_0x4c3ef5){var _0x5f44ed=function(_0x213d17){while(--_0x213d17){_0x53c94d['push'](_0x53c94d['shift']());}};_0x5f44ed(++_0x4c3ef5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2ea0cf,_0x2072f4){_0x2ea0cf=_0x2ea0cf-0x0;var _0x4999f0=_0x5f2f[_0x2ea0cf];return _0x4999f0;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'min_internal':{'type':Sequelize[_0xf5f2('0x2')](0xb),'unique':_0xf5f2('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xf5f2('0x2')](0xb),'unique':_0xf5f2('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xf5f2('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xf5f2('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xf5f2('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xf5f2('0x5')]},'turnaddr':{'type':Sequelize[_0xf5f2('0x5')]},'turnusername':{'type':Sequelize[_0xf5f2('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xf5f2('0x5')]},'defaultPageTitle':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':_0xf5f2('0x7')},'chatTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xf5f2('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xf5f2('0x2')]},'transcribeRegion':{'type':Sequelize[_0xf5f2('0x5')]},'sentiment':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xf5f2('0x2')]},'sentimentRegion':{'type':Sequelize[_0xf5f2('0x5')]},'language':{'type':Sequelize[_0xf5f2('0x5')]},'bucket':{'type':Sequelize[_0xf5f2('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xf5f2('0x2')](0x2)[_0xf5f2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xf5f2('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xf5f2('0x2')](0x2)[_0xf5f2('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 8a24a12..56a0ce1 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 _0x36f1=['loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','toLower','root','join','default','custom','default_logo.svg','Sequelize','ValidationError','upperFirst','download','getLogoLogin','server/files/images/logos','default_loginLogo.svg','\x20not\x20found','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','message','Setting,\x20%s,\x20%s','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','Setting','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','body','addLogo','file','logo','filename','addLogoLogin','getLogo','getLicense'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x36f1,0x19f));var _0x136f=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x36f1[_0x1e7b16];return _0x37fadc;};'use strict';var emlformat=require(_0x136f('0x0'));var rimraf=require(_0x136f('0x1'));var zipdir=require(_0x136f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x136f('0x3'));var moment=require(_0x136f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x136f('0x5'));var util=require(_0x136f('0x6'));var path=require(_0x136f('0x7'));var sox=require(_0x136f('0x8'));var csv=require(_0x136f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x136f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x136f('0xb'));var jsforce=require(_0x136f('0xc'));var deskjs=require(_0x136f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x136f('0xe'));var Papa=require(_0x136f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x136f('0x10'));var as=require(_0x136f('0x11'));var hardwareService=require(_0x136f('0x12'));var logger=require('../../config/logger')(_0x136f('0x13'));var utils=require('../../config/utils');var config=require(_0x136f('0x14'));var licenseUtil=require(_0x136f('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x136f('0x16'));var client=jayson['client'][_0x136f('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x198090,_0x5bf4e6,_0xfa3ffe,_0x1ba6a0){return new BPromise(function(_0x5807d1,_0x343538){var _0x24d348=_0x1ba6a0||client;return _0x24d348[_0x136f('0x18')](_0x198090,_0xfa3ffe)[_0x136f('0x19')](function(_0x4c50f0){logger[_0x136f('0x1a')]('Setting,\x20%s,\x20%s',_0x5bf4e6,_0x136f('0x1b'));logger[_0x136f('0x1c')]('Setting,\x20%s,\x20%s,\x20%s',_0x5bf4e6,_0x136f('0x1b'),JSON[_0x136f('0x1d')](_0x4c50f0));if(_0x4c50f0[_0x136f('0x1e')]){if(_0x4c50f0[_0x136f('0x1e')][_0x136f('0x1f')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x5bf4e6,_0x4c50f0['error'][_0x136f('0x20')]);return _0x343538(_0x4c50f0[_0x136f('0x1e')][_0x136f('0x20')]);}logger[_0x136f('0x1e')](_0x136f('0x21'),_0x5bf4e6,_0x4c50f0[_0x136f('0x1e')][_0x136f('0x20')]);return _0x5807d1(_0x4c50f0['error'][_0x136f('0x20')]);}else{logger[_0x136f('0x1a')]('Setting,\x20%s,\x20%s',_0x5bf4e6,_0x136f('0x1b'));_0x5807d1(_0x4c50f0[_0x136f('0x22')][_0x136f('0x20')]);}})[_0x136f('0x23')](function(_0x3bb8ba){logger['error'](_0x136f('0x21'),_0x5bf4e6,_0x3bb8ba);_0x343538(_0x3bb8ba);});});}function respondWithStatusCode(_0x9cd00a,_0x3281e3){_0x3281e3=_0x3281e3||0xcc;return function(_0x34111f){if(_0x34111f){return _0x9cd00a[_0x136f('0x24')](_0x3281e3);}return _0x9cd00a[_0x136f('0x25')](_0x3281e3)['end']();};}function respondWithResult(_0x81012f,_0x411750){_0x411750=_0x411750||0xc8;return function(_0x466589){if(_0x466589){return _0x81012f[_0x136f('0x25')](_0x411750)[_0x136f('0x26')](_0x466589);}};}function respondWithFilteredResult(_0x565577,_0x128070){return function(_0x3ab82f){if(_0x3ab82f){var _0x4e7ee3=typeof _0x128070[_0x136f('0x27')]==='undefined'&&typeof _0x128070['limit']===_0x136f('0x28');var _0x5d2ad2=_0x3ab82f[_0x136f('0x29')];var _0x3fc1c4=_0x4e7ee3?0x0:_0x128070[_0x136f('0x27')];var _0x186861=_0x4e7ee3?_0x3ab82f[_0x136f('0x29')]:_0x128070[_0x136f('0x27')]+_0x128070[_0x136f('0x2a')];var _0x4ce987;if(_0x186861>=_0x5d2ad2){_0x186861=_0x5d2ad2;_0x4ce987=0xc8;}else{_0x4ce987=0xce;}_0x565577[_0x136f('0x25')](_0x4ce987);return _0x565577[_0x136f('0x2b')](_0x136f('0x2c'),_0x3fc1c4+'-'+_0x186861+'/'+_0x5d2ad2)[_0x136f('0x26')](_0x3ab82f);}return null;};}function patchUpdates(_0x3a08ec){return function(_0x2c391e){try{jsonpatch[_0x136f('0x2d')](_0x2c391e,_0x3a08ec,!![]);}catch(_0x2ce48c){return BPromise[_0x136f('0x2e')](_0x2ce48c);}return _0x2c391e[_0x136f('0x2f')]();};}function saveUpdates(_0x901c38,_0x5a517c){return function(_0x34df0a){if(_0x34df0a){return _0x34df0a[_0x136f('0x30')](_0x901c38)[_0x136f('0x19')](function(_0x115983){return _0x115983;});}return null;};}function removeEntity(_0x9a7543,_0x2c3c44){return function(_0x241a84){if(_0x241a84){return _0x241a84[_0x136f('0x31')]()[_0x136f('0x19')](function(){_0x9a7543[_0x136f('0x25')](0xcc)[_0x136f('0x32')]();});}};}function handleEntityNotFound(_0x598693,_0x14c695){return function(_0x180662){if(!_0x180662){_0x598693['sendStatus'](0x194);}return _0x180662;};}function handleError(_0x391108,_0x11e863){_0x11e863=_0x11e863||0x1f4;return function(_0x3b1520){logger[_0x136f('0x1e')](_0x3b1520[_0x136f('0x33')]);if(_0x3b1520[_0x136f('0x34')]){delete _0x3b1520['name'];}_0x391108['status'](_0x11e863)[_0x136f('0x35')](_0x3b1520);};}exports[_0x136f('0x36')]=function(_0x2cc2a9,_0xba4e70){var _0x317465={},_0x1d485d={},_0x4fca3a={'count':0x0,'rows':[]};var _0x460908=_[_0x136f('0x37')](db[_0x136f('0x38')][_0x136f('0x39')],function(_0xf36c53){return{'name':_0xf36c53[_0x136f('0x3a')],'type':_0xf36c53['type'][_0x136f('0x3b')]};});_0x1d485d[_0x136f('0x3c')]=_[_0x136f('0x37')](_0x460908,_0x136f('0x34'));_0x1d485d['query']=_[_0x136f('0x3d')](_0x2cc2a9['query']);_0x1d485d[_0x136f('0x3e')]=_[_0x136f('0x3f')](_0x1d485d[_0x136f('0x3c')],_0x1d485d[_0x136f('0x40')]);_0x317465['attributes']=_['intersection'](_0x1d485d[_0x136f('0x3c')],qs['fields'](_0x2cc2a9[_0x136f('0x40')][_0x136f('0x41')]));_0x317465[_0x136f('0x42')]=_0x317465[_0x136f('0x42')][_0x136f('0x43')]?_0x317465['attributes']:_0x1d485d['model'];if(!_0x2cc2a9[_0x136f('0x40')][_0x136f('0x44')](_0x136f('0x45'))){_0x317465[_0x136f('0x2a')]=qs['limit'](_0x2cc2a9[_0x136f('0x40')]['limit']);_0x317465['offset']=qs[_0x136f('0x27')](_0x2cc2a9[_0x136f('0x40')]['offset']);}_0x317465[_0x136f('0x46')]=qs[_0x136f('0x47')](_0x2cc2a9[_0x136f('0x40')][_0x136f('0x47')]);_0x317465[_0x136f('0x48')]=qs['filters'](_[_0x136f('0x49')](_0x2cc2a9[_0x136f('0x40')],_0x1d485d[_0x136f('0x3e')]),_0x460908);if(_0x2cc2a9[_0x136f('0x40')][_0x136f('0x4a')]){_0x317465['where']=_['merge'](_0x317465[_0x136f('0x48')],{'$or':_['map'](_0x460908,function(_0x4934ba){if(_0x4934ba['type']!==_0x136f('0x4b')){var _0x399844={};_0x399844[_0x4934ba[_0x136f('0x34')]]={'$like':'%'+_0x2cc2a9[_0x136f('0x40')][_0x136f('0x4a')]+'%'};return _0x399844;}})});}_0x317465=_[_0x136f('0x4c')]({},_0x317465,_0x2cc2a9[_0x136f('0x4d')]);var _0x20d6ca={'where':_0x317465['where']};return db[_0x136f('0x38')][_0x136f('0x29')](_0x20d6ca)['then'](function(_0x10baf4){_0x4fca3a[_0x136f('0x29')]=_0x10baf4;if(_0x2cc2a9['query'][_0x136f('0x4e')]){_0x317465[_0x136f('0x4f')]=[{'all':!![]}];}return db[_0x136f('0x38')][_0x136f('0x50')](_0x317465);})['then'](function(_0x5b3137){_0x4fca3a[_0x136f('0x51')]=_0x5b3137;return _0x4fca3a;})[_0x136f('0x19')](respondWithFilteredResult(_0xba4e70,_0x317465))['catch'](handleError(_0xba4e70,null));};exports[_0x136f('0x52')]=function(_0x4ba4ac,_0x394020){var _0x283159={'raw':![],'where':{'id':_0x4ba4ac[_0x136f('0x53')]['id']}},_0x2e16ff={};_0x2e16ff['model']=_[_0x136f('0x3d')](db[_0x136f('0x38')][_0x136f('0x39')]);_0x2e16ff['query']=_[_0x136f('0x3d')](_0x4ba4ac[_0x136f('0x40')]);_0x2e16ff['filters']=_['intersection'](_0x2e16ff['model'],_0x2e16ff['query']);_0x283159[_0x136f('0x42')]=_[_0x136f('0x3f')](_0x2e16ff[_0x136f('0x3c')],qs[_0x136f('0x41')](_0x4ba4ac[_0x136f('0x40')][_0x136f('0x41')]));_0x283159['attributes']=_0x283159['attributes'][_0x136f('0x43')]?_0x283159[_0x136f('0x42')]:_0x2e16ff[_0x136f('0x3c')];if(_0x4ba4ac['query'][_0x136f('0x4e')]){_0x283159[_0x136f('0x4f')]=[{'all':!![]}];}_0x283159=_[_0x136f('0x4c')]({},_0x283159,_0x4ba4ac[_0x136f('0x4d')]);return db[_0x136f('0x38')][_0x136f('0x54')](_0x283159)[_0x136f('0x19')](handleEntityNotFound(_0x394020,null))[_0x136f('0x19')](respondWithResult(_0x394020,null))[_0x136f('0x23')](handleError(_0x394020,null));};exports['update']=function(_0x24fa43,_0x4a7aaa){if(_0x24fa43[_0x136f('0x55')]['id']){delete _0x24fa43['body']['id'];}return db[_0x136f('0x38')][_0x136f('0x54')]({'where':{'id':_0x24fa43['params']['id']}})[_0x136f('0x19')](handleEntityNotFound(_0x4a7aaa,null))[_0x136f('0x19')](saveUpdates(_0x24fa43[_0x136f('0x55')],null))[_0x136f('0x19')](respondWithResult(_0x4a7aaa,null))[_0x136f('0x23')](handleError(_0x4a7aaa,null));};exports[_0x136f('0x56')]=function(_0x3f7fe0,_0x1a5d8c,_0x37f44f){if(_0x3f7fe0[_0x136f('0x57')]&&_0x3f7fe0[_0x136f('0x57')]['filename']){_0x3f7fe0['body'][_0x136f('0x58')]=_0x3f7fe0[_0x136f('0x57')][_0x136f('0x59')];}return db['Setting'][_0x136f('0x54')]({'where':{'id':_0x3f7fe0[_0x136f('0x53')]['id']}})[_0x136f('0x19')](handleEntityNotFound(_0x1a5d8c,null))[_0x136f('0x19')](saveUpdates(_0x3f7fe0[_0x136f('0x55')],null))[_0x136f('0x19')](respondWithResult(_0x1a5d8c,null))[_0x136f('0x23')](handleError(_0x1a5d8c,null));};exports[_0x136f('0x5a')]=function(_0x2c36d7,_0x40b005,_0x31d68b){if(_0x2c36d7['file']&&_0x2c36d7[_0x136f('0x57')]['filename']){_0x2c36d7['body']['loginLogo']=_0x2c36d7[_0x136f('0x57')][_0x136f('0x59')];}return db[_0x136f('0x38')][_0x136f('0x54')]({'where':{'id':_0x2c36d7['params']['id']}})[_0x136f('0x19')](handleEntityNotFound(_0x40b005,null))['then'](saveUpdates(_0x2c36d7['body'],null))['then'](respondWithResult(_0x40b005,null))[_0x136f('0x23')](handleError(_0x40b005,null));};var utilLicense=require(_0x136f('0x15'));exports[_0x136f('0x5b')]=function(_0x5111da,_0x2b14a1,_0x509d0b){var _0x5d18de='server/files/images/logos';var _0xcf77b={'custom':![]};return utilLicense[_0x136f('0x5c')]()[_0x136f('0x19')](function(_0x2beb9c){if(_0x2beb9c){_0xcf77b=_0x2beb9c;}return db['Setting'][_0x136f('0x54')]({'where':{'id':_0x5111da[_0x136f('0x53')]['id']},'attributes':['logo',_0x136f('0x5d'),_0x136f('0x5e'),_0x136f('0x5f'),_0x136f('0x60'),_0x136f('0x61'),_0x136f('0x62'),_0x136f('0x63')],'raw':!![]});})[_0x136f('0x19')](handleEntityNotFound(_0x2b14a1,null))[_0x136f('0x19')](function(_0x1f23d9){if(_0x1f23d9){var _0x8fdef2=_0x1f23d9[_0x136f('0x58')]&&fs[_0x136f('0x64')](path['join'](config['root'],_0x5d18de,_[_0x136f('0x65')](_0x1f23d9[_0x136f('0x58')])))?path['join'](config[_0x136f('0x66')],_0x5d18de,_[_0x136f('0x65')](_0x1f23d9[_0x136f('0x58')])):path[_0x136f('0x67')](config[_0x136f('0x66')],_0x5d18de,_[_0x136f('0x65')]('default_logo.svg'));var _0x152188=_0x136f('0x68')+_['upperFirst'](_0x136f('0x58'));if(_0x1f23d9[_0x152188]||!_0xcf77b[_0x136f('0x69')]){_0x8fdef2=path['join'](config[_0x136f('0x66')],_0x5d18de,_[_0x136f('0x65')](_0x136f('0x6a')));}if(!fs['existsSync'](_0x8fdef2)){throw new db[(_0x136f('0x6b'))][(_0x136f('0x6c'))](_[_0x136f('0x6d')](_0x136f('0x58'))+'\x20not\x20found');}return _0x2b14a1[_0x136f('0x6e')](_0x8fdef2);}})[_0x136f('0x23')](handleError(_0x2b14a1,null));};var utilLicense=require(_0x136f('0x15'));exports[_0x136f('0x6f')]=function(_0x20121d,_0x2aa869,_0x3d488a){var _0x29b056=_0x136f('0x70');var _0x45b0ac={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x23467f){if(_0x23467f){_0x45b0ac=_0x23467f;}return db[_0x136f('0x38')][_0x136f('0x54')]({'where':{'id':_0x20121d['params']['id']},'attributes':[_0x136f('0x58'),_0x136f('0x5d'),_0x136f('0x5e'),_0x136f('0x5f'),'defaultLogo',_0x136f('0x61'),_0x136f('0x62'),_0x136f('0x63')],'raw':!![]});})[_0x136f('0x19')](handleEntityNotFound(_0x2aa869,null))[_0x136f('0x19')](function(_0x5e8ae7){if(_0x5e8ae7){var _0x35304d=_0x5e8ae7[_0x136f('0x5d')]&&fs[_0x136f('0x64')](path[_0x136f('0x67')](config['root'],_0x29b056,_[_0x136f('0x65')](_0x5e8ae7[_0x136f('0x5d')])))?path[_0x136f('0x67')](config[_0x136f('0x66')],_0x29b056,_[_0x136f('0x65')](_0x5e8ae7[_0x136f('0x5d')])):path['join'](config['root'],_0x29b056,_[_0x136f('0x65')]('default_loginLogo.svg'));var _0x2b480e='default'+_['upperFirst']('loginLogo');if(_0x5e8ae7[_0x2b480e]||!_0x45b0ac[_0x136f('0x69')]){_0x35304d=path[_0x136f('0x67')](config['root'],_0x29b056,_[_0x136f('0x65')](_0x136f('0x71')));}if(!fs[_0x136f('0x64')](_0x35304d)){throw new db[(_0x136f('0x6b'))][(_0x136f('0x6c'))](_[_0x136f('0x6d')](_0x136f('0x5d'))+_0x136f('0x72'));}return _0x2aa869[_0x136f('0x6e')](_0x35304d);}})['catch'](handleError(_0x2aa869,null));};exports['gdpr']=function(_0x51f737,_0x46b2fb){return db['Setting'][_0x136f('0x54')]({'where':{'id':_0x51f737[_0x136f('0x53')]['id']},'attributes':[_0x136f('0x73')]})[_0x136f('0x19')](respondWithResult(_0x46b2fb,null))['catch'](handleError(_0x46b2fb,null));};exports[_0x136f('0x74')]=function(_0x4b1504,_0x151428,_0x58074e){if(_0x4b1504['file']&&_0x4b1504['file'][_0x136f('0x59')]){_0x4b1504[_0x136f('0x55')]['preferred']=_0x4b1504['file'][_0x136f('0x59')];}return db[_0x136f('0x38')][_0x136f('0x54')]({'where':{'id':_0x4b1504['params']['id']}})[_0x136f('0x19')](handleEntityNotFound(_0x151428,null))[_0x136f('0x19')](saveUpdates(_0x4b1504[_0x136f('0x55')],null))['then'](respondWithResult(_0x151428,null))[_0x136f('0x23')](handleError(_0x151428,null));};var utilLicense=require(_0x136f('0x15'));exports[_0x136f('0x75')]=function(_0x163cc3,_0x4518df,_0x53d2f8){var _0x37ea3e=_0x136f('0x70');var _0x1b83c7={'custom':![]};return utilLicense[_0x136f('0x5c')]()[_0x136f('0x19')](function(_0x112463){if(_0x112463){_0x1b83c7=_0x112463;}return db[_0x136f('0x38')]['find']({'where':{'id':_0x163cc3[_0x136f('0x53')]['id']},'attributes':[_0x136f('0x58'),_0x136f('0x5d'),'preferred',_0x136f('0x5f'),'defaultLogo',_0x136f('0x61'),_0x136f('0x62'),_0x136f('0x63')],'raw':!![]});})[_0x136f('0x19')](handleEntityNotFound(_0x4518df,null))[_0x136f('0x19')](function(_0x5c05bb){if(_0x5c05bb){var _0x333e8a=_0x5c05bb[_0x136f('0x5e')]&&fs[_0x136f('0x64')](path[_0x136f('0x67')](config[_0x136f('0x66')],_0x37ea3e,_[_0x136f('0x65')](_0x5c05bb[_0x136f('0x5e')])))?path[_0x136f('0x67')](config['root'],_0x37ea3e,_[_0x136f('0x65')](_0x5c05bb[_0x136f('0x5e')])):path[_0x136f('0x67')](config[_0x136f('0x66')],_0x37ea3e,_['toLower'](_0x136f('0x76')));var _0x5acd92=_0x136f('0x68')+_[_0x136f('0x6d')](_0x136f('0x5e'));if(_0x5c05bb[_0x5acd92]||!_0x1b83c7['custom']||!_0x1b83c7[_0x136f('0x5e')]){_0x333e8a=path['join'](config[_0x136f('0x66')],_0x37ea3e,_[_0x136f('0x65')](_0x136f('0x76')));}if(!fs[_0x136f('0x64')](_0x333e8a)){throw new db['Sequelize']['ValidationError'](_[_0x136f('0x6d')](_0x136f('0x5e'))+_0x136f('0x72'));}return _0x4518df[_0x136f('0x6e')](_0x333e8a);}})[_0x136f('0x23')](handleError(_0x4518df,null));};exports[_0x136f('0x77')]=function(_0x23d2a6,_0x173848,_0x5bbddb){if(_0x23d2a6[_0x136f('0x57')]&&_0x23d2a6[_0x136f('0x57')][_0x136f('0x59')]){_0x23d2a6[_0x136f('0x55')]['favicon']=_0x23d2a6[_0x136f('0x57')]['filename'];}return db[_0x136f('0x38')][_0x136f('0x54')]({'where':{'id':_0x23d2a6[_0x136f('0x53')]['id']}})['then'](handleEntityNotFound(_0x173848,null))[_0x136f('0x19')](saveUpdates(_0x23d2a6[_0x136f('0x55')],null))[_0x136f('0x19')](respondWithResult(_0x173848,null))[_0x136f('0x23')](handleError(_0x173848,null));};var utilLicense=require('../../config/license/util');exports[_0x136f('0x78')]=function(_0x3fff8b,_0x44160e,_0x529c25){var _0x3613c0=_0x136f('0x70');var _0x2d19a4={'custom':![]};return utilLicense[_0x136f('0x5c')]()[_0x136f('0x19')](function(_0x241b81){if(_0x241b81){_0x2d19a4=_0x241b81;}return db[_0x136f('0x38')][_0x136f('0x54')]({'where':{'id':_0x3fff8b[_0x136f('0x53')]['id']},'attributes':[_0x136f('0x58'),'loginLogo',_0x136f('0x5e'),'favicon',_0x136f('0x60'),_0x136f('0x61'),'defaultPreferred',_0x136f('0x63')],'raw':!![]});})[_0x136f('0x19')](handleEntityNotFound(_0x44160e,null))[_0x136f('0x19')](function(_0x2b9640){if(_0x2b9640){var _0x41211c=_0x2b9640[_0x136f('0x5f')]&&fs['existsSync'](path['join'](config['root'],_0x3613c0,_[_0x136f('0x65')](_0x2b9640[_0x136f('0x5f')])))?path[_0x136f('0x67')](config['root'],_0x3613c0,_[_0x136f('0x65')](_0x2b9640[_0x136f('0x5f')])):path['join'](config['root'],_0x3613c0,_[_0x136f('0x65')]('default_favicon.ico'));var _0x2f789e=_0x136f('0x68')+_['upperFirst'](_0x136f('0x5f'));if(_0x2b9640[_0x2f789e]||!_0x2d19a4[_0x136f('0x69')]){_0x41211c=path[_0x136f('0x67')](config[_0x136f('0x66')],_0x3613c0,_['toLower'](_0x136f('0x79')));}if(!fs[_0x136f('0x64')](_0x41211c)){throw new db[(_0x136f('0x6b'))][(_0x136f('0x6c'))](_[_0x136f('0x6d')](_0x136f('0x5f'))+_0x136f('0x72'));}return _0x44160e[_0x136f('0x6e')](_0x41211c);}})[_0x136f('0x23')](handleError(_0x44160e,null));};exports[_0x136f('0x7a')]=function(_0x29848d,_0x242057){var _0x410be0={'offset':moment()[_0x136f('0x7b')]()};_0x410be0[_0x136f('0x7c')]=moment()['utcOffset'](_0x410be0['offset'])[_0x136f('0x7d')](_0x136f('0x7e'));return _0x242057[_0x136f('0x25')](0xc8)[_0x136f('0x35')](_0x410be0);}; \ No newline at end of file +var _0xcbcc=['hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','keys','find','body','params','addLogo','file','filename','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','root','join','toLower','upperFirst','custom','existsSync','ValidationError','\x20not\x20found','getLogoLogin','favicon','defaultFavicon','default_loginLogo.svg','default','Sequelize','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','status','offset','undefined','limit','set','Content-Range','apply','reject','save','update','send','index','Setting','rawAttributes','type','key','name','query','intersection','attributes','fields','length','model'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcbcc,0x198));var _0xccbc=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xcbcc[_0x344a3f];return _0x264712;};'use strict';var emlformat=require(_0xccbc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xccbc('0x1'));var rp=require(_0xccbc('0x2'));var moment=require('moment');var BPromise=require(_0xccbc('0x3'));var Mustache=require(_0xccbc('0x4'));var util=require(_0xccbc('0x5'));var path=require(_0xccbc('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xccbc('0x7'));var _=require(_0xccbc('0x8'));var squel=require(_0xccbc('0x9'));var crypto=require(_0xccbc('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xccbc('0xb'));var toCsv=require(_0xccbc('0xc'));var querystring=require(_0xccbc('0xd'));var Papa=require('papaparse');var Redis=require(_0xccbc('0xe'));var authService=require(_0xccbc('0xf'));var qs=require(_0xccbc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xccbc('0x11'));var logger=require(_0xccbc('0x12'))(_0xccbc('0x13'));var utils=require(_0xccbc('0x14'));var config=require(_0xccbc('0x15'));var licenseUtil=require(_0xccbc('0x16'));var db=require(_0xccbc('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xccbc('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5f11c7,_0x49323c,_0x36c67a,_0x2aa8f1){return new BPromise(function(_0x4abb18,_0x1c8f8a){var _0x57e803=_0x2aa8f1||client;return _0x57e803[_0xccbc('0x19')](_0x5f11c7,_0x36c67a)[_0xccbc('0x1a')](function(_0x140c1b){logger[_0xccbc('0x1b')](_0xccbc('0x1c'),_0x49323c,_0xccbc('0x1d'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x49323c,_0xccbc('0x1d'),JSON[_0xccbc('0x1e')](_0x140c1b));if(_0x140c1b[_0xccbc('0x1f')]){if(_0x140c1b[_0xccbc('0x1f')]['code']===0x1f4){logger['error'](_0xccbc('0x1c'),_0x49323c,_0x140c1b[_0xccbc('0x1f')][_0xccbc('0x20')]);return _0x1c8f8a(_0x140c1b[_0xccbc('0x1f')][_0xccbc('0x20')]);}logger[_0xccbc('0x1f')](_0xccbc('0x1c'),_0x49323c,_0x140c1b[_0xccbc('0x1f')][_0xccbc('0x20')]);return _0x4abb18(_0x140c1b[_0xccbc('0x1f')][_0xccbc('0x20')]);}else{logger[_0xccbc('0x1b')](_0xccbc('0x1c'),_0x49323c,_0xccbc('0x1d'));_0x4abb18(_0x140c1b[_0xccbc('0x21')]['message']);}})[_0xccbc('0x22')](function(_0x443c23){logger[_0xccbc('0x1f')]('Setting,\x20%s,\x20%s',_0x49323c,_0x443c23);_0x1c8f8a(_0x443c23);});});}function respondWithStatusCode(_0x40ad70,_0x2c089a){_0x2c089a=_0x2c089a||0xcc;return function(_0x4b7326){if(_0x4b7326){return _0x40ad70[_0xccbc('0x23')](_0x2c089a);}return _0x40ad70['status'](_0x2c089a)[_0xccbc('0x24')]();};}function respondWithResult(_0x487d96,_0x49788c){_0x49788c=_0x49788c||0xc8;return function(_0x37868e){if(_0x37868e){return _0x487d96[_0xccbc('0x25')](_0x49788c)['json'](_0x37868e);}};}function respondWithFilteredResult(_0x23e2ee,_0x3b3dec){return function(_0x8cf905){if(_0x8cf905){var _0x147f1b=typeof _0x3b3dec[_0xccbc('0x26')]===_0xccbc('0x27')&&typeof _0x3b3dec[_0xccbc('0x28')]===_0xccbc('0x27');var _0x433895=_0x8cf905['count'];var _0x4540dd=_0x147f1b?0x0:_0x3b3dec[_0xccbc('0x26')];var _0x29dd54=_0x147f1b?_0x8cf905['count']:_0x3b3dec[_0xccbc('0x26')]+_0x3b3dec[_0xccbc('0x28')];var _0x302663;if(_0x29dd54>=_0x433895){_0x29dd54=_0x433895;_0x302663=0xc8;}else{_0x302663=0xce;}_0x23e2ee[_0xccbc('0x25')](_0x302663);return _0x23e2ee[_0xccbc('0x29')](_0xccbc('0x2a'),_0x4540dd+'-'+_0x29dd54+'/'+_0x433895)['json'](_0x8cf905);}return null;};}function patchUpdates(_0x5d15bd){return function(_0xe130f7){try{jsonpatch[_0xccbc('0x2b')](_0xe130f7,_0x5d15bd,!![]);}catch(_0x190edb){return BPromise[_0xccbc('0x2c')](_0x190edb);}return _0xe130f7[_0xccbc('0x2d')]();};}function saveUpdates(_0x6a5655,_0x2b3148){return function(_0x49bdf8){if(_0x49bdf8){return _0x49bdf8[_0xccbc('0x2e')](_0x6a5655)['then'](function(_0x698ff8){return _0x698ff8;});}return null;};}function removeEntity(_0x2f2d24,_0x45f993){return function(_0x54a36f){if(_0x54a36f){return _0x54a36f['destroy']()['then'](function(){_0x2f2d24[_0xccbc('0x25')](0xcc)[_0xccbc('0x24')]();});}};}function handleEntityNotFound(_0x430ab3,_0x5d079){return function(_0x575cac){if(!_0x575cac){_0x430ab3[_0xccbc('0x23')](0x194);}return _0x575cac;};}function handleError(_0x99e334,_0x211f28){_0x211f28=_0x211f28||0x1f4;return function(_0x4b19c6){logger[_0xccbc('0x1f')](_0x4b19c6['stack']);if(_0x4b19c6['name']){delete _0x4b19c6['name'];}_0x99e334[_0xccbc('0x25')](_0x211f28)[_0xccbc('0x2f')](_0x4b19c6);};}exports[_0xccbc('0x30')]=function(_0x2578da,_0x31e06a){var _0x26c35e={},_0x41430f={},_0x15930f={'count':0x0,'rows':[]};var _0xe3fd62=_['map'](db[_0xccbc('0x31')][_0xccbc('0x32')],function(_0x35d480){return{'name':_0x35d480['fieldName'],'type':_0x35d480[_0xccbc('0x33')][_0xccbc('0x34')]};});_0x41430f['model']=_['map'](_0xe3fd62,_0xccbc('0x35'));_0x41430f[_0xccbc('0x36')]=_['keys'](_0x2578da[_0xccbc('0x36')]);_0x41430f['filters']=_[_0xccbc('0x37')](_0x41430f['model'],_0x41430f[_0xccbc('0x36')]);_0x26c35e[_0xccbc('0x38')]=_[_0xccbc('0x37')](_0x41430f['model'],qs[_0xccbc('0x39')](_0x2578da[_0xccbc('0x36')][_0xccbc('0x39')]));_0x26c35e[_0xccbc('0x38')]=_0x26c35e[_0xccbc('0x38')][_0xccbc('0x3a')]?_0x26c35e[_0xccbc('0x38')]:_0x41430f[_0xccbc('0x3b')];if(!_0x2578da[_0xccbc('0x36')][_0xccbc('0x3c')]('nolimit')){_0x26c35e['limit']=qs[_0xccbc('0x28')](_0x2578da[_0xccbc('0x36')][_0xccbc('0x28')]);_0x26c35e[_0xccbc('0x26')]=qs[_0xccbc('0x26')](_0x2578da[_0xccbc('0x36')][_0xccbc('0x26')]);}_0x26c35e['order']=qs[_0xccbc('0x3d')](_0x2578da['query']['sort']);_0x26c35e[_0xccbc('0x3e')]=qs[_0xccbc('0x3f')](_[_0xccbc('0x40')](_0x2578da[_0xccbc('0x36')],_0x41430f[_0xccbc('0x3f')]),_0xe3fd62);if(_0x2578da[_0xccbc('0x36')][_0xccbc('0x41')]){_0x26c35e[_0xccbc('0x3e')]=_[_0xccbc('0x42')](_0x26c35e[_0xccbc('0x3e')],{'$or':_['map'](_0xe3fd62,function(_0x3736a2){if(_0x3736a2[_0xccbc('0x33')]!==_0xccbc('0x43')){var _0x34d639={};_0x34d639[_0x3736a2[_0xccbc('0x35')]]={'$like':'%'+_0x2578da[_0xccbc('0x36')][_0xccbc('0x41')]+'%'};return _0x34d639;}})});}_0x26c35e=_[_0xccbc('0x42')]({},_0x26c35e,_0x2578da[_0xccbc('0x44')]);var _0xd11240={'where':_0x26c35e[_0xccbc('0x3e')]};return db['Setting'][_0xccbc('0x45')](_0xd11240)['then'](function(_0x56eb37){_0x15930f[_0xccbc('0x45')]=_0x56eb37;if(_0x2578da[_0xccbc('0x36')][_0xccbc('0x46')]){_0x26c35e[_0xccbc('0x47')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x26c35e);})[_0xccbc('0x1a')](function(_0x5db585){_0x15930f[_0xccbc('0x48')]=_0x5db585;return _0x15930f;})['then'](respondWithFilteredResult(_0x31e06a,_0x26c35e))['catch'](handleError(_0x31e06a,null));};exports[_0xccbc('0x49')]=function(_0x3da18f,_0x428ecb){var _0x4fd49b={'raw':![],'where':{'id':_0x3da18f['params']['id']}},_0x144f0a={};_0x144f0a[_0xccbc('0x3b')]=_[_0xccbc('0x4a')](db[_0xccbc('0x31')]['rawAttributes']);_0x144f0a['query']=_[_0xccbc('0x4a')](_0x3da18f[_0xccbc('0x36')]);_0x144f0a[_0xccbc('0x3f')]=_[_0xccbc('0x37')](_0x144f0a[_0xccbc('0x3b')],_0x144f0a[_0xccbc('0x36')]);_0x4fd49b[_0xccbc('0x38')]=_[_0xccbc('0x37')](_0x144f0a[_0xccbc('0x3b')],qs[_0xccbc('0x39')](_0x3da18f['query']['fields']));_0x4fd49b['attributes']=_0x4fd49b[_0xccbc('0x38')]['length']?_0x4fd49b[_0xccbc('0x38')]:_0x144f0a[_0xccbc('0x3b')];if(_0x3da18f[_0xccbc('0x36')][_0xccbc('0x46')]){_0x4fd49b[_0xccbc('0x47')]=[{'all':!![]}];}_0x4fd49b=_[_0xccbc('0x42')]({},_0x4fd49b,_0x3da18f['options']);return db[_0xccbc('0x31')][_0xccbc('0x4b')](_0x4fd49b)[_0xccbc('0x1a')](handleEntityNotFound(_0x428ecb,null))[_0xccbc('0x1a')](respondWithResult(_0x428ecb,null))[_0xccbc('0x22')](handleError(_0x428ecb,null));};exports[_0xccbc('0x2e')]=function(_0x1bd89d,_0x339418){if(_0x1bd89d[_0xccbc('0x4c')]['id']){delete _0x1bd89d['body']['id'];}return db['Setting']['find']({'where':{'id':_0x1bd89d[_0xccbc('0x4d')]['id']}})[_0xccbc('0x1a')](handleEntityNotFound(_0x339418,null))['then'](saveUpdates(_0x1bd89d[_0xccbc('0x4c')],null))['then'](respondWithResult(_0x339418,null))[_0xccbc('0x22')](handleError(_0x339418,null));};exports[_0xccbc('0x4e')]=function(_0x4c5fd8,_0x3785b6,_0xd703c2){if(_0x4c5fd8[_0xccbc('0x4f')]&&_0x4c5fd8['file'][_0xccbc('0x50')]){_0x4c5fd8[_0xccbc('0x4c')]['logo']=_0x4c5fd8[_0xccbc('0x4f')][_0xccbc('0x50')];}return db[_0xccbc('0x31')][_0xccbc('0x4b')]({'where':{'id':_0x4c5fd8[_0xccbc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3785b6,null))['then'](saveUpdates(_0x4c5fd8[_0xccbc('0x4c')],null))[_0xccbc('0x1a')](respondWithResult(_0x3785b6,null))[_0xccbc('0x22')](handleError(_0x3785b6,null));};exports['addLogoLogin']=function(_0x2dcb44,_0x189923,_0x4dcc4a){if(_0x2dcb44['file']&&_0x2dcb44[_0xccbc('0x4f')][_0xccbc('0x50')]){_0x2dcb44['body'][_0xccbc('0x51')]=_0x2dcb44['file'][_0xccbc('0x50')];}return db[_0xccbc('0x31')][_0xccbc('0x4b')]({'where':{'id':_0x2dcb44[_0xccbc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x189923,null))[_0xccbc('0x1a')](saveUpdates(_0x2dcb44[_0xccbc('0x4c')],null))['then'](respondWithResult(_0x189923,null))['catch'](handleError(_0x189923,null));};var utilLicense=require(_0xccbc('0x16'));exports[_0xccbc('0x52')]=function(_0x18e32d,_0x2e4452,_0x57de41){var _0x24eea2=_0xccbc('0x53');var _0x5dee45={'custom':![]};return utilLicense[_0xccbc('0x54')]()[_0xccbc('0x1a')](function(_0x470d88){if(_0x470d88){_0x5dee45=_0x470d88;}return db['Setting'][_0xccbc('0x4b')]({'where':{'id':_0x18e32d[_0xccbc('0x4d')]['id']},'attributes':[_0xccbc('0x55'),_0xccbc('0x51'),_0xccbc('0x56'),'favicon',_0xccbc('0x57'),_0xccbc('0x58'),_0xccbc('0x59'),'defaultFavicon'],'raw':!![]});})[_0xccbc('0x1a')](handleEntityNotFound(_0x2e4452,null))[_0xccbc('0x1a')](function(_0x104de2){if(_0x104de2){var _0x430df9=_0x104de2[_0xccbc('0x55')]&&fs['existsSync'](path['join'](config[_0xccbc('0x5a')],_0x24eea2,_['toLower'](_0x104de2[_0xccbc('0x55')])))?path[_0xccbc('0x5b')](config[_0xccbc('0x5a')],_0x24eea2,_[_0xccbc('0x5c')](_0x104de2['logo'])):path[_0xccbc('0x5b')](config[_0xccbc('0x5a')],_0x24eea2,_[_0xccbc('0x5c')]('default_logo.svg'));var _0x3c5762='default'+_[_0xccbc('0x5d')](_0xccbc('0x55'));if(_0x104de2[_0x3c5762]||!_0x5dee45[_0xccbc('0x5e')]){_0x430df9=path['join'](config[_0xccbc('0x5a')],_0x24eea2,_[_0xccbc('0x5c')]('default_logo.svg'));}if(!fs[_0xccbc('0x5f')](_0x430df9)){throw new db['Sequelize'][(_0xccbc('0x60'))](_[_0xccbc('0x5d')](_0xccbc('0x55'))+_0xccbc('0x61'));}return _0x2e4452['download'](_0x430df9);}})['catch'](handleError(_0x2e4452,null));};var utilLicense=require(_0xccbc('0x16'));exports[_0xccbc('0x62')]=function(_0xef5a12,_0x354c11,_0x2ffb8f){var _0x1a91bb=_0xccbc('0x53');var _0x4eb9b9={'custom':![]};return utilLicense[_0xccbc('0x54')]()[_0xccbc('0x1a')](function(_0xdb3a99){if(_0xdb3a99){_0x4eb9b9=_0xdb3a99;}return db['Setting'][_0xccbc('0x4b')]({'where':{'id':_0xef5a12[_0xccbc('0x4d')]['id']},'attributes':[_0xccbc('0x55'),_0xccbc('0x51'),'preferred',_0xccbc('0x63'),_0xccbc('0x57'),_0xccbc('0x58'),_0xccbc('0x59'),_0xccbc('0x64')],'raw':!![]});})[_0xccbc('0x1a')](handleEntityNotFound(_0x354c11,null))[_0xccbc('0x1a')](function(_0x2c23c2){if(_0x2c23c2){var _0x530a2a=_0x2c23c2[_0xccbc('0x51')]&&fs[_0xccbc('0x5f')](path['join'](config[_0xccbc('0x5a')],_0x1a91bb,_[_0xccbc('0x5c')](_0x2c23c2[_0xccbc('0x51')])))?path[_0xccbc('0x5b')](config[_0xccbc('0x5a')],_0x1a91bb,_[_0xccbc('0x5c')](_0x2c23c2['loginLogo'])):path[_0xccbc('0x5b')](config[_0xccbc('0x5a')],_0x1a91bb,_[_0xccbc('0x5c')](_0xccbc('0x65')));var _0x3b1481=_0xccbc('0x66')+_[_0xccbc('0x5d')](_0xccbc('0x51'));if(_0x2c23c2[_0x3b1481]||!_0x4eb9b9[_0xccbc('0x5e')]){_0x530a2a=path[_0xccbc('0x5b')](config[_0xccbc('0x5a')],_0x1a91bb,_[_0xccbc('0x5c')](_0xccbc('0x65')));}if(!fs[_0xccbc('0x5f')](_0x530a2a)){throw new db[(_0xccbc('0x67'))][(_0xccbc('0x60'))](_[_0xccbc('0x5d')](_0xccbc('0x51'))+'\x20not\x20found');}return _0x354c11[_0xccbc('0x68')](_0x530a2a);}})[_0xccbc('0x22')](handleError(_0x354c11,null));};exports[_0xccbc('0x69')]=function(_0x5248a6,_0x2db480){return db[_0xccbc('0x31')]['find']({'where':{'id':_0x5248a6[_0xccbc('0x4d')]['id']},'attributes':[_0xccbc('0x6a')]})['then'](respondWithResult(_0x2db480,null))[_0xccbc('0x22')](handleError(_0x2db480,null));};exports[_0xccbc('0x6b')]=function(_0x57808e,_0x307b57,_0x54d911){if(_0x57808e[_0xccbc('0x4f')]&&_0x57808e['file'][_0xccbc('0x50')]){_0x57808e[_0xccbc('0x4c')][_0xccbc('0x56')]=_0x57808e[_0xccbc('0x4f')][_0xccbc('0x50')];}return db[_0xccbc('0x31')][_0xccbc('0x4b')]({'where':{'id':_0x57808e[_0xccbc('0x4d')]['id']}})[_0xccbc('0x1a')](handleEntityNotFound(_0x307b57,null))[_0xccbc('0x1a')](saveUpdates(_0x57808e[_0xccbc('0x4c')],null))[_0xccbc('0x1a')](respondWithResult(_0x307b57,null))[_0xccbc('0x22')](handleError(_0x307b57,null));};var utilLicense=require('../../config/license/util');exports[_0xccbc('0x6c')]=function(_0x4c0c4c,_0x1ce89e,_0x599ca5){var _0x28cc81=_0xccbc('0x53');var _0x19073b={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x38a672){if(_0x38a672){_0x19073b=_0x38a672;}return db['Setting'][_0xccbc('0x4b')]({'where':{'id':_0x4c0c4c['params']['id']},'attributes':[_0xccbc('0x55'),'loginLogo',_0xccbc('0x56'),_0xccbc('0x63'),_0xccbc('0x57'),'defaultLoginLogo','defaultPreferred',_0xccbc('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x1ce89e,null))[_0xccbc('0x1a')](function(_0x1c5526){if(_0x1c5526){var _0x4d98da=_0x1c5526[_0xccbc('0x56')]&&fs['existsSync'](path[_0xccbc('0x5b')](config[_0xccbc('0x5a')],_0x28cc81,_['toLower'](_0x1c5526[_0xccbc('0x56')])))?path['join'](config[_0xccbc('0x5a')],_0x28cc81,_[_0xccbc('0x5c')](_0x1c5526[_0xccbc('0x56')])):path[_0xccbc('0x5b')](config[_0xccbc('0x5a')],_0x28cc81,_[_0xccbc('0x5c')]('default_preferred.png'));var _0x4acc7b='default'+_['upperFirst'](_0xccbc('0x56'));if(_0x1c5526[_0x4acc7b]||!_0x19073b['custom']||!_0x19073b[_0xccbc('0x56')]){_0x4d98da=path['join'](config[_0xccbc('0x5a')],_0x28cc81,_[_0xccbc('0x5c')](_0xccbc('0x6d')));}if(!fs['existsSync'](_0x4d98da)){throw new db[(_0xccbc('0x67'))][(_0xccbc('0x60'))](_[_0xccbc('0x5d')](_0xccbc('0x56'))+_0xccbc('0x61'));}return _0x1ce89e[_0xccbc('0x68')](_0x4d98da);}})['catch'](handleError(_0x1ce89e,null));};exports[_0xccbc('0x6e')]=function(_0x6e245b,_0x2bcef9,_0x2a3ef8){if(_0x6e245b['file']&&_0x6e245b['file']['filename']){_0x6e245b[_0xccbc('0x4c')]['favicon']=_0x6e245b[_0xccbc('0x4f')][_0xccbc('0x50')];}return db[_0xccbc('0x31')][_0xccbc('0x4b')]({'where':{'id':_0x6e245b[_0xccbc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2bcef9,null))[_0xccbc('0x1a')](saveUpdates(_0x6e245b[_0xccbc('0x4c')],null))['then'](respondWithResult(_0x2bcef9,null))['catch'](handleError(_0x2bcef9,null));};var utilLicense=require(_0xccbc('0x16'));exports['getFavicon']=function(_0x355ad6,_0xddf43a,_0x4869b5){var _0x324012=_0xccbc('0x53');var _0x48187b={'custom':![]};return utilLicense[_0xccbc('0x54')]()[_0xccbc('0x1a')](function(_0x28a072){if(_0x28a072){_0x48187b=_0x28a072;}return db['Setting'][_0xccbc('0x4b')]({'where':{'id':_0x355ad6['params']['id']},'attributes':[_0xccbc('0x55'),'loginLogo','preferred','favicon','defaultLogo',_0xccbc('0x58'),_0xccbc('0x59'),_0xccbc('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0xddf43a,null))['then'](function(_0x328eb2){if(_0x328eb2){var _0x15e6a9=_0x328eb2['favicon']&&fs[_0xccbc('0x5f')](path[_0xccbc('0x5b')](config[_0xccbc('0x5a')],_0x324012,_[_0xccbc('0x5c')](_0x328eb2['favicon'])))?path[_0xccbc('0x5b')](config[_0xccbc('0x5a')],_0x324012,_[_0xccbc('0x5c')](_0x328eb2[_0xccbc('0x63')])):path[_0xccbc('0x5b')](config[_0xccbc('0x5a')],_0x324012,_[_0xccbc('0x5c')](_0xccbc('0x6f')));var _0x12f712=_0xccbc('0x66')+_['upperFirst'](_0xccbc('0x63'));if(_0x328eb2[_0x12f712]||!_0x48187b[_0xccbc('0x5e')]){_0x15e6a9=path['join'](config[_0xccbc('0x5a')],_0x324012,_['toLower'](_0xccbc('0x6f')));}if(!fs['existsSync'](_0x15e6a9)){throw new db[(_0xccbc('0x67'))][(_0xccbc('0x60'))](_['upperFirst'](_0xccbc('0x63'))+_0xccbc('0x61'));}return _0xddf43a[_0xccbc('0x68')](_0x15e6a9);}})[_0xccbc('0x22')](handleError(_0xddf43a,null));};exports[_0xccbc('0x70')]=function(_0x33d0b6,_0x389cb5){var _0x9e375={'offset':moment()[_0xccbc('0x71')]()};_0x9e375[_0xccbc('0x72')]=moment()['utcOffset'](_0x9e375[_0xccbc('0x26')])[_0xccbc('0x73')](_0xccbc('0x74'));return _0x389cb5[_0xccbc('0x25')](0xc8)['send'](_0x9e375);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 1767650..25d196c 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(_0x5a2d3f,_0x27b04e){var _0x5c65d8=function(_0x2d1965){while(--_0x2d1965){_0x5a2d3f['push'](_0x5a2d3f['shift']());}};_0x5c65d8(++_0x27b04e);}(_0x55ca,0x126));var _0xa55c=function(_0x4d593e,_0x131776){_0x4d593e=_0x4d593e-0x0;var _0x31e2df=_0x55ca[_0x4d593e];return _0x31e2df;};'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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x48ddb8,_0xa3bd0f){var _0x580372=function(_0x493c0e){while(--_0x493c0e){_0x48ddb8['push'](_0x48ddb8['shift']());}};_0x580372(++_0xa3bd0f);}(_0xedd9,0xfc));var _0x9edd=function(_0x3e1ffb,_0x16d000){_0x3e1ffb=_0x3e1ffb-0x0;var _0x4a28c6=_0xedd9[_0x3e1ffb];return _0x4a28c6;};'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':'settings','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 a06004d..4047c00 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 _0x2425=['include','map','model','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSetting','Setting','options','raw','where','attributes'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2425,0x16c));var _0x5242=function(_0x5d2415,_0x52ca09){_0x5d2415=_0x5d2415-0x0;var _0xdcfd1e=_0x2425[_0x5d2415];return _0xdcfd1e;};'use strict';var _=require('lodash');var util=require(_0x5242('0x0'));var moment=require(_0x5242('0x1'));var BPromise=require(_0x5242('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5242('0x3'));var db=require(_0x5242('0x4'))['db'];var utils=require(_0x5242('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5242('0x6'));var jayson=require(_0x5242('0x7'));var client=jayson[_0x5242('0x8')][_0x5242('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4549f3,_0x4b81a5,_0x54221){return new BPromise(function(_0x2bd6aa,_0x2cc979){return client['request'](_0x4549f3,_0x54221)['then'](function(_0x3ef8b4){logger[_0x5242('0xa')](_0x5242('0xb'),_0x4b81a5,_0x5242('0xc'));logger[_0x5242('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x4b81a5,_0x5242('0xc'),JSON[_0x5242('0xe')](_0x3ef8b4));if(_0x3ef8b4[_0x5242('0xf')]){if(_0x3ef8b4['error'][_0x5242('0x10')]===0x1f4){logger[_0x5242('0xf')](_0x5242('0xb'),_0x4b81a5,_0x3ef8b4[_0x5242('0xf')][_0x5242('0x11')]);return _0x2cc979(_0x3ef8b4[_0x5242('0xf')][_0x5242('0x11')]);}logger[_0x5242('0xf')](_0x5242('0xb'),_0x4b81a5,_0x3ef8b4[_0x5242('0xf')][_0x5242('0x11')]);return _0x2bd6aa(_0x3ef8b4[_0x5242('0xf')][_0x5242('0x11')]);}else{logger[_0x5242('0xa')](_0x5242('0xb'),_0x4b81a5,_0x5242('0xc'));_0x2bd6aa(_0x3ef8b4[_0x5242('0x12')][_0x5242('0x11')]);}})[_0x5242('0x13')](function(_0x53058b){logger[_0x5242('0xf')]('Setting,\x20%s,\x20%s',_0x4b81a5,_0x53058b);_0x2cc979(_0x53058b);});});}exports[_0x5242('0x14')]=function(_0x27395f){var _0x50e769=this;return new Promise(function(_0x47bf1d,_0x14f317){return db[_0x5242('0x15')]['find']({'raw':_0x27395f[_0x5242('0x16')]?_0x27395f[_0x5242('0x16')][_0x5242('0x17')]===undefined?!![]:![]:!![],'where':_0x27395f[_0x5242('0x16')]?_0x27395f['options'][_0x5242('0x18')]||null:null,'attributes':_0x27395f[_0x5242('0x16')]?_0x27395f[_0x5242('0x16')][_0x5242('0x19')]||null:null,'include':_0x27395f['options']?_0x27395f[_0x5242('0x16')][_0x5242('0x1a')]?_[_0x5242('0x1b')](_0x27395f[_0x5242('0x16')][_0x5242('0x1a')],function(_0x25ab97){return{'model':db[_0x25ab97[_0x5242('0x1c')]],'as':_0x25ab97['as'],'attributes':_0x25ab97[_0x5242('0x19')],'include':_0x25ab97['include']?_[_0x5242('0x1b')](_0x25ab97[_0x5242('0x1a')],function(_0x7dbe59){return{'model':db[_0x7dbe59[_0x5242('0x1c')]],'as':_0x7dbe59['as'],'attributes':_0x7dbe59[_0x5242('0x19')],'include':_0x7dbe59[_0x5242('0x1a')]?_['map'](_0x7dbe59[_0x5242('0x1a')],function(_0x981a84){return{'model':db[_0x981a84['model']],'as':_0x981a84['as'],'attributes':_0x981a84[_0x5242('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5242('0x1d')](function(_0x51c85d){logger[_0x5242('0xa')](_0x5242('0x14'),_0x27395f);logger[_0x5242('0xd')](_0x5242('0x14'),_0x27395f,JSON[_0x5242('0xe')](_0x51c85d));_0x47bf1d(_0x51c85d);})[_0x5242('0x13')](function(_0x2e530e){logger[_0x5242('0xf')](_0x5242('0x14'),_0x2e530e[_0x5242('0x11')],_0x27395f);_0x14f317(_0x50e769['error'](0x1f4,_0x2e530e[_0x5242('0x11')]));});});}; \ No newline at end of file +var _0x5552=['info','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','options','include','map','model','attributes'];(function(_0x15797a,_0x16274f){var _0x3e2618=function(_0x2b6e99){while(--_0x2b6e99){_0x15797a['push'](_0x15797a['shift']());}};_0x3e2618(++_0x16274f);}(_0x5552,0x196));var _0x2555=function(_0x3ed199,_0x478c6d){_0x3ed199=_0x3ed199-0x0;var _0x31adb8=_0x5552[_0x3ed199];return _0x31adb8;};'use strict';var _=require(_0x2555('0x0'));var util=require(_0x2555('0x1'));var moment=require(_0x2555('0x2'));var BPromise=require(_0x2555('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2555('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2555('0x5'));var logger=require('../../config/logger')(_0x2555('0x6'));var config=require('../../config/environment');var jayson=require(_0x2555('0x7'));var client=jayson[_0x2555('0x8')][_0x2555('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d8318,_0xb0785c,_0x461b8f){return new BPromise(function(_0x2b0386,_0x532c54){return client['request'](_0x4d8318,_0x461b8f)[_0x2555('0xa')](function(_0x46bfba){logger['info']('Setting,\x20%s,\x20%s',_0xb0785c,_0x2555('0xb'));logger[_0x2555('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0xb0785c,_0x2555('0xb'),JSON[_0x2555('0xd')](_0x46bfba));if(_0x46bfba[_0x2555('0xe')]){if(_0x46bfba[_0x2555('0xe')][_0x2555('0xf')]===0x1f4){logger['error'](_0x2555('0x10'),_0xb0785c,_0x46bfba[_0x2555('0xe')]['message']);return _0x532c54(_0x46bfba['error'][_0x2555('0x11')]);}logger[_0x2555('0xe')](_0x2555('0x10'),_0xb0785c,_0x46bfba[_0x2555('0xe')][_0x2555('0x11')]);return _0x2b0386(_0x46bfba[_0x2555('0xe')][_0x2555('0x11')]);}else{logger['info'](_0x2555('0x10'),_0xb0785c,_0x2555('0xb'));_0x2b0386(_0x46bfba[_0x2555('0x12')][_0x2555('0x11')]);}})[_0x2555('0x13')](function(_0x1f1b36){logger['error'](_0x2555('0x10'),_0xb0785c,_0x1f1b36);_0x532c54(_0x1f1b36);});});}exports[_0x2555('0x14')]=function(_0x4118d2){var _0x4f94e3=this;return new Promise(function(_0x4fa369,_0x40e219){return db['Setting']['find']({'raw':_0x4118d2[_0x2555('0x15')]?_0x4118d2[_0x2555('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4118d2[_0x2555('0x15')]?_0x4118d2['options']['where']||null:null,'attributes':_0x4118d2[_0x2555('0x15')]?_0x4118d2[_0x2555('0x15')]['attributes']||null:null,'include':_0x4118d2[_0x2555('0x15')]?_0x4118d2[_0x2555('0x15')][_0x2555('0x16')]?_[_0x2555('0x17')](_0x4118d2[_0x2555('0x15')][_0x2555('0x16')],function(_0x59f5b7){return{'model':db[_0x59f5b7[_0x2555('0x18')]],'as':_0x59f5b7['as'],'attributes':_0x59f5b7['attributes'],'include':_0x59f5b7[_0x2555('0x16')]?_[_0x2555('0x17')](_0x59f5b7[_0x2555('0x16')],function(_0x585fc3){return{'model':db[_0x585fc3[_0x2555('0x18')]],'as':_0x585fc3['as'],'attributes':_0x585fc3[_0x2555('0x19')],'include':_0x585fc3['include']?_[_0x2555('0x17')](_0x585fc3[_0x2555('0x16')],function(_0x3cd0be){return{'model':db[_0x3cd0be[_0x2555('0x18')]],'as':_0x3cd0be['as'],'attributes':_0x3cd0be[_0x2555('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2555('0xa')](function(_0x4f793c){logger[_0x2555('0x1a')](_0x2555('0x14'),_0x4118d2);logger[_0x2555('0xc')](_0x2555('0x14'),_0x4118d2,JSON[_0x2555('0xd')](_0x4f793c));_0x4fa369(_0x4f793c);})[_0x2555('0x13')](function(_0xe69cd){logger['error'](_0x2555('0x14'),_0xe69cd[_0x2555('0x11')],_0x4118d2);_0x40e219(_0x4f94e3['error'](0x1f4,_0xe69cd[_0x2555('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 84284ae..7b4c091 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 _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x330b84,_0x4f60bf){var _0x34c611=function(_0x1d24da){while(--_0x1d24da){_0x330b84['push'](_0x330b84['shift']());}};_0x34c611(++_0x4f60bf);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xc4aa[_0x2235bf];return _0x4c3a64;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file +var _0x5fc3=['/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getInteractions','/:id/status','statusGet','post','create','/:id/dispositions','addAnswer','/:id/notify','/:id/send','send','status','/:id/users','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','describe'];(function(_0x21c20c,_0x492b8c){var _0x11475f=function(_0xb81a1c){while(--_0xb81a1c){_0x21c20c['push'](_0x21c20c['shift']());}};_0x11475f(++_0x492b8c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x228ac9,_0x42f065){_0x228ac9=_0x228ac9-0x0;var _0x69fe02=_0x5fc3[_0x228ac9];return _0x69fe02;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/dispositions',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getAnswers']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0x35fc('0x9')]('/:id/interactions',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router[_0x35fc('0x9')](_0x35fc('0x12'),controller[_0x35fc('0x13')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x14')]('/',auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x14')](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller['addDisposition']);router[_0x35fc('0x14')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x14')](_0x35fc('0x18'),controller['notify']);router[_0x35fc('0x14')](_0x35fc('0x10'),auth[_0x35fc('0xa')](),controller['addApplications']);router[_0x35fc('0x14')](_0x35fc('0x19'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1a')]);router[_0x35fc('0x14')](_0x35fc('0x12'),controller[_0x35fc('0x1b')]);router[_0x35fc('0x14')](_0x35fc('0x1c'),auth[_0x35fc('0xa')](),controller['addAgents']);router[_0x35fc('0x1d')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1e')]);router[_0x35fc('0x1f')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x20')]);router['delete'](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x21')]);router['delete'](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x22')]);router[_0x35fc('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x35fc('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index eb2b954..585c009 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 _0x68c6=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','STRING','name','skebby','connectel','clicksend','clickatell','bandwidth','infobip','intelepeer','ENUM','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x68c6,0x1cb));var _0x668c=function(_0x58675f,_0x390355){_0x58675f=_0x58675f-0x0;var _0x1cc7f0=_0x68c6[_0x58675f];return _0x1cc7f0;};'use strict';var Sequelize=require(_0x668c('0x0'));var rs=require(_0x668c('0x1'));module['exports']={'name':{'type':Sequelize[_0x668c('0x2')],'unique':_0x668c('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x668c('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x668c('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x668c('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x668c('0x2')]},'type':{'type':Sequelize['ENUM']('twilio',_0x668c('0x4'),_0x668c('0x5'),_0x668c('0x6'),'plivo',_0x668c('0x7'),_0x668c('0x8'),'csc',_0x668c('0x9'),_0x668c('0xa'))},'accountSid':{'type':Sequelize[_0x668c('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x668c('0x2')]},'smsMethod':{'type':Sequelize[_0x668c('0xb')]('SI','TI','GP')},'username':{'type':Sequelize[_0x668c('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x668c('0x2')]},'accountId':{'type':Sequelize[_0x668c('0x2')]},'senderString':{'type':Sequelize[_0x668c('0x2')]},'deliveryReport':{'type':Sequelize[_0x668c('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x668c('0x2')]},'notificationTemplate':{'type':Sequelize[_0x668c('0xd')],'defaultValue':function(){return _0x668c('0xe');}},'notificationSound':{'type':Sequelize[_0x668c('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x668c('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x668c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x668c('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x668c('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x668c('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x668c('0xf')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x668c('0xc')],'defaultValue':![],'comment':_0x668c('0x10'),'set':function(_0x37a508){if(!_0x37a508)this[_0x668c('0x11')](_0x668c('0x12'),null);this['setDataValue']('mandatoryDisposition',_0x37a508);}}}; \ No newline at end of file +var _0x4736=['mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','bandwidth','csc','infobip','BOOLEAN','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'];(function(_0x4f22c2,_0x2a47c2){var _0x3563bf=function(_0x59332c){while(--_0x59332c){_0x4f22c2['push'](_0x4f22c2['shift']());}};_0x3563bf(++_0x2a47c2);}(_0x4736,0xc9));var _0x6473=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4736[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6473('0x0'));var rs=require(_0x6473('0x1'));module[_0x6473('0x2')]={'name':{'type':Sequelize[_0x6473('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x6473('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x6473('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x6473('0x3')],'defaultValue':function(){return rs[_0x6473('0x4')]();}},'phone':{'type':Sequelize[_0x6473('0x3')]},'type':{'type':Sequelize[_0x6473('0x5')](_0x6473('0x6'),_0x6473('0x7'),_0x6473('0x8'),_0x6473('0x9'),_0x6473('0xa'),'clickatell',_0x6473('0xb'),_0x6473('0xc'),_0x6473('0xd'),'intelepeer')},'accountSid':{'type':Sequelize[_0x6473('0x3')]},'authId':{'type':Sequelize[_0x6473('0x3')]},'authToken':{'type':Sequelize[_0x6473('0x3')]},'smsMethod':{'type':Sequelize[_0x6473('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x6473('0x3')]},'password':{'type':Sequelize[_0x6473('0x3')]},'apiKey':{'type':Sequelize[_0x6473('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x6473('0x3')]},'deliveryReport':{'type':Sequelize[_0x6473('0xe')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6473('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6473('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6473('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6473('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6473('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6473('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x6473('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6473('0x10')],'comment':_0x6473('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x6473('0xe')],'defaultValue':![],'comment':_0x6473('0x12'),'set':function(_0x422fb4){if(!_0x422fb4)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x6473('0x13'),_0x422fb4);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 9358fb6..bb3a265 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 _0xd965=['createdAt','updatedAt','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','clicksend','plivo','Text','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','Sequelize','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','CmList','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','spread','interaction','created','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','SmsApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','fullname','Tag','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','connectel','requestid','statusInt','status_code','message_id','groupName','bandwidth','redif','DELIVERED','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','csc','state','addAgents','ids','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','socket.io-emitter','redis','./smsAccount.socket','register','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsAccount','includeAll','include','findAll','rows','show','params','keys','find','create','role','user','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','findOne','SmsAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','Applications','account','applications','orderBy','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','difference'];(function(_0x2a5b24,_0xdb5e9b){var _0x19d021=function(_0x3604fd){while(--_0x3604fd){_0x2a5b24['push'](_0x2a5b24['shift']());}};_0x19d021(++_0xdb5e9b);}(_0xd965,0x151));var _0x5d96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd965[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5d96('0x0'));var rimraf=require(_0x5d96('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5d96('0x2'));var BPromise=require(_0x5d96('0x3'));var Mustache=require(_0x5d96('0x4'));var util=require(_0x5d96('0x5'));var path=require(_0x5d96('0x6'));var sox=require('sox');var csv=require(_0x5d96('0x7'));var ejs=require(_0x5d96('0x8'));var fs=require('fs');var fs_extra=require(_0x5d96('0x9'));var _=require(_0x5d96('0xa'));var squel=require(_0x5d96('0xb'));var crypto=require('crypto');var jsforce=require(_0x5d96('0xc'));var deskjs=require(_0x5d96('0xd'));var toCsv=require(_0x5d96('0x7'));var querystring=require(_0x5d96('0xe'));var Papa=require(_0x5d96('0xf'));var Redis=require(_0x5d96('0x10'));var authService=require(_0x5d96('0x11'));var qs=require(_0x5d96('0x12'));var as=require(_0x5d96('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d96('0x14'))('api');var utils=require(_0x5d96('0x15'));var config=require(_0x5d96('0x16'));var licenseUtil=require(_0x5d96('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5d96('0x18'))(new Redis(config[_0x5d96('0x19')]));require(_0x5d96('0x1a'))[_0x5d96('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5d96('0x1c')][_0x5d96('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x8de9f3,_0x3f6186,_0x1e90d5,_0x57c9d2){return new BPromise(function(_0x4cb730,_0x2c7728){var _0x34c220=_0x57c9d2||client;return _0x34c220[_0x5d96('0x1e')](_0x8de9f3,_0x1e90d5)['then'](function(_0x19d8fb){logger[_0x5d96('0x1f')](_0x5d96('0x20'),_0x3f6186,_0x5d96('0x21'));logger[_0x5d96('0x22')](_0x5d96('0x23'),_0x3f6186,'request\x20sent',JSON[_0x5d96('0x24')](_0x19d8fb));if(_0x19d8fb[_0x5d96('0x25')]){if(_0x19d8fb[_0x5d96('0x25')]['code']===0x1f4){logger[_0x5d96('0x25')](_0x5d96('0x20'),_0x3f6186,_0x19d8fb['error'][_0x5d96('0x26')]);return _0x2c7728(_0x19d8fb[_0x5d96('0x25')][_0x5d96('0x26')]);}logger[_0x5d96('0x25')](_0x5d96('0x20'),_0x3f6186,_0x19d8fb[_0x5d96('0x25')][_0x5d96('0x26')]);return _0x4cb730(_0x19d8fb[_0x5d96('0x25')]['message']);}else{logger['info'](_0x5d96('0x20'),_0x3f6186,_0x5d96('0x21'));_0x4cb730(_0x19d8fb[_0x5d96('0x27')]['message']);}})[_0x5d96('0x28')](function(_0x56cebe){logger[_0x5d96('0x25')](_0x5d96('0x20'),_0x3f6186,_0x56cebe);_0x2c7728(_0x56cebe);});});}function respondWithStatusCode(_0x138664,_0x4ebadc){_0x4ebadc=_0x4ebadc||0xcc;return function(_0x48620b){if(_0x48620b){return _0x138664[_0x5d96('0x29')](_0x4ebadc);}return _0x138664[_0x5d96('0x2a')](_0x4ebadc)[_0x5d96('0x2b')]();};}function respondWithResult(_0x5da8b4,_0x1b7e0a){_0x1b7e0a=_0x1b7e0a||0xc8;return function(_0x45f6b7){if(_0x45f6b7){return _0x5da8b4[_0x5d96('0x2a')](_0x1b7e0a)[_0x5d96('0x2c')](_0x45f6b7);}};}function respondWithFilteredResult(_0x33ef68,_0x497ba8){return function(_0x5bdd5f){if(_0x5bdd5f){var _0x35b510=typeof _0x497ba8['offset']===_0x5d96('0x2d')&&typeof _0x497ba8[_0x5d96('0x2e')]===_0x5d96('0x2d');var _0xc90e2=_0x5bdd5f[_0x5d96('0x2f')];var _0x4a71eb=_0x35b510?0x0:_0x497ba8[_0x5d96('0x30')];var _0x1a4068=_0x35b510?_0x5bdd5f['count']:_0x497ba8[_0x5d96('0x30')]+_0x497ba8[_0x5d96('0x2e')];var _0x2397e9;if(_0x1a4068>=_0xc90e2){_0x1a4068=_0xc90e2;_0x2397e9=0xc8;}else{_0x2397e9=0xce;}_0x33ef68[_0x5d96('0x2a')](_0x2397e9);return _0x33ef68[_0x5d96('0x31')](_0x5d96('0x32'),_0x4a71eb+'-'+_0x1a4068+'/'+_0xc90e2)[_0x5d96('0x2c')](_0x5bdd5f);}return null;};}function patchUpdates(_0x34fe4c){return function(_0x22d701){try{jsonpatch[_0x5d96('0x33')](_0x22d701,_0x34fe4c,!![]);}catch(_0x1f533a){return BPromise[_0x5d96('0x34')](_0x1f533a);}return _0x22d701['save']();};}function saveUpdates(_0x1472f8,_0x105b81){return function(_0x3d2b7a){if(_0x3d2b7a){return _0x3d2b7a[_0x5d96('0x35')](_0x1472f8)[_0x5d96('0x36')](function(_0x49952d){return _0x49952d;});}return null;};}function removeEntity(_0xd73df7,_0x40bbca){return function(_0x47ac66){if(_0x47ac66){return _0x47ac66[_0x5d96('0x37')]()[_0x5d96('0x36')](function(){var _0x2a417a=_0x47ac66[_0x5d96('0x38')]({'plain':!![]});var _0x43657e='SmsAccounts';return db[_0x5d96('0x39')][_0x5d96('0x37')]({'where':{'type':_0x43657e,'resourceId':_0x2a417a['id']}})['then'](function(){return _0x47ac66;});})[_0x5d96('0x36')](function(){_0xd73df7[_0x5d96('0x2a')](0xcc)[_0x5d96('0x2b')]();});}};}function handleEntityNotFound(_0x4bacb2,_0x57b63f){return function(_0x131ace){if(!_0x131ace){_0x4bacb2[_0x5d96('0x29')](0x194);}return _0x131ace;};}function handleError(_0x19fd9d,_0x5466f3){_0x5466f3=_0x5466f3||0x1f4;return function(_0x5ebe55){logger[_0x5d96('0x25')](_0x5ebe55['stack']);if(_0x5ebe55['name']){delete _0x5ebe55[_0x5d96('0x3a')];}_0x19fd9d['status'](_0x5466f3)[_0x5d96('0x3b')](_0x5ebe55);};}exports[_0x5d96('0x3c')]=function(_0x68719b,_0x59abfc){var _0x29c008={'include':[{'model':db[_0x5d96('0x3d')],'as':_0x5d96('0x3e')}]},_0x45b889={},_0x3c24ad={'count':0x0,'rows':[]};var _0x43cfad=_[_0x5d96('0x3f')](db['SmsAccount'][_0x5d96('0x40')],function(_0x566ff6){return{'name':_0x566ff6[_0x5d96('0x41')],'type':_0x566ff6[_0x5d96('0x42')]['key']};});_0x45b889[_0x5d96('0x43')]=_[_0x5d96('0x3f')](_0x43cfad,_0x5d96('0x3a'));_0x45b889[_0x5d96('0x44')]=_['keys'](_0x68719b[_0x5d96('0x44')]);_0x45b889['filters']=_[_0x5d96('0x45')](_0x45b889[_0x5d96('0x43')],_0x45b889[_0x5d96('0x44')]);_0x29c008['attributes']=_[_0x5d96('0x45')](_0x45b889[_0x5d96('0x43')],qs[_0x5d96('0x46')](_0x68719b[_0x5d96('0x44')][_0x5d96('0x46')]));_0x29c008[_0x5d96('0x47')]=_0x29c008[_0x5d96('0x47')][_0x5d96('0x48')]?_0x29c008[_0x5d96('0x47')]:_0x45b889[_0x5d96('0x43')];if(!_0x68719b['query'][_0x5d96('0x49')](_0x5d96('0x4a'))){_0x29c008['limit']=qs[_0x5d96('0x2e')](_0x68719b[_0x5d96('0x44')]['limit']);_0x29c008[_0x5d96('0x30')]=qs[_0x5d96('0x30')](_0x68719b['query'][_0x5d96('0x30')]);}_0x29c008[_0x5d96('0x4b')]=qs[_0x5d96('0x4c')](_0x68719b[_0x5d96('0x44')][_0x5d96('0x4c')]);_0x29c008[_0x5d96('0x4d')]=qs[_0x5d96('0x4e')](_[_0x5d96('0x4f')](_0x68719b['query'],_0x45b889[_0x5d96('0x4e')]),_0x43cfad);if(_0x68719b[_0x5d96('0x44')][_0x5d96('0x50')]){_0x29c008[_0x5d96('0x4d')]=_[_0x5d96('0x51')](_0x29c008[_0x5d96('0x4d')],{'$or':_[_0x5d96('0x3f')](_0x43cfad,function(_0x4eef20){if(_0x4eef20[_0x5d96('0x42')]!==_0x5d96('0x52')){var _0xb8fcb4={};_0xb8fcb4[_0x4eef20[_0x5d96('0x3a')]]={'$like':'%'+_0x68719b[_0x5d96('0x44')][_0x5d96('0x50')]+'%'};return _0xb8fcb4;}})});}_0x29c008=_[_0x5d96('0x51')]({},_0x29c008,_0x68719b[_0x5d96('0x53')]);var _0x588b4c={'where':_0x29c008['where']};return db[_0x5d96('0x54')][_0x5d96('0x2f')](_0x588b4c)['then'](function(_0x4f0cb7){_0x3c24ad[_0x5d96('0x2f')]=_0x4f0cb7;if(_0x68719b[_0x5d96('0x44')][_0x5d96('0x55')]){_0x29c008[_0x5d96('0x56')]=[{'all':!![]}];}return db[_0x5d96('0x54')][_0x5d96('0x57')](_0x29c008);})['then'](function(_0x2d1272){_0x3c24ad[_0x5d96('0x58')]=_0x2d1272;return _0x3c24ad;})[_0x5d96('0x36')](respondWithFilteredResult(_0x59abfc,_0x29c008))['catch'](handleError(_0x59abfc,null));};exports[_0x5d96('0x59')]=function(_0xa24f9c,_0x38107f){var _0x406c3a={'raw':![],'where':{'id':_0xa24f9c[_0x5d96('0x5a')]['id']},'include':[{'model':db[_0x5d96('0x3d')],'as':'mandatoryDispositionPause'}]},_0x4a944d={};_0x4a944d[_0x5d96('0x43')]=_[_0x5d96('0x5b')](db[_0x5d96('0x54')]['rawAttributes']);_0x4a944d[_0x5d96('0x44')]=_[_0x5d96('0x5b')](_0xa24f9c['query']);_0x4a944d[_0x5d96('0x4e')]=_[_0x5d96('0x45')](_0x4a944d[_0x5d96('0x43')],_0x4a944d[_0x5d96('0x44')]);_0x406c3a[_0x5d96('0x47')]=_[_0x5d96('0x45')](_0x4a944d['model'],qs['fields'](_0xa24f9c['query'][_0x5d96('0x46')]));_0x406c3a['attributes']=_0x406c3a[_0x5d96('0x47')][_0x5d96('0x48')]?_0x406c3a[_0x5d96('0x47')]:_0x4a944d[_0x5d96('0x43')];if(_0xa24f9c[_0x5d96('0x44')][_0x5d96('0x55')]){_0x406c3a[_0x5d96('0x56')]=[{'all':!![]}];}_0x406c3a=_[_0x5d96('0x51')]({},_0x406c3a,_0xa24f9c[_0x5d96('0x53')]);return db['SmsAccount'][_0x5d96('0x5c')](_0x406c3a)['then'](handleEntityNotFound(_0x38107f,null))['then'](respondWithResult(_0x38107f,null))[_0x5d96('0x28')](handleError(_0x38107f,null));};exports[_0x5d96('0x5d')]=function(_0x267c44,_0x372075){return db[_0x5d96('0x54')]['create'](_0x267c44['body'],{})[_0x5d96('0x36')](function(_0xc05273){var _0x5f4a20=_0x267c44['user'][_0x5d96('0x38')]({'plain':!![]});if(!_0x5f4a20)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f4a20[_0x5d96('0x5e')]===_0x5d96('0x5f')){var _0x480180=_0xc05273['get']({'plain':!![]});var _0x4922df=_0x5d96('0x60');return db[_0x5d96('0x61')][_0x5d96('0x5c')]({'where':{'name':_0x4922df,'userProfileId':_0x5f4a20[_0x5d96('0x62')]},'raw':!![]})[_0x5d96('0x36')](function(_0x189c94){if(_0x189c94&&_0x189c94[_0x5d96('0x63')]===0x0){return db[_0x5d96('0x39')][_0x5d96('0x5d')]({'name':_0x480180[_0x5d96('0x3a')],'resourceId':_0x480180['id'],'type':_0x189c94['name'],'sectionId':_0x189c94['id']},{})[_0x5d96('0x36')](function(){return _0xc05273;});}else{return _0xc05273;}})[_0x5d96('0x28')](function(_0x2d2b55){logger[_0x5d96('0x25')](_0x5d96('0x64'),_0x2d2b55);throw _0x2d2b55;});}return _0xc05273;})[_0x5d96('0x36')](respondWithResult(_0x372075,0xc9))[_0x5d96('0x28')](handleError(_0x372075,null));};exports[_0x5d96('0x35')]=function(_0x1dd6f7,_0x321776){if(_0x1dd6f7[_0x5d96('0x65')]['id']){delete _0x1dd6f7[_0x5d96('0x65')]['id'];}return db[_0x5d96('0x54')]['find']({'where':{'id':_0x1dd6f7[_0x5d96('0x5a')]['id']},'include':[{'model':db[_0x5d96('0x3d')],'as':_0x5d96('0x3e')}]})[_0x5d96('0x36')](handleEntityNotFound(_0x321776,null))[_0x5d96('0x36')](saveUpdates(_0x1dd6f7['body'],null))[_0x5d96('0x36')](respondWithResult(_0x321776,null))[_0x5d96('0x28')](handleError(_0x321776,null));};exports[_0x5d96('0x37')]=function(_0x491760,_0x4c9001){return db['SmsAccount']['find']({'where':{'id':_0x491760[_0x5d96('0x5a')]['id']}})[_0x5d96('0x36')](handleEntityNotFound(_0x4c9001,null))[_0x5d96('0x36')](removeEntity(_0x4c9001,null))['catch'](handleError(_0x4c9001,null));};exports[_0x5d96('0x66')]=function(_0xbb1fdc,_0x5f0413){return db[_0x5d96('0x54')][_0x5d96('0x66')]()[_0x5d96('0x36')](respondWithResult(_0x5f0413,null))['catch'](handleError(_0x5f0413,null));};exports[_0x5d96('0x67')]=function(_0x3c7c01,_0x47dd4c,_0x517e15){if(_0x3c7c01['body']['id']){delete _0x3c7c01['body']['id'];}return db[_0x5d96('0x54')][_0x5d96('0x5c')]({'where':{'id':_0x3c7c01[_0x5d96('0x5a')]['id']}})[_0x5d96('0x36')](handleEntityNotFound(_0x47dd4c,null))[_0x5d96('0x36')](function(_0x3fdb9b){if(_0x3fdb9b){_0x3c7c01['body']['SmsAccountId']=_0x3fdb9b['id'];return db[_0x5d96('0x68')][_0x5d96('0x5d')](_0x3c7c01[_0x5d96('0x65')]);}})[_0x5d96('0x36')](respondWithResult(_0x47dd4c,null))['catch'](handleError(_0x47dd4c,null));};exports[_0x5d96('0x69')]=function(_0x1fce9f,_0x42cb60,_0x5b9dcd){var _0x1292b9={'raw':![],'where':{}};var _0x15374a={};var _0x1376d7={'count':0x0,'rows':[]};return db[_0x5d96('0x54')][_0x5d96('0x6a')]({'where':{'id':_0x1fce9f['params']['id']}})[_0x5d96('0x36')](handleEntityNotFound(_0x42cb60,null))[_0x5d96('0x36')](function(_0xe77acc){if(_0xe77acc){_0x15374a[_0x5d96('0x43')]=_[_0x5d96('0x5b')](db[_0x5d96('0x68')]['rawAttributes']);_0x15374a[_0x5d96('0x44')]=_[_0x5d96('0x5b')](_0x1fce9f['query']);_0x15374a[_0x5d96('0x4e')]=_[_0x5d96('0x45')](_0x15374a[_0x5d96('0x43')],_0x15374a[_0x5d96('0x44')]);_0x1292b9[_0x5d96('0x47')]=_[_0x5d96('0x45')](_0x15374a[_0x5d96('0x43')],qs['fields'](_0x1fce9f[_0x5d96('0x44')]['fields']));_0x1292b9[_0x5d96('0x47')]=_0x1292b9[_0x5d96('0x47')][_0x5d96('0x48')]?_0x1292b9[_0x5d96('0x47')]:_0x15374a['model'];if(!_0x1fce9f['query'][_0x5d96('0x49')](_0x5d96('0x4a'))){_0x1292b9[_0x5d96('0x2e')]=qs[_0x5d96('0x2e')](_0x1fce9f[_0x5d96('0x44')][_0x5d96('0x2e')]);_0x1292b9[_0x5d96('0x30')]=qs['offset'](_0x1fce9f[_0x5d96('0x44')][_0x5d96('0x30')]);}_0x1292b9['order']=qs[_0x5d96('0x4c')](_0x1fce9f[_0x5d96('0x44')]['sort']);_0x1292b9[_0x5d96('0x4d')]=qs[_0x5d96('0x4e')](_[_0x5d96('0x4f')](_0x1fce9f[_0x5d96('0x44')],_0x15374a['filters']));_0x1292b9[_0x5d96('0x4d')][_0x5d96('0x6b')]=_0xe77acc['id'];if(_0x1fce9f[_0x5d96('0x44')][_0x5d96('0x50')]){_0x1292b9[_0x5d96('0x4d')]=_[_0x5d96('0x51')](_0x1292b9['where'],{'$or':_[_0x5d96('0x3f')](_0x1292b9[_0x5d96('0x47')],function(_0x378408){var _0x119f64={};_0x119f64[_0x378408]={'$like':'%'+_0x1fce9f[_0x5d96('0x44')][_0x5d96('0x50')]+'%'};return _0x119f64;})});}_0x1292b9=_[_0x5d96('0x51')]({},_0x1292b9,_0x1fce9f[_0x5d96('0x53')]);return db['Disposition'][_0x5d96('0x2f')]({'where':_0x1292b9['where']})['then'](function(_0x4f2612){_0x1376d7[_0x5d96('0x2f')]=_0x4f2612;if(_0x1fce9f[_0x5d96('0x44')][_0x5d96('0x55')]){_0x1292b9[_0x5d96('0x56')]=[{'all':!![]}];}return db[_0x5d96('0x68')][_0x5d96('0x57')](_0x1292b9);})['then'](function(_0x3d29e6){_0x1376d7[_0x5d96('0x58')]=_0x3d29e6;return _0x1376d7;});}})[_0x5d96('0x36')](respondWithFilteredResult(_0x42cb60,_0x1292b9))[_0x5d96('0x28')](handleError(_0x42cb60,null));};exports[_0x5d96('0x6c')]=function(_0x4f889b,_0x2862ab,_0x48eca9){return db['SmsAccount'][_0x5d96('0x5c')]({'where':{'id':_0x4f889b[_0x5d96('0x5a')]['id']}})[_0x5d96('0x36')](handleEntityNotFound(_0x2862ab,null))[_0x5d96('0x36')](function(_0x3bd2b6){if(_0x3bd2b6){return _0x3bd2b6['removeDispositions'](_0x4f889b['query']['ids']);}})[_0x5d96('0x36')](respondWithStatusCode(_0x2862ab,null))[_0x5d96('0x28')](handleError(_0x2862ab,null));};exports[_0x5d96('0x6d')]=function(_0x3516e0,_0x35c1e1,_0x1d2d02){if(_0x3516e0[_0x5d96('0x65')]['id']){delete _0x3516e0['body']['id'];}return db['SmsAccount'][_0x5d96('0x5c')]({'where':{'id':_0x3516e0['params']['id']}})['then'](handleEntityNotFound(_0x35c1e1,null))[_0x5d96('0x36')](function(_0x15d5d9){if(_0x15d5d9){_0x3516e0['body']['SmsAccountId']=_0x15d5d9['id'];return db[_0x5d96('0x6e')][_0x5d96('0x5d')](_0x3516e0[_0x5d96('0x65')]);}})[_0x5d96('0x36')](respondWithResult(_0x35c1e1,null))[_0x5d96('0x28')](handleError(_0x35c1e1,null));};exports[_0x5d96('0x6f')]=function(_0x1881aa,_0xedd3b8,_0x8623b8){var _0x4aaa04={'raw':![],'where':{}};var _0x5d708c={};var _0xb7224c={'count':0x0,'rows':[]};return db[_0x5d96('0x54')][_0x5d96('0x6a')]({'where':{'id':_0x1881aa['params']['id']}})[_0x5d96('0x36')](handleEntityNotFound(_0xedd3b8,null))[_0x5d96('0x36')](function(_0x4a74b6){if(_0x4a74b6){_0x5d708c[_0x5d96('0x43')]=_[_0x5d96('0x5b')](db[_0x5d96('0x6e')][_0x5d96('0x40')]);_0x5d708c[_0x5d96('0x44')]=_['keys'](_0x1881aa['query']);_0x5d708c[_0x5d96('0x4e')]=_[_0x5d96('0x45')](_0x5d708c['model'],_0x5d708c[_0x5d96('0x44')]);_0x4aaa04['attributes']=_[_0x5d96('0x45')](_0x5d708c[_0x5d96('0x43')],qs[_0x5d96('0x46')](_0x1881aa['query'][_0x5d96('0x46')]));_0x4aaa04[_0x5d96('0x47')]=_0x4aaa04['attributes'][_0x5d96('0x48')]?_0x4aaa04[_0x5d96('0x47')]:_0x5d708c[_0x5d96('0x43')];if(!_0x1881aa[_0x5d96('0x44')][_0x5d96('0x49')](_0x5d96('0x4a'))){_0x4aaa04['limit']=qs[_0x5d96('0x2e')](_0x1881aa[_0x5d96('0x44')][_0x5d96('0x2e')]);_0x4aaa04[_0x5d96('0x30')]=qs['offset'](_0x1881aa[_0x5d96('0x44')]['offset']);}_0x4aaa04[_0x5d96('0x4b')]=qs['sort'](_0x1881aa[_0x5d96('0x44')][_0x5d96('0x4c')]);_0x4aaa04[_0x5d96('0x4d')]=qs[_0x5d96('0x4e')](_['pick'](_0x1881aa[_0x5d96('0x44')],_0x5d708c['filters']));_0x4aaa04['where'][_0x5d96('0x6b')]=_0x4a74b6['id'];if(_0x1881aa['query']['filter']){_0x4aaa04[_0x5d96('0x4d')]=_[_0x5d96('0x51')](_0x4aaa04[_0x5d96('0x4d')],{'$or':_[_0x5d96('0x3f')](_0x4aaa04[_0x5d96('0x47')],function(_0x1bd582){var _0x5eb1cb={};_0x5eb1cb[_0x1bd582]={'$like':'%'+_0x1881aa[_0x5d96('0x44')][_0x5d96('0x50')]+'%'};return _0x5eb1cb;})});}_0x4aaa04=_[_0x5d96('0x51')]({},_0x4aaa04,_0x1881aa[_0x5d96('0x53')]);return db['CannedAnswer']['count']({'where':_0x4aaa04[_0x5d96('0x4d')]})['then'](function(_0x101122){_0xb7224c['count']=_0x101122;if(_0x1881aa[_0x5d96('0x44')][_0x5d96('0x55')]){_0x4aaa04[_0x5d96('0x56')]=[{'all':!![]}];}return db[_0x5d96('0x6e')][_0x5d96('0x57')](_0x4aaa04);})['then'](function(_0x3836ee){_0xb7224c[_0x5d96('0x58')]=_0x3836ee;return _0xb7224c;});}})[_0x5d96('0x36')](respondWithFilteredResult(_0xedd3b8,_0x4aaa04))[_0x5d96('0x28')](handleError(_0xedd3b8,null));};exports[_0x5d96('0x70')]=function(_0x575259,_0x4776bf,_0x461f14){return db[_0x5d96('0x54')][_0x5d96('0x5c')]({'where':{'id':_0x575259[_0x5d96('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4776bf,null))[_0x5d96('0x36')](function(_0x1bec80){if(_0x1bec80){return _0x1bec80[_0x5d96('0x70')](_0x575259[_0x5d96('0x44')]['ids']);}})[_0x5d96('0x36')](respondWithStatusCode(_0x4776bf,null))['catch'](handleError(_0x4776bf,null));};exports[_0x5d96('0x71')]=function(_0x4ccbfa,_0x3ba0ac,_0x44cdce){var _0xdd6467={'channel':_0x5d96('0x72')};var _0x46b5c5=[];var _0x1f5591=[];var _0xb9802={};return db['SmsAccount'][_0x5d96('0x5c')]({'where':{'id':_0x4ccbfa[_0x5d96('0x5a')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x5d96('0x73')}]})[_0x5d96('0x36')](handleEntityNotFound(_0x3ba0ac,null))[_0x5d96('0x36')](function(_0x32787b){_0xdd6467[_0x5d96('0x74')]=_0x32787b;_0xdd6467[_0x5d96('0x75')]=_[_0x5d96('0x76')](_0x32787b[_0x5d96('0x73')],[_0x5d96('0x77')],[_0x5d96('0x78')]);if(_0xdd6467['account'][_0x5d96('0x73')]){delete _0xdd6467[_0x5d96('0x74')][_0x5d96('0x73')];}return db[_0x5d96('0x79')][_0x5d96('0x66')]();})[_0x5d96('0x36')](function(_0x309531){if(!_0x309531){throw new db['Sequelize'][(_0x5d96('0x7a'))](_0x5d96('0x7b'));}_0x46b5c5=_[_0x5d96('0x7c')](_['keys'](_0x309531),[_0x5d96('0x7d'),_0x5d96('0x7e')]);_0x1f5591=_[_0x5d96('0x7c')](_['keys'](_0x309531),[_0x5d96('0x7d'),_0x5d96('0x7e'),'CompanyId',_0x5d96('0x7f')]);_0xdd6467[_0x5d96('0x65')]={'mapKey':_0x5d96('0x80')};if(_0xdd6467['account'][_0x5d96('0x42')]){switch(_0xdd6467[_0x5d96('0x74')][_0x5d96('0x42')]){case _0x5d96('0x81'):_0xdd6467[_0x5d96('0x65')][_0x5d96('0x82')]=_0x4ccbfa[_0x5d96('0x65')][_0x5d96('0x83')];_0xdd6467[_0x5d96('0x65')][_0x5d96('0x65')]=_0x4ccbfa['body'][_0x5d96('0x84')];_0xdd6467['body'][_0x5d96('0x85')]=_0x4ccbfa[_0x5d96('0x65')][_0x5d96('0x86')];break;case _0x5d96('0x87'):_0xdd6467[_0x5d96('0x65')][_0x5d96('0x82')]='+'+_0x4ccbfa[_0x5d96('0x65')][_0x5d96('0x88')];_0xdd6467[_0x5d96('0x65')][_0x5d96('0x65')]=_0x4ccbfa[_0x5d96('0x65')][_0x5d96('0x89')];break;case'connectel':_0xdd6467[_0x5d96('0x65')][_0x5d96('0x82')]=_0x4ccbfa[_0x5d96('0x65')][_0x5d96('0x82')];_0xdd6467[_0x5d96('0x65')][_0x5d96('0x65')]=_0x4ccbfa[_0x5d96('0x65')][_0x5d96('0x26')];break;case _0x5d96('0x8a'):_0xdd6467['body'][_0x5d96('0x82')]=_0x4ccbfa[_0x5d96('0x65')][_0x5d96('0x82')];_0xdd6467[_0x5d96('0x65')][_0x5d96('0x65')]=_0x4ccbfa[_0x5d96('0x65')]['body'];_0xdd6467[_0x5d96('0x65')]['messageId']=_0x4ccbfa[_0x5d96('0x65')]['message_id'];break;case _0x5d96('0x8b'):_0xdd6467[_0x5d96('0x65')]['from']=_0x4ccbfa[_0x5d96('0x65')]['From'];_0xdd6467['body']['body']=_0x4ccbfa[_0x5d96('0x65')][_0x5d96('0x8c')];_0xdd6467[_0x5d96('0x65')][_0x5d96('0x85')]=_0x4ccbfa[_0x5d96('0x65')][_0x5d96('0x8d')];break;case _0x5d96('0x8e'):_0xdd6467[_0x5d96('0x65')][_0x5d96('0x82')]='+'+_0x4ccbfa[_0x5d96('0x65')][_0x5d96('0x8f')][0x0][_0x5d96('0x82')];_0xdd6467[_0x5d96('0x65')]['body']=_0x4ccbfa['body'][_0x5d96('0x8f')][0x0]['text'];_0xdd6467[_0x5d96('0x65')][_0x5d96('0x85')]=_0x4ccbfa[_0x5d96('0x65')][_0x5d96('0x8f')][0x0][_0x5d96('0x85')];break;case'csc':_0xdd6467[_0x5d96('0x65')][_0x5d96('0x82')]=_0x4ccbfa[_0x5d96('0x65')][_0x5d96('0x90')];_0xdd6467['body'][_0x5d96('0x65')]=_0x4ccbfa['body'][_0x5d96('0x91')][_0x5d96('0x26')];break;case _0x5d96('0x92'):_0xdd6467[_0x5d96('0x65')][_0x5d96('0x82')]=_0x4ccbfa[_0x5d96('0x65')][_0x5d96('0x93')];_0xdd6467[_0x5d96('0x65')][_0x5d96('0x65')]=_0x4ccbfa[_0x5d96('0x65')][_0x5d96('0x89')];_0xdd6467[_0x5d96('0x65')][_0x5d96('0x85')]=_0x4ccbfa['body'][_0x5d96('0x94')];break;case'bandwidth':_0xdd6467[_0x5d96('0x65')]['messageId']=_0x4ccbfa['body'][0x0][_0x5d96('0x26')]['id'];_0xdd6467[_0x5d96('0x65')][_0x5d96('0x82')]=_0x4ccbfa['body'][0x0]['message'][_0x5d96('0x82')];_0xdd6467[_0x5d96('0x65')]['body']=_0x4ccbfa['body'][0x0][_0x5d96('0x26')][_0x5d96('0x89')];break;case _0x5d96('0x95'):_0xdd6467[_0x5d96('0x65')][_0x5d96('0x82')]=_0x4ccbfa[_0x5d96('0x65')][_0x5d96('0x82')];_0xdd6467[_0x5d96('0x65')][_0x5d96('0x65')]=_0x4ccbfa[_0x5d96('0x65')][_0x5d96('0x26')];_0xdd6467['body'][_0x5d96('0x85')]=_0x4ccbfa[_0x5d96('0x65')][_0x5d96('0x96')];break;}}if(_0xdd6467[_0x5d96('0x65')]['id']){delete _0xdd6467['body']['id'];}if(_[_0x5d96('0x97')](_0xdd6467[_0x5d96('0x65')][_0x5d96('0x82')])){throw new db[(_0x5d96('0x98'))][(_0x5d96('0x7a'))](_0x5d96('0x99'));}if(_['isNil'](_0xdd6467['body']['body'])||_0xdd6467[_0x5d96('0x65')][_0x5d96('0x65')]===''){throw new db[(_0x5d96('0x98'))][(_0x5d96('0x7a'))](_0x5d96('0x9a'));}if(_[_0x5d96('0x97')](_0xdd6467[_0x5d96('0x65')]['mapKey'])){throw new db[(_0x5d96('0x98'))][(_0x5d96('0x7a'))](_0x5d96('0x9b')+_0x1f5591);}if(!_[_0x5d96('0x9c')](_0x1f5591,_0xdd6467['body']['mapKey'])){throw new db[(_0x5d96('0x98'))][(_0x5d96('0x7a'))](_0x5d96('0x9d')+_0x1f5591);}_0xb9802[_0xdd6467[_0x5d96('0x65')][_0x5d96('0x9e')]]=_0xdd6467[_0x5d96('0x65')][_0x5d96('0x82')];return db[_0x5d96('0x9f')][_0x5d96('0x5c')]({'where':{'id':_0xdd6467[_0x5d96('0x74')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x5d96('0xa0'),'where':_0xb9802,'limit':0x1,'order':[[_0x5d96('0x7e'),_0x5d96('0xa1')]]}]});})['then'](handleEntityNotFound(_0x3ba0ac,null))[_0x5d96('0x36')](function(_0x5bb147){if(_0x5bb147){_0xdd6467[_0x5d96('0xa2')]=_[_0x5d96('0xa3')](_0x5bb147,['Contacts']);if(_0x5bb147[_0x5d96('0xa0')][_0x5d96('0x48')]){return _0x5bb147['Contacts'][0x0];}var _0x29cbb4=_[_0x5d96('0xa4')](_0xdd6467['body'],{'firstName':_0xdd6467[_0x5d96('0x65')][_0x5d96('0x82')],'ListId':_0x5bb147['id']});_0x29cbb4[_0xdd6467[_0x5d96('0x65')][_0x5d96('0x9e')]]=_0xdd6467[_0x5d96('0x65')][_0x5d96('0x82')];return db['CmContact'][_0x5d96('0x5d')](_0x29cbb4,{'fields':_0x46b5c5,'raw':!![]});}})[_0x5d96('0x36')](handleEntityNotFound(_0x3ba0ac,null))['then'](function(_0xa87932){if(_0xa87932){_0xdd6467[_0x5d96('0xa5')]=_0xa87932;var _0x325693={'ContactId':_0xa87932['id'],'phone':_0xdd6467['body'][_0x5d96('0x82')],'SmsAccountId':_0x4ccbfa[_0x5d96('0x5a')]['id']};var _0x423cf3={'ContactId':_0xa87932['id'],'SmsAccountId':_0x4ccbfa[_0x5d96('0x5a')]['id'],'closed':![]};return db[_0x5d96('0xa6')][_0x5d96('0x5c')]({'where':_0x423cf3})[_0x5d96('0x36')](function(_0x432b3f){if(_0x432b3f){return[_0x432b3f,![]];}return db['SmsInteraction'][_0x5d96('0x5d')](_0x325693)[_0x5d96('0x36')](function(_0x48bbd0){return[_0x48bbd0,!![]];});});}})[_0x5d96('0xa7')](function(_0x17931c,_0x4171e3){_0xdd6467[_0x5d96('0xa8')]=_0x17931c[_0x5d96('0x38')]({'plain':!![]});_0xdd6467[_0x5d96('0xa8')][_0x5d96('0xa9')]=![];if(_0x4171e3){if(_0xdd6467[_0x5d96('0x74')]['autoclose']){_0xdd6467[_0x5d96('0x75')]['push']({'id':0x0,'priority':_0xdd6467[_0x5d96('0x75')][_0x5d96('0x48')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x5d96('0xaa')});}_0xdd6467[_0x5d96('0xa8')][_0x5d96('0xa9')]=!![];}return db[_0x5d96('0xab')]['create']({'phone':_0xdd6467[_0x5d96('0x65')][_0x5d96('0x82')],'messageId':_0xdd6467[_0x5d96('0x65')]['messageId'],'body':_0xdd6467[_0x5d96('0x65')]['body'],'SmsAccountId':_0x4ccbfa[_0x5d96('0x5a')]['id'],'SmsInteractionId':_0x17931c['id'],'direction':'in','ContactId':_0x17931c[_0x5d96('0xac')],'AttachmentId':_0xdd6467[_0x5d96('0x65')][_0x5d96('0xad')]});})[_0x5d96('0x36')](function(_0x543187){_0xdd6467[_0x5d96('0x26')]=_0x543187;if(_0xdd6467[_0x5d96('0xa8')][_0x5d96('0xae')]){return db[_0x5d96('0xaf')][_0x5d96('0x5c')]({'attributes':['id',_0x5d96('0x3a')],'where':{'id':_0xdd6467[_0x5d96('0xa8')][_0x5d96('0xae')]}})[_0x5d96('0x36')](function(_0x105704){if(_0x105704){_0xdd6467[_0x5d96('0x75')][_0x5d96('0xb0')]({'id':0x0,'priority':0x0,'app':_0x5d96('0xb1'),'appdata':_0x105704[_0x5d96('0x3a')]+','+(_0xdd6467[_0x5d96('0x74')][_0x5d96('0xb2')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x5d96('0xb3'),_0x5d96('0xb4'),_0xdd6467);});}return respondWithRpcPromise('Start',_0x5d96('0xb4'),_0xdd6467);})[_0x5d96('0x36')](function(_0x4a70b5){if(_0x4a70b5){var _0x70a67e=0xc8;var _0x27cae8=_0x5d96('0xb5');logger[_0x5d96('0x1f')](_0x5d96('0x23'),_0x27cae8,_0x70a67e,'entity\x20found');logger['debug'](_0x5d96('0xb6'),_0x27cae8,_0x70a67e,'entity\x20found',JSON[_0x5d96('0x24')](_0x4a70b5));if(_0xdd6467[_0x5d96('0x74')]['type']==='twilio'){return _0x3ba0ac[_0x5d96('0x2a')](_0x70a67e)[_0x5d96('0x31')](_0x5d96('0xb7'),_0x5d96('0xb8'))['send'](_0x5d96('0xb9'));}else{return _0x3ba0ac[_0x5d96('0x2a')](_0x70a67e)[_0x5d96('0x2c')](_0x4a70b5);}}})['catch'](handleError(_0x3ba0ac,null));};exports[_0x5d96('0xba')]=function(_0x2e0e79,_0x4670f6,_0x309bbc){return db[_0x5d96('0x54')][_0x5d96('0x6a')]({'where':{'id':_0x2e0e79[_0x5d96('0x5a')]['id']}})[_0x5d96('0x36')](handleEntityNotFound(_0x4670f6,null))[_0x5d96('0x36')](function(_0x38f7fc){if(_0x38f7fc){return db['sequelize']['transaction'](function(_0x520146){return db[_0x5d96('0xbb')]['destroy']({'where':{'SmsAccountId':_0x2e0e79[_0x5d96('0x5a')]['id']},'transaction':_0x520146})[_0x5d96('0x36')](function(_0x370b2e){var _0x2c5bcb=_[_0x5d96('0x3f')](_0x2e0e79['body'],function(_0x3b87e8){_0x3b87e8[_0x5d96('0x6b')]=_0x2e0e79['params']['id'];return _0x3b87e8;});return db[_0x5d96('0xbb')][_0x5d96('0xbc')](_0x2c5bcb,{'transaction':_0x520146});});})[_0x5d96('0x36')](function(){return db['SmsApplication'][_0x5d96('0xbd')]({'where':{'SmsAccountId':_0x2e0e79[_0x5d96('0x5a')]['id']},'order':_0x5d96('0x77')});});}})[_0x5d96('0x36')](respondWithResult(_0x4670f6,null))[_0x5d96('0x28')](handleError(_0x4670f6,null));};exports[_0x5d96('0xbe')]=function(_0x121a35,_0x64ed9e,_0x3ff79e){var _0x33cdaa={};var _0x1b855e={};var _0x423846;var _0x1a1490;return db['SmsAccount'][_0x5d96('0x6a')]({'where':{'id':_0x121a35[_0x5d96('0x5a')]['id']}})[_0x5d96('0x36')](handleEntityNotFound(_0x64ed9e,null))[_0x5d96('0x36')](function(_0x3ca098){if(_0x3ca098){_0x423846=_0x3ca098;_0x1b855e[_0x5d96('0x43')]=_[_0x5d96('0x5b')](db[_0x5d96('0xbb')][_0x5d96('0x40')]);_0x1b855e[_0x5d96('0x44')]=_[_0x5d96('0x5b')](_0x121a35[_0x5d96('0x44')]);_0x1b855e[_0x5d96('0x4e')]=_[_0x5d96('0x45')](_0x1b855e[_0x5d96('0x43')],_0x1b855e['query']);_0x33cdaa[_0x5d96('0x47')]=_[_0x5d96('0x45')](_0x1b855e['model'],qs['fields'](_0x121a35[_0x5d96('0x44')]['fields']));_0x33cdaa[_0x5d96('0x47')]=_0x33cdaa[_0x5d96('0x47')]['length']?_0x33cdaa[_0x5d96('0x47')]:_0x1b855e[_0x5d96('0x43')];_0x33cdaa[_0x5d96('0x4b')]=qs[_0x5d96('0x4c')](_0x121a35[_0x5d96('0x44')][_0x5d96('0x4c')]);_0x33cdaa[_0x5d96('0x4d')]=qs['filters'](_[_0x5d96('0x4f')](_0x121a35[_0x5d96('0x44')],_0x1b855e[_0x5d96('0x4e')]));if(_0x121a35[_0x5d96('0x44')]['filter']){_0x33cdaa[_0x5d96('0x4d')]=_['merge'](_0x33cdaa[_0x5d96('0x4d')],{'$or':_[_0x5d96('0x3f')](_0x33cdaa[_0x5d96('0x47')],function(_0x4ad1e5){var _0x51edb7={};_0x51edb7[_0x4ad1e5]={'$like':'%'+_0x121a35[_0x5d96('0x44')]['filter']+'%'};return _0x51edb7;})});}_0x33cdaa=_[_0x5d96('0x51')]({},_0x33cdaa,_0x121a35['options']);return _0x423846[_0x5d96('0xbe')](_0x33cdaa);}})[_0x5d96('0x36')](function(_0x35b0f7){if(_0x35b0f7){_0x1a1490=_0x35b0f7[_0x5d96('0x48')];if(!_0x121a35[_0x5d96('0x44')][_0x5d96('0x49')]('nolimit')){_0x33cdaa[_0x5d96('0x2e')]=qs[_0x5d96('0x2e')](_0x121a35[_0x5d96('0x44')]['limit']);_0x33cdaa['offset']=qs[_0x5d96('0x30')](_0x121a35[_0x5d96('0x44')]['offset']);}return _0x423846[_0x5d96('0xbe')](_0x33cdaa);}})[_0x5d96('0x36')](function(_0x2c4021){if(_0x2c4021){return _0x2c4021?{'count':_0x1a1490,'rows':_0x2c4021}:null;}})['then'](respondWithResult(_0x64ed9e,null))['catch'](handleError(_0x64ed9e,null));};exports[_0x5d96('0xbf')]=function(_0x3da894,_0x19f1bd,_0x51d1fd){var _0x5820d7={'raw':![],'where':{}};var _0x30b0d9={};var _0x141760={'count':0x0,'rows':[]};return db[_0x5d96('0x54')]['findOne']({'where':{'id':_0x3da894['params']['id']}})['then'](handleEntityNotFound(_0x19f1bd,null))[_0x5d96('0x36')](function(_0x58f56d){if(_0x58f56d){_0x30b0d9[_0x5d96('0x43')]=_[_0x5d96('0x5b')](db['SmsInteraction'][_0x5d96('0x40')]);_0x30b0d9[_0x5d96('0x44')]=_['keys'](_0x3da894[_0x5d96('0x44')]);_0x30b0d9['filters']=_['intersection'](_0x30b0d9[_0x5d96('0x43')],_0x30b0d9[_0x5d96('0x44')]);_0x5820d7['attributes']=_['intersection'](_0x30b0d9[_0x5d96('0x43')],qs[_0x5d96('0x46')](_0x3da894[_0x5d96('0x44')][_0x5d96('0x46')]));_0x5820d7[_0x5d96('0x47')]=_0x5820d7[_0x5d96('0x47')][_0x5d96('0x48')]?_0x5820d7[_0x5d96('0x47')]:_0x30b0d9[_0x5d96('0x43')];if(!_0x3da894[_0x5d96('0x44')][_0x5d96('0x49')]('nolimit')){_0x5820d7['limit']=qs['limit'](_0x3da894['query'][_0x5d96('0x2e')]);_0x5820d7[_0x5d96('0x30')]=qs[_0x5d96('0x30')](_0x3da894[_0x5d96('0x44')][_0x5d96('0x30')]);}_0x5820d7['order']=qs[_0x5d96('0x4c')](_0x3da894[_0x5d96('0x44')][_0x5d96('0x4c')]);_0x5820d7['where']=qs[_0x5d96('0x4e')](_[_0x5d96('0x4f')](_0x3da894['query'],_0x30b0d9['filters']));_0x5820d7[_0x5d96('0x4d')][_0x5d96('0x6b')]=_0x58f56d['id'];if(_0x3da894[_0x5d96('0x44')][_0x5d96('0x50')]){_0x5820d7[_0x5d96('0x4d')]=_['merge'](_0x5820d7[_0x5d96('0x4d')],{'$or':_[_0x5d96('0x3f')](_0x5820d7[_0x5d96('0x47')],function(_0x1a42ad){var _0x5c1437={};_0x5c1437[_0x1a42ad]={'$like':'%'+_0x3da894['query'][_0x5d96('0x50')]+'%'};return _0x5c1437;})});}_0x5820d7=_[_0x5d96('0x51')]({},_0x5820d7,_0x3da894['options']);return db['SmsInteraction'][_0x5d96('0x2f')]({'where':_0x5820d7['where']})[_0x5d96('0x36')](function(_0x1ef1da){_0x141760[_0x5d96('0x2f')]=_0x1ef1da;if(_0x3da894[_0x5d96('0x44')]['includeAll']){_0x5820d7[_0x5d96('0x56')]=[{'model':db[_0x5d96('0x79')],'as':_0x5d96('0xc0'),'required':![]},{'model':db[_0x5d96('0xaf')],'as':'Owner','attributes':[_0x5d96('0x3a'),_0x5d96('0xc1'),'internal'],'required':![]},{'model':db[_0x5d96('0xc2')],'as':'Tags','attributes':['id',_0x5d96('0x3a'),_0x5d96('0xc3')],'where':_0x3da894[_0x5d96('0x44')][_0x5d96('0xc4')]?{'id':_0x3da894[_0x5d96('0x44')]['tag']}:undefined,'required':_0x3da894['query'][_0x5d96('0xc4')]?!![]:![]}];}return db['SmsInteraction'][_0x5d96('0x57')](_0x5820d7);})[_0x5d96('0x36')](function(_0x20a2ea){_0x141760[_0x5d96('0x58')]=_0x20a2ea;return _0x141760;});}})['then'](respondWithFilteredResult(_0x19f1bd,_0x5820d7))[_0x5d96('0x28')](handleError(_0x19f1bd,null));};exports[_0x5d96('0x3b')]=function(_0x13f66a,_0x54754b,_0x133750){var _0x3ccb6f,_0x55304e,_0x17cb29;if(_[_0x5d96('0x97')](_0x13f66a[_0x5d96('0x65')][_0x5d96('0x65')])||_0x13f66a[_0x5d96('0x65')][_0x5d96('0x65')]===''){throw new db[(_0x5d96('0x98'))][(_0x5d96('0x7a'))](_0x5d96('0x9a'));}if(_[_0x5d96('0x97')](_0x13f66a[_0x5d96('0x65')]['to'])){throw new db[(_0x5d96('0x98'))][(_0x5d96('0x7a'))](_0x5d96('0xc5'));}_0x3ccb6f=_0x13f66a[_0x5d96('0x65')]['to'];return db[_0x5d96('0x54')][_0x5d96('0x5c')]({'where':{'id':_0x13f66a['params']['id']},'include':[{'model':db[_0x5d96('0x9f')],'as':_0x5d96('0xc6'),'include':[{'model':db[_0x5d96('0x79')],'as':_0x5d96('0xa0'),'where':{'mobile':_0x3ccb6f},'limit':0x1,'order':[[_0x5d96('0x7e'),_0x5d96('0xa1')]]}]}]})[_0x5d96('0x36')](handleEntityNotFound(_0x54754b,null))[_0x5d96('0x36')](function(_0x15a992){if(_0x15a992&&_0x15a992[_0x5d96('0xc6')]){_0x55304e=_0x15a992[_0x5d96('0x38')]({'plain':!![]});if(_0x55304e[_0x5d96('0xc6')]&&_0x55304e['List'][_0x5d96('0xa0')][_0x5d96('0x48')]){return _0x55304e[_0x5d96('0xc6')]['Contacts'][0x0];}return db[_0x5d96('0x79')][_0x5d96('0x5d')](_[_0x5d96('0xa4')](_0x13f66a[_0x5d96('0x65')],{'firstName':_0x3ccb6f,'mobile':_0x3ccb6f,'phone':_0x3ccb6f,'ListId':_0x55304e[_0x5d96('0x7f')]}));}})[_0x5d96('0x36')](handleEntityNotFound(_0x54754b,null))[_0x5d96('0x36')](function(_0x5187d5){if(_0x5187d5){_0x17cb29=_0x5187d5;return db[_0x5d96('0xa6')]['find']({'where':{'ContactId':_0x17cb29['id'],'closed':![],'SmsAccountId':_0x55304e['id']}})[_0x5d96('0x36')](function(_0xcc3503){if(_0xcc3503){return[_0xcc3503,![]];}return db[_0x5d96('0xa6')][_0x5d96('0x5d')]({'UserId':_0x13f66a[_0x5d96('0x5f')]['id'],'ContactId':_0x17cb29['id'],'SmsAccountId':_0x55304e['id'],'phone':_0x3ccb6f,'firstMsgDirection':_0x5d96('0xc7'),'Messages':[_[_0x5d96('0x51')](_0x13f66a[_0x5d96('0x65')],{'read':![],'body':_0x13f66a[_0x5d96('0x65')]['body'],'phone':_0x3ccb6f,'SmsAccountId':_0x55304e['id'],'UserId':_0x13f66a[_0x5d96('0x5f')]['id'],'ContactId':_0x17cb29['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x5d96('0xc8')}]})[_0x5d96('0x36')](function(_0x40561b){return[_0x40561b,!![]];});});}})[_0x5d96('0xa7')](function(_0x4b3cbf,_0x3b1dbf){if(_0x3b1dbf){return _0x4b3cbf;}return db[_0x5d96('0xab')][_0x5d96('0x5d')](_['merge'](_0x13f66a['body'],{'read':![],'body':_0x13f66a[_0x5d96('0x65')][_0x5d96('0x65')],'phone':_0x3ccb6f,'SmsAccountId':_0x55304e['id'],'SmsInteractionId':_0x4b3cbf['id'],'UserId':_0x13f66a[_0x5d96('0x5f')]['id'],'ContactId':_0x17cb29['id']}))['then'](function(_0xaaeb8){_0x4b3cbf['dataValues']['Messages']=[];_0x4b3cbf[_0x5d96('0xc9')][_0x5d96('0xc8')]['push'](_0xaaeb8[_0x5d96('0xc9')]);return _0x4b3cbf;});})[_0x5d96('0x36')](respondWithResult(_0x54754b,null))['catch'](handleError(_0x54754b,null));};exports[_0x5d96('0x2a')]=function(_0x5c791a,_0x3151cc,_0x43b6e6){if(_0x5c791a[_0x5d96('0x65')]['id']){delete _0x5c791a[_0x5d96('0x65')]['id'];}var _0x37743a,_0x4a8657,_0xa7c2d9;return db[_0x5d96('0x54')][_0x5d96('0x5c')]({'where':{'id':_0x5c791a[_0x5d96('0x5a')]['id']}})[_0x5d96('0x36')](handleEntityNotFound(_0x3151cc,null))[_0x5d96('0x36')](function(_0x1d83db){if(_0x1d83db){_0xa7c2d9=_0x1d83db;logger[_0x5d96('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5d96('0x2a'),_0x5d96('0xca'),_0x1d83db[_0x5d96('0x42')],util['inspect'](_0x5c791a[_0x5d96('0x65')],{'showHidden':![],'depth':null}));switch(_0x1d83db[_0x5d96('0x42')]){case'skebby':if(_0x5c791a['body'][_0x5d96('0xcb')]&&_0x5c791a[_0x5d96('0x65')]['status']){_0x4a8657=_0x5c791a[_0x5d96('0x65')][_0x5d96('0x2a')];return db[_0x5d96('0xab')][_0x5d96('0x5c')]({'where':{'messageId':_0x5c791a['body'][_0x5d96('0xcb')]}});}break;case _0x5d96('0xcc'):if(_0x5c791a['body'][_0x5d96('0xcd')]&&_0x5c791a['body'][_0x5d96('0xce')]){_0x4a8657=_0x5c791a[_0x5d96('0x65')][_0x5d96('0xce')];return db[_0x5d96('0xab')][_0x5d96('0x5c')]({'where':{'messageId':_0x5c791a['body'][_0x5d96('0xcd')]}});}break;case _0x5d96('0x8a'):if(_0x5c791a[_0x5d96('0x65')]['message_id']&&_0x5c791a['body'][_0x5d96('0xcf')]){_0x4a8657=_0x5c791a[_0x5d96('0x65')][_0x5d96('0xcf')];return db[_0x5d96('0xab')]['find']({'where':{'messageId':_0x5c791a[_0x5d96('0x65')][_0x5d96('0xd0')]}});}break;case _0x5d96('0x8e'):var _0x4175b8=_0x5c791a[_0x5d96('0x65')][_0x5d96('0x8f')][0x0];if(_0x4175b8['messageId']&&_0x4175b8[_0x5d96('0x2a')]['groupName']==='DELIVERED'){_0x4a8657=_0x4175b8[_0x5d96('0x2a')][_0x5d96('0xd1')];return db[_0x5d96('0xab')]['find']({'where':{'messageId':_0x4175b8[_0x5d96('0x85')]}});}break;case _0x5d96('0x92'):if(_0x5c791a[_0x5d96('0x65')][_0x5d96('0x85')]&&_0x5c791a[_0x5d96('0x65')][_0x5d96('0x2a')]){_0x4a8657=_0x5c791a[_0x5d96('0x65')][_0x5d96('0x2a')];return db[_0x5d96('0xab')][_0x5d96('0x5c')]({'where':{'messageId':_0x5c791a[_0x5d96('0x65')][_0x5d96('0x85')]}});}break;case _0x5d96('0xd2'):if(_0x5c791a[_0x5d96('0x65')][0x0][_0x5d96('0x26')]['id']){_0x4a8657=_0x5c791a[_0x5d96('0x65')][0x0][_0x5d96('0x42')];return db['SmsMessage'][_0x5d96('0x5c')]({'where':{'messageId':_0x5c791a[_0x5d96('0x65')][0x0][_0x5d96('0x26')]['id']}});}break;case'intelepeer':if(_0x5c791a[_0x5d96('0x65')][_0x5d96('0xd3')]&&_0x5c791a[_0x5d96('0x65')][_0x5d96('0x2a')]){_0x4a8657=_0x5c791a[_0x5d96('0x65')][_0x5d96('0x2a')];return db[_0x5d96('0xab')][_0x5d96('0x5c')]({'where':{'messageId':_0x5c791a['body']['redif']}});}break;}}})[_0x5d96('0x36')](handleEntityNotFound(_0x3151cc,null))[_0x5d96('0x36')](function(_0x596607){if(_0x596607){_0x37743a=_0x596607;switch(_0xa7c2d9['type']){case'skebby':if(_0x4a8657===_0x5d96('0xd4')){return _0x37743a[_0x5d96('0x35')]({'read':!![]});}else{logger[_0x5d96('0x25')](_0x5d96('0x23'),_0x5d96('0x2a'),_0x5d96('0x87'),util[_0x5d96('0xd5')](_0x5c791a[_0x5d96('0x65')],{'showHidden':![],'depth':null}));}break;case _0x5d96('0xcc'):if(_0x4a8657==='1'){return _0x37743a['update']({'read':!![]});}else{logger[_0x5d96('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x5d96('0x87'),util[_0x5d96('0xd5')](_0x5c791a[_0x5d96('0x65')],{'showHidden':![],'depth':null}));}break;case _0x5d96('0x8a'):if(!_0x5c791a['body'][_0x5d96('0xd6')]&&_0x4a8657>=0xc8&&_0x4a8657<=0xce){return _0x37743a['update']({'read':!![]});}else{logger[_0x5d96('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x5d96('0x8a'),util['inspect'](_0x5c791a[_0x5d96('0x65')],{'showHidden':![],'depth':null}));}break;case _0x5d96('0x8e'):var _0x38c21f=_0x5c791a[_0x5d96('0x65')][_0x5d96('0x8f')][0x0];if(_0x38c21f[_0x5d96('0x2a')]['groupName']==='DELIVERED'){return _0x37743a[_0x5d96('0x35')]({'read':!![]});}else{logger['error'](_0x5d96('0x23'),_0x5d96('0x2a'),_0x5d96('0x8e'),util[_0x5d96('0xd5')](_0x5c791a[_0x5d96('0x65')],{'showHidden':![],'depth':null}));}break;case _0x5d96('0x92'):if(_0x4a8657==_0x5d96('0xd7')||_0x4a8657==_0x5d96('0xd8')){return _0x37743a['update']({'read':!![]});}else{logger[_0x5d96('0x25')](_0x5d96('0x23'),'status',_0x5d96('0x92'),util[_0x5d96('0xd5')](_0x5c791a[_0x5d96('0x65')],{'showHidden':![],'depth':null}));}break;case _0x5d96('0xd2'):if(_0x4a8657==_0x5d96('0xd9')){return _0x37743a[_0x5d96('0x35')]({'read':!![]});}else{logger[_0x5d96('0x25')](_0x5d96('0x23'),_0x5d96('0x2a'),_0x5d96('0xd2'),util[_0x5d96('0xd5')](_0x5c791a[_0x5d96('0x65')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x4a8657===_0x5d96('0xda')||_0x4a8657===_0x5d96('0xdb')){return _0x37743a[_0x5d96('0x35')]({'read':!![]});}else{logger['error'](_0x5d96('0x23'),_0x5d96('0x2a'),_0x5d96('0x95'),util[_0x5d96('0xd5')](_0x5c791a[_0x5d96('0x65')],{'showHidden':![],'depth':null}));}break;}return _0x37743a;}})['then'](respondWithResult(_0x3151cc,null))[_0x5d96('0x28')](handleError(_0x3151cc,null));};exports[_0x5d96('0xdc')]=function(_0x3917e7,_0x4c514,_0x188837){var _0x837a52,_0xd4c1f0,_0x2a307b;return db[_0x5d96('0x54')]['find']({'where':{'id':_0x3917e7[_0x5d96('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4c514,null))['then'](function(_0xb1324e){if(_0xb1324e){_0x2a307b=_0xb1324e;logger[_0x5d96('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5d96('0x2a'),'received\x20delivery\x20report\x20from',_0xb1324e[_0x5d96('0x42')],util[_0x5d96('0xd5')](_0x3917e7[_0x5d96('0x44')],{'showHidden':![],'depth':null}));switch(_0xb1324e[_0x5d96('0x42')]){case _0x5d96('0xdd'):if(_0x3917e7[_0x5d96('0x44')]['message-id']&&_0x3917e7[_0x5d96('0x44')][_0x5d96('0xde')]){_0xd4c1f0=_0x3917e7[_0x5d96('0x44')][_0x5d96('0xde')];return db[_0x5d96('0xab')][_0x5d96('0x5c')]({'where':{'messageId':_0x3917e7[_0x5d96('0x44')]['message-id']}});}break;}}})[_0x5d96('0x36')](handleEntityNotFound(_0x4c514,null))[_0x5d96('0x36')](function(_0x5356d1){if(_0x5356d1){_0x837a52=_0x5356d1;switch(_0x2a307b[_0x5d96('0x42')]){case _0x5d96('0xdd'):if(_0xd4c1f0==='2'||_0xd4c1f0==='6'){return _0x837a52[_0x5d96('0x35')]({'read':!![]});}else{logger[_0x5d96('0x25')](_0x5d96('0x23'),'status',_0x5d96('0xdd'),util[_0x5d96('0xd5')](_0x3917e7[_0x5d96('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x837a52;}})[_0x5d96('0x36')](respondWithResult(_0x4c514,null))['catch'](handleError(_0x4c514,null));};exports[_0x5d96('0xdf')]=function(_0x5077a1,_0x53ad27,_0x17bbc8){return db[_0x5d96('0x54')]['find']({'where':{'id':_0x5077a1[_0x5d96('0x5a')]['id']}})[_0x5d96('0x36')](handleEntityNotFound(_0x53ad27,null))[_0x5d96('0x36')](function(_0x4ee724){if(_0x4ee724){return _0x4ee724[_0x5d96('0xdf')](_0x5077a1[_0x5d96('0x65')][_0x5d96('0xe0')],_[_0x5d96('0xa3')](_0x5077a1[_0x5d96('0x65')],[_0x5d96('0xe0'),'id'])||{})[_0x5d96('0xa7')](function(_0xd45bf0){for(var _0x3dd286=0x0;_0x3dd286<_0x5077a1[_0x5d96('0x65')][_0x5d96('0xe0')]['length'];_0x3dd286+=0x1){socket[_0x5d96('0xe1')](_0x5d96('0xe2'),{'UserId':Number(_0x5077a1['body'][_0x5d96('0xe0')][_0x3dd286]),'SmsAccountId':Number(_0x5077a1[_0x5d96('0x5a')]['id'])});}return _0xd45bf0;});}})[_0x5d96('0x36')](respondWithResult(_0x53ad27,null))[_0x5d96('0x28')](handleError(_0x53ad27,null));};exports['removeAgents']=function(_0x403243,_0x7f91f1,_0xe1c064){return db[_0x5d96('0x54')][_0x5d96('0x5c')]({'where':{'id':_0x403243[_0x5d96('0x5a')]['id']}})['then'](handleEntityNotFound(_0x7f91f1,null))[_0x5d96('0x36')](function(_0x5f120d){if(_0x5f120d){return _0x5f120d[_0x5d96('0xe3')](_0x403243[_0x5d96('0x44')][_0x5d96('0xe0')])[_0x5d96('0x36')](function(){if(_[_0x5d96('0xe4')](_0x403243[_0x5d96('0x44')][_0x5d96('0xe0')])){for(var _0x585917=0x0;_0x585917<_0x403243[_0x5d96('0x44')][_0x5d96('0xe0')][_0x5d96('0x48')];_0x585917+=0x1){socket[_0x5d96('0xe1')](_0x5d96('0xe5'),{'UserId':Number(_0x403243[_0x5d96('0x44')][_0x5d96('0xe0')][_0x585917]),'SmsAccountId':Number(_0x403243[_0x5d96('0x5a')]['id'])});}}else{socket[_0x5d96('0xe1')](_0x5d96('0xe5'),{'UserId':Number(_0x403243[_0x5d96('0x44')][_0x5d96('0xe0')]),'SmsAccountId':Number(_0x403243['params']['id'])});}});}})[_0x5d96('0x36')](respondWithStatusCode(_0x7f91f1,null))['catch'](handleError(_0x7f91f1,null));};exports[_0x5d96('0xe6')]=function(_0x522102,_0x188f5f,_0x12865a){var _0xd9f468={};var _0x4aa73c={};var _0x5bf8a3;var _0x296c4e;return db[_0x5d96('0x54')][_0x5d96('0x6a')]({'where':{'id':_0x522102[_0x5d96('0x5a')]['id']}})[_0x5d96('0x36')](handleEntityNotFound(_0x188f5f,null))[_0x5d96('0x36')](function(_0x400f6e){if(_0x400f6e){_0x5bf8a3=_0x400f6e;_0x4aa73c['model']=_[_0x5d96('0x5b')](db[_0x5d96('0xaf')][_0x5d96('0x40')]);_0x4aa73c[_0x5d96('0x44')]=_[_0x5d96('0x5b')](_0x522102[_0x5d96('0x44')]);_0x4aa73c[_0x5d96('0x4e')]=_[_0x5d96('0x45')](_0x4aa73c[_0x5d96('0x43')],_0x4aa73c[_0x5d96('0x44')]);_0xd9f468['attributes']=_[_0x5d96('0x45')](_0x4aa73c[_0x5d96('0x43')],qs[_0x5d96('0x46')](_0x522102[_0x5d96('0x44')][_0x5d96('0x46')]));_0xd9f468['attributes']=_0xd9f468[_0x5d96('0x47')][_0x5d96('0x48')]?_0xd9f468[_0x5d96('0x47')]:_0x4aa73c[_0x5d96('0x43')];_0xd9f468[_0x5d96('0x4b')]=qs[_0x5d96('0x4c')](_0x522102['query'][_0x5d96('0x4c')]);_0xd9f468[_0x5d96('0x4d')]=qs[_0x5d96('0x4e')](_[_0x5d96('0x4f')](_0x522102[_0x5d96('0x44')],_0x4aa73c['filters']));if(_0x522102['query']['filter']){_0xd9f468[_0x5d96('0x4d')]=_[_0x5d96('0x51')](_0xd9f468[_0x5d96('0x4d')],{'$or':_[_0x5d96('0x3f')](_0xd9f468[_0x5d96('0x47')],function(_0x2a3b5c){var _0x3671ce={};_0x3671ce[_0x2a3b5c]={'$like':'%'+_0x522102['query'][_0x5d96('0x50')]+'%'};return _0x3671ce;})});}_0xd9f468=_[_0x5d96('0x51')]({},_0xd9f468,_0x522102[_0x5d96('0x53')]);return _0x5bf8a3[_0x5d96('0xe6')](_0xd9f468);}})[_0x5d96('0x36')](function(_0x46c4a2){if(_0x46c4a2){_0x296c4e=_0x46c4a2[_0x5d96('0x48')];if(!_0x522102[_0x5d96('0x44')][_0x5d96('0x49')](_0x5d96('0x4a'))){_0xd9f468[_0x5d96('0x2e')]=qs[_0x5d96('0x2e')](_0x522102[_0x5d96('0x44')]['limit']);_0xd9f468[_0x5d96('0x30')]=qs[_0x5d96('0x30')](_0x522102[_0x5d96('0x44')][_0x5d96('0x30')]);}return _0x5bf8a3[_0x5d96('0xe6')](_0xd9f468);}})['then'](function(_0x5c4b8b){if(_0x5c4b8b){return _0x5c4b8b?{'count':_0x296c4e,'rows':_0x5c4b8b}:null;}})[_0x5d96('0x36')](respondWithResult(_0x188f5f,null))[_0x5d96('0x28')](handleError(_0x188f5f,null));}; \ No newline at end of file +var _0x1179=['addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','order','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','SmsApplication','Applications','applications','priority','account','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','Body','MessageSid','skebby','sender','text','connectel','clicksend','message_id','Text','MessageUUID','infobip','results','messageId','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','defaults','SmsInteraction','interaction','get','created','autoclose','push','unmanaged','ContactId','AttachmentId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','send','\x0a','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tags','color','tag','List','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','redif','DELIVERED','inspect','update','error_code','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','csc','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','SmsAccounts','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe'];(function(_0x53eb7e,_0x93ace8){var _0x36eea5=function(_0x3cf850){while(--_0x3cf850){_0x53eb7e['push'](_0x53eb7e['shift']());}};_0x36eea5(++_0x93ace8);}(_0x1179,0x14d));var _0x9117=function(_0x4ce875,_0x202932){_0x4ce875=_0x4ce875-0x0;var _0x2cbeb9=_0x1179[_0x4ce875];return _0x2cbeb9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9117('0x0'));var rp=require(_0x9117('0x1'));var moment=require(_0x9117('0x2'));var BPromise=require(_0x9117('0x3'));var Mustache=require('mustache');var util=require(_0x9117('0x4'));var path=require(_0x9117('0x5'));var sox=require(_0x9117('0x6'));var csv=require(_0x9117('0x7'));var ejs=require(_0x9117('0x8'));var fs=require('fs');var fs_extra=require(_0x9117('0x9'));var _=require(_0x9117('0xa'));var squel=require(_0x9117('0xb'));var crypto=require('crypto');var jsforce=require(_0x9117('0xc'));var deskjs=require(_0x9117('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9117('0xe'));var authService=require(_0x9117('0xf'));var qs=require(_0x9117('0x10'));var as=require(_0x9117('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9117('0x12'));var licenseUtil=require(_0x9117('0x13'));var db=require(_0x9117('0x14'))['db'];config[_0x9117('0x15')]=_['defaults'](config[_0x9117('0x15')],{'host':_0x9117('0x16'),'port':0x18eb});var socket=require(_0x9117('0x17'))(new Redis(config['redis']));require(_0x9117('0x18'))['register'](socket);var jayson=require(_0x9117('0x19'));var client=jayson[_0x9117('0x1a')][_0x9117('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x2ca4a0,_0x54ab4c,_0x275283,_0x3d0f2d){return new BPromise(function(_0x5d8893,_0x45b643){var _0x55125e=_0x3d0f2d||client;return _0x55125e['request'](_0x2ca4a0,_0x275283)[_0x9117('0x1c')](function(_0x2546b6){logger[_0x9117('0x1d')](_0x9117('0x1e'),_0x54ab4c,_0x9117('0x1f'));logger[_0x9117('0x20')](_0x9117('0x21'),_0x54ab4c,_0x9117('0x1f'),JSON[_0x9117('0x22')](_0x2546b6));if(_0x2546b6['error']){if(_0x2546b6[_0x9117('0x23')]['code']===0x1f4){logger[_0x9117('0x23')](_0x9117('0x1e'),_0x54ab4c,_0x2546b6[_0x9117('0x23')][_0x9117('0x24')]);return _0x45b643(_0x2546b6[_0x9117('0x23')][_0x9117('0x24')]);}logger[_0x9117('0x23')](_0x9117('0x1e'),_0x54ab4c,_0x2546b6[_0x9117('0x23')][_0x9117('0x24')]);return _0x5d8893(_0x2546b6[_0x9117('0x23')]['message']);}else{logger[_0x9117('0x1d')](_0x9117('0x1e'),_0x54ab4c,_0x9117('0x1f'));_0x5d8893(_0x2546b6[_0x9117('0x25')]['message']);}})['catch'](function(_0x1ff92d){logger['error'](_0x9117('0x1e'),_0x54ab4c,_0x1ff92d);_0x45b643(_0x1ff92d);});});}function respondWithStatusCode(_0x466f7e,_0x17bfe8){_0x17bfe8=_0x17bfe8||0xcc;return function(_0x4c37c1){if(_0x4c37c1){return _0x466f7e[_0x9117('0x26')](_0x17bfe8);}return _0x466f7e['status'](_0x17bfe8)[_0x9117('0x27')]();};}function respondWithResult(_0x1da58b,_0x355f62){_0x355f62=_0x355f62||0xc8;return function(_0x281a4e){if(_0x281a4e){return _0x1da58b[_0x9117('0x28')](_0x355f62)[_0x9117('0x29')](_0x281a4e);}};}function respondWithFilteredResult(_0x317ac4,_0x5177ed){return function(_0x1800fb){if(_0x1800fb){var _0x9573c1=typeof _0x5177ed[_0x9117('0x2a')]==='undefined'&&typeof _0x5177ed[_0x9117('0x2b')]===_0x9117('0x2c');var _0x3bfbe3=_0x1800fb['count'];var _0x5a83d5=_0x9573c1?0x0:_0x5177ed['offset'];var _0x4aba72=_0x9573c1?_0x1800fb[_0x9117('0x2d')]:_0x5177ed[_0x9117('0x2a')]+_0x5177ed[_0x9117('0x2b')];var _0x1b06f9;if(_0x4aba72>=_0x3bfbe3){_0x4aba72=_0x3bfbe3;_0x1b06f9=0xc8;}else{_0x1b06f9=0xce;}_0x317ac4['status'](_0x1b06f9);return _0x317ac4[_0x9117('0x2e')](_0x9117('0x2f'),_0x5a83d5+'-'+_0x4aba72+'/'+_0x3bfbe3)['json'](_0x1800fb);}return null;};}function patchUpdates(_0x5439a7){return function(_0x301414){try{jsonpatch[_0x9117('0x30')](_0x301414,_0x5439a7,!![]);}catch(_0x2a81ea){return BPromise[_0x9117('0x31')](_0x2a81ea);}return _0x301414[_0x9117('0x32')]();};}function saveUpdates(_0x40af0a,_0x4f7bfe){return function(_0x5d8635){if(_0x5d8635){return _0x5d8635['update'](_0x40af0a)['then'](function(_0x30d954){return _0x30d954;});}return null;};}function removeEntity(_0x4badf0,_0x88bdbe){return function(_0x484f5d){if(_0x484f5d){return _0x484f5d[_0x9117('0x33')]()[_0x9117('0x1c')](function(){var _0x18899c=_0x484f5d['get']({'plain':!![]});var _0x48c627=_0x9117('0x34');return db[_0x9117('0x35')]['destroy']({'where':{'type':_0x48c627,'resourceId':_0x18899c['id']}})[_0x9117('0x1c')](function(){return _0x484f5d;});})[_0x9117('0x1c')](function(){_0x4badf0['status'](0xcc)[_0x9117('0x27')]();});}};}function handleEntityNotFound(_0x36bb7b,_0x341baa){return function(_0x128363){if(!_0x128363){_0x36bb7b[_0x9117('0x26')](0x194);}return _0x128363;};}function handleError(_0x5911e5,_0x23ca4d){_0x23ca4d=_0x23ca4d||0x1f4;return function(_0x56c46d){logger[_0x9117('0x23')](_0x56c46d[_0x9117('0x36')]);if(_0x56c46d['name']){delete _0x56c46d[_0x9117('0x37')];}_0x5911e5['status'](_0x23ca4d)['send'](_0x56c46d);};}exports['index']=function(_0x5a6af2,_0x2086dd){var _0x30ef00={'include':[{'model':db[_0x9117('0x38')],'as':_0x9117('0x39')}]},_0x34b211={},_0x5a8ab9={'count':0x0,'rows':[]};var _0x17f006=_[_0x9117('0x3a')](db[_0x9117('0x3b')][_0x9117('0x3c')],function(_0x6c4034){return{'name':_0x6c4034[_0x9117('0x3d')],'type':_0x6c4034[_0x9117('0x3e')][_0x9117('0x3f')]};});_0x34b211[_0x9117('0x40')]=_[_0x9117('0x3a')](_0x17f006,_0x9117('0x37'));_0x34b211[_0x9117('0x41')]=_[_0x9117('0x42')](_0x5a6af2[_0x9117('0x41')]);_0x34b211[_0x9117('0x43')]=_[_0x9117('0x44')](_0x34b211[_0x9117('0x40')],_0x34b211['query']);_0x30ef00['attributes']=_[_0x9117('0x44')](_0x34b211[_0x9117('0x40')],qs[_0x9117('0x45')](_0x5a6af2['query']['fields']));_0x30ef00[_0x9117('0x46')]=_0x30ef00[_0x9117('0x46')][_0x9117('0x47')]?_0x30ef00[_0x9117('0x46')]:_0x34b211[_0x9117('0x40')];if(!_0x5a6af2[_0x9117('0x41')][_0x9117('0x48')]('nolimit')){_0x30ef00[_0x9117('0x2b')]=qs[_0x9117('0x2b')](_0x5a6af2['query'][_0x9117('0x2b')]);_0x30ef00['offset']=qs[_0x9117('0x2a')](_0x5a6af2[_0x9117('0x41')][_0x9117('0x2a')]);}_0x30ef00['order']=qs[_0x9117('0x49')](_0x5a6af2[_0x9117('0x41')][_0x9117('0x49')]);_0x30ef00[_0x9117('0x4a')]=qs[_0x9117('0x43')](_[_0x9117('0x4b')](_0x5a6af2['query'],_0x34b211['filters']),_0x17f006);if(_0x5a6af2[_0x9117('0x41')]['filter']){_0x30ef00[_0x9117('0x4a')]=_['merge'](_0x30ef00[_0x9117('0x4a')],{'$or':_[_0x9117('0x3a')](_0x17f006,function(_0x34ac20){if(_0x34ac20['type']!==_0x9117('0x4c')){var _0x188fef={};_0x188fef[_0x34ac20['name']]={'$like':'%'+_0x5a6af2[_0x9117('0x41')][_0x9117('0x4d')]+'%'};return _0x188fef;}})});}_0x30ef00=_[_0x9117('0x4e')]({},_0x30ef00,_0x5a6af2['options']);var _0x4749e3={'where':_0x30ef00[_0x9117('0x4a')]};return db['SmsAccount'][_0x9117('0x2d')](_0x4749e3)[_0x9117('0x1c')](function(_0x4805e1){_0x5a8ab9['count']=_0x4805e1;if(_0x5a6af2[_0x9117('0x41')][_0x9117('0x4f')]){_0x30ef00[_0x9117('0x50')]=[{'all':!![]}];}return db[_0x9117('0x3b')][_0x9117('0x51')](_0x30ef00);})['then'](function(_0x10b0d8){_0x5a8ab9['rows']=_0x10b0d8;return _0x5a8ab9;})[_0x9117('0x1c')](respondWithFilteredResult(_0x2086dd,_0x30ef00))[_0x9117('0x52')](handleError(_0x2086dd,null));};exports[_0x9117('0x53')]=function(_0x54ebb1,_0x3b5609){var _0x2ebc85={'raw':![],'where':{'id':_0x54ebb1[_0x9117('0x54')]['id']},'include':[{'model':db[_0x9117('0x38')],'as':_0x9117('0x39')}]},_0x3d23c3={};_0x3d23c3['model']=_[_0x9117('0x42')](db[_0x9117('0x3b')][_0x9117('0x3c')]);_0x3d23c3[_0x9117('0x41')]=_[_0x9117('0x42')](_0x54ebb1[_0x9117('0x41')]);_0x3d23c3[_0x9117('0x43')]=_['intersection'](_0x3d23c3[_0x9117('0x40')],_0x3d23c3['query']);_0x2ebc85['attributes']=_[_0x9117('0x44')](_0x3d23c3[_0x9117('0x40')],qs[_0x9117('0x45')](_0x54ebb1[_0x9117('0x41')][_0x9117('0x45')]));_0x2ebc85[_0x9117('0x46')]=_0x2ebc85[_0x9117('0x46')][_0x9117('0x47')]?_0x2ebc85[_0x9117('0x46')]:_0x3d23c3['model'];if(_0x54ebb1[_0x9117('0x41')][_0x9117('0x4f')]){_0x2ebc85[_0x9117('0x50')]=[{'all':!![]}];}_0x2ebc85=_['merge']({},_0x2ebc85,_0x54ebb1[_0x9117('0x55')]);return db[_0x9117('0x3b')][_0x9117('0x56')](_0x2ebc85)[_0x9117('0x1c')](handleEntityNotFound(_0x3b5609,null))[_0x9117('0x1c')](respondWithResult(_0x3b5609,null))[_0x9117('0x52')](handleError(_0x3b5609,null));};exports[_0x9117('0x57')]=function(_0x2b49e2,_0x1b7bca){return db[_0x9117('0x3b')]['create'](_0x2b49e2[_0x9117('0x58')],{})[_0x9117('0x1c')](function(_0x5c3111){var _0x441257=_0x2b49e2[_0x9117('0x59')]['get']({'plain':!![]});if(!_0x441257)throw new Error(_0x9117('0x5a'));if(_0x441257[_0x9117('0x5b')]===_0x9117('0x59')){var _0x2eed57=_0x5c3111['get']({'plain':!![]});var _0x120b68=_0x9117('0x34');return db[_0x9117('0x5c')][_0x9117('0x56')]({'where':{'name':_0x120b68,'userProfileId':_0x441257[_0x9117('0x5d')]},'raw':!![]})[_0x9117('0x1c')](function(_0x371038){if(_0x371038&&_0x371038[_0x9117('0x5e')]===0x0){return db[_0x9117('0x35')][_0x9117('0x57')]({'name':_0x2eed57[_0x9117('0x37')],'resourceId':_0x2eed57['id'],'type':_0x371038[_0x9117('0x37')],'sectionId':_0x371038['id']},{})[_0x9117('0x1c')](function(){return _0x5c3111;});}else{return _0x5c3111;}})[_0x9117('0x52')](function(_0xa48d2d){logger[_0x9117('0x23')](_0x9117('0x5f'),_0xa48d2d);throw _0xa48d2d;});}return _0x5c3111;})[_0x9117('0x1c')](respondWithResult(_0x1b7bca,0xc9))['catch'](handleError(_0x1b7bca,null));};exports['update']=function(_0x1da32a,_0x4a3805){if(_0x1da32a['body']['id']){delete _0x1da32a[_0x9117('0x58')]['id'];}return db[_0x9117('0x3b')][_0x9117('0x56')]({'where':{'id':_0x1da32a[_0x9117('0x54')]['id']},'include':[{'model':db[_0x9117('0x38')],'as':_0x9117('0x39')}]})[_0x9117('0x1c')](handleEntityNotFound(_0x4a3805,null))[_0x9117('0x1c')](saveUpdates(_0x1da32a[_0x9117('0x58')],null))[_0x9117('0x1c')](respondWithResult(_0x4a3805,null))['catch'](handleError(_0x4a3805,null));};exports[_0x9117('0x33')]=function(_0x4d9a2e,_0x129e81){return db[_0x9117('0x3b')][_0x9117('0x56')]({'where':{'id':_0x4d9a2e['params']['id']}})[_0x9117('0x1c')](handleEntityNotFound(_0x129e81,null))[_0x9117('0x1c')](removeEntity(_0x129e81,null))['catch'](handleError(_0x129e81,null));};exports[_0x9117('0x60')]=function(_0x4bf525,_0x383118){return db[_0x9117('0x3b')]['describe']()[_0x9117('0x1c')](respondWithResult(_0x383118,null))[_0x9117('0x52')](handleError(_0x383118,null));};exports[_0x9117('0x61')]=function(_0x16a1ea,_0x490f64,_0x45f36b){if(_0x16a1ea[_0x9117('0x58')]['id']){delete _0x16a1ea['body']['id'];}return db[_0x9117('0x3b')][_0x9117('0x56')]({'where':{'id':_0x16a1ea['params']['id']}})['then'](handleEntityNotFound(_0x490f64,null))[_0x9117('0x1c')](function(_0x51839a){if(_0x51839a){_0x16a1ea[_0x9117('0x58')][_0x9117('0x62')]=_0x51839a['id'];return db[_0x9117('0x63')][_0x9117('0x57')](_0x16a1ea[_0x9117('0x58')]);}})[_0x9117('0x1c')](respondWithResult(_0x490f64,null))[_0x9117('0x52')](handleError(_0x490f64,null));};exports[_0x9117('0x64')]=function(_0x5255f1,_0x1a5457,_0x1d84a6){var _0x21fb62={'raw':![],'where':{}};var _0x548cce={};var _0x58049b={'count':0x0,'rows':[]};return db['SmsAccount'][_0x9117('0x65')]({'where':{'id':_0x5255f1[_0x9117('0x54')]['id']}})[_0x9117('0x1c')](handleEntityNotFound(_0x1a5457,null))['then'](function(_0x57fa6c){if(_0x57fa6c){_0x548cce[_0x9117('0x40')]=_[_0x9117('0x42')](db[_0x9117('0x63')]['rawAttributes']);_0x548cce[_0x9117('0x41')]=_[_0x9117('0x42')](_0x5255f1['query']);_0x548cce[_0x9117('0x43')]=_[_0x9117('0x44')](_0x548cce[_0x9117('0x40')],_0x548cce[_0x9117('0x41')]);_0x21fb62[_0x9117('0x46')]=_[_0x9117('0x44')](_0x548cce[_0x9117('0x40')],qs['fields'](_0x5255f1[_0x9117('0x41')][_0x9117('0x45')]));_0x21fb62[_0x9117('0x46')]=_0x21fb62[_0x9117('0x46')][_0x9117('0x47')]?_0x21fb62[_0x9117('0x46')]:_0x548cce[_0x9117('0x40')];if(!_0x5255f1[_0x9117('0x41')][_0x9117('0x48')](_0x9117('0x66'))){_0x21fb62['limit']=qs[_0x9117('0x2b')](_0x5255f1[_0x9117('0x41')][_0x9117('0x2b')]);_0x21fb62['offset']=qs[_0x9117('0x2a')](_0x5255f1[_0x9117('0x41')][_0x9117('0x2a')]);}_0x21fb62[_0x9117('0x67')]=qs['sort'](_0x5255f1[_0x9117('0x41')][_0x9117('0x49')]);_0x21fb62['where']=qs[_0x9117('0x43')](_['pick'](_0x5255f1[_0x9117('0x41')],_0x548cce[_0x9117('0x43')]));_0x21fb62[_0x9117('0x4a')]['SmsAccountId']=_0x57fa6c['id'];if(_0x5255f1[_0x9117('0x41')]['filter']){_0x21fb62[_0x9117('0x4a')]=_[_0x9117('0x4e')](_0x21fb62[_0x9117('0x4a')],{'$or':_[_0x9117('0x3a')](_0x21fb62[_0x9117('0x46')],function(_0x376890){var _0x2e68e4={};_0x2e68e4[_0x376890]={'$like':'%'+_0x5255f1[_0x9117('0x41')]['filter']+'%'};return _0x2e68e4;})});}_0x21fb62=_[_0x9117('0x4e')]({},_0x21fb62,_0x5255f1[_0x9117('0x55')]);return db[_0x9117('0x63')]['count']({'where':_0x21fb62[_0x9117('0x4a')]})['then'](function(_0x544906){_0x58049b[_0x9117('0x2d')]=_0x544906;if(_0x5255f1[_0x9117('0x41')][_0x9117('0x4f')]){_0x21fb62[_0x9117('0x50')]=[{'all':!![]}];}return db[_0x9117('0x63')]['findAll'](_0x21fb62);})['then'](function(_0x460039){_0x58049b[_0x9117('0x68')]=_0x460039;return _0x58049b;});}})[_0x9117('0x1c')](respondWithFilteredResult(_0x1a5457,_0x21fb62))['catch'](handleError(_0x1a5457,null));};exports[_0x9117('0x69')]=function(_0x2d5fd3,_0x4a70b9,_0x231c4c){return db[_0x9117('0x3b')][_0x9117('0x56')]({'where':{'id':_0x2d5fd3[_0x9117('0x54')]['id']}})[_0x9117('0x1c')](handleEntityNotFound(_0x4a70b9,null))[_0x9117('0x1c')](function(_0x1a1e83){if(_0x1a1e83){return _0x1a1e83['removeDispositions'](_0x2d5fd3[_0x9117('0x41')][_0x9117('0x6a')]);}})[_0x9117('0x1c')](respondWithStatusCode(_0x4a70b9,null))[_0x9117('0x52')](handleError(_0x4a70b9,null));};exports[_0x9117('0x6b')]=function(_0x1d9557,_0x22aa26,_0x1ee8ae){if(_0x1d9557[_0x9117('0x58')]['id']){delete _0x1d9557['body']['id'];}return db[_0x9117('0x3b')][_0x9117('0x56')]({'where':{'id':_0x1d9557[_0x9117('0x54')]['id']}})[_0x9117('0x1c')](handleEntityNotFound(_0x22aa26,null))[_0x9117('0x1c')](function(_0x50d692){if(_0x50d692){_0x1d9557[_0x9117('0x58')][_0x9117('0x62')]=_0x50d692['id'];return db[_0x9117('0x6c')]['create'](_0x1d9557[_0x9117('0x58')]);}})['then'](respondWithResult(_0x22aa26,null))[_0x9117('0x52')](handleError(_0x22aa26,null));};exports['getAnswers']=function(_0x28007a,_0x1e043d,_0x423532){var _0x3dc92c={'raw':![],'where':{}};var _0x33c4eb={};var _0x355304={'count':0x0,'rows':[]};return db['SmsAccount'][_0x9117('0x65')]({'where':{'id':_0x28007a[_0x9117('0x54')]['id']}})[_0x9117('0x1c')](handleEntityNotFound(_0x1e043d,null))[_0x9117('0x1c')](function(_0x1445e3){if(_0x1445e3){_0x33c4eb[_0x9117('0x40')]=_[_0x9117('0x42')](db[_0x9117('0x6c')][_0x9117('0x3c')]);_0x33c4eb[_0x9117('0x41')]=_[_0x9117('0x42')](_0x28007a['query']);_0x33c4eb['filters']=_['intersection'](_0x33c4eb[_0x9117('0x40')],_0x33c4eb[_0x9117('0x41')]);_0x3dc92c[_0x9117('0x46')]=_[_0x9117('0x44')](_0x33c4eb[_0x9117('0x40')],qs[_0x9117('0x45')](_0x28007a[_0x9117('0x41')][_0x9117('0x45')]));_0x3dc92c[_0x9117('0x46')]=_0x3dc92c[_0x9117('0x46')][_0x9117('0x47')]?_0x3dc92c[_0x9117('0x46')]:_0x33c4eb['model'];if(!_0x28007a[_0x9117('0x41')][_0x9117('0x48')](_0x9117('0x66'))){_0x3dc92c[_0x9117('0x2b')]=qs[_0x9117('0x2b')](_0x28007a['query'][_0x9117('0x2b')]);_0x3dc92c[_0x9117('0x2a')]=qs[_0x9117('0x2a')](_0x28007a['query']['offset']);}_0x3dc92c[_0x9117('0x67')]=qs[_0x9117('0x49')](_0x28007a[_0x9117('0x41')][_0x9117('0x49')]);_0x3dc92c[_0x9117('0x4a')]=qs['filters'](_[_0x9117('0x4b')](_0x28007a[_0x9117('0x41')],_0x33c4eb[_0x9117('0x43')]));_0x3dc92c[_0x9117('0x4a')][_0x9117('0x62')]=_0x1445e3['id'];if(_0x28007a[_0x9117('0x41')][_0x9117('0x4d')]){_0x3dc92c[_0x9117('0x4a')]=_[_0x9117('0x4e')](_0x3dc92c['where'],{'$or':_['map'](_0x3dc92c[_0x9117('0x46')],function(_0x574779){var _0x367515={};_0x367515[_0x574779]={'$like':'%'+_0x28007a[_0x9117('0x41')]['filter']+'%'};return _0x367515;})});}_0x3dc92c=_['merge']({},_0x3dc92c,_0x28007a['options']);return db[_0x9117('0x6c')][_0x9117('0x2d')]({'where':_0x3dc92c['where']})['then'](function(_0x130b9f){_0x355304[_0x9117('0x2d')]=_0x130b9f;if(_0x28007a[_0x9117('0x41')][_0x9117('0x4f')]){_0x3dc92c[_0x9117('0x50')]=[{'all':!![]}];}return db[_0x9117('0x6c')][_0x9117('0x51')](_0x3dc92c);})[_0x9117('0x1c')](function(_0x126865){_0x355304['rows']=_0x126865;return _0x355304;});}})['then'](respondWithFilteredResult(_0x1e043d,_0x3dc92c))['catch'](handleError(_0x1e043d,null));};exports['removeAnswers']=function(_0x18732b,_0x5719cb,_0x16143){return db[_0x9117('0x3b')][_0x9117('0x56')]({'where':{'id':_0x18732b[_0x9117('0x54')]['id']}})[_0x9117('0x1c')](handleEntityNotFound(_0x5719cb,null))[_0x9117('0x1c')](function(_0x23f46b){if(_0x23f46b){return _0x23f46b[_0x9117('0x6d')](_0x18732b['query'][_0x9117('0x6a')]);}})[_0x9117('0x1c')](respondWithStatusCode(_0x5719cb,null))[_0x9117('0x52')](handleError(_0x5719cb,null));};exports[_0x9117('0x6e')]=function(_0x52bb88,_0x584c61,_0x702c90){var _0x7a7b71={'channel':'sms'};var _0x10547d=[];var _0x184166=[];var _0x1836aa={};return db[_0x9117('0x3b')]['find']({'where':{'id':_0x52bb88['params']['id']},'include':[{'model':db[_0x9117('0x6f')],'as':_0x9117('0x70')}]})[_0x9117('0x1c')](handleEntityNotFound(_0x584c61,null))['then'](function(_0x3a97a9){_0x7a7b71['account']=_0x3a97a9;_0x7a7b71[_0x9117('0x71')]=_['orderBy'](_0x3a97a9['Applications'],[_0x9117('0x72')],['asc']);if(_0x7a7b71[_0x9117('0x73')][_0x9117('0x70')]){delete _0x7a7b71['account']['Applications'];}return db[_0x9117('0x74')][_0x9117('0x60')]();})[_0x9117('0x1c')](function(_0x5586bc){if(!_0x5586bc){throw new db[(_0x9117('0x75'))]['ValidationError'](_0x9117('0x76'));}_0x10547d=_[_0x9117('0x77')](_['keys'](_0x5586bc),[_0x9117('0x78'),_0x9117('0x79')]);_0x184166=_[_0x9117('0x77')](_[_0x9117('0x42')](_0x5586bc),[_0x9117('0x78'),'updatedAt','CompanyId',_0x9117('0x7a')]);_0x7a7b71[_0x9117('0x58')]={'mapKey':_0x9117('0x7b')};if(_0x7a7b71[_0x9117('0x73')][_0x9117('0x3e')]){switch(_0x7a7b71[_0x9117('0x73')][_0x9117('0x3e')]){case _0x9117('0x7c'):_0x7a7b71['body'][_0x9117('0x7d')]=_0x52bb88[_0x9117('0x58')][_0x9117('0x7e')];_0x7a7b71[_0x9117('0x58')][_0x9117('0x58')]=_0x52bb88['body'][_0x9117('0x7f')];_0x7a7b71[_0x9117('0x58')]['messageId']=_0x52bb88[_0x9117('0x58')][_0x9117('0x80')];break;case _0x9117('0x81'):_0x7a7b71[_0x9117('0x58')][_0x9117('0x7d')]='+'+_0x52bb88[_0x9117('0x58')][_0x9117('0x82')];_0x7a7b71[_0x9117('0x58')][_0x9117('0x58')]=_0x52bb88[_0x9117('0x58')][_0x9117('0x83')];break;case _0x9117('0x84'):_0x7a7b71['body'][_0x9117('0x7d')]=_0x52bb88[_0x9117('0x58')][_0x9117('0x7d')];_0x7a7b71[_0x9117('0x58')][_0x9117('0x58')]=_0x52bb88['body']['message'];break;case _0x9117('0x85'):_0x7a7b71[_0x9117('0x58')][_0x9117('0x7d')]=_0x52bb88['body'][_0x9117('0x7d')];_0x7a7b71['body'][_0x9117('0x58')]=_0x52bb88[_0x9117('0x58')][_0x9117('0x58')];_0x7a7b71[_0x9117('0x58')]['messageId']=_0x52bb88[_0x9117('0x58')][_0x9117('0x86')];break;case'plivo':_0x7a7b71[_0x9117('0x58')][_0x9117('0x7d')]=_0x52bb88[_0x9117('0x58')][_0x9117('0x7e')];_0x7a7b71['body'][_0x9117('0x58')]=_0x52bb88[_0x9117('0x58')][_0x9117('0x87')];_0x7a7b71[_0x9117('0x58')]['messageId']=_0x52bb88[_0x9117('0x58')][_0x9117('0x88')];break;case _0x9117('0x89'):_0x7a7b71[_0x9117('0x58')][_0x9117('0x7d')]='+'+_0x52bb88[_0x9117('0x58')]['results'][0x0][_0x9117('0x7d')];_0x7a7b71[_0x9117('0x58')][_0x9117('0x58')]=_0x52bb88[_0x9117('0x58')][_0x9117('0x8a')][0x0]['text'];_0x7a7b71[_0x9117('0x58')][_0x9117('0x8b')]=_0x52bb88[_0x9117('0x58')]['results'][0x0][_0x9117('0x8b')];break;case'csc':_0x7a7b71['body'][_0x9117('0x7d')]=_0x52bb88['body'][_0x9117('0x8c')];_0x7a7b71[_0x9117('0x58')][_0x9117('0x58')]=_0x52bb88[_0x9117('0x58')]['segmentedMessage']['message'];break;case _0x9117('0x8d'):_0x7a7b71[_0x9117('0x58')][_0x9117('0x7d')]=_0x52bb88[_0x9117('0x58')][_0x9117('0x8e')];_0x7a7b71[_0x9117('0x58')][_0x9117('0x58')]=_0x52bb88[_0x9117('0x58')]['text'];_0x7a7b71[_0x9117('0x58')]['messageId']=_0x52bb88[_0x9117('0x58')][_0x9117('0x8f')];break;case _0x9117('0x90'):_0x7a7b71[_0x9117('0x58')]['messageId']=_0x52bb88[_0x9117('0x58')][0x0][_0x9117('0x24')]['id'];_0x7a7b71[_0x9117('0x58')][_0x9117('0x7d')]=_0x52bb88[_0x9117('0x58')][0x0][_0x9117('0x24')][_0x9117('0x7d')];_0x7a7b71['body']['body']=_0x52bb88['body'][0x0][_0x9117('0x24')]['text'];break;case _0x9117('0x91'):_0x7a7b71[_0x9117('0x58')][_0x9117('0x7d')]=_0x52bb88[_0x9117('0x58')][_0x9117('0x7d')];_0x7a7b71[_0x9117('0x58')][_0x9117('0x58')]=_0x52bb88[_0x9117('0x58')][_0x9117('0x24')];_0x7a7b71[_0x9117('0x58')]['messageId']=_0x52bb88[_0x9117('0x58')]['refid'];break;}}if(_0x7a7b71[_0x9117('0x58')]['id']){delete _0x7a7b71[_0x9117('0x58')]['id'];}if(_[_0x9117('0x92')](_0x7a7b71[_0x9117('0x58')][_0x9117('0x7d')])){throw new db[(_0x9117('0x75'))][(_0x9117('0x93'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x7a7b71[_0x9117('0x58')][_0x9117('0x58')])||_0x7a7b71['body'][_0x9117('0x58')]===''){throw new db[(_0x9117('0x75'))][(_0x9117('0x93'))](_0x9117('0x94'));}if(_[_0x9117('0x92')](_0x7a7b71[_0x9117('0x58')][_0x9117('0x95')])){throw new db[(_0x9117('0x75'))][(_0x9117('0x93'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x184166);}if(!_[_0x9117('0x96')](_0x184166,_0x7a7b71[_0x9117('0x58')][_0x9117('0x95')])){throw new db[(_0x9117('0x75'))][(_0x9117('0x93'))](_0x9117('0x97')+_0x184166);}_0x1836aa[_0x7a7b71[_0x9117('0x58')][_0x9117('0x95')]]=_0x7a7b71[_0x9117('0x58')]['from'];return db['CmList'][_0x9117('0x56')]({'where':{'id':_0x7a7b71[_0x9117('0x73')][_0x9117('0x7a')]},'include':[{'model':db['CmContact'],'as':_0x9117('0x98'),'where':_0x1836aa,'limit':0x1,'order':[[_0x9117('0x79'),_0x9117('0x99')]]}]});})[_0x9117('0x1c')](handleEntityNotFound(_0x584c61,null))[_0x9117('0x1c')](function(_0x5c7c2d){if(_0x5c7c2d){_0x7a7b71[_0x9117('0x9a')]=_[_0x9117('0x9b')](_0x5c7c2d,[_0x9117('0x98')]);if(_0x5c7c2d['Contacts'][_0x9117('0x47')]){return _0x5c7c2d[_0x9117('0x98')][0x0];}var _0x324e3d=_[_0x9117('0x9c')](_0x7a7b71[_0x9117('0x58')],{'firstName':_0x7a7b71[_0x9117('0x58')][_0x9117('0x7d')],'ListId':_0x5c7c2d['id']});_0x324e3d[_0x7a7b71[_0x9117('0x58')][_0x9117('0x95')]]=_0x7a7b71['body'][_0x9117('0x7d')];return db['CmContact'][_0x9117('0x57')](_0x324e3d,{'fields':_0x10547d,'raw':!![]});}})['then'](handleEntityNotFound(_0x584c61,null))[_0x9117('0x1c')](function(_0x524b38){if(_0x524b38){_0x7a7b71['contact']=_0x524b38;var _0x423732={'ContactId':_0x524b38['id'],'phone':_0x7a7b71[_0x9117('0x58')][_0x9117('0x7d')],'SmsAccountId':_0x52bb88[_0x9117('0x54')]['id']};var _0x505ebb={'ContactId':_0x524b38['id'],'SmsAccountId':_0x52bb88[_0x9117('0x54')]['id'],'closed':![]};return db['SmsInteraction'][_0x9117('0x56')]({'where':_0x505ebb})[_0x9117('0x1c')](function(_0x3f8668){if(_0x3f8668){return[_0x3f8668,![]];}return db[_0x9117('0x9d')][_0x9117('0x57')](_0x423732)['then'](function(_0x4c2cd0){return[_0x4c2cd0,!![]];});});}})['spread'](function(_0xe74c3f,_0x431648){_0x7a7b71[_0x9117('0x9e')]=_0xe74c3f[_0x9117('0x9f')]({'plain':!![]});_0x7a7b71[_0x9117('0x9e')][_0x9117('0xa0')]=![];if(_0x431648){if(_0x7a7b71[_0x9117('0x73')][_0x9117('0xa1')]){_0x7a7b71[_0x9117('0x71')][_0x9117('0xa2')]({'id':0x0,'priority':_0x7a7b71[_0x9117('0x71')]['length']+0x1,'app':'close','appdata':_0x9117('0xa3'),'interval':'*,*,*,*'});}_0x7a7b71[_0x9117('0x9e')][_0x9117('0xa0')]=!![];}return db['SmsMessage'][_0x9117('0x57')]({'phone':_0x7a7b71[_0x9117('0x58')][_0x9117('0x7d')],'messageId':_0x7a7b71[_0x9117('0x58')][_0x9117('0x8b')],'body':_0x7a7b71['body'][_0x9117('0x58')],'SmsAccountId':_0x52bb88['params']['id'],'SmsInteractionId':_0xe74c3f['id'],'direction':'in','ContactId':_0xe74c3f[_0x9117('0xa4')],'AttachmentId':_0x7a7b71[_0x9117('0x58')][_0x9117('0xa5')]});})[_0x9117('0x1c')](function(_0x2d9877){_0x7a7b71[_0x9117('0x24')]=_0x2d9877;if(_0x7a7b71[_0x9117('0x9e')]['UserId']){return db['User'][_0x9117('0x56')]({'attributes':['id',_0x9117('0x37')],'where':{'id':_0x7a7b71[_0x9117('0x9e')]['UserId']}})[_0x9117('0x1c')](function(_0x3f0551){if(_0x3f0551){_0x7a7b71[_0x9117('0x71')][_0x9117('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3f0551[_0x9117('0x37')]+','+(_0x7a7b71[_0x9117('0x73')][_0x9117('0xa7')]||0xa),'interval':_0x9117('0xa8')});}return respondWithRpcPromise(_0x9117('0xa9'),_0x9117('0xaa'),_0x7a7b71);});}return respondWithRpcPromise(_0x9117('0xa9'),_0x9117('0xaa'),_0x7a7b71);})[_0x9117('0x1c')](function(_0x2fefe4){if(_0x2fefe4){var _0x3d3d63=0xc8;var _0x59cd03=_0x9117('0xab');logger[_0x9117('0x1d')](_0x9117('0x21'),_0x59cd03,_0x3d3d63,_0x9117('0xac'));logger[_0x9117('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x59cd03,_0x3d3d63,_0x9117('0xac'),JSON[_0x9117('0x22')](_0x2fefe4));if(_0x7a7b71['account'][_0x9117('0x3e')]===_0x9117('0x7c')){return _0x584c61[_0x9117('0x28')](_0x3d3d63)['set'](_0x9117('0xad'),_0x9117('0xae'))[_0x9117('0xaf')](_0x9117('0xb0'));}else{return _0x584c61['status'](_0x3d3d63)[_0x9117('0x29')](_0x2fefe4);}}})[_0x9117('0x52')](handleError(_0x584c61,null));};exports['addApplications']=function(_0x2ed6c0,_0x3b5421,_0x5ac108){return db[_0x9117('0x3b')][_0x9117('0x65')]({'where':{'id':_0x2ed6c0[_0x9117('0x54')]['id']}})[_0x9117('0x1c')](handleEntityNotFound(_0x3b5421,null))[_0x9117('0x1c')](function(_0x515365){if(_0x515365){return db['sequelize']['transaction'](function(_0x48ee2e){return db[_0x9117('0x6f')][_0x9117('0x33')]({'where':{'SmsAccountId':_0x2ed6c0['params']['id']},'transaction':_0x48ee2e})['then'](function(_0x1a6fb4){var _0x550913=_[_0x9117('0x3a')](_0x2ed6c0[_0x9117('0x58')],function(_0x4bad8b){_0x4bad8b[_0x9117('0x62')]=_0x2ed6c0[_0x9117('0x54')]['id'];return _0x4bad8b;});return db[_0x9117('0x6f')][_0x9117('0xb1')](_0x550913,{'transaction':_0x48ee2e});});})[_0x9117('0x1c')](function(){return db[_0x9117('0x6f')][_0x9117('0xb2')]({'where':{'SmsAccountId':_0x2ed6c0['params']['id']},'order':_0x9117('0x72')});});}})[_0x9117('0x1c')](respondWithResult(_0x3b5421,null))[_0x9117('0x52')](handleError(_0x3b5421,null));};exports[_0x9117('0xb3')]=function(_0x347a71,_0x521254,_0x1565e2){var _0x22c140={};var _0x5ce8b1={};var _0x4e5142;var _0x2a6397;return db[_0x9117('0x3b')][_0x9117('0x65')]({'where':{'id':_0x347a71[_0x9117('0x54')]['id']}})['then'](handleEntityNotFound(_0x521254,null))[_0x9117('0x1c')](function(_0x79a1e3){if(_0x79a1e3){_0x4e5142=_0x79a1e3;_0x5ce8b1[_0x9117('0x40')]=_[_0x9117('0x42')](db[_0x9117('0x6f')]['rawAttributes']);_0x5ce8b1['query']=_[_0x9117('0x42')](_0x347a71['query']);_0x5ce8b1[_0x9117('0x43')]=_['intersection'](_0x5ce8b1[_0x9117('0x40')],_0x5ce8b1[_0x9117('0x41')]);_0x22c140[_0x9117('0x46')]=_[_0x9117('0x44')](_0x5ce8b1[_0x9117('0x40')],qs[_0x9117('0x45')](_0x347a71[_0x9117('0x41')][_0x9117('0x45')]));_0x22c140[_0x9117('0x46')]=_0x22c140[_0x9117('0x46')][_0x9117('0x47')]?_0x22c140['attributes']:_0x5ce8b1['model'];_0x22c140[_0x9117('0x67')]=qs['sort'](_0x347a71[_0x9117('0x41')][_0x9117('0x49')]);_0x22c140[_0x9117('0x4a')]=qs['filters'](_['pick'](_0x347a71[_0x9117('0x41')],_0x5ce8b1[_0x9117('0x43')]));if(_0x347a71[_0x9117('0x41')][_0x9117('0x4d')]){_0x22c140[_0x9117('0x4a')]=_['merge'](_0x22c140['where'],{'$or':_[_0x9117('0x3a')](_0x22c140[_0x9117('0x46')],function(_0x339b48){var _0x571ef1={};_0x571ef1[_0x339b48]={'$like':'%'+_0x347a71[_0x9117('0x41')][_0x9117('0x4d')]+'%'};return _0x571ef1;})});}_0x22c140=_[_0x9117('0x4e')]({},_0x22c140,_0x347a71['options']);return _0x4e5142['getApplications'](_0x22c140);}})[_0x9117('0x1c')](function(_0x145e71){if(_0x145e71){_0x2a6397=_0x145e71[_0x9117('0x47')];if(!_0x347a71[_0x9117('0x41')][_0x9117('0x48')](_0x9117('0x66'))){_0x22c140[_0x9117('0x2b')]=qs[_0x9117('0x2b')](_0x347a71[_0x9117('0x41')][_0x9117('0x2b')]);_0x22c140[_0x9117('0x2a')]=qs[_0x9117('0x2a')](_0x347a71['query']['offset']);}return _0x4e5142['getApplications'](_0x22c140);}})[_0x9117('0x1c')](function(_0x46604c){if(_0x46604c){return _0x46604c?{'count':_0x2a6397,'rows':_0x46604c}:null;}})[_0x9117('0x1c')](respondWithResult(_0x521254,null))[_0x9117('0x52')](handleError(_0x521254,null));};exports[_0x9117('0xb4')]=function(_0x5acf16,_0x566511,_0x5b064e){var _0x20a87a={'raw':![],'where':{}};var _0x5cce92={};var _0x514c95={'count':0x0,'rows':[]};return db[_0x9117('0x3b')]['findOne']({'where':{'id':_0x5acf16[_0x9117('0x54')]['id']}})['then'](handleEntityNotFound(_0x566511,null))['then'](function(_0x3c9c9b){if(_0x3c9c9b){_0x5cce92['model']=_[_0x9117('0x42')](db[_0x9117('0x9d')]['rawAttributes']);_0x5cce92[_0x9117('0x41')]=_['keys'](_0x5acf16[_0x9117('0x41')]);_0x5cce92[_0x9117('0x43')]=_[_0x9117('0x44')](_0x5cce92['model'],_0x5cce92[_0x9117('0x41')]);_0x20a87a[_0x9117('0x46')]=_[_0x9117('0x44')](_0x5cce92['model'],qs[_0x9117('0x45')](_0x5acf16[_0x9117('0x41')][_0x9117('0x45')]));_0x20a87a[_0x9117('0x46')]=_0x20a87a[_0x9117('0x46')][_0x9117('0x47')]?_0x20a87a[_0x9117('0x46')]:_0x5cce92['model'];if(!_0x5acf16[_0x9117('0x41')][_0x9117('0x48')](_0x9117('0x66'))){_0x20a87a['limit']=qs['limit'](_0x5acf16[_0x9117('0x41')]['limit']);_0x20a87a[_0x9117('0x2a')]=qs[_0x9117('0x2a')](_0x5acf16[_0x9117('0x41')][_0x9117('0x2a')]);}_0x20a87a[_0x9117('0x67')]=qs[_0x9117('0x49')](_0x5acf16[_0x9117('0x41')][_0x9117('0x49')]);_0x20a87a[_0x9117('0x4a')]=qs['filters'](_[_0x9117('0x4b')](_0x5acf16[_0x9117('0x41')],_0x5cce92[_0x9117('0x43')]));_0x20a87a[_0x9117('0x4a')][_0x9117('0x62')]=_0x3c9c9b['id'];if(_0x5acf16[_0x9117('0x41')][_0x9117('0x4d')]){_0x20a87a[_0x9117('0x4a')]=_['merge'](_0x20a87a[_0x9117('0x4a')],{'$or':_[_0x9117('0x3a')](_0x20a87a[_0x9117('0x46')],function(_0x422ba7){var _0x2961b4={};_0x2961b4[_0x422ba7]={'$like':'%'+_0x5acf16['query'][_0x9117('0x4d')]+'%'};return _0x2961b4;})});}_0x20a87a=_[_0x9117('0x4e')]({},_0x20a87a,_0x5acf16[_0x9117('0x55')]);return db['SmsInteraction'][_0x9117('0x2d')]({'where':_0x20a87a['where']})[_0x9117('0x1c')](function(_0x4e0596){_0x514c95['count']=_0x4e0596;if(_0x5acf16[_0x9117('0x41')][_0x9117('0x4f')]){_0x20a87a['include']=[{'model':db[_0x9117('0x74')],'as':_0x9117('0xb5'),'required':![]},{'model':db[_0x9117('0xb6')],'as':_0x9117('0xb7'),'attributes':[_0x9117('0x37'),_0x9117('0xb8'),_0x9117('0xb9')],'required':![]},{'model':db['Tag'],'as':_0x9117('0xba'),'attributes':['id','name',_0x9117('0xbb')],'where':_0x5acf16[_0x9117('0x41')][_0x9117('0xbc')]?{'id':_0x5acf16[_0x9117('0x41')][_0x9117('0xbc')]}:undefined,'required':_0x5acf16[_0x9117('0x41')]['tag']?!![]:![]}];}return db[_0x9117('0x9d')][_0x9117('0x51')](_0x20a87a);})['then'](function(_0x1ee144){_0x514c95[_0x9117('0x68')]=_0x1ee144;return _0x514c95;});}})['then'](respondWithFilteredResult(_0x566511,_0x20a87a))['catch'](handleError(_0x566511,null));};exports['send']=function(_0x32d270,_0x50c08d,_0x4fba5d){var _0x4ffa17,_0x3411d2,_0x3c315f;if(_[_0x9117('0x92')](_0x32d270[_0x9117('0x58')][_0x9117('0x58')])||_0x32d270[_0x9117('0x58')][_0x9117('0x58')]===''){throw new db[(_0x9117('0x75'))]['ValidationError'](_0x9117('0x94'));}if(_[_0x9117('0x92')](_0x32d270['body']['to'])){throw new db[(_0x9117('0x75'))][(_0x9117('0x93'))]('to\x20is\x20mandatory');}_0x4ffa17=_0x32d270[_0x9117('0x58')]['to'];return db[_0x9117('0x3b')][_0x9117('0x56')]({'where':{'id':_0x32d270[_0x9117('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0x9117('0xbd'),'include':[{'model':db[_0x9117('0x74')],'as':'Contacts','where':{'mobile':_0x4ffa17},'limit':0x1,'order':[[_0x9117('0x79'),_0x9117('0x99')]]}]}]})[_0x9117('0x1c')](handleEntityNotFound(_0x50c08d,null))[_0x9117('0x1c')](function(_0x38295f){if(_0x38295f&&_0x38295f['List']){_0x3411d2=_0x38295f[_0x9117('0x9f')]({'plain':!![]});if(_0x3411d2[_0x9117('0xbd')]&&_0x3411d2[_0x9117('0xbd')][_0x9117('0x98')][_0x9117('0x47')]){return _0x3411d2[_0x9117('0xbd')][_0x9117('0x98')][0x0];}return db[_0x9117('0x74')][_0x9117('0x57')](_['defaults'](_0x32d270[_0x9117('0x58')],{'firstName':_0x4ffa17,'mobile':_0x4ffa17,'phone':_0x4ffa17,'ListId':_0x3411d2['ListId']}));}})['then'](handleEntityNotFound(_0x50c08d,null))[_0x9117('0x1c')](function(_0x33cbe6){if(_0x33cbe6){_0x3c315f=_0x33cbe6;return db[_0x9117('0x9d')][_0x9117('0x56')]({'where':{'ContactId':_0x3c315f['id'],'closed':![],'SmsAccountId':_0x3411d2['id']}})[_0x9117('0x1c')](function(_0x2a4f86){if(_0x2a4f86){return[_0x2a4f86,![]];}return db['SmsInteraction'][_0x9117('0x57')]({'UserId':_0x32d270[_0x9117('0x59')]['id'],'ContactId':_0x3c315f['id'],'SmsAccountId':_0x3411d2['id'],'phone':_0x4ffa17,'firstMsgDirection':'out','Messages':[_[_0x9117('0x4e')](_0x32d270[_0x9117('0x58')],{'read':![],'body':_0x32d270[_0x9117('0x58')][_0x9117('0x58')],'phone':_0x4ffa17,'SmsAccountId':_0x3411d2['id'],'UserId':_0x32d270[_0x9117('0x59')]['id'],'ContactId':_0x3c315f['id']})]},{'include':[{'model':db[_0x9117('0xbe')],'as':_0x9117('0xbf')}]})[_0x9117('0x1c')](function(_0xcb6b67){return[_0xcb6b67,!![]];});});}})['spread'](function(_0x1b6cc1,_0x46fb1c){if(_0x46fb1c){return _0x1b6cc1;}return db[_0x9117('0xbe')]['create'](_[_0x9117('0x4e')](_0x32d270[_0x9117('0x58')],{'read':![],'body':_0x32d270[_0x9117('0x58')]['body'],'phone':_0x4ffa17,'SmsAccountId':_0x3411d2['id'],'SmsInteractionId':_0x1b6cc1['id'],'UserId':_0x32d270[_0x9117('0x59')]['id'],'ContactId':_0x3c315f['id']}))[_0x9117('0x1c')](function(_0x342a74){_0x1b6cc1[_0x9117('0xc0')]['Messages']=[];_0x1b6cc1['dataValues']['Messages'][_0x9117('0xa2')](_0x342a74['dataValues']);return _0x1b6cc1;});})[_0x9117('0x1c')](respondWithResult(_0x50c08d,null))[_0x9117('0x52')](handleError(_0x50c08d,null));};exports[_0x9117('0x28')]=function(_0x2b4005,_0x57ad13,_0x3013ec){if(_0x2b4005[_0x9117('0x58')]['id']){delete _0x2b4005['body']['id'];}var _0x3b7424,_0x30578a,_0xbc683b;return db[_0x9117('0x3b')][_0x9117('0x56')]({'where':{'id':_0x2b4005[_0x9117('0x54')]['id']}})[_0x9117('0x1c')](handleEntityNotFound(_0x57ad13,null))[_0x9117('0x1c')](function(_0x5d572c){if(_0x5d572c){_0xbc683b=_0x5d572c;logger[_0x9117('0x20')](_0x9117('0x21'),_0x9117('0x28'),_0x9117('0xc1'),_0x5d572c[_0x9117('0x3e')],util['inspect'](_0x2b4005[_0x9117('0x58')],{'showHidden':![],'depth':null}));switch(_0x5d572c[_0x9117('0x3e')]){case _0x9117('0x81'):if(_0x2b4005[_0x9117('0x58')][_0x9117('0xc2')]&&_0x2b4005[_0x9117('0x58')][_0x9117('0x28')]){_0x30578a=_0x2b4005[_0x9117('0x58')]['status'];return db[_0x9117('0xbe')][_0x9117('0x56')]({'where':{'messageId':_0x2b4005[_0x9117('0x58')]['skebby_dispatch_id']}});}break;case _0x9117('0x84'):if(_0x2b4005[_0x9117('0x58')][_0x9117('0xc3')]&&_0x2b4005[_0x9117('0x58')]['statusInt']){_0x30578a=_0x2b4005['body'][_0x9117('0xc4')];return db[_0x9117('0xbe')][_0x9117('0x56')]({'where':{'messageId':_0x2b4005[_0x9117('0x58')][_0x9117('0xc3')]}});}break;case _0x9117('0x85'):if(_0x2b4005['body'][_0x9117('0x86')]&&_0x2b4005[_0x9117('0x58')][_0x9117('0xc5')]){_0x30578a=_0x2b4005[_0x9117('0x58')][_0x9117('0xc5')];return db[_0x9117('0xbe')]['find']({'where':{'messageId':_0x2b4005[_0x9117('0x58')]['message_id']}});}break;case _0x9117('0x89'):var _0x40252e=_0x2b4005[_0x9117('0x58')]['results'][0x0];if(_0x40252e[_0x9117('0x8b')]&&_0x40252e[_0x9117('0x28')][_0x9117('0xc6')]==='DELIVERED'){_0x30578a=_0x40252e['status'][_0x9117('0xc6')];return db[_0x9117('0xbe')][_0x9117('0x56')]({'where':{'messageId':_0x40252e[_0x9117('0x8b')]}});}break;case'clickatell':if(_0x2b4005['body']['messageId']&&_0x2b4005[_0x9117('0x58')][_0x9117('0x28')]){_0x30578a=_0x2b4005[_0x9117('0x58')]['status'];return db['SmsMessage'][_0x9117('0x56')]({'where':{'messageId':_0x2b4005[_0x9117('0x58')][_0x9117('0x8b')]}});}break;case'bandwidth':if(_0x2b4005[_0x9117('0x58')][0x0][_0x9117('0x24')]['id']){_0x30578a=_0x2b4005[_0x9117('0x58')][0x0][_0x9117('0x3e')];return db[_0x9117('0xbe')][_0x9117('0x56')]({'where':{'messageId':_0x2b4005[_0x9117('0x58')][0x0]['message']['id']}});}break;case _0x9117('0x91'):if(_0x2b4005[_0x9117('0x58')]['redif']&&_0x2b4005[_0x9117('0x58')]['status']){_0x30578a=_0x2b4005[_0x9117('0x58')]['status'];return db[_0x9117('0xbe')][_0x9117('0x56')]({'where':{'messageId':_0x2b4005[_0x9117('0x58')][_0x9117('0xc7')]}});}break;}}})['then'](handleEntityNotFound(_0x57ad13,null))[_0x9117('0x1c')](function(_0x2e5d9e){if(_0x2e5d9e){_0x3b7424=_0x2e5d9e;switch(_0xbc683b[_0x9117('0x3e')]){case _0x9117('0x81'):if(_0x30578a===_0x9117('0xc8')){return _0x3b7424['update']({'read':!![]});}else{logger['error'](_0x9117('0x21'),_0x9117('0x28'),'skebby',util[_0x9117('0xc9')](_0x2b4005['body'],{'showHidden':![],'depth':null}));}break;case _0x9117('0x84'):if(_0x30578a==='1'){return _0x3b7424[_0x9117('0xca')]({'read':!![]});}else{logger[_0x9117('0x23')](_0x9117('0x21'),_0x9117('0x28'),_0x9117('0x81'),util['inspect'](_0x2b4005[_0x9117('0x58')],{'showHidden':![],'depth':null}));}break;case _0x9117('0x85'):if(!_0x2b4005[_0x9117('0x58')][_0x9117('0xcb')]&&_0x30578a>=0xc8&&_0x30578a<=0xce){return _0x3b7424[_0x9117('0xca')]({'read':!![]});}else{logger['error'](_0x9117('0x21'),_0x9117('0x28'),_0x9117('0x85'),util[_0x9117('0xc9')](_0x2b4005[_0x9117('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x448b2f=_0x2b4005[_0x9117('0x58')][_0x9117('0x8a')][0x0];if(_0x448b2f[_0x9117('0x28')][_0x9117('0xc6')]==='DELIVERED'){return _0x3b7424[_0x9117('0xca')]({'read':!![]});}else{logger['error'](_0x9117('0x21'),'status',_0x9117('0x89'),util[_0x9117('0xc9')](_0x2b4005[_0x9117('0x58')],{'showHidden':![],'depth':null}));}break;case _0x9117('0x8d'):if(_0x30578a=='DELIVERED_TO_GATEWAY'||_0x30578a==_0x9117('0xcc')){return _0x3b7424[_0x9117('0xca')]({'read':!![]});}else{logger['error'](_0x9117('0x21'),'status',_0x9117('0x8d'),util['inspect'](_0x2b4005[_0x9117('0x58')],{'showHidden':![],'depth':null}));}break;case _0x9117('0x90'):if(_0x30578a==_0x9117('0xcd')){return _0x3b7424[_0x9117('0xca')]({'read':!![]});}else{logger[_0x9117('0x23')](_0x9117('0x21'),_0x9117('0x28'),_0x9117('0x90'),util[_0x9117('0xc9')](_0x2b4005[_0x9117('0x58')],{'showHidden':![],'depth':null}));}break;case _0x9117('0x91'):if(_0x30578a==='DELIVRD'||_0x30578a===_0x9117('0xce')){return _0x3b7424['update']({'read':!![]});}else{logger[_0x9117('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9117('0x28'),_0x9117('0x91'),util[_0x9117('0xc9')](_0x2b4005[_0x9117('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x3b7424;}})[_0x9117('0x1c')](respondWithResult(_0x57ad13,null))[_0x9117('0x52')](handleError(_0x57ad13,null));};exports['statusGet']=function(_0x23d152,_0x139bd0,_0x227201){var _0x36f573,_0x325b5e,_0x4cea11;return db[_0x9117('0x3b')][_0x9117('0x56')]({'where':{'id':_0x23d152[_0x9117('0x54')]['id']}})['then'](handleEntityNotFound(_0x139bd0,null))['then'](function(_0x1505a2){if(_0x1505a2){_0x4cea11=_0x1505a2;logger['debug'](_0x9117('0x21'),'status',_0x9117('0xc1'),_0x1505a2[_0x9117('0x3e')],util[_0x9117('0xc9')](_0x23d152['query'],{'showHidden':![],'depth':null}));switch(_0x1505a2[_0x9117('0x3e')]){case _0x9117('0xcf'):if(_0x23d152[_0x9117('0x41')][_0x9117('0xd0')]&&_0x23d152[_0x9117('0x41')][_0x9117('0xd1')]){_0x325b5e=_0x23d152[_0x9117('0x41')][_0x9117('0xd1')];return db[_0x9117('0xbe')][_0x9117('0x56')]({'where':{'messageId':_0x23d152[_0x9117('0x41')][_0x9117('0xd0')]}});}break;}}})[_0x9117('0x1c')](handleEntityNotFound(_0x139bd0,null))['then'](function(_0x2f5bd5){if(_0x2f5bd5){_0x36f573=_0x2f5bd5;switch(_0x4cea11['type']){case _0x9117('0xcf'):if(_0x325b5e==='2'||_0x325b5e==='6'){return _0x36f573[_0x9117('0xca')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9117('0x28'),_0x9117('0xcf'),util[_0x9117('0xc9')](_0x23d152[_0x9117('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x36f573;}})['then'](respondWithResult(_0x139bd0,null))[_0x9117('0x52')](handleError(_0x139bd0,null));};exports[_0x9117('0xd2')]=function(_0x4a0c97,_0x5486d0,_0x3109bc){return db[_0x9117('0x3b')]['find']({'where':{'id':_0x4a0c97[_0x9117('0x54')]['id']}})['then'](handleEntityNotFound(_0x5486d0,null))[_0x9117('0x1c')](function(_0x475b32){if(_0x475b32){return _0x475b32['addAgents'](_0x4a0c97[_0x9117('0x58')][_0x9117('0x6a')],_['omit'](_0x4a0c97[_0x9117('0x58')],[_0x9117('0x6a'),'id'])||{})['spread'](function(_0x2196a7){for(var _0x4bd4fd=0x0;_0x4bd4fd<_0x4a0c97[_0x9117('0x58')][_0x9117('0x6a')][_0x9117('0x47')];_0x4bd4fd+=0x1){socket[_0x9117('0xd3')]('userSmsAccount:save',{'UserId':Number(_0x4a0c97[_0x9117('0x58')][_0x9117('0x6a')][_0x4bd4fd]),'SmsAccountId':Number(_0x4a0c97[_0x9117('0x54')]['id'])});}return _0x2196a7;});}})['then'](respondWithResult(_0x5486d0,null))[_0x9117('0x52')](handleError(_0x5486d0,null));};exports[_0x9117('0xd4')]=function(_0x10d6fe,_0x5f0e5a,_0x571ed5){return db[_0x9117('0x3b')][_0x9117('0x56')]({'where':{'id':_0x10d6fe[_0x9117('0x54')]['id']}})[_0x9117('0x1c')](handleEntityNotFound(_0x5f0e5a,null))['then'](function(_0x505ecd){if(_0x505ecd){return _0x505ecd[_0x9117('0xd4')](_0x10d6fe[_0x9117('0x41')][_0x9117('0x6a')])[_0x9117('0x1c')](function(){if(_['isArray'](_0x10d6fe[_0x9117('0x41')][_0x9117('0x6a')])){for(var _0x1f7cbe=0x0;_0x1f7cbe<_0x10d6fe[_0x9117('0x41')][_0x9117('0x6a')][_0x9117('0x47')];_0x1f7cbe+=0x1){socket[_0x9117('0xd3')](_0x9117('0xd5'),{'UserId':Number(_0x10d6fe['query'][_0x9117('0x6a')][_0x1f7cbe]),'SmsAccountId':Number(_0x10d6fe[_0x9117('0x54')]['id'])});}}else{socket['emit'](_0x9117('0xd5'),{'UserId':Number(_0x10d6fe['query'][_0x9117('0x6a')]),'SmsAccountId':Number(_0x10d6fe[_0x9117('0x54')]['id'])});}});}})[_0x9117('0x1c')](respondWithStatusCode(_0x5f0e5a,null))['catch'](handleError(_0x5f0e5a,null));};exports['getAgents']=function(_0x4d63f2,_0x25c298,_0x14175f){var _0x1faa4b={};var _0x5ab260={};var _0x3e1995;var _0x54a152;return db[_0x9117('0x3b')][_0x9117('0x65')]({'where':{'id':_0x4d63f2['params']['id']}})[_0x9117('0x1c')](handleEntityNotFound(_0x25c298,null))['then'](function(_0x35e673){if(_0x35e673){_0x3e1995=_0x35e673;_0x5ab260['model']=_[_0x9117('0x42')](db[_0x9117('0xb6')][_0x9117('0x3c')]);_0x5ab260[_0x9117('0x41')]=_['keys'](_0x4d63f2[_0x9117('0x41')]);_0x5ab260[_0x9117('0x43')]=_[_0x9117('0x44')](_0x5ab260[_0x9117('0x40')],_0x5ab260[_0x9117('0x41')]);_0x1faa4b['attributes']=_['intersection'](_0x5ab260[_0x9117('0x40')],qs[_0x9117('0x45')](_0x4d63f2[_0x9117('0x41')][_0x9117('0x45')]));_0x1faa4b[_0x9117('0x46')]=_0x1faa4b['attributes'][_0x9117('0x47')]?_0x1faa4b[_0x9117('0x46')]:_0x5ab260[_0x9117('0x40')];_0x1faa4b[_0x9117('0x67')]=qs['sort'](_0x4d63f2['query'][_0x9117('0x49')]);_0x1faa4b[_0x9117('0x4a')]=qs[_0x9117('0x43')](_[_0x9117('0x4b')](_0x4d63f2['query'],_0x5ab260[_0x9117('0x43')]));if(_0x4d63f2[_0x9117('0x41')][_0x9117('0x4d')]){_0x1faa4b['where']=_['merge'](_0x1faa4b['where'],{'$or':_[_0x9117('0x3a')](_0x1faa4b[_0x9117('0x46')],function(_0x2b892f){var _0x11831d={};_0x11831d[_0x2b892f]={'$like':'%'+_0x4d63f2['query'][_0x9117('0x4d')]+'%'};return _0x11831d;})});}_0x1faa4b=_['merge']({},_0x1faa4b,_0x4d63f2[_0x9117('0x55')]);return _0x3e1995[_0x9117('0xd6')](_0x1faa4b);}})[_0x9117('0x1c')](function(_0x101f04){if(_0x101f04){_0x54a152=_0x101f04[_0x9117('0x47')];if(!_0x4d63f2[_0x9117('0x41')][_0x9117('0x48')](_0x9117('0x66'))){_0x1faa4b['limit']=qs[_0x9117('0x2b')](_0x4d63f2[_0x9117('0x41')][_0x9117('0x2b')]);_0x1faa4b[_0x9117('0x2a')]=qs['offset'](_0x4d63f2[_0x9117('0x41')][_0x9117('0x2a')]);}return _0x3e1995[_0x9117('0xd6')](_0x1faa4b);}})[_0x9117('0x1c')](function(_0x2fd41a){if(_0x2fd41a){return _0x2fd41a?{'count':_0x54a152,'rows':_0x2fd41a}:null;}})[_0x9117('0x1c')](respondWithResult(_0x25c298,null))['catch'](handleError(_0x25c298,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 586a765..f3ea2c6 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 _0x2933=['hasOwnProperty','exports','events','SmsAccount','setMaxListeners','save','remove','emit'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x2933,0x142));var _0x3293=function(_0x4cee2b,_0x35423f){_0x4cee2b=_0x4cee2b-0x0;var _0x215999=_0x2933[_0x4cee2b];return _0x215999;};'use strict';var EventEmitter=require(_0x3293('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x3293('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x3293('0x2')](0x0);var events={'afterCreate':_0x3293('0x3'),'afterUpdate':'update','afterDestroy':_0x3293('0x4')};function emitEvent(_0x3544ed){return function(_0x747c79,_0x2c72a3,_0x526d7d){SmsAccountEvents[_0x3293('0x5')](_0x3544ed+':'+_0x747c79['id'],_0x747c79);SmsAccountEvents[_0x3293('0x5')](_0x3544ed,_0x747c79);_0x526d7d(null);};}for(var e in events){if(events[_0x3293('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x3293('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x0c3c=['events','../../mysqldb','SmsAccount','setMaxListeners','remove','emit','exports'];(function(_0x42ab5c,_0x2c0fbb){var _0x27516a=function(_0x4f26da){while(--_0x4f26da){_0x42ab5c['push'](_0x42ab5c['shift']());}};_0x27516a(++_0x2c0fbb);}(_0x0c3c,0x1ab));var _0xc0c3=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0x0c3c[_0x52684f];return _0x4a55f0;};'use strict';var EventEmitter=require(_0xc0c3('0x0'));var SmsAccount=require(_0xc0c3('0x1'))['db'][_0xc0c3('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xc0c3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc0c3('0x4')};function emitEvent(_0x2e6a79){return function(_0x422e1d,_0x3055f1,_0x3134a6){SmsAccountEvents[_0xc0c3('0x5')](_0x2e6a79+':'+_0x422e1d['id'],_0x422e1d);SmsAccountEvents[_0xc0c3('0x5')](_0x2e6a79,_0x422e1d);_0x3134a6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xc0c3('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 80084ed..c279db6 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 _0x1543=['moment','bluebird','path','rimraf','./smsAccount.attributes','exports','sms_accounts','lodash','../../config/logger','api'];(function(_0x53eabc,_0x3d76d5){var _0x4e3564=function(_0x1cd40a){while(--_0x1cd40a){_0x53eabc['push'](_0x53eabc['shift']());}};_0x4e3564(++_0x3d76d5);}(_0x1543,0x1c9));var _0x3154=function(_0x4426ef,_0x1bde6b){_0x4426ef=_0x4426ef-0x0;var _0x455cec=_0x1543[_0x4426ef];return _0x455cec;};'use strict';var _=require(_0x3154('0x0'));var util=require('util');var logger=require(_0x3154('0x1'))(_0x3154('0x2'));var moment=require(_0x3154('0x3'));var BPromise=require(_0x3154('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3154('0x5'));var rimraf=require(_0x3154('0x6'));var config=require('../../config/environment');var attributes=require(_0x3154('0x7'));module[_0x3154('0x8')]=function(_0x2a1ed6,_0x4c072){return _0x2a1ed6['define']('SmsAccount',attributes,{'tableName':_0x3154('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde03=['sms_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','define','SmsAccount'];(function(_0x5ce509,_0x100c5d){var _0x2b317f=function(_0x5bca86){while(--_0x5bca86){_0x5ce509['push'](_0x5ce509['shift']());}};_0x2b317f(++_0x100c5d);}(_0xde03,0x153));var _0x3de0=function(_0x4ee8ed,_0x5874e1){_0x4ee8ed=_0x4ee8ed-0x0;var _0x4b0e10=_0xde03[_0x4ee8ed];return _0x4b0e10;};'use strict';var _=require(_0x3de0('0x0'));var util=require('util');var logger=require(_0x3de0('0x1'))(_0x3de0('0x2'));var moment=require(_0x3de0('0x3'));var BPromise=require(_0x3de0('0x4'));var rp=require(_0x3de0('0x5'));var fs=require('fs');var path=require(_0x3de0('0x6'));var rimraf=require(_0x3de0('0x7'));var config=require(_0x3de0('0x8'));var attributes=require(_0x3de0('0x9'));module['exports']=function(_0x42c76c,_0x1903c5){return _0x42c76c[_0x3de0('0xa')](_0x3de0('0xb'),attributes,{'tableName':_0x3de0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index c29cf57..0cdf794 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 _0x4ae7=['where','attributes','map','include','model','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ShowSmsAccount','SmsAccount','find','options'];(function(_0x490c45,_0x97b829){var _0x82738e=function(_0x215c17){while(--_0x215c17){_0x490c45['push'](_0x490c45['shift']());}};_0x82738e(++_0x97b829);}(_0x4ae7,0x136));var _0x74ae=function(_0x427677,_0x397c4e){_0x427677=_0x427677-0x0;var _0x8e5fd9=_0x4ae7[_0x427677];return _0x8e5fd9;};'use strict';var _=require(_0x74ae('0x0'));var util=require('util');var moment=require(_0x74ae('0x1'));var BPromise=require(_0x74ae('0x2'));var rs=require(_0x74ae('0x3'));var fs=require('fs');var Redis=require(_0x74ae('0x4'));var db=require(_0x74ae('0x5'))['db'];var utils=require(_0x74ae('0x6'));var logger=require('../../config/logger')(_0x74ae('0x7'));var config=require(_0x74ae('0x8'));var jayson=require(_0x74ae('0x9'));var client=jayson[_0x74ae('0xa')][_0x74ae('0xb')]({'port':0x232a});config[_0x74ae('0xc')]=_[_0x74ae('0xd')](config[_0x74ae('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x74ae('0xe'))(new Redis(config['redis']));require(_0x74ae('0xf'))[_0x74ae('0x10')](socket);function respondWithRpcPromise(_0x38a196,_0x7bf800,_0x3a4c53){return new BPromise(function(_0x234b8a,_0x395ffa){return client[_0x74ae('0x11')](_0x38a196,_0x3a4c53)[_0x74ae('0x12')](function(_0x4ab528){logger[_0x74ae('0x13')](_0x74ae('0x14'),_0x7bf800,_0x74ae('0x15'));logger[_0x74ae('0x16')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7bf800,_0x74ae('0x15'),JSON[_0x74ae('0x17')](_0x4ab528));if(_0x4ab528[_0x74ae('0x18')]){if(_0x4ab528[_0x74ae('0x18')][_0x74ae('0x19')]===0x1f4){logger[_0x74ae('0x18')](_0x74ae('0x14'),_0x7bf800,_0x4ab528[_0x74ae('0x18')]['message']);return _0x395ffa(_0x4ab528[_0x74ae('0x18')]['message']);}logger['error'](_0x74ae('0x14'),_0x7bf800,_0x4ab528[_0x74ae('0x18')][_0x74ae('0x1a')]);return _0x234b8a(_0x4ab528[_0x74ae('0x18')]['message']);}else{logger[_0x74ae('0x13')](_0x74ae('0x14'),_0x7bf800,_0x74ae('0x15'));_0x234b8a(_0x4ab528[_0x74ae('0x1b')]['message']);}})['catch'](function(_0x13839f){logger[_0x74ae('0x18')](_0x74ae('0x14'),_0x7bf800,_0x13839f);_0x395ffa(_0x13839f);});});}exports[_0x74ae('0x1c')]=function(_0x31c568){var _0x35fdac=this;return new Promise(function(_0x1f8fda,_0x374eb6){return db[_0x74ae('0x1d')][_0x74ae('0x1e')]({'raw':_0x31c568[_0x74ae('0x1f')]?_0x31c568[_0x74ae('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x31c568[_0x74ae('0x1f')]?_0x31c568[_0x74ae('0x1f')][_0x74ae('0x20')]||null:null,'attributes':_0x31c568[_0x74ae('0x1f')]?_0x31c568[_0x74ae('0x1f')][_0x74ae('0x21')]||null:null,'include':_0x31c568[_0x74ae('0x1f')]?_0x31c568['options']['include']?_[_0x74ae('0x22')](_0x31c568['options'][_0x74ae('0x23')],function(_0x176ab8){return{'model':db[_0x176ab8['model']],'as':_0x176ab8['as'],'attributes':_0x176ab8[_0x74ae('0x21')],'include':_0x176ab8[_0x74ae('0x23')]?_[_0x74ae('0x22')](_0x176ab8[_0x74ae('0x23')],function(_0x463f1e){return{'model':db[_0x463f1e[_0x74ae('0x24')]],'as':_0x463f1e['as'],'attributes':_0x463f1e[_0x74ae('0x21')],'include':_0x463f1e['include']?_[_0x74ae('0x22')](_0x463f1e[_0x74ae('0x23')],function(_0x31f54c){return{'model':db[_0x31f54c[_0x74ae('0x24')]],'as':_0x31f54c['as'],'attributes':_0x31f54c[_0x74ae('0x21')]};}):[]};}):[]};}):[]:[]})[_0x74ae('0x12')](function(_0x583389){logger[_0x74ae('0x13')](_0x74ae('0x1c'),_0x31c568);logger[_0x74ae('0x16')](_0x74ae('0x1c'),_0x31c568,JSON['stringify'](_0x583389));_0x1f8fda(_0x583389);})[_0x74ae('0x25')](function(_0x59a3fa){logger[_0x74ae('0x18')]('ShowSmsAccount',_0x59a3fa[_0x74ae('0x1a')],_0x31c568);_0x374eb6(_0x35fdac['error'](0x1f4,_0x59a3fa['message']));});});}; \ No newline at end of file +var _0xcb4c=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','SmsAccount','find','options','raw','where','attributes','include','map','model','ShowSmsAccount','debug','stringify','catch','util'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xcb4c,0x6e));var _0xccb4=function(_0x5d14c6,_0xef6d82){_0x5d14c6=_0x5d14c6-0x0;var _0x49f240=_0xcb4c[_0x5d14c6];return _0x49f240;};'use strict';var _=require('lodash');var util=require(_0xccb4('0x0'));var moment=require(_0xccb4('0x1'));var BPromise=require(_0xccb4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xccb4('0x3'));var db=require(_0xccb4('0x4'))['db'];var utils=require(_0xccb4('0x5'));var logger=require(_0xccb4('0x6'))(_0xccb4('0x7'));var config=require(_0xccb4('0x8'));var jayson=require(_0xccb4('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xccb4('0xa')]=_[_0xccb4('0xb')](config[_0xccb4('0xa')],{'host':_0xccb4('0xc'),'port':0x18eb});var socket=require(_0xccb4('0xd'))(new Redis(config[_0xccb4('0xa')]));require('./smsAccount.socket')[_0xccb4('0xe')](socket);function respondWithRpcPromise(_0x1f342c,_0x2366ce,_0x5aa0b2){return new BPromise(function(_0xddc1d8,_0x32e95d){return client['request'](_0x1f342c,_0x5aa0b2)[_0xccb4('0xf')](function(_0xaa7ba4){logger[_0xccb4('0x10')](_0xccb4('0x11'),_0x2366ce,_0xccb4('0x12'));logger['debug'](_0xccb4('0x13'),_0x2366ce,'request\x20sent',JSON['stringify'](_0xaa7ba4));if(_0xaa7ba4['error']){if(_0xaa7ba4[_0xccb4('0x14')][_0xccb4('0x15')]===0x1f4){logger[_0xccb4('0x14')]('SmsAccount,\x20%s,\x20%s',_0x2366ce,_0xaa7ba4[_0xccb4('0x14')]['message']);return _0x32e95d(_0xaa7ba4[_0xccb4('0x14')]['message']);}logger[_0xccb4('0x14')](_0xccb4('0x11'),_0x2366ce,_0xaa7ba4[_0xccb4('0x14')]['message']);return _0xddc1d8(_0xaa7ba4[_0xccb4('0x14')][_0xccb4('0x16')]);}else{logger[_0xccb4('0x10')]('SmsAccount,\x20%s,\x20%s',_0x2366ce,'request\x20sent');_0xddc1d8(_0xaa7ba4[_0xccb4('0x17')]['message']);}})['catch'](function(_0x150c94){logger[_0xccb4('0x14')]('SmsAccount,\x20%s,\x20%s',_0x2366ce,_0x150c94);_0x32e95d(_0x150c94);});});}exports['ShowSmsAccount']=function(_0x455bde){var _0x70f2e3=this;return new Promise(function(_0x20e637,_0x5a7011){return db[_0xccb4('0x18')][_0xccb4('0x19')]({'raw':_0x455bde[_0xccb4('0x1a')]?_0x455bde[_0xccb4('0x1a')][_0xccb4('0x1b')]===undefined?!![]:![]:!![],'where':_0x455bde[_0xccb4('0x1a')]?_0x455bde[_0xccb4('0x1a')][_0xccb4('0x1c')]||null:null,'attributes':_0x455bde[_0xccb4('0x1a')]?_0x455bde['options'][_0xccb4('0x1d')]||null:null,'include':_0x455bde[_0xccb4('0x1a')]?_0x455bde['options'][_0xccb4('0x1e')]?_[_0xccb4('0x1f')](_0x455bde['options'][_0xccb4('0x1e')],function(_0x2c1338){return{'model':db[_0x2c1338[_0xccb4('0x20')]],'as':_0x2c1338['as'],'attributes':_0x2c1338['attributes'],'include':_0x2c1338[_0xccb4('0x1e')]?_[_0xccb4('0x1f')](_0x2c1338[_0xccb4('0x1e')],function(_0x21ab55){return{'model':db[_0x21ab55[_0xccb4('0x20')]],'as':_0x21ab55['as'],'attributes':_0x21ab55['attributes'],'include':_0x21ab55[_0xccb4('0x1e')]?_['map'](_0x21ab55[_0xccb4('0x1e')],function(_0x291142){return{'model':db[_0x291142[_0xccb4('0x20')]],'as':_0x291142['as'],'attributes':_0x291142[_0xccb4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xccb4('0xf')](function(_0xa77415){logger['info'](_0xccb4('0x21'),_0x455bde);logger[_0xccb4('0x22')]('ShowSmsAccount',_0x455bde,JSON[_0xccb4('0x23')](_0xa77415));_0x20e637(_0xa77415);})[_0xccb4('0x24')](function(_0x1b429c){logger[_0xccb4('0x14')]('ShowSmsAccount',_0x1b429c['message'],_0x455bde);_0x5a7011(_0x70f2e3['error'](0x1f4,_0x1b429c[_0xccb4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 8c1d641..1345518 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 e08bafb..24f4852 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x228142,_0x11238a){var _0x43e00f=function(_0x1ef0b3){while(--_0x1ef0b3){_0x228142['push'](_0x228142['shift']());}};_0x43e00f(++_0x11238a);}(_0x008c,0x188));var _0xc008=function(_0x23c77e,_0x110c62){_0x23c77e=_0x23c77e-0x0;var _0x57d2be=_0x008c[_0x23c77e];return _0x57d2be;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x2ac248,_0x13b418){var _0x11dc08=function(_0x5d26af){while(--_0x5d26af){_0x2ac248['push'](_0x2ac248['shift']());}};_0x11dc08(++_0x13b418);}(_0x008c,0x188));var _0xc008=function(_0x67f65f,_0x541c1a){_0x67f65f=_0x67f65f-0x0;var _0x124a3e=_0x008c[_0x67f65f];return _0x124a3e;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 4a9cadc..da0bcbd 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 _0xa2ea=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x20048c,_0x337690){var _0x1d7f4b=function(_0x420930){while(--_0x420930){_0x20048c['push'](_0x20048c['shift']());}};_0x1d7f4b(++_0x337690);}(_0xa2ea,0xa3));var _0xaa2e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa2ea[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require(_0xaa2e('0x0'));module[_0xaa2e('0x1')]={'priority':{'type':Sequelize[_0xaa2e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xaa2e('0x3')],'allowNull':![],'defaultValue':_0xaa2e('0x4')},'appdata':{'type':Sequelize[_0xaa2e('0x5')]()},'description':{'type':Sequelize[_0xaa2e('0x3')]},'interval':{'type':Sequelize[_0xaa2e('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x7cde=['noop','TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x7cde,0x1dc));var _0xe7cd=function(_0x5f2dcf,_0x4ec6f2){_0x5f2dcf=_0x5f2dcf-0x0;var _0x158747=_0x7cde[_0x5f2dcf];return _0x158747;};'use strict';var Sequelize=require(_0xe7cd('0x0'));module[_0xe7cd('0x1')]={'priority':{'type':Sequelize[_0xe7cd('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe7cd('0x3')],'allowNull':![],'defaultValue':_0xe7cd('0x4')},'appdata':{'type':Sequelize[_0xe7cd('0x5')]()},'description':{'type':Sequelize[_0xe7cd('0x3')]},'interval':{'type':Sequelize[_0xe7cd('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 4479f6f..104a39c 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 _0xfe0b=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','end','error','name','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','papaparse'];(function(_0x592663,_0x2c3a74){var _0x392f26=function(_0x1fcc39){while(--_0x1fcc39){_0x592663['push'](_0x592663['shift']());}};_0x392f26(++_0x2c3a74);}(_0xfe0b,0x1a2));var _0xbfe0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xfe0b[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbfe0('0x0'));var zipdir=require(_0xbfe0('0x1'));var jsonpatch=require(_0xbfe0('0x2'));var rp=require(_0xbfe0('0x3'));var moment=require(_0xbfe0('0x4'));var BPromise=require(_0xbfe0('0x5'));var Mustache=require(_0xbfe0('0x6'));var util=require(_0xbfe0('0x7'));var path=require(_0xbfe0('0x8'));var sox=require(_0xbfe0('0x9'));var csv=require(_0xbfe0('0xa'));var ejs=require(_0xbfe0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbfe0('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbfe0('0xd'));var Redis=require('ioredis');var authService=require(_0xbfe0('0xe'));var qs=require(_0xbfe0('0xf'));var as=require(_0xbfe0('0x10'));var hardwareService=require(_0xbfe0('0x11'));var logger=require(_0xbfe0('0x12'))(_0xbfe0('0x13'));var utils=require(_0xbfe0('0x14'));var config=require(_0xbfe0('0x15'));var licenseUtil=require(_0xbfe0('0x16'));var db=require(_0xbfe0('0x17'))['db'];function respondWithStatusCode(_0x446041,_0x8219a7){_0x8219a7=_0x8219a7||0xcc;return function(_0x38568c){if(_0x38568c){return _0x446041[_0xbfe0('0x18')](_0x8219a7);}return _0x446041[_0xbfe0('0x19')](_0x8219a7)['end']();};}function respondWithResult(_0x302a5e,_0x19ccfb){_0x19ccfb=_0x19ccfb||0xc8;return function(_0x3919fb){if(_0x3919fb){return _0x302a5e[_0xbfe0('0x19')](_0x19ccfb)[_0xbfe0('0x1a')](_0x3919fb);}};}function respondWithFilteredResult(_0x2e6337,_0x13e08e){return function(_0x45a343){if(_0x45a343){var _0x440089=typeof _0x13e08e['offset']===_0xbfe0('0x1b')&&typeof _0x13e08e[_0xbfe0('0x1c')]===_0xbfe0('0x1b');var _0x140323=_0x45a343[_0xbfe0('0x1d')];var _0x580372=_0x440089?0x0:_0x13e08e[_0xbfe0('0x1e')];var _0x2438c2=_0x440089?_0x45a343['count']:_0x13e08e[_0xbfe0('0x1e')]+_0x13e08e[_0xbfe0('0x1c')];var _0x1dfaea;if(_0x2438c2>=_0x140323){_0x2438c2=_0x140323;_0x1dfaea=0xc8;}else{_0x1dfaea=0xce;}_0x2e6337[_0xbfe0('0x19')](_0x1dfaea);return _0x2e6337[_0xbfe0('0x1f')](_0xbfe0('0x20'),_0x580372+'-'+_0x2438c2+'/'+_0x140323)[_0xbfe0('0x1a')](_0x45a343);}return null;};}function patchUpdates(_0x3dda6e){return function(_0x147317){try{jsonpatch[_0xbfe0('0x21')](_0x147317,_0x3dda6e,!![]);}catch(_0x5a9f73){return BPromise[_0xbfe0('0x22')](_0x5a9f73);}return _0x147317['save']();};}function saveUpdates(_0x293206,_0x5b7046){return function(_0x3ff949){if(_0x3ff949){return _0x3ff949['update'](_0x293206)[_0xbfe0('0x23')](function(_0x1d8011){return _0x1d8011;});}return null;};}function removeEntity(_0x4d629c,_0xe0377){return function(_0x23f804){if(_0x23f804){return _0x23f804[_0xbfe0('0x24')]()[_0xbfe0('0x23')](function(){_0x4d629c[_0xbfe0('0x19')](0xcc)[_0xbfe0('0x25')]();});}};}function handleEntityNotFound(_0x1de051,_0x3fdfa4){return function(_0x11a48b){if(!_0x11a48b){_0x1de051[_0xbfe0('0x18')](0x194);}return _0x11a48b;};}function handleError(_0x4c82a0,_0x525da4){_0x525da4=_0x525da4||0x1f4;return function(_0x26c1c8){logger[_0xbfe0('0x26')](_0x26c1c8['stack']);if(_0x26c1c8[_0xbfe0('0x27')]){delete _0x26c1c8['name'];}_0x4c82a0[_0xbfe0('0x19')](_0x525da4)['send'](_0x26c1c8);};}exports[_0xbfe0('0x28')]=function(_0x4a8f4b,_0xaec0cb){var _0x4f23ed={},_0x202f52={},_0x46cfa8={'count':0x0,'rows':[]};var _0xe7fefd=_[_0xbfe0('0x29')](db[_0xbfe0('0x2a')][_0xbfe0('0x2b')],function(_0x175dd8){return{'name':_0x175dd8[_0xbfe0('0x2c')],'type':_0x175dd8[_0xbfe0('0x2d')][_0xbfe0('0x2e')]};});_0x202f52[_0xbfe0('0x2f')]=_[_0xbfe0('0x29')](_0xe7fefd,_0xbfe0('0x27'));_0x202f52[_0xbfe0('0x30')]=_['keys'](_0x4a8f4b['query']);_0x202f52[_0xbfe0('0x31')]=_[_0xbfe0('0x32')](_0x202f52['model'],_0x202f52[_0xbfe0('0x30')]);_0x4f23ed[_0xbfe0('0x33')]=_[_0xbfe0('0x32')](_0x202f52[_0xbfe0('0x2f')],qs[_0xbfe0('0x34')](_0x4a8f4b[_0xbfe0('0x30')][_0xbfe0('0x34')]));_0x4f23ed[_0xbfe0('0x33')]=_0x4f23ed['attributes'][_0xbfe0('0x35')]?_0x4f23ed[_0xbfe0('0x33')]:_0x202f52[_0xbfe0('0x2f')];if(!_0x4a8f4b[_0xbfe0('0x30')][_0xbfe0('0x36')]('nolimit')){_0x4f23ed['limit']=qs[_0xbfe0('0x1c')](_0x4a8f4b[_0xbfe0('0x30')]['limit']);_0x4f23ed[_0xbfe0('0x1e')]=qs[_0xbfe0('0x1e')](_0x4a8f4b[_0xbfe0('0x30')][_0xbfe0('0x1e')]);}_0x4f23ed['order']=qs[_0xbfe0('0x37')](_0x4a8f4b[_0xbfe0('0x30')]['sort']);_0x4f23ed[_0xbfe0('0x38')]=qs[_0xbfe0('0x31')](_[_0xbfe0('0x39')](_0x4a8f4b[_0xbfe0('0x30')],_0x202f52['filters']),_0xe7fefd);if(_0x4a8f4b['query'][_0xbfe0('0x3a')]){_0x4f23ed[_0xbfe0('0x38')]=_[_0xbfe0('0x3b')](_0x4f23ed[_0xbfe0('0x38')],{'$or':_[_0xbfe0('0x29')](_0xe7fefd,function(_0x4714bb){if(_0x4714bb[_0xbfe0('0x2d')]!=='VIRTUAL'){var _0x21597a={};_0x21597a[_0x4714bb['name']]={'$like':'%'+_0x4a8f4b[_0xbfe0('0x30')][_0xbfe0('0x3a')]+'%'};return _0x21597a;}})});}_0x4f23ed=_[_0xbfe0('0x3b')]({},_0x4f23ed,_0x4a8f4b[_0xbfe0('0x3c')]);var _0x59da26={'where':_0x4f23ed[_0xbfe0('0x38')]};return db[_0xbfe0('0x2a')][_0xbfe0('0x1d')](_0x59da26)[_0xbfe0('0x23')](function(_0x45ea88){_0x46cfa8['count']=_0x45ea88;if(_0x4a8f4b[_0xbfe0('0x30')][_0xbfe0('0x3d')]){_0x4f23ed[_0xbfe0('0x3e')]=[{'all':!![]}];}return db['SmsApplication'][_0xbfe0('0x3f')](_0x4f23ed);})['then'](function(_0x501158){_0x46cfa8[_0xbfe0('0x40')]=_0x501158;return _0x46cfa8;})[_0xbfe0('0x23')](respondWithFilteredResult(_0xaec0cb,_0x4f23ed))[_0xbfe0('0x41')](handleError(_0xaec0cb,null));};exports['show']=function(_0x224de7,_0x403ca2){var _0x11c2b6={'raw':!![],'where':{'id':_0x224de7[_0xbfe0('0x42')]['id']}},_0x748e2f={};_0x748e2f[_0xbfe0('0x2f')]=_[_0xbfe0('0x43')](db['SmsApplication'][_0xbfe0('0x2b')]);_0x748e2f[_0xbfe0('0x30')]=_[_0xbfe0('0x43')](_0x224de7[_0xbfe0('0x30')]);_0x748e2f[_0xbfe0('0x31')]=_[_0xbfe0('0x32')](_0x748e2f[_0xbfe0('0x2f')],_0x748e2f[_0xbfe0('0x30')]);_0x11c2b6[_0xbfe0('0x33')]=_['intersection'](_0x748e2f[_0xbfe0('0x2f')],qs[_0xbfe0('0x34')](_0x224de7[_0xbfe0('0x30')][_0xbfe0('0x34')]));_0x11c2b6[_0xbfe0('0x33')]=_0x11c2b6[_0xbfe0('0x33')][_0xbfe0('0x35')]?_0x11c2b6[_0xbfe0('0x33')]:_0x748e2f['model'];if(_0x224de7[_0xbfe0('0x30')][_0xbfe0('0x3d')]){_0x11c2b6[_0xbfe0('0x3e')]=[{'all':!![]}];}_0x11c2b6=_[_0xbfe0('0x3b')]({},_0x11c2b6,_0x224de7[_0xbfe0('0x3c')]);return db[_0xbfe0('0x2a')][_0xbfe0('0x44')](_0x11c2b6)[_0xbfe0('0x23')](handleEntityNotFound(_0x403ca2,null))[_0xbfe0('0x23')](respondWithResult(_0x403ca2,null))[_0xbfe0('0x41')](handleError(_0x403ca2,null));};exports[_0xbfe0('0x45')]=function(_0x12726d,_0x120265){return db[_0xbfe0('0x2a')][_0xbfe0('0x45')](_0x12726d[_0xbfe0('0x46')],{})[_0xbfe0('0x23')](respondWithResult(_0x120265,0xc9))[_0xbfe0('0x41')](handleError(_0x120265,null));};exports[_0xbfe0('0x47')]=function(_0xda7332,_0x202797){if(_0xda7332[_0xbfe0('0x46')]['id']){delete _0xda7332[_0xbfe0('0x46')]['id'];}return db[_0xbfe0('0x2a')][_0xbfe0('0x44')]({'where':{'id':_0xda7332['params']['id']}})[_0xbfe0('0x23')](handleEntityNotFound(_0x202797,null))['then'](saveUpdates(_0xda7332[_0xbfe0('0x46')],null))[_0xbfe0('0x23')](respondWithResult(_0x202797,null))[_0xbfe0('0x41')](handleError(_0x202797,null));};exports[_0xbfe0('0x24')]=function(_0x1426a3,_0x106c05){return db[_0xbfe0('0x2a')][_0xbfe0('0x44')]({'where':{'id':_0x1426a3['params']['id']}})['then'](handleEntityNotFound(_0x106c05,null))[_0xbfe0('0x23')](removeEntity(_0x106c05,null))['catch'](handleError(_0x106c05,null));}; \ No newline at end of file +var _0x47a3=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','index','SmsApplication','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','catch','create','params','body','destroy','find','rimraf','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1f25d9,_0x5c51cc){var _0x167f0d=function(_0x8ee221){while(--_0x8ee221){_0x1f25d9['push'](_0x1f25d9['shift']());}};_0x167f0d(++_0x5c51cc);}(_0x47a3,0x157));var _0x347a=function(_0x46b85e,_0x25cf9f){_0x46b85e=_0x46b85e-0x0;var _0x41f30d=_0x47a3[_0x46b85e];return _0x41f30d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x347a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x347a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x347a('0x2'));var util=require(_0x347a('0x3'));var path=require(_0x347a('0x4'));var sox=require('sox');var csv=require(_0x347a('0x5'));var ejs=require(_0x347a('0x6'));var fs=require('fs');var fs_extra=require(_0x347a('0x7'));var _=require(_0x347a('0x8'));var squel=require(_0x347a('0x9'));var crypto=require(_0x347a('0xa'));var jsforce=require(_0x347a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x347a('0x5'));var querystring=require(_0x347a('0xc'));var Papa=require(_0x347a('0xd'));var Redis=require(_0x347a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x347a('0xf'));var as=require(_0x347a('0x10'));var hardwareService=require(_0x347a('0x11'));var logger=require(_0x347a('0x12'))('api');var utils=require(_0x347a('0x13'));var config=require(_0x347a('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb79dc6,_0x775c80){_0x775c80=_0x775c80||0xcc;return function(_0x16f5f4){if(_0x16f5f4){return _0xb79dc6['sendStatus'](_0x775c80);}return _0xb79dc6[_0x347a('0x15')](_0x775c80)[_0x347a('0x16')]();};}function respondWithResult(_0x1ac98b,_0x5cefa2){_0x5cefa2=_0x5cefa2||0xc8;return function(_0x31d065){if(_0x31d065){return _0x1ac98b['status'](_0x5cefa2)[_0x347a('0x17')](_0x31d065);}};}function respondWithFilteredResult(_0x599220,_0x407b7b){return function(_0x1867e2){if(_0x1867e2){var _0x53e130=typeof _0x407b7b[_0x347a('0x18')]===_0x347a('0x19')&&typeof _0x407b7b[_0x347a('0x1a')]===_0x347a('0x19');var _0x264314=_0x1867e2['count'];var _0x4456f0=_0x53e130?0x0:_0x407b7b[_0x347a('0x18')];var _0x2c28e6=_0x53e130?_0x1867e2[_0x347a('0x1b')]:_0x407b7b[_0x347a('0x18')]+_0x407b7b[_0x347a('0x1a')];var _0x26f023;if(_0x2c28e6>=_0x264314){_0x2c28e6=_0x264314;_0x26f023=0xc8;}else{_0x26f023=0xce;}_0x599220[_0x347a('0x15')](_0x26f023);return _0x599220[_0x347a('0x1c')](_0x347a('0x1d'),_0x4456f0+'-'+_0x2c28e6+'/'+_0x264314)['json'](_0x1867e2);}return null;};}function patchUpdates(_0x22d3f0){return function(_0x152a40){try{jsonpatch[_0x347a('0x1e')](_0x152a40,_0x22d3f0,!![]);}catch(_0x3617f0){return BPromise[_0x347a('0x1f')](_0x3617f0);}return _0x152a40[_0x347a('0x20')]();};}function saveUpdates(_0x46bf4a,_0x2eeede){return function(_0x32a661){if(_0x32a661){return _0x32a661['update'](_0x46bf4a)[_0x347a('0x21')](function(_0x417252){return _0x417252;});}return null;};}function removeEntity(_0x30180a,_0x43af4b){return function(_0x4f3829){if(_0x4f3829){return _0x4f3829['destroy']()[_0x347a('0x21')](function(){_0x30180a['status'](0xcc)[_0x347a('0x16')]();});}};}function handleEntityNotFound(_0xdcefa5,_0x3c3dc8){return function(_0x1aa764){if(!_0x1aa764){_0xdcefa5[_0x347a('0x22')](0x194);}return _0x1aa764;};}function handleError(_0x248456,_0x362eaf){_0x362eaf=_0x362eaf||0x1f4;return function(_0x2e990e){logger[_0x347a('0x23')](_0x2e990e[_0x347a('0x24')]);if(_0x2e990e['name']){delete _0x2e990e[_0x347a('0x25')];}_0x248456[_0x347a('0x15')](_0x362eaf)[_0x347a('0x26')](_0x2e990e);};}exports[_0x347a('0x27')]=function(_0x1bf600,_0x2fd196){var _0x5f40d2={},_0x207b11={},_0x427e57={'count':0x0,'rows':[]};var _0x139715=_['map'](db[_0x347a('0x28')][_0x347a('0x29')],function(_0x218f7c){return{'name':_0x218f7c[_0x347a('0x2a')],'type':_0x218f7c[_0x347a('0x2b')]['key']};});_0x207b11['model']=_['map'](_0x139715,_0x347a('0x25'));_0x207b11[_0x347a('0x2c')]=_[_0x347a('0x2d')](_0x1bf600[_0x347a('0x2c')]);_0x207b11[_0x347a('0x2e')]=_[_0x347a('0x2f')](_0x207b11[_0x347a('0x30')],_0x207b11['query']);_0x5f40d2[_0x347a('0x31')]=_['intersection'](_0x207b11[_0x347a('0x30')],qs['fields'](_0x1bf600['query'][_0x347a('0x32')]));_0x5f40d2[_0x347a('0x31')]=_0x5f40d2[_0x347a('0x31')][_0x347a('0x33')]?_0x5f40d2['attributes']:_0x207b11[_0x347a('0x30')];if(!_0x1bf600['query']['hasOwnProperty'](_0x347a('0x34'))){_0x5f40d2[_0x347a('0x1a')]=qs['limit'](_0x1bf600[_0x347a('0x2c')][_0x347a('0x1a')]);_0x5f40d2[_0x347a('0x18')]=qs[_0x347a('0x18')](_0x1bf600[_0x347a('0x2c')]['offset']);}_0x5f40d2[_0x347a('0x35')]=qs[_0x347a('0x36')](_0x1bf600[_0x347a('0x2c')][_0x347a('0x36')]);_0x5f40d2[_0x347a('0x37')]=qs['filters'](_[_0x347a('0x38')](_0x1bf600[_0x347a('0x2c')],_0x207b11[_0x347a('0x2e')]),_0x139715);if(_0x1bf600[_0x347a('0x2c')][_0x347a('0x39')]){_0x5f40d2[_0x347a('0x37')]=_[_0x347a('0x3a')](_0x5f40d2[_0x347a('0x37')],{'$or':_[_0x347a('0x3b')](_0x139715,function(_0x2392a3){if(_0x2392a3['type']!==_0x347a('0x3c')){var _0x151bdb={};_0x151bdb[_0x2392a3[_0x347a('0x25')]]={'$like':'%'+_0x1bf600[_0x347a('0x2c')]['filter']+'%'};return _0x151bdb;}})});}_0x5f40d2=_[_0x347a('0x3a')]({},_0x5f40d2,_0x1bf600[_0x347a('0x3d')]);var _0x262bbb={'where':_0x5f40d2[_0x347a('0x37')]};return db[_0x347a('0x28')][_0x347a('0x1b')](_0x262bbb)[_0x347a('0x21')](function(_0x568dc7){_0x427e57[_0x347a('0x1b')]=_0x568dc7;if(_0x1bf600[_0x347a('0x2c')][_0x347a('0x3e')]){_0x5f40d2[_0x347a('0x3f')]=[{'all':!![]}];}return db[_0x347a('0x28')]['findAll'](_0x5f40d2);})[_0x347a('0x21')](function(_0x2f9614){_0x427e57[_0x347a('0x40')]=_0x2f9614;return _0x427e57;})[_0x347a('0x21')](respondWithFilteredResult(_0x2fd196,_0x5f40d2))['catch'](handleError(_0x2fd196,null));};exports[_0x347a('0x41')]=function(_0x61e78c,_0x115b8a){var _0x366a13={'raw':!![],'where':{'id':_0x61e78c['params']['id']}},_0x384f59={};_0x384f59[_0x347a('0x30')]=_[_0x347a('0x2d')](db[_0x347a('0x28')][_0x347a('0x29')]);_0x384f59[_0x347a('0x2c')]=_[_0x347a('0x2d')](_0x61e78c[_0x347a('0x2c')]);_0x384f59[_0x347a('0x2e')]=_[_0x347a('0x2f')](_0x384f59[_0x347a('0x30')],_0x384f59[_0x347a('0x2c')]);_0x366a13['attributes']=_['intersection'](_0x384f59[_0x347a('0x30')],qs[_0x347a('0x32')](_0x61e78c[_0x347a('0x2c')][_0x347a('0x32')]));_0x366a13[_0x347a('0x31')]=_0x366a13[_0x347a('0x31')][_0x347a('0x33')]?_0x366a13[_0x347a('0x31')]:_0x384f59[_0x347a('0x30')];if(_0x61e78c[_0x347a('0x2c')]['includeAll']){_0x366a13[_0x347a('0x3f')]=[{'all':!![]}];}_0x366a13=_[_0x347a('0x3a')]({},_0x366a13,_0x61e78c['options']);return db[_0x347a('0x28')]['find'](_0x366a13)[_0x347a('0x21')](handleEntityNotFound(_0x115b8a,null))['then'](respondWithResult(_0x115b8a,null))[_0x347a('0x42')](handleError(_0x115b8a,null));};exports['create']=function(_0x46f276,_0x12d4fd){return db[_0x347a('0x28')][_0x347a('0x43')](_0x46f276['body'],{})[_0x347a('0x21')](respondWithResult(_0x12d4fd,0xc9))[_0x347a('0x42')](handleError(_0x12d4fd,null));};exports['update']=function(_0x493f06,_0x3901e9){if(_0x493f06['body']['id']){delete _0x493f06['body']['id'];}return db[_0x347a('0x28')]['find']({'where':{'id':_0x493f06[_0x347a('0x44')]['id']}})[_0x347a('0x21')](handleEntityNotFound(_0x3901e9,null))[_0x347a('0x21')](saveUpdates(_0x493f06[_0x347a('0x45')],null))[_0x347a('0x21')](respondWithResult(_0x3901e9,null))['catch'](handleError(_0x3901e9,null));};exports[_0x347a('0x46')]=function(_0x40e213,_0x5eca13){return db[_0x347a('0x28')][_0x347a('0x47')]({'where':{'id':_0x40e213['params']['id']}})['then'](handleEntityNotFound(_0x5eca13,null))[_0x347a('0x21')](removeEntity(_0x5eca13,null))[_0x347a('0x42')](handleError(_0x5eca13,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index bf77e83..28f72ea 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 _0x5282=['../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x26d06e,_0x5d0f7f){var _0x1b39bc=function(_0x46c22e){while(--_0x46c22e){_0x26d06e['push'](_0x26d06e['shift']());}};_0x1b39bc(++_0x5d0f7f);}(_0x5282,0x111));var _0x2528=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0x5282[_0x25a42a];return _0x1129b1;};'use strict';var _=require(_0x2528('0x0'));var util=require('util');var logger=require(_0x2528('0x1'))(_0x2528('0x2'));var moment=require(_0x2528('0x3'));var BPromise=require(_0x2528('0x4'));var rp=require(_0x2528('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2528('0x6'));var config=require(_0x2528('0x7'));var attributes=require(_0x2528('0x8'));module[_0x2528('0x9')]=function(_0x266084,_0x1f51f9){return _0x266084[_0x2528('0xa')](_0x2528('0xb'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2528('0xc'),'collate':_0x2528('0xd')});}; \ No newline at end of file +var _0x3fea=['lodash','util','moment','bluebird','request-promise','path','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2666b4,_0x5052e7){var _0x57629c=function(_0x5b4783){while(--_0x5b4783){_0x2666b4['push'](_0x2666b4['shift']());}};_0x57629c(++_0x5052e7);}(_0x3fea,0x1bc));var _0xa3fe=function(_0x398251,_0x7768d4){_0x398251=_0x398251-0x0;var _0x440012=_0x3fea[_0x398251];return _0x440012;};'use strict';var _=require(_0xa3fe('0x0'));var util=require(_0xa3fe('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa3fe('0x2'));var BPromise=require(_0xa3fe('0x3'));var rp=require(_0xa3fe('0x4'));var fs=require('fs');var path=require(_0xa3fe('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa3fe('0x6'));module['exports']=function(_0x380ba9,_0x462b65){return _0x380ba9[_0xa3fe('0x7')](_0xa3fe('0x8'),attributes,{'tableName':_0xa3fe('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa3fe('0xa'),'collate':_0xa3fe('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 3564c58..9a18f8a 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 _0x56c8=['message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','SmsApplication,\x20%s,\x20%s'];(function(_0x5baef5,_0x4fb90b){var _0x57d3a1=function(_0x432836){while(--_0x432836){_0x5baef5['push'](_0x5baef5['shift']());}};_0x57d3a1(++_0x4fb90b);}(_0x56c8,0x12f));var _0x856c=function(_0xe79d37,_0x4f7ed0){_0xe79d37=_0xe79d37-0x0;var _0x52cfcd=_0x56c8[_0xe79d37];return _0x52cfcd;};'use strict';var _=require(_0x856c('0x0'));var util=require(_0x856c('0x1'));var moment=require(_0x856c('0x2'));var BPromise=require(_0x856c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x856c('0x4'));var db=require(_0x856c('0x5'))['db'];var utils=require(_0x856c('0x6'));var logger=require(_0x856c('0x7'))(_0x856c('0x8'));var config=require('../../config/environment');var jayson=require(_0x856c('0x9'));var client=jayson[_0x856c('0xa')][_0x856c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15a17c,_0x338a7e,_0x456bdb){return new BPromise(function(_0x48d81b,_0x5064ef){return client[_0x856c('0xc')](_0x15a17c,_0x456bdb)[_0x856c('0xd')](function(_0xa2bd07){logger['info']('SmsApplication,\x20%s,\x20%s',_0x338a7e,'request\x20sent');logger[_0x856c('0xe')](_0x856c('0xf'),_0x338a7e,_0x856c('0x10'),JSON['stringify'](_0xa2bd07));if(_0xa2bd07[_0x856c('0x11')]){if(_0xa2bd07[_0x856c('0x11')]['code']===0x1f4){logger[_0x856c('0x11')](_0x856c('0x12'),_0x338a7e,_0xa2bd07[_0x856c('0x11')][_0x856c('0x13')]);return _0x5064ef(_0xa2bd07[_0x856c('0x11')][_0x856c('0x13')]);}logger[_0x856c('0x11')](_0x856c('0x12'),_0x338a7e,_0xa2bd07['error'][_0x856c('0x13')]);return _0x48d81b(_0xa2bd07['error'][_0x856c('0x13')]);}else{logger[_0x856c('0x14')](_0x856c('0x12'),_0x338a7e,_0x856c('0x10'));_0x48d81b(_0xa2bd07[_0x856c('0x15')][_0x856c('0x13')]);}})[_0x856c('0x16')](function(_0x13b1c6){logger[_0x856c('0x11')](_0x856c('0x12'),_0x338a7e,_0x13b1c6);_0x5064ef(_0x13b1c6);});});} \ No newline at end of file +var _0x905a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','code','message','SmsApplication,\x20%s,\x20%s','info','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x4dfb21,_0x433976){var _0x50e09b=function(_0xda2f71){while(--_0xda2f71){_0x4dfb21['push'](_0x4dfb21['shift']());}};_0x50e09b(++_0x433976);}(_0x905a,0xeb));var _0xa905=function(_0x442165,_0x53ace0){_0x442165=_0x442165-0x0;var _0x5de80d=_0x905a[_0x442165];return _0x5de80d;};'use strict';var _=require(_0xa905('0x0'));var util=require('util');var moment=require(_0xa905('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa905('0x2'));var db=require(_0xa905('0x3'))['db'];var utils=require(_0xa905('0x4'));var logger=require(_0xa905('0x5'))(_0xa905('0x6'));var config=require(_0xa905('0x7'));var jayson=require(_0xa905('0x8'));var client=jayson[_0xa905('0x9')][_0xa905('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a0072,_0x18c72e,_0x16ac5b){return new BPromise(function(_0x314e6d,_0x51ae6d){return client[_0xa905('0xb')](_0x3a0072,_0x16ac5b)['then'](function(_0x43eced){logger['info']('SmsApplication,\x20%s,\x20%s',_0x18c72e,_0xa905('0xc'));logger[_0xa905('0xd')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x18c72e,_0xa905('0xc'),JSON['stringify'](_0x43eced));if(_0x43eced['error']){if(_0x43eced[_0xa905('0xe')][_0xa905('0xf')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x18c72e,_0x43eced[_0xa905('0xe')][_0xa905('0x10')]);return _0x51ae6d(_0x43eced[_0xa905('0xe')][_0xa905('0x10')]);}logger[_0xa905('0xe')](_0xa905('0x11'),_0x18c72e,_0x43eced['error'][_0xa905('0x10')]);return _0x314e6d(_0x43eced['error'][_0xa905('0x10')]);}else{logger[_0xa905('0x12')]('SmsApplication,\x20%s,\x20%s',_0x18c72e,'request\x20sent');_0x314e6d(_0x43eced['result'][_0xa905('0x10')]);}})[_0xa905('0x13')](function(_0x1d393b){logger[_0xa905('0xe')](_0xa905('0x11'),_0x18c72e,_0x1d393b);_0x51ae6d(_0x1d393b);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 7310691..2392345 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 _0xe5b5=['destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','sms','smsinteraction:addtags','put','tracked','smsinteraction:update','delete','smsinteraction:destroy'];(function(_0x1da06f,_0x280122){var _0x5847b0=function(_0x1ae8f8){while(--_0x1ae8f8){_0x1da06f['push'](_0x1da06f['shift']());}};_0x5847b0(++_0x280122);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x53ddab,_0x4ada9d){_0x53ddab=_0x53ddab-0x0;var _0x5819ac=_0xe5b5[_0x53ddab];return _0x5819ac;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/messages',auth[_0x5e5b('0xc')](),controller['getMessages']);router[_0x5e5b('0xb')](_0x5e5b('0x12'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5e5b('0x14')](_0x5e5b('0x15'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x16')]);router[_0x5e5b('0x14')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),interaction['tracked'](_0x5e5b('0x18'),_0x5e5b('0x19')),controller['addTags']);router[_0x5e5b('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x5e5b('0x1b')](_0x5e5b('0x18'),_0x5e5b('0x1c')),controller['update']);router[_0x5e5b('0x1d')]('/:id',auth[_0x5e5b('0xc')](),interaction[_0x5e5b('0x1b')]('sms',_0x5e5b('0x1e')),controller[_0x5e5b('0x1f')]);router[_0x5e5b('0x1d')]('/:id/tags',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x20')]);module['exports']=router; \ No newline at end of file +var _0x36ee=['../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','smsinteraction:addtags','addTags','put','tracked','sms','smsinteraction:update','update','delete','smsinteraction:destroy','/:id/tags','removeTags','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x332363,_0x5c9942){var _0xe15eef=function(_0x27f330){while(--_0x27f330){_0x332363['push'](_0x332363['shift']());}};_0xe15eef(++_0x5c9942);}(_0x36ee,0xe8));var _0xe36e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x36ee[_0x501510];return _0x1e6ee5;};'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('0x13')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x14')]);router['post'](_0xe36e('0xf'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x13')]('/:id/tags',auth[_0xe36e('0x9')](),interaction['tracked']('sms',_0xe36e('0x16')),controller[_0xe36e('0x17')]);router[_0xe36e('0x18')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')](_0xe36e('0x1a'),_0xe36e('0x1b')),controller[_0xe36e('0x1c')]);router[_0xe36e('0x1d')]('/:id',auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')]('sms',_0xe36e('0x1e')),controller['destroy']);router[_0xe36e('0x1d')](_0xe36e('0x1f'),auth['isAuthenticated'](),controller[_0xe36e('0x20')]);module[_0xe36e('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 2e9b08a..a282b6a 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 _0x4d87=['ENUM','out','moment','exports','BOOLEAN','STRING','DATE'];(function(_0x2a7ed1,_0x59159e){var _0xc81ead=function(_0xfa2187){while(--_0xfa2187){_0x2a7ed1['push'](_0x2a7ed1['shift']());}};_0xc81ead(++_0x59159e);}(_0x4d87,0xf0));var _0x74d8=function(_0x326fa1,_0x4fa2cd){_0x326fa1=_0x326fa1-0x0;var _0x10b976=_0x4d87[_0x326fa1];return _0x10b976;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x74d8('0x0'));module[_0x74d8('0x1')]={'closed':{'type':Sequelize[_0x74d8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x74d8('0x3')]},'secondDisposition':{'type':Sequelize[_0x74d8('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x74d8('0x3')]},'read1stAt':{'type':Sequelize[_0x74d8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x74d8('0x5')]('in',_0x74d8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x74d8('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x4873=['moment','exports','DATE','STRING','ENUM','out','BOOLEAN','sequelize'];(function(_0x126604,_0x43bf92){var _0x1cdef2=function(_0x4f83c9){while(--_0x4f83c9){_0x126604['push'](_0x126604['shift']());}};_0x1cdef2(++_0x43bf92);}(_0x4873,0x1df));var _0x3487=function(_0x469629,_0x3ee6d5){_0x469629=_0x469629-0x0;var _0x1b9321=_0x4873[_0x469629];return _0x1b9321;};'use strict';var Sequelize=require(_0x3487('0x0'));var moment=require(_0x3487('0x1'));module[_0x3487('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3487('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3487('0x4')]},'note':{'type':Sequelize[_0x3487('0x4')]},'phone':{'type':Sequelize[_0x3487('0x4')]},'read1stAt':{'type':Sequelize[_0x3487('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x3487('0x5')]('in',_0x3487('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3487('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3487('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3487('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 9745ff7..45cd88a 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 _0xac4a=['group','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','toString','sequelize','keyBy','merge','SmsInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','params','includeAll','include','options','create','body','update','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','format','YYYY-MM-DD\x20HH:mm:ss','spread','emit','smsInteractionTags:save','removeTags','download','join','server','tmp','root','files','CmContact','firstName','lastName','direction','secret','SmsAccount','Account','Owner','mkdirSync','Sms','N.A.','createdAt','disposition','Messages','System','out','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','./smsInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','field','color','from','tools_tags','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','SmsAccountId','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?'];(function(_0x2825a6,_0x5111df){var _0x3eb3ea=function(_0x734517){while(--_0x734517){_0x2825a6['push'](_0x2825a6['shift']());}};_0x3eb3ea(++_0x5111df);}(_0xac4a,0x13f));var _0xaac4=function(_0x7574b4,_0x5d8850){_0x7574b4=_0x7574b4-0x0;var _0x574f00=_0xac4a[_0x7574b4];return _0x574f00;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var pdf=require(_0xaac4('0x10'));var hardwareService=require(_0xaac4('0x11'));var logger=require(_0xaac4('0x12'))(_0xaac4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaac4('0x14'));var db=require(_0xaac4('0x15'))['db'];config[_0xaac4('0x16')]=_['defaults'](config[_0xaac4('0x16')],{'host':_0xaac4('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaac4('0x16')]));require(_0xaac4('0x18'))[_0xaac4('0x19')](socket);function respondWithStatusCode(_0x150fdd,_0x187624){_0x187624=_0x187624||0xcc;return function(_0x2fbeb7){if(_0x2fbeb7){return _0x150fdd[_0xaac4('0x1a')](_0x187624);}return _0x150fdd[_0xaac4('0x1b')](_0x187624)[_0xaac4('0x1c')]();};}function respondWithResult(_0xb8466e,_0x35bc32){_0x35bc32=_0x35bc32||0xc8;return function(_0x1766c2){if(_0x1766c2){return _0xb8466e[_0xaac4('0x1b')](_0x35bc32)['json'](_0x1766c2);}};}function respondWithFilteredResult(_0x33bc73,_0x52085a){return function(_0x220630){if(_0x220630){var _0x5b6fd6=typeof _0x52085a[_0xaac4('0x1d')]===_0xaac4('0x1e')&&typeof _0x52085a[_0xaac4('0x1f')]===_0xaac4('0x1e');var _0x3cbcb1=_0x220630[_0xaac4('0x20')];var _0x44f0e8=_0x5b6fd6?0x0:_0x52085a[_0xaac4('0x1d')];var _0x4166ee=_0x5b6fd6?_0x220630['count']:_0x52085a[_0xaac4('0x1d')]+_0x52085a['limit'];var _0x3303f1;if(_0x4166ee>=_0x3cbcb1){_0x4166ee=_0x3cbcb1;_0x3303f1=0xc8;}else{_0x3303f1=0xce;}_0x33bc73[_0xaac4('0x1b')](_0x3303f1);return _0x33bc73[_0xaac4('0x21')](_0xaac4('0x22'),_0x44f0e8+'-'+_0x4166ee+'/'+_0x3cbcb1)[_0xaac4('0x23')](_0x220630);}return null;};}function patchUpdates(_0x383a8c){return function(_0x590905){try{jsonpatch[_0xaac4('0x24')](_0x590905,_0x383a8c,!![]);}catch(_0x27a84d){return BPromise[_0xaac4('0x25')](_0x27a84d);}return _0x590905[_0xaac4('0x26')]();};}function saveUpdates(_0x3dd059,_0x2dcc59){return function(_0xb2577b){if(_0xb2577b){return _0xb2577b['update'](_0x3dd059)[_0xaac4('0x27')](function(_0x4f1b65){return _0x4f1b65;});}return null;};}function removeEntity(_0x54203b,_0x4fac85){return function(_0x5a0bb3){if(_0x5a0bb3){return _0x5a0bb3[_0xaac4('0x28')]()[_0xaac4('0x27')](function(){_0x54203b[_0xaac4('0x1b')](0xcc)[_0xaac4('0x1c')]();});}};}function handleEntityNotFound(_0x3c1445,_0x249a5d){return function(_0x43b122){if(!_0x43b122){_0x3c1445[_0xaac4('0x1a')](0x194);}return _0x43b122;};}function handleError(_0x2f36ad,_0x386c9b){_0x386c9b=_0x386c9b||0x1f4;return function(_0x4d0f5f){logger[_0xaac4('0x29')](_0x4d0f5f[_0xaac4('0x2a')]);if(_0x4d0f5f[_0xaac4('0x2b')]){delete _0x4d0f5f[_0xaac4('0x2b')];}_0x2f36ad[_0xaac4('0x1b')](_0x386c9b)[_0xaac4('0x2c')](_0x4d0f5f);};}function getInteractionUsers(_0x5e469a,_0xcf6c1){return new BPromise(function(_0x5d2c9a,_0x2df7e3){try{if(_0xcf6c1[_0x5e469a['id']]){_0x5e469a[_0xaac4('0x2d')]=_[_0xaac4('0x2e')](_0xcf6c1[_0x5e469a['id']],function(_0x2aaa68){return{'id':_0x2aaa68['id'],'fullname':_0x2aaa68['fullname']};});}}catch(_0x5000e1){_0x2df7e3(_0x5000e1);}_0x5d2c9a(_0x5e469a);});}function getInteractionTags(_0x58f748,_0x20abcc){return new BPromise(function(_0xee6aa9,_0x2df196){try{if(_0x58f748[_0xaac4('0x2f')]){_0x58f748[_0xaac4('0x30')]=[];_0x58f748[_0xaac4('0x2f')][_0xaac4('0x31')](',')[_0xaac4('0x32')](function(_0x2481a9){_0x58f748[_0xaac4('0x30')][_0xaac4('0x33')](_0x20abcc[_0x2481a9]);});}delete _0x58f748[_0xaac4('0x2f')];}catch(_0x10e67b){_0x2df196(_0x10e67b);}_0xee6aa9(_0x58f748);});}function updateSmsInteraction(_0x3b93e5,_0x1f7646,_0x5b38a4){return new BPromise(function(_0x5bad9f,_0xd89df1){return getInteractionUsers(_0x3b93e5,_0x5b38a4)[_0xaac4('0x27')](function(_0xa07d0){return getInteractionTags(_0xa07d0,_0x1f7646);})['then'](function(_0x191d0f){_0x5bad9f(_0x191d0f);})[_0xaac4('0x34')](function(_0x2cbf8d){_0xd89df1(_0x2cbf8d);});});}exports[_0xaac4('0x35')]=function(_0x1ec59d,_0x1e1853){var _0x418939={},_0x53b7cb={},_0x36591a={'count':0x0,'rows':[]};var _0x31ec51=_[_0xaac4('0x2e')](db['SmsInteraction'][_0xaac4('0x36')],function(_0x497e7b){return{'name':_0x497e7b['fieldName'],'type':_0x497e7b[_0xaac4('0x37')][_0xaac4('0x38')]};});_0x53b7cb[_0xaac4('0x39')]=_['map'](_0x31ec51,'name');_0x53b7cb[_0xaac4('0x3a')]=_[_0xaac4('0x3b')](_0x1ec59d[_0xaac4('0x3a')]);_0x53b7cb[_0xaac4('0x3c')]=_[_0xaac4('0x3d')](_0x53b7cb[_0xaac4('0x39')],_0x53b7cb['query']);_0x418939['attributes']=_[_0xaac4('0x3d')](_0x53b7cb[_0xaac4('0x39')],qs['fields'](_0x1ec59d[_0xaac4('0x3a')][_0xaac4('0x3e')]));_0x418939[_0xaac4('0x3f')]=_0x418939['attributes'][_0xaac4('0x40')]?_0x418939[_0xaac4('0x3f')]:_0x53b7cb[_0xaac4('0x39')];if(!_0x1ec59d['query'][_0xaac4('0x41')](_0xaac4('0x42'))){_0x418939[_0xaac4('0x1f')]=qs[_0xaac4('0x1f')](_0x1ec59d['query'][_0xaac4('0x1f')]);_0x418939['offset']=qs['offset'](_0x1ec59d[_0xaac4('0x3a')][_0xaac4('0x1d')]);}_0x418939[_0xaac4('0x43')]=qs[_0xaac4('0x44')](_0x1ec59d[_0xaac4('0x3a')][_0xaac4('0x44')]);_0x418939[_0xaac4('0x45')]=qs[_0xaac4('0x3c')](_['pick'](_0x1ec59d[_0xaac4('0x3a')],_0x53b7cb[_0xaac4('0x3c')]),_0x31ec51);var _0x1fea3d=[];var _0x2bba0c=squel['select']()[_0xaac4('0x46')]('id')[_0xaac4('0x46')](_0xaac4('0x2b'))['field'](_0xaac4('0x47'))[_0xaac4('0x48')](_0xaac4('0x49'));var _0x2b9030=squel['select']()[_0xaac4('0x46')](_0xaac4('0x4a'))[_0xaac4('0x46')]('u.fullname')[_0xaac4('0x46')](_0xaac4('0x4b'))[_0xaac4('0x48')](_0xaac4('0x4c'),'ui')[_0xaac4('0x4d')](_0xaac4('0x4e'),'u',_0xaac4('0x4f'));var _0xa8d1c9=squel[_0xaac4('0x50')]()['from'](_0xaac4('0x51'),'i')[_0xaac4('0x4d')](_0xaac4('0x52'),'c',_0xaac4('0x53'))[_0xaac4('0x4d')]('users','o','o.id\x20=\x20i.UserId')[_0xaac4('0x4d')](_0xaac4('0x54'),'a',_0xaac4('0x55'))[_0xaac4('0x4d')]('sms_messages','me',_0xaac4('0x56'))['left_join'](_0xaac4('0x57'),'it',_0xaac4('0x58'))['left_join'](_0xaac4('0x49'),'t',_0xaac4('0x59'));var _0x357bc6=squel['expr']();var _0x517dac=[];var _0x1624a6=squel[_0xaac4('0x5a')]();var _0x22dda7;if(_0x1ec59d[_0xaac4('0x3a')][_0xaac4('0x5b')]){_0x22dda7=as[_0xaac4('0x5c')](_0x1ec59d['query'][_0xaac4('0x5b')]);var _0x370315=_0x22dda7[_0xaac4('0x5d')];for(var _0x38f9af=0x0;_0x38f9af<_0x22dda7['conditions'][_0xaac4('0x40')];_0x38f9af++){var _0x571418=_0x22dda7[_0xaac4('0x5e')][_0x38f9af];var _0x3a703c='i';var _0x460252=_[_0xaac4('0x5f')](_0x31ec51,[_0xaac4('0x2b'),_0x571418[_0xaac4('0x46')]]);if(!_0x460252){switch(_0x571418[_0xaac4('0x46')]){case _0xaac4('0x60'):if(_0x571418[_0xaac4('0x61')]==0x1){_0xa8d1c9[_0xaac4('0x62')]('`'+_0x571418[_0xaac4('0x46')]+_0xaac4('0x63'));}else{_0xa8d1c9[_0xaac4('0x62')]('`'+_0x571418[_0xaac4('0x46')]+'`\x20>\x200');}break;case _0xaac4('0x64'):if(_0x571418[_0xaac4('0x65')]===_0xaac4('0x66')){if(_0x571418[_0xaac4('0x61')][_0xaac4('0x31')]('\x20')[_0xaac4('0x40')]>0x1){_0x357bc6[_0x370315](_0xaac4('0x67'),qs[_0xaac4('0x68')](_0x571418['value']),null);}else{var _0x3d7ccc='%'+_0x571418['value']+'%';_0x357bc6[_0x370315](_0xaac4('0x69'),_0x3d7ccc,_0x3d7ccc,_0x3d7ccc);}}else{_0x460252=_['find'](_0x31ec51,[_0xaac4('0x2b'),'ContactId']);_0x571418['field']=_0xaac4('0x6a');_0x3f547e=as[_0xaac4('0x6b')](_0x3a703c,_0x460252['type'],_0x571418);_0x357bc6[_0x370315](_0x3f547e[_0xaac4('0x6c')],_0x3f547e[_0xaac4('0x61')][_0xaac4('0x6d')],_0x3f547e[_0xaac4('0x61')][_0xaac4('0x1c')]);}break;case _0xaac4('0x6e'):var _0x5d38bc=_0x571418[_0xaac4('0x61')]['split'](',')[_0xaac4('0x2e')](function(_0x5ec220){return Number(_0x5ec220);});_0x5d38bc['forEach'](function(_0x5e302c){_0x1624a6['or'](_0xaac4('0x6f'),'%,'+_0x5e302c+',%');});_0x517dac=_[_0xaac4('0x70')](_0x517dac,_0x5d38bc);break;case _0xaac4('0x71'):if(_0x571418[_0xaac4('0x65')]==='$substring'){_0x357bc6[_0x370315](_0xaac4('0x72'),'%'+_0x571418[_0xaac4('0x61')]+'%',null);}else{_0x460252=_[_0xaac4('0x5f')](_0x31ec51,['name',_0xaac4('0x73')]);_0x571418[_0xaac4('0x46')]=_0xaac4('0x73');_0x3f547e=as[_0xaac4('0x6b')](_0x3a703c,_0x460252[_0xaac4('0x37')],_0x571418);_0x357bc6[_0x370315](_0x3f547e[_0xaac4('0x6c')],_0x3f547e[_0xaac4('0x61')]['start'],_0x3f547e['value'][_0xaac4('0x1c')]);}break;case'body':_0x3f547e=as['buildExpression']('me',null,_0x571418);_0x357bc6[_0x370315](_0x3f547e[_0xaac4('0x6c')],_0x3f547e['value'][_0xaac4('0x6d')],_0x3f547e['value'][_0xaac4('0x1c')]);break;}}else{var _0x3f547e=as['buildExpression'](_0x3a703c,_0x460252['type'],_0x571418);_0x357bc6[_0x370315](_0x3f547e['text'],_0x3f547e['value'][_0xaac4('0x6d')],_0x3f547e[_0xaac4('0x61')][_0xaac4('0x1c')]);}}}else{var _0x399c74=_(_0x1ec59d['query'])[_0xaac4('0x3b')]()[_0xaac4('0x2e')](function(_0x3b0470){return _[_0xaac4('0x74')](_0x31ec51,[_0xaac4('0x2b'),_0x3b0470])?_0x3b0470:undefined;})[_0xaac4('0x75')]()[_0xaac4('0x61')]();if(!_[_0xaac4('0x76')](_0x399c74)){_0x399c74[_0xaac4('0x32')](function(_0x40271c){if(_0x40271c===_0xaac4('0x77')){_0xa8d1c9['where']('i.SmsAccountId\x20IN\x20?',[][_0xaac4('0x78')](_0x1ec59d['query'][_0x40271c]));}else if(_0x40271c==='createdAt'){var _0x3141af=JSON['parse'](_0x1ec59d[_0xaac4('0x3a')][_0x40271c])[_0xaac4('0x79')];var _0x26bae8=JSON[_0xaac4('0x7a')](_0x1ec59d['query'][_0x40271c])[_0xaac4('0x7b')];_0xa8d1c9[_0xaac4('0x45')](_0xaac4('0x7c'),_0x3141af,_0x26bae8);}else{if(_0x1ec59d[_0xaac4('0x3a')][_0x40271c]===_0xaac4('0x7d')){_0xa8d1c9[_0xaac4('0x45')]('i.'+_0x40271c+'\x20IS\x20NULL');}else{_0xa8d1c9[_0xaac4('0x45')]('i.'+_0x40271c+_0xaac4('0x7e'),_0x1ec59d['query'][_0x40271c]);}}});}if(_0x1ec59d[_0xaac4('0x3a')][_0xaac4('0x7f')]){if(_0x1ec59d['query']['read']==0x1){_0xa8d1c9[_0xaac4('0x62')](_0xaac4('0x80'));}else{_0xa8d1c9[_0xaac4('0x62')](_0xaac4('0x81'));}}if(_0x1ec59d[_0xaac4('0x3a')][_0xaac4('0x82')]){_0x517dac=_[_0xaac4('0x83')](_0x1ec59d[_0xaac4('0x3a')]['tag'])?_0x1ec59d[_0xaac4('0x3a')][_0xaac4('0x82')]:new Array(_0x1ec59d[_0xaac4('0x3a')][_0xaac4('0x82')]);_0x517dac[_0xaac4('0x32')](function(_0x2fef84){_0x1624a6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2fef84+',%');});}if(_0x1ec59d[_0xaac4('0x3a')][_0xaac4('0x84')]){var _0x53059b=_0x1ec59d['query']['filter'][_0xaac4('0x85')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x53059b)){_0x357bc6['or']('i.id\x20LIKE\x20?',_0x53059b+'%')['or']('i.phone\x20LIKE\x20?',_0x53059b+'%');}else{_0x357bc6['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xaac4('0x68')](_0x53059b))['or'](_0xaac4('0x86'),_0x53059b+'%');}}}_0xa8d1c9[_0xaac4('0x45')](_0x357bc6);_0xa8d1c9[_0xaac4('0x87')]('i.id');var _0x28c01d={'type':db[_0xaac4('0x88')][_0xaac4('0x89')][_0xaac4('0x8a')],'raw':!![]};var _0x28cb6f=_0xa8d1c9[_0xaac4('0x8b')]();_0x28cb6f[_0xaac4('0x46')]('i.id');_0x28cb6f[_0xaac4('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x418939[_0xaac4('0x43')]){_0x418939[_0xaac4('0x43')][_0xaac4('0x32')](function(_0x1d02fd){var _0x201d81=_0x1d02fd[0x0]===_0xaac4('0x8c')?_0x1d02fd[0x0]:'i.'+_0x1d02fd[0x0];_0xa8d1c9[_0xaac4('0x43')](_0x201d81,_0x1d02fd[0x1]===_0xaac4('0x8d')?![]:!![]);});}if(!_[_0xaac4('0x76')](_0x517dac)){_0xa8d1c9[_0xaac4('0x62')](_0x1624a6);_0x28cb6f[_0xaac4('0x45')](_0xaac4('0x8e'),_0x517dac);}BPromise[_0xaac4('0x8f')]()[_0xaac4('0x27')](function(){if(!_0x22dda7){if(_0x1ec59d[_0xaac4('0x3a')][_0xaac4('0x77')])return;_0x28cb6f[_0xaac4('0x45')](_0xaac4('0x90'));_0xa8d1c9[_0xaac4('0x45')](_0xaac4('0x90'));return;}if(_0x1ec59d[_0xaac4('0x91')][_0xaac4('0x92')]!==_0xaac4('0x93'))return;return _0x1ec59d[_0xaac4('0x91')][_0xaac4('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0xb12069){if(_[_0xaac4('0x76')](_0xb12069)){_0x28cb6f[_0xaac4('0x45')](_0xaac4('0x95'));_0xa8d1c9[_0xaac4('0x45')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x28cb6f[_0xaac4('0x45')](_0xaac4('0x96'),_[_0xaac4('0x2e')](_0xb12069,'id'));_0xa8d1c9[_0xaac4('0x45')](_0xaac4('0x96'),_['map'](_0xb12069,'id'));}});})[_0xaac4('0x27')](function(){if(_0x1ec59d['user'][_0xaac4('0x92')]===_0xaac4('0x93')&&!_0x22dda7&&!_0x1ec59d['query'][_0xaac4('0x77')])return[];return db['sequelize'][_0xaac4('0x3a')](_0x28cb6f[_0xaac4('0x97')](),_0x28c01d);})['then'](function(_0x3dea56){_0x36591a[_0xaac4('0x20')]=_0x3dea56['length'];if(_0x36591a[_0xaac4('0x20')]===0x0)return[];return db[_0xaac4('0x98')][_0xaac4('0x3a')](_0x2bba0c[_0xaac4('0x97')](),_0x28c01d)[_0xaac4('0x27')](function(_0x328567){_0x1fea3d=_[_0xaac4('0x99')](_0x328567,'id');_0x28c01d=_[_0xaac4('0x9a')](_0x28c01d,{'model':db[_0xaac4('0x9b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1ec59d['query'][_0xaac4('0x3e')]){_0x418939[_0xaac4('0x3f')][_0xaac4('0x32')](function(_0x5d475c){_0xa8d1c9[_0xaac4('0x46')]('i.'+_0x5d475c);});}else{_0xa8d1c9[_0xaac4('0x46')](_0xaac4('0x9c'),_0xaac4('0x60'));_0xa8d1c9[_0xaac4('0x46')](_0xaac4('0x9d'),_0xaac4('0x9e'));_0xa8d1c9[_0xaac4('0x46')](_0xaac4('0x9f'),_0xaac4('0xa0'));_0xa8d1c9[_0xaac4('0x46')](_0xaac4('0xa1'),_0xaac4('0x8c'));_0xa8d1c9[_0xaac4('0x46')](_0xaac4('0xa2'));_0xa8d1c9[_0xaac4('0x46')]('c.firstName',_0xaac4('0xa3'));_0xa8d1c9[_0xaac4('0x46')](_0xaac4('0xa4'),'Contact.lastName');_0xa8d1c9[_0xaac4('0x46')](_0xaac4('0xa5'),'Contact.email');_0xa8d1c9[_0xaac4('0x46')]('c.phone',_0xaac4('0xa6'));_0xa8d1c9[_0xaac4('0x46')](_0xaac4('0xa7'),_0xaac4('0xa8'));_0xa8d1c9[_0xaac4('0x46')](_0xaac4('0xa9'),'Contact.fax');_0xa8d1c9[_0xaac4('0x46')](_0xaac4('0xaa'),_0xaac4('0xab'));_0xa8d1c9[_0xaac4('0x46')]('o.internal',_0xaac4('0xac'));_0xa8d1c9[_0xaac4('0x46')](_0xaac4('0xad'),'TagIds');}if(_0x418939[_0xaac4('0x1f')])_0xa8d1c9[_0xaac4('0x1f')](_0x418939[_0xaac4('0x1f')]);if(_0x418939[_0xaac4('0x1d')])_0xa8d1c9[_0xaac4('0x1d')](_0x418939['offset']);return db['sequelize'][_0xaac4('0x3a')](_0xa8d1c9[_0xaac4('0x97')](),_0x28c01d);})[_0xaac4('0x27')](function(_0xcb43db){if(_0xcb43db['length']>0x0)_0x2b9030[_0xaac4('0x45')](_0xaac4('0xae'),_[_0xaac4('0x2e')](_0xcb43db,'id'));return db[_0xaac4('0x98')][_0xaac4('0x3a')](_0x2b9030[_0xaac4('0x97')](),_0x28c01d)[_0xaac4('0x27')](function(_0x3f97ba){var _0x145ac1=_[_0xaac4('0xaf')](_0x3f97ba,_0xaac4('0xb0'));var _0x1e4e84=[];_0xcb43db[_0xaac4('0x32')](function(_0x4dde7f){_0x1e4e84[_0xaac4('0x33')](updateSmsInteraction(_0x4dde7f,_0x1fea3d,_0x145ac1));});return BPromise[_0xaac4('0xb1')](_0x1e4e84);});});})[_0xaac4('0x27')](function(_0x43c575){_0x36591a[_0xaac4('0xb2')]=_0x43c575;return _0x36591a;})[_0xaac4('0x27')](respondWithFilteredResult(_0x1e1853,_0x418939))[_0xaac4('0x34')](handleError(_0x1e1853,null));};exports['show']=function(_0x3fe063,_0x3abb63){var _0x32ca0b={'raw':![],'where':{'id':_0x3fe063[_0xaac4('0xb3')]['id']}},_0x12df94={};_0x12df94[_0xaac4('0x39')]=_[_0xaac4('0x3b')](db[_0xaac4('0x9b')]['rawAttributes']);_0x12df94[_0xaac4('0x3a')]=_[_0xaac4('0x3b')](_0x3fe063[_0xaac4('0x3a')]);_0x12df94[_0xaac4('0x3c')]=_[_0xaac4('0x3d')](_0x12df94[_0xaac4('0x39')],_0x12df94[_0xaac4('0x3a')]);_0x32ca0b[_0xaac4('0x3f')]=_[_0xaac4('0x3d')](_0x12df94[_0xaac4('0x39')],qs['fields'](_0x3fe063['query'][_0xaac4('0x3e')]));_0x32ca0b[_0xaac4('0x3f')]=_0x32ca0b[_0xaac4('0x3f')][_0xaac4('0x40')]?_0x32ca0b[_0xaac4('0x3f')]:_0x12df94['model'];if(_0x3fe063[_0xaac4('0x3a')][_0xaac4('0xb4')]){_0x32ca0b[_0xaac4('0xb5')]=[{'all':!![]}];}_0x32ca0b=_[_0xaac4('0x9a')]({},_0x32ca0b,_0x3fe063[_0xaac4('0xb6')]);return db[_0xaac4('0x9b')][_0xaac4('0x5f')](_0x32ca0b)[_0xaac4('0x27')](handleEntityNotFound(_0x3abb63,null))[_0xaac4('0x27')](respondWithResult(_0x3abb63,null))[_0xaac4('0x34')](handleError(_0x3abb63,null));};exports[_0xaac4('0xb7')]=function(_0x26cdef,_0xe4a5ad){return db[_0xaac4('0x9b')][_0xaac4('0xb7')](_0x26cdef[_0xaac4('0xb8')],{})[_0xaac4('0x27')](respondWithResult(_0xe4a5ad,0xc9))[_0xaac4('0x34')](handleError(_0xe4a5ad,null));};exports[_0xaac4('0xb9')]=function(_0x2c7e3e,_0x15b1ad){if(_0x2c7e3e[_0xaac4('0xb8')]['id']){delete _0x2c7e3e[_0xaac4('0xb8')]['id'];}return db[_0xaac4('0x9b')][_0xaac4('0x5f')]({'where':{'id':_0x2c7e3e[_0xaac4('0xb3')]['id']}})[_0xaac4('0x27')](handleEntityNotFound(_0x15b1ad,null))[_0xaac4('0x27')](saveUpdates(_0x2c7e3e[_0xaac4('0xb8')],null))[_0xaac4('0x27')](respondWithResult(_0x15b1ad,null))[_0xaac4('0x34')](handleError(_0x15b1ad,null));};exports[_0xaac4('0x28')]=function(_0x337061,_0x20f1c4){return db['SmsInteraction'][_0xaac4('0x5f')]({'where':{'id':_0x337061[_0xaac4('0xb3')]['id']}})[_0xaac4('0x27')](handleEntityNotFound(_0x20f1c4,null))[_0xaac4('0x27')](removeEntity(_0x20f1c4,null))[_0xaac4('0x34')](handleError(_0x20f1c4,null));};exports[_0xaac4('0xba')]=function(_0x8d0eeb,_0x3b0af8){return db['SmsInteraction'][_0xaac4('0xba')]()[_0xaac4('0x27')](respondWithResult(_0x3b0af8,null))['catch'](handleError(_0x3b0af8,null));};exports[_0xaac4('0xbb')]=function(_0x13f59b,_0x18628c,_0x2af5ff){return db['SmsMessage'][_0xaac4('0x5f')]({'where':{'id':_0x13f59b[_0xaac4('0xb3')]['id']}})[_0xaac4('0x27')](handleEntityNotFound(_0x18628c,null))[_0xaac4('0x27')](function(_0x4673f1){if(_0x4673f1){return _0x4673f1[_0xaac4('0xbb')](_0x13f59b[_0xaac4('0xb8')][_0xaac4('0xbc')],_[_0xaac4('0xbd')](_0x13f59b['body'],[_0xaac4('0xbc'),'id'])||{});}})[_0xaac4('0x27')](respondWithResult(_0x18628c,null))[_0xaac4('0x34')](handleError(_0x18628c,null));};exports[_0xaac4('0xbe')]=function(_0x30f57d,_0x1b72e9,_0x2b4e84){var _0x438206={'raw':![],'where':{}};var _0x299b63={};var _0x4c4fd7={'count':0x0,'rows':[]};return db[_0xaac4('0x9b')][_0xaac4('0xbf')]({'where':{'id':_0x30f57d['params']['id']}})['then'](handleEntityNotFound(_0x1b72e9,null))[_0xaac4('0x27')](function(_0x3d9982){if(_0x3d9982){_0x299b63[_0xaac4('0x39')]=_[_0xaac4('0x3b')](db[_0xaac4('0xc0')][_0xaac4('0x36')]);_0x299b63['query']=_[_0xaac4('0x3b')](_0x30f57d[_0xaac4('0x3a')]);_0x299b63['filters']=_[_0xaac4('0x3d')](_0x299b63[_0xaac4('0x39')],_0x299b63[_0xaac4('0x3a')]);_0x438206['attributes']=_[_0xaac4('0x3d')](_0x299b63[_0xaac4('0x39')],qs[_0xaac4('0x3e')](_0x30f57d[_0xaac4('0x3a')]['fields']));_0x438206['attributes']=_0x438206[_0xaac4('0x3f')][_0xaac4('0x40')]?_0x438206[_0xaac4('0x3f')]:_0x299b63[_0xaac4('0x39')];if(!_0x30f57d[_0xaac4('0x3a')][_0xaac4('0x41')](_0xaac4('0x42'))){_0x438206[_0xaac4('0x1f')]=qs[_0xaac4('0x1f')](_0x30f57d['query'][_0xaac4('0x1f')]);_0x438206[_0xaac4('0x1d')]=qs[_0xaac4('0x1d')](_0x30f57d[_0xaac4('0x3a')][_0xaac4('0x1d')]);}_0x438206[_0xaac4('0x43')]=qs[_0xaac4('0x44')](_0x30f57d['query'][_0xaac4('0x44')]);_0x438206[_0xaac4('0x45')]=qs['filters'](_['pick'](_0x30f57d['query'],_0x299b63[_0xaac4('0x3c')]));_0x438206[_0xaac4('0x45')][_0xaac4('0xb0')]=_0x3d9982['id'];if(_0x30f57d[_0xaac4('0x3a')][_0xaac4('0x84')]){_0x438206[_0xaac4('0x45')]=_[_0xaac4('0x9a')](_0x438206[_0xaac4('0x45')],{'$or':_[_0xaac4('0x2e')](_0x438206[_0xaac4('0x3f')],function(_0x128f8e){var _0x44ae3c={};_0x44ae3c[_0x128f8e]={'$like':'%'+_0x30f57d[_0xaac4('0x3a')][_0xaac4('0x84')]+'%'};return _0x44ae3c;})});}if(_0x30f57d['query'][_0xaac4('0x79')]){var _0x533fd7=_0x30f57d[_0xaac4('0x3a')][_0xaac4('0x79')][_0xaac4('0x31')](',');var _0x593598={};_0x593598[_0x533fd7[0x0]]={'$gte':moment(_0x533fd7[0x1])[_0xaac4('0xc1')](_0xaac4('0xc2'))};_0x438206[_0xaac4('0x45')]=_[_0xaac4('0x9a')](_0x438206['where'],_0x593598);}_0x438206=_[_0xaac4('0x9a')]({},_0x438206,_0x30f57d[_0xaac4('0xb6')]);return db[_0xaac4('0xc0')][_0xaac4('0x20')]({'where':_0x438206[_0xaac4('0x45')]})[_0xaac4('0x27')](function(_0x4cbbb8){_0x4c4fd7[_0xaac4('0x20')]=_0x4cbbb8;if(_0x30f57d[_0xaac4('0x3a')]['includeAll']){_0x438206[_0xaac4('0xb5')]=[{'all':!![]}];}return db[_0xaac4('0xc0')]['findAll'](_0x438206);})['then'](function(_0x55c223){_0x4c4fd7[_0xaac4('0xb2')]=_0x55c223;return _0x4c4fd7;});}})[_0xaac4('0x27')](respondWithFilteredResult(_0x1b72e9,_0x438206))[_0xaac4('0x34')](handleError(_0x1b72e9,null));};exports['addTags']=function(_0x25f93b,_0x5da3a2,_0x30b2a1){return db[_0xaac4('0x9b')][_0xaac4('0x5f')]({'where':{'id':_0x25f93b[_0xaac4('0xb3')]['id']}})[_0xaac4('0x27')](handleEntityNotFound(_0x5da3a2,null))['then'](function(_0x30aa12){if(_0x30aa12){return _0x30aa12['setTags'](_0x25f93b[_0xaac4('0xb8')][_0xaac4('0xbc')],_[_0xaac4('0xbd')](_0x25f93b[_0xaac4('0xb8')],[_0xaac4('0xbc'),'id'])||{})[_0xaac4('0xc3')](function(){return db[_0xaac4('0x6e')]['findAll']({'attributes':['id',_0xaac4('0x2b'),_0xaac4('0x47')],'where':{'id':_0x25f93b[_0xaac4('0xb8')]['ids']}});})['then'](function(_0x2f8ac4){socket[_0xaac4('0xc4')](_0xaac4('0xc5'),{'id':Number(_0x25f93b['params']['id']),'tags':_0x2f8ac4||[]});return{'id':Number(_0x25f93b['params']['id']),'tags':_0x2f8ac4||[]};});}})['then'](respondWithResult(_0x5da3a2,null))[_0xaac4('0x34')](handleError(_0x5da3a2,null));};exports[_0xaac4('0xc6')]=function(_0x4b2d98,_0x48fab2,_0x40697e){return db[_0xaac4('0x9b')]['find']({'where':{'id':_0x4b2d98['params']['id']}})[_0xaac4('0x27')](handleEntityNotFound(_0x48fab2,null))[_0xaac4('0x27')](function(_0x5969d1){if(_0x5969d1){return _0x5969d1[_0xaac4('0xc6')](_0x4b2d98[_0xaac4('0x3a')]['ids']);}})[_0xaac4('0x27')](respondWithStatusCode(_0x48fab2,null))[_0xaac4('0x34')](handleError(_0x48fab2,null));};exports[_0xaac4('0xc7')]=function(_0x17ff33,_0x11de67){var _0x11906a=moment()['unix']()['toString']();var _0x4f3de9=path[_0xaac4('0xc8')](config['root'],_0xaac4('0xc9'),'files',_0xaac4('0xca'));var _0x5b8c3b=path[_0xaac4('0xc8')](config[_0xaac4('0xcb')],'server',_0xaac4('0xcc'),'attachments');var _0x27d958=path['join'](_0x4f3de9,_0x11906a);var _0xe692a0=util[_0xaac4('0xc1')]('transcript-%d-%s.zip',_0x17ff33[_0xaac4('0xb3')]['id'],_0x11906a);var _0x1c7ab0=path[_0xaac4('0xc8')](_0x4f3de9,_0xe692a0);var _0x238a16=[];_0x238a16['push']({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x238a16[_0xaac4('0x33')]({'model':db[_0xaac4('0xcd')],'as':_0xaac4('0x64'),'attributes':['id',_0xaac4('0xce'),_0xaac4('0xcf')],'raw':!![]});var _0x2e8daf=[{'model':db[_0xaac4('0xc0')],'as':'Messages','attributes':['id',_0xaac4('0xb8'),'createdAt',_0xaac4('0xd0'),_0xaac4('0xd1'),_0xaac4('0x7f')],'include':_0x238a16}];_0x2e8daf[_0xaac4('0x33')]({'model':db[_0xaac4('0xd2')],'as':_0xaac4('0xd3'),'attributes':['id',_0xaac4('0x2b')]});_0x2e8daf[_0xaac4('0x33')]({'model':db[_0xaac4('0x71')],'as':_0xaac4('0xd4'),'attributes':['id','fullname']});return db[_0xaac4('0x9b')][_0xaac4('0x5f')]({'where':{'id':_0x17ff33[_0xaac4('0xb3')]['id']},'include':_0x2e8daf})[_0xaac4('0x27')](handleEntityNotFound(_0x11de67,null))[_0xaac4('0x27')](function(_0x29ffe0){if(_0x29ffe0){var _0x18c51=_0x29ffe0['get']({'plain':!![]});fs[_0xaac4('0xd5')](_0x27d958);var _0x45b118={'channel':_0xaac4('0xd6'),'account':_0x18c51[_0xaac4('0xd3')][_0xaac4('0x2b')],'agent':_0x18c51[_0xaac4('0xd4')]?_0x18c51[_0xaac4('0xd4')]['fullname']:_0xaac4('0xd7'),'createdAt':moment(_0x18c51[_0xaac4('0xd8')])[_0xaac4('0xc1')](_0xaac4('0xc2'))[_0xaac4('0x97')](),'closedAt':_0x18c51['closed']?moment(_0x18c51['closedAt'])[_0xaac4('0xc1')](_0xaac4('0xc2'))[_0xaac4('0x97')]():'','disposition':_0x18c51[_0xaac4('0xd9')],'messages':_(_0x18c51[_0xaac4('0xda')])[_0xaac4('0x84')]({'secret':![]})[_0xaac4('0x2e')](function(_0x38fa21){return{'date':moment(_0x38fa21[_0xaac4('0xd8')])[_0xaac4('0xc1')](_0xaac4('0xc2'))['toString'](),'sender':_0x38fa21[_0xaac4('0xd0')]==='out'?_0x38fa21['User']?_0x38fa21[_0xaac4('0x71')]['fullname']:_0xaac4('0xdb'):_0x38fa21[_0xaac4('0x64')]['firstName']+(_0x38fa21['Contact'][_0xaac4('0xcf')]?'\x20'+_0x38fa21[_0xaac4('0x64')][_0xaac4('0xcf')]:''),'body':_0x38fa21[_0xaac4('0xb8')],'direction':_0x38fa21[_0xaac4('0xd0')]===_0xaac4('0xdc')?'A':'C','secret':_0x38fa21[_0xaac4('0xd1')],'read':_0x38fa21['read']};})[_0xaac4('0x61')]()};return ejs[_0xaac4('0xdd')](path[_0xaac4('0xc8')](config[_0xaac4('0xcb')],_0xaac4('0xc9'),_0xaac4('0xde'),'downloadInteraction.ejs'),{'interaction':_0x45b118})[_0xaac4('0x27')](function(_0x250ab6){var _0x2aa69c=path[_0xaac4('0xc8')](_0x27d958,_0xaac4('0xdf')+_0x18c51['id']+'-'+_0x11906a+_0xaac4('0xe0'));var _0x5cdd55={'path':_0x2aa69c,'channel':_0xaac4('0xd6'),'interactionId':_0x18c51['id']};return pdf[_0xaac4('0xe1')](_0x250ab6,_0x5cdd55);})[_0xaac4('0x27')](function(){return new BPromise(function(_0x1d15fd,_0x4e136c){zipdir(_0x27d958,{'saveTo':_0x1c7ab0},function(_0x482fc7,_0x1291c1){if(_0x482fc7)return _0x4e136c(_0x482fc7);return _0x1d15fd(_0x1291c1);});})[_0xaac4('0x27')](function(){return new BPromise(function(_0x7e7b30,_0x26ed30){rimraf(_0x27d958,function(_0x436337){if(_0x436337)_0x26ed30(_0x436337);return _0x7e7b30();});});})[_0xaac4('0x27')](function(){return _0x11de67[_0xaac4('0xc7')](_0x1c7ab0,_0xe692a0,function(_0x3297c1){if(_0x3297c1){console[_0xaac4('0xe2')]('err',_0x3297c1);}else{fs['unlinkSync'](_0x1c7ab0);}});});});}else{return _0x11de67[_0xaac4('0x1a')](0xc8);}})[_0xaac4('0x34')](handleError(_0x11de67,null));}; \ No newline at end of file +var _0x2cf6=['rows','setTags','spread','removeTags','download','unix','join','server','tmp','root','attachments','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','get','mkdirSync','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','out','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','end','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','catch','map','SmsInteraction','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','users','left_join','cm_contacts','o.id\x20=\x20i.UserId','sms_accounts','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','value','getFullTextValue','find','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','$substring','UserId','start','keys','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.SmsAccountId\x20IS\x20NULL','toString','sequelize','keyBy','a.key','Account.key','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','contactName','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','all','params','include','merge','create','body','describe','addMessage','SmsMessage','ids','getMessages','findOne','hasOwnProperty','SmsInteractionId','format','options','includeAll','findAll'];(function(_0x2110f1,_0x330231){var _0x1ac2d9=function(_0x169629){while(--_0x169629){_0x2110f1['push'](_0x2110f1['shift']());}};_0x1ac2d9(++_0x330231);}(_0x2cf6,0x1df));var _0x62cf=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x2cf6[_0x12d033];return _0x3b4e80;};'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('sox');var csv=require(_0x62cf('0x9'));var ejs=require(_0x62cf('0xa'));var fs=require('fs');var fs_extra=require(_0x62cf('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x62cf('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x62cf('0x9'));var querystring=require(_0x62cf('0xd'));var Papa=require(_0x62cf('0xe'));var Redis=require(_0x62cf('0xf'));var authService=require(_0x62cf('0x10'));var qs=require(_0x62cf('0x11'));var as=require(_0x62cf('0x12'));var pdf=require(_0x62cf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x62cf('0x14'))('api');var utils=require(_0x62cf('0x15'));var config=require(_0x62cf('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x62cf('0x17'))['db'];config[_0x62cf('0x18')]=_[_0x62cf('0x19')](config[_0x62cf('0x18')],{'host':_0x62cf('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x62cf('0x1b'))[_0x62cf('0x1c')](socket);function respondWithStatusCode(_0x4f61ca,_0x408484){_0x408484=_0x408484||0xcc;return function(_0x4ec18b){if(_0x4ec18b){return _0x4f61ca[_0x62cf('0x1d')](_0x408484);}return _0x4f61ca[_0x62cf('0x1e')](_0x408484)['end']();};}function respondWithResult(_0xc803ee,_0x60746d){_0x60746d=_0x60746d||0xc8;return function(_0x10d0d5){if(_0x10d0d5){return _0xc803ee[_0x62cf('0x1e')](_0x60746d)[_0x62cf('0x1f')](_0x10d0d5);}};}function respondWithFilteredResult(_0x5a70ab,_0x1c8239){return function(_0x52fc3c){if(_0x52fc3c){var _0xd88e01=typeof _0x1c8239[_0x62cf('0x20')]===_0x62cf('0x21')&&typeof _0x1c8239[_0x62cf('0x22')]===_0x62cf('0x21');var _0x5f3aa0=_0x52fc3c['count'];var _0x2ca2f6=_0xd88e01?0x0:_0x1c8239['offset'];var _0x4f171e=_0xd88e01?_0x52fc3c[_0x62cf('0x23')]:_0x1c8239[_0x62cf('0x20')]+_0x1c8239[_0x62cf('0x22')];var _0x2bdd2c;if(_0x4f171e>=_0x5f3aa0){_0x4f171e=_0x5f3aa0;_0x2bdd2c=0xc8;}else{_0x2bdd2c=0xce;}_0x5a70ab[_0x62cf('0x1e')](_0x2bdd2c);return _0x5a70ab[_0x62cf('0x24')]('Content-Range',_0x2ca2f6+'-'+_0x4f171e+'/'+_0x5f3aa0)[_0x62cf('0x1f')](_0x52fc3c);}return null;};}function patchUpdates(_0x4f544c){return function(_0x19c578){try{jsonpatch[_0x62cf('0x25')](_0x19c578,_0x4f544c,!![]);}catch(_0x1b8502){return BPromise[_0x62cf('0x26')](_0x1b8502);}return _0x19c578['save']();};}function saveUpdates(_0x102ab1,_0x10c122){return function(_0x4eb509){if(_0x4eb509){return _0x4eb509[_0x62cf('0x27')](_0x102ab1)[_0x62cf('0x28')](function(_0x1eee38){return _0x1eee38;});}return null;};}function removeEntity(_0x2310af,_0x18b567){return function(_0x31b6f1){if(_0x31b6f1){return _0x31b6f1[_0x62cf('0x29')]()[_0x62cf('0x28')](function(){_0x2310af[_0x62cf('0x1e')](0xcc)[_0x62cf('0x2a')]();});}};}function handleEntityNotFound(_0x10f1c1,_0x5d539c){return function(_0x4f63eb){if(!_0x4f63eb){_0x10f1c1[_0x62cf('0x1d')](0x194);}return _0x4f63eb;};}function handleError(_0x43690c,_0x3c609e){_0x3c609e=_0x3c609e||0x1f4;return function(_0x3ade5a){logger[_0x62cf('0x2b')](_0x3ade5a[_0x62cf('0x2c')]);if(_0x3ade5a[_0x62cf('0x2d')]){delete _0x3ade5a['name'];}_0x43690c[_0x62cf('0x1e')](_0x3c609e)[_0x62cf('0x2e')](_0x3ade5a);};}function getInteractionUsers(_0x1e340e,_0x3548a9){return new BPromise(function(_0x5b0605,_0x586a94){try{if(_0x3548a9[_0x1e340e['id']]){_0x1e340e[_0x62cf('0x2f')]=_['map'](_0x3548a9[_0x1e340e['id']],function(_0x30235e){return{'id':_0x30235e['id'],'fullname':_0x30235e[_0x62cf('0x30')]};});}}catch(_0x7b616d){_0x586a94(_0x7b616d);}_0x5b0605(_0x1e340e);});}function getInteractionTags(_0x11f24c,_0x35992e){return new BPromise(function(_0x4f303e,_0xb763be){try{if(_0x11f24c[_0x62cf('0x31')]){_0x11f24c[_0x62cf('0x32')]=[];_0x11f24c[_0x62cf('0x31')][_0x62cf('0x33')](',')[_0x62cf('0x34')](function(_0xcd6366){_0x11f24c['Tags'][_0x62cf('0x35')](_0x35992e[_0xcd6366]);});}delete _0x11f24c[_0x62cf('0x31')];}catch(_0x21c14d){_0xb763be(_0x21c14d);}_0x4f303e(_0x11f24c);});}function updateSmsInteraction(_0x41c907,_0x5979f8,_0x27e5e3){return new BPromise(function(_0x4829a0,_0x59a070){return getInteractionUsers(_0x41c907,_0x27e5e3)[_0x62cf('0x28')](function(_0x19966f){return getInteractionTags(_0x19966f,_0x5979f8);})[_0x62cf('0x28')](function(_0x24f51d){_0x4829a0(_0x24f51d);})[_0x62cf('0x36')](function(_0x2849c0){_0x59a070(_0x2849c0);});});}exports['index']=function(_0x40f153,_0x38aaab){var _0x3d55e0={},_0x4fe184={},_0xf89f36={'count':0x0,'rows':[]};var _0x3f1ba4=_[_0x62cf('0x37')](db[_0x62cf('0x38')]['rawAttributes'],function(_0x4c8069){return{'name':_0x4c8069[_0x62cf('0x39')],'type':_0x4c8069['type'][_0x62cf('0x3a')]};});_0x4fe184[_0x62cf('0x3b')]=_[_0x62cf('0x37')](_0x3f1ba4,_0x62cf('0x2d'));_0x4fe184[_0x62cf('0x3c')]=_['keys'](_0x40f153[_0x62cf('0x3c')]);_0x4fe184[_0x62cf('0x3d')]=_[_0x62cf('0x3e')](_0x4fe184[_0x62cf('0x3b')],_0x4fe184[_0x62cf('0x3c')]);_0x3d55e0['attributes']=_[_0x62cf('0x3e')](_0x4fe184[_0x62cf('0x3b')],qs['fields'](_0x40f153[_0x62cf('0x3c')][_0x62cf('0x3f')]));_0x3d55e0[_0x62cf('0x40')]=_0x3d55e0['attributes'][_0x62cf('0x41')]?_0x3d55e0[_0x62cf('0x40')]:_0x4fe184[_0x62cf('0x3b')];if(!_0x40f153[_0x62cf('0x3c')]['hasOwnProperty'](_0x62cf('0x42'))){_0x3d55e0[_0x62cf('0x22')]=qs[_0x62cf('0x22')](_0x40f153[_0x62cf('0x3c')][_0x62cf('0x22')]);_0x3d55e0[_0x62cf('0x20')]=qs['offset'](_0x40f153['query'][_0x62cf('0x20')]);}_0x3d55e0[_0x62cf('0x43')]=qs[_0x62cf('0x44')](_0x40f153[_0x62cf('0x3c')]['sort']);_0x3d55e0[_0x62cf('0x45')]=qs[_0x62cf('0x3d')](_[_0x62cf('0x46')](_0x40f153[_0x62cf('0x3c')],_0x4fe184[_0x62cf('0x3d')]),_0x3f1ba4);var _0x1286f6=[];var _0x4a6850=squel[_0x62cf('0x47')]()[_0x62cf('0x48')]('id')[_0x62cf('0x48')](_0x62cf('0x2d'))[_0x62cf('0x48')](_0x62cf('0x49'))[_0x62cf('0x4a')](_0x62cf('0x4b'));var _0x7ccd32=squel[_0x62cf('0x47')]()[_0x62cf('0x48')](_0x62cf('0x4c'))[_0x62cf('0x48')](_0x62cf('0x4d'))['field'](_0x62cf('0x4e'))[_0x62cf('0x4a')](_0x62cf('0x4f'),'ui')['left_join'](_0x62cf('0x50'),'u','u.id\x20=\x20ui.UserId');var _0x2ef765=squel[_0x62cf('0x47')]()[_0x62cf('0x4a')]('sms_interactions','i')[_0x62cf('0x51')](_0x62cf('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x62cf('0x51')](_0x62cf('0x50'),'o',_0x62cf('0x53'))[_0x62cf('0x51')](_0x62cf('0x54'),'a','a.id\x20=\x20i.SmsAccountId')[_0x62cf('0x51')]('sms_messages','me',_0x62cf('0x55'))['left_join'](_0x62cf('0x56'),'it',_0x62cf('0x57'))[_0x62cf('0x51')]('tools_tags','t',_0x62cf('0x58'));var _0x40f3cf=squel['expr']();var _0x509da2=[];var _0x2f7cb7=squel['expr']();var _0x13e0de;if(_0x40f153[_0x62cf('0x3c')][_0x62cf('0x59')]){_0x13e0de=as['parseSearch'](_0x40f153['query']['search']);var _0x58626c=_0x13e0de[_0x62cf('0x5a')];for(var _0x46b868=0x0;_0x46b868<_0x13e0de['conditions'][_0x62cf('0x41')];_0x46b868++){var _0x1afac2=_0x13e0de[_0x62cf('0x5b')][_0x46b868];var _0x1b6e11='i';var _0x45d041=_['find'](_0x3f1ba4,[_0x62cf('0x2d'),_0x1afac2[_0x62cf('0x48')]]);if(!_0x45d041){switch(_0x1afac2[_0x62cf('0x48')]){case _0x62cf('0x5c'):if(_0x1afac2['value']==0x1){_0x2ef765[_0x62cf('0x5d')]('`'+_0x1afac2['field']+_0x62cf('0x5e'));}else{_0x2ef765['having']('`'+_0x1afac2['field']+_0x62cf('0x5f'));}break;case _0x62cf('0x60'):if(_0x1afac2['operator']==='$substring'){if(_0x1afac2[_0x62cf('0x61')][_0x62cf('0x33')]('\x20')[_0x62cf('0x41')]>0x1){_0x40f3cf[_0x58626c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x62cf('0x62')](_0x1afac2['value']),null);}else{var _0x36d6fd='%'+_0x1afac2[_0x62cf('0x61')]+'%';_0x40f3cf[_0x58626c]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x36d6fd,_0x36d6fd,_0x36d6fd);}}else{_0x45d041=_[_0x62cf('0x63')](_0x3f1ba4,[_0x62cf('0x2d'),_0x62cf('0x64')]);_0x1afac2[_0x62cf('0x48')]=_0x62cf('0x64');_0x556323=as[_0x62cf('0x65')](_0x1b6e11,_0x45d041[_0x62cf('0x66')],_0x1afac2);_0x40f3cf[_0x58626c](_0x556323[_0x62cf('0x67')],_0x556323[_0x62cf('0x61')]['start'],_0x556323[_0x62cf('0x61')][_0x62cf('0x2a')]);}break;case _0x62cf('0x68'):var _0x37a6b6=_0x1afac2['value']['split'](',')[_0x62cf('0x37')](function(_0x8c701f){return Number(_0x8c701f);});_0x37a6b6[_0x62cf('0x34')](function(_0x2f5d89){_0x2f7cb7['or'](_0x62cf('0x69'),'%,'+_0x2f5d89+',%');});_0x509da2=_[_0x62cf('0x6a')](_0x509da2,_0x37a6b6);break;case'User':if(_0x1afac2[_0x62cf('0x6b')]===_0x62cf('0x6c')){_0x40f3cf[_0x58626c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1afac2['value']+'%',null);}else{_0x45d041=_[_0x62cf('0x63')](_0x3f1ba4,[_0x62cf('0x2d'),'UserId']);_0x1afac2[_0x62cf('0x48')]=_0x62cf('0x6d');_0x556323=as[_0x62cf('0x65')](_0x1b6e11,_0x45d041[_0x62cf('0x66')],_0x1afac2);_0x40f3cf[_0x58626c](_0x556323[_0x62cf('0x67')],_0x556323[_0x62cf('0x61')][_0x62cf('0x6e')],_0x556323['value'][_0x62cf('0x2a')]);}break;case'body':_0x556323=as['buildExpression']('me',null,_0x1afac2);_0x40f3cf[_0x58626c](_0x556323[_0x62cf('0x67')],_0x556323[_0x62cf('0x61')][_0x62cf('0x6e')],_0x556323[_0x62cf('0x61')][_0x62cf('0x2a')]);break;}}else{var _0x556323=as[_0x62cf('0x65')](_0x1b6e11,_0x45d041[_0x62cf('0x66')],_0x1afac2);_0x40f3cf[_0x58626c](_0x556323[_0x62cf('0x67')],_0x556323['value']['start'],_0x556323[_0x62cf('0x61')][_0x62cf('0x2a')]);}}}else{var _0x13eccc=_(_0x40f153[_0x62cf('0x3c')])[_0x62cf('0x6f')]()['map'](function(_0x3419c2){return _[_0x62cf('0x70')](_0x3f1ba4,[_0x62cf('0x2d'),_0x3419c2])?_0x3419c2:undefined;})['compact']()[_0x62cf('0x61')]();if(!_[_0x62cf('0x71')](_0x13eccc)){_0x13eccc['forEach'](function(_0xc4d0db){if(_0xc4d0db===_0x62cf('0x72')){_0x2ef765['where'](_0x62cf('0x73'),[]['concat'](_0x40f153[_0x62cf('0x3c')][_0xc4d0db]));}else if(_0xc4d0db===_0x62cf('0x74')){var _0xd56568=JSON['parse'](_0x40f153['query'][_0xc4d0db])[_0x62cf('0x75')];var _0x1b24cc=JSON['parse'](_0x40f153[_0x62cf('0x3c')][_0xc4d0db])[_0x62cf('0x76')];_0x2ef765['where'](_0x62cf('0x77'),_0xd56568,_0x1b24cc);}else{if(_0x40f153[_0x62cf('0x3c')][_0xc4d0db]===_0x62cf('0x78')){_0x2ef765[_0x62cf('0x45')]('i.'+_0xc4d0db+_0x62cf('0x79'));}else{_0x2ef765[_0x62cf('0x45')]('i.'+_0xc4d0db+_0x62cf('0x7a'),_0x40f153['query'][_0xc4d0db]);}}});}if(_0x40f153['query']['read']){if(_0x40f153['query'][_0x62cf('0x7b')]==0x1){_0x2ef765[_0x62cf('0x5d')]('`unreadMessages`\x20=\x200');}else{_0x2ef765[_0x62cf('0x5d')](_0x62cf('0x7c'));}}if(_0x40f153[_0x62cf('0x3c')]['tag']){_0x509da2=_[_0x62cf('0x7d')](_0x40f153['query'][_0x62cf('0x7e')])?_0x40f153[_0x62cf('0x3c')][_0x62cf('0x7e')]:new Array(_0x40f153[_0x62cf('0x3c')][_0x62cf('0x7e')]);_0x509da2[_0x62cf('0x34')](function(_0x518b71){_0x2f7cb7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x518b71+',%');});}if(_0x40f153['query'][_0x62cf('0x7f')]){var _0x5f0aa4=_0x40f153[_0x62cf('0x3c')][_0x62cf('0x7f')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x62cf('0x80')](_0x5f0aa4)){_0x40f3cf['or'](_0x62cf('0x81'),_0x5f0aa4+'%')['or'](_0x62cf('0x82'),_0x5f0aa4+'%');}else{_0x40f3cf['or'](_0x62cf('0x83'),qs[_0x62cf('0x62')](_0x5f0aa4))['or'](_0x62cf('0x84'),_0x5f0aa4+'%');}}}_0x2ef765[_0x62cf('0x45')](_0x40f3cf);_0x2ef765['group']('i.id');var _0x52ac40={'type':db[_0x62cf('0x85')]['QueryTypes']['SELECT'],'raw':!![]};var _0x1431dc=_0x2ef765['clone']();_0x1431dc[_0x62cf('0x48')](_0x62cf('0x86'));_0x1431dc[_0x62cf('0x48')](_0x62cf('0x87'),'unreadMessages');if(_0x3d55e0['order']){_0x3d55e0[_0x62cf('0x43')][_0x62cf('0x34')](function(_0x17e3b5){var _0x114843=_0x17e3b5[0x0]==='contactName'?_0x17e3b5[0x0]:'i.'+_0x17e3b5[0x0];_0x2ef765['order'](_0x114843,_0x17e3b5[0x1]===_0x62cf('0x88')?![]:!![]);});}if(!_['isEmpty'](_0x509da2)){_0x2ef765[_0x62cf('0x5d')](_0x2f7cb7);_0x1431dc['where'](_0x62cf('0x89'),_0x509da2);}BPromise[_0x62cf('0x8a')]()[_0x62cf('0x28')](function(){if(!_0x13e0de){if(_0x40f153[_0x62cf('0x3c')][_0x62cf('0x72')])return;_0x1431dc[_0x62cf('0x45')](_0x62cf('0x8b'));_0x2ef765[_0x62cf('0x45')](_0x62cf('0x8b'));return;}if(_0x40f153[_0x62cf('0x8c')][_0x62cf('0x8d')]!==_0x62cf('0x8e'))return;return _0x40f153[_0x62cf('0x8c')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x62cf('0x28')](function(_0x14e5dd){if(_[_0x62cf('0x71')](_0x14e5dd)){_0x1431dc[_0x62cf('0x45')]('i.SmsAccountId\x20IS\x20NULL');_0x2ef765[_0x62cf('0x45')](_0x62cf('0x8f'));}else{_0x1431dc[_0x62cf('0x45')]('i.SmsAccountId\x20IN\x20?',_['map'](_0x14e5dd,'id'));_0x2ef765[_0x62cf('0x45')]('i.SmsAccountId\x20IN\x20?',_[_0x62cf('0x37')](_0x14e5dd,'id'));}});})[_0x62cf('0x28')](function(){if(_0x40f153[_0x62cf('0x8c')]['role']==='agent'&&!_0x13e0de&&!_0x40f153['query'][_0x62cf('0x72')])return[];return db['sequelize'][_0x62cf('0x3c')](_0x1431dc[_0x62cf('0x90')](),_0x52ac40);})[_0x62cf('0x28')](function(_0x140600){_0xf89f36[_0x62cf('0x23')]=_0x140600['length'];if(_0xf89f36[_0x62cf('0x23')]===0x0)return[];return db[_0x62cf('0x91')]['query'](_0x4a6850[_0x62cf('0x90')](),_0x52ac40)['then'](function(_0x2ace2f){_0x1286f6=_[_0x62cf('0x92')](_0x2ace2f,'id');_0x52ac40=_['merge'](_0x52ac40,{'model':db[_0x62cf('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x40f153[_0x62cf('0x3c')]['fields']){_0x3d55e0['attributes'][_0x62cf('0x34')](function(_0x53cb30){_0x2ef765[_0x62cf('0x48')]('i.'+_0x53cb30);});}else{_0x2ef765[_0x62cf('0x48')](_0x62cf('0x87'),_0x62cf('0x5c'));_0x2ef765['field'](_0x62cf('0x93'),_0x62cf('0x94'));_0x2ef765[_0x62cf('0x48')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x2ef765['field'](_0x62cf('0x95'),_0x62cf('0x96'));_0x2ef765['field'](_0x62cf('0x97'));_0x2ef765[_0x62cf('0x48')](_0x62cf('0x98'),_0x62cf('0x99'));_0x2ef765[_0x62cf('0x48')](_0x62cf('0x9a'),'Contact.lastName');_0x2ef765[_0x62cf('0x48')](_0x62cf('0x9b'),'Contact.email');_0x2ef765[_0x62cf('0x48')]('c.phone',_0x62cf('0x9c'));_0x2ef765[_0x62cf('0x48')](_0x62cf('0x9d'),_0x62cf('0x9e'));_0x2ef765[_0x62cf('0x48')](_0x62cf('0x9f'),'Contact.fax');_0x2ef765[_0x62cf('0x48')](_0x62cf('0xa0'),'Owner.fullname');_0x2ef765[_0x62cf('0x48')](_0x62cf('0xa1'),_0x62cf('0xa2'));_0x2ef765[_0x62cf('0x48')](_0x62cf('0xa3'),_0x62cf('0x31'));}if(_0x3d55e0[_0x62cf('0x22')])_0x2ef765[_0x62cf('0x22')](_0x3d55e0['limit']);if(_0x3d55e0[_0x62cf('0x20')])_0x2ef765[_0x62cf('0x20')](_0x3d55e0['offset']);return db[_0x62cf('0x91')]['query'](_0x2ef765['toString'](),_0x52ac40);})['then'](function(_0x23abd1){if(_0x23abd1[_0x62cf('0x41')]>0x0)_0x7ccd32[_0x62cf('0x45')](_0x62cf('0xa4'),_['map'](_0x23abd1,'id'));return db[_0x62cf('0x91')][_0x62cf('0x3c')](_0x7ccd32[_0x62cf('0x90')](),_0x52ac40)['then'](function(_0x3819de){var _0x4751ec=_[_0x62cf('0xa5')](_0x3819de,'SmsInteractionId');var _0x323030=[];_0x23abd1['forEach'](function(_0x3e558d){_0x323030[_0x62cf('0x35')](updateSmsInteraction(_0x3e558d,_0x1286f6,_0x4751ec));});return BPromise[_0x62cf('0xa6')](_0x323030);});});})[_0x62cf('0x28')](function(_0x1e70c9){_0xf89f36['rows']=_0x1e70c9;return _0xf89f36;})[_0x62cf('0x28')](respondWithFilteredResult(_0x38aaab,_0x3d55e0))[_0x62cf('0x36')](handleError(_0x38aaab,null));};exports['show']=function(_0x1ccf7f,_0x10346e){var _0x37f428={'raw':![],'where':{'id':_0x1ccf7f[_0x62cf('0xa7')]['id']}},_0x271344={};_0x271344[_0x62cf('0x3b')]=_['keys'](db[_0x62cf('0x38')]['rawAttributes']);_0x271344[_0x62cf('0x3c')]=_['keys'](_0x1ccf7f['query']);_0x271344[_0x62cf('0x3d')]=_[_0x62cf('0x3e')](_0x271344[_0x62cf('0x3b')],_0x271344[_0x62cf('0x3c')]);_0x37f428[_0x62cf('0x40')]=_['intersection'](_0x271344[_0x62cf('0x3b')],qs[_0x62cf('0x3f')](_0x1ccf7f['query'][_0x62cf('0x3f')]));_0x37f428[_0x62cf('0x40')]=_0x37f428['attributes']['length']?_0x37f428[_0x62cf('0x40')]:_0x271344['model'];if(_0x1ccf7f['query']['includeAll']){_0x37f428[_0x62cf('0xa8')]=[{'all':!![]}];}_0x37f428=_[_0x62cf('0xa9')]({},_0x37f428,_0x1ccf7f['options']);return db[_0x62cf('0x38')]['find'](_0x37f428)[_0x62cf('0x28')](handleEntityNotFound(_0x10346e,null))[_0x62cf('0x28')](respondWithResult(_0x10346e,null))['catch'](handleError(_0x10346e,null));};exports[_0x62cf('0xaa')]=function(_0xaa3750,_0x8cbd63){return db[_0x62cf('0x38')][_0x62cf('0xaa')](_0xaa3750[_0x62cf('0xab')],{})['then'](respondWithResult(_0x8cbd63,0xc9))['catch'](handleError(_0x8cbd63,null));};exports['update']=function(_0x4702d2,_0x1b45f4){if(_0x4702d2[_0x62cf('0xab')]['id']){delete _0x4702d2[_0x62cf('0xab')]['id'];}return db['SmsInteraction'][_0x62cf('0x63')]({'where':{'id':_0x4702d2[_0x62cf('0xa7')]['id']}})[_0x62cf('0x28')](handleEntityNotFound(_0x1b45f4,null))[_0x62cf('0x28')](saveUpdates(_0x4702d2[_0x62cf('0xab')],null))[_0x62cf('0x28')](respondWithResult(_0x1b45f4,null))[_0x62cf('0x36')](handleError(_0x1b45f4,null));};exports[_0x62cf('0x29')]=function(_0x4e7a8f,_0x2c7610){return db['SmsInteraction'][_0x62cf('0x63')]({'where':{'id':_0x4e7a8f[_0x62cf('0xa7')]['id']}})[_0x62cf('0x28')](handleEntityNotFound(_0x2c7610,null))[_0x62cf('0x28')](removeEntity(_0x2c7610,null))['catch'](handleError(_0x2c7610,null));};exports[_0x62cf('0xac')]=function(_0x39b53e,_0x175edf){return db[_0x62cf('0x38')][_0x62cf('0xac')]()[_0x62cf('0x28')](respondWithResult(_0x175edf,null))[_0x62cf('0x36')](handleError(_0x175edf,null));};exports[_0x62cf('0xad')]=function(_0x405aed,_0xf90fff,_0x374d3c){return db[_0x62cf('0xae')][_0x62cf('0x63')]({'where':{'id':_0x405aed['params']['id']}})['then'](handleEntityNotFound(_0xf90fff,null))[_0x62cf('0x28')](function(_0x1d8f5e){if(_0x1d8f5e){return _0x1d8f5e[_0x62cf('0xad')](_0x405aed['body'][_0x62cf('0xaf')],_['omit'](_0x405aed[_0x62cf('0xab')],['ids','id'])||{});}})[_0x62cf('0x28')](respondWithResult(_0xf90fff,null))[_0x62cf('0x36')](handleError(_0xf90fff,null));};exports[_0x62cf('0xb0')]=function(_0x5081fd,_0x7744f,_0x1038e2){var _0x28ed30={'raw':![],'where':{}};var _0x34c649={};var _0xccd44={'count':0x0,'rows':[]};return db[_0x62cf('0x38')][_0x62cf('0xb1')]({'where':{'id':_0x5081fd[_0x62cf('0xa7')]['id']}})['then'](handleEntityNotFound(_0x7744f,null))[_0x62cf('0x28')](function(_0x2ee99f){if(_0x2ee99f){_0x34c649['model']=_['keys'](db[_0x62cf('0xae')]['rawAttributes']);_0x34c649['query']=_[_0x62cf('0x6f')](_0x5081fd[_0x62cf('0x3c')]);_0x34c649[_0x62cf('0x3d')]=_['intersection'](_0x34c649[_0x62cf('0x3b')],_0x34c649[_0x62cf('0x3c')]);_0x28ed30[_0x62cf('0x40')]=_[_0x62cf('0x3e')](_0x34c649[_0x62cf('0x3b')],qs['fields'](_0x5081fd[_0x62cf('0x3c')][_0x62cf('0x3f')]));_0x28ed30[_0x62cf('0x40')]=_0x28ed30[_0x62cf('0x40')][_0x62cf('0x41')]?_0x28ed30['attributes']:_0x34c649[_0x62cf('0x3b')];if(!_0x5081fd[_0x62cf('0x3c')][_0x62cf('0xb2')](_0x62cf('0x42'))){_0x28ed30[_0x62cf('0x22')]=qs[_0x62cf('0x22')](_0x5081fd[_0x62cf('0x3c')]['limit']);_0x28ed30[_0x62cf('0x20')]=qs['offset'](_0x5081fd['query'][_0x62cf('0x20')]);}_0x28ed30[_0x62cf('0x43')]=qs[_0x62cf('0x44')](_0x5081fd['query']['sort']);_0x28ed30[_0x62cf('0x45')]=qs[_0x62cf('0x3d')](_['pick'](_0x5081fd['query'],_0x34c649[_0x62cf('0x3d')]));_0x28ed30[_0x62cf('0x45')][_0x62cf('0xb3')]=_0x2ee99f['id'];if(_0x5081fd[_0x62cf('0x3c')][_0x62cf('0x7f')]){_0x28ed30['where']=_[_0x62cf('0xa9')](_0x28ed30[_0x62cf('0x45')],{'$or':_[_0x62cf('0x37')](_0x28ed30[_0x62cf('0x40')],function(_0x6a292e){var _0x4e1b3e={};_0x4e1b3e[_0x6a292e]={'$like':'%'+_0x5081fd['query']['filter']+'%'};return _0x4e1b3e;})});}if(_0x5081fd[_0x62cf('0x3c')][_0x62cf('0x75')]){var _0x260b33=_0x5081fd[_0x62cf('0x3c')]['$gte'][_0x62cf('0x33')](',');var _0xd1b28a={};_0xd1b28a[_0x260b33[0x0]]={'$gte':moment(_0x260b33[0x1])[_0x62cf('0xb4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x28ed30[_0x62cf('0x45')]=_[_0x62cf('0xa9')](_0x28ed30[_0x62cf('0x45')],_0xd1b28a);}_0x28ed30=_[_0x62cf('0xa9')]({},_0x28ed30,_0x5081fd[_0x62cf('0xb5')]);return db[_0x62cf('0xae')][_0x62cf('0x23')]({'where':_0x28ed30[_0x62cf('0x45')]})[_0x62cf('0x28')](function(_0x2e1bd0){_0xccd44[_0x62cf('0x23')]=_0x2e1bd0;if(_0x5081fd[_0x62cf('0x3c')][_0x62cf('0xb6')]){_0x28ed30[_0x62cf('0xa8')]=[{'all':!![]}];}return db[_0x62cf('0xae')][_0x62cf('0xb7')](_0x28ed30);})[_0x62cf('0x28')](function(_0x533473){_0xccd44[_0x62cf('0xb8')]=_0x533473;return _0xccd44;});}})[_0x62cf('0x28')](respondWithFilteredResult(_0x7744f,_0x28ed30))[_0x62cf('0x36')](handleError(_0x7744f,null));};exports['addTags']=function(_0x42c0f9,_0x2bc182,_0x32c7f6){return db[_0x62cf('0x38')]['find']({'where':{'id':_0x42c0f9[_0x62cf('0xa7')]['id']}})[_0x62cf('0x28')](handleEntityNotFound(_0x2bc182,null))['then'](function(_0x1e5006){if(_0x1e5006){return _0x1e5006[_0x62cf('0xb9')](_0x42c0f9[_0x62cf('0xab')][_0x62cf('0xaf')],_['omit'](_0x42c0f9[_0x62cf('0xab')],[_0x62cf('0xaf'),'id'])||{})[_0x62cf('0xba')](function(){return db[_0x62cf('0x68')][_0x62cf('0xb7')]({'attributes':['id',_0x62cf('0x2d'),_0x62cf('0x49')],'where':{'id':_0x42c0f9[_0x62cf('0xab')]['ids']}});})[_0x62cf('0x28')](function(_0x3c0284){socket['emit']('smsInteractionTags:save',{'id':Number(_0x42c0f9[_0x62cf('0xa7')]['id']),'tags':_0x3c0284||[]});return{'id':Number(_0x42c0f9[_0x62cf('0xa7')]['id']),'tags':_0x3c0284||[]};});}})[_0x62cf('0x28')](respondWithResult(_0x2bc182,null))['catch'](handleError(_0x2bc182,null));};exports[_0x62cf('0xbb')]=function(_0x3e73b7,_0x503a6b,_0x5383b8){return db['SmsInteraction'][_0x62cf('0x63')]({'where':{'id':_0x3e73b7['params']['id']}})[_0x62cf('0x28')](handleEntityNotFound(_0x503a6b,null))['then'](function(_0x458e0d){if(_0x458e0d){return _0x458e0d[_0x62cf('0xbb')](_0x3e73b7['query']['ids']);}})['then'](respondWithStatusCode(_0x503a6b,null))[_0x62cf('0x36')](handleError(_0x503a6b,null));};exports[_0x62cf('0xbc')]=function(_0x151ec8,_0x3c5019){var _0x2318a7=moment()[_0x62cf('0xbd')]()[_0x62cf('0x90')]();var _0xe1f5e0=path[_0x62cf('0xbe')](config['root'],_0x62cf('0xbf'),'files',_0x62cf('0xc0'));var _0x5ccbf2=path[_0x62cf('0xbe')](config[_0x62cf('0xc1')],_0x62cf('0xbf'),'files',_0x62cf('0xc2'));var _0x410f6c=path[_0x62cf('0xbe')](_0xe1f5e0,_0x2318a7);var _0x1f8a7e=util['format'](_0x62cf('0xc3'),_0x151ec8[_0x62cf('0xa7')]['id'],_0x2318a7);var _0x29e5cc=path[_0x62cf('0xbe')](_0xe1f5e0,_0x1f8a7e);var _0x4b73b1=[];_0x4b73b1[_0x62cf('0x35')]({'model':db['User'],'as':_0x62cf('0xc4'),'attributes':['id',_0x62cf('0x30')],'raw':!![]});_0x4b73b1[_0x62cf('0x35')]({'model':db[_0x62cf('0xc5')],'as':_0x62cf('0x60'),'attributes':['id',_0x62cf('0xc6'),_0x62cf('0xc7')],'raw':!![]});var _0x569ce0=[{'model':db[_0x62cf('0xae')],'as':_0x62cf('0xc8'),'attributes':['id','body',_0x62cf('0x74'),_0x62cf('0xc9'),_0x62cf('0xca'),_0x62cf('0x7b')],'include':_0x4b73b1}];_0x569ce0['push']({'model':db[_0x62cf('0xcb')],'as':_0x62cf('0xcc'),'attributes':['id','name']});_0x569ce0[_0x62cf('0x35')]({'model':db[_0x62cf('0xc4')],'as':_0x62cf('0xcd'),'attributes':['id',_0x62cf('0x30')]});return db[_0x62cf('0x38')][_0x62cf('0x63')]({'where':{'id':_0x151ec8['params']['id']},'include':_0x569ce0})['then'](handleEntityNotFound(_0x3c5019,null))[_0x62cf('0x28')](function(_0x4c748e){if(_0x4c748e){var _0x188053=_0x4c748e[_0x62cf('0xce')]({'plain':!![]});fs[_0x62cf('0xcf')](_0x410f6c);var _0x91be53={'channel':'Sms','account':_0x188053[_0x62cf('0xcc')][_0x62cf('0x2d')],'agent':_0x188053[_0x62cf('0xcd')]?_0x188053[_0x62cf('0xcd')][_0x62cf('0x30')]:_0x62cf('0xd0'),'createdAt':moment(_0x188053['createdAt'])[_0x62cf('0xb4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x62cf('0x90')](),'closedAt':_0x188053[_0x62cf('0xd1')]?moment(_0x188053[_0x62cf('0xd2')])[_0x62cf('0xb4')](_0x62cf('0xd3'))[_0x62cf('0x90')]():'','disposition':_0x188053[_0x62cf('0xd4')],'messages':_(_0x188053[_0x62cf('0xc8')])[_0x62cf('0x7f')]({'secret':![]})[_0x62cf('0x37')](function(_0x490208){return{'date':moment(_0x490208[_0x62cf('0x74')])[_0x62cf('0xb4')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x490208[_0x62cf('0xc9')]===_0x62cf('0xd5')?_0x490208[_0x62cf('0xc4')]?_0x490208[_0x62cf('0xc4')][_0x62cf('0x30')]:'System':_0x490208[_0x62cf('0x60')][_0x62cf('0xc6')]+(_0x490208[_0x62cf('0x60')][_0x62cf('0xc7')]?'\x20'+_0x490208[_0x62cf('0x60')][_0x62cf('0xc7')]:''),'body':_0x490208[_0x62cf('0xab')],'direction':_0x490208[_0x62cf('0xc9')]===_0x62cf('0xd5')?'A':'C','secret':_0x490208[_0x62cf('0xca')],'read':_0x490208[_0x62cf('0x7b')]};})[_0x62cf('0x61')]()};return ejs[_0x62cf('0xd6')](path['join'](config['root'],_0x62cf('0xbf'),_0x62cf('0xd7'),'downloadInteraction.ejs'),{'interaction':_0x91be53})['then'](function(_0x3e4dab){var _0x4e268c=path['join'](_0x410f6c,_0x62cf('0xd8')+_0x188053['id']+'-'+_0x2318a7+_0x62cf('0xd9'));var _0x49abad={'path':_0x4e268c,'channel':'Sms','interactionId':_0x188053['id']};return pdf[_0x62cf('0xda')](_0x3e4dab,_0x49abad);})[_0x62cf('0x28')](function(){return new BPromise(function(_0x11b1bf,_0x358f74){zipdir(_0x410f6c,{'saveTo':_0x29e5cc},function(_0xce78c0,_0xd956cc){if(_0xce78c0)return _0x358f74(_0xce78c0);return _0x11b1bf(_0xd956cc);});})[_0x62cf('0x28')](function(){return new BPromise(function(_0x59ea16,_0x403e63){rimraf(_0x410f6c,function(_0x21939e){if(_0x21939e)_0x403e63(_0x21939e);return _0x59ea16();});});})[_0x62cf('0x28')](function(){return _0x3c5019['download'](_0x29e5cc,_0x1f8a7e,function(_0x4fa9cd){if(_0x4fa9cd){console[_0x62cf('0xdb')]('err',_0x4fa9cd);}else{fs[_0x62cf('0xdc')](_0x29e5cc);}});});});}else{return _0x3c5019['sendStatus'](0xc8);}})['catch'](handleError(_0x3c5019,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 1394542..e6b8440 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 _0xe5af=['findAll','unreadMessages','emit','catch','hasOwnProperty','hook','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','remove','setDataValue','Users','map'];(function(_0x3e5a5f,_0x42e767){var _0x3352f7=function(_0x4e6268){while(--_0x4e6268){_0x3e5a5f['push'](_0x3e5a5f['shift']());}};_0x3352f7(++_0x42e767);}(_0xe5af,0x9c));var _0xfe5a=function(_0x19c3f4,_0x3b6a12){_0x19c3f4=_0x19c3f4-0x0;var _0x513c9b=_0xe5af[_0x19c3f4];return _0x513c9b;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xfe5a('0x0'))['db'][_0xfe5a('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0xfe5a('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xfe5a('0x3')](0x0);var events={'afterCreate':_0xfe5a('0x4'),'afterUpdate':'update','afterDestroy':_0xfe5a('0x5')};function emitEvent(_0x48e3a7){return function(_0x526677,_0x37455d,_0x2039cd){_0x526677['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x356c69){_0x526677[_0xfe5a('0x6')](_0xfe5a('0x7'),_0x356c69[_0xfe5a('0x8')](function(_0x5cd100){return{'id':_0x5cd100['id']};}));return SmsMessage[_0xfe5a('0x9')]({'where':{'SmsInteractionId':_0x526677['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x51718e){_0x526677[_0xfe5a('0x6')](_0xfe5a('0xa'),_0x51718e['length']);SmsInteractionEvents[_0xfe5a('0xb')](_0x48e3a7+':'+_0x526677['id'],_0x526677);SmsInteractionEvents[_0xfe5a('0xb')](_0x48e3a7,_0x526677);_0x2039cd(null);})[_0xfe5a('0xc')](_0x2039cd(null));};}for(var e in events){if(events[_0xfe5a('0xd')](e)){var event=events[e];SmsInteraction[_0xfe5a('0xe')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x958a=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users'];(function(_0x23211c,_0x3e24ac){var _0x133ece=function(_0x35aefd){while(--_0x35aefd){_0x23211c['push'](_0x23211c['shift']());}};_0x133ece(++_0x3e24ac);}(_0x958a,0x128));var _0xa958=function(_0x3e5ada,_0x556ac8){_0x3e5ada=_0x3e5ada-0x0;var _0x19fa10=_0x958a[_0x3e5ada];return _0x19fa10;};'use strict';var EventEmitter=require(_0xa958('0x0'));var SmsInteraction=require(_0xa958('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xa958('0x1'))['db'][_0xa958('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xa958('0x3')](0x0);var events={'afterCreate':_0xa958('0x4'),'afterUpdate':_0xa958('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3424b0){return function(_0x578481,_0x2024b8,_0x9b7d9e){_0x578481[_0xa958('0x6')]({'attributes':['id'],'raw':!![]})[_0xa958('0x7')](function(_0x3ca01f){_0x578481[_0xa958('0x8')](_0xa958('0x9'),_0x3ca01f['map'](function(_0x514b4f){return{'id':_0x514b4f['id']};}));return SmsMessage[_0xa958('0xa')]({'where':{'SmsInteractionId':_0x578481['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa958('0x7')](function(_0x11f090){_0x578481[_0xa958('0x8')](_0xa958('0xb'),_0x11f090[_0xa958('0xc')]);SmsInteractionEvents[_0xa958('0xd')](_0x3424b0+':'+_0x578481['id'],_0x578481);SmsInteractionEvents[_0xa958('0xd')](_0x3424b0,_0x578481);_0x9b7d9e(null);})[_0xa958('0xe')](_0x9b7d9e(null));};}for(var e in events){if(events[_0xa958('0xf')](e)){var event=events[e];SmsInteraction[_0xa958('0x10')](e,emitEvent(event));}}module[_0xa958('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index cb6aa55..90ef7de 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 _0xf4d9=['moment','bluebird','path','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','closedAt','lodash','util','../../config/logger','api'];(function(_0x43b7dc,_0x3e479b){var _0x20a38c=function(_0x2a76bd){while(--_0x2a76bd){_0x43b7dc['push'](_0x43b7dc['shift']());}};_0x20a38c(++_0x3e479b);}(_0xf4d9,0xea));var _0x9f4d=function(_0xc6bb3b,_0x2fcf06){_0xc6bb3b=_0xc6bb3b-0x0;var _0x1ce729=_0xf4d9[_0xc6bb3b];return _0x1ce729;};'use strict';var _=require(_0x9f4d('0x0'));var util=require(_0x9f4d('0x1'));var logger=require(_0x9f4d('0x2'))(_0x9f4d('0x3'));var moment=require(_0x9f4d('0x4'));var BPromise=require(_0x9f4d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f4d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9f4d('0x7'));module['exports']=function(_0x5202e5,_0x1f310f){return _0x5202e5[_0x9f4d('0x8')](_0x9f4d('0x9'),attributes,{'tableName':_0x9f4d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x194240,_0x494de1,_0x14b5fe){if(_0x194240[_0x9f4d('0xb')](_0x9f4d('0xc'))){_0x194240[_0x9f4d('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x14b5fe(null,_0x194240);}}});}; \ No newline at end of file +var _0xda95=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','closedAt','format'];(function(_0x419aa4,_0x5926a7){var _0x557d9b=function(_0x43c9ac){while(--_0x43c9ac){_0x419aa4['push'](_0x419aa4['shift']());}};_0x557d9b(++_0x5926a7);}(_0xda95,0x1a9));var _0x5da9=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0xda95[_0x47b15f];return _0x55bf25;};'use strict';var _=require(_0x5da9('0x0'));var util=require(_0x5da9('0x1'));var logger=require(_0x5da9('0x2'))(_0x5da9('0x3'));var moment=require(_0x5da9('0x4'));var BPromise=require(_0x5da9('0x5'));var rp=require(_0x5da9('0x6'));var fs=require('fs');var path=require(_0x5da9('0x7'));var rimraf=require('rimraf');var config=require(_0x5da9('0x8'));var attributes=require(_0x5da9('0x9'));module[_0x5da9('0xa')]=function(_0x2503fb,_0x494da4){return _0x2503fb[_0x5da9('0xb')](_0x5da9('0xc'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43d339,_0x3e880c,_0x2b1869){if(_0x43d339[_0x5da9('0xd')](_0x5da9('0xe'))){_0x43d339[_0x5da9('0xf')]=moment()[_0x5da9('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2b1869(null,_0x43d339);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 0643270..10d7cd5 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 _0x17ed=['stringify','code','error','message','catch','update','body','options','where','attributes','limit','then','UpdateSmsInteraction','AddTagsToSmsInteraction','SmsInteraction','find','addTags','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x46ca8e,_0xcdf234){var _0x29bb72=function(_0x55029b){while(--_0x55029b){_0x46ca8e['push'](_0x46ca8e['shift']());}};_0x29bb72(++_0xcdf234);}(_0x17ed,0xe0));var _0xd17e=function(_0x4a8cba,_0x139627){_0x4a8cba=_0x4a8cba-0x0;var _0x261036=_0x17ed[_0x4a8cba];return _0x261036;};'use strict';var _=require(_0xd17e('0x0'));var util=require(_0xd17e('0x1'));var moment=require(_0xd17e('0x2'));var BPromise=require(_0xd17e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd17e('0x4'));var db=require(_0xd17e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd17e('0x6'));var config=require(_0xd17e('0x7'));var jayson=require(_0xd17e('0x8'));var client=jayson[_0xd17e('0x9')]['http']({'port':0x232a});config[_0xd17e('0xa')]=_[_0xd17e('0xb')](config[_0xd17e('0xa')],{'host':_0xd17e('0xc'),'port':0x18eb});var socket=require(_0xd17e('0xd'))(new Redis(config[_0xd17e('0xa')]));require(_0xd17e('0xe'))[_0xd17e('0xf')](socket);function respondWithRpcPromise(_0x480461,_0x5aadc5,_0x4147fe){return new BPromise(function(_0x23d53e,_0x912663){return client[_0xd17e('0x10')](_0x480461,_0x4147fe)['then'](function(_0x37d20d){logger[_0xd17e('0x11')](_0xd17e('0x12'),_0x5aadc5,_0xd17e('0x13'));logger[_0xd17e('0x14')](_0xd17e('0x15'),_0x5aadc5,'request\x20sent',JSON[_0xd17e('0x16')](_0x37d20d));if(_0x37d20d['error']){if(_0x37d20d['error'][_0xd17e('0x17')]===0x1f4){logger[_0xd17e('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x5aadc5,_0x37d20d[_0xd17e('0x18')][_0xd17e('0x19')]);return _0x912663(_0x37d20d[_0xd17e('0x18')]['message']);}logger[_0xd17e('0x18')](_0xd17e('0x12'),_0x5aadc5,_0x37d20d[_0xd17e('0x18')][_0xd17e('0x19')]);return _0x23d53e(_0x37d20d['error']['message']);}else{logger['info'](_0xd17e('0x12'),_0x5aadc5,'request\x20sent');_0x23d53e(_0x37d20d['result'][_0xd17e('0x19')]);}})[_0xd17e('0x1a')](function(_0x2d20b9){logger[_0xd17e('0x18')](_0xd17e('0x12'),_0x5aadc5,_0x2d20b9);_0x912663(_0x2d20b9);});});}exports['UpdateSmsInteraction']=function(_0x244954){var _0x2b34eb=this;return new Promise(function(_0x13b25f,_0x31ddaf){return db['SmsInteraction'][_0xd17e('0x1b')](_0x244954[_0xd17e('0x1c')],{'raw':_0x244954[_0xd17e('0x1d')]?_0x244954['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x244954[_0xd17e('0x1d')]?_0x244954['options'][_0xd17e('0x1e')]||null:null,'attributes':_0x244954[_0xd17e('0x1d')]?_0x244954[_0xd17e('0x1d')][_0xd17e('0x1f')]||null:null,'limit':_0x244954[_0xd17e('0x1d')]?_0x244954[_0xd17e('0x1d')][_0xd17e('0x20')]||null:null})[_0xd17e('0x21')](function(_0x52f9b1){logger[_0xd17e('0x11')](_0xd17e('0x22'),_0x244954);logger[_0xd17e('0x14')](_0xd17e('0x22'),_0x244954,JSON['stringify'](_0x52f9b1));_0x13b25f(_0x52f9b1);})[_0xd17e('0x1a')](function(_0x46e99d){logger['error'](_0xd17e('0x22'),_0x46e99d['message'],_0x244954);_0x31ddaf(_0x2b34eb[_0xd17e('0x18')](0x1f4,_0x46e99d['message']));});});};exports[_0xd17e('0x23')]=function(_0xf976f9){return new Promise(function(_0x123f4e,_0x544608){return db[_0xd17e('0x24')][_0xd17e('0x25')]({'where':_0xf976f9[_0xd17e('0x1d')]?_0xf976f9[_0xd17e('0x1d')]['where']||null:null})[_0xd17e('0x21')](function(_0x456b9c){if(_0x456b9c){return _0x456b9c[_0xd17e('0x26')](_0xf976f9['body']['ids'],_[_0xd17e('0x27')](_0xf976f9[_0xd17e('0x1c')],['ids','id'])||{});}})['spread'](function(_0x308e1b){logger[_0xd17e('0x11')](_0xd17e('0x28'),_0xf976f9);logger['debug'](_0xd17e('0x28'),_0xf976f9,JSON[_0xd17e('0x16')](_0x308e1b));_0x123f4e(_0x308e1b);})[_0xd17e('0x1a')](function(_0x3ab330){logger[_0xd17e('0x18')](_0xd17e('0x28'),_0x3ab330[_0xd17e('0x19')],_0xf976f9);_0x544608(_this[_0xd17e('0x18')](0x1f4,_0x3ab330[_0xd17e('0x19')]));});});}; \ No newline at end of file +var _0x6888=['attributes','limit','then','debug','stringify','SmsInteraction','find','addTags','ids','body','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateSmsInteraction','update','options','where'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0x6888,0x1e5));var _0x8688=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x6888[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x8688('0x0'));var util=require(_0x8688('0x1'));var moment=require(_0x8688('0x2'));var BPromise=require(_0x8688('0x3'));var rs=require(_0x8688('0x4'));var fs=require('fs');var Redis=require(_0x8688('0x5'));var db=require(_0x8688('0x6'))['db'];var utils=require(_0x8688('0x7'));var logger=require(_0x8688('0x8'))(_0x8688('0x9'));var config=require(_0x8688('0xa'));var jayson=require(_0x8688('0xb'));var client=jayson[_0x8688('0xc')]['http']({'port':0x232a});config[_0x8688('0xd')]=_[_0x8688('0xe')](config[_0x8688('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x8688('0xf'))(new Redis(config[_0x8688('0xd')]));require('./smsInteraction.socket')[_0x8688('0x10')](socket);function respondWithRpcPromise(_0x223599,_0x5b4c36,_0x59bd25){return new BPromise(function(_0x3c41a0,_0x2275f4){return client[_0x8688('0x11')](_0x223599,_0x59bd25)['then'](function(_0x391eea){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x5b4c36,'request\x20sent');logger['debug'](_0x8688('0x12'),_0x5b4c36,_0x8688('0x13'),JSON['stringify'](_0x391eea));if(_0x391eea[_0x8688('0x14')]){if(_0x391eea[_0x8688('0x14')][_0x8688('0x15')]===0x1f4){logger['error'](_0x8688('0x16'),_0x5b4c36,_0x391eea['error']['message']);return _0x2275f4(_0x391eea[_0x8688('0x14')]['message']);}logger[_0x8688('0x14')](_0x8688('0x16'),_0x5b4c36,_0x391eea[_0x8688('0x14')]['message']);return _0x3c41a0(_0x391eea[_0x8688('0x14')][_0x8688('0x17')]);}else{logger[_0x8688('0x18')](_0x8688('0x16'),_0x5b4c36,_0x8688('0x13'));_0x3c41a0(_0x391eea[_0x8688('0x19')][_0x8688('0x17')]);}})[_0x8688('0x1a')](function(_0x4b3b39){logger[_0x8688('0x14')](_0x8688('0x16'),_0x5b4c36,_0x4b3b39);_0x2275f4(_0x4b3b39);});});}exports[_0x8688('0x1b')]=function(_0x2517b0){var _0x104b49=this;return new Promise(function(_0x433f4d,_0xb37878){return db['SmsInteraction'][_0x8688('0x1c')](_0x2517b0['body'],{'raw':_0x2517b0[_0x8688('0x1d')]?_0x2517b0[_0x8688('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2517b0['options']?_0x2517b0[_0x8688('0x1d')][_0x8688('0x1e')]||null:null,'attributes':_0x2517b0['options']?_0x2517b0[_0x8688('0x1d')][_0x8688('0x1f')]||null:null,'limit':_0x2517b0[_0x8688('0x1d')]?_0x2517b0[_0x8688('0x1d')][_0x8688('0x20')]||null:null})[_0x8688('0x21')](function(_0x3938a3){logger['info'](_0x8688('0x1b'),_0x2517b0);logger[_0x8688('0x22')](_0x8688('0x1b'),_0x2517b0,JSON[_0x8688('0x23')](_0x3938a3));_0x433f4d(_0x3938a3);})[_0x8688('0x1a')](function(_0x4a748b){logger['error']('UpdateSmsInteraction',_0x4a748b[_0x8688('0x17')],_0x2517b0);_0xb37878(_0x104b49[_0x8688('0x14')](0x1f4,_0x4a748b[_0x8688('0x17')]));});});};exports['AddTagsToSmsInteraction']=function(_0x23e5f1){return new Promise(function(_0x17f885,_0x5775c1){return db[_0x8688('0x24')][_0x8688('0x25')]({'where':_0x23e5f1[_0x8688('0x1d')]?_0x23e5f1['options'][_0x8688('0x1e')]||null:null})['then'](function(_0x22efa9){if(_0x22efa9){return _0x22efa9[_0x8688('0x26')](_0x23e5f1['body'][_0x8688('0x27')],_['omit'](_0x23e5f1[_0x8688('0x28')],['ids','id'])||{});}})[_0x8688('0x29')](function(_0xce0728){logger[_0x8688('0x18')](_0x8688('0x2a'),_0x23e5f1);logger['debug']('AddTags',_0x23e5f1,JSON['stringify'](_0xce0728));_0x17f885(_0xce0728);})[_0x8688('0x1a')](function(_0x83d717){logger[_0x8688('0x14')]('AddTags',_0x83d717[_0x8688('0x17')],_0x23e5f1);_0x5775c1(_this[_0x8688('0x14')](0x1f4,_0x83d717['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index d54d79b..8157ed9 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 _0x78b4=['register','smsInteraction:','./smsInteraction.events','save','remove','removeListener'];(function(_0x4bc65f,_0x39ec43){var _0x44f85f=function(_0x175343){while(--_0x175343){_0x4bc65f['push'](_0x4bc65f['shift']());}};_0x44f85f(++_0x39ec43);}(_0x78b4,0xda));var _0x478b=function(_0x4b9ed9,_0x4c7335){_0x4b9ed9=_0x4b9ed9-0x0;var _0x1649ff=_0x78b4[_0x4b9ed9];return _0x1649ff;};'use strict';var SmsInteractionEvents=require(_0x478b('0x0'));var events=[_0x478b('0x1'),_0x478b('0x2'),'update'];function createListener(_0x4ebf19,_0x551722){return function(_0x16712b){_0x551722['emit'](_0x4ebf19,_0x16712b);};}function removeListener(_0xb97bf1,_0x156a03){return function(){SmsInteractionEvents[_0x478b('0x3')](_0xb97bf1,_0x156a03);};}exports[_0x478b('0x4')]=function(_0xbdca4b){for(var _0x2653fa=0x0,_0x564de6=events['length'];_0x2653fa<_0x564de6;_0x2653fa++){var _0x441078=events[_0x2653fa];var _0x1045e4=createListener(_0x478b('0x5')+_0x441078,_0xbdca4b);SmsInteractionEvents['on'](_0x441078,_0x1045e4);}}; \ No newline at end of file +var _0xde9b=['update','removeListener','register','save'];(function(_0x50337b,_0x35a8ee){var _0x53d607=function(_0x1c0451){while(--_0x1c0451){_0x50337b['push'](_0x50337b['shift']());}};_0x53d607(++_0x35a8ee);}(_0xde9b,0x1cb));var _0xbde9=function(_0x2f7aa6,_0x2072e5){_0x2f7aa6=_0x2f7aa6-0x0;var _0x18d006=_0xde9b[_0x2f7aa6];return _0x18d006;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xbde9('0x0'),'remove',_0xbde9('0x1')];function createListener(_0x3c9310,_0x28d7a7){return function(_0x525050){_0x28d7a7['emit'](_0x3c9310,_0x525050);};}function removeListener(_0x3b4b45,_0x5b54d0){return function(){SmsInteractionEvents[_0xbde9('0x2')](_0x3b4b45,_0x5b54d0);};}exports[_0xbde9('0x3')]=function(_0x19f205){for(var _0x14c966=0x0,_0x318832=events['length'];_0x14c966<_0x318832;_0x14c966++){var _0x2cb6c5=events[_0x14c966];var _0x151dbc=createListener('smsInteraction:'+_0x2cb6c5,_0x19f205);SmsInteractionEvents['on'](_0x2cb6c5,_0x151dbc);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 466539e..a32249d 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 _0x0046=['isAuthenticated','index','describe','tracked','smsmessage:create','create','post','/:id/status','status','put','/:id','update','accept','reject','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get'];(function(_0x74f979,_0x3f5b22){var _0x546238=function(_0x21e4e0){while(--_0x21e4e0){_0x74f979['push'](_0x74f979['shift']());}};_0x546238(++_0x3f5b22);}(_0x0046,0x187));var _0x6004=function(_0x40cd11,_0x53da44){_0x40cd11=_0x40cd11-0x0;var _0x15b6eb=_0x0046[_0x40cd11];return _0x15b6eb;};'use strict';var multer=require(_0x6004('0x0'));var util=require('util');var path=require(_0x6004('0x1'));var timeout=require('connect-timeout');var express=require(_0x6004('0x2'));var router=express[_0x6004('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6004('0x4'));var interaction=require(_0x6004('0x5'));var config=require(_0x6004('0x6'));var controller=require(_0x6004('0x7'));router[_0x6004('0x8')]('/',auth[_0x6004('0x9')](),controller[_0x6004('0xa')]);router['get']('/describe',auth[_0x6004('0x9')](),controller[_0x6004('0xb')]);router[_0x6004('0x8')]('/:id',auth[_0x6004('0x9')](),controller['show']);router['post']('/',auth[_0x6004('0x9')](),interaction[_0x6004('0xc')]('sms',_0x6004('0xd')),controller[_0x6004('0xe')]);router[_0x6004('0xf')](_0x6004('0x10'),controller[_0x6004('0x11')]);router[_0x6004('0x12')](_0x6004('0x13'),auth['isAuthenticated'](),controller[_0x6004('0x14')]);router[_0x6004('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x6004('0x15')]);router[_0x6004('0x12')]('/:id/reject',auth[_0x6004('0x9')](),controller[_0x6004('0x16')]);router[_0x6004('0x17')](_0x6004('0x13'),auth[_0x6004('0x9')](),controller[_0x6004('0x18')]);module['exports']=router; \ No newline at end of file +var _0x590f=['fs-extra','../../config/environment','./smsMessage.controller','isAuthenticated','/describe','get','/:id','post','tracked','sms','create','/:id/status','status','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x1e5b36,_0x39753d){var _0xf6f708=function(_0x35cfca){while(--_0x35cfca){_0x1e5b36['push'](_0x1e5b36['shift']());}};_0xf6f708(++_0x39753d);}(_0x590f,0x97));var _0xf590=function(_0x55d2da,_0x339e31){_0x55d2da=_0x55d2da-0x0;var _0x266a8c=_0x590f[_0x55d2da];return _0x266a8c;};'use strict';var multer=require(_0xf590('0x0'));var util=require(_0xf590('0x1'));var path=require(_0xf590('0x2'));var timeout=require(_0xf590('0x3'));var express=require('express');var router=express[_0xf590('0x4')]();var fs_extra=require(_0xf590('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf590('0x6'));var controller=require(_0xf590('0x7'));router['get']('/',auth[_0xf590('0x8')](),controller['index']);router['get'](_0xf590('0x9'),auth[_0xf590('0x8')](),controller['describe']);router[_0xf590('0xa')](_0xf590('0xb'),auth[_0xf590('0x8')](),controller['show']);router[_0xf590('0xc')]('/',auth[_0xf590('0x8')](),interaction[_0xf590('0xd')](_0xf590('0xe'),'smsmessage:create'),controller[_0xf590('0xf')]);router[_0xf590('0xc')](_0xf590('0x10'),controller[_0xf590('0x11')]);router[_0xf590('0x12')]('/:id',auth[_0xf590('0x8')](),controller[_0xf590('0x13')]);router['put'](_0xf590('0x14'),auth['isAuthenticated'](),controller[_0xf590('0x15')]);router[_0xf590('0x12')]('/:id/reject',auth['isAuthenticated'](),controller[_0xf590('0x16')]);router[_0xf590('0x17')](_0xf590('0xb'),auth[_0xf590('0x8')](),controller[_0xf590('0x18')]);module[_0xf590('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index ed87424..6d92e87 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 _0x05dc=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x560166,_0x509bcd){var _0x3fad6d=function(_0x2c6343){while(--_0x2c6343){_0x560166['push'](_0x560166['shift']());}};_0x3fad6d(++_0x509bcd);}(_0x05dc,0xcd));var _0xc05d=function(_0x128188,_0x418a16){_0x128188=_0x128188-0x0;var _0x4bc209=_0x05dc[_0x128188];return _0x4bc209;};'use strict';var Sequelize=require(_0xc05d('0x0'));module[_0xc05d('0x1')]={'body':{'type':Sequelize[_0xc05d('0x2')](_0xc05d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc05d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc05d('0x5')),'defaultValue':_0xc05d('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xc05d('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xc05d('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xdcd9=['medium','out','STRING','DATE','TEXT','exports'];(function(_0x30d382,_0x5947a3){var _0x2f10e0=function(_0x3f6cad){while(--_0x3f6cad){_0x30d382['push'](_0x30d382['shift']());}};_0x2f10e0(++_0x5947a3);}(_0xdcd9,0xf5));var _0x9dcd=function(_0x7ff114,_0x45970d){_0x7ff114=_0x7ff114-0x0;var _0x1d9189=_0xdcd9[_0x7ff114];return _0x1d9189;};'use strict';var Sequelize=require('sequelize');module[_0x9dcd('0x0')]={'body':{'type':Sequelize['TEXT'](_0x9dcd('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9dcd('0x2')),'defaultValue':_0x9dcd('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9dcd('0x3')](0xbe)},'phone':{'type':Sequelize[_0x9dcd('0x3')]},'readAt':{'type':Sequelize[_0x9dcd('0x4')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9dcd('0x5')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 5c44a65..2a30247 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 _0x4bd4=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','status','end','json','offset','undefined','count','apply','reject','update','destroy','sendStatus','name','map','SmsMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','type','options','includeAll','include','findAll','rows','show','params','length','merge','find','catch','create','body','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','interface','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','indexOf','sent','Status','plivio','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x54842e,_0x6303d3){var _0x1fb3f9=function(_0x27735d){while(--_0x27735d){_0x54842e['push'](_0x54842e['shift']());}};_0x1fb3f9(++_0x6303d3);}(_0x4bd4,0x107));var _0x44bd=function(_0x4eae09,_0x5e5c1e){_0x4eae09=_0x4eae09-0x0;var _0x264f33=_0x4bd4[_0x4eae09];return _0x264f33;};'use strict';var emlformat=require(_0x44bd('0x0'));var rimraf=require(_0x44bd('0x1'));var zipdir=require(_0x44bd('0x2'));var jsonpatch=require(_0x44bd('0x3'));var rp=require(_0x44bd('0x4'));var moment=require(_0x44bd('0x5'));var BPromise=require(_0x44bd('0x6'));var Mustache=require(_0x44bd('0x7'));var util=require(_0x44bd('0x8'));var path=require('path');var sox=require(_0x44bd('0x9'));var csv=require(_0x44bd('0xa'));var ejs=require(_0x44bd('0xb'));var fs=require('fs');var fs_extra=require(_0x44bd('0xc'));var _=require('lodash');var squel=require(_0x44bd('0xd'));var crypto=require(_0x44bd('0xe'));var jsforce=require(_0x44bd('0xf'));var deskjs=require(_0x44bd('0x10'));var toCsv=require(_0x44bd('0xa'));var querystring=require(_0x44bd('0x11'));var Papa=require(_0x44bd('0x12'));var Redis=require('ioredis');var authService=require(_0x44bd('0x13'));var qs=require(_0x44bd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x44bd('0x15'));var logger=require(_0x44bd('0x16'))('api');var utils=require(_0x44bd('0x17'));var config=require(_0x44bd('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x44bd('0x19'))['db'];config[_0x44bd('0x1a')]=_['defaults'](config[_0x44bd('0x1a')],{'host':_0x44bd('0x1b'),'port':0x18eb});var socket=require(_0x44bd('0x1c'))(new Redis(config[_0x44bd('0x1a')]));require(_0x44bd('0x1d'))[_0x44bd('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x44bd('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x44bd('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x414f0e,_0x528787,_0x1024d6,_0x1915b0){return new BPromise(function(_0x29124f,_0x37e095){var _0x3ccec1=_0x1915b0||client;return _0x3ccec1[_0x44bd('0x20')](_0x414f0e,_0x1024d6)[_0x44bd('0x21')](function(_0x195922){logger[_0x44bd('0x22')](_0x44bd('0x23'),_0x528787,_0x44bd('0x24'));logger[_0x44bd('0x25')](_0x44bd('0x26'),_0x528787,'request\x20sent',JSON['stringify'](_0x195922));if(_0x195922[_0x44bd('0x27')]){if(_0x195922[_0x44bd('0x27')][_0x44bd('0x28')]===0x1f4){logger[_0x44bd('0x27')](_0x44bd('0x23'),_0x528787,_0x195922[_0x44bd('0x27')]['message']);return _0x37e095(_0x195922['error'][_0x44bd('0x29')]);}logger[_0x44bd('0x27')](_0x44bd('0x23'),_0x528787,_0x195922['error'][_0x44bd('0x29')]);return _0x29124f(_0x195922['error'][_0x44bd('0x29')]);}else{logger[_0x44bd('0x22')](_0x44bd('0x23'),_0x528787,_0x44bd('0x24'));_0x29124f(_0x195922[_0x44bd('0x2a')][_0x44bd('0x29')]);}})['catch'](function(_0x2a641a){logger['error'](_0x44bd('0x23'),_0x528787,_0x2a641a);_0x37e095(_0x2a641a);});});}function respondWithStatusCode(_0x56d3d6,_0xfa84d8){_0xfa84d8=_0xfa84d8||0xcc;return function(_0x58e736){if(_0x58e736){return _0x56d3d6['sendStatus'](_0xfa84d8);}return _0x56d3d6[_0x44bd('0x2b')](_0xfa84d8)[_0x44bd('0x2c')]();};}function respondWithResult(_0x3fcb52,_0x2f4db2){_0x2f4db2=_0x2f4db2||0xc8;return function(_0x4b417c){if(_0x4b417c){return _0x3fcb52[_0x44bd('0x2b')](_0x2f4db2)[_0x44bd('0x2d')](_0x4b417c);}};}function respondWithFilteredResult(_0x58ea44,_0x5996f9){return function(_0x4a159f){if(_0x4a159f){var _0x3be9a3=typeof _0x5996f9[_0x44bd('0x2e')]===_0x44bd('0x2f')&&typeof _0x5996f9['limit']===_0x44bd('0x2f');var _0x320d76=_0x4a159f[_0x44bd('0x30')];var _0x5bcf60=_0x3be9a3?0x0:_0x5996f9['offset'];var _0x48dc8d=_0x3be9a3?_0x4a159f[_0x44bd('0x30')]:_0x5996f9[_0x44bd('0x2e')]+_0x5996f9['limit'];var _0x8be013;if(_0x48dc8d>=_0x320d76){_0x48dc8d=_0x320d76;_0x8be013=0xc8;}else{_0x8be013=0xce;}_0x58ea44[_0x44bd('0x2b')](_0x8be013);return _0x58ea44['set']('Content-Range',_0x5bcf60+'-'+_0x48dc8d+'/'+_0x320d76)['json'](_0x4a159f);}return null;};}function patchUpdates(_0x250acb){return function(_0x12ddea){try{jsonpatch[_0x44bd('0x31')](_0x12ddea,_0x250acb,!![]);}catch(_0x18cca6){return BPromise[_0x44bd('0x32')](_0x18cca6);}return _0x12ddea['save']();};}function saveUpdates(_0x1a85d7,_0x2c7204){return function(_0x2c21db){if(_0x2c21db){return _0x2c21db[_0x44bd('0x33')](_0x1a85d7)[_0x44bd('0x21')](function(_0x1317d0){return _0x1317d0;});}return null;};}function removeEntity(_0x1221ea,_0x21d53c){return function(_0xc6fe03){if(_0xc6fe03){return _0xc6fe03[_0x44bd('0x34')]()['then'](function(){_0x1221ea[_0x44bd('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x575ef6,_0x22fdb6){return function(_0x317f15){if(!_0x317f15){_0x575ef6[_0x44bd('0x35')](0x194);}return _0x317f15;};}function handleError(_0x18aadc,_0x2316a6){_0x2316a6=_0x2316a6||0x1f4;return function(_0x57f943){logger[_0x44bd('0x27')](_0x57f943['stack']);if(_0x57f943[_0x44bd('0x36')]){delete _0x57f943[_0x44bd('0x36')];}_0x18aadc[_0x44bd('0x2b')](_0x2316a6)['send'](_0x57f943);};}exports['index']=function(_0x511b0e,_0x115302){var _0x44a25d={},_0x5ec3cb={},_0x1061ca={'count':0x0,'rows':[]};var _0x101063=_[_0x44bd('0x37')](db[_0x44bd('0x38')][_0x44bd('0x39')],function(_0x3ff57b){return{'name':_0x3ff57b[_0x44bd('0x3a')],'type':_0x3ff57b['type'][_0x44bd('0x3b')]};});_0x5ec3cb['model']=_[_0x44bd('0x37')](_0x101063,'name');_0x5ec3cb[_0x44bd('0x3c')]=_[_0x44bd('0x3d')](_0x511b0e['query']);_0x5ec3cb[_0x44bd('0x3e')]=_[_0x44bd('0x3f')](_0x5ec3cb[_0x44bd('0x40')],_0x5ec3cb[_0x44bd('0x3c')]);_0x44a25d[_0x44bd('0x41')]=_[_0x44bd('0x3f')](_0x5ec3cb['model'],qs[_0x44bd('0x42')](_0x511b0e[_0x44bd('0x3c')][_0x44bd('0x42')]));_0x44a25d[_0x44bd('0x41')]=_0x44a25d[_0x44bd('0x41')]['length']?_0x44a25d[_0x44bd('0x41')]:_0x5ec3cb['model'];if(!_0x511b0e[_0x44bd('0x3c')][_0x44bd('0x43')](_0x44bd('0x44'))){_0x44a25d['limit']=qs['limit'](_0x511b0e[_0x44bd('0x3c')][_0x44bd('0x45')]);_0x44a25d[_0x44bd('0x2e')]=qs[_0x44bd('0x2e')](_0x511b0e['query']['offset']);}_0x44a25d['order']=qs[_0x44bd('0x46')](_0x511b0e[_0x44bd('0x3c')][_0x44bd('0x46')]);_0x44a25d[_0x44bd('0x47')]=qs[_0x44bd('0x3e')](_[_0x44bd('0x48')](_0x511b0e[_0x44bd('0x3c')],_0x5ec3cb['filters']),_0x101063);if(_0x511b0e['query'][_0x44bd('0x49')]){_0x44a25d['where']=_['merge'](_0x44a25d[_0x44bd('0x47')],{'$or':_['map'](_0x101063,function(_0x1cf339){if(_0x1cf339[_0x44bd('0x4a')]!=='VIRTUAL'){var _0x598a78={};_0x598a78[_0x1cf339['name']]={'$like':'%'+_0x511b0e[_0x44bd('0x3c')][_0x44bd('0x49')]+'%'};return _0x598a78;}})});}_0x44a25d=_['merge']({},_0x44a25d,_0x511b0e[_0x44bd('0x4b')]);var _0x2abc78={'where':_0x44a25d[_0x44bd('0x47')]};return db[_0x44bd('0x38')][_0x44bd('0x30')](_0x2abc78)[_0x44bd('0x21')](function(_0x4990b4){_0x1061ca[_0x44bd('0x30')]=_0x4990b4;if(_0x511b0e[_0x44bd('0x3c')][_0x44bd('0x4c')]){_0x44a25d[_0x44bd('0x4d')]=[{'all':!![]}];}return db[_0x44bd('0x38')][_0x44bd('0x4e')](_0x44a25d);})[_0x44bd('0x21')](function(_0x518ee2){_0x1061ca[_0x44bd('0x4f')]=_0x518ee2;return _0x1061ca;})[_0x44bd('0x21')](respondWithFilteredResult(_0x115302,_0x44a25d))['catch'](handleError(_0x115302,null));};exports[_0x44bd('0x50')]=function(_0x17d6ec,_0x317814){var _0x3c7b03={'raw':!![],'where':{'id':_0x17d6ec[_0x44bd('0x51')]['id']}},_0xee7e7e={};_0xee7e7e[_0x44bd('0x40')]=_[_0x44bd('0x3d')](db[_0x44bd('0x38')][_0x44bd('0x39')]);_0xee7e7e[_0x44bd('0x3c')]=_[_0x44bd('0x3d')](_0x17d6ec['query']);_0xee7e7e[_0x44bd('0x3e')]=_['intersection'](_0xee7e7e[_0x44bd('0x40')],_0xee7e7e[_0x44bd('0x3c')]);_0x3c7b03[_0x44bd('0x41')]=_[_0x44bd('0x3f')](_0xee7e7e[_0x44bd('0x40')],qs['fields'](_0x17d6ec[_0x44bd('0x3c')]['fields']));_0x3c7b03[_0x44bd('0x41')]=_0x3c7b03[_0x44bd('0x41')][_0x44bd('0x52')]?_0x3c7b03['attributes']:_0xee7e7e[_0x44bd('0x40')];if(_0x17d6ec[_0x44bd('0x3c')]['includeAll']){_0x3c7b03['include']=[{'all':!![]}];}_0x3c7b03=_[_0x44bd('0x53')]({},_0x3c7b03,_0x17d6ec[_0x44bd('0x4b')]);return db[_0x44bd('0x38')][_0x44bd('0x54')](_0x3c7b03)[_0x44bd('0x21')](handleEntityNotFound(_0x317814,null))[_0x44bd('0x21')](respondWithResult(_0x317814,null))[_0x44bd('0x55')](handleError(_0x317814,null));};exports[_0x44bd('0x56')]=function(_0x5a91b9,_0x439e3c){return db['SmsMessage'][_0x44bd('0x56')](_0x5a91b9[_0x44bd('0x57')],{})[_0x44bd('0x21')](respondWithResult(_0x439e3c,0xc9))[_0x44bd('0x55')](handleError(_0x439e3c,null));};exports[_0x44bd('0x33')]=function(_0x5e5f82,_0x449ca1){if(_0x5e5f82[_0x44bd('0x57')]['id']){delete _0x5e5f82[_0x44bd('0x57')]['id'];}return db[_0x44bd('0x38')][_0x44bd('0x54')]({'where':{'id':_0x5e5f82['params']['id']}})[_0x44bd('0x21')](handleEntityNotFound(_0x449ca1,null))[_0x44bd('0x21')](saveUpdates(_0x5e5f82[_0x44bd('0x57')],null))[_0x44bd('0x21')](respondWithResult(_0x449ca1,null))['catch'](handleError(_0x449ca1,null));};exports[_0x44bd('0x34')]=function(_0x1b147c,_0x4a92e2){return db[_0x44bd('0x38')][_0x44bd('0x54')]({'where':{'id':_0x1b147c[_0x44bd('0x51')]['id']}})[_0x44bd('0x21')](handleEntityNotFound(_0x4a92e2,null))[_0x44bd('0x21')](removeEntity(_0x4a92e2,null))[_0x44bd('0x55')](handleError(_0x4a92e2,null));};exports['describe']=function(_0x23528c,_0x3d1896){return db[_0x44bd('0x38')]['describe']()['then'](respondWithResult(_0x3d1896,null))[_0x44bd('0x55')](handleError(_0x3d1896,null));};var interaction_log=require(_0x44bd('0x16'))('sms-interactions');exports[_0x44bd('0x58')]=function(_0xa31433,_0x19997b,_0x1f3e7b){var _0x489df0={'agent':{},'channel':_0x44bd('0x59')};if(_0xa31433[_0x44bd('0x57')]['id']){delete _0xa31433[_0x44bd('0x57')]['id'];}_0xa31433[_0x44bd('0x57')]['read']=!![];_0xa31433[_0x44bd('0x57')][_0x44bd('0x5a')]=moment()[_0x44bd('0x5b')](_0x44bd('0x5c'));_0xa31433['body'][_0x44bd('0x5d')]=_0xa31433[_0x44bd('0x57')][_0x44bd('0x5d')]||_0xa31433[_0x44bd('0x5e')]['id'];_0x489df0[_0x44bd('0x5f')]['id']=_0xa31433['body'][_0x44bd('0x5d')];return db[_0x44bd('0x38')][_0x44bd('0x54')]({'where':{'id':_0xa31433[_0x44bd('0x51')]['id'],'UserId':null}})[_0x44bd('0x21')](handleEntityNotFound(_0x19997b,null))['then'](saveUpdates(_0xa31433['body'],null))[_0x44bd('0x21')](function(_0x2a7428){if(_0x2a7428){_0x489df0[_0x44bd('0x29')]=_0x2a7428[_0x44bd('0x60')]({'plain':!![]});return db[_0x44bd('0x61')][_0x44bd('0x54')]({'where':{'id':_0x2a7428[_0x44bd('0x62')]}});}return null;})[_0x44bd('0x21')](handleEntityNotFound(_0x19997b,null))[_0x44bd('0x21')](function(_0x2eb165){if(_0x2eb165){return _0x2eb165[_0x44bd('0x33')]({'UserId':_0xa31433[_0x44bd('0x57')]['UserId'],'read1stAt':_[_0x44bd('0x63')](_0x2eb165[_0x44bd('0x64')])?moment()[_0x44bd('0x5b')](_0x44bd('0x5c')):undefined});}return null;})[_0x44bd('0x21')](function(_0x5dd606){if(_0x5dd606){_0x489df0[_0x44bd('0x65')]=_0x5dd606[_0x44bd('0x60')]({'plain':!![]});interaction_log[_0x44bd('0x22')](_0x44bd('0x66'),_0xa31433['user']['id'],_0xa31433[_0x44bd('0x5e')]['name'],_0xa31433[_0x44bd('0x5e')][_0x44bd('0x67')],_0x489df0[_0x44bd('0x65')]['id'],_0xa31433['body']?JSON[_0x44bd('0x68')](_0xa31433[_0x44bd('0x57')]):_0x44bd('0x69'));return respondWithRpcPromise(_0x44bd('0x6a'),'acceptMessage',_0x489df0);}return null;})[_0x44bd('0x21')](function(_0x3338fd){var _0x37f164='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3338fd[_0x44bd('0x29')]['ContactId'];return db['sequelize'][_0x44bd('0x3c')](_0x37f164,{'type':db['Sequelize'][_0x44bd('0x6b')][_0x44bd('0x6c')],'raw':!![]})[_0x44bd('0x21')](function(_0x194fa9){return _0x194fa9;});})['then'](function(_0x25ba67){if(_0x25ba67){_0x489df0[_0x44bd('0x29')][_0x44bd('0x6d')]=_0x25ba67[0x0];if(!_0xa31433[_0x44bd('0x57')][_0x44bd('0x5d')])return;return db[_0x44bd('0x6e')][_0x44bd('0x54')]({'where':{'id':_0xa31433[_0x44bd('0x57')]['UserId'],'role':_0x44bd('0x5f')},'attributes':['id',_0x44bd('0x36'),_0x44bd('0x6f'),_0x44bd('0x70'),_0x44bd('0x71')],'raw':!![]});}return null;})[_0x44bd('0x21')](function(_0x267252){if(!_0x267252)return null;_0x489df0[_0x44bd('0x29')][_0x44bd('0x5f')]=_0x267252;return _0x489df0;})[_0x44bd('0x21')](function(_0x3328ce){if(_0x3328ce){if(_0xa31433[_0x44bd('0x57')][_0x44bd('0x72')]){_0x489df0[_0x44bd('0x29')]['interface']=util[_0x44bd('0x5b')](_0x44bd('0x73'),_0xa31433[_0x44bd('0x5e')][_0x44bd('0x36')]);_0x489df0[_0x44bd('0x29')][_0x44bd('0x74')]=_0x489df0[_0x44bd('0x74')];_0x489df0[_0x44bd('0x29')][_0x44bd('0x75')]=_0x44bd('0x58');return respondWithRpcPromise(_0x44bd('0x76'),_0x44bd('0x76'),{'event':_0x44bd('0x77'),'message':_0x489df0[_0x44bd('0x29')]},client9002)[_0x44bd('0x21')](function(){return _0x489df0;});}return _0x489df0;}return null;})[_0x44bd('0x21')](respondWithResult(_0x19997b,null))['catch'](handleError(_0x19997b,null));};var interaction_log=require(_0x44bd('0x16'))(_0x44bd('0x78'));exports[_0x44bd('0x32')]=function(_0x5c1163,_0xb1d122,_0x1375d3){var _0x3f5087={'agent':{},'channel':_0x44bd('0x59')};if(_0x5c1163['body']['id']){delete _0x5c1163[_0x44bd('0x57')]['id'];}_0x5c1163[_0x44bd('0x57')]['UserId']=_0x5c1163[_0x44bd('0x57')][_0x44bd('0x5d')]||_0x5c1163[_0x44bd('0x5e')]['id'];_0x3f5087[_0x44bd('0x5f')]['id']=_0x5c1163['body'][_0x44bd('0x5d')];return db[_0x44bd('0x38')][_0x44bd('0x54')]({'where':{'id':_0x5c1163[_0x44bd('0x51')]['id'],'UserId':null}})[_0x44bd('0x21')](handleEntityNotFound(_0xb1d122,null))[_0x44bd('0x21')](function(_0x2831ae){if(_0x2831ae){_0x3f5087[_0x44bd('0x29')]=_0x2831ae[_0x44bd('0x60')]({'plain':!![]});return db[_0x44bd('0x61')]['find']({'where':{'id':_0x2831ae[_0x44bd('0x62')]}});}return null;})[_0x44bd('0x21')](handleEntityNotFound(_0xb1d122,null))[_0x44bd('0x21')](function(_0x509604){if(_0x509604){_0x3f5087[_0x44bd('0x65')]=_0x509604[_0x44bd('0x60')]({'plain':!![]});interaction_log[_0x44bd('0x22')](_0x44bd('0x79'),_0x5c1163['user']['id'],_0x5c1163[_0x44bd('0x5e')]['name'],_0x5c1163[_0x44bd('0x5e')][_0x44bd('0x67')],_0x3f5087[_0x44bd('0x65')]['id'],_0x5c1163['body']?JSON[_0x44bd('0x68')](_0x5c1163['body']):'null');return respondWithRpcPromise(_0x44bd('0x7a'),'rejectMessage',_0x3f5087);}return null;})[_0x44bd('0x21')](function(_0x39aa9b){var _0x4297ff=_0x44bd('0x7b')+_0x39aa9b['message']['ContactId'];return db[_0x44bd('0x7c')][_0x44bd('0x3c')](_0x4297ff,{'type':db['Sequelize'][_0x44bd('0x6b')]['SELECT'],'raw':!![]})[_0x44bd('0x21')](function(_0x3cea4d){return _0x3cea4d;});})['then'](function(_0x775eec){if(_0x775eec){_0x3f5087[_0x44bd('0x29')][_0x44bd('0x6d')]=_0x775eec[0x0];if(!_0x5c1163[_0x44bd('0x57')][_0x44bd('0x5d')])return;return db[_0x44bd('0x6e')][_0x44bd('0x54')]({'where':{'id':_0x5c1163['body'][_0x44bd('0x5d')],'role':_0x44bd('0x5f')},'attributes':['id',_0x44bd('0x36'),_0x44bd('0x6f'),_0x44bd('0x70'),'internal'],'raw':!![]});}return null;})['then'](function(_0x45c35c){if(!_0x45c35c)return null;_0x3f5087['message'][_0x44bd('0x5f')]=_0x45c35c;return _0x3f5087;})[_0x44bd('0x21')](function(_0x2a9160){if(_0x2a9160){_0x2a9160[_0x44bd('0x29')][_0x44bd('0x7d')]=util['format']('SIP/%s',_0x5c1163[_0x44bd('0x5e')][_0x44bd('0x36')]);_0x2a9160['message'][_0x44bd('0x74')]=_0x3f5087[_0x44bd('0x74')];_0x2a9160[_0x44bd('0x29')][_0x44bd('0x75')]=_0x44bd('0x32');respondWithRpcPromise(_0x44bd('0x76'),_0x44bd('0x76'),{'event':'rejectmessage','message':_0x2a9160[_0x44bd('0x29')]},client9002);return _0x3f5087;}return null;})[_0x44bd('0x21')](respondWithResult(_0xb1d122,null))['catch'](handleError(_0xb1d122,null));};exports[_0x44bd('0x2b')]=function(_0x3ac188,_0x2d34b5,_0x4e3817){if(_0x3ac188[_0x44bd('0x57')]['id']){delete _0x3ac188[_0x44bd('0x57')]['id'];}var _0x44fd0f;return db['SmsMessage'][_0x44bd('0x54')]({'where':{'id':_0x3ac188[_0x44bd('0x51')]['id']}})['then'](handleEntityNotFound(_0x2d34b5,null))['then'](function(_0x5b3517){if(_0x5b3517){_0x44fd0f=_0x5b3517;return db[_0x44bd('0x7e')][_0x44bd('0x54')]({'where':{'id':_0x5b3517['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x2d34b5,null))[_0x44bd('0x21')](function(_0x3ba54d){if(_0x3ba54d){logger[_0x44bd('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x44bd('0x2b'),_0x44bd('0x7f'),_0x3ba54d[_0x44bd('0x4a')],util[_0x44bd('0x80')](_0x3ac188[_0x44bd('0x57')],{'showHidden':![],'depth':null}));switch(_0x3ba54d['type']){case _0x44bd('0x81'):if(_0x3ac188[_0x44bd('0x57')]['MessageSid']&&_0x3ac188[_0x44bd('0x57')][_0x44bd('0x82')]===_0x44fd0f[_0x44bd('0x83')]){return _0x44fd0f[_0x44bd('0x33')]({'read':!![]});}else{logger[_0x44bd('0x27')](_0x44bd('0x84'),_0x44bd('0x2b'),_0x44bd('0x81'),util[_0x44bd('0x80')](_0x3ac188['body'],{'showHidden':![],'depth':null}));}break;case _0x44bd('0x85'):if(_0x3ac188[_0x44bd('0x57')]['MessageUUID']&&_0x3ac188[_0x44bd('0x57')]['MessageUUID']===_0x44fd0f['messageId']&&_[_0x44bd('0x86')]([_0x44bd('0x87'),'delivered'],_0x3ac188[_0x44bd('0x57')][_0x44bd('0x88')])>=0x0){return _0x44fd0f[_0x44bd('0x33')]({'read':!![]});}else{logger['error'](_0x44bd('0x84'),_0x44bd('0x2b'),_0x44bd('0x89'),util[_0x44bd('0x80')](_0x3ac188[_0x44bd('0x57')],{'showHidden':![],'depth':null}));}break;case _0x44bd('0x8a'):var _0x3a86c4=_0x3ac188[_0x44bd('0x57')]['results'][0x0];if(_0x3a86c4['status'][_0x44bd('0x8b')]===_0x44bd('0x8c')){return _0x44fd0f['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x44bd('0x8a'),util[_0x44bd('0x80')](_0x3ac188[_0x44bd('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x44fd0f;}})[_0x44bd('0x21')](respondWithResult(_0x2d34b5,null))[_0x44bd('0x55')](handleError(_0x2d34b5,null));}; \ No newline at end of file +var _0x8aba=['crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','client','request','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','name','send','index','map','SmsMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','describe','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','SIP/%s','channel','EventManager','acceptmessage','sms','info','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','interface','event','rejectmessage','SmsAccount','SmsAccountId','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','delivered','Status','plivio','results','groupName','infobip','eml-format','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8aba,0x1ab));var _0xa8ab=function(_0x54e9eb,_0xf1c5d7){_0x54e9eb=_0x54e9eb-0x0;var _0xdd3096=_0x8aba[_0x54e9eb];return _0xdd3096;};'use strict';var emlformat=require(_0xa8ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa8ab('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa8ab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa8ab('0x3'));var util=require(_0xa8ab('0x4'));var path=require('path');var sox=require(_0xa8ab('0x5'));var csv=require(_0xa8ab('0x6'));var ejs=require(_0xa8ab('0x7'));var fs=require('fs');var fs_extra=require(_0xa8ab('0x8'));var _=require(_0xa8ab('0x9'));var squel=require(_0xa8ab('0xa'));var crypto=require(_0xa8ab('0xb'));var jsforce=require(_0xa8ab('0xc'));var deskjs=require(_0xa8ab('0xd'));var toCsv=require(_0xa8ab('0x6'));var querystring=require('querystring');var Papa=require(_0xa8ab('0xe'));var Redis=require(_0xa8ab('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa8ab('0x10'));var logger=require(_0xa8ab('0x11'))(_0xa8ab('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa8ab('0x13'))['db'];config[_0xa8ab('0x14')]=_['defaults'](config[_0xa8ab('0x14')],{'host':_0xa8ab('0x15'),'port':0x18eb});var socket=require(_0xa8ab('0x16'))(new Redis(config[_0xa8ab('0x14')]));require(_0xa8ab('0x17'))[_0xa8ab('0x18')](socket);var jayson=require(_0xa8ab('0x19'));var client=jayson['client'][_0xa8ab('0x1a')]({'port':0x232c});var client9002=jayson[_0xa8ab('0x1b')][_0xa8ab('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1b8a07,_0xf03ef,_0x3a5f7b,_0x577d40){return new BPromise(function(_0x465fd8,_0x34ed09){var _0x5130f6=_0x577d40||client;return _0x5130f6[_0xa8ab('0x1c')](_0x1b8a07,_0x3a5f7b)['then'](function(_0x8a967){logger['info'](_0xa8ab('0x1d'),_0xf03ef,'request\x20sent');logger[_0xa8ab('0x1e')](_0xa8ab('0x1f'),_0xf03ef,_0xa8ab('0x20'),JSON[_0xa8ab('0x21')](_0x8a967));if(_0x8a967['error']){if(_0x8a967['error'][_0xa8ab('0x22')]===0x1f4){logger[_0xa8ab('0x23')]('SmsMessage,\x20%s,\x20%s',_0xf03ef,_0x8a967[_0xa8ab('0x23')][_0xa8ab('0x24')]);return _0x34ed09(_0x8a967[_0xa8ab('0x23')][_0xa8ab('0x24')]);}logger[_0xa8ab('0x23')](_0xa8ab('0x1d'),_0xf03ef,_0x8a967[_0xa8ab('0x23')]['message']);return _0x465fd8(_0x8a967[_0xa8ab('0x23')][_0xa8ab('0x24')]);}else{logger['info'](_0xa8ab('0x1d'),_0xf03ef,_0xa8ab('0x20'));_0x465fd8(_0x8a967['result'][_0xa8ab('0x24')]);}})['catch'](function(_0x13e829){logger[_0xa8ab('0x23')]('SmsMessage,\x20%s,\x20%s',_0xf03ef,_0x13e829);_0x34ed09(_0x13e829);});});}function respondWithStatusCode(_0x3f8e22,_0x36f17f){_0x36f17f=_0x36f17f||0xcc;return function(_0x44e904){if(_0x44e904){return _0x3f8e22['sendStatus'](_0x36f17f);}return _0x3f8e22[_0xa8ab('0x25')](_0x36f17f)['end']();};}function respondWithResult(_0x41d15c,_0x376788){_0x376788=_0x376788||0xc8;return function(_0x55706b){if(_0x55706b){return _0x41d15c[_0xa8ab('0x25')](_0x376788)[_0xa8ab('0x26')](_0x55706b);}};}function respondWithFilteredResult(_0x4ec959,_0x59c4a7){return function(_0x510d0e){if(_0x510d0e){var _0x1f3f60=typeof _0x59c4a7[_0xa8ab('0x27')]==='undefined'&&typeof _0x59c4a7[_0xa8ab('0x28')]===_0xa8ab('0x29');var _0x146ed1=_0x510d0e[_0xa8ab('0x2a')];var _0x5da942=_0x1f3f60?0x0:_0x59c4a7[_0xa8ab('0x27')];var _0x38fbeb=_0x1f3f60?_0x510d0e[_0xa8ab('0x2a')]:_0x59c4a7['offset']+_0x59c4a7[_0xa8ab('0x28')];var _0x1c4891;if(_0x38fbeb>=_0x146ed1){_0x38fbeb=_0x146ed1;_0x1c4891=0xc8;}else{_0x1c4891=0xce;}_0x4ec959[_0xa8ab('0x25')](_0x1c4891);return _0x4ec959[_0xa8ab('0x2b')](_0xa8ab('0x2c'),_0x5da942+'-'+_0x38fbeb+'/'+_0x146ed1)[_0xa8ab('0x26')](_0x510d0e);}return null;};}function patchUpdates(_0x91ff4d){return function(_0x36e849){try{jsonpatch[_0xa8ab('0x2d')](_0x36e849,_0x91ff4d,!![]);}catch(_0x235522){return BPromise[_0xa8ab('0x2e')](_0x235522);}return _0x36e849['save']();};}function saveUpdates(_0x73f76f,_0xb4dcb3){return function(_0x2b4968){if(_0x2b4968){return _0x2b4968[_0xa8ab('0x2f')](_0x73f76f)[_0xa8ab('0x30')](function(_0x1db042){return _0x1db042;});}return null;};}function removeEntity(_0x27bffa,_0x1dff52){return function(_0x386ea7){if(_0x386ea7){return _0x386ea7[_0xa8ab('0x31')]()[_0xa8ab('0x30')](function(){_0x27bffa[_0xa8ab('0x25')](0xcc)[_0xa8ab('0x32')]();});}};}function handleEntityNotFound(_0x482d8f,_0x24243b){return function(_0x37603b){if(!_0x37603b){_0x482d8f['sendStatus'](0x194);}return _0x37603b;};}function handleError(_0x3626d8,_0x1f4e07){_0x1f4e07=_0x1f4e07||0x1f4;return function(_0x278606){logger[_0xa8ab('0x23')](_0x278606['stack']);if(_0x278606[_0xa8ab('0x33')]){delete _0x278606[_0xa8ab('0x33')];}_0x3626d8[_0xa8ab('0x25')](_0x1f4e07)[_0xa8ab('0x34')](_0x278606);};}exports[_0xa8ab('0x35')]=function(_0xefc0c5,_0x16b575){var _0x278bb3={},_0x4389ea={},_0x354b7f={'count':0x0,'rows':[]};var _0x3ed09c=_[_0xa8ab('0x36')](db[_0xa8ab('0x37')][_0xa8ab('0x38')],function(_0x1bfae7){return{'name':_0x1bfae7['fieldName'],'type':_0x1bfae7[_0xa8ab('0x39')][_0xa8ab('0x3a')]};});_0x4389ea[_0xa8ab('0x3b')]=_[_0xa8ab('0x36')](_0x3ed09c,'name');_0x4389ea[_0xa8ab('0x3c')]=_[_0xa8ab('0x3d')](_0xefc0c5[_0xa8ab('0x3c')]);_0x4389ea[_0xa8ab('0x3e')]=_[_0xa8ab('0x3f')](_0x4389ea[_0xa8ab('0x3b')],_0x4389ea[_0xa8ab('0x3c')]);_0x278bb3[_0xa8ab('0x40')]=_['intersection'](_0x4389ea['model'],qs['fields'](_0xefc0c5['query']['fields']));_0x278bb3[_0xa8ab('0x40')]=_0x278bb3[_0xa8ab('0x40')][_0xa8ab('0x41')]?_0x278bb3[_0xa8ab('0x40')]:_0x4389ea[_0xa8ab('0x3b')];if(!_0xefc0c5['query'][_0xa8ab('0x42')](_0xa8ab('0x43'))){_0x278bb3[_0xa8ab('0x28')]=qs['limit'](_0xefc0c5[_0xa8ab('0x3c')][_0xa8ab('0x28')]);_0x278bb3[_0xa8ab('0x27')]=qs['offset'](_0xefc0c5[_0xa8ab('0x3c')][_0xa8ab('0x27')]);}_0x278bb3[_0xa8ab('0x44')]=qs['sort'](_0xefc0c5['query']['sort']);_0x278bb3['where']=qs[_0xa8ab('0x3e')](_[_0xa8ab('0x45')](_0xefc0c5[_0xa8ab('0x3c')],_0x4389ea[_0xa8ab('0x3e')]),_0x3ed09c);if(_0xefc0c5['query'][_0xa8ab('0x46')]){_0x278bb3[_0xa8ab('0x47')]=_[_0xa8ab('0x48')](_0x278bb3[_0xa8ab('0x47')],{'$or':_[_0xa8ab('0x36')](_0x3ed09c,function(_0x5a500b){if(_0x5a500b['type']!==_0xa8ab('0x49')){var _0x111321={};_0x111321[_0x5a500b[_0xa8ab('0x33')]]={'$like':'%'+_0xefc0c5[_0xa8ab('0x3c')][_0xa8ab('0x46')]+'%'};return _0x111321;}})});}_0x278bb3=_[_0xa8ab('0x48')]({},_0x278bb3,_0xefc0c5[_0xa8ab('0x4a')]);var _0x445a67={'where':_0x278bb3[_0xa8ab('0x47')]};return db[_0xa8ab('0x37')]['count'](_0x445a67)[_0xa8ab('0x30')](function(_0x3144ef){_0x354b7f['count']=_0x3144ef;if(_0xefc0c5['query'][_0xa8ab('0x4b')]){_0x278bb3[_0xa8ab('0x4c')]=[{'all':!![]}];}return db[_0xa8ab('0x37')][_0xa8ab('0x4d')](_0x278bb3);})['then'](function(_0x5a4ac6){_0x354b7f[_0xa8ab('0x4e')]=_0x5a4ac6;return _0x354b7f;})[_0xa8ab('0x30')](respondWithFilteredResult(_0x16b575,_0x278bb3))[_0xa8ab('0x4f')](handleError(_0x16b575,null));};exports[_0xa8ab('0x50')]=function(_0xff1b93,_0x53f8a7){var _0x1f6019={'raw':!![],'where':{'id':_0xff1b93[_0xa8ab('0x51')]['id']}},_0x174bf0={};_0x174bf0[_0xa8ab('0x3b')]=_[_0xa8ab('0x3d')](db['SmsMessage'][_0xa8ab('0x38')]);_0x174bf0['query']=_[_0xa8ab('0x3d')](_0xff1b93['query']);_0x174bf0[_0xa8ab('0x3e')]=_['intersection'](_0x174bf0[_0xa8ab('0x3b')],_0x174bf0[_0xa8ab('0x3c')]);_0x1f6019[_0xa8ab('0x40')]=_['intersection'](_0x174bf0[_0xa8ab('0x3b')],qs[_0xa8ab('0x52')](_0xff1b93['query'][_0xa8ab('0x52')]));_0x1f6019['attributes']=_0x1f6019['attributes'][_0xa8ab('0x41')]?_0x1f6019['attributes']:_0x174bf0[_0xa8ab('0x3b')];if(_0xff1b93['query'][_0xa8ab('0x4b')]){_0x1f6019[_0xa8ab('0x4c')]=[{'all':!![]}];}_0x1f6019=_[_0xa8ab('0x48')]({},_0x1f6019,_0xff1b93[_0xa8ab('0x4a')]);return db['SmsMessage'][_0xa8ab('0x53')](_0x1f6019)['then'](handleEntityNotFound(_0x53f8a7,null))['then'](respondWithResult(_0x53f8a7,null))[_0xa8ab('0x4f')](handleError(_0x53f8a7,null));};exports[_0xa8ab('0x54')]=function(_0x4e8991,_0x14f526){return db[_0xa8ab('0x37')][_0xa8ab('0x54')](_0x4e8991[_0xa8ab('0x55')],{})[_0xa8ab('0x30')](respondWithResult(_0x14f526,0xc9))['catch'](handleError(_0x14f526,null));};exports[_0xa8ab('0x2f')]=function(_0x536d94,_0xde40cb){if(_0x536d94[_0xa8ab('0x55')]['id']){delete _0x536d94[_0xa8ab('0x55')]['id'];}return db[_0xa8ab('0x37')][_0xa8ab('0x53')]({'where':{'id':_0x536d94[_0xa8ab('0x51')]['id']}})[_0xa8ab('0x30')](handleEntityNotFound(_0xde40cb,null))[_0xa8ab('0x30')](saveUpdates(_0x536d94['body'],null))['then'](respondWithResult(_0xde40cb,null))[_0xa8ab('0x4f')](handleError(_0xde40cb,null));};exports[_0xa8ab('0x31')]=function(_0x25e1b5,_0x2e7a1f){return db[_0xa8ab('0x37')]['find']({'where':{'id':_0x25e1b5[_0xa8ab('0x51')]['id']}})[_0xa8ab('0x30')](handleEntityNotFound(_0x2e7a1f,null))[_0xa8ab('0x30')](removeEntity(_0x2e7a1f,null))[_0xa8ab('0x4f')](handleError(_0x2e7a1f,null));};exports[_0xa8ab('0x56')]=function(_0x2b3684,_0x15d452){return db[_0xa8ab('0x37')][_0xa8ab('0x56')]()[_0xa8ab('0x30')](respondWithResult(_0x15d452,null))[_0xa8ab('0x4f')](handleError(_0x15d452,null));};var interaction_log=require(_0xa8ab('0x11'))('sms-interactions');exports[_0xa8ab('0x57')]=function(_0x4b1de0,_0x52f4d5,_0x464c80){var _0xb46ae4={'agent':{},'channel':'sms'};if(_0x4b1de0[_0xa8ab('0x55')]['id']){delete _0x4b1de0[_0xa8ab('0x55')]['id'];}_0x4b1de0[_0xa8ab('0x55')][_0xa8ab('0x58')]=!![];_0x4b1de0[_0xa8ab('0x55')][_0xa8ab('0x59')]=moment()['format'](_0xa8ab('0x5a'));_0x4b1de0[_0xa8ab('0x55')][_0xa8ab('0x5b')]=_0x4b1de0[_0xa8ab('0x55')][_0xa8ab('0x5b')]||_0x4b1de0[_0xa8ab('0x5c')]['id'];_0xb46ae4[_0xa8ab('0x5d')]['id']=_0x4b1de0[_0xa8ab('0x55')][_0xa8ab('0x5b')];return db[_0xa8ab('0x37')][_0xa8ab('0x53')]({'where':{'id':_0x4b1de0[_0xa8ab('0x51')]['id'],'UserId':null}})[_0xa8ab('0x30')](handleEntityNotFound(_0x52f4d5,null))[_0xa8ab('0x30')](saveUpdates(_0x4b1de0[_0xa8ab('0x55')],null))[_0xa8ab('0x30')](function(_0x1cceca){if(_0x1cceca){_0xb46ae4[_0xa8ab('0x24')]=_0x1cceca[_0xa8ab('0x5e')]({'plain':!![]});return db[_0xa8ab('0x5f')][_0xa8ab('0x53')]({'where':{'id':_0x1cceca[_0xa8ab('0x60')]}});}return null;})[_0xa8ab('0x30')](handleEntityNotFound(_0x52f4d5,null))['then'](function(_0x427d8e){if(_0x427d8e){return _0x427d8e[_0xa8ab('0x2f')]({'UserId':_0x4b1de0['body'][_0xa8ab('0x5b')],'read1stAt':_[_0xa8ab('0x61')](_0x427d8e[_0xa8ab('0x62')])?moment()[_0xa8ab('0x63')](_0xa8ab('0x5a')):undefined});}return null;})[_0xa8ab('0x30')](function(_0x1ddc58){if(_0x1ddc58){_0xb46ae4['interaction']=_0x1ddc58[_0xa8ab('0x5e')]({'plain':!![]});interaction_log['info'](_0xa8ab('0x64'),_0x4b1de0[_0xa8ab('0x5c')]['id'],_0x4b1de0['user'][_0xa8ab('0x33')],_0x4b1de0[_0xa8ab('0x5c')][_0xa8ab('0x65')],_0xb46ae4[_0xa8ab('0x66')]['id'],_0x4b1de0[_0xa8ab('0x55')]?JSON[_0xa8ab('0x21')](_0x4b1de0[_0xa8ab('0x55')]):_0xa8ab('0x67'));return respondWithRpcPromise(_0xa8ab('0x68'),_0xa8ab('0x69'),_0xb46ae4);}return null;})[_0xa8ab('0x30')](function(_0x5f6d95){var _0x460469='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5f6d95[_0xa8ab('0x24')][_0xa8ab('0x6a')];return db[_0xa8ab('0x6b')][_0xa8ab('0x3c')](_0x460469,{'type':db[_0xa8ab('0x6c')][_0xa8ab('0x6d')][_0xa8ab('0x6e')],'raw':!![]})[_0xa8ab('0x30')](function(_0x1c4a4a){return _0x1c4a4a;});})[_0xa8ab('0x30')](function(_0x381601){if(_0x381601){_0xb46ae4['message'][_0xa8ab('0x6f')]=_0x381601[0x0];if(!_0x4b1de0[_0xa8ab('0x55')][_0xa8ab('0x5b')])return;return db[_0xa8ab('0x70')][_0xa8ab('0x53')]({'where':{'id':_0x4b1de0[_0xa8ab('0x55')][_0xa8ab('0x5b')],'role':'agent'},'attributes':['id',_0xa8ab('0x33'),_0xa8ab('0x71'),'email',_0xa8ab('0x72')],'raw':!![]});}return null;})['then'](function(_0x3c3dd3){if(!_0x3c3dd3)return null;_0xb46ae4[_0xa8ab('0x24')]['agent']=_0x3c3dd3;return _0xb46ae4;})['then'](function(_0xffad6e){if(_0xffad6e){if(_0x4b1de0[_0xa8ab('0x55')][_0xa8ab('0x73')]){_0xb46ae4[_0xa8ab('0x24')]['interface']=util[_0xa8ab('0x63')](_0xa8ab('0x74'),_0x4b1de0[_0xa8ab('0x5c')][_0xa8ab('0x33')]);_0xb46ae4[_0xa8ab('0x24')][_0xa8ab('0x75')]=_0xb46ae4[_0xa8ab('0x75')];_0xb46ae4[_0xa8ab('0x24')]['event']='accept';return respondWithRpcPromise(_0xa8ab('0x76'),_0xa8ab('0x76'),{'event':_0xa8ab('0x77'),'message':_0xb46ae4[_0xa8ab('0x24')]},client9002)['then'](function(){return _0xb46ae4;});}return _0xb46ae4;}return null;})[_0xa8ab('0x30')](respondWithResult(_0x52f4d5,null))[_0xa8ab('0x4f')](handleError(_0x52f4d5,null));};var interaction_log=require(_0xa8ab('0x11'))('sms-interactions');exports[_0xa8ab('0x2e')]=function(_0x488fad,_0x3d765e,_0xd8fc4e){var _0x5b4ec2={'agent':{},'channel':_0xa8ab('0x78')};if(_0x488fad['body']['id']){delete _0x488fad[_0xa8ab('0x55')]['id'];}_0x488fad['body'][_0xa8ab('0x5b')]=_0x488fad[_0xa8ab('0x55')][_0xa8ab('0x5b')]||_0x488fad['user']['id'];_0x5b4ec2[_0xa8ab('0x5d')]['id']=_0x488fad['body'][_0xa8ab('0x5b')];return db[_0xa8ab('0x37')][_0xa8ab('0x53')]({'where':{'id':_0x488fad['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3d765e,null))[_0xa8ab('0x30')](function(_0x58c821){if(_0x58c821){_0x5b4ec2[_0xa8ab('0x24')]=_0x58c821[_0xa8ab('0x5e')]({'plain':!![]});return db[_0xa8ab('0x5f')]['find']({'where':{'id':_0x58c821['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3d765e,null))[_0xa8ab('0x30')](function(_0x7bfd6){if(_0x7bfd6){_0x5b4ec2['interaction']=_0x7bfd6['get']({'plain':!![]});interaction_log[_0xa8ab('0x79')](_0xa8ab('0x7a'),_0x488fad[_0xa8ab('0x5c')]['id'],_0x488fad[_0xa8ab('0x5c')][_0xa8ab('0x33')],_0x488fad[_0xa8ab('0x5c')][_0xa8ab('0x65')],_0x5b4ec2[_0xa8ab('0x66')]['id'],_0x488fad[_0xa8ab('0x55')]?JSON[_0xa8ab('0x21')](_0x488fad[_0xa8ab('0x55')]):_0xa8ab('0x67'));return respondWithRpcPromise(_0xa8ab('0x7b'),_0xa8ab('0x7c'),_0x5b4ec2);}return null;})[_0xa8ab('0x30')](function(_0x108d7f){var _0x1f1c61=_0xa8ab('0x7d')+_0x108d7f[_0xa8ab('0x24')]['ContactId'];return db[_0xa8ab('0x6b')][_0xa8ab('0x3c')](_0x1f1c61,{'type':db[_0xa8ab('0x6c')]['QueryTypes'][_0xa8ab('0x6e')],'raw':!![]})['then'](function(_0x5db23e){return _0x5db23e;});})[_0xa8ab('0x30')](function(_0x2f568a){if(_0x2f568a){_0x5b4ec2[_0xa8ab('0x24')][_0xa8ab('0x6f')]=_0x2f568a[0x0];if(!_0x488fad[_0xa8ab('0x55')][_0xa8ab('0x5b')])return;return db['User'][_0xa8ab('0x53')]({'where':{'id':_0x488fad[_0xa8ab('0x55')][_0xa8ab('0x5b')],'role':'agent'},'attributes':['id',_0xa8ab('0x33'),_0xa8ab('0x71'),_0xa8ab('0x7e'),'internal'],'raw':!![]});}return null;})['then'](function(_0x412196){if(!_0x412196)return null;_0x5b4ec2[_0xa8ab('0x24')]['agent']=_0x412196;return _0x5b4ec2;})[_0xa8ab('0x30')](function(_0x2c20aa){if(_0x2c20aa){_0x2c20aa[_0xa8ab('0x24')][_0xa8ab('0x7f')]=util['format']('SIP/%s',_0x488fad[_0xa8ab('0x5c')][_0xa8ab('0x33')]);_0x2c20aa['message']['channel']=_0x5b4ec2['channel'];_0x2c20aa[_0xa8ab('0x24')][_0xa8ab('0x80')]=_0xa8ab('0x2e');respondWithRpcPromise(_0xa8ab('0x76'),_0xa8ab('0x76'),{'event':_0xa8ab('0x81'),'message':_0x2c20aa[_0xa8ab('0x24')]},client9002);return _0x5b4ec2;}return null;})[_0xa8ab('0x30')](respondWithResult(_0x3d765e,null))[_0xa8ab('0x4f')](handleError(_0x3d765e,null));};exports['status']=function(_0x279d33,_0x51b85e,_0x539260){if(_0x279d33['body']['id']){delete _0x279d33[_0xa8ab('0x55')]['id'];}var _0x35cc36;return db[_0xa8ab('0x37')][_0xa8ab('0x53')]({'where':{'id':_0x279d33[_0xa8ab('0x51')]['id']}})[_0xa8ab('0x30')](handleEntityNotFound(_0x51b85e,null))[_0xa8ab('0x30')](function(_0x357a9b){if(_0x357a9b){_0x35cc36=_0x357a9b;return db[_0xa8ab('0x82')]['find']({'where':{'id':_0x357a9b[_0xa8ab('0x83')]}});}})[_0xa8ab('0x30')](handleEntityNotFound(_0x51b85e,null))['then'](function(_0x1dbc60){if(_0x1dbc60){logger[_0xa8ab('0x1e')](_0xa8ab('0x1f'),_0xa8ab('0x25'),'received\x20delivery\x20report\x20from',_0x1dbc60[_0xa8ab('0x39')],util[_0xa8ab('0x84')](_0x279d33[_0xa8ab('0x55')],{'showHidden':![],'depth':null}));switch(_0x1dbc60[_0xa8ab('0x39')]){case'twilio':if(_0x279d33[_0xa8ab('0x55')][_0xa8ab('0x85')]&&_0x279d33[_0xa8ab('0x55')][_0xa8ab('0x85')]===_0x35cc36[_0xa8ab('0x86')]){return _0x35cc36['update']({'read':!![]});}else{logger[_0xa8ab('0x23')](_0xa8ab('0x87'),_0xa8ab('0x25'),_0xa8ab('0x88'),util[_0xa8ab('0x84')](_0x279d33[_0xa8ab('0x55')],{'showHidden':![],'depth':null}));}break;case _0xa8ab('0x89'):if(_0x279d33[_0xa8ab('0x55')]['MessageUUID']&&_0x279d33[_0xa8ab('0x55')][_0xa8ab('0x8a')]===_0x35cc36[_0xa8ab('0x86')]&&_[_0xa8ab('0x8b')](['sent',_0xa8ab('0x8c')],_0x279d33[_0xa8ab('0x55')][_0xa8ab('0x8d')])>=0x0){return _0x35cc36[_0xa8ab('0x2f')]({'read':!![]});}else{logger[_0xa8ab('0x23')](_0xa8ab('0x87'),'status',_0xa8ab('0x8e'),util[_0xa8ab('0x84')](_0x279d33[_0xa8ab('0x55')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x292426=_0x279d33[_0xa8ab('0x55')][_0xa8ab('0x8f')][0x0];if(_0x292426['status'][_0xa8ab('0x90')]==='DELIVERED'){return _0x35cc36[_0xa8ab('0x2f')]({'read':!![]});}else{logger['error'](_0xa8ab('0x87'),_0xa8ab('0x25'),_0xa8ab('0x91'),util[_0xa8ab('0x84')](_0x279d33[_0xa8ab('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x35cc36;}})['then'](respondWithResult(_0x51b85e,null))[_0xa8ab('0x4f')](handleError(_0x51b85e,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index e28d38c..b9b1d7e 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 _0xdba8=['setMaxListeners','save','update','remove','emit','hook','SmsMessage'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0xdba8,0x179));var _0x8dba=function(_0x2aeecd,_0x526050){_0x2aeecd=_0x2aeecd-0x0;var _0x1dd3f4=_0xdba8[_0x2aeecd];return _0x1dd3f4;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0x8dba('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x8dba('0x1')](0x0);var events={'afterCreate':_0x8dba('0x2'),'afterUpdate':_0x8dba('0x3'),'afterDestroy':_0x8dba('0x4')};function emitEvent(_0x245766){return function(_0x5b946f,_0x212cad,_0x10e835){SmsMessageEvents[_0x8dba('0x5')](_0x245766+':'+_0x5b946f['id'],_0x5b946f);SmsMessageEvents[_0x8dba('0x5')](_0x245766,_0x5b946f);_0x10e835(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x8dba('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xce3e=['emit','hook','exports','events','../../mysqldb','save','update'];(function(_0x36c678,_0x56135e){var _0x292540=function(_0x5d9713){while(--_0x5d9713){_0x36c678['push'](_0x36c678['shift']());}};_0x292540(++_0x56135e);}(_0xce3e,0x1ae));var _0xece3=function(_0x7ca473,_0x269f3b){_0x7ca473=_0x7ca473-0x0;var _0x17ad18=_0xce3e[_0x7ca473];return _0x17ad18;};'use strict';var EventEmitter=require(_0xece3('0x0'));var SmsMessage=require(_0xece3('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xece3('0x2'),'afterUpdate':_0xece3('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4be400){return function(_0x462adb,_0xd8aa1f,_0x77036b){SmsMessageEvents['emit'](_0x4be400+':'+_0x462adb['id'],_0x462adb);SmsMessageEvents[_0xece3('0x4')](_0x4be400,_0x462adb);_0x77036b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xece3('0x5')](e,emitEvent(event));}}module[_0xece3('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index d88b1a7..1cf1a9b 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 _0x9990=['./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','toLowerCase','out','secret','isNil','UserId','findOne','SmsInteractionId','then','update','direction','catch','error','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','token','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','GET','split','sms','user_key','session_key','total_sent','deliveryReport','read','afterCreate','connectel','senderString','POST','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','queued_count','head','data','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','sender','text','timestamp','sort','length','apiKey','createHash','hex','signature=','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','accountId','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4f8d16,_0x3d5853){var _0x3bb7b1=function(_0x185642){while(--_0x185642){_0x4f8d16['push'](_0x4f8d16['shift']());}};_0x3bb7b1(++_0x3d5853);}(_0x9990,0xf6));var _0x0999=function(_0xeb9f69,_0x34d75e){_0xeb9f69=_0xeb9f69-0x0;var _0x4a8d87=_0x9990[_0xeb9f69];return _0x4a8d87;};'use strict';var _=require('lodash');var util=require(_0x0999('0x0'));var logger=require(_0x0999('0x1'))(_0x0999('0x2'));var moment=require(_0x0999('0x3'));var BPromise=require(_0x0999('0x4'));var rp=require(_0x0999('0x5'));var fs=require('fs');var path=require(_0x0999('0x6'));var rimraf=require(_0x0999('0x7'));var config=require('../../config/environment');var attributes=require(_0x0999('0x8'));module[_0x0999('0x9')]=function(_0x45d3e0,_0x4c606f){return _0x45d3e0[_0x0999('0xa')](_0x0999('0xb'),attributes,{'tableName':_0x0999('0xc'),'paranoid':![],'indexes':[{'name':_0x0999('0xd'),'fields':[_0x0999('0xd')]},{'name':_0x0999('0xe'),'fields':[_0x0999('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xf6a77f,_0x3073d3,_0x161b44){var _0x5f1333=_0x45d3e0[_0x0999('0x10')];var _0x471d9c=_0xf6a77f[_0x0999('0x11')]({'plain':!![]});if(_0x471d9c['direction'][_0x0999('0x12')]()==='in'||_0x471d9c['direction'][_0x0999('0x12')]()===_0x0999('0x13')&&!_0x471d9c[_0x0999('0x14')]&&!_[_0x0999('0x15')](_0x471d9c[_0x0999('0x16')])){_0x5f1333['SmsInteraction'][_0x0999('0x17')]({'where':{'id':_0x471d9c[_0x0999('0x18')]}})[_0x0999('0x19')](function(_0x4011bf){if(_0x4011bf){_0x4011bf[_0x0999('0x1a')]({'lastMsgAt':_0x471d9c['createdAt'],'lastMsgDirection':_0x471d9c[_0x0999('0x1b')][_0x0999('0x12')]()});}})[_0x0999('0x1c')](function(_0x4e4e53){console[_0x0999('0x1d')](_0x4e4e53);});}if(_0x471d9c[_0x0999('0x1b')]===_0x0999('0x13')&&!_0x471d9c['secret']){var _0xa82828;_0x5f1333[_0x0999('0x1e')]['find']({'where':{'id':_0x471d9c[_0x0999('0x1f')]},'raw':!![]})[_0x0999('0x19')](function(_0x56373e){_0xa82828=_0x56373e;if(_0xa82828&&_0xa82828[_0x0999('0x20')]){switch(_0xa82828[_0x0999('0x20')]){case _0x0999('0x21'):var _0x470c84=require(_0x0999('0x21'));if(_0xa82828[_0x0999('0x22')]&&_0xa82828[_0x0999('0x23')]&&_0xa82828[_0x0999('0x24')]){var _0x8a5ef6=new _0x470c84(_0xa82828['accountSid'],_0xa82828[_0x0999('0x23')]);_0x8a5ef6[_0x0999('0x25')]['create']({'body':_0x471d9c['body'],'to':_0x471d9c[_0x0999('0x24')],'from':_0xa82828[_0x0999('0x24')],'statusCallback':_0xa82828[_0x0999('0x26')]+_0x0999('0x27')+_0x471d9c['id']+_0x0999('0x28')+_0xa82828[_0x0999('0x29')]})['then'](function(_0x20ba88){if(_0x20ba88['sid']){return _0xf6a77f[_0x0999('0x1a')]({'messageId':_0x20ba88['sid']});}})[_0x0999('0x1c')](function(_0x106669){logger[_0x0999('0x1d')](_0x0999('0x2a'),'afterCreate','twilio',util[_0x0999('0x2b')](_0x106669,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0999('0x2a'),'afterCreate',_0x0999('0x21'),_0x0999('0x2c'));}break;case _0x0999('0x2d'):var _0xf63dc7=_0x0999('0x2e');if(_0xa82828[_0x0999('0x2f')]&&_0xa82828[_0x0999('0x30')]){var _0x5c9fb4={'recipient':[_0x471d9c[_0x0999('0x24')]],'message':_0x471d9c[_0x0999('0xf')],'message_type':_0xa82828[_0x0999('0x31')]};if(_0xa82828[_0x0999('0x31')]&&_0xa82828[_0x0999('0x31')]!=='SI'){_0x5c9fb4['sender']=_0xa82828[_0x0999('0x24')];}var _0x505994={'url':_0xf63dc7+_0x0999('0x32')+_0xa82828['username']+'&password='+_0xa82828[_0x0999('0x30')],'method':_0x0999('0x33')};rp(_0x505994)['then'](function(_0xdf8b8b){var _0x153f0c=_0xdf8b8b[_0x0999('0x34')](';');var _0x4ede8e={'user_key':_0x153f0c[0x0],'session_key':_0x153f0c[0x1]};_0x505994={'url':_0xf63dc7+_0x0999('0x35'),'method':'POST','headers':{'user_key':_0x4ede8e[_0x0999('0x36')],'Session_key':_0x4ede8e[_0x0999('0x37')]},'json':!![],'body':_0x5c9fb4};return rp(_0x505994);})[_0x0999('0x19')](function(_0x45b1ee){if(_0x45b1ee[_0x0999('0x38')]>=0x1){var _0x53f08d={'messageId':_0x45b1ee['internal_order_id']};if(_0xa82828[_0x0999('0x31')]!=='GP'||!_0xa82828[_0x0999('0x39')]){_0x53f08d[_0x0999('0x3a')]=!![];}return _0xf6a77f[_0x0999('0x1a')](_0x53f08d);}else{return logger['error'](_0x0999('0x2a'),_0x0999('0x3b'),'skebby',util[_0x0999('0x2b')](_0x45b1ee,{'showHidden':![],'depth':null}));}})[_0x0999('0x1c')](function(_0x4611f9){return logger[_0x0999('0x1d')](_0x0999('0x2a'),_0x0999('0x3b'),'skebby',util[_0x0999('0x2b')](_0x4611f9,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0999('0x2a'),_0x0999('0x3b'),_0x0999('0x2d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x0999('0x3c'):if(_0xa82828[_0x0999('0x23')]){var _0x4e3bd3={'recipient':_0x471d9c[_0x0999('0x24')],'message':_0x471d9c[_0x0999('0xf')],'sender':_0xa82828[_0x0999('0x3d')]||_0xa82828[_0x0999('0x24')],'authorization':_0xa82828[_0x0999('0x23')]};var _0x3073d3={'method':_0x0999('0x3e'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x4e3bd3,'json':!![]};rp(_0x3073d3)[_0x0999('0x19')](function(_0x22da38){var _0x557358={'messageId':_0x22da38[_0x0999('0x3f')]};if(!_0xa82828[_0x0999('0x39')]){_0x557358[_0x0999('0x3a')]=!![];}return _0xf6a77f[_0x0999('0x1a')](_0x557358);})[_0x0999('0x1c')](function(_0x47ab00){logger[_0x0999('0x1d')](_0x0999('0x2a'),_0x0999('0x3b'),'connectel',util[_0x0999('0x2b')](_0x47ab00,{'showHidden':![],'depth':null}));});}else{logger[_0x0999('0x1d')](_0x0999('0x2a'),_0x0999('0x3b'),_0x0999('0x3c'),_0x0999('0x40'));}break;case _0x0999('0x41'):if(_0xa82828[_0x0999('0x2f')]&&_0xa82828[_0x0999('0x30')]){var _0x4e3bd3={'messages':[{'source':_0x0999('0x42'),'to':_0x471d9c[_0x0999('0x24')],'body':_0x471d9c['body'],'from':_0xa82828[_0x0999('0x3d')]||_0xa82828[_0x0999('0x24')]}]};var _0x4d3d7b=util['format'](_0x0999('0x43'),_0xa82828['username'],_0xa82828['password']);var _0x3073d3={'method':_0x0999('0x3e'),'uri':_0x0999('0x44'),'body':_0x4e3bd3,'headers':{'Authorization':util[_0x0999('0x45')](_0x0999('0x46'),new Buffer(_0x4d3d7b)[_0x0999('0x47')](_0x0999('0x48')))},'json':!![]};rp(_0x3073d3)[_0x0999('0x19')](function(_0x336c19){if(_0x336c19[_0x0999('0x49')]>=0xc8&&_0x336c19[_0x0999('0x49')]<=0xce){if(_0x336c19['data']&&_0x336c19['data'][_0x0999('0x4a')]>0x0){var _0x185fbe=_[_0x0999('0x4b')](_0x336c19[_0x0999('0x4c')][_0x0999('0x25')]);var _0xd6a019={'messageId':_0x185fbe[_0x0999('0x4d')]};if(!_0xa82828[_0x0999('0x39')]){_0xd6a019['read']=!![];}return _0xf6a77f['update'](_0xd6a019);}else{logger[_0x0999('0x1d')](_0x0999('0x2a'),'afterCreate',_0x0999('0x4e'),util['inspect'](_0x336c19,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x0999('0x2a'),_0x0999('0x3b'),_0x0999('0x4e'),util[_0x0999('0x2b')](_0x336c19,{'showHidden':![],'depth':null}));}})[_0x0999('0x1c')](function(_0x6ae41b){logger[_0x0999('0x1d')](_0x0999('0x2a'),_0x0999('0x3b'),'clickSend',util[_0x0999('0x2b')](_0x6ae41b,{'showHidden':![],'depth':null}));});}else{logger[_0x0999('0x1d')](_0x0999('0x2a'),_0x0999('0x3b'),_0x0999('0x4e'),_0x0999('0x4f'));}break;case _0x0999('0x50'):if(_0xa82828[_0x0999('0x51')]&&_0xa82828[_0x0999('0x23')]){var _0x4e3bd3={'dst':_0x471d9c[_0x0999('0x24')],'text':_0x471d9c['body'],'src':_0xa82828[_0x0999('0x3d')]||_0xa82828[_0x0999('0x24')],'url':_0xa82828[_0x0999('0x26')]+_0x0999('0x27')+_0x471d9c['id']+_0x0999('0x28')+_0xa82828['token']};var _0x4d3d7b=util[_0x0999('0x45')](_0x0999('0x43'),_0xa82828[_0x0999('0x51')],_0xa82828[_0x0999('0x23')]);var _0x3073d3={'method':'POST','uri':util[_0x0999('0x45')](_0x0999('0x52'),_0xa82828[_0x0999('0x51')]),'body':_0x4e3bd3,'headers':{'Authorization':util[_0x0999('0x45')](_0x0999('0x46'),new Buffer(_0x4d3d7b)[_0x0999('0x47')](_0x0999('0x48')))},'json':!![]};rp(_0x3073d3)['then'](function(_0x10829d){var _0x1df925={'messageId':_0x10829d[_0x0999('0x53')][0x0]};return _0xf6a77f[_0x0999('0x1a')](_0x1df925);})['catch'](function(_0x2a1769){logger[_0x0999('0x1d')](_0x0999('0x2a'),'afterCreate',_0x0999('0x50'),util[_0x0999('0x2b')](_0x2a1769,{'showHidden':![],'depth':null}));});}else{logger[_0x0999('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0999('0x3b'),_0x0999('0x50'),_0x0999('0x54'));}break;case _0x0999('0x55'):if(_0xa82828[_0x0999('0x2f')]&&_0xa82828[_0x0999('0x30')]){if(_0xa82828[_0x0999('0x56')]){var _0x1607f1={'method':_0x0999('0x3e'),'uri':_0xa82828['baseUrl']+_0x0999('0x57'),'body':{'username':_0xa82828[_0x0999('0x2f')],'password':_0xa82828[_0x0999('0x30')]},'json':!![]};return rp(_0x1607f1)[_0x0999('0x19')](function(_0x239ee5){var _0x4d86d4={'method':'POST','uri':_0xa82828[_0x0999('0x56')]+_0x0999('0x58'),'body':{'messages':[{'from':_0xa82828['phone'],'destinations':[{'to':_0x471d9c['phone']}],'text':_0x471d9c['body'],'notifyUrl':_0xa82828[_0x0999('0x26')]+_0x0999('0x27')+_0x471d9c['id']+_0x0999('0x28')+_0xa82828[_0x0999('0x29')],'notifyContentType':_0x0999('0x59'),'callbackData':_0xa82828[_0x0999('0x24')]+';'+_0x471d9c[_0x0999('0xf')]}]},'headers':{'Authorization':_0x0999('0x5a')+_0x239ee5[_0x0999('0x29')]},'json':!![]};return rp(_0x4d86d4)['then'](function(_0x12e759){if(_0x12e759['messages']){var _0x2a3f46={'messageId':_0x12e759[_0x0999('0x25')][0x0][_0x0999('0xd')]};if(!_0xa82828[_0x0999('0x39')]){_0x2a3f46[_0x0999('0x3a')]=!![];}return _0xf6a77f['update'](_0x2a3f46);}else{return logger['error'](_0x0999('0x2a'),_0x0999('0x3b'),_0x0999('0x55'),util[_0x0999('0x2b')](_0x12e759,{'showHidden':![],'depth':null}));}});})[_0x0999('0x1c')](function(_0x495047){return logger[_0x0999('0x1d')](_0x0999('0x2a'),_0x0999('0x3b'),_0x0999('0x55'),util[_0x0999('0x2b')](_0x495047,{'showHidden':![],'depth':null}));});}else{logger[_0x0999('0x1d')](_0x0999('0x2a'),_0x0999('0x3b'),_0x0999('0x55'),_0x0999('0x5b'));}}else{logger['error'](_0x0999('0x2a'),_0x0999('0x3b'),'infobip',_0x0999('0x4f'));}break;case _0x0999('0x5c'):var _0x2b85a5=require(_0x0999('0x5d'));if(_0xa82828['apiKey']){var _0x30f751={};_0x30f751[_0x0999('0x5e')]=_0xa82828[_0x0999('0x2f')];_0x30f751['phone']=_0x471d9c['phone'];_0x30f751[_0x0999('0x5f')]=_0xa82828[_0x0999('0x24')];_0x30f751[_0x0999('0x60')]=_0x471d9c['body'];_0x30f751[_0x0999('0x61')]=+new Date();var _0xbe138f='';var _0x353a8f='';var _0x49a856=Object['keys'](_0x30f751);_0x49a856[_0x0999('0x62')]();for(var _0x9f943=0x0;_0x9f943<_0x49a856[_0x0999('0x63')];_0x9f943++){if(_0xbe138f!=''){_0xbe138f+='&';}_0xbe138f+=_0x49a856[_0x9f943]+'='+encodeURIComponent(_0x30f751[_0x49a856[_0x9f943]]);_0x353a8f+=_0x30f751[_0x49a856[_0x9f943]];}_0x353a8f+=_0xa82828[_0x0999('0x64')];_0x353a8f=_0x2b85a5[_0x0999('0x65')]('md5')['update'](_0x353a8f)['digest'](_0x0999('0x66'));if(_0xbe138f!==''){_0xbe138f+='&';}_0xbe138f+=_0x0999('0x67')+_0x353a8f;var _0x505994={'method':'GET','uri':_0xa82828[_0x0999('0x56')]+_0x0999('0x68')+_0xbe138f,'json':!![]};return rp(_0x505994)[_0x0999('0x19')](function(_0x4e57e2){var _0x310508=Object[_0x0999('0x69')](_0x4e57e2);if(_0x4e57e2[_0x310508[0x0]][_0x0999('0x1d')]&&parseInt(_0x4e57e2[_0x310508[0x0]]['error'])===0x0){var _0x50753e={'messageId':_0x4e57e2[_0x310508[0x0]][_0x0999('0x6a')]};if(!_0xa82828['deliveryReport']){_0x50753e[_0x0999('0x3a')]=!![];}return _0xf6a77f['update'](_0x50753e);}else{return logger[_0x0999('0x1d')](_0x0999('0x2a'),_0x0999('0x3b'),'csc',util[_0x0999('0x2b')](_0x4e57e2['error'],{'showHidden':![],'depth':null}));}})[_0x0999('0x1c')](function(_0x3a2e00){return logger[_0x0999('0x1d')](_0x0999('0x2a'),_0x0999('0x3b'),_0x0999('0x5c'),util[_0x0999('0x2b')](_0x3a2e00,{'showHidden':![],'depth':null}));});}else{logger[_0x0999('0x1d')](_0x0999('0x2a'),_0x0999('0x3b'),_0x0999('0x5c'),_0x0999('0x6b'));}break;case'clickatell':if(_0xa82828[_0x0999('0x64')]){var _0x27fca9={'method':'POST','uri':_0x0999('0x6c'),'headers':{'Authorization':_0xa82828[_0x0999('0x64')]},'body':{'content':_0x471d9c[_0x0999('0xf')],'to':[_0x471d9c[_0x0999('0x24')]],'from':_0xa82828[_0x0999('0x24')],'binary':![],'clientMessageId':_0x0999('0x6d'),'charset':_0x0999('0x6e')},'json':!![]};rp(_0x27fca9)[_0x0999('0x19')](function(_0x344675){if(!_0x344675['error']){var _0x3e866d={'messageId':_0x344675['messages'][0x0][_0x0999('0x6f')]};if(!_0xa82828[_0x0999('0x39')]){_0x3e866d[_0x0999('0x3a')]=!![];}return _0xf6a77f[_0x0999('0x1a')](_0x3e866d);}else{return logger[_0x0999('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0999('0x3b'),'clickatell',util[_0x0999('0x2b')](_0x344675[_0x0999('0x1d')],{'showHidden':![],'depth':null}));}})[_0x0999('0x1c')](function(_0x46fabd){return logger[_0x0999('0x1d')](_0x0999('0x2a'),'afterCreate','clickatell',util[_0x0999('0x2b')](_0x46fabd,{'showHidden':![],'depth':null}));});}else{logger[_0x0999('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0999('0x3b'),_0x0999('0x70'),_0x0999('0x6b'));}break;case'bandwidth':if(_0xa82828[_0x0999('0x2f')]&&_0xa82828[_0x0999('0x30')]){var _0x4d3d7b=util[_0x0999('0x45')](_0x0999('0x43'),_0xa82828['username'],_0xa82828[_0x0999('0x30')]);var _0x3073d3={'method':_0x0999('0x3e'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0xa82828[_0x0999('0x71')]+'/messages','body':{'to':[_0x471d9c['phone']],'text':_0x471d9c[_0x0999('0xf')],'from':_0xa82828['phone'],'applicationId':_0xa82828[_0x0999('0x72')]},'headers':{'Authorization':util[_0x0999('0x45')](_0x0999('0x46'),new Buffer(_0x4d3d7b)[_0x0999('0x47')](_0x0999('0x48')))},'json':!![]};rp(_0x3073d3)[_0x0999('0x19')](function(_0x776b81){if(_0x776b81['id']){var _0x5d4de3={'messageId':_0x776b81['id']};return _0xf6a77f[_0x0999('0x1a')](_0x5d4de3);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0999('0x3b'),_0x0999('0x73'),util[_0x0999('0x2b')](_0x776b81,{'showHidden':![],'depth':null}));}})['catch'](function(_0x57ba52){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0999('0x3b'),_0x0999('0x73'),util[_0x0999('0x2b')](_0x57ba52,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0999('0x2a'),_0x0999('0x3b'),_0x0999('0x73'),_0x0999('0x4f'));}break;case _0x0999('0x74'):if(_0xa82828['apiKey']){var _0x1645b2={};var _0x505994={'method':_0x0999('0x3e'),'uri':_0x0999('0x75'),'headers':{'Authorization':_0x0999('0x76')+_0xa82828[_0x0999('0x64')],'Content-Type':_0x0999('0x59')},'body':{'from':_0xa82828[_0x0999('0x24')],'to':_0x471d9c[_0x0999('0x24')],'text':_0x471d9c[_0x0999('0xf')]},'json':!![]};return rp(_0x505994)[_0x0999('0x19')](function(_0x1daa8f){if(_0x1daa8f['code']==0xca){_0x1645b2[_0x0999('0x77')]=_0x1daa8f;var _0x37e1b2={'method':_0x0999('0x3e'),'uri':_0x0999('0x78'),'headers':{'Authorization':_0x0999('0x76')+_0xa82828[_0x0999('0x64')],'Content-Type':_0x0999('0x59')},'body':{'refid':_0x1645b2[_0x0999('0x77')][_0x0999('0x79')]},'json':!![]};return rp(_0x37e1b2)[_0x0999('0x19')](function(_0x429111){_0x1645b2[_0x0999('0x7a')]=_0x429111;var _0x18327f={'messageId':_0x1645b2[_0x0999('0x77')][_0x0999('0x79')],'read':!![]};return _0xf6a77f['update'](_0x18327f);});}else{return logger[_0x0999('0x1d')](_0x0999('0x2a'),'afterCreate',_0x0999('0x74'),util[_0x0999('0x2b')](_0x1daa8f,{'showHidden':![],'depth':null}));}})[_0x0999('0x1c')](function(_0x441eb3){return logger[_0x0999('0x1d')](_0x0999('0x2a'),_0x0999('0x3b'),_0x0999('0x74'),util['inspect'](_0x441eb3,{'showHidden':![],'depth':null}));});}else{return logger[_0x0999('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0999('0x3b'),'intelepeer',_0x0999('0x7b'));}break;}}})[_0x0999('0x7c')](function(){_0x161b44();});}else{_0x161b44();}}},'charset':_0x0999('0x7d'),'collate':_0x0999('0x7e')});}; \ No newline at end of file +var _0x3d9c=['skebby','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','clickSend','plivo','authId','/api/sms/messages/','/status?token=','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','baseUrl','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','createHash','digest','hex','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','intelepeer','Token\x20not\x20received','finally','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','SmsInteraction','findOne','createdAt','toLowerCase','catch','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','remote','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','update'];(function(_0x29f1b5,_0x19ac42){var _0x5bcfbd=function(_0x126629){while(--_0x126629){_0x29f1b5['push'](_0x29f1b5['shift']());}};_0x5bcfbd(++_0x19ac42);}(_0x3d9c,0x134));var _0xc3d9=function(_0x92441c,_0x21e5c5){_0x92441c=_0x92441c-0x0;var _0x3cde0f=_0x3d9c[_0x92441c];return _0x3cde0f;};'use strict';var _=require(_0xc3d9('0x0'));var util=require('util');var logger=require(_0xc3d9('0x1'))(_0xc3d9('0x2'));var moment=require(_0xc3d9('0x3'));var BPromise=require('bluebird');var rp=require(_0xc3d9('0x4'));var fs=require('fs');var path=require(_0xc3d9('0x5'));var rimraf=require(_0xc3d9('0x6'));var config=require(_0xc3d9('0x7'));var attributes=require(_0xc3d9('0x8'));module[_0xc3d9('0x9')]=function(_0x137aaf,_0x492577){return _0x137aaf[_0xc3d9('0xa')](_0xc3d9('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xc3d9('0xc'),'fields':['messageId']},{'name':_0xc3d9('0xd'),'fields':[_0xc3d9('0xe')],'type':_0xc3d9('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x573544,_0x74edfd,_0x98063a){var _0x5050b7=_0x137aaf[_0xc3d9('0x10')];var _0x36fdda=_0x573544[_0xc3d9('0x11')]({'plain':!![]});if(_0x36fdda[_0xc3d9('0x12')]['toLowerCase']()==='in'||_0x36fdda[_0xc3d9('0x12')]['toLowerCase']()===_0xc3d9('0x13')&&!_0x36fdda[_0xc3d9('0x14')]&&!_[_0xc3d9('0x15')](_0x36fdda['UserId'])){_0x5050b7[_0xc3d9('0x16')][_0xc3d9('0x17')]({'where':{'id':_0x36fdda['SmsInteractionId']}})['then'](function(_0x3571fa){if(_0x3571fa){_0x3571fa['update']({'lastMsgAt':_0x36fdda[_0xc3d9('0x18')],'lastMsgDirection':_0x36fdda[_0xc3d9('0x12')][_0xc3d9('0x19')]()});}})[_0xc3d9('0x1a')](function(_0x5b48f4){console['error'](_0x5b48f4);});}if(_0x36fdda['direction']===_0xc3d9('0x13')&&!_0x36fdda[_0xc3d9('0x14')]){var _0x15e429;_0x5050b7['SmsAccount'][_0xc3d9('0x1b')]({'where':{'id':_0x36fdda[_0xc3d9('0x1c')]},'raw':!![]})[_0xc3d9('0x1d')](function(_0x4056ed){_0x15e429=_0x4056ed;if(_0x15e429&&_0x15e429[_0xc3d9('0x1e')]){switch(_0x15e429[_0xc3d9('0x1e')]){case _0xc3d9('0x1f'):var _0x14d4ec=require('twilio');if(_0x15e429[_0xc3d9('0x20')]&&_0x15e429[_0xc3d9('0x21')]&&_0x15e429[_0xc3d9('0x22')]){var _0x4a4f76=new _0x14d4ec(_0x15e429[_0xc3d9('0x20')],_0x15e429[_0xc3d9('0x21')]);_0x4a4f76[_0xc3d9('0x23')][_0xc3d9('0x24')]({'body':_0x36fdda[_0xc3d9('0xe')],'to':_0x36fdda[_0xc3d9('0x22')],'from':_0x15e429['phone'],'statusCallback':_0x15e429[_0xc3d9('0x25')]+'/api/sms/messages/'+_0x36fdda['id']+'/status?token='+_0x15e429[_0xc3d9('0x26')]})[_0xc3d9('0x1d')](function(_0x2ee926){if(_0x2ee926[_0xc3d9('0x27')]){return _0x573544['update']({'messageId':_0x2ee926[_0xc3d9('0x27')]});}})[_0xc3d9('0x1a')](function(_0x30c357){logger[_0xc3d9('0x28')](_0xc3d9('0x29'),'afterCreate',_0xc3d9('0x1f'),util['inspect'](_0x30c357,{'showHidden':![],'depth':null}));});}else{logger[_0xc3d9('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc3d9('0x2a'),_0xc3d9('0x1f'),_0xc3d9('0x2b'));}break;case'skebby':var _0x5a7202=_0xc3d9('0x2c');if(_0x15e429[_0xc3d9('0x2d')]&&_0x15e429[_0xc3d9('0x2e')]){var _0x528326={'recipient':[_0x36fdda[_0xc3d9('0x22')]],'message':_0x36fdda[_0xc3d9('0xe')],'message_type':_0x15e429[_0xc3d9('0x2f')]};if(_0x15e429[_0xc3d9('0x2f')]&&_0x15e429[_0xc3d9('0x2f')]!=='SI'){_0x528326[_0xc3d9('0x30')]=_0x15e429[_0xc3d9('0x22')];}var _0x38345a={'url':_0x5a7202+_0xc3d9('0x31')+_0x15e429['username']+_0xc3d9('0x32')+_0x15e429[_0xc3d9('0x2e')],'method':_0xc3d9('0x33')};rp(_0x38345a)['then'](function(_0x4a703a){var _0x5aaab9=_0x4a703a[_0xc3d9('0x34')](';');var _0x118123={'user_key':_0x5aaab9[0x0],'session_key':_0x5aaab9[0x1]};_0x38345a={'url':_0x5a7202+'sms','method':_0xc3d9('0x35'),'headers':{'user_key':_0x118123[_0xc3d9('0x36')],'Session_key':_0x118123[_0xc3d9('0x37')]},'json':!![],'body':_0x528326};return rp(_0x38345a);})[_0xc3d9('0x1d')](function(_0x34e4f3){if(_0x34e4f3[_0xc3d9('0x38')]>=0x1){var _0x564041={'messageId':_0x34e4f3[_0xc3d9('0x39')]};if(_0x15e429['smsMethod']!=='GP'||!_0x15e429[_0xc3d9('0x3a')]){_0x564041[_0xc3d9('0x3b')]=!![];}return _0x573544[_0xc3d9('0x3c')](_0x564041);}else{return logger[_0xc3d9('0x28')](_0xc3d9('0x29'),_0xc3d9('0x2a'),_0xc3d9('0x3d'),util[_0xc3d9('0x3e')](_0x34e4f3,{'showHidden':![],'depth':null}));}})[_0xc3d9('0x1a')](function(_0x4cc424){return logger[_0xc3d9('0x28')](_0xc3d9('0x29'),_0xc3d9('0x2a'),_0xc3d9('0x3d'),util['inspect'](_0x4cc424,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc3d9('0x29'),'afterCreate',_0xc3d9('0x3d'),_0xc3d9('0x3f'));}break;case _0xc3d9('0x40'):if(_0x15e429[_0xc3d9('0x21')]){var _0x1b4b6a={'recipient':_0x36fdda[_0xc3d9('0x22')],'message':_0x36fdda[_0xc3d9('0xe')],'sender':_0x15e429[_0xc3d9('0x41')]||_0x15e429['phone'],'authorization':_0x15e429[_0xc3d9('0x21')]};var _0x74edfd={'method':_0xc3d9('0x35'),'uri':_0xc3d9('0x42'),'body':_0x1b4b6a,'json':!![]};rp(_0x74edfd)['then'](function(_0x40c95c){var _0xd2ad1d={'messageId':_0x40c95c[_0xc3d9('0x43')]};if(!_0x15e429[_0xc3d9('0x3a')]){_0xd2ad1d[_0xc3d9('0x3b')]=!![];}return _0x573544[_0xc3d9('0x3c')](_0xd2ad1d);})[_0xc3d9('0x1a')](function(_0x57f39e){logger['error'](_0xc3d9('0x29'),_0xc3d9('0x2a'),_0xc3d9('0x40'),util[_0xc3d9('0x3e')](_0x57f39e,{'showHidden':![],'depth':null}));});}else{logger[_0xc3d9('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','connectel',_0xc3d9('0x44'));}break;case'clicksend':if(_0x15e429[_0xc3d9('0x2d')]&&_0x15e429[_0xc3d9('0x2e')]){var _0x1b4b6a={'messages':[{'source':_0xc3d9('0x45'),'to':_0x36fdda[_0xc3d9('0x22')],'body':_0x36fdda[_0xc3d9('0xe')],'from':_0x15e429[_0xc3d9('0x41')]||_0x15e429[_0xc3d9('0x22')]}]};var _0x4146e1=util[_0xc3d9('0x46')]('%s:%s',_0x15e429[_0xc3d9('0x2d')],_0x15e429[_0xc3d9('0x2e')]);var _0x74edfd={'method':'POST','uri':_0xc3d9('0x47'),'body':_0x1b4b6a,'headers':{'Authorization':util['format'](_0xc3d9('0x48'),new Buffer(_0x4146e1)[_0xc3d9('0x49')](_0xc3d9('0x4a')))},'json':!![]};rp(_0x74edfd)[_0xc3d9('0x1d')](function(_0x45f54a){if(_0x45f54a[_0xc3d9('0x4b')]>=0xc8&&_0x45f54a['http_code']<=0xce){if(_0x45f54a[_0xc3d9('0x4c')]&&_0x45f54a[_0xc3d9('0x4c')][_0xc3d9('0x4d')]>0x0){var _0x20faa2=_[_0xc3d9('0x4e')](_0x45f54a[_0xc3d9('0x4c')][_0xc3d9('0x23')]);var _0x5ea872={'messageId':_0x20faa2['message_id']};if(!_0x15e429['deliveryReport']){_0x5ea872[_0xc3d9('0x3b')]=!![];}return _0x573544['update'](_0x5ea872);}else{logger['error'](_0xc3d9('0x29'),_0xc3d9('0x2a'),_0xc3d9('0x4f'),util[_0xc3d9('0x3e')](_0x45f54a,{'showHidden':![],'depth':null}));}}else{logger[_0xc3d9('0x28')](_0xc3d9('0x29'),'afterCreate',_0xc3d9('0x4f'),util[_0xc3d9('0x3e')](_0x45f54a,{'showHidden':![],'depth':null}));}})['catch'](function(_0x55ffdd){logger[_0xc3d9('0x28')](_0xc3d9('0x29'),_0xc3d9('0x2a'),_0xc3d9('0x4f'),util[_0xc3d9('0x3e')](_0x55ffdd,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc3d9('0x29'),_0xc3d9('0x2a'),_0xc3d9('0x4f'),_0xc3d9('0x3f'));}break;case _0xc3d9('0x50'):if(_0x15e429[_0xc3d9('0x51')]&&_0x15e429[_0xc3d9('0x21')]){var _0x1b4b6a={'dst':_0x36fdda[_0xc3d9('0x22')],'text':_0x36fdda[_0xc3d9('0xe')],'src':_0x15e429[_0xc3d9('0x41')]||_0x15e429['phone'],'url':_0x15e429['remote']+_0xc3d9('0x52')+_0x36fdda['id']+_0xc3d9('0x53')+_0x15e429[_0xc3d9('0x26')]};var _0x4146e1=util[_0xc3d9('0x46')](_0xc3d9('0x54'),_0x15e429[_0xc3d9('0x51')],_0x15e429[_0xc3d9('0x21')]);var _0x74edfd={'method':_0xc3d9('0x35'),'uri':util[_0xc3d9('0x46')](_0xc3d9('0x55'),_0x15e429['authId']),'body':_0x1b4b6a,'headers':{'Authorization':util[_0xc3d9('0x46')](_0xc3d9('0x48'),new Buffer(_0x4146e1)['toString']('base64'))},'json':!![]};rp(_0x74edfd)['then'](function(_0x22c9ce){var _0x6d933e={'messageId':_0x22c9ce[_0xc3d9('0x56')][0x0]};return _0x573544[_0xc3d9('0x3c')](_0x6d933e);})[_0xc3d9('0x1a')](function(_0x3d8533){logger[_0xc3d9('0x28')](_0xc3d9('0x29'),_0xc3d9('0x2a'),_0xc3d9('0x50'),util['inspect'](_0x3d8533,{'showHidden':![],'depth':null}));});}else{logger[_0xc3d9('0x28')](_0xc3d9('0x29'),_0xc3d9('0x2a'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xc3d9('0x57'):if(_0x15e429['username']&&_0x15e429[_0xc3d9('0x2e')]){if(_0x15e429[_0xc3d9('0x58')]){var _0x3440e4={'method':_0xc3d9('0x35'),'uri':_0x15e429[_0xc3d9('0x58')]+'/auth/1/session','body':{'username':_0x15e429[_0xc3d9('0x2d')],'password':_0x15e429[_0xc3d9('0x2e')]},'json':!![]};return rp(_0x3440e4)[_0xc3d9('0x1d')](function(_0xeb853){var _0x55a17e={'method':'POST','uri':_0x15e429[_0xc3d9('0x58')]+_0xc3d9('0x59'),'body':{'messages':[{'from':_0x15e429[_0xc3d9('0x22')],'destinations':[{'to':_0x36fdda[_0xc3d9('0x22')]}],'text':_0x36fdda[_0xc3d9('0xe')],'notifyUrl':_0x15e429[_0xc3d9('0x25')]+_0xc3d9('0x52')+_0x36fdda['id']+'/status?token='+_0x15e429['token'],'notifyContentType':_0xc3d9('0x5a'),'callbackData':_0x15e429['phone']+';'+_0x36fdda[_0xc3d9('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0xeb853[_0xc3d9('0x26')]},'json':!![]};return rp(_0x55a17e)[_0xc3d9('0x1d')](function(_0x4a64c1){if(_0x4a64c1[_0xc3d9('0x23')]){var _0x10adfe={'messageId':_0x4a64c1[_0xc3d9('0x23')][0x0][_0xc3d9('0xc')]};if(!_0x15e429[_0xc3d9('0x3a')]){_0x10adfe['read']=!![];}return _0x573544['update'](_0x10adfe);}else{return logger[_0xc3d9('0x28')](_0xc3d9('0x29'),'afterCreate','infobip',util['inspect'](_0x4a64c1,{'showHidden':![],'depth':null}));}});})[_0xc3d9('0x1a')](function(_0x292344){return logger[_0xc3d9('0x28')](_0xc3d9('0x29'),_0xc3d9('0x2a'),_0xc3d9('0x57'),util[_0xc3d9('0x3e')](_0x292344,{'showHidden':![],'depth':null}));});}else{logger[_0xc3d9('0x28')](_0xc3d9('0x29'),_0xc3d9('0x2a'),_0xc3d9('0x57'),_0xc3d9('0x5b'));}}else{logger[_0xc3d9('0x28')](_0xc3d9('0x29'),'afterCreate',_0xc3d9('0x57'),_0xc3d9('0x3f'));}break;case _0xc3d9('0x5c'):var _0x53b504=require(_0xc3d9('0x5d'));if(_0x15e429[_0xc3d9('0x5e')]){var _0x521875={};_0x521875[_0xc3d9('0x5f')]=_0x15e429[_0xc3d9('0x2d')];_0x521875[_0xc3d9('0x22')]=_0x36fdda[_0xc3d9('0x22')];_0x521875[_0xc3d9('0x30')]=_0x15e429[_0xc3d9('0x22')];_0x521875[_0xc3d9('0x60')]=_0x36fdda[_0xc3d9('0xe')];_0x521875[_0xc3d9('0x61')]=+new Date();var _0x584a14='';var _0x34170a='';var _0x358859=Object[_0xc3d9('0x62')](_0x521875);_0x358859[_0xc3d9('0x63')]();for(var _0x4544bc=0x0;_0x4544bc<_0x358859['length'];_0x4544bc++){if(_0x584a14!=''){_0x584a14+='&';}_0x584a14+=_0x358859[_0x4544bc]+'='+encodeURIComponent(_0x521875[_0x358859[_0x4544bc]]);_0x34170a+=_0x521875[_0x358859[_0x4544bc]];}_0x34170a+=_0x15e429['apiKey'];_0x34170a=_0x53b504[_0xc3d9('0x64')]('md5')['update'](_0x34170a)[_0xc3d9('0x65')](_0xc3d9('0x66'));if(_0x584a14!==''){_0x584a14+='&';}_0x584a14+='signature='+_0x34170a;var _0x38345a={'method':_0xc3d9('0x33'),'uri':_0x15e429['baseUrl']+_0xc3d9('0x67')+_0x584a14,'json':!![]};return rp(_0x38345a)[_0xc3d9('0x1d')](function(_0x535aad){var _0x7a4ff=Object[_0xc3d9('0x62')](_0x535aad);if(_0x535aad[_0x7a4ff[0x0]][_0xc3d9('0x28')]&&parseInt(_0x535aad[_0x7a4ff[0x0]]['error'])===0x0){var _0x2b6a92={'messageId':_0x535aad[_0x7a4ff[0x0]]['id_sms']};if(!_0x15e429['deliveryReport']){_0x2b6a92[_0xc3d9('0x3b')]=!![];}return _0x573544['update'](_0x2b6a92);}else{return logger[_0xc3d9('0x28')](_0xc3d9('0x29'),_0xc3d9('0x2a'),_0xc3d9('0x5c'),util[_0xc3d9('0x3e')](_0x535aad['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0xd884a2){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc3d9('0x2a'),_0xc3d9('0x5c'),util['inspect'](_0xd884a2,{'showHidden':![],'depth':null}));});}else{logger[_0xc3d9('0x28')](_0xc3d9('0x29'),_0xc3d9('0x2a'),_0xc3d9('0x5c'),_0xc3d9('0x68'));}break;case _0xc3d9('0x69'):if(_0x15e429[_0xc3d9('0x5e')]){var _0x486495={'method':'POST','uri':_0xc3d9('0x6a'),'headers':{'Authorization':_0x15e429[_0xc3d9('0x5e')]},'body':{'content':_0x36fdda[_0xc3d9('0xe')],'to':[_0x36fdda[_0xc3d9('0x22')]],'from':_0x15e429['phone'],'binary':![],'clientMessageId':_0xc3d9('0x6b'),'charset':_0xc3d9('0x6c')},'json':!![]};rp(_0x486495)['then'](function(_0x27a0db){if(!_0x27a0db[_0xc3d9('0x28')]){var _0x1cd5c4={'messageId':_0x27a0db[_0xc3d9('0x23')][0x0]['apiMessageId']};if(!_0x15e429['deliveryReport']){_0x1cd5c4[_0xc3d9('0x3b')]=!![];}return _0x573544[_0xc3d9('0x3c')](_0x1cd5c4);}else{return logger[_0xc3d9('0x28')](_0xc3d9('0x29'),_0xc3d9('0x2a'),_0xc3d9('0x69'),util[_0xc3d9('0x3e')](_0x27a0db['error'],{'showHidden':![],'depth':null}));}})[_0xc3d9('0x1a')](function(_0x2ab694){return logger[_0xc3d9('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc3d9('0x2a'),_0xc3d9('0x69'),util[_0xc3d9('0x3e')](_0x2ab694,{'showHidden':![],'depth':null}));});}else{logger[_0xc3d9('0x28')](_0xc3d9('0x29'),_0xc3d9('0x2a'),_0xc3d9('0x69'),'Missing\x20parameters:\x20apiKey');}break;case _0xc3d9('0x6d'):if(_0x15e429[_0xc3d9('0x2d')]&&_0x15e429[_0xc3d9('0x2e')]){var _0x4146e1=util[_0xc3d9('0x46')](_0xc3d9('0x54'),_0x15e429[_0xc3d9('0x2d')],_0x15e429[_0xc3d9('0x2e')]);var _0x74edfd={'method':_0xc3d9('0x35'),'uri':_0xc3d9('0x6e')+_0x15e429[_0xc3d9('0x6f')]+_0xc3d9('0x70'),'body':{'to':[_0x36fdda[_0xc3d9('0x22')]],'text':_0x36fdda['body'],'from':_0x15e429[_0xc3d9('0x22')],'applicationId':_0x15e429[_0xc3d9('0x71')]},'headers':{'Authorization':util[_0xc3d9('0x46')](_0xc3d9('0x48'),new Buffer(_0x4146e1)['toString'](_0xc3d9('0x4a')))},'json':!![]};rp(_0x74edfd)[_0xc3d9('0x1d')](function(_0x50d0b5){if(_0x50d0b5['id']){var _0x3f40f5={'messageId':_0x50d0b5['id']};return _0x573544['update'](_0x3f40f5);}else{logger[_0xc3d9('0x28')](_0xc3d9('0x29'),_0xc3d9('0x2a'),'bandwidth',util[_0xc3d9('0x3e')](_0x50d0b5,{'showHidden':![],'depth':null}));}})['catch'](function(_0x470510){logger['error'](_0xc3d9('0x29'),_0xc3d9('0x2a'),_0xc3d9('0x6d'),util[_0xc3d9('0x3e')](_0x470510,{'showHidden':![],'depth':null}));});}else{logger[_0xc3d9('0x28')](_0xc3d9('0x29'),_0xc3d9('0x2a'),_0xc3d9('0x6d'),_0xc3d9('0x3f'));}break;case'intelepeer':if(_0x15e429[_0xc3d9('0x5e')]){var _0x3ae9df={};var _0x38345a={'method':_0xc3d9('0x35'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x15e429[_0xc3d9('0x5e')],'Content-Type':_0xc3d9('0x5a')},'body':{'from':_0x15e429[_0xc3d9('0x22')],'to':_0x36fdda[_0xc3d9('0x22')],'text':_0x36fdda[_0xc3d9('0xe')]},'json':!![]};return rp(_0x38345a)[_0xc3d9('0x1d')](function(_0x297262){if(_0x297262[_0xc3d9('0x72')]==0xca){_0x3ae9df[_0xc3d9('0x73')]=_0x297262;var _0x38f8f1={'method':_0xc3d9('0x35'),'uri':_0xc3d9('0x74'),'headers':{'Authorization':_0xc3d9('0x75')+_0x15e429[_0xc3d9('0x5e')],'Content-Type':_0xc3d9('0x5a')},'body':{'refid':_0x3ae9df[_0xc3d9('0x73')][_0xc3d9('0x76')]},'json':!![]};return rp(_0x38f8f1)[_0xc3d9('0x1d')](function(_0x262598){_0x3ae9df[_0xc3d9('0x77')]=_0x262598;var _0x1c04c0={'messageId':_0x3ae9df[_0xc3d9('0x73')]['refid'],'read':!![]};return _0x573544[_0xc3d9('0x3c')](_0x1c04c0);});}else{return logger[_0xc3d9('0x28')](_0xc3d9('0x29'),'afterCreate',_0xc3d9('0x78'),util[_0xc3d9('0x3e')](_0x297262,{'showHidden':![],'depth':null}));}})[_0xc3d9('0x1a')](function(_0x3fe437){return logger[_0xc3d9('0x28')](_0xc3d9('0x29'),_0xc3d9('0x2a'),_0xc3d9('0x78'),util['inspect'](_0x3fe437,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc3d9('0x2a'),'intelepeer',_0xc3d9('0x79'));}break;}}})[_0xc3d9('0x7a')](function(){_0x98063a();});}else{_0x98063a();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index e6876a6..60af529 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 _0x4fc9=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsMessage,\x20%s,\x20%s','catch','CreateSmsMessage','SmsMessage','create','options','debug','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3d9d1e,_0x5d284a){var _0x58a4e2=function(_0x42d718){while(--_0x42d718){_0x3d9d1e['push'](_0x3d9d1e['shift']());}};_0x58a4e2(++_0x5d284a);}(_0x4fc9,0x89));var _0x94fc=function(_0x418226,_0x313434){_0x418226=_0x418226-0x0;var _0x1e4cf2=_0x4fc9[_0x418226];return _0x1e4cf2;};'use strict';var _=require(_0x94fc('0x0'));var util=require(_0x94fc('0x1'));var moment=require(_0x94fc('0x2'));var BPromise=require('bluebird');var rs=require(_0x94fc('0x3'));var fs=require('fs');var Redis=require(_0x94fc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x94fc('0x5'));var logger=require(_0x94fc('0x6'))('rpc');var config=require(_0x94fc('0x7'));var jayson=require(_0x94fc('0x8'));var client=jayson['client'][_0x94fc('0x9')]({'port':0x232a});config[_0x94fc('0xa')]=_[_0x94fc('0xb')](config['redis'],{'host':_0x94fc('0xc'),'port':0x18eb});var socket=require(_0x94fc('0xd'))(new Redis(config['redis']));require(_0x94fc('0xe'))['register'](socket);function respondWithRpcPromise(_0xc27014,_0x2fce54,_0xd7fc2a){return new BPromise(function(_0x46a1d3,_0x3c442e){return client['request'](_0xc27014,_0xd7fc2a)[_0x94fc('0xf')](function(_0x60080){logger[_0x94fc('0x10')]('SmsMessage,\x20%s,\x20%s',_0x2fce54,_0x94fc('0x11'));logger['debug'](_0x94fc('0x12'),_0x2fce54,_0x94fc('0x11'),JSON[_0x94fc('0x13')](_0x60080));if(_0x60080[_0x94fc('0x14')]){if(_0x60080[_0x94fc('0x14')]['code']===0x1f4){logger[_0x94fc('0x14')]('SmsMessage,\x20%s,\x20%s',_0x2fce54,_0x60080[_0x94fc('0x14')][_0x94fc('0x15')]);return _0x3c442e(_0x60080[_0x94fc('0x14')][_0x94fc('0x15')]);}logger[_0x94fc('0x14')](_0x94fc('0x16'),_0x2fce54,_0x60080[_0x94fc('0x14')][_0x94fc('0x15')]);return _0x46a1d3(_0x60080['error'][_0x94fc('0x15')]);}else{logger[_0x94fc('0x10')](_0x94fc('0x16'),_0x2fce54,_0x94fc('0x11'));_0x46a1d3(_0x60080['result']['message']);}})[_0x94fc('0x17')](function(_0x22657c){logger['error'](_0x94fc('0x16'),_0x2fce54,_0x22657c);_0x3c442e(_0x22657c);});});}exports[_0x94fc('0x18')]=function(_0x1eafc9){var _0x3cf871=this;return new Promise(function(_0x5b80fb,_0x1d3928){return db[_0x94fc('0x19')][_0x94fc('0x1a')](_0x1eafc9['body'],{'raw':_0x1eafc9[_0x94fc('0x1b')]?_0x1eafc9['options']['raw']===undefined?!![]:![]:!![]})[_0x94fc('0xf')](function(_0xbba30a){logger[_0x94fc('0x10')](_0x94fc('0x18'),_0x1eafc9);logger[_0x94fc('0x1c')](_0x94fc('0x18'),_0x1eafc9,JSON[_0x94fc('0x13')](_0xbba30a));_0x5b80fb(_0xbba30a);})[_0x94fc('0x17')](function(_0x2e56ee){logger[_0x94fc('0x14')](_0x94fc('0x18'),_0x2e56ee[_0x94fc('0x15')],_0x1eafc9);_0x1d3928(_0x3cf871[_0x94fc('0x14')](0x1f4,_0x2e56ee[_0x94fc('0x15')]));});});}; \ No newline at end of file +var _0xdacb=['defaults','localhost','socket.io-emitter','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis'];(function(_0x23428f,_0x288620){var _0x4a1f23=function(_0x4d1f1d){while(--_0x4d1f1d){_0x23428f['push'](_0x23428f['shift']());}};_0x4a1f23(++_0x288620);}(_0xdacb,0x1a8));var _0xbdac=function(_0x2d1a8e,_0x5382b8){_0x2d1a8e=_0x2d1a8e-0x0;var _0x5be882=_0xdacb[_0x2d1a8e];return _0x5be882;};'use strict';var _=require(_0xbdac('0x0'));var util=require(_0xbdac('0x1'));var moment=require('moment');var BPromise=require(_0xbdac('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdac('0x3'))['db'];var utils=require(_0xbdac('0x4'));var logger=require(_0xbdac('0x5'))(_0xbdac('0x6'));var config=require(_0xbdac('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbdac('0x8')]({'port':0x232a});config[_0xbdac('0x9')]=_[_0xbdac('0xa')](config[_0xbdac('0x9')],{'host':_0xbdac('0xb'),'port':0x18eb});var socket=require(_0xbdac('0xc'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xbdac('0xd')](socket);function respondWithRpcPromise(_0x467d0c,_0x1eafc6,_0x55d73a){return new BPromise(function(_0x21ae37,_0x4024c7){return client[_0xbdac('0xe')](_0x467d0c,_0x55d73a)[_0xbdac('0xf')](function(_0x451159){logger[_0xbdac('0x10')](_0xbdac('0x11'),_0x1eafc6,_0xbdac('0x12'));logger[_0xbdac('0x13')](_0xbdac('0x14'),_0x1eafc6,_0xbdac('0x12'),JSON['stringify'](_0x451159));if(_0x451159[_0xbdac('0x15')]){if(_0x451159[_0xbdac('0x15')]['code']===0x1f4){logger[_0xbdac('0x15')](_0xbdac('0x11'),_0x1eafc6,_0x451159[_0xbdac('0x15')][_0xbdac('0x16')]);return _0x4024c7(_0x451159[_0xbdac('0x15')][_0xbdac('0x16')]);}logger[_0xbdac('0x15')](_0xbdac('0x11'),_0x1eafc6,_0x451159[_0xbdac('0x15')]['message']);return _0x21ae37(_0x451159[_0xbdac('0x15')]['message']);}else{logger[_0xbdac('0x10')](_0xbdac('0x11'),_0x1eafc6,_0xbdac('0x12'));_0x21ae37(_0x451159[_0xbdac('0x17')]['message']);}})[_0xbdac('0x18')](function(_0x9470a6){logger['error'](_0xbdac('0x11'),_0x1eafc6,_0x9470a6);_0x4024c7(_0x9470a6);});});}exports[_0xbdac('0x19')]=function(_0x28bbe3){var _0x3c6f6e=this;return new Promise(function(_0xbb1b77,_0x194f13){return db[_0xbdac('0x1a')][_0xbdac('0x1b')](_0x28bbe3[_0xbdac('0x1c')],{'raw':_0x28bbe3[_0xbdac('0x1d')]?_0x28bbe3[_0xbdac('0x1d')][_0xbdac('0x1e')]===undefined?!![]:![]:!![]})[_0xbdac('0xf')](function(_0x2edd16){logger['info']('CreateSmsMessage',_0x28bbe3);logger[_0xbdac('0x13')]('CreateSmsMessage',_0x28bbe3,JSON['stringify'](_0x2edd16));_0xbb1b77(_0x2edd16);})[_0xbdac('0x18')](function(_0x4a769d){logger[_0xbdac('0x15')](_0xbdac('0x19'),_0x4a769d[_0xbdac('0x16')],_0x28bbe3);_0x194f13(_0x3c6f6e['error'](0x1f4,_0x4a769d[_0xbdac('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 6ffbca6..0a70cb7 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 _0xa051=['update','emit','register','length','smsMessage:','./smsMessage.events','save','remove'];(function(_0x39324f,_0x3e1483){var _0x3ca913=function(_0x2335b6){while(--_0x2335b6){_0x39324f['push'](_0x39324f['shift']());}};_0x3ca913(++_0x3e1483);}(_0xa051,0xf5));var _0x1a05=function(_0x4f00fb,_0x8df1a1){_0x4f00fb=_0x4f00fb-0x0;var _0x41d061=_0xa051[_0x4f00fb];return _0x41d061;};'use strict';var SmsMessageEvents=require(_0x1a05('0x0'));var events=[_0x1a05('0x1'),_0x1a05('0x2'),_0x1a05('0x3')];function createListener(_0x5c7db6,_0x455319){return function(_0x2fa408){_0x455319[_0x1a05('0x4')](_0x5c7db6,_0x2fa408);};}function removeListener(_0x2758e8,_0x40f775){return function(){SmsMessageEvents['removeListener'](_0x2758e8,_0x40f775);};}exports[_0x1a05('0x5')]=function(_0x4ad561){for(var _0x402b30=0x0,_0x2250d0=events[_0x1a05('0x6')];_0x402b30<_0x2250d0;_0x402b30++){var _0x1163cf=events[_0x402b30];var _0x51654e=createListener(_0x1a05('0x7')+_0x1163cf,_0x4ad561);SmsMessageEvents['on'](_0x1163cf,_0x51654e);}}; \ No newline at end of file +var _0x37a3=['length','smsMessage:','./smsMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x5a5ea2,_0x55b4ba){var _0x22245d=function(_0x2b4e70){while(--_0x2b4e70){_0x5a5ea2['push'](_0x5a5ea2['shift']());}};_0x22245d(++_0x55b4ba);}(_0x37a3,0x1b2));var _0x337a=function(_0x2a279d,_0x57abbc){_0x2a279d=_0x2a279d-0x0;var _0x766143=_0x37a3[_0x2a279d];return _0x766143;};'use strict';var SmsMessageEvents=require(_0x337a('0x0'));var events=[_0x337a('0x1'),_0x337a('0x2'),_0x337a('0x3')];function createListener(_0xc66196,_0x5bcc5b){return function(_0x34c1dc){_0x5bcc5b[_0x337a('0x4')](_0xc66196,_0x34c1dc);};}function removeListener(_0x43b80a,_0x376d0c){return function(){SmsMessageEvents[_0x337a('0x5')](_0x43b80a,_0x376d0c);};}exports[_0x337a('0x6')]=function(_0x46158e){for(var _0x288faf=0x0,_0x5ef9f1=events[_0x337a('0x7')];_0x288faf<_0x5ef9f1;_0x288faf++){var _0x49f766=events[_0x288faf];var _0x17ff2f=createListener(_0x337a('0x8')+_0x49f766,_0x46158e);SmsMessageEvents['on'](_0x49f766,_0x17ff2f);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 933421d..3c1772d 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 _0x0f34=['/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe'];(function(_0x57606a,_0x55edcf){var _0x323b68=function(_0x3990ea){while(--_0x3990ea){_0x57606a['push'](_0x57606a['shift']());}};_0x323b68(++_0x55edcf);}(_0x0f34,0x154));var _0x40f3=function(_0x45b1ad,_0x215b03){_0x45b1ad=_0x45b1ad-0x0;var _0x3d5696=_0x0f34[_0x45b1ad];return _0x3d5696;};'use strict';var multer=require(_0x40f3('0x0'));var util=require(_0x40f3('0x1'));var path=require('path');var timeout=require(_0x40f3('0x2'));var express=require(_0x40f3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x40f3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x40f3('0x5'));var controller=require(_0x40f3('0x6'));router[_0x40f3('0x7')]('/',auth[_0x40f3('0x8')](),controller[_0x40f3('0x9')]);router['get'](_0x40f3('0xa'),auth[_0x40f3('0x8')](),controller['describe']);router[_0x40f3('0x7')]('/:id',auth[_0x40f3('0x8')](),controller['show']);router['get'](_0x40f3('0xb'),auth['isAuthenticated'](),controller[_0x40f3('0xc')]);router[_0x40f3('0x7')](_0x40f3('0xd'),auth['isAuthenticated'](),controller[_0x40f3('0xe')]);router[_0x40f3('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x40f3('0xf')]);router[_0x40f3('0x10')]('/',auth[_0x40f3('0x8')](),controller[_0x40f3('0x11')]);router[_0x40f3('0x10')](_0x40f3('0xd'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0x40f3('0x12'),auth[_0x40f3('0x8')](),controller[_0x40f3('0x13')]);router[_0x40f3('0x14')]('/:id',auth[_0x40f3('0x8')](),controller[_0x40f3('0x15')]);router[_0x40f3('0x16')]('/:id',auth[_0x40f3('0x8')](),controller[_0x40f3('0x17')]);router[_0x40f3('0x16')]('/:id/teams',auth[_0x40f3('0x8')](),controller[_0x40f3('0x18')]);router[_0x40f3('0x16')](_0x40f3('0x12'),auth[_0x40f3('0x8')](),controller[_0x40f3('0x19')]);module[_0x40f3('0x1a')]=router; \ No newline at end of file +var _0xce1b=['/:id/users','getAgents','post','addTeams','addAgents','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','isAuthenticated','get','/:id','show','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x49b653,_0x549808){var _0x2641f6=function(_0x44656b){while(--_0x44656b){_0x49b653['push'](_0x49b653['shift']());}};_0x2641f6(++_0x549808);}(_0xce1b,0x176));var _0xbce1=function(_0x2059b3,_0x437d71){_0x2059b3=_0x2059b3-0x0;var _0xaaf662=_0xce1b[_0x2059b3];return _0xaaf662;};'use strict';var multer=require(_0xbce1('0x0'));var util=require(_0xbce1('0x1'));var path=require('path');var timeout=require(_0xbce1('0x2'));var express=require('express');var router=express[_0xbce1('0x3')]();var fs_extra=require(_0xbce1('0x4'));var auth=require(_0xbce1('0x5'));var interaction=require(_0xbce1('0x6'));var config=require('../../config/environment');var controller=require(_0xbce1('0x7'));router['get']('/',auth[_0xbce1('0x8')](),controller['index']);router[_0xbce1('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xbce1('0x9')](_0xbce1('0xa'),auth[_0xbce1('0x8')](),controller[_0xbce1('0xb')]);router['get'](_0xbce1('0xc'),auth['isAuthenticated'](),controller[_0xbce1('0xd')]);router['get'](_0xbce1('0xe'),auth[_0xbce1('0x8')](),controller[_0xbce1('0xf')]);router['get'](_0xbce1('0x10'),auth[_0xbce1('0x8')](),controller[_0xbce1('0x11')]);router[_0xbce1('0x12')]('/',auth[_0xbce1('0x8')](),controller['create']);router[_0xbce1('0x12')](_0xbce1('0xe'),auth[_0xbce1('0x8')](),controller[_0xbce1('0x13')]);router['post'](_0xbce1('0x10'),auth['isAuthenticated'](),controller[_0xbce1('0x14')]);router['put'](_0xbce1('0xa'),auth[_0xbce1('0x8')](),controller['update']);router[_0xbce1('0x15')](_0xbce1('0xa'),auth['isAuthenticated'](),controller[_0xbce1('0x16')]);router[_0xbce1('0x15')]('/:id/teams',auth[_0xbce1('0x8')](),controller[_0xbce1('0x17')]);router[_0xbce1('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0xbce1('0x18')]);module[_0xbce1('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 5683fd5..f3fa1cd 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 _0xb605=['INTEGER','rrmemory','sequelize','STRING','name'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xb605,0x70));var _0x5b60=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0xb605[_0x30cc1a];return _0xb3f18f;};'use strict';var Sequelize=require(_0x5b60('0x0'));module['exports']={'name':{'type':Sequelize[_0x5b60('0x1')],'unique':_0x5b60('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x5b60('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5b60('0x4'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x2b0f=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x2b0f,0x18e));var _0xf2b0=function(_0x1f6714,_0x3ae5e2){_0x1f6714=_0x1f6714-0x0;var _0x82f71e=_0x2b0f[_0x1f6714];return _0x82f71e;};'use strict';var Sequelize=require(_0xf2b0('0x0'));module[_0xf2b0('0x1')]={'name':{'type':Sequelize[_0xf2b0('0x2')],'unique':_0xf2b0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf2b0('0x2')]},'timeout':{'type':Sequelize[_0xf2b0('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf2b0('0x5')](_0xf2b0('0x6'),_0xf2b0('0x7'),_0xf2b0('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 23f18ff..29b7313 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 _0x71d8=['findOrCreate','forEach','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','offset','undefined','count','set','json','apply','save','update','destroy','get','SmsQueues','UserProfileResource','then','stack','name','index','map','SmsQueue','rawAttributes','fieldName','key','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','body','describe','getMembers','findOne','UserSmsQueue','pick','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','createdAt','format','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap'];(function(_0x6004da,_0x19df50){var _0x4af1dc=function(_0x5122da){while(--_0x5122da){_0x6004da['push'](_0x6004da['shift']());}};_0x4af1dc(++_0x19df50);}(_0x71d8,0xb0));var _0x871d=function(_0x8ff4bc,_0x36bf13){_0x8ff4bc=_0x8ff4bc-0x0;var _0x3630e6=_0x71d8[_0x8ff4bc];return _0x3630e6;};'use strict';var emlformat=require(_0x871d('0x0'));var rimraf=require(_0x871d('0x1'));var zipdir=require(_0x871d('0x2'));var jsonpatch=require(_0x871d('0x3'));var rp=require(_0x871d('0x4'));var moment=require(_0x871d('0x5'));var BPromise=require(_0x871d('0x6'));var Mustache=require(_0x871d('0x7'));var util=require(_0x871d('0x8'));var path=require(_0x871d('0x9'));var sox=require(_0x871d('0xa'));var csv=require('to-csv');var ejs=require(_0x871d('0xb'));var fs=require('fs');var fs_extra=require(_0x871d('0xc'));var _=require(_0x871d('0xd'));var squel=require(_0x871d('0xe'));var crypto=require(_0x871d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x871d('0x10'));var toCsv=require(_0x871d('0x11'));var querystring=require(_0x871d('0x12'));var Papa=require(_0x871d('0x13'));var Redis=require(_0x871d('0x14'));var authService=require(_0x871d('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x871d('0x16'));var hardwareService=require(_0x871d('0x17'));var logger=require(_0x871d('0x18'))(_0x871d('0x19'));var utils=require(_0x871d('0x1a'));var config=require(_0x871d('0x1b'));var licenseUtil=require(_0x871d('0x1c'));var db=require(_0x871d('0x1d'))['db'];config[_0x871d('0x1e')]=_[_0x871d('0x1f')](config['redis'],{'host':_0x871d('0x20'),'port':0x18eb});var socket=require(_0x871d('0x21'))(new Redis(config['redis']));require(_0x871d('0x22'))[_0x871d('0x23')](socket);function respondWithStatusCode(_0x882bf1,_0x5a1ce1){_0x5a1ce1=_0x5a1ce1||0xcc;return function(_0x36d422){if(_0x36d422){return _0x882bf1[_0x871d('0x24')](_0x5a1ce1);}return _0x882bf1[_0x871d('0x25')](_0x5a1ce1)[_0x871d('0x26')]();};}function respondWithResult(_0x41a98d,_0x136f2a){_0x136f2a=_0x136f2a||0xc8;return function(_0x53c444){if(_0x53c444){return _0x41a98d[_0x871d('0x25')](_0x136f2a)['json'](_0x53c444);}};}function respondWithFilteredResult(_0x229a99,_0x37f0ca){return function(_0x1eeb7f){if(_0x1eeb7f){var _0x12068d=typeof _0x37f0ca[_0x871d('0x27')]===_0x871d('0x28')&&typeof _0x37f0ca['limit']===_0x871d('0x28');var _0x47f288=_0x1eeb7f[_0x871d('0x29')];var _0x322945=_0x12068d?0x0:_0x37f0ca[_0x871d('0x27')];var _0x33b6dc=_0x12068d?_0x1eeb7f[_0x871d('0x29')]:_0x37f0ca[_0x871d('0x27')]+_0x37f0ca['limit'];var _0x588b83;if(_0x33b6dc>=_0x47f288){_0x33b6dc=_0x47f288;_0x588b83=0xc8;}else{_0x588b83=0xce;}_0x229a99[_0x871d('0x25')](_0x588b83);return _0x229a99[_0x871d('0x2a')]('Content-Range',_0x322945+'-'+_0x33b6dc+'/'+_0x47f288)[_0x871d('0x2b')](_0x1eeb7f);}return null;};}function patchUpdates(_0x2ff62d){return function(_0x474a27){try{jsonpatch[_0x871d('0x2c')](_0x474a27,_0x2ff62d,!![]);}catch(_0x15798d){return BPromise['reject'](_0x15798d);}return _0x474a27[_0x871d('0x2d')]();};}function saveUpdates(_0x17598d,_0x5822d1){return function(_0x30b815){if(_0x30b815){return _0x30b815[_0x871d('0x2e')](_0x17598d)['then'](function(_0x45cd50){return _0x45cd50;});}return null;};}function removeEntity(_0x2225c0,_0x4bc990){return function(_0x5ac3bd){if(_0x5ac3bd){return _0x5ac3bd[_0x871d('0x2f')]()['then'](function(){var _0x1ca670=_0x5ac3bd[_0x871d('0x30')]({'plain':!![]});var _0x325f09=_0x871d('0x31');return db[_0x871d('0x32')]['destroy']({'where':{'type':_0x325f09,'resourceId':_0x1ca670['id']}})[_0x871d('0x33')](function(){return _0x5ac3bd;});})[_0x871d('0x33')](function(){_0x2225c0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6e303e,_0xd47e01){return function(_0x18ceae){if(!_0x18ceae){_0x6e303e[_0x871d('0x24')](0x194);}return _0x18ceae;};}function handleError(_0x458682,_0x110400){_0x110400=_0x110400||0x1f4;return function(_0x344f76){logger['error'](_0x344f76[_0x871d('0x34')]);if(_0x344f76[_0x871d('0x35')]){delete _0x344f76[_0x871d('0x35')];}_0x458682[_0x871d('0x25')](_0x110400)['send'](_0x344f76);};}exports[_0x871d('0x36')]=function(_0x2b8cef,_0x2317dd){var _0x3f4b6c={},_0x2cf194={},_0x468ef1={'count':0x0,'rows':[]};var _0x3a6bea=_[_0x871d('0x37')](db[_0x871d('0x38')][_0x871d('0x39')],function(_0xa6c86a){return{'name':_0xa6c86a[_0x871d('0x3a')],'type':_0xa6c86a['type'][_0x871d('0x3b')]};});_0x2cf194['model']=_['map'](_0x3a6bea,'name');_0x2cf194['query']=_['keys'](_0x2b8cef[_0x871d('0x3c')]);_0x2cf194['filters']=_[_0x871d('0x3d')](_0x2cf194['model'],_0x2cf194[_0x871d('0x3c')]);_0x3f4b6c[_0x871d('0x3e')]=_[_0x871d('0x3d')](_0x2cf194[_0x871d('0x3f')],qs[_0x871d('0x40')](_0x2b8cef['query']['fields']));_0x3f4b6c['attributes']=_0x3f4b6c['attributes'][_0x871d('0x41')]?_0x3f4b6c[_0x871d('0x3e')]:_0x2cf194[_0x871d('0x3f')];if(!_0x2b8cef[_0x871d('0x3c')][_0x871d('0x42')](_0x871d('0x43'))){_0x3f4b6c[_0x871d('0x44')]=qs[_0x871d('0x44')](_0x2b8cef[_0x871d('0x3c')][_0x871d('0x44')]);_0x3f4b6c[_0x871d('0x27')]=qs[_0x871d('0x27')](_0x2b8cef['query'][_0x871d('0x27')]);}_0x3f4b6c[_0x871d('0x45')]=qs[_0x871d('0x46')](_0x2b8cef[_0x871d('0x3c')][_0x871d('0x46')]);_0x3f4b6c[_0x871d('0x47')]=qs[_0x871d('0x48')](_['pick'](_0x2b8cef['query'],_0x2cf194['filters']),_0x3a6bea);if(_0x2b8cef['query']['filter']){_0x3f4b6c[_0x871d('0x47')]=_[_0x871d('0x49')](_0x3f4b6c[_0x871d('0x47')],{'$or':_['map'](_0x3a6bea,function(_0xe28984){if(_0xe28984['type']!==_0x871d('0x4a')){var _0x225994={};_0x225994[_0xe28984['name']]={'$like':'%'+_0x2b8cef[_0x871d('0x3c')][_0x871d('0x4b')]+'%'};return _0x225994;}})});}_0x3f4b6c=_['merge']({},_0x3f4b6c,_0x2b8cef[_0x871d('0x4c')]);var _0x194e94={'where':_0x3f4b6c[_0x871d('0x47')]};return db[_0x871d('0x38')]['count'](_0x194e94)[_0x871d('0x33')](function(_0x443514){_0x468ef1['count']=_0x443514;if(_0x2b8cef[_0x871d('0x3c')]['includeAll']){_0x3f4b6c[_0x871d('0x4d')]=[{'all':!![]}];}return db[_0x871d('0x38')][_0x871d('0x4e')](_0x3f4b6c);})[_0x871d('0x33')](function(_0x14f685){_0x468ef1[_0x871d('0x4f')]=_0x14f685;return _0x468ef1;})[_0x871d('0x33')](respondWithFilteredResult(_0x2317dd,_0x3f4b6c))[_0x871d('0x50')](handleError(_0x2317dd,null));};exports[_0x871d('0x51')]=function(_0x275fd2,_0x305675){var _0x9c0e34={'raw':!![],'where':{'id':_0x275fd2[_0x871d('0x52')]['id']}},_0x35d10d={};_0x35d10d['model']=_[_0x871d('0x53')](db[_0x871d('0x38')][_0x871d('0x39')]);_0x35d10d[_0x871d('0x3c')]=_['keys'](_0x275fd2['query']);_0x35d10d[_0x871d('0x48')]=_[_0x871d('0x3d')](_0x35d10d['model'],_0x35d10d[_0x871d('0x3c')]);_0x9c0e34[_0x871d('0x3e')]=_[_0x871d('0x3d')](_0x35d10d[_0x871d('0x3f')],qs[_0x871d('0x40')](_0x275fd2[_0x871d('0x3c')]['fields']));_0x9c0e34[_0x871d('0x3e')]=_0x9c0e34[_0x871d('0x3e')][_0x871d('0x41')]?_0x9c0e34[_0x871d('0x3e')]:_0x35d10d['model'];if(_0x275fd2[_0x871d('0x3c')][_0x871d('0x54')]){_0x9c0e34[_0x871d('0x4d')]=[{'all':!![]}];}_0x9c0e34=_[_0x871d('0x49')]({},_0x9c0e34,_0x275fd2['options']);return db['SmsQueue'][_0x871d('0x55')](_0x9c0e34)[_0x871d('0x33')](handleEntityNotFound(_0x305675,null))[_0x871d('0x33')](respondWithResult(_0x305675,null))[_0x871d('0x50')](handleError(_0x305675,null));};exports[_0x871d('0x56')]=function(_0x407013,_0xf0abc7){return db[_0x871d('0x38')][_0x871d('0x56')](_0x407013['body'],{})[_0x871d('0x33')](function(_0x8ce5ce){var _0x52f4c0=_0x407013[_0x871d('0x57')][_0x871d('0x30')]({'plain':!![]});if(!_0x52f4c0)throw new Error(_0x871d('0x58'));if(_0x52f4c0[_0x871d('0x59')]==='user'){var _0xfe0d1=_0x8ce5ce[_0x871d('0x30')]({'plain':!![]});var _0x4d8032=_0x871d('0x31');return db[_0x871d('0x5a')][_0x871d('0x55')]({'where':{'name':_0x4d8032,'userProfileId':_0x52f4c0[_0x871d('0x5b')]},'raw':!![]})[_0x871d('0x33')](function(_0x59a68f){if(_0x59a68f&&_0x59a68f['autoAssociation']===0x0){return db[_0x871d('0x32')][_0x871d('0x56')]({'name':_0xfe0d1['name'],'resourceId':_0xfe0d1['id'],'type':_0x59a68f[_0x871d('0x35')],'sectionId':_0x59a68f['id']},{})['then'](function(){return _0x8ce5ce;});}else{return _0x8ce5ce;}})['catch'](function(_0x289287){logger[_0x871d('0x5c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x289287);throw _0x289287;});}return _0x8ce5ce;})['then'](respondWithResult(_0xf0abc7,0xc9))[_0x871d('0x50')](handleError(_0xf0abc7,null));};exports[_0x871d('0x2e')]=function(_0x3c3f8d,_0x3ea3ce){if(_0x3c3f8d['body']['id']){delete _0x3c3f8d[_0x871d('0x5d')]['id'];}return db[_0x871d('0x38')][_0x871d('0x55')]({'where':{'id':_0x3c3f8d['params']['id']}})[_0x871d('0x33')](handleEntityNotFound(_0x3ea3ce,null))[_0x871d('0x33')](saveUpdates(_0x3c3f8d[_0x871d('0x5d')],null))[_0x871d('0x33')](respondWithResult(_0x3ea3ce,null))['catch'](handleError(_0x3ea3ce,null));};exports[_0x871d('0x2f')]=function(_0x1f3a9a,_0x571221){return db[_0x871d('0x38')]['find']({'where':{'id':_0x1f3a9a[_0x871d('0x52')]['id']}})[_0x871d('0x33')](handleEntityNotFound(_0x571221,null))[_0x871d('0x33')](removeEntity(_0x571221,null))[_0x871d('0x50')](handleError(_0x571221,null));};exports['describe']=function(_0x4047d3,_0x5f4912){return db[_0x871d('0x38')][_0x871d('0x5e')]()[_0x871d('0x33')](respondWithResult(_0x5f4912,null))[_0x871d('0x50')](handleError(_0x5f4912,null));};exports[_0x871d('0x5f')]=function(_0x51ee23,_0xb5b6dd,_0x1008ba){var _0x5533a1={'raw':!![],'where':{}},_0x491b1c={},_0x5a393f;return db['SmsQueue'][_0x871d('0x60')]({'where':{'id':_0x51ee23[_0x871d('0x52')]['id']}})[_0x871d('0x33')](handleEntityNotFound(_0xb5b6dd,null))['then'](function(_0x29a519){if(_0x29a519){_0x5a393f=_0x29a519[_0x871d('0x30')]({'plain':!![]});_0x491b1c['model']=_[_0x871d('0x53')](db[_0x871d('0x61')]['rawAttributes']);_0x491b1c['query']=_[_0x871d('0x53')](_0x51ee23[_0x871d('0x3c')]);_0x491b1c[_0x871d('0x48')]=_['intersection'](_0x491b1c[_0x871d('0x3f')],_0x491b1c[_0x871d('0x3c')]);_0x5533a1[_0x871d('0x3e')]=_[_0x871d('0x3d')](_0x491b1c['model'],qs[_0x871d('0x40')](_0x51ee23[_0x871d('0x3c')][_0x871d('0x40')]));_0x5533a1['attributes']=_0x5533a1['attributes']['length']?_0x5533a1[_0x871d('0x3e')]:_0x491b1c[_0x871d('0x3f')];if(!_0x51ee23[_0x871d('0x3c')]['hasOwnProperty'](_0x871d('0x43'))){_0x5533a1['limit']=qs[_0x871d('0x44')](_0x51ee23[_0x871d('0x3c')]['limit']);_0x5533a1[_0x871d('0x27')]=qs['offset'](_0x51ee23[_0x871d('0x3c')][_0x871d('0x27')]);}_0x5533a1['order']=qs['sort'](_0x51ee23[_0x871d('0x3c')][_0x871d('0x46')]);_0x5533a1['where']=qs['filters'](_[_0x871d('0x62')](_0x51ee23[_0x871d('0x3c')],_0x491b1c[_0x871d('0x48')]));_0x5533a1[_0x871d('0x47')][_0x871d('0x63')]=_0x29a519['id'];if(_0x51ee23[_0x871d('0x3c')][_0x871d('0x4b')]){_0x5533a1['where']=_[_0x871d('0x49')](_0x5533a1[_0x871d('0x47')],{'$or':_[_0x871d('0x37')](_0x5533a1[_0x871d('0x3e')],function(_0x4372e3){var _0x3bcda4={};_0x3bcda4[_0x4372e3]={'$like':'%'+_0x51ee23[_0x871d('0x3c')][_0x871d('0x4b')]+'%'};return _0x3bcda4;})});}_0x5533a1=_[_0x871d('0x49')]({},_0x5533a1,_0x51ee23[_0x871d('0x4c')]);return db[_0x871d('0x61')]['findAll'](_0x5533a1);}})[_0x871d('0x33')](function(_0x285efa){if(_0x285efa){return db[_0x871d('0x64')][_0x871d('0x65')]({'where':{'id':_[_0x871d('0x37')](_0x285efa,_0x871d('0x66')),'role':_0x871d('0x67')},'attributes':['id','name',_0x871d('0x68'),'updatedAt',_0x871d('0x69')]});}})[_0x871d('0x33')](function(_0x402999){if(_0x402999){return{'count':_0x402999[_0x871d('0x29')],'rows':_[_0x871d('0x37')](_0x402999[_0x871d('0x4f')],function(_0x51552a){return{'membername':_0x51552a[_0x871d('0x35')],'UserId':_0x51552a['id'],'queue_name':_0x5a393f['name'],'SmsQueueId':_0x5a393f['id'],'interface':util[_0x871d('0x6a')]('%s/%s',_0x871d('0x6b'),_0x51552a[_0x871d('0x35')]),'penalty':0x0,'paused':_0x51552a['smsPause'],'createdAt':_0x51552a[_0x871d('0x69')],'updatedAt':_0x51552a[_0x871d('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x871d('0x33')](respondWithFilteredResult(_0xb5b6dd,_0x5533a1))[_0x871d('0x50')](handleError(_0xb5b6dd,null));};exports[_0x871d('0x6d')]=function(_0x38c8fc,_0x2a00b2,_0x3f23ff){var _0xa57906={};var _0x521a11={};var _0xa788b6;var _0x4ecf57;return db['SmsQueue'][_0x871d('0x60')]({'where':{'id':_0x38c8fc[_0x871d('0x52')]['id']}})['then'](handleEntityNotFound(_0x2a00b2,null))[_0x871d('0x33')](function(_0x309f4f){if(_0x309f4f){_0xa788b6=_0x309f4f;_0x521a11[_0x871d('0x3f')]=_[_0x871d('0x53')](db[_0x871d('0x6e')][_0x871d('0x39')]);_0x521a11[_0x871d('0x3c')]=_[_0x871d('0x53')](_0x38c8fc[_0x871d('0x3c')]);_0x521a11['filters']=_['intersection'](_0x521a11[_0x871d('0x3f')],_0x521a11[_0x871d('0x3c')]);_0xa57906[_0x871d('0x3e')]=_[_0x871d('0x3d')](_0x521a11[_0x871d('0x3f')],qs[_0x871d('0x40')](_0x38c8fc[_0x871d('0x3c')][_0x871d('0x40')]));_0xa57906['attributes']=_0xa57906[_0x871d('0x3e')][_0x871d('0x41')]?_0xa57906[_0x871d('0x3e')]:_0x521a11[_0x871d('0x3f')];_0xa57906['order']=qs[_0x871d('0x46')](_0x38c8fc[_0x871d('0x3c')][_0x871d('0x46')]);_0xa57906[_0x871d('0x47')]=qs[_0x871d('0x48')](_[_0x871d('0x62')](_0x38c8fc[_0x871d('0x3c')],_0x521a11['filters']));if(_0x38c8fc[_0x871d('0x3c')][_0x871d('0x4b')]){_0xa57906[_0x871d('0x47')]=_[_0x871d('0x49')](_0xa57906[_0x871d('0x47')],{'$or':_['map'](_0xa57906[_0x871d('0x3e')],function(_0x4d8e3b){var _0x16f255={};_0x16f255[_0x4d8e3b]={'$like':'%'+_0x38c8fc[_0x871d('0x3c')][_0x871d('0x4b')]+'%'};return _0x16f255;})});}_0xa57906=_[_0x871d('0x49')]({},_0xa57906,_0x38c8fc[_0x871d('0x4c')]);return _0xa788b6[_0x871d('0x6d')](_0xa57906);}})[_0x871d('0x33')](function(_0x149b19){if(_0x149b19){_0x4ecf57=_0x149b19['length'];if(!_0x38c8fc[_0x871d('0x3c')][_0x871d('0x42')](_0x871d('0x43'))){_0xa57906[_0x871d('0x44')]=qs[_0x871d('0x44')](_0x38c8fc['query']['limit']);_0xa57906[_0x871d('0x27')]=qs[_0x871d('0x27')](_0x38c8fc[_0x871d('0x3c')]['offset']);}return _0xa788b6[_0x871d('0x6d')](_0xa57906);}})[_0x871d('0x33')](function(_0x5a0060){if(_0x5a0060){return _0x5a0060?{'count':_0x4ecf57,'rows':_0x5a0060}:null;}})['then'](respondWithResult(_0x2a00b2,null))[_0x871d('0x50')](handleError(_0x2a00b2,null));};exports[_0x871d('0x6f')]=function(_0x3ad9f3,_0xdf3ef4,_0x1afbc1){var _0x1e548a=_0x3ad9f3[_0x871d('0x5d')][_0x871d('0x70')];return db[_0x871d('0x6e')][_0x871d('0x4e')]({'where':{'id':_0x1e548a},'attributes':['id'],'include':[{'model':db['User'],'as':_0x871d('0x71'),'attributes':['id','name',_0x871d('0x72'),_0x871d('0x73'),_0x871d('0x74')],'raw':!![]}]})[_0x871d('0x33')](function(_0x4cbf7d){if(_0x4cbf7d){var _0x115ee8=_[_0x871d('0x75')](_0x4cbf7d,function(_0x24d0c0){var _0x14ad9e=_0x24d0c0[_0x871d('0x30')]({'plain':!![]});return _0x14ad9e[_0x871d('0x71')];});return db[_0x871d('0x38')]['find']({'where':{'id':_0x3ad9f3[_0x871d('0x52')]['id']}})[_0x871d('0x33')](function(_0x2b0730){return db['sequelize']['transaction'](function(_0x23bf0d){return _0x2b0730[_0x871d('0x6f')](_0x1e548a,{'transaction':_0x23bf0d})[_0x871d('0x33')](function(){return BPromise['each'](_0x115ee8,function(_0xafcfa4){return db[_0x871d('0x61')][_0x871d('0x76')]({'where':{'UserId':_0xafcfa4['id'],'SmsQueueId':_0x3ad9f3[_0x871d('0x52')]['id']},'transaction':_0x23bf0d});});})[_0x871d('0x33')](function(){_0x115ee8[_0x871d('0x77')](function(_0x39ac57){socket['emit'](_0x871d('0x78'),{'UserId':_0x39ac57['id'],'SmsQueueId':_0x2b0730['id']});});});});});}})[_0x871d('0x33')](respondWithStatusCode(_0xdf3ef4,null))[_0x871d('0x50')](handleError(_0xdf3ef4,null));};exports[_0x871d('0x79')]=function(_0x314ce2,_0x2f40b7,_0x1885cc){return db[_0x871d('0x6e')][_0x871d('0x4e')]({'where':{'id':_0x314ce2[_0x871d('0x3c')]['ids']},'attributes':['id'],'include':[{'model':db[_0x871d('0x64')],'as':_0x871d('0x71'),'attributes':['id'],'raw':!![]}]})[_0x871d('0x33')](handleEntityNotFound(_0x2f40b7,null))[_0x871d('0x33')](function(_0x2ce3e3){var _0x3df27f=_[_0x871d('0x37')](_0x2ce3e3,'id');var _0x404da2=[];var _0x111b1b=[];var _0x3ddadc=squel[_0x871d('0x7a')]();_0x3ddadc[_0x871d('0x7b')](_0x871d('0x7c'))[_0x871d('0x7d')](_0x871d('0x7e'),'tq')[_0x871d('0x7f')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x871d('0x47')](_0x871d('0x80'),_0x314ce2['params']['id']);for(var _0x4e1fac=0x0;_0x4e1fac<_0x2ce3e3[_0x871d('0x41')];_0x4e1fac+=0x1){let _0x58f036=_0x2ce3e3[_0x4e1fac];for(var _0x128b3f=0x0;_0x128b3f<_0x58f036['Agents'][_0x871d('0x41')];_0x128b3f+=0x1){let _0x107927=_0x58f036[_0x871d('0x71')][_0x128b3f];var _0xc17008=_0x3ddadc[_0x871d('0x81')]();_0xc17008[_0x871d('0x47')](_0x871d('0x82'),_0x107927['id']);_0x111b1b['push'](db[_0x871d('0x83')][_0x871d('0x3c')](_0xc17008['toString'](),{'type':db['sequelize'][_0x871d('0x84')][_0x871d('0x85')]})[_0x871d('0x33')](function(_0xc658af){if(_0xc658af[_0x871d('0x41')]===0x1){return _0x107927['id'];}else{var _0x593835=_[_0x871d('0x86')](_[_0x871d('0x37')](_0xc658af,_0x871d('0x87')),function(_0x2d3dd7){return _[_0x871d('0x88')](_0x3df27f,_0x2d3dd7);});if(_0x593835){return _0x107927['id'];}}}));}}return BPromise[_0x871d('0x89')](_0x111b1b)['then'](function(_0x3633e7){_0x404da2=_(_0x404da2)['union'](_0x3633e7)[_0x871d('0x8a')]()[_0x871d('0x8b')]();return db[_0x871d('0x38')][_0x871d('0x55')]({'where':{'id':_0x314ce2[_0x871d('0x52')]['id']}})[_0x871d('0x33')](function(_0x24b926){return db['sequelize']['transaction'](function(_0x470637){return _0x24b926[_0x871d('0x79')](_0x314ce2[_0x871d('0x3c')][_0x871d('0x70')],{'transaction':_0x470637})[_0x871d('0x33')](function(){if(!_['isEmpty'](_0x404da2)){return _0x24b926[_0x871d('0x8c')](_0x404da2,{'transaction':_0x470637});}})[_0x871d('0x33')](function(){_0x404da2[_0x871d('0x77')](function(_0x1c4866){socket[_0x871d('0x8d')](_0x871d('0x8e'),{'UserId':_0x1c4866,'SmsQueueId':_0x24b926['id']});});});});});});})[_0x871d('0x33')](respondWithStatusCode(_0x2f40b7,null))[_0x871d('0x50')](handleError(_0x2f40b7,null));};exports[_0x871d('0x8f')]=function(_0x2e7d12,_0x1ed97a,_0xbc264d){return db['SmsQueue'][_0x871d('0x55')]({'where':{'id':_0x2e7d12[_0x871d('0x52')]['id']}})[_0x871d('0x33')](handleEntityNotFound(_0x1ed97a,null))['then'](function(_0x21e7f2){if(_0x21e7f2){return _0x21e7f2['addAgents'](_0x2e7d12[_0x871d('0x5d')]['ids'],_[_0x871d('0x90')](_0x2e7d12['body'],[_0x871d('0x70'),'id'])||{})[_0x871d('0x91')](function(_0x2440ed){for(var _0x5bc881=0x0;_0x5bc881<_0x2e7d12[_0x871d('0x5d')][_0x871d('0x70')][_0x871d('0x41')];_0x5bc881+=0x1){socket[_0x871d('0x8d')]('userSmsQueue:save',{'UserId':Number(_0x2e7d12[_0x871d('0x5d')][_0x871d('0x70')][_0x5bc881]),'SmsQueueId':Number(_0x2e7d12[_0x871d('0x52')]['id'])});}return _0x2440ed;});}})[_0x871d('0x33')](respondWithResult(_0x1ed97a,null))[_0x871d('0x50')](handleError(_0x1ed97a,null));};exports['removeAgents']=function(_0x2bede8,_0x27444d,_0x2f966f){return db[_0x871d('0x38')]['find']({'where':{'id':_0x2bede8[_0x871d('0x52')]['id']}})['then'](handleEntityNotFound(_0x27444d,null))['then'](function(_0x574d41){if(_0x574d41){return _0x574d41[_0x871d('0x8c')](_0x2bede8[_0x871d('0x3c')][_0x871d('0x70')])[_0x871d('0x33')](function(){if(_['isArray'](_0x2bede8[_0x871d('0x3c')][_0x871d('0x70')])){for(var _0x45c316=0x0;_0x45c316<_0x2bede8['query'][_0x871d('0x70')][_0x871d('0x41')];_0x45c316+=0x1){socket[_0x871d('0x8d')]('userSmsQueue:remove',{'UserId':Number(_0x2bede8['query'][_0x871d('0x70')][_0x45c316]),'SmsQueueId':Number(_0x2bede8[_0x871d('0x52')]['id'])});}}else{socket[_0x871d('0x8d')](_0x871d('0x8e'),{'UserId':Number(_0x2bede8['query'][_0x871d('0x70')]),'SmsQueueId':Number(_0x2bede8['params']['id'])});}});}})[_0x871d('0x33')](respondWithStatusCode(_0x27444d,null))['catch'](handleError(_0x27444d,null));};exports['getAgents']=function(_0x193471,_0x10db9b,_0x5184c8){var _0x1ecbdb={};var _0x2d3ea5={};var _0x1941e7;var _0x556541;return db[_0x871d('0x38')][_0x871d('0x60')]({'where':{'id':_0x193471[_0x871d('0x52')]['id']}})[_0x871d('0x33')](handleEntityNotFound(_0x10db9b,null))[_0x871d('0x33')](function(_0x2dbdfc){if(_0x2dbdfc){_0x1941e7=_0x2dbdfc;_0x2d3ea5['model']=_[_0x871d('0x53')](db[_0x871d('0x64')][_0x871d('0x39')]);_0x2d3ea5[_0x871d('0x3c')]=_['keys'](_0x193471['query']);_0x2d3ea5[_0x871d('0x48')]=_['intersection'](_0x2d3ea5[_0x871d('0x3f')],_0x2d3ea5[_0x871d('0x3c')]);_0x1ecbdb['attributes']=_[_0x871d('0x3d')](_0x2d3ea5[_0x871d('0x3f')],qs[_0x871d('0x40')](_0x193471[_0x871d('0x3c')][_0x871d('0x40')]));_0x1ecbdb[_0x871d('0x3e')]=_0x1ecbdb[_0x871d('0x3e')][_0x871d('0x41')]?_0x1ecbdb[_0x871d('0x3e')]:_0x2d3ea5[_0x871d('0x3f')];_0x1ecbdb[_0x871d('0x45')]=qs[_0x871d('0x46')](_0x193471[_0x871d('0x3c')][_0x871d('0x46')]);_0x1ecbdb['where']=qs[_0x871d('0x48')](_[_0x871d('0x62')](_0x193471[_0x871d('0x3c')],_0x2d3ea5[_0x871d('0x48')]));if(_0x193471['query'][_0x871d('0x4b')]){_0x1ecbdb[_0x871d('0x47')]=_[_0x871d('0x49')](_0x1ecbdb[_0x871d('0x47')],{'$or':_['map'](_0x1ecbdb['attributes'],function(_0x522ff5){var _0x5e7e9b={};_0x5e7e9b[_0x522ff5]={'$like':'%'+_0x193471[_0x871d('0x3c')][_0x871d('0x4b')]+'%'};return _0x5e7e9b;})});}_0x1ecbdb=_['merge']({},_0x1ecbdb,_0x193471[_0x871d('0x4c')]);return _0x1941e7[_0x871d('0x92')](_0x1ecbdb);}})[_0x871d('0x33')](function(_0x3b606c){if(_0x3b606c){_0x556541=_0x3b606c[_0x871d('0x41')];if(!_0x193471[_0x871d('0x3c')][_0x871d('0x42')](_0x871d('0x43'))){_0x1ecbdb[_0x871d('0x44')]=qs[_0x871d('0x44')](_0x193471['query']['limit']);_0x1ecbdb['offset']=qs[_0x871d('0x27')](_0x193471[_0x871d('0x3c')][_0x871d('0x27')]);}return _0x1941e7[_0x871d('0x92')](_0x1ecbdb);}})[_0x871d('0x33')](function(_0x12822d){if(_0x12822d){return _0x12822d?{'count':_0x556541,'rows':_0x12822d}:null;}})[_0x871d('0x33')](respondWithResult(_0x10db9b,null))[_0x871d('0x50')](handleError(_0x10db9b,null));}; \ No newline at end of file +var _0x8e49=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','UserProfileResource','destroy','error','stack','name','send','index','map','SmsQueue','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','userProfileId','autoAssociation','describe','getMembers','findOne','UserSmsQueue','pick','SmsQueueId','filter','User','findAndCountAll','UserId','smsPause','createdAt','format','%s/%s','updatedAt','getTeams','Team','order','ids','voicePause','interface','flatMap','Agents','sequelize','addTeams','each','findOrCreate','emit','userSmsQueue:save','removeTeams','select','field','from','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','SELECT','every','TeamId','union','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x4604ad,_0x2c516e){var _0x3ed8ef=function(_0x2cb13e){while(--_0x2cb13e){_0x4604ad['push'](_0x4604ad['shift']());}};_0x3ed8ef(++_0x2c516e);}(_0x8e49,0x7d));var _0x98e4=function(_0x2feb53,_0x264ef7){_0x2feb53=_0x2feb53-0x0;var _0x5700ee=_0x8e49[_0x2feb53];return _0x5700ee;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x98e4('0x0'));var jsonpatch=require(_0x98e4('0x1'));var rp=require(_0x98e4('0x2'));var moment=require(_0x98e4('0x3'));var BPromise=require(_0x98e4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x98e4('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x98e4('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x98e4('0x7'));var squel=require(_0x98e4('0x8'));var crypto=require(_0x98e4('0x9'));var jsforce=require(_0x98e4('0xa'));var deskjs=require(_0x98e4('0xb'));var toCsv=require(_0x98e4('0xc'));var querystring=require(_0x98e4('0xd'));var Papa=require(_0x98e4('0xe'));var Redis=require(_0x98e4('0xf'));var authService=require(_0x98e4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98e4('0x11'));var logger=require(_0x98e4('0x12'))(_0x98e4('0x13'));var utils=require(_0x98e4('0x14'));var config=require(_0x98e4('0x15'));var licenseUtil=require(_0x98e4('0x16'));var db=require(_0x98e4('0x17'))['db'];config[_0x98e4('0x18')]=_[_0x98e4('0x19')](config['redis'],{'host':_0x98e4('0x1a'),'port':0x18eb});var socket=require(_0x98e4('0x1b'))(new Redis(config[_0x98e4('0x18')]));require('./smsQueue.socket')[_0x98e4('0x1c')](socket);function respondWithStatusCode(_0x5ce589,_0x56cff7){_0x56cff7=_0x56cff7||0xcc;return function(_0x587f66){if(_0x587f66){return _0x5ce589[_0x98e4('0x1d')](_0x56cff7);}return _0x5ce589[_0x98e4('0x1e')](_0x56cff7)[_0x98e4('0x1f')]();};}function respondWithResult(_0x2a4b8f,_0x4e82aa){_0x4e82aa=_0x4e82aa||0xc8;return function(_0xe08148){if(_0xe08148){return _0x2a4b8f['status'](_0x4e82aa)[_0x98e4('0x20')](_0xe08148);}};}function respondWithFilteredResult(_0x4f380a,_0x1e19df){return function(_0x1b221d){if(_0x1b221d){var _0xf8d252=typeof _0x1e19df[_0x98e4('0x21')]===_0x98e4('0x22')&&typeof _0x1e19df[_0x98e4('0x23')]===_0x98e4('0x22');var _0x59e94c=_0x1b221d[_0x98e4('0x24')];var _0x5f54a7=_0xf8d252?0x0:_0x1e19df['offset'];var _0xff8345=_0xf8d252?_0x1b221d[_0x98e4('0x24')]:_0x1e19df[_0x98e4('0x21')]+_0x1e19df[_0x98e4('0x23')];var _0x5c691f;if(_0xff8345>=_0x59e94c){_0xff8345=_0x59e94c;_0x5c691f=0xc8;}else{_0x5c691f=0xce;}_0x4f380a[_0x98e4('0x1e')](_0x5c691f);return _0x4f380a[_0x98e4('0x25')](_0x98e4('0x26'),_0x5f54a7+'-'+_0xff8345+'/'+_0x59e94c)[_0x98e4('0x20')](_0x1b221d);}return null;};}function patchUpdates(_0x318249){return function(_0x45f7c6){try{jsonpatch['apply'](_0x45f7c6,_0x318249,!![]);}catch(_0x223c9a){return BPromise[_0x98e4('0x27')](_0x223c9a);}return _0x45f7c6[_0x98e4('0x28')]();};}function saveUpdates(_0x5dc429,_0x599fc7){return function(_0x570b5b){if(_0x570b5b){return _0x570b5b[_0x98e4('0x29')](_0x5dc429)['then'](function(_0x3479e2){return _0x3479e2;});}return null;};}function removeEntity(_0x3b33ef,_0x17ee3f){return function(_0x5cdb3c){if(_0x5cdb3c){return _0x5cdb3c['destroy']()[_0x98e4('0x2a')](function(){var _0x246950=_0x5cdb3c['get']({'plain':!![]});var _0xbb1d35='SmsQueues';return db[_0x98e4('0x2b')][_0x98e4('0x2c')]({'where':{'type':_0xbb1d35,'resourceId':_0x246950['id']}})['then'](function(){return _0x5cdb3c;});})[_0x98e4('0x2a')](function(){_0x3b33ef['status'](0xcc)[_0x98e4('0x1f')]();});}};}function handleEntityNotFound(_0xbfe039,_0x14c4cf){return function(_0x3861e2){if(!_0x3861e2){_0xbfe039['sendStatus'](0x194);}return _0x3861e2;};}function handleError(_0x3d1b87,_0x3f687b){_0x3f687b=_0x3f687b||0x1f4;return function(_0x412569){logger[_0x98e4('0x2d')](_0x412569[_0x98e4('0x2e')]);if(_0x412569['name']){delete _0x412569[_0x98e4('0x2f')];}_0x3d1b87['status'](_0x3f687b)[_0x98e4('0x30')](_0x412569);};}exports[_0x98e4('0x31')]=function(_0x5e34c7,_0x17889e){var _0x29b56b={},_0x31c1cb={},_0x4f44b0={'count':0x0,'rows':[]};var _0x12d5ac=_[_0x98e4('0x32')](db[_0x98e4('0x33')][_0x98e4('0x34')],function(_0x2be52e){return{'name':_0x2be52e['fieldName'],'type':_0x2be52e[_0x98e4('0x35')][_0x98e4('0x36')]};});_0x31c1cb[_0x98e4('0x37')]=_[_0x98e4('0x32')](_0x12d5ac,_0x98e4('0x2f'));_0x31c1cb['query']=_[_0x98e4('0x38')](_0x5e34c7[_0x98e4('0x39')]);_0x31c1cb[_0x98e4('0x3a')]=_[_0x98e4('0x3b')](_0x31c1cb['model'],_0x31c1cb[_0x98e4('0x39')]);_0x29b56b['attributes']=_['intersection'](_0x31c1cb[_0x98e4('0x37')],qs[_0x98e4('0x3c')](_0x5e34c7['query'][_0x98e4('0x3c')]));_0x29b56b[_0x98e4('0x3d')]=_0x29b56b[_0x98e4('0x3d')]['length']?_0x29b56b[_0x98e4('0x3d')]:_0x31c1cb['model'];if(!_0x5e34c7[_0x98e4('0x39')][_0x98e4('0x3e')](_0x98e4('0x3f'))){_0x29b56b[_0x98e4('0x23')]=qs[_0x98e4('0x23')](_0x5e34c7[_0x98e4('0x39')]['limit']);_0x29b56b[_0x98e4('0x21')]=qs[_0x98e4('0x21')](_0x5e34c7[_0x98e4('0x39')][_0x98e4('0x21')]);}_0x29b56b['order']=qs[_0x98e4('0x40')](_0x5e34c7[_0x98e4('0x39')]['sort']);_0x29b56b[_0x98e4('0x41')]=qs[_0x98e4('0x3a')](_['pick'](_0x5e34c7[_0x98e4('0x39')],_0x31c1cb[_0x98e4('0x3a')]),_0x12d5ac);if(_0x5e34c7[_0x98e4('0x39')]['filter']){_0x29b56b[_0x98e4('0x41')]=_[_0x98e4('0x42')](_0x29b56b[_0x98e4('0x41')],{'$or':_['map'](_0x12d5ac,function(_0x441eae){if(_0x441eae['type']!=='VIRTUAL'){var _0x3af567={};_0x3af567[_0x441eae['name']]={'$like':'%'+_0x5e34c7[_0x98e4('0x39')]['filter']+'%'};return _0x3af567;}})});}_0x29b56b=_[_0x98e4('0x42')]({},_0x29b56b,_0x5e34c7[_0x98e4('0x43')]);var _0x32d75b={'where':_0x29b56b[_0x98e4('0x41')]};return db[_0x98e4('0x33')][_0x98e4('0x24')](_0x32d75b)[_0x98e4('0x2a')](function(_0x5a0c04){_0x4f44b0['count']=_0x5a0c04;if(_0x5e34c7[_0x98e4('0x39')][_0x98e4('0x44')]){_0x29b56b[_0x98e4('0x45')]=[{'all':!![]}];}return db[_0x98e4('0x33')][_0x98e4('0x46')](_0x29b56b);})[_0x98e4('0x2a')](function(_0x1cf00b){_0x4f44b0[_0x98e4('0x47')]=_0x1cf00b;return _0x4f44b0;})[_0x98e4('0x2a')](respondWithFilteredResult(_0x17889e,_0x29b56b))[_0x98e4('0x48')](handleError(_0x17889e,null));};exports[_0x98e4('0x49')]=function(_0x1d898f,_0x2040c1){var _0xb7b512={'raw':!![],'where':{'id':_0x1d898f[_0x98e4('0x4a')]['id']}},_0x296fd0={};_0x296fd0['model']=_[_0x98e4('0x38')](db[_0x98e4('0x33')][_0x98e4('0x34')]);_0x296fd0[_0x98e4('0x39')]=_[_0x98e4('0x38')](_0x1d898f[_0x98e4('0x39')]);_0x296fd0['filters']=_[_0x98e4('0x3b')](_0x296fd0[_0x98e4('0x37')],_0x296fd0['query']);_0xb7b512['attributes']=_[_0x98e4('0x3b')](_0x296fd0[_0x98e4('0x37')],qs[_0x98e4('0x3c')](_0x1d898f[_0x98e4('0x39')]['fields']));_0xb7b512[_0x98e4('0x3d')]=_0xb7b512[_0x98e4('0x3d')][_0x98e4('0x4b')]?_0xb7b512[_0x98e4('0x3d')]:_0x296fd0[_0x98e4('0x37')];if(_0x1d898f[_0x98e4('0x39')][_0x98e4('0x44')]){_0xb7b512['include']=[{'all':!![]}];}_0xb7b512=_[_0x98e4('0x42')]({},_0xb7b512,_0x1d898f[_0x98e4('0x43')]);return db[_0x98e4('0x33')][_0x98e4('0x4c')](_0xb7b512)[_0x98e4('0x2a')](handleEntityNotFound(_0x2040c1,null))[_0x98e4('0x2a')](respondWithResult(_0x2040c1,null))[_0x98e4('0x48')](handleError(_0x2040c1,null));};exports[_0x98e4('0x4d')]=function(_0x36f969,_0x9d4c79){return db[_0x98e4('0x33')][_0x98e4('0x4d')](_0x36f969[_0x98e4('0x4e')],{})[_0x98e4('0x2a')](function(_0xb5af63){var _0x4a366c=_0x36f969[_0x98e4('0x4f')][_0x98e4('0x50')]({'plain':!![]});if(!_0x4a366c)throw new Error(_0x98e4('0x51'));if(_0x4a366c[_0x98e4('0x52')]===_0x98e4('0x4f')){var _0x26ad1d=_0xb5af63[_0x98e4('0x50')]({'plain':!![]});var _0x462d1b=_0x98e4('0x53');return db['UserProfileSection'][_0x98e4('0x4c')]({'where':{'name':_0x462d1b,'userProfileId':_0x4a366c[_0x98e4('0x54')]},'raw':!![]})[_0x98e4('0x2a')](function(_0x504f97){if(_0x504f97&&_0x504f97[_0x98e4('0x55')]===0x0){return db[_0x98e4('0x2b')]['create']({'name':_0x26ad1d[_0x98e4('0x2f')],'resourceId':_0x26ad1d['id'],'type':_0x504f97[_0x98e4('0x2f')],'sectionId':_0x504f97['id']},{})[_0x98e4('0x2a')](function(){return _0xb5af63;});}else{return _0xb5af63;}})[_0x98e4('0x48')](function(_0x356bc6){logger[_0x98e4('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x356bc6);throw _0x356bc6;});}return _0xb5af63;})[_0x98e4('0x2a')](respondWithResult(_0x9d4c79,0xc9))[_0x98e4('0x48')](handleError(_0x9d4c79,null));};exports[_0x98e4('0x29')]=function(_0x280ab4,_0x409508){if(_0x280ab4[_0x98e4('0x4e')]['id']){delete _0x280ab4[_0x98e4('0x4e')]['id'];}return db['SmsQueue'][_0x98e4('0x4c')]({'where':{'id':_0x280ab4['params']['id']}})[_0x98e4('0x2a')](handleEntityNotFound(_0x409508,null))[_0x98e4('0x2a')](saveUpdates(_0x280ab4[_0x98e4('0x4e')],null))['then'](respondWithResult(_0x409508,null))['catch'](handleError(_0x409508,null));};exports[_0x98e4('0x2c')]=function(_0xdb4dca,_0x12cc49){return db[_0x98e4('0x33')][_0x98e4('0x4c')]({'where':{'id':_0xdb4dca[_0x98e4('0x4a')]['id']}})[_0x98e4('0x2a')](handleEntityNotFound(_0x12cc49,null))[_0x98e4('0x2a')](removeEntity(_0x12cc49,null))[_0x98e4('0x48')](handleError(_0x12cc49,null));};exports[_0x98e4('0x56')]=function(_0x12b0ab,_0x56b592){return db[_0x98e4('0x33')][_0x98e4('0x56')]()[_0x98e4('0x2a')](respondWithResult(_0x56b592,null))['catch'](handleError(_0x56b592,null));};exports[_0x98e4('0x57')]=function(_0x4173ea,_0x1a9ceb,_0x47f743){var _0x4442dc={'raw':!![],'where':{}},_0x482014={},_0x50b265;return db['SmsQueue'][_0x98e4('0x58')]({'where':{'id':_0x4173ea[_0x98e4('0x4a')]['id']}})[_0x98e4('0x2a')](handleEntityNotFound(_0x1a9ceb,null))[_0x98e4('0x2a')](function(_0x549336){if(_0x549336){_0x50b265=_0x549336[_0x98e4('0x50')]({'plain':!![]});_0x482014[_0x98e4('0x37')]=_['keys'](db[_0x98e4('0x59')][_0x98e4('0x34')]);_0x482014[_0x98e4('0x39')]=_[_0x98e4('0x38')](_0x4173ea[_0x98e4('0x39')]);_0x482014[_0x98e4('0x3a')]=_[_0x98e4('0x3b')](_0x482014[_0x98e4('0x37')],_0x482014['query']);_0x4442dc[_0x98e4('0x3d')]=_[_0x98e4('0x3b')](_0x482014[_0x98e4('0x37')],qs[_0x98e4('0x3c')](_0x4173ea['query'][_0x98e4('0x3c')]));_0x4442dc[_0x98e4('0x3d')]=_0x4442dc[_0x98e4('0x3d')]['length']?_0x4442dc['attributes']:_0x482014[_0x98e4('0x37')];if(!_0x4173ea[_0x98e4('0x39')][_0x98e4('0x3e')](_0x98e4('0x3f'))){_0x4442dc[_0x98e4('0x23')]=qs['limit'](_0x4173ea[_0x98e4('0x39')][_0x98e4('0x23')]);_0x4442dc['offset']=qs[_0x98e4('0x21')](_0x4173ea[_0x98e4('0x39')][_0x98e4('0x21')]);}_0x4442dc['order']=qs[_0x98e4('0x40')](_0x4173ea[_0x98e4('0x39')][_0x98e4('0x40')]);_0x4442dc[_0x98e4('0x41')]=qs['filters'](_[_0x98e4('0x5a')](_0x4173ea[_0x98e4('0x39')],_0x482014[_0x98e4('0x3a')]));_0x4442dc['where'][_0x98e4('0x5b')]=_0x549336['id'];if(_0x4173ea[_0x98e4('0x39')]['filter']){_0x4442dc[_0x98e4('0x41')]=_[_0x98e4('0x42')](_0x4442dc[_0x98e4('0x41')],{'$or':_[_0x98e4('0x32')](_0x4442dc[_0x98e4('0x3d')],function(_0x5bf4fa){var _0x296391={};_0x296391[_0x5bf4fa]={'$like':'%'+_0x4173ea[_0x98e4('0x39')][_0x98e4('0x5c')]+'%'};return _0x296391;})});}_0x4442dc=_[_0x98e4('0x42')]({},_0x4442dc,_0x4173ea[_0x98e4('0x43')]);return db['UserSmsQueue'][_0x98e4('0x46')](_0x4442dc);}})[_0x98e4('0x2a')](function(_0x13bfde){if(_0x13bfde){return db[_0x98e4('0x5d')][_0x98e4('0x5e')]({'where':{'id':_[_0x98e4('0x32')](_0x13bfde,_0x98e4('0x5f')),'role':'agent'},'attributes':['id',_0x98e4('0x2f'),_0x98e4('0x60'),'updatedAt',_0x98e4('0x61')]});}})[_0x98e4('0x2a')](function(_0x428a5c){if(_0x428a5c){return{'count':_0x428a5c[_0x98e4('0x24')],'rows':_['map'](_0x428a5c[_0x98e4('0x47')],function(_0x50beab){return{'membername':_0x50beab[_0x98e4('0x2f')],'UserId':_0x50beab['id'],'queue_name':_0x50b265[_0x98e4('0x2f')],'SmsQueueId':_0x50b265['id'],'interface':util[_0x98e4('0x62')](_0x98e4('0x63'),'SIP',_0x50beab[_0x98e4('0x2f')]),'penalty':0x0,'paused':_0x50beab[_0x98e4('0x60')],'createdAt':_0x50beab[_0x98e4('0x61')],'updatedAt':_0x50beab[_0x98e4('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x98e4('0x2a')](respondWithFilteredResult(_0x1a9ceb,_0x4442dc))['catch'](handleError(_0x1a9ceb,null));};exports[_0x98e4('0x65')]=function(_0x3bab99,_0x30a257,_0x4eac55){var _0x36cc90={};var _0x22b03f={};var _0x333e29;var _0xd2741f;return db[_0x98e4('0x33')]['findOne']({'where':{'id':_0x3bab99[_0x98e4('0x4a')]['id']}})[_0x98e4('0x2a')](handleEntityNotFound(_0x30a257,null))['then'](function(_0x26bed8){if(_0x26bed8){_0x333e29=_0x26bed8;_0x22b03f[_0x98e4('0x37')]=_[_0x98e4('0x38')](db[_0x98e4('0x66')][_0x98e4('0x34')]);_0x22b03f[_0x98e4('0x39')]=_['keys'](_0x3bab99['query']);_0x22b03f[_0x98e4('0x3a')]=_[_0x98e4('0x3b')](_0x22b03f[_0x98e4('0x37')],_0x22b03f[_0x98e4('0x39')]);_0x36cc90[_0x98e4('0x3d')]=_[_0x98e4('0x3b')](_0x22b03f[_0x98e4('0x37')],qs[_0x98e4('0x3c')](_0x3bab99['query']['fields']));_0x36cc90[_0x98e4('0x3d')]=_0x36cc90[_0x98e4('0x3d')]['length']?_0x36cc90[_0x98e4('0x3d')]:_0x22b03f[_0x98e4('0x37')];_0x36cc90[_0x98e4('0x67')]=qs[_0x98e4('0x40')](_0x3bab99[_0x98e4('0x39')][_0x98e4('0x40')]);_0x36cc90[_0x98e4('0x41')]=qs['filters'](_[_0x98e4('0x5a')](_0x3bab99['query'],_0x22b03f[_0x98e4('0x3a')]));if(_0x3bab99['query'][_0x98e4('0x5c')]){_0x36cc90[_0x98e4('0x41')]=_[_0x98e4('0x42')](_0x36cc90[_0x98e4('0x41')],{'$or':_[_0x98e4('0x32')](_0x36cc90[_0x98e4('0x3d')],function(_0xcf078e){var _0x440655={};_0x440655[_0xcf078e]={'$like':'%'+_0x3bab99[_0x98e4('0x39')][_0x98e4('0x5c')]+'%'};return _0x440655;})});}_0x36cc90=_[_0x98e4('0x42')]({},_0x36cc90,_0x3bab99[_0x98e4('0x43')]);return _0x333e29[_0x98e4('0x65')](_0x36cc90);}})[_0x98e4('0x2a')](function(_0x2ffada){if(_0x2ffada){_0xd2741f=_0x2ffada[_0x98e4('0x4b')];if(!_0x3bab99[_0x98e4('0x39')][_0x98e4('0x3e')](_0x98e4('0x3f'))){_0x36cc90['limit']=qs['limit'](_0x3bab99[_0x98e4('0x39')][_0x98e4('0x23')]);_0x36cc90[_0x98e4('0x21')]=qs['offset'](_0x3bab99[_0x98e4('0x39')]['offset']);}return _0x333e29[_0x98e4('0x65')](_0x36cc90);}})['then'](function(_0x43c35e){if(_0x43c35e){return _0x43c35e?{'count':_0xd2741f,'rows':_0x43c35e}:null;}})[_0x98e4('0x2a')](respondWithResult(_0x30a257,null))['catch'](handleError(_0x30a257,null));};exports['addTeams']=function(_0x1398fa,_0x376eee,_0x12fb9f){var _0x7c6175=_0x1398fa[_0x98e4('0x4e')][_0x98e4('0x68')];return db[_0x98e4('0x66')][_0x98e4('0x46')]({'where':{'id':_0x7c6175},'attributes':['id'],'include':[{'model':db[_0x98e4('0x5d')],'as':'Agents','attributes':['id',_0x98e4('0x2f'),'online',_0x98e4('0x69'),_0x98e4('0x6a')],'raw':!![]}]})[_0x98e4('0x2a')](function(_0x3e7d86){if(_0x3e7d86){var _0x2dd5ab=_[_0x98e4('0x6b')](_0x3e7d86,function(_0x34402e){var _0x407727=_0x34402e[_0x98e4('0x50')]({'plain':!![]});return _0x407727[_0x98e4('0x6c')];});return db[_0x98e4('0x33')][_0x98e4('0x4c')]({'where':{'id':_0x1398fa['params']['id']}})[_0x98e4('0x2a')](function(_0x268435){return db[_0x98e4('0x6d')]['transaction'](function(_0x35fc4d){return _0x268435[_0x98e4('0x6e')](_0x7c6175,{'transaction':_0x35fc4d})[_0x98e4('0x2a')](function(){return BPromise[_0x98e4('0x6f')](_0x2dd5ab,function(_0x518d88){return db['UserSmsQueue'][_0x98e4('0x70')]({'where':{'UserId':_0x518d88['id'],'SmsQueueId':_0x1398fa[_0x98e4('0x4a')]['id']},'transaction':_0x35fc4d});});})[_0x98e4('0x2a')](function(){_0x2dd5ab['forEach'](function(_0x14279a){socket[_0x98e4('0x71')](_0x98e4('0x72'),{'UserId':_0x14279a['id'],'SmsQueueId':_0x268435['id']});});});});});}})['then'](respondWithStatusCode(_0x376eee,null))[_0x98e4('0x48')](handleError(_0x376eee,null));};exports[_0x98e4('0x73')]=function(_0x2313ed,_0x103887,_0x7304dc){return db['Team']['findAll']({'where':{'id':_0x2313ed['query'][_0x98e4('0x68')]},'attributes':['id'],'include':[{'model':db[_0x98e4('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x98e4('0x2a')](handleEntityNotFound(_0x103887,null))['then'](function(_0x29f99c){var _0x1f124b=_['map'](_0x29f99c,'id');var _0x238086=[];var _0x47d228=[];var _0x4fdfb7=squel[_0x98e4('0x74')]();_0x4fdfb7[_0x98e4('0x75')]('tq.TeamId')[_0x98e4('0x76')]('team_has_sms_queues','tq')[_0x98e4('0x77')]('user_has_teams','ut',_0x98e4('0x78'))['where'](_0x98e4('0x79'),_0x2313ed['params']['id']);for(var _0x2163b3=0x0;_0x2163b3<_0x29f99c[_0x98e4('0x4b')];_0x2163b3+=0x1){let _0x15479d=_0x29f99c[_0x2163b3];for(var _0x154d70=0x0;_0x154d70<_0x15479d[_0x98e4('0x6c')][_0x98e4('0x4b')];_0x154d70+=0x1){let _0x14a0c7=_0x15479d[_0x98e4('0x6c')][_0x154d70];var _0x597d84=_0x4fdfb7[_0x98e4('0x7a')]();_0x597d84[_0x98e4('0x41')]('ut.UserId\x20=\x20?',_0x14a0c7['id']);_0x47d228[_0x98e4('0x7b')](db['sequelize'][_0x98e4('0x39')](_0x597d84[_0x98e4('0x7c')](),{'type':db['sequelize']['QueryTypes'][_0x98e4('0x7d')]})[_0x98e4('0x2a')](function(_0x39700a){if(_0x39700a['length']===0x1){return _0x14a0c7['id'];}else{var _0x138004=_[_0x98e4('0x7e')](_[_0x98e4('0x32')](_0x39700a,_0x98e4('0x7f')),function(_0x49240f){return _['includes'](_0x1f124b,_0x49240f);});if(_0x138004){return _0x14a0c7['id'];}}}));}}return BPromise['all'](_0x47d228)['then'](function(_0x293724){_0x238086=_(_0x238086)[_0x98e4('0x80')](_0x293724)['compact']()['value']();return db[_0x98e4('0x33')][_0x98e4('0x4c')]({'where':{'id':_0x2313ed[_0x98e4('0x4a')]['id']}})[_0x98e4('0x2a')](function(_0x20f4c6){return db[_0x98e4('0x6d')][_0x98e4('0x81')](function(_0x1dd0de){return _0x20f4c6[_0x98e4('0x73')](_0x2313ed[_0x98e4('0x39')]['ids'],{'transaction':_0x1dd0de})[_0x98e4('0x2a')](function(){if(!_[_0x98e4('0x82')](_0x238086)){return _0x20f4c6[_0x98e4('0x83')](_0x238086,{'transaction':_0x1dd0de});}})[_0x98e4('0x2a')](function(){_0x238086['forEach'](function(_0x5bfdc1){socket[_0x98e4('0x71')](_0x98e4('0x84'),{'UserId':_0x5bfdc1,'SmsQueueId':_0x20f4c6['id']});});});});});});})[_0x98e4('0x2a')](respondWithStatusCode(_0x103887,null))[_0x98e4('0x48')](handleError(_0x103887,null));};exports[_0x98e4('0x85')]=function(_0x45f3bb,_0x224437,_0x522df6){return db[_0x98e4('0x33')][_0x98e4('0x4c')]({'where':{'id':_0x45f3bb[_0x98e4('0x4a')]['id']}})[_0x98e4('0x2a')](handleEntityNotFound(_0x224437,null))[_0x98e4('0x2a')](function(_0x2158cc){if(_0x2158cc){return _0x2158cc[_0x98e4('0x85')](_0x45f3bb['body'][_0x98e4('0x68')],_[_0x98e4('0x86')](_0x45f3bb[_0x98e4('0x4e')],['ids','id'])||{})['spread'](function(_0x5628c6){for(var _0xf18bab=0x0;_0xf18bab<_0x45f3bb[_0x98e4('0x4e')]['ids'][_0x98e4('0x4b')];_0xf18bab+=0x1){socket[_0x98e4('0x71')](_0x98e4('0x72'),{'UserId':Number(_0x45f3bb[_0x98e4('0x4e')][_0x98e4('0x68')][_0xf18bab]),'SmsQueueId':Number(_0x45f3bb[_0x98e4('0x4a')]['id'])});}return _0x5628c6;});}})['then'](respondWithResult(_0x224437,null))[_0x98e4('0x48')](handleError(_0x224437,null));};exports['removeAgents']=function(_0x418fb3,_0x4a2087,_0xf67e06){return db['SmsQueue'][_0x98e4('0x4c')]({'where':{'id':_0x418fb3[_0x98e4('0x4a')]['id']}})[_0x98e4('0x2a')](handleEntityNotFound(_0x4a2087,null))[_0x98e4('0x2a')](function(_0x10b4a1){if(_0x10b4a1){return _0x10b4a1[_0x98e4('0x83')](_0x418fb3[_0x98e4('0x39')][_0x98e4('0x68')])[_0x98e4('0x2a')](function(){if(_[_0x98e4('0x87')](_0x418fb3[_0x98e4('0x39')][_0x98e4('0x68')])){for(var _0x2248f9=0x0;_0x2248f9<_0x418fb3['query'][_0x98e4('0x68')][_0x98e4('0x4b')];_0x2248f9+=0x1){socket[_0x98e4('0x71')](_0x98e4('0x84'),{'UserId':Number(_0x418fb3[_0x98e4('0x39')][_0x98e4('0x68')][_0x2248f9]),'SmsQueueId':Number(_0x418fb3['params']['id'])});}}else{socket[_0x98e4('0x71')](_0x98e4('0x84'),{'UserId':Number(_0x418fb3['query'][_0x98e4('0x68')]),'SmsQueueId':Number(_0x418fb3[_0x98e4('0x4a')]['id'])});}});}})[_0x98e4('0x2a')](respondWithStatusCode(_0x4a2087,null))[_0x98e4('0x48')](handleError(_0x4a2087,null));};exports[_0x98e4('0x88')]=function(_0x2a2e0c,_0x5595dd,_0x16d2d7){var _0x31f3e9={};var _0x5e7279={};var _0x5586ef;var _0xc847b1;return db[_0x98e4('0x33')][_0x98e4('0x58')]({'where':{'id':_0x2a2e0c[_0x98e4('0x4a')]['id']}})[_0x98e4('0x2a')](handleEntityNotFound(_0x5595dd,null))[_0x98e4('0x2a')](function(_0x38ed3f){if(_0x38ed3f){_0x5586ef=_0x38ed3f;_0x5e7279[_0x98e4('0x37')]=_[_0x98e4('0x38')](db['User']['rawAttributes']);_0x5e7279['query']=_[_0x98e4('0x38')](_0x2a2e0c[_0x98e4('0x39')]);_0x5e7279[_0x98e4('0x3a')]=_[_0x98e4('0x3b')](_0x5e7279[_0x98e4('0x37')],_0x5e7279[_0x98e4('0x39')]);_0x31f3e9['attributes']=_[_0x98e4('0x3b')](_0x5e7279[_0x98e4('0x37')],qs[_0x98e4('0x3c')](_0x2a2e0c['query']['fields']));_0x31f3e9[_0x98e4('0x3d')]=_0x31f3e9[_0x98e4('0x3d')][_0x98e4('0x4b')]?_0x31f3e9[_0x98e4('0x3d')]:_0x5e7279[_0x98e4('0x37')];_0x31f3e9[_0x98e4('0x67')]=qs[_0x98e4('0x40')](_0x2a2e0c[_0x98e4('0x39')][_0x98e4('0x40')]);_0x31f3e9[_0x98e4('0x41')]=qs['filters'](_['pick'](_0x2a2e0c['query'],_0x5e7279['filters']));if(_0x2a2e0c[_0x98e4('0x39')][_0x98e4('0x5c')]){_0x31f3e9[_0x98e4('0x41')]=_[_0x98e4('0x42')](_0x31f3e9[_0x98e4('0x41')],{'$or':_['map'](_0x31f3e9['attributes'],function(_0x42701f){var _0x24f4f4={};_0x24f4f4[_0x42701f]={'$like':'%'+_0x2a2e0c[_0x98e4('0x39')][_0x98e4('0x5c')]+'%'};return _0x24f4f4;})});}_0x31f3e9=_[_0x98e4('0x42')]({},_0x31f3e9,_0x2a2e0c[_0x98e4('0x43')]);return _0x5586ef[_0x98e4('0x88')](_0x31f3e9);}})['then'](function(_0x422810){if(_0x422810){_0xc847b1=_0x422810[_0x98e4('0x4b')];if(!_0x2a2e0c['query'][_0x98e4('0x3e')](_0x98e4('0x3f'))){_0x31f3e9['limit']=qs['limit'](_0x2a2e0c[_0x98e4('0x39')]['limit']);_0x31f3e9[_0x98e4('0x21')]=qs[_0x98e4('0x21')](_0x2a2e0c[_0x98e4('0x39')][_0x98e4('0x21')]);}return _0x5586ef[_0x98e4('0x88')](_0x31f3e9);}})[_0x98e4('0x2a')](function(_0x29aa34){if(_0x29aa34){return _0x29aa34?{'count':_0xc847b1,'rows':_0x29aa34}:null;}})[_0x98e4('0x2a')](respondWithResult(_0x5595dd,null))['catch'](handleError(_0x5595dd,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 9176b7b..63edb9e 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 _0xca2f=['emit','hasOwnProperty','hook','exports','events','SmsQueue','setMaxListeners','save','remove'];(function(_0x401ccd,_0x140815){var _0x5a57ad=function(_0x8ad698){while(--_0x8ad698){_0x401ccd['push'](_0x401ccd['shift']());}};_0x5a57ad(++_0x140815);}(_0xca2f,0x67));var _0xfca2=function(_0x37676d,_0x55fb68){_0x37676d=_0x37676d-0x0;var _0x329144=_0xca2f[_0x37676d];return _0x329144;};'use strict';var EventEmitter=require(_0xfca2('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xfca2('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xfca2('0x2')](0x0);var events={'afterCreate':_0xfca2('0x3'),'afterUpdate':'update','afterDestroy':_0xfca2('0x4')};function emitEvent(_0x2efc60){return function(_0x529d60,_0x5cfb1a,_0x9b83be){SmsQueueEvents[_0xfca2('0x5')](_0x2efc60+':'+_0x529d60['id'],_0x529d60);SmsQueueEvents[_0xfca2('0x5')](_0x2efc60,_0x529d60);_0x9b83be(null);};}for(var e in events){if(events[_0xfca2('0x6')](e)){var event=events[e];SmsQueue[_0xfca2('0x7')](e,emitEvent(event));}}module[_0xfca2('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x643f=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0xae282f,_0x2d9368){var _0x5f46d4=function(_0x4f703e){while(--_0x4f703e){_0xae282f['push'](_0xae282f['shift']());}};_0x5f46d4(++_0x2d9368);}(_0x643f,0x181));var _0xf643=function(_0x1a5d99,_0x25094e){_0x1a5d99=_0x1a5d99-0x0;var _0xea0fb8=_0x643f[_0x1a5d99];return _0xea0fb8;};'use strict';var EventEmitter=require(_0xf643('0x0'));var SmsQueue=require(_0xf643('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xf643('0x2')](0x0);var events={'afterCreate':_0xf643('0x3'),'afterUpdate':_0xf643('0x4'),'afterDestroy':_0xf643('0x5')};function emitEvent(_0x12e238){return function(_0x1643e5,_0x17424f,_0x2a7d73){SmsQueueEvents[_0xf643('0x6')](_0x12e238+':'+_0x1643e5['id'],_0x1643e5);SmsQueueEvents['emit'](_0x12e238,_0x1643e5);_0x2a7d73(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xf643('0x7')](e,emitEvent(event));}}module[_0xf643('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 21602ff..7425568 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 _0x2162=['api','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','../../config/logger'];(function(_0x1e5310,_0x1aab3b){var _0x413b87=function(_0xe8dcaa){while(--_0xe8dcaa){_0x1e5310['push'](_0x1e5310['shift']());}};_0x413b87(++_0x1aab3b);}(_0x2162,0x1b7));var _0x2216=function(_0x2892da,_0x191a40){_0x2892da=_0x2892da-0x0;var _0x28cff2=_0x2162[_0x2892da];return _0x28cff2;};'use strict';var _=require(_0x2216('0x0'));var util=require(_0x2216('0x1'));var logger=require(_0x2216('0x2'))(_0x2216('0x3'));var moment=require('moment');var BPromise=require(_0x2216('0x4'));var rp=require(_0x2216('0x5'));var fs=require('fs');var path=require(_0x2216('0x6'));var rimraf=require(_0x2216('0x7'));var config=require(_0x2216('0x8'));var attributes=require(_0x2216('0x9'));module['exports']=function(_0x5d0359,_0x6082e3){return _0x5d0359[_0x2216('0xa')](_0x2216('0xb'),attributes,{'tableName':_0x2216('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6508=['sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SmsQueue'];(function(_0x3da3cc,_0x3b880f){var _0x3cbbfe=function(_0x322a5e){while(--_0x322a5e){_0x3da3cc['push'](_0x3da3cc['shift']());}};_0x3cbbfe(++_0x3b880f);}(_0x6508,0x175));var _0x8650=function(_0x502598,_0x1e95c8){_0x502598=_0x502598-0x0;var _0xbdee21=_0x6508[_0x502598];return _0xbdee21;};'use strict';var _=require(_0x8650('0x0'));var util=require(_0x8650('0x1'));var logger=require(_0x8650('0x2'))('api');var moment=require(_0x8650('0x3'));var BPromise=require(_0x8650('0x4'));var rp=require(_0x8650('0x5'));var fs=require('fs');var path=require(_0x8650('0x6'));var rimraf=require(_0x8650('0x7'));var config=require(_0x8650('0x8'));var attributes=require('./smsQueue.attributes');module[_0x8650('0x9')]=function(_0x29cfd9,_0x36d558){return _0x29cfd9['define'](_0x8650('0xa'),attributes,{'tableName':_0x8650('0xb'),'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 572b8af..d887018 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 _0xd795=['limit','include','map','model','ShowSmsQueue','SmsQueue','find','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetSmsQueue','findAll','options','raw','where','attributes'];(function(_0x911aa,_0x5cb8b5){var _0x327202=function(_0x52308e){while(--_0x52308e){_0x911aa['push'](_0x911aa['shift']());}};_0x327202(++_0x5cb8b5);}(_0xd795,0xab));var _0x5d79=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xd795[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0x5d79('0x0'));var moment=require(_0x5d79('0x1'));var BPromise=require(_0x5d79('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d79('0x3'))['db'];var utils=require(_0x5d79('0x4'));var logger=require(_0x5d79('0x5'))(_0x5d79('0x6'));var config=require(_0x5d79('0x7'));var jayson=require(_0x5d79('0x8'));var client=jayson[_0x5d79('0x9')][_0x5d79('0xa')]({'port':0x232a});config['redis']=_[_0x5d79('0xb')](config[_0x5d79('0xc')],{'host':_0x5d79('0xd'),'port':0x18eb});var socket=require(_0x5d79('0xe'))(new Redis(config[_0x5d79('0xc')]));require(_0x5d79('0xf'))[_0x5d79('0x10')](socket);function respondWithRpcPromise(_0x4f0172,_0x4ca959,_0x2cd78d){return new BPromise(function(_0x2d55ce,_0x5de0ab){return client['request'](_0x4f0172,_0x2cd78d)[_0x5d79('0x11')](function(_0x69694d){logger['info'](_0x5d79('0x12'),_0x4ca959,_0x5d79('0x13'));logger[_0x5d79('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x4ca959,_0x5d79('0x13'),JSON[_0x5d79('0x15')](_0x69694d));if(_0x69694d[_0x5d79('0x16')]){if(_0x69694d[_0x5d79('0x16')][_0x5d79('0x17')]===0x1f4){logger[_0x5d79('0x16')](_0x5d79('0x12'),_0x4ca959,_0x69694d[_0x5d79('0x16')][_0x5d79('0x18')]);return _0x5de0ab(_0x69694d[_0x5d79('0x16')][_0x5d79('0x18')]);}logger[_0x5d79('0x16')](_0x5d79('0x12'),_0x4ca959,_0x69694d[_0x5d79('0x16')][_0x5d79('0x18')]);return _0x2d55ce(_0x69694d[_0x5d79('0x16')][_0x5d79('0x18')]);}else{logger[_0x5d79('0x19')]('SmsQueue,\x20%s,\x20%s',_0x4ca959,_0x5d79('0x13'));_0x2d55ce(_0x69694d[_0x5d79('0x1a')][_0x5d79('0x18')]);}})[_0x5d79('0x1b')](function(_0x4a4eb6){logger[_0x5d79('0x16')](_0x5d79('0x12'),_0x4ca959,_0x4a4eb6);_0x5de0ab(_0x4a4eb6);});});}exports[_0x5d79('0x1c')]=function(_0x3a8a75){var _0x34c297=this;return new Promise(function(_0x4bd647,_0x225a36){return db['SmsQueue'][_0x5d79('0x1d')]({'raw':_0x3a8a75[_0x5d79('0x1e')]?_0x3a8a75['options'][_0x5d79('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a8a75[_0x5d79('0x1e')]?_0x3a8a75[_0x5d79('0x1e')][_0x5d79('0x20')]||null:null,'attributes':_0x3a8a75['options']?_0x3a8a75[_0x5d79('0x1e')][_0x5d79('0x21')]||null:null,'limit':_0x3a8a75['options']?_0x3a8a75[_0x5d79('0x1e')][_0x5d79('0x22')]||null:null,'include':_0x3a8a75[_0x5d79('0x1e')]?_0x3a8a75[_0x5d79('0x1e')][_0x5d79('0x23')]?_[_0x5d79('0x24')](_0x3a8a75[_0x5d79('0x1e')][_0x5d79('0x23')],function(_0x208d28){return{'model':db[_0x208d28[_0x5d79('0x25')]],'as':_0x208d28['as'],'attributes':_0x208d28[_0x5d79('0x21')],'include':_0x208d28[_0x5d79('0x23')]?_[_0x5d79('0x24')](_0x208d28[_0x5d79('0x23')],function(_0x180f07){return{'model':db[_0x180f07[_0x5d79('0x25')]],'as':_0x180f07['as'],'attributes':_0x180f07['attributes'],'include':_0x180f07[_0x5d79('0x23')]?_[_0x5d79('0x24')](_0x180f07[_0x5d79('0x23')],function(_0x3312f6){return{'model':db[_0x3312f6['model']],'as':_0x3312f6['as'],'attributes':_0x3312f6[_0x5d79('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40ffe9){logger[_0x5d79('0x19')](_0x5d79('0x1c'),_0x3a8a75);logger[_0x5d79('0x14')](_0x5d79('0x1c'),_0x3a8a75,JSON[_0x5d79('0x15')](_0x40ffe9));_0x4bd647(_0x40ffe9);})[_0x5d79('0x1b')](function(_0xa35903){logger['error']('GetSmsQueue',_0xa35903[_0x5d79('0x18')],_0x3a8a75);_0x225a36(_0x34c297['error'](0x1f4,_0xa35903[_0x5d79('0x18')]));});});};exports[_0x5d79('0x26')]=function(_0x263613){var _0xf52ea0=this;return new Promise(function(_0x4eef55,_0x35edf8){return db[_0x5d79('0x27')][_0x5d79('0x28')]({'raw':_0x263613[_0x5d79('0x1e')]?_0x263613[_0x5d79('0x1e')][_0x5d79('0x1f')]===undefined?!![]:![]:!![],'where':_0x263613[_0x5d79('0x1e')]?_0x263613[_0x5d79('0x1e')][_0x5d79('0x20')]||null:null,'attributes':_0x263613[_0x5d79('0x1e')]?_0x263613['options']['attributes']||null:null,'include':_0x263613[_0x5d79('0x1e')]?_0x263613['options'][_0x5d79('0x23')]?_['map'](_0x263613[_0x5d79('0x1e')][_0x5d79('0x23')],function(_0x1ea8f3){return{'model':db[_0x1ea8f3[_0x5d79('0x25')]],'as':_0x1ea8f3['as'],'attributes':_0x1ea8f3[_0x5d79('0x21')],'include':_0x1ea8f3[_0x5d79('0x23')]?_['map'](_0x1ea8f3[_0x5d79('0x23')],function(_0x46c50f){return{'model':db[_0x46c50f[_0x5d79('0x25')]],'as':_0x46c50f['as'],'attributes':_0x46c50f['attributes'],'include':_0x46c50f[_0x5d79('0x23')]?_['map'](_0x46c50f[_0x5d79('0x23')],function(_0x3428ac){return{'model':db[_0x3428ac['model']],'as':_0x3428ac['as'],'attributes':_0x3428ac[_0x5d79('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5d79('0x11')](function(_0x240576){logger['info'](_0x5d79('0x26'),_0x263613);logger['debug']('ShowSmsQueue',_0x263613,JSON[_0x5d79('0x15')](_0x240576));_0x4eef55(_0x240576);})['catch'](function(_0x273894){logger[_0x5d79('0x16')](_0x5d79('0x26'),_0x273894[_0x5d79('0x18')],_0x263613);_0x35edf8(_0xf52ea0[_0x5d79('0x16')](0x1f4,_0x273894['message']));});});}; \ No newline at end of file +var _0xecae=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','options','limit','include','attributes','map','model','find','where','ShowSmsQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x40a0a4,_0x5d30d0){var _0x50cc17=function(_0x4ea52d){while(--_0x4ea52d){_0x40a0a4['push'](_0x40a0a4['shift']());}};_0x50cc17(++_0x5d30d0);}(_0xecae,0x72));var _0xeeca=function(_0x37229f,_0x654ba){_0x37229f=_0x37229f-0x0;var _0x28d70d=_0xecae[_0x37229f];return _0x28d70d;};'use strict';var _=require(_0xeeca('0x0'));var util=require('util');var moment=require(_0xeeca('0x1'));var BPromise=require(_0xeeca('0x2'));var rs=require(_0xeeca('0x3'));var fs=require('fs');var Redis=require(_0xeeca('0x4'));var db=require(_0xeeca('0x5'))['db'];var utils=require(_0xeeca('0x6'));var logger=require(_0xeeca('0x7'))(_0xeeca('0x8'));var config=require(_0xeeca('0x9'));var jayson=require(_0xeeca('0xa'));var client=jayson[_0xeeca('0xb')][_0xeeca('0xc')]({'port':0x232a});config[_0xeeca('0xd')]=_[_0xeeca('0xe')](config[_0xeeca('0xd')],{'host':_0xeeca('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeeca('0xd')]));require('./smsQueue.socket')[_0xeeca('0x10')](socket);function respondWithRpcPromise(_0x26323e,_0x544ae9,_0x433b6b){return new BPromise(function(_0x157744,_0x3eef01){return client[_0xeeca('0x11')](_0x26323e,_0x433b6b)[_0xeeca('0x12')](function(_0x55172c){logger[_0xeeca('0x13')](_0xeeca('0x14'),_0x544ae9,_0xeeca('0x15'));logger[_0xeeca('0x16')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x544ae9,_0xeeca('0x15'),JSON[_0xeeca('0x17')](_0x55172c));if(_0x55172c[_0xeeca('0x18')]){if(_0x55172c[_0xeeca('0x18')][_0xeeca('0x19')]===0x1f4){logger['error'](_0xeeca('0x14'),_0x544ae9,_0x55172c[_0xeeca('0x18')][_0xeeca('0x1a')]);return _0x3eef01(_0x55172c[_0xeeca('0x18')][_0xeeca('0x1a')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x544ae9,_0x55172c[_0xeeca('0x18')][_0xeeca('0x1a')]);return _0x157744(_0x55172c[_0xeeca('0x18')][_0xeeca('0x1a')]);}else{logger[_0xeeca('0x13')]('SmsQueue,\x20%s,\x20%s',_0x544ae9,_0xeeca('0x15'));_0x157744(_0x55172c[_0xeeca('0x1b')][_0xeeca('0x1a')]);}})[_0xeeca('0x1c')](function(_0x1c7198){logger['error'](_0xeeca('0x14'),_0x544ae9,_0x1c7198);_0x3eef01(_0x1c7198);});});}exports[_0xeeca('0x1d')]=function(_0x556244){var _0x59a3d8=this;return new Promise(function(_0x9a2779,_0x7cefcf){return db[_0xeeca('0x1e')]['findAll']({'raw':_0x556244[_0xeeca('0x1f')]?_0x556244[_0xeeca('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x556244[_0xeeca('0x1f')]?_0x556244['options']['where']||null:null,'attributes':_0x556244[_0xeeca('0x1f')]?_0x556244['options']['attributes']||null:null,'limit':_0x556244[_0xeeca('0x1f')]?_0x556244[_0xeeca('0x1f')][_0xeeca('0x20')]||null:null,'include':_0x556244[_0xeeca('0x1f')]?_0x556244['options']['include']?_['map'](_0x556244['options'][_0xeeca('0x21')],function(_0x4f9f5b){return{'model':db[_0x4f9f5b['model']],'as':_0x4f9f5b['as'],'attributes':_0x4f9f5b[_0xeeca('0x22')],'include':_0x4f9f5b['include']?_[_0xeeca('0x23')](_0x4f9f5b[_0xeeca('0x21')],function(_0x297787){return{'model':db[_0x297787[_0xeeca('0x24')]],'as':_0x297787['as'],'attributes':_0x297787[_0xeeca('0x22')],'include':_0x297787[_0xeeca('0x21')]?_[_0xeeca('0x23')](_0x297787['include'],function(_0x23677d){return{'model':db[_0x23677d['model']],'as':_0x23677d['as'],'attributes':_0x23677d[_0xeeca('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e95ea){logger[_0xeeca('0x13')](_0xeeca('0x1d'),_0x556244);logger[_0xeeca('0x16')](_0xeeca('0x1d'),_0x556244,JSON[_0xeeca('0x17')](_0x3e95ea));_0x9a2779(_0x3e95ea);})[_0xeeca('0x1c')](function(_0x1966d4){logger[_0xeeca('0x18')](_0xeeca('0x1d'),_0x1966d4['message'],_0x556244);_0x7cefcf(_0x59a3d8[_0xeeca('0x18')](0x1f4,_0x1966d4[_0xeeca('0x1a')]));});});};exports['ShowSmsQueue']=function(_0x1d5e05){var _0x1b0106=this;return new Promise(function(_0x45d714,_0x9c2449){return db['SmsQueue'][_0xeeca('0x25')]({'raw':_0x1d5e05['options']?_0x1d5e05[_0xeeca('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x1d5e05[_0xeeca('0x1f')]?_0x1d5e05['options'][_0xeeca('0x26')]||null:null,'attributes':_0x1d5e05['options']?_0x1d5e05['options']['attributes']||null:null,'include':_0x1d5e05['options']?_0x1d5e05[_0xeeca('0x1f')][_0xeeca('0x21')]?_['map'](_0x1d5e05[_0xeeca('0x1f')][_0xeeca('0x21')],function(_0x4bf74e){return{'model':db[_0x4bf74e[_0xeeca('0x24')]],'as':_0x4bf74e['as'],'attributes':_0x4bf74e[_0xeeca('0x22')],'include':_0x4bf74e[_0xeeca('0x21')]?_[_0xeeca('0x23')](_0x4bf74e['include'],function(_0x145d38){return{'model':db[_0x145d38['model']],'as':_0x145d38['as'],'attributes':_0x145d38['attributes'],'include':_0x145d38[_0xeeca('0x21')]?_[_0xeeca('0x23')](_0x145d38[_0xeeca('0x21')],function(_0x434aef){return{'model':db[_0x434aef[_0xeeca('0x24')]],'as':_0x434aef['as'],'attributes':_0x434aef['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x366422){logger['info'](_0xeeca('0x27'),_0x1d5e05);logger[_0xeeca('0x16')](_0xeeca('0x27'),_0x1d5e05,JSON[_0xeeca('0x17')](_0x366422));_0x45d714(_0x366422);})[_0xeeca('0x1c')](function(_0x2ec117){logger[_0xeeca('0x18')]('ShowSmsQueue',_0x2ec117[_0xeeca('0x1a')],_0x1d5e05);_0x9c2449(_0x1b0106[_0xeeca('0x18')](0x1f4,_0x2ec117['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 112dc18..5d4839d 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 _0xbe0d=['./smsQueue.events','save','remove','update','emit','register','length','smsQueue:'];(function(_0x1df0f8,_0x419080){var _0x52b311=function(_0x442f28){while(--_0x442f28){_0x1df0f8['push'](_0x1df0f8['shift']());}};_0x52b311(++_0x419080);}(_0xbe0d,0x140));var _0xdbe0=function(_0x30dea6,_0x45559f){_0x30dea6=_0x30dea6-0x0;var _0x1a70bd=_0xbe0d[_0x30dea6];return _0x1a70bd;};'use strict';var SmsQueueEvents=require(_0xdbe0('0x0'));var events=[_0xdbe0('0x1'),_0xdbe0('0x2'),_0xdbe0('0x3')];function createListener(_0x529e2d,_0x214446){return function(_0x33c6ca){_0x214446[_0xdbe0('0x4')](_0x529e2d,_0x33c6ca);};}function removeListener(_0x2e834b,_0x443f9b){return function(){SmsQueueEvents['removeListener'](_0x2e834b,_0x443f9b);};}exports[_0xdbe0('0x5')]=function(_0x35f1f6){for(var _0x24e38a=0x0,_0xf82872=events[_0xdbe0('0x6')];_0x24e38a<_0xf82872;_0x24e38a++){var _0x26bb9a=events[_0x24e38a];var _0x135506=createListener(_0xdbe0('0x7')+_0x26bb9a,_0x35f1f6);SmsQueueEvents['on'](_0x26bb9a,_0x135506);}}; \ No newline at end of file +var _0x9822=['update','register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x3f4a8e,_0x507c39){var _0x7f68fd=function(_0x29890f){while(--_0x29890f){_0x3f4a8e['push'](_0x3f4a8e['shift']());}};_0x7f68fd(++_0x507c39);}(_0x9822,0x10e));var _0x2982=function(_0x27316d,_0x4c6711){_0x27316d=_0x27316d-0x0;var _0x718f80=_0x9822[_0x27316d];return _0x718f80;};'use strict';var SmsQueueEvents=require(_0x2982('0x0'));var events=[_0x2982('0x1'),_0x2982('0x2'),_0x2982('0x3')];function createListener(_0x6a8de8,_0x19ff4d){return function(_0x52d463){_0x19ff4d['emit'](_0x6a8de8,_0x52d463);};}function removeListener(_0x3dd85c,_0x4e10da){return function(){SmsQueueEvents['removeListener'](_0x3dd85c,_0x4e10da);};}exports[_0x2982('0x4')]=function(_0x34f5f2){for(var _0xec9c89=0x0,_0x55fe87=events[_0x2982('0x5')];_0xec9c89<_0x55fe87;_0xec9c89++){var _0x39ebab=events[_0xec9c89];var _0x175f39=createListener(_0x2982('0x6')+_0x39ebab,_0x34f5f2);SmsQueueEvents['on'](_0x39ebab,_0x175f39);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index cadd334..5e9e3d8 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 _0xeb1c=['index','get','/describe','describe','show','post','put','/:id','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xeb1c,0x185));var _0xceb1=function(_0x4e4848,_0x5c7271){_0x4e4848=_0x4e4848-0x0;var _0xa69a7=_0xeb1c[_0x4e4848];return _0xa69a7;};'use strict';var multer=require(_0xceb1('0x0'));var util=require(_0xceb1('0x1'));var path=require(_0xceb1('0x2'));var timeout=require('connect-timeout');var express=require(_0xceb1('0x3'));var router=express['Router']();var fs_extra=require(_0xceb1('0x4'));var auth=require(_0xceb1('0x5'));var interaction=require(_0xceb1('0x6'));var config=require(_0xceb1('0x7'));var controller=require(_0xceb1('0x8'));router['get']('/',auth[_0xceb1('0x9')](),controller[_0xceb1('0xa')]);router[_0xceb1('0xb')](_0xceb1('0xc'),auth[_0xceb1('0x9')](),controller[_0xceb1('0xd')]);router[_0xceb1('0xb')]('/:id',auth[_0xceb1('0x9')](),controller[_0xceb1('0xe')]);router[_0xceb1('0xf')]('/',auth[_0xceb1('0x9')](),controller['create']);router[_0xceb1('0x10')](_0xceb1('0x11'),auth[_0xceb1('0x9')](),controller[_0xceb1('0x12')]);router[_0xceb1('0x13')](_0xceb1('0x11'),auth[_0xceb1('0x9')](),controller[_0xceb1('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1530=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','update','delete','multer'];(function(_0x1ea5ba,_0x39b20d){var _0x762145=function(_0x463c78){while(--_0x463c78){_0x1ea5ba['push'](_0x1ea5ba['shift']());}};_0x762145(++_0x39b20d);}(_0x1530,0x103));var _0x0153=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x1530[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require(_0x0153('0x0'));var util=require('util');var path=require(_0x0153('0x1'));var timeout=require(_0x0153('0x2'));var express=require(_0x0153('0x3'));var router=express[_0x0153('0x4')]();var fs_extra=require(_0x0153('0x5'));var auth=require(_0x0153('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0153('0x7'));var controller=require(_0x0153('0x8'));router['get']('/',auth[_0x0153('0x9')](),controller[_0x0153('0xa')]);router[_0x0153('0xb')](_0x0153('0xc'),auth['isAuthenticated'](),controller[_0x0153('0xd')]);router['get']('/:id',auth[_0x0153('0x9')](),controller[_0x0153('0xe')]);router[_0x0153('0xf')]('/',auth[_0x0153('0x9')](),controller[_0x0153('0x10')]);router[_0x0153('0x11')]('/:id',auth[_0x0153('0x9')](),controller[_0x0153('0x12')]);router[_0x0153('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 5edfcf2..e5caede 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 _0xc68e=['moment','sequelize','STRING','DATE'];(function(_0x40b61c,_0x13015c){var _0x29ea9b=function(_0xfcadb6){while(--_0xfcadb6){_0x40b61c['push'](_0x40b61c['shift']());}};_0x29ea9b(++_0x13015c);}(_0xc68e,0x1e4));var _0xec68=function(_0x30f3bc,_0x4418da){_0x30f3bc=_0x30f3bc-0x0;var _0x21000f=_0xc68e[_0x30f3bc];return _0x21000f;};'use strict';var moment=require(_0xec68('0x0'));var Sequelize=require(_0xec68('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xec68('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xec68('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xec68('0x3')]},'acceptAt':{'type':Sequelize[_0xec68('0x3')]},'exitAt':{'type':Sequelize[_0xec68('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x76b7=['moment','sequelize','STRING','DATE'];(function(_0x2685b2,_0x513f32){var _0x54b54e=function(_0x57ff7e){while(--_0x57ff7e){_0x2685b2['push'](_0x2685b2['shift']());}};_0x54b54e(++_0x513f32);}(_0x76b7,0x80));var _0x776b=function(_0x5ecc65,_0x54e148){_0x5ecc65=_0x5ecc65-0x0;var _0x508897=_0x76b7[_0x5ecc65];return _0x508897;};'use strict';var moment=require(_0x776b('0x0'));var Sequelize=require(_0x776b('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x776b('0x2')]},'joinAt':{'type':Sequelize[_0x776b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x776b('0x3')]},'exitAt':{'type':Sequelize[_0x776b('0x3')]},'reason':{'type':Sequelize[_0x776b('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 0ae2189..1ba5592 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 _0xf728=['sendStatus','status','end','undefined','limit','count','offset','set','json','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','SmsQueueReport','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x5082a4,_0x4baab9){var _0x344ace=function(_0x29e30b){while(--_0x29e30b){_0x5082a4['push'](_0x5082a4['shift']());}};_0x344ace(++_0x4baab9);}(_0xf728,0x1e2));var _0x8f72=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xf728[_0xf71120];return _0xbe2fd3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f72('0x0'));var zipdir=require(_0x8f72('0x1'));var jsonpatch=require(_0x8f72('0x2'));var rp=require('request-promise');var moment=require(_0x8f72('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8f72('0x4'));var util=require(_0x8f72('0x5'));var path=require(_0x8f72('0x6'));var sox=require(_0x8f72('0x7'));var csv=require(_0x8f72('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f72('0x9'));var _=require(_0x8f72('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8f72('0xb'));var Papa=require(_0x8f72('0xc'));var Redis=require(_0x8f72('0xd'));var authService=require(_0x8f72('0xe'));var qs=require(_0x8f72('0xf'));var as=require(_0x8f72('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f72('0x11'))(_0x8f72('0x12'));var utils=require(_0x8f72('0x13'));var config=require(_0x8f72('0x14'));var licenseUtil=require(_0x8f72('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x548317,_0x20d989){_0x20d989=_0x20d989||0xcc;return function(_0x304cce){if(_0x304cce){return _0x548317[_0x8f72('0x16')](_0x20d989);}return _0x548317[_0x8f72('0x17')](_0x20d989)[_0x8f72('0x18')]();};}function respondWithResult(_0x174c7a,_0x2ab074){_0x2ab074=_0x2ab074||0xc8;return function(_0x7b3e6a){if(_0x7b3e6a){return _0x174c7a[_0x8f72('0x17')](_0x2ab074)['json'](_0x7b3e6a);}};}function respondWithFilteredResult(_0x373990,_0x1556e1){return function(_0x5603b3){if(_0x5603b3){var _0x5a436b=typeof _0x1556e1['offset']===_0x8f72('0x19')&&typeof _0x1556e1[_0x8f72('0x1a')]===_0x8f72('0x19');var _0x19da24=_0x5603b3[_0x8f72('0x1b')];var _0x58cf5c=_0x5a436b?0x0:_0x1556e1[_0x8f72('0x1c')];var _0x1c6609=_0x5a436b?_0x5603b3[_0x8f72('0x1b')]:_0x1556e1[_0x8f72('0x1c')]+_0x1556e1[_0x8f72('0x1a')];var _0x50eee5;if(_0x1c6609>=_0x19da24){_0x1c6609=_0x19da24;_0x50eee5=0xc8;}else{_0x50eee5=0xce;}_0x373990[_0x8f72('0x17')](_0x50eee5);return _0x373990[_0x8f72('0x1d')]('Content-Range',_0x58cf5c+'-'+_0x1c6609+'/'+_0x19da24)[_0x8f72('0x1e')](_0x5603b3);}return null;};}function patchUpdates(_0x4bae60){return function(_0x26b534){try{jsonpatch['apply'](_0x26b534,_0x4bae60,!![]);}catch(_0x22e41f){return BPromise['reject'](_0x22e41f);}return _0x26b534[_0x8f72('0x1f')]();};}function saveUpdates(_0x4d0472,_0x394017){return function(_0x351434){if(_0x351434){return _0x351434[_0x8f72('0x20')](_0x4d0472)['then'](function(_0x117141){return _0x117141;});}return null;};}function removeEntity(_0x22eed8,_0x9cffd6){return function(_0x4fce07){if(_0x4fce07){return _0x4fce07[_0x8f72('0x21')]()[_0x8f72('0x22')](function(){_0x22eed8[_0x8f72('0x17')](0xcc)[_0x8f72('0x18')]();});}};}function handleEntityNotFound(_0xde9757,_0x561ede){return function(_0x49c6c6){if(!_0x49c6c6){_0xde9757['sendStatus'](0x194);}return _0x49c6c6;};}function handleError(_0x2f2ec3,_0x3ec24d){_0x3ec24d=_0x3ec24d||0x1f4;return function(_0x510b13){logger[_0x8f72('0x23')](_0x510b13[_0x8f72('0x24')]);if(_0x510b13[_0x8f72('0x25')]){delete _0x510b13[_0x8f72('0x25')];}_0x2f2ec3[_0x8f72('0x17')](_0x3ec24d)[_0x8f72('0x26')](_0x510b13);};}exports[_0x8f72('0x27')]=function(_0x3789f7,_0x3a92a8){var _0x196a81={},_0x2da897={},_0x36eb61={'count':0x0,'rows':[]};var _0x5727ac=_[_0x8f72('0x28')](db['SmsQueueReport'][_0x8f72('0x29')],function(_0x2b2e4c){return{'name':_0x2b2e4c['fieldName'],'type':_0x2b2e4c[_0x8f72('0x2a')][_0x8f72('0x2b')]};});_0x2da897['model']=_[_0x8f72('0x28')](_0x5727ac,_0x8f72('0x25'));_0x2da897[_0x8f72('0x2c')]=_[_0x8f72('0x2d')](_0x3789f7[_0x8f72('0x2c')]);_0x2da897[_0x8f72('0x2e')]=_['intersection'](_0x2da897[_0x8f72('0x2f')],_0x2da897[_0x8f72('0x2c')]);_0x196a81[_0x8f72('0x30')]=_[_0x8f72('0x31')](_0x2da897['model'],qs[_0x8f72('0x32')](_0x3789f7[_0x8f72('0x2c')]['fields']));_0x196a81[_0x8f72('0x30')]=_0x196a81[_0x8f72('0x30')][_0x8f72('0x33')]?_0x196a81[_0x8f72('0x30')]:_0x2da897[_0x8f72('0x2f')];if(!_0x3789f7['query'][_0x8f72('0x34')](_0x8f72('0x35'))){_0x196a81[_0x8f72('0x1a')]=qs[_0x8f72('0x1a')](_0x3789f7[_0x8f72('0x2c')][_0x8f72('0x1a')]);_0x196a81[_0x8f72('0x1c')]=qs[_0x8f72('0x1c')](_0x3789f7['query'][_0x8f72('0x1c')]);}_0x196a81[_0x8f72('0x36')]=qs[_0x8f72('0x37')](_0x3789f7['query']['sort']);_0x196a81[_0x8f72('0x38')]=qs[_0x8f72('0x2e')](_[_0x8f72('0x39')](_0x3789f7['query'],_0x2da897[_0x8f72('0x2e')]),_0x5727ac);if(_0x3789f7[_0x8f72('0x2c')]['filter']){_0x196a81[_0x8f72('0x38')]=_['merge'](_0x196a81[_0x8f72('0x38')],{'$or':_[_0x8f72('0x28')](_0x5727ac,function(_0x59c2ec){if(_0x59c2ec[_0x8f72('0x2a')]!=='VIRTUAL'){var _0x1204cc={};_0x1204cc[_0x59c2ec[_0x8f72('0x25')]]={'$like':'%'+_0x3789f7[_0x8f72('0x2c')][_0x8f72('0x3a')]+'%'};return _0x1204cc;}})});}_0x196a81=_[_0x8f72('0x3b')]({},_0x196a81,_0x3789f7['options']);var _0x49c3c4={'where':_0x196a81[_0x8f72('0x38')]};return db[_0x8f72('0x3c')][_0x8f72('0x1b')](_0x49c3c4)[_0x8f72('0x22')](function(_0x57e809){_0x36eb61[_0x8f72('0x1b')]=_0x57e809;if(_0x3789f7[_0x8f72('0x2c')][_0x8f72('0x3d')]){_0x196a81[_0x8f72('0x3e')]=[{'all':!![]}];}return db[_0x8f72('0x3c')][_0x8f72('0x3f')](_0x196a81);})[_0x8f72('0x22')](function(_0x5ec13f){_0x36eb61[_0x8f72('0x40')]=_0x5ec13f;return _0x36eb61;})[_0x8f72('0x22')](respondWithFilteredResult(_0x3a92a8,_0x196a81))['catch'](handleError(_0x3a92a8,null));};exports[_0x8f72('0x41')]=function(_0x3d05cc,_0x42454d){var _0x95abcb={'raw':!![],'where':{'id':_0x3d05cc[_0x8f72('0x42')]['id']}},_0x5acd55={};_0x5acd55['model']=_[_0x8f72('0x2d')](db[_0x8f72('0x3c')][_0x8f72('0x29')]);_0x5acd55[_0x8f72('0x2c')]=_[_0x8f72('0x2d')](_0x3d05cc['query']);_0x5acd55[_0x8f72('0x2e')]=_[_0x8f72('0x31')](_0x5acd55[_0x8f72('0x2f')],_0x5acd55[_0x8f72('0x2c')]);_0x95abcb[_0x8f72('0x30')]=_['intersection'](_0x5acd55[_0x8f72('0x2f')],qs[_0x8f72('0x32')](_0x3d05cc[_0x8f72('0x2c')][_0x8f72('0x32')]));_0x95abcb[_0x8f72('0x30')]=_0x95abcb[_0x8f72('0x30')][_0x8f72('0x33')]?_0x95abcb[_0x8f72('0x30')]:_0x5acd55[_0x8f72('0x2f')];if(_0x3d05cc[_0x8f72('0x2c')][_0x8f72('0x3d')]){_0x95abcb[_0x8f72('0x3e')]=[{'all':!![]}];}_0x95abcb=_['merge']({},_0x95abcb,_0x3d05cc['options']);return db[_0x8f72('0x3c')][_0x8f72('0x43')](_0x95abcb)[_0x8f72('0x22')](handleEntityNotFound(_0x42454d,null))[_0x8f72('0x22')](respondWithResult(_0x42454d,null))[_0x8f72('0x44')](handleError(_0x42454d,null));};exports[_0x8f72('0x45')]=function(_0x9dcbf3,_0xd09de5){return db['SmsQueueReport']['create'](_0x9dcbf3[_0x8f72('0x46')],{})[_0x8f72('0x22')](respondWithResult(_0xd09de5,0xc9))[_0x8f72('0x44')](handleError(_0xd09de5,null));};exports[_0x8f72('0x20')]=function(_0x2fe9ff,_0x5c8f65){if(_0x2fe9ff['body']['id']){delete _0x2fe9ff[_0x8f72('0x46')]['id'];}return db[_0x8f72('0x3c')][_0x8f72('0x43')]({'where':{'id':_0x2fe9ff['params']['id']}})[_0x8f72('0x22')](handleEntityNotFound(_0x5c8f65,null))[_0x8f72('0x22')](saveUpdates(_0x2fe9ff[_0x8f72('0x46')],null))[_0x8f72('0x22')](respondWithResult(_0x5c8f65,null))[_0x8f72('0x44')](handleError(_0x5c8f65,null));};exports[_0x8f72('0x21')]=function(_0x17ee19,_0x3ad7cd){return db[_0x8f72('0x3c')][_0x8f72('0x43')]({'where':{'id':_0x17ee19['params']['id']}})[_0x8f72('0x22')](handleEntityNotFound(_0x3ad7cd,null))[_0x8f72('0x22')](removeEntity(_0x3ad7cd,null))['catch'](handleError(_0x3ad7cd,null));};exports[_0x8f72('0x47')]=function(_0x1c9813,_0x933604){return db[_0x8f72('0x3c')][_0x8f72('0x47')]()[_0x8f72('0x22')](respondWithResult(_0x933604,null))[_0x8f72('0x44')](handleError(_0x933604,null));}; \ No newline at end of file +var _0x41c4=['count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','query','keys','filters','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','create','update','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined'];(function(_0x3fa50f,_0x11c479){var _0x4e81c7=function(_0x296fc8){while(--_0x296fc8){_0x3fa50f['push'](_0x3fa50f['shift']());}};_0x4e81c7(++_0x11c479);}(_0x41c4,0x81));var _0x441c=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x41c4[_0x164eca];return _0x2ce562;};'use strict';var emlformat=require(_0x441c('0x0'));var rimraf=require(_0x441c('0x1'));var zipdir=require(_0x441c('0x2'));var jsonpatch=require(_0x441c('0x3'));var rp=require(_0x441c('0x4'));var moment=require(_0x441c('0x5'));var BPromise=require(_0x441c('0x6'));var Mustache=require(_0x441c('0x7'));var util=require(_0x441c('0x8'));var path=require(_0x441c('0x9'));var sox=require(_0x441c('0xa'));var csv=require('to-csv');var ejs=require(_0x441c('0xb'));var fs=require('fs');var fs_extra=require(_0x441c('0xc'));var _=require(_0x441c('0xd'));var squel=require(_0x441c('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x441c('0xf'));var toCsv=require(_0x441c('0x10'));var querystring=require(_0x441c('0x11'));var Papa=require(_0x441c('0x12'));var Redis=require(_0x441c('0x13'));var authService=require(_0x441c('0x14'));var qs=require(_0x441c('0x15'));var as=require(_0x441c('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x441c('0x17'))(_0x441c('0x18'));var utils=require(_0x441c('0x19'));var config=require(_0x441c('0x1a'));var licenseUtil=require(_0x441c('0x1b'));var db=require(_0x441c('0x1c'))['db'];function respondWithStatusCode(_0x52891e,_0x1507c4){_0x1507c4=_0x1507c4||0xcc;return function(_0x3b6db9){if(_0x3b6db9){return _0x52891e[_0x441c('0x1d')](_0x1507c4);}return _0x52891e['status'](_0x1507c4)[_0x441c('0x1e')]();};}function respondWithResult(_0x451653,_0x6ca8bb){_0x6ca8bb=_0x6ca8bb||0xc8;return function(_0x3cba78){if(_0x3cba78){return _0x451653[_0x441c('0x1f')](_0x6ca8bb)[_0x441c('0x20')](_0x3cba78);}};}function respondWithFilteredResult(_0x2aa6f0,_0xbdd4f4){return function(_0x3e70e2){if(_0x3e70e2){var _0x3b86ff=typeof _0xbdd4f4[_0x441c('0x21')]===_0x441c('0x22')&&typeof _0xbdd4f4['limit']===_0x441c('0x22');var _0x1bee78=_0x3e70e2[_0x441c('0x23')];var _0x47e693=_0x3b86ff?0x0:_0xbdd4f4['offset'];var _0x3fc442=_0x3b86ff?_0x3e70e2[_0x441c('0x23')]:_0xbdd4f4[_0x441c('0x21')]+_0xbdd4f4['limit'];var _0x831c02;if(_0x3fc442>=_0x1bee78){_0x3fc442=_0x1bee78;_0x831c02=0xc8;}else{_0x831c02=0xce;}_0x2aa6f0[_0x441c('0x1f')](_0x831c02);return _0x2aa6f0[_0x441c('0x24')]('Content-Range',_0x47e693+'-'+_0x3fc442+'/'+_0x1bee78)['json'](_0x3e70e2);}return null;};}function patchUpdates(_0x32e78d){return function(_0x5190b7){try{jsonpatch[_0x441c('0x25')](_0x5190b7,_0x32e78d,!![]);}catch(_0x224eda){return BPromise[_0x441c('0x26')](_0x224eda);}return _0x5190b7[_0x441c('0x27')]();};}function saveUpdates(_0xe091cc,_0x4b0317){return function(_0x4ade3a){if(_0x4ade3a){return _0x4ade3a['update'](_0xe091cc)[_0x441c('0x28')](function(_0x485ab9){return _0x485ab9;});}return null;};}function removeEntity(_0x4b0727,_0x11f6a8){return function(_0x3e6b3a){if(_0x3e6b3a){return _0x3e6b3a[_0x441c('0x29')]()[_0x441c('0x28')](function(){_0x4b0727[_0x441c('0x1f')](0xcc)[_0x441c('0x1e')]();});}};}function handleEntityNotFound(_0x66977c,_0x71c04a){return function(_0x4f364b){if(!_0x4f364b){_0x66977c[_0x441c('0x1d')](0x194);}return _0x4f364b;};}function handleError(_0x4735a8,_0x42e57b){_0x42e57b=_0x42e57b||0x1f4;return function(_0x18f8db){logger[_0x441c('0x2a')](_0x18f8db[_0x441c('0x2b')]);if(_0x18f8db[_0x441c('0x2c')]){delete _0x18f8db[_0x441c('0x2c')];}_0x4735a8[_0x441c('0x1f')](_0x42e57b)[_0x441c('0x2d')](_0x18f8db);};}exports[_0x441c('0x2e')]=function(_0xf71c0e,_0x10c141){var _0x55b4cd={},_0x49675b={},_0x3d1f14={'count':0x0,'rows':[]};var _0x82b995=_[_0x441c('0x2f')](db[_0x441c('0x30')][_0x441c('0x31')],function(_0xc65343){return{'name':_0xc65343[_0x441c('0x32')],'type':_0xc65343[_0x441c('0x33')]['key']};});_0x49675b['model']=_[_0x441c('0x2f')](_0x82b995,'name');_0x49675b[_0x441c('0x34')]=_[_0x441c('0x35')](_0xf71c0e[_0x441c('0x34')]);_0x49675b[_0x441c('0x36')]=_['intersection'](_0x49675b['model'],_0x49675b[_0x441c('0x34')]);_0x55b4cd[_0x441c('0x37')]=_['intersection'](_0x49675b['model'],qs[_0x441c('0x38')](_0xf71c0e[_0x441c('0x34')]['fields']));_0x55b4cd[_0x441c('0x37')]=_0x55b4cd['attributes'][_0x441c('0x39')]?_0x55b4cd[_0x441c('0x37')]:_0x49675b[_0x441c('0x3a')];if(!_0xf71c0e[_0x441c('0x34')][_0x441c('0x3b')](_0x441c('0x3c'))){_0x55b4cd['limit']=qs[_0x441c('0x3d')](_0xf71c0e[_0x441c('0x34')][_0x441c('0x3d')]);_0x55b4cd[_0x441c('0x21')]=qs[_0x441c('0x21')](_0xf71c0e[_0x441c('0x34')][_0x441c('0x21')]);}_0x55b4cd[_0x441c('0x3e')]=qs[_0x441c('0x3f')](_0xf71c0e[_0x441c('0x34')][_0x441c('0x3f')]);_0x55b4cd[_0x441c('0x40')]=qs[_0x441c('0x36')](_['pick'](_0xf71c0e[_0x441c('0x34')],_0x49675b['filters']),_0x82b995);if(_0xf71c0e[_0x441c('0x34')][_0x441c('0x41')]){_0x55b4cd['where']=_['merge'](_0x55b4cd['where'],{'$or':_[_0x441c('0x2f')](_0x82b995,function(_0x2d583e){if(_0x2d583e[_0x441c('0x33')]!==_0x441c('0x42')){var _0x17aa69={};_0x17aa69[_0x2d583e[_0x441c('0x2c')]]={'$like':'%'+_0xf71c0e[_0x441c('0x34')][_0x441c('0x41')]+'%'};return _0x17aa69;}})});}_0x55b4cd=_[_0x441c('0x43')]({},_0x55b4cd,_0xf71c0e[_0x441c('0x44')]);var _0x265a65={'where':_0x55b4cd[_0x441c('0x40')]};return db[_0x441c('0x30')][_0x441c('0x23')](_0x265a65)[_0x441c('0x28')](function(_0x1a7618){_0x3d1f14['count']=_0x1a7618;if(_0xf71c0e[_0x441c('0x34')][_0x441c('0x45')]){_0x55b4cd[_0x441c('0x46')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x441c('0x47')](_0x55b4cd);})[_0x441c('0x28')](function(_0x10a92b){_0x3d1f14[_0x441c('0x48')]=_0x10a92b;return _0x3d1f14;})[_0x441c('0x28')](respondWithFilteredResult(_0x10c141,_0x55b4cd))[_0x441c('0x49')](handleError(_0x10c141,null));};exports[_0x441c('0x4a')]=function(_0x14eb45,_0x57368f){var _0x27cfe2={'raw':!![],'where':{'id':_0x14eb45[_0x441c('0x4b')]['id']}},_0x174bee={};_0x174bee[_0x441c('0x3a')]=_[_0x441c('0x35')](db[_0x441c('0x30')][_0x441c('0x31')]);_0x174bee[_0x441c('0x34')]=_[_0x441c('0x35')](_0x14eb45[_0x441c('0x34')]);_0x174bee[_0x441c('0x36')]=_[_0x441c('0x4c')](_0x174bee[_0x441c('0x3a')],_0x174bee['query']);_0x27cfe2[_0x441c('0x37')]=_[_0x441c('0x4c')](_0x174bee[_0x441c('0x3a')],qs[_0x441c('0x38')](_0x14eb45['query'][_0x441c('0x38')]));_0x27cfe2[_0x441c('0x37')]=_0x27cfe2[_0x441c('0x37')][_0x441c('0x39')]?_0x27cfe2[_0x441c('0x37')]:_0x174bee[_0x441c('0x3a')];if(_0x14eb45['query'][_0x441c('0x45')]){_0x27cfe2[_0x441c('0x46')]=[{'all':!![]}];}_0x27cfe2=_[_0x441c('0x43')]({},_0x27cfe2,_0x14eb45['options']);return db[_0x441c('0x30')]['find'](_0x27cfe2)[_0x441c('0x28')](handleEntityNotFound(_0x57368f,null))[_0x441c('0x28')](respondWithResult(_0x57368f,null))[_0x441c('0x49')](handleError(_0x57368f,null));};exports[_0x441c('0x4d')]=function(_0x47c3a0,_0x476aa0){return db[_0x441c('0x30')][_0x441c('0x4d')](_0x47c3a0['body'],{})[_0x441c('0x28')](respondWithResult(_0x476aa0,0xc9))[_0x441c('0x49')](handleError(_0x476aa0,null));};exports[_0x441c('0x4e')]=function(_0x46aa57,_0x39d465){if(_0x46aa57[_0x441c('0x4f')]['id']){delete _0x46aa57[_0x441c('0x4f')]['id'];}return db['SmsQueueReport'][_0x441c('0x50')]({'where':{'id':_0x46aa57[_0x441c('0x4b')]['id']}})[_0x441c('0x28')](handleEntityNotFound(_0x39d465,null))['then'](saveUpdates(_0x46aa57[_0x441c('0x4f')],null))['then'](respondWithResult(_0x39d465,null))[_0x441c('0x49')](handleError(_0x39d465,null));};exports['destroy']=function(_0x14c28f,_0x331387){return db[_0x441c('0x30')][_0x441c('0x50')]({'where':{'id':_0x14c28f[_0x441c('0x4b')]['id']}})[_0x441c('0x28')](handleEntityNotFound(_0x331387,null))['then'](removeEntity(_0x331387,null))[_0x441c('0x49')](handleError(_0x331387,null));};exports[_0x441c('0x51')]=function(_0x55b368,_0x62698d){return db['SmsQueueReport'][_0x441c('0x51')]()[_0x441c('0x28')](respondWithResult(_0x62698d,null))[_0x441c('0x49')](handleError(_0x62698d,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 3122901..9fa581a 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x236ac8,_0xa798d6){var _0x1ff538=function(_0x35c99e){while(--_0x35c99e){_0x236ac8['push'](_0x236ac8['shift']());}};_0x1ff538(++_0xa798d6);}(_0xe706,0xa3));var _0x6e70=function(_0x7dfb21,_0x54cbb5){_0x7dfb21=_0x7dfb21-0x0;var _0x544f45=_0xe706[_0x7dfb21];return _0x544f45;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x36ebad,_0x1ae718){var _0x41251d=function(_0x2aa70b){while(--_0x2aa70b){_0x36ebad['push'](_0x36ebad['shift']());}};_0x41251d(++_0x1ae718);}(_0x70e0,0x17b));var _0x070e=function(_0x5bc7bc,_0x54c6fd){_0x5bc7bc=_0x5bc7bc-0x0;var _0x539f81=_0x70e0[_0x5bc7bc];return _0x539f81;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index cd43f31..a4f3d4e 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 _0xab96=['UpdateSmsQueueReport','update','where','attributes','limit','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','message','SmsQueueReport,\x20%s,\x20%s','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw'];(function(_0x5ec454,_0xfcd77e){var _0x5ebf50=function(_0x29de85){while(--_0x29de85){_0x5ec454['push'](_0x5ec454['shift']());}};_0x5ebf50(++_0xfcd77e);}(_0xab96,0x144));var _0x6ab9=function(_0x40270d,_0xed9a9c){_0x40270d=_0x40270d-0x0;var _0x45f9d6=_0xab96[_0x40270d];return _0x45f9d6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6ab9('0x0'));var BPromise=require(_0x6ab9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ab9('0x2'));var db=require(_0x6ab9('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6ab9('0x4'));var config=require('../../config/environment');var jayson=require(_0x6ab9('0x5'));var client=jayson[_0x6ab9('0x6')][_0x6ab9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x53b951,_0x10b3c6,_0x5a5045){return new BPromise(function(_0x56547c,_0x3777ef){return client[_0x6ab9('0x8')](_0x53b951,_0x5a5045)[_0x6ab9('0x9')](function(_0x3592ab){logger[_0x6ab9('0xa')]('SmsQueueReport,\x20%s,\x20%s',_0x10b3c6,_0x6ab9('0xb'));logger[_0x6ab9('0xc')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x10b3c6,'request\x20sent',JSON[_0x6ab9('0xd')](_0x3592ab));if(_0x3592ab[_0x6ab9('0xe')]){if(_0x3592ab[_0x6ab9('0xe')]['code']===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x10b3c6,_0x3592ab[_0x6ab9('0xe')][_0x6ab9('0xf')]);return _0x3777ef(_0x3592ab[_0x6ab9('0xe')][_0x6ab9('0xf')]);}logger['error'](_0x6ab9('0x10'),_0x10b3c6,_0x3592ab[_0x6ab9('0xe')][_0x6ab9('0xf')]);return _0x56547c(_0x3592ab['error'][_0x6ab9('0xf')]);}else{logger[_0x6ab9('0xa')](_0x6ab9('0x10'),_0x10b3c6,'request\x20sent');_0x56547c(_0x3592ab[_0x6ab9('0x11')][_0x6ab9('0xf')]);}})[_0x6ab9('0x12')](function(_0xa4a0bc){logger[_0x6ab9('0xe')](_0x6ab9('0x10'),_0x10b3c6,_0xa4a0bc);_0x3777ef(_0xa4a0bc);});});}exports[_0x6ab9('0x13')]=function(_0x5d4861){var _0x2d0fd1=this;return new Promise(function(_0x35e8ff,_0x3757b5){return db[_0x6ab9('0x14')]['create'](_0x5d4861[_0x6ab9('0x15')],{'raw':_0x5d4861[_0x6ab9('0x16')]?_0x5d4861[_0x6ab9('0x16')][_0x6ab9('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x198df2){logger[_0x6ab9('0xa')]('CreateSmsQueueReport',_0x5d4861);logger[_0x6ab9('0xc')](_0x6ab9('0x13'),_0x5d4861,JSON[_0x6ab9('0xd')](_0x198df2));_0x35e8ff(_0x198df2);})[_0x6ab9('0x12')](function(_0x36eee7){logger['error'](_0x6ab9('0x13'),_0x36eee7[_0x6ab9('0xf')],_0x5d4861);_0x3757b5(_0x2d0fd1['error'](0x1f4,_0x36eee7[_0x6ab9('0xf')]));});});};exports[_0x6ab9('0x18')]=function(_0x1e6f75){var _0x356344=this;return new Promise(function(_0x9ddab2,_0x5f486e){return db[_0x6ab9('0x14')][_0x6ab9('0x19')](_0x1e6f75[_0x6ab9('0x15')],{'raw':_0x1e6f75[_0x6ab9('0x16')]?_0x1e6f75[_0x6ab9('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e6f75[_0x6ab9('0x16')]?_0x1e6f75['options'][_0x6ab9('0x1a')]||null:null,'attributes':_0x1e6f75[_0x6ab9('0x16')]?_0x1e6f75['options'][_0x6ab9('0x1b')]||null:null,'limit':_0x1e6f75[_0x6ab9('0x16')]?_0x1e6f75[_0x6ab9('0x16')][_0x6ab9('0x1c')]||null:null})[_0x6ab9('0x9')](function(_0x24be18){logger['info'](_0x6ab9('0x18'),_0x1e6f75);logger[_0x6ab9('0xc')]('UpdateSmsQueueReport',_0x1e6f75,JSON[_0x6ab9('0xd')](_0x24be18));_0x9ddab2(_0x24be18);})['catch'](function(_0x5d6ce5){logger[_0x6ab9('0xe')](_0x6ab9('0x18'),_0x5d6ce5['message'],_0x1e6f75);_0x5f486e(_0x356344[_0x6ab9('0xe')](0x1f4,_0x5d6ce5[_0x6ab9('0xf')]));});});}; \ No newline at end of file +var _0xa1b5=['attributes','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','update','where'];(function(_0x313f97,_0x57f7a0){var _0x1f13de=function(_0x289d34){while(--_0x289d34){_0x313f97['push'](_0x313f97['shift']());}};_0x1f13de(++_0x57f7a0);}(_0xa1b5,0x7d));var _0x5a1b=function(_0x1c0541,_0xab1087){_0x1c0541=_0x1c0541-0x0;var _0x30f9ce=_0xa1b5[_0x1c0541];return _0x30f9ce;};'use strict';var _=require(_0x5a1b('0x0'));var util=require(_0x5a1b('0x1'));var moment=require('moment');var BPromise=require(_0x5a1b('0x2'));var rs=require(_0x5a1b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a1b('0x4'))['db'];var utils=require(_0x5a1b('0x5'));var logger=require(_0x5a1b('0x6'))(_0x5a1b('0x7'));var config=require(_0x5a1b('0x8'));var jayson=require(_0x5a1b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19e140,_0x388aa1,_0x2605f7){return new BPromise(function(_0x34ee09,_0x367966){return client[_0x5a1b('0xa')](_0x19e140,_0x2605f7)[_0x5a1b('0xb')](function(_0x2c0da5){logger['info'](_0x5a1b('0xc'),_0x388aa1,_0x5a1b('0xd'));logger[_0x5a1b('0xe')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x388aa1,_0x5a1b('0xd'),JSON[_0x5a1b('0xf')](_0x2c0da5));if(_0x2c0da5[_0x5a1b('0x10')]){if(_0x2c0da5[_0x5a1b('0x10')][_0x5a1b('0x11')]===0x1f4){logger[_0x5a1b('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x388aa1,_0x2c0da5[_0x5a1b('0x10')][_0x5a1b('0x12')]);return _0x367966(_0x2c0da5[_0x5a1b('0x10')][_0x5a1b('0x12')]);}logger['error'](_0x5a1b('0xc'),_0x388aa1,_0x2c0da5[_0x5a1b('0x10')][_0x5a1b('0x12')]);return _0x34ee09(_0x2c0da5['error'][_0x5a1b('0x12')]);}else{logger[_0x5a1b('0x13')](_0x5a1b('0xc'),_0x388aa1,_0x5a1b('0xd'));_0x34ee09(_0x2c0da5['result'][_0x5a1b('0x12')]);}})[_0x5a1b('0x14')](function(_0x3c9ccb){logger['error'](_0x5a1b('0xc'),_0x388aa1,_0x3c9ccb);_0x367966(_0x3c9ccb);});});}exports[_0x5a1b('0x15')]=function(_0x152984){var _0x1c8ac8=this;return new Promise(function(_0x410048,_0x5dd558){return db[_0x5a1b('0x16')][_0x5a1b('0x17')](_0x152984[_0x5a1b('0x18')],{'raw':_0x152984[_0x5a1b('0x19')]?_0x152984['options'][_0x5a1b('0x1a')]===undefined?!![]:![]:!![]})[_0x5a1b('0xb')](function(_0x5d742a){logger['info'](_0x5a1b('0x15'),_0x152984);logger[_0x5a1b('0xe')](_0x5a1b('0x15'),_0x152984,JSON[_0x5a1b('0xf')](_0x5d742a));_0x410048(_0x5d742a);})[_0x5a1b('0x14')](function(_0x370567){logger[_0x5a1b('0x10')](_0x5a1b('0x15'),_0x370567['message'],_0x152984);_0x5dd558(_0x1c8ac8['error'](0x1f4,_0x370567[_0x5a1b('0x12')]));});});};exports[_0x5a1b('0x1b')]=function(_0x46f90c){var _0xfb3a03=this;return new Promise(function(_0x28685e,_0x30e14d){return db[_0x5a1b('0x16')][_0x5a1b('0x1c')](_0x46f90c[_0x5a1b('0x18')],{'raw':_0x46f90c['options']?_0x46f90c[_0x5a1b('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46f90c[_0x5a1b('0x19')]?_0x46f90c[_0x5a1b('0x19')][_0x5a1b('0x1d')]||null:null,'attributes':_0x46f90c[_0x5a1b('0x19')]?_0x46f90c[_0x5a1b('0x19')][_0x5a1b('0x1e')]||null:null,'limit':_0x46f90c[_0x5a1b('0x19')]?_0x46f90c[_0x5a1b('0x19')]['limit']||null:null})[_0x5a1b('0xb')](function(_0x3a1251){logger['info'](_0x5a1b('0x1b'),_0x46f90c);logger[_0x5a1b('0xe')](_0x5a1b('0x1b'),_0x46f90c,JSON['stringify'](_0x3a1251));_0x28685e(_0x3a1251);})[_0x5a1b('0x14')](function(_0x115150){logger[_0x5a1b('0x10')](_0x5a1b('0x1b'),_0x115150[_0x5a1b('0x12')],_0x46f90c);_0x30e14d(_0xfb3a03[_0x5a1b('0x10')](0x1f4,_0x115150[_0x5a1b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 956d2a9..fa9472e 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 _0x5fc3=['/:id','show','post','create','put','update','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','describe'];(function(_0x5ee8d0,_0xb64cdb){var _0x4a92a7=function(_0x38ac49){while(--_0x38ac49){_0x5ee8d0['push'](_0x5ee8d0['shift']());}};_0x4a92a7(++_0xb64cdb);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x5fc3[_0x4d1ee9];return _0x9a5456;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc492=['/:id','post','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe'];(function(_0x2712fb,_0x205d50){var _0x433b32=function(_0x4479bf){while(--_0x4479bf){_0x2712fb['push'](_0x2712fb['shift']());}};_0x433b32(++_0x205d50);}(_0xc492,0xd7));var _0x2c49=function(_0x2197fb,_0x30f3d0){_0x2197fb=_0x2197fb-0x0;var _0x591fab=_0xc492[_0x2197fb];return _0x591fab;};'use strict';var multer=require(_0x2c49('0x0'));var util=require(_0x2c49('0x1'));var path=require(_0x2c49('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2c49('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2c49('0x4'));var config=require(_0x2c49('0x5'));var controller=require('./smsTransferReport.controller');router[_0x2c49('0x6')]('/',auth['isAuthenticated'](),controller[_0x2c49('0x7')]);router[_0x2c49('0x6')]('/describe',auth[_0x2c49('0x8')](),controller[_0x2c49('0x9')]);router[_0x2c49('0x6')](_0x2c49('0xa'),auth[_0x2c49('0x8')](),controller['show']);router[_0x2c49('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x2c49('0x8')](),controller['update']);router[_0x2c49('0xc')](_0x2c49('0xa'),auth['isAuthenticated'](),controller[_0x2c49('0xd')]);module[_0x2c49('0xe')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index f1495e2..bc8232a 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x249594,_0x40840b){var _0xe8148a=function(_0x1b95b0){while(--_0x1b95b0){_0x249594['push'](_0x249594['shift']());}};_0xe8148a(++_0x40840b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x40911a,_0x55ec99){_0x40911a=_0x40911a-0x0;var _0x27e8e3=_0xcb91[_0x40911a];return _0x27e8e3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x58e127,_0x1daf32){_0x58e127=_0x58e127-0x0;var _0x27f631=_0x9bde[_0x58e127];return _0x27f631;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 0e90c1d..df6c929 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 _0x9861=['type','options','then','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','json','undefined','limit','count','Content-Range','apply','reject','update','destroy','error','name','index','map','SmsTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge'];(function(_0x414297,_0x18578e){var _0x51ea47=function(_0x4a7b22){while(--_0x4a7b22){_0x414297['push'](_0x414297['shift']());}};_0x51ea47(++_0x18578e);}(_0x9861,0x1f1));var _0x1986=function(_0x1cc43b,_0x8ecaff){_0x1cc43b=_0x1cc43b-0x0;var _0x531976=_0x9861[_0x1cc43b];return _0x531976;};'use strict';var emlformat=require(_0x1986('0x0'));var rimraf=require(_0x1986('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1986('0x2'));var BPromise=require(_0x1986('0x3'));var Mustache=require(_0x1986('0x4'));var util=require(_0x1986('0x5'));var path=require(_0x1986('0x6'));var sox=require(_0x1986('0x7'));var csv=require(_0x1986('0x8'));var ejs=require(_0x1986('0x9'));var fs=require('fs');var fs_extra=require(_0x1986('0xa'));var _=require(_0x1986('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1986('0xc'));var toCsv=require(_0x1986('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1986('0xd'));var authService=require(_0x1986('0xe'));var qs=require(_0x1986('0xf'));var as=require(_0x1986('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1986('0x11'))(_0x1986('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1986('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x295ea5,_0x447045){_0x447045=_0x447045||0xcc;return function(_0x44c427){if(_0x44c427){return _0x295ea5[_0x1986('0x14')](_0x447045);}return _0x295ea5[_0x1986('0x15')](_0x447045)['end']();};}function respondWithResult(_0x6fc47c,_0x4e3f03){_0x4e3f03=_0x4e3f03||0xc8;return function(_0x527b89){if(_0x527b89){return _0x6fc47c[_0x1986('0x15')](_0x4e3f03)[_0x1986('0x16')](_0x527b89);}};}function respondWithFilteredResult(_0x414123,_0xf34830){return function(_0x4e456a){if(_0x4e456a){var _0x45d8ff=typeof _0xf34830['offset']===_0x1986('0x17')&&typeof _0xf34830[_0x1986('0x18')]===_0x1986('0x17');var _0x2c7768=_0x4e456a[_0x1986('0x19')];var _0x985894=_0x45d8ff?0x0:_0xf34830['offset'];var _0x192824=_0x45d8ff?_0x4e456a['count']:_0xf34830['offset']+_0xf34830['limit'];var _0x2a42a5;if(_0x192824>=_0x2c7768){_0x192824=_0x2c7768;_0x2a42a5=0xc8;}else{_0x2a42a5=0xce;}_0x414123[_0x1986('0x15')](_0x2a42a5);return _0x414123['set'](_0x1986('0x1a'),_0x985894+'-'+_0x192824+'/'+_0x2c7768)[_0x1986('0x16')](_0x4e456a);}return null;};}function patchUpdates(_0x3d1b6f){return function(_0x23e214){try{jsonpatch[_0x1986('0x1b')](_0x23e214,_0x3d1b6f,!![]);}catch(_0x2fdddb){return BPromise[_0x1986('0x1c')](_0x2fdddb);}return _0x23e214['save']();};}function saveUpdates(_0x574d5c,_0x4e0f6b){return function(_0x109555){if(_0x109555){return _0x109555[_0x1986('0x1d')](_0x574d5c)['then'](function(_0x1512ec){return _0x1512ec;});}return null;};}function removeEntity(_0x3ef318,_0x32ab60){return function(_0x2065ca){if(_0x2065ca){return _0x2065ca[_0x1986('0x1e')]()['then'](function(){_0x3ef318['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x530bf4,_0x137247){return function(_0x41173d){if(!_0x41173d){_0x530bf4['sendStatus'](0x194);}return _0x41173d;};}function handleError(_0x113458,_0x352a2c){_0x352a2c=_0x352a2c||0x1f4;return function(_0xbaa56e){logger[_0x1986('0x1f')](_0xbaa56e['stack']);if(_0xbaa56e['name']){delete _0xbaa56e[_0x1986('0x20')];}_0x113458[_0x1986('0x15')](_0x352a2c)['send'](_0xbaa56e);};}exports[_0x1986('0x21')]=function(_0x13e302,_0x490619){var _0x31dca5={},_0x223c5d={},_0x4b3740={'count':0x0,'rows':[]};var _0x286071=_[_0x1986('0x22')](db[_0x1986('0x23')]['rawAttributes'],function(_0x150c5b){return{'name':_0x150c5b[_0x1986('0x24')],'type':_0x150c5b['type'][_0x1986('0x25')]};});_0x223c5d[_0x1986('0x26')]=_[_0x1986('0x22')](_0x286071,_0x1986('0x20'));_0x223c5d[_0x1986('0x27')]=_[_0x1986('0x28')](_0x13e302[_0x1986('0x27')]);_0x223c5d[_0x1986('0x29')]=_[_0x1986('0x2a')](_0x223c5d[_0x1986('0x26')],_0x223c5d['query']);_0x31dca5[_0x1986('0x2b')]=_['intersection'](_0x223c5d[_0x1986('0x26')],qs[_0x1986('0x2c')](_0x13e302[_0x1986('0x27')][_0x1986('0x2c')]));_0x31dca5['attributes']=_0x31dca5[_0x1986('0x2b')][_0x1986('0x2d')]?_0x31dca5['attributes']:_0x223c5d['model'];if(!_0x13e302[_0x1986('0x27')][_0x1986('0x2e')](_0x1986('0x2f'))){_0x31dca5[_0x1986('0x18')]=qs[_0x1986('0x18')](_0x13e302[_0x1986('0x27')]['limit']);_0x31dca5[_0x1986('0x30')]=qs[_0x1986('0x30')](_0x13e302[_0x1986('0x27')]['offset']);}_0x31dca5[_0x1986('0x31')]=qs[_0x1986('0x32')](_0x13e302[_0x1986('0x27')][_0x1986('0x32')]);_0x31dca5[_0x1986('0x33')]=qs[_0x1986('0x29')](_[_0x1986('0x34')](_0x13e302[_0x1986('0x27')],_0x223c5d[_0x1986('0x29')]),_0x286071);if(_0x13e302[_0x1986('0x27')][_0x1986('0x35')]){_0x31dca5[_0x1986('0x33')]=_[_0x1986('0x36')](_0x31dca5['where'],{'$or':_[_0x1986('0x22')](_0x286071,function(_0x3b18aa){if(_0x3b18aa[_0x1986('0x37')]!=='VIRTUAL'){var _0x3e499d={};_0x3e499d[_0x3b18aa['name']]={'$like':'%'+_0x13e302[_0x1986('0x27')][_0x1986('0x35')]+'%'};return _0x3e499d;}})});}_0x31dca5=_[_0x1986('0x36')]({},_0x31dca5,_0x13e302[_0x1986('0x38')]);var _0x4e4a41={'where':_0x31dca5[_0x1986('0x33')]};return db[_0x1986('0x23')]['count'](_0x4e4a41)[_0x1986('0x39')](function(_0x5c877a){_0x4b3740[_0x1986('0x19')]=_0x5c877a;if(_0x13e302['query'][_0x1986('0x3a')]){_0x31dca5['include']=[{'all':!![]}];}return db[_0x1986('0x23')][_0x1986('0x3b')](_0x31dca5);})[_0x1986('0x39')](function(_0x4d0e41){_0x4b3740[_0x1986('0x3c')]=_0x4d0e41;return _0x4b3740;})['then'](respondWithFilteredResult(_0x490619,_0x31dca5))[_0x1986('0x3d')](handleError(_0x490619,null));};exports[_0x1986('0x3e')]=function(_0x506f90,_0xbf079f){var _0x5137dd={'raw':!![],'where':{'id':_0x506f90[_0x1986('0x3f')]['id']}},_0x3b09d8={};_0x3b09d8[_0x1986('0x26')]=_[_0x1986('0x28')](db[_0x1986('0x23')]['rawAttributes']);_0x3b09d8[_0x1986('0x27')]=_[_0x1986('0x28')](_0x506f90['query']);_0x3b09d8[_0x1986('0x29')]=_[_0x1986('0x2a')](_0x3b09d8[_0x1986('0x26')],_0x3b09d8[_0x1986('0x27')]);_0x5137dd[_0x1986('0x2b')]=_['intersection'](_0x3b09d8[_0x1986('0x26')],qs[_0x1986('0x2c')](_0x506f90[_0x1986('0x27')]['fields']));_0x5137dd[_0x1986('0x2b')]=_0x5137dd[_0x1986('0x2b')]['length']?_0x5137dd[_0x1986('0x2b')]:_0x3b09d8[_0x1986('0x26')];if(_0x506f90['query'][_0x1986('0x3a')]){_0x5137dd[_0x1986('0x40')]=[{'all':!![]}];}_0x5137dd=_[_0x1986('0x36')]({},_0x5137dd,_0x506f90[_0x1986('0x38')]);return db[_0x1986('0x23')][_0x1986('0x41')](_0x5137dd)['then'](handleEntityNotFound(_0xbf079f,null))[_0x1986('0x39')](respondWithResult(_0xbf079f,null))[_0x1986('0x3d')](handleError(_0xbf079f,null));};exports[_0x1986('0x42')]=function(_0x540e30,_0x87314a){return db['SmsTransferReport'][_0x1986('0x42')](_0x540e30[_0x1986('0x43')],{})['then'](respondWithResult(_0x87314a,0xc9))['catch'](handleError(_0x87314a,null));};exports[_0x1986('0x1d')]=function(_0x461073,_0x14881a){if(_0x461073['body']['id']){delete _0x461073[_0x1986('0x43')]['id'];}return db[_0x1986('0x23')][_0x1986('0x41')]({'where':{'id':_0x461073[_0x1986('0x3f')]['id']}})[_0x1986('0x39')](handleEntityNotFound(_0x14881a,null))[_0x1986('0x39')](saveUpdates(_0x461073['body'],null))['then'](respondWithResult(_0x14881a,null))[_0x1986('0x3d')](handleError(_0x14881a,null));};exports[_0x1986('0x1e')]=function(_0x23745e,_0x3b451d){return db[_0x1986('0x23')][_0x1986('0x41')]({'where':{'id':_0x23745e[_0x1986('0x3f')]['id']}})[_0x1986('0x39')](handleEntityNotFound(_0x3b451d,null))['then'](removeEntity(_0x3b451d,null))['catch'](handleError(_0x3b451d,null));};exports['describe']=function(_0x2ddc05,_0x4a8536){return db[_0x1986('0x23')][_0x1986('0x44')]()[_0x1986('0x39')](respondWithResult(_0x4a8536,null))[_0x1986('0x3d')](handleError(_0x4a8536,null));}; \ No newline at end of file +var _0x716a=['attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','rawAttributes','include','create','body','catch','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','apply','save','update','then','destroy','error','stack','name','send','map','SmsTransferReport','type','key','query','keys','filters','intersection','model'];(function(_0x25ede0,_0x29dc39){var _0x16fc37=function(_0x13e4d1){while(--_0x13e4d1){_0x25ede0['push'](_0x25ede0['shift']());}};_0x16fc37(++_0x29dc39);}(_0x716a,0xf1));var _0xa716=function(_0x2ff4bd,_0x4780a6){_0x2ff4bd=_0x2ff4bd-0x0;var _0x28edc6=_0x716a[_0x2ff4bd];return _0x28edc6;};'use strict';var emlformat=require(_0xa716('0x0'));var rimraf=require(_0xa716('0x1'));var zipdir=require(_0xa716('0x2'));var jsonpatch=require(_0xa716('0x3'));var rp=require(_0xa716('0x4'));var moment=require(_0xa716('0x5'));var BPromise=require(_0xa716('0x6'));var Mustache=require('mustache');var util=require(_0xa716('0x7'));var path=require(_0xa716('0x8'));var sox=require(_0xa716('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa716('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa716('0xb'));var jsforce=require(_0xa716('0xc'));var deskjs=require(_0xa716('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa716('0xe'));var Papa=require(_0xa716('0xf'));var Redis=require('ioredis');var authService=require(_0xa716('0x10'));var qs=require(_0xa716('0x11'));var as=require(_0xa716('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa716('0x13'));var utils=require('../../config/utils');var config=require(_0xa716('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa716('0x15'))['db'];function respondWithStatusCode(_0x33646b,_0x36ebae){_0x36ebae=_0x36ebae||0xcc;return function(_0x2051ca){if(_0x2051ca){return _0x33646b[_0xa716('0x16')](_0x36ebae);}return _0x33646b['status'](_0x36ebae)[_0xa716('0x17')]();};}function respondWithResult(_0x7c8f55,_0x5750cf){_0x5750cf=_0x5750cf||0xc8;return function(_0x189572){if(_0x189572){return _0x7c8f55['status'](_0x5750cf)[_0xa716('0x18')](_0x189572);}};}function respondWithFilteredResult(_0x306903,_0x595c79){return function(_0x5ec38e){if(_0x5ec38e){var _0x538d0b=typeof _0x595c79[_0xa716('0x19')]===_0xa716('0x1a')&&typeof _0x595c79['limit']===_0xa716('0x1a');var _0x44a996=_0x5ec38e[_0xa716('0x1b')];var _0x551af1=_0x538d0b?0x0:_0x595c79[_0xa716('0x19')];var _0x22538f=_0x538d0b?_0x5ec38e[_0xa716('0x1b')]:_0x595c79[_0xa716('0x19')]+_0x595c79['limit'];var _0x377a5c;if(_0x22538f>=_0x44a996){_0x22538f=_0x44a996;_0x377a5c=0xc8;}else{_0x377a5c=0xce;}_0x306903[_0xa716('0x1c')](_0x377a5c);return _0x306903['set']('Content-Range',_0x551af1+'-'+_0x22538f+'/'+_0x44a996)['json'](_0x5ec38e);}return null;};}function patchUpdates(_0x5f065c){return function(_0x2494d7){try{jsonpatch[_0xa716('0x1d')](_0x2494d7,_0x5f065c,!![]);}catch(_0x46d491){return BPromise['reject'](_0x46d491);}return _0x2494d7[_0xa716('0x1e')]();};}function saveUpdates(_0x55e9df,_0x54c9d9){return function(_0x2b6e9f){if(_0x2b6e9f){return _0x2b6e9f[_0xa716('0x1f')](_0x55e9df)[_0xa716('0x20')](function(_0x3b5d92){return _0x3b5d92;});}return null;};}function removeEntity(_0x172f55,_0x44ab0e){return function(_0x22e08a){if(_0x22e08a){return _0x22e08a[_0xa716('0x21')]()[_0xa716('0x20')](function(){_0x172f55[_0xa716('0x1c')](0xcc)[_0xa716('0x17')]();});}};}function handleEntityNotFound(_0x37e0be,_0x28653c){return function(_0x264bc9){if(!_0x264bc9){_0x37e0be[_0xa716('0x16')](0x194);}return _0x264bc9;};}function handleError(_0x29d0fe,_0x5df517){_0x5df517=_0x5df517||0x1f4;return function(_0x4ab356){logger[_0xa716('0x22')](_0x4ab356[_0xa716('0x23')]);if(_0x4ab356[_0xa716('0x24')]){delete _0x4ab356[_0xa716('0x24')];}_0x29d0fe[_0xa716('0x1c')](_0x5df517)[_0xa716('0x25')](_0x4ab356);};}exports['index']=function(_0x563922,_0x12e233){var _0xa2b3ca={},_0x188d82={},_0x46189c={'count':0x0,'rows':[]};var _0x4e5ba9=_[_0xa716('0x26')](db[_0xa716('0x27')]['rawAttributes'],function(_0x531153){return{'name':_0x531153['fieldName'],'type':_0x531153[_0xa716('0x28')][_0xa716('0x29')]};});_0x188d82['model']=_[_0xa716('0x26')](_0x4e5ba9,_0xa716('0x24'));_0x188d82[_0xa716('0x2a')]=_[_0xa716('0x2b')](_0x563922['query']);_0x188d82[_0xa716('0x2c')]=_[_0xa716('0x2d')](_0x188d82[_0xa716('0x2e')],_0x188d82['query']);_0xa2b3ca[_0xa716('0x2f')]=_['intersection'](_0x188d82[_0xa716('0x2e')],qs[_0xa716('0x30')](_0x563922[_0xa716('0x2a')][_0xa716('0x30')]));_0xa2b3ca[_0xa716('0x2f')]=_0xa2b3ca[_0xa716('0x2f')][_0xa716('0x31')]?_0xa2b3ca[_0xa716('0x2f')]:_0x188d82[_0xa716('0x2e')];if(!_0x563922[_0xa716('0x2a')][_0xa716('0x32')](_0xa716('0x33'))){_0xa2b3ca[_0xa716('0x34')]=qs[_0xa716('0x34')](_0x563922['query'][_0xa716('0x34')]);_0xa2b3ca[_0xa716('0x19')]=qs['offset'](_0x563922['query'][_0xa716('0x19')]);}_0xa2b3ca[_0xa716('0x35')]=qs[_0xa716('0x36')](_0x563922[_0xa716('0x2a')][_0xa716('0x36')]);_0xa2b3ca[_0xa716('0x37')]=qs[_0xa716('0x2c')](_[_0xa716('0x38')](_0x563922[_0xa716('0x2a')],_0x188d82[_0xa716('0x2c')]),_0x4e5ba9);if(_0x563922[_0xa716('0x2a')][_0xa716('0x39')]){_0xa2b3ca[_0xa716('0x37')]=_[_0xa716('0x3a')](_0xa2b3ca[_0xa716('0x37')],{'$or':_[_0xa716('0x26')](_0x4e5ba9,function(_0x58f3f6){if(_0x58f3f6[_0xa716('0x28')]!==_0xa716('0x3b')){var _0x13e111={};_0x13e111[_0x58f3f6[_0xa716('0x24')]]={'$like':'%'+_0x563922[_0xa716('0x2a')][_0xa716('0x39')]+'%'};return _0x13e111;}})});}_0xa2b3ca=_[_0xa716('0x3a')]({},_0xa2b3ca,_0x563922[_0xa716('0x3c')]);var _0x37ad3a={'where':_0xa2b3ca[_0xa716('0x37')]};return db[_0xa716('0x27')][_0xa716('0x1b')](_0x37ad3a)['then'](function(_0x40e662){_0x46189c['count']=_0x40e662;if(_0x563922[_0xa716('0x2a')][_0xa716('0x3d')]){_0xa2b3ca['include']=[{'all':!![]}];}return db[_0xa716('0x27')]['findAll'](_0xa2b3ca);})[_0xa716('0x20')](function(_0xea7398){_0x46189c[_0xa716('0x3e')]=_0xea7398;return _0x46189c;})[_0xa716('0x20')](respondWithFilteredResult(_0x12e233,_0xa2b3ca))['catch'](handleError(_0x12e233,null));};exports[_0xa716('0x3f')]=function(_0x36568d,_0x24ea3e){var _0x3cc4c2={'raw':!![],'where':{'id':_0x36568d[_0xa716('0x40')]['id']}},_0x22f4f0={};_0x22f4f0[_0xa716('0x2e')]=_[_0xa716('0x2b')](db['SmsTransferReport'][_0xa716('0x41')]);_0x22f4f0[_0xa716('0x2a')]=_[_0xa716('0x2b')](_0x36568d[_0xa716('0x2a')]);_0x22f4f0[_0xa716('0x2c')]=_['intersection'](_0x22f4f0['model'],_0x22f4f0[_0xa716('0x2a')]);_0x3cc4c2[_0xa716('0x2f')]=_[_0xa716('0x2d')](_0x22f4f0[_0xa716('0x2e')],qs[_0xa716('0x30')](_0x36568d['query'][_0xa716('0x30')]));_0x3cc4c2[_0xa716('0x2f')]=_0x3cc4c2[_0xa716('0x2f')]['length']?_0x3cc4c2[_0xa716('0x2f')]:_0x22f4f0[_0xa716('0x2e')];if(_0x36568d[_0xa716('0x2a')][_0xa716('0x3d')]){_0x3cc4c2[_0xa716('0x42')]=[{'all':!![]}];}_0x3cc4c2=_['merge']({},_0x3cc4c2,_0x36568d[_0xa716('0x3c')]);return db[_0xa716('0x27')]['find'](_0x3cc4c2)['then'](handleEntityNotFound(_0x24ea3e,null))[_0xa716('0x20')](respondWithResult(_0x24ea3e,null))['catch'](handleError(_0x24ea3e,null));};exports[_0xa716('0x43')]=function(_0x33fda,_0x23c10f){return db[_0xa716('0x27')]['create'](_0x33fda[_0xa716('0x44')],{})[_0xa716('0x20')](respondWithResult(_0x23c10f,0xc9))[_0xa716('0x45')](handleError(_0x23c10f,null));};exports[_0xa716('0x1f')]=function(_0x560163,_0x32d990){if(_0x560163[_0xa716('0x44')]['id']){delete _0x560163['body']['id'];}return db[_0xa716('0x27')][_0xa716('0x46')]({'where':{'id':_0x560163[_0xa716('0x40')]['id']}})[_0xa716('0x20')](handleEntityNotFound(_0x32d990,null))[_0xa716('0x20')](saveUpdates(_0x560163[_0xa716('0x44')],null))[_0xa716('0x20')](respondWithResult(_0x32d990,null))[_0xa716('0x45')](handleError(_0x32d990,null));};exports[_0xa716('0x21')]=function(_0x527988,_0x55bb91){return db[_0xa716('0x27')][_0xa716('0x46')]({'where':{'id':_0x527988[_0xa716('0x40')]['id']}})[_0xa716('0x20')](handleEntityNotFound(_0x55bb91,null))[_0xa716('0x20')](removeEntity(_0x55bb91,null))[_0xa716('0x45')](handleError(_0x55bb91,null));};exports[_0xa716('0x47')]=function(_0x959a57,_0x25c5f6){return db[_0xa716('0x27')][_0xa716('0x47')]()[_0xa716('0x20')](respondWithResult(_0x25c5f6,null))['catch'](handleError(_0x25c5f6,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 814cfaf..cb181e6 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 _0xea4e=['path','../../config/environment','exports','define','SmsTransferReport','uniqueid','util','../../config/logger','api','moment','request-promise'];(function(_0x2d7a73,_0x33105f){var _0x1aabe0=function(_0x54d2f8){while(--_0x54d2f8){_0x2d7a73['push'](_0x2d7a73['shift']());}};_0x1aabe0(++_0x33105f);}(_0xea4e,0x7f));var _0xeea4=function(_0x6cf5ec,_0x194d2e){_0x6cf5ec=_0x6cf5ec-0x0;var _0x271c4f=_0xea4e[_0x6cf5ec];return _0x271c4f;};'use strict';var _=require('lodash');var util=require(_0xeea4('0x0'));var logger=require(_0xeea4('0x1'))(_0xeea4('0x2'));var moment=require(_0xeea4('0x3'));var BPromise=require('bluebird');var rp=require(_0xeea4('0x4'));var fs=require('fs');var path=require(_0xeea4('0x5'));var rimraf=require('rimraf');var config=require(_0xeea4('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0xeea4('0x7')]=function(_0xd68494,_0x23d8d6){return _0xd68494[_0xeea4('0x8')](_0xeea4('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xeea4('0xa'),'fields':[_0xeea4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd449=['../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','path','rimraf'];(function(_0x4ec29d,_0x5f3ea3){var _0xcc3ce1=function(_0x45b458){while(--_0x45b458){_0x4ec29d['push'](_0x4ec29d['shift']());}};_0xcc3ce1(++_0x5f3ea3);}(_0xd449,0x153));var _0x9d44=function(_0x152449,_0x49f41d){_0x152449=_0x152449-0x0;var _0x5b58b2=_0xd449[_0x152449];return _0x5b58b2;};'use strict';var _=require(_0x9d44('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d44('0x1'));var rimraf=require(_0x9d44('0x2'));var config=require(_0x9d44('0x3'));var attributes=require(_0x9d44('0x4'));module['exports']=function(_0x3ad7ba,_0x128f0c){return _0x3ad7ba[_0x9d44('0x5')](_0x9d44('0x6'),attributes,{'tableName':_0x9d44('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9d44('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index ad639f0..30261a1 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 _0x59c3=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x27c00a,_0x5c3f23){var _0x1ad46d=function(_0x4aac9a){while(--_0x4aac9a){_0x27c00a['push'](_0x27c00a['shift']());}};_0x1ad46d(++_0x5c3f23);}(_0x59c3,0x133));var _0x359c=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x59c3[_0x32d457];return _0x338386;};'use strict';var _=require(_0x359c('0x0'));var util=require(_0x359c('0x1'));var moment=require(_0x359c('0x2'));var BPromise=require(_0x359c('0x3'));var rs=require(_0x359c('0x4'));var fs=require('fs');var Redis=require(_0x359c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x359c('0x6'));var logger=require(_0x359c('0x7'))(_0x359c('0x8'));var config=require(_0x359c('0x9'));var jayson=require(_0x359c('0xa'));var client=jayson[_0x359c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9c107b,_0x58b390,_0x3a7d8e){return new BPromise(function(_0x335963,_0x44ae3a){return client[_0x359c('0xc')](_0x9c107b,_0x3a7d8e)['then'](function(_0x1fb4c8){logger['info'](_0x359c('0xd'),_0x58b390,_0x359c('0xe'));logger[_0x359c('0xf')](_0x359c('0x10'),_0x58b390,_0x359c('0xe'),JSON[_0x359c('0x11')](_0x1fb4c8));if(_0x1fb4c8['error']){if(_0x1fb4c8[_0x359c('0x12')][_0x359c('0x13')]===0x1f4){logger[_0x359c('0x12')](_0x359c('0xd'),_0x58b390,_0x1fb4c8[_0x359c('0x12')][_0x359c('0x14')]);return _0x44ae3a(_0x1fb4c8[_0x359c('0x12')][_0x359c('0x14')]);}logger[_0x359c('0x12')](_0x359c('0xd'),_0x58b390,_0x1fb4c8[_0x359c('0x12')][_0x359c('0x14')]);return _0x335963(_0x1fb4c8['error'][_0x359c('0x14')]);}else{logger[_0x359c('0x15')]('SmsTransferReport,\x20%s,\x20%s',_0x58b390,_0x359c('0xe'));_0x335963(_0x1fb4c8[_0x359c('0x16')][_0x359c('0x14')]);}})[_0x359c('0x17')](function(_0x421bab){logger[_0x359c('0x12')](_0x359c('0xd'),_0x58b390,_0x421bab);_0x44ae3a(_0x421bab);});});} \ No newline at end of file +var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5dbaec,_0x3626b8){var _0x590069=function(_0x48ffbd){while(--_0x48ffbd){_0x5dbaec['push'](_0x5dbaec['shift']());}};_0x590069(++_0x3626b8);}(_0xa41a,0x6b));var _0xaa41=function(_0xfb3b4e,_0x586019){_0xfb3b4e=_0xfb3b4e-0x0;var _0x47730b=_0xa41a[_0xfb3b4e];return _0x47730b;};'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/sound/index.js b/server/api/sound/index.js index 4605926..32350fa 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 _0x9db3=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','%s-%s%s','basename','extname','now','single','file','create','put','update','delete','exports','multer','util','path'];(function(_0x5016c9,_0x57cdf0){var _0x5371ee=function(_0x494af9){while(--_0x494af9){_0x5016c9['push'](_0x5016c9['shift']());}};_0x5371ee(++_0x57cdf0);}(_0x9db3,0xd6));var _0x39db=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x9db3[_0x4a53d];return _0x27410e;};'use strict';var multer=require(_0x39db('0x0'));var util=require(_0x39db('0x1'));var path=require(_0x39db('0x2'));var timeout=require(_0x39db('0x3'));var express=require('express');var router=express[_0x39db('0x4')]();var fs_extra=require(_0x39db('0x5'));var auth=require(_0x39db('0x6'));var interaction=require(_0x39db('0x7'));var config=require('../../config/environment');var controller=require(_0x39db('0x8'));router[_0x39db('0x9')]('/',auth['isAuthenticated'](),controller[_0x39db('0xa')]);router[_0x39db('0x9')](_0x39db('0xb'),auth[_0x39db('0xc')](),controller[_0x39db('0xd')]);router[_0x39db('0x9')](_0x39db('0xe'),auth[_0x39db('0xc')](),controller[_0x39db('0xf')]);var upload=multer({'storage':multer[_0x39db('0x10')]({'destination':function(_0xccfc5d,_0x272d1b,_0x2b0471){_0x2b0471(null,path[_0x39db('0x11')](config['root'],_0x39db('0x12')));},'filename':function(_0x5f0b7d,_0x10b59a,_0x3ce7d0){_0x10b59a['originalname']=_0x10b59a[_0x39db('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3ce7d0(null,util['format'](_0x39db('0x14'),path[_0x39db('0x15')](_0x10b59a['originalname'],path[_0x39db('0x16')](_0x10b59a['originalname'])),Date[_0x39db('0x17')](),path[_0x39db('0x16')](_0x10b59a[_0x39db('0x13')])));}})});router['post']('/',upload[_0x39db('0x18')](_0x39db('0x19')),controller[_0x39db('0x1a')]);router[_0x39db('0x1b')](_0x39db('0xb'),auth[_0x39db('0xc')](),controller[_0x39db('0x1c')]);router[_0x39db('0x1d')](_0x39db('0xb'),auth[_0x39db('0xc')](),controller[_0x39db('0x1d')]);module[_0x39db('0x1e')]=router; \ No newline at end of file +var _0xec9f=['/:id','isAuthenticated','show','/:id/download','diskStorage','join','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get'];(function(_0x3e2300,_0x562761){var _0x164a5b=function(_0x551480){while(--_0x551480){_0x3e2300['push'](_0x3e2300['shift']());}};_0x164a5b(++_0x562761);}(_0xec9f,0x8c));var _0xfec9=function(_0x5e0079,_0xac03db){_0x5e0079=_0x5e0079-0x0;var _0x34a9b7=_0xec9f[_0x5e0079];return _0x34a9b7;};'use strict';var multer=require(_0xfec9('0x0'));var util=require(_0xfec9('0x1'));var path=require('path');var timeout=require(_0xfec9('0x2'));var express=require(_0xfec9('0x3'));var router=express[_0xfec9('0x4')]();var fs_extra=require(_0xfec9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfec9('0x6'));var config=require(_0xfec9('0x7'));var controller=require(_0xfec9('0x8'));router[_0xfec9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfec9('0x9')](_0xfec9('0xa'),auth[_0xfec9('0xb')](),controller[_0xfec9('0xc')]);router['get'](_0xfec9('0xd'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xfec9('0xe')]({'destination':function(_0x13923f,_0x3cde66,_0x2a14aa){_0x2a14aa(null,path[_0xfec9('0xf')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x4050dc,_0x1d36c5,_0x3eb5d7){_0x1d36c5['originalname']=_0x1d36c5[_0xfec9('0x10')][_0xfec9('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3eb5d7(null,util[_0xfec9('0x12')](_0xfec9('0x13'),path[_0xfec9('0x14')](_0x1d36c5[_0xfec9('0x10')],path['extname'](_0x1d36c5[_0xfec9('0x10')])),Date['now'](),path[_0xfec9('0x15')](_0x1d36c5[_0xfec9('0x10')])));}})});router[_0xfec9('0x16')]('/',upload[_0xfec9('0x17')](_0xfec9('0x18')),controller[_0xfec9('0x19')]);router[_0xfec9('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0xfec9('0x1b')]);router[_0xfec9('0x1c')](_0xfec9('0xa'),auth[_0xfec9('0xb')](),controller[_0xfec9('0x1c')]);module[_0xfec9('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index bf1f0d2..94cb0f3 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 _0xb289=['sequelize','STRING','name','FLOAT','INTEGER','BIGINT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb289,0xba));var _0x9b28=function(_0x50923f,_0x35d6b7){_0x50923f=_0x50923f-0x0;var _0xacc11e=_0xb289[_0x50923f];return _0xacc11e;};'use strict';var Sequelize=require(_0x9b28('0x0'));module['exports']={'name':{'type':Sequelize[_0x9b28('0x1')],'unique':_0x9b28('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x9b28('0x1')]},'original_duration':{'type':Sequelize[_0x9b28('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x9b28('0x4')]},'original_bitRate':{'type':Sequelize[_0x9b28('0x5')]},'original_sampleRate':{'type':Sequelize[_0x9b28('0x4')]},'converted_format':{'type':Sequelize[_0x9b28('0x1')]},'converted_duration':{'type':Sequelize[_0x9b28('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x9b28('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x83d9=['STRING','FLOAT','BIGINT','INTEGER','exports'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x83d9,0x1c1));var _0x983d=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x83d9[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require('sequelize');module[_0x983d('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x983d('0x1')]},'display_name':{'type':Sequelize[_0x983d('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x983d('0x1')]},'original_format':{'type':Sequelize[_0x983d('0x1')]},'original_duration':{'type':Sequelize[_0x983d('0x2')]},'original_sampleCount':{'type':Sequelize[_0x983d('0x3')]},'original_channelCount':{'type':Sequelize[_0x983d('0x4')]},'original_bitRate':{'type':Sequelize[_0x983d('0x3')]},'original_sampleRate':{'type':Sequelize[_0x983d('0x4')]},'converted_format':{'type':Sequelize[_0x983d('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x983d('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x983d('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index f1214db..48b4cdf 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 _0xfe71=['sendStatus','error','name','send','index','Sound','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','length','find','download','params','converted_format','join','root','save_name','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','basename','extname','file','filename','originalname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','channelCount','converted_bitRate','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','start','original_format','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','then','destroy','get','Sounds','UserProfileResource'];(function(_0x17d871,_0x253a91){var _0x4a3e2a=function(_0x36bb0c){while(--_0x36bb0c){_0x17d871['push'](_0x17d871['shift']());}};_0x4a3e2a(++_0x253a91);}(_0xfe71,0x1bf));var _0x1fe7=function(_0x406680,_0x2bd836){_0x406680=_0x406680-0x0;var _0x438811=_0xfe71[_0x406680];return _0x438811;};'use strict';var emlformat=require(_0x1fe7('0x0'));var rimraf=require(_0x1fe7('0x1'));var zipdir=require(_0x1fe7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1fe7('0x3'));var BPromise=require(_0x1fe7('0x4'));var Mustache=require(_0x1fe7('0x5'));var util=require(_0x1fe7('0x6'));var path=require(_0x1fe7('0x7'));var sox=require(_0x1fe7('0x8'));var csv=require(_0x1fe7('0x9'));var ejs=require(_0x1fe7('0xa'));var fs=require('fs');var fs_extra=require(_0x1fe7('0xb'));var _=require(_0x1fe7('0xc'));var squel=require(_0x1fe7('0xd'));var crypto=require(_0x1fe7('0xe'));var jsforce=require(_0x1fe7('0xf'));var deskjs=require(_0x1fe7('0x10'));var toCsv=require(_0x1fe7('0x9'));var querystring=require(_0x1fe7('0x11'));var Papa=require(_0x1fe7('0x12'));var Redis=require(_0x1fe7('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1fe7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1fe7('0x15'));var logger=require(_0x1fe7('0x16'))(_0x1fe7('0x17'));var utils=require('../../config/utils');var config=require(_0x1fe7('0x18'));var licenseUtil=require(_0x1fe7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x466751,_0x1552ab){_0x1552ab=_0x1552ab||0xcc;return function(_0x19f2be){if(_0x19f2be){return _0x466751['sendStatus'](_0x1552ab);}return _0x466751[_0x1fe7('0x1a')](_0x1552ab)[_0x1fe7('0x1b')]();};}function respondWithResult(_0x3f15a7,_0x594376){_0x594376=_0x594376||0xc8;return function(_0x2a8cd2){if(_0x2a8cd2){return _0x3f15a7[_0x1fe7('0x1a')](_0x594376)[_0x1fe7('0x1c')](_0x2a8cd2);}};}function respondWithFilteredResult(_0x547a33,_0x396af3){return function(_0x558cf0){if(_0x558cf0){var _0x2c4063=typeof _0x396af3[_0x1fe7('0x1d')]===_0x1fe7('0x1e')&&typeof _0x396af3['limit']===_0x1fe7('0x1e');var _0x207015=_0x558cf0[_0x1fe7('0x1f')];var _0x2edfac=_0x2c4063?0x0:_0x396af3['offset'];var _0x310ac1=_0x2c4063?_0x558cf0[_0x1fe7('0x1f')]:_0x396af3['offset']+_0x396af3[_0x1fe7('0x20')];var _0x415021;if(_0x310ac1>=_0x207015){_0x310ac1=_0x207015;_0x415021=0xc8;}else{_0x415021=0xce;}_0x547a33[_0x1fe7('0x1a')](_0x415021);return _0x547a33['set'](_0x1fe7('0x21'),_0x2edfac+'-'+_0x310ac1+'/'+_0x207015)['json'](_0x558cf0);}return null;};}function patchUpdates(_0x3c8f7a){return function(_0x544d4b){try{jsonpatch[_0x1fe7('0x22')](_0x544d4b,_0x3c8f7a,!![]);}catch(_0x22c334){return BPromise[_0x1fe7('0x23')](_0x22c334);}return _0x544d4b['save']();};}function saveUpdates(_0x4dfe72,_0x391260){return function(_0x338874){if(_0x338874){return _0x338874['update'](_0x4dfe72)[_0x1fe7('0x24')](function(_0x12c7ad){return _0x12c7ad;});}return null;};}function removeEntity(_0x1e3242,_0x4b295d){return function(_0x5b99cc){if(_0x5b99cc){return _0x5b99cc[_0x1fe7('0x25')]()[_0x1fe7('0x24')](function(){var _0x4856e0=_0x5b99cc[_0x1fe7('0x26')]({'plain':!![]});var _0x251e47=_0x1fe7('0x27');return db[_0x1fe7('0x28')][_0x1fe7('0x25')]({'where':{'type':_0x251e47,'resourceId':_0x4856e0['id']}})[_0x1fe7('0x24')](function(){return _0x5b99cc;});})[_0x1fe7('0x24')](function(){_0x1e3242[_0x1fe7('0x1a')](0xcc)[_0x1fe7('0x1b')]();});}};}function handleEntityNotFound(_0x2bd3ef,_0x86e79){return function(_0x50c43c){if(!_0x50c43c){_0x2bd3ef[_0x1fe7('0x29')](0x194);}return _0x50c43c;};}function handleError(_0x3ebc11,_0xb755a8){_0xb755a8=_0xb755a8||0x1f4;return function(_0x413d9c){logger[_0x1fe7('0x2a')](_0x413d9c['stack']);if(_0x413d9c['name']){delete _0x413d9c[_0x1fe7('0x2b')];}_0x3ebc11[_0x1fe7('0x1a')](_0xb755a8)[_0x1fe7('0x2c')](_0x413d9c);};}exports[_0x1fe7('0x2d')]=function(_0x3a59fc,_0x5b433c){var _0x5933aa={},_0xdc0a1c={},_0x2183cf={'count':0x0,'rows':[]};var _0xd1d014=_['map'](db[_0x1fe7('0x2e')]['rawAttributes'],function(_0x366f39){return{'name':_0x366f39[_0x1fe7('0x2f')],'type':_0x366f39['type'][_0x1fe7('0x30')]};});_0xdc0a1c['model']=_['map'](_0xd1d014,_0x1fe7('0x2b'));_0xdc0a1c[_0x1fe7('0x31')]=_[_0x1fe7('0x32')](_0x3a59fc[_0x1fe7('0x31')]);_0xdc0a1c[_0x1fe7('0x33')]=_[_0x1fe7('0x34')](_0xdc0a1c[_0x1fe7('0x35')],_0xdc0a1c[_0x1fe7('0x31')]);_0x5933aa[_0x1fe7('0x36')]=_['intersection'](_0xdc0a1c['model'],qs[_0x1fe7('0x37')](_0x3a59fc[_0x1fe7('0x31')]['fields']));_0x5933aa['attributes']=_0x5933aa['attributes']['length']?_0x5933aa[_0x1fe7('0x36')]:_0xdc0a1c['model'];if(!_0x3a59fc['query'][_0x1fe7('0x38')](_0x1fe7('0x39'))){_0x5933aa[_0x1fe7('0x20')]=qs[_0x1fe7('0x20')](_0x3a59fc[_0x1fe7('0x31')][_0x1fe7('0x20')]);_0x5933aa[_0x1fe7('0x1d')]=qs[_0x1fe7('0x1d')](_0x3a59fc[_0x1fe7('0x31')][_0x1fe7('0x1d')]);}_0x5933aa[_0x1fe7('0x3a')]=qs['sort'](_0x3a59fc[_0x1fe7('0x31')][_0x1fe7('0x3b')]);_0x5933aa[_0x1fe7('0x3c')]=qs[_0x1fe7('0x33')](_[_0x1fe7('0x3d')](_0x3a59fc['query'],_0xdc0a1c['filters']),_0xd1d014);if(_0x3a59fc['query'][_0x1fe7('0x3e')]){_0x5933aa['where']=_['merge'](_0x5933aa['where'],{'$or':_[_0x1fe7('0x3f')](_0xd1d014,function(_0x281348){if(_0x281348[_0x1fe7('0x40')]!==_0x1fe7('0x41')){var _0x1a301f={};_0x1a301f[_0x281348['name']]={'$like':'%'+_0x3a59fc[_0x1fe7('0x31')][_0x1fe7('0x3e')]+'%'};return _0x1a301f;}})});}_0x5933aa=_[_0x1fe7('0x42')]({},_0x5933aa,_0x3a59fc[_0x1fe7('0x43')]);var _0x46f976={'where':_0x5933aa[_0x1fe7('0x3c')]};return db[_0x1fe7('0x2e')]['count'](_0x46f976)[_0x1fe7('0x24')](function(_0x15caf8){_0x2183cf[_0x1fe7('0x1f')]=_0x15caf8;if(_0x3a59fc['query'][_0x1fe7('0x44')]){_0x5933aa[_0x1fe7('0x45')]=[{'all':!![]}];}return db[_0x1fe7('0x2e')][_0x1fe7('0x46')](_0x5933aa);})['then'](function(_0x574b7b){_0x2183cf[_0x1fe7('0x47')]=_0x574b7b;return _0x2183cf;})['then'](respondWithFilteredResult(_0x5b433c,_0x5933aa))[_0x1fe7('0x48')](handleError(_0x5b433c,null));};exports[_0x1fe7('0x49')]=function(_0x27af02,_0x4f84dc){var _0x1d9dbe={'raw':!![],'where':{'id':_0x27af02['params']['id']}},_0x35f42b={};_0x35f42b[_0x1fe7('0x35')]=_[_0x1fe7('0x32')](db[_0x1fe7('0x2e')]['rawAttributes']);_0x35f42b[_0x1fe7('0x31')]=_[_0x1fe7('0x32')](_0x27af02[_0x1fe7('0x31')]);_0x35f42b[_0x1fe7('0x33')]=_[_0x1fe7('0x34')](_0x35f42b[_0x1fe7('0x35')],_0x35f42b[_0x1fe7('0x31')]);_0x1d9dbe[_0x1fe7('0x36')]=_[_0x1fe7('0x34')](_0x35f42b['model'],qs[_0x1fe7('0x37')](_0x27af02[_0x1fe7('0x31')][_0x1fe7('0x37')]));_0x1d9dbe['attributes']=_0x1d9dbe[_0x1fe7('0x36')][_0x1fe7('0x4a')]?_0x1d9dbe[_0x1fe7('0x36')]:_0x35f42b['model'];if(_0x27af02[_0x1fe7('0x31')][_0x1fe7('0x44')]){_0x1d9dbe['include']=[{'all':!![]}];}_0x1d9dbe=_[_0x1fe7('0x42')]({},_0x1d9dbe,_0x27af02['options']);return db[_0x1fe7('0x2e')][_0x1fe7('0x4b')](_0x1d9dbe)['then'](handleEntityNotFound(_0x4f84dc,null))[_0x1fe7('0x24')](respondWithResult(_0x4f84dc,null))[_0x1fe7('0x48')](handleError(_0x4f84dc,null));};exports[_0x1fe7('0x4c')]=function(_0x59b5d0,_0xc69a19,_0x486d92){return db['Sound'][_0x1fe7('0x4b')]({'where':{'id':_0x59b5d0[_0x1fe7('0x4d')]['id']},'attributes':[_0x1fe7('0x2b'),'save_name',_0x1fe7('0x4e')],'raw':!![]})[_0x1fe7('0x24')](handleEntityNotFound(_0xc69a19,null))[_0x1fe7('0x24')](function(_0x173b0c){if(_0x173b0c){if(!fs['existsSync'](path[_0x1fe7('0x4f')](config[_0x1fe7('0x50')],'server/files/sounds/converted',_0x173b0c[_0x1fe7('0x51')]+'.'+_0x173b0c[_0x1fe7('0x4e')]))){throw new db['Sequelize']['ValidationError'](_0x1fe7('0x52'));}return _0xc69a19[_0x1fe7('0x4c')](path[_0x1fe7('0x4f')](config[_0x1fe7('0x50')],_0x1fe7('0x53'),util[_0x1fe7('0x54')](_0x1fe7('0x55'),_0x173b0c[_0x1fe7('0x51')],_0x173b0c[_0x1fe7('0x4e')])),util[_0x1fe7('0x54')](_0x1fe7('0x55'),_0x173b0c[_0x1fe7('0x2b')],_0x173b0c[_0x1fe7('0x4e')]));}return null;})[_0x1fe7('0x48')](handleError(_0xc69a19,null));};exports[_0x1fe7('0x56')]=function(_0x5903d7,_0x33e795,_0x5f2ace){var _0x241daf={'name':path[_0x1fe7('0x57')](_0x5903d7['file']['originalname'],path[_0x1fe7('0x58')](_0x5903d7[_0x1fe7('0x59')]['originalname'])),'save_name':path['basename'](_0x5903d7['file'][_0x1fe7('0x5a')],path['extname'](_0x5903d7[_0x1fe7('0x59')][_0x1fe7('0x5a')])),'original_format':path[_0x1fe7('0x58')](_0x5903d7[_0x1fe7('0x59')][_0x1fe7('0x5b')])[_0x1fe7('0x5c')](0x1),'converted_format':_0x1fe7('0x5d')};var _0x356293=path[_0x1fe7('0x4f')](config[_0x1fe7('0x50')],_0x1fe7('0x5e'),_0x5903d7[_0x1fe7('0x59')][_0x1fe7('0x5a')]);var _0x213414=path['join'](config[_0x1fe7('0x50')],_0x1fe7('0x53'),util[_0x1fe7('0x54')](_0x1fe7('0x55'),path[_0x1fe7('0x57')](_0x5903d7[_0x1fe7('0x59')][_0x1fe7('0x5a')],path['extname'](_0x5903d7[_0x1fe7('0x59')][_0x1fe7('0x5a')])),_0x241daf['converted_format']));logger[_0x1fe7('0x5f')](_0x1fe7('0x60'),_0x356293);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x213414);try{fs[_0x1fe7('0x61')](_0x356293,parseInt(_0x1fe7('0x62'),0x8));var _0x1d8e9d=sox[_0x1fe7('0x63')](_0x356293,_0x213414,{'sampleRate':0x1f40,'format':_0x1fe7('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1d8e9d['on'](_0x1fe7('0x2a'),function(_0x2f7051){fs['unlinkSync'](_0x356293);_0x33e795['status'](0x1f4)[_0x1fe7('0x2c')](_0x2f7051);});_0x1d8e9d['on'](_0x1fe7('0x64'),function(_0x2ed9c1){_0x241daf[_0x1fe7('0x65')]=isNaN(_0x2ed9c1[_0x1fe7('0x66')])?null:_0x2ed9c1[_0x1fe7('0x66')]*0x3e8;_0x241daf[_0x1fe7('0x67')]=isNaN(_0x2ed9c1['sampleCount'])?null:_0x2ed9c1[_0x1fe7('0x68')];_0x241daf[_0x1fe7('0x69')]=isNaN(_0x2ed9c1['channelCount'])?null:_0x2ed9c1['channelCount'];_0x241daf['original_bitRate']=isNaN(_0x2ed9c1[_0x1fe7('0x6a')])?null:_0x2ed9c1['bitRate'];_0x241daf[_0x1fe7('0x6b')]=isNaN(_0x2ed9c1[_0x1fe7('0x6c')])?null:_0x2ed9c1[_0x1fe7('0x6c')];});_0x1d8e9d['on'](_0x1fe7('0x6d'),function(_0x52decb){_0x241daf[_0x1fe7('0x6e')]=isNaN(_0x52decb[_0x1fe7('0x66')])?null:_0x52decb[_0x1fe7('0x66')]*0x3e8;_0x241daf['converted_sampleCount']=isNaN(_0x52decb[_0x1fe7('0x68')])?null:_0x52decb[_0x1fe7('0x68')];_0x241daf['converted_channelCount']=isNaN(_0x52decb[_0x1fe7('0x6f')])?null:_0x52decb[_0x1fe7('0x6f')];_0x241daf[_0x1fe7('0x70')]=isNaN(_0x52decb['bitRate'])?null:_0x52decb[_0x1fe7('0x6a')];_0x241daf[_0x1fe7('0x71')]=isNaN(_0x52decb['sampleRate'])?null:_0x52decb['sampleRate'];});_0x1d8e9d['on']('end',function(){fs[_0x1fe7('0x61')](_0x213414,parseInt(_0x1fe7('0x62'),0x8));return db[_0x1fe7('0x2e')][_0x1fe7('0x56')](_0x241daf)[_0x1fe7('0x24')](function(_0x5b5a7b){var _0xe4addb={'role':_0x5903d7[_0x1fe7('0x72')]['role'],'userProfileId':_0x5903d7[_0x1fe7('0x72')][_0x1fe7('0x73')]};if(!_0xe4addb)throw new Error(_0x1fe7('0x74'));if(_0xe4addb[_0x1fe7('0x75')]==='user'){var _0x3d5ec2=_0x5b5a7b['get']({'plain':!![]});return db['UserProfileSection'][_0x1fe7('0x4b')]({'where':{'name':_0x1fe7('0x27'),'userProfileId':_0xe4addb[_0x1fe7('0x73')]},'raw':!![]})[_0x1fe7('0x24')](function(_0x67cc34){if(_0x67cc34&&_0x67cc34[_0x1fe7('0x76')]===0x0){return db['UserProfileResource'][_0x1fe7('0x56')]({'name':_0x3d5ec2['name'],'resourceId':_0x3d5ec2['id'],'type':_0x67cc34[_0x1fe7('0x2b')],'sectionId':_0x67cc34['id']},{})[_0x1fe7('0x24')](function(){return _0x5b5a7b;});}else{return _0x5b5a7b;}})['catch'](function(_0x557e47){logger[_0x1fe7('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x557e47);throw _0x557e47;});}return _0x5b5a7b;})[_0x1fe7('0x24')](respondWithResult(_0x33e795,null))[_0x1fe7('0x48')](handleError(_0x33e795,null));});_0x1d8e9d[_0x1fe7('0x77')]();}catch(_0x164bfb){_0x33e795[_0x1fe7('0x1a')](0x1f4)['send'](_0x164bfb);}};exports['update']=function(_0x5c92f9,_0xd1e84c,_0x1ceff1){return db[_0x1fe7('0x2e')]['find']({'where':{'id':_0x5c92f9[_0x1fe7('0x4d')]['id']}})['then'](handleEntityNotFound(_0xd1e84c,null))[_0x1fe7('0x24')](saveUpdates(_[_0x1fe7('0x3d')](_0x5c92f9[_0x1fe7('0x72')],[_0x1fe7('0x2b'),'description']),null))[_0x1fe7('0x24')](respondWithResult(_0xd1e84c,null))[_0x1fe7('0x48')](handleError(_0xd1e84c,null));};exports['delete']=function(_0x326a08,_0x102cd0,_0x17553a){return db[_0x1fe7('0x2e')][_0x1fe7('0x4b')]({'where':{'id':_0x326a08[_0x1fe7('0x4d')]['id']}})[_0x1fe7('0x24')](function(_0x3fdedd){if(_0x3fdedd){return _0x3fdedd[_0x1fe7('0x25')]();}})[_0x1fe7('0x24')](function(_0x33285d){var _0xfb40df=path[_0x1fe7('0x4f')](config[_0x1fe7('0x50')],_0x1fe7('0x5e'),util[_0x1fe7('0x54')](_0x1fe7('0x55'),_0x33285d[_0x1fe7('0x51')],_0x33285d[_0x1fe7('0x78')]));var _0x1bf667=path[_0x1fe7('0x4f')](config['root'],_0x1fe7('0x53'),util[_0x1fe7('0x54')](_0x1fe7('0x55'),_0x33285d['save_name'],_0x33285d[_0x1fe7('0x4e')]));fs[_0x1fe7('0x79')](_0xfb40df);fs[_0x1fe7('0x79')](_0x1bf667);return _0x33285d;})['then'](function(_0x429d59){if(_0x429d59){return _0x102cd0['status'](0xcc)[_0x1fe7('0x1b')]();}})[_0x1fe7('0x24')](handleEntityNotFound(_0x102cd0,null))[_0x1fe7('0x48')](handleError(_0x102cd0,null));}; \ No newline at end of file +var _0xbecd=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','destroy','get','Sounds','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','Sound','includeAll','include','findAll','rows','catch','params','find','save_name','root','server/files/sounds/converted','converted_format','Sequelize','Sound\x20not\x20found','download','format','%s.%s','create','originalname','extname','file','basename','substring','join','server/files/sounds/original','filename','info','chmodSync','0777','transcode','error','unlinkSync','original_duration','duration','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox'];(function(_0x262c63,_0x308093){var _0x475622=function(_0x3c1b80){while(--_0x3c1b80){_0x262c63['push'](_0x262c63['shift']());}};_0x475622(++_0x308093);}(_0xbecd,0x73));var _0xdbec=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbecd[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xdbec('0x0'));var rimraf=require(_0xdbec('0x1'));var zipdir=require(_0xdbec('0x2'));var jsonpatch=require(_0xdbec('0x3'));var rp=require('request-promise');var moment=require(_0xdbec('0x4'));var BPromise=require(_0xdbec('0x5'));var Mustache=require('mustache');var util=require(_0xdbec('0x6'));var path=require(_0xdbec('0x7'));var sox=require(_0xdbec('0x8'));var csv=require(_0xdbec('0x9'));var ejs=require(_0xdbec('0xa'));var fs=require('fs');var fs_extra=require(_0xdbec('0xb'));var _=require(_0xdbec('0xc'));var squel=require(_0xdbec('0xd'));var crypto=require(_0xdbec('0xe'));var jsforce=require(_0xdbec('0xf'));var deskjs=require(_0xdbec('0x10'));var toCsv=require(_0xdbec('0x9'));var querystring=require(_0xdbec('0x11'));var Papa=require(_0xdbec('0x12'));var Redis=require('ioredis');var authService=require(_0xdbec('0x13'));var qs=require(_0xdbec('0x14'));var as=require(_0xdbec('0x15'));var hardwareService=require(_0xdbec('0x16'));var logger=require(_0xdbec('0x17'))(_0xdbec('0x18'));var utils=require(_0xdbec('0x19'));var config=require(_0xdbec('0x1a'));var licenseUtil=require(_0xdbec('0x1b'));var db=require(_0xdbec('0x1c'))['db'];function respondWithStatusCode(_0x247d96,_0x242961){_0x242961=_0x242961||0xcc;return function(_0x588925){if(_0x588925){return _0x247d96[_0xdbec('0x1d')](_0x242961);}return _0x247d96[_0xdbec('0x1e')](_0x242961)[_0xdbec('0x1f')]();};}function respondWithResult(_0x5d2095,_0x35f039){_0x35f039=_0x35f039||0xc8;return function(_0x1e9e11){if(_0x1e9e11){return _0x5d2095[_0xdbec('0x1e')](_0x35f039)['json'](_0x1e9e11);}};}function respondWithFilteredResult(_0x4b2c2b,_0x40c2ec){return function(_0x4aab96){if(_0x4aab96){var _0x1855be=typeof _0x40c2ec[_0xdbec('0x20')]==='undefined'&&typeof _0x40c2ec[_0xdbec('0x21')]===_0xdbec('0x22');var _0x34c8a9=_0x4aab96[_0xdbec('0x23')];var _0xc5740b=_0x1855be?0x0:_0x40c2ec['offset'];var _0x72c6ef=_0x1855be?_0x4aab96[_0xdbec('0x23')]:_0x40c2ec[_0xdbec('0x20')]+_0x40c2ec[_0xdbec('0x21')];var _0x13efb8;if(_0x72c6ef>=_0x34c8a9){_0x72c6ef=_0x34c8a9;_0x13efb8=0xc8;}else{_0x13efb8=0xce;}_0x4b2c2b[_0xdbec('0x1e')](_0x13efb8);return _0x4b2c2b['set'](_0xdbec('0x24'),_0xc5740b+'-'+_0x72c6ef+'/'+_0x34c8a9)[_0xdbec('0x25')](_0x4aab96);}return null;};}function patchUpdates(_0x480e62){return function(_0x246286){try{jsonpatch[_0xdbec('0x26')](_0x246286,_0x480e62,!![]);}catch(_0x5c4aef){return BPromise[_0xdbec('0x27')](_0x5c4aef);}return _0x246286[_0xdbec('0x28')]();};}function saveUpdates(_0x1c0893,_0x553f6e){return function(_0x790e79){if(_0x790e79){return _0x790e79[_0xdbec('0x29')](_0x1c0893)['then'](function(_0x4cb7aa){return _0x4cb7aa;});}return null;};}function removeEntity(_0x3ed082,_0x2e0f07){return function(_0x18a307){if(_0x18a307){return _0x18a307[_0xdbec('0x2a')]()['then'](function(){var _0x43f529=_0x18a307[_0xdbec('0x2b')]({'plain':!![]});var _0x2214b1=_0xdbec('0x2c');return db['UserProfileResource'][_0xdbec('0x2a')]({'where':{'type':_0x2214b1,'resourceId':_0x43f529['id']}})[_0xdbec('0x2d')](function(){return _0x18a307;});})[_0xdbec('0x2d')](function(){_0x3ed082[_0xdbec('0x1e')](0xcc)[_0xdbec('0x1f')]();});}};}function handleEntityNotFound(_0x4f9ff7,_0x3ccf3a){return function(_0x12e5d9){if(!_0x12e5d9){_0x4f9ff7[_0xdbec('0x1d')](0x194);}return _0x12e5d9;};}function handleError(_0x1c282a,_0x5f547e){_0x5f547e=_0x5f547e||0x1f4;return function(_0xe81b88){logger['error'](_0xe81b88[_0xdbec('0x2e')]);if(_0xe81b88[_0xdbec('0x2f')]){delete _0xe81b88[_0xdbec('0x2f')];}_0x1c282a[_0xdbec('0x1e')](_0x5f547e)[_0xdbec('0x30')](_0xe81b88);};}exports[_0xdbec('0x31')]=function(_0x5ab4ba,_0x7a33b2){var _0x3394c1={},_0x32770d={},_0xe139cf={'count':0x0,'rows':[]};var _0x19fa29=_[_0xdbec('0x32')](db['Sound'][_0xdbec('0x33')],function(_0x55e241){return{'name':_0x55e241[_0xdbec('0x34')],'type':_0x55e241[_0xdbec('0x35')][_0xdbec('0x36')]};});_0x32770d[_0xdbec('0x37')]=_[_0xdbec('0x32')](_0x19fa29,_0xdbec('0x2f'));_0x32770d[_0xdbec('0x38')]=_[_0xdbec('0x39')](_0x5ab4ba[_0xdbec('0x38')]);_0x32770d[_0xdbec('0x3a')]=_[_0xdbec('0x3b')](_0x32770d['model'],_0x32770d[_0xdbec('0x38')]);_0x3394c1[_0xdbec('0x3c')]=_[_0xdbec('0x3b')](_0x32770d[_0xdbec('0x37')],qs['fields'](_0x5ab4ba[_0xdbec('0x38')][_0xdbec('0x3d')]));_0x3394c1[_0xdbec('0x3c')]=_0x3394c1[_0xdbec('0x3c')][_0xdbec('0x3e')]?_0x3394c1[_0xdbec('0x3c')]:_0x32770d[_0xdbec('0x37')];if(!_0x5ab4ba[_0xdbec('0x38')][_0xdbec('0x3f')]('nolimit')){_0x3394c1[_0xdbec('0x21')]=qs[_0xdbec('0x21')](_0x5ab4ba[_0xdbec('0x38')][_0xdbec('0x21')]);_0x3394c1[_0xdbec('0x20')]=qs['offset'](_0x5ab4ba[_0xdbec('0x38')][_0xdbec('0x20')]);}_0x3394c1[_0xdbec('0x40')]=qs[_0xdbec('0x41')](_0x5ab4ba['query'][_0xdbec('0x41')]);_0x3394c1[_0xdbec('0x42')]=qs[_0xdbec('0x3a')](_['pick'](_0x5ab4ba[_0xdbec('0x38')],_0x32770d['filters']),_0x19fa29);if(_0x5ab4ba[_0xdbec('0x38')][_0xdbec('0x43')]){_0x3394c1[_0xdbec('0x42')]=_[_0xdbec('0x44')](_0x3394c1['where'],{'$or':_['map'](_0x19fa29,function(_0x430b3c){if(_0x430b3c[_0xdbec('0x35')]!==_0xdbec('0x45')){var _0x36eff8={};_0x36eff8[_0x430b3c[_0xdbec('0x2f')]]={'$like':'%'+_0x5ab4ba[_0xdbec('0x38')][_0xdbec('0x43')]+'%'};return _0x36eff8;}})});}_0x3394c1=_['merge']({},_0x3394c1,_0x5ab4ba['options']);var _0x56e353={'where':_0x3394c1[_0xdbec('0x42')]};return db[_0xdbec('0x46')][_0xdbec('0x23')](_0x56e353)[_0xdbec('0x2d')](function(_0x12d62f){_0xe139cf[_0xdbec('0x23')]=_0x12d62f;if(_0x5ab4ba[_0xdbec('0x38')][_0xdbec('0x47')]){_0x3394c1[_0xdbec('0x48')]=[{'all':!![]}];}return db['Sound'][_0xdbec('0x49')](_0x3394c1);})[_0xdbec('0x2d')](function(_0x3586ec){_0xe139cf[_0xdbec('0x4a')]=_0x3586ec;return _0xe139cf;})[_0xdbec('0x2d')](respondWithFilteredResult(_0x7a33b2,_0x3394c1))[_0xdbec('0x4b')](handleError(_0x7a33b2,null));};exports['show']=function(_0x1a768e,_0x57a14c){var _0x2fcc74={'raw':!![],'where':{'id':_0x1a768e[_0xdbec('0x4c')]['id']}},_0x4dde9e={};_0x4dde9e[_0xdbec('0x37')]=_[_0xdbec('0x39')](db[_0xdbec('0x46')][_0xdbec('0x33')]);_0x4dde9e[_0xdbec('0x38')]=_['keys'](_0x1a768e['query']);_0x4dde9e[_0xdbec('0x3a')]=_['intersection'](_0x4dde9e[_0xdbec('0x37')],_0x4dde9e[_0xdbec('0x38')]);_0x2fcc74['attributes']=_[_0xdbec('0x3b')](_0x4dde9e[_0xdbec('0x37')],qs[_0xdbec('0x3d')](_0x1a768e[_0xdbec('0x38')][_0xdbec('0x3d')]));_0x2fcc74['attributes']=_0x2fcc74[_0xdbec('0x3c')][_0xdbec('0x3e')]?_0x2fcc74[_0xdbec('0x3c')]:_0x4dde9e[_0xdbec('0x37')];if(_0x1a768e['query']['includeAll']){_0x2fcc74[_0xdbec('0x48')]=[{'all':!![]}];}_0x2fcc74=_[_0xdbec('0x44')]({},_0x2fcc74,_0x1a768e['options']);return db[_0xdbec('0x46')][_0xdbec('0x4d')](_0x2fcc74)[_0xdbec('0x2d')](handleEntityNotFound(_0x57a14c,null))[_0xdbec('0x2d')](respondWithResult(_0x57a14c,null))['catch'](handleError(_0x57a14c,null));};exports['download']=function(_0x57e3f7,_0xc51f4f,_0x866688){return db[_0xdbec('0x46')]['find']({'where':{'id':_0x57e3f7['params']['id']},'attributes':[_0xdbec('0x2f'),_0xdbec('0x4e'),'converted_format'],'raw':!![]})[_0xdbec('0x2d')](handleEntityNotFound(_0xc51f4f,null))['then'](function(_0x506206){if(_0x506206){if(!fs['existsSync'](path['join'](config[_0xdbec('0x4f')],_0xdbec('0x50'),_0x506206[_0xdbec('0x4e')]+'.'+_0x506206[_0xdbec('0x51')]))){throw new db[(_0xdbec('0x52'))]['ValidationError'](_0xdbec('0x53'));}return _0xc51f4f[_0xdbec('0x54')](path['join'](config['root'],_0xdbec('0x50'),util[_0xdbec('0x55')](_0xdbec('0x56'),_0x506206[_0xdbec('0x4e')],_0x506206[_0xdbec('0x51')])),util[_0xdbec('0x55')](_0xdbec('0x56'),_0x506206['name'],_0x506206['converted_format']));}return null;})[_0xdbec('0x4b')](handleError(_0xc51f4f,null));};exports[_0xdbec('0x57')]=function(_0x9d5164,_0x66a2f8,_0x3ad127){var _0x3ae24b={'name':path['basename'](_0x9d5164['file'][_0xdbec('0x58')],path[_0xdbec('0x59')](_0x9d5164[_0xdbec('0x5a')][_0xdbec('0x58')])),'save_name':path[_0xdbec('0x5b')](_0x9d5164[_0xdbec('0x5a')]['filename'],path[_0xdbec('0x59')](_0x9d5164[_0xdbec('0x5a')]['filename'])),'original_format':path[_0xdbec('0x59')](_0x9d5164[_0xdbec('0x5a')][_0xdbec('0x58')])[_0xdbec('0x5c')](0x1),'converted_format':'wav'};var _0x4026d0=path[_0xdbec('0x5d')](config[_0xdbec('0x4f')],_0xdbec('0x5e'),_0x9d5164[_0xdbec('0x5a')][_0xdbec('0x5f')]);var _0x527ba8=path[_0xdbec('0x5d')](config[_0xdbec('0x4f')],_0xdbec('0x50'),util['format'](_0xdbec('0x56'),path[_0xdbec('0x5b')](_0x9d5164[_0xdbec('0x5a')][_0xdbec('0x5f')],path[_0xdbec('0x59')](_0x9d5164['file']['filename'])),_0x3ae24b['converted_format']));logger[_0xdbec('0x60')]('Sound\x20upload\x20filepath:\x20%s',_0x4026d0);logger[_0xdbec('0x60')]('Sound\x20upload\x20destination:\x20%s',_0x527ba8);try{fs[_0xdbec('0x61')](_0x4026d0,parseInt(_0xdbec('0x62'),0x8));var _0x5b963a=sox[_0xdbec('0x63')](_0x4026d0,_0x527ba8,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5b963a['on'](_0xdbec('0x64'),function(_0x494ec0){fs[_0xdbec('0x65')](_0x4026d0);_0x66a2f8[_0xdbec('0x1e')](0x1f4)['send'](_0x494ec0);});_0x5b963a['on']('src',function(_0x234a5c){_0x3ae24b[_0xdbec('0x66')]=isNaN(_0x234a5c[_0xdbec('0x67')])?null:_0x234a5c['duration']*0x3e8;_0x3ae24b['original_sampleCount']=isNaN(_0x234a5c[_0xdbec('0x68')])?null:_0x234a5c[_0xdbec('0x68')];_0x3ae24b[_0xdbec('0x69')]=isNaN(_0x234a5c[_0xdbec('0x6a')])?null:_0x234a5c[_0xdbec('0x6a')];_0x3ae24b['original_bitRate']=isNaN(_0x234a5c[_0xdbec('0x6b')])?null:_0x234a5c[_0xdbec('0x6b')];_0x3ae24b[_0xdbec('0x6c')]=isNaN(_0x234a5c['sampleRate'])?null:_0x234a5c[_0xdbec('0x6d')];});_0x5b963a['on'](_0xdbec('0x6e'),function(_0x573456){_0x3ae24b[_0xdbec('0x6f')]=isNaN(_0x573456[_0xdbec('0x67')])?null:_0x573456['duration']*0x3e8;_0x3ae24b[_0xdbec('0x70')]=isNaN(_0x573456[_0xdbec('0x68')])?null:_0x573456[_0xdbec('0x68')];_0x3ae24b[_0xdbec('0x71')]=isNaN(_0x573456[_0xdbec('0x6a')])?null:_0x573456[_0xdbec('0x6a')];_0x3ae24b['converted_bitRate']=isNaN(_0x573456[_0xdbec('0x6b')])?null:_0x573456[_0xdbec('0x6b')];_0x3ae24b[_0xdbec('0x72')]=isNaN(_0x573456[_0xdbec('0x6d')])?null:_0x573456[_0xdbec('0x6d')];});_0x5b963a['on'](_0xdbec('0x1f'),function(){fs[_0xdbec('0x61')](_0x527ba8,parseInt(_0xdbec('0x62'),0x8));return db['Sound']['create'](_0x3ae24b)['then'](function(_0x5ecd49){var _0x44c566={'role':_0x9d5164['body'][_0xdbec('0x73')],'userProfileId':_0x9d5164[_0xdbec('0x74')][_0xdbec('0x75')]};if(!_0x44c566)throw new Error(_0xdbec('0x76'));if(_0x44c566[_0xdbec('0x73')]===_0xdbec('0x77')){var _0x1326f2=_0x5ecd49[_0xdbec('0x2b')]({'plain':!![]});return db[_0xdbec('0x78')][_0xdbec('0x4d')]({'where':{'name':'Sounds','userProfileId':_0x44c566['userProfileId']},'raw':!![]})[_0xdbec('0x2d')](function(_0x57475e){if(_0x57475e&&_0x57475e[_0xdbec('0x79')]===0x0){return db[_0xdbec('0x7a')][_0xdbec('0x57')]({'name':_0x1326f2[_0xdbec('0x2f')],'resourceId':_0x1326f2['id'],'type':_0x57475e[_0xdbec('0x2f')],'sectionId':_0x57475e['id']},{})[_0xdbec('0x2d')](function(){return _0x5ecd49;});}else{return _0x5ecd49;}})[_0xdbec('0x4b')](function(_0x298b51){logger[_0xdbec('0x64')](_0xdbec('0x7b'),_0x298b51);throw _0x298b51;});}return _0x5ecd49;})[_0xdbec('0x2d')](respondWithResult(_0x66a2f8,null))['catch'](handleError(_0x66a2f8,null));});_0x5b963a['start']();}catch(_0x4f1b5d){_0x66a2f8[_0xdbec('0x1e')](0x1f4)[_0xdbec('0x30')](_0x4f1b5d);}};exports[_0xdbec('0x29')]=function(_0x3d9930,_0x54f203,_0x2df721){return db['Sound'][_0xdbec('0x4d')]({'where':{'id':_0x3d9930['params']['id']}})['then'](handleEntityNotFound(_0x54f203,null))[_0xdbec('0x2d')](saveUpdates(_['pick'](_0x3d9930[_0xdbec('0x74')],[_0xdbec('0x2f'),'description']),null))['then'](respondWithResult(_0x54f203,null))[_0xdbec('0x4b')](handleError(_0x54f203,null));};exports['delete']=function(_0x2fdcb4,_0x43503a,_0x35b745){return db[_0xdbec('0x46')][_0xdbec('0x4d')]({'where':{'id':_0x2fdcb4[_0xdbec('0x4c')]['id']}})[_0xdbec('0x2d')](function(_0x1aba30){if(_0x1aba30){return _0x1aba30['destroy']();}})[_0xdbec('0x2d')](function(_0x4dd313){var _0x347723=path['join'](config[_0xdbec('0x4f')],_0xdbec('0x5e'),util[_0xdbec('0x55')](_0xdbec('0x56'),_0x4dd313[_0xdbec('0x4e')],_0x4dd313['original_format']));var _0x2bbaaf=path[_0xdbec('0x5d')](config[_0xdbec('0x4f')],_0xdbec('0x50'),util['format'](_0xdbec('0x56'),_0x4dd313[_0xdbec('0x4e')],_0x4dd313[_0xdbec('0x51')]));fs[_0xdbec('0x65')](_0x347723);fs[_0xdbec('0x65')](_0x2bbaaf);return _0x4dd313;})[_0xdbec('0x2d')](function(_0x232069){if(_0x232069){return _0x43503a['status'](0xcc)[_0xdbec('0x1f')]();}})['then'](handleEntityNotFound(_0x43503a,null))[_0xdbec('0x4b')](handleError(_0x43503a,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 33ef5e2..cd088a9 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 _0x7d93=['tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./sound.attributes','exports','define','Sound'];(function(_0x22b82b,_0x4407cd){var _0x220523=function(_0x4f062e){while(--_0x4f062e){_0x22b82b['push'](_0x22b82b['shift']());}};_0x220523(++_0x4407cd);}(_0x7d93,0x17b));var _0x37d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d93[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x37d9('0x0'));var util=require(_0x37d9('0x1'));var logger=require(_0x37d9('0x2'))(_0x37d9('0x3'));var moment=require(_0x37d9('0x4'));var BPromise=require(_0x37d9('0x5'));var rp=require(_0x37d9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x37d9('0x7'));var config=require(_0x37d9('0x8'));var attributes=require(_0x37d9('0x9'));module[_0x37d9('0xa')]=function(_0x10cada,_0x2b181f){return _0x10cada[_0x37d9('0xb')](_0x37d9('0xc'),attributes,{'tableName':_0x37d9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14b0=['api','request-promise','../../config/environment','exports','define','tools_sounds','lodash','util','../../config/logger'];(function(_0x5b6aab,_0x11533b){var _0x1ce016=function(_0x5ce675){while(--_0x5ce675){_0x5b6aab['push'](_0x5b6aab['shift']());}};_0x1ce016(++_0x11533b);}(_0x14b0,0x1da));var _0x014b=function(_0x34dfa8,_0x2379a9){_0x34dfa8=_0x34dfa8-0x0;var _0x4cc0b4=_0x14b0[_0x34dfa8];return _0x4cc0b4;};'use strict';var _=require(_0x014b('0x0'));var util=require(_0x014b('0x1'));var logger=require(_0x014b('0x2'))(_0x014b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x014b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x014b('0x5'));var attributes=require('./sound.attributes');module[_0x014b('0x6')]=function(_0x4c3324,_0x2817cf){return _0x4c3324[_0x014b('0x7')]('Sound',attributes,{'tableName':_0x014b('0x8'),'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 9dad4cb..6bafcab 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 _0xc526=['Sound,\x20%s,\x20%s,\x20%s','error','message','result','catch','Sound','raw','options','where','attributes','include','map','model','ShowSound','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4c8a8f,_0x997ef){var _0x404500=function(_0x1c6072){while(--_0x1c6072){_0x4c8a8f['push'](_0x4c8a8f['shift']());}};_0x404500(++_0x997ef);}(_0xc526,0x1ee));var _0x6c52=function(_0x5c7999,_0x25b0fb){_0x5c7999=_0x5c7999-0x0;var _0x33651f=_0xc526[_0x5c7999];return _0x33651f;};'use strict';var _=require(_0x6c52('0x0'));var util=require(_0x6c52('0x1'));var moment=require(_0x6c52('0x2'));var BPromise=require(_0x6c52('0x3'));var rs=require(_0x6c52('0x4'));var fs=require('fs');var Redis=require(_0x6c52('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c52('0x6'));var logger=require(_0x6c52('0x7'))('rpc');var config=require(_0x6c52('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6c52('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d9f00,_0x5ad8e5,_0x268f55){return new BPromise(function(_0x3afefd,_0x285b07){return client[_0x6c52('0xa')](_0x1d9f00,_0x268f55)[_0x6c52('0xb')](function(_0x3f5679){logger[_0x6c52('0xc')](_0x6c52('0xd'),_0x5ad8e5,_0x6c52('0xe'));logger[_0x6c52('0xf')](_0x6c52('0x10'),_0x5ad8e5,'request\x20sent',JSON['stringify'](_0x3f5679));if(_0x3f5679[_0x6c52('0x11')]){if(_0x3f5679[_0x6c52('0x11')]['code']===0x1f4){logger[_0x6c52('0x11')](_0x6c52('0xd'),_0x5ad8e5,_0x3f5679[_0x6c52('0x11')]['message']);return _0x285b07(_0x3f5679[_0x6c52('0x11')][_0x6c52('0x12')]);}logger[_0x6c52('0x11')](_0x6c52('0xd'),_0x5ad8e5,_0x3f5679[_0x6c52('0x11')][_0x6c52('0x12')]);return _0x3afefd(_0x3f5679[_0x6c52('0x11')][_0x6c52('0x12')]);}else{logger[_0x6c52('0xc')](_0x6c52('0xd'),_0x5ad8e5,_0x6c52('0xe'));_0x3afefd(_0x3f5679[_0x6c52('0x13')]['message']);}})[_0x6c52('0x14')](function(_0x442f7d){logger[_0x6c52('0x11')]('Sound,\x20%s,\x20%s',_0x5ad8e5,_0x442f7d);_0x285b07(_0x442f7d);});});}exports['ShowSound']=function(_0xefc8e7){var _0x3e13db=this;return new Promise(function(_0x4cc0ac,_0x4337ba){return db[_0x6c52('0x15')]['find']({'raw':_0xefc8e7['options']?_0xefc8e7['options'][_0x6c52('0x16')]===undefined?!![]:![]:!![],'where':_0xefc8e7[_0x6c52('0x17')]?_0xefc8e7[_0x6c52('0x17')][_0x6c52('0x18')]||null:null,'attributes':_0xefc8e7['options']?_0xefc8e7[_0x6c52('0x17')][_0x6c52('0x19')]||null:null,'include':_0xefc8e7[_0x6c52('0x17')]?_0xefc8e7[_0x6c52('0x17')][_0x6c52('0x1a')]?_[_0x6c52('0x1b')](_0xefc8e7[_0x6c52('0x17')][_0x6c52('0x1a')],function(_0x2ff862){return{'model':db[_0x2ff862[_0x6c52('0x1c')]],'as':_0x2ff862['as'],'attributes':_0x2ff862[_0x6c52('0x19')],'include':_0x2ff862[_0x6c52('0x1a')]?_[_0x6c52('0x1b')](_0x2ff862[_0x6c52('0x1a')],function(_0x55a246){return{'model':db[_0x55a246[_0x6c52('0x1c')]],'as':_0x55a246['as'],'attributes':_0x55a246['attributes'],'include':_0x55a246['include']?_[_0x6c52('0x1b')](_0x55a246[_0x6c52('0x1a')],function(_0x26fa46){return{'model':db[_0x26fa46[_0x6c52('0x1c')]],'as':_0x26fa46['as'],'attributes':_0x26fa46[_0x6c52('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c6127){logger[_0x6c52('0xc')](_0x6c52('0x1d'),_0xefc8e7);logger[_0x6c52('0xf')](_0x6c52('0x1d'),_0xefc8e7,JSON['stringify'](_0x4c6127));_0x4cc0ac(_0x4c6127);})[_0x6c52('0x14')](function(_0xea4bba){logger[_0x6c52('0x11')](_0x6c52('0x1d'),_0xea4bba[_0x6c52('0x12')],_0xefc8e7);_0x4337ba(_0x3e13db[_0x6c52('0x11')](0x1f4,_0xea4bba['message']));});});}; \ No newline at end of file +var _0xd0b0=['../../config/logger','rpc','../../config/environment','client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','ShowSound','Sound','find','options','raw','where','include','map','model','attributes','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xd0b0,0x17a));var _0x0d0b=function(_0x29ea63,_0x44cc7e){_0x29ea63=_0x29ea63-0x0;var _0x16afcd=_0xd0b0[_0x29ea63];return _0x16afcd;};'use strict';var _=require(_0x0d0b('0x0'));var util=require(_0x0d0b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0d0b('0x2'));var fs=require('fs');var Redis=require(_0x0d0b('0x3'));var db=require(_0x0d0b('0x4'))['db'];var utils=require(_0x0d0b('0x5'));var logger=require(_0x0d0b('0x6'))(_0x0d0b('0x7'));var config=require(_0x0d0b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0d0b('0x9')][_0x0d0b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x562fc6,_0x395780,_0x394f33){return new BPromise(function(_0xcb5113,_0x2d949e){return client[_0x0d0b('0xb')](_0x562fc6,_0x394f33)[_0x0d0b('0xc')](function(_0x5adecb){logger['info'](_0x0d0b('0xd'),_0x395780,_0x0d0b('0xe'));logger[_0x0d0b('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x395780,_0x0d0b('0xe'),JSON[_0x0d0b('0x10')](_0x5adecb));if(_0x5adecb['error']){if(_0x5adecb[_0x0d0b('0x11')][_0x0d0b('0x12')]===0x1f4){logger['error'](_0x0d0b('0xd'),_0x395780,_0x5adecb[_0x0d0b('0x11')][_0x0d0b('0x13')]);return _0x2d949e(_0x5adecb['error'][_0x0d0b('0x13')]);}logger[_0x0d0b('0x11')]('Sound,\x20%s,\x20%s',_0x395780,_0x5adecb['error']['message']);return _0xcb5113(_0x5adecb[_0x0d0b('0x11')][_0x0d0b('0x13')]);}else{logger[_0x0d0b('0x14')]('Sound,\x20%s,\x20%s',_0x395780,_0x0d0b('0xe'));_0xcb5113(_0x5adecb['result']['message']);}})['catch'](function(_0x6bec02){logger[_0x0d0b('0x11')]('Sound,\x20%s,\x20%s',_0x395780,_0x6bec02);_0x2d949e(_0x6bec02);});});}exports[_0x0d0b('0x15')]=function(_0x57481d){var _0x12c7de=this;return new Promise(function(_0x2052bd,_0xbec9d6){return db[_0x0d0b('0x16')][_0x0d0b('0x17')]({'raw':_0x57481d[_0x0d0b('0x18')]?_0x57481d['options'][_0x0d0b('0x19')]===undefined?!![]:![]:!![],'where':_0x57481d[_0x0d0b('0x18')]?_0x57481d[_0x0d0b('0x18')][_0x0d0b('0x1a')]||null:null,'attributes':_0x57481d['options']?_0x57481d[_0x0d0b('0x18')]['attributes']||null:null,'include':_0x57481d[_0x0d0b('0x18')]?_0x57481d[_0x0d0b('0x18')][_0x0d0b('0x1b')]?_[_0x0d0b('0x1c')](_0x57481d[_0x0d0b('0x18')][_0x0d0b('0x1b')],function(_0xf790ba){return{'model':db[_0xf790ba[_0x0d0b('0x1d')]],'as':_0xf790ba['as'],'attributes':_0xf790ba['attributes'],'include':_0xf790ba[_0x0d0b('0x1b')]?_[_0x0d0b('0x1c')](_0xf790ba['include'],function(_0x12ce7a){return{'model':db[_0x12ce7a[_0x0d0b('0x1d')]],'as':_0x12ce7a['as'],'attributes':_0x12ce7a[_0x0d0b('0x1e')],'include':_0x12ce7a[_0x0d0b('0x1b')]?_['map'](_0x12ce7a[_0x0d0b('0x1b')],function(_0x2d0838){return{'model':db[_0x2d0838[_0x0d0b('0x1d')]],'as':_0x2d0838['as'],'attributes':_0x2d0838[_0x0d0b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d0b('0xc')](function(_0x541c83){logger[_0x0d0b('0x14')](_0x0d0b('0x15'),_0x57481d);logger[_0x0d0b('0xf')](_0x0d0b('0x15'),_0x57481d,JSON[_0x0d0b('0x10')](_0x541c83));_0x2052bd(_0x541c83);})[_0x0d0b('0x1f')](function(_0x2bca7a){logger[_0x0d0b('0x11')](_0x0d0b('0x15'),_0x2bca7a[_0x0d0b('0x13')],_0x57481d);_0xbec9d6(_0x12c7de[_0x0d0b('0x11')](0x1f4,_0x2bca7a[_0x0d0b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 6e2943b..829dfa5 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(_0x2e5521,_0x119b54){var _0x87a890=function(_0x288b67){while(--_0x288b67){_0x2e5521['push'](_0x2e5521['shift']());}};_0x87a890(++_0x119b54);}(_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'));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 _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x3ab9f1,_0x5c9894){var _0x3c5a6f=function(_0x51e797){while(--_0x51e797){_0x3ab9f1['push'](_0x3ab9f1['shift']());}};_0x3c5a6f(++_0x5c9894);}(_0x757a,0xde));var _0xa757=function(_0x3f6fc5,_0x4bdf45){_0x3f6fc5=_0x3f6fc5-0x0;var _0x46f00c=_0x757a[_0x3f6fc5];return _0x46f00c;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 922f31d..ea212ab 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 _0x3299=['out','sequelize','exports','STRING','TEXT','medium'];(function(_0x7486a3,_0x13e613){var _0x2ab9a2=function(_0x445e08){while(--_0x445e08){_0x7486a3['push'](_0x7486a3['shift']());}};_0x2ab9a2(++_0x13e613);}(_0x3299,0x175));var _0x9329=function(_0x467cc5,_0x28fb1c){_0x467cc5=_0x467cc5-0x0;var _0x11133a=_0x3299[_0x467cc5];return _0x11133a;};'use strict';var Sequelize=require(_0x9329('0x0'));module[_0x9329('0x1')]={'uniqueid':{'type':Sequelize[_0x9329('0x2')]},'body':{'type':Sequelize[_0x9329('0x3')](_0x9329('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9329('0x5')),'defaultValue':_0x9329('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x9329('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xc91b=['sequelize','exports','STRING','TEXT','ENUM','out'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0xc91b,0x84));var _0xbc91=function(_0x3e6b0e,_0x35116b){_0x3e6b0e=_0x3e6b0e-0x0;var _0x2d5ab1=_0xc91b[_0x3e6b0e];return _0x2d5ab1;};'use strict';var Sequelize=require(_0xbc91('0x0'));module[_0xbc91('0x1')]={'uniqueid':{'type':Sequelize[_0xbc91('0x2')]},'body':{'type':Sequelize[_0xbc91('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xbc91('0x4')]('in','out'),'defaultValue':_0xbc91('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xbc91('0x2')]},'providerResponse':{'type':Sequelize[_0xbc91('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 180fb01..473aa7d 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 _0xb01c=['index','SquareMessage','rawAttributes','fieldName','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../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','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xb01c,0xbe));var _0xcb01=function(_0x484e40,_0x1c0308){_0x484e40=_0x484e40-0x0;var _0x480f6c=_0xb01c[_0x484e40];return _0x480f6c;};'use strict';var emlformat=require(_0xcb01('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcb01('0x1'));var jsonpatch=require(_0xcb01('0x2'));var rp=require(_0xcb01('0x3'));var moment=require(_0xcb01('0x4'));var BPromise=require(_0xcb01('0x5'));var Mustache=require(_0xcb01('0x6'));var util=require(_0xcb01('0x7'));var path=require('path');var sox=require(_0xcb01('0x8'));var csv=require(_0xcb01('0x9'));var ejs=require(_0xcb01('0xa'));var fs=require('fs');var fs_extra=require(_0xcb01('0xb'));var _=require(_0xcb01('0xc'));var squel=require(_0xcb01('0xd'));var crypto=require(_0xcb01('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xcb01('0xf'));var toCsv=require(_0xcb01('0x9'));var querystring=require(_0xcb01('0x10'));var Papa=require(_0xcb01('0x11'));var Redis=require('ioredis');var authService=require(_0xcb01('0x12'));var qs=require(_0xcb01('0x13'));var as=require(_0xcb01('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcb01('0x15'))(_0xcb01('0x16'));var utils=require(_0xcb01('0x17'));var config=require(_0xcb01('0x18'));var licenseUtil=require(_0xcb01('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24e760,_0x3c6540){_0x3c6540=_0x3c6540||0xcc;return function(_0x1bce5e){if(_0x1bce5e){return _0x24e760[_0xcb01('0x1a')](_0x3c6540);}return _0x24e760[_0xcb01('0x1b')](_0x3c6540)[_0xcb01('0x1c')]();};}function respondWithResult(_0x351451,_0x12c597){_0x12c597=_0x12c597||0xc8;return function(_0x4660fa){if(_0x4660fa){return _0x351451[_0xcb01('0x1b')](_0x12c597)[_0xcb01('0x1d')](_0x4660fa);}};}function respondWithFilteredResult(_0xe0b0ba,_0x58eb23){return function(_0x4a572d){if(_0x4a572d){var _0x4a1864=typeof _0x58eb23[_0xcb01('0x1e')]===_0xcb01('0x1f')&&typeof _0x58eb23['limit']==='undefined';var _0x3e271f=_0x4a572d[_0xcb01('0x20')];var _0x34ee4d=_0x4a1864?0x0:_0x58eb23[_0xcb01('0x1e')];var _0x4cf752=_0x4a1864?_0x4a572d[_0xcb01('0x20')]:_0x58eb23[_0xcb01('0x1e')]+_0x58eb23['limit'];var _0x42f8e2;if(_0x4cf752>=_0x3e271f){_0x4cf752=_0x3e271f;_0x42f8e2=0xc8;}else{_0x42f8e2=0xce;}_0xe0b0ba[_0xcb01('0x1b')](_0x42f8e2);return _0xe0b0ba[_0xcb01('0x21')](_0xcb01('0x22'),_0x34ee4d+'-'+_0x4cf752+'/'+_0x3e271f)['json'](_0x4a572d);}return null;};}function patchUpdates(_0x453fe3){return function(_0x20df19){try{jsonpatch[_0xcb01('0x23')](_0x20df19,_0x453fe3,!![]);}catch(_0x4cbdfa){return BPromise[_0xcb01('0x24')](_0x4cbdfa);}return _0x20df19[_0xcb01('0x25')]();};}function saveUpdates(_0x33168b,_0x4032b8){return function(_0x260ccc){if(_0x260ccc){return _0x260ccc[_0xcb01('0x26')](_0x33168b)[_0xcb01('0x27')](function(_0x1a29b7){return _0x1a29b7;});}return null;};}function removeEntity(_0x48ef5b,_0x1a08f8){return function(_0x18eb52){if(_0x18eb52){return _0x18eb52[_0xcb01('0x28')]()[_0xcb01('0x27')](function(){_0x48ef5b[_0xcb01('0x1b')](0xcc)[_0xcb01('0x1c')]();});}};}function handleEntityNotFound(_0x611228,_0xe46ccb){return function(_0x5e9976){if(!_0x5e9976){_0x611228[_0xcb01('0x1a')](0x194);}return _0x5e9976;};}function handleError(_0x6f0ee3,_0x12cc71){_0x12cc71=_0x12cc71||0x1f4;return function(_0x4cba75){logger[_0xcb01('0x29')](_0x4cba75[_0xcb01('0x2a')]);if(_0x4cba75['name']){delete _0x4cba75['name'];}_0x6f0ee3['status'](_0x12cc71)[_0xcb01('0x2b')](_0x4cba75);};}exports[_0xcb01('0x2c')]=function(_0x49eeb4,_0x3938b0){var _0x35a522={},_0x54ae1d={},_0x527d37={'count':0x0,'rows':[]};var _0x35fe0a=_['map'](db[_0xcb01('0x2d')][_0xcb01('0x2e')],function(_0x46102b){return{'name':_0x46102b[_0xcb01('0x2f')],'type':_0x46102b['type'][_0xcb01('0x30')]};});_0x54ae1d[_0xcb01('0x31')]=_[_0xcb01('0x32')](_0x35fe0a,_0xcb01('0x33'));_0x54ae1d[_0xcb01('0x34')]=_[_0xcb01('0x35')](_0x49eeb4['query']);_0x54ae1d[_0xcb01('0x36')]=_[_0xcb01('0x37')](_0x54ae1d[_0xcb01('0x31')],_0x54ae1d[_0xcb01('0x34')]);_0x35a522[_0xcb01('0x38')]=_[_0xcb01('0x37')](_0x54ae1d[_0xcb01('0x31')],qs[_0xcb01('0x39')](_0x49eeb4[_0xcb01('0x34')][_0xcb01('0x39')]));_0x35a522[_0xcb01('0x38')]=_0x35a522[_0xcb01('0x38')][_0xcb01('0x3a')]?_0x35a522[_0xcb01('0x38')]:_0x54ae1d[_0xcb01('0x31')];if(!_0x49eeb4[_0xcb01('0x34')][_0xcb01('0x3b')](_0xcb01('0x3c'))){_0x35a522['limit']=qs['limit'](_0x49eeb4[_0xcb01('0x34')][_0xcb01('0x3d')]);_0x35a522[_0xcb01('0x1e')]=qs[_0xcb01('0x1e')](_0x49eeb4['query']['offset']);}_0x35a522[_0xcb01('0x3e')]=qs[_0xcb01('0x3f')](_0x49eeb4['query'][_0xcb01('0x3f')]);_0x35a522['where']=qs['filters'](_[_0xcb01('0x40')](_0x49eeb4[_0xcb01('0x34')],_0x54ae1d[_0xcb01('0x36')]),_0x35fe0a);if(_0x49eeb4[_0xcb01('0x34')][_0xcb01('0x41')]){_0x35a522['where']=_[_0xcb01('0x42')](_0x35a522[_0xcb01('0x43')],{'$or':_['map'](_0x35fe0a,function(_0x46c8b5){if(_0x46c8b5['type']!==_0xcb01('0x44')){var _0x2d7dba={};_0x2d7dba[_0x46c8b5[_0xcb01('0x33')]]={'$like':'%'+_0x49eeb4[_0xcb01('0x34')][_0xcb01('0x41')]+'%'};return _0x2d7dba;}})});}_0x35a522=_['merge']({},_0x35a522,_0x49eeb4[_0xcb01('0x45')]);var _0x18f181={'where':_0x35a522[_0xcb01('0x43')]};return db[_0xcb01('0x2d')][_0xcb01('0x20')](_0x18f181)[_0xcb01('0x27')](function(_0x562151){_0x527d37[_0xcb01('0x20')]=_0x562151;if(_0x49eeb4[_0xcb01('0x34')][_0xcb01('0x46')]){_0x35a522[_0xcb01('0x47')]=[{'all':!![]}];}return db[_0xcb01('0x2d')][_0xcb01('0x48')](_0x35a522);})['then'](function(_0x486bea){_0x527d37['rows']=_0x486bea;return _0x527d37;})[_0xcb01('0x27')](respondWithFilteredResult(_0x3938b0,_0x35a522))[_0xcb01('0x49')](handleError(_0x3938b0,null));};exports['show']=function(_0x312947,_0x5be2fa){var _0x27f24d={'raw':!![],'where':{'id':_0x312947[_0xcb01('0x4a')]['id']}},_0x3f5990={};_0x3f5990['model']=_[_0xcb01('0x35')](db[_0xcb01('0x2d')]['rawAttributes']);_0x3f5990[_0xcb01('0x34')]=_[_0xcb01('0x35')](_0x312947[_0xcb01('0x34')]);_0x3f5990[_0xcb01('0x36')]=_[_0xcb01('0x37')](_0x3f5990['model'],_0x3f5990['query']);_0x27f24d[_0xcb01('0x38')]=_[_0xcb01('0x37')](_0x3f5990['model'],qs[_0xcb01('0x39')](_0x312947['query'][_0xcb01('0x39')]));_0x27f24d[_0xcb01('0x38')]=_0x27f24d['attributes']['length']?_0x27f24d[_0xcb01('0x38')]:_0x3f5990[_0xcb01('0x31')];if(_0x312947[_0xcb01('0x34')][_0xcb01('0x46')]){_0x27f24d[_0xcb01('0x47')]=[{'all':!![]}];}_0x27f24d=_[_0xcb01('0x42')]({},_0x27f24d,_0x312947[_0xcb01('0x45')]);return db[_0xcb01('0x2d')][_0xcb01('0x4b')](_0x27f24d)[_0xcb01('0x27')](handleEntityNotFound(_0x5be2fa,null))[_0xcb01('0x27')](respondWithResult(_0x5be2fa,null))[_0xcb01('0x49')](handleError(_0x5be2fa,null));};exports[_0xcb01('0x4c')]=function(_0x8b4f86,_0x439ae9){return db[_0xcb01('0x2d')][_0xcb01('0x4c')](_0x8b4f86[_0xcb01('0x4d')],{})[_0xcb01('0x27')](respondWithResult(_0x439ae9,0xc9))[_0xcb01('0x49')](handleError(_0x439ae9,null));};exports[_0xcb01('0x26')]=function(_0x2441f5,_0x5b4ca0){if(_0x2441f5['body']['id']){delete _0x2441f5[_0xcb01('0x4d')]['id'];}return db['SquareMessage'][_0xcb01('0x4b')]({'where':{'id':_0x2441f5[_0xcb01('0x4a')]['id']}})[_0xcb01('0x27')](handleEntityNotFound(_0x5b4ca0,null))[_0xcb01('0x27')](saveUpdates(_0x2441f5[_0xcb01('0x4d')],null))['then'](respondWithResult(_0x5b4ca0,null))['catch'](handleError(_0x5b4ca0,null));};exports[_0xcb01('0x28')]=function(_0x228c77,_0xd46a43){return db[_0xcb01('0x2d')][_0xcb01('0x4b')]({'where':{'id':_0x228c77[_0xcb01('0x4a')]['id']}})['then'](handleEntityNotFound(_0xd46a43,null))[_0xcb01('0x27')](removeEntity(_0xd46a43,null))[_0xcb01('0x49')](handleError(_0xd46a43,null));}; \ No newline at end of file +var _0x15e9=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','map','SquareMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','length','include','create','body','update','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3f5522,_0x28e324){var _0x4731f1=function(_0xfe154){while(--_0xfe154){_0x3f5522['push'](_0x3f5522['shift']());}};_0x4731f1(++_0x28e324);}(_0x15e9,0xd6));var _0x915e=function(_0x1b3809,_0x56d7c3){_0x1b3809=_0x1b3809-0x0;var _0x262454=_0x15e9[_0x1b3809];return _0x262454;};'use strict';var emlformat=require(_0x915e('0x0'));var rimraf=require(_0x915e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x915e('0x2'));var rp=require(_0x915e('0x3'));var moment=require(_0x915e('0x4'));var BPromise=require(_0x915e('0x5'));var Mustache=require(_0x915e('0x6'));var util=require(_0x915e('0x7'));var path=require('path');var sox=require(_0x915e('0x8'));var csv=require(_0x915e('0x9'));var ejs=require(_0x915e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x915e('0xb'));var squel=require(_0x915e('0xc'));var crypto=require(_0x915e('0xd'));var jsforce=require(_0x915e('0xe'));var deskjs=require(_0x915e('0xf'));var toCsv=require(_0x915e('0x9'));var querystring=require(_0x915e('0x10'));var Papa=require('papaparse');var Redis=require(_0x915e('0x11'));var authService=require(_0x915e('0x12'));var qs=require(_0x915e('0x13'));var as=require(_0x915e('0x14'));var hardwareService=require(_0x915e('0x15'));var logger=require('../../config/logger')(_0x915e('0x16'));var utils=require(_0x915e('0x17'));var config=require(_0x915e('0x18'));var licenseUtil=require(_0x915e('0x19'));var db=require(_0x915e('0x1a'))['db'];function respondWithStatusCode(_0x45d1a3,_0x3a8d30){_0x3a8d30=_0x3a8d30||0xcc;return function(_0x20abac){if(_0x20abac){return _0x45d1a3['sendStatus'](_0x3a8d30);}return _0x45d1a3[_0x915e('0x1b')](_0x3a8d30)[_0x915e('0x1c')]();};}function respondWithResult(_0x2221f1,_0x5aa674){_0x5aa674=_0x5aa674||0xc8;return function(_0x1f8611){if(_0x1f8611){return _0x2221f1[_0x915e('0x1b')](_0x5aa674)[_0x915e('0x1d')](_0x1f8611);}};}function respondWithFilteredResult(_0x3a6f10,_0x5d4a58){return function(_0x137ad4){if(_0x137ad4){var _0x59a803=typeof _0x5d4a58[_0x915e('0x1e')]===_0x915e('0x1f')&&typeof _0x5d4a58['limit']===_0x915e('0x1f');var _0x8115c3=_0x137ad4[_0x915e('0x20')];var _0x34dc1e=_0x59a803?0x0:_0x5d4a58[_0x915e('0x1e')];var _0xdc9a7d=_0x59a803?_0x137ad4['count']:_0x5d4a58['offset']+_0x5d4a58[_0x915e('0x21')];var _0x5604a0;if(_0xdc9a7d>=_0x8115c3){_0xdc9a7d=_0x8115c3;_0x5604a0=0xc8;}else{_0x5604a0=0xce;}_0x3a6f10[_0x915e('0x1b')](_0x5604a0);return _0x3a6f10[_0x915e('0x22')](_0x915e('0x23'),_0x34dc1e+'-'+_0xdc9a7d+'/'+_0x8115c3)[_0x915e('0x1d')](_0x137ad4);}return null;};}function patchUpdates(_0x42ffe6){return function(_0x1629de){try{jsonpatch[_0x915e('0x24')](_0x1629de,_0x42ffe6,!![]);}catch(_0xebe891){return BPromise['reject'](_0xebe891);}return _0x1629de[_0x915e('0x25')]();};}function saveUpdates(_0x19bdae,_0x4fdb84){return function(_0x1139f4){if(_0x1139f4){return _0x1139f4['update'](_0x19bdae)[_0x915e('0x26')](function(_0x1eae9b){return _0x1eae9b;});}return null;};}function removeEntity(_0x56cfe1,_0x56edc5){return function(_0x94eba7){if(_0x94eba7){return _0x94eba7[_0x915e('0x27')]()[_0x915e('0x26')](function(){_0x56cfe1[_0x915e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x524660,_0x479712){return function(_0x4dc6ec){if(!_0x4dc6ec){_0x524660[_0x915e('0x28')](0x194);}return _0x4dc6ec;};}function handleError(_0x3901e8,_0x5f3394){_0x5f3394=_0x5f3394||0x1f4;return function(_0x4e88a6){logger[_0x915e('0x29')](_0x4e88a6[_0x915e('0x2a')]);if(_0x4e88a6['name']){delete _0x4e88a6[_0x915e('0x2b')];}_0x3901e8['status'](_0x5f3394)[_0x915e('0x2c')](_0x4e88a6);};}exports['index']=function(_0x28a549,_0x1d6c71){var _0x3a6dc5={},_0x58f729={},_0x2040d4={'count':0x0,'rows':[]};var _0x1b200c=_[_0x915e('0x2d')](db[_0x915e('0x2e')][_0x915e('0x2f')],function(_0x3cdac7){return{'name':_0x3cdac7[_0x915e('0x30')],'type':_0x3cdac7[_0x915e('0x31')]['key']};});_0x58f729[_0x915e('0x32')]=_['map'](_0x1b200c,_0x915e('0x2b'));_0x58f729[_0x915e('0x33')]=_[_0x915e('0x34')](_0x28a549['query']);_0x58f729[_0x915e('0x35')]=_[_0x915e('0x36')](_0x58f729[_0x915e('0x32')],_0x58f729[_0x915e('0x33')]);_0x3a6dc5['attributes']=_[_0x915e('0x36')](_0x58f729[_0x915e('0x32')],qs[_0x915e('0x37')](_0x28a549[_0x915e('0x33')][_0x915e('0x37')]));_0x3a6dc5['attributes']=_0x3a6dc5[_0x915e('0x38')]['length']?_0x3a6dc5[_0x915e('0x38')]:_0x58f729[_0x915e('0x32')];if(!_0x28a549[_0x915e('0x33')][_0x915e('0x39')](_0x915e('0x3a'))){_0x3a6dc5['limit']=qs[_0x915e('0x21')](_0x28a549[_0x915e('0x33')][_0x915e('0x21')]);_0x3a6dc5[_0x915e('0x1e')]=qs[_0x915e('0x1e')](_0x28a549['query'][_0x915e('0x1e')]);}_0x3a6dc5[_0x915e('0x3b')]=qs['sort'](_0x28a549[_0x915e('0x33')][_0x915e('0x3c')]);_0x3a6dc5[_0x915e('0x3d')]=qs[_0x915e('0x35')](_[_0x915e('0x3e')](_0x28a549[_0x915e('0x33')],_0x58f729['filters']),_0x1b200c);if(_0x28a549[_0x915e('0x33')]['filter']){_0x3a6dc5[_0x915e('0x3d')]=_['merge'](_0x3a6dc5[_0x915e('0x3d')],{'$or':_['map'](_0x1b200c,function(_0x1c00b4){if(_0x1c00b4['type']!==_0x915e('0x3f')){var _0x41b90a={};_0x41b90a[_0x1c00b4[_0x915e('0x2b')]]={'$like':'%'+_0x28a549[_0x915e('0x33')][_0x915e('0x40')]+'%'};return _0x41b90a;}})});}_0x3a6dc5=_[_0x915e('0x41')]({},_0x3a6dc5,_0x28a549[_0x915e('0x42')]);var _0x17b4e9={'where':_0x3a6dc5[_0x915e('0x3d')]};return db['SquareMessage'][_0x915e('0x20')](_0x17b4e9)[_0x915e('0x26')](function(_0xcaa887){_0x2040d4[_0x915e('0x20')]=_0xcaa887;if(_0x28a549['query'][_0x915e('0x43')]){_0x3a6dc5['include']=[{'all':!![]}];}return db[_0x915e('0x2e')][_0x915e('0x44')](_0x3a6dc5);})[_0x915e('0x26')](function(_0x5d3bb4){_0x2040d4['rows']=_0x5d3bb4;return _0x2040d4;})['then'](respondWithFilteredResult(_0x1d6c71,_0x3a6dc5))[_0x915e('0x45')](handleError(_0x1d6c71,null));};exports[_0x915e('0x46')]=function(_0x3ce680,_0x1d03e8){var _0x133867={'raw':!![],'where':{'id':_0x3ce680[_0x915e('0x47')]['id']}},_0x216584={};_0x216584[_0x915e('0x32')]=_[_0x915e('0x34')](db[_0x915e('0x2e')][_0x915e('0x2f')]);_0x216584['query']=_[_0x915e('0x34')](_0x3ce680[_0x915e('0x33')]);_0x216584['filters']=_['intersection'](_0x216584['model'],_0x216584[_0x915e('0x33')]);_0x133867[_0x915e('0x38')]=_[_0x915e('0x36')](_0x216584[_0x915e('0x32')],qs[_0x915e('0x37')](_0x3ce680[_0x915e('0x33')]['fields']));_0x133867['attributes']=_0x133867['attributes'][_0x915e('0x48')]?_0x133867[_0x915e('0x38')]:_0x216584[_0x915e('0x32')];if(_0x3ce680['query'][_0x915e('0x43')]){_0x133867[_0x915e('0x49')]=[{'all':!![]}];}_0x133867=_[_0x915e('0x41')]({},_0x133867,_0x3ce680['options']);return db[_0x915e('0x2e')]['find'](_0x133867)[_0x915e('0x26')](handleEntityNotFound(_0x1d03e8,null))[_0x915e('0x26')](respondWithResult(_0x1d03e8,null))[_0x915e('0x45')](handleError(_0x1d03e8,null));};exports[_0x915e('0x4a')]=function(_0x144ab3,_0x1753ca){return db['SquareMessage'][_0x915e('0x4a')](_0x144ab3[_0x915e('0x4b')],{})['then'](respondWithResult(_0x1753ca,0xc9))[_0x915e('0x45')](handleError(_0x1753ca,null));};exports[_0x915e('0x4c')]=function(_0x296b6c,_0x15c4d6){if(_0x296b6c[_0x915e('0x4b')]['id']){delete _0x296b6c[_0x915e('0x4b')]['id'];}return db[_0x915e('0x2e')][_0x915e('0x4d')]({'where':{'id':_0x296b6c['params']['id']}})[_0x915e('0x26')](handleEntityNotFound(_0x15c4d6,null))[_0x915e('0x26')](saveUpdates(_0x296b6c[_0x915e('0x4b')],null))[_0x915e('0x26')](respondWithResult(_0x15c4d6,null))[_0x915e('0x45')](handleError(_0x15c4d6,null));};exports[_0x915e('0x27')]=function(_0x5c20ce,_0x29f00c){return db[_0x915e('0x2e')][_0x915e('0x4d')]({'where':{'id':_0x5c20ce[_0x915e('0x47')]['id']}})[_0x915e('0x26')](handleEntityNotFound(_0x29f00c,null))[_0x915e('0x26')](removeEntity(_0x29f00c,null))[_0x915e('0x45')](handleError(_0x29f00c,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 2a5113d..65b989c 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 _0xecdc=['./squareMessage.attributes','exports','define','square_messages','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x563fa5,_0x6e8b70){var _0x39991d=function(_0x51e638){while(--_0x51e638){_0x563fa5['push'](_0x563fa5['shift']());}};_0x39991d(++_0x6e8b70);}(_0xecdc,0x88));var _0xcecd=function(_0x4cedc7,_0x116b4f){_0x4cedc7=_0x4cedc7-0x0;var _0x2cc4c2=_0xecdc[_0x4cedc7];return _0x2cc4c2;};'use strict';var _=require(_0xcecd('0x0'));var util=require('util');var logger=require(_0xcecd('0x1'))(_0xcecd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcecd('0x3'));var fs=require('fs');var path=require(_0xcecd('0x4'));var rimraf=require(_0xcecd('0x5'));var config=require(_0xcecd('0x6'));var attributes=require(_0xcecd('0x7'));module[_0xcecd('0x8')]=function(_0x1b4185,_0x384e8a){return _0x1b4185[_0xcecd('0x9')]('SquareMessage',attributes,{'tableName':_0xcecd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe79e=['api','bluebird','request-promise','rimraf','../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe79e,0x1ad));var _0xee79=function(_0x5e7faa,_0x300960){_0x5e7faa=_0x5e7faa-0x0;var _0x435e17=_0xe79e[_0x5e7faa];return _0x435e17;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee79('0x0'))(_0xee79('0x1'));var moment=require('moment');var BPromise=require(_0xee79('0x2'));var rp=require(_0xee79('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee79('0x4'));var config=require(_0xee79('0x5'));var attributes=require(_0xee79('0x6'));module['exports']=function(_0x3e791b,_0x4e8bf7){return _0x3e791b[_0xee79('0x7')](_0xee79('0x8'),attributes,{'tableName':_0xee79('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 3734ef0..87a8f7b 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 _0x4d90=['rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','SquareMessage,\x20%s,\x20%s','message','result','SquareMessage','create','body','options','raw','info','CreateSquareMessage','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x491249,_0x3acad4){var _0xc507ce=function(_0x274cec){while(--_0x274cec){_0x491249['push'](_0x491249['shift']());}};_0xc507ce(++_0x3acad4);}(_0x4d90,0x8a));var _0x04d9=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x4d90[_0x5447fd];return _0x15b28a;};'use strict';var _=require('lodash');var util=require(_0x04d9('0x0'));var moment=require(_0x04d9('0x1'));var BPromise=require(_0x04d9('0x2'));var rs=require(_0x04d9('0x3'));var fs=require('fs');var Redis=require(_0x04d9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x04d9('0x5'));var logger=require(_0x04d9('0x6'))(_0x04d9('0x7'));var config=require(_0x04d9('0x8'));var jayson=require(_0x04d9('0x9'));var client=jayson[_0x04d9('0xa')][_0x04d9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37d22a,_0x508b12,_0x44a589){return new BPromise(function(_0x12deac,_0x4022a4){return client[_0x04d9('0xc')](_0x37d22a,_0x44a589)[_0x04d9('0xd')](function(_0x55891f){logger['info']('SquareMessage,\x20%s,\x20%s',_0x508b12,_0x04d9('0xe'));logger[_0x04d9('0xf')](_0x04d9('0x10'),_0x508b12,_0x04d9('0xe'),JSON[_0x04d9('0x11')](_0x55891f));if(_0x55891f['error']){if(_0x55891f[_0x04d9('0x12')]['code']===0x1f4){logger['error'](_0x04d9('0x13'),_0x508b12,_0x55891f['error'][_0x04d9('0x14')]);return _0x4022a4(_0x55891f[_0x04d9('0x12')][_0x04d9('0x14')]);}logger[_0x04d9('0x12')](_0x04d9('0x13'),_0x508b12,_0x55891f['error'][_0x04d9('0x14')]);return _0x12deac(_0x55891f['error'][_0x04d9('0x14')]);}else{logger['info'](_0x04d9('0x13'),_0x508b12,_0x04d9('0xe'));_0x12deac(_0x55891f[_0x04d9('0x15')]['message']);}})['catch'](function(_0xb958d){logger[_0x04d9('0x12')](_0x04d9('0x13'),_0x508b12,_0xb958d);_0x4022a4(_0xb958d);});});}exports['CreateSquareMessage']=function(_0x4d5209){var _0x3eacba=this;return new Promise(function(_0x374f11,_0x4b4d55){return db[_0x04d9('0x16')][_0x04d9('0x17')](_0x4d5209[_0x04d9('0x18')],{'raw':_0x4d5209[_0x04d9('0x19')]?_0x4d5209[_0x04d9('0x19')][_0x04d9('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1fc963){logger[_0x04d9('0x1b')](_0x04d9('0x1c'),_0x4d5209);logger[_0x04d9('0xf')](_0x04d9('0x1c'),_0x4d5209,JSON[_0x04d9('0x11')](_0x1fc963));_0x374f11(_0x1fc963);})['catch'](function(_0x26cf21){logger[_0x04d9('0x12')](_0x04d9('0x1c'),_0x26cf21[_0x04d9('0x14')],_0x4d5209);_0x4b4d55(_0x3eacba[_0x04d9('0x12')](0x1f4,_0x26cf21[_0x04d9('0x14')]));});});}; \ No newline at end of file +var _0x1b50=['stringify','error','message','result','SquareMessage,\x20%s,\x20%s','CreateSquareMessage','options','raw','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1b50,0x103));var _0x01b5=function(_0x407195,_0x4d4227){_0x407195=_0x407195-0x0;var _0x50c6b7=_0x1b50[_0x407195];return _0x50c6b7;};'use strict';var _=require('lodash');var util=require(_0x01b5('0x0'));var moment=require(_0x01b5('0x1'));var BPromise=require(_0x01b5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01b5('0x3'));var db=require(_0x01b5('0x4'))['db'];var utils=require(_0x01b5('0x5'));var logger=require('../../config/logger')(_0x01b5('0x6'));var config=require(_0x01b5('0x7'));var jayson=require(_0x01b5('0x8'));var client=jayson[_0x01b5('0x9')][_0x01b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x94c44c,_0x835c4f,_0x46067c){return new BPromise(function(_0x5186d4,_0x4093c0){return client[_0x01b5('0xb')](_0x94c44c,_0x46067c)[_0x01b5('0xc')](function(_0xc2311b){logger[_0x01b5('0xd')]('SquareMessage,\x20%s,\x20%s',_0x835c4f,'request\x20sent');logger[_0x01b5('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x835c4f,_0x01b5('0xf'),JSON[_0x01b5('0x10')](_0xc2311b));if(_0xc2311b[_0x01b5('0x11')]){if(_0xc2311b[_0x01b5('0x11')]['code']===0x1f4){logger[_0x01b5('0x11')]('SquareMessage,\x20%s,\x20%s',_0x835c4f,_0xc2311b['error']['message']);return _0x4093c0(_0xc2311b[_0x01b5('0x11')][_0x01b5('0x12')]);}logger[_0x01b5('0x11')]('SquareMessage,\x20%s,\x20%s',_0x835c4f,_0xc2311b[_0x01b5('0x11')]['message']);return _0x5186d4(_0xc2311b[_0x01b5('0x11')][_0x01b5('0x12')]);}else{logger[_0x01b5('0xd')]('SquareMessage,\x20%s,\x20%s',_0x835c4f,_0x01b5('0xf'));_0x5186d4(_0xc2311b[_0x01b5('0x13')][_0x01b5('0x12')]);}})['catch'](function(_0x331942){logger['error'](_0x01b5('0x14'),_0x835c4f,_0x331942);_0x4093c0(_0x331942);});});}exports[_0x01b5('0x15')]=function(_0x13fa98){var _0x1e0241=this;return new Promise(function(_0x238885,_0x4b2db8){return db['SquareMessage']['create'](_0x13fa98['body'],{'raw':_0x13fa98[_0x01b5('0x16')]?_0x13fa98[_0x01b5('0x16')][_0x01b5('0x17')]===undefined?!![]:![]:!![]})[_0x01b5('0xc')](function(_0x2b5a95){logger[_0x01b5('0xd')](_0x01b5('0x15'),_0x13fa98);logger[_0x01b5('0xe')]('CreateSquareMessage',_0x13fa98,JSON[_0x01b5('0x10')](_0x2b5a95));_0x238885(_0x2b5a95);})[_0x01b5('0x18')](function(_0x52d6fd){logger[_0x01b5('0x11')](_0x01b5('0x15'),_0x52d6fd[_0x01b5('0x12')],_0x13fa98);_0x4b2db8(_0x1e0241[_0x01b5('0x11')](0x1f4,_0x52d6fd[_0x01b5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 224c640..9f43a08 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 _0x2b37=['exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/test','15s','create','put','update','delete','destroy'];(function(_0x1d3264,_0x58afe9){var _0x36960b=function(_0x503acd){while(--_0x503acd){_0x1d3264['push'](_0x1d3264['shift']());}};_0x36960b(++_0x58afe9);}(_0x2b37,0x131));var _0x72b3=function(_0xb9923d,_0x36ce6c){_0xb9923d=_0xb9923d-0x0;var _0x239ce1=_0x2b37[_0xb9923d];return _0x239ce1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x72b3('0x0'));var timeout=require(_0x72b3('0x1'));var express=require('express');var router=express[_0x72b3('0x2')]();var fs_extra=require(_0x72b3('0x3'));var auth=require(_0x72b3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x72b3('0x5'));var controller=require('./squareOdbc.controller');router['get']('/',auth[_0x72b3('0x6')](),controller[_0x72b3('0x7')]);router[_0x72b3('0x8')](_0x72b3('0x9'),auth['isAuthenticated'](),controller[_0x72b3('0xa')]);router[_0x72b3('0x8')](_0x72b3('0xb'),auth['isAuthenticated'](),timeout(_0x72b3('0xc')),controller['test']);router['post']('/',auth[_0x72b3('0x6')](),controller[_0x72b3('0xd')]);router[_0x72b3('0xe')](_0x72b3('0x9'),auth[_0x72b3('0x6')](),controller[_0x72b3('0xf')]);router[_0x72b3('0x10')](_0x72b3('0x9'),auth[_0x72b3('0x6')](),controller[_0x72b3('0x11')]);module[_0x72b3('0x12')]=router; \ No newline at end of file +var _0xda20=['fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','/:id/test','15s','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x244f1c,_0x116cc2){var _0x326435=function(_0x3eadf6){while(--_0x3eadf6){_0x244f1c['push'](_0x244f1c['shift']());}};_0x326435(++_0x116cc2);}(_0xda20,0x9a));var _0x0da2=function(_0x236ea6,_0x2434e4){_0x236ea6=_0x236ea6-0x0;var _0x4106e1=_0xda20[_0x236ea6];return _0x4106e1;};'use strict';var multer=require(_0x0da2('0x0'));var util=require(_0x0da2('0x1'));var path=require(_0x0da2('0x2'));var timeout=require(_0x0da2('0x3'));var express=require(_0x0da2('0x4'));var router=express[_0x0da2('0x5')]();var fs_extra=require(_0x0da2('0x6'));var auth=require(_0x0da2('0x7'));var interaction=require(_0x0da2('0x8'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0x0da2('0x9')]('/',auth['isAuthenticated'](),controller[_0x0da2('0xa')]);router[_0x0da2('0x9')](_0x0da2('0xb'),auth[_0x0da2('0xc')](),controller['show']);router[_0x0da2('0x9')](_0x0da2('0xd'),auth['isAuthenticated'](),timeout(_0x0da2('0xe')),controller['test']);router[_0x0da2('0xf')]('/',auth[_0x0da2('0xc')](),controller['create']);router[_0x0da2('0x10')](_0x0da2('0xb'),auth[_0x0da2('0xc')](),controller[_0x0da2('0x11')]);router[_0x0da2('0x12')]('/:id',auth[_0x0da2('0xc')](),controller['destroy']);module[_0x0da2('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index c29be72..4b542d1 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 _0xaac7=['name','sequelize','STRING'];(function(_0x5d96ec,_0x39248f){var _0x350f30=function(_0x8f623f){while(--_0x8f623f){_0x5d96ec['push'](_0x5d96ec['shift']());}};_0x350f30(++_0x39248f);}(_0xaac7,0xd6));var _0x7aac=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xaac7[_0x164eca];return _0x2ce562;};'use strict';var Sequelize=require(_0x7aac('0x0'));module['exports']={'name':{'type':Sequelize[_0x7aac('0x1')],'unique':_0x7aac('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x7aac('0x1')]},'description':{'type':Sequelize[_0x7aac('0x1')]}}; \ No newline at end of file +var _0xc5b5=['name','STRING'];(function(_0x2ff3d2,_0x1e7b57){var _0x46dbb5=function(_0x18ced5){while(--_0x18ced5){_0x2ff3d2['push'](_0x2ff3d2['shift']());}};_0x46dbb5(++_0x1e7b57);}(_0xc5b5,0xc0));var _0x5c5b=function(_0x264f48,_0x2c82d8){_0x264f48=_0x264f48-0x0;var _0xb99167=_0xc5b5[_0x264f48];return _0xb99167;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5c5b('0x0'),'allowNull':![]},'dsn':{'type':Sequelize[_0x5c5b('0x1')]},'description':{'type':Sequelize[_0x5c5b('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index fc6b564..ba4816f 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 _0xe529=['fieldName','type','key','query','keys','filters','model','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','intersection','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','find','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','get','ODBC','UserProfileResource','sendStatus','error','stack','name','index','map','SquareOdbc','rawAttributes'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0xe529,0xda));var _0x9e52=function(_0x267750,_0x54f315){_0x267750=_0x267750-0x0;var _0x12f0dd=_0xe529[_0x267750];return _0x12f0dd;};'use strict';var emlformat=require(_0x9e52('0x0'));var rimraf=require(_0x9e52('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e52('0x2'));var rp=require(_0x9e52('0x3'));var moment=require(_0x9e52('0x4'));var BPromise=require(_0x9e52('0x5'));var Mustache=require(_0x9e52('0x6'));var util=require(_0x9e52('0x7'));var path=require(_0x9e52('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9e52('0x9'));var _=require(_0x9e52('0xa'));var squel=require(_0x9e52('0xb'));var crypto=require(_0x9e52('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9e52('0xd'));var toCsv=require(_0x9e52('0xe'));var querystring=require(_0x9e52('0xf'));var Papa=require(_0x9e52('0x10'));var Redis=require(_0x9e52('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9e52('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e52('0x13'));var logger=require(_0x9e52('0x14'))(_0x9e52('0x15'));var utils=require(_0x9e52('0x16'));var config=require(_0x9e52('0x17'));var licenseUtil=require(_0x9e52('0x18'));var db=require(_0x9e52('0x19'))['db'];function respondWithStatusCode(_0x85f1e5,_0x392ef2){_0x392ef2=_0x392ef2||0xcc;return function(_0x164622){if(_0x164622){return _0x85f1e5['sendStatus'](_0x392ef2);}return _0x85f1e5[_0x9e52('0x1a')](_0x392ef2)[_0x9e52('0x1b')]();};}function respondWithResult(_0x376709,_0x1c5cd5){_0x1c5cd5=_0x1c5cd5||0xc8;return function(_0x17e523){if(_0x17e523){return _0x376709[_0x9e52('0x1a')](_0x1c5cd5)[_0x9e52('0x1c')](_0x17e523);}};}function respondWithFilteredResult(_0x109b24,_0x2ab28c){return function(_0x4e88c0){if(_0x4e88c0){var _0x2e3c9e=typeof _0x2ab28c[_0x9e52('0x1d')]===_0x9e52('0x1e')&&typeof _0x2ab28c[_0x9e52('0x1f')]==='undefined';var _0x414dec=_0x4e88c0['count'];var _0x7dc64=_0x2e3c9e?0x0:_0x2ab28c['offset'];var _0x473ce3=_0x2e3c9e?_0x4e88c0[_0x9e52('0x20')]:_0x2ab28c['offset']+_0x2ab28c[_0x9e52('0x1f')];var _0x2a0023;if(_0x473ce3>=_0x414dec){_0x473ce3=_0x414dec;_0x2a0023=0xc8;}else{_0x2a0023=0xce;}_0x109b24[_0x9e52('0x1a')](_0x2a0023);return _0x109b24['set'](_0x9e52('0x21'),_0x7dc64+'-'+_0x473ce3+'/'+_0x414dec)[_0x9e52('0x1c')](_0x4e88c0);}return null;};}function patchUpdates(_0x48fb81){return function(_0xc085d0){try{jsonpatch[_0x9e52('0x22')](_0xc085d0,_0x48fb81,!![]);}catch(_0x2a5127){return BPromise['reject'](_0x2a5127);}return _0xc085d0['save']();};}function saveUpdates(_0x5ca71f,_0x3d6cc9){return function(_0x5bc56a){if(_0x5bc56a){return _0x5bc56a[_0x9e52('0x23')](_0x5ca71f)[_0x9e52('0x24')](function(_0x5bd4dd){return _0x5bd4dd;});}return null;};}function removeEntity(_0x5fa9a3,_0x125179){return function(_0x5f0913){if(_0x5f0913){return _0x5f0913[_0x9e52('0x25')]()[_0x9e52('0x24')](function(){var _0x2a02f6=_0x5f0913[_0x9e52('0x26')]({'plain':!![]});var _0x3a2d83=_0x9e52('0x27');return db[_0x9e52('0x28')]['destroy']({'where':{'type':_0x3a2d83,'resourceId':_0x2a02f6['id']}})[_0x9e52('0x24')](function(){return _0x5f0913;});})[_0x9e52('0x24')](function(){_0x5fa9a3[_0x9e52('0x1a')](0xcc)[_0x9e52('0x1b')]();});}};}function handleEntityNotFound(_0x2cf7ac,_0x33b333){return function(_0x1a26dd){if(!_0x1a26dd){_0x2cf7ac[_0x9e52('0x29')](0x194);}return _0x1a26dd;};}function handleError(_0x387728,_0x574e1d){_0x574e1d=_0x574e1d||0x1f4;return function(_0x5e6200){logger[_0x9e52('0x2a')](_0x5e6200[_0x9e52('0x2b')]);if(_0x5e6200['name']){delete _0x5e6200[_0x9e52('0x2c')];}_0x387728['status'](_0x574e1d)['send'](_0x5e6200);};}exports[_0x9e52('0x2d')]=function(_0x644af9,_0x93f8e0){var _0x440db6={},_0x35b7a8={},_0x18c686={'count':0x0,'rows':[]};var _0xc366c4=_[_0x9e52('0x2e')](db[_0x9e52('0x2f')][_0x9e52('0x30')],function(_0x191181){return{'name':_0x191181[_0x9e52('0x31')],'type':_0x191181[_0x9e52('0x32')][_0x9e52('0x33')]};});_0x35b7a8['model']=_[_0x9e52('0x2e')](_0xc366c4,_0x9e52('0x2c'));_0x35b7a8[_0x9e52('0x34')]=_[_0x9e52('0x35')](_0x644af9[_0x9e52('0x34')]);_0x35b7a8[_0x9e52('0x36')]=_['intersection'](_0x35b7a8[_0x9e52('0x37')],_0x35b7a8['query']);_0x440db6[_0x9e52('0x38')]=_['intersection'](_0x35b7a8[_0x9e52('0x37')],qs[_0x9e52('0x39')](_0x644af9['query'][_0x9e52('0x39')]));_0x440db6[_0x9e52('0x38')]=_0x440db6['attributes'][_0x9e52('0x3a')]?_0x440db6['attributes']:_0x35b7a8['model'];if(!_0x644af9['query']['hasOwnProperty']('nolimit')){_0x440db6['limit']=qs['limit'](_0x644af9[_0x9e52('0x34')]['limit']);_0x440db6[_0x9e52('0x1d')]=qs[_0x9e52('0x1d')](_0x644af9[_0x9e52('0x34')][_0x9e52('0x1d')]);}_0x440db6[_0x9e52('0x3b')]=qs[_0x9e52('0x3c')](_0x644af9[_0x9e52('0x34')]['sort']);_0x440db6[_0x9e52('0x3d')]=qs['filters'](_[_0x9e52('0x3e')](_0x644af9[_0x9e52('0x34')],_0x35b7a8[_0x9e52('0x36')]),_0xc366c4);if(_0x644af9[_0x9e52('0x34')]['filter']){_0x440db6['where']=_[_0x9e52('0x3f')](_0x440db6[_0x9e52('0x3d')],{'$or':_['map'](_0xc366c4,function(_0x1299e3){if(_0x1299e3['type']!==_0x9e52('0x40')){var _0x31fbec={};_0x31fbec[_0x1299e3[_0x9e52('0x2c')]]={'$like':'%'+_0x644af9[_0x9e52('0x34')][_0x9e52('0x41')]+'%'};return _0x31fbec;}})});}_0x440db6=_['merge']({},_0x440db6,_0x644af9[_0x9e52('0x42')]);var _0x9c354b={'where':_0x440db6['where']};return db[_0x9e52('0x2f')][_0x9e52('0x20')](_0x9c354b)[_0x9e52('0x24')](function(_0x14112f){_0x18c686[_0x9e52('0x20')]=_0x14112f;if(_0x644af9[_0x9e52('0x34')][_0x9e52('0x43')]){_0x440db6[_0x9e52('0x44')]=[{'all':!![]}];}return db[_0x9e52('0x2f')][_0x9e52('0x45')](_0x440db6);})['then'](function(_0xff4102){_0x18c686[_0x9e52('0x46')]=_0xff4102;return _0x18c686;})['then'](respondWithFilteredResult(_0x93f8e0,_0x440db6))[_0x9e52('0x47')](handleError(_0x93f8e0,null));};exports[_0x9e52('0x48')]=function(_0x59c149,_0x3fc735){var _0x383a3c={'raw':!![],'where':{'id':_0x59c149[_0x9e52('0x49')]['id']}},_0x144ff0={};_0x144ff0[_0x9e52('0x37')]=_[_0x9e52('0x35')](db['SquareOdbc'][_0x9e52('0x30')]);_0x144ff0[_0x9e52('0x34')]=_[_0x9e52('0x35')](_0x59c149['query']);_0x144ff0[_0x9e52('0x36')]=_[_0x9e52('0x4a')](_0x144ff0[_0x9e52('0x37')],_0x144ff0[_0x9e52('0x34')]);_0x383a3c['attributes']=_['intersection'](_0x144ff0[_0x9e52('0x37')],qs[_0x9e52('0x39')](_0x59c149[_0x9e52('0x34')][_0x9e52('0x39')]));_0x383a3c[_0x9e52('0x38')]=_0x383a3c[_0x9e52('0x38')][_0x9e52('0x3a')]?_0x383a3c[_0x9e52('0x38')]:_0x144ff0[_0x9e52('0x37')];if(_0x59c149[_0x9e52('0x34')][_0x9e52('0x43')]){_0x383a3c[_0x9e52('0x44')]=[{'all':!![]}];}_0x383a3c=_[_0x9e52('0x3f')]({},_0x383a3c,_0x59c149[_0x9e52('0x42')]);return db['SquareOdbc']['find'](_0x383a3c)['then'](handleEntityNotFound(_0x3fc735,null))[_0x9e52('0x24')](respondWithResult(_0x3fc735,null))[_0x9e52('0x47')](handleError(_0x3fc735,null));};exports['create']=function(_0x4eae29,_0x37e262){return db[_0x9e52('0x2f')]['create'](_0x4eae29[_0x9e52('0x4b')],{})[_0x9e52('0x24')](function(_0xf28f40){var _0x3e0d73=_0x4eae29[_0x9e52('0x4c')]['get']({'plain':!![]});if(!_0x3e0d73)throw new Error(_0x9e52('0x4d'));if(_0x3e0d73[_0x9e52('0x4e')]===_0x9e52('0x4c')){var _0x533689=_0xf28f40['get']({'plain':!![]});var _0x4cc719='ODBC';return db[_0x9e52('0x4f')]['find']({'where':{'name':_0x4cc719,'userProfileId':_0x3e0d73[_0x9e52('0x50')]},'raw':!![]})['then'](function(_0x1f9347){if(_0x1f9347&&_0x1f9347[_0x9e52('0x51')]===0x0){return db[_0x9e52('0x28')][_0x9e52('0x52')]({'name':_0x533689[_0x9e52('0x2c')],'resourceId':_0x533689['id'],'type':_0x1f9347['name'],'sectionId':_0x1f9347['id']},{})[_0x9e52('0x24')](function(){return _0xf28f40;});}else{return _0xf28f40;}})['catch'](function(_0x1a9623){logger[_0x9e52('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a9623);throw _0x1a9623;});}return _0xf28f40;})[_0x9e52('0x24')](respondWithResult(_0x37e262,0xc9))[_0x9e52('0x47')](handleError(_0x37e262,null));};exports[_0x9e52('0x23')]=function(_0x36ef09,_0x25faa1){if(_0x36ef09[_0x9e52('0x4b')]['id']){delete _0x36ef09[_0x9e52('0x4b')]['id'];}return db[_0x9e52('0x2f')][_0x9e52('0x53')]({'where':{'id':_0x36ef09[_0x9e52('0x49')]['id']}})['then'](handleEntityNotFound(_0x25faa1,null))[_0x9e52('0x24')](saveUpdates(_0x36ef09[_0x9e52('0x4b')],null))[_0x9e52('0x24')](respondWithResult(_0x25faa1,null))[_0x9e52('0x47')](handleError(_0x25faa1,null));};exports[_0x9e52('0x25')]=function(_0x5471a1,_0x95ef2d){return db['SquareOdbc'][_0x9e52('0x53')]({'where':{'id':_0x5471a1[_0x9e52('0x49')]['id']}})[_0x9e52('0x24')](handleEntityNotFound(_0x95ef2d,null))['then'](removeEntity(_0x95ef2d,null))['catch'](handleError(_0x95ef2d,null));};exports[_0x9e52('0x54')]=function(_0x2d7faf,_0x28e17e,_0x407b36){var _0x1f345f;return db[_0x9e52('0x2f')][_0x9e52('0x53')]({'where':{'id':_0x2d7faf[_0x9e52('0x49')]['id']},'attributes':['id',_0x9e52('0x55')]})[_0x9e52('0x24')](handleEntityNotFound(_0x28e17e,null))[_0x9e52('0x24')](function(_0x39e7f5){if(_0x39e7f5){var _0x37b81f=require(_0x9e52('0x56'))();_0x37b81f[_0x9e52('0x57')](_0x39e7f5[_0x9e52('0x55')]);_0x37b81f[_0x9e52('0x58')]();return _0x39e7f5;}})[_0x9e52('0x24')](respondWithResult(_0x28e17e,null))[_0x9e52('0x47')](handleError(_0x28e17e,null));}; \ No newline at end of file +var _0x56e3=['path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','UserProfileResource','error','stack','name','send','index','SquareOdbc','rawAttributes','type','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','openSync','closeSync','rimraf','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x56e3,0x14e));var _0x356e=function(_0x2f73ea,_0xbffe20){_0x2f73ea=_0x2f73ea-0x0;var _0x306839=_0x56e3[_0x2f73ea];return _0x306839;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x356e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x356e('0x1'));var rp=require(_0x356e('0x2'));var moment=require(_0x356e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x356e('0x4'));var util=require(_0x356e('0x5'));var path=require(_0x356e('0x6'));var sox=require(_0x356e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x356e('0x8'));var squel=require(_0x356e('0x9'));var crypto=require(_0x356e('0xa'));var jsforce=require(_0x356e('0xb'));var deskjs=require(_0x356e('0xc'));var toCsv=require(_0x356e('0xd'));var querystring=require(_0x356e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x356e('0xf'));var qs=require(_0x356e('0x10'));var as=require(_0x356e('0x11'));var hardwareService=require(_0x356e('0x12'));var logger=require(_0x356e('0x13'))('api');var utils=require(_0x356e('0x14'));var config=require(_0x356e('0x15'));var licenseUtil=require(_0x356e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25eb2c,_0x1815d0){_0x1815d0=_0x1815d0||0xcc;return function(_0xf50016){if(_0xf50016){return _0x25eb2c[_0x356e('0x17')](_0x1815d0);}return _0x25eb2c[_0x356e('0x18')](_0x1815d0)[_0x356e('0x19')]();};}function respondWithResult(_0x1335b9,_0x22f3f1){_0x22f3f1=_0x22f3f1||0xc8;return function(_0x58847c){if(_0x58847c){return _0x1335b9[_0x356e('0x18')](_0x22f3f1)['json'](_0x58847c);}};}function respondWithFilteredResult(_0x36e05f,_0x10f1f5){return function(_0x3b6a8f){if(_0x3b6a8f){var _0x4333a8=typeof _0x10f1f5[_0x356e('0x1a')]==='undefined'&&typeof _0x10f1f5['limit']===_0x356e('0x1b');var _0x4d1d4a=_0x3b6a8f[_0x356e('0x1c')];var _0x36db5b=_0x4333a8?0x0:_0x10f1f5[_0x356e('0x1a')];var _0x432e96=_0x4333a8?_0x3b6a8f['count']:_0x10f1f5['offset']+_0x10f1f5[_0x356e('0x1d')];var _0x47f1fd;if(_0x432e96>=_0x4d1d4a){_0x432e96=_0x4d1d4a;_0x47f1fd=0xc8;}else{_0x47f1fd=0xce;}_0x36e05f['status'](_0x47f1fd);return _0x36e05f[_0x356e('0x1e')](_0x356e('0x1f'),_0x36db5b+'-'+_0x432e96+'/'+_0x4d1d4a)['json'](_0x3b6a8f);}return null;};}function patchUpdates(_0x4dca49){return function(_0x39f581){try{jsonpatch[_0x356e('0x20')](_0x39f581,_0x4dca49,!![]);}catch(_0x551c39){return BPromise[_0x356e('0x21')](_0x551c39);}return _0x39f581[_0x356e('0x22')]();};}function saveUpdates(_0x50a395,_0x424c60){return function(_0x3c2d9b){if(_0x3c2d9b){return _0x3c2d9b[_0x356e('0x23')](_0x50a395)['then'](function(_0x254a81){return _0x254a81;});}return null;};}function removeEntity(_0x29e060,_0x33376d){return function(_0x30bd77){if(_0x30bd77){return _0x30bd77[_0x356e('0x24')]()[_0x356e('0x25')](function(){var _0x254893=_0x30bd77['get']({'plain':!![]});var _0x4db70c='ODBC';return db[_0x356e('0x26')][_0x356e('0x24')]({'where':{'type':_0x4db70c,'resourceId':_0x254893['id']}})[_0x356e('0x25')](function(){return _0x30bd77;});})[_0x356e('0x25')](function(){_0x29e060[_0x356e('0x18')](0xcc)[_0x356e('0x19')]();});}};}function handleEntityNotFound(_0x43d99f,_0x49f038){return function(_0x42979e){if(!_0x42979e){_0x43d99f['sendStatus'](0x194);}return _0x42979e;};}function handleError(_0x4be980,_0x546047){_0x546047=_0x546047||0x1f4;return function(_0x177fa0){logger[_0x356e('0x27')](_0x177fa0[_0x356e('0x28')]);if(_0x177fa0['name']){delete _0x177fa0[_0x356e('0x29')];}_0x4be980[_0x356e('0x18')](_0x546047)[_0x356e('0x2a')](_0x177fa0);};}exports[_0x356e('0x2b')]=function(_0x2d2613,_0x5733ca){var _0x673063={},_0x57b553={},_0x3feb9a={'count':0x0,'rows':[]};var _0x5b077d=_['map'](db[_0x356e('0x2c')][_0x356e('0x2d')],function(_0x553d37){return{'name':_0x553d37['fieldName'],'type':_0x553d37[_0x356e('0x2e')]['key']};});_0x57b553[_0x356e('0x2f')]=_[_0x356e('0x30')](_0x5b077d,_0x356e('0x29'));_0x57b553['query']=_[_0x356e('0x31')](_0x2d2613[_0x356e('0x32')]);_0x57b553[_0x356e('0x33')]=_[_0x356e('0x34')](_0x57b553[_0x356e('0x2f')],_0x57b553[_0x356e('0x32')]);_0x673063[_0x356e('0x35')]=_['intersection'](_0x57b553[_0x356e('0x2f')],qs['fields'](_0x2d2613['query'][_0x356e('0x36')]));_0x673063[_0x356e('0x35')]=_0x673063[_0x356e('0x35')]['length']?_0x673063[_0x356e('0x35')]:_0x57b553['model'];if(!_0x2d2613[_0x356e('0x32')][_0x356e('0x37')]('nolimit')){_0x673063['limit']=qs[_0x356e('0x1d')](_0x2d2613[_0x356e('0x32')][_0x356e('0x1d')]);_0x673063[_0x356e('0x1a')]=qs[_0x356e('0x1a')](_0x2d2613['query'][_0x356e('0x1a')]);}_0x673063['order']=qs[_0x356e('0x38')](_0x2d2613['query'][_0x356e('0x38')]);_0x673063[_0x356e('0x39')]=qs[_0x356e('0x33')](_[_0x356e('0x3a')](_0x2d2613[_0x356e('0x32')],_0x57b553['filters']),_0x5b077d);if(_0x2d2613[_0x356e('0x32')][_0x356e('0x3b')]){_0x673063[_0x356e('0x39')]=_[_0x356e('0x3c')](_0x673063[_0x356e('0x39')],{'$or':_[_0x356e('0x30')](_0x5b077d,function(_0x25d64e){if(_0x25d64e[_0x356e('0x2e')]!==_0x356e('0x3d')){var _0x33f702={};_0x33f702[_0x25d64e['name']]={'$like':'%'+_0x2d2613['query'][_0x356e('0x3b')]+'%'};return _0x33f702;}})});}_0x673063=_[_0x356e('0x3c')]({},_0x673063,_0x2d2613['options']);var _0x5e497f={'where':_0x673063[_0x356e('0x39')]};return db[_0x356e('0x2c')][_0x356e('0x1c')](_0x5e497f)[_0x356e('0x25')](function(_0x3871e2){_0x3feb9a[_0x356e('0x1c')]=_0x3871e2;if(_0x2d2613[_0x356e('0x32')][_0x356e('0x3e')]){_0x673063[_0x356e('0x3f')]=[{'all':!![]}];}return db[_0x356e('0x2c')]['findAll'](_0x673063);})[_0x356e('0x25')](function(_0x27e2ac){_0x3feb9a[_0x356e('0x40')]=_0x27e2ac;return _0x3feb9a;})['then'](respondWithFilteredResult(_0x5733ca,_0x673063))[_0x356e('0x41')](handleError(_0x5733ca,null));};exports[_0x356e('0x42')]=function(_0x539d6d,_0x343ecc){var _0x1f689d={'raw':!![],'where':{'id':_0x539d6d[_0x356e('0x43')]['id']}},_0x3663b9={};_0x3663b9[_0x356e('0x2f')]=_[_0x356e('0x31')](db[_0x356e('0x2c')][_0x356e('0x2d')]);_0x3663b9[_0x356e('0x32')]=_[_0x356e('0x31')](_0x539d6d[_0x356e('0x32')]);_0x3663b9['filters']=_[_0x356e('0x34')](_0x3663b9['model'],_0x3663b9[_0x356e('0x32')]);_0x1f689d[_0x356e('0x35')]=_[_0x356e('0x34')](_0x3663b9[_0x356e('0x2f')],qs['fields'](_0x539d6d['query'][_0x356e('0x36')]));_0x1f689d[_0x356e('0x35')]=_0x1f689d['attributes'][_0x356e('0x44')]?_0x1f689d['attributes']:_0x3663b9[_0x356e('0x2f')];if(_0x539d6d['query'][_0x356e('0x3e')]){_0x1f689d['include']=[{'all':!![]}];}_0x1f689d=_[_0x356e('0x3c')]({},_0x1f689d,_0x539d6d[_0x356e('0x45')]);return db['SquareOdbc'][_0x356e('0x46')](_0x1f689d)[_0x356e('0x25')](handleEntityNotFound(_0x343ecc,null))[_0x356e('0x25')](respondWithResult(_0x343ecc,null))['catch'](handleError(_0x343ecc,null));};exports[_0x356e('0x47')]=function(_0x423af4,_0x1ad312){return db[_0x356e('0x2c')][_0x356e('0x47')](_0x423af4[_0x356e('0x48')],{})[_0x356e('0x25')](function(_0x4f428c){var _0x559a2d=_0x423af4[_0x356e('0x49')][_0x356e('0x4a')]({'plain':!![]});if(!_0x559a2d)throw new Error(_0x356e('0x4b'));if(_0x559a2d[_0x356e('0x4c')]===_0x356e('0x49')){var _0x4055fd=_0x4f428c['get']({'plain':!![]});var _0x366c0=_0x356e('0x4d');return db[_0x356e('0x4e')][_0x356e('0x46')]({'where':{'name':_0x366c0,'userProfileId':_0x559a2d['userProfileId']},'raw':!![]})[_0x356e('0x25')](function(_0x2328ed){if(_0x2328ed&&_0x2328ed[_0x356e('0x4f')]===0x0){return db[_0x356e('0x26')][_0x356e('0x47')]({'name':_0x4055fd[_0x356e('0x29')],'resourceId':_0x4055fd['id'],'type':_0x2328ed['name'],'sectionId':_0x2328ed['id']},{})[_0x356e('0x25')](function(){return _0x4f428c;});}else{return _0x4f428c;}})[_0x356e('0x41')](function(_0x2f0fbe){logger[_0x356e('0x27')](_0x356e('0x50'),_0x2f0fbe);throw _0x2f0fbe;});}return _0x4f428c;})[_0x356e('0x25')](respondWithResult(_0x1ad312,0xc9))['catch'](handleError(_0x1ad312,null));};exports[_0x356e('0x23')]=function(_0x29151d,_0x1c0e88){if(_0x29151d[_0x356e('0x48')]['id']){delete _0x29151d[_0x356e('0x48')]['id'];}return db[_0x356e('0x2c')][_0x356e('0x46')]({'where':{'id':_0x29151d[_0x356e('0x43')]['id']}})[_0x356e('0x25')](handleEntityNotFound(_0x1c0e88,null))['then'](saveUpdates(_0x29151d[_0x356e('0x48')],null))[_0x356e('0x25')](respondWithResult(_0x1c0e88,null))[_0x356e('0x41')](handleError(_0x1c0e88,null));};exports['destroy']=function(_0x2b189a,_0x384e08){return db['SquareOdbc']['find']({'where':{'id':_0x2b189a[_0x356e('0x43')]['id']}})[_0x356e('0x25')](handleEntityNotFound(_0x384e08,null))[_0x356e('0x25')](removeEntity(_0x384e08,null))['catch'](handleError(_0x384e08,null));};exports['test']=function(_0x138cfa,_0x444175,_0x5e7325){var _0x581b38;return db['SquareOdbc']['find']({'where':{'id':_0x138cfa['params']['id']},'attributes':['id',_0x356e('0x51')]})[_0x356e('0x25')](handleEntityNotFound(_0x444175,null))['then'](function(_0x31bd3f){if(_0x31bd3f){var _0x20701=require(_0x356e('0x52'))();_0x20701[_0x356e('0x53')](_0x31bd3f[_0x356e('0x51')]);_0x20701[_0x356e('0x54')]();return _0x31bd3f;}})[_0x356e('0x25')](respondWithResult(_0x444175,null))[_0x356e('0x41')](handleError(_0x444175,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 4f3e116..1b97052 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 _0xbccb=['rimraf','../../config/environment','exports','SquareOdbc','square_odbc','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x17e426,_0x5c4c9c){var _0x10b895=function(_0x3b4d84){while(--_0x3b4d84){_0x17e426['push'](_0x17e426['shift']());}};_0x10b895(++_0x5c4c9c);}(_0xbccb,0x1de));var _0xbbcc=function(_0x5491e5,_0x37a869){_0x5491e5=_0x5491e5-0x0;var _0x214eb5=_0xbccb[_0x5491e5];return _0x214eb5;};'use strict';var _=require('lodash');var util=require(_0xbbcc('0x0'));var logger=require(_0xbbcc('0x1'))(_0xbbcc('0x2'));var moment=require(_0xbbcc('0x3'));var BPromise=require(_0xbbcc('0x4'));var rp=require(_0xbbcc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbbcc('0x6'));var config=require(_0xbbcc('0x7'));var attributes=require('./squareOdbc.attributes');module[_0xbbcc('0x8')]=function(_0x2e4ccb,_0x3f25d0){return _0x2e4ccb['define'](_0xbbcc('0x9'),attributes,{'tableName':_0xbbcc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92d8=['api','moment','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','lodash','util','../../config/logger'];(function(_0xf4764b,_0x444e3b){var _0x1d0e76=function(_0x265ca2){while(--_0x265ca2){_0xf4764b['push'](_0xf4764b['shift']());}};_0x1d0e76(++_0x444e3b);}(_0x92d8,0xa5));var _0x892d=function(_0xea4c9d,_0x4a2d07){_0xea4c9d=_0xea4c9d-0x0;var _0x2c84e3=_0x92d8[_0xea4c9d];return _0x2c84e3;};'use strict';var _=require(_0x892d('0x0'));var util=require(_0x892d('0x1'));var logger=require(_0x892d('0x2'))(_0x892d('0x3'));var moment=require(_0x892d('0x4'));var BPromise=require('bluebird');var rp=require(_0x892d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x892d('0x6'));var config=require(_0x892d('0x7'));var attributes=require(_0x892d('0x8'));module[_0x892d('0x9')]=function(_0x4709e2,_0x5844ec){return _0x4709e2[_0x892d('0xa')](_0x892d('0xb'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 95a6df8..f0c20c1 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 _0x9457=['info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSquareOdbc','SquareOdbc','options','raw','where','map','include','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9457,0xd3));var _0x7945=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9457[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7945('0x0'));var util=require(_0x7945('0x1'));var moment=require(_0x7945('0x2'));var BPromise=require(_0x7945('0x3'));var rs=require(_0x7945('0x4'));var fs=require('fs');var Redis=require(_0x7945('0x5'));var db=require(_0x7945('0x6'))['db'];var utils=require(_0x7945('0x7'));var logger=require(_0x7945('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7945('0x9')][_0x7945('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31befc,_0x2ed689,_0x27d7b8){return new BPromise(function(_0x26a57d,_0x328895){return client[_0x7945('0xb')](_0x31befc,_0x27d7b8)[_0x7945('0xc')](function(_0x58af67){logger[_0x7945('0xd')](_0x7945('0xe'),_0x2ed689,_0x7945('0xf'));logger[_0x7945('0x10')](_0x7945('0x11'),_0x2ed689,'request\x20sent',JSON[_0x7945('0x12')](_0x58af67));if(_0x58af67[_0x7945('0x13')]){if(_0x58af67[_0x7945('0x13')]['code']===0x1f4){logger[_0x7945('0x13')](_0x7945('0xe'),_0x2ed689,_0x58af67[_0x7945('0x13')][_0x7945('0x14')]);return _0x328895(_0x58af67['error'][_0x7945('0x14')]);}logger[_0x7945('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x2ed689,_0x58af67[_0x7945('0x13')][_0x7945('0x14')]);return _0x26a57d(_0x58af67[_0x7945('0x13')][_0x7945('0x14')]);}else{logger['info'](_0x7945('0xe'),_0x2ed689,_0x7945('0xf'));_0x26a57d(_0x58af67[_0x7945('0x15')][_0x7945('0x14')]);}})[_0x7945('0x16')](function(_0x3e52c3){logger[_0x7945('0x13')](_0x7945('0xe'),_0x2ed689,_0x3e52c3);_0x328895(_0x3e52c3);});});}exports[_0x7945('0x17')]=function(_0x10f168){var _0x5a007f=this;return new Promise(function(_0x3d1638,_0x4dac39){return db[_0x7945('0x18')]['find']({'raw':_0x10f168[_0x7945('0x19')]?_0x10f168[_0x7945('0x19')][_0x7945('0x1a')]===undefined?!![]:![]:!![],'where':_0x10f168['options']?_0x10f168[_0x7945('0x19')][_0x7945('0x1b')]||null:null,'attributes':_0x10f168[_0x7945('0x19')]?_0x10f168[_0x7945('0x19')]['attributes']||null:null,'include':_0x10f168[_0x7945('0x19')]?_0x10f168['options']['include']?_[_0x7945('0x1c')](_0x10f168[_0x7945('0x19')][_0x7945('0x1d')],function(_0x2e638e){return{'model':db[_0x2e638e[_0x7945('0x1e')]],'as':_0x2e638e['as'],'attributes':_0x2e638e[_0x7945('0x1f')],'include':_0x2e638e[_0x7945('0x1d')]?_[_0x7945('0x1c')](_0x2e638e[_0x7945('0x1d')],function(_0x40ad0d){return{'model':db[_0x40ad0d[_0x7945('0x1e')]],'as':_0x40ad0d['as'],'attributes':_0x40ad0d[_0x7945('0x1f')],'include':_0x40ad0d[_0x7945('0x1d')]?_[_0x7945('0x1c')](_0x40ad0d[_0x7945('0x1d')],function(_0x25c873){return{'model':db[_0x25c873['model']],'as':_0x25c873['as'],'attributes':_0x25c873[_0x7945('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7945('0xc')](function(_0x11fed7){logger[_0x7945('0xd')](_0x7945('0x17'),_0x10f168);logger[_0x7945('0x10')](_0x7945('0x17'),_0x10f168,JSON[_0x7945('0x12')](_0x11fed7));_0x3d1638(_0x11fed7);})['catch'](function(_0x160b20){logger['error'](_0x7945('0x17'),_0x160b20['message'],_0x10f168);_0x4dac39(_0x5a007f[_0x7945('0x13')](0x1f4,_0x160b20[_0x7945('0x14')]));});});}; \ No newline at end of file +var _0xac17=['request\x20sent','stringify','error','message','result','catch','ShowSquareOdbc','options','raw','attributes','include','map','model','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x2e78e9,_0x42957c){var _0x35aad4=function(_0x360fa1){while(--_0x360fa1){_0x2e78e9['push'](_0x2e78e9['shift']());}};_0x35aad4(++_0x42957c);}(_0xac17,0x162));var _0x7ac1=function(_0x1b3a09,_0x20c774){_0x1b3a09=_0x1b3a09-0x0;var _0x357bb8=_0xac17[_0x1b3a09];return _0x357bb8;};'use strict';var _=require(_0x7ac1('0x0'));var util=require(_0x7ac1('0x1'));var moment=require(_0x7ac1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ac1('0x3'));var db=require(_0x7ac1('0x4'))['db'];var utils=require(_0x7ac1('0x5'));var logger=require(_0x7ac1('0x6'))(_0x7ac1('0x7'));var config=require(_0x7ac1('0x8'));var jayson=require(_0x7ac1('0x9'));var client=jayson[_0x7ac1('0xa')][_0x7ac1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b4b90,_0x9118d8,_0x422119){return new BPromise(function(_0x511ff6,_0x24daf1){return client[_0x7ac1('0xc')](_0x5b4b90,_0x422119)[_0x7ac1('0xd')](function(_0x25caaf){logger[_0x7ac1('0xe')](_0x7ac1('0xf'),_0x9118d8,'request\x20sent');logger[_0x7ac1('0x10')](_0x7ac1('0x11'),_0x9118d8,_0x7ac1('0x12'),JSON[_0x7ac1('0x13')](_0x25caaf));if(_0x25caaf[_0x7ac1('0x14')]){if(_0x25caaf[_0x7ac1('0x14')]['code']===0x1f4){logger[_0x7ac1('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x9118d8,_0x25caaf['error']['message']);return _0x24daf1(_0x25caaf['error'][_0x7ac1('0x15')]);}logger[_0x7ac1('0x14')](_0x7ac1('0xf'),_0x9118d8,_0x25caaf['error'][_0x7ac1('0x15')]);return _0x511ff6(_0x25caaf[_0x7ac1('0x14')][_0x7ac1('0x15')]);}else{logger[_0x7ac1('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x9118d8,'request\x20sent');_0x511ff6(_0x25caaf[_0x7ac1('0x16')][_0x7ac1('0x15')]);}})[_0x7ac1('0x17')](function(_0x22bd01){logger[_0x7ac1('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x9118d8,_0x22bd01);_0x24daf1(_0x22bd01);});});}exports[_0x7ac1('0x18')]=function(_0x1bfcc0){var _0xed67ab=this;return new Promise(function(_0x35641e,_0x2087bf){return db['SquareOdbc']['find']({'raw':_0x1bfcc0[_0x7ac1('0x19')]?_0x1bfcc0[_0x7ac1('0x19')][_0x7ac1('0x1a')]===undefined?!![]:![]:!![],'where':_0x1bfcc0[_0x7ac1('0x19')]?_0x1bfcc0[_0x7ac1('0x19')]['where']||null:null,'attributes':_0x1bfcc0[_0x7ac1('0x19')]?_0x1bfcc0['options'][_0x7ac1('0x1b')]||null:null,'include':_0x1bfcc0[_0x7ac1('0x19')]?_0x1bfcc0[_0x7ac1('0x19')][_0x7ac1('0x1c')]?_[_0x7ac1('0x1d')](_0x1bfcc0[_0x7ac1('0x19')][_0x7ac1('0x1c')],function(_0x4eafba){return{'model':db[_0x4eafba[_0x7ac1('0x1e')]],'as':_0x4eafba['as'],'attributes':_0x4eafba[_0x7ac1('0x1b')],'include':_0x4eafba[_0x7ac1('0x1c')]?_[_0x7ac1('0x1d')](_0x4eafba[_0x7ac1('0x1c')],function(_0x2f6498){return{'model':db[_0x2f6498[_0x7ac1('0x1e')]],'as':_0x2f6498['as'],'attributes':_0x2f6498['attributes'],'include':_0x2f6498['include']?_['map'](_0x2f6498[_0x7ac1('0x1c')],function(_0x4a518a){return{'model':db[_0x4a518a['model']],'as':_0x4a518a['as'],'attributes':_0x4a518a[_0x7ac1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7ac1('0xd')](function(_0x3727db){logger[_0x7ac1('0xe')](_0x7ac1('0x18'),_0x1bfcc0);logger['debug']('ShowSquareOdbc',_0x1bfcc0,JSON[_0x7ac1('0x13')](_0x3727db));_0x35641e(_0x3727db);})[_0x7ac1('0x17')](function(_0x33dc7c){logger[_0x7ac1('0x14')](_0x7ac1('0x18'),_0x33dc7c[_0x7ac1('0x15')],_0x1bfcc0);_0x2087bf(_0xed67ab['error'](0x1f4,_0x33dc7c[_0x7ac1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 3cc8696..c88dcaf 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 _0x2250=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','getUsers','post','create','/:id/users','addUsers','put','delete','destroy','removeUsers'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2250,0x178));var _0x0225=function(_0x13062b,_0x285d7d){_0x13062b=_0x13062b-0x0;var _0x564586=_0x2250[_0x13062b];return _0x564586;};'use strict';var multer=require(_0x0225('0x0'));var util=require(_0x0225('0x1'));var path=require(_0x0225('0x2'));var timeout=require(_0x0225('0x3'));var express=require(_0x0225('0x4'));var router=express[_0x0225('0x5')]();var fs_extra=require(_0x0225('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0225('0x7'));var config=require(_0x0225('0x8'));var controller=require(_0x0225('0x9'));router[_0x0225('0xa')]('/',auth[_0x0225('0xb')](),controller[_0x0225('0xc')]);router[_0x0225('0xa')](_0x0225('0xd'),auth['isAuthenticated'](),controller[_0x0225('0xe')]);router['get']('/:id/users',auth[_0x0225('0xb')](),controller[_0x0225('0xf')]);router[_0x0225('0x10')]('/',auth[_0x0225('0xb')](),controller[_0x0225('0x11')]);router['post'](_0x0225('0x12'),auth[_0x0225('0xb')](),controller[_0x0225('0x13')]);router[_0x0225('0x14')]('/:id',auth[_0x0225('0xb')](),controller['update']);router[_0x0225('0x15')](_0x0225('0xd'),auth['isAuthenticated'](),controller[_0x0225('0x16')]);router[_0x0225('0x15')](_0x0225('0x12'),auth[_0x0225('0xb')](),controller[_0x0225('0x17')]);module[_0x0225('0x18')]=router; \ No newline at end of file +var _0x1dcd=['destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','get','getUsers','post','create','/:id/users','update','delete'];(function(_0x640ff7,_0x3c1201){var _0x43e4f2=function(_0x55306a){while(--_0x55306a){_0x640ff7['push'](_0x640ff7['shift']());}};_0x43e4f2(++_0x3c1201);}(_0x1dcd,0x100));var _0xd1dc=function(_0x82be4,_0x1b074b){_0x82be4=_0x82be4-0x0;var _0xe2637=_0x1dcd[_0x82be4];return _0xe2637;};'use strict';var multer=require(_0xd1dc('0x0'));var util=require(_0xd1dc('0x1'));var path=require(_0xd1dc('0x2'));var timeout=require(_0xd1dc('0x3'));var express=require(_0xd1dc('0x4'));var router=express[_0xd1dc('0x5')]();var fs_extra=require(_0xd1dc('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd1dc('0x7'));var config=require(_0xd1dc('0x8'));var controller=require('./squareProject.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd1dc('0x9')]);router['get'](_0xd1dc('0xa'),auth[_0xd1dc('0xb')](),controller[_0xd1dc('0xc')]);router[_0xd1dc('0xd')]('/:id/users',auth[_0xd1dc('0xb')](),controller[_0xd1dc('0xe')]);router[_0xd1dc('0xf')]('/',auth[_0xd1dc('0xb')](),controller[_0xd1dc('0x10')]);router[_0xd1dc('0xf')](_0xd1dc('0x11'),auth[_0xd1dc('0xb')](),controller['addUsers']);router['put'](_0xd1dc('0xa'),auth['isAuthenticated'](),controller[_0xd1dc('0x12')]);router[_0xd1dc('0x13')](_0xd1dc('0xa'),auth[_0xd1dc('0xb')](),controller[_0xd1dc('0x14')]);router[_0xd1dc('0x13')](_0xd1dc('0x11'),auth['isAuthenticated'](),controller[_0xd1dc('0x15')]);module[_0xd1dc('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index f15bce8..c660472 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 _0x2ebe=['long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','TEXT'];(function(_0x40f7b8,_0x15ea21){var _0x1fe337=function(_0x4a81ea){while(--_0x4a81ea){_0x40f7b8['push'](_0x40f7b8['shift']());}};_0x1fe337(++_0x15ea21);}(_0x2ebe,0x125));var _0xe2eb=function(_0x2afe05,_0xd10763){_0x2afe05=_0x2afe05-0x0;var _0x593048=_0x2ebe[_0x2afe05];return _0x593048;};'use strict';var Sequelize=require(_0xe2eb('0x0'));module[_0xe2eb('0x1')]={'name':{'type':Sequelize[_0xe2eb('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xe2eb('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0xe2eb('0x4')),'get':function(){if(this[_0xe2eb('0x5')](_0xe2eb('0x6'))){return this[_0xe2eb('0x5')](_0xe2eb('0x6'))[_0xe2eb('0x7')](_0xe2eb('0x8'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this['getDataValue'](_0xe2eb('0x9'))){return this[_0xe2eb('0x5')](_0xe2eb('0x9'))[_0xe2eb('0x7')](_0xe2eb('0x8'));}}},'savedAt':{'type':Sequelize[_0xe2eb('0xa')]},'publishedAt':{'type':Sequelize[_0xe2eb('0xa')]}}; \ No newline at end of file +var _0x8e79=['sequelize','STRING','name','TEXT','long','getDataValue','preproduction','toString','utf8','BLOB','production','DATE'];(function(_0x5e0c86,_0xe6fbf7){var _0x53c99e=function(_0x42bcc4){while(--_0x42bcc4){_0x5e0c86['push'](_0x5e0c86['shift']());}};_0x53c99e(++_0xe6fbf7);}(_0x8e79,0x150));var _0x98e7=function(_0x4df85a,_0x3d4e43){_0x4df85a=_0x4df85a-0x0;var _0x4f2a7a=_0x8e79[_0x4df85a];return _0x4f2a7a;};'use strict';var Sequelize=require(_0x98e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x98e7('0x1')],'unique':_0x98e7('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x98e7('0x1')]},'notes':{'type':Sequelize[_0x98e7('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0x98e7('0x4')),'get':function(){if(this[_0x98e7('0x5')](_0x98e7('0x6'))){return this['getDataValue'](_0x98e7('0x6'))[_0x98e7('0x7')](_0x98e7('0x8'));}}},'production':{'type':Sequelize[_0x98e7('0x9')](_0x98e7('0x4')),'get':function(){if(this[_0x98e7('0x5')](_0x98e7('0xa'))){return this[_0x98e7('0x5')](_0x98e7('0xa'))[_0x98e7('0x7')](_0x98e7('0x8'));}}},'savedAt':{'type':Sequelize[_0x98e7('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index dd9b9eb..fd31154 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 _0x9497=['attributes','fields','nolimit','sort','pick','filters','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SquareProjects','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','omit','removeUsers','ids','isArray','emit','userSquareProject:remove','getUsers','User','order','hasOwnProperty','eml-format','rimraf','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','map','SquareProject','rawAttributes','key','model','query','keys','intersection'];(function(_0x58836f,_0x5351e2){var _0x28f9b1=function(_0x30a6cc){while(--_0x30a6cc){_0x58836f['push'](_0x58836f['shift']());}};_0x28f9b1(++_0x5351e2);}(_0x9497,0x1a8));var _0x7949=function(_0x933c43,_0xe484db){_0x933c43=_0x933c43-0x0;var _0x1f251e=_0x9497[_0x933c43];return _0x1f251e;};'use strict';var emlformat=require(_0x7949('0x0'));var rimraf=require(_0x7949('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7949('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7949('0x3'));var util=require(_0x7949('0x4'));var path=require(_0x7949('0x5'));var sox=require(_0x7949('0x6'));var csv=require('to-csv');var ejs=require(_0x7949('0x7'));var fs=require('fs');var fs_extra=require(_0x7949('0x8'));var _=require(_0x7949('0x9'));var squel=require('squel');var crypto=require(_0x7949('0xa'));var jsforce=require(_0x7949('0xb'));var deskjs=require(_0x7949('0xc'));var toCsv=require(_0x7949('0xd'));var querystring=require(_0x7949('0xe'));var Papa=require('papaparse');var Redis=require(_0x7949('0xf'));var authService=require(_0x7949('0x10'));var qs=require(_0x7949('0x11'));var as=require(_0x7949('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7949('0x13'));var utils=require('../../config/utils');var config=require(_0x7949('0x14'));var licenseUtil=require(_0x7949('0x15'));var db=require(_0x7949('0x16'))['db'];config[_0x7949('0x17')]=_['defaults'](config[_0x7949('0x17')],{'host':_0x7949('0x18'),'port':0x18eb});var socket=require(_0x7949('0x19'))(new Redis(config[_0x7949('0x17')]));require(_0x7949('0x1a'))['register'](socket);function respondWithStatusCode(_0x89387f,_0x427a52){_0x427a52=_0x427a52||0xcc;return function(_0x28f41a){if(_0x28f41a){return _0x89387f[_0x7949('0x1b')](_0x427a52);}return _0x89387f[_0x7949('0x1c')](_0x427a52)[_0x7949('0x1d')]();};}function respondWithResult(_0x36a3cf,_0x283bc7){_0x283bc7=_0x283bc7||0xc8;return function(_0xdca612){if(_0xdca612){return _0x36a3cf[_0x7949('0x1c')](_0x283bc7)[_0x7949('0x1e')](_0xdca612);}};}function respondWithFilteredResult(_0x5dc1b9,_0xaaee61){return function(_0x45fefb){if(_0x45fefb){var _0x802331=typeof _0xaaee61['offset']===_0x7949('0x1f')&&typeof _0xaaee61['limit']===_0x7949('0x1f');var _0x4c46c1=_0x45fefb[_0x7949('0x20')];var _0xe2f6f7=_0x802331?0x0:_0xaaee61[_0x7949('0x21')];var _0x387ce3=_0x802331?_0x45fefb[_0x7949('0x20')]:_0xaaee61[_0x7949('0x21')]+_0xaaee61[_0x7949('0x22')];var _0x17583d;if(_0x387ce3>=_0x4c46c1){_0x387ce3=_0x4c46c1;_0x17583d=0xc8;}else{_0x17583d=0xce;}_0x5dc1b9[_0x7949('0x1c')](_0x17583d);return _0x5dc1b9[_0x7949('0x23')](_0x7949('0x24'),_0xe2f6f7+'-'+_0x387ce3+'/'+_0x4c46c1)[_0x7949('0x1e')](_0x45fefb);}return null;};}function patchUpdates(_0x2b4634){return function(_0x33e119){try{jsonpatch[_0x7949('0x25')](_0x33e119,_0x2b4634,!![]);}catch(_0x2f637c){return BPromise[_0x7949('0x26')](_0x2f637c);}return _0x33e119[_0x7949('0x27')]();};}function saveUpdates(_0x148b47,_0x281bc6){return function(_0x4143be){if(_0x4143be){return _0x4143be['update'](_0x148b47)[_0x7949('0x28')](function(_0xce32cb){return _0xce32cb;});}return null;};}function removeEntity(_0x2db9b9,_0x3a2711){return function(_0x4cec49){if(_0x4cec49){return _0x4cec49[_0x7949('0x29')]()['then'](function(){var _0x9acd68=_0x4cec49[_0x7949('0x2a')]({'plain':!![]});var _0x4cdfe9='SquareProjects';return db[_0x7949('0x2b')][_0x7949('0x29')]({'where':{'type':_0x4cdfe9,'resourceId':_0x9acd68['id']}})[_0x7949('0x28')](function(){return _0x4cec49;});})['then'](function(){_0x2db9b9[_0x7949('0x1c')](0xcc)[_0x7949('0x1d')]();});}};}function handleEntityNotFound(_0x2d3c5a,_0xba2dc7){return function(_0x5ee984){if(!_0x5ee984){_0x2d3c5a[_0x7949('0x1b')](0x194);}return _0x5ee984;};}function handleError(_0x12fbbc,_0x32a743){_0x32a743=_0x32a743||0x1f4;return function(_0x4a60a6){logger[_0x7949('0x2c')](_0x4a60a6[_0x7949('0x2d')]);if(_0x4a60a6[_0x7949('0x2e')]){delete _0x4a60a6[_0x7949('0x2e')];}_0x12fbbc[_0x7949('0x1c')](_0x32a743)[_0x7949('0x2f')](_0x4a60a6);};}exports['index']=function(_0x4b9bdc,_0x24fa57){var _0x1ce77b={},_0x51d4da={},_0x39bea2={'count':0x0,'rows':[]};var _0x568ef1=_[_0x7949('0x30')](db[_0x7949('0x31')][_0x7949('0x32')],function(_0x2b68a0){return{'name':_0x2b68a0['fieldName'],'type':_0x2b68a0['type'][_0x7949('0x33')]};});_0x51d4da[_0x7949('0x34')]=_[_0x7949('0x30')](_0x568ef1,_0x7949('0x2e'));_0x51d4da[_0x7949('0x35')]=_[_0x7949('0x36')](_0x4b9bdc[_0x7949('0x35')]);_0x51d4da['filters']=_[_0x7949('0x37')](_0x51d4da[_0x7949('0x34')],_0x51d4da[_0x7949('0x35')]);_0x1ce77b[_0x7949('0x38')]=_[_0x7949('0x37')](_0x51d4da[_0x7949('0x34')],qs['fields'](_0x4b9bdc[_0x7949('0x35')][_0x7949('0x39')]));_0x1ce77b[_0x7949('0x38')]=_0x1ce77b['attributes']['length']?_0x1ce77b[_0x7949('0x38')]:_0x51d4da[_0x7949('0x34')];if(!_0x4b9bdc[_0x7949('0x35')]['hasOwnProperty'](_0x7949('0x3a'))){_0x1ce77b[_0x7949('0x22')]=qs[_0x7949('0x22')](_0x4b9bdc[_0x7949('0x35')]['limit']);_0x1ce77b[_0x7949('0x21')]=qs['offset'](_0x4b9bdc[_0x7949('0x35')]['offset']);}_0x1ce77b['order']=qs[_0x7949('0x3b')](_0x4b9bdc[_0x7949('0x35')][_0x7949('0x3b')]);_0x1ce77b['where']=qs['filters'](_[_0x7949('0x3c')](_0x4b9bdc['query'],_0x51d4da[_0x7949('0x3d')]),_0x568ef1);if(_0x4b9bdc[_0x7949('0x35')]['filter']){_0x1ce77b[_0x7949('0x3e')]=_['merge'](_0x1ce77b[_0x7949('0x3e')],{'$or':_[_0x7949('0x30')](_0x568ef1,function(_0x1a3a2e){if(_0x1a3a2e['type']!==_0x7949('0x3f')){var _0x593f1f={};_0x593f1f[_0x1a3a2e['name']]={'$like':'%'+_0x4b9bdc[_0x7949('0x35')][_0x7949('0x40')]+'%'};return _0x593f1f;}})});}_0x1ce77b=_[_0x7949('0x41')]({},_0x1ce77b,_0x4b9bdc[_0x7949('0x42')]);var _0x270997={'where':_0x1ce77b[_0x7949('0x3e')]};return db['SquareProject'][_0x7949('0x20')](_0x270997)['then'](function(_0xccd0f8){_0x39bea2[_0x7949('0x20')]=_0xccd0f8;if(_0x4b9bdc[_0x7949('0x35')][_0x7949('0x43')]){_0x1ce77b['include']=[{'all':!![]}];}return db[_0x7949('0x31')][_0x7949('0x44')](_0x1ce77b);})['then'](function(_0x2564f6){_0x39bea2[_0x7949('0x45')]=_0x2564f6;return _0x39bea2;})[_0x7949('0x28')](respondWithFilteredResult(_0x24fa57,_0x1ce77b))[_0x7949('0x46')](handleError(_0x24fa57,null));};exports[_0x7949('0x47')]=function(_0x496076,_0x1e31fb){var _0x229e93={'raw':![],'where':{'id':_0x496076[_0x7949('0x48')]['id']}},_0x6da2ec={};_0x6da2ec[_0x7949('0x34')]=_[_0x7949('0x36')](db[_0x7949('0x31')][_0x7949('0x32')]);_0x6da2ec['query']=_[_0x7949('0x36')](_0x496076[_0x7949('0x35')]);_0x6da2ec['filters']=_[_0x7949('0x37')](_0x6da2ec['model'],_0x6da2ec[_0x7949('0x35')]);_0x229e93['attributes']=_[_0x7949('0x37')](_0x6da2ec[_0x7949('0x34')],qs[_0x7949('0x39')](_0x496076[_0x7949('0x35')]['fields']));_0x229e93[_0x7949('0x38')]=_0x229e93[_0x7949('0x38')][_0x7949('0x49')]?_0x229e93[_0x7949('0x38')]:_0x6da2ec[_0x7949('0x34')];if(_0x496076[_0x7949('0x35')][_0x7949('0x43')]){_0x229e93[_0x7949('0x4a')]=[{'all':!![]}];}_0x229e93=_['merge']({},_0x229e93,_0x496076[_0x7949('0x42')]);return db[_0x7949('0x31')][_0x7949('0x4b')](_0x229e93)[_0x7949('0x28')](handleEntityNotFound(_0x1e31fb,null))[_0x7949('0x28')](respondWithResult(_0x1e31fb,null))[_0x7949('0x46')](handleError(_0x1e31fb,null));};exports[_0x7949('0x4c')]=function(_0x5f42be,_0x18ce3a){return db[_0x7949('0x31')][_0x7949('0x4c')](_0x5f42be[_0x7949('0x4d')],{})[_0x7949('0x28')](function(_0x644538){var _0x17a62e=_0x5f42be[_0x7949('0x4e')]['get']({'plain':!![]});if(!_0x17a62e)throw new Error(_0x7949('0x4f'));if(_0x17a62e['role']===_0x7949('0x4e')){var _0x5ac787=_0x644538['get']({'plain':!![]});var _0x2c642c=_0x7949('0x50');return db[_0x7949('0x51')][_0x7949('0x4b')]({'where':{'name':_0x2c642c,'userProfileId':_0x17a62e['userProfileId']},'raw':!![]})['then'](function(_0x11af27){if(_0x11af27&&_0x11af27[_0x7949('0x52')]===0x0){return db['UserProfileResource'][_0x7949('0x4c')]({'name':_0x5ac787[_0x7949('0x2e')],'resourceId':_0x5ac787['id'],'type':_0x11af27[_0x7949('0x2e')],'sectionId':_0x11af27['id']},{})[_0x7949('0x28')](function(){return _0x644538;});}else{return _0x644538;}})[_0x7949('0x46')](function(_0x509623){logger['error'](_0x7949('0x53'),_0x509623);throw _0x509623;});}return _0x644538;})[_0x7949('0x28')](respondWithResult(_0x18ce3a,0xc9))[_0x7949('0x46')](handleError(_0x18ce3a,null));};exports[_0x7949('0x54')]=function(_0x2dbb4e,_0x44b8f2){if(_0x2dbb4e['body']['id']){delete _0x2dbb4e[_0x7949('0x4d')]['id'];}return db['SquareProject'][_0x7949('0x4b')]({'where':{'id':_0x2dbb4e[_0x7949('0x48')]['id']}})[_0x7949('0x28')](handleEntityNotFound(_0x44b8f2,null))[_0x7949('0x28')](saveUpdates(_0x2dbb4e['body'],null))[_0x7949('0x28')](respondWithResult(_0x44b8f2,null))[_0x7949('0x46')](handleError(_0x44b8f2,null));};exports[_0x7949('0x29')]=function(_0x10d0b6,_0x225c8d){return db[_0x7949('0x31')][_0x7949('0x4b')]({'where':{'id':_0x10d0b6[_0x7949('0x48')]['id']}})[_0x7949('0x28')](handleEntityNotFound(_0x225c8d,null))[_0x7949('0x28')](removeEntity(_0x225c8d,null))[_0x7949('0x46')](handleError(_0x225c8d,null));};exports[_0x7949('0x55')]=function(_0x428121,_0x4b8bdc,_0x16d5e4){return db['SquareProject'][_0x7949('0x4b')]({'where':{'id':_0x428121[_0x7949('0x48')]['id']}})[_0x7949('0x28')](handleEntityNotFound(_0x4b8bdc,null))[_0x7949('0x28')](function(_0xad4de3){if(_0xad4de3){return _0xad4de3[_0x7949('0x55')](_0x428121[_0x7949('0x4d')]['ids'],_[_0x7949('0x56')](_0x428121['body'],['ids','id'])||{});}})[_0x7949('0x28')](respondWithResult(_0x4b8bdc,null))[_0x7949('0x46')](handleError(_0x4b8bdc,null));};exports['removeUsers']=function(_0x2cc312,_0x591672,_0x1689b2){return db[_0x7949('0x31')]['find']({'where':{'id':_0x2cc312[_0x7949('0x48')]['id']}})[_0x7949('0x28')](handleEntityNotFound(_0x591672,null))[_0x7949('0x28')](function(_0x5934ee){if(_0x5934ee){return _0x5934ee[_0x7949('0x57')](_0x2cc312[_0x7949('0x35')][_0x7949('0x58')])[_0x7949('0x28')](function(){if(_[_0x7949('0x59')](_0x2cc312[_0x7949('0x35')][_0x7949('0x58')])){for(var _0x589952=0x0;_0x589952<_0x2cc312[_0x7949('0x35')][_0x7949('0x58')][_0x7949('0x49')];_0x589952+=0x1){socket[_0x7949('0x5a')](_0x7949('0x5b'),{'UserId':Number(_0x2cc312['query'][_0x7949('0x58')][_0x589952]),'SquareProjectId':Number(_0x2cc312[_0x7949('0x48')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x2cc312[_0x7949('0x35')][_0x7949('0x58')]),'SquareProjectId':Number(_0x2cc312['params']['id'])});}});}})[_0x7949('0x28')](respondWithStatusCode(_0x591672,null))['catch'](handleError(_0x591672,null));};exports[_0x7949('0x5c')]=function(_0x35e63d,_0x33105,_0x453388){var _0x18eedd={};var _0x33a24b={};var _0x255dac;var _0x3ad93b;return db[_0x7949('0x31')]['findOne']({'where':{'id':_0x35e63d[_0x7949('0x48')]['id']}})[_0x7949('0x28')](handleEntityNotFound(_0x33105,null))[_0x7949('0x28')](function(_0x4561cb){if(_0x4561cb){_0x255dac=_0x4561cb;_0x33a24b[_0x7949('0x34')]=_[_0x7949('0x36')](db[_0x7949('0x5d')][_0x7949('0x32')]);_0x33a24b['query']=_[_0x7949('0x36')](_0x35e63d[_0x7949('0x35')]);_0x33a24b[_0x7949('0x3d')]=_[_0x7949('0x37')](_0x33a24b['model'],_0x33a24b[_0x7949('0x35')]);_0x18eedd[_0x7949('0x38')]=_[_0x7949('0x37')](_0x33a24b['model'],qs['fields'](_0x35e63d[_0x7949('0x35')][_0x7949('0x39')]));_0x18eedd[_0x7949('0x38')]=_0x18eedd[_0x7949('0x38')][_0x7949('0x49')]?_0x18eedd[_0x7949('0x38')]:_0x33a24b[_0x7949('0x34')];_0x18eedd[_0x7949('0x5e')]=qs[_0x7949('0x3b')](_0x35e63d[_0x7949('0x35')][_0x7949('0x3b')]);_0x18eedd[_0x7949('0x3e')]=qs[_0x7949('0x3d')](_['pick'](_0x35e63d[_0x7949('0x35')],_0x33a24b[_0x7949('0x3d')]));if(_0x35e63d[_0x7949('0x35')][_0x7949('0x40')]){_0x18eedd[_0x7949('0x3e')]=_[_0x7949('0x41')](_0x18eedd['where'],{'$or':_['map'](_0x18eedd[_0x7949('0x38')],function(_0xe5b90f){var _0x3a52d7={};_0x3a52d7[_0xe5b90f]={'$like':'%'+_0x35e63d[_0x7949('0x35')][_0x7949('0x40')]+'%'};return _0x3a52d7;})});}_0x18eedd=_[_0x7949('0x41')]({},_0x18eedd,_0x35e63d['options']);return _0x255dac[_0x7949('0x5c')](_0x18eedd);}})[_0x7949('0x28')](function(_0x5cda6c){if(_0x5cda6c){_0x3ad93b=_0x5cda6c[_0x7949('0x49')];if(!_0x35e63d[_0x7949('0x35')][_0x7949('0x5f')](_0x7949('0x3a'))){_0x18eedd[_0x7949('0x22')]=qs[_0x7949('0x22')](_0x35e63d[_0x7949('0x35')][_0x7949('0x22')]);_0x18eedd[_0x7949('0x21')]=qs['offset'](_0x35e63d['query'][_0x7949('0x21')]);}return _0x255dac[_0x7949('0x5c')](_0x18eedd);}})[_0x7949('0x28')](function(_0x4e33c8){if(_0x4e33c8){return _0x4e33c8?{'count':_0x3ad93b,'rows':_0x4e33c8}:null;}})[_0x7949('0x28')](respondWithResult(_0x33105,null))[_0x7949('0x46')](handleError(_0x33105,null));}; \ No newline at end of file +var _0xc940=['intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','rows','catch','show','params','keys','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','emit','userSquareProject:remove','getUsers','User','hasOwnProperty','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','SquareProject','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x4b2366,_0x341406){var _0x4c30dd=function(_0x4634ec){while(--_0x4634ec){_0x4b2366['push'](_0x4b2366['shift']());}};_0x4c30dd(++_0x341406);}(_0xc940,0x1af));var _0x0c94=function(_0x28e6cb,_0x4aa007){_0x28e6cb=_0x28e6cb-0x0;var _0x3fe72a=_0xc940[_0x28e6cb];return _0x3fe72a;};'use strict';var emlformat=require(_0x0c94('0x0'));var rimraf=require(_0x0c94('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c94('0x2'));var rp=require('request-promise');var moment=require(_0x0c94('0x3'));var BPromise=require(_0x0c94('0x4'));var Mustache=require(_0x0c94('0x5'));var util=require(_0x0c94('0x6'));var path=require('path');var sox=require(_0x0c94('0x7'));var csv=require(_0x0c94('0x8'));var ejs=require(_0x0c94('0x9'));var fs=require('fs');var fs_extra=require(_0x0c94('0xa'));var _=require(_0x0c94('0xb'));var squel=require(_0x0c94('0xc'));var crypto=require(_0x0c94('0xd'));var jsforce=require(_0x0c94('0xe'));var deskjs=require(_0x0c94('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0c94('0x10'));var Redis=require(_0x0c94('0x11'));var authService=require(_0x0c94('0x12'));var qs=require(_0x0c94('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c94('0x14'))(_0x0c94('0x15'));var utils=require(_0x0c94('0x16'));var config=require(_0x0c94('0x17'));var licenseUtil=require(_0x0c94('0x18'));var db=require(_0x0c94('0x19'))['db'];config[_0x0c94('0x1a')]=_[_0x0c94('0x1b')](config['redis'],{'host':_0x0c94('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0c94('0x1a')]));require(_0x0c94('0x1d'))[_0x0c94('0x1e')](socket);function respondWithStatusCode(_0x10d6d0,_0x38f905){_0x38f905=_0x38f905||0xcc;return function(_0x568812){if(_0x568812){return _0x10d6d0[_0x0c94('0x1f')](_0x38f905);}return _0x10d6d0[_0x0c94('0x20')](_0x38f905)['end']();};}function respondWithResult(_0x501020,_0x217616){_0x217616=_0x217616||0xc8;return function(_0x154b08){if(_0x154b08){return _0x501020[_0x0c94('0x20')](_0x217616)[_0x0c94('0x21')](_0x154b08);}};}function respondWithFilteredResult(_0x250684,_0xfcb453){return function(_0x330300){if(_0x330300){var _0x52e73e=typeof _0xfcb453[_0x0c94('0x22')]===_0x0c94('0x23')&&typeof _0xfcb453[_0x0c94('0x24')]===_0x0c94('0x23');var _0x2f5a8d=_0x330300[_0x0c94('0x25')];var _0x2f1a07=_0x52e73e?0x0:_0xfcb453[_0x0c94('0x22')];var _0x554c1e=_0x52e73e?_0x330300[_0x0c94('0x25')]:_0xfcb453[_0x0c94('0x22')]+_0xfcb453['limit'];var _0x1648be;if(_0x554c1e>=_0x2f5a8d){_0x554c1e=_0x2f5a8d;_0x1648be=0xc8;}else{_0x1648be=0xce;}_0x250684[_0x0c94('0x20')](_0x1648be);return _0x250684[_0x0c94('0x26')](_0x0c94('0x27'),_0x2f1a07+'-'+_0x554c1e+'/'+_0x2f5a8d)[_0x0c94('0x21')](_0x330300);}return null;};}function patchUpdates(_0x40697d){return function(_0x12898f){try{jsonpatch[_0x0c94('0x28')](_0x12898f,_0x40697d,!![]);}catch(_0x55f3c6){return BPromise[_0x0c94('0x29')](_0x55f3c6);}return _0x12898f[_0x0c94('0x2a')]();};}function saveUpdates(_0x56f2ce,_0x539c86){return function(_0xf52fd4){if(_0xf52fd4){return _0xf52fd4[_0x0c94('0x2b')](_0x56f2ce)[_0x0c94('0x2c')](function(_0x35e384){return _0x35e384;});}return null;};}function removeEntity(_0x98bdf1,_0x25769f){return function(_0x31b6e2){if(_0x31b6e2){return _0x31b6e2[_0x0c94('0x2d')]()[_0x0c94('0x2c')](function(){var _0x418903=_0x31b6e2['get']({'plain':!![]});var _0x37f434='SquareProjects';return db['UserProfileResource'][_0x0c94('0x2d')]({'where':{'type':_0x37f434,'resourceId':_0x418903['id']}})[_0x0c94('0x2c')](function(){return _0x31b6e2;});})[_0x0c94('0x2c')](function(){_0x98bdf1[_0x0c94('0x20')](0xcc)[_0x0c94('0x2e')]();});}};}function handleEntityNotFound(_0x5d6afd,_0x58b051){return function(_0x14c23d){if(!_0x14c23d){_0x5d6afd[_0x0c94('0x1f')](0x194);}return _0x14c23d;};}function handleError(_0x2a9370,_0x5a5927){_0x5a5927=_0x5a5927||0x1f4;return function(_0x170765){logger[_0x0c94('0x2f')](_0x170765[_0x0c94('0x30')]);if(_0x170765[_0x0c94('0x31')]){delete _0x170765[_0x0c94('0x31')];}_0x2a9370[_0x0c94('0x20')](_0x5a5927)[_0x0c94('0x32')](_0x170765);};}exports['index']=function(_0x4fb5ce,_0x50d27a){var _0x35385d={},_0x3bfeb8={},_0x320a72={'count':0x0,'rows':[]};var _0x21ab62=_['map'](db[_0x0c94('0x33')][_0x0c94('0x34')],function(_0x3adb2e){return{'name':_0x3adb2e[_0x0c94('0x35')],'type':_0x3adb2e[_0x0c94('0x36')][_0x0c94('0x37')]};});_0x3bfeb8[_0x0c94('0x38')]=_['map'](_0x21ab62,_0x0c94('0x31'));_0x3bfeb8[_0x0c94('0x39')]=_['keys'](_0x4fb5ce[_0x0c94('0x39')]);_0x3bfeb8[_0x0c94('0x3a')]=_[_0x0c94('0x3b')](_0x3bfeb8[_0x0c94('0x38')],_0x3bfeb8['query']);_0x35385d[_0x0c94('0x3c')]=_['intersection'](_0x3bfeb8['model'],qs[_0x0c94('0x3d')](_0x4fb5ce[_0x0c94('0x39')][_0x0c94('0x3d')]));_0x35385d[_0x0c94('0x3c')]=_0x35385d[_0x0c94('0x3c')][_0x0c94('0x3e')]?_0x35385d[_0x0c94('0x3c')]:_0x3bfeb8[_0x0c94('0x38')];if(!_0x4fb5ce['query']['hasOwnProperty'](_0x0c94('0x3f'))){_0x35385d[_0x0c94('0x24')]=qs['limit'](_0x4fb5ce[_0x0c94('0x39')][_0x0c94('0x24')]);_0x35385d[_0x0c94('0x22')]=qs['offset'](_0x4fb5ce[_0x0c94('0x39')][_0x0c94('0x22')]);}_0x35385d[_0x0c94('0x40')]=qs[_0x0c94('0x41')](_0x4fb5ce[_0x0c94('0x39')][_0x0c94('0x41')]);_0x35385d[_0x0c94('0x42')]=qs[_0x0c94('0x3a')](_[_0x0c94('0x43')](_0x4fb5ce[_0x0c94('0x39')],_0x3bfeb8['filters']),_0x21ab62);if(_0x4fb5ce[_0x0c94('0x39')][_0x0c94('0x44')]){_0x35385d[_0x0c94('0x42')]=_[_0x0c94('0x45')](_0x35385d[_0x0c94('0x42')],{'$or':_[_0x0c94('0x46')](_0x21ab62,function(_0x1f5dea){if(_0x1f5dea['type']!==_0x0c94('0x47')){var _0x10fdb4={};_0x10fdb4[_0x1f5dea[_0x0c94('0x31')]]={'$like':'%'+_0x4fb5ce[_0x0c94('0x39')]['filter']+'%'};return _0x10fdb4;}})});}_0x35385d=_['merge']({},_0x35385d,_0x4fb5ce['options']);var _0x505819={'where':_0x35385d[_0x0c94('0x42')]};return db['SquareProject']['count'](_0x505819)[_0x0c94('0x2c')](function(_0x2e15c9){_0x320a72[_0x0c94('0x25')]=_0x2e15c9;if(_0x4fb5ce[_0x0c94('0x39')][_0x0c94('0x48')]){_0x35385d[_0x0c94('0x49')]=[{'all':!![]}];}return db[_0x0c94('0x33')]['findAll'](_0x35385d);})[_0x0c94('0x2c')](function(_0x4d16ff){_0x320a72[_0x0c94('0x4a')]=_0x4d16ff;return _0x320a72;})[_0x0c94('0x2c')](respondWithFilteredResult(_0x50d27a,_0x35385d))[_0x0c94('0x4b')](handleError(_0x50d27a,null));};exports[_0x0c94('0x4c')]=function(_0x11a9e3,_0x3d7714){var _0xad6167={'raw':![],'where':{'id':_0x11a9e3[_0x0c94('0x4d')]['id']}},_0x2668da={};_0x2668da[_0x0c94('0x38')]=_[_0x0c94('0x4e')](db[_0x0c94('0x33')]['rawAttributes']);_0x2668da[_0x0c94('0x39')]=_[_0x0c94('0x4e')](_0x11a9e3['query']);_0x2668da['filters']=_[_0x0c94('0x3b')](_0x2668da[_0x0c94('0x38')],_0x2668da[_0x0c94('0x39')]);_0xad6167[_0x0c94('0x3c')]=_[_0x0c94('0x3b')](_0x2668da[_0x0c94('0x38')],qs['fields'](_0x11a9e3[_0x0c94('0x39')][_0x0c94('0x3d')]));_0xad6167[_0x0c94('0x3c')]=_0xad6167[_0x0c94('0x3c')][_0x0c94('0x3e')]?_0xad6167[_0x0c94('0x3c')]:_0x2668da['model'];if(_0x11a9e3[_0x0c94('0x39')][_0x0c94('0x48')]){_0xad6167[_0x0c94('0x49')]=[{'all':!![]}];}_0xad6167=_[_0x0c94('0x45')]({},_0xad6167,_0x11a9e3[_0x0c94('0x4f')]);return db['SquareProject'][_0x0c94('0x50')](_0xad6167)['then'](handleEntityNotFound(_0x3d7714,null))[_0x0c94('0x2c')](respondWithResult(_0x3d7714,null))['catch'](handleError(_0x3d7714,null));};exports[_0x0c94('0x51')]=function(_0x3f8a7f,_0x3072a0){return db[_0x0c94('0x33')][_0x0c94('0x51')](_0x3f8a7f[_0x0c94('0x52')],{})[_0x0c94('0x2c')](function(_0x5d46e5){var _0x149df2=_0x3f8a7f['user'][_0x0c94('0x53')]({'plain':!![]});if(!_0x149df2)throw new Error(_0x0c94('0x54'));if(_0x149df2['role']===_0x0c94('0x55')){var _0x287146=_0x5d46e5[_0x0c94('0x53')]({'plain':!![]});var _0x592347='SquareProjects';return db[_0x0c94('0x56')][_0x0c94('0x50')]({'where':{'name':_0x592347,'userProfileId':_0x149df2[_0x0c94('0x57')]},'raw':!![]})[_0x0c94('0x2c')](function(_0x337609){if(_0x337609&&_0x337609['autoAssociation']===0x0){return db['UserProfileResource'][_0x0c94('0x51')]({'name':_0x287146[_0x0c94('0x31')],'resourceId':_0x287146['id'],'type':_0x337609['name'],'sectionId':_0x337609['id']},{})[_0x0c94('0x2c')](function(){return _0x5d46e5;});}else{return _0x5d46e5;}})['catch'](function(_0x4bd8ef){logger[_0x0c94('0x2f')](_0x0c94('0x58'),_0x4bd8ef);throw _0x4bd8ef;});}return _0x5d46e5;})[_0x0c94('0x2c')](respondWithResult(_0x3072a0,0xc9))[_0x0c94('0x4b')](handleError(_0x3072a0,null));};exports['update']=function(_0xede336,_0x1991fb){if(_0xede336[_0x0c94('0x52')]['id']){delete _0xede336['body']['id'];}return db[_0x0c94('0x33')][_0x0c94('0x50')]({'where':{'id':_0xede336[_0x0c94('0x4d')]['id']}})[_0x0c94('0x2c')](handleEntityNotFound(_0x1991fb,null))['then'](saveUpdates(_0xede336['body'],null))['then'](respondWithResult(_0x1991fb,null))['catch'](handleError(_0x1991fb,null));};exports['destroy']=function(_0x52a6d3,_0x50d1a5){return db[_0x0c94('0x33')]['find']({'where':{'id':_0x52a6d3[_0x0c94('0x4d')]['id']}})['then'](handleEntityNotFound(_0x50d1a5,null))[_0x0c94('0x2c')](removeEntity(_0x50d1a5,null))[_0x0c94('0x4b')](handleError(_0x50d1a5,null));};exports[_0x0c94('0x59')]=function(_0x3d7358,_0x3f4399,_0x50e3c8){return db[_0x0c94('0x33')][_0x0c94('0x50')]({'where':{'id':_0x3d7358[_0x0c94('0x4d')]['id']}})[_0x0c94('0x2c')](handleEntityNotFound(_0x3f4399,null))[_0x0c94('0x2c')](function(_0x4f206d){if(_0x4f206d){return _0x4f206d['addUsers'](_0x3d7358[_0x0c94('0x52')][_0x0c94('0x5a')],_[_0x0c94('0x5b')](_0x3d7358[_0x0c94('0x52')],[_0x0c94('0x5a'),'id'])||{});}})['then'](respondWithResult(_0x3f4399,null))['catch'](handleError(_0x3f4399,null));};exports[_0x0c94('0x5c')]=function(_0x408627,_0x3f59b0,_0x99c7c){return db[_0x0c94('0x33')]['find']({'where':{'id':_0x408627[_0x0c94('0x4d')]['id']}})[_0x0c94('0x2c')](handleEntityNotFound(_0x3f59b0,null))[_0x0c94('0x2c')](function(_0x5afc8c){if(_0x5afc8c){return _0x5afc8c[_0x0c94('0x5c')](_0x408627[_0x0c94('0x39')]['ids'])[_0x0c94('0x2c')](function(){if(_['isArray'](_0x408627[_0x0c94('0x39')]['ids'])){for(var _0x2bfb4b=0x0;_0x2bfb4b<_0x408627[_0x0c94('0x39')][_0x0c94('0x5a')][_0x0c94('0x3e')];_0x2bfb4b+=0x1){socket[_0x0c94('0x5d')](_0x0c94('0x5e'),{'UserId':Number(_0x408627[_0x0c94('0x39')][_0x0c94('0x5a')][_0x2bfb4b]),'SquareProjectId':Number(_0x408627[_0x0c94('0x4d')]['id'])});}}else{socket[_0x0c94('0x5d')]('userSquareProject:remove',{'UserId':Number(_0x408627[_0x0c94('0x39')][_0x0c94('0x5a')]),'SquareProjectId':Number(_0x408627[_0x0c94('0x4d')]['id'])});}});}})[_0x0c94('0x2c')](respondWithStatusCode(_0x3f59b0,null))[_0x0c94('0x4b')](handleError(_0x3f59b0,null));};exports[_0x0c94('0x5f')]=function(_0x52029c,_0x4fc565,_0x46e861){var _0x5dec98={};var _0x539cee={};var _0x52c768;var _0x36754a;return db[_0x0c94('0x33')]['findOne']({'where':{'id':_0x52029c[_0x0c94('0x4d')]['id']}})[_0x0c94('0x2c')](handleEntityNotFound(_0x4fc565,null))['then'](function(_0x5dfc14){if(_0x5dfc14){_0x52c768=_0x5dfc14;_0x539cee[_0x0c94('0x38')]=_[_0x0c94('0x4e')](db[_0x0c94('0x60')][_0x0c94('0x34')]);_0x539cee[_0x0c94('0x39')]=_[_0x0c94('0x4e')](_0x52029c[_0x0c94('0x39')]);_0x539cee[_0x0c94('0x3a')]=_[_0x0c94('0x3b')](_0x539cee[_0x0c94('0x38')],_0x539cee[_0x0c94('0x39')]);_0x5dec98[_0x0c94('0x3c')]=_[_0x0c94('0x3b')](_0x539cee['model'],qs['fields'](_0x52029c[_0x0c94('0x39')][_0x0c94('0x3d')]));_0x5dec98[_0x0c94('0x3c')]=_0x5dec98['attributes']['length']?_0x5dec98[_0x0c94('0x3c')]:_0x539cee['model'];_0x5dec98[_0x0c94('0x40')]=qs['sort'](_0x52029c['query'][_0x0c94('0x41')]);_0x5dec98[_0x0c94('0x42')]=qs['filters'](_[_0x0c94('0x43')](_0x52029c[_0x0c94('0x39')],_0x539cee['filters']));if(_0x52029c[_0x0c94('0x39')][_0x0c94('0x44')]){_0x5dec98['where']=_['merge'](_0x5dec98[_0x0c94('0x42')],{'$or':_[_0x0c94('0x46')](_0x5dec98['attributes'],function(_0x58b1a1){var _0x50bc93={};_0x50bc93[_0x58b1a1]={'$like':'%'+_0x52029c[_0x0c94('0x39')][_0x0c94('0x44')]+'%'};return _0x50bc93;})});}_0x5dec98=_[_0x0c94('0x45')]({},_0x5dec98,_0x52029c[_0x0c94('0x4f')]);return _0x52c768[_0x0c94('0x5f')](_0x5dec98);}})[_0x0c94('0x2c')](function(_0x1296ba){if(_0x1296ba){_0x36754a=_0x1296ba[_0x0c94('0x3e')];if(!_0x52029c[_0x0c94('0x39')][_0x0c94('0x61')](_0x0c94('0x3f'))){_0x5dec98[_0x0c94('0x24')]=qs[_0x0c94('0x24')](_0x52029c[_0x0c94('0x39')]['limit']);_0x5dec98[_0x0c94('0x22')]=qs[_0x0c94('0x22')](_0x52029c[_0x0c94('0x39')]['offset']);}return _0x52c768[_0x0c94('0x5f')](_0x5dec98);}})['then'](function(_0x3c8832){if(_0x3c8832){return _0x3c8832?{'count':_0x36754a,'rows':_0x3c8832}:null;}})[_0x0c94('0x2c')](respondWithResult(_0x4fc565,null))['catch'](handleError(_0x4fc565,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index d107cab..c2f9155 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 _0xe1c6=['events','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x65817b,_0x41c477){var _0x35e3b1=function(_0x51550b){while(--_0x51550b){_0x65817b['push'](_0x65817b['shift']());}};_0x35e3b1(++_0x41c477);}(_0xe1c6,0x154));var _0x6e1c=function(_0x3506aa,_0x4e70f5){_0x3506aa=_0x3506aa-0x0;var _0x3aaf43=_0xe1c6[_0x3506aa];return _0x3aaf43;};'use strict';var EventEmitter=require(_0x6e1c('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x6e1c('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x6e1c('0x2')](0x0);var events={'afterCreate':_0x6e1c('0x3'),'afterUpdate':_0x6e1c('0x4'),'afterDestroy':_0x6e1c('0x5')};function emitEvent(_0x2e4750){return function(_0x1bfab8,_0x17eb16,_0x231aa6){SquareProjectEvents[_0x6e1c('0x6')](_0x2e4750+':'+_0x1bfab8['id'],_0x1bfab8);SquareProjectEvents[_0x6e1c('0x6')](_0x2e4750,_0x1bfab8);_0x231aa6(null);};}for(var e in events){if(events[_0x6e1c('0x7')](e)){var event=events[e];SquareProject[_0x6e1c('0x8')](e,emitEvent(event));}}module[_0x6e1c('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x4905=['SquareProject','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x115cf7,_0x54d11e){var _0x4e21aa=function(_0xcd2990){while(--_0xcd2990){_0x115cf7['push'](_0x115cf7['shift']());}};_0x4e21aa(++_0x54d11e);}(_0x4905,0x179));var _0x5490=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x4905[_0x4dbaad];return _0x226c72;};'use strict';var EventEmitter=require(_0x5490('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x5490('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x5490('0x2')](0x0);var events={'afterCreate':_0x5490('0x3'),'afterUpdate':_0x5490('0x4'),'afterDestroy':_0x5490('0x5')};function emitEvent(_0x340cf2){return function(_0x3c51f4,_0x5a8a50,_0x199bf2){SquareProjectEvents[_0x5490('0x6')](_0x340cf2+':'+_0x3c51f4['id'],_0x3c51f4);SquareProjectEvents[_0x5490('0x6')](_0x340cf2,_0x3c51f4);_0x199bf2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x5490('0x7')](e,emitEvent(event));}}module[_0x5490('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 db31845..888a4b2 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 _0x2c0f=['moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','define','SquareProject','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','lodash','util','../../config/logger','api'];(function(_0x52fb16,_0x18014f){var _0x258fb7=function(_0x535a4f){while(--_0x535a4f){_0x52fb16['push'](_0x52fb16['shift']());}};_0x258fb7(++_0x18014f);}(_0x2c0f,0xd9));var _0xf2c0=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0x2c0f[_0x5e42a7];return _0x36d21b;};'use strict';var _=require(_0xf2c0('0x0'));var util=require(_0xf2c0('0x1'));var logger=require(_0xf2c0('0x2'))(_0xf2c0('0x3'));var moment=require(_0xf2c0('0x4'));var BPromise=require(_0xf2c0('0x5'));var rp=require(_0xf2c0('0x6'));var fs=require('fs');var path=require(_0xf2c0('0x7'));var rimraf=require('rimraf');var config=require(_0xf2c0('0x8'));var attributes=require(_0xf2c0('0x9'));module['exports']=function(_0x37bc21,_0x2fcf43){return _0x37bc21[_0xf2c0('0xa')](_0xf2c0('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1fb174,_0x57f905,_0x15056e){if(_0x1fb174['changed'](_0xf2c0('0xc'))){_0x1fb174[_0xf2c0('0xd')]=moment()[_0xf2c0('0xe')](_0xf2c0('0xf'));}if(_0x1fb174[_0xf2c0('0x10')]('production')){_0x1fb174['publishedAt']=moment()[_0xf2c0('0xe')](_0xf2c0('0xf'));}_0x15056e(null,_0x1fb174);}}});}; \ No newline at end of file +var _0x35c4=['YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','define','square_projects','savedAt','format'];(function(_0x24a536,_0x29f9a5){var _0x5ccb17=function(_0x549906){while(--_0x549906){_0x24a536['push'](_0x24a536['shift']());}};_0x5ccb17(++_0x29f9a5);}(_0x35c4,0x70));var _0x435c=function(_0xe74468,_0x38fa41){_0xe74468=_0xe74468-0x0;var _0x2598e8=_0x35c4[_0xe74468];return _0x2598e8;};'use strict';var _=require(_0x435c('0x0'));var util=require(_0x435c('0x1'));var logger=require(_0x435c('0x2'))(_0x435c('0x3'));var moment=require(_0x435c('0x4'));var BPromise=require('bluebird');var rp=require(_0x435c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x435c('0x6'));var config=require(_0x435c('0x7'));var attributes=require(_0x435c('0x8'));module[_0x435c('0x9')]=function(_0x4e3dcd,_0x40c990){return _0x4e3dcd[_0x435c('0xa')]('SquareProject',attributes,{'tableName':_0x435c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5ae09f,_0x2414be,_0x339916){if(_0x5ae09f['changed']('preproduction')){_0x5ae09f[_0x435c('0xc')]=moment()[_0x435c('0xd')](_0x435c('0xe'));}if(_0x5ae09f[_0x435c('0xf')](_0x435c('0x10'))){_0x5ae09f[_0x435c('0x11')]=moment()[_0x435c('0xd')](_0x435c('0xe'));}_0x339916(null,_0x5ae09f);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index a6abd78..bcb8c05 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 _0x76df=['model','attributes','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','defaults','redis','localhost','./squareProject.socket','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSquareProject','SquareProject','options','where','include','map'];(function(_0x4718d8,_0x2610e6){var _0x115468=function(_0x5aa59f){while(--_0x5aa59f){_0x4718d8['push'](_0x4718d8['shift']());}};_0x115468(++_0x2610e6);}(_0x76df,0x142));var _0xf76d=function(_0x9686e3,_0x205f24){_0x9686e3=_0x9686e3-0x0;var _0x4d6220=_0x76df[_0x9686e3];return _0x4d6220;};'use strict';var _=require('lodash');var util=require(_0xf76d('0x0'));var moment=require(_0xf76d('0x1'));var BPromise=require(_0xf76d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf76d('0x3'));var db=require(_0xf76d('0x4'))['db'];var utils=require(_0xf76d('0x5'));var logger=require(_0xf76d('0x6'))(_0xf76d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf76d('0x8')]({'port':0x232a});config['redis']=_[_0xf76d('0x9')](config[_0xf76d('0xa')],{'host':_0xf76d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf76d('0xa')]));require(_0xf76d('0xc'))['register'](socket);function respondWithRpcPromise(_0x1ed1a3,_0x4327b1,_0x5ecd5a){return new BPromise(function(_0x273556,_0x2e0a50){return client[_0xf76d('0xd')](_0x1ed1a3,_0x5ecd5a)['then'](function(_0xbd5dac){logger[_0xf76d('0xe')](_0xf76d('0xf'),_0x4327b1,_0xf76d('0x10'));logger[_0xf76d('0x11')](_0xf76d('0x12'),_0x4327b1,_0xf76d('0x10'),JSON[_0xf76d('0x13')](_0xbd5dac));if(_0xbd5dac[_0xf76d('0x14')]){if(_0xbd5dac['error']['code']===0x1f4){logger[_0xf76d('0x14')](_0xf76d('0xf'),_0x4327b1,_0xbd5dac['error']['message']);return _0x2e0a50(_0xbd5dac[_0xf76d('0x14')]['message']);}logger[_0xf76d('0x14')](_0xf76d('0xf'),_0x4327b1,_0xbd5dac[_0xf76d('0x14')][_0xf76d('0x15')]);return _0x273556(_0xbd5dac[_0xf76d('0x14')][_0xf76d('0x15')]);}else{logger[_0xf76d('0xe')]('SquareProject,\x20%s,\x20%s',_0x4327b1,_0xf76d('0x10'));_0x273556(_0xbd5dac[_0xf76d('0x16')][_0xf76d('0x15')]);}})[_0xf76d('0x17')](function(_0x577b74){logger[_0xf76d('0x14')](_0xf76d('0xf'),_0x4327b1,_0x577b74);_0x2e0a50(_0x577b74);});});}exports[_0xf76d('0x18')]=function(_0x2713bf){var _0x47cb17=this;return new Promise(function(_0x5ea42e,_0x6ec6a7){return db[_0xf76d('0x19')]['find']({'raw':_0x2713bf['options']?_0x2713bf[_0xf76d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2713bf[_0xf76d('0x1a')]?_0x2713bf[_0xf76d('0x1a')][_0xf76d('0x1b')]||null:null,'attributes':_0x2713bf['options']?_0x2713bf[_0xf76d('0x1a')]['attributes']||null:null,'include':_0x2713bf['options']?_0x2713bf['options'][_0xf76d('0x1c')]?_[_0xf76d('0x1d')](_0x2713bf['options'][_0xf76d('0x1c')],function(_0x2d6e4f){return{'model':db[_0x2d6e4f[_0xf76d('0x1e')]],'as':_0x2d6e4f['as'],'attributes':_0x2d6e4f[_0xf76d('0x1f')],'include':_0x2d6e4f[_0xf76d('0x1c')]?_['map'](_0x2d6e4f[_0xf76d('0x1c')],function(_0x1968c1){return{'model':db[_0x1968c1['model']],'as':_0x1968c1['as'],'attributes':_0x1968c1[_0xf76d('0x1f')],'include':_0x1968c1[_0xf76d('0x1c')]?_[_0xf76d('0x1d')](_0x1968c1[_0xf76d('0x1c')],function(_0x1e5c3c){return{'model':db[_0x1e5c3c[_0xf76d('0x1e')]],'as':_0x1e5c3c['as'],'attributes':_0x1e5c3c[_0xf76d('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e9af6){logger[_0xf76d('0xe')](_0xf76d('0x18'),_0x2713bf);logger['debug'](_0xf76d('0x18'),_0x2713bf,JSON[_0xf76d('0x13')](_0x4e9af6));_0x5ea42e(_0x4e9af6);})[_0xf76d('0x17')](function(_0x190939){logger[_0xf76d('0x14')](_0xf76d('0x18'),_0x190939[_0xf76d('0x15')],_0x2713bf);_0x6ec6a7(_0x47cb17['error'](0x1f4,_0x190939[_0xf76d('0x15')]));});});}; \ No newline at end of file +var _0x7e14=['raw','where','include','map','model','attributes','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','./squareProject.socket','register','request','then','info','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','SquareProject,\x20%s,\x20%s','message','result','ShowSquareProject','SquareProject','find','options'];(function(_0x470f63,_0x48d80b){var _0x4f09e2=function(_0x3aa3a4){while(--_0x3aa3a4){_0x470f63['push'](_0x470f63['shift']());}};_0x4f09e2(++_0x48d80b);}(_0x7e14,0xdf));var _0x47e1=function(_0x362501,_0x320b2a){_0x362501=_0x362501-0x0;var _0x17be05=_0x7e14[_0x362501];return _0x17be05;};'use strict';var _=require(_0x47e1('0x0'));var util=require(_0x47e1('0x1'));var moment=require(_0x47e1('0x2'));var BPromise=require('bluebird');var rs=require(_0x47e1('0x3'));var fs=require('fs');var Redis=require(_0x47e1('0x4'));var db=require(_0x47e1('0x5'))['db'];var utils=require(_0x47e1('0x6'));var logger=require('../../config/logger')(_0x47e1('0x7'));var config=require(_0x47e1('0x8'));var jayson=require(_0x47e1('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x47e1('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x47e1('0xb'))(new Redis(config[_0x47e1('0xa')]));require(_0x47e1('0xc'))[_0x47e1('0xd')](socket);function respondWithRpcPromise(_0x180953,_0x2f0cb3,_0xe02504){return new BPromise(function(_0x52db69,_0x57b37f){return client[_0x47e1('0xe')](_0x180953,_0xe02504)[_0x47e1('0xf')](function(_0x3b61e1){logger[_0x47e1('0x10')]('SquareProject,\x20%s,\x20%s',_0x2f0cb3,_0x47e1('0x11'));logger[_0x47e1('0x12')](_0x47e1('0x13'),_0x2f0cb3,_0x47e1('0x11'),JSON[_0x47e1('0x14')](_0x3b61e1));if(_0x3b61e1[_0x47e1('0x15')]){if(_0x3b61e1[_0x47e1('0x15')]['code']===0x1f4){logger[_0x47e1('0x15')](_0x47e1('0x16'),_0x2f0cb3,_0x3b61e1['error'][_0x47e1('0x17')]);return _0x57b37f(_0x3b61e1[_0x47e1('0x15')][_0x47e1('0x17')]);}logger[_0x47e1('0x15')](_0x47e1('0x16'),_0x2f0cb3,_0x3b61e1[_0x47e1('0x15')][_0x47e1('0x17')]);return _0x52db69(_0x3b61e1[_0x47e1('0x15')][_0x47e1('0x17')]);}else{logger['info']('SquareProject,\x20%s,\x20%s',_0x2f0cb3,_0x47e1('0x11'));_0x52db69(_0x3b61e1[_0x47e1('0x18')][_0x47e1('0x17')]);}})['catch'](function(_0x4e6f27){logger[_0x47e1('0x15')](_0x47e1('0x16'),_0x2f0cb3,_0x4e6f27);_0x57b37f(_0x4e6f27);});});}exports[_0x47e1('0x19')]=function(_0x59d7ff){var _0x14dfb2=this;return new Promise(function(_0x1a48eb,_0x53ec44){return db[_0x47e1('0x1a')][_0x47e1('0x1b')]({'raw':_0x59d7ff[_0x47e1('0x1c')]?_0x59d7ff['options'][_0x47e1('0x1d')]===undefined?!![]:![]:!![],'where':_0x59d7ff[_0x47e1('0x1c')]?_0x59d7ff[_0x47e1('0x1c')][_0x47e1('0x1e')]||null:null,'attributes':_0x59d7ff[_0x47e1('0x1c')]?_0x59d7ff[_0x47e1('0x1c')]['attributes']||null:null,'include':_0x59d7ff['options']?_0x59d7ff[_0x47e1('0x1c')][_0x47e1('0x1f')]?_[_0x47e1('0x20')](_0x59d7ff[_0x47e1('0x1c')]['include'],function(_0x521d14){return{'model':db[_0x521d14[_0x47e1('0x21')]],'as':_0x521d14['as'],'attributes':_0x521d14[_0x47e1('0x22')],'include':_0x521d14[_0x47e1('0x1f')]?_['map'](_0x521d14[_0x47e1('0x1f')],function(_0x1cfd99){return{'model':db[_0x1cfd99[_0x47e1('0x21')]],'as':_0x1cfd99['as'],'attributes':_0x1cfd99[_0x47e1('0x22')],'include':_0x1cfd99[_0x47e1('0x1f')]?_[_0x47e1('0x20')](_0x1cfd99['include'],function(_0x249345){return{'model':db[_0x249345[_0x47e1('0x21')]],'as':_0x249345['as'],'attributes':_0x249345['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x868d62){logger[_0x47e1('0x10')](_0x47e1('0x19'),_0x59d7ff);logger['debug'](_0x47e1('0x19'),_0x59d7ff,JSON['stringify'](_0x868d62));_0x1a48eb(_0x868d62);})[_0x47e1('0x23')](function(_0x5c3198){logger[_0x47e1('0x15')]('ShowSquareProject',_0x5c3198[_0x47e1('0x17')],_0x59d7ff);_0x53ec44(_0x14dfb2['error'](0x1f4,_0x5c3198['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 4335c76..55818f3 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 _0xe10b=['emit','removeListener','register','length','squareProject:','save','remove','update'];(function(_0x1ebfc7,_0x2797db){var _0x1627b8=function(_0x59ceee){while(--_0x59ceee){_0x1ebfc7['push'](_0x1ebfc7['shift']());}};_0x1627b8(++_0x2797db);}(_0xe10b,0x12d));var _0xbe10=function(_0x3fa41e,_0x1fad37){_0x3fa41e=_0x3fa41e-0x0;var _0x143cd5=_0xe10b[_0x3fa41e];return _0x143cd5;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xbe10('0x0'),_0xbe10('0x1'),_0xbe10('0x2')];function createListener(_0x3296a4,_0x5f2c78){return function(_0x76773f){_0x5f2c78[_0xbe10('0x3')](_0x3296a4,_0x76773f);};}function removeListener(_0x18bbfb,_0x122a4b){return function(){SquareProjectEvents[_0xbe10('0x4')](_0x18bbfb,_0x122a4b);};}exports[_0xbe10('0x5')]=function(_0x4a9fd4){for(var _0x4eb597=0x0,_0x45e2e2=events[_0xbe10('0x6')];_0x4eb597<_0x45e2e2;_0x4eb597++){var _0x2a61f5=events[_0x4eb597];var _0x43c19d=createListener(_0xbe10('0x7')+_0x2a61f5,_0x4a9fd4);SquareProjectEvents['on'](_0x2a61f5,_0x43c19d);}}; \ No newline at end of file +var _0xec17=['removeListener','register','length','squareProject:','./squareProject.events','save','remove','update'];(function(_0x460573,_0x3024e9){var _0x3e670d=function(_0x5d1eaa){while(--_0x5d1eaa){_0x460573['push'](_0x460573['shift']());}};_0x3e670d(++_0x3024e9);}(_0xec17,0x7c));var _0x7ec1=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xec17[_0x2c91e9];return _0x13f0ff;};'use strict';var SquareProjectEvents=require(_0x7ec1('0x0'));var events=[_0x7ec1('0x1'),_0x7ec1('0x2'),_0x7ec1('0x3')];function createListener(_0x419c1c,_0x1f3a77){return function(_0x65bebe){_0x1f3a77['emit'](_0x419c1c,_0x65bebe);};}function removeListener(_0x141ae3,_0x3a1bf9){return function(){SquareProjectEvents[_0x7ec1('0x4')](_0x141ae3,_0x3a1bf9);};}exports[_0x7ec1('0x5')]=function(_0x7c7344){for(var _0x3d139a=0x0,_0x1b4bbd=events[_0x7ec1('0x6')];_0x3d139a<_0x1b4bbd;_0x3d139a++){var _0x4f3517=events[_0x3d139a];var _0x50b64c=createListener(_0x7ec1('0x7')+_0x4f3517,_0x7c7344);SquareProjectEvents['on'](_0x4f3517,_0x50b64c);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index da69303..8799fc6 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 _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0xe20c98,_0x56c150){var _0x5c0db9=function(_0x1e94ee){while(--_0x1e94ee){_0xe20c98['push'](_0xe20c98['shift']());}};_0x5c0db9(++_0x56c150);}(_0x5fab,0x177));var _0xb5fa=function(_0x327dbd,_0x2bd34d){_0x327dbd=_0x327dbd-0x0;var _0x58775e=_0x5fab[_0x327dbd];return _0x58775e;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file +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(_0xe4ea86,_0xf678b6){var _0x3756e0=function(_0x2144f2){while(--_0x2144f2){_0xe4ea86['push'](_0xe4ea86['shift']());}};_0x3756e0(++_0xf678b6);}(_0x1cb9,0x14e));var _0x91cb=function(_0x129f97,_0x1f079b){_0x129f97=_0x129f97-0x0;var _0x16621a=_0x1cb9[_0x129f97];return _0x16621a;};'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 diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 3de862b..57c006f 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 _0x8ef6=['VIRTUAL','savePath','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x41cfd4,_0x1ed2cc){var _0x190f48=function(_0x4b5b1a){while(--_0x4b5b1a){_0x41cfd4['push'](_0x41cfd4['shift']());}};_0x190f48(++_0x1ed2cc);}(_0x8ef6,0xf2));var _0x68ef=function(_0x4b8823,_0x322260){_0x4b8823=_0x4b8823-0x0;var _0x4b8263=_0x8ef6[_0x4b8823];return _0x4b8263;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'callerid':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize[_0x68ef('0x2')]},'extension':{'type':Sequelize[_0x68ef('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'dnid':{'type':Sequelize[_0x68ef('0x2')]},'projectName':{'type':Sequelize[_0x68ef('0x2')]},'saveName':{'type':Sequelize[_0x68ef('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x68ef('0x3')],'get':function(){var _0x4740e8='';var _0x2de776=this['getDataValue'](_0x68ef('0x4'));if(_0x2de776){_0x4740e8=_0x2de776[_0x68ef('0x5')](_0x2de776[_0x68ef('0x6')]('.'));}return _0x4740e8;}}}; \ No newline at end of file +var _0x7dfd=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','savePath'];(function(_0x1d0b5e,_0x5aa065){var _0x57a93b=function(_0x1cda96){while(--_0x1cda96){_0x1d0b5e['push'](_0x1d0b5e['shift']());}};_0x57a93b(++_0x5aa065);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'uniqueid':{'type':Sequelize[_0xd7df('0x2')]},'callerid':{'type':Sequelize[_0xd7df('0x2')]},'calleridname':{'type':Sequelize[_0xd7df('0x2')]},'context':{'type':Sequelize[_0xd7df('0x2')]},'extension':{'type':Sequelize[_0xd7df('0x2')]},'priority':{'type':Sequelize[_0xd7df('0x2')]},'accountcode':{'type':Sequelize[_0xd7df('0x2')]},'dnid':{'type':Sequelize[_0xd7df('0x2')]},'projectName':{'type':Sequelize[_0xd7df('0x2')]},'saveName':{'type':Sequelize[_0xd7df('0x2')]},'filename':{'type':Sequelize[_0xd7df('0x2')]},'savePath':{'type':Sequelize[_0xd7df('0x2')]},'format':{'type':Sequelize[_0xd7df('0x3')],'get':function(){var _0x16e50='';var _0x2c48a4=this['getDataValue'](_0xd7df('0x4'));if(_0x2c48a4){_0x16e50=_0x2c48a4[_0xd7df('0x5')](_0x2c48a4[_0xd7df('0x6')]('.'));}return _0x16e50;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 944b4ef..be966b3 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 _0x0d15=['ValidationError','SquareRecording\x20not\x20found','filename','unlink','Not\x20found','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','then','destroy','error','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','keys','length','include','find','body','update','params','download','../../components/encryptor','type','uniqueid','savePath','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize'];(function(_0x2af9ed,_0x4a6014){var _0x47a1ce=function(_0xe0b7df){while(--_0xe0b7df){_0x2af9ed['push'](_0x2af9ed['shift']());}};_0x47a1ce(++_0x4a6014);}(_0x0d15,0x192));var _0x50d1=function(_0x2d88ca,_0x3a0ddc){_0x2d88ca=_0x2d88ca-0x0;var _0x33df12=_0x0d15[_0x2d88ca];return _0x33df12;};'use strict';var emlformat=require(_0x50d1('0x0'));var rimraf=require(_0x50d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50d1('0x2'));var rp=require(_0x50d1('0x3'));var moment=require(_0x50d1('0x4'));var BPromise=require(_0x50d1('0x5'));var Mustache=require(_0x50d1('0x6'));var util=require(_0x50d1('0x7'));var path=require('path');var sox=require(_0x50d1('0x8'));var csv=require(_0x50d1('0x9'));var ejs=require(_0x50d1('0xa'));var fs=require('fs');var fs_extra=require(_0x50d1('0xb'));var _=require(_0x50d1('0xc'));var squel=require(_0x50d1('0xd'));var crypto=require(_0x50d1('0xe'));var jsforce=require(_0x50d1('0xf'));var deskjs=require(_0x50d1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x50d1('0x11'));var Papa=require(_0x50d1('0x12'));var Redis=require(_0x50d1('0x13'));var authService=require(_0x50d1('0x14'));var qs=require(_0x50d1('0x15'));var as=require(_0x50d1('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x50d1('0x17'))(_0x50d1('0x18'));var utils=require(_0x50d1('0x19'));var config=require(_0x50d1('0x1a'));var licenseUtil=require(_0x50d1('0x1b'));var db=require(_0x50d1('0x1c'))['db'];function respondWithStatusCode(_0x46b68d,_0x1d2a20){_0x1d2a20=_0x1d2a20||0xcc;return function(_0x4b1356){if(_0x4b1356){return _0x46b68d[_0x50d1('0x1d')](_0x1d2a20);}return _0x46b68d[_0x50d1('0x1e')](_0x1d2a20)[_0x50d1('0x1f')]();};}function respondWithResult(_0x52f2a5,_0x318d90){_0x318d90=_0x318d90||0xc8;return function(_0x3fa29f){if(_0x3fa29f){return _0x52f2a5[_0x50d1('0x1e')](_0x318d90)[_0x50d1('0x20')](_0x3fa29f);}};}function respondWithFilteredResult(_0x15725e,_0x53db7d){return function(_0x17d64c){if(_0x17d64c){var _0x3b70e1=typeof _0x53db7d[_0x50d1('0x21')]==='undefined'&&typeof _0x53db7d[_0x50d1('0x22')]===_0x50d1('0x23');var _0x3406a4=_0x17d64c[_0x50d1('0x24')];var _0x1d75f0=_0x3b70e1?0x0:_0x53db7d[_0x50d1('0x21')];var _0x44da2e=_0x3b70e1?_0x17d64c[_0x50d1('0x24')]:_0x53db7d[_0x50d1('0x21')]+_0x53db7d[_0x50d1('0x22')];var _0x30bc49;if(_0x44da2e>=_0x3406a4){_0x44da2e=_0x3406a4;_0x30bc49=0xc8;}else{_0x30bc49=0xce;}_0x15725e[_0x50d1('0x1e')](_0x30bc49);return _0x15725e[_0x50d1('0x25')]('Content-Range',_0x1d75f0+'-'+_0x44da2e+'/'+_0x3406a4)[_0x50d1('0x20')](_0x17d64c);}return null;};}function patchUpdates(_0x376f41){return function(_0x1cebef){try{jsonpatch['apply'](_0x1cebef,_0x376f41,!![]);}catch(_0x30be0c){return BPromise[_0x50d1('0x26')](_0x30be0c);}return _0x1cebef[_0x50d1('0x27')]();};}function saveUpdates(_0x493c59,_0x1854b8){return function(_0x4cb1fd){if(_0x4cb1fd){return _0x4cb1fd['update'](_0x493c59)[_0x50d1('0x28')](function(_0x501424){return _0x501424;});}return null;};}function removeEntity(_0x10a4bd,_0x1ecdbc){return function(_0x236475){if(_0x236475){return _0x236475[_0x50d1('0x29')]()[_0x50d1('0x28')](function(){_0x10a4bd[_0x50d1('0x1e')](0xcc)[_0x50d1('0x1f')]();});}};}function handleEntityNotFound(_0x51e480,_0x3baa89){return function(_0x421279){if(!_0x421279){_0x51e480[_0x50d1('0x1d')](0x194);}return _0x421279;};}function handleError(_0x4d174c,_0x59caef){_0x59caef=_0x59caef||0x1f4;return function(_0x3ed20b){logger[_0x50d1('0x2a')](_0x3ed20b['stack']);if(_0x3ed20b[_0x50d1('0x2b')]){delete _0x3ed20b[_0x50d1('0x2b')];}_0x4d174c['status'](_0x59caef)[_0x50d1('0x2c')](_0x3ed20b);};}exports[_0x50d1('0x2d')]=function(_0x183585,_0x5e43fb){var _0x541717={},_0x443092={},_0x28cc52={'count':0x0,'rows':[]};var _0x346266=_[_0x50d1('0x2e')](db[_0x50d1('0x2f')][_0x50d1('0x30')],function(_0x7a71ef){return{'name':_0x7a71ef[_0x50d1('0x31')],'type':_0x7a71ef['type'][_0x50d1('0x32')]};});_0x443092[_0x50d1('0x33')]=_[_0x50d1('0x2e')](_0x346266,_0x50d1('0x2b'));_0x443092[_0x50d1('0x34')]=_['keys'](_0x183585[_0x50d1('0x34')]);_0x443092[_0x50d1('0x35')]=_[_0x50d1('0x36')](_0x443092[_0x50d1('0x33')],_0x443092[_0x50d1('0x34')]);_0x541717[_0x50d1('0x37')]=_[_0x50d1('0x36')](_0x443092[_0x50d1('0x33')],qs['fields'](_0x183585[_0x50d1('0x34')][_0x50d1('0x38')]));_0x541717[_0x50d1('0x37')]=_0x541717[_0x50d1('0x37')]['length']?_0x541717[_0x50d1('0x37')]:_0x443092[_0x50d1('0x33')];if(!_0x183585[_0x50d1('0x34')][_0x50d1('0x39')](_0x50d1('0x3a'))){_0x541717[_0x50d1('0x22')]=qs[_0x50d1('0x22')](_0x183585[_0x50d1('0x34')][_0x50d1('0x22')]);_0x541717[_0x50d1('0x21')]=qs['offset'](_0x183585[_0x50d1('0x34')][_0x50d1('0x21')]);}_0x541717[_0x50d1('0x3b')]=qs['sort'](_0x183585[_0x50d1('0x34')][_0x50d1('0x3c')]);_0x541717[_0x50d1('0x3d')]=qs[_0x50d1('0x35')](_['pick'](_0x183585[_0x50d1('0x34')],_0x443092['filters']),_0x346266);if(_0x183585['query'][_0x50d1('0x3e')]){_0x541717[_0x50d1('0x3d')]=_[_0x50d1('0x3f')](_0x541717[_0x50d1('0x3d')],{'$or':_[_0x50d1('0x2e')](_0x346266,function(_0x3b1a72){if(_0x3b1a72['type']!==_0x50d1('0x40')){var _0x5d20d4={};_0x5d20d4[_0x3b1a72[_0x50d1('0x2b')]]={'$like':'%'+_0x183585[_0x50d1('0x34')]['filter']+'%'};return _0x5d20d4;}})});}_0x541717=_[_0x50d1('0x3f')]({},_0x541717,_0x183585[_0x50d1('0x41')]);var _0x5a7c0={'where':_0x541717[_0x50d1('0x3d')]};return db[_0x50d1('0x2f')]['count'](_0x5a7c0)[_0x50d1('0x28')](function(_0x15716e){_0x28cc52[_0x50d1('0x24')]=_0x15716e;if(_0x183585['query'][_0x50d1('0x42')]){_0x541717['include']=[{'all':!![]}];}return db[_0x50d1('0x2f')][_0x50d1('0x43')](_0x541717);})[_0x50d1('0x28')](function(_0xb77c1f){_0x28cc52['rows']=_0xb77c1f;return _0x28cc52;})['then'](respondWithFilteredResult(_0x5e43fb,_0x541717))[_0x50d1('0x44')](handleError(_0x5e43fb,null));};exports['show']=function(_0x17fbc5,_0x3bb6a6){var _0x2832ff={'raw':!![],'where':{'id':_0x17fbc5['params']['id']}},_0x459ef9={};_0x459ef9[_0x50d1('0x33')]=_['keys'](db['SquareRecording'][_0x50d1('0x30')]);_0x459ef9['query']=_[_0x50d1('0x45')](_0x17fbc5[_0x50d1('0x34')]);_0x459ef9['filters']=_[_0x50d1('0x36')](_0x459ef9['model'],_0x459ef9['query']);_0x2832ff['attributes']=_[_0x50d1('0x36')](_0x459ef9[_0x50d1('0x33')],qs['fields'](_0x17fbc5[_0x50d1('0x34')][_0x50d1('0x38')]));_0x2832ff['attributes']=_0x2832ff[_0x50d1('0x37')][_0x50d1('0x46')]?_0x2832ff[_0x50d1('0x37')]:_0x459ef9['model'];if(_0x17fbc5[_0x50d1('0x34')][_0x50d1('0x42')]){_0x2832ff[_0x50d1('0x47')]=[{'all':!![]}];}_0x2832ff=_[_0x50d1('0x3f')]({},_0x2832ff,_0x17fbc5['options']);return db[_0x50d1('0x2f')][_0x50d1('0x48')](_0x2832ff)[_0x50d1('0x28')](handleEntityNotFound(_0x3bb6a6,null))['then'](respondWithResult(_0x3bb6a6,null))[_0x50d1('0x44')](handleError(_0x3bb6a6,null));};exports['create']=function(_0xa758f3,_0x23ec8b){return db[_0x50d1('0x2f')]['create'](_0xa758f3[_0x50d1('0x49')],{})[_0x50d1('0x28')](respondWithResult(_0x23ec8b,0xc9))[_0x50d1('0x44')](handleError(_0x23ec8b,null));};exports[_0x50d1('0x4a')]=function(_0x5ee532,_0x97422e){if(_0x5ee532['body']['id']){delete _0x5ee532['body']['id'];}return db[_0x50d1('0x2f')][_0x50d1('0x48')]({'where':{'id':_0x5ee532[_0x50d1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x97422e,null))['then'](saveUpdates(_0x5ee532[_0x50d1('0x49')],null))['then'](respondWithResult(_0x97422e,null))[_0x50d1('0x44')](handleError(_0x97422e,null));};exports[_0x50d1('0x4c')]=function(_0x9429ff,_0x18a2e3,_0x4e0fa3){var _0xf51c9e=require(_0x50d1('0x4d'));var _0x3e3805=![];var _0x44309b={};if(_0x9429ff[_0x50d1('0x34')][_0x50d1('0x4e')]&&_0x9429ff[_0x50d1('0x34')]['type']===_0x50d1('0x4f')){_0x44309b[_0x50d1('0x4f')]=_0x9429ff[_0x50d1('0x4b')]['id'];}else{_0x44309b['id']=_0x9429ff[_0x50d1('0x4b')]['id'];}return db['SquareRecording'][_0x50d1('0x48')]({'where':_0x44309b,'attributes':['id',_0x50d1('0x50'),'filename'],'raw':!![]})[_0x50d1('0x28')](handleEntityNotFound(_0x18a2e3,null))[_0x50d1('0x28')](function(_0x126f79){if(_0x126f79){var _0x26ab31=_0x126f79[_0x50d1('0x50')];var _0x5be3a1=util[_0x50d1('0x51')](_0x50d1('0x52'),_0x26ab31);if(fs['existsSync'](_0x5be3a1)){_0x3e3805=!![];return _0xf51c9e[_0x50d1('0x53')](_0x5be3a1,_0x26ab31,config[_0x50d1('0x54')][_0x50d1('0x55')])[_0x50d1('0x28')](function(){return _0x126f79;});}return _0x126f79;}})[_0x50d1('0x28')](function(_0x1a2e3c){if(_0x1a2e3c){var _0xbcd38a=_0x1a2e3c[_0x50d1('0x50')];if(!fs[_0x50d1('0x56')](_0xbcd38a)){throw new db[(_0x50d1('0x57'))][(_0x50d1('0x58'))](_0x50d1('0x59'));}if(_0x1a2e3c[_0x50d1('0x5a')]){return _0x18a2e3[_0x50d1('0x4c')](_0xbcd38a,_0x1a2e3c[_0x50d1('0x5a')]+path['extname'](_0xbcd38a),function(){if(_0x3e3805){fs[_0x50d1('0x5b')](_0xbcd38a);}});}else{return _0x18a2e3['download'](_0xbcd38a,function(_0x97f150){if(_0x3e3805){fs[_0x50d1('0x5b')](_0xbcd38a);}});}}})[_0x50d1('0x44')](function(_0x59b5b6){if(_0x59b5b6['message']===_0x50d1('0x59')){_0x18a2e3[_0x50d1('0x1e')](0x194)[_0x50d1('0x2c')](_0x50d1('0x5c'));}else{return handleError(_0x18a2e3,null);}});};exports[_0x50d1('0x29')]=function(_0x2b7136,_0x5b13fc){return db['SquareRecording'][_0x50d1('0x48')]({'where':{'id':_0x2b7136[_0x50d1('0x4b')]['id']}})[_0x50d1('0x28')](function(_0x1c19ac){if(_[_0x50d1('0x5d')](_0x1c19ac)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1c19ac;})['then'](function(_0x176d55){var _0x1b1fe5=_0x176d55['savePath'];logger[_0x50d1('0x5e')]('cancellazione\x20fisica\x20documento\x20%s',_0x1b1fe5);if(!_[_0x50d1('0x5d')](_0x176d55[_0x50d1('0x50')])&&fs[_0x50d1('0x56')](_0x1b1fe5)){logger[_0x50d1('0x5e')]('File:\x20\x22'+_0x1b1fe5+_0x50d1('0x5f'));fs[_0x50d1('0x60')](_0x1b1fe5);}_0x1b1fe5=_0x1b1fe5+'.cypher';if(!_['isNil'](_0x176d55['savePath'])&&fs['existsSync'](_0x1b1fe5)){logger[_0x50d1('0x5e')](_0x50d1('0x61')+_0x1b1fe5+_0x50d1('0x5f'));fs[_0x50d1('0x60')](_0x1b1fe5);}return _0x176d55;})[_0x50d1('0x28')](function(_0x14fdf2){if(!_0x14fdf2)throw new InternalError();return _0x14fdf2[_0x50d1('0x29')]();})['then'](function(){_0x5b13fc[_0x50d1('0x1e')](0xcc)['end']();})[_0x50d1('0x44')](handleError(_0x5b13fc,null));}; \ No newline at end of file +var _0xc8d6=['params','model','keys','options','find','create','body','uniqueid','savePath','filename','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','send','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','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','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','sendStatus','stack','name','map','SquareRecording','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','includeAll','include','rows','catch','show'];(function(_0x8af54b,_0x280be5){var _0x27d8f0=function(_0x559734){while(--_0x559734){_0x8af54b['push'](_0x8af54b['shift']());}};_0x27d8f0(++_0x280be5);}(_0xc8d6,0xe0));var _0x6c8d=function(_0x2c77e7,_0x425ebb){_0x2c77e7=_0x2c77e7-0x0;var _0x51f485=_0xc8d6[_0x2c77e7];return _0x51f485;};'use strict';var emlformat=require(_0x6c8d('0x0'));var rimraf=require(_0x6c8d('0x1'));var zipdir=require(_0x6c8d('0x2'));var jsonpatch=require(_0x6c8d('0x3'));var rp=require(_0x6c8d('0x4'));var moment=require('moment');var BPromise=require(_0x6c8d('0x5'));var Mustache=require(_0x6c8d('0x6'));var util=require('util');var path=require(_0x6c8d('0x7'));var sox=require(_0x6c8d('0x8'));var csv=require(_0x6c8d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c8d('0xa'));var _=require('lodash');var squel=require(_0x6c8d('0xb'));var crypto=require(_0x6c8d('0xc'));var jsforce=require(_0x6c8d('0xd'));var deskjs=require(_0x6c8d('0xe'));var toCsv=require(_0x6c8d('0x9'));var querystring=require(_0x6c8d('0xf'));var Papa=require(_0x6c8d('0x10'));var Redis=require(_0x6c8d('0x11'));var authService=require(_0x6c8d('0x12'));var qs=require(_0x6c8d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c8d('0x14'));var logger=require(_0x6c8d('0x15'))('api');var utils=require(_0x6c8d('0x16'));var config=require(_0x6c8d('0x17'));var licenseUtil=require(_0x6c8d('0x18'));var db=require(_0x6c8d('0x19'))['db'];function respondWithStatusCode(_0x5730b5,_0x4f2a42){_0x4f2a42=_0x4f2a42||0xcc;return function(_0x37eef5){if(_0x37eef5){return _0x5730b5['sendStatus'](_0x4f2a42);}return _0x5730b5[_0x6c8d('0x1a')](_0x4f2a42)[_0x6c8d('0x1b')]();};}function respondWithResult(_0x33079c,_0x485df4){_0x485df4=_0x485df4||0xc8;return function(_0x5ed4e3){if(_0x5ed4e3){return _0x33079c[_0x6c8d('0x1a')](_0x485df4)[_0x6c8d('0x1c')](_0x5ed4e3);}};}function respondWithFilteredResult(_0x3a3239,_0x4defc7){return function(_0x3deb29){if(_0x3deb29){var _0x29b087=typeof _0x4defc7[_0x6c8d('0x1d')]===_0x6c8d('0x1e')&&typeof _0x4defc7[_0x6c8d('0x1f')]==='undefined';var _0x4c4d43=_0x3deb29[_0x6c8d('0x20')];var _0x2ce546=_0x29b087?0x0:_0x4defc7[_0x6c8d('0x1d')];var _0x19b192=_0x29b087?_0x3deb29[_0x6c8d('0x20')]:_0x4defc7[_0x6c8d('0x1d')]+_0x4defc7['limit'];var _0x317a1f;if(_0x19b192>=_0x4c4d43){_0x19b192=_0x4c4d43;_0x317a1f=0xc8;}else{_0x317a1f=0xce;}_0x3a3239[_0x6c8d('0x1a')](_0x317a1f);return _0x3a3239['set'](_0x6c8d('0x21'),_0x2ce546+'-'+_0x19b192+'/'+_0x4c4d43)[_0x6c8d('0x1c')](_0x3deb29);}return null;};}function patchUpdates(_0x255afa){return function(_0x2606e9){try{jsonpatch[_0x6c8d('0x22')](_0x2606e9,_0x255afa,!![]);}catch(_0x58ef73){return BPromise['reject'](_0x58ef73);}return _0x2606e9['save']();};}function saveUpdates(_0xaf8c0f,_0x4e48c0){return function(_0x37830c){if(_0x37830c){return _0x37830c[_0x6c8d('0x23')](_0xaf8c0f)[_0x6c8d('0x24')](function(_0x5ab53b){return _0x5ab53b;});}return null;};}function removeEntity(_0x5e81d3,_0x144d1f){return function(_0x636df3){if(_0x636df3){return _0x636df3[_0x6c8d('0x25')]()[_0x6c8d('0x24')](function(){_0x5e81d3[_0x6c8d('0x1a')](0xcc)[_0x6c8d('0x1b')]();});}};}function handleEntityNotFound(_0x36b403,_0x15c227){return function(_0x4a3cd4){if(!_0x4a3cd4){_0x36b403[_0x6c8d('0x26')](0x194);}return _0x4a3cd4;};}function handleError(_0x101e83,_0x360822){_0x360822=_0x360822||0x1f4;return function(_0x58faa8){logger['error'](_0x58faa8[_0x6c8d('0x27')]);if(_0x58faa8[_0x6c8d('0x28')]){delete _0x58faa8[_0x6c8d('0x28')];}_0x101e83['status'](_0x360822)['send'](_0x58faa8);};}exports['index']=function(_0x245228,_0x5a294e){var _0x5b5913={},_0x26d48e={},_0x1f9429={'count':0x0,'rows':[]};var _0x292cb1=_[_0x6c8d('0x29')](db[_0x6c8d('0x2a')][_0x6c8d('0x2b')],function(_0x559191){return{'name':_0x559191[_0x6c8d('0x2c')],'type':_0x559191[_0x6c8d('0x2d')][_0x6c8d('0x2e')]};});_0x26d48e['model']=_[_0x6c8d('0x29')](_0x292cb1,_0x6c8d('0x28'));_0x26d48e['query']=_['keys'](_0x245228[_0x6c8d('0x2f')]);_0x26d48e[_0x6c8d('0x30')]=_[_0x6c8d('0x31')](_0x26d48e['model'],_0x26d48e[_0x6c8d('0x2f')]);_0x5b5913[_0x6c8d('0x32')]=_[_0x6c8d('0x31')](_0x26d48e['model'],qs['fields'](_0x245228['query'][_0x6c8d('0x33')]));_0x5b5913['attributes']=_0x5b5913[_0x6c8d('0x32')][_0x6c8d('0x34')]?_0x5b5913[_0x6c8d('0x32')]:_0x26d48e['model'];if(!_0x245228[_0x6c8d('0x2f')][_0x6c8d('0x35')](_0x6c8d('0x36'))){_0x5b5913[_0x6c8d('0x1f')]=qs[_0x6c8d('0x1f')](_0x245228[_0x6c8d('0x2f')][_0x6c8d('0x1f')]);_0x5b5913[_0x6c8d('0x1d')]=qs[_0x6c8d('0x1d')](_0x245228[_0x6c8d('0x2f')][_0x6c8d('0x1d')]);}_0x5b5913['order']=qs[_0x6c8d('0x37')](_0x245228[_0x6c8d('0x2f')][_0x6c8d('0x37')]);_0x5b5913[_0x6c8d('0x38')]=qs[_0x6c8d('0x30')](_['pick'](_0x245228[_0x6c8d('0x2f')],_0x26d48e[_0x6c8d('0x30')]),_0x292cb1);if(_0x245228[_0x6c8d('0x2f')][_0x6c8d('0x39')]){_0x5b5913['where']=_[_0x6c8d('0x3a')](_0x5b5913[_0x6c8d('0x38')],{'$or':_[_0x6c8d('0x29')](_0x292cb1,function(_0xdcf4e1){if(_0xdcf4e1[_0x6c8d('0x2d')]!=='VIRTUAL'){var _0x34f7bc={};_0x34f7bc[_0xdcf4e1[_0x6c8d('0x28')]]={'$like':'%'+_0x245228[_0x6c8d('0x2f')][_0x6c8d('0x39')]+'%'};return _0x34f7bc;}})});}_0x5b5913=_[_0x6c8d('0x3a')]({},_0x5b5913,_0x245228['options']);var _0x4518a0={'where':_0x5b5913[_0x6c8d('0x38')]};return db[_0x6c8d('0x2a')][_0x6c8d('0x20')](_0x4518a0)[_0x6c8d('0x24')](function(_0x554004){_0x1f9429[_0x6c8d('0x20')]=_0x554004;if(_0x245228[_0x6c8d('0x2f')][_0x6c8d('0x3b')]){_0x5b5913[_0x6c8d('0x3c')]=[{'all':!![]}];}return db[_0x6c8d('0x2a')]['findAll'](_0x5b5913);})[_0x6c8d('0x24')](function(_0x4e7c7d){_0x1f9429[_0x6c8d('0x3d')]=_0x4e7c7d;return _0x1f9429;})['then'](respondWithFilteredResult(_0x5a294e,_0x5b5913))[_0x6c8d('0x3e')](handleError(_0x5a294e,null));};exports[_0x6c8d('0x3f')]=function(_0x4902c2,_0x13a9a4){var _0x24a9ac={'raw':!![],'where':{'id':_0x4902c2[_0x6c8d('0x40')]['id']}},_0x4b31dc={};_0x4b31dc[_0x6c8d('0x41')]=_['keys'](db[_0x6c8d('0x2a')][_0x6c8d('0x2b')]);_0x4b31dc[_0x6c8d('0x2f')]=_[_0x6c8d('0x42')](_0x4902c2[_0x6c8d('0x2f')]);_0x4b31dc[_0x6c8d('0x30')]=_['intersection'](_0x4b31dc['model'],_0x4b31dc[_0x6c8d('0x2f')]);_0x24a9ac[_0x6c8d('0x32')]=_[_0x6c8d('0x31')](_0x4b31dc['model'],qs['fields'](_0x4902c2[_0x6c8d('0x2f')][_0x6c8d('0x33')]));_0x24a9ac[_0x6c8d('0x32')]=_0x24a9ac[_0x6c8d('0x32')][_0x6c8d('0x34')]?_0x24a9ac[_0x6c8d('0x32')]:_0x4b31dc[_0x6c8d('0x41')];if(_0x4902c2['query'][_0x6c8d('0x3b')]){_0x24a9ac['include']=[{'all':!![]}];}_0x24a9ac=_[_0x6c8d('0x3a')]({},_0x24a9ac,_0x4902c2[_0x6c8d('0x43')]);return db[_0x6c8d('0x2a')][_0x6c8d('0x44')](_0x24a9ac)['then'](handleEntityNotFound(_0x13a9a4,null))[_0x6c8d('0x24')](respondWithResult(_0x13a9a4,null))['catch'](handleError(_0x13a9a4,null));};exports[_0x6c8d('0x45')]=function(_0x12b418,_0x24e2ab){return db[_0x6c8d('0x2a')][_0x6c8d('0x45')](_0x12b418['body'],{})['then'](respondWithResult(_0x24e2ab,0xc9))['catch'](handleError(_0x24e2ab,null));};exports[_0x6c8d('0x23')]=function(_0x18b727,_0x3b7d1f){if(_0x18b727[_0x6c8d('0x46')]['id']){delete _0x18b727[_0x6c8d('0x46')]['id'];}return db['SquareRecording'][_0x6c8d('0x44')]({'where':{'id':_0x18b727[_0x6c8d('0x40')]['id']}})['then'](handleEntityNotFound(_0x3b7d1f,null))[_0x6c8d('0x24')](saveUpdates(_0x18b727['body'],null))[_0x6c8d('0x24')](respondWithResult(_0x3b7d1f,null))['catch'](handleError(_0x3b7d1f,null));};exports['download']=function(_0x1fc8ee,_0x1d9fa5,_0x13d904){var _0x452046=require('../../components/encryptor');var _0x358846=![];var _0xb4e396={};if(_0x1fc8ee['query'][_0x6c8d('0x2d')]&&_0x1fc8ee[_0x6c8d('0x2f')][_0x6c8d('0x2d')]==='uniqueid'){_0xb4e396[_0x6c8d('0x47')]=_0x1fc8ee['params']['id'];}else{_0xb4e396['id']=_0x1fc8ee[_0x6c8d('0x40')]['id'];}return db[_0x6c8d('0x2a')]['find']({'where':_0xb4e396,'attributes':['id',_0x6c8d('0x48'),_0x6c8d('0x49')],'raw':!![]})[_0x6c8d('0x24')](handleEntityNotFound(_0x1d9fa5,null))[_0x6c8d('0x24')](function(_0x25b66a){if(_0x25b66a){var _0x55d7ce=_0x25b66a[_0x6c8d('0x48')];var _0x399bec=util[_0x6c8d('0x4a')](_0x6c8d('0x4b'),_0x55d7ce);if(fs['existsSync'](_0x399bec)){_0x358846=!![];return _0x452046[_0x6c8d('0x4c')](_0x399bec,_0x55d7ce,config[_0x6c8d('0x4d')][_0x6c8d('0x4e')])[_0x6c8d('0x24')](function(){return _0x25b66a;});}return _0x25b66a;}})[_0x6c8d('0x24')](function(_0x2f4f91){if(_0x2f4f91){var _0x37403e=_0x2f4f91['savePath'];if(!fs[_0x6c8d('0x4f')](_0x37403e)){throw new db[(_0x6c8d('0x50'))][(_0x6c8d('0x51'))](_0x6c8d('0x52'));}if(_0x2f4f91[_0x6c8d('0x49')]){return _0x1d9fa5[_0x6c8d('0x53')](_0x37403e,_0x2f4f91['filename']+path[_0x6c8d('0x54')](_0x37403e),function(){if(_0x358846){fs[_0x6c8d('0x55')](_0x37403e);}});}else{return _0x1d9fa5[_0x6c8d('0x53')](_0x37403e,function(_0x1dcf28){if(_0x358846){fs[_0x6c8d('0x55')](_0x37403e);}});}}})[_0x6c8d('0x3e')](function(_0x1217b0){if(_0x1217b0[_0x6c8d('0x56')]===_0x6c8d('0x52')){_0x1d9fa5[_0x6c8d('0x1a')](0x194)[_0x6c8d('0x57')](_0x6c8d('0x58'));}else{return handleError(_0x1d9fa5,null);}});};exports['destroy']=function(_0x5245c3,_0x4cdbc4){return db[_0x6c8d('0x2a')]['find']({'where':{'id':_0x5245c3[_0x6c8d('0x40')]['id']}})[_0x6c8d('0x24')](function(_0x9b4bfd){if(_[_0x6c8d('0x59')](_0x9b4bfd)){throw new ReferenceError(_0x6c8d('0x5a'));}return _0x9b4bfd;})['then'](function(_0x1c8f8c){var _0x5cff97=_0x1c8f8c[_0x6c8d('0x48')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x5cff97);if(!_[_0x6c8d('0x59')](_0x1c8f8c[_0x6c8d('0x48')])&&fs[_0x6c8d('0x4f')](_0x5cff97)){logger[_0x6c8d('0x5b')](_0x6c8d('0x5c')+_0x5cff97+_0x6c8d('0x5d'));fs[_0x6c8d('0x5e')](_0x5cff97);}_0x5cff97=_0x5cff97+_0x6c8d('0x5f');if(!_[_0x6c8d('0x59')](_0x1c8f8c[_0x6c8d('0x48')])&&fs['existsSync'](_0x5cff97)){logger[_0x6c8d('0x5b')](_0x6c8d('0x5c')+_0x5cff97+_0x6c8d('0x5d'));fs['unlinkSync'](_0x5cff97);}return _0x1c8f8c;})[_0x6c8d('0x24')](function(_0x176302){if(!_0x176302)throw new InternalError();return _0x176302[_0x6c8d('0x25')]();})['then'](function(){_0x4cdbc4['status'](0xcc)[_0x6c8d('0x1b')]();})[_0x6c8d('0x3e')](handleError(_0x4cdbc4,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index f5b036b..6fb0a29 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 _0xdeb3=['./squareRecording.attributes','define','square_recordings','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3c6741,_0x24c6f0){var _0x5d3310=function(_0x504ffb){while(--_0x504ffb){_0x3c6741['push'](_0x3c6741['shift']());}};_0x5d3310(++_0x24c6f0);}(_0xdeb3,0xb7));var _0x3deb=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xdeb3[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x3deb('0x0'));var logger=require(_0x3deb('0x1'))(_0x3deb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3deb('0x3'));var fs=require('fs');var path=require(_0x3deb('0x4'));var rimraf=require(_0x3deb('0x5'));var config=require(_0x3deb('0x6'));var attributes=require(_0x3deb('0x7'));module['exports']=function(_0x193700,_0x47d2d4){return _0x193700[_0x3deb('0x8')]('SquareRecording',attributes,{'tableName':_0x3deb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6302=['./squareRecording.attributes','exports','define','SquareRecording','square_recordings','util','../../config/logger','api','moment','path'];(function(_0xf23dc0,_0x517564){var _0x43eb40=function(_0x1b800f){while(--_0x1b800f){_0xf23dc0['push'](_0xf23dc0['shift']());}};_0x43eb40(++_0x517564);}(_0x6302,0x109));var _0x2630=function(_0x2859d0,_0xc4822e){_0x2859d0=_0x2859d0-0x0;var _0x58415=_0x6302[_0x2859d0];return _0x58415;};'use strict';var _=require('lodash');var util=require(_0x2630('0x0'));var logger=require(_0x2630('0x1'))(_0x2630('0x2'));var moment=require(_0x2630('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2630('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2630('0x5'));module[_0x2630('0x6')]=function(_0x434d82,_0x1a9f2b){return _0x434d82[_0x2630('0x7')](_0x2630('0x8'),attributes,{'tableName':_0x2630('0x9'),'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 44da5d1..476cc34 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 _0x8d76=['message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x31619f,_0x3f3df6){var _0x252118=function(_0x5b952b){while(--_0x5b952b){_0x31619f['push'](_0x31619f['shift']());}};_0x252118(++_0x3f3df6);}(_0x8d76,0x86));var _0x68d7=function(_0x39f6d3,_0x1e2317){_0x39f6d3=_0x39f6d3-0x0;var _0xd9dafd=_0x8d76[_0x39f6d3];return _0xd9dafd;};'use strict';var _=require(_0x68d7('0x0'));var util=require('util');var moment=require(_0x68d7('0x1'));var BPromise=require(_0x68d7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x68d7('0x3'));var db=require(_0x68d7('0x4'))['db'];var utils=require(_0x68d7('0x5'));var logger=require(_0x68d7('0x6'))(_0x68d7('0x7'));var config=require(_0x68d7('0x8'));var jayson=require(_0x68d7('0x9'));var client=jayson[_0x68d7('0xa')][_0x68d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e36f7,_0x483d55,_0x256050){return new BPromise(function(_0x14b8d8,_0x361a61){return client[_0x68d7('0xc')](_0x5e36f7,_0x256050)[_0x68d7('0xd')](function(_0x20d986){logger[_0x68d7('0xe')](_0x68d7('0xf'),_0x483d55,_0x68d7('0x10'));logger[_0x68d7('0x11')](_0x68d7('0x12'),_0x483d55,_0x68d7('0x10'),JSON['stringify'](_0x20d986));if(_0x20d986[_0x68d7('0x13')]){if(_0x20d986[_0x68d7('0x13')][_0x68d7('0x14')]===0x1f4){logger[_0x68d7('0x13')]('SquareRecording,\x20%s,\x20%s',_0x483d55,_0x20d986[_0x68d7('0x13')][_0x68d7('0x15')]);return _0x361a61(_0x20d986[_0x68d7('0x13')][_0x68d7('0x15')]);}logger[_0x68d7('0x13')](_0x68d7('0xf'),_0x483d55,_0x20d986[_0x68d7('0x13')][_0x68d7('0x15')]);return _0x14b8d8(_0x20d986[_0x68d7('0x13')][_0x68d7('0x15')]);}else{logger[_0x68d7('0xe')]('SquareRecording,\x20%s,\x20%s',_0x483d55,'request\x20sent');_0x14b8d8(_0x20d986[_0x68d7('0x16')]['message']);}})[_0x68d7('0x17')](function(_0x196f9a){logger[_0x68d7('0x13')](_0x68d7('0xf'),_0x483d55,_0x196f9a);_0x361a61(_0x196f9a);});});}exports[_0x68d7('0x18')]=function(_0x44cca2){var _0x4c81b9=this;return new Promise(function(_0x28517c,_0x20dd97){return db[_0x68d7('0x19')][_0x68d7('0x1a')](_0x44cca2[_0x68d7('0x1b')],{'raw':_0x44cca2[_0x68d7('0x1c')]?_0x44cca2[_0x68d7('0x1c')][_0x68d7('0x1d')]===undefined?!![]:![]:!![]})[_0x68d7('0xd')](function(_0x17ad00){logger['info'](_0x68d7('0x18'),_0x44cca2);logger[_0x68d7('0x11')]('CreateSquareRecording',_0x44cca2,JSON[_0x68d7('0x1e')](_0x17ad00));_0x28517c(_0x17ad00);})['catch'](function(_0x2374c6){logger[_0x68d7('0x13')](_0x68d7('0x18'),_0x2374c6[_0x68d7('0x15')],_0x44cca2);_0x20dd97(_0x4c81b9[_0x68d7('0x13')](0x1f4,_0x2374c6[_0x68d7('0x15')]));});});}; \ No newline at end of file +var _0xdb80=['error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','debug','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','client','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2422b6,_0x5ae000){var _0x5abc90=function(_0x56cedb){while(--_0x56cedb){_0x2422b6['push'](_0x2422b6['shift']());}};_0x5abc90(++_0x5ae000);}(_0xdb80,0x183));var _0x0db8=function(_0x8503e0,_0x38132a){_0x8503e0=_0x8503e0-0x0;var _0x433237=_0xdb80[_0x8503e0];return _0x433237;};'use strict';var _=require(_0x0db8('0x0'));var util=require(_0x0db8('0x1'));var moment=require(_0x0db8('0x2'));var BPromise=require(_0x0db8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0db8('0x4'));var logger=require(_0x0db8('0x5'))('rpc');var config=require(_0x0db8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0db8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3554f2,_0x316635,_0x57d85b){return new BPromise(function(_0x3c6374,_0x2dc68e){return client['request'](_0x3554f2,_0x57d85b)[_0x0db8('0x8')](function(_0x3cf721){logger[_0x0db8('0x9')](_0x0db8('0xa'),_0x316635,_0x0db8('0xb'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x316635,'request\x20sent',JSON[_0x0db8('0xc')](_0x3cf721));if(_0x3cf721[_0x0db8('0xd')]){if(_0x3cf721[_0x0db8('0xd')][_0x0db8('0xe')]===0x1f4){logger[_0x0db8('0xd')]('SquareRecording,\x20%s,\x20%s',_0x316635,_0x3cf721[_0x0db8('0xd')]['message']);return _0x2dc68e(_0x3cf721[_0x0db8('0xd')][_0x0db8('0xf')]);}logger[_0x0db8('0xd')](_0x0db8('0xa'),_0x316635,_0x3cf721[_0x0db8('0xd')][_0x0db8('0xf')]);return _0x3c6374(_0x3cf721['error'][_0x0db8('0xf')]);}else{logger[_0x0db8('0x9')](_0x0db8('0xa'),_0x316635,_0x0db8('0xb'));_0x3c6374(_0x3cf721[_0x0db8('0x10')]['message']);}})[_0x0db8('0x11')](function(_0x238126){logger[_0x0db8('0xd')]('SquareRecording,\x20%s,\x20%s',_0x316635,_0x238126);_0x2dc68e(_0x238126);});});}exports[_0x0db8('0x12')]=function(_0x3b84b3){var _0x5bc794=this;return new Promise(function(_0x463484,_0x5fec36){return db[_0x0db8('0x13')][_0x0db8('0x14')](_0x3b84b3[_0x0db8('0x15')],{'raw':_0x3b84b3['options']?_0x3b84b3[_0x0db8('0x16')][_0x0db8('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x169a01){logger[_0x0db8('0x9')](_0x0db8('0x12'),_0x3b84b3);logger[_0x0db8('0x18')](_0x0db8('0x12'),_0x3b84b3,JSON[_0x0db8('0xc')](_0x169a01));_0x463484(_0x169a01);})['catch'](function(_0x19e9e6){logger['error'](_0x0db8('0x12'),_0x19e9e6[_0x0db8('0xf')],_0x3b84b3);_0x5fec36(_0x5bc794[_0x0db8('0xd')](0x1f4,_0x19e9e6[_0x0db8('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 7f943b2..e4c7ef6 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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x1e6651,_0x4366fc){var _0x656bab=function(_0x327688){while(--_0x327688){_0x1e6651['push'](_0x1e6651['shift']());}};_0x656bab(++_0x4366fc);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +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(_0x37d36f,_0x736947){var _0x285016=function(_0x1f6870){while(--_0x1f6870){_0x37d36f['push'](_0x37d36f['shift']());}};_0x285016(++_0x736947);}(_0xe706,0xa3));var _0x6e70=function(_0x4c9c5b,_0x210cbb){_0x4c9c5b=_0x4c9c5b-0x0;var _0x4088ab=_0xe706[_0x4c9c5b];return _0x4088ab;};'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 25febba..4a1af69 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 _0xc5b2=['sequelize','exports','STRING','DATE'];(function(_0x50f230,_0x56036d){var _0x45d4b9=function(_0x12f4b7){while(--_0x12f4b7){_0x50f230['push'](_0x50f230['shift']());}};_0x45d4b9(++_0x56036d);}(_0xc5b2,0x170));var _0x2c5b=function(_0x1a2859,_0x5b49b6){_0x1a2859=_0x1a2859-0x0;var _0x1702d9=_0xc5b2[_0x1a2859];return _0x1702d9;};'use strict';var Sequelize=require(_0x2c5b('0x0'));module[_0x2c5b('0x1')]={'network':{'type':Sequelize[_0x2c5b('0x2')]},'network_script':{'type':Sequelize[_0x2c5b('0x2')]},'request':{'type':Sequelize[_0x2c5b('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2c5b('0x2')]},'type':{'type':Sequelize[_0x2c5b('0x2')]},'uniqueid':{'type':Sequelize[_0x2c5b('0x2')]},'version':{'type':Sequelize[_0x2c5b('0x2')]},'callerid':{'type':Sequelize[_0x2c5b('0x2')]},'calleridname':{'type':Sequelize[_0x2c5b('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x2c5b('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x2c5b('0x2')]},'dnid':{'type':Sequelize[_0x2c5b('0x2')]},'rdnis':{'type':Sequelize[_0x2c5b('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x2c5b('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x2c5b('0x2')]},'accountcode':{'type':Sequelize[_0x2c5b('0x2')]},'threadid':{'type':Sequelize[_0x2c5b('0x2')]},'project_name':{'type':Sequelize[_0x2c5b('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x2c5b('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb77b=['DATE','STRING'];(function(_0x478359,_0xf54c28){var _0x3f7c64=function(_0x102c9b){while(--_0x102c9b){_0x478359['push'](_0x478359['shift']());}};_0x3f7c64(++_0xf54c28);}(_0xb77b,0xcd));var _0xbb77=function(_0x1fcbcb,_0x32b35b){_0x1fcbcb=_0x1fcbcb-0x0;var _0x53eb9b=_0xb77b[_0x1fcbcb];return _0x53eb9b;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xbb77('0x0')]},'request':{'type':Sequelize[_0xbb77('0x0')]},'channel':{'type':Sequelize[_0xbb77('0x0')]},'language':{'type':Sequelize[_0xbb77('0x0')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xbb77('0x0')]},'version':{'type':Sequelize[_0xbb77('0x0')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbb77('0x0')]},'callingpres':{'type':Sequelize[_0xbb77('0x0')]},'callingani2':{'type':Sequelize[_0xbb77('0x0')]},'callington':{'type':Sequelize[_0xbb77('0x0')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xbb77('0x0')]},'rdnis':{'type':Sequelize[_0xbb77('0x0')]},'context':{'type':Sequelize[_0xbb77('0x0')]},'extension':{'type':Sequelize[_0xbb77('0x0')]},'priority':{'type':Sequelize[_0xbb77('0x0')]},'enhanced':{'type':Sequelize[_0xbb77('0x0')]},'accountcode':{'type':Sequelize[_0xbb77('0x0')]},'threadid':{'type':Sequelize[_0xbb77('0x0')]},'project_name':{'type':Sequelize[_0xbb77('0x0')]},'joinAt':{'type':Sequelize[_0xbb77('0x1')]},'leaveAt':{'type':Sequelize[_0xbb77('0x1')]},'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 9870344..bfa1f34 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 _0x034c=['intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','params','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','reject','save','then','destroy','stack','name','send','map','SquareReport','rawAttributes','type','model','query','keys','filters'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x034c,0xa9));var _0xc034=function(_0x2d7654,_0x485742){_0x2d7654=_0x2d7654-0x0;var _0x13fa44=_0x034c[_0x2d7654];return _0x13fa44;};'use strict';var emlformat=require(_0xc034('0x0'));var rimraf=require(_0xc034('0x1'));var zipdir=require(_0xc034('0x2'));var jsonpatch=require(_0xc034('0x3'));var rp=require(_0xc034('0x4'));var moment=require(_0xc034('0x5'));var BPromise=require(_0xc034('0x6'));var Mustache=require('mustache');var util=require(_0xc034('0x7'));var path=require(_0xc034('0x8'));var sox=require(_0xc034('0x9'));var csv=require(_0xc034('0xa'));var ejs=require(_0xc034('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc034('0xc'));var squel=require(_0xc034('0xd'));var crypto=require(_0xc034('0xe'));var jsforce=require(_0xc034('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc034('0xa'));var querystring=require(_0xc034('0x10'));var Papa=require(_0xc034('0x11'));var Redis=require('ioredis');var authService=require(_0xc034('0x12'));var qs=require(_0xc034('0x13'));var as=require(_0xc034('0x14'));var hardwareService=require(_0xc034('0x15'));var logger=require('../../config/logger')(_0xc034('0x16'));var utils=require(_0xc034('0x17'));var config=require(_0xc034('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc034('0x19'))['db'];function respondWithStatusCode(_0xa7f737,_0x15053f){_0x15053f=_0x15053f||0xcc;return function(_0x5cc594){if(_0x5cc594){return _0xa7f737[_0xc034('0x1a')](_0x15053f);}return _0xa7f737['status'](_0x15053f)[_0xc034('0x1b')]();};}function respondWithResult(_0x58d7a9,_0x4afdb3){_0x4afdb3=_0x4afdb3||0xc8;return function(_0x3cdeed){if(_0x3cdeed){return _0x58d7a9[_0xc034('0x1c')](_0x4afdb3)[_0xc034('0x1d')](_0x3cdeed);}};}function respondWithFilteredResult(_0x33d019,_0x4e5db2){return function(_0x350a62){if(_0x350a62){var _0x4ec3c4=typeof _0x4e5db2[_0xc034('0x1e')]==='undefined'&&typeof _0x4e5db2[_0xc034('0x1f')]===_0xc034('0x20');var _0x531f94=_0x350a62[_0xc034('0x21')];var _0x5057a8=_0x4ec3c4?0x0:_0x4e5db2[_0xc034('0x1e')];var _0x717d33=_0x4ec3c4?_0x350a62[_0xc034('0x21')]:_0x4e5db2[_0xc034('0x1e')]+_0x4e5db2['limit'];var _0x3fda25;if(_0x717d33>=_0x531f94){_0x717d33=_0x531f94;_0x3fda25=0xc8;}else{_0x3fda25=0xce;}_0x33d019[_0xc034('0x1c')](_0x3fda25);return _0x33d019[_0xc034('0x22')]('Content-Range',_0x5057a8+'-'+_0x717d33+'/'+_0x531f94)[_0xc034('0x1d')](_0x350a62);}return null;};}function patchUpdates(_0x1cfbb1){return function(_0x55a860){try{jsonpatch['apply'](_0x55a860,_0x1cfbb1,!![]);}catch(_0x290557){return BPromise[_0xc034('0x23')](_0x290557);}return _0x55a860[_0xc034('0x24')]();};}function saveUpdates(_0x3a8f4b,_0x445e25){return function(_0x502371){if(_0x502371){return _0x502371['update'](_0x3a8f4b)[_0xc034('0x25')](function(_0x36f60b){return _0x36f60b;});}return null;};}function removeEntity(_0x5302b3,_0x49d330){return function(_0x1374d1){if(_0x1374d1){return _0x1374d1[_0xc034('0x26')]()[_0xc034('0x25')](function(){_0x5302b3[_0xc034('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a35db,_0x3553ba){return function(_0x964379){if(!_0x964379){_0x2a35db[_0xc034('0x1a')](0x194);}return _0x964379;};}function handleError(_0x17eaa0,_0x1f1fec){_0x1f1fec=_0x1f1fec||0x1f4;return function(_0x1f9fd4){logger['error'](_0x1f9fd4[_0xc034('0x27')]);if(_0x1f9fd4['name']){delete _0x1f9fd4[_0xc034('0x28')];}_0x17eaa0['status'](_0x1f1fec)[_0xc034('0x29')](_0x1f9fd4);};}exports['index']=function(_0x5c4129,_0x2569c7){var _0x53f1b0={},_0x299639={},_0x2f599e={'count':0x0,'rows':[]};var _0x25397d=_[_0xc034('0x2a')](db[_0xc034('0x2b')][_0xc034('0x2c')],function(_0x480ce9){return{'name':_0x480ce9['fieldName'],'type':_0x480ce9[_0xc034('0x2d')]['key']};});_0x299639[_0xc034('0x2e')]=_[_0xc034('0x2a')](_0x25397d,_0xc034('0x28'));_0x299639[_0xc034('0x2f')]=_[_0xc034('0x30')](_0x5c4129[_0xc034('0x2f')]);_0x299639[_0xc034('0x31')]=_[_0xc034('0x32')](_0x299639['model'],_0x299639[_0xc034('0x2f')]);_0x53f1b0[_0xc034('0x33')]=_[_0xc034('0x32')](_0x299639[_0xc034('0x2e')],qs[_0xc034('0x34')](_0x5c4129[_0xc034('0x2f')]['fields']));_0x53f1b0[_0xc034('0x33')]=_0x53f1b0[_0xc034('0x33')][_0xc034('0x35')]?_0x53f1b0[_0xc034('0x33')]:_0x299639[_0xc034('0x2e')];if(!_0x5c4129[_0xc034('0x2f')][_0xc034('0x36')]('nolimit')){_0x53f1b0['limit']=qs['limit'](_0x5c4129[_0xc034('0x2f')]['limit']);_0x53f1b0['offset']=qs[_0xc034('0x1e')](_0x5c4129[_0xc034('0x2f')][_0xc034('0x1e')]);}_0x53f1b0[_0xc034('0x37')]=qs[_0xc034('0x38')](_0x5c4129[_0xc034('0x2f')]['sort']);_0x53f1b0['where']=qs[_0xc034('0x31')](_[_0xc034('0x39')](_0x5c4129[_0xc034('0x2f')],_0x299639[_0xc034('0x31')]),_0x25397d);if(_0x5c4129[_0xc034('0x2f')][_0xc034('0x3a')]){_0x53f1b0[_0xc034('0x3b')]=_[_0xc034('0x3c')](_0x53f1b0[_0xc034('0x3b')],{'$or':_['map'](_0x25397d,function(_0x101bab){if(_0x101bab['type']!==_0xc034('0x3d')){var _0x4a0229={};_0x4a0229[_0x101bab['name']]={'$like':'%'+_0x5c4129[_0xc034('0x2f')][_0xc034('0x3a')]+'%'};return _0x4a0229;}})});}_0x53f1b0=_[_0xc034('0x3c')]({},_0x53f1b0,_0x5c4129['options']);var _0x15b4ad={'where':_0x53f1b0[_0xc034('0x3b')]};return db[_0xc034('0x2b')][_0xc034('0x21')](_0x15b4ad)[_0xc034('0x25')](function(_0x43a080){_0x2f599e['count']=_0x43a080;if(_0x5c4129['query'][_0xc034('0x3e')]){_0x53f1b0[_0xc034('0x3f')]=[{'all':!![]}];}return db[_0xc034('0x2b')][_0xc034('0x40')](_0x53f1b0);})[_0xc034('0x25')](function(_0x4e0d3f){_0x2f599e['rows']=_0x4e0d3f;return _0x2f599e;})['then'](respondWithFilteredResult(_0x2569c7,_0x53f1b0))[_0xc034('0x41')](handleError(_0x2569c7,null));};exports['show']=function(_0x4597ed,_0x537ec0){var _0x3ce722={'raw':!![],'where':{'id':_0x4597ed[_0xc034('0x42')]['id']}},_0x334bac={};_0x334bac['model']=_[_0xc034('0x30')](db[_0xc034('0x2b')][_0xc034('0x2c')]);_0x334bac['query']=_[_0xc034('0x30')](_0x4597ed['query']);_0x334bac[_0xc034('0x31')]=_['intersection'](_0x334bac[_0xc034('0x2e')],_0x334bac[_0xc034('0x2f')]);_0x3ce722[_0xc034('0x33')]=_[_0xc034('0x32')](_0x334bac[_0xc034('0x2e')],qs[_0xc034('0x34')](_0x4597ed['query'][_0xc034('0x34')]));_0x3ce722['attributes']=_0x3ce722[_0xc034('0x33')]['length']?_0x3ce722[_0xc034('0x33')]:_0x334bac[_0xc034('0x2e')];if(_0x4597ed['query'][_0xc034('0x3e')]){_0x3ce722['include']=[{'all':!![]}];}_0x3ce722=_[_0xc034('0x3c')]({},_0x3ce722,_0x4597ed[_0xc034('0x43')]);return db[_0xc034('0x2b')][_0xc034('0x44')](_0x3ce722)[_0xc034('0x25')](handleEntityNotFound(_0x537ec0,null))[_0xc034('0x25')](respondWithResult(_0x537ec0,null))['catch'](handleError(_0x537ec0,null));};exports['create']=function(_0x15de61,_0x1061a3){return db[_0xc034('0x2b')][_0xc034('0x45')](_0x15de61[_0xc034('0x46')],{})['then'](respondWithResult(_0x1061a3,0xc9))[_0xc034('0x41')](handleError(_0x1061a3,null));};exports[_0xc034('0x47')]=function(_0x18ce03,_0x162f43){if(_0x18ce03[_0xc034('0x46')]['id']){delete _0x18ce03[_0xc034('0x46')]['id'];}return db[_0xc034('0x2b')][_0xc034('0x44')]({'where':{'id':_0x18ce03[_0xc034('0x42')]['id']}})[_0xc034('0x25')](handleEntityNotFound(_0x162f43,null))[_0xc034('0x25')](saveUpdates(_0x18ce03[_0xc034('0x46')],null))[_0xc034('0x25')](respondWithResult(_0x162f43,null))['catch'](handleError(_0x162f43,null));};exports[_0xc034('0x26')]=function(_0x2b0e42,_0x27d6fd){return db['SquareReport'][_0xc034('0x44')]({'where':{'id':_0x2b0e42[_0xc034('0x42')]['id']}})[_0xc034('0x25')](handleEntityNotFound(_0x27d6fd,null))[_0xc034('0x25')](removeEntity(_0x27d6fd,null))['catch'](handleError(_0x27d6fd,null));};exports['describe']=function(_0xb0531b,_0x3f024f){return db[_0xc034('0x2b')][_0xc034('0x48')]()[_0xc034('0x25')](respondWithResult(_0x3f024f,null))[_0xc034('0x41')](handleError(_0x3f024f,null));}; \ No newline at end of file +var _0xc39c=['rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','catch','show','params','options','find','create','body','describe','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','SquareReport'];(function(_0x39ce02,_0x2268dd){var _0x1a5ee6=function(_0x11d5c8){while(--_0x11d5c8){_0x39ce02['push'](_0x39ce02['shift']());}};_0x1a5ee6(++_0x2268dd);}(_0xc39c,0xf8));var _0xcc39=function(_0xb05dcd,_0x9e110c){_0xb05dcd=_0xb05dcd-0x0;var _0x36ee80=_0xc39c[_0xb05dcd];return _0x36ee80;};'use strict';var emlformat=require(_0xcc39('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcc39('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcc39('0x2'));var BPromise=require(_0xcc39('0x3'));var Mustache=require('mustache');var util=require(_0xcc39('0x4'));var path=require(_0xcc39('0x5'));var sox=require(_0xcc39('0x6'));var csv=require(_0xcc39('0x7'));var ejs=require(_0xcc39('0x8'));var fs=require('fs');var fs_extra=require(_0xcc39('0x9'));var _=require(_0xcc39('0xa'));var squel=require(_0xcc39('0xb'));var crypto=require(_0xcc39('0xc'));var jsforce=require(_0xcc39('0xd'));var deskjs=require(_0xcc39('0xe'));var toCsv=require(_0xcc39('0x7'));var querystring=require('querystring');var Papa=require(_0xcc39('0xf'));var Redis=require(_0xcc39('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcc39('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc39('0x12'))(_0xcc39('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcc39('0x14'));var db=require(_0xcc39('0x15'))['db'];function respondWithStatusCode(_0x2b51d3,_0x5b7183){_0x5b7183=_0x5b7183||0xcc;return function(_0x5d51cc){if(_0x5d51cc){return _0x2b51d3[_0xcc39('0x16')](_0x5b7183);}return _0x2b51d3['status'](_0x5b7183)[_0xcc39('0x17')]();};}function respondWithResult(_0x6ba59b,_0xed0be4){_0xed0be4=_0xed0be4||0xc8;return function(_0x300476){if(_0x300476){return _0x6ba59b[_0xcc39('0x18')](_0xed0be4)[_0xcc39('0x19')](_0x300476);}};}function respondWithFilteredResult(_0x132f99,_0x469d9b){return function(_0x4451d6){if(_0x4451d6){var _0x194016=typeof _0x469d9b['offset']===_0xcc39('0x1a')&&typeof _0x469d9b[_0xcc39('0x1b')]===_0xcc39('0x1a');var _0x2f1992=_0x4451d6[_0xcc39('0x1c')];var _0x23d2e8=_0x194016?0x0:_0x469d9b[_0xcc39('0x1d')];var _0x316602=_0x194016?_0x4451d6[_0xcc39('0x1c')]:_0x469d9b[_0xcc39('0x1d')]+_0x469d9b[_0xcc39('0x1b')];var _0x238dd9;if(_0x316602>=_0x2f1992){_0x316602=_0x2f1992;_0x238dd9=0xc8;}else{_0x238dd9=0xce;}_0x132f99[_0xcc39('0x18')](_0x238dd9);return _0x132f99[_0xcc39('0x1e')](_0xcc39('0x1f'),_0x23d2e8+'-'+_0x316602+'/'+_0x2f1992)[_0xcc39('0x19')](_0x4451d6);}return null;};}function patchUpdates(_0x1848ea){return function(_0x5827a3){try{jsonpatch[_0xcc39('0x20')](_0x5827a3,_0x1848ea,!![]);}catch(_0x163cd4){return BPromise['reject'](_0x163cd4);}return _0x5827a3[_0xcc39('0x21')]();};}function saveUpdates(_0x2feaef,_0x58cfc0){return function(_0x588480){if(_0x588480){return _0x588480[_0xcc39('0x22')](_0x2feaef)[_0xcc39('0x23')](function(_0x22c774){return _0x22c774;});}return null;};}function removeEntity(_0x2e019c,_0x411146){return function(_0x2b49a4){if(_0x2b49a4){return _0x2b49a4[_0xcc39('0x24')]()['then'](function(){_0x2e019c[_0xcc39('0x18')](0xcc)[_0xcc39('0x17')]();});}};}function handleEntityNotFound(_0x26654f,_0x52823e){return function(_0x2419db){if(!_0x2419db){_0x26654f[_0xcc39('0x16')](0x194);}return _0x2419db;};}function handleError(_0x578dff,_0x510dd9){_0x510dd9=_0x510dd9||0x1f4;return function(_0x11eca5){logger[_0xcc39('0x25')](_0x11eca5[_0xcc39('0x26')]);if(_0x11eca5[_0xcc39('0x27')]){delete _0x11eca5['name'];}_0x578dff[_0xcc39('0x18')](_0x510dd9)[_0xcc39('0x28')](_0x11eca5);};}exports[_0xcc39('0x29')]=function(_0x2ab015,_0x5160b6){var _0xffbdd4={},_0x10667e={},_0x50093e={'count':0x0,'rows':[]};var _0x35b5af=_[_0xcc39('0x2a')](db[_0xcc39('0x2b')][_0xcc39('0x2c')],function(_0xbf41e1){return{'name':_0xbf41e1[_0xcc39('0x2d')],'type':_0xbf41e1[_0xcc39('0x2e')][_0xcc39('0x2f')]};});_0x10667e['model']=_[_0xcc39('0x2a')](_0x35b5af,_0xcc39('0x27'));_0x10667e['query']=_[_0xcc39('0x30')](_0x2ab015[_0xcc39('0x31')]);_0x10667e[_0xcc39('0x32')]=_[_0xcc39('0x33')](_0x10667e['model'],_0x10667e['query']);_0xffbdd4[_0xcc39('0x34')]=_[_0xcc39('0x33')](_0x10667e[_0xcc39('0x35')],qs[_0xcc39('0x36')](_0x2ab015[_0xcc39('0x31')]['fields']));_0xffbdd4[_0xcc39('0x34')]=_0xffbdd4[_0xcc39('0x34')]['length']?_0xffbdd4[_0xcc39('0x34')]:_0x10667e[_0xcc39('0x35')];if(!_0x2ab015[_0xcc39('0x31')]['hasOwnProperty'](_0xcc39('0x37'))){_0xffbdd4['limit']=qs[_0xcc39('0x1b')](_0x2ab015['query'][_0xcc39('0x1b')]);_0xffbdd4[_0xcc39('0x1d')]=qs['offset'](_0x2ab015[_0xcc39('0x31')][_0xcc39('0x1d')]);}_0xffbdd4[_0xcc39('0x38')]=qs[_0xcc39('0x39')](_0x2ab015[_0xcc39('0x31')][_0xcc39('0x39')]);_0xffbdd4['where']=qs[_0xcc39('0x32')](_[_0xcc39('0x3a')](_0x2ab015[_0xcc39('0x31')],_0x10667e[_0xcc39('0x32')]),_0x35b5af);if(_0x2ab015[_0xcc39('0x31')][_0xcc39('0x3b')]){_0xffbdd4[_0xcc39('0x3c')]=_['merge'](_0xffbdd4[_0xcc39('0x3c')],{'$or':_[_0xcc39('0x2a')](_0x35b5af,function(_0x568b1d){if(_0x568b1d[_0xcc39('0x2e')]!=='VIRTUAL'){var _0x50228f={};_0x50228f[_0x568b1d[_0xcc39('0x27')]]={'$like':'%'+_0x2ab015[_0xcc39('0x31')][_0xcc39('0x3b')]+'%'};return _0x50228f;}})});}_0xffbdd4=_[_0xcc39('0x3d')]({},_0xffbdd4,_0x2ab015['options']);var _0x3adbd5={'where':_0xffbdd4[_0xcc39('0x3c')]};return db['SquareReport'][_0xcc39('0x1c')](_0x3adbd5)[_0xcc39('0x23')](function(_0x4f30a9){_0x50093e[_0xcc39('0x1c')]=_0x4f30a9;if(_0x2ab015[_0xcc39('0x31')][_0xcc39('0x3e')]){_0xffbdd4[_0xcc39('0x3f')]=[{'all':!![]}];}return db['SquareReport'][_0xcc39('0x40')](_0xffbdd4);})[_0xcc39('0x23')](function(_0x273c4d){_0x50093e['rows']=_0x273c4d;return _0x50093e;})[_0xcc39('0x23')](respondWithFilteredResult(_0x5160b6,_0xffbdd4))[_0xcc39('0x41')](handleError(_0x5160b6,null));};exports[_0xcc39('0x42')]=function(_0x401da1,_0x37b7b1){var _0x5b9585={'raw':!![],'where':{'id':_0x401da1[_0xcc39('0x43')]['id']}},_0x236e2d={};_0x236e2d[_0xcc39('0x35')]=_[_0xcc39('0x30')](db[_0xcc39('0x2b')][_0xcc39('0x2c')]);_0x236e2d['query']=_[_0xcc39('0x30')](_0x401da1[_0xcc39('0x31')]);_0x236e2d[_0xcc39('0x32')]=_[_0xcc39('0x33')](_0x236e2d[_0xcc39('0x35')],_0x236e2d[_0xcc39('0x31')]);_0x5b9585[_0xcc39('0x34')]=_[_0xcc39('0x33')](_0x236e2d[_0xcc39('0x35')],qs[_0xcc39('0x36')](_0x401da1[_0xcc39('0x31')][_0xcc39('0x36')]));_0x5b9585[_0xcc39('0x34')]=_0x5b9585['attributes']['length']?_0x5b9585['attributes']:_0x236e2d[_0xcc39('0x35')];if(_0x401da1[_0xcc39('0x31')]['includeAll']){_0x5b9585['include']=[{'all':!![]}];}_0x5b9585=_['merge']({},_0x5b9585,_0x401da1[_0xcc39('0x44')]);return db[_0xcc39('0x2b')][_0xcc39('0x45')](_0x5b9585)['then'](handleEntityNotFound(_0x37b7b1,null))[_0xcc39('0x23')](respondWithResult(_0x37b7b1,null))[_0xcc39('0x41')](handleError(_0x37b7b1,null));};exports[_0xcc39('0x46')]=function(_0x54d63e,_0x1dcd1e){return db[_0xcc39('0x2b')][_0xcc39('0x46')](_0x54d63e['body'],{})[_0xcc39('0x23')](respondWithResult(_0x1dcd1e,0xc9))['catch'](handleError(_0x1dcd1e,null));};exports['update']=function(_0x37727e,_0x1e1ec3){if(_0x37727e[_0xcc39('0x47')]['id']){delete _0x37727e[_0xcc39('0x47')]['id'];}return db[_0xcc39('0x2b')]['find']({'where':{'id':_0x37727e[_0xcc39('0x43')]['id']}})[_0xcc39('0x23')](handleEntityNotFound(_0x1e1ec3,null))[_0xcc39('0x23')](saveUpdates(_0x37727e[_0xcc39('0x47')],null))['then'](respondWithResult(_0x1e1ec3,null))[_0xcc39('0x41')](handleError(_0x1e1ec3,null));};exports[_0xcc39('0x24')]=function(_0x1bc2b2,_0x5063d6){return db['SquareReport'][_0xcc39('0x45')]({'where':{'id':_0x1bc2b2[_0xcc39('0x43')]['id']}})['then'](handleEntityNotFound(_0x5063d6,null))[_0xcc39('0x23')](removeEntity(_0x5063d6,null))[_0xcc39('0x41')](handleError(_0x5063d6,null));};exports['describe']=function(_0x4ae411,_0x39ce49){return db[_0xcc39('0x2b')][_0xcc39('0x48')]()[_0xcc39('0x23')](respondWithResult(_0x39ce49,null))['catch'](handleError(_0x39ce49,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 17039a7..551b17a 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 _0x0f10=['SquareReport','uid_pname','project_name','leaveAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','define'];(function(_0x3e9aca,_0x2ce960){var _0x182544=function(_0x4aaa99){while(--_0x4aaa99){_0x3e9aca['push'](_0x3e9aca['shift']());}};_0x182544(++_0x2ce960);}(_0x0f10,0x1b7));var _0x00f1=function(_0x1ac792,_0x4cdb6b){_0x1ac792=_0x1ac792-0x0;var _0xfe92a9=_0x0f10[_0x1ac792];return _0xfe92a9;};'use strict';var _=require(_0x00f1('0x0'));var util=require('util');var logger=require(_0x00f1('0x1'))(_0x00f1('0x2'));var moment=require(_0x00f1('0x3'));var BPromise=require(_0x00f1('0x4'));var rp=require(_0x00f1('0x5'));var fs=require('fs');var path=require(_0x00f1('0x6'));var rimraf=require(_0x00f1('0x7'));var config=require(_0x00f1('0x8'));var attributes=require(_0x00f1('0x9'));module['exports']=function(_0x58c452,_0x1ecc10){return _0x58c452[_0x00f1('0xa')](_0x00f1('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x00f1('0xc'),'fields':['uniqueid',_0x00f1('0xd')]},{'name':'leaveAt','fields':[_0x00f1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6b75=['bluebird','request-promise','path','rimraf','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x6b75,0x14f));var _0x56b7=function(_0x277fa3,_0x3b2dde){_0x277fa3=_0x277fa3-0x0;var _0x2e4520=_0x6b75[_0x277fa3];return _0x2e4520;};'use strict';var _=require(_0x56b7('0x0'));var util=require(_0x56b7('0x1'));var logger=require(_0x56b7('0x2'))(_0x56b7('0x3'));var moment=require(_0x56b7('0x4'));var BPromise=require(_0x56b7('0x5'));var rp=require(_0x56b7('0x6'));var fs=require('fs');var path=require(_0x56b7('0x7'));var rimraf=require(_0x56b7('0x8'));var config=require('../../config/environment');var attributes=require(_0x56b7('0x9'));module[_0x56b7('0xa')]=function(_0x4d24be,_0x547280){return _0x4d24be['define'](_0x56b7('0xb'),attributes,{'tableName':_0x56b7('0xc'),'paranoid':![],'indexes':[{'name':_0x56b7('0xd'),'fields':[_0x56b7('0xe'),_0x56b7('0xf')]},{'name':_0x56b7('0x10'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index b185990..6032d3e 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 _0x0963=['SquareReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateSquareReport','create','body','options','raw','stringify','UpdateSquareReport','update','where','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x0963,0xe4));var _0x3096=function(_0xcfeda9,_0xd418ae){_0xcfeda9=_0xcfeda9-0x0;var _0x4826c7=_0x0963[_0xcfeda9];return _0x4826c7;};'use strict';var _=require('lodash');var util=require(_0x3096('0x0'));var moment=require(_0x3096('0x1'));var BPromise=require('bluebird');var rs=require(_0x3096('0x2'));var fs=require('fs');var Redis=require(_0x3096('0x3'));var db=require(_0x3096('0x4'))['db'];var utils=require(_0x3096('0x5'));var logger=require(_0x3096('0x6'))('rpc');var config=require(_0x3096('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3096('0x8')][_0x3096('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43e562,_0x5041fa,_0x5179a9){return new BPromise(function(_0x151808,_0x483c26){return client[_0x3096('0xa')](_0x43e562,_0x5179a9)[_0x3096('0xb')](function(_0x3b673c){logger['info'](_0x3096('0xc'),_0x5041fa,_0x3096('0xd'));logger[_0x3096('0xe')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x5041fa,_0x3096('0xd'),JSON['stringify'](_0x3b673c));if(_0x3b673c[_0x3096('0xf')]){if(_0x3b673c[_0x3096('0xf')][_0x3096('0x10')]===0x1f4){logger[_0x3096('0xf')]('SquareReport,\x20%s,\x20%s',_0x5041fa,_0x3b673c['error'][_0x3096('0x11')]);return _0x483c26(_0x3b673c[_0x3096('0xf')][_0x3096('0x11')]);}logger[_0x3096('0xf')](_0x3096('0xc'),_0x5041fa,_0x3b673c['error']['message']);return _0x151808(_0x3b673c[_0x3096('0xf')][_0x3096('0x11')]);}else{logger[_0x3096('0x12')](_0x3096('0xc'),_0x5041fa,_0x3096('0xd'));_0x151808(_0x3b673c['result']['message']);}})[_0x3096('0x13')](function(_0x43f616){logger['error']('SquareReport,\x20%s,\x20%s',_0x5041fa,_0x43f616);_0x483c26(_0x43f616);});});}exports[_0x3096('0x14')]=function(_0x470309){var _0x1542e2=this;return new Promise(function(_0x6c8077,_0x54e83d){return db['SquareReport'][_0x3096('0x15')](_0x470309[_0x3096('0x16')],{'raw':_0x470309[_0x3096('0x17')]?_0x470309[_0x3096('0x17')][_0x3096('0x18')]===undefined?!![]:![]:!![]})[_0x3096('0xb')](function(_0x35b0d9){logger['info']('CreateSquareReport',_0x470309);logger['debug'](_0x3096('0x14'),_0x470309,JSON[_0x3096('0x19')](_0x35b0d9));_0x6c8077(_0x35b0d9);})[_0x3096('0x13')](function(_0x547d92){logger[_0x3096('0xf')]('CreateSquareReport',_0x547d92[_0x3096('0x11')],_0x470309);_0x54e83d(_0x1542e2[_0x3096('0xf')](0x1f4,_0x547d92[_0x3096('0x11')]));});});};exports[_0x3096('0x1a')]=function(_0x4cf8e4){var _0x417e10=this;return new Promise(function(_0x23d5c2,_0x390da9){return db['SquareReport'][_0x3096('0x1b')](_0x4cf8e4[_0x3096('0x16')],{'raw':_0x4cf8e4[_0x3096('0x17')]?_0x4cf8e4[_0x3096('0x17')][_0x3096('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cf8e4[_0x3096('0x17')]?_0x4cf8e4[_0x3096('0x17')][_0x3096('0x1c')]||null:null,'attributes':_0x4cf8e4[_0x3096('0x17')]?_0x4cf8e4[_0x3096('0x17')]['attributes']||null:null,'limit':_0x4cf8e4[_0x3096('0x17')]?_0x4cf8e4[_0x3096('0x17')][_0x3096('0x1d')]||null:null})[_0x3096('0xb')](function(_0x4be1c3){logger[_0x3096('0x12')](_0x3096('0x1a'),_0x4cf8e4);logger[_0x3096('0xe')](_0x3096('0x1a'),_0x4cf8e4,JSON['stringify'](_0x4be1c3));_0x23d5c2(_0x4be1c3);})[_0x3096('0x13')](function(_0x3db151){logger['error'](_0x3096('0x1a'),_0x3db151[_0x3096('0x11')],_0x4cf8e4);_0x390da9(_0x417e10[_0x3096('0xf')](0x1f4,_0x3db151[_0x3096('0x11')]));});});}; \ No newline at end of file +var _0x5925=['info','SquareReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CreateSquareReport','SquareReport','create','options','raw','then','catch','UpdateSquareReport','update','where','attributes','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1a04a6,_0x1b9764){var _0xb3f005=function(_0x52c7c9){while(--_0x52c7c9){_0x1a04a6['push'](_0x1a04a6['shift']());}};_0xb3f005(++_0x1b9764);}(_0x5925,0x1a7));var _0x5592=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0x5925[_0x2f4c1c];return _0x25e0f2;};'use strict';var _=require(_0x5592('0x0'));var util=require('util');var moment=require(_0x5592('0x1'));var BPromise=require('bluebird');var rs=require(_0x5592('0x2'));var fs=require('fs');var Redis=require(_0x5592('0x3'));var db=require(_0x5592('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5592('0x5'))(_0x5592('0x6'));var config=require(_0x5592('0x7'));var jayson=require(_0x5592('0x8'));var client=jayson[_0x5592('0x9')][_0x5592('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39bf69,_0xa10bca,_0x31fd7a){return new BPromise(function(_0xf29238,_0x3ee3c9){return client['request'](_0x39bf69,_0x31fd7a)['then'](function(_0x3ddcde){logger[_0x5592('0xb')](_0x5592('0xc'),_0xa10bca,'request\x20sent');logger[_0x5592('0xd')]('SquareReport,\x20%s,\x20%s,\x20%s',_0xa10bca,_0x5592('0xe'),JSON[_0x5592('0xf')](_0x3ddcde));if(_0x3ddcde[_0x5592('0x10')]){if(_0x3ddcde[_0x5592('0x10')][_0x5592('0x11')]===0x1f4){logger[_0x5592('0x10')]('SquareReport,\x20%s,\x20%s',_0xa10bca,_0x3ddcde[_0x5592('0x10')][_0x5592('0x12')]);return _0x3ee3c9(_0x3ddcde['error'][_0x5592('0x12')]);}logger['error'](_0x5592('0xc'),_0xa10bca,_0x3ddcde[_0x5592('0x10')][_0x5592('0x12')]);return _0xf29238(_0x3ddcde[_0x5592('0x10')][_0x5592('0x12')]);}else{logger[_0x5592('0xb')]('SquareReport,\x20%s,\x20%s',_0xa10bca,_0x5592('0xe'));_0xf29238(_0x3ddcde[_0x5592('0x13')][_0x5592('0x12')]);}})['catch'](function(_0x1c92e1){logger[_0x5592('0x10')](_0x5592('0xc'),_0xa10bca,_0x1c92e1);_0x3ee3c9(_0x1c92e1);});});}exports[_0x5592('0x14')]=function(_0x33303c){var _0x578353=this;return new Promise(function(_0x2a9eae,_0x3e7fc1){return db[_0x5592('0x15')][_0x5592('0x16')](_0x33303c['body'],{'raw':_0x33303c['options']?_0x33303c[_0x5592('0x17')][_0x5592('0x18')]===undefined?!![]:![]:!![]})[_0x5592('0x19')](function(_0x1b8156){logger[_0x5592('0xb')](_0x5592('0x14'),_0x33303c);logger[_0x5592('0xd')]('CreateSquareReport',_0x33303c,JSON[_0x5592('0xf')](_0x1b8156));_0x2a9eae(_0x1b8156);})[_0x5592('0x1a')](function(_0x5d96b3){logger[_0x5592('0x10')](_0x5592('0x14'),_0x5d96b3[_0x5592('0x12')],_0x33303c);_0x3e7fc1(_0x578353['error'](0x1f4,_0x5d96b3[_0x5592('0x12')]));});});};exports[_0x5592('0x1b')]=function(_0x32d942){var _0x1bccdf=this;return new Promise(function(_0x178611,_0x307cbf){return db[_0x5592('0x15')][_0x5592('0x1c')](_0x32d942['body'],{'raw':_0x32d942[_0x5592('0x17')]?_0x32d942['options'][_0x5592('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32d942['options']?_0x32d942[_0x5592('0x17')][_0x5592('0x1d')]||null:null,'attributes':_0x32d942[_0x5592('0x17')]?_0x32d942[_0x5592('0x17')][_0x5592('0x1e')]||null:null,'limit':_0x32d942[_0x5592('0x17')]?_0x32d942[_0x5592('0x17')]['limit']||null:null})[_0x5592('0x19')](function(_0x465343){logger[_0x5592('0xb')](_0x5592('0x1b'),_0x32d942);logger['debug']('UpdateSquareReport',_0x32d942,JSON['stringify'](_0x465343));_0x178611(_0x465343);})[_0x5592('0x1a')](function(_0x1c48cf){logger[_0x5592('0x10')](_0x5592('0x1b'),_0x1c48cf[_0x5592('0x12')],_0x32d942);_0x307cbf(_0x1bccdf[_0x5592('0x10')](0x1f4,_0x1c48cf[_0x5592('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 6a8b0a9..81c5e6c 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 _0x241b=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','./squareReportDetail.controller','isAuthenticated','index','get','/:id','show','post','update','destroy'];(function(_0x2dab23,_0x11db5f){var _0x509868=function(_0x3d477f){while(--_0x3d477f){_0x2dab23['push'](_0x2dab23['shift']());}};_0x509868(++_0x11db5f);}(_0x241b,0x1c1));var _0xb241=function(_0x570ef3,_0xde14c8){_0x570ef3=_0x570ef3-0x0;var _0x26ea61=_0x241b[_0x570ef3];return _0x26ea61;};'use strict';var multer=require('multer');var util=require(_0xb241('0x0'));var path=require(_0xb241('0x1'));var timeout=require(_0xb241('0x2'));var express=require(_0xb241('0x3'));var router=express[_0xb241('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb241('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb241('0x6'));router['get']('/',auth[_0xb241('0x7')](),controller[_0xb241('0x8')]);router[_0xb241('0x9')]('/describe',auth[_0xb241('0x7')](),controller['describe']);router['get'](_0xb241('0xa'),auth[_0xb241('0x7')](),controller[_0xb241('0xb')]);router[_0xb241('0xc')]('/',auth[_0xb241('0x7')](),controller['create']);router['put'](_0xb241('0xa'),auth[_0xb241('0x7')](),controller[_0xb241('0xd')]);router['delete'](_0xb241('0xa'),auth['isAuthenticated'](),controller[_0xb241('0xe')]);module[_0xb241('0xf')]=router; \ No newline at end of file +var _0xeef5=['describe','/:id','show','post','put','update','delete','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated'];(function(_0x477c0c,_0x48b400){var _0x37d540=function(_0x2d95e2){while(--_0x2d95e2){_0x477c0c['push'](_0x477c0c['shift']());}};_0x37d540(++_0x48b400);}(_0xeef5,0x15b));var _0x5eef=function(_0x1685b7,_0x161555){_0x1685b7=_0x1685b7-0x0;var _0x3ce987=_0xeef5[_0x1685b7];return _0x3ce987;};'use strict';var multer=require(_0x5eef('0x0'));var util=require('util');var path=require(_0x5eef('0x1'));var timeout=require(_0x5eef('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5eef('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5eef('0x4'));var config=require(_0x5eef('0x5'));var controller=require('./squareReportDetail.controller');router[_0x5eef('0x6')]('/',auth['isAuthenticated'](),controller[_0x5eef('0x7')]);router[_0x5eef('0x6')](_0x5eef('0x8'),auth[_0x5eef('0x9')](),controller[_0x5eef('0xa')]);router[_0x5eef('0x6')](_0x5eef('0xb'),auth[_0x5eef('0x9')](),controller[_0x5eef('0xc')]);router[_0x5eef('0xd')]('/',auth[_0x5eef('0x9')](),controller['create']);router[_0x5eef('0xe')]('/:id',auth[_0x5eef('0x9')](),controller[_0x5eef('0xf')]);router[_0x5eef('0x10')](_0x5eef('0xb'),auth[_0x5eef('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index e4e8190..35cdcce 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 _0xbbde=['exports','STRING','TEXT','sequelize'];(function(_0x535956,_0x411673){var _0x5b21ab=function(_0x428d54){while(--_0x428d54){_0x535956['push'](_0x535956['shift']());}};_0x5b21ab(++_0x411673);}(_0xbbde,0x107));var _0xebbd=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0xbbde[_0x510c60];return _0x49c4aa;};'use strict';var Sequelize=require(_0xebbd('0x0'));module[_0xebbd('0x1')]={'uniqueid':{'type':Sequelize[_0xebbd('0x2')]},'node':{'type':Sequelize[_0xebbd('0x2')]},'application':{'type':Sequelize[_0xebbd('0x2')]},'data':{'type':Sequelize[_0xebbd('0x3')]},'project_name':{'type':Sequelize[_0xebbd('0x2')]},'callerid':{'type':Sequelize[_0xebbd('0x2')]}}; \ No newline at end of file +var _0x4653=['TEXT','sequelize','exports','STRING'];(function(_0x4b2b03,_0xbf34ee){var _0x1bf0ed=function(_0x562785){while(--_0x562785){_0x4b2b03['push'](_0x4b2b03['shift']());}};_0x1bf0ed(++_0xbf34ee);}(_0x4653,0x131));var _0x3465=function(_0x2349e9,_0x5e24a1){_0x2349e9=_0x2349e9-0x0;var _0x458ed1=_0x4653[_0x2349e9];return _0x458ed1;};'use strict';var Sequelize=require(_0x3465('0x0'));module[_0x3465('0x1')]={'uniqueid':{'type':Sequelize[_0x3465('0x2')]},'node':{'type':Sequelize[_0x3465('0x2')]},'application':{'type':Sequelize[_0x3465('0x2')]},'data':{'type':Sequelize[_0x3465('0x3')]},'project_name':{'type':Sequelize[_0x3465('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 8e0f050..946b3df 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 _0x6841=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','json','undefined','limit','offset','count','status','Content-Range','apply','destroy','then','end','error','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','map','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6841,0xd3));var _0x1684=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x6841[_0x4d8ed9];return _0x1e2140;};'use strict';var emlformat=require(_0x1684('0x0'));var rimraf=require(_0x1684('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1684('0x2'));var rp=require(_0x1684('0x3'));var moment=require(_0x1684('0x4'));var BPromise=require(_0x1684('0x5'));var Mustache=require(_0x1684('0x6'));var util=require(_0x1684('0x7'));var path=require(_0x1684('0x8'));var sox=require(_0x1684('0x9'));var csv=require(_0x1684('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1684('0xb'));var _=require(_0x1684('0xc'));var squel=require(_0x1684('0xd'));var crypto=require(_0x1684('0xe'));var jsforce=require(_0x1684('0xf'));var deskjs=require(_0x1684('0x10'));var toCsv=require(_0x1684('0xa'));var querystring=require(_0x1684('0x11'));var Papa=require('papaparse');var Redis=require(_0x1684('0x12'));var authService=require(_0x1684('0x13'));var qs=require(_0x1684('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1684('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x1684('0x16'));var config=require(_0x1684('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a9c1b,_0x4ca1c9){_0x4ca1c9=_0x4ca1c9||0xcc;return function(_0x56666c){if(_0x56666c){return _0x4a9c1b[_0x1684('0x18')](_0x4ca1c9);}return _0x4a9c1b['status'](_0x4ca1c9)['end']();};}function respondWithResult(_0x596820,_0xdc893a){_0xdc893a=_0xdc893a||0xc8;return function(_0x4d6050){if(_0x4d6050){return _0x596820['status'](_0xdc893a)[_0x1684('0x19')](_0x4d6050);}};}function respondWithFilteredResult(_0x492415,_0x2f308e){return function(_0x4f8779){if(_0x4f8779){var _0x52fe92=typeof _0x2f308e['offset']===_0x1684('0x1a')&&typeof _0x2f308e[_0x1684('0x1b')]===_0x1684('0x1a');var _0x4e0358=_0x4f8779['count'];var _0x47dd8e=_0x52fe92?0x0:_0x2f308e[_0x1684('0x1c')];var _0x40e2ba=_0x52fe92?_0x4f8779[_0x1684('0x1d')]:_0x2f308e[_0x1684('0x1c')]+_0x2f308e['limit'];var _0x18cc66;if(_0x40e2ba>=_0x4e0358){_0x40e2ba=_0x4e0358;_0x18cc66=0xc8;}else{_0x18cc66=0xce;}_0x492415[_0x1684('0x1e')](_0x18cc66);return _0x492415['set'](_0x1684('0x1f'),_0x47dd8e+'-'+_0x40e2ba+'/'+_0x4e0358)[_0x1684('0x19')](_0x4f8779);}return null;};}function patchUpdates(_0x34e871){return function(_0x4eb91a){try{jsonpatch[_0x1684('0x20')](_0x4eb91a,_0x34e871,!![]);}catch(_0x1722d9){return BPromise['reject'](_0x1722d9);}return _0x4eb91a['save']();};}function saveUpdates(_0x293bf4,_0x3eb6d6){return function(_0x211fc2){if(_0x211fc2){return _0x211fc2['update'](_0x293bf4)['then'](function(_0x4959a2){return _0x4959a2;});}return null;};}function removeEntity(_0x38eaac,_0x2a25f1){return function(_0x176acf){if(_0x176acf){return _0x176acf[_0x1684('0x21')]()[_0x1684('0x22')](function(){_0x38eaac[_0x1684('0x1e')](0xcc)[_0x1684('0x23')]();});}};}function handleEntityNotFound(_0x14a343,_0xbf6f9d){return function(_0x429cba){if(!_0x429cba){_0x14a343[_0x1684('0x18')](0x194);}return _0x429cba;};}function handleError(_0x327de3,_0x33d0a2){_0x33d0a2=_0x33d0a2||0x1f4;return function(_0x24a38f){logger[_0x1684('0x24')](_0x24a38f[_0x1684('0x25')]);if(_0x24a38f[_0x1684('0x26')]){delete _0x24a38f['name'];}_0x327de3[_0x1684('0x1e')](_0x33d0a2)[_0x1684('0x27')](_0x24a38f);};}exports[_0x1684('0x28')]=function(_0x98f18e,_0xef9e94){var _0x35050d={},_0x578d1a={},_0x166d54={'count':0x0,'rows':[]};var _0x363d75=_['map'](db[_0x1684('0x29')][_0x1684('0x2a')],function(_0x471792){return{'name':_0x471792[_0x1684('0x2b')],'type':_0x471792[_0x1684('0x2c')][_0x1684('0x2d')]};});_0x578d1a[_0x1684('0x2e')]=_['map'](_0x363d75,_0x1684('0x26'));_0x578d1a[_0x1684('0x2f')]=_[_0x1684('0x30')](_0x98f18e[_0x1684('0x2f')]);_0x578d1a[_0x1684('0x31')]=_[_0x1684('0x32')](_0x578d1a[_0x1684('0x2e')],_0x578d1a[_0x1684('0x2f')]);_0x35050d[_0x1684('0x33')]=_[_0x1684('0x32')](_0x578d1a[_0x1684('0x2e')],qs[_0x1684('0x34')](_0x98f18e[_0x1684('0x2f')][_0x1684('0x34')]));_0x35050d[_0x1684('0x33')]=_0x35050d[_0x1684('0x33')][_0x1684('0x35')]?_0x35050d[_0x1684('0x33')]:_0x578d1a[_0x1684('0x2e')];if(!_0x98f18e[_0x1684('0x2f')]['hasOwnProperty']('nolimit')){_0x35050d[_0x1684('0x1b')]=qs[_0x1684('0x1b')](_0x98f18e['query'][_0x1684('0x1b')]);_0x35050d[_0x1684('0x1c')]=qs[_0x1684('0x1c')](_0x98f18e[_0x1684('0x2f')][_0x1684('0x1c')]);}_0x35050d[_0x1684('0x36')]=qs[_0x1684('0x37')](_0x98f18e['query'][_0x1684('0x37')]);_0x35050d['where']=qs[_0x1684('0x31')](_['pick'](_0x98f18e[_0x1684('0x2f')],_0x578d1a[_0x1684('0x31')]),_0x363d75);if(_0x98f18e[_0x1684('0x2f')][_0x1684('0x38')]){_0x35050d[_0x1684('0x39')]=_[_0x1684('0x3a')](_0x35050d[_0x1684('0x39')],{'$or':_[_0x1684('0x3b')](_0x363d75,function(_0x20ca4d){if(_0x20ca4d[_0x1684('0x2c')]!=='VIRTUAL'){var _0x3d6e25={};_0x3d6e25[_0x20ca4d[_0x1684('0x26')]]={'$like':'%'+_0x98f18e[_0x1684('0x2f')][_0x1684('0x38')]+'%'};return _0x3d6e25;}})});}_0x35050d=_['merge']({},_0x35050d,_0x98f18e['options']);var _0x5bad03={'where':_0x35050d['where']};return db[_0x1684('0x29')]['count'](_0x5bad03)['then'](function(_0x461d4e){_0x166d54[_0x1684('0x1d')]=_0x461d4e;if(_0x98f18e['query'][_0x1684('0x3c')]){_0x35050d[_0x1684('0x3d')]=[{'all':!![]}];}return db[_0x1684('0x29')][_0x1684('0x3e')](_0x35050d);})['then'](function(_0x3416c3){_0x166d54[_0x1684('0x3f')]=_0x3416c3;return _0x166d54;})[_0x1684('0x22')](respondWithFilteredResult(_0xef9e94,_0x35050d))[_0x1684('0x40')](handleError(_0xef9e94,null));};exports[_0x1684('0x41')]=function(_0x22d052,_0x1427d6){var _0x2dae6a={'raw':!![],'where':{'id':_0x22d052[_0x1684('0x42')]['id']}},_0x210ea6={};_0x210ea6[_0x1684('0x2e')]=_[_0x1684('0x30')](db[_0x1684('0x29')][_0x1684('0x2a')]);_0x210ea6[_0x1684('0x2f')]=_[_0x1684('0x30')](_0x22d052[_0x1684('0x2f')]);_0x210ea6[_0x1684('0x31')]=_[_0x1684('0x32')](_0x210ea6[_0x1684('0x2e')],_0x210ea6[_0x1684('0x2f')]);_0x2dae6a[_0x1684('0x33')]=_[_0x1684('0x32')](_0x210ea6[_0x1684('0x2e')],qs[_0x1684('0x34')](_0x22d052[_0x1684('0x2f')][_0x1684('0x34')]));_0x2dae6a[_0x1684('0x33')]=_0x2dae6a[_0x1684('0x33')][_0x1684('0x35')]?_0x2dae6a['attributes']:_0x210ea6[_0x1684('0x2e')];if(_0x22d052[_0x1684('0x2f')][_0x1684('0x3c')]){_0x2dae6a['include']=[{'all':!![]}];}_0x2dae6a=_['merge']({},_0x2dae6a,_0x22d052[_0x1684('0x43')]);return db[_0x1684('0x29')][_0x1684('0x44')](_0x2dae6a)[_0x1684('0x22')](handleEntityNotFound(_0x1427d6,null))[_0x1684('0x22')](respondWithResult(_0x1427d6,null))['catch'](handleError(_0x1427d6,null));};exports[_0x1684('0x45')]=function(_0xa771f4,_0x6a9e64){return db[_0x1684('0x29')][_0x1684('0x45')](_0xa771f4[_0x1684('0x46')],{})[_0x1684('0x22')](respondWithResult(_0x6a9e64,0xc9))[_0x1684('0x40')](handleError(_0x6a9e64,null));};exports['update']=function(_0x14470f,_0x3249cf){if(_0x14470f[_0x1684('0x46')]['id']){delete _0x14470f['body']['id'];}return db[_0x1684('0x29')][_0x1684('0x44')]({'where':{'id':_0x14470f[_0x1684('0x42')]['id']}})[_0x1684('0x22')](handleEntityNotFound(_0x3249cf,null))[_0x1684('0x22')](saveUpdates(_0x14470f[_0x1684('0x46')],null))['then'](respondWithResult(_0x3249cf,null))[_0x1684('0x40')](handleError(_0x3249cf,null));};exports[_0x1684('0x21')]=function(_0x5d649c,_0x206e21){return db[_0x1684('0x29')][_0x1684('0x44')]({'where':{'id':_0x5d649c[_0x1684('0x42')]['id']}})['then'](handleEntityNotFound(_0x206e21,null))[_0x1684('0x22')](removeEntity(_0x206e21,null))[_0x1684('0x40')](handleError(_0x206e21,null));};exports['describe']=function(_0xb13551,_0x209dab){return db[_0x1684('0x29')]['describe']()[_0x1684('0x22')](respondWithResult(_0x209dab,null))['catch'](handleError(_0x209dab,null));}; \ No newline at end of file +var _0x7f60=['mustache','path','sox','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','rows','show','params','fields','includeAll','include','find','catch','create','body','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x21f19a,_0x12adef){var _0x14edb2=function(_0x2156f4){while(--_0x2156f4){_0x21f19a['push'](_0x21f19a['shift']());}};_0x14edb2(++_0x12adef);}(_0x7f60,0x8c));var _0x07f6=function(_0x41ad70,_0x31ee22){_0x41ad70=_0x41ad70-0x0;var _0x1d8ab5=_0x7f60[_0x41ad70];return _0x1d8ab5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x07f6('0x0'));var zipdir=require(_0x07f6('0x1'));var jsonpatch=require(_0x07f6('0x2'));var rp=require('request-promise');var moment=require(_0x07f6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x07f6('0x4'));var util=require('util');var path=require(_0x07f6('0x5'));var sox=require(_0x07f6('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x07f6('0x7'));var _=require('lodash');var squel=require(_0x07f6('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x07f6('0x9'));var toCsv=require('to-csv');var querystring=require(_0x07f6('0xa'));var Papa=require(_0x07f6('0xb'));var Redis=require(_0x07f6('0xc'));var authService=require(_0x07f6('0xd'));var qs=require(_0x07f6('0xe'));var as=require(_0x07f6('0xf'));var hardwareService=require(_0x07f6('0x10'));var logger=require('../../config/logger')(_0x07f6('0x11'));var utils=require(_0x07f6('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x07f6('0x13'));var db=require(_0x07f6('0x14'))['db'];function respondWithStatusCode(_0x164cf4,_0x30dc2a){_0x30dc2a=_0x30dc2a||0xcc;return function(_0x17a1d0){if(_0x17a1d0){return _0x164cf4['sendStatus'](_0x30dc2a);}return _0x164cf4[_0x07f6('0x15')](_0x30dc2a)['end']();};}function respondWithResult(_0x497fb6,_0x21de6a){_0x21de6a=_0x21de6a||0xc8;return function(_0x2cdcef){if(_0x2cdcef){return _0x497fb6['status'](_0x21de6a)[_0x07f6('0x16')](_0x2cdcef);}};}function respondWithFilteredResult(_0x303baa,_0x476881){return function(_0x5a0bfb){if(_0x5a0bfb){var _0x3900d5=typeof _0x476881[_0x07f6('0x17')]===_0x07f6('0x18')&&typeof _0x476881['limit']===_0x07f6('0x18');var _0x883acf=_0x5a0bfb[_0x07f6('0x19')];var _0x28d3b3=_0x3900d5?0x0:_0x476881['offset'];var _0x9ceb75=_0x3900d5?_0x5a0bfb[_0x07f6('0x19')]:_0x476881['offset']+_0x476881[_0x07f6('0x1a')];var _0x22eede;if(_0x9ceb75>=_0x883acf){_0x9ceb75=_0x883acf;_0x22eede=0xc8;}else{_0x22eede=0xce;}_0x303baa[_0x07f6('0x15')](_0x22eede);return _0x303baa['set'](_0x07f6('0x1b'),_0x28d3b3+'-'+_0x9ceb75+'/'+_0x883acf)[_0x07f6('0x16')](_0x5a0bfb);}return null;};}function patchUpdates(_0x5cac75){return function(_0x494dee){try{jsonpatch[_0x07f6('0x1c')](_0x494dee,_0x5cac75,!![]);}catch(_0x31cf29){return BPromise[_0x07f6('0x1d')](_0x31cf29);}return _0x494dee[_0x07f6('0x1e')]();};}function saveUpdates(_0x40e1d9,_0x4a71d1){return function(_0xe2ef73){if(_0xe2ef73){return _0xe2ef73[_0x07f6('0x1f')](_0x40e1d9)[_0x07f6('0x20')](function(_0x5e1d77){return _0x5e1d77;});}return null;};}function removeEntity(_0x1970e3,_0x43c7d5){return function(_0x7b9d8c){if(_0x7b9d8c){return _0x7b9d8c[_0x07f6('0x21')]()[_0x07f6('0x20')](function(){_0x1970e3[_0x07f6('0x15')](0xcc)[_0x07f6('0x22')]();});}};}function handleEntityNotFound(_0x4609bf,_0x3cf0da){return function(_0x544ea6){if(!_0x544ea6){_0x4609bf['sendStatus'](0x194);}return _0x544ea6;};}function handleError(_0x15ce69,_0x3cf69d){_0x3cf69d=_0x3cf69d||0x1f4;return function(_0x48a7d5){logger[_0x07f6('0x23')](_0x48a7d5[_0x07f6('0x24')]);if(_0x48a7d5['name']){delete _0x48a7d5[_0x07f6('0x25')];}_0x15ce69['status'](_0x3cf69d)[_0x07f6('0x26')](_0x48a7d5);};}exports[_0x07f6('0x27')]=function(_0x15a3ae,_0x260043){var _0x34f143={},_0x195a28={},_0x406ceb={'count':0x0,'rows':[]};var _0x5499a0=_[_0x07f6('0x28')](db[_0x07f6('0x29')][_0x07f6('0x2a')],function(_0x297127){return{'name':_0x297127[_0x07f6('0x2b')],'type':_0x297127[_0x07f6('0x2c')][_0x07f6('0x2d')]};});_0x195a28[_0x07f6('0x2e')]=_[_0x07f6('0x28')](_0x5499a0,'name');_0x195a28[_0x07f6('0x2f')]=_[_0x07f6('0x30')](_0x15a3ae[_0x07f6('0x2f')]);_0x195a28[_0x07f6('0x31')]=_['intersection'](_0x195a28[_0x07f6('0x2e')],_0x195a28[_0x07f6('0x2f')]);_0x34f143[_0x07f6('0x32')]=_[_0x07f6('0x33')](_0x195a28[_0x07f6('0x2e')],qs['fields'](_0x15a3ae[_0x07f6('0x2f')]['fields']));_0x34f143['attributes']=_0x34f143[_0x07f6('0x32')][_0x07f6('0x34')]?_0x34f143[_0x07f6('0x32')]:_0x195a28['model'];if(!_0x15a3ae[_0x07f6('0x2f')][_0x07f6('0x35')](_0x07f6('0x36'))){_0x34f143[_0x07f6('0x1a')]=qs[_0x07f6('0x1a')](_0x15a3ae['query'][_0x07f6('0x1a')]);_0x34f143[_0x07f6('0x17')]=qs[_0x07f6('0x17')](_0x15a3ae['query'][_0x07f6('0x17')]);}_0x34f143[_0x07f6('0x37')]=qs[_0x07f6('0x38')](_0x15a3ae[_0x07f6('0x2f')][_0x07f6('0x38')]);_0x34f143['where']=qs[_0x07f6('0x31')](_[_0x07f6('0x39')](_0x15a3ae[_0x07f6('0x2f')],_0x195a28[_0x07f6('0x31')]),_0x5499a0);if(_0x15a3ae[_0x07f6('0x2f')][_0x07f6('0x3a')]){_0x34f143[_0x07f6('0x3b')]=_[_0x07f6('0x3c')](_0x34f143[_0x07f6('0x3b')],{'$or':_[_0x07f6('0x28')](_0x5499a0,function(_0x4dec2d){if(_0x4dec2d[_0x07f6('0x2c')]!=='VIRTUAL'){var _0x547599={};_0x547599[_0x4dec2d['name']]={'$like':'%'+_0x15a3ae[_0x07f6('0x2f')][_0x07f6('0x3a')]+'%'};return _0x547599;}})});}_0x34f143=_[_0x07f6('0x3c')]({},_0x34f143,_0x15a3ae[_0x07f6('0x3d')]);var _0x4e3b95={'where':_0x34f143[_0x07f6('0x3b')]};return db['SquareDetailsReport'][_0x07f6('0x19')](_0x4e3b95)[_0x07f6('0x20')](function(_0x3292ba){_0x406ceb[_0x07f6('0x19')]=_0x3292ba;if(_0x15a3ae[_0x07f6('0x2f')]['includeAll']){_0x34f143['include']=[{'all':!![]}];}return db[_0x07f6('0x29')]['findAll'](_0x34f143);})[_0x07f6('0x20')](function(_0x1cfdc5){_0x406ceb[_0x07f6('0x3e')]=_0x1cfdc5;return _0x406ceb;})[_0x07f6('0x20')](respondWithFilteredResult(_0x260043,_0x34f143))['catch'](handleError(_0x260043,null));};exports[_0x07f6('0x3f')]=function(_0x4d3aab,_0xb5e88){var _0x452d16={'raw':!![],'where':{'id':_0x4d3aab[_0x07f6('0x40')]['id']}},_0x2eb464={};_0x2eb464[_0x07f6('0x2e')]=_[_0x07f6('0x30')](db[_0x07f6('0x29')][_0x07f6('0x2a')]);_0x2eb464[_0x07f6('0x2f')]=_['keys'](_0x4d3aab[_0x07f6('0x2f')]);_0x2eb464[_0x07f6('0x31')]=_['intersection'](_0x2eb464[_0x07f6('0x2e')],_0x2eb464[_0x07f6('0x2f')]);_0x452d16['attributes']=_[_0x07f6('0x33')](_0x2eb464['model'],qs[_0x07f6('0x41')](_0x4d3aab[_0x07f6('0x2f')][_0x07f6('0x41')]));_0x452d16[_0x07f6('0x32')]=_0x452d16['attributes'][_0x07f6('0x34')]?_0x452d16[_0x07f6('0x32')]:_0x2eb464[_0x07f6('0x2e')];if(_0x4d3aab[_0x07f6('0x2f')][_0x07f6('0x42')]){_0x452d16[_0x07f6('0x43')]=[{'all':!![]}];}_0x452d16=_[_0x07f6('0x3c')]({},_0x452d16,_0x4d3aab[_0x07f6('0x3d')]);return db[_0x07f6('0x29')][_0x07f6('0x44')](_0x452d16)[_0x07f6('0x20')](handleEntityNotFound(_0xb5e88,null))['then'](respondWithResult(_0xb5e88,null))[_0x07f6('0x45')](handleError(_0xb5e88,null));};exports['create']=function(_0x1dbb19,_0x4a5bc3){return db['SquareDetailsReport'][_0x07f6('0x46')](_0x1dbb19[_0x07f6('0x47')],{})[_0x07f6('0x20')](respondWithResult(_0x4a5bc3,0xc9))[_0x07f6('0x45')](handleError(_0x4a5bc3,null));};exports[_0x07f6('0x1f')]=function(_0x4fcab7,_0x484667){if(_0x4fcab7['body']['id']){delete _0x4fcab7[_0x07f6('0x47')]['id'];}return db['SquareDetailsReport'][_0x07f6('0x44')]({'where':{'id':_0x4fcab7[_0x07f6('0x40')]['id']}})[_0x07f6('0x20')](handleEntityNotFound(_0x484667,null))[_0x07f6('0x20')](saveUpdates(_0x4fcab7[_0x07f6('0x47')],null))[_0x07f6('0x20')](respondWithResult(_0x484667,null))[_0x07f6('0x45')](handleError(_0x484667,null));};exports['destroy']=function(_0x5dfaeb,_0x3b4521){return db[_0x07f6('0x29')][_0x07f6('0x44')]({'where':{'id':_0x5dfaeb['params']['id']}})['then'](handleEntityNotFound(_0x3b4521,null))['then'](removeEntity(_0x3b4521,null))[_0x07f6('0x45')](handleError(_0x3b4521,null));};exports['describe']=function(_0x442be6,_0x1d3319){return db[_0x07f6('0x29')]['describe']()[_0x07f6('0x20')](respondWithResult(_0x1d3319,null))['catch'](handleError(_0x1d3319,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 3d3c1bf..9e82d2f 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 _0x8046=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0x8046,0x1c5));var _0x6804=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x8046[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0x6804('0x0'));var util=require(_0x6804('0x1'));var logger=require(_0x6804('0x2'))(_0x6804('0x3'));var moment=require(_0x6804('0x4'));var BPromise=require('bluebird');var rp=require(_0x6804('0x5'));var fs=require('fs');var path=require(_0x6804('0x6'));var rimraf=require(_0x6804('0x7'));var config=require(_0x6804('0x8'));var attributes=require(_0x6804('0x9'));module[_0x6804('0xa')]=function(_0x5d9810,_0x1cff95){return _0x5d9810[_0x6804('0xb')](_0x6804('0xc'),attributes,{'tableName':_0x6804('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb60=['path','rimraf','../../config/environment','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0xcb60,0x156));var _0x0cb6=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0xcb60[_0x247fa1];return _0x244f35;};'use strict';var _=require(_0x0cb6('0x0'));var util=require(_0x0cb6('0x1'));var logger=require(_0x0cb6('0x2'))('api');var moment=require(_0x0cb6('0x3'));var BPromise=require(_0x0cb6('0x4'));var rp=require(_0x0cb6('0x5'));var fs=require('fs');var path=require(_0x0cb6('0x6'));var rimraf=require(_0x0cb6('0x7'));var config=require(_0x0cb6('0x8'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0xc6f3de,_0x206a9a){return _0xc6f3de[_0x0cb6('0x9')](_0x0cb6('0xa'),attributes,{'tableName':_0x0cb6('0xb'),'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 f12b946..c0e8141 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 _0x1c9a=['catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x1c9a,0x98));var _0xa1c9=function(_0x39d6b9,_0x4d4bd7){_0x39d6b9=_0x39d6b9-0x0;var _0x82cdd9=_0x1c9a[_0x39d6b9];return _0x82cdd9;};'use strict';var _=require(_0xa1c9('0x0'));var util=require('util');var moment=require(_0xa1c9('0x1'));var BPromise=require('bluebird');var rs=require(_0xa1c9('0x2'));var fs=require('fs');var Redis=require(_0xa1c9('0x3'));var db=require(_0xa1c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1c9('0x5'))(_0xa1c9('0x6'));var config=require(_0xa1c9('0x7'));var jayson=require(_0xa1c9('0x8'));var client=jayson['client'][_0xa1c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5448f2,_0x222624,_0x463c9c){return new BPromise(function(_0x3f07c2,_0x5059df){return client[_0xa1c9('0xa')](_0x5448f2,_0x463c9c)[_0xa1c9('0xb')](function(_0x24136d){logger[_0xa1c9('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x222624,_0xa1c9('0xd'));logger[_0xa1c9('0xe')](_0xa1c9('0xf'),_0x222624,_0xa1c9('0xd'),JSON[_0xa1c9('0x10')](_0x24136d));if(_0x24136d[_0xa1c9('0x11')]){if(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x12')]===0x1f4){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x5059df(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x3f07c2(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}else{logger[_0xa1c9('0xc')](_0xa1c9('0x13'),_0x222624,_0xa1c9('0xd'));_0x3f07c2(_0x24136d[_0xa1c9('0x15')][_0xa1c9('0x14')]);}})[_0xa1c9('0x16')](function(_0x373f5d){logger['error'](_0xa1c9('0x13'),_0x222624,_0x373f5d);_0x5059df(_0x373f5d);});});}exports[_0xa1c9('0x17')]=function(_0x224ae4){var _0x50db9b=this;return new Promise(function(_0x2fb81e,_0x5ab911){return db[_0xa1c9('0x18')][_0xa1c9('0x19')](_0x224ae4[_0xa1c9('0x1a')],{'raw':_0x224ae4['options']?_0x224ae4[_0xa1c9('0x1b')][_0xa1c9('0x1c')]===undefined?!![]:![]:!![]})[_0xa1c9('0xb')](function(_0x4edf37){logger[_0xa1c9('0xc')](_0xa1c9('0x17'),_0x224ae4);logger['debug'](_0xa1c9('0x17'),_0x224ae4,JSON[_0xa1c9('0x10')](_0x4edf37));_0x2fb81e(_0x4edf37);})[_0xa1c9('0x16')](function(_0x4d05d0){logger[_0xa1c9('0x11')](_0xa1c9('0x17'),_0x4d05d0[_0xa1c9('0x14')],_0x224ae4);_0x5ab911(_0x50db9b[_0xa1c9('0x11')](0x1f4,_0x4d05d0[_0xa1c9('0x14')]));});});}; \ No newline at end of file +var _0x3266=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','body','options','raw','catch','CreateSquareDetailsReport','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x14020e,_0x19c6c9){var _0xc82538=function(_0x49417f){while(--_0x49417f){_0x14020e['push'](_0x14020e['shift']());}};_0xc82538(++_0x19c6c9);}(_0x3266,0x6a));var _0x6326=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0x3266[_0x1a0daa];return _0x1dbe15;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var moment=require(_0x6326('0x2'));var BPromise=require(_0x6326('0x3'));var rs=require(_0x6326('0x4'));var fs=require('fs');var Redis=require(_0x6326('0x5'));var db=require(_0x6326('0x6'))['db'];var utils=require(_0x6326('0x7'));var logger=require(_0x6326('0x8'))('rpc');var config=require(_0x6326('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6326('0xa')][_0x6326('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14208e,_0x5402e5,_0x161f4e){return new BPromise(function(_0x5730e7,_0x2af571){return client[_0x6326('0xc')](_0x14208e,_0x161f4e)[_0x6326('0xd')](function(_0x1aee60){logger[_0x6326('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x5402e5,_0x6326('0xf'));logger[_0x6326('0x10')](_0x6326('0x11'),_0x5402e5,_0x6326('0xf'),JSON[_0x6326('0x12')](_0x1aee60));if(_0x1aee60[_0x6326('0x13')]){if(_0x1aee60[_0x6326('0x13')][_0x6326('0x14')]===0x1f4){logger[_0x6326('0x13')](_0x6326('0x15'),_0x5402e5,_0x1aee60['error']['message']);return _0x2af571(_0x1aee60[_0x6326('0x13')][_0x6326('0x16')]);}logger['error'](_0x6326('0x15'),_0x5402e5,_0x1aee60['error'][_0x6326('0x16')]);return _0x5730e7(_0x1aee60[_0x6326('0x13')][_0x6326('0x16')]);}else{logger[_0x6326('0xe')](_0x6326('0x15'),_0x5402e5,_0x6326('0xf'));_0x5730e7(_0x1aee60['result'][_0x6326('0x16')]);}})['catch'](function(_0x5945ee){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x5402e5,_0x5945ee);_0x2af571(_0x5945ee);});});}exports['CreateSquareDetailsReport']=function(_0x58e960){var _0xdf5ced=this;return new Promise(function(_0x1f4c11,_0x2be78e){return db['SquareDetailsReport']['create'](_0x58e960[_0x6326('0x17')],{'raw':_0x58e960[_0x6326('0x18')]?_0x58e960[_0x6326('0x18')][_0x6326('0x19')]===undefined?!![]:![]:!![]})[_0x6326('0xd')](function(_0x25957a){logger[_0x6326('0xe')]('CreateSquareDetailsReport',_0x58e960);logger[_0x6326('0x10')]('CreateSquareDetailsReport',_0x58e960,JSON[_0x6326('0x12')](_0x25957a));_0x1f4c11(_0x25957a);})[_0x6326('0x1a')](function(_0x2482ef){logger[_0x6326('0x13')](_0x6326('0x1b'),_0x2482ef[_0x6326('0x16')],_0x58e960);_0x2be78e(_0xdf5ced[_0x6326('0x13')](0x1f4,_0x2482ef[_0x6326('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 31c7085..02d3711 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 _0x7bd6=['express','Router','../../components/auth/service','./system.controller','isAuthenticated','index','get','/process/:pid/kill','killProcess','exports'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x7bd6,0x96));var _0x67bd=function(_0xb2e670,_0x436e56){_0xb2e670=_0xb2e670-0x0;var _0x598b6b=_0x7bd6[_0xb2e670];return _0x598b6b;};'use strict';var express=require(_0x67bd('0x0'));var router=express[_0x67bd('0x1')]();var auth=require(_0x67bd('0x2'));var controller=require(_0x67bd('0x3'));router['get']('/',auth[_0x67bd('0x4')](),controller[_0x67bd('0x5')]);router[_0x67bd('0x6')](_0x67bd('0x7'),auth['isAuthenticated'](),controller[_0x67bd('0x8')]);module[_0x67bd('0x9')]=router; \ No newline at end of file +var _0xe0b9=['exports','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill','killProcess'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0xe0b9,0x12a));var _0x9e0b=function(_0x9b7a64,_0x38d4a8){_0x9b7a64=_0x9b7a64-0x0;var _0x33fd98=_0xe0b9[_0x9b7a64];return _0x33fd98;};'use strict';var express=require(_0x9e0b('0x0'));var router=express[_0x9e0b('0x1')]();var auth=require(_0x9e0b('0x2'));var controller=require(_0x9e0b('0x3'));router[_0x9e0b('0x4')]('/',auth[_0x9e0b('0x5')](),controller['index']);router[_0x9e0b('0x4')](_0x9e0b('0x6'),auth[_0x9e0b('0x5')](),controller[_0x9e0b('0x7')]);module[_0x9e0b('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index c77e288..d738c80 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 _0x998e=['child_process','../../config/logger','api','util','bluebird','lodash','error','inspect','send','getAllData','catch','status','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','then','split','length','indexOf','pid','kill','SIGINT','json','Process\x20with\x20pid\x20%s\x20killed\x20correctly'];(function(_0x268047,_0x565f46){var _0x5dac57=function(_0x4a9ad7){while(--_0x4a9ad7){_0x268047['push'](_0x268047['shift']());}};_0x5dac57(++_0x565f46);}(_0x998e,0xc8));var _0xe998=function(_0x2fe1e3,_0x4c7077){_0x2fe1e3=_0x2fe1e3-0x0;var _0x261f0c=_0x998e[_0x2fe1e3];return _0x261f0c;};'use strict';var info=require('systeminformation');var exec=require(_0xe998('0x0'))['exec'];var logger=require(_0xe998('0x1'))(_0xe998('0x2'));var util=require(_0xe998('0x3'));var BPromise=require(_0xe998('0x4'));var _=require(_0xe998('0x5'));function handleError(_0x10f1dd,_0x587acf,_0x3129de){_0x587acf=_0x587acf||0x1f4;return function(_0x5b7c25){logger[_0xe998('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x3129de,_0x587acf,util[_0xe998('0x7')](_0x5b7c25,{'showHidden':![],'depth':null}));delete _0x5b7c25['name'];_0x10f1dd['status'](_0x587acf)[_0xe998('0x8')](_0x5b7c25);};}exports['index']=function(_0x262d22,_0xdac780){return info[_0xe998('0x9')]()['then'](function(_0x130b77){return _0xdac780['status'](0xc8)['json'](_0x130b77);})[_0xe998('0xa')](function(_0x316016){return _0xdac780[_0xe998('0xb')](0x1f4)['json'](_0x316016);});};exports[_0xe998('0xc')]=function(_0x4dc81d,_0x266489){var _0x42579f=[_0xe998('0xd')];return new BPromise(function(_0x1840ed,_0xf2c9c0){return exec(util['format'](_0xe998('0xe'),_0x4dc81d[_0xe998('0xf')]['pid']),function(_0x20b362,_0x509671,_0x59e1c1){if(_0x20b362){return _0xf2c9c0(_0x20b362);}return _0x1840ed(_0x509671);});})[_0xe998('0x10')](function(_0x4065bf){var _0xe7e36e=![];var _0x5b73de=_0x4065bf[_0xe998('0x11')](/\n/);for(var _0xc05cf0=0x0,_0x1bd49d=_0x42579f[_0xe998('0x12')];_0xc05cf0<_0x1bd49d,_0xe7e36e===![];_0xc05cf0+=0x1){if(_0x4065bf[_0xe998('0x13')](_0x42579f[_0xc05cf0])>=0x0){_0xe7e36e=!![];}}if(!_0xe7e36e){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x4dc81d[_0xe998('0xf')][_0xe998('0x14')]));}process[_0xe998('0x15')](_0x4dc81d['params'][_0xe998('0x14')],_0xe998('0x16'));return _0x266489[_0xe998('0xb')](0xc8)[_0xe998('0x17')]({'message':util['format'](_0xe998('0x18'),_0x4dc81d['params'][_0xe998('0x14')])});})[_0xe998('0xa')](handleError(_0x266489,null,_0xe998('0xc')));}; \ No newline at end of file +var _0xbe60=['getAllData','status','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','../../config/logger','util','bluebird','error','send','index'];(function(_0x512673,_0x484705){var _0x441100=function(_0x387673){while(--_0x387673){_0x512673['push'](_0x512673['shift']());}};_0x441100(++_0x484705);}(_0xbe60,0x149));var _0x0be6=function(_0x5a368f,_0xcac789){_0x5a368f=_0x5a368f-0x0;var _0x225a2f=_0xbe60[_0x5a368f];return _0x225a2f;};'use strict';var info=require(_0x0be6('0x0'));var exec=require('child_process')['exec'];var logger=require(_0x0be6('0x1'))('api');var util=require(_0x0be6('0x2'));var BPromise=require(_0x0be6('0x3'));var _=require('lodash');function handleError(_0x578e63,_0x3c7d5b,_0x122d15){_0x3c7d5b=_0x3c7d5b||0x1f4;return function(_0x2b8230){logger[_0x0be6('0x4')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x122d15,_0x3c7d5b,util['inspect'](_0x2b8230,{'showHidden':![],'depth':null}));delete _0x2b8230['name'];_0x578e63['status'](_0x3c7d5b)[_0x0be6('0x5')](_0x2b8230);};}exports[_0x0be6('0x6')]=function(_0x5961b0,_0xcd596e){return info[_0x0be6('0x7')]()['then'](function(_0x34b7ea){return _0xcd596e[_0x0be6('0x8')](0xc8)[_0x0be6('0x9')](_0x34b7ea);})[_0x0be6('0xa')](function(_0x50fb7a){return _0xcd596e[_0x0be6('0x8')](0x1f4)[_0x0be6('0x9')](_0x50fb7a);});};exports['killProcess']=function(_0x2b5736,_0xa80e40){var _0x2b92c9=[_0x0be6('0xb')];return new BPromise(function(_0x4d260e,_0x51d74a){return exec(util[_0x0be6('0xc')](_0x0be6('0xd'),_0x2b5736['params']['pid']),function(_0x40960f,_0x39ac6a,_0x5a9d02){if(_0x40960f){return _0x51d74a(_0x40960f);}return _0x4d260e(_0x39ac6a);});})['then'](function(_0x31ec0c){var _0x5c18c7=![];var _0x1bcd92=_0x31ec0c[_0x0be6('0xe')](/\n/);for(var _0xcf972e=0x0,_0x55b24b=_0x2b92c9[_0x0be6('0xf')];_0xcf972e<_0x55b24b,_0x5c18c7===![];_0xcf972e+=0x1){if(_0x31ec0c[_0x0be6('0x10')](_0x2b92c9[_0xcf972e])>=0x0){_0x5c18c7=!![];}}if(!_0x5c18c7){throw new Error(util['format'](_0x0be6('0x11'),_0x2b5736[_0x0be6('0x12')][_0x0be6('0x13')]));}process[_0x0be6('0x14')](_0x2b5736[_0x0be6('0x12')][_0x0be6('0x13')],_0x0be6('0x15'));return _0xa80e40[_0x0be6('0x8')](0xc8)['json']({'message':util[_0x0be6('0xc')](_0x0be6('0x16'),_0x2b5736[_0x0be6('0x12')][_0x0be6('0x13')])});})['catch'](handleError(_0xa80e40,null,_0x0be6('0x17')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 4a1d8f9..8b460d5 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 _0x1658=['delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x471273,_0x216ce4){var _0x4a318c=function(_0x61d51b){while(--_0x61d51b){_0x471273['push'](_0x471273['shift']());}};_0x4a318c(++_0x216ce4);}(_0x1658,0x163));var _0x8165=function(_0x1caeb7,_0x39f829){_0x1caeb7=_0x1caeb7-0x0;var _0x54ff04=_0x1658[_0x1caeb7];return _0x54ff04;};'use strict';var multer=require(_0x8165('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8165('0x1'));var express=require('express');var router=express[_0x8165('0x2')]();var fs_extra=require(_0x8165('0x3'));var auth=require(_0x8165('0x4'));var interaction=require(_0x8165('0x5'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x8165('0x6')]('/',auth[_0x8165('0x7')](),controller[_0x8165('0x8')]);router[_0x8165('0x6')](_0x8165('0x9'),auth[_0x8165('0x7')](),controller[_0x8165('0xa')]);router['post']('/',auth[_0x8165('0x7')](),controller[_0x8165('0xb')]);router[_0x8165('0xc')](_0x8165('0x9'),auth[_0x8165('0x7')](),controller['update']);router[_0x8165('0xd')](_0x8165('0x9'),auth[_0x8165('0x7')](),controller[_0x8165('0xe')]);module[_0x8165('0xf')]=router; \ No newline at end of file +var _0x84c4=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','post','create','put','/:id','update','delete'];(function(_0x569411,_0xdc19aa){var _0x29d80b=function(_0x15d8f0){while(--_0x15d8f0){_0x569411['push'](_0x569411['shift']());}};_0x29d80b(++_0xdc19aa);}(_0x84c4,0x157));var _0x484c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84c4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x484c('0x0'));var util=require(_0x484c('0x1'));var path=require(_0x484c('0x2'));var timeout=require(_0x484c('0x3'));var express=require(_0x484c('0x4'));var router=express[_0x484c('0x5')]();var fs_extra=require(_0x484c('0x6'));var auth=require(_0x484c('0x7'));var interaction=require(_0x484c('0x8'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x484c('0x9')]('/',auth[_0x484c('0xa')](),controller['index']);router[_0x484c('0x9')]('/:id',auth[_0x484c('0xa')](),controller[_0x484c('0xb')]);router[_0x484c('0xc')]('/',auth['isAuthenticated'](),controller[_0x484c('0xd')]);router[_0x484c('0xe')](_0x484c('0xf'),auth[_0x484c('0xa')](),controller[_0x484c('0x10')]);router[_0x484c('0x11')](_0x484c('0xf'),auth['isAuthenticated'](),controller[_0x484c('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 620594e..e05426d 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 _0xa45c=['STRING','sequelize','exports'];(function(_0x1e0ce6,_0x193cdc){var _0x12f74d=function(_0x5656fb){while(--_0x5656fb){_0x1e0ce6['push'](_0x1e0ce6['shift']());}};_0x12f74d(++_0x193cdc);}(_0xa45c,0x6d));var _0xca45=function(_0x4e8682,_0xa2c8bf){_0x4e8682=_0x4e8682-0x0;var _0x31e1a2=_0xa45c[_0x4e8682];return _0x31e1a2;};'use strict';var Sequelize=require(_0xca45('0x0'));module[_0xca45('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xca45('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xca45('0x2')]}}; \ No newline at end of file +var _0xf4f4=['STRING','#0091EA','sequelize','exports','name'];(function(_0x1d3978,_0x329d79){var _0x1a25b7=function(_0x41627a){while(--_0x41627a){_0x1d3978['push'](_0x1d3978['shift']());}};_0x1a25b7(++_0x329d79);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x23f8f7,_0x10d37f){_0x23f8f7=_0x23f8f7-0x0;var _0xe330=_0xf4f4[_0x23f8f7];return _0xe330;};'use strict';var Sequelize=require(_0x4f4f('0x0'));module[_0x4f4f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4f4f('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4f4f('0x3')],'defaultValue':_0x4f4f('0x4')},'description':{'type':Sequelize[_0x4f4f('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index eda27fd..49b4e34 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 _0xa75b=['rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','reject','then','destroy','get','Tags','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Tag'];(function(_0x2fbd38,_0x10738f){var _0x16d43a=function(_0x469ebe){while(--_0x469ebe){_0x2fbd38['push'](_0x2fbd38['shift']());}};_0x16d43a(++_0x10738f);}(_0xa75b,0x170));var _0xba75=function(_0x5c49ac,_0x3c5224){_0x5c49ac=_0x5c49ac-0x0;var _0x349876=_0xa75b[_0x5c49ac];return _0x349876;};'use strict';var emlformat=require(_0xba75('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xba75('0x1'));var rp=require(_0xba75('0x2'));var moment=require(_0xba75('0x3'));var BPromise=require(_0xba75('0x4'));var Mustache=require(_0xba75('0x5'));var util=require(_0xba75('0x6'));var path=require(_0xba75('0x7'));var sox=require(_0xba75('0x8'));var csv=require(_0xba75('0x9'));var ejs=require(_0xba75('0xa'));var fs=require('fs');var fs_extra=require(_0xba75('0xb'));var _=require(_0xba75('0xc'));var squel=require(_0xba75('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba75('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xba75('0xf'));var Redis=require('ioredis');var authService=require(_0xba75('0x10'));var qs=require(_0xba75('0x11'));var as=require(_0xba75('0x12'));var hardwareService=require(_0xba75('0x13'));var logger=require(_0xba75('0x14'))(_0xba75('0x15'));var utils=require(_0xba75('0x16'));var config=require(_0xba75('0x17'));var licenseUtil=require(_0xba75('0x18'));var db=require(_0xba75('0x19'))['db'];function respondWithStatusCode(_0x8116d8,_0x1ed697){_0x1ed697=_0x1ed697||0xcc;return function(_0x50db90){if(_0x50db90){return _0x8116d8['sendStatus'](_0x1ed697);}return _0x8116d8[_0xba75('0x1a')](_0x1ed697)['end']();};}function respondWithResult(_0x2f141a,_0x2df615){_0x2df615=_0x2df615||0xc8;return function(_0xa27f76){if(_0xa27f76){return _0x2f141a[_0xba75('0x1a')](_0x2df615)['json'](_0xa27f76);}};}function respondWithFilteredResult(_0x31b3b3,_0x18bab2){return function(_0x256678){if(_0x256678){var _0x4028f9=typeof _0x18bab2[_0xba75('0x1b')]==='undefined'&&typeof _0x18bab2[_0xba75('0x1c')]===_0xba75('0x1d');var _0x14bd83=_0x256678['count'];var _0x2822af=_0x4028f9?0x0:_0x18bab2[_0xba75('0x1b')];var _0xc4bf17=_0x4028f9?_0x256678[_0xba75('0x1e')]:_0x18bab2[_0xba75('0x1b')]+_0x18bab2[_0xba75('0x1c')];var _0x5811cb;if(_0xc4bf17>=_0x14bd83){_0xc4bf17=_0x14bd83;_0x5811cb=0xc8;}else{_0x5811cb=0xce;}_0x31b3b3[_0xba75('0x1a')](_0x5811cb);return _0x31b3b3[_0xba75('0x1f')]('Content-Range',_0x2822af+'-'+_0xc4bf17+'/'+_0x14bd83)['json'](_0x256678);}return null;};}function patchUpdates(_0x35ffd2){return function(_0x31bc33){try{jsonpatch['apply'](_0x31bc33,_0x35ffd2,!![]);}catch(_0x48206c){return BPromise[_0xba75('0x20')](_0x48206c);}return _0x31bc33['save']();};}function saveUpdates(_0x1b8a36,_0x2ece41){return function(_0x19b2d7){if(_0x19b2d7){return _0x19b2d7['update'](_0x1b8a36)[_0xba75('0x21')](function(_0x221d5e){return _0x221d5e;});}return null;};}function removeEntity(_0x139fa4,_0x3e9bd9){return function(_0x14c54b){if(_0x14c54b){return _0x14c54b[_0xba75('0x22')]()['then'](function(){var _0x246c48=_0x14c54b[_0xba75('0x23')]({'plain':!![]});var _0xe579fb=_0xba75('0x24');return db[_0xba75('0x25')][_0xba75('0x22')]({'where':{'type':_0xe579fb,'resourceId':_0x246c48['id']}})[_0xba75('0x21')](function(){return _0x14c54b;});})[_0xba75('0x21')](function(){_0x139fa4[_0xba75('0x1a')](0xcc)[_0xba75('0x26')]();});}};}function handleEntityNotFound(_0x47ddff,_0x4c8d02){return function(_0x4e1987){if(!_0x4e1987){_0x47ddff[_0xba75('0x27')](0x194);}return _0x4e1987;};}function handleError(_0x4856be,_0x42cefb){_0x42cefb=_0x42cefb||0x1f4;return function(_0x58ea2d){logger[_0xba75('0x28')](_0x58ea2d[_0xba75('0x29')]);if(_0x58ea2d[_0xba75('0x2a')]){delete _0x58ea2d['name'];}_0x4856be[_0xba75('0x1a')](_0x42cefb)[_0xba75('0x2b')](_0x58ea2d);};}exports[_0xba75('0x2c')]=function(_0x2808f0,_0x5d9f78){var _0x4791a5={},_0x200715={},_0x481a04={'count':0x0,'rows':[]};var _0x5a85ee=_[_0xba75('0x2d')](db[_0xba75('0x2e')][_0xba75('0x2f')],function(_0x4b4d69){return{'name':_0x4b4d69[_0xba75('0x30')],'type':_0x4b4d69[_0xba75('0x31')]['key']};});_0x200715[_0xba75('0x32')]=_[_0xba75('0x2d')](_0x5a85ee,_0xba75('0x2a'));_0x200715[_0xba75('0x33')]=_['keys'](_0x2808f0[_0xba75('0x33')]);_0x200715[_0xba75('0x34')]=_['intersection'](_0x200715[_0xba75('0x32')],_0x200715[_0xba75('0x33')]);_0x4791a5[_0xba75('0x35')]=_['intersection'](_0x200715[_0xba75('0x32')],qs[_0xba75('0x36')](_0x2808f0[_0xba75('0x33')][_0xba75('0x36')]));_0x4791a5[_0xba75('0x35')]=_0x4791a5[_0xba75('0x35')][_0xba75('0x37')]?_0x4791a5['attributes']:_0x200715['model'];if(!_0x2808f0[_0xba75('0x33')][_0xba75('0x38')](_0xba75('0x39'))){_0x4791a5['limit']=qs[_0xba75('0x1c')](_0x2808f0[_0xba75('0x33')]['limit']);_0x4791a5['offset']=qs[_0xba75('0x1b')](_0x2808f0[_0xba75('0x33')][_0xba75('0x1b')]);}_0x4791a5[_0xba75('0x3a')]=qs[_0xba75('0x3b')](_0x2808f0['query']['sort']);_0x4791a5[_0xba75('0x3c')]=qs[_0xba75('0x34')](_[_0xba75('0x3d')](_0x2808f0[_0xba75('0x33')],_0x200715[_0xba75('0x34')]),_0x5a85ee);if(_0x2808f0[_0xba75('0x33')][_0xba75('0x3e')]){_0x4791a5['where']=_[_0xba75('0x3f')](_0x4791a5[_0xba75('0x3c')],{'$or':_['map'](_0x5a85ee,function(_0x1f28e8){if(_0x1f28e8[_0xba75('0x31')]!==_0xba75('0x40')){var _0x45d8cd={};_0x45d8cd[_0x1f28e8[_0xba75('0x2a')]]={'$like':'%'+_0x2808f0[_0xba75('0x33')][_0xba75('0x3e')]+'%'};return _0x45d8cd;}})});}_0x4791a5=_['merge']({},_0x4791a5,_0x2808f0[_0xba75('0x41')]);var _0x59d005={'where':_0x4791a5[_0xba75('0x3c')]};return db['Tag'][_0xba75('0x1e')](_0x59d005)[_0xba75('0x21')](function(_0x9c32ad){_0x481a04[_0xba75('0x1e')]=_0x9c32ad;if(_0x2808f0[_0xba75('0x33')][_0xba75('0x42')]){_0x4791a5[_0xba75('0x43')]=[{'all':!![]}];}return db[_0xba75('0x2e')][_0xba75('0x44')](_0x4791a5);})['then'](function(_0x30b5f0){_0x481a04[_0xba75('0x45')]=_0x30b5f0;return _0x481a04;})['then'](respondWithFilteredResult(_0x5d9f78,_0x4791a5))[_0xba75('0x46')](handleError(_0x5d9f78,null));};exports[_0xba75('0x47')]=function(_0x1130ac,_0x5bf935){var _0x5043a5={'raw':!![],'where':{'id':_0x1130ac['params']['id']}},_0x5c6491={};_0x5c6491[_0xba75('0x32')]=_['keys'](db[_0xba75('0x2e')][_0xba75('0x2f')]);_0x5c6491[_0xba75('0x33')]=_[_0xba75('0x48')](_0x1130ac[_0xba75('0x33')]);_0x5c6491['filters']=_['intersection'](_0x5c6491[_0xba75('0x32')],_0x5c6491['query']);_0x5043a5[_0xba75('0x35')]=_['intersection'](_0x5c6491[_0xba75('0x32')],qs[_0xba75('0x36')](_0x1130ac[_0xba75('0x33')][_0xba75('0x36')]));_0x5043a5['attributes']=_0x5043a5[_0xba75('0x35')][_0xba75('0x37')]?_0x5043a5[_0xba75('0x35')]:_0x5c6491[_0xba75('0x32')];if(_0x1130ac[_0xba75('0x33')][_0xba75('0x42')]){_0x5043a5[_0xba75('0x43')]=[{'all':!![]}];}_0x5043a5=_[_0xba75('0x3f')]({},_0x5043a5,_0x1130ac['options']);return db[_0xba75('0x2e')][_0xba75('0x49')](_0x5043a5)[_0xba75('0x21')](handleEntityNotFound(_0x5bf935,null))[_0xba75('0x21')](respondWithResult(_0x5bf935,null))[_0xba75('0x46')](handleError(_0x5bf935,null));};exports['create']=function(_0x2a1f84,_0x25ae33){return db[_0xba75('0x2e')][_0xba75('0x4a')](_0x2a1f84[_0xba75('0x4b')],{})[_0xba75('0x21')](function(_0x2c9085){var _0x5dc5f8=_0x2a1f84[_0xba75('0x4c')][_0xba75('0x23')]({'plain':!![]});if(!_0x5dc5f8)throw new Error(_0xba75('0x4d'));if(_0x5dc5f8['role']===_0xba75('0x4c')){var _0x29b4fc=_0x2c9085['get']({'plain':!![]});var _0x4d7e7e=_0xba75('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x4d7e7e,'userProfileId':_0x5dc5f8[_0xba75('0x4e')]},'raw':!![]})['then'](function(_0xbb87b9){if(_0xbb87b9&&_0xbb87b9[_0xba75('0x4f')]===0x0){return db[_0xba75('0x25')][_0xba75('0x4a')]({'name':_0x29b4fc[_0xba75('0x2a')],'resourceId':_0x29b4fc['id'],'type':_0xbb87b9['name'],'sectionId':_0xbb87b9['id']},{})[_0xba75('0x21')](function(){return _0x2c9085;});}else{return _0x2c9085;}})[_0xba75('0x46')](function(_0x57aaa6){logger[_0xba75('0x28')](_0xba75('0x50'),_0x57aaa6);throw _0x57aaa6;});}return _0x2c9085;})[_0xba75('0x21')](respondWithResult(_0x25ae33,0xc9))[_0xba75('0x46')](handleError(_0x25ae33,null));};exports[_0xba75('0x51')]=function(_0x52b2c9,_0x43f4b7){if(_0x52b2c9[_0xba75('0x4b')]['id']){delete _0x52b2c9['body']['id'];}return db[_0xba75('0x2e')][_0xba75('0x49')]({'where':{'id':_0x52b2c9[_0xba75('0x52')]['id']}})[_0xba75('0x21')](handleEntityNotFound(_0x43f4b7,null))[_0xba75('0x21')](saveUpdates(_0x52b2c9[_0xba75('0x4b')],null))['then'](respondWithResult(_0x43f4b7,null))[_0xba75('0x46')](handleError(_0x43f4b7,null));};exports[_0xba75('0x22')]=function(_0x361efb,_0x429e26){return db[_0xba75('0x2e')][_0xba75('0x49')]({'where':{'id':_0x361efb['params']['id']}})['then'](handleEntityNotFound(_0x429e26,null))['then'](removeEntity(_0x429e26,null))['catch'](handleError(_0x429e26,null));}; \ No newline at end of file +var _0x16d2=['error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','findAll','rows','show','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','UserProfileSection','userProfileId','UserProfileResource','catch','update','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','get'];(function(_0x339d80,_0x27c188){var _0x3eac6c=function(_0x3fe246){while(--_0x3fe246){_0x339d80['push'](_0x339d80['shift']());}};_0x3eac6c(++_0x27c188);}(_0x16d2,0x123));var _0x216d=function(_0x2a19c1,_0x56d2cb){_0x2a19c1=_0x2a19c1-0x0;var _0x1b69e0=_0x16d2[_0x2a19c1];return _0x1b69e0;};'use strict';var emlformat=require(_0x216d('0x0'));var rimraf=require(_0x216d('0x1'));var zipdir=require(_0x216d('0x2'));var jsonpatch=require(_0x216d('0x3'));var rp=require(_0x216d('0x4'));var moment=require(_0x216d('0x5'));var BPromise=require(_0x216d('0x6'));var Mustache=require(_0x216d('0x7'));var util=require(_0x216d('0x8'));var path=require('path');var sox=require(_0x216d('0x9'));var csv=require(_0x216d('0xa'));var ejs=require(_0x216d('0xb'));var fs=require('fs');var fs_extra=require(_0x216d('0xc'));var _=require(_0x216d('0xd'));var squel=require(_0x216d('0xe'));var crypto=require(_0x216d('0xf'));var jsforce=require(_0x216d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x216d('0xa'));var querystring=require(_0x216d('0x11'));var Papa=require(_0x216d('0x12'));var Redis=require(_0x216d('0x13'));var authService=require(_0x216d('0x14'));var qs=require(_0x216d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x216d('0x16'));var logger=require('../../config/logger')(_0x216d('0x17'));var utils=require(_0x216d('0x18'));var config=require(_0x216d('0x19'));var licenseUtil=require(_0x216d('0x1a'));var db=require(_0x216d('0x1b'))['db'];function respondWithStatusCode(_0x23ecf9,_0x4c92d9){_0x4c92d9=_0x4c92d9||0xcc;return function(_0xb36a43){if(_0xb36a43){return _0x23ecf9['sendStatus'](_0x4c92d9);}return _0x23ecf9[_0x216d('0x1c')](_0x4c92d9)[_0x216d('0x1d')]();};}function respondWithResult(_0x4dc2a2,_0x165c19){_0x165c19=_0x165c19||0xc8;return function(_0x322e4b){if(_0x322e4b){return _0x4dc2a2['status'](_0x165c19)[_0x216d('0x1e')](_0x322e4b);}};}function respondWithFilteredResult(_0x494e92,_0x448c0d){return function(_0xf571a4){if(_0xf571a4){var _0x4631b0=typeof _0x448c0d[_0x216d('0x1f')]===_0x216d('0x20')&&typeof _0x448c0d[_0x216d('0x21')]===_0x216d('0x20');var _0x1496fe=_0xf571a4[_0x216d('0x22')];var _0x53d464=_0x4631b0?0x0:_0x448c0d[_0x216d('0x1f')];var _0x5124ab=_0x4631b0?_0xf571a4['count']:_0x448c0d[_0x216d('0x1f')]+_0x448c0d[_0x216d('0x21')];var _0x574758;if(_0x5124ab>=_0x1496fe){_0x5124ab=_0x1496fe;_0x574758=0xc8;}else{_0x574758=0xce;}_0x494e92[_0x216d('0x1c')](_0x574758);return _0x494e92[_0x216d('0x23')]('Content-Range',_0x53d464+'-'+_0x5124ab+'/'+_0x1496fe)[_0x216d('0x1e')](_0xf571a4);}return null;};}function patchUpdates(_0x13b8e0){return function(_0x430e81){try{jsonpatch[_0x216d('0x24')](_0x430e81,_0x13b8e0,!![]);}catch(_0x5c3e03){return BPromise[_0x216d('0x25')](_0x5c3e03);}return _0x430e81[_0x216d('0x26')]();};}function saveUpdates(_0x10f299,_0x438981){return function(_0x206782){if(_0x206782){return _0x206782['update'](_0x10f299)[_0x216d('0x27')](function(_0x1bd4db){return _0x1bd4db;});}return null;};}function removeEntity(_0x188494,_0x2880c6){return function(_0x6fa4b3){if(_0x6fa4b3){return _0x6fa4b3['destroy']()[_0x216d('0x27')](function(){var _0xab672=_0x6fa4b3[_0x216d('0x28')]({'plain':!![]});var _0x5998a1='Tags';return db['UserProfileResource']['destroy']({'where':{'type':_0x5998a1,'resourceId':_0xab672['id']}})['then'](function(){return _0x6fa4b3;});})[_0x216d('0x27')](function(){_0x188494[_0x216d('0x1c')](0xcc)[_0x216d('0x1d')]();});}};}function handleEntityNotFound(_0x73b509,_0x46d0ef){return function(_0x47fa6d){if(!_0x47fa6d){_0x73b509['sendStatus'](0x194);}return _0x47fa6d;};}function handleError(_0xa7624a,_0x51b2bd){_0x51b2bd=_0x51b2bd||0x1f4;return function(_0x23d1c3){logger[_0x216d('0x29')](_0x23d1c3[_0x216d('0x2a')]);if(_0x23d1c3[_0x216d('0x2b')]){delete _0x23d1c3[_0x216d('0x2b')];}_0xa7624a[_0x216d('0x1c')](_0x51b2bd)[_0x216d('0x2c')](_0x23d1c3);};}exports[_0x216d('0x2d')]=function(_0x169cfa,_0x28f56a){var _0x11be90={},_0x260134={},_0x4537fd={'count':0x0,'rows':[]};var _0x483324=_[_0x216d('0x2e')](db[_0x216d('0x2f')][_0x216d('0x30')],function(_0x510ad9){return{'name':_0x510ad9[_0x216d('0x31')],'type':_0x510ad9[_0x216d('0x32')][_0x216d('0x33')]};});_0x260134[_0x216d('0x34')]=_['map'](_0x483324,_0x216d('0x2b'));_0x260134[_0x216d('0x35')]=_[_0x216d('0x36')](_0x169cfa[_0x216d('0x35')]);_0x260134[_0x216d('0x37')]=_[_0x216d('0x38')](_0x260134[_0x216d('0x34')],_0x260134[_0x216d('0x35')]);_0x11be90[_0x216d('0x39')]=_[_0x216d('0x38')](_0x260134[_0x216d('0x34')],qs['fields'](_0x169cfa[_0x216d('0x35')][_0x216d('0x3a')]));_0x11be90[_0x216d('0x39')]=_0x11be90['attributes'][_0x216d('0x3b')]?_0x11be90[_0x216d('0x39')]:_0x260134['model'];if(!_0x169cfa[_0x216d('0x35')]['hasOwnProperty']('nolimit')){_0x11be90[_0x216d('0x21')]=qs[_0x216d('0x21')](_0x169cfa[_0x216d('0x35')][_0x216d('0x21')]);_0x11be90['offset']=qs['offset'](_0x169cfa['query'][_0x216d('0x1f')]);}_0x11be90[_0x216d('0x3c')]=qs['sort'](_0x169cfa[_0x216d('0x35')][_0x216d('0x3d')]);_0x11be90['where']=qs[_0x216d('0x37')](_[_0x216d('0x3e')](_0x169cfa[_0x216d('0x35')],_0x260134[_0x216d('0x37')]),_0x483324);if(_0x169cfa[_0x216d('0x35')][_0x216d('0x3f')]){_0x11be90[_0x216d('0x40')]=_[_0x216d('0x41')](_0x11be90['where'],{'$or':_['map'](_0x483324,function(_0x281a88){if(_0x281a88[_0x216d('0x32')]!=='VIRTUAL'){var _0xf33f9c={};_0xf33f9c[_0x281a88[_0x216d('0x2b')]]={'$like':'%'+_0x169cfa[_0x216d('0x35')]['filter']+'%'};return _0xf33f9c;}})});}_0x11be90=_[_0x216d('0x41')]({},_0x11be90,_0x169cfa[_0x216d('0x42')]);var _0x13d787={'where':_0x11be90[_0x216d('0x40')]};return db['Tag'][_0x216d('0x22')](_0x13d787)[_0x216d('0x27')](function(_0x5665d7){_0x4537fd[_0x216d('0x22')]=_0x5665d7;if(_0x169cfa[_0x216d('0x35')]['includeAll']){_0x11be90['include']=[{'all':!![]}];}return db[_0x216d('0x2f')][_0x216d('0x43')](_0x11be90);})[_0x216d('0x27')](function(_0x498efe){_0x4537fd[_0x216d('0x44')]=_0x498efe;return _0x4537fd;})['then'](respondWithFilteredResult(_0x28f56a,_0x11be90))['catch'](handleError(_0x28f56a,null));};exports[_0x216d('0x45')]=function(_0x43336e,_0xac81f){var _0x5ddaeb={'raw':!![],'where':{'id':_0x43336e['params']['id']}},_0xaccf45={};_0xaccf45[_0x216d('0x34')]=_[_0x216d('0x36')](db[_0x216d('0x2f')]['rawAttributes']);_0xaccf45[_0x216d('0x35')]=_[_0x216d('0x36')](_0x43336e[_0x216d('0x35')]);_0xaccf45[_0x216d('0x37')]=_['intersection'](_0xaccf45['model'],_0xaccf45['query']);_0x5ddaeb[_0x216d('0x39')]=_[_0x216d('0x38')](_0xaccf45[_0x216d('0x34')],qs[_0x216d('0x3a')](_0x43336e[_0x216d('0x35')][_0x216d('0x3a')]));_0x5ddaeb[_0x216d('0x39')]=_0x5ddaeb[_0x216d('0x39')]['length']?_0x5ddaeb[_0x216d('0x39')]:_0xaccf45[_0x216d('0x34')];if(_0x43336e[_0x216d('0x35')][_0x216d('0x46')]){_0x5ddaeb['include']=[{'all':!![]}];}_0x5ddaeb=_[_0x216d('0x41')]({},_0x5ddaeb,_0x43336e['options']);return db[_0x216d('0x2f')][_0x216d('0x47')](_0x5ddaeb)[_0x216d('0x27')](handleEntityNotFound(_0xac81f,null))['then'](respondWithResult(_0xac81f,null))['catch'](handleError(_0xac81f,null));};exports[_0x216d('0x48')]=function(_0x32d499,_0x3932a3){return db[_0x216d('0x2f')][_0x216d('0x48')](_0x32d499[_0x216d('0x49')],{})['then'](function(_0x4f9274){var _0x26209c=_0x32d499['user'][_0x216d('0x28')]({'plain':!![]});if(!_0x26209c)throw new Error(_0x216d('0x4a'));if(_0x26209c['role']==='user'){var _0x5f37e3=_0x4f9274['get']({'plain':!![]});var _0x1ae9b7=_0x216d('0x4b');return db[_0x216d('0x4c')][_0x216d('0x47')]({'where':{'name':_0x1ae9b7,'userProfileId':_0x26209c[_0x216d('0x4d')]},'raw':!![]})[_0x216d('0x27')](function(_0x29efa8){if(_0x29efa8&&_0x29efa8['autoAssociation']===0x0){return db[_0x216d('0x4e')][_0x216d('0x48')]({'name':_0x5f37e3[_0x216d('0x2b')],'resourceId':_0x5f37e3['id'],'type':_0x29efa8['name'],'sectionId':_0x29efa8['id']},{})[_0x216d('0x27')](function(){return _0x4f9274;});}else{return _0x4f9274;}})[_0x216d('0x4f')](function(_0x2c7c67){logger[_0x216d('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c7c67);throw _0x2c7c67;});}return _0x4f9274;})[_0x216d('0x27')](respondWithResult(_0x3932a3,0xc9))[_0x216d('0x4f')](handleError(_0x3932a3,null));};exports[_0x216d('0x50')]=function(_0x1a4761,_0x4d7705){if(_0x1a4761[_0x216d('0x49')]['id']){delete _0x1a4761[_0x216d('0x49')]['id'];}return db['Tag'][_0x216d('0x47')]({'where':{'id':_0x1a4761['params']['id']}})[_0x216d('0x27')](handleEntityNotFound(_0x4d7705,null))[_0x216d('0x27')](saveUpdates(_0x1a4761[_0x216d('0x49')],null))[_0x216d('0x27')](respondWithResult(_0x4d7705,null))[_0x216d('0x4f')](handleError(_0x4d7705,null));};exports[_0x216d('0x51')]=function(_0x24297f,_0x2c6cb6){return db[_0x216d('0x2f')]['find']({'where':{'id':_0x24297f[_0x216d('0x52')]['id']}})[_0x216d('0x27')](handleEntityNotFound(_0x2c6cb6,null))['then'](removeEntity(_0x2c6cb6,null))[_0x216d('0x4f')](handleError(_0x2c6cb6,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index a8e6494..1543422 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 _0xf462=['api','bluebird','path','rimraf','../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash','../../config/logger'];(function(_0x45cf5d,_0x51bdb6){var _0x207ed3=function(_0x1ecf53){while(--_0x1ecf53){_0x45cf5d['push'](_0x45cf5d['shift']());}};_0x207ed3(++_0x51bdb6);}(_0xf462,0xb9));var _0x2f46=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xf462[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x2f46('0x0'));var util=require('util');var logger=require(_0x2f46('0x1'))(_0x2f46('0x2'));var moment=require('moment');var BPromise=require(_0x2f46('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f46('0x4'));var rimraf=require(_0x2f46('0x5'));var config=require(_0x2f46('0x6'));var attributes=require(_0x2f46('0x7'));module['exports']=function(_0x2f31b2,_0x11a386){return _0x2f31b2[_0x2f46('0x8')](_0x2f46('0x9'),attributes,{'tableName':_0x2f46('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f28=['tools_tags','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','exports','define'];(function(_0x4bd33b,_0x2b7fbe){var _0x5e2048=function(_0x27c634){while(--_0x27c634){_0x4bd33b['push'](_0x4bd33b['shift']());}};_0x5e2048(++_0x2b7fbe);}(_0x0f28,0x85));var _0x80f2=function(_0x1ebe2f,_0x523227){_0x1ebe2f=_0x1ebe2f-0x0;var _0xdeb06f=_0x0f28[_0x1ebe2f];return _0xdeb06f;};'use strict';var _=require(_0x80f2('0x0'));var util=require('util');var logger=require(_0x80f2('0x1'))(_0x80f2('0x2'));var moment=require(_0x80f2('0x3'));var BPromise=require(_0x80f2('0x4'));var rp=require(_0x80f2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x80f2('0x6'));var config=require(_0x80f2('0x7'));var attributes=require(_0x80f2('0x8'));module[_0x80f2('0x9')]=function(_0xbb4148,_0x35ad4f){return _0xbb4148[_0x80f2('0xa')]('Tag',attributes,{'tableName':_0x80f2('0xb'),'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 0ecd972..2e66cfc 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 _0xb7c8=['error','Tag,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x17c649,_0x4907e0){var _0x31a7fb=function(_0x43b049){while(--_0x43b049){_0x17c649['push'](_0x17c649['shift']());}};_0x31a7fb(++_0x4907e0);}(_0xb7c8,0x119));var _0x8b7c=function(_0x1a61a8,_0x2d263f){_0x1a61a8=_0x1a61a8-0x0;var _0x2387b6=_0xb7c8[_0x1a61a8];return _0x2387b6;};'use strict';var _=require('lodash');var util=require(_0x8b7c('0x0'));var moment=require(_0x8b7c('0x1'));var BPromise=require(_0x8b7c('0x2'));var rs=require(_0x8b7c('0x3'));var fs=require('fs');var Redis=require(_0x8b7c('0x4'));var db=require(_0x8b7c('0x5'))['db'];var utils=require(_0x8b7c('0x6'));var logger=require('../../config/logger')(_0x8b7c('0x7'));var config=require(_0x8b7c('0x8'));var jayson=require(_0x8b7c('0x9'));var client=jayson[_0x8b7c('0xa')][_0x8b7c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12665c,_0x7a3850,_0x3c8fd6){return new BPromise(function(_0x6afb55,_0x30a924){return client[_0x8b7c('0xc')](_0x12665c,_0x3c8fd6)[_0x8b7c('0xd')](function(_0x48370e){logger[_0x8b7c('0xe')]('Tag,\x20%s,\x20%s',_0x7a3850,_0x8b7c('0xf'));logger[_0x8b7c('0x10')]('Tag,\x20%s,\x20%s,\x20%s',_0x7a3850,_0x8b7c('0xf'),JSON[_0x8b7c('0x11')](_0x48370e));if(_0x48370e[_0x8b7c('0x12')]){if(_0x48370e['error']['code']===0x1f4){logger[_0x8b7c('0x12')](_0x8b7c('0x13'),_0x7a3850,_0x48370e[_0x8b7c('0x12')][_0x8b7c('0x14')]);return _0x30a924(_0x48370e[_0x8b7c('0x12')][_0x8b7c('0x14')]);}logger[_0x8b7c('0x12')]('Tag,\x20%s,\x20%s',_0x7a3850,_0x48370e[_0x8b7c('0x12')][_0x8b7c('0x14')]);return _0x6afb55(_0x48370e[_0x8b7c('0x12')]['message']);}else{logger[_0x8b7c('0xe')](_0x8b7c('0x13'),_0x7a3850,'request\x20sent');_0x6afb55(_0x48370e[_0x8b7c('0x15')][_0x8b7c('0x14')]);}})[_0x8b7c('0x16')](function(_0x1682fd){logger[_0x8b7c('0x12')]('Tag,\x20%s,\x20%s',_0x7a3850,_0x1682fd);_0x30a924(_0x1682fd);});});} \ No newline at end of file +var _0x495e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x3a5d55,_0x39e46b){var _0x379f1f=function(_0x48ed4b){while(--_0x48ed4b){_0x3a5d55['push'](_0x3a5d55['shift']());}};_0x379f1f(++_0x39e46b);}(_0x495e,0xfb));var _0xe495=function(_0x3b3a82,_0x53b5e0){_0x3b3a82=_0x3b3a82-0x0;var _0x267063=_0x495e[_0x3b3a82];return _0x267063;};'use strict';var _=require(_0xe495('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe495('0x1'));var rs=require(_0xe495('0x2'));var fs=require('fs');var Redis=require(_0xe495('0x3'));var db=require(_0xe495('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe495('0x5'))(_0xe495('0x6'));var config=require(_0xe495('0x7'));var jayson=require(_0xe495('0x8'));var client=jayson[_0xe495('0x9')][_0xe495('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x101a7e,_0x5745e3,_0x599ab4){return new BPromise(function(_0x5c17d0,_0x16f146){return client['request'](_0x101a7e,_0x599ab4)[_0xe495('0xb')](function(_0x3a9a00){logger[_0xe495('0xc')](_0xe495('0xd'),_0x5745e3,_0xe495('0xe'));logger['debug'](_0xe495('0xf'),_0x5745e3,_0xe495('0xe'),JSON[_0xe495('0x10')](_0x3a9a00));if(_0x3a9a00['error']){if(_0x3a9a00[_0xe495('0x11')][_0xe495('0x12')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x5745e3,_0x3a9a00[_0xe495('0x11')][_0xe495('0x13')]);return _0x16f146(_0x3a9a00['error'][_0xe495('0x13')]);}logger[_0xe495('0x11')](_0xe495('0xd'),_0x5745e3,_0x3a9a00[_0xe495('0x11')][_0xe495('0x13')]);return _0x5c17d0(_0x3a9a00['error'][_0xe495('0x13')]);}else{logger[_0xe495('0xc')](_0xe495('0xd'),_0x5745e3,_0xe495('0xe'));_0x5c17d0(_0x3a9a00[_0xe495('0x14')]['message']);}})['catch'](function(_0x4de730){logger[_0xe495('0x11')](_0xe495('0xd'),_0x5745e3,_0x4de730);_0x16f146(_0x4de730);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 92d8cf9..32d9722 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_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/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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 bb2ff84..7e693cb 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 _0xe706=['STRING','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe706,0xa3));var _0x6e70=function(_0x1fe809,_0x433222){_0x1fe809=_0x1fe809-0x0;var _0x59c58c=_0xe706[_0x1fe809];return _0x59c58c;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x33521d,_0x15b9ef){var _0x122fa9=function(_0x3b8b12){while(--_0x3b8b12){_0x33521d['push'](_0x33521d['shift']());}};_0x122fa9(++_0x15b9ef);}(_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 diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 6599ae2..c23eca2 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 _0xa745=['role','user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','Queue','capitalize','Queues','addQueues','Sequelize','add','removeQueues','remove','ids','addAgents','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','transaction','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','findAll','online','voicePause','upsert','isNil','format','SIP/%s','interface','all','Chat','removeAgents','parse','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./team.socket','register','status','end','json','offset','undefined','count','apply','reject','save','update','then','destroy','get','Teams','sendStatus','stack','name','send','index','map','Team','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','catch','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x5ca3ae,_0x1d8e4c){var _0x374bef=function(_0x53cb3b){while(--_0x53cb3b){_0x5ca3ae['push'](_0x5ca3ae['shift']());}};_0x374bef(++_0x1d8e4c);}(_0xa745,0x1b9));var _0x5a74=function(_0x46a174,_0x807c8){_0x46a174=_0x46a174-0x0;var _0xbae100=_0xa745[_0x46a174];return _0xbae100;};'use strict';var emlformat=require(_0x5a74('0x0'));var rimraf=require(_0x5a74('0x1'));var zipdir=require(_0x5a74('0x2'));var jsonpatch=require(_0x5a74('0x3'));var rp=require('request-promise');var moment=require(_0x5a74('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5a74('0x5'));var util=require(_0x5a74('0x6'));var path=require('path');var sox=require(_0x5a74('0x7'));var csv=require(_0x5a74('0x8'));var ejs=require(_0x5a74('0x9'));var fs=require('fs');var fs_extra=require(_0x5a74('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5a74('0xb'));var jsforce=require(_0x5a74('0xc'));var deskjs=require(_0x5a74('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5a74('0xe'));var Papa=require(_0x5a74('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5a74('0x10'));var as=require(_0x5a74('0x11'));var hardwareService=require(_0x5a74('0x12'));var logger=require(_0x5a74('0x13'))('api');var utils=require(_0x5a74('0x14'));var config=require(_0x5a74('0x15'));var licenseUtil=require(_0x5a74('0x16'));var db=require('../../mysqldb')['db'];config[_0x5a74('0x17')]=_['defaults'](config[_0x5a74('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x5a74('0x18'))(new Redis(config[_0x5a74('0x17')]));require(_0x5a74('0x19'))[_0x5a74('0x1a')](socket);function respondWithStatusCode(_0x5bd294,_0x178a88){_0x178a88=_0x178a88||0xcc;return function(_0x53d971){if(_0x53d971){return _0x5bd294['sendStatus'](_0x178a88);}return _0x5bd294[_0x5a74('0x1b')](_0x178a88)[_0x5a74('0x1c')]();};}function respondWithResult(_0x430c54,_0x52957f){_0x52957f=_0x52957f||0xc8;return function(_0x21de3f){if(_0x21de3f){return _0x430c54[_0x5a74('0x1b')](_0x52957f)[_0x5a74('0x1d')](_0x21de3f);}};}function respondWithFilteredResult(_0xd14596,_0x2d2147){return function(_0x104b3c){if(_0x104b3c){var _0x1b9178=typeof _0x2d2147[_0x5a74('0x1e')]===_0x5a74('0x1f')&&typeof _0x2d2147['limit']==='undefined';var _0x4349f7=_0x104b3c['count'];var _0x321e36=_0x1b9178?0x0:_0x2d2147['offset'];var _0xb935cc=_0x1b9178?_0x104b3c[_0x5a74('0x20')]:_0x2d2147['offset']+_0x2d2147['limit'];var _0x3fea73;if(_0xb935cc>=_0x4349f7){_0xb935cc=_0x4349f7;_0x3fea73=0xc8;}else{_0x3fea73=0xce;}_0xd14596[_0x5a74('0x1b')](_0x3fea73);return _0xd14596['set']('Content-Range',_0x321e36+'-'+_0xb935cc+'/'+_0x4349f7)['json'](_0x104b3c);}return null;};}function patchUpdates(_0x11a8a4){return function(_0x508d2d){try{jsonpatch[_0x5a74('0x21')](_0x508d2d,_0x11a8a4,!![]);}catch(_0x3708e3){return BPromise[_0x5a74('0x22')](_0x3708e3);}return _0x508d2d[_0x5a74('0x23')]();};}function saveUpdates(_0xba9ab1,_0x31102e){return function(_0x4bf2ee){if(_0x4bf2ee){return _0x4bf2ee[_0x5a74('0x24')](_0xba9ab1)[_0x5a74('0x25')](function(_0x4299e9){return _0x4299e9;});}return null;};}function removeEntity(_0x169abe,_0xf60e06){return function(_0x9710be){if(_0x9710be){return _0x9710be[_0x5a74('0x26')]()[_0x5a74('0x25')](function(){var _0x1f14f2=_0x9710be[_0x5a74('0x27')]({'plain':!![]});var _0x16f471=_0x5a74('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x16f471,'resourceId':_0x1f14f2['id']}})[_0x5a74('0x25')](function(){return _0x9710be;});})['then'](function(){_0x169abe[_0x5a74('0x1b')](0xcc)[_0x5a74('0x1c')]();});}};}function handleEntityNotFound(_0x340bd0,_0x493f7c){return function(_0xfb3c25){if(!_0xfb3c25){_0x340bd0[_0x5a74('0x29')](0x194);}return _0xfb3c25;};}function handleError(_0x2758d4,_0x4a9572){_0x4a9572=_0x4a9572||0x1f4;return function(_0x54fdcf){logger['error'](_0x54fdcf[_0x5a74('0x2a')]);if(_0x54fdcf[_0x5a74('0x2b')]){delete _0x54fdcf[_0x5a74('0x2b')];}_0x2758d4[_0x5a74('0x1b')](_0x4a9572)[_0x5a74('0x2c')](_0x54fdcf);};}exports[_0x5a74('0x2d')]=function(_0x5698ff,_0xdd4f92){var _0x42adb5={},_0xfa8bf9={},_0x59cee7={'count':0x0,'rows':[]};var _0x16ffe0=_[_0x5a74('0x2e')](db[_0x5a74('0x2f')][_0x5a74('0x30')],function(_0x4148dd){return{'name':_0x4148dd['fieldName'],'type':_0x4148dd[_0x5a74('0x31')][_0x5a74('0x32')]};});_0xfa8bf9[_0x5a74('0x33')]=_[_0x5a74('0x2e')](_0x16ffe0,_0x5a74('0x2b'));_0xfa8bf9[_0x5a74('0x34')]=_[_0x5a74('0x35')](_0x5698ff[_0x5a74('0x34')]);_0xfa8bf9[_0x5a74('0x36')]=_[_0x5a74('0x37')](_0xfa8bf9[_0x5a74('0x33')],_0xfa8bf9[_0x5a74('0x34')]);_0x42adb5[_0x5a74('0x38')]=_[_0x5a74('0x37')](_0xfa8bf9[_0x5a74('0x33')],qs[_0x5a74('0x39')](_0x5698ff[_0x5a74('0x34')][_0x5a74('0x39')]));_0x42adb5['attributes']=_0x42adb5[_0x5a74('0x38')][_0x5a74('0x3a')]?_0x42adb5[_0x5a74('0x38')]:_0xfa8bf9[_0x5a74('0x33')];if(!_0x5698ff[_0x5a74('0x34')][_0x5a74('0x3b')](_0x5a74('0x3c'))){_0x42adb5[_0x5a74('0x3d')]=qs[_0x5a74('0x3d')](_0x5698ff[_0x5a74('0x34')]['limit']);_0x42adb5['offset']=qs[_0x5a74('0x1e')](_0x5698ff['query'][_0x5a74('0x1e')]);}_0x42adb5[_0x5a74('0x3e')]=qs[_0x5a74('0x3f')](_0x5698ff[_0x5a74('0x34')]['sort']);_0x42adb5[_0x5a74('0x40')]=qs[_0x5a74('0x36')](_[_0x5a74('0x41')](_0x5698ff[_0x5a74('0x34')],_0xfa8bf9[_0x5a74('0x36')]),_0x16ffe0);if(_0x5698ff[_0x5a74('0x34')][_0x5a74('0x42')]){_0x42adb5[_0x5a74('0x40')]=_['merge'](_0x42adb5['where'],{'$or':_[_0x5a74('0x2e')](_0x16ffe0,function(_0x51970c){if(_0x51970c[_0x5a74('0x31')]!==_0x5a74('0x43')){var _0xa32698={};_0xa32698[_0x51970c[_0x5a74('0x2b')]]={'$like':'%'+_0x5698ff[_0x5a74('0x34')][_0x5a74('0x42')]+'%'};return _0xa32698;}})});}_0x42adb5=_[_0x5a74('0x44')]({},_0x42adb5,_0x5698ff[_0x5a74('0x45')]);var _0x139d70={'where':_0x42adb5[_0x5a74('0x40')]};return db[_0x5a74('0x2f')][_0x5a74('0x20')](_0x139d70)[_0x5a74('0x25')](function(_0x2c22c4){_0x59cee7[_0x5a74('0x20')]=_0x2c22c4;if(_0x5698ff['query']['includeAll']){_0x42adb5[_0x5a74('0x46')]=[{'all':!![]}];}return db[_0x5a74('0x2f')]['findAll'](_0x42adb5);})[_0x5a74('0x25')](function(_0x3a6812){_0x59cee7[_0x5a74('0x47')]=_0x3a6812;return _0x59cee7;})[_0x5a74('0x25')](respondWithFilteredResult(_0xdd4f92,_0x42adb5))[_0x5a74('0x48')](handleError(_0xdd4f92,null));};exports['show']=function(_0xfad3f,_0x2c4e20){var _0x557009={'raw':![],'where':{'id':_0xfad3f[_0x5a74('0x49')]['id']}},_0x63d366={};_0x63d366['model']=_[_0x5a74('0x35')](db[_0x5a74('0x2f')][_0x5a74('0x30')]);_0x63d366[_0x5a74('0x34')]=_[_0x5a74('0x35')](_0xfad3f['query']);_0x63d366['filters']=_[_0x5a74('0x37')](_0x63d366['model'],_0x63d366['query']);_0x557009[_0x5a74('0x38')]=_[_0x5a74('0x37')](_0x63d366[_0x5a74('0x33')],qs['fields'](_0xfad3f[_0x5a74('0x34')]['fields']));_0x557009['attributes']=_0x557009[_0x5a74('0x38')][_0x5a74('0x3a')]?_0x557009['attributes']:_0x63d366[_0x5a74('0x33')];if(_0xfad3f[_0x5a74('0x34')][_0x5a74('0x4a')]){_0x557009[_0x5a74('0x46')]=[{'all':!![]}];}_0x557009=_[_0x5a74('0x44')]({},_0x557009,_0xfad3f[_0x5a74('0x45')]);return db['Team'][_0x5a74('0x4b')](_0x557009)[_0x5a74('0x25')](handleEntityNotFound(_0x2c4e20,null))[_0x5a74('0x25')](respondWithResult(_0x2c4e20,null))[_0x5a74('0x48')](handleError(_0x2c4e20,null));};exports[_0x5a74('0x4c')]=function(_0x4e4543,_0x2a49d8){return db[_0x5a74('0x2f')][_0x5a74('0x4c')](_0x4e4543[_0x5a74('0x4d')],{})[_0x5a74('0x25')](function(_0x762359){var _0x12164e=_0x4e4543['user'][_0x5a74('0x27')]({'plain':!![]});if(!_0x12164e)throw new Error(_0x5a74('0x4e'));if(_0x12164e[_0x5a74('0x4f')]===_0x5a74('0x50')){var _0x29ec2e=_0x762359['get']({'plain':!![]});var _0x1c6da4=_0x5a74('0x28');return db['UserProfileSection'][_0x5a74('0x4b')]({'where':{'name':_0x1c6da4,'userProfileId':_0x12164e[_0x5a74('0x51')]},'raw':!![]})[_0x5a74('0x25')](function(_0x15397d){if(_0x15397d&&_0x15397d['autoAssociation']===0x0){return db['UserProfileResource'][_0x5a74('0x4c')]({'name':_0x29ec2e[_0x5a74('0x2b')],'resourceId':_0x29ec2e['id'],'type':_0x15397d[_0x5a74('0x2b')],'sectionId':_0x15397d['id']},{})[_0x5a74('0x25')](function(){return _0x762359;});}else{return _0x762359;}})[_0x5a74('0x48')](function(_0x164933){logger[_0x5a74('0x52')](_0x5a74('0x53'),_0x164933);throw _0x164933;});}return _0x762359;})['then'](respondWithResult(_0x2a49d8,0xc9))['catch'](handleError(_0x2a49d8,null));};exports[_0x5a74('0x24')]=function(_0x103325,_0xfc0572){if(_0x103325[_0x5a74('0x4d')]['id']){delete _0x103325[_0x5a74('0x4d')]['id'];}return db[_0x5a74('0x2f')]['find']({'where':{'id':_0x103325[_0x5a74('0x49')]['id']}})[_0x5a74('0x25')](handleEntityNotFound(_0xfc0572,null))['then'](saveUpdates(_0x103325[_0x5a74('0x4d')],null))[_0x5a74('0x25')](respondWithResult(_0xfc0572,null))['catch'](handleError(_0xfc0572,null));};exports['destroy']=function(_0x20ed5a,_0x3a51ae){return db['Team'][_0x5a74('0x4b')]({'where':{'id':_0x20ed5a['params']['id']}})[_0x5a74('0x25')](handleEntityNotFound(_0x3a51ae,null))[_0x5a74('0x25')](removeEntity(_0x3a51ae,null))['catch'](handleError(_0x3a51ae,null));};exports[_0x5a74('0x54')]=function(_0x5573b8,_0x3b0804,_0x12d3d3){return db[_0x5a74('0x2f')][_0x5a74('0x55')]({'where':{'id':_0x5573b8['params']['id']}})[_0x5a74('0x25')](handleEntityNotFound(_0x3b0804,null))[_0x5a74('0x25')](function(_0x2649b0){if(!_0x5573b8['query'][_0x5a74('0x56')]||!utils[_0x5a74('0x57')](_0x5573b8['query'][_0x5a74('0x56')])){throw new db['Sequelize'][(_0x5a74('0x58'))](_0x5a74('0x59'));}var _0x164264={};var _0x31f701={};_0x31f701['model']=_[_0x5a74('0x35')](db[_['capitalize'](_0x5573b8['query']['channel'][_0x5a74('0x5a')]())+_0x5a74('0x5b')]['rawAttributes']);_0x31f701['query']=_[_0x5a74('0x35')](_0x5573b8[_0x5a74('0x34')]);_0x31f701[_0x5a74('0x36')]=_[_0x5a74('0x37')](_0x31f701[_0x5a74('0x33')],_0x31f701[_0x5a74('0x34')]);_0x164264[_0x5a74('0x38')]=_['intersection'](_0x31f701[_0x5a74('0x33')],qs[_0x5a74('0x39')](_0x5573b8[_0x5a74('0x34')][_0x5a74('0x39')]));_0x164264['attributes']=_0x164264['attributes'][_0x5a74('0x3a')]?_0x164264['attributes']:_0x31f701[_0x5a74('0x33')];_0x164264[_0x5a74('0x3d')]=qs['limit'](_0x5573b8[_0x5a74('0x34')]['limit']);_0x164264[_0x5a74('0x1e')]=qs['offset'](_0x5573b8[_0x5a74('0x34')][_0x5a74('0x1e')]);_0x164264[_0x5a74('0x3e')]=qs['sort'](_0x5573b8[_0x5a74('0x34')][_0x5a74('0x3f')]);_0x164264['where']=qs[_0x5a74('0x36')](_[_0x5a74('0x41')](_0x5573b8[_0x5a74('0x34')],_0x31f701[_0x5a74('0x36')]));_0x164264=_['merge']({},_0x164264,_0x5573b8[_0x5a74('0x45')]);return _0x2649b0[_0x5a74('0x27')+_[_0x5a74('0x5c')](_0x5573b8['query']['channel'][_0x5a74('0x5a')]())+_0x5a74('0x5d')](_0x164264);})[_0x5a74('0x25')](respondWithResult(_0x3b0804,null))[_0x5a74('0x48')](handleError(_0x3b0804,null));};exports[_0x5a74('0x5e')]=function(_0x4fe690,_0x55f0b4,_0x31cf59){return db[_0x5a74('0x2f')][_0x5a74('0x55')]({'where':{'id':_0x4fe690[_0x5a74('0x49')]['id']}})['then'](function(_0x10d786){if(_0x10d786){if(!_0x4fe690[_0x5a74('0x4d')][_0x5a74('0x56')]||!utils[_0x5a74('0x57')](_0x4fe690[_0x5a74('0x4d')][_0x5a74('0x56')])){throw new db[(_0x5a74('0x5f'))]['ValidationError'](_0x5a74('0x59'));}return _0x10d786[_0x5a74('0x60')+_[_0x5a74('0x5c')](_0x4fe690[_0x5a74('0x4d')][_0x5a74('0x56')][_0x5a74('0x5a')]())+_0x5a74('0x5d')](_0x4fe690[_0x5a74('0x4d')]['ids']);}return null;})[_0x5a74('0x25')](handleEntityNotFound(_0x55f0b4,null))[_0x5a74('0x25')](respondWithStatusCode(_0x55f0b4,null))[_0x5a74('0x48')](handleError(_0x55f0b4,null));};exports[_0x5a74('0x61')]=function(_0x3419ec,_0x198e7d,_0x260790){return db['Team'][_0x5a74('0x55')]({'where':{'id':_0x3419ec[_0x5a74('0x49')]['id']}})[_0x5a74('0x25')](function(_0x5e873f){if(_0x5e873f){if(!_0x3419ec[_0x5a74('0x34')][_0x5a74('0x56')]||!utils['isValidChannel'](_0x3419ec['query'][_0x5a74('0x56')])){throw new db[(_0x5a74('0x5f'))][(_0x5a74('0x58'))](_0x5a74('0x59'));}return _0x5e873f[_0x5a74('0x62')+_[_0x5a74('0x5c')](_0x3419ec[_0x5a74('0x34')][_0x5a74('0x56')][_0x5a74('0x5a')]())+'Queues'](_0x3419ec['query'][_0x5a74('0x63')]);}return null;})['then'](handleEntityNotFound(_0x198e7d,null))[_0x5a74('0x25')](respondWithStatusCode(_0x198e7d,null))['catch'](handleError(_0x198e7d,null));};exports[_0x5a74('0x64')]=function(_0x2d1da1,_0x3b473c){return db[_0x5a74('0x2f')][_0x5a74('0x4b')]({'where':{'id':_0x2d1da1[_0x5a74('0x49')]['id']}})['then'](handleEntityNotFound(_0x3b473c,null))[_0x5a74('0x25')](function(_0x465408){if(_0x465408){var _0x16f13c=[_0x5a74('0x65'),'Chat',_0x5a74('0x66'),_0x5a74('0x67'),_0x5a74('0x68'),_0x5a74('0x69'),_0x5a74('0x6a')];return db[_0x5a74('0x6b')][_0x5a74('0x6c')](function(_0x1322ee){var _0x10fd51=_[_0x5a74('0x2e')](_0x16f13c,function(_0x519f11){var _0xd03a29={'attributes':['id',_0x5a74('0x2b')]};if(_0x519f11===_0x5a74('0x65')){_0xd03a29[_0x5a74('0x6d')]={'attributes':[_0x5a74('0x6e')]};}return _0x465408['get'+_0x519f11+'Queues'](_0xd03a29)[_0x5a74('0x25')](function(_0x7eac9d){var _0x133e87=_['map'](_0x7eac9d,function(_0x2531bc){var _0x3d3df4=_[_0x5a74('0x2e')](_0x2d1da1['body']['ids'],function(_0x43c916){var _0x49bb84={'where':{'UserId':_0x43c916,[_0x519f11+_0x5a74('0x6f')]:_0x2531bc['id']},'transaction':_0x1322ee};if(_0x519f11===_0x5a74('0x65')){_0x49bb84['defaults']={'penalty':_0x2531bc[_0x5a74('0x70')][_0x5a74('0x6e')]};}return db[_0x5a74('0x71')+_0x519f11+_0x5a74('0x5b')][_0x5a74('0x72')](_0x49bb84)[_0x5a74('0x25')](function(){socket[_0x5a74('0x73')](_0x5a74('0x50')+_0x519f11+_0x5a74('0x74'),{'UserId':_0x43c916,[_0x519f11+_0x5a74('0x6f')]:_0x2531bc['id']});if(_0x519f11!=='Voice')return;return db[_0x5a74('0x71')][_0x5a74('0x75')]({'where':{'id':_0x2d1da1[_0x5a74('0x4d')][_0x5a74('0x63')],'online':0x1},'attributes':['id','name',_0x5a74('0x76'),_0x5a74('0x77'),'interface'],'raw':!![]})[_0x5a74('0x25')](function(_0xac9aee){var _0x51f3bc=_[_0x5a74('0x2e')](_0xac9aee,function(_0x42faa1){return db['UserVoiceQueueRt'][_0x5a74('0x78')]({'membername':_0x42faa1[_0x5a74('0x2b')],'UserId':_0x42faa1['id'],'queue_name':_0x2531bc[_0x5a74('0x2b')],'VoiceQueueId':_0x2531bc['id'],'interface':_[_0x5a74('0x79')](_0x42faa1['interface'])?util[_0x5a74('0x7a')](_0x5a74('0x7b'),_0x42faa1[_0x5a74('0x2b')]):_0x42faa1[_0x5a74('0x7c')],'paused':_0x42faa1[_0x5a74('0x77')]||![],'penalty':_0x2531bc[_0x5a74('0x70')][_0x5a74('0x6e')]},{'transaction':_0x1322ee});});return Promise['all'](_0x51f3bc);});});});return Promise['all'](_0x3d3df4);});return Promise[_0x5a74('0x7d')](_0x133e87);});});return Promise[_0x5a74('0x7d')](_0x10fd51)[_0x5a74('0x25')](function(){return _0x465408[_0x5a74('0x64')](_0x2d1da1[_0x5a74('0x4d')][_0x5a74('0x63')],{'transaction':_0x1322ee})['spread'](function(_0x1ae329){return _0x1ae329;});});});}})[_0x5a74('0x25')](respondWithResult(_0x3b473c,null))[_0x5a74('0x48')](handleError(_0x3b473c,null));};exports['removeAgents']=function(_0x154897,_0x1eb5f2){return db['Team'][_0x5a74('0x4b')]({'where':{'id':_0x154897[_0x5a74('0x49')]['id']}})[_0x5a74('0x25')](handleEntityNotFound(_0x1eb5f2,null))[_0x5a74('0x25')](function(_0x4dfb9b){if(_0x4dfb9b){var _0x361541=[_0x5a74('0x65'),_0x5a74('0x7e'),_0x5a74('0x66'),_0x5a74('0x67'),_0x5a74('0x68'),'Openchannel','Whatsapp'];return db[_0x5a74('0x6b')][_0x5a74('0x6c')](function(_0xcb0cf4){var _0x5d05d2=_[_0x5a74('0x2e')](_0x361541,function(_0x168697){var _0x3d1166={'attributes':['id',_0x5a74('0x2b')]};return _0x4dfb9b['get'+_0x168697+'Queues'](_0x3d1166)['then'](function(_0x3854ec){var _0xd4423e=_['map'](_0x3854ec,function(_0x16d710){return _0x16d710[_0x5a74('0x7f')](_0x154897[_0x5a74('0x34')][_0x5a74('0x63')],{'transaction':_0xcb0cf4})[_0x5a74('0x25')](function(){var _0x3cc480=JSON[_0x5a74('0x80')]('['+_0x154897[_0x5a74('0x34')][_0x5a74('0x63')]+']');var _0x400868=_[_0x5a74('0x2e')](_0x3cc480,function(_0x3a11a9){socket[_0x5a74('0x73')](_0x5a74('0x50')+_0x168697+'Queue:remove',{'UserId':Number(_0x3a11a9),[_0x168697+_0x5a74('0x6f')]:_0x16d710['id']});if(_0x168697!==_0x5a74('0x65'))return;return db['UserVoiceQueueRt'][_0x5a74('0x26')]({'where':{'VoiceQueueId':_0x16d710['id'],'UserId':_0x3a11a9},'transaction':_0xcb0cf4});});return Promise['all'](_0x400868);});});return Promise['all'](_0xd4423e);});});return Promise['all'](_0x5d05d2)['then'](function(){return _0x4dfb9b[_0x5a74('0x7f')](_0x154897[_0x5a74('0x34')][_0x5a74('0x63')],{'transaction':_0xcb0cf4});});});}})['then'](respondWithStatusCode(_0x1eb5f2,null))['catch'](handleError(_0x1eb5f2,null));};exports['getAgents']=function(_0x3001b3,_0x1c34ce,_0x442c55){var _0x43c105={};var _0x5664f4={};var _0x34ccd8;var _0x14caef;return db['Team'][_0x5a74('0x55')]({'where':{'id':_0x3001b3[_0x5a74('0x49')]['id']}})['then'](handleEntityNotFound(_0x1c34ce,null))[_0x5a74('0x25')](function(_0xcc22bb){if(_0xcc22bb){_0x34ccd8=_0xcc22bb;_0x5664f4[_0x5a74('0x33')]=_[_0x5a74('0x35')](db[_0x5a74('0x71')][_0x5a74('0x30')]);_0x5664f4[_0x5a74('0x34')]=_[_0x5a74('0x35')](_0x3001b3[_0x5a74('0x34')]);_0x5664f4['filters']=_[_0x5a74('0x37')](_0x5664f4['model'],_0x5664f4[_0x5a74('0x34')]);_0x43c105[_0x5a74('0x38')]=_['intersection'](_0x5664f4[_0x5a74('0x33')],qs[_0x5a74('0x39')](_0x3001b3['query']['fields']));_0x43c105['attributes']=_0x43c105[_0x5a74('0x38')]['length']?_0x43c105[_0x5a74('0x38')]:_0x5664f4['model'];_0x43c105[_0x5a74('0x3e')]=qs[_0x5a74('0x3f')](_0x3001b3[_0x5a74('0x34')]['sort']);_0x43c105['where']=qs[_0x5a74('0x36')](_[_0x5a74('0x41')](_0x3001b3[_0x5a74('0x34')],_0x5664f4[_0x5a74('0x36')]));if(_0x3001b3[_0x5a74('0x34')][_0x5a74('0x42')]){_0x43c105[_0x5a74('0x40')]=_[_0x5a74('0x44')](_0x43c105[_0x5a74('0x40')],{'$or':_[_0x5a74('0x2e')](_0x43c105[_0x5a74('0x38')],function(_0x5e6fc1){var _0x2cf814={};_0x2cf814[_0x5e6fc1]={'$like':'%'+_0x3001b3[_0x5a74('0x34')]['filter']+'%'};return _0x2cf814;})});}_0x43c105=_[_0x5a74('0x44')]({},_0x43c105,_0x3001b3[_0x5a74('0x45')]);return _0x34ccd8[_0x5a74('0x81')](_0x43c105);}})[_0x5a74('0x25')](function(_0x25fc89){if(_0x25fc89){_0x14caef=_0x25fc89[_0x5a74('0x3a')];if(!_0x3001b3[_0x5a74('0x34')][_0x5a74('0x3b')](_0x5a74('0x3c'))){_0x43c105[_0x5a74('0x3d')]=qs[_0x5a74('0x3d')](_0x3001b3['query']['limit']);_0x43c105[_0x5a74('0x1e')]=qs['offset'](_0x3001b3['query'][_0x5a74('0x1e')]);}return _0x34ccd8['getAgents'](_0x43c105);}})[_0x5a74('0x25')](function(_0x570eea){if(_0x570eea){return _0x570eea?{'count':_0x14caef,'rows':_0x570eea}:null;}})['then'](respondWithResult(_0x1c34ce,null))[_0x5a74('0x48')](handleError(_0x1c34ce,null));}; \ No newline at end of file +var _0xefe5=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','channel','ValidationError','Unknown\x20channel','capitalize','Queue','toLowerCase','isValidChannel','Sequelize','add','ids','remove','Queues','addAgents','Voice','Chat','Sms','Fax','Whatsapp','transaction','penalty','QueueId','TeamVoiceQueue','emit','Queue:save','findAll','online','voicePause','interface','isNil','SIP/%s','all','spread','removeAgents','Mail','Openchannel','sequelize','parse','Queue:remove','UserVoiceQueueRt','getAgents','User','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','save','update','then','destroy','get','Teams','UserProfileResource','stack','name','index','map','Team','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','rows','catch','params','rawAttributes','includeAll','merge','find'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xefe5,0x1c6));var _0x5efe=function(_0x4d9c1c,_0x10051b){_0x4d9c1c=_0x4d9c1c-0x0;var _0xb7adfd=_0xefe5[_0x4d9c1c];return _0xb7adfd;};'use strict';var emlformat=require(_0x5efe('0x0'));var rimraf=require(_0x5efe('0x1'));var zipdir=require(_0x5efe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5efe('0x3'));var moment=require(_0x5efe('0x4'));var BPromise=require(_0x5efe('0x5'));var Mustache=require(_0x5efe('0x6'));var util=require(_0x5efe('0x7'));var path=require(_0x5efe('0x8'));var sox=require(_0x5efe('0x9'));var csv=require('to-csv');var ejs=require(_0x5efe('0xa'));var fs=require('fs');var fs_extra=require(_0x5efe('0xb'));var _=require('lodash');var squel=require(_0x5efe('0xc'));var crypto=require(_0x5efe('0xd'));var jsforce=require(_0x5efe('0xe'));var deskjs=require(_0x5efe('0xf'));var toCsv=require(_0x5efe('0x10'));var querystring=require(_0x5efe('0x11'));var Papa=require(_0x5efe('0x12'));var Redis=require(_0x5efe('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5efe('0x14'));var hardwareService=require(_0x5efe('0x15'));var logger=require(_0x5efe('0x16'))(_0x5efe('0x17'));var utils=require(_0x5efe('0x18'));var config=require(_0x5efe('0x19'));var licenseUtil=require(_0x5efe('0x1a'));var db=require(_0x5efe('0x1b'))['db'];config[_0x5efe('0x1c')]=_[_0x5efe('0x1d')](config['redis'],{'host':_0x5efe('0x1e'),'port':0x18eb});var socket=require(_0x5efe('0x1f'))(new Redis(config[_0x5efe('0x1c')]));require('./team.socket')[_0x5efe('0x20')](socket);function respondWithStatusCode(_0x736304,_0x2c27b3){_0x2c27b3=_0x2c27b3||0xcc;return function(_0x35042c){if(_0x35042c){return _0x736304[_0x5efe('0x21')](_0x2c27b3);}return _0x736304[_0x5efe('0x22')](_0x2c27b3)[_0x5efe('0x23')]();};}function respondWithResult(_0x325c2a,_0x34f285){_0x34f285=_0x34f285||0xc8;return function(_0x304ceb){if(_0x304ceb){return _0x325c2a[_0x5efe('0x22')](_0x34f285)[_0x5efe('0x24')](_0x304ceb);}};}function respondWithFilteredResult(_0x7ef0ce,_0x16b201){return function(_0x4dbf3d){if(_0x4dbf3d){var _0x45a70d=typeof _0x16b201['offset']===_0x5efe('0x25')&&typeof _0x16b201['limit']===_0x5efe('0x25');var _0x1b0e94=_0x4dbf3d['count'];var _0x296f66=_0x45a70d?0x0:_0x16b201[_0x5efe('0x26')];var _0x418f84=_0x45a70d?_0x4dbf3d[_0x5efe('0x27')]:_0x16b201['offset']+_0x16b201[_0x5efe('0x28')];var _0x4fefd5;if(_0x418f84>=_0x1b0e94){_0x418f84=_0x1b0e94;_0x4fefd5=0xc8;}else{_0x4fefd5=0xce;}_0x7ef0ce[_0x5efe('0x22')](_0x4fefd5);return _0x7ef0ce['set'](_0x5efe('0x29'),_0x296f66+'-'+_0x418f84+'/'+_0x1b0e94)[_0x5efe('0x24')](_0x4dbf3d);}return null;};}function patchUpdates(_0x4786d2){return function(_0x2d7fce){try{jsonpatch['apply'](_0x2d7fce,_0x4786d2,!![]);}catch(_0xf275d2){return BPromise['reject'](_0xf275d2);}return _0x2d7fce[_0x5efe('0x2a')]();};}function saveUpdates(_0x59bab1,_0x5d82ee){return function(_0x20c308){if(_0x20c308){return _0x20c308[_0x5efe('0x2b')](_0x59bab1)[_0x5efe('0x2c')](function(_0x2a616d){return _0x2a616d;});}return null;};}function removeEntity(_0x4156b2,_0x790568){return function(_0x87897b){if(_0x87897b){return _0x87897b[_0x5efe('0x2d')]()['then'](function(){var _0xa388c=_0x87897b[_0x5efe('0x2e')]({'plain':!![]});var _0x4ba688=_0x5efe('0x2f');return db[_0x5efe('0x30')][_0x5efe('0x2d')]({'where':{'type':_0x4ba688,'resourceId':_0xa388c['id']}})['then'](function(){return _0x87897b;});})[_0x5efe('0x2c')](function(){_0x4156b2['status'](0xcc)[_0x5efe('0x23')]();});}};}function handleEntityNotFound(_0x36c9d5,_0x382e3a){return function(_0x316741){if(!_0x316741){_0x36c9d5[_0x5efe('0x21')](0x194);}return _0x316741;};}function handleError(_0x3d2117,_0x4ce9e0){_0x4ce9e0=_0x4ce9e0||0x1f4;return function(_0x5b77a7){logger['error'](_0x5b77a7[_0x5efe('0x31')]);if(_0x5b77a7[_0x5efe('0x32')]){delete _0x5b77a7[_0x5efe('0x32')];}_0x3d2117[_0x5efe('0x22')](_0x4ce9e0)['send'](_0x5b77a7);};}exports[_0x5efe('0x33')]=function(_0x2514b7,_0x281761){var _0x3e0f54={},_0x4b092d={},_0x27d1cf={'count':0x0,'rows':[]};var _0x2e0578=_[_0x5efe('0x34')](db[_0x5efe('0x35')]['rawAttributes'],function(_0x362202){return{'name':_0x362202[_0x5efe('0x36')],'type':_0x362202[_0x5efe('0x37')][_0x5efe('0x38')]};});_0x4b092d['model']=_['map'](_0x2e0578,_0x5efe('0x32'));_0x4b092d['query']=_[_0x5efe('0x39')](_0x2514b7[_0x5efe('0x3a')]);_0x4b092d[_0x5efe('0x3b')]=_[_0x5efe('0x3c')](_0x4b092d[_0x5efe('0x3d')],_0x4b092d[_0x5efe('0x3a')]);_0x3e0f54[_0x5efe('0x3e')]=_['intersection'](_0x4b092d[_0x5efe('0x3d')],qs[_0x5efe('0x3f')](_0x2514b7['query'][_0x5efe('0x3f')]));_0x3e0f54[_0x5efe('0x3e')]=_0x3e0f54[_0x5efe('0x3e')][_0x5efe('0x40')]?_0x3e0f54[_0x5efe('0x3e')]:_0x4b092d[_0x5efe('0x3d')];if(!_0x2514b7[_0x5efe('0x3a')][_0x5efe('0x41')](_0x5efe('0x42'))){_0x3e0f54[_0x5efe('0x28')]=qs[_0x5efe('0x28')](_0x2514b7[_0x5efe('0x3a')][_0x5efe('0x28')]);_0x3e0f54[_0x5efe('0x26')]=qs[_0x5efe('0x26')](_0x2514b7[_0x5efe('0x3a')][_0x5efe('0x26')]);}_0x3e0f54[_0x5efe('0x43')]=qs[_0x5efe('0x44')](_0x2514b7[_0x5efe('0x3a')][_0x5efe('0x44')]);_0x3e0f54[_0x5efe('0x45')]=qs[_0x5efe('0x3b')](_[_0x5efe('0x46')](_0x2514b7['query'],_0x4b092d[_0x5efe('0x3b')]),_0x2e0578);if(_0x2514b7[_0x5efe('0x3a')][_0x5efe('0x47')]){_0x3e0f54[_0x5efe('0x45')]=_['merge'](_0x3e0f54[_0x5efe('0x45')],{'$or':_['map'](_0x2e0578,function(_0x517a1e){if(_0x517a1e[_0x5efe('0x37')]!==_0x5efe('0x48')){var _0x32edd5={};_0x32edd5[_0x517a1e[_0x5efe('0x32')]]={'$like':'%'+_0x2514b7[_0x5efe('0x3a')][_0x5efe('0x47')]+'%'};return _0x32edd5;}})});}_0x3e0f54=_['merge']({},_0x3e0f54,_0x2514b7[_0x5efe('0x49')]);var _0x54ca61={'where':_0x3e0f54['where']};return db['Team'][_0x5efe('0x27')](_0x54ca61)['then'](function(_0x1dc3ce){_0x27d1cf[_0x5efe('0x27')]=_0x1dc3ce;if(_0x2514b7['query']['includeAll']){_0x3e0f54[_0x5efe('0x4a')]=[{'all':!![]}];}return db[_0x5efe('0x35')]['findAll'](_0x3e0f54);})[_0x5efe('0x2c')](function(_0x14739c){_0x27d1cf[_0x5efe('0x4b')]=_0x14739c;return _0x27d1cf;})[_0x5efe('0x2c')](respondWithFilteredResult(_0x281761,_0x3e0f54))[_0x5efe('0x4c')](handleError(_0x281761,null));};exports['show']=function(_0x32aa17,_0x453ed0){var _0x3ff5cf={'raw':![],'where':{'id':_0x32aa17[_0x5efe('0x4d')]['id']}},_0x5a772b={};_0x5a772b[_0x5efe('0x3d')]=_[_0x5efe('0x39')](db['Team'][_0x5efe('0x4e')]);_0x5a772b['query']=_[_0x5efe('0x39')](_0x32aa17['query']);_0x5a772b[_0x5efe('0x3b')]=_[_0x5efe('0x3c')](_0x5a772b['model'],_0x5a772b['query']);_0x3ff5cf[_0x5efe('0x3e')]=_[_0x5efe('0x3c')](_0x5a772b[_0x5efe('0x3d')],qs[_0x5efe('0x3f')](_0x32aa17[_0x5efe('0x3a')][_0x5efe('0x3f')]));_0x3ff5cf[_0x5efe('0x3e')]=_0x3ff5cf[_0x5efe('0x3e')]['length']?_0x3ff5cf[_0x5efe('0x3e')]:_0x5a772b['model'];if(_0x32aa17['query'][_0x5efe('0x4f')]){_0x3ff5cf[_0x5efe('0x4a')]=[{'all':!![]}];}_0x3ff5cf=_[_0x5efe('0x50')]({},_0x3ff5cf,_0x32aa17['options']);return db['Team'][_0x5efe('0x51')](_0x3ff5cf)['then'](handleEntityNotFound(_0x453ed0,null))['then'](respondWithResult(_0x453ed0,null))[_0x5efe('0x4c')](handleError(_0x453ed0,null));};exports[_0x5efe('0x52')]=function(_0x26b62e,_0x2ccdc8){return db[_0x5efe('0x35')][_0x5efe('0x52')](_0x26b62e[_0x5efe('0x53')],{})[_0x5efe('0x2c')](function(_0x5a3215){var _0x3d1666=_0x26b62e[_0x5efe('0x54')][_0x5efe('0x2e')]({'plain':!![]});if(!_0x3d1666)throw new Error(_0x5efe('0x55'));if(_0x3d1666[_0x5efe('0x56')]===_0x5efe('0x54')){var _0x1dbd3e=_0x5a3215['get']({'plain':!![]});var _0x2c97db=_0x5efe('0x2f');return db[_0x5efe('0x57')][_0x5efe('0x51')]({'where':{'name':_0x2c97db,'userProfileId':_0x3d1666[_0x5efe('0x58')]},'raw':!![]})[_0x5efe('0x2c')](function(_0x2e7dc1){if(_0x2e7dc1&&_0x2e7dc1[_0x5efe('0x59')]===0x0){return db[_0x5efe('0x30')][_0x5efe('0x52')]({'name':_0x1dbd3e['name'],'resourceId':_0x1dbd3e['id'],'type':_0x2e7dc1['name'],'sectionId':_0x2e7dc1['id']},{})[_0x5efe('0x2c')](function(){return _0x5a3215;});}else{return _0x5a3215;}})[_0x5efe('0x4c')](function(_0x213788){logger[_0x5efe('0x5a')](_0x5efe('0x5b'),_0x213788);throw _0x213788;});}return _0x5a3215;})['then'](respondWithResult(_0x2ccdc8,0xc9))[_0x5efe('0x4c')](handleError(_0x2ccdc8,null));};exports[_0x5efe('0x2b')]=function(_0x330bd0,_0x4f56f8){if(_0x330bd0['body']['id']){delete _0x330bd0[_0x5efe('0x53')]['id'];}return db[_0x5efe('0x35')][_0x5efe('0x51')]({'where':{'id':_0x330bd0[_0x5efe('0x4d')]['id']}})[_0x5efe('0x2c')](handleEntityNotFound(_0x4f56f8,null))[_0x5efe('0x2c')](saveUpdates(_0x330bd0[_0x5efe('0x53')],null))[_0x5efe('0x2c')](respondWithResult(_0x4f56f8,null))[_0x5efe('0x4c')](handleError(_0x4f56f8,null));};exports[_0x5efe('0x2d')]=function(_0x2200f0,_0x26a901){return db['Team']['find']({'where':{'id':_0x2200f0[_0x5efe('0x4d')]['id']}})[_0x5efe('0x2c')](handleEntityNotFound(_0x26a901,null))[_0x5efe('0x2c')](removeEntity(_0x26a901,null))[_0x5efe('0x4c')](handleError(_0x26a901,null));};exports['getQueues']=function(_0x460f75,_0x6194e5,_0x23af0e){return db[_0x5efe('0x35')][_0x5efe('0x5c')]({'where':{'id':_0x460f75[_0x5efe('0x4d')]['id']}})[_0x5efe('0x2c')](handleEntityNotFound(_0x6194e5,null))['then'](function(_0x14e939){if(!_0x460f75[_0x5efe('0x3a')]['channel']||!utils['isValidChannel'](_0x460f75[_0x5efe('0x3a')][_0x5efe('0x5d')])){throw new db['Sequelize'][(_0x5efe('0x5e'))](_0x5efe('0x5f'));}var _0x41653f={};var _0x651bab={};_0x651bab[_0x5efe('0x3d')]=_[_0x5efe('0x39')](db[_[_0x5efe('0x60')](_0x460f75['query'][_0x5efe('0x5d')]['toLowerCase']())+_0x5efe('0x61')][_0x5efe('0x4e')]);_0x651bab['query']=_['keys'](_0x460f75[_0x5efe('0x3a')]);_0x651bab[_0x5efe('0x3b')]=_[_0x5efe('0x3c')](_0x651bab[_0x5efe('0x3d')],_0x651bab[_0x5efe('0x3a')]);_0x41653f['attributes']=_[_0x5efe('0x3c')](_0x651bab[_0x5efe('0x3d')],qs[_0x5efe('0x3f')](_0x460f75[_0x5efe('0x3a')][_0x5efe('0x3f')]));_0x41653f[_0x5efe('0x3e')]=_0x41653f[_0x5efe('0x3e')][_0x5efe('0x40')]?_0x41653f['attributes']:_0x651bab[_0x5efe('0x3d')];_0x41653f[_0x5efe('0x28')]=qs[_0x5efe('0x28')](_0x460f75[_0x5efe('0x3a')][_0x5efe('0x28')]);_0x41653f[_0x5efe('0x26')]=qs[_0x5efe('0x26')](_0x460f75[_0x5efe('0x3a')][_0x5efe('0x26')]);_0x41653f[_0x5efe('0x43')]=qs['sort'](_0x460f75['query'][_0x5efe('0x44')]);_0x41653f['where']=qs[_0x5efe('0x3b')](_[_0x5efe('0x46')](_0x460f75[_0x5efe('0x3a')],_0x651bab[_0x5efe('0x3b')]));_0x41653f=_[_0x5efe('0x50')]({},_0x41653f,_0x460f75['options']);return _0x14e939[_0x5efe('0x2e')+_[_0x5efe('0x60')](_0x460f75[_0x5efe('0x3a')]['channel'][_0x5efe('0x62')]())+'Queues'](_0x41653f);})[_0x5efe('0x2c')](respondWithResult(_0x6194e5,null))[_0x5efe('0x4c')](handleError(_0x6194e5,null));};exports['addQueues']=function(_0x3cb43c,_0x9764e5,_0x41f15a){return db['Team']['findOne']({'where':{'id':_0x3cb43c[_0x5efe('0x4d')]['id']}})[_0x5efe('0x2c')](function(_0x9e8a1a){if(_0x9e8a1a){if(!_0x3cb43c['body'][_0x5efe('0x5d')]||!utils[_0x5efe('0x63')](_0x3cb43c[_0x5efe('0x53')][_0x5efe('0x5d')])){throw new db[(_0x5efe('0x64'))][(_0x5efe('0x5e'))](_0x5efe('0x5f'));}return _0x9e8a1a[_0x5efe('0x65')+_[_0x5efe('0x60')](_0x3cb43c[_0x5efe('0x53')][_0x5efe('0x5d')][_0x5efe('0x62')]())+'Queues'](_0x3cb43c[_0x5efe('0x53')][_0x5efe('0x66')]);}return null;})[_0x5efe('0x2c')](handleEntityNotFound(_0x9764e5,null))[_0x5efe('0x2c')](respondWithStatusCode(_0x9764e5,null))[_0x5efe('0x4c')](handleError(_0x9764e5,null));};exports['removeQueues']=function(_0x3b8e48,_0x3a265e,_0x6dcbbf){return db[_0x5efe('0x35')]['findOne']({'where':{'id':_0x3b8e48[_0x5efe('0x4d')]['id']}})[_0x5efe('0x2c')](function(_0x13e804){if(_0x13e804){if(!_0x3b8e48[_0x5efe('0x3a')]['channel']||!utils['isValidChannel'](_0x3b8e48[_0x5efe('0x3a')][_0x5efe('0x5d')])){throw new db['Sequelize'][(_0x5efe('0x5e'))]('Unknown\x20channel');}return _0x13e804[_0x5efe('0x67')+_[_0x5efe('0x60')](_0x3b8e48['query'][_0x5efe('0x5d')][_0x5efe('0x62')]())+_0x5efe('0x68')](_0x3b8e48[_0x5efe('0x3a')][_0x5efe('0x66')]);}return null;})[_0x5efe('0x2c')](handleEntityNotFound(_0x3a265e,null))[_0x5efe('0x2c')](respondWithStatusCode(_0x3a265e,null))[_0x5efe('0x4c')](handleError(_0x3a265e,null));};exports[_0x5efe('0x69')]=function(_0x5f5c33,_0x39af62){return db[_0x5efe('0x35')][_0x5efe('0x51')]({'where':{'id':_0x5f5c33[_0x5efe('0x4d')]['id']}})[_0x5efe('0x2c')](handleEntityNotFound(_0x39af62,null))[_0x5efe('0x2c')](function(_0x43b745){if(_0x43b745){var _0x541fc5=[_0x5efe('0x6a'),_0x5efe('0x6b'),'Mail',_0x5efe('0x6c'),_0x5efe('0x6d'),'Openchannel',_0x5efe('0x6e')];return db['sequelize'][_0x5efe('0x6f')](function(_0x465458){var _0x10bf75=_[_0x5efe('0x34')](_0x541fc5,function(_0x282087){var _0x17a9a2={'attributes':['id','name']};if(_0x282087===_0x5efe('0x6a')){_0x17a9a2['through']={'attributes':[_0x5efe('0x70')]};}return _0x43b745[_0x5efe('0x2e')+_0x282087+_0x5efe('0x68')](_0x17a9a2)[_0x5efe('0x2c')](function(_0x35db55){var _0x1ec463=_[_0x5efe('0x34')](_0x35db55,function(_0x421ea5){var _0x57e78f=_[_0x5efe('0x34')](_0x5f5c33[_0x5efe('0x53')][_0x5efe('0x66')],function(_0x281cca){var _0xf7d003={'where':{'UserId':_0x281cca,[_0x282087+_0x5efe('0x71')]:_0x421ea5['id']},'transaction':_0x465458};if(_0x282087===_0x5efe('0x6a')){_0xf7d003[_0x5efe('0x1d')]={'penalty':_0x421ea5[_0x5efe('0x72')][_0x5efe('0x70')]};}return db['User'+_0x282087+_0x5efe('0x61')]['findOrCreate'](_0xf7d003)[_0x5efe('0x2c')](function(){socket[_0x5efe('0x73')]('user'+_0x282087+_0x5efe('0x74'),{'UserId':_0x281cca,[_0x282087+_0x5efe('0x71')]:_0x421ea5['id']});if(_0x282087!==_0x5efe('0x6a'))return;return db['User'][_0x5efe('0x75')]({'where':{'id':_0x5f5c33['body']['ids'],'online':0x1},'attributes':['id','name',_0x5efe('0x76'),_0x5efe('0x77'),_0x5efe('0x78')],'raw':!![]})[_0x5efe('0x2c')](function(_0x107691){var _0x42d4fa=_[_0x5efe('0x34')](_0x107691,function(_0x2bd0da){return db['UserVoiceQueueRt']['upsert']({'membername':_0x2bd0da[_0x5efe('0x32')],'UserId':_0x2bd0da['id'],'queue_name':_0x421ea5[_0x5efe('0x32')],'VoiceQueueId':_0x421ea5['id'],'interface':_[_0x5efe('0x79')](_0x2bd0da['interface'])?util['format'](_0x5efe('0x7a'),_0x2bd0da['name']):_0x2bd0da[_0x5efe('0x78')],'paused':_0x2bd0da[_0x5efe('0x77')]||![],'penalty':_0x421ea5[_0x5efe('0x72')][_0x5efe('0x70')]},{'transaction':_0x465458});});return Promise['all'](_0x42d4fa);});});});return Promise[_0x5efe('0x7b')](_0x57e78f);});return Promise[_0x5efe('0x7b')](_0x1ec463);});});return Promise[_0x5efe('0x7b')](_0x10bf75)[_0x5efe('0x2c')](function(){return _0x43b745[_0x5efe('0x69')](_0x5f5c33['body'][_0x5efe('0x66')],{'transaction':_0x465458})[_0x5efe('0x7c')](function(_0x4475d2){return _0x4475d2;});});});}})[_0x5efe('0x2c')](respondWithResult(_0x39af62,null))[_0x5efe('0x4c')](handleError(_0x39af62,null));};exports[_0x5efe('0x7d')]=function(_0xc5d869,_0x33c03e){return db[_0x5efe('0x35')][_0x5efe('0x51')]({'where':{'id':_0xc5d869['params']['id']}})[_0x5efe('0x2c')](handleEntityNotFound(_0x33c03e,null))[_0x5efe('0x2c')](function(_0x4203ee){if(_0x4203ee){var _0x2c1f0a=[_0x5efe('0x6a'),'Chat',_0x5efe('0x7e'),_0x5efe('0x6c'),_0x5efe('0x6d'),_0x5efe('0x7f'),_0x5efe('0x6e')];return db[_0x5efe('0x80')][_0x5efe('0x6f')](function(_0x3c1bba){var _0x34fb3a=_[_0x5efe('0x34')](_0x2c1f0a,function(_0x4f462e){var _0x361d47={'attributes':['id',_0x5efe('0x32')]};return _0x4203ee[_0x5efe('0x2e')+_0x4f462e+_0x5efe('0x68')](_0x361d47)['then'](function(_0x34422a){var _0x37b76b=_['map'](_0x34422a,function(_0x8c04ca){return _0x8c04ca[_0x5efe('0x7d')](_0xc5d869['query'][_0x5efe('0x66')],{'transaction':_0x3c1bba})['then'](function(){var _0x2cb713=JSON[_0x5efe('0x81')]('['+_0xc5d869[_0x5efe('0x3a')][_0x5efe('0x66')]+']');var _0x4f7de8=_[_0x5efe('0x34')](_0x2cb713,function(_0x5e39d2){socket[_0x5efe('0x73')]('user'+_0x4f462e+_0x5efe('0x82'),{'UserId':Number(_0x5e39d2),[_0x4f462e+'QueueId']:_0x8c04ca['id']});if(_0x4f462e!==_0x5efe('0x6a'))return;return db[_0x5efe('0x83')][_0x5efe('0x2d')]({'where':{'VoiceQueueId':_0x8c04ca['id'],'UserId':_0x5e39d2},'transaction':_0x3c1bba});});return Promise[_0x5efe('0x7b')](_0x4f7de8);});});return Promise[_0x5efe('0x7b')](_0x37b76b);});});return Promise['all'](_0x34fb3a)['then'](function(){return _0x4203ee[_0x5efe('0x7d')](_0xc5d869['query'][_0x5efe('0x66')],{'transaction':_0x3c1bba});});});}})['then'](respondWithStatusCode(_0x33c03e,null))['catch'](handleError(_0x33c03e,null));};exports[_0x5efe('0x84')]=function(_0x7572c7,_0xd56d9f,_0x1e9948){var _0x263213={};var _0x2974e1={};var _0x45de6b;var _0x37be47;return db[_0x5efe('0x35')][_0x5efe('0x5c')]({'where':{'id':_0x7572c7[_0x5efe('0x4d')]['id']}})[_0x5efe('0x2c')](handleEntityNotFound(_0xd56d9f,null))[_0x5efe('0x2c')](function(_0x3c6395){if(_0x3c6395){_0x45de6b=_0x3c6395;_0x2974e1[_0x5efe('0x3d')]=_[_0x5efe('0x39')](db[_0x5efe('0x85')][_0x5efe('0x4e')]);_0x2974e1[_0x5efe('0x3a')]=_[_0x5efe('0x39')](_0x7572c7['query']);_0x2974e1[_0x5efe('0x3b')]=_[_0x5efe('0x3c')](_0x2974e1[_0x5efe('0x3d')],_0x2974e1[_0x5efe('0x3a')]);_0x263213[_0x5efe('0x3e')]=_[_0x5efe('0x3c')](_0x2974e1[_0x5efe('0x3d')],qs[_0x5efe('0x3f')](_0x7572c7[_0x5efe('0x3a')][_0x5efe('0x3f')]));_0x263213['attributes']=_0x263213[_0x5efe('0x3e')][_0x5efe('0x40')]?_0x263213[_0x5efe('0x3e')]:_0x2974e1[_0x5efe('0x3d')];_0x263213['order']=qs[_0x5efe('0x44')](_0x7572c7[_0x5efe('0x3a')][_0x5efe('0x44')]);_0x263213['where']=qs[_0x5efe('0x3b')](_['pick'](_0x7572c7[_0x5efe('0x3a')],_0x2974e1['filters']));if(_0x7572c7[_0x5efe('0x3a')][_0x5efe('0x47')]){_0x263213[_0x5efe('0x45')]=_['merge'](_0x263213[_0x5efe('0x45')],{'$or':_[_0x5efe('0x34')](_0x263213[_0x5efe('0x3e')],function(_0xfb2b2f){var _0x1e2390={};_0x1e2390[_0xfb2b2f]={'$like':'%'+_0x7572c7['query'][_0x5efe('0x47')]+'%'};return _0x1e2390;})});}_0x263213=_[_0x5efe('0x50')]({},_0x263213,_0x7572c7[_0x5efe('0x49')]);return _0x45de6b[_0x5efe('0x84')](_0x263213);}})[_0x5efe('0x2c')](function(_0x50b892){if(_0x50b892){_0x37be47=_0x50b892[_0x5efe('0x40')];if(!_0x7572c7[_0x5efe('0x3a')]['hasOwnProperty']('nolimit')){_0x263213[_0x5efe('0x28')]=qs['limit'](_0x7572c7[_0x5efe('0x3a')][_0x5efe('0x28')]);_0x263213[_0x5efe('0x26')]=qs['offset'](_0x7572c7[_0x5efe('0x3a')][_0x5efe('0x26')]);}return _0x45de6b['getAgents'](_0x263213);}})[_0x5efe('0x2c')](function(_0x514157){if(_0x514157){return _0x514157?{'count':_0x37be47,'rows':_0x514157}:null;}})[_0x5efe('0x2c')](respondWithResult(_0xd56d9f,null))[_0x5efe('0x4c')](handleError(_0xd56d9f,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 9a4a219..3105760 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 _0xd5ab=['hasOwnProperty','events','Team','save','update','remove','emit'];(function(_0x121b1a,_0x42fdb7){var _0x2d89a6=function(_0x1b6027){while(--_0x1b6027){_0x121b1a['push'](_0x121b1a['shift']());}};_0x2d89a6(++_0x42fdb7);}(_0xd5ab,0x1e4));var _0xbd5a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd5ab[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xbd5a('0x0'));var Team=require('../../mysqldb')['db'][_0xbd5a('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbd5a('0x2'),'afterUpdate':_0xbd5a('0x3'),'afterDestroy':_0xbd5a('0x4')};function emitEvent(_0x46dfa8){return function(_0xfde0c1,_0x270b2a,_0xfc4ddc){TeamEvents[_0xbd5a('0x5')](_0x46dfa8+':'+_0xfde0c1['id'],_0xfde0c1);TeamEvents[_0xbd5a('0x5')](_0x46dfa8,_0xfde0c1);_0xfc4ddc(null);};}for(var e in events){if(events[_0xbd5a('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xea77=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','save','update','remove'];(function(_0x2626af,_0xac6e3){var _0x2e6533=function(_0xd34542){while(--_0xd34542){_0x2626af['push'](_0x2626af['shift']());}};_0x2e6533(++_0xac6e3);}(_0xea77,0x1a8));var _0x7ea7=function(_0x1b0396,_0x570d96){_0x1b0396=_0x1b0396-0x0;var _0x2a758c=_0xea77[_0x1b0396];return _0x2a758c;};'use strict';var EventEmitter=require(_0x7ea7('0x0'));var Team=require(_0x7ea7('0x1'))['db'][_0x7ea7('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7ea7('0x3'),'afterUpdate':_0x7ea7('0x4'),'afterDestroy':_0x7ea7('0x5')};function emitEvent(_0xbc39b2){return function(_0x2fac01,_0x15bc05,_0x3e6e55){TeamEvents[_0x7ea7('0x6')](_0xbc39b2+':'+_0x2fac01['id'],_0x2fac01);TeamEvents[_0x7ea7('0x6')](_0xbc39b2,_0x2fac01);_0x3e6e55(null);};}for(var e in events){if(events[_0x7ea7('0x7')](e)){var event=events[e];Team[_0x7ea7('0x8')](e,emitEvent(event));}}module[_0x7ea7('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index d19ff7f..e26c78f 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 _0xdc18=['./team.attributes','exports','define','Team','teams','lodash','api','moment','bluebird','path','../../config/environment'];(function(_0x5bff15,_0x19bb55){var _0xfaa34f=function(_0x5e82a4){while(--_0x5e82a4){_0x5bff15['push'](_0x5bff15['shift']());}};_0xfaa34f(++_0x19bb55);}(_0xdc18,0x12e));var _0x8dc1=function(_0x58e450,_0x3e21da){_0x58e450=_0x58e450-0x0;var _0x26193d=_0xdc18[_0x58e450];return _0x26193d;};'use strict';var _=require(_0x8dc1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8dc1('0x1'));var moment=require(_0x8dc1('0x2'));var BPromise=require(_0x8dc1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8dc1('0x4'));var rimraf=require('rimraf');var config=require(_0x8dc1('0x5'));var attributes=require(_0x8dc1('0x6'));module[_0x8dc1('0x7')]=function(_0xdfa900,_0xf924f4){return _0xdfa900[_0x8dc1('0x8')](_0x8dc1('0x9'),attributes,{'tableName':_0x8dc1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05e4=['teams','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./team.attributes','Team'];(function(_0x2e50b2,_0x26b904){var _0xd73e3=function(_0x288f81){while(--_0x288f81){_0x2e50b2['push'](_0x2e50b2['shift']());}};_0xd73e3(++_0x26b904);}(_0x05e4,0x1a5));var _0x405e=function(_0x128843,_0x450a76){_0x128843=_0x128843-0x0;var _0x57b915=_0x05e4[_0x128843];return _0x57b915;};'use strict';var _=require(_0x405e('0x0'));var util=require(_0x405e('0x1'));var logger=require(_0x405e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x405e('0x3'));var rp=require(_0x405e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x405e('0x5'));var config=require(_0x405e('0x6'));var attributes=require(_0x405e('0x7'));module['exports']=function(_0x5381a2,_0x50b46e){return _0x5381a2['define'](_0x405e('0x8'),attributes,{'tableName':_0x405e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 9bf396b..b29a897 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 _0x37b1=['Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./team.socket','register','request','then','info'];(function(_0x22e9fe,_0x3d019f){var _0x47cd19=function(_0x8fd5fc){while(--_0x8fd5fc){_0x22e9fe['push'](_0x22e9fe['shift']());}};_0x47cd19(++_0x3d019f);}(_0x37b1,0x9f));var _0x137b=function(_0x3e929b,_0x5ee20e){_0x3e929b=_0x3e929b-0x0;var _0x4ff3e8=_0x37b1[_0x3e929b];return _0x4ff3e8;};'use strict';var _=require(_0x137b('0x0'));var util=require(_0x137b('0x1'));var moment=require(_0x137b('0x2'));var BPromise=require(_0x137b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x137b('0x4'));var db=require(_0x137b('0x5'))['db'];var utils=require(_0x137b('0x6'));var logger=require(_0x137b('0x7'))(_0x137b('0x8'));var config=require(_0x137b('0x9'));var jayson=require(_0x137b('0xa'));var client=jayson[_0x137b('0xb')][_0x137b('0xc')]({'port':0x232a});config[_0x137b('0xd')]=_[_0x137b('0xe')](config[_0x137b('0xd')],{'host':_0x137b('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x137b('0xd')]));require(_0x137b('0x10'))[_0x137b('0x11')](socket);function respondWithRpcPromise(_0x5b4ee8,_0x3d99fa,_0x46f42f){return new BPromise(function(_0x59d82d,_0x3cc453){return client[_0x137b('0x12')](_0x5b4ee8,_0x46f42f)[_0x137b('0x13')](function(_0x442a29){logger[_0x137b('0x14')](_0x137b('0x15'),_0x3d99fa,'request\x20sent');logger[_0x137b('0x16')](_0x137b('0x17'),_0x3d99fa,_0x137b('0x18'),JSON['stringify'](_0x442a29));if(_0x442a29[_0x137b('0x19')]){if(_0x442a29[_0x137b('0x19')][_0x137b('0x1a')]===0x1f4){logger[_0x137b('0x19')]('Team,\x20%s,\x20%s',_0x3d99fa,_0x442a29[_0x137b('0x19')][_0x137b('0x1b')]);return _0x3cc453(_0x442a29['error'][_0x137b('0x1b')]);}logger[_0x137b('0x19')](_0x137b('0x15'),_0x3d99fa,_0x442a29[_0x137b('0x19')][_0x137b('0x1b')]);return _0x59d82d(_0x442a29['error'][_0x137b('0x1b')]);}else{logger['info'](_0x137b('0x15'),_0x3d99fa,_0x137b('0x18'));_0x59d82d(_0x442a29[_0x137b('0x1c')][_0x137b('0x1b')]);}})[_0x137b('0x1d')](function(_0x5879bc){logger[_0x137b('0x19')]('Team,\x20%s,\x20%s',_0x3d99fa,_0x5879bc);_0x3cc453(_0x5879bc);});});} \ No newline at end of file +var _0xf55d=['message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2921aa,_0x3fc4c2){var _0x43d814=function(_0x36ed7a){while(--_0x36ed7a){_0x2921aa['push'](_0x2921aa['shift']());}};_0x43d814(++_0x3fc4c2);}(_0xf55d,0x1c4));var _0xdf55=function(_0x42509a,_0x294d43){_0x42509a=_0x42509a-0x0;var _0x1bcfda=_0xf55d[_0x42509a];return _0x1bcfda;};'use strict';var _=require('lodash');var util=require(_0xdf55('0x0'));var moment=require(_0xdf55('0x1'));var BPromise=require(_0xdf55('0x2'));var rs=require(_0xdf55('0x3'));var fs=require('fs');var Redis=require(_0xdf55('0x4'));var db=require(_0xdf55('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xdf55('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdf55('0x7')]['http']({'port':0x232a});config[_0xdf55('0x8')]=_[_0xdf55('0x9')](config[_0xdf55('0x8')],{'host':_0xdf55('0xa'),'port':0x18eb});var socket=require(_0xdf55('0xb'))(new Redis(config[_0xdf55('0x8')]));require(_0xdf55('0xc'))[_0xdf55('0xd')](socket);function respondWithRpcPromise(_0x4b3e0b,_0x2bbd93,_0x5b1033){return new BPromise(function(_0x5dd0cd,_0x4a0b9e){return client[_0xdf55('0xe')](_0x4b3e0b,_0x5b1033)['then'](function(_0x31e9af){logger[_0xdf55('0xf')](_0xdf55('0x10'),_0x2bbd93,_0xdf55('0x11'));logger[_0xdf55('0x12')](_0xdf55('0x13'),_0x2bbd93,_0xdf55('0x11'),JSON[_0xdf55('0x14')](_0x31e9af));if(_0x31e9af[_0xdf55('0x15')]){if(_0x31e9af[_0xdf55('0x15')][_0xdf55('0x16')]===0x1f4){logger[_0xdf55('0x15')](_0xdf55('0x10'),_0x2bbd93,_0x31e9af[_0xdf55('0x15')]['message']);return _0x4a0b9e(_0x31e9af['error']['message']);}logger[_0xdf55('0x15')](_0xdf55('0x10'),_0x2bbd93,_0x31e9af[_0xdf55('0x15')][_0xdf55('0x17')]);return _0x5dd0cd(_0x31e9af[_0xdf55('0x15')][_0xdf55('0x17')]);}else{logger[_0xdf55('0xf')]('Team,\x20%s,\x20%s',_0x2bbd93,_0xdf55('0x11'));_0x5dd0cd(_0x31e9af['result'][_0xdf55('0x17')]);}})[_0xdf55('0x18')](function(_0x559ce3){logger[_0xdf55('0x15')]('Team,\x20%s,\x20%s',_0x2bbd93,_0x559ce3);_0x4a0b9e(_0x559ce3);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 5daa9c1..f4fc73a 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 _0x6e6c=['save','update','emit','register','length','team:','./team.events'];(function(_0xa785e1,_0x4671f1){var _0x6185f1=function(_0x308a27){while(--_0x308a27){_0xa785e1['push'](_0xa785e1['shift']());}};_0x6185f1(++_0x4671f1);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6e6c[_0x397e5f];return _0x5302b8;};'use strict';var TeamEvents=require(_0xc6e6('0x0'));var events=[_0xc6e6('0x1'),'remove',_0xc6e6('0x2')];function createListener(_0x1b63fe,_0x58f303){return function(_0x550e47){_0x58f303[_0xc6e6('0x3')](_0x1b63fe,_0x550e47);};}function removeListener(_0x5a9e2b,_0x40b7e1){return function(){TeamEvents['removeListener'](_0x5a9e2b,_0x40b7e1);};}exports[_0xc6e6('0x4')]=function(_0x1182c7){for(var _0x4bf906=0x0,_0x301f55=events[_0xc6e6('0x5')];_0x4bf906<_0x301f55;_0x4bf906++){var _0x4da7bd=events[_0x4bf906];var _0x324706=createListener(_0xc6e6('0x6')+_0x4da7bd,_0x1182c7);TeamEvents['on'](_0x4da7bd,_0x324706);}}; \ No newline at end of file +var _0xf3e5=['save','remove','update','removeListener','register','length','./team.events'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf3e5,0xc3));var _0x5f3e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xf3e5[_0x5c351c];return _0x26f3b3;};'use strict';var TeamEvents=require(_0x5f3e('0x0'));var events=[_0x5f3e('0x1'),_0x5f3e('0x2'),_0x5f3e('0x3')];function createListener(_0x1549dc,_0x3bd946){return function(_0x1a08c1){_0x3bd946['emit'](_0x1549dc,_0x1a08c1);};}function removeListener(_0x2f5d1d,_0x35c558){return function(){TeamEvents[_0x5f3e('0x4')](_0x2f5d1d,_0x35c558);};}exports[_0x5f3e('0x5')]=function(_0x1d1187){for(var _0x115405=0x0,_0x5f146c=events[_0x5f3e('0x6')];_0x115405<_0x5f146c;_0x115405++){var _0x23c665=events[_0x115405];var _0x3b9fd3=createListener('team:'+_0x23c665,_0x1d1187);TeamEvents['on'](_0x23c665,_0x3b9fd3);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 4af9d0a..4992b61 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x47e934,_0x11d22f){var _0x2088eb=function(_0x5e3386){while(--_0x5e3386){_0x47e934['push'](_0x47e934['shift']());}};_0x2088eb(++_0x11d22f);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x36ba19,_0x1c2447){var _0x438c84=function(_0x565511){while(--_0x565511){_0x36ba19['push'](_0x36ba19['shift']());}};_0x438c84(++_0x1c2447);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x215dc8,_0x52c245){_0x215dc8=_0x215dc8-0x0;var _0x583ea3=_0xcb91[_0x215dc8];return _0x583ea3;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index dfdb8b3..d222c76 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 _0xf596=['INTEGER','sequelize','exports'];(function(_0x632bc8,_0x2edb19){var _0x389439=function(_0x192d70){while(--_0x192d70){_0x632bc8['push'](_0x632bc8['shift']());}};_0x389439(++_0x2edb19);}(_0xf596,0xd3));var _0x6f59=function(_0x56bdcb,_0x411f51){_0x56bdcb=_0x56bdcb-0x0;var _0xdb8f70=_0xf596[_0x56bdcb];return _0xdb8f70;};'use strict';var Sequelize=require(_0x6f59('0x0'));module[_0x6f59('0x1')]={'penalty':{'type':Sequelize[_0x6f59('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc2f5=['INTEGER','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc2f5,0x175));var _0x5c2f=function(_0x468bb5,_0x538ddb){_0x468bb5=_0x468bb5-0x0;var _0x3b99fb=_0xc2f5[_0x468bb5];return _0x3b99fb;};'use strict';var Sequelize=require('sequelize');module[_0x5c2f('0x0')]={'penalty':{'type':Sequelize[_0x5c2f('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 6f88abf..d535290 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 _0x0eec=['exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x49c997,_0x381aca){var _0x14407e=function(_0x172920){while(--_0x172920){_0x49c997['push'](_0x49c997['shift']());}};_0x14407e(++_0x381aca);}(_0x0eec,0xac));var _0xc0ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0eec[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc0ee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc0ee('0x1'));var moment=require(_0xc0ee('0x2'));var BPromise=require(_0xc0ee('0x3'));var rp=require(_0xc0ee('0x4'));var fs=require('fs');var path=require(_0xc0ee('0x5'));var rimraf=require(_0xc0ee('0x6'));var config=require(_0xc0ee('0x7'));var attributes=require('./teamVoiceQueue.attributes');module[_0xc0ee('0x8')]=function(_0x4db3d6,_0x218797){return _0x4db3d6[_0xc0ee('0x9')](_0xc0ee('0xa'),attributes,{'tableName':_0xc0ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c6d=['moment','request-promise','path','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','lodash','util','../../config/logger','api'];(function(_0x49d48d,_0xf1fdaa){var _0x46e093=function(_0x535f82){while(--_0x535f82){_0x49d48d['push'](_0x49d48d['shift']());}};_0x46e093(++_0xf1fdaa);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x3a77ea,_0x139e30){_0x3a77ea=_0x3a77ea-0x0;var _0x2d43b8=_0x4c6d[_0x3a77ea];return _0x2d43b8;};'use strict';var _=require(_0xd4c6('0x0'));var util=require(_0xd4c6('0x1'));var logger=require(_0xd4c6('0x2'))(_0xd4c6('0x3'));var moment=require(_0xd4c6('0x4'));var BPromise=require('bluebird');var rp=require(_0xd4c6('0x5'));var fs=require('fs');var path=require(_0xd4c6('0x6'));var rimraf=require(_0xd4c6('0x7'));var config=require('../../config/environment');var attributes=require(_0xd4c6('0x8'));module[_0xd4c6('0x9')]=function(_0x56279c,_0x182671){return _0x56279c[_0xd4c6('0xa')](_0xd4c6('0xb'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index faa385d..78fcc0a 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 _0xa273=['request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0x4dd7cf,_0x48cad2){var _0x4c5233=function(_0x2b01c2){while(--_0x2b01c2){_0x4dd7cf['push'](_0x4dd7cf['shift']());}};_0x4c5233(++_0x48cad2);}(_0xa273,0x1d5));var _0x3a27=function(_0x46f67f,_0x229637){_0x46f67f=_0x46f67f-0x0;var _0x49ec47=_0xa273[_0x46f67f];return _0x49ec47;};'use strict';var _=require(_0x3a27('0x0'));var util=require(_0x3a27('0x1'));var moment=require(_0x3a27('0x2'));var BPromise=require(_0x3a27('0x3'));var rs=require(_0x3a27('0x4'));var fs=require('fs');var Redis=require(_0x3a27('0x5'));var db=require(_0x3a27('0x6'))['db'];var utils=require(_0x3a27('0x7'));var logger=require(_0x3a27('0x8'))(_0x3a27('0x9'));var config=require('../../config/environment');var jayson=require(_0x3a27('0xa'));var client=jayson[_0x3a27('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43aa5b,_0x6240d4,_0x3c1afb){return new BPromise(function(_0x486981,_0x45b3c8){return client['request'](_0x43aa5b,_0x3c1afb)[_0x3a27('0xc')](function(_0x237f38){logger['info'](_0x3a27('0xd'),_0x6240d4,_0x3a27('0xe'));logger[_0x3a27('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x6240d4,_0x3a27('0xe'),JSON[_0x3a27('0x10')](_0x237f38));if(_0x237f38[_0x3a27('0x11')]){if(_0x237f38[_0x3a27('0x11')][_0x3a27('0x12')]===0x1f4){logger[_0x3a27('0x11')](_0x3a27('0xd'),_0x6240d4,_0x237f38[_0x3a27('0x11')]['message']);return _0x45b3c8(_0x237f38[_0x3a27('0x11')][_0x3a27('0x13')]);}logger['error'](_0x3a27('0xd'),_0x6240d4,_0x237f38[_0x3a27('0x11')][_0x3a27('0x13')]);return _0x486981(_0x237f38['error'][_0x3a27('0x13')]);}else{logger[_0x3a27('0x14')](_0x3a27('0xd'),_0x6240d4,'request\x20sent');_0x486981(_0x237f38[_0x3a27('0x15')][_0x3a27('0x13')]);}})[_0x3a27('0x16')](function(_0x421161){logger[_0x3a27('0x11')](_0x3a27('0xd'),_0x6240d4,_0x421161);_0x45b3c8(_0x421161);});});} \ No newline at end of file +var _0xad75=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0x3a4a9b,_0x29315d){var _0x58454b=function(_0x5b0be4){while(--_0x5b0be4){_0x3a4a9b['push'](_0x3a4a9b['shift']());}};_0x58454b(++_0x29315d);}(_0xad75,0xdb));var _0x5ad7=function(_0x26bcff,_0x1bf100){_0x26bcff=_0x26bcff-0x0;var _0xb14b0d=_0xad75[_0x26bcff];return _0xb14b0d;};'use strict';var _=require(_0x5ad7('0x0'));var util=require(_0x5ad7('0x1'));var moment=require(_0x5ad7('0x2'));var BPromise=require(_0x5ad7('0x3'));var rs=require(_0x5ad7('0x4'));var fs=require('fs');var Redis=require(_0x5ad7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ad7('0x6'));var logger=require(_0x5ad7('0x7'))(_0x5ad7('0x8'));var config=require('../../config/environment');var jayson=require(_0x5ad7('0x9'));var client=jayson[_0x5ad7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59e095,_0x5cb253,_0x54f3f8){return new BPromise(function(_0x2eebb6,_0x3e561c){return client[_0x5ad7('0xb')](_0x59e095,_0x54f3f8)[_0x5ad7('0xc')](function(_0x1dd651){logger[_0x5ad7('0xd')](_0x5ad7('0xe'),_0x5cb253,'request\x20sent');logger['debug'](_0x5ad7('0xf'),_0x5cb253,_0x5ad7('0x10'),JSON[_0x5ad7('0x11')](_0x1dd651));if(_0x1dd651[_0x5ad7('0x12')]){if(_0x1dd651[_0x5ad7('0x12')]['code']===0x1f4){logger[_0x5ad7('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5cb253,_0x1dd651[_0x5ad7('0x12')][_0x5ad7('0x13')]);return _0x3e561c(_0x1dd651[_0x5ad7('0x12')][_0x5ad7('0x13')]);}logger[_0x5ad7('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5cb253,_0x1dd651[_0x5ad7('0x12')][_0x5ad7('0x13')]);return _0x2eebb6(_0x1dd651['error'][_0x5ad7('0x13')]);}else{logger[_0x5ad7('0xd')](_0x5ad7('0xe'),_0x5cb253,'request\x20sent');_0x2eebb6(_0x1dd651[_0x5ad7('0x14')]['message']);}})[_0x5ad7('0x15')](function(_0x2938d7){logger['error'](_0x5ad7('0xe'),_0x5cb253,_0x2938d7);_0x3e561c(_0x2938d7);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 4f4d687..c14df96 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 _0x9f0e=['../../config/environment','./template.controller','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x9f0e,0x116));var _0xe9f0=function(_0x3752ae,_0x142f7b){_0x3752ae=_0x3752ae-0x0;var _0x1ce3b2=_0x9f0e[_0x3752ae];return _0x1ce3b2;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['show']);router[_0xe9f0('0xc')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xa'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);module[_0xe9f0('0x12')]=router; \ No newline at end of file +var _0xbedb=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','post','put','destroy','exports','multer','path'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0xbedb,0x12e));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbbed('0x0'));var util=require('util');var path=require(_0xbbed('0x1'));var timeout=require(_0xbbed('0x2'));var express=require(_0xbbed('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbbed('0x4'));var interaction=require(_0xbbed('0x5'));var config=require(_0xbbed('0x6'));var controller=require(_0xbbed('0x7'));router[_0xbbed('0x8')]('/',auth[_0xbbed('0x9')](),controller[_0xbbed('0xa')]);router[_0xbbed('0x8')](_0xbbed('0xb'),auth[_0xbbed('0x9')](),controller['show']);router[_0xbbed('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbbed('0xd')](_0xbbed('0xb'),auth[_0xbbed('0x9')](),controller['update']);router['delete'](_0xbbed('0xb'),auth[_0xbbed('0x9')](),controller[_0xbbed('0xe')]);module[_0xbbed('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 79115f5..72405e0 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 _0x893a=['sequelize','exports','STRING'];(function(_0x686b0c,_0x5774db){var _0x52a1e9=function(_0x30c800){while(--_0x30c800){_0x686b0c['push'](_0x686b0c['shift']());}};_0x52a1e9(++_0x5774db);}(_0x893a,0xed));var _0xa893=function(_0x3735a0,_0x4749e0){_0x3735a0=_0x3735a0-0x0;var _0x40d32e=_0x893a[_0x3735a0];return _0x40d32e;};'use strict';var Sequelize=require(_0xa893('0x0'));module[_0xa893('0x1')]={'name':{'type':Sequelize[_0xa893('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4c05=['sequelize','exports','STRING','TEXT'];(function(_0x48f645,_0x25b041){var _0xadef10=function(_0x1b78d7){while(--_0x1b78d7){_0x48f645['push'](_0x48f645['shift']());}};_0xadef10(++_0x25b041);}(_0x4c05,0x1cc));var _0x54c0=function(_0x39cf10,_0x412cae){_0x39cf10=_0x39cf10-0x0;var _0x359439=_0x4c05[_0x39cf10];return _0x359439;};'use strict';var Sequelize=require(_0x54c0('0x0'));module[_0x54c0('0x1')]={'name':{'type':Sequelize[_0x54c0('0x2')]},'description':{'type':Sequelize[_0x54c0('0x2')]},'html':{'type':Sequelize[_0x54c0('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 34c7a71..1892ee8 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 _0xb4ae=['send','index','map','Template','rawAttributes','type','query','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','get','Templates','UserProfileResource','sendStatus','error','stack','name'];(function(_0x5130e0,_0x425334){var _0x4dfadd=function(_0x2801ba){while(--_0x2801ba){_0x5130e0['push'](_0x5130e0['shift']());}};_0x4dfadd(++_0x425334);}(_0xb4ae,0x1c2));var _0xeb4a=function(_0x5b4a91,_0x55634b){_0x5b4a91=_0x5b4a91-0x0;var _0x1e0d05=_0xb4ae[_0x5b4a91];return _0x1e0d05;};'use strict';var emlformat=require(_0xeb4a('0x0'));var rimraf=require(_0xeb4a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb4a('0x2'));var rp=require(_0xeb4a('0x3'));var moment=require(_0xeb4a('0x4'));var BPromise=require(_0xeb4a('0x5'));var Mustache=require(_0xeb4a('0x6'));var util=require('util');var path=require('path');var sox=require(_0xeb4a('0x7'));var csv=require(_0xeb4a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb4a('0x9'));var _=require('lodash');var squel=require(_0xeb4a('0xa'));var crypto=require(_0xeb4a('0xb'));var jsforce=require(_0xeb4a('0xc'));var deskjs=require(_0xeb4a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xeb4a('0xe'));var Papa=require(_0xeb4a('0xf'));var Redis=require('ioredis');var authService=require(_0xeb4a('0x10'));var qs=require(_0xeb4a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb4a('0x12'));var logger=require(_0xeb4a('0x13'))('api');var utils=require(_0xeb4a('0x14'));var config=require(_0xeb4a('0x15'));var licenseUtil=require(_0xeb4a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x422a5a,_0xc3ed0b){_0xc3ed0b=_0xc3ed0b||0xcc;return function(_0x40bbd0){if(_0x40bbd0){return _0x422a5a['sendStatus'](_0xc3ed0b);}return _0x422a5a[_0xeb4a('0x17')](_0xc3ed0b)['end']();};}function respondWithResult(_0xfff477,_0x46effe){_0x46effe=_0x46effe||0xc8;return function(_0x294719){if(_0x294719){return _0xfff477['status'](_0x46effe)[_0xeb4a('0x18')](_0x294719);}};}function respondWithFilteredResult(_0x52b2d3,_0x16e480){return function(_0x10eb59){if(_0x10eb59){var _0x1aafee=typeof _0x16e480[_0xeb4a('0x19')]==='undefined'&&typeof _0x16e480[_0xeb4a('0x1a')]===_0xeb4a('0x1b');var _0x67d75e=_0x10eb59[_0xeb4a('0x1c')];var _0x472116=_0x1aafee?0x0:_0x16e480[_0xeb4a('0x19')];var _0x3fe6a0=_0x1aafee?_0x10eb59[_0xeb4a('0x1c')]:_0x16e480[_0xeb4a('0x19')]+_0x16e480[_0xeb4a('0x1a')];var _0x177da1;if(_0x3fe6a0>=_0x67d75e){_0x3fe6a0=_0x67d75e;_0x177da1=0xc8;}else{_0x177da1=0xce;}_0x52b2d3['status'](_0x177da1);return _0x52b2d3[_0xeb4a('0x1d')](_0xeb4a('0x1e'),_0x472116+'-'+_0x3fe6a0+'/'+_0x67d75e)[_0xeb4a('0x18')](_0x10eb59);}return null;};}function patchUpdates(_0x1c5728){return function(_0x40b140){try{jsonpatch[_0xeb4a('0x1f')](_0x40b140,_0x1c5728,!![]);}catch(_0x124934){return BPromise['reject'](_0x124934);}return _0x40b140[_0xeb4a('0x20')]();};}function saveUpdates(_0xaf4c7f,_0x292a1a){return function(_0xa3f221){if(_0xa3f221){return _0xa3f221['update'](_0xaf4c7f)[_0xeb4a('0x21')](function(_0xdde73c){return _0xdde73c;});}return null;};}function removeEntity(_0x3db6e3,_0x3504ea){return function(_0x18e52a){if(_0x18e52a){return _0x18e52a[_0xeb4a('0x22')]()[_0xeb4a('0x21')](function(){var _0x1dd286=_0x18e52a[_0xeb4a('0x23')]({'plain':!![]});var _0x2fafc4=_0xeb4a('0x24');return db[_0xeb4a('0x25')]['destroy']({'where':{'type':_0x2fafc4,'resourceId':_0x1dd286['id']}})[_0xeb4a('0x21')](function(){return _0x18e52a;});})[_0xeb4a('0x21')](function(){_0x3db6e3[_0xeb4a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56b856,_0x48c239){return function(_0x53256a){if(!_0x53256a){_0x56b856[_0xeb4a('0x26')](0x194);}return _0x53256a;};}function handleError(_0x5bb3a2,_0x5c8f4f){_0x5c8f4f=_0x5c8f4f||0x1f4;return function(_0x57039b){logger[_0xeb4a('0x27')](_0x57039b[_0xeb4a('0x28')]);if(_0x57039b['name']){delete _0x57039b[_0xeb4a('0x29')];}_0x5bb3a2[_0xeb4a('0x17')](_0x5c8f4f)[_0xeb4a('0x2a')](_0x57039b);};}exports[_0xeb4a('0x2b')]=function(_0x5d258b,_0x1246cc){var _0x2dbc43={},_0x3cf751={},_0x585cb2={'count':0x0,'rows':[]};var _0x137b00=_[_0xeb4a('0x2c')](db[_0xeb4a('0x2d')][_0xeb4a('0x2e')],function(_0xf0d507){return{'name':_0xf0d507['fieldName'],'type':_0xf0d507[_0xeb4a('0x2f')]['key']};});_0x3cf751['model']=_['map'](_0x137b00,'name');_0x3cf751[_0xeb4a('0x30')]=_['keys'](_0x5d258b[_0xeb4a('0x30')]);_0x3cf751[_0xeb4a('0x31')]=_[_0xeb4a('0x32')](_0x3cf751['model'],_0x3cf751['query']);_0x2dbc43[_0xeb4a('0x33')]=_[_0xeb4a('0x32')](_0x3cf751[_0xeb4a('0x34')],qs[_0xeb4a('0x35')](_0x5d258b['query']['fields']));_0x2dbc43['attributes']=_0x2dbc43[_0xeb4a('0x33')]['length']?_0x2dbc43['attributes']:_0x3cf751['model'];if(!_0x5d258b['query'][_0xeb4a('0x36')]('nolimit')){_0x2dbc43[_0xeb4a('0x1a')]=qs[_0xeb4a('0x1a')](_0x5d258b[_0xeb4a('0x30')][_0xeb4a('0x1a')]);_0x2dbc43[_0xeb4a('0x19')]=qs[_0xeb4a('0x19')](_0x5d258b[_0xeb4a('0x30')][_0xeb4a('0x19')]);}_0x2dbc43[_0xeb4a('0x37')]=qs[_0xeb4a('0x38')](_0x5d258b[_0xeb4a('0x30')][_0xeb4a('0x38')]);_0x2dbc43[_0xeb4a('0x39')]=qs[_0xeb4a('0x31')](_[_0xeb4a('0x3a')](_0x5d258b['query'],_0x3cf751[_0xeb4a('0x31')]),_0x137b00);if(_0x5d258b['query'][_0xeb4a('0x3b')]){_0x2dbc43[_0xeb4a('0x39')]=_['merge'](_0x2dbc43['where'],{'$or':_['map'](_0x137b00,function(_0x2db76c){if(_0x2db76c[_0xeb4a('0x2f')]!==_0xeb4a('0x3c')){var _0x4afe0d={};_0x4afe0d[_0x2db76c[_0xeb4a('0x29')]]={'$like':'%'+_0x5d258b[_0xeb4a('0x30')][_0xeb4a('0x3b')]+'%'};return _0x4afe0d;}})});}_0x2dbc43=_[_0xeb4a('0x3d')]({},_0x2dbc43,_0x5d258b[_0xeb4a('0x3e')]);var _0x346710={'where':_0x2dbc43[_0xeb4a('0x39')]};return db[_0xeb4a('0x2d')][_0xeb4a('0x1c')](_0x346710)['then'](function(_0x35260a){_0x585cb2['count']=_0x35260a;if(_0x5d258b[_0xeb4a('0x30')][_0xeb4a('0x3f')]){_0x2dbc43[_0xeb4a('0x40')]=[{'all':!![]}];}return db[_0xeb4a('0x2d')][_0xeb4a('0x41')](_0x2dbc43);})[_0xeb4a('0x21')](function(_0x2df9ad){_0x585cb2['rows']=_0x2df9ad;return _0x585cb2;})['then'](respondWithFilteredResult(_0x1246cc,_0x2dbc43))[_0xeb4a('0x42')](handleError(_0x1246cc,null));};exports[_0xeb4a('0x43')]=function(_0x3aa454,_0x3b6aa7){var _0x572d95={'raw':!![],'where':{'id':_0x3aa454[_0xeb4a('0x44')]['id']}},_0xcb2177={};_0xcb2177['model']=_[_0xeb4a('0x45')](db[_0xeb4a('0x2d')][_0xeb4a('0x2e')]);_0xcb2177['query']=_[_0xeb4a('0x45')](_0x3aa454[_0xeb4a('0x30')]);_0xcb2177[_0xeb4a('0x31')]=_[_0xeb4a('0x32')](_0xcb2177[_0xeb4a('0x34')],_0xcb2177[_0xeb4a('0x30')]);_0x572d95['attributes']=_[_0xeb4a('0x32')](_0xcb2177[_0xeb4a('0x34')],qs['fields'](_0x3aa454[_0xeb4a('0x30')][_0xeb4a('0x35')]));_0x572d95[_0xeb4a('0x33')]=_0x572d95[_0xeb4a('0x33')][_0xeb4a('0x46')]?_0x572d95[_0xeb4a('0x33')]:_0xcb2177[_0xeb4a('0x34')];if(_0x3aa454[_0xeb4a('0x30')][_0xeb4a('0x3f')]){_0x572d95['include']=[{'all':!![]}];}_0x572d95=_[_0xeb4a('0x3d')]({},_0x572d95,_0x3aa454[_0xeb4a('0x3e')]);return db[_0xeb4a('0x2d')][_0xeb4a('0x47')](_0x572d95)[_0xeb4a('0x21')](handleEntityNotFound(_0x3b6aa7,null))[_0xeb4a('0x21')](respondWithResult(_0x3b6aa7,null))[_0xeb4a('0x42')](handleError(_0x3b6aa7,null));};exports[_0xeb4a('0x48')]=function(_0x23490c,_0x4c5c0a){return db[_0xeb4a('0x2d')][_0xeb4a('0x48')](_0x23490c['body'],{})[_0xeb4a('0x21')](function(_0x1d746a){var _0x384772=_0x23490c[_0xeb4a('0x49')][_0xeb4a('0x23')]({'plain':!![]});if(!_0x384772)throw new Error(_0xeb4a('0x4a'));if(_0x384772[_0xeb4a('0x4b')]===_0xeb4a('0x49')){var _0x4fe8d7=_0x1d746a[_0xeb4a('0x23')]({'plain':!![]});var _0x3876c9=_0xeb4a('0x24');return db[_0xeb4a('0x4c')][_0xeb4a('0x47')]({'where':{'name':_0x3876c9,'userProfileId':_0x384772[_0xeb4a('0x4d')]},'raw':!![]})[_0xeb4a('0x21')](function(_0x4a53ec){if(_0x4a53ec&&_0x4a53ec[_0xeb4a('0x4e')]===0x0){return db[_0xeb4a('0x25')][_0xeb4a('0x48')]({'name':_0x4fe8d7[_0xeb4a('0x29')],'resourceId':_0x4fe8d7['id'],'type':_0x4a53ec[_0xeb4a('0x29')],'sectionId':_0x4a53ec['id']},{})[_0xeb4a('0x21')](function(){return _0x1d746a;});}else{return _0x1d746a;}})['catch'](function(_0xd4be66){logger[_0xeb4a('0x27')](_0xeb4a('0x4f'),_0xd4be66);throw _0xd4be66;});}return _0x1d746a;})[_0xeb4a('0x21')](respondWithResult(_0x4c5c0a,0xc9))[_0xeb4a('0x42')](handleError(_0x4c5c0a,null));};exports[_0xeb4a('0x50')]=function(_0x3a171a,_0x41f7df){if(_0x3a171a[_0xeb4a('0x51')]['id']){delete _0x3a171a[_0xeb4a('0x51')]['id'];}return db[_0xeb4a('0x2d')][_0xeb4a('0x47')]({'where':{'id':_0x3a171a[_0xeb4a('0x44')]['id']}})[_0xeb4a('0x21')](handleEntityNotFound(_0x41f7df,null))[_0xeb4a('0x21')](saveUpdates(_0x3a171a['body'],null))[_0xeb4a('0x21')](respondWithResult(_0x41f7df,null))[_0xeb4a('0x42')](handleError(_0x41f7df,null));};exports[_0xeb4a('0x22')]=function(_0x4aee31,_0x49d297){return db['Template'][_0xeb4a('0x47')]({'where':{'id':_0x4aee31[_0xeb4a('0x44')]['id']}})['then'](handleEntityNotFound(_0x49d297,null))[_0xeb4a('0x21')](removeEntity(_0x49d297,null))[_0xeb4a('0x42')](handleError(_0x49d297,null));}; \ No newline at end of file +var _0x2234=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Template','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','create','body','user','role','Templates'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x2234,0x14a));var _0x4223=function(_0x4e9df2,_0x36818e){_0x4e9df2=_0x4e9df2-0x0;var _0x9fe790=_0x2234[_0x4e9df2];return _0x9fe790;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4223('0x0'));var jsonpatch=require(_0x4223('0x1'));var rp=require('request-promise');var moment=require(_0x4223('0x2'));var BPromise=require(_0x4223('0x3'));var Mustache=require(_0x4223('0x4'));var util=require('util');var path=require(_0x4223('0x5'));var sox=require(_0x4223('0x6'));var csv=require(_0x4223('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4223('0x8'));var squel=require('squel');var crypto=require(_0x4223('0x9'));var jsforce=require(_0x4223('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4223('0x7'));var querystring=require(_0x4223('0xb'));var Papa=require(_0x4223('0xc'));var Redis=require(_0x4223('0xd'));var authService=require(_0x4223('0xe'));var qs=require(_0x4223('0xf'));var as=require(_0x4223('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4223('0x11'))(_0x4223('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4223('0x13'));var db=require(_0x4223('0x14'))['db'];function respondWithStatusCode(_0x57a5fe,_0x22a621){_0x22a621=_0x22a621||0xcc;return function(_0x157e3d){if(_0x157e3d){return _0x57a5fe[_0x4223('0x15')](_0x22a621);}return _0x57a5fe[_0x4223('0x16')](_0x22a621)[_0x4223('0x17')]();};}function respondWithResult(_0xd947f3,_0x174b5c){_0x174b5c=_0x174b5c||0xc8;return function(_0x56e43a){if(_0x56e43a){return _0xd947f3[_0x4223('0x16')](_0x174b5c)[_0x4223('0x18')](_0x56e43a);}};}function respondWithFilteredResult(_0x15207f,_0x48d8c4){return function(_0x135c7c){if(_0x135c7c){var _0x1c54a2=typeof _0x48d8c4[_0x4223('0x19')]===_0x4223('0x1a')&&typeof _0x48d8c4[_0x4223('0x1b')]===_0x4223('0x1a');var _0x21d8c2=_0x135c7c[_0x4223('0x1c')];var _0x578e3b=_0x1c54a2?0x0:_0x48d8c4[_0x4223('0x19')];var _0x518c30=_0x1c54a2?_0x135c7c[_0x4223('0x1c')]:_0x48d8c4[_0x4223('0x19')]+_0x48d8c4['limit'];var _0x395bd3;if(_0x518c30>=_0x21d8c2){_0x518c30=_0x21d8c2;_0x395bd3=0xc8;}else{_0x395bd3=0xce;}_0x15207f[_0x4223('0x16')](_0x395bd3);return _0x15207f['set'](_0x4223('0x1d'),_0x578e3b+'-'+_0x518c30+'/'+_0x21d8c2)['json'](_0x135c7c);}return null;};}function patchUpdates(_0x1421bd){return function(_0x27f89c){try{jsonpatch[_0x4223('0x1e')](_0x27f89c,_0x1421bd,!![]);}catch(_0x134551){return BPromise[_0x4223('0x1f')](_0x134551);}return _0x27f89c[_0x4223('0x20')]();};}function saveUpdates(_0x5aea0e,_0x5285fc){return function(_0x5a6bc1){if(_0x5a6bc1){return _0x5a6bc1[_0x4223('0x21')](_0x5aea0e)[_0x4223('0x22')](function(_0x4005fa){return _0x4005fa;});}return null;};}function removeEntity(_0x27dd4b,_0x2c2456){return function(_0x41bfc3){if(_0x41bfc3){return _0x41bfc3[_0x4223('0x23')]()['then'](function(){var _0x34ff5f=_0x41bfc3[_0x4223('0x24')]({'plain':!![]});var _0x5dba20='Templates';return db[_0x4223('0x25')][_0x4223('0x23')]({'where':{'type':_0x5dba20,'resourceId':_0x34ff5f['id']}})['then'](function(){return _0x41bfc3;});})[_0x4223('0x22')](function(){_0x27dd4b[_0x4223('0x16')](0xcc)[_0x4223('0x17')]();});}};}function handleEntityNotFound(_0x1126bf,_0x7c6e9e){return function(_0x1a1d68){if(!_0x1a1d68){_0x1126bf[_0x4223('0x15')](0x194);}return _0x1a1d68;};}function handleError(_0x4d02f8,_0x2579c8){_0x2579c8=_0x2579c8||0x1f4;return function(_0x3c99fe){logger[_0x4223('0x26')](_0x3c99fe[_0x4223('0x27')]);if(_0x3c99fe[_0x4223('0x28')]){delete _0x3c99fe[_0x4223('0x28')];}_0x4d02f8['status'](_0x2579c8)[_0x4223('0x29')](_0x3c99fe);};}exports[_0x4223('0x2a')]=function(_0x5abd93,_0xff8b66){var _0x5ad204={},_0xda9c2b={},_0x39578f={'count':0x0,'rows':[]};var _0x58667e=_[_0x4223('0x2b')](db[_0x4223('0x2c')][_0x4223('0x2d')],function(_0x130d59){return{'name':_0x130d59[_0x4223('0x2e')],'type':_0x130d59['type'][_0x4223('0x2f')]};});_0xda9c2b[_0x4223('0x30')]=_[_0x4223('0x2b')](_0x58667e,_0x4223('0x28'));_0xda9c2b[_0x4223('0x31')]=_[_0x4223('0x32')](_0x5abd93[_0x4223('0x31')]);_0xda9c2b[_0x4223('0x33')]=_[_0x4223('0x34')](_0xda9c2b['model'],_0xda9c2b[_0x4223('0x31')]);_0x5ad204[_0x4223('0x35')]=_[_0x4223('0x34')](_0xda9c2b[_0x4223('0x30')],qs[_0x4223('0x36')](_0x5abd93[_0x4223('0x31')]['fields']));_0x5ad204[_0x4223('0x35')]=_0x5ad204[_0x4223('0x35')][_0x4223('0x37')]?_0x5ad204[_0x4223('0x35')]:_0xda9c2b[_0x4223('0x30')];if(!_0x5abd93['query'][_0x4223('0x38')]('nolimit')){_0x5ad204[_0x4223('0x1b')]=qs[_0x4223('0x1b')](_0x5abd93['query']['limit']);_0x5ad204['offset']=qs['offset'](_0x5abd93[_0x4223('0x31')][_0x4223('0x19')]);}_0x5ad204[_0x4223('0x39')]=qs[_0x4223('0x3a')](_0x5abd93[_0x4223('0x31')][_0x4223('0x3a')]);_0x5ad204[_0x4223('0x3b')]=qs[_0x4223('0x33')](_['pick'](_0x5abd93[_0x4223('0x31')],_0xda9c2b[_0x4223('0x33')]),_0x58667e);if(_0x5abd93[_0x4223('0x31')][_0x4223('0x3c')]){_0x5ad204[_0x4223('0x3b')]=_[_0x4223('0x3d')](_0x5ad204[_0x4223('0x3b')],{'$or':_['map'](_0x58667e,function(_0x471a3d){if(_0x471a3d[_0x4223('0x3e')]!==_0x4223('0x3f')){var _0x374203={};_0x374203[_0x471a3d[_0x4223('0x28')]]={'$like':'%'+_0x5abd93[_0x4223('0x31')]['filter']+'%'};return _0x374203;}})});}_0x5ad204=_[_0x4223('0x3d')]({},_0x5ad204,_0x5abd93[_0x4223('0x40')]);var _0xdd1429={'where':_0x5ad204['where']};return db[_0x4223('0x2c')][_0x4223('0x1c')](_0xdd1429)['then'](function(_0x5879c1){_0x39578f['count']=_0x5879c1;if(_0x5abd93[_0x4223('0x31')][_0x4223('0x41')]){_0x5ad204[_0x4223('0x42')]=[{'all':!![]}];}return db[_0x4223('0x2c')]['findAll'](_0x5ad204);})[_0x4223('0x22')](function(_0x5cd396){_0x39578f[_0x4223('0x43')]=_0x5cd396;return _0x39578f;})['then'](respondWithFilteredResult(_0xff8b66,_0x5ad204))[_0x4223('0x44')](handleError(_0xff8b66,null));};exports[_0x4223('0x45')]=function(_0x344dc8,_0x57d88c){var _0x1c3845={'raw':!![],'where':{'id':_0x344dc8['params']['id']}},_0x28d244={};_0x28d244[_0x4223('0x30')]=_[_0x4223('0x32')](db['Template']['rawAttributes']);_0x28d244[_0x4223('0x31')]=_['keys'](_0x344dc8[_0x4223('0x31')]);_0x28d244['filters']=_[_0x4223('0x34')](_0x28d244['model'],_0x28d244[_0x4223('0x31')]);_0x1c3845[_0x4223('0x35')]=_['intersection'](_0x28d244[_0x4223('0x30')],qs['fields'](_0x344dc8[_0x4223('0x31')]['fields']));_0x1c3845[_0x4223('0x35')]=_0x1c3845['attributes']['length']?_0x1c3845[_0x4223('0x35')]:_0x28d244['model'];if(_0x344dc8[_0x4223('0x31')]['includeAll']){_0x1c3845[_0x4223('0x42')]=[{'all':!![]}];}_0x1c3845=_['merge']({},_0x1c3845,_0x344dc8[_0x4223('0x40')]);return db['Template']['find'](_0x1c3845)['then'](handleEntityNotFound(_0x57d88c,null))['then'](respondWithResult(_0x57d88c,null))['catch'](handleError(_0x57d88c,null));};exports['create']=function(_0x2291b0,_0x476514){return db[_0x4223('0x2c')][_0x4223('0x46')](_0x2291b0[_0x4223('0x47')],{})['then'](function(_0x42bfec){var _0x3e5328=_0x2291b0[_0x4223('0x48')][_0x4223('0x24')]({'plain':!![]});if(!_0x3e5328)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e5328[_0x4223('0x49')]===_0x4223('0x48')){var _0x5dfd11=_0x42bfec[_0x4223('0x24')]({'plain':!![]});var _0x4677b9=_0x4223('0x4a');return db[_0x4223('0x4b')]['find']({'where':{'name':_0x4677b9,'userProfileId':_0x3e5328[_0x4223('0x4c')]},'raw':!![]})[_0x4223('0x22')](function(_0x248f05){if(_0x248f05&&_0x248f05[_0x4223('0x4d')]===0x0){return db[_0x4223('0x25')]['create']({'name':_0x5dfd11[_0x4223('0x28')],'resourceId':_0x5dfd11['id'],'type':_0x248f05[_0x4223('0x28')],'sectionId':_0x248f05['id']},{})['then'](function(){return _0x42bfec;});}else{return _0x42bfec;}})[_0x4223('0x44')](function(_0x3c8150){logger[_0x4223('0x26')](_0x4223('0x4e'),_0x3c8150);throw _0x3c8150;});}return _0x42bfec;})[_0x4223('0x22')](respondWithResult(_0x476514,0xc9))['catch'](handleError(_0x476514,null));};exports[_0x4223('0x21')]=function(_0x581f7d,_0x40524c){if(_0x581f7d['body']['id']){delete _0x581f7d[_0x4223('0x47')]['id'];}return db[_0x4223('0x2c')][_0x4223('0x4f')]({'where':{'id':_0x581f7d[_0x4223('0x50')]['id']}})[_0x4223('0x22')](handleEntityNotFound(_0x40524c,null))[_0x4223('0x22')](saveUpdates(_0x581f7d['body'],null))[_0x4223('0x22')](respondWithResult(_0x40524c,null))[_0x4223('0x44')](handleError(_0x40524c,null));};exports['destroy']=function(_0x4f9c97,_0xbb8c42){return db[_0x4223('0x2c')][_0x4223('0x4f')]({'where':{'id':_0x4f9c97[_0x4223('0x50')]['id']}})[_0x4223('0x22')](handleEntityNotFound(_0xbb8c42,null))['then'](removeEntity(_0xbb8c42,null))[_0x4223('0x44')](handleError(_0xbb8c42,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 72e5aab..342484a 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 _0xe442=['Template','util','api','moment','request-promise','../../config/environment','./template.attributes','exports'];(function(_0x47bc4f,_0x3c20a4){var _0xfee090=function(_0xd24881){while(--_0xd24881){_0x47bc4f['push'](_0x47bc4f['shift']());}};_0xfee090(++_0x3c20a4);}(_0xe442,0x181));var _0x2e44=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xe442[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require('lodash');var util=require(_0x2e44('0x0'));var logger=require('../../config/logger')(_0x2e44('0x1'));var moment=require(_0x2e44('0x2'));var BPromise=require('bluebird');var rp=require(_0x2e44('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2e44('0x4'));var attributes=require(_0x2e44('0x5'));module[_0x2e44('0x6')]=function(_0x5e4c8f,_0x1be4c8){return _0x5e4c8f['define'](_0x2e44('0x7'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x571e=['bluebird','path','rimraf','../../config/environment','./template.attributes','exports','Template','tools_templates','lodash','util','../../config/logger','api','moment'];(function(_0x203803,_0x2141b0){var _0x4843a2=function(_0x1ec8da){while(--_0x1ec8da){_0x203803['push'](_0x203803['shift']());}};_0x4843a2(++_0x2141b0);}(_0x571e,0xa4));var _0xe571=function(_0xc4f1e9,_0x147f85){_0xc4f1e9=_0xc4f1e9-0x0;var _0x31a937=_0x571e[_0xc4f1e9];return _0x31a937;};'use strict';var _=require(_0xe571('0x0'));var util=require(_0xe571('0x1'));var logger=require(_0xe571('0x2'))(_0xe571('0x3'));var moment=require(_0xe571('0x4'));var BPromise=require(_0xe571('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe571('0x6'));var rimraf=require(_0xe571('0x7'));var config=require(_0xe571('0x8'));var attributes=require(_0xe571('0x9'));module[_0xe571('0xa')]=function(_0x572d4f,_0x3fc512){return _0x572d4f['define'](_0xe571('0xb'),attributes,{'tableName':_0xe571('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 7875e0a..5acfae7 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 _0x8b49=['options','where','limit','include','map','model','attributes','GetTemplate','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','stringify','error','code','Template,\x20%s,\x20%s','message','catch','Template','raw'];(function(_0x3d73ba,_0x356e23){var _0x47e406=function(_0x90df31){while(--_0x90df31){_0x3d73ba['push'](_0x3d73ba['shift']());}};_0x47e406(++_0x356e23);}(_0x8b49,0xb2));var _0x98b4=function(_0x328fe8,_0x3959b4){_0x328fe8=_0x328fe8-0x0;var _0x28eab1=_0x8b49[_0x328fe8];return _0x28eab1;};'use strict';var _=require(_0x98b4('0x0'));var util=require(_0x98b4('0x1'));var moment=require(_0x98b4('0x2'));var BPromise=require(_0x98b4('0x3'));var rs=require(_0x98b4('0x4'));var fs=require('fs');var Redis=require(_0x98b4('0x5'));var db=require(_0x98b4('0x6'))['db'];var utils=require(_0x98b4('0x7'));var logger=require(_0x98b4('0x8'))(_0x98b4('0x9'));var config=require(_0x98b4('0xa'));var jayson=require(_0x98b4('0xb'));var client=jayson[_0x98b4('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39d3ac,_0x109207,_0x10a466){return new BPromise(function(_0x4ce75a,_0x1a99ac){return client[_0x98b4('0xd')](_0x39d3ac,_0x10a466)[_0x98b4('0xe')](function(_0x4c5771){logger[_0x98b4('0xf')]('Template,\x20%s,\x20%s',_0x109207,'request\x20sent');logger[_0x98b4('0x10')]('Template,\x20%s,\x20%s,\x20%s',_0x109207,_0x98b4('0x11'),JSON[_0x98b4('0x12')](_0x4c5771));if(_0x4c5771[_0x98b4('0x13')]){if(_0x4c5771['error'][_0x98b4('0x14')]===0x1f4){logger['error'](_0x98b4('0x15'),_0x109207,_0x4c5771[_0x98b4('0x13')]['message']);return _0x1a99ac(_0x4c5771[_0x98b4('0x13')][_0x98b4('0x16')]);}logger['error']('Template,\x20%s,\x20%s',_0x109207,_0x4c5771['error'][_0x98b4('0x16')]);return _0x4ce75a(_0x4c5771[_0x98b4('0x13')][_0x98b4('0x16')]);}else{logger[_0x98b4('0xf')](_0x98b4('0x15'),_0x109207,'request\x20sent');_0x4ce75a(_0x4c5771['result']['message']);}})[_0x98b4('0x17')](function(_0x1b82d2){logger[_0x98b4('0x13')](_0x98b4('0x15'),_0x109207,_0x1b82d2);_0x1a99ac(_0x1b82d2);});});}exports['GetTemplate']=function(_0x4ca741){var _0xe8cf06=this;return new Promise(function(_0x1b2afc,_0x3f49a0){return db[_0x98b4('0x18')]['findAll']({'raw':_0x4ca741['options']?_0x4ca741['options'][_0x98b4('0x19')]===undefined?!![]:![]:!![],'where':_0x4ca741[_0x98b4('0x1a')]?_0x4ca741[_0x98b4('0x1a')][_0x98b4('0x1b')]||null:null,'attributes':_0x4ca741[_0x98b4('0x1a')]?_0x4ca741[_0x98b4('0x1a')]['attributes']||null:null,'limit':_0x4ca741[_0x98b4('0x1a')]?_0x4ca741[_0x98b4('0x1a')][_0x98b4('0x1c')]||null:null,'include':_0x4ca741['options']?_0x4ca741[_0x98b4('0x1a')][_0x98b4('0x1d')]?_[_0x98b4('0x1e')](_0x4ca741[_0x98b4('0x1a')]['include'],function(_0x2ef243){return{'model':db[_0x2ef243[_0x98b4('0x1f')]],'as':_0x2ef243['as'],'attributes':_0x2ef243[_0x98b4('0x20')],'include':_0x2ef243[_0x98b4('0x1d')]?_[_0x98b4('0x1e')](_0x2ef243['include'],function(_0x760f35){return{'model':db[_0x760f35[_0x98b4('0x1f')]],'as':_0x760f35['as'],'attributes':_0x760f35[_0x98b4('0x20')],'include':_0x760f35[_0x98b4('0x1d')]?_[_0x98b4('0x1e')](_0x760f35['include'],function(_0x98c2b4){return{'model':db[_0x98c2b4[_0x98b4('0x1f')]],'as':_0x98c2b4['as'],'attributes':_0x98c2b4[_0x98b4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x98b4('0xe')](function(_0x4ba255){logger[_0x98b4('0xf')]('GetTemplate',_0x4ca741);logger['debug'](_0x98b4('0x21'),_0x4ca741,JSON[_0x98b4('0x12')](_0x4ba255));_0x1b2afc(_0x4ba255);})[_0x98b4('0x17')](function(_0x5070e1){logger[_0x98b4('0x13')](_0x98b4('0x21'),_0x5070e1[_0x98b4('0x16')],_0x4ca741);_0x3f49a0(_0xe8cf06[_0x98b4('0x13')](0x1f4,_0x5070e1[_0x98b4('0x16')]));});});}; \ No newline at end of file +var _0x3e86=['request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','GetTemplate','Template','findAll','options','raw','where','limit','include','map','model','attributes','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x477069,_0x3ce70c){var _0x5e3bb0=function(_0x10dda9){while(--_0x10dda9){_0x477069['push'](_0x477069['shift']());}};_0x5e3bb0(++_0x3ce70c);}(_0x3e86,0x16a));var _0x63e8=function(_0x3a5023,_0x4febf8){_0x3a5023=_0x3a5023-0x0;var _0x16c8db=_0x3e86[_0x3a5023];return _0x16c8db;};'use strict';var _=require(_0x63e8('0x0'));var util=require(_0x63e8('0x1'));var moment=require(_0x63e8('0x2'));var BPromise=require(_0x63e8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x63e8('0x4'))['db'];var utils=require(_0x63e8('0x5'));var logger=require(_0x63e8('0x6'))(_0x63e8('0x7'));var config=require(_0x63e8('0x8'));var jayson=require(_0x63e8('0x9'));var client=jayson[_0x63e8('0xa')][_0x63e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47349c,_0x31dd02,_0x35d5b5){return new BPromise(function(_0x2ce0e4,_0x35303e){return client[_0x63e8('0xc')](_0x47349c,_0x35d5b5)[_0x63e8('0xd')](function(_0x30f9f1){logger[_0x63e8('0xe')](_0x63e8('0xf'),_0x31dd02,_0x63e8('0x10'));logger[_0x63e8('0x11')](_0x63e8('0x12'),_0x31dd02,_0x63e8('0x10'),JSON[_0x63e8('0x13')](_0x30f9f1));if(_0x30f9f1['error']){if(_0x30f9f1[_0x63e8('0x14')]['code']===0x1f4){logger[_0x63e8('0x14')](_0x63e8('0xf'),_0x31dd02,_0x30f9f1[_0x63e8('0x14')][_0x63e8('0x15')]);return _0x35303e(_0x30f9f1[_0x63e8('0x14')][_0x63e8('0x15')]);}logger['error'](_0x63e8('0xf'),_0x31dd02,_0x30f9f1['error']['message']);return _0x2ce0e4(_0x30f9f1['error'][_0x63e8('0x15')]);}else{logger[_0x63e8('0xe')](_0x63e8('0xf'),_0x31dd02,_0x63e8('0x10'));_0x2ce0e4(_0x30f9f1['result'][_0x63e8('0x15')]);}})['catch'](function(_0x5bcbb5){logger['error'](_0x63e8('0xf'),_0x31dd02,_0x5bcbb5);_0x35303e(_0x5bcbb5);});});}exports[_0x63e8('0x16')]=function(_0x5c2440){var _0x448207=this;return new Promise(function(_0x59da1e,_0x257e7f){return db[_0x63e8('0x17')][_0x63e8('0x18')]({'raw':_0x5c2440[_0x63e8('0x19')]?_0x5c2440[_0x63e8('0x19')][_0x63e8('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c2440[_0x63e8('0x19')]?_0x5c2440[_0x63e8('0x19')][_0x63e8('0x1b')]||null:null,'attributes':_0x5c2440['options']?_0x5c2440['options']['attributes']||null:null,'limit':_0x5c2440[_0x63e8('0x19')]?_0x5c2440[_0x63e8('0x19')][_0x63e8('0x1c')]||null:null,'include':_0x5c2440[_0x63e8('0x19')]?_0x5c2440[_0x63e8('0x19')][_0x63e8('0x1d')]?_['map'](_0x5c2440[_0x63e8('0x19')][_0x63e8('0x1d')],function(_0x315d27){return{'model':db[_0x315d27['model']],'as':_0x315d27['as'],'attributes':_0x315d27['attributes'],'include':_0x315d27[_0x63e8('0x1d')]?_[_0x63e8('0x1e')](_0x315d27[_0x63e8('0x1d')],function(_0x16efe2){return{'model':db[_0x16efe2['model']],'as':_0x16efe2['as'],'attributes':_0x16efe2['attributes'],'include':_0x16efe2[_0x63e8('0x1d')]?_[_0x63e8('0x1e')](_0x16efe2['include'],function(_0x1b48ca){return{'model':db[_0x1b48ca[_0x63e8('0x1f')]],'as':_0x1b48ca['as'],'attributes':_0x1b48ca[_0x63e8('0x20')]};}):[]};}):[]};}):[]:[]})[_0x63e8('0xd')](function(_0x298f6e){logger['info'](_0x63e8('0x16'),_0x5c2440);logger[_0x63e8('0x11')](_0x63e8('0x16'),_0x5c2440,JSON['stringify'](_0x298f6e));_0x59da1e(_0x298f6e);})[_0x63e8('0x21')](function(_0x480f72){logger['error']('GetTemplate',_0x480f72[_0x63e8('0x15')],_0x5c2440);_0x257e7f(_0x448207[_0x63e8('0x14')](0x1f4,_0x480f72[_0x63e8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index b64f10a..d367653 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 _0xc12e=['getActions','addAllCondition','post','addAnyCondition','addAction','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions'];(function(_0x2c03d9,_0x3ada63){var _0x3a5873=function(_0x23bf11){while(--_0x23bf11){_0x2c03d9['push'](_0x2c03d9['shift']());}};_0x3a5873(++_0x3ada63);}(_0xc12e,0x13f));var _0xec12=function(_0x460666,_0x24bfa0){_0x460666=_0x460666-0x0;var _0x555cbf=_0xc12e[_0x460666];return _0x555cbf;};'use strict';var multer=require(_0xec12('0x0'));var util=require(_0xec12('0x1'));var path=require(_0xec12('0x2'));var timeout=require(_0xec12('0x3'));var express=require('express');var router=express[_0xec12('0x4')]();var fs_extra=require(_0xec12('0x5'));var auth=require(_0xec12('0x6'));var interaction=require(_0xec12('0x7'));var config=require(_0xec12('0x8'));var controller=require(_0xec12('0x9'));router[_0xec12('0xa')]('/',auth[_0xec12('0xb')](),controller['index']);router['get']('/:id',auth[_0xec12('0xb')](),controller['show']);router['get'](_0xec12('0xc'),auth[_0xec12('0xb')](),controller[_0xec12('0xd')]);router[_0xec12('0xa')](_0xec12('0xe'),auth[_0xec12('0xb')](),controller[_0xec12('0xf')]);router[_0xec12('0xa')](_0xec12('0x10'),auth[_0xec12('0xb')](),controller[_0xec12('0x11')]);router['post']('/',auth[_0xec12('0xb')](),controller['create']);router['post'](_0xec12('0xc'),auth['isAuthenticated'](),controller[_0xec12('0x12')]);router[_0xec12('0x13')](_0xec12('0xe'),auth['isAuthenticated'](),controller[_0xec12('0x14')]);router[_0xec12('0x13')]('/:id/actions',auth[_0xec12('0xb')](),controller[_0xec12('0x15')]);router[_0xec12('0x16')](_0xec12('0x17'),auth['isAuthenticated'](),controller[_0xec12('0x18')]);router[_0xec12('0x19')](_0xec12('0x17'),auth[_0xec12('0xb')](),controller[_0xec12('0x1a')]);module[_0xec12('0x1b')]=router; \ No newline at end of file +var _0x40ca=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','post','/:id/any_conditions','addAction','put','delete','destroy','exports','multer','util','path','express'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x40ca,0x14e));var _0xa40c=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x40ca[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0xa40c('0x0'));var util=require(_0xa40c('0x1'));var path=require(_0xa40c('0x2'));var timeout=require('connect-timeout');var express=require(_0xa40c('0x3'));var router=express[_0xa40c('0x4')]();var fs_extra=require(_0xa40c('0x5'));var auth=require(_0xa40c('0x6'));var interaction=require(_0xa40c('0x7'));var config=require(_0xa40c('0x8'));var controller=require(_0xa40c('0x9'));router[_0xa40c('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa40c('0xb'),auth[_0xa40c('0xc')](),controller[_0xa40c('0xd')]);router[_0xa40c('0xa')](_0xa40c('0xe'),auth[_0xa40c('0xc')](),controller[_0xa40c('0xf')]);router[_0xa40c('0xa')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0xa40c('0x10')]);router[_0xa40c('0xa')](_0xa40c('0x11'),auth[_0xa40c('0xc')](),controller[_0xa40c('0x12')]);router[_0xa40c('0x13')]('/',auth[_0xa40c('0xc')](),controller['create']);router[_0xa40c('0x13')](_0xa40c('0xe'),auth['isAuthenticated'](),controller['addAllCondition']);router['post'](_0xa40c('0x14'),auth[_0xa40c('0xc')](),controller['addAnyCondition']);router[_0xa40c('0x13')]('/:id/actions',auth[_0xa40c('0xc')](),controller[_0xa40c('0x15')]);router[_0xa40c('0x16')](_0xa40c('0xb'),auth[_0xa40c('0xc')](),controller['update']);router[_0xa40c('0x17')](_0xa40c('0xb'),auth[_0xa40c('0xc')](),controller[_0xa40c('0x18')]);module[_0xa40c('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 754de33..dde19a3 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 _0x99ed=['sequelize','exports','STRING','BOOLEAN'];(function(_0x4ac320,_0x288cfc){var _0x22e691=function(_0x353ebf){while(--_0x353ebf){_0x4ac320['push'](_0x4ac320['shift']());}};_0x22e691(++_0x288cfc);}(_0x99ed,0x90));var _0xd99e=function(_0x16569d,_0x1d26e0){_0x16569d=_0x16569d-0x0;var _0x504b4b=_0x99ed[_0x16569d];return _0x504b4b;};'use strict';var Sequelize=require(_0xd99e('0x0'));module[_0xd99e('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd99e('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xd99e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe043=['BOOLEAN','sequelize','exports','STRING'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xe043,0x1d1));var _0x3e04=function(_0x287510,_0x100cde){_0x287510=_0x287510-0x0;var _0x3ce677=_0xe043[_0x287510];return _0x3ce677;};'use strict';var Sequelize=require(_0x3e04('0x0'));module[_0x3e04('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3e04('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x3e04('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 6246882..891f33a 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 _0x92a4=['../../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','get','Triggers','UserProfileResource','destroy','name','send','index','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','map','VIRTUAL','merge','options','Trigger','include','catch','params','keys','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','find','addAllCondition','TriggerAllId','Condition','getAllConditions','findOne','rawAttributes','order','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3d85be,_0x53c96c){var _0x41242c=function(_0x4b87fd){while(--_0x4b87fd){_0x3d85be['push'](_0x3d85be['shift']());}};_0x41242c(++_0x53c96c);}(_0x92a4,0x101));var _0x492a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x92a4[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x492a('0x0'));var jsonpatch=require(_0x492a('0x1'));var rp=require(_0x492a('0x2'));var moment=require(_0x492a('0x3'));var BPromise=require(_0x492a('0x4'));var Mustache=require('mustache');var util=require(_0x492a('0x5'));var path=require(_0x492a('0x6'));var sox=require(_0x492a('0x7'));var csv=require('to-csv');var ejs=require(_0x492a('0x8'));var fs=require('fs');var fs_extra=require(_0x492a('0x9'));var _=require(_0x492a('0xa'));var squel=require(_0x492a('0xb'));var crypto=require(_0x492a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x492a('0xd'));var toCsv=require(_0x492a('0xe'));var querystring=require(_0x492a('0xf'));var Papa=require(_0x492a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x492a('0x11'));var hardwareService=require(_0x492a('0x12'));var logger=require(_0x492a('0x13'))(_0x492a('0x14'));var utils=require(_0x492a('0x15'));var config=require(_0x492a('0x16'));var licenseUtil=require(_0x492a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46068e,_0x5e4596){_0x5e4596=_0x5e4596||0xcc;return function(_0xa7b0ae){if(_0xa7b0ae){return _0x46068e[_0x492a('0x18')](_0x5e4596);}return _0x46068e[_0x492a('0x19')](_0x5e4596)[_0x492a('0x1a')]();};}function respondWithResult(_0x272634,_0x5f18d8){_0x5f18d8=_0x5f18d8||0xc8;return function(_0x32cc46){if(_0x32cc46){return _0x272634['status'](_0x5f18d8)[_0x492a('0x1b')](_0x32cc46);}};}function respondWithFilteredResult(_0x5c2fd1,_0x1bcf20){return function(_0x4d3583){if(_0x4d3583){var _0x8ef598=typeof _0x1bcf20[_0x492a('0x1c')]===_0x492a('0x1d')&&typeof _0x1bcf20[_0x492a('0x1e')]===_0x492a('0x1d');var _0x2eb1be=_0x4d3583[_0x492a('0x1f')];var _0xe04356=_0x8ef598?0x0:_0x1bcf20[_0x492a('0x1c')];var _0x17c464=_0x8ef598?_0x4d3583['count']:_0x1bcf20[_0x492a('0x1c')]+_0x1bcf20['limit'];var _0x4a3e72;if(_0x17c464>=_0x2eb1be){_0x17c464=_0x2eb1be;_0x4a3e72=0xc8;}else{_0x4a3e72=0xce;}_0x5c2fd1[_0x492a('0x19')](_0x4a3e72);return _0x5c2fd1[_0x492a('0x20')](_0x492a('0x21'),_0xe04356+'-'+_0x17c464+'/'+_0x2eb1be)['json'](_0x4d3583);}return null;};}function patchUpdates(_0x2f672f){return function(_0x2ab1bd){try{jsonpatch[_0x492a('0x22')](_0x2ab1bd,_0x2f672f,!![]);}catch(_0x44c932){return BPromise[_0x492a('0x23')](_0x44c932);}return _0x2ab1bd[_0x492a('0x24')]();};}function saveUpdates(_0x2f8ba6,_0x59fe4f){return function(_0x378282){if(_0x378282){return _0x378282[_0x492a('0x25')](_0x2f8ba6)['then'](function(_0x172d22){return _0x172d22;});}return null;};}function removeEntity(_0x213d36,_0x48e00a){return function(_0x4d440c){if(_0x4d440c){return _0x4d440c['destroy']()[_0x492a('0x26')](function(){var _0x3bd1d2=_0x4d440c[_0x492a('0x27')]({'plain':!![]});var _0x5ec3a7=_0x492a('0x28');return db[_0x492a('0x29')][_0x492a('0x2a')]({'where':{'type':_0x5ec3a7,'resourceId':_0x3bd1d2['id']}})[_0x492a('0x26')](function(){return _0x4d440c;});})['then'](function(){_0x213d36[_0x492a('0x19')](0xcc)[_0x492a('0x1a')]();});}};}function handleEntityNotFound(_0x58155e,_0x563865){return function(_0x807bd9){if(!_0x807bd9){_0x58155e[_0x492a('0x18')](0x194);}return _0x807bd9;};}function handleError(_0x52f77f,_0x16984e){_0x16984e=_0x16984e||0x1f4;return function(_0x4876f4){logger['error'](_0x4876f4['stack']);if(_0x4876f4[_0x492a('0x2b')]){delete _0x4876f4['name'];}_0x52f77f[_0x492a('0x19')](_0x16984e)[_0x492a('0x2c')](_0x4876f4);};}exports[_0x492a('0x2d')]=function(_0x5ae075,_0x227199){var _0x1e9cc0={},_0x24dc46={},_0x2652ae={'count':0x0,'rows':[]};var _0x45b294=_['map'](db['Trigger']['rawAttributes'],function(_0x294b2d){return{'name':_0x294b2d['fieldName'],'type':_0x294b2d[_0x492a('0x2e')][_0x492a('0x2f')]};});_0x24dc46[_0x492a('0x30')]=_['map'](_0x45b294,_0x492a('0x2b'));_0x24dc46[_0x492a('0x31')]=_['keys'](_0x5ae075[_0x492a('0x31')]);_0x24dc46[_0x492a('0x32')]=_['intersection'](_0x24dc46['model'],_0x24dc46['query']);_0x1e9cc0[_0x492a('0x33')]=_[_0x492a('0x34')](_0x24dc46[_0x492a('0x30')],qs[_0x492a('0x35')](_0x5ae075['query']['fields']));_0x1e9cc0[_0x492a('0x33')]=_0x1e9cc0[_0x492a('0x33')][_0x492a('0x36')]?_0x1e9cc0[_0x492a('0x33')]:_0x24dc46['model'];if(!_0x5ae075[_0x492a('0x31')]['hasOwnProperty'](_0x492a('0x37'))){_0x1e9cc0[_0x492a('0x1e')]=qs[_0x492a('0x1e')](_0x5ae075[_0x492a('0x31')][_0x492a('0x1e')]);_0x1e9cc0['offset']=qs['offset'](_0x5ae075[_0x492a('0x31')][_0x492a('0x1c')]);}_0x1e9cc0['order']=qs[_0x492a('0x38')](_0x5ae075[_0x492a('0x31')][_0x492a('0x38')]);_0x1e9cc0[_0x492a('0x39')]=qs[_0x492a('0x32')](_[_0x492a('0x3a')](_0x5ae075[_0x492a('0x31')],_0x24dc46['filters']),_0x45b294);if(_0x5ae075['query'][_0x492a('0x3b')]){_0x1e9cc0[_0x492a('0x39')]=_['merge'](_0x1e9cc0[_0x492a('0x39')],{'$or':_[_0x492a('0x3c')](_0x45b294,function(_0x160dc6){if(_0x160dc6['type']!==_0x492a('0x3d')){var _0x4a88e5={};_0x4a88e5[_0x160dc6[_0x492a('0x2b')]]={'$like':'%'+_0x5ae075[_0x492a('0x31')]['filter']+'%'};return _0x4a88e5;}})});}_0x1e9cc0=_[_0x492a('0x3e')]({},_0x1e9cc0,_0x5ae075[_0x492a('0x3f')]);var _0x51586e={'where':_0x1e9cc0[_0x492a('0x39')]};return db[_0x492a('0x40')][_0x492a('0x1f')](_0x51586e)[_0x492a('0x26')](function(_0x4df745){_0x2652ae['count']=_0x4df745;if(_0x5ae075[_0x492a('0x31')]['includeAll']){_0x1e9cc0[_0x492a('0x41')]=[{'all':!![]}];}return db[_0x492a('0x40')]['findAll'](_0x1e9cc0);})[_0x492a('0x26')](function(_0x47d365){_0x2652ae['rows']=_0x47d365;return _0x2652ae;})[_0x492a('0x26')](respondWithFilteredResult(_0x227199,_0x1e9cc0))[_0x492a('0x42')](handleError(_0x227199,null));};exports['show']=function(_0x24fe8a,_0x15babb){var _0x147835={'raw':![],'where':{'id':_0x24fe8a[_0x492a('0x43')]['id']}},_0x25cdc3={};_0x25cdc3[_0x492a('0x30')]=_['keys'](db[_0x492a('0x40')]['rawAttributes']);_0x25cdc3[_0x492a('0x31')]=_[_0x492a('0x44')](_0x24fe8a[_0x492a('0x31')]);_0x25cdc3['filters']=_[_0x492a('0x34')](_0x25cdc3['model'],_0x25cdc3[_0x492a('0x31')]);_0x147835['attributes']=_[_0x492a('0x34')](_0x25cdc3['model'],qs[_0x492a('0x35')](_0x24fe8a['query']['fields']));_0x147835['attributes']=_0x147835[_0x492a('0x33')][_0x492a('0x36')]?_0x147835[_0x492a('0x33')]:_0x25cdc3['model'];if(_0x24fe8a[_0x492a('0x31')][_0x492a('0x45')]){_0x147835[_0x492a('0x41')]=[{'all':!![]}];}_0x147835=_[_0x492a('0x3e')]({},_0x147835,_0x24fe8a['options']);return db[_0x492a('0x40')]['find'](_0x147835)[_0x492a('0x26')](handleEntityNotFound(_0x15babb,null))[_0x492a('0x26')](respondWithResult(_0x15babb,null))[_0x492a('0x42')](handleError(_0x15babb,null));};exports[_0x492a('0x46')]=function(_0x303321,_0x295b29){return db['Trigger'][_0x492a('0x46')](_0x303321[_0x492a('0x47')],{})['then'](function(_0x41c8a8){var _0x38ec30=_0x303321['user'][_0x492a('0x27')]({'plain':!![]});if(!_0x38ec30)throw new Error(_0x492a('0x48'));if(_0x38ec30[_0x492a('0x49')]===_0x492a('0x4a')){var _0x54d41d=_0x41c8a8[_0x492a('0x27')]({'plain':!![]});var _0x50a390=_0x492a('0x28');return db[_0x492a('0x4b')]['find']({'where':{'name':_0x50a390,'userProfileId':_0x38ec30[_0x492a('0x4c')]},'raw':!![]})['then'](function(_0x44df2a){if(_0x44df2a&&_0x44df2a[_0x492a('0x4d')]===0x0){return db['UserProfileResource'][_0x492a('0x46')]({'name':_0x54d41d[_0x492a('0x2b')],'resourceId':_0x54d41d['id'],'type':_0x44df2a[_0x492a('0x2b')],'sectionId':_0x44df2a['id']},{})['then'](function(){return _0x41c8a8;});}else{return _0x41c8a8;}})[_0x492a('0x42')](function(_0x3f1a1f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f1a1f);throw _0x3f1a1f;});}return _0x41c8a8;})[_0x492a('0x26')](respondWithResult(_0x295b29,0xc9))['catch'](handleError(_0x295b29,null));};exports[_0x492a('0x25')]=function(_0x4468ca,_0x569286){if(_0x4468ca[_0x492a('0x47')]['id']){delete _0x4468ca['body']['id'];}return db[_0x492a('0x40')][_0x492a('0x4e')]({'where':{'id':_0x4468ca[_0x492a('0x43')]['id']}})[_0x492a('0x26')](handleEntityNotFound(_0x569286,null))['then'](saveUpdates(_0x4468ca[_0x492a('0x47')],null))[_0x492a('0x26')](respondWithResult(_0x569286,null))[_0x492a('0x42')](handleError(_0x569286,null));};exports[_0x492a('0x2a')]=function(_0x3c4865,_0x43d52b){return db[_0x492a('0x40')][_0x492a('0x4e')]({'where':{'id':_0x3c4865[_0x492a('0x43')]['id']}})[_0x492a('0x26')](handleEntityNotFound(_0x43d52b,null))[_0x492a('0x26')](removeEntity(_0x43d52b,null))['catch'](handleError(_0x43d52b,null));};exports[_0x492a('0x4f')]=function(_0x4201e3,_0x1276a8,_0x428a8d){if(_0x4201e3[_0x492a('0x47')]['id']){delete _0x4201e3[_0x492a('0x47')]['id'];}return db['Trigger'][_0x492a('0x4e')]({'where':{'id':_0x4201e3[_0x492a('0x43')]['id']}})[_0x492a('0x26')](handleEntityNotFound(_0x1276a8,null))[_0x492a('0x26')](function(_0x3bd268){if(_0x3bd268){_0x4201e3[_0x492a('0x47')][_0x492a('0x50')]=_0x3bd268['id'];return db[_0x492a('0x51')][_0x492a('0x46')](_0x4201e3[_0x492a('0x47')]);}})[_0x492a('0x26')](respondWithResult(_0x1276a8,null))[_0x492a('0x42')](handleError(_0x1276a8,null));};exports['addAnyCondition']=function(_0x55ef99,_0x523bd9,_0x39bd71){if(_0x55ef99['body']['id']){delete _0x55ef99['body']['id'];}return db[_0x492a('0x40')][_0x492a('0x4e')]({'where':{'id':_0x55ef99[_0x492a('0x43')]['id']}})[_0x492a('0x26')](handleEntityNotFound(_0x523bd9,null))['then'](function(_0x1c13bb){if(_0x1c13bb){_0x55ef99[_0x492a('0x47')]['TriggerAnyId']=_0x1c13bb['id'];return db['Condition'][_0x492a('0x46')](_0x55ef99[_0x492a('0x47')]);}})[_0x492a('0x26')](respondWithResult(_0x523bd9,null))['catch'](handleError(_0x523bd9,null));};exports[_0x492a('0x52')]=function(_0x400596,_0x264971,_0x59964b){var _0x4cf626={};var _0x40e9c5={};var _0x431e8c;var _0x4a71c1;return db[_0x492a('0x40')][_0x492a('0x53')]({'where':{'id':_0x400596['params']['id']}})[_0x492a('0x26')](handleEntityNotFound(_0x264971,null))[_0x492a('0x26')](function(_0x3cdbdd){if(_0x3cdbdd){_0x431e8c=_0x3cdbdd;_0x40e9c5[_0x492a('0x30')]=_[_0x492a('0x44')](db[_0x492a('0x51')][_0x492a('0x54')]);_0x40e9c5[_0x492a('0x31')]=_[_0x492a('0x44')](_0x400596[_0x492a('0x31')]);_0x40e9c5[_0x492a('0x32')]=_['intersection'](_0x40e9c5[_0x492a('0x30')],_0x40e9c5['query']);_0x4cf626[_0x492a('0x33')]=_['intersection'](_0x40e9c5['model'],qs[_0x492a('0x35')](_0x400596[_0x492a('0x31')]['fields']));_0x4cf626['attributes']=_0x4cf626[_0x492a('0x33')][_0x492a('0x36')]?_0x4cf626[_0x492a('0x33')]:_0x40e9c5['model'];_0x4cf626[_0x492a('0x55')]=qs[_0x492a('0x38')](_0x400596[_0x492a('0x31')]['sort']);_0x4cf626[_0x492a('0x39')]=qs[_0x492a('0x32')](_['pick'](_0x400596[_0x492a('0x31')],_0x40e9c5[_0x492a('0x32')]));if(_0x400596[_0x492a('0x31')][_0x492a('0x3b')]){_0x4cf626[_0x492a('0x39')]=_[_0x492a('0x3e')](_0x4cf626['where'],{'$or':_['map'](_0x4cf626[_0x492a('0x33')],function(_0x202391){var _0x401841={};_0x401841[_0x202391]={'$like':'%'+_0x400596[_0x492a('0x31')]['filter']+'%'};return _0x401841;})});}_0x4cf626=_[_0x492a('0x3e')]({},_0x4cf626,_0x400596[_0x492a('0x3f')]);return _0x431e8c[_0x492a('0x52')](_0x4cf626);}})[_0x492a('0x26')](function(_0x52398f){if(_0x52398f){_0x4a71c1=_0x52398f[_0x492a('0x36')];if(!_0x400596['query'][_0x492a('0x56')](_0x492a('0x37'))){_0x4cf626[_0x492a('0x1e')]=qs[_0x492a('0x1e')](_0x400596[_0x492a('0x31')][_0x492a('0x1e')]);_0x4cf626[_0x492a('0x1c')]=qs['offset'](_0x400596[_0x492a('0x31')]['offset']);}return _0x431e8c[_0x492a('0x52')](_0x4cf626);}})[_0x492a('0x26')](function(_0x3f6501){if(_0x3f6501){return _0x3f6501?{'count':_0x4a71c1,'rows':_0x3f6501}:null;}})[_0x492a('0x26')](respondWithResult(_0x264971,null))[_0x492a('0x42')](handleError(_0x264971,null));};exports[_0x492a('0x57')]=function(_0x5993d1,_0x468dec,_0x58e678){var _0x23686a={};var _0x13fb7f={};var _0x1a8185;var _0x2fc2dc;return db['Trigger'][_0x492a('0x53')]({'where':{'id':_0x5993d1[_0x492a('0x43')]['id']}})['then'](handleEntityNotFound(_0x468dec,null))[_0x492a('0x26')](function(_0x17836c){if(_0x17836c){_0x1a8185=_0x17836c;_0x13fb7f['model']=_[_0x492a('0x44')](db[_0x492a('0x51')][_0x492a('0x54')]);_0x13fb7f['query']=_[_0x492a('0x44')](_0x5993d1[_0x492a('0x31')]);_0x13fb7f['filters']=_[_0x492a('0x34')](_0x13fb7f[_0x492a('0x30')],_0x13fb7f[_0x492a('0x31')]);_0x23686a['attributes']=_[_0x492a('0x34')](_0x13fb7f['model'],qs[_0x492a('0x35')](_0x5993d1[_0x492a('0x31')][_0x492a('0x35')]));_0x23686a['attributes']=_0x23686a[_0x492a('0x33')][_0x492a('0x36')]?_0x23686a[_0x492a('0x33')]:_0x13fb7f[_0x492a('0x30')];_0x23686a[_0x492a('0x55')]=qs[_0x492a('0x38')](_0x5993d1[_0x492a('0x31')][_0x492a('0x38')]);_0x23686a[_0x492a('0x39')]=qs[_0x492a('0x32')](_[_0x492a('0x3a')](_0x5993d1['query'],_0x13fb7f[_0x492a('0x32')]));if(_0x5993d1['query']['filter']){_0x23686a[_0x492a('0x39')]=_[_0x492a('0x3e')](_0x23686a[_0x492a('0x39')],{'$or':_[_0x492a('0x3c')](_0x23686a['attributes'],function(_0x481267){var _0xe78c83={};_0xe78c83[_0x481267]={'$like':'%'+_0x5993d1[_0x492a('0x31')][_0x492a('0x3b')]+'%'};return _0xe78c83;})});}_0x23686a=_['merge']({},_0x23686a,_0x5993d1['options']);return _0x1a8185['getAnyConditions'](_0x23686a);}})[_0x492a('0x26')](function(_0xb155aa){if(_0xb155aa){_0x2fc2dc=_0xb155aa[_0x492a('0x36')];if(!_0x5993d1['query'][_0x492a('0x56')](_0x492a('0x37'))){_0x23686a['limit']=qs[_0x492a('0x1e')](_0x5993d1[_0x492a('0x31')]['limit']);_0x23686a[_0x492a('0x1c')]=qs['offset'](_0x5993d1[_0x492a('0x31')][_0x492a('0x1c')]);}return _0x1a8185[_0x492a('0x57')](_0x23686a);}})[_0x492a('0x26')](function(_0x2a06c7){if(_0x2a06c7){return _0x2a06c7?{'count':_0x2fc2dc,'rows':_0x2a06c7}:null;}})[_0x492a('0x26')](respondWithResult(_0x468dec,null))[_0x492a('0x42')](handleError(_0x468dec,null));};exports[_0x492a('0x58')]=function(_0x4bcc39,_0x5d2fc1,_0xebacd5){if(_0x4bcc39[_0x492a('0x47')]['id']){delete _0x4bcc39['body']['id'];}return db[_0x492a('0x40')][_0x492a('0x4e')]({'where':{'id':_0x4bcc39['params']['id']}})[_0x492a('0x26')](handleEntityNotFound(_0x5d2fc1,null))[_0x492a('0x26')](function(_0xc7c8dd){if(_0xc7c8dd){_0x4bcc39[_0x492a('0x47')][_0x492a('0x59')]=_0xc7c8dd['id'];return db[_0x492a('0x5a')][_0x492a('0x46')](_0x4bcc39[_0x492a('0x47')]);}})['then'](respondWithResult(_0x5d2fc1,null))[_0x492a('0x42')](handleError(_0x5d2fc1,null));};exports['getActions']=function(_0x4c5311,_0x4c909c,_0x5c6eb7){var _0x3e360c={};var _0x2f5057={};var _0x3dbdcc;var _0xc33a98;return db['Trigger'][_0x492a('0x53')]({'where':{'id':_0x4c5311[_0x492a('0x43')]['id']}})[_0x492a('0x26')](handleEntityNotFound(_0x4c909c,null))['then'](function(_0x229d43){if(_0x229d43){_0x3dbdcc=_0x229d43;_0x2f5057[_0x492a('0x30')]=_['keys'](db[_0x492a('0x5a')]['rawAttributes']);_0x2f5057[_0x492a('0x31')]=_[_0x492a('0x44')](_0x4c5311[_0x492a('0x31')]);_0x2f5057[_0x492a('0x32')]=_[_0x492a('0x34')](_0x2f5057['model'],_0x2f5057['query']);_0x3e360c[_0x492a('0x33')]=_['intersection'](_0x2f5057[_0x492a('0x30')],qs[_0x492a('0x35')](_0x4c5311['query'][_0x492a('0x35')]));_0x3e360c[_0x492a('0x33')]=_0x3e360c[_0x492a('0x33')][_0x492a('0x36')]?_0x3e360c[_0x492a('0x33')]:_0x2f5057[_0x492a('0x30')];_0x3e360c[_0x492a('0x55')]=qs[_0x492a('0x38')](_0x4c5311[_0x492a('0x31')][_0x492a('0x38')]);_0x3e360c[_0x492a('0x39')]=qs[_0x492a('0x32')](_['pick'](_0x4c5311['query'],_0x2f5057[_0x492a('0x32')]));if(_0x4c5311[_0x492a('0x31')][_0x492a('0x3b')]){_0x3e360c[_0x492a('0x39')]=_[_0x492a('0x3e')](_0x3e360c['where'],{'$or':_[_0x492a('0x3c')](_0x3e360c['attributes'],function(_0x5742a3){var _0x574a7f={};_0x574a7f[_0x5742a3]={'$like':'%'+_0x4c5311[_0x492a('0x31')][_0x492a('0x3b')]+'%'};return _0x574a7f;})});}_0x3e360c=_[_0x492a('0x3e')]({},_0x3e360c,_0x4c5311[_0x492a('0x3f')]);return _0x3dbdcc[_0x492a('0x5b')](_0x3e360c);}})['then'](function(_0x185d6f){if(_0x185d6f){_0xc33a98=_0x185d6f[_0x492a('0x36')];if(!_0x4c5311[_0x492a('0x31')]['hasOwnProperty'](_0x492a('0x37'))){_0x3e360c[_0x492a('0x1e')]=qs[_0x492a('0x1e')](_0x4c5311[_0x492a('0x31')][_0x492a('0x1e')]);_0x3e360c[_0x492a('0x1c')]=qs[_0x492a('0x1c')](_0x4c5311[_0x492a('0x31')][_0x492a('0x1c')]);}return _0x3dbdcc[_0x492a('0x5b')](_0x3e360c);}})[_0x492a('0x26')](function(_0x34016c){if(_0x34016c){return _0x34016c?{'count':_0xc33a98,'rows':_0x34016c}:null;}})[_0x492a('0x26')](respondWithResult(_0x4c909c,null))[_0x492a('0x42')](handleError(_0x4c909c,null));}; \ No newline at end of file +var _0x00b4=['TriggerId','getActions','Action','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','json','undefined','count','offset','Content-Range','update','then','destroy','get','Triggers','UserProfileResource','sendStatus','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','order','pick','getAnyConditions','addAction'];(function(_0x56cf67,_0x157b8c){var _0x44f026=function(_0x46dbdb){while(--_0x46dbdb){_0x56cf67['push'](_0x56cf67['shift']());}};_0x44f026(++_0x157b8c);}(_0x00b4,0x111));var _0x400b=function(_0x29e782,_0x5d846a){_0x29e782=_0x29e782-0x0;var _0x3e919f=_0x00b4[_0x29e782];return _0x3e919f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x400b('0x0'));var zipdir=require(_0x400b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x400b('0x2'));var moment=require(_0x400b('0x3'));var BPromise=require(_0x400b('0x4'));var Mustache=require(_0x400b('0x5'));var util=require('util');var path=require(_0x400b('0x6'));var sox=require(_0x400b('0x7'));var csv=require(_0x400b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x400b('0x9'));var _=require(_0x400b('0xa'));var squel=require('squel');var crypto=require(_0x400b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x400b('0xc'));var toCsv=require(_0x400b('0x8'));var querystring=require(_0x400b('0xd'));var Papa=require(_0x400b('0xe'));var Redis=require(_0x400b('0xf'));var authService=require(_0x400b('0x10'));var qs=require(_0x400b('0x11'));var as=require(_0x400b('0x12'));var hardwareService=require(_0x400b('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x400b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x400b('0x15'))['db'];function respondWithStatusCode(_0x5e9d19,_0x5d3b40){_0x5d3b40=_0x5d3b40||0xcc;return function(_0x458814){if(_0x458814){return _0x5e9d19['sendStatus'](_0x5d3b40);}return _0x5e9d19[_0x400b('0x16')](_0x5d3b40)['end']();};}function respondWithResult(_0x3c3d49,_0x5e4db4){_0x5e4db4=_0x5e4db4||0xc8;return function(_0x3cb2d4){if(_0x3cb2d4){return _0x3c3d49[_0x400b('0x16')](_0x5e4db4)[_0x400b('0x17')](_0x3cb2d4);}};}function respondWithFilteredResult(_0x298799,_0x2dcb98){return function(_0x386020){if(_0x386020){var _0x5a05d8=typeof _0x2dcb98['offset']===_0x400b('0x18')&&typeof _0x2dcb98['limit']===_0x400b('0x18');var _0x624a39=_0x386020[_0x400b('0x19')];var _0x5dd56d=_0x5a05d8?0x0:_0x2dcb98['offset'];var _0x186dc8=_0x5a05d8?_0x386020['count']:_0x2dcb98[_0x400b('0x1a')]+_0x2dcb98['limit'];var _0x6ba7;if(_0x186dc8>=_0x624a39){_0x186dc8=_0x624a39;_0x6ba7=0xc8;}else{_0x6ba7=0xce;}_0x298799['status'](_0x6ba7);return _0x298799['set'](_0x400b('0x1b'),_0x5dd56d+'-'+_0x186dc8+'/'+_0x624a39)[_0x400b('0x17')](_0x386020);}return null;};}function patchUpdates(_0x20e9fc){return function(_0x40e387){try{jsonpatch['apply'](_0x40e387,_0x20e9fc,!![]);}catch(_0x1327e6){return BPromise['reject'](_0x1327e6);}return _0x40e387['save']();};}function saveUpdates(_0x2d0a9c,_0x2c94bd){return function(_0x9b00ef){if(_0x9b00ef){return _0x9b00ef[_0x400b('0x1c')](_0x2d0a9c)[_0x400b('0x1d')](function(_0x507f88){return _0x507f88;});}return null;};}function removeEntity(_0x1ac68a,_0xd1484f){return function(_0x5091b){if(_0x5091b){return _0x5091b[_0x400b('0x1e')]()['then'](function(){var _0x2692b3=_0x5091b[_0x400b('0x1f')]({'plain':!![]});var _0x1d5d6e=_0x400b('0x20');return db[_0x400b('0x21')][_0x400b('0x1e')]({'where':{'type':_0x1d5d6e,'resourceId':_0x2692b3['id']}})[_0x400b('0x1d')](function(){return _0x5091b;});})['then'](function(){_0x1ac68a[_0x400b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f80c1,_0x5a284c){return function(_0x55723b){if(!_0x55723b){_0x4f80c1[_0x400b('0x22')](0x194);}return _0x55723b;};}function handleError(_0x4807be,_0x3acd68){_0x3acd68=_0x3acd68||0x1f4;return function(_0x2df961){logger['error'](_0x2df961[_0x400b('0x23')]);if(_0x2df961['name']){delete _0x2df961[_0x400b('0x24')];}_0x4807be[_0x400b('0x16')](_0x3acd68)[_0x400b('0x25')](_0x2df961);};}exports[_0x400b('0x26')]=function(_0xaaded3,_0x326dbf){var _0x41ac87={},_0x12f436={},_0x422865={'count':0x0,'rows':[]};var _0x57cb61=_[_0x400b('0x27')](db[_0x400b('0x28')][_0x400b('0x29')],function(_0xff12ae){return{'name':_0xff12ae[_0x400b('0x2a')],'type':_0xff12ae[_0x400b('0x2b')][_0x400b('0x2c')]};});_0x12f436[_0x400b('0x2d')]=_[_0x400b('0x27')](_0x57cb61,'name');_0x12f436[_0x400b('0x2e')]=_[_0x400b('0x2f')](_0xaaded3[_0x400b('0x2e')]);_0x12f436[_0x400b('0x30')]=_[_0x400b('0x31')](_0x12f436[_0x400b('0x2d')],_0x12f436[_0x400b('0x2e')]);_0x41ac87[_0x400b('0x32')]=_[_0x400b('0x31')](_0x12f436['model'],qs[_0x400b('0x33')](_0xaaded3[_0x400b('0x2e')][_0x400b('0x33')]));_0x41ac87[_0x400b('0x32')]=_0x41ac87[_0x400b('0x32')][_0x400b('0x34')]?_0x41ac87[_0x400b('0x32')]:_0x12f436[_0x400b('0x2d')];if(!_0xaaded3[_0x400b('0x2e')]['hasOwnProperty'](_0x400b('0x35'))){_0x41ac87[_0x400b('0x36')]=qs[_0x400b('0x36')](_0xaaded3[_0x400b('0x2e')][_0x400b('0x36')]);_0x41ac87[_0x400b('0x1a')]=qs[_0x400b('0x1a')](_0xaaded3[_0x400b('0x2e')][_0x400b('0x1a')]);}_0x41ac87['order']=qs[_0x400b('0x37')](_0xaaded3[_0x400b('0x2e')][_0x400b('0x37')]);_0x41ac87[_0x400b('0x38')]=qs[_0x400b('0x30')](_['pick'](_0xaaded3[_0x400b('0x2e')],_0x12f436[_0x400b('0x30')]),_0x57cb61);if(_0xaaded3[_0x400b('0x2e')]['filter']){_0x41ac87[_0x400b('0x38')]=_[_0x400b('0x39')](_0x41ac87[_0x400b('0x38')],{'$or':_[_0x400b('0x27')](_0x57cb61,function(_0x549e5d){if(_0x549e5d['type']!==_0x400b('0x3a')){var _0x1f5bed={};_0x1f5bed[_0x549e5d[_0x400b('0x24')]]={'$like':'%'+_0xaaded3[_0x400b('0x2e')][_0x400b('0x3b')]+'%'};return _0x1f5bed;}})});}_0x41ac87=_[_0x400b('0x39')]({},_0x41ac87,_0xaaded3[_0x400b('0x3c')]);var _0x3141fa={'where':_0x41ac87['where']};return db['Trigger'][_0x400b('0x19')](_0x3141fa)[_0x400b('0x1d')](function(_0x14199c){_0x422865[_0x400b('0x19')]=_0x14199c;if(_0xaaded3[_0x400b('0x2e')]['includeAll']){_0x41ac87[_0x400b('0x3d')]=[{'all':!![]}];}return db[_0x400b('0x28')][_0x400b('0x3e')](_0x41ac87);})['then'](function(_0x4fa65f){_0x422865['rows']=_0x4fa65f;return _0x422865;})[_0x400b('0x1d')](respondWithFilteredResult(_0x326dbf,_0x41ac87))[_0x400b('0x3f')](handleError(_0x326dbf,null));};exports[_0x400b('0x40')]=function(_0x394a3b,_0x350c97){var _0x54e050={'raw':![],'where':{'id':_0x394a3b[_0x400b('0x41')]['id']}},_0x231889={};_0x231889[_0x400b('0x2d')]=_[_0x400b('0x2f')](db['Trigger'][_0x400b('0x29')]);_0x231889[_0x400b('0x2e')]=_[_0x400b('0x2f')](_0x394a3b[_0x400b('0x2e')]);_0x231889[_0x400b('0x30')]=_[_0x400b('0x31')](_0x231889[_0x400b('0x2d')],_0x231889[_0x400b('0x2e')]);_0x54e050['attributes']=_[_0x400b('0x31')](_0x231889[_0x400b('0x2d')],qs['fields'](_0x394a3b[_0x400b('0x2e')][_0x400b('0x33')]));_0x54e050[_0x400b('0x32')]=_0x54e050[_0x400b('0x32')][_0x400b('0x34')]?_0x54e050[_0x400b('0x32')]:_0x231889[_0x400b('0x2d')];if(_0x394a3b[_0x400b('0x2e')][_0x400b('0x42')]){_0x54e050[_0x400b('0x3d')]=[{'all':!![]}];}_0x54e050=_[_0x400b('0x39')]({},_0x54e050,_0x394a3b[_0x400b('0x3c')]);return db['Trigger'][_0x400b('0x43')](_0x54e050)[_0x400b('0x1d')](handleEntityNotFound(_0x350c97,null))[_0x400b('0x1d')](respondWithResult(_0x350c97,null))[_0x400b('0x3f')](handleError(_0x350c97,null));};exports[_0x400b('0x44')]=function(_0x388751,_0xfea36f){return db['Trigger'][_0x400b('0x44')](_0x388751[_0x400b('0x45')],{})[_0x400b('0x1d')](function(_0x417227){var _0x48b846=_0x388751[_0x400b('0x46')][_0x400b('0x1f')]({'plain':!![]});if(!_0x48b846)throw new Error(_0x400b('0x47'));if(_0x48b846['role']===_0x400b('0x46')){var _0x52ff36=_0x417227['get']({'plain':!![]});var _0x4a62db=_0x400b('0x20');return db[_0x400b('0x48')][_0x400b('0x43')]({'where':{'name':_0x4a62db,'userProfileId':_0x48b846[_0x400b('0x49')]},'raw':!![]})[_0x400b('0x1d')](function(_0x1eaa5e){if(_0x1eaa5e&&_0x1eaa5e[_0x400b('0x4a')]===0x0){return db[_0x400b('0x21')][_0x400b('0x44')]({'name':_0x52ff36[_0x400b('0x24')],'resourceId':_0x52ff36['id'],'type':_0x1eaa5e['name'],'sectionId':_0x1eaa5e['id']},{})[_0x400b('0x1d')](function(){return _0x417227;});}else{return _0x417227;}})['catch'](function(_0x5b02e2){logger[_0x400b('0x4b')](_0x400b('0x4c'),_0x5b02e2);throw _0x5b02e2;});}return _0x417227;})[_0x400b('0x1d')](respondWithResult(_0xfea36f,0xc9))['catch'](handleError(_0xfea36f,null));};exports['update']=function(_0x33e954,_0x244421){if(_0x33e954[_0x400b('0x45')]['id']){delete _0x33e954['body']['id'];}return db[_0x400b('0x28')]['find']({'where':{'id':_0x33e954[_0x400b('0x41')]['id']}})[_0x400b('0x1d')](handleEntityNotFound(_0x244421,null))['then'](saveUpdates(_0x33e954['body'],null))[_0x400b('0x1d')](respondWithResult(_0x244421,null))['catch'](handleError(_0x244421,null));};exports[_0x400b('0x1e')]=function(_0x40b19e,_0x1873d1){return db[_0x400b('0x28')][_0x400b('0x43')]({'where':{'id':_0x40b19e[_0x400b('0x41')]['id']}})[_0x400b('0x1d')](handleEntityNotFound(_0x1873d1,null))[_0x400b('0x1d')](removeEntity(_0x1873d1,null))[_0x400b('0x3f')](handleError(_0x1873d1,null));};exports[_0x400b('0x4d')]=function(_0x1f2712,_0x3e52d5,_0x387b5e){if(_0x1f2712[_0x400b('0x45')]['id']){delete _0x1f2712[_0x400b('0x45')]['id'];}return db[_0x400b('0x28')][_0x400b('0x43')]({'where':{'id':_0x1f2712['params']['id']}})[_0x400b('0x1d')](handleEntityNotFound(_0x3e52d5,null))['then'](function(_0x339bce){if(_0x339bce){_0x1f2712[_0x400b('0x45')][_0x400b('0x4e')]=_0x339bce['id'];return db[_0x400b('0x4f')][_0x400b('0x44')](_0x1f2712[_0x400b('0x45')]);}})['then'](respondWithResult(_0x3e52d5,null))['catch'](handleError(_0x3e52d5,null));};exports['addAnyCondition']=function(_0x50337d,_0x5ba81c,_0xd51a00){if(_0x50337d[_0x400b('0x45')]['id']){delete _0x50337d[_0x400b('0x45')]['id'];}return db[_0x400b('0x28')][_0x400b('0x43')]({'where':{'id':_0x50337d['params']['id']}})[_0x400b('0x1d')](handleEntityNotFound(_0x5ba81c,null))[_0x400b('0x1d')](function(_0x4aa653){if(_0x4aa653){_0x50337d[_0x400b('0x45')][_0x400b('0x50')]=_0x4aa653['id'];return db['Condition'][_0x400b('0x44')](_0x50337d[_0x400b('0x45')]);}})['then'](respondWithResult(_0x5ba81c,null))[_0x400b('0x3f')](handleError(_0x5ba81c,null));};exports[_0x400b('0x51')]=function(_0x3a475f,_0x1772db,_0x241960){var _0x4c1766={};var _0x5522cc={};var _0x437f46;var _0x261602;return db[_0x400b('0x28')][_0x400b('0x52')]({'where':{'id':_0x3a475f[_0x400b('0x41')]['id']}})[_0x400b('0x1d')](handleEntityNotFound(_0x1772db,null))['then'](function(_0x3b0130){if(_0x3b0130){_0x437f46=_0x3b0130;_0x5522cc[_0x400b('0x2d')]=_[_0x400b('0x2f')](db[_0x400b('0x4f')][_0x400b('0x29')]);_0x5522cc[_0x400b('0x2e')]=_[_0x400b('0x2f')](_0x3a475f[_0x400b('0x2e')]);_0x5522cc['filters']=_[_0x400b('0x31')](_0x5522cc['model'],_0x5522cc[_0x400b('0x2e')]);_0x4c1766['attributes']=_[_0x400b('0x31')](_0x5522cc[_0x400b('0x2d')],qs[_0x400b('0x33')](_0x3a475f['query'][_0x400b('0x33')]));_0x4c1766[_0x400b('0x32')]=_0x4c1766[_0x400b('0x32')][_0x400b('0x34')]?_0x4c1766[_0x400b('0x32')]:_0x5522cc[_0x400b('0x2d')];_0x4c1766[_0x400b('0x53')]=qs[_0x400b('0x37')](_0x3a475f[_0x400b('0x2e')][_0x400b('0x37')]);_0x4c1766['where']=qs['filters'](_[_0x400b('0x54')](_0x3a475f[_0x400b('0x2e')],_0x5522cc[_0x400b('0x30')]));if(_0x3a475f['query'][_0x400b('0x3b')]){_0x4c1766['where']=_[_0x400b('0x39')](_0x4c1766[_0x400b('0x38')],{'$or':_[_0x400b('0x27')](_0x4c1766[_0x400b('0x32')],function(_0x4b14d9){var _0x545ba2={};_0x545ba2[_0x4b14d9]={'$like':'%'+_0x3a475f[_0x400b('0x2e')][_0x400b('0x3b')]+'%'};return _0x545ba2;})});}_0x4c1766=_[_0x400b('0x39')]({},_0x4c1766,_0x3a475f[_0x400b('0x3c')]);return _0x437f46[_0x400b('0x51')](_0x4c1766);}})[_0x400b('0x1d')](function(_0x4dfa4a){if(_0x4dfa4a){_0x261602=_0x4dfa4a[_0x400b('0x34')];if(!_0x3a475f['query']['hasOwnProperty']('nolimit')){_0x4c1766[_0x400b('0x36')]=qs[_0x400b('0x36')](_0x3a475f[_0x400b('0x2e')][_0x400b('0x36')]);_0x4c1766[_0x400b('0x1a')]=qs[_0x400b('0x1a')](_0x3a475f['query'][_0x400b('0x1a')]);}return _0x437f46['getAllConditions'](_0x4c1766);}})[_0x400b('0x1d')](function(_0x37c6c6){if(_0x37c6c6){return _0x37c6c6?{'count':_0x261602,'rows':_0x37c6c6}:null;}})[_0x400b('0x1d')](respondWithResult(_0x1772db,null))[_0x400b('0x3f')](handleError(_0x1772db,null));};exports[_0x400b('0x55')]=function(_0x5f461b,_0x4a0d06,_0x54c065){var _0x200a41={};var _0x23af04={};var _0x3e7304;var _0x24100c;return db[_0x400b('0x28')][_0x400b('0x52')]({'where':{'id':_0x5f461b[_0x400b('0x41')]['id']}})[_0x400b('0x1d')](handleEntityNotFound(_0x4a0d06,null))[_0x400b('0x1d')](function(_0x1c0f1f){if(_0x1c0f1f){_0x3e7304=_0x1c0f1f;_0x23af04[_0x400b('0x2d')]=_[_0x400b('0x2f')](db[_0x400b('0x4f')][_0x400b('0x29')]);_0x23af04[_0x400b('0x2e')]=_[_0x400b('0x2f')](_0x5f461b['query']);_0x23af04[_0x400b('0x30')]=_['intersection'](_0x23af04[_0x400b('0x2d')],_0x23af04[_0x400b('0x2e')]);_0x200a41[_0x400b('0x32')]=_[_0x400b('0x31')](_0x23af04['model'],qs['fields'](_0x5f461b[_0x400b('0x2e')][_0x400b('0x33')]));_0x200a41[_0x400b('0x32')]=_0x200a41[_0x400b('0x32')][_0x400b('0x34')]?_0x200a41[_0x400b('0x32')]:_0x23af04[_0x400b('0x2d')];_0x200a41[_0x400b('0x53')]=qs['sort'](_0x5f461b[_0x400b('0x2e')][_0x400b('0x37')]);_0x200a41['where']=qs[_0x400b('0x30')](_[_0x400b('0x54')](_0x5f461b[_0x400b('0x2e')],_0x23af04[_0x400b('0x30')]));if(_0x5f461b[_0x400b('0x2e')]['filter']){_0x200a41['where']=_['merge'](_0x200a41['where'],{'$or':_[_0x400b('0x27')](_0x200a41['attributes'],function(_0x42430c){var _0x240f5a={};_0x240f5a[_0x42430c]={'$like':'%'+_0x5f461b[_0x400b('0x2e')][_0x400b('0x3b')]+'%'};return _0x240f5a;})});}_0x200a41=_['merge']({},_0x200a41,_0x5f461b[_0x400b('0x3c')]);return _0x3e7304[_0x400b('0x55')](_0x200a41);}})[_0x400b('0x1d')](function(_0x3b08f4){if(_0x3b08f4){_0x24100c=_0x3b08f4['length'];if(!_0x5f461b[_0x400b('0x2e')]['hasOwnProperty'](_0x400b('0x35'))){_0x200a41[_0x400b('0x36')]=qs[_0x400b('0x36')](_0x5f461b[_0x400b('0x2e')][_0x400b('0x36')]);_0x200a41[_0x400b('0x1a')]=qs[_0x400b('0x1a')](_0x5f461b['query'][_0x400b('0x1a')]);}return _0x3e7304[_0x400b('0x55')](_0x200a41);}})[_0x400b('0x1d')](function(_0x5381b3){if(_0x5381b3){return _0x5381b3?{'count':_0x24100c,'rows':_0x5381b3}:null;}})['then'](respondWithResult(_0x4a0d06,null))[_0x400b('0x3f')](handleError(_0x4a0d06,null));};exports[_0x400b('0x56')]=function(_0x1f2fbf,_0x5c84da,_0x5b6020){if(_0x1f2fbf['body']['id']){delete _0x1f2fbf[_0x400b('0x45')]['id'];}return db[_0x400b('0x28')][_0x400b('0x43')]({'where':{'id':_0x1f2fbf[_0x400b('0x41')]['id']}})['then'](handleEntityNotFound(_0x5c84da,null))[_0x400b('0x1d')](function(_0x4ad4a3){if(_0x4ad4a3){_0x1f2fbf['body'][_0x400b('0x57')]=_0x4ad4a3['id'];return db['Action']['create'](_0x1f2fbf[_0x400b('0x45')]);}})[_0x400b('0x1d')](respondWithResult(_0x5c84da,null))['catch'](handleError(_0x5c84da,null));};exports[_0x400b('0x58')]=function(_0x24dc03,_0x2fa31f,_0x228d43){var _0x1e9f32={};var _0x4d85d9={};var _0x23ad18;var _0x90942d;return db['Trigger'][_0x400b('0x52')]({'where':{'id':_0x24dc03[_0x400b('0x41')]['id']}})[_0x400b('0x1d')](handleEntityNotFound(_0x2fa31f,null))[_0x400b('0x1d')](function(_0x19d917){if(_0x19d917){_0x23ad18=_0x19d917;_0x4d85d9[_0x400b('0x2d')]=_[_0x400b('0x2f')](db[_0x400b('0x59')][_0x400b('0x29')]);_0x4d85d9['query']=_[_0x400b('0x2f')](_0x24dc03[_0x400b('0x2e')]);_0x4d85d9[_0x400b('0x30')]=_[_0x400b('0x31')](_0x4d85d9[_0x400b('0x2d')],_0x4d85d9[_0x400b('0x2e')]);_0x1e9f32[_0x400b('0x32')]=_['intersection'](_0x4d85d9['model'],qs['fields'](_0x24dc03[_0x400b('0x2e')][_0x400b('0x33')]));_0x1e9f32[_0x400b('0x32')]=_0x1e9f32[_0x400b('0x32')][_0x400b('0x34')]?_0x1e9f32[_0x400b('0x32')]:_0x4d85d9[_0x400b('0x2d')];_0x1e9f32[_0x400b('0x53')]=qs[_0x400b('0x37')](_0x24dc03[_0x400b('0x2e')][_0x400b('0x37')]);_0x1e9f32['where']=qs[_0x400b('0x30')](_['pick'](_0x24dc03[_0x400b('0x2e')],_0x4d85d9[_0x400b('0x30')]));if(_0x24dc03[_0x400b('0x2e')]['filter']){_0x1e9f32[_0x400b('0x38')]=_[_0x400b('0x39')](_0x1e9f32[_0x400b('0x38')],{'$or':_['map'](_0x1e9f32['attributes'],function(_0x2a8519){var _0x3fc5b0={};_0x3fc5b0[_0x2a8519]={'$like':'%'+_0x24dc03[_0x400b('0x2e')][_0x400b('0x3b')]+'%'};return _0x3fc5b0;})});}_0x1e9f32=_['merge']({},_0x1e9f32,_0x24dc03['options']);return _0x23ad18[_0x400b('0x58')](_0x1e9f32);}})['then'](function(_0x539b4c){if(_0x539b4c){_0x90942d=_0x539b4c[_0x400b('0x34')];if(!_0x24dc03['query']['hasOwnProperty'](_0x400b('0x35'))){_0x1e9f32[_0x400b('0x36')]=qs[_0x400b('0x36')](_0x24dc03[_0x400b('0x2e')][_0x400b('0x36')]);_0x1e9f32[_0x400b('0x1a')]=qs[_0x400b('0x1a')](_0x24dc03[_0x400b('0x2e')][_0x400b('0x1a')]);}return _0x23ad18[_0x400b('0x58')](_0x1e9f32);}})[_0x400b('0x1d')](function(_0x229d87){if(_0x229d87){return _0x229d87?{'count':_0x90942d,'rows':_0x229d87}:null;}})[_0x400b('0x1d')](respondWithResult(_0x2fa31f,null))[_0x400b('0x3f')](handleError(_0x2fa31f,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index fbf2dc4..ffa1023 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 _0x04f1=['Trigger','tools_triggers','lodash','util','../../config/logger','bluebird','request-promise','path','define'];(function(_0x202a06,_0x3a346b){var _0x578aaf=function(_0x30532b){while(--_0x30532b){_0x202a06['push'](_0x202a06['shift']());}};_0x578aaf(++_0x3a346b);}(_0x04f1,0x92));var _0x104f=function(_0x4fd154,_0x4cd69c){_0x4fd154=_0x4fd154-0x0;var _0x1adcad=_0x04f1[_0x4fd154];return _0x1adcad;};'use strict';var _=require(_0x104f('0x0'));var util=require(_0x104f('0x1'));var logger=require(_0x104f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x104f('0x3'));var rp=require(_0x104f('0x4'));var fs=require('fs');var path=require(_0x104f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./trigger.attributes');module['exports']=function(_0x4e767b,_0x20a746){return _0x4e767b[_0x104f('0x6')](_0x104f('0x7'),attributes,{'tableName':_0x104f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd3b=['request-promise','path','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2ba9a1,_0xe6ba79){var _0x41ed28=function(_0x3aec30){while(--_0x3aec30){_0x2ba9a1['push'](_0x2ba9a1['shift']());}};_0x41ed28(++_0xe6ba79);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x2c9e29,_0x1f9351){_0x2c9e29=_0x2c9e29-0x0;var _0x272a84=_0xbd3b[_0x2c9e29];return _0x272a84;};'use strict';var _=require(_0xbbd3('0x0'));var util=require(_0xbbd3('0x1'));var logger=require(_0xbbd3('0x2'))('api');var moment=require(_0xbbd3('0x3'));var BPromise=require(_0xbbd3('0x4'));var rp=require(_0xbbd3('0x5'));var fs=require('fs');var path=require(_0xbbd3('0x6'));var rimraf=require('rimraf');var config=require(_0xbbd3('0x7'));var attributes=require(_0xbbd3('0x8'));module['exports']=function(_0x2e1bcb,_0x494774){return _0x2e1bcb[_0xbbd3('0x9')](_0xbbd3('0xa'),attributes,{'tableName':_0xbbd3('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 2f90ae5..a09f5d3 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 _0x49e5=['attributes','include','map','then','GetTrigger','ShowTrigger','find','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Trigger','findAll','options','raw','where'];(function(_0x51e3db,_0x483e38){var _0x3f3a11=function(_0x1109e2){while(--_0x1109e2){_0x51e3db['push'](_0x51e3db['shift']());}};_0x3f3a11(++_0x483e38);}(_0x49e5,0x71));var _0x549e=function(_0x261cf2,_0x2cdd20){_0x261cf2=_0x261cf2-0x0;var _0x25bfdd=_0x49e5[_0x261cf2];return _0x25bfdd;};'use strict';var _=require(_0x549e('0x0'));var util=require(_0x549e('0x1'));var moment=require(_0x549e('0x2'));var BPromise=require(_0x549e('0x3'));var rs=require(_0x549e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x549e('0x5'))['db'];var utils=require(_0x549e('0x6'));var logger=require(_0x549e('0x7'))(_0x549e('0x8'));var config=require(_0x549e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x549e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5677b2,_0x44b1e3,_0x2d83f2){return new BPromise(function(_0x158392,_0x5e3c38){return client['request'](_0x5677b2,_0x2d83f2)['then'](function(_0x230ae5){logger[_0x549e('0xb')](_0x549e('0xc'),_0x44b1e3,_0x549e('0xd'));logger[_0x549e('0xe')](_0x549e('0xf'),_0x44b1e3,'request\x20sent',JSON[_0x549e('0x10')](_0x230ae5));if(_0x230ae5['error']){if(_0x230ae5[_0x549e('0x11')][_0x549e('0x12')]===0x1f4){logger[_0x549e('0x11')]('Trigger,\x20%s,\x20%s',_0x44b1e3,_0x230ae5[_0x549e('0x11')][_0x549e('0x13')]);return _0x5e3c38(_0x230ae5[_0x549e('0x11')]['message']);}logger[_0x549e('0x11')](_0x549e('0xc'),_0x44b1e3,_0x230ae5[_0x549e('0x11')][_0x549e('0x13')]);return _0x158392(_0x230ae5[_0x549e('0x11')][_0x549e('0x13')]);}else{logger[_0x549e('0xb')](_0x549e('0xc'),_0x44b1e3,_0x549e('0xd'));_0x158392(_0x230ae5[_0x549e('0x14')][_0x549e('0x13')]);}})[_0x549e('0x15')](function(_0x402c51){logger[_0x549e('0x11')](_0x549e('0xc'),_0x44b1e3,_0x402c51);_0x5e3c38(_0x402c51);});});}exports['GetTrigger']=function(_0x294cb3){var _0x233a69=this;return new Promise(function(_0x48f639,_0x7da4f2){return db[_0x549e('0x16')][_0x549e('0x17')]({'raw':_0x294cb3[_0x549e('0x18')]?_0x294cb3[_0x549e('0x18')][_0x549e('0x19')]===undefined?!![]:![]:!![],'where':_0x294cb3[_0x549e('0x18')]?_0x294cb3[_0x549e('0x18')][_0x549e('0x1a')]||null:null,'attributes':_0x294cb3[_0x549e('0x18')]?_0x294cb3[_0x549e('0x18')][_0x549e('0x1b')]||null:null,'limit':_0x294cb3[_0x549e('0x18')]?_0x294cb3['options']['limit']||null:null,'include':_0x294cb3['options']?_0x294cb3[_0x549e('0x18')][_0x549e('0x1c')]?_[_0x549e('0x1d')](_0x294cb3['options']['include'],function(_0x1a7f15){return{'model':db[_0x1a7f15['model']],'as':_0x1a7f15['as'],'attributes':_0x1a7f15[_0x549e('0x1b')],'include':_0x1a7f15[_0x549e('0x1c')]?_[_0x549e('0x1d')](_0x1a7f15[_0x549e('0x1c')],function(_0xabf2dc){return{'model':db[_0xabf2dc['model']],'as':_0xabf2dc['as'],'attributes':_0xabf2dc['attributes'],'include':_0xabf2dc[_0x549e('0x1c')]?_[_0x549e('0x1d')](_0xabf2dc[_0x549e('0x1c')],function(_0x425f53){return{'model':db[_0x425f53['model']],'as':_0x425f53['as'],'attributes':_0x425f53['attributes']};}):[]};}):[]};}):[]:[]})[_0x549e('0x1e')](function(_0x337123){logger[_0x549e('0xb')](_0x549e('0x1f'),_0x294cb3);logger[_0x549e('0xe')]('GetTrigger',_0x294cb3,JSON[_0x549e('0x10')](_0x337123));_0x48f639(_0x337123);})[_0x549e('0x15')](function(_0x3abda5){logger['error']('GetTrigger',_0x3abda5[_0x549e('0x13')],_0x294cb3);_0x7da4f2(_0x233a69[_0x549e('0x11')](0x1f4,_0x3abda5[_0x549e('0x13')]));});});};exports[_0x549e('0x20')]=function(_0x467e2d){var _0x13b293=this;return new Promise(function(_0x40785c,_0x2d1d41){return db[_0x549e('0x16')][_0x549e('0x21')]({'raw':_0x467e2d['options']?_0x467e2d[_0x549e('0x18')][_0x549e('0x19')]===undefined?!![]:![]:!![],'where':_0x467e2d[_0x549e('0x18')]?_0x467e2d[_0x549e('0x18')][_0x549e('0x1a')]||null:null,'attributes':_0x467e2d[_0x549e('0x18')]?_0x467e2d['options'][_0x549e('0x1b')]||null:null,'include':_0x467e2d['options']?_0x467e2d['options'][_0x549e('0x1c')]?_[_0x549e('0x1d')](_0x467e2d[_0x549e('0x18')]['include'],function(_0x2b2ee1){return{'model':db[_0x2b2ee1[_0x549e('0x22')]],'as':_0x2b2ee1['as'],'attributes':_0x2b2ee1[_0x549e('0x1b')],'include':_0x2b2ee1[_0x549e('0x1c')]?_[_0x549e('0x1d')](_0x2b2ee1['include'],function(_0x18740d){return{'model':db[_0x18740d[_0x549e('0x22')]],'as':_0x18740d['as'],'attributes':_0x18740d[_0x549e('0x1b')],'include':_0x18740d[_0x549e('0x1c')]?_['map'](_0x18740d[_0x549e('0x1c')],function(_0x141391){return{'model':db[_0x141391['model']],'as':_0x141391['as'],'attributes':_0x141391[_0x549e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x549e('0x1e')](function(_0x2e0a0b){logger[_0x549e('0xb')](_0x549e('0x20'),_0x467e2d);logger[_0x549e('0xe')](_0x549e('0x20'),_0x467e2d,JSON[_0x549e('0x10')](_0x2e0a0b));_0x40785c(_0x2e0a0b);})['catch'](function(_0x3aa382){logger[_0x549e('0x11')](_0x549e('0x20'),_0x3aa382['message'],_0x467e2d);_0x2d1d41(_0x13b293[_0x549e('0x11')](0x1f4,_0x3aa382[_0x549e('0x13')]));});});}; \ No newline at end of file +var _0x59fc=['then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trigger','options','raw','where','attributes','limit','map','model','include','GetTrigger','find','ShowTrigger','catch','lodash','util','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x59fc,0x10f));var _0xc59f=function(_0x596544,_0x3776a5){_0x596544=_0x596544-0x0;var _0x57e458=_0x59fc[_0x596544];return _0x57e458;};'use strict';var _=require(_0xc59f('0x0'));var util=require(_0xc59f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc59f('0x2'))['db'];var utils=require(_0xc59f('0x3'));var logger=require('../../config/logger')(_0xc59f('0x4'));var config=require(_0xc59f('0x5'));var jayson=require(_0xc59f('0x6'));var client=jayson['client'][_0xc59f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1e2768,_0x5d69d6,_0x4cd770){return new BPromise(function(_0x5c3940,_0x19d9b0){return client['request'](_0x1e2768,_0x4cd770)[_0xc59f('0x8')](function(_0x183e54){logger[_0xc59f('0x9')](_0xc59f('0xa'),_0x5d69d6,_0xc59f('0xb'));logger[_0xc59f('0xc')](_0xc59f('0xd'),_0x5d69d6,_0xc59f('0xb'),JSON[_0xc59f('0xe')](_0x183e54));if(_0x183e54[_0xc59f('0xf')]){if(_0x183e54[_0xc59f('0xf')][_0xc59f('0x10')]===0x1f4){logger[_0xc59f('0xf')](_0xc59f('0xa'),_0x5d69d6,_0x183e54[_0xc59f('0xf')][_0xc59f('0x11')]);return _0x19d9b0(_0x183e54[_0xc59f('0xf')]['message']);}logger[_0xc59f('0xf')](_0xc59f('0xa'),_0x5d69d6,_0x183e54[_0xc59f('0xf')][_0xc59f('0x11')]);return _0x5c3940(_0x183e54['error']['message']);}else{logger[_0xc59f('0x9')](_0xc59f('0xa'),_0x5d69d6,_0xc59f('0xb'));_0x5c3940(_0x183e54['result']['message']);}})['catch'](function(_0x5ce5fe){logger[_0xc59f('0xf')](_0xc59f('0xa'),_0x5d69d6,_0x5ce5fe);_0x19d9b0(_0x5ce5fe);});});}exports['GetTrigger']=function(_0xc48c2){var _0x421361=this;return new Promise(function(_0x5a4e31,_0x492689){return db[_0xc59f('0x12')]['findAll']({'raw':_0xc48c2[_0xc59f('0x13')]?_0xc48c2['options'][_0xc59f('0x14')]===undefined?!![]:![]:!![],'where':_0xc48c2[_0xc59f('0x13')]?_0xc48c2[_0xc59f('0x13')][_0xc59f('0x15')]||null:null,'attributes':_0xc48c2[_0xc59f('0x13')]?_0xc48c2[_0xc59f('0x13')][_0xc59f('0x16')]||null:null,'limit':_0xc48c2[_0xc59f('0x13')]?_0xc48c2[_0xc59f('0x13')][_0xc59f('0x17')]||null:null,'include':_0xc48c2[_0xc59f('0x13')]?_0xc48c2[_0xc59f('0x13')]['include']?_[_0xc59f('0x18')](_0xc48c2[_0xc59f('0x13')]['include'],function(_0x1629a0){return{'model':db[_0x1629a0[_0xc59f('0x19')]],'as':_0x1629a0['as'],'attributes':_0x1629a0[_0xc59f('0x16')],'include':_0x1629a0[_0xc59f('0x1a')]?_[_0xc59f('0x18')](_0x1629a0[_0xc59f('0x1a')],function(_0x390c97){return{'model':db[_0x390c97['model']],'as':_0x390c97['as'],'attributes':_0x390c97['attributes'],'include':_0x390c97[_0xc59f('0x1a')]?_[_0xc59f('0x18')](_0x390c97[_0xc59f('0x1a')],function(_0x5d9268){return{'model':db[_0x5d9268[_0xc59f('0x19')]],'as':_0x5d9268['as'],'attributes':_0x5d9268[_0xc59f('0x16')]};}):[]};}):[]};}):[]:[]})[_0xc59f('0x8')](function(_0x47a48b){logger['info'](_0xc59f('0x1b'),_0xc48c2);logger[_0xc59f('0xc')](_0xc59f('0x1b'),_0xc48c2,JSON[_0xc59f('0xe')](_0x47a48b));_0x5a4e31(_0x47a48b);})['catch'](function(_0x2bde38){logger['error'](_0xc59f('0x1b'),_0x2bde38[_0xc59f('0x11')],_0xc48c2);_0x492689(_0x421361[_0xc59f('0xf')](0x1f4,_0x2bde38['message']));});});};exports['ShowTrigger']=function(_0x7d74f4){var _0x12609d=this;return new Promise(function(_0x26a423,_0x56099d){return db[_0xc59f('0x12')][_0xc59f('0x1c')]({'raw':_0x7d74f4[_0xc59f('0x13')]?_0x7d74f4[_0xc59f('0x13')][_0xc59f('0x14')]===undefined?!![]:![]:!![],'where':_0x7d74f4['options']?_0x7d74f4['options'][_0xc59f('0x15')]||null:null,'attributes':_0x7d74f4[_0xc59f('0x13')]?_0x7d74f4['options'][_0xc59f('0x16')]||null:null,'include':_0x7d74f4['options']?_0x7d74f4[_0xc59f('0x13')][_0xc59f('0x1a')]?_[_0xc59f('0x18')](_0x7d74f4[_0xc59f('0x13')][_0xc59f('0x1a')],function(_0x18e13f){return{'model':db[_0x18e13f[_0xc59f('0x19')]],'as':_0x18e13f['as'],'attributes':_0x18e13f[_0xc59f('0x16')],'include':_0x18e13f[_0xc59f('0x1a')]?_[_0xc59f('0x18')](_0x18e13f[_0xc59f('0x1a')],function(_0x585b38){return{'model':db[_0x585b38[_0xc59f('0x19')]],'as':_0x585b38['as'],'attributes':_0x585b38[_0xc59f('0x16')],'include':_0x585b38['include']?_[_0xc59f('0x18')](_0x585b38[_0xc59f('0x1a')],function(_0x22a7cd){return{'model':db[_0x22a7cd[_0xc59f('0x19')]],'as':_0x22a7cd['as'],'attributes':_0x22a7cd['attributes']};}):[]};}):[]};}):[]:[]})[_0xc59f('0x8')](function(_0x2a7163){logger[_0xc59f('0x9')](_0xc59f('0x1d'),_0x7d74f4);logger[_0xc59f('0xc')](_0xc59f('0x1d'),_0x7d74f4,JSON['stringify'](_0x2a7163));_0x26a423(_0x2a7163);})[_0xc59f('0x1e')](function(_0x3d6a94){logger[_0xc59f('0xf')](_0xc59f('0x1d'),_0x3d6a94[_0xc59f('0x11')],_0x7d74f4);_0x56099d(_0x12609d['error'](0x1f4,_0x3d6a94[_0xc59f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 4d156ec..806e645 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 _0x1bd8=['update','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','/:id','show','clone','post','put'];(function(_0x2942ab,_0x3be3ee){var _0x1b6576=function(_0x73f63b){while(--_0x73f63b){_0x2942ab['push'](_0x2942ab['shift']());}};_0x1b6576(++_0x3be3ee);}(_0x1bd8,0x191));var _0x81bd=function(_0x44e49b,_0x5d5ecf){_0x44e49b=_0x44e49b-0x0;var _0x192631=_0x1bd8[_0x44e49b];return _0x192631;};'use strict';var multer=require(_0x81bd('0x0'));var util=require('util');var path=require(_0x81bd('0x1'));var timeout=require(_0x81bd('0x2'));var express=require('express');var router=express[_0x81bd('0x3')]();var fs_extra=require(_0x81bd('0x4'));var auth=require(_0x81bd('0x5'));var interaction=require(_0x81bd('0x6'));var config=require(_0x81bd('0x7'));var controller=require(_0x81bd('0x8'));router['get']('/',auth[_0x81bd('0x9')](),controller[_0x81bd('0xa')]);router[_0x81bd('0xb')](_0x81bd('0xc'),auth[_0x81bd('0x9')](),controller[_0x81bd('0xd')]);router['post']('/:id/clone',auth[_0x81bd('0x9')](),controller[_0x81bd('0xe')]);router[_0x81bd('0xf')]('/',auth[_0x81bd('0x9')](),controller['create']);router[_0x81bd('0x10')]('/:id',auth[_0x81bd('0x9')](),controller[_0x81bd('0x11')]);router['delete'](_0x81bd('0xc'),auth[_0x81bd('0x9')](),controller[_0x81bd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1665=['update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','clone','post'];(function(_0x5371d0,_0x232486){var _0x1e47a5=function(_0x30b9a0){while(--_0x30b9a0){_0x5371d0['push'](_0x5371d0['shift']());}};_0x1e47a5(++_0x232486);}(_0x1665,0x1a6));var _0x5166=function(_0x4bc413,_0x4a5161){_0x4bc413=_0x4bc413-0x0;var _0x13910d=_0x1665[_0x4bc413];return _0x13910d;};'use strict';var multer=require(_0x5166('0x0'));var util=require('util');var path=require(_0x5166('0x1'));var timeout=require(_0x5166('0x2'));var express=require('express');var router=express[_0x5166('0x3')]();var fs_extra=require(_0x5166('0x4'));var auth=require(_0x5166('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5166('0x6'));router[_0x5166('0x7')]('/',auth[_0x5166('0x8')](),controller[_0x5166('0x9')]);router[_0x5166('0x7')](_0x5166('0xa'),auth[_0x5166('0x8')](),controller[_0x5166('0xb')]);router['post'](_0x5166('0xc'),auth['isAuthenticated'](),controller[_0x5166('0xd')]);router[_0x5166('0xe')]('/',auth[_0x5166('0x8')](),controller['create']);router['put'](_0x5166('0xa'),auth[_0x5166('0x8')](),controller[_0x5166('0xf')]);router[_0x5166('0x10')](_0x5166('0xa'),auth[_0x5166('0x8')](),controller[_0x5166('0x11')]);module[_0x5166('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index aeb4742..59ea325 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 _0x5559=['\x22\x22\x20<>','always','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','update','update,nonat','BOOLEAN','sequelize','exports','STRING','user','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','getDataValue','transport','ENUM','rfc2833','info','shortinfo','inband','auto','yes','nonat','force_rport,comedia','nat','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER'];(function(_0x457808,_0x4c22fc){var _0x122088=function(_0x587176){while(--_0x587176){_0x457808['push'](_0x457808['shift']());}};_0x122088(++_0x4c22fc);}(_0x5559,0x19f));var _0x9555=function(_0x50c2dd,_0x4d7751){_0x50c2dd=_0x50c2dd-0x0;var _0x57671=_0x5559[_0x50c2dd];return _0x57671;};'use strict';var Sequelize=require(_0x9555('0x0'));module[_0x9555('0x1')]={'name':{'type':Sequelize[_0x9555('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0x9555('0x3'),'peer'),'allowNull':![],'defaultValue':_0x9555('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9555('0x5')},'callingpres':{'type':Sequelize['ENUM'](_0x9555('0x6'),_0x9555('0x7'),_0x9555('0x8'),_0x9555('0x9'),'PROHIB_NOT_SCREENED',_0x9555('0xa'),_0x9555('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0x9555('0x2')]},'permit':{'type':Sequelize[_0x9555('0x2')]},'secret':{'type':Sequelize[_0x9555('0x2')]},'md5secret':{'type':Sequelize[_0x9555('0x2')]},'remotesecret':{'type':Sequelize[_0x9555('0x2')]},'transport':{'type':Sequelize[_0x9555('0x2')],'defaultValue':_0x9555('0xc'),'set':function(_0x56c34e){this['setDataValue']('transport',_0x56c34e?_0x56c34e['join'](','):null);},'get':function(){return this[_0x9555('0xd')](_0x9555('0xe'))?this[_0x9555('0xd')](_0x9555('0xe'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x9555('0xf')](_0x9555('0x10'),_0x9555('0x11'),_0x9555('0x12'),_0x9555('0x13'),_0x9555('0x14')),'defaultValue':_0x9555('0x10')},'directmedia':{'type':Sequelize[_0x9555('0xf')](_0x9555('0x15'),'no',_0x9555('0x16'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9555('0xf')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9555('0x2')]},'directmediadeny':{'type':Sequelize[_0x9555('0x2')]},'nat':{'type':Sequelize[_0x9555('0x2')],'defaultValue':_0x9555('0x17'),'set':function(_0xcd6d3e){this['setDataValue'](_0x9555('0x18'),_0xcd6d3e?_0xcd6d3e[_0x9555('0x19')](','):null);},'get':function(){return this[_0x9555('0xd')](_0x9555('0x18'))?this[_0x9555('0xd')](_0x9555('0x18'))[_0x9555('0x1a')](','):null;},'comment':_0x9555('0x1b')},'callgroup':{'type':Sequelize[_0x9555('0x2')]},'namedcallgroup':{'type':Sequelize[_0x9555('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x9555('0x2')]},'language':{'type':Sequelize[_0x9555('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9555('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x9555('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x9555('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x5abf20){this['setDataValue'](_0x9555('0x1c'),_0x5abf20?_0x5abf20[_0x9555('0x19')](';'):_0x9555('0x1d'));},'get':function(){return this['getDataValue'](_0x9555('0x1c'))?this[_0x9555('0xd')](_0x9555('0x1c'))[_0x9555('0x1a')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x9555('0xf')](_0x9555('0x15'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x9555('0x1e'),'set':function(_0x299da0){this['setDataValue'](_0x9555('0x1f'),_0x299da0?_0x299da0[_0x9555('0x19')](','):null);},'get':function(){return this[_0x9555('0xd')](_0x9555('0x1f'))?this[_0x9555('0xd')]('insecure')['split'](','):null;},'comment':_0x9555('0x20')},'trustrpid':{'type':Sequelize[_0x9555('0xf')](_0x9555('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9555('0xf')](_0x9555('0x15'),'no',_0x9555('0x21'))},'promiscredir':{'type':Sequelize['ENUM'](_0x9555('0x15'),'no')},'useclientcode':{'type':Sequelize[_0x9555('0xf')]('yes','no')},'accountcode':{'type':Sequelize[_0x9555('0x22')](0xb)},'setvar':{'type':Sequelize[_0x9555('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x9555('0x23')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x9555('0xf')](_0x9555('0x15'),'no'),'defaultValue':_0x9555('0x15')},'busylevel':{'type':Sequelize[_0x9555('0x22')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x9555('0x15'),'no')},'allowsubscribe':{'type':Sequelize[_0x9555('0xf')](_0x9555('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x9555('0xf')](_0x9555('0x15'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x9555('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0x9555('0x2')]},'template':{'type':Sequelize[_0x9555('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0x9555('0x15'),'no',_0x9555('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9555('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x9555('0xf')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x9555('0xf')]('accept',_0x9555('0x25'),_0x9555('0x26'))},'session_expires':{'type':Sequelize[_0x9555('0x22')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x9555('0xf')](_0x9555('0x27'),_0x9555('0x28')),'defaultValue':_0x9555('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x9555('0x2')]},'regexten':{'type':Sequelize[_0x9555('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x9555('0x22')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x9555('0x15'),'no'),'defaultValue':_0x9555('0x15')},'keepalive':{'type':Sequelize[_0x9555('0x22')](0xb)},'defaultip':{'type':Sequelize[_0x9555('0x2')]},'defaultuser':{'type':Sequelize[_0x9555('0x2')]},'rtptimeout':{'type':Sequelize[_0x9555('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x9555('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x9555('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0x9555('0xf')](_0x9555('0x15'),'no',_0x9555('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9555('0x2')]},'callbackextension':{'type':Sequelize[_0x9555('0x2')]},'timert1':{'type':Sequelize[_0x9555('0x22')](0xb)},'timerb':{'type':Sequelize[_0x9555('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0x9555('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0x9555('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x9555('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x9555('0xf')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9555('0xf')](_0x9555('0x15'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x9555('0x15'),'no')},'icesupport':{'type':Sequelize[_0x9555('0xf')](_0x9555('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0x9555('0xf')](_0x9555('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0x9555('0xf')](_0x9555('0x15'),'no',_0x9555('0x2a'),_0x9555('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x9555('0x22')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x9555('0x2')]},'dtlscafile':{'type':Sequelize[_0x9555('0x2')]},'dtlscapath':{'type':Sequelize[_0x9555('0x2')]},'dtlssetup':{'type':Sequelize[_0x9555('0xf')](_0x9555('0x2c'),_0x9555('0x2d'),_0x9555('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x9555('0xf')](_0x9555('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9555('0x2')]},'recordofffeature':{'type':Sequelize[_0x9555('0x2')]},'call_limit':{'type':Sequelize[_0x9555('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x9555('0xf')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x9555('0x15'),'no')},'vmexten':{'type':Sequelize[_0x9555('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x9555('0x2')]},'parkinglot':{'type':Sequelize[_0x9555('0x2')]},'description':{'type':Sequelize[_0x9555('0x2')]},'host':{'type':Sequelize[_0x9555('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x9555('0xf')](_0x9555('0x15'),'no',_0x9555('0x16'),_0x9555('0x2f'),_0x9555('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x9555('0x2')]},'otherFields':{'type':Sequelize[_0x9555('0x2')]},'active':{'type':Sequelize[_0x9555('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x9555('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x3fb5=['outgoing','nat','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','originate','uac','uas','pai','active','actpass','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','inband','auto','rfc2833','yes','nonat','update'];(function(_0x4cfe6d,_0x566303){var _0xd62f2b=function(_0x12f270){while(--_0x12f270){_0x4cfe6d['push'](_0x4cfe6d['shift']());}};_0xd62f2b(++_0x566303);}(_0x3fb5,0x107));var _0x53fb=function(_0x5aefab,_0x3685c8){_0x5aefab=_0x5aefab-0x0;var _0x139aba=_0x3fb5[_0x5aefab];return _0x139aba;};'use strict';var Sequelize=require(_0x53fb('0x0'));module[_0x53fb('0x1')]={'name':{'type':Sequelize[_0x53fb('0x2')],'allowNull':![],'unique':_0x53fb('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x53fb('0x4')](_0x53fb('0x5'),'user',_0x53fb('0x6')),'allowNull':![],'defaultValue':_0x53fb('0x5')},'context':{'type':Sequelize[_0x53fb('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0x53fb('0x7'),_0x53fb('0x8'),_0x53fb('0x9'),'ALLOWED',_0x53fb('0xa'),_0x53fb('0xb'),_0x53fb('0xc'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x53fb('0x2')]},'secret':{'type':Sequelize[_0x53fb('0x2')]},'md5secret':{'type':Sequelize[_0x53fb('0x2')]},'remotesecret':{'type':Sequelize[_0x53fb('0x2')]},'transport':{'type':Sequelize[_0x53fb('0x2')],'defaultValue':_0x53fb('0xd'),'set':function(_0x52c701){this[_0x53fb('0xe')](_0x53fb('0xf'),_0x52c701?_0x52c701['join'](','):null);},'get':function(){return this['getDataValue'](_0x53fb('0xf'))?this[_0x53fb('0x10')]('transport')['split'](','):null;},'comment':_0x53fb('0x11')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x53fb('0x12'),'shortinfo',_0x53fb('0x13'),_0x53fb('0x14')),'defaultValue':_0x53fb('0x15')},'directmedia':{'type':Sequelize[_0x53fb('0x4')](_0x53fb('0x16'),'no',_0x53fb('0x17'),_0x53fb('0x18'),_0x53fb('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x53fb('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x53fb('0x2')]},'directmediadeny':{'type':Sequelize[_0x53fb('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x20f928){this['setDataValue'](_0x53fb('0x1a'),_0x20f928?_0x20f928[_0x53fb('0x1b')](','):null);},'get':function(){return this[_0x53fb('0x10')](_0x53fb('0x1a'))?this[_0x53fb('0x10')]('nat')[_0x53fb('0x1c')](','):null;},'comment':_0x53fb('0x1d')},'callgroup':{'type':Sequelize[_0x53fb('0x2')]},'namedcallgroup':{'type':Sequelize[_0x53fb('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x53fb('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x53fb('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x53fb('0x2')],'allowNull':![],'defaultValue':_0x53fb('0x1e'),'set':function(_0x24af24){this['setDataValue']('allow',_0x24af24?_0x24af24[_0x53fb('0x1b')](';'):_0x53fb('0x1e'));},'get':function(){return this['getDataValue']('allow')?this[_0x53fb('0x10')]('allow')[_0x53fb('0x1c')](';'):null;},'comment':_0x53fb('0x1f')},'autoframing':{'type':Sequelize['ENUM'](_0x53fb('0x16'),'no')},'insecure':{'type':Sequelize[_0x53fb('0x2')],'defaultValue':_0x53fb('0x20'),'set':function(_0x47ad4f){this[_0x53fb('0xe')]('insecure',_0x47ad4f?_0x47ad4f['join'](','):null);},'get':function(){return this[_0x53fb('0x10')](_0x53fb('0x21'))?this[_0x53fb('0x10')](_0x53fb('0x21'))[_0x53fb('0x1c')](','):null;},'comment':_0x53fb('0x22')},'trustrpid':{'type':Sequelize[_0x53fb('0x4')](_0x53fb('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x53fb('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x53fb('0x4')]('yes','no',_0x53fb('0x23'))},'promiscredir':{'type':Sequelize['ENUM'](_0x53fb('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x53fb('0x4')](_0x53fb('0x16'),'no')},'accountcode':{'type':Sequelize[_0x53fb('0x24')](0xb)},'setvar':{'type':Sequelize[_0x53fb('0x2')]},'callerid':{'type':Sequelize[_0x53fb('0x2')],'defaultValue':_0x53fb('0x25')},'amaflags':{'type':Sequelize[_0x53fb('0x2')]},'callcounter':{'type':Sequelize[_0x53fb('0x4')](_0x53fb('0x16'),'no'),'defaultValue':_0x53fb('0x16')},'busylevel':{'type':Sequelize[_0x53fb('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x53fb('0x4')](_0x53fb('0x16'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x53fb('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x53fb('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x53fb('0x4')](_0x53fb('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x53fb('0x2')]},'template':{'type':Sequelize[_0x53fb('0x2')]},'videosupport':{'type':Sequelize[_0x53fb('0x4')](_0x53fb('0x16'),'no',_0x53fb('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x53fb('0x4')]('yes','no')},'mailbox':{'type':Sequelize[_0x53fb('0x2')]},'session_timers':{'type':Sequelize[_0x53fb('0x4')](_0x53fb('0x27'),'refuse',_0x53fb('0x28'))},'session_expires':{'type':Sequelize[_0x53fb('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x53fb('0x24')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x53fb('0x29'),'uas'),'defaultValue':_0x53fb('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x53fb('0x2')]},'regexten':{'type':Sequelize[_0x53fb('0x2')]},'fromdomain':{'type':Sequelize[_0x53fb('0x2')]},'fromuser':{'type':Sequelize[_0x53fb('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x53fb('0x4')](_0x53fb('0x16'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x53fb('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x53fb('0x2')]},'defaultuser':{'type':Sequelize[_0x53fb('0x2')]},'rtptimeout':{'type':Sequelize[_0x53fb('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x53fb('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x53fb('0x4')](_0x53fb('0x16'),'no',_0x53fb('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x53fb('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x53fb('0x24')](0xb)},'timerb':{'type':Sequelize[_0x53fb('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x53fb('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x53fb('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x53fb('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x53fb('0x2')]},'use_q850_reason':{'type':Sequelize[_0x53fb('0x2')]},'maxforwards':{'type':Sequelize[_0x53fb('0x24')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x53fb('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x53fb('0x4')](_0x53fb('0x16'),'no')},'force_avp':{'type':Sequelize[_0x53fb('0x4')](_0x53fb('0x16'),'no')},'icesupport':{'type':Sequelize[_0x53fb('0x4')](_0x53fb('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x53fb('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x53fb('0x16'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0x53fb('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x53fb('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x53fb('0x2')]},'dtlscipher':{'type':Sequelize[_0x53fb('0x2')]},'dtlscafile':{'type':Sequelize[_0x53fb('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x53fb('0x4')](_0x53fb('0x2c'),'passive',_0x53fb('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x53fb('0x2')]},'usereqphone':{'type':Sequelize[_0x53fb('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x53fb('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x53fb('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x53fb('0x4')](_0x53fb('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x53fb('0x4')](_0x53fb('0x16'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x53fb('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x53fb('0x2')]},'host':{'type':Sequelize[_0x53fb('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x53fb('0x4')](_0x53fb('0x16'),'no',_0x53fb('0x17'),_0x53fb('0x18'),_0x53fb('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x53fb('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x53fb('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index e276bab..1e62085 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 _0x008c=['update','destroy','get','Trunks','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','Trunk','findAll','show','params','includeAll','include','options','clone','find','omit','createdAt','updatedAt','body','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','utf8','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','Reload','chan_sip.so','server/files/templates/trunk.ejs','join','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save'];(function(_0x1f20d6,_0x1b4431){var _0x2a7f7f=function(_0x3d4642){while(--_0x3d4642){_0x1f20d6['push'](_0x1f20d6['shift']());}};_0x2a7f7f(++_0x1b4431);}(_0x008c,0x188));var _0xc008=function(_0x3d6eb1,_0x1f99b1){_0x3d6eb1=_0x3d6eb1-0x0;var _0x4e5356=_0x008c[_0x3d6eb1];return _0x4e5356;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];var jayson=require(_0xc008('0x18'));var client=jayson[_0xc008('0x19')][_0xc008('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x593f7a,_0x560e28,_0x33f44c,_0x50c1ab){return new BPromise(function(_0x25e13f,_0x4584e1){var _0x2073ef=_0x50c1ab||client;return _0x2073ef[_0xc008('0x1b')](_0x593f7a,_0x33f44c)[_0xc008('0x1c')](function(_0x5ee00b){logger['info']('Trunk,\x20%s,\x20%s',_0x560e28,_0xc008('0x1d'));logger[_0xc008('0x1e')](_0xc008('0x1f'),_0x560e28,_0xc008('0x1d'),JSON['stringify'](_0x5ee00b));if(_0x5ee00b['error']){if(_0x5ee00b['error']['code']===0x1f4){logger[_0xc008('0x20')](_0xc008('0x21'),_0x560e28,_0x5ee00b['error'][_0xc008('0x22')]);return _0x4584e1(_0x5ee00b['error']['message']);}logger['error']('Trunk,\x20%s,\x20%s',_0x560e28,_0x5ee00b[_0xc008('0x20')]['message']);return _0x25e13f(_0x5ee00b['error']['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x560e28,_0xc008('0x1d'));_0x25e13f(_0x5ee00b[_0xc008('0x23')][_0xc008('0x22')]);}})[_0xc008('0x24')](function(_0x11cc75){logger[_0xc008('0x20')]('Trunk,\x20%s,\x20%s',_0x560e28,_0x11cc75);_0x4584e1(_0x11cc75);});});}function respondWithStatusCode(_0x459fd9,_0x5c85f2){_0x5c85f2=_0x5c85f2||0xcc;return function(_0x58a6ea){if(_0x58a6ea){return _0x459fd9[_0xc008('0x25')](_0x5c85f2);}return _0x459fd9[_0xc008('0x26')](_0x5c85f2)[_0xc008('0x27')]();};}function respondWithResult(_0x3cb28c,_0x5410f5){_0x5410f5=_0x5410f5||0xc8;return function(_0x48582b){if(_0x48582b){return _0x3cb28c['status'](_0x5410f5)[_0xc008('0x28')](_0x48582b);}};}function respondWithFilteredResult(_0x15dade,_0x92c582){return function(_0x2e31c2){if(_0x2e31c2){var _0x5bebd9=typeof _0x92c582['offset']==='undefined'&&typeof _0x92c582['limit']==='undefined';var _0x3865c0=_0x2e31c2[_0xc008('0x29')];var _0x25eae4=_0x5bebd9?0x0:_0x92c582['offset'];var _0x24c14c=_0x5bebd9?_0x2e31c2[_0xc008('0x29')]:_0x92c582[_0xc008('0x2a')]+_0x92c582[_0xc008('0x2b')];var _0x4c5dec;if(_0x24c14c>=_0x3865c0){_0x24c14c=_0x3865c0;_0x4c5dec=0xc8;}else{_0x4c5dec=0xce;}_0x15dade[_0xc008('0x26')](_0x4c5dec);return _0x15dade[_0xc008('0x2c')]('Content-Range',_0x25eae4+'-'+_0x24c14c+'/'+_0x3865c0)['json'](_0x2e31c2);}return null;};}function patchUpdates(_0x539766){return function(_0x1032b2){try{jsonpatch[_0xc008('0x2d')](_0x1032b2,_0x539766,!![]);}catch(_0xf831f2){return BPromise[_0xc008('0x2e')](_0xf831f2);}return _0x1032b2[_0xc008('0x2f')]();};}function saveUpdates(_0xceebc3,_0x294f97){return function(_0x22d8e8){if(_0x22d8e8){return _0x22d8e8[_0xc008('0x30')](_0xceebc3)[_0xc008('0x1c')](function(_0x2f4b6b){return _0x2f4b6b;});}return null;};}function removeEntity(_0x1ac7c8,_0x596ee8){return function(_0x334a09){if(_0x334a09){return _0x334a09[_0xc008('0x31')]()['then'](function(){var _0xaf4b84=_0x334a09[_0xc008('0x32')]({'plain':!![]});var _0x383be7=_0xc008('0x33');return db[_0xc008('0x34')][_0xc008('0x31')]({'where':{'type':_0x383be7,'resourceId':_0xaf4b84['id']}})[_0xc008('0x1c')](function(){return _0x334a09;});})[_0xc008('0x1c')](function(){_0x1ac7c8[_0xc008('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415b87,_0x389a40){return function(_0x459df4){if(!_0x459df4){_0x415b87[_0xc008('0x25')](0x194);}return _0x459df4;};}function handleError(_0x40002f,_0x315562){_0x315562=_0x315562||0x1f4;return function(_0x1667a0){logger['error'](_0x1667a0[_0xc008('0x35')]);if(_0x1667a0[_0xc008('0x36')]){delete _0x1667a0['name'];}_0x40002f[_0xc008('0x26')](_0x315562)[_0xc008('0x37')](_0x1667a0);};}exports['index']=function(_0x263473,_0x2e4ae1){var _0x280e9b={},_0x55ff48={},_0x53b353={'count':0x0,'rows':[]};var _0x478810=_[_0xc008('0x38')](db['Trunk'][_0xc008('0x39')],function(_0x3884dd){return{'name':_0x3884dd[_0xc008('0x3a')],'type':_0x3884dd[_0xc008('0x3b')][_0xc008('0x3c')]};});_0x55ff48[_0xc008('0x3d')]=_[_0xc008('0x38')](_0x478810,_0xc008('0x36'));_0x55ff48[_0xc008('0x3e')]=_[_0xc008('0x3f')](_0x263473[_0xc008('0x3e')]);_0x55ff48[_0xc008('0x40')]=_[_0xc008('0x41')](_0x55ff48[_0xc008('0x3d')],_0x55ff48['query']);_0x280e9b[_0xc008('0x42')]=_[_0xc008('0x41')](_0x55ff48[_0xc008('0x3d')],qs[_0xc008('0x43')](_0x263473['query'][_0xc008('0x43')]));_0x280e9b[_0xc008('0x42')]=_0x280e9b[_0xc008('0x42')][_0xc008('0x44')]?_0x280e9b[_0xc008('0x42')]:_0x55ff48['model'];if(!_0x263473[_0xc008('0x3e')][_0xc008('0x45')](_0xc008('0x46'))){_0x280e9b[_0xc008('0x2b')]=qs[_0xc008('0x2b')](_0x263473['query'][_0xc008('0x2b')]);_0x280e9b[_0xc008('0x2a')]=qs[_0xc008('0x2a')](_0x263473[_0xc008('0x3e')]['offset']);}_0x280e9b[_0xc008('0x47')]=qs[_0xc008('0x48')](_0x263473[_0xc008('0x3e')]['sort']);_0x280e9b[_0xc008('0x49')]=qs['filters'](_[_0xc008('0x4a')](_0x263473['query'],_0x55ff48[_0xc008('0x40')]),_0x478810);if(_0x263473[_0xc008('0x3e')]['filter']){_0x280e9b[_0xc008('0x49')]=_[_0xc008('0x4b')](_0x280e9b[_0xc008('0x49')],{'$or':_['map'](_0x478810,function(_0x1cec64){if(_0x1cec64[_0xc008('0x3b')]!==_0xc008('0x4c')){var _0x44fc5d={};_0x44fc5d[_0x1cec64[_0xc008('0x36')]]={'$like':'%'+_0x263473[_0xc008('0x3e')]['filter']+'%'};return _0x44fc5d;}})});}_0x280e9b=_['merge']({},_0x280e9b,_0x263473['options']);var _0x4552ed={'where':_0x280e9b[_0xc008('0x49')]};return db[_0xc008('0x4d')][_0xc008('0x29')](_0x4552ed)[_0xc008('0x1c')](function(_0x24f6a4){_0x53b353[_0xc008('0x29')]=_0x24f6a4;if(_0x263473[_0xc008('0x3e')]['includeAll']){_0x280e9b['include']=[{'all':!![]}];}return db['Trunk'][_0xc008('0x4e')](_0x280e9b);})[_0xc008('0x1c')](function(_0x158eae){_0x53b353['rows']=_0x158eae;return _0x53b353;})[_0xc008('0x1c')](respondWithFilteredResult(_0x2e4ae1,_0x280e9b))[_0xc008('0x24')](handleError(_0x2e4ae1,null));};exports[_0xc008('0x4f')]=function(_0x1c2c50,_0x4981b4){var _0x56e4ac={'raw':![],'where':{'id':_0x1c2c50[_0xc008('0x50')]['id']}},_0x17ec90={};_0x17ec90[_0xc008('0x3d')]=_[_0xc008('0x3f')](db['Trunk']['rawAttributes']);_0x17ec90[_0xc008('0x3e')]=_['keys'](_0x1c2c50[_0xc008('0x3e')]);_0x17ec90[_0xc008('0x40')]=_[_0xc008('0x41')](_0x17ec90['model'],_0x17ec90[_0xc008('0x3e')]);_0x56e4ac[_0xc008('0x42')]=_[_0xc008('0x41')](_0x17ec90[_0xc008('0x3d')],qs[_0xc008('0x43')](_0x1c2c50['query'][_0xc008('0x43')]));_0x56e4ac[_0xc008('0x42')]=_0x56e4ac['attributes'][_0xc008('0x44')]?_0x56e4ac[_0xc008('0x42')]:_0x17ec90['model'];if(_0x1c2c50['query'][_0xc008('0x51')]){_0x56e4ac[_0xc008('0x52')]=[{'all':!![]}];}_0x56e4ac=_[_0xc008('0x4b')]({},_0x56e4ac,_0x1c2c50[_0xc008('0x53')]);return db[_0xc008('0x4d')]['find'](_0x56e4ac)['then'](handleEntityNotFound(_0x4981b4,null))[_0xc008('0x1c')](respondWithResult(_0x4981b4,null))['catch'](handleError(_0x4981b4,null));};exports[_0xc008('0x54')]=function(_0x25d351,_0xf94fcb){var _0x2f1105={'where':{'id':_0x25d351[_0xc008('0x50')]['id']}},_0x44f42d={};_0x44f42d['model']=_[_0xc008('0x3f')](db[_0xc008('0x4d')][_0xc008('0x39')]);_0x2f1105[_0xc008('0x42')]=_[_0xc008('0x41')](_0x44f42d['model'],qs[_0xc008('0x43')](_0x25d351['query']['fields']));_0x2f1105['attributes']=_0x2f1105[_0xc008('0x42')][_0xc008('0x44')]?_0x2f1105[_0xc008('0x42')]:_0x44f42d['model'];if(_0x25d351[_0xc008('0x3e')][_0xc008('0x51')]){_0x2f1105[_0xc008('0x52')]=[{'all':!![]}];}_0x2f1105=_['merge']({},_0x2f1105,_0x25d351[_0xc008('0x53')]);return db[_0xc008('0x4d')][_0xc008('0x55')](_0x2f1105)[_0xc008('0x1c')](handleEntityNotFound(_0xf94fcb,null))['then'](function(_0x4022dd){if(_0x4022dd){var _0x4eaa6d=_0x4022dd[_0xc008('0x32')]({'plain':!![]});_0x4eaa6d=qs[_0xc008('0x56')](_0x4eaa6d,['id',_0xc008('0x57'),_0xc008('0x58')]);_0x25d351[_0xc008('0x59')]=_[_0xc008('0x56')](_0x25d351['body'],['id',_0xc008('0x57'),'updatedAt']);return db['Trunk'][_0xc008('0x5a')](_[_0xc008('0x4b')](_0x4eaa6d,_0x25d351['body']),{'include':_0x25d351[_0xc008('0x3e')][_0xc008('0x51')]?[{'all':!![]}]:undefined})[_0xc008('0x1c')](function(_0x4517c0){var _0x21ee6d=_0x25d351[_0xc008('0x5b')][_0xc008('0x32')]({'plain':!![]});if(!_0x21ee6d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21ee6d[_0xc008('0x5c')]===_0xc008('0x5b')){var _0x3bfb15=_0x4517c0[_0xc008('0x32')]({'plain':!![]});var _0xb3ca0f=_0xc008('0x33');return db[_0xc008('0x5d')][_0xc008('0x55')]({'where':{'name':_0xb3ca0f,'userProfileId':_0x21ee6d[_0xc008('0x5e')]},'raw':!![]})[_0xc008('0x1c')](function(_0x1bef66){if(_0x1bef66&&_0x1bef66[_0xc008('0x5f')]===0x0){return db[_0xc008('0x34')][_0xc008('0x5a')]({'name':_0x3bfb15['name'],'resourceId':_0x3bfb15['id'],'type':_0x1bef66[_0xc008('0x36')],'sectionId':_0x1bef66['id']},{})[_0xc008('0x1c')](function(){return _0x4517c0;});}else{return _0x4517c0;}})[_0xc008('0x24')](function(_0x566dea){logger[_0xc008('0x20')](_0xc008('0x60'),_0x566dea);throw _0x566dea;});}return _0x4517c0;});}})['then'](respondWithResult(_0xf94fcb,0xc9))['catch'](handleError(_0xf94fcb,null));};exports[_0xc008('0x5a')]=function(_0x2a4c2b,_0x7bad14,_0x39083c){var _0x1a2ce7;return db[_0xc008('0x4d')][_0xc008('0x5a')](_0x2a4c2b[_0xc008('0x59')],{'raw':!![]})[_0xc008('0x1c')](function(_0x1b059b){_0x1a2ce7=_0x1b059b;return db[_0xc008('0x4d')]['findAll']({'raw':!![]});})[_0xc008('0x1c')](function(_0x25a52b){var _0xfdb5e3=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],'server/files/templates/trunk.ejs'),_0xc008('0x63'));var _0x46fa7b=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],_0xc008('0x64')),_0xc008('0x63'));var _0x553f5c=ejs[_0xc008('0x65')](_0xfdb5e3,{'trunks':_0x25a52b||[]});fs['writeFileSync'](_0xc008('0x66'),_0x553f5c);if(_0x1a2ce7[_0xc008('0x67')]){var _0x23012c=ejs[_0xc008('0x65')](_0x46fa7b,{'trunks':_0x25a52b||[]});fs[_0xc008('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x23012c);}})[_0xc008('0x1c')](function(){return respondWithRpcPromise(_0xc008('0x69'),'create',{'module':_0xc008('0x6a')});})['then'](function(){var _0x278cbe=_0x2a4c2b['user'][_0xc008('0x32')]({'plain':!![]});if(!_0x278cbe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x278cbe[_0xc008('0x5c')]===_0xc008('0x5b')){var _0x33d8e4=_0x1a2ce7[_0xc008('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xc008('0x55')]({'where':{'name':_0xc008('0x33'),'userProfileId':_0x278cbe[_0xc008('0x5e')]},'raw':!![]})[_0xc008('0x1c')](function(_0x321500){if(_0x321500&&_0x321500[_0xc008('0x5f')]===0x0){return db[_0xc008('0x34')][_0xc008('0x5a')]({'name':_0x33d8e4['name'],'resourceId':_0x33d8e4['id'],'type':_0x321500[_0xc008('0x36')],'sectionId':_0x321500['id']},{})['then'](function(){return _0x1a2ce7;});}else{return _0x1a2ce7;}})['catch'](function(_0x4c84da){logger[_0xc008('0x20')](_0xc008('0x60'),_0x4c84da);throw _0x4c84da;});}return _0x1a2ce7;})[_0xc008('0x1c')](respondWithResult(_0x7bad14,0xc9))[_0xc008('0x24')](handleError(_0x7bad14,null));};exports[_0xc008('0x30')]=function(_0x2e9646,_0x23ef42,_0x519328){var _0x127bdf;return db['Trunk'][_0xc008('0x55')]({'where':{'id':_0x2e9646[_0xc008('0x50')]['id']}})[_0xc008('0x1c')](handleEntityNotFound(_0x23ef42,null))[_0xc008('0x1c')](saveUpdates(_0x2e9646[_0xc008('0x59')],null))[_0xc008('0x1c')](function(_0x23d4ff){if(_0x23d4ff){_0x127bdf=_0x23d4ff;return db[_0xc008('0x4d')][_0xc008('0x4e')]({'raw':!![]});}})[_0xc008('0x1c')](function(_0x334ed8){if(_0x334ed8){var _0x1dd9fe=fs['readFileSync'](path['join'](config[_0xc008('0x62')],_0xc008('0x6b')),_0xc008('0x63'));var _0x572d93=fs[_0xc008('0x61')](path[_0xc008('0x6c')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x3fc44f=ejs[_0xc008('0x65')](_0x1dd9fe,{'trunks':_0x334ed8||[]});fs[_0xc008('0x68')](_0xc008('0x66'),_0x3fc44f);var _0x1101b8=ejs[_0xc008('0x65')](_0x572d93,{'trunks':_0x334ed8||[]});fs[_0xc008('0x68')](_0xc008('0x6d'),_0x1101b8);return respondWithRpcPromise(_0xc008('0x69'),_0xc008('0x30'),{'module':'chan_sip.so'});}return null;})['then'](function(_0xc644fe){if(_0xc644fe){return _0x127bdf;}})[_0xc008('0x1c')](respondWithResult(_0x23ef42,null))[_0xc008('0x24')](handleError(_0x23ef42,null));};exports[_0xc008('0x31')]=function(_0x2b94b2,_0x37fc2c,_0x4b434f){var _0x5794fe;return db[_0xc008('0x4d')][_0xc008('0x55')]({'where':{'id':_0x2b94b2[_0xc008('0x50')]['id']}})['then'](handleEntityNotFound(_0x37fc2c,null))['then'](removeEntity(_0x37fc2c,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})['then'](function(_0x276de2){var _0x52bf60=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],_0xc008('0x6b')),_0xc008('0x63'));var _0x5bc8b0=fs['readFileSync'](path[_0xc008('0x6c')](config['root'],_0xc008('0x64')),_0xc008('0x63'));var _0x544519=ejs[_0xc008('0x65')](_0x52bf60,{'trunks':_0x276de2});var _0x4db90b=ejs['render'](_0x5bc8b0,{'trunks':_0x276de2});fs[_0xc008('0x68')](_0xc008('0x66'),_0x544519);fs['writeFileSync'](_0xc008('0x6d'),_0x4db90b);return respondWithRpcPromise(_0xc008('0x69'),_0xc008('0x31'),{'module':'chan_sip.so'});})[_0xc008('0x24')](handleError(_0x37fc2c,null));}; \ No newline at end of file +var _0xe5b3=['then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','clone','find','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request'];(function(_0x553150,_0x589ff3){var _0x18193d=function(_0x3a5ae6){while(--_0x3a5ae6){_0x553150['push'](_0x553150['shift']());}};_0x18193d(++_0x589ff3);}(_0xe5b3,0x133));var _0x3e5b=function(_0x46cbc6,_0x477112){_0x46cbc6=_0x46cbc6-0x0;var _0x335ca5=_0xe5b3[_0x46cbc6];return _0x335ca5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];var jayson=require(_0x3e5b('0x19'));var client=jayson[_0x3e5b('0x1a')][_0x3e5b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x405e70,_0x560010,_0x39a2a1,_0x5f2f9c){return new BPromise(function(_0x51a188,_0x4d71a3){var _0x3754e3=_0x5f2f9c||client;return _0x3754e3[_0x3e5b('0x1c')](_0x405e70,_0x39a2a1)[_0x3e5b('0x1d')](function(_0x4fb471){logger[_0x3e5b('0x1e')]('Trunk,\x20%s,\x20%s',_0x560010,'request\x20sent');logger[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0x560010,'request\x20sent',JSON[_0x3e5b('0x21')](_0x4fb471));if(_0x4fb471[_0x3e5b('0x22')]){if(_0x4fb471['error'][_0x3e5b('0x23')]===0x1f4){logger[_0x3e5b('0x22')]('Trunk,\x20%s,\x20%s',_0x560010,_0x4fb471['error'][_0x3e5b('0x24')]);return _0x4d71a3(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);return _0x51a188(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}else{logger[_0x3e5b('0x1e')](_0x3e5b('0x25'),_0x560010,_0x3e5b('0x26'));_0x51a188(_0x4fb471[_0x3e5b('0x27')][_0x3e5b('0x24')]);}})['catch'](function(_0x433f9c){logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x433f9c);_0x4d71a3(_0x433f9c);});});}function respondWithStatusCode(_0x150674,_0x50039b){_0x50039b=_0x50039b||0xcc;return function(_0x1eb80f){if(_0x1eb80f){return _0x150674['sendStatus'](_0x50039b);}return _0x150674[_0x3e5b('0x28')](_0x50039b)[_0x3e5b('0x29')]();};}function respondWithResult(_0x4d5e61,_0x41b684){_0x41b684=_0x41b684||0xc8;return function(_0x2f6368){if(_0x2f6368){return _0x4d5e61[_0x3e5b('0x28')](_0x41b684)[_0x3e5b('0x2a')](_0x2f6368);}};}function respondWithFilteredResult(_0x3bb749,_0x26c7f2){return function(_0x160e87){if(_0x160e87){var _0x2ddf57=typeof _0x26c7f2['offset']===_0x3e5b('0x2b')&&typeof _0x26c7f2['limit']===_0x3e5b('0x2b');var _0x4fd64b=_0x160e87[_0x3e5b('0x2c')];var _0x1f6473=_0x2ddf57?0x0:_0x26c7f2[_0x3e5b('0x2d')];var _0x475b39=_0x2ddf57?_0x160e87[_0x3e5b('0x2c')]:_0x26c7f2[_0x3e5b('0x2d')]+_0x26c7f2[_0x3e5b('0x2e')];var _0x9c2123;if(_0x475b39>=_0x4fd64b){_0x475b39=_0x4fd64b;_0x9c2123=0xc8;}else{_0x9c2123=0xce;}_0x3bb749[_0x3e5b('0x28')](_0x9c2123);return _0x3bb749[_0x3e5b('0x2f')](_0x3e5b('0x30'),_0x1f6473+'-'+_0x475b39+'/'+_0x4fd64b)['json'](_0x160e87);}return null;};}function patchUpdates(_0x21bc10){return function(_0x1882aa){try{jsonpatch[_0x3e5b('0x31')](_0x1882aa,_0x21bc10,!![]);}catch(_0x2a14eb){return BPromise[_0x3e5b('0x32')](_0x2a14eb);}return _0x1882aa[_0x3e5b('0x33')]();};}function saveUpdates(_0x345927,_0x4c4e01){return function(_0x33f089){if(_0x33f089){return _0x33f089['update'](_0x345927)['then'](function(_0x32c6b0){return _0x32c6b0;});}return null;};}function removeEntity(_0x78d68a,_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x34')]()[_0x3e5b('0x1d')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x35')]({'plain':!![]});var _0x26f842=_0x3e5b('0x36');return db[_0x3e5b('0x37')][_0x3e5b('0x34')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1d')](function(){return _0x40e37d;});})[_0x3e5b('0x1d')](function(){_0x78d68a[_0x3e5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e,_0xec45c5){return function(_0x53caa2){if(!_0x53caa2){_0x141b7e['sendStatus'](0x194);}return _0x53caa2;};}function handleError(_0x471196,_0x56d7ef){_0x56d7ef=_0x56d7ef||0x1f4;return function(_0x2939da){logger[_0x3e5b('0x22')](_0x2939da[_0x3e5b('0x38')]);if(_0x2939da[_0x3e5b('0x39')]){delete _0x2939da['name'];}_0x471196[_0x3e5b('0x28')](_0x56d7ef)['send'](_0x2939da);};}exports[_0x3e5b('0x3a')]=function(_0x5ec841,_0x47f7c8){var _0x48f414={},_0x10c202={},_0x174ebf={'count':0x0,'rows':[]};var _0x2eaa30=_[_0x3e5b('0x3b')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')],function(_0x5466ac){return{'name':_0x5466ac['fieldName'],'type':_0x5466ac['type']['key']};});_0x10c202['model']=_['map'](_0x2eaa30,'name');_0x10c202[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x5ec841[_0x3e5b('0x3e')]);_0x10c202[_0x3e5b('0x40')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],_0x10c202[_0x3e5b('0x3e')]);_0x48f414[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x5ec841['query'][_0x3e5b('0x44')]));_0x48f414[_0x3e5b('0x43')]=_0x48f414[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x48f414[_0x3e5b('0x43')]:_0x10c202[_0x3e5b('0x42')];if(!_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x46')](_0x3e5b('0x47'))){_0x48f414[_0x3e5b('0x2e')]=qs[_0x3e5b('0x2e')](_0x5ec841['query']['limit']);_0x48f414['offset']=qs['offset'](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x2d')]);}_0x48f414[_0x3e5b('0x48')]=qs[_0x3e5b('0x49')](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x49')]);_0x48f414[_0x3e5b('0x4a')]=qs[_0x3e5b('0x40')](_[_0x3e5b('0x4b')](_0x5ec841[_0x3e5b('0x3e')],_0x10c202['filters']),_0x2eaa30);if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x4c')]){_0x48f414[_0x3e5b('0x4a')]=_[_0x3e5b('0x4d')](_0x48f414[_0x3e5b('0x4a')],{'$or':_['map'](_0x2eaa30,function(_0x588ee7){if(_0x588ee7['type']!==_0x3e5b('0x4e')){var _0x20af6a={};_0x20af6a[_0x588ee7[_0x3e5b('0x39')]]={'$like':'%'+_0x5ec841['query']['filter']+'%'};return _0x20af6a;}})});}_0x48f414=_[_0x3e5b('0x4d')]({},_0x48f414,_0x5ec841[_0x3e5b('0x4f')]);var _0x123947={'where':_0x48f414['where']};return db['Trunk'][_0x3e5b('0x2c')](_0x123947)['then'](function(_0x14b62a){_0x174ebf[_0x3e5b('0x2c')]=_0x14b62a;if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x48f414[_0x3e5b('0x51')]=[{'all':!![]}];}return db[_0x3e5b('0x3c')][_0x3e5b('0x52')](_0x48f414);})[_0x3e5b('0x1d')](function(_0x339852){_0x174ebf['rows']=_0x339852;return _0x174ebf;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x47f7c8,_0x48f414))['catch'](handleError(_0x47f7c8,null));};exports[_0x3e5b('0x53')]=function(_0x2e7047,_0x26e11e){var _0x3d51fa={'raw':![],'where':{'id':_0x2e7047[_0x3e5b('0x54')]['id']}},_0x291e4d={};_0x291e4d[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x291e4d[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x2e7047[_0x3e5b('0x3e')]);_0x291e4d['filters']=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],_0x291e4d[_0x3e5b('0x3e')]);_0x3d51fa[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],qs['fields'](_0x2e7047[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x3d51fa[_0x3e5b('0x43')]=_0x3d51fa[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x3d51fa[_0x3e5b('0x43')]:_0x291e4d[_0x3e5b('0x42')];if(_0x2e7047[_0x3e5b('0x3e')]['includeAll']){_0x3d51fa[_0x3e5b('0x51')]=[{'all':!![]}];}_0x3d51fa=_['merge']({},_0x3d51fa,_0x2e7047['options']);return db[_0x3e5b('0x3c')]['find'](_0x3d51fa)[_0x3e5b('0x1d')](handleEntityNotFound(_0x26e11e,null))[_0x3e5b('0x1d')](respondWithResult(_0x26e11e,null))[_0x3e5b('0x55')](handleError(_0x26e11e,null));};exports[_0x3e5b('0x56')]=function(_0x4a492b,_0x5ddeee){var _0x545712={'where':{'id':_0x4a492b[_0x3e5b('0x54')]['id']}},_0x581b94={};_0x581b94[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x545712['attributes']=_['intersection'](_0x581b94[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x545712[_0x3e5b('0x43')]=_0x545712['attributes']['length']?_0x545712['attributes']:_0x581b94['model'];if(_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x545712[_0x3e5b('0x51')]=[{'all':!![]}];}_0x545712=_[_0x3e5b('0x4d')]({},_0x545712,_0x4a492b[_0x3e5b('0x4f')]);return db[_0x3e5b('0x3c')][_0x3e5b('0x57')](_0x545712)[_0x3e5b('0x1d')](handleEntityNotFound(_0x5ddeee,null))['then'](function(_0x285db6){if(_0x285db6){var _0x29897b=_0x285db6[_0x3e5b('0x35')]({'plain':!![]});_0x29897b=qs[_0x3e5b('0x58')](_0x29897b,['id',_0x3e5b('0x59'),'updatedAt']);_0x4a492b[_0x3e5b('0x5a')]=_['omit'](_0x4a492b[_0x3e5b('0x5a')],['id',_0x3e5b('0x59'),'updatedAt']);return db['Trunk']['create'](_[_0x3e5b('0x4d')](_0x29897b,_0x4a492b['body']),{'include':_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]?[{'all':!![]}]:undefined})[_0x3e5b('0x1d')](function(_0x40197c){var _0x14f187=_0x4a492b['user']['get']({'plain':!![]});if(!_0x14f187)throw new Error(_0x3e5b('0x5b'));if(_0x14f187[_0x3e5b('0x5c')]===_0x3e5b('0x5d')){var _0x4dfb45=_0x40197c[_0x3e5b('0x35')]({'plain':!![]});var _0x3c5293=_0x3e5b('0x36');return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3c5293,'userProfileId':_0x14f187[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x4a1ce3){if(_0x4a1ce3&&_0x4a1ce3[_0x3e5b('0x60')]===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x4dfb45[_0x3e5b('0x39')],'resourceId':_0x4dfb45['id'],'type':_0x4a1ce3[_0x3e5b('0x39')],'sectionId':_0x4a1ce3['id']},{})[_0x3e5b('0x1d')](function(){return _0x40197c;});}else{return _0x40197c;}})[_0x3e5b('0x55')](function(_0x2411c3){logger[_0x3e5b('0x22')](_0x3e5b('0x62'),_0x2411c3);throw _0x2411c3;});}return _0x40197c;});}})['then'](respondWithResult(_0x5ddeee,0xc9))[_0x3e5b('0x55')](handleError(_0x5ddeee,null));};exports[_0x3e5b('0x61')]=function(_0x5af305,_0x177144,_0x31ef31){var _0x561c78;return db['Trunk']['create'](_0x5af305[_0x3e5b('0x5a')],{'raw':!![]})[_0x3e5b('0x1d')](function(_0x498e6d){_0x561c78=_0x498e6d;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});})['then'](function(_0x3d3bf2){var _0x17f60f=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0x410c7a=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x40103e=ejs[_0x3e5b('0x69')](_0x17f60f,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x40103e);if(_0x561c78['registry']){var _0x590f0c=ejs[_0x3e5b('0x69')](_0x410c7a,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x590f0c);}})[_0x3e5b('0x1d')](function(){return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x61'),{'module':_0x3e5b('0x6d')});})[_0x3e5b('0x1d')](function(){var _0x9deb09=_0x5af305[_0x3e5b('0x5d')]['get']({'plain':!![]});if(!_0x9deb09)throw new Error(_0x3e5b('0x5b'));if(_0x9deb09[_0x3e5b('0x5c')]==='user'){var _0x577747=_0x561c78['get']({'plain':!![]});return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3e5b('0x36'),'userProfileId':_0x9deb09[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x1ba550){if(_0x1ba550&&_0x1ba550['autoAssociation']===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x577747['name'],'resourceId':_0x577747['id'],'type':_0x1ba550[_0x3e5b('0x39')],'sectionId':_0x1ba550['id']},{})['then'](function(){return _0x561c78;});}else{return _0x561c78;}})['catch'](function(_0x211e73){logger[_0x3e5b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211e73);throw _0x211e73;});}return _0x561c78;})[_0x3e5b('0x1d')](respondWithResult(_0x177144,0xc9))[_0x3e5b('0x55')](handleError(_0x177144,null));};exports['update']=function(_0x2e36af,_0x185640,_0x14baa9){var _0x1425eb;return db[_0x3e5b('0x3c')][_0x3e5b('0x57')]({'where':{'id':_0x2e36af['params']['id']}})['then'](handleEntityNotFound(_0x185640,null))[_0x3e5b('0x1d')](saveUpdates(_0x2e36af['body'],null))['then'](function(_0x25d3d8){if(_0x25d3d8){_0x1425eb=_0x25d3d8;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});}})['then'](function(_0x2e5fa3){if(_0x2e5fa3){var _0x4b8d19=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0xdf2677=fs['readFileSync'](path[_0x3e5b('0x64')](config['root'],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x58ccf3=ejs[_0x3e5b('0x69')](_0x4b8d19,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x58ccf3);var _0x5ad011=ejs[_0x3e5b('0x69')](_0xdf2677,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5ad011);return respondWithRpcPromise('Reload',_0x3e5b('0x6f'),{'module':_0x3e5b('0x6d')});}return null;})['then'](function(_0xd9d941){if(_0xd9d941){return _0x1425eb;}})[_0x3e5b('0x1d')](respondWithResult(_0x185640,null))[_0x3e5b('0x55')](handleError(_0x185640,null));};exports['destroy']=function(_0x3b3306,_0x30e079,_0x352f7e){var _0x1d7c05;return db['Trunk'][_0x3e5b('0x57')]({'where':{'id':_0x3b3306['params']['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x30e079,null))['then'](removeEntity(_0x30e079,null))[_0x3e5b('0x1d')](function(){return db[_0x3e5b('0x3c')]['findAll']({'raw':!![]});})[_0x3e5b('0x1d')](function(_0x2299b9){var _0x56ff9d=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),'utf8');var _0x53328b=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x3d1193=ejs['render'](_0x56ff9d,{'trunks':_0x2299b9});var _0x5d6aae=ejs[_0x3e5b('0x69')](_0x53328b,{'trunks':_0x2299b9});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x3d1193);fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5d6aae);return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x34'),{'module':_0x3e5b('0x6d')});})['catch'](handleError(_0x30e079,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index e74072b..4bf354a 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 _0x4e9b=['bluebird','path','rimraf','../../config/environment','./trunk.attributes','define','Trunk','tools_trunks','util','../../config/logger','api','moment'];(function(_0x265f52,_0x2d59d1){var _0x108c85=function(_0x56bc80){while(--_0x56bc80){_0x265f52['push'](_0x265f52['shift']());}};_0x108c85(++_0x2d59d1);}(_0x4e9b,0x1a0));var _0xb4e9=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x4e9b[_0x19b3f9];return _0x18c3f6;};'use strict';var _=require('lodash');var util=require(_0xb4e9('0x0'));var logger=require(_0xb4e9('0x1'))(_0xb4e9('0x2'));var moment=require(_0xb4e9('0x3'));var BPromise=require(_0xb4e9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4e9('0x5'));var rimraf=require(_0xb4e9('0x6'));var config=require(_0xb4e9('0x7'));var attributes=require(_0xb4e9('0x8'));module['exports']=function(_0xe02e40,_0x1d1839){return _0xe02e40[_0xb4e9('0x9')](_0xb4e9('0xa'),attributes,{'tableName':_0xb4e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7ef=['../../config/environment','./trunk.attributes','exports','define','tools_trunks','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x211fc2,_0x306cd7){var _0x523302=function(_0x2f2213){while(--_0x2f2213){_0x211fc2['push'](_0x211fc2['shift']());}};_0x523302(++_0x306cd7);}(_0xf7ef,0x89));var _0xff7e=function(_0x243cef,_0x382eac){_0x243cef=_0x243cef-0x0;var _0x5bc2bf=_0xf7ef[_0x243cef];return _0x5bc2bf;};'use strict';var _=require(_0xff7e('0x0'));var util=require(_0xff7e('0x1'));var logger=require(_0xff7e('0x2'))(_0xff7e('0x3'));var moment=require('moment');var BPromise=require(_0xff7e('0x4'));var rp=require(_0xff7e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xff7e('0x6'));var attributes=require(_0xff7e('0x7'));module[_0xff7e('0x8')]=function(_0x59cab7,_0x115dc1){return _0x59cab7[_0xff7e('0x9')]('Trunk',attributes,{'tableName':_0xff7e('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 98869e9..eebed86 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 _0x61d3=['result','GetTrunk','Trunk','findAll','raw','options','where','limit','include','map','model','attributes','stringify','ShowTrunk','find','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x51ecaa,_0x5cb746){var _0x287dca=function(_0x210136){while(--_0x210136){_0x51ecaa['push'](_0x51ecaa['shift']());}};_0x287dca(++_0x5cb746);}(_0x61d3,0x7f));var _0x361d=function(_0x383c94,_0x2c7402){_0x383c94=_0x383c94-0x0;var _0x149b61=_0x61d3[_0x383c94];return _0x149b61;};'use strict';var _=require(_0x361d('0x0'));var util=require(_0x361d('0x1'));var moment=require(_0x361d('0x2'));var BPromise=require(_0x361d('0x3'));var rs=require(_0x361d('0x4'));var fs=require('fs');var Redis=require(_0x361d('0x5'));var db=require(_0x361d('0x6'))['db'];var utils=require(_0x361d('0x7'));var logger=require(_0x361d('0x8'))(_0x361d('0x9'));var config=require(_0x361d('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x361d('0xb')][_0x361d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x19de70,_0x40c218,_0x1e227c){return new BPromise(function(_0x4f23b9,_0x3e2267){return client['request'](_0x19de70,_0x1e227c)[_0x361d('0xd')](function(_0x29ab18){logger[_0x361d('0xe')](_0x361d('0xf'),_0x40c218,_0x361d('0x10'));logger[_0x361d('0x11')](_0x361d('0x12'),_0x40c218,_0x361d('0x10'),JSON['stringify'](_0x29ab18));if(_0x29ab18['error']){if(_0x29ab18[_0x361d('0x13')]['code']===0x1f4){logger[_0x361d('0x13')]('Trunk,\x20%s,\x20%s',_0x40c218,_0x29ab18[_0x361d('0x13')][_0x361d('0x14')]);return _0x3e2267(_0x29ab18[_0x361d('0x13')]['message']);}logger[_0x361d('0x13')](_0x361d('0xf'),_0x40c218,_0x29ab18[_0x361d('0x13')][_0x361d('0x14')]);return _0x4f23b9(_0x29ab18[_0x361d('0x13')][_0x361d('0x14')]);}else{logger[_0x361d('0xe')](_0x361d('0xf'),_0x40c218,_0x361d('0x10'));_0x4f23b9(_0x29ab18[_0x361d('0x15')]['message']);}})['catch'](function(_0xb7da3a){logger[_0x361d('0x13')]('Trunk,\x20%s,\x20%s',_0x40c218,_0xb7da3a);_0x3e2267(_0xb7da3a);});});}exports[_0x361d('0x16')]=function(_0x301ae0){var _0x2bd7c3=this;return new Promise(function(_0x4e993a,_0x409c77){return db[_0x361d('0x17')][_0x361d('0x18')]({'raw':_0x301ae0['options']?_0x301ae0['options'][_0x361d('0x19')]===undefined?!![]:![]:!![],'where':_0x301ae0[_0x361d('0x1a')]?_0x301ae0['options'][_0x361d('0x1b')]||null:null,'attributes':_0x301ae0['options']?_0x301ae0['options']['attributes']||null:null,'limit':_0x301ae0['options']?_0x301ae0[_0x361d('0x1a')][_0x361d('0x1c')]||null:null,'include':_0x301ae0[_0x361d('0x1a')]?_0x301ae0[_0x361d('0x1a')][_0x361d('0x1d')]?_[_0x361d('0x1e')](_0x301ae0[_0x361d('0x1a')][_0x361d('0x1d')],function(_0x572a63){return{'model':db[_0x572a63[_0x361d('0x1f')]],'as':_0x572a63['as'],'attributes':_0x572a63[_0x361d('0x20')],'include':_0x572a63[_0x361d('0x1d')]?_[_0x361d('0x1e')](_0x572a63['include'],function(_0x3d05f9){return{'model':db[_0x3d05f9[_0x361d('0x1f')]],'as':_0x3d05f9['as'],'attributes':_0x3d05f9['attributes'],'include':_0x3d05f9['include']?_[_0x361d('0x1e')](_0x3d05f9['include'],function(_0x38074c){return{'model':db[_0x38074c[_0x361d('0x1f')]],'as':_0x38074c['as'],'attributes':_0x38074c['attributes']};}):[]};}):[]};}):[]:[]})[_0x361d('0xd')](function(_0xd14d29){logger[_0x361d('0xe')]('GetTrunk',_0x301ae0);logger[_0x361d('0x11')]('GetTrunk',_0x301ae0,JSON[_0x361d('0x21')](_0xd14d29));_0x4e993a(_0xd14d29);})['catch'](function(_0xb53d80){logger[_0x361d('0x13')](_0x361d('0x16'),_0xb53d80[_0x361d('0x14')],_0x301ae0);_0x409c77(_0x2bd7c3[_0x361d('0x13')](0x1f4,_0xb53d80['message']));});});};exports[_0x361d('0x22')]=function(_0x15439f){var _0x44b1b2=this;return new Promise(function(_0x5410c9,_0x57b934){return db[_0x361d('0x17')][_0x361d('0x23')]({'raw':_0x15439f[_0x361d('0x1a')]?_0x15439f[_0x361d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x15439f[_0x361d('0x1a')]?_0x15439f[_0x361d('0x1a')][_0x361d('0x1b')]||null:null,'attributes':_0x15439f['options']?_0x15439f[_0x361d('0x1a')][_0x361d('0x20')]||null:null,'include':_0x15439f[_0x361d('0x1a')]?_0x15439f[_0x361d('0x1a')]['include']?_['map'](_0x15439f[_0x361d('0x1a')][_0x361d('0x1d')],function(_0x1a690d){return{'model':db[_0x1a690d[_0x361d('0x1f')]],'as':_0x1a690d['as'],'attributes':_0x1a690d[_0x361d('0x20')],'include':_0x1a690d['include']?_[_0x361d('0x1e')](_0x1a690d['include'],function(_0x53d57a){return{'model':db[_0x53d57a[_0x361d('0x1f')]],'as':_0x53d57a['as'],'attributes':_0x53d57a[_0x361d('0x20')],'include':_0x53d57a['include']?_[_0x361d('0x1e')](_0x53d57a['include'],function(_0xf83df0){return{'model':db[_0xf83df0[_0x361d('0x1f')]],'as':_0xf83df0['as'],'attributes':_0xf83df0[_0x361d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x361d('0xd')](function(_0x48b3ed){logger[_0x361d('0xe')](_0x361d('0x22'),_0x15439f);logger[_0x361d('0x11')](_0x361d('0x22'),_0x15439f,JSON[_0x361d('0x21')](_0x48b3ed));_0x5410c9(_0x48b3ed);})[_0x361d('0x24')](function(_0x3b0b66){logger[_0x361d('0x13')](_0x361d('0x22'),_0x3b0b66['message'],_0x15439f);_0x57b934(_0x44b1b2[_0x361d('0x13')](0x1f4,_0x3b0b66['message']));});});}; \ No newline at end of file +var _0x7f59=['stringify','catch','ShowTrunk','Trunk','find','raw','where','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','error','message','result','GetTrunk','findAll','options','attributes','limit','include','map','model','then'];(function(_0x2a83e1,_0x5683e6){var _0x2117af=function(_0x1dbfa){while(--_0x1dbfa){_0x2a83e1['push'](_0x2a83e1['shift']());}};_0x2117af(++_0x5683e6);}(_0x7f59,0x1c4));var _0x97f5=function(_0x4e2127,_0x34df23){_0x4e2127=_0x4e2127-0x0;var _0x2a7cdd=_0x7f59[_0x4e2127];return _0x2a7cdd;};'use strict';var _=require(_0x97f5('0x0'));var util=require(_0x97f5('0x1'));var moment=require(_0x97f5('0x2'));var BPromise=require(_0x97f5('0x3'));var rs=require(_0x97f5('0x4'));var fs=require('fs');var Redis=require(_0x97f5('0x5'));var db=require(_0x97f5('0x6'))['db'];var utils=require(_0x97f5('0x7'));var logger=require(_0x97f5('0x8'))('rpc');var config=require(_0x97f5('0x9'));var jayson=require(_0x97f5('0xa'));var client=jayson[_0x97f5('0xb')][_0x97f5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3181ba,_0x1385dc,_0x45ed09){return new BPromise(function(_0x2bde2d,_0x495d29){return client[_0x97f5('0xd')](_0x3181ba,_0x45ed09)['then'](function(_0x2f263b){logger[_0x97f5('0xe')](_0x97f5('0xf'),_0x1385dc,_0x97f5('0x10'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x1385dc,'request\x20sent',JSON['stringify'](_0x2f263b));if(_0x2f263b['error']){if(_0x2f263b[_0x97f5('0x11')]['code']===0x1f4){logger[_0x97f5('0x11')]('Trunk,\x20%s,\x20%s',_0x1385dc,_0x2f263b[_0x97f5('0x11')][_0x97f5('0x12')]);return _0x495d29(_0x2f263b['error'][_0x97f5('0x12')]);}logger[_0x97f5('0x11')]('Trunk,\x20%s,\x20%s',_0x1385dc,_0x2f263b[_0x97f5('0x11')][_0x97f5('0x12')]);return _0x2bde2d(_0x2f263b[_0x97f5('0x11')]['message']);}else{logger[_0x97f5('0xe')](_0x97f5('0xf'),_0x1385dc,_0x97f5('0x10'));_0x2bde2d(_0x2f263b[_0x97f5('0x13')][_0x97f5('0x12')]);}})['catch'](function(_0x27e7d3){logger['error'](_0x97f5('0xf'),_0x1385dc,_0x27e7d3);_0x495d29(_0x27e7d3);});});}exports[_0x97f5('0x14')]=function(_0xdc4c13){var _0x50483b=this;return new Promise(function(_0x5ccae1,_0x513835){return db['Trunk'][_0x97f5('0x15')]({'raw':_0xdc4c13['options']?_0xdc4c13[_0x97f5('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xdc4c13[_0x97f5('0x16')]?_0xdc4c13[_0x97f5('0x16')]['where']||null:null,'attributes':_0xdc4c13[_0x97f5('0x16')]?_0xdc4c13['options'][_0x97f5('0x17')]||null:null,'limit':_0xdc4c13[_0x97f5('0x16')]?_0xdc4c13[_0x97f5('0x16')][_0x97f5('0x18')]||null:null,'include':_0xdc4c13['options']?_0xdc4c13[_0x97f5('0x16')][_0x97f5('0x19')]?_[_0x97f5('0x1a')](_0xdc4c13[_0x97f5('0x16')][_0x97f5('0x19')],function(_0x41f943){return{'model':db[_0x41f943['model']],'as':_0x41f943['as'],'attributes':_0x41f943[_0x97f5('0x17')],'include':_0x41f943[_0x97f5('0x19')]?_[_0x97f5('0x1a')](_0x41f943[_0x97f5('0x19')],function(_0x180453){return{'model':db[_0x180453[_0x97f5('0x1b')]],'as':_0x180453['as'],'attributes':_0x180453['attributes'],'include':_0x180453[_0x97f5('0x19')]?_[_0x97f5('0x1a')](_0x180453[_0x97f5('0x19')],function(_0x17b01c){return{'model':db[_0x17b01c[_0x97f5('0x1b')]],'as':_0x17b01c['as'],'attributes':_0x17b01c[_0x97f5('0x17')]};}):[]};}):[]};}):[]:[]})[_0x97f5('0x1c')](function(_0x302d76){logger['info'](_0x97f5('0x14'),_0xdc4c13);logger['debug'](_0x97f5('0x14'),_0xdc4c13,JSON[_0x97f5('0x1d')](_0x302d76));_0x5ccae1(_0x302d76);})[_0x97f5('0x1e')](function(_0x3cb1ba){logger[_0x97f5('0x11')](_0x97f5('0x14'),_0x3cb1ba['message'],_0xdc4c13);_0x513835(_0x50483b[_0x97f5('0x11')](0x1f4,_0x3cb1ba[_0x97f5('0x12')]));});});};exports[_0x97f5('0x1f')]=function(_0x199617){var _0x3e5440=this;return new Promise(function(_0x3b715b,_0x15b409){return db[_0x97f5('0x20')][_0x97f5('0x21')]({'raw':_0x199617[_0x97f5('0x16')]?_0x199617[_0x97f5('0x16')][_0x97f5('0x22')]===undefined?!![]:![]:!![],'where':_0x199617[_0x97f5('0x16')]?_0x199617[_0x97f5('0x16')][_0x97f5('0x23')]||null:null,'attributes':_0x199617[_0x97f5('0x16')]?_0x199617['options'][_0x97f5('0x17')]||null:null,'include':_0x199617[_0x97f5('0x16')]?_0x199617['options'][_0x97f5('0x19')]?_['map'](_0x199617[_0x97f5('0x16')][_0x97f5('0x19')],function(_0x5922c3){return{'model':db[_0x5922c3[_0x97f5('0x1b')]],'as':_0x5922c3['as'],'attributes':_0x5922c3[_0x97f5('0x17')],'include':_0x5922c3['include']?_['map'](_0x5922c3[_0x97f5('0x19')],function(_0x1b8151){return{'model':db[_0x1b8151[_0x97f5('0x1b')]],'as':_0x1b8151['as'],'attributes':_0x1b8151[_0x97f5('0x17')],'include':_0x1b8151[_0x97f5('0x19')]?_[_0x97f5('0x1a')](_0x1b8151['include'],function(_0x2e3d92){return{'model':db[_0x2e3d92[_0x97f5('0x1b')]],'as':_0x2e3d92['as'],'attributes':_0x2e3d92[_0x97f5('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33f670){logger[_0x97f5('0xe')](_0x97f5('0x1f'),_0x199617);logger[_0x97f5('0x24')](_0x97f5('0x1f'),_0x199617,JSON[_0x97f5('0x1d')](_0x33f670));_0x3b715b(_0x33f670);})['catch'](function(_0x456ba4){logger[_0x97f5('0x11')](_0x97f5('0x1f'),_0x456ba4[_0x97f5('0x12')],_0x199617);_0x15b409(_0x3e5440[_0x97f5('0x11')](0x1f4,_0x456ba4[_0x97f5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 8776f96..7b21373 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 _0xe77f=['addQueues','diskStorage','root','server/files/images/','format','%s-%s','now','originalname','single','file','/:id/login','login','/:id/logout','logout','pause','/:id/unpause','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/square_projects','createApiKey','put','update','/:id/password','changePassword','removeQueues','removeTeams','delete','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many'];(function(_0x5b0339,_0x203fac){var _0x152a9c=function(_0x11a40e){while(--_0x11a40e){_0x5b0339['push'](_0x5b0339['shift']());}};_0x152a9c(++_0x203fac);}(_0xe77f,0xad));var _0xfe77=function(_0x49cd45,_0x1b5d4f){_0x49cd45=_0x49cd45-0x0;var _0x152d5=_0xe77f[_0x49cd45];return _0x152d5;};'use strict';var multer=require(_0xfe77('0x0'));var util=require(_0xfe77('0x1'));var path=require(_0xfe77('0x2'));var timeout=require(_0xfe77('0x3'));var express=require(_0xfe77('0x4'));var router=express[_0xfe77('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfe77('0x6'));var config=require(_0xfe77('0x7'));var controller=require(_0xfe77('0x8'));router[_0xfe77('0x9')]('/',auth[_0xfe77('0xa')](),controller[_0xfe77('0xb')]);router[_0xfe77('0x9')](_0xfe77('0xc'),auth[_0xfe77('0xa')](),controller[_0xfe77('0xd')]);router[_0xfe77('0x9')](_0xfe77('0xe'),auth['isAuthenticated'](),controller[_0xfe77('0xf')]);router['get'](_0xfe77('0x10'),auth['isAuthenticated'](),controller[_0xfe77('0x11')]);router[_0xfe77('0x9')](_0xfe77('0x12'),auth[_0xfe77('0xa')](),controller['show']);router[_0xfe77('0x9')](_0xfe77('0x13'),controller[_0xfe77('0x14')]);router['get'](_0xfe77('0x15'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x16')]);router[_0xfe77('0x9')](_0xfe77('0x17'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x18')]);router['get'](_0xfe77('0x19'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x1a')]);router['get'](_0xfe77('0x1b'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x1c')]);router[_0xfe77('0x9')](_0xfe77('0x1d'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x1e')]);router[_0xfe77('0x9')](_0xfe77('0x1f'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x20')]);router[_0xfe77('0x9')](_0xfe77('0x21'),auth['isAuthenticated'](),controller[_0xfe77('0x22')]);router[_0xfe77('0x9')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0xfe77('0x23')]);router[_0xfe77('0x9')](_0xfe77('0x24'),auth['isAuthenticated'](),controller[_0xfe77('0x25')]);router['get'](_0xfe77('0x26'),auth[_0xfe77('0xa')](),controller['getMailInteractions']);router[_0xfe77('0x9')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0xfe77('0x27')]);router[_0xfe77('0x9')](_0xfe77('0x28'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x29')]);router['get'](_0xfe77('0x2a'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x2b')]);router[_0xfe77('0x9')](_0xfe77('0x2c'),auth[_0xfe77('0xa')](),controller['getTeams']);router['get'](_0xfe77('0x2d'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x2e')]);router[_0xfe77('0x9')]('/:id/agents',auth[_0xfe77('0xa')](),controller[_0xfe77('0x2f')]);router[_0xfe77('0x9')](_0xfe77('0x30'),auth[_0xfe77('0xa')](),controller['getVoicePrefixes']);router[_0xfe77('0x9')](_0xfe77('0x31'),auth['isAuthenticated'](),controller[_0xfe77('0x32')]);router[_0xfe77('0x9')](_0xfe77('0x33'),auth[_0xfe77('0xa')](),controller['getMailAccounts']);router['get']('/:id/openchannel_accounts',auth[_0xfe77('0xa')](),controller[_0xfe77('0x34')]);router[_0xfe77('0x9')](_0xfe77('0x35'),auth['isAuthenticated'](),controller[_0xfe77('0x36')]);router[_0xfe77('0x9')](_0xfe77('0x37'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x38')]);router['get'](_0xfe77('0x39'),auth[_0xfe77('0xa')](),controller['getWhatsappAccounts']);router[_0xfe77('0x9')]('/:id/square_projects',auth['isAuthenticated'](),controller['getSquareProjects']);router['get']('/:id/scheduled_calls',auth[_0xfe77('0xa')](),controller[_0xfe77('0x3a')]);router[_0xfe77('0x9')](_0xfe77('0x3b'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x3c')]);router[_0xfe77('0x3d')](_0xfe77('0x17'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x3e')]);router[_0xfe77('0x3d')]('/',auth[_0xfe77('0xa')](),controller[_0xfe77('0x3f')]);router[_0xfe77('0x3d')](_0xfe77('0x40'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0xfe77('0x3d')](_0xfe77('0x19'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x41')]);var upload=multer({'storage':multer[_0xfe77('0x42')]({'destination':function(_0x40d8b2,_0x1daa0d,_0x3f373b){_0x3f373b(null,path['join'](config[_0xfe77('0x43')],_0xfe77('0x44')));},'filename':function(_0x2ab16f,_0x475259,_0x5042de){_0x5042de(null,util[_0xfe77('0x45')](_0xfe77('0x46'),Date[_0xfe77('0x47')](),_0x475259[_0xfe77('0x48')]));}})});router[_0xfe77('0x3d')](_0xfe77('0x13'),upload[_0xfe77('0x49')](_0xfe77('0x4a')),controller['addAvatar']);router['post'](_0xfe77('0x4b'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x4c')]);router['post'](_0xfe77('0x4d'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x4e')]);router[_0xfe77('0x3d')]('/:id/pause',auth[_0xfe77('0xa')](),controller[_0xfe77('0x4f')]);router[_0xfe77('0x3d')](_0xfe77('0x50'),auth[_0xfe77('0xa')](),controller['unpause']);router['post']('/:id/teams',auth[_0xfe77('0xa')](),controller['addTeams']);router[_0xfe77('0x3d')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0xfe77('0x51')]);router[_0xfe77('0x3d')](_0xfe77('0x52'),auth['isAuthenticated'](),controller[_0xfe77('0x53')]);router[_0xfe77('0x3d')](_0xfe77('0x54'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x55')]);router[_0xfe77('0x3d')]('/:id/sms_interactions',auth[_0xfe77('0xa')](),controller[_0xfe77('0x56')]);router['post'](_0xfe77('0x57'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x58')]);router['post'](_0xfe77('0x59'),auth['isAuthenticated'](),controller[_0xfe77('0x5a')]);router[_0xfe77('0x3d')](_0xfe77('0x31'),auth[_0xfe77('0xa')](),controller['addFaxAccounts']);router['post'](_0xfe77('0x33'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x5b')]);router['post'](_0xfe77('0x5c'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x5d')]);router[_0xfe77('0x3d')](_0xfe77('0x35'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x5e')]);router[_0xfe77('0x3d')](_0xfe77('0x37'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x5f')]);router[_0xfe77('0x3d')](_0xfe77('0x39'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x60')]);router[_0xfe77('0x3d')](_0xfe77('0x61'),auth[_0xfe77('0xa')](),controller['addSquareProjects']);router[_0xfe77('0x3d')]('/:id/api_key',auth[_0xfe77('0xa')](),controller[_0xfe77('0x62')]);router[_0xfe77('0x63')]('/:id',auth[_0xfe77('0xa')](),controller[_0xfe77('0x64')]);router[_0xfe77('0x63')](_0xfe77('0x65'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x66')]);router['delete'](_0xfe77('0x19'),auth['isAuthenticated'](),controller[_0xfe77('0x67')]);router['delete']('/:id/teams',auth[_0xfe77('0xa')](),controller[_0xfe77('0x68')]);router[_0xfe77('0x69')](_0xfe77('0x12'),auth[_0xfe77('0xa')](),controller['destroy']);router[_0xfe77('0x69')](_0xfe77('0x6a'),auth['isAuthenticated'](),controller[_0xfe77('0x6b')]);router[_0xfe77('0x69')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xfe77('0x6c')]);router['delete'](_0xfe77('0x54'),auth['isAuthenticated'](),controller[_0xfe77('0x6d')]);router[_0xfe77('0x69')](_0xfe77('0x6e'),auth['isAuthenticated'](),controller[_0xfe77('0x6f')]);router[_0xfe77('0x69')]('/:id/openchannel_interactions',auth[_0xfe77('0xa')](),controller['removeOpenchannelInteractions']);router['delete'](_0xfe77('0x59'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x70')]);router[_0xfe77('0x69')](_0xfe77('0x31'),auth['isAuthenticated'](),controller[_0xfe77('0x71')]);router[_0xfe77('0x69')](_0xfe77('0x33'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x72')]);router[_0xfe77('0x69')](_0xfe77('0x5c'),auth[_0xfe77('0xa')](),controller['removeOpenchannelAccounts']);router['delete']('/:id/sms_accounts',auth[_0xfe77('0xa')](),controller['removeSmsAccounts']);router[_0xfe77('0x69')](_0xfe77('0x37'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x73')]);router[_0xfe77('0x69')](_0xfe77('0x39'),auth[_0xfe77('0xa')](),controller[_0xfe77('0x74')]);router[_0xfe77('0x69')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0xfe77('0x75')]);router[_0xfe77('0x69')](_0xfe77('0x3b'),auth['isAuthenticated'](),controller[_0xfe77('0x76')]);module['exports']=router; \ No newline at end of file +var _0x5b9b=['removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','index','/describe','describe','/whoami','isAuthenticated','whoami','/presence','/:id','show','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getSquareProjects','/:id/scheduled_calls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','root','server/files/images/','format','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b9b,0x7f));var _0xb5b9=function(_0x5836ec,_0x5a5a4b){_0x5836ec=_0x5836ec-0x0;var _0x5070b5=_0x5b9b[_0x5836ec];return _0x5070b5;};'use strict';var multer=require(_0xb5b9('0x0'));var util=require('util');var path=require(_0xb5b9('0x1'));var timeout=require(_0xb5b9('0x2'));var express=require(_0xb5b9('0x3'));var router=express[_0xb5b9('0x4')]();var fs_extra=require(_0xb5b9('0x5'));var auth=require(_0xb5b9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb5b9('0x7'));var controller=require(_0xb5b9('0x8'));router[_0xb5b9('0x9')]('/',auth['isAuthenticated'](),controller[_0xb5b9('0xa')]);router[_0xb5b9('0x9')](_0xb5b9('0xb'),auth['isAuthenticated'](),controller[_0xb5b9('0xc')]);router[_0xb5b9('0x9')](_0xb5b9('0xd'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0xf')]);router[_0xb5b9('0x9')](_0xb5b9('0x10'),auth['isAuthenticated'](),controller['getPresence']);router['get'](_0xb5b9('0x11'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x12')]);router['get']('/:id/avatar',controller[_0xb5b9('0x13')]);router[_0xb5b9('0x9')]('/:id/open_tabs',auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x14')]);router['get'](_0xb5b9('0x15'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x16')]);router[_0xb5b9('0x9')](_0xb5b9('0x17'),auth['isAuthenticated'](),controller[_0xb5b9('0x18')]);router[_0xb5b9('0x9')](_0xb5b9('0x19'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x1a')]);router[_0xb5b9('0x9')]('/:id/groups',auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x1b')]);router['get'](_0xb5b9('0x1c'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x1d')]);router[_0xb5b9('0x9')](_0xb5b9('0x1e'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x1f')]);router['get'](_0xb5b9('0x20'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x21')]);router['get'](_0xb5b9('0x22'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x23')]);router[_0xb5b9('0x9')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0xb5b9('0x24')]);router[_0xb5b9('0x9')](_0xb5b9('0x25'),auth['isAuthenticated'](),controller[_0xb5b9('0x26')]);router['get']('/:id/fax/interactions',auth[_0xb5b9('0xe')](),controller['getFaxInteractions']);router[_0xb5b9('0x9')](_0xb5b9('0x27'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x28')]);router[_0xb5b9('0x9')](_0xb5b9('0x29'),auth[_0xb5b9('0xe')](),controller['getTeams']);router[_0xb5b9('0x9')](_0xb5b9('0x2a'),auth[_0xb5b9('0xe')](),controller['getLists']);router[_0xb5b9('0x9')](_0xb5b9('0x2b'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x2c')]);router[_0xb5b9('0x9')](_0xb5b9('0x2d'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x2e')]);router[_0xb5b9('0x9')](_0xb5b9('0x2f'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x30')]);router[_0xb5b9('0x9')](_0xb5b9('0x31'),auth[_0xb5b9('0xe')](),controller['getMailAccounts']);router[_0xb5b9('0x9')](_0xb5b9('0x32'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x33')]);router[_0xb5b9('0x9')](_0xb5b9('0x34'),auth['isAuthenticated'](),controller[_0xb5b9('0x35')]);router[_0xb5b9('0x9')]('/:id/chat_websites',auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x36')]);router[_0xb5b9('0x9')](_0xb5b9('0x37'),auth[_0xb5b9('0xe')](),controller['getWhatsappAccounts']);router['get']('/:id/square_projects',auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x38')]);router[_0xb5b9('0x9')](_0xb5b9('0x39'),auth[_0xb5b9('0xe')](),controller['getScheduledCalls']);router[_0xb5b9('0x9')](_0xb5b9('0x3a'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x3b')]);router[_0xb5b9('0x3c')](_0xb5b9('0x15'),auth['isAuthenticated'](),controller[_0xb5b9('0x3d')]);router['post']('/',auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x3e')]);router[_0xb5b9('0x3c')](_0xb5b9('0x3f'),auth[_0xb5b9('0xe')](),controller['bulkCreate']);router[_0xb5b9('0x3c')]('/:id/queues',auth[_0xb5b9('0xe')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x18b3e2,_0x144c26,_0x57594d){_0x57594d(null,path['join'](config[_0xb5b9('0x40')],_0xb5b9('0x41')));},'filename':function(_0xc4821c,_0x476b10,_0x9794b2){_0x9794b2(null,util[_0xb5b9('0x42')]('%s-%s',Date['now'](),_0x476b10[_0xb5b9('0x43')]));}})});router[_0xb5b9('0x3c')]('/:id/avatar',upload[_0xb5b9('0x44')](_0xb5b9('0x45')),controller[_0xb5b9('0x46')]);router[_0xb5b9('0x3c')](_0xb5b9('0x47'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x48')]);router[_0xb5b9('0x3c')](_0xb5b9('0x49'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x4a')]);router['post'](_0xb5b9('0x4b'),auth[_0xb5b9('0xe')](),controller['pause']);router[_0xb5b9('0x3c')](_0xb5b9('0x4c'),auth['isAuthenticated'](),controller[_0xb5b9('0x4d')]);router[_0xb5b9('0x3c')]('/:id/teams',auth['isAuthenticated'](),controller[_0xb5b9('0x4e')]);router[_0xb5b9('0x3c')](_0xb5b9('0x4f'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x50')]);router['post']('/:id/mail_interactions',auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x51')]);router[_0xb5b9('0x3c')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xb5b9('0x52')]);router[_0xb5b9('0x3c')](_0xb5b9('0x53'),auth['isAuthenticated'](),controller[_0xb5b9('0x54')]);router[_0xb5b9('0x3c')]('/:id/openchannel_interactions',auth[_0xb5b9('0xe')](),controller['addOpenchannelInteractions']);router[_0xb5b9('0x3c')](_0xb5b9('0x55'),auth['isAuthenticated'](),controller[_0xb5b9('0x56')]);router[_0xb5b9('0x3c')](_0xb5b9('0x2f'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x57')]);router[_0xb5b9('0x3c')](_0xb5b9('0x31'),auth['isAuthenticated'](),controller['addMailAccounts']);router[_0xb5b9('0x3c')]('/:id/openchannel_accounts',auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x58')]);router[_0xb5b9('0x3c')](_0xb5b9('0x34'),auth['isAuthenticated'](),controller[_0xb5b9('0x59')]);router[_0xb5b9('0x3c')](_0xb5b9('0x5a'),auth[_0xb5b9('0xe')](),controller['addChatWebsites']);router[_0xb5b9('0x3c')](_0xb5b9('0x37'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x5b')]);router[_0xb5b9('0x3c')](_0xb5b9('0x5c'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x5d')]);router['post']('/:id/api_key',auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x5e')]);router[_0xb5b9('0x5f')]('/:id',auth['isAuthenticated'](),controller[_0xb5b9('0x60')]);router[_0xb5b9('0x5f')](_0xb5b9('0x61'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x62')]);router['delete'](_0xb5b9('0x17'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x63')]);router[_0xb5b9('0x64')](_0xb5b9('0x29'),auth['isAuthenticated'](),controller[_0xb5b9('0x65')]);router[_0xb5b9('0x64')](_0xb5b9('0x11'),auth['isAuthenticated'](),controller[_0xb5b9('0x66')]);router[_0xb5b9('0x64')](_0xb5b9('0x4f'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x67')]);router[_0xb5b9('0x64')](_0xb5b9('0x68'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x69')]);router['delete'](_0xb5b9('0x6a'),auth['isAuthenticated'](),controller[_0xb5b9('0x6b')]);router['delete'](_0xb5b9('0x53'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x6c')]);router['delete']('/:id/openchannel_interactions',auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x6d')]);router['delete'](_0xb5b9('0x55'),auth[_0xb5b9('0xe')](),controller['removeWhatsappInteractions']);router[_0xb5b9('0x64')](_0xb5b9('0x2f'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x6e')]);router['delete'](_0xb5b9('0x31'),auth['isAuthenticated'](),controller[_0xb5b9('0x6f')]);router[_0xb5b9('0x64')](_0xb5b9('0x32'),auth[_0xb5b9('0xe')](),controller['removeOpenchannelAccounts']);router[_0xb5b9('0x64')]('/:id/sms_accounts',auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x70')]);router[_0xb5b9('0x64')](_0xb5b9('0x5a'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x71')]);router[_0xb5b9('0x64')](_0xb5b9('0x37'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x72')]);router[_0xb5b9('0x64')](_0xb5b9('0x5c'),auth[_0xb5b9('0xe')](),controller[_0xb5b9('0x73')]);router[_0xb5b9('0x64')](_0xb5b9('0x3a'),auth['isAuthenticated'](),controller[_0xb5b9('0x74')]);module[_0xb5b9('0x75')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 0fd89c1..8d156a3 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 _0x5785=['loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','callerid','format','getDataValue','email','ENUM','admin','user','agent','telephone','local','INTEGER','internal','accountcode','\x22%s\x22\x20<%s>','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','udp','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','nonat','outgoing','force_rport,comedia','join','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','accept','originate','uas','fingerprint','certificate','active','passive','actpass','update','update,nonat','showWebBar','wss','encryption','avpf','force_avp','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','dtlscertfile','/etc/pki/tls/certs/motion.crt','TEXT','permissions','map','split','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x5785,0x119));var _0x5578=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x5785[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x5578('0x0'));var moment=require(_0x5578('0x1'));var util=require(_0x5578('0x2'));var _=require(_0x5578('0x3'));module[_0x5578('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5578('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2a3b8a){this[_0x5578('0x6')](_0x5578('0x5'),_0x2a3b8a);this[_0x5578('0x6')](_0x5578('0x7'),_0x2a3b8a);},'comment':_0x5578('0x8')},'fullname':{'type':Sequelize[_0x5578('0x9')],'allowNull':![],'set':function(_0x464ab2){this[_0x5578('0x6')]('fullname',_0x464ab2);this[_0x5578('0x6')](_0x5578('0xa'),util[_0x5578('0xb')]('\x22%s\x22\x20<%s>',_0x464ab2,this[_0x5578('0xc')]('internal')));}},'alias':{'type':Sequelize[_0x5578('0x9')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5578('0xd'),'validate':{'isEmail':!![]},'set':function(_0x3fcf85){if(_0x3fcf85){this[_0x5578('0x6')]('email',_0x3fcf85['toLowerCase']());}}},'role':{'type':Sequelize[_0x5578('0xe')](_0x5578('0xf'),_0x5578('0x10'),_0x5578('0x11'),_0x5578('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x5578('0x9')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x5578('0x9')],'defaultValue':_0x5578('0x13')},'internal':{'type':Sequelize[_0x5578('0x14')](0xb),'allowNull':![],'unique':_0x5578('0x15'),'set':function(_0x4f6d2a){this[_0x5578('0x6')](_0x5578('0x15'),_0x4f6d2a);this[_0x5578('0x6')](_0x5578('0x16'),_0x4f6d2a);this[_0x5578('0x6')](_0x5578('0xa'),util[_0x5578('0xb')](_0x5578('0x17'),this[_0x5578('0xc')](_0x5578('0x18')),_0x4f6d2a));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x5578('0x9')]},'mobile':{'type':Sequelize[_0x5578('0x9')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x5578('0x9')]},'city':{'type':Sequelize[_0x5578('0x9')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x5578('0x1a')]},'voicePause':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x5578('0x9')],'defaultValue':_0x5578('0x1b')},'lastPauseAt':{'type':Sequelize[_0x5578('0x1a')]},'chatCapacity':{'type':Sequelize[_0x5578('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x5578('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x5578('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x5578('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x5578('0x19')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x5578('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x5578('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x5578('0x1c')},'ipaddr':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'port':{'type':Sequelize[_0x5578('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x5578('0xe')](_0x5578('0x1d'),_0x5578('0x10'),_0x5578('0x1e')),'allowNull':!![],'defaultValue':_0x5578('0x1d')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x5578('0x1f')},'callingpres':{'type':Sequelize[_0x5578('0xe')](_0x5578('0x20'),_0x5578('0x21'),_0x5578('0x22'),_0x5578('0x23'),_0x5578('0x24'),_0x5578('0x25'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x5578('0x26'),'set':function(_0x30af8a){this[_0x5578('0x6')](_0x5578('0x27'),_0x30af8a?_0x30af8a['join'](','):null);},'get':function(){return this[_0x5578('0xc')](_0x5578('0x27'))?this[_0x5578('0xc')](_0x5578('0x27'))['split'](','):null;},'comment':_0x5578('0x28')},'dtmfmode':{'type':Sequelize[_0x5578('0xe')](_0x5578('0x29'),'info',_0x5578('0x2a'),_0x5578('0x2b'),'auto'),'allowNull':!![],'defaultValue':_0x5578('0x29')},'directmedia':{'type':Sequelize['ENUM'](_0x5578('0x2c'),'no',_0x5578('0x2d'),'update',_0x5578('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5578('0xe')](_0x5578('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![],'defaultValue':_0x5578('0x2f'),'set':function(_0x4772ff){this[_0x5578('0x6')]('nat',_0x4772ff?_0x4772ff[_0x5578('0x30')](','):null);},'get':function(){return this[_0x5578('0xc')](_0x5578('0x31'))?this['getDataValue'](_0x5578('0x31'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x5578('0x9')]},'namedcallgroup':{'type':Sequelize[_0x5578('0x9')]},'pickupgroup':{'type':Sequelize[_0x5578('0x9')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x5578('0x9')]},'disallow':{'type':Sequelize[_0x5578('0x9')],'allowNull':![],'defaultValue':_0x5578('0x32')},'allow':{'type':Sequelize[_0x5578('0x9')],'allowNull':![],'defaultValue':_0x5578('0x33'),'set':function(_0x5a3c64){this['setDataValue'](_0x5578('0x34'),_0x5a3c64?_0x5a3c64['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x5578('0xc')](_0x5578('0x34'))?this[_0x5578('0xc')](_0x5578('0x34'))['split'](';'):null;},'comment':_0x5578('0x35')},'autoframing':{'type':Sequelize[_0x5578('0xe')](_0x5578('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![],'set':function(_0x264bf8){this['setDataValue'](_0x5578('0x36'),_0x264bf8?_0x264bf8[_0x5578('0x30')](','):null);},'get':function(){return this['getDataValue'](_0x5578('0x36'))?this[_0x5578('0xc')](_0x5578('0x36'))['split'](','):null;},'comment':_0x5578('0x37')},'trustrpid':{'type':Sequelize[_0x5578('0xe')](_0x5578('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5578('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5578('0xe')](_0x5578('0x2c'),'no',_0x5578('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x5578('0xe')](_0x5578('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![],'defaultValue':_0x5578('0x39')},'amaflags':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x5578('0xe')](_0x5578('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x5578('0x2c')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x5578('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x5578('0xe')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x5578('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x5578('0xe')](_0x5578('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'template':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x5578('0xe')]('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5578('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x5578('0xe')](_0x5578('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x5578('0xe')](_0x5578('0x3a'),'refuse',_0x5578('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x5578('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x5578('0x3c')),'allowNull':!![],'defaultValue':_0x5578('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x5578('0xe')](_0x5578('0x2c'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x5578('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x5578('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x5578('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x5578('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x5578('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x5578('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x5578('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x5578('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x5578('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x5578('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x5578('0xe')](_0x5578('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x5578('0xe')](_0x5578('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x5578('0xe')](_0x5578('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x5578('0xe')]('yes','no',_0x5578('0x3d'),_0x5578('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x5578('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x5578('0xe')](_0x5578('0x3f'),_0x5578('0x40'),_0x5578('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x5578('0xe')](_0x5578('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x5578('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x5578('0xe')](_0x5578('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x5578('0x2c'),'no',_0x5578('0x2d'),_0x5578('0x42'),_0x5578('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x5578('0x9')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x5578('0x1a')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x5578('0x14')],'defaultValue':0x0,'set':function(_0x43aa25){this[_0x5578('0x6')](_0x5578('0x44'),_0x43aa25);var _0xd69f9=this['get']({'plain':!![]});switch(_0x43aa25){case 0x0:case 0x1:var _0x3a3137=_0xd69f9['transport']?_['isArray'](_0xd69f9[_0x5578('0x27')])?_0xd69f9[_0x5578('0x27')][_0x5578('0x30')]():_0xd69f9['transport']:_0x5578('0x26');if(_0x3a3137===_0x5578('0x45')){_0x3a3137=_0x5578('0x26');}this[_0x5578('0x6')]('transport',_0x3a3137);this['setDataValue'](_0x5578('0x46'),'no');this[_0x5578('0x6')](_0x5578('0x47'),null);this['setDataValue'](_0x5578('0x48'),null);this[_0x5578('0x6')]('icesupport',null);this[_0x5578('0x6')]('dtlsenable',null);this[_0x5578('0x6')](_0x5578('0x49'),null);this[_0x5578('0x6')](_0x5578('0x4a'),null);this[_0x5578('0x6')]('dtlscertfile',null);this[_0x5578('0x6')](_0x5578('0x4b'),null);this[_0x5578('0x6')](_0x5578('0x4c'),'no');break;case 0x2:this['setDataValue'](_0x5578('0x27'),_0x5578('0x45'));this['setDataValue'](_0x5578('0x46'),_0x5578('0x2c'));this[_0x5578('0x6')]('avpf',_0x5578('0x2c'));this[_0x5578('0x6')](_0x5578('0x48'),_0x5578('0x2c'));this[_0x5578('0x6')]('icesupport',_0x5578('0x2c'));this[_0x5578('0x6')]('dtlsenable','yes');this[_0x5578('0x6')](_0x5578('0x49'),'no');this[_0x5578('0x6')](_0x5578('0x4a'),_0x5578('0x41'));this[_0x5578('0x6')]('dtlscertfile',_0xd69f9[_0x5578('0x4d')]||_0x5578('0x4e'));this[_0x5578('0x6')]('dtlsprivatekey',_0xd69f9['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0x5578('0x6')](_0x5578('0x4c'),_0x5578('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0x5578('0x4f')],'set':function(_0x2eafb4){this[_0x5578('0x6')](_0x5578('0x50'),_0x2eafb4?_0x2eafb4[_0x5578('0x30')](','):[]);},'get':function(){return this[_0x5578('0xc')](_0x5578('0x50'))?_[_0x5578('0x51')](this[_0x5578('0xc')]('permissions')[_0x5578('0x52')](','),function(_0x1b53c6){return parseInt(_0x1b53c6,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x5578('0x9')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x5578('0x9')]},'phoneBarBusyNumber':{'type':Sequelize[_0x5578('0x9')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x5578('0x19')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x5578('0x19')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x5578('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x5578('0x9')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x5578('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x5578('0x19')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x5578('0x53')],'get':function(){return this[_0x5578('0xc')](_0x5578('0x54'))?this[_0x5578('0xc')](_0x5578('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![]},'interface':{'type':Sequelize[_0x5578('0x9')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x5578('0x9')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![],'set':function(_0x39a500){if(typeof _0x39a500===_0x5578('0x55')){var _0x2c0c9e=_0x39a500==='1'?!![]:_0x39a500==='0'?![]:_0x39a500===_0x5578('0x56')?!![]:_0x39a500===_0x5578('0x57')?![]:![];this['setDataValue'](_0x5578('0x58'),_0x2c0c9e);}else{this['setDataValue'](_0x5578('0x58'),_0x39a500);}}},'blocked':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![],'set':function(_0x4661ec){this[_0x5578('0x6')](_0x5578('0x59'),_0x4661ec);if(_0x4661ec===!![]){this['setDataValue'](_0x5578('0x5a'),moment());this[_0x5578('0x6')](_0x5578('0x5b'),0x0);}else{this['setDataValue'](_0x5578('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0x5578('0x1a')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x5578('0x19')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x5578('0x19')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x5578('0x14')](0x5)[_0x5578('0x5c')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x5578('0x19')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5578('0x19')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5578('0x19')],'defaultValue':!![]}}; \ No newline at end of file +var _0x34f2=['local','INTEGER','internal','callerid','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','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','split','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','accept','refuse','uac','uas','fingerprint','active','passive','actpass','update,nonat','TEXT','showWebBar','isArray','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','encryption','avpf','icesupport','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','false','screenrecording','loginAttempts','blockedAt','UNSIGNED','sequelize','moment','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','email','toLowerCase','ENUM','admin','user','telephone'];(function(_0x182058,_0x4132cd){var _0x5c9939=function(_0x332226){while(--_0x332226){_0x182058['push'](_0x182058['shift']());}};_0x5c9939(++_0x4132cd);}(_0x34f2,0x15a));var _0x234f=function(_0x407385,_0x40f76b){_0x407385=_0x407385-0x0;var _0x4f15d2=_0x34f2[_0x407385];return _0x4f15d2;};'use strict';var Sequelize=require(_0x234f('0x0'));var moment=require(_0x234f('0x1'));var util=require('util');var _=require(_0x234f('0x2'));module[_0x234f('0x3')]={'name':{'type':Sequelize[_0x234f('0x4')],'allowNull':![],'unique':_0x234f('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3957a0){this[_0x234f('0x6')](_0x234f('0x5'),_0x3957a0);this[_0x234f('0x6')](_0x234f('0x7'),_0x3957a0);},'comment':_0x234f('0x8')},'fullname':{'type':Sequelize[_0x234f('0x4')],'allowNull':![],'set':function(_0x254f37){this[_0x234f('0x6')](_0x234f('0x9'),_0x254f37);this[_0x234f('0x6')]('callerid',util[_0x234f('0xa')](_0x234f('0xb'),_0x254f37,this['getDataValue']('internal')));}},'alias':{'type':Sequelize[_0x234f('0x4')]},'email':{'type':Sequelize[_0x234f('0x4')],'allowNull':![],'unique':_0x234f('0xc'),'validate':{'isEmail':!![]},'set':function(_0x362ec1){if(_0x362ec1){this[_0x234f('0x6')]('email',_0x362ec1[_0x234f('0xd')]());}}},'role':{'type':Sequelize[_0x234f('0xe')](_0x234f('0xf'),_0x234f('0x10'),'agent',_0x234f('0x11')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x234f('0x4')],'defaultValue':_0x234f('0x12')},'internal':{'type':Sequelize[_0x234f('0x13')](0xb),'allowNull':![],'unique':_0x234f('0x14'),'set':function(_0x2fea04){this[_0x234f('0x6')](_0x234f('0x14'),_0x2fea04);this['setDataValue']('accountcode',_0x2fea04);this[_0x234f('0x6')](_0x234f('0x15'),util['format'](_0x234f('0xb'),this[_0x234f('0x16')](_0x234f('0x9')),_0x2fea04));}},'salt':{'type':Sequelize[_0x234f('0x4')]},'phone':{'type':Sequelize[_0x234f('0x4')]},'mobile':{'type':Sequelize[_0x234f('0x4')]},'address':{'type':Sequelize[_0x234f('0x4')]},'zipcode':{'type':Sequelize[_0x234f('0x4')]},'userpic':{'type':Sequelize[_0x234f('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x234f('0x4')]},'online':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x234f('0x18')]},'voicePause':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x234f('0x19')},'lastPauseAt':{'type':Sequelize[_0x234f('0x18')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x234f('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x234f('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x234f('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x234f('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x234f('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x234f('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x234f('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x234f('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![],'defaultValue':_0x234f('0x1a')},'ipaddr':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x234f('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x234f('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x234f('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x234f('0xe')]('friend',_0x234f('0x10'),_0x234f('0x1b')),'allowNull':!![],'defaultValue':_0x234f('0x1c')},'context':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![],'defaultValue':_0x234f('0x1d')},'callingpres':{'type':Sequelize[_0x234f('0xe')](_0x234f('0x1e'),_0x234f('0x1f'),_0x234f('0x20'),_0x234f('0x21'),'PROHIB_NOT_SCREENED',_0x234f('0x22'),'PROHIB_FAILED_SCREEN',_0x234f('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![],'defaultValue':_0x234f('0x24'),'set':function(_0x4b1198){this['setDataValue'](_0x234f('0x25'),_0x4b1198?_0x4b1198[_0x234f('0x26')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x234f('0x16')]('transport')['split'](','):null;},'comment':_0x234f('0x27')},'dtmfmode':{'type':Sequelize['ENUM'](_0x234f('0x28'),_0x234f('0x29'),_0x234f('0x2a'),_0x234f('0x2b'),_0x234f('0x2c')),'allowNull':!![],'defaultValue':_0x234f('0x28')},'directmedia':{'type':Sequelize[_0x234f('0xe')](_0x234f('0x2d'),'no',_0x234f('0x2e'),'update',_0x234f('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x234f('0xe')](_0x234f('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![],'defaultValue':_0x234f('0x30'),'set':function(_0x242d9e){this['setDataValue'](_0x234f('0x31'),_0x242d9e?_0x242d9e[_0x234f('0x26')](','):null);},'get':function(){return this[_0x234f('0x16')](_0x234f('0x31'))?this['getDataValue']('nat')['split'](','):null;},'comment':_0x234f('0x32')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x234f('0x4')]},'pickupgroup':{'type':Sequelize[_0x234f('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x234f('0x4')]},'language':{'type':Sequelize[_0x234f('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x234f('0x4')]},'disallow':{'type':Sequelize[_0x234f('0x4')],'allowNull':![],'defaultValue':_0x234f('0x33')},'allow':{'type':Sequelize[_0x234f('0x4')],'allowNull':![],'defaultValue':_0x234f('0x34'),'set':function(_0x19490d){this[_0x234f('0x6')](_0x234f('0x35'),_0x19490d?_0x19490d[_0x234f('0x26')](';'):_0x234f('0x34'));},'get':function(){return this[_0x234f('0x16')](_0x234f('0x35'))?this[_0x234f('0x16')](_0x234f('0x35'))[_0x234f('0x36')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x234f('0xe')](_0x234f('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![],'set':function(_0x272736){this[_0x234f('0x6')](_0x234f('0x37'),_0x272736?_0x272736[_0x234f('0x26')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x234f('0x16')]('insecure')[_0x234f('0x36')](','):null;},'comment':_0x234f('0x38')},'trustrpid':{'type':Sequelize[_0x234f('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x234f('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x234f('0xe')](_0x234f('0x2d'),'no',_0x234f('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x234f('0xe')](_0x234f('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x234f('0xe')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x234f('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![],'defaultValue':_0x234f('0x3a')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x234f('0xe')](_0x234f('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x234f('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x234f('0xe')](_0x234f('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x234f('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x234f('0xe')](_0x234f('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x234f('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x234f('0xe')](_0x234f('0x2d'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x234f('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x234f('0xe')](_0x234f('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x234f('0xe')](_0x234f('0x3b'),_0x234f('0x3c'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x234f('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x234f('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x234f('0xe')](_0x234f('0x3d'),_0x234f('0x3e')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x234f('0xe')](_0x234f('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x234f('0x2d')},'keepalive':{'type':Sequelize[_0x234f('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x234f('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x234f('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x234f('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x234f('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x234f('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x234f('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x234f('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x234f('0xe')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x234f('0xe')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x234f('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x234f('0xe')](_0x234f('0x2d'),'no',_0x234f('0x3f'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x234f('0xe')](_0x234f('0x40'),_0x234f('0x41'),_0x234f('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x234f('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x234f('0xe')](_0x234f('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x234f('0xe')](_0x234f('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x234f('0xe')]('yes','no',_0x234f('0x2e'),'update',_0x234f('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x234f('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x234f('0x18')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x234f('0x44')]},'showWebBar':{'type':Sequelize[_0x234f('0x13')],'defaultValue':0x0,'set':function(_0x229c4d){this[_0x234f('0x6')](_0x234f('0x45'),_0x229c4d);var _0x5422b2=this['get']({'plain':!![]});switch(_0x229c4d){case 0x0:case 0x1:var _0x13162c=_0x5422b2[_0x234f('0x25')]?_[_0x234f('0x46')](_0x5422b2[_0x234f('0x25')])?_0x5422b2['transport']['join']():_0x5422b2[_0x234f('0x25')]:_0x234f('0x24');if(_0x13162c==='wss'){_0x13162c=_0x234f('0x24');}this[_0x234f('0x6')](_0x234f('0x25'),_0x13162c);this[_0x234f('0x6')]('encryption','no');this[_0x234f('0x6')]('avpf',null);this[_0x234f('0x6')]('force_avp',null);this['setDataValue']('icesupport',null);this['setDataValue'](_0x234f('0x47'),null);this[_0x234f('0x6')](_0x234f('0x48'),null);this[_0x234f('0x6')](_0x234f('0x49'),null);this[_0x234f('0x6')](_0x234f('0x4a'),null);this[_0x234f('0x6')](_0x234f('0x4b'),null);this['setDataValue'](_0x234f('0x4c'),'no');break;case 0x2:this[_0x234f('0x6')](_0x234f('0x25'),_0x234f('0x4d'));this[_0x234f('0x6')](_0x234f('0x4e'),'yes');this[_0x234f('0x6')](_0x234f('0x4f'),_0x234f('0x2d'));this[_0x234f('0x6')]('force_avp',_0x234f('0x2d'));this['setDataValue'](_0x234f('0x50'),_0x234f('0x2d'));this[_0x234f('0x6')](_0x234f('0x47'),_0x234f('0x2d'));this[_0x234f('0x6')]('dtlsverify','no');this['setDataValue'](_0x234f('0x49'),_0x234f('0x42'));this['setDataValue'](_0x234f('0x4a'),_0x5422b2[_0x234f('0x4a')]||_0x234f('0x51'));this[_0x234f('0x6')]('dtlsprivatekey',_0x5422b2[_0x234f('0x4b')]||_0x234f('0x52'));this[_0x234f('0x6')](_0x234f('0x4c'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x234f('0x44')],'set':function(_0x481a7e){this['setDataValue'](_0x234f('0x53'),_0x481a7e?_0x481a7e[_0x234f('0x26')](','):[]);},'get':function(){return this[_0x234f('0x16')](_0x234f('0x53'))?_[_0x234f('0x54')](this[_0x234f('0x16')](_0x234f('0x53'))[_0x234f('0x36')](','),function(_0x152b90){return parseInt(_0x152b90,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x234f('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x234f('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x234f('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x234f('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x234f('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x234f('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x234f('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x234f('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x234f('0xe')](_0x234f('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x234f('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x234f('0x55')],'get':function(){return this[_0x234f('0x16')]('phoneBarEnableScreenRecordingByAgent')?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x234f('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x234f('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![],'set':function(_0x4be778){if(typeof _0x4be778==='string'){var _0x268309=_0x4be778==='1'?!![]:_0x4be778==='0'?![]:_0x4be778==='true'?!![]:_0x4be778===_0x234f('0x56')?![]:![];this[_0x234f('0x6')]('screenrecording',_0x268309);}else{this[_0x234f('0x6')](_0x234f('0x57'),_0x4be778);}}},'blocked':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![],'set':function(_0x42514b){this[_0x234f('0x6')]('blocked',_0x42514b);if(_0x42514b===!![]){this['setDataValue']('blockedAt',moment());this[_0x234f('0x6')](_0x234f('0x58'),0x0);}else{this[_0x234f('0x6')](_0x234f('0x59'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x234f('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x234f('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x234f('0x13')](0x5)[_0x234f('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x234f('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x234f('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'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 e2b1a70..1640bf1 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 _0xee4e=['107','108','109','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','some','each','telephone','isEmpty','compact','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','interface','isValidChannel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','VoiceQueue','get','voice','format','SIP/%s','voicePause','upsert','removeQueues','remove','isArray','Queue:remove','UserVoiceQueueRt','addAvatar','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','userpic','download','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','SmsOpenTabs','SMS','WhatsappOpenTabs','getContacts','CmContact','order','sort','pick','CmList','Tag','Tags','color','tag','hasOwnProperty','nolimit','getQueues','Queue','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','concat','update','LOGININPAUSE','isMiddleware','pause','updateAttributes','forEach','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','set','%s%s','Pause','QueuePause','getTeams','Team','addTeams','getVoiceQueues','Voice','getChatQueues','setDataValue','Sms','getWhatsappQueues','Fax','Openchannel','flatten','transaction','getDataValue','removeTeams','Chat','getMailQueues','Mail','Whatsapp','getFaxQueues','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','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','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$or','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$notILike','$like','$contains','$contained','$any','CmHopper','firstName','lastName','Contact','dialActive','getApiKey','token','No\x20API\x20access\x20key\x20found!','generateApiKey','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','getPresence','resolve','queues','teams','inbound','lower','col','toString','asc','desc','substring','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','voiceStatus','slice','charAt','toUpperCase','select','ui.','field','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','moment','bluebird','util','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','./user.socket','register','defaults','localhost','http','request','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','offset','limit','count','destroy','role','admin','Users','user','Agents','agent','Telephones','ignore','value','includes','find','name','UserProfileResource','sendStatus','stack','send','index','User','rawAttributes','map','fieldName','type','key','filter','salt','where','query','includeAll','include','attributes','push','findAll','openTabs','true','chat','rows','sms','dataValues','fax','mail','openchannel','whatsapp','all','model','keys','password','filters','intersection','fields','length','merge','options','body','params','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','max','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','email','permissions','101','103','113','110','104','105'];(function(_0x4b1e6b,_0x4a42e8){var _0x515d94=function(_0x218e98){while(--_0x218e98){_0x4b1e6b['push'](_0x4b1e6b['shift']());}};_0x515d94(++_0x4a42e8);}(_0xee4e,0x122));var _0xeee4=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xee4e[_0x16d10f];return _0x50c823;};'use strict';var moment=require(_0xeee4('0x0'));var BPromise=require(_0xeee4('0x1'));var util=require(_0xeee4('0x2'));var path=require('path');var fs=require('fs');var _=require(_0xeee4('0x3'));var squel=require(_0xeee4('0x4'));var jayson=require(_0xeee4('0x5'));var Redis=require(_0xeee4('0x6'));var authService=require(_0xeee4('0x7'));var qs=require(_0xeee4('0x8'));var logger=require(_0xeee4('0x9'))(_0xeee4('0xa'));var utils=require('../../config/utils');var config=require(_0xeee4('0xb'));var licenseUtil=require(_0xeee4('0xc'));var db=require(_0xeee4('0xd'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xeee4('0xe')]));require(_0xeee4('0xf'))[_0xeee4('0x10')](socket);config['redis']=_[_0xeee4('0x11')](config[_0xeee4('0xe')],{'host':_0xeee4('0x12'),'port':0x18eb});var client=jayson['client'][_0xeee4('0x13')]({'port':0x232a});var values;function respondWithRpcPromise(_0x50d6f8,_0x1b1931,_0x2b25da,_0xd54ff2){return new BPromise(function(_0x51cf42,_0x203074){var _0xab281b=_0xd54ff2||client;return _0xab281b[_0xeee4('0x14')](_0x50d6f8,_0x2b25da)[_0xeee4('0x15')](function(_0x59921c){logger['info'](_0xeee4('0x16'),_0x1b1931,_0xeee4('0x17'));logger[_0xeee4('0x18')](_0xeee4('0x19'),_0x1b1931,_0xeee4('0x17'),JSON['stringify'](_0x59921c));if(_0x59921c['error']){if(_0x59921c[_0xeee4('0x1a')][_0xeee4('0x1b')]===0x1f4){logger[_0xeee4('0x1a')](_0xeee4('0x16'),_0x1b1931,_0x59921c[_0xeee4('0x1a')][_0xeee4('0x1c')]);return _0x203074(_0x59921c['error'][_0xeee4('0x1c')]);}logger['error'](_0xeee4('0x16'),_0x1b1931,_0x59921c['error'][_0xeee4('0x1c')]);return _0x51cf42(_0x59921c[_0xeee4('0x1a')][_0xeee4('0x1c')]);}else{logger['info'](_0xeee4('0x16'),_0x1b1931,_0xeee4('0x17'));_0x51cf42(_0x59921c[_0xeee4('0x1d')]['message']);}})[_0xeee4('0x1e')](function(_0x33765d){logger[_0xeee4('0x1a')](_0xeee4('0x16'),_0x1b1931,_0x33765d);_0x203074(_0x33765d);});});}function respondWithStatusCode(_0x5e4ac6,_0x378f92){_0x378f92=_0x378f92||0xcc;return function(_0x1e470d){if(_0x1e470d){return _0x5e4ac6['sendStatus'](_0x378f92);}return _0x5e4ac6[_0xeee4('0x1f')](_0x378f92)[_0xeee4('0x20')]();};}function respondWithResult(_0x24accf,_0x19af78){_0x19af78=_0x19af78||0xc8;return function(_0x4f457a){if(_0x4f457a){return _0x24accf[_0xeee4('0x1f')](_0x19af78)[_0xeee4('0x21')](_0x4f457a);}};}function respondWithFilteredResult(_0x28276e,_0x5623e6){return function(_0x497833){if(_0x497833){var _0x2c27e0=typeof _0x5623e6[_0xeee4('0x22')]==='undefined'&&typeof _0x5623e6[_0xeee4('0x23')]==='undefined';var _0x46a6e1=_0x497833[_0xeee4('0x24')];var _0x1e2b5b=_0x2c27e0?0x0:_0x5623e6[_0xeee4('0x22')];var _0x1f9e12=_0x2c27e0?_0x497833[_0xeee4('0x24')]:_0x5623e6[_0xeee4('0x22')]+_0x5623e6[_0xeee4('0x23')];var _0x2cdee7;if(_0x1f9e12>=_0x46a6e1){_0x1f9e12=_0x46a6e1;_0x2cdee7=0xc8;}else{_0x2cdee7=0xce;}_0x28276e[_0xeee4('0x1f')](_0x2cdee7);return _0x28276e['set']('Content-Range',_0x1e2b5b+'-'+_0x1f9e12+'/'+_0x46a6e1)[_0xeee4('0x21')](_0x497833);}return null;};}function saveUpdates(_0x249667){return function(_0x4f0873){if(_0x4f0873){return _0x4f0873['update'](_0x249667)[_0xeee4('0x15')](function(_0x348a72){return _0x348a72;});}return null;};}function removeEntity(_0x4b546e){return function(_0x463344){if(_0x463344){return _0x463344[_0xeee4('0x25')]()['then'](function(){var _0x5e5374=_0x463344['get']({'plain':!![]});if(_0x5e5374[_0xeee4('0x26')]===_0xeee4('0x27'))return;var _0x36f60e=[{'name':_0xeee4('0x28'),'value':_0xeee4('0x29'),'ignore':!![]},{'name':_0xeee4('0x2a'),'value':_0xeee4('0x2b'),'ignore':![]},{'name':_0xeee4('0x2c'),'value':'telephone','ignore':![]}];var _0x51971e=_(_0x36f60e)['filter'](_0xeee4('0x2d'))['map'](_0xeee4('0x2e'))[_0xeee4('0x2e')]();if(_[_0xeee4('0x2f')](_0x51971e,_0x5e5374[_0xeee4('0x26')])){return;}var _0x2366d9=_[_0xeee4('0x30')](_0x36f60e,[_0xeee4('0x2e'),_0x5e5374['role']])[_0xeee4('0x31')];return db[_0xeee4('0x32')]['destroy']({'where':{'type':_0x2366d9,'resourceId':_0x5e5374['id']}})['then'](function(){return _0x463344;});})[_0xeee4('0x15')](function(){_0x4b546e['status'](0xcc)[_0xeee4('0x20')]();});}};}function handleEntityNotFound(_0x307fe3){return function(_0x2f00a2){if(!_0x2f00a2){_0x307fe3[_0xeee4('0x33')](0x194);}return _0x2f00a2;};}function handleError(_0x565790,_0x567e71){_0x567e71=_0x567e71||0x1f4;return function(_0x136189){logger['error'](_0x136189[_0xeee4('0x34')]);if(_0x136189[_0xeee4('0x31')]){delete _0x136189[_0xeee4('0x31')];}_0x565790[_0xeee4('0x1f')](_0x567e71)[_0xeee4('0x35')](_0x136189);};}exports[_0xeee4('0x36')]=function(_0x5aa50e,_0x4567db){var _0x91f224={},_0x1f65c3={'count':0x0,'rows':[]};var _0x105ba8=_(db[_0xeee4('0x37')][_0xeee4('0x38')])[_0xeee4('0x39')](function(_0x5ceb9a){return{'name':_0x5ceb9a[_0xeee4('0x3a')],'type':_0x5ceb9a[_0xeee4('0x3b')][_0xeee4('0x3c')]};})[_0xeee4('0x3d')](function(_0x232831){return!_[_0xeee4('0x2f')](['password',_0xeee4('0x3e')],_0x232831['name']);})['value']();_0x91f224=qs['getOptions'](_0x105ba8,_0x5aa50e);var _0x17112f={'where':_0x91f224[_0xeee4('0x3f')]};return db['User'][_0xeee4('0x24')](_0x17112f)[_0xeee4('0x15')](function(_0x2b004a){_0x1f65c3[_0xeee4('0x24')]=_0x2b004a;if(_0x5aa50e[_0xeee4('0x40')][_0xeee4('0x41')]){_0x91f224[_0xeee4('0x42')]=[{'all':!![]}];}if(!_[_0xeee4('0x2f')](_0x91f224[_0xeee4('0x43')],'id')){_0x91f224[_0xeee4('0x43')][_0xeee4('0x44')]('id');}return db[_0xeee4('0x37')][_0xeee4('0x45')](_0x91f224);})[_0xeee4('0x15')](function(_0x3c8f84){_0x1f65c3['rows']=_0x3c8f84;if(_0x5aa50e['query'][_0xeee4('0x46')]===_0xeee4('0x47')){var _0x470c0f=[];for(var _0x37b06c=0x0;_0x37b06c<_0x1f65c3['rows']['length'];_0x37b06c++){_0x470c0f[_0xeee4('0x44')](get_open_tabs(_0xeee4('0x48'),_0x1f65c3[_0xeee4('0x49')][_0x37b06c]['dataValues']));_0x470c0f['push'](get_open_tabs(_0xeee4('0x4a'),_0x1f65c3[_0xeee4('0x49')][_0x37b06c][_0xeee4('0x4b')]));_0x470c0f[_0xeee4('0x44')](get_open_tabs(_0xeee4('0x4c'),_0x1f65c3[_0xeee4('0x49')][_0x37b06c][_0xeee4('0x4b')]));_0x470c0f[_0xeee4('0x44')](get_open_tabs(_0xeee4('0x4d'),_0x1f65c3[_0xeee4('0x49')][_0x37b06c][_0xeee4('0x4b')]));_0x470c0f[_0xeee4('0x44')](get_open_tabs(_0xeee4('0x4e'),_0x1f65c3[_0xeee4('0x49')][_0x37b06c][_0xeee4('0x4b')]));_0x470c0f[_0xeee4('0x44')](get_open_tabs(_0xeee4('0x4f'),_0x1f65c3[_0xeee4('0x49')][_0x37b06c][_0xeee4('0x4b')]));}return BPromise[_0xeee4('0x50')](_0x470c0f)['then'](function(_0xbd9f8a){return _0x1f65c3;});}else{return _0x1f65c3;}})['then'](respondWithFilteredResult(_0x4567db,_0x91f224))['catch'](handleError(_0x4567db,null));};exports['show']=function(_0x2e21ea,_0x44f746){var _0x54fcda={'raw':![],'where':{'id':_0x2e21ea['params']['id']}},_0x40ef92={};_0x40ef92[_0xeee4('0x51')]=_['differenceBy'](_[_0xeee4('0x52')](db[_0xeee4('0x37')][_0xeee4('0x38')]),[_0xeee4('0x53'),_0xeee4('0x3e')]);_0x40ef92[_0xeee4('0x40')]=_['keys'](_0x2e21ea[_0xeee4('0x40')]);_0x40ef92[_0xeee4('0x54')]=_[_0xeee4('0x55')](_0x40ef92[_0xeee4('0x51')],_0x40ef92[_0xeee4('0x40')]);_0x54fcda[_0xeee4('0x43')]=_['intersection'](_0x40ef92[_0xeee4('0x51')],qs[_0xeee4('0x56')](_0x2e21ea['query'][_0xeee4('0x56')]));_0x54fcda[_0xeee4('0x43')]=_0x54fcda[_0xeee4('0x43')][_0xeee4('0x57')]?_0x54fcda['attributes']:_0x40ef92[_0xeee4('0x51')];if(_0x2e21ea[_0xeee4('0x40')][_0xeee4('0x41')]){_0x54fcda['include']=[{'all':!![]}];}_0x54fcda=_[_0xeee4('0x58')]({},_0x54fcda,_0x2e21ea[_0xeee4('0x59')]);if(!_[_0xeee4('0x2f')](_0x54fcda['attributes'],'id')){_0x54fcda[_0xeee4('0x43')][_0xeee4('0x44')]('id');}return db[_0xeee4('0x37')][_0xeee4('0x30')](_0x54fcda)[_0xeee4('0x15')](handleEntityNotFound(_0x44f746,null))[_0xeee4('0x15')](function(_0x86fbc3){var _0x5b3a13=[];values=_0x86fbc3;if(_0x2e21ea[_0xeee4('0x40')]['openTabs']===_0xeee4('0x47')){_0x5b3a13[_0xeee4('0x44')](get_open_tabs('chat',_0x86fbc3[_0xeee4('0x4b')]));_0x5b3a13['push'](get_open_tabs(_0xeee4('0x4a'),_0x86fbc3[_0xeee4('0x4b')]));_0x5b3a13['push'](get_open_tabs(_0xeee4('0x4e'),_0x86fbc3[_0xeee4('0x4b')]));_0x5b3a13[_0xeee4('0x44')](get_open_tabs(_0xeee4('0x4f'),_0x86fbc3[_0xeee4('0x4b')]));_0x5b3a13[_0xeee4('0x44')](get_open_tabs('fax',_0x86fbc3[_0xeee4('0x4b')]));_0x5b3a13[_0xeee4('0x44')](get_open_tabs('mail',_0x86fbc3['dataValues']));return BPromise['all'](_0x5b3a13);}else{return values;}})['then'](function(_0x227d00){return values;})[_0xeee4('0x15')](respondWithResult(_0x44f746,null))[_0xeee4('0x1e')](handleError(_0x44f746,null));};exports['update']=function(_0x4910eb,_0x26b3f0){if(_0x4910eb[_0xeee4('0x5a')]['id']){delete _0x4910eb[_0xeee4('0x5a')]['id'];}delete _0x4910eb[_0xeee4('0x5a')]['role'];return db[_0xeee4('0x37')]['find']({'where':{'id':_0x4910eb[_0xeee4('0x5b')]['id']}})[_0xeee4('0x15')](handleEntityNotFound(_0x26b3f0,null))[_0xeee4('0x15')](saveUpdates(_0x4910eb[_0xeee4('0x5a')],null))[_0xeee4('0x15')](respondWithResult(_0x26b3f0,null))[_0xeee4('0x1e')](handleError(_0x26b3f0,null));};exports[_0xeee4('0x5c')]=function(_0x370034,_0x17265a){return db[_0xeee4('0x37')][_0xeee4('0x5c')]()['then'](respondWithResult(_0x17265a,null))[_0xeee4('0x1e')](handleError(_0x17265a,null));};exports[_0xeee4('0x5d')]=function(_0x457b2a,_0x7d09b6){return db[_0xeee4('0x37')][_0xeee4('0x30')]({'where':{'id':_0x457b2a[_0xeee4('0x5b')]['id']}})[_0xeee4('0x15')](handleEntityNotFound(_0x7d09b6,null))[_0xeee4('0x15')](function(_0x5af749){if(_0x5af749){return _0x5af749[_0xeee4('0x5d')](_0x457b2a[_0xeee4('0x5a')][_0xeee4('0x5e')],_[_0xeee4('0x5f')](_0x457b2a[_0xeee4('0x5a')],[_0xeee4('0x5e'),'id'])||{});}})[_0xeee4('0x15')](respondWithResult(_0x7d09b6,null))[_0xeee4('0x1e')](handleError(_0x7d09b6,null));};function validateUser(_0x5c562d){return new BPromise(function(_0x10e28e,_0x33ce03){if(_0x5c562d[_0xeee4('0x60')])return _0x10e28e(_0x5c562d);return db[_0xeee4('0x61')][_0xeee4('0x62')](0x1)[_0xeee4('0x15')](function(_0x73374d){if(_0x73374d[_0xeee4('0x63')])authService[_0xeee4('0x64')](_0x5c562d[_0xeee4('0x53')]);db[_0xeee4('0x37')][_0xeee4('0x65')](_0xeee4('0x60'))[_0xeee4('0x15')](function(_0x2f05a5){if(_[_0xeee4('0x66')](_0x2f05a5)){_0x5c562d[_0xeee4('0x60')]=_0x73374d['min_internal']||0x1;return;}if(_[_0xeee4('0x66')](_0x73374d['min_internal'])||_0x73374d[_0xeee4('0x67')]===_0x2f05a5){_0x5c562d[_0xeee4('0x60')]=_0x2f05a5+0x1;return;}if(_0x73374d[_0xeee4('0x67')]>_0x2f05a5){_0x5c562d['internal']=_0x73374d[_0xeee4('0x67')];return;}return db['sequelize']['query'](_0xeee4('0x68'),{'type':db[_0xeee4('0x69')][_0xeee4('0x6a')][_0xeee4('0x6b')]})[_0xeee4('0x15')](function(_0x4d4584){if(_0x4d4584&&_0x4d4584['length']){for(var _0x122fdd=0x0,_0x163b3e=_0x4d4584['length'];_0x122fdd<_0x163b3e&&_[_0xeee4('0x66')](_0x5c562d['internal']);_0x122fdd++){if(_0x73374d[_0xeee4('0x67')]<=_0x4d4584[_0x122fdd]['from']){_0x5c562d[_0xeee4('0x60')]=_0x4d4584[_0x122fdd][_0xeee4('0x6c')];}else if(_0x73374d[_0xeee4('0x67')]>_0x4d4584[_0x122fdd][_0xeee4('0x6c')]&&_0x73374d[_0xeee4('0x67')]<=_0x4d4584[_0x122fdd]['to']){_0x5c562d['internal']=_0x73374d['min_internal'];}}}if(_[_0xeee4('0x66')](_0x5c562d[_0xeee4('0x60')])){_0x5c562d[_0xeee4('0x60')]=_0x2f05a5+0x1;}return _0x10e28e(_0x5c562d);});});})[_0xeee4('0x1e')](function(_0x1f65a6){_0x33ce03(_0x1f65a6);});});}function updateUser(_0x486523){return new BPromise(function(_0x4887ca,_0x44d34e){try{if(_0x486523[_0xeee4('0x6d')]){_0x486523[_0xeee4('0x6e')]=_0x486523[_0xeee4('0x60')];_0x486523[_0xeee4('0x6f')]={'mailbox':_0x486523['internal'],'password':_0x486523[_0xeee4('0x53')],'fullname':_0x486523[_0xeee4('0x70')],'email':_0x486523[_0xeee4('0x71')]};}if(_0x486523[_0xeee4('0x26')]===_0xeee4('0x2b')){if(!_0x486523[_0xeee4('0x72')])_0x486523[_0xeee4('0x72')]=[_0xeee4('0x73'),'102',_0xeee4('0x74'),_0xeee4('0x75'),_0xeee4('0x76'),_0xeee4('0x77'),_0xeee4('0x78'),'106',_0xeee4('0x79'),_0xeee4('0x7a'),_0xeee4('0x7b'),_0xeee4('0x7c'),_0xeee4('0x7d'),_0xeee4('0x7e'),_0xeee4('0x7f')];}_0x4887ca(_0x486523);}catch(_0x41dfd5){_0x44d34e(_0x41dfd5);}});}exports[_0xeee4('0x80')]=function(_0x505c99,_0x380c59){if(_0x505c99[_0xeee4('0x29')]['role']==='agent')throw new Error(_0xeee4('0x81'));if(_0x505c99[_0xeee4('0x5a')][_0xeee4('0x26')]===_0xeee4('0x29')&&_0x505c99[_0xeee4('0x29')][_0xeee4('0x26')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x505c99['body']['role']===_0xeee4('0x27')&&_0x505c99[_0xeee4('0x29')][_0xeee4('0x26')]!==_0xeee4('0x27')){throw new Error(_0xeee4('0x82'));}return licenseUtil[_0xeee4('0x83')]([_0x505c99[_0xeee4('0x5a')]])[_0xeee4('0x15')](function(){return validateUser(_0x505c99[_0xeee4('0x5a')]);})[_0xeee4('0x15')](function(_0x54dd2a){return updateUser(_0x54dd2a)[_0xeee4('0x15')](function(_0x317f1e){if(_0x317f1e[_0xeee4('0x26')]===_0xeee4('0x27')){_0x317f1e[_0xeee4('0x84')]=_0x505c99[_0xeee4('0x29')][_0xeee4('0x84')];delete _0x317f1e[_0xeee4('0x85')];}return _0x317f1e;});})[_0xeee4('0x15')](function(_0xdceb50){return db[_0xeee4('0x37')][_0xeee4('0x80')](_0xdceb50,{'include':[{'model':db[_0xeee4('0x6f')],'as':_0xeee4('0x6f')}]});})[_0xeee4('0x15')](function(_0x2de089){if(_0x505c99[_0xeee4('0x5a')][_0xeee4('0x26')]===_0xeee4('0x29'))return _0x2de089;if(_0x505c99[_0xeee4('0x29')][_0xeee4('0x26')]!==_0xeee4('0x29'))return _0x2de089;return db['UserProfileSection']['find']({'where':{'name':_0x2de089[_0xeee4('0x26')]===_0xeee4('0x2b')?_0xeee4('0x2a'):_0xeee4('0x2c'),'userProfileId':_0x505c99[_0xeee4('0x29')][_0xeee4('0x85')]},'raw':!![]})[_0xeee4('0x15')](function(_0x4f6a55){if(!_0x4f6a55||_0x4f6a55[_0xeee4('0x86')]!=0x0)return _0x2de089;return db[_0xeee4('0x32')][_0xeee4('0x80')]({'name':_0x2de089[_0xeee4('0x31')],'resourceId':_0x2de089['id'],'type':_0x4f6a55['name'],'sectionId':_0x4f6a55['id']},{})[_0xeee4('0x15')](function(){return _0x2de089;});})[_0xeee4('0x1e')](function(_0xe1202){logger['error'](_0xeee4('0x87'),_0xe1202);throw _0xe1202;});})[_0xeee4('0x15')](respondWithResult(_0x380c59,0xc9))[_0xeee4('0x1e')](handleError(_0x380c59,null));};exports[_0xeee4('0x88')]=function(_0x3c3d37,_0x348293){var _0x586a12=_0x3c3d37[_0xeee4('0x5a')];var _0x33915a=[];if(_0x3c3d37[_0xeee4('0x29')][_0xeee4('0x26')]===_0xeee4('0x2b'))throw new Error(_0xeee4('0x81'));if(_['some'](_0x586a12,['role',_0xeee4('0x29')])&&_0x3c3d37[_0xeee4('0x29')][_0xeee4('0x26')]!==_0xeee4('0x27')){throw new Error(_0xeee4('0x89'));}if(_[_0xeee4('0x8a')](_0x586a12,[_0xeee4('0x26'),_0xeee4('0x27')])&&_0x3c3d37[_0xeee4('0x29')][_0xeee4('0x26')]!==_0xeee4('0x27')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xeee4('0x83')](_0x586a12)[_0xeee4('0x15')](function(){return validateUser(_0x586a12[0x0]);})[_0xeee4('0x15')](function(){for(var _0x61ad3f=0x1;_0x61ad3f<_0x586a12[_0xeee4('0x57')];_0x61ad3f++){var _0xe3591c=_0x586a12[_0x61ad3f-0x1][_0xeee4('0x60')];if(!_0x586a12[_0x61ad3f][_0xeee4('0x60')])_0x586a12[_0x61ad3f][_0xeee4('0x60')]=_0xe3591c+0x1;_0x33915a['push'](validateUser(_0x586a12[_0x61ad3f]));}return BPromise['all'](_0x33915a);})[_0xeee4('0x15')](function(){_0x33915a=[];for(var _0x276d29=0x0;_0x276d29<_0x586a12[_0xeee4('0x57')];_0x276d29++){_0x33915a['push'](updateUser(_0x586a12[_0x276d29]));}return BPromise[_0xeee4('0x50')](_0x33915a);})[_0xeee4('0x15')](function(){return BPromise[_0xeee4('0x8b')](_0x586a12,function(_0x1a7b03){return db[_0xeee4('0x37')][_0xeee4('0x80')](_0x1a7b03,{'include':[{'model':db[_0xeee4('0x6f')],'as':_0xeee4('0x6f')}]})[_0xeee4('0x15')](function(_0x1c78c1){_0x1a7b03['id']=_0x1c78c1['id'];return _0x1a7b03;});});})[_0xeee4('0x15')](function(_0x1b5bb7){if(_0x3c3d37['body'][_0xeee4('0x26')]===_0xeee4('0x29'))return _0x1b5bb7;if(_0x3c3d37[_0xeee4('0x29')][_0xeee4('0x26')]!==_0xeee4('0x29'))return _0x1b5bb7;var _0x3fc549=_[_0xeee4('0x8a')](_0x1b5bb7,function(_0x465f8d){return _0x465f8d[_0xeee4('0x26')]===_0xeee4('0x2b')||_0x465f8d[_0xeee4('0x26')]===_0xeee4('0x8c');});if(!_0x3fc549)return _0x1b5bb7;return db['UserProfileSection'][_0xeee4('0x45')]({'where':{'name':{'$or':['Agents',_0xeee4('0x2c')]},'userProfileId':_0x3c3d37[_0xeee4('0x29')]['userProfileId']},'raw':!![]})[_0xeee4('0x15')](function(_0x1bcb86){if(_[_0xeee4('0x8d')](_0x1bcb86)||!_[_0xeee4('0x8a')](_0x1bcb86,[_0xeee4('0x86'),0x0]))return _0x1b5bb7;_0x33915a=[];var _0xaf8284=_(_0x1bcb86)[_0xeee4('0x39')](function(_0x243d05){if(_0x243d05[_0xeee4('0x86')]===0x1)return;return _0x243d05['name']==='Agents'?_0xeee4('0x2b'):_0xeee4('0x8c');})[_0xeee4('0x8e')]()[_0xeee4('0x2e')]();for(var _0x20ac0c=0x0;_0x20ac0c<_0x1b5bb7[_0xeee4('0x57')];_0x20ac0c++){if(!_['includes'](_0xaf8284,_0x1b5bb7[_0x20ac0c][_0xeee4('0x26')]))return;var _0xe41464=_0x1b5bb7[_0x20ac0c]['role']===_0xeee4('0x2b')?_0xeee4('0x2a'):_0xeee4('0x2c');_0x33915a[_0xeee4('0x44')](db[_0xeee4('0x32')]['create']({'name':_0x1b5bb7[_0x20ac0c][_0xeee4('0x31')],'resourceId':_0x1b5bb7[_0x20ac0c]['id'],'type':_0xe41464,'sectionId':_[_0xeee4('0x30')](_0x1bcb86,[_0xeee4('0x31'),_0xe41464])['id']},{}));}return BPromise['all'](_0x33915a);});})[_0xeee4('0x15')](respondWithResult(_0x348293,0xc9))[_0xeee4('0x1e')](handleError(_0x348293,null));};exports[_0xeee4('0x8f')]=function(_0x24fba9,_0x3fbbbd){if(_0x24fba9['body']['id']){delete _0x24fba9[_0xeee4('0x5a')]['id'];}return db[_0xeee4('0x37')]['find']({'where':{'id':_0x24fba9[_0xeee4('0x5b')]['id']}})['then'](function(_0x52848e){if(!_0x52848e)return null;if(_0x52848e['id']===_0x24fba9['user']['id']){if(!_0x24fba9['body'][_0xeee4('0x90')]||!_0x24fba9[_0xeee4('0x5a')][_0xeee4('0x91')]){throw new db['Sequelize'][(_0xeee4('0x92'))](_0xeee4('0x93'));}if(!_0x52848e[_0xeee4('0x94')](_0x24fba9['body'][_0xeee4('0x90')])){throw new db[(_0xeee4('0x95'))][(_0xeee4('0x92'))]('Wrong\x20credentials');}if(_0x24fba9['body'][_0xeee4('0x90')]===_0x24fba9[_0xeee4('0x5a')][_0xeee4('0x91')]){throw new db[(_0xeee4('0x95'))][(_0xeee4('0x92'))](_0xeee4('0x96'));}}else if(_0x24fba9[_0xeee4('0x29')][_0xeee4('0x26')]===_0xeee4('0x27')){if(!_0x24fba9['body'][_0xeee4('0x91')]){throw new db[(_0xeee4('0x95'))][(_0xeee4('0x92'))](_0xeee4('0x97'));}}else if(_0x24fba9['user'][_0xeee4('0x26')]===_0xeee4('0x29')){if(!_0x24fba9['body']['newPassword']){throw new db[(_0xeee4('0x95'))][(_0xeee4('0x92'))](_0xeee4('0x97'));}if(_0x52848e['role']!==_0xeee4('0x2b')){throw new db['Sequelize'][(_0xeee4('0x92'))](_0xeee4('0x81'));}}else{throw new db[(_0xeee4('0x95'))][(_0xeee4('0x92'))](_0xeee4('0x81'));}return _0x52848e;})[_0xeee4('0x15')](handleEntityNotFound(_0x3fbbbd,null))[_0xeee4('0x15')](function(_0x4f5fce){return db[_0xeee4('0x61')][_0xeee4('0x98')]({'attributes':['id',_0xeee4('0x63'),_0xeee4('0x99'),_0xeee4('0x9a')]})[_0xeee4('0x15')](function(_0x11706c){if(_0x11706c['securePassword'])authService['validatePasswordPattern'](_0x24fba9[_0xeee4('0x5a')]['newPassword']);if(!_0x11706c[_0xeee4('0x99')]||!_0x4f5fce[_0xeee4('0x9b')])return _0x4f5fce;authService[_0xeee4('0x9c')](_0x24fba9['body'][_0xeee4('0x91')],_0x4f5fce['previousPasswords'],_0x11706c[_0xeee4('0x9a')]);return _0x4f5fce;})[_0xeee4('0x15')](saveUpdates({'password':_0x24fba9['body'][_0xeee4('0x91')],'passwordResetAt':_0x24fba9['user']['id']==_0x24fba9[_0xeee4('0x5b')]['id']?moment():null,'previousPasswords':authService[_0xeee4('0x9d')](_0x24fba9[_0xeee4('0x5a')]['newPassword'],_0x4f5fce[_0xeee4('0x9b')])},null));})[_0xeee4('0x15')](respondWithResult(_0x3fbbbd,null))[_0xeee4('0x1e')](handleError(_0x3fbbbd,null));};exports[_0xeee4('0x9e')]=function(_0x18eba9,_0x3e760f){var _0x4c1fff=_0x18eba9[_0xeee4('0x5a')][_0xeee4('0x9f')];return db[_0xeee4('0x37')]['find']({'where':{'id':_0x18eba9[_0xeee4('0x5b')]['id']},'attributes':['id','name','role',_0xeee4('0xa0'),'loginInPause','voicePause',_0xeee4('0xa1')]})[_0xeee4('0x15')](handleEntityNotFound(_0x3e760f,null))['then'](function(_0x2b93a9){if(_0x2b93a9){if(!utils[_0xeee4('0xa2')](_0x4c1fff)){throw new db[(_0xeee4('0x95'))][(_0xeee4('0x92'))]('Unknown\x20channel');}return _0x2b93a9[_0xeee4('0xa3')+_[_0xeee4('0xa4')](_0x4c1fff[_0xeee4('0xa5')]())+_0xeee4('0xa6')](_0x18eba9['body'][_0xeee4('0x5e')],{'penalty':_0x18eba9[_0xeee4('0x5a')][_0xeee4('0xa7')]||0x0})[_0xeee4('0xa8')](function(_0x2e6f60){for(var _0x1e14e5=0x0;_0x1e14e5<_0x18eba9[_0xeee4('0x5a')][_0xeee4('0x5e')]['length'];_0x1e14e5+=0x1){var _0x5f5a98={'UserId':Number(_0x18eba9[_0xeee4('0x5b')]['id'])};_0x5f5a98[_['capitalize'](_0x4c1fff[_0xeee4('0xa5')]())+_0xeee4('0xa9')]=Number(_0x18eba9[_0xeee4('0x5a')][_0xeee4('0x5e')][_0x1e14e5]);socket[_0xeee4('0xaa')]('user'+_[_0xeee4('0xa4')](_0x4c1fff[_0xeee4('0xa5')]())+_0xeee4('0xab'),_0x5f5a98);}return _0x2e6f60;})[_0xeee4('0x15')](function(){if(_0x4c1fff==='voice'){return db[_0xeee4('0xac')]['findAll']({'where':{'id':_0x18eba9[_0xeee4('0x5a')][_0xeee4('0x5e')]||[]},'raw':!![],'attributes':['id',_0xeee4('0x31')]});}})['then'](function(_0x1a4c90){var _0x55aa4e=_0x2b93a9[_0xeee4('0xad')]({'plain':!![]});var _0x28cb56=[];if(_0x4c1fff===_0xeee4('0xae')&&_0x55aa4e['role']===_0xeee4('0x2b')&&_0x55aa4e[_0xeee4('0xa0')]){for(var _0x4f8d4c=0x0;_0x4f8d4c<_0x1a4c90[_0xeee4('0x57')];_0x4f8d4c+=0x1){_0x28cb56[_0xeee4('0x44')]({'membername':_0x55aa4e['name'],'UserId':_0x55aa4e['id'],'queue_name':_0x1a4c90[_0x4f8d4c][_0xeee4('0x31')],'VoiceQueueId':_0x1a4c90[_0x4f8d4c]['id'],'interface':_['isNil'](_0x55aa4e['interface'])?util[_0xeee4('0xaf')](_0xeee4('0xb0'),_0x55aa4e['name']):_0x55aa4e[_0xeee4('0xa1')],'paused':_0x55aa4e[_0xeee4('0xb1')]||![],'penalty':_0x18eba9[_0xeee4('0x5a')][_0xeee4('0xa7')]||0x0});}return BPromise[_0xeee4('0x8b')](_0x28cb56,function(_0x139320){return db['UserVoiceQueueRt'][_0xeee4('0xb2')](_0x139320);});}return _0x2b93a9;});}})['then'](respondWithStatusCode(_0x3e760f,null))[_0xeee4('0x1e')](handleError(_0x3e760f,null));};exports[_0xeee4('0xb3')]=function(_0x4ba1da,_0x5a3260){var _0xd88c5b;return db[_0xeee4('0x37')]['find']({'where':{'id':_0x4ba1da[_0xeee4('0x5b')]['id']},'attributes':['id',_0xeee4('0x31'),'role']})['then'](handleEntityNotFound(_0x5a3260,null))[_0xeee4('0x15')](function(_0x230e2f){if(_0x230e2f){_0xd88c5b=_0x230e2f;if(!_0x4ba1da[_0xeee4('0x40')][_0xeee4('0x9f')]||!utils[_0xeee4('0xa2')](_0x4ba1da[_0xeee4('0x40')]['channel'])){throw new db['Sequelize'][(_0xeee4('0x92'))]('Unknown\x20channel');}return _0x230e2f[_0xeee4('0xb4')+_['capitalize'](_0x4ba1da['query'][_0xeee4('0x9f')][_0xeee4('0xa5')]())+_0xeee4('0xa6')](_0x4ba1da[_0xeee4('0x40')][_0xeee4('0x5e')]);}})[_0xeee4('0x15')](function(_0x15150e){if(_[_0xeee4('0xb5')](_0x4ba1da['query'][_0xeee4('0x5e')])){for(var _0x12bacd=0x0;_0x12bacd<_0x4ba1da[_0xeee4('0x40')][_0xeee4('0x5e')][_0xeee4('0x57')];_0x12bacd+=0x1){var _0x4aad96={'UserId':Number(_0x4ba1da[_0xeee4('0x5b')]['id'])};_0x4aad96[_[_0xeee4('0xa4')](_0x4ba1da['query']['channel'][_0xeee4('0xa5')]())+_0xeee4('0xa9')]=Number(_0x4ba1da[_0xeee4('0x40')][_0xeee4('0x5e')][_0x12bacd]);socket['emit']('user'+_[_0xeee4('0xa4')](_0x4ba1da[_0xeee4('0x40')]['channel']['toLowerCase']())+'Queue:remove',_0x4aad96);}}else{var _0x4aad96={'UserId':Number(_0x4ba1da[_0xeee4('0x5b')]['id'])};_0x4aad96[_[_0xeee4('0xa4')](_0x4ba1da[_0xeee4('0x40')][_0xeee4('0x9f')][_0xeee4('0xa5')]())+_0xeee4('0xa9')]=Number(_0x4ba1da[_0xeee4('0x40')]['ids']);socket[_0xeee4('0xaa')](_0xeee4('0x29')+_[_0xeee4('0xa4')](_0x4ba1da['query']['channel'][_0xeee4('0xa5')]())+_0xeee4('0xb6'),_0x4aad96);}return _0x15150e;})[_0xeee4('0x15')](function(){if(_0x4ba1da[_0xeee4('0x40')][_0xeee4('0x9f')]===_0xeee4('0xae')){return db[_0xeee4('0xb7')][_0xeee4('0x25')]({'where':{'UserId':_0x4ba1da[_0xeee4('0x5b')]['id'],'VoiceQueueId':_0x4ba1da[_0xeee4('0x40')][_0xeee4('0x5e')]},'individualHooks':!![]})[_0xeee4('0x15')](function(){return _0xd88c5b;});}return _0xd88c5b;})['then'](respondWithStatusCode(_0x5a3260,null))['catch'](handleError(_0x5a3260,null));};exports[_0xeee4('0xb8')]=function(_0xd22ac5,_0x1e75c7){_0xd22ac5['body']['userpic']=_0xd22ac5[_0xeee4('0xb9')][_0xeee4('0xba')];return db[_0xeee4('0x37')][_0xeee4('0x30')]({'where':{'id':_0xd22ac5[_0xeee4('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1e75c7,null))[_0xeee4('0x15')](saveUpdates(_0xd22ac5[_0xeee4('0x5a')],null))[_0xeee4('0x15')](respondWithResult(_0x1e75c7,null))[_0xeee4('0x1e')](handleError(_0x1e75c7,null));};exports[_0xeee4('0xbb')]=function(_0x1fa74a,_0x25092c){var _0x3e0e7d=path[_0xeee4('0xbc')](config[_0xeee4('0xbd')],_0xeee4('0xbe'));return db[_0xeee4('0x37')]['find']({'where':{'id':_0x1fa74a['params']['id']},'attributes':['id',_0xeee4('0xbf')],'raw':!![]})[_0xeee4('0x15')](handleEntityNotFound(_0x25092c,null))['then'](function(_0x2169ca){if(_0x2169ca){if(_['isNil'](_0x2169ca['userpic'])){return _0x25092c[_0xeee4('0xc0')](_0x3e0e7d);}else{if(!fs['existsSync'](path[_0xeee4('0xbc')](config[_0xeee4('0xbd')],_0xeee4('0xc1'),_0x2169ca['userpic']))){return _0x25092c[_0xeee4('0xc0')](_0x3e0e7d);}return _0x25092c[_0xeee4('0xc0')](path[_0xeee4('0xbc')](config[_0xeee4('0xbd')],'server/files/images/',_0x2169ca[_0xeee4('0xbf')]));}}})[_0xeee4('0x1e')](handleError(_0x25092c,null));};exports[_0xeee4('0xc2')]=function(_0x22fe3f,_0x571648){return db['User'][_0xeee4('0x30')]({'where':{'id':_0x22fe3f[_0xeee4('0x5b')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x571648,null))[_0xeee4('0x15')](function(_0x87a08c){var _0x54c604=[];values=_0x87a08c[_0xeee4('0x4b')];_0x54c604[_0xeee4('0x44')](get_open_tabs(_0xeee4('0x48'),_0x87a08c[_0xeee4('0x4b')]));_0x54c604['push'](get_open_tabs(_0xeee4('0x4a'),_0x87a08c[_0xeee4('0x4b')]));_0x54c604[_0xeee4('0x44')](get_open_tabs(_0xeee4('0x4e'),_0x87a08c[_0xeee4('0x4b')]));_0x54c604[_0xeee4('0x44')](get_open_tabs(_0xeee4('0x4f'),_0x87a08c[_0xeee4('0x4b')]));_0x54c604[_0xeee4('0x44')](get_open_tabs(_0xeee4('0x4c'),_0x87a08c[_0xeee4('0x4b')]));_0x54c604[_0xeee4('0x44')](get_open_tabs(_0xeee4('0x4d'),_0x87a08c[_0xeee4('0x4b')]));return BPromise[_0xeee4('0x50')](_0x54c604);})['then'](function(_0x3e4db8){var _0x126779=[];if(_0x3e4db8){for(var _0x3efa39=0x0;_0x3efa39=_0x4bbcae){_0x20bc5a=_0x4bbcae;_0x26ef14=0xc8;}else{_0x26ef14=0xce;}_0x53269e[_0x7822('0x1d')](_0x26ef14);return _0x53269e[_0x7822('0x22')](_0x7822('0x23'),_0x1d2d5f+'-'+_0x20bc5a+'/'+_0x4bbcae)[_0x7822('0x24')](_0x2c4948);}return null;};}function saveUpdates(_0x19173e){return function(_0x8ce726){if(_0x8ce726){return _0x8ce726[_0x7822('0x25')](_0x19173e)[_0x7822('0x13')](function(_0x2028e8){return _0x2028e8;});}return null;};}function removeEntity(_0x17d4df){return function(_0x22578b){if(_0x22578b){return _0x22578b['destroy']()['then'](function(){var _0x52865b=_0x22578b[_0x7822('0x26')]({'plain':!![]});if(_0x52865b[_0x7822('0x27')]==='admin')return;var _0x25db50=[{'name':_0x7822('0x28'),'value':'user','ignore':!![]},{'name':_0x7822('0x29'),'value':_0x7822('0x2a'),'ignore':![]},{'name':_0x7822('0x2b'),'value':'telephone','ignore':![]}];var _0x5f35df=_(_0x25db50)[_0x7822('0x2c')]('ignore')['map'](_0x7822('0x2d'))['value']();if(_[_0x7822('0x2e')](_0x5f35df,_0x52865b[_0x7822('0x27')])){return;}var _0x188702=_['find'](_0x25db50,[_0x7822('0x2d'),_0x52865b[_0x7822('0x27')]])[_0x7822('0x2f')];return db[_0x7822('0x30')][_0x7822('0x31')]({'where':{'type':_0x188702,'resourceId':_0x52865b['id']}})[_0x7822('0x13')](function(){return _0x22578b;});})[_0x7822('0x13')](function(){_0x17d4df['status'](0xcc)[_0x7822('0x32')]();});}};}function handleEntityNotFound(_0x2746fb){return function(_0x1d9ef8){if(!_0x1d9ef8){_0x2746fb[_0x7822('0x1c')](0x194);}return _0x1d9ef8;};}function handleError(_0x4481c0,_0x47b3bf){_0x47b3bf=_0x47b3bf||0x1f4;return function(_0x5cf6a3){logger[_0x7822('0x18')](_0x5cf6a3['stack']);if(_0x5cf6a3[_0x7822('0x2f')]){delete _0x5cf6a3[_0x7822('0x2f')];}_0x4481c0[_0x7822('0x1d')](_0x47b3bf)[_0x7822('0x33')](_0x5cf6a3);};}exports['index']=function(_0x569434,_0x1dceac){var _0x33f4ab={},_0x5a6cf0={'count':0x0,'rows':[]};var _0x7399f5=_(db[_0x7822('0x34')]['rawAttributes'])['map'](function(_0x297071){return{'name':_0x297071[_0x7822('0x35')],'type':_0x297071[_0x7822('0x36')]['key']};})[_0x7822('0x2c')](function(_0x250e1c){return!_[_0x7822('0x2e')]([_0x7822('0x37'),_0x7822('0x38')],_0x250e1c[_0x7822('0x2f')]);})['value']();_0x33f4ab=qs[_0x7822('0x39')](_0x7399f5,_0x569434);var _0x340d59={'where':_0x33f4ab[_0x7822('0x3a')]};return db[_0x7822('0x34')][_0x7822('0x20')](_0x340d59)['then'](function(_0x1b9a8e){_0x5a6cf0[_0x7822('0x20')]=_0x1b9a8e;if(_0x569434[_0x7822('0x3b')][_0x7822('0x3c')]){_0x33f4ab['include']=[{'all':!![]}];}if(!_[_0x7822('0x2e')](_0x33f4ab[_0x7822('0x3d')],'id')){_0x33f4ab['attributes'][_0x7822('0x3e')]('id');}return db[_0x7822('0x34')][_0x7822('0x3f')](_0x33f4ab);})[_0x7822('0x13')](function(_0x45ae4c){_0x5a6cf0[_0x7822('0x40')]=_0x45ae4c;if(_0x569434['query'][_0x7822('0x41')]===_0x7822('0x42')){var _0x51fd88=[];for(var _0x3b0355=0x0;_0x3b0355<_0x5a6cf0['rows'][_0x7822('0x43')];_0x3b0355++){_0x51fd88[_0x7822('0x3e')](get_open_tabs(_0x7822('0x44'),_0x5a6cf0[_0x7822('0x40')][_0x3b0355][_0x7822('0x45')]));_0x51fd88[_0x7822('0x3e')](get_open_tabs(_0x7822('0x46'),_0x5a6cf0[_0x7822('0x40')][_0x3b0355][_0x7822('0x45')]));_0x51fd88['push'](get_open_tabs('fax',_0x5a6cf0[_0x7822('0x40')][_0x3b0355]['dataValues']));_0x51fd88['push'](get_open_tabs(_0x7822('0x47'),_0x5a6cf0[_0x7822('0x40')][_0x3b0355][_0x7822('0x45')]));_0x51fd88[_0x7822('0x3e')](get_open_tabs(_0x7822('0x48'),_0x5a6cf0[_0x7822('0x40')][_0x3b0355][_0x7822('0x45')]));_0x51fd88[_0x7822('0x3e')](get_open_tabs(_0x7822('0x49'),_0x5a6cf0['rows'][_0x3b0355][_0x7822('0x45')]));}return BPromise[_0x7822('0x4a')](_0x51fd88)[_0x7822('0x13')](function(_0x31b553){return _0x5a6cf0;});}else{return _0x5a6cf0;}})[_0x7822('0x13')](respondWithFilteredResult(_0x1dceac,_0x33f4ab))[_0x7822('0x4b')](handleError(_0x1dceac,null));};exports['show']=function(_0x1a4ce5,_0x39a02d){var _0x1e32bd={'raw':![],'where':{'id':_0x1a4ce5[_0x7822('0x4c')]['id']}},_0x3a98ac={};_0x3a98ac[_0x7822('0x4d')]=_[_0x7822('0x4e')](_[_0x7822('0x4f')](db['User']['rawAttributes']),[_0x7822('0x37'),'salt']);_0x3a98ac[_0x7822('0x3b')]=_[_0x7822('0x4f')](_0x1a4ce5[_0x7822('0x3b')]);_0x3a98ac[_0x7822('0x50')]=_['intersection'](_0x3a98ac[_0x7822('0x4d')],_0x3a98ac[_0x7822('0x3b')]);_0x1e32bd[_0x7822('0x3d')]=_['intersection'](_0x3a98ac[_0x7822('0x4d')],qs[_0x7822('0x51')](_0x1a4ce5[_0x7822('0x3b')][_0x7822('0x51')]));_0x1e32bd['attributes']=_0x1e32bd['attributes']['length']?_0x1e32bd[_0x7822('0x3d')]:_0x3a98ac[_0x7822('0x4d')];if(_0x1a4ce5[_0x7822('0x3b')][_0x7822('0x3c')]){_0x1e32bd[_0x7822('0x52')]=[{'all':!![]}];}_0x1e32bd=_['merge']({},_0x1e32bd,_0x1a4ce5[_0x7822('0x53')]);if(!_[_0x7822('0x2e')](_0x1e32bd[_0x7822('0x3d')],'id')){_0x1e32bd[_0x7822('0x3d')][_0x7822('0x3e')]('id');}return db[_0x7822('0x34')][_0x7822('0x54')](_0x1e32bd)[_0x7822('0x13')](handleEntityNotFound(_0x39a02d,null))[_0x7822('0x13')](function(_0x332723){var _0x1f76ef=[];values=_0x332723;if(_0x1a4ce5[_0x7822('0x3b')]['openTabs']==='true'){_0x1f76ef['push'](get_open_tabs(_0x7822('0x44'),_0x332723[_0x7822('0x45')]));_0x1f76ef['push'](get_open_tabs(_0x7822('0x46'),_0x332723[_0x7822('0x45')]));_0x1f76ef[_0x7822('0x3e')](get_open_tabs(_0x7822('0x48'),_0x332723[_0x7822('0x45')]));_0x1f76ef[_0x7822('0x3e')](get_open_tabs('whatsapp',_0x332723[_0x7822('0x45')]));_0x1f76ef[_0x7822('0x3e')](get_open_tabs(_0x7822('0x55'),_0x332723['dataValues']));_0x1f76ef[_0x7822('0x3e')](get_open_tabs(_0x7822('0x47'),_0x332723['dataValues']));return BPromise[_0x7822('0x4a')](_0x1f76ef);}else{return values;}})[_0x7822('0x13')](function(_0x5e0a3c){return values;})[_0x7822('0x13')](respondWithResult(_0x39a02d,null))[_0x7822('0x4b')](handleError(_0x39a02d,null));};exports[_0x7822('0x25')]=function(_0x1212e6,_0x6c440a){if(_0x1212e6[_0x7822('0x56')]['id']){delete _0x1212e6[_0x7822('0x56')]['id'];}delete _0x1212e6[_0x7822('0x56')][_0x7822('0x27')];return db['User'][_0x7822('0x54')]({'where':{'id':_0x1212e6[_0x7822('0x4c')]['id']}})[_0x7822('0x13')](handleEntityNotFound(_0x6c440a,null))[_0x7822('0x13')](saveUpdates(_0x1212e6[_0x7822('0x56')],null))[_0x7822('0x13')](respondWithResult(_0x6c440a,null))['catch'](handleError(_0x6c440a,null));};exports[_0x7822('0x57')]=function(_0x4da82b,_0x3ccfc4){return db[_0x7822('0x34')][_0x7822('0x57')]()[_0x7822('0x13')](respondWithResult(_0x3ccfc4,null))[_0x7822('0x4b')](handleError(_0x3ccfc4,null));};exports[_0x7822('0x58')]=function(_0x5719d2,_0x2df6cf){return db[_0x7822('0x34')][_0x7822('0x54')]({'where':{'id':_0x5719d2[_0x7822('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2df6cf,null))[_0x7822('0x13')](function(_0x90971a){if(_0x90971a){return _0x90971a[_0x7822('0x58')](_0x5719d2[_0x7822('0x56')][_0x7822('0x59')],_['omit'](_0x5719d2[_0x7822('0x56')],[_0x7822('0x59'),'id'])||{});}})[_0x7822('0x13')](respondWithResult(_0x2df6cf,null))[_0x7822('0x4b')](handleError(_0x2df6cf,null));};function validateUser(_0x34091f){return new BPromise(function(_0x540a8a,_0x18629f){if(_0x34091f[_0x7822('0x5a')])return _0x540a8a(_0x34091f);return db[_0x7822('0x5b')][_0x7822('0x5c')](0x1)[_0x7822('0x13')](function(_0x241dee){if(_0x241dee[_0x7822('0x5d')])authService[_0x7822('0x5e')](_0x34091f[_0x7822('0x37')]);db[_0x7822('0x34')][_0x7822('0x5f')](_0x7822('0x5a'))['then'](function(_0x4b3186){if(_[_0x7822('0x60')](_0x4b3186)){_0x34091f[_0x7822('0x5a')]=_0x241dee[_0x7822('0x61')]||0x1;return;}if(_[_0x7822('0x60')](_0x241dee[_0x7822('0x61')])||_0x241dee[_0x7822('0x61')]===_0x4b3186){_0x34091f[_0x7822('0x5a')]=_0x4b3186+0x1;return;}if(_0x241dee[_0x7822('0x61')]>_0x4b3186){_0x34091f[_0x7822('0x5a')]=_0x241dee[_0x7822('0x61')];return;}return db[_0x7822('0x62')][_0x7822('0x3b')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize'][_0x7822('0x63')][_0x7822('0x64')]})['then'](function(_0x514585){if(_0x514585&&_0x514585[_0x7822('0x43')]){for(var _0x185920=0x0,_0x5ee603=_0x514585['length'];_0x185920<_0x5ee603&&_[_0x7822('0x60')](_0x34091f[_0x7822('0x5a')]);_0x185920++){if(_0x241dee[_0x7822('0x61')]<=_0x514585[_0x185920][_0x7822('0x65')]){_0x34091f['internal']=_0x514585[_0x185920][_0x7822('0x65')];}else if(_0x241dee[_0x7822('0x61')]>_0x514585[_0x185920][_0x7822('0x65')]&&_0x241dee[_0x7822('0x61')]<=_0x514585[_0x185920]['to']){_0x34091f[_0x7822('0x5a')]=_0x241dee[_0x7822('0x61')];}}}if(_[_0x7822('0x60')](_0x34091f[_0x7822('0x5a')])){_0x34091f[_0x7822('0x5a')]=_0x4b3186+0x1;}return _0x540a8a(_0x34091f);});});})[_0x7822('0x4b')](function(_0x58b854){_0x18629f(_0x58b854);});});}function updateUser(_0x4b8aad){return new BPromise(function(_0x3038eb,_0x44e008){try{if(_0x4b8aad[_0x7822('0x66')]){_0x4b8aad[_0x7822('0x67')]=_0x4b8aad[_0x7822('0x5a')];_0x4b8aad[_0x7822('0x68')]={'mailbox':_0x4b8aad[_0x7822('0x5a')],'password':_0x4b8aad[_0x7822('0x37')],'fullname':_0x4b8aad[_0x7822('0x69')],'email':_0x4b8aad[_0x7822('0x6a')]};}if(_0x4b8aad[_0x7822('0x27')]==='agent'){if(!_0x4b8aad[_0x7822('0x6b')])_0x4b8aad[_0x7822('0x6b')]=['101',_0x7822('0x6c'),'103','113',_0x7822('0x6d'),_0x7822('0x6e'),_0x7822('0x6f'),_0x7822('0x70'),_0x7822('0x71'),_0x7822('0x72'),_0x7822('0x73'),_0x7822('0x74'),_0x7822('0x75'),'114','115'];}_0x3038eb(_0x4b8aad);}catch(_0xff3812){_0x44e008(_0xff3812);}});}exports['create']=function(_0x5a145d,_0x2532fd){if(_0x5a145d[_0x7822('0x76')][_0x7822('0x27')]===_0x7822('0x2a'))throw new Error(_0x7822('0x77'));if(_0x5a145d[_0x7822('0x56')][_0x7822('0x27')]===_0x7822('0x76')&&_0x5a145d['user']['role']!=='admin'){throw new Error(_0x7822('0x78'));}if(_0x5a145d[_0x7822('0x56')]['role']===_0x7822('0x79')&&_0x5a145d[_0x7822('0x76')][_0x7822('0x27')]!==_0x7822('0x79')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x7822('0x7a')]([_0x5a145d[_0x7822('0x56')]])['then'](function(){return validateUser(_0x5a145d['body']);})[_0x7822('0x13')](function(_0x3ce7fe){return updateUser(_0x3ce7fe)[_0x7822('0x13')](function(_0x13f536){if(_0x13f536[_0x7822('0x27')]==='admin'){_0x13f536['settingsEnabled']=_0x5a145d[_0x7822('0x76')][_0x7822('0x7b')];delete _0x13f536[_0x7822('0x7c')];}return _0x13f536;});})[_0x7822('0x13')](function(_0x5d770b){return db['User'][_0x7822('0x7d')](_0x5d770b,{'include':[{'model':db[_0x7822('0x68')],'as':'VoiceMail'}]});})['then'](function(_0x1cc540){if(_0x5a145d[_0x7822('0x56')][_0x7822('0x27')]===_0x7822('0x76'))return _0x1cc540;if(_0x5a145d['user'][_0x7822('0x27')]!==_0x7822('0x76'))return _0x1cc540;return db[_0x7822('0x7e')][_0x7822('0x54')]({'where':{'name':_0x1cc540[_0x7822('0x27')]==='agent'?_0x7822('0x29'):_0x7822('0x2b'),'userProfileId':_0x5a145d[_0x7822('0x76')][_0x7822('0x7c')]},'raw':!![]})[_0x7822('0x13')](function(_0x4fae5b){if(!_0x4fae5b||_0x4fae5b[_0x7822('0x7f')]!=0x0)return _0x1cc540;return db['UserProfileResource'][_0x7822('0x7d')]({'name':_0x1cc540[_0x7822('0x2f')],'resourceId':_0x1cc540['id'],'type':_0x4fae5b[_0x7822('0x2f')],'sectionId':_0x4fae5b['id']},{})[_0x7822('0x13')](function(){return _0x1cc540;});})[_0x7822('0x4b')](function(_0x249d1b){logger['error'](_0x7822('0x80'),_0x249d1b);throw _0x249d1b;});})['then'](respondWithResult(_0x2532fd,0xc9))['catch'](handleError(_0x2532fd,null));};exports[_0x7822('0x81')]=function(_0x55f809,_0x36841a){var _0x7fec12=_0x55f809[_0x7822('0x56')];var _0x2a2248=[];if(_0x55f809[_0x7822('0x76')][_0x7822('0x27')]===_0x7822('0x2a'))throw new Error(_0x7822('0x77'));if(_['some'](_0x7fec12,['role',_0x7822('0x76')])&&_0x55f809[_0x7822('0x76')][_0x7822('0x27')]!==_0x7822('0x79')){throw new Error(_0x7822('0x78'));}if(_[_0x7822('0x82')](_0x7fec12,[_0x7822('0x27'),_0x7822('0x79')])&&_0x55f809[_0x7822('0x76')][_0x7822('0x27')]!==_0x7822('0x79')){throw new Error(_0x7822('0x83'));}return licenseUtil[_0x7822('0x7a')](_0x7fec12)[_0x7822('0x13')](function(){return validateUser(_0x7fec12[0x0]);})['then'](function(){for(var _0x181576=0x1;_0x181576<_0x7fec12['length'];_0x181576++){var _0x4e5c47=_0x7fec12[_0x181576-0x1]['internal'];if(!_0x7fec12[_0x181576]['internal'])_0x7fec12[_0x181576][_0x7822('0x5a')]=_0x4e5c47+0x1;_0x2a2248[_0x7822('0x3e')](validateUser(_0x7fec12[_0x181576]));}return BPromise[_0x7822('0x4a')](_0x2a2248);})['then'](function(){_0x2a2248=[];for(var _0x1b3870=0x0;_0x1b3870<_0x7fec12[_0x7822('0x43')];_0x1b3870++){_0x2a2248[_0x7822('0x3e')](updateUser(_0x7fec12[_0x1b3870]));}return BPromise[_0x7822('0x4a')](_0x2a2248);})['then'](function(){return BPromise['each'](_0x7fec12,function(_0x322b4f){return db[_0x7822('0x34')][_0x7822('0x7d')](_0x322b4f,{'include':[{'model':db[_0x7822('0x68')],'as':_0x7822('0x68')}]})[_0x7822('0x13')](function(_0x480e95){_0x322b4f['id']=_0x480e95['id'];return _0x322b4f;});});})['then'](function(_0x1d10e4){if(_0x55f809[_0x7822('0x56')][_0x7822('0x27')]===_0x7822('0x76'))return _0x1d10e4;if(_0x55f809[_0x7822('0x76')]['role']!==_0x7822('0x76'))return _0x1d10e4;var _0x254584=_[_0x7822('0x82')](_0x1d10e4,function(_0x4b0f8b){return _0x4b0f8b['role']===_0x7822('0x2a')||_0x4b0f8b[_0x7822('0x27')]===_0x7822('0x84');});if(!_0x254584)return _0x1d10e4;return db[_0x7822('0x7e')][_0x7822('0x3f')]({'where':{'name':{'$or':['Agents',_0x7822('0x2b')]},'userProfileId':_0x55f809[_0x7822('0x76')][_0x7822('0x7c')]},'raw':!![]})[_0x7822('0x13')](function(_0x48818d){if(_[_0x7822('0x85')](_0x48818d)||!_[_0x7822('0x82')](_0x48818d,[_0x7822('0x7f'),0x0]))return _0x1d10e4;_0x2a2248=[];var _0x55cb7f=_(_0x48818d)[_0x7822('0x86')](function(_0x4cf702){if(_0x4cf702[_0x7822('0x7f')]===0x1)return;return _0x4cf702[_0x7822('0x2f')]===_0x7822('0x29')?'agent':_0x7822('0x84');})['compact']()[_0x7822('0x2d')]();for(var _0x396f43=0x0;_0x396f43<_0x1d10e4[_0x7822('0x43')];_0x396f43++){if(!_[_0x7822('0x2e')](_0x55cb7f,_0x1d10e4[_0x396f43]['role']))return;var _0x2507d4=_0x1d10e4[_0x396f43][_0x7822('0x27')]===_0x7822('0x2a')?_0x7822('0x29'):_0x7822('0x2b');_0x2a2248[_0x7822('0x3e')](db[_0x7822('0x30')][_0x7822('0x7d')]({'name':_0x1d10e4[_0x396f43][_0x7822('0x2f')],'resourceId':_0x1d10e4[_0x396f43]['id'],'type':_0x2507d4,'sectionId':_[_0x7822('0x54')](_0x48818d,[_0x7822('0x2f'),_0x2507d4])['id']},{}));}return BPromise[_0x7822('0x4a')](_0x2a2248);});})['then'](respondWithResult(_0x36841a,0xc9))['catch'](handleError(_0x36841a,null));};exports[_0x7822('0x87')]=function(_0x4dfce1,_0x353270){if(_0x4dfce1['body']['id']){delete _0x4dfce1[_0x7822('0x56')]['id'];}return db[_0x7822('0x34')][_0x7822('0x54')]({'where':{'id':_0x4dfce1['params']['id']}})[_0x7822('0x13')](function(_0x4cbd0a){if(!_0x4cbd0a)return null;if(_0x4cbd0a['id']===_0x4dfce1[_0x7822('0x76')]['id']){if(!_0x4dfce1['body']['oldPassword']||!_0x4dfce1[_0x7822('0x56')][_0x7822('0x88')]){throw new db[(_0x7822('0x89'))]['ValidationError'](_0x7822('0x8a'));}if(!_0x4cbd0a[_0x7822('0x8b')](_0x4dfce1[_0x7822('0x56')][_0x7822('0x8c')])){throw new db[(_0x7822('0x89'))][(_0x7822('0x8d'))](_0x7822('0x8e'));}if(_0x4dfce1[_0x7822('0x56')]['oldPassword']===_0x4dfce1[_0x7822('0x56')]['newPassword']){throw new db['Sequelize']['ValidationError'](_0x7822('0x8f'));}}else if(_0x4dfce1[_0x7822('0x76')]['role']==='admin'){if(!_0x4dfce1['body'][_0x7822('0x88')]){throw new db[(_0x7822('0x89'))][(_0x7822('0x8d'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x4dfce1[_0x7822('0x76')]['role']==='user'){if(!_0x4dfce1['body'][_0x7822('0x88')]){throw new db[(_0x7822('0x89'))][(_0x7822('0x8d'))](_0x7822('0x90'));}if(_0x4cbd0a[_0x7822('0x27')]!=='agent'){throw new db[(_0x7822('0x89'))][(_0x7822('0x8d'))](_0x7822('0x77'));}}else{throw new db['Sequelize'][(_0x7822('0x8d'))](_0x7822('0x77'));}return _0x4cbd0a;})[_0x7822('0x13')](handleEntityNotFound(_0x353270,null))[_0x7822('0x13')](function(_0x45bb4d){return db[_0x7822('0x5b')][_0x7822('0x91')]({'attributes':['id',_0x7822('0x5d'),_0x7822('0x92'),_0x7822('0x93')]})[_0x7822('0x13')](function(_0x3db5b3){if(_0x3db5b3[_0x7822('0x5d')])authService[_0x7822('0x5e')](_0x4dfce1[_0x7822('0x56')][_0x7822('0x88')]);if(!_0x3db5b3['enforcePasswordHistory']||!_0x45bb4d['previousPasswords'])return _0x45bb4d;authService[_0x7822('0x94')](_0x4dfce1['body'][_0x7822('0x88')],_0x45bb4d['previousPasswords'],_0x3db5b3[_0x7822('0x93')]);return _0x45bb4d;})['then'](saveUpdates({'password':_0x4dfce1['body'][_0x7822('0x88')],'passwordResetAt':_0x4dfce1[_0x7822('0x76')]['id']==_0x4dfce1['params']['id']?moment():null,'previousPasswords':authService[_0x7822('0x95')](_0x4dfce1[_0x7822('0x56')]['newPassword'],_0x45bb4d[_0x7822('0x96')])},null));})[_0x7822('0x13')](respondWithResult(_0x353270,null))[_0x7822('0x4b')](handleError(_0x353270,null));};exports['addQueues']=function(_0x3635f3,_0x2568a2){var _0x39a481=_0x3635f3['body']['channel'];return db[_0x7822('0x34')][_0x7822('0x54')]({'where':{'id':_0x3635f3[_0x7822('0x4c')]['id']},'attributes':['id',_0x7822('0x2f'),_0x7822('0x27'),_0x7822('0x97'),_0x7822('0x98'),_0x7822('0x99'),_0x7822('0x9a')]})[_0x7822('0x13')](handleEntityNotFound(_0x2568a2,null))[_0x7822('0x13')](function(_0xb6e2e8){if(_0xb6e2e8){if(!utils[_0x7822('0x9b')](_0x39a481)){throw new db[(_0x7822('0x89'))][(_0x7822('0x8d'))]('Unknown\x20channel');}return _0xb6e2e8[_0x7822('0x9c')+_[_0x7822('0x9d')](_0x39a481[_0x7822('0x9e')]())+_0x7822('0x9f')](_0x3635f3[_0x7822('0x56')][_0x7822('0x59')],{'penalty':_0x3635f3[_0x7822('0x56')][_0x7822('0xa0')]||0x0})[_0x7822('0xa1')](function(_0x1b5923){for(var _0x4c07bd=0x0;_0x4c07bd<_0x3635f3[_0x7822('0x56')]['ids']['length'];_0x4c07bd+=0x1){var _0x27b1e4={'UserId':Number(_0x3635f3['params']['id'])};_0x27b1e4[_[_0x7822('0x9d')](_0x39a481[_0x7822('0x9e')]())+_0x7822('0xa2')]=Number(_0x3635f3[_0x7822('0x56')][_0x7822('0x59')][_0x4c07bd]);socket[_0x7822('0xa3')]('user'+_[_0x7822('0x9d')](_0x39a481[_0x7822('0x9e')]())+'Queue:save',_0x27b1e4);}return _0x1b5923;})['then'](function(){if(_0x39a481===_0x7822('0xa4')){return db[_0x7822('0xa5')]['findAll']({'where':{'id':_0x3635f3[_0x7822('0x56')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x4c8c46){var _0x2d5d7e=_0xb6e2e8[_0x7822('0x26')]({'plain':!![]});var _0x51e673=[];if(_0x39a481===_0x7822('0xa4')&&_0x2d5d7e['role']==='agent'&&_0x2d5d7e['online']){for(var _0x4666ba=0x0;_0x4666ba<_0x4c8c46[_0x7822('0x43')];_0x4666ba+=0x1){_0x51e673[_0x7822('0x3e')]({'membername':_0x2d5d7e[_0x7822('0x2f')],'UserId':_0x2d5d7e['id'],'queue_name':_0x4c8c46[_0x4666ba][_0x7822('0x2f')],'VoiceQueueId':_0x4c8c46[_0x4666ba]['id'],'interface':_[_0x7822('0x60')](_0x2d5d7e[_0x7822('0x9a')])?util[_0x7822('0xa6')]('SIP/%s',_0x2d5d7e[_0x7822('0x2f')]):_0x2d5d7e['interface'],'paused':_0x2d5d7e[_0x7822('0x99')]||![],'penalty':_0x3635f3['body'][_0x7822('0xa0')]||0x0});}return BPromise[_0x7822('0xa7')](_0x51e673,function(_0x5666a0){return db[_0x7822('0xa8')][_0x7822('0xa9')](_0x5666a0);});}return _0xb6e2e8;});}})[_0x7822('0x13')](respondWithStatusCode(_0x2568a2,null))[_0x7822('0x4b')](handleError(_0x2568a2,null));};exports[_0x7822('0xaa')]=function(_0x25e273,_0x5e7e02){var _0x50c151;return db[_0x7822('0x34')][_0x7822('0x54')]({'where':{'id':_0x25e273[_0x7822('0x4c')]['id']},'attributes':['id',_0x7822('0x2f'),_0x7822('0x27')]})[_0x7822('0x13')](handleEntityNotFound(_0x5e7e02,null))[_0x7822('0x13')](function(_0x4e1800){if(_0x4e1800){_0x50c151=_0x4e1800;if(!_0x25e273['query']['channel']||!utils[_0x7822('0x9b')](_0x25e273[_0x7822('0x3b')][_0x7822('0xab')])){throw new db[(_0x7822('0x89'))][(_0x7822('0x8d'))](_0x7822('0xac'));}return _0x4e1800[_0x7822('0xad')+_[_0x7822('0x9d')](_0x25e273[_0x7822('0x3b')]['channel']['toLowerCase']())+_0x7822('0x9f')](_0x25e273[_0x7822('0x3b')]['ids']);}})[_0x7822('0x13')](function(_0x20242b){if(_[_0x7822('0xae')](_0x25e273[_0x7822('0x3b')][_0x7822('0x59')])){for(var _0x5d7580=0x0;_0x5d7580<_0x25e273[_0x7822('0x3b')][_0x7822('0x59')][_0x7822('0x43')];_0x5d7580+=0x1){var _0xbf878b={'UserId':Number(_0x25e273[_0x7822('0x4c')]['id'])};_0xbf878b[_[_0x7822('0x9d')](_0x25e273[_0x7822('0x3b')][_0x7822('0xab')][_0x7822('0x9e')]())+'QueueId']=Number(_0x25e273[_0x7822('0x3b')][_0x7822('0x59')][_0x5d7580]);socket['emit'](_0x7822('0x76')+_[_0x7822('0x9d')](_0x25e273[_0x7822('0x3b')][_0x7822('0xab')][_0x7822('0x9e')]())+_0x7822('0xaf'),_0xbf878b);}}else{var _0xbf878b={'UserId':Number(_0x25e273[_0x7822('0x4c')]['id'])};_0xbf878b[_[_0x7822('0x9d')](_0x25e273[_0x7822('0x3b')]['channel'][_0x7822('0x9e')]())+_0x7822('0xa2')]=Number(_0x25e273['query'][_0x7822('0x59')]);socket[_0x7822('0xa3')](_0x7822('0x76')+_[_0x7822('0x9d')](_0x25e273[_0x7822('0x3b')][_0x7822('0xab')][_0x7822('0x9e')]())+'Queue:remove',_0xbf878b);}return _0x20242b;})[_0x7822('0x13')](function(){if(_0x25e273['query'][_0x7822('0xab')]===_0x7822('0xa4')){return db[_0x7822('0xa8')]['destroy']({'where':{'UserId':_0x25e273['params']['id'],'VoiceQueueId':_0x25e273['query']['ids']},'individualHooks':!![]})['then'](function(){return _0x50c151;});}return _0x50c151;})[_0x7822('0x13')](respondWithStatusCode(_0x5e7e02,null))[_0x7822('0x4b')](handleError(_0x5e7e02,null));};exports[_0x7822('0xb0')]=function(_0x11800a,_0x2257fa){_0x11800a[_0x7822('0x56')][_0x7822('0xb1')]=_0x11800a[_0x7822('0xb2')][_0x7822('0xb3')];return db[_0x7822('0x34')]['find']({'where':{'id':_0x11800a['params']['id']}})[_0x7822('0x13')](handleEntityNotFound(_0x2257fa,null))[_0x7822('0x13')](saveUpdates(_0x11800a[_0x7822('0x56')],null))[_0x7822('0x13')](respondWithResult(_0x2257fa,null))[_0x7822('0x4b')](handleError(_0x2257fa,null));};exports[_0x7822('0xb4')]=function(_0x3040cf,_0x15beb7){var _0x12765d=path[_0x7822('0xb5')](config[_0x7822('0xb6')],_0x7822('0xb7'));return db[_0x7822('0x34')][_0x7822('0x54')]({'where':{'id':_0x3040cf[_0x7822('0x4c')]['id']},'attributes':['id',_0x7822('0xb1')],'raw':!![]})[_0x7822('0x13')](handleEntityNotFound(_0x15beb7,null))[_0x7822('0x13')](function(_0x8befcc){if(_0x8befcc){if(_[_0x7822('0x60')](_0x8befcc['userpic'])){return _0x15beb7[_0x7822('0xb8')](_0x12765d);}else{if(!fs['existsSync'](path['join'](config[_0x7822('0xb6')],_0x7822('0xb9'),_0x8befcc[_0x7822('0xb1')]))){return _0x15beb7[_0x7822('0xb8')](_0x12765d);}return _0x15beb7[_0x7822('0xb8')](path[_0x7822('0xb5')](config[_0x7822('0xb6')],_0x7822('0xb9'),_0x8befcc[_0x7822('0xb1')]));}}})[_0x7822('0x4b')](handleError(_0x15beb7,null));};exports[_0x7822('0xba')]=function(_0x222a8c,_0x494acb){return db['User'][_0x7822('0x54')]({'where':{'id':_0x222a8c[_0x7822('0x4c')]['id']},'attributes':['id']})[_0x7822('0x13')](handleEntityNotFound(_0x494acb,null))['then'](function(_0x4002f4){var _0x3cbabe=[];values=_0x4002f4['dataValues'];_0x3cbabe['push'](get_open_tabs('chat',_0x4002f4['dataValues']));_0x3cbabe[_0x7822('0x3e')](get_open_tabs('sms',_0x4002f4[_0x7822('0x45')]));_0x3cbabe[_0x7822('0x3e')](get_open_tabs(_0x7822('0x48'),_0x4002f4[_0x7822('0x45')]));_0x3cbabe[_0x7822('0x3e')](get_open_tabs(_0x7822('0x49'),_0x4002f4[_0x7822('0x45')]));_0x3cbabe[_0x7822('0x3e')](get_open_tabs(_0x7822('0x55'),_0x4002f4[_0x7822('0x45')]));_0x3cbabe[_0x7822('0x3e')](get_open_tabs('mail',_0x4002f4['dataValues']));return BPromise['all'](_0x3cbabe);})[_0x7822('0x13')](function(_0x129338){var _0x1dba8d=[];if(_0x129338){for(var _0x55499f=0x0;_0x55499f=_0x3b83b0[_0x1e67('0x51')]){throw new Error(_0x1e67('0x52'));}})[_0x1e67('0xf')](function(){if(_0x8c6dd0){return db['UserVoiceQueueRt'][_0x1e67('0x4a')]({'where':{'membername':_0x8c6dd0[_0x1e67('0x26')]},'individualHooks':!![]});}})[_0x1e67('0xf')](function(){if(_0x8c6dd0){return _0x8c6dd0[_0x1e67('0x53')]({'raw':!![]});}})[_0x1e67('0xf')](function(_0x12fc35){if(_0x8c6dd0){if(_0x12fc35){var _0x3d0850=[];_0x1af026=_0x12fc35;if(_0x1af026[_0x1e67('0x2d')]){for(var _0x2d2476=0x0;_0x2d2476<_0x1af026[_0x1e67('0x2d')];_0x2d2476++){_0x3d0850[_0x1e67('0x32')](db[_0x1e67('0x29')][_0x1e67('0x54')]({'membername':_0x8c6dd0[_0x1e67('0x26')],'UserId':_0x8c6dd0['id'],'queue_name':_0x1af026[_0x2d2476]['name'],'VoiceQueueId':_0x1af026[_0x2d2476]['id'],'interface':_0x104b9a,'paused':_0x8c6dd0[_0x1e67('0x4d')]||![],'penalty':_0x1af026[_0x2d2476][_0x1e67('0x55')]||0x0}));}return BPromise[_0x1e67('0x48')](_0x3d0850);}}}})[_0x1e67('0xf')](function(){if(_0x8c6dd0){return db[_0x1e67('0x2b')][_0x1e67('0x1a')]({'where':{'membername':_0x8c6dd0[_0x1e67('0x26')],'exitAt':null}});}})[_0x1e67('0xf')](function(_0x274492){if(_0x8c6dd0){if(_0x274492&&_0x274492[_0x1e67('0x2d')]){var _0x308a3f=[];_0x274492[_0x1e67('0x31')](function(_0x25e28d){_0x308a3f[_0x1e67('0x32')](_0x25e28d[_0x1e67('0x2a')]({'exitAt':moment()[_0x1e67('0x2e')](_0x1e67('0x2f'))}));});return BPromise['all'](_0x308a3f);}}})[_0x1e67('0xf')](function(_0x1ac9e1){if(_0x8c6dd0){var _0x5b76e6=[];var _0x2a7793=[];var _0x15acbf=utils[_0x1e67('0x56')]();var _0x1ac6b0={'membername':_0x8c6dd0['name'],'interface':_0x104b9a,'enterAt':moment()[_0x1e67('0x2e')](_0x1e67('0x2f')),'role':_0x8c6dd0[_0x1e67('0x27')],'internal':_0x8c6dd0[_0x1e67('0x36')]};_0x15acbf[_0x1e67('0x31')](function(_0x501565){_0x5b76e6['push'](_[_0x1e67('0x57')]({'channel':_0x501565,'type':'LOGIN','data1':_0x1e67('0x58'),'data2':_0x104b9a},_0x1ac6b0));if(_0x8c6dd0[_0x1e67('0x4d')]){_0x2a7793['push'](_[_0x1e67('0x57')]({'channel':_0x501565,'type':_0x1e67('0x2c'),'data1':_0x1e67('0x59')},_0x1ac6b0));}});return db[_0x1e67('0x2b')][_0x1e67('0x38')](_0x5b76e6['concat'](_0x2a7793),{'individualHooks':!![]});}})[_0x1e67('0xf')](function(){if(_0x8c6dd0){return _0x8c6dd0[_0x1e67('0x2a')]({'online':!![],'lastLoginAt':moment()[_0x1e67('0x2e')](_0x1e67('0x2f')),'voicePause':_0x8c6dd0[_0x1e67('0x4d')]||![],'mailPause':_0x8c6dd0['loginInPause']||![],'chatPause':_0x8c6dd0[_0x1e67('0x4d')]||![],'faxPause':_0x8c6dd0[_0x1e67('0x4d')]||![],'smsPause':_0x8c6dd0[_0x1e67('0x4d')]||![],'openchannelPause':_0x8c6dd0['loginInPause']||![],'pauseType':_0x8c6dd0[_0x1e67('0x4d')]?_0x1e67('0x59'):null,'lastPauseAt':moment()[_0x1e67('0x2e')](_0x1e67('0x2f')),'interface':_0x104b9a});}})['then'](function(_0x33063a){_0x3c2e93(_0x33063a);})[_0x1e67('0x17')](function(_0x99dcf2){_0x5b1125(_0x18435c[_0x1e67('0x13')](0x1f4,_0x99dcf2[_0x1e67('0x15')]));});});}; \ No newline at end of file +var _0x34b0=['type','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','system','mail','chat','fax','sms','openchannel','%s%s','Pause','forEach','all','LogoutUser','destroy','role','mobile','phone','loginInPause','SIP/%s','../../config/license/util','getLicense','agents','getVoiceQueues','upsert','merge','callysquare','LOGININPAUSE','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./user.socket','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','code','error','message','result','GetUser','User','findAll','options','where','attributes','include','map','model','stringify','catch','ShowUser','find','raw','PauseUser','internal','interface','UserVoiceQueueRt','update','MemberReport','name','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','getChannels','push','isNil','format','body','DEFAULT\x20PAUSE','bulkCreate'];(function(_0x2e093f,_0x1e2e14){var _0x5ee5f7=function(_0x4bb4ec){while(--_0x4bb4ec){_0x2e093f['push'](_0x2e093f['shift']());}};_0x5ee5f7(++_0x1e2e14);}(_0x34b0,0xcf));var _0x034b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x34b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x034b('0x0'));var util=require('util');var moment=require(_0x034b('0x1'));var BPromise=require('bluebird');var rs=require(_0x034b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x034b('0x3'));var logger=require(_0x034b('0x4'))(_0x034b('0x5'));var config=require('../../config/environment');var jayson=require(_0x034b('0x6'));var client=jayson[_0x034b('0x7')][_0x034b('0x8')]({'port':0x232a});config[_0x034b('0x9')]=_[_0x034b('0xa')](config[_0x034b('0x9')],{'host':_0x034b('0xb'),'port':0x18eb});var socket=require(_0x034b('0xc'))(new Redis(config[_0x034b('0x9')]));require(_0x034b('0xd'))[_0x034b('0xe')](socket);function respondWithRpcPromise(_0x497917,_0x12b633,_0x410e90){return new BPromise(function(_0x30cd52,_0x475963){return client[_0x034b('0xf')](_0x497917,_0x410e90)[_0x034b('0x10')](function(_0x8baa82){logger[_0x034b('0x11')](_0x034b('0x12'),_0x12b633,_0x034b('0x13'));logger[_0x034b('0x14')](_0x034b('0x15'),_0x12b633,_0x034b('0x13'),JSON['stringify'](_0x8baa82));if(_0x8baa82['error']){if(_0x8baa82['error'][_0x034b('0x16')]===0x1f4){logger[_0x034b('0x17')](_0x034b('0x12'),_0x12b633,_0x8baa82[_0x034b('0x17')][_0x034b('0x18')]);return _0x475963(_0x8baa82[_0x034b('0x17')]['message']);}logger[_0x034b('0x17')](_0x034b('0x12'),_0x12b633,_0x8baa82[_0x034b('0x17')]['message']);return _0x30cd52(_0x8baa82[_0x034b('0x17')][_0x034b('0x18')]);}else{logger['info'](_0x034b('0x12'),_0x12b633,_0x034b('0x13'));_0x30cd52(_0x8baa82[_0x034b('0x19')][_0x034b('0x18')]);}})['catch'](function(_0x3b04c3){logger['error'](_0x034b('0x12'),_0x12b633,_0x3b04c3);_0x475963(_0x3b04c3);});});}exports[_0x034b('0x1a')]=function(_0x6759cc){var _0x184664=this;return new Promise(function(_0x2f5925,_0x17c7c0){return db[_0x034b('0x1b')][_0x034b('0x1c')]({'raw':_0x6759cc[_0x034b('0x1d')]?_0x6759cc['options']['raw']===undefined?!![]:![]:!![],'where':_0x6759cc['options']?_0x6759cc[_0x034b('0x1d')][_0x034b('0x1e')]||null:null,'attributes':_0x6759cc[_0x034b('0x1d')]?_0x6759cc['options'][_0x034b('0x1f')]||null:null,'limit':_0x6759cc[_0x034b('0x1d')]?_0x6759cc[_0x034b('0x1d')]['limit']||null:null,'include':_0x6759cc[_0x034b('0x1d')]?_0x6759cc[_0x034b('0x1d')][_0x034b('0x20')]?_[_0x034b('0x21')](_0x6759cc[_0x034b('0x1d')][_0x034b('0x20')],function(_0x219101){return{'model':db[_0x219101['model']],'as':_0x219101['as'],'attributes':_0x219101[_0x034b('0x1f')],'include':_0x219101['include']?_[_0x034b('0x21')](_0x219101['include'],function(_0x53c90c){return{'model':db[_0x53c90c[_0x034b('0x22')]],'as':_0x53c90c['as'],'attributes':_0x53c90c['attributes'],'include':_0x53c90c[_0x034b('0x20')]?_['map'](_0x53c90c['include'],function(_0x21e322){return{'model':db[_0x21e322[_0x034b('0x22')]],'as':_0x21e322['as'],'attributes':_0x21e322[_0x034b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x034b('0x10')](function(_0x31881f){logger['info'](_0x034b('0x1a'),_0x6759cc);logger[_0x034b('0x14')](_0x034b('0x1a'),_0x6759cc,JSON[_0x034b('0x23')](_0x31881f));_0x2f5925(_0x31881f);})[_0x034b('0x24')](function(_0x8225f0){logger[_0x034b('0x17')](_0x034b('0x1a'),_0x8225f0[_0x034b('0x18')],_0x6759cc);_0x17c7c0(_0x184664[_0x034b('0x17')](0x1f4,_0x8225f0[_0x034b('0x18')]));});});};exports[_0x034b('0x25')]=function(_0x55c1d0){var _0x49b9f9=this;return new Promise(function(_0x49ed13,_0x3956b8){return db['User'][_0x034b('0x26')]({'raw':_0x55c1d0[_0x034b('0x1d')]?_0x55c1d0[_0x034b('0x1d')][_0x034b('0x27')]===undefined?!![]:![]:!![],'where':_0x55c1d0[_0x034b('0x1d')]?_0x55c1d0[_0x034b('0x1d')][_0x034b('0x1e')]||null:null,'attributes':_0x55c1d0[_0x034b('0x1d')]?_0x55c1d0[_0x034b('0x1d')][_0x034b('0x1f')]||null:null,'include':_0x55c1d0[_0x034b('0x1d')]?_0x55c1d0[_0x034b('0x1d')][_0x034b('0x20')]?_[_0x034b('0x21')](_0x55c1d0[_0x034b('0x1d')][_0x034b('0x20')],function(_0x3a4b5d){return{'model':db[_0x3a4b5d['model']],'as':_0x3a4b5d['as'],'attributes':_0x3a4b5d[_0x034b('0x1f')],'include':_0x3a4b5d[_0x034b('0x20')]?_[_0x034b('0x21')](_0x3a4b5d[_0x034b('0x20')],function(_0x2a5e74){return{'model':db[_0x2a5e74[_0x034b('0x22')]],'as':_0x2a5e74['as'],'attributes':_0x2a5e74[_0x034b('0x1f')],'include':_0x2a5e74['include']?_[_0x034b('0x21')](_0x2a5e74[_0x034b('0x20')],function(_0x14948d){return{'model':db[_0x14948d[_0x034b('0x22')]],'as':_0x14948d['as'],'attributes':_0x14948d['attributes']};}):[]};}):[]};}):[]:[]})[_0x034b('0x10')](function(_0x2fd0e7){logger[_0x034b('0x11')]('ShowUser',_0x55c1d0);logger[_0x034b('0x14')]('ShowUser',_0x55c1d0,JSON[_0x034b('0x23')](_0x2fd0e7));_0x49ed13(_0x2fd0e7);})[_0x034b('0x24')](function(_0x101b4b){logger['error'](_0x034b('0x25'),_0x101b4b['message'],_0x55c1d0);_0x3956b8(_0x49b9f9['error'](0x1f4,_0x101b4b[_0x034b('0x18')]));});});};exports[_0x034b('0x28')]=function(_0x33225e){var _0x479692=this;return new Promise(function(_0x1c378a,_0x18cff8){var _0x4143cf;return db[_0x034b('0x1b')][_0x034b('0x26')]({'where':_0x33225e[_0x034b('0x1d')]['where']||{},'attributes':['id','name','role',_0x034b('0x29'),_0x034b('0x2a')]})[_0x034b('0x10')](function(_0x1cdf3f){if(_0x1cdf3f){_0x4143cf=_0x1cdf3f;return db[_0x034b('0x2b')][_0x034b('0x2c')]({'paused':0x1},{'where':{'UserId':_0x4143cf['id']},'individualHooks':!![]});}})[_0x034b('0x10')](function(){if(_0x4143cf){return db[_0x034b('0x2d')][_0x034b('0x1c')]({'where':{'membername':_0x4143cf[_0x034b('0x2e')],'type':_0x034b('0x2f'),'exitAt':null}});}})[_0x034b('0x10')](function(_0x101536){if(_0x4143cf){if(_0x101536&&_0x101536[_0x034b('0x30')]){var _0x317a80=moment()['format'](_0x034b('0x31'));for(var _0x79a8dc=0x0,_0xdb9040=_0x101536[_0x034b('0x30')];_0x79a8dc<_0xdb9040;_0x79a8dc++){_0x101536[_0x79a8dc]['updateAttributes']({'exitAt':_0x317a80});}}}})['then'](function(){if(_0x4143cf){var _0x1ba5a1=[];var _0x249d3d=utils[_0x034b('0x32')]();_0x249d3d['forEach'](function(_0xa879fc){_0x1ba5a1[_0x034b('0x33')]({'channel':_0xa879fc,'membername':_0x4143cf['name'],'interface':_[_0x034b('0x34')](_0x4143cf[_0x034b('0x2a')])?util[_0x034b('0x35')]('SIP/%s',_0x4143cf['name']):_0x4143cf[_0x034b('0x2a')],'type':'PAUSE','enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x33225e[_0x034b('0x36')]['type']||_0x034b('0x37'),'role':_0x4143cf['role'],'internal':_0x4143cf['internal'],'uniqueid':_0x33225e[_0x034b('0x36')]['uniqueid']||null});});return db[_0x034b('0x2d')][_0x034b('0x38')](_0x1ba5a1,{'individualHooks':!![]});}})[_0x034b('0x10')](function(){if(_0x4143cf){return _0x4143cf[_0x034b('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x33225e[_0x034b('0x36')][_0x034b('0x39')]||_0x034b('0x37'),'lastPauseAt':moment()[_0x034b('0x35')](_0x034b('0x31'))});}})[_0x034b('0x10')](function(_0x5571df){_0x1c378a(_0x5571df);})[_0x034b('0x24')](function(_0x2782ed){_0x18cff8(_0x479692[_0x034b('0x17')](0x1f4,_0x2782ed[_0x034b('0x18')]));});});};exports[_0x034b('0x3a')]=function(_0xc4632c){var _0x364480=this;return new Promise(function(_0xfa1b,_0x3a1caa){var _0x80cafc;return db[_0x034b('0x1b')][_0x034b('0x3b')]({'where':_0xc4632c['options'][_0x034b('0x1e')]||{},'attributes':['id',_0x034b('0x2e')]})[_0x034b('0x10')](function(_0x3ac482){if(_0x3ac482){_0x80cafc=_0x3ac482;if(_0xc4632c[_0x034b('0x36')][_0x034b('0x3c')]&&!utils[_0x034b('0x3d')](_0xc4632c[_0x034b('0x36')][_0x034b('0x3c')])){throw new Error(_0x034b('0x3e'));}switch(_0xc4632c[_0x034b('0x36')][_0x034b('0x3c')]){case'voice':return db[_0x034b('0x2b')][_0x034b('0x2c')]({'paused':0x0},{'where':{'UserId':_0x80cafc['id']}})[_0x034b('0x10')](function(){return db[_0x034b('0x2d')]['find']({'where':{'channel':_0xc4632c[_0x034b('0x36')][_0x034b('0x3c')],'membername':_0x80cafc[_0x034b('0x2e')],'type':_0x034b('0x2f'),'exitAt':null}});})['then'](function(_0x29b737){if(_0x29b737){return _0x29b737[_0x034b('0x2c')]({'exitAt':moment()[_0x034b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x034b('0x3f')},{'individualHooks':!![]});}return null;})[_0x034b('0x10')](function(){return _0x80cafc[_0x034b('0x2c')]({'voicePause':![]});});case _0x034b('0x40'):case _0x034b('0x41'):case _0x034b('0x42'):case _0x034b('0x43'):case _0x034b('0x44'):case'whatsapp':return db[_0x034b('0x2d')][_0x034b('0x26')]({'where':{'channel':_0xc4632c['body'][_0x034b('0x3c')],'membername':_0x80cafc[_0x034b('0x2e')],'type':_0x034b('0x2f'),'exitAt':null}})['then'](function(_0x24e451){return _0x24e451['update']({'exitAt':moment()[_0x034b('0x35')](_0x034b('0x31')),'data2':_0x034b('0x3f')},{'individualHooks':!![]});})[_0x034b('0x10')](function(){var _0x1bfcbe={};_['set'](_0x1bfcbe,util[_0x034b('0x35')](_0x034b('0x45'),_0xc4632c[_0x034b('0x36')][_0x034b('0x3c')],_0x034b('0x46')),![]);return _0x80cafc[_0x034b('0x2c')](_0x1bfcbe);});default:return db[_0x034b('0x2b')][_0x034b('0x2c')]({'paused':0x0},{'where':{'UserId':_0x80cafc['id']}})['then'](function(){return db['MemberReport'][_0x034b('0x1c')]({'where':{'membername':_0x80cafc[_0x034b('0x2e')],'type':_0x034b('0x2f'),'exitAt':null}});})[_0x034b('0x10')](function(_0x507ab1){var _0x122d8d=[];_0x507ab1[_0x034b('0x47')](function(_0x58bb62){_0x122d8d[_0x034b('0x33')](_0x58bb62['update']({'exitAt':moment()[_0x034b('0x35')](_0x034b('0x31')),'data2':'system'}));});return BPromise[_0x034b('0x48')](_0x122d8d);})[_0x034b('0x10')](function(){return _0x80cafc[_0x034b('0x2c')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x513920){_0xfa1b(_0x513920);})[_0x034b('0x24')](function(_0x336c59){_0x3a1caa(_0x364480[_0x034b('0x17')](0x1f4,_0x336c59['message']));});});};exports[_0x034b('0x49')]=function(_0x181b04){var _0x125510=this;return new Promise(function(_0x53502e,_0x4cd4ea){var _0x5f55b2;return db[_0x034b('0x1b')][_0x034b('0x3b')]({'where':_0x181b04[_0x034b('0x1d')][_0x034b('0x1e')]||{},'attributes':['id','name']})[_0x034b('0x10')](function(_0x38ce35){if(_0x38ce35){_0x5f55b2=_0x38ce35;return db[_0x034b('0x2b')][_0x034b('0x4a')]({'where':{'membername':_0x5f55b2['name']},'individualHooks':!![]});}})[_0x034b('0x10')](function(){if(_0x5f55b2){return db[_0x034b('0x2d')][_0x034b('0x1c')]({'where':{'membername':_0x5f55b2[_0x034b('0x2e')],'exitAt':null}});}})[_0x034b('0x10')](function(_0x632ba6){if(_0x5f55b2){if(_0x632ba6&&_0x632ba6[_0x034b('0x30')]){var _0x1ce652=[];_0x632ba6[_0x034b('0x47')](function(_0x39d4df){_0x1ce652['push'](_0x39d4df[_0x034b('0x2c')]({'exitAt':moment()[_0x034b('0x35')](_0x034b('0x31'))}));});return BPromise['all'](_0x1ce652);}}})['then'](function(){if(_0x5f55b2){return _0x5f55b2[_0x034b('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x034b('0x10')](function(_0x204933){_0x53502e(_0x204933);})[_0x034b('0x24')](function(_0x10e160){_0x4cd4ea(_0x125510[_0x034b('0x17')](0x1f4,_0x10e160[_0x034b('0x18')]));});});};exports['LoginUser']=function(_0x1a292b){var _0x1447d7=this;return new Promise(function(_0x2fa756,_0xfcc136){var _0x167ac8;var _0x559a0d;var _0x36be6a;var _0x30730e;return db[_0x034b('0x1b')][_0x034b('0x3b')]({'where':_0x1a292b['options'][_0x034b('0x1e')]||{},'attributes':['id',_0x034b('0x2e'),_0x034b('0x4b'),_0x034b('0x4c'),_0x034b('0x4d'),_0x034b('0x29'),_0x034b('0x4e'),'interface']})[_0x034b('0x10')](function(_0x2b5635){if(_0x2b5635){_0x167ac8=_0x2b5635;_0x30730e=_0x1a292b[_0x034b('0x36')]['interface']?_0x1a292b[_0x034b('0x36')][_0x034b('0x2a')]:util[_0x034b('0x35')](_0x034b('0x4f'),_0x167ac8[_0x034b('0x2e')]);return db['User']['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x167ac8['id']}}});}})[_0x034b('0x10')](function(_0x23be5c){if(_0x23be5c){_0x36be6a=_0x23be5c;return require(_0x034b('0x50'))[_0x034b('0x51')]();}})[_0x034b('0x10')](function(_0x2ff2c7){if(_0x2ff2c7&&_0x2ff2c7[_0x034b('0x52')]&&_0x36be6a>=_0x2ff2c7['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x167ac8){return db[_0x034b('0x2b')][_0x034b('0x4a')]({'where':{'membername':_0x167ac8[_0x034b('0x2e')]},'individualHooks':!![]});}})[_0x034b('0x10')](function(){if(_0x167ac8){return _0x167ac8[_0x034b('0x53')]({'raw':!![]});}})['then'](function(_0x254fdf){if(_0x167ac8){if(_0x254fdf){var _0x33202d=[];_0x559a0d=_0x254fdf;if(_0x559a0d[_0x034b('0x30')]){for(var _0x11ee6c=0x0;_0x11ee6c<_0x559a0d['length'];_0x11ee6c++){_0x33202d[_0x034b('0x33')](db['UserVoiceQueueRt'][_0x034b('0x54')]({'membername':_0x167ac8[_0x034b('0x2e')],'UserId':_0x167ac8['id'],'queue_name':_0x559a0d[_0x11ee6c][_0x034b('0x2e')],'VoiceQueueId':_0x559a0d[_0x11ee6c]['id'],'interface':_0x30730e,'paused':_0x167ac8[_0x034b('0x4e')]||![],'penalty':_0x559a0d[_0x11ee6c]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x034b('0x48')](_0x33202d);}}}})['then'](function(){if(_0x167ac8){return db[_0x034b('0x2d')][_0x034b('0x1c')]({'where':{'membername':_0x167ac8['name'],'exitAt':null}});}})[_0x034b('0x10')](function(_0x54f952){if(_0x167ac8){if(_0x54f952&&_0x54f952[_0x034b('0x30')]){var _0x52a5f3=[];_0x54f952[_0x034b('0x47')](function(_0x3c681b){_0x52a5f3['push'](_0x3c681b[_0x034b('0x2c')]({'exitAt':moment()[_0x034b('0x35')](_0x034b('0x31'))}));});return BPromise[_0x034b('0x48')](_0x52a5f3);}}})['then'](function(_0x2fe651){if(_0x167ac8){var _0x1e2dc6=[];var _0x3f9df8=[];var _0x110550=utils[_0x034b('0x32')]();var _0x5e898a={'membername':_0x167ac8[_0x034b('0x2e')],'interface':_0x30730e,'enterAt':moment()[_0x034b('0x35')](_0x034b('0x31')),'role':_0x167ac8[_0x034b('0x4b')],'internal':_0x167ac8[_0x034b('0x29')]};_0x110550[_0x034b('0x47')](function(_0x10df22){_0x1e2dc6['push'](_[_0x034b('0x55')]({'channel':_0x10df22,'type':'LOGIN','data1':_0x034b('0x56'),'data2':_0x30730e},_0x5e898a));if(_0x167ac8[_0x034b('0x4e')]){_0x3f9df8['push'](_[_0x034b('0x55')]({'channel':_0x10df22,'type':_0x034b('0x2f'),'data1':_0x034b('0x57')},_0x5e898a));}});return db[_0x034b('0x2d')][_0x034b('0x38')](_0x1e2dc6['concat'](_0x3f9df8),{'individualHooks':!![]});}})[_0x034b('0x10')](function(){if(_0x167ac8){return _0x167ac8[_0x034b('0x2c')]({'online':!![],'lastLoginAt':moment()[_0x034b('0x35')](_0x034b('0x31')),'voicePause':_0x167ac8[_0x034b('0x4e')]||![],'mailPause':_0x167ac8[_0x034b('0x4e')]||![],'chatPause':_0x167ac8[_0x034b('0x4e')]||![],'faxPause':_0x167ac8[_0x034b('0x4e')]||![],'smsPause':_0x167ac8[_0x034b('0x4e')]||![],'openchannelPause':_0x167ac8[_0x034b('0x4e')]||![],'pauseType':_0x167ac8['loginInPause']?_0x034b('0x57'):null,'lastPauseAt':moment()['format'](_0x034b('0x31')),'interface':_0x30730e});}})[_0x034b('0x10')](function(_0x496cef){_0x2fa756(_0x496cef);})['catch'](function(_0x514172){_0xfcc136(_0x1447d7['error'](0x1f4,_0x514172[_0x034b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 01ff2e9..a9de876 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 _0x156e=['removeListener','register','length','user:','./user.events','save','remove','update','emit'];(function(_0x2976de,_0x4c546d){var _0xecbf51=function(_0x234025){while(--_0x234025){_0x2976de['push'](_0x2976de['shift']());}};_0xecbf51(++_0x4c546d);}(_0x156e,0xdc));var _0xe156=function(_0x537ef8,_0x4c806f){_0x537ef8=_0x537ef8-0x0;var _0x29f523=_0x156e[_0x537ef8];return _0x29f523;};'use strict';var UserEvents=require(_0xe156('0x0'));var events=[_0xe156('0x1'),_0xe156('0x2'),_0xe156('0x3')];function createListener(_0x1aa89e,_0x4f335d){return function(_0x2735eb){_0x4f335d[_0xe156('0x4')](_0x1aa89e,_0x2735eb);};}function removeListener(_0x4f51cd,_0x2a6e66){return function(){UserEvents[_0xe156('0x5')](_0x4f51cd,_0x2a6e66);};}exports[_0xe156('0x6')]=function(_0x3593a4){for(var _0x4a300f=0x0,_0x757bfb=events[_0xe156('0x7')];_0x4a300f<_0x757bfb;_0x4a300f++){var _0x4f8f3a=events[_0x4a300f];var _0x156487=createListener(_0xe156('0x8')+_0x4f8f3a,_0x3593a4);UserEvents['on'](_0x4f8f3a,_0x156487);}}; \ No newline at end of file +var _0x9571=['./user.events','save','update','removeListener','register','length','user:'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9571,0xf5));var _0x1957=function(_0x97d4b6,_0x1b8eab){_0x97d4b6=_0x97d4b6-0x0;var _0x364238=_0x9571[_0x97d4b6];return _0x364238;};'use strict';var UserEvents=require(_0x1957('0x0'));var events=[_0x1957('0x1'),'remove',_0x1957('0x2')];function createListener(_0x513b82,_0x4a09d7){return function(_0x8e760){_0x4a09d7['emit'](_0x513b82,_0x8e760);};}function removeListener(_0x109879,_0x346709){return function(){UserEvents[_0x1957('0x3')](_0x109879,_0x346709);};}exports[_0x1957('0x4')]=function(_0x301674){for(var _0x4ec0aa=0x0,_0x5b93da=events[_0x1957('0x5')];_0x4ec0aa<_0x5b93da;_0x4ec0aa++){var _0x1d28d0=events[_0x4ec0aa];var _0x1e0ecc=createListener(_0x1957('0x6')+_0x1d28d0,_0x301674);UserEvents['on'](_0x1d28d0,_0x1e0ecc);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index e402bce..10091e3 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xbfc389,_0x5aad2e){var _0x31583a=function(_0x3fddcd){while(--_0x3fddcd){_0xbfc389['push'](_0xbfc389['shift']());}};_0x31583a(++_0x5aad2e);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3c3b57,_0x5c6241){var _0x630592=function(_0x527535){while(--_0x527535){_0x3c3b57['push'](_0x3c3b57['shift']());}};_0x630592(++_0x5c6241);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 4beace9..e031a07 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 _0x0185=['INTEGER'];(function(_0x3f465d,_0xbd2037){var _0x121ad1=function(_0x5b13d6){while(--_0x5b13d6){_0x3f465d['push'](_0x3f465d['shift']());}};_0x121ad1(++_0xbd2037);}(_0x0185,0x1ac));var _0x5018=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0x0185[_0x3b150c];return _0x5cd414;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x5018('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5370=['INTEGER','sequelize'];(function(_0x18799b,_0x17b1da){var _0x411b80=function(_0x1a8a73){while(--_0x1a8a73){_0x18799b['push'](_0x18799b['shift']());}};_0x411b80(++_0x17b1da);}(_0x5370,0x18f));var _0x0537=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5370[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x0537('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0537('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 a06cf3f..73c4e99 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 _0x9d05=['request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','util'];(function(_0x2ed94b,_0x2f0c86){var _0x422d21=function(_0x22d304){while(--_0x22d304){_0x2ed94b['push'](_0x2ed94b['shift']());}};_0x422d21(++_0x2f0c86);}(_0x9d05,0x19d));var _0x59d0=function(_0x3fb46e,_0xe29c0b){_0x3fb46e=_0x3fb46e-0x0;var _0x251c96=_0x9d05[_0x3fb46e];return _0x251c96;};'use strict';var _=require('lodash');var util=require(_0x59d0('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x59d0('0x1'));var fs=require('fs');var path=require(_0x59d0('0x2'));var rimraf=require(_0x59d0('0x3'));var config=require(_0x59d0('0x4'));var attributes=require(_0x59d0('0x5'));module[_0x59d0('0x6')]=function(_0x369e41,_0x8fbcdd){return _0x369e41['define'](_0x59d0('0x7'),attributes,{'tableName':_0x59d0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7193=['user_has_chat_queues','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserChatQueue'];(function(_0x8e9097,_0x3892f3){var _0x353377=function(_0x53b6be){while(--_0x53b6be){_0x8e9097['push'](_0x8e9097['shift']());}};_0x353377(++_0x3892f3);}(_0x7193,0xc7));var _0x3719=function(_0x39b316,_0x3def1e){_0x39b316=_0x39b316-0x0;var _0x182ab1=_0x7193[_0x39b316];return _0x182ab1;};'use strict';var _=require(_0x3719('0x0'));var util=require(_0x3719('0x1'));var logger=require('../../config/logger')(_0x3719('0x2'));var moment=require('moment');var BPromise=require(_0x3719('0x3'));var rp=require(_0x3719('0x4'));var fs=require('fs');var path=require(_0x3719('0x5'));var rimraf=require(_0x3719('0x6'));var config=require(_0x3719('0x7'));var attributes=require('./userChatQueue.attributes');module[_0x3719('0x8')]=function(_0xd2afc9,_0x3f0bf1){return _0xd2afc9['define'](_0x3719('0x9'),attributes,{'tableName':_0x3719('0xa'),'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 1c71419..30f0f93 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 _0x27f1=['message','catch','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5e7514,_0x30c2e1){var _0x12f472=function(_0x33ddb6){while(--_0x33ddb6){_0x5e7514['push'](_0x5e7514['shift']());}};_0x12f472(++_0x30c2e1);}(_0x27f1,0xda));var _0x127f=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0x27f1[_0x5e28c2];return _0x1a8cc6;};'use strict';var _=require('lodash');var util=require(_0x127f('0x0'));var moment=require(_0x127f('0x1'));var BPromise=require(_0x127f('0x2'));var rs=require(_0x127f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x127f('0x4'))(_0x127f('0x5'));var config=require('../../config/environment');var jayson=require(_0x127f('0x6'));var client=jayson[_0x127f('0x7')][_0x127f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x107f7c,_0x91347d,_0x2b490f){return new BPromise(function(_0x5b7f37,_0x477c62){return client['request'](_0x107f7c,_0x2b490f)[_0x127f('0x9')](function(_0x17c9bc){logger[_0x127f('0xa')](_0x127f('0xb'),_0x91347d,_0x127f('0xc'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x91347d,'request\x20sent',JSON[_0x127f('0xd')](_0x17c9bc));if(_0x17c9bc['error']){if(_0x17c9bc[_0x127f('0xe')][_0x127f('0xf')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x91347d,_0x17c9bc[_0x127f('0xe')][_0x127f('0x10')]);return _0x477c62(_0x17c9bc['error'][_0x127f('0x10')]);}logger[_0x127f('0xe')](_0x127f('0xb'),_0x91347d,_0x17c9bc[_0x127f('0xe')][_0x127f('0x10')]);return _0x5b7f37(_0x17c9bc[_0x127f('0xe')]['message']);}else{logger['info'](_0x127f('0xb'),_0x91347d,'request\x20sent');_0x5b7f37(_0x17c9bc['result'][_0x127f('0x10')]);}})[_0x127f('0x11')](function(_0x211e6a){logger[_0x127f('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x91347d,_0x211e6a);_0x477c62(_0x211e6a);});});} \ No newline at end of file +var _0x7e88=['error','code','result','message','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x22b3ce,_0x269b45){var _0x4b493d=function(_0x420069){while(--_0x420069){_0x22b3ce['push'](_0x22b3ce['shift']());}};_0x4b493d(++_0x269b45);}(_0x7e88,0x134));var _0x87e8=function(_0x5a0724,_0x9f230f){_0x5a0724=_0x5a0724-0x0;var _0x5df941=_0x7e88[_0x5a0724];return _0x5df941;};'use strict';var _=require(_0x87e8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x87e8('0x1'));var rs=require(_0x87e8('0x2'));var fs=require('fs');var Redis=require(_0x87e8('0x3'));var db=require(_0x87e8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x87e8('0x5'))(_0x87e8('0x6'));var config=require(_0x87e8('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x56dbf9,_0x132db6,_0x2b2eae){return new BPromise(function(_0x2ca883,_0x7f28cf){return client[_0x87e8('0x8')](_0x56dbf9,_0x2b2eae)['then'](function(_0x5de49d){logger[_0x87e8('0x9')](_0x87e8('0xa'),_0x132db6,_0x87e8('0xb'));logger[_0x87e8('0xc')](_0x87e8('0xd'),_0x132db6,'request\x20sent',JSON[_0x87e8('0xe')](_0x5de49d));if(_0x5de49d['error']){if(_0x5de49d[_0x87e8('0xf')][_0x87e8('0x10')]===0x1f4){logger[_0x87e8('0xf')](_0x87e8('0xa'),_0x132db6,_0x5de49d[_0x87e8('0xf')]['message']);return _0x7f28cf(_0x5de49d[_0x87e8('0xf')]['message']);}logger[_0x87e8('0xf')](_0x87e8('0xa'),_0x132db6,_0x5de49d[_0x87e8('0xf')]['message']);return _0x2ca883(_0x5de49d[_0x87e8('0xf')]['message']);}else{logger[_0x87e8('0x9')](_0x87e8('0xa'),_0x132db6,'request\x20sent');_0x2ca883(_0x5de49d[_0x87e8('0x11')][_0x87e8('0x12')]);}})['catch'](function(_0x27fae9){logger[_0x87e8('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x132db6,_0x27fae9);_0x7f28cf(_0x27fae9);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 15622c8..f07e2c6 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x24e88b,_0x443671){var _0x346d24=function(_0x3e8e4f){while(--_0x3e8e4f){_0x24e88b['push'](_0x24e88b['shift']());}};_0x346d24(++_0x443671);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1132da,_0x19b175){var _0x36f848=function(_0x3baa4f){while(--_0x3baa4f){_0x1132da['push'](_0x1132da['shift']());}};_0x36f848(++_0x19b175);}(_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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index cdedde5..b22a083 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 _0x5fef=['STRING','sequelize','INTEGER'];(function(_0xff0163,_0x38d580){var _0x170bf5=function(_0x5384fc){while(--_0x5384fc){_0xff0163['push'](_0xff0163['shift']());}};_0x170bf5(++_0x38d580);}(_0x5fef,0x124));var _0xf5fe=function(_0x2c6007,_0x3d8be8){_0x2c6007=_0x2c6007-0x0;var _0x59cd24=_0x5fef[_0x2c6007];return _0x59cd24;};'use strict';var Sequelize=require(_0xf5fe('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf5fe('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf5fe('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xf5fe('0x2')]}}; \ No newline at end of file +var _0x156e=['INTEGER','STRING','sequelize','exports'];(function(_0x420513,_0x30eae3){var _0x1b44ec=function(_0x644f88){while(--_0x644f88){_0x420513['push'](_0x420513['shift']());}};_0x1b44ec(++_0x30eae3);}(_0x156e,0x11a));var _0xe156=function(_0x450069,_0x231192){_0x450069=_0x450069-0x0;var _0x37d137=_0x156e[_0x450069];return _0x37d137;};'use strict';var Sequelize=require(_0xe156('0x0'));module[_0xe156('0x1')]={'penalty':{'type':Sequelize[_0xe156('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xe156('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 404ef98..da8036d 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 _0x2649=['./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5eec60,_0x1d91ee){var _0x331e64=function(_0x3cdec3){while(--_0x3cdec3){_0x5eec60['push'](_0x5eec60['shift']());}};_0x331e64(++_0x1d91ee);}(_0x2649,0x1d3));var _0x9264=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0x2649[_0x2b91c5];return _0xbd5531;};'use strict';var _=require(_0x9264('0x0'));var util=require(_0x9264('0x1'));var logger=require(_0x9264('0x2'))(_0x9264('0x3'));var moment=require('moment');var BPromise=require(_0x9264('0x4'));var rp=require(_0x9264('0x5'));var fs=require('fs');var path=require(_0x9264('0x6'));var rimraf=require(_0x9264('0x7'));var config=require(_0x9264('0x8'));var attributes=require(_0x9264('0x9'));module[_0x9264('0xa')]=function(_0x4be598,_0x1d0d82){return _0x4be598[_0x9264('0xb')](_0x9264('0xc'),attributes,{'tableName':_0x9264('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb24=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','user_has_fax_queues','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb24,0x9f));var _0x4db2=function(_0x58e19b,_0x4d5f47){_0x58e19b=_0x58e19b-0x0;var _0x56a20b=_0xdb24[_0x58e19b];return _0x56a20b;};'use strict';var _=require(_0x4db2('0x0'));var util=require(_0x4db2('0x1'));var logger=require(_0x4db2('0x2'))(_0x4db2('0x3'));var moment=require('moment');var BPromise=require(_0x4db2('0x4'));var rp=require(_0x4db2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4db2('0x6'));var config=require(_0x4db2('0x7'));var attributes=require(_0x4db2('0x8'));module['exports']=function(_0x528158,_0x5ada90){return _0x528158['define']('UserFaxQueue',attributes,{'tableName':_0x4db2('0x9'),'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 7703bef..214150d 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 _0xb894=['request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserFaxQueue,\x20%s,\x20%s'];(function(_0x4587dd,_0x53de60){var _0x3b03ce=function(_0x764900){while(--_0x764900){_0x4587dd['push'](_0x4587dd['shift']());}};_0x3b03ce(++_0x53de60);}(_0xb894,0x82));var _0x4b89=function(_0x4ff297,_0xfaa0b){_0x4ff297=_0x4ff297-0x0;var _0x24cdef=_0xb894[_0x4ff297];return _0x24cdef;};'use strict';var _=require('lodash');var util=require(_0x4b89('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4b89('0x1'));var fs=require('fs');var Redis=require(_0x4b89('0x2'));var db=require(_0x4b89('0x3'))['db'];var utils=require(_0x4b89('0x4'));var logger=require(_0x4b89('0x5'))(_0x4b89('0x6'));var config=require(_0x4b89('0x7'));var jayson=require(_0x4b89('0x8'));var client=jayson[_0x4b89('0x9')][_0x4b89('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c6c06,_0x53140a,_0x3014f9){return new BPromise(function(_0x2a3d91,_0x5a7077){return client[_0x4b89('0xb')](_0x1c6c06,_0x3014f9)[_0x4b89('0xc')](function(_0xbea13a){logger['info'](_0x4b89('0xd'),_0x53140a,_0x4b89('0xe'));logger[_0x4b89('0xf')](_0x4b89('0x10'),_0x53140a,_0x4b89('0xe'),JSON[_0x4b89('0x11')](_0xbea13a));if(_0xbea13a[_0x4b89('0x12')]){if(_0xbea13a['error'][_0x4b89('0x13')]===0x1f4){logger[_0x4b89('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x53140a,_0xbea13a[_0x4b89('0x12')]['message']);return _0x5a7077(_0xbea13a[_0x4b89('0x12')][_0x4b89('0x14')]);}logger[_0x4b89('0x12')](_0x4b89('0xd'),_0x53140a,_0xbea13a[_0x4b89('0x12')][_0x4b89('0x14')]);return _0x2a3d91(_0xbea13a[_0x4b89('0x12')]['message']);}else{logger[_0x4b89('0x15')](_0x4b89('0xd'),_0x53140a,_0x4b89('0xe'));_0x2a3d91(_0xbea13a[_0x4b89('0x16')][_0x4b89('0x14')]);}})[_0x4b89('0x17')](function(_0x4cfd2e){logger[_0x4b89('0x12')](_0x4b89('0xd'),_0x53140a,_0x4cfd2e);_0x5a7077(_0x4cfd2e);});});} \ No newline at end of file +var _0xb6eb=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x24b1e6,_0xeb4c8f){var _0x40f903=function(_0x244465){while(--_0x244465){_0x24b1e6['push'](_0x24b1e6['shift']());}};_0x40f903(++_0xeb4c8f);}(_0xb6eb,0x161));var _0xbb6e=function(_0xc525dc,_0x383b97){_0xc525dc=_0xc525dc-0x0;var _0x37f6d1=_0xb6eb[_0xc525dc];return _0x37f6d1;};'use strict';var _=require(_0xbb6e('0x0'));var util=require(_0xbb6e('0x1'));var moment=require('moment');var BPromise=require(_0xbb6e('0x2'));var rs=require(_0xbb6e('0x3'));var fs=require('fs');var Redis=require(_0xbb6e('0x4'));var db=require(_0xbb6e('0x5'))['db'];var utils=require(_0xbb6e('0x6'));var logger=require(_0xbb6e('0x7'))(_0xbb6e('0x8'));var config=require(_0xbb6e('0x9'));var jayson=require(_0xbb6e('0xa'));var client=jayson['client'][_0xbb6e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x261de4,_0x1d488c,_0xc80a9f){return new BPromise(function(_0x39031b,_0x3aa689){return client[_0xbb6e('0xc')](_0x261de4,_0xc80a9f)[_0xbb6e('0xd')](function(_0x48e6d9){logger[_0xbb6e('0xe')](_0xbb6e('0xf'),_0x1d488c,_0xbb6e('0x10'));logger[_0xbb6e('0x11')](_0xbb6e('0x12'),_0x1d488c,_0xbb6e('0x10'),JSON[_0xbb6e('0x13')](_0x48e6d9));if(_0x48e6d9[_0xbb6e('0x14')]){if(_0x48e6d9[_0xbb6e('0x14')][_0xbb6e('0x15')]===0x1f4){logger[_0xbb6e('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x1d488c,_0x48e6d9[_0xbb6e('0x14')][_0xbb6e('0x16')]);return _0x3aa689(_0x48e6d9[_0xbb6e('0x14')][_0xbb6e('0x16')]);}logger[_0xbb6e('0x14')](_0xbb6e('0xf'),_0x1d488c,_0x48e6d9[_0xbb6e('0x14')][_0xbb6e('0x16')]);return _0x39031b(_0x48e6d9['error']['message']);}else{logger[_0xbb6e('0xe')](_0xbb6e('0xf'),_0x1d488c,_0xbb6e('0x10'));_0x39031b(_0x48e6d9[_0xbb6e('0x17')][_0xbb6e('0x16')]);}})[_0xbb6e('0x18')](function(_0x3d697c){logger[_0xbb6e('0x14')](_0xbb6e('0xf'),_0x1d488c,_0x3d697c);_0x3aa689(_0x3d697c);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index a30e805..604cf7f 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x240ba8,_0x335246){var _0x2e0885=function(_0x342e1d){while(--_0x342e1d){_0x240ba8['push'](_0x240ba8['shift']());}};_0x2e0885(++_0x335246);}(_0x70e0,0x17b));var _0x070e=function(_0x1dd8f5,_0x54322a){_0x1dd8f5=_0x1dd8f5-0x0;var _0x4ac9cd=_0x70e0[_0x1dd8f5];return _0x4ac9cd;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1c3ce4,_0x3396d5){var _0x257435=function(_0x5bf4b3){while(--_0x5bf4b3){_0x1c3ce4['push'](_0x1c3ce4['shift']());}};_0x257435(++_0x3396d5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x144b30,_0x77072d){_0x144b30=_0x144b30-0x0;var _0x1bb7bc=_0xcb91[_0x144b30];return _0x1bb7bc;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 3ef8c7f..aa8f1c8 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 _0xcc20=['sequelize','exports'];(function(_0x5c5cc4,_0x3743fa){var _0x302608=function(_0x258182){while(--_0x258182){_0x5c5cc4['push'](_0x5c5cc4['shift']());}};_0x302608(++_0x3743fa);}(_0xcc20,0x108));var _0x0cc2=function(_0x43b01d,_0x170c3e){_0x43b01d=_0x43b01d-0x0;var _0x94ce73=_0xcc20[_0x43b01d];return _0x94ce73;};'use strict';var Sequelize=require(_0x0cc2('0x0'));module[_0x0cc2('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5c97=['INTEGER'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5c97,0x164));var _0x75c9=function(_0x23e9af,_0x29c52c){_0x23e9af=_0x23e9af-0x0;var _0x2c4f8b=_0x5c97[_0x23e9af];return _0x2c4f8b;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x75c9('0x0')],'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 d6bcea1..0779e98 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 _0x49d7=['api','moment','path','rimraf','user_has_mail_queues','lodash','util','../../config/logger'];(function(_0x1fc376,_0x4fbfea){var _0x28073a=function(_0x593ff8){while(--_0x593ff8){_0x1fc376['push'](_0x1fc376['shift']());}};_0x28073a(++_0x4fbfea);}(_0x49d7,0x1b5));var _0x749d=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x49d7[_0x166742];return _0xb7814a;};'use strict';var _=require(_0x749d('0x0'));var util=require(_0x749d('0x1'));var logger=require(_0x749d('0x2'))(_0x749d('0x3'));var moment=require(_0x749d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x749d('0x5'));var rimraf=require(_0x749d('0x6'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x5bde49,_0xfc7c56){return _0x5bde49['define']('UserMailQueue',attributes,{'tableName':_0x749d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc70=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4f3cd1,_0x4b666e){var _0x4f304d=function(_0x5691ad){while(--_0x5691ad){_0x4f3cd1['push'](_0x4f3cd1['shift']());}};_0x4f304d(++_0x4b666e);}(_0xbc70,0x76));var _0x0bc7=function(_0x14760a,_0x317d72){_0x14760a=_0x14760a-0x0;var _0x102ce5=_0xbc70[_0x14760a];return _0x102ce5;};'use strict';var _=require(_0x0bc7('0x0'));var util=require(_0x0bc7('0x1'));var logger=require(_0x0bc7('0x2'))(_0x0bc7('0x3'));var moment=require(_0x0bc7('0x4'));var BPromise=require('bluebird');var rp=require(_0x0bc7('0x5'));var fs=require('fs');var path=require(_0x0bc7('0x6'));var rimraf=require(_0x0bc7('0x7'));var config=require(_0x0bc7('0x8'));var attributes=require(_0x0bc7('0x9'));module[_0x0bc7('0xa')]=function(_0x27252d,_0x5a45dc){return _0x27252d[_0x0bc7('0xb')](_0x0bc7('0xc'),attributes,{'tableName':_0x0bc7('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 0c3f57d..f7a3050 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 _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x11f6f2,_0x56d8b6){var _0x225500=function(_0x56eddc){while(--_0x56eddc){_0x11f6f2['push'](_0x11f6f2['shift']());}};_0x225500(++_0x56d8b6);}(_0x6aa7,0x178));var _0x76aa=function(_0x174f43,_0x563c3e){_0x174f43=_0x174f43-0x0;var _0x363687=_0x6aa7[_0x174f43];return _0x363687;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ 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','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4ae5a3,_0x5bf621){var _0x21f0c8=function(_0x517605){while(--_0x517605){_0x4ae5a3['push'](_0x4ae5a3['shift']());}};_0x21f0c8(++_0x5bf621);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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']('UserMailQueue,\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/userNotification/index.js b/server/api/userNotification/index.js index 9689a9b..02a46f1 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 _0x8a68=['exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./userNotification.controller','post','isAuthenticated','sendUserNotification'];(function(_0x51f4fc,_0x1fe3ef){var _0x4d96fc=function(_0xddc9){while(--_0xddc9){_0x51f4fc['push'](_0x51f4fc['shift']());}};_0x4d96fc(++_0x1fe3ef);}(_0x8a68,0x199));var _0x88a6=function(_0x1b0b38,_0x488f2f){_0x1b0b38=_0x1b0b38-0x0;var _0xe07f0e=_0x8a68[_0x1b0b38];return _0xe07f0e;};'use strict';var multer=require(_0x88a6('0x0'));var util=require(_0x88a6('0x1'));var path=require(_0x88a6('0x2'));var timeout=require('connect-timeout');var express=require(_0x88a6('0x3'));var router=express[_0x88a6('0x4')]();var fs_extra=require(_0x88a6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x88a6('0x6'));var config=require('../../config/environment');var controller=require(_0x88a6('0x7'));router[_0x88a6('0x8')]('/',auth[_0x88a6('0x9')](),controller[_0x88a6('0xa')]);module[_0x88a6('0xb')]=router; \ No newline at end of file +var _0x2515=['multer','path','Router','../../components/interaction/service','../../config/environment','./userNotification.controller','post','exports'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x2515,0x170));var _0x5251=function(_0x5e1100,_0xd61de7){_0x5e1100=_0x5e1100-0x0;var _0x1ee552=_0x2515[_0x5e1100];return _0x1ee552;};'use strict';var multer=require(_0x5251('0x0'));var util=require('util');var path=require(_0x5251('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5251('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5251('0x3'));var config=require(_0x5251('0x4'));var controller=require(_0x5251('0x5'));router[_0x5251('0x6')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0x5251('0x7')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 02d99d8..ed910e3 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 _0x0a4e=['STRING','sequelize','exports','TEXT'];(function(_0x2e3d84,_0x2bc62d){var _0x1fedb6=function(_0x37caae){while(--_0x37caae){_0x2e3d84['push'](_0x2e3d84['shift']());}};_0x1fedb6(++_0x2bc62d);}(_0x0a4e,0x139));var _0xe0a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a4e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe0a4('0x0'));module[_0xe0a4('0x1')]={'body':{'type':Sequelize[_0xe0a4('0x2')]},'senderName':{'type':Sequelize[_0xe0a4('0x3')]},'recipientsId':{'type':Sequelize[_0xe0a4('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x2e78=['STRING','BOOLEAN','sequelize','exports'];(function(_0x1ff5d5,_0x2457ba){var _0x52f8f9=function(_0x3733a6){while(--_0x3733a6){_0x1ff5d5['push'](_0x1ff5d5['shift']());}};_0x52f8f9(++_0x2457ba);}(_0x2e78,0xf2));var _0x82e7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2e78[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x82e7('0x0'));module[_0x82e7('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x82e7('0x2')]},'beep':{'type':Sequelize[_0x82e7('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 65d7b8a..9351ac0 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 _0xb504=['stack','name','status','send','sendUserNotification','body','hasOwnProperty','text','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','Sequelize','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sequelize','forEach','recipient','emit','userNotification:send','catch','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','union','ids','replace','Queue','push','all','flatten','findOne','map','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./userNotification.socket','register','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error'];(function(_0x2fdf43,_0x36b869){var _0x2b3305=function(_0x5dfbc5){while(--_0x5dfbc5){_0x2fdf43['push'](_0x2fdf43['shift']());}};_0x2b3305(++_0x36b869);}(_0xb504,0x9a));var _0x4b50=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb504[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x4b50('0x0'));var rimraf=require(_0x4b50('0x1'));var zipdir=require(_0x4b50('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b50('0x3'));var moment=require(_0x4b50('0x4'));var BPromise=require(_0x4b50('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4b50('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4b50('0x7'));var fs=require('fs');var fs_extra=require(_0x4b50('0x8'));var _=require(_0x4b50('0x9'));var squel=require(_0x4b50('0xa'));var crypto=require(_0x4b50('0xb'));var jsforce=require(_0x4b50('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4b50('0xd'));var querystring=require(_0x4b50('0xe'));var Papa=require(_0x4b50('0xf'));var Redis=require(_0x4b50('0x10'));var authService=require(_0x4b50('0x11'));var qs=require(_0x4b50('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b50('0x13'));var logger=require(_0x4b50('0x14'))('api');var utils=require(_0x4b50('0x15'));var config=require(_0x4b50('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b50('0x17'))['db'];config[_0x4b50('0x18')]=_[_0x4b50('0x19')](config[_0x4b50('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4b50('0x1a'))[_0x4b50('0x1b')](socket);function respondWithStatusCode(_0x4c5c77,_0x1c3ab8){_0x1c3ab8=_0x1c3ab8||0xcc;return function(_0x36ea72){if(_0x36ea72){return _0x4c5c77['sendStatus'](_0x1c3ab8);}return _0x4c5c77['status'](_0x1c3ab8)[_0x4b50('0x1c')]();};}function respondWithResult(_0x70dd8f,_0x1fd118){_0x1fd118=_0x1fd118||0xc8;return function(_0x343763){if(_0x343763){return _0x70dd8f['status'](_0x1fd118)[_0x4b50('0x1d')](_0x343763);}};}function respondWithFilteredResult(_0x4a0f28,_0x366fb2){return function(_0x35ba81){if(_0x35ba81){var _0x1f02cc=typeof _0x366fb2[_0x4b50('0x1e')]===_0x4b50('0x1f')&&typeof _0x366fb2[_0x4b50('0x20')]===_0x4b50('0x1f');var _0xbf0eee=_0x35ba81[_0x4b50('0x21')];var _0x6e5e93=_0x1f02cc?0x0:_0x366fb2[_0x4b50('0x1e')];var _0x1cd7da=_0x1f02cc?_0x35ba81['count']:_0x366fb2[_0x4b50('0x1e')]+_0x366fb2[_0x4b50('0x20')];var _0x4a99f9;if(_0x1cd7da>=_0xbf0eee){_0x1cd7da=_0xbf0eee;_0x4a99f9=0xc8;}else{_0x4a99f9=0xce;}_0x4a0f28['status'](_0x4a99f9);return _0x4a0f28[_0x4b50('0x22')](_0x4b50('0x23'),_0x6e5e93+'-'+_0x1cd7da+'/'+_0xbf0eee)['json'](_0x35ba81);}return null;};}function patchUpdates(_0x4b3936){return function(_0x5e00aa){try{jsonpatch[_0x4b50('0x24')](_0x5e00aa,_0x4b3936,!![]);}catch(_0x1a3a06){return BPromise[_0x4b50('0x25')](_0x1a3a06);}return _0x5e00aa[_0x4b50('0x26')]();};}function saveUpdates(_0x51c6db,_0x18b9fd){return function(_0x59f6e0){if(_0x59f6e0){return _0x59f6e0[_0x4b50('0x27')](_0x51c6db)[_0x4b50('0x28')](function(_0x13dd6d){return _0x13dd6d;});}return null;};}function removeEntity(_0x411d35,_0x5c61f3){return function(_0x536ae7){if(_0x536ae7){return _0x536ae7[_0x4b50('0x29')]()[_0x4b50('0x28')](function(){_0x411d35['status'](0xcc)[_0x4b50('0x1c')]();});}};}function handleEntityNotFound(_0x309c9c,_0x5d3fc8){return function(_0x541477){if(!_0x541477){_0x309c9c[_0x4b50('0x2a')](0x194);}return _0x541477;};}function handleError(_0xeb02ba,_0x58a465){_0x58a465=_0x58a465||0x1f4;return function(_0x25d326){logger[_0x4b50('0x2b')](_0x25d326[_0x4b50('0x2c')]);if(_0x25d326[_0x4b50('0x2d')]){delete _0x25d326[_0x4b50('0x2d')];}_0xeb02ba[_0x4b50('0x2e')](_0x58a465)[_0x4b50('0x2f')](_0x25d326);};}exports[_0x4b50('0x30')]=function(_0x5d2814,_0x1a82b1,_0xbbc797){if(!_0x5d2814[_0x4b50('0x31')][_0x4b50('0x32')](_0x4b50('0x33'))&&!_0x5d2814[_0x4b50('0x31')][_0x4b50('0x32')]('TemplateId')){throw new db['Sequelize'][(_0x4b50('0x34'))](_0x4b50('0x35'));}else{if(_0x5d2814[_0x4b50('0x31')]['hasOwnProperty'](_0x4b50('0x36'))&&!_0x5d2814[_0x4b50('0x31')]['hasOwnProperty'](_0x4b50('0x37'))){throw new db['Sequelize']['ValidationError'](_0x4b50('0x38'));}if(!_0x5d2814[_0x4b50('0x31')][_0x4b50('0x32')](_0x4b50('0x39'))){throw new db[(_0x4b50('0x3a'))][(_0x4b50('0x34'))](_0x4b50('0x3b'));}else{try{var _0x341ad0=JSON[_0x4b50('0x3c')](_0x5d2814['body'][_0x4b50('0x39')]);}catch(_0x5a5dda){logger[_0x4b50('0x2b')](_0x5a5dda);throw new db[(_0x4b50('0x3a'))][(_0x4b50('0x34'))](_0x4b50('0x3d'));}var _0x572ecb=['chatqueue',_0x4b50('0x3e'),_0x4b50('0x3f'),_0x4b50('0x40'),_0x4b50('0x41'),_0x4b50('0x42'),'whatsappqueue',_0x4b50('0x43'),_0x4b50('0x44')];if(_[_0x4b50('0x45')](_0x341ad0,function(_0x25d176){return!_[_0x4b50('0x46')](_0x572ecb,_0x25d176[_0x4b50('0x47')][_0x4b50('0x48')]());})){throw new db[(_0x4b50('0x3a'))]['ValidationError'](_0x4b50('0x49'));}}}var _0xf1b4d8={};_0xf1b4d8[_0x4b50('0x4a')]=_0x5d2814[_0x4b50('0x31')][_0x4b50('0x32')](_0x4b50('0x4a'))?_0x5d2814['body']['senderName']:_0x5d2814[_0x4b50('0x44')][_0x4b50('0x4b')];_0xf1b4d8['recipientsDescription']=_[_0x4b50('0x4c')](_0x5d2814[_0x4b50('0x31')][_0x4b50('0x4d')])?null:_0x5d2814[_0x4b50('0x31')][_0x4b50('0x4d')];_0xf1b4d8[_0x4b50('0x4e')]=_0x5d2814[_0x4b50('0x31')][_0x4b50('0x4e')]||![];_0xf1b4d8[_0x4b50('0x4f')]=_0x5d2814['user']['id'];return getContent(_0x5d2814[_0x4b50('0x31')])[_0x4b50('0x28')](function(_0x2a8b90){_0xf1b4d8['body']=_0x2a8b90;return getRecipients(_0x341ad0);})[_0x4b50('0x28')](function(_0x315b0f){_0xf1b4d8[_0x4b50('0x50')]=_['sortBy'](_0x315b0f)['join'](',');return db[_0x4b50('0x51')]['transaction'](function(_0x55c5f4){return db['UserNotification']['create'](_0xf1b4d8,{'raw':!![],'transaction':_0x55c5f4})['then'](function(_0x2ba571){var _0x5b72e0={'sender':_0xf1b4d8[_0x4b50('0x4a')],'description':_0xf1b4d8[_0x4b50('0x4d')],'content':_0xf1b4d8['body'],'beep':_0xf1b4d8[_0x4b50('0x4e')]};_0x315b0f[_0x4b50('0x52')](function(_0x563a53){_0x5b72e0[_0x4b50('0x53')]=_0x563a53;socket[_0x4b50('0x54')](_0x4b50('0x55'),_0x5b72e0);});return _0x2ba571;});});})[_0x4b50('0x28')](respondWithResult(_0x1a82b1,0xc9))[_0x4b50('0x56')](handleError(_0x1a82b1,null));};function getContent(_0x4328a9){return new BPromise(function(_0x1176af,_0x502b3d){if(_0x4328a9[_0x4b50('0x33')]){_0x1176af(_0x4328a9['text']);return;}return db['Template']['findOne']({'attributes':[_0x4b50('0x57')],'where':{'id':_0x4328a9[_0x4b50('0x36')]},'raw':!![]})['then'](function(_0x378247){if(!_0x378247)throw new db[(_0x4b50('0x3a'))][(_0x4b50('0x34'))](_0x4b50('0x58'));var _0x369fc1=Mustache['render'](_0x378247[_0x4b50('0x57')],_0x4328a9[_0x4b50('0x37')]);_0x1176af(_0x369fc1);})[_0x4b50('0x56')](function(_0x17c569){_0x502b3d(_0x17c569);});});}function getRecipients(_0x521da9){return new BPromise(function(_0x1df4dc,_0x5efa1e){var _0x3a8570=[];var _0x529a37=[];_0x521da9[_0x4b50('0x52')](function(_0x4e4c61){var _0x2a7e9f=_[_0x4b50('0x59')](_0x4e4c61[_0x4b50('0x47')][_0x4b50('0x48')]());if(_0x2a7e9f==='User'){_0x3a8570=_[_0x4b50('0x5a')](_0x3a8570,_0x4e4c61[_0x4b50('0x5b')]);}else{if(_[_0x4b50('0x46')](_0x2a7e9f,'queue'))_0x2a7e9f=_0x2a7e9f[_0x4b50('0x5c')]('queue',_0x4b50('0x5d'));_0x4e4c61[_0x4b50('0x5b')][_0x4b50('0x52')](function(_0xd0f9fe){_0x529a37[_0x4b50('0x5e')](getAgents(_0x2a7e9f,_0xd0f9fe));});}});return BPromise[_0x4b50('0x5f')](_0x529a37)[_0x4b50('0x28')](function(_0x28baab){_0x3a8570=_[_0x4b50('0x5a')](_0x3a8570,_[_0x4b50('0x60')](_0x28baab));_0x1df4dc(_0x3a8570);})[_0x4b50('0x56')](function(_0x45571a){_0x5efa1e(_0x45571a);});});}function getAgents(_0x310608,_0x1baf33){return new BPromise(function(_0x50bdd7,_0x1233b2){return db[_0x310608][_0x4b50('0x61')]({'where':{'id':_0x1baf33}})[_0x4b50('0x28')](function(_0x3f4716){return _0x3f4716['getAgents']({'attributes':['id'],'raw':!![]})[_0x4b50('0x28')](function(_0x2cdce7){var _0x11fed3=_[_0x4b50('0x62')](_0x2cdce7,'id');_0x50bdd7(_0x11fed3);});})['catch'](function(_0x50c30b){_0x1233b2(_0x50c30b);});});} \ No newline at end of file +var _0xbf05=['recipientsId','join','sequelize','transaction','UserNotification','emit','userNotification:send','catch','text','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','union','ids','queue','Queue','forEach','push','all','flatten','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep'];(function(_0x392e8d,_0x3d05ca){var _0x40c881=function(_0x5a7fe9){while(--_0x5a7fe9){_0x392e8d['push'](_0x392e8d['shift']());}};_0x40c881(++_0x3d05ca);}(_0xbf05,0x1ec));var _0x5bf0=function(_0x2dd6be,_0x7ba34d){_0x2dd6be=_0x2dd6be-0x0;var _0x584749=_0xbf05[_0x2dd6be];return _0x584749;};'use strict';var emlformat=require(_0x5bf0('0x0'));var rimraf=require(_0x5bf0('0x1'));var zipdir=require(_0x5bf0('0x2'));var jsonpatch=require(_0x5bf0('0x3'));var rp=require('request-promise');var moment=require(_0x5bf0('0x4'));var BPromise=require(_0x5bf0('0x5'));var Mustache=require(_0x5bf0('0x6'));var util=require(_0x5bf0('0x7'));var path=require(_0x5bf0('0x8'));var sox=require(_0x5bf0('0x9'));var csv=require('to-csv');var ejs=require(_0x5bf0('0xa'));var fs=require('fs');var fs_extra=require(_0x5bf0('0xb'));var _=require(_0x5bf0('0xc'));var squel=require(_0x5bf0('0xd'));var crypto=require(_0x5bf0('0xe'));var jsforce=require(_0x5bf0('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5bf0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5bf0('0x11'));var hardwareService=require(_0x5bf0('0x12'));var logger=require(_0x5bf0('0x13'))(_0x5bf0('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5bf0('0x15'))['db'];config[_0x5bf0('0x16')]=_[_0x5bf0('0x17')](config[_0x5bf0('0x16')],{'host':_0x5bf0('0x18'),'port':0x18eb});var socket=require(_0x5bf0('0x19'))(new Redis(config[_0x5bf0('0x16')]));require(_0x5bf0('0x1a'))[_0x5bf0('0x1b')](socket);function respondWithStatusCode(_0x250937,_0x1c9807){_0x1c9807=_0x1c9807||0xcc;return function(_0x34e5b0){if(_0x34e5b0){return _0x250937[_0x5bf0('0x1c')](_0x1c9807);}return _0x250937['status'](_0x1c9807)['end']();};}function respondWithResult(_0x27798f,_0x3a889d){_0x3a889d=_0x3a889d||0xc8;return function(_0x5ae9d6){if(_0x5ae9d6){return _0x27798f[_0x5bf0('0x1d')](_0x3a889d)[_0x5bf0('0x1e')](_0x5ae9d6);}};}function respondWithFilteredResult(_0x51b806,_0x35d766){return function(_0x59b21c){if(_0x59b21c){var _0x27851d=typeof _0x35d766[_0x5bf0('0x1f')]===_0x5bf0('0x20')&&typeof _0x35d766['limit']===_0x5bf0('0x20');var _0xf8e64a=_0x59b21c[_0x5bf0('0x21')];var _0x16c1fc=_0x27851d?0x0:_0x35d766[_0x5bf0('0x1f')];var _0x237d7f=_0x27851d?_0x59b21c[_0x5bf0('0x21')]:_0x35d766[_0x5bf0('0x1f')]+_0x35d766[_0x5bf0('0x22')];var _0x2f3ccc;if(_0x237d7f>=_0xf8e64a){_0x237d7f=_0xf8e64a;_0x2f3ccc=0xc8;}else{_0x2f3ccc=0xce;}_0x51b806[_0x5bf0('0x1d')](_0x2f3ccc);return _0x51b806[_0x5bf0('0x23')](_0x5bf0('0x24'),_0x16c1fc+'-'+_0x237d7f+'/'+_0xf8e64a)['json'](_0x59b21c);}return null;};}function patchUpdates(_0x2834c7){return function(_0x1789fe){try{jsonpatch[_0x5bf0('0x25')](_0x1789fe,_0x2834c7,!![]);}catch(_0x336de8){return BPromise[_0x5bf0('0x26')](_0x336de8);}return _0x1789fe[_0x5bf0('0x27')]();};}function saveUpdates(_0x559111,_0x4684a5){return function(_0xad88d){if(_0xad88d){return _0xad88d['update'](_0x559111)[_0x5bf0('0x28')](function(_0x9aded6){return _0x9aded6;});}return null;};}function removeEntity(_0x4e8e3c,_0x4e643e){return function(_0x50a15f){if(_0x50a15f){return _0x50a15f[_0x5bf0('0x29')]()[_0x5bf0('0x28')](function(){_0x4e8e3c[_0x5bf0('0x1d')](0xcc)[_0x5bf0('0x2a')]();});}};}function handleEntityNotFound(_0x1e4914,_0x5d7bf0){return function(_0x74971d){if(!_0x74971d){_0x1e4914[_0x5bf0('0x1c')](0x194);}return _0x74971d;};}function handleError(_0x727ff6,_0x2e5620){_0x2e5620=_0x2e5620||0x1f4;return function(_0x5805f2){logger[_0x5bf0('0x2b')](_0x5805f2[_0x5bf0('0x2c')]);if(_0x5805f2['name']){delete _0x5805f2['name'];}_0x727ff6[_0x5bf0('0x1d')](_0x2e5620)[_0x5bf0('0x2d')](_0x5805f2);};}exports[_0x5bf0('0x2e')]=function(_0x3b5e63,_0x3d4cb3,_0x3fbd99){if(!_0x3b5e63[_0x5bf0('0x2f')][_0x5bf0('0x30')]('text')&&!_0x3b5e63['body'][_0x5bf0('0x30')](_0x5bf0('0x31'))){throw new db[(_0x5bf0('0x32'))][(_0x5bf0('0x33'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x3b5e63[_0x5bf0('0x2f')]['hasOwnProperty'](_0x5bf0('0x31'))&&!_0x3b5e63['body'][_0x5bf0('0x30')](_0x5bf0('0x34'))){throw new db['Sequelize'][(_0x5bf0('0x33'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x3b5e63[_0x5bf0('0x2f')][_0x5bf0('0x30')](_0x5bf0('0x35'))){throw new db['Sequelize'][(_0x5bf0('0x33'))](_0x5bf0('0x36'));}else{try{var _0x2102eb=JSON[_0x5bf0('0x37')](_0x3b5e63['body'][_0x5bf0('0x35')]);}catch(_0xeda9bd){logger[_0x5bf0('0x2b')](_0xeda9bd);throw new db[(_0x5bf0('0x32'))][(_0x5bf0('0x33'))](_0x5bf0('0x38'));}var _0x156883=['chatqueue',_0x5bf0('0x39'),_0x5bf0('0x3a'),_0x5bf0('0x3b'),'smsqueue','voicequeue',_0x5bf0('0x3c'),_0x5bf0('0x3d'),_0x5bf0('0x3e')];if(_[_0x5bf0('0x3f')](_0x2102eb,function(_0xc257b){return!_[_0x5bf0('0x40')](_0x156883,_0xc257b[_0x5bf0('0x41')][_0x5bf0('0x42')]());})){throw new db['Sequelize'][(_0x5bf0('0x33'))](_0x5bf0('0x43'));}}}var _0x3dcb11={};_0x3dcb11[_0x5bf0('0x44')]=_0x3b5e63[_0x5bf0('0x2f')][_0x5bf0('0x30')](_0x5bf0('0x44'))?_0x3b5e63[_0x5bf0('0x2f')]['senderName']:_0x3b5e63['user'][_0x5bf0('0x45')];_0x3dcb11[_0x5bf0('0x46')]=_['isEmpty'](_0x3b5e63[_0x5bf0('0x2f')]['recipientsDescription'])?null:_0x3b5e63[_0x5bf0('0x2f')][_0x5bf0('0x46')];_0x3dcb11['beep']=_0x3b5e63[_0x5bf0('0x2f')][_0x5bf0('0x47')]||![];_0x3dcb11['SenderId']=_0x3b5e63[_0x5bf0('0x3e')]['id'];return getContent(_0x3b5e63[_0x5bf0('0x2f')])[_0x5bf0('0x28')](function(_0x2b0398){_0x3dcb11[_0x5bf0('0x2f')]=_0x2b0398;return getRecipients(_0x2102eb);})[_0x5bf0('0x28')](function(_0x229b29){_0x3dcb11[_0x5bf0('0x48')]=_['sortBy'](_0x229b29)[_0x5bf0('0x49')](',');return db[_0x5bf0('0x4a')][_0x5bf0('0x4b')](function(_0x130291){return db[_0x5bf0('0x4c')]['create'](_0x3dcb11,{'raw':!![],'transaction':_0x130291})[_0x5bf0('0x28')](function(_0xdf19a){var _0x451da7={'sender':_0x3dcb11[_0x5bf0('0x44')],'description':_0x3dcb11[_0x5bf0('0x46')],'content':_0x3dcb11[_0x5bf0('0x2f')],'beep':_0x3dcb11['beep']};_0x229b29['forEach'](function(_0x1b18ab){_0x451da7['recipient']=_0x1b18ab;socket[_0x5bf0('0x4d')](_0x5bf0('0x4e'),_0x451da7);});return _0xdf19a;});});})[_0x5bf0('0x28')](respondWithResult(_0x3d4cb3,0xc9))[_0x5bf0('0x4f')](handleError(_0x3d4cb3,null));};function getContent(_0x5814c8){return new BPromise(function(_0x18b82a,_0x14da90){if(_0x5814c8[_0x5bf0('0x50')]){_0x18b82a(_0x5814c8[_0x5bf0('0x50')]);return;}return db[_0x5bf0('0x51')]['findOne']({'attributes':[_0x5bf0('0x52')],'where':{'id':_0x5814c8[_0x5bf0('0x31')]},'raw':!![]})[_0x5bf0('0x28')](function(_0x261124){if(!_0x261124)throw new db[(_0x5bf0('0x32'))]['ValidationError'](_0x5bf0('0x53'));var _0x51063c=Mustache[_0x5bf0('0x54')](_0x261124[_0x5bf0('0x52')],_0x5814c8['view']);_0x18b82a(_0x51063c);})['catch'](function(_0x2f75cf){_0x14da90(_0x2f75cf);});});}function getRecipients(_0x4b97a6){return new BPromise(function(_0x34f4a7,_0x5a7b1b){var _0x16f230=[];var _0x304dcc=[];_0x4b97a6['forEach'](function(_0x46c636){var _0x4873bc=_[_0x5bf0('0x55')](_0x46c636[_0x5bf0('0x41')][_0x5bf0('0x42')]());if(_0x4873bc==='User'){_0x16f230=_[_0x5bf0('0x56')](_0x16f230,_0x46c636[_0x5bf0('0x57')]);}else{if(_[_0x5bf0('0x40')](_0x4873bc,_0x5bf0('0x58')))_0x4873bc=_0x4873bc['replace'](_0x5bf0('0x58'),_0x5bf0('0x59'));_0x46c636[_0x5bf0('0x57')][_0x5bf0('0x5a')](function(_0x3d0f62){_0x304dcc[_0x5bf0('0x5b')](getAgents(_0x4873bc,_0x3d0f62));});}});return BPromise[_0x5bf0('0x5c')](_0x304dcc)[_0x5bf0('0x28')](function(_0x266e0b){_0x16f230=_[_0x5bf0('0x56')](_0x16f230,_[_0x5bf0('0x5d')](_0x266e0b));_0x34f4a7(_0x16f230);})['catch'](function(_0x30f1b6){_0x5a7b1b(_0x30f1b6);});});}function getAgents(_0x3962dc,_0x1ea7de){return new BPromise(function(_0x2f0bd7,_0x240049){return db[_0x3962dc]['findOne']({'where':{'id':_0x1ea7de}})['then'](function(_0xb27317){return _0xb27317['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x4496d7){var _0x35f506=_['map'](_0x4496d7,'id');_0x2f0bd7(_0x35f506);});})[_0x5bf0('0x4f')](function(_0x40bd74){_0x240049(_0x40bd74);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 3fa2b0a..2e71a73 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 _0xe310=['exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe310,0xd2));var _0x0e31=function(_0x53ea4e,_0x437db6){_0x53ea4e=_0x53ea4e-0x0;var _0x1f54dc=_0xe310[_0x53ea4e];return _0x1f54dc;};'use strict';var EventEmitter=require(_0x0e31('0x0'));var UserNotification=require(_0x0e31('0x1'))['db'][_0x0e31('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x0e31('0x3')](0x0);var events={'afterCreate':_0x0e31('0x4'),'afterUpdate':_0x0e31('0x5'),'afterDestroy':_0x0e31('0x6')};function emitEvent(_0x55729b){return function(_0x5cb3d4,_0x49a2e4,_0x53a475){UserNotificationEvents[_0x0e31('0x7')](_0x55729b+':'+_0x5cb3d4['id'],_0x5cb3d4);UserNotificationEvents[_0x0e31('0x7')](_0x55729b,_0x5cb3d4);_0x53a475(null);};}for(var e in events){if(events[_0x0e31('0x8')](e)){var event=events[e];UserNotification[_0x0e31('0x9')](e,emitEvent(event));}}module[_0x0e31('0xa')]=UserNotificationEvents; \ No newline at end of file +var _0x6311=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','remove'];(function(_0x1ed388,_0x4c1474){var _0x356c7f=function(_0x19b7e1){while(--_0x19b7e1){_0x1ed388['push'](_0x1ed388['shift']());}};_0x356c7f(++_0x4c1474);}(_0x6311,0xfc));var _0x1631=function(_0x396583,_0x1049e3){_0x396583=_0x396583-0x0;var _0x3af08e=_0x6311[_0x396583];return _0x3af08e;};'use strict';var EventEmitter=require(_0x1631('0x0'));var UserNotification=require(_0x1631('0x1'))['db'][_0x1631('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1631('0x3')};function emitEvent(_0x223dfe){return function(_0x56515c,_0xc1d8f9,_0x4b4b1b){UserNotificationEvents['emit'](_0x223dfe+':'+_0x56515c['id'],_0x56515c);UserNotificationEvents[_0x1631('0x4')](_0x223dfe,_0x56515c);_0x4b4b1b(null);};}for(var e in events){if(events[_0x1631('0x5')](e)){var event=events[e];UserNotification[_0x1631('0x6')](e,emitEvent(event));}}module[_0x1631('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 8a9d7df..c026f30 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 _0x7107=['userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','../../config/environment','./userNotification.attributes','exports'];(function(_0xa961c5,_0xdd9ef0){var _0x33e6bf=function(_0x55f981){while(--_0x55f981){_0xa961c5['push'](_0xa961c5['shift']());}};_0x33e6bf(++_0xdd9ef0);}(_0x7107,0x7b));var _0x7710=function(_0x423b51,_0xfda98e){_0x423b51=_0x423b51-0x0;var _0x403d01=_0x7107[_0x423b51];return _0x403d01;};'use strict';var _=require(_0x7710('0x0'));var util=require(_0x7710('0x1'));var logger=require(_0x7710('0x2'))(_0x7710('0x3'));var moment=require(_0x7710('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7710('0x5'));var rimraf=require('rimraf');var config=require(_0x7710('0x6'));var attributes=require(_0x7710('0x7'));module[_0x7710('0x8')]=function(_0x48772e,_0x43425a){return _0x48772e['define']('UserNotification',attributes,{'tableName':_0x7710('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7710('0xa'),'collate':_0x7710('0xb')});}; \ No newline at end of file +var _0x57c8=['exports','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes'];(function(_0x1d5430,_0x3d0c7b){var _0x5ed7d6=function(_0x34d03b){while(--_0x34d03b){_0x1d5430['push'](_0x1d5430['shift']());}};_0x5ed7d6(++_0x3d0c7b);}(_0x57c8,0x1d6));var _0x857c=function(_0x1ca9fe,_0x3e29ec){_0x1ca9fe=_0x1ca9fe-0x0;var _0x24a18b=_0x57c8[_0x1ca9fe];return _0x24a18b;};'use strict';var _=require(_0x857c('0x0'));var util=require(_0x857c('0x1'));var logger=require(_0x857c('0x2'))(_0x857c('0x3'));var moment=require('moment');var BPromise=require(_0x857c('0x4'));var rp=require(_0x857c('0x5'));var fs=require('fs');var path=require(_0x857c('0x6'));var rimraf=require(_0x857c('0x7'));var config=require(_0x857c('0x8'));var attributes=require(_0x857c('0x9'));module[_0x857c('0xa')]=function(_0x39f648,_0x5c044d){return _0x39f648[_0x857c('0xb')](_0x857c('0xc'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x857c('0xd'),'collate':_0x857c('0xe')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index dc4277d..b5a093c 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 _0xd2b0=['jayson/promise','client','redis','defaults','./userNotification.socket','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','message','info','result','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd2b0,0x188));var _0x0d2b=function(_0x1dfa63,_0x362bd4){_0x1dfa63=_0x1dfa63-0x0;var _0x26f2a9=_0xd2b0[_0x1dfa63];return _0x26f2a9;};'use strict';var _=require(_0x0d2b('0x0'));var util=require(_0x0d2b('0x1'));var moment=require(_0x0d2b('0x2'));var BPromise=require(_0x0d2b('0x3'));var rs=require(_0x0d2b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0d2b('0x5'));var config=require(_0x0d2b('0x6'));var jayson=require(_0x0d2b('0x7'));var client=jayson[_0x0d2b('0x8')]['http']({'port':0x232a});config[_0x0d2b('0x9')]=_[_0x0d2b('0xa')](config[_0x0d2b('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d2b('0x9')]));require(_0x0d2b('0xb'))['register'](socket);function respondWithRpcPromise(_0x330c33,_0x998d4d,_0x4701b3){return new BPromise(function(_0x1cff4b,_0x5a74ae){return client['request'](_0x330c33,_0x4701b3)[_0x0d2b('0xc')](function(_0x59ea20){logger['info'](_0x0d2b('0xd'),_0x998d4d,_0x0d2b('0xe'));logger[_0x0d2b('0xf')](_0x0d2b('0x10'),_0x998d4d,_0x0d2b('0xe'),JSON['stringify'](_0x59ea20));if(_0x59ea20[_0x0d2b('0x11')]){if(_0x59ea20[_0x0d2b('0x11')]['code']===0x1f4){logger[_0x0d2b('0x11')]('UserNotification,\x20%s,\x20%s',_0x998d4d,_0x59ea20['error'][_0x0d2b('0x12')]);return _0x5a74ae(_0x59ea20[_0x0d2b('0x11')][_0x0d2b('0x12')]);}logger[_0x0d2b('0x11')](_0x0d2b('0xd'),_0x998d4d,_0x59ea20[_0x0d2b('0x11')]['message']);return _0x1cff4b(_0x59ea20[_0x0d2b('0x11')][_0x0d2b('0x12')]);}else{logger[_0x0d2b('0x13')]('UserNotification,\x20%s,\x20%s',_0x998d4d,'request\x20sent');_0x1cff4b(_0x59ea20[_0x0d2b('0x14')][_0x0d2b('0x12')]);}})['catch'](function(_0x319570){logger['error']('UserNotification,\x20%s,\x20%s',_0x998d4d,_0x319570);_0x5a74ae(_0x319570);});});} \ No newline at end of file +var _0xc7cc=['../../config/logger','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4d6abe,_0x5ddd9e){var _0x46e548=function(_0x26ef99){while(--_0x26ef99){_0x4d6abe['push'](_0x4d6abe['shift']());}};_0x46e548(++_0x5ddd9e);}(_0xc7cc,0x11a));var _0xcc7c=function(_0x32885b,_0x3000b5){_0x32885b=_0x32885b-0x0;var _0x31985e=_0xc7cc[_0x32885b];return _0x31985e;};'use strict';var _=require('lodash');var util=require(_0xcc7c('0x0'));var moment=require('moment');var BPromise=require(_0xcc7c('0x1'));var rs=require(_0xcc7c('0x2'));var fs=require('fs');var Redis=require(_0xcc7c('0x3'));var db=require(_0xcc7c('0x4'))['db'];var utils=require(_0xcc7c('0x5'));var logger=require(_0xcc7c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcc7c('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xcc7c('0x8')]=_[_0xcc7c('0x9')](config[_0xcc7c('0x8')],{'host':_0xcc7c('0xa'),'port':0x18eb});var socket=require(_0xcc7c('0xb'))(new Redis(config[_0xcc7c('0x8')]));require('./userNotification.socket')[_0xcc7c('0xc')](socket);function respondWithRpcPromise(_0x34f1bc,_0x2f5772,_0x2c4fda){return new BPromise(function(_0x3834db,_0xab8901){return client[_0xcc7c('0xd')](_0x34f1bc,_0x2c4fda)['then'](function(_0x2b04c0){logger['info'](_0xcc7c('0xe'),_0x2f5772,'request\x20sent');logger[_0xcc7c('0xf')](_0xcc7c('0x10'),_0x2f5772,_0xcc7c('0x11'),JSON[_0xcc7c('0x12')](_0x2b04c0));if(_0x2b04c0['error']){if(_0x2b04c0[_0xcc7c('0x13')]['code']===0x1f4){logger[_0xcc7c('0x13')](_0xcc7c('0xe'),_0x2f5772,_0x2b04c0['error']['message']);return _0xab8901(_0x2b04c0[_0xcc7c('0x13')][_0xcc7c('0x14')]);}logger[_0xcc7c('0x13')](_0xcc7c('0xe'),_0x2f5772,_0x2b04c0[_0xcc7c('0x13')][_0xcc7c('0x14')]);return _0x3834db(_0x2b04c0[_0xcc7c('0x13')][_0xcc7c('0x14')]);}else{logger[_0xcc7c('0x15')]('UserNotification,\x20%s,\x20%s',_0x2f5772,_0xcc7c('0x11'));_0x3834db(_0x2b04c0[_0xcc7c('0x16')][_0xcc7c('0x14')]);}})[_0xcc7c('0x17')](function(_0x567583){logger[_0xcc7c('0x13')](_0xcc7c('0xe'),_0x2f5772,_0x567583);_0xab8901(_0x567583);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index d49d766..f66604c 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 _0x0442=['./userNotification.events','save','update','emit','register'];(function(_0x92d1ff,_0xa9cb8c){var _0x2490d7=function(_0x2dba61){while(--_0x2dba61){_0x92d1ff['push'](_0x92d1ff['shift']());}};_0x2490d7(++_0xa9cb8c);}(_0x0442,0xd2));var _0x2044=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x0442[_0x4b2863];return _0x567d67;};'use strict';var UserNotificationEvents=require(_0x2044('0x0'));var events=[_0x2044('0x1'),'remove',_0x2044('0x2')];function createListener(_0x2286cb,_0x33fd79){return function(_0x26e85f){_0x33fd79[_0x2044('0x3')](_0x2286cb,_0x26e85f);};}function removeListener(_0x16bcf1,_0x520ad9){return function(){UserNotificationEvents['removeListener'](_0x16bcf1,_0x520ad9);};}exports[_0x2044('0x4')]=function(_0x237450){for(var _0x16e94c=0x0,_0x36475a=events['length'];_0x16e94c<_0x36475a;_0x16e94c++){var _0x5e23da=events[_0x16e94c];var _0xf8bda6=createListener('userNotification:'+_0x5e23da,_0x237450);UserNotificationEvents['on'](_0x5e23da,_0xf8bda6);}}; \ No newline at end of file +var _0x2391=['emit','removeListener','./userNotification.events','save','remove'];(function(_0x3cc6bf,_0x517266){var _0x4b4a4c=function(_0x23093b){while(--_0x23093b){_0x3cc6bf['push'](_0x3cc6bf['shift']());}};_0x4b4a4c(++_0x517266);}(_0x2391,0x106));var _0x1239=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x2391[_0x2bf141];return _0x48277b;};'use strict';var UserNotificationEvents=require(_0x1239('0x0'));var events=[_0x1239('0x1'),_0x1239('0x2'),'update'];function createListener(_0x3d8783,_0x1413e0){return function(_0x2afe60){_0x1413e0[_0x1239('0x3')](_0x3d8783,_0x2afe60);};}function removeListener(_0x40c443,_0x2f401e){return function(){UserNotificationEvents[_0x1239('0x4')](_0x40c443,_0x2f401e);};}exports['register']=function(_0x1748a3){for(var _0x14c983=0x0,_0x34185a=events['length'];_0x14c983<_0x34185a;_0x14c983++){var _0xb71d85=events[_0x14c983];var _0x4b11cc=createListener('userNotification:'+_0xb71d85,_0x1748a3);UserNotificationEvents['on'](_0xb71d85,_0x4b11cc);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 5f14e65..5c79e1f 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x132e98,_0x27a554){var _0x323218=function(_0x2bdaaf){while(--_0x2bdaaf){_0x132e98['push'](_0x132e98['shift']());}};_0x323218(++_0x27a554);}(_0xe706,0xa3));var _0x6e70=function(_0x252550,_0x1ffe4d){_0x252550=_0x252550-0x0;var _0x352629=_0xe706[_0x252550];return _0x352629;};'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(_0x17503c,_0x42cb4d){var _0x26ec05=function(_0x3ccc0b){while(--_0x3ccc0b){_0x17503c['push'](_0x17503c['shift']());}};_0x26ec05(++_0x42cb4d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x80d733,_0x266211){_0x80d733=_0x80d733-0x0;var _0x435868=_0xcb91[_0x80d733];return _0x435868;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 4a4f078..8a2e01b 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 _0xe75e=['INTEGER','sequelize','exports'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0xe75e,0x7f));var _0xee75=function(_0x4a93bb,_0x495404){_0x4a93bb=_0x4a93bb-0x0;var _0x208468=_0xe75e[_0x4a93bb];return _0x208468;};'use strict';var Sequelize=require(_0xee75('0x0'));module[_0xee75('0x1')]={'penalty':{'type':Sequelize[_0xee75('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x441d=['exports','sequelize'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x441d,0x13f));var _0xd441=function(_0x1a6431,_0x12ba4a){_0x1a6431=_0x1a6431-0x0;var _0x3ca845=_0x441d[_0x1a6431];return _0x3ca845;};'use strict';var Sequelize=require(_0xd441('0x0'));module[_0xd441('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 59d3b63..9e96d41 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 _0x3fce=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger'];(function(_0x570535,_0x395710){var _0x3503e1=function(_0x2be680){while(--_0x2be680){_0x570535['push'](_0x570535['shift']());}};_0x3503e1(++_0x395710);}(_0x3fce,0x1ce));var _0xe3fc=function(_0x6f3151,_0x406745){_0x6f3151=_0x6f3151-0x0;var _0x305fb8=_0x3fce[_0x6f3151];return _0x305fb8;};'use strict';var _=require(_0xe3fc('0x0'));var util=require(_0xe3fc('0x1'));var logger=require(_0xe3fc('0x2'))(_0xe3fc('0x3'));var moment=require(_0xe3fc('0x4'));var BPromise=require(_0xe3fc('0x5'));var rp=require(_0xe3fc('0x6'));var fs=require('fs');var path=require(_0xe3fc('0x7'));var rimraf=require(_0xe3fc('0x8'));var config=require(_0xe3fc('0x9'));var attributes=require(_0xe3fc('0xa'));module[_0xe3fc('0xb')]=function(_0x4a7a2f,_0x25a7da){return _0x4a7a2f[_0xe3fc('0xc')](_0xe3fc('0xd'),attributes,{'tableName':_0xe3fc('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd26a=['path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','user_has_openchannel_queues','moment','bluebird','request-promise'];(function(_0x458c85,_0x5cc5da){var _0x2fdf6f=function(_0x2c8f3a){while(--_0x2c8f3a){_0x458c85['push'](_0x458c85['shift']());}};_0x2fdf6f(++_0x5cc5da);}(_0xd26a,0x19b));var _0xad26=function(_0x12b5de,_0x1770a7){_0x12b5de=_0x12b5de-0x0;var _0x328ed8=_0xd26a[_0x12b5de];return _0x328ed8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xad26('0x0'));var BPromise=require(_0xad26('0x1'));var rp=require(_0xad26('0x2'));var fs=require('fs');var path=require(_0xad26('0x3'));var rimraf=require(_0xad26('0x4'));var config=require(_0xad26('0x5'));var attributes=require(_0xad26('0x6'));module['exports']=function(_0x3c3595,_0x1e450f){return _0x3c3595[_0xad26('0x7')]('UserOpenchannelQueue',attributes,{'tableName':_0xad26('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index b06f4a1..82b5684 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 _0x9407=['info','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x30deae,_0x2c5cef){var _0x1a704d=function(_0x2c0a8e){while(--_0x2c0a8e){_0x30deae['push'](_0x30deae['shift']());}};_0x1a704d(++_0x2c5cef);}(_0x9407,0xda));var _0x7940=function(_0x3f8b2e,_0x371cb7){_0x3f8b2e=_0x3f8b2e-0x0;var _0x13292f=_0x9407[_0x3f8b2e];return _0x13292f;};'use strict';var _=require(_0x7940('0x0'));var util=require(_0x7940('0x1'));var moment=require(_0x7940('0x2'));var BPromise=require(_0x7940('0x3'));var rs=require(_0x7940('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7940('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7940('0x6'))('rpc');var config=require(_0x7940('0x7'));var jayson=require(_0x7940('0x8'));var client=jayson[_0x7940('0x9')][_0x7940('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x629d06,_0x37de0c,_0x2ff146){return new BPromise(function(_0x41ef1a,_0x1566ed){return client[_0x7940('0xb')](_0x629d06,_0x2ff146)[_0x7940('0xc')](function(_0x53e2c7){logger[_0x7940('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x37de0c,_0x7940('0xe'));logger['debug'](_0x7940('0xf'),_0x37de0c,_0x7940('0xe'),JSON['stringify'](_0x53e2c7));if(_0x53e2c7[_0x7940('0x10')]){if(_0x53e2c7[_0x7940('0x10')]['code']===0x1f4){logger[_0x7940('0x10')](_0x7940('0x11'),_0x37de0c,_0x53e2c7[_0x7940('0x10')][_0x7940('0x12')]);return _0x1566ed(_0x53e2c7[_0x7940('0x10')][_0x7940('0x12')]);}logger[_0x7940('0x10')](_0x7940('0x11'),_0x37de0c,_0x53e2c7[_0x7940('0x10')][_0x7940('0x12')]);return _0x41ef1a(_0x53e2c7[_0x7940('0x10')][_0x7940('0x12')]);}else{logger['info'](_0x7940('0x11'),_0x37de0c,_0x7940('0xe'));_0x41ef1a(_0x53e2c7[_0x7940('0x13')]['message']);}})[_0x7940('0x14')](function(_0xd28a9e){logger[_0x7940('0x10')](_0x7940('0x11'),_0x37de0c,_0xd28a9e);_0x1566ed(_0xd28a9e);});});} \ No newline at end of file +var _0x304e=['then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x304e,0x181));var _0xe304=function(_0x1a23b0,_0x2acdfc){_0x1a23b0=_0x1a23b0-0x0;var _0xc09550=_0x304e[_0x1a23b0];return _0xc09550;};'use strict';var _=require('lodash');var util=require(_0xe304('0x0'));var moment=require(_0xe304('0x1'));var BPromise=require(_0xe304('0x2'));var rs=require(_0xe304('0x3'));var fs=require('fs');var Redis=require(_0xe304('0x4'));var db=require(_0xe304('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe304('0x6'))(_0xe304('0x7'));var config=require(_0xe304('0x8'));var jayson=require(_0xe304('0x9'));var client=jayson['client'][_0xe304('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59bedc,_0x4096b6,_0x1c519d){return new BPromise(function(_0x25c940,_0x1a5233){return client['request'](_0x59bedc,_0x1c519d)[_0xe304('0xb')](function(_0x3877f0){logger[_0xe304('0xc')](_0xe304('0xd'),_0x4096b6,_0xe304('0xe'));logger[_0xe304('0xf')](_0xe304('0x10'),_0x4096b6,_0xe304('0xe'),JSON[_0xe304('0x11')](_0x3877f0));if(_0x3877f0[_0xe304('0x12')]){if(_0x3877f0[_0xe304('0x12')][_0xe304('0x13')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4096b6,_0x3877f0[_0xe304('0x12')][_0xe304('0x14')]);return _0x1a5233(_0x3877f0[_0xe304('0x12')]['message']);}logger[_0xe304('0x12')](_0xe304('0xd'),_0x4096b6,_0x3877f0['error']['message']);return _0x25c940(_0x3877f0[_0xe304('0x12')][_0xe304('0x14')]);}else{logger[_0xe304('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4096b6,'request\x20sent');_0x25c940(_0x3877f0['result']['message']);}})[_0xe304('0x15')](function(_0x4fa65c){logger[_0xe304('0x12')](_0xe304('0xd'),_0x4096b6,_0x4fa65c);_0x1a5233(_0x4fa65c);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 8915db9..91400e1 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 _0xb7a6=['isAuthenticated','index','/describe','describe','/:id','/:id/sections','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','addResources','put','update','delete','destroy','removeSections','removeResources','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xec1efc,_0x1ff145){var _0x39f347=function(_0x40b8ad){while(--_0x40b8ad){_0xec1efc['push'](_0xec1efc['shift']());}};_0x39f347(++_0x1ff145);}(_0xb7a6,0x189));var _0x6b7a=function(_0x1ee00e,_0x298c64){_0x1ee00e=_0x1ee00e-0x0;var _0x46d572=_0xb7a6[_0x1ee00e];return _0x46d572;};'use strict';var multer=require('multer');var util=require(_0x6b7a('0x0'));var path=require(_0x6b7a('0x1'));var timeout=require(_0x6b7a('0x2'));var express=require(_0x6b7a('0x3'));var router=express[_0x6b7a('0x4')]();var fs_extra=require(_0x6b7a('0x5'));var auth=require(_0x6b7a('0x6'));var interaction=require(_0x6b7a('0x7'));var config=require(_0x6b7a('0x8'));var controller=require('./userProfile.controller');router[_0x6b7a('0x9')]('/',auth[_0x6b7a('0xa')](),controller[_0x6b7a('0xb')]);router['get'](_0x6b7a('0xc'),auth['isAuthenticated'](),controller[_0x6b7a('0xd')]);router[_0x6b7a('0x9')](_0x6b7a('0xe'),auth[_0x6b7a('0xa')](),controller['show']);router[_0x6b7a('0x9')](_0x6b7a('0xf'),auth[_0x6b7a('0xa')](),controller[_0x6b7a('0x10')]);router[_0x6b7a('0x9')](_0x6b7a('0x11'),auth[_0x6b7a('0xa')](),controller[_0x6b7a('0x12')]);router['post']('/',auth[_0x6b7a('0xa')](),controller[_0x6b7a('0x13')]);router[_0x6b7a('0x14')](_0x6b7a('0x15'),auth[_0x6b7a('0xa')](),controller[_0x6b7a('0x16')]);router[_0x6b7a('0x14')]('/:id/sections',auth[_0x6b7a('0xa')](),controller['addSections']);router['post'](_0x6b7a('0x11'),auth[_0x6b7a('0xa')](),controller[_0x6b7a('0x17')]);router[_0x6b7a('0x18')]('/:id',auth[_0x6b7a('0xa')](),controller[_0x6b7a('0x19')]);router[_0x6b7a('0x1a')](_0x6b7a('0xe'),auth[_0x6b7a('0xa')](),controller[_0x6b7a('0x1b')]);router['delete'](_0x6b7a('0xf'),auth[_0x6b7a('0xa')](),controller[_0x6b7a('0x1c')]);router[_0x6b7a('0x1a')](_0x6b7a('0x11'),auth['isAuthenticated'](),controller[_0x6b7a('0x1d')]);module[_0x6b7a('0x1e')]=router; \ No newline at end of file +var _0x942c=['multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/sections','getResources','post','/:id/clone','clone','/:id/resources','addResources','update','delete','destroy','removeSections','removeResources','exports'];(function(_0x3852e8,_0x5615fb){var _0x23bcd7=function(_0x24addd){while(--_0x24addd){_0x3852e8['push'](_0x3852e8['shift']());}};_0x23bcd7(++_0x5615fb);}(_0x942c,0xe0));var _0xc942=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x942c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc942('0x0'));var util=require('util');var path=require(_0xc942('0x1'));var timeout=require(_0xc942('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc942('0x3'));var auth=require(_0xc942('0x4'));var interaction=require(_0xc942('0x5'));var config=require(_0xc942('0x6'));var controller=require(_0xc942('0x7'));router['get']('/',auth[_0xc942('0x8')](),controller[_0xc942('0x9')]);router[_0xc942('0xa')](_0xc942('0xb'),auth[_0xc942('0x8')](),controller[_0xc942('0xc')]);router[_0xc942('0xa')](_0xc942('0xd'),auth['isAuthenticated'](),controller[_0xc942('0xe')]);router['get'](_0xc942('0xf'),auth[_0xc942('0x8')](),controller['getSections']);router[_0xc942('0xa')]('/:id/resources',auth[_0xc942('0x8')](),controller[_0xc942('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc942('0x11')](_0xc942('0x12'),auth['isAuthenticated'](),controller[_0xc942('0x13')]);router[_0xc942('0x11')]('/:id/sections',auth[_0xc942('0x8')](),controller['addSections']);router[_0xc942('0x11')](_0xc942('0x14'),auth[_0xc942('0x8')](),controller[_0xc942('0x15')]);router['put'](_0xc942('0xd'),auth[_0xc942('0x8')](),controller[_0xc942('0x16')]);router[_0xc942('0x17')](_0xc942('0xd'),auth[_0xc942('0x8')](),controller[_0xc942('0x18')]);router[_0xc942('0x17')](_0xc942('0xf'),auth[_0xc942('0x8')](),controller[_0xc942('0x19')]);router[_0xc942('0x17')](_0xc942('0x14'),auth[_0xc942('0x8')](),controller[_0xc942('0x1a')]);module[_0xc942('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 fd91e28..b1ef123 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 _0x1233=['join','getDataValue','BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions'];(function(_0x166976,_0x5c38c9){var _0x2b4dad=function(_0x2a3d96){while(--_0x2a3d96){_0x166976['push'](_0x166976['shift']());}};_0x2b4dad(++_0x5c38c9);}(_0x1233,0x18f));var _0x3123=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0x1233[_0x146a85];return _0x1b59bf;};'use strict';var Sequelize=require(_0x3123('0x0'));module[_0x3123('0x1')]={'name':{'type':Sequelize[_0x3123('0x2')],'allowNull':![],'unique':_0x3123('0x3')},'crudPermissions':{'type':Sequelize[_0x3123('0x2')],'set':function(_0x35417c){this[_0x3123('0x4')](_0x3123('0x5'),_0x35417c?_0x35417c[_0x3123('0x6')](''):[]);},'get':function(){return this[_0x3123('0x7')](_0x3123('0x5'))?this[_0x3123('0x7')](_0x3123('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x3123('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x3123('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x3123('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x3123('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x3123('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x3123('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x3123('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5f17=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','setDataValue','crudPermissions'];(function(_0x5dc3e8,_0x54b92a){var _0x406c4a=function(_0x5a6b68){while(--_0x5a6b68){_0x5dc3e8['push'](_0x5dc3e8['shift']());}};_0x406c4a(++_0x54b92a);}(_0x5f17,0x123));var _0x75f1=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x5f17[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require(_0x75f1('0x0'));module[_0x75f1('0x1')]={'name':{'type':Sequelize[_0x75f1('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x75f1('0x2')],'set':function(_0x4732f4){this[_0x75f1('0x3')](_0x75f1('0x4'),_0x4732f4?_0x4732f4['join'](''):[]);},'get':function(){return this['getDataValue'](_0x75f1('0x4'))?this[_0x75f1('0x5')](_0x75f1('0x4'))[_0x75f1('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x75f1('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x75f1('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x75f1('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x75f1('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x75f1('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x75f1('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x75f1('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 05b7e49..42d0f50 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 _0x3d04=['count','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','map','UserProfile','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','then','includeAll','include','rows','show','params','rawAttributes','merge','find','catch','create','body','clone','get','omit','createdAt','updatedAt','sequelize','transaction','UserProfileSection','findAll','each','sectionId','userProfileId','Resources','UserProfileResource','describe','addSections','push','removeSections','ids','getSections','enabled','includes','subsections','autoAssociation','findOne','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x1e6bf3,_0x4133b2){var _0x21ea62=function(_0x2e9f58){while(--_0x2e9f58){_0x1e6bf3['push'](_0x1e6bf3['shift']());}};_0x21ea62(++_0x4133b2);}(_0x3d04,0xbe));var _0x43d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d04[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x43d0('0x0'));var rimraf=require(_0x43d0('0x1'));var zipdir=require(_0x43d0('0x2'));var jsonpatch=require(_0x43d0('0x3'));var rp=require(_0x43d0('0x4'));var moment=require(_0x43d0('0x5'));var BPromise=require(_0x43d0('0x6'));var Mustache=require(_0x43d0('0x7'));var util=require('util');var path=require(_0x43d0('0x8'));var sox=require(_0x43d0('0x9'));var csv=require(_0x43d0('0xa'));var ejs=require(_0x43d0('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(_0x43d0('0xc'));var deskjs=require(_0x43d0('0xd'));var toCsv=require(_0x43d0('0xa'));var querystring=require(_0x43d0('0xe'));var Papa=require(_0x43d0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43d0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x43d0('0x11'))(_0x43d0('0x12'));var utils=require(_0x43d0('0x13'));var config=require(_0x43d0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x43d0('0x15'))['db'];config[_0x43d0('0x16')]=_['defaults'](config[_0x43d0('0x16')],{'host':_0x43d0('0x17'),'port':0x18eb});var socket=require(_0x43d0('0x18'))(new Redis(config['redis']));require(_0x43d0('0x19'))[_0x43d0('0x1a')](socket);function respondWithStatusCode(_0x436130,_0x47f3c6){_0x47f3c6=_0x47f3c6||0xcc;return function(_0x257510){if(_0x257510){return _0x436130[_0x43d0('0x1b')](_0x47f3c6);}return _0x436130[_0x43d0('0x1c')](_0x47f3c6)[_0x43d0('0x1d')]();};}function respondWithResult(_0x91b4a1,_0x4aa32a){_0x4aa32a=_0x4aa32a||0xc8;return function(_0x5d4fc4){if(_0x5d4fc4){return _0x91b4a1[_0x43d0('0x1c')](_0x4aa32a)[_0x43d0('0x1e')](_0x5d4fc4);}};}function respondWithFilteredResult(_0x35decf,_0x56a27b){return function(_0x2c641e){if(_0x2c641e){var _0x532402=typeof _0x56a27b[_0x43d0('0x1f')]===_0x43d0('0x20')&&typeof _0x56a27b[_0x43d0('0x21')]==='undefined';var _0x3d7dcc=_0x2c641e[_0x43d0('0x22')];var _0x4d9146=_0x532402?0x0:_0x56a27b[_0x43d0('0x1f')];var _0x135126=_0x532402?_0x2c641e[_0x43d0('0x22')]:_0x56a27b[_0x43d0('0x1f')]+_0x56a27b[_0x43d0('0x21')];var _0x28381b;if(_0x135126>=_0x3d7dcc){_0x135126=_0x3d7dcc;_0x28381b=0xc8;}else{_0x28381b=0xce;}_0x35decf[_0x43d0('0x1c')](_0x28381b);return _0x35decf[_0x43d0('0x23')](_0x43d0('0x24'),_0x4d9146+'-'+_0x135126+'/'+_0x3d7dcc)[_0x43d0('0x1e')](_0x2c641e);}return null;};}function patchUpdates(_0xec5f07){return function(_0x19d2ff){try{jsonpatch[_0x43d0('0x25')](_0x19d2ff,_0xec5f07,!![]);}catch(_0xbc72e6){return BPromise[_0x43d0('0x26')](_0xbc72e6);}return _0x19d2ff['save']();};}function saveUpdates(_0x2c7b24,_0x1bf6ae){return function(_0x509041){if(_0x509041){return _0x509041[_0x43d0('0x27')](_0x2c7b24)['then'](function(_0x29c111){return _0x29c111;});}return null;};}function removeEntity(_0x44497b,_0x5dd310){return function(_0x3e38e4){if(_0x3e38e4){return _0x3e38e4[_0x43d0('0x28')]()['then'](function(){_0x44497b[_0x43d0('0x1c')](0xcc)[_0x43d0('0x1d')]();});}};}function handleEntityNotFound(_0x22ae3c,_0x5f16ac){return function(_0x447725){if(!_0x447725){_0x22ae3c[_0x43d0('0x1b')](0x194);}return _0x447725;};}function handleError(_0x2c4f3f,_0x1eb771){_0x1eb771=_0x1eb771||0x1f4;return function(_0x37d78f){logger[_0x43d0('0x29')](_0x37d78f[_0x43d0('0x2a')]);if(_0x37d78f['name']){delete _0x37d78f[_0x43d0('0x2b')];}_0x2c4f3f[_0x43d0('0x1c')](_0x1eb771)[_0x43d0('0x2c')](_0x37d78f);};}exports['index']=function(_0x4bfce9,_0x52c37b){var _0x3c1ea3={},_0x2db9dc={},_0x10086b={'count':0x0,'rows':[]};var _0x13e3c9=_[_0x43d0('0x2d')](db[_0x43d0('0x2e')]['rawAttributes'],function(_0x77654d){return{'name':_0x77654d[_0x43d0('0x2f')],'type':_0x77654d[_0x43d0('0x30')][_0x43d0('0x31')]};});_0x2db9dc[_0x43d0('0x32')]=_[_0x43d0('0x2d')](_0x13e3c9,_0x43d0('0x2b'));_0x2db9dc[_0x43d0('0x33')]=_[_0x43d0('0x34')](_0x4bfce9[_0x43d0('0x33')]);_0x2db9dc[_0x43d0('0x35')]=_['intersection'](_0x2db9dc[_0x43d0('0x32')],_0x2db9dc[_0x43d0('0x33')]);_0x3c1ea3[_0x43d0('0x36')]=_[_0x43d0('0x37')](_0x2db9dc['model'],qs[_0x43d0('0x38')](_0x4bfce9['query'][_0x43d0('0x38')]));_0x3c1ea3[_0x43d0('0x36')]=_0x3c1ea3['attributes'][_0x43d0('0x39')]?_0x3c1ea3[_0x43d0('0x36')]:_0x2db9dc[_0x43d0('0x32')];if(!_0x4bfce9[_0x43d0('0x33')][_0x43d0('0x3a')](_0x43d0('0x3b'))){_0x3c1ea3[_0x43d0('0x21')]=qs[_0x43d0('0x21')](_0x4bfce9[_0x43d0('0x33')][_0x43d0('0x21')]);_0x3c1ea3[_0x43d0('0x1f')]=qs['offset'](_0x4bfce9[_0x43d0('0x33')][_0x43d0('0x1f')]);}_0x3c1ea3[_0x43d0('0x3c')]=qs[_0x43d0('0x3d')](_0x4bfce9[_0x43d0('0x33')][_0x43d0('0x3d')]);_0x3c1ea3[_0x43d0('0x3e')]=qs[_0x43d0('0x35')](_[_0x43d0('0x3f')](_0x4bfce9[_0x43d0('0x33')],_0x2db9dc[_0x43d0('0x35')]),_0x13e3c9);if(_0x4bfce9[_0x43d0('0x33')][_0x43d0('0x40')]){_0x3c1ea3[_0x43d0('0x3e')]=_['merge'](_0x3c1ea3[_0x43d0('0x3e')],{'$or':_[_0x43d0('0x2d')](_0x13e3c9,function(_0x38f330){if(_0x38f330[_0x43d0('0x30')]!==_0x43d0('0x41')){var _0x1e6c8b={};_0x1e6c8b[_0x38f330[_0x43d0('0x2b')]]={'$like':'%'+_0x4bfce9[_0x43d0('0x33')]['filter']+'%'};return _0x1e6c8b;}})});}_0x3c1ea3=_['merge']({},_0x3c1ea3,_0x4bfce9[_0x43d0('0x42')]);var _0x5ad2d0={'where':_0x3c1ea3['where']};return db[_0x43d0('0x2e')]['count'](_0x5ad2d0)[_0x43d0('0x43')](function(_0x5027d0){_0x10086b[_0x43d0('0x22')]=_0x5027d0;if(_0x4bfce9['query'][_0x43d0('0x44')]){_0x3c1ea3[_0x43d0('0x45')]=[{'all':!![]}];}return db[_0x43d0('0x2e')]['findAll'](_0x3c1ea3);})[_0x43d0('0x43')](function(_0x520406){_0x10086b[_0x43d0('0x46')]=_0x520406;return _0x10086b;})['then'](respondWithFilteredResult(_0x52c37b,_0x3c1ea3))['catch'](handleError(_0x52c37b,null));};exports[_0x43d0('0x47')]=function(_0xcb5a02,_0x4d539f){var _0x2f2ac9={'raw':![],'where':{'id':_0xcb5a02[_0x43d0('0x48')]['id']}},_0x1c87bc={};_0x1c87bc[_0x43d0('0x32')]=_[_0x43d0('0x34')](db['UserProfile'][_0x43d0('0x49')]);_0x1c87bc[_0x43d0('0x33')]=_[_0x43d0('0x34')](_0xcb5a02[_0x43d0('0x33')]);_0x1c87bc['filters']=_[_0x43d0('0x37')](_0x1c87bc[_0x43d0('0x32')],_0x1c87bc[_0x43d0('0x33')]);_0x2f2ac9[_0x43d0('0x36')]=_[_0x43d0('0x37')](_0x1c87bc['model'],qs[_0x43d0('0x38')](_0xcb5a02[_0x43d0('0x33')]['fields']));_0x2f2ac9[_0x43d0('0x36')]=_0x2f2ac9[_0x43d0('0x36')][_0x43d0('0x39')]?_0x2f2ac9['attributes']:_0x1c87bc[_0x43d0('0x32')];if(_0xcb5a02['query'][_0x43d0('0x44')]){_0x2f2ac9['include']=[{'all':!![]}];}_0x2f2ac9=_[_0x43d0('0x4a')]({},_0x2f2ac9,_0xcb5a02[_0x43d0('0x42')]);return db[_0x43d0('0x2e')][_0x43d0('0x4b')](_0x2f2ac9)[_0x43d0('0x43')](handleEntityNotFound(_0x4d539f,null))['then'](respondWithResult(_0x4d539f,null))[_0x43d0('0x4c')](handleError(_0x4d539f,null));};exports['create']=function(_0x5a6364,_0x3e7392){return db[_0x43d0('0x2e')][_0x43d0('0x4d')](_0x5a6364[_0x43d0('0x4e')],{})[_0x43d0('0x43')](respondWithResult(_0x3e7392,0xc9))[_0x43d0('0x4c')](handleError(_0x3e7392,null));};exports[_0x43d0('0x4f')]=function(_0x347ec2,_0x313c3e){var _0x27affd={'where':{'id':_0x347ec2['params']['id']}},_0x22b1f9={};_0x22b1f9[_0x43d0('0x32')]=_[_0x43d0('0x34')](db[_0x43d0('0x2e')]['rawAttributes']);_0x27affd[_0x43d0('0x36')]=_['intersection'](_0x22b1f9['model'],qs[_0x43d0('0x38')](_0x347ec2[_0x43d0('0x33')][_0x43d0('0x38')]));_0x27affd[_0x43d0('0x36')]=_0x27affd[_0x43d0('0x36')]['length']?_0x27affd['attributes']:_0x22b1f9[_0x43d0('0x32')];if(_0x347ec2['query'][_0x43d0('0x44')]){_0x27affd[_0x43d0('0x45')]=[{'all':!![]}];}_0x27affd=_['merge']({},_0x27affd,_0x347ec2['options']);return db['UserProfile'][_0x43d0('0x4b')](_0x27affd)[_0x43d0('0x43')](handleEntityNotFound(_0x313c3e,null))[_0x43d0('0x43')](function(_0x38ed47){if(_0x38ed47){var _0xeb7c28=_0x38ed47[_0x43d0('0x50')]({'plain':!![]});_0xeb7c28=qs[_0x43d0('0x51')](_0xeb7c28,['id',_0x43d0('0x52'),_0x43d0('0x53'),'crudPermissions']);_0x347ec2[_0x43d0('0x4e')]=_[_0x43d0('0x51')](_0x347ec2[_0x43d0('0x4e')],['id',_0x43d0('0x52'),_0x43d0('0x53')]);return db[_0x43d0('0x54')][_0x43d0('0x55')](function(_0x27ee58){return db[_0x43d0('0x2e')][_0x43d0('0x4d')](_['merge'](_0xeb7c28,_0x347ec2['body']),{'include':_0x347ec2[_0x43d0('0x33')][_0x43d0('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x27ee58})[_0x43d0('0x43')](function(_0x2e57b5){var _0x23b441=_0x2e57b5[_0x43d0('0x50')]({'plain':!![]});return db[_0x43d0('0x56')][_0x43d0('0x57')]({'where':{'userProfileId':_0x347ec2[_0x43d0('0x48')]['id']},'raw':!![]})[_0x43d0('0x43')](function(_0xe4f09d){if(_0xe4f09d){return BPromise[_0x43d0('0x58')](_0xe4f09d,function(_0x155ea8){return new BPromise(function(_0x1043bf,_0x40798f){if(_0x155ea8['autoAssociation']===null||_0x155ea8['autoAssociation']===0x1)_0x1043bf(null);return db['UserProfileResource'][_0x43d0('0x57')]({'where':{'sectionId':_0x155ea8['id']},'raw':!![]})[_0x43d0('0x43')](function(_0x14884e){var _0x4f15a3=_['map'](_0x14884e,function(_0x5dcd89){return qs[_0x43d0('0x51')](_0x5dcd89,['id','createdAt',_0x43d0('0x53'),_0x43d0('0x59')]);});_0x1043bf(_0x4f15a3);})[_0x43d0('0x4c')](function(_0x5519c1){_0x40798f(_0x5519c1);});})[_0x43d0('0x43')](function(_0x47668e){var _0x35a743=qs[_0x43d0('0x51')](_0x155ea8,['id',_0x43d0('0x52'),_0x43d0('0x53')]);_0x35a743[_0x43d0('0x5a')]=_0x23b441['id'];if(_0x47668e)_0x35a743[_0x43d0('0x5b')]=_0x47668e;return _0x35a743;})[_0x43d0('0x43')](function(_0x16a2d8){return db['UserProfileSection'][_0x43d0('0x4d')](_0x16a2d8,{'include':[{'model':db[_0x43d0('0x5c')],'as':_0x43d0('0x5b')}],'raw':!![],'transaction':_0x27ee58});});})[_0x43d0('0x43')](function(){return _0x23b441;});}});});});}})[_0x43d0('0x43')](respondWithResult(_0x313c3e,0xc9))[_0x43d0('0x4c')](handleError(_0x313c3e,null));};exports['update']=function(_0x3951e4,_0x17886d){if(_0x3951e4[_0x43d0('0x4e')]['id']){delete _0x3951e4[_0x43d0('0x4e')]['id'];}return db[_0x43d0('0x2e')][_0x43d0('0x4b')]({'where':{'id':_0x3951e4['params']['id']}})[_0x43d0('0x43')](handleEntityNotFound(_0x17886d,null))[_0x43d0('0x43')](saveUpdates(_0x3951e4[_0x43d0('0x4e')],null))[_0x43d0('0x43')](respondWithResult(_0x17886d,null))['catch'](handleError(_0x17886d,null));};exports[_0x43d0('0x28')]=function(_0x44333,_0x2c9b0d){return db['UserProfile']['find']({'where':{'id':_0x44333[_0x43d0('0x48')]['id']}})[_0x43d0('0x43')](handleEntityNotFound(_0x2c9b0d,null))['then'](removeEntity(_0x2c9b0d,null))['catch'](handleError(_0x2c9b0d,null));};exports[_0x43d0('0x5d')]=function(_0x178f97,_0x274c92){return db[_0x43d0('0x2e')][_0x43d0('0x5d')]()[_0x43d0('0x43')](respondWithResult(_0x274c92,null))[_0x43d0('0x4c')](handleError(_0x274c92,null));};exports[_0x43d0('0x5e')]=function(_0x554919,_0x44fd10){var _0x471912=_0x554919['body'];return db['UserProfile']['find']({'where':{'id':_0x554919[_0x43d0('0x48')]['id']}})[_0x43d0('0x43')](handleEntityNotFound(_0x44fd10,null))[_0x43d0('0x43')](function(_0x505946){if(_0x505946){return db[_0x43d0('0x54')][_0x43d0('0x55')](function(_0x551dae){return db[_0x43d0('0x56')][_0x43d0('0x28')]({'where':{'userProfileId':_0x554919['params']['id'],'sectionId':_[_0x43d0('0x2d')](_0x471912,function(_0x4e5c9f){return _0x4e5c9f[_0x43d0('0x59')];})},'transaction':_0x551dae})[_0x43d0('0x43')](function(){var _0x4a947b=_['map'](_0x471912,function(_0x1a68db){_0x1a68db[_0x43d0('0x5a')]=_0x554919[_0x43d0('0x48')]['id'];return _0x1a68db;});var _0x4dca6e=[];return BPromise['each'](_0x4a947b,function(_0x441d46){return db[_0x43d0('0x56')]['create'](_0x441d46,{'include':[{'model':db[_0x43d0('0x5c')],'as':'Resources'}],'raw':!![],'transaction':_0x551dae})['then'](function(_0x27a2c7){_0x4dca6e[_0x43d0('0x5f')](_0x27a2c7[_0x43d0('0x50')]({'plain':!![]}));});})[_0x43d0('0x43')](function(){return _0x4dca6e;});});});}})[_0x43d0('0x43')](function(_0x3f5c9b){return _0x3f5c9b;})[_0x43d0('0x43')](respondWithResult(_0x44fd10,null))[_0x43d0('0x4c')](handleError(_0x44fd10,null));};exports[_0x43d0('0x60')]=function(_0x29ac7e,_0x3b488c){var _0x5b97bc;return db[_0x43d0('0x2e')]['find']({'where':{'id':_0x29ac7e['params']['id']},'attributes':['id',_0x43d0('0x2b')]})[_0x43d0('0x43')](handleEntityNotFound(_0x3b488c,null))['then'](function(_0x2b8b92){if(_0x2b8b92){_0x5b97bc=_0x2b8b92;return db[_0x43d0('0x56')][_0x43d0('0x28')]({'where':{'userProfileId':_0x29ac7e[_0x43d0('0x48')]['id'],'sectionId':_0x29ac7e[_0x43d0('0x33')][_0x43d0('0x61')]}});}})[_0x43d0('0x43')](function(){return _0x5b97bc;})[_0x43d0('0x43')](respondWithStatusCode(_0x3b488c,null))[_0x43d0('0x4c')](handleError(_0x3b488c,null));};exports[_0x43d0('0x62')]=function(_0x81485b,_0x1aa37f){var _0x241c6e=[];var _0x2945ad=[];return db[_0x43d0('0x56')]['findAll']({'where':{'userProfileId':_0x81485b[_0x43d0('0x48')]['id']},'raw':!![]})[_0x43d0('0x43')](function(_0x228f4e){_0x241c6e=_[_0x43d0('0x40')](_0x228f4e,function(_0x44c085){return _0x44c085[_0x43d0('0x63')]===0x1||_['includes']([0x3eb,0x709],_0x44c085[_0x43d0('0x59')]);});if(!_['isEmpty'](_0x241c6e)){return _[_0x43d0('0x2d')](_0x241c6e,function(_0x948a6a){return _0x948a6a[_0x43d0('0x59')];});}else{return;}})[_0x43d0('0x43')](function(_0x26573a){if(_0x26573a)_0x2945ad=_0x26573a;if(_[_0x43d0('0x64')](_0x2945ad,0x64)){var _0x219d70=_['find'](_0x241c6e,{'sectionId':0x64});return hasDefaultDashboard(_0x219d70)['then'](function(_0xaa6b5a){return _[_0x43d0('0x2d')](_0x241c6e,function(_0x38299a){if(_0x38299a[_0x43d0('0x59')]===0x64){_0x38299a[_0x43d0('0x65')]=_0xaa6b5a;}return _0x38299a;});});}else{return;}})[_0x43d0('0x43')](function(_0x4c8b48){if(_0x4c8b48)_0x241c6e=_0x4c8b48;if(_['includes'](_0x2945ad,0x3eb)){var _0x2cef12=_['find'](_0x241c6e,{'sectionId':0x3eb});return getCustomDashboards(_0x2cef12)[_0x43d0('0x43')](function(_0x2cc15b){return _[_0x43d0('0x2d')](_0x241c6e,function(_0x4523e6){if(_0x2cef12[_0x43d0('0x63')]){if(_0x4523e6[_0x43d0('0x59')]===0x3eb){_0x4523e6[_0x43d0('0x65')]=_0x2cc15b;}}else{if(_0x4523e6['sectionId']===0x64){_0x4523e6[_0x43d0('0x65')]=_0x2cc15b;}}return _0x4523e6;});});}else{return;}})[_0x43d0('0x43')](function(_0x343954){if(_0x343954)_0x241c6e=_0x343954;if(_[_0x43d0('0x64')](_0x2945ad,0x709)){var _0x23422e=_[_0x43d0('0x4b')](_0x241c6e,{'sectionId':0x709});return getPlugins(_0x23422e)[_0x43d0('0x43')](function(_0x2b1454){if(_0x23422e[_0x43d0('0x63')]){return _[_0x43d0('0x2d')](_0x241c6e,function(_0x35e659){if(_0x35e659[_0x43d0('0x59')]===0x709){_0x35e659[_0x43d0('0x65')]=_0x2b1454;}return _0x35e659;});}else{var _0x11a9bc={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2b1454};var _0x4fa0de=_['map'](_0x241c6e);_0x4fa0de['push'](_0x11a9bc);return _0x4fa0de;}});}else{return;}})[_0x43d0('0x43')](function(_0x4387ab){if(_0x4387ab)_0x241c6e=_0x4387ab;return _[_0x43d0('0x40')](_0x241c6e,[_0x43d0('0x63'),0x1]);})['then'](respondWithResult(_0x1aa37f,null))[_0x43d0('0x4c')](handleError(_0x1aa37f,null));};function hasDefaultDashboard(_0x4a3266){var _0x24924a=[0x65];return new BPromise(function(_0x28f523,_0x754cd4){try{if(_0x4a3266[_0x43d0('0x66')]){_0x28f523(_0x24924a);}else{return db[_0x43d0('0x5c')][_0x43d0('0x67')]({'where':{'sectionId':_0x4a3266['id']},'raw':!![]})[_0x43d0('0x43')](function(_0x531ba2){_0x531ba2?_0x28f523(_0x24924a):_0x28f523();});}}catch(_0x36e5c0){_0x754cd4(_0x36e5c0);}});}function getCustomDashboards(_0x162fb0){var _0x4645d3=[];return new BPromise(function(_0xcc08ce,_0x4948f2){try{if(_0x162fb0[_0x43d0('0x66')]){return db['Dashboard'][_0x43d0('0x57')]({'raw':!![]})['then'](function(_0x3a5421){_0x3a5421[_0x43d0('0x68')](function(_0x3fdf44){_0x4645d3['push'](_0x3fdf44['id']+0x1869f);});_0xcc08ce(_0x4645d3);});}else{return db[_0x43d0('0x5c')][_0x43d0('0x57')]({'where':{'sectionId':_0x162fb0['id']},'raw':!![]})[_0x43d0('0x43')](function(_0x43baea){_0x43baea['forEach'](function(_0x3c19f7){_0x4645d3[_0x43d0('0x5f')](_0x3c19f7[_0x43d0('0x69')]+0x1869f);});_0xcc08ce(_0x4645d3);});}}catch(_0x6ed83d){_0x4948f2(_0x6ed83d);}});}function getPlugins(_0x3dba5b){var _0x43eba2=[];return new BPromise(function(_0x3aad81,_0x44d85e){try{if(_0x3dba5b['autoAssociation']){return db[_0x43d0('0x6a')]['findAll']({'raw':!![]})[_0x43d0('0x43')](function(_0x39de5f){_0x39de5f['forEach'](function(_0x2e085a){_0x43eba2[_0x43d0('0x5f')](_0x2e085a['id']+0x15b38);});_0x3aad81(_0x43eba2);});}else{return db[_0x43d0('0x5c')][_0x43d0('0x57')]({'where':{'sectionId':_0x3dba5b['id']},'raw':!![]})[_0x43d0('0x43')](function(_0x591118){_0x591118[_0x43d0('0x68')](function(_0x56cac9){_0x43eba2[_0x43d0('0x5f')](_0x56cac9['resourceId']+0x15b38);});_0x3aad81(_0x43eba2);});}}catch(_0x2f768b){_0x44d85e(_0x2f768b);}});}exports['addResources']=function(_0xed3a6e,_0x5ababd){return db['UserProfile'][_0x43d0('0x4b')]({'where':{'id':_0xed3a6e[_0x43d0('0x48')]['id']}})[_0x43d0('0x43')](handleEntityNotFound(_0x5ababd,null))[_0x43d0('0x43')](function(_0x2f9ef9){if(_0x2f9ef9){return db[_0x43d0('0x54')][_0x43d0('0x55')](function(_0xebf7f9){return db[_0x43d0('0x56')][_0x43d0('0x57')]({'where':{'userProfileId':_0xed3a6e[_0x43d0('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x43d0('0x43')](function(_0xc0af78){if(_0xc0af78){return db['UserProfileSection'][_0x43d0('0x28')]({'where':{'userProfileId':_0xed3a6e[_0x43d0('0x48')]['id'],'id':_[_0x43d0('0x2d')](_0xc0af78,function(_0x4600b1){return _0x4600b1['id'];})},'transaction':_0xebf7f9});}})[_0x43d0('0x43')](function(_0x53ff2b){var _0x44e2a9=_[_0x43d0('0x2d')](_0xed3a6e[_0x43d0('0x4e')],function(_0x45c8f0){_0x45c8f0[_0x43d0('0x5a')]=_0xed3a6e[_0x43d0('0x48')]['id'];return _0x45c8f0;});return db['UserProfileSection'][_0x43d0('0x6b')](_0x44e2a9,{'raw':!![],'transaction':_0xebf7f9});})[_0x43d0('0x43')](function(_0x399a8a){var _0x5ceafb=_[_0x43d0('0x40')](_[_0x43d0('0x2d')](_0x399a8a,function(_0x53c4b1){return _0x53c4b1['get']({'plain':!![]});}),{'includeAll':![]});if(_0x5ceafb){return db[_0x43d0('0x56')][_0x43d0('0x57')]({'where':{'userProfileId':_0xed3a6e[_0x43d0('0x48')]['id'],'sectionId':_[_0x43d0('0x2d')](_0x5ceafb,function(_0x5a1538){return _0x5a1538[_0x43d0('0x59')];})},'attributes':['id',_0x43d0('0x59')],'raw':!![]})['then'](function(_0x5171f8){var _0x36d7b7=_['map'](_0xed3a6e[_0x43d0('0x4e')],function(_0x2afd7b){_0x2afd7b[_0x43d0('0x5a')]=_0xed3a6e[_0x43d0('0x48')]['id'];return _0x2afd7b;});return db[_0x43d0('0x5c')][_0x43d0('0x6b')](_0x36d7b7,{'raw':!![],'transaction':_0xebf7f9});});}})[_0x43d0('0x4c')](handleError(_0x5ababd,null));});}})[_0x43d0('0x43')](function(_0x1ab7fb){var _0x55c834=_['map'](_0x1ab7fb,function(_0x3646d3){return _0x3646d3[_0x43d0('0x50')]({'plain':!![]});});})[_0x43d0('0x43')](respondWithResult(_0x5ababd,null))[_0x43d0('0x4c')](handleError(_0x5ababd,null));};exports['removeResources']=function(_0x5f1062,_0x45b90b,_0x3088b3){return db[_0x43d0('0x2e')][_0x43d0('0x4b')]({'where':{'id':_0x5f1062[_0x43d0('0x48')]['id']}})['then'](handleEntityNotFound(_0x45b90b,null))[_0x43d0('0x43')](function(_0x45cc44){if(_0x45cc44){return _0x45cc44[_0x43d0('0x6c')](_0x5f1062[_0x43d0('0x33')][_0x43d0('0x61')]);}})[_0x43d0('0x43')](respondWithStatusCode(_0x45b90b,null))['catch'](handleError(_0x45b90b,null));};exports[_0x43d0('0x6d')]=function(_0x4e1751,_0x41884a){var _0x442545={};if(!_0x4e1751[_0x43d0('0x33')][_0x43d0('0x6e')])throw new Error('Missing\x20section\x20parameter');if(!_0x4e1751[_0x43d0('0x33')]['hasOwnProperty'](_0x43d0('0x3b'))){_0x442545[_0x43d0('0x21')]=qs[_0x43d0('0x21')](_0x4e1751[_0x43d0('0x33')][_0x43d0('0x21')]);_0x442545[_0x43d0('0x1f')]=qs[_0x43d0('0x1f')](_0x4e1751[_0x43d0('0x33')][_0x43d0('0x1f')]);}return db[_0x43d0('0x2e')][_0x43d0('0x4b')]({'where':{'id':_0x4e1751[_0x43d0('0x48')]['id']}})['then'](function(_0x394984){if(!_0x394984)throw new Error(_0x43d0('0x6f')+_0x4e1751[_0x43d0('0x48')]['id']);return db[_0x43d0('0x2e')][_0x43d0('0x6d')](_0x4e1751);})[_0x43d0('0x43')](respondWithFilteredResult(_0x41884a,_0x442545))[_0x43d0('0x4c')](handleError(_0x41884a,null));}; \ No newline at end of file +var _0x578c=['desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','then','destroy','error','stack','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','clone','createdAt','updatedAt','crudPermissions','omit','sequelize','transaction','get','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','describe','addSections','push','ids','getSections','includes','isEmpty','enabled','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x3a8ec5,_0x378f44){var _0x483caf=function(_0x559670){while(--_0x559670){_0x3a8ec5['push'](_0x3a8ec5['shift']());}};_0x483caf(++_0x378f44);}(_0x578c,0x158));var _0xc578=function(_0x483544,_0x3bee38){_0x483544=_0x483544-0x0;var _0x2e4169=_0x578c[_0x483544];return _0x2e4169;};'use strict';var emlformat=require(_0xc578('0x0'));var rimraf=require(_0xc578('0x1'));var zipdir=require(_0xc578('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc578('0x3'));var moment=require(_0xc578('0x4'));var BPromise=require(_0xc578('0x5'));var Mustache=require('mustache');var util=require(_0xc578('0x6'));var path=require(_0xc578('0x7'));var sox=require(_0xc578('0x8'));var csv=require(_0xc578('0x9'));var ejs=require(_0xc578('0xa'));var fs=require('fs');var fs_extra=require(_0xc578('0xb'));var _=require(_0xc578('0xc'));var squel=require(_0xc578('0xd'));var crypto=require(_0xc578('0xe'));var jsforce=require(_0xc578('0xf'));var deskjs=require(_0xc578('0x10'));var toCsv=require(_0xc578('0x9'));var querystring=require(_0xc578('0x11'));var Papa=require(_0xc578('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc578('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc578('0x14'));var logger=require(_0xc578('0x15'))(_0xc578('0x16'));var utils=require('../../config/utils');var config=require(_0xc578('0x17'));var licenseUtil=require(_0xc578('0x18'));var db=require(_0xc578('0x19'))['db'];config['redis']=_[_0xc578('0x1a')](config[_0xc578('0x1b')],{'host':_0xc578('0x1c'),'port':0x18eb});var socket=require(_0xc578('0x1d'))(new Redis(config[_0xc578('0x1b')]));require('./userProfile.socket')[_0xc578('0x1e')](socket);function respondWithStatusCode(_0x3634a4,_0x13a4eb){_0x13a4eb=_0x13a4eb||0xcc;return function(_0x251007){if(_0x251007){return _0x3634a4[_0xc578('0x1f')](_0x13a4eb);}return _0x3634a4[_0xc578('0x20')](_0x13a4eb)[_0xc578('0x21')]();};}function respondWithResult(_0x13b6d4,_0x109756){_0x109756=_0x109756||0xc8;return function(_0x3f6f18){if(_0x3f6f18){return _0x13b6d4[_0xc578('0x20')](_0x109756)[_0xc578('0x22')](_0x3f6f18);}};}function respondWithFilteredResult(_0x45e527,_0x450244){return function(_0x462935){if(_0x462935){var _0x415b76=typeof _0x450244[_0xc578('0x23')]===_0xc578('0x24')&&typeof _0x450244['limit']===_0xc578('0x24');var _0x2822c1=_0x462935[_0xc578('0x25')];var _0x70ed21=_0x415b76?0x0:_0x450244['offset'];var _0x29284c=_0x415b76?_0x462935[_0xc578('0x25')]:_0x450244[_0xc578('0x23')]+_0x450244['limit'];var _0x5202e3;if(_0x29284c>=_0x2822c1){_0x29284c=_0x2822c1;_0x5202e3=0xc8;}else{_0x5202e3=0xce;}_0x45e527['status'](_0x5202e3);return _0x45e527[_0xc578('0x26')](_0xc578('0x27'),_0x70ed21+'-'+_0x29284c+'/'+_0x2822c1)[_0xc578('0x22')](_0x462935);}return null;};}function patchUpdates(_0x326575){return function(_0x397bf0){try{jsonpatch['apply'](_0x397bf0,_0x326575,!![]);}catch(_0x19314b){return BPromise[_0xc578('0x28')](_0x19314b);}return _0x397bf0[_0xc578('0x29')]();};}function saveUpdates(_0x4f2305,_0x23b202){return function(_0x54388f){if(_0x54388f){return _0x54388f['update'](_0x4f2305)[_0xc578('0x2a')](function(_0xbf3f05){return _0xbf3f05;});}return null;};}function removeEntity(_0xf4090e,_0x431638){return function(_0x5998e0){if(_0x5998e0){return _0x5998e0[_0xc578('0x2b')]()[_0xc578('0x2a')](function(){_0xf4090e['status'](0xcc)[_0xc578('0x21')]();});}};}function handleEntityNotFound(_0x2762d9,_0x4fbf4b){return function(_0x47502d){if(!_0x47502d){_0x2762d9['sendStatus'](0x194);}return _0x47502d;};}function handleError(_0x1622d1,_0x56d9e1){_0x56d9e1=_0x56d9e1||0x1f4;return function(_0x1e4623){logger[_0xc578('0x2c')](_0x1e4623[_0xc578('0x2d')]);if(_0x1e4623['name']){delete _0x1e4623['name'];}_0x1622d1[_0xc578('0x20')](_0x56d9e1)[_0xc578('0x2e')](_0x1e4623);};}exports[_0xc578('0x2f')]=function(_0x5dca96,_0x4f8e2a){var _0x19b91b={},_0x845df5={},_0x3c3690={'count':0x0,'rows':[]};var _0x169586=_[_0xc578('0x30')](db[_0xc578('0x31')][_0xc578('0x32')],function(_0x572645){return{'name':_0x572645[_0xc578('0x33')],'type':_0x572645[_0xc578('0x34')][_0xc578('0x35')]};});_0x845df5[_0xc578('0x36')]=_[_0xc578('0x30')](_0x169586,_0xc578('0x37'));_0x845df5[_0xc578('0x38')]=_[_0xc578('0x39')](_0x5dca96[_0xc578('0x38')]);_0x845df5[_0xc578('0x3a')]=_[_0xc578('0x3b')](_0x845df5[_0xc578('0x36')],_0x845df5[_0xc578('0x38')]);_0x19b91b[_0xc578('0x3c')]=_[_0xc578('0x3b')](_0x845df5[_0xc578('0x36')],qs[_0xc578('0x3d')](_0x5dca96[_0xc578('0x38')][_0xc578('0x3d')]));_0x19b91b['attributes']=_0x19b91b[_0xc578('0x3c')][_0xc578('0x3e')]?_0x19b91b[_0xc578('0x3c')]:_0x845df5[_0xc578('0x36')];if(!_0x5dca96[_0xc578('0x38')][_0xc578('0x3f')](_0xc578('0x40'))){_0x19b91b[_0xc578('0x41')]=qs[_0xc578('0x41')](_0x5dca96[_0xc578('0x38')]['limit']);_0x19b91b[_0xc578('0x23')]=qs[_0xc578('0x23')](_0x5dca96[_0xc578('0x38')][_0xc578('0x23')]);}_0x19b91b[_0xc578('0x42')]=qs['sort'](_0x5dca96[_0xc578('0x38')][_0xc578('0x43')]);_0x19b91b[_0xc578('0x44')]=qs[_0xc578('0x3a')](_[_0xc578('0x45')](_0x5dca96['query'],_0x845df5['filters']),_0x169586);if(_0x5dca96['query'][_0xc578('0x46')]){_0x19b91b[_0xc578('0x44')]=_[_0xc578('0x47')](_0x19b91b[_0xc578('0x44')],{'$or':_[_0xc578('0x30')](_0x169586,function(_0x38ec41){if(_0x38ec41['type']!==_0xc578('0x48')){var _0x27e20d={};_0x27e20d[_0x38ec41[_0xc578('0x37')]]={'$like':'%'+_0x5dca96[_0xc578('0x38')][_0xc578('0x46')]+'%'};return _0x27e20d;}})});}_0x19b91b=_[_0xc578('0x47')]({},_0x19b91b,_0x5dca96[_0xc578('0x49')]);var _0x323355={'where':_0x19b91b['where']};return db[_0xc578('0x31')]['count'](_0x323355)[_0xc578('0x2a')](function(_0x56d04a){_0x3c3690[_0xc578('0x25')]=_0x56d04a;if(_0x5dca96[_0xc578('0x38')][_0xc578('0x4a')]){_0x19b91b['include']=[{'all':!![]}];}return db['UserProfile'][_0xc578('0x4b')](_0x19b91b);})[_0xc578('0x2a')](function(_0x161067){_0x3c3690['rows']=_0x161067;return _0x3c3690;})['then'](respondWithFilteredResult(_0x4f8e2a,_0x19b91b))[_0xc578('0x4c')](handleError(_0x4f8e2a,null));};exports[_0xc578('0x4d')]=function(_0x57e68c,_0x3ec901){var _0x1c9924={'raw':![],'where':{'id':_0x57e68c[_0xc578('0x4e')]['id']}},_0x17578d={};_0x17578d[_0xc578('0x36')]=_[_0xc578('0x39')](db[_0xc578('0x31')][_0xc578('0x32')]);_0x17578d[_0xc578('0x38')]=_[_0xc578('0x39')](_0x57e68c[_0xc578('0x38')]);_0x17578d['filters']=_[_0xc578('0x3b')](_0x17578d['model'],_0x17578d[_0xc578('0x38')]);_0x1c9924[_0xc578('0x3c')]=_[_0xc578('0x3b')](_0x17578d[_0xc578('0x36')],qs[_0xc578('0x3d')](_0x57e68c['query'][_0xc578('0x3d')]));_0x1c9924['attributes']=_0x1c9924[_0xc578('0x3c')][_0xc578('0x3e')]?_0x1c9924[_0xc578('0x3c')]:_0x17578d[_0xc578('0x36')];if(_0x57e68c['query'][_0xc578('0x4a')]){_0x1c9924[_0xc578('0x4f')]=[{'all':!![]}];}_0x1c9924=_[_0xc578('0x47')]({},_0x1c9924,_0x57e68c[_0xc578('0x49')]);return db[_0xc578('0x31')][_0xc578('0x50')](_0x1c9924)['then'](handleEntityNotFound(_0x3ec901,null))[_0xc578('0x2a')](respondWithResult(_0x3ec901,null))[_0xc578('0x4c')](handleError(_0x3ec901,null));};exports[_0xc578('0x51')]=function(_0x55e44e,_0x364703){return db[_0xc578('0x31')][_0xc578('0x51')](_0x55e44e[_0xc578('0x52')],{})[_0xc578('0x2a')](respondWithResult(_0x364703,0xc9))['catch'](handleError(_0x364703,null));};exports[_0xc578('0x53')]=function(_0x3cc17c,_0x5b5932){var _0x7108a1={'where':{'id':_0x3cc17c[_0xc578('0x4e')]['id']}},_0x42d1d2={};_0x42d1d2[_0xc578('0x36')]=_[_0xc578('0x39')](db[_0xc578('0x31')][_0xc578('0x32')]);_0x7108a1['attributes']=_[_0xc578('0x3b')](_0x42d1d2[_0xc578('0x36')],qs[_0xc578('0x3d')](_0x3cc17c[_0xc578('0x38')][_0xc578('0x3d')]));_0x7108a1['attributes']=_0x7108a1[_0xc578('0x3c')]['length']?_0x7108a1[_0xc578('0x3c')]:_0x42d1d2[_0xc578('0x36')];if(_0x3cc17c[_0xc578('0x38')]['includeAll']){_0x7108a1[_0xc578('0x4f')]=[{'all':!![]}];}_0x7108a1=_[_0xc578('0x47')]({},_0x7108a1,_0x3cc17c[_0xc578('0x49')]);return db[_0xc578('0x31')][_0xc578('0x50')](_0x7108a1)[_0xc578('0x2a')](handleEntityNotFound(_0x5b5932,null))[_0xc578('0x2a')](function(_0x5632bb){if(_0x5632bb){var _0x469fcf=_0x5632bb['get']({'plain':!![]});_0x469fcf=qs['omit'](_0x469fcf,['id',_0xc578('0x54'),_0xc578('0x55'),_0xc578('0x56')]);_0x3cc17c['body']=_[_0xc578('0x57')](_0x3cc17c['body'],['id',_0xc578('0x54'),_0xc578('0x55')]);return db[_0xc578('0x58')][_0xc578('0x59')](function(_0x1ddc24){return db[_0xc578('0x31')]['create'](_[_0xc578('0x47')](_0x469fcf,_0x3cc17c['body']),{'include':_0x3cc17c[_0xc578('0x38')][_0xc578('0x4a')]?[{'all':!![]}]:undefined,'transaction':_0x1ddc24})['then'](function(_0x39ce62){var _0x4bea64=_0x39ce62[_0xc578('0x5a')]({'plain':!![]});return db[_0xc578('0x5b')][_0xc578('0x4b')]({'where':{'userProfileId':_0x3cc17c['params']['id']},'raw':!![]})['then'](function(_0x426907){if(_0x426907){return BPromise[_0xc578('0x5c')](_0x426907,function(_0x406475){return new BPromise(function(_0x2328db,_0x2a7442){if(_0x406475[_0xc578('0x5d')]===null||_0x406475[_0xc578('0x5d')]===0x1)_0x2328db(null);return db[_0xc578('0x5e')][_0xc578('0x4b')]({'where':{'sectionId':_0x406475['id']},'raw':!![]})[_0xc578('0x2a')](function(_0x4b1de0){var _0x37e49a=_[_0xc578('0x30')](_0x4b1de0,function(_0x25e7aa){return qs[_0xc578('0x57')](_0x25e7aa,['id',_0xc578('0x54'),'updatedAt',_0xc578('0x5f')]);});_0x2328db(_0x37e49a);})[_0xc578('0x4c')](function(_0x2925e3){_0x2a7442(_0x2925e3);});})['then'](function(_0x58a43c){var _0x367a2c=qs['omit'](_0x406475,['id',_0xc578('0x54'),_0xc578('0x55')]);_0x367a2c[_0xc578('0x60')]=_0x4bea64['id'];if(_0x58a43c)_0x367a2c['Resources']=_0x58a43c;return _0x367a2c;})[_0xc578('0x2a')](function(_0x45a12f){return db[_0xc578('0x5b')][_0xc578('0x51')](_0x45a12f,{'include':[{'model':db['UserProfileResource'],'as':_0xc578('0x61')}],'raw':!![],'transaction':_0x1ddc24});});})[_0xc578('0x2a')](function(){return _0x4bea64;});}});});});}})[_0xc578('0x2a')](respondWithResult(_0x5b5932,0xc9))[_0xc578('0x4c')](handleError(_0x5b5932,null));};exports[_0xc578('0x62')]=function(_0x50d4b0,_0x241a87){if(_0x50d4b0[_0xc578('0x52')]['id']){delete _0x50d4b0['body']['id'];}return db[_0xc578('0x31')][_0xc578('0x50')]({'where':{'id':_0x50d4b0['params']['id']}})[_0xc578('0x2a')](handleEntityNotFound(_0x241a87,null))['then'](saveUpdates(_0x50d4b0[_0xc578('0x52')],null))['then'](respondWithResult(_0x241a87,null))[_0xc578('0x4c')](handleError(_0x241a87,null));};exports[_0xc578('0x2b')]=function(_0x4a2d8e,_0x4bfa3f){return db[_0xc578('0x31')][_0xc578('0x50')]({'where':{'id':_0x4a2d8e[_0xc578('0x4e')]['id']}})[_0xc578('0x2a')](handleEntityNotFound(_0x4bfa3f,null))[_0xc578('0x2a')](removeEntity(_0x4bfa3f,null))[_0xc578('0x4c')](handleError(_0x4bfa3f,null));};exports['describe']=function(_0x1ba24c,_0x518ac4){return db[_0xc578('0x31')][_0xc578('0x63')]()['then'](respondWithResult(_0x518ac4,null))[_0xc578('0x4c')](handleError(_0x518ac4,null));};exports[_0xc578('0x64')]=function(_0x3bcfd1,_0x43553c){var _0x4850ea=_0x3bcfd1['body'];return db[_0xc578('0x31')][_0xc578('0x50')]({'where':{'id':_0x3bcfd1[_0xc578('0x4e')]['id']}})[_0xc578('0x2a')](handleEntityNotFound(_0x43553c,null))[_0xc578('0x2a')](function(_0x15e243){if(_0x15e243){return db[_0xc578('0x58')][_0xc578('0x59')](function(_0x158ec5){return db[_0xc578('0x5b')][_0xc578('0x2b')]({'where':{'userProfileId':_0x3bcfd1[_0xc578('0x4e')]['id'],'sectionId':_[_0xc578('0x30')](_0x4850ea,function(_0x40119a){return _0x40119a[_0xc578('0x5f')];})},'transaction':_0x158ec5})[_0xc578('0x2a')](function(){var _0x15a501=_[_0xc578('0x30')](_0x4850ea,function(_0x11a961){_0x11a961['userProfileId']=_0x3bcfd1[_0xc578('0x4e')]['id'];return _0x11a961;});var _0x17a974=[];return BPromise[_0xc578('0x5c')](_0x15a501,function(_0x4616b5){return db[_0xc578('0x5b')][_0xc578('0x51')](_0x4616b5,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x158ec5})['then'](function(_0x2dc023){_0x17a974[_0xc578('0x65')](_0x2dc023[_0xc578('0x5a')]({'plain':!![]}));});})[_0xc578('0x2a')](function(){return _0x17a974;});});});}})[_0xc578('0x2a')](function(_0x49f202){return _0x49f202;})[_0xc578('0x2a')](respondWithResult(_0x43553c,null))[_0xc578('0x4c')](handleError(_0x43553c,null));};exports['removeSections']=function(_0x38cfe0,_0x46abfa){var _0x4046c8;return db[_0xc578('0x31')][_0xc578('0x50')]({'where':{'id':_0x38cfe0[_0xc578('0x4e')]['id']},'attributes':['id',_0xc578('0x37')]})['then'](handleEntityNotFound(_0x46abfa,null))[_0xc578('0x2a')](function(_0x6c1c27){if(_0x6c1c27){_0x4046c8=_0x6c1c27;return db[_0xc578('0x5b')]['destroy']({'where':{'userProfileId':_0x38cfe0['params']['id'],'sectionId':_0x38cfe0['query'][_0xc578('0x66')]}});}})['then'](function(){return _0x4046c8;})[_0xc578('0x2a')](respondWithStatusCode(_0x46abfa,null))[_0xc578('0x4c')](handleError(_0x46abfa,null));};exports[_0xc578('0x67')]=function(_0x590f63,_0x17bbd5){var _0x117041=[];var _0x18d8f7=[];return db[_0xc578('0x5b')][_0xc578('0x4b')]({'where':{'userProfileId':_0x590f63['params']['id']},'raw':!![]})[_0xc578('0x2a')](function(_0x549d08){_0x117041=_[_0xc578('0x46')](_0x549d08,function(_0x53329b){return _0x53329b['enabled']===0x1||_[_0xc578('0x68')]([0x3eb,0x709],_0x53329b[_0xc578('0x5f')]);});if(!_[_0xc578('0x69')](_0x117041)){return _[_0xc578('0x30')](_0x117041,function(_0x541a4a){return _0x541a4a[_0xc578('0x5f')];});}else{return;}})[_0xc578('0x2a')](function(_0x139cf1){if(_0x139cf1)_0x18d8f7=_0x139cf1;if(_['includes'](_0x18d8f7,0x64)){var _0x3414a9=_[_0xc578('0x50')](_0x117041,{'sectionId':0x64});return hasDefaultDashboard(_0x3414a9)[_0xc578('0x2a')](function(_0x2a1fd3){return _[_0xc578('0x30')](_0x117041,function(_0x1a688d){if(_0x1a688d['sectionId']===0x64){_0x1a688d['subsections']=_0x2a1fd3;}return _0x1a688d;});});}else{return;}})[_0xc578('0x2a')](function(_0x228a5f){if(_0x228a5f)_0x117041=_0x228a5f;if(_[_0xc578('0x68')](_0x18d8f7,0x3eb)){var _0x52fac1=_[_0xc578('0x50')](_0x117041,{'sectionId':0x3eb});return getCustomDashboards(_0x52fac1)[_0xc578('0x2a')](function(_0x516a24){return _[_0xc578('0x30')](_0x117041,function(_0x47ec61){if(_0x52fac1[_0xc578('0x6a')]){if(_0x47ec61[_0xc578('0x5f')]===0x3eb){_0x47ec61[_0xc578('0x6b')]=_0x516a24;}}else{if(_0x47ec61[_0xc578('0x5f')]===0x64){_0x47ec61[_0xc578('0x6b')]=_0x516a24;}}return _0x47ec61;});});}else{return;}})['then'](function(_0x2003b6){if(_0x2003b6)_0x117041=_0x2003b6;if(_[_0xc578('0x68')](_0x18d8f7,0x709)){var _0x473955=_[_0xc578('0x50')](_0x117041,{'sectionId':0x709});return getPlugins(_0x473955)[_0xc578('0x2a')](function(_0x2a0580){if(_0x473955[_0xc578('0x6a')]){return _[_0xc578('0x30')](_0x117041,function(_0x108585){if(_0x108585['sectionId']===0x709){_0x108585[_0xc578('0x6b')]=_0x2a0580;}return _0x108585;});}else{var _0x1d4379={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2a0580};var _0x408c36=_[_0xc578('0x30')](_0x117041);_0x408c36[_0xc578('0x65')](_0x1d4379);return _0x408c36;}});}else{return;}})[_0xc578('0x2a')](function(_0x521413){if(_0x521413)_0x117041=_0x521413;return _[_0xc578('0x46')](_0x117041,['enabled',0x1]);})[_0xc578('0x2a')](respondWithResult(_0x17bbd5,null))[_0xc578('0x4c')](handleError(_0x17bbd5,null));};function hasDefaultDashboard(_0x5aaace){var _0x27c789=[0x65];return new BPromise(function(_0x53d5e4,_0x5a42b8){try{if(_0x5aaace[_0xc578('0x5d')]){_0x53d5e4(_0x27c789);}else{return db[_0xc578('0x5e')][_0xc578('0x6c')]({'where':{'sectionId':_0x5aaace['id']},'raw':!![]})[_0xc578('0x2a')](function(_0xabcc1c){_0xabcc1c?_0x53d5e4(_0x27c789):_0x53d5e4();});}}catch(_0x386abd){_0x5a42b8(_0x386abd);}});}function getCustomDashboards(_0x453d61){var _0x2cedc0=[];return new BPromise(function(_0xea8d1b,_0x421ef5){try{if(_0x453d61[_0xc578('0x5d')]){return db[_0xc578('0x6d')][_0xc578('0x4b')]({'raw':!![]})['then'](function(_0x2f28d5){_0x2f28d5[_0xc578('0x6e')](function(_0x37c840){_0x2cedc0[_0xc578('0x65')](_0x37c840['id']+0x1869f);});_0xea8d1b(_0x2cedc0);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x453d61['id']},'raw':!![]})[_0xc578('0x2a')](function(_0x532da8){_0x532da8[_0xc578('0x6e')](function(_0x19ba1a){_0x2cedc0[_0xc578('0x65')](_0x19ba1a[_0xc578('0x6f')]+0x1869f);});_0xea8d1b(_0x2cedc0);});}}catch(_0x67178f){_0x421ef5(_0x67178f);}});}function getPlugins(_0x320381){var _0x2a74a2=[];return new BPromise(function(_0x6ced5f,_0x45e61f){try{if(_0x320381[_0xc578('0x5d')]){return db[_0xc578('0x70')]['findAll']({'raw':!![]})[_0xc578('0x2a')](function(_0x3a994a){_0x3a994a[_0xc578('0x6e')](function(_0x556046){_0x2a74a2[_0xc578('0x65')](_0x556046['id']+0x15b38);});_0x6ced5f(_0x2a74a2);});}else{return db[_0xc578('0x5e')][_0xc578('0x4b')]({'where':{'sectionId':_0x320381['id']},'raw':!![]})[_0xc578('0x2a')](function(_0x3deb53){_0x3deb53[_0xc578('0x6e')](function(_0x5612ab){_0x2a74a2[_0xc578('0x65')](_0x5612ab[_0xc578('0x6f')]+0x15b38);});_0x6ced5f(_0x2a74a2);});}}catch(_0x2fbcd4){_0x45e61f(_0x2fbcd4);}});}exports[_0xc578('0x71')]=function(_0x2fb44e,_0x2569bf){return db[_0xc578('0x31')][_0xc578('0x50')]({'where':{'id':_0x2fb44e['params']['id']}})['then'](handleEntityNotFound(_0x2569bf,null))[_0xc578('0x2a')](function(_0x4fa031){if(_0x4fa031){return db[_0xc578('0x58')][_0xc578('0x59')](function(_0xa4fcb9){return db[_0xc578('0x5b')][_0xc578('0x4b')]({'where':{'userProfileId':_0x2fb44e['params']['id']},'attributes':['id'],'raw':!![]})[_0xc578('0x2a')](function(_0x4d7663){if(_0x4d7663){return db['UserProfileSection'][_0xc578('0x2b')]({'where':{'userProfileId':_0x2fb44e[_0xc578('0x4e')]['id'],'id':_['map'](_0x4d7663,function(_0x4c7d2f){return _0x4c7d2f['id'];})},'transaction':_0xa4fcb9});}})[_0xc578('0x2a')](function(_0x452fd0){var _0x4a5e76=_[_0xc578('0x30')](_0x2fb44e[_0xc578('0x52')],function(_0xb5a16b){_0xb5a16b[_0xc578('0x60')]=_0x2fb44e[_0xc578('0x4e')]['id'];return _0xb5a16b;});return db['UserProfileSection'][_0xc578('0x72')](_0x4a5e76,{'raw':!![],'transaction':_0xa4fcb9});})[_0xc578('0x2a')](function(_0x42b82d){var _0x6de832=_[_0xc578('0x46')](_[_0xc578('0x30')](_0x42b82d,function(_0x2665d0){return _0x2665d0[_0xc578('0x5a')]({'plain':!![]});}),{'includeAll':![]});if(_0x6de832){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x2fb44e[_0xc578('0x4e')]['id'],'sectionId':_[_0xc578('0x30')](_0x6de832,function(_0xbe4b31){return _0xbe4b31[_0xc578('0x5f')];})},'attributes':['id',_0xc578('0x5f')],'raw':!![]})[_0xc578('0x2a')](function(_0x24552e){var _0x3170cd=_[_0xc578('0x30')](_0x2fb44e[_0xc578('0x52')],function(_0x3718fb){_0x3718fb[_0xc578('0x60')]=_0x2fb44e['params']['id'];return _0x3718fb;});return db[_0xc578('0x5e')][_0xc578('0x72')](_0x3170cd,{'raw':!![],'transaction':_0xa4fcb9});});}})['catch'](handleError(_0x2569bf,null));});}})[_0xc578('0x2a')](function(_0x31a170){var _0x2cc32c=_[_0xc578('0x30')](_0x31a170,function(_0x5b6925){return _0x5b6925[_0xc578('0x5a')]({'plain':!![]});});})[_0xc578('0x2a')](respondWithResult(_0x2569bf,null))[_0xc578('0x4c')](handleError(_0x2569bf,null));};exports[_0xc578('0x73')]=function(_0x276827,_0x39e49e,_0x38ec79){return db[_0xc578('0x31')][_0xc578('0x50')]({'where':{'id':_0x276827['params']['id']}})[_0xc578('0x2a')](handleEntityNotFound(_0x39e49e,null))['then'](function(_0x53e687){if(_0x53e687){return _0x53e687[_0xc578('0x73')](_0x276827['query']['ids']);}})[_0xc578('0x2a')](respondWithStatusCode(_0x39e49e,null))[_0xc578('0x4c')](handleError(_0x39e49e,null));};exports[_0xc578('0x74')]=function(_0x3ba0fe,_0xec5066){var _0x6ee0ca={};if(!_0x3ba0fe['query'][_0xc578('0x75')])throw new Error(_0xc578('0x76'));if(!_0x3ba0fe[_0xc578('0x38')][_0xc578('0x3f')](_0xc578('0x40'))){_0x6ee0ca[_0xc578('0x41')]=qs[_0xc578('0x41')](_0x3ba0fe[_0xc578('0x38')][_0xc578('0x41')]);_0x6ee0ca[_0xc578('0x23')]=qs[_0xc578('0x23')](_0x3ba0fe['query'][_0xc578('0x23')]);}return db[_0xc578('0x31')][_0xc578('0x50')]({'where':{'id':_0x3ba0fe[_0xc578('0x4e')]['id']}})['then'](function(_0x59bc89){if(!_0x59bc89)throw new Error(_0xc578('0x77')+_0x3ba0fe[_0xc578('0x4e')]['id']);return db[_0xc578('0x31')][_0xc578('0x74')](_0x3ba0fe);})[_0xc578('0x2a')](respondWithFilteredResult(_0xec5066,_0x6ee0ca))[_0xc578('0x4c')](handleError(_0xec5066,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 7d22f99..4d58f20 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 _0x8a9a=['UserProfile','setMaxListeners','save','update','remove','emit','hook','../../mysqldb'];(function(_0x17f4eb,_0x34cc64){var _0x1904c6=function(_0x5f5172){while(--_0x5f5172){_0x17f4eb['push'](_0x17f4eb['shift']());}};_0x1904c6(++_0x34cc64);}(_0x8a9a,0x17f));var _0xa8a9=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x8a9a[_0xb0f7c3];return _0x28ea68;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xa8a9('0x0'))['db'][_0xa8a9('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xa8a9('0x2')](0x0);var events={'afterCreate':_0xa8a9('0x3'),'afterUpdate':_0xa8a9('0x4'),'afterDestroy':_0xa8a9('0x5')};function emitEvent(_0x2d782d){return function(_0x9570dc,_0x3fcb8c,_0xe5e64b){UserProfileEvents[_0xa8a9('0x6')](_0x2d782d+':'+_0x9570dc['id'],_0x9570dc);UserProfileEvents[_0xa8a9('0x6')](_0x2d782d,_0x9570dc);_0xe5e64b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xa8a9('0x7')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x16ce=['exports','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xf96766,_0x388d98){var _0x55c4e3=function(_0x4e5392){while(--_0x4e5392){_0xf96766['push'](_0xf96766['shift']());}};_0x55c4e3(++_0x388d98);}(_0x16ce,0xfb));var _0xe16c=function(_0x57aa85,_0xf56b03){_0x57aa85=_0x57aa85-0x0;var _0x482b87=_0x16ce[_0x57aa85];return _0x482b87;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xe16c('0x0'))['db'][_0xe16c('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xe16c('0x2')](0x0);var events={'afterCreate':_0xe16c('0x3'),'afterUpdate':_0xe16c('0x4'),'afterDestroy':_0xe16c('0x5')};function emitEvent(_0x546ed6){return function(_0x55c37e,_0x4a5fc8,_0x884769){UserProfileEvents['emit'](_0x546ed6+':'+_0x55c37e['id'],_0x55c37e);UserProfileEvents[_0xe16c('0x6')](_0x546ed6,_0x55c37e);_0x884769(null);};}for(var e in events){if(events[_0xe16c('0x7')](e)){var event=events[e];UserProfile[_0xe16c('0x8')](e,emitEvent(event));}}module[_0xe16c('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 2d1c963..5e756d0 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 _0x741c=['length','find','all','ignore','autoAssociation','push','keys','intersection','fields','attributes','nolimit','limit','offset','order','sort','pick','filters','merge','key','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','CmContact','color','ThroughTags','tag','openTabs','true','chat','sms','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','filter','field','value','findAll','catch','model','associatedResources','name','then','map','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','projects','JscriptyProject','contacts','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatwebsites','faxqueues','FaxQueue','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','User','role','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','type','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','WhatsappAccount','Team','queuecampaigns','users','telephones','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','tags','Tag','templates','Template','trunks','Trunk','variables','extractedreports','Reports','reportId','metrics','AnalyticMetric','toUpperCase','slice','SELECT','select','ui.','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','UserProfile','user_profiles','section','mergeResources','isEmpty'];(function(_0x559579,_0x2c5605){var _0x57ca1c=function(_0x46453e){while(--_0x46453e){_0x559579['push'](_0x559579['shift']());}};_0x57ca1c(++_0x2c5605);}(_0x741c,0x196));var _0xc741=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x741c[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xc741('0x0'));var attributes=require(_0xc741('0x1'));var qs=require(_0xc741('0x2'));var squel=require(_0xc741('0x3'));module[_0xc741('0x4')]=function(_0x31de60){var _0x5c8d3b=_0x31de60['models'];function _0x4089bf(_0x4ccc27,_0xc80e99){return new Promise(function(_0x1935b4,_0x3708ae){if(!_0xc80e99)return _0x1935b4(null);var _0x133bc4=_0xc80e99[_0xc741('0x5')]?{[_0xc80e99[_0xc741('0x5')][_0xc741('0x6')]]:_0xc80e99['filter'][_0xc741('0x7')]}:undefined;return _0x5c8d3b[_0x4ccc27][_0xc741('0x8')]({'where':_0x133bc4,'raw':!![]})['then'](function(_0xc6555){_0xc80e99['associatedResources']=_['map'](_0xc6555,'id');_0x1935b4(_0xc80e99);})[_0xc741('0x9')](function(_0x264cb9){_0x3708ae(_0x264cb9);});});}function _0x40639b(_0x47501c,_0xa1abb1){return new Promise(function(_0x29920b,_0x312684){var _0x506b51=_0x47501c['filter']?{[_0x47501c['filter'][_0xc741('0x6')]]:_0x47501c[_0xc741('0x5')][_0xc741('0x7')]}:undefined;return _0x5c8d3b[_0x47501c[_0xc741('0xa')]][_0xc741('0x8')]({'where':_0x506b51,'raw':!![]})['then'](function(_0xde1da){_0xa1abb1[_0xc741('0xb')]=_['map'](_0xde1da,function(_0xc0383){return _0xc0383[_0xc741('0xc')];});_0x29920b(_0xa1abb1);})[_0xc741('0x9')](function(_0x450179){_0x312684(_0x450179);});});}function _0x21514e(_0x5bbe86,_0x4dcf16,_0x341f54){if(!_0x4dcf16)return Promise['resolve'](null);return new Promise(function(_0x1c4f3a,_0x3903c6){return _0x5c8d3b['UserProfileResource']['findAll']({'where':{'sectionId':_0x4dcf16['id']},'raw':!![]})[_0xc741('0xd')](function(_0x477cc2){if(_0x5bbe86[_0xc741('0x6')]&&_0x5bbe86['field']!=='id'){_0x4dcf16[_0xc741('0xb')]=_[_0xc741('0xe')](_0x477cc2,function(_0x475348){return _0x475348[_0x5bbe86[_0xc741('0x6')]];});}else{if(_0x341f54===_0xc741('0xf')){_0x4dcf16[_0xc741('0xb')]=_[_0xc741('0xe')](_0x477cc2,function(_0x30b7ea){return{'id':_0x30b7ea[_0xc741('0x10')],'type':_0x30b7ea['type']};});}else{_0x4dcf16[_0xc741('0xb')]=_['map'](_0x477cc2,function(_0x212c67){return _0x212c67['resourceId'];});}}_0x1c4f3a(_0x4dcf16);})[_0xc741('0x9')](function(_0x3c3497){_0x3903c6(_0x3c3497);});});}function _0x38e752(_0x5ca96f,_0x71c786){var _0x5a89bd={'parentSections':[]};switch(_0x5ca96f[_0xc741('0x11')]()){case _0xc741('0x12'):_0x5a89bd[_0xc741('0x13')]='SquareProject';break;case'odbc':_0x5a89bd['childModel']=_0xc741('0x14');break;case _0xc741('0x15'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x16');_0x5a89bd[_0xc741('0x17')]=[{'name':'SquareProjects','field':'name','foreignKey':_0xc741('0x18')}];break;case _0xc741('0x19'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x1a');break;case _0xc741('0x1b'):_0x5a89bd[_0xc741('0x13')]='CmContact';_0x5a89bd[_0xc741('0x17')]=[{'name':_0xc741('0x1c'),'field':'id','foreignKey':'ListId'}];break;case _0xc741('0x1d'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x1e');break;case _0xc741('0x1f'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x20');break;case _0xc741('0x21'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x22');break;case'chatqueues':_0x5a89bd[_0xc741('0x13')]='ChatQueue';break;case _0xc741('0x23'):_0x5a89bd['childModel']='ChatWebsite';break;case _0xc741('0x24'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x25');break;case'faxaccounts':_0x5a89bd[_0xc741('0x13')]=_0xc741('0x26');break;case _0xc741('0x27'):case'internalroutes':case _0xc741('0x28'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x29');break;case _0xc741('0x2a'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x2b');break;case _0xc741('0x2c'):_0x5a89bd['childModel']='VoiceMail';break;case _0xc741('0x2d'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x2e');_0x5a89bd[_0xc741('0x17')]=[{'name':_0xc741('0x2f'),'field':_0xc741('0xc'),'foreignKey':'membername','model':_0xc741('0x30'),'filter':{'field':_0xc741('0x31'),'value':['agent']}},{'name':_0xc741('0x32'),'field':_0xc741('0xc'),'foreignKey':_0xc741('0x33'),'model':'User','filter':{'field':_0xc741('0x31'),'value':[_0xc741('0x34')]}},{'name':_0xc741('0x35'),'field':_0xc741('0xc'),'foreignKey':_0xc741('0x36'),'model':_0xc741('0x37'),'filter':{'field':_0xc741('0x38'),'value':['inbound']}},{'name':_0xc741('0x39'),'field':_0xc741('0xc'),'foreignKey':_0xc741('0x36'),'model':_0xc741('0x37'),'filter':{'field':_0xc741('0x38'),'value':[_0xc741('0x3a')]}}];break;case _0xc741('0x3b'):_0x5a89bd[_0xc741('0x13')]='VoiceMusicOnHold';break;case _0xc741('0x3c'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x3d');break;case _0xc741('0x3e'):_0x5a89bd['childModel']=_0xc741('0x3f');break;case'ivrcampaigns':_0x5a89bd[_0xc741('0x13')]=_0xc741('0x40');break;case _0xc741('0x41'):_0x5a89bd['childModel']='MailQueue';break;case _0xc741('0x42'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x43');break;case _0xc741('0x44'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x45');break;case _0xc741('0x46'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x47');break;case _0xc741('0x48'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x49');break;case _0xc741('0x4a'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x4b');break;case _0xc741('0x4c'):_0x5a89bd[_0xc741('0x13')]='SmsAccount';break;case _0xc741('0x4d'):_0x5a89bd['childModel']=_0xc741('0x4e');break;case'whatsappaccounts':_0x5a89bd[_0xc741('0x13')]=_0xc741('0x4f');break;case'teams':_0x5a89bd[_0xc741('0x13')]=_0xc741('0x50');break;case'voicequeues':case _0xc741('0x51'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x37');if(_0x71c786){_0x5a89bd[_0xc741('0x17')]=[{'name':_0xc741('0x35')},{'name':_0xc741('0x39')}];}break;case _0xc741('0x52'):case'agents':case _0xc741('0x53'):_0x5a89bd['childModel']='User';if(_0x71c786){_0x5a89bd[_0xc741('0x17')]=[{'name':'Users','filter':{'field':_0xc741('0x31'),'value':[_0xc741('0x54'),_0xc741('0x55')]},'ignore':!![]},{'name':_0xc741('0x2f')},{'name':_0xc741('0x32')}];}break;case _0xc741('0x56'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x57');break;case _0xc741('0x58'):_0x5a89bd['childModel']='SalesforceAccount';break;case _0xc741('0x59'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x5a');break;case _0xc741('0x5b'):_0x5a89bd['childModel']=_0xc741('0x5c');break;case'deskaccounts':_0x5a89bd[_0xc741('0x13')]=_0xc741('0x5d');break;case _0xc741('0x5e'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x5f');break;case _0xc741('0x60'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x30');break;case _0xc741('0x61'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x62');break;case _0xc741('0x63'):_0x5a89bd['childModel']=_0xc741('0x64');break;case _0xc741('0x65'):_0x5a89bd[_0xc741('0x13')]='Dashboard';break;case _0xc741('0x66'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x67');break;case _0xc741('0x68'):_0x5a89bd['childModel']=_0xc741('0x69');break;case _0xc741('0x6a'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x6b');break;case'sounds':_0x5a89bd[_0xc741('0x13')]='Sound';break;case _0xc741('0x6c'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x6d');break;case _0xc741('0x6e'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x6f');break;case'triggers':_0x5a89bd[_0xc741('0x13')]='Trigger';break;case _0xc741('0x70'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x71');break;case _0xc741('0x72'):_0x5a89bd[_0xc741('0x13')]='Variable';break;case'plugins':_0x5a89bd[_0xc741('0x13')]='Plugin';break;case _0xc741('0x73'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0xf');_0x5a89bd[_0xc741('0x17')]=[{'name':_0xc741('0x74'),'field':'id','foreignKey':_0xc741('0x75')}];break;case _0xc741('0x76'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x77');break;}return _0x5a89bd;}function _0x335eb6(_0xc1c742,_0x1e31bb){var _0x4f386b=_0xc1c742['charAt'](0x0)[_0xc741('0x78')]()+_0xc1c742[_0xc741('0x79')](0x1);var _0xe0b6d8={'type':_0x5c8d3b['Sequelize']['QueryTypes'][_0xc741('0x7a')],'raw':!![]};return new Promise(function(_0x5a4f5b,_0x394be8){var _0x3523a2=squel[_0xc741('0x7b')]()[_0xc741('0x6')](_0xc741('0x7c')+_0x4f386b+'InteractionId','id')['field'](_0xc741('0x7d'))[_0xc741('0x7e')]('user_has_'+_0xc1c742+_0xc741('0x7f'),'ui')[_0xc741('0x80')](_0xc741('0x81'),_0x1e31bb['id']);return _0x5c8d3b[_0xc741('0x82')][_0xc741('0x83')](_0x3523a2['toString'](),_0xe0b6d8)['then'](function(_0x2802a7){_0x1e31bb[_0x4f386b+'OpenTabs']=_0x2802a7;_0x5a4f5b(_0x2802a7);})[_0xc741('0x9')](function(_0x43471d){_0x394be8(_0x43471d);});});}return _0x31de60['define'](_0xc741('0x84'),attributes,{'tableName':_0xc741('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xf47dfd){var _0x1aecb3={'raw':![],'where':{}};var _0x1c5c67={};var _0x9027d1={'count':0x0,'rows':[]};var _0xd0575b=_0xf47dfd['query'][_0xc741('0x86')];var _0x28390d=_0xf47dfd['query'][_0xc741('0x87')]||![];var _0x2d9a96=_0x38e752(_0xd0575b,_0x28390d);if(!_0x2d9a96[_0xc741('0x13')])throw new Error('Invalid\x20section\x20\x27'+_0xd0575b+'\x27');var _0xe0f852=[{'name':_0xd0575b}];if(!_[_0xc741('0x88')](_0x2d9a96['parentSections']))_0xe0f852=_0x2d9a96[_0xc741('0x17')];var _0x3768ef=[];for(var _0xfa0e86=0x0;_0xfa0e86<_0xe0f852[_0xc741('0x89')];_0xfa0e86++){_0x3768ef['push'](_0x5c8d3b['UserProfileSection'][_0xc741('0x8a')]({'where':{'userProfileId':_0xf47dfd['params']['id'],'name':_0xe0f852[_0xfa0e86][_0xc741('0xc')]},'raw':!![]}));}return Promise[_0xc741('0x8b')](_0x3768ef)[_0xc741('0xd')](function(_0x1d0401){var _0x438997=_[_0xc741('0x5')](_0x1d0401,function(_0x5eab1a){return _0x5eab1a?_0x5eab1a:undefined;});var _0x40cfe0=_['filter'](_0xe0f852,[_0xc741('0x8c'),!![]]);var _0x1931e2=_[_0xc741('0x88')](_0x438997)&&_[_0xc741('0x88')](_0x40cfe0)?null:_['union'](_0x40cfe0,_0x438997);if(!_0x1931e2)return null;var _0x31c533=[];for(var _0x19b48a=0x0;_0x19b48a<_0x1931e2[_0xc741('0x89')];_0x19b48a++){var _0x164525=_[_0xc741('0x8a')](_0xe0f852,function(_0x240865){return _0x1931e2[_0x19b48a]?_0x240865[_0xc741('0xc')]===_0x1931e2[_0x19b48a][_0xc741('0xc')]:null;});if(_0x164525){if(_0x1931e2[_0x19b48a][_0xc741('0x8c')]){_0x31c533['push'](_0x4089bf(_0x2d9a96['childModel'],_0x1931e2[_0x19b48a]));}else{if(!_0x1931e2[_0x19b48a][_0xc741('0x8d')]){_0x31c533[_0xc741('0x8e')](_0x21514e(_0x164525,_0x1931e2[_0x19b48a],_0x2d9a96[_0xc741('0x13')]));}else{if(_0x164525[_0xc741('0xa')]){_0x31c533['push'](_0x40639b(_0x164525,_0x1931e2[_0x19b48a]));}}}}}return Promise[_0xc741('0x8b')](_0x31c533);})[_0xc741('0xd')](function(_0x22982b){var _0x3f3b84=_0x22982b;var _0x31c314=null;if(_0x3f3b84){_0x31c314=_0x3f3b84[_0xc741('0x89')]===0x1?_0x3f3b84[0x0]:null;}if(!_0x31c314&&!_0x3f3b84)return _0x9027d1;var _0x2cb099=_0x5c8d3b[_0x2d9a96[_0xc741('0x13')]]['rawAttributes'];_0x1c5c67[_0xc741('0xa')]=_['keys'](_0x2cb099);_0x1c5c67['query']=_[_0xc741('0x8f')](_0xf47dfd[_0xc741('0x83')]);_0x1c5c67['filters']=_[_0xc741('0x90')](_0x1c5c67[_0xc741('0xa')],_0x1c5c67['query']);_0x1aecb3['attributes']=_[_0xc741('0x90')](_0x1c5c67[_0xc741('0xa')],qs['fields'](_0xf47dfd[_0xc741('0x83')][_0xc741('0x91')]));_0x1aecb3[_0xc741('0x92')]=_0x1aecb3[_0xc741('0x92')][_0xc741('0x89')]?_0x1aecb3[_0xc741('0x92')]:_0x1c5c67[_0xc741('0xa')];if(!_0xf47dfd[_0xc741('0x83')]['hasOwnProperty'](_0xc741('0x93'))){_0x1aecb3[_0xc741('0x94')]=qs[_0xc741('0x94')](_0xf47dfd[_0xc741('0x83')]['limit']);_0x1aecb3[_0xc741('0x95')]=qs[_0xc741('0x95')](_0xf47dfd['query'][_0xc741('0x95')]);}_0x1aecb3[_0xc741('0x96')]=qs[_0xc741('0x97')](_0xf47dfd[_0xc741('0x83')]['sort']);_0x1aecb3['where']=qs['filters'](_[_0xc741('0x98')](_0xf47dfd[_0xc741('0x83')],_0x1c5c67[_0xc741('0x99')]));if(_0xf47dfd[_0xc741('0x83')]['filter']){_0x1aecb3[_0xc741('0x80')]=_[_0xc741('0x9a')](_0x1aecb3['where'],{'$or':_['map'](_0x2cb099,function(_0x110cac){if(_0x110cac[_0xc741('0x38')][_0xc741('0x9b')]!=='VIRTUAL'){var _0x3922e1={};_0x3922e1[_0x110cac[_0xc741('0x6')]]={'$like':'%'+_0xf47dfd[_0xc741('0x83')]['filter']+'%'};return _0x3922e1;}})});}var _0x4a3c3a=[];var _0x58b414=null;var _0x2e7cfa={};if(_0x31c314){_0x58b414=_[_0xc741('0x8a')](_0xe0f852,['name',_0x31c314['name']]);if(_0x58b414[_0xc741('0x6')]){_0x2e7cfa={};if(_0x2d9a96[_0xc741('0x13')]==='AnalyticExtractedReport'){_0x2e7cfa[_0x58b414[_0xc741('0x9c')]]=_['map'](_0x31c314['associatedResources'],'id');}else{_0x2e7cfa[_0x58b414['foreignKey']]=_0x31c314[_0xc741('0xb')];}_0x4a3c3a[_0xc741('0x8e')](_0x2e7cfa);}else{_0x1aecb3[_0xc741('0x80')]['id']=_0x31c314[_0xc741('0xb')];}}else{for(var _0x59822a=0x0;_0x59822a<_0x3f3b84[_0xc741('0x89')];_0x59822a++){_0x58b414=_['find'](_0xe0f852,[_0xc741('0xc'),_0x3f3b84[_0x59822a]['name']]);if(_0x58b414['field']){_0x2e7cfa={};_0x2e7cfa[_0x58b414[_0xc741('0x9c')]]=_0x3f3b84[_0x59822a][_0xc741('0xb')];_0x4a3c3a['push'](_0x2e7cfa);}else{if(!_0x1aecb3[_0xc741('0x80')]['id'])_0x1aecb3[_0xc741('0x80')]['id']=[];_0x3f3b84[_0x59822a][_0xc741('0xb')][_0xc741('0x9d')](function(_0x3103bd){_0x1aecb3[_0xc741('0x80')]['id']['push'](_0x3103bd);});}}}if(!_[_0xc741('0x88')](_0x4a3c3a)){_0x1aecb3[_0xc741('0x80')]=_[_0xc741('0x9a')](_0x1aecb3[_0xc741('0x80')],{'$and':{'$or':_0x4a3c3a}});}_0x1aecb3=_[_0xc741('0x9a')]({},_0x1aecb3,_0xf47dfd[_0xc741('0x9e')]);if(_0x31c314&&!_0x31c314[_0xc741('0x8d')]&&_0x2d9a96[_0xc741('0x13')]===_0xc741('0xf')){if(_0xf47dfd[_0xc741('0x83')][_0xc741('0x9f')]){_0x1aecb3[_0xc741('0xa0')]=[{'all':!![]}];}return _0x5c8d3b[_0x2d9a96['childModel']]['findAll'](_0x1aecb3)['then'](function(_0x4c78dc){var _0x1a693a=[];_0x4c78dc[_0xc741('0x9d')](function(_0xb83d6e){var _0x2e1962;switch(_0xb83d6e[_0xc741('0xa1')]){case _0xc741('0xa2'):_0x2e1962=_[_0xc741('0x8a')](_0x31c314[_0xc741('0xb')],function(_0x252e16){return _0x252e16['id']===_0xb83d6e[_0xc741('0x75')]&&_0x252e16[_0xc741('0x38')]===_0xc741('0xa3');});break;case _0xc741('0xa4'):_0x2e1962=_['find'](_0x31c314[_0xc741('0xb')],function(_0x211cee){return _0x211cee['id']===_0xb83d6e[_0xc741('0x75')]&&_0x211cee[_0xc741('0x38')]===_0xc741('0xa5');});break;}if(_0x2e1962)_0x1a693a[_0xc741('0x8e')](_0xb83d6e);});_0x9027d1[_0xc741('0xa6')]=_0x1a693a[_0xc741('0x89')];_0x9027d1[_0xc741('0xa7')]=_0x1a693a;return _0x9027d1;});}else{return _0x5c8d3b[_0x2d9a96[_0xc741('0x13')]][_0xc741('0xa6')]({'where':_0x1aecb3[_0xc741('0x80')]})['then'](function(_0x3d755c){_0x9027d1[_0xc741('0xa6')]=_0x3d755c;if(_0xf47dfd[_0xc741('0x83')]['includeAll']){if(_0x2d9a96[_0xc741('0x13')]===_0xc741('0xa8')){_0x1aecb3['include']=[{'model':_0x5c8d3b[_0xc741('0x6d')],'as':'Tags','attributes':['id',_0xc741('0xc'),_0xc741('0xa9')],'required':_0xf47dfd[_0xc741('0x83')]['tag']?!![]:![]},{'model':_0x5c8d3b[_0xc741('0x6d')],'as':_0xc741('0xaa'),'attributes':['id','name','color'],'through':_0xf47dfd[_0xc741('0x83')][_0xc741('0xab')]?{'attributes':[],'where':{'TagId':_0xf47dfd[_0xc741('0x83')][_0xc741('0xab')]||undefined}}:{},'required':_0xf47dfd['query'][_0xc741('0xab')]?!![]:![]}];}else{_0x1aecb3[_0xc741('0xa0')]=[{'all':!![]}];}}return _0x5c8d3b[_0x2d9a96[_0xc741('0x13')]][_0xc741('0x8')](_0x1aecb3);})[_0xc741('0xd')](function(_0x4045cc){_0x9027d1[_0xc741('0xa7')]=_0x4045cc;if(_0xd0575b==='Agents'&&_0xf47dfd[_0xc741('0x83')][_0xc741('0xac')]===_0xc741('0xad')){var _0x62d071=[];for(var _0x193414=0x0;_0x193414<_0x9027d1[_0xc741('0xa7')]['length'];_0x193414++){_0x62d071[_0xc741('0x8e')](_0x335eb6(_0xc741('0xae'),_0x9027d1['rows'][_0x193414]['dataValues']));_0x62d071[_0xc741('0x8e')](_0x335eb6(_0xc741('0xaf'),_0x9027d1['rows'][_0x193414][_0xc741('0xb0')]));_0x62d071[_0xc741('0x8e')](_0x335eb6(_0xc741('0xb1'),_0x9027d1[_0xc741('0xa7')][_0x193414][_0xc741('0xb0')]));_0x62d071[_0xc741('0x8e')](_0x335eb6(_0xc741('0xb2'),_0x9027d1[_0xc741('0xa7')][_0x193414][_0xc741('0xb0')]));_0x62d071[_0xc741('0x8e')](_0x335eb6(_0xc741('0xb3'),_0x9027d1['rows'][_0x193414]['dataValues']));_0x62d071[_0xc741('0x8e')](_0x335eb6(_0xc741('0xb4'),_0x9027d1[_0xc741('0xa7')][_0x193414]['dataValues']));}return Promise[_0xc741('0x8b')](_0x62d071)['then'](function(){return _0x9027d1;});}return _0x9027d1;});}});}}});}; \ No newline at end of file +var _0x77d4=['Variable','plugins','Plugin','extractedreports','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','SELECT','select','ui.','InteractionId','from','user_has_','where','query','toString','OpenTabs','define','UserProfile','user_profiles','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','all','autoAssociation','model','rawAttributes','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','includeAll','include','reportType','default','reportId','DefaultReports','custom','count','Tags','color','ThroughTags','tag','rows','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','./userProfile.attributes','squel','filter','then','associatedResources','map','catch','value','findAll','name','resolve','field','AnalyticExtractedReport','resourceId','type','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareProjects','projectName','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','Telephones','User','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','parentSections','agents','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','Pause','scheduler','Schedule','Sound','tags','Tag','Template','triggers','Trigger','Trunk','variables'];(function(_0x364c77,_0x59f364){var _0x3dd24d=function(_0xe4eaae){while(--_0xe4eaae){_0x364c77['push'](_0x364c77['shift']());}};_0x3dd24d(++_0x59f364);}(_0x77d4,0x108));var _0x477d=function(_0x3ef984,_0x3f5981){_0x3ef984=_0x3ef984-0x0;var _0x578b03=_0x77d4[_0x3ef984];return _0x578b03;};'use strict';var _=require('lodash');var attributes=require(_0x477d('0x0'));var qs=require('../../components/parsers/qs');var squel=require(_0x477d('0x1'));module['exports']=function(_0x41bcf1){var _0x13ad75=_0x41bcf1['models'];function _0x53e1b8(_0x16213f,_0xf3cde0){return new Promise(function(_0x3d2f8d,_0x471fca){if(!_0xf3cde0)return _0x3d2f8d(null);var _0x2545e5=_0xf3cde0[_0x477d('0x2')]?{[_0xf3cde0['filter']['field']]:_0xf3cde0[_0x477d('0x2')]['value']}:undefined;return _0x13ad75[_0x16213f]['findAll']({'where':_0x2545e5,'raw':!![]})[_0x477d('0x3')](function(_0x29f11b){_0xf3cde0[_0x477d('0x4')]=_[_0x477d('0x5')](_0x29f11b,'id');_0x3d2f8d(_0xf3cde0);})[_0x477d('0x6')](function(_0x58ff29){_0x471fca(_0x58ff29);});});}function _0x932cc9(_0x4f11bc,_0x295ad){return new Promise(function(_0x462ac1,_0x55ace3){var _0x472012=_0x4f11bc[_0x477d('0x2')]?{[_0x4f11bc['filter']['field']]:_0x4f11bc[_0x477d('0x2')][_0x477d('0x7')]}:undefined;return _0x13ad75[_0x4f11bc['model']][_0x477d('0x8')]({'where':_0x472012,'raw':!![]})[_0x477d('0x3')](function(_0x48c73a){_0x295ad['associatedResources']=_[_0x477d('0x5')](_0x48c73a,function(_0x4bbfef){return _0x4bbfef[_0x477d('0x9')];});_0x462ac1(_0x295ad);})[_0x477d('0x6')](function(_0x25fc02){_0x55ace3(_0x25fc02);});});}function _0x5985b5(_0x116aa7,_0x78d1f2,_0x29c6f8){if(!_0x78d1f2)return Promise[_0x477d('0xa')](null);return new Promise(function(_0x57b38e,_0x28f17a){return _0x13ad75['UserProfileResource'][_0x477d('0x8')]({'where':{'sectionId':_0x78d1f2['id']},'raw':!![]})[_0x477d('0x3')](function(_0x159beb){if(_0x116aa7[_0x477d('0xb')]&&_0x116aa7[_0x477d('0xb')]!=='id'){_0x78d1f2[_0x477d('0x4')]=_['map'](_0x159beb,function(_0x33db7a){return _0x33db7a[_0x116aa7['field']];});}else{if(_0x29c6f8===_0x477d('0xc')){_0x78d1f2[_0x477d('0x4')]=_[_0x477d('0x5')](_0x159beb,function(_0x14cbd5){return{'id':_0x14cbd5[_0x477d('0xd')],'type':_0x14cbd5[_0x477d('0xe')]};});}else{_0x78d1f2[_0x477d('0x4')]=_[_0x477d('0x5')](_0x159beb,function(_0x45a8bd){return _0x45a8bd[_0x477d('0xd')];});}}_0x57b38e(_0x78d1f2);})[_0x477d('0x6')](function(_0x3525e8){_0x28f17a(_0x3525e8);});});}function _0x43c845(_0x1f3868,_0x4e6a44){var _0x4481b0={'parentSections':[]};switch(_0x1f3868['toLowerCase']()){case _0x477d('0xf'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x11');break;case _0x477d('0x12'):_0x4481b0['childModel']=_0x477d('0x13');break;case _0x477d('0x14'):_0x4481b0[_0x477d('0x10')]='SquareRecording';_0x4481b0['parentSections']=[{'name':_0x477d('0x15'),'field':_0x477d('0x9'),'foreignKey':_0x477d('0x16')}];break;case'projects':_0x4481b0[_0x477d('0x10')]=_0x477d('0x17');break;case _0x477d('0x18'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x19');_0x4481b0['parentSections']=[{'name':_0x477d('0x1a'),'field':'id','foreignKey':_0x477d('0x1b')}];break;case _0x477d('0x1c'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x1d');break;case _0x477d('0x1e'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x1f');break;case _0x477d('0x20'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x21');break;case _0x477d('0x22'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x23');break;case _0x477d('0x24'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x25');break;case _0x477d('0x26'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x27');break;case'faxaccounts':_0x4481b0[_0x477d('0x10')]='FaxAccount';break;case _0x477d('0x28'):case _0x477d('0x29'):case _0x477d('0x2a'):_0x4481b0['childModel']=_0x477d('0x2b');break;case _0x477d('0x2c'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x2d');break;case _0x477d('0x2e'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x2f');break;case _0x477d('0x30'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x31');_0x4481b0['parentSections']=[{'name':_0x477d('0x32'),'field':_0x477d('0x9'),'foreignKey':_0x477d('0x33'),'model':'User','filter':{'field':_0x477d('0x34'),'value':[_0x477d('0x35')]}},{'name':_0x477d('0x36'),'field':'name','foreignKey':'membername','model':_0x477d('0x37'),'filter':{'field':_0x477d('0x34'),'value':[_0x477d('0x38')]}},{'name':_0x477d('0x39'),'field':_0x477d('0x9'),'foreignKey':'queue','model':_0x477d('0x3a'),'filter':{'field':'type','value':[_0x477d('0x3b')]}},{'name':_0x477d('0x3c'),'field':_0x477d('0x9'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x477d('0xe'),'value':[_0x477d('0x3d')]}}];break;case _0x477d('0x3e'):_0x4481b0[_0x477d('0x10')]='VoiceMusicOnHold';break;case _0x477d('0x3f'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x40');break;case _0x477d('0x41'):_0x4481b0[_0x477d('0x10')]='VoicePrefix';break;case _0x477d('0x42'):_0x4481b0[_0x477d('0x10')]='Campaign';break;case _0x477d('0x43'):_0x4481b0['childModel']=_0x477d('0x44');break;case _0x477d('0x45'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x46');break;case _0x477d('0x47'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x48');break;case _0x477d('0x49'):_0x4481b0[_0x477d('0x10')]='OpenchannelQueue';break;case _0x477d('0x4a'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x4b');break;case _0x477d('0x4c'):_0x4481b0['childModel']='SmsQueue';break;case _0x477d('0x4d'):_0x4481b0[_0x477d('0x10')]='SmsAccount';break;case _0x477d('0x4e'):_0x4481b0['childModel']='WhatsappQueue';break;case _0x477d('0x4f'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x50');break;case _0x477d('0x51'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x52');break;case'voicequeues':case _0x477d('0x53'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x3a');if(_0x4e6a44){_0x4481b0[_0x477d('0x54')]=[{'name':_0x477d('0x39')},{'name':'QueueCampaigns'}];}break;case'users':case _0x477d('0x55'):case _0x477d('0x56'):_0x4481b0[_0x477d('0x10')]='User';if(_0x4e6a44){_0x4481b0[_0x477d('0x54')]=[{'name':_0x477d('0x57'),'filter':{'field':_0x477d('0x34'),'value':[_0x477d('0x58'),_0x477d('0x59')]},'ignore':!![]},{'name':_0x477d('0x32')},{'name':_0x477d('0x36')}];}break;case'zendeskaccounts':_0x4481b0[_0x477d('0x10')]=_0x477d('0x5a');break;case _0x477d('0x5b'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x5c');break;case _0x477d('0x5d'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x5e');break;case _0x477d('0x5f'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x60');break;case _0x477d('0x61'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x62');break;case _0x477d('0x63'):_0x4481b0['childModel']=_0x477d('0x64');break;case _0x477d('0x65'):_0x4481b0['childModel']='User';break;case'cannedanswers':_0x4481b0[_0x477d('0x10')]=_0x477d('0x66');break;case _0x477d('0x67'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x68');break;case _0x477d('0x69'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x6a');break;case'intervals':_0x4481b0[_0x477d('0x10')]=_0x477d('0x6b');break;case _0x477d('0x6c'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x6d');break;case _0x477d('0x6e'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x6f');break;case'sounds':_0x4481b0[_0x477d('0x10')]=_0x477d('0x70');break;case _0x477d('0x71'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x72');break;case'templates':_0x4481b0[_0x477d('0x10')]=_0x477d('0x73');break;case _0x477d('0x74'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x75');break;case'trunks':_0x4481b0['childModel']=_0x477d('0x76');break;case _0x477d('0x77'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x78');break;case _0x477d('0x79'):_0x4481b0[_0x477d('0x10')]=_0x477d('0x7a');break;case _0x477d('0x7b'):_0x4481b0['childModel']='AnalyticExtractedReport';_0x4481b0['parentSections']=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x477d('0x7c'):_0x4481b0['childModel']=_0x477d('0x7d');break;}return _0x4481b0;}function _0x4ab576(_0x3f2d4f,_0x1316df){var _0x5d0922=_0x3f2d4f[_0x477d('0x7e')](0x0)[_0x477d('0x7f')]()+_0x3f2d4f[_0x477d('0x80')](0x1);var _0x851020={'type':_0x13ad75[_0x477d('0x81')]['QueryTypes'][_0x477d('0x82')],'raw':!![]};return new Promise(function(_0x245fbe,_0x584f62){var _0xe084ab=squel[_0x477d('0x83')]()[_0x477d('0xb')](_0x477d('0x84')+_0x5d0922+_0x477d('0x85'),'id')['field']('ui.createdAt')[_0x477d('0x86')](_0x477d('0x87')+_0x3f2d4f+'_interactions','ui')[_0x477d('0x88')]('ui.UserId\x20=\x20?',_0x1316df['id']);return _0x13ad75['sequelize'][_0x477d('0x89')](_0xe084ab[_0x477d('0x8a')](),_0x851020)[_0x477d('0x3')](function(_0x1566d6){_0x1316df[_0x5d0922+_0x477d('0x8b')]=_0x1566d6;_0x245fbe(_0x1566d6);})['catch'](function(_0x4c17f5){_0x584f62(_0x4c17f5);});});}return _0x41bcf1[_0x477d('0x8c')](_0x477d('0x8d'),attributes,{'tableName':_0x477d('0x8e'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2b0b84){var _0x24708b={'raw':![],'where':{}};var _0x40c681={};var _0x1e7d73={'count':0x0,'rows':[]};var _0x42b408=_0x2b0b84[_0x477d('0x89')]['section'];var _0x50585d=_0x2b0b84[_0x477d('0x89')]['mergeResources']||![];var _0x25d7cf=_0x43c845(_0x42b408,_0x50585d);if(!_0x25d7cf[_0x477d('0x10')])throw new Error(_0x477d('0x8f')+_0x42b408+'\x27');var _0x4a97aa=[{'name':_0x42b408}];if(!_[_0x477d('0x90')](_0x25d7cf[_0x477d('0x54')]))_0x4a97aa=_0x25d7cf['parentSections'];var _0x2d1e6d=[];for(var _0x3ab693=0x0;_0x3ab693<_0x4a97aa[_0x477d('0x91')];_0x3ab693++){_0x2d1e6d[_0x477d('0x92')](_0x13ad75[_0x477d('0x93')][_0x477d('0x94')]({'where':{'userProfileId':_0x2b0b84['params']['id'],'name':_0x4a97aa[_0x3ab693][_0x477d('0x9')]},'raw':!![]}));}return Promise[_0x477d('0x95')](_0x2d1e6d)[_0x477d('0x3')](function(_0x459c91){var _0x4e7ba3=_[_0x477d('0x2')](_0x459c91,function(_0x543673){return _0x543673?_0x543673:undefined;});var _0x17c564=_[_0x477d('0x2')](_0x4a97aa,['ignore',!![]]);var _0x41ec7a=_[_0x477d('0x90')](_0x4e7ba3)&&_[_0x477d('0x90')](_0x17c564)?null:_['union'](_0x17c564,_0x4e7ba3);if(!_0x41ec7a)return null;var _0x5561bc=[];for(var _0x10654d=0x0;_0x10654d<_0x41ec7a[_0x477d('0x91')];_0x10654d++){var _0x439486=_[_0x477d('0x94')](_0x4a97aa,function(_0x57be6f){return _0x41ec7a[_0x10654d]?_0x57be6f[_0x477d('0x9')]===_0x41ec7a[_0x10654d][_0x477d('0x9')]:null;});if(_0x439486){if(_0x41ec7a[_0x10654d]['ignore']){_0x5561bc[_0x477d('0x92')](_0x53e1b8(_0x25d7cf[_0x477d('0x10')],_0x41ec7a[_0x10654d]));}else{if(!_0x41ec7a[_0x10654d][_0x477d('0x96')]){_0x5561bc['push'](_0x5985b5(_0x439486,_0x41ec7a[_0x10654d],_0x25d7cf[_0x477d('0x10')]));}else{if(_0x439486[_0x477d('0x97')]){_0x5561bc[_0x477d('0x92')](_0x932cc9(_0x439486,_0x41ec7a[_0x10654d]));}}}}}return Promise['all'](_0x5561bc);})[_0x477d('0x3')](function(_0x1eeec7){var _0x290e77=_0x1eeec7;var _0xd3404b=null;if(_0x290e77){_0xd3404b=_0x290e77[_0x477d('0x91')]===0x1?_0x290e77[0x0]:null;}if(!_0xd3404b&&!_0x290e77)return _0x1e7d73;var _0x30c4e8=_0x13ad75[_0x25d7cf[_0x477d('0x10')]][_0x477d('0x98')];_0x40c681[_0x477d('0x97')]=_['keys'](_0x30c4e8);_0x40c681['query']=_[_0x477d('0x99')](_0x2b0b84['query']);_0x40c681[_0x477d('0x9a')]=_['intersection'](_0x40c681[_0x477d('0x97')],_0x40c681['query']);_0x24708b[_0x477d('0x9b')]=_[_0x477d('0x9c')](_0x40c681[_0x477d('0x97')],qs[_0x477d('0x9d')](_0x2b0b84['query']['fields']));_0x24708b['attributes']=_0x24708b['attributes']['length']?_0x24708b[_0x477d('0x9b')]:_0x40c681[_0x477d('0x97')];if(!_0x2b0b84[_0x477d('0x89')][_0x477d('0x9e')](_0x477d('0x9f'))){_0x24708b[_0x477d('0xa0')]=qs['limit'](_0x2b0b84[_0x477d('0x89')]['limit']);_0x24708b['offset']=qs[_0x477d('0xa1')](_0x2b0b84[_0x477d('0x89')][_0x477d('0xa1')]);}_0x24708b[_0x477d('0xa2')]=qs[_0x477d('0xa3')](_0x2b0b84[_0x477d('0x89')]['sort']);_0x24708b['where']=qs[_0x477d('0x9a')](_[_0x477d('0xa4')](_0x2b0b84[_0x477d('0x89')],_0x40c681['filters']));if(_0x2b0b84['query'][_0x477d('0x2')]){_0x24708b[_0x477d('0x88')]=_[_0x477d('0xa5')](_0x24708b[_0x477d('0x88')],{'$or':_[_0x477d('0x5')](_0x30c4e8,function(_0x3d2ab1){if(_0x3d2ab1[_0x477d('0xe')][_0x477d('0xa6')]!==_0x477d('0xa7')){var _0x52dba2={};_0x52dba2[_0x3d2ab1[_0x477d('0xb')]]={'$like':'%'+_0x2b0b84[_0x477d('0x89')]['filter']+'%'};return _0x52dba2;}})});}var _0x2380cf=[];var _0x2b84a4=null;var _0x15088d={};if(_0xd3404b){_0x2b84a4=_[_0x477d('0x94')](_0x4a97aa,[_0x477d('0x9'),_0xd3404b['name']]);if(_0x2b84a4[_0x477d('0xb')]){_0x15088d={};if(_0x25d7cf['childModel']===_0x477d('0xc')){_0x15088d[_0x2b84a4[_0x477d('0xa8')]]=_['map'](_0xd3404b[_0x477d('0x4')],'id');}else{_0x15088d[_0x2b84a4[_0x477d('0xa8')]]=_0xd3404b['associatedResources'];}_0x2380cf[_0x477d('0x92')](_0x15088d);}else{_0x24708b[_0x477d('0x88')]['id']=_0xd3404b['associatedResources'];}}else{for(var _0x3d83f5=0x0;_0x3d83f5<_0x290e77[_0x477d('0x91')];_0x3d83f5++){_0x2b84a4=_[_0x477d('0x94')](_0x4a97aa,[_0x477d('0x9'),_0x290e77[_0x3d83f5][_0x477d('0x9')]]);if(_0x2b84a4[_0x477d('0xb')]){_0x15088d={};_0x15088d[_0x2b84a4[_0x477d('0xa8')]]=_0x290e77[_0x3d83f5][_0x477d('0x4')];_0x2380cf[_0x477d('0x92')](_0x15088d);}else{if(!_0x24708b[_0x477d('0x88')]['id'])_0x24708b[_0x477d('0x88')]['id']=[];_0x290e77[_0x3d83f5][_0x477d('0x4')][_0x477d('0xa9')](function(_0xb6280e){_0x24708b[_0x477d('0x88')]['id']['push'](_0xb6280e);});}}}if(!_[_0x477d('0x90')](_0x2380cf)){_0x24708b['where']=_['merge'](_0x24708b[_0x477d('0x88')],{'$and':{'$or':_0x2380cf}});}_0x24708b=_[_0x477d('0xa5')]({},_0x24708b,_0x2b0b84['options']);if(_0xd3404b&&!_0xd3404b[_0x477d('0x96')]&&_0x25d7cf[_0x477d('0x10')]===_0x477d('0xc')){if(_0x2b0b84[_0x477d('0x89')][_0x477d('0xaa')]){_0x24708b[_0x477d('0xab')]=[{'all':!![]}];}return _0x13ad75[_0x25d7cf[_0x477d('0x10')]]['findAll'](_0x24708b)[_0x477d('0x3')](function(_0x3d1808){var _0x5ae446=[];_0x3d1808[_0x477d('0xa9')](function(_0x1991a1){var _0x4c1902;switch(_0x1991a1[_0x477d('0xac')]){case _0x477d('0xad'):_0x4c1902=_[_0x477d('0x94')](_0xd3404b[_0x477d('0x4')],function(_0x26c4f9){return _0x26c4f9['id']===_0x1991a1[_0x477d('0xae')]&&_0x26c4f9[_0x477d('0xe')]===_0x477d('0xaf');});break;case _0x477d('0xb0'):_0x4c1902=_[_0x477d('0x94')](_0xd3404b[_0x477d('0x4')],function(_0x38d728){return _0x38d728['id']===_0x1991a1[_0x477d('0xae')]&&_0x38d728['type']==='CustomReports';});break;}if(_0x4c1902)_0x5ae446[_0x477d('0x92')](_0x1991a1);});_0x1e7d73['count']=_0x5ae446['length'];_0x1e7d73['rows']=_0x5ae446;return _0x1e7d73;});}else{return _0x13ad75[_0x25d7cf[_0x477d('0x10')]][_0x477d('0xb1')]({'where':_0x24708b['where']})[_0x477d('0x3')](function(_0x2115ca){_0x1e7d73[_0x477d('0xb1')]=_0x2115ca;if(_0x2b0b84[_0x477d('0x89')][_0x477d('0xaa')]){if(_0x25d7cf['childModel']==='CmContact'){_0x24708b[_0x477d('0xab')]=[{'model':_0x13ad75[_0x477d('0x72')],'as':_0x477d('0xb2'),'attributes':['id',_0x477d('0x9'),_0x477d('0xb3')],'required':_0x2b0b84['query']['tag']?!![]:![]},{'model':_0x13ad75['Tag'],'as':_0x477d('0xb4'),'attributes':['id',_0x477d('0x9'),'color'],'through':_0x2b0b84[_0x477d('0x89')][_0x477d('0xb5')]?{'attributes':[],'where':{'TagId':_0x2b0b84[_0x477d('0x89')][_0x477d('0xb5')]||undefined}}:{},'required':_0x2b0b84[_0x477d('0x89')][_0x477d('0xb5')]?!![]:![]}];}else{_0x24708b[_0x477d('0xab')]=[{'all':!![]}];}}return _0x13ad75[_0x25d7cf['childModel']][_0x477d('0x8')](_0x24708b);})['then'](function(_0x43d598){_0x1e7d73[_0x477d('0xb6')]=_0x43d598;if(_0x42b408===_0x477d('0x32')&&_0x2b0b84[_0x477d('0x89')][_0x477d('0xb7')]===_0x477d('0xb8')){var _0x8b4d43=[];for(var _0x4b5bdd=0x0;_0x4b5bdd<_0x1e7d73[_0x477d('0xb6')][_0x477d('0x91')];_0x4b5bdd++){_0x8b4d43[_0x477d('0x92')](_0x4ab576(_0x477d('0xb9'),_0x1e7d73['rows'][_0x4b5bdd][_0x477d('0xba')]));_0x8b4d43['push'](_0x4ab576(_0x477d('0xbb'),_0x1e7d73[_0x477d('0xb6')][_0x4b5bdd][_0x477d('0xba')]));_0x8b4d43[_0x477d('0x92')](_0x4ab576(_0x477d('0xbc'),_0x1e7d73['rows'][_0x4b5bdd][_0x477d('0xba')]));_0x8b4d43['push'](_0x4ab576(_0x477d('0xbd'),_0x1e7d73[_0x477d('0xb6')][_0x4b5bdd][_0x477d('0xba')]));_0x8b4d43['push'](_0x4ab576(_0x477d('0xbe'),_0x1e7d73[_0x477d('0xb6')][_0x4b5bdd][_0x477d('0xba')]));_0x8b4d43[_0x477d('0x92')](_0x4ab576(_0x477d('0xbf'),_0x1e7d73[_0x477d('0xb6')][_0x4b5bdd][_0x477d('0xba')]));}return Promise[_0x477d('0x95')](_0x8b4d43)[_0x477d('0x3')](function(){return _0x1e7d73;});}return _0x1e7d73;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 59f9b6e..63046f7 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 _0x0324=['debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./userProfile.socket','request','then','request\x20sent'];(function(_0x38b6cb,_0xb27e9){var _0x1d31f5=function(_0x35f7c1){while(--_0x35f7c1){_0x38b6cb['push'](_0x38b6cb['shift']());}};_0x1d31f5(++_0xb27e9);}(_0x0324,0x90));var _0x4032=function(_0x5cd1cb,_0x3b46ee){_0x5cd1cb=_0x5cd1cb-0x0;var _0x3dd311=_0x0324[_0x5cd1cb];return _0x3dd311;};'use strict';var _=require('lodash');var util=require(_0x4032('0x0'));var moment=require(_0x4032('0x1'));var BPromise=require(_0x4032('0x2'));var rs=require(_0x4032('0x3'));var fs=require('fs');var Redis=require(_0x4032('0x4'));var db=require(_0x4032('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4032('0x6'))(_0x4032('0x7'));var config=require(_0x4032('0x8'));var jayson=require(_0x4032('0x9'));var client=jayson[_0x4032('0xa')][_0x4032('0xb')]({'port':0x232a});config['redis']=_[_0x4032('0xc')](config[_0x4032('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4032('0xd')]));require(_0x4032('0xe'))['register'](socket);function respondWithRpcPromise(_0x35d7fd,_0x2940da,_0x3bc38e){return new BPromise(function(_0x3d38aa,_0x561064){return client[_0x4032('0xf')](_0x35d7fd,_0x3bc38e)[_0x4032('0x10')](function(_0x5e9430){logger['info']('UserProfile,\x20%s,\x20%s',_0x2940da,_0x4032('0x11'));logger[_0x4032('0x12')](_0x4032('0x13'),_0x2940da,_0x4032('0x11'),JSON[_0x4032('0x14')](_0x5e9430));if(_0x5e9430[_0x4032('0x15')]){if(_0x5e9430[_0x4032('0x15')][_0x4032('0x16')]===0x1f4){logger[_0x4032('0x15')](_0x4032('0x17'),_0x2940da,_0x5e9430['error']['message']);return _0x561064(_0x5e9430[_0x4032('0x15')][_0x4032('0x18')]);}logger[_0x4032('0x15')](_0x4032('0x17'),_0x2940da,_0x5e9430[_0x4032('0x15')][_0x4032('0x18')]);return _0x3d38aa(_0x5e9430['error'][_0x4032('0x18')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x2940da,_0x4032('0x11'));_0x3d38aa(_0x5e9430[_0x4032('0x19')][_0x4032('0x18')]);}})[_0x4032('0x1a')](function(_0x194abb){logger[_0x4032('0x15')]('UserProfile,\x20%s,\x20%s',_0x2940da,_0x194abb);_0x561064(_0x194abb);});});} \ No newline at end of file +var _0xd301=['defaults','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x1d39f6,_0x146f4a){var _0x3dbd7a=function(_0x4486f2){while(--_0x4486f2){_0x1d39f6['push'](_0x1d39f6['shift']());}};_0x3dbd7a(++_0x146f4a);}(_0xd301,0x145));var _0x1d30=function(_0x5b5f98,_0x430e9f){_0x5b5f98=_0x5b5f98-0x0;var _0x292f83=_0xd301[_0x5b5f98];return _0x292f83;};'use strict';var _=require(_0x1d30('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d30('0x1'));var fs=require('fs');var Redis=require(_0x1d30('0x2'));var db=require(_0x1d30('0x3'))['db'];var utils=require(_0x1d30('0x4'));var logger=require(_0x1d30('0x5'))(_0x1d30('0x6'));var config=require(_0x1d30('0x7'));var jayson=require(_0x1d30('0x8'));var client=jayson[_0x1d30('0x9')]['http']({'port':0x232a});config[_0x1d30('0xa')]=_[_0x1d30('0xb')](config[_0x1d30('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1d30('0xc'))(new Redis(config[_0x1d30('0xa')]));require(_0x1d30('0xd'))[_0x1d30('0xe')](socket);function respondWithRpcPromise(_0x2a526e,_0xbad263,_0x2bcc44){return new BPromise(function(_0x5ced3a,_0x3b65ed){return client[_0x1d30('0xf')](_0x2a526e,_0x2bcc44)[_0x1d30('0x10')](function(_0x521497){logger[_0x1d30('0x11')](_0x1d30('0x12'),_0xbad263,_0x1d30('0x13'));logger[_0x1d30('0x14')](_0x1d30('0x15'),_0xbad263,_0x1d30('0x13'),JSON[_0x1d30('0x16')](_0x521497));if(_0x521497[_0x1d30('0x17')]){if(_0x521497[_0x1d30('0x17')][_0x1d30('0x18')]===0x1f4){logger[_0x1d30('0x17')](_0x1d30('0x12'),_0xbad263,_0x521497[_0x1d30('0x17')][_0x1d30('0x19')]);return _0x3b65ed(_0x521497[_0x1d30('0x17')]['message']);}logger[_0x1d30('0x17')](_0x1d30('0x12'),_0xbad263,_0x521497[_0x1d30('0x17')][_0x1d30('0x19')]);return _0x5ced3a(_0x521497[_0x1d30('0x17')]['message']);}else{logger['info'](_0x1d30('0x12'),_0xbad263,_0x1d30('0x13'));_0x5ced3a(_0x521497[_0x1d30('0x1a')][_0x1d30('0x19')]);}})[_0x1d30('0x1b')](function(_0x458b97){logger[_0x1d30('0x17')](_0x1d30('0x12'),_0xbad263,_0x458b97);_0x3b65ed(_0x458b97);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 161e32f..6db6ec3 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 _0xbee8=['register','length','userProfile:','./userProfile.events','save','remove','update','removeListener'];(function(_0x53f852,_0x18ab08){var _0x2640c2=function(_0x35ce2a){while(--_0x35ce2a){_0x53f852['push'](_0x53f852['shift']());}};_0x2640c2(++_0x18ab08);}(_0xbee8,0x18b));var _0x8bee=function(_0x3df871,_0xda2e11){_0x3df871=_0x3df871-0x0;var _0x570f7b=_0xbee8[_0x3df871];return _0x570f7b;};'use strict';var UserProfileEvents=require(_0x8bee('0x0'));var events=[_0x8bee('0x1'),_0x8bee('0x2'),_0x8bee('0x3')];function createListener(_0x315bfd,_0xaa6925){return function(_0x2996af){_0xaa6925['emit'](_0x315bfd,_0x2996af);};}function removeListener(_0x2e6301,_0x19926a){return function(){UserProfileEvents[_0x8bee('0x4')](_0x2e6301,_0x19926a);};}exports[_0x8bee('0x5')]=function(_0x1183c3){for(var _0x5cfecc=0x0,_0x5015a1=events[_0x8bee('0x6')];_0x5cfecc<_0x5015a1;_0x5cfecc++){var _0x3aec6a=events[_0x5cfecc];var _0x100971=createListener(_0x8bee('0x7')+_0x3aec6a,_0x1183c3);UserProfileEvents['on'](_0x3aec6a,_0x100971);}}; \ No newline at end of file +var _0x7c7e=['length','userProfile:','./userProfile.events','save','remove','update','emit','removeListener','register'];(function(_0x181cae,_0x3be447){var _0x58533f=function(_0xda1150){while(--_0xda1150){_0x181cae['push'](_0x181cae['shift']());}};_0x58533f(++_0x3be447);}(_0x7c7e,0x107));var _0xe7c7=function(_0x4e1f46,_0x3deec6){_0x4e1f46=_0x4e1f46-0x0;var _0x239acb=_0x7c7e[_0x4e1f46];return _0x239acb;};'use strict';var UserProfileEvents=require(_0xe7c7('0x0'));var events=[_0xe7c7('0x1'),_0xe7c7('0x2'),_0xe7c7('0x3')];function createListener(_0x4312ca,_0x2b4052){return function(_0x13f1be){_0x2b4052[_0xe7c7('0x4')](_0x4312ca,_0x13f1be);};}function removeListener(_0x24079c,_0x12eec1){return function(){UserProfileEvents[_0xe7c7('0x5')](_0x24079c,_0x12eec1);};}exports[_0xe7c7('0x6')]=function(_0x48de8d){for(var _0x746156=0x0,_0x45928c=events[_0xe7c7('0x7')];_0x746156<_0x45928c;_0x746156++){var _0x4e41af=events[_0x746156];var _0x34dd69=createListener(_0xe7c7('0x8')+_0x4e41af,_0x48de8d);UserProfileEvents['on'](_0x4e41af,_0x34dd69);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 16ec342..0277f82 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 _0xe39a=['Router','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','multer','util','path','express'];(function(_0x57140b,_0xec482d){var _0x31cf97=function(_0x199ac1){while(--_0x199ac1){_0x57140b['push'](_0x57140b['shift']());}};_0x31cf97(++_0xec482d);}(_0xe39a,0x106));var _0xae39=function(_0x13d682,_0x3c4a27){_0x13d682=_0x13d682-0x0;var _0x3adac3=_0xe39a[_0x13d682];return _0x3adac3;};'use strict';var multer=require(_0xae39('0x0'));var util=require(_0xae39('0x1'));var path=require(_0xae39('0x2'));var timeout=require('connect-timeout');var express=require(_0xae39('0x3'));var router=express[_0xae39('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xae39('0x5'));var config=require(_0xae39('0x6'));var controller=require(_0xae39('0x7'));router[_0xae39('0x8')]('/',auth[_0xae39('0x9')](),controller[_0xae39('0xa')]);router[_0xae39('0x8')](_0xae39('0xb'),auth[_0xae39('0x9')](),controller[_0xae39('0xc')]);router[_0xae39('0x8')](_0xae39('0xd'),auth[_0xae39('0x9')](),controller['show']);router[_0xae39('0xe')]('/',auth['isAuthenticated'](),controller[_0xae39('0xf')]);router[_0xae39('0x10')]('/:id',auth[_0xae39('0x9')](),controller['update']);router[_0xae39('0x11')](_0xae39('0xd'),auth[_0xae39('0x9')](),controller[_0xae39('0x12')]);module['exports']=router; \ No newline at end of file +var _0x897d=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','show','post','/:id','delete','util','path'];(function(_0x191529,_0x52d53d){var _0x5e816c=function(_0x10d7cf){while(--_0x10d7cf){_0x191529['push'](_0x191529['shift']());}};_0x5e816c(++_0x52d53d);}(_0x897d,0x1a7));var _0xd897=function(_0x3b352e,_0x5af5ca){_0x3b352e=_0x3b352e-0x0;var _0x33c4de=_0x897d[_0x3b352e];return _0x33c4de;};'use strict';var multer=require('multer');var util=require(_0xd897('0x0'));var path=require(_0xd897('0x1'));var timeout=require(_0xd897('0x2'));var express=require(_0xd897('0x3'));var router=express['Router']();var fs_extra=require(_0xd897('0x4'));var auth=require(_0xd897('0x5'));var interaction=require(_0xd897('0x6'));var config=require(_0xd897('0x7'));var controller=require(_0xd897('0x8'));router[_0xd897('0x9')]('/',auth[_0xd897('0xa')](),controller['index']);router[_0xd897('0x9')](_0xd897('0xb'),auth[_0xd897('0xa')](),controller[_0xd897('0xc')]);router[_0xd897('0x9')]('/:id',auth[_0xd897('0xa')](),controller[_0xd897('0xd')]);router[_0xd897('0xe')]('/',auth[_0xd897('0xa')](),controller['create']);router['put'](_0xd897('0xf'),auth[_0xd897('0xa')](),controller['update']);router[_0xd897('0x10')](_0xd897('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 1a1012e..3a205ef 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 _0x8147=['INTEGER','exports','STRING'];(function(_0x18e875,_0x54fff7){var _0x1643c6=function(_0x5f09ff){while(--_0x5f09ff){_0x18e875['push'](_0x18e875['shift']());}};_0x1643c6(++_0x54fff7);}(_0x8147,0x178));var _0x7814=function(_0x4be55f,_0x2919b3){_0x4be55f=_0x4be55f-0x0;var _0x5e9a3a=_0x8147[_0x4be55f];return _0x5e9a3a;};'use strict';var Sequelize=require('sequelize');module[_0x7814('0x0')]={'name':{'type':Sequelize[_0x7814('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7814('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7814('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x6225=['STRING','INTEGER','sequelize','exports'];(function(_0xfe3407,_0x2d93f9){var _0x2a86ba=function(_0x557e9e){while(--_0x557e9e){_0xfe3407['push'](_0xfe3407['shift']());}};_0x2a86ba(++_0x2d93f9);}(_0x6225,0x116));var _0x5622=function(_0x5828d0,_0x2c3e93){_0x5828d0=_0x5828d0-0x0;var _0x239b02=_0x6225[_0x5828d0];return _0x239b02;};'use strict';var Sequelize=require(_0x5622('0x0'));module[_0x5622('0x1')]={'name':{'type':Sequelize[_0x5622('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5622('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5622('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 3141a09..9f6a476 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 _0x8952=['filter','VIRTUAL','merge','options','findAll','rows','show','params','keys','includeAll','include','catch','create','body','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','stack','name','map','UserProfileResource','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x8952,0x17e));var _0x2895=function(_0x846319,_0x5d38e9){_0x846319=_0x846319-0x0;var _0x994e4d=_0x8952[_0x846319];return _0x994e4d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2895('0x0'));var zipdir=require(_0x2895('0x1'));var jsonpatch=require(_0x2895('0x2'));var rp=require(_0x2895('0x3'));var moment=require(_0x2895('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2895('0x5'));var util=require(_0x2895('0x6'));var path=require(_0x2895('0x7'));var sox=require('sox');var csv=require(_0x2895('0x8'));var ejs=require(_0x2895('0x9'));var fs=require('fs');var fs_extra=require(_0x2895('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x8'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2895('0x14'))['db'];function respondWithStatusCode(_0x3924be,_0x4b1342){_0x4b1342=_0x4b1342||0xcc;return function(_0x32574c){if(_0x32574c){return _0x3924be[_0x2895('0x15')](_0x4b1342);}return _0x3924be['status'](_0x4b1342)['end']();};}function respondWithResult(_0x1d1493,_0x2ca2ac){_0x2ca2ac=_0x2ca2ac||0xc8;return function(_0x5777a0){if(_0x5777a0){return _0x1d1493[_0x2895('0x16')](_0x2ca2ac)[_0x2895('0x17')](_0x5777a0);}};}function respondWithFilteredResult(_0x27b50e,_0x1ae013){return function(_0x1d3659){if(_0x1d3659){var _0x2627e6=typeof _0x1ae013[_0x2895('0x18')]===_0x2895('0x19')&&typeof _0x1ae013[_0x2895('0x1a')]===_0x2895('0x19');var _0x10a1bf=_0x1d3659[_0x2895('0x1b')];var _0xbf8b63=_0x2627e6?0x0:_0x1ae013[_0x2895('0x18')];var _0x155124=_0x2627e6?_0x1d3659[_0x2895('0x1b')]:_0x1ae013[_0x2895('0x18')]+_0x1ae013[_0x2895('0x1a')];var _0x5a8eab;if(_0x155124>=_0x10a1bf){_0x155124=_0x10a1bf;_0x5a8eab=0xc8;}else{_0x5a8eab=0xce;}_0x27b50e['status'](_0x5a8eab);return _0x27b50e['set'](_0x2895('0x1c'),_0xbf8b63+'-'+_0x155124+'/'+_0x10a1bf)[_0x2895('0x17')](_0x1d3659);}return null;};}function patchUpdates(_0x3ec4da){return function(_0x593e47){try{jsonpatch[_0x2895('0x1d')](_0x593e47,_0x3ec4da,!![]);}catch(_0x190b79){return BPromise[_0x2895('0x1e')](_0x190b79);}return _0x593e47[_0x2895('0x1f')]();};}function saveUpdates(_0x8b75e0,_0x5dbbfe){return function(_0x30c6c3){if(_0x30c6c3){return _0x30c6c3[_0x2895('0x20')](_0x8b75e0)['then'](function(_0x142e58){return _0x142e58;});}return null;};}function removeEntity(_0x384357,_0x6f8ad4){return function(_0x511286){if(_0x511286){return _0x511286['destroy']()[_0x2895('0x21')](function(){_0x384357[_0x2895('0x16')](0xcc)[_0x2895('0x22')]();});}};}function handleEntityNotFound(_0x4a21cf,_0x3d3320){return function(_0x3690ce){if(!_0x3690ce){_0x4a21cf['sendStatus'](0x194);}return _0x3690ce;};}function handleError(_0x293ad3,_0x127540){_0x127540=_0x127540||0x1f4;return function(_0x2cd4df){logger['error'](_0x2cd4df[_0x2895('0x23')]);if(_0x2cd4df[_0x2895('0x24')]){delete _0x2cd4df['name'];}_0x293ad3[_0x2895('0x16')](_0x127540)['send'](_0x2cd4df);};}exports['index']=function(_0x18a935,_0x4ee2cc){var _0xfa4f85={},_0x381538={},_0x4fdd94={'count':0x0,'rows':[]};var _0x5574bf=_[_0x2895('0x25')](db[_0x2895('0x26')][_0x2895('0x27')],function(_0x14e343){return{'name':_0x14e343[_0x2895('0x28')],'type':_0x14e343[_0x2895('0x29')][_0x2895('0x2a')]};});_0x381538['model']=_[_0x2895('0x25')](_0x5574bf,_0x2895('0x24'));_0x381538[_0x2895('0x2b')]=_['keys'](_0x18a935[_0x2895('0x2b')]);_0x381538[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],_0x381538['query']);_0xfa4f85[_0x2895('0x2f')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x18a935[_0x2895('0x2b')]['fields']));_0xfa4f85['attributes']=_0xfa4f85[_0x2895('0x2f')][_0x2895('0x31')]?_0xfa4f85['attributes']:_0x381538[_0x2895('0x2e')];if(!_0x18a935['query'][_0x2895('0x32')](_0x2895('0x33'))){_0xfa4f85['limit']=qs[_0x2895('0x1a')](_0x18a935['query'][_0x2895('0x1a')]);_0xfa4f85['offset']=qs['offset'](_0x18a935[_0x2895('0x2b')][_0x2895('0x18')]);}_0xfa4f85[_0x2895('0x34')]=qs['sort'](_0x18a935[_0x2895('0x2b')][_0x2895('0x35')]);_0xfa4f85[_0x2895('0x36')]=qs[_0x2895('0x2c')](_[_0x2895('0x37')](_0x18a935[_0x2895('0x2b')],_0x381538[_0x2895('0x2c')]),_0x5574bf);if(_0x18a935[_0x2895('0x2b')][_0x2895('0x38')]){_0xfa4f85[_0x2895('0x36')]=_['merge'](_0xfa4f85[_0x2895('0x36')],{'$or':_[_0x2895('0x25')](_0x5574bf,function(_0x47413d){if(_0x47413d[_0x2895('0x29')]!==_0x2895('0x39')){var _0x12d7d8={};_0x12d7d8[_0x47413d[_0x2895('0x24')]]={'$like':'%'+_0x18a935['query']['filter']+'%'};return _0x12d7d8;}})});}_0xfa4f85=_[_0x2895('0x3a')]({},_0xfa4f85,_0x18a935[_0x2895('0x3b')]);var _0x24b9e0={'where':_0xfa4f85[_0x2895('0x36')]};return db[_0x2895('0x26')][_0x2895('0x1b')](_0x24b9e0)['then'](function(_0x5d18ef){_0x4fdd94[_0x2895('0x1b')]=_0x5d18ef;if(_0x18a935[_0x2895('0x2b')]['includeAll']){_0xfa4f85['include']=[{'all':!![]}];}return db[_0x2895('0x26')][_0x2895('0x3c')](_0xfa4f85);})[_0x2895('0x21')](function(_0x28967f){_0x4fdd94[_0x2895('0x3d')]=_0x28967f;return _0x4fdd94;})[_0x2895('0x21')](respondWithFilteredResult(_0x4ee2cc,_0xfa4f85))['catch'](handleError(_0x4ee2cc,null));};exports[_0x2895('0x3e')]=function(_0x2cfb24,_0x18ca24){var _0x1537fd={'raw':![],'where':{'id':_0x2cfb24[_0x2895('0x3f')]['id']}},_0x4af6d6={};_0x4af6d6[_0x2895('0x2e')]=_[_0x2895('0x40')](db[_0x2895('0x26')]['rawAttributes']);_0x4af6d6['query']=_[_0x2895('0x40')](_0x2cfb24[_0x2895('0x2b')]);_0x4af6d6[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],_0x4af6d6['query']);_0x1537fd['attributes']=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x2cfb24[_0x2895('0x2b')][_0x2895('0x30')]));_0x1537fd[_0x2895('0x2f')]=_0x1537fd[_0x2895('0x2f')]['length']?_0x1537fd[_0x2895('0x2f')]:_0x4af6d6[_0x2895('0x2e')];if(_0x2cfb24[_0x2895('0x2b')][_0x2895('0x41')]){_0x1537fd[_0x2895('0x42')]=[{'all':!![]}];}_0x1537fd=_[_0x2895('0x3a')]({},_0x1537fd,_0x2cfb24[_0x2895('0x3b')]);return db[_0x2895('0x26')]['find'](_0x1537fd)[_0x2895('0x21')](handleEntityNotFound(_0x18ca24,null))[_0x2895('0x21')](respondWithResult(_0x18ca24,null))[_0x2895('0x43')](handleError(_0x18ca24,null));};exports['create']=function(_0xc85aa1,_0x5307a9){return db['UserProfileResource'][_0x2895('0x44')](_0xc85aa1[_0x2895('0x45')],{})[_0x2895('0x21')](respondWithResult(_0x5307a9,0xc9))[_0x2895('0x43')](handleError(_0x5307a9,null));};exports[_0x2895('0x20')]=function(_0x3cc331,_0x11e53a){if(_0x3cc331['body']['id']){delete _0x3cc331[_0x2895('0x45')]['id'];}return db[_0x2895('0x26')]['find']({'where':{'id':_0x3cc331['params']['id']}})['then'](handleEntityNotFound(_0x11e53a,null))[_0x2895('0x21')](saveUpdates(_0x3cc331[_0x2895('0x45')],null))[_0x2895('0x21')](respondWithResult(_0x11e53a,null))[_0x2895('0x43')](handleError(_0x11e53a,null));};exports[_0x2895('0x46')]=function(_0x3c5261,_0xaca46c){return db[_0x2895('0x26')][_0x2895('0x47')]({'where':{'id':_0x3c5261[_0x2895('0x3f')]['id']}})[_0x2895('0x21')](handleEntityNotFound(_0xaca46c,null))[_0x2895('0x21')](removeEntity(_0xaca46c,null))[_0x2895('0x43')](handleError(_0xaca46c,null));};exports[_0x2895('0x48')]=function(_0x356d35,_0x3c1135){return db[_0x2895('0x26')][_0x2895('0x48')]()[_0x2895('0x21')](respondWithResult(_0x3c1135,null))[_0x2895('0x43')](handleError(_0x3c1135,null));}; \ No newline at end of file +var _0xf61e=['where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','status','error','stack','name','send','index','map','UserProfileResource','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order'];(function(_0x51bb74,_0x3af26f){var _0x5a124b=function(_0x292fb6){while(--_0x292fb6){_0x51bb74['push'](_0x51bb74['shift']());}};_0x5a124b(++_0x3af26f);}(_0xf61e,0x191));var _0xef61=function(_0x2367e6,_0x26276d){_0x2367e6=_0x2367e6-0x0;var _0x2ef44b=_0xf61e[_0x2367e6];return _0x2ef44b;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b144,_0x4e738f){return function(_0x2a6832){if(!_0x2a6832){_0x16b144[_0xef61('0x1d')](0x194);}return _0x2a6832;};}function handleError(_0x2419a9,_0xf4c7c9){_0xf4c7c9=_0xf4c7c9||0x1f4;return function(_0x2155f1){logger[_0xef61('0x2a')](_0x2155f1[_0xef61('0x2b')]);if(_0x2155f1[_0xef61('0x2c')]){delete _0x2155f1[_0xef61('0x2c')];}_0x2419a9[_0xef61('0x29')](_0xf4c7c9)[_0xef61('0x2d')](_0x2155f1);};}exports[_0xef61('0x2e')]=function(_0xeb9a62,_0x63edd4){var _0x1f3572={},_0x85978={},_0x39c15e={'count':0x0,'rows':[]};var _0x393ea9=_[_0xef61('0x2f')](db[_0xef61('0x30')][_0xef61('0x31')],function(_0x53fa3b){return{'name':_0x53fa3b['fieldName'],'type':_0x53fa3b['type'][_0xef61('0x32')]};});_0x85978[_0xef61('0x33')]=_[_0xef61('0x2f')](_0x393ea9,'name');_0x85978[_0xef61('0x34')]=_[_0xef61('0x35')](_0xeb9a62['query']);_0x85978[_0xef61('0x36')]=_['intersection'](_0x85978['model'],_0x85978[_0xef61('0x34')]);_0x1f3572['attributes']=_[_0xef61('0x37')](_0x85978['model'],qs[_0xef61('0x38')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x38')]));_0x1f3572[_0xef61('0x39')]=_0x1f3572[_0xef61('0x39')][_0xef61('0x3a')]?_0x1f3572[_0xef61('0x39')]:_0x85978[_0xef61('0x33')];if(!_0xeb9a62[_0xef61('0x34')][_0xef61('0x3b')]('nolimit')){_0x1f3572[_0xef61('0x23')]=qs[_0xef61('0x23')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x23')]);_0x1f3572[_0xef61('0x20')]=qs['offset'](_0xeb9a62[_0xef61('0x34')][_0xef61('0x20')]);}_0x1f3572[_0xef61('0x3c')]=qs['sort'](_0xeb9a62['query']['sort']);_0x1f3572[_0xef61('0x3d')]=qs['filters'](_['pick'](_0xeb9a62['query'],_0x85978[_0xef61('0x36')]),_0x393ea9);if(_0xeb9a62[_0xef61('0x34')][_0xef61('0x3e')]){_0x1f3572['where']=_['merge'](_0x1f3572['where'],{'$or':_[_0xef61('0x2f')](_0x393ea9,function(_0x32ad44){if(_0x32ad44['type']!==_0xef61('0x3f')){var _0x12f442={};_0x12f442[_0x32ad44[_0xef61('0x2c')]]={'$like':'%'+_0xeb9a62[_0xef61('0x34')]['filter']+'%'};return _0x12f442;}})});}_0x1f3572=_[_0xef61('0x40')]({},_0x1f3572,_0xeb9a62[_0xef61('0x41')]);var _0x3103d4={'where':_0x1f3572[_0xef61('0x3d')]};return db['UserProfileResource']['count'](_0x3103d4)[_0xef61('0x28')](function(_0x462972){_0x39c15e[_0xef61('0x22')]=_0x462972;if(_0xeb9a62['query'][_0xef61('0x42')]){_0x1f3572[_0xef61('0x43')]=[{'all':!![]}];}return db[_0xef61('0x30')][_0xef61('0x44')](_0x1f3572);})['then'](function(_0x545597){_0x39c15e['rows']=_0x545597;return _0x39c15e;})[_0xef61('0x28')](respondWithFilteredResult(_0x63edd4,_0x1f3572))[_0xef61('0x45')](handleError(_0x63edd4,null));};exports[_0xef61('0x46')]=function(_0xe40d,_0x3f81a1){var _0x272143={'raw':![],'where':{'id':_0xe40d['params']['id']}},_0xc9b467={};_0xc9b467[_0xef61('0x33')]=_[_0xef61('0x35')](db[_0xef61('0x30')][_0xef61('0x31')]);_0xc9b467['query']=_[_0xef61('0x35')](_0xe40d[_0xef61('0x34')]);_0xc9b467[_0xef61('0x36')]=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],_0xc9b467[_0xef61('0x34')]);_0x272143['attributes']=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],qs[_0xef61('0x38')](_0xe40d['query'][_0xef61('0x38')]));_0x272143[_0xef61('0x39')]=_0x272143[_0xef61('0x39')][_0xef61('0x3a')]?_0x272143[_0xef61('0x39')]:_0xc9b467[_0xef61('0x33')];if(_0xe40d['query'][_0xef61('0x42')]){_0x272143[_0xef61('0x43')]=[{'all':!![]}];}_0x272143=_['merge']({},_0x272143,_0xe40d[_0xef61('0x41')]);return db[_0xef61('0x30')][_0xef61('0x47')](_0x272143)[_0xef61('0x28')](handleEntityNotFound(_0x3f81a1,null))['then'](respondWithResult(_0x3f81a1,null))[_0xef61('0x45')](handleError(_0x3f81a1,null));};exports[_0xef61('0x48')]=function(_0x5e614b,_0x47b09d){return db[_0xef61('0x30')][_0xef61('0x48')](_0x5e614b['body'],{})[_0xef61('0x28')](respondWithResult(_0x47b09d,0xc9))[_0xef61('0x45')](handleError(_0x47b09d,null));};exports[_0xef61('0x49')]=function(_0x2904e0,_0x13bb20){if(_0x2904e0[_0xef61('0x4a')]['id']){delete _0x2904e0[_0xef61('0x4a')]['id'];}return db['UserProfileResource'][_0xef61('0x47')]({'where':{'id':_0x2904e0['params']['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x13bb20,null))[_0xef61('0x28')](saveUpdates(_0x2904e0[_0xef61('0x4a')],null))[_0xef61('0x28')](respondWithResult(_0x13bb20,null))[_0xef61('0x45')](handleError(_0x13bb20,null));};exports[_0xef61('0x27')]=function(_0x3e23eb,_0x1565c7){return db[_0xef61('0x30')]['find']({'where':{'id':_0x3e23eb[_0xef61('0x4b')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x1565c7,null))['then'](removeEntity(_0x1565c7,null))['catch'](handleError(_0x1565c7,null));};exports[_0xef61('0x4c')]=function(_0x1ce127,_0x504389){return db[_0xef61('0x30')]['describe']()[_0xef61('0x28')](respondWithResult(_0x504389,null))[_0xef61('0x45')](handleError(_0x504389,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 826a023..66d93ad 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 _0x3a78=['../../config/environment','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','api','moment','bluebird','rimraf'];(function(_0x1789f8,_0x52d0fc){var _0x338750=function(_0x34b1e7){while(--_0x34b1e7){_0x1789f8['push'](_0x1789f8['shift']());}};_0x338750(++_0x52d0fc);}(_0x3a78,0x1dc));var _0x83a7=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x3a78[_0x1c34e7];return _0x378cb1;};'use strict';var _=require('lodash');var util=require(_0x83a7('0x0'));var logger=require('../../config/logger')(_0x83a7('0x1'));var moment=require(_0x83a7('0x2'));var BPromise=require(_0x83a7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x83a7('0x4'));var config=require(_0x83a7('0x5'));var attributes=require(_0x83a7('0x6'));module['exports']=function(_0x48250f,_0x19ab68){return _0x48250f[_0x83a7('0x7')](_0x83a7('0x8'),attributes,{'tableName':_0x83a7('0x9'),'paranoid':![],'indexes':[{'name':_0x83a7('0xa'),'fields':[_0x83a7('0xb'),_0x83a7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x183b=['bluebird','request-promise','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment'];(function(_0x3f5544,_0x1a5fd1){var _0x12ef82=function(_0xe65ae0){while(--_0xe65ae0){_0x3f5544['push'](_0x3f5544['shift']());}};_0x12ef82(++_0x1a5fd1);}(_0x183b,0x95));var _0xb183=function(_0x191326,_0x11222a){_0x191326=_0x191326-0x0;var _0x239ea5=_0x183b[_0x191326];return _0x239ea5;};'use strict';var _=require(_0xb183('0x0'));var util=require(_0xb183('0x1'));var logger=require(_0xb183('0x2'))(_0xb183('0x3'));var moment=require(_0xb183('0x4'));var BPromise=require(_0xb183('0x5'));var rp=require(_0xb183('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb183('0x7'));var attributes=require(_0xb183('0x8'));module[_0xb183('0x9')]=function(_0x58ac43,_0x5a5769){return _0x58ac43[_0xb183('0xa')]('UserProfileResource',attributes,{'tableName':_0xb183('0xb'),'paranoid':![],'indexes':[{'name':_0xb183('0xc'),'fields':['resourceId',_0xb183('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 8e6d12f..d3e8588 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 _0x5eb9=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','UserProfileResource,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash'];(function(_0x132663,_0x4de2ac){var _0x4fe27f=function(_0x1dfec6){while(--_0x1dfec6){_0x132663['push'](_0x132663['shift']());}};_0x4fe27f(++_0x4de2ac);}(_0x5eb9,0x8b));var _0x95eb=function(_0x30dfa4,_0x1a6275){_0x30dfa4=_0x30dfa4-0x0;var _0x185b37=_0x5eb9[_0x30dfa4];return _0x185b37;};'use strict';var _=require(_0x95eb('0x0'));var util=require(_0x95eb('0x1'));var moment=require(_0x95eb('0x2'));var BPromise=require('bluebird');var rs=require(_0x95eb('0x3'));var fs=require('fs');var Redis=require(_0x95eb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x95eb('0x5'));var logger=require(_0x95eb('0x6'))(_0x95eb('0x7'));var config=require(_0x95eb('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x95eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xabbd3,_0x44d61e,_0x177601){return new BPromise(function(_0x43185f,_0x1310dd){return client[_0x95eb('0xa')](_0xabbd3,_0x177601)['then'](function(_0x277714){logger[_0x95eb('0xb')](_0x95eb('0xc'),_0x44d61e,'request\x20sent');logger[_0x95eb('0xd')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x44d61e,_0x95eb('0xe'),JSON[_0x95eb('0xf')](_0x277714));if(_0x277714[_0x95eb('0x10')]){if(_0x277714[_0x95eb('0x10')][_0x95eb('0x11')]===0x1f4){logger[_0x95eb('0x10')](_0x95eb('0xc'),_0x44d61e,_0x277714[_0x95eb('0x10')][_0x95eb('0x12')]);return _0x1310dd(_0x277714['error']['message']);}logger['error'](_0x95eb('0xc'),_0x44d61e,_0x277714[_0x95eb('0x10')][_0x95eb('0x12')]);return _0x43185f(_0x277714[_0x95eb('0x10')][_0x95eb('0x12')]);}else{logger[_0x95eb('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x44d61e,'request\x20sent');_0x43185f(_0x277714[_0x95eb('0x13')]['message']);}})['catch'](function(_0x7547e7){logger[_0x95eb('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x44d61e,_0x7547e7);_0x1310dd(_0x7547e7);});});} \ No newline at end of file +var _0xe1ab=['request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserProfileResource,\x20%s,\x20%s'];(function(_0x3749e5,_0x5e4389){var _0x297f9e=function(_0x482a0a){while(--_0x482a0a){_0x3749e5['push'](_0x3749e5['shift']());}};_0x297f9e(++_0x5e4389);}(_0xe1ab,0xa8));var _0xbe1a=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xe1ab[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0xbe1a('0x0'));var util=require('util');var moment=require(_0xbe1a('0x1'));var BPromise=require('bluebird');var rs=require(_0xbe1a('0x2'));var fs=require('fs');var Redis=require(_0xbe1a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbe1a('0x4'))(_0xbe1a('0x5'));var config=require(_0xbe1a('0x6'));var jayson=require(_0xbe1a('0x7'));var client=jayson[_0xbe1a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a5f7f,_0xed6150,_0x15c25a){return new BPromise(function(_0x48c632,_0x157163){return client['request'](_0x4a5f7f,_0x15c25a)[_0xbe1a('0x9')](function(_0x533634){logger[_0xbe1a('0xa')](_0xbe1a('0xb'),_0xed6150,_0xbe1a('0xc'));logger[_0xbe1a('0xd')](_0xbe1a('0xe'),_0xed6150,_0xbe1a('0xc'),JSON['stringify'](_0x533634));if(_0x533634['error']){if(_0x533634['error'][_0xbe1a('0xf')]===0x1f4){logger[_0xbe1a('0x10')](_0xbe1a('0xb'),_0xed6150,_0x533634[_0xbe1a('0x10')][_0xbe1a('0x11')]);return _0x157163(_0x533634['error'][_0xbe1a('0x11')]);}logger['error'](_0xbe1a('0xb'),_0xed6150,_0x533634[_0xbe1a('0x10')][_0xbe1a('0x11')]);return _0x48c632(_0x533634[_0xbe1a('0x10')]['message']);}else{logger[_0xbe1a('0xa')](_0xbe1a('0xb'),_0xed6150,_0xbe1a('0xc'));_0x48c632(_0x533634[_0xbe1a('0x12')][_0xbe1a('0x11')]);}})[_0xbe1a('0x13')](function(_0x5015fc){logger[_0xbe1a('0x10')](_0xbe1a('0xb'),_0xed6150,_0x5015fc);_0x157163(_0x5015fc);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index e373da2..cafcb3d 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 _0x7351=['get','/describe','isAuthenticated','describe','/:id','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','index'];(function(_0x4637d2,_0x1cb4a9){var _0x5b2683=function(_0x1a59ca){while(--_0x1a59ca){_0x4637d2['push'](_0x4637d2['shift']());}};_0x5b2683(++_0x1cb4a9);}(_0x7351,0x11b));var _0x1735=function(_0xe3114b,_0x2fd647){_0xe3114b=_0xe3114b-0x0;var _0x42eb9e=_0x7351[_0xe3114b];return _0x42eb9e;};'use strict';var multer=require(_0x1735('0x0'));var util=require(_0x1735('0x1'));var path=require(_0x1735('0x2'));var timeout=require(_0x1735('0x3'));var express=require(_0x1735('0x4'));var router=express[_0x1735('0x5')]();var fs_extra=require(_0x1735('0x6'));var auth=require(_0x1735('0x7'));var interaction=require(_0x1735('0x8'));var config=require('../../config/environment');var controller=require(_0x1735('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1735('0xa')]);router[_0x1735('0xb')](_0x1735('0xc'),auth[_0x1735('0xd')](),controller[_0x1735('0xe')]);router[_0x1735('0xb')](_0x1735('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x1735('0x10')]('/',auth[_0x1735('0xd')](),controller['create']);router[_0x1735('0x11')]('/:id',auth[_0x1735('0xd')](),controller[_0x1735('0x12')]);router[_0x1735('0x13')]('/:id',auth[_0x1735('0xd')](),controller[_0x1735('0x14')]);module['exports']=router; \ No newline at end of file +var _0xbc6d=['update','delete','exports','path','express','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x475640,_0x1fa709){var _0x4e1eb7=function(_0x58d930){while(--_0x58d930){_0x475640['push'](_0x475640['shift']());}};_0x4e1eb7(++_0x1fa709);}(_0xbc6d,0xe0));var _0xdbc6=function(_0x27acbf,_0xe7afec){_0x27acbf=_0x27acbf-0x0;var _0xf93fc8=_0xbc6d[_0x27acbf];return _0xf93fc8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdbc6('0x0'));var timeout=require('connect-timeout');var express=require(_0xdbc6('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbc6('0x2'));var config=require(_0xdbc6('0x3'));var controller=require(_0xdbc6('0x4'));router[_0xdbc6('0x5')]('/',auth[_0xdbc6('0x6')](),controller[_0xdbc6('0x7')]);router[_0xdbc6('0x5')](_0xdbc6('0x8'),auth[_0xdbc6('0x6')](),controller[_0xdbc6('0x9')]);router['get'](_0xdbc6('0xa'),auth[_0xdbc6('0x6')](),controller[_0xdbc6('0xb')]);router[_0xdbc6('0xc')]('/',auth[_0xdbc6('0x6')](),controller[_0xdbc6('0xd')]);router['put']('/:id',auth[_0xdbc6('0x6')](),controller[_0xdbc6('0xe')]);router[_0xdbc6('0xf')](_0xdbc6('0xa'),auth[_0xdbc6('0x6')](),controller['destroy']);module[_0xdbc6('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index c843a82..11daa0f 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 _0x14a0=['INTEGER','BOOLEAN','crudPermissions','join','getDataValue','split','exports','STRING'];(function(_0x1d0c98,_0x18d8a6){var _0x494266=function(_0xb50a2f){while(--_0xb50a2f){_0x1d0c98['push'](_0x1d0c98['shift']());}};_0x494266(++_0x18d8a6);}(_0x14a0,0x8e));var _0x014a=function(_0x21e254,_0x1371f3){_0x21e254=_0x21e254-0x0;var _0x1ee7d3=_0x14a0[_0x21e254];return _0x1ee7d3;};'use strict';var Sequelize=require('sequelize');module[_0x014a('0x0')]={'name':{'type':Sequelize[_0x014a('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x014a('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x014a('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x014a('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x014a('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x014a('0x1')],'set':function(_0x521a59){this['setDataValue'](_0x014a('0x4'),_0x521a59?_0x521a59[_0x014a('0x5')](''):[]);},'get':function(){return this[_0x014a('0x6')]('crudPermissions')?this['getDataValue'](_0x014a('0x4'))[_0x014a('0x7')](''):[];}}}; \ No newline at end of file +var _0x3c81=['join','getDataValue','sequelize','exports','STRING','INTEGER','setDataValue','crudPermissions'];(function(_0x3dbd12,_0x5e002b){var _0x6c7d18=function(_0x235778){while(--_0x235778){_0x3dbd12['push'](_0x3dbd12['shift']());}};_0x6c7d18(++_0x5e002b);}(_0x3c81,0x102));var _0x13c8=function(_0xd10c75,_0x239ff9){_0xd10c75=_0xd10c75-0x0;var _0x3f46ea=_0x3c81[_0xd10c75];return _0x3f46ea;};'use strict';var Sequelize=require(_0x13c8('0x0'));module[_0x13c8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x13c8('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x548599){this[_0x13c8('0x4')](_0x13c8('0x5'),_0x548599?_0x548599[_0x13c8('0x6')](''):[]);},'get':function(){return this[_0x13c8('0x7')](_0x13c8('0x5'))?this[_0x13c8('0x7')](_0x13c8('0x5'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index fc80789..049af0a 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 _0x7563=['util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','UserProfileSection','includeAll','include','findAll','rows','params','length','catch','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0xe155a1,_0x46f8e1){var _0x21e534=function(_0x22ebbb){while(--_0x22ebbb){_0xe155a1['push'](_0xe155a1['shift']());}};_0x21e534(++_0x46f8e1);}(_0x7563,0xde));var _0x3756=function(_0x389395,_0xf7b449){_0x389395=_0x389395-0x0;var _0x7b9ea7=_0x7563[_0x389395];return _0x7b9ea7;};'use strict';var emlformat=require(_0x3756('0x0'));var rimraf=require(_0x3756('0x1'));var zipdir=require(_0x3756('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3756('0x3'));var BPromise=require(_0x3756('0x4'));var Mustache=require(_0x3756('0x5'));var util=require(_0x3756('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3756('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3756('0x8'));var _=require(_0x3756('0x9'));var squel=require(_0x3756('0xa'));var crypto=require(_0x3756('0xb'));var jsforce=require(_0x3756('0xc'));var deskjs=require(_0x3756('0xd'));var toCsv=require(_0x3756('0x7'));var querystring=require(_0x3756('0xe'));var Papa=require(_0x3756('0xf'));var Redis=require(_0x3756('0x10'));var authService=require(_0x3756('0x11'));var qs=require(_0x3756('0x12'));var as=require(_0x3756('0x13'));var hardwareService=require(_0x3756('0x14'));var logger=require(_0x3756('0x15'))(_0x3756('0x16'));var utils=require(_0x3756('0x17'));var config=require(_0x3756('0x18'));var licenseUtil=require(_0x3756('0x19'));var db=require(_0x3756('0x1a'))['db'];function respondWithStatusCode(_0x3f9d72,_0x10d97d){_0x10d97d=_0x10d97d||0xcc;return function(_0x4e5dd3){if(_0x4e5dd3){return _0x3f9d72[_0x3756('0x1b')](_0x10d97d);}return _0x3f9d72[_0x3756('0x1c')](_0x10d97d)[_0x3756('0x1d')]();};}function respondWithResult(_0x5ec798,_0x38a7db){_0x38a7db=_0x38a7db||0xc8;return function(_0x46d7c4){if(_0x46d7c4){return _0x5ec798[_0x3756('0x1c')](_0x38a7db)[_0x3756('0x1e')](_0x46d7c4);}};}function respondWithFilteredResult(_0x3fbcc9,_0x204ea8){return function(_0x53482b){if(_0x53482b){var _0x48cad3=typeof _0x204ea8[_0x3756('0x1f')]===_0x3756('0x20')&&typeof _0x204ea8[_0x3756('0x21')]===_0x3756('0x20');var _0x1f4033=_0x53482b['count'];var _0x3a6455=_0x48cad3?0x0:_0x204ea8['offset'];var _0x2f8ac2=_0x48cad3?_0x53482b[_0x3756('0x22')]:_0x204ea8[_0x3756('0x1f')]+_0x204ea8['limit'];var _0x2a243e;if(_0x2f8ac2>=_0x1f4033){_0x2f8ac2=_0x1f4033;_0x2a243e=0xc8;}else{_0x2a243e=0xce;}_0x3fbcc9[_0x3756('0x1c')](_0x2a243e);return _0x3fbcc9[_0x3756('0x23')](_0x3756('0x24'),_0x3a6455+'-'+_0x2f8ac2+'/'+_0x1f4033)[_0x3756('0x1e')](_0x53482b);}return null;};}function patchUpdates(_0x4d8ca8){return function(_0x5da739){try{jsonpatch[_0x3756('0x25')](_0x5da739,_0x4d8ca8,!![]);}catch(_0x5a919e){return BPromise[_0x3756('0x26')](_0x5a919e);}return _0x5da739[_0x3756('0x27')]();};}function saveUpdates(_0x12ac80,_0x175aa6){return function(_0xcfda41){if(_0xcfda41){return _0xcfda41[_0x3756('0x28')](_0x12ac80)[_0x3756('0x29')](function(_0x3ea5ee){return _0x3ea5ee;});}return null;};}function removeEntity(_0x1d769b,_0x31eac6){return function(_0x24eeec){if(_0x24eeec){return _0x24eeec[_0x3756('0x2a')]()['then'](function(){_0x1d769b[_0x3756('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57fd76,_0x383385){return function(_0x29c079){if(!_0x29c079){_0x57fd76[_0x3756('0x1b')](0x194);}return _0x29c079;};}function handleError(_0x2f495e,_0x1fc71f){_0x1fc71f=_0x1fc71f||0x1f4;return function(_0x2b9586){logger['error'](_0x2b9586[_0x3756('0x2b')]);if(_0x2b9586[_0x3756('0x2c')]){delete _0x2b9586[_0x3756('0x2c')];}_0x2f495e[_0x3756('0x1c')](_0x1fc71f)[_0x3756('0x2d')](_0x2b9586);};}exports['index']=function(_0x5c9a9e,_0xeda97a){var _0x172e0b={},_0x4d4847={},_0x314fcc={'count':0x0,'rows':[]};var _0x2419b0=_[_0x3756('0x2e')](db['UserProfileSection'][_0x3756('0x2f')],function(_0x53976d){return{'name':_0x53976d[_0x3756('0x30')],'type':_0x53976d[_0x3756('0x31')][_0x3756('0x32')]};});_0x4d4847[_0x3756('0x33')]=_[_0x3756('0x2e')](_0x2419b0,'name');_0x4d4847[_0x3756('0x34')]=_[_0x3756('0x35')](_0x5c9a9e[_0x3756('0x34')]);_0x4d4847[_0x3756('0x36')]=_[_0x3756('0x37')](_0x4d4847[_0x3756('0x33')],_0x4d4847[_0x3756('0x34')]);_0x172e0b['attributes']=_[_0x3756('0x37')](_0x4d4847['model'],qs[_0x3756('0x38')](_0x5c9a9e[_0x3756('0x34')]['fields']));_0x172e0b[_0x3756('0x39')]=_0x172e0b[_0x3756('0x39')]['length']?_0x172e0b[_0x3756('0x39')]:_0x4d4847[_0x3756('0x33')];if(!_0x5c9a9e[_0x3756('0x34')][_0x3756('0x3a')]('nolimit')){_0x172e0b[_0x3756('0x21')]=qs['limit'](_0x5c9a9e[_0x3756('0x34')]['limit']);_0x172e0b[_0x3756('0x1f')]=qs[_0x3756('0x1f')](_0x5c9a9e[_0x3756('0x34')]['offset']);}_0x172e0b['order']=qs[_0x3756('0x3b')](_0x5c9a9e[_0x3756('0x34')][_0x3756('0x3b')]);_0x172e0b[_0x3756('0x3c')]=qs[_0x3756('0x36')](_[_0x3756('0x3d')](_0x5c9a9e[_0x3756('0x34')],_0x4d4847['filters']),_0x2419b0);if(_0x5c9a9e[_0x3756('0x34')][_0x3756('0x3e')]){_0x172e0b['where']=_[_0x3756('0x3f')](_0x172e0b['where'],{'$or':_[_0x3756('0x2e')](_0x2419b0,function(_0x1d8cdd){if(_0x1d8cdd[_0x3756('0x31')]!==_0x3756('0x40')){var _0x31d265={};_0x31d265[_0x1d8cdd[_0x3756('0x2c')]]={'$like':'%'+_0x5c9a9e['query'][_0x3756('0x3e')]+'%'};return _0x31d265;}})});}_0x172e0b=_[_0x3756('0x3f')]({},_0x172e0b,_0x5c9a9e[_0x3756('0x41')]);var _0x38e0c8={'where':_0x172e0b[_0x3756('0x3c')]};return db[_0x3756('0x42')][_0x3756('0x22')](_0x38e0c8)['then'](function(_0x43af8a){_0x314fcc[_0x3756('0x22')]=_0x43af8a;if(_0x5c9a9e[_0x3756('0x34')][_0x3756('0x43')]){_0x172e0b[_0x3756('0x44')]=[{'all':!![]}];}return db[_0x3756('0x42')][_0x3756('0x45')](_0x172e0b);})['then'](function(_0x2fdfa8){_0x314fcc[_0x3756('0x46')]=_0x2fdfa8;return _0x314fcc;})[_0x3756('0x29')](respondWithFilteredResult(_0xeda97a,_0x172e0b))['catch'](handleError(_0xeda97a,null));};exports['show']=function(_0x4629f9,_0x1897ba){var _0xfe1a0f={'raw':![],'where':{'id':_0x4629f9[_0x3756('0x47')]['id']}},_0x4c10f2={};_0x4c10f2[_0x3756('0x33')]=_[_0x3756('0x35')](db[_0x3756('0x42')][_0x3756('0x2f')]);_0x4c10f2[_0x3756('0x34')]=_['keys'](_0x4629f9[_0x3756('0x34')]);_0x4c10f2[_0x3756('0x36')]=_['intersection'](_0x4c10f2[_0x3756('0x33')],_0x4c10f2['query']);_0xfe1a0f[_0x3756('0x39')]=_[_0x3756('0x37')](_0x4c10f2[_0x3756('0x33')],qs['fields'](_0x4629f9[_0x3756('0x34')][_0x3756('0x38')]));_0xfe1a0f[_0x3756('0x39')]=_0xfe1a0f[_0x3756('0x39')][_0x3756('0x48')]?_0xfe1a0f[_0x3756('0x39')]:_0x4c10f2['model'];if(_0x4629f9['query'][_0x3756('0x43')]){_0xfe1a0f[_0x3756('0x44')]=[{'all':!![]}];}_0xfe1a0f=_['merge']({},_0xfe1a0f,_0x4629f9[_0x3756('0x41')]);return db[_0x3756('0x42')]['find'](_0xfe1a0f)['then'](handleEntityNotFound(_0x1897ba,null))['then'](respondWithResult(_0x1897ba,null))[_0x3756('0x49')](handleError(_0x1897ba,null));};exports[_0x3756('0x4a')]=function(_0x52bc5e,_0x505c46){return db[_0x3756('0x42')][_0x3756('0x4a')](_0x52bc5e['body'],{})[_0x3756('0x29')](respondWithResult(_0x505c46,0xc9))[_0x3756('0x49')](handleError(_0x505c46,null));};exports['update']=function(_0x1cc2c1,_0x580b2e){if(_0x1cc2c1[_0x3756('0x4b')]['id']){delete _0x1cc2c1[_0x3756('0x4b')]['id'];}return db[_0x3756('0x42')]['find']({'where':{'id':_0x1cc2c1[_0x3756('0x47')]['id']}})['then'](handleEntityNotFound(_0x580b2e,null))[_0x3756('0x29')](saveUpdates(_0x1cc2c1[_0x3756('0x4b')],null))['then'](respondWithResult(_0x580b2e,null))[_0x3756('0x49')](handleError(_0x580b2e,null));};exports[_0x3756('0x2a')]=function(_0x54d8bf,_0x5616f7){return db[_0x3756('0x42')]['find']({'where':{'id':_0x54d8bf['params']['id']}})[_0x3756('0x29')](handleEntityNotFound(_0x5616f7,null))['then'](removeEntity(_0x5616f7,null))[_0x3756('0x49')](handleError(_0x5616f7,null));};exports['describe']=function(_0x537b00,_0x59d2c0){return db[_0x3756('0x42')]['describe']()[_0x3756('0x29')](respondWithResult(_0x59d2c0,null))[_0x3756('0x49')](handleError(_0x59d2c0,null));}; \ No newline at end of file +var _0x9b4c=['reject','save','destroy','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','then','rows','catch','params','length','includeAll','find','create','body','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply'];(function(_0x4b26b5,_0x4f71fd){var _0x4dec71=function(_0x184329){while(--_0x184329){_0x4b26b5['push'](_0x4b26b5['shift']());}};_0x4dec71(++_0x4f71fd);}(_0x9b4c,0x76));var _0xc9b4=function(_0x41699c,_0x317092){_0x41699c=_0x41699c-0x0;var _0xb1e0ad=_0x9b4c[_0x41699c];return _0xb1e0ad;};'use strict';var emlformat=require(_0xc9b4('0x0'));var rimraf=require(_0xc9b4('0x1'));var zipdir=require(_0xc9b4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc9b4('0x3'));var moment=require(_0xc9b4('0x4'));var BPromise=require(_0xc9b4('0x5'));var Mustache=require(_0xc9b4('0x6'));var util=require(_0xc9b4('0x7'));var path=require(_0xc9b4('0x8'));var sox=require(_0xc9b4('0x9'));var csv=require('to-csv');var ejs=require(_0xc9b4('0xa'));var fs=require('fs');var fs_extra=require(_0xc9b4('0xb'));var _=require(_0xc9b4('0xc'));var squel=require('squel');var crypto=require(_0xc9b4('0xd'));var jsforce=require(_0xc9b4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc9b4('0xf'));var querystring=require('querystring');var Papa=require(_0xc9b4('0x10'));var Redis=require(_0xc9b4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc9b4('0x12'));var as=require(_0xc9b4('0x13'));var hardwareService=require(_0xc9b4('0x14'));var logger=require(_0xc9b4('0x15'))(_0xc9b4('0x16'));var utils=require(_0xc9b4('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bb80b,_0x435aed){_0x435aed=_0x435aed||0xcc;return function(_0x1657b1){if(_0x1657b1){return _0x3bb80b[_0xc9b4('0x18')](_0x435aed);}return _0x3bb80b['status'](_0x435aed)[_0xc9b4('0x19')]();};}function respondWithResult(_0x4877cd,_0x3dbcf5){_0x3dbcf5=_0x3dbcf5||0xc8;return function(_0x2e3909){if(_0x2e3909){return _0x4877cd['status'](_0x3dbcf5)[_0xc9b4('0x1a')](_0x2e3909);}};}function respondWithFilteredResult(_0x5742a1,_0x5b1742){return function(_0x85fea3){if(_0x85fea3){var _0x3de580=typeof _0x5b1742[_0xc9b4('0x1b')]===_0xc9b4('0x1c')&&typeof _0x5b1742[_0xc9b4('0x1d')]===_0xc9b4('0x1c');var _0x57b789=_0x85fea3[_0xc9b4('0x1e')];var _0x1602f1=_0x3de580?0x0:_0x5b1742['offset'];var _0x26ecd9=_0x3de580?_0x85fea3['count']:_0x5b1742['offset']+_0x5b1742['limit'];var _0x262029;if(_0x26ecd9>=_0x57b789){_0x26ecd9=_0x57b789;_0x262029=0xc8;}else{_0x262029=0xce;}_0x5742a1[_0xc9b4('0x1f')](_0x262029);return _0x5742a1['set'](_0xc9b4('0x20'),_0x1602f1+'-'+_0x26ecd9+'/'+_0x57b789)[_0xc9b4('0x1a')](_0x85fea3);}return null;};}function patchUpdates(_0x100994){return function(_0x972ddd){try{jsonpatch[_0xc9b4('0x21')](_0x972ddd,_0x100994,!![]);}catch(_0x8737f8){return BPromise[_0xc9b4('0x22')](_0x8737f8);}return _0x972ddd[_0xc9b4('0x23')]();};}function saveUpdates(_0x5f44e1,_0x79daed){return function(_0x59fc3c){if(_0x59fc3c){return _0x59fc3c['update'](_0x5f44e1)['then'](function(_0x46adfc){return _0x46adfc;});}return null;};}function removeEntity(_0x403863,_0x47bb7d){return function(_0x1bc921){if(_0x1bc921){return _0x1bc921[_0xc9b4('0x24')]()['then'](function(){_0x403863[_0xc9b4('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3491c9,_0x5a438c){return function(_0x513e84){if(!_0x513e84){_0x3491c9['sendStatus'](0x194);}return _0x513e84;};}function handleError(_0x54992f,_0x29eebf){_0x29eebf=_0x29eebf||0x1f4;return function(_0x47a8c2){logger['error'](_0x47a8c2[_0xc9b4('0x25')]);if(_0x47a8c2[_0xc9b4('0x26')]){delete _0x47a8c2['name'];}_0x54992f[_0xc9b4('0x1f')](_0x29eebf)[_0xc9b4('0x27')](_0x47a8c2);};}exports[_0xc9b4('0x28')]=function(_0x6836a8,_0x66e187){var _0x3c5276={},_0xd30dd9={},_0x4aabf5={'count':0x0,'rows':[]};var _0x3a8242=_[_0xc9b4('0x29')](db[_0xc9b4('0x2a')][_0xc9b4('0x2b')],function(_0x2b956f){return{'name':_0x2b956f[_0xc9b4('0x2c')],'type':_0x2b956f[_0xc9b4('0x2d')][_0xc9b4('0x2e')]};});_0xd30dd9[_0xc9b4('0x2f')]=_[_0xc9b4('0x29')](_0x3a8242,'name');_0xd30dd9[_0xc9b4('0x30')]=_[_0xc9b4('0x31')](_0x6836a8['query']);_0xd30dd9[_0xc9b4('0x32')]=_[_0xc9b4('0x33')](_0xd30dd9[_0xc9b4('0x2f')],_0xd30dd9[_0xc9b4('0x30')]);_0x3c5276[_0xc9b4('0x34')]=_[_0xc9b4('0x33')](_0xd30dd9[_0xc9b4('0x2f')],qs[_0xc9b4('0x35')](_0x6836a8[_0xc9b4('0x30')]['fields']));_0x3c5276[_0xc9b4('0x34')]=_0x3c5276[_0xc9b4('0x34')]['length']?_0x3c5276[_0xc9b4('0x34')]:_0xd30dd9[_0xc9b4('0x2f')];if(!_0x6836a8[_0xc9b4('0x30')][_0xc9b4('0x36')](_0xc9b4('0x37'))){_0x3c5276[_0xc9b4('0x1d')]=qs['limit'](_0x6836a8[_0xc9b4('0x30')]['limit']);_0x3c5276['offset']=qs[_0xc9b4('0x1b')](_0x6836a8['query'][_0xc9b4('0x1b')]);}_0x3c5276['order']=qs[_0xc9b4('0x38')](_0x6836a8[_0xc9b4('0x30')][_0xc9b4('0x38')]);_0x3c5276['where']=qs[_0xc9b4('0x32')](_[_0xc9b4('0x39')](_0x6836a8[_0xc9b4('0x30')],_0xd30dd9[_0xc9b4('0x32')]),_0x3a8242);if(_0x6836a8[_0xc9b4('0x30')]['filter']){_0x3c5276[_0xc9b4('0x3a')]=_[_0xc9b4('0x3b')](_0x3c5276[_0xc9b4('0x3a')],{'$or':_[_0xc9b4('0x29')](_0x3a8242,function(_0x3f48ff){if(_0x3f48ff[_0xc9b4('0x2d')]!==_0xc9b4('0x3c')){var _0x1a53e8={};_0x1a53e8[_0x3f48ff[_0xc9b4('0x26')]]={'$like':'%'+_0x6836a8[_0xc9b4('0x30')][_0xc9b4('0x3d')]+'%'};return _0x1a53e8;}})});}_0x3c5276=_[_0xc9b4('0x3b')]({},_0x3c5276,_0x6836a8[_0xc9b4('0x3e')]);var _0x83754f={'where':_0x3c5276[_0xc9b4('0x3a')]};return db[_0xc9b4('0x2a')][_0xc9b4('0x1e')](_0x83754f)['then'](function(_0x5398bb){_0x4aabf5[_0xc9b4('0x1e')]=_0x5398bb;if(_0x6836a8[_0xc9b4('0x30')]['includeAll']){_0x3c5276[_0xc9b4('0x3f')]=[{'all':!![]}];}return db[_0xc9b4('0x2a')][_0xc9b4('0x40')](_0x3c5276);})[_0xc9b4('0x41')](function(_0x305989){_0x4aabf5[_0xc9b4('0x42')]=_0x305989;return _0x4aabf5;})[_0xc9b4('0x41')](respondWithFilteredResult(_0x66e187,_0x3c5276))[_0xc9b4('0x43')](handleError(_0x66e187,null));};exports['show']=function(_0x4ee6ed,_0x46ccae){var _0x59507a={'raw':![],'where':{'id':_0x4ee6ed[_0xc9b4('0x44')]['id']}},_0x304b79={};_0x304b79[_0xc9b4('0x2f')]=_['keys'](db['UserProfileSection'][_0xc9b4('0x2b')]);_0x304b79[_0xc9b4('0x30')]=_['keys'](_0x4ee6ed[_0xc9b4('0x30')]);_0x304b79[_0xc9b4('0x32')]=_[_0xc9b4('0x33')](_0x304b79['model'],_0x304b79[_0xc9b4('0x30')]);_0x59507a[_0xc9b4('0x34')]=_[_0xc9b4('0x33')](_0x304b79[_0xc9b4('0x2f')],qs['fields'](_0x4ee6ed[_0xc9b4('0x30')][_0xc9b4('0x35')]));_0x59507a[_0xc9b4('0x34')]=_0x59507a[_0xc9b4('0x34')][_0xc9b4('0x45')]?_0x59507a['attributes']:_0x304b79[_0xc9b4('0x2f')];if(_0x4ee6ed[_0xc9b4('0x30')][_0xc9b4('0x46')]){_0x59507a[_0xc9b4('0x3f')]=[{'all':!![]}];}_0x59507a=_[_0xc9b4('0x3b')]({},_0x59507a,_0x4ee6ed[_0xc9b4('0x3e')]);return db[_0xc9b4('0x2a')][_0xc9b4('0x47')](_0x59507a)[_0xc9b4('0x41')](handleEntityNotFound(_0x46ccae,null))[_0xc9b4('0x41')](respondWithResult(_0x46ccae,null))[_0xc9b4('0x43')](handleError(_0x46ccae,null));};exports[_0xc9b4('0x48')]=function(_0x2116a8,_0x21a65e){return db[_0xc9b4('0x2a')][_0xc9b4('0x48')](_0x2116a8[_0xc9b4('0x49')],{})['then'](respondWithResult(_0x21a65e,0xc9))[_0xc9b4('0x43')](handleError(_0x21a65e,null));};exports[_0xc9b4('0x4a')]=function(_0x16b737,_0x1a0a2a){if(_0x16b737[_0xc9b4('0x49')]['id']){delete _0x16b737[_0xc9b4('0x49')]['id'];}return db[_0xc9b4('0x2a')][_0xc9b4('0x47')]({'where':{'id':_0x16b737[_0xc9b4('0x44')]['id']}})['then'](handleEntityNotFound(_0x1a0a2a,null))[_0xc9b4('0x41')](saveUpdates(_0x16b737[_0xc9b4('0x49')],null))[_0xc9b4('0x41')](respondWithResult(_0x1a0a2a,null))[_0xc9b4('0x43')](handleError(_0x1a0a2a,null));};exports[_0xc9b4('0x24')]=function(_0x4e96a8,_0x41410f){return db[_0xc9b4('0x2a')][_0xc9b4('0x47')]({'where':{'id':_0x4e96a8[_0xc9b4('0x44')]['id']}})[_0xc9b4('0x41')](handleEntityNotFound(_0x41410f,null))[_0xc9b4('0x41')](removeEntity(_0x41410f,null))['catch'](handleError(_0x41410f,null));};exports['describe']=function(_0x3a19a2,_0x4be8d8){return db[_0xc9b4('0x2a')][_0xc9b4('0x4b')]()['then'](respondWithResult(_0x4be8d8,null))['catch'](handleError(_0x4be8d8,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 20e8acc..7a06186 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 _0x5dd6=['../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x2f8a26,_0xa515e4){var _0x40366b=function(_0x59291e){while(--_0x59291e){_0x2f8a26['push'](_0x2f8a26['shift']());}};_0x40366b(++_0xa515e4);}(_0x5dd6,0x94));var _0x65dd=function(_0x358927,_0x1eee11){_0x358927=_0x358927-0x0;var _0x4d5873=_0x5dd6[_0x358927];return _0x4d5873;};'use strict';var _=require(_0x65dd('0x0'));var util=require(_0x65dd('0x1'));var logger=require(_0x65dd('0x2'))(_0x65dd('0x3'));var moment=require('moment');var BPromise=require(_0x65dd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x65dd('0x5'));var rimraf=require('rimraf');var config=require(_0x65dd('0x6'));var attributes=require(_0x65dd('0x7'));module['exports']=function(_0x5749c4,_0x37abae){return _0x5749c4[_0x65dd('0x8')](_0x65dd('0x9'),attributes,{'tableName':_0x65dd('0xa'),'paranoid':![],'indexes':[{'name':_0x65dd('0xb'),'fields':[_0x65dd('0xc'),_0x65dd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5cef=['request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','api','bluebird'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x5cef,0x130));var _0xf5ce=function(_0x2cf86e,_0x355cd7){_0x2cf86e=_0x2cf86e-0x0;var _0x31a08f=_0x5cef[_0x2cf86e];return _0x31a08f;};'use strict';var _=require(_0xf5ce('0x0'));var util=require(_0xf5ce('0x1'));var logger=require('../../config/logger')(_0xf5ce('0x2'));var moment=require('moment');var BPromise=require(_0xf5ce('0x3'));var rp=require(_0xf5ce('0x4'));var fs=require('fs');var path=require(_0xf5ce('0x5'));var rimraf=require(_0xf5ce('0x6'));var config=require(_0xf5ce('0x7'));var attributes=require(_0xf5ce('0x8'));module[_0xf5ce('0x9')]=function(_0x38a252,_0x1057d5){return _0x38a252['define']('UserProfileSection',attributes,{'tableName':_0xf5ce('0xa'),'paranoid':![],'indexes':[{'name':_0xf5ce('0xb'),'fields':[_0xf5ce('0xc'),_0xf5ce('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index f8657c6..2379331 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 _0x1c6e=['error','code','UserProfileSection,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1c6e,0x79));var _0xe1c6=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x1c6e[_0x4e6ae6];return _0x23c108;};'use strict';var _=require(_0xe1c6('0x0'));var util=require(_0xe1c6('0x1'));var moment=require(_0xe1c6('0x2'));var BPromise=require('bluebird');var rs=require(_0xe1c6('0x3'));var fs=require('fs');var Redis=require(_0xe1c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe1c6('0x5'));var logger=require(_0xe1c6('0x6'))(_0xe1c6('0x7'));var config=require('../../config/environment');var jayson=require(_0xe1c6('0x8'));var client=jayson[_0xe1c6('0x9')][_0xe1c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6869a2,_0x43cd49,_0x37c384){return new BPromise(function(_0x8a4ea5,_0x4699be){return client[_0xe1c6('0xb')](_0x6869a2,_0x37c384)[_0xe1c6('0xc')](function(_0x315731){logger[_0xe1c6('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x43cd49,'request\x20sent');logger[_0xe1c6('0xe')](_0xe1c6('0xf'),_0x43cd49,'request\x20sent',JSON[_0xe1c6('0x10')](_0x315731));if(_0x315731[_0xe1c6('0x11')]){if(_0x315731[_0xe1c6('0x11')][_0xe1c6('0x12')]===0x1f4){logger[_0xe1c6('0x11')](_0xe1c6('0x13'),_0x43cd49,_0x315731[_0xe1c6('0x11')][_0xe1c6('0x14')]);return _0x4699be(_0x315731[_0xe1c6('0x11')][_0xe1c6('0x14')]);}logger[_0xe1c6('0x11')](_0xe1c6('0x13'),_0x43cd49,_0x315731['error'][_0xe1c6('0x14')]);return _0x8a4ea5(_0x315731[_0xe1c6('0x11')][_0xe1c6('0x14')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x43cd49,_0xe1c6('0x15'));_0x8a4ea5(_0x315731[_0xe1c6('0x16')][_0xe1c6('0x14')]);}})['catch'](function(_0x33486e){logger[_0xe1c6('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x43cd49,_0x33486e);_0x4699be(_0x33486e);});});} \ No newline at end of file +var _0xd064=['message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2ad57b,_0x4be494){var _0x463b09=function(_0x47229d){while(--_0x47229d){_0x2ad57b['push'](_0x2ad57b['shift']());}};_0x463b09(++_0x4be494);}(_0xd064,0xe8));var _0x4d06=function(_0x4733d3,_0x454290){_0x4733d3=_0x4733d3-0x0;var _0x1b9a44=_0xd064[_0x4733d3];return _0x1b9a44;};'use strict';var _=require(_0x4d06('0x0'));var util=require(_0x4d06('0x1'));var moment=require('moment');var BPromise=require(_0x4d06('0x2'));var rs=require(_0x4d06('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d06('0x4'))['db'];var utils=require(_0x4d06('0x5'));var logger=require(_0x4d06('0x6'))(_0x4d06('0x7'));var config=require(_0x4d06('0x8'));var jayson=require(_0x4d06('0x9'));var client=jayson[_0x4d06('0xa')][_0x4d06('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ffe3f,_0x545621,_0x179fb0){return new BPromise(function(_0x366374,_0x8e9961){return client[_0x4d06('0xc')](_0x2ffe3f,_0x179fb0)[_0x4d06('0xd')](function(_0x751a06){logger[_0x4d06('0xe')](_0x4d06('0xf'),_0x545621,_0x4d06('0x10'));logger['debug'](_0x4d06('0x11'),_0x545621,_0x4d06('0x10'),JSON[_0x4d06('0x12')](_0x751a06));if(_0x751a06[_0x4d06('0x13')]){if(_0x751a06['error'][_0x4d06('0x14')]===0x1f4){logger[_0x4d06('0x13')](_0x4d06('0xf'),_0x545621,_0x751a06[_0x4d06('0x13')][_0x4d06('0x15')]);return _0x8e9961(_0x751a06[_0x4d06('0x13')][_0x4d06('0x15')]);}logger[_0x4d06('0x13')](_0x4d06('0xf'),_0x545621,_0x751a06[_0x4d06('0x13')][_0x4d06('0x15')]);return _0x366374(_0x751a06['error'][_0x4d06('0x15')]);}else{logger[_0x4d06('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x545621,_0x4d06('0x10'));_0x366374(_0x751a06['result'][_0x4d06('0x15')]);}})[_0x4d06('0x16')](function(_0x4b4115){logger[_0x4d06('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x545621,_0x4b4115);_0x8e9961(_0x4b4115);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 0025b18..09c01ba 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x398a29,_0x50e5d7){var _0x163832=function(_0x10c318){while(--_0x10c318){_0x398a29['push'](_0x398a29['shift']());}};_0x163832(++_0x50e5d7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0xcb91[_0x251e8c];return _0x1e0c1d;};'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(_0xe8fd91,_0x25ebca){var _0x334a0d=function(_0xbaa345){while(--_0xbaa345){_0xe8fd91['push'](_0xe8fd91['shift']());}};_0x334a0d(++_0x25ebca);}(_0x70e0,0x17b));var _0x070e=function(_0x5079cb,_0x3d6f56){_0x5079cb=_0x5079cb-0x0;var _0x343a28=_0x70e0[_0x5079cb];return _0x343a28;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 002cedb..b58f988 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 _0xb3dd=['sequelize','exports'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0xb3dd,0xce));var _0xdb3d=function(_0x2a7751,_0x316064){_0x2a7751=_0x2a7751-0x0;var _0x4b4c02=_0xb3dd[_0x2a7751];return _0x4b4c02;};'use strict';var Sequelize=require(_0xdb3d('0x0'));module[_0xdb3d('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xff19=['sequelize','exports'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xff19,0x100));var _0x9ff1=function(_0x4a2c0d,_0x22bab5){_0x4a2c0d=_0x4a2c0d-0x0;var _0x37e6e2=_0xff19[_0x4a2c0d];return _0x37e6e2;};'use strict';var Sequelize=require(_0x9ff1('0x0'));module[_0x9ff1('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 9421035..1550702 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 _0xe3da=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','lodash'];(function(_0x20be28,_0x24b925){var _0x8ab067=function(_0x314de9){while(--_0x314de9){_0x20be28['push'](_0x20be28['shift']());}};_0x8ab067(++_0x24b925);}(_0xe3da,0x1cd));var _0xae3d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe3da[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));module[_0xae3d('0xb')]=function(_0xa9a1a,_0xa54808){return _0xa9a1a[_0xae3d('0xc')](_0xae3d('0xd'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','define','user_has_sms_queues','lodash'];(function(_0x2e72b5,_0x396e41){var _0x3439ea=function(_0x1c4180){while(--_0x1c4180){_0x2e72b5['push'](_0x2e72b5['shift']());}};_0x3439ea(++_0x396e41);}(_0x5496,0x175));var _0x6549=function(_0x31cef2,_0x5f57cf){_0x31cef2=_0x31cef2-0x0;var _0x51d6fc=_0x5496[_0x31cef2];return _0x51d6fc;};'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')]('UserSmsQueue',attributes,{'tableName':_0x6549('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 c20f95b..f9bf99c 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 _0xb094=['UserSmsQueue,\x20%s,\x20%s','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','client','http','request','then','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0xb094,0x8e));var _0x4b09=function(_0x3482ca,_0x84bd61){_0x3482ca=_0x3482ca-0x0;var _0x4956ac=_0xb094[_0x3482ca];return _0x4956ac;};'use strict';var _=require(_0x4b09('0x0'));var util=require(_0x4b09('0x1'));var moment=require('moment');var BPromise=require(_0x4b09('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b09('0x3'));var db=require(_0x4b09('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4b09('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4b09('0x6')][_0x4b09('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x45b388,_0x5b46e6,_0xd15792){return new BPromise(function(_0x2e4222,_0x5ae7c){return client[_0x4b09('0x8')](_0x45b388,_0xd15792)[_0x4b09('0x9')](function(_0x4a3cc8){logger[_0x4b09('0xa')]('UserSmsQueue,\x20%s,\x20%s',_0x5b46e6,'request\x20sent');logger[_0x4b09('0xb')](_0x4b09('0xc'),_0x5b46e6,_0x4b09('0xd'),JSON[_0x4b09('0xe')](_0x4a3cc8));if(_0x4a3cc8[_0x4b09('0xf')]){if(_0x4a3cc8[_0x4b09('0xf')][_0x4b09('0x10')]===0x1f4){logger[_0x4b09('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x5b46e6,_0x4a3cc8[_0x4b09('0xf')]['message']);return _0x5ae7c(_0x4a3cc8['error'][_0x4b09('0x11')]);}logger[_0x4b09('0xf')](_0x4b09('0x12'),_0x5b46e6,_0x4a3cc8['error'][_0x4b09('0x11')]);return _0x2e4222(_0x4a3cc8[_0x4b09('0xf')]['message']);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x5b46e6,_0x4b09('0xd'));_0x2e4222(_0x4a3cc8['result']['message']);}})[_0x4b09('0x13')](function(_0x1c1031){logger['error'](_0x4b09('0x12'),_0x5b46e6,_0x1c1031);_0x5ae7c(_0x1c1031);});});} \ No newline at end of file +var _0x0f34=['message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','error','code'];(function(_0x3287bc,_0x141abb){var _0x3ed835=function(_0xa7e825){while(--_0xa7e825){_0x3287bc['push'](_0x3287bc['shift']());}};_0x3ed835(++_0x141abb);}(_0x0f34,0x158));var _0x40f3=function(_0xc08f00,_0x28067f){_0xc08f00=_0xc08f00-0x0;var _0x8649f7=_0x0f34[_0xc08f00];return _0x8649f7;};'use strict';var _=require(_0x40f3('0x0'));var util=require(_0x40f3('0x1'));var moment=require(_0x40f3('0x2'));var BPromise=require(_0x40f3('0x3'));var rs=require(_0x40f3('0x4'));var fs=require('fs');var Redis=require(_0x40f3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x40f3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x40f3('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x40f3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48131d,_0x1f033b,_0x2ebe98){return new BPromise(function(_0x55549c,_0x2a8226){return client[_0x40f3('0x9')](_0x48131d,_0x2ebe98)[_0x40f3('0xa')](function(_0x554dcb){logger[_0x40f3('0xb')](_0x40f3('0xc'),_0x1f033b,'request\x20sent');logger[_0x40f3('0xd')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x1f033b,'request\x20sent',JSON['stringify'](_0x554dcb));if(_0x554dcb[_0x40f3('0xe')]){if(_0x554dcb[_0x40f3('0xe')][_0x40f3('0xf')]===0x1f4){logger[_0x40f3('0xe')](_0x40f3('0xc'),_0x1f033b,_0x554dcb[_0x40f3('0xe')][_0x40f3('0x10')]);return _0x2a8226(_0x554dcb['error'][_0x40f3('0x10')]);}logger[_0x40f3('0xe')](_0x40f3('0xc'),_0x1f033b,_0x554dcb[_0x40f3('0xe')]['message']);return _0x55549c(_0x554dcb[_0x40f3('0xe')][_0x40f3('0x10')]);}else{logger[_0x40f3('0xb')](_0x40f3('0xc'),_0x1f033b,_0x40f3('0x11'));_0x55549c(_0x554dcb[_0x40f3('0x12')][_0x40f3('0x10')]);}})[_0x40f3('0x13')](function(_0x1fc29e){logger[_0x40f3('0xe')](_0x40f3('0xc'),_0x1f033b,_0x1fc29e);_0x2a8226(_0x1fc29e);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index b423b65..a98670c 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x449fb0,_0xf691a2){var _0x10bb91=function(_0x86e613){while(--_0x86e613){_0x449fb0['push'](_0x449fb0['shift']());}};_0x10bb91(++_0xf691a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x33de79,_0x51888f){var _0x1932fa=function(_0x3824c3){while(--_0x3824c3){_0x33de79['push'](_0x33de79['shift']());}};_0x1932fa(++_0x51888f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 9006424..dfb791b 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5fd6=['INTEGER'];(function(_0x597a3a,_0x4eea1f){var _0x29002f=function(_0x38c25f){while(--_0x38c25f){_0x597a3a['push'](_0x597a3a['shift']());}};_0x29002f(++_0x4eea1f);}(_0x5fd6,0x16a));var _0x65fd=function(_0x5daa92,_0x2fd69e){_0x5daa92=_0x5daa92-0x0;var _0x2d6b27=_0x5fd6[_0x5daa92];return _0x2d6b27;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x65fd('0x0')],'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 fcf06ca..2b18749 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 _0x9a1e=['path','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2b0d37,_0x2b3ec9){var _0x97495f=function(_0x3214f1){while(--_0x3214f1){_0x2b0d37['push'](_0x2b0d37['shift']());}};_0x97495f(++_0x2b3ec9);}(_0x9a1e,0x9f));var _0xe9a1=function(_0x163f41,_0x2adbd6){_0x163f41=_0x163f41-0x0;var _0x4d6721=_0x9a1e[_0x163f41];return _0x4d6721;};'use strict';var _=require(_0xe9a1('0x0'));var util=require(_0xe9a1('0x1'));var logger=require(_0xe9a1('0x2'))(_0xe9a1('0x3'));var moment=require(_0xe9a1('0x4'));var BPromise=require(_0xe9a1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9a1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe9a1('0x7'));module['exports']=function(_0x11e42a,_0x261aba){return _0x11e42a[_0xe9a1('0x8')](_0xe9a1('0x9'),attributes,{'tableName':_0xe9a1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc97f=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','lodash'];(function(_0x258b93,_0x188ccc){var _0x35484b=function(_0x2563ea){while(--_0x2563ea){_0x258b93['push'](_0x258b93['shift']());}};_0x35484b(++_0x188ccc);}(_0xc97f,0x107));var _0xfc97=function(_0x5cd318,_0x3cf18c){_0x5cd318=_0x5cd318-0x0;var _0x380cba=_0xc97f[_0x5cd318];return _0x380cba;};'use strict';var _=require(_0xfc97('0x0'));var util=require(_0xfc97('0x1'));var logger=require(_0xfc97('0x2'))('api');var moment=require(_0xfc97('0x3'));var BPromise=require('bluebird');var rp=require(_0xfc97('0x4'));var fs=require('fs');var path=require(_0xfc97('0x5'));var rimraf=require(_0xfc97('0x6'));var config=require(_0xfc97('0x7'));var attributes=require(_0xfc97('0x8'));module[_0xfc97('0x9')]=function(_0x32c42a,_0x5e88ac){return _0x32c42a['define'](_0xfc97('0xa'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 30f17d1..8ec227d 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 _0x1eb0=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserVoiceQueue,\x20%s,\x20%s'];(function(_0xb438fa,_0x1bd698){var _0x2f02a3=function(_0x1cdb45){while(--_0x1cdb45){_0xb438fa['push'](_0xb438fa['shift']());}};_0x2f02a3(++_0x1bd698);}(_0x1eb0,0x1a9));var _0x01eb=function(_0x2ef111,_0x54ee51){_0x2ef111=_0x2ef111-0x0;var _0x881a20=_0x1eb0[_0x2ef111];return _0x881a20;};'use strict';var _=require(_0x01eb('0x0'));var util=require(_0x01eb('0x1'));var moment=require(_0x01eb('0x2'));var BPromise=require(_0x01eb('0x3'));var rs=require(_0x01eb('0x4'));var fs=require('fs');var Redis=require(_0x01eb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x01eb('0x6'));var logger=require(_0x01eb('0x7'))(_0x01eb('0x8'));var config=require(_0x01eb('0x9'));var jayson=require(_0x01eb('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25cb80,_0x91887e,_0x1a1359){return new BPromise(function(_0x4de53e,_0x36edd4){return client[_0x01eb('0xb')](_0x25cb80,_0x1a1359)[_0x01eb('0xc')](function(_0x1a5cfc){logger[_0x01eb('0xd')](_0x01eb('0xe'),_0x91887e,'request\x20sent');logger['debug'](_0x01eb('0xf'),_0x91887e,_0x01eb('0x10'),JSON[_0x01eb('0x11')](_0x1a5cfc));if(_0x1a5cfc[_0x01eb('0x12')]){if(_0x1a5cfc[_0x01eb('0x12')]['code']===0x1f4){logger['error'](_0x01eb('0xe'),_0x91887e,_0x1a5cfc['error']['message']);return _0x36edd4(_0x1a5cfc[_0x01eb('0x12')][_0x01eb('0x13')]);}logger[_0x01eb('0x12')](_0x01eb('0xe'),_0x91887e,_0x1a5cfc[_0x01eb('0x12')]['message']);return _0x4de53e(_0x1a5cfc[_0x01eb('0x12')][_0x01eb('0x13')]);}else{logger[_0x01eb('0xd')](_0x01eb('0xe'),_0x91887e,'request\x20sent');_0x4de53e(_0x1a5cfc[_0x01eb('0x14')][_0x01eb('0x13')]);}})[_0x01eb('0x15')](function(_0x4f1aa9){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x91887e,_0x4f1aa9);_0x36edd4(_0x4f1aa9);});});} \ No newline at end of file +var _0xe3da=['randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird'];(function(_0x5e099c,_0x32cade){var _0x10d92c=function(_0x2374ea){while(--_0x2374ea){_0x5e099c['push'](_0x5e099c['shift']());}};_0x10d92c(++_0x32cade);}(_0xe3da,0x1b5));var _0xae3d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe3da[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xae3d('0x5'))(_0xae3d('0x6'));var config=require(_0xae3d('0x7'));var jayson=require(_0xae3d('0x8'));var client=jayson[_0xae3d('0x9')][_0xae3d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cf981,_0x118c7d,_0xfe441c){return new BPromise(function(_0x198b48,_0x158c0b){return client[_0xae3d('0xb')](_0x3cf981,_0xfe441c)['then'](function(_0x54f402){logger[_0xae3d('0xc')](_0xae3d('0xd'),_0x118c7d,_0xae3d('0xe'));logger[_0xae3d('0xf')](_0xae3d('0x10'),_0x118c7d,'request\x20sent',JSON[_0xae3d('0x11')](_0x54f402));if(_0x54f402[_0xae3d('0x12')]){if(_0x54f402[_0xae3d('0x12')]['code']===0x1f4){logger[_0xae3d('0x12')](_0xae3d('0xd'),_0x118c7d,_0x54f402[_0xae3d('0x12')]['message']);return _0x158c0b(_0x54f402[_0xae3d('0x12')]['message']);}logger[_0xae3d('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x118c7d,_0x54f402[_0xae3d('0x12')][_0xae3d('0x13')]);return _0x198b48(_0x54f402[_0xae3d('0x12')][_0xae3d('0x13')]);}else{logger[_0xae3d('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x118c7d,_0xae3d('0xe'));_0x198b48(_0x54f402[_0xae3d('0x14')][_0xae3d('0x13')]);}})['catch'](function(_0xbf453c){logger[_0xae3d('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x118c7d,_0xbf453c);_0x158c0b(_0xbf453c);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 2f53fe3..25dae18 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x24f121,_0xff3e08){var _0x2a6672=function(_0x4e2b6e){while(--_0x4e2b6e){_0x24f121['push'](_0x24f121['shift']());}};_0x2a6672(++_0xff3e08);}(_0x70e0,0x17b));var _0x070e=function(_0xe2a966,_0x137f4b){_0xe2a966=_0xe2a966-0x0;var _0x1010be=_0x70e0[_0xe2a966];return _0x1010be;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x203d5a,_0x549fb2){var _0x362a83=function(_0x203dfa){while(--_0x203dfa){_0x203d5a['push'](_0x203d5a['shift']());}};_0x362a83(++_0x549fb2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4cce65,_0x40021e){_0x4cce65=_0x4cce65-0x0;var _0x4d1b45=_0xcb91[_0x4cce65];return _0x4d1b45;};'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 ce52f86..bdec9d2 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 _0xfa49=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x455fc8,_0xe5f899){var _0x266ad3=function(_0xb25dd0){while(--_0xb25dd0){_0x455fc8['push'](_0x455fc8['shift']());}};_0x266ad3(++_0xe5f899);}(_0xfa49,0x12c));var _0x9fa4=function(_0x35bff4,_0x319274){_0x35bff4=_0x35bff4-0x0;var _0x5b7353=_0xfa49[_0x35bff4];return _0x5b7353;};'use strict';var Sequelize=require(_0x9fa4('0x0'));module[_0x9fa4('0x1')]={'uniqueid':{'type':Sequelize[_0x9fa4('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x9fa4('0x3')},'membername':{'type':Sequelize[_0x9fa4('0x4')],'allowNull':![],'comment':_0x9fa4('0x3')},'UserId':{'type':Sequelize[_0x9fa4('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9fa4('0x5'),'comment':_0x9fa4('0x3')},'VoiceQueueId':{'type':Sequelize[_0x9fa4('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x9fa4('0x4')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x9fa4('0x2')](0xb),'defaultValue':0x0,'comment':_0x9fa4('0x3')},'paused':{'type':Sequelize[_0x9fa4('0x2')](0xb),'defaultValue':0x0,'comment':_0x9fa4('0x3')}}; \ No newline at end of file +var _0x1724=['INTEGER','sequelize','exports','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x49b66d,_0x254821){var _0x452e3b=function(_0x5e5aae){while(--_0x5e5aae){_0x49b66d['push'](_0x49b66d['shift']());}};_0x452e3b(++_0x254821);}(_0x1724,0x7f));var _0x4172=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x1724[_0x1e7b16];return _0x37fadc;};'use strict';var Sequelize=require(_0x4172('0x0'));module[_0x4172('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x4172('0x2')},'membername':{'type':Sequelize[_0x4172('0x3')],'allowNull':![],'comment':_0x4172('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x4172('0x3')],'allowNull':![],'unique':_0x4172('0x4'),'comment':_0x4172('0x2')},'VoiceQueueId':{'type':Sequelize[_0x4172('0x5')],'allowNull':![]},'interface':{'type':Sequelize[_0x4172('0x3')],'allowNull':![],'unique':_0x4172('0x4'),'comment':_0x4172('0x2')},'penalty':{'type':Sequelize[_0x4172('0x5')](0xb),'defaultValue':0x0,'comment':_0x4172('0x2')},'paused':{'type':Sequelize[_0x4172('0x5')](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 fccc579..c870deb 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 _0xe67b=['save','update','emit','hasOwnProperty','exports','../../mysqldb','UserVoiceQueueRt'];(function(_0x3a5d58,_0xb40160){var _0x1a40dd=function(_0x1ac2a5){while(--_0x1ac2a5){_0x3a5d58['push'](_0x3a5d58['shift']());}};_0x1a40dd(++_0xb40160);}(_0xe67b,0xf3));var _0xbe67=function(_0xe30e17,_0xce02be){_0xe30e17=_0xe30e17-0x0;var _0x2342c9=_0xe67b[_0xe30e17];return _0x2342c9;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xbe67('0x0'))['db'][_0xbe67('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe67('0x2'),'afterUpdate':_0xbe67('0x3'),'afterDestroy':'remove'};function emitEvent(_0x161ca6){return function(_0x50463f,_0x80278c,_0x305146){UserVoiceQueueRtEvents[_0xbe67('0x4')](_0x161ca6+':'+_0x50463f['id'],_0x50463f);UserVoiceQueueRtEvents['emit'](_0x161ca6,_0x50463f);_0x305146(null);};}for(var e in events){if(events[_0xbe67('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xbe67('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x94c5=['hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x4c6eaa,_0x391f8b){var _0x403439=function(_0x3dd4e7){while(--_0x3dd4e7){_0x4c6eaa['push'](_0x4c6eaa['shift']());}};_0x403439(++_0x391f8b);}(_0x94c5,0x17c));var _0x594c=function(_0x4597b8,_0x71e429){_0x4597b8=_0x4597b8-0x0;var _0x4fde9b=_0x94c5[_0x4597b8];return _0x4fde9b;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x594c('0x0'))['db'][_0x594c('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x594c('0x2')](0x0);var events={'afterCreate':_0x594c('0x3'),'afterUpdate':_0x594c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x552afb){return function(_0x5620b1,_0x2b59f1,_0x21d51e){UserVoiceQueueRtEvents[_0x594c('0x5')](_0x552afb+':'+_0x5620b1['id'],_0x5620b1);UserVoiceQueueRtEvents[_0x594c('0x5')](_0x552afb,_0x5620b1);_0x21d51e(null);};}for(var e in events){if(events[_0x594c('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x594c('0x7')](e,emitEvent(event));}}module[_0x594c('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 1eb1a83..e9af5ea 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 _0xec37=['define','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x301abd,_0x3db812){var _0x1aac0b=function(_0x3a5062){while(--_0x3a5062){_0x301abd['push'](_0x301abd['shift']());}};_0x1aac0b(++_0x3db812);}(_0xec37,0x64));var _0x7ec3=function(_0x16771d,_0x224c60){_0x16771d=_0x16771d-0x0;var _0x386f11=_0xec37[_0x16771d];return _0x386f11;};'use strict';var _=require(_0x7ec3('0x0'));var util=require(_0x7ec3('0x1'));var logger=require(_0x7ec3('0x2'))(_0x7ec3('0x3'));var moment=require('moment');var BPromise=require(_0x7ec3('0x4'));var rp=require(_0x7ec3('0x5'));var fs=require('fs');var path=require(_0x7ec3('0x6'));var rimraf=require('rimraf');var config=require(_0x7ec3('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x494b7a,_0x4098ad){return _0x494b7a[_0x7ec3('0x8')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2699=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','user_has_voice_queues_rt','lodash','util'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x2699,0x112));var _0x9269=function(_0x4c6cf0,_0x826f70){_0x4c6cf0=_0x4c6cf0-0x0;var _0x108145=_0x2699[_0x4c6cf0];return _0x108145;};'use strict';var _=require(_0x9269('0x0'));var util=require(_0x9269('0x1'));var logger=require(_0x9269('0x2'))(_0x9269('0x3'));var moment=require(_0x9269('0x4'));var BPromise=require(_0x9269('0x5'));var rp=require(_0x9269('0x6'));var fs=require('fs');var path=require(_0x9269('0x7'));var rimraf=require(_0x9269('0x8'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0x9269('0x9')]=function(_0x479929,_0xc3dd9d){return _0x479929[_0x9269('0xa')]('UserVoiceQueueRt',attributes,{'tableName':_0x9269('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 4024eb7..5fa0cf7 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 _0x679d=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','UserVoiceQueueRt','findAll','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','stringify','lodash','util','bluebird','randomstring','ioredis'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0x679d,0x1c3));var _0xd679=function(_0x4df0d2,_0x51c8be){_0x4df0d2=_0x4df0d2-0x0;var _0x29760e=_0x679d[_0x4df0d2];return _0x29760e;};'use strict';var _=require(_0xd679('0x0'));var util=require(_0xd679('0x1'));var moment=require('moment');var BPromise=require(_0xd679('0x2'));var rs=require(_0xd679('0x3'));var fs=require('fs');var Redis=require(_0xd679('0x4'));var db=require(_0xd679('0x5'))['db'];var utils=require(_0xd679('0x6'));var logger=require('../../config/logger')(_0xd679('0x7'));var config=require(_0xd679('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd679('0x9')][_0xd679('0xa')]({'port':0x232a});config[_0xd679('0xb')]=_[_0xd679('0xc')](config[_0xd679('0xb')],{'host':_0xd679('0xd'),'port':0x18eb});var socket=require(_0xd679('0xe'))(new Redis(config[_0xd679('0xb')]));require(_0xd679('0xf'))['register'](socket);function respondWithRpcPromise(_0x305bf0,_0x2e0275,_0x4a3cfa){return new BPromise(function(_0x26d1fb,_0x4b16dd){return client[_0xd679('0x10')](_0x305bf0,_0x4a3cfa)[_0xd679('0x11')](function(_0xbc136a){logger[_0xd679('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2e0275,_0xd679('0x13'));logger[_0xd679('0x14')](_0xd679('0x15'),_0x2e0275,_0xd679('0x13'),JSON['stringify'](_0xbc136a));if(_0xbc136a[_0xd679('0x16')]){if(_0xbc136a[_0xd679('0x16')]['code']===0x1f4){logger['error'](_0xd679('0x17'),_0x2e0275,_0xbc136a[_0xd679('0x16')]['message']);return _0x4b16dd(_0xbc136a[_0xd679('0x16')][_0xd679('0x18')]);}logger[_0xd679('0x16')](_0xd679('0x17'),_0x2e0275,_0xbc136a[_0xd679('0x16')][_0xd679('0x18')]);return _0x26d1fb(_0xbc136a[_0xd679('0x16')]['message']);}else{logger[_0xd679('0x12')](_0xd679('0x17'),_0x2e0275,_0xd679('0x13'));_0x26d1fb(_0xbc136a[_0xd679('0x19')][_0xd679('0x18')]);}})[_0xd679('0x1a')](function(_0x595381){logger[_0xd679('0x16')](_0xd679('0x17'),_0x2e0275,_0x595381);_0x4b16dd(_0x595381);});});}exports['GetVoiceQueueRtPauses']=function(_0x4fc6ca){var _0x40b88a=this;return new Promise(function(_0x11362e,_0x232fc7){return db[_0xd679('0x1b')][_0xd679('0x1c')]({'raw':_0x4fc6ca[_0xd679('0x1d')]?_0x4fc6ca[_0xd679('0x1d')][_0xd679('0x1e')]===undefined?!![]:![]:!![],'where':_0x4fc6ca[_0xd679('0x1d')]?_0x4fc6ca[_0xd679('0x1d')][_0xd679('0x1f')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xd679('0x20')]['fn']('IF',db['sequelize'][_0xd679('0x21')](_0xd679('0x22')))),_0xd679('0x23')]]})[_0xd679('0x11')](function(_0x3c9457){logger['info'](_0xd679('0x24'),_0x4fc6ca);logger[_0xd679('0x14')](_0xd679('0x24'),_0x4fc6ca,JSON[_0xd679('0x25')](_0x3c9457));_0x11362e(_0x3c9457);})[_0xd679('0x1a')](function(_0x2e944c){logger['error'](_0xd679('0x24'),_0x2e944c[_0xd679('0x18')],_0x4fc6ca);_0x232fc7(_0x40b88a['error'](0x1f4,_0x2e944c[_0xd679('0x18')]));});});}; \ No newline at end of file +var _0xb8ec=['UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','GetVoiceQueueRtPauses'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb8ec,0x14d));var _0xcb8e=function(_0x393b3b,_0x3cbec8){_0x393b3b=_0x393b3b-0x0;var _0x1f7189=_0xb8ec[_0x393b3b];return _0x1f7189;};'use strict';var _=require('lodash');var util=require(_0xcb8e('0x0'));var moment=require(_0xcb8e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb8e('0x2'));var db=require(_0xcb8e('0x3'))['db'];var utils=require(_0xcb8e('0x4'));var logger=require(_0xcb8e('0x5'))(_0xcb8e('0x6'));var config=require(_0xcb8e('0x7'));var jayson=require(_0xcb8e('0x8'));var client=jayson[_0xcb8e('0x9')]['http']({'port':0x232a});config[_0xcb8e('0xa')]=_[_0xcb8e('0xb')](config[_0xcb8e('0xa')],{'host':_0xcb8e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb8e('0xa')]));require(_0xcb8e('0xd'))[_0xcb8e('0xe')](socket);function respondWithRpcPromise(_0x81fd5f,_0x46594f,_0x574889){return new BPromise(function(_0x423659,_0x59a315){return client[_0xcb8e('0xf')](_0x81fd5f,_0x574889)['then'](function(_0x3c7c1c){logger[_0xcb8e('0x10')](_0xcb8e('0x11'),_0x46594f,_0xcb8e('0x12'));logger[_0xcb8e('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x46594f,_0xcb8e('0x12'),JSON[_0xcb8e('0x14')](_0x3c7c1c));if(_0x3c7c1c['error']){if(_0x3c7c1c['error'][_0xcb8e('0x15')]===0x1f4){logger[_0xcb8e('0x16')](_0xcb8e('0x11'),_0x46594f,_0x3c7c1c[_0xcb8e('0x16')][_0xcb8e('0x17')]);return _0x59a315(_0x3c7c1c[_0xcb8e('0x16')][_0xcb8e('0x17')]);}logger[_0xcb8e('0x16')](_0xcb8e('0x11'),_0x46594f,_0x3c7c1c[_0xcb8e('0x16')][_0xcb8e('0x17')]);return _0x423659(_0x3c7c1c[_0xcb8e('0x16')]['message']);}else{logger[_0xcb8e('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x46594f,_0xcb8e('0x12'));_0x423659(_0x3c7c1c[_0xcb8e('0x18')][_0xcb8e('0x17')]);}})[_0xcb8e('0x19')](function(_0x152d48){logger['error'](_0xcb8e('0x11'),_0x46594f,_0x152d48);_0x59a315(_0x152d48);});});}exports[_0xcb8e('0x1a')]=function(_0x46b576){var _0x3a62aa=this;return new Promise(function(_0x18a54c,_0x2b0139){return db[_0xcb8e('0x1b')][_0xcb8e('0x1c')]({'raw':_0x46b576[_0xcb8e('0x1d')]?_0x46b576[_0xcb8e('0x1d')][_0xcb8e('0x1e')]===undefined?!![]:![]:!![],'where':_0x46b576[_0xcb8e('0x1d')]?_0x46b576['options'][_0xcb8e('0x1f')]||null:null,'attributes':[[db[_0xcb8e('0x20')]['fn'](_0xcb8e('0x21'),db['sequelize']['fn']('IF',db[_0xcb8e('0x20')][_0xcb8e('0x22')]('`paused`\x20=\x201,\x201,\x20null'))),_0xcb8e('0x23')]]})['then'](function(_0x5d56e1){logger['info'](_0xcb8e('0x1a'),_0x46b576);logger[_0xcb8e('0x13')]('GetVoiceQueueRtPauses',_0x46b576,JSON['stringify'](_0x5d56e1));_0x18a54c(_0x5d56e1);})[_0xcb8e('0x19')](function(_0x7ecad8){logger[_0xcb8e('0x16')](_0xcb8e('0x1a'),_0x7ecad8[_0xcb8e('0x17')],_0x46b576);_0x2b0139(_0x3a62aa[_0xcb8e('0x16')](0x1f4,_0x7ecad8[_0xcb8e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index be0e06f..ccbfef3 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 _0x236d=['./userVoiceQueueRt.events','save','update','emit','register','userVoiceQueueRt:'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x236d,0x7e));var _0xd236=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x236d[_0x3dd15e];return _0x231fd0;};'use strict';var UserVoiceQueueRtEvents=require(_0xd236('0x0'));var events=[_0xd236('0x1'),'remove',_0xd236('0x2')];function createListener(_0x592746,_0x117bd0){return function(_0x2ffe96){_0x117bd0[_0xd236('0x3')](_0x592746,_0x2ffe96);};}function removeListener(_0x17ebae,_0x52cdc5){return function(){UserVoiceQueueRtEvents['removeListener'](_0x17ebae,_0x52cdc5);};}exports[_0xd236('0x4')]=function(_0x29a67c){for(var _0x75d84c=0x0,_0x1aedc6=events['length'];_0x75d84c<_0x1aedc6;_0x75d84c++){var _0x54ac9c=events[_0x75d84c];var _0x2d9025=createListener(_0xd236('0x5')+_0x54ac9c,_0x29a67c);UserVoiceQueueRtEvents['on'](_0x54ac9c,_0x2d9025);}}; \ No newline at end of file +var _0x53ec=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','removeListener'];(function(_0x2ffc8d,_0x33c196){var _0x262945=function(_0x5d2a89){while(--_0x5d2a89){_0x2ffc8d['push'](_0x2ffc8d['shift']());}};_0x262945(++_0x33c196);}(_0x53ec,0x192));var _0xc53e=function(_0x45f4e9,_0x5246fd){_0x45f4e9=_0x45f4e9-0x0;var _0x559d8f=_0x53ec[_0x45f4e9];return _0x559d8f;};'use strict';var UserVoiceQueueRtEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){UserVoiceQueueRtEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);UserVoiceQueueRtEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 9fdf507..26c4598 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(_0x549a84,_0x225007){var _0x121d5d=function(_0xc71860){while(--_0xc71860){_0x549a84['push'](_0x549a84['shift']());}};_0x121d5d(++_0x225007);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4f9f37,_0x1c2b67){var _0x370c88=function(_0x37641b){while(--_0x37641b){_0x4f9f37['push'](_0x4f9f37['shift']());}};_0x370c88(++_0x1c2b67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 1e877be..779abba 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 _0x1d5f=['exports','INTEGER'];(function(_0x9ebae9,_0x38831e){var _0x27b231=function(_0x11a6b4){while(--_0x11a6b4){_0x9ebae9['push'](_0x9ebae9['shift']());}};_0x27b231(++_0x38831e);}(_0x1d5f,0x8a));var _0xf1d5=function(_0x4206f5,_0x21f338){_0x4206f5=_0x4206f5-0x0;var _0xa29cf3=_0x1d5f[_0x4206f5];return _0xa29cf3;};'use strict';var Sequelize=require('sequelize');module[_0xf1d5('0x0')]={'penalty':{'type':Sequelize[_0xf1d5('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd7f9=['exports','sequelize'];(function(_0x220719,_0x1cabf9){var _0x28b05e=function(_0x21d4d2){while(--_0x21d4d2){_0x220719['push'](_0x220719['shift']());}};_0x28b05e(++_0x1cabf9);}(_0xd7f9,0x8b));var _0x9d7f=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0xd7f9[_0x4bd06e];return _0x85ebb;};'use strict';var Sequelize=require(_0x9d7f('0x0'));module[_0x9d7f('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 3392f91..7a45028 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 _0xcaa2=['../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5b977f,_0x4c1fb0){var _0x437ada=function(_0x2b6d9d){while(--_0x2b6d9d){_0x5b977f['push'](_0x5b977f['shift']());}};_0x437ada(++_0x4c1fb0);}(_0xcaa2,0xf5));var _0x2caa=function(_0x5bee28,_0x1dc7e2){_0x5bee28=_0x5bee28-0x0;var _0x395d1d=_0xcaa2[_0x5bee28];return _0x395d1d;};'use strict';var _=require(_0x2caa('0x0'));var util=require('util');var logger=require(_0x2caa('0x1'))(_0x2caa('0x2'));var moment=require(_0x2caa('0x3'));var BPromise=require(_0x2caa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2caa('0x5'));var rimraf=require(_0x2caa('0x6'));var config=require(_0x2caa('0x7'));var attributes=require(_0x2caa('0x8'));module['exports']=function(_0x5a75a3,_0x9d352e){return _0x5a75a3[_0x2caa('0x9')](_0x2caa('0xa'),attributes,{'tableName':_0x2caa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x331e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','user_has_whatsapp_queues','lodash','util','../../config/logger'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0x331e,0x110));var _0xe331=function(_0xc82cac,_0x87996){_0xc82cac=_0xc82cac-0x0;var _0x244b24=_0x331e[_0xc82cac];return _0x244b24;};'use strict';var _=require(_0xe331('0x0'));var util=require(_0xe331('0x1'));var logger=require(_0xe331('0x2'))(_0xe331('0x3'));var moment=require(_0xe331('0x4'));var BPromise=require(_0xe331('0x5'));var rp=require(_0xe331('0x6'));var fs=require('fs');var path=require(_0xe331('0x7'));var rimraf=require(_0xe331('0x8'));var config=require(_0xe331('0x9'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x29ca41,_0x33d36d){return _0x29ca41['define']('UserWhatsappQueue',attributes,{'tableName':_0xe331('0xa'),'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 39e740e..515a556 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 _0xd37f=['UserWhatsappQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x16c9bd,_0x1c750e){var _0x49298e=function(_0x5eb991){while(--_0x5eb991){_0x16c9bd['push'](_0x16c9bd['shift']());}};_0x49298e(++_0x1c750e);}(_0xd37f,0x1e3));var _0xfd37=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd37f[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xfd37('0x0'));var util=require(_0xfd37('0x1'));var moment=require('moment');var BPromise=require(_0xfd37('0x2'));var rs=require(_0xfd37('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd37('0x4'))['db'];var utils=require(_0xfd37('0x5'));var logger=require(_0xfd37('0x6'))(_0xfd37('0x7'));var config=require(_0xfd37('0x8'));var jayson=require(_0xfd37('0x9'));var client=jayson[_0xfd37('0xa')][_0xfd37('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x417bbb,_0x5d3ab5,_0x5b67bd){return new BPromise(function(_0x2015d5,_0x50317c){return client['request'](_0x417bbb,_0x5b67bd)[_0xfd37('0xc')](function(_0x45fdd8){logger[_0xfd37('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5d3ab5,'request\x20sent');logger[_0xfd37('0xe')](_0xfd37('0xf'),_0x5d3ab5,_0xfd37('0x10'),JSON[_0xfd37('0x11')](_0x45fdd8));if(_0x45fdd8[_0xfd37('0x12')]){if(_0x45fdd8[_0xfd37('0x12')][_0xfd37('0x13')]===0x1f4){logger[_0xfd37('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5d3ab5,_0x45fdd8[_0xfd37('0x12')][_0xfd37('0x14')]);return _0x50317c(_0x45fdd8[_0xfd37('0x12')][_0xfd37('0x14')]);}logger['error'](_0xfd37('0x15'),_0x5d3ab5,_0x45fdd8[_0xfd37('0x12')]['message']);return _0x2015d5(_0x45fdd8[_0xfd37('0x12')][_0xfd37('0x14')]);}else{logger[_0xfd37('0xd')](_0xfd37('0x15'),_0x5d3ab5,_0xfd37('0x10'));_0x2015d5(_0x45fdd8[_0xfd37('0x16')][_0xfd37('0x14')]);}})[_0xfd37('0x17')](function(_0x17d8fb){logger[_0xfd37('0x12')](_0xfd37('0x15'),_0x5d3ab5,_0x17d8fb);_0x50317c(_0x17d8fb);});});} \ No newline at end of file +var _0xddca=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5d5106,_0x1e822d){var _0xe4d96a=function(_0x515cd8){while(--_0x515cd8){_0x5d5106['push'](_0x5d5106['shift']());}};_0xe4d96a(++_0x1e822d);}(_0xddca,0x1c5));var _0xaddc=function(_0xaffbc8,_0x12b840){_0xaffbc8=_0xaffbc8-0x0;var _0x366bb0=_0xddca[_0xaffbc8];return _0x366bb0;};'use strict';var _=require(_0xaddc('0x0'));var util=require('util');var moment=require(_0xaddc('0x1'));var BPromise=require(_0xaddc('0x2'));var rs=require(_0xaddc('0x3'));var fs=require('fs');var Redis=require(_0xaddc('0x4'));var db=require(_0xaddc('0x5'))['db'];var utils=require(_0xaddc('0x6'));var logger=require(_0xaddc('0x7'))(_0xaddc('0x8'));var config=require(_0xaddc('0x9'));var jayson=require(_0xaddc('0xa'));var client=jayson[_0xaddc('0xb')][_0xaddc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d7125,_0x4b5489,_0x2f661d){return new BPromise(function(_0x563c2c,_0x41121c){return client['request'](_0x3d7125,_0x2f661d)[_0xaddc('0xd')](function(_0x1a2d14){logger[_0xaddc('0xe')](_0xaddc('0xf'),_0x4b5489,_0xaddc('0x10'));logger[_0xaddc('0x11')](_0xaddc('0x12'),_0x4b5489,_0xaddc('0x10'),JSON['stringify'](_0x1a2d14));if(_0x1a2d14[_0xaddc('0x13')]){if(_0x1a2d14[_0xaddc('0x13')][_0xaddc('0x14')]===0x1f4){logger[_0xaddc('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x4b5489,_0x1a2d14[_0xaddc('0x13')][_0xaddc('0x15')]);return _0x41121c(_0x1a2d14[_0xaddc('0x13')][_0xaddc('0x15')]);}logger[_0xaddc('0x13')](_0xaddc('0xf'),_0x4b5489,_0x1a2d14['error']['message']);return _0x563c2c(_0x1a2d14[_0xaddc('0x13')][_0xaddc('0x15')]);}else{logger[_0xaddc('0xe')](_0xaddc('0xf'),_0x4b5489,_0xaddc('0x10'));_0x563c2c(_0x1a2d14[_0xaddc('0x16')]['message']);}})['catch'](function(_0x453a23){logger['error'](_0xaddc('0xf'),_0x4b5489,_0x453a23);_0x41121c(_0x453a23);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 85577f7..a62bbc9 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 _0xdeb3=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','create','put','update','delete','multer','util','path'];(function(_0x52620f,_0x505daa){var _0xe1f23a=function(_0x354d4b){while(--_0x354d4b){_0x52620f['push'](_0x52620f['shift']());}};_0xe1f23a(++_0x505daa);}(_0xdeb3,0xeb));var _0x3deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb3[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x3deb('0x0'));var util=require(_0x3deb('0x1'));var path=require(_0x3deb('0x2'));var timeout=require(_0x3deb('0x3'));var express=require(_0x3deb('0x4'));var router=express[_0x3deb('0x5')]();var fs_extra=require(_0x3deb('0x6'));var auth=require(_0x3deb('0x7'));var interaction=require(_0x3deb('0x8'));var config=require('../../config/environment');var controller=require('./variable.controller');router['get']('/',auth[_0x3deb('0x9')](),controller[_0x3deb('0xa')]);router[_0x3deb('0xb')](_0x3deb('0xc'),auth[_0x3deb('0x9')](),controller['show']);router['post']('/',auth[_0x3deb('0x9')](),controller[_0x3deb('0xd')]);router[_0x3deb('0xe')](_0x3deb('0xc'),auth[_0x3deb('0x9')](),controller[_0x3deb('0xf')]);router[_0x3deb('0x10')](_0x3deb('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2cc1=['isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./variable.controller','get','/:id'];(function(_0x177ae2,_0x55f3a2){var _0x32811b=function(_0x7cd984){while(--_0x7cd984){_0x177ae2['push'](_0x177ae2['shift']());}};_0x32811b(++_0x55f3a2);}(_0x2cc1,0x1bd));var _0x12cc=function(_0x38a13a,_0x2b0ac0){_0x38a13a=_0x38a13a-0x0;var _0x37f0d6=_0x2cc1[_0x38a13a];return _0x37f0d6;};'use strict';var multer=require(_0x12cc('0x0'));var util=require(_0x12cc('0x1'));var path=require(_0x12cc('0x2'));var timeout=require(_0x12cc('0x3'));var express=require(_0x12cc('0x4'));var router=express[_0x12cc('0x5')]();var fs_extra=require(_0x12cc('0x6'));var auth=require(_0x12cc('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x12cc('0x8'));router[_0x12cc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x12cc('0x9')](_0x12cc('0xa'),auth[_0x12cc('0xb')](),controller[_0x12cc('0xc')]);router[_0x12cc('0xd')]('/',auth[_0x12cc('0xb')](),controller[_0x12cc('0xe')]);router[_0x12cc('0xf')](_0x12cc('0xa'),auth[_0x12cc('0xb')](),controller[_0x12cc('0x10')]);router[_0x12cc('0x11')](_0x12cc('0xa'),auth['isAuthenticated'](),controller[_0x12cc('0x12')]);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 dd220a9..a6990f6 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 _0xaffe=['exports','STRING','sequelize'];(function(_0x25c1bd,_0x2b9085){var _0x1eea5f=function(_0x3b720c){while(--_0x3b720c){_0x25c1bd['push'](_0x25c1bd['shift']());}};_0x1eea5f(++_0x2b9085);}(_0xaffe,0x158));var _0xeaff=function(_0x129334,_0x5e5324){_0x129334=_0x129334-0x0;var _0x2b9e3f=_0xaffe[_0x129334];return _0x2b9e3f;};'use strict';var Sequelize=require(_0xeaff('0x0'));module[_0xeaff('0x1')]={'name':{'type':Sequelize[_0xeaff('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xeaff('0x2')]}}; \ No newline at end of file +var _0xd5cd=['STRING','name','sequelize','exports'];(function(_0x28d4a2,_0x578d0e){var _0x189fa9=function(_0x4c426a){while(--_0x4c426a){_0x28d4a2['push'](_0x28d4a2['shift']());}};_0x189fa9(++_0x578d0e);}(_0xd5cd,0x7e));var _0xdd5c=function(_0x11cfab,_0x56fb0b){_0x11cfab=_0x11cfab-0x0;var _0x5f1345=_0xd5cd[_0x11cfab];return _0x5f1345;};'use strict';var Sequelize=require(_0xdd5c('0x0'));module[_0xdd5c('0x1')]={'name':{'type':Sequelize[_0xdd5c('0x2')],'unique':_0xdd5c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdd5c('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 8171367..e76202b 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 _0x5dfb=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','json','apply','save','destroy','then','get','UserProfileResource','end','error','stack','name','send','index','map','Variable','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection'];(function(_0x765c93,_0x3a755b){var _0x36debc=function(_0x4bbfe7){while(--_0x4bbfe7){_0x765c93['push'](_0x765c93['shift']());}};_0x36debc(++_0x3a755b);}(_0x5dfb,0x192));var _0xb5df=function(_0x3a7e01,_0x51204c){_0x3a7e01=_0x3a7e01-0x0;var _0x5b8398=_0x5dfb[_0x3a7e01];return _0x5b8398;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb5df('0x0'));var zipdir=require(_0xb5df('0x1'));var jsonpatch=require(_0xb5df('0x2'));var rp=require(_0xb5df('0x3'));var moment=require(_0xb5df('0x4'));var BPromise=require(_0xb5df('0x5'));var Mustache=require(_0xb5df('0x6'));var util=require('util');var path=require(_0xb5df('0x7'));var sox=require(_0xb5df('0x8'));var csv=require(_0xb5df('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb5df('0xa'));var _=require('lodash');var squel=require(_0xb5df('0xb'));var crypto=require('crypto');var jsforce=require(_0xb5df('0xc'));var deskjs=require(_0xb5df('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb5df('0xe'));var Papa=require(_0xb5df('0xf'));var Redis=require(_0xb5df('0x10'));var authService=require(_0xb5df('0x11'));var qs=require(_0xb5df('0x12'));var as=require(_0xb5df('0x13'));var hardwareService=require(_0xb5df('0x14'));var logger=require('../../config/logger')(_0xb5df('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb5df('0x16'));var db=require(_0xb5df('0x17'))['db'];function respondWithStatusCode(_0x598249,_0x33792f){_0x33792f=_0x33792f||0xcc;return function(_0x5b86ae){if(_0x5b86ae){return _0x598249[_0xb5df('0x18')](_0x33792f);}return _0x598249['status'](_0x33792f)['end']();};}function respondWithResult(_0x4b360b,_0x453c13){_0x453c13=_0x453c13||0xc8;return function(_0x3644bc){if(_0x3644bc){return _0x4b360b[_0xb5df('0x19')](_0x453c13)['json'](_0x3644bc);}};}function respondWithFilteredResult(_0x14dee8,_0x514e93){return function(_0x31bf71){if(_0x31bf71){var _0x51015f=typeof _0x514e93['offset']==='undefined'&&typeof _0x514e93['limit']===_0xb5df('0x1a');var _0x3d8262=_0x31bf71[_0xb5df('0x1b')];var _0x1781bd=_0x51015f?0x0:_0x514e93[_0xb5df('0x1c')];var _0x4d82f2=_0x51015f?_0x31bf71['count']:_0x514e93[_0xb5df('0x1c')]+_0x514e93[_0xb5df('0x1d')];var _0x50f5f2;if(_0x4d82f2>=_0x3d8262){_0x4d82f2=_0x3d8262;_0x50f5f2=0xc8;}else{_0x50f5f2=0xce;}_0x14dee8['status'](_0x50f5f2);return _0x14dee8[_0xb5df('0x1e')]('Content-Range',_0x1781bd+'-'+_0x4d82f2+'/'+_0x3d8262)[_0xb5df('0x1f')](_0x31bf71);}return null;};}function patchUpdates(_0x4a8db1){return function(_0x6eed5a){try{jsonpatch[_0xb5df('0x20')](_0x6eed5a,_0x4a8db1,!![]);}catch(_0x1bd343){return BPromise['reject'](_0x1bd343);}return _0x6eed5a[_0xb5df('0x21')]();};}function saveUpdates(_0x5b4764,_0x226fbf){return function(_0x4afeb2){if(_0x4afeb2){return _0x4afeb2['update'](_0x5b4764)['then'](function(_0x389df4){return _0x389df4;});}return null;};}function removeEntity(_0x3f6cb7,_0x376a1b){return function(_0x3b9503){if(_0x3b9503){return _0x3b9503[_0xb5df('0x22')]()[_0xb5df('0x23')](function(){var _0xb71c=_0x3b9503[_0xb5df('0x24')]({'plain':!![]});var _0x50bebd='Variables';return db[_0xb5df('0x25')][_0xb5df('0x22')]({'where':{'type':_0x50bebd,'resourceId':_0xb71c['id']}})['then'](function(){return _0x3b9503;});})[_0xb5df('0x23')](function(){_0x3f6cb7['status'](0xcc)[_0xb5df('0x26')]();});}};}function handleEntityNotFound(_0x2086dd,_0x4cddbc){return function(_0x171c8d){if(!_0x171c8d){_0x2086dd[_0xb5df('0x18')](0x194);}return _0x171c8d;};}function handleError(_0x37ff34,_0x5e520e){_0x5e520e=_0x5e520e||0x1f4;return function(_0x57c6be){logger[_0xb5df('0x27')](_0x57c6be[_0xb5df('0x28')]);if(_0x57c6be[_0xb5df('0x29')]){delete _0x57c6be[_0xb5df('0x29')];}_0x37ff34[_0xb5df('0x19')](_0x5e520e)[_0xb5df('0x2a')](_0x57c6be);};}exports[_0xb5df('0x2b')]=function(_0x4c3f8a,_0x40437c){var _0x5e57a6={},_0x2ae2fd={},_0x2a7641={'count':0x0,'rows':[]};var _0x599f7c=_[_0xb5df('0x2c')](db[_0xb5df('0x2d')][_0xb5df('0x2e')],function(_0xbbce6a){return{'name':_0xbbce6a['fieldName'],'type':_0xbbce6a[_0xb5df('0x2f')][_0xb5df('0x30')]};});_0x2ae2fd[_0xb5df('0x31')]=_['map'](_0x599f7c,_0xb5df('0x29'));_0x2ae2fd[_0xb5df('0x32')]=_['keys'](_0x4c3f8a[_0xb5df('0x32')]);_0x2ae2fd[_0xb5df('0x33')]=_[_0xb5df('0x34')](_0x2ae2fd['model'],_0x2ae2fd[_0xb5df('0x32')]);_0x5e57a6['attributes']=_[_0xb5df('0x34')](_0x2ae2fd[_0xb5df('0x31')],qs[_0xb5df('0x35')](_0x4c3f8a[_0xb5df('0x32')][_0xb5df('0x35')]));_0x5e57a6[_0xb5df('0x36')]=_0x5e57a6['attributes'][_0xb5df('0x37')]?_0x5e57a6[_0xb5df('0x36')]:_0x2ae2fd['model'];if(!_0x4c3f8a[_0xb5df('0x32')][_0xb5df('0x38')]('nolimit')){_0x5e57a6[_0xb5df('0x1d')]=qs['limit'](_0x4c3f8a[_0xb5df('0x32')][_0xb5df('0x1d')]);_0x5e57a6['offset']=qs[_0xb5df('0x1c')](_0x4c3f8a[_0xb5df('0x32')][_0xb5df('0x1c')]);}_0x5e57a6[_0xb5df('0x39')]=qs['sort'](_0x4c3f8a['query']['sort']);_0x5e57a6['where']=qs['filters'](_['pick'](_0x4c3f8a[_0xb5df('0x32')],_0x2ae2fd[_0xb5df('0x33')]),_0x599f7c);if(_0x4c3f8a[_0xb5df('0x32')][_0xb5df('0x3a')]){_0x5e57a6[_0xb5df('0x3b')]=_[_0xb5df('0x3c')](_0x5e57a6[_0xb5df('0x3b')],{'$or':_[_0xb5df('0x2c')](_0x599f7c,function(_0x3fdfe8){if(_0x3fdfe8[_0xb5df('0x2f')]!==_0xb5df('0x3d')){var _0x3c5293={};_0x3c5293[_0x3fdfe8[_0xb5df('0x29')]]={'$like':'%'+_0x4c3f8a[_0xb5df('0x32')]['filter']+'%'};return _0x3c5293;}})});}_0x5e57a6=_['merge']({},_0x5e57a6,_0x4c3f8a[_0xb5df('0x3e')]);var _0x136973={'where':_0x5e57a6[_0xb5df('0x3b')]};return db['Variable'][_0xb5df('0x1b')](_0x136973)['then'](function(_0x36a069){_0x2a7641['count']=_0x36a069;if(_0x4c3f8a[_0xb5df('0x32')][_0xb5df('0x3f')]){_0x5e57a6[_0xb5df('0x40')]=[{'all':!![]}];}return db[_0xb5df('0x2d')][_0xb5df('0x41')](_0x5e57a6);})[_0xb5df('0x23')](function(_0x1b089f){_0x2a7641['rows']=_0x1b089f;return _0x2a7641;})['then'](respondWithFilteredResult(_0x40437c,_0x5e57a6))[_0xb5df('0x42')](handleError(_0x40437c,null));};exports[_0xb5df('0x43')]=function(_0x361303,_0x18f87f){var _0x27bc09={'raw':!![],'where':{'id':_0x361303[_0xb5df('0x44')]['id']}},_0x2f28e8={};_0x2f28e8[_0xb5df('0x31')]=_['keys'](db[_0xb5df('0x2d')][_0xb5df('0x2e')]);_0x2f28e8['query']=_[_0xb5df('0x45')](_0x361303[_0xb5df('0x32')]);_0x2f28e8[_0xb5df('0x33')]=_[_0xb5df('0x34')](_0x2f28e8[_0xb5df('0x31')],_0x2f28e8[_0xb5df('0x32')]);_0x27bc09['attributes']=_[_0xb5df('0x34')](_0x2f28e8[_0xb5df('0x31')],qs['fields'](_0x361303[_0xb5df('0x32')][_0xb5df('0x35')]));_0x27bc09[_0xb5df('0x36')]=_0x27bc09[_0xb5df('0x36')][_0xb5df('0x37')]?_0x27bc09[_0xb5df('0x36')]:_0x2f28e8[_0xb5df('0x31')];if(_0x361303[_0xb5df('0x32')][_0xb5df('0x3f')]){_0x27bc09[_0xb5df('0x40')]=[{'all':!![]}];}_0x27bc09=_[_0xb5df('0x3c')]({},_0x27bc09,_0x361303[_0xb5df('0x3e')]);return db['Variable'][_0xb5df('0x46')](_0x27bc09)[_0xb5df('0x23')](handleEntityNotFound(_0x18f87f,null))[_0xb5df('0x23')](respondWithResult(_0x18f87f,null))[_0xb5df('0x42')](handleError(_0x18f87f,null));};exports['create']=function(_0x2ada5c,_0x5f07fd){return db[_0xb5df('0x2d')][_0xb5df('0x47')](_0x2ada5c[_0xb5df('0x48')],{})[_0xb5df('0x23')](function(_0x5f1baa){var _0x51063c=_0x2ada5c[_0xb5df('0x49')][_0xb5df('0x24')]({'plain':!![]});if(!_0x51063c)throw new Error(_0xb5df('0x4a'));if(_0x51063c[_0xb5df('0x4b')]==='user'){var _0x1e5781=_0x5f1baa[_0xb5df('0x24')]({'plain':!![]});var _0x21da25=_0xb5df('0x4c');return db[_0xb5df('0x4d')]['find']({'where':{'name':_0x21da25,'userProfileId':_0x51063c['userProfileId']},'raw':!![]})[_0xb5df('0x23')](function(_0x4bb3e3){if(_0x4bb3e3&&_0x4bb3e3['autoAssociation']===0x0){return db[_0xb5df('0x25')][_0xb5df('0x47')]({'name':_0x1e5781['name'],'resourceId':_0x1e5781['id'],'type':_0x4bb3e3[_0xb5df('0x29')],'sectionId':_0x4bb3e3['id']},{})['then'](function(){return _0x5f1baa;});}else{return _0x5f1baa;}})[_0xb5df('0x42')](function(_0x2eb41d){logger[_0xb5df('0x27')](_0xb5df('0x4e'),_0x2eb41d);throw _0x2eb41d;});}return _0x5f1baa;})[_0xb5df('0x23')](respondWithResult(_0x5f07fd,0xc9))[_0xb5df('0x42')](handleError(_0x5f07fd,null));};exports[_0xb5df('0x4f')]=function(_0x8f5c5b,_0x19a5c8){if(_0x8f5c5b[_0xb5df('0x48')]['id']){delete _0x8f5c5b[_0xb5df('0x48')]['id'];}return db[_0xb5df('0x2d')][_0xb5df('0x46')]({'where':{'id':_0x8f5c5b[_0xb5df('0x44')]['id']}})[_0xb5df('0x23')](handleEntityNotFound(_0x19a5c8,null))[_0xb5df('0x23')](saveUpdates(_0x8f5c5b[_0xb5df('0x48')],null))[_0xb5df('0x23')](respondWithResult(_0x19a5c8,null))[_0xb5df('0x42')](handleError(_0x19a5c8,null));};exports[_0xb5df('0x22')]=function(_0x318591,_0x53e08b){return db[_0xb5df('0x2d')]['find']({'where':{'id':_0x318591['params']['id']}})[_0xb5df('0x23')](handleEntityNotFound(_0x53e08b,null))[_0xb5df('0x23')](removeEntity(_0x53e08b,null))[_0xb5df('0x42')](handleError(_0x53e08b,null));}; \ No newline at end of file +var _0xc549=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Variables','UserProfileSection','userProfileId','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','send','index','map','Variable','type','key','query','filters'];(function(_0x1ad6e7,_0xec3159){var _0x5ce01e=function(_0x564f40){while(--_0x564f40){_0x1ad6e7['push'](_0x1ad6e7['shift']());}};_0x5ce01e(++_0xec3159);}(_0xc549,0xc3));var _0x9c54=function(_0x2748c2,_0x4dbcbc){_0x2748c2=_0x2748c2-0x0;var _0x31f1ed=_0xc549[_0x2748c2];return _0x31f1ed;};'use strict';var emlformat=require(_0x9c54('0x0'));var rimraf=require(_0x9c54('0x1'));var zipdir=require(_0x9c54('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c54('0x3'));var moment=require(_0x9c54('0x4'));var BPromise=require(_0x9c54('0x5'));var Mustache=require(_0x9c54('0x6'));var util=require(_0x9c54('0x7'));var path=require(_0x9c54('0x8'));var sox=require(_0x9c54('0x9'));var csv=require(_0x9c54('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9c54('0xb'));var squel=require(_0x9c54('0xc'));var crypto=require(_0x9c54('0xd'));var jsforce=require(_0x9c54('0xe'));var deskjs=require(_0x9c54('0xf'));var toCsv=require(_0x9c54('0xa'));var querystring=require(_0x9c54('0x10'));var Papa=require(_0x9c54('0x11'));var Redis=require('ioredis');var authService=require(_0x9c54('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c54('0x13'));var logger=require(_0x9c54('0x14'))('api');var utils=require(_0x9c54('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9c54('0x16'))['db'];function respondWithStatusCode(_0x40c8a2,_0xa40afb){_0xa40afb=_0xa40afb||0xcc;return function(_0x88a030){if(_0x88a030){return _0x40c8a2[_0x9c54('0x17')](_0xa40afb);}return _0x40c8a2[_0x9c54('0x18')](_0xa40afb)[_0x9c54('0x19')]();};}function respondWithResult(_0x4e07d2,_0x30d52b){_0x30d52b=_0x30d52b||0xc8;return function(_0x38dcfa){if(_0x38dcfa){return _0x4e07d2[_0x9c54('0x18')](_0x30d52b)[_0x9c54('0x1a')](_0x38dcfa);}};}function respondWithFilteredResult(_0x3c8a94,_0x3459a8){return function(_0x3d4f71){if(_0x3d4f71){var _0x1a4815=typeof _0x3459a8[_0x9c54('0x1b')]==='undefined'&&typeof _0x3459a8['limit']===_0x9c54('0x1c');var _0x4836bb=_0x3d4f71[_0x9c54('0x1d')];var _0x138a42=_0x1a4815?0x0:_0x3459a8[_0x9c54('0x1b')];var _0x275274=_0x1a4815?_0x3d4f71[_0x9c54('0x1d')]:_0x3459a8[_0x9c54('0x1b')]+_0x3459a8['limit'];var _0x3a953b;if(_0x275274>=_0x4836bb){_0x275274=_0x4836bb;_0x3a953b=0xc8;}else{_0x3a953b=0xce;}_0x3c8a94[_0x9c54('0x18')](_0x3a953b);return _0x3c8a94[_0x9c54('0x1e')]('Content-Range',_0x138a42+'-'+_0x275274+'/'+_0x4836bb)['json'](_0x3d4f71);}return null;};}function patchUpdates(_0x539636){return function(_0x34ba37){try{jsonpatch[_0x9c54('0x1f')](_0x34ba37,_0x539636,!![]);}catch(_0x5e6045){return BPromise[_0x9c54('0x20')](_0x5e6045);}return _0x34ba37[_0x9c54('0x21')]();};}function saveUpdates(_0x5c5f92,_0x46e8ef){return function(_0x1f43b8){if(_0x1f43b8){return _0x1f43b8[_0x9c54('0x22')](_0x5c5f92)[_0x9c54('0x23')](function(_0x349dfd){return _0x349dfd;});}return null;};}function removeEntity(_0x5535d4,_0x415a81){return function(_0x399fed){if(_0x399fed){return _0x399fed[_0x9c54('0x24')]()[_0x9c54('0x23')](function(){var _0x161499=_0x399fed['get']({'plain':!![]});var _0x4ec517='Variables';return db[_0x9c54('0x25')][_0x9c54('0x24')]({'where':{'type':_0x4ec517,'resourceId':_0x161499['id']}})['then'](function(){return _0x399fed;});})[_0x9c54('0x23')](function(){_0x5535d4[_0x9c54('0x18')](0xcc)[_0x9c54('0x19')]();});}};}function handleEntityNotFound(_0x1b1a24,_0x27d950){return function(_0x41b748){if(!_0x41b748){_0x1b1a24[_0x9c54('0x17')](0x194);}return _0x41b748;};}function handleError(_0x2219b0,_0x441683){_0x441683=_0x441683||0x1f4;return function(_0x2a3309){logger['error'](_0x2a3309[_0x9c54('0x26')]);if(_0x2a3309['name']){delete _0x2a3309[_0x9c54('0x27')];}_0x2219b0[_0x9c54('0x18')](_0x441683)[_0x9c54('0x28')](_0x2a3309);};}exports[_0x9c54('0x29')]=function(_0x2cfc5b,_0xb148e2){var _0x4e12b6={},_0x497744={},_0x53dd03={'count':0x0,'rows':[]};var _0x11d607=_[_0x9c54('0x2a')](db[_0x9c54('0x2b')]['rawAttributes'],function(_0x290325){return{'name':_0x290325['fieldName'],'type':_0x290325[_0x9c54('0x2c')][_0x9c54('0x2d')]};});_0x497744['model']=_[_0x9c54('0x2a')](_0x11d607,'name');_0x497744[_0x9c54('0x2e')]=_['keys'](_0x2cfc5b[_0x9c54('0x2e')]);_0x497744[_0x9c54('0x2f')]=_[_0x9c54('0x30')](_0x497744[_0x9c54('0x31')],_0x497744[_0x9c54('0x2e')]);_0x4e12b6[_0x9c54('0x32')]=_[_0x9c54('0x30')](_0x497744[_0x9c54('0x31')],qs['fields'](_0x2cfc5b[_0x9c54('0x2e')][_0x9c54('0x33')]));_0x4e12b6[_0x9c54('0x32')]=_0x4e12b6[_0x9c54('0x32')][_0x9c54('0x34')]?_0x4e12b6[_0x9c54('0x32')]:_0x497744[_0x9c54('0x31')];if(!_0x2cfc5b['query'][_0x9c54('0x35')](_0x9c54('0x36'))){_0x4e12b6[_0x9c54('0x37')]=qs[_0x9c54('0x37')](_0x2cfc5b[_0x9c54('0x2e')]['limit']);_0x4e12b6[_0x9c54('0x1b')]=qs['offset'](_0x2cfc5b[_0x9c54('0x2e')]['offset']);}_0x4e12b6[_0x9c54('0x38')]=qs[_0x9c54('0x39')](_0x2cfc5b[_0x9c54('0x2e')]['sort']);_0x4e12b6[_0x9c54('0x3a')]=qs[_0x9c54('0x2f')](_[_0x9c54('0x3b')](_0x2cfc5b[_0x9c54('0x2e')],_0x497744[_0x9c54('0x2f')]),_0x11d607);if(_0x2cfc5b[_0x9c54('0x2e')][_0x9c54('0x3c')]){_0x4e12b6[_0x9c54('0x3a')]=_[_0x9c54('0x3d')](_0x4e12b6[_0x9c54('0x3a')],{'$or':_['map'](_0x11d607,function(_0x5f292b){if(_0x5f292b[_0x9c54('0x2c')]!==_0x9c54('0x3e')){var _0x4f46ce={};_0x4f46ce[_0x5f292b[_0x9c54('0x27')]]={'$like':'%'+_0x2cfc5b[_0x9c54('0x2e')][_0x9c54('0x3c')]+'%'};return _0x4f46ce;}})});}_0x4e12b6=_[_0x9c54('0x3d')]({},_0x4e12b6,_0x2cfc5b[_0x9c54('0x3f')]);var _0x29f6dd={'where':_0x4e12b6['where']};return db[_0x9c54('0x2b')][_0x9c54('0x1d')](_0x29f6dd)[_0x9c54('0x23')](function(_0xc70084){_0x53dd03[_0x9c54('0x1d')]=_0xc70084;if(_0x2cfc5b[_0x9c54('0x2e')][_0x9c54('0x40')]){_0x4e12b6[_0x9c54('0x41')]=[{'all':!![]}];}return db[_0x9c54('0x2b')][_0x9c54('0x42')](_0x4e12b6);})[_0x9c54('0x23')](function(_0x1947ce){_0x53dd03['rows']=_0x1947ce;return _0x53dd03;})[_0x9c54('0x23')](respondWithFilteredResult(_0xb148e2,_0x4e12b6))[_0x9c54('0x43')](handleError(_0xb148e2,null));};exports[_0x9c54('0x44')]=function(_0x290397,_0x3ec564){var _0x27084a={'raw':!![],'where':{'id':_0x290397[_0x9c54('0x45')]['id']}},_0x2a5b76={};_0x2a5b76[_0x9c54('0x31')]=_[_0x9c54('0x46')](db[_0x9c54('0x2b')][_0x9c54('0x47')]);_0x2a5b76[_0x9c54('0x2e')]=_[_0x9c54('0x46')](_0x290397['query']);_0x2a5b76[_0x9c54('0x2f')]=_['intersection'](_0x2a5b76[_0x9c54('0x31')],_0x2a5b76['query']);_0x27084a[_0x9c54('0x32')]=_[_0x9c54('0x30')](_0x2a5b76[_0x9c54('0x31')],qs[_0x9c54('0x33')](_0x290397[_0x9c54('0x2e')][_0x9c54('0x33')]));_0x27084a[_0x9c54('0x32')]=_0x27084a['attributes'][_0x9c54('0x34')]?_0x27084a[_0x9c54('0x32')]:_0x2a5b76[_0x9c54('0x31')];if(_0x290397[_0x9c54('0x2e')][_0x9c54('0x40')]){_0x27084a[_0x9c54('0x41')]=[{'all':!![]}];}_0x27084a=_[_0x9c54('0x3d')]({},_0x27084a,_0x290397['options']);return db[_0x9c54('0x2b')][_0x9c54('0x48')](_0x27084a)[_0x9c54('0x23')](handleEntityNotFound(_0x3ec564,null))['then'](respondWithResult(_0x3ec564,null))['catch'](handleError(_0x3ec564,null));};exports[_0x9c54('0x49')]=function(_0x2ef2c8,_0x1a0017){return db[_0x9c54('0x2b')][_0x9c54('0x49')](_0x2ef2c8['body'],{})['then'](function(_0xb403fc){var _0x59acb3=_0x2ef2c8[_0x9c54('0x4a')][_0x9c54('0x4b')]({'plain':!![]});if(!_0x59acb3)throw new Error(_0x9c54('0x4c'));if(_0x59acb3['role']===_0x9c54('0x4a')){var _0x1fc8c4=_0xb403fc[_0x9c54('0x4b')]({'plain':!![]});var _0x59d556=_0x9c54('0x4d');return db[_0x9c54('0x4e')][_0x9c54('0x48')]({'where':{'name':_0x59d556,'userProfileId':_0x59acb3[_0x9c54('0x4f')]},'raw':!![]})['then'](function(_0x3c77be){if(_0x3c77be&&_0x3c77be['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1fc8c4[_0x9c54('0x27')],'resourceId':_0x1fc8c4['id'],'type':_0x3c77be[_0x9c54('0x27')],'sectionId':_0x3c77be['id']},{})[_0x9c54('0x23')](function(){return _0xb403fc;});}else{return _0xb403fc;}})['catch'](function(_0x48d920){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48d920);throw _0x48d920;});}return _0xb403fc;})[_0x9c54('0x23')](respondWithResult(_0x1a0017,0xc9))[_0x9c54('0x43')](handleError(_0x1a0017,null));};exports[_0x9c54('0x22')]=function(_0x566338,_0x4a66c5){if(_0x566338['body']['id']){delete _0x566338[_0x9c54('0x50')]['id'];}return db[_0x9c54('0x2b')][_0x9c54('0x48')]({'where':{'id':_0x566338[_0x9c54('0x45')]['id']}})[_0x9c54('0x23')](handleEntityNotFound(_0x4a66c5,null))[_0x9c54('0x23')](saveUpdates(_0x566338['body'],null))[_0x9c54('0x23')](respondWithResult(_0x4a66c5,null))[_0x9c54('0x43')](handleError(_0x4a66c5,null));};exports[_0x9c54('0x24')]=function(_0x3d80fe,_0x12da56){return db[_0x9c54('0x2b')]['find']({'where':{'id':_0x3d80fe['params']['id']}})[_0x9c54('0x23')](handleEntityNotFound(_0x12da56,null))[_0x9c54('0x23')](removeEntity(_0x12da56,null))[_0x9c54('0x43')](handleError(_0x12da56,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index b75c125..0e64bb8 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 _0x82d0=['define','Variable','lodash','util','moment','bluebird','request-promise','path','rimraf','./variable.attributes','exports'];(function(_0x581837,_0x49d49){var _0x136b5e=function(_0x28449b){while(--_0x28449b){_0x581837['push'](_0x581837['shift']());}};_0x136b5e(++_0x49d49);}(_0x82d0,0xbd));var _0x082d=function(_0x110cbb,_0x186ee7){_0x110cbb=_0x110cbb-0x0;var _0x145f91=_0x82d0[_0x110cbb];return _0x145f91;};'use strict';var _=require(_0x082d('0x0'));var util=require(_0x082d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x082d('0x2'));var BPromise=require(_0x082d('0x3'));var rp=require(_0x082d('0x4'));var fs=require('fs');var path=require(_0x082d('0x5'));var rimraf=require(_0x082d('0x6'));var config=require('../../config/environment');var attributes=require(_0x082d('0x7'));module[_0x082d('0x8')]=function(_0x3dc210,_0x4c04d2){return _0x3dc210[_0x082d('0x9')](_0x082d('0xa'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a33=['path','rimraf','../../config/environment','exports','define','Variable','tools_variables','lodash','util','bluebird','request-promise'];(function(_0x129d1a,_0x349caa){var _0x90ffb5=function(_0x16ab6e){while(--_0x16ab6e){_0x129d1a['push'](_0x129d1a['shift']());}};_0x90ffb5(++_0x349caa);}(_0x3a33,0x125));var _0x33a3=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x3a33[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x33a3('0x0'));var util=require(_0x33a3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x33a3('0x2'));var rp=require(_0x33a3('0x3'));var fs=require('fs');var path=require(_0x33a3('0x4'));var rimraf=require(_0x33a3('0x5'));var config=require(_0x33a3('0x6'));var attributes=require('./variable.attributes');module[_0x33a3('0x7')]=function(_0x81b7fd,_0x313221){return _0x81b7fd[_0x33a3('0x8')](_0x33a3('0x9'),attributes,{'tableName':_0x33a3('0xa'),'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 a87979e..75acdca 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x3d3a66,_0x5669ee){var _0x30c7d7=function(_0x20df6b){while(--_0x20df6b){_0x3d3a66['push'](_0x3d3a66['shift']());}};_0x30c7d7(++_0x5669ee);}(_0x6aa7,0x178));var _0x76aa=function(_0x409c51,_0x5f4941){_0x409c51=_0x409c51-0x0;var _0x320504=_0x6aa7[_0x409c51];return _0x320504;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file +var _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x189381,_0x2825dd){var _0xcb8c3=function(_0x37574a){while(--_0x37574a){_0x189381['push'](_0x189381['shift']());}};_0xcb8c3(++_0x2825dd);}(_0xf494,0x1c6));var _0x4f49=function(_0x638638,_0x34585e){_0x638638=_0x638638-0x0;var _0x3651ee=_0xf494[_0x638638];return _0x3651ee;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index a31911d..9e8a9dd 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 _0x25cd=['pull','restart','/migrations','migrations','Router','../../components/auth/service','get','index','isAuthenticated','/reset','reset','/pull'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25cd,0x1c0));var _0xd25c=function(_0x2689d1,_0x50661a){_0x2689d1=_0x2689d1-0x0;var _0x283069=_0x25cd[_0x2689d1];return _0x283069;};'use strict';var express=require('express');var router=express[_0xd25c('0x0')]();var auth=require(_0xd25c('0x1'));var controller=require('./version.controller');router[_0xd25c('0x2')]('/',controller[_0xd25c('0x3')]);router[_0xd25c('0x2')]('/fetch',auth[_0xd25c('0x4')](),auth['canUpdate'](),controller['fetch']);router['get'](_0xd25c('0x5'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xd25c('0x6')]);router[_0xd25c('0x2')](_0xd25c('0x7'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xd25c('0x8')]);router[_0xd25c('0x2')]('/restart',auth[_0xd25c('0x4')](),controller[_0xd25c('0x9')]);router[_0xd25c('0x2')](_0xd25c('0xa'),controller[_0xd25c('0xb')]);module['exports']=router; \ No newline at end of file +var _0xbcee=['/pull','restart','/migrations','migrations','express','../../components/auth/service','./version.controller','index','get','/fetch','isAuthenticated','canUpdate','fetch','reset'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0xbcee,0x66));var _0xebce=function(_0x48c82c,_0x5d6538){_0x48c82c=_0x48c82c-0x0;var _0x25b5a6=_0xbcee[_0x48c82c];return _0x25b5a6;};'use strict';var express=require(_0xebce('0x0'));var router=express['Router']();var auth=require(_0xebce('0x1'));var controller=require(_0xebce('0x2'));router['get']('/',controller[_0xebce('0x3')]);router[_0xebce('0x4')](_0xebce('0x5'),auth[_0xebce('0x6')](),auth[_0xebce('0x7')](),controller[_0xebce('0x8')]);router[_0xebce('0x4')]('/reset',auth[_0xebce('0x6')](),auth['canUpdate'](),controller[_0xebce('0x9')]);router[_0xebce('0x4')](_0xebce('0xa'),auth[_0xebce('0x6')](),auth[_0xebce('0x7')](),controller['pull']);router[_0xebce('0x4')]('/restart',auth[_0xebce('0x6')](),controller[_0xebce('0xb')]);router['get'](_0xebce('0xc'),controller[_0xebce('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 bc90251..9ab3663 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 _0xcaad=['path','lodash','version','compare-versions','../../config/environment','../../config/pm2','../../config/logger','update','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','.js','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug'];(function(_0x351d41,_0x591817){var _0x2dce86=function(_0x22233b){while(--_0x22233b){_0x351d41['push'](_0x351d41['shift']());}};_0x2dce86(++_0x591817);}(_0xcaad,0x1dc));var _0xdcaa=function(_0x467280,_0x2d4f5f){_0x467280=_0x467280-0x0;var _0x47fb02=_0xcaad[_0x467280];return _0x47fb02;};'use strict';var Umzug=require(_0xdcaa('0x0'));var path=require(_0xdcaa('0x1'));var fs=require('fs');var _=require(_0xdcaa('0x2'));var pkginfo=require('pkginfo')(module,_0xdcaa('0x3'));var compareVersions=require(_0xdcaa('0x4'));var exec=require('child_process')['exec'];var db=require('../../mysqldb')['db'];var config=require(_0xdcaa('0x5'));var pm2=require(_0xdcaa('0x6'));var logger=require(_0xdcaa('0x7'))(_0xdcaa('0x8'));var git=require('simple-git')(config[_0xdcaa('0x9')]);exports[_0xdcaa('0xa')]=function(_0x380447,_0x2d3f6f){var _0x2d1660={'current':module[_0xdcaa('0xb')][_0xdcaa('0x3')],'phonebar':0x2};if(_0x380447[_0xdcaa('0xc')]&&_0x380447[_0xdcaa('0xc')][_0xdcaa('0xd')]){return git[_0xdcaa('0xe')]()[_0xdcaa('0xf')](function(_0x17154d,_0x4c54ee){_0x2d1660['latest']=(_0x17154d?module[_0xdcaa('0xb')][_0xdcaa('0x3')]:_0x4c54ee[_0xdcaa('0xd')])||_0xdcaa('0x10');return _0x2d3f6f[_0xdcaa('0x11')](0xc8)['json'](_0x2d1660);});}else{return _0x2d3f6f[_0xdcaa('0x11')](0xc8)[_0xdcaa('0x12')](_0x2d1660);}};exports[_0xdcaa('0xe')]=function(_0x3126aa,_0x41b6d2){return git[_0xdcaa('0xe')]([_0xdcaa('0x13'),_0xdcaa('0x14')],function(_0x4d6727){if(_0x4d6727){logger[_0xdcaa('0x15')](_0x4d6727);return _0x41b6d2[_0xdcaa('0x11')](0x1f4)['json'](_0x4d6727);}logger[_0xdcaa('0x16')](_0xdcaa('0x17'));return _0x41b6d2[_0xdcaa('0x11')](0xc8)['json']({'output':_0xdcaa('0x18')});});};exports[_0xdcaa('0x19')]=function(_0x353cb4,_0x5a53c1){return git[_0xdcaa('0x19')]([_0xdcaa('0x1a'),_0xdcaa('0x1b')],function(_0x23fc9f){if(_0x23fc9f){logger['error'](_0x23fc9f);return _0x5a53c1['status'](0x1f4)[_0xdcaa('0x12')](_0x23fc9f);}logger[_0xdcaa('0x16')](_0xdcaa('0x1c'));return _0x5a53c1[_0xdcaa('0x11')](0xc8)[_0xdcaa('0x12')]({'output':_0xdcaa('0x1d')});});};exports['pull']=function(_0x230410,_0x2e2b5e){exec(_0xdcaa('0x1e'),function(_0x57800e,_0x467218,_0x100046){logger[_0xdcaa('0x16')](_0x467218);logger['info'](_0x100046);if(_0x57800e){logger['error'](_0x57800e);return _0x2e2b5e[_0xdcaa('0x11')](0x1f4)['json'](_0x57800e);}return _0x2e2b5e['status'](0xc8)[_0xdcaa('0x12')]({'output':_0x467218});});};exports[_0xdcaa('0x1f')]=function(_0x1103c3,_0x62e190){return pm2[_0xdcaa('0x1f')]('motion2')['then'](function(_0x1eb2f5){logger[_0xdcaa('0x16')]('pm2\x20restart\x20motion\x20%s',_0x1eb2f5);return _0x62e190[_0xdcaa('0x11')](0xc8)[_0xdcaa('0x12')]({'output':_0xdcaa('0x20')});})[_0xdcaa('0x21')](function(_0xf68449){logger[_0xdcaa('0x15')](_0xf68449);return _0x62e190['status'](0x1f4)[_0xdcaa('0x12')](_0xf68449);});};exports[_0xdcaa('0x22')]=function(_0x3c4390,_0x15d003){var _0x27662a=fs[_0xdcaa('0x23')](path[_0xdcaa('0x24')](config[_0xdcaa('0x9')],_0xdcaa('0x25'),_0xdcaa('0x22')));var _0x5691b2=[];for(var _0x272616=0x0;_0x272616<_0x27662a[_0xdcaa('0x26')];_0x272616++){var _0x325504=_0x27662a[_0x272616][_0xdcaa('0x27')](_0xdcaa('0x28'),'');if(compareVersions(module[_0xdcaa('0xb')]['version'],_0x325504)===-0x1){_0x5691b2[_0xdcaa('0x29')](_0x325504);}}if(_0x5691b2['length']){var _0x531c86=_0x5691b2[_0xdcaa('0x2a')](compareVersions);var _0x17ff13=new Umzug({'storage':_0xdcaa('0x2b'),'storageOptions':{'model':db[_0xdcaa('0x2c')],'modelName':_0xdcaa('0x2c'),'columnName':'version'},'migrations':{'params':[db[_0xdcaa('0x2b')]['getQueryInterface'](),db['sequelize'][_0xdcaa('0x2d')],function(){throw new Error(_0xdcaa('0x2e'));}],'path':path[_0xdcaa('0x24')](config[_0xdcaa('0x9')],_0xdcaa('0x25'),_0xdcaa('0x22')),'pattern':/\.js$/}});_0x17ff13['up']({'migrations':_[_0xdcaa('0x2f')](_0x531c86,function(_0x1fb03d){return _0x1fb03d+'.js';})})[_0xdcaa('0x30')](function(){return _0x15d003['status'](0xc8)[_0xdcaa('0x12')]({'output':_0xdcaa('0x31')+module['exports'][_0xdcaa('0x3')]+_0xdcaa('0x32')+_['last'](_0x531c86),'migrations':_[_0xdcaa('0x24')](_0x531c86)});})['catch'](function(_0x40fcfe){if(_0x40fcfe instanceof db['sequelize'][_0xdcaa('0x33')]){return _0x15d003['status'](0xc8)[_0xdcaa('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x15d003[_0xdcaa('0x11')](0x1f4)[_0xdcaa('0x12')](_0x40fcfe);}});}else{return _0x15d003[_0xdcaa('0x11')](0xc8)[_0xdcaa('0x12')]({'output':_0xdcaa('0x34')});}}; \ No newline at end of file +var _0x799a=['2.0.0','status','json','origin','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','info','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','replace','.js','push','length','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x799a,0x196));var _0xa799=function(_0x35695,_0xa0a76e){_0x35695=_0x35695-0x0;var _0x4b4a5b=_0x799a[_0x35695];return _0x4b4a5b;};'use strict';var Umzug=require(_0xa799('0x0'));var path=require(_0xa799('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xa799('0x2'))(module,_0xa799('0x3'));var compareVersions=require('compare-versions');var exec=require(_0xa799('0x4'))[_0xa799('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0xa799('0x6'));var pm2=require(_0xa799('0x7'));var logger=require(_0xa799('0x8'))(_0xa799('0x9'));var git=require(_0xa799('0xa'))(config[_0xa799('0xb')]);exports[_0xa799('0xc')]=function(_0x47a400,_0x12a55b){var _0x39f61b={'current':module[_0xa799('0xd')][_0xa799('0x3')],'phonebar':0x2};if(_0x47a400[_0xa799('0xe')]&&_0x47a400['query'][_0xa799('0xf')]){return git[_0xa799('0x10')]()[_0xa799('0x11')](function(_0x149f40,_0x38e393){_0x39f61b[_0xa799('0xf')]=(_0x149f40?module[_0xa799('0xd')][_0xa799('0x3')]:_0x38e393[_0xa799('0xf')])||_0xa799('0x12');return _0x12a55b[_0xa799('0x13')](0xc8)[_0xa799('0x14')](_0x39f61b);});}else{return _0x12a55b[_0xa799('0x13')](0xc8)['json'](_0x39f61b);}};exports[_0xa799('0x10')]=function(_0x229c2b,_0x1e26f2){return git[_0xa799('0x10')]([_0xa799('0x15'),'master'],function(_0x3080ae){if(_0x3080ae){logger['error'](_0x3080ae);return _0x1e26f2[_0xa799('0x13')](0x1f4)[_0xa799('0x14')](_0x3080ae);}logger['info']('git\x20fetch');return _0x1e26f2['status'](0xc8)[_0xa799('0x14')]({'output':_0xa799('0x16')});});};exports[_0xa799('0x17')]=function(_0x9bb57b,_0x5987cd){return git[_0xa799('0x17')]([_0xa799('0x18'),_0xa799('0x19')],function(_0x5cf185){if(_0x5cf185){logger[_0xa799('0x1a')](_0x5cf185);return _0x5987cd[_0xa799('0x13')](0x1f4)[_0xa799('0x14')](_0x5cf185);}logger[_0xa799('0x1b')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x5987cd[_0xa799('0x13')](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports[_0xa799('0x1c')]=function(_0x36e55a,_0x301598){exec(_0xa799('0x1d'),function(_0x4ca853,_0xbe94df,_0x393f02){logger[_0xa799('0x1b')](_0xbe94df);logger[_0xa799('0x1b')](_0x393f02);if(_0x4ca853){logger[_0xa799('0x1a')](_0x4ca853);return _0x301598[_0xa799('0x13')](0x1f4)[_0xa799('0x14')](_0x4ca853);}return _0x301598[_0xa799('0x13')](0xc8)['json']({'output':_0xbe94df});});};exports[_0xa799('0x1e')]=function(_0x3db8f8,_0x449618){return pm2[_0xa799('0x1e')]('motion2')[_0xa799('0x1f')](function(_0x3154e3){logger[_0xa799('0x1b')](_0xa799('0x20'),_0x3154e3);return _0x449618[_0xa799('0x13')](0xc8)[_0xa799('0x14')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xa799('0x21')](function(_0x3cdcf3){logger[_0xa799('0x1a')](_0x3cdcf3);return _0x449618['status'](0x1f4)[_0xa799('0x14')](_0x3cdcf3);});};exports[_0xa799('0x22')]=function(_0x8c6b2f,_0x923c7f){var _0x59777f=fs[_0xa799('0x23')](path[_0xa799('0x24')](config['root'],_0xa799('0x25'),'migrations'));var _0x1efd55=[];for(var _0x106bdf=0x0;_0x106bdf<_0x59777f['length'];_0x106bdf++){var _0x22fa4d=_0x59777f[_0x106bdf][_0xa799('0x26')](_0xa799('0x27'),'');if(compareVersions(module['exports'][_0xa799('0x3')],_0x22fa4d)===-0x1){_0x1efd55[_0xa799('0x28')](_0x22fa4d);}}if(_0x1efd55[_0xa799('0x29')]){var _0x4959e0=_0x1efd55['sort'](compareVersions);var _0x1ca13c=new Umzug({'storage':_0xa799('0x2a'),'storageOptions':{'model':db[_0xa799('0x2b')],'modelName':_0xa799('0x2b'),'columnName':_0xa799('0x3')},'migrations':{'params':[db[_0xa799('0x2a')][_0xa799('0x2c')](),db['sequelize'][_0xa799('0x2d')],function(){throw new Error(_0xa799('0x2e'));}],'path':path['join'](config[_0xa799('0xb')],_0xa799('0x25'),'migrations'),'pattern':/\.js$/}});_0x1ca13c['up']({'migrations':_[_0xa799('0x2f')](_0x4959e0,function(_0xda9a25){return _0xda9a25+_0xa799('0x27');})})[_0xa799('0x1f')](function(){return _0x923c7f['status'](0xc8)[_0xa799('0x14')]({'output':_0xa799('0x30')+module[_0xa799('0xd')][_0xa799('0x3')]+_0xa799('0x31')+_[_0xa799('0x32')](_0x4959e0),'migrations':_['join'](_0x4959e0)});})[_0xa799('0x21')](function(_0xf48d45){if(_0xf48d45 instanceof db['sequelize'][_0xa799('0x33')]){return _0x923c7f['status'](0xc8)[_0xa799('0x14')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x923c7f[_0xa799('0x13')](0x1f4)[_0xa799('0x14')](_0xf48d45);}});}else{return _0x923c7f[_0xa799('0x13')](0xc8)[_0xa799('0x14')]({'output':_0xa799('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 1d90c3c..94ef415 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 _0x163e=['update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0x163e,0x137));var _0xe163=function(_0x1faaa1,_0x1568dd){_0x1faaa1=_0x1faaa1-0x0;var _0x994ec=_0x163e[_0x1faaa1];return _0x994ec;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe163('0x0'));var timeout=require(_0xe163('0x1'));var express=require(_0xe163('0x2'));var router=express[_0xe163('0x3')]();var fs_extra=require(_0xe163('0x4'));var auth=require(_0xe163('0x5'));var interaction=require(_0xe163('0x6'));var config=require(_0xe163('0x7'));var controller=require(_0xe163('0x8'));router[_0xe163('0x9')]('/',auth[_0xe163('0xa')](),controller[_0xe163('0xb')]);router[_0xe163('0x9')](_0xe163('0xc'),auth[_0xe163('0xa')](),controller[_0xe163('0xd')]);router[_0xe163('0x9')](_0xe163('0xe'),auth[_0xe163('0xa')](),controller[_0xe163('0xf')]);router[_0xe163('0x10')]('/',auth[_0xe163('0xa')](),controller[_0xe163('0x11')]);router[_0xe163('0x12')](_0xe163('0xe'),auth[_0xe163('0xa')](),controller[_0xe163('0x13')]);router[_0xe163('0x14')]('/:id',auth[_0xe163('0xa')](),controller['destroy']);module[_0xe163('0x15')]=router; \ No newline at end of file +var _0xbf85=['post','put','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get','/:id'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0xbf85,0x137));var _0x5bf8=function(_0xe046d1,_0x323423){_0xe046d1=_0xe046d1-0x0;var _0x18a7b6=_0xbf85[_0xe046d1];return _0x18a7b6;};'use strict';var multer=require(_0x5bf8('0x0'));var util=require(_0x5bf8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5bf8('0x2'));var router=express[_0x5bf8('0x3')]();var fs_extra=require(_0x5bf8('0x4'));var auth=require(_0x5bf8('0x5'));var interaction=require(_0x5bf8('0x6'));var config=require(_0x5bf8('0x7'));var controller=require(_0x5bf8('0x8'));router['get']('/',auth[_0x5bf8('0x9')](),controller[_0x5bf8('0xa')]);router[_0x5bf8('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5bf8('0xb')](_0x5bf8('0xc'),auth[_0x5bf8('0x9')](),controller['show']);router[_0x5bf8('0xd')]('/',auth[_0x5bf8('0x9')](),controller['create']);router[_0x5bf8('0xe')]('/:id',auth[_0x5bf8('0x9')](),controller[_0x5bf8('0xf')]);router[_0x5bf8('0x10')](_0x5bf8('0xc'),auth[_0x5bf8('0x9')](),controller['destroy']);module[_0x5bf8('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 ce12a40..d6d5475 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 _0x9158=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0xb85d6f,_0x2a6d08){var _0x20bac9=function(_0x19f4f2){while(--_0x19f4f2){_0xb85d6f['push'](_0xb85d6f['shift']());}};_0x20bac9(++_0x2a6d08);}(_0x9158,0x16e));var _0x8915=function(_0x3953fe,_0x5d0a7d){_0x3953fe=_0x3953fe-0x0;var _0x272cba=_0x9158[_0x3953fe];return _0x272cba;};'use strict';var Sequelize=require(_0x8915('0x0'));module[_0x8915('0x1')]={'type':{'type':Sequelize[_0x8915('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8915('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x8915('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x8915('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8915('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x8915('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x8915('0x3')]},'agentdumpAt':{'type':Sequelize[_0x8915('0x3')]},'holdtime':{'type':Sequelize[_0x8915('0x4')]},'agentcomplete':{'type':Sequelize[_0x8915('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x8915('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8915('0x4')]},'agentacw':{'type':Sequelize[_0x8915('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8915('0x4')]},'reason':{'type':Sequelize[_0x8915('0x2')]},'lastevent':{'type':Sequelize[_0x8915('0x2')]},'channel':{'type':Sequelize[_0x8915('0x2')]},'channelstate':{'type':Sequelize[_0x8915('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x8915('0x2')]},'language':{'type':Sequelize[_0x8915('0x2')]},'accountcode':{'type':Sequelize[_0x8915('0x2')]},'context':{'type':Sequelize[_0x8915('0x2')]},'exten':{'type':Sequelize[_0x8915('0x2')]},'priority':{'type':Sequelize[_0x8915('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x8915('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x8915('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x8915('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x8915('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x8915('0x2')]},'destcontext':{'type':Sequelize[_0x8915('0x2')]},'destexten':{'type':Sequelize[_0x8915('0x2')]},'destpriority':{'type':Sequelize[_0x8915('0x2')]},'destuniqueid':{'type':Sequelize[_0x8915('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x8915('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x8915('0x2')]},'transfer':{'type':Sequelize[_0x8915('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8915('0x2')],'comment':_0x8915('0x6')},'transferexten':{'type':Sequelize[_0x8915('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x8915('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0664=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x0664,0x93));var _0x4066=function(_0x306c5d,_0x2ef4e8){_0x306c5d=_0x306c5d-0x0;var _0x5d823b=_0x0664[_0x306c5d];return _0x5d823b;};'use strict';var Sequelize=require('sequelize');module[_0x4066('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4066('0x1')]},'calleridnum':{'type':Sequelize[_0x4066('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4066('0x1')]},'interface':{'type':Sequelize[_0x4066('0x1')]},'membername':{'type':Sequelize[_0x4066('0x1')]},'agentcalledAt':{'type':Sequelize[_0x4066('0x2')]},'agentconnectAt':{'type':Sequelize[_0x4066('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x4066('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x4066('0x2')]},'agentdumpAt':{'type':Sequelize[_0x4066('0x2')]},'holdtime':{'type':Sequelize[_0x4066('0x3')]},'agentcomplete':{'type':Sequelize[_0x4066('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4066('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x4066('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4066('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4066('0x1')]},'channelstate':{'type':Sequelize[_0x4066('0x3')]},'channelstatedesc':{'type':Sequelize[_0x4066('0x1')]},'connectedlinenum':{'type':Sequelize[_0x4066('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4066('0x1')]},'priority':{'type':Sequelize[_0x4066('0x1')]},'destchannel':{'type':Sequelize[_0x4066('0x1')]},'destchannelstate':{'type':Sequelize[_0x4066('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x4066('0x1')]},'destcalleridnum':{'type':Sequelize[_0x4066('0x1')]},'destcalleridname':{'type':Sequelize[_0x4066('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x4066('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x4066('0x1')]},'destaccountcode':{'type':Sequelize[_0x4066('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x4066('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x4066('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x4066('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4066('0x1')],'comment':_0x4066('0x5')},'transferexten':{'type':Sequelize[_0x4066('0x1')]},'transferuniqueid':{'type':Sequelize[_0x4066('0x1')]},'agententerreason':{'type':Sequelize[_0x4066('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 93c338b..6c53d23 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(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 4b73e09..2a63489 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 _0x39d9=['path','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x184b30,_0x87f8ea){var _0x4655be=function(_0x532a42){while(--_0x532a42){_0x184b30['push'](_0x184b30['shift']());}};_0x4655be(++_0x87f8ea);}(_0x39d9,0x17f));var _0x939d=function(_0x193285,_0x2b4c2e){_0x193285=_0x193285-0x0;var _0x41ddf9=_0x39d9[_0x193285];return _0x41ddf9;};'use strict';var _=require(_0x939d('0x0'));var util=require(_0x939d('0x1'));var logger=require(_0x939d('0x2'))(_0x939d('0x3'));var moment=require(_0x939d('0x4'));var BPromise=require(_0x939d('0x5'));var rp=require(_0x939d('0x6'));var fs=require('fs');var path=require(_0x939d('0x7'));var rimraf=require('rimraf');var config=require(_0x939d('0x8'));var attributes=require(_0x939d('0x9'));module[_0x939d('0xa')]=function(_0x48b22f,_0x41c89f){return _0x48b22f['define'](_0x939d('0xb'),attributes,{'tableName':_0x939d('0xc'),'paranoid':![],'indexes':[{'fields':[_0x939d('0xd'),_0x939d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a3a=['./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x5563a9,_0xfa9726){var _0x1fdbbd=function(_0x6a34df){while(--_0x6a34df){_0x5563a9['push'](_0x5563a9['shift']());}};_0x1fdbbd(++_0xfa9726);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x1a303a,_0x57335a){_0x1a303a=_0x1a303a-0x0;var _0xe3ead2=_0x2a3a[_0x1a303a];return _0xe3ead2;};'use strict';var _=require(_0xa2a3('0x0'));var util=require(_0xa2a3('0x1'));var logger=require(_0xa2a3('0x2'))(_0xa2a3('0x3'));var moment=require(_0xa2a3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2a3('0x5'));var rimraf=require(_0xa2a3('0x6'));var config=require(_0xa2a3('0x7'));var attributes=require(_0xa2a3('0x8'));module[_0xa2a3('0x9')]=function(_0xf652d7,_0x186655){return _0xf652d7['define'](_0xa2a3('0xa'),attributes,{'tableName':_0xa2a3('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa2a3('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 26e6bb1..5d8e9b0 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 _0x7f03=['VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','raw','update','options','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x7f03,0x191));var _0x37f0=function(_0x2d09cb,_0x534602){_0x2d09cb=_0x2d09cb-0x0;var _0x3ac390=_0x7f03[_0x2d09cb];return _0x3ac390;};'use strict';var _=require(_0x37f0('0x0'));var util=require(_0x37f0('0x1'));var moment=require(_0x37f0('0x2'));var BPromise=require('bluebird');var rs=require(_0x37f0('0x3'));var fs=require('fs');var Redis=require(_0x37f0('0x4'));var db=require(_0x37f0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x37f0('0x6'))(_0x37f0('0x7'));var config=require('../../config/environment');var jayson=require(_0x37f0('0x8'));var client=jayson['client'][_0x37f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2605c6,_0x3355cc,_0x57e48c){return new BPromise(function(_0x2bf68c,_0x593143){return client['request'](_0x2605c6,_0x57e48c)[_0x37f0('0xa')](function(_0x253475){logger[_0x37f0('0xb')](_0x37f0('0xc'),_0x3355cc,_0x37f0('0xd'));logger[_0x37f0('0xe')](_0x37f0('0xf'),_0x3355cc,'request\x20sent',JSON[_0x37f0('0x10')](_0x253475));if(_0x253475[_0x37f0('0x11')]){if(_0x253475[_0x37f0('0x11')]['code']===0x1f4){logger[_0x37f0('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x3355cc,_0x253475[_0x37f0('0x11')][_0x37f0('0x12')]);return _0x593143(_0x253475['error'][_0x37f0('0x12')]);}logger[_0x37f0('0x11')](_0x37f0('0xc'),_0x3355cc,_0x253475[_0x37f0('0x11')][_0x37f0('0x12')]);return _0x2bf68c(_0x253475[_0x37f0('0x11')]['message']);}else{logger['info'](_0x37f0('0xc'),_0x3355cc,_0x37f0('0xd'));_0x2bf68c(_0x253475[_0x37f0('0x13')][_0x37f0('0x12')]);}})[_0x37f0('0x14')](function(_0xac64df){logger[_0x37f0('0x11')](_0x37f0('0xc'),_0x3355cc,_0xac64df);_0x593143(_0xac64df);});});}exports[_0x37f0('0x15')]=function(_0x3d14e9){var _0x3045d7=this;return new Promise(function(_0x32e246,_0x37fbc0){return db[_0x37f0('0x16')][_0x37f0('0x17')](_0x3d14e9[_0x37f0('0x18')],{'raw':_0x3d14e9['options']?_0x3d14e9['options'][_0x37f0('0x19')]===undefined?!![]:![]:!![]})[_0x37f0('0xa')](function(_0xe7db48){logger[_0x37f0('0xb')]('CreateVoiceAgentReport',_0x3d14e9);logger['debug'](_0x37f0('0x15'),_0x3d14e9,JSON[_0x37f0('0x10')](_0xe7db48));_0x32e246(_0xe7db48);})[_0x37f0('0x14')](function(_0x23819a){logger[_0x37f0('0x11')](_0x37f0('0x15'),_0x23819a[_0x37f0('0x12')],_0x3d14e9);_0x37fbc0(_0x3045d7[_0x37f0('0x11')](0x1f4,_0x23819a['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x27fd38){var _0x34a05a=this;return new Promise(function(_0xdc5849,_0x3d725f){return db[_0x37f0('0x16')][_0x37f0('0x1a')](_0x27fd38[_0x37f0('0x18')],{'raw':_0x27fd38[_0x37f0('0x1b')]?_0x27fd38[_0x37f0('0x1b')][_0x37f0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27fd38[_0x37f0('0x1b')]?_0x27fd38[_0x37f0('0x1b')][_0x37f0('0x1c')]||null:null,'attributes':_0x27fd38[_0x37f0('0x1b')]?_0x27fd38[_0x37f0('0x1b')][_0x37f0('0x1d')]||null:null,'limit':_0x27fd38['options']?_0x27fd38[_0x37f0('0x1b')][_0x37f0('0x1e')]||null:null})['then'](function(_0x50d926){logger['info'](_0x37f0('0x1f'),_0x27fd38);logger[_0x37f0('0xe')]('UpdateVoiceAgentReport',_0x27fd38,JSON[_0x37f0('0x10')](_0x50d926));_0xdc5849(_0x50d926);})[_0x37f0('0x14')](function(_0x1fc0ed){logger[_0x37f0('0x11')]('UpdateVoiceAgentReport',_0x1fc0ed[_0x37f0('0x12')],_0x27fd38);_0x3d725f(_0x34a05a[_0x37f0('0x11')](0x1f4,_0x1fc0ed[_0x37f0('0x12')]));});});}; \ No newline at end of file +var _0x157a=['update','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','info','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','then','UpdateVoiceAgentReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x157a,0x110));var _0xa157=function(_0x389318,_0x13a53d){_0x389318=_0x389318-0x0;var _0x7919e3=_0x157a[_0x389318];return _0x7919e3;};'use strict';var _=require(_0xa157('0x0'));var util=require('util');var moment=require(_0xa157('0x1'));var BPromise=require(_0xa157('0x2'));var rs=require(_0xa157('0x3'));var fs=require('fs');var Redis=require(_0xa157('0x4'));var db=require(_0xa157('0x5'))['db'];var utils=require(_0xa157('0x6'));var logger=require('../../config/logger')(_0xa157('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa157('0x8')][_0xa157('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4433a8,_0x573277,_0x155150){return new BPromise(function(_0x17e832,_0xb526e){return client['request'](_0x4433a8,_0x155150)['then'](function(_0x1de3c6){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x573277,_0xa157('0xa'));logger[_0xa157('0xb')](_0xa157('0xc'),_0x573277,_0xa157('0xa'),JSON[_0xa157('0xd')](_0x1de3c6));if(_0x1de3c6['error']){if(_0x1de3c6[_0xa157('0xe')][_0xa157('0xf')]===0x1f4){logger[_0xa157('0xe')](_0xa157('0x10'),_0x573277,_0x1de3c6[_0xa157('0xe')][_0xa157('0x11')]);return _0xb526e(_0x1de3c6[_0xa157('0xe')][_0xa157('0x11')]);}logger[_0xa157('0xe')](_0xa157('0x10'),_0x573277,_0x1de3c6[_0xa157('0xe')][_0xa157('0x11')]);return _0x17e832(_0x1de3c6['error']['message']);}else{logger[_0xa157('0x12')](_0xa157('0x10'),_0x573277,_0xa157('0xa'));_0x17e832(_0x1de3c6['result'][_0xa157('0x11')]);}})[_0xa157('0x13')](function(_0x3118c7){logger[_0xa157('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x573277,_0x3118c7);_0xb526e(_0x3118c7);});});}exports[_0xa157('0x14')]=function(_0x4c9488){var _0x518436=this;return new Promise(function(_0x40af92,_0x361879){return db[_0xa157('0x15')][_0xa157('0x16')](_0x4c9488[_0xa157('0x17')],{'raw':_0x4c9488[_0xa157('0x18')]?_0x4c9488[_0xa157('0x18')][_0xa157('0x19')]===undefined?!![]:![]:!![]})[_0xa157('0x1a')](function(_0x268a0c){logger[_0xa157('0x12')](_0xa157('0x14'),_0x4c9488);logger['debug']('CreateVoiceAgentReport',_0x4c9488,JSON[_0xa157('0xd')](_0x268a0c));_0x40af92(_0x268a0c);})['catch'](function(_0x4601ed){logger[_0xa157('0xe')](_0xa157('0x14'),_0x4601ed[_0xa157('0x11')],_0x4c9488);_0x361879(_0x518436['error'](0x1f4,_0x4601ed[_0xa157('0x11')]));});});};exports[_0xa157('0x1b')]=function(_0x1d01aa){var _0x226af7=this;return new Promise(function(_0x14a3fe,_0x167f0e){return db['VoiceAgentReport'][_0xa157('0x1c')](_0x1d01aa['body'],{'raw':_0x1d01aa[_0xa157('0x18')]?_0x1d01aa['options'][_0xa157('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d01aa[_0xa157('0x18')]?_0x1d01aa[_0xa157('0x18')]['where']||null:null,'attributes':_0x1d01aa[_0xa157('0x18')]?_0x1d01aa['options']['attributes']||null:null,'limit':_0x1d01aa['options']?_0x1d01aa[_0xa157('0x18')][_0xa157('0x1d')]||null:null})['then'](function(_0x580c60){logger[_0xa157('0x12')](_0xa157('0x1b'),_0x1d01aa);logger[_0xa157('0xb')](_0xa157('0x1b'),_0x1d01aa,JSON[_0xa157('0xd')](_0x580c60));_0x14a3fe(_0x580c60);})['catch'](function(_0xb8bdec){logger['error'](_0xa157('0x1b'),_0xb8bdec[_0xa157('0x11')],_0x1d01aa);_0x167f0e(_0x226af7[_0xa157('0xe')](0x1f4,_0xb8bdec[_0xa157('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index c331197..f29638d 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 _0x0309=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','index','get','isAuthenticated','/:id','post','create','update','delete','destroy','multer','path','express'];(function(_0x300522,_0x4562b4){var _0x536ff5=function(_0x3158b4){while(--_0x3158b4){_0x300522['push'](_0x300522['shift']());}};_0x536ff5(++_0x4562b4);}(_0x0309,0x165));var _0x9030=function(_0x497621,_0x406008){_0x497621=_0x497621-0x0;var _0x4a3d26=_0x0309[_0x497621];return _0x4a3d26;};'use strict';var multer=require(_0x9030('0x0'));var util=require('util');var path=require(_0x9030('0x1'));var timeout=require('connect-timeout');var express=require(_0x9030('0x2'));var router=express[_0x9030('0x3')]();var fs_extra=require(_0x9030('0x4'));var auth=require(_0x9030('0x5'));var interaction=require(_0x9030('0x6'));var config=require(_0x9030('0x7'));var controller=require(_0x9030('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9030('0x9')]);router[_0x9030('0xa')]('/describe',auth[_0x9030('0xb')](),controller['describe']);router[_0x9030('0xa')](_0x9030('0xc'),auth[_0x9030('0xb')](),controller['show']);router[_0x9030('0xd')]('/',auth[_0x9030('0xb')](),controller[_0x9030('0xe')]);router['put'](_0x9030('0xc'),auth[_0x9030('0xb')](),controller[_0x9030('0xf')]);router[_0x9030('0x10')](_0x9030('0xc'),auth[_0x9030('0xb')](),controller[_0x9030('0x11')]);module['exports']=router; \ No newline at end of file +var _0x008c=['../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','show','post','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x008c,0x188));var _0xc008=function(_0x320b8e,_0x1da3fe){_0x320b8e=_0x320b8e-0x0;var _0x55a10a=_0x008c[_0x320b8e];return _0x55a10a;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['update']);router[_0xc008('0x10')](_0xc008('0xf'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);module[_0xc008('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index dae02b6..a12698c 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 _0x1a76=['ENUM','inbound','internal','inbound-fax','dialer','DATE','INTEGER','exports','STRING'];(function(_0x39336c,_0x5e008d){var _0x3b93b4=function(_0x25c218){while(--_0x25c218){_0x39336c['push'](_0x39336c['shift']());}};_0x3b93b4(++_0x5e008d);}(_0x1a76,0xf1));var _0x61a7=function(_0x2d8434,_0x43d781){_0x2d8434=_0x2d8434-0x0;var _0x26b9e4=_0x1a76[_0x2d8434];return _0x26b9e4;};'use strict';var Sequelize=require('sequelize');module[_0x61a7('0x0')]={'uniqueid':{'type':Sequelize[_0x61a7('0x1')]},'type':{'type':Sequelize[_0x61a7('0x2')](_0x61a7('0x3'),_0x61a7('0x4'),'outbound',_0x61a7('0x5'),'outbound-fax',_0x61a7('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x61a7('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x61a7('0x1')]},'destinationcontext':{'type':Sequelize[_0x61a7('0x1')]},'callerid':{'type':Sequelize[_0x61a7('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x61a7('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x61a7('0x7')]},'systemanswertime':{'type':Sequelize[_0x61a7('0x7')]},'answertime':{'type':Sequelize[_0x61a7('0x7')]},'endtime':{'type':Sequelize[_0x61a7('0x7')]},'duration':{'type':Sequelize[_0x61a7('0x8')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x61a7('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x61a7('0x1')]},'userfield':{'type':Sequelize[_0x61a7('0x1')]},'userDisposition':{'type':Sequelize[_0x61a7('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x61a7('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x61a7('0x1')]},'note':{'type':Sequelize[_0x61a7('0x1')]},'prefix':{'type':Sequelize[_0x61a7('0x1')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x61a7('0x1')]}}; \ No newline at end of file +var _0xf4a0=['dialer','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound','outbound-fax'];(function(_0x310eb9,_0x1aed15){var _0x28915c=function(_0x457fd6){while(--_0x457fd6){_0x310eb9['push'](_0x310eb9['shift']());}};_0x28915c(++_0x1aed15);}(_0xf4a0,0x1f2));var _0x0f4a=function(_0x34db0c,_0x1cb45f){_0x34db0c=_0x34db0c-0x0;var _0x5cbef3=_0xf4a0[_0x34db0c];return _0x5cbef3;};'use strict';var Sequelize=require(_0x0f4a('0x0'));module[_0x0f4a('0x1')]={'uniqueid':{'type':Sequelize[_0x0f4a('0x2')]},'type':{'type':Sequelize[_0x0f4a('0x3')](_0x0f4a('0x4'),_0x0f4a('0x5'),_0x0f4a('0x6'),'inbound-fax',_0x0f4a('0x7'),_0x0f4a('0x8'))},'tag':{'type':Sequelize[_0x0f4a('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x0f4a('0x2')]},'destination':{'type':Sequelize[_0x0f4a('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0f4a('0x2')]},'channel':{'type':Sequelize[_0x0f4a('0x2')]},'destinationchannel':{'type':Sequelize[_0x0f4a('0x2')]},'lastapplication':{'type':Sequelize[_0x0f4a('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x0f4a('0x9')]},'systemanswertime':{'type':Sequelize[_0x0f4a('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x0f4a('0x9')]},'duration':{'type':Sequelize[_0x0f4a('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x0f4a('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0f4a('0x2')]},'amaflags':{'type':Sequelize[_0x0f4a('0x2')]},'userfield':{'type':Sequelize[_0x0f4a('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x0f4a('0x2')]},'note':{'type':Sequelize[_0x0f4a('0x2')]},'prefix':{'type':Sequelize[_0x0f4a('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x0f4a('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 6c3c79d..3992b07 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 _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x1d633f,_0xbc2fda){_0x1d633f=_0x1d633f-0x0;var _0xf24c8a=_0x2032[_0x1d633f];return _0xf24c8a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x5d30f9,_0x16447b){var _0x4c9f07=function(_0x300347){while(--_0x300347){_0x5d30f9['push'](_0x5d30f9['shift']());}};_0x4c9f07(++_0x16447b);}(_0xb10b,0x12a));var _0xbb10=function(_0x137815,_0x78dd4b){_0x137815=_0x137815-0x0;var _0x29ded1=_0xb10b[_0x137815];return _0x29ded1;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 3392257..9bd70d8 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 _0x12ee=['api','bluebird','request-promise','path','rimraf','exports','define','report_call','uniqueid','../../config/logger'];(function(_0x236572,_0x5eec3f){var _0x479a92=function(_0x3401d8){while(--_0x3401d8){_0x236572['push'](_0x236572['shift']());}};_0x479a92(++_0x5eec3f);}(_0x12ee,0x1a3));var _0xe12e=function(_0x343a5a,_0x55f1a1){_0x343a5a=_0x343a5a-0x0;var _0x323b5f=_0x12ee[_0x343a5a];return _0x323b5f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe12e('0x0'))(_0xe12e('0x1'));var moment=require('moment');var BPromise=require(_0xe12e('0x2'));var rp=require(_0xe12e('0x3'));var fs=require('fs');var path=require(_0xe12e('0x4'));var rimraf=require(_0xe12e('0x5'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0xe12e('0x6')]=function(_0x416f79,_0xf7140a){return _0x416f79[_0xe12e('0x7')]('VoiceCallReport',attributes,{'tableName':_0xe12e('0x8'),'paranoid':![],'indexes':[{'fields':[_0xe12e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2bda=['uniqueid','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call'];(function(_0x1785a2,_0x15d901){var _0x58380c=function(_0x2739e8){while(--_0x2739e8){_0x1785a2['push'](_0x1785a2['shift']());}};_0x58380c(++_0x15d901);}(_0x2bda,0x1e1));var _0xa2bd=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0x2bda[_0x1e4f2d];return _0xd05ce5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa2bd('0x0'))('api');var moment=require(_0xa2bd('0x1'));var BPromise=require(_0xa2bd('0x2'));var rp=require(_0xa2bd('0x3'));var fs=require('fs');var path=require(_0xa2bd('0x4'));var rimraf=require('rimraf');var config=require(_0xa2bd('0x5'));var attributes=require(_0xa2bd('0x6'));module[_0xa2bd('0x7')]=function(_0x4c257c,_0x248060){return _0x4c257c[_0xa2bd('0x8')](_0xa2bd('0x9'),attributes,{'tableName':_0xa2bd('0xa'),'paranoid':![],'indexes':[{'fields':[_0xa2bd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 2a02896..3ba7c84 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 _0x9728=['stringify','error','code','message','result','GetVoiceCallReport','options','raw','where','attributes','limit','include','map','model','catch','CreateVoiceCallReport','VoiceCallReport','body','UpdateVoiceCallReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s'];(function(_0x4997e6,_0x49fb00){var _0x4fa7d8=function(_0x3a8c05){while(--_0x3a8c05){_0x4997e6['push'](_0x4997e6['shift']());}};_0x4fa7d8(++_0x49fb00);}(_0x9728,0x13c));var _0x8972=function(_0x3645a3,_0x18f645){_0x3645a3=_0x3645a3-0x0;var _0xbf0d07=_0x9728[_0x3645a3];return _0xbf0d07;};'use strict';var _=require(_0x8972('0x0'));var util=require(_0x8972('0x1'));var moment=require('moment');var BPromise=require(_0x8972('0x2'));var rs=require(_0x8972('0x3'));var fs=require('fs');var Redis=require(_0x8972('0x4'));var db=require(_0x8972('0x5'))['db'];var utils=require(_0x8972('0x6'));var logger=require(_0x8972('0x7'))('rpc');var config=require(_0x8972('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8972('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2089bc,_0x3d8703,_0x54780f){return new BPromise(function(_0x24197f,_0x1d80ce){return client[_0x8972('0xa')](_0x2089bc,_0x54780f)[_0x8972('0xb')](function(_0x22a668){logger[_0x8972('0xc')](_0x8972('0xd'),_0x3d8703,_0x8972('0xe'));logger[_0x8972('0xf')](_0x8972('0x10'),_0x3d8703,'request\x20sent',JSON[_0x8972('0x11')](_0x22a668));if(_0x22a668[_0x8972('0x12')]){if(_0x22a668['error'][_0x8972('0x13')]===0x1f4){logger[_0x8972('0x12')](_0x8972('0xd'),_0x3d8703,_0x22a668[_0x8972('0x12')][_0x8972('0x14')]);return _0x1d80ce(_0x22a668[_0x8972('0x12')]['message']);}logger[_0x8972('0x12')](_0x8972('0xd'),_0x3d8703,_0x22a668[_0x8972('0x12')][_0x8972('0x14')]);return _0x24197f(_0x22a668[_0x8972('0x12')]['message']);}else{logger[_0x8972('0xc')](_0x8972('0xd'),_0x3d8703,_0x8972('0xe'));_0x24197f(_0x22a668[_0x8972('0x15')][_0x8972('0x14')]);}})['catch'](function(_0x475304){logger[_0x8972('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x3d8703,_0x475304);_0x1d80ce(_0x475304);});});}exports[_0x8972('0x16')]=function(_0x2d6099){var _0x25018b=this;return new Promise(function(_0x6b8890,_0x3635bb){return db['VoiceCallReport']['findAll']({'raw':_0x2d6099[_0x8972('0x17')]?_0x2d6099['options'][_0x8972('0x18')]===undefined?!![]:![]:!![],'where':_0x2d6099[_0x8972('0x17')]?_0x2d6099[_0x8972('0x17')][_0x8972('0x19')]||null:null,'attributes':_0x2d6099['options']?_0x2d6099[_0x8972('0x17')][_0x8972('0x1a')]||null:null,'limit':_0x2d6099['options']?_0x2d6099['options'][_0x8972('0x1b')]||null:null,'include':_0x2d6099[_0x8972('0x17')]?_0x2d6099[_0x8972('0x17')][_0x8972('0x1c')]?_[_0x8972('0x1d')](_0x2d6099[_0x8972('0x17')][_0x8972('0x1c')],function(_0x2a7750){return{'model':db[_0x2a7750['model']],'as':_0x2a7750['as'],'attributes':_0x2a7750[_0x8972('0x1a')],'include':_0x2a7750[_0x8972('0x1c')]?_['map'](_0x2a7750[_0x8972('0x1c')],function(_0x354fd5){return{'model':db[_0x354fd5[_0x8972('0x1e')]],'as':_0x354fd5['as'],'attributes':_0x354fd5['attributes'],'include':_0x354fd5['include']?_[_0x8972('0x1d')](_0x354fd5[_0x8972('0x1c')],function(_0x1fe668){return{'model':db[_0x1fe668[_0x8972('0x1e')]],'as':_0x1fe668['as'],'attributes':_0x1fe668[_0x8972('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8972('0xb')](function(_0x13d84d){logger['info'](_0x8972('0x16'),_0x2d6099);logger[_0x8972('0xf')](_0x8972('0x16'),_0x2d6099,JSON[_0x8972('0x11')](_0x13d84d));_0x6b8890(_0x13d84d);})[_0x8972('0x1f')](function(_0x16a949){logger[_0x8972('0x12')](_0x8972('0x16'),_0x16a949[_0x8972('0x14')],_0x2d6099);_0x3635bb(_0x25018b[_0x8972('0x12')](0x1f4,_0x16a949[_0x8972('0x14')]));});});};exports[_0x8972('0x20')]=function(_0x7a0174){var _0x12606a=this;return new Promise(function(_0x53d313,_0x50ecc2){return db[_0x8972('0x21')]['create'](_0x7a0174[_0x8972('0x22')],{'raw':_0x7a0174[_0x8972('0x17')]?_0x7a0174['options'][_0x8972('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x35da09){logger[_0x8972('0xc')](_0x8972('0x20'),_0x7a0174);logger[_0x8972('0xf')](_0x8972('0x20'),_0x7a0174,JSON[_0x8972('0x11')](_0x35da09));_0x53d313(_0x35da09);})[_0x8972('0x1f')](function(_0x182da5){logger[_0x8972('0x12')](_0x8972('0x20'),_0x182da5[_0x8972('0x14')],_0x7a0174);_0x50ecc2(_0x12606a[_0x8972('0x12')](0x1f4,_0x182da5[_0x8972('0x14')]));});});};exports[_0x8972('0x23')]=function(_0x24d1c9){var _0x49098c=this;return new Promise(function(_0x25cd1b,_0x3c3a6e){return db[_0x8972('0x21')][_0x8972('0x24')](_0x24d1c9['body'],{'raw':_0x24d1c9[_0x8972('0x17')]?_0x24d1c9[_0x8972('0x17')][_0x8972('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24d1c9[_0x8972('0x17')]?_0x24d1c9[_0x8972('0x17')][_0x8972('0x19')]||null:null,'attributes':_0x24d1c9[_0x8972('0x17')]?_0x24d1c9[_0x8972('0x17')]['attributes']||null:null,'limit':_0x24d1c9[_0x8972('0x17')]?_0x24d1c9[_0x8972('0x17')][_0x8972('0x1b')]||null:null})['then'](function(_0x27b6be){logger[_0x8972('0xc')]('UpdateVoiceCallReport',_0x24d1c9);logger[_0x8972('0xf')](_0x8972('0x23'),_0x24d1c9,JSON[_0x8972('0x11')](_0x27b6be));_0x25cd1b(_0x27b6be);})['catch'](function(_0x6f31e5){logger[_0x8972('0x12')](_0x8972('0x23'),_0x6f31e5[_0x8972('0x14')],_0x24d1c9);_0x3c3a6e(_0x49098c[_0x8972('0x12')](0x1f4,_0x6f31e5['message']));});});}; \ No newline at end of file +var _0x138f=['where','limit','include','map','model','attributes','CreateVoiceCallReport','create','UpdateVoiceCallReport','update','body','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw'];(function(_0x5e085f,_0x3dfc96){var _0x340095=function(_0x558a4f){while(--_0x558a4f){_0x5e085f['push'](_0x5e085f['shift']());}};_0x340095(++_0x3dfc96);}(_0x138f,0xbf));var _0xf138=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0x138f[_0x350aeb];return _0x3c5273;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf138('0x0'));var rs=require(_0xf138('0x1'));var fs=require('fs');var Redis=require(_0xf138('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf138('0x3'));var logger=require(_0xf138('0x4'))('rpc');var config=require(_0xf138('0x5'));var jayson=require(_0xf138('0x6'));var client=jayson[_0xf138('0x7')][_0xf138('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f8727,_0x491cc4,_0x3cd422){return new BPromise(function(_0x290d62,_0x28b732){return client['request'](_0x4f8727,_0x3cd422)[_0xf138('0x9')](function(_0x7e634c){logger['info'](_0xf138('0xa'),_0x491cc4,_0xf138('0xb'));logger[_0xf138('0xc')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x491cc4,_0xf138('0xb'),JSON[_0xf138('0xd')](_0x7e634c));if(_0x7e634c['error']){if(_0x7e634c[_0xf138('0xe')][_0xf138('0xf')]===0x1f4){logger[_0xf138('0xe')](_0xf138('0xa'),_0x491cc4,_0x7e634c[_0xf138('0xe')][_0xf138('0x10')]);return _0x28b732(_0x7e634c[_0xf138('0xe')][_0xf138('0x10')]);}logger['error'](_0xf138('0xa'),_0x491cc4,_0x7e634c[_0xf138('0xe')][_0xf138('0x10')]);return _0x290d62(_0x7e634c[_0xf138('0xe')]['message']);}else{logger[_0xf138('0x11')](_0xf138('0xa'),_0x491cc4,_0xf138('0xb'));_0x290d62(_0x7e634c[_0xf138('0x12')][_0xf138('0x10')]);}})[_0xf138('0x13')](function(_0x2ad95f){logger[_0xf138('0xe')](_0xf138('0xa'),_0x491cc4,_0x2ad95f);_0x28b732(_0x2ad95f);});});}exports[_0xf138('0x14')]=function(_0x1f643a){var _0x2a1f9=this;return new Promise(function(_0x5d8a36,_0x359a09){return db[_0xf138('0x15')][_0xf138('0x16')]({'raw':_0x1f643a[_0xf138('0x17')]?_0x1f643a[_0xf138('0x17')][_0xf138('0x18')]===undefined?!![]:![]:!![],'where':_0x1f643a[_0xf138('0x17')]?_0x1f643a[_0xf138('0x17')][_0xf138('0x19')]||null:null,'attributes':_0x1f643a[_0xf138('0x17')]?_0x1f643a[_0xf138('0x17')]['attributes']||null:null,'limit':_0x1f643a[_0xf138('0x17')]?_0x1f643a[_0xf138('0x17')][_0xf138('0x1a')]||null:null,'include':_0x1f643a[_0xf138('0x17')]?_0x1f643a[_0xf138('0x17')][_0xf138('0x1b')]?_[_0xf138('0x1c')](_0x1f643a[_0xf138('0x17')][_0xf138('0x1b')],function(_0x2ff600){return{'model':db[_0x2ff600[_0xf138('0x1d')]],'as':_0x2ff600['as'],'attributes':_0x2ff600[_0xf138('0x1e')],'include':_0x2ff600[_0xf138('0x1b')]?_[_0xf138('0x1c')](_0x2ff600[_0xf138('0x1b')],function(_0x1ba58e){return{'model':db[_0x1ba58e['model']],'as':_0x1ba58e['as'],'attributes':_0x1ba58e[_0xf138('0x1e')],'include':_0x1ba58e[_0xf138('0x1b')]?_['map'](_0x1ba58e[_0xf138('0x1b')],function(_0x395551){return{'model':db[_0x395551[_0xf138('0x1d')]],'as':_0x395551['as'],'attributes':_0x395551[_0xf138('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf138('0x9')](function(_0x1fad35){logger[_0xf138('0x11')]('GetVoiceCallReport',_0x1f643a);logger[_0xf138('0xc')](_0xf138('0x14'),_0x1f643a,JSON[_0xf138('0xd')](_0x1fad35));_0x5d8a36(_0x1fad35);})[_0xf138('0x13')](function(_0x502c85){logger[_0xf138('0xe')](_0xf138('0x14'),_0x502c85['message'],_0x1f643a);_0x359a09(_0x2a1f9['error'](0x1f4,_0x502c85[_0xf138('0x10')]));});});};exports[_0xf138('0x1f')]=function(_0x56d739){var _0x592fa2=this;return new Promise(function(_0x4f5bd9,_0x60f117){return db['VoiceCallReport'][_0xf138('0x20')](_0x56d739['body'],{'raw':_0x56d739[_0xf138('0x17')]?_0x56d739[_0xf138('0x17')][_0xf138('0x18')]===undefined?!![]:![]:!![]})[_0xf138('0x9')](function(_0x496aa6){logger[_0xf138('0x11')](_0xf138('0x1f'),_0x56d739);logger['debug'](_0xf138('0x1f'),_0x56d739,JSON[_0xf138('0xd')](_0x496aa6));_0x4f5bd9(_0x496aa6);})[_0xf138('0x13')](function(_0x544e7d){logger[_0xf138('0xe')](_0xf138('0x1f'),_0x544e7d['message'],_0x56d739);_0x60f117(_0x592fa2[_0xf138('0xe')](0x1f4,_0x544e7d[_0xf138('0x10')]));});});};exports[_0xf138('0x21')]=function(_0x4efdf0){var _0x27c7f5=this;return new Promise(function(_0x1650a6,_0x16b073){return db[_0xf138('0x15')][_0xf138('0x22')](_0x4efdf0[_0xf138('0x23')],{'raw':_0x4efdf0[_0xf138('0x17')]?_0x4efdf0[_0xf138('0x17')][_0xf138('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4efdf0[_0xf138('0x17')]?_0x4efdf0[_0xf138('0x17')]['where']||null:null,'attributes':_0x4efdf0['options']?_0x4efdf0['options']['attributes']||null:null,'limit':_0x4efdf0[_0xf138('0x17')]?_0x4efdf0[_0xf138('0x17')][_0xf138('0x1a')]||null:null})['then'](function(_0x4ccff9){logger[_0xf138('0x11')](_0xf138('0x21'),_0x4efdf0);logger[_0xf138('0xc')](_0xf138('0x21'),_0x4efdf0,JSON[_0xf138('0xd')](_0x4ccff9));_0x1650a6(_0x4ccff9);})['catch'](function(_0x23e3de){logger['error']('UpdateVoiceCallReport',_0x23e3de[_0xf138('0x10')],_0x4efdf0);_0x16b073(_0x27c7f5[_0xf138('0xe')](0x1f4,_0x23e3de[_0xf138('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 6fb4112..3d892f2 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 _0x14cc=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','post','create','put','/:id','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x14cc,0xdf));var _0xc14c=function(_0x1ac6ec,_0x1f81fc){_0x1ac6ec=_0x1ac6ec-0x0;var _0x48a489=_0x14cc[_0x1ac6ec];return _0x48a489;};'use strict';var multer=require(_0xc14c('0x0'));var util=require(_0xc14c('0x1'));var path=require('path');var timeout=require(_0xc14c('0x2'));var express=require(_0xc14c('0x3'));var router=express[_0xc14c('0x4')]();var fs_extra=require(_0xc14c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc14c('0x6'));var config=require(_0xc14c('0x7'));var controller=require(_0xc14c('0x8'));router[_0xc14c('0x9')]('/',auth[_0xc14c('0xa')](),controller[_0xc14c('0xb')]);router['get']('/:id',auth[_0xc14c('0xa')](),controller['show']);router[_0xc14c('0xc')]('/',auth[_0xc14c('0xa')](),controller[_0xc14c('0xd')]);router[_0xc14c('0xe')](_0xc14c('0xf'),auth['isAuthenticated'](),controller[_0xc14c('0x10')]);router[_0xc14c('0x11')](_0xc14c('0xf'),auth['isAuthenticated'](),controller[_0xc14c('0x12')]);module[_0xc14c('0x13')]=router; \ No newline at end of file +var _0x4947=['/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index'];(function(_0x208560,_0x2af194){var _0x259b9d=function(_0x56e04a){while(--_0x56e04a){_0x208560['push'](_0x208560['shift']());}};_0x259b9d(++_0x2af194);}(_0x4947,0x182));var _0x7494=function(_0x36b037,_0x2b234e){_0x36b037=_0x36b037-0x0;var _0x409194=_0x4947[_0x36b037];return _0x409194;};'use strict';var multer=require(_0x7494('0x0'));var util=require(_0x7494('0x1'));var path=require(_0x7494('0x2'));var timeout=require(_0x7494('0x3'));var express=require(_0x7494('0x4'));var router=express['Router']();var fs_extra=require(_0x7494('0x5'));var auth=require(_0x7494('0x6'));var interaction=require(_0x7494('0x7'));var config=require(_0x7494('0x8'));var controller=require(_0x7494('0x9'));router[_0x7494('0xa')]('/',auth[_0x7494('0xb')](),controller[_0x7494('0xc')]);router['get'](_0x7494('0xd'),auth['isAuthenticated'](),controller[_0x7494('0xe')]);router[_0x7494('0xf')]('/',auth[_0x7494('0xb')](),controller[_0x7494('0x10')]);router[_0x7494('0x11')](_0x7494('0xd'),auth[_0x7494('0xb')](),controller[_0x7494('0x12')]);router['delete'](_0x7494('0xd'),auth['isAuthenticated'](),controller[_0x7494('0x13')]);module[_0x7494('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 9d9a939..d2dc5c3 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 _0x1ea0=['join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','options'];(function(_0x5031c1,_0x310436){var _0x418bb6=function(_0x401842){while(--_0x401842){_0x5031c1['push'](_0x5031c1['shift']());}};_0x418bb6(++_0x310436);}(_0x1ea0,0x148));var _0x01ea=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1ea0[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x01ea('0x0'));module[_0x01ea('0x1')]={'name':{'type':Sequelize[_0x01ea('0x2')]},'prefix':{'type':Sequelize[_0x01ea('0x2')],'unique':_0x01ea('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x01ea('0x2')],'set':function(_0x532dbb){this['setDataValue'](_0x01ea('0x4'),_0x532dbb?_0x532dbb[_0x01ea('0x5')](''):[]);},'get':function(){return this[_0x01ea('0x6')](_0x01ea('0x4'))?this[_0x01ea('0x6')](_0x01ea('0x4'))[_0x01ea('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x01ea('0x2')]},'record':{'type':Sequelize[_0x01ea('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x01ea('0x2')]}}; \ No newline at end of file +var _0x44ea=['options','join','getDataValue','split','BOOLEAN','STRING','name'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x44ea,0x1a9));var _0xa44e=function(_0x17fb16,_0x3ffda6){_0x17fb16=_0x17fb16-0x0;var _0x337728=_0x44ea[_0x17fb16];return _0x337728;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xa44e('0x0')],'unique':_0xa44e('0x1'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x244b2e){this['setDataValue'](_0xa44e('0x2'),_0x244b2e?_0x244b2e[_0xa44e('0x3')](''):[]);},'get':function(){return this[_0xa44e('0x4')](_0xa44e('0x2'))?this[_0xa44e('0x4')](_0xa44e('0x2'))[_0xa44e('0x5')](''):[];}},'auth':{'type':Sequelize[_0xa44e('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0xa44e('0x0')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa44e('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index d9e4534..814b0eb 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 _0xad13=['update','then','get','ChanSpies','UserProfileResource','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','where','type','options','includeAll','include','rows','catch','show','params','find','create','user','role','autoAssociation','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x2851f2,_0x3d6113){var _0x4984db=function(_0x5c354f){while(--_0x5c354f){_0x2851f2['push'](_0x2851f2['shift']());}};_0x4984db(++_0x3d6113);}(_0xad13,0x79));var _0x3ad1=function(_0x48451e,_0x1cf56b){_0x48451e=_0x48451e-0x0;var _0x5888af=_0xad13[_0x48451e];return _0x5888af;};'use strict';var emlformat=require(_0x3ad1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ad1('0x1'));var jsonpatch=require(_0x3ad1('0x2'));var rp=require(_0x3ad1('0x3'));var moment=require(_0x3ad1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3ad1('0x5'));var util=require(_0x3ad1('0x6'));var path=require(_0x3ad1('0x7'));var sox=require(_0x3ad1('0x8'));var csv=require(_0x3ad1('0x9'));var ejs=require(_0x3ad1('0xa'));var fs=require('fs');var fs_extra=require(_0x3ad1('0xb'));var _=require(_0x3ad1('0xc'));var squel=require(_0x3ad1('0xd'));var crypto=require(_0x3ad1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3ad1('0xf'));var toCsv=require(_0x3ad1('0x9'));var querystring=require(_0x3ad1('0x10'));var Papa=require('papaparse');var Redis=require(_0x3ad1('0x11'));var authService=require(_0x3ad1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3ad1('0x13'));var hardwareService=require(_0x3ad1('0x14'));var logger=require(_0x3ad1('0x15'))(_0x3ad1('0x16'));var utils=require(_0x3ad1('0x17'));var config=require(_0x3ad1('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x142957,_0x42f6a0){_0x42f6a0=_0x42f6a0||0xcc;return function(_0x4544c0){if(_0x4544c0){return _0x142957[_0x3ad1('0x19')](_0x42f6a0);}return _0x142957['status'](_0x42f6a0)[_0x3ad1('0x1a')]();};}function respondWithResult(_0x4bf44f,_0x19b1db){_0x19b1db=_0x19b1db||0xc8;return function(_0x3b68de){if(_0x3b68de){return _0x4bf44f[_0x3ad1('0x1b')](_0x19b1db)[_0x3ad1('0x1c')](_0x3b68de);}};}function respondWithFilteredResult(_0x5448a1,_0x4104aa){return function(_0xce229){if(_0xce229){var _0x384ed5=typeof _0x4104aa[_0x3ad1('0x1d')]===_0x3ad1('0x1e')&&typeof _0x4104aa[_0x3ad1('0x1f')]===_0x3ad1('0x1e');var _0x5cf66b=_0xce229[_0x3ad1('0x20')];var _0x30e53f=_0x384ed5?0x0:_0x4104aa[_0x3ad1('0x1d')];var _0xd43203=_0x384ed5?_0xce229[_0x3ad1('0x20')]:_0x4104aa['offset']+_0x4104aa[_0x3ad1('0x1f')];var _0x3de9a2;if(_0xd43203>=_0x5cf66b){_0xd43203=_0x5cf66b;_0x3de9a2=0xc8;}else{_0x3de9a2=0xce;}_0x5448a1['status'](_0x3de9a2);return _0x5448a1[_0x3ad1('0x21')](_0x3ad1('0x22'),_0x30e53f+'-'+_0xd43203+'/'+_0x5cf66b)[_0x3ad1('0x1c')](_0xce229);}return null;};}function patchUpdates(_0x46649d){return function(_0x1f65ff){try{jsonpatch[_0x3ad1('0x23')](_0x1f65ff,_0x46649d,!![]);}catch(_0x5aa568){return BPromise[_0x3ad1('0x24')](_0x5aa568);}return _0x1f65ff['save']();};}function saveUpdates(_0xc78309,_0x5f1031){return function(_0x21ed3b){if(_0x21ed3b){return _0x21ed3b[_0x3ad1('0x25')](_0xc78309)[_0x3ad1('0x26')](function(_0x3e9c1f){return _0x3e9c1f;});}return null;};}function removeEntity(_0x2365f3,_0x3a0166){return function(_0x2fd5e6){if(_0x2fd5e6){return _0x2fd5e6['destroy']()[_0x3ad1('0x26')](function(){var _0x466d91=_0x2fd5e6[_0x3ad1('0x27')]({'plain':!![]});var _0x2ee2e8=_0x3ad1('0x28');return db[_0x3ad1('0x29')]['destroy']({'where':{'type':_0x2ee2e8,'resourceId':_0x466d91['id']}})['then'](function(){return _0x2fd5e6;});})[_0x3ad1('0x26')](function(){_0x2365f3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x322a9a,_0x2408d5){return function(_0xf5d14c){if(!_0xf5d14c){_0x322a9a[_0x3ad1('0x19')](0x194);}return _0xf5d14c;};}function handleError(_0x5b200c,_0x5b7461){_0x5b7461=_0x5b7461||0x1f4;return function(_0xc56f8a){logger[_0x3ad1('0x2a')](_0xc56f8a[_0x3ad1('0x2b')]);if(_0xc56f8a[_0x3ad1('0x2c')]){delete _0xc56f8a['name'];}_0x5b200c['status'](_0x5b7461)[_0x3ad1('0x2d')](_0xc56f8a);};}exports['index']=function(_0x7def7b,_0x1d28d6){var _0x266d0d={},_0x255924={},_0x1f5887={'count':0x0,'rows':[]};var _0x7c001=_[_0x3ad1('0x2e')](db[_0x3ad1('0x2f')][_0x3ad1('0x30')],function(_0x567e85){return{'name':_0x567e85[_0x3ad1('0x31')],'type':_0x567e85['type'][_0x3ad1('0x32')]};});_0x255924[_0x3ad1('0x33')]=_[_0x3ad1('0x2e')](_0x7c001,_0x3ad1('0x2c'));_0x255924[_0x3ad1('0x34')]=_[_0x3ad1('0x35')](_0x7def7b[_0x3ad1('0x34')]);_0x255924['filters']=_[_0x3ad1('0x36')](_0x255924['model'],_0x255924['query']);_0x266d0d['attributes']=_[_0x3ad1('0x36')](_0x255924[_0x3ad1('0x33')],qs[_0x3ad1('0x37')](_0x7def7b[_0x3ad1('0x34')][_0x3ad1('0x37')]));_0x266d0d[_0x3ad1('0x38')]=_0x266d0d['attributes']['length']?_0x266d0d[_0x3ad1('0x38')]:_0x255924[_0x3ad1('0x33')];if(!_0x7def7b[_0x3ad1('0x34')][_0x3ad1('0x39')](_0x3ad1('0x3a'))){_0x266d0d['limit']=qs['limit'](_0x7def7b['query']['limit']);_0x266d0d[_0x3ad1('0x1d')]=qs['offset'](_0x7def7b[_0x3ad1('0x34')][_0x3ad1('0x1d')]);}_0x266d0d[_0x3ad1('0x3b')]=qs['sort'](_0x7def7b[_0x3ad1('0x34')][_0x3ad1('0x3c')]);_0x266d0d['where']=qs[_0x3ad1('0x3d')](_['pick'](_0x7def7b[_0x3ad1('0x34')],_0x255924[_0x3ad1('0x3d')]),_0x7c001);if(_0x7def7b[_0x3ad1('0x34')][_0x3ad1('0x3e')]){_0x266d0d['where']=_['merge'](_0x266d0d[_0x3ad1('0x3f')],{'$or':_[_0x3ad1('0x2e')](_0x7c001,function(_0xd38d0){if(_0xd38d0[_0x3ad1('0x40')]!=='VIRTUAL'){var _0x10f027={};_0x10f027[_0xd38d0[_0x3ad1('0x2c')]]={'$like':'%'+_0x7def7b[_0x3ad1('0x34')][_0x3ad1('0x3e')]+'%'};return _0x10f027;}})});}_0x266d0d=_['merge']({},_0x266d0d,_0x7def7b[_0x3ad1('0x41')]);var _0x4fd158={'where':_0x266d0d['where']};return db[_0x3ad1('0x2f')]['count'](_0x4fd158)['then'](function(_0x534b5d){_0x1f5887[_0x3ad1('0x20')]=_0x534b5d;if(_0x7def7b[_0x3ad1('0x34')][_0x3ad1('0x42')]){_0x266d0d[_0x3ad1('0x43')]=[{'all':!![]}];}return db[_0x3ad1('0x2f')]['findAll'](_0x266d0d);})['then'](function(_0xf267d0){_0x1f5887[_0x3ad1('0x44')]=_0xf267d0;return _0x1f5887;})['then'](respondWithFilteredResult(_0x1d28d6,_0x266d0d))[_0x3ad1('0x45')](handleError(_0x1d28d6,null));};exports[_0x3ad1('0x46')]=function(_0x48532c,_0x235189){var _0x347dee={'raw':![],'where':{'id':_0x48532c[_0x3ad1('0x47')]['id']}},_0x4cf9bb={};_0x4cf9bb['model']=_[_0x3ad1('0x35')](db[_0x3ad1('0x2f')][_0x3ad1('0x30')]);_0x4cf9bb[_0x3ad1('0x34')]=_[_0x3ad1('0x35')](_0x48532c[_0x3ad1('0x34')]);_0x4cf9bb[_0x3ad1('0x3d')]=_['intersection'](_0x4cf9bb['model'],_0x4cf9bb[_0x3ad1('0x34')]);_0x347dee[_0x3ad1('0x38')]=_[_0x3ad1('0x36')](_0x4cf9bb[_0x3ad1('0x33')],qs['fields'](_0x48532c['query'][_0x3ad1('0x37')]));_0x347dee['attributes']=_0x347dee[_0x3ad1('0x38')]['length']?_0x347dee[_0x3ad1('0x38')]:_0x4cf9bb['model'];if(_0x48532c[_0x3ad1('0x34')][_0x3ad1('0x42')]){_0x347dee[_0x3ad1('0x43')]=[{'all':!![]}];}_0x347dee=_['merge']({},_0x347dee,_0x48532c[_0x3ad1('0x41')]);return db[_0x3ad1('0x2f')][_0x3ad1('0x48')](_0x347dee)[_0x3ad1('0x26')](handleEntityNotFound(_0x235189,null))['then'](respondWithResult(_0x235189,null))[_0x3ad1('0x45')](handleError(_0x235189,null));};exports[_0x3ad1('0x49')]=function(_0x21bda3,_0x456e31){return db[_0x3ad1('0x2f')][_0x3ad1('0x49')](_0x21bda3['body'],{})['then'](function(_0x4c40ee){var _0x994136=_0x21bda3[_0x3ad1('0x4a')]['get']({'plain':!![]});if(!_0x994136)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x994136[_0x3ad1('0x4b')]===_0x3ad1('0x4a')){var _0x16add6=_0x4c40ee[_0x3ad1('0x27')]({'plain':!![]});var _0x516a3d=_0x3ad1('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x516a3d,'userProfileId':_0x994136['userProfileId']},'raw':!![]})[_0x3ad1('0x26')](function(_0x46b25b){if(_0x46b25b&&_0x46b25b[_0x3ad1('0x4c')]===0x0){return db[_0x3ad1('0x29')][_0x3ad1('0x49')]({'name':_0x16add6['name'],'resourceId':_0x16add6['id'],'type':_0x46b25b[_0x3ad1('0x2c')],'sectionId':_0x46b25b['id']},{})[_0x3ad1('0x26')](function(){return _0x4c40ee;});}else{return _0x4c40ee;}})[_0x3ad1('0x45')](function(_0x4081d4){logger[_0x3ad1('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4081d4);throw _0x4081d4;});}return _0x4c40ee;})[_0x3ad1('0x26')](respondWithResult(_0x456e31,0xc9))[_0x3ad1('0x45')](handleError(_0x456e31,null));};exports[_0x3ad1('0x25')]=function(_0x300faf,_0x350d40){if(_0x300faf[_0x3ad1('0x4d')]['id']){delete _0x300faf[_0x3ad1('0x4d')]['id'];}return db[_0x3ad1('0x2f')][_0x3ad1('0x48')]({'where':{'id':_0x300faf[_0x3ad1('0x47')]['id']}})['then'](handleEntityNotFound(_0x350d40,null))['then'](saveUpdates(_0x300faf[_0x3ad1('0x4d')],null))['then'](respondWithResult(_0x350d40,null))[_0x3ad1('0x45')](handleError(_0x350d40,null));};exports[_0x3ad1('0x4e')]=function(_0x28864d,_0x590b70){return db[_0x3ad1('0x2f')]['find']({'where':{'id':_0x28864d[_0x3ad1('0x47')]['id']}})['then'](handleEntityNotFound(_0x590b70,null))[_0x3ad1('0x26')](removeEntity(_0x590b70,null))[_0x3ad1('0x45')](handleError(_0x590b70,null));}; \ No newline at end of file +var _0xb07f=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','VoiceChanSpy','findAll','rows','catch','show','params','keys','length','includeAll','options','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','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb07f,0x109));var _0xfb07=function(_0x3dc8ee,_0x3a931c){_0x3dc8ee=_0x3dc8ee-0x0;var _0x436c0d=_0xb07f[_0x3dc8ee];return _0x436c0d;};'use strict';var emlformat=require(_0xfb07('0x0'));var rimraf=require(_0xfb07('0x1'));var zipdir=require(_0xfb07('0x2'));var jsonpatch=require(_0xfb07('0x3'));var rp=require(_0xfb07('0x4'));var moment=require(_0xfb07('0x5'));var BPromise=require(_0xfb07('0x6'));var Mustache=require(_0xfb07('0x7'));var util=require(_0xfb07('0x8'));var path=require(_0xfb07('0x9'));var sox=require(_0xfb07('0xa'));var csv=require('to-csv');var ejs=require(_0xfb07('0xb'));var fs=require('fs');var fs_extra=require(_0xfb07('0xc'));var _=require(_0xfb07('0xd'));var squel=require(_0xfb07('0xe'));var crypto=require(_0xfb07('0xf'));var jsforce=require(_0xfb07('0x10'));var deskjs=require(_0xfb07('0x11'));var toCsv=require(_0xfb07('0x12'));var querystring=require(_0xfb07('0x13'));var Papa=require(_0xfb07('0x14'));var Redis=require(_0xfb07('0x15'));var authService=require(_0xfb07('0x16'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb07('0x17'))(_0xfb07('0x18'));var utils=require('../../config/utils');var config=require(_0xfb07('0x19'));var licenseUtil=require(_0xfb07('0x1a'));var db=require(_0xfb07('0x1b'))['db'];function respondWithStatusCode(_0x13275d,_0x2ad2cf){_0x2ad2cf=_0x2ad2cf||0xcc;return function(_0x35fd11){if(_0x35fd11){return _0x13275d[_0xfb07('0x1c')](_0x2ad2cf);}return _0x13275d['status'](_0x2ad2cf)[_0xfb07('0x1d')]();};}function respondWithResult(_0x40bf71,_0x3c69db){_0x3c69db=_0x3c69db||0xc8;return function(_0x2c35e4){if(_0x2c35e4){return _0x40bf71[_0xfb07('0x1e')](_0x3c69db)[_0xfb07('0x1f')](_0x2c35e4);}};}function respondWithFilteredResult(_0x29cbae,_0x228e2a){return function(_0x2363d6){if(_0x2363d6){var _0x6a14e0=typeof _0x228e2a[_0xfb07('0x20')]===_0xfb07('0x21')&&typeof _0x228e2a[_0xfb07('0x22')]===_0xfb07('0x21');var _0x4ebcc3=_0x2363d6['count'];var _0x3e747e=_0x6a14e0?0x0:_0x228e2a[_0xfb07('0x20')];var _0x197f12=_0x6a14e0?_0x2363d6['count']:_0x228e2a[_0xfb07('0x20')]+_0x228e2a[_0xfb07('0x22')];var _0x527c4e;if(_0x197f12>=_0x4ebcc3){_0x197f12=_0x4ebcc3;_0x527c4e=0xc8;}else{_0x527c4e=0xce;}_0x29cbae['status'](_0x527c4e);return _0x29cbae[_0xfb07('0x23')](_0xfb07('0x24'),_0x3e747e+'-'+_0x197f12+'/'+_0x4ebcc3)[_0xfb07('0x1f')](_0x2363d6);}return null;};}function patchUpdates(_0x2c6c44){return function(_0x388995){try{jsonpatch[_0xfb07('0x25')](_0x388995,_0x2c6c44,!![]);}catch(_0x15e153){return BPromise[_0xfb07('0x26')](_0x15e153);}return _0x388995[_0xfb07('0x27')]();};}function saveUpdates(_0x578bb2,_0x45806a){return function(_0x56d0c4){if(_0x56d0c4){return _0x56d0c4[_0xfb07('0x28')](_0x578bb2)[_0xfb07('0x29')](function(_0x428c85){return _0x428c85;});}return null;};}function removeEntity(_0x301c1a,_0xb2063a){return function(_0x508d3b){if(_0x508d3b){return _0x508d3b[_0xfb07('0x2a')]()[_0xfb07('0x29')](function(){var _0x10835a=_0x508d3b[_0xfb07('0x2b')]({'plain':!![]});var _0x3b14fa=_0xfb07('0x2c');return db['UserProfileResource'][_0xfb07('0x2a')]({'where':{'type':_0x3b14fa,'resourceId':_0x10835a['id']}})[_0xfb07('0x29')](function(){return _0x508d3b;});})['then'](function(){_0x301c1a[_0xfb07('0x1e')](0xcc)[_0xfb07('0x1d')]();});}};}function handleEntityNotFound(_0xe813a7,_0x149ac0){return function(_0x46927a){if(!_0x46927a){_0xe813a7[_0xfb07('0x1c')](0x194);}return _0x46927a;};}function handleError(_0x20f01a,_0x24ff99){_0x24ff99=_0x24ff99||0x1f4;return function(_0x95f1d){logger[_0xfb07('0x2d')](_0x95f1d[_0xfb07('0x2e')]);if(_0x95f1d['name']){delete _0x95f1d[_0xfb07('0x2f')];}_0x20f01a[_0xfb07('0x1e')](_0x24ff99)[_0xfb07('0x30')](_0x95f1d);};}exports[_0xfb07('0x31')]=function(_0x5dd4c9,_0x46d57e){var _0xd5290c={},_0x4ce9a4={},_0x36da2a={'count':0x0,'rows':[]};var _0x5dc353=_[_0xfb07('0x32')](db['VoiceChanSpy'][_0xfb07('0x33')],function(_0x4a8d4c){return{'name':_0x4a8d4c[_0xfb07('0x34')],'type':_0x4a8d4c[_0xfb07('0x35')][_0xfb07('0x36')]};});_0x4ce9a4[_0xfb07('0x37')]=_[_0xfb07('0x32')](_0x5dc353,_0xfb07('0x2f'));_0x4ce9a4['query']=_['keys'](_0x5dd4c9[_0xfb07('0x38')]);_0x4ce9a4[_0xfb07('0x39')]=_[_0xfb07('0x3a')](_0x4ce9a4[_0xfb07('0x37')],_0x4ce9a4['query']);_0xd5290c['attributes']=_[_0xfb07('0x3a')](_0x4ce9a4[_0xfb07('0x37')],qs[_0xfb07('0x3b')](_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x3b')]));_0xd5290c[_0xfb07('0x3c')]=_0xd5290c['attributes']['length']?_0xd5290c['attributes']:_0x4ce9a4[_0xfb07('0x37')];if(!_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x3d')](_0xfb07('0x3e'))){_0xd5290c['limit']=qs['limit'](_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x22')]);_0xd5290c['offset']=qs['offset'](_0x5dd4c9['query'][_0xfb07('0x20')]);}_0xd5290c[_0xfb07('0x3f')]=qs['sort'](_0x5dd4c9['query'][_0xfb07('0x40')]);_0xd5290c[_0xfb07('0x41')]=qs[_0xfb07('0x39')](_[_0xfb07('0x42')](_0x5dd4c9[_0xfb07('0x38')],_0x4ce9a4['filters']),_0x5dc353);if(_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x43')]){_0xd5290c[_0xfb07('0x41')]=_[_0xfb07('0x44')](_0xd5290c['where'],{'$or':_['map'](_0x5dc353,function(_0x2d40cb){if(_0x2d40cb[_0xfb07('0x35')]!==_0xfb07('0x45')){var _0xc5df59={};_0xc5df59[_0x2d40cb[_0xfb07('0x2f')]]={'$like':'%'+_0x5dd4c9[_0xfb07('0x38')][_0xfb07('0x43')]+'%'};return _0xc5df59;}})});}_0xd5290c=_['merge']({},_0xd5290c,_0x5dd4c9['options']);var _0x44dafb={'where':_0xd5290c[_0xfb07('0x41')]};return db['VoiceChanSpy']['count'](_0x44dafb)[_0xfb07('0x29')](function(_0x20d682){_0x36da2a[_0xfb07('0x46')]=_0x20d682;if(_0x5dd4c9['query']['includeAll']){_0xd5290c[_0xfb07('0x47')]=[{'all':!![]}];}return db[_0xfb07('0x48')][_0xfb07('0x49')](_0xd5290c);})[_0xfb07('0x29')](function(_0xb87b68){_0x36da2a[_0xfb07('0x4a')]=_0xb87b68;return _0x36da2a;})[_0xfb07('0x29')](respondWithFilteredResult(_0x46d57e,_0xd5290c))[_0xfb07('0x4b')](handleError(_0x46d57e,null));};exports[_0xfb07('0x4c')]=function(_0x492f1b,_0x41df3f){var _0x12c588={'raw':![],'where':{'id':_0x492f1b[_0xfb07('0x4d')]['id']}},_0x3d6372={};_0x3d6372[_0xfb07('0x37')]=_[_0xfb07('0x4e')](db[_0xfb07('0x48')][_0xfb07('0x33')]);_0x3d6372[_0xfb07('0x38')]=_[_0xfb07('0x4e')](_0x492f1b['query']);_0x3d6372['filters']=_[_0xfb07('0x3a')](_0x3d6372[_0xfb07('0x37')],_0x3d6372['query']);_0x12c588[_0xfb07('0x3c')]=_[_0xfb07('0x3a')](_0x3d6372[_0xfb07('0x37')],qs[_0xfb07('0x3b')](_0x492f1b[_0xfb07('0x38')]['fields']));_0x12c588['attributes']=_0x12c588[_0xfb07('0x3c')][_0xfb07('0x4f')]?_0x12c588[_0xfb07('0x3c')]:_0x3d6372[_0xfb07('0x37')];if(_0x492f1b[_0xfb07('0x38')][_0xfb07('0x50')]){_0x12c588[_0xfb07('0x47')]=[{'all':!![]}];}_0x12c588=_[_0xfb07('0x44')]({},_0x12c588,_0x492f1b[_0xfb07('0x51')]);return db[_0xfb07('0x48')]['find'](_0x12c588)['then'](handleEntityNotFound(_0x41df3f,null))['then'](respondWithResult(_0x41df3f,null))[_0xfb07('0x4b')](handleError(_0x41df3f,null));};exports['create']=function(_0x2397f8,_0x31cca8){return db[_0xfb07('0x48')][_0xfb07('0x52')](_0x2397f8[_0xfb07('0x53')],{})[_0xfb07('0x29')](function(_0x4d464e){var _0x3b2cce=_0x2397f8[_0xfb07('0x54')][_0xfb07('0x2b')]({'plain':!![]});if(!_0x3b2cce)throw new Error(_0xfb07('0x55'));if(_0x3b2cce[_0xfb07('0x56')]==='user'){var _0x3cfb89=_0x4d464e[_0xfb07('0x2b')]({'plain':!![]});var _0x40fa4a=_0xfb07('0x2c');return db[_0xfb07('0x57')]['find']({'where':{'name':_0x40fa4a,'userProfileId':_0x3b2cce[_0xfb07('0x58')]},'raw':!![]})[_0xfb07('0x29')](function(_0x38b30e){if(_0x38b30e&&_0x38b30e[_0xfb07('0x59')]===0x0){return db[_0xfb07('0x5a')]['create']({'name':_0x3cfb89[_0xfb07('0x2f')],'resourceId':_0x3cfb89['id'],'type':_0x38b30e[_0xfb07('0x2f')],'sectionId':_0x38b30e['id']},{})[_0xfb07('0x29')](function(){return _0x4d464e;});}else{return _0x4d464e;}})[_0xfb07('0x4b')](function(_0x4e597d){logger[_0xfb07('0x2d')](_0xfb07('0x5b'),_0x4e597d);throw _0x4e597d;});}return _0x4d464e;})[_0xfb07('0x29')](respondWithResult(_0x31cca8,0xc9))[_0xfb07('0x4b')](handleError(_0x31cca8,null));};exports[_0xfb07('0x28')]=function(_0x165628,_0x353b33){if(_0x165628[_0xfb07('0x53')]['id']){delete _0x165628[_0xfb07('0x53')]['id'];}return db[_0xfb07('0x48')]['find']({'where':{'id':_0x165628[_0xfb07('0x4d')]['id']}})['then'](handleEntityNotFound(_0x353b33,null))[_0xfb07('0x29')](saveUpdates(_0x165628[_0xfb07('0x53')],null))[_0xfb07('0x29')](respondWithResult(_0x353b33,null))[_0xfb07('0x4b')](handleError(_0x353b33,null));};exports[_0xfb07('0x2a')]=function(_0x7746bb,_0x1c76af){return db['VoiceChanSpy']['find']({'where':{'id':_0x7746bb['params']['id']}})[_0xfb07('0x29')](handleEntityNotFound(_0x1c76af,null))[_0xfb07('0x29')](removeEntity(_0x1c76af,null))[_0xfb07('0x4b')](handleError(_0x1c76af,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 5de5ef7..e97b05a 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 _0x3f9f=['bluebird','./voiceChanSpy.attributes','from-sip','format','prefix','system','push','merge','Set','record','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','name','options','join','StopMixMonitor','concat','internal','User','findAll','agent','catch','exports','define','VoiceChanSpy','voice_chanspy','then','length','VoiceExtension','bulkCreate','destroy','lodash','util'];(function(_0x1012ab,_0xfb2018){var _0x4ebbe3=function(_0x32cb49){while(--_0x32cb49){_0x1012ab['push'](_0x1012ab['shift']());}};_0x4ebbe3(++_0xfb2018);}(_0x3f9f,0x1df));var _0xf3f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f9f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf3f9('0x0'));var util=require(_0xf3f9('0x1'));var BPromise=require(_0xf3f9('0x2'));var attributes=require(_0xf3f9('0x3'));var getUserApplications=function(_0x4b6fa5,_0x538f0d,_0x7f7d87){var _0x20dd6c=0x1;var _0x4972f0=[];var _0x12956d={'context':_0x538f0d['context']||_0xf3f9('0x4'),'exten':util[_0xf3f9('0x5')]('%s%s',_0x4b6fa5[_0xf3f9('0x6')],_0x7f7d87),'type':_0xf3f9('0x7'),'isApp':![],'ChanSpyId':_0x4b6fa5['id'],'UserId':_0x538f0d['id']};_0x4972f0[_0xf3f9('0x8')](_[_0xf3f9('0x9')]({'app':_0xf3f9('0xa'),'appdata':util['format']('CDR(type)=%s','chanspy'),'priority':_0x20dd6c++},_0x12956d));if(_0x4b6fa5[_0xf3f9('0xb')]){_0x4972f0[_0xf3f9('0x8')](_[_0xf3f9('0x9')]({'app':_0xf3f9('0xc'),'appdata':util[_0xf3f9('0x5')]('${UNIQUEID}.%s,a',_0x4b6fa5[_0xf3f9('0xd')]),'priority':_0x20dd6c++},_0x12956d));}if(_0x4b6fa5[_0xf3f9('0xe')]){_0x4972f0['push'](_[_0xf3f9('0x9')]({'app':_0xf3f9('0xf'),'appdata':_0x4b6fa5[_0xf3f9('0x10')],'priority':_0x20dd6c++},_0x12956d));}_0x4972f0[_0xf3f9('0x8')](_['merge']({'app':_0xf3f9('0x11'),'appdata':util[_0xf3f9('0x5')]('SIP/%s,%s',_0x538f0d[_0xf3f9('0x12')],_0x4b6fa5[_0xf3f9('0x13')]?_0x4b6fa5[_0xf3f9('0x13')][_0xf3f9('0x14')](''):''),'priority':_0x20dd6c++},_0x12956d));if(_0x4b6fa5['record']){_0x4972f0[_0xf3f9('0x8')](_[_0xf3f9('0x9')]({'app':_0xf3f9('0x15'),'priority':_0x20dd6c++},_0x12956d));}return _0x4972f0;};var getChanSpyApplications=function(_0x4ea889,_0x243d05){var _0x8eee04=[];for(var _0x378d62=0x0,_0x4bdbb7=0x1;_0x378d62<_0x243d05['length'];_0x378d62++,_0x4bdbb7=0x1){_0x8eee04=_0x8eee04[_0xf3f9('0x16')](getUserApplications(_0x4ea889,_0x243d05[_0x378d62],_0x243d05[_0x378d62][_0xf3f9('0x17')]));if(_0x243d05[_0x378d62][_0xf3f9('0x17')]!=_0x243d05[_0x378d62]['name']){_0x8eee04=_0x8eee04[_0xf3f9('0x16')](getUserApplications(_0x4ea889,_0x243d05[_0x378d62],_0x243d05[_0x378d62][_0xf3f9('0x12')]));}}return _0x8eee04;};var getChanSpyPromise=function(_0xdae451,_0x450b4b){return new BPromise(function(_0x3b761e,_0x525af2){return _0xdae451[_0xf3f9('0x18')][_0xf3f9('0x19')]({'attributes':['id',_0xf3f9('0x12'),_0xf3f9('0x17')],'where':{'role':_0xf3f9('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x346c55){if(_0x346c55){return _0x3b761e(getChanSpyApplications(_0x450b4b,_0x346c55));}return _0x3b761e([]);})[_0xf3f9('0x1b')](function(_0x207b41){_0x525af2(_0x207b41);});});};module[_0xf3f9('0x1c')]=function(_0x3bdbdb,_0x10243b){var _0x2dc945=_0x3bdbdb['models'];return _0x3bdbdb[_0xf3f9('0x1d')](_0xf3f9('0x1e'),attributes,{'tableName':_0xf3f9('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x16be9c,_0x4fd4e0,_0x27b706){return getChanSpyPromise(_0x2dc945,_0x16be9c)[_0xf3f9('0x20')](function(_0x3b0f75){if(_0x3b0f75&&_0x3b0f75[_0xf3f9('0x21')]){return _0x2dc945[_0xf3f9('0x22')][_0xf3f9('0x23')](_0x3b0f75);}})[_0xf3f9('0x20')](function(){_0x27b706();})[_0xf3f9('0x1b')](function(_0x22ef7f){_0x27b706(_0x22ef7f);});},'afterUpdate':function(_0x3433ec,_0x305e08,_0xf0d26a){return _0x2dc945[_0xf3f9('0x22')][_0xf3f9('0x24')]({'where':{'ChanSpyId':_0x3433ec['id']}})[_0xf3f9('0x20')](function(){return getChanSpyPromise(_0x2dc945,_0x3433ec);})[_0xf3f9('0x20')](function(_0x32be79){if(_0x32be79&&_0x32be79['length']){return _0x2dc945['VoiceExtension'][_0xf3f9('0x23')](_0x32be79);}})['then'](function(){_0xf0d26a();})[_0xf3f9('0x1b')](function(_0x5f2b9e){_0xf0d26a(_0x5f2b9e);});},'afterDestroy':function(_0x19bc30,_0xd3fa23,_0x1cf489){return _0x2dc945[_0xf3f9('0x22')][_0xf3f9('0x24')]({'where':{'ChanSpyId':_0x19bc30['id']}})[_0xf3f9('0x20')](function(){_0x1cf489();})[_0xf3f9('0x1b')](function(_0x4dfb67){_0x1cf489(_0x4dfb67);});}}});}; \ No newline at end of file +var _0x8a11=['util','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','prefix','system','push','merge','format','chanspy','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','record','StopMixMonitor','length','concat','internal','findAll','agent','then','catch','models','define','VoiceChanSpy','voice_chanspy','bulkCreate','VoiceExtension','destroy','lodash'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x8a11,0xbd));var _0x18a1=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x8a11[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x18a1('0x0'));var util=require(_0x18a1('0x1'));var BPromise=require(_0x18a1('0x2'));var attributes=require(_0x18a1('0x3'));var getUserApplications=function(_0x26e5a6,_0x20f93f,_0x400d6a){var _0x47d3a1=0x1;var _0x8c5999=[];var _0x4050c2={'context':_0x20f93f['context']||_0x18a1('0x4'),'exten':util['format'](_0x18a1('0x5'),_0x26e5a6[_0x18a1('0x6')],_0x400d6a),'type':_0x18a1('0x7'),'isApp':![],'ChanSpyId':_0x26e5a6['id'],'UserId':_0x20f93f['id']};_0x8c5999[_0x18a1('0x8')](_[_0x18a1('0x9')]({'app':'Set','appdata':util[_0x18a1('0xa')]('CDR(type)=%s',_0x18a1('0xb')),'priority':_0x47d3a1++},_0x4050c2));if(_0x26e5a6['record']){_0x8c5999[_0x18a1('0x8')](_[_0x18a1('0x9')]({'app':_0x18a1('0xc'),'appdata':util['format'](_0x18a1('0xd'),_0x26e5a6['recordingFormat']),'priority':_0x47d3a1++},_0x4050c2));}if(_0x26e5a6[_0x18a1('0xe')]){_0x8c5999[_0x18a1('0x8')](_[_0x18a1('0x9')]({'app':_0x18a1('0xf'),'appdata':_0x26e5a6[_0x18a1('0x10')],'priority':_0x47d3a1++},_0x4050c2));}_0x8c5999[_0x18a1('0x8')](_['merge']({'app':_0x18a1('0x11'),'appdata':util[_0x18a1('0xa')](_0x18a1('0x12'),_0x20f93f[_0x18a1('0x13')],_0x26e5a6[_0x18a1('0x14')]?_0x26e5a6['options'][_0x18a1('0x15')](''):''),'priority':_0x47d3a1++},_0x4050c2));if(_0x26e5a6[_0x18a1('0x16')]){_0x8c5999[_0x18a1('0x8')](_[_0x18a1('0x9')]({'app':_0x18a1('0x17'),'priority':_0x47d3a1++},_0x4050c2));}return _0x8c5999;};var getChanSpyApplications=function(_0x166c77,_0x1be600){var _0x3c1944=[];for(var _0x58f4fd=0x0,_0x3339e1=0x1;_0x58f4fd<_0x1be600[_0x18a1('0x18')];_0x58f4fd++,_0x3339e1=0x1){_0x3c1944=_0x3c1944[_0x18a1('0x19')](getUserApplications(_0x166c77,_0x1be600[_0x58f4fd],_0x1be600[_0x58f4fd][_0x18a1('0x1a')]));if(_0x1be600[_0x58f4fd][_0x18a1('0x1a')]!=_0x1be600[_0x58f4fd]['name']){_0x3c1944=_0x3c1944['concat'](getUserApplications(_0x166c77,_0x1be600[_0x58f4fd],_0x1be600[_0x58f4fd][_0x18a1('0x13')]));}}return _0x3c1944;};var getChanSpyPromise=function(_0x5ab9f4,_0x354d57){return new BPromise(function(_0x2a9587,_0x539df5){return _0x5ab9f4['User'][_0x18a1('0x1b')]({'attributes':['id',_0x18a1('0x13'),_0x18a1('0x1a')],'where':{'role':_0x18a1('0x1c'),'chanspy':!![]},'raw':!![]})[_0x18a1('0x1d')](function(_0x460975){if(_0x460975){return _0x2a9587(getChanSpyApplications(_0x354d57,_0x460975));}return _0x2a9587([]);})[_0x18a1('0x1e')](function(_0x2cbc8e){_0x539df5(_0x2cbc8e);});});};module['exports']=function(_0x377936,_0x488a68){var _0x56af31=_0x377936[_0x18a1('0x1f')];return _0x377936[_0x18a1('0x20')](_0x18a1('0x21'),attributes,{'tableName':_0x18a1('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x343e95,_0x2253ef,_0x7fe027){return getChanSpyPromise(_0x56af31,_0x343e95)[_0x18a1('0x1d')](function(_0x3c1f04){if(_0x3c1f04&&_0x3c1f04['length']){return _0x56af31['VoiceExtension'][_0x18a1('0x23')](_0x3c1f04);}})[_0x18a1('0x1d')](function(){_0x7fe027();})[_0x18a1('0x1e')](function(_0x9284ca){_0x7fe027(_0x9284ca);});},'afterUpdate':function(_0x1436fe,_0x3caf14,_0x305025){return _0x56af31[_0x18a1('0x24')][_0x18a1('0x25')]({'where':{'ChanSpyId':_0x1436fe['id']}})[_0x18a1('0x1d')](function(){return getChanSpyPromise(_0x56af31,_0x1436fe);})[_0x18a1('0x1d')](function(_0x19e4ee){if(_0x19e4ee&&_0x19e4ee[_0x18a1('0x18')]){return _0x56af31['VoiceExtension'][_0x18a1('0x23')](_0x19e4ee);}})['then'](function(){_0x305025();})[_0x18a1('0x1e')](function(_0x594f55){_0x305025(_0x594f55);});},'afterDestroy':function(_0x517180,_0x45438c,_0x4b9a04){return _0x56af31[_0x18a1('0x24')][_0x18a1('0x25')]({'where':{'ChanSpyId':_0x517180['id']}})[_0x18a1('0x1d')](function(){_0x4b9a04();})[_0x18a1('0x1e')](function(_0x18a7ea){_0x4b9a04(_0x18a7ea);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index ac0ac8a..e1b5f06 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 _0x6324=['client','http','then','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise'];(function(_0x5ed009,_0x56e34a){var _0x17d522=function(_0x4b8389){while(--_0x4b8389){_0x5ed009['push'](_0x5ed009['shift']());}};_0x17d522(++_0x56e34a);}(_0x6324,0x142));var _0x4632=function(_0x355e2b,_0x1e99eb){_0x355e2b=_0x355e2b-0x0;var _0x2b59bb=_0x6324[_0x355e2b];return _0x2b59bb;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var moment=require(_0x4632('0x2'));var BPromise=require(_0x4632('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4632('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4632('0x5'));var logger=require('../../config/logger')(_0x4632('0x6'));var config=require('../../config/environment');var jayson=require(_0x4632('0x7'));var client=jayson[_0x4632('0x8')][_0x4632('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x126e9a,_0x4a15b2,_0x17e860){return new BPromise(function(_0x44dd6d,_0x390a46){return client['request'](_0x126e9a,_0x17e860)[_0x4632('0xa')](function(_0x47824c){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x4a15b2,_0x4632('0xb'));logger[_0x4632('0xc')](_0x4632('0xd'),_0x4a15b2,_0x4632('0xb'),JSON[_0x4632('0xe')](_0x47824c));if(_0x47824c[_0x4632('0xf')]){if(_0x47824c[_0x4632('0xf')][_0x4632('0x10')]===0x1f4){logger['error'](_0x4632('0x11'),_0x4a15b2,_0x47824c['error'][_0x4632('0x12')]);return _0x390a46(_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);}logger[_0x4632('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x4a15b2,_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);return _0x44dd6d(_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);}else{logger[_0x4632('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x4a15b2,'request\x20sent');_0x44dd6d(_0x47824c[_0x4632('0x14')][_0x4632('0x12')]);}})[_0x4632('0x15')](function(_0x125eb9){logger['error'](_0x4632('0x11'),_0x4a15b2,_0x125eb9);_0x390a46(_0x125eb9);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceChanSpy,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x54a08f,_0x1b5e3e){var _0x3fca29=function(_0x1b60c6){while(--_0x1b60c6){_0x54a08f['push'](_0x54a08f['shift']());}};_0x3fca29(++_0x1b5e3e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x306273,_0x50cbac){_0x306273=_0x306273-0x0;var _0x30479e=_0xb43b[_0x306273];return _0x30479e;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index e292ac2..9831231 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 _0x5213=['get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceContext.controller'];(function(_0x45fb72,_0x5b1500){var _0xa7d333=function(_0x30925f){while(--_0x30925f){_0x45fb72['push'](_0x45fb72['shift']());}};_0xa7d333(++_0x5b1500);}(_0x5213,0xb6));var _0x3521=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x5213[_0x243b59];return _0x3e1676;};'use strict';var multer=require(_0x3521('0x0'));var util=require(_0x3521('0x1'));var path=require(_0x3521('0x2'));var timeout=require(_0x3521('0x3'));var express=require(_0x3521('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3521('0x5'));var interaction=require(_0x3521('0x6'));var config=require('../../config/environment');var controller=require(_0x3521('0x7'));router[_0x3521('0x8')]('/',auth[_0x3521('0x9')](),controller[_0x3521('0xa')]);router['get'](_0x3521('0xb'),auth[_0x3521('0x9')](),controller[_0x3521('0xc')]);router[_0x3521('0xd')]('/',auth[_0x3521('0x9')](),controller[_0x3521('0xe')]);router[_0x3521('0xf')](_0x3521('0xb'),auth[_0x3521('0x9')](),controller['update']);router[_0x3521('0x10')](_0x3521('0xb'),auth[_0x3521('0x9')](),controller[_0x3521('0x11')]);module[_0x3521('0x12')]=router; \ No newline at end of file +var _0x5752=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x35f1d0,_0x2741bd){var _0x2ab802=function(_0x416c33){while(--_0x416c33){_0x35f1d0['push'](_0x35f1d0['shift']());}};_0x2ab802(++_0x2741bd);}(_0x5752,0xf7));var _0x2575=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x5752[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require(_0x2575('0x0'));var util=require(_0x2575('0x1'));var path=require(_0x2575('0x2'));var timeout=require(_0x2575('0x3'));var express=require(_0x2575('0x4'));var router=express[_0x2575('0x5')]();var fs_extra=require(_0x2575('0x6'));var auth=require(_0x2575('0x7'));var interaction=require(_0x2575('0x8'));var config=require(_0x2575('0x9'));var controller=require(_0x2575('0xa'));router[_0x2575('0xb')]('/',auth[_0x2575('0xc')](),controller[_0x2575('0xd')]);router[_0x2575('0xb')](_0x2575('0xe'),auth[_0x2575('0xc')](),controller[_0x2575('0xf')]);router['post']('/',auth[_0x2575('0xc')](),controller[_0x2575('0x10')]);router[_0x2575('0x11')](_0x2575('0xe'),auth[_0x2575('0xc')](),controller[_0x2575('0x12')]);router[_0x2575('0x13')](_0x2575('0xe'),auth[_0x2575('0xc')](),controller[_0x2575('0x14')]);module[_0x2575('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 3d226f2..8ae2b13 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 _0x3733=['sequelize','STRING','name','BOOLEAN'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0x3733,0xb0));var _0x3373=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3733[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3373('0x0'));module['exports']={'name':{'type':Sequelize[_0x3373('0x1')],'unique':_0x3373('0x2')},'description':{'type':Sequelize[_0x3373('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x3373('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x470b=['name','sequelize','exports','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x470b,0xd9));var _0xb470=function(_0x463ce1,_0xccefb8){_0x463ce1=_0x463ce1-0x0;var _0x15846d=_0x470b[_0x463ce1];return _0x15846d;};'use strict';var Sequelize=require(_0xb470('0x0'));module[_0xb470('0x1')]={'name':{'type':Sequelize[_0xb470('0x2')],'unique':_0xb470('0x3')},'description':{'type':Sequelize[_0xb470('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 67f4f70..8807ce7 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 _0x9a34=['moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','VoiceContext,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','count','limit','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','name','send','index','map','VoiceContext','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','create','body','join','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','writeFileSync','Reload','rimraf','zip-dir','fast-json-patch'];(function(_0x49fa47,_0x445242){var _0x17d038=function(_0x36b4fb){while(--_0x36b4fb){_0x49fa47['push'](_0x49fa47['shift']());}};_0x17d038(++_0x445242);}(_0x9a34,0x12f));var _0x49a3=function(_0x338d20,_0x2f9b16){_0x338d20=_0x338d20-0x0;var _0x558026=_0x9a34[_0x338d20];return _0x558026;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x49a3('0x0'));var zipdir=require(_0x49a3('0x1'));var jsonpatch=require(_0x49a3('0x2'));var rp=require('request-promise');var moment=require(_0x49a3('0x3'));var BPromise=require(_0x49a3('0x4'));var Mustache=require(_0x49a3('0x5'));var util=require(_0x49a3('0x6'));var path=require(_0x49a3('0x7'));var sox=require(_0x49a3('0x8'));var csv=require('to-csv');var ejs=require(_0x49a3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x49a3('0xa'));var squel=require('squel');var crypto=require(_0x49a3('0xb'));var jsforce=require(_0x49a3('0xc'));var deskjs=require(_0x49a3('0xd'));var toCsv=require(_0x49a3('0xe'));var querystring=require(_0x49a3('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49a3('0x10'));var as=require(_0x49a3('0x11'));var hardwareService=require(_0x49a3('0x12'));var logger=require('../../config/logger')(_0x49a3('0x13'));var utils=require(_0x49a3('0x14'));var config=require(_0x49a3('0x15'));var licenseUtil=require(_0x49a3('0x16'));var db=require(_0x49a3('0x17'))['db'];var jayson=require(_0x49a3('0x18'));var client=jayson[_0x49a3('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b3780,_0x400a3d,_0xe440b7,_0x589b10){return new BPromise(function(_0x21e98d,_0x48e23a){var _0x2f8075=_0x589b10||client;return _0x2f8075[_0x49a3('0x1a')](_0x1b3780,_0xe440b7)[_0x49a3('0x1b')](function(_0x3dc6c2){logger['info']('VoiceContext,\x20%s,\x20%s',_0x400a3d,'request\x20sent');logger['debug'](_0x49a3('0x1c'),_0x400a3d,_0x49a3('0x1d'),JSON[_0x49a3('0x1e')](_0x3dc6c2));if(_0x3dc6c2['error']){if(_0x3dc6c2['error'][_0x49a3('0x1f')]===0x1f4){logger[_0x49a3('0x20')]('VoiceContext,\x20%s,\x20%s',_0x400a3d,_0x3dc6c2['error'][_0x49a3('0x21')]);return _0x48e23a(_0x3dc6c2[_0x49a3('0x20')][_0x49a3('0x21')]);}logger['error'](_0x49a3('0x22'),_0x400a3d,_0x3dc6c2[_0x49a3('0x20')][_0x49a3('0x21')]);return _0x21e98d(_0x3dc6c2[_0x49a3('0x20')][_0x49a3('0x21')]);}else{logger['info'](_0x49a3('0x22'),_0x400a3d,'request\x20sent');_0x21e98d(_0x3dc6c2['result']['message']);}})[_0x49a3('0x23')](function(_0x172330){logger['error'](_0x49a3('0x22'),_0x400a3d,_0x172330);_0x48e23a(_0x172330);});});}function respondWithStatusCode(_0xbd5711,_0x21621e){_0x21621e=_0x21621e||0xcc;return function(_0x2c0dfb){if(_0x2c0dfb){return _0xbd5711[_0x49a3('0x24')](_0x21621e);}return _0xbd5711[_0x49a3('0x25')](_0x21621e)[_0x49a3('0x26')]();};}function respondWithResult(_0x2e884c,_0x4a7f58){_0x4a7f58=_0x4a7f58||0xc8;return function(_0x142d1a){if(_0x142d1a){return _0x2e884c[_0x49a3('0x25')](_0x4a7f58)[_0x49a3('0x27')](_0x142d1a);}};}function respondWithFilteredResult(_0x1c95e9,_0x2b6539){return function(_0x596a22){if(_0x596a22){var _0x586823=typeof _0x2b6539[_0x49a3('0x28')]==='undefined'&&typeof _0x2b6539['limit']==='undefined';var _0x3989dc=_0x596a22['count'];var _0x42d146=_0x586823?0x0:_0x2b6539[_0x49a3('0x28')];var _0x4ef14b=_0x586823?_0x596a22[_0x49a3('0x29')]:_0x2b6539[_0x49a3('0x28')]+_0x2b6539[_0x49a3('0x2a')];var _0xdf39ff;if(_0x4ef14b>=_0x3989dc){_0x4ef14b=_0x3989dc;_0xdf39ff=0xc8;}else{_0xdf39ff=0xce;}_0x1c95e9['status'](_0xdf39ff);return _0x1c95e9['set'](_0x49a3('0x2b'),_0x42d146+'-'+_0x4ef14b+'/'+_0x3989dc)[_0x49a3('0x27')](_0x596a22);}return null;};}function patchUpdates(_0x466393){return function(_0x108475){try{jsonpatch[_0x49a3('0x2c')](_0x108475,_0x466393,!![]);}catch(_0x30cb77){return BPromise[_0x49a3('0x2d')](_0x30cb77);}return _0x108475[_0x49a3('0x2e')]();};}function saveUpdates(_0x535098,_0x16c2e5){return function(_0x19fd80){if(_0x19fd80){return _0x19fd80[_0x49a3('0x2f')](_0x535098)[_0x49a3('0x1b')](function(_0x9193b){return _0x9193b;});}return null;};}function removeEntity(_0x396b31,_0x535530){return function(_0x3776fd){if(_0x3776fd){return _0x3776fd[_0x49a3('0x30')]()['then'](function(){var _0x4c3046=_0x3776fd[_0x49a3('0x31')]({'plain':!![]});var _0x37c32c='Contexts';return db[_0x49a3('0x32')][_0x49a3('0x30')]({'where':{'type':_0x37c32c,'resourceId':_0x4c3046['id']}})[_0x49a3('0x1b')](function(){return _0x3776fd;});})[_0x49a3('0x1b')](function(){_0x396b31[_0x49a3('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x68b62c,_0x54ed11){return function(_0xb31b21){if(!_0xb31b21){_0x68b62c[_0x49a3('0x24')](0x194);}return _0xb31b21;};}function handleError(_0xade7b0,_0x550be9){_0x550be9=_0x550be9||0x1f4;return function(_0x557fe9){logger[_0x49a3('0x20')](_0x557fe9['stack']);if(_0x557fe9[_0x49a3('0x33')]){delete _0x557fe9['name'];}_0xade7b0[_0x49a3('0x25')](_0x550be9)[_0x49a3('0x34')](_0x557fe9);};}exports[_0x49a3('0x35')]=function(_0x385cfa,_0x2b6924){var _0x20f2dc={},_0x1b9b00={},_0x4a8908={'count':0x0,'rows':[]};var _0x4aa58d=_[_0x49a3('0x36')](db[_0x49a3('0x37')][_0x49a3('0x38')],function(_0x33b977){return{'name':_0x33b977['fieldName'],'type':_0x33b977['type'][_0x49a3('0x39')]};});_0x1b9b00[_0x49a3('0x3a')]=_[_0x49a3('0x36')](_0x4aa58d,_0x49a3('0x33'));_0x1b9b00[_0x49a3('0x3b')]=_['keys'](_0x385cfa[_0x49a3('0x3b')]);_0x1b9b00['filters']=_[_0x49a3('0x3c')](_0x1b9b00[_0x49a3('0x3a')],_0x1b9b00[_0x49a3('0x3b')]);_0x20f2dc[_0x49a3('0x3d')]=_[_0x49a3('0x3c')](_0x1b9b00[_0x49a3('0x3a')],qs[_0x49a3('0x3e')](_0x385cfa['query'][_0x49a3('0x3e')]));_0x20f2dc['attributes']=_0x20f2dc[_0x49a3('0x3d')][_0x49a3('0x3f')]?_0x20f2dc[_0x49a3('0x3d')]:_0x1b9b00[_0x49a3('0x3a')];if(!_0x385cfa['query'][_0x49a3('0x40')](_0x49a3('0x41'))){_0x20f2dc['limit']=qs[_0x49a3('0x2a')](_0x385cfa[_0x49a3('0x3b')][_0x49a3('0x2a')]);_0x20f2dc[_0x49a3('0x28')]=qs['offset'](_0x385cfa[_0x49a3('0x3b')][_0x49a3('0x28')]);}_0x20f2dc[_0x49a3('0x42')]=qs[_0x49a3('0x43')](_0x385cfa[_0x49a3('0x3b')][_0x49a3('0x43')]);_0x20f2dc[_0x49a3('0x44')]=qs[_0x49a3('0x45')](_[_0x49a3('0x46')](_0x385cfa[_0x49a3('0x3b')],_0x1b9b00[_0x49a3('0x45')]),_0x4aa58d);if(_0x385cfa[_0x49a3('0x3b')][_0x49a3('0x47')]){_0x20f2dc[_0x49a3('0x44')]=_[_0x49a3('0x48')](_0x20f2dc[_0x49a3('0x44')],{'$or':_[_0x49a3('0x36')](_0x4aa58d,function(_0x5496a9){if(_0x5496a9[_0x49a3('0x49')]!==_0x49a3('0x4a')){var _0x36cea1={};_0x36cea1[_0x5496a9[_0x49a3('0x33')]]={'$like':'%'+_0x385cfa[_0x49a3('0x3b')][_0x49a3('0x47')]+'%'};return _0x36cea1;}})});}_0x20f2dc=_[_0x49a3('0x48')]({},_0x20f2dc,_0x385cfa[_0x49a3('0x4b')]);var _0x40bd5b={'where':_0x20f2dc[_0x49a3('0x44')]};return db[_0x49a3('0x37')][_0x49a3('0x29')](_0x40bd5b)[_0x49a3('0x1b')](function(_0x40d689){_0x4a8908[_0x49a3('0x29')]=_0x40d689;if(_0x385cfa[_0x49a3('0x3b')][_0x49a3('0x4c')]){_0x20f2dc[_0x49a3('0x4d')]=[{'all':!![]}];}return db['VoiceContext'][_0x49a3('0x4e')](_0x20f2dc);})['then'](function(_0x4f75e3){_0x4a8908[_0x49a3('0x4f')]=_0x4f75e3;return _0x4a8908;})[_0x49a3('0x1b')](respondWithFilteredResult(_0x2b6924,_0x20f2dc))[_0x49a3('0x23')](handleError(_0x2b6924,null));};exports['show']=function(_0x6740bc,_0xb32705){var _0x51aa7f={'raw':![],'where':{'id':_0x6740bc[_0x49a3('0x50')]['id']}},_0x3694f7={};_0x3694f7[_0x49a3('0x3a')]=_[_0x49a3('0x51')](db[_0x49a3('0x37')]['rawAttributes']);_0x3694f7[_0x49a3('0x3b')]=_['keys'](_0x6740bc[_0x49a3('0x3b')]);_0x3694f7[_0x49a3('0x45')]=_[_0x49a3('0x3c')](_0x3694f7[_0x49a3('0x3a')],_0x3694f7[_0x49a3('0x3b')]);_0x51aa7f[_0x49a3('0x3d')]=_[_0x49a3('0x3c')](_0x3694f7[_0x49a3('0x3a')],qs[_0x49a3('0x3e')](_0x6740bc[_0x49a3('0x3b')][_0x49a3('0x3e')]));_0x51aa7f['attributes']=_0x51aa7f[_0x49a3('0x3d')][_0x49a3('0x3f')]?_0x51aa7f[_0x49a3('0x3d')]:_0x3694f7[_0x49a3('0x3a')];if(_0x6740bc[_0x49a3('0x3b')]['includeAll']){_0x51aa7f[_0x49a3('0x4d')]=[{'all':!![]}];}_0x51aa7f=_['merge']({},_0x51aa7f,_0x6740bc['options']);return db[_0x49a3('0x37')]['find'](_0x51aa7f)[_0x49a3('0x1b')](handleEntityNotFound(_0xb32705,null))[_0x49a3('0x1b')](respondWithResult(_0xb32705,null))[_0x49a3('0x23')](handleError(_0xb32705,null));};exports['create']=function(_0x34be30,_0x29d4ce,_0x43c631){var _0x17dec8;return db[_0x49a3('0x37')][_0x49a3('0x52')](_0x34be30[_0x49a3('0x53')],{'raw':!![]})[_0x49a3('0x1b')](function(_0x27ea03){_0x17dec8=_0x27ea03;return db[_0x49a3('0x37')][_0x49a3('0x4e')]({'raw':!![]});})[_0x49a3('0x1b')](function(_0x1dbf20){var _0x3d8f18=fs['readFileSync'](path[_0x49a3('0x54')](config['root'],_0x49a3('0x55')),_0x49a3('0x56'));var _0x2efae2=ejs[_0x49a3('0x57')](_0x3d8f18,{'contexts':_0x1dbf20||[]});fs['writeFileSync'](_0x49a3('0x58'),_0x2efae2);})[_0x49a3('0x1b')](function(){return respondWithRpcPromise('Reload',_0x49a3('0x52'),{'module':_0x49a3('0x59')});})[_0x49a3('0x1b')](function(){var _0x4807b6=_0x34be30['user'][_0x49a3('0x31')]({'plain':!![]});if(!_0x4807b6)throw new Error(_0x49a3('0x5a'));if(_0x4807b6[_0x49a3('0x5b')]==='user'){var _0x54d631=_0x17dec8[_0x49a3('0x31')]({'plain':!![]});return db[_0x49a3('0x5c')][_0x49a3('0x5d')]({'where':{'name':_0x49a3('0x5e'),'userProfileId':_0x4807b6[_0x49a3('0x5f')]},'raw':!![]})[_0x49a3('0x1b')](function(_0x4ba30e){if(_0x4ba30e&&_0x4ba30e[_0x49a3('0x60')]===0x0){return db[_0x49a3('0x32')][_0x49a3('0x52')]({'name':_0x54d631[_0x49a3('0x33')],'resourceId':_0x54d631['id'],'type':_0x4ba30e['name'],'sectionId':_0x4ba30e['id']},{})[_0x49a3('0x1b')](function(){return _0x17dec8;});}else{return _0x17dec8;}})[_0x49a3('0x23')](function(_0x1aeee1){logger[_0x49a3('0x20')](_0x49a3('0x61'),_0x1aeee1);throw _0x1aeee1;});}return _0x17dec8;})[_0x49a3('0x1b')](respondWithResult(_0x29d4ce,0xc9))['catch'](handleError(_0x29d4ce,null));};exports[_0x49a3('0x2f')]=function(_0xa8c570,_0x5361e0,_0x5ced33){var _0x27b7ed;return db[_0x49a3('0x37')][_0x49a3('0x5d')]({'where':{'id':_0xa8c570[_0x49a3('0x50')]['id']}})[_0x49a3('0x1b')](handleEntityNotFound(_0x5361e0,null))[_0x49a3('0x1b')](saveUpdates(_0xa8c570[_0x49a3('0x53')],null))[_0x49a3('0x1b')](function(_0x13f0dc){if(_0x13f0dc){_0x27b7ed=_0x13f0dc;return db[_0x49a3('0x37')]['findAll']({'raw':!![]});}})[_0x49a3('0x1b')](function(_0x3b7da9){var _0x194b7b=fs[_0x49a3('0x62')](path[_0x49a3('0x54')](config[_0x49a3('0x63')],_0x49a3('0x55')),_0x49a3('0x56'));var _0x499343=ejs['render'](_0x194b7b,{'contexts':_0x3b7da9||[]});fs[_0x49a3('0x64')](_0x49a3('0x58'),_0x499343);})[_0x49a3('0x1b')](function(){return respondWithRpcPromise(_0x49a3('0x65'),'update',{'module':'chan_sip.so'});})[_0x49a3('0x1b')](function(){return _0x27b7ed;})[_0x49a3('0x1b')](respondWithResult(_0x5361e0,null))['catch'](handleError(_0x5361e0,null));};exports[_0x49a3('0x30')]=function(_0x28ef7b,_0x2b3dba,_0x389ed0){var _0x59745b;return db[_0x49a3('0x37')][_0x49a3('0x5d')]({'where':{'id':_0x28ef7b[_0x49a3('0x50')]['id']}})[_0x49a3('0x1b')](handleEntityNotFound(_0x2b3dba,null))[_0x49a3('0x1b')](removeEntity(_0x2b3dba,null))[_0x49a3('0x1b')](function(){return db[_0x49a3('0x37')][_0x49a3('0x4e')]({'raw':!![]});})[_0x49a3('0x1b')](function(_0x54da83){var _0x573367=fs[_0x49a3('0x62')](path[_0x49a3('0x54')](config[_0x49a3('0x63')],'server/files/templates/context.ejs'),_0x49a3('0x56'));var _0xb28e97=ejs['render'](_0x573367,{'contexts':_0x54da83});fs[_0x49a3('0x64')](_0x49a3('0x58'),_0xb28e97);return respondWithRpcPromise('Reload',_0x49a3('0x30'),{'module':_0x49a3('0x59')});})[_0x49a3('0x23')](handleError(_0x2b3dba,null));}; \ No newline at end of file +var _0x48c2=['catch','sendStatus','status','end','offset','limit','undefined','count','set','json','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','writeFileSync','Reload','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','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','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x40279f,_0x135e4d){var _0x9df5f6=function(_0x193801){while(--_0x193801){_0x40279f['push'](_0x40279f['shift']());}};_0x9df5f6(++_0x135e4d);}(_0x48c2,0x181));var _0x248c=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x48c2[_0x342baa];return _0x1208f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x248c('0x0'));var zipdir=require(_0x248c('0x1'));var jsonpatch=require(_0x248c('0x2'));var rp=require('request-promise');var moment=require(_0x248c('0x3'));var BPromise=require(_0x248c('0x4'));var Mustache=require(_0x248c('0x5'));var util=require(_0x248c('0x6'));var path=require(_0x248c('0x7'));var sox=require(_0x248c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x248c('0x9'));var squel=require(_0x248c('0xa'));var crypto=require(_0x248c('0xb'));var jsforce=require(_0x248c('0xc'));var deskjs=require(_0x248c('0xd'));var toCsv=require(_0x248c('0xe'));var querystring=require('querystring');var Papa=require(_0x248c('0xf'));var Redis=require(_0x248c('0x10'));var authService=require(_0x248c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x248c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x248c('0x13'))(_0x248c('0x14'));var utils=require(_0x248c('0x15'));var config=require(_0x248c('0x16'));var licenseUtil=require(_0x248c('0x17'));var db=require(_0x248c('0x18'))['db'];var jayson=require(_0x248c('0x19'));var client=jayson[_0x248c('0x1a')][_0x248c('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4e611c,_0x308d55,_0x480f4a,_0x240490){return new BPromise(function(_0x59ec85,_0x40e93e){var _0x36f8f6=_0x240490||client;return _0x36f8f6[_0x248c('0x1c')](_0x4e611c,_0x480f4a)[_0x248c('0x1d')](function(_0x5986eb){logger[_0x248c('0x1e')](_0x248c('0x1f'),_0x308d55,_0x248c('0x20'));logger[_0x248c('0x21')](_0x248c('0x22'),_0x308d55,'request\x20sent',JSON['stringify'](_0x5986eb));if(_0x5986eb['error']){if(_0x5986eb['error'][_0x248c('0x23')]===0x1f4){logger[_0x248c('0x24')](_0x248c('0x1f'),_0x308d55,_0x5986eb['error'][_0x248c('0x25')]);return _0x40e93e(_0x5986eb['error'][_0x248c('0x25')]);}logger['error'](_0x248c('0x1f'),_0x308d55,_0x5986eb[_0x248c('0x24')]['message']);return _0x59ec85(_0x5986eb[_0x248c('0x24')]['message']);}else{logger[_0x248c('0x1e')](_0x248c('0x1f'),_0x308d55,_0x248c('0x20'));_0x59ec85(_0x5986eb[_0x248c('0x26')][_0x248c('0x25')]);}})[_0x248c('0x27')](function(_0x50b7fb){logger[_0x248c('0x24')](_0x248c('0x1f'),_0x308d55,_0x50b7fb);_0x40e93e(_0x50b7fb);});});}function respondWithStatusCode(_0x31bee3,_0x4f444b){_0x4f444b=_0x4f444b||0xcc;return function(_0x45a1c8){if(_0x45a1c8){return _0x31bee3[_0x248c('0x28')](_0x4f444b);}return _0x31bee3[_0x248c('0x29')](_0x4f444b)[_0x248c('0x2a')]();};}function respondWithResult(_0xae79f0,_0x112b9d){_0x112b9d=_0x112b9d||0xc8;return function(_0x2ffd9c){if(_0x2ffd9c){return _0xae79f0[_0x248c('0x29')](_0x112b9d)['json'](_0x2ffd9c);}};}function respondWithFilteredResult(_0x4ae010,_0x26f208){return function(_0x37e8f3){if(_0x37e8f3){var _0x5e965d=typeof _0x26f208[_0x248c('0x2b')]==='undefined'&&typeof _0x26f208[_0x248c('0x2c')]===_0x248c('0x2d');var _0x503139=_0x37e8f3[_0x248c('0x2e')];var _0x273c0e=_0x5e965d?0x0:_0x26f208[_0x248c('0x2b')];var _0x10e1ac=_0x5e965d?_0x37e8f3['count']:_0x26f208['offset']+_0x26f208[_0x248c('0x2c')];var _0x4efeba;if(_0x10e1ac>=_0x503139){_0x10e1ac=_0x503139;_0x4efeba=0xc8;}else{_0x4efeba=0xce;}_0x4ae010[_0x248c('0x29')](_0x4efeba);return _0x4ae010[_0x248c('0x2f')]('Content-Range',_0x273c0e+'-'+_0x10e1ac+'/'+_0x503139)[_0x248c('0x30')](_0x37e8f3);}return null;};}function patchUpdates(_0x49333b){return function(_0x4460f0){try{jsonpatch['apply'](_0x4460f0,_0x49333b,!![]);}catch(_0x45ab4a){return BPromise[_0x248c('0x31')](_0x45ab4a);}return _0x4460f0[_0x248c('0x32')]();};}function saveUpdates(_0x899ee,_0x1cd9d7){return function(_0x37dfa6){if(_0x37dfa6){return _0x37dfa6[_0x248c('0x33')](_0x899ee)[_0x248c('0x1d')](function(_0x2a631a){return _0x2a631a;});}return null;};}function removeEntity(_0x1d88bf,_0x201b6a){return function(_0x1f5784){if(_0x1f5784){return _0x1f5784[_0x248c('0x34')]()[_0x248c('0x1d')](function(){var _0x55378d=_0x1f5784[_0x248c('0x35')]({'plain':!![]});var _0x446767=_0x248c('0x36');return db[_0x248c('0x37')]['destroy']({'where':{'type':_0x446767,'resourceId':_0x55378d['id']}})[_0x248c('0x1d')](function(){return _0x1f5784;});})[_0x248c('0x1d')](function(){_0x1d88bf[_0x248c('0x29')](0xcc)[_0x248c('0x2a')]();});}};}function handleEntityNotFound(_0x145ea1,_0x2f0c27){return function(_0x57ff14){if(!_0x57ff14){_0x145ea1[_0x248c('0x28')](0x194);}return _0x57ff14;};}function handleError(_0x55fe7f,_0x4e9b38){_0x4e9b38=_0x4e9b38||0x1f4;return function(_0x84e0d6){logger[_0x248c('0x24')](_0x84e0d6[_0x248c('0x38')]);if(_0x84e0d6['name']){delete _0x84e0d6[_0x248c('0x39')];}_0x55fe7f[_0x248c('0x29')](_0x4e9b38)[_0x248c('0x3a')](_0x84e0d6);};}exports[_0x248c('0x3b')]=function(_0x2d3a73,_0x10bb9a){var _0x4b46f4={},_0x15181a={},_0x9d83df={'count':0x0,'rows':[]};var _0x3e655f=_[_0x248c('0x3c')](db[_0x248c('0x3d')][_0x248c('0x3e')],function(_0x218d08){return{'name':_0x218d08[_0x248c('0x3f')],'type':_0x218d08[_0x248c('0x40')][_0x248c('0x41')]};});_0x15181a[_0x248c('0x42')]=_['map'](_0x3e655f,_0x248c('0x39'));_0x15181a[_0x248c('0x43')]=_[_0x248c('0x44')](_0x2d3a73[_0x248c('0x43')]);_0x15181a[_0x248c('0x45')]=_['intersection'](_0x15181a[_0x248c('0x42')],_0x15181a[_0x248c('0x43')]);_0x4b46f4['attributes']=_[_0x248c('0x46')](_0x15181a[_0x248c('0x42')],qs[_0x248c('0x47')](_0x2d3a73[_0x248c('0x43')][_0x248c('0x47')]));_0x4b46f4[_0x248c('0x48')]=_0x4b46f4[_0x248c('0x48')][_0x248c('0x49')]?_0x4b46f4[_0x248c('0x48')]:_0x15181a['model'];if(!_0x2d3a73[_0x248c('0x43')]['hasOwnProperty']('nolimit')){_0x4b46f4[_0x248c('0x2c')]=qs[_0x248c('0x2c')](_0x2d3a73[_0x248c('0x43')][_0x248c('0x2c')]);_0x4b46f4['offset']=qs[_0x248c('0x2b')](_0x2d3a73[_0x248c('0x43')][_0x248c('0x2b')]);}_0x4b46f4[_0x248c('0x4a')]=qs[_0x248c('0x4b')](_0x2d3a73[_0x248c('0x43')][_0x248c('0x4b')]);_0x4b46f4[_0x248c('0x4c')]=qs['filters'](_[_0x248c('0x4d')](_0x2d3a73['query'],_0x15181a[_0x248c('0x45')]),_0x3e655f);if(_0x2d3a73[_0x248c('0x43')]['filter']){_0x4b46f4[_0x248c('0x4c')]=_[_0x248c('0x4e')](_0x4b46f4['where'],{'$or':_['map'](_0x3e655f,function(_0xcdd06){if(_0xcdd06[_0x248c('0x40')]!==_0x248c('0x4f')){var _0x411e4b={};_0x411e4b[_0xcdd06['name']]={'$like':'%'+_0x2d3a73[_0x248c('0x43')]['filter']+'%'};return _0x411e4b;}})});}_0x4b46f4=_['merge']({},_0x4b46f4,_0x2d3a73[_0x248c('0x50')]);var _0x2ec9ea={'where':_0x4b46f4[_0x248c('0x4c')]};return db[_0x248c('0x3d')][_0x248c('0x2e')](_0x2ec9ea)[_0x248c('0x1d')](function(_0x52f01a){_0x9d83df[_0x248c('0x2e')]=_0x52f01a;if(_0x2d3a73[_0x248c('0x43')][_0x248c('0x51')]){_0x4b46f4[_0x248c('0x52')]=[{'all':!![]}];}return db[_0x248c('0x3d')][_0x248c('0x53')](_0x4b46f4);})[_0x248c('0x1d')](function(_0x4cd129){_0x9d83df[_0x248c('0x54')]=_0x4cd129;return _0x9d83df;})['then'](respondWithFilteredResult(_0x10bb9a,_0x4b46f4))['catch'](handleError(_0x10bb9a,null));};exports['show']=function(_0x5b7c6b,_0x47ef1c){var _0x42c48e={'raw':![],'where':{'id':_0x5b7c6b['params']['id']}},_0x55c3b3={};_0x55c3b3[_0x248c('0x42')]=_[_0x248c('0x44')](db[_0x248c('0x3d')][_0x248c('0x3e')]);_0x55c3b3[_0x248c('0x43')]=_[_0x248c('0x44')](_0x5b7c6b[_0x248c('0x43')]);_0x55c3b3[_0x248c('0x45')]=_[_0x248c('0x46')](_0x55c3b3[_0x248c('0x42')],_0x55c3b3['query']);_0x42c48e[_0x248c('0x48')]=_[_0x248c('0x46')](_0x55c3b3['model'],qs[_0x248c('0x47')](_0x5b7c6b['query'][_0x248c('0x47')]));_0x42c48e[_0x248c('0x48')]=_0x42c48e[_0x248c('0x48')][_0x248c('0x49')]?_0x42c48e[_0x248c('0x48')]:_0x55c3b3[_0x248c('0x42')];if(_0x5b7c6b['query'][_0x248c('0x51')]){_0x42c48e['include']=[{'all':!![]}];}_0x42c48e=_[_0x248c('0x4e')]({},_0x42c48e,_0x5b7c6b[_0x248c('0x50')]);return db[_0x248c('0x3d')][_0x248c('0x55')](_0x42c48e)['then'](handleEntityNotFound(_0x47ef1c,null))[_0x248c('0x1d')](respondWithResult(_0x47ef1c,null))[_0x248c('0x27')](handleError(_0x47ef1c,null));};exports[_0x248c('0x56')]=function(_0x302e6b,_0x55cebe,_0x5a497d){var _0x2562b4;return db[_0x248c('0x3d')][_0x248c('0x56')](_0x302e6b[_0x248c('0x57')],{'raw':!![]})[_0x248c('0x1d')](function(_0x592889){_0x2562b4=_0x592889;return db['VoiceContext'][_0x248c('0x53')]({'raw':!![]});})[_0x248c('0x1d')](function(_0x328f72){var _0x4a684f=fs[_0x248c('0x58')](path[_0x248c('0x59')](config[_0x248c('0x5a')],_0x248c('0x5b')),_0x248c('0x5c'));var _0xf6a8d3=ejs[_0x248c('0x5d')](_0x4a684f,{'contexts':_0x328f72||[]});fs['writeFileSync'](_0x248c('0x5e'),_0xf6a8d3);})[_0x248c('0x1d')](function(){return respondWithRpcPromise('Reload',_0x248c('0x56'),{'module':_0x248c('0x5f')});})[_0x248c('0x1d')](function(){var _0x5531b0=_0x302e6b[_0x248c('0x60')]['get']({'plain':!![]});if(!_0x5531b0)throw new Error(_0x248c('0x61'));if(_0x5531b0[_0x248c('0x62')]===_0x248c('0x60')){var _0x40f019=_0x2562b4[_0x248c('0x35')]({'plain':!![]});return db[_0x248c('0x63')][_0x248c('0x55')]({'where':{'name':'Contexts','userProfileId':_0x5531b0[_0x248c('0x64')]},'raw':!![]})[_0x248c('0x1d')](function(_0x113e96){if(_0x113e96&&_0x113e96[_0x248c('0x65')]===0x0){return db[_0x248c('0x37')]['create']({'name':_0x40f019[_0x248c('0x39')],'resourceId':_0x40f019['id'],'type':_0x113e96['name'],'sectionId':_0x113e96['id']},{})[_0x248c('0x1d')](function(){return _0x2562b4;});}else{return _0x2562b4;}})[_0x248c('0x27')](function(_0x396885){logger[_0x248c('0x24')](_0x248c('0x66'),_0x396885);throw _0x396885;});}return _0x2562b4;})[_0x248c('0x1d')](respondWithResult(_0x55cebe,0xc9))[_0x248c('0x27')](handleError(_0x55cebe,null));};exports[_0x248c('0x33')]=function(_0xc279d0,_0x369196,_0x249d2f){var _0x4c4853;return db[_0x248c('0x3d')][_0x248c('0x55')]({'where':{'id':_0xc279d0[_0x248c('0x67')]['id']}})[_0x248c('0x1d')](handleEntityNotFound(_0x369196,null))[_0x248c('0x1d')](saveUpdates(_0xc279d0[_0x248c('0x57')],null))[_0x248c('0x1d')](function(_0x36c5f5){if(_0x36c5f5){_0x4c4853=_0x36c5f5;return db[_0x248c('0x3d')][_0x248c('0x53')]({'raw':!![]});}})[_0x248c('0x1d')](function(_0x5da68c){var _0x38710a=fs['readFileSync'](path[_0x248c('0x59')](config[_0x248c('0x5a')],_0x248c('0x5b')),_0x248c('0x5c'));var _0x362d65=ejs[_0x248c('0x5d')](_0x38710a,{'contexts':_0x5da68c||[]});fs[_0x248c('0x68')](_0x248c('0x5e'),_0x362d65);})[_0x248c('0x1d')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x248c('0x5f')});})[_0x248c('0x1d')](function(){return _0x4c4853;})[_0x248c('0x1d')](respondWithResult(_0x369196,null))['catch'](handleError(_0x369196,null));};exports[_0x248c('0x34')]=function(_0x12484f,_0x1539c1,_0x100c80){var _0x4b3492;return db[_0x248c('0x3d')][_0x248c('0x55')]({'where':{'id':_0x12484f[_0x248c('0x67')]['id']}})[_0x248c('0x1d')](handleEntityNotFound(_0x1539c1,null))['then'](removeEntity(_0x1539c1,null))[_0x248c('0x1d')](function(){return db['VoiceContext'][_0x248c('0x53')]({'raw':!![]});})[_0x248c('0x1d')](function(_0x253edc){var _0x4b4f7a=fs[_0x248c('0x58')](path[_0x248c('0x59')](config[_0x248c('0x5a')],_0x248c('0x5b')),_0x248c('0x5c'));var _0xf6dfba=ejs['render'](_0x4b4f7a,{'contexts':_0x253edc});fs[_0x248c('0x68')](_0x248c('0x5e'),_0xf6dfba);return respondWithRpcPromise(_0x248c('0x69'),_0x248c('0x34'),{'module':_0x248c('0x5f')});})['catch'](handleError(_0x1539c1,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 1c21dd2..05d0cf4 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 _0xb35e=['./voiceContext.attributes','exports','define','VoiceContext','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb35e,0x190));var _0xeb35=function(_0x42240a,_0x33dd2a){_0x42240a=_0x42240a-0x0;var _0xbed48b=_0xb35e[_0x42240a];return _0xbed48b;};'use strict';var _=require(_0xeb35('0x0'));var util=require('util');var logger=require(_0xeb35('0x1'))(_0xeb35('0x2'));var moment=require('moment');var BPromise=require(_0xeb35('0x3'));var rp=require(_0xeb35('0x4'));var fs=require('fs');var path=require(_0xeb35('0x5'));var rimraf=require(_0xeb35('0x6'));var config=require(_0xeb35('0x7'));var attributes=require(_0xeb35('0x8'));module[_0xeb35('0x9')]=function(_0x11b0bb,_0x182420){return _0x11b0bb[_0xeb35('0xa')](_0xeb35('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38f5=['./voiceContext.attributes','define','VoiceContext','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x38f5,0x71));var _0x538f=function(_0x348d9b,_0x19878b){_0x348d9b=_0x348d9b-0x0;var _0x579b30=_0x38f5[_0x348d9b];return _0x579b30;};'use strict';var _=require(_0x538f('0x0'));var util=require(_0x538f('0x1'));var logger=require('../../config/logger')(_0x538f('0x2'));var moment=require(_0x538f('0x3'));var BPromise=require(_0x538f('0x4'));var rp=require(_0x538f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x538f('0x6'));var config=require(_0x538f('0x7'));var attributes=require(_0x538f('0x8'));module['exports']=function(_0x2d15ae,_0x30bd9f){return _0x2d15ae[_0x538f('0x9')](_0x538f('0xa'),attributes,{'tableName':'voice_contexts','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 6deea1b..7411630 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 _0x4dd3=['message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x55ec71,_0x53e227){var _0x419323=function(_0x4acbdb){while(--_0x4acbdb){_0x55ec71['push'](_0x55ec71['shift']());}};_0x419323(++_0x53e227);}(_0x4dd3,0xf5));var _0x34dd=function(_0x29a29f,_0x155ce7){_0x29a29f=_0x29a29f-0x0;var _0x443ea3=_0x4dd3[_0x29a29f];return _0x443ea3;};'use strict';var _=require(_0x34dd('0x0'));var util=require(_0x34dd('0x1'));var moment=require(_0x34dd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34dd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x34dd('0x4'));var logger=require(_0x34dd('0x5'))(_0x34dd('0x6'));var config=require('../../config/environment');var jayson=require(_0x34dd('0x7'));var client=jayson[_0x34dd('0x8')][_0x34dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x365482,_0x3a3429,_0x5e8911){return new BPromise(function(_0x4cb036,_0xc0c516){return client[_0x34dd('0xa')](_0x365482,_0x5e8911)[_0x34dd('0xb')](function(_0x4e1bc8){logger[_0x34dd('0xc')](_0x34dd('0xd'),_0x3a3429,_0x34dd('0xe'));logger[_0x34dd('0xf')](_0x34dd('0x10'),_0x3a3429,_0x34dd('0xe'),JSON['stringify'](_0x4e1bc8));if(_0x4e1bc8[_0x34dd('0x11')]){if(_0x4e1bc8[_0x34dd('0x11')][_0x34dd('0x12')]===0x1f4){logger[_0x34dd('0x11')](_0x34dd('0xd'),_0x3a3429,_0x4e1bc8['error']['message']);return _0xc0c516(_0x4e1bc8[_0x34dd('0x11')][_0x34dd('0x13')]);}logger[_0x34dd('0x11')]('VoiceContext,\x20%s,\x20%s',_0x3a3429,_0x4e1bc8[_0x34dd('0x11')]['message']);return _0x4cb036(_0x4e1bc8[_0x34dd('0x11')][_0x34dd('0x13')]);}else{logger[_0x34dd('0xc')](_0x34dd('0xd'),_0x3a3429,_0x34dd('0xe'));_0x4cb036(_0x4e1bc8[_0x34dd('0x14')]['message']);}})[_0x34dd('0x15')](function(_0x46d9f5){logger[_0x34dd('0x11')](_0x34dd('0xd'),_0x3a3429,_0x46d9f5);_0xc0c516(_0x46d9f5);});});} \ No newline at end of file +var _0x3b46=['request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2e7475,_0x4a4b76){var _0x5fa576=function(_0x2e6e49){while(--_0x2e6e49){_0x2e7475['push'](_0x2e7475['shift']());}};_0x5fa576(++_0x4a4b76);}(_0x3b46,0x1a2));var _0x63b4=function(_0x29aefc,_0x4dcf53){_0x29aefc=_0x29aefc-0x0;var _0x11be36=_0x3b46[_0x29aefc];return _0x11be36;};'use strict';var _=require(_0x63b4('0x0'));var util=require(_0x63b4('0x1'));var moment=require(_0x63b4('0x2'));var BPromise=require(_0x63b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x63b4('0x4'));var db=require(_0x63b4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x63b4('0x6'))(_0x63b4('0x7'));var config=require(_0x63b4('0x8'));var jayson=require(_0x63b4('0x9'));var client=jayson[_0x63b4('0xa')][_0x63b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x514b5d,_0x5ce3df,_0x352379){return new BPromise(function(_0x4b02fb,_0x261eb8){return client[_0x63b4('0xc')](_0x514b5d,_0x352379)[_0x63b4('0xd')](function(_0x438ec8){logger['info']('VoiceContext,\x20%s,\x20%s',_0x5ce3df,_0x63b4('0xe'));logger[_0x63b4('0xf')](_0x63b4('0x10'),_0x5ce3df,_0x63b4('0xe'),JSON[_0x63b4('0x11')](_0x438ec8));if(_0x438ec8[_0x63b4('0x12')]){if(_0x438ec8['error'][_0x63b4('0x13')]===0x1f4){logger[_0x63b4('0x12')](_0x63b4('0x14'),_0x5ce3df,_0x438ec8[_0x63b4('0x12')]['message']);return _0x261eb8(_0x438ec8[_0x63b4('0x12')][_0x63b4('0x15')]);}logger[_0x63b4('0x12')](_0x63b4('0x14'),_0x5ce3df,_0x438ec8[_0x63b4('0x12')][_0x63b4('0x15')]);return _0x4b02fb(_0x438ec8[_0x63b4('0x12')]['message']);}else{logger[_0x63b4('0x16')](_0x63b4('0x14'),_0x5ce3df,_0x63b4('0xe'));_0x4b02fb(_0x438ec8['result'][_0x63b4('0x15')]);}})[_0x63b4('0x17')](function(_0x39b0dc){logger[_0x63b4('0x12')]('VoiceContext,\x20%s,\x20%s',_0x5ce3df,_0x39b0dc);_0x261eb8(_0x39b0dc);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 4c0d812..8e112b8 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 _0xfc73=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceDialReport.controller','get'];(function(_0x81fef0,_0x1f4f54){var _0xf9c3c2=function(_0x717b24){while(--_0x717b24){_0x81fef0['push'](_0x81fef0['shift']());}};_0xf9c3c2(++_0x1f4f54);}(_0xfc73,0x1e5));var _0x3fc7=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xfc73[_0x2aec52];return _0x3b8835;};'use strict';var multer=require(_0x3fc7('0x0'));var util=require(_0x3fc7('0x1'));var path=require('path');var timeout=require(_0x3fc7('0x2'));var express=require(_0x3fc7('0x3'));var router=express[_0x3fc7('0x4')]();var fs_extra=require(_0x3fc7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3fc7('0x6'));var controller=require(_0x3fc7('0x7'));router[_0x3fc7('0x8')]('/',auth[_0x3fc7('0x9')](),controller[_0x3fc7('0xa')]);router[_0x3fc7('0x8')]('/describe',auth[_0x3fc7('0x9')](),controller['describe']);router[_0x3fc7('0x8')](_0x3fc7('0xb'),auth[_0x3fc7('0x9')](),controller[_0x3fc7('0xc')]);router[_0x3fc7('0xd')]('/',auth[_0x3fc7('0x9')](),controller[_0x3fc7('0xe')]);router[_0x3fc7('0xf')]('/:id',auth[_0x3fc7('0x9')](),controller['update']);router[_0x3fc7('0x10')]('/:id',auth[_0x3fc7('0x9')](),controller[_0x3fc7('0x11')]);module[_0x3fc7('0x12')]=router; \ No newline at end of file +var _0x7ee3=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x30ce68,_0x25ff90){var _0x5dece8=function(_0x1540a3){while(--_0x1540a3){_0x30ce68['push'](_0x30ce68['shift']());}};_0x5dece8(++_0x25ff90);}(_0x7ee3,0xf3));var _0x37ee=function(_0x4637f0,_0x30443d){_0x4637f0=_0x4637f0-0x0;var _0x2ef2ae=_0x7ee3[_0x4637f0];return _0x2ef2ae;};'use strict';var multer=require('multer');var util=require(_0x37ee('0x0'));var path=require(_0x37ee('0x1'));var timeout=require(_0x37ee('0x2'));var express=require(_0x37ee('0x3'));var router=express[_0x37ee('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x37ee('0x5'));var interaction=require(_0x37ee('0x6'));var config=require(_0x37ee('0x7'));var controller=require('./voiceDialReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x37ee('0x8')](_0x37ee('0x9'),auth[_0x37ee('0xa')](),controller[_0x37ee('0xb')]);router['get'](_0x37ee('0xc'),auth['isAuthenticated'](),controller[_0x37ee('0xd')]);router[_0x37ee('0xe')]('/',auth[_0x37ee('0xa')](),controller['create']);router[_0x37ee('0xf')](_0x37ee('0xc'),auth[_0x37ee('0xa')](),controller['update']);router[_0x37ee('0x10')](_0x37ee('0xc'),auth[_0x37ee('0xa')](),controller[_0x37ee('0x11')]);module[_0x37ee('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 85c25e9..d0580b8 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 _0x9a19=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x53f4e3,_0x62f760){var _0x25c1ef=function(_0x4e4e95){while(--_0x4e4e95){_0x53f4e3['push'](_0x53f4e3['shift']());}};_0x25c1ef(++_0x62f760);}(_0x9a19,0x114));var _0x99a1=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0x9a19[_0x54edc9];return _0x2ae7a9;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'privilege':{'type':Sequelize[_0x99a1('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x99a1('0x3')]},'channelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'calleridnum':{'type':Sequelize[_0x99a1('0x2')]},'calleridname':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'language':{'type':Sequelize[_0x99a1('0x2')]},'accountcode':{'type':Sequelize[_0x99a1('0x2')]},'context':{'type':Sequelize[_0x99a1('0x2')]},'exten':{'type':Sequelize[_0x99a1('0x2')]},'priority':{'type':Sequelize[_0x99a1('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x99a1('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'destlanguage':{'type':Sequelize[_0x99a1('0x2')]},'destaccountcode':{'type':Sequelize[_0x99a1('0x2')]},'destcontext':{'type':Sequelize[_0x99a1('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x99a1('0x3')]},'destuniqueid':{'type':Sequelize[_0x99a1('0x2')]},'destlinkedid':{'type':Sequelize[_0x99a1('0x2')]},'dialstring':{'type':Sequelize[_0x99a1('0x2')]},'dialstatus':{'type':Sequelize[_0x99a1('0x2')]},'starttime':{'type':Sequelize[_0x99a1('0x4')]},'answertime':{'type':Sequelize[_0x99a1('0x4')]},'endtime':{'type':Sequelize[_0x99a1('0x4')]},'lastevent':{'type':Sequelize[_0x99a1('0x2')],'comment':_0x99a1('0x5')},'routeId':{'type':Sequelize[_0x99a1('0x3')]},'duration':{'type':Sequelize[_0x99a1('0x3')]},'holdtime':{'type':Sequelize[_0x99a1('0x3')]},'billableseconds':{'type':Sequelize[_0x99a1('0x3')]}}; \ No newline at end of file +var _0x3e74=['DATE','sequelize','STRING','INTEGER'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x3e74,0x175));var _0x43e7=function(_0x1e7e90,_0x56c173){_0x1e7e90=_0x1e7e90-0x0;var _0x55690c=_0x3e74[_0x1e7e90];return _0x55690c;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x43e7('0x1')]},'channel':{'type':Sequelize[_0x43e7('0x1')]},'channelstate':{'type':Sequelize[_0x43e7('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x43e7('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x43e7('0x1')]},'language':{'type':Sequelize[_0x43e7('0x1')]},'accountcode':{'type':Sequelize[_0x43e7('0x1')]},'context':{'type':Sequelize[_0x43e7('0x1')]},'exten':{'type':Sequelize[_0x43e7('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x43e7('0x1')]},'linkedid':{'type':Sequelize[_0x43e7('0x1')]},'destchannel':{'type':Sequelize[_0x43e7('0x1')]},'destchannelstate':{'type':Sequelize[_0x43e7('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x43e7('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x43e7('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x43e7('0x1')]},'destaccountcode':{'type':Sequelize[_0x43e7('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x43e7('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x43e7('0x1')]},'destlinkedid':{'type':Sequelize[_0x43e7('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x43e7('0x1')]},'starttime':{'type':Sequelize[_0x43e7('0x3')]},'answertime':{'type':Sequelize[_0x43e7('0x3')]},'endtime':{'type':Sequelize[_0x43e7('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x43e7('0x2')]},'duration':{'type':Sequelize[_0x43e7('0x2')]},'holdtime':{'type':Sequelize[_0x43e7('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 6d71703..ff2116d 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 _0x2ffb=['params','rawAttributes','includeAll','include','options','find','catch','create','body','destroy','describe','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','then','end','error','stack','name','send','index','map','VoiceDialReport','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','findAll','rows','show'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0x2ffb,0x1e7));var _0xb2ff=function(_0x5d8cd3,_0x1638dd){_0x5d8cd3=_0x5d8cd3-0x0;var _0x804d64=_0x2ffb[_0x5d8cd3];return _0x804d64;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb2ff('0x0'));var rp=require(_0xb2ff('0x1'));var moment=require('moment');var BPromise=require(_0xb2ff('0x2'));var Mustache=require(_0xb2ff('0x3'));var util=require('util');var path=require(_0xb2ff('0x4'));var sox=require(_0xb2ff('0x5'));var csv=require('to-csv');var ejs=require(_0xb2ff('0x6'));var fs=require('fs');var fs_extra=require(_0xb2ff('0x7'));var _=require(_0xb2ff('0x8'));var squel=require(_0xb2ff('0x9'));var crypto=require(_0xb2ff('0xa'));var jsforce=require(_0xb2ff('0xb'));var deskjs=require(_0xb2ff('0xc'));var toCsv=require(_0xb2ff('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb2ff('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb2ff('0xf'))(_0xb2ff('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb2ff('0x11'))['db'];function respondWithStatusCode(_0x5529a6,_0x39943e){_0x39943e=_0x39943e||0xcc;return function(_0x41a363){if(_0x41a363){return _0x5529a6[_0xb2ff('0x12')](_0x39943e);}return _0x5529a6[_0xb2ff('0x13')](_0x39943e)['end']();};}function respondWithResult(_0x3876d8,_0x232ad9){_0x232ad9=_0x232ad9||0xc8;return function(_0x3f2e54){if(_0x3f2e54){return _0x3876d8['status'](_0x232ad9)[_0xb2ff('0x14')](_0x3f2e54);}};}function respondWithFilteredResult(_0x59b573,_0x4120f1){return function(_0xf2da06){if(_0xf2da06){var _0x2b2a51=typeof _0x4120f1[_0xb2ff('0x15')]===_0xb2ff('0x16')&&typeof _0x4120f1['limit']===_0xb2ff('0x16');var _0x4dc86c=_0xf2da06[_0xb2ff('0x17')];var _0x5ed923=_0x2b2a51?0x0:_0x4120f1[_0xb2ff('0x15')];var _0x354440=_0x2b2a51?_0xf2da06['count']:_0x4120f1[_0xb2ff('0x15')]+_0x4120f1[_0xb2ff('0x18')];var _0x3f3b2a;if(_0x354440>=_0x4dc86c){_0x354440=_0x4dc86c;_0x3f3b2a=0xc8;}else{_0x3f3b2a=0xce;}_0x59b573[_0xb2ff('0x13')](_0x3f3b2a);return _0x59b573[_0xb2ff('0x19')]('Content-Range',_0x5ed923+'-'+_0x354440+'/'+_0x4dc86c)['json'](_0xf2da06);}return null;};}function patchUpdates(_0x4791b5){return function(_0x426fdd){try{jsonpatch[_0xb2ff('0x1a')](_0x426fdd,_0x4791b5,!![]);}catch(_0x28a0ee){return BPromise['reject'](_0x28a0ee);}return _0x426fdd[_0xb2ff('0x1b')]();};}function saveUpdates(_0x2c057d,_0x284968){return function(_0xfd5d8d){if(_0xfd5d8d){return _0xfd5d8d[_0xb2ff('0x1c')](_0x2c057d)[_0xb2ff('0x1d')](function(_0x1ee510){return _0x1ee510;});}return null;};}function removeEntity(_0x3d13a7,_0x4bffd7){return function(_0x348035){if(_0x348035){return _0x348035['destroy']()[_0xb2ff('0x1d')](function(){_0x3d13a7[_0xb2ff('0x13')](0xcc)[_0xb2ff('0x1e')]();});}};}function handleEntityNotFound(_0x4547de,_0x3e5d82){return function(_0x5c6913){if(!_0x5c6913){_0x4547de[_0xb2ff('0x12')](0x194);}return _0x5c6913;};}function handleError(_0x551c0c,_0x26e2e0){_0x26e2e0=_0x26e2e0||0x1f4;return function(_0x331487){logger[_0xb2ff('0x1f')](_0x331487[_0xb2ff('0x20')]);if(_0x331487[_0xb2ff('0x21')]){delete _0x331487[_0xb2ff('0x21')];}_0x551c0c['status'](_0x26e2e0)[_0xb2ff('0x22')](_0x331487);};}exports[_0xb2ff('0x23')]=function(_0x1a025d,_0x15ad28){var _0x27651f={},_0x457d7b={},_0x143bde={'count':0x0,'rows':[]};var _0xf9c70f=_[_0xb2ff('0x24')](db[_0xb2ff('0x25')]['rawAttributes'],function(_0x498d1e){return{'name':_0x498d1e[_0xb2ff('0x26')],'type':_0x498d1e[_0xb2ff('0x27')]['key']};});_0x457d7b[_0xb2ff('0x28')]=_[_0xb2ff('0x24')](_0xf9c70f,'name');_0x457d7b['query']=_[_0xb2ff('0x29')](_0x1a025d[_0xb2ff('0x2a')]);_0x457d7b[_0xb2ff('0x2b')]=_[_0xb2ff('0x2c')](_0x457d7b[_0xb2ff('0x28')],_0x457d7b[_0xb2ff('0x2a')]);_0x27651f['attributes']=_[_0xb2ff('0x2c')](_0x457d7b['model'],qs[_0xb2ff('0x2d')](_0x1a025d[_0xb2ff('0x2a')][_0xb2ff('0x2d')]));_0x27651f[_0xb2ff('0x2e')]=_0x27651f[_0xb2ff('0x2e')][_0xb2ff('0x2f')]?_0x27651f[_0xb2ff('0x2e')]:_0x457d7b[_0xb2ff('0x28')];if(!_0x1a025d[_0xb2ff('0x2a')]['hasOwnProperty'](_0xb2ff('0x30'))){_0x27651f[_0xb2ff('0x18')]=qs[_0xb2ff('0x18')](_0x1a025d['query'][_0xb2ff('0x18')]);_0x27651f[_0xb2ff('0x15')]=qs[_0xb2ff('0x15')](_0x1a025d[_0xb2ff('0x2a')][_0xb2ff('0x15')]);}_0x27651f[_0xb2ff('0x31')]=qs[_0xb2ff('0x32')](_0x1a025d['query']['sort']);_0x27651f[_0xb2ff('0x33')]=qs[_0xb2ff('0x2b')](_[_0xb2ff('0x34')](_0x1a025d[_0xb2ff('0x2a')],_0x457d7b[_0xb2ff('0x2b')]),_0xf9c70f);if(_0x1a025d[_0xb2ff('0x2a')]['filter']){_0x27651f[_0xb2ff('0x33')]=_['merge'](_0x27651f['where'],{'$or':_[_0xb2ff('0x24')](_0xf9c70f,function(_0x101c4e){if(_0x101c4e[_0xb2ff('0x27')]!=='VIRTUAL'){var _0x479b14={};_0x479b14[_0x101c4e[_0xb2ff('0x21')]]={'$like':'%'+_0x1a025d[_0xb2ff('0x2a')]['filter']+'%'};return _0x479b14;}})});}_0x27651f=_[_0xb2ff('0x35')]({},_0x27651f,_0x1a025d['options']);var _0x889967={'where':_0x27651f[_0xb2ff('0x33')]};return db['VoiceDialReport'][_0xb2ff('0x17')](_0x889967)[_0xb2ff('0x1d')](function(_0x4e0812){_0x143bde[_0xb2ff('0x17')]=_0x4e0812;if(_0x1a025d[_0xb2ff('0x2a')]['includeAll']){_0x27651f['include']=[{'all':!![]}];}return db[_0xb2ff('0x25')][_0xb2ff('0x36')](_0x27651f);})[_0xb2ff('0x1d')](function(_0x41ff64){_0x143bde[_0xb2ff('0x37')]=_0x41ff64;return _0x143bde;})['then'](respondWithFilteredResult(_0x15ad28,_0x27651f))['catch'](handleError(_0x15ad28,null));};exports[_0xb2ff('0x38')]=function(_0x462d19,_0x4c6067){var _0x5442a5={'raw':!![],'where':{'id':_0x462d19[_0xb2ff('0x39')]['id']}},_0x224c4f={};_0x224c4f[_0xb2ff('0x28')]=_['keys'](db['VoiceDialReport'][_0xb2ff('0x3a')]);_0x224c4f[_0xb2ff('0x2a')]=_[_0xb2ff('0x29')](_0x462d19['query']);_0x224c4f['filters']=_[_0xb2ff('0x2c')](_0x224c4f['model'],_0x224c4f['query']);_0x5442a5[_0xb2ff('0x2e')]=_[_0xb2ff('0x2c')](_0x224c4f[_0xb2ff('0x28')],qs[_0xb2ff('0x2d')](_0x462d19[_0xb2ff('0x2a')]['fields']));_0x5442a5['attributes']=_0x5442a5[_0xb2ff('0x2e')][_0xb2ff('0x2f')]?_0x5442a5[_0xb2ff('0x2e')]:_0x224c4f[_0xb2ff('0x28')];if(_0x462d19[_0xb2ff('0x2a')][_0xb2ff('0x3b')]){_0x5442a5[_0xb2ff('0x3c')]=[{'all':!![]}];}_0x5442a5=_[_0xb2ff('0x35')]({},_0x5442a5,_0x462d19[_0xb2ff('0x3d')]);return db[_0xb2ff('0x25')][_0xb2ff('0x3e')](_0x5442a5)['then'](handleEntityNotFound(_0x4c6067,null))[_0xb2ff('0x1d')](respondWithResult(_0x4c6067,null))[_0xb2ff('0x3f')](handleError(_0x4c6067,null));};exports[_0xb2ff('0x40')]=function(_0x19554e,_0x5473da){return db[_0xb2ff('0x25')]['create'](_0x19554e[_0xb2ff('0x41')],{})[_0xb2ff('0x1d')](respondWithResult(_0x5473da,0xc9))['catch'](handleError(_0x5473da,null));};exports[_0xb2ff('0x1c')]=function(_0xf38200,_0x155b97){if(_0xf38200['body']['id']){delete _0xf38200[_0xb2ff('0x41')]['id'];}return db['VoiceDialReport'][_0xb2ff('0x3e')]({'where':{'id':_0xf38200[_0xb2ff('0x39')]['id']}})[_0xb2ff('0x1d')](handleEntityNotFound(_0x155b97,null))[_0xb2ff('0x1d')](saveUpdates(_0xf38200[_0xb2ff('0x41')],null))[_0xb2ff('0x1d')](respondWithResult(_0x155b97,null))[_0xb2ff('0x3f')](handleError(_0x155b97,null));};exports[_0xb2ff('0x42')]=function(_0x240f57,_0x116dc7){return db[_0xb2ff('0x25')][_0xb2ff('0x3e')]({'where':{'id':_0x240f57['params']['id']}})[_0xb2ff('0x1d')](handleEntityNotFound(_0x116dc7,null))[_0xb2ff('0x1d')](removeEntity(_0x116dc7,null))[_0xb2ff('0x3f')](handleError(_0x116dc7,null));};exports[_0xb2ff('0x43')]=function(_0x177f7b,_0x5a48c8){return db[_0xb2ff('0x25')][_0xb2ff('0x43')]()['then'](respondWithResult(_0x5a48c8,null))['catch'](handleError(_0x5a48c8,null));}; \ No newline at end of file +var _0xcdc8=['path','to-csv','ejs','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','save','update','destroy','then','error','name','send','index','map','VoiceDialReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','catch','show','params','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x1526e1,_0x5ed5a5){var _0x249a1e=function(_0x4a7c12){while(--_0x4a7c12){_0x1526e1['push'](_0x1526e1['shift']());}};_0x249a1e(++_0x5ed5a5);}(_0xcdc8,0xb7));var _0x8cdc=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xcdc8[_0x2b7764];return _0x848dcb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8cdc('0x0'));var zipdir=require(_0x8cdc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8cdc('0x2'));var moment=require(_0x8cdc('0x3'));var BPromise=require(_0x8cdc('0x4'));var Mustache=require(_0x8cdc('0x5'));var util=require('util');var path=require(_0x8cdc('0x6'));var sox=require('sox');var csv=require(_0x8cdc('0x7'));var ejs=require(_0x8cdc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8cdc('0x9'));var toCsv=require(_0x8cdc('0x7'));var querystring=require(_0x8cdc('0xa'));var Papa=require(_0x8cdc('0xb'));var Redis=require('ioredis');var authService=require(_0x8cdc('0xc'));var qs=require(_0x8cdc('0xd'));var as=require(_0x8cdc('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8cdc('0xf'))('api');var utils=require(_0x8cdc('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8cdc('0x11'))['db'];function respondWithStatusCode(_0x19b558,_0x291f16){_0x291f16=_0x291f16||0xcc;return function(_0x1f2903){if(_0x1f2903){return _0x19b558[_0x8cdc('0x12')](_0x291f16);}return _0x19b558[_0x8cdc('0x13')](_0x291f16)[_0x8cdc('0x14')]();};}function respondWithResult(_0x41260e,_0x146881){_0x146881=_0x146881||0xc8;return function(_0x57b075){if(_0x57b075){return _0x41260e[_0x8cdc('0x13')](_0x146881)['json'](_0x57b075);}};}function respondWithFilteredResult(_0x1c76bc,_0x525f41){return function(_0x3c3923){if(_0x3c3923){var _0x50eaa2=typeof _0x525f41[_0x8cdc('0x15')]===_0x8cdc('0x16')&&typeof _0x525f41[_0x8cdc('0x17')]==='undefined';var _0x575fcc=_0x3c3923[_0x8cdc('0x18')];var _0x59772b=_0x50eaa2?0x0:_0x525f41[_0x8cdc('0x15')];var _0x593d6e=_0x50eaa2?_0x3c3923['count']:_0x525f41[_0x8cdc('0x15')]+_0x525f41['limit'];var _0x280e6e;if(_0x593d6e>=_0x575fcc){_0x593d6e=_0x575fcc;_0x280e6e=0xc8;}else{_0x280e6e=0xce;}_0x1c76bc[_0x8cdc('0x13')](_0x280e6e);return _0x1c76bc[_0x8cdc('0x19')]('Content-Range',_0x59772b+'-'+_0x593d6e+'/'+_0x575fcc)['json'](_0x3c3923);}return null;};}function patchUpdates(_0x24361e){return function(_0x8d436b){try{jsonpatch[_0x8cdc('0x1a')](_0x8d436b,_0x24361e,!![]);}catch(_0x46626d){return BPromise['reject'](_0x46626d);}return _0x8d436b[_0x8cdc('0x1b')]();};}function saveUpdates(_0x172bd6,_0x317b37){return function(_0x317139){if(_0x317139){return _0x317139[_0x8cdc('0x1c')](_0x172bd6)['then'](function(_0x5ea2a6){return _0x5ea2a6;});}return null;};}function removeEntity(_0x2a101d,_0x2bd40d){return function(_0x427e27){if(_0x427e27){return _0x427e27[_0x8cdc('0x1d')]()[_0x8cdc('0x1e')](function(){_0x2a101d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cd98d,_0x18e2e1){return function(_0x317f37){if(!_0x317f37){_0x3cd98d[_0x8cdc('0x12')](0x194);}return _0x317f37;};}function handleError(_0x5e2061,_0x41a586){_0x41a586=_0x41a586||0x1f4;return function(_0x164fe5){logger[_0x8cdc('0x1f')](_0x164fe5['stack']);if(_0x164fe5['name']){delete _0x164fe5[_0x8cdc('0x20')];}_0x5e2061[_0x8cdc('0x13')](_0x41a586)[_0x8cdc('0x21')](_0x164fe5);};}exports[_0x8cdc('0x22')]=function(_0x4796d5,_0x427561){var _0x5f3c9e={},_0x1ffaf0={},_0x2b3ff5={'count':0x0,'rows':[]};var _0x4e6c01=_[_0x8cdc('0x23')](db[_0x8cdc('0x24')]['rawAttributes'],function(_0x149f32){return{'name':_0x149f32[_0x8cdc('0x25')],'type':_0x149f32[_0x8cdc('0x26')][_0x8cdc('0x27')]};});_0x1ffaf0[_0x8cdc('0x28')]=_[_0x8cdc('0x23')](_0x4e6c01,'name');_0x1ffaf0[_0x8cdc('0x29')]=_[_0x8cdc('0x2a')](_0x4796d5['query']);_0x1ffaf0[_0x8cdc('0x2b')]=_[_0x8cdc('0x2c')](_0x1ffaf0[_0x8cdc('0x28')],_0x1ffaf0[_0x8cdc('0x29')]);_0x5f3c9e[_0x8cdc('0x2d')]=_[_0x8cdc('0x2c')](_0x1ffaf0[_0x8cdc('0x28')],qs[_0x8cdc('0x2e')](_0x4796d5['query'][_0x8cdc('0x2e')]));_0x5f3c9e[_0x8cdc('0x2d')]=_0x5f3c9e[_0x8cdc('0x2d')][_0x8cdc('0x2f')]?_0x5f3c9e[_0x8cdc('0x2d')]:_0x1ffaf0[_0x8cdc('0x28')];if(!_0x4796d5['query'][_0x8cdc('0x30')](_0x8cdc('0x31'))){_0x5f3c9e['limit']=qs[_0x8cdc('0x17')](_0x4796d5['query'][_0x8cdc('0x17')]);_0x5f3c9e['offset']=qs[_0x8cdc('0x15')](_0x4796d5['query'][_0x8cdc('0x15')]);}_0x5f3c9e[_0x8cdc('0x32')]=qs[_0x8cdc('0x33')](_0x4796d5[_0x8cdc('0x29')]['sort']);_0x5f3c9e[_0x8cdc('0x34')]=qs[_0x8cdc('0x2b')](_['pick'](_0x4796d5[_0x8cdc('0x29')],_0x1ffaf0[_0x8cdc('0x2b')]),_0x4e6c01);if(_0x4796d5[_0x8cdc('0x29')]['filter']){_0x5f3c9e[_0x8cdc('0x34')]=_['merge'](_0x5f3c9e[_0x8cdc('0x34')],{'$or':_[_0x8cdc('0x23')](_0x4e6c01,function(_0x222c3e){if(_0x222c3e[_0x8cdc('0x26')]!=='VIRTUAL'){var _0x2c622a={};_0x2c622a[_0x222c3e[_0x8cdc('0x20')]]={'$like':'%'+_0x4796d5[_0x8cdc('0x29')]['filter']+'%'};return _0x2c622a;}})});}_0x5f3c9e=_[_0x8cdc('0x35')]({},_0x5f3c9e,_0x4796d5[_0x8cdc('0x36')]);var _0x4e638f={'where':_0x5f3c9e['where']};return db[_0x8cdc('0x24')][_0x8cdc('0x18')](_0x4e638f)[_0x8cdc('0x1e')](function(_0x45f33c){_0x2b3ff5['count']=_0x45f33c;if(_0x4796d5['query'][_0x8cdc('0x37')]){_0x5f3c9e['include']=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x5f3c9e);})[_0x8cdc('0x1e')](function(_0x57abdf){_0x2b3ff5['rows']=_0x57abdf;return _0x2b3ff5;})['then'](respondWithFilteredResult(_0x427561,_0x5f3c9e))[_0x8cdc('0x38')](handleError(_0x427561,null));};exports[_0x8cdc('0x39')]=function(_0x3a20bb,_0x21f020){var _0x5aee30={'raw':!![],'where':{'id':_0x3a20bb[_0x8cdc('0x3a')]['id']}},_0x36c6b5={};_0x36c6b5[_0x8cdc('0x28')]=_[_0x8cdc('0x2a')](db[_0x8cdc('0x24')]['rawAttributes']);_0x36c6b5['query']=_[_0x8cdc('0x2a')](_0x3a20bb[_0x8cdc('0x29')]);_0x36c6b5[_0x8cdc('0x2b')]=_[_0x8cdc('0x2c')](_0x36c6b5[_0x8cdc('0x28')],_0x36c6b5[_0x8cdc('0x29')]);_0x5aee30[_0x8cdc('0x2d')]=_[_0x8cdc('0x2c')](_0x36c6b5[_0x8cdc('0x28')],qs['fields'](_0x3a20bb[_0x8cdc('0x29')][_0x8cdc('0x2e')]));_0x5aee30[_0x8cdc('0x2d')]=_0x5aee30[_0x8cdc('0x2d')][_0x8cdc('0x2f')]?_0x5aee30['attributes']:_0x36c6b5[_0x8cdc('0x28')];if(_0x3a20bb[_0x8cdc('0x29')][_0x8cdc('0x37')]){_0x5aee30['include']=[{'all':!![]}];}_0x5aee30=_[_0x8cdc('0x35')]({},_0x5aee30,_0x3a20bb[_0x8cdc('0x36')]);return db[_0x8cdc('0x24')][_0x8cdc('0x3b')](_0x5aee30)[_0x8cdc('0x1e')](handleEntityNotFound(_0x21f020,null))['then'](respondWithResult(_0x21f020,null))[_0x8cdc('0x38')](handleError(_0x21f020,null));};exports[_0x8cdc('0x3c')]=function(_0xdb99c9,_0x18b70e){return db['VoiceDialReport'][_0x8cdc('0x3c')](_0xdb99c9[_0x8cdc('0x3d')],{})[_0x8cdc('0x1e')](respondWithResult(_0x18b70e,0xc9))[_0x8cdc('0x38')](handleError(_0x18b70e,null));};exports['update']=function(_0x21585b,_0x125b3a){if(_0x21585b[_0x8cdc('0x3d')]['id']){delete _0x21585b[_0x8cdc('0x3d')]['id'];}return db[_0x8cdc('0x24')]['find']({'where':{'id':_0x21585b[_0x8cdc('0x3a')]['id']}})[_0x8cdc('0x1e')](handleEntityNotFound(_0x125b3a,null))[_0x8cdc('0x1e')](saveUpdates(_0x21585b[_0x8cdc('0x3d')],null))['then'](respondWithResult(_0x125b3a,null))['catch'](handleError(_0x125b3a,null));};exports['destroy']=function(_0x757eeb,_0x3b9012){return db[_0x8cdc('0x24')][_0x8cdc('0x3b')]({'where':{'id':_0x757eeb[_0x8cdc('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3b9012,null))[_0x8cdc('0x1e')](removeEntity(_0x3b9012,null))['catch'](handleError(_0x3b9012,null));};exports[_0x8cdc('0x3e')]=function(_0x4490b8,_0xe45f21){return db[_0x8cdc('0x24')][_0x8cdc('0x3e')]()[_0x8cdc('0x1e')](respondWithResult(_0xe45f21,null))[_0x8cdc('0x38')](handleError(_0xe45f21,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 30220dc..0f28fe1 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 _0x98a8=['report_dial','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define'];(function(_0x153663,_0x3ef313){var _0xfcdd26=function(_0x5b4cc7){while(--_0x5b4cc7){_0x153663['push'](_0x153663['shift']());}};_0xfcdd26(++_0x3ef313);}(_0x98a8,0x12c));var _0x898a=function(_0xa63aa1,_0x54f32e){_0xa63aa1=_0xa63aa1-0x0;var _0x279e0f=_0x98a8[_0xa63aa1];return _0x279e0f;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var logger=require(_0x898a('0x2'))(_0x898a('0x3'));var moment=require(_0x898a('0x4'));var BPromise=require(_0x898a('0x5'));var rp=require(_0x898a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var attributes=require(_0x898a('0x9'));module[_0x898a('0xa')]=function(_0x3e7ddd,_0x5d7e59){return _0x3e7ddd[_0x898a('0xb')]('VoiceDialReport',attributes,{'tableName':_0x898a('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbf19=['request-promise','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','moment','bluebird'];(function(_0x568f43,_0x1e7179){var _0x2cf597=function(_0x493e71){while(--_0x493e71){_0x568f43['push'](_0x568f43['shift']());}};_0x2cf597(++_0x1e7179);}(_0xbf19,0x1a0));var _0x9bf1=function(_0x30ae53,_0x5d4d89){_0x30ae53=_0x30ae53-0x0;var _0x23b11a=_0xbf19[_0x30ae53];return _0x23b11a;};'use strict';var _=require(_0x9bf1('0x0'));var util=require(_0x9bf1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9bf1('0x2'));var BPromise=require(_0x9bf1('0x3'));var rp=require(_0x9bf1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9bf1('0x5'));var config=require('../../config/environment');var attributes=require(_0x9bf1('0x6'));module[_0x9bf1('0x7')]=function(_0x425f20,_0x2698ff){return _0x425f20[_0x9bf1('0x8')](_0x9bf1('0x9'),attributes,{'tableName':_0x9bf1('0xa'),'paranoid':![],'indexes':[{'fields':[_0x9bf1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 627416c..61f45ff 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 _0x06a3=['VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','request\x20sent','result','CreateVoiceDialReport','VoiceDialReport','create','options','raw','then','where','attributes','limit','UpdateVoiceDialReport','catch','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','VoiceDialReport,\x20%s,\x20%s','debug'];(function(_0x155d1c,_0x3e4579){var _0x38c310=function(_0x272d76){while(--_0x272d76){_0x155d1c['push'](_0x155d1c['shift']());}};_0x38c310(++_0x3e4579);}(_0x06a3,0x103));var _0x306a=function(_0x4fadb8,_0x11b539){_0x4fadb8=_0x4fadb8-0x0;var _0x3c9e20=_0x06a3[_0x4fadb8];return _0x3c9e20;};'use strict';var _=require('lodash');var util=require(_0x306a('0x0'));var moment=require(_0x306a('0x1'));var BPromise=require('bluebird');var rs=require(_0x306a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x306a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x306a('0x4'))('rpc');var config=require(_0x306a('0x5'));var jayson=require(_0x306a('0x6'));var client=jayson[_0x306a('0x7')][_0x306a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f3afb,_0x116f16,_0x11299c){return new BPromise(function(_0x5ab419,_0x271558){return client['request'](_0x2f3afb,_0x11299c)['then'](function(_0xb5c4b3){logger['info'](_0x306a('0x9'),_0x116f16,'request\x20sent');logger[_0x306a('0xa')](_0x306a('0xb'),_0x116f16,'request\x20sent',JSON[_0x306a('0xc')](_0xb5c4b3));if(_0xb5c4b3['error']){if(_0xb5c4b3['error'][_0x306a('0xd')]===0x1f4){logger[_0x306a('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x116f16,_0xb5c4b3[_0x306a('0xe')][_0x306a('0xf')]);return _0x271558(_0xb5c4b3[_0x306a('0xe')]['message']);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x116f16,_0xb5c4b3[_0x306a('0xe')][_0x306a('0xf')]);return _0x5ab419(_0xb5c4b3[_0x306a('0xe')]['message']);}else{logger[_0x306a('0x10')](_0x306a('0x9'),_0x116f16,_0x306a('0x11'));_0x5ab419(_0xb5c4b3[_0x306a('0x12')]['message']);}})['catch'](function(_0x358c82){logger[_0x306a('0xe')](_0x306a('0x9'),_0x116f16,_0x358c82);_0x271558(_0x358c82);});});}exports[_0x306a('0x13')]=function(_0x303bac){var _0x4b02b0=this;return new Promise(function(_0x277872,_0x2079a3){return db[_0x306a('0x14')][_0x306a('0x15')](_0x303bac['body'],{'raw':_0x303bac[_0x306a('0x16')]?_0x303bac[_0x306a('0x16')][_0x306a('0x17')]===undefined?!![]:![]:!![]})[_0x306a('0x18')](function(_0x20e627){logger[_0x306a('0x10')](_0x306a('0x13'),_0x303bac);logger['debug'](_0x306a('0x13'),_0x303bac,JSON[_0x306a('0xc')](_0x20e627));_0x277872(_0x20e627);})['catch'](function(_0x2c5948){logger[_0x306a('0xe')](_0x306a('0x13'),_0x2c5948['message'],_0x303bac);_0x2079a3(_0x4b02b0[_0x306a('0xe')](0x1f4,_0x2c5948[_0x306a('0xf')]));});});};exports['UpdateVoiceDialReport']=function(_0x48a9d3){var _0x4f6f86=this;return new Promise(function(_0x1001e8,_0x22985f){return db['VoiceDialReport']['update'](_0x48a9d3['body'],{'raw':_0x48a9d3[_0x306a('0x16')]?_0x48a9d3[_0x306a('0x16')][_0x306a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48a9d3[_0x306a('0x16')]?_0x48a9d3[_0x306a('0x16')][_0x306a('0x19')]||null:null,'attributes':_0x48a9d3[_0x306a('0x16')]?_0x48a9d3[_0x306a('0x16')][_0x306a('0x1a')]||null:null,'limit':_0x48a9d3['options']?_0x48a9d3['options'][_0x306a('0x1b')]||null:null})[_0x306a('0x18')](function(_0x21cb6b){logger[_0x306a('0x10')]('UpdateVoiceDialReport',_0x48a9d3);logger[_0x306a('0xa')](_0x306a('0x1c'),_0x48a9d3,JSON[_0x306a('0xc')](_0x21cb6b));_0x1001e8(_0x21cb6b);})[_0x306a('0x1d')](function(_0x36fd36){logger[_0x306a('0xe')](_0x306a('0x1c'),_0x36fd36['message'],_0x48a9d3);_0x22985f(_0x4f6f86[_0x306a('0xe')](0x1f4,_0x36fd36['message']));});});}; \ No newline at end of file +var _0x26a8=['VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','UpdateVoiceDialReport','update','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info'];(function(_0x2f8b45,_0x58f83c){var _0x275424=function(_0x524b2b){while(--_0x524b2b){_0x2f8b45['push'](_0x2f8b45['shift']());}};_0x275424(++_0x58f83c);}(_0x26a8,0x153));var _0x826a=function(_0x1f3c26,_0x43be03){_0x1f3c26=_0x1f3c26-0x0;var _0x51c270=_0x26a8[_0x1f3c26];return _0x51c270;};'use strict';var _=require(_0x826a('0x0'));var util=require(_0x826a('0x1'));var moment=require(_0x826a('0x2'));var BPromise=require(_0x826a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x826a('0x4'));var db=require(_0x826a('0x5'))['db'];var utils=require(_0x826a('0x6'));var logger=require('../../config/logger')(_0x826a('0x7'));var config=require(_0x826a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x826a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5cae82,_0x3e93ea,_0x47b5fd){return new BPromise(function(_0x569028,_0x4cbefe){return client[_0x826a('0xa')](_0x5cae82,_0x47b5fd)[_0x826a('0xb')](function(_0xd5913e){logger[_0x826a('0xc')](_0x826a('0xd'),_0x3e93ea,_0x826a('0xe'));logger[_0x826a('0xf')](_0x826a('0x10'),_0x3e93ea,_0x826a('0xe'),JSON[_0x826a('0x11')](_0xd5913e));if(_0xd5913e[_0x826a('0x12')]){if(_0xd5913e[_0x826a('0x12')][_0x826a('0x13')]===0x1f4){logger['error'](_0x826a('0xd'),_0x3e93ea,_0xd5913e[_0x826a('0x12')][_0x826a('0x14')]);return _0x4cbefe(_0xd5913e[_0x826a('0x12')][_0x826a('0x14')]);}logger['error'](_0x826a('0xd'),_0x3e93ea,_0xd5913e[_0x826a('0x12')][_0x826a('0x14')]);return _0x569028(_0xd5913e[_0x826a('0x12')][_0x826a('0x14')]);}else{logger[_0x826a('0xc')](_0x826a('0xd'),_0x3e93ea,_0x826a('0xe'));_0x569028(_0xd5913e[_0x826a('0x15')]['message']);}})[_0x826a('0x16')](function(_0xce5e1){logger[_0x826a('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x3e93ea,_0xce5e1);_0x4cbefe(_0xce5e1);});});}exports[_0x826a('0x17')]=function(_0x1eca73){var _0x2a5a6c=this;return new Promise(function(_0x323383,_0x550554){return db[_0x826a('0x18')]['create'](_0x1eca73[_0x826a('0x19')],{'raw':_0x1eca73[_0x826a('0x1a')]?_0x1eca73['options'][_0x826a('0x1b')]===undefined?!![]:![]:!![]})[_0x826a('0xb')](function(_0x3fe0e9){logger['info'](_0x826a('0x17'),_0x1eca73);logger['debug']('CreateVoiceDialReport',_0x1eca73,JSON[_0x826a('0x11')](_0x3fe0e9));_0x323383(_0x3fe0e9);})['catch'](function(_0x2e92ee){logger[_0x826a('0x12')](_0x826a('0x17'),_0x2e92ee['message'],_0x1eca73);_0x550554(_0x2a5a6c[_0x826a('0x12')](0x1f4,_0x2e92ee[_0x826a('0x14')]));});});};exports[_0x826a('0x1c')]=function(_0x1b6738){var _0x29e80b=this;return new Promise(function(_0x5a352e,_0x55385a){return db[_0x826a('0x18')][_0x826a('0x1d')](_0x1b6738['body'],{'raw':_0x1b6738[_0x826a('0x1a')]?_0x1b6738[_0x826a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b6738[_0x826a('0x1a')]?_0x1b6738[_0x826a('0x1a')][_0x826a('0x1e')]||null:null,'attributes':_0x1b6738['options']?_0x1b6738[_0x826a('0x1a')]['attributes']||null:null,'limit':_0x1b6738[_0x826a('0x1a')]?_0x1b6738[_0x826a('0x1a')][_0x826a('0x1f')]||null:null})[_0x826a('0xb')](function(_0xf53416){logger[_0x826a('0xc')]('UpdateVoiceDialReport',_0x1b6738);logger['debug'](_0x826a('0x1c'),_0x1b6738,JSON['stringify'](_0xf53416));_0x5a352e(_0xf53416);})[_0x826a('0x16')](function(_0xad683){logger[_0x826a('0x12')](_0x826a('0x1c'),_0xad683[_0x826a('0x14')],_0x1b6738);_0x55385a(_0x29e80b[_0x826a('0x12')](0x1f4,_0xad683[_0x826a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index c2779df..8ee9d17 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 _0x7ed1=['create','addApplications','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x147aa3,_0x493b62){var _0x10a82b=function(_0xec7379){while(--_0xec7379){_0x147aa3['push'](_0x147aa3['shift']());}};_0x10a82b(++_0x493b62);}(_0x7ed1,0x195));var _0x17ed=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x7ed1[_0x556bb1];return _0x45455f;};'use strict';var multer=require(_0x17ed('0x0'));var util=require(_0x17ed('0x1'));var path=require(_0x17ed('0x2'));var timeout=require(_0x17ed('0x3'));var express=require('express');var router=express[_0x17ed('0x4')]();var fs_extra=require(_0x17ed('0x5'));var auth=require(_0x17ed('0x6'));var interaction=require(_0x17ed('0x7'));var config=require('../../config/environment');var controller=require(_0x17ed('0x8'));router[_0x17ed('0x9')]('/',auth[_0x17ed('0xa')](),controller[_0x17ed('0xb')]);router['get'](_0x17ed('0xc'),auth[_0x17ed('0xa')](),controller[_0x17ed('0xd')]);router[_0x17ed('0xe')]('/',auth['isAuthenticated'](),controller[_0x17ed('0xf')]);router[_0x17ed('0xe')]('/:id/applications',auth[_0x17ed('0xa')](),controller[_0x17ed('0x10')]);router['put'](_0x17ed('0xc'),auth[_0x17ed('0xa')](),controller[_0x17ed('0x11')]);router[_0x17ed('0x12')](_0x17ed('0xc'),auth[_0x17ed('0xa')](),controller['destroy']);module[_0x17ed('0x13')]=router; \ No newline at end of file +var _0xab41=['index','show','post','create','isAuthenticated','addApplications','put','/:id','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2ce1db,_0x5b473c){var _0x48ae88=function(_0x221df7){while(--_0x221df7){_0x2ce1db['push'](_0x2ce1db['shift']());}};_0x48ae88(++_0x5b473c);}(_0xab41,0xac));var _0x1ab4=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xab41[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0x1ab4('0x0'));var path=require(_0x1ab4('0x1'));var timeout=require('connect-timeout');var express=require(_0x1ab4('0x2'));var router=express['Router']();var fs_extra=require(_0x1ab4('0x3'));var auth=require(_0x1ab4('0x4'));var interaction=require(_0x1ab4('0x5'));var config=require(_0x1ab4('0x6'));var controller=require('./voiceExtension.controller');router[_0x1ab4('0x7')]('/',auth['isAuthenticated'](),controller[_0x1ab4('0x8')]);router[_0x1ab4('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x1ab4('0x9')]);router[_0x1ab4('0xa')]('/',auth['isAuthenticated'](),controller[_0x1ab4('0xb')]);router['post']('/:id/applications',auth[_0x1ab4('0xc')](),controller[_0x1ab4('0xd')]);router[_0x1ab4('0xe')]('/:id',auth[_0x1ab4('0xc')](),controller['update']);router['delete'](_0x1ab4('0xf'),auth[_0x1ab4('0xc')](),controller[_0x1ab4('0x10')]);module[_0x1ab4('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index ca04e66..77c9390 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60d7=['internal','system','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','STRING','compositeIndex','ENUM','inbound','outbound'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x60d7,0x10e));var _0x760d=function(_0x440997,_0x4061d1){_0x440997=_0x440997-0x0;var _0x3eb82d=_0x60d7[_0x440997];return _0x3eb82d;};'use strict';var Sequelize=require(_0x760d('0x0'));module['exports']={'context':{'type':Sequelize[_0x760d('0x1')],'allowNull':![],'unique':_0x760d('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x760d('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x760d('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x760d('0x1')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x760d('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x760d('0x3')](_0x760d('0x4'),_0x760d('0x5'),_0x760d('0x6'),'inbound-fax','outbound-fax',_0x760d('0x7'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x760d('0x1')]},'interval':{'type':Sequelize[_0x760d('0x1')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x760d('0x8')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x760d('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x760d('0x8')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x760d('0x1')],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x760d('0x9')],'get':function(_0x17749b){return this[_0x760d('0xa')](_0x760d('0xb'));}},'alias':{'type':Sequelize[_0x760d('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xb622=['sequelize','compositeIndex','STRING','NoOp','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue'];(function(_0x498381,_0x122bfc){var _0x7e0ae8=function(_0x5b3414){while(--_0x5b3414){_0x498381['push'](_0x498381['shift']());}};_0x7e0ae8(++_0x122bfc);}(_0xb622,0xaa));var _0x2b62=function(_0x476e2a,_0x243b93){_0x476e2a=_0x476e2a-0x0;var _0x4eac3e=_0xb622[_0x476e2a];return _0x4eac3e;};'use strict';var Sequelize=require(_0x2b62('0x0'));module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2b62('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x2b62('0x2')],'allowNull':![],'unique':_0x2b62('0x1')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x2b62('0x1')},'tag':{'type':Sequelize[_0x2b62('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2b62('0x3')},'appdata':{'type':Sequelize[_0x2b62('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x2b62('0x4'),_0x2b62('0x5'),_0x2b62('0x6'),_0x2b62('0x7'),_0x2b62('0x8'),_0x2b62('0x9'),_0x2b62('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x2b62('0x2')]},'interval':{'type':Sequelize[_0x2b62('0x2')],'allowNull':![],'defaultValue':_0x2b62('0xb')},'IntervalId':{'type':Sequelize[_0x2b62('0xc')]},'isApp':{'type':Sequelize[_0x2b62('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x2b62('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x2b62('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x2b62('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x2b62('0xc')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x2b62('0xe')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x2b62('0xf')],'get':function(_0x5180f8){return this[_0x2b62('0x10')]('exten');}},'alias':{'type':Sequelize[_0x2b62('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 33de7db..0187e52 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 _0xbb58=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','offset','undefined','count','limit','apply','reject','then','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','type','find','name','end','error','stack','VoiceExtension','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','destroy','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','VoiceExtensionId','isApp','rewriteDial','toLowerCase','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x223e44,_0x4aba64){var _0xde2a8a=function(_0x3ec43b){while(--_0x3ec43b){_0x223e44['push'](_0x223e44['shift']());}};_0xde2a8a(++_0x4aba64);}(_0xbb58,0xc1));var _0x8bb5=function(_0x31e586,_0x4d0e31){_0x31e586=_0x31e586-0x0;var _0x362482=_0xbb58[_0x31e586];return _0x362482;};'use strict';var emlformat=require(_0x8bb5('0x0'));var rimraf=require(_0x8bb5('0x1'));var zipdir=require(_0x8bb5('0x2'));var jsonpatch=require(_0x8bb5('0x3'));var rp=require(_0x8bb5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8bb5('0x5'));var sox=require('sox');var csv=require(_0x8bb5('0x6'));var ejs=require(_0x8bb5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bb5('0x8'));var squel=require(_0x8bb5('0x9'));var crypto=require(_0x8bb5('0xa'));var jsforce=require(_0x8bb5('0xb'));var deskjs=require(_0x8bb5('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8bb5('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8bb5('0xe'));var as=require(_0x8bb5('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8bb5('0x10'))('api');var utils=require(_0x8bb5('0x11'));var config=require(_0x8bb5('0x12'));var licenseUtil=require(_0x8bb5('0x13'));var db=require(_0x8bb5('0x14'))['db'];config[_0x8bb5('0x15')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8bb5('0x16'))(new Redis(config['redis']));require(_0x8bb5('0x17'))[_0x8bb5('0x18')](socket);function respondWithStatusCode(_0x517a97,_0x30967f){_0x30967f=_0x30967f||0xcc;return function(_0x2cb2c2){if(_0x2cb2c2){return _0x517a97[_0x8bb5('0x19')](_0x30967f);}return _0x517a97[_0x8bb5('0x1a')](_0x30967f)['end']();};}function respondWithResult(_0x142d01,_0x19f976){_0x19f976=_0x19f976||0xc8;return function(_0x88ab3){if(_0x88ab3){return _0x142d01['status'](_0x19f976)[_0x8bb5('0x1b')](_0x88ab3);}};}function respondWithFilteredResult(_0x433c65,_0x49a3fd){return function(_0x37bf40){if(_0x37bf40){var _0x317282=typeof _0x49a3fd[_0x8bb5('0x1c')]===_0x8bb5('0x1d')&&typeof _0x49a3fd['limit']==='undefined';var _0x594335=_0x37bf40[_0x8bb5('0x1e')];var _0x1fa260=_0x317282?0x0:_0x49a3fd[_0x8bb5('0x1c')];var _0x5790bb=_0x317282?_0x37bf40[_0x8bb5('0x1e')]:_0x49a3fd[_0x8bb5('0x1c')]+_0x49a3fd[_0x8bb5('0x1f')];var _0x4cc267;if(_0x5790bb>=_0x594335){_0x5790bb=_0x594335;_0x4cc267=0xc8;}else{_0x4cc267=0xce;}_0x433c65['status'](_0x4cc267);return _0x433c65['set']('Content-Range',_0x1fa260+'-'+_0x5790bb+'/'+_0x594335)[_0x8bb5('0x1b')](_0x37bf40);}return null;};}function patchUpdates(_0x3025fd){return function(_0x1ba4e1){try{jsonpatch[_0x8bb5('0x20')](_0x1ba4e1,_0x3025fd,!![]);}catch(_0x4386af){return BPromise[_0x8bb5('0x21')](_0x4386af);}return _0x1ba4e1['save']();};}function saveUpdates(_0x4a6b57,_0x555883){return function(_0x2aad8c){if(_0x2aad8c){return _0x2aad8c['update'](_0x4a6b57)[_0x8bb5('0x22')](function(_0x4627d6){return _0x4627d6;});}return null;};}function removeEntity(_0x5c6a8b,_0x545a6a){return function(_0x235bbf){if(_0x235bbf){return _0x235bbf['destroy']()[_0x8bb5('0x22')](function(){var _0x1ab8ff=_0x235bbf['get']({'plain':!![]});var _0x30eaca=[{'name':_0x8bb5('0x23'),'value':_0x8bb5('0x24'),'ignore':![]},{'name':_0x8bb5('0x25'),'value':_0x8bb5('0x26'),'ignore':![]},{'name':_0x8bb5('0x27'),'value':_0x8bb5('0x28'),'ignore':![]}];var _0x11a8e8=_(_0x30eaca)[_0x8bb5('0x29')](_0x8bb5('0x2a'))[_0x8bb5('0x2b')]('value')[_0x8bb5('0x2c')]();if(_['includes'](_0x11a8e8,_0x1ab8ff[_0x8bb5('0x2d')])){return;}var _0xf3bed=_[_0x8bb5('0x2e')](_0x30eaca,[_0x8bb5('0x2c'),_0x1ab8ff[_0x8bb5('0x2d')]])[_0x8bb5('0x2f')];return db['UserProfileResource']['destroy']({'where':{'type':_0xf3bed,'resourceId':_0x1ab8ff['id']}})[_0x8bb5('0x22')](function(){return _0x235bbf;});})[_0x8bb5('0x22')](function(){_0x5c6a8b[_0x8bb5('0x1a')](0xcc)[_0x8bb5('0x30')]();});}};}function handleEntityNotFound(_0x6bafae,_0x5df11c){return function(_0x41c038){if(!_0x41c038){_0x6bafae[_0x8bb5('0x19')](0x194);}return _0x41c038;};}function handleError(_0x35abbf,_0x1b2704){_0x1b2704=_0x1b2704||0x1f4;return function(_0x126b7e){logger[_0x8bb5('0x31')](_0x126b7e[_0x8bb5('0x32')]);if(_0x126b7e[_0x8bb5('0x2f')]){delete _0x126b7e[_0x8bb5('0x2f')];}_0x35abbf[_0x8bb5('0x1a')](_0x1b2704)['send'](_0x126b7e);};}exports['index']=function(_0x45def6,_0x2ba63d){var _0x35ba35={},_0x12edea={},_0x5b1a71={'count':0x0,'rows':[]};var _0x1d4a0f=_[_0x8bb5('0x2b')](db[_0x8bb5('0x33')][_0x8bb5('0x34')],function(_0x1644b5){return{'name':_0x1644b5['fieldName'],'type':_0x1644b5[_0x8bb5('0x2d')][_0x8bb5('0x35')]};});_0x12edea[_0x8bb5('0x36')]=_['map'](_0x1d4a0f,'name');_0x12edea['query']=_[_0x8bb5('0x37')](_0x45def6[_0x8bb5('0x38')]);_0x12edea[_0x8bb5('0x39')]=_[_0x8bb5('0x3a')](_0x12edea[_0x8bb5('0x36')],_0x12edea[_0x8bb5('0x38')]);_0x35ba35[_0x8bb5('0x3b')]=_[_0x8bb5('0x3a')](_0x12edea['model'],qs[_0x8bb5('0x3c')](_0x45def6[_0x8bb5('0x38')][_0x8bb5('0x3c')]));_0x35ba35['attributes']=_0x35ba35[_0x8bb5('0x3b')][_0x8bb5('0x3d')]?_0x35ba35[_0x8bb5('0x3b')]:_0x12edea[_0x8bb5('0x36')];if(!_0x45def6[_0x8bb5('0x38')]['hasOwnProperty']('nolimit')){_0x35ba35[_0x8bb5('0x1f')]=qs['limit'](_0x45def6[_0x8bb5('0x38')][_0x8bb5('0x1f')]);_0x35ba35[_0x8bb5('0x1c')]=qs['offset'](_0x45def6[_0x8bb5('0x38')][_0x8bb5('0x1c')]);}_0x35ba35[_0x8bb5('0x3e')]=qs[_0x8bb5('0x3f')](_0x45def6[_0x8bb5('0x38')][_0x8bb5('0x3f')]);_0x35ba35[_0x8bb5('0x40')]=qs[_0x8bb5('0x39')](_[_0x8bb5('0x41')](_0x45def6[_0x8bb5('0x38')],_0x12edea['filters']),_0x1d4a0f);if(_0x45def6[_0x8bb5('0x38')]['filter']){_0x35ba35[_0x8bb5('0x40')]=_['merge'](_0x35ba35[_0x8bb5('0x40')],{'$or':_['map'](_0x1d4a0f,function(_0x341604){if(_0x341604['type']!==_0x8bb5('0x42')){var _0x2f917a={};_0x2f917a[_0x341604[_0x8bb5('0x2f')]]={'$like':'%'+_0x45def6[_0x8bb5('0x38')][_0x8bb5('0x29')]+'%'};return _0x2f917a;}})});}_0x35ba35=_[_0x8bb5('0x43')]({},_0x35ba35,_0x45def6[_0x8bb5('0x44')]);var _0x5ace0f={'where':_0x35ba35[_0x8bb5('0x40')]};return db['VoiceExtension'][_0x8bb5('0x1e')](_0x5ace0f)['then'](function(_0x58ca7d){_0x5b1a71[_0x8bb5('0x1e')]=_0x58ca7d;if(_0x45def6['query'][_0x8bb5('0x45')]){_0x35ba35['include']=[{'all':!![]}];}return db[_0x8bb5('0x33')][_0x8bb5('0x46')](_0x35ba35);})[_0x8bb5('0x22')](function(_0x451320){_0x5b1a71[_0x8bb5('0x47')]=_0x451320;return _0x5b1a71;})['then'](respondWithFilteredResult(_0x2ba63d,_0x35ba35))[_0x8bb5('0x48')](handleError(_0x2ba63d,null));};exports[_0x8bb5('0x49')]=function(_0x139a01,_0x589cb6){var _0x5e834d={'raw':![],'where':{'id':_0x139a01[_0x8bb5('0x4a')]['id']}},_0x118b1d={};_0x118b1d['model']=_[_0x8bb5('0x37')](db[_0x8bb5('0x33')][_0x8bb5('0x34')]);_0x118b1d[_0x8bb5('0x38')]=_[_0x8bb5('0x37')](_0x139a01[_0x8bb5('0x38')]);_0x118b1d[_0x8bb5('0x39')]=_[_0x8bb5('0x3a')](_0x118b1d[_0x8bb5('0x36')],_0x118b1d[_0x8bb5('0x38')]);_0x5e834d[_0x8bb5('0x3b')]=_[_0x8bb5('0x3a')](_0x118b1d[_0x8bb5('0x36')],qs[_0x8bb5('0x3c')](_0x139a01[_0x8bb5('0x38')][_0x8bb5('0x3c')]));_0x5e834d[_0x8bb5('0x3b')]=_0x5e834d[_0x8bb5('0x3b')][_0x8bb5('0x3d')]?_0x5e834d[_0x8bb5('0x3b')]:_0x118b1d[_0x8bb5('0x36')];if(_0x139a01[_0x8bb5('0x38')][_0x8bb5('0x45')]){_0x5e834d[_0x8bb5('0x4b')]=[{'all':!![]}];}_0x5e834d=_['merge']({},_0x5e834d,_0x139a01[_0x8bb5('0x44')]);return db[_0x8bb5('0x33')][_0x8bb5('0x2e')](_0x5e834d)[_0x8bb5('0x22')](handleEntityNotFound(_0x589cb6,null))['then'](respondWithResult(_0x589cb6,null))[_0x8bb5('0x48')](handleError(_0x589cb6,null));};exports[_0x8bb5('0x4c')]=function(_0x5416c2,_0x53552d){return db[_0x8bb5('0x33')][_0x8bb5('0x2e')]({'where':{'id':_0x5416c2[_0x8bb5('0x4a')]['id']}})[_0x8bb5('0x22')](handleEntityNotFound(_0x53552d,null))[_0x8bb5('0x22')](removeEntity(_0x53552d,null))[_0x8bb5('0x48')](handleError(_0x53552d,null));};exports[_0x8bb5('0x4d')]=function(_0xafa837,_0x23339d){if(_0xafa837[_0x8bb5('0x4e')][_0x8bb5('0x2d')]===_0x8bb5('0x26')&&!_[_0x8bb5('0x4f')](_0xafa837[_0x8bb5('0x4e')][_0x8bb5('0x50')],'_')){_0xafa837[_0x8bb5('0x4e')][_0x8bb5('0x50')]='_'[_0x8bb5('0x51')](_0xafa837['body'][_0x8bb5('0x50')]);}return db[_0x8bb5('0x33')][_0x8bb5('0x4d')](_0xafa837[_0x8bb5('0x4e')],{'raw':![]})[_0x8bb5('0x22')](function(_0x22f748){var _0x597c74=_0xafa837[_0x8bb5('0x52')]['get']({'plain':!![]});if(!_0x597c74)throw new Error(_0x8bb5('0x53'));if(_0x597c74[_0x8bb5('0x54')]===_0x8bb5('0x52')){var _0x125922=_0x22f748['get']({'plain':!![]});var _0x4e165c=[{'name':_0x8bb5('0x23'),'value':'inbound'},{'name':'OutboundRoutes','value':_0x8bb5('0x26')},{'name':_0x8bb5('0x27'),'value':'internal'}];var _0x419445=_[_0x8bb5('0x2e')](_0x4e165c,[_0x8bb5('0x2c'),_0x125922[_0x8bb5('0x2d')]])['name'];return db[_0x8bb5('0x55')][_0x8bb5('0x2e')]({'where':{'name':_0x419445,'userProfileId':_0x597c74[_0x8bb5('0x56')]},'raw':!![]})['then'](function(_0x3f964e){if(_0x3f964e&&_0x3f964e[_0x8bb5('0x57')]===0x0){return db['UserProfileResource'][_0x8bb5('0x4d')]({'name':_0x125922[_0x8bb5('0x2f')],'resourceId':_0x125922['id'],'type':_0x3f964e[_0x8bb5('0x2f')],'sectionId':_0x3f964e['id']},{})[_0x8bb5('0x22')](function(){return _0x22f748;});}else{return _0x22f748;}})[_0x8bb5('0x48')](function(_0x3eacf7){logger[_0x8bb5('0x31')](_0x8bb5('0x58'),_0x3eacf7);throw _0x3eacf7;});}return _0x22f748;})[_0x8bb5('0x22')](respondWithResult(_0x23339d,0xc9))[_0x8bb5('0x48')](handleError(_0x23339d,null));};exports['update']=function(_0x14edd1,_0x13d30c){if(_0x14edd1[_0x8bb5('0x4e')]['id']){delete _0x14edd1[_0x8bb5('0x4e')]['id'];}return db[_0x8bb5('0x33')]['find']({'where':{'id':_0x14edd1[_0x8bb5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x13d30c,null))[_0x8bb5('0x22')](function(_0x169fda){if(_0x169fda){return db[_0x8bb5('0x33')][_0x8bb5('0x59')](_[_0x8bb5('0x41')](_0x14edd1['body'],[_0x8bb5('0x50'),'context',_0x8bb5('0x5a'),_0x8bb5('0x5b'),_0x8bb5('0x5c'),_0x8bb5('0x5d'),_0x8bb5('0x5e')]),{'where':{'context':_0x169fda['context'],'exten':_0x169fda['exten']},'individualHooks':!![]})['then'](function(_0x4cf2dd){return _0x4cf2dd;});}return null;})[_0x8bb5('0x22')](respondWithStatusCode(_0x13d30c,null))[_0x8bb5('0x48')](handleError(_0x13d30c,null));};exports[_0x8bb5('0x5f')]=function(_0x3cb62e,_0x855e96){return db[_0x8bb5('0x33')]['findOne']({'where':{'id':_0x3cb62e[_0x8bb5('0x4a')]['id']}})[_0x8bb5('0x22')](function(_0x263ec4){if(_0x263ec4){return db[_0x8bb5('0x60')]['transaction'](function(_0xe832cd){return db[_0x8bb5('0x33')][_0x8bb5('0x4c')]({'where':{'VoiceExtensionId':_0x3cb62e['params']['id']},'transaction':_0xe832cd})[_0x8bb5('0x22')](function(){var _0x49cf71=_[_0x8bb5('0x2b')](_0x3cb62e[_0x8bb5('0x4e')],function(_0x3bdb93){_0x3bdb93[_0x8bb5('0x61')]=_0x3cb62e[_0x8bb5('0x4a')]['id'];_0x3bdb93[_0x8bb5('0x62')]=!![];return _0x3bdb93;});var _0xe72cee=_0x3cb62e[_0x8bb5('0x38')][_0x8bb5('0x63')]&&_0x3cb62e[_0x8bb5('0x38')][_0x8bb5('0x63')][_0x8bb5('0x64')]()==='true'?!![]:![];return _0x263ec4[_0x8bb5('0x65')](_0x49cf71,_0xe72cee);})[_0x8bb5('0x22')](function(_0x4b994f){return db['VoiceExtension'][_0x8bb5('0x66')](_0x4b994f,{'transaction':_0xe832cd});});})[_0x8bb5('0x22')](function(){return db['VoiceExtension'][_0x8bb5('0x67')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3cb62e[_0x8bb5('0x4a')]['id']},'order':_0x8bb5('0x68')});});}})[_0x8bb5('0x22')](respondWithResult(_0x855e96,null))[_0x8bb5('0x48')](handleError(_0x855e96,null));}; \ No newline at end of file +var _0xdb9c=['limit','set','Content-Range','apply','reject','save','update','then','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','map','value','includes','find','type','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','destroy','create','body','startsWith','exten','concat','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','internal','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','description','recordingFormat','mandatoryDisposition','addApplications','findOne','transaction','VoiceExtensionId','isApp','rewriteDial','toLowerCase','true','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','undefined','count','offset'];(function(_0x294351,_0x48fa98){var _0x1d6b9a=function(_0x517c13){while(--_0x517c13){_0x294351['push'](_0x294351['shift']());}};_0x1d6b9a(++_0x48fa98);}(_0xdb9c,0xc7));var _0xcdb9=function(_0x4692a6,_0x8e55b4){_0x4692a6=_0x4692a6-0x0;var _0x58ada1=_0xdb9c[_0x4692a6];return _0x58ada1;};'use strict';var emlformat=require(_0xcdb9('0x0'));var rimraf=require(_0xcdb9('0x1'));var zipdir=require(_0xcdb9('0x2'));var jsonpatch=require(_0xcdb9('0x3'));var rp=require('request-promise');var moment=require(_0xcdb9('0x4'));var BPromise=require(_0xcdb9('0x5'));var Mustache=require(_0xcdb9('0x6'));var util=require(_0xcdb9('0x7'));var path=require('path');var sox=require(_0xcdb9('0x8'));var csv=require(_0xcdb9('0x9'));var ejs=require(_0xcdb9('0xa'));var fs=require('fs');var fs_extra=require(_0xcdb9('0xb'));var _=require(_0xcdb9('0xc'));var squel=require(_0xcdb9('0xd'));var crypto=require(_0xcdb9('0xe'));var jsforce=require(_0xcdb9('0xf'));var deskjs=require(_0xcdb9('0x10'));var toCsv=require(_0xcdb9('0x9'));var querystring=require(_0xcdb9('0x11'));var Papa=require('papaparse');var Redis=require(_0xcdb9('0x12'));var authService=require(_0xcdb9('0x13'));var qs=require(_0xcdb9('0x14'));var as=require(_0xcdb9('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcdb9('0x16'));var utils=require(_0xcdb9('0x17'));var config=require(_0xcdb9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcdb9('0x19'))['db'];config[_0xcdb9('0x1a')]=_[_0xcdb9('0x1b')](config['redis'],{'host':_0xcdb9('0x1c'),'port':0x18eb});var socket=require(_0xcdb9('0x1d'))(new Redis(config[_0xcdb9('0x1a')]));require(_0xcdb9('0x1e'))[_0xcdb9('0x1f')](socket);function respondWithStatusCode(_0x201667,_0x2c2f86){_0x2c2f86=_0x2c2f86||0xcc;return function(_0x197c80){if(_0x197c80){return _0x201667[_0xcdb9('0x20')](_0x2c2f86);}return _0x201667[_0xcdb9('0x21')](_0x2c2f86)[_0xcdb9('0x22')]();};}function respondWithResult(_0x3d84ed,_0xca1069){_0xca1069=_0xca1069||0xc8;return function(_0x4f9627){if(_0x4f9627){return _0x3d84ed['status'](_0xca1069)[_0xcdb9('0x23')](_0x4f9627);}};}function respondWithFilteredResult(_0x21a4a2,_0x1c86a1){return function(_0x948dbb){if(_0x948dbb){var _0x224d72=typeof _0x1c86a1['offset']===_0xcdb9('0x24')&&typeof _0x1c86a1['limit']===_0xcdb9('0x24');var _0x3f39cb=_0x948dbb[_0xcdb9('0x25')];var _0x3ce53b=_0x224d72?0x0:_0x1c86a1[_0xcdb9('0x26')];var _0x5a9775=_0x224d72?_0x948dbb[_0xcdb9('0x25')]:_0x1c86a1['offset']+_0x1c86a1[_0xcdb9('0x27')];var _0x47849f;if(_0x5a9775>=_0x3f39cb){_0x5a9775=_0x3f39cb;_0x47849f=0xc8;}else{_0x47849f=0xce;}_0x21a4a2[_0xcdb9('0x21')](_0x47849f);return _0x21a4a2[_0xcdb9('0x28')](_0xcdb9('0x29'),_0x3ce53b+'-'+_0x5a9775+'/'+_0x3f39cb)[_0xcdb9('0x23')](_0x948dbb);}return null;};}function patchUpdates(_0x207be2){return function(_0x4d74e3){try{jsonpatch[_0xcdb9('0x2a')](_0x4d74e3,_0x207be2,!![]);}catch(_0x32c687){return BPromise[_0xcdb9('0x2b')](_0x32c687);}return _0x4d74e3[_0xcdb9('0x2c')]();};}function saveUpdates(_0x518b87,_0xde3245){return function(_0x5e231d){if(_0x5e231d){return _0x5e231d[_0xcdb9('0x2d')](_0x518b87)[_0xcdb9('0x2e')](function(_0xbe4a1f){return _0xbe4a1f;});}return null;};}function removeEntity(_0x36c5f6,_0x4a359d){return function(_0x1b82a1){if(_0x1b82a1){return _0x1b82a1['destroy']()['then'](function(){var _0x26f9a3=_0x1b82a1['get']({'plain':!![]});var _0x4c5342=[{'name':_0xcdb9('0x2f'),'value':_0xcdb9('0x30'),'ignore':![]},{'name':_0xcdb9('0x31'),'value':_0xcdb9('0x32'),'ignore':![]},{'name':_0xcdb9('0x33'),'value':'internal','ignore':![]}];var _0x55424c=_(_0x4c5342)[_0xcdb9('0x34')]('ignore')[_0xcdb9('0x35')](_0xcdb9('0x36'))[_0xcdb9('0x36')]();if(_[_0xcdb9('0x37')](_0x55424c,_0x26f9a3['type'])){return;}var _0x1ecf2e=_[_0xcdb9('0x38')](_0x4c5342,[_0xcdb9('0x36'),_0x26f9a3[_0xcdb9('0x39')]])[_0xcdb9('0x3a')];return db[_0xcdb9('0x3b')]['destroy']({'where':{'type':_0x1ecf2e,'resourceId':_0x26f9a3['id']}})[_0xcdb9('0x2e')](function(){return _0x1b82a1;});})[_0xcdb9('0x2e')](function(){_0x36c5f6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f0895,_0x35a6fc){return function(_0x14bd6c){if(!_0x14bd6c){_0x5f0895[_0xcdb9('0x20')](0x194);}return _0x14bd6c;};}function handleError(_0x533704,_0x11f6b7){_0x11f6b7=_0x11f6b7||0x1f4;return function(_0x32a674){logger[_0xcdb9('0x3c')](_0x32a674[_0xcdb9('0x3d')]);if(_0x32a674[_0xcdb9('0x3a')]){delete _0x32a674[_0xcdb9('0x3a')];}_0x533704['status'](_0x11f6b7)[_0xcdb9('0x3e')](_0x32a674);};}exports[_0xcdb9('0x3f')]=function(_0x168163,_0x9c4c82){var _0x40ffd3={},_0x13591f={},_0x4cc848={'count':0x0,'rows':[]};var _0x57be9f=_[_0xcdb9('0x35')](db[_0xcdb9('0x40')][_0xcdb9('0x41')],function(_0x5e876e){return{'name':_0x5e876e[_0xcdb9('0x42')],'type':_0x5e876e[_0xcdb9('0x39')][_0xcdb9('0x43')]};});_0x13591f[_0xcdb9('0x44')]=_[_0xcdb9('0x35')](_0x57be9f,'name');_0x13591f[_0xcdb9('0x45')]=_[_0xcdb9('0x46')](_0x168163[_0xcdb9('0x45')]);_0x13591f[_0xcdb9('0x47')]=_[_0xcdb9('0x48')](_0x13591f['model'],_0x13591f[_0xcdb9('0x45')]);_0x40ffd3[_0xcdb9('0x49')]=_[_0xcdb9('0x48')](_0x13591f[_0xcdb9('0x44')],qs[_0xcdb9('0x4a')](_0x168163[_0xcdb9('0x45')][_0xcdb9('0x4a')]));_0x40ffd3[_0xcdb9('0x49')]=_0x40ffd3[_0xcdb9('0x49')][_0xcdb9('0x4b')]?_0x40ffd3[_0xcdb9('0x49')]:_0x13591f['model'];if(!_0x168163[_0xcdb9('0x45')][_0xcdb9('0x4c')](_0xcdb9('0x4d'))){_0x40ffd3['limit']=qs[_0xcdb9('0x27')](_0x168163[_0xcdb9('0x45')][_0xcdb9('0x27')]);_0x40ffd3[_0xcdb9('0x26')]=qs[_0xcdb9('0x26')](_0x168163[_0xcdb9('0x45')][_0xcdb9('0x26')]);}_0x40ffd3[_0xcdb9('0x4e')]=qs[_0xcdb9('0x4f')](_0x168163[_0xcdb9('0x45')][_0xcdb9('0x4f')]);_0x40ffd3[_0xcdb9('0x50')]=qs['filters'](_['pick'](_0x168163[_0xcdb9('0x45')],_0x13591f['filters']),_0x57be9f);if(_0x168163[_0xcdb9('0x45')][_0xcdb9('0x34')]){_0x40ffd3[_0xcdb9('0x50')]=_[_0xcdb9('0x51')](_0x40ffd3['where'],{'$or':_[_0xcdb9('0x35')](_0x57be9f,function(_0xfa9bbe){if(_0xfa9bbe[_0xcdb9('0x39')]!==_0xcdb9('0x52')){var _0x388702={};_0x388702[_0xfa9bbe['name']]={'$like':'%'+_0x168163[_0xcdb9('0x45')]['filter']+'%'};return _0x388702;}})});}_0x40ffd3=_[_0xcdb9('0x51')]({},_0x40ffd3,_0x168163['options']);var _0x29b8f4={'where':_0x40ffd3[_0xcdb9('0x50')]};return db['VoiceExtension'][_0xcdb9('0x25')](_0x29b8f4)[_0xcdb9('0x2e')](function(_0x5604aa){_0x4cc848['count']=_0x5604aa;if(_0x168163[_0xcdb9('0x45')][_0xcdb9('0x53')]){_0x40ffd3[_0xcdb9('0x54')]=[{'all':!![]}];}return db[_0xcdb9('0x40')][_0xcdb9('0x55')](_0x40ffd3);})[_0xcdb9('0x2e')](function(_0x597b49){_0x4cc848[_0xcdb9('0x56')]=_0x597b49;return _0x4cc848;})[_0xcdb9('0x2e')](respondWithFilteredResult(_0x9c4c82,_0x40ffd3))[_0xcdb9('0x57')](handleError(_0x9c4c82,null));};exports[_0xcdb9('0x58')]=function(_0x5cd42e,_0x30dc74){var _0x1c7724={'raw':![],'where':{'id':_0x5cd42e[_0xcdb9('0x59')]['id']}},_0x702f48={};_0x702f48[_0xcdb9('0x44')]=_[_0xcdb9('0x46')](db[_0xcdb9('0x40')][_0xcdb9('0x41')]);_0x702f48[_0xcdb9('0x45')]=_[_0xcdb9('0x46')](_0x5cd42e['query']);_0x702f48[_0xcdb9('0x47')]=_[_0xcdb9('0x48')](_0x702f48[_0xcdb9('0x44')],_0x702f48[_0xcdb9('0x45')]);_0x1c7724[_0xcdb9('0x49')]=_[_0xcdb9('0x48')](_0x702f48[_0xcdb9('0x44')],qs[_0xcdb9('0x4a')](_0x5cd42e['query'][_0xcdb9('0x4a')]));_0x1c7724[_0xcdb9('0x49')]=_0x1c7724[_0xcdb9('0x49')][_0xcdb9('0x4b')]?_0x1c7724[_0xcdb9('0x49')]:_0x702f48[_0xcdb9('0x44')];if(_0x5cd42e['query']['includeAll']){_0x1c7724['include']=[{'all':!![]}];}_0x1c7724=_[_0xcdb9('0x51')]({},_0x1c7724,_0x5cd42e[_0xcdb9('0x5a')]);return db['VoiceExtension'][_0xcdb9('0x38')](_0x1c7724)['then'](handleEntityNotFound(_0x30dc74,null))[_0xcdb9('0x2e')](respondWithResult(_0x30dc74,null))[_0xcdb9('0x57')](handleError(_0x30dc74,null));};exports[_0xcdb9('0x5b')]=function(_0xcb879a,_0x2f508b){return db[_0xcdb9('0x40')][_0xcdb9('0x38')]({'where':{'id':_0xcb879a[_0xcdb9('0x59')]['id']}})[_0xcdb9('0x2e')](handleEntityNotFound(_0x2f508b,null))[_0xcdb9('0x2e')](removeEntity(_0x2f508b,null))[_0xcdb9('0x57')](handleError(_0x2f508b,null));};exports[_0xcdb9('0x5c')]=function(_0x14746,_0x690a71){if(_0x14746[_0xcdb9('0x5d')][_0xcdb9('0x39')]===_0xcdb9('0x32')&&!_[_0xcdb9('0x5e')](_0x14746[_0xcdb9('0x5d')]['exten'],'_')){_0x14746['body'][_0xcdb9('0x5f')]='_'[_0xcdb9('0x60')](_0x14746['body'][_0xcdb9('0x5f')]);}return db['VoiceExtension'][_0xcdb9('0x5c')](_0x14746[_0xcdb9('0x5d')],{'raw':![]})['then'](function(_0x300de7){var _0x5de460=_0x14746['user'][_0xcdb9('0x61')]({'plain':!![]});if(!_0x5de460)throw new Error(_0xcdb9('0x62'));if(_0x5de460[_0xcdb9('0x63')]===_0xcdb9('0x64')){var _0x56c4bc=_0x300de7[_0xcdb9('0x61')]({'plain':!![]});var _0xf54737=[{'name':_0xcdb9('0x2f'),'value':_0xcdb9('0x30')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0xcdb9('0x33'),'value':_0xcdb9('0x65')}];var _0x5a750c=_[_0xcdb9('0x38')](_0xf54737,[_0xcdb9('0x36'),_0x56c4bc[_0xcdb9('0x39')]])[_0xcdb9('0x3a')];return db['UserProfileSection'][_0xcdb9('0x38')]({'where':{'name':_0x5a750c,'userProfileId':_0x5de460[_0xcdb9('0x66')]},'raw':!![]})[_0xcdb9('0x2e')](function(_0x48123d){if(_0x48123d&&_0x48123d['autoAssociation']===0x0){return db[_0xcdb9('0x3b')][_0xcdb9('0x5c')]({'name':_0x56c4bc[_0xcdb9('0x3a')],'resourceId':_0x56c4bc['id'],'type':_0x48123d[_0xcdb9('0x3a')],'sectionId':_0x48123d['id']},{})[_0xcdb9('0x2e')](function(){return _0x300de7;});}else{return _0x300de7;}})[_0xcdb9('0x57')](function(_0x1ebd6b){logger[_0xcdb9('0x3c')](_0xcdb9('0x67'),_0x1ebd6b);throw _0x1ebd6b;});}return _0x300de7;})['then'](respondWithResult(_0x690a71,0xc9))[_0xcdb9('0x57')](handleError(_0x690a71,null));};exports[_0xcdb9('0x2d')]=function(_0x55408f,_0x17e73e){if(_0x55408f['body']['id']){delete _0x55408f[_0xcdb9('0x5d')]['id'];}return db['VoiceExtension'][_0xcdb9('0x38')]({'where':{'id':_0x55408f['params']['id']}})[_0xcdb9('0x2e')](handleEntityNotFound(_0x17e73e,null))[_0xcdb9('0x2e')](function(_0x4d4bd8){if(_0x4d4bd8){return db['VoiceExtension'][_0xcdb9('0x2d')](_[_0xcdb9('0x68')](_0x55408f[_0xcdb9('0x5d')],[_0xcdb9('0x5f'),'context',_0xcdb9('0x69'),_0xcdb9('0x6a'),'cutdigits',_0xcdb9('0x6b'),'alias']),{'where':{'context':_0x4d4bd8['context'],'exten':_0x4d4bd8[_0xcdb9('0x5f')]},'individualHooks':!![]})[_0xcdb9('0x2e')](function(_0x491b4c){return _0x491b4c;});}return null;})[_0xcdb9('0x2e')](respondWithStatusCode(_0x17e73e,null))[_0xcdb9('0x57')](handleError(_0x17e73e,null));};exports[_0xcdb9('0x6c')]=function(_0x3b2a30,_0x35d5cc){return db['VoiceExtension'][_0xcdb9('0x6d')]({'where':{'id':_0x3b2a30['params']['id']}})['then'](function(_0x461fa8){if(_0x461fa8){return db['sequelize'][_0xcdb9('0x6e')](function(_0x141789){return db[_0xcdb9('0x40')]['destroy']({'where':{'VoiceExtensionId':_0x3b2a30['params']['id']},'transaction':_0x141789})['then'](function(){var _0x55d6f2=_['map'](_0x3b2a30['body'],function(_0x1f2cfe){_0x1f2cfe[_0xcdb9('0x6f')]=_0x3b2a30[_0xcdb9('0x59')]['id'];_0x1f2cfe[_0xcdb9('0x70')]=!![];return _0x1f2cfe;});var _0x2855fd=_0x3b2a30['query'][_0xcdb9('0x71')]&&_0x3b2a30[_0xcdb9('0x45')][_0xcdb9('0x71')][_0xcdb9('0x72')]()===_0xcdb9('0x73')?!![]:![];return _0x461fa8[_0xcdb9('0x74')](_0x55d6f2,_0x2855fd);})[_0xcdb9('0x2e')](function(_0x2064ad){return db[_0xcdb9('0x40')]['bulkCreate'](_0x2064ad,{'transaction':_0x141789});});})[_0xcdb9('0x2e')](function(){return db[_0xcdb9('0x40')][_0xcdb9('0x75')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3b2a30[_0xcdb9('0x59')]['id']},'order':_0xcdb9('0x76')});});}})[_0xcdb9('0x2e')](respondWithResult(_0x35d5cc,null))[_0xcdb9('0x57')](handleError(_0x35d5cc,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index d88b983..ede93dd 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 _0x1ca5=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','VoiceExtension','save'];(function(_0x3ef5ec,_0x213115){var _0x57a088=function(_0x199b1d){while(--_0x199b1d){_0x3ef5ec['push'](_0x3ef5ec['shift']());}};_0x57a088(++_0x213115);}(_0x1ca5,0x75));var _0x51ca=function(_0x19fe31,_0x4664eb){_0x19fe31=_0x19fe31-0x0;var _0x1ed7d0=_0x1ca5[_0x19fe31];return _0x1ed7d0;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x51ca('0x0'))['db'][_0x51ca('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x51ca('0x2'),'afterUpdate':_0x51ca('0x3'),'afterDestroy':_0x51ca('0x4')};function emitEvent(_0x54d4db){return function(_0x1b3180,_0xf40968,_0x3c4670){VoiceExtensionEvents['emit'](_0x54d4db+':'+_0x1b3180['id'],_0x1b3180);VoiceExtensionEvents[_0x51ca('0x5')](_0x54d4db,_0x1b3180);_0x3c4670(null);};}for(var e in events){if(events[_0x51ca('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x51ca('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x3a2b=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x3dc1c6,_0x8529a1){var _0x3c82ce=function(_0x5212d1){while(--_0x5212d1){_0x3dc1c6['push'](_0x3dc1c6['shift']());}};_0x3c82ce(++_0x8529a1);}(_0x3a2b,0xe0));var _0xb3a2=function(_0x4fd6af,_0x9c7005){_0x4fd6af=_0x4fd6af-0x0;var _0x103be8=_0x3a2b[_0x4fd6af];return _0x103be8;};'use strict';var EventEmitter=require(_0xb3a2('0x0'));var VoiceExtension=require(_0xb3a2('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb3a2('0x2')](0x0);var events={'afterCreate':_0xb3a2('0x3'),'afterUpdate':_0xb3a2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2858d3){return function(_0x517e2d,_0x5a751f,_0x1a32f8){VoiceExtensionEvents['emit'](_0x2858d3+':'+_0x517e2d['id'],_0x517e2d);VoiceExtensionEvents[_0xb3a2('0x5')](_0x2858d3,_0x517e2d);_0x1a32f8(null);};}for(var e in events){if(events[_0xb3a2('0x6')](e)){var event=events[e];VoiceExtension[_0xb3a2('0x7')](e,emitEvent(event));}}module[_0xb3a2('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 3f68eef..5ec3e64 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 _0xfcdc=['inbound','push','CDR(routeid)=','Set','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','param','phone','prefix','${EXTEN}','SIP','join','none','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','filter','tag','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','appdata','priority','last','concat','define','VoiceExtension','voice_extensions','Hangup','util','lodash','./voiceExtension.attributes','models','type','CDR(type)=','exten','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','context'];(function(_0x173f9e,_0x41e4da){var _0x2ce401=function(_0x2fe56b){while(--_0x2fe56b){_0x173f9e['push'](_0x173f9e['shift']());}};_0x2ce401(++_0x41e4da);}(_0xfcdc,0x12c));var _0xcfcd=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xfcdc[_0x59ee6f];return _0x4c0979;};'use strict';var util=require(_0xcfcd('0x0'));var _=require(_0xcfcd('0x1'));var attributes=require(_0xcfcd('0x2'));module['exports']=function(_0x8a8650){var _0xf7ba00=_0x8a8650[_0xcfcd('0x3')];function _0x337550(_0x3f0c14){var _0xbfed3e=0x2;var _0x3a511c=[{'type':_0x3f0c14[_0xcfcd('0x4')],'app':'Set','appdata':_0xcfcd('0x5')+_0x3f0c14[_0xcfcd('0x4')],'context':_0x3f0c14['context'],'exten':_0x3f0c14[_0xcfcd('0x6')],'priority':_0xbfed3e++,'VoiceExtensionId':_0x3f0c14['id']},{'type':_0x3f0c14[_0xcfcd('0x4')],'app':_0x3f0c14['alias']?'Set':_0xcfcd('0x7'),'appdata':_0x3f0c14[_0xcfcd('0x8')]?_0xcfcd('0x9')+_0x3f0c14[_0xcfcd('0x8')]:_0xcfcd('0xa'),'context':_0x3f0c14[_0xcfcd('0xb')],'exten':_0x3f0c14[_0xcfcd('0x6')],'priority':_0xbfed3e++,'VoiceExtensionId':_0x3f0c14['id']}];if(_0x3f0c14[_0xcfcd('0x4')]===_0xcfcd('0xc')){_0x3a511c[_0xcfcd('0xd')]({'type':_0xcfcd('0xc'),'app':'Set','appdata':_0xcfcd('0xe')+_0x3f0c14['id'],'context':_0x3f0c14[_0xcfcd('0xb')],'exten':_0x3f0c14[_0xcfcd('0x6')],'priority':_0xbfed3e++,'VoiceExtensionId':_0x3f0c14['id']});}_0x3a511c[_0xcfcd('0xd')]({'type':_0x3f0c14[_0xcfcd('0x4')],'app':_0xcfcd('0xf'),'appdata':_0xcfcd('0x10'),'context':_0x3f0c14[_0xcfcd('0xb')],'exten':_0x3f0c14[_0xcfcd('0x6')],'priority':_0xbfed3e++,'VoiceExtensionId':_0x3f0c14['id']},{'type':_0x3f0c14[_0xcfcd('0x4')],'app':_0xcfcd('0xf'),'appdata':_0xcfcd('0x11'),'context':_0x3f0c14['context'],'exten':_0x3f0c14[_0xcfcd('0x6')],'priority':_0xbfed3e++,'VoiceExtensionId':_0x3f0c14['id']},{'type':_0x3f0c14[_0xcfcd('0x4')],'app':_0xcfcd('0xf'),'appdata':_0xcfcd('0x12'),'context':_0x3f0c14['context'],'exten':_0x3f0c14['exten'],'priority':_0xbfed3e++,'VoiceExtensionId':_0x3f0c14['id']});return _0x3a511c;}function _0x2dafc6(_0x2c5bee){var _0x2974a5=0x2;var _0x45c154=[{'type':_0xcfcd('0x13'),'app':_0xcfcd('0xf'),'appdata':'CDR(type)=outbound','context':_0x2c5bee[_0xcfcd('0xb')],'exten':_0x2c5bee['exten'],'priority':_0x2974a5++,'VoiceExtensionId':_0x2c5bee['id']},{'type':_0xcfcd('0x13'),'app':_0x2c5bee[_0xcfcd('0x8')]?_0xcfcd('0xf'):'NoOp','appdata':_0x2c5bee[_0xcfcd('0x8')]?'CDR(routeAlias)='+_0x2c5bee['alias']:_0xcfcd('0xa'),'context':_0x2c5bee[_0xcfcd('0xb')],'exten':_0x2c5bee[_0xcfcd('0x6')],'priority':_0x2974a5++,'VoiceExtensionId':_0x2c5bee['id']},{'type':_0xcfcd('0x13'),'app':_0xcfcd('0xf'),'appdata':_0xcfcd('0x14')+(_0x2c5bee[_0xcfcd('0x15')]?_0xcfcd('0x16')+_0x2c5bee[_0xcfcd('0x15')]+'}':'${EXTEN}'),'context':_0x2c5bee['context'],'exten':_0x2c5bee['exten'],'priority':_0x2974a5++,'VoiceExtensionId':_0x2c5bee['id']},{'type':_0xcfcd('0x13'),'app':'Set','appdata':_0xcfcd('0xe')+_0x2c5bee['id'],'context':_0x2c5bee[_0xcfcd('0xb')],'exten':_0x2c5bee[_0xcfcd('0x6')],'priority':_0x2974a5++,'VoiceExtensionId':_0x2c5bee['id']},{'type':_0xcfcd('0x13'),'app':_0xcfcd('0x17'),'appdata':_0xcfcd('0x18')+(_0x2974a5+0x2)+'):Goto('+(_0x2974a5+0x1)+')','context':_0x2c5bee['context'],'exten':_0x2c5bee[_0xcfcd('0x6')],'priority':_0x2974a5++,'VoiceExtensionId':_0x2c5bee['id']},{'type':_0xcfcd('0x13'),'app':_0xcfcd('0xf'),'appdata':_0x2c5bee['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x2c5bee['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x2c5bee[_0xcfcd('0xb')],'exten':_0x2c5bee[_0xcfcd('0x6')],'priority':_0x2974a5++,'VoiceExtensionId':_0x2c5bee['id']},{'type':_0xcfcd('0x13'),'app':'Set','appdata':_0xcfcd('0x10'),'context':_0x2c5bee[_0xcfcd('0xb')],'exten':_0x2c5bee['exten'],'priority':_0x2974a5++,'VoiceExtensionId':_0x2c5bee['id']},{'type':_0xcfcd('0x13'),'app':_0xcfcd('0xf'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2c5bee[_0xcfcd('0xb')],'exten':_0x2c5bee[_0xcfcd('0x6')],'priority':_0x2974a5++,'VoiceExtensionId':_0x2c5bee['id']},{'type':'outbound','app':_0xcfcd('0xf'),'appdata':_0xcfcd('0x12'),'context':_0x2c5bee[_0xcfcd('0xb')],'exten':_0x2c5bee[_0xcfcd('0x6')],'priority':_0x2974a5++,'VoiceExtensionId':_0x2c5bee['id']},{'type':_0xcfcd('0x13'),'app':_0xcfcd('0xf'),'appdata':_0xcfcd('0x19')+_0x2c5bee['id'],'context':_0x2c5bee['context'],'exten':_0x2c5bee[_0xcfcd('0x6')],'priority':_0x2974a5++,'VoiceExtensionId':_0x2c5bee['id']}];if(_0x2c5bee[_0xcfcd('0x1a')](_0xcfcd('0x1b'))&&_0x2c5bee['recordingFormat']!=='none'){_0x45c154[_0xcfcd('0xd')]({'type':'outbound','app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x2c5bee[_0xcfcd('0xb')],'exten':_0x2c5bee[_0xcfcd('0x6')],'priority':_0x2974a5++,'VoiceExtensionId':_0x2c5bee['id']},{'type':_0xcfcd('0x13'),'app':'Set','appdata':_0xcfcd('0x1c')+_0x2c5bee['recordingFormat']||_0xcfcd('0x1d'),'context':_0x2c5bee['context'],'exten':_0x2c5bee[_0xcfcd('0x6')],'priority':_0x2974a5++,'VoiceExtensionId':_0x2c5bee['id']});}return _0x45c154;}function _0xba8dd9(_0x1fd4d3){var _0x29a957=[{'name':_0xcfcd('0x1e'),'param':0x0},{'name':_0xcfcd('0x1f'),'param':0x1},{'name':_0xcfcd('0x20'),'param':0x2},{'name':_0xcfcd('0x21'),'param':0x3}];var _0x3dba8d={};var _0x512211=_0x1fd4d3[_0xcfcd('0x22')](',');var _0x178ace=[];for(var _0x436879=0x0;_0x436879<_0x29a957['length'];_0x436879++){switch(_0x29a957[_0x436879]['name']){case _0xcfcd('0x1e'):_0x3dba8d[_0xcfcd('0x1e')]=_0x512211[_0x29a957[_0x436879][_0xcfcd('0x23')]][_0xcfcd('0x22')]('/')[0x1];_0x3dba8d[_0xcfcd('0x24')]=_0x512211[_0x29a957[_0x436879][_0xcfcd('0x23')]][_0xcfcd('0x22')]('/')[0x2];_0x3dba8d[_0xcfcd('0x25')]=_0x3dba8d[_0xcfcd('0x24')]?_0x3dba8d[_0xcfcd('0x24')]['split']('$')[0x0]:undefined;_0x3dba8d['phone']=route[_0xcfcd('0x15')]?(_0x3dba8d[_0xcfcd('0x25')]||'')+_0xcfcd('0x16')+route[_0xcfcd('0x15')]+'}':(_0x3dba8d[_0xcfcd('0x25')]||'')+_0xcfcd('0x26');_0x178ace[_0x29a957[_0x436879][_0xcfcd('0x23')]]=[_0xcfcd('0x27'),_0x3dba8d[_0xcfcd('0x1e')],_0x3dba8d[_0xcfcd('0x24')]][_0xcfcd('0x28')]('/');break;case _0xcfcd('0x20'):_0x3dba8d[_0xcfcd('0x20')]=_0x512211[_0x29a957[_0x436879][_0xcfcd('0x23')]];if(route[_0xcfcd('0x1b')]!==_0xcfcd('0x29')){if(_0x3dba8d[_0xcfcd('0x20')][_0xcfcd('0x2a')](_0xcfcd('0x2b'))<0x0){_0x3dba8d[_0xcfcd('0x20')]+=_0xcfcd('0x2b');}}else{_0x3dba8d[_0xcfcd('0x20')]=_0x3dba8d[_0xcfcd('0x20')]['replace'](_0xcfcd('0x2b'),'');}_0x178ace[_0x29a957[_0x436879][_0xcfcd('0x23')]]=_0x3dba8d[_0xcfcd('0x20')];break;default:_0x178ace[_0x29a957[_0x436879][_0xcfcd('0x23')]]=_0x512211[_0x29a957[_0x436879][_0xcfcd('0x23')]];}}return _0x178ace[_0xcfcd('0x28')](',');}function _0x2324c2(_0x320934,_0x3a8679,_0x2c2628,_0x14b028){return new Promise(function(_0x2200d7,_0x3b336e){var _0x4bde15=[];if(_[_0xcfcd('0x2c')](_0x3a8679))return _0x2200d7(_0x4bde15);_0xf7ba00[_0xcfcd('0x2d')][_0xcfcd('0x2e')]({'attributes':['id',_0xcfcd('0x2f'),_0xcfcd('0x30')],'raw':!![]})[_0xcfcd('0x31')](function(_0x3f668e){for(var _0x582e4d=0x0,_0x18d151=0x0;_0x582e4d<_0x3a8679[_0xcfcd('0x32')];_0x582e4d++,_0x18d151=0x0){var _0x55cf04=_0x3a8679[_0x582e4d];var _0xc3d19b=[];var _0x4d657a=[];if(_0x55cf04[_0xcfcd('0x2f')]!==_0xcfcd('0x33')){_0x55cf04[_0xcfcd('0x34')]=[_0x55cf04[_0xcfcd('0x2f')]];}else{_0x55cf04['intervals']=_0x55cf04[_0xcfcd('0x30')]?_['map'](_[_0xcfcd('0x35')](_0x3f668e,{'IntervalId':_0x55cf04[_0xcfcd('0x30')]}),_0xcfcd('0x2f')):[];}_0x55cf04[_0xcfcd('0xb')]=_0x320934[_0xcfcd('0xb')];_0x55cf04[_0xcfcd('0x6')]=_0x320934[_0xcfcd('0x6')];if(_0x55cf04[_0xcfcd('0x4')])_0x55cf04[_0xcfcd('0x4')]=_0x55cf04[_0xcfcd('0x4')]['toLowerCase']();if(_0x320934[_0xcfcd('0x4')]===_0xcfcd('0x13')){if(_0x55cf04['hasOwnProperty'](_0xcfcd('0x36'))&&_0x55cf04[_0xcfcd('0x36')]&&_0x55cf04[_0xcfcd('0x36')]!=='--'){_0xc3d19b[_0xcfcd('0xd')]({'type':_0x55cf04[_0xcfcd('0x4')]['toLowerCase'](),'app':_0xcfcd('0xf'),'appdata':'CDR(tag)='+_0x55cf04['tag'],'context':_0x320934['context'],'exten':_0x320934[_0xcfcd('0x6')],'priority':_0x55cf04[_0xcfcd('0x34')][_0xcfcd('0x32')]+_0x2c2628+_0x18d151++,'VoiceExtensionId':_0x320934['id']});}_0xc3d19b[_0xcfcd('0xd')]({'type':_0x55cf04[_0xcfcd('0x4')][_0xcfcd('0x37')](),'app':_0xcfcd('0x17'),'appdata':_0xcfcd('0x38')+(_0x55cf04[_0xcfcd('0x39')]?_0xcfcd('0x3a')+_0x55cf04[_0xcfcd('0x39')]+')':_0xcfcd('0x3b')),'context':_0x320934[_0xcfcd('0xb')],'exten':_0x320934[_0xcfcd('0x6')],'priority':_0x55cf04[_0xcfcd('0x34')]['length']+_0x2c2628+_0x18d151++,'VoiceExtensionId':_0x320934['id']});}else{if(_0x55cf04[_0xcfcd('0x1a')](_0xcfcd('0x3c'))){if([_0xcfcd('0x3d'),_0xcfcd('0x3e')][_0xcfcd('0x3f')](_0x55cf04[_0xcfcd('0x40')]['toLowerCase']())&&_0x55cf04[_0xcfcd('0x41')]!==_0xcfcd('0x42')){if(_0x55cf04[_0xcfcd('0x3c')]){_0xc3d19b[_0xcfcd('0xd')]({'type':_0x55cf04['type'][_0xcfcd('0x37')](),'app':_0xcfcd('0x17'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x320934[_0xcfcd('0xb')],'exten':_0x320934[_0xcfcd('0x6')],'priority':_0x55cf04['intervals']['length']+_0x2c2628+_0x18d151++,'VoiceExtensionId':_0x320934['id']});_0xc3d19b[_0xcfcd('0xd')]({'type':_0x55cf04[_0xcfcd('0x4')][_0xcfcd('0x37')](),'app':_0xcfcd('0xf'),'appdata':_0xcfcd('0x43'),'context':_0x320934[_0xcfcd('0xb')],'exten':_0x320934[_0xcfcd('0x6')],'priority':_0x55cf04[_0xcfcd('0x34')][_0xcfcd('0x32')]+_0x2c2628+_0x18d151++,'VoiceExtensionId':_0x320934['id']});}else{_0xc3d19b[_0xcfcd('0xd')]({'type':_0x55cf04['type'][_0xcfcd('0x37')](),'app':_0xcfcd('0x17'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x320934['context'],'exten':_0x320934[_0xcfcd('0x6')],'priority':_0x55cf04[_0xcfcd('0x34')][_0xcfcd('0x32')]+_0x2c2628+_0x18d151++,'VoiceExtensionId':_0x320934['id']});_0xc3d19b['push']({'type':_0x55cf04[_0xcfcd('0x4')][_0xcfcd('0x37')](),'app':_0xcfcd('0xf'),'appdata':_0xcfcd('0x44'),'context':_0x320934[_0xcfcd('0xb')],'exten':_0x320934[_0xcfcd('0x6')],'priority':_0x55cf04['intervals']['length']+_0x2c2628+_0x18d151++,'VoiceExtensionId':_0x320934['id']});}}}}for(var _0x4276ff=0x0;_0x4276ff<_0x55cf04[_0xcfcd('0x34')][_0xcfcd('0x32')];_0x4276ff++){var _0x3a1a9c=_0x2c2628+_0x55cf04['intervals'][_0xcfcd('0x32')];var _0x6223d6=_0x4276ff===_0x55cf04[_0xcfcd('0x34')]['length']-0x1?_0x2c2628+_0xc3d19b[_0xcfcd('0x32')]+_0x4d657a['length']+0x2:_0x2c2628+_0x4276ff+0x1;_0xc3d19b['splice'](_0x4276ff,0x0,{'type':_0x320934['type'],'app':'GotoIfTime','appdata':_0x55cf04[_0xcfcd('0x34')][_0x4276ff]+'?'+_0x320934[_0xcfcd('0xb')]+',${EXTEN},'+_0x3a1a9c+':'+_0x320934[_0xcfcd('0xb')]+_0xcfcd('0x45')+_0x6223d6,'exten':_0x320934[_0xcfcd('0x6')],'context':_0x320934[_0xcfcd('0xb')],'priority':_0x2c2628+_0x4276ff,'VoiceExtensionId':_0x320934['id']});}if(_0x14b028&&_0x55cf04['appType']==='outboundDial')_0x55cf04[_0xcfcd('0x46')]=_0xba8dd9(_0x55cf04[_0xcfcd('0x46')]);_0x55cf04[_0xcfcd('0x47')]=_0xc3d19b['length']?_[_0xcfcd('0x48')](_0xc3d19b)[_0xcfcd('0x47')]+0x1:_0x2c2628;_0x4bde15=_[_0xcfcd('0x49')](_0x4bde15,_0xc3d19b,[_0x55cf04],_0x4d657a);_0x2c2628=_[_0xcfcd('0x48')](_0x4bde15)[_0xcfcd('0x47')]+0x1;}return _0x2200d7(_0x4bde15);})['catch'](function(_0x5c5510){_0x3b336e(_0x5c5510);});});}return _0x8a8650[_0xcfcd('0x4a')](_0xcfcd('0x4b'),attributes,{'tableName':_0xcfcd('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x67f4c3,_0x4c13de){var _0x1eae76=this;var _0x3b3e76=_0x1eae76['type']===_0xcfcd('0x13')?_0x2dafc6(_0x1eae76):_0x337550(_0x1eae76);return _0x2324c2(_0x1eae76,_0x67f4c3,_['last'](_0x3b3e76)['priority']+0x1,_0x4c13de)[_0xcfcd('0x31')](function(_0x5120ca){var _0x435ba9=_[_0xcfcd('0x49')](_0x3b3e76,_0x5120ca);_0x435ba9['push']({'type':_0x1eae76[_0xcfcd('0x4')],'app':_0xcfcd('0x4d'),'exten':_0x1eae76[_0xcfcd('0x6')],'context':_0x1eae76[_0xcfcd('0xb')],'priority':_[_0xcfcd('0x48')](_0x435ba9)['priority']+0x1,'VoiceExtensionId':_0x1eae76['id']});return _0x435ba9;});}}});}; \ No newline at end of file +var _0x0b52=['CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','VoiceExtension','Hangup','util','lodash','./voiceExtension.attributes','models','Set','CDR(type)=','context','exten','type','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','split','length','name','param','phone','prefix','SIP','join','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','tag','toLowerCase'];(function(_0x503946,_0x525f15){var _0x4f6fc0=function(_0x56311e){while(--_0x56311e){_0x503946['push'](_0x503946['shift']());}};_0x4f6fc0(++_0x525f15);}(_0x0b52,0xc2));var _0x20b5=function(_0xfe44dc,_0x221e44){_0xfe44dc=_0xfe44dc-0x0;var _0xd76a66=_0x0b52[_0xfe44dc];return _0xd76a66;};'use strict';var util=require(_0x20b5('0x0'));var _=require(_0x20b5('0x1'));var attributes=require(_0x20b5('0x2'));module['exports']=function(_0x416300){var _0x588fa6=_0x416300[_0x20b5('0x3')];function _0x32c89b(_0x2e7d37){var _0x17506f=0x2;var _0x381bc5=[{'type':_0x2e7d37['type'],'app':_0x20b5('0x4'),'appdata':_0x20b5('0x5')+_0x2e7d37['type'],'context':_0x2e7d37[_0x20b5('0x6')],'exten':_0x2e7d37[_0x20b5('0x7')],'priority':_0x17506f++,'VoiceExtensionId':_0x2e7d37['id']},{'type':_0x2e7d37[_0x20b5('0x8')],'app':_0x2e7d37[_0x20b5('0x9')]?_0x20b5('0x4'):_0x20b5('0xa'),'appdata':_0x2e7d37['alias']?_0x20b5('0xb')+_0x2e7d37[_0x20b5('0x9')]:_0x20b5('0xc'),'context':_0x2e7d37['context'],'exten':_0x2e7d37[_0x20b5('0x7')],'priority':_0x17506f++,'VoiceExtensionId':_0x2e7d37['id']}];if(_0x2e7d37[_0x20b5('0x8')]===_0x20b5('0xd')){_0x381bc5[_0x20b5('0xe')]({'type':_0x20b5('0xd'),'app':_0x20b5('0x4'),'appdata':_0x20b5('0xf')+_0x2e7d37['id'],'context':_0x2e7d37['context'],'exten':_0x2e7d37[_0x20b5('0x7')],'priority':_0x17506f++,'VoiceExtensionId':_0x2e7d37['id']});}_0x381bc5[_0x20b5('0xe')]({'type':_0x2e7d37[_0x20b5('0x8')],'app':_0x20b5('0x4'),'appdata':_0x20b5('0x10'),'context':_0x2e7d37[_0x20b5('0x6')],'exten':_0x2e7d37[_0x20b5('0x7')],'priority':_0x17506f++,'VoiceExtensionId':_0x2e7d37['id']},{'type':_0x2e7d37[_0x20b5('0x8')],'app':_0x20b5('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2e7d37['context'],'exten':_0x2e7d37[_0x20b5('0x7')],'priority':_0x17506f++,'VoiceExtensionId':_0x2e7d37['id']},{'type':_0x2e7d37[_0x20b5('0x8')],'app':_0x20b5('0x4'),'appdata':_0x20b5('0x11'),'context':_0x2e7d37[_0x20b5('0x6')],'exten':_0x2e7d37[_0x20b5('0x7')],'priority':_0x17506f++,'VoiceExtensionId':_0x2e7d37['id']});return _0x381bc5;}function _0x2724dc(_0x11eee2){var _0x5dd9bc=0x2;var _0xe8510e=[{'type':_0x20b5('0x12'),'app':'Set','appdata':'CDR(type)=outbound','context':_0x11eee2[_0x20b5('0x6')],'exten':_0x11eee2[_0x20b5('0x7')],'priority':_0x5dd9bc++,'VoiceExtensionId':_0x11eee2['id']},{'type':_0x20b5('0x12'),'app':_0x11eee2[_0x20b5('0x9')]?'Set':_0x20b5('0xa'),'appdata':_0x11eee2[_0x20b5('0x9')]?_0x20b5('0xb')+_0x11eee2['alias']:_0x20b5('0xc'),'context':_0x11eee2[_0x20b5('0x6')],'exten':_0x11eee2['exten'],'priority':_0x5dd9bc++,'VoiceExtensionId':_0x11eee2['id']},{'type':'outbound','app':_0x20b5('0x4'),'appdata':_0x20b5('0x13')+(_0x11eee2['cutdigits']?_0x20b5('0x14')+_0x11eee2[_0x20b5('0x15')]+'}':_0x20b5('0x16')),'context':_0x11eee2[_0x20b5('0x6')],'exten':_0x11eee2[_0x20b5('0x7')],'priority':_0x5dd9bc++,'VoiceExtensionId':_0x11eee2['id']},{'type':_0x20b5('0x12'),'app':'Set','appdata':_0x20b5('0xf')+_0x11eee2['id'],'context':_0x11eee2[_0x20b5('0x6')],'exten':_0x11eee2[_0x20b5('0x7')],'priority':_0x5dd9bc++,'VoiceExtensionId':_0x11eee2['id']},{'type':'outbound','app':_0x20b5('0x17'),'appdata':_0x20b5('0x18')+(_0x5dd9bc+0x2)+_0x20b5('0x19')+(_0x5dd9bc+0x1)+')','context':_0x11eee2[_0x20b5('0x6')],'exten':_0x11eee2[_0x20b5('0x7')],'priority':_0x5dd9bc++,'VoiceExtensionId':_0x11eee2['id']},{'type':_0x20b5('0x12'),'app':'Set','appdata':_0x11eee2[_0x20b5('0x15')]?_0x20b5('0x1a')+_0x11eee2[_0x20b5('0x15')]+'}':_0x20b5('0x1b'),'context':_0x11eee2[_0x20b5('0x6')],'exten':_0x11eee2[_0x20b5('0x7')],'priority':_0x5dd9bc++,'VoiceExtensionId':_0x11eee2['id']},{'type':_0x20b5('0x12'),'app':'Set','appdata':_0x20b5('0x10'),'context':_0x11eee2[_0x20b5('0x6')],'exten':_0x11eee2[_0x20b5('0x7')],'priority':_0x5dd9bc++,'VoiceExtensionId':_0x11eee2['id']},{'type':_0x20b5('0x12'),'app':_0x20b5('0x4'),'appdata':_0x20b5('0x1c'),'context':_0x11eee2[_0x20b5('0x6')],'exten':_0x11eee2[_0x20b5('0x7')],'priority':_0x5dd9bc++,'VoiceExtensionId':_0x11eee2['id']},{'type':_0x20b5('0x12'),'app':_0x20b5('0x4'),'appdata':_0x20b5('0x11'),'context':_0x11eee2['context'],'exten':_0x11eee2[_0x20b5('0x7')],'priority':_0x5dd9bc++,'VoiceExtensionId':_0x11eee2['id']},{'type':'outbound','app':_0x20b5('0x4'),'appdata':_0x20b5('0x1d')+_0x11eee2['id'],'context':_0x11eee2[_0x20b5('0x6')],'exten':_0x11eee2['exten'],'priority':_0x5dd9bc++,'VoiceExtensionId':_0x11eee2['id']}];if(_0x11eee2[_0x20b5('0x1e')](_0x20b5('0x1f'))&&_0x11eee2[_0x20b5('0x1f')]!=='none'){_0xe8510e['push']({'type':'outbound','app':'Set','appdata':_0x20b5('0x20'),'context':_0x11eee2[_0x20b5('0x6')],'exten':_0x11eee2[_0x20b5('0x7')],'priority':_0x5dd9bc++,'VoiceExtensionId':_0x11eee2['id']},{'type':'outbound','app':_0x20b5('0x4'),'appdata':_0x20b5('0x21')+_0x11eee2[_0x20b5('0x1f')]||'wav','context':_0x11eee2['context'],'exten':_0x11eee2[_0x20b5('0x7')],'priority':_0x5dd9bc++,'VoiceExtensionId':_0x11eee2['id']});}return _0xe8510e;}function _0x28321e(_0x385405){var _0x2687ee=[{'name':_0x20b5('0x22'),'param':0x0},{'name':_0x20b5('0x23'),'param':0x1},{'name':_0x20b5('0x24'),'param':0x2},{'name':_0x20b5('0x25'),'param':0x3}];var _0xe7a0a0={};var _0x31de5d=_0x385405[_0x20b5('0x26')](',');var _0x5bd2ae=[];for(var _0x3db540=0x0;_0x3db540<_0x2687ee[_0x20b5('0x27')];_0x3db540++){switch(_0x2687ee[_0x3db540][_0x20b5('0x28')]){case'trunk':_0xe7a0a0[_0x20b5('0x22')]=_0x31de5d[_0x2687ee[_0x3db540][_0x20b5('0x29')]][_0x20b5('0x26')]('/')[0x1];_0xe7a0a0[_0x20b5('0x2a')]=_0x31de5d[_0x2687ee[_0x3db540][_0x20b5('0x29')]][_0x20b5('0x26')]('/')[0x2];_0xe7a0a0[_0x20b5('0x2b')]=_0xe7a0a0[_0x20b5('0x2a')]?_0xe7a0a0[_0x20b5('0x2a')][_0x20b5('0x26')]('$')[0x0]:undefined;_0xe7a0a0[_0x20b5('0x2a')]=route[_0x20b5('0x15')]?(_0xe7a0a0[_0x20b5('0x2b')]||'')+'${EXTEN:'+route[_0x20b5('0x15')]+'}':(_0xe7a0a0['prefix']||'')+_0x20b5('0x16');_0x5bd2ae[_0x2687ee[_0x3db540][_0x20b5('0x29')]]=[_0x20b5('0x2c'),_0xe7a0a0[_0x20b5('0x22')],_0xe7a0a0[_0x20b5('0x2a')]][_0x20b5('0x2d')]('/');break;case _0x20b5('0x24'):_0xe7a0a0[_0x20b5('0x24')]=_0x31de5d[_0x2687ee[_0x3db540][_0x20b5('0x29')]];if(route['recordingFormat']!==_0x20b5('0x2e')){if(_0xe7a0a0[_0x20b5('0x24')][_0x20b5('0x2f')](_0x20b5('0x30'))<0x0){_0xe7a0a0[_0x20b5('0x24')]+=_0x20b5('0x30');}}else{_0xe7a0a0['options']=_0xe7a0a0[_0x20b5('0x24')][_0x20b5('0x31')]('U(xcally-mixmonitor-context)','');}_0x5bd2ae[_0x2687ee[_0x3db540][_0x20b5('0x29')]]=_0xe7a0a0[_0x20b5('0x24')];break;default:_0x5bd2ae[_0x2687ee[_0x3db540][_0x20b5('0x29')]]=_0x31de5d[_0x2687ee[_0x3db540][_0x20b5('0x29')]];}}return _0x5bd2ae[_0x20b5('0x2d')](',');}function _0x52d239(_0x416376,_0x16ff9e,_0x2754c4,_0x5e89f5){return new Promise(function(_0x347c0c,_0x29ef3c){var _0x403638=[];if(_[_0x20b5('0x32')](_0x16ff9e))return _0x347c0c(_0x403638);_0x588fa6['Interval'][_0x20b5('0x33')]({'attributes':['id',_0x20b5('0x34'),_0x20b5('0x35')],'raw':!![]})[_0x20b5('0x36')](function(_0x3dedd8){for(var _0x2f28e3=0x0,_0x1b1091=0x0;_0x2f28e3<_0x16ff9e['length'];_0x2f28e3++,_0x1b1091=0x0){var _0x1127a5=_0x16ff9e[_0x2f28e3];var _0x4c4dba=[];var _0x3e165c=[];if(_0x1127a5[_0x20b5('0x34')]!==_0x20b5('0x37')){_0x1127a5[_0x20b5('0x38')]=[_0x1127a5[_0x20b5('0x34')]];}else{_0x1127a5[_0x20b5('0x38')]=_0x1127a5[_0x20b5('0x35')]?_[_0x20b5('0x39')](_[_0x20b5('0x3a')](_0x3dedd8,{'IntervalId':_0x1127a5[_0x20b5('0x35')]}),_0x20b5('0x34')):[];}_0x1127a5[_0x20b5('0x6')]=_0x416376['context'];_0x1127a5[_0x20b5('0x7')]=_0x416376[_0x20b5('0x7')];if(_0x1127a5[_0x20b5('0x8')])_0x1127a5[_0x20b5('0x8')]=_0x1127a5[_0x20b5('0x8')]['toLowerCase']();if(_0x416376[_0x20b5('0x8')]===_0x20b5('0x12')){if(_0x1127a5[_0x20b5('0x1e')](_0x20b5('0x3b'))&&_0x1127a5[_0x20b5('0x3b')]&&_0x1127a5[_0x20b5('0x3b')]!=='--'){_0x4c4dba[_0x20b5('0xe')]({'type':_0x1127a5[_0x20b5('0x8')][_0x20b5('0x3c')](),'app':'Set','appdata':_0x20b5('0x3d')+_0x1127a5['tag'],'context':_0x416376[_0x20b5('0x6')],'exten':_0x416376[_0x20b5('0x7')],'priority':_0x1127a5[_0x20b5('0x38')]['length']+_0x2754c4+_0x1b1091++,'VoiceExtensionId':_0x416376['id']});}_0x4c4dba[_0x20b5('0xe')]({'type':_0x1127a5[_0x20b5('0x8')]['toLowerCase'](),'app':_0x20b5('0x17'),'appdata':_0x20b5('0x3e')+(_0x1127a5[_0x20b5('0x3f')]?_0x20b5('0x40')+_0x1127a5[_0x20b5('0x3f')]+')':_0x20b5('0x41')),'context':_0x416376[_0x20b5('0x6')],'exten':_0x416376['exten'],'priority':_0x1127a5[_0x20b5('0x38')][_0x20b5('0x27')]+_0x2754c4+_0x1b1091++,'VoiceExtensionId':_0x416376['id']});}else{if(_0x1127a5['hasOwnProperty'](_0x20b5('0x42'))){if([_0x20b5('0x43'),_0x20b5('0x44')][_0x20b5('0x45')](_0x1127a5[_0x20b5('0x46')][_0x20b5('0x3c')]())&&_0x1127a5[_0x20b5('0x47')]!==_0x20b5('0x48')){if(_0x1127a5[_0x20b5('0x42')]){_0x4c4dba[_0x20b5('0xe')]({'type':_0x1127a5[_0x20b5('0x8')][_0x20b5('0x3c')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x416376[_0x20b5('0x6')],'exten':_0x416376[_0x20b5('0x7')],'priority':_0x1127a5['intervals']['length']+_0x2754c4+_0x1b1091++,'VoiceExtensionId':_0x416376['id']});_0x4c4dba['push']({'type':_0x1127a5['type'][_0x20b5('0x3c')](),'app':'Set','appdata':_0x20b5('0x49'),'context':_0x416376[_0x20b5('0x6')],'exten':_0x416376['exten'],'priority':_0x1127a5['intervals'][_0x20b5('0x27')]+_0x2754c4+_0x1b1091++,'VoiceExtensionId':_0x416376['id']});}else{_0x4c4dba[_0x20b5('0xe')]({'type':_0x1127a5[_0x20b5('0x8')][_0x20b5('0x3c')](),'app':_0x20b5('0x17'),'appdata':_0x20b5('0x4a'),'context':_0x416376[_0x20b5('0x6')],'exten':_0x416376[_0x20b5('0x7')],'priority':_0x1127a5[_0x20b5('0x38')][_0x20b5('0x27')]+_0x2754c4+_0x1b1091++,'VoiceExtensionId':_0x416376['id']});_0x4c4dba['push']({'type':_0x1127a5[_0x20b5('0x8')][_0x20b5('0x3c')](),'app':_0x20b5('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x416376[_0x20b5('0x6')],'exten':_0x416376[_0x20b5('0x7')],'priority':_0x1127a5[_0x20b5('0x38')][_0x20b5('0x27')]+_0x2754c4+_0x1b1091++,'VoiceExtensionId':_0x416376['id']});}}}}for(var _0x5b3f7e=0x0;_0x5b3f7e<_0x1127a5[_0x20b5('0x38')][_0x20b5('0x27')];_0x5b3f7e++){var _0x19c6dd=_0x2754c4+_0x1127a5[_0x20b5('0x38')][_0x20b5('0x27')];var _0x362812=_0x5b3f7e===_0x1127a5[_0x20b5('0x38')][_0x20b5('0x27')]-0x1?_0x2754c4+_0x4c4dba[_0x20b5('0x27')]+_0x3e165c[_0x20b5('0x27')]+0x2:_0x2754c4+_0x5b3f7e+0x1;_0x4c4dba[_0x20b5('0x4b')](_0x5b3f7e,0x0,{'type':_0x416376[_0x20b5('0x8')],'app':_0x20b5('0x4c'),'appdata':_0x1127a5[_0x20b5('0x38')][_0x5b3f7e]+'?'+_0x416376[_0x20b5('0x6')]+_0x20b5('0x4d')+_0x19c6dd+':'+_0x416376[_0x20b5('0x6')]+_0x20b5('0x4d')+_0x362812,'exten':_0x416376[_0x20b5('0x7')],'context':_0x416376[_0x20b5('0x6')],'priority':_0x2754c4+_0x5b3f7e,'VoiceExtensionId':_0x416376['id']});}if(_0x5e89f5&&_0x1127a5[_0x20b5('0x47')]===_0x20b5('0x4e'))_0x1127a5[_0x20b5('0x4f')]=_0x28321e(_0x1127a5['appdata']);_0x1127a5[_0x20b5('0x50')]=_0x4c4dba['length']?_[_0x20b5('0x51')](_0x4c4dba)[_0x20b5('0x50')]+0x1:_0x2754c4;_0x403638=_[_0x20b5('0x52')](_0x403638,_0x4c4dba,[_0x1127a5],_0x3e165c);_0x2754c4=_['last'](_0x403638)[_0x20b5('0x50')]+0x1;}return _0x347c0c(_0x403638);})['catch'](function(_0x4ca2fe){_0x29ef3c(_0x4ca2fe);});});}return _0x416300['define'](_0x20b5('0x53'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x150a5c,_0x15e7f4){var _0x2d1d9e=this;var _0xa5152c=_0x2d1d9e[_0x20b5('0x8')]===_0x20b5('0x12')?_0x2724dc(_0x2d1d9e):_0x32c89b(_0x2d1d9e);return _0x52d239(_0x2d1d9e,_0x150a5c,_['last'](_0xa5152c)['priority']+0x1,_0x15e7f4)[_0x20b5('0x36')](function(_0x33384e){var _0x5f171a=_[_0x20b5('0x52')](_0xa5152c,_0x33384e);_0x5f171a['push']({'type':_0x2d1d9e[_0x20b5('0x8')],'app':_0x20b5('0x54'),'exten':_0x2d1d9e[_0x20b5('0x7')],'context':_0x2d1d9e[_0x20b5('0x6')],'priority':_['last'](_0x5f171a)['priority']+0x1,'VoiceExtensionId':_0x2d1d9e['id']});return _0x5f171a;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 32c0d36..7c853f4 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 _0xaee6=['result','GetVoiceExtension','VoiceExtension','options','raw','where','attributes','include','model','map','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./voiceExtension.socket','request','then','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x5d8631,_0x44944b){var _0x34c15e=function(_0x4448f8){while(--_0x4448f8){_0x5d8631['push'](_0x5d8631['shift']());}};_0x34c15e(++_0x44944b);}(_0xaee6,0x187));var _0x6aee=function(_0x15c32b,_0x3559dc){_0x15c32b=_0x15c32b-0x0;var _0x16bd65=_0xaee6[_0x15c32b];return _0x16bd65;};'use strict';var _=require(_0x6aee('0x0'));var util=require(_0x6aee('0x1'));var moment=require(_0x6aee('0x2'));var BPromise=require(_0x6aee('0x3'));var rs=require(_0x6aee('0x4'));var fs=require('fs');var Redis=require(_0x6aee('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6aee('0x6'));var logger=require(_0x6aee('0x7'))(_0x6aee('0x8'));var config=require('../../config/environment');var jayson=require(_0x6aee('0x9'));var client=jayson[_0x6aee('0xa')][_0x6aee('0xb')]({'port':0x232a});config[_0x6aee('0xc')]=_[_0x6aee('0xd')](config[_0x6aee('0xc')],{'host':_0x6aee('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6aee('0xf'))['register'](socket);function respondWithRpcPromise(_0x27a179,_0x2552ec,_0x1f81fa){return new BPromise(function(_0x57e596,_0xd99e94){return client[_0x6aee('0x10')](_0x27a179,_0x1f81fa)[_0x6aee('0x11')](function(_0x1092d9){logger['info'](_0x6aee('0x12'),_0x2552ec,'request\x20sent');logger[_0x6aee('0x13')](_0x6aee('0x14'),_0x2552ec,_0x6aee('0x15'),JSON[_0x6aee('0x16')](_0x1092d9));if(_0x1092d9[_0x6aee('0x17')]){if(_0x1092d9['error'][_0x6aee('0x18')]===0x1f4){logger[_0x6aee('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x2552ec,_0x1092d9['error'][_0x6aee('0x19')]);return _0xd99e94(_0x1092d9[_0x6aee('0x17')][_0x6aee('0x19')]);}logger[_0x6aee('0x17')](_0x6aee('0x12'),_0x2552ec,_0x1092d9[_0x6aee('0x17')][_0x6aee('0x19')]);return _0x57e596(_0x1092d9[_0x6aee('0x17')]['message']);}else{logger[_0x6aee('0x1a')](_0x6aee('0x12'),_0x2552ec,'request\x20sent');_0x57e596(_0x1092d9[_0x6aee('0x1b')][_0x6aee('0x19')]);}})['catch'](function(_0x1848a9){logger[_0x6aee('0x17')](_0x6aee('0x12'),_0x2552ec,_0x1848a9);_0xd99e94(_0x1848a9);});});}exports[_0x6aee('0x1c')]=function(_0x340eae){var _0x26aab4=this;return new Promise(function(_0xf94d0d,_0x5969b2){return db[_0x6aee('0x1d')]['findAll']({'raw':_0x340eae['options']?_0x340eae[_0x6aee('0x1e')][_0x6aee('0x1f')]===undefined?!![]:![]:!![],'where':_0x340eae[_0x6aee('0x1e')]?_0x340eae[_0x6aee('0x1e')][_0x6aee('0x20')]||null:null,'attributes':_0x340eae[_0x6aee('0x1e')]?_0x340eae[_0x6aee('0x1e')][_0x6aee('0x21')]||null:null,'limit':_0x340eae['options']?_0x340eae[_0x6aee('0x1e')]['limit']||null:null,'include':_0x340eae['options']?_0x340eae[_0x6aee('0x1e')][_0x6aee('0x22')]?_['map'](_0x340eae[_0x6aee('0x1e')][_0x6aee('0x22')],function(_0x56716f){return{'model':db[_0x56716f[_0x6aee('0x23')]],'as':_0x56716f['as'],'attributes':_0x56716f[_0x6aee('0x21')],'include':_0x56716f[_0x6aee('0x22')]?_[_0x6aee('0x24')](_0x56716f[_0x6aee('0x22')],function(_0x321c55){return{'model':db[_0x321c55[_0x6aee('0x23')]],'as':_0x321c55['as'],'attributes':_0x321c55[_0x6aee('0x21')],'include':_0x321c55[_0x6aee('0x22')]?_[_0x6aee('0x24')](_0x321c55[_0x6aee('0x22')],function(_0x3376d1){return{'model':db[_0x3376d1[_0x6aee('0x23')]],'as':_0x3376d1['as'],'attributes':_0x3376d1[_0x6aee('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6aee('0x11')](function(_0x2fc285){logger['info']('GetVoiceExtension',_0x340eae);logger[_0x6aee('0x13')](_0x6aee('0x1c'),_0x340eae,JSON[_0x6aee('0x16')](_0x2fc285));_0xf94d0d(_0x2fc285);})[_0x6aee('0x25')](function(_0x4a2c8f){logger[_0x6aee('0x17')]('GetVoiceExtension',_0x4a2c8f[_0x6aee('0x19')],_0x340eae);_0x5969b2(_0x26aab4[_0x6aee('0x17')](0x1f4,_0x4a2c8f[_0x6aee('0x19')]));});});}; \ No newline at end of file +var _0xbf4e=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','VoiceExtension,\x20%s,\x20%s','message','catch','GetVoiceExtension','findAll','options','raw','where','attributes','include','map','model','stringify'];(function(_0x599544,_0x8965fb){var _0x3a121a=function(_0x27c174){while(--_0x27c174){_0x599544['push'](_0x599544['shift']());}};_0x3a121a(++_0x8965fb);}(_0xbf4e,0x172));var _0xebf4=function(_0x30d80a,_0x2ec82f){_0x30d80a=_0x30d80a-0x0;var _0x44382c=_0xbf4e[_0x30d80a];return _0x44382c;};'use strict';var _=require(_0xebf4('0x0'));var util=require(_0xebf4('0x1'));var moment=require(_0xebf4('0x2'));var BPromise=require(_0xebf4('0x3'));var rs=require(_0xebf4('0x4'));var fs=require('fs');var Redis=require(_0xebf4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xebf4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xebf4('0x7'));var jayson=require(_0xebf4('0x8'));var client=jayson['client'][_0xebf4('0x9')]({'port':0x232a});config[_0xebf4('0xa')]=_[_0xebf4('0xb')](config['redis'],{'host':_0xebf4('0xc'),'port':0x18eb});var socket=require(_0xebf4('0xd'))(new Redis(config[_0xebf4('0xa')]));require(_0xebf4('0xe'))[_0xebf4('0xf')](socket);function respondWithRpcPromise(_0xb64374,_0x35dc8f,_0x172837){return new BPromise(function(_0x1ed483,_0x188d77){return client[_0xebf4('0x10')](_0xb64374,_0x172837)[_0xebf4('0x11')](function(_0x24adc5){logger[_0xebf4('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x35dc8f,_0xebf4('0x13'));logger[_0xebf4('0x14')](_0xebf4('0x15'),_0x35dc8f,'request\x20sent',JSON['stringify'](_0x24adc5));if(_0x24adc5[_0xebf4('0x16')]){if(_0x24adc5[_0xebf4('0x16')][_0xebf4('0x17')]===0x1f4){logger[_0xebf4('0x16')](_0xebf4('0x18'),_0x35dc8f,_0x24adc5[_0xebf4('0x16')][_0xebf4('0x19')]);return _0x188d77(_0x24adc5[_0xebf4('0x16')][_0xebf4('0x19')]);}logger[_0xebf4('0x16')](_0xebf4('0x18'),_0x35dc8f,_0x24adc5[_0xebf4('0x16')][_0xebf4('0x19')]);return _0x1ed483(_0x24adc5[_0xebf4('0x16')][_0xebf4('0x19')]);}else{logger[_0xebf4('0x12')](_0xebf4('0x18'),_0x35dc8f,_0xebf4('0x13'));_0x1ed483(_0x24adc5['result']['message']);}})[_0xebf4('0x1a')](function(_0x1180f7){logger[_0xebf4('0x16')](_0xebf4('0x18'),_0x35dc8f,_0x1180f7);_0x188d77(_0x1180f7);});});}exports[_0xebf4('0x1b')]=function(_0x2d930b){var _0x1d9aa8=this;return new Promise(function(_0x293130,_0x153d7d){return db['VoiceExtension'][_0xebf4('0x1c')]({'raw':_0x2d930b[_0xebf4('0x1d')]?_0x2d930b[_0xebf4('0x1d')][_0xebf4('0x1e')]===undefined?!![]:![]:!![],'where':_0x2d930b[_0xebf4('0x1d')]?_0x2d930b[_0xebf4('0x1d')][_0xebf4('0x1f')]||null:null,'attributes':_0x2d930b['options']?_0x2d930b[_0xebf4('0x1d')][_0xebf4('0x20')]||null:null,'limit':_0x2d930b['options']?_0x2d930b['options']['limit']||null:null,'include':_0x2d930b['options']?_0x2d930b[_0xebf4('0x1d')][_0xebf4('0x21')]?_[_0xebf4('0x22')](_0x2d930b[_0xebf4('0x1d')][_0xebf4('0x21')],function(_0x467c70){return{'model':db[_0x467c70[_0xebf4('0x23')]],'as':_0x467c70['as'],'attributes':_0x467c70[_0xebf4('0x20')],'include':_0x467c70['include']?_[_0xebf4('0x22')](_0x467c70['include'],function(_0x462987){return{'model':db[_0x462987[_0xebf4('0x23')]],'as':_0x462987['as'],'attributes':_0x462987['attributes'],'include':_0x462987[_0xebf4('0x21')]?_[_0xebf4('0x22')](_0x462987['include'],function(_0x64293d){return{'model':db[_0x64293d['model']],'as':_0x64293d['as'],'attributes':_0x64293d[_0xebf4('0x20')]};}):[]};}):[]};}):[]:[]})[_0xebf4('0x11')](function(_0x51ae3f){logger[_0xebf4('0x12')]('GetVoiceExtension',_0x2d930b);logger['debug']('GetVoiceExtension',_0x2d930b,JSON[_0xebf4('0x24')](_0x51ae3f));_0x293130(_0x51ae3f);})[_0xebf4('0x1a')](function(_0x4a3b36){logger[_0xebf4('0x16')](_0xebf4('0x1b'),_0x4a3b36['message'],_0x2d930b);_0x153d7d(_0x1d9aa8[_0xebf4('0x16')](0x1f4,_0x4a3b36[_0xebf4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 1f74669..3953842 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 _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x2a93da,_0x273a4a){var _0x55240e=function(_0x57bc4f){while(--_0x57bc4f){_0x2a93da['push'](_0x2a93da['shift']());}};_0x55240e(++_0x273a4a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0x5fc3[_0x3e25c1];return _0x52e7f2;};'use strict';var VoiceExtensionEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){VoiceExtensionEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);VoiceExtensionEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file +var _0x2ef3=['update','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove'];(function(_0x9ebfe0,_0x5c3b55){var _0x273a3d=function(_0x42e5b5){while(--_0x42e5b5){_0x9ebfe0['push'](_0x9ebfe0['shift']());}};_0x273a3d(++_0x5c3b55);}(_0x2ef3,0xba));var _0x32ef=function(_0xdc2744,_0x2e84e8){_0xdc2744=_0xdc2744-0x0;var _0x57a3e4=_0x2ef3[_0xdc2744];return _0x57a3e4;};'use strict';var VoiceExtensionEvents=require(_0x32ef('0x0'));var events=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3')];function createListener(_0x3944df,_0x38047b){return function(_0x48106c){_0x38047b[_0x32ef('0x4')](_0x3944df,_0x48106c);};}function removeListener(_0x38b7f3,_0x524ab6){return function(){VoiceExtensionEvents[_0x32ef('0x5')](_0x38b7f3,_0x524ab6);};}exports[_0x32ef('0x6')]=function(_0x4c8104){for(var _0x5dfa09=0x0,_0x2c0089=events[_0x32ef('0x7')];_0x5dfa09<_0x2c0089;_0x5dfa09++){var _0x367c39=events[_0x5dfa09];var _0x2fb8eb=createListener(_0x32ef('0x8')+_0x367c39,_0x4c8104);VoiceExtensionEvents['on'](_0x367c39,_0x2fb8eb);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index a5ecfce..7589947 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 _0xe3da=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','destroy'];(function(_0x554129,_0x2c3d20){var _0x4de573=function(_0x4d1b9b){while(--_0x4d1b9b){_0x554129['push'](_0x554129['shift']());}};_0x4de573(++_0x2c3d20);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'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/messages',auth['isAuthenticated'](),controller[_0xae3d('0x10')]);router[_0xae3d('0x11')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0x12')]);router[_0xae3d('0x13')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0x14')]);router['delete'](_0xae3d('0xe'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x15')]);module[_0xae3d('0x16')]=router; \ No newline at end of file +var _0x4888=['/:id/messages','post','create','put','update','delete','/:id','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x4888,0x198));var _0x8488=function(_0x16b47f,_0x56cdd5){_0x16b47f=_0x16b47f-0x0;var _0x2070d4=_0x4888[_0x16b47f];return _0x2070d4;};'use strict';var multer=require('multer');var util=require(_0x8488('0x0'));var path=require(_0x8488('0x1'));var timeout=require(_0x8488('0x2'));var express=require(_0x8488('0x3'));var router=express[_0x8488('0x4')]();var fs_extra=require(_0x8488('0x5'));var auth=require(_0x8488('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8488('0x7'));var controller=require(_0x8488('0x8'));router[_0x8488('0x9')]('/',auth[_0x8488('0xa')](),controller[_0x8488('0xb')]);router[_0x8488('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x8488('0xc'),auth[_0x8488('0xa')](),controller['getMessages']);router[_0x8488('0xd')]('/',auth[_0x8488('0xa')](),controller[_0x8488('0xe')]);router[_0x8488('0xf')]('/:id',auth[_0x8488('0xa')](),controller[_0x8488('0x10')]);router[_0x8488('0x11')](_0x8488('0x12'),auth[_0x8488('0xa')](),controller['destroy']);module[_0x8488('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 9b7c23d..a5b587f 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 _0x8cdc=['INTEGER','getDataValue','\x20-\x20','mailbox','sequelize','STRING','contest_mailbox','string','trim','yes','ENUM','TINYINT(4)','TIMESTAMP'];(function(_0x3ca064,_0x505cfe){var _0x404382=function(_0x1223e2){while(--_0x1223e2){_0x3ca064['push'](_0x3ca064['shift']());}};_0x404382(++_0x505cfe);}(_0x8cdc,0x93));var _0xc8cd=function(_0x32f12e,_0x2439a8){_0x32f12e=_0x32f12e-0x0;var _0x517bac=_0x8cdc[_0x32f12e];return _0x517bac;};'use strict';var Sequelize=require(_0xc8cd('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xc8cd('0x1')]},'context':{'type':Sequelize[_0xc8cd('0x1')],'defaultValue':'from-voicemail','unique':_0xc8cd('0x2')},'mailbox':{'type':Sequelize[_0xc8cd('0x1')],'defaultValue':'','allowNull':![],'unique':_0xc8cd('0x2')},'password':{'type':Sequelize[_0xc8cd('0x1')]},'fullname':{'type':Sequelize[_0xc8cd('0x1')]},'email':{'type':Sequelize[_0xc8cd('0x1')],'validate':{'isEmail':!![]},'set':function(_0x3ff6ed){this['setDataValue']('email',typeof _0x3ff6ed===_0xc8cd('0x3')&&_0x3ff6ed[_0xc8cd('0x4')]()?_0x3ff6ed[_0xc8cd('0x4')]():null);}},'pager':{'type':Sequelize[_0xc8cd('0x1')]},'tz':{'type':Sequelize[_0xc8cd('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0xc8cd('0x5'),'no'),'defaultValue':_0xc8cd('0x5'),'allowNull':![]},'saycid':{'type':Sequelize[_0xc8cd('0x6')](_0xc8cd('0x5'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xc8cd('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xc8cd('0x6')](_0xc8cd('0x5'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xc8cd('0x6')](_0xc8cd('0x5'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xc8cd('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xc8cd('0x7'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xc8cd('0x5'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xc8cd('0x5'),'no'),'defaultValue':_0xc8cd('0x5'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xc8cd('0x6')](_0xc8cd('0x5'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xc8cd('0x5'),'no'),'defaultValue':_0xc8cd('0x5'),'allowNull':![]},'stamp':{'type':_0xc8cd('0x8')},'emailsubject':{'type':Sequelize[_0xc8cd('0x1')]},'emailbody':{'type':Sequelize[_0xc8cd('0x1')]},'maxsecs':{'type':Sequelize[_0xc8cd('0x9')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xc8cd('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xc8cd('0xa')]('fullname')+_0xc8cd('0xb')+this[_0xc8cd('0xa')](_0xc8cd('0xc'));}}}; \ No newline at end of file +var _0x869b=['contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x869b,0x176));var _0xb869=function(_0x5a51a4,_0x19be8e){_0x5a51a4=_0x5a51a4-0x0;var _0x3e19a2=_0x869b[_0x5a51a4];return _0x3e19a2;};'use strict';var Sequelize=require(_0xb869('0x0'));module[_0xb869('0x1')]={'customer_id':{'type':Sequelize[_0xb869('0x2')]},'context':{'type':Sequelize[_0xb869('0x2')],'defaultValue':_0xb869('0x3'),'unique':_0xb869('0x4')},'mailbox':{'type':Sequelize[_0xb869('0x2')],'defaultValue':'','allowNull':![],'unique':_0xb869('0x4')},'password':{'type':Sequelize[_0xb869('0x2')]},'fullname':{'type':Sequelize[_0xb869('0x2')]},'email':{'type':Sequelize[_0xb869('0x2')],'validate':{'isEmail':!![]},'set':function(_0x571daf){this[_0xb869('0x5')]('email',typeof _0x571daf===_0xb869('0x6')&&_0x571daf['trim']()?_0x571daf[_0xb869('0x7')]():null);}},'pager':{'type':Sequelize[_0xb869('0x2')]},'tz':{'type':Sequelize[_0xb869('0x2')],'defaultValue':_0xb869('0x8')},'attach':{'type':Sequelize[_0xb869('0x9')]('yes','no'),'defaultValue':_0xb869('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xb869('0x9')]('yes','no'),'defaultValue':_0xb869('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xb869('0x2')]},'callback':{'type':Sequelize[_0xb869('0x2')]},'review':{'type':Sequelize[_0xb869('0x9')](_0xb869('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xb869('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xb869('0x9')](_0xb869('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xb869('0x9')](_0xb869('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xb869('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xb869('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xb869('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xb869('0x9')](_0xb869('0xa'),'no'),'defaultValue':_0xb869('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xb869('0x9')](_0xb869('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xb869('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xb869('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xb869('0xc')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xb869('0x2')]},'maxsecs':{'type':Sequelize[_0xb869('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xb869('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb869('0xe')](_0xb869('0xf'))+_0xb869('0x10')+this[_0xb869('0xe')](_0xb869('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 98adbd7..003ed80 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 _0x4ded=['findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','order','sort','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','name','index','map','VoiceMail','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','VIRTUAL','filter','merge','options','includeAll','include'];(function(_0x3d0035,_0x4cd00a){var _0x188361=function(_0x59891b){while(--_0x59891b){_0x3d0035['push'](_0x3d0035['shift']());}};_0x188361(++_0x4cd00a);}(_0x4ded,0x116));var _0xd4de=function(_0x9719d9,_0x46dfab){_0x9719d9=_0x9719d9-0x0;var _0x21dff4=_0x4ded[_0x9719d9];return _0x21dff4;};'use strict';var emlformat=require(_0xd4de('0x0'));var rimraf=require(_0xd4de('0x1'));var zipdir=require(_0xd4de('0x2'));var jsonpatch=require(_0xd4de('0x3'));var rp=require(_0xd4de('0x4'));var moment=require(_0xd4de('0x5'));var BPromise=require(_0xd4de('0x6'));var Mustache=require(_0xd4de('0x7'));var util=require(_0xd4de('0x8'));var path=require(_0xd4de('0x9'));var sox=require(_0xd4de('0xa'));var csv=require(_0xd4de('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4de('0xc'));var _=require(_0xd4de('0xd'));var squel=require(_0xd4de('0xe'));var crypto=require(_0xd4de('0xf'));var jsforce=require(_0xd4de('0x10'));var deskjs=require(_0xd4de('0x11'));var toCsv=require('to-csv');var querystring=require(_0xd4de('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd4de('0x13'));var as=require(_0xd4de('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd4de('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd4de('0x16'));var db=require(_0xd4de('0x17'))['db'];function respondWithStatusCode(_0x104dad,_0x2aa09d){_0x2aa09d=_0x2aa09d||0xcc;return function(_0x3ffc72){if(_0x3ffc72){return _0x104dad[_0xd4de('0x18')](_0x2aa09d);}return _0x104dad[_0xd4de('0x19')](_0x2aa09d)[_0xd4de('0x1a')]();};}function respondWithResult(_0x3e3735,_0x37cb9f){_0x37cb9f=_0x37cb9f||0xc8;return function(_0x691ba9){if(_0x691ba9){return _0x3e3735[_0xd4de('0x19')](_0x37cb9f)[_0xd4de('0x1b')](_0x691ba9);}};}function respondWithFilteredResult(_0xbb4f7e,_0x102e5b){return function(_0xa7c18b){if(_0xa7c18b){var _0x325fba=typeof _0x102e5b['offset']==='undefined'&&typeof _0x102e5b[_0xd4de('0x1c')]===_0xd4de('0x1d');var _0x17b377=_0xa7c18b[_0xd4de('0x1e')];var _0x5b1d1c=_0x325fba?0x0:_0x102e5b['offset'];var _0x1e91d5=_0x325fba?_0xa7c18b['count']:_0x102e5b[_0xd4de('0x1f')]+_0x102e5b[_0xd4de('0x1c')];var _0x50b9e3;if(_0x1e91d5>=_0x17b377){_0x1e91d5=_0x17b377;_0x50b9e3=0xc8;}else{_0x50b9e3=0xce;}_0xbb4f7e[_0xd4de('0x19')](_0x50b9e3);return _0xbb4f7e['set'](_0xd4de('0x20'),_0x5b1d1c+'-'+_0x1e91d5+'/'+_0x17b377)[_0xd4de('0x1b')](_0xa7c18b);}return null;};}function patchUpdates(_0x2bad14){return function(_0x8e8712){try{jsonpatch['apply'](_0x8e8712,_0x2bad14,!![]);}catch(_0x318658){return BPromise[_0xd4de('0x21')](_0x318658);}return _0x8e8712[_0xd4de('0x22')]();};}function saveUpdates(_0xdb3fc,_0x1c631a){return function(_0x2d092a){if(_0x2d092a){return _0x2d092a[_0xd4de('0x23')](_0xdb3fc)[_0xd4de('0x24')](function(_0x2f9de6){return _0x2f9de6;});}return null;};}function removeEntity(_0x413f68,_0x534b37){return function(_0xad333f){if(_0xad333f){return _0xad333f[_0xd4de('0x25')]()[_0xd4de('0x24')](function(){var _0x22970c=_0xad333f[_0xd4de('0x26')]({'plain':!![]});var _0x984904=_0xd4de('0x27');return db[_0xd4de('0x28')][_0xd4de('0x25')]({'where':{'type':_0x984904,'resourceId':_0x22970c['id']}})[_0xd4de('0x24')](function(){return _0xad333f;});})[_0xd4de('0x24')](function(){_0x413f68[_0xd4de('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe64e4e,_0x35e2fc){return function(_0x5005b0){if(!_0x5005b0){_0xe64e4e[_0xd4de('0x18')](0x194);}return _0x5005b0;};}function handleError(_0x59b3c5,_0x44b710){_0x44b710=_0x44b710||0x1f4;return function(_0x32e407){logger[_0xd4de('0x29')](_0x32e407['stack']);if(_0x32e407[_0xd4de('0x2a')]){delete _0x32e407[_0xd4de('0x2a')];}_0x59b3c5[_0xd4de('0x19')](_0x44b710)['send'](_0x32e407);};}exports[_0xd4de('0x2b')]=function(_0x1804c7,_0x55f9f9){var _0x5103b5={},_0x5706fe={},_0x3f6491={'count':0x0,'rows':[]};var _0x496795=_[_0xd4de('0x2c')](db[_0xd4de('0x2d')][_0xd4de('0x2e')],function(_0x2e08eb){return{'name':_0x2e08eb['fieldName'],'type':_0x2e08eb[_0xd4de('0x2f')][_0xd4de('0x30')]};});_0x5706fe['model']=_[_0xd4de('0x2c')](_0x496795,_0xd4de('0x2a'));_0x5706fe['query']=_['keys'](_0x1804c7[_0xd4de('0x31')]);_0x5706fe[_0xd4de('0x32')]=_[_0xd4de('0x33')](_0x5706fe[_0xd4de('0x34')],_0x5706fe['query']);_0x5103b5[_0xd4de('0x35')]=_[_0xd4de('0x33')](_0x5706fe['model'],qs[_0xd4de('0x36')](_0x1804c7[_0xd4de('0x31')][_0xd4de('0x36')]));_0x5103b5[_0xd4de('0x35')]=_0x5103b5[_0xd4de('0x35')][_0xd4de('0x37')]?_0x5103b5['attributes']:_0x5706fe['model'];if(!_0x1804c7[_0xd4de('0x31')][_0xd4de('0x38')](_0xd4de('0x39'))){_0x5103b5['limit']=qs[_0xd4de('0x1c')](_0x1804c7[_0xd4de('0x31')]['limit']);_0x5103b5[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x1804c7[_0xd4de('0x31')][_0xd4de('0x1f')]);}_0x5103b5['order']=qs['sort'](_0x1804c7[_0xd4de('0x31')]['sort']);_0x5103b5[_0xd4de('0x3a')]=qs['filters'](_[_0xd4de('0x3b')](_0x1804c7[_0xd4de('0x31')],_0x5706fe[_0xd4de('0x32')]),_0x496795);if(_0x1804c7[_0xd4de('0x31')]['filter']){_0x5103b5[_0xd4de('0x3a')]=_['merge'](_0x5103b5[_0xd4de('0x3a')],{'$or':_[_0xd4de('0x2c')](_0x496795,function(_0x7f17b9){if(_0x7f17b9[_0xd4de('0x2f')]!==_0xd4de('0x3c')){var _0x13c256={};_0x13c256[_0x7f17b9[_0xd4de('0x2a')]]={'$like':'%'+_0x1804c7['query'][_0xd4de('0x3d')]+'%'};return _0x13c256;}})});}_0x5103b5=_[_0xd4de('0x3e')]({},_0x5103b5,_0x1804c7[_0xd4de('0x3f')]);var _0x2ec1fa={'where':_0x5103b5[_0xd4de('0x3a')]};return db['VoiceMail'][_0xd4de('0x1e')](_0x2ec1fa)[_0xd4de('0x24')](function(_0x2294e2){_0x3f6491['count']=_0x2294e2;if(_0x1804c7[_0xd4de('0x31')][_0xd4de('0x40')]){_0x5103b5[_0xd4de('0x41')]=[{'all':!![]}];}return db['VoiceMail'][_0xd4de('0x42')](_0x5103b5);})[_0xd4de('0x24')](function(_0x419c49){_0x3f6491[_0xd4de('0x43')]=_0x419c49;return _0x3f6491;})[_0xd4de('0x24')](respondWithFilteredResult(_0x55f9f9,_0x5103b5))[_0xd4de('0x44')](handleError(_0x55f9f9,null));};exports[_0xd4de('0x45')]=function(_0x5ecbbd,_0x43b542){var _0x164bde={'raw':!![],'where':{'id':_0x5ecbbd['params']['id']}},_0x58082a={};_0x58082a[_0xd4de('0x34')]=_[_0xd4de('0x46')](db[_0xd4de('0x2d')]['rawAttributes']);_0x58082a['query']=_[_0xd4de('0x46')](_0x5ecbbd[_0xd4de('0x31')]);_0x58082a['filters']=_[_0xd4de('0x33')](_0x58082a[_0xd4de('0x34')],_0x58082a[_0xd4de('0x31')]);_0x164bde[_0xd4de('0x35')]=_['intersection'](_0x58082a[_0xd4de('0x34')],qs[_0xd4de('0x36')](_0x5ecbbd[_0xd4de('0x31')][_0xd4de('0x36')]));_0x164bde[_0xd4de('0x35')]=_0x164bde[_0xd4de('0x35')]['length']?_0x164bde[_0xd4de('0x35')]:_0x58082a[_0xd4de('0x34')];if(_0x5ecbbd[_0xd4de('0x31')][_0xd4de('0x40')]){_0x164bde[_0xd4de('0x41')]=[{'all':!![]}];}_0x164bde=_[_0xd4de('0x3e')]({},_0x164bde,_0x5ecbbd[_0xd4de('0x3f')]);return db[_0xd4de('0x2d')][_0xd4de('0x47')](_0x164bde)[_0xd4de('0x24')](handleEntityNotFound(_0x43b542,null))['then'](respondWithResult(_0x43b542,null))[_0xd4de('0x44')](handleError(_0x43b542,null));};exports[_0xd4de('0x48')]=function(_0x178daf,_0x518bfe){return db[_0xd4de('0x2d')][_0xd4de('0x48')](_0x178daf[_0xd4de('0x49')],{})[_0xd4de('0x24')](function(_0x42e58e){var _0xa24bb7=_0x178daf[_0xd4de('0x4a')][_0xd4de('0x26')]({'plain':!![]});if(!_0xa24bb7)throw new Error(_0xd4de('0x4b'));if(_0xa24bb7[_0xd4de('0x4c')]==='user'){var _0x3e4c7f=_0x42e58e[_0xd4de('0x26')]({'plain':!![]});var _0x215f85=_0xd4de('0x27');return db[_0xd4de('0x4d')]['find']({'where':{'name':_0x215f85,'userProfileId':_0xa24bb7['userProfileId']},'raw':!![]})[_0xd4de('0x24')](function(_0x2deedb){if(_0x2deedb&&_0x2deedb['autoAssociation']===0x0){return db['UserProfileResource'][_0xd4de('0x48')]({'name':_0x3e4c7f[_0xd4de('0x2a')],'resourceId':_0x3e4c7f['id'],'type':_0x2deedb[_0xd4de('0x2a')],'sectionId':_0x2deedb['id']},{})[_0xd4de('0x24')](function(){return _0x42e58e;});}else{return _0x42e58e;}})[_0xd4de('0x44')](function(_0x15c8cd){logger[_0xd4de('0x29')](_0xd4de('0x4e'),_0x15c8cd);throw _0x15c8cd;});}return _0x42e58e;})[_0xd4de('0x24')](respondWithResult(_0x518bfe,0xc9))[_0xd4de('0x44')](handleError(_0x518bfe,null));};exports[_0xd4de('0x23')]=function(_0x2e1780,_0x56c13e){if(_0x2e1780[_0xd4de('0x49')]['id']){delete _0x2e1780[_0xd4de('0x49')]['id'];}return db[_0xd4de('0x2d')][_0xd4de('0x47')]({'where':{'id':_0x2e1780[_0xd4de('0x4f')]['id']}})[_0xd4de('0x24')](handleEntityNotFound(_0x56c13e,null))['then'](saveUpdates(_0x2e1780[_0xd4de('0x49')],null))['then'](respondWithResult(_0x56c13e,null))['catch'](handleError(_0x56c13e,null));};exports[_0xd4de('0x25')]=function(_0xd79781,_0x2d1e45){return db[_0xd4de('0x2d')]['find']({'where':{'id':_0xd79781[_0xd4de('0x4f')]['id']}})[_0xd4de('0x24')](handleEntityNotFound(_0x2d1e45,null))[_0xd4de('0x24')](removeEntity(_0x2d1e45,null))[_0xd4de('0x44')](handleError(_0x2d1e45,null));};exports[_0xd4de('0x50')]=function(_0x4bb7df,_0x5496f7,_0x4b55cc){return db[_0xd4de('0x2d')][_0xd4de('0x51')]({'where':{'id':_0x4bb7df[_0xd4de('0x4f')]['id']}})[_0xd4de('0x24')](handleEntityNotFound(_0x5496f7,null))['then'](function(_0x35ba6f){var _0x146eaa;var _0x2e0d76={},_0x17047a={};_0x17047a['model']=_[_0xd4de('0x46')](db[_0xd4de('0x52')][_0xd4de('0x2e')]);_0x17047a[_0xd4de('0x31')]=_['keys'](_0x4bb7df['query']);_0x17047a['filters']=_[_0xd4de('0x33')](_0x17047a[_0xd4de('0x34')],_0x17047a[_0xd4de('0x31')]);_0x2e0d76['attributes']=_[_0xd4de('0x33')](_0x17047a[_0xd4de('0x34')],qs[_0xd4de('0x36')](_0x4bb7df['query'][_0xd4de('0x36')]));_0x2e0d76['attributes']=_0x2e0d76[_0xd4de('0x35')][_0xd4de('0x37')]?_0x2e0d76[_0xd4de('0x35')]:_0x17047a[_0xd4de('0x34')];if(!_0x4bb7df[_0xd4de('0x31')][_0xd4de('0x38')](_0xd4de('0x39'))){_0x2e0d76[_0xd4de('0x1c')]=qs['limit'](_0x4bb7df[_0xd4de('0x31')]['limit']);_0x2e0d76[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x4bb7df['query'][_0xd4de('0x1f')]);}_0x2e0d76[_0xd4de('0x53')]=qs[_0xd4de('0x54')](_0x4bb7df[_0xd4de('0x31')][_0xd4de('0x54')]);_0x2e0d76[_0xd4de('0x3a')]=qs[_0xd4de('0x32')](_[_0xd4de('0x3b')](_0x4bb7df[_0xd4de('0x31')],_0x17047a[_0xd4de('0x32')]));if(_0x4bb7df[_0xd4de('0x31')][_0xd4de('0x3d')]){_0x2e0d76[_0xd4de('0x3a')]=_['merge'](_0x2e0d76[_0xd4de('0x3a')],{'$or':_[_0xd4de('0x2c')](_0x2e0d76[_0xd4de('0x35')],function(_0x331f08){var _0x25628e={};_0x25628e[_0x331f08]={'$like':'%'+_0x4bb7df[_0xd4de('0x31')][_0xd4de('0x3d')]+'%'};return _0x25628e;})});}_0x2e0d76[_0xd4de('0x3a')]=_['merge'](_0x2e0d76[_0xd4de('0x3a')],{'mailboxuser':_0x35ba6f['mailbox']});_0x2e0d76=_['merge']({},_0x2e0d76,_0x4bb7df['options']);return db[_0xd4de('0x52')][_0xd4de('0x55')](_0x2e0d76)['then'](respondWithFilteredResult(_0x5496f7,_0x2e0d76));})['catch'](handleError(_0x5496f7,null));}; \ No newline at end of file +var _0x282b=['json','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','end','error','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','VoiceMail','includeAll','include','findAll','catch','show','intersection','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','getMessages','findOne','VoiceMailMessage','pick','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x282b,0xec));var _0xb282=function(_0x3aa86a,_0x1251fc){_0x3aa86a=_0x3aa86a-0x0;var _0x37c04b=_0x282b[_0x3aa86a];return _0x37c04b;};'use strict';var emlformat=require(_0xb282('0x0'));var rimraf=require(_0xb282('0x1'));var zipdir=require(_0xb282('0x2'));var jsonpatch=require(_0xb282('0x3'));var rp=require(_0xb282('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb282('0x5'));var util=require('util');var path=require(_0xb282('0x6'));var sox=require(_0xb282('0x7'));var csv=require(_0xb282('0x8'));var ejs=require(_0xb282('0x9'));var fs=require('fs');var fs_extra=require(_0xb282('0xa'));var _=require(_0xb282('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb282('0xc'));var deskjs=require(_0xb282('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb282('0xe'));var Papa=require(_0xb282('0xf'));var Redis=require(_0xb282('0x10'));var authService=require(_0xb282('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb282('0x12'));var logger=require(_0xb282('0x13'))(_0xb282('0x14'));var utils=require(_0xb282('0x15'));var config=require(_0xb282('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x338bdb,_0xc08746){_0xc08746=_0xc08746||0xcc;return function(_0x40d7b8){if(_0x40d7b8){return _0x338bdb[_0xb282('0x17')](_0xc08746);}return _0x338bdb[_0xb282('0x18')](_0xc08746)['end']();};}function respondWithResult(_0x34c595,_0x5adf7f){_0x5adf7f=_0x5adf7f||0xc8;return function(_0xe1d53){if(_0xe1d53){return _0x34c595[_0xb282('0x18')](_0x5adf7f)['json'](_0xe1d53);}};}function respondWithFilteredResult(_0x525cfa,_0x5bc7c3){return function(_0x13cea1){if(_0x13cea1){var _0x350676=typeof _0x5bc7c3[_0xb282('0x19')]===_0xb282('0x1a')&&typeof _0x5bc7c3[_0xb282('0x1b')]==='undefined';var _0x191a31=_0x13cea1[_0xb282('0x1c')];var _0xca5f12=_0x350676?0x0:_0x5bc7c3[_0xb282('0x19')];var _0x3f8a3f=_0x350676?_0x13cea1['count']:_0x5bc7c3['offset']+_0x5bc7c3[_0xb282('0x1b')];var _0x2cdeb1;if(_0x3f8a3f>=_0x191a31){_0x3f8a3f=_0x191a31;_0x2cdeb1=0xc8;}else{_0x2cdeb1=0xce;}_0x525cfa['status'](_0x2cdeb1);return _0x525cfa[_0xb282('0x1d')](_0xb282('0x1e'),_0xca5f12+'-'+_0x3f8a3f+'/'+_0x191a31)[_0xb282('0x1f')](_0x13cea1);}return null;};}function patchUpdates(_0x438dbe){return function(_0x1c3084){try{jsonpatch['apply'](_0x1c3084,_0x438dbe,!![]);}catch(_0x1de407){return BPromise[_0xb282('0x20')](_0x1de407);}return _0x1c3084[_0xb282('0x21')]();};}function saveUpdates(_0x4b79d7,_0x437d66){return function(_0x2a7ef8){if(_0x2a7ef8){return _0x2a7ef8[_0xb282('0x22')](_0x4b79d7)[_0xb282('0x23')](function(_0x680095){return _0x680095;});}return null;};}function removeEntity(_0x56645f,_0x4d624f){return function(_0x360f15){if(_0x360f15){return _0x360f15[_0xb282('0x24')]()['then'](function(){var _0x5e828e=_0x360f15[_0xb282('0x25')]({'plain':!![]});var _0x114f77=_0xb282('0x26');return db[_0xb282('0x27')][_0xb282('0x24')]({'where':{'type':_0x114f77,'resourceId':_0x5e828e['id']}})[_0xb282('0x23')](function(){return _0x360f15;});})['then'](function(){_0x56645f[_0xb282('0x18')](0xcc)[_0xb282('0x28')]();});}};}function handleEntityNotFound(_0x50bd73,_0x22d895){return function(_0x38a1f8){if(!_0x38a1f8){_0x50bd73[_0xb282('0x17')](0x194);}return _0x38a1f8;};}function handleError(_0x280940,_0x59644e){_0x59644e=_0x59644e||0x1f4;return function(_0x1520b1){logger[_0xb282('0x29')](_0x1520b1[_0xb282('0x2a')]);if(_0x1520b1[_0xb282('0x2b')]){delete _0x1520b1[_0xb282('0x2b')];}_0x280940[_0xb282('0x18')](_0x59644e)[_0xb282('0x2c')](_0x1520b1);};}exports['index']=function(_0x1b15b5,_0x1e2861){var _0x3eb294={},_0xd8780b={},_0x42ef75={'count':0x0,'rows':[]};var _0x5f3ddf=_[_0xb282('0x2d')](db['VoiceMail'][_0xb282('0x2e')],function(_0x1bf721){return{'name':_0x1bf721[_0xb282('0x2f')],'type':_0x1bf721['type'][_0xb282('0x30')]};});_0xd8780b['model']=_[_0xb282('0x2d')](_0x5f3ddf,_0xb282('0x2b'));_0xd8780b[_0xb282('0x31')]=_[_0xb282('0x32')](_0x1b15b5[_0xb282('0x31')]);_0xd8780b[_0xb282('0x33')]=_['intersection'](_0xd8780b[_0xb282('0x34')],_0xd8780b[_0xb282('0x31')]);_0x3eb294['attributes']=_['intersection'](_0xd8780b[_0xb282('0x34')],qs[_0xb282('0x35')](_0x1b15b5[_0xb282('0x31')]['fields']));_0x3eb294['attributes']=_0x3eb294['attributes'][_0xb282('0x36')]?_0x3eb294[_0xb282('0x37')]:_0xd8780b[_0xb282('0x34')];if(!_0x1b15b5[_0xb282('0x31')][_0xb282('0x38')](_0xb282('0x39'))){_0x3eb294[_0xb282('0x1b')]=qs['limit'](_0x1b15b5[_0xb282('0x31')]['limit']);_0x3eb294[_0xb282('0x19')]=qs[_0xb282('0x19')](_0x1b15b5[_0xb282('0x31')]['offset']);}_0x3eb294[_0xb282('0x3a')]=qs['sort'](_0x1b15b5[_0xb282('0x31')][_0xb282('0x3b')]);_0x3eb294[_0xb282('0x3c')]=qs[_0xb282('0x33')](_['pick'](_0x1b15b5['query'],_0xd8780b[_0xb282('0x33')]),_0x5f3ddf);if(_0x1b15b5[_0xb282('0x31')][_0xb282('0x3d')]){_0x3eb294[_0xb282('0x3c')]=_['merge'](_0x3eb294[_0xb282('0x3c')],{'$or':_['map'](_0x5f3ddf,function(_0x475895){if(_0x475895[_0xb282('0x3e')]!=='VIRTUAL'){var _0x41f2c4={};_0x41f2c4[_0x475895[_0xb282('0x2b')]]={'$like':'%'+_0x1b15b5[_0xb282('0x31')][_0xb282('0x3d')]+'%'};return _0x41f2c4;}})});}_0x3eb294=_[_0xb282('0x3f')]({},_0x3eb294,_0x1b15b5[_0xb282('0x40')]);var _0x43e87e={'where':_0x3eb294[_0xb282('0x3c')]};return db[_0xb282('0x41')][_0xb282('0x1c')](_0x43e87e)[_0xb282('0x23')](function(_0x91fe43){_0x42ef75[_0xb282('0x1c')]=_0x91fe43;if(_0x1b15b5[_0xb282('0x31')][_0xb282('0x42')]){_0x3eb294[_0xb282('0x43')]=[{'all':!![]}];}return db[_0xb282('0x41')][_0xb282('0x44')](_0x3eb294);})['then'](function(_0x310ad1){_0x42ef75['rows']=_0x310ad1;return _0x42ef75;})[_0xb282('0x23')](respondWithFilteredResult(_0x1e2861,_0x3eb294))[_0xb282('0x45')](handleError(_0x1e2861,null));};exports[_0xb282('0x46')]=function(_0x2f2ce8,_0x197472){var _0x3ddf56={'raw':!![],'where':{'id':_0x2f2ce8['params']['id']}},_0x5a6c0d={};_0x5a6c0d[_0xb282('0x34')]=_['keys'](db[_0xb282('0x41')][_0xb282('0x2e')]);_0x5a6c0d['query']=_[_0xb282('0x32')](_0x2f2ce8[_0xb282('0x31')]);_0x5a6c0d[_0xb282('0x33')]=_['intersection'](_0x5a6c0d['model'],_0x5a6c0d[_0xb282('0x31')]);_0x3ddf56['attributes']=_[_0xb282('0x47')](_0x5a6c0d[_0xb282('0x34')],qs[_0xb282('0x35')](_0x2f2ce8[_0xb282('0x31')][_0xb282('0x35')]));_0x3ddf56[_0xb282('0x37')]=_0x3ddf56['attributes'][_0xb282('0x36')]?_0x3ddf56[_0xb282('0x37')]:_0x5a6c0d[_0xb282('0x34')];if(_0x2f2ce8['query'][_0xb282('0x42')]){_0x3ddf56['include']=[{'all':!![]}];}_0x3ddf56=_[_0xb282('0x3f')]({},_0x3ddf56,_0x2f2ce8['options']);return db[_0xb282('0x41')]['find'](_0x3ddf56)['then'](handleEntityNotFound(_0x197472,null))['then'](respondWithResult(_0x197472,null))[_0xb282('0x45')](handleError(_0x197472,null));};exports[_0xb282('0x48')]=function(_0x42d99f,_0x7a5aa4){return db['VoiceMail']['create'](_0x42d99f['body'],{})[_0xb282('0x23')](function(_0x255ad5){var _0x3bed8d=_0x42d99f[_0xb282('0x49')]['get']({'plain':!![]});if(!_0x3bed8d)throw new Error(_0xb282('0x4a'));if(_0x3bed8d[_0xb282('0x4b')]==='user'){var _0x33bded=_0x255ad5[_0xb282('0x25')]({'plain':!![]});var _0x16f66b=_0xb282('0x26');return db[_0xb282('0x4c')]['find']({'where':{'name':_0x16f66b,'userProfileId':_0x3bed8d[_0xb282('0x4d')]},'raw':!![]})[_0xb282('0x23')](function(_0x465209){if(_0x465209&&_0x465209[_0xb282('0x4e')]===0x0){return db[_0xb282('0x27')][_0xb282('0x48')]({'name':_0x33bded['name'],'resourceId':_0x33bded['id'],'type':_0x465209[_0xb282('0x2b')],'sectionId':_0x465209['id']},{})['then'](function(){return _0x255ad5;});}else{return _0x255ad5;}})[_0xb282('0x45')](function(_0x1e6ade){logger['error'](_0xb282('0x4f'),_0x1e6ade);throw _0x1e6ade;});}return _0x255ad5;})[_0xb282('0x23')](respondWithResult(_0x7a5aa4,0xc9))[_0xb282('0x45')](handleError(_0x7a5aa4,null));};exports['update']=function(_0x51cbb0,_0x1028b9){if(_0x51cbb0[_0xb282('0x50')]['id']){delete _0x51cbb0[_0xb282('0x50')]['id'];}return db['VoiceMail'][_0xb282('0x51')]({'where':{'id':_0x51cbb0['params']['id']}})[_0xb282('0x23')](handleEntityNotFound(_0x1028b9,null))[_0xb282('0x23')](saveUpdates(_0x51cbb0['body'],null))[_0xb282('0x23')](respondWithResult(_0x1028b9,null))['catch'](handleError(_0x1028b9,null));};exports[_0xb282('0x24')]=function(_0x34b31a,_0x2e6eaa){return db[_0xb282('0x41')][_0xb282('0x51')]({'where':{'id':_0x34b31a[_0xb282('0x52')]['id']}})['then'](handleEntityNotFound(_0x2e6eaa,null))[_0xb282('0x23')](removeEntity(_0x2e6eaa,null))['catch'](handleError(_0x2e6eaa,null));};exports[_0xb282('0x53')]=function(_0x34baf2,_0x53d50a,_0x597793){return db[_0xb282('0x41')][_0xb282('0x54')]({'where':{'id':_0x34baf2[_0xb282('0x52')]['id']}})['then'](handleEntityNotFound(_0x53d50a,null))['then'](function(_0x40ae87){var _0x2dbbc4;var _0x3716b0={},_0x5d6a78={};_0x5d6a78[_0xb282('0x34')]=_['keys'](db[_0xb282('0x55')][_0xb282('0x2e')]);_0x5d6a78[_0xb282('0x31')]=_[_0xb282('0x32')](_0x34baf2[_0xb282('0x31')]);_0x5d6a78[_0xb282('0x33')]=_[_0xb282('0x47')](_0x5d6a78['model'],_0x5d6a78[_0xb282('0x31')]);_0x3716b0[_0xb282('0x37')]=_[_0xb282('0x47')](_0x5d6a78['model'],qs['fields'](_0x34baf2[_0xb282('0x31')][_0xb282('0x35')]));_0x3716b0[_0xb282('0x37')]=_0x3716b0['attributes']['length']?_0x3716b0[_0xb282('0x37')]:_0x5d6a78[_0xb282('0x34')];if(!_0x34baf2['query'][_0xb282('0x38')](_0xb282('0x39'))){_0x3716b0[_0xb282('0x1b')]=qs['limit'](_0x34baf2[_0xb282('0x31')][_0xb282('0x1b')]);_0x3716b0['offset']=qs[_0xb282('0x19')](_0x34baf2[_0xb282('0x31')][_0xb282('0x19')]);}_0x3716b0[_0xb282('0x3a')]=qs['sort'](_0x34baf2['query'][_0xb282('0x3b')]);_0x3716b0[_0xb282('0x3c')]=qs['filters'](_[_0xb282('0x56')](_0x34baf2[_0xb282('0x31')],_0x5d6a78[_0xb282('0x33')]));if(_0x34baf2[_0xb282('0x31')][_0xb282('0x3d')]){_0x3716b0[_0xb282('0x3c')]=_[_0xb282('0x3f')](_0x3716b0[_0xb282('0x3c')],{'$or':_['map'](_0x3716b0[_0xb282('0x37')],function(_0xb22721){var _0x18f33d={};_0x18f33d[_0xb22721]={'$like':'%'+_0x34baf2['query'][_0xb282('0x3d')]+'%'};return _0x18f33d;})});}_0x3716b0[_0xb282('0x3c')]=_['merge'](_0x3716b0['where'],{'mailboxuser':_0x40ae87[_0xb282('0x57')]});_0x3716b0=_[_0xb282('0x3f')]({},_0x3716b0,_0x34baf2[_0xb282('0x40')]);return db[_0xb282('0x55')][_0xb282('0x58')](_0x3716b0)[_0xb282('0x23')](respondWithFilteredResult(_0x53d50a,_0x3716b0));})[_0xb282('0x45')](handleError(_0x53d50a,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 18d9133..21ed656 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 _0x5272=['./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','context','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x4043a9,_0x254d81){var _0x41995c=function(_0x35eeec){while(--_0x35eeec){_0x4043a9['push'](_0x4043a9['shift']());}};_0x41995c(++_0x254d81);}(_0x5272,0x16f));var _0x2527=function(_0x2b6f29,_0x194be0){_0x2b6f29=_0x2b6f29-0x0;var _0x5f59dc=_0x5272[_0x2b6f29];return _0x5f59dc;};'use strict';var _=require(_0x2527('0x0'));var util=require(_0x2527('0x1'));var logger=require(_0x2527('0x2'))(_0x2527('0x3'));var moment=require(_0x2527('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2527('0x5'));var rimraf=require(_0x2527('0x6'));var config=require(_0x2527('0x7'));var attributes=require(_0x2527('0x8'));module[_0x2527('0x9')]=function(_0x514f0d,_0x195780){return _0x514f0d[_0x2527('0xa')](_0x2527('0xb'),attributes,{'tableName':_0x2527('0xc'),'paranoid':![],'indexes':[{'name':_0x2527('0xd'),'fields':['mailbox',_0x2527('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1b99=['rimraf','../../config/environment','./voiceMail.attributes','VoiceMail','voice_voicemail','mailbox_context','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2e9959,_0x5bafa0){var _0x423de8=function(_0x594573){while(--_0x594573){_0x2e9959['push'](_0x2e9959['shift']());}};_0x423de8(++_0x5bafa0);}(_0x1b99,0xc9));var _0x91b9=function(_0x3d61c6,_0x4571e6){_0x3d61c6=_0x3d61c6-0x0;var _0x47e0df=_0x1b99[_0x3d61c6];return _0x47e0df;};'use strict';var _=require(_0x91b9('0x0'));var util=require(_0x91b9('0x1'));var logger=require(_0x91b9('0x2'))(_0x91b9('0x3'));var moment=require('moment');var BPromise=require(_0x91b9('0x4'));var rp=require(_0x91b9('0x5'));var fs=require('fs');var path=require(_0x91b9('0x6'));var rimraf=require(_0x91b9('0x7'));var config=require(_0x91b9('0x8'));var attributes=require(_0x91b9('0x9'));module['exports']=function(_0x3dfd44,_0x1b2dd9){return _0x3dfd44['define'](_0x91b9('0xa'),attributes,{'tableName':_0x91b9('0xb'),'paranoid':![],'indexes':[{'name':_0x91b9('0xc'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 58058aa..15cd518 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 _0x2061=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x48f969,_0x5522df){var _0x1d3716=function(_0x5ac95d){while(--_0x5ac95d){_0x48f969['push'](_0x48f969['shift']());}};_0x1d3716(++_0x5522df);}(_0x2061,0xa7));var _0x1206=function(_0x54f0d3,_0x504769){_0x54f0d3=_0x54f0d3-0x0;var _0x4063ac=_0x2061[_0x54f0d3];return _0x4063ac;};'use strict';var _=require(_0x1206('0x0'));var util=require(_0x1206('0x1'));var moment=require(_0x1206('0x2'));var BPromise=require(_0x1206('0x3'));var rs=require(_0x1206('0x4'));var fs=require('fs');var Redis=require(_0x1206('0x5'));var db=require(_0x1206('0x6'))['db'];var utils=require(_0x1206('0x7'));var logger=require(_0x1206('0x8'))(_0x1206('0x9'));var config=require(_0x1206('0xa'));var jayson=require(_0x1206('0xb'));var client=jayson[_0x1206('0xc')][_0x1206('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x56f08a,_0x103ef7,_0x6d8db9){return new BPromise(function(_0xfa615a,_0x47d5d2){return client[_0x1206('0xe')](_0x56f08a,_0x6d8db9)['then'](function(_0xe6714){logger[_0x1206('0xf')](_0x1206('0x10'),_0x103ef7,_0x1206('0x11'));logger[_0x1206('0x12')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x103ef7,_0x1206('0x11'),JSON[_0x1206('0x13')](_0xe6714));if(_0xe6714[_0x1206('0x14')]){if(_0xe6714[_0x1206('0x14')][_0x1206('0x15')]===0x1f4){logger['error'](_0x1206('0x10'),_0x103ef7,_0xe6714[_0x1206('0x14')][_0x1206('0x16')]);return _0x47d5d2(_0xe6714[_0x1206('0x14')][_0x1206('0x16')]);}logger[_0x1206('0x14')](_0x1206('0x10'),_0x103ef7,_0xe6714[_0x1206('0x14')][_0x1206('0x16')]);return _0xfa615a(_0xe6714[_0x1206('0x14')][_0x1206('0x16')]);}else{logger[_0x1206('0xf')](_0x1206('0x10'),_0x103ef7,_0x1206('0x11'));_0xfa615a(_0xe6714['result'][_0x1206('0x16')]);}})[_0x1206('0x17')](function(_0x478a3f){logger['error'](_0x1206('0x10'),_0x103ef7,_0x478a3f);_0x47d5d2(_0x478a3f);});});} \ No newline at end of file +var _0x5a79=['../../config/environment','jayson/promise','then','info','VoiceMail,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5a79,0x19b));var _0x95a7=function(_0x270061,_0x4e41e1){_0x270061=_0x270061-0x0;var _0x329604=_0x5a79[_0x270061];return _0x329604;};'use strict';var _=require(_0x95a7('0x0'));var util=require(_0x95a7('0x1'));var moment=require(_0x95a7('0x2'));var BPromise=require(_0x95a7('0x3'));var rs=require(_0x95a7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95a7('0x5'))['db'];var utils=require(_0x95a7('0x6'));var logger=require(_0x95a7('0x7'))(_0x95a7('0x8'));var config=require(_0x95a7('0x9'));var jayson=require(_0x95a7('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ae06e,_0x10dfce,_0x37b4d5){return new BPromise(function(_0x319e7c,_0x1284fc){return client['request'](_0x3ae06e,_0x37b4d5)[_0x95a7('0xb')](function(_0x259c1e){logger[_0x95a7('0xc')](_0x95a7('0xd'),_0x10dfce,'request\x20sent');logger[_0x95a7('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x10dfce,_0x95a7('0xf'),JSON[_0x95a7('0x10')](_0x259c1e));if(_0x259c1e[_0x95a7('0x11')]){if(_0x259c1e[_0x95a7('0x11')][_0x95a7('0x12')]===0x1f4){logger[_0x95a7('0x11')](_0x95a7('0xd'),_0x10dfce,_0x259c1e['error'][_0x95a7('0x13')]);return _0x1284fc(_0x259c1e[_0x95a7('0x11')][_0x95a7('0x13')]);}logger[_0x95a7('0x11')](_0x95a7('0xd'),_0x10dfce,_0x259c1e[_0x95a7('0x11')][_0x95a7('0x13')]);return _0x319e7c(_0x259c1e[_0x95a7('0x11')][_0x95a7('0x13')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x10dfce,_0x95a7('0xf'));_0x319e7c(_0x259c1e[_0x95a7('0x14')][_0x95a7('0x13')]);}})['catch'](function(_0x46d617){logger[_0x95a7('0x11')]('VoiceMail,\x20%s,\x20%s',_0x10dfce,_0x46d617);_0x1284fc(_0x46d617);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index d44a03f..db73fb6 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 _0xdbb9=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','download','post','create','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdbb9,0xe4));var _0x9dbb=function(_0x3237bd,_0x21ad0d){_0x3237bd=_0x3237bd-0x0;var _0x1d5987=_0xdbb9[_0x3237bd];return _0x1d5987;};'use strict';var multer=require(_0x9dbb('0x0'));var util=require('util');var path=require(_0x9dbb('0x1'));var timeout=require(_0x9dbb('0x2'));var express=require(_0x9dbb('0x3'));var router=express[_0x9dbb('0x4')]();var fs_extra=require(_0x9dbb('0x5'));var auth=require(_0x9dbb('0x6'));var interaction=require(_0x9dbb('0x7'));var config=require(_0x9dbb('0x8'));var controller=require('./voiceMailMessage.controller');router[_0x9dbb('0x9')]('/',auth['isAuthenticated'](),controller[_0x9dbb('0xa')]);router[_0x9dbb('0x9')](_0x9dbb('0xb'),auth[_0x9dbb('0xc')](),controller[_0x9dbb('0xd')]);router[_0x9dbb('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x9dbb('0xe')]);router[_0x9dbb('0xf')]('/',auth[_0x9dbb('0xc')](),controller[_0x9dbb('0x10')]);router['put'](_0x9dbb('0xb'),auth['isAuthenticated'](),controller[_0x9dbb('0x11')]);router[_0x9dbb('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x9dbb('0x13')]);module[_0x9dbb('0x14')]=router; \ No newline at end of file +var _0xae63=['download','post','create','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','/:id','show','/:id/download'];(function(_0x2a29d0,_0x45156e){var _0x17b6de=function(_0xcaa83c){while(--_0xcaa83c){_0x2a29d0['push'](_0x2a29d0['shift']());}};_0x17b6de(++_0x45156e);}(_0xae63,0x18d));var _0x3ae6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xae63[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3ae6('0x0'));var util=require('util');var path=require(_0x3ae6('0x1'));var timeout=require(_0x3ae6('0x2'));var express=require('express');var router=express[_0x3ae6('0x3')]();var fs_extra=require(_0x3ae6('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3ae6('0x5'));var controller=require('./voiceMailMessage.controller');router[_0x3ae6('0x6')]('/',auth[_0x3ae6('0x7')](),controller['index']);router[_0x3ae6('0x6')](_0x3ae6('0x8'),auth[_0x3ae6('0x7')](),controller[_0x3ae6('0x9')]);router[_0x3ae6('0x6')](_0x3ae6('0xa'),auth[_0x3ae6('0x7')](),controller[_0x3ae6('0xb')]);router[_0x3ae6('0xc')]('/',auth[_0x3ae6('0x7')](),controller[_0x3ae6('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3ae6('0xe')]);router[_0x3ae6('0xf')](_0x3ae6('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x3ae6('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 930f161..c806d66 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 _0x2923=['BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x33a90a,_0x343214){var _0x1165ec=function(_0x1587f3){while(--_0x1587f3){_0x33a90a['push'](_0x33a90a['shift']());}};_0x1165ec(++_0x343214);}(_0x2923,0x1b3));var _0x3292=function(_0x287cff,_0x2eb9d7){_0x287cff=_0x287cff-0x0;var _0x2c6136=_0x2923[_0x287cff];return _0x2c6136;};'use strict';var Sequelize=require(_0x3292('0x0'));module['exports']={'name':{'type':Sequelize[_0x3292('0x1')],'get':function(_0x1b653d){return this[_0x3292('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x3292('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x3292('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x3292('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x3292('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x3292('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x3292('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x3292('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x3292('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x3292('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x3292('0x5')](_0x3292('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x3292('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x3292('0x7'),'defaultValue':Sequelize[_0x3292('0x8')](_0x3292('0x9'))}}; \ No newline at end of file +var _0x920a=['INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue'];(function(_0x1cf7e8,_0x3cea71){var _0x3a9a74=function(_0x4b05ff){while(--_0x4b05ff){_0x1cf7e8['push'](_0x1cf7e8['shift']());}};_0x3a9a74(++_0x3cea71);}(_0x920a,0xcf));var _0xa920=function(_0x2f050f,_0x3961f3){_0x2f050f=_0x2f050f-0x0;var _0x2d3325=_0x920a[_0x2f050f];return _0x2d3325;};'use strict';var Sequelize=require(_0xa920('0x0'));module['exports']={'name':{'type':Sequelize[_0xa920('0x1')],'get':function(_0x2dfa9b){return this[_0xa920('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xa920('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa920('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xa920('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa920('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa920('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xa920('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa920('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xa920('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xa920('0x5')](_0xa920('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xa920('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa920('0x4')],'defaultValue':''},'stamp':{'type':_0xa920('0x7'),'defaultValue':Sequelize[_0xa920('0x8')](_0xa920('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 901f7c2..c084cb4 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 _0xcd15=['mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','VoiceMailMessage','fieldName','type','key','model','differenceBy','keys','query','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','length','include','create','body','find','destroy','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x547af,_0x17abff){var _0x22f7f4=function(_0x5f0384){while(--_0x5f0384){_0x547af['push'](_0x547af['shift']());}};_0x22f7f4(++_0x17abff);}(_0xcd15,0x1b7));var _0x5cd1=function(_0x5575cd,_0x73ab7a){_0x5575cd=_0x5575cd-0x0;var _0x4979a0=_0xcd15[_0x5575cd];return _0x4979a0;};'use strict';var emlformat=require(_0x5cd1('0x0'));var rimraf=require(_0x5cd1('0x1'));var zipdir=require(_0x5cd1('0x2'));var jsonpatch=require(_0x5cd1('0x3'));var rp=require(_0x5cd1('0x4'));var moment=require(_0x5cd1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5cd1('0x6'));var util=require(_0x5cd1('0x7'));var path=require(_0x5cd1('0x8'));var sox=require(_0x5cd1('0x9'));var csv=require(_0x5cd1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5cd1('0xb'));var _=require(_0x5cd1('0xc'));var squel=require(_0x5cd1('0xd'));var crypto=require('crypto');var jsforce=require(_0x5cd1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5cd1('0xf'));var Papa=require('papaparse');var Redis=require(_0x5cd1('0x10'));var authService=require(_0x5cd1('0x11'));var qs=require(_0x5cd1('0x12'));var as=require(_0x5cd1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5cd1('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5cd1('0x15'))['db'];function respondWithStatusCode(_0x5d466c,_0x307d23){_0x307d23=_0x307d23||0xcc;return function(_0x3a5a4b){if(_0x3a5a4b){return _0x5d466c[_0x5cd1('0x16')](_0x307d23);}return _0x5d466c[_0x5cd1('0x17')](_0x307d23)[_0x5cd1('0x18')]();};}function respondWithResult(_0xc22301,_0x4be323){_0x4be323=_0x4be323||0xc8;return function(_0x53269e){if(_0x53269e){return _0xc22301[_0x5cd1('0x17')](_0x4be323)[_0x5cd1('0x19')](_0x53269e);}};}function respondWithFilteredResult(_0x295a94,_0x1fe815){return function(_0x2c5fdf){if(_0x2c5fdf){var _0x1fc344=typeof _0x1fe815[_0x5cd1('0x1a')]===_0x5cd1('0x1b')&&typeof _0x1fe815[_0x5cd1('0x1c')]==='undefined';var _0x4dec02=_0x2c5fdf['count'];var _0x853a93=_0x1fc344?0x0:_0x1fe815['offset'];var _0x467ff7=_0x1fc344?_0x2c5fdf[_0x5cd1('0x1d')]:_0x1fe815[_0x5cd1('0x1a')]+_0x1fe815[_0x5cd1('0x1c')];var _0x421d8a;if(_0x467ff7>=_0x4dec02){_0x467ff7=_0x4dec02;_0x421d8a=0xc8;}else{_0x421d8a=0xce;}_0x295a94[_0x5cd1('0x17')](_0x421d8a);return _0x295a94['set'](_0x5cd1('0x1e'),_0x853a93+'-'+_0x467ff7+'/'+_0x4dec02)[_0x5cd1('0x19')](_0x2c5fdf);}return null;};}function patchUpdates(_0x3a2405){return function(_0x1e80fc){try{jsonpatch[_0x5cd1('0x1f')](_0x1e80fc,_0x3a2405,!![]);}catch(_0x398c37){return BPromise[_0x5cd1('0x20')](_0x398c37);}return _0x1e80fc[_0x5cd1('0x21')]();};}function saveUpdates(_0xc708ac,_0x42b3bf){return function(_0x4ee32d){if(_0x4ee32d){return _0x4ee32d[_0x5cd1('0x22')](_0xc708ac)[_0x5cd1('0x23')](function(_0x17620a){return _0x17620a;});}return null;};}function removeEntity(_0x6da693,_0x346c0f){return function(_0x331cd8){if(_0x331cd8){return _0x331cd8['destroy']()[_0x5cd1('0x23')](function(){_0x6da693['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54c4b9,_0x3387ba){return function(_0x4d0aee){if(!_0x4d0aee){_0x54c4b9[_0x5cd1('0x16')](0x194);}return _0x4d0aee;};}function handleError(_0xb76243,_0x5f5609){_0x5f5609=_0x5f5609||0x1f4;return function(_0x264615){logger[_0x5cd1('0x24')](_0x264615[_0x5cd1('0x25')]);if(_0x264615[_0x5cd1('0x26')]){delete _0x264615[_0x5cd1('0x26')];}_0xb76243[_0x5cd1('0x17')](_0x5f5609)[_0x5cd1('0x27')](_0x264615);};}exports[_0x5cd1('0x28')]=function(_0x3a983d,_0x26d962){var _0x35ab91={},_0x35cd14={},_0x220a9f={'count':0x0,'rows':[]};var _0x1ee602=_[_0x5cd1('0x29')](db[_0x5cd1('0x2a')]['rawAttributes'],function(_0x2aef06){return{'name':_0x2aef06[_0x5cd1('0x2b')],'type':_0x2aef06[_0x5cd1('0x2c')][_0x5cd1('0x2d')]};});_0x35cd14[_0x5cd1('0x2e')]=_[_0x5cd1('0x2f')](_[_0x5cd1('0x29')](_0x1ee602,_0x5cd1('0x26')),[_0x5cd1('0x26')]);_0x35cd14['query']=_[_0x5cd1('0x30')](_0x3a983d[_0x5cd1('0x31')]);_0x35cd14[_0x5cd1('0x32')]=_['intersection'](_0x35cd14['model'],_0x35cd14[_0x5cd1('0x31')]);_0x35ab91[_0x5cd1('0x33')]=_[_0x5cd1('0x34')](_0x35cd14[_0x5cd1('0x2e')],qs['fields'](_0x3a983d[_0x5cd1('0x31')]['fields']));_0x35ab91['attributes']=_0x35ab91['attributes']['length']?_0x35ab91[_0x5cd1('0x33')]:_0x35cd14[_0x5cd1('0x2e')];if(!_0x3a983d[_0x5cd1('0x31')][_0x5cd1('0x35')](_0x5cd1('0x36'))){_0x35ab91[_0x5cd1('0x1c')]=qs[_0x5cd1('0x1c')](_0x3a983d[_0x5cd1('0x31')][_0x5cd1('0x1c')]);_0x35ab91[_0x5cd1('0x1a')]=qs[_0x5cd1('0x1a')](_0x3a983d[_0x5cd1('0x31')]['offset']);}_0x35ab91[_0x5cd1('0x37')]=qs['sort'](_0x3a983d[_0x5cd1('0x31')][_0x5cd1('0x38')]);_0x35ab91['where']=qs[_0x5cd1('0x32')](_[_0x5cd1('0x39')](_0x3a983d[_0x5cd1('0x31')],_0x35cd14['filters']),_0x1ee602);if(_0x3a983d[_0x5cd1('0x31')][_0x5cd1('0x3a')]){_0x35ab91[_0x5cd1('0x3b')]=_[_0x5cd1('0x3c')](_0x35ab91[_0x5cd1('0x3b')],{'$or':_['map'](_0x1ee602,function(_0x481f73){if(_0x481f73[_0x5cd1('0x2c')]!==_0x5cd1('0x3d')){var _0x5bebf6={};_0x5bebf6[_0x481f73['name']]={'$like':'%'+_0x3a983d[_0x5cd1('0x31')]['filter']+'%'};return _0x5bebf6;}})});}_0x35ab91=_['merge']({},_0x35ab91,_0x3a983d[_0x5cd1('0x3e')]);var _0x2067f0={'where':_0x35ab91[_0x5cd1('0x3b')]};return db[_0x5cd1('0x2a')][_0x5cd1('0x1d')](_0x2067f0)['then'](function(_0x331084){_0x220a9f[_0x5cd1('0x1d')]=_0x331084;if(_0x3a983d[_0x5cd1('0x31')][_0x5cd1('0x3f')]){_0x35ab91['include']=[{'all':!![]}];}return db[_0x5cd1('0x2a')][_0x5cd1('0x40')](_0x35ab91);})[_0x5cd1('0x23')](function(_0x1a527c){_0x220a9f[_0x5cd1('0x41')]=_0x1a527c;return _0x220a9f;})['then'](respondWithFilteredResult(_0x26d962,_0x35ab91))[_0x5cd1('0x42')](handleError(_0x26d962,null));};exports[_0x5cd1('0x43')]=function(_0x34883f,_0x26ae39){var _0x424eb8={'raw':!![],'where':{'id':_0x34883f[_0x5cd1('0x44')]['id']}},_0x3bcec7={};_0x3bcec7[_0x5cd1('0x2e')]=_[_0x5cd1('0x30')](db[_0x5cd1('0x2a')][_0x5cd1('0x45')]);_0x3bcec7[_0x5cd1('0x31')]=_[_0x5cd1('0x30')](_0x34883f['query']);_0x3bcec7[_0x5cd1('0x32')]=_[_0x5cd1('0x34')](_0x3bcec7[_0x5cd1('0x2e')],_0x3bcec7[_0x5cd1('0x31')]);_0x424eb8[_0x5cd1('0x33')]=_[_0x5cd1('0x34')](_0x3bcec7[_0x5cd1('0x2e')],qs[_0x5cd1('0x46')](_0x34883f[_0x5cd1('0x31')][_0x5cd1('0x46')]));_0x424eb8[_0x5cd1('0x33')]=_0x424eb8[_0x5cd1('0x33')][_0x5cd1('0x47')]?_0x424eb8[_0x5cd1('0x33')]:_0x3bcec7['model'];if(_0x34883f[_0x5cd1('0x31')][_0x5cd1('0x3f')]){_0x424eb8[_0x5cd1('0x48')]=[{'all':!![]}];}_0x424eb8=_[_0x5cd1('0x3c')]({},_0x424eb8,_0x34883f[_0x5cd1('0x3e')]);return db[_0x5cd1('0x2a')]['find'](_0x424eb8)['then'](handleEntityNotFound(_0x26ae39,null))[_0x5cd1('0x23')](respondWithResult(_0x26ae39,null))[_0x5cd1('0x42')](handleError(_0x26ae39,null));};exports[_0x5cd1('0x49')]=function(_0xdfcd9,_0x55093b){return db[_0x5cd1('0x2a')]['create'](_0xdfcd9['body'],{})[_0x5cd1('0x23')](respondWithResult(_0x55093b,0xc9))[_0x5cd1('0x42')](handleError(_0x55093b,null));};exports['update']=function(_0x9d7883,_0x524913){if(_0x9d7883[_0x5cd1('0x4a')]['id']){delete _0x9d7883[_0x5cd1('0x4a')]['id'];}return db[_0x5cd1('0x2a')][_0x5cd1('0x4b')]({'where':{'id':_0x9d7883[_0x5cd1('0x44')]['id']}})[_0x5cd1('0x23')](handleEntityNotFound(_0x524913,null))['then'](saveUpdates(_0x9d7883[_0x5cd1('0x4a')],null))[_0x5cd1('0x23')](respondWithResult(_0x524913,null))[_0x5cd1('0x42')](handleError(_0x524913,null));};exports[_0x5cd1('0x4c')]=function(_0x2ef79d,_0x2b5a0e){return db['VoiceMailMessage'][_0x5cd1('0x4b')]({'where':{'id':_0x2ef79d[_0x5cd1('0x44')]['id']}})[_0x5cd1('0x23')](handleEntityNotFound(_0x2b5a0e,null))[_0x5cd1('0x23')](removeEntity(_0x2b5a0e,null))['catch'](handleError(_0x2b5a0e,null));};exports[_0x5cd1('0x4d')]=function(_0x5827c5,_0x4ec229,_0x3a8d27){return db[_0x5cd1('0x2a')]['find']({'where':{'id':_0x5827c5[_0x5cd1('0x44')]['id']},'attributes':['id',_0x5cd1('0x4e'),_0x5cd1('0x4f')]})[_0x5cd1('0x23')](handleEntityNotFound(_0x4ec229,null))[_0x5cd1('0x23')](function(_0x26975a){if(_0x26975a){if(!_0x26975a[_0x5cd1('0x4e')]){throw new db[(_0x5cd1('0x50'))][(_0x5cd1('0x51'))](_0x5cd1('0x52'));}var _0x321f12={'Content-Type':_0x5cd1('0x53'),'Content-Disposition':_0x5cd1('0x54')};if(_0x26975a[_0x5cd1('0x4f')]){_0x321f12[_0x5cd1('0x55')]=_0x5cd1('0x56')+_0x26975a['msg_id']+_0x5cd1('0x57');}_0x4ec229[_0x5cd1('0x58')](_0x321f12);return _0x4ec229[_0x5cd1('0x27')](new Buffer(_0x26975a['recording']));}})[_0x5cd1('0x42')](handleError(_0x4ec229,null));}; \ No newline at end of file +var _0x5469=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','stack','name','send','index','VoiceMailMessage','fieldName','type','key','model','differenceBy','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','map','VIRTUAL','includeAll','include','catch','show','params','options','find','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5469,0x9b));var _0x9546=function(_0x223c0d,_0x3ec04d){_0x223c0d=_0x223c0d-0x0;var _0x207827=_0x5469[_0x223c0d];return _0x207827;};'use strict';var emlformat=require(_0x9546('0x0'));var rimraf=require(_0x9546('0x1'));var zipdir=require(_0x9546('0x2'));var jsonpatch=require(_0x9546('0x3'));var rp=require(_0x9546('0x4'));var moment=require(_0x9546('0x5'));var BPromise=require(_0x9546('0x6'));var Mustache=require(_0x9546('0x7'));var util=require(_0x9546('0x8'));var path=require(_0x9546('0x9'));var sox=require(_0x9546('0xa'));var csv=require('to-csv');var ejs=require(_0x9546('0xb'));var fs=require('fs');var fs_extra=require(_0x9546('0xc'));var _=require('lodash');var squel=require(_0x9546('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9546('0xe'));var toCsv=require(_0x9546('0xf'));var querystring=require(_0x9546('0x10'));var Papa=require(_0x9546('0x11'));var Redis=require(_0x9546('0x12'));var authService=require(_0x9546('0x13'));var qs=require(_0x9546('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9546('0x15'));var logger=require(_0x9546('0x16'))(_0x9546('0x17'));var utils=require(_0x9546('0x18'));var config=require(_0x9546('0x19'));var licenseUtil=require(_0x9546('0x1a'));var db=require(_0x9546('0x1b'))['db'];function respondWithStatusCode(_0x5ea552,_0x2cf2c4){_0x2cf2c4=_0x2cf2c4||0xcc;return function(_0x26095f){if(_0x26095f){return _0x5ea552[_0x9546('0x1c')](_0x2cf2c4);}return _0x5ea552['status'](_0x2cf2c4)['end']();};}function respondWithResult(_0x2f5049,_0x2f7654){_0x2f7654=_0x2f7654||0xc8;return function(_0x12be00){if(_0x12be00){return _0x2f5049[_0x9546('0x1d')](_0x2f7654)[_0x9546('0x1e')](_0x12be00);}};}function respondWithFilteredResult(_0x51985e,_0x48866d){return function(_0x296569){if(_0x296569){var _0x29a22b=typeof _0x48866d[_0x9546('0x1f')]==='undefined'&&typeof _0x48866d[_0x9546('0x20')]===_0x9546('0x21');var _0x2d9ad3=_0x296569[_0x9546('0x22')];var _0x1ab0ab=_0x29a22b?0x0:_0x48866d[_0x9546('0x1f')];var _0x2b355d=_0x29a22b?_0x296569[_0x9546('0x22')]:_0x48866d['offset']+_0x48866d[_0x9546('0x20')];var _0x446110;if(_0x2b355d>=_0x2d9ad3){_0x2b355d=_0x2d9ad3;_0x446110=0xc8;}else{_0x446110=0xce;}_0x51985e[_0x9546('0x1d')](_0x446110);return _0x51985e[_0x9546('0x23')]('Content-Range',_0x1ab0ab+'-'+_0x2b355d+'/'+_0x2d9ad3)['json'](_0x296569);}return null;};}function patchUpdates(_0x22830e){return function(_0x4f6e65){try{jsonpatch[_0x9546('0x24')](_0x4f6e65,_0x22830e,!![]);}catch(_0x259b6d){return BPromise['reject'](_0x259b6d);}return _0x4f6e65[_0x9546('0x25')]();};}function saveUpdates(_0x2a85ad,_0x42666b){return function(_0x363ed1){if(_0x363ed1){return _0x363ed1[_0x9546('0x26')](_0x2a85ad)[_0x9546('0x27')](function(_0x3d584b){return _0x3d584b;});}return null;};}function removeEntity(_0x19dc98,_0x3630ce){return function(_0x50e129){if(_0x50e129){return _0x50e129[_0x9546('0x28')]()[_0x9546('0x27')](function(){_0x19dc98['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1329c7,_0x43e41c){return function(_0x44c0cd){if(!_0x44c0cd){_0x1329c7[_0x9546('0x1c')](0x194);}return _0x44c0cd;};}function handleError(_0x101423,_0x5911e8){_0x5911e8=_0x5911e8||0x1f4;return function(_0x524238){logger[_0x9546('0x29')](_0x524238[_0x9546('0x2a')]);if(_0x524238[_0x9546('0x2b')]){delete _0x524238[_0x9546('0x2b')];}_0x101423[_0x9546('0x1d')](_0x5911e8)[_0x9546('0x2c')](_0x524238);};}exports[_0x9546('0x2d')]=function(_0x40f0d2,_0x44f236){var _0x4f75be={},_0x1b875c={},_0x2bb0ac={'count':0x0,'rows':[]};var _0x1652cc=_['map'](db[_0x9546('0x2e')]['rawAttributes'],function(_0x1871f6){return{'name':_0x1871f6[_0x9546('0x2f')],'type':_0x1871f6[_0x9546('0x30')][_0x9546('0x31')]};});_0x1b875c[_0x9546('0x32')]=_[_0x9546('0x33')](_['map'](_0x1652cc,_0x9546('0x2b')),['name']);_0x1b875c[_0x9546('0x34')]=_[_0x9546('0x35')](_0x40f0d2['query']);_0x1b875c['filters']=_[_0x9546('0x36')](_0x1b875c[_0x9546('0x32')],_0x1b875c['query']);_0x4f75be['attributes']=_[_0x9546('0x36')](_0x1b875c[_0x9546('0x32')],qs[_0x9546('0x37')](_0x40f0d2[_0x9546('0x34')]['fields']));_0x4f75be[_0x9546('0x38')]=_0x4f75be[_0x9546('0x38')]['length']?_0x4f75be[_0x9546('0x38')]:_0x1b875c[_0x9546('0x32')];if(!_0x40f0d2['query'][_0x9546('0x39')](_0x9546('0x3a'))){_0x4f75be[_0x9546('0x20')]=qs[_0x9546('0x20')](_0x40f0d2['query'][_0x9546('0x20')]);_0x4f75be[_0x9546('0x1f')]=qs[_0x9546('0x1f')](_0x40f0d2['query'][_0x9546('0x1f')]);}_0x4f75be['order']=qs[_0x9546('0x3b')](_0x40f0d2['query'][_0x9546('0x3b')]);_0x4f75be['where']=qs[_0x9546('0x3c')](_[_0x9546('0x3d')](_0x40f0d2['query'],_0x1b875c[_0x9546('0x3c')]),_0x1652cc);if(_0x40f0d2[_0x9546('0x34')][_0x9546('0x3e')]){_0x4f75be['where']=_[_0x9546('0x3f')](_0x4f75be[_0x9546('0x40')],{'$or':_[_0x9546('0x41')](_0x1652cc,function(_0x731ace){if(_0x731ace[_0x9546('0x30')]!==_0x9546('0x42')){var _0xd19960={};_0xd19960[_0x731ace[_0x9546('0x2b')]]={'$like':'%'+_0x40f0d2[_0x9546('0x34')][_0x9546('0x3e')]+'%'};return _0xd19960;}})});}_0x4f75be=_[_0x9546('0x3f')]({},_0x4f75be,_0x40f0d2['options']);var _0x53b133={'where':_0x4f75be['where']};return db['VoiceMailMessage'][_0x9546('0x22')](_0x53b133)[_0x9546('0x27')](function(_0x1d5929){_0x2bb0ac['count']=_0x1d5929;if(_0x40f0d2[_0x9546('0x34')][_0x9546('0x43')]){_0x4f75be[_0x9546('0x44')]=[{'all':!![]}];}return db[_0x9546('0x2e')]['findAll'](_0x4f75be);})['then'](function(_0x2f272e){_0x2bb0ac['rows']=_0x2f272e;return _0x2bb0ac;})[_0x9546('0x27')](respondWithFilteredResult(_0x44f236,_0x4f75be))[_0x9546('0x45')](handleError(_0x44f236,null));};exports[_0x9546('0x46')]=function(_0x4b23ce,_0x184d72){var _0x5f3645={'raw':!![],'where':{'id':_0x4b23ce[_0x9546('0x47')]['id']}},_0x3fc0c0={};_0x3fc0c0['model']=_['keys'](db[_0x9546('0x2e')]['rawAttributes']);_0x3fc0c0[_0x9546('0x34')]=_['keys'](_0x4b23ce[_0x9546('0x34')]);_0x3fc0c0[_0x9546('0x3c')]=_[_0x9546('0x36')](_0x3fc0c0[_0x9546('0x32')],_0x3fc0c0[_0x9546('0x34')]);_0x5f3645[_0x9546('0x38')]=_['intersection'](_0x3fc0c0[_0x9546('0x32')],qs[_0x9546('0x37')](_0x4b23ce[_0x9546('0x34')][_0x9546('0x37')]));_0x5f3645[_0x9546('0x38')]=_0x5f3645[_0x9546('0x38')]['length']?_0x5f3645[_0x9546('0x38')]:_0x3fc0c0[_0x9546('0x32')];if(_0x4b23ce[_0x9546('0x34')]['includeAll']){_0x5f3645[_0x9546('0x44')]=[{'all':!![]}];}_0x5f3645=_[_0x9546('0x3f')]({},_0x5f3645,_0x4b23ce[_0x9546('0x48')]);return db[_0x9546('0x2e')][_0x9546('0x49')](_0x5f3645)[_0x9546('0x27')](handleEntityNotFound(_0x184d72,null))[_0x9546('0x27')](respondWithResult(_0x184d72,null))['catch'](handleError(_0x184d72,null));};exports[_0x9546('0x4a')]=function(_0x492cb1,_0x309755){return db[_0x9546('0x2e')]['create'](_0x492cb1[_0x9546('0x4b')],{})[_0x9546('0x27')](respondWithResult(_0x309755,0xc9))[_0x9546('0x45')](handleError(_0x309755,null));};exports[_0x9546('0x26')]=function(_0x330593,_0x4d35e8){if(_0x330593[_0x9546('0x4b')]['id']){delete _0x330593[_0x9546('0x4b')]['id'];}return db[_0x9546('0x2e')][_0x9546('0x49')]({'where':{'id':_0x330593[_0x9546('0x47')]['id']}})[_0x9546('0x27')](handleEntityNotFound(_0x4d35e8,null))[_0x9546('0x27')](saveUpdates(_0x330593['body'],null))[_0x9546('0x27')](respondWithResult(_0x4d35e8,null))['catch'](handleError(_0x4d35e8,null));};exports['destroy']=function(_0x22bd94,_0xb6ea67){return db[_0x9546('0x2e')][_0x9546('0x49')]({'where':{'id':_0x22bd94[_0x9546('0x47')]['id']}})[_0x9546('0x27')](handleEntityNotFound(_0xb6ea67,null))['then'](removeEntity(_0xb6ea67,null))[_0x9546('0x45')](handleError(_0xb6ea67,null));};exports[_0x9546('0x4c')]=function(_0x1b7719,_0x5be4a7,_0x2caae1){return db[_0x9546('0x2e')]['find']({'where':{'id':_0x1b7719[_0x9546('0x47')]['id']},'attributes':['id',_0x9546('0x4d'),_0x9546('0x4e')]})[_0x9546('0x27')](handleEntityNotFound(_0x5be4a7,null))[_0x9546('0x27')](function(_0x49ef2d){if(_0x49ef2d){if(!_0x49ef2d[_0x9546('0x4d')]){throw new db[(_0x9546('0x4f'))][(_0x9546('0x50'))](_0x9546('0x51'));}var _0x225fc2={'Content-Type':_0x9546('0x52'),'Content-Disposition':'attachment'};if(_0x49ef2d['msg_id']){_0x225fc2[_0x9546('0x53')]=_0x9546('0x54')+_0x49ef2d[_0x9546('0x4e')]+_0x9546('0x55');}_0x5be4a7[_0x9546('0x23')](_0x225fc2);return _0x5be4a7['send'](new Buffer(_0x49ef2d[_0x9546('0x4d')]));}})[_0x9546('0x45')](handleError(_0x5be4a7,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index af797dc..bb286b7 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 _0x0138=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','dir','util'];(function(_0x33e309,_0x3a0efb){var _0x326f94=function(_0x9d2546){while(--_0x9d2546){_0x33e309['push'](_0x33e309['shift']());}};_0x326f94(++_0x3a0efb);}(_0x0138,0x16a));var _0x8013=function(_0x1d9333,_0x2a9349){_0x1d9333=_0x1d9333-0x0;var _0x2ac128=_0x0138[_0x1d9333];return _0x2ac128;};'use strict';var _=require('lodash');var util=require(_0x8013('0x0'));var logger=require(_0x8013('0x1'))(_0x8013('0x2'));var moment=require('moment');var BPromise=require(_0x8013('0x3'));var rp=require(_0x8013('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8013('0x5'));var config=require(_0x8013('0x6'));var attributes=require(_0x8013('0x7'));module[_0x8013('0x8')]=function(_0x494980,_0x4d2545){return _0x494980[_0x8013('0x9')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x8013('0xa'),'fields':[_0x8013('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x3129=['lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','dir'];(function(_0x1f62c3,_0x1ff95b){var _0x385c1c=function(_0x1db580){while(--_0x1db580){_0x1f62c3['push'](_0x1f62c3['shift']());}};_0x385c1c(++_0x1ff95b);}(_0x3129,0xf2));var _0x9312=function(_0x587e9b,_0x19ea16){_0x587e9b=_0x587e9b-0x0;var _0x501263=_0x3129[_0x587e9b];return _0x501263;};'use strict';var _=require(_0x9312('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9312('0x1'));var moment=require(_0x9312('0x2'));var BPromise=require(_0x9312('0x3'));var rp=require(_0x9312('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9312('0x5'));var config=require(_0x9312('0x6'));var attributes=require(_0x9312('0x7'));module[_0x9312('0x8')]=function(_0x3c1a6e,_0x5e3665){return _0x3c1a6e[_0x9312('0x9')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x9312('0xa'),'fields':[_0x9312('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index cb4a298..bdf026b 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 _0xd7b5=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0xd129ce,_0x3faef0){var _0x2c5e6e=function(_0x4c52fb){while(--_0x4c52fb){_0xd129ce['push'](_0xd129ce['shift']());}};_0x2c5e6e(++_0x3faef0);}(_0xd7b5,0x17e));var _0x5d7b=function(_0x4ea36c,_0x3807d1){_0x4ea36c=_0x4ea36c-0x0;var _0x1f9007=_0xd7b5[_0x4ea36c];return _0x1f9007;};'use strict';var _=require(_0x5d7b('0x0'));var util=require(_0x5d7b('0x1'));var moment=require(_0x5d7b('0x2'));var BPromise=require(_0x5d7b('0x3'));var rs=require(_0x5d7b('0x4'));var fs=require('fs');var Redis=require(_0x5d7b('0x5'));var db=require(_0x5d7b('0x6'))['db'];var utils=require(_0x5d7b('0x7'));var logger=require(_0x5d7b('0x8'))(_0x5d7b('0x9'));var config=require(_0x5d7b('0xa'));var jayson=require(_0x5d7b('0xb'));var client=jayson[_0x5d7b('0xc')][_0x5d7b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x35125,_0x3cc012,_0x3cfe81){return new BPromise(function(_0x12d706,_0x23f6cd){return client['request'](_0x35125,_0x3cfe81)['then'](function(_0x5153f5){logger[_0x5d7b('0xe')](_0x5d7b('0xf'),_0x3cc012,_0x5d7b('0x10'));logger[_0x5d7b('0x11')](_0x5d7b('0x12'),_0x3cc012,'request\x20sent',JSON[_0x5d7b('0x13')](_0x5153f5));if(_0x5153f5[_0x5d7b('0x14')]){if(_0x5153f5[_0x5d7b('0x14')]['code']===0x1f4){logger[_0x5d7b('0x14')](_0x5d7b('0xf'),_0x3cc012,_0x5153f5[_0x5d7b('0x14')]['message']);return _0x23f6cd(_0x5153f5[_0x5d7b('0x14')][_0x5d7b('0x15')]);}logger[_0x5d7b('0x14')](_0x5d7b('0xf'),_0x3cc012,_0x5153f5[_0x5d7b('0x14')][_0x5d7b('0x15')]);return _0x12d706(_0x5153f5[_0x5d7b('0x14')][_0x5d7b('0x15')]);}else{logger[_0x5d7b('0xe')](_0x5d7b('0xf'),_0x3cc012,_0x5d7b('0x10'));_0x12d706(_0x5153f5[_0x5d7b('0x16')][_0x5d7b('0x15')]);}})[_0x5d7b('0x17')](function(_0x445808){logger[_0x5d7b('0x14')](_0x5d7b('0xf'),_0x3cc012,_0x445808);_0x23f6cd(_0x445808);});});} \ No newline at end of file +var _0xbd07=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x195977,_0x2fb479){var _0x16b370=function(_0x3556a4){while(--_0x3556a4){_0x195977['push'](_0x195977['shift']());}};_0x16b370(++_0x2fb479);}(_0xbd07,0x72));var _0x7bd0=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xbd07[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x7bd0('0x0'));var util=require('util');var moment=require(_0x7bd0('0x1'));var BPromise=require(_0x7bd0('0x2'));var rs=require(_0x7bd0('0x3'));var fs=require('fs');var Redis=require(_0x7bd0('0x4'));var db=require(_0x7bd0('0x5'))['db'];var utils=require(_0x7bd0('0x6'));var logger=require(_0x7bd0('0x7'))(_0x7bd0('0x8'));var config=require('../../config/environment');var jayson=require(_0x7bd0('0x9'));var client=jayson[_0x7bd0('0xa')][_0x7bd0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27ae0a,_0x5b2114,_0x437b56){return new BPromise(function(_0x4c505f,_0x1d0c53){return client[_0x7bd0('0xc')](_0x27ae0a,_0x437b56)['then'](function(_0x1fbf6f){logger[_0x7bd0('0xd')](_0x7bd0('0xe'),_0x5b2114,_0x7bd0('0xf'));logger[_0x7bd0('0x10')](_0x7bd0('0x11'),_0x5b2114,_0x7bd0('0xf'),JSON['stringify'](_0x1fbf6f));if(_0x1fbf6f['error']){if(_0x1fbf6f[_0x7bd0('0x12')][_0x7bd0('0x13')]===0x1f4){logger[_0x7bd0('0x12')](_0x7bd0('0xe'),_0x5b2114,_0x1fbf6f['error']['message']);return _0x1d0c53(_0x1fbf6f[_0x7bd0('0x12')][_0x7bd0('0x14')]);}logger['error'](_0x7bd0('0xe'),_0x5b2114,_0x1fbf6f[_0x7bd0('0x12')][_0x7bd0('0x14')]);return _0x4c505f(_0x1fbf6f['error'][_0x7bd0('0x14')]);}else{logger[_0x7bd0('0xd')](_0x7bd0('0xe'),_0x5b2114,_0x7bd0('0xf'));_0x4c505f(_0x1fbf6f[_0x7bd0('0x15')][_0x7bd0('0x14')]);}})[_0x7bd0('0x16')](function(_0x2b40d7){logger[_0x7bd0('0x12')](_0x7bd0('0xe'),_0x5b2114,_0x2b40d7);_0x1d0c53(_0x2b40d7);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 299ebf9..cc2dbd7 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 _0x1113=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/sounds','getSounds','post','addSound','put','delete','destroy','/:id/sounds/:id2','removeSound','multer'];(function(_0x3cdcbe,_0x450f7b){var _0x5846a1=function(_0x5d2030){while(--_0x5d2030){_0x3cdcbe['push'](_0x3cdcbe['shift']());}};_0x5846a1(++_0x450f7b);}(_0x1113,0x149));var _0x3111=function(_0x3acb67,_0xbe0faa){_0x3acb67=_0x3acb67-0x0;var _0x534936=_0x1113[_0x3acb67];return _0x534936;};'use strict';var multer=require(_0x3111('0x0'));var util=require(_0x3111('0x1'));var path=require(_0x3111('0x2'));var timeout=require(_0x3111('0x3'));var express=require(_0x3111('0x4'));var router=express[_0x3111('0x5')]();var fs_extra=require(_0x3111('0x6'));var auth=require(_0x3111('0x7'));var interaction=require(_0x3111('0x8'));var config=require(_0x3111('0x9'));var controller=require('./voiceMusicOnHold.controller');router[_0x3111('0xa')]('/',auth[_0x3111('0xb')](),controller['index']);router[_0x3111('0xa')](_0x3111('0xc'),auth[_0x3111('0xb')](),controller['show']);router[_0x3111('0xa')](_0x3111('0xd'),auth[_0x3111('0xb')](),controller[_0x3111('0xe')]);router[_0x3111('0xf')]('/',auth[_0x3111('0xb')](),controller['create']);router[_0x3111('0xf')](_0x3111('0xd'),auth['isAuthenticated'](),controller[_0x3111('0x10')]);router[_0x3111('0x11')](_0x3111('0xc'),auth[_0x3111('0xb')](),controller['update']);router[_0x3111('0x12')]('/:id',auth[_0x3111('0xb')](),controller[_0x3111('0x13')]);router['delete'](_0x3111('0x14'),auth['isAuthenticated'](),controller[_0x3111('0x15')]);module['exports']=router; \ No newline at end of file +var _0xd807=['./voiceMusicOnHold.controller','index','get','/:id','isAuthenticated','show','/:id/sounds','getSounds','post','create','addSound','put','update','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x193679,_0x293d83){var _0x221192=function(_0x18c65a){while(--_0x18c65a){_0x193679['push'](_0x193679['shift']());}};_0x221192(++_0x293d83);}(_0xd807,0x188));var _0x7d80=function(_0x208e77,_0x2af1ee){_0x208e77=_0x208e77-0x0;var _0x4d1153=_0xd807[_0x208e77];return _0x4d1153;};'use strict';var multer=require(_0x7d80('0x0'));var util=require(_0x7d80('0x1'));var path=require(_0x7d80('0x2'));var timeout=require(_0x7d80('0x3'));var express=require(_0x7d80('0x4'));var router=express[_0x7d80('0x5')]();var fs_extra=require(_0x7d80('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7d80('0x7'));var controller=require(_0x7d80('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7d80('0x9')]);router[_0x7d80('0xa')](_0x7d80('0xb'),auth[_0x7d80('0xc')](),controller[_0x7d80('0xd')]);router[_0x7d80('0xa')](_0x7d80('0xe'),auth[_0x7d80('0xc')](),controller[_0x7d80('0xf')]);router[_0x7d80('0x10')]('/',auth[_0x7d80('0xc')](),controller[_0x7d80('0x11')]);router[_0x7d80('0x10')]('/:id/sounds',auth['isAuthenticated'](),controller[_0x7d80('0x12')]);router[_0x7d80('0x13')](_0x7d80('0xb'),auth[_0x7d80('0xc')](),controller[_0x7d80('0x14')]);router['delete'](_0x7d80('0xb'),auth[_0x7d80('0xc')](),controller[_0x7d80('0x15')]);router['delete'](_0x7d80('0x16'),auth[_0x7d80('0xc')](),controller[_0x7d80('0x17')]);module[_0x7d80('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 4810632..8bf0785 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 _0xaf9d=['BOOLEAN','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3','mp3','alpha'];(function(_0x58381c,_0x3b9374){var _0x1a7440=function(_0x2bc7f1){while(--_0x2bc7f1){_0x58381c['push'](_0x58381c['shift']());}};_0x1a7440(++_0x3b9374);}(_0xaf9d,0x64));var _0xdaf9=function(_0x58716f,_0x3be8ea){_0x58716f=_0x58716f-0x0;var _0x41325c=_0xaf9d[_0x58716f];return _0x41325c;};'use strict';var Sequelize=require('sequelize');module[_0xdaf9('0x0')]={'name':{'type':Sequelize[_0xdaf9('0x1')],'allowNull':![],'unique':_0xdaf9('0x2')},'mode':{'type':Sequelize[_0xdaf9('0x3')](_0xdaf9('0x4'),_0xdaf9('0x5'),_0xdaf9('0x6'),'quietmp3nb',_0xdaf9('0x7'),_0xdaf9('0x8')),'allowNull':!![],'defaultValue':_0xdaf9('0x5')},'directory':{'type':Sequelize[_0xdaf9('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0xdaf9('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xdaf9('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xdaf9('0x1')],'allowNull':!![],'defaultValue':_0xdaf9('0x9')},'format':{'type':Sequelize[_0xdaf9('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xdaf9('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x75e7=['quietmp3nb','quietmp3','mp3','STRING','TIMESTAMP','BOOLEAN','sequelize','exports','ENUM','custom','files','mp3nb'];(function(_0x596dcc,_0x5b952d){var _0x405f75=function(_0x2ec358){while(--_0x2ec358){_0x596dcc['push'](_0x596dcc['shift']());}};_0x405f75(++_0x5b952d);}(_0x75e7,0x1b6));var _0x775e=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x75e7[_0x1030ce];return _0x3367fd;};'use strict';var Sequelize=require(_0x775e('0x0'));module[_0x775e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x775e('0x2')](_0x775e('0x3'),_0x775e('0x4'),_0x775e('0x5'),_0x775e('0x6'),_0x775e('0x7'),_0x775e('0x8')),'allowNull':!![],'defaultValue':_0x775e('0x4')},'directory':{'type':Sequelize[_0x775e('0x9')],'allowNull':!![]},'application':{'type':Sequelize[_0x775e('0x9')],'allowNull':!![]},'digit':{'type':Sequelize[_0x775e('0x9')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x775e('0xa')},'defaultEntry':{'type':Sequelize[_0x775e('0xb')],'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 3f3ce2c..51caed8 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 _0x9a92=['rows','catch','show','rawAttributes','includeAll','body','find','params','create','sequelize','transaction','mode','directory','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt','join','root','server/files/sounds/converted','format','extname','server/files/moh','%s.%s','symlinkSync','removeSound','id2','getSounds','Sound','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','set','Content-Range','save','then','get','MusicOnHolds','UserProfileResource','destroy','sendStatus','error','stack','name','map','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','VoiceMusicOnHold','findAll'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9a92,0x1e2));var _0x29a9=function(_0x1254d9,_0x1860a3){_0x1254d9=_0x1254d9-0x0;var _0xd37e6f=_0x9a92[_0x1254d9];return _0xd37e6f;};'use strict';var emlformat=require(_0x29a9('0x0'));var rimraf=require(_0x29a9('0x1'));var zipdir=require(_0x29a9('0x2'));var jsonpatch=require(_0x29a9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x29a9('0x4'));var util=require(_0x29a9('0x5'));var path=require(_0x29a9('0x6'));var sox=require('sox');var csv=require(_0x29a9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x29a9('0x8'));var squel=require(_0x29a9('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x29a9('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x29a9('0xb'));var Redis=require(_0x29a9('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x29a9('0xd'));var hardwareService=require(_0x29a9('0xe'));var logger=require(_0x29a9('0xf'))(_0x29a9('0x10'));var utils=require(_0x29a9('0x11'));var config=require(_0x29a9('0x12'));var licenseUtil=require(_0x29a9('0x13'));var db=require(_0x29a9('0x14'))['db'];function respondWithStatusCode(_0x40aa64,_0x3ea1d8){_0x3ea1d8=_0x3ea1d8||0xcc;return function(_0x10ef0b){if(_0x10ef0b){return _0x40aa64['sendStatus'](_0x3ea1d8);}return _0x40aa64[_0x29a9('0x15')](_0x3ea1d8)[_0x29a9('0x16')]();};}function respondWithResult(_0x2bd291,_0x5280f0){_0x5280f0=_0x5280f0||0xc8;return function(_0x214c86){if(_0x214c86){return _0x2bd291[_0x29a9('0x15')](_0x5280f0)[_0x29a9('0x17')](_0x214c86);}};}function respondWithFilteredResult(_0x3d8be7,_0xc3c70c){return function(_0x41e9b9){if(_0x41e9b9){var _0x167a9f=typeof _0xc3c70c['offset']===_0x29a9('0x18')&&typeof _0xc3c70c[_0x29a9('0x19')]===_0x29a9('0x18');var _0x3e4375=_0x41e9b9['count'];var _0x1832e1=_0x167a9f?0x0:_0xc3c70c[_0x29a9('0x1a')];var _0x192ff0=_0x167a9f?_0x41e9b9['count']:_0xc3c70c[_0x29a9('0x1a')]+_0xc3c70c['limit'];var _0x459ed8;if(_0x192ff0>=_0x3e4375){_0x192ff0=_0x3e4375;_0x459ed8=0xc8;}else{_0x459ed8=0xce;}_0x3d8be7[_0x29a9('0x15')](_0x459ed8);return _0x3d8be7[_0x29a9('0x1b')](_0x29a9('0x1c'),_0x1832e1+'-'+_0x192ff0+'/'+_0x3e4375)[_0x29a9('0x17')](_0x41e9b9);}return null;};}function patchUpdates(_0xac7df0){return function(_0x166cf2){try{jsonpatch['apply'](_0x166cf2,_0xac7df0,!![]);}catch(_0x28b1aa){return BPromise['reject'](_0x28b1aa);}return _0x166cf2[_0x29a9('0x1d')]();};}function saveUpdates(_0x5db17c,_0x72c407){return function(_0x290613){if(_0x290613){return _0x290613['update'](_0x5db17c)['then'](function(_0x431a4b){return _0x431a4b;});}return null;};}function removeEntity(_0x4e3e1d,_0x395d8d){return function(_0x421f21){if(_0x421f21){return _0x421f21['destroy']()[_0x29a9('0x1e')](function(){var _0x1f2e4b=_0x421f21[_0x29a9('0x1f')]({'plain':!![]});var _0x4904c1=_0x29a9('0x20');return db[_0x29a9('0x21')][_0x29a9('0x22')]({'where':{'type':_0x4904c1,'resourceId':_0x1f2e4b['id']}})[_0x29a9('0x1e')](function(){return _0x421f21;});})['then'](function(){_0x4e3e1d[_0x29a9('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53a965,_0x42c764){return function(_0x2a8a91){if(!_0x2a8a91){_0x53a965[_0x29a9('0x23')](0x194);}return _0x2a8a91;};}function handleError(_0x42364b,_0x1558d7){_0x1558d7=_0x1558d7||0x1f4;return function(_0x2e1053){logger[_0x29a9('0x24')](_0x2e1053[_0x29a9('0x25')]);if(_0x2e1053['name']){delete _0x2e1053[_0x29a9('0x26')];}_0x42364b['status'](_0x1558d7)['send'](_0x2e1053);};}exports['index']=function(_0x902f69,_0x454de6){var _0x31d970={},_0x1d4d00={},_0x59a184={'count':0x0,'rows':[]};var _0x56bdc4=_[_0x29a9('0x27')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x4aa2b1){return{'name':_0x4aa2b1['fieldName'],'type':_0x4aa2b1[_0x29a9('0x28')][_0x29a9('0x29')]};});_0x1d4d00[_0x29a9('0x2a')]=_[_0x29a9('0x27')](_0x56bdc4,_0x29a9('0x26'));_0x1d4d00[_0x29a9('0x2b')]=_[_0x29a9('0x2c')](_0x902f69[_0x29a9('0x2b')]);_0x1d4d00['filters']=_['intersection'](_0x1d4d00[_0x29a9('0x2a')],_0x1d4d00['query']);_0x31d970['attributes']=_[_0x29a9('0x2d')](_0x1d4d00[_0x29a9('0x2a')],qs['fields'](_0x902f69['query'][_0x29a9('0x2e')]));_0x31d970[_0x29a9('0x2f')]=_0x31d970[_0x29a9('0x2f')][_0x29a9('0x30')]?_0x31d970[_0x29a9('0x2f')]:_0x1d4d00[_0x29a9('0x2a')];if(!_0x902f69[_0x29a9('0x2b')][_0x29a9('0x31')]('nolimit')){_0x31d970['limit']=qs[_0x29a9('0x19')](_0x902f69[_0x29a9('0x2b')][_0x29a9('0x19')]);_0x31d970[_0x29a9('0x1a')]=qs[_0x29a9('0x1a')](_0x902f69[_0x29a9('0x2b')][_0x29a9('0x1a')]);}_0x31d970[_0x29a9('0x32')]=qs[_0x29a9('0x33')](_0x902f69[_0x29a9('0x2b')][_0x29a9('0x33')]);delete _0x902f69[_0x29a9('0x2b')][_0x29a9('0x33')];_0x31d970[_0x29a9('0x34')]=qs[_0x29a9('0x35')](_[_0x29a9('0x36')](_0x902f69[_0x29a9('0x2b')],_0x1d4d00['filters']),_0x56bdc4);if(_0x902f69[_0x29a9('0x2b')][_0x29a9('0x37')]){_0x31d970['where']=_[_0x29a9('0x38')](_0x31d970[_0x29a9('0x34')],{'$or':_[_0x29a9('0x27')](_0x56bdc4,function(_0x102fb3){if(_0x102fb3[_0x29a9('0x28')]!==_0x29a9('0x39')){var _0x5ccd2c={};_0x5ccd2c[_0x102fb3[_0x29a9('0x26')]]={'$like':'%'+_0x902f69[_0x29a9('0x2b')][_0x29a9('0x37')]+'%'};return _0x5ccd2c;}})});}_0x31d970=_[_0x29a9('0x38')]({},_0x31d970,_0x902f69[_0x29a9('0x3a')]);var _0x4b9517={'where':_0x31d970['where']};return db['VoiceMusicOnHold'][_0x29a9('0x3b')](_0x4b9517)['then'](function(_0x4a3adb){_0x59a184[_0x29a9('0x3b')]=_0x4a3adb;if(_0x902f69['query']['includeAll']){_0x31d970[_0x29a9('0x3c')]=[{'all':!![]}];}return db[_0x29a9('0x3d')][_0x29a9('0x3e')](_0x31d970);})[_0x29a9('0x1e')](function(_0x132b49){_0x59a184[_0x29a9('0x3f')]=_0x132b49;return _0x59a184;})[_0x29a9('0x1e')](respondWithFilteredResult(_0x454de6,_0x31d970))[_0x29a9('0x40')](handleError(_0x454de6,null));};exports[_0x29a9('0x41')]=function(_0x4e380a,_0x42fa1b){var _0x8481cf={'raw':![],'where':{'id':_0x4e380a['params']['id']}},_0x56af72={};_0x56af72[_0x29a9('0x2a')]=_[_0x29a9('0x2c')](db['VoiceMusicOnHold'][_0x29a9('0x42')]);_0x56af72[_0x29a9('0x2b')]=_['keys'](_0x4e380a[_0x29a9('0x2b')]);_0x56af72[_0x29a9('0x35')]=_[_0x29a9('0x2d')](_0x56af72[_0x29a9('0x2a')],_0x56af72[_0x29a9('0x2b')]);_0x8481cf[_0x29a9('0x2f')]=_['intersection'](_0x56af72['model'],qs[_0x29a9('0x2e')](_0x4e380a['query'][_0x29a9('0x2e')]));_0x8481cf['attributes']=_0x8481cf[_0x29a9('0x2f')]['length']?_0x8481cf['attributes']:_0x56af72[_0x29a9('0x2a')];if(_0x4e380a['query'][_0x29a9('0x43')]){_0x8481cf[_0x29a9('0x3c')]=[{'all':!![]}];}_0x8481cf=_['merge']({},_0x8481cf,_0x4e380a[_0x29a9('0x3a')]);return db['VoiceMusicOnHold']['find'](_0x8481cf)['then'](handleEntityNotFound(_0x42fa1b,null))[_0x29a9('0x1e')](respondWithResult(_0x42fa1b,null))[_0x29a9('0x40')](handleError(_0x42fa1b,null));};exports['update']=function(_0x2b13a9,_0x3b7887){if(_0x2b13a9[_0x29a9('0x44')]['id']){delete _0x2b13a9[_0x29a9('0x44')]['id'];}return db[_0x29a9('0x3d')][_0x29a9('0x45')]({'where':{'id':_0x2b13a9[_0x29a9('0x46')]['id']}})['then'](handleEntityNotFound(_0x3b7887,null))[_0x29a9('0x1e')](saveUpdates(_0x2b13a9['body'],null))[_0x29a9('0x1e')](respondWithResult(_0x3b7887,null))[_0x29a9('0x40')](handleError(_0x3b7887,null));};exports[_0x29a9('0x47')]=function(_0x4543a,_0x1799b7,_0x153bf0){return db[_0x29a9('0x48')][_0x29a9('0x49')](function(_0x2cd609){if(_0x4543a[_0x29a9('0x44')][_0x29a9('0x4a')]==='files'){_0x4543a[_0x29a9('0x44')][_0x29a9('0x4b')]=path['join'](config['root'],'server/files/moh',_0x4543a['body']['name']);}return db[_0x29a9('0x3d')][_0x29a9('0x47')](_0x4543a[_0x29a9('0x44')],{'transaction':_0x2cd609})['then'](function(_0x28bf87){if(_0x4543a[_0x29a9('0x44')][_0x29a9('0x4a')]===_0x29a9('0x4c')){fs[_0x29a9('0x4d')](_0x28bf87[_0x29a9('0x4b')],parseInt(_0x29a9('0x4e'),0x8));}var _0x3461a7=_0x4543a[_0x29a9('0x4f')]['get']({'plain':!![]});if(!_0x3461a7)throw new Error(_0x29a9('0x50'));if(_0x3461a7[_0x29a9('0x51')]===_0x29a9('0x4f')){var _0x467818=_0x28bf87['get']({'plain':!![]});return db[_0x29a9('0x52')][_0x29a9('0x45')]({'where':{'name':_0x29a9('0x20'),'userProfileId':_0x3461a7[_0x29a9('0x53')]},'raw':!![]})[_0x29a9('0x1e')](function(_0x1617f7){if(_0x1617f7&&_0x1617f7[_0x29a9('0x54')]===0x0){return db['UserProfileResource'][_0x29a9('0x47')]({'name':_0x467818[_0x29a9('0x26')],'resourceId':_0x467818['id'],'type':_0x1617f7[_0x29a9('0x26')],'sectionId':_0x1617f7['id']},{})[_0x29a9('0x1e')](function(){return _0x28bf87;});}else{return _0x28bf87;}})['catch'](function(_0x505989){logger[_0x29a9('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x505989);});}return _0x28bf87;});})[_0x29a9('0x1e')](respondWithResult(_0x1799b7,0xc9))[_0x29a9('0x40')](handleError(_0x1799b7,null));};exports[_0x29a9('0x22')]=function(_0x15115d,_0x4e2251,_0x5e44df){var _0x253fd9;return db[_0x29a9('0x3d')][_0x29a9('0x45')]({'where':{'id':_0x15115d['params']['id']}})[_0x29a9('0x1e')](function(_0x5f3585){if(_0x5f3585){return db[_0x29a9('0x48')][_0x29a9('0x49')](function(_0x6136cd){return _0x5f3585[_0x29a9('0x22')]({'transaction':_0x6136cd,'raw':!![]})[_0x29a9('0x1e')](function(_0x3f6c4b){if(_0x3f6c4b[_0x29a9('0x4b')]){fs['readdirSync'](_0x3f6c4b[_0x29a9('0x4b')])[_0x29a9('0x55')](function(_0x5c9d7b){fs[_0x29a9('0x56')](path['join'](_0x3f6c4b[_0x29a9('0x4b')],_0x5c9d7b));});fs[_0x29a9('0x57')](_0x3f6c4b[_0x29a9('0x4b')]);}return _0x3f6c4b;});})[_0x29a9('0x40')](function(_0xc468ef){throw new db[(_0x29a9('0x58'))][(_0x29a9('0x59'))](_0xc468ef[_0x29a9('0x5a')]);});}})[_0x29a9('0x1e')](handleEntityNotFound(_0x4e2251,null))['then'](removeEntity(_0x4e2251,null))[_0x29a9('0x40')](handleError(_0x4e2251,null));};exports[_0x29a9('0x5b')]=function(_0x50491b,_0x55dd62,_0x26e673){return db['sequelize']['transaction'](function(_0x5e8a7e){var _0x5d87fb;return db[_0x29a9('0x3d')][_0x29a9('0x45')]({'where':{'id':_0x50491b[_0x29a9('0x46')]['id']}})[_0x29a9('0x1e')](function(_0x457372){if(_0x457372){_0x5d87fb=_0x457372;return _0x457372[_0x29a9('0x5b')](_0x50491b[_0x29a9('0x44')]['id'],{'transaction':_0x5e8a7e});}})[_0x29a9('0x1e')](function(_0x33636d){if(_0x33636d){return db['Sound'][_0x29a9('0x5c')]({'where':{'id':_0x50491b[_0x29a9('0x44')]['id']},'attributes':['id',_0x29a9('0x26'),_0x29a9('0x5d'),_0x29a9('0x5e'),_0x29a9('0x5f')],'raw':!![]});}})['then'](function(_0x4dd77f){if(_0x4dd77f){var _0x3105cd=path[_0x29a9('0x60')](config[_0x29a9('0x61')],_0x29a9('0x62'),util[_0x29a9('0x63')]('%s.%s',path['basename'](_0x4dd77f['save_name'],path[_0x29a9('0x64')](_0x4dd77f[_0x29a9('0x5d')])),_0x4dd77f[_0x29a9('0x5e')]));var _0x470a41=path[_0x29a9('0x60')](config[_0x29a9('0x61')],_0x29a9('0x65'),_0x5d87fb[_0x29a9('0x26')],util[_0x29a9('0x63')](_0x29a9('0x66'),_0x4dd77f[_0x29a9('0x26')],_0x4dd77f[_0x29a9('0x5e')]));fs[_0x29a9('0x67')](_0x3105cd,_0x470a41);return _0x4dd77f;}})[_0x29a9('0x40')](function(_0x1afc3b){throw new db[(_0x29a9('0x58'))][(_0x29a9('0x59'))](_0x1afc3b[_0x29a9('0x5a')]);});})[_0x29a9('0x1e')](handleEntityNotFound(_0x55dd62,null))[_0x29a9('0x1e')](respondWithResult(_0x55dd62,0xc9))['catch'](handleError(_0x55dd62,null));};exports[_0x29a9('0x68')]=function(_0x4f43a2,_0x2b7252,_0x7b23a9){return db[_0x29a9('0x48')][_0x29a9('0x49')](function(_0x23e3f3){var _0x3e3ce6;return db[_0x29a9('0x3d')][_0x29a9('0x5c')]({'where':{'id':_0x4f43a2[_0x29a9('0x46')]['id']}})[_0x29a9('0x1e')](handleEntityNotFound(_0x2b7252,null))[_0x29a9('0x1e')](function(_0x14eefa){if(_0x14eefa){_0x3e3ce6=_0x14eefa;return _0x14eefa[_0x29a9('0x68')](_0x4f43a2['params'][_0x29a9('0x69')]);}})[_0x29a9('0x1e')](function(_0x48b78b){if(_0x48b78b){return db['Sound'][_0x29a9('0x5c')]({'where':{'id':_0x4f43a2[_0x29a9('0x46')][_0x29a9('0x69')]},'attributes':['id',_0x29a9('0x26'),_0x29a9('0x5d'),_0x29a9('0x5e'),_0x29a9('0x5f')],'raw':!![]});}})[_0x29a9('0x1e')](function(_0x3032dc){if(_0x3032dc){fs[_0x29a9('0x56')](path['join'](_0x3e3ce6[_0x29a9('0x4b')],util[_0x29a9('0x63')](_0x29a9('0x66'),_0x3032dc[_0x29a9('0x26')],_0x3032dc[_0x29a9('0x5e')])));return _0x3032dc;}})['catch'](function(_0x29e583){throw new db[(_0x29a9('0x58'))]['ValidationError'](_0x29e583[_0x29a9('0x5a')]);});})[_0x29a9('0x1e')](handleEntityNotFound(_0x2b7252,null))[_0x29a9('0x1e')](respondWithStatusCode(_0x2b7252,0xcc))[_0x29a9('0x40')](handleError(_0x2b7252,null));};exports[_0x29a9('0x6a')]=function(_0x2a09b3,_0xa1ce07,_0x399650){var _0x5c2017={};var _0x45e5e0={};var _0x294bf6;var _0x352962;return db[_0x29a9('0x3d')][_0x29a9('0x5c')]({'where':{'id':_0x2a09b3[_0x29a9('0x46')]['id']}})[_0x29a9('0x1e')](handleEntityNotFound(_0xa1ce07,null))[_0x29a9('0x1e')](function(_0x488e2c){if(_0x488e2c){_0x294bf6=_0x488e2c;_0x45e5e0[_0x29a9('0x2a')]=_[_0x29a9('0x2c')](db[_0x29a9('0x6b')][_0x29a9('0x42')]);_0x45e5e0[_0x29a9('0x2b')]=_[_0x29a9('0x2c')](_0x2a09b3[_0x29a9('0x2b')]);_0x45e5e0[_0x29a9('0x35')]=_[_0x29a9('0x2d')](_0x45e5e0['model'],_0x45e5e0[_0x29a9('0x2b')]);_0x5c2017[_0x29a9('0x2f')]=_[_0x29a9('0x2d')](_0x45e5e0[_0x29a9('0x2a')],qs[_0x29a9('0x2e')](_0x2a09b3[_0x29a9('0x2b')][_0x29a9('0x2e')]));_0x5c2017[_0x29a9('0x2f')]=_0x5c2017[_0x29a9('0x2f')]['length']?_0x5c2017[_0x29a9('0x2f')]:_0x45e5e0[_0x29a9('0x2a')];_0x5c2017['order']=qs['sort'](_0x2a09b3[_0x29a9('0x2b')][_0x29a9('0x33')]);_0x5c2017[_0x29a9('0x34')]=qs['filters'](_['pick'](_0x2a09b3[_0x29a9('0x2b')],_0x45e5e0[_0x29a9('0x35')]));if(_0x2a09b3[_0x29a9('0x2b')][_0x29a9('0x37')]){_0x5c2017['where']=_[_0x29a9('0x38')](_0x5c2017[_0x29a9('0x34')],{'$or':_[_0x29a9('0x27')](_0x5c2017['attributes'],function(_0xc2bcfa){var _0x1d4ee7={};_0x1d4ee7[_0xc2bcfa]={'$like':'%'+_0x2a09b3[_0x29a9('0x2b')][_0x29a9('0x37')]+'%'};return _0x1d4ee7;})});}_0x5c2017=_[_0x29a9('0x38')]({},_0x5c2017,_0x2a09b3['options']);return _0x294bf6['getSounds'](_0x5c2017);}})[_0x29a9('0x1e')](function(_0x535f66){if(_0x535f66){_0x352962=_0x535f66[_0x29a9('0x30')];if(!_0x2a09b3[_0x29a9('0x2b')][_0x29a9('0x31')](_0x29a9('0x6c'))){_0x5c2017[_0x29a9('0x19')]=qs[_0x29a9('0x19')](_0x2a09b3['query']['limit']);_0x5c2017[_0x29a9('0x1a')]=qs['offset'](_0x2a09b3[_0x29a9('0x2b')][_0x29a9('0x1a')]);}return _0x294bf6['getSounds'](_0x5c2017);}})['then'](function(_0x5689e6){if(_0x5689e6){return _0x5689e6?{'count':_0x352962,'rows':_0x5689e6}:null;}})[_0x29a9('0x1e')](respondWithResult(_0xa1ce07,null))[_0x29a9('0x40')](handleError(_0xa1ce07,null));}; \ No newline at end of file +var _0x8c37=['keys','query','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','filters','find','catch','body','create','sequelize','transaction','files','directory','root','server/files/moh','mode','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','join','rmdirSync','Sequelize','message','addSound','Sound','findOne','converted_format','createdAt','format','%s.%s','basename','save_name','extname','symlinkSync','ValidationError','removeSound','id2','getSounds','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','destroy','then','get','MusicOnHolds','UserProfileResource','end','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model'];(function(_0x3367a8,_0x396cd0){var _0x6acc4a=function(_0xfe8c73){while(--_0xfe8c73){_0x3367a8['push'](_0x3367a8['shift']());}};_0x6acc4a(++_0x396cd0);}(_0x8c37,0xb1));var _0x78c3=function(_0x149cf3,_0x3d04d1){_0x149cf3=_0x149cf3-0x0;var _0x2f7047=_0x8c37[_0x149cf3];return _0x2f7047;};'use strict';var emlformat=require(_0x78c3('0x0'));var rimraf=require(_0x78c3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x78c3('0x2'));var rp=require(_0x78c3('0x3'));var moment=require(_0x78c3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x78c3('0x5'));var util=require('util');var path=require(_0x78c3('0x6'));var sox=require(_0x78c3('0x7'));var csv=require(_0x78c3('0x8'));var ejs=require(_0x78c3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x78c3('0xa'));var jsforce=require(_0x78c3('0xb'));var deskjs=require(_0x78c3('0xc'));var toCsv=require(_0x78c3('0x8'));var querystring=require(_0x78c3('0xd'));var Papa=require('papaparse');var Redis=require(_0x78c3('0xe'));var authService=require(_0x78c3('0xf'));var qs=require(_0x78c3('0x10'));var as=require(_0x78c3('0x11'));var hardwareService=require(_0x78c3('0x12'));var logger=require(_0x78c3('0x13'))(_0x78c3('0x14'));var utils=require(_0x78c3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x78c3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11095a,_0x4118c6){_0x4118c6=_0x4118c6||0xcc;return function(_0x42c54a){if(_0x42c54a){return _0x11095a[_0x78c3('0x17')](_0x4118c6);}return _0x11095a['status'](_0x4118c6)['end']();};}function respondWithResult(_0x349cf6,_0x184f15){_0x184f15=_0x184f15||0xc8;return function(_0x361158){if(_0x361158){return _0x349cf6['status'](_0x184f15)[_0x78c3('0x18')](_0x361158);}};}function respondWithFilteredResult(_0x404cf8,_0xdec8e9){return function(_0x44773e){if(_0x44773e){var _0x537027=typeof _0xdec8e9[_0x78c3('0x19')]===_0x78c3('0x1a')&&typeof _0xdec8e9[_0x78c3('0x1b')]==='undefined';var _0x32d2ad=_0x44773e['count'];var _0x984f57=_0x537027?0x0:_0xdec8e9['offset'];var _0x2f9a68=_0x537027?_0x44773e[_0x78c3('0x1c')]:_0xdec8e9[_0x78c3('0x19')]+_0xdec8e9[_0x78c3('0x1b')];var _0x42a3ab;if(_0x2f9a68>=_0x32d2ad){_0x2f9a68=_0x32d2ad;_0x42a3ab=0xc8;}else{_0x42a3ab=0xce;}_0x404cf8[_0x78c3('0x1d')](_0x42a3ab);return _0x404cf8[_0x78c3('0x1e')](_0x78c3('0x1f'),_0x984f57+'-'+_0x2f9a68+'/'+_0x32d2ad)['json'](_0x44773e);}return null;};}function patchUpdates(_0x427c2c){return function(_0x1be21d){try{jsonpatch[_0x78c3('0x20')](_0x1be21d,_0x427c2c,!![]);}catch(_0x3cfa30){return BPromise['reject'](_0x3cfa30);}return _0x1be21d[_0x78c3('0x21')]();};}function saveUpdates(_0x4833e5,_0x32530c){return function(_0x1d3ae0){if(_0x1d3ae0){return _0x1d3ae0[_0x78c3('0x22')](_0x4833e5)['then'](function(_0xb33ac8){return _0xb33ac8;});}return null;};}function removeEntity(_0x361ac9,_0x729986){return function(_0x1b910d){if(_0x1b910d){return _0x1b910d[_0x78c3('0x23')]()[_0x78c3('0x24')](function(){var _0x31ed27=_0x1b910d[_0x78c3('0x25')]({'plain':!![]});var _0x311a42=_0x78c3('0x26');return db[_0x78c3('0x27')][_0x78c3('0x23')]({'where':{'type':_0x311a42,'resourceId':_0x31ed27['id']}})[_0x78c3('0x24')](function(){return _0x1b910d;});})[_0x78c3('0x24')](function(){_0x361ac9[_0x78c3('0x1d')](0xcc)[_0x78c3('0x28')]();});}};}function handleEntityNotFound(_0x109d95,_0x325cf4){return function(_0x4adc8e){if(!_0x4adc8e){_0x109d95[_0x78c3('0x17')](0x194);}return _0x4adc8e;};}function handleError(_0x18b2eb,_0x25103d){_0x25103d=_0x25103d||0x1f4;return function(_0x1f9b87){logger['error'](_0x1f9b87[_0x78c3('0x29')]);if(_0x1f9b87[_0x78c3('0x2a')]){delete _0x1f9b87[_0x78c3('0x2a')];}_0x18b2eb[_0x78c3('0x1d')](_0x25103d)[_0x78c3('0x2b')](_0x1f9b87);};}exports[_0x78c3('0x2c')]=function(_0x2ad85a,_0x575d63){var _0x251746={},_0x3ba8be={},_0x146ecd={'count':0x0,'rows':[]};var _0x412ff2=_['map'](db[_0x78c3('0x2d')][_0x78c3('0x2e')],function(_0x5788d1){return{'name':_0x5788d1[_0x78c3('0x2f')],'type':_0x5788d1[_0x78c3('0x30')][_0x78c3('0x31')]};});_0x3ba8be[_0x78c3('0x32')]=_['map'](_0x412ff2,'name');_0x3ba8be['query']=_[_0x78c3('0x33')](_0x2ad85a[_0x78c3('0x34')]);_0x3ba8be['filters']=_[_0x78c3('0x35')](_0x3ba8be['model'],_0x3ba8be[_0x78c3('0x34')]);_0x251746[_0x78c3('0x36')]=_['intersection'](_0x3ba8be[_0x78c3('0x32')],qs['fields'](_0x2ad85a[_0x78c3('0x34')][_0x78c3('0x37')]));_0x251746[_0x78c3('0x36')]=_0x251746[_0x78c3('0x36')][_0x78c3('0x38')]?_0x251746[_0x78c3('0x36')]:_0x3ba8be['model'];if(!_0x2ad85a[_0x78c3('0x34')]['hasOwnProperty'](_0x78c3('0x39'))){_0x251746[_0x78c3('0x1b')]=qs[_0x78c3('0x1b')](_0x2ad85a[_0x78c3('0x34')][_0x78c3('0x1b')]);_0x251746['offset']=qs[_0x78c3('0x19')](_0x2ad85a[_0x78c3('0x34')][_0x78c3('0x19')]);}_0x251746[_0x78c3('0x3a')]=qs[_0x78c3('0x3b')](_0x2ad85a[_0x78c3('0x34')][_0x78c3('0x3b')]);delete _0x2ad85a['query'][_0x78c3('0x3b')];_0x251746['where']=qs['filters'](_[_0x78c3('0x3c')](_0x2ad85a[_0x78c3('0x34')],_0x3ba8be['filters']),_0x412ff2);if(_0x2ad85a[_0x78c3('0x34')]['filter']){_0x251746[_0x78c3('0x3d')]=_[_0x78c3('0x3e')](_0x251746[_0x78c3('0x3d')],{'$or':_['map'](_0x412ff2,function(_0x3add6c){if(_0x3add6c[_0x78c3('0x30')]!==_0x78c3('0x3f')){var _0x5884eb={};_0x5884eb[_0x3add6c[_0x78c3('0x2a')]]={'$like':'%'+_0x2ad85a[_0x78c3('0x34')][_0x78c3('0x40')]+'%'};return _0x5884eb;}})});}_0x251746=_[_0x78c3('0x3e')]({},_0x251746,_0x2ad85a[_0x78c3('0x41')]);var _0x3aee3b={'where':_0x251746['where']};return db[_0x78c3('0x2d')][_0x78c3('0x1c')](_0x3aee3b)[_0x78c3('0x24')](function(_0x143440){_0x146ecd[_0x78c3('0x1c')]=_0x143440;if(_0x2ad85a[_0x78c3('0x34')][_0x78c3('0x42')]){_0x251746[_0x78c3('0x43')]=[{'all':!![]}];}return db[_0x78c3('0x2d')][_0x78c3('0x44')](_0x251746);})['then'](function(_0x45706a){_0x146ecd[_0x78c3('0x45')]=_0x45706a;return _0x146ecd;})['then'](respondWithFilteredResult(_0x575d63,_0x251746))['catch'](handleError(_0x575d63,null));};exports[_0x78c3('0x46')]=function(_0x20a5a4,_0x372c46){var _0x66c70b={'raw':![],'where':{'id':_0x20a5a4[_0x78c3('0x47')]['id']}},_0x5a8b8d={};_0x5a8b8d[_0x78c3('0x32')]=_[_0x78c3('0x33')](db[_0x78c3('0x2d')]['rawAttributes']);_0x5a8b8d['query']=_[_0x78c3('0x33')](_0x20a5a4[_0x78c3('0x34')]);_0x5a8b8d[_0x78c3('0x48')]=_['intersection'](_0x5a8b8d[_0x78c3('0x32')],_0x5a8b8d['query']);_0x66c70b[_0x78c3('0x36')]=_[_0x78c3('0x35')](_0x5a8b8d[_0x78c3('0x32')],qs[_0x78c3('0x37')](_0x20a5a4[_0x78c3('0x34')]['fields']));_0x66c70b['attributes']=_0x66c70b[_0x78c3('0x36')][_0x78c3('0x38')]?_0x66c70b[_0x78c3('0x36')]:_0x5a8b8d[_0x78c3('0x32')];if(_0x20a5a4[_0x78c3('0x34')][_0x78c3('0x42')]){_0x66c70b[_0x78c3('0x43')]=[{'all':!![]}];}_0x66c70b=_[_0x78c3('0x3e')]({},_0x66c70b,_0x20a5a4[_0x78c3('0x41')]);return db[_0x78c3('0x2d')][_0x78c3('0x49')](_0x66c70b)['then'](handleEntityNotFound(_0x372c46,null))['then'](respondWithResult(_0x372c46,null))[_0x78c3('0x4a')](handleError(_0x372c46,null));};exports[_0x78c3('0x22')]=function(_0x2a76f2,_0x3b38b4){if(_0x2a76f2[_0x78c3('0x4b')]['id']){delete _0x2a76f2['body']['id'];}return db[_0x78c3('0x2d')]['find']({'where':{'id':_0x2a76f2['params']['id']}})[_0x78c3('0x24')](handleEntityNotFound(_0x3b38b4,null))[_0x78c3('0x24')](saveUpdates(_0x2a76f2[_0x78c3('0x4b')],null))['then'](respondWithResult(_0x3b38b4,null))[_0x78c3('0x4a')](handleError(_0x3b38b4,null));};exports[_0x78c3('0x4c')]=function(_0x1de2cf,_0xa8c60b,_0x2f61bd){return db[_0x78c3('0x4d')][_0x78c3('0x4e')](function(_0x431084){if(_0x1de2cf[_0x78c3('0x4b')]['mode']===_0x78c3('0x4f')){_0x1de2cf[_0x78c3('0x4b')][_0x78c3('0x50')]=path['join'](config[_0x78c3('0x51')],_0x78c3('0x52'),_0x1de2cf['body']['name']);}return db[_0x78c3('0x2d')]['create'](_0x1de2cf['body'],{'transaction':_0x431084})['then'](function(_0x384f28){if(_0x1de2cf['body'][_0x78c3('0x53')]==='files'){fs[_0x78c3('0x54')](_0x384f28[_0x78c3('0x50')],parseInt(_0x78c3('0x55'),0x8));}var _0x402367=_0x1de2cf[_0x78c3('0x56')][_0x78c3('0x25')]({'plain':!![]});if(!_0x402367)throw new Error(_0x78c3('0x57'));if(_0x402367[_0x78c3('0x58')]===_0x78c3('0x56')){var _0x195157=_0x384f28[_0x78c3('0x25')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x402367[_0x78c3('0x59')]},'raw':!![]})[_0x78c3('0x24')](function(_0x511163){if(_0x511163&&_0x511163[_0x78c3('0x5a')]===0x0){return db[_0x78c3('0x27')][_0x78c3('0x4c')]({'name':_0x195157[_0x78c3('0x2a')],'resourceId':_0x195157['id'],'type':_0x511163[_0x78c3('0x2a')],'sectionId':_0x511163['id']},{})[_0x78c3('0x24')](function(){return _0x384f28;});}else{return _0x384f28;}})[_0x78c3('0x4a')](function(_0x10a0ad){logger['error'](_0x78c3('0x5b'),_0x10a0ad);});}return _0x384f28;});})[_0x78c3('0x24')](respondWithResult(_0xa8c60b,0xc9))['catch'](handleError(_0xa8c60b,null));};exports['destroy']=function(_0x3a04ec,_0x63eb53,_0x367449){var _0x2107e7;return db[_0x78c3('0x2d')][_0x78c3('0x49')]({'where':{'id':_0x3a04ec[_0x78c3('0x47')]['id']}})[_0x78c3('0x24')](function(_0x35078f){if(_0x35078f){return db[_0x78c3('0x4d')][_0x78c3('0x4e')](function(_0x26f418){return _0x35078f['destroy']({'transaction':_0x26f418,'raw':!![]})[_0x78c3('0x24')](function(_0x49d181){if(_0x49d181[_0x78c3('0x50')]){fs[_0x78c3('0x5c')](_0x49d181['directory'])[_0x78c3('0x5d')](function(_0x3a8854){fs['unlinkSync'](path[_0x78c3('0x5e')](_0x49d181['directory'],_0x3a8854));});fs[_0x78c3('0x5f')](_0x49d181[_0x78c3('0x50')]);}return _0x49d181;});})[_0x78c3('0x4a')](function(_0x48db5e){throw new db[(_0x78c3('0x60'))]['ValidationError'](_0x48db5e[_0x78c3('0x61')]);});}})[_0x78c3('0x24')](handleEntityNotFound(_0x63eb53,null))[_0x78c3('0x24')](removeEntity(_0x63eb53,null))[_0x78c3('0x4a')](handleError(_0x63eb53,null));};exports[_0x78c3('0x62')]=function(_0x59cbad,_0x4ce2f8,_0x528731){return db[_0x78c3('0x4d')]['transaction'](function(_0x4104db){var _0x4e86c7;return db[_0x78c3('0x2d')][_0x78c3('0x49')]({'where':{'id':_0x59cbad[_0x78c3('0x47')]['id']}})['then'](function(_0x62596f){if(_0x62596f){_0x4e86c7=_0x62596f;return _0x62596f[_0x78c3('0x62')](_0x59cbad[_0x78c3('0x4b')]['id'],{'transaction':_0x4104db});}})[_0x78c3('0x24')](function(_0x309581){if(_0x309581){return db[_0x78c3('0x63')][_0x78c3('0x64')]({'where':{'id':_0x59cbad['body']['id']},'attributes':['id',_0x78c3('0x2a'),'save_name',_0x78c3('0x65'),_0x78c3('0x66')],'raw':!![]});}})[_0x78c3('0x24')](function(_0x170e14){if(_0x170e14){var _0x3a612a=path['join'](config[_0x78c3('0x51')],'server/files/sounds/converted',util[_0x78c3('0x67')](_0x78c3('0x68'),path[_0x78c3('0x69')](_0x170e14[_0x78c3('0x6a')],path[_0x78c3('0x6b')](_0x170e14['save_name'])),_0x170e14['converted_format']));var _0x1b0142=path[_0x78c3('0x5e')](config[_0x78c3('0x51')],'server/files/moh',_0x4e86c7[_0x78c3('0x2a')],util['format'](_0x78c3('0x68'),_0x170e14[_0x78c3('0x2a')],_0x170e14[_0x78c3('0x65')]));fs[_0x78c3('0x6c')](_0x3a612a,_0x1b0142);return _0x170e14;}})[_0x78c3('0x4a')](function(_0x5c2ac4){throw new db[(_0x78c3('0x60'))][(_0x78c3('0x6d'))](_0x5c2ac4[_0x78c3('0x61')]);});})['then'](handleEntityNotFound(_0x4ce2f8,null))['then'](respondWithResult(_0x4ce2f8,0xc9))[_0x78c3('0x4a')](handleError(_0x4ce2f8,null));};exports[_0x78c3('0x6e')]=function(_0x2d9662,_0xebef6f,_0x1735d2){return db[_0x78c3('0x4d')][_0x78c3('0x4e')](function(_0x5b2eb1){var _0x2b2696;return db[_0x78c3('0x2d')][_0x78c3('0x64')]({'where':{'id':_0x2d9662[_0x78c3('0x47')]['id']}})[_0x78c3('0x24')](handleEntityNotFound(_0xebef6f,null))[_0x78c3('0x24')](function(_0x378cc3){if(_0x378cc3){_0x2b2696=_0x378cc3;return _0x378cc3[_0x78c3('0x6e')](_0x2d9662[_0x78c3('0x47')][_0x78c3('0x6f')]);}})[_0x78c3('0x24')](function(_0x194f72){if(_0x194f72){return db[_0x78c3('0x63')][_0x78c3('0x64')]({'where':{'id':_0x2d9662[_0x78c3('0x47')][_0x78c3('0x6f')]},'attributes':['id','name',_0x78c3('0x6a'),'converted_format',_0x78c3('0x66')],'raw':!![]});}})[_0x78c3('0x24')](function(_0x336daf){if(_0x336daf){fs['unlinkSync'](path[_0x78c3('0x5e')](_0x2b2696[_0x78c3('0x50')],util['format'](_0x78c3('0x68'),_0x336daf[_0x78c3('0x2a')],_0x336daf[_0x78c3('0x65')])));return _0x336daf;}})['catch'](function(_0x11d639){throw new db['Sequelize'][(_0x78c3('0x6d'))](_0x11d639['message']);});})['then'](handleEntityNotFound(_0xebef6f,null))['then'](respondWithStatusCode(_0xebef6f,0xcc))[_0x78c3('0x4a')](handleError(_0xebef6f,null));};exports[_0x78c3('0x70')]=function(_0x5174da,_0x5689de,_0x35a53f){var _0x2e12b7={};var _0x5dfce1={};var _0x4fecbb;var _0x25d1c0;return db[_0x78c3('0x2d')][_0x78c3('0x64')]({'where':{'id':_0x5174da[_0x78c3('0x47')]['id']}})[_0x78c3('0x24')](handleEntityNotFound(_0x5689de,null))[_0x78c3('0x24')](function(_0x4c65ad){if(_0x4c65ad){_0x4fecbb=_0x4c65ad;_0x5dfce1[_0x78c3('0x32')]=_[_0x78c3('0x33')](db[_0x78c3('0x63')]['rawAttributes']);_0x5dfce1[_0x78c3('0x34')]=_[_0x78c3('0x33')](_0x5174da[_0x78c3('0x34')]);_0x5dfce1[_0x78c3('0x48')]=_[_0x78c3('0x35')](_0x5dfce1['model'],_0x5dfce1[_0x78c3('0x34')]);_0x2e12b7['attributes']=_['intersection'](_0x5dfce1[_0x78c3('0x32')],qs[_0x78c3('0x37')](_0x5174da[_0x78c3('0x34')][_0x78c3('0x37')]));_0x2e12b7[_0x78c3('0x36')]=_0x2e12b7[_0x78c3('0x36')][_0x78c3('0x38')]?_0x2e12b7[_0x78c3('0x36')]:_0x5dfce1[_0x78c3('0x32')];_0x2e12b7['order']=qs['sort'](_0x5174da['query'][_0x78c3('0x3b')]);_0x2e12b7[_0x78c3('0x3d')]=qs['filters'](_[_0x78c3('0x3c')](_0x5174da[_0x78c3('0x34')],_0x5dfce1['filters']));if(_0x5174da[_0x78c3('0x34')]['filter']){_0x2e12b7[_0x78c3('0x3d')]=_[_0x78c3('0x3e')](_0x2e12b7[_0x78c3('0x3d')],{'$or':_['map'](_0x2e12b7['attributes'],function(_0x29efe4){var _0x2e3b76={};_0x2e3b76[_0x29efe4]={'$like':'%'+_0x5174da[_0x78c3('0x34')][_0x78c3('0x40')]+'%'};return _0x2e3b76;})});}_0x2e12b7=_[_0x78c3('0x3e')]({},_0x2e12b7,_0x5174da[_0x78c3('0x41')]);return _0x4fecbb[_0x78c3('0x70')](_0x2e12b7);}})['then'](function(_0x26805f){if(_0x26805f){_0x25d1c0=_0x26805f[_0x78c3('0x38')];if(!_0x5174da[_0x78c3('0x34')][_0x78c3('0x71')](_0x78c3('0x39'))){_0x2e12b7[_0x78c3('0x1b')]=qs['limit'](_0x5174da[_0x78c3('0x34')][_0x78c3('0x1b')]);_0x2e12b7['offset']=qs['offset'](_0x5174da['query'][_0x78c3('0x19')]);}return _0x4fecbb[_0x78c3('0x70')](_0x2e12b7);}})[_0x78c3('0x24')](function(_0x102e11){if(_0x102e11){return _0x102e11?{'count':_0x25d1c0,'rows':_0x102e11}:null;}})[_0x78c3('0x24')](respondWithResult(_0x5689de,null))[_0x78c3('0x4a')](handleError(_0x5689de,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index de6164b..2d51d5a 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 _0x7b86=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger'];(function(_0x4ecf66,_0x9123fe){var _0x279cfc=function(_0x56f92e){while(--_0x56f92e){_0x4ecf66['push'](_0x4ecf66['shift']());}};_0x279cfc(++_0x9123fe);}(_0x7b86,0x7f));var _0x67b8=function(_0xbd97f4,_0x8b5779){_0xbd97f4=_0xbd97f4-0x0;var _0x11ee12=_0x7b86[_0xbd97f4];return _0x11ee12;};'use strict';var _=require(_0x67b8('0x0'));var util=require(_0x67b8('0x1'));var logger=require(_0x67b8('0x2'))(_0x67b8('0x3'));var moment=require(_0x67b8('0x4'));var BPromise=require(_0x67b8('0x5'));var rp=require(_0x67b8('0x6'));var fs=require('fs');var path=require(_0x67b8('0x7'));var rimraf=require(_0x67b8('0x8'));var config=require(_0x67b8('0x9'));var attributes=require(_0x67b8('0xa'));module['exports']=function(_0x4227f0,_0x1bea1f){return _0x4227f0['define'](_0x67b8('0xb'),attributes,{'tableName':_0x67b8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1eea=['request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','api','moment','bluebird'];(function(_0x4ca536,_0x57c8de){var _0x3bd35f=function(_0x26d91d){while(--_0x26d91d){_0x4ca536['push'](_0x4ca536['shift']());}};_0x3bd35f(++_0x57c8de);}(_0x1eea,0x64));var _0xa1ee=function(_0x279011,_0x35bd4f){_0x279011=_0x279011-0x0;var _0xd0204e=_0x1eea[_0x279011];return _0xd0204e;};'use strict';var _=require(_0xa1ee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa1ee('0x1'));var moment=require(_0xa1ee('0x2'));var BPromise=require(_0xa1ee('0x3'));var rp=require(_0xa1ee('0x4'));var fs=require('fs');var path=require(_0xa1ee('0x5'));var rimraf=require(_0xa1ee('0x6'));var config=require(_0xa1ee('0x7'));var attributes=require(_0xa1ee('0x8'));module[_0xa1ee('0x9')]=function(_0x1dcba6,_0x25ca10){return _0x1dcba6[_0xa1ee('0xa')](_0xa1ee('0xb'),attributes,{'tableName':_0xa1ee('0xc'),'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 77f2310..0de88b8 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(_0x586caf,_0x509775){var _0x346412=function(_0x559294){while(--_0x559294){_0x586caf['push'](_0x586caf['shift']());}};_0x346412(++_0x509775);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x30f5bb,_0x4db4bd){_0x30f5bb=_0x30f5bb-0x0;var _0x1cfc00=_0xcb91[_0x30f5bb];return _0x1cfc00;};'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 _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0x1b2606,_0x3cbc00){var _0x166b43=function(_0x13ef5d){while(--_0x13ef5d){_0x1b2606['push'](_0x1b2606['shift']());}};_0x166b43(++_0x3cbc00);}(_0xe706,0xa3));var _0x6e70=function(_0x179604,_0x48c283){_0x179604=_0x179604-0x0;var _0x29b655=_0xe706[_0x179604];return _0x29b655;};'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']('VoiceMusicOnHold,\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']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index ea02307..de9ab66 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 _0xdced=['delete','destroy','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','/:id','show','/:id/users','getAgents','post','create','put','update'];(function(_0x2fb3c9,_0x3adbe8){var _0x2f2819=function(_0x1a399b){while(--_0x1a399b){_0x2fb3c9['push'](_0x2fb3c9['shift']());}};_0x2f2819(++_0x3adbe8);}(_0xdced,0x12f));var _0xddce=function(_0x40b7ec,_0x307707){_0x40b7ec=_0x40b7ec-0x0;var _0x72b976=_0xdced[_0x40b7ec];return _0x72b976;};'use strict';var multer=require(_0xddce('0x0'));var util=require('util');var path=require(_0xddce('0x1'));var timeout=require(_0xddce('0x2'));var express=require('express');var router=express[_0xddce('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xddce('0x4'));var interaction=require(_0xddce('0x5'));var config=require(_0xddce('0x6'));var controller=require('./voicePrefix.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xddce('0x7')]);router[_0xddce('0x8')](_0xddce('0x9'),auth[_0xddce('0xa')](),controller['describe']);router['get'](_0xddce('0xb'),auth[_0xddce('0xa')](),controller[_0xddce('0xc')]);router['get'](_0xddce('0xd'),auth['isAuthenticated'](),controller[_0xddce('0xe')]);router[_0xddce('0xf')]('/',auth[_0xddce('0xa')](),controller[_0xddce('0x10')]);router[_0xddce('0xf')]('/:id/users',auth[_0xddce('0xa')](),controller['addAgents']);router[_0xddce('0x11')](_0xddce('0xb'),auth[_0xddce('0xa')](),controller[_0xddce('0x12')]);router[_0xddce('0x13')](_0xddce('0xb'),auth[_0xddce('0xa')](),controller[_0xddce('0x14')]);router[_0xddce('0x13')](_0xddce('0xd'),auth[_0xddce('0xa')](),controller[_0xddce('0x15')]);module[_0xddce('0x16')]=router; \ No newline at end of file +var _0x29be=['delete','destroy','connect-timeout','Router','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','show','/:id/users','getAgents','post','create','addAgents','put'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x29be,0x92));var _0xe29b=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x29be[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe29b('0x0'));var express=require('express');var router=express[_0xe29b('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe29b('0x2'));var config=require('../../config/environment');var controller=require(_0xe29b('0x3'));router[_0xe29b('0x4')]('/',auth[_0xe29b('0x5')](),controller[_0xe29b('0x6')]);router[_0xe29b('0x4')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xe29b('0x4')]('/:id',auth[_0xe29b('0x5')](),controller[_0xe29b('0x7')]);router[_0xe29b('0x4')](_0xe29b('0x8'),auth[_0xe29b('0x5')](),controller[_0xe29b('0x9')]);router[_0xe29b('0xa')]('/',auth['isAuthenticated'](),controller[_0xe29b('0xb')]);router[_0xe29b('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0xe29b('0xc')]);router[_0xe29b('0xd')]('/:id',auth[_0xe29b('0x5')](),controller['update']);router[_0xe29b('0xe')]('/:id',auth[_0xe29b('0x5')](),controller[_0xe29b('0xf')]);router[_0xe29b('0xe')](_0xe29b('0x8'),auth[_0xe29b('0x5')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index d626f02..3780551 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 _0x7d5e=['VIRTUAL','system-','sequelize','exports','STRING','name'];(function(_0x1d094c,_0x168326){var _0x1e6250=function(_0x148b77){while(--_0x148b77){_0x1d094c['push'](_0x1d094c['shift']());}};_0x1e6250(++_0x168326);}(_0x7d5e,0x1ca));var _0xe7d5=function(_0x366912,_0x80d720){_0x366912=_0x366912-0x0;var _0x3f7ed6=_0x7d5e[_0x366912];return _0x3f7ed6;};'use strict';var Sequelize=require(_0xe7d5('0x0'));module[_0xe7d5('0x1')]={'name':{'type':Sequelize[_0xe7d5('0x2')],'allowNull':![],'unique':_0xe7d5('0x3')},'prefix':{'type':Sequelize[_0xe7d5('0x4')],'get':function(_0x1833b5){return _0xe7d5('0x5')+this['getDataValue'](_0xe7d5('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xe7d5('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xcc36=['name','VIRTUAL','getDataValue','INTEGER','sequelize','exports','STRING'];(function(_0x409252,_0x513a5a){var _0x20ed08=function(_0x27ba62){while(--_0x27ba62){_0x409252['push'](_0x409252['shift']());}};_0x20ed08(++_0x513a5a);}(_0xcc36,0x162));var _0x6cc3=function(_0x18bf5b,_0x370e42){_0x18bf5b=_0x18bf5b-0x0;var _0x1853e6=_0xcc36[_0x18bf5b];return _0x1853e6;};'use strict';var Sequelize=require(_0x6cc3('0x0'));module[_0x6cc3('0x1')]={'name':{'type':Sequelize[_0x6cc3('0x2')],'allowNull':![],'unique':_0x6cc3('0x3')},'prefix':{'type':Sequelize[_0x6cc3('0x4')],'get':function(_0x464514){return'system-'+this[_0x6cc3('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0x6cc3('0x2')]},'callerIdAll':{'type':Sequelize[_0x6cc3('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x6cc3('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 718b9a7..70a1cf5 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 _0x8201=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','redis','./voicePrefix.socket','register','sendStatus','status','end','undefined','limit','count','offset','json','apply','reject','save','then','get','error','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','VoicePrefix','includeAll','include','findAll','rows','catch','show','params','find','destroy','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','PREFIX-CALLERIDALL=','callerIdAll','NoOp','goto','length','charAt','system-','update','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','pick','eml-format','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x3cef02,_0x394686){var _0x10b8cc=function(_0x39684d){while(--_0x39684d){_0x3cef02['push'](_0x3cef02['shift']());}};_0x10b8cc(++_0x394686);}(_0x8201,0x71));var _0x1820=function(_0x59b2c1,_0x765d01){_0x59b2c1=_0x59b2c1-0x0;var _0x3b8f61=_0x8201[_0x59b2c1];return _0x3b8f61;};'use strict';var emlformat=require(_0x1820('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1820('0x1'));var rp=require('request-promise');var moment=require(_0x1820('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1820('0x3'));var util=require(_0x1820('0x4'));var path=require('path');var sox=require(_0x1820('0x5'));var csv=require(_0x1820('0x6'));var ejs=require(_0x1820('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1820('0x8'));var squel=require(_0x1820('0x9'));var crypto=require('crypto');var jsforce=require(_0x1820('0xa'));var deskjs=require(_0x1820('0xb'));var toCsv=require(_0x1820('0x6'));var querystring=require(_0x1820('0xc'));var Papa=require(_0x1820('0xd'));var Redis=require(_0x1820('0xe'));var authService=require(_0x1820('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1820('0x10'));var logger=require(_0x1820('0x11'))(_0x1820('0x12'));var utils=require(_0x1820('0x13'));var config=require(_0x1820('0x14'));var licenseUtil=require(_0x1820('0x15'));var db=require(_0x1820('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x1820('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1820('0x18')]));require(_0x1820('0x19'))[_0x1820('0x1a')](socket);function respondWithStatusCode(_0x5317cf,_0xc65d23){_0xc65d23=_0xc65d23||0xcc;return function(_0x516ece){if(_0x516ece){return _0x5317cf[_0x1820('0x1b')](_0xc65d23);}return _0x5317cf[_0x1820('0x1c')](_0xc65d23)[_0x1820('0x1d')]();};}function respondWithResult(_0x20eb5e,_0x5b3332){_0x5b3332=_0x5b3332||0xc8;return function(_0x416660){if(_0x416660){return _0x20eb5e[_0x1820('0x1c')](_0x5b3332)['json'](_0x416660);}};}function respondWithFilteredResult(_0xa2378e,_0x3c824c){return function(_0x2d12a4){if(_0x2d12a4){var _0x3cf990=typeof _0x3c824c['offset']===_0x1820('0x1e')&&typeof _0x3c824c[_0x1820('0x1f')]===_0x1820('0x1e');var _0x2f240f=_0x2d12a4[_0x1820('0x20')];var _0x343664=_0x3cf990?0x0:_0x3c824c[_0x1820('0x21')];var _0x2efe44=_0x3cf990?_0x2d12a4['count']:_0x3c824c[_0x1820('0x21')]+_0x3c824c[_0x1820('0x1f')];var _0x22ec43;if(_0x2efe44>=_0x2f240f){_0x2efe44=_0x2f240f;_0x22ec43=0xc8;}else{_0x22ec43=0xce;}_0xa2378e[_0x1820('0x1c')](_0x22ec43);return _0xa2378e['set']('Content-Range',_0x343664+'-'+_0x2efe44+'/'+_0x2f240f)[_0x1820('0x22')](_0x2d12a4);}return null;};}function patchUpdates(_0x3702ea){return function(_0x57e4c7){try{jsonpatch[_0x1820('0x23')](_0x57e4c7,_0x3702ea,!![]);}catch(_0x2840b4){return BPromise[_0x1820('0x24')](_0x2840b4);}return _0x57e4c7[_0x1820('0x25')]();};}function saveUpdates(_0x2d9074,_0x485c71){return function(_0x556319){if(_0x556319){return _0x556319['update'](_0x2d9074)[_0x1820('0x26')](function(_0x55badd){return _0x55badd;});}return null;};}function removeEntity(_0x58643f,_0x2af5f8){return function(_0x47ce0a){if(_0x47ce0a){return _0x47ce0a['destroy']()[_0x1820('0x26')](function(){var _0x3be5bf=_0x47ce0a[_0x1820('0x27')]({'plain':!![]});var _0x486b99='VoicePrefixes';return db['UserProfileResource']['destroy']({'where':{'type':_0x486b99,'resourceId':_0x3be5bf['id']}})[_0x1820('0x26')](function(){return _0x47ce0a;});})['then'](function(){_0x58643f[_0x1820('0x1c')](0xcc)[_0x1820('0x1d')]();});}};}function handleEntityNotFound(_0x3d535d,_0x12aa88){return function(_0x1b93f8){if(!_0x1b93f8){_0x3d535d[_0x1820('0x1b')](0x194);}return _0x1b93f8;};}function handleError(_0x4bce70,_0x3a9cd3){_0x3a9cd3=_0x3a9cd3||0x1f4;return function(_0x2b8209){logger[_0x1820('0x28')](_0x2b8209['stack']);if(_0x2b8209[_0x1820('0x29')]){delete _0x2b8209['name'];}_0x4bce70[_0x1820('0x1c')](_0x3a9cd3)['send'](_0x2b8209);};}exports[_0x1820('0x2a')]=function(_0x509159,_0x459a46){var _0x219d41={},_0x512d77={},_0x340297={'count':0x0,'rows':[]};var _0x4eb5c4=_[_0x1820('0x2b')](db['VoicePrefix'][_0x1820('0x2c')],function(_0x3ea77c){return{'name':_0x3ea77c[_0x1820('0x2d')],'type':_0x3ea77c[_0x1820('0x2e')]['key']};});_0x512d77[_0x1820('0x2f')]=_['map'](_0x4eb5c4,_0x1820('0x29'));_0x512d77[_0x1820('0x30')]=_[_0x1820('0x31')](_0x509159['query']);_0x512d77[_0x1820('0x32')]=_[_0x1820('0x33')](_0x512d77[_0x1820('0x2f')],_0x512d77['query']);_0x219d41[_0x1820('0x34')]=_[_0x1820('0x33')](_0x512d77['model'],qs['fields'](_0x509159[_0x1820('0x30')][_0x1820('0x35')]));_0x219d41[_0x1820('0x34')]=_0x219d41[_0x1820('0x34')]['length']?_0x219d41[_0x1820('0x34')]:_0x512d77[_0x1820('0x2f')];if(!_0x509159[_0x1820('0x30')][_0x1820('0x36')](_0x1820('0x37'))){_0x219d41[_0x1820('0x1f')]=qs[_0x1820('0x1f')](_0x509159['query'][_0x1820('0x1f')]);_0x219d41[_0x1820('0x21')]=qs[_0x1820('0x21')](_0x509159[_0x1820('0x30')]['offset']);}_0x219d41[_0x1820('0x38')]=qs[_0x1820('0x39')](_0x509159['query'][_0x1820('0x39')]);_0x219d41['where']=qs['filters'](_['pick'](_0x509159['query'],_0x512d77[_0x1820('0x32')]),_0x4eb5c4);if(_0x509159[_0x1820('0x30')]['filter']){_0x219d41[_0x1820('0x3a')]=_[_0x1820('0x3b')](_0x219d41[_0x1820('0x3a')],{'$or':_[_0x1820('0x2b')](_0x4eb5c4,function(_0x5381de){if(_0x5381de['type']!==_0x1820('0x3c')){var _0x90f6fb={};_0x90f6fb[_0x5381de[_0x1820('0x29')]]={'$like':'%'+_0x509159[_0x1820('0x30')][_0x1820('0x3d')]+'%'};return _0x90f6fb;}})});}_0x219d41=_[_0x1820('0x3b')]({},_0x219d41,_0x509159[_0x1820('0x3e')]);var _0x55d7c2={'where':_0x219d41[_0x1820('0x3a')]};return db[_0x1820('0x3f')][_0x1820('0x20')](_0x55d7c2)[_0x1820('0x26')](function(_0x5727ae){_0x340297[_0x1820('0x20')]=_0x5727ae;if(_0x509159[_0x1820('0x30')][_0x1820('0x40')]){_0x219d41[_0x1820('0x41')]=[{'all':!![]}];}return db[_0x1820('0x3f')][_0x1820('0x42')](_0x219d41);})[_0x1820('0x26')](function(_0x2db8ea){_0x340297[_0x1820('0x43')]=_0x2db8ea;return _0x340297;})['then'](respondWithFilteredResult(_0x459a46,_0x219d41))[_0x1820('0x44')](handleError(_0x459a46,null));};exports[_0x1820('0x45')]=function(_0x51c342,_0x35ea87){var _0x1fe272={'raw':![],'where':{'id':_0x51c342[_0x1820('0x46')]['id']}},_0x3037fa={};_0x3037fa[_0x1820('0x2f')]=_[_0x1820('0x31')](db[_0x1820('0x3f')][_0x1820('0x2c')]);_0x3037fa[_0x1820('0x30')]=_['keys'](_0x51c342[_0x1820('0x30')]);_0x3037fa[_0x1820('0x32')]=_[_0x1820('0x33')](_0x3037fa['model'],_0x3037fa[_0x1820('0x30')]);_0x1fe272[_0x1820('0x34')]=_[_0x1820('0x33')](_0x3037fa['model'],qs['fields'](_0x51c342[_0x1820('0x30')][_0x1820('0x35')]));_0x1fe272[_0x1820('0x34')]=_0x1fe272[_0x1820('0x34')]['length']?_0x1fe272['attributes']:_0x3037fa[_0x1820('0x2f')];if(_0x51c342['query'][_0x1820('0x40')]){_0x1fe272[_0x1820('0x41')]=[{'all':!![]}];}_0x1fe272=_[_0x1820('0x3b')]({},_0x1fe272,_0x51c342[_0x1820('0x3e')]);return db['VoicePrefix'][_0x1820('0x47')](_0x1fe272)[_0x1820('0x26')](handleEntityNotFound(_0x35ea87,null))[_0x1820('0x26')](respondWithResult(_0x35ea87,null))[_0x1820('0x44')](handleError(_0x35ea87,null));};exports[_0x1820('0x48')]=function(_0x24607e,_0x23b01c){return db[_0x1820('0x3f')][_0x1820('0x47')]({'where':{'id':_0x24607e[_0x1820('0x46')]['id']}})[_0x1820('0x26')](handleEntityNotFound(_0x23b01c,null))[_0x1820('0x26')](removeEntity(_0x23b01c,null))[_0x1820('0x44')](handleError(_0x23b01c,null));};exports['describe']=function(_0x4445dc,_0x5e3868){return db['VoicePrefix'][_0x1820('0x49')]()[_0x1820('0x26')](respondWithResult(_0x5e3868,null))[_0x1820('0x44')](handleError(_0x5e3868,null));};exports[_0x1820('0x4a')]=function(_0x27ff15,_0x353fea){var _0x24fbef;return db[_0x1820('0x4b')][_0x1820('0x4c')](function(_0x1f7521){return db[_0x1820('0x3f')]['create'](_0x27ff15[_0x1820('0x4d')],{'transaction':_0x1f7521})[_0x1820('0x26')](function(_0x1f5611){_0x24fbef=_0x1f5611[_0x1820('0x27')]({'plain':!![]});return db[_0x1820('0x4e')][_0x1820('0x47')]({'where':{'id':_0x24fbef[_0x1820('0x4f')]},'raw':!![]})['then'](function(_0x345330){return createVoicePrefixExtensions(_0x24fbef,_0x345330,_0x1f7521);});});})[_0x1820('0x26')](function(){var _0x372682=_0x27ff15[_0x1820('0x50')][_0x1820('0x27')]({'plain':!![]});if(!_0x372682)throw new Error(_0x1820('0x51'));if(_0x372682[_0x1820('0x52')]===_0x1820('0x50')){var _0x32b2e3=_0x24fbef;return db[_0x1820('0x53')][_0x1820('0x47')]({'where':{'name':_0x1820('0x54'),'userProfileId':_0x372682[_0x1820('0x55')]},'raw':!![]})['then'](function(_0x2ff401){if(_0x2ff401&&_0x2ff401[_0x1820('0x56')]===0x0){return db[_0x1820('0x57')][_0x1820('0x4a')]({'name':_0x32b2e3['name'],'resourceId':_0x32b2e3['id'],'type':_0x2ff401[_0x1820('0x29')],'sectionId':_0x2ff401['id']},{})['then'](function(){return _0x24fbef;});}else{return _0x24fbef;}})[_0x1820('0x44')](function(_0x11fe99){logger[_0x1820('0x28')](_0x1820('0x58'),_0x11fe99);throw _0x11fe99;});}return _0x24fbef;})['then'](respondWithResult(_0x353fea,null))[_0x1820('0x44')](handleError(_0x353fea,null));};function Extension(_0xf1ab90,_0x1c933c,_0x509cc2,_0x351f4a){this[_0x1820('0x59')]=_0x1820('0x5a');this[_0x1820('0x5b')]=_0xf1ab90;this['app']=_0x509cc2;this[_0x1820('0x2e')]=_0x1820('0x5c');this['description']=_0x1820('0x5d');this[_0x1820('0x5e')]=_0x1c933c;this[_0x1820('0x5f')]=_0x351f4a;}function createVoicePrefixExtensions(_0x4adcb1,_0x3d32d8,_0x5aa1d9){return new BPromise(function(_0x518961,_0x2001b2){var _0xfdd76b=new Extension(formatPrefixName(_0x4adcb1[_0x1820('0x60')]),0x1,'NoOp',_0x1820('0x61'));_0xfdd76b[_0x1820('0x62')]=_0x4adcb1['id'];return db['VoiceExtension']['create'](_0xfdd76b,{'transaction':_0x5aa1d9})[_0x1820('0x26')](function(_0x545b21){var _0x394b27=_0x545b21[_0x1820('0x27')]({'plain':!![]});var _0x4106ab=_[_0x1820('0x2b')](addVoicePrefixExtensions(_0x4adcb1,_0x3d32d8),function(_0x98f1d7){_0x98f1d7[_0x1820('0x4f')]=_0x394b27['id'];_0x98f1d7[_0x1820('0x62')]=_0x4adcb1['id'];return _0x98f1d7;});return db[_0x1820('0x4e')][_0x1820('0x63')](_0x4106ab,{'transaction':_0x5aa1d9})[_0x1820('0x26')](function(_0x48a651){if(!_0x48a651){return _0x2001b2(_0x1820('0x64'));}else{return _0x518961(_0x48a651);}})['catch'](function(_0x47fdfe){return _0x2001b2(_0x47fdfe);});});;});};function addVoicePrefixExtensions(_0x5b62e1,_0x44889f){var _0x4b76cd=[];var _0x1a3440=formatPrefixName(_0x5b62e1[_0x1820('0x60')]);_0x4b76cd[_0x1820('0x65')](new Extension(_0x1a3440,0x2,_0x1820('0x66'),'CDR(prefix)='+_0x5b62e1[_0x1820('0x29')]));if(_0x5b62e1['callerIdAll']){_0x4b76cd[_0x1820('0x65')](new Extension(_0x1a3440,0x3,_0x1820('0x66'),_0x1820('0x67')+_0x5b62e1[_0x1820('0x68')]));}else{_0x4b76cd['push'](new Extension(_0x1a3440,0x3,_0x1820('0x69'),'No\x20callerid\x20available'));}_0x4b76cd[_0x1820('0x65')](new Extension(_0x1a3440,0x4,_0x1820('0x6a'),_0x44889f[_0x1820('0x59')]+','+'${EXTEN:'+(0x8+_0x5b62e1['name']['length'])+'}'+','+0x1));return _0x4b76cd;}function formatPrefixName(_0x43dfb9){var _0x51502c='_';for(var _0x3f71c3=0x0;_0x3f71c3<_0x43dfb9[_0x1820('0x6b')];_0x3f71c3++){if(_0x43dfb9['charAt'](_0x3f71c3)=='-'){_0x51502c+=_0x43dfb9[_0x1820('0x6c')](_0x3f71c3);}else{_0x51502c+='['+_0x43dfb9[_0x1820('0x6c')](_0x3f71c3)+']';}}_0x51502c+='.';return _0x51502c;}exports['update']=function(_0x6e072c,_0x3bc5c2,_0x5129cf){var _0x18ea39=_0x6e072c[_0x1820('0x4d')];_0x18ea39[_0x1820('0x60')]=_0x1820('0x6d')+_0x18ea39['name']+'-';return db['sequelize']['transaction'](function(_0x3a3e66){return db[_0x1820('0x3f')][_0x1820('0x6e')](_0x18ea39,{'where':{'id':_0x18ea39['id']},'transaction':_0x3a3e66})['then'](function(){return db[_0x1820('0x4e')][_0x1820('0x48')]({'where':{'VoicePrefixId':_0x18ea39['id']},'transaction':_0x3a3e66})[_0x1820('0x26')](function(){return db[_0x1820('0x4e')][_0x1820('0x47')]({'where':{'id':_0x18ea39['VoiceExtensionId']},'raw':!![]})[_0x1820('0x26')](function(_0xf3bb6f){return createVoicePrefixExtensions(_0x18ea39,_0xf3bb6f,_0x3a3e66);});});});})[_0x1820('0x26')](function(){return db[_0x1820('0x3f')][_0x1820('0x6f')](_0x18ea39['id']);})[_0x1820('0x26')](respondWithResult(_0x3bc5c2,null))[_0x1820('0x44')](handleError(_0x3bc5c2,null));};exports[_0x1820('0x70')]=function(_0x50bb3a,_0x3e356b,_0x2e3547){return db[_0x1820('0x3f')][_0x1820('0x47')]({'where':{'id':_0x50bb3a[_0x1820('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e356b,null))[_0x1820('0x26')](function(_0x3836fc){if(_0x3836fc){return _0x3836fc[_0x1820('0x70')](_0x50bb3a[_0x1820('0x4d')][_0x1820('0x71')],_[_0x1820('0x72')](_0x50bb3a[_0x1820('0x4d')],[_0x1820('0x71'),'id'])||{})[_0x1820('0x73')](function(_0x45148d){for(var _0x1453ed=0x0;_0x1453ed<_0x50bb3a[_0x1820('0x4d')]['ids'][_0x1820('0x6b')];_0x1453ed+=0x1){socket[_0x1820('0x74')](_0x1820('0x75'),{'UserId':Number(_0x50bb3a[_0x1820('0x4d')][_0x1820('0x71')][_0x1453ed]),'VoicePrefixId':Number(_0x50bb3a[_0x1820('0x46')]['id'])});}return _0x45148d;});}})[_0x1820('0x26')](respondWithResult(_0x3e356b,null))['catch'](handleError(_0x3e356b,null));};exports[_0x1820('0x76')]=function(_0x47492f,_0x1e3b08,_0x4a86ba){return db[_0x1820('0x3f')][_0x1820('0x47')]({'where':{'id':_0x47492f[_0x1820('0x46')]['id']}})['then'](handleEntityNotFound(_0x1e3b08,null))[_0x1820('0x26')](function(_0x563f00){if(_0x563f00){return _0x563f00[_0x1820('0x76')](_0x47492f[_0x1820('0x30')][_0x1820('0x71')])['then'](function(){if(_[_0x1820('0x77')](_0x47492f[_0x1820('0x30')][_0x1820('0x71')])){for(var _0x9d2b8a=0x0;_0x9d2b8a<_0x47492f[_0x1820('0x30')][_0x1820('0x71')][_0x1820('0x6b')];_0x9d2b8a+=0x1){socket[_0x1820('0x74')](_0x1820('0x78'),{'UserId':Number(_0x47492f[_0x1820('0x30')][_0x1820('0x71')][_0x9d2b8a]),'VoicePrefixId':Number(_0x47492f[_0x1820('0x46')]['id'])});}}else{socket[_0x1820('0x74')](_0x1820('0x78'),{'UserId':Number(_0x47492f[_0x1820('0x30')]['ids']),'VoicePrefixId':Number(_0x47492f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1e3b08,null))[_0x1820('0x44')](handleError(_0x1e3b08,null));};exports[_0x1820('0x79')]=function(_0x5ef58a,_0x33a974,_0x319c62){var _0x203f8f={};var _0x20bb2e={};var _0x1ab4a5;var _0x32e897;return db[_0x1820('0x3f')]['findOne']({'where':{'id':_0x5ef58a['params']['id']}})[_0x1820('0x26')](handleEntityNotFound(_0x33a974,null))[_0x1820('0x26')](function(_0x1bd2d4){if(_0x1bd2d4){_0x1ab4a5=_0x1bd2d4;_0x20bb2e['model']=_['keys'](db[_0x1820('0x7a')][_0x1820('0x2c')]);_0x20bb2e['query']=_[_0x1820('0x31')](_0x5ef58a[_0x1820('0x30')]);_0x20bb2e['filters']=_[_0x1820('0x33')](_0x20bb2e['model'],_0x20bb2e[_0x1820('0x30')]);_0x203f8f[_0x1820('0x34')]=_[_0x1820('0x33')](_0x20bb2e[_0x1820('0x2f')],qs['fields'](_0x5ef58a[_0x1820('0x30')]['fields']));_0x203f8f[_0x1820('0x34')]=_0x203f8f[_0x1820('0x34')][_0x1820('0x6b')]?_0x203f8f['attributes']:_0x20bb2e[_0x1820('0x2f')];_0x203f8f[_0x1820('0x38')]=qs[_0x1820('0x39')](_0x5ef58a[_0x1820('0x30')][_0x1820('0x39')]);_0x203f8f[_0x1820('0x3a')]=qs['filters'](_[_0x1820('0x7b')](_0x5ef58a['query'],_0x20bb2e[_0x1820('0x32')]));if(_0x5ef58a[_0x1820('0x30')]['filter']){_0x203f8f[_0x1820('0x3a')]=_['merge'](_0x203f8f[_0x1820('0x3a')],{'$or':_[_0x1820('0x2b')](_0x203f8f[_0x1820('0x34')],function(_0x444c03){var _0x28360d={};_0x28360d[_0x444c03]={'$like':'%'+_0x5ef58a[_0x1820('0x30')][_0x1820('0x3d')]+'%'};return _0x28360d;})});}_0x203f8f=_['merge']({},_0x203f8f,_0x5ef58a[_0x1820('0x3e')]);return _0x1ab4a5['getAgents'](_0x203f8f);}})[_0x1820('0x26')](function(_0x2a4b3e){if(_0x2a4b3e){_0x32e897=_0x2a4b3e[_0x1820('0x6b')];if(!_0x5ef58a['query'][_0x1820('0x36')]('nolimit')){_0x203f8f['limit']=qs[_0x1820('0x1f')](_0x5ef58a['query']['limit']);_0x203f8f[_0x1820('0x21')]=qs[_0x1820('0x21')](_0x5ef58a[_0x1820('0x30')][_0x1820('0x21')]);}return _0x1ab4a5['getAgents'](_0x203f8f);}})['then'](function(_0x196c40){if(_0x196c40){return _0x196c40?{'count':_0x32e897,'rows':_0x196c40}:null;}})[_0x1820('0x26')](respondWithResult(_0x33a974,null))[_0x1820('0x44')](handleError(_0x33a974,null));}; \ No newline at end of file +var _0xd403=['defaults','redis','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','VoicePrefixes','UserProfileResource','then','error','stack','name','send','VoicePrefix','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','charAt','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','getAgents','User','pick','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x2b737c,_0x274adf){var _0x466ed5=function(_0x593124){while(--_0x593124){_0x2b737c['push'](_0x2b737c['shift']());}};_0x466ed5(++_0x274adf);}(_0xd403,0x1d5));var _0x3d40=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xd403[_0x243b59];return _0x3e1676;};'use strict';var emlformat=require(_0x3d40('0x0'));var rimraf=require(_0x3d40('0x1'));var zipdir=require(_0x3d40('0x2'));var jsonpatch=require(_0x3d40('0x3'));var rp=require('request-promise');var moment=require(_0x3d40('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3d40('0x5'));var util=require(_0x3d40('0x6'));var path=require(_0x3d40('0x7'));var sox=require(_0x3d40('0x8'));var csv=require(_0x3d40('0x9'));var ejs=require(_0x3d40('0xa'));var fs=require('fs');var fs_extra=require(_0x3d40('0xb'));var _=require(_0x3d40('0xc'));var squel=require(_0x3d40('0xd'));var crypto=require(_0x3d40('0xe'));var jsforce=require(_0x3d40('0xf'));var deskjs=require(_0x3d40('0x10'));var toCsv=require(_0x3d40('0x9'));var querystring=require(_0x3d40('0x11'));var Papa=require(_0x3d40('0x12'));var Redis=require(_0x3d40('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3d40('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d40('0x15'));var logger=require(_0x3d40('0x16'))(_0x3d40('0x17'));var utils=require('../../config/utils');var config=require(_0x3d40('0x18'));var licenseUtil=require(_0x3d40('0x19'));var db=require(_0x3d40('0x1a'))['db'];config['redis']=_[_0x3d40('0x1b')](config[_0x3d40('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d40('0x1c')]));require(_0x3d40('0x1d'))[_0x3d40('0x1e')](socket);function respondWithStatusCode(_0x5062ec,_0x2fc2cb){_0x2fc2cb=_0x2fc2cb||0xcc;return function(_0x1e6400){if(_0x1e6400){return _0x5062ec[_0x3d40('0x1f')](_0x2fc2cb);}return _0x5062ec[_0x3d40('0x20')](_0x2fc2cb)[_0x3d40('0x21')]();};}function respondWithResult(_0x359e9d,_0x47c0ea){_0x47c0ea=_0x47c0ea||0xc8;return function(_0x4d6429){if(_0x4d6429){return _0x359e9d['status'](_0x47c0ea)[_0x3d40('0x22')](_0x4d6429);}};}function respondWithFilteredResult(_0x2f38e1,_0x41fd78){return function(_0x75437e){if(_0x75437e){var _0x2f71a4=typeof _0x41fd78[_0x3d40('0x23')]===_0x3d40('0x24')&&typeof _0x41fd78[_0x3d40('0x25')]===_0x3d40('0x24');var _0x402b4e=_0x75437e[_0x3d40('0x26')];var _0x4a0687=_0x2f71a4?0x0:_0x41fd78['offset'];var _0x3a3bc4=_0x2f71a4?_0x75437e[_0x3d40('0x26')]:_0x41fd78[_0x3d40('0x23')]+_0x41fd78[_0x3d40('0x25')];var _0x28b1c0;if(_0x3a3bc4>=_0x402b4e){_0x3a3bc4=_0x402b4e;_0x28b1c0=0xc8;}else{_0x28b1c0=0xce;}_0x2f38e1[_0x3d40('0x20')](_0x28b1c0);return _0x2f38e1[_0x3d40('0x27')](_0x3d40('0x28'),_0x4a0687+'-'+_0x3a3bc4+'/'+_0x402b4e)[_0x3d40('0x22')](_0x75437e);}return null;};}function patchUpdates(_0x321bc2){return function(_0x1c1309){try{jsonpatch[_0x3d40('0x29')](_0x1c1309,_0x321bc2,!![]);}catch(_0x181688){return BPromise['reject'](_0x181688);}return _0x1c1309[_0x3d40('0x2a')]();};}function saveUpdates(_0x14cad3,_0x33015d){return function(_0x1341c1){if(_0x1341c1){return _0x1341c1[_0x3d40('0x2b')](_0x14cad3)['then'](function(_0x45aa46){return _0x45aa46;});}return null;};}function removeEntity(_0x28c438,_0x3cc4df){return function(_0x47499a){if(_0x47499a){return _0x47499a[_0x3d40('0x2c')]()['then'](function(){var _0x26844b=_0x47499a[_0x3d40('0x2d')]({'plain':!![]});var _0x4e4ee9=_0x3d40('0x2e');return db[_0x3d40('0x2f')][_0x3d40('0x2c')]({'where':{'type':_0x4e4ee9,'resourceId':_0x26844b['id']}})['then'](function(){return _0x47499a;});})[_0x3d40('0x30')](function(){_0x28c438[_0x3d40('0x20')](0xcc)[_0x3d40('0x21')]();});}};}function handleEntityNotFound(_0x23b7d2,_0x30d626){return function(_0x2db6f3){if(!_0x2db6f3){_0x23b7d2[_0x3d40('0x1f')](0x194);}return _0x2db6f3;};}function handleError(_0x19cc1f,_0x5d8ae7){_0x5d8ae7=_0x5d8ae7||0x1f4;return function(_0x4e536f){logger[_0x3d40('0x31')](_0x4e536f[_0x3d40('0x32')]);if(_0x4e536f['name']){delete _0x4e536f[_0x3d40('0x33')];}_0x19cc1f['status'](_0x5d8ae7)[_0x3d40('0x34')](_0x4e536f);};}exports['index']=function(_0x30a57f,_0xbff1f2){var _0x2d3ec6={},_0x1c482d={},_0x3bb717={'count':0x0,'rows':[]};var _0x4e5ae1=_['map'](db[_0x3d40('0x35')][_0x3d40('0x36')],function(_0x917bf1){return{'name':_0x917bf1['fieldName'],'type':_0x917bf1[_0x3d40('0x37')]['key']};});_0x1c482d['model']=_['map'](_0x4e5ae1,_0x3d40('0x33'));_0x1c482d[_0x3d40('0x38')]=_[_0x3d40('0x39')](_0x30a57f[_0x3d40('0x38')]);_0x1c482d[_0x3d40('0x3a')]=_[_0x3d40('0x3b')](_0x1c482d[_0x3d40('0x3c')],_0x1c482d[_0x3d40('0x38')]);_0x2d3ec6[_0x3d40('0x3d')]=_['intersection'](_0x1c482d['model'],qs[_0x3d40('0x3e')](_0x30a57f[_0x3d40('0x38')][_0x3d40('0x3e')]));_0x2d3ec6[_0x3d40('0x3d')]=_0x2d3ec6[_0x3d40('0x3d')][_0x3d40('0x3f')]?_0x2d3ec6['attributes']:_0x1c482d[_0x3d40('0x3c')];if(!_0x30a57f[_0x3d40('0x38')][_0x3d40('0x40')]('nolimit')){_0x2d3ec6[_0x3d40('0x25')]=qs['limit'](_0x30a57f[_0x3d40('0x38')][_0x3d40('0x25')]);_0x2d3ec6['offset']=qs[_0x3d40('0x23')](_0x30a57f['query']['offset']);}_0x2d3ec6[_0x3d40('0x41')]=qs[_0x3d40('0x42')](_0x30a57f['query'][_0x3d40('0x42')]);_0x2d3ec6[_0x3d40('0x43')]=qs[_0x3d40('0x3a')](_['pick'](_0x30a57f[_0x3d40('0x38')],_0x1c482d[_0x3d40('0x3a')]),_0x4e5ae1);if(_0x30a57f[_0x3d40('0x38')][_0x3d40('0x44')]){_0x2d3ec6[_0x3d40('0x43')]=_[_0x3d40('0x45')](_0x2d3ec6[_0x3d40('0x43')],{'$or':_[_0x3d40('0x46')](_0x4e5ae1,function(_0xc79909){if(_0xc79909[_0x3d40('0x37')]!==_0x3d40('0x47')){var _0x4b3a83={};_0x4b3a83[_0xc79909[_0x3d40('0x33')]]={'$like':'%'+_0x30a57f['query']['filter']+'%'};return _0x4b3a83;}})});}_0x2d3ec6=_['merge']({},_0x2d3ec6,_0x30a57f[_0x3d40('0x48')]);var _0x32b284={'where':_0x2d3ec6[_0x3d40('0x43')]};return db['VoicePrefix'][_0x3d40('0x26')](_0x32b284)[_0x3d40('0x30')](function(_0x46e59d){_0x3bb717[_0x3d40('0x26')]=_0x46e59d;if(_0x30a57f['query'][_0x3d40('0x49')]){_0x2d3ec6[_0x3d40('0x4a')]=[{'all':!![]}];}return db[_0x3d40('0x35')][_0x3d40('0x4b')](_0x2d3ec6);})[_0x3d40('0x30')](function(_0x4387f5){_0x3bb717[_0x3d40('0x4c')]=_0x4387f5;return _0x3bb717;})[_0x3d40('0x30')](respondWithFilteredResult(_0xbff1f2,_0x2d3ec6))[_0x3d40('0x4d')](handleError(_0xbff1f2,null));};exports[_0x3d40('0x4e')]=function(_0x5f3d6e,_0x528081){var _0x26449f={'raw':![],'where':{'id':_0x5f3d6e[_0x3d40('0x4f')]['id']}},_0x1b5988={};_0x1b5988[_0x3d40('0x3c')]=_[_0x3d40('0x39')](db[_0x3d40('0x35')][_0x3d40('0x36')]);_0x1b5988[_0x3d40('0x38')]=_[_0x3d40('0x39')](_0x5f3d6e['query']);_0x1b5988['filters']=_[_0x3d40('0x3b')](_0x1b5988[_0x3d40('0x3c')],_0x1b5988[_0x3d40('0x38')]);_0x26449f[_0x3d40('0x3d')]=_[_0x3d40('0x3b')](_0x1b5988['model'],qs[_0x3d40('0x3e')](_0x5f3d6e[_0x3d40('0x38')]['fields']));_0x26449f['attributes']=_0x26449f['attributes'][_0x3d40('0x3f')]?_0x26449f[_0x3d40('0x3d')]:_0x1b5988[_0x3d40('0x3c')];if(_0x5f3d6e['query'][_0x3d40('0x49')]){_0x26449f['include']=[{'all':!![]}];}_0x26449f=_['merge']({},_0x26449f,_0x5f3d6e[_0x3d40('0x48')]);return db[_0x3d40('0x35')][_0x3d40('0x50')](_0x26449f)[_0x3d40('0x30')](handleEntityNotFound(_0x528081,null))['then'](respondWithResult(_0x528081,null))[_0x3d40('0x4d')](handleError(_0x528081,null));};exports['destroy']=function(_0x3801ac,_0xbd7a8e){return db['VoicePrefix']['find']({'where':{'id':_0x3801ac[_0x3d40('0x4f')]['id']}})[_0x3d40('0x30')](handleEntityNotFound(_0xbd7a8e,null))[_0x3d40('0x30')](removeEntity(_0xbd7a8e,null))[_0x3d40('0x4d')](handleError(_0xbd7a8e,null));};exports[_0x3d40('0x51')]=function(_0x55a098,_0x5590e3){return db[_0x3d40('0x35')][_0x3d40('0x51')]()[_0x3d40('0x30')](respondWithResult(_0x5590e3,null))[_0x3d40('0x4d')](handleError(_0x5590e3,null));};exports[_0x3d40('0x52')]=function(_0x198846,_0x5c2619){var _0x20bdd3;return db[_0x3d40('0x53')][_0x3d40('0x54')](function(_0x10223d){return db[_0x3d40('0x35')][_0x3d40('0x52')](_0x198846[_0x3d40('0x55')],{'transaction':_0x10223d})[_0x3d40('0x30')](function(_0x2067fd){_0x20bdd3=_0x2067fd[_0x3d40('0x2d')]({'plain':!![]});return db[_0x3d40('0x56')][_0x3d40('0x50')]({'where':{'id':_0x20bdd3[_0x3d40('0x57')]},'raw':!![]})[_0x3d40('0x30')](function(_0x56bcce){return createVoicePrefixExtensions(_0x20bdd3,_0x56bcce,_0x10223d);});});})['then'](function(){var _0x5a2fff=_0x198846['user']['get']({'plain':!![]});if(!_0x5a2fff)throw new Error(_0x3d40('0x58'));if(_0x5a2fff['role']===_0x3d40('0x59')){var _0x59396b=_0x20bdd3;return db['UserProfileSection'][_0x3d40('0x50')]({'where':{'name':_0x3d40('0x2e'),'userProfileId':_0x5a2fff['userProfileId']},'raw':!![]})[_0x3d40('0x30')](function(_0x305bb5){if(_0x305bb5&&_0x305bb5[_0x3d40('0x5a')]===0x0){return db['UserProfileResource'][_0x3d40('0x52')]({'name':_0x59396b['name'],'resourceId':_0x59396b['id'],'type':_0x305bb5[_0x3d40('0x33')],'sectionId':_0x305bb5['id']},{})['then'](function(){return _0x20bdd3;});}else{return _0x20bdd3;}})['catch'](function(_0x4c30a6){logger[_0x3d40('0x31')](_0x3d40('0x5b'),_0x4c30a6);throw _0x4c30a6;});}return _0x20bdd3;})['then'](respondWithResult(_0x5c2619,null))[_0x3d40('0x4d')](handleError(_0x5c2619,null));};function Extension(_0x5caa26,_0x4d438a,_0x2a8cf9,_0x5f121d){this[_0x3d40('0x5c')]='from-sip';this['exten']=_0x5caa26;this[_0x3d40('0x5d')]=_0x2a8cf9;this['type']=_0x3d40('0x5e');this[_0x3d40('0x5f')]=_0x3d40('0x60');this[_0x3d40('0x61')]=_0x4d438a;this[_0x3d40('0x62')]=_0x5f121d;}function createVoicePrefixExtensions(_0x4c761e,_0x358999,_0x1d6445){return new BPromise(function(_0x3457fa,_0x34f02a){var _0x48004a=new Extension(formatPrefixName(_0x4c761e[_0x3d40('0x63')]),0x1,_0x3d40('0x64'),_0x3d40('0x65'));_0x48004a['VoicePrefixId']=_0x4c761e['id'];return db[_0x3d40('0x56')][_0x3d40('0x52')](_0x48004a,{'transaction':_0x1d6445})[_0x3d40('0x30')](function(_0x385f41){var _0x2a920c=_0x385f41['get']({'plain':!![]});var _0x850ccc=_[_0x3d40('0x46')](addVoicePrefixExtensions(_0x4c761e,_0x358999),function(_0x42621c){_0x42621c[_0x3d40('0x57')]=_0x2a920c['id'];_0x42621c[_0x3d40('0x66')]=_0x4c761e['id'];return _0x42621c;});return db[_0x3d40('0x56')][_0x3d40('0x67')](_0x850ccc,{'transaction':_0x1d6445})['then'](function(_0x5d14f8){if(!_0x5d14f8){return _0x34f02a('Extensions\x20creation\x20failed');}else{return _0x3457fa(_0x5d14f8);}})['catch'](function(_0x2e70f2){return _0x34f02a(_0x2e70f2);});});;});};function addVoicePrefixExtensions(_0x5a9e25,_0x3fca59){var _0x471d78=[];var _0x19f033=formatPrefixName(_0x5a9e25[_0x3d40('0x63')]);_0x471d78[_0x3d40('0x68')](new Extension(_0x19f033,0x2,_0x3d40('0x69'),_0x3d40('0x6a')+_0x5a9e25[_0x3d40('0x33')]));if(_0x5a9e25[_0x3d40('0x6b')]){_0x471d78['push'](new Extension(_0x19f033,0x3,_0x3d40('0x69'),_0x3d40('0x6c')+_0x5a9e25[_0x3d40('0x6b')]));}else{_0x471d78[_0x3d40('0x68')](new Extension(_0x19f033,0x3,_0x3d40('0x64'),_0x3d40('0x6d')));}_0x471d78[_0x3d40('0x68')](new Extension(_0x19f033,0x4,_0x3d40('0x6e'),_0x3fca59[_0x3d40('0x5c')]+','+'${EXTEN:'+(0x8+_0x5a9e25[_0x3d40('0x33')][_0x3d40('0x3f')])+'}'+','+0x1));return _0x471d78;}function formatPrefixName(_0x3077e0){var _0x11fc54='_';for(var _0x2cfc63=0x0;_0x2cfc63<_0x3077e0[_0x3d40('0x3f')];_0x2cfc63++){if(_0x3077e0['charAt'](_0x2cfc63)=='-'){_0x11fc54+=_0x3077e0[_0x3d40('0x6f')](_0x2cfc63);}else{_0x11fc54+='['+_0x3077e0[_0x3d40('0x6f')](_0x2cfc63)+']';}}_0x11fc54+='.';return _0x11fc54;}exports[_0x3d40('0x2b')]=function(_0x2d6c09,_0x578fe7,_0x59dc7b){var _0x404303=_0x2d6c09[_0x3d40('0x55')];_0x404303[_0x3d40('0x63')]='system-'+_0x404303[_0x3d40('0x33')]+'-';return db[_0x3d40('0x53')][_0x3d40('0x54')](function(_0x50480b){return db[_0x3d40('0x35')]['update'](_0x404303,{'where':{'id':_0x404303['id']},'transaction':_0x50480b})[_0x3d40('0x30')](function(){return db[_0x3d40('0x56')][_0x3d40('0x2c')]({'where':{'VoicePrefixId':_0x404303['id']},'transaction':_0x50480b})[_0x3d40('0x30')](function(){return db[_0x3d40('0x56')]['find']({'where':{'id':_0x404303[_0x3d40('0x57')]},'raw':!![]})['then'](function(_0x597a62){return createVoicePrefixExtensions(_0x404303,_0x597a62,_0x50480b);});});});})[_0x3d40('0x30')](function(){return db['VoicePrefix'][_0x3d40('0x70')](_0x404303['id']);})[_0x3d40('0x30')](respondWithResult(_0x578fe7,null))[_0x3d40('0x4d')](handleError(_0x578fe7,null));};exports['addAgents']=function(_0x5d5fa4,_0x334974,_0x2975a1){return db['VoicePrefix']['find']({'where':{'id':_0x5d5fa4[_0x3d40('0x4f')]['id']}})['then'](handleEntityNotFound(_0x334974,null))[_0x3d40('0x30')](function(_0x447df5){if(_0x447df5){return _0x447df5[_0x3d40('0x71')](_0x5d5fa4['body'][_0x3d40('0x72')],_[_0x3d40('0x73')](_0x5d5fa4[_0x3d40('0x55')],[_0x3d40('0x72'),'id'])||{})[_0x3d40('0x74')](function(_0x15ca86){for(var _0x105668=0x0;_0x105668<_0x5d5fa4['body'][_0x3d40('0x72')]['length'];_0x105668+=0x1){socket[_0x3d40('0x75')](_0x3d40('0x76'),{'UserId':Number(_0x5d5fa4[_0x3d40('0x55')][_0x3d40('0x72')][_0x105668]),'VoicePrefixId':Number(_0x5d5fa4[_0x3d40('0x4f')]['id'])});}return _0x15ca86;});}})['then'](respondWithResult(_0x334974,null))[_0x3d40('0x4d')](handleError(_0x334974,null));};exports[_0x3d40('0x77')]=function(_0x5416f3,_0x22e3ec,_0x583fda){return db[_0x3d40('0x35')][_0x3d40('0x50')]({'where':{'id':_0x5416f3[_0x3d40('0x4f')]['id']}})[_0x3d40('0x30')](handleEntityNotFound(_0x22e3ec,null))[_0x3d40('0x30')](function(_0xabc8fd){if(_0xabc8fd){return _0xabc8fd[_0x3d40('0x77')](_0x5416f3['query'][_0x3d40('0x72')])[_0x3d40('0x30')](function(){if(_[_0x3d40('0x78')](_0x5416f3[_0x3d40('0x38')]['ids'])){for(var _0x3d600d=0x0;_0x3d600d<_0x5416f3[_0x3d40('0x38')][_0x3d40('0x72')]['length'];_0x3d600d+=0x1){socket[_0x3d40('0x75')]('userVoicePrefix:remove',{'UserId':Number(_0x5416f3[_0x3d40('0x38')][_0x3d40('0x72')][_0x3d600d]),'VoicePrefixId':Number(_0x5416f3['params']['id'])});}}else{socket[_0x3d40('0x75')]('userVoicePrefix:remove',{'UserId':Number(_0x5416f3[_0x3d40('0x38')][_0x3d40('0x72')]),'VoicePrefixId':Number(_0x5416f3[_0x3d40('0x4f')]['id'])});}});}})[_0x3d40('0x30')](respondWithStatusCode(_0x22e3ec,null))[_0x3d40('0x4d')](handleError(_0x22e3ec,null));};exports[_0x3d40('0x79')]=function(_0x2916f9,_0x345c51,_0x25fb81){var _0x4cf723={};var _0x58139c={};var _0x4dbd26;var _0x10d59f;return db[_0x3d40('0x35')]['findOne']({'where':{'id':_0x2916f9[_0x3d40('0x4f')]['id']}})[_0x3d40('0x30')](handleEntityNotFound(_0x345c51,null))[_0x3d40('0x30')](function(_0x512ce2){if(_0x512ce2){_0x4dbd26=_0x512ce2;_0x58139c[_0x3d40('0x3c')]=_['keys'](db[_0x3d40('0x7a')][_0x3d40('0x36')]);_0x58139c[_0x3d40('0x38')]=_[_0x3d40('0x39')](_0x2916f9[_0x3d40('0x38')]);_0x58139c[_0x3d40('0x3a')]=_[_0x3d40('0x3b')](_0x58139c[_0x3d40('0x3c')],_0x58139c[_0x3d40('0x38')]);_0x4cf723['attributes']=_[_0x3d40('0x3b')](_0x58139c[_0x3d40('0x3c')],qs[_0x3d40('0x3e')](_0x2916f9[_0x3d40('0x38')][_0x3d40('0x3e')]));_0x4cf723[_0x3d40('0x3d')]=_0x4cf723[_0x3d40('0x3d')][_0x3d40('0x3f')]?_0x4cf723[_0x3d40('0x3d')]:_0x58139c[_0x3d40('0x3c')];_0x4cf723[_0x3d40('0x41')]=qs['sort'](_0x2916f9[_0x3d40('0x38')][_0x3d40('0x42')]);_0x4cf723['where']=qs[_0x3d40('0x3a')](_[_0x3d40('0x7b')](_0x2916f9['query'],_0x58139c['filters']));if(_0x2916f9[_0x3d40('0x38')][_0x3d40('0x44')]){_0x4cf723[_0x3d40('0x43')]=_[_0x3d40('0x45')](_0x4cf723[_0x3d40('0x43')],{'$or':_[_0x3d40('0x46')](_0x4cf723['attributes'],function(_0x417288){var _0x97a8f2={};_0x97a8f2[_0x417288]={'$like':'%'+_0x2916f9[_0x3d40('0x38')][_0x3d40('0x44')]+'%'};return _0x97a8f2;})});}_0x4cf723=_[_0x3d40('0x45')]({},_0x4cf723,_0x2916f9[_0x3d40('0x48')]);return _0x4dbd26[_0x3d40('0x79')](_0x4cf723);}})['then'](function(_0x589225){if(_0x589225){_0x10d59f=_0x589225[_0x3d40('0x3f')];if(!_0x2916f9['query'][_0x3d40('0x40')]('nolimit')){_0x4cf723[_0x3d40('0x25')]=qs[_0x3d40('0x25')](_0x2916f9[_0x3d40('0x38')][_0x3d40('0x25')]);_0x4cf723[_0x3d40('0x23')]=qs[_0x3d40('0x23')](_0x2916f9['query'][_0x3d40('0x23')]);}return _0x4dbd26['getAgents'](_0x4cf723);}})['then'](function(_0x36e290){if(_0x36e290){return _0x36e290?{'count':_0x10d59f,'rows':_0x36e290}:null;}})[_0x3d40('0x30')](respondWithResult(_0x345c51,null))[_0x3d40('0x4d')](handleError(_0x345c51,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 0a84d4d..d1c1878 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 _0x7307=['emit','hasOwnProperty','hook','exports','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove'];(function(_0x306159,_0x5caa33){var _0x242168=function(_0x1b580e){while(--_0x1b580e){_0x306159['push'](_0x306159['shift']());}};_0x242168(++_0x5caa33);}(_0x7307,0x176));var _0x7730=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x7307[_0x46d0c9];return _0x174506;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x7730('0x0'))['db'][_0x7730('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x7730('0x2')](0x0);var events={'afterCreate':_0x7730('0x3'),'afterUpdate':_0x7730('0x4'),'afterDestroy':_0x7730('0x5')};function emitEvent(_0x24697b){return function(_0x2feeab,_0x394144,_0x15fd6d){VoicePrefixEvents[_0x7730('0x6')](_0x24697b+':'+_0x2feeab['id'],_0x2feeab);VoicePrefixEvents[_0x7730('0x6')](_0x24697b,_0x2feeab);_0x15fd6d(null);};}for(var e in events){if(events[_0x7730('0x7')](e)){var event=events[e];VoicePrefix[_0x7730('0x8')](e,emitEvent(event));}}module[_0x7730('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x8a8e=['exports','events','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x21ed98,_0x4a4209){var _0x4012bf=function(_0x46a9df){while(--_0x46a9df){_0x21ed98['push'](_0x21ed98['shift']());}};_0x4012bf(++_0x4a4209);}(_0x8a8e,0x6f));var _0xe8a8=function(_0x559cc4,_0x44ce57){_0x559cc4=_0x559cc4-0x0;var _0x138971=_0x8a8e[_0x559cc4];return _0x138971;};'use strict';var EventEmitter=require(_0xe8a8('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xe8a8('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe8a8('0x2')](0x0);var events={'afterCreate':_0xe8a8('0x3'),'afterUpdate':_0xe8a8('0x4'),'afterDestroy':_0xe8a8('0x5')};function emitEvent(_0x4dcb15){return function(_0x4a979d,_0x244e38,_0xd3b0e7){VoicePrefixEvents[_0xe8a8('0x6')](_0x4dcb15+':'+_0x4a979d['id'],_0x4a979d);VoicePrefixEvents['emit'](_0x4dcb15,_0x4a979d);_0xd3b0e7(null);};}for(var e in events){if(events[_0xe8a8('0x7')](e)){var event=events[e];VoicePrefix[_0xe8a8('0x8')](e,emitEvent(event));}}module[_0xe8a8('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index a1f3a36..97c4832 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 _0x5b19=['util','../../config/logger','moment','bluebird','path','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes','lodash'];(function(_0x483094,_0x455752){var _0x27c52d=function(_0x59efce){while(--_0x59efce){_0x483094['push'](_0x483094['shift']());}};_0x27c52d(++_0x455752);}(_0x5b19,0x16a));var _0x95b1=function(_0x132f56,_0x1d7070){_0x132f56=_0x132f56-0x0;var _0x2e5305=_0x5b19[_0x132f56];return _0x2e5305;};'use strict';var _=require(_0x95b1('0x0'));var util=require(_0x95b1('0x1'));var logger=require(_0x95b1('0x2'))('api');var moment=require(_0x95b1('0x3'));var BPromise=require(_0x95b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x95b1('0x5'));var rimraf=require('rimraf');var config=require(_0x95b1('0x6'));var attributes=require(_0x95b1('0x7'));module[_0x95b1('0x8')]=function(_0x3a19ec,_0x2c320a){return _0x3a19ec['define'](_0x95b1('0x9'),attributes,{'tableName':_0x95b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5ca=['moment','bluebird','path','rimraf','../../config/environment','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger'];(function(_0x58e97a,_0x40c13e){var _0x24f34c=function(_0x58e2ad){while(--_0x58e2ad){_0x58e97a['push'](_0x58e97a['shift']());}};_0x24f34c(++_0x40c13e);}(_0xe5ca,0x105));var _0xae5c=function(_0x5d6e35,_0x4d1ac0){_0x5d6e35=_0x5d6e35-0x0;var _0x5d7ada=_0xe5ca[_0x5d6e35];return _0x5d7ada;};'use strict';var _=require(_0xae5c('0x0'));var util=require(_0xae5c('0x1'));var logger=require(_0xae5c('0x2'))('api');var moment=require(_0xae5c('0x3'));var BPromise=require(_0xae5c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xae5c('0x5'));var rimraf=require(_0xae5c('0x6'));var config=require(_0xae5c('0x7'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x1f59ff,_0x103b68){return _0x1f59ff[_0xae5c('0x8')](_0xae5c('0x9'),attributes,{'tableName':_0xae5c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 5a50f61..b244bc9 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 _0x1921=['then','info','VoicePrefix,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x1921,0xf2));var _0x1192=function(_0x159d7e,_0x424488){_0x159d7e=_0x159d7e-0x0;var _0x9ad89=_0x1921[_0x159d7e];return _0x9ad89;};'use strict';var _=require(_0x1192('0x0'));var util=require('util');var moment=require(_0x1192('0x1'));var BPromise=require(_0x1192('0x2'));var rs=require(_0x1192('0x3'));var fs=require('fs');var Redis=require(_0x1192('0x4'));var db=require(_0x1192('0x5'))['db'];var utils=require(_0x1192('0x6'));var logger=require(_0x1192('0x7'))(_0x1192('0x8'));var config=require(_0x1192('0x9'));var jayson=require(_0x1192('0xa'));var client=jayson[_0x1192('0xb')]['http']({'port':0x232a});config['redis']=_[_0x1192('0xc')](config[_0x1192('0xd')],{'host':_0x1192('0xe'),'port':0x18eb});var socket=require(_0x1192('0xf'))(new Redis(config[_0x1192('0xd')]));require(_0x1192('0x10'))[_0x1192('0x11')](socket);function respondWithRpcPromise(_0x34002b,_0x50af83,_0x53a796){return new BPromise(function(_0x403518,_0x27b5b2){return client[_0x1192('0x12')](_0x34002b,_0x53a796)[_0x1192('0x13')](function(_0x46465c){logger[_0x1192('0x14')](_0x1192('0x15'),_0x50af83,'request\x20sent');logger[_0x1192('0x16')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x50af83,_0x1192('0x17'),JSON[_0x1192('0x18')](_0x46465c));if(_0x46465c['error']){if(_0x46465c[_0x1192('0x19')][_0x1192('0x1a')]===0x1f4){logger[_0x1192('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x50af83,_0x46465c[_0x1192('0x19')][_0x1192('0x1b')]);return _0x27b5b2(_0x46465c['error'][_0x1192('0x1b')]);}logger[_0x1192('0x19')](_0x1192('0x15'),_0x50af83,_0x46465c['error'][_0x1192('0x1b')]);return _0x403518(_0x46465c['error'][_0x1192('0x1b')]);}else{logger[_0x1192('0x14')](_0x1192('0x15'),_0x50af83,_0x1192('0x17'));_0x403518(_0x46465c[_0x1192('0x1c')][_0x1192('0x1b')]);}})['catch'](function(_0x4f72d7){logger[_0x1192('0x19')](_0x1192('0x15'),_0x50af83,_0x4f72d7);_0x27b5b2(_0x4f72d7);});});} \ No newline at end of file +var _0xf55c=['error','code','VoicePrefix,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','then','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x61bdc9,_0x4198f5){var _0x49f160=function(_0x26839a){while(--_0x26839a){_0x61bdc9['push'](_0x61bdc9['shift']());}};_0x49f160(++_0x4198f5);}(_0xf55c,0x1e7));var _0xcf55=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xf55c[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0xcf55('0x0'));var util=require('util');var moment=require(_0xcf55('0x1'));var BPromise=require(_0xcf55('0x2'));var rs=require(_0xcf55('0x3'));var fs=require('fs');var Redis=require(_0xcf55('0x4'));var db=require(_0xcf55('0x5'))['db'];var utils=require(_0xcf55('0x6'));var logger=require(_0xcf55('0x7'))('rpc');var config=require(_0xcf55('0x8'));var jayson=require(_0xcf55('0x9'));var client=jayson[_0xcf55('0xa')][_0xcf55('0xb')]({'port':0x232a});config['redis']=_[_0xcf55('0xc')](config[_0xcf55('0xd')],{'host':_0xcf55('0xe'),'port':0x18eb});var socket=require(_0xcf55('0xf'))(new Redis(config['redis']));require(_0xcf55('0x10'))[_0xcf55('0x11')](socket);function respondWithRpcPromise(_0x13f181,_0x8f499a,_0x68c2b6){return new BPromise(function(_0x1d8ffc,_0xa8cc0d){return client['request'](_0x13f181,_0x68c2b6)[_0xcf55('0x12')](function(_0x133c22){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x8f499a,_0xcf55('0x13'));logger[_0xcf55('0x14')](_0xcf55('0x15'),_0x8f499a,_0xcf55('0x13'),JSON[_0xcf55('0x16')](_0x133c22));if(_0x133c22[_0xcf55('0x17')]){if(_0x133c22[_0xcf55('0x17')][_0xcf55('0x18')]===0x1f4){logger[_0xcf55('0x17')](_0xcf55('0x19'),_0x8f499a,_0x133c22[_0xcf55('0x17')][_0xcf55('0x1a')]);return _0xa8cc0d(_0x133c22['error'][_0xcf55('0x1a')]);}logger[_0xcf55('0x17')](_0xcf55('0x19'),_0x8f499a,_0x133c22[_0xcf55('0x17')][_0xcf55('0x1a')]);return _0x1d8ffc(_0x133c22['error'][_0xcf55('0x1a')]);}else{logger[_0xcf55('0x1b')](_0xcf55('0x19'),_0x8f499a,_0xcf55('0x13'));_0x1d8ffc(_0x133c22[_0xcf55('0x1c')]['message']);}})[_0xcf55('0x1d')](function(_0x486436){logger[_0xcf55('0x17')](_0xcf55('0x19'),_0x8f499a,_0x486436);_0xa8cc0d(_0x486436);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7bea5f0..985d029 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 _0x3eec=['voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener','length'];(function(_0xa6d4d5,_0x1f691e){var _0x51cb90=function(_0x2b17f2){while(--_0x2b17f2){_0xa6d4d5['push'](_0xa6d4d5['shift']());}};_0x51cb90(++_0x1f691e);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x9250d6,_0x5030a7){_0x9250d6=_0x9250d6-0x0;var _0x2b636a=_0x3eec[_0x9250d6];return _0x2b636a;};'use strict';var VoicePrefixEvents=require(_0xc3ee('0x0'));var events=[_0xc3ee('0x1'),_0xc3ee('0x2'),_0xc3ee('0x3')];function createListener(_0x484ade,_0x223d08){return function(_0x280209){_0x223d08[_0xc3ee('0x4')](_0x484ade,_0x280209);};}function removeListener(_0x35b2fb,_0x25074b){return function(){VoicePrefixEvents[_0xc3ee('0x5')](_0x35b2fb,_0x25074b);};}exports['register']=function(_0x471de7){for(var _0xbd5b6=0x0,_0xea4318=events[_0xc3ee('0x6')];_0xbd5b6<_0xea4318;_0xbd5b6++){var _0x356374=events[_0xbd5b6];var _0x3d74c0=createListener(_0xc3ee('0x7')+_0x356374,_0x471de7);VoicePrefixEvents['on'](_0x356374,_0x3d74c0);}}; \ No newline at end of file +var _0x8278=['remove','update','emit','register','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x8278,0x1ae));var _0x8827=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8278[_0x3dd15e];return _0x231fd0;};'use strict';var VoicePrefixEvents=require(_0x8827('0x0'));var events=[_0x8827('0x1'),_0x8827('0x2'),_0x8827('0x3')];function createListener(_0x4d6de2,_0x5be177){return function(_0x1b1dff){_0x5be177[_0x8827('0x4')](_0x4d6de2,_0x1b1dff);};}function removeListener(_0x9a5311,_0xf4c10){return function(){VoicePrefixEvents['removeListener'](_0x9a5311,_0xf4c10);};}exports[_0x8827('0x5')]=function(_0x4342d7){for(var _0x11797a=0x0,_0x31d236=events[_0x8827('0x6')];_0x11797a<_0x31d236;_0x11797a++){var _0xfb36a9=events[_0x11797a];var _0xb78af=createListener(_0x8827('0x7')+_0xfb36a9,_0x4342d7);VoicePrefixEvents['on'](_0xfb36a9,_0xb78af);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index e974246..086b5b1 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 _0x23f4=['getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addAgents','put','update','delete','removeTeams','removeAgents','removeBlackLists','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','/:id','show'];(function(_0x5ad0e1,_0x2466be){var _0x355c7b=function(_0x303667){while(--_0x303667){_0x5ad0e1['push'](_0x5ad0e1['shift']());}};_0x355c7b(++_0x2466be);}(_0x23f4,0x6e));var _0x423f=function(_0x29e425,_0x379de6){_0x29e425=_0x29e425-0x0;var _0x56741d=_0x23f4[_0x29e425];return _0x56741d;};'use strict';var multer=require(_0x423f('0x0'));var util=require(_0x423f('0x1'));var path=require(_0x423f('0x2'));var timeout=require(_0x423f('0x3'));var express=require('express');var router=express[_0x423f('0x4')]();var fs_extra=require(_0x423f('0x5'));var auth=require(_0x423f('0x6'));var interaction=require(_0x423f('0x7'));var config=require('../../config/environment');var controller=require(_0x423f('0x8'));router[_0x423f('0x9')]('/',auth[_0x423f('0xa')](),controller['index']);router[_0x423f('0x9')](_0x423f('0xb'),auth[_0x423f('0xa')](),controller[_0x423f('0xc')]);router[_0x423f('0x9')]('/:id/hoppers',auth[_0x423f('0xa')](),controller[_0x423f('0xd')]);router['get'](_0x423f('0xe'),auth[_0x423f('0xa')](),controller[_0x423f('0xf')]);router['get'](_0x423f('0x10'),auth[_0x423f('0xa')](),controller[_0x423f('0x11')]);router[_0x423f('0x9')](_0x423f('0x12'),auth['isAuthenticated'](),controller[_0x423f('0x13')]);router['get'](_0x423f('0x14'),auth[_0x423f('0xa')](),controller[_0x423f('0x15')]);router[_0x423f('0x9')](_0x423f('0x16'),auth[_0x423f('0xa')](),controller[_0x423f('0x17')]);router[_0x423f('0x9')](_0x423f('0x18'),auth[_0x423f('0xa')](),controller[_0x423f('0x19')]);router['get'](_0x423f('0x1a'),auth['isAuthenticated'](),controller[_0x423f('0x1b')]);router[_0x423f('0x9')](_0x423f('0x1c'),auth[_0x423f('0xa')](),controller[_0x423f('0x1d')]);router[_0x423f('0x1e')]('/',auth[_0x423f('0xa')](),controller[_0x423f('0x1f')]);router[_0x423f('0x1e')](_0x423f('0x20'),auth[_0x423f('0xa')](),controller[_0x423f('0x21')]);router[_0x423f('0x1e')]('/:id/teams',auth[_0x423f('0xa')](),controller['addTeams']);router[_0x423f('0x1e')](_0x423f('0x16'),auth['isAuthenticated'](),controller[_0x423f('0x22')]);router[_0x423f('0x1e')](_0x423f('0x1a'),auth['isAuthenticated'](),controller['addLists']);router['post'](_0x423f('0x1c'),auth[_0x423f('0xa')](),controller['addBlackLists']);router[_0x423f('0x23')]('/:id',auth[_0x423f('0xa')](),controller[_0x423f('0x24')]);router[_0x423f('0x25')](_0x423f('0xb'),auth[_0x423f('0xa')](),controller['destroy']);router[_0x423f('0x25')](_0x423f('0x14'),auth[_0x423f('0xa')](),controller[_0x423f('0x26')]);router[_0x423f('0x25')](_0x423f('0x16'),auth[_0x423f('0xa')](),controller[_0x423f('0x27')]);router['delete'](_0x423f('0x1a'),auth[_0x423f('0xa')](),controller['removeLists']);router[_0x423f('0x25')](_0x423f('0x1c'),auth['isAuthenticated'](),controller[_0x423f('0x28')]);module['exports']=router; \ No newline at end of file +var _0x3f8b=['/:id/teams','getAgents','/:id/members','getMembers','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','/:id/users','addAgents','addLists','addBlackLists','put','/:id','update','destroy','delete','/:id/lists','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','get','index','isAuthenticated','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black'];(function(_0x17e3c4,_0x821010){var _0x2211b9=function(_0x33ab42){while(--_0x33ab42){_0x17e3c4['push'](_0x17e3c4['shift']());}};_0x2211b9(++_0x821010);}(_0x3f8b,0x1b8));var _0xb3f8=function(_0x1c2051,_0x4cb6b9){_0x1c2051=_0x1c2051-0x0;var _0x2b58a0=_0x3f8b[_0x1c2051];return _0x2b58a0;};'use strict';var multer=require(_0xb3f8('0x0'));var util=require(_0xb3f8('0x1'));var path=require(_0xb3f8('0x2'));var timeout=require(_0xb3f8('0x3'));var express=require(_0xb3f8('0x4'));var router=express[_0xb3f8('0x5')]();var fs_extra=require(_0xb3f8('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceQueue.controller');router[_0xb3f8('0x7')]('/',auth['isAuthenticated'](),controller[_0xb3f8('0x8')]);router[_0xb3f8('0x7')]('/:id',auth[_0xb3f8('0x9')](),controller[_0xb3f8('0xa')]);router[_0xb3f8('0x7')](_0xb3f8('0xb'),auth[_0xb3f8('0x9')](),controller['getHoppers']);router[_0xb3f8('0x7')](_0xb3f8('0xc'),auth['isAuthenticated'](),controller[_0xb3f8('0xd')]);router[_0xb3f8('0x7')]('/:id/hopper_finals',auth[_0xb3f8('0x9')](),controller[_0xb3f8('0xe')]);router[_0xb3f8('0x7')](_0xb3f8('0xf'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0xb3f8('0x7')](_0xb3f8('0x10'),auth[_0xb3f8('0x9')](),controller['getTeams']);router[_0xb3f8('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0xb3f8('0x11')]);router['get'](_0xb3f8('0x12'),auth[_0xb3f8('0x9')](),controller[_0xb3f8('0x13')]);router[_0xb3f8('0x7')]('/:id/lists',auth[_0xb3f8('0x9')](),controller[_0xb3f8('0x14')]);router[_0xb3f8('0x7')](_0xb3f8('0x15'),auth['isAuthenticated'](),controller[_0xb3f8('0x16')]);router[_0xb3f8('0x17')]('/',auth[_0xb3f8('0x9')](),controller['create']);router[_0xb3f8('0x17')](_0xb3f8('0x18'),auth[_0xb3f8('0x9')](),controller['clone']);router[_0xb3f8('0x17')](_0xb3f8('0x10'),auth[_0xb3f8('0x9')](),controller['addTeams']);router[_0xb3f8('0x17')](_0xb3f8('0x19'),auth[_0xb3f8('0x9')](),controller[_0xb3f8('0x1a')]);router[_0xb3f8('0x17')]('/:id/lists',auth[_0xb3f8('0x9')](),controller[_0xb3f8('0x1b')]);router[_0xb3f8('0x17')](_0xb3f8('0x15'),auth[_0xb3f8('0x9')](),controller[_0xb3f8('0x1c')]);router[_0xb3f8('0x1d')](_0xb3f8('0x1e'),auth['isAuthenticated'](),controller[_0xb3f8('0x1f')]);router['delete'](_0xb3f8('0x1e'),auth['isAuthenticated'](),controller[_0xb3f8('0x20')]);router['delete'](_0xb3f8('0x10'),auth[_0xb3f8('0x9')](),controller['removeTeams']);router['delete'](_0xb3f8('0x19'),auth[_0xb3f8('0x9')](),controller['removeAgents']);router[_0xb3f8('0x21')](_0xb3f8('0x22'),auth['isAuthenticated'](),controller[_0xb3f8('0x23')]);router[_0xb3f8('0x21')]('/:id/blacklists',auth[_0xb3f8('0x9')](),controller[_0xb3f8('0x24')]);module[_0xb3f8('0x25')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 62dd23b..b724821 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 _0x6a39=['#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','onlyIfOpen','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x1b9cb8,_0x47ba43){var _0x2db519=function(_0x3207f4){while(--_0x3207f4){_0x1b9cb8['push'](_0x1b9cb8['shift']());}};_0x2db519(++_0x47ba43);}(_0x6a39,0x140));var _0x96a3=function(_0x107844,_0x41926f){_0x107844=_0x107844-0x0;var _0x40c2b5=_0x6a39[_0x107844];return _0x40c2b5;};'use strict';var Sequelize=require(_0x96a3('0x0'));module[_0x96a3('0x1')]={'name':{'type':Sequelize[_0x96a3('0x2')],'allowNull':![],'unique':_0x96a3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x96a3('0x4')](_0x96a3('0x5'),'outbound'),'allowNull':![],'defaultValue':_0x96a3('0x5')},'musiconhold':{'type':Sequelize[_0x96a3('0x2')],'defaultValue':_0x96a3('0x6')},'announce':{'type':Sequelize[_0x96a3('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x96a3('0x4')]('rr',_0x96a3('0x7'),_0x96a3('0x8'),_0x96a3('0x9'),_0x96a3('0xa'),_0x96a3('0xb'),'linear',_0x96a3('0xc'),_0x96a3('0xd')),'allowNull':![],'defaultValue':_0x96a3('0x7'),'set':function(_0x4fae13){this[_0x96a3('0xe')](_0x96a3('0xf'),_0x4fae13?_0x4fae13:_0x96a3('0xb'));},'get':function(){var _0x41ac35=this[_0x96a3('0x10')](_0x96a3('0x11'));var _0x3baa38=this[_0x96a3('0x10')](_0x96a3('0x12'));var _0x1312be=this['getDataValue'](_0x96a3('0xf'));if(_0x41ac35==='inbound'){return _0x1312be;}if(_0x3baa38===_0x96a3('0x13')&&_0x1312be==='rrmemory'||_0x3baa38===_0x96a3('0x13')&&_0x1312be==='roundrobin'){return _0x1312be;}if(_0x3baa38===_0x96a3('0x14')||_0x3baa38===_0x96a3('0x15')||_0x3baa38===_0x96a3('0x16')){return _0x1312be;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x96a3('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x96a3('0x17')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x96a3('0x2')]},'weight':{'type':Sequelize[_0x96a3('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x96a3('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x96a3('0x4')]('yes','no'),'defaultValue':_0x96a3('0x18')},'autopause':{'type':Sequelize[_0x96a3('0x4')]('yes','no',_0x96a3('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x96a3('0x17')](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x96a3('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x96a3('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x96a3('0x4')](_0x96a3('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x96a3('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x96a3('0x4')](_0x96a3('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x96a3('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x96a3('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x96a3('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x96a3('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x96a3('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x96a3('0x4')](_0x96a3('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x96a3('0x18'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x96a3('0x4')](_0x96a3('0x18'),'no',_0x96a3('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x96a3('0x4')](_0x96a3('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x96a3('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x96a3('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x96a3('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x96a3('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x96a3('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x96a3('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x96a3('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x96a3('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x96a3('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x96a3('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x96a3('0x2')]},'queue_quantity1':{'type':Sequelize[_0x96a3('0x2')]},'queue_quantity2':{'type':Sequelize[_0x96a3('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x96a3('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x96a3('0x1b')],'set':function(_0x30c1bb){this[_0x96a3('0xe')](_0x96a3('0x1c'),_0x30c1bb?_0x30c1bb[_0x96a3('0x1d')](','):[]);},'get':function(){return this[_0x96a3('0x10')](_0x96a3('0x1c'))?this[_0x96a3('0x10')](_0x96a3('0x1c'))[_0x96a3('0x1e')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x96a3('0x18'),'set':function(_0x47f749){this[_0x96a3('0xe')](_0x96a3('0x1f'),_0x47f749?_0x47f749['join'](','):undefined);},'get':function(){return this[_0x96a3('0x10')]('joinempty')?this['getDataValue'](_0x96a3('0x1f'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x96a3('0x2')],'defaultValue':'no','set':function(_0x14c94b){this[_0x96a3('0xe')](_0x96a3('0x20'),_0x14c94b?_0x14c94b['join'](','):undefined);},'get':function(){return this[_0x96a3('0x10')](_0x96a3('0x20'))?this[_0x96a3('0x10')](_0x96a3('0x20'))[_0x96a3('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x96a3('0x4')](_0x96a3('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x96a3('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x96a3('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x96a3('0x4')](_0x96a3('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x96a3('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x3a21e2){this[_0x96a3('0xe')](_0x96a3('0x21'),_0x3a21e2);if(_0x3a21e2){if(this[_0x96a3('0x10')](_0x96a3('0x22'))<0x2){this[_0x96a3('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x96a3('0x23')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x96a3('0x4')]('preview',_0x96a3('0x14'),_0x96a3('0x16'),_0x96a3('0x15'),'booked'),'defaultValue':_0x96a3('0x14'),'comment':_0x96a3('0x24')},'dialLimitChannel':{'type':Sequelize[_0x96a3('0x17')](0x4)[_0x96a3('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x96a3('0x26')},'dialLimitQueue':{'type':Sequelize[_0x96a3('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x96a3('0x27')](0x2)[_0x96a3('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x96a3('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x96a3('0x4')](_0x96a3('0x29'),'dropRate'),'defaultValue':_0x96a3('0x2a'),'comment':_0x96a3('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x96a3('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x96a3('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x96a3('0x17')](0x3)[_0x96a3('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x96a3('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0x96a3('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x96a3('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x96a3('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x96a3('0x2e')},'dialQueueOptions':{'type':Sequelize[_0x96a3('0x2')],'defaultValue':_0x96a3('0x2f'),'comment':_0x96a3('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x96a3('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x96a3('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x96a3('0x17')](0x3)[_0x96a3('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x96a3('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x96a3('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x96a3('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0x96a3('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x96a3('0x33')},'dialBusyRetryFrequency':{'type':Sequelize[_0x96a3('0x17')](0x5)[_0x96a3('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x96a3('0x25')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x96a3('0x17')](0x5)[_0x96a3('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x96a3('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x96a3('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x96a3('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x96a3('0x2')],'defaultValue':_0x96a3('0x35')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x96a3('0x4')]('always',_0x96a3('0x36'),_0x96a3('0x37')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x96a3('0x23')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x96a3('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x96a3('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x96a3('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x96a3('0x17')](0x9)[_0x96a3('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x96a3('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x96a3('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x96a3('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x96a3('0x17')](0x9)[_0x96a3('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x96a3('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x96a3('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x96a3('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x96a3('0x17')](0x9)[_0x96a3('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x96a3('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x96a3('0x17')](0x9)[_0x96a3('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x96a3('0x3d')},'dialRecallMeTimeout':{'type':Sequelize[_0x96a3('0x17')](0x5)[_0x96a3('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x96a3('0x3e')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x96a3('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize[_0x96a3('0x4')](_0x96a3('0x40'),_0x96a3('0x41')),'defaultValue':_0x96a3('0x40')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x96a3('0x42')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x96a3('0x23')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x96a3('0x23')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x96a3('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x96a3('0x43')},'dialCutDigit':{'type':Sequelize[_0x96a3('0x17')](0x3)[_0x96a3('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x96a3('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x96a3('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x96a3('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x96a3('0x45')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x96a3('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x96a3('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0x96a3('0x17')](0x5)[_0x96a3('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x96a3('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x96a3('0x17')](0x3)[_0x96a3('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x96a3('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x96a3('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x96a3('0x17')](0x3)[_0x96a3('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x96a3('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x96a3('0x17')](0x5)[_0x96a3('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x96a3('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x96a3('0x17')](0x3)[_0x96a3('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x96a3('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x96a3('0x17')],'allowNull':!![],'comment':_0x96a3('0x4b')},'mandatoryDisposition':{'type':Sequelize[_0x96a3('0x23')],'defaultValue':![],'comment':_0x96a3('0x4c'),'set':function(_0x62f027){if(!_0x62f027)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x96a3('0xe')](_0x96a3('0x4d'),_0x62f027);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x96a3('0x17')](0x3)[_0x96a3('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x96a3('0x17')](0x3)[_0x96a3('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xa81a=['#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','ENUM','outbound','inbound','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','strategy','getDataValue','type','dialMethod','booked','roundrobin','predictive','power','INTEGER','yes','all','once','TEXT','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','wrapuptime','BOOLEAN','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)'];(function(_0x105598,_0xe7dd46){var _0x1b8b5a=function(_0x3fb5a2){while(--_0x3fb5a2){_0x105598['push'](_0x105598['shift']());}};_0x1b8b5a(++_0xe7dd46);}(_0xa81a,0x1f1));var _0xaa81=function(_0x54bc0b,_0x246ef0){_0x54bc0b=_0x54bc0b-0x0;var _0x25a77f=_0xa81a[_0x54bc0b];return _0x25a77f;};'use strict';var Sequelize=require(_0xaa81('0x0'));module['exports']={'name':{'type':Sequelize[_0xaa81('0x1')],'allowNull':![],'unique':_0xaa81('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xaa81('0x3')]('inbound',_0xaa81('0x4')),'allowNull':![],'defaultValue':_0xaa81('0x5')},'musiconhold':{'type':Sequelize[_0xaa81('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xaa81('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xaa81('0x3')]('rr','ringall',_0xaa81('0x6'),_0xaa81('0x7'),_0xaa81('0x8'),_0xaa81('0x9'),_0xaa81('0xa'),_0xaa81('0xb'),_0xaa81('0xc')),'allowNull':![],'defaultValue':'ringall','set':function(_0x24d136){this['setDataValue'](_0xaa81('0xd'),_0x24d136?_0x24d136:'rrmemory');},'get':function(){var _0x20d6b9=this[_0xaa81('0xe')](_0xaa81('0xf'));var _0x2aad5e=this['getDataValue'](_0xaa81('0x10'));var _0x24d10a=this[_0xaa81('0xe')](_0xaa81('0xd'));if(_0x20d6b9===_0xaa81('0x5')){return _0x24d10a;}if(_0x2aad5e==='booked'&&_0x24d10a===_0xaa81('0x9')||_0x2aad5e===_0xaa81('0x11')&&_0x24d10a===_0xaa81('0x12')){return _0x24d10a;}if(_0x2aad5e==='progressive'||_0x2aad5e===_0xaa81('0x13')||_0x2aad5e===_0xaa81('0x14')){return _0x24d10a;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xaa81('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xaa81('0x15')](0xb)},'timeout':{'type':Sequelize[_0xaa81('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xaa81('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xaa81('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xaa81('0x16')},'autopause':{'type':Sequelize['ENUM'](_0xaa81('0x16'),'no',_0xaa81('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xaa81('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xaa81('0x3')](_0xaa81('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xaa81('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xaa81('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xaa81('0x3')](_0xaa81('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xaa81('0x3')](_0xaa81('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xaa81('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xaa81('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xaa81('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xaa81('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xaa81('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xaa81('0x3')](_0xaa81('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xaa81('0x3')](_0xaa81('0x16'),'no'),'defaultValue':_0xaa81('0x16')},'announce_holdtime':{'type':Sequelize[_0xaa81('0x3')](_0xaa81('0x16'),'no',_0xaa81('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xaa81('0x16'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xaa81('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xaa81('0x1')]},'queue_youarenext':{'type':Sequelize[_0xaa81('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xaa81('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xaa81('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xaa81('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xaa81('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xaa81('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xaa81('0x1')]},'queue_less_than':{'type':Sequelize[_0xaa81('0x1')]},'periodic_announce':{'type':Sequelize[_0xaa81('0x19')],'set':function(_0x1cded9){this[_0xaa81('0x1a')](_0xaa81('0x1b'),_0x1cded9?_0x1cded9[_0xaa81('0x1c')](','):[]);},'get':function(){return this[_0xaa81('0xe')](_0xaa81('0x1b'))?this['getDataValue']('periodic_announce')[_0xaa81('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0xaa81('0x1')],'defaultValue':'yes','set':function(_0x91122c){this['setDataValue']('joinempty',_0x91122c?_0x91122c[_0xaa81('0x1c')](','):undefined);},'get':function(){return this[_0xaa81('0xe')](_0xaa81('0x1e'))?this[_0xaa81('0xe')](_0xaa81('0x1e'))[_0xaa81('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xaa81('0x1')],'defaultValue':'no','set':function(_0x20050d){this[_0xaa81('0x1a')](_0xaa81('0x1f'),_0x20050d?_0x20050d[_0xaa81('0x1c')](','):undefined);},'get':function(){return this['getDataValue']('leavewhenempty')?this['getDataValue'](_0xaa81('0x1f'))[_0xaa81('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xaa81('0x3')](_0xaa81('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xaa81('0x3')](_0xaa81('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xaa81('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xaa81('0x3')](_0xaa81('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xaa81('0x1')]},'description':{'type':Sequelize[_0xaa81('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x5230e2){this['setDataValue']('acw',_0x5230e2);if(_0x5230e2){if(this[_0xaa81('0xe')](_0xaa81('0x20'))<0x2){this[_0xaa81('0x1a')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xaa81('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xaa81('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xaa81('0x3')]('preview',_0xaa81('0x22'),_0xaa81('0x14'),_0xaa81('0x13'),_0xaa81('0x11')),'defaultValue':'progressive','comment':_0xaa81('0x23')},'dialLimitChannel':{'type':Sequelize[_0xaa81('0x15')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xaa81('0x15')](0x4)[_0xaa81('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xaa81('0x25')},'dialPowerLevel':{'type':Sequelize[_0xaa81('0x26')](0x2)[_0xaa81('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xaa81('0x27')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xaa81('0x28'),_0xaa81('0x29')),'defaultValue':_0xaa81('0x29'),'comment':_0xaa81('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xaa81('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xaa81('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xaa81('0x15')](0x3)[_0xaa81('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xaa81('0x2b'),'comment':_0xaa81('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0xaa81('0x15')](0x3)[_0xaa81('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaa81('0x2d')},'dialQueueProject':{'type':Sequelize[_0xaa81('0x1')],'comment':_0xaa81('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaa81('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaa81('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xaa81('0x15')](0x5)[_0xaa81('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaa81('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0xaa81('0x15')](0x3)[_0xaa81('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaa81('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0xaa81('0x15')](0x5)[_0xaa81('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaa81('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaa81('0x24')],'defaultValue':0x3,'comment':_0xaa81('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xaa81('0x15')](0x5)[_0xaa81('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xaa81('0x15')](0x3)[_0xaa81('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xaa81('0x34')},'dialTimezone':{'type':Sequelize[_0xaa81('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xaa81('0x1')],'defaultValue':_0xaa81('0x35')},'dialPrefix':{'type':Sequelize[_0xaa81('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xaa81('0x3')]('always',_0xaa81('0x36'),_0xaa81('0x37')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xaa81('0x21')],'defaultValue':0x0,'comment':_0xaa81('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0xaa81('0x15')](0x9)[_0xaa81('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xaa81('0x39')},'dialAMDGreeting':{'type':Sequelize[_0xaa81('0x15')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xaa81('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xaa81('0x15')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xaa81('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaa81('0x3c')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xaa81('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xaa81('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xaa81('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xaa81('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xaa81('0x15')](0x9)[_0xaa81('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xaa81('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xaa81('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xaa81('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xaa81('0x15')](0x9)[_0xaa81('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaa81('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0xaa81('0x15')](0x5)[_0xaa81('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xaa81('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0xaa81('0x3')](_0xaa81('0x43'),_0xaa81('0x44')),'defaultValue':_0xaa81('0x43')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0xaa81('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xaa81('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xaa81('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xaa81('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xaa81('0x15')](0x3)[_0xaa81('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaa81('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xaa81('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaa81('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xaa81('0x15')](0x5)[_0xaa81('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaa81('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0xaa81('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaa81('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0xaa81('0x15')](0x5)[_0xaa81('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaa81('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xaa81('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaa81('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0xaa81('0x15')](0x3)[_0xaa81('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xaa81('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaa81('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xaa81('0x15')](0x5)[_0xaa81('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaa81('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaa81('0x15')],'allowNull':!![],'comment':_0xaa81('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0xaa81('0x21')],'defaultValue':![],'comment':_0xaa81('0x4e'),'set':function(_0x52f32b){if(!_0x52f32b)this[_0xaa81('0x1a')](_0xaa81('0x4f'),null);this['setDataValue'](_0xaa81('0x50'),_0x52f32b);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xaa81('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xaa81('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 1bd0aa2..80b4d15 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 _0x0c30=['spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','NOW()','CmListId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','bluebird','mustache','util','path','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','find','name','sendStatus','error','send','VoiceQueue','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','fields','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','createdAt','updatedAt','role','UserProfileSection','getHoppers','findOne','rawAttributes','nolimit','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','TeamVoiceQueue','upsert','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','select','field','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents'];(function(_0x1d5759,_0x417e09){var _0x51ddcd=function(_0x4e3f43){while(--_0x4e3f43){_0x1d5759['push'](_0x1d5759['shift']());}};_0x51ddcd(++_0x417e09);}(_0x0c30,0xd7));var _0x00c3=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0x0c30[_0x386c3e];return _0x4b8e13;};'use strict';var emlformat=require(_0x00c3('0x0'));var rimraf=require(_0x00c3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x00c3('0x2'));var Mustache=require(_0x00c3('0x3'));var util=require(_0x00c3('0x4'));var path=require(_0x00c3('0x5'));var sox=require('sox');var csv=require(_0x00c3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x00c3('0x7'));var _=require('lodash');var squel=require(_0x00c3('0x8'));var crypto=require('crypto');var jsforce=require(_0x00c3('0x9'));var deskjs=require(_0x00c3('0xa'));var toCsv=require(_0x00c3('0x6'));var querystring=require(_0x00c3('0xb'));var Papa=require('papaparse');var Redis=require(_0x00c3('0xc'));var authService=require(_0x00c3('0xd'));var qs=require(_0x00c3('0xe'));var as=require(_0x00c3('0xf'));var hardwareService=require(_0x00c3('0x10'));var logger=require(_0x00c3('0x11'))(_0x00c3('0x12'));var utils=require(_0x00c3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x00c3('0x14'));var db=require(_0x00c3('0x15'))['db'];config[_0x00c3('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x00c3('0x17'))(new Redis(config[_0x00c3('0x16')]));require('./voiceQueue.socket')[_0x00c3('0x18')](socket);function respondWithStatusCode(_0x19e406,_0x3b68ce){_0x3b68ce=_0x3b68ce||0xcc;return function(_0x5b5368){if(_0x5b5368){return _0x19e406['sendStatus'](_0x3b68ce);}return _0x19e406[_0x00c3('0x19')](_0x3b68ce)[_0x00c3('0x1a')]();};}function respondWithResult(_0x5ef0aa,_0x2abb03){_0x2abb03=_0x2abb03||0xc8;return function(_0x20f379){if(_0x20f379){return _0x5ef0aa[_0x00c3('0x19')](_0x2abb03)[_0x00c3('0x1b')](_0x20f379);}};}function respondWithFilteredResult(_0x2c6144,_0x23fc23){return function(_0x36a03){if(_0x36a03){var _0x18b754=typeof _0x23fc23[_0x00c3('0x1c')]==='undefined'&&typeof _0x23fc23[_0x00c3('0x1d')]===_0x00c3('0x1e');var _0x3ff324=_0x36a03[_0x00c3('0x1f')];var _0x412fd1=_0x18b754?0x0:_0x23fc23[_0x00c3('0x1c')];var _0x22118a=_0x18b754?_0x36a03[_0x00c3('0x1f')]:_0x23fc23['offset']+_0x23fc23[_0x00c3('0x1d')];var _0x2dbb6c;if(_0x22118a>=_0x3ff324){_0x22118a=_0x3ff324;_0x2dbb6c=0xc8;}else{_0x2dbb6c=0xce;}_0x2c6144[_0x00c3('0x19')](_0x2dbb6c);return _0x2c6144[_0x00c3('0x20')](_0x00c3('0x21'),_0x412fd1+'-'+_0x22118a+'/'+_0x3ff324)['json'](_0x36a03);}return null;};}function patchUpdates(_0x4ffd92){return function(_0x4411e0){try{jsonpatch[_0x00c3('0x22')](_0x4411e0,_0x4ffd92,!![]);}catch(_0x652c19){return BPromise[_0x00c3('0x23')](_0x652c19);}return _0x4411e0[_0x00c3('0x24')]();};}function saveUpdates(_0x41017c,_0x181ff4){return function(_0x47fb65){if(_0x47fb65){return _0x47fb65[_0x00c3('0x25')](_0x41017c)[_0x00c3('0x26')](function(_0x5a07ba){return _0x5a07ba;});}return null;};}function removeEntity(_0x4a0c9d,_0x5b7604){return function(_0x3db8c2){if(_0x3db8c2){return _0x3db8c2[_0x00c3('0x27')]()['then'](function(){var _0x2243e2=_0x3db8c2[_0x00c3('0x28')]({'plain':!![]});var _0x22fae3=[{'name':_0x00c3('0x29'),'value':_0x00c3('0x2a'),'ignore':![]},{'name':_0x00c3('0x2b'),'value':_0x00c3('0x2c'),'ignore':![]}];var _0x51442f=_(_0x22fae3)['filter'](_0x00c3('0x2d'))[_0x00c3('0x2e')](_0x00c3('0x2f'))[_0x00c3('0x2f')]();if(_[_0x00c3('0x30')](_0x51442f,_0x2243e2[_0x00c3('0x31')])){return;}var _0x2a50dc=_[_0x00c3('0x32')](_0x22fae3,['value',_0x2243e2[_0x00c3('0x31')]])[_0x00c3('0x33')];return db['UserProfileResource'][_0x00c3('0x27')]({'where':{'type':_0x2a50dc,'resourceId':_0x2243e2['id']}})[_0x00c3('0x26')](function(){return _0x3db8c2;});})['then'](function(){_0x4a0c9d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ce048,_0x15edb4){return function(_0x5a9e2a){if(!_0x5a9e2a){_0x2ce048[_0x00c3('0x34')](0x194);}return _0x5a9e2a;};}function handleError(_0x555c0c,_0x13d929){_0x13d929=_0x13d929||0x1f4;return function(_0x164477){logger[_0x00c3('0x35')](_0x164477['stack']);if(_0x164477[_0x00c3('0x33')]){delete _0x164477['name'];}_0x555c0c[_0x00c3('0x19')](_0x13d929)[_0x00c3('0x36')](_0x164477);};}exports['index']=function(_0x2ce2f,_0x354e8c){var _0x4f0a24={},_0x273f87={},_0xe0cd2a={'count':0x0,'rows':[]};var _0x1f7f69=_[_0x00c3('0x2e')](db[_0x00c3('0x37')]['rawAttributes'],function(_0x6aa157){return{'name':_0x6aa157[_0x00c3('0x38')],'type':_0x6aa157[_0x00c3('0x31')][_0x00c3('0x39')]};});_0x273f87[_0x00c3('0x3a')]=_[_0x00c3('0x2e')](_0x1f7f69,_0x00c3('0x33'));_0x273f87[_0x00c3('0x3b')]=_[_0x00c3('0x3c')](_0x2ce2f[_0x00c3('0x3b')]);_0x273f87[_0x00c3('0x3d')]=_[_0x00c3('0x3e')](_0x273f87[_0x00c3('0x3a')],_0x273f87[_0x00c3('0x3b')]);_0x4f0a24[_0x00c3('0x3f')]=_[_0x00c3('0x3e')](_0x273f87[_0x00c3('0x3a')],qs['fields'](_0x2ce2f[_0x00c3('0x3b')]['fields']));_0x4f0a24[_0x00c3('0x3f')]=_0x4f0a24[_0x00c3('0x3f')]['length']?_0x4f0a24[_0x00c3('0x3f')]:_0x273f87[_0x00c3('0x3a')];if(!_0x2ce2f[_0x00c3('0x3b')][_0x00c3('0x40')]('nolimit')){_0x4f0a24[_0x00c3('0x1d')]=qs[_0x00c3('0x1d')](_0x2ce2f[_0x00c3('0x3b')][_0x00c3('0x1d')]);_0x4f0a24[_0x00c3('0x1c')]=qs[_0x00c3('0x1c')](_0x2ce2f['query'][_0x00c3('0x1c')]);}_0x4f0a24[_0x00c3('0x41')]=qs[_0x00c3('0x42')](_0x2ce2f[_0x00c3('0x3b')]['sort']);_0x4f0a24[_0x00c3('0x43')]=qs[_0x00c3('0x3d')](_[_0x00c3('0x44')](_0x2ce2f['query'],_0x273f87[_0x00c3('0x3d')]),_0x1f7f69);if(_0x2ce2f[_0x00c3('0x3b')][_0x00c3('0x45')]){_0x4f0a24['where']=_[_0x00c3('0x46')](_0x4f0a24[_0x00c3('0x43')],{'$or':_[_0x00c3('0x2e')](_0x1f7f69,function(_0x52bfcd){if(_0x52bfcd[_0x00c3('0x31')]!==_0x00c3('0x47')){var _0x439ed1={};_0x439ed1[_0x52bfcd['name']]={'$like':'%'+_0x2ce2f[_0x00c3('0x3b')][_0x00c3('0x45')]+'%'};return _0x439ed1;}})});}_0x4f0a24=_[_0x00c3('0x46')]({},_0x4f0a24,_0x2ce2f['options']);var _0x1b9cdf={'where':_0x4f0a24['where']};return db['VoiceQueue'][_0x00c3('0x1f')](_0x1b9cdf)[_0x00c3('0x26')](function(_0x2fcd86){_0xe0cd2a['count']=_0x2fcd86;if(_0x2ce2f['query'][_0x00c3('0x48')]){_0x4f0a24[_0x00c3('0x49')]=[{'all':!![]}];}return db[_0x00c3('0x37')][_0x00c3('0x4a')](_0x4f0a24);})['then'](function(_0x300e9e){_0xe0cd2a[_0x00c3('0x4b')]=_0x300e9e;return _0xe0cd2a;})[_0x00c3('0x26')](respondWithFilteredResult(_0x354e8c,_0x4f0a24))['catch'](handleError(_0x354e8c,null));};exports[_0x00c3('0x4c')]=function(_0x175147,_0x481273){var _0x1636f6={'raw':![],'where':{'id':_0x175147[_0x00c3('0x4d')]['id']}},_0x432af0={};_0x432af0[_0x00c3('0x3a')]=_['keys'](db[_0x00c3('0x37')]['rawAttributes']);_0x432af0[_0x00c3('0x3b')]=_[_0x00c3('0x3c')](_0x175147[_0x00c3('0x3b')]);_0x432af0['filters']=_[_0x00c3('0x3e')](_0x432af0[_0x00c3('0x3a')],_0x432af0[_0x00c3('0x3b')]);_0x1636f6[_0x00c3('0x3f')]=_[_0x00c3('0x3e')](_0x432af0[_0x00c3('0x3a')],qs[_0x00c3('0x4e')](_0x175147[_0x00c3('0x3b')][_0x00c3('0x4e')]));_0x1636f6[_0x00c3('0x3f')]=_0x1636f6['attributes']['length']?_0x1636f6[_0x00c3('0x3f')]:_0x432af0['model'];if(_0x175147[_0x00c3('0x3b')][_0x00c3('0x48')]){_0x1636f6['include']=[{'all':!![]}];}_0x1636f6=_[_0x00c3('0x46')]({},_0x1636f6,_0x175147[_0x00c3('0x4f')]);return db['VoiceQueue'][_0x00c3('0x32')](_0x1636f6)[_0x00c3('0x26')](handleEntityNotFound(_0x481273,null))[_0x00c3('0x26')](respondWithResult(_0x481273,null))[_0x00c3('0x50')](handleError(_0x481273,null));};exports[_0x00c3('0x51')]=function(_0x1c42bf,_0x46fe8c){return db[_0x00c3('0x37')][_0x00c3('0x51')](_0x1c42bf[_0x00c3('0x52')],{})[_0x00c3('0x26')](function(_0x12bd0f){var _0x4f56a6=_0x1c42bf[_0x00c3('0x53')][_0x00c3('0x28')]({'plain':!![]});if(!_0x4f56a6)throw new Error(_0x00c3('0x54'));if(_0x4f56a6['role']===_0x00c3('0x53')){var _0x2695f7=_0x12bd0f[_0x00c3('0x28')]({'plain':!![]});var _0x38a1ef=[{'name':_0x00c3('0x29'),'value':_0x00c3('0x2a')},{'name':_0x00c3('0x2b'),'value':'outbound'}];var _0x542d50=_[_0x00c3('0x32')](_0x38a1ef,['value',_0x2695f7['type']])[_0x00c3('0x33')];return db['UserProfileSection'][_0x00c3('0x32')]({'where':{'name':_0x542d50,'userProfileId':_0x4f56a6[_0x00c3('0x55')]},'raw':!![]})['then'](function(_0x3ef2af){if(_0x3ef2af&&_0x3ef2af[_0x00c3('0x56')]===0x0){return db[_0x00c3('0x57')]['create']({'name':_0x2695f7[_0x00c3('0x33')],'resourceId':_0x2695f7['id'],'type':_0x3ef2af[_0x00c3('0x33')],'sectionId':_0x3ef2af['id']},{})['then'](function(){return _0x12bd0f;});}else{return _0x12bd0f;}})[_0x00c3('0x50')](function(_0x141f52){logger['error'](_0x00c3('0x58'),_0x141f52);throw _0x141f52;});}return _0x12bd0f;})[_0x00c3('0x26')](respondWithResult(_0x46fe8c,0xc9))[_0x00c3('0x50')](handleError(_0x46fe8c,null));};exports[_0x00c3('0x59')]=function(_0x22139e,_0x2d93b4){var _0xba4569={'where':{'id':_0x22139e['params']['id']}},_0x5dcefa={};_0x5dcefa[_0x00c3('0x3a')]=_[_0x00c3('0x3c')](db[_0x00c3('0x37')]['rawAttributes']);_0xba4569[_0x00c3('0x3f')]=_['intersection'](_0x5dcefa['model'],qs[_0x00c3('0x4e')](_0x22139e[_0x00c3('0x3b')]['fields']));_0xba4569['attributes']=_0xba4569[_0x00c3('0x3f')][_0x00c3('0x5a')]?_0xba4569[_0x00c3('0x3f')]:_0x5dcefa[_0x00c3('0x3a')];if(_0x22139e[_0x00c3('0x3b')][_0x00c3('0x48')]){_0xba4569['include']=[{'all':!![]}];}_0xba4569=_['merge']({},_0xba4569,_0x22139e[_0x00c3('0x4f')]);return db[_0x00c3('0x37')]['find'](_0xba4569)[_0x00c3('0x26')](handleEntityNotFound(_0x2d93b4,null))[_0x00c3('0x26')](function(_0x3035fe){if(_0x3035fe){var _0x309a11=_0x3035fe[_0x00c3('0x28')]({'plain':!![]});_0x309a11=qs[_0x00c3('0x5b')](_0x309a11,['id',_0x00c3('0x5c'),_0x00c3('0x5d')]);_0x22139e[_0x00c3('0x52')]=_['omit'](_0x22139e[_0x00c3('0x52')],['id',_0x00c3('0x5c'),_0x00c3('0x5d')]);return db[_0x00c3('0x37')]['create'](_[_0x00c3('0x46')](_0x309a11,_0x22139e['body']),{'include':_0x22139e[_0x00c3('0x3b')][_0x00c3('0x48')]?[{'all':!![]}]:undefined})[_0x00c3('0x26')](function(_0x171f26){var _0x107045=_0x22139e['user'][_0x00c3('0x28')]({'plain':!![]});if(!_0x107045)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x107045[_0x00c3('0x5e')]===_0x00c3('0x53')){var _0x55264c=_0x171f26[_0x00c3('0x28')]({'plain':!![]});var _0x43616c=[{'name':_0x00c3('0x29'),'value':_0x00c3('0x2a')},{'name':_0x00c3('0x2b'),'value':_0x00c3('0x2c')}];var _0x3e7191=_[_0x00c3('0x32')](_0x43616c,[_0x00c3('0x2f'),_0x55264c[_0x00c3('0x31')]])[_0x00c3('0x33')];return db[_0x00c3('0x5f')][_0x00c3('0x32')]({'where':{'name':_0x3e7191,'userProfileId':_0x107045[_0x00c3('0x55')]},'raw':!![]})[_0x00c3('0x26')](function(_0x1b54a3){if(_0x1b54a3&&_0x1b54a3[_0x00c3('0x56')]===0x0){return db[_0x00c3('0x57')][_0x00c3('0x51')]({'name':_0x55264c[_0x00c3('0x33')],'resourceId':_0x55264c['id'],'type':_0x1b54a3['name'],'sectionId':_0x1b54a3['id']},{})[_0x00c3('0x26')](function(){return _0x171f26;});}else{return _0x171f26;}})[_0x00c3('0x50')](function(_0xeefe30){logger[_0x00c3('0x35')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xeefe30);throw _0xeefe30;});}return _0x171f26;});}})[_0x00c3('0x26')](respondWithResult(_0x2d93b4,0xc9))['catch'](handleError(_0x2d93b4,null));};exports[_0x00c3('0x25')]=function(_0x11ba79,_0x3db10b){if(_0x11ba79[_0x00c3('0x52')]['id']){delete _0x11ba79['body']['id'];}return db[_0x00c3('0x37')][_0x00c3('0x32')]({'where':{'id':_0x11ba79[_0x00c3('0x4d')]['id']}})[_0x00c3('0x26')](handleEntityNotFound(_0x3db10b,null))[_0x00c3('0x26')](saveUpdates(_0x11ba79[_0x00c3('0x52')],null))[_0x00c3('0x26')](respondWithResult(_0x3db10b,null))['catch'](handleError(_0x3db10b,null));};exports['destroy']=function(_0x27a480,_0x4424af){return db[_0x00c3('0x37')]['find']({'where':{'id':_0x27a480[_0x00c3('0x4d')]['id']}})[_0x00c3('0x26')](handleEntityNotFound(_0x4424af,null))['then'](removeEntity(_0x4424af,null))[_0x00c3('0x50')](handleError(_0x4424af,null));};exports[_0x00c3('0x60')]=function(_0x3a2f97,_0x2ddc53,_0x459688){var _0x493d84={'raw':![],'where':{}};var _0x4f43d3={};var _0x333ef5={'count':0x0,'rows':[]};return db[_0x00c3('0x37')][_0x00c3('0x61')]({'where':{'id':_0x3a2f97[_0x00c3('0x4d')]['id']}})[_0x00c3('0x26')](handleEntityNotFound(_0x2ddc53,null))[_0x00c3('0x26')](function(_0x3773b3){if(_0x3773b3){_0x4f43d3[_0x00c3('0x3a')]=_[_0x00c3('0x3c')](db['CmHopper'][_0x00c3('0x62')]);_0x4f43d3[_0x00c3('0x3b')]=_[_0x00c3('0x3c')](_0x3a2f97['query']);_0x4f43d3[_0x00c3('0x3d')]=_[_0x00c3('0x3e')](_0x4f43d3['model'],_0x4f43d3[_0x00c3('0x3b')]);_0x493d84[_0x00c3('0x3f')]=_[_0x00c3('0x3e')](_0x4f43d3[_0x00c3('0x3a')],qs[_0x00c3('0x4e')](_0x3a2f97['query'][_0x00c3('0x4e')]));_0x493d84[_0x00c3('0x3f')]=_0x493d84[_0x00c3('0x3f')][_0x00c3('0x5a')]?_0x493d84[_0x00c3('0x3f')]:_0x4f43d3[_0x00c3('0x3a')];if(!_0x3a2f97[_0x00c3('0x3b')][_0x00c3('0x40')](_0x00c3('0x63'))){_0x493d84['limit']=qs[_0x00c3('0x1d')](_0x3a2f97[_0x00c3('0x3b')][_0x00c3('0x1d')]);_0x493d84[_0x00c3('0x1c')]=qs['offset'](_0x3a2f97['query'][_0x00c3('0x1c')]);}_0x493d84['order']=qs['sort'](_0x3a2f97[_0x00c3('0x3b')][_0x00c3('0x42')]);_0x493d84['where']=qs[_0x00c3('0x3d')](_[_0x00c3('0x44')](_0x3a2f97[_0x00c3('0x3b')],_0x4f43d3[_0x00c3('0x3d')]));_0x493d84[_0x00c3('0x43')][_0x00c3('0x64')]=_0x3773b3['id'];if(_0x3a2f97['query']['filter']){_0x493d84['where']=_[_0x00c3('0x46')](_0x493d84[_0x00c3('0x43')],{'$or':_[_0x00c3('0x2e')](_0x493d84['attributes'],function(_0x2b5c4e){var _0x40f09c={};_0x40f09c[_0x2b5c4e]={'$like':'%'+_0x3a2f97[_0x00c3('0x3b')][_0x00c3('0x45')]+'%'};return _0x40f09c;})});}_0x493d84=_[_0x00c3('0x46')]({},_0x493d84,_0x3a2f97[_0x00c3('0x4f')]);return db[_0x00c3('0x65')][_0x00c3('0x1f')]({'where':_0x493d84['where']})[_0x00c3('0x26')](function(_0x405451){_0x333ef5[_0x00c3('0x1f')]=_0x405451;if(_0x3a2f97['query'][_0x00c3('0x48')]){_0x493d84[_0x00c3('0x49')]=[{'all':!![]}];}return db[_0x00c3('0x65')][_0x00c3('0x4a')](_0x493d84);})[_0x00c3('0x26')](function(_0x151297){_0x333ef5[_0x00c3('0x4b')]=_0x151297;return _0x333ef5;});}})[_0x00c3('0x26')](respondWithFilteredResult(_0x2ddc53,_0x493d84))['catch'](handleError(_0x2ddc53,null));};exports[_0x00c3('0x66')]=function(_0x1834fe,_0x2aaa00,_0x3781c3){var _0x17f557={'raw':!![],'where':{}};var _0x5d06f2={};var _0x204a41={'count':0x0,'rows':[]};return db[_0x00c3('0x37')][_0x00c3('0x61')]({'where':{'id':_0x1834fe['params']['id']}})[_0x00c3('0x26')](handleEntityNotFound(_0x2aaa00,null))[_0x00c3('0x26')](function(_0xa7b0d0){if(_0xa7b0d0){_0x5d06f2['model']=_[_0x00c3('0x3c')](db[_0x00c3('0x67')][_0x00c3('0x62')]);_0x5d06f2[_0x00c3('0x3b')]=_[_0x00c3('0x3c')](_0x1834fe['query']);_0x5d06f2[_0x00c3('0x3d')]=_[_0x00c3('0x3e')](_0x5d06f2[_0x00c3('0x3a')],_0x5d06f2[_0x00c3('0x3b')]);_0x17f557[_0x00c3('0x3f')]=_[_0x00c3('0x3e')](_0x5d06f2[_0x00c3('0x3a')],qs[_0x00c3('0x4e')](_0x1834fe[_0x00c3('0x3b')][_0x00c3('0x4e')]));_0x17f557[_0x00c3('0x3f')]=_0x17f557[_0x00c3('0x3f')][_0x00c3('0x5a')]?_0x17f557[_0x00c3('0x3f')]:_0x5d06f2[_0x00c3('0x3a')];if(!_0x1834fe[_0x00c3('0x3b')][_0x00c3('0x40')](_0x00c3('0x63'))){_0x17f557[_0x00c3('0x1d')]=qs[_0x00c3('0x1d')](_0x1834fe[_0x00c3('0x3b')][_0x00c3('0x1d')]);_0x17f557[_0x00c3('0x1c')]=qs[_0x00c3('0x1c')](_0x1834fe[_0x00c3('0x3b')][_0x00c3('0x1c')]);}_0x17f557[_0x00c3('0x41')]=qs[_0x00c3('0x42')](_0x1834fe[_0x00c3('0x3b')]['sort']);_0x17f557['where']=qs[_0x00c3('0x3d')](_[_0x00c3('0x44')](_0x1834fe['query'],_0x5d06f2[_0x00c3('0x3d')]));_0x17f557[_0x00c3('0x43')][_0x00c3('0x64')]=_0xa7b0d0['id'];if(_0x1834fe['query'][_0x00c3('0x45')]){_0x17f557[_0x00c3('0x43')]=_[_0x00c3('0x46')](_0x17f557[_0x00c3('0x43')],{'$or':_[_0x00c3('0x2e')](_0x17f557[_0x00c3('0x3f')],function(_0x14be3b){var _0x1188de={};_0x1188de[_0x14be3b]={'$like':'%'+_0x1834fe['query']['filter']+'%'};return _0x1188de;})});}_0x17f557=_['merge']({},_0x17f557,_0x1834fe[_0x00c3('0x4f')]);return db[_0x00c3('0x67')][_0x00c3('0x1f')]({'where':_0x17f557[_0x00c3('0x43')]})[_0x00c3('0x26')](function(_0x429977){_0x204a41[_0x00c3('0x1f')]=_0x429977;if(_0x1834fe[_0x00c3('0x3b')][_0x00c3('0x48')]){_0x17f557[_0x00c3('0x49')]=[{'all':!![]}];}return db[_0x00c3('0x67')][_0x00c3('0x4a')](_0x17f557);})[_0x00c3('0x26')](function(_0x185ec3){_0x204a41[_0x00c3('0x4b')]=_0x185ec3;return _0x204a41;});}})['then'](respondWithFilteredResult(_0x2aaa00,_0x17f557))['catch'](handleError(_0x2aaa00,null));};exports[_0x00c3('0x68')]=function(_0x3afb5e,_0xf1dd6c,_0x326f32){var _0x3ccb02={'raw':!![],'where':{}};var _0x1539e9={};var _0x2cdafc={'count':0x0,'rows':[]};return db[_0x00c3('0x37')][_0x00c3('0x61')]({'where':{'id':_0x3afb5e['params']['id']}})[_0x00c3('0x26')](handleEntityNotFound(_0xf1dd6c,null))['then'](function(_0x16e84d){if(_0x16e84d){_0x1539e9[_0x00c3('0x3a')]=_[_0x00c3('0x3c')](db[_0x00c3('0x69')][_0x00c3('0x62')]);_0x1539e9[_0x00c3('0x3b')]=_['keys'](_0x3afb5e[_0x00c3('0x3b')]);_0x1539e9[_0x00c3('0x3d')]=_[_0x00c3('0x3e')](_0x1539e9[_0x00c3('0x3a')],_0x1539e9['query']);_0x3ccb02[_0x00c3('0x3f')]=_[_0x00c3('0x3e')](_0x1539e9['model'],qs['fields'](_0x3afb5e[_0x00c3('0x3b')]['fields']));_0x3ccb02['attributes']=_0x3ccb02['attributes'][_0x00c3('0x5a')]?_0x3ccb02[_0x00c3('0x3f')]:_0x1539e9[_0x00c3('0x3a')];if(!_0x3afb5e[_0x00c3('0x3b')][_0x00c3('0x40')](_0x00c3('0x63'))){_0x3ccb02[_0x00c3('0x1d')]=qs[_0x00c3('0x1d')](_0x3afb5e[_0x00c3('0x3b')][_0x00c3('0x1d')]);_0x3ccb02[_0x00c3('0x1c')]=qs[_0x00c3('0x1c')](_0x3afb5e['query']['offset']);}_0x3ccb02[_0x00c3('0x41')]=qs['sort'](_0x3afb5e[_0x00c3('0x3b')][_0x00c3('0x42')]);_0x3ccb02[_0x00c3('0x43')]=qs[_0x00c3('0x3d')](_['pick'](_0x3afb5e[_0x00c3('0x3b')],_0x1539e9['filters']));_0x3ccb02[_0x00c3('0x43')][_0x00c3('0x64')]=_0x16e84d['id'];if(_0x3afb5e['query'][_0x00c3('0x45')]){_0x3ccb02[_0x00c3('0x43')]=_[_0x00c3('0x46')](_0x3ccb02[_0x00c3('0x43')],{'$or':_[_0x00c3('0x2e')](_0x3ccb02[_0x00c3('0x3f')],function(_0x29da00){var _0x540e3c={};_0x540e3c[_0x29da00]={'$like':'%'+_0x3afb5e['query']['filter']+'%'};return _0x540e3c;})});}_0x3ccb02=_['merge']({},_0x3ccb02,_0x3afb5e[_0x00c3('0x4f')]);return db['CmHopperFinal']['count']({'where':_0x3ccb02[_0x00c3('0x43')]})['then'](function(_0x1f498b){_0x2cdafc[_0x00c3('0x1f')]=_0x1f498b;if(_0x3afb5e['query']['includeAll']){_0x3ccb02[_0x00c3('0x49')]=[{'all':!![]}];}return db[_0x00c3('0x69')][_0x00c3('0x4a')](_0x3ccb02);})[_0x00c3('0x26')](function(_0x2011dd){_0x2cdafc['rows']=_0x2011dd;return _0x2cdafc;});}})[_0x00c3('0x26')](respondWithFilteredResult(_0xf1dd6c,_0x3ccb02))[_0x00c3('0x50')](handleError(_0xf1dd6c,null));};exports[_0x00c3('0x6a')]=function(_0x4cfec3,_0x109a48,_0x463303){var _0x157579={'raw':!![],'where':{}};var _0x3664b7={};var _0x46cb43={'count':0x0,'rows':[]};return db[_0x00c3('0x37')][_0x00c3('0x61')]({'where':{'id':_0x4cfec3['params']['id']}})[_0x00c3('0x26')](handleEntityNotFound(_0x109a48,null))['then'](function(_0x4782cc){if(_0x4782cc){_0x3664b7['model']=_['keys'](db[_0x00c3('0x6b')][_0x00c3('0x62')]);_0x3664b7[_0x00c3('0x3b')]=_[_0x00c3('0x3c')](_0x4cfec3[_0x00c3('0x3b')]);_0x3664b7['filters']=_[_0x00c3('0x3e')](_0x3664b7[_0x00c3('0x3a')],_0x3664b7[_0x00c3('0x3b')]);_0x157579['attributes']=_['intersection'](_0x3664b7[_0x00c3('0x3a')],qs[_0x00c3('0x4e')](_0x4cfec3[_0x00c3('0x3b')][_0x00c3('0x4e')]));_0x157579[_0x00c3('0x3f')]=_0x157579['attributes'][_0x00c3('0x5a')]?_0x157579[_0x00c3('0x3f')]:_0x3664b7[_0x00c3('0x3a')];if(!_0x4cfec3['query'][_0x00c3('0x40')]('nolimit')){_0x157579[_0x00c3('0x1d')]=qs['limit'](_0x4cfec3['query']['limit']);_0x157579[_0x00c3('0x1c')]=qs[_0x00c3('0x1c')](_0x4cfec3[_0x00c3('0x3b')][_0x00c3('0x1c')]);}_0x157579[_0x00c3('0x41')]=qs[_0x00c3('0x42')](_0x4cfec3[_0x00c3('0x3b')][_0x00c3('0x42')]);_0x157579[_0x00c3('0x43')]=qs['filters'](_[_0x00c3('0x44')](_0x4cfec3[_0x00c3('0x3b')],_0x3664b7['filters']));_0x157579['where'][_0x00c3('0x64')]=_0x4782cc['id'];if(_0x4cfec3[_0x00c3('0x3b')][_0x00c3('0x45')]){_0x157579['where']=_[_0x00c3('0x46')](_0x157579['where'],{'$or':_[_0x00c3('0x2e')](_0x157579[_0x00c3('0x3f')],function(_0x24b82b){var _0x243b2b={};_0x243b2b[_0x24b82b]={'$like':'%'+_0x4cfec3[_0x00c3('0x3b')]['filter']+'%'};return _0x243b2b;})});}_0x157579=_['merge']({},_0x157579,_0x4cfec3['options']);return db[_0x00c3('0x6b')][_0x00c3('0x1f')]({'where':_0x157579[_0x00c3('0x43')]})[_0x00c3('0x26')](function(_0x613eee){_0x46cb43['count']=_0x613eee;if(_0x4cfec3[_0x00c3('0x3b')][_0x00c3('0x48')]){_0x157579[_0x00c3('0x49')]=[{'all':!![]}];}return db[_0x00c3('0x6b')][_0x00c3('0x4a')](_0x157579);})['then'](function(_0x1540d0){_0x46cb43[_0x00c3('0x4b')]=_0x1540d0;return _0x46cb43;});}})[_0x00c3('0x26')](respondWithFilteredResult(_0x109a48,_0x157579))[_0x00c3('0x50')](handleError(_0x109a48,null));};exports['getTeams']=function(_0x1d1449,_0x21e09a,_0x17c7f3){var _0x3addab={};var _0x422fca={};var _0x33a747;var _0x413041;return db['VoiceQueue'][_0x00c3('0x61')]({'where':{'id':_0x1d1449[_0x00c3('0x4d')]['id']}})[_0x00c3('0x26')](handleEntityNotFound(_0x21e09a,null))['then'](function(_0x1c05a9){if(_0x1c05a9){_0x33a747=_0x1c05a9;_0x422fca[_0x00c3('0x3a')]=_[_0x00c3('0x3c')](db[_0x00c3('0x6c')]['rawAttributes']);_0x422fca[_0x00c3('0x3b')]=_[_0x00c3('0x3c')](_0x1d1449['query']);_0x422fca[_0x00c3('0x3d')]=_[_0x00c3('0x3e')](_0x422fca[_0x00c3('0x3a')],_0x422fca['query']);_0x3addab['attributes']=_['intersection'](_0x422fca[_0x00c3('0x3a')],qs[_0x00c3('0x4e')](_0x1d1449[_0x00c3('0x3b')]['fields']));_0x3addab['attributes']=_0x3addab['attributes']['length']?_0x3addab['attributes']:_0x422fca[_0x00c3('0x3a')];_0x3addab[_0x00c3('0x41')]=qs['sort'](_0x1d1449['query']['sort']);_0x3addab[_0x00c3('0x43')]=qs[_0x00c3('0x3d')](_[_0x00c3('0x44')](_0x1d1449[_0x00c3('0x3b')],_0x422fca[_0x00c3('0x3d')]));if(_0x1d1449[_0x00c3('0x3b')]['filter']){_0x3addab['where']=_['merge'](_0x3addab[_0x00c3('0x43')],{'$or':_['map'](_0x3addab[_0x00c3('0x3f')],function(_0x15803f){var _0xa87de0={};_0xa87de0[_0x15803f]={'$like':'%'+_0x1d1449[_0x00c3('0x3b')]['filter']+'%'};return _0xa87de0;})});}_0x3addab=_[_0x00c3('0x46')]({},_0x3addab,_0x1d1449['options']);return _0x33a747[_0x00c3('0x6d')](_0x3addab);}})[_0x00c3('0x26')](function(_0x7aea0a){if(_0x7aea0a){_0x413041=_0x7aea0a['length'];if(!_0x1d1449[_0x00c3('0x3b')][_0x00c3('0x40')](_0x00c3('0x63'))){_0x3addab[_0x00c3('0x1d')]=qs[_0x00c3('0x1d')](_0x1d1449[_0x00c3('0x3b')]['limit']);_0x3addab[_0x00c3('0x1c')]=qs[_0x00c3('0x1c')](_0x1d1449['query'][_0x00c3('0x1c')]);}return _0x33a747[_0x00c3('0x6d')](_0x3addab);}})['then'](function(_0x4c974f){if(_0x4c974f){return _0x4c974f?{'count':_0x413041,'rows':_0x4c974f}:null;}})['then'](respondWithResult(_0x21e09a,null))[_0x00c3('0x50')](handleError(_0x21e09a,null));};exports[_0x00c3('0x6e')]=function(_0x59a432,_0x1852fe,_0x38ade2){var _0x483c42=_0x59a432['body']['teams'];var _0x3631a2=_[_0x00c3('0x2e')](_0x483c42,'id');return db[_0x00c3('0x6c')][_0x00c3('0x4a')]({'where':{'id':_0x3631a2},'attributes':['id'],'include':[{'model':db[_0x00c3('0x6f')],'as':_0x00c3('0x70'),'attributes':['id',_0x00c3('0x33'),_0x00c3('0x71'),_0x00c3('0x72'),_0x00c3('0x73')],'raw':!![]}]})[_0x00c3('0x26')](function(_0x30aecd){if(_0x30aecd){var _0x17a005=_[_0x00c3('0x74')](_0x30aecd,function(_0x588461){var _0x532078=_0x588461['get']({'plain':!![]});_0x532078[_0x00c3('0x70')][_0x00c3('0x75')](function(_0x282576){_0x282576[_0x00c3('0x76')]=_[_0x00c3('0x32')](_0x483c42,{'id':_0x532078['id']})[_0x00c3('0x76')];});return _0x532078[_0x00c3('0x70')];});return db[_0x00c3('0x37')][_0x00c3('0x32')]({'where':{'id':_0x59a432['params']['id']}})[_0x00c3('0x26')](function(_0x459f34){return db[_0x00c3('0x77')][_0x00c3('0x78')](function(_0x7bd6ca){return _0x459f34['addTeams'](_0x3631a2,{'transaction':_0x7bd6ca})[_0x00c3('0x26')](function(){return BPromise['each'](_0x483c42,function(_0x264ddb){return db[_0x00c3('0x79')][_0x00c3('0x7a')]({'TeamId':_0x264ddb['id'],'VoiceQueueId':_0x59a432['params']['id'],'penalty':_0x264ddb['penalty']},{'transaction':_0x7bd6ca});});})[_0x00c3('0x26')](function(){return BPromise[_0x00c3('0x7b')](_0x17a005,function(_0x3143e8){return db[_0x00c3('0x7c')][_0x00c3('0x7d')]({'where':{'UserId':_0x3143e8['id'],'VoiceQueueId':_0x59a432[_0x00c3('0x4d')]['id']},'defaults':{'penalty':_0x3143e8['penalty']},'transaction':_0x7bd6ca});});})[_0x00c3('0x26')](function(){return BPromise[_0x00c3('0x7b')](_[_0x00c3('0x45')](_0x17a005,{'online':!![]}),function(_0x506e75){return db[_0x00c3('0x7e')]['upsert']({'membername':_0x506e75[_0x00c3('0x33')],'UserId':_0x506e75['id'],'queue_name':_0x459f34[_0x00c3('0x33')],'VoiceQueueId':_0x459f34['id'],'interface':_[_0x00c3('0x7f')](_0x506e75['interface'])?util[_0x00c3('0x80')](_0x00c3('0x81'),_0x506e75[_0x00c3('0x33')]):_0x506e75[_0x00c3('0x73')],'paused':_0x506e75[_0x00c3('0x72')]||![],'penalty':_0x506e75[_0x00c3('0x76')]},{'transaction':_0x7bd6ca});});})[_0x00c3('0x26')](function(){_0x17a005[_0x00c3('0x75')](function(_0xb69204){socket['emit'](_0x00c3('0x82'),{'UserId':_0xb69204['id'],'VoiceQueueId':_0x459f34['id']});});});});});}})[_0x00c3('0x26')](respondWithStatusCode(_0x1852fe,null))[_0x00c3('0x50')](handleError(_0x1852fe,null));};exports[_0x00c3('0x83')]=function(_0x4bf065,_0x4f6221,_0x395ab0){return db[_0x00c3('0x6c')][_0x00c3('0x4a')]({'where':{'id':_0x4bf065[_0x00c3('0x3b')][_0x00c3('0x84')]},'attributes':['id'],'include':[{'model':db[_0x00c3('0x6f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x00c3('0x26')](handleEntityNotFound(_0x4f6221,null))[_0x00c3('0x26')](function(_0x33f0ea){var _0x4ffd7d=_[_0x00c3('0x2e')](_0x33f0ea,'id');var _0x442e61=[];var _0x4c10e0=[];var _0x5f5617=squel[_0x00c3('0x85')]();_0x5f5617[_0x00c3('0x86')]('tq.TeamId')[_0x00c3('0x87')](_0x00c3('0x88'),'tq')['join'](_0x00c3('0x89'),'ut',_0x00c3('0x8a'))[_0x00c3('0x43')](_0x00c3('0x8b'),_0x4bf065[_0x00c3('0x4d')]['id']);for(var _0x1befa2=0x0;_0x1befa2<_0x33f0ea['length'];_0x1befa2+=0x1){let _0x4de719=_0x33f0ea[_0x1befa2];for(var _0x290ebf=0x0;_0x290ebf<_0x4de719[_0x00c3('0x70')][_0x00c3('0x5a')];_0x290ebf+=0x1){let _0x2a1b91=_0x4de719[_0x00c3('0x70')][_0x290ebf];var _0x30ac03=_0x5f5617['clone']();_0x30ac03[_0x00c3('0x43')](_0x00c3('0x8c'),_0x2a1b91['id']);_0x4c10e0[_0x00c3('0x8d')](db[_0x00c3('0x77')][_0x00c3('0x3b')](_0x30ac03[_0x00c3('0x8e')](),{'type':db[_0x00c3('0x77')][_0x00c3('0x8f')][_0x00c3('0x90')]})['then'](function(_0x3ab20d){if(_0x3ab20d['length']===0x1){return _0x2a1b91['id'];}else{var _0x1e648f=_[_0x00c3('0x91')](_['map'](_0x3ab20d,_0x00c3('0x92')),function(_0x3eab3e){return _[_0x00c3('0x30')](_0x4ffd7d,_0x3eab3e);});if(_0x1e648f){return _0x2a1b91['id'];}}}));}}return BPromise[_0x00c3('0x93')](_0x4c10e0)['then'](function(_0x4280df){_0x442e61=_(_0x442e61)['union'](_0x4280df)['compact']()[_0x00c3('0x2f')]();return db[_0x00c3('0x37')][_0x00c3('0x32')]({'where':{'id':_0x4bf065['params']['id']}})[_0x00c3('0x26')](function(_0x33d7cc){return db[_0x00c3('0x77')][_0x00c3('0x78')](function(_0x5f26b9){return _0x33d7cc[_0x00c3('0x83')](_0x4bf065[_0x00c3('0x3b')][_0x00c3('0x84')],{'transaction':_0x5f26b9})[_0x00c3('0x26')](function(){if(!_[_0x00c3('0x94')](_0x442e61)){return _0x33d7cc[_0x00c3('0x95')](_0x442e61,{'transaction':_0x5f26b9})[_0x00c3('0x26')](function(){return db[_0x00c3('0x7e')]['destroy']({'where':{'VoiceQueueId':_0x4bf065[_0x00c3('0x4d')]['id'],'UserId':_0x442e61},'transaction':_0x5f26b9});});}})[_0x00c3('0x26')](function(){_0x442e61[_0x00c3('0x75')](function(_0x89ae0f){socket[_0x00c3('0x96')](_0x00c3('0x97'),{'UserId':_0x89ae0f,'VoiceQueueId':_0x33d7cc['id']});});});});});});})[_0x00c3('0x26')](respondWithStatusCode(_0x4f6221,null))[_0x00c3('0x50')](handleError(_0x4f6221,null));};exports['addAgents']=function(_0x21200f,_0x57f016,_0x448384){var _0x40630f,_0x2a268e;return db[_0x00c3('0x37')]['find']({'where':{'id':_0x21200f[_0x00c3('0x4d')]['id']}})[_0x00c3('0x26')](handleEntityNotFound(_0x57f016,null))[_0x00c3('0x26')](function(_0x3835c7){if(_0x3835c7){_0x2a268e=_0x3835c7;return _0x3835c7[_0x00c3('0x98')](_0x21200f[_0x00c3('0x52')]['ids'],_[_0x00c3('0x5b')](_0x21200f[_0x00c3('0x52')],[_0x00c3('0x84'),'id'])||{})[_0x00c3('0x99')](function(_0x522281){for(var _0x52a3ab=0x0;_0x52a3ab<_0x21200f[_0x00c3('0x52')][_0x00c3('0x84')]['length'];_0x52a3ab+=0x1){socket['emit'](_0x00c3('0x82'),{'UserId':Number(_0x21200f['body'][_0x00c3('0x84')][_0x52a3ab]),'VoiceQueueId':Number(_0x21200f[_0x00c3('0x4d')]['id'])});}return _0x522281;});}})[_0x00c3('0x26')](function(_0x19212c){_0x40630f=_0x19212c||[];if(_0x2a268e){return db['User'][_0x00c3('0x4a')]({'where':{'id':_0x21200f['body'][_0x00c3('0x84')]},'attributes':['id',_0x00c3('0x33'),_0x00c3('0x71'),_0x00c3('0x72'),_0x00c3('0x73')],'raw':!![]});}})[_0x00c3('0x26')](function(_0x5cbc3e){if(!_['isEmpty'](_0x5cbc3e)){var _0x2c894c=[];for(var _0x3a937e=0x0;_0x3a937e<_0x5cbc3e['length'];_0x3a937e++){if(_0x5cbc3e[_0x3a937e][_0x00c3('0x71')]){_0x2c894c[_0x00c3('0x8d')](db[_0x00c3('0x7e')]['upsert']({'membername':_0x5cbc3e[_0x3a937e][_0x00c3('0x33')],'UserId':_0x5cbc3e[_0x3a937e]['id'],'queue_name':_0x2a268e[_0x00c3('0x33')],'VoiceQueueId':_0x2a268e['id'],'interface':_[_0x00c3('0x7f')](_0x5cbc3e[_0x3a937e][_0x00c3('0x73')])?util[_0x00c3('0x80')](_0x00c3('0x81'),_0x5cbc3e[_0x3a937e][_0x00c3('0x33')]):_0x5cbc3e[_0x3a937e][_0x00c3('0x73')],'paused':_0x5cbc3e[_0x3a937e][_0x00c3('0x72')]||![],'penalty':_0x21200f['body'][_0x00c3('0x76')]||0x0}));}}return BPromise[_0x00c3('0x93')](_0x2c894c);}})[_0x00c3('0x26')](function(){return _0x40630f;})[_0x00c3('0x26')](respondWithResult(_0x57f016,null))[_0x00c3('0x50')](handleError(_0x57f016,null));};exports[_0x00c3('0x95')]=function(_0xed73dd,_0x18681a,_0x3bf941){return db[_0x00c3('0x37')][_0x00c3('0x32')]({'where':{'id':_0xed73dd[_0x00c3('0x4d')]['id']}})[_0x00c3('0x26')](handleEntityNotFound(_0x18681a,null))[_0x00c3('0x26')](function(_0x55d36c){if(_0x55d36c){return _0x55d36c[_0x00c3('0x95')](_0xed73dd[_0x00c3('0x3b')]['ids'])[_0x00c3('0x26')](function(){if(_[_0x00c3('0x9a')](_0xed73dd['query']['ids'])){for(var _0x13e485=0x0;_0x13e485<_0xed73dd['query'][_0x00c3('0x84')][_0x00c3('0x5a')];_0x13e485+=0x1){socket[_0x00c3('0x96')](_0x00c3('0x97'),{'UserId':Number(_0xed73dd['query'][_0x00c3('0x84')][_0x13e485]),'VoiceQueueId':Number(_0xed73dd[_0x00c3('0x4d')]['id'])});}}else{socket[_0x00c3('0x96')]('userVoiceQueue:remove',{'UserId':Number(_0xed73dd[_0x00c3('0x3b')][_0x00c3('0x84')]),'VoiceQueueId':Number(_0xed73dd['params']['id'])});}});}})[_0x00c3('0x26')](function(_0xe6312){return db['UserVoiceQueueRt'][_0x00c3('0x27')]({'where':{'VoiceQueueId':_0xed73dd[_0x00c3('0x4d')]['id'],'UserId':_0xed73dd[_0x00c3('0x3b')][_0x00c3('0x84')]}})[_0x00c3('0x26')](function(){return _0xe6312;});})[_0x00c3('0x26')](respondWithStatusCode(_0x18681a,null))['catch'](handleError(_0x18681a,null));};exports[_0x00c3('0x9b')]=function(_0x39e61d,_0x2da544,_0x2ca887){var _0x5a0a1e={};var _0x3208c0={};var _0x3575c4;var _0x36ad5c;return db['VoiceQueue']['findOne']({'where':{'id':_0x39e61d[_0x00c3('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2da544,null))[_0x00c3('0x26')](function(_0x5794b3){if(_0x5794b3){_0x3575c4=_0x5794b3;_0x3208c0[_0x00c3('0x3a')]=_[_0x00c3('0x3c')](db[_0x00c3('0x6f')][_0x00c3('0x62')]);_0x3208c0[_0x00c3('0x3b')]=_['keys'](_0x39e61d['query']);_0x3208c0[_0x00c3('0x3d')]=_[_0x00c3('0x3e')](_0x3208c0[_0x00c3('0x3a')],_0x3208c0['query']);_0x5a0a1e[_0x00c3('0x3f')]=_[_0x00c3('0x3e')](_0x3208c0[_0x00c3('0x3a')],qs[_0x00c3('0x4e')](_0x39e61d[_0x00c3('0x3b')][_0x00c3('0x4e')]));_0x5a0a1e[_0x00c3('0x3f')]=_0x5a0a1e[_0x00c3('0x3f')]['length']?_0x5a0a1e['attributes']:_0x3208c0['model'];_0x5a0a1e[_0x00c3('0x41')]=qs[_0x00c3('0x42')](_0x39e61d['query']['sort']);_0x5a0a1e[_0x00c3('0x43')]=qs[_0x00c3('0x3d')](_[_0x00c3('0x44')](_0x39e61d['query'],_0x3208c0['filters']));if(_0x39e61d['query'][_0x00c3('0x45')]){_0x5a0a1e[_0x00c3('0x43')]=_[_0x00c3('0x46')](_0x5a0a1e[_0x00c3('0x43')],{'$or':_[_0x00c3('0x2e')](_0x5a0a1e['attributes'],function(_0x239eab){var _0x578636={};_0x578636[_0x239eab]={'$like':'%'+_0x39e61d['query']['filter']+'%'};return _0x578636;})});}_0x5a0a1e=_[_0x00c3('0x46')]({},_0x5a0a1e,_0x39e61d[_0x00c3('0x4f')]);return _0x3575c4[_0x00c3('0x9b')](_0x5a0a1e);}})['then'](function(_0x5bfae0){if(_0x5bfae0){_0x36ad5c=_0x5bfae0[_0x00c3('0x5a')];if(!_0x39e61d[_0x00c3('0x3b')][_0x00c3('0x40')](_0x00c3('0x63'))){_0x5a0a1e[_0x00c3('0x1d')]=qs[_0x00c3('0x1d')](_0x39e61d[_0x00c3('0x3b')][_0x00c3('0x1d')]);_0x5a0a1e[_0x00c3('0x1c')]=qs[_0x00c3('0x1c')](_0x39e61d[_0x00c3('0x3b')][_0x00c3('0x1c')]);}return _0x3575c4['getAgents'](_0x5a0a1e);}})['then'](function(_0x2974da){if(_0x2974da){return _0x2974da?{'count':_0x36ad5c,'rows':_0x2974da}:null;}})[_0x00c3('0x26')](respondWithResult(_0x2da544,null))['catch'](handleError(_0x2da544,null));};exports['getMembers']=function(_0xf4da28,_0x1258e5,_0x38040e){var _0x41a050={};var _0x51641f={};var _0x8c0bd2;var _0x904a70;return db[_0x00c3('0x37')][_0x00c3('0x61')]({'where':{'id':_0xf4da28[_0x00c3('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1258e5,null))['then'](function(_0x57cc66){if(_0x57cc66){_0x8c0bd2=_0x57cc66;_0x51641f['model']=_[_0x00c3('0x3c')](db[_0x00c3('0x7e')][_0x00c3('0x62')]);_0x51641f[_0x00c3('0x3b')]=_[_0x00c3('0x3c')](_0xf4da28['query']);_0x51641f[_0x00c3('0x3d')]=_[_0x00c3('0x3e')](_0x51641f[_0x00c3('0x3a')],_0x51641f['query']);_0x41a050[_0x00c3('0x3f')]=_[_0x00c3('0x3e')](_0x51641f[_0x00c3('0x3a')],qs['fields'](_0xf4da28['query'][_0x00c3('0x4e')]));_0x41a050[_0x00c3('0x3f')]=_0x41a050[_0x00c3('0x3f')][_0x00c3('0x5a')]?_0x41a050[_0x00c3('0x3f')]:_0x51641f['model'];_0x41a050['order']=qs[_0x00c3('0x42')](_0xf4da28[_0x00c3('0x3b')][_0x00c3('0x42')]);_0x41a050[_0x00c3('0x43')]=qs[_0x00c3('0x3d')](_[_0x00c3('0x44')](_0xf4da28[_0x00c3('0x3b')],_0x51641f[_0x00c3('0x3d')]));if(_0xf4da28['query']['filter']){_0x41a050[_0x00c3('0x43')]=_[_0x00c3('0x46')](_0x41a050[_0x00c3('0x43')],{'$or':_[_0x00c3('0x2e')](_0x41a050['attributes'],function(_0x27e579){var _0x559dce={};_0x559dce[_0x27e579]={'$like':'%'+_0xf4da28[_0x00c3('0x3b')][_0x00c3('0x45')]+'%'};return _0x559dce;})});}_0x41a050=_[_0x00c3('0x46')]({},_0x41a050,_0xf4da28[_0x00c3('0x4f')]);return _0x8c0bd2[_0x00c3('0x9c')](_0x41a050);}})['then'](function(_0xb41dad){if(_0xb41dad){_0x904a70=_0xb41dad[_0x00c3('0x5a')];if(!_0xf4da28[_0x00c3('0x3b')][_0x00c3('0x40')](_0x00c3('0x63'))){_0x41a050[_0x00c3('0x1d')]=qs['limit'](_0xf4da28[_0x00c3('0x3b')][_0x00c3('0x1d')]);_0x41a050[_0x00c3('0x1c')]=qs['offset'](_0xf4da28[_0x00c3('0x3b')][_0x00c3('0x1c')]);}return _0x8c0bd2[_0x00c3('0x9c')](_0x41a050);}})[_0x00c3('0x26')](function(_0x2bc456){return _0x2bc456?{'count':_0x904a70,'rows':_0x2bc456}:null;})[_0x00c3('0x26')](respondWithResult(_0x1258e5,null))['catch'](handleError(_0x1258e5,null));};exports[_0x00c3('0x9d')]=function(_0x49129d,_0x390740,_0x2aadd1){var _0x555e7d={};var _0x47b409={};var _0x926434;var _0x166094;return db['VoiceQueue']['findOne']({'where':{'id':_0x49129d[_0x00c3('0x4d')]['id']}})[_0x00c3('0x26')](handleEntityNotFound(_0x390740,null))['then'](function(_0x4f835e){if(_0x4f835e){_0x926434=_0x4f835e;_0x47b409[_0x00c3('0x3a')]=_[_0x00c3('0x3c')](db[_0x00c3('0x9e')][_0x00c3('0x62')]);_0x47b409[_0x00c3('0x3b')]=_[_0x00c3('0x3c')](_0x49129d[_0x00c3('0x3b')]);_0x47b409[_0x00c3('0x3d')]=_[_0x00c3('0x3e')](_0x47b409[_0x00c3('0x3a')],_0x47b409[_0x00c3('0x3b')]);_0x555e7d[_0x00c3('0x3f')]=_[_0x00c3('0x3e')](_0x47b409[_0x00c3('0x3a')],qs[_0x00c3('0x4e')](_0x49129d[_0x00c3('0x3b')][_0x00c3('0x4e')]));_0x555e7d[_0x00c3('0x3f')]=_0x555e7d['attributes'][_0x00c3('0x5a')]?_0x555e7d[_0x00c3('0x3f')]:_0x47b409[_0x00c3('0x3a')];_0x555e7d[_0x00c3('0x41')]=qs[_0x00c3('0x42')](_0x49129d[_0x00c3('0x3b')][_0x00c3('0x42')]);_0x555e7d[_0x00c3('0x43')]=qs[_0x00c3('0x3d')](_['pick'](_0x49129d[_0x00c3('0x3b')],_0x47b409[_0x00c3('0x3d')]));if(_0x49129d['query'][_0x00c3('0x45')]){_0x555e7d[_0x00c3('0x43')]=_[_0x00c3('0x46')](_0x555e7d[_0x00c3('0x43')],{'$or':_[_0x00c3('0x2e')](_0x555e7d[_0x00c3('0x3f')],function(_0x208700){var _0x572b84={};_0x572b84[_0x208700]={'$like':'%'+_0x49129d['query'][_0x00c3('0x45')]+'%'};return _0x572b84;})});}_0x555e7d=_[_0x00c3('0x46')]({},_0x555e7d,_0x49129d['options']);return _0x926434[_0x00c3('0x9d')](_0x555e7d);}})[_0x00c3('0x26')](function(_0x425483){if(_0x425483){_0x166094=_0x425483['length'];if(!_0x49129d[_0x00c3('0x3b')][_0x00c3('0x40')](_0x00c3('0x63'))){_0x555e7d[_0x00c3('0x1d')]=qs[_0x00c3('0x1d')](_0x49129d[_0x00c3('0x3b')][_0x00c3('0x1d')]);_0x555e7d[_0x00c3('0x1c')]=qs[_0x00c3('0x1c')](_0x49129d[_0x00c3('0x3b')][_0x00c3('0x1c')]);}return _0x926434[_0x00c3('0x9d')](_0x555e7d);}})['then'](function(_0x2635ba){if(_0x2635ba){return _0x2635ba?{'count':_0x166094,'rows':_0x2635ba}:null;}})['then'](respondWithResult(_0x390740,null))['catch'](handleError(_0x390740,null));};exports[_0x00c3('0x9f')]=function(_0x58b4a4,_0x410abd,_0x35381f){var _0x1828fe,_0x1b82ee;return db[_0x00c3('0x37')][_0x00c3('0x32')]({'where':{'id':_0x58b4a4[_0x00c3('0x4d')]['id']}})[_0x00c3('0x26')](handleEntityNotFound(_0x410abd,null))[_0x00c3('0x26')](function(_0x89f970){if(_0x89f970){_0x1b82ee=_0x89f970;return _0x89f970[_0x00c3('0x9f')](_0x58b4a4[_0x00c3('0x52')][_0x00c3('0x84')],_[_0x00c3('0x5b')](_0x58b4a4[_0x00c3('0x52')],[_0x00c3('0x84'),'id'])||{});}return null;})[_0x00c3('0x99')](function(_0x41210c){var _0x174dec;_0x1828fe=_0x41210c||[];var _0x224189=[];if(_0x41210c){for(var _0x1cfa9f=0x0;_0x1cfa9f<_0x41210c[_0x00c3('0x5a')];_0x1cfa9f+=0x1){var _0x228ee5=_0x41210c[_0x1cfa9f][_0x00c3('0x28')]({'plain':!![]});_0x1b82ee[_0x00c3('0xa0')]=_0x58b4a4['body'][_0x00c3('0xa0')]?_0x58b4a4['body'][_0x00c3('0xa0')]:_0x1b82ee[_0x00c3('0xa0')];switch(_0x1b82ee['dialCheckDuplicateType']){case _0x00c3('0xa1'):_0x174dec=squel[_0x00c3('0xa2')]()[_0x00c3('0xa3')](_0x00c3('0xa4'))[_0x00c3('0xa5')]([_0x00c3('0xa6'),_0x00c3('0xa7'),_0x00c3('0xa8'),'ListId',_0x00c3('0x64'),'createdAt',_0x00c3('0x5d')],squel[_0x00c3('0x85')]()[_0x00c3('0x86')]('phone',_0x00c3('0xa6'))[_0x00c3('0x86')](_0x00c3('0xa9'),_0x00c3('0xa7'))[_0x00c3('0x86')]('id',_0x00c3('0xa8'))['field'](_0x228ee5[_0x00c3('0xaa')]['toString'](),_0x00c3('0xab'))[_0x00c3('0x86')](_0x58b4a4[_0x00c3('0x4d')]['id']['toString'](),_0x00c3('0x64'))[_0x00c3('0x86')](_0x00c3('0xa9'),_0x00c3('0x5c'))[_0x00c3('0x86')](_0x00c3('0xa9'),_0x00c3('0x5d'))[_0x00c3('0x87')](_0x00c3('0xac'))['where'](_0x00c3('0xad'))[_0x00c3('0x43')](_0x00c3('0xae'),_0x228ee5['CmListId']['toString']())['where'](_0x00c3('0xaf'))[_0x00c3('0x43')](_0x00c3('0xb0'),squel[_0x00c3('0x85')]()[_0x00c3('0x86')](_0x00c3('0xb1'))[_0x00c3('0x87')]('cm_hopper_final')['where'](_0x00c3('0x8b'),_0x58b4a4[_0x00c3('0x4d')]['id'][_0x00c3('0x8e')]()))[_0x00c3('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0x00c3('0x85')]()['field'](_0x00c3('0xb2'))[_0x00c3('0x87')](_0x00c3('0xa4'))[_0x00c3('0x43')](_0x00c3('0x8b'),_0x58b4a4['params']['id'][_0x00c3('0x8e')]())))[_0x00c3('0x8e')]();break;case _0x00c3('0xb3'):_0x174dec=squel[_0x00c3('0xa2')]()[_0x00c3('0xa3')](_0x00c3('0xa4'))[_0x00c3('0xa5')]([_0x00c3('0xa6'),_0x00c3('0xa7'),_0x00c3('0xa8'),_0x00c3('0xab'),'VoiceQueueId',_0x00c3('0x5c'),_0x00c3('0x5d')],squel[_0x00c3('0x85')]()['field']('phone','phone')[_0x00c3('0x86')](_0x00c3('0xa9'),_0x00c3('0xa7'))[_0x00c3('0x86')]('id',_0x00c3('0xa8'))[_0x00c3('0x86')](_0x228ee5['CmListId'][_0x00c3('0x8e')](),_0x00c3('0xab'))[_0x00c3('0x86')](_0x58b4a4[_0x00c3('0x4d')]['id'][_0x00c3('0x8e')](),_0x00c3('0x64'))[_0x00c3('0x86')](_0x00c3('0xa9'),'createdAt')['field'](_0x00c3('0xa9'),_0x00c3('0x5d'))['from'](_0x00c3('0xac'))[_0x00c3('0x43')](_0x00c3('0xad'))[_0x00c3('0x43')](_0x00c3('0xae'),_0x228ee5[_0x00c3('0xaa')][_0x00c3('0x8e')]())['where'](_0x00c3('0xaf'))[_0x00c3('0x43')](_0x00c3('0xb0'),squel['select']()[_0x00c3('0x86')](_0x00c3('0xb2'))[_0x00c3('0x87')](_0x00c3('0xa4'))[_0x00c3('0x43')]('VoiceQueueId\x20=\x20?',_0x58b4a4['params']['id']['toString']())))[_0x00c3('0x8e')]();break;default:_0x174dec=squel[_0x00c3('0xa2')]()['into']('cm_hopper')[_0x00c3('0xa5')]([_0x00c3('0xa6'),'scheduledAt','ContactId',_0x00c3('0xab'),_0x00c3('0x64'),_0x00c3('0x5c'),'updatedAt'],squel[_0x00c3('0x85')]()[_0x00c3('0x86')]('phone',_0x00c3('0xa6'))['field'](_0x00c3('0xa9'),_0x00c3('0xa7'))[_0x00c3('0x86')]('id','ContactId')['field'](_0x228ee5['CmListId'][_0x00c3('0x8e')](),_0x00c3('0xab'))[_0x00c3('0x86')](_0x58b4a4[_0x00c3('0x4d')]['id']['toString'](),'VoiceQueueId')[_0x00c3('0x86')](_0x00c3('0xa9'),_0x00c3('0x5c'))[_0x00c3('0x86')](_0x00c3('0xa9'),_0x00c3('0x5d'))[_0x00c3('0x87')](_0x00c3('0xac'))['where'](_0x00c3('0xad'))['where']('ListId\x20=\x20?',_0x228ee5[_0x00c3('0xaa')][_0x00c3('0x8e')]())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x224189[_0x00c3('0x8d')](db[_0x00c3('0x77')][_0x00c3('0x3b')](_0x174dec));}return BPromise['all'](_0x224189);}})[_0x00c3('0x26')](function(){return _0x1828fe;})[_0x00c3('0x26')](respondWithResult(_0x410abd,null))[_0x00c3('0x50')](handleError(_0x410abd,null));};exports[_0x00c3('0xb4')]=function(_0x49143c,_0x3a4f5c,_0x2f0f78){return db[_0x00c3('0x37')][_0x00c3('0x32')]({'where':{'id':_0x49143c[_0x00c3('0x4d')]['id']}})[_0x00c3('0x26')](handleEntityNotFound(_0x3a4f5c,null))[_0x00c3('0x26')](function(_0x4b4925){if(_0x4b4925){return _0x4b4925[_0x00c3('0xb4')](_0x49143c[_0x00c3('0x3b')][_0x00c3('0x84')]);}})[_0x00c3('0x26')](function(_0x3b9591){if(_0x3b9591){return db[_0x00c3('0x65')][_0x00c3('0x27')]({'where':{'ListId':_0x49143c[_0x00c3('0x3b')][_0x00c3('0x84')],'VoiceQueueId':_0x49143c['params']['id']}})[_0x00c3('0x26')](function(){return _0x3b9591;});}})[_0x00c3('0x26')](respondWithStatusCode(_0x3a4f5c,null))[_0x00c3('0x50')](handleError(_0x3a4f5c,null));};exports[_0x00c3('0xb5')]=function(_0x45bd7a,_0x97616c,_0x4539cd){var _0xced94f={};var _0xda1cf4={};var _0x285f5a;var _0x559633;return db[_0x00c3('0x37')]['findOne']({'where':{'id':_0x45bd7a['params']['id']}})['then'](handleEntityNotFound(_0x97616c,null))[_0x00c3('0x26')](function(_0x4013f2){if(_0x4013f2){_0x285f5a=_0x4013f2;_0xda1cf4[_0x00c3('0x3a')]=_['keys'](db[_0x00c3('0x9e')][_0x00c3('0x62')]);_0xda1cf4['query']=_[_0x00c3('0x3c')](_0x45bd7a[_0x00c3('0x3b')]);_0xda1cf4['filters']=_[_0x00c3('0x3e')](_0xda1cf4[_0x00c3('0x3a')],_0xda1cf4['query']);_0xced94f[_0x00c3('0x3f')]=_[_0x00c3('0x3e')](_0xda1cf4[_0x00c3('0x3a')],qs[_0x00c3('0x4e')](_0x45bd7a[_0x00c3('0x3b')][_0x00c3('0x4e')]));_0xced94f['attributes']=_0xced94f[_0x00c3('0x3f')][_0x00c3('0x5a')]?_0xced94f[_0x00c3('0x3f')]:_0xda1cf4[_0x00c3('0x3a')];_0xced94f[_0x00c3('0x41')]=qs[_0x00c3('0x42')](_0x45bd7a[_0x00c3('0x3b')][_0x00c3('0x42')]);_0xced94f[_0x00c3('0x43')]=qs[_0x00c3('0x3d')](_['pick'](_0x45bd7a[_0x00c3('0x3b')],_0xda1cf4[_0x00c3('0x3d')]));if(_0x45bd7a[_0x00c3('0x3b')][_0x00c3('0x45')]){_0xced94f[_0x00c3('0x43')]=_[_0x00c3('0x46')](_0xced94f[_0x00c3('0x43')],{'$or':_[_0x00c3('0x2e')](_0xced94f['attributes'],function(_0x3f2847){var _0x2f4048={};_0x2f4048[_0x3f2847]={'$like':'%'+_0x45bd7a[_0x00c3('0x3b')][_0x00c3('0x45')]+'%'};return _0x2f4048;})});}_0xced94f=_[_0x00c3('0x46')]({},_0xced94f,_0x45bd7a[_0x00c3('0x4f')]);return _0x285f5a[_0x00c3('0xb5')](_0xced94f);}})[_0x00c3('0x26')](function(_0x3ab362){if(_0x3ab362){_0x559633=_0x3ab362[_0x00c3('0x5a')];if(!_0x45bd7a[_0x00c3('0x3b')]['hasOwnProperty']('nolimit')){_0xced94f[_0x00c3('0x1d')]=qs[_0x00c3('0x1d')](_0x45bd7a[_0x00c3('0x3b')][_0x00c3('0x1d')]);_0xced94f[_0x00c3('0x1c')]=qs[_0x00c3('0x1c')](_0x45bd7a[_0x00c3('0x3b')][_0x00c3('0x1c')]);}return _0x285f5a[_0x00c3('0xb5')](_0xced94f);}})[_0x00c3('0x26')](function(_0x5ed5c2){if(_0x5ed5c2){return _0x5ed5c2?{'count':_0x559633,'rows':_0x5ed5c2}:null;}})[_0x00c3('0x26')](respondWithResult(_0x97616c,null))[_0x00c3('0x50')](handleError(_0x97616c,null));};exports['addBlackLists']=function(_0x44d2ed,_0x434c40,_0x56df76){var _0x2a4bec,_0x4c779e;return db['VoiceQueue']['find']({'where':{'id':_0x44d2ed[_0x00c3('0x4d')]['id']}})[_0x00c3('0x26')](handleEntityNotFound(_0x434c40,null))[_0x00c3('0x26')](function(_0x21416e){if(_0x21416e){_0x4c779e=_0x21416e;return _0x21416e[_0x00c3('0xb6')](_0x44d2ed[_0x00c3('0x52')][_0x00c3('0x84')],_['omit'](_0x44d2ed[_0x00c3('0x52')],[_0x00c3('0x84'),'id'])||{});}return null;})[_0x00c3('0x99')](function(_0x47ac0b){var _0x1f3080;_0x2a4bec=_0x47ac0b||[];var _0x469b9d=[];if(_0x47ac0b){for(var _0x4bec3e=0x0;_0x4bec3e<_0x47ac0b[_0x00c3('0x5a')];_0x4bec3e+=0x1){var _0x2fbde2=_0x47ac0b[_0x4bec3e]['get']({'plain':!![]});_0x1f3080=squel[_0x00c3('0xa2')]()[_0x00c3('0xa3')]('cm_hopper_black')[_0x00c3('0xa5')](['phone','ContactId',_0x00c3('0xab'),_0x00c3('0x64'),'createdAt',_0x00c3('0x5d')],squel[_0x00c3('0x85')]()['field'](_0x00c3('0xa6'),_0x00c3('0xa6'))[_0x00c3('0x86')]('id',_0x00c3('0xa8'))[_0x00c3('0x86')](_0x2fbde2['CmListId'][_0x00c3('0x8e')](),_0x00c3('0xab'))['field'](_0x44d2ed['params']['id']['toString'](),_0x00c3('0x64'))[_0x00c3('0x86')](_0x00c3('0xa9'),_0x00c3('0x5c'))[_0x00c3('0x86')](_0x00c3('0xa9'),'updatedAt')['from'](_0x00c3('0xac'))[_0x00c3('0x43')](_0x00c3('0xad'))[_0x00c3('0x43')]('ListId\x20=\x20?',_0x2fbde2[_0x00c3('0xaa')]['toString']())['where'](_0x00c3('0xaf')))[_0x00c3('0x8e')]();_0x469b9d[_0x00c3('0x8d')](db[_0x00c3('0x77')]['query'](_0x1f3080));}return BPromise[_0x00c3('0x93')](_0x469b9d);}})['then'](function(){return _0x2a4bec;})[_0x00c3('0x26')](respondWithResult(_0x434c40,null))[_0x00c3('0x50')](handleError(_0x434c40,null));};exports['removeBlackLists']=function(_0x50a8d8,_0x39e9f0,_0x3187be){return db['VoiceQueue'][_0x00c3('0x32')]({'where':{'id':_0x50a8d8['params']['id']}})['then'](handleEntityNotFound(_0x39e9f0,null))['then'](function(_0x42f42a){if(_0x42f42a){return _0x42f42a[_0x00c3('0xb7')](_0x50a8d8['query'][_0x00c3('0x84')]);}})[_0x00c3('0x26')](function(_0x207d5e){if(_0x207d5e){return db[_0x00c3('0x6b')][_0x00c3('0x27')]({'where':{'ListId':_0x50a8d8[_0x00c3('0x3b')][_0x00c3('0x84')],'VoiceQueueId':_0x50a8d8[_0x00c3('0x4d')]['id']}})['then'](function(){return _0x207d5e;});}})[_0x00c3('0x26')](respondWithStatusCode(_0x39e9f0,null))['catch'](handleError(_0x39e9f0,null));}; \ No newline at end of file +var _0xd4eb=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','sendStatus','error','stack','send','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','map','VIRTUAL','merge','options','VoiceQueue','include','findAll','catch','show','params','keys','includeAll','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','CmHopper','hasOwnProperty','pick','rows','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','each','TeamVoiceQueue','upsert','UserVoiceQueue','isNil','format','SIP/%s','userVoiceQueue:save','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','all','compact','transaction','removeTeams','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','omit','spread','emit','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ListId','scheduledAt','ContactId','CmListId','NOW()','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','onlyIfOpen','ListId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_contacts','removeLists','getBlackLists','CmList','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x1022b9,_0x38b4c8){var _0x587f26=function(_0x2e60b4){while(--_0x2e60b4){_0x1022b9['push'](_0x1022b9['shift']());}};_0x587f26(++_0x38b4c8);}(_0xd4eb,0xa4));var _0xbd4e=function(_0x71bb37,_0x50a844){_0x71bb37=_0x71bb37-0x0;var _0x35a462=_0xd4eb[_0x71bb37];return _0x35a462;};'use strict';var emlformat=require(_0xbd4e('0x0'));var rimraf=require(_0xbd4e('0x1'));var zipdir=require(_0xbd4e('0x2'));var jsonpatch=require(_0xbd4e('0x3'));var rp=require(_0xbd4e('0x4'));var moment=require(_0xbd4e('0x5'));var BPromise=require(_0xbd4e('0x6'));var Mustache=require(_0xbd4e('0x7'));var util=require(_0xbd4e('0x8'));var path=require(_0xbd4e('0x9'));var sox=require(_0xbd4e('0xa'));var csv=require(_0xbd4e('0xb'));var ejs=require(_0xbd4e('0xc'));var fs=require('fs');var fs_extra=require(_0xbd4e('0xd'));var _=require(_0xbd4e('0xe'));var squel=require(_0xbd4e('0xf'));var crypto=require(_0xbd4e('0x10'));var jsforce=require(_0xbd4e('0x11'));var deskjs=require(_0xbd4e('0x12'));var toCsv=require(_0xbd4e('0xb'));var querystring=require(_0xbd4e('0x13'));var Papa=require(_0xbd4e('0x14'));var Redis=require('ioredis');var authService=require(_0xbd4e('0x15'));var qs=require(_0xbd4e('0x16'));var as=require(_0xbd4e('0x17'));var hardwareService=require(_0xbd4e('0x18'));var logger=require('../../config/logger')(_0xbd4e('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbd4e('0x1a'))['db'];config[_0xbd4e('0x1b')]=_[_0xbd4e('0x1c')](config[_0xbd4e('0x1b')],{'host':_0xbd4e('0x1d'),'port':0x18eb});var socket=require(_0xbd4e('0x1e'))(new Redis(config[_0xbd4e('0x1b')]));require(_0xbd4e('0x1f'))[_0xbd4e('0x20')](socket);function respondWithStatusCode(_0x145326,_0x279c82){_0x279c82=_0x279c82||0xcc;return function(_0x1983d3){if(_0x1983d3){return _0x145326['sendStatus'](_0x279c82);}return _0x145326[_0xbd4e('0x21')](_0x279c82)[_0xbd4e('0x22')]();};}function respondWithResult(_0x1f2d33,_0x79a085){_0x79a085=_0x79a085||0xc8;return function(_0x10c796){if(_0x10c796){return _0x1f2d33[_0xbd4e('0x21')](_0x79a085)[_0xbd4e('0x23')](_0x10c796);}};}function respondWithFilteredResult(_0x16b482,_0x1bec59){return function(_0x139237){if(_0x139237){var _0x5add17=typeof _0x1bec59[_0xbd4e('0x24')]==='undefined'&&typeof _0x1bec59[_0xbd4e('0x25')]==='undefined';var _0x2ba8ff=_0x139237[_0xbd4e('0x26')];var _0x43fbc9=_0x5add17?0x0:_0x1bec59[_0xbd4e('0x24')];var _0x35e8e4=_0x5add17?_0x139237[_0xbd4e('0x26')]:_0x1bec59[_0xbd4e('0x24')]+_0x1bec59[_0xbd4e('0x25')];var _0x37c2e0;if(_0x35e8e4>=_0x2ba8ff){_0x35e8e4=_0x2ba8ff;_0x37c2e0=0xc8;}else{_0x37c2e0=0xce;}_0x16b482['status'](_0x37c2e0);return _0x16b482[_0xbd4e('0x27')](_0xbd4e('0x28'),_0x43fbc9+'-'+_0x35e8e4+'/'+_0x2ba8ff)['json'](_0x139237);}return null;};}function patchUpdates(_0x280898){return function(_0x1492cb){try{jsonpatch[_0xbd4e('0x29')](_0x1492cb,_0x280898,!![]);}catch(_0x259bb6){return BPromise['reject'](_0x259bb6);}return _0x1492cb[_0xbd4e('0x2a')]();};}function saveUpdates(_0xdeeee2,_0x583721){return function(_0x36faa9){if(_0x36faa9){return _0x36faa9[_0xbd4e('0x2b')](_0xdeeee2)[_0xbd4e('0x2c')](function(_0x311cb7){return _0x311cb7;});}return null;};}function removeEntity(_0x41a258,_0x3d6759){return function(_0x51a2ec){if(_0x51a2ec){return _0x51a2ec[_0xbd4e('0x2d')]()[_0xbd4e('0x2c')](function(){var _0x94084a=_0x51a2ec[_0xbd4e('0x2e')]({'plain':!![]});var _0x12aea0=[{'name':_0xbd4e('0x2f'),'value':_0xbd4e('0x30'),'ignore':![]},{'name':_0xbd4e('0x31'),'value':_0xbd4e('0x32'),'ignore':![]}];var _0x1c21c2=_(_0x12aea0)[_0xbd4e('0x33')](_0xbd4e('0x34'))['map'](_0xbd4e('0x35'))['value']();if(_[_0xbd4e('0x36')](_0x1c21c2,_0x94084a[_0xbd4e('0x37')])){return;}var _0x1cc150=_[_0xbd4e('0x38')](_0x12aea0,[_0xbd4e('0x35'),_0x94084a[_0xbd4e('0x37')]])[_0xbd4e('0x39')];return db[_0xbd4e('0x3a')][_0xbd4e('0x2d')]({'where':{'type':_0x1cc150,'resourceId':_0x94084a['id']}})[_0xbd4e('0x2c')](function(){return _0x51a2ec;});})[_0xbd4e('0x2c')](function(){_0x41a258['status'](0xcc)[_0xbd4e('0x22')]();});}};}function handleEntityNotFound(_0x3b3c84,_0x26db8a){return function(_0x5f588b){if(!_0x5f588b){_0x3b3c84[_0xbd4e('0x3b')](0x194);}return _0x5f588b;};}function handleError(_0x9db3ef,_0x50acf3){_0x50acf3=_0x50acf3||0x1f4;return function(_0x1afb1d){logger[_0xbd4e('0x3c')](_0x1afb1d[_0xbd4e('0x3d')]);if(_0x1afb1d['name']){delete _0x1afb1d[_0xbd4e('0x39')];}_0x9db3ef[_0xbd4e('0x21')](_0x50acf3)[_0xbd4e('0x3e')](_0x1afb1d);};}exports['index']=function(_0x235d09,_0x54a4ae){var _0x5189e9={},_0x1438a7={},_0x48f9de={'count':0x0,'rows':[]};var _0x2c6a70=_['map'](db['VoiceQueue'][_0xbd4e('0x3f')],function(_0x2827e2){return{'name':_0x2827e2[_0xbd4e('0x40')],'type':_0x2827e2[_0xbd4e('0x37')][_0xbd4e('0x41')]};});_0x1438a7[_0xbd4e('0x42')]=_['map'](_0x2c6a70,_0xbd4e('0x39'));_0x1438a7['query']=_['keys'](_0x235d09[_0xbd4e('0x43')]);_0x1438a7[_0xbd4e('0x44')]=_[_0xbd4e('0x45')](_0x1438a7[_0xbd4e('0x42')],_0x1438a7['query']);_0x5189e9[_0xbd4e('0x46')]=_['intersection'](_0x1438a7[_0xbd4e('0x42')],qs['fields'](_0x235d09[_0xbd4e('0x43')][_0xbd4e('0x47')]));_0x5189e9['attributes']=_0x5189e9[_0xbd4e('0x46')][_0xbd4e('0x48')]?_0x5189e9[_0xbd4e('0x46')]:_0x1438a7[_0xbd4e('0x42')];if(!_0x235d09[_0xbd4e('0x43')]['hasOwnProperty'](_0xbd4e('0x49'))){_0x5189e9['limit']=qs['limit'](_0x235d09[_0xbd4e('0x43')][_0xbd4e('0x25')]);_0x5189e9[_0xbd4e('0x24')]=qs[_0xbd4e('0x24')](_0x235d09[_0xbd4e('0x43')]['offset']);}_0x5189e9[_0xbd4e('0x4a')]=qs[_0xbd4e('0x4b')](_0x235d09[_0xbd4e('0x43')][_0xbd4e('0x4b')]);_0x5189e9[_0xbd4e('0x4c')]=qs[_0xbd4e('0x44')](_['pick'](_0x235d09[_0xbd4e('0x43')],_0x1438a7[_0xbd4e('0x44')]),_0x2c6a70);if(_0x235d09[_0xbd4e('0x43')]['filter']){_0x5189e9[_0xbd4e('0x4c')]=_['merge'](_0x5189e9['where'],{'$or':_[_0xbd4e('0x4d')](_0x2c6a70,function(_0x1d744c){if(_0x1d744c[_0xbd4e('0x37')]!==_0xbd4e('0x4e')){var _0x43184e={};_0x43184e[_0x1d744c['name']]={'$like':'%'+_0x235d09[_0xbd4e('0x43')][_0xbd4e('0x33')]+'%'};return _0x43184e;}})});}_0x5189e9=_[_0xbd4e('0x4f')]({},_0x5189e9,_0x235d09[_0xbd4e('0x50')]);var _0x364739={'where':_0x5189e9[_0xbd4e('0x4c')]};return db[_0xbd4e('0x51')][_0xbd4e('0x26')](_0x364739)['then'](function(_0x42df75){_0x48f9de[_0xbd4e('0x26')]=_0x42df75;if(_0x235d09[_0xbd4e('0x43')]['includeAll']){_0x5189e9[_0xbd4e('0x52')]=[{'all':!![]}];}return db[_0xbd4e('0x51')][_0xbd4e('0x53')](_0x5189e9);})[_0xbd4e('0x2c')](function(_0x4c7bcb){_0x48f9de['rows']=_0x4c7bcb;return _0x48f9de;})['then'](respondWithFilteredResult(_0x54a4ae,_0x5189e9))[_0xbd4e('0x54')](handleError(_0x54a4ae,null));};exports[_0xbd4e('0x55')]=function(_0x231b61,_0x3a8461){var _0x113489={'raw':![],'where':{'id':_0x231b61[_0xbd4e('0x56')]['id']}},_0x5ddaf9={};_0x5ddaf9[_0xbd4e('0x42')]=_[_0xbd4e('0x57')](db[_0xbd4e('0x51')][_0xbd4e('0x3f')]);_0x5ddaf9[_0xbd4e('0x43')]=_[_0xbd4e('0x57')](_0x231b61[_0xbd4e('0x43')]);_0x5ddaf9[_0xbd4e('0x44')]=_[_0xbd4e('0x45')](_0x5ddaf9[_0xbd4e('0x42')],_0x5ddaf9['query']);_0x113489['attributes']=_[_0xbd4e('0x45')](_0x5ddaf9[_0xbd4e('0x42')],qs[_0xbd4e('0x47')](_0x231b61['query'][_0xbd4e('0x47')]));_0x113489[_0xbd4e('0x46')]=_0x113489['attributes'][_0xbd4e('0x48')]?_0x113489[_0xbd4e('0x46')]:_0x5ddaf9['model'];if(_0x231b61[_0xbd4e('0x43')][_0xbd4e('0x58')]){_0x113489[_0xbd4e('0x52')]=[{'all':!![]}];}_0x113489=_[_0xbd4e('0x4f')]({},_0x113489,_0x231b61[_0xbd4e('0x50')]);return db[_0xbd4e('0x51')][_0xbd4e('0x38')](_0x113489)[_0xbd4e('0x2c')](handleEntityNotFound(_0x3a8461,null))[_0xbd4e('0x2c')](respondWithResult(_0x3a8461,null))[_0xbd4e('0x54')](handleError(_0x3a8461,null));};exports[_0xbd4e('0x59')]=function(_0x5a2674,_0x43f97f){return db[_0xbd4e('0x51')][_0xbd4e('0x59')](_0x5a2674['body'],{})['then'](function(_0x4f8c86){var _0x5b1205=_0x5a2674[_0xbd4e('0x5a')][_0xbd4e('0x2e')]({'plain':!![]});if(!_0x5b1205)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b1205[_0xbd4e('0x5b')]===_0xbd4e('0x5a')){var _0x50683b=_0x4f8c86[_0xbd4e('0x2e')]({'plain':!![]});var _0x13444a=[{'name':_0xbd4e('0x2f'),'value':_0xbd4e('0x30')},{'name':_0xbd4e('0x31'),'value':_0xbd4e('0x32')}];var _0x428120=_[_0xbd4e('0x38')](_0x13444a,[_0xbd4e('0x35'),_0x50683b['type']])[_0xbd4e('0x39')];return db[_0xbd4e('0x5c')][_0xbd4e('0x38')]({'where':{'name':_0x428120,'userProfileId':_0x5b1205[_0xbd4e('0x5d')]},'raw':!![]})[_0xbd4e('0x2c')](function(_0x417310){if(_0x417310&&_0x417310[_0xbd4e('0x5e')]===0x0){return db['UserProfileResource'][_0xbd4e('0x59')]({'name':_0x50683b[_0xbd4e('0x39')],'resourceId':_0x50683b['id'],'type':_0x417310[_0xbd4e('0x39')],'sectionId':_0x417310['id']},{})[_0xbd4e('0x2c')](function(){return _0x4f8c86;});}else{return _0x4f8c86;}})[_0xbd4e('0x54')](function(_0x231139){logger[_0xbd4e('0x3c')](_0xbd4e('0x5f'),_0x231139);throw _0x231139;});}return _0x4f8c86;})[_0xbd4e('0x2c')](respondWithResult(_0x43f97f,0xc9))['catch'](handleError(_0x43f97f,null));};exports['clone']=function(_0x2c3d27,_0x1000d9){var _0x89d952={'where':{'id':_0x2c3d27[_0xbd4e('0x56')]['id']}},_0x549603={};_0x549603['model']=_[_0xbd4e('0x57')](db[_0xbd4e('0x51')][_0xbd4e('0x3f')]);_0x89d952[_0xbd4e('0x46')]=_['intersection'](_0x549603[_0xbd4e('0x42')],qs[_0xbd4e('0x47')](_0x2c3d27[_0xbd4e('0x43')][_0xbd4e('0x47')]));_0x89d952['attributes']=_0x89d952[_0xbd4e('0x46')][_0xbd4e('0x48')]?_0x89d952[_0xbd4e('0x46')]:_0x549603[_0xbd4e('0x42')];if(_0x2c3d27['query']['includeAll']){_0x89d952['include']=[{'all':!![]}];}_0x89d952=_[_0xbd4e('0x4f')]({},_0x89d952,_0x2c3d27['options']);return db[_0xbd4e('0x51')][_0xbd4e('0x38')](_0x89d952)[_0xbd4e('0x2c')](handleEntityNotFound(_0x1000d9,null))['then'](function(_0x4fd4f3){if(_0x4fd4f3){var _0x2fef8e=_0x4fd4f3[_0xbd4e('0x2e')]({'plain':!![]});_0x2fef8e=qs['omit'](_0x2fef8e,['id',_0xbd4e('0x60'),_0xbd4e('0x61')]);_0x2c3d27['body']=_['omit'](_0x2c3d27[_0xbd4e('0x62')],['id',_0xbd4e('0x60'),'updatedAt']);return db[_0xbd4e('0x51')][_0xbd4e('0x59')](_[_0xbd4e('0x4f')](_0x2fef8e,_0x2c3d27['body']),{'include':_0x2c3d27[_0xbd4e('0x43')][_0xbd4e('0x58')]?[{'all':!![]}]:undefined})[_0xbd4e('0x2c')](function(_0x58693f){var _0x42c82a=_0x2c3d27[_0xbd4e('0x5a')][_0xbd4e('0x2e')]({'plain':!![]});if(!_0x42c82a)throw new Error(_0xbd4e('0x63'));if(_0x42c82a[_0xbd4e('0x5b')]==='user'){var _0x47b2dc=_0x58693f[_0xbd4e('0x2e')]({'plain':!![]});var _0x5d6c4f=[{'name':'VoiceQueues','value':_0xbd4e('0x30')},{'name':_0xbd4e('0x31'),'value':_0xbd4e('0x32')}];var _0x39ae97=_[_0xbd4e('0x38')](_0x5d6c4f,[_0xbd4e('0x35'),_0x47b2dc[_0xbd4e('0x37')]])[_0xbd4e('0x39')];return db[_0xbd4e('0x5c')][_0xbd4e('0x38')]({'where':{'name':_0x39ae97,'userProfileId':_0x42c82a[_0xbd4e('0x5d')]},'raw':!![]})['then'](function(_0x102530){if(_0x102530&&_0x102530[_0xbd4e('0x5e')]===0x0){return db[_0xbd4e('0x3a')][_0xbd4e('0x59')]({'name':_0x47b2dc[_0xbd4e('0x39')],'resourceId':_0x47b2dc['id'],'type':_0x102530[_0xbd4e('0x39')],'sectionId':_0x102530['id']},{})[_0xbd4e('0x2c')](function(){return _0x58693f;});}else{return _0x58693f;}})[_0xbd4e('0x54')](function(_0x6bcd09){logger[_0xbd4e('0x3c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6bcd09);throw _0x6bcd09;});}return _0x58693f;});}})[_0xbd4e('0x2c')](respondWithResult(_0x1000d9,0xc9))[_0xbd4e('0x54')](handleError(_0x1000d9,null));};exports[_0xbd4e('0x2b')]=function(_0x431edd,_0x2e1b20){if(_0x431edd[_0xbd4e('0x62')]['id']){delete _0x431edd['body']['id'];}return db[_0xbd4e('0x51')][_0xbd4e('0x38')]({'where':{'id':_0x431edd[_0xbd4e('0x56')]['id']}})['then'](handleEntityNotFound(_0x2e1b20,null))[_0xbd4e('0x2c')](saveUpdates(_0x431edd[_0xbd4e('0x62')],null))[_0xbd4e('0x2c')](respondWithResult(_0x2e1b20,null))[_0xbd4e('0x54')](handleError(_0x2e1b20,null));};exports[_0xbd4e('0x2d')]=function(_0x18dcc8,_0x65a8b4){return db[_0xbd4e('0x51')]['find']({'where':{'id':_0x18dcc8[_0xbd4e('0x56')]['id']}})[_0xbd4e('0x2c')](handleEntityNotFound(_0x65a8b4,null))[_0xbd4e('0x2c')](removeEntity(_0x65a8b4,null))[_0xbd4e('0x54')](handleError(_0x65a8b4,null));};exports[_0xbd4e('0x64')]=function(_0x33ffeb,_0x4070d2,_0x25dbd9){var _0x1cc6db={'raw':![],'where':{}};var _0x239f02={};var _0x4f5402={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xbd4e('0x65')]({'where':{'id':_0x33ffeb[_0xbd4e('0x56')]['id']}})['then'](handleEntityNotFound(_0x4070d2,null))[_0xbd4e('0x2c')](function(_0x596ad3){if(_0x596ad3){_0x239f02[_0xbd4e('0x42')]=_[_0xbd4e('0x57')](db[_0xbd4e('0x66')][_0xbd4e('0x3f')]);_0x239f02[_0xbd4e('0x43')]=_[_0xbd4e('0x57')](_0x33ffeb['query']);_0x239f02[_0xbd4e('0x44')]=_['intersection'](_0x239f02[_0xbd4e('0x42')],_0x239f02[_0xbd4e('0x43')]);_0x1cc6db['attributes']=_[_0xbd4e('0x45')](_0x239f02[_0xbd4e('0x42')],qs[_0xbd4e('0x47')](_0x33ffeb['query'][_0xbd4e('0x47')]));_0x1cc6db[_0xbd4e('0x46')]=_0x1cc6db['attributes'][_0xbd4e('0x48')]?_0x1cc6db[_0xbd4e('0x46')]:_0x239f02[_0xbd4e('0x42')];if(!_0x33ffeb['query'][_0xbd4e('0x67')](_0xbd4e('0x49'))){_0x1cc6db['limit']=qs[_0xbd4e('0x25')](_0x33ffeb[_0xbd4e('0x43')][_0xbd4e('0x25')]);_0x1cc6db[_0xbd4e('0x24')]=qs['offset'](_0x33ffeb[_0xbd4e('0x43')][_0xbd4e('0x24')]);}_0x1cc6db['order']=qs[_0xbd4e('0x4b')](_0x33ffeb[_0xbd4e('0x43')][_0xbd4e('0x4b')]);_0x1cc6db['where']=qs[_0xbd4e('0x44')](_[_0xbd4e('0x68')](_0x33ffeb[_0xbd4e('0x43')],_0x239f02[_0xbd4e('0x44')]));_0x1cc6db[_0xbd4e('0x4c')]['VoiceQueueId']=_0x596ad3['id'];if(_0x33ffeb[_0xbd4e('0x43')][_0xbd4e('0x33')]){_0x1cc6db[_0xbd4e('0x4c')]=_[_0xbd4e('0x4f')](_0x1cc6db[_0xbd4e('0x4c')],{'$or':_[_0xbd4e('0x4d')](_0x1cc6db[_0xbd4e('0x46')],function(_0x2f13b0){var _0x47266c={};_0x47266c[_0x2f13b0]={'$like':'%'+_0x33ffeb[_0xbd4e('0x43')]['filter']+'%'};return _0x47266c;})});}_0x1cc6db=_[_0xbd4e('0x4f')]({},_0x1cc6db,_0x33ffeb[_0xbd4e('0x50')]);return db[_0xbd4e('0x66')]['count']({'where':_0x1cc6db['where']})[_0xbd4e('0x2c')](function(_0x30d3b5){_0x4f5402['count']=_0x30d3b5;if(_0x33ffeb[_0xbd4e('0x43')][_0xbd4e('0x58')]){_0x1cc6db[_0xbd4e('0x52')]=[{'all':!![]}];}return db[_0xbd4e('0x66')]['findAll'](_0x1cc6db);})['then'](function(_0x2aec10){_0x4f5402[_0xbd4e('0x69')]=_0x2aec10;return _0x4f5402;});}})[_0xbd4e('0x2c')](respondWithFilteredResult(_0x4070d2,_0x1cc6db))[_0xbd4e('0x54')](handleError(_0x4070d2,null));};exports['getHopperHistories']=function(_0xe932e3,_0x5a670d,_0x55888e){var _0x2c952e={'raw':!![],'where':{}};var _0x4792d5={};var _0x4f713c={'count':0x0,'rows':[]};return db[_0xbd4e('0x51')]['findOne']({'where':{'id':_0xe932e3[_0xbd4e('0x56')]['id']}})[_0xbd4e('0x2c')](handleEntityNotFound(_0x5a670d,null))[_0xbd4e('0x2c')](function(_0xba08e4){if(_0xba08e4){_0x4792d5[_0xbd4e('0x42')]=_[_0xbd4e('0x57')](db[_0xbd4e('0x6a')][_0xbd4e('0x3f')]);_0x4792d5[_0xbd4e('0x43')]=_[_0xbd4e('0x57')](_0xe932e3[_0xbd4e('0x43')]);_0x4792d5['filters']=_[_0xbd4e('0x45')](_0x4792d5[_0xbd4e('0x42')],_0x4792d5[_0xbd4e('0x43')]);_0x2c952e[_0xbd4e('0x46')]=_[_0xbd4e('0x45')](_0x4792d5[_0xbd4e('0x42')],qs[_0xbd4e('0x47')](_0xe932e3[_0xbd4e('0x43')][_0xbd4e('0x47')]));_0x2c952e[_0xbd4e('0x46')]=_0x2c952e[_0xbd4e('0x46')]['length']?_0x2c952e[_0xbd4e('0x46')]:_0x4792d5[_0xbd4e('0x42')];if(!_0xe932e3[_0xbd4e('0x43')][_0xbd4e('0x67')](_0xbd4e('0x49'))){_0x2c952e[_0xbd4e('0x25')]=qs['limit'](_0xe932e3[_0xbd4e('0x43')]['limit']);_0x2c952e[_0xbd4e('0x24')]=qs[_0xbd4e('0x24')](_0xe932e3[_0xbd4e('0x43')]['offset']);}_0x2c952e['order']=qs[_0xbd4e('0x4b')](_0xe932e3[_0xbd4e('0x43')][_0xbd4e('0x4b')]);_0x2c952e[_0xbd4e('0x4c')]=qs[_0xbd4e('0x44')](_[_0xbd4e('0x68')](_0xe932e3['query'],_0x4792d5[_0xbd4e('0x44')]));_0x2c952e[_0xbd4e('0x4c')][_0xbd4e('0x6b')]=_0xba08e4['id'];if(_0xe932e3[_0xbd4e('0x43')][_0xbd4e('0x33')]){_0x2c952e[_0xbd4e('0x4c')]=_['merge'](_0x2c952e['where'],{'$or':_[_0xbd4e('0x4d')](_0x2c952e[_0xbd4e('0x46')],function(_0x94fe35){var _0x51770c={};_0x51770c[_0x94fe35]={'$like':'%'+_0xe932e3[_0xbd4e('0x43')][_0xbd4e('0x33')]+'%'};return _0x51770c;})});}_0x2c952e=_[_0xbd4e('0x4f')]({},_0x2c952e,_0xe932e3[_0xbd4e('0x50')]);return db['CmHopperHistory']['count']({'where':_0x2c952e[_0xbd4e('0x4c')]})[_0xbd4e('0x2c')](function(_0x1732b7){_0x4f713c['count']=_0x1732b7;if(_0xe932e3['query'][_0xbd4e('0x58')]){_0x2c952e[_0xbd4e('0x52')]=[{'all':!![]}];}return db[_0xbd4e('0x6a')]['findAll'](_0x2c952e);})['then'](function(_0x4673fc){_0x4f713c[_0xbd4e('0x69')]=_0x4673fc;return _0x4f713c;});}})[_0xbd4e('0x2c')](respondWithFilteredResult(_0x5a670d,_0x2c952e))[_0xbd4e('0x54')](handleError(_0x5a670d,null));};exports[_0xbd4e('0x6c')]=function(_0x20af55,_0x4898f8,_0x11cb8f){var _0x3afd79={'raw':!![],'where':{}};var _0x554a31={};var _0xa264cc={'count':0x0,'rows':[]};return db[_0xbd4e('0x51')][_0xbd4e('0x65')]({'where':{'id':_0x20af55['params']['id']}})['then'](handleEntityNotFound(_0x4898f8,null))[_0xbd4e('0x2c')](function(_0x4825e2){if(_0x4825e2){_0x554a31[_0xbd4e('0x42')]=_[_0xbd4e('0x57')](db[_0xbd4e('0x6d')][_0xbd4e('0x3f')]);_0x554a31['query']=_[_0xbd4e('0x57')](_0x20af55[_0xbd4e('0x43')]);_0x554a31[_0xbd4e('0x44')]=_['intersection'](_0x554a31[_0xbd4e('0x42')],_0x554a31[_0xbd4e('0x43')]);_0x3afd79['attributes']=_[_0xbd4e('0x45')](_0x554a31['model'],qs['fields'](_0x20af55[_0xbd4e('0x43')][_0xbd4e('0x47')]));_0x3afd79[_0xbd4e('0x46')]=_0x3afd79[_0xbd4e('0x46')]['length']?_0x3afd79[_0xbd4e('0x46')]:_0x554a31['model'];if(!_0x20af55['query'][_0xbd4e('0x67')]('nolimit')){_0x3afd79[_0xbd4e('0x25')]=qs[_0xbd4e('0x25')](_0x20af55[_0xbd4e('0x43')][_0xbd4e('0x25')]);_0x3afd79['offset']=qs[_0xbd4e('0x24')](_0x20af55['query'][_0xbd4e('0x24')]);}_0x3afd79[_0xbd4e('0x4a')]=qs[_0xbd4e('0x4b')](_0x20af55['query'][_0xbd4e('0x4b')]);_0x3afd79[_0xbd4e('0x4c')]=qs[_0xbd4e('0x44')](_[_0xbd4e('0x68')](_0x20af55[_0xbd4e('0x43')],_0x554a31[_0xbd4e('0x44')]));_0x3afd79['where'][_0xbd4e('0x6b')]=_0x4825e2['id'];if(_0x20af55[_0xbd4e('0x43')]['filter']){_0x3afd79[_0xbd4e('0x4c')]=_[_0xbd4e('0x4f')](_0x3afd79[_0xbd4e('0x4c')],{'$or':_['map'](_0x3afd79[_0xbd4e('0x46')],function(_0x182e38){var _0x1b05ae={};_0x1b05ae[_0x182e38]={'$like':'%'+_0x20af55['query']['filter']+'%'};return _0x1b05ae;})});}_0x3afd79=_[_0xbd4e('0x4f')]({},_0x3afd79,_0x20af55[_0xbd4e('0x50')]);return db['CmHopperFinal']['count']({'where':_0x3afd79['where']})[_0xbd4e('0x2c')](function(_0x1d394b){_0xa264cc['count']=_0x1d394b;if(_0x20af55['query'][_0xbd4e('0x58')]){_0x3afd79['include']=[{'all':!![]}];}return db[_0xbd4e('0x6d')]['findAll'](_0x3afd79);})['then'](function(_0x256795){_0xa264cc[_0xbd4e('0x69')]=_0x256795;return _0xa264cc;});}})[_0xbd4e('0x2c')](respondWithFilteredResult(_0x4898f8,_0x3afd79))['catch'](handleError(_0x4898f8,null));};exports[_0xbd4e('0x6e')]=function(_0xb7bfde,_0x393528,_0xd1eabf){var _0x394ced={'raw':!![],'where':{}};var _0x477d3e={};var _0x68c180={'count':0x0,'rows':[]};return db[_0xbd4e('0x51')][_0xbd4e('0x65')]({'where':{'id':_0xb7bfde['params']['id']}})[_0xbd4e('0x2c')](handleEntityNotFound(_0x393528,null))[_0xbd4e('0x2c')](function(_0xfd7b11){if(_0xfd7b11){_0x477d3e[_0xbd4e('0x42')]=_[_0xbd4e('0x57')](db['CmHopperBlack'][_0xbd4e('0x3f')]);_0x477d3e['query']=_[_0xbd4e('0x57')](_0xb7bfde[_0xbd4e('0x43')]);_0x477d3e['filters']=_['intersection'](_0x477d3e[_0xbd4e('0x42')],_0x477d3e[_0xbd4e('0x43')]);_0x394ced[_0xbd4e('0x46')]=_[_0xbd4e('0x45')](_0x477d3e[_0xbd4e('0x42')],qs[_0xbd4e('0x47')](_0xb7bfde[_0xbd4e('0x43')][_0xbd4e('0x47')]));_0x394ced['attributes']=_0x394ced[_0xbd4e('0x46')]['length']?_0x394ced[_0xbd4e('0x46')]:_0x477d3e[_0xbd4e('0x42')];if(!_0xb7bfde[_0xbd4e('0x43')]['hasOwnProperty'](_0xbd4e('0x49'))){_0x394ced['limit']=qs[_0xbd4e('0x25')](_0xb7bfde['query'][_0xbd4e('0x25')]);_0x394ced[_0xbd4e('0x24')]=qs['offset'](_0xb7bfde[_0xbd4e('0x43')]['offset']);}_0x394ced[_0xbd4e('0x4a')]=qs[_0xbd4e('0x4b')](_0xb7bfde['query'][_0xbd4e('0x4b')]);_0x394ced['where']=qs[_0xbd4e('0x44')](_[_0xbd4e('0x68')](_0xb7bfde[_0xbd4e('0x43')],_0x477d3e[_0xbd4e('0x44')]));_0x394ced[_0xbd4e('0x4c')][_0xbd4e('0x6b')]=_0xfd7b11['id'];if(_0xb7bfde[_0xbd4e('0x43')][_0xbd4e('0x33')]){_0x394ced[_0xbd4e('0x4c')]=_['merge'](_0x394ced[_0xbd4e('0x4c')],{'$or':_['map'](_0x394ced[_0xbd4e('0x46')],function(_0xe49da1){var _0x521070={};_0x521070[_0xe49da1]={'$like':'%'+_0xb7bfde[_0xbd4e('0x43')][_0xbd4e('0x33')]+'%'};return _0x521070;})});}_0x394ced=_[_0xbd4e('0x4f')]({},_0x394ced,_0xb7bfde[_0xbd4e('0x50')]);return db[_0xbd4e('0x6f')][_0xbd4e('0x26')]({'where':_0x394ced[_0xbd4e('0x4c')]})[_0xbd4e('0x2c')](function(_0x1d6475){_0x68c180[_0xbd4e('0x26')]=_0x1d6475;if(_0xb7bfde['query'][_0xbd4e('0x58')]){_0x394ced[_0xbd4e('0x52')]=[{'all':!![]}];}return db[_0xbd4e('0x6f')]['findAll'](_0x394ced);})[_0xbd4e('0x2c')](function(_0x1d555f){_0x68c180[_0xbd4e('0x69')]=_0x1d555f;return _0x68c180;});}})[_0xbd4e('0x2c')](respondWithFilteredResult(_0x393528,_0x394ced))['catch'](handleError(_0x393528,null));};exports[_0xbd4e('0x70')]=function(_0x111bf3,_0x24f85a,_0x2eb4a9){var _0x417ce5={};var _0x1b5def={};var _0x3f81ca;var _0x123203;return db[_0xbd4e('0x51')][_0xbd4e('0x65')]({'where':{'id':_0x111bf3['params']['id']}})['then'](handleEntityNotFound(_0x24f85a,null))['then'](function(_0x371626){if(_0x371626){_0x3f81ca=_0x371626;_0x1b5def[_0xbd4e('0x42')]=_[_0xbd4e('0x57')](db[_0xbd4e('0x71')][_0xbd4e('0x3f')]);_0x1b5def[_0xbd4e('0x43')]=_['keys'](_0x111bf3[_0xbd4e('0x43')]);_0x1b5def[_0xbd4e('0x44')]=_[_0xbd4e('0x45')](_0x1b5def[_0xbd4e('0x42')],_0x1b5def[_0xbd4e('0x43')]);_0x417ce5[_0xbd4e('0x46')]=_[_0xbd4e('0x45')](_0x1b5def[_0xbd4e('0x42')],qs[_0xbd4e('0x47')](_0x111bf3[_0xbd4e('0x43')]['fields']));_0x417ce5['attributes']=_0x417ce5[_0xbd4e('0x46')][_0xbd4e('0x48')]?_0x417ce5[_0xbd4e('0x46')]:_0x1b5def[_0xbd4e('0x42')];_0x417ce5[_0xbd4e('0x4a')]=qs[_0xbd4e('0x4b')](_0x111bf3['query'][_0xbd4e('0x4b')]);_0x417ce5['where']=qs[_0xbd4e('0x44')](_[_0xbd4e('0x68')](_0x111bf3['query'],_0x1b5def[_0xbd4e('0x44')]));if(_0x111bf3[_0xbd4e('0x43')][_0xbd4e('0x33')]){_0x417ce5[_0xbd4e('0x4c')]=_[_0xbd4e('0x4f')](_0x417ce5[_0xbd4e('0x4c')],{'$or':_['map'](_0x417ce5[_0xbd4e('0x46')],function(_0x12e259){var _0x35a270={};_0x35a270[_0x12e259]={'$like':'%'+_0x111bf3[_0xbd4e('0x43')][_0xbd4e('0x33')]+'%'};return _0x35a270;})});}_0x417ce5=_[_0xbd4e('0x4f')]({},_0x417ce5,_0x111bf3[_0xbd4e('0x50')]);return _0x3f81ca['getTeams'](_0x417ce5);}})[_0xbd4e('0x2c')](function(_0x530c6a){if(_0x530c6a){_0x123203=_0x530c6a[_0xbd4e('0x48')];if(!_0x111bf3[_0xbd4e('0x43')][_0xbd4e('0x67')](_0xbd4e('0x49'))){_0x417ce5['limit']=qs['limit'](_0x111bf3['query'][_0xbd4e('0x25')]);_0x417ce5['offset']=qs['offset'](_0x111bf3[_0xbd4e('0x43')][_0xbd4e('0x24')]);}return _0x3f81ca[_0xbd4e('0x70')](_0x417ce5);}})['then'](function(_0x4f3f6b){if(_0x4f3f6b){return _0x4f3f6b?{'count':_0x123203,'rows':_0x4f3f6b}:null;}})[_0xbd4e('0x2c')](respondWithResult(_0x24f85a,null))[_0xbd4e('0x54')](handleError(_0x24f85a,null));};exports[_0xbd4e('0x72')]=function(_0x419079,_0x1fa85c,_0x50b3eb){var _0x19a30a=_0x419079[_0xbd4e('0x62')][_0xbd4e('0x73')];var _0x22991f=_[_0xbd4e('0x4d')](_0x19a30a,'id');return db['Team'][_0xbd4e('0x53')]({'where':{'id':_0x22991f},'attributes':['id'],'include':[{'model':db[_0xbd4e('0x74')],'as':_0xbd4e('0x75'),'attributes':['id',_0xbd4e('0x39'),_0xbd4e('0x76'),_0xbd4e('0x77'),_0xbd4e('0x78')],'raw':!![]}]})[_0xbd4e('0x2c')](function(_0xdf0bcc){if(_0xdf0bcc){var _0x46ca4d=_[_0xbd4e('0x79')](_0xdf0bcc,function(_0x3565b4){var _0x2ee400=_0x3565b4[_0xbd4e('0x2e')]({'plain':!![]});_0x2ee400[_0xbd4e('0x75')][_0xbd4e('0x7a')](function(_0xae4835){_0xae4835[_0xbd4e('0x7b')]=_[_0xbd4e('0x38')](_0x19a30a,{'id':_0x2ee400['id']})['penalty'];});return _0x2ee400[_0xbd4e('0x75')];});return db[_0xbd4e('0x51')][_0xbd4e('0x38')]({'where':{'id':_0x419079[_0xbd4e('0x56')]['id']}})[_0xbd4e('0x2c')](function(_0x741f1){return db[_0xbd4e('0x7c')]['transaction'](function(_0x1b282a){return _0x741f1['addTeams'](_0x22991f,{'transaction':_0x1b282a})['then'](function(){return BPromise[_0xbd4e('0x7d')](_0x19a30a,function(_0xdba857){return db[_0xbd4e('0x7e')][_0xbd4e('0x7f')]({'TeamId':_0xdba857['id'],'VoiceQueueId':_0x419079[_0xbd4e('0x56')]['id'],'penalty':_0xdba857[_0xbd4e('0x7b')]},{'transaction':_0x1b282a});});})['then'](function(){return BPromise[_0xbd4e('0x7d')](_0x46ca4d,function(_0x356ee2){return db[_0xbd4e('0x80')]['findOrCreate']({'where':{'UserId':_0x356ee2['id'],'VoiceQueueId':_0x419079[_0xbd4e('0x56')]['id']},'defaults':{'penalty':_0x356ee2[_0xbd4e('0x7b')]},'transaction':_0x1b282a});});})['then'](function(){return BPromise[_0xbd4e('0x7d')](_[_0xbd4e('0x33')](_0x46ca4d,{'online':!![]}),function(_0x3cf33b){return db['UserVoiceQueueRt']['upsert']({'membername':_0x3cf33b['name'],'UserId':_0x3cf33b['id'],'queue_name':_0x741f1[_0xbd4e('0x39')],'VoiceQueueId':_0x741f1['id'],'interface':_[_0xbd4e('0x81')](_0x3cf33b[_0xbd4e('0x78')])?util[_0xbd4e('0x82')](_0xbd4e('0x83'),_0x3cf33b['name']):_0x3cf33b[_0xbd4e('0x78')],'paused':_0x3cf33b[_0xbd4e('0x77')]||![],'penalty':_0x3cf33b['penalty']},{'transaction':_0x1b282a});});})[_0xbd4e('0x2c')](function(){_0x46ca4d[_0xbd4e('0x7a')](function(_0x47ac2b){socket['emit'](_0xbd4e('0x84'),{'UserId':_0x47ac2b['id'],'VoiceQueueId':_0x741f1['id']});});});});});}})[_0xbd4e('0x2c')](respondWithStatusCode(_0x1fa85c,null))[_0xbd4e('0x54')](handleError(_0x1fa85c,null));};exports['removeTeams']=function(_0x469f8e,_0xf12e9f,_0x25a3a2){return db['Team']['findAll']({'where':{'id':_0x469f8e[_0xbd4e('0x43')][_0xbd4e('0x85')]},'attributes':['id'],'include':[{'model':db[_0xbd4e('0x74')],'as':_0xbd4e('0x75'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xf12e9f,null))[_0xbd4e('0x2c')](function(_0x365352){var _0x9757e6=_['map'](_0x365352,'id');var _0x2fa418=[];var _0x38471a=[];var _0x2f3b04=squel[_0xbd4e('0x86')]();_0x2f3b04[_0xbd4e('0x87')](_0xbd4e('0x88'))[_0xbd4e('0x89')](_0xbd4e('0x8a'),'tq')[_0xbd4e('0x8b')](_0xbd4e('0x8c'),'ut',_0xbd4e('0x8d'))[_0xbd4e('0x4c')](_0xbd4e('0x8e'),_0x469f8e[_0xbd4e('0x56')]['id']);for(var _0x1385cf=0x0;_0x1385cf<_0x365352[_0xbd4e('0x48')];_0x1385cf+=0x1){let _0x5bc7e2=_0x365352[_0x1385cf];for(var _0xc1cc3=0x0;_0xc1cc3<_0x5bc7e2[_0xbd4e('0x75')][_0xbd4e('0x48')];_0xc1cc3+=0x1){let _0x50703b=_0x5bc7e2[_0xbd4e('0x75')][_0xc1cc3];var _0x24a6ff=_0x2f3b04[_0xbd4e('0x8f')]();_0x24a6ff[_0xbd4e('0x4c')]('ut.UserId\x20=\x20?',_0x50703b['id']);_0x38471a[_0xbd4e('0x90')](db[_0xbd4e('0x7c')][_0xbd4e('0x43')](_0x24a6ff[_0xbd4e('0x91')](),{'type':db['sequelize'][_0xbd4e('0x92')]['SELECT']})[_0xbd4e('0x2c')](function(_0x23116f){if(_0x23116f['length']===0x1){return _0x50703b['id'];}else{var _0x43e531=_[_0xbd4e('0x93')](_[_0xbd4e('0x4d')](_0x23116f,_0xbd4e('0x94')),function(_0x2f95f8){return _[_0xbd4e('0x36')](_0x9757e6,_0x2f95f8);});if(_0x43e531){return _0x50703b['id'];}}}));}}return BPromise[_0xbd4e('0x95')](_0x38471a)['then'](function(_0x47d6ba){_0x2fa418=_(_0x2fa418)['union'](_0x47d6ba)[_0xbd4e('0x96')]()['value']();return db['VoiceQueue'][_0xbd4e('0x38')]({'where':{'id':_0x469f8e['params']['id']}})[_0xbd4e('0x2c')](function(_0xf588ee){return db[_0xbd4e('0x7c')][_0xbd4e('0x97')](function(_0x25b034){return _0xf588ee[_0xbd4e('0x98')](_0x469f8e[_0xbd4e('0x43')]['ids'],{'transaction':_0x25b034})[_0xbd4e('0x2c')](function(){if(!_[_0xbd4e('0x99')](_0x2fa418)){return _0xf588ee[_0xbd4e('0x9a')](_0x2fa418,{'transaction':_0x25b034})['then'](function(){return db[_0xbd4e('0x9b')][_0xbd4e('0x2d')]({'where':{'VoiceQueueId':_0x469f8e[_0xbd4e('0x56')]['id'],'UserId':_0x2fa418},'transaction':_0x25b034});});}})[_0xbd4e('0x2c')](function(){_0x2fa418[_0xbd4e('0x7a')](function(_0x18aa9b){socket['emit'](_0xbd4e('0x9c'),{'UserId':_0x18aa9b,'VoiceQueueId':_0xf588ee['id']});});});});});});})[_0xbd4e('0x2c')](respondWithStatusCode(_0xf12e9f,null))[_0xbd4e('0x54')](handleError(_0xf12e9f,null));};exports[_0xbd4e('0x9d')]=function(_0x3cc118,_0x527c0c,_0x174b87){var _0x225411,_0x23f302;return db[_0xbd4e('0x51')]['find']({'where':{'id':_0x3cc118['params']['id']}})[_0xbd4e('0x2c')](handleEntityNotFound(_0x527c0c,null))['then'](function(_0x12be7c){if(_0x12be7c){_0x23f302=_0x12be7c;return _0x12be7c[_0xbd4e('0x9d')](_0x3cc118[_0xbd4e('0x62')][_0xbd4e('0x85')],_[_0xbd4e('0x9e')](_0x3cc118[_0xbd4e('0x62')],[_0xbd4e('0x85'),'id'])||{})[_0xbd4e('0x9f')](function(_0x21d655){for(var _0x5732ff=0x0;_0x5732ff<_0x3cc118[_0xbd4e('0x62')][_0xbd4e('0x85')][_0xbd4e('0x48')];_0x5732ff+=0x1){socket[_0xbd4e('0xa0')](_0xbd4e('0x84'),{'UserId':Number(_0x3cc118[_0xbd4e('0x62')][_0xbd4e('0x85')][_0x5732ff]),'VoiceQueueId':Number(_0x3cc118[_0xbd4e('0x56')]['id'])});}return _0x21d655;});}})['then'](function(_0x35b7f5){_0x225411=_0x35b7f5||[];if(_0x23f302){return db[_0xbd4e('0x74')][_0xbd4e('0x53')]({'where':{'id':_0x3cc118[_0xbd4e('0x62')][_0xbd4e('0x85')]},'attributes':['id',_0xbd4e('0x39'),_0xbd4e('0x76'),'voicePause','interface'],'raw':!![]});}})[_0xbd4e('0x2c')](function(_0x398fb0){if(!_['isEmpty'](_0x398fb0)){var _0x569ce5=[];for(var _0x5eaeb8=0x0;_0x5eaeb8<_0x398fb0['length'];_0x5eaeb8++){if(_0x398fb0[_0x5eaeb8][_0xbd4e('0x76')]){_0x569ce5[_0xbd4e('0x90')](db[_0xbd4e('0x9b')]['upsert']({'membername':_0x398fb0[_0x5eaeb8]['name'],'UserId':_0x398fb0[_0x5eaeb8]['id'],'queue_name':_0x23f302[_0xbd4e('0x39')],'VoiceQueueId':_0x23f302['id'],'interface':_[_0xbd4e('0x81')](_0x398fb0[_0x5eaeb8][_0xbd4e('0x78')])?util[_0xbd4e('0x82')](_0xbd4e('0x83'),_0x398fb0[_0x5eaeb8]['name']):_0x398fb0[_0x5eaeb8][_0xbd4e('0x78')],'paused':_0x398fb0[_0x5eaeb8][_0xbd4e('0x77')]||![],'penalty':_0x3cc118[_0xbd4e('0x62')][_0xbd4e('0x7b')]||0x0}));}}return BPromise[_0xbd4e('0x95')](_0x569ce5);}})[_0xbd4e('0x2c')](function(){return _0x225411;})['then'](respondWithResult(_0x527c0c,null))[_0xbd4e('0x54')](handleError(_0x527c0c,null));};exports[_0xbd4e('0x9a')]=function(_0x45c703,_0x593797,_0x10a574){return db[_0xbd4e('0x51')][_0xbd4e('0x38')]({'where':{'id':_0x45c703[_0xbd4e('0x56')]['id']}})['then'](handleEntityNotFound(_0x593797,null))['then'](function(_0x432bbe){if(_0x432bbe){return _0x432bbe['removeAgents'](_0x45c703['query'][_0xbd4e('0x85')])[_0xbd4e('0x2c')](function(){if(_['isArray'](_0x45c703['query'][_0xbd4e('0x85')])){for(var _0x2e39df=0x0;_0x2e39df<_0x45c703[_0xbd4e('0x43')][_0xbd4e('0x85')][_0xbd4e('0x48')];_0x2e39df+=0x1){socket[_0xbd4e('0xa0')](_0xbd4e('0x9c'),{'UserId':Number(_0x45c703[_0xbd4e('0x43')][_0xbd4e('0x85')][_0x2e39df]),'VoiceQueueId':Number(_0x45c703[_0xbd4e('0x56')]['id'])});}}else{socket[_0xbd4e('0xa0')](_0xbd4e('0x9c'),{'UserId':Number(_0x45c703[_0xbd4e('0x43')][_0xbd4e('0x85')]),'VoiceQueueId':Number(_0x45c703[_0xbd4e('0x56')]['id'])});}});}})[_0xbd4e('0x2c')](function(_0x3acde2){return db[_0xbd4e('0x9b')][_0xbd4e('0x2d')]({'where':{'VoiceQueueId':_0x45c703[_0xbd4e('0x56')]['id'],'UserId':_0x45c703[_0xbd4e('0x43')][_0xbd4e('0x85')]}})[_0xbd4e('0x2c')](function(){return _0x3acde2;});})['then'](respondWithStatusCode(_0x593797,null))[_0xbd4e('0x54')](handleError(_0x593797,null));};exports[_0xbd4e('0xa1')]=function(_0x5895a3,_0x5a84f1,_0xff1bd1){var _0x24cfe0={};var _0x244861={};var _0x123fdd;var _0x41d8e3;return db[_0xbd4e('0x51')][_0xbd4e('0x65')]({'where':{'id':_0x5895a3[_0xbd4e('0x56')]['id']}})['then'](handleEntityNotFound(_0x5a84f1,null))[_0xbd4e('0x2c')](function(_0x8d7ae){if(_0x8d7ae){_0x123fdd=_0x8d7ae;_0x244861['model']=_[_0xbd4e('0x57')](db[_0xbd4e('0x74')][_0xbd4e('0x3f')]);_0x244861[_0xbd4e('0x43')]=_['keys'](_0x5895a3[_0xbd4e('0x43')]);_0x244861[_0xbd4e('0x44')]=_['intersection'](_0x244861[_0xbd4e('0x42')],_0x244861[_0xbd4e('0x43')]);_0x24cfe0[_0xbd4e('0x46')]=_[_0xbd4e('0x45')](_0x244861['model'],qs['fields'](_0x5895a3[_0xbd4e('0x43')][_0xbd4e('0x47')]));_0x24cfe0['attributes']=_0x24cfe0[_0xbd4e('0x46')]['length']?_0x24cfe0[_0xbd4e('0x46')]:_0x244861[_0xbd4e('0x42')];_0x24cfe0[_0xbd4e('0x4a')]=qs[_0xbd4e('0x4b')](_0x5895a3[_0xbd4e('0x43')][_0xbd4e('0x4b')]);_0x24cfe0['where']=qs[_0xbd4e('0x44')](_[_0xbd4e('0x68')](_0x5895a3[_0xbd4e('0x43')],_0x244861['filters']));if(_0x5895a3[_0xbd4e('0x43')][_0xbd4e('0x33')]){_0x24cfe0[_0xbd4e('0x4c')]=_[_0xbd4e('0x4f')](_0x24cfe0[_0xbd4e('0x4c')],{'$or':_[_0xbd4e('0x4d')](_0x24cfe0['attributes'],function(_0x605ee2){var _0x15b98e={};_0x15b98e[_0x605ee2]={'$like':'%'+_0x5895a3[_0xbd4e('0x43')][_0xbd4e('0x33')]+'%'};return _0x15b98e;})});}_0x24cfe0=_[_0xbd4e('0x4f')]({},_0x24cfe0,_0x5895a3[_0xbd4e('0x50')]);return _0x123fdd[_0xbd4e('0xa1')](_0x24cfe0);}})[_0xbd4e('0x2c')](function(_0x566264){if(_0x566264){_0x41d8e3=_0x566264[_0xbd4e('0x48')];if(!_0x5895a3['query'][_0xbd4e('0x67')](_0xbd4e('0x49'))){_0x24cfe0[_0xbd4e('0x25')]=qs['limit'](_0x5895a3[_0xbd4e('0x43')][_0xbd4e('0x25')]);_0x24cfe0['offset']=qs[_0xbd4e('0x24')](_0x5895a3[_0xbd4e('0x43')][_0xbd4e('0x24')]);}return _0x123fdd['getAgents'](_0x24cfe0);}})['then'](function(_0x1e58e5){if(_0x1e58e5){return _0x1e58e5?{'count':_0x41d8e3,'rows':_0x1e58e5}:null;}})[_0xbd4e('0x2c')](respondWithResult(_0x5a84f1,null))[_0xbd4e('0x54')](handleError(_0x5a84f1,null));};exports[_0xbd4e('0xa2')]=function(_0x4fe068,_0x50e7ee,_0x23e95c){var _0x2376ee={};var _0x27a500={};var _0x341f1f;var _0x3b396b;return db[_0xbd4e('0x51')]['findOne']({'where':{'id':_0x4fe068[_0xbd4e('0x56')]['id']}})[_0xbd4e('0x2c')](handleEntityNotFound(_0x50e7ee,null))['then'](function(_0x5b7442){if(_0x5b7442){_0x341f1f=_0x5b7442;_0x27a500[_0xbd4e('0x42')]=_[_0xbd4e('0x57')](db[_0xbd4e('0x9b')][_0xbd4e('0x3f')]);_0x27a500[_0xbd4e('0x43')]=_[_0xbd4e('0x57')](_0x4fe068['query']);_0x27a500[_0xbd4e('0x44')]=_[_0xbd4e('0x45')](_0x27a500[_0xbd4e('0x42')],_0x27a500[_0xbd4e('0x43')]);_0x2376ee[_0xbd4e('0x46')]=_[_0xbd4e('0x45')](_0x27a500[_0xbd4e('0x42')],qs['fields'](_0x4fe068[_0xbd4e('0x43')][_0xbd4e('0x47')]));_0x2376ee[_0xbd4e('0x46')]=_0x2376ee['attributes'][_0xbd4e('0x48')]?_0x2376ee[_0xbd4e('0x46')]:_0x27a500['model'];_0x2376ee['order']=qs[_0xbd4e('0x4b')](_0x4fe068[_0xbd4e('0x43')][_0xbd4e('0x4b')]);_0x2376ee[_0xbd4e('0x4c')]=qs[_0xbd4e('0x44')](_['pick'](_0x4fe068[_0xbd4e('0x43')],_0x27a500[_0xbd4e('0x44')]));if(_0x4fe068['query']['filter']){_0x2376ee[_0xbd4e('0x4c')]=_[_0xbd4e('0x4f')](_0x2376ee[_0xbd4e('0x4c')],{'$or':_[_0xbd4e('0x4d')](_0x2376ee[_0xbd4e('0x46')],function(_0x4e5b55){var _0x2619f9={};_0x2619f9[_0x4e5b55]={'$like':'%'+_0x4fe068[_0xbd4e('0x43')][_0xbd4e('0x33')]+'%'};return _0x2619f9;})});}_0x2376ee=_[_0xbd4e('0x4f')]({},_0x2376ee,_0x4fe068[_0xbd4e('0x50')]);return _0x341f1f[_0xbd4e('0xa2')](_0x2376ee);}})[_0xbd4e('0x2c')](function(_0x3b7af1){if(_0x3b7af1){_0x3b396b=_0x3b7af1[_0xbd4e('0x48')];if(!_0x4fe068[_0xbd4e('0x43')]['hasOwnProperty']('nolimit')){_0x2376ee['limit']=qs[_0xbd4e('0x25')](_0x4fe068[_0xbd4e('0x43')]['limit']);_0x2376ee[_0xbd4e('0x24')]=qs[_0xbd4e('0x24')](_0x4fe068[_0xbd4e('0x43')][_0xbd4e('0x24')]);}return _0x341f1f[_0xbd4e('0xa2')](_0x2376ee);}})[_0xbd4e('0x2c')](function(_0x25948f){return _0x25948f?{'count':_0x3b396b,'rows':_0x25948f}:null;})['then'](respondWithResult(_0x50e7ee,null))[_0xbd4e('0x54')](handleError(_0x50e7ee,null));};exports[_0xbd4e('0xa3')]=function(_0x537c6c,_0x3cd17c,_0xad9433){var _0x56a44b={};var _0xb07394={};var _0x30faf0;var _0x4a2574;return db['VoiceQueue'][_0xbd4e('0x65')]({'where':{'id':_0x537c6c[_0xbd4e('0x56')]['id']}})['then'](handleEntityNotFound(_0x3cd17c,null))['then'](function(_0x69d916){if(_0x69d916){_0x30faf0=_0x69d916;_0xb07394[_0xbd4e('0x42')]=_[_0xbd4e('0x57')](db['CmList'][_0xbd4e('0x3f')]);_0xb07394[_0xbd4e('0x43')]=_['keys'](_0x537c6c['query']);_0xb07394[_0xbd4e('0x44')]=_[_0xbd4e('0x45')](_0xb07394[_0xbd4e('0x42')],_0xb07394['query']);_0x56a44b['attributes']=_['intersection'](_0xb07394[_0xbd4e('0x42')],qs['fields'](_0x537c6c[_0xbd4e('0x43')][_0xbd4e('0x47')]));_0x56a44b[_0xbd4e('0x46')]=_0x56a44b['attributes'][_0xbd4e('0x48')]?_0x56a44b[_0xbd4e('0x46')]:_0xb07394[_0xbd4e('0x42')];_0x56a44b[_0xbd4e('0x4a')]=qs[_0xbd4e('0x4b')](_0x537c6c['query']['sort']);_0x56a44b['where']=qs['filters'](_[_0xbd4e('0x68')](_0x537c6c['query'],_0xb07394['filters']));if(_0x537c6c[_0xbd4e('0x43')][_0xbd4e('0x33')]){_0x56a44b[_0xbd4e('0x4c')]=_[_0xbd4e('0x4f')](_0x56a44b[_0xbd4e('0x4c')],{'$or':_[_0xbd4e('0x4d')](_0x56a44b[_0xbd4e('0x46')],function(_0x50aaa1){var _0x3f977d={};_0x3f977d[_0x50aaa1]={'$like':'%'+_0x537c6c['query'][_0xbd4e('0x33')]+'%'};return _0x3f977d;})});}_0x56a44b=_['merge']({},_0x56a44b,_0x537c6c[_0xbd4e('0x50')]);return _0x30faf0[_0xbd4e('0xa3')](_0x56a44b);}})[_0xbd4e('0x2c')](function(_0x4d2db9){if(_0x4d2db9){_0x4a2574=_0x4d2db9[_0xbd4e('0x48')];if(!_0x537c6c[_0xbd4e('0x43')][_0xbd4e('0x67')](_0xbd4e('0x49'))){_0x56a44b[_0xbd4e('0x25')]=qs['limit'](_0x537c6c[_0xbd4e('0x43')][_0xbd4e('0x25')]);_0x56a44b[_0xbd4e('0x24')]=qs[_0xbd4e('0x24')](_0x537c6c[_0xbd4e('0x43')][_0xbd4e('0x24')]);}return _0x30faf0[_0xbd4e('0xa3')](_0x56a44b);}})[_0xbd4e('0x2c')](function(_0x1717c2){if(_0x1717c2){return _0x1717c2?{'count':_0x4a2574,'rows':_0x1717c2}:null;}})[_0xbd4e('0x2c')](respondWithResult(_0x3cd17c,null))[_0xbd4e('0x54')](handleError(_0x3cd17c,null));};exports[_0xbd4e('0xa4')]=function(_0x138d73,_0x4d7c91,_0x18b362){var _0x3620cb,_0x2255ef;return db[_0xbd4e('0x51')]['find']({'where':{'id':_0x138d73[_0xbd4e('0x56')]['id']}})[_0xbd4e('0x2c')](handleEntityNotFound(_0x4d7c91,null))[_0xbd4e('0x2c')](function(_0x53ad17){if(_0x53ad17){_0x2255ef=_0x53ad17;return _0x53ad17['addLists'](_0x138d73[_0xbd4e('0x62')][_0xbd4e('0x85')],_[_0xbd4e('0x9e')](_0x138d73[_0xbd4e('0x62')],[_0xbd4e('0x85'),'id'])||{});}return null;})[_0xbd4e('0x9f')](function(_0x538fe5){var _0x1d908f;_0x3620cb=_0x538fe5||[];var _0x33d4d0=[];if(_0x538fe5){for(var _0x5849f7=0x0;_0x5849f7<_0x538fe5['length'];_0x5849f7+=0x1){var _0x315145=_0x538fe5[_0x5849f7][_0xbd4e('0x2e')]({'plain':!![]});_0x2255ef[_0xbd4e('0xa5')]=_0x138d73[_0xbd4e('0x62')]['dialCheckDuplicateType']?_0x138d73[_0xbd4e('0x62')][_0xbd4e('0xa5')]:_0x2255ef[_0xbd4e('0xa5')];switch(_0x2255ef['dialCheckDuplicateType']){case _0xbd4e('0xa6'):_0x1d908f=squel[_0xbd4e('0xa7')]()[_0xbd4e('0xa8')](_0xbd4e('0xa9'))[_0xbd4e('0xaa')]([_0xbd4e('0xab'),'scheduledAt','ContactId',_0xbd4e('0xac'),_0xbd4e('0x6b'),'createdAt',_0xbd4e('0x61')],squel[_0xbd4e('0x86')]()[_0xbd4e('0x87')](_0xbd4e('0xab'),_0xbd4e('0xab'))['field']('NOW()',_0xbd4e('0xad'))[_0xbd4e('0x87')]('id',_0xbd4e('0xae'))['field'](_0x315145[_0xbd4e('0xaf')][_0xbd4e('0x91')](),'ListId')[_0xbd4e('0x87')](_0x138d73[_0xbd4e('0x56')]['id'][_0xbd4e('0x91')](),_0xbd4e('0x6b'))['field'](_0xbd4e('0xb0'),_0xbd4e('0x60'))[_0xbd4e('0x87')](_0xbd4e('0xb0'),_0xbd4e('0x61'))[_0xbd4e('0x89')]('cm_contacts')['where'](_0xbd4e('0xb1'))[_0xbd4e('0x4c')]('ListId\x20=\x20?',_0x315145[_0xbd4e('0xaf')][_0xbd4e('0x91')]())['where'](_0xbd4e('0xb2'))['where'](_0xbd4e('0xb3'),squel['select']()[_0xbd4e('0x87')](_0xbd4e('0xb4'))[_0xbd4e('0x89')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x138d73[_0xbd4e('0x56')]['id'][_0xbd4e('0x91')]()))[_0xbd4e('0x4c')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbd4e('0x86')]()[_0xbd4e('0x87')]('COALESCE(phone,\x27\x27)')[_0xbd4e('0x89')]('cm_hopper')[_0xbd4e('0x4c')]('VoiceQueueId\x20=\x20?',_0x138d73[_0xbd4e('0x56')]['id']['toString']())))[_0xbd4e('0x91')]();break;case _0xbd4e('0xb5'):_0x1d908f=squel[_0xbd4e('0xa7')]()[_0xbd4e('0xa8')](_0xbd4e('0xa9'))[_0xbd4e('0xaa')](['phone','scheduledAt',_0xbd4e('0xae'),_0xbd4e('0xac'),'VoiceQueueId',_0xbd4e('0x60'),_0xbd4e('0x61')],squel[_0xbd4e('0x86')]()[_0xbd4e('0x87')](_0xbd4e('0xab'),'phone')['field'](_0xbd4e('0xb0'),_0xbd4e('0xad'))[_0xbd4e('0x87')]('id',_0xbd4e('0xae'))[_0xbd4e('0x87')](_0x315145[_0xbd4e('0xaf')][_0xbd4e('0x91')](),_0xbd4e('0xac'))[_0xbd4e('0x87')](_0x138d73[_0xbd4e('0x56')]['id']['toString'](),_0xbd4e('0x6b'))[_0xbd4e('0x87')](_0xbd4e('0xb0'),_0xbd4e('0x60'))[_0xbd4e('0x87')](_0xbd4e('0xb0'),_0xbd4e('0x61'))[_0xbd4e('0x89')]('cm_contacts')['where'](_0xbd4e('0xb1'))[_0xbd4e('0x4c')](_0xbd4e('0xb6'),_0x315145[_0xbd4e('0xaf')]['toString']())[_0xbd4e('0x4c')](_0xbd4e('0xb2'))[_0xbd4e('0x4c')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbd4e('0x86')]()[_0xbd4e('0x87')](_0xbd4e('0xb7'))[_0xbd4e('0x89')]('cm_hopper')[_0xbd4e('0x4c')]('VoiceQueueId\x20=\x20?',_0x138d73[_0xbd4e('0x56')]['id']['toString']())))[_0xbd4e('0x91')]();break;default:_0x1d908f=squel[_0xbd4e('0xa7')]()[_0xbd4e('0xa8')](_0xbd4e('0xa9'))[_0xbd4e('0xaa')]([_0xbd4e('0xab'),'scheduledAt',_0xbd4e('0xae'),'ListId',_0xbd4e('0x6b'),_0xbd4e('0x60'),'updatedAt'],squel[_0xbd4e('0x86')]()[_0xbd4e('0x87')]('phone',_0xbd4e('0xab'))[_0xbd4e('0x87')](_0xbd4e('0xb0'),_0xbd4e('0xad'))[_0xbd4e('0x87')]('id',_0xbd4e('0xae'))[_0xbd4e('0x87')](_0x315145['CmListId'][_0xbd4e('0x91')](),'ListId')[_0xbd4e('0x87')](_0x138d73[_0xbd4e('0x56')]['id'][_0xbd4e('0x91')](),'VoiceQueueId')[_0xbd4e('0x87')](_0xbd4e('0xb0'),'createdAt')[_0xbd4e('0x87')](_0xbd4e('0xb0'),'updatedAt')[_0xbd4e('0x89')](_0xbd4e('0xb8'))[_0xbd4e('0x4c')](_0xbd4e('0xb1'))[_0xbd4e('0x4c')](_0xbd4e('0xb6'),_0x315145[_0xbd4e('0xaf')][_0xbd4e('0x91')]())[_0xbd4e('0x4c')](_0xbd4e('0xb2')))['toString']();}_0x33d4d0[_0xbd4e('0x90')](db['sequelize']['query'](_0x1d908f));}return BPromise[_0xbd4e('0x95')](_0x33d4d0);}})['then'](function(){return _0x3620cb;})['then'](respondWithResult(_0x4d7c91,null))['catch'](handleError(_0x4d7c91,null));};exports[_0xbd4e('0xb9')]=function(_0x46c93b,_0x84cc8e,_0x61377d){return db['VoiceQueue']['find']({'where':{'id':_0x46c93b[_0xbd4e('0x56')]['id']}})[_0xbd4e('0x2c')](handleEntityNotFound(_0x84cc8e,null))[_0xbd4e('0x2c')](function(_0x153515){if(_0x153515){return _0x153515['removeLists'](_0x46c93b[_0xbd4e('0x43')][_0xbd4e('0x85')]);}})['then'](function(_0x50762f){if(_0x50762f){return db[_0xbd4e('0x66')]['destroy']({'where':{'ListId':_0x46c93b['query'][_0xbd4e('0x85')],'VoiceQueueId':_0x46c93b[_0xbd4e('0x56')]['id']}})['then'](function(){return _0x50762f;});}})[_0xbd4e('0x2c')](respondWithStatusCode(_0x84cc8e,null))['catch'](handleError(_0x84cc8e,null));};exports[_0xbd4e('0xba')]=function(_0x1a6a26,_0x187ff2,_0x4de22f){var _0x71e53e={};var _0x3afeec={};var _0x420327;var _0x5adc61;return db[_0xbd4e('0x51')]['findOne']({'where':{'id':_0x1a6a26['params']['id']}})[_0xbd4e('0x2c')](handleEntityNotFound(_0x187ff2,null))[_0xbd4e('0x2c')](function(_0xd1d812){if(_0xd1d812){_0x420327=_0xd1d812;_0x3afeec[_0xbd4e('0x42')]=_[_0xbd4e('0x57')](db[_0xbd4e('0xbb')][_0xbd4e('0x3f')]);_0x3afeec['query']=_[_0xbd4e('0x57')](_0x1a6a26[_0xbd4e('0x43')]);_0x3afeec[_0xbd4e('0x44')]=_[_0xbd4e('0x45')](_0x3afeec['model'],_0x3afeec[_0xbd4e('0x43')]);_0x71e53e[_0xbd4e('0x46')]=_[_0xbd4e('0x45')](_0x3afeec['model'],qs[_0xbd4e('0x47')](_0x1a6a26[_0xbd4e('0x43')][_0xbd4e('0x47')]));_0x71e53e['attributes']=_0x71e53e[_0xbd4e('0x46')]['length']?_0x71e53e[_0xbd4e('0x46')]:_0x3afeec[_0xbd4e('0x42')];_0x71e53e[_0xbd4e('0x4a')]=qs[_0xbd4e('0x4b')](_0x1a6a26[_0xbd4e('0x43')][_0xbd4e('0x4b')]);_0x71e53e[_0xbd4e('0x4c')]=qs[_0xbd4e('0x44')](_['pick'](_0x1a6a26[_0xbd4e('0x43')],_0x3afeec[_0xbd4e('0x44')]));if(_0x1a6a26[_0xbd4e('0x43')]['filter']){_0x71e53e['where']=_['merge'](_0x71e53e[_0xbd4e('0x4c')],{'$or':_[_0xbd4e('0x4d')](_0x71e53e[_0xbd4e('0x46')],function(_0x25c2a8){var _0x36b571={};_0x36b571[_0x25c2a8]={'$like':'%'+_0x1a6a26[_0xbd4e('0x43')][_0xbd4e('0x33')]+'%'};return _0x36b571;})});}_0x71e53e=_['merge']({},_0x71e53e,_0x1a6a26[_0xbd4e('0x50')]);return _0x420327[_0xbd4e('0xba')](_0x71e53e);}})['then'](function(_0x5f15fd){if(_0x5f15fd){_0x5adc61=_0x5f15fd[_0xbd4e('0x48')];if(!_0x1a6a26['query'][_0xbd4e('0x67')]('nolimit')){_0x71e53e[_0xbd4e('0x25')]=qs[_0xbd4e('0x25')](_0x1a6a26[_0xbd4e('0x43')][_0xbd4e('0x25')]);_0x71e53e[_0xbd4e('0x24')]=qs['offset'](_0x1a6a26['query'][_0xbd4e('0x24')]);}return _0x420327[_0xbd4e('0xba')](_0x71e53e);}})[_0xbd4e('0x2c')](function(_0x27db9e){if(_0x27db9e){return _0x27db9e?{'count':_0x5adc61,'rows':_0x27db9e}:null;}})[_0xbd4e('0x2c')](respondWithResult(_0x187ff2,null))['catch'](handleError(_0x187ff2,null));};exports['addBlackLists']=function(_0x3a6342,_0x2d7fc2,_0xcae663){var _0x1aeb61,_0x30690e;return db[_0xbd4e('0x51')]['find']({'where':{'id':_0x3a6342[_0xbd4e('0x56')]['id']}})['then'](handleEntityNotFound(_0x2d7fc2,null))['then'](function(_0xd5597){if(_0xd5597){_0x30690e=_0xd5597;return _0xd5597['addBlackLists'](_0x3a6342[_0xbd4e('0x62')]['ids'],_[_0xbd4e('0x9e')](_0x3a6342['body'],['ids','id'])||{});}return null;})[_0xbd4e('0x9f')](function(_0x100390){var _0x167db2;_0x1aeb61=_0x100390||[];var _0x25e77d=[];if(_0x100390){for(var _0x11102d=0x0;_0x11102d<_0x100390[_0xbd4e('0x48')];_0x11102d+=0x1){var _0x53add6=_0x100390[_0x11102d][_0xbd4e('0x2e')]({'plain':!![]});_0x167db2=squel[_0xbd4e('0xa7')]()['into'](_0xbd4e('0xbc'))[_0xbd4e('0xaa')]([_0xbd4e('0xab'),_0xbd4e('0xae'),_0xbd4e('0xac'),_0xbd4e('0x6b'),'createdAt',_0xbd4e('0x61')],squel['select']()[_0xbd4e('0x87')]('phone',_0xbd4e('0xab'))[_0xbd4e('0x87')]('id',_0xbd4e('0xae'))[_0xbd4e('0x87')](_0x53add6[_0xbd4e('0xaf')]['toString'](),_0xbd4e('0xac'))[_0xbd4e('0x87')](_0x3a6342['params']['id'][_0xbd4e('0x91')](),'VoiceQueueId')['field'](_0xbd4e('0xb0'),_0xbd4e('0x60'))[_0xbd4e('0x87')](_0xbd4e('0xb0'),_0xbd4e('0x61'))[_0xbd4e('0x89')](_0xbd4e('0xb8'))[_0xbd4e('0x4c')](_0xbd4e('0xb1'))[_0xbd4e('0x4c')]('ListId\x20=\x20?',_0x53add6[_0xbd4e('0xaf')][_0xbd4e('0x91')]())[_0xbd4e('0x4c')](_0xbd4e('0xb2')))[_0xbd4e('0x91')]();_0x25e77d[_0xbd4e('0x90')](db['sequelize'][_0xbd4e('0x43')](_0x167db2));}return BPromise[_0xbd4e('0x95')](_0x25e77d);}})[_0xbd4e('0x2c')](function(){return _0x1aeb61;})[_0xbd4e('0x2c')](respondWithResult(_0x2d7fc2,null))[_0xbd4e('0x54')](handleError(_0x2d7fc2,null));};exports[_0xbd4e('0xbd')]=function(_0xc141ba,_0x717ba8,_0xb5a89c){return db['VoiceQueue'][_0xbd4e('0x38')]({'where':{'id':_0xc141ba[_0xbd4e('0x56')]['id']}})[_0xbd4e('0x2c')](handleEntityNotFound(_0x717ba8,null))[_0xbd4e('0x2c')](function(_0x11eb52){if(_0x11eb52){return _0x11eb52[_0xbd4e('0xbd')](_0xc141ba[_0xbd4e('0x43')]['ids']);}})[_0xbd4e('0x2c')](function(_0x1f983f){if(_0x1f983f){return db[_0xbd4e('0x6f')][_0xbd4e('0x2d')]({'where':{'ListId':_0xc141ba[_0xbd4e('0x43')][_0xbd4e('0x85')],'VoiceQueueId':_0xc141ba[_0xbd4e('0x56')]['id']}})[_0xbd4e('0x2c')](function(){return _0x1f983f;});}})[_0xbd4e('0x2c')](respondWithStatusCode(_0x717ba8,null))[_0xbd4e('0x54')](handleError(_0x717ba8,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 37c6110..60caed9 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 _0x376d=['VoiceQueue','setMaxListeners','save','update','remove','emit','events'];(function(_0x20acdb,_0x210c8e){var _0x383b0d=function(_0x5d0919){while(--_0x5d0919){_0x20acdb['push'](_0x20acdb['shift']());}};_0x383b0d(++_0x210c8e);}(_0x376d,0x1d4));var _0xd376=function(_0x5c1bbd,_0x164495){_0x5c1bbd=_0x5c1bbd-0x0;var _0x105e4b=_0x376d[_0x5c1bbd];return _0x105e4b;};'use strict';var EventEmitter=require(_0xd376('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xd376('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xd376('0x2')](0x0);var events={'afterCreate':_0xd376('0x3'),'afterUpdate':_0xd376('0x4'),'afterDestroy':_0xd376('0x5')};function emitEvent(_0xbeb5aa){return function(_0x54c031,_0x57b7b6,_0x1ed81d){VoiceQueueEvents['emit'](_0xbeb5aa+':'+_0x54c031['id'],_0x54c031);VoiceQueueEvents[_0xd376('0x6')](_0xbeb5aa,_0x54c031);_0x1ed81d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x1fdf=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueue','save','update'];(function(_0x517f0e,_0x557448){var _0x513b60=function(_0x8f0a20){while(--_0x8f0a20){_0x517f0e['push'](_0x517f0e['shift']());}};_0x513b60(++_0x557448);}(_0x1fdf,0x148));var _0xf1fd=function(_0x2c32de,_0x138844){_0x2c32de=_0x2c32de-0x0;var _0x1ad47e=_0x1fdf[_0x2c32de];return _0x1ad47e;};'use strict';var EventEmitter=require(_0xf1fd('0x0'));var VoiceQueue=require(_0xf1fd('0x1'))['db'][_0xf1fd('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf1fd('0x3'),'afterUpdate':_0xf1fd('0x4'),'afterDestroy':_0xf1fd('0x5')};function emitEvent(_0x38418b){return function(_0x2c3aaf,_0x1872f8,_0x108d19){VoiceQueueEvents[_0xf1fd('0x6')](_0x38418b+':'+_0x2c3aaf['id'],_0x2c3aaf);VoiceQueueEvents[_0xf1fd('0x6')](_0x38418b,_0x2c3aaf);_0x108d19(null);};}for(var e in events){if(events[_0xf1fd('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xf1fd('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 06bad1d..8ad9517 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 _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x1879c0,_0x330937){var _0x49aafc=function(_0x5c42b3){while(--_0x5c42b3){_0x1879c0['push'](_0x1879c0['shift']());}};_0x49aafc(++_0x330937);}(_0x34e8,0x12c));var _0x834e=function(_0x3aeef5,_0x2b8424){_0x3aeef5=_0x3aeef5-0x0;var _0x42fddb=_0x34e8[_0x3aeef5];return _0x42fddb;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x871ef5,_0x58880b){var _0x1f62ea=function(_0x13934c){while(--_0x13934c){_0x871ef5['push'](_0x871ef5['shift']());}};_0x1f62ea(++_0x58880b);}(_0x70e0,0x17b));var _0x070e=function(_0x1bdc53,_0x3808f0){_0x1bdc53=_0x1bdc53-0x0;var _0x6a6ff9=_0x70e0[_0x1bdc53];return _0x6a6ff9;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index d642df0..a49e816 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 _0x916a=['ShowVoiceQueue','find','then','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','info','VoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','model','map'];(function(_0x2f1114,_0x4561f1){var _0x2fe856=function(_0x8397f8){while(--_0x8397f8){_0x2f1114['push'](_0x2f1114['shift']());}};_0x2fe856(++_0x4561f1);}(_0x916a,0x17f));var _0xa916=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0x916a[_0x295314];return _0x584b0c;};'use strict';var _=require(_0xa916('0x0'));var util=require('util');var moment=require(_0xa916('0x1'));var BPromise=require(_0xa916('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa916('0x3'));var db=require(_0xa916('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa916('0x5'))(_0xa916('0x6'));var config=require(_0xa916('0x7'));var jayson=require(_0xa916('0x8'));var client=jayson['client'][_0xa916('0x9')]({'port':0x232a});config[_0xa916('0xa')]=_[_0xa916('0xb')](config[_0xa916('0xa')],{'host':_0xa916('0xc'),'port':0x18eb});var socket=require(_0xa916('0xd'))(new Redis(config[_0xa916('0xa')]));require(_0xa916('0xe'))['register'](socket);function respondWithRpcPromise(_0x52ccd6,_0x5a3bfb,_0x2eb9e1){return new BPromise(function(_0x172a6d,_0x5d7efe){return client['request'](_0x52ccd6,_0x2eb9e1)['then'](function(_0x2e11fd){logger[_0xa916('0xf')](_0xa916('0x10'),_0x5a3bfb,'request\x20sent');logger[_0xa916('0x11')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5a3bfb,_0xa916('0x12'),JSON[_0xa916('0x13')](_0x2e11fd));if(_0x2e11fd[_0xa916('0x14')]){if(_0x2e11fd[_0xa916('0x14')]['code']===0x1f4){logger[_0xa916('0x14')](_0xa916('0x10'),_0x5a3bfb,_0x2e11fd[_0xa916('0x14')][_0xa916('0x15')]);return _0x5d7efe(_0x2e11fd['error'][_0xa916('0x15')]);}logger[_0xa916('0x14')](_0xa916('0x10'),_0x5a3bfb,_0x2e11fd['error'][_0xa916('0x15')]);return _0x172a6d(_0x2e11fd[_0xa916('0x14')][_0xa916('0x15')]);}else{logger[_0xa916('0xf')](_0xa916('0x10'),_0x5a3bfb,_0xa916('0x12'));_0x172a6d(_0x2e11fd[_0xa916('0x16')][_0xa916('0x15')]);}})[_0xa916('0x17')](function(_0x211627){logger[_0xa916('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x5a3bfb,_0x211627);_0x5d7efe(_0x211627);});});}exports[_0xa916('0x18')]=function(_0x42b271){var _0xac78a8=this;return new Promise(function(_0x4312b5,_0x4332d3){return db[_0xa916('0x19')][_0xa916('0x1a')]({'raw':_0x42b271['options']?_0x42b271[_0xa916('0x1b')][_0xa916('0x1c')]===undefined?!![]:![]:!![],'where':_0x42b271[_0xa916('0x1b')]?_0x42b271[_0xa916('0x1b')][_0xa916('0x1d')]||null:null,'attributes':_0x42b271[_0xa916('0x1b')]?_0x42b271[_0xa916('0x1b')][_0xa916('0x1e')]||null:null,'limit':_0x42b271['options']?_0x42b271['options'][_0xa916('0x1f')]||null:null,'include':_0x42b271[_0xa916('0x1b')]?_0x42b271[_0xa916('0x1b')]['include']?_['map'](_0x42b271[_0xa916('0x1b')][_0xa916('0x20')],function(_0x311347){return{'model':db[_0x311347['model']],'as':_0x311347['as'],'attributes':_0x311347[_0xa916('0x1e')],'include':_0x311347[_0xa916('0x20')]?_['map'](_0x311347[_0xa916('0x20')],function(_0x21bc02){return{'model':db[_0x21bc02[_0xa916('0x21')]],'as':_0x21bc02['as'],'attributes':_0x21bc02[_0xa916('0x1e')],'include':_0x21bc02['include']?_[_0xa916('0x22')](_0x21bc02[_0xa916('0x20')],function(_0x6371b8){return{'model':db[_0x6371b8[_0xa916('0x21')]],'as':_0x6371b8['as'],'attributes':_0x6371b8[_0xa916('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x160935){logger['info'](_0xa916('0x18'),_0x42b271);logger[_0xa916('0x11')](_0xa916('0x18'),_0x42b271,JSON[_0xa916('0x13')](_0x160935));_0x4312b5(_0x160935);})[_0xa916('0x17')](function(_0x46f070){logger['error']('GetVoiceQueue',_0x46f070['message'],_0x42b271);_0x4332d3(_0xac78a8[_0xa916('0x14')](0x1f4,_0x46f070[_0xa916('0x15')]));});});};exports[_0xa916('0x23')]=function(_0x47117c){var _0x501c4b=this;return new Promise(function(_0x29c122,_0x17b792){return db['VoiceQueue'][_0xa916('0x24')]({'raw':_0x47117c[_0xa916('0x1b')]?_0x47117c[_0xa916('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x47117c[_0xa916('0x1b')]?_0x47117c[_0xa916('0x1b')][_0xa916('0x1d')]||null:null,'attributes':_0x47117c[_0xa916('0x1b')]?_0x47117c[_0xa916('0x1b')][_0xa916('0x1e')]||null:null,'include':_0x47117c[_0xa916('0x1b')]?_0x47117c[_0xa916('0x1b')][_0xa916('0x20')]?_['map'](_0x47117c['options'][_0xa916('0x20')],function(_0x193680){return{'model':db[_0x193680[_0xa916('0x21')]],'as':_0x193680['as'],'attributes':_0x193680['attributes'],'include':_0x193680[_0xa916('0x20')]?_[_0xa916('0x22')](_0x193680[_0xa916('0x20')],function(_0x913d98){return{'model':db[_0x913d98['model']],'as':_0x913d98['as'],'attributes':_0x913d98['attributes'],'include':_0x913d98['include']?_['map'](_0x913d98[_0xa916('0x20')],function(_0x840b02){return{'model':db[_0x840b02[_0xa916('0x21')]],'as':_0x840b02['as'],'attributes':_0x840b02[_0xa916('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa916('0x25')](function(_0x4d75f3){logger[_0xa916('0xf')](_0xa916('0x23'),_0x47117c);logger[_0xa916('0x11')]('ShowVoiceQueue',_0x47117c,JSON[_0xa916('0x13')](_0x4d75f3));_0x29c122(_0x4d75f3);})[_0xa916('0x17')](function(_0x26b614){logger[_0xa916('0x14')](_0xa916('0x23'),_0x26b614['message'],_0x47117c);_0x17b792(_0x501c4b[_0xa916('0x14')](0x1f4,_0x26b614['message']));});});}; \ No newline at end of file +var _0x30fe=['GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowVoiceQueue','find','lodash','util','moment','bluebird','ioredis','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','stringify','error','code','message','VoiceQueue,\x20%s,\x20%s','info','result','catch'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0x30fe,0x146));var _0xe30f=function(_0x2ef8aa,_0x2a5df0){_0x2ef8aa=_0x2ef8aa-0x0;var _0x13a3e2=_0x30fe[_0x2ef8aa];return _0x13a3e2;};'use strict';var _=require(_0xe30f('0x0'));var util=require(_0xe30f('0x1'));var moment=require(_0xe30f('0x2'));var BPromise=require(_0xe30f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe30f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe30f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe30f('0x6'));var client=jayson[_0xe30f('0x7')][_0xe30f('0x8')]({'port':0x232a});config[_0xe30f('0x9')]=_[_0xe30f('0xa')](config[_0xe30f('0x9')],{'host':_0xe30f('0xb'),'port':0x18eb});var socket=require(_0xe30f('0xc'))(new Redis(config[_0xe30f('0x9')]));require('./voiceQueue.socket')[_0xe30f('0xd')](socket);function respondWithRpcPromise(_0x482fe4,_0x2a49bc,_0x220b56){return new BPromise(function(_0xfffb1,_0x14fc4f){return client[_0xe30f('0xe')](_0x482fe4,_0x220b56)[_0xe30f('0xf')](function(_0x439021){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x2a49bc,'request\x20sent');logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x2a49bc,_0xe30f('0x10'),JSON[_0xe30f('0x11')](_0x439021));if(_0x439021['error']){if(_0x439021[_0xe30f('0x12')][_0xe30f('0x13')]===0x1f4){logger[_0xe30f('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x2a49bc,_0x439021[_0xe30f('0x12')]['message']);return _0x14fc4f(_0x439021[_0xe30f('0x12')][_0xe30f('0x14')]);}logger[_0xe30f('0x12')](_0xe30f('0x15'),_0x2a49bc,_0x439021[_0xe30f('0x12')][_0xe30f('0x14')]);return _0xfffb1(_0x439021[_0xe30f('0x12')][_0xe30f('0x14')]);}else{logger[_0xe30f('0x16')](_0xe30f('0x15'),_0x2a49bc,_0xe30f('0x10'));_0xfffb1(_0x439021[_0xe30f('0x17')]['message']);}})[_0xe30f('0x18')](function(_0x41cc4e){logger[_0xe30f('0x12')](_0xe30f('0x15'),_0x2a49bc,_0x41cc4e);_0x14fc4f(_0x41cc4e);});});}exports[_0xe30f('0x19')]=function(_0x5231e4){var _0x286fef=this;return new Promise(function(_0xb48251,_0xf08179){return db[_0xe30f('0x1a')][_0xe30f('0x1b')]({'raw':_0x5231e4[_0xe30f('0x1c')]?_0x5231e4[_0xe30f('0x1c')][_0xe30f('0x1d')]===undefined?!![]:![]:!![],'where':_0x5231e4[_0xe30f('0x1c')]?_0x5231e4[_0xe30f('0x1c')][_0xe30f('0x1e')]||null:null,'attributes':_0x5231e4[_0xe30f('0x1c')]?_0x5231e4[_0xe30f('0x1c')][_0xe30f('0x1f')]||null:null,'limit':_0x5231e4['options']?_0x5231e4[_0xe30f('0x1c')][_0xe30f('0x20')]||null:null,'include':_0x5231e4['options']?_0x5231e4[_0xe30f('0x1c')][_0xe30f('0x21')]?_[_0xe30f('0x22')](_0x5231e4[_0xe30f('0x1c')][_0xe30f('0x21')],function(_0x195cd4){return{'model':db[_0x195cd4['model']],'as':_0x195cd4['as'],'attributes':_0x195cd4[_0xe30f('0x1f')],'include':_0x195cd4[_0xe30f('0x21')]?_[_0xe30f('0x22')](_0x195cd4[_0xe30f('0x21')],function(_0x22e868){return{'model':db[_0x22e868['model']],'as':_0x22e868['as'],'attributes':_0x22e868['attributes'],'include':_0x22e868[_0xe30f('0x21')]?_[_0xe30f('0x22')](_0x22e868[_0xe30f('0x21')],function(_0x5630db){return{'model':db[_0x5630db[_0xe30f('0x23')]],'as':_0x5630db['as'],'attributes':_0x5630db[_0xe30f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe30f('0xf')](function(_0xb3ee4a){logger[_0xe30f('0x16')]('GetVoiceQueue',_0x5231e4);logger[_0xe30f('0x24')](_0xe30f('0x19'),_0x5231e4,JSON[_0xe30f('0x11')](_0xb3ee4a));_0xb48251(_0xb3ee4a);})[_0xe30f('0x18')](function(_0x271be7){logger[_0xe30f('0x12')](_0xe30f('0x19'),_0x271be7[_0xe30f('0x14')],_0x5231e4);_0xf08179(_0x286fef[_0xe30f('0x12')](0x1f4,_0x271be7[_0xe30f('0x14')]));});});};exports[_0xe30f('0x25')]=function(_0x2c909d){var _0x55282c=this;return new Promise(function(_0x62070c,_0xffa822){return db['VoiceQueue'][_0xe30f('0x26')]({'raw':_0x2c909d[_0xe30f('0x1c')]?_0x2c909d[_0xe30f('0x1c')][_0xe30f('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c909d[_0xe30f('0x1c')]?_0x2c909d['options'][_0xe30f('0x1e')]||null:null,'attributes':_0x2c909d['options']?_0x2c909d['options'][_0xe30f('0x1f')]||null:null,'include':_0x2c909d['options']?_0x2c909d[_0xe30f('0x1c')][_0xe30f('0x21')]?_[_0xe30f('0x22')](_0x2c909d['options'][_0xe30f('0x21')],function(_0x4b3152){return{'model':db[_0x4b3152[_0xe30f('0x23')]],'as':_0x4b3152['as'],'attributes':_0x4b3152[_0xe30f('0x1f')],'include':_0x4b3152['include']?_[_0xe30f('0x22')](_0x4b3152['include'],function(_0x34dc01){return{'model':db[_0x34dc01[_0xe30f('0x23')]],'as':_0x34dc01['as'],'attributes':_0x34dc01[_0xe30f('0x1f')],'include':_0x34dc01[_0xe30f('0x21')]?_['map'](_0x34dc01[_0xe30f('0x21')],function(_0x51bd07){return{'model':db[_0x51bd07[_0xe30f('0x23')]],'as':_0x51bd07['as'],'attributes':_0x51bd07[_0xe30f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe30f('0xf')](function(_0x3a41bb){logger[_0xe30f('0x16')](_0xe30f('0x25'),_0x2c909d);logger[_0xe30f('0x24')](_0xe30f('0x25'),_0x2c909d,JSON['stringify'](_0x3a41bb));_0x62070c(_0x3a41bb);})[_0xe30f('0x18')](function(_0x4b866e){logger['error'](_0xe30f('0x25'),_0x4b866e[_0xe30f('0x14')],_0x2c909d);_0xffa822(_0x55282c['error'](0x1f4,_0x4b866e[_0xe30f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index dd4b20d..4895944 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 _0xae9e=['removeListener','register','length','voiceQueue:','./voiceQueue.events','remove','update','emit'];(function(_0x20aae1,_0x51efd4){var _0x510601=function(_0x20895f){while(--_0x20895f){_0x20aae1['push'](_0x20aae1['shift']());}};_0x510601(++_0x51efd4);}(_0xae9e,0xe4));var _0xeae9=function(_0x3fe912,_0x33cb27){_0x3fe912=_0x3fe912-0x0;var _0x43a18b=_0xae9e[_0x3fe912];return _0x43a18b;};'use strict';var VoiceQueueEvents=require(_0xeae9('0x0'));var events=['save',_0xeae9('0x1'),_0xeae9('0x2')];function createListener(_0x22b4a1,_0x2af9e8){return function(_0x68aa01){_0x2af9e8[_0xeae9('0x3')](_0x22b4a1,_0x68aa01);};}function removeListener(_0xd0bae9,_0x5c4716){return function(){VoiceQueueEvents[_0xeae9('0x4')](_0xd0bae9,_0x5c4716);};}exports[_0xeae9('0x5')]=function(_0x2b56a9){for(var _0x3cc75a=0x0,_0xf3feea=events[_0xeae9('0x6')];_0x3cc75a<_0xf3feea;_0x3cc75a++){var _0x2eb287=events[_0x3cc75a];var _0x3c5d24=createListener(_0xeae9('0x7')+_0x2eb287,_0x2b56a9);VoiceQueueEvents['on'](_0x2eb287,_0x3c5d24);}}; \ No newline at end of file +var _0x2f42=['./voiceQueue.events','remove','update','register','length','voiceQueue:'];(function(_0x584b6d,_0x229b2e){var _0xc1c345=function(_0x3ef14d){while(--_0x3ef14d){_0x584b6d['push'](_0x584b6d['shift']());}};_0xc1c345(++_0x229b2e);}(_0x2f42,0x17a));var _0x22f4=function(_0x1c496,_0x29f918){_0x1c496=_0x1c496-0x0;var _0x294938=_0x2f42[_0x1c496];return _0x294938;};'use strict';var VoiceQueueEvents=require(_0x22f4('0x0'));var events=['save',_0x22f4('0x1'),_0x22f4('0x2')];function createListener(_0x2284f9,_0x3573a9){return function(_0x51222a){_0x3573a9['emit'](_0x2284f9,_0x51222a);};}function removeListener(_0xbe2e69,_0xf38869){return function(){VoiceQueueEvents['removeListener'](_0xbe2e69,_0xf38869);};}exports[_0x22f4('0x3')]=function(_0x584ded){for(var _0x1ef92d=0x0,_0x5bfadd=events[_0x22f4('0x4')];_0x1ef92d<_0x5bfadd;_0x1ef92d++){var _0x4dd5a1=events[_0x1ef92d];var _0x629cf1=createListener(_0x22f4('0x5')+_0x4dd5a1,_0x584ded);VoiceQueueEvents['on'](_0x4dd5a1,_0x629cf1);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index fa7e5dc..c3fc6cd 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 _0x3a65=['../../config/environment','isAuthenticated','index','get','/describe','/index','getVoiceQueuesReport','/:id','show','post','put','update','delete','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2e1cd7,_0x293ea1){var _0x515226=function(_0x816b94){while(--_0x816b94){_0x2e1cd7['push'](_0x2e1cd7['shift']());}};_0x515226(++_0x293ea1);}(_0x3a65,0x18a));var _0x53a6=function(_0x3631ec,_0x4eb193){_0x3631ec=_0x3631ec-0x0;var _0x2a403b=_0x3a65[_0x3631ec];return _0x2a403b;};'use strict';var multer=require(_0x53a6('0x0'));var util=require('util');var path=require(_0x53a6('0x1'));var timeout=require('connect-timeout');var express=require(_0x53a6('0x2'));var router=express['Router']();var fs_extra=require(_0x53a6('0x3'));var auth=require(_0x53a6('0x4'));var interaction=require(_0x53a6('0x5'));var config=require(_0x53a6('0x6'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0x53a6('0x7')](),controller[_0x53a6('0x8')]);router[_0x53a6('0x9')](_0x53a6('0xa'),auth[_0x53a6('0x7')](),controller['describe']);router[_0x53a6('0x9')](_0x53a6('0xb'),auth[_0x53a6('0x7')](),controller[_0x53a6('0xc')]);router['get'](_0x53a6('0xd'),auth[_0x53a6('0x7')](),controller[_0x53a6('0xe')]);router[_0x53a6('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x53a6('0x10')](_0x53a6('0xd'),auth[_0x53a6('0x7')](),controller[_0x53a6('0x11')]);router[_0x53a6('0x12')](_0x53a6('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x53a6('0x13')]=router; \ No newline at end of file +var _0x779a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','Router'];(function(_0x1a2905,_0xe5b154){var _0x5177f9=function(_0x4d825c){while(--_0x4d825c){_0x1a2905['push'](_0x1a2905['shift']());}};_0x5177f9(++_0xe5b154);}(_0x779a,0x183));var _0xa779=function(_0x38f497,_0x11e083){_0x38f497=_0x38f497-0x0;var _0x42cd5c=_0x779a[_0x38f497];return _0x42cd5c;};'use strict';var multer=require('multer');var util=require(_0xa779('0x0'));var path=require(_0xa779('0x1'));var timeout=require(_0xa779('0x2'));var express=require('express');var router=express[_0xa779('0x3')]();var fs_extra=require(_0xa779('0x4'));var auth=require(_0xa779('0x5'));var interaction=require(_0xa779('0x6'));var config=require(_0xa779('0x7'));var controller=require('./voiceQueueReport.controller');router[_0xa779('0x8')]('/',auth[_0xa779('0x9')](),controller[_0xa779('0xa')]);router[_0xa779('0x8')](_0xa779('0xb'),auth[_0xa779('0x9')](),controller[_0xa779('0xc')]);router[_0xa779('0x8')](_0xa779('0xd'),auth[_0xa779('0x9')](),controller[_0xa779('0xe')]);router[_0xa779('0x8')](_0xa779('0xf'),auth[_0xa779('0x9')](),controller[_0xa779('0x10')]);router[_0xa779('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa779('0x12')](_0xa779('0xf'),auth[_0xa779('0x9')](),controller[_0xa779('0x13')]);router[_0xa779('0x14')](_0xa779('0xf'),auth[_0xa779('0x9')](),controller[_0xa779('0x15')]);module[_0xa779('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index a9a7158..e2c354f 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 _0xbc75=['diff','seconds','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0x536919,_0x2d0c68){var _0x3694d9=function(_0xf21223){while(--_0xf21223){_0x536919['push'](_0x536919['shift']());}};_0x3694d9(++_0x2d0c68);}(_0xbc75,0x7f));var _0x5bc7=function(_0xd7278d,_0x5b1f1d){_0xd7278d=_0xd7278d-0x0;var _0x2ec27a=_0xbc75[_0xd7278d];return _0x2ec27a;};'use strict';var Sequelize=require(_0x5bc7('0x0'));var moment=require(_0x5bc7('0x1'));module[_0x5bc7('0x2')]={'type':{'type':Sequelize[_0x5bc7('0x3')]},'uniqueid':{'type':Sequelize[_0x5bc7('0x3')]},'calleridnum':{'type':Sequelize[_0x5bc7('0x3')]},'calleridname':{'type':Sequelize[_0x5bc7('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x5bc7('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x185fa6){var _0x723d54=moment(_0x185fa6);var _0xbad133=moment(this[_0x5bc7('0x5')](_0x5bc7('0x6')))[_0x5bc7('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2802fa=_0x723d54[_0x5bc7('0x8')](_0xbad133,_0x5bc7('0x9'));this[_0x5bc7('0xa')]('queuecallerleaveAt',_0x185fa6);this['setDataValue']('holdtime',_0x2802fa||null);}},'position':{'type':Sequelize[_0x5bc7('0xb')]},'count':{'type':Sequelize[_0x5bc7('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x5bc7('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x5bc7('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x5bc7('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5bc7('0x4')]},'queuecallerexit':{'type':Sequelize[_0x5bc7('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5bc7('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x5bc7('0x3')],'comment':_0x5bc7('0xd')},'originalposition':{'type':Sequelize[_0x5bc7('0xb')]},'channel':{'type':Sequelize[_0x5bc7('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x5bc7('0x3')]},'accountcode':{'type':Sequelize[_0x5bc7('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5bc7('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x5bc7('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5bc7('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5bc7('0x3')]},'transfer':{'type':Sequelize[_0x5bc7('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5bc7('0x3')],'comment':_0x5bc7('0xe')},'transferexten':{'type':Sequelize[_0x5bc7('0x3')]},'transferuniqueid':{'type':Sequelize[_0x5bc7('0x3')]},'disposition':{'type':Sequelize[_0x5bc7('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x5bc7('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x203f=['DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING'];(function(_0x29a56e,_0x5a2fc6){var _0x3d1260=function(_0x350149){while(--_0x350149){_0x29a56e['push'](_0x29a56e['shift']());}};_0x3d1260(++_0x5a2fc6);}(_0x203f,0x1b0));var _0xf203=function(_0x43941d,_0x45fd0d){_0x43941d=_0x43941d-0x0;var _0x27b82a=_0x203f[_0x43941d];return _0x27b82a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf203('0x0'));module[_0xf203('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf203('0x2')]},'calleridnum':{'type':Sequelize[_0xf203('0x2')]},'calleridname':{'type':Sequelize[_0xf203('0x2')]},'queue':{'type':Sequelize[_0xf203('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xf203('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xf203('0x3')],'set':function(_0x5dc74c){var _0x555145=moment(_0x5dc74c);var _0x302786=moment(this[_0xf203('0x4')](_0xf203('0x5')))[_0xf203('0x6')](_0xf203('0x7'));var _0x317396=_0x555145[_0xf203('0x8')](_0x302786,_0xf203('0x9'));this[_0xf203('0xa')](_0xf203('0xb'),_0x5dc74c);this[_0xf203('0xa')]('holdtime',_0x317396||null);}},'position':{'type':Sequelize[_0xf203('0xc')]},'count':{'type':Sequelize[_0xf203('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xf203('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xf203('0x3')]},'queuecallerexit':{'type':Sequelize[_0xf203('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xf203('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xf203('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xf203('0xc')]},'channel':{'type':Sequelize[_0xf203('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf203('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xf203('0x2')]},'context':{'type':Sequelize[_0xf203('0x2')]},'exten':{'type':Sequelize[_0xf203('0x2')]},'priority':{'type':Sequelize[_0xf203('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf203('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xf203('0x2')]},'transfer':{'type':Sequelize[_0xf203('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xf203('0xe')},'transferexten':{'type':Sequelize[_0xf203('0x2')]},'transferuniqueid':{'type':Sequelize[_0xf203('0x2')]},'disposition':{'type':Sequelize[_0xf203('0x2')]},'secondDisposition':{'type':Sequelize[_0xf203('0x2')]},'thirdDisposition':{'type':Sequelize[_0xf203('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 2755a70..a0c8c03 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 _0x6b68=['desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','count','set','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','VoiceQueueReport','include','findAll','rows','catch','show','params','keys','options','create','body','find','describe','getVoiceQueuesReport','includeAll','eml-format','rimraf','moment','mustache','util','path','to-csv','ejs','fs-extra','squel'];(function(_0x42269a,_0x1f339c){var _0x4c455e=function(_0x1c50b4){while(--_0x1c50b4){_0x42269a['push'](_0x42269a['shift']());}};_0x4c455e(++_0x1f339c);}(_0x6b68,0xe3));var _0x86b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b68[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x86b6('0x0'));var rimraf=require(_0x86b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x86b6('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x86b6('0x3'));var util=require(_0x86b6('0x4'));var path=require(_0x86b6('0x5'));var sox=require('sox');var csv=require(_0x86b6('0x6'));var ejs=require(_0x86b6('0x7'));var fs=require('fs');var fs_extra=require(_0x86b6('0x8'));var _=require('lodash');var squel=require(_0x86b6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86b6('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x86b6('0xb'));var authService=require(_0x86b6('0xc'));var qs=require(_0x86b6('0xd'));var as=require(_0x86b6('0xe'));var hardwareService=require(_0x86b6('0xf'));var logger=require(_0x86b6('0x10'))(_0x86b6('0x11'));var utils=require(_0x86b6('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x86b6('0x13'));var db=require('../../mysqldb')['db'];config[_0x86b6('0x14')]=_[_0x86b6('0x15')](config[_0x86b6('0x14')],{'host':_0x86b6('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x86b6('0x14')]));require(_0x86b6('0x17'))[_0x86b6('0x18')](socket);function respondWithStatusCode(_0x4ff574,_0x292bba){_0x292bba=_0x292bba||0xcc;return function(_0x1bddbd){if(_0x1bddbd){return _0x4ff574[_0x86b6('0x19')](_0x292bba);}return _0x4ff574[_0x86b6('0x1a')](_0x292bba)[_0x86b6('0x1b')]();};}function respondWithResult(_0x50a72b,_0x204585){_0x204585=_0x204585||0xc8;return function(_0x3c1fc9){if(_0x3c1fc9){return _0x50a72b[_0x86b6('0x1a')](_0x204585)['json'](_0x3c1fc9);}};}function respondWithFilteredResult(_0x571788,_0x465065){return function(_0x1d728e){if(_0x1d728e){var _0x48e056=typeof _0x465065[_0x86b6('0x1c')]===_0x86b6('0x1d')&&typeof _0x465065['limit']===_0x86b6('0x1d');var _0x36f509=_0x1d728e[_0x86b6('0x1e')];var _0x449e41=_0x48e056?0x0:_0x465065[_0x86b6('0x1c')];var _0x2024f3=_0x48e056?_0x1d728e['count']:_0x465065[_0x86b6('0x1c')]+_0x465065['limit'];var _0x3cc72b;if(_0x2024f3>=_0x36f509){_0x2024f3=_0x36f509;_0x3cc72b=0xc8;}else{_0x3cc72b=0xce;}_0x571788[_0x86b6('0x1a')](_0x3cc72b);return _0x571788[_0x86b6('0x1f')]('Content-Range',_0x449e41+'-'+_0x2024f3+'/'+_0x36f509)[_0x86b6('0x20')](_0x1d728e);}return null;};}function patchUpdates(_0x1cdd30){return function(_0x42ce5f){try{jsonpatch[_0x86b6('0x21')](_0x42ce5f,_0x1cdd30,!![]);}catch(_0x41a104){return BPromise[_0x86b6('0x22')](_0x41a104);}return _0x42ce5f[_0x86b6('0x23')]();};}function saveUpdates(_0x19c12d,_0x58a022){return function(_0x4e8304){if(_0x4e8304){return _0x4e8304[_0x86b6('0x24')](_0x19c12d)[_0x86b6('0x25')](function(_0x494eb3){return _0x494eb3;});}return null;};}function removeEntity(_0x2a4e95,_0x4f2e6e){return function(_0x4de93b){if(_0x4de93b){return _0x4de93b[_0x86b6('0x26')]()[_0x86b6('0x25')](function(){_0x2a4e95[_0x86b6('0x1a')](0xcc)[_0x86b6('0x1b')]();});}};}function handleEntityNotFound(_0x8dd13d,_0x5590c6){return function(_0x53ae4d){if(!_0x53ae4d){_0x8dd13d['sendStatus'](0x194);}return _0x53ae4d;};}function handleError(_0x1948cd,_0x1e28b9){_0x1e28b9=_0x1e28b9||0x1f4;return function(_0x73d9c2){logger['error'](_0x73d9c2[_0x86b6('0x27')]);if(_0x73d9c2[_0x86b6('0x28')]){delete _0x73d9c2[_0x86b6('0x28')];}_0x1948cd['status'](_0x1e28b9)[_0x86b6('0x29')](_0x73d9c2);};}exports[_0x86b6('0x2a')]=function(_0x26edcf,_0x556253){var _0x575d9b={},_0x250cb7={},_0x5e2041={'count':0x0,'rows':[]};var _0x1aeeb3=_[_0x86b6('0x2b')](db['VoiceQueueReport'][_0x86b6('0x2c')],function(_0x234b49){return{'name':_0x234b49['fieldName'],'type':_0x234b49['type'][_0x86b6('0x2d')]};});_0x250cb7[_0x86b6('0x2e')]=_[_0x86b6('0x2b')](_0x1aeeb3,_0x86b6('0x28'));_0x250cb7[_0x86b6('0x2f')]=_['keys'](_0x26edcf[_0x86b6('0x2f')]);_0x250cb7['filters']=_[_0x86b6('0x30')](_0x250cb7['model'],_0x250cb7[_0x86b6('0x2f')]);_0x575d9b[_0x86b6('0x31')]=_[_0x86b6('0x30')](_0x250cb7['model'],qs[_0x86b6('0x32')](_0x26edcf[_0x86b6('0x2f')][_0x86b6('0x32')]));_0x575d9b[_0x86b6('0x31')]=_0x575d9b[_0x86b6('0x31')][_0x86b6('0x33')]?_0x575d9b[_0x86b6('0x31')]:_0x250cb7[_0x86b6('0x2e')];if(!_0x26edcf[_0x86b6('0x2f')][_0x86b6('0x34')](_0x86b6('0x35'))){_0x575d9b[_0x86b6('0x36')]=qs['limit'](_0x26edcf[_0x86b6('0x2f')][_0x86b6('0x36')]);_0x575d9b[_0x86b6('0x1c')]=qs[_0x86b6('0x1c')](_0x26edcf[_0x86b6('0x2f')]['offset']);}_0x575d9b[_0x86b6('0x37')]=qs[_0x86b6('0x38')](_0x26edcf[_0x86b6('0x2f')]['sort']);_0x575d9b['where']=qs[_0x86b6('0x39')](_[_0x86b6('0x3a')](_0x26edcf[_0x86b6('0x2f')],_0x250cb7[_0x86b6('0x39')]),_0x1aeeb3);if(_0x26edcf[_0x86b6('0x2f')][_0x86b6('0x3b')]){_0x575d9b[_0x86b6('0x3c')]=_[_0x86b6('0x3d')](_0x575d9b['where'],{'$or':_['map'](_0x1aeeb3,function(_0x4ca772){if(_0x4ca772[_0x86b6('0x3e')]!==_0x86b6('0x3f')){var _0x2b59d5={};_0x2b59d5[_0x4ca772[_0x86b6('0x28')]]={'$like':'%'+_0x26edcf[_0x86b6('0x2f')][_0x86b6('0x3b')]+'%'};return _0x2b59d5;}})});}_0x575d9b=_[_0x86b6('0x3d')]({},_0x575d9b,_0x26edcf['options']);var _0x193519={'where':_0x575d9b[_0x86b6('0x3c')]};return db[_0x86b6('0x40')][_0x86b6('0x1e')](_0x193519)['then'](function(_0x43b05c){_0x5e2041[_0x86b6('0x1e')]=_0x43b05c;if(_0x26edcf[_0x86b6('0x2f')]['includeAll']){_0x575d9b[_0x86b6('0x41')]=[{'all':!![]}];}return db[_0x86b6('0x40')][_0x86b6('0x42')](_0x575d9b);})[_0x86b6('0x25')](function(_0x37db97){_0x5e2041[_0x86b6('0x43')]=_0x37db97;return _0x5e2041;})['then'](respondWithFilteredResult(_0x556253,_0x575d9b))[_0x86b6('0x44')](handleError(_0x556253,null));};exports[_0x86b6('0x45')]=function(_0xe0c036,_0x39f899){var _0x23f33f={'raw':![],'where':{'id':_0xe0c036[_0x86b6('0x46')]['id']}},_0x91b109={};_0x91b109[_0x86b6('0x2e')]=_['keys'](db['VoiceQueueReport'][_0x86b6('0x2c')]);_0x91b109['query']=_[_0x86b6('0x47')](_0xe0c036[_0x86b6('0x2f')]);_0x91b109[_0x86b6('0x39')]=_[_0x86b6('0x30')](_0x91b109[_0x86b6('0x2e')],_0x91b109['query']);_0x23f33f[_0x86b6('0x31')]=_[_0x86b6('0x30')](_0x91b109[_0x86b6('0x2e')],qs[_0x86b6('0x32')](_0xe0c036[_0x86b6('0x2f')][_0x86b6('0x32')]));_0x23f33f[_0x86b6('0x31')]=_0x23f33f[_0x86b6('0x31')][_0x86b6('0x33')]?_0x23f33f[_0x86b6('0x31')]:_0x91b109[_0x86b6('0x2e')];if(_0xe0c036[_0x86b6('0x2f')]['includeAll']){_0x23f33f['include']=[{'all':!![]}];}_0x23f33f=_['merge']({},_0x23f33f,_0xe0c036[_0x86b6('0x48')]);return db[_0x86b6('0x40')]['find'](_0x23f33f)[_0x86b6('0x25')](handleEntityNotFound(_0x39f899,null))[_0x86b6('0x25')](respondWithResult(_0x39f899,null))[_0x86b6('0x44')](handleError(_0x39f899,null));};exports[_0x86b6('0x49')]=function(_0x84b932,_0x471c63){return db[_0x86b6('0x40')]['create'](_0x84b932[_0x86b6('0x4a')],{})[_0x86b6('0x25')](respondWithResult(_0x471c63,0xc9))[_0x86b6('0x44')](handleError(_0x471c63,null));};exports['update']=function(_0x3a9b6e,_0x2cb3f0){if(_0x3a9b6e[_0x86b6('0x4a')]['id']){delete _0x3a9b6e[_0x86b6('0x4a')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x3a9b6e['params']['id']}})[_0x86b6('0x25')](handleEntityNotFound(_0x2cb3f0,null))[_0x86b6('0x25')](saveUpdates(_0x3a9b6e[_0x86b6('0x4a')],null))[_0x86b6('0x25')](respondWithResult(_0x2cb3f0,null))[_0x86b6('0x44')](handleError(_0x2cb3f0,null));};exports[_0x86b6('0x26')]=function(_0x4f60f7,_0x437ff0){return db[_0x86b6('0x40')][_0x86b6('0x4b')]({'where':{'id':_0x4f60f7['params']['id']}})['then'](handleEntityNotFound(_0x437ff0,null))[_0x86b6('0x25')](removeEntity(_0x437ff0,null))['catch'](handleError(_0x437ff0,null));};exports[_0x86b6('0x4c')]=function(_0x11552c,_0x5e40a3){return db[_0x86b6('0x40')][_0x86b6('0x4c')]()[_0x86b6('0x25')](respondWithResult(_0x5e40a3,null))[_0x86b6('0x44')](handleError(_0x5e40a3,null));};exports[_0x86b6('0x4d')]=function(_0x4b3d43,_0x4c6f07){var _0x479bf0={},_0xe56ba5={},_0x109fc8={'count':0x0,'rows':[]};_0xe56ba5[_0x86b6('0x2e')]=_[_0x86b6('0x47')](db['VoiceQueueReport'][_0x86b6('0x2c')]);_0xe56ba5['query']=_[_0x86b6('0x47')](_0x4b3d43[_0x86b6('0x2f')]);_0xe56ba5['filters']=_[_0x86b6('0x30')](_0xe56ba5[_0x86b6('0x2e')],_0xe56ba5[_0x86b6('0x2f')]);_0x479bf0[_0x86b6('0x31')]=_[_0x86b6('0x30')](_0xe56ba5[_0x86b6('0x2e')],qs[_0x86b6('0x32')](_0x4b3d43[_0x86b6('0x2f')][_0x86b6('0x32')]));_0x479bf0['attributes']=_0x479bf0[_0x86b6('0x31')][_0x86b6('0x33')]?_0x479bf0['attributes']:_0xe56ba5[_0x86b6('0x2e')];if(!_0x4b3d43[_0x86b6('0x2f')][_0x86b6('0x34')](_0x86b6('0x35'))){_0x479bf0[_0x86b6('0x36')]=qs['limit'](_0x4b3d43[_0x86b6('0x2f')][_0x86b6('0x36')]);_0x479bf0['offset']=qs[_0x86b6('0x1c')](_0x4b3d43[_0x86b6('0x2f')][_0x86b6('0x1c')]);}_0x479bf0[_0x86b6('0x37')]=qs[_0x86b6('0x38')](_0x4b3d43[_0x86b6('0x2f')]['sort']);_0x479bf0[_0x86b6('0x3c')]=qs[_0x86b6('0x39')](_[_0x86b6('0x3a')](_0x4b3d43[_0x86b6('0x2f')],_0xe56ba5[_0x86b6('0x39')]));if(_0x4b3d43[_0x86b6('0x2f')][_0x86b6('0x3b')]){_0x479bf0[_0x86b6('0x3c')]=_[_0x86b6('0x3d')](_0x479bf0[_0x86b6('0x3c')],{'$or':_[_0x86b6('0x2b')](_0x479bf0['attributes'],function(_0x3b9004){var _0x45a6b7={};_0x45a6b7[_0x3b9004]={'$like':'%'+_0x4b3d43['query']['filter']+'%'};return _0x45a6b7;})});}_0x479bf0=_[_0x86b6('0x3d')]({},_0x479bf0,_0x4b3d43[_0x86b6('0x48')]);var _0x48c71d={'where':_0x479bf0[_0x86b6('0x3c')]};return db[_0x86b6('0x40')]['count'](_0x48c71d)[_0x86b6('0x25')](function(_0x4d352c){_0x109fc8[_0x86b6('0x1e')]=_0x4d352c;if(_0x4b3d43[_0x86b6('0x2f')][_0x86b6('0x4e')]){_0x479bf0['include']=[{'all':!![]}];}return db[_0x86b6('0x40')][_0x86b6('0x42')](_0x479bf0);})[_0x86b6('0x25')](function(_0x54bc4f){_0x109fc8[_0x86b6('0x43')]=_0x54bc4f;return _0x109fc8;})[_0x86b6('0x25')](respondWithFilteredResult(_0x4c6f07,_0x479bf0,_0x86b6('0x4d')))['catch'](handleError(_0x4c6f07,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0xc436=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','then','error','stack','send','index','VoiceQueueReport','rawAttributes','fieldName','type','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','catch','show','keys','options','find','body','params','describe','getVoiceQueuesReport','includeAll','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc436,0x9b));var _0x6c43=function(_0x5838cf,_0x3bd77e){_0x5838cf=_0x5838cf-0x0;var _0x2a2ab0=_0xc436[_0x5838cf];return _0x2a2ab0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c43('0x0'));var zipdir=require(_0x6c43('0x1'));var jsonpatch=require(_0x6c43('0x2'));var rp=require('request-promise');var moment=require(_0x6c43('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6c43('0x4'));var util=require('util');var path=require(_0x6c43('0x5'));var sox=require(_0x6c43('0x6'));var csv=require(_0x6c43('0x7'));var ejs=require(_0x6c43('0x8'));var fs=require('fs');var fs_extra=require(_0x6c43('0x9'));var _=require(_0x6c43('0xa'));var squel=require(_0x6c43('0xb'));var crypto=require(_0x6c43('0xc'));var jsforce=require(_0x6c43('0xd'));var deskjs=require(_0x6c43('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6c43('0xf'));var Papa=require(_0x6c43('0x10'));var Redis=require(_0x6c43('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6c43('0x12'));var hardwareService=require(_0x6c43('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6c43('0x14'));var config=require(_0x6c43('0x15'));var licenseUtil=require(_0x6c43('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x6c43('0x17')],{'host':_0x6c43('0x18'),'port':0x18eb});var socket=require(_0x6c43('0x19'))(new Redis(config[_0x6c43('0x17')]));require(_0x6c43('0x1a'))[_0x6c43('0x1b')](socket);function respondWithStatusCode(_0x54e955,_0x28fcb6){_0x28fcb6=_0x28fcb6||0xcc;return function(_0x5abaab){if(_0x5abaab){return _0x54e955[_0x6c43('0x1c')](_0x28fcb6);}return _0x54e955['status'](_0x28fcb6)[_0x6c43('0x1d')]();};}function respondWithResult(_0x2a8d6d,_0xf553c7){_0xf553c7=_0xf553c7||0xc8;return function(_0x44b263){if(_0x44b263){return _0x2a8d6d[_0x6c43('0x1e')](_0xf553c7)[_0x6c43('0x1f')](_0x44b263);}};}function respondWithFilteredResult(_0x2a7c46,_0x15f5e0){return function(_0x48c4c0){if(_0x48c4c0){var _0x386ce2=typeof _0x15f5e0[_0x6c43('0x20')]===_0x6c43('0x21')&&typeof _0x15f5e0['limit']==='undefined';var _0x30895e=_0x48c4c0[_0x6c43('0x22')];var _0x17fd98=_0x386ce2?0x0:_0x15f5e0[_0x6c43('0x20')];var _0xf68047=_0x386ce2?_0x48c4c0[_0x6c43('0x22')]:_0x15f5e0['offset']+_0x15f5e0[_0x6c43('0x23')];var _0x217c9d;if(_0xf68047>=_0x30895e){_0xf68047=_0x30895e;_0x217c9d=0xc8;}else{_0x217c9d=0xce;}_0x2a7c46[_0x6c43('0x1e')](_0x217c9d);return _0x2a7c46[_0x6c43('0x24')](_0x6c43('0x25'),_0x17fd98+'-'+_0xf68047+'/'+_0x30895e)['json'](_0x48c4c0);}return null;};}function patchUpdates(_0x4411e7){return function(_0x1ea5d1){try{jsonpatch['apply'](_0x1ea5d1,_0x4411e7,!![]);}catch(_0x117011){return BPromise[_0x6c43('0x26')](_0x117011);}return _0x1ea5d1['save']();};}function saveUpdates(_0x2af3e6,_0xfdc569){return function(_0x20f12a){if(_0x20f12a){return _0x20f12a[_0x6c43('0x27')](_0x2af3e6)['then'](function(_0x4cc62c){return _0x4cc62c;});}return null;};}function removeEntity(_0xd47acf,_0x45cf77){return function(_0x4ec803){if(_0x4ec803){return _0x4ec803[_0x6c43('0x28')]()[_0x6c43('0x29')](function(){_0xd47acf[_0x6c43('0x1e')](0xcc)[_0x6c43('0x1d')]();});}};}function handleEntityNotFound(_0x2a62eb,_0x34df52){return function(_0x4ed144){if(!_0x4ed144){_0x2a62eb['sendStatus'](0x194);}return _0x4ed144;};}function handleError(_0x51fc68,_0x1227ba){_0x1227ba=_0x1227ba||0x1f4;return function(_0x19817b){logger[_0x6c43('0x2a')](_0x19817b[_0x6c43('0x2b')]);if(_0x19817b['name']){delete _0x19817b['name'];}_0x51fc68[_0x6c43('0x1e')](_0x1227ba)[_0x6c43('0x2c')](_0x19817b);};}exports[_0x6c43('0x2d')]=function(_0x4aa39f,_0x5589b5){var _0x1b557d={},_0x5ae0a1={},_0x41a06a={'count':0x0,'rows':[]};var _0x3cb54b=_['map'](db[_0x6c43('0x2e')][_0x6c43('0x2f')],function(_0x53fb32){return{'name':_0x53fb32[_0x6c43('0x30')],'type':_0x53fb32[_0x6c43('0x31')]['key']};});_0x5ae0a1[_0x6c43('0x32')]=_[_0x6c43('0x33')](_0x3cb54b,_0x6c43('0x34'));_0x5ae0a1[_0x6c43('0x35')]=_['keys'](_0x4aa39f[_0x6c43('0x35')]);_0x5ae0a1[_0x6c43('0x36')]=_[_0x6c43('0x37')](_0x5ae0a1[_0x6c43('0x32')],_0x5ae0a1[_0x6c43('0x35')]);_0x1b557d[_0x6c43('0x38')]=_[_0x6c43('0x37')](_0x5ae0a1['model'],qs[_0x6c43('0x39')](_0x4aa39f[_0x6c43('0x35')][_0x6c43('0x39')]));_0x1b557d[_0x6c43('0x38')]=_0x1b557d[_0x6c43('0x38')][_0x6c43('0x3a')]?_0x1b557d[_0x6c43('0x38')]:_0x5ae0a1[_0x6c43('0x32')];if(!_0x4aa39f[_0x6c43('0x35')][_0x6c43('0x3b')](_0x6c43('0x3c'))){_0x1b557d['limit']=qs[_0x6c43('0x23')](_0x4aa39f[_0x6c43('0x35')][_0x6c43('0x23')]);_0x1b557d[_0x6c43('0x20')]=qs[_0x6c43('0x20')](_0x4aa39f[_0x6c43('0x35')][_0x6c43('0x20')]);}_0x1b557d[_0x6c43('0x3d')]=qs[_0x6c43('0x3e')](_0x4aa39f[_0x6c43('0x35')][_0x6c43('0x3e')]);_0x1b557d['where']=qs[_0x6c43('0x36')](_[_0x6c43('0x3f')](_0x4aa39f[_0x6c43('0x35')],_0x5ae0a1[_0x6c43('0x36')]),_0x3cb54b);if(_0x4aa39f[_0x6c43('0x35')][_0x6c43('0x40')]){_0x1b557d[_0x6c43('0x41')]=_['merge'](_0x1b557d[_0x6c43('0x41')],{'$or':_['map'](_0x3cb54b,function(_0x20fbe1){if(_0x20fbe1[_0x6c43('0x31')]!==_0x6c43('0x42')){var _0x440026={};_0x440026[_0x20fbe1[_0x6c43('0x34')]]={'$like':'%'+_0x4aa39f['query'][_0x6c43('0x40')]+'%'};return _0x440026;}})});}_0x1b557d=_[_0x6c43('0x43')]({},_0x1b557d,_0x4aa39f['options']);var _0x5de961={'where':_0x1b557d['where']};return db[_0x6c43('0x2e')][_0x6c43('0x22')](_0x5de961)[_0x6c43('0x29')](function(_0x192f97){_0x41a06a[_0x6c43('0x22')]=_0x192f97;if(_0x4aa39f[_0x6c43('0x35')]['includeAll']){_0x1b557d[_0x6c43('0x44')]=[{'all':!![]}];}return db[_0x6c43('0x2e')][_0x6c43('0x45')](_0x1b557d);})[_0x6c43('0x29')](function(_0xffaec6){_0x41a06a[_0x6c43('0x46')]=_0xffaec6;return _0x41a06a;})[_0x6c43('0x29')](respondWithFilteredResult(_0x5589b5,_0x1b557d))[_0x6c43('0x47')](handleError(_0x5589b5,null));};exports[_0x6c43('0x48')]=function(_0x36cdc0,_0x5d30b0){var _0x3e02c1={'raw':![],'where':{'id':_0x36cdc0['params']['id']}},_0x151e10={};_0x151e10[_0x6c43('0x32')]=_[_0x6c43('0x49')](db[_0x6c43('0x2e')][_0x6c43('0x2f')]);_0x151e10[_0x6c43('0x35')]=_['keys'](_0x36cdc0[_0x6c43('0x35')]);_0x151e10[_0x6c43('0x36')]=_[_0x6c43('0x37')](_0x151e10[_0x6c43('0x32')],_0x151e10[_0x6c43('0x35')]);_0x3e02c1[_0x6c43('0x38')]=_[_0x6c43('0x37')](_0x151e10[_0x6c43('0x32')],qs[_0x6c43('0x39')](_0x36cdc0[_0x6c43('0x35')][_0x6c43('0x39')]));_0x3e02c1[_0x6c43('0x38')]=_0x3e02c1[_0x6c43('0x38')][_0x6c43('0x3a')]?_0x3e02c1['attributes']:_0x151e10[_0x6c43('0x32')];if(_0x36cdc0[_0x6c43('0x35')]['includeAll']){_0x3e02c1[_0x6c43('0x44')]=[{'all':!![]}];}_0x3e02c1=_[_0x6c43('0x43')]({},_0x3e02c1,_0x36cdc0[_0x6c43('0x4a')]);return db['VoiceQueueReport'][_0x6c43('0x4b')](_0x3e02c1)[_0x6c43('0x29')](handleEntityNotFound(_0x5d30b0,null))[_0x6c43('0x29')](respondWithResult(_0x5d30b0,null))['catch'](handleError(_0x5d30b0,null));};exports['create']=function(_0x32144b,_0xdcbead){return db[_0x6c43('0x2e')]['create'](_0x32144b[_0x6c43('0x4c')],{})[_0x6c43('0x29')](respondWithResult(_0xdcbead,0xc9))[_0x6c43('0x47')](handleError(_0xdcbead,null));};exports[_0x6c43('0x27')]=function(_0x271280,_0x5d1607){if(_0x271280[_0x6c43('0x4c')]['id']){delete _0x271280[_0x6c43('0x4c')]['id'];}return db[_0x6c43('0x2e')][_0x6c43('0x4b')]({'where':{'id':_0x271280[_0x6c43('0x4d')]['id']}})[_0x6c43('0x29')](handleEntityNotFound(_0x5d1607,null))[_0x6c43('0x29')](saveUpdates(_0x271280[_0x6c43('0x4c')],null))[_0x6c43('0x29')](respondWithResult(_0x5d1607,null))[_0x6c43('0x47')](handleError(_0x5d1607,null));};exports[_0x6c43('0x28')]=function(_0xe93c0b,_0x6d96f6){return db[_0x6c43('0x2e')][_0x6c43('0x4b')]({'where':{'id':_0xe93c0b['params']['id']}})['then'](handleEntityNotFound(_0x6d96f6,null))[_0x6c43('0x29')](removeEntity(_0x6d96f6,null))[_0x6c43('0x47')](handleError(_0x6d96f6,null));};exports[_0x6c43('0x4e')]=function(_0x372824,_0x5bbdd0){return db['VoiceQueueReport'][_0x6c43('0x4e')]()[_0x6c43('0x29')](respondWithResult(_0x5bbdd0,null))[_0x6c43('0x47')](handleError(_0x5bbdd0,null));};exports[_0x6c43('0x4f')]=function(_0x257bdc,_0x4bfd8a){var _0x534c8f={},_0x3b6687={},_0x270bc1={'count':0x0,'rows':[]};_0x3b6687[_0x6c43('0x32')]=_[_0x6c43('0x49')](db[_0x6c43('0x2e')][_0x6c43('0x2f')]);_0x3b6687[_0x6c43('0x35')]=_[_0x6c43('0x49')](_0x257bdc[_0x6c43('0x35')]);_0x3b6687[_0x6c43('0x36')]=_['intersection'](_0x3b6687[_0x6c43('0x32')],_0x3b6687[_0x6c43('0x35')]);_0x534c8f['attributes']=_['intersection'](_0x3b6687['model'],qs[_0x6c43('0x39')](_0x257bdc[_0x6c43('0x35')][_0x6c43('0x39')]));_0x534c8f[_0x6c43('0x38')]=_0x534c8f['attributes'][_0x6c43('0x3a')]?_0x534c8f['attributes']:_0x3b6687[_0x6c43('0x32')];if(!_0x257bdc['query'][_0x6c43('0x3b')]('nolimit')){_0x534c8f[_0x6c43('0x23')]=qs[_0x6c43('0x23')](_0x257bdc[_0x6c43('0x35')]['limit']);_0x534c8f[_0x6c43('0x20')]=qs['offset'](_0x257bdc[_0x6c43('0x35')][_0x6c43('0x20')]);}_0x534c8f[_0x6c43('0x3d')]=qs[_0x6c43('0x3e')](_0x257bdc['query'][_0x6c43('0x3e')]);_0x534c8f['where']=qs[_0x6c43('0x36')](_[_0x6c43('0x3f')](_0x257bdc[_0x6c43('0x35')],_0x3b6687[_0x6c43('0x36')]));if(_0x257bdc[_0x6c43('0x35')]['filter']){_0x534c8f[_0x6c43('0x41')]=_[_0x6c43('0x43')](_0x534c8f[_0x6c43('0x41')],{'$or':_[_0x6c43('0x33')](_0x534c8f[_0x6c43('0x38')],function(_0x246f23){var _0x148b04={};_0x148b04[_0x246f23]={'$like':'%'+_0x257bdc[_0x6c43('0x35')][_0x6c43('0x40')]+'%'};return _0x148b04;})});}_0x534c8f=_[_0x6c43('0x43')]({},_0x534c8f,_0x257bdc[_0x6c43('0x4a')]);var _0x115beb={'where':_0x534c8f[_0x6c43('0x41')]};return db['VoiceQueueReport'][_0x6c43('0x22')](_0x115beb)[_0x6c43('0x29')](function(_0x2456b0){_0x270bc1['count']=_0x2456b0;if(_0x257bdc[_0x6c43('0x35')][_0x6c43('0x50')]){_0x534c8f[_0x6c43('0x44')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x6c43('0x45')](_0x534c8f);})['then'](function(_0x377d05){_0x270bc1[_0x6c43('0x46')]=_0x377d05;return _0x270bc1;})[_0x6c43('0x29')](respondWithFilteredResult(_0x4bfd8a,_0x534c8f,_0x6c43('0x4f')))[_0x6c43('0x47')](handleError(_0x4bfd8a,null,_0x6c43('0x4f')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index d56fd90..4b910e8 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 _0x668f=['save','update','remove','emit','hasOwnProperty','exports','events','VoiceQueueReport','setMaxListeners'];(function(_0x4d4334,_0x159e02){var _0x594988=function(_0x10fe51){while(--_0x10fe51){_0x4d4334['push'](_0x4d4334['shift']());}};_0x594988(++_0x159e02);}(_0x668f,0x69));var _0xf668=function(_0x4de723,_0x5e9fcb){_0x4de723=_0x4de723-0x0;var _0x398a4d=_0x668f[_0x4de723];return _0x398a4d;};'use strict';var EventEmitter=require(_0xf668('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xf668('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xf668('0x2')](0x0);var events={'afterCreate':_0xf668('0x3'),'afterUpdate':_0xf668('0x4'),'afterDestroy':_0xf668('0x5')};function emitEvent(_0x1f38df){return function(_0x2b30e4,_0xc003f6,_0x417ebf){VoiceQueueReportEvents[_0xf668('0x6')](_0x1f38df+':'+_0x2b30e4['id'],_0x2b30e4);VoiceQueueReportEvents[_0xf668('0x6')](_0x1f38df,_0x2b30e4);_0x417ebf(null);};}for(var e in events){if(events[_0xf668('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xf668('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xa80b=['hook','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x4be79a,_0x227e03){var _0x468ffa=function(_0x56d5f9){while(--_0x56d5f9){_0x4be79a['push'](_0x4be79a['shift']());}};_0x468ffa(++_0x227e03);}(_0xa80b,0x1b9));var _0xba80=function(_0x2587b6,_0x77b30d){_0x2587b6=_0x2587b6-0x0;var _0x465a2b=_0xa80b[_0x2587b6];return _0x465a2b;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xba80('0x0'))['db'][_0xba80('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xba80('0x2')](0x0);var events={'afterCreate':_0xba80('0x3'),'afterUpdate':_0xba80('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1888bf){return function(_0x3f9a36,_0x36737f,_0x2f311b){VoiceQueueReportEvents[_0xba80('0x5')](_0x1888bf+':'+_0x3f9a36['id'],_0x3f9a36);VoiceQueueReportEvents[_0xba80('0x5')](_0x1888bf,_0x3f9a36);_0x2f311b(null);};}for(var e in events){if(events[_0xba80('0x6')](e)){var event=events[e];VoiceQueueReport[_0xba80('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index de955ad..e7f8d70 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 _0xeb8a=['moment','bluebird','path','rimraf','../../config/environment','exports','define','report_queue','uniqueid','calleridnum','lodash','util','api'];(function(_0x297b84,_0x302bb6){var _0x12c17d=function(_0x1419de){while(--_0x1419de){_0x297b84['push'](_0x297b84['shift']());}};_0x12c17d(++_0x302bb6);}(_0xeb8a,0x15c));var _0xaeb8=function(_0x42b48b,_0x42f13b){_0x42b48b=_0x42b48b-0x0;var _0x20794a=_0xeb8a[_0x42b48b];return _0x20794a;};'use strict';var _=require(_0xaeb8('0x0'));var util=require(_0xaeb8('0x1'));var logger=require('../../config/logger')(_0xaeb8('0x2'));var moment=require(_0xaeb8('0x3'));var BPromise=require(_0xaeb8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaeb8('0x5'));var rimraf=require(_0xaeb8('0x6'));var config=require(_0xaeb8('0x7'));var attributes=require('./voiceQueueReport.attributes');module[_0xaeb8('0x8')]=function(_0x10d87f,_0x2fde75){return _0x10d87f[_0xaeb8('0x9')]('VoiceQueueReport',attributes,{'tableName':_0xaeb8('0xa'),'paranoid':![],'indexes':[{'fields':[_0xaeb8('0xb')]},{'fields':[_0xaeb8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x38ca=['bluebird','path','rimraf','../../config/environment','./voiceQueueReport.attributes','report_queue','uniqueid','calleridnum','lodash','../../config/logger','api','moment'];(function(_0x4d740a,_0x55391f){var _0x5e53bf=function(_0x43105e){while(--_0x43105e){_0x4d740a['push'](_0x4d740a['shift']());}};_0x5e53bf(++_0x55391f);}(_0x38ca,0xb0));var _0xa38c=function(_0x1ef550,_0x3af741){_0x1ef550=_0x1ef550-0x0;var _0x2c059c=_0x38ca[_0x1ef550];return _0x2c059c;};'use strict';var _=require(_0xa38c('0x0'));var util=require('util');var logger=require(_0xa38c('0x1'))(_0xa38c('0x2'));var moment=require(_0xa38c('0x3'));var BPromise=require(_0xa38c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa38c('0x5'));var rimraf=require(_0xa38c('0x6'));var config=require(_0xa38c('0x7'));var attributes=require(_0xa38c('0x8'));module['exports']=function(_0xe4cde2,_0x4487ef){return _0xe4cde2['define']('VoiceQueueReport',attributes,{'tableName':_0xa38c('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa38c('0xa')]},{'fields':[_0xa38c('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 11c48dc..821ef03 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 _0x23ee=['catch','UpdateVoiceQueueReport','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','include','model','map','create','body','CreateVoiceQueueReport'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x23ee,0x1e6));var _0xe23e=function(_0x59616b,_0x38e534){_0x59616b=_0x59616b-0x0;var _0x5c4523=_0x23ee[_0x59616b];return _0x5c4523;};'use strict';var _=require(_0xe23e('0x0'));var util=require(_0xe23e('0x1'));var moment=require(_0xe23e('0x2'));var BPromise=require('bluebird');var rs=require(_0xe23e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe23e('0x4'))['db'];var utils=require(_0xe23e('0x5'));var logger=require(_0xe23e('0x6'))(_0xe23e('0x7'));var config=require(_0xe23e('0x8'));var jayson=require(_0xe23e('0x9'));var client=jayson[_0xe23e('0xa')][_0xe23e('0xb')]({'port':0x232a});config[_0xe23e('0xc')]=_[_0xe23e('0xd')](config[_0xe23e('0xc')],{'host':_0xe23e('0xe'),'port':0x18eb});var socket=require(_0xe23e('0xf'))(new Redis(config[_0xe23e('0xc')]));require(_0xe23e('0x10'))['register'](socket);function respondWithRpcPromise(_0x9f7b69,_0x4fb288,_0x197382){return new BPromise(function(_0x2b787d,_0x1f5f58){return client[_0xe23e('0x11')](_0x9f7b69,_0x197382)[_0xe23e('0x12')](function(_0x9b0a67){logger[_0xe23e('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x4fb288,_0xe23e('0x14'));logger[_0xe23e('0x15')](_0xe23e('0x16'),_0x4fb288,_0xe23e('0x14'),JSON[_0xe23e('0x17')](_0x9b0a67));if(_0x9b0a67[_0xe23e('0x18')]){if(_0x9b0a67[_0xe23e('0x18')][_0xe23e('0x19')]===0x1f4){logger[_0xe23e('0x18')](_0xe23e('0x1a'),_0x4fb288,_0x9b0a67[_0xe23e('0x18')]['message']);return _0x1f5f58(_0x9b0a67[_0xe23e('0x18')][_0xe23e('0x1b')]);}logger[_0xe23e('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x4fb288,_0x9b0a67[_0xe23e('0x18')][_0xe23e('0x1b')]);return _0x2b787d(_0x9b0a67[_0xe23e('0x18')][_0xe23e('0x1b')]);}else{logger[_0xe23e('0x13')](_0xe23e('0x1a'),_0x4fb288,_0xe23e('0x14'));_0x2b787d(_0x9b0a67[_0xe23e('0x1c')][_0xe23e('0x1b')]);}})['catch'](function(_0x21d3b8){logger[_0xe23e('0x18')](_0xe23e('0x1a'),_0x4fb288,_0x21d3b8);_0x1f5f58(_0x21d3b8);});});}exports[_0xe23e('0x1d')]=function(_0x425de0){var _0x28f89e=this;return new Promise(function(_0x2ea343,_0x30379f){return db[_0xe23e('0x1e')]['findAll']({'raw':_0x425de0[_0xe23e('0x1f')]?_0x425de0[_0xe23e('0x1f')][_0xe23e('0x20')]===undefined?!![]:![]:!![],'where':_0x425de0['options']?_0x425de0['options'][_0xe23e('0x21')]||null:null,'attributes':_0x425de0['options']?_0x425de0[_0xe23e('0x1f')][_0xe23e('0x22')]||null:null,'limit':_0x425de0['options']?_0x425de0[_0xe23e('0x1f')][_0xe23e('0x23')]||null:null,'include':_0x425de0[_0xe23e('0x1f')]?_0x425de0[_0xe23e('0x1f')][_0xe23e('0x24')]?_['map'](_0x425de0[_0xe23e('0x1f')][_0xe23e('0x24')],function(_0x47c14f){return{'model':db[_0x47c14f[_0xe23e('0x25')]],'as':_0x47c14f['as'],'attributes':_0x47c14f['attributes'],'include':_0x47c14f[_0xe23e('0x24')]?_[_0xe23e('0x26')](_0x47c14f[_0xe23e('0x24')],function(_0xbdd72a){return{'model':db[_0xbdd72a[_0xe23e('0x25')]],'as':_0xbdd72a['as'],'attributes':_0xbdd72a[_0xe23e('0x22')],'include':_0xbdd72a['include']?_[_0xe23e('0x26')](_0xbdd72a[_0xe23e('0x24')],function(_0xff6e10){return{'model':db[_0xff6e10[_0xe23e('0x25')]],'as':_0xff6e10['as'],'attributes':_0xff6e10[_0xe23e('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x172b9a){logger['info'](_0xe23e('0x1d'),_0x425de0);logger['debug'](_0xe23e('0x1d'),_0x425de0,JSON[_0xe23e('0x17')](_0x172b9a));_0x2ea343(_0x172b9a);})['catch'](function(_0x56d7d2){logger[_0xe23e('0x18')](_0xe23e('0x1d'),_0x56d7d2[_0xe23e('0x1b')],_0x425de0);_0x30379f(_0x28f89e[_0xe23e('0x18')](0x1f4,_0x56d7d2[_0xe23e('0x1b')]));});});};exports['CreateVoiceQueueReport']=function(_0x2dd29a){var _0x5927df=this;return new Promise(function(_0x394093,_0x4b4b46){return db[_0xe23e('0x1e')][_0xe23e('0x27')](_0x2dd29a[_0xe23e('0x28')],{'raw':_0x2dd29a[_0xe23e('0x1f')]?_0x2dd29a[_0xe23e('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xe23e('0x12')](function(_0x1eaae4){logger[_0xe23e('0x13')](_0xe23e('0x29'),_0x2dd29a);logger[_0xe23e('0x15')](_0xe23e('0x29'),_0x2dd29a,JSON[_0xe23e('0x17')](_0x1eaae4));_0x394093(_0x1eaae4);})[_0xe23e('0x2a')](function(_0x4667f3){logger[_0xe23e('0x18')](_0xe23e('0x29'),_0x4667f3[_0xe23e('0x1b')],_0x2dd29a);_0x4b4b46(_0x5927df[_0xe23e('0x18')](0x1f4,_0x4667f3[_0xe23e('0x1b')]));});});};exports[_0xe23e('0x2b')]=function(_0x246e21){var _0x2192e3=this;return new Promise(function(_0x4d4a52,_0x21a0ff){return db[_0xe23e('0x1e')]['update'](_0x246e21[_0xe23e('0x28')],{'raw':_0x246e21['options']?_0x246e21[_0xe23e('0x1f')][_0xe23e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x246e21['options']?_0x246e21[_0xe23e('0x1f')][_0xe23e('0x21')]||null:null,'attributes':_0x246e21['options']?_0x246e21[_0xe23e('0x1f')]['attributes']||null:null,'limit':_0x246e21[_0xe23e('0x1f')]?_0x246e21[_0xe23e('0x1f')][_0xe23e('0x23')]||null:null})['then'](function(_0x2c20a5){logger[_0xe23e('0x13')](_0xe23e('0x2b'),_0x246e21);logger[_0xe23e('0x15')]('UpdateVoiceQueueReport',_0x246e21,JSON[_0xe23e('0x17')](_0x2c20a5));_0x4d4a52(_0x2c20a5);})['catch'](function(_0x2ab1c4){logger[_0xe23e('0x18')]('UpdateVoiceQueueReport',_0x2ab1c4[_0xe23e('0x1b')],_0x246e21);_0x21a0ff(_0x2192e3[_0xe23e('0x18')](0x1f4,_0x2ab1c4[_0xe23e('0x1b')]));});});}; \ No newline at end of file +var _0x51b2=['defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','limit','map','include','model','attributes','stringify','CreateVoiceQueueReport','create','update','body','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x51b2,0x80));var _0x251b=function(_0xe5b539,_0x467802){_0xe5b539=_0xe5b539-0x0;var _0x4bd185=_0x51b2[_0xe5b539];return _0x4bd185;};'use strict';var _=require(_0x251b('0x0'));var util=require(_0x251b('0x1'));var moment=require(_0x251b('0x2'));var BPromise=require(_0x251b('0x3'));var rs=require(_0x251b('0x4'));var fs=require('fs');var Redis=require(_0x251b('0x5'));var db=require(_0x251b('0x6'))['db'];var utils=require(_0x251b('0x7'));var logger=require(_0x251b('0x8'))(_0x251b('0x9'));var config=require(_0x251b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x251b('0xb')][_0x251b('0xc')]({'port':0x232a});config['redis']=_[_0x251b('0xd')](config[_0x251b('0xe')],{'host':_0x251b('0xf'),'port':0x18eb});var socket=require(_0x251b('0x10'))(new Redis(config['redis']));require(_0x251b('0x11'))[_0x251b('0x12')](socket);function respondWithRpcPromise(_0x55c0b1,_0x27c687,_0x46be7e){return new BPromise(function(_0x3715c2,_0x263244){return client[_0x251b('0x13')](_0x55c0b1,_0x46be7e)[_0x251b('0x14')](function(_0x37bd99){logger['info'](_0x251b('0x15'),_0x27c687,_0x251b('0x16'));logger[_0x251b('0x17')](_0x251b('0x18'),_0x27c687,'request\x20sent',JSON['stringify'](_0x37bd99));if(_0x37bd99[_0x251b('0x19')]){if(_0x37bd99[_0x251b('0x19')][_0x251b('0x1a')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x27c687,_0x37bd99['error'][_0x251b('0x1b')]);return _0x263244(_0x37bd99[_0x251b('0x19')][_0x251b('0x1b')]);}logger[_0x251b('0x19')](_0x251b('0x15'),_0x27c687,_0x37bd99[_0x251b('0x19')][_0x251b('0x1b')]);return _0x3715c2(_0x37bd99[_0x251b('0x19')][_0x251b('0x1b')]);}else{logger[_0x251b('0x1c')](_0x251b('0x15'),_0x27c687,_0x251b('0x16'));_0x3715c2(_0x37bd99[_0x251b('0x1d')][_0x251b('0x1b')]);}})[_0x251b('0x1e')](function(_0x451f97){logger[_0x251b('0x19')](_0x251b('0x15'),_0x27c687,_0x451f97);_0x263244(_0x451f97);});});}exports[_0x251b('0x1f')]=function(_0x57c63a){var _0x16c53e=this;return new Promise(function(_0x1bfb2b,_0x54217a){return db[_0x251b('0x20')][_0x251b('0x21')]({'raw':_0x57c63a[_0x251b('0x22')]?_0x57c63a['options'][_0x251b('0x23')]===undefined?!![]:![]:!![],'where':_0x57c63a[_0x251b('0x22')]?_0x57c63a[_0x251b('0x22')][_0x251b('0x24')]||null:null,'attributes':_0x57c63a[_0x251b('0x22')]?_0x57c63a[_0x251b('0x22')]['attributes']||null:null,'limit':_0x57c63a[_0x251b('0x22')]?_0x57c63a['options'][_0x251b('0x25')]||null:null,'include':_0x57c63a['options']?_0x57c63a[_0x251b('0x22')]['include']?_[_0x251b('0x26')](_0x57c63a[_0x251b('0x22')][_0x251b('0x27')],function(_0x5a2a88){return{'model':db[_0x5a2a88[_0x251b('0x28')]],'as':_0x5a2a88['as'],'attributes':_0x5a2a88[_0x251b('0x29')],'include':_0x5a2a88[_0x251b('0x27')]?_[_0x251b('0x26')](_0x5a2a88[_0x251b('0x27')],function(_0x241d6d){return{'model':db[_0x241d6d[_0x251b('0x28')]],'as':_0x241d6d['as'],'attributes':_0x241d6d[_0x251b('0x29')],'include':_0x241d6d[_0x251b('0x27')]?_[_0x251b('0x26')](_0x241d6d[_0x251b('0x27')],function(_0x49fe55){return{'model':db[_0x49fe55[_0x251b('0x28')]],'as':_0x49fe55['as'],'attributes':_0x49fe55[_0x251b('0x29')]};}):[]};}):[]};}):[]:[]})[_0x251b('0x14')](function(_0x4fa02b){logger[_0x251b('0x1c')]('GetVoiceQueueReport',_0x57c63a);logger[_0x251b('0x17')](_0x251b('0x1f'),_0x57c63a,JSON[_0x251b('0x2a')](_0x4fa02b));_0x1bfb2b(_0x4fa02b);})[_0x251b('0x1e')](function(_0x25af17){logger['error'](_0x251b('0x1f'),_0x25af17['message'],_0x57c63a);_0x54217a(_0x16c53e[_0x251b('0x19')](0x1f4,_0x25af17['message']));});});};exports[_0x251b('0x2b')]=function(_0x17111c){var _0x4a1a58=this;return new Promise(function(_0x151722,_0x46fb99){return db['VoiceQueueReport'][_0x251b('0x2c')](_0x17111c['body'],{'raw':_0x17111c[_0x251b('0x22')]?_0x17111c[_0x251b('0x22')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1f7d9f){logger[_0x251b('0x1c')](_0x251b('0x2b'),_0x17111c);logger[_0x251b('0x17')](_0x251b('0x2b'),_0x17111c,JSON[_0x251b('0x2a')](_0x1f7d9f));_0x151722(_0x1f7d9f);})[_0x251b('0x1e')](function(_0x18b9cb){logger['error']('CreateVoiceQueueReport',_0x18b9cb[_0x251b('0x1b')],_0x17111c);_0x46fb99(_0x4a1a58['error'](0x1f4,_0x18b9cb[_0x251b('0x1b')]));});});};exports['UpdateVoiceQueueReport']=function(_0x58464f){var _0x2b154e=this;return new Promise(function(_0x597e52,_0x3c8f7f){return db[_0x251b('0x20')][_0x251b('0x2d')](_0x58464f[_0x251b('0x2e')],{'raw':_0x58464f[_0x251b('0x22')]?_0x58464f['options'][_0x251b('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58464f['options']?_0x58464f['options']['where']||null:null,'attributes':_0x58464f[_0x251b('0x22')]?_0x58464f[_0x251b('0x22')][_0x251b('0x29')]||null:null,'limit':_0x58464f['options']?_0x58464f[_0x251b('0x22')][_0x251b('0x25')]||null:null})[_0x251b('0x14')](function(_0xc9c3f8){logger[_0x251b('0x1c')]('UpdateVoiceQueueReport',_0x58464f);logger[_0x251b('0x17')]('UpdateVoiceQueueReport',_0x58464f,JSON[_0x251b('0x2a')](_0xc9c3f8));_0x597e52(_0xc9c3f8);})[_0x251b('0x1e')](function(_0x46c5d1){logger[_0x251b('0x19')]('UpdateVoiceQueueReport',_0x46c5d1[_0x251b('0x1b')],_0x58464f);_0x3c8f7f(_0x2b154e['error'](0x1f4,_0x46c5d1[_0x251b('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 1574b1b..a06b958 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 _0x31c2=['removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit'];(function(_0x20ecae,_0x14c0aa){var _0x2b9caf=function(_0x4bad11){while(--_0x4bad11){_0x20ecae['push'](_0x20ecae['shift']());}};_0x2b9caf(++_0x14c0aa);}(_0x31c2,0x1e1));var _0x231c=function(_0x26ecdc,_0x5c1f52){_0x26ecdc=_0x26ecdc-0x0;var _0x8b09c3=_0x31c2[_0x26ecdc];return _0x8b09c3;};'use strict';var VoiceQueueReportEvents=require(_0x231c('0x0'));var events=[_0x231c('0x1'),_0x231c('0x2'),_0x231c('0x3')];function createListener(_0x1c57c9,_0x7e36a0){return function(_0xa1faa4){_0x7e36a0[_0x231c('0x4')](_0x1c57c9,_0xa1faa4);};}function removeListener(_0x5b0b0a,_0x59f232){return function(){VoiceQueueReportEvents[_0x231c('0x5')](_0x5b0b0a,_0x59f232);};}exports[_0x231c('0x6')]=function(_0x1f3f7d){for(var _0x219c3f=0x0,_0x48bfb2=events[_0x231c('0x7')];_0x219c3f<_0x48bfb2;_0x219c3f++){var _0x49ff9e=events[_0x219c3f];var _0x439df8=createListener(_0x231c('0x8')+_0x49ff9e,_0x1f3f7d);VoiceQueueReportEvents['on'](_0x49ff9e,_0x439df8);}}; \ No newline at end of file +var _0x938d=['./voiceQueueReport.events','save','update','removeListener','length'];(function(_0xc1b1,_0x29f090){var _0x7c004=function(_0xb1204e){while(--_0xb1204e){_0xc1b1['push'](_0xc1b1['shift']());}};_0x7c004(++_0x29f090);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceQueueReportEvents=require(_0xd938('0x0'));var events=[_0xd938('0x1'),'remove',_0xd938('0x2')];function createListener(_0x29cf5f,_0x221132){return function(_0x5349c7){_0x221132['emit'](_0x29cf5f,_0x5349c7);};}function removeListener(_0xc9f24b,_0x429911){return function(){VoiceQueueReportEvents[_0xd938('0x3')](_0xc9f24b,_0x429911);};}exports['register']=function(_0x3a81d2){for(var _0xb5e113=0x0,_0x1ed46b=events[_0xd938('0x4')];_0xb5e113<_0x1ed46b;_0xb5e113++){var _0x678164=events[_0xb5e113];var _0x419e0b=createListener('voiceQueueReport:'+_0x678164,_0x3a81d2);VoiceQueueReportEvents['on'](_0x678164,_0x419e0b);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index b2f5938..d75b6d1 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 _0x5e40=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','show','post'];(function(_0x430503,_0x2757c1){var _0x4c20a0=function(_0xc91d22){while(--_0xc91d22){_0x430503['push'](_0x430503['shift']());}};_0x4c20a0(++_0x2757c1);}(_0x5e40,0x1a4));var _0x05e4=function(_0x576c1e,_0x49c1d6){_0x576c1e=_0x576c1e-0x0;var _0x33a3c3=_0x5e40[_0x576c1e];return _0x33a3c3;};'use strict';var multer=require(_0x05e4('0x0'));var util=require(_0x05e4('0x1'));var path=require('path');var timeout=require(_0x05e4('0x2'));var express=require(_0x05e4('0x3'));var router=express[_0x05e4('0x4')]();var fs_extra=require(_0x05e4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x05e4('0x6'));var controller=require(_0x05e4('0x7'));router['get']('/',auth[_0x05e4('0x8')](),controller[_0x05e4('0x9')]);router['get']('/:id',auth[_0x05e4('0x8')](),controller[_0x05e4('0xa')]);router[_0x05e4('0xb')]('/',auth[_0x05e4('0x8')](),controller[_0x05e4('0xc')]);router[_0x05e4('0xd')]('/:id',auth[_0x05e4('0x8')](),controller[_0x05e4('0xe')]);router[_0x05e4('0xf')]('/:id',auth[_0x05e4('0x8')](),controller[_0x05e4('0x10')]);module[_0x05e4('0x11')]=router; \ No newline at end of file +var _0x839e=['get','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x839e,0xdb));var _0xe839=function(_0x5393a6,_0x3c972d){_0x5393a6=_0x5393a6-0x0;var _0x477463=_0x839e[_0x5393a6];return _0x477463;};'use strict';var multer=require(_0xe839('0x0'));var util=require(_0xe839('0x1'));var path=require(_0xe839('0x2'));var timeout=require(_0xe839('0x3'));var express=require(_0xe839('0x4'));var router=express['Router']();var fs_extra=require(_0xe839('0x5'));var auth=require(_0xe839('0x6'));var interaction=require(_0xe839('0x7'));var config=require(_0xe839('0x8'));var controller=require(_0xe839('0x9'));router['get']('/',auth[_0xe839('0xa')](),controller[_0xe839('0xb')]);router[_0xe839('0xc')](_0xe839('0xd'),auth[_0xe839('0xa')](),controller[_0xe839('0xe')]);router['post']('/',auth[_0xe839('0xa')](),controller[_0xe839('0xf')]);router[_0xe839('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe839('0x11')]);router[_0xe839('0x12')](_0xe839('0xd'),auth[_0xe839('0xa')](),controller[_0xe839('0x13')]);module[_0xe839('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 99205ee..3c7d540 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 _0x6bf6=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports'];(function(_0x4bc39e,_0xba18dd){var _0x1a75d9=function(_0x1b63df){while(--_0x1b63df){_0x4bc39e['push'](_0x4bc39e['shift']());}};_0x1a75d9(++_0xba18dd);}(_0x6bf6,0x11c));var _0x66bf=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x6bf6[_0x59befa];return _0x1dd63d;};'use strict';var Sequelize=require(_0x66bf('0x0'));var moment=require(_0x66bf('0x1'));module[_0x66bf('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x66bf('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x66bf('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x66bf('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x66bf('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x66bf('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x66bf('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x66bf('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x66bf('0x4')],'allowNull':![],'defaultValue':moment()[_0x66bf('0x5')](_0x66bf('0x6'))}}; \ No newline at end of file +var _0x0adf=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports'];(function(_0x4d03d6,_0x438a06){var _0x22752e=function(_0x1b2894){while(--_0x1b2894){_0x4d03d6['push'](_0x4d03d6['shift']());}};_0x22752e(++_0x438a06);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x9ac644,_0x4ad0ad){_0x9ac644=_0x9ac644-0x0;var _0x340a83=_0x0adf[_0x9ac644];return _0x340a83;};'use strict';var Sequelize=require(_0xf0ad('0x0'));var moment=require(_0xf0ad('0x1'));module[_0xf0ad('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xf0ad('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xf0ad('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xf0ad('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xf0ad('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xf0ad('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xf0ad('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xf0ad('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xf0ad('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xf0ad('0x4')],'allowNull':![],'defaultValue':moment()[_0xf0ad('0x5')](_0xf0ad('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 5ae35f5..b886b4f 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 _0xb86d=['../../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','Content-Range','reject','save','then','destroy','end','sendStatus','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','findAll','rows','catch','show','keys','find','create','body','params','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service'];(function(_0x1bccb3,_0x5400d9){var _0x5079fa=function(_0x31fcb0){while(--_0x31fcb0){_0x1bccb3['push'](_0x1bccb3['shift']());}};_0x5079fa(++_0x5400d9);}(_0xb86d,0x158));var _0xdb86=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb86d[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb86('0x0'));var zipdir=require(_0xdb86('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb86('0x2'));var moment=require('moment');var BPromise=require(_0xdb86('0x3'));var Mustache=require(_0xdb86('0x4'));var util=require(_0xdb86('0x5'));var path=require(_0xdb86('0x6'));var sox=require(_0xdb86('0x7'));var csv=require(_0xdb86('0x8'));var ejs=require(_0xdb86('0x9'));var fs=require('fs');var fs_extra=require(_0xdb86('0xa'));var _=require(_0xdb86('0xb'));var squel=require(_0xdb86('0xc'));var crypto=require(_0xdb86('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdb86('0x8'));var querystring=require('querystring');var Papa=require(_0xdb86('0xe'));var Redis=require('ioredis');var authService=require(_0xdb86('0xf'));var qs=require(_0xdb86('0x10'));var as=require(_0xdb86('0x11'));var hardwareService=require(_0xdb86('0x12'));var logger=require(_0xdb86('0x13'))(_0xdb86('0x14'));var utils=require(_0xdb86('0x15'));var config=require(_0xdb86('0x16'));var licenseUtil=require(_0xdb86('0x17'));var db=require(_0xdb86('0x18'))['db'];function respondWithStatusCode(_0x4999b5,_0x55c6ec){_0x55c6ec=_0x55c6ec||0xcc;return function(_0x33edf6){if(_0x33edf6){return _0x4999b5['sendStatus'](_0x55c6ec);}return _0x4999b5[_0xdb86('0x19')](_0x55c6ec)['end']();};}function respondWithResult(_0x5f2caf,_0x129def){_0x129def=_0x129def||0xc8;return function(_0x4f8221){if(_0x4f8221){return _0x5f2caf[_0xdb86('0x19')](_0x129def)[_0xdb86('0x1a')](_0x4f8221);}};}function respondWithFilteredResult(_0x3996de,_0x2192a4){return function(_0x47cd56){if(_0x47cd56){var _0x5875da=typeof _0x2192a4[_0xdb86('0x1b')]==='undefined'&&typeof _0x2192a4['limit']===_0xdb86('0x1c');var _0x3489e1=_0x47cd56['count'];var _0x58f790=_0x5875da?0x0:_0x2192a4['offset'];var _0x39d39d=_0x5875da?_0x47cd56['count']:_0x2192a4[_0xdb86('0x1b')]+_0x2192a4[_0xdb86('0x1d')];var _0x2cc454;if(_0x39d39d>=_0x3489e1){_0x39d39d=_0x3489e1;_0x2cc454=0xc8;}else{_0x2cc454=0xce;}_0x3996de[_0xdb86('0x19')](_0x2cc454);return _0x3996de['set'](_0xdb86('0x1e'),_0x58f790+'-'+_0x39d39d+'/'+_0x3489e1)[_0xdb86('0x1a')](_0x47cd56);}return null;};}function patchUpdates(_0x142476){return function(_0x4dd5ba){try{jsonpatch['apply'](_0x4dd5ba,_0x142476,!![]);}catch(_0x7b5e0b){return BPromise[_0xdb86('0x1f')](_0x7b5e0b);}return _0x4dd5ba[_0xdb86('0x20')]();};}function saveUpdates(_0x2bd63a,_0x1f1284){return function(_0x54109a){if(_0x54109a){return _0x54109a['update'](_0x2bd63a)[_0xdb86('0x21')](function(_0x8c2eb7){return _0x8c2eb7;});}return null;};}function removeEntity(_0x479671,_0x92e918){return function(_0x279e0e){if(_0x279e0e){return _0x279e0e[_0xdb86('0x22')]()[_0xdb86('0x21')](function(){_0x479671[_0xdb86('0x19')](0xcc)[_0xdb86('0x23')]();});}};}function handleEntityNotFound(_0x3dfed8,_0x54d1b3){return function(_0x28f9be){if(!_0x28f9be){_0x3dfed8[_0xdb86('0x24')](0x194);}return _0x28f9be;};}function handleError(_0x1da0ad,_0x1b2e8a){_0x1b2e8a=_0x1b2e8a||0x1f4;return function(_0x2e06aa){logger[_0xdb86('0x25')](_0x2e06aa['stack']);if(_0x2e06aa['name']){delete _0x2e06aa[_0xdb86('0x26')];}_0x1da0ad[_0xdb86('0x19')](_0x1b2e8a)[_0xdb86('0x27')](_0x2e06aa);};}exports[_0xdb86('0x28')]=function(_0x53abff,_0x1b74eb){var _0x5a449c={},_0x578062={},_0x42a1c4={'count':0x0,'rows':[]};var _0xd6ad9e=_[_0xdb86('0x29')](db[_0xdb86('0x2a')][_0xdb86('0x2b')],function(_0x4320d6){return{'name':_0x4320d6[_0xdb86('0x2c')],'type':_0x4320d6[_0xdb86('0x2d')]['key']};});_0x578062[_0xdb86('0x2e')]=_['map'](_0xd6ad9e,_0xdb86('0x26'));_0x578062[_0xdb86('0x2f')]=_['keys'](_0x53abff['query']);_0x578062[_0xdb86('0x30')]=_[_0xdb86('0x31')](_0x578062[_0xdb86('0x2e')],_0x578062['query']);_0x5a449c[_0xdb86('0x32')]=_[_0xdb86('0x31')](_0x578062[_0xdb86('0x2e')],qs[_0xdb86('0x33')](_0x53abff[_0xdb86('0x2f')][_0xdb86('0x33')]));_0x5a449c[_0xdb86('0x32')]=_0x5a449c[_0xdb86('0x32')][_0xdb86('0x34')]?_0x5a449c[_0xdb86('0x32')]:_0x578062[_0xdb86('0x2e')];if(!_0x53abff[_0xdb86('0x2f')][_0xdb86('0x35')](_0xdb86('0x36'))){_0x5a449c['limit']=qs[_0xdb86('0x1d')](_0x53abff[_0xdb86('0x2f')][_0xdb86('0x1d')]);_0x5a449c[_0xdb86('0x1b')]=qs['offset'](_0x53abff[_0xdb86('0x2f')][_0xdb86('0x1b')]);}_0x5a449c['order']=qs[_0xdb86('0x37')](_0x53abff['query']['sort']);_0x5a449c[_0xdb86('0x38')]=qs[_0xdb86('0x30')](_[_0xdb86('0x39')](_0x53abff[_0xdb86('0x2f')],_0x578062['filters']),_0xd6ad9e);if(_0x53abff[_0xdb86('0x2f')][_0xdb86('0x3a')]){_0x5a449c[_0xdb86('0x38')]=_['merge'](_0x5a449c[_0xdb86('0x38')],{'$or':_[_0xdb86('0x29')](_0xd6ad9e,function(_0x5e0b27){if(_0x5e0b27[_0xdb86('0x2d')]!==_0xdb86('0x3b')){var _0x4466ec={};_0x4466ec[_0x5e0b27[_0xdb86('0x26')]]={'$like':'%'+_0x53abff['query'][_0xdb86('0x3a')]+'%'};return _0x4466ec;}})});}_0x5a449c=_[_0xdb86('0x3c')]({},_0x5a449c,_0x53abff['options']);var _0xd27a11={'where':_0x5a449c['where']};return db[_0xdb86('0x2a')][_0xdb86('0x3d')](_0xd27a11)['then'](function(_0x4b105b){_0x42a1c4[_0xdb86('0x3d')]=_0x4b105b;if(_0x53abff[_0xdb86('0x2f')][_0xdb86('0x3e')]){_0x5a449c['include']=[{'all':!![]}];}return db[_0xdb86('0x2a')][_0xdb86('0x3f')](_0x5a449c);})[_0xdb86('0x21')](function(_0x1afd89){_0x42a1c4[_0xdb86('0x40')]=_0x1afd89;return _0x42a1c4;})['then'](respondWithFilteredResult(_0x1b74eb,_0x5a449c))[_0xdb86('0x41')](handleError(_0x1b74eb,null));};exports[_0xdb86('0x42')]=function(_0x2dd165,_0x55af1f){var _0x5bc4b5={'raw':!![],'where':{'id':_0x2dd165['params']['id']}},_0x3ec063={};_0x3ec063[_0xdb86('0x2e')]=_[_0xdb86('0x43')](db[_0xdb86('0x2a')]['rawAttributes']);_0x3ec063[_0xdb86('0x2f')]=_[_0xdb86('0x43')](_0x2dd165['query']);_0x3ec063[_0xdb86('0x30')]=_[_0xdb86('0x31')](_0x3ec063[_0xdb86('0x2e')],_0x3ec063[_0xdb86('0x2f')]);_0x5bc4b5[_0xdb86('0x32')]=_[_0xdb86('0x31')](_0x3ec063['model'],qs[_0xdb86('0x33')](_0x2dd165[_0xdb86('0x2f')][_0xdb86('0x33')]));_0x5bc4b5[_0xdb86('0x32')]=_0x5bc4b5[_0xdb86('0x32')][_0xdb86('0x34')]?_0x5bc4b5[_0xdb86('0x32')]:_0x3ec063['model'];if(_0x2dd165[_0xdb86('0x2f')][_0xdb86('0x3e')]){_0x5bc4b5['include']=[{'all':!![]}];}_0x5bc4b5=_['merge']({},_0x5bc4b5,_0x2dd165['options']);return db['VoiceQueuesLog'][_0xdb86('0x44')](_0x5bc4b5)[_0xdb86('0x21')](handleEntityNotFound(_0x55af1f,null))[_0xdb86('0x21')](respondWithResult(_0x55af1f,null))[_0xdb86('0x41')](handleError(_0x55af1f,null));};exports['create']=function(_0x1ba6dc,_0x155f62){return db[_0xdb86('0x2a')][_0xdb86('0x45')](_0x1ba6dc[_0xdb86('0x46')],{})[_0xdb86('0x21')](respondWithResult(_0x155f62,0xc9))[_0xdb86('0x41')](handleError(_0x155f62,null));};exports['update']=function(_0x58216b,_0x10eee7){if(_0x58216b[_0xdb86('0x46')]['id']){delete _0x58216b[_0xdb86('0x46')]['id'];}return db['VoiceQueuesLog'][_0xdb86('0x44')]({'where':{'id':_0x58216b[_0xdb86('0x47')]['id']}})[_0xdb86('0x21')](handleEntityNotFound(_0x10eee7,null))['then'](saveUpdates(_0x58216b['body'],null))['then'](respondWithResult(_0x10eee7,null))['catch'](handleError(_0x10eee7,null));};exports['destroy']=function(_0x8d97a3,_0x2119be){return db[_0xdb86('0x2a')]['find']({'where':{'id':_0x8d97a3[_0xdb86('0x47')]['id']}})[_0xdb86('0x21')](handleEntityNotFound(_0x2119be,null))[_0xdb86('0x21')](removeEntity(_0x2119be,null))[_0xdb86('0x41')](handleError(_0x2119be,null));}; \ No newline at end of file +var _0xf904=['sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x499608,_0x187e5b){var _0x29eddf=function(_0x47ccfd){while(--_0x47ccfd){_0x499608['push'](_0x499608['shift']());}};_0x29eddf(++_0x187e5b);}(_0xf904,0x16d));var _0x4f90=function(_0x2bae44,_0x33f37a){_0x2bae44=_0x2bae44-0x0;var _0x1e111b=_0xf904[_0x2bae44];return _0x1e111b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f90('0x0'));var zipdir=require(_0x4f90('0x1'));var jsonpatch=require(_0x4f90('0x2'));var rp=require(_0x4f90('0x3'));var moment=require(_0x4f90('0x4'));var BPromise=require(_0x4f90('0x5'));var Mustache=require('mustache');var util=require(_0x4f90('0x6'));var path=require(_0x4f90('0x7'));var sox=require(_0x4f90('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4f90('0x9'));var _=require('lodash');var squel=require(_0x4f90('0xa'));var crypto=require(_0x4f90('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4f90('0xc'));var toCsv=require(_0x4f90('0xd'));var querystring=require(_0x4f90('0xe'));var Papa=require('papaparse');var Redis=require(_0x4f90('0xf'));var authService=require(_0x4f90('0x10'));var qs=require(_0x4f90('0x11'));var as=require(_0x4f90('0x12'));var hardwareService=require(_0x4f90('0x13'));var logger=require(_0x4f90('0x14'))(_0x4f90('0x15'));var utils=require(_0x4f90('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4f90('0x17'));var db=require(_0x4f90('0x18'))['db'];function respondWithStatusCode(_0x274d19,_0x215a25){_0x215a25=_0x215a25||0xcc;return function(_0x57a26e){if(_0x57a26e){return _0x274d19[_0x4f90('0x19')](_0x215a25);}return _0x274d19[_0x4f90('0x1a')](_0x215a25)[_0x4f90('0x1b')]();};}function respondWithResult(_0x5a5cb1,_0x200379){_0x200379=_0x200379||0xc8;return function(_0x26e7dc){if(_0x26e7dc){return _0x5a5cb1[_0x4f90('0x1a')](_0x200379)[_0x4f90('0x1c')](_0x26e7dc);}};}function respondWithFilteredResult(_0x2c660f,_0x4f41f7){return function(_0x5850c9){if(_0x5850c9){var _0x2b3b8d=typeof _0x4f41f7[_0x4f90('0x1d')]===_0x4f90('0x1e')&&typeof _0x4f41f7['limit']==='undefined';var _0x2816d5=_0x5850c9[_0x4f90('0x1f')];var _0x58eb4e=_0x2b3b8d?0x0:_0x4f41f7[_0x4f90('0x1d')];var _0x1d28c5=_0x2b3b8d?_0x5850c9[_0x4f90('0x1f')]:_0x4f41f7[_0x4f90('0x1d')]+_0x4f41f7[_0x4f90('0x20')];var _0x1688ac;if(_0x1d28c5>=_0x2816d5){_0x1d28c5=_0x2816d5;_0x1688ac=0xc8;}else{_0x1688ac=0xce;}_0x2c660f['status'](_0x1688ac);return _0x2c660f[_0x4f90('0x21')]('Content-Range',_0x58eb4e+'-'+_0x1d28c5+'/'+_0x2816d5)[_0x4f90('0x1c')](_0x5850c9);}return null;};}function patchUpdates(_0x4266d1){return function(_0x565f1c){try{jsonpatch[_0x4f90('0x22')](_0x565f1c,_0x4266d1,!![]);}catch(_0x5866dd){return BPromise[_0x4f90('0x23')](_0x5866dd);}return _0x565f1c[_0x4f90('0x24')]();};}function saveUpdates(_0x2b3b46,_0x2d3bd0){return function(_0x11257a){if(_0x11257a){return _0x11257a[_0x4f90('0x25')](_0x2b3b46)['then'](function(_0x3b9fc6){return _0x3b9fc6;});}return null;};}function removeEntity(_0x386e88,_0xdcd839){return function(_0x2df188){if(_0x2df188){return _0x2df188[_0x4f90('0x26')]()[_0x4f90('0x27')](function(){_0x386e88[_0x4f90('0x1a')](0xcc)[_0x4f90('0x1b')]();});}};}function handleEntityNotFound(_0x17bafe,_0x580bb9){return function(_0x33e5d6){if(!_0x33e5d6){_0x17bafe['sendStatus'](0x194);}return _0x33e5d6;};}function handleError(_0x4759a4,_0x2f01bc){_0x2f01bc=_0x2f01bc||0x1f4;return function(_0x14878e){logger[_0x4f90('0x28')](_0x14878e[_0x4f90('0x29')]);if(_0x14878e['name']){delete _0x14878e[_0x4f90('0x2a')];}_0x4759a4[_0x4f90('0x1a')](_0x2f01bc)[_0x4f90('0x2b')](_0x14878e);};}exports[_0x4f90('0x2c')]=function(_0x8d5a49,_0x58bd02){var _0x9620ad={},_0x4588c3={},_0x37518d={'count':0x0,'rows':[]};var _0x2427e4=_[_0x4f90('0x2d')](db[_0x4f90('0x2e')][_0x4f90('0x2f')],function(_0x128fed){return{'name':_0x128fed[_0x4f90('0x30')],'type':_0x128fed[_0x4f90('0x31')][_0x4f90('0x32')]};});_0x4588c3[_0x4f90('0x33')]=_[_0x4f90('0x2d')](_0x2427e4,_0x4f90('0x2a'));_0x4588c3[_0x4f90('0x34')]=_[_0x4f90('0x35')](_0x8d5a49[_0x4f90('0x34')]);_0x4588c3[_0x4f90('0x36')]=_[_0x4f90('0x37')](_0x4588c3[_0x4f90('0x33')],_0x4588c3[_0x4f90('0x34')]);_0x9620ad['attributes']=_['intersection'](_0x4588c3['model'],qs[_0x4f90('0x38')](_0x8d5a49[_0x4f90('0x34')][_0x4f90('0x38')]));_0x9620ad[_0x4f90('0x39')]=_0x9620ad[_0x4f90('0x39')][_0x4f90('0x3a')]?_0x9620ad[_0x4f90('0x39')]:_0x4588c3[_0x4f90('0x33')];if(!_0x8d5a49[_0x4f90('0x34')][_0x4f90('0x3b')](_0x4f90('0x3c'))){_0x9620ad[_0x4f90('0x20')]=qs['limit'](_0x8d5a49[_0x4f90('0x34')][_0x4f90('0x20')]);_0x9620ad['offset']=qs[_0x4f90('0x1d')](_0x8d5a49[_0x4f90('0x34')][_0x4f90('0x1d')]);}_0x9620ad[_0x4f90('0x3d')]=qs[_0x4f90('0x3e')](_0x8d5a49[_0x4f90('0x34')][_0x4f90('0x3e')]);_0x9620ad[_0x4f90('0x3f')]=qs[_0x4f90('0x36')](_[_0x4f90('0x40')](_0x8d5a49[_0x4f90('0x34')],_0x4588c3['filters']),_0x2427e4);if(_0x8d5a49['query']['filter']){_0x9620ad[_0x4f90('0x3f')]=_[_0x4f90('0x41')](_0x9620ad[_0x4f90('0x3f')],{'$or':_[_0x4f90('0x2d')](_0x2427e4,function(_0x49bb6f){if(_0x49bb6f[_0x4f90('0x31')]!=='VIRTUAL'){var _0x322104={};_0x322104[_0x49bb6f[_0x4f90('0x2a')]]={'$like':'%'+_0x8d5a49[_0x4f90('0x34')][_0x4f90('0x42')]+'%'};return _0x322104;}})});}_0x9620ad=_[_0x4f90('0x41')]({},_0x9620ad,_0x8d5a49[_0x4f90('0x43')]);var _0x4ed83f={'where':_0x9620ad[_0x4f90('0x3f')]};return db[_0x4f90('0x2e')]['count'](_0x4ed83f)[_0x4f90('0x27')](function(_0x247274){_0x37518d['count']=_0x247274;if(_0x8d5a49[_0x4f90('0x34')][_0x4f90('0x44')]){_0x9620ad[_0x4f90('0x45')]=[{'all':!![]}];}return db[_0x4f90('0x2e')][_0x4f90('0x46')](_0x9620ad);})['then'](function(_0x14cb0c){_0x37518d[_0x4f90('0x47')]=_0x14cb0c;return _0x37518d;})[_0x4f90('0x27')](respondWithFilteredResult(_0x58bd02,_0x9620ad))[_0x4f90('0x48')](handleError(_0x58bd02,null));};exports[_0x4f90('0x49')]=function(_0x11b083,_0x117759){var _0x555ec1={'raw':!![],'where':{'id':_0x11b083[_0x4f90('0x4a')]['id']}},_0x12aaaa={};_0x12aaaa[_0x4f90('0x33')]=_[_0x4f90('0x35')](db[_0x4f90('0x2e')][_0x4f90('0x2f')]);_0x12aaaa[_0x4f90('0x34')]=_['keys'](_0x11b083[_0x4f90('0x34')]);_0x12aaaa[_0x4f90('0x36')]=_['intersection'](_0x12aaaa[_0x4f90('0x33')],_0x12aaaa[_0x4f90('0x34')]);_0x555ec1[_0x4f90('0x39')]=_[_0x4f90('0x37')](_0x12aaaa[_0x4f90('0x33')],qs[_0x4f90('0x38')](_0x11b083[_0x4f90('0x34')][_0x4f90('0x38')]));_0x555ec1['attributes']=_0x555ec1[_0x4f90('0x39')][_0x4f90('0x3a')]?_0x555ec1[_0x4f90('0x39')]:_0x12aaaa[_0x4f90('0x33')];if(_0x11b083[_0x4f90('0x34')][_0x4f90('0x44')]){_0x555ec1[_0x4f90('0x45')]=[{'all':!![]}];}_0x555ec1=_['merge']({},_0x555ec1,_0x11b083[_0x4f90('0x43')]);return db[_0x4f90('0x2e')][_0x4f90('0x4b')](_0x555ec1)[_0x4f90('0x27')](handleEntityNotFound(_0x117759,null))['then'](respondWithResult(_0x117759,null))[_0x4f90('0x48')](handleError(_0x117759,null));};exports['create']=function(_0x4c4d48,_0x3830e6){return db['VoiceQueuesLog'][_0x4f90('0x4c')](_0x4c4d48['body'],{})[_0x4f90('0x27')](respondWithResult(_0x3830e6,0xc9))[_0x4f90('0x48')](handleError(_0x3830e6,null));};exports[_0x4f90('0x25')]=function(_0x4b13dc,_0x35f838){if(_0x4b13dc['body']['id']){delete _0x4b13dc[_0x4f90('0x4d')]['id'];}return db[_0x4f90('0x2e')][_0x4f90('0x4b')]({'where':{'id':_0x4b13dc[_0x4f90('0x4a')]['id']}})['then'](handleEntityNotFound(_0x35f838,null))[_0x4f90('0x27')](saveUpdates(_0x4b13dc[_0x4f90('0x4d')],null))[_0x4f90('0x27')](respondWithResult(_0x35f838,null))[_0x4f90('0x48')](handleError(_0x35f838,null));};exports[_0x4f90('0x26')]=function(_0x1723a5,_0x4b4b17){return db[_0x4f90('0x2e')][_0x4f90('0x4b')]({'where':{'id':_0x1723a5[_0x4f90('0x4a')]['id']}})[_0x4f90('0x27')](handleEntityNotFound(_0x4b4b17,null))[_0x4f90('0x27')](removeEntity(_0x4b4b17,null))['catch'](handleError(_0x4b4b17,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index e3defd4..06a8a1d 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 _0x8134=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','../../config/logger'];(function(_0x1b4cbf,_0x1984ad){var _0xb225fd=function(_0x35020f){while(--_0x35020f){_0x1b4cbf['push'](_0x1b4cbf['shift']());}};_0xb225fd(++_0x1984ad);}(_0x8134,0xf6));var _0x4813=function(_0x32311a,_0x492faf){_0x32311a=_0x32311a-0x0;var _0x3cb609=_0x8134[_0x32311a];return _0x3cb609;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4813('0x0'))(_0x4813('0x1'));var moment=require(_0x4813('0x2'));var BPromise=require(_0x4813('0x3'));var rp=require(_0x4813('0x4'));var fs=require('fs');var path=require(_0x4813('0x5'));var rimraf=require('rimraf');var config=require(_0x4813('0x6'));var attributes=require('./voiceQueuesLog.attributes');module[_0x4813('0x7')]=function(_0x4d9c31,_0x22499e){return _0x4d9c31[_0x4813('0x8')](_0x4813('0x9'),attributes,{'tableName':_0x4813('0xa'),'paranoid':![],'indexes':[{'name':_0x4813('0xb'),'fields':[_0x4813('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xff98=['util','../../config/logger','api','moment','request-promise','rimraf','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm'];(function(_0x281548,_0x25d717){var _0x2edfa6=function(_0x9c335f){while(--_0x9c335f){_0x281548['push'](_0x281548['shift']());}};_0x2edfa6(++_0x25d717);}(_0xff98,0x9c));var _0x8ff9=function(_0x5abf35,_0x5663dd){_0x5abf35=_0x5abf35-0x0;var _0x14da9d=_0xff98[_0x5abf35];return _0x14da9d;};'use strict';var _=require('lodash');var util=require(_0x8ff9('0x0'));var logger=require(_0x8ff9('0x1'))(_0x8ff9('0x2'));var moment=require(_0x8ff9('0x3'));var BPromise=require('bluebird');var rp=require(_0x8ff9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ff9('0x5'));var config=require('../../config/environment');var attributes=require(_0x8ff9('0x6'));module['exports']=function(_0x7b1d31,_0x2c11a2){return _0x7b1d31[_0x8ff9('0x7')](_0x8ff9('0x8'),attributes,{'tableName':_0x8ff9('0x9'),'paranoid':![],'indexes':[{'name':_0x8ff9('0xa'),'fields':[_0x8ff9('0xb'),_0x8ff9('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 2ddb4b6..4182273 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 _0xb9fc=['then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x2884e5,_0x270700){var _0x97078e=function(_0x1e3bd3){while(--_0x1e3bd3){_0x2884e5['push'](_0x2884e5['shift']());}};_0x97078e(++_0x270700);}(_0xb9fc,0x6e));var _0xcb9f=function(_0x4c1aba,_0x526395){_0x4c1aba=_0x4c1aba-0x0;var _0x4126bc=_0xb9fc[_0x4c1aba];return _0x4126bc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcb9f('0x0'));var BPromise=require(_0xcb9f('0x1'));var rs=require(_0xcb9f('0x2'));var fs=require('fs');var Redis=require(_0xcb9f('0x3'));var db=require(_0xcb9f('0x4'))['db'];var utils=require(_0xcb9f('0x5'));var logger=require(_0xcb9f('0x6'))(_0xcb9f('0x7'));var config=require('../../config/environment');var jayson=require(_0xcb9f('0x8'));var client=jayson['client'][_0xcb9f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3420a3,_0x1f47fd,_0x1513d2){return new BPromise(function(_0x20a28f,_0x1e71e8){return client['request'](_0x3420a3,_0x1513d2)[_0xcb9f('0xa')](function(_0x4e10da){logger[_0xcb9f('0xb')](_0xcb9f('0xc'),_0x1f47fd,_0xcb9f('0xd'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x1f47fd,_0xcb9f('0xd'),JSON[_0xcb9f('0xe')](_0x4e10da));if(_0x4e10da[_0xcb9f('0xf')]){if(_0x4e10da[_0xcb9f('0xf')][_0xcb9f('0x10')]===0x1f4){logger[_0xcb9f('0xf')](_0xcb9f('0xc'),_0x1f47fd,_0x4e10da['error'][_0xcb9f('0x11')]);return _0x1e71e8(_0x4e10da[_0xcb9f('0xf')][_0xcb9f('0x11')]);}logger['error'](_0xcb9f('0xc'),_0x1f47fd,_0x4e10da['error']['message']);return _0x20a28f(_0x4e10da[_0xcb9f('0xf')][_0xcb9f('0x11')]);}else{logger[_0xcb9f('0xb')](_0xcb9f('0xc'),_0x1f47fd,_0xcb9f('0xd'));_0x20a28f(_0x4e10da[_0xcb9f('0x12')][_0xcb9f('0x11')]);}})[_0xcb9f('0x13')](function(_0x3ceaf5){logger[_0xcb9f('0xf')](_0xcb9f('0xc'),_0x1f47fd,_0x3ceaf5);_0x1e71e8(_0x3ceaf5);});});} \ No newline at end of file +var _0x8911=['VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x493efe,_0x3a60ba){var _0x554a59=function(_0x2b5c9c){while(--_0x2b5c9c){_0x493efe['push'](_0x493efe['shift']());}};_0x554a59(++_0x3a60ba);}(_0x8911,0xf1));var _0x1891=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8911[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1891('0x0'));var util=require(_0x1891('0x1'));var moment=require(_0x1891('0x2'));var BPromise=require('bluebird');var rs=require(_0x1891('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1891('0x4'))(_0x1891('0x5'));var config=require(_0x1891('0x6'));var jayson=require(_0x1891('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4f8626,_0x4fb9ce,_0x19a91b){return new BPromise(function(_0x5f52c7,_0x4199f5){return client[_0x1891('0x8')](_0x4f8626,_0x19a91b)[_0x1891('0x9')](function(_0x2727f9){logger[_0x1891('0xa')](_0x1891('0xb'),_0x4fb9ce,_0x1891('0xc'));logger[_0x1891('0xd')](_0x1891('0xe'),_0x4fb9ce,_0x1891('0xc'),JSON['stringify'](_0x2727f9));if(_0x2727f9[_0x1891('0xf')]){if(_0x2727f9['error'][_0x1891('0x10')]===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x4fb9ce,_0x2727f9[_0x1891('0xf')]['message']);return _0x4199f5(_0x2727f9[_0x1891('0xf')]['message']);}logger['error'](_0x1891('0xb'),_0x4fb9ce,_0x2727f9[_0x1891('0xf')][_0x1891('0x11')]);return _0x5f52c7(_0x2727f9[_0x1891('0xf')][_0x1891('0x11')]);}else{logger[_0x1891('0xa')](_0x1891('0xb'),_0x4fb9ce,_0x1891('0xc'));_0x5f52c7(_0x2727f9['result'][_0x1891('0x11')]);}})['catch'](function(_0x62a550){logger[_0x1891('0xf')](_0x1891('0xb'),_0x4fb9ce,_0x62a550);_0x4199f5(_0x62a550);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index d51b8db..023ceed 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 _0xaec3=['../../components/auth/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id/download','/:id/downloads','downloads','/:id/transcribe','post','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x4bdab6,_0xe86f11){var _0x5e1c1a=function(_0x5dedbd){while(--_0x5dedbd){_0x4bdab6['push'](_0x4bdab6['shift']());}};_0x5e1c1a(++_0xe86f11);}(_0xaec3,0xba));var _0x3aec=function(_0x42700a,_0x3fa82f){_0x42700a=_0x42700a-0x0;var _0x12bc09=_0xaec3[_0x42700a];return _0x12bc09;};'use strict';var multer=require(_0x3aec('0x0'));var util=require('util');var path=require(_0x3aec('0x1'));var timeout=require(_0x3aec('0x2'));var express=require(_0x3aec('0x3'));var router=express[_0x3aec('0x4')]();var fs_extra=require(_0x3aec('0x5'));var auth=require(_0x3aec('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3aec('0x7'));router[_0x3aec('0x8')]('/',auth[_0x3aec('0x9')](),controller[_0x3aec('0xa')]);router['get'](_0x3aec('0xb'),auth[_0x3aec('0x9')](),controller[_0x3aec('0xc')]);router['get']('/:id',auth[_0x3aec('0x9')](),controller['show']);router['get'](_0x3aec('0xd'),auth[_0x3aec('0x9')](),controller['download']);router[_0x3aec('0x8')](_0x3aec('0xe'),controller[_0x3aec('0xf')]);router['get'](_0x3aec('0x10'),auth[_0x3aec('0x9')](),controller['downloadTranscribe']);router[_0x3aec('0x11')]('/',auth[_0x3aec('0x9')](),controller[_0x3aec('0x12')]);router[_0x3aec('0x11')](_0x3aec('0x10'),auth[_0x3aec('0x9')](),controller['runTranscribe']);router['put'](_0x3aec('0x13'),auth[_0x3aec('0x9')](),controller[_0x3aec('0x14')]);router[_0x3aec('0x15')]('/:id',auth[_0x3aec('0x9')](),controller[_0x3aec('0x16')]);module[_0x3aec('0x17')]=router; \ No newline at end of file +var _0xf8e6=['download','/:id/transcribe','downloadTranscribe','post','create','put','/:id','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','isAuthenticated','get','/describe','describe','show','/:id/download'];(function(_0x7eb499,_0x29d8e8){var _0x5cda47=function(_0x140092){while(--_0x140092){_0x7eb499['push'](_0x7eb499['shift']());}};_0x5cda47(++_0x29d8e8);}(_0xf8e6,0xb1));var _0x6f8e=function(_0x42aaac,_0x18be59){_0x42aaac=_0x42aaac-0x0;var _0x1c2230=_0xf8e6[_0x42aaac];return _0x1c2230;};'use strict';var multer=require('multer');var util=require(_0x6f8e('0x0'));var path=require(_0x6f8e('0x1'));var timeout=require(_0x6f8e('0x2'));var express=require(_0x6f8e('0x3'));var router=express[_0x6f8e('0x4')]();var fs_extra=require(_0x6f8e('0x5'));var auth=require(_0x6f8e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6f8e('0x7'));var controller=require(_0x6f8e('0x8'));router['get']('/',auth[_0x6f8e('0x9')](),controller['index']);router[_0x6f8e('0xa')](_0x6f8e('0xb'),auth[_0x6f8e('0x9')](),controller[_0x6f8e('0xc')]);router['get']('/:id',auth[_0x6f8e('0x9')](),controller[_0x6f8e('0xd')]);router[_0x6f8e('0xa')](_0x6f8e('0xe'),auth[_0x6f8e('0x9')](),controller[_0x6f8e('0xf')]);router['get']('/:id/downloads',controller['downloads']);router[_0x6f8e('0xa')](_0x6f8e('0x10'),auth[_0x6f8e('0x9')](),controller[_0x6f8e('0x11')]);router[_0x6f8e('0x12')]('/',auth[_0x6f8e('0x9')](),controller[_0x6f8e('0x13')]);router[_0x6f8e('0x12')](_0x6f8e('0x10'),auth[_0x6f8e('0x9')](),controller['runTranscribe']);router[_0x6f8e('0x14')](_0x6f8e('0x15'),auth[_0x6f8e('0x9')](),controller[_0x6f8e('0x16')]);router['delete']('/:id',auth[_0x6f8e('0x9')](),controller[_0x6f8e('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 4be44d7..6d35035 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(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 1101723..7f226ff 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 _0x965f=['request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','format','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceRecording','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','token','$and','push','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','runSentiment','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch'];(function(_0x5f1974,_0x42d53c){var _0x121355=function(_0xf27715){while(--_0xf27715){_0x5f1974['push'](_0x5f1974['shift']());}};_0x121355(++_0x42d53c);}(_0x965f,0x93));var _0xf965=function(_0x1bb441,_0xe2195a){_0x1bb441=_0x1bb441-0x0;var _0x1a5f20=_0x965f[_0x1bb441];return _0x1a5f20;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf965('0x0'));var zipdir=require(_0xf965('0x1'));var jsonpatch=require(_0xf965('0x2'));var rp=require(_0xf965('0x3'));var moment=require(_0xf965('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf965('0x5'));var util=require('util');var path=require(_0xf965('0x6'));var sox=require(_0xf965('0x7'));var csv=require(_0xf965('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf965('0x9'));var _=require(_0xf965('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf965('0xb'));var Papa=require(_0xf965('0xc'));var AWS=require(_0xf965('0xd'));var uuidv4=require('uuid/v4');var Redis=require(_0xf965('0xe'));var authService=require(_0xf965('0xf'));var qs=require(_0xf965('0x10'));var as=require(_0xf965('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf965('0x12'))(_0xf965('0x13'));var utils=require(_0xf965('0x14'));var config=require(_0xf965('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf965('0x16'))['db'];function respondWithStatusCode(_0x1c40bc,_0x1ab86f){_0x1ab86f=_0x1ab86f||0xcc;return function(_0x3052a6){if(_0x3052a6){return _0x1c40bc[_0xf965('0x17')](_0x1ab86f);}return _0x1c40bc[_0xf965('0x18')](_0x1ab86f)[_0xf965('0x19')]();};}function respondWithResult(_0x14e3b6,_0x8868ea){_0x8868ea=_0x8868ea||0xc8;return function(_0x12141d){if(_0x12141d){return _0x14e3b6['status'](_0x8868ea)[_0xf965('0x1a')](_0x12141d);}};}function respondWithFilteredResult(_0x291af8,_0x351f1f){return function(_0x4d2125){if(_0x4d2125){var _0x39c8d2=typeof _0x351f1f[_0xf965('0x1b')]===_0xf965('0x1c')&&typeof _0x351f1f['limit']===_0xf965('0x1c');var _0xa4ae32=_0x4d2125[_0xf965('0x1d')];var _0x3c9fd6=_0x39c8d2?0x0:_0x351f1f[_0xf965('0x1b')];var _0x3adf84=_0x39c8d2?_0x4d2125[_0xf965('0x1d')]:_0x351f1f[_0xf965('0x1b')]+_0x351f1f[_0xf965('0x1e')];var _0x410d87;if(_0x3adf84>=_0xa4ae32){_0x3adf84=_0xa4ae32;_0x410d87=0xc8;}else{_0x410d87=0xce;}_0x291af8[_0xf965('0x18')](_0x410d87);return _0x291af8[_0xf965('0x1f')](_0xf965('0x20'),_0x3c9fd6+'-'+_0x3adf84+'/'+_0xa4ae32)[_0xf965('0x1a')](_0x4d2125);}return null;};}function patchUpdates(_0x4aa53b){return function(_0x76c01a){try{jsonpatch[_0xf965('0x21')](_0x76c01a,_0x4aa53b,!![]);}catch(_0x11bfda){return BPromise[_0xf965('0x22')](_0x11bfda);}return _0x76c01a[_0xf965('0x23')]();};}function saveUpdates(_0x282ac5,_0x114270){return function(_0x4313d2){if(_0x4313d2){return _0x4313d2[_0xf965('0x24')](_0x282ac5)[_0xf965('0x25')](function(_0x36c81d){return _0x36c81d;});}return null;};}function removeEntity(_0x55750d,_0x196c50){return function(_0x5cec94){if(_0x5cec94){return _0x5cec94[_0xf965('0x26')]()[_0xf965('0x25')](function(){_0x55750d['status'](0xcc)[_0xf965('0x19')]();});}};}function handleEntityNotFound(_0x364196,_0x5365b8){return function(_0x41b6d0){if(!_0x41b6d0){_0x364196[_0xf965('0x17')](0x194);}return _0x41b6d0;};}function handleError(_0x56af6c,_0x1957c3){_0x1957c3=_0x1957c3||0x1f4;return function(_0x1f4230){logger[_0xf965('0x27')](_0x1f4230['stack']);if(_0x1f4230[_0xf965('0x28')]){delete _0x1f4230[_0xf965('0x28')];}_0x56af6c[_0xf965('0x18')](_0x1957c3)[_0xf965('0x29')](_0x1f4230);};}exports[_0xf965('0x2a')]=function(_0x1e52fe,_0x295e7f){var _0x27c723={},_0x4ccce8={},_0x585369={'count':0x0,'rows':[]};var _0x3c0874=_[_0xf965('0x2b')](db['VoiceRecording'][_0xf965('0x2c')],function(_0xdef73d){return{'name':_0xdef73d[_0xf965('0x2d')],'type':_0xdef73d[_0xf965('0x2e')][_0xf965('0x2f')]};});_0x4ccce8[_0xf965('0x30')]=_[_0xf965('0x31')](_['map'](_0x3c0874,'name'),[_0xf965('0x32')]);_0x4ccce8['query']=_[_0xf965('0x33')](_0x1e52fe[_0xf965('0x34')]);_0x4ccce8[_0xf965('0x35')]=_['intersection'](_0x4ccce8[_0xf965('0x30')],_0x4ccce8['query']);_0x27c723[_0xf965('0x36')]=_[_0xf965('0x37')](_0x4ccce8['model'],qs[_0xf965('0x38')](_0x1e52fe[_0xf965('0x34')][_0xf965('0x38')]));_0x27c723[_0xf965('0x36')]=_0x27c723[_0xf965('0x36')][_0xf965('0x39')]?_0x27c723[_0xf965('0x36')]:_0x4ccce8[_0xf965('0x30')];if(!_0x1e52fe[_0xf965('0x34')]['hasOwnProperty'](_0xf965('0x3a'))){_0x27c723['limit']=qs[_0xf965('0x1e')](_0x1e52fe['query']['limit']);_0x27c723['offset']=qs[_0xf965('0x1b')](_0x1e52fe[_0xf965('0x34')][_0xf965('0x1b')]);}_0x27c723[_0xf965('0x3b')]=qs[_0xf965('0x3c')](_0x1e52fe['query'][_0xf965('0x3c')]);_0x27c723[_0xf965('0x3d')]=qs[_0xf965('0x35')](_[_0xf965('0x3e')](_0x1e52fe['query'],_0x4ccce8[_0xf965('0x35')]),_0x3c0874);if(_0x1e52fe[_0xf965('0x34')]['filter']){_0x27c723[_0xf965('0x3d')]=_[_0xf965('0x3f')](_0x27c723['where'],{'$or':_[_0xf965('0x2b')](_0x3c0874,function(_0x50fa25){if(_0x50fa25[_0xf965('0x2e')]!==_0xf965('0x40')){var _0x287af8={};_0x287af8[_0x50fa25[_0xf965('0x28')]]={'$like':'%'+_0x1e52fe[_0xf965('0x34')][_0xf965('0x41')]+'%'};return _0x287af8;}})});}_0x27c723=_['merge']({},_0x27c723,_0x1e52fe[_0xf965('0x42')]);var _0x3c9d8b={'where':_0x27c723[_0xf965('0x3d')]};return db[_0xf965('0x43')][_0xf965('0x1d')](_0x3c9d8b)[_0xf965('0x25')](function(_0x29ec01){_0x585369[_0xf965('0x1d')]=_0x29ec01;if(_0x1e52fe[_0xf965('0x34')][_0xf965('0x44')]){_0x27c723['include']=[{'all':!![]}];}return db[_0xf965('0x43')][_0xf965('0x45')](_0x27c723);})[_0xf965('0x25')](function(_0x34330f){_0x585369[_0xf965('0x46')]=_0x34330f;return _0x585369;})['then'](respondWithFilteredResult(_0x295e7f,_0x27c723))[_0xf965('0x47')](handleError(_0x295e7f,null));};exports[_0xf965('0x48')]=function(_0x3b81b4,_0x200117){var _0x22ad38={'raw':![],'where':{'id':_0x3b81b4[_0xf965('0x49')]['id']}},_0x1d14b6={};_0x1d14b6['model']=_[_0xf965('0x33')](db[_0xf965('0x43')][_0xf965('0x2c')]);_0x1d14b6[_0xf965('0x34')]=_[_0xf965('0x33')](_0x3b81b4[_0xf965('0x34')]);_0x1d14b6[_0xf965('0x35')]=_[_0xf965('0x37')](_0x1d14b6['model'],_0x1d14b6[_0xf965('0x34')]);_0x22ad38[_0xf965('0x36')]=_[_0xf965('0x37')](_0x1d14b6[_0xf965('0x30')],qs[_0xf965('0x38')](_0x3b81b4['query'][_0xf965('0x38')]));_0x22ad38['attributes']=_0x22ad38[_0xf965('0x36')][_0xf965('0x39')]?_0x22ad38['attributes']:_0x1d14b6[_0xf965('0x30')];if(_0x3b81b4[_0xf965('0x34')][_0xf965('0x44')]){_0x22ad38[_0xf965('0x4a')]=[{'all':!![]}];}_0x22ad38=_[_0xf965('0x3f')]({},_0x22ad38,_0x3b81b4['options']);return db['VoiceRecording'][_0xf965('0x4b')](_0x22ad38)[_0xf965('0x25')](handleEntityNotFound(_0x200117,null))['then'](respondWithResult(_0x200117,null))[_0xf965('0x47')](handleError(_0x200117,null));};exports[_0xf965('0x4c')]=function(_0x18e8ad,_0x2e6a9e){return db[_0xf965('0x43')][_0xf965('0x4c')](_0x18e8ad[_0xf965('0x4d')],{})['then'](respondWithResult(_0x2e6a9e,0xc9))[_0xf965('0x47')](handleError(_0x2e6a9e,null));};exports[_0xf965('0x24')]=function(_0x3aba87,_0x52bdc8){if(_0x3aba87[_0xf965('0x4d')]['id']){delete _0x3aba87[_0xf965('0x4d')]['id'];}return db[_0xf965('0x43')][_0xf965('0x4b')]({'where':{'id':_0x3aba87[_0xf965('0x49')]['id']}})[_0xf965('0x25')](handleEntityNotFound(_0x52bdc8,null))[_0xf965('0x25')](saveUpdates(_0x3aba87['body'],null))['then'](respondWithResult(_0x52bdc8,null))[_0xf965('0x47')](handleError(_0x52bdc8,null));};exports[_0xf965('0x4e')]=function(_0x1feba9,_0x85466){return db[_0xf965('0x43')]['describe']()['then'](respondWithResult(_0x85466,null))['catch'](handleError(_0x85466,null));};exports[_0xf965('0x4f')]=function(_0x39fc86,_0x32cb4f,_0x3e61aa){var _0x2fd34c=require(_0xf965('0x50'));var _0x11f697=![];var _0x35be20={};if(_0x39fc86[_0xf965('0x34')][_0xf965('0x2e')]&&_0x39fc86[_0xf965('0x34')][_0xf965('0x2e')]==='uniqueid'){_0x35be20[_0xf965('0x51')]=_0x39fc86[_0xf965('0x49')]['id'];}else{_0x35be20['id']=_0x39fc86['params']['id'];}return db[_0xf965('0x43')][_0xf965('0x4b')]({'where':_0x35be20,'attributes':['id',_0xf965('0x52')],'raw':!![]})[_0xf965('0x25')](handleEntityNotFound(_0x32cb4f,null))[_0xf965('0x25')](function(_0x3fc39d){if(_0x3fc39d){var _0x2048a3=_0x3fc39d[_0xf965('0x52')];var _0x3eb1f1=util[_0xf965('0x32')](_0xf965('0x53'),_0x2048a3);if(fs['existsSync'](_0x3eb1f1)){_0x11f697=!![];return _0x2fd34c[_0xf965('0x54')](_0x3eb1f1,_0x2048a3,config[_0xf965('0x55')][_0xf965('0x56')])['then'](function(){return _0x3fc39d;});}return _0x3fc39d;}})[_0xf965('0x25')](function(_0x1dfe22){if(_0x1dfe22){var _0x1ff2b8=_0x1dfe22[_0xf965('0x52')];if(!fs[_0xf965('0x57')](_0x1ff2b8)){throw new db[(_0xf965('0x58'))][(_0xf965('0x59'))](_0xf965('0x5a'));}if(_0x1dfe22[_0xf965('0x5b')]){return _0x32cb4f[_0xf965('0x4f')](_0x1ff2b8,_0x1dfe22[_0xf965('0x5b')]+path[_0xf965('0x5c')](_0x1ff2b8),function(){if(_0x11f697){fs[_0xf965('0x5d')](_0x1ff2b8);}});}else{return _0x32cb4f[_0xf965('0x4f')](_0x1ff2b8,function(_0x36a46e){if(_0x11f697){fs[_0xf965('0x5d')](_0x1ff2b8);}});}}})[_0xf965('0x47')](function(_0x37d2df){if(_0x37d2df['message']===_0xf965('0x5a')){_0x32cb4f['status'](0x194)[_0xf965('0x29')](_0xf965('0x5e'));}else{return handleError(_0x32cb4f,null);}});};exports[_0xf965('0x5f')]=function(_0x46691a,_0x4a338f,_0x13c68e){var _0x30cf62=require(_0xf965('0x50'));var _0x3d9441=![];var _0x2bdda3={'$and':[db[_0xf965('0x60')][_0xf965('0x3d')](db[_0xf965('0x60')]['fn']('MD5',db['sequelize']['col'](_0xf965('0x51'))),_0x46691a['query'][_0xf965('0x61')])]};if(_0x46691a['query'][_0xf965('0x2e')]&&_0x46691a[_0xf965('0x34')][_0xf965('0x2e')]===_0xf965('0x51')){_0x2bdda3[_0xf965('0x62')][_0xf965('0x63')]({'uniqueid':_0x46691a[_0xf965('0x49')]['id']});}else{_0x2bdda3[_0xf965('0x62')]['push']({'id':_0x46691a[_0xf965('0x49')]['id']});}return db[_0xf965('0x43')][_0xf965('0x4b')]({'where':_0x2bdda3,'attributes':['id','value'],'raw':!![]})[_0xf965('0x25')](handleEntityNotFound(_0x4a338f,null))['then'](function(_0x25eab7){if(_0x25eab7){var _0x3214ce=util[_0xf965('0x32')](_0xf965('0x53'),_0x25eab7[_0xf965('0x52')]);if(fs['existsSync'](_0x3214ce)){_0x3d9441=!![];return _0x30cf62['decryptFile'](_0x3214ce,_0x25eab7[_0xf965('0x52')],config['secrets'][_0xf965('0x56')])['then'](function(){return _0x25eab7;});}return _0x25eab7;}})[_0xf965('0x25')](function(_0x7ee581){if(_0x7ee581){if(!fs[_0xf965('0x57')](_0x7ee581[_0xf965('0x52')])){throw new db['Sequelize'][(_0xf965('0x59'))](_0xf965('0x5a'));}if(_0x7ee581['filename']){return _0x4a338f['download'](_0x7ee581[_0xf965('0x52')],_0x7ee581['filename']+path[_0xf965('0x5c')](_0x7ee581[_0xf965('0x52')]),function(){if(_0x3d9441){fs[_0xf965('0x5d')](_0x7ee581[_0xf965('0x52')]);}});}else{return _0x4a338f[_0xf965('0x4f')](_0x7ee581[_0xf965('0x52')],function(_0x393916){if(_0x3d9441){fs[_0xf965('0x5d')](_0x7ee581[_0xf965('0x52')]);}});}}})['catch'](handleError(_0x4a338f,null));};exports[_0xf965('0x26')]=function(_0x3ca038,_0x4fe083){return db[_0xf965('0x43')][_0xf965('0x4b')]({'where':{'id':_0x3ca038[_0xf965('0x49')]['id']}})[_0xf965('0x25')](function(_0x330f4a){if(_['isNil'](_0x330f4a)){throw new ReferenceError('Entity\x20not\x20found');}return _0x330f4a;})[_0xf965('0x25')](function(_0x3944ad){var _0x4fbb42=_0x3944ad[_0xf965('0x52')];logger[_0xf965('0x64')](_0xf965('0x65'),_0x4fbb42);if(!_[_0xf965('0x66')](_0x3944ad[_0xf965('0x52')])&&fs['existsSync'](_0x4fbb42)){logger[_0xf965('0x64')](_0xf965('0x67')+_0x4fbb42+_0xf965('0x68'));fs[_0xf965('0x69')](_0x4fbb42);}_0x4fbb42=_0x4fbb42+_0xf965('0x6a');if(!_['isNil'](_0x3944ad[_0xf965('0x52')])&&fs[_0xf965('0x57')](_0x4fbb42)){logger[_0xf965('0x64')](_0xf965('0x67')+_0x4fbb42+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x4fbb42);}return _0x3944ad;})[_0xf965('0x25')](function(_0x339108){if(!_0x339108)throw new InternalError();return _0x339108[_0xf965('0x26')]();})[_0xf965('0x25')](function(){_0x4fe083['status'](0xcc)[_0xf965('0x19')]();})[_0xf965('0x47')](handleError(_0x4fe083,null));};function getBucketslist(_0x7c1ef6,_0xdfa405,_0x1c6878){return new Promise(function(_0x521a6b,_0x4a7942){var _0x345ee6=new AWS['S3']({'accessKeyId':_0xdfa405,'secretAccessKey':_0x7c1ef6,'region':_0x1c6878});_0x345ee6[_0xf965('0x6b')]({},function(_0x344d35,_0x47ad38){if(_0x344d35){return _0x4a7942(_0x344d35);}else{return _0x521a6b(_0x47ad38);}});});}function createBucket(_0x477946,_0x72da26,_0x39cadd,_0x4d1e8f){return new Promise(function(_0x357dc2,_0x229c78){var _0x480d0d=new AWS['S3']({'accessKeyId':_0x72da26,'secretAccessKey':_0x477946,'region':_0x39cadd});_0x480d0d[_0xf965('0x6c')]({'Bucket':_0x4d1e8f},function(_0x4f0b10,_0xa5270b){if(_0x4f0b10){return _0x229c78(_0x4f0b10);}else{return _0x357dc2(_0xa5270b);}});});}function uploadFile(_0x5abc0f,_0x4af01f,_0x5ba3dd,_0x413e35,_0x25d019,_0x43cc21){return new Promise(function(_0x2be0fa,_0x1bdc01){var _0x4c8f5c=new AWS['S3']({'accessKeyId':_0x4af01f,'secretAccessKey':_0x5abc0f,'region':_0x5ba3dd});_0x4c8f5c['upload']({'Bucket':_0x413e35,'Key':_0x25d019,'Body':_0x43cc21},function(_0x33fc35,_0x587c79){if(_0x33fc35){return _0x1bdc01(_0x33fc35);}else{return _0x2be0fa(_0x587c79);}});});}function startTranscribe(_0x5a1cf7,_0x28ce5b,_0x2a11b0,_0x145376,_0x532aef,_0x365c6e){return new Promise(function(_0x3be947,_0x28ffda){var _0x3de930=new AWS[(_0xf965('0x6d'))]({'accessKeyId':_0x28ce5b,'secretAccessKey':_0x5a1cf7,'region':_0x2a11b0});_0x3de930['startTranscriptionJob']({'TranscriptionJobName':_0x145376,'LanguageCode':_0x532aef,'Media':{'MediaFileUri':_0x365c6e}},function(_0x265ec0,_0x2555f3){if(_0x265ec0){return _0x28ffda(_0x265ec0);}else{return _0x3be947(_0x2555f3);}});});}function transcribe(_0x5548b5,_0x11186a,_0x3ae860,_0x18bf9c,_0x531af2,_0x1f9281,_0x2afcc4){return new Promise(function(_0x16fd85,_0x2fdfb6){var _0x43c838={};logger['info'](util[_0xf965('0x32')](_0xf965('0x6e'),_0x5548b5,_0x531af2));return uploadFile(_0x11186a,_0x3ae860,_0x18bf9c,_0x531af2,path[_0xf965('0x6f')](_0x1f9281),fs[_0xf965('0x70')](_0x1f9281))[_0xf965('0x25')](function(_0xa892b0){logger[_0xf965('0x64')](util[_0xf965('0x32')](_0xf965('0x71'),_0x5548b5,_0x531af2,_0xa892b0['Location']));_0x43c838[_0xf965('0x72')]=_0xa892b0[_0xf965('0x73')];_0x43c838[_0xf965('0x74')]=_0xa892b0[_0xf965('0x75')];logger['info'](util[_0xf965('0x32')](_0xf965('0x76'),_0x5548b5));return startTranscribe(_0x11186a,_0x3ae860,_0x18bf9c,uuidv4(),_0x2afcc4,_0xa892b0['Location']);})[_0xf965('0x25')](function(_0x1d6c6d){logger[_0xf965('0x64')](util[_0xf965('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x5548b5,_0x1d6c6d[_0xf965('0x77')][_0xf965('0x78')]));_0x43c838['transcribeName']=_0x1d6c6d[_0xf965('0x77')][_0xf965('0x78')];_0x43c838[_0xf965('0x79')]=_0x1d6c6d[_0xf965('0x77')][_0xf965('0x7a')];return _0x16fd85(_0x43c838);})[_0xf965('0x47')](function(_0x1100a3){return _0x2fdfb6(_0x1100a3);});});}exports[_0xf965('0x7b')]=function(_0x538bd9,_0x57c131,_0x341be3){var _0x729668;var _0x5557bd;var _0xd9bfdd;var _0x4370b6=require(_0xf965('0x50'));return db[_0xf965('0x43')][_0xf965('0x7c')]({'where':{'id':_0x538bd9[_0xf965('0x49')]['id']}})[_0xf965('0x25')](function(_0x1cd1d3){if(_0x1cd1d3){var _0x4a490c=util[_0xf965('0x32')](_0xf965('0x53'),_0x1cd1d3[_0xf965('0x52')]);if(fs['existsSync'](_0x4a490c)){cypher=!![];return _0x4370b6['decryptFile'](_0x4a490c,_0x1cd1d3['value'],config[_0xf965('0x55')]['recording'])['then'](function(){return _0x1cd1d3;});}return _0x1cd1d3;}})[_0xf965('0x25')](function(_0x9a49a){if(!_0x9a49a){throw new db[(_0xf965('0x58'))][(_0xf965('0x59'))](_0xf965('0x7d'));}_0x5557bd=_0x9a49a;return db[_0xf965('0x7e')][_0xf965('0x7c')]({'where':{'id':0x1}});})[_0xf965('0x25')](handleEntityNotFound(_0x57c131,null))['then'](function(_0x7d8097){if(_0x7d8097){_0x729668=_0x7d8097;if(!_0x729668['transcribe']||!_0x729668[_0xf965('0x7f')]||!_0x729668[_0xf965('0x80')]||!_0x729668[_0xf965('0x81')]||!_0x729668['bucket']){throw new db['Sequelize']['ValidationError']('Transcribe\x20not\x20configured');}if(_0x538bd9[_0xf965('0x4d')][_0xf965('0x82')]&&(!_0x729668['sentiment']||!_0x729668['sentimentAccountId']||!_0x729668['sentimentRegion']||!_0x729668[_0xf965('0x81')]||!_0x729668[_0xf965('0x72')])){throw new db[(_0xf965('0x58'))][(_0xf965('0x59'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xf965('0x83')][_0xf965('0x7c')]({'where':{'id':_0x729668[_0xf965('0x7f')]}});}})[_0xf965('0x25')](function(_0x53b789){if(!_0x53b789){throw new db['Sequelize']['ValidationError'](_0xf965('0x84'));}if(!_0x53b789[_0xf965('0x85')]||!_0x53b789[_0xf965('0x86')]){throw new db[(_0xf965('0x58'))][(_0xf965('0x59'))](_0xf965('0x87'));}_0xd9bfdd=_0x53b789;return getBucketslist(_0xd9bfdd[_0xf965('0x85')],_0xd9bfdd['data2'],_0x729668[_0xf965('0x80')]);})['then'](function(_0xeddd5a){if(_0xeddd5a&&_0xeddd5a['Buckets']){var _0x56a625=_['find'](_0xeddd5a[_0xf965('0x88')],function(_0x4f39fd){return _0x4f39fd[_0xf965('0x89')]===_0x729668[_0xf965('0x72')];});if(!_0x56a625){logger[_0xf965('0x64')](util[_0xf965('0x32')](_0xf965('0x8a'),_0x538bd9[_0xf965('0x49')]['id'],_0x729668[_0xf965('0x72')]));return createBucket(_0xd9bfdd[_0xf965('0x85')],_0xd9bfdd[_0xf965('0x86')],_0x729668[_0xf965('0x80')],_0x729668['bucket']);}logger[_0xf965('0x64')](util[_0xf965('0x32')](_0xf965('0x8b'),_0x538bd9[_0xf965('0x49')]['id'],_0x729668[_0xf965('0x72')]));return;}})[_0xf965('0x25')](function(_0x50c479){if(_0x5557bd[_0xf965('0x79')]===_0xf965('0x8c')){return transcribe(_0x538bd9[_0xf965('0x49')]['id'],_0xd9bfdd[_0xf965('0x85')],_0xd9bfdd[_0xf965('0x86')],_0x729668[_0xf965('0x80')],_0x729668[_0xf965('0x72')],_0x5557bd[_0xf965('0x52')],_0x729668[_0xf965('0x81')]);}else{logger[_0xf965('0x64')](util['format'](_0xf965('0x8d'),_0x538bd9['params']['id']));return{'transcribeStatus':_0xf965('0x8e')};}})['then'](function(_0x2492bf){if(_0x2492bf){_0x2492bf[_0xf965('0x8f')]=_0x538bd9[_0xf965('0x4d')][_0xf965('0x82')];return _0x5557bd[_0xf965('0x90')](_0x2492bf);}})['then'](respondWithResult(_0x57c131,null))[_0xf965('0x47')](handleError(_0x57c131,null));};function writeFile(_0x3a474e,_0xd4fe71){return new Promise(function(_0x2190c3,_0x4fb20c){fs[_0xf965('0x91')](_0xd4fe71,_0x3a474e,function(_0x2fdfd6,_0x5e0dab){if(_0x2fdfd6){return _0x4fb20c(_0x2fdfd6);}else{return _0x2190c3(_0x5e0dab);}});});}exports[_0xf965('0x92')]=function(_0x3bbe9d,_0x23bd1a,_0x3bbd16){return db[_0xf965('0x43')][_0xf965('0x7c')]({'where':{'id':_0x3bbe9d['params']['id']}})[_0xf965('0x25')](handleEntityNotFound(_0x23bd1a))[_0xf965('0x25')](function(_0x4a5c88){if(_0x4a5c88&&_0x4a5c88[_0xf965('0x93')]){var _0x72573b=_0x4a5c88[_0xf965('0x93')];var _0x3c14a7=config[_0xf965('0x94')]+'/server/files/transcribes/transcribe_'+_0x4a5c88['id']+'.txt';if(fs[_0xf965('0x57')](_0x3c14a7)){return _0x3c14a7;}return writeFile(_0x72573b,_0x3c14a7)[_0xf965('0x25')](function(){return _0x3c14a7;});}else{throw new db[(_0xf965('0x58'))][(_0xf965('0x59'))](_0xf965('0x95'));}})[_0xf965('0x25')](function(_0x11976f){return _0x23bd1a['download'](_0x11976f);})[_0xf965('0x47')](handleError(_0x23bd1a));}; \ No newline at end of file +var _0x79ba=['cancellazione\x20fisica\x20documento\x20%s','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','File:\x20\x22','unlinkSync','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','Location','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Setting','findOne','transcribe','transcribeAccountId','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','key','model','differenceBy','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','VoiceRecording','includeAll','findAll','rows','catch','show','params','body','describe','type','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','filename','download','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','token','$and','push','find','isNil','Entity\x20not\x20found'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x79ba,0xc5));var _0xa79b=function(_0x2a4d83,_0x2f548c){_0x2a4d83=_0x2a4d83-0x0;var _0x1f223d=_0x79ba[_0x2a4d83];return _0x1f223d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa79b('0x0'));var zipdir=require(_0xa79b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa79b('0x2'));var moment=require(_0xa79b('0x3'));var BPromise=require(_0xa79b('0x4'));var Mustache=require(_0xa79b('0x5'));var util=require(_0xa79b('0x6'));var path=require('path');var sox=require(_0xa79b('0x7'));var csv=require('to-csv');var ejs=require(_0xa79b('0x8'));var fs=require('fs');var fs_extra=require(_0xa79b('0x9'));var _=require(_0xa79b('0xa'));var squel=require(_0xa79b('0xb'));var crypto=require(_0xa79b('0xc'));var jsforce=require(_0xa79b('0xd'));var deskjs=require(_0xa79b('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa79b('0xf'));var AWS=require(_0xa79b('0x10'));var uuidv4=require(_0xa79b('0x11'));var Redis=require(_0xa79b('0x12'));var authService=require(_0xa79b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa79b('0x14'));var hardwareService=require(_0xa79b('0x15'));var logger=require('../../config/logger')(_0xa79b('0x16'));var utils=require('../../config/utils');var config=require(_0xa79b('0x17'));var licenseUtil=require(_0xa79b('0x18'));var db=require(_0xa79b('0x19'))['db'];function respondWithStatusCode(_0x2c64f7,_0x1b7714){_0x1b7714=_0x1b7714||0xcc;return function(_0x406c87){if(_0x406c87){return _0x2c64f7[_0xa79b('0x1a')](_0x1b7714);}return _0x2c64f7['status'](_0x1b7714)['end']();};}function respondWithResult(_0x25296b,_0x42674b){_0x42674b=_0x42674b||0xc8;return function(_0x23652b){if(_0x23652b){return _0x25296b['status'](_0x42674b)[_0xa79b('0x1b')](_0x23652b);}};}function respondWithFilteredResult(_0x1fbad4,_0xbe2e34){return function(_0x4cc67b){if(_0x4cc67b){var _0x35d51a=typeof _0xbe2e34[_0xa79b('0x1c')]===_0xa79b('0x1d')&&typeof _0xbe2e34[_0xa79b('0x1e')]===_0xa79b('0x1d');var _0x28f152=_0x4cc67b[_0xa79b('0x1f')];var _0x5813e8=_0x35d51a?0x0:_0xbe2e34[_0xa79b('0x1c')];var _0x466f16=_0x35d51a?_0x4cc67b['count']:_0xbe2e34['offset']+_0xbe2e34['limit'];var _0x2ada40;if(_0x466f16>=_0x28f152){_0x466f16=_0x28f152;_0x2ada40=0xc8;}else{_0x2ada40=0xce;}_0x1fbad4[_0xa79b('0x20')](_0x2ada40);return _0x1fbad4['set'](_0xa79b('0x21'),_0x5813e8+'-'+_0x466f16+'/'+_0x28f152)[_0xa79b('0x1b')](_0x4cc67b);}return null;};}function patchUpdates(_0x2381cd){return function(_0x592a43){try{jsonpatch['apply'](_0x592a43,_0x2381cd,!![]);}catch(_0x11a3b8){return BPromise[_0xa79b('0x22')](_0x11a3b8);}return _0x592a43['save']();};}function saveUpdates(_0x5b3658,_0x3d0485){return function(_0x1f4486){if(_0x1f4486){return _0x1f4486[_0xa79b('0x23')](_0x5b3658)[_0xa79b('0x24')](function(_0x15ba7a){return _0x15ba7a;});}return null;};}function removeEntity(_0x52045f,_0x504116){return function(_0x30218a){if(_0x30218a){return _0x30218a[_0xa79b('0x25')]()['then'](function(){_0x52045f[_0xa79b('0x20')](0xcc)[_0xa79b('0x26')]();});}};}function handleEntityNotFound(_0x45ea79,_0x35e651){return function(_0x2d7740){if(!_0x2d7740){_0x45ea79['sendStatus'](0x194);}return _0x2d7740;};}function handleError(_0x39a997,_0x215d0f){_0x215d0f=_0x215d0f||0x1f4;return function(_0x2a667f){logger[_0xa79b('0x27')](_0x2a667f[_0xa79b('0x28')]);if(_0x2a667f[_0xa79b('0x29')]){delete _0x2a667f[_0xa79b('0x29')];}_0x39a997[_0xa79b('0x20')](_0x215d0f)[_0xa79b('0x2a')](_0x2a667f);};}exports[_0xa79b('0x2b')]=function(_0x165829,_0x1e0190){var _0x14e951={},_0x2f578a={},_0x451826={'count':0x0,'rows':[]};var _0xcfa06e=_[_0xa79b('0x2c')](db['VoiceRecording'][_0xa79b('0x2d')],function(_0x258130){return{'name':_0x258130['fieldName'],'type':_0x258130['type'][_0xa79b('0x2e')]};});_0x2f578a[_0xa79b('0x2f')]=_[_0xa79b('0x30')](_[_0xa79b('0x2c')](_0xcfa06e,'name'),[_0xa79b('0x31')]);_0x2f578a['query']=_[_0xa79b('0x32')](_0x165829[_0xa79b('0x33')]);_0x2f578a[_0xa79b('0x34')]=_[_0xa79b('0x35')](_0x2f578a['model'],_0x2f578a[_0xa79b('0x33')]);_0x14e951[_0xa79b('0x36')]=_[_0xa79b('0x35')](_0x2f578a['model'],qs[_0xa79b('0x37')](_0x165829['query'][_0xa79b('0x37')]));_0x14e951[_0xa79b('0x36')]=_0x14e951[_0xa79b('0x36')][_0xa79b('0x38')]?_0x14e951['attributes']:_0x2f578a['model'];if(!_0x165829['query'][_0xa79b('0x39')](_0xa79b('0x3a'))){_0x14e951[_0xa79b('0x1e')]=qs[_0xa79b('0x1e')](_0x165829['query'][_0xa79b('0x1e')]);_0x14e951['offset']=qs[_0xa79b('0x1c')](_0x165829['query'][_0xa79b('0x1c')]);}_0x14e951[_0xa79b('0x3b')]=qs[_0xa79b('0x3c')](_0x165829['query']['sort']);_0x14e951[_0xa79b('0x3d')]=qs[_0xa79b('0x34')](_[_0xa79b('0x3e')](_0x165829[_0xa79b('0x33')],_0x2f578a['filters']),_0xcfa06e);if(_0x165829[_0xa79b('0x33')][_0xa79b('0x3f')]){_0x14e951[_0xa79b('0x3d')]=_['merge'](_0x14e951[_0xa79b('0x3d')],{'$or':_[_0xa79b('0x2c')](_0xcfa06e,function(_0x56df89){if(_0x56df89['type']!==_0xa79b('0x40')){var _0x13e745={};_0x13e745[_0x56df89[_0xa79b('0x29')]]={'$like':'%'+_0x165829[_0xa79b('0x33')][_0xa79b('0x3f')]+'%'};return _0x13e745;}})});}_0x14e951=_[_0xa79b('0x41')]({},_0x14e951,_0x165829[_0xa79b('0x42')]);var _0x1d05d6={'where':_0x14e951['where']};return db[_0xa79b('0x43')][_0xa79b('0x1f')](_0x1d05d6)[_0xa79b('0x24')](function(_0x1c6265){_0x451826[_0xa79b('0x1f')]=_0x1c6265;if(_0x165829[_0xa79b('0x33')][_0xa79b('0x44')]){_0x14e951['include']=[{'all':!![]}];}return db[_0xa79b('0x43')][_0xa79b('0x45')](_0x14e951);})[_0xa79b('0x24')](function(_0xce41e1){_0x451826[_0xa79b('0x46')]=_0xce41e1;return _0x451826;})[_0xa79b('0x24')](respondWithFilteredResult(_0x1e0190,_0x14e951))[_0xa79b('0x47')](handleError(_0x1e0190,null));};exports[_0xa79b('0x48')]=function(_0x3de786,_0x1d2da4){var _0x1191fd={'raw':![],'where':{'id':_0x3de786[_0xa79b('0x49')]['id']}},_0x5f4def={};_0x5f4def['model']=_['keys'](db[_0xa79b('0x43')][_0xa79b('0x2d')]);_0x5f4def[_0xa79b('0x33')]=_[_0xa79b('0x32')](_0x3de786[_0xa79b('0x33')]);_0x5f4def[_0xa79b('0x34')]=_[_0xa79b('0x35')](_0x5f4def[_0xa79b('0x2f')],_0x5f4def[_0xa79b('0x33')]);_0x1191fd['attributes']=_[_0xa79b('0x35')](_0x5f4def[_0xa79b('0x2f')],qs[_0xa79b('0x37')](_0x3de786['query']['fields']));_0x1191fd['attributes']=_0x1191fd[_0xa79b('0x36')][_0xa79b('0x38')]?_0x1191fd[_0xa79b('0x36')]:_0x5f4def[_0xa79b('0x2f')];if(_0x3de786[_0xa79b('0x33')][_0xa79b('0x44')]){_0x1191fd['include']=[{'all':!![]}];}_0x1191fd=_['merge']({},_0x1191fd,_0x3de786['options']);return db[_0xa79b('0x43')]['find'](_0x1191fd)[_0xa79b('0x24')](handleEntityNotFound(_0x1d2da4,null))[_0xa79b('0x24')](respondWithResult(_0x1d2da4,null))[_0xa79b('0x47')](handleError(_0x1d2da4,null));};exports['create']=function(_0xe0a182,_0x497d30){return db[_0xa79b('0x43')]['create'](_0xe0a182[_0xa79b('0x4a')],{})[_0xa79b('0x24')](respondWithResult(_0x497d30,0xc9))[_0xa79b('0x47')](handleError(_0x497d30,null));};exports[_0xa79b('0x23')]=function(_0x40a701,_0x249205){if(_0x40a701[_0xa79b('0x4a')]['id']){delete _0x40a701[_0xa79b('0x4a')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x40a701[_0xa79b('0x49')]['id']}})[_0xa79b('0x24')](handleEntityNotFound(_0x249205,null))[_0xa79b('0x24')](saveUpdates(_0x40a701[_0xa79b('0x4a')],null))[_0xa79b('0x24')](respondWithResult(_0x249205,null))[_0xa79b('0x47')](handleError(_0x249205,null));};exports[_0xa79b('0x4b')]=function(_0xfd87f8,_0x413b18){return db[_0xa79b('0x43')][_0xa79b('0x4b')]()[_0xa79b('0x24')](respondWithResult(_0x413b18,null))['catch'](handleError(_0x413b18,null));};exports['download']=function(_0x140e18,_0x3811fb,_0x4e93fc){var _0x333afe=require('../../components/encryptor');var _0xf0b6be=![];var _0x30687d={};if(_0x140e18[_0xa79b('0x33')][_0xa79b('0x4c')]&&_0x140e18[_0xa79b('0x33')]['type']===_0xa79b('0x4d')){_0x30687d[_0xa79b('0x4d')]=_0x140e18[_0xa79b('0x49')]['id'];}else{_0x30687d['id']=_0x140e18[_0xa79b('0x49')]['id'];}return db[_0xa79b('0x43')]['find']({'where':_0x30687d,'attributes':['id','value'],'raw':!![]})[_0xa79b('0x24')](handleEntityNotFound(_0x3811fb,null))[_0xa79b('0x24')](function(_0xb72305){if(_0xb72305){var _0x4c3d3a=_0xb72305[_0xa79b('0x4e')];var _0x324392=util[_0xa79b('0x31')](_0xa79b('0x4f'),_0x4c3d3a);if(fs['existsSync'](_0x324392)){_0xf0b6be=!![];return _0x333afe[_0xa79b('0x50')](_0x324392,_0x4c3d3a,config[_0xa79b('0x51')][_0xa79b('0x52')])[_0xa79b('0x24')](function(){return _0xb72305;});}return _0xb72305;}})[_0xa79b('0x24')](function(_0x4c0204){if(_0x4c0204){var _0x394c39=_0x4c0204['value'];if(!fs[_0xa79b('0x53')](_0x394c39)){throw new db[(_0xa79b('0x54'))][(_0xa79b('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x4c0204[_0xa79b('0x56')]){return _0x3811fb[_0xa79b('0x57')](_0x394c39,_0x4c0204[_0xa79b('0x56')]+path[_0xa79b('0x58')](_0x394c39),function(){if(_0xf0b6be){fs[_0xa79b('0x59')](_0x394c39);}});}else{return _0x3811fb[_0xa79b('0x57')](_0x394c39,function(_0x1ccff1){if(_0xf0b6be){fs[_0xa79b('0x59')](_0x394c39);}});}}})[_0xa79b('0x47')](function(_0x1b388e){if(_0x1b388e[_0xa79b('0x5a')]===_0xa79b('0x5b')){_0x3811fb['status'](0x194)[_0xa79b('0x2a')](_0xa79b('0x5c'));}else{return handleError(_0x3811fb,null);}});};exports[_0xa79b('0x5d')]=function(_0x5acbbf,_0x7d86c0,_0x4ae420){var _0x36d294=require(_0xa79b('0x5e'));var _0x55b6ae=![];var _0x39bc7d={'$and':[db[_0xa79b('0x5f')]['where'](db[_0xa79b('0x5f')]['fn'](_0xa79b('0x60'),db[_0xa79b('0x5f')]['col'](_0xa79b('0x4d'))),_0x5acbbf[_0xa79b('0x33')][_0xa79b('0x61')])]};if(_0x5acbbf[_0xa79b('0x33')][_0xa79b('0x4c')]&&_0x5acbbf[_0xa79b('0x33')][_0xa79b('0x4c')]===_0xa79b('0x4d')){_0x39bc7d[_0xa79b('0x62')][_0xa79b('0x63')]({'uniqueid':_0x5acbbf['params']['id']});}else{_0x39bc7d[_0xa79b('0x62')][_0xa79b('0x63')]({'id':_0x5acbbf[_0xa79b('0x49')]['id']});}return db[_0xa79b('0x43')][_0xa79b('0x64')]({'where':_0x39bc7d,'attributes':['id',_0xa79b('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x7d86c0,null))[_0xa79b('0x24')](function(_0x1836e3){if(_0x1836e3){var _0x2b540c=util[_0xa79b('0x31')](_0xa79b('0x4f'),_0x1836e3[_0xa79b('0x4e')]);if(fs['existsSync'](_0x2b540c)){_0x55b6ae=!![];return _0x36d294['decryptFile'](_0x2b540c,_0x1836e3[_0xa79b('0x4e')],config['secrets'][_0xa79b('0x52')])['then'](function(){return _0x1836e3;});}return _0x1836e3;}})[_0xa79b('0x24')](function(_0xe572e9){if(_0xe572e9){if(!fs['existsSync'](_0xe572e9['value'])){throw new db[(_0xa79b('0x54'))][(_0xa79b('0x55'))](_0xa79b('0x5b'));}if(_0xe572e9[_0xa79b('0x56')]){return _0x7d86c0[_0xa79b('0x57')](_0xe572e9['value'],_0xe572e9[_0xa79b('0x56')]+path['extname'](_0xe572e9[_0xa79b('0x4e')]),function(){if(_0x55b6ae){fs[_0xa79b('0x59')](_0xe572e9[_0xa79b('0x4e')]);}});}else{return _0x7d86c0[_0xa79b('0x57')](_0xe572e9[_0xa79b('0x4e')],function(_0x4d3fa3){if(_0x55b6ae){fs[_0xa79b('0x59')](_0xe572e9[_0xa79b('0x4e')]);}});}}})[_0xa79b('0x47')](handleError(_0x7d86c0,null));};exports[_0xa79b('0x25')]=function(_0x16436d,_0x3c79c8){return db[_0xa79b('0x43')][_0xa79b('0x64')]({'where':{'id':_0x16436d[_0xa79b('0x49')]['id']}})['then'](function(_0x23bc32){if(_[_0xa79b('0x65')](_0x23bc32)){throw new ReferenceError(_0xa79b('0x66'));}return _0x23bc32;})[_0xa79b('0x24')](function(_0x2ab05b){var _0xd17e31=_0x2ab05b[_0xa79b('0x4e')];logger['info'](_0xa79b('0x67'),_0xd17e31);if(!_[_0xa79b('0x65')](_0x2ab05b[_0xa79b('0x4e')])&&fs['existsSync'](_0xd17e31)){logger[_0xa79b('0x68')]('File:\x20\x22'+_0xd17e31+_0xa79b('0x69'));fs['unlinkSync'](_0xd17e31);}_0xd17e31=_0xd17e31+_0xa79b('0x6a');if(!_[_0xa79b('0x65')](_0x2ab05b['value'])&&fs[_0xa79b('0x53')](_0xd17e31)){logger['info'](_0xa79b('0x6b')+_0xd17e31+_0xa79b('0x69'));fs[_0xa79b('0x6c')](_0xd17e31);}return _0x2ab05b;})[_0xa79b('0x24')](function(_0x5b3d75){if(!_0x5b3d75)throw new InternalError();return _0x5b3d75[_0xa79b('0x25')]();})['then'](function(){_0x3c79c8[_0xa79b('0x20')](0xcc)[_0xa79b('0x26')]();})[_0xa79b('0x47')](handleError(_0x3c79c8,null));};function getBucketslist(_0x1a1023,_0x3af08f,_0x83db7c){return new Promise(function(_0x2709ae,_0x2a604f){var _0xe48728=new AWS['S3']({'accessKeyId':_0x3af08f,'secretAccessKey':_0x1a1023,'region':_0x83db7c});_0xe48728[_0xa79b('0x6d')]({},function(_0x26c8a1,_0x471d52){if(_0x26c8a1){return _0x2a604f(_0x26c8a1);}else{return _0x2709ae(_0x471d52);}});});}function createBucket(_0x218bcf,_0x45d575,_0x51452b,_0x427bbe){return new Promise(function(_0x5492d9,_0x158805){var _0x107106=new AWS['S3']({'accessKeyId':_0x45d575,'secretAccessKey':_0x218bcf,'region':_0x51452b});_0x107106['createBucket']({'Bucket':_0x427bbe},function(_0x11ddc7,_0x1f285c){if(_0x11ddc7){return _0x158805(_0x11ddc7);}else{return _0x5492d9(_0x1f285c);}});});}function uploadFile(_0x1083c1,_0x4b5a97,_0xce451a,_0x14fdfe,_0x5eb1c7,_0x3a1258){return new Promise(function(_0x23d7a4,_0x28d4c5){var _0x5b798f=new AWS['S3']({'accessKeyId':_0x4b5a97,'secretAccessKey':_0x1083c1,'region':_0xce451a});_0x5b798f[_0xa79b('0x6e')]({'Bucket':_0x14fdfe,'Key':_0x5eb1c7,'Body':_0x3a1258},function(_0x12a688,_0x45e6af){if(_0x12a688){return _0x28d4c5(_0x12a688);}else{return _0x23d7a4(_0x45e6af);}});});}function startTranscribe(_0x4bf664,_0x43a99e,_0x5e9b78,_0x13dc88,_0x3797fc,_0x5e658c){return new Promise(function(_0x562b98,_0x37bd85){var _0x51038f=new AWS[(_0xa79b('0x6f'))]({'accessKeyId':_0x43a99e,'secretAccessKey':_0x4bf664,'region':_0x5e9b78});_0x51038f[_0xa79b('0x70')]({'TranscriptionJobName':_0x13dc88,'LanguageCode':_0x3797fc,'Media':{'MediaFileUri':_0x5e658c}},function(_0x1deb37,_0x22da86){if(_0x1deb37){return _0x37bd85(_0x1deb37);}else{return _0x562b98(_0x22da86);}});});}function transcribe(_0x1803c7,_0x3e566f,_0x5ac8b7,_0x327aa9,_0x57d539,_0x3f8a8b,_0x2cee96){return new Promise(function(_0x107612,_0x5ba657){var _0x314013={};logger['info'](util[_0xa79b('0x31')](_0xa79b('0x71'),_0x1803c7,_0x57d539));return uploadFile(_0x3e566f,_0x5ac8b7,_0x327aa9,_0x57d539,path['basename'](_0x3f8a8b),fs['readFileSync'](_0x3f8a8b))[_0xa79b('0x24')](function(_0x41d088){logger['info'](util[_0xa79b('0x31')](_0xa79b('0x72'),_0x1803c7,_0x57d539,_0x41d088['Location']));_0x314013[_0xa79b('0x73')]=_0x41d088[_0xa79b('0x74')];_0x314013['location']=_0x41d088['Location'];logger[_0xa79b('0x68')](util['format'](_0xa79b('0x75'),_0x1803c7));return startTranscribe(_0x3e566f,_0x5ac8b7,_0x327aa9,uuidv4(),_0x2cee96,_0x41d088[_0xa79b('0x76')]);})[_0xa79b('0x24')](function(_0x310343){logger[_0xa79b('0x68')](util[_0xa79b('0x31')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x1803c7,_0x310343[_0xa79b('0x77')][_0xa79b('0x78')]));_0x314013['transcribeName']=_0x310343['TranscriptionJob'][_0xa79b('0x78')];_0x314013[_0xa79b('0x79')]=_0x310343['TranscriptionJob'][_0xa79b('0x7a')];return _0x107612(_0x314013);})[_0xa79b('0x47')](function(_0x3ab87e){return _0x5ba657(_0x3ab87e);});});}exports[_0xa79b('0x7b')]=function(_0x597176,_0x52df79,_0x5677e7){var _0x1a7194;var _0x56c2eb;var _0x40df8a;var _0x4e1905=require('../../components/encryptor');return db[_0xa79b('0x43')]['findOne']({'where':{'id':_0x597176[_0xa79b('0x49')]['id']}})['then'](function(_0x160e7e){if(_0x160e7e){var _0x1496ed=util[_0xa79b('0x31')](_0xa79b('0x4f'),_0x160e7e['value']);if(fs['existsSync'](_0x1496ed)){cypher=!![];return _0x4e1905[_0xa79b('0x50')](_0x1496ed,_0x160e7e[_0xa79b('0x4e')],config[_0xa79b('0x51')][_0xa79b('0x52')])[_0xa79b('0x24')](function(){return _0x160e7e;});}return _0x160e7e;}})['then'](function(_0x22a9ea){if(!_0x22a9ea){throw new db[(_0xa79b('0x54'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x56c2eb=_0x22a9ea;return db[_0xa79b('0x7c')][_0xa79b('0x7d')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x52df79,null))['then'](function(_0x8b0370){if(_0x8b0370){_0x1a7194=_0x8b0370;if(!_0x1a7194[_0xa79b('0x7e')]||!_0x1a7194[_0xa79b('0x7f')]||!_0x1a7194['transcribeRegion']||!_0x1a7194[_0xa79b('0x80')]||!_0x1a7194[_0xa79b('0x73')]){throw new db[(_0xa79b('0x54'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x597176[_0xa79b('0x4a')][_0xa79b('0x81')]&&(!_0x1a7194[_0xa79b('0x82')]||!_0x1a7194[_0xa79b('0x83')]||!_0x1a7194[_0xa79b('0x84')]||!_0x1a7194['language']||!_0x1a7194[_0xa79b('0x73')])){throw new db[(_0xa79b('0x54'))]['ValidationError'](_0xa79b('0x85'));}return db['CloudProvider'][_0xa79b('0x7d')]({'where':{'id':_0x1a7194[_0xa79b('0x7f')]}});}})[_0xa79b('0x24')](function(_0x36d7bb){if(!_0x36d7bb){throw new db[(_0xa79b('0x54'))][(_0xa79b('0x55'))](_0xa79b('0x86'));}if(!_0x36d7bb[_0xa79b('0x87')]||!_0x36d7bb[_0xa79b('0x88')]){throw new db[(_0xa79b('0x54'))]['ValidationError'](_0xa79b('0x89'));}_0x40df8a=_0x36d7bb;return getBucketslist(_0x40df8a['data1'],_0x40df8a[_0xa79b('0x88')],_0x1a7194[_0xa79b('0x8a')]);})[_0xa79b('0x24')](function(_0x225e89){if(_0x225e89&&_0x225e89['Buckets']){var _0xd73bc4=_[_0xa79b('0x64')](_0x225e89[_0xa79b('0x8b')],function(_0x96ecc6){return _0x96ecc6['Name']===_0x1a7194[_0xa79b('0x73')];});if(!_0xd73bc4){logger[_0xa79b('0x68')](util['format'](_0xa79b('0x8c'),_0x597176['params']['id'],_0x1a7194[_0xa79b('0x73')]));return createBucket(_0x40df8a[_0xa79b('0x87')],_0x40df8a[_0xa79b('0x88')],_0x1a7194['transcribeRegion'],_0x1a7194['bucket']);}logger[_0xa79b('0x68')](util['format'](_0xa79b('0x8d'),_0x597176[_0xa79b('0x49')]['id'],_0x1a7194['bucket']));return;}})[_0xa79b('0x24')](function(_0x14c3a4){if(_0x56c2eb[_0xa79b('0x79')]===_0xa79b('0x8e')){return transcribe(_0x597176[_0xa79b('0x49')]['id'],_0x40df8a[_0xa79b('0x87')],_0x40df8a['data2'],_0x1a7194[_0xa79b('0x8a')],_0x1a7194[_0xa79b('0x73')],_0x56c2eb[_0xa79b('0x4e')],_0x1a7194['language']);}else{logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x597176[_0xa79b('0x49')]['id']));return{'transcribeStatus':_0xa79b('0x8f')};}})[_0xa79b('0x24')](function(_0x2d71cd){if(_0x2d71cd){_0x2d71cd['tempSentiment']=_0x597176[_0xa79b('0x4a')][_0xa79b('0x81')];return _0x56c2eb[_0xa79b('0x90')](_0x2d71cd);}})[_0xa79b('0x24')](respondWithResult(_0x52df79,null))[_0xa79b('0x47')](handleError(_0x52df79,null));};function writeFile(_0x3d9aea,_0x4b39fc){return new Promise(function(_0x399b20,_0x292cdd){fs[_0xa79b('0x91')](_0x4b39fc,_0x3d9aea,function(_0x139f80,_0x9a1f32){if(_0x139f80){return _0x292cdd(_0x139f80);}else{return _0x399b20(_0x9a1f32);}});});}exports[_0xa79b('0x92')]=function(_0x3892d4,_0x35c285,_0x13c6af){return db[_0xa79b('0x43')]['findOne']({'where':{'id':_0x3892d4[_0xa79b('0x49')]['id']}})[_0xa79b('0x24')](handleEntityNotFound(_0x35c285))[_0xa79b('0x24')](function(_0x4651aa){if(_0x4651aa&&_0x4651aa[_0xa79b('0x93')]){var _0x532baa=_0x4651aa[_0xa79b('0x93')];var _0x1ba3da=config['root']+_0xa79b('0x94')+_0x4651aa['id']+_0xa79b('0x95');if(fs[_0xa79b('0x53')](_0x1ba3da)){return _0x1ba3da;}return writeFile(_0x532baa,_0x1ba3da)[_0xa79b('0x24')](function(){return _0x1ba3da;});}else{throw new db['Sequelize'][(_0xa79b('0x55'))]('Transcript\x20not\x20available');}})['then'](function(_0x17ef53){return _0x35c285[_0xa79b('0x57')](_0x17ef53);})['catch'](handleError(_0x35c285));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index dd8714b..151f19e 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 _0x7ff5=['request-promise','path','../../config/environment','exports','define','voice_recordings','uniqueid','util','../../config/logger','api','bluebird'];(function(_0x511beb,_0x237d2a){var _0x240851=function(_0xa0d75b){while(--_0xa0d75b){_0x511beb['push'](_0x511beb['shift']());}};_0x240851(++_0x237d2a);}(_0x7ff5,0xcd));var _0x57ff=function(_0x488382,_0x2d1a4e){_0x488382=_0x488382-0x0;var _0x4f329b=_0x7ff5[_0x488382];return _0x4f329b;};'use strict';var _=require('lodash');var util=require(_0x57ff('0x0'));var logger=require(_0x57ff('0x1'))(_0x57ff('0x2'));var moment=require('moment');var BPromise=require(_0x57ff('0x3'));var rp=require(_0x57ff('0x4'));var fs=require('fs');var path=require(_0x57ff('0x5'));var rimraf=require('rimraf');var config=require(_0x57ff('0x6'));var attributes=require('./voiceRecording.attributes');module[_0x57ff('0x7')]=function(_0x364fb3,_0x40948b){return _0x364fb3[_0x57ff('0x8')]('VoiceRecording',attributes,{'tableName':_0x57ff('0x9'),'paranoid':![],'indexes':[{'name':_0x57ff('0xa'),'fields':[_0x57ff('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8e79=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','../../config/logger'];(function(_0x3a6606,_0x51bd1e){var _0x52299c=function(_0x51ae89){while(--_0x51ae89){_0x3a6606['push'](_0x3a6606['shift']());}};_0x52299c(++_0x51bd1e);}(_0x8e79,0x150));var _0x98e7=function(_0x143e92,_0x5e8fdb){_0x143e92=_0x143e92-0x0;var _0x163b23=_0x8e79[_0x143e92];return _0x163b23;};'use strict';var _=require(_0x98e7('0x0'));var util=require('util');var logger=require(_0x98e7('0x1'))(_0x98e7('0x2'));var moment=require(_0x98e7('0x3'));var BPromise=require(_0x98e7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98e7('0x5'));var rimraf=require(_0x98e7('0x6'));var config=require(_0x98e7('0x7'));var attributes=require('./voiceRecording.attributes');module[_0x98e7('0x8')]=function(_0x1bc752,_0x1e4ff6){return _0x1bc752[_0x98e7('0x9')](_0x98e7('0xa'),attributes,{'tableName':_0x98e7('0xb'),'paranoid':![],'indexes':[{'name':_0x98e7('0xc'),'fields':[_0x98e7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 070fd6d..1333890 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 _0xe3da=['CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VoiceRecording','update','body','options','where','attributes','limit','then','UpdateVoiceRecording','catch','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher','secrets','recording','unlink'];(function(_0x4b4ee0,_0x1243f){var _0x2c2de8=function(_0x47736f){while(--_0x47736f){_0x4b4ee0['push'](_0x4b4ee0['shift']());}};_0x2c2de8(++_0x1243f);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x476579,_0x33c089,_0x583b98){return new BPromise(function(_0x2a5c45,_0x3d6650){return client['request'](_0x476579,_0x583b98)['then'](function(_0x459592){logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));logger[_0xae3d('0x11')](_0xae3d('0x12'),_0x33c089,'request\x20sent',JSON[_0xae3d('0x13')](_0x459592));if(_0x459592['error']){if(_0x459592[_0xae3d('0x14')][_0xae3d('0x15')]===0x1f4){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592['error'][_0xae3d('0x16')]);return _0x3d6650(_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);}logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);return _0x2a5c45(_0x459592['error'][_0xae3d('0x16')]);}else{logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));_0x2a5c45(_0x459592[_0xae3d('0x17')][_0xae3d('0x16')]);}})['catch'](function(_0xe925fd){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0xe925fd);_0x3d6650(_0xe925fd);});});}exports['UpdateVoiceRecording']=function(_0x3f8cf9){var _0x4cbe4e=this;return new Promise(function(_0x558e42,_0x4d931d){return db[_0xae3d('0x18')][_0xae3d('0x19')](_0x3f8cf9[_0xae3d('0x1a')],{'raw':_0x3f8cf9[_0xae3d('0x1b')]?_0x3f8cf9[_0xae3d('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f8cf9[_0xae3d('0x1b')]?_0x3f8cf9['options'][_0xae3d('0x1c')]||null:null,'attributes':_0x3f8cf9[_0xae3d('0x1b')]?_0x3f8cf9[_0xae3d('0x1b')][_0xae3d('0x1d')]||null:null,'limit':_0x3f8cf9[_0xae3d('0x1b')]?_0x3f8cf9[_0xae3d('0x1b')][_0xae3d('0x1e')]||null:null})[_0xae3d('0x1f')](function(_0x3224ff){logger[_0xae3d('0xe')](_0xae3d('0x20'),_0x3f8cf9);logger[_0xae3d('0x11')](_0xae3d('0x20'),_0x3f8cf9,JSON[_0xae3d('0x13')](_0x3224ff));_0x558e42(_0x3224ff);})[_0xae3d('0x21')](function(_0x1fe90f){logger[_0xae3d('0x14')](_0xae3d('0x20'),_0x1fe90f[_0xae3d('0x16')],_0x3f8cf9);_0x4d931d(_0x4cbe4e[_0xae3d('0x14')](0x1f4,_0x1fe90f['message']));});});};exports[_0xae3d('0x22')]=function(_0x185e71){var _0xb5940=this;return new Promise(function(_0x52df0f,_0x256bd0){var _0x4391db=require(_0xae3d('0x23'));var _0x54c1e1;return db['Setting'][_0xae3d('0x24')]({'attributes':['id',_0xae3d('0x25')],'where':{'id':0x1},'raw':!![]})[_0xae3d('0x1f')](function(_0x3114f9){_0x54c1e1=_0x3114f9;return db[_0xae3d('0x18')]['create'](_0x185e71[_0xae3d('0x1a')]);})[_0xae3d('0x1f')](function(_0x5a39c5){if(_0x54c1e1[_0xae3d('0x25')]&&fs[_0xae3d('0x26')](_0x5a39c5[_0xae3d('0x27')])){var _0x46f484=util[_0xae3d('0x28')](_0xae3d('0x29'),_0x5a39c5['value']);return _0x4391db['encryptFile'](_0x5a39c5['value'],_0x46f484,config[_0xae3d('0x2a')][_0xae3d('0x2b')])[_0xae3d('0x1f')](function(){fs[_0xae3d('0x2c')](_0x5a39c5['value']);logger[_0xae3d('0xe')](_0xae3d('0x2d'));return _0x5a39c5;});}return _0x5a39c5;})[_0xae3d('0x1f')](function(_0x3748d2){logger[_0xae3d('0xe')](_0xae3d('0x22'),_0x185e71);logger[_0xae3d('0x11')]('CreateVoiceRecording',_0x185e71,JSON[_0xae3d('0x13')](_0x3748d2));_0x52df0f(_0x3748d2);})['catch'](function(_0x55aae4){logger[_0xae3d('0x14')]('CreateVoiceRecording',_0x55aae4[_0xae3d('0x16')],_0x185e71);_0x256bd0(_0xb5940['error'](0x1f4,_0x55aae4['message']));});});}; \ No newline at end of file +var _0x4e2e=['error','message','result','VoiceRecording','update','body','options','raw','attributes','limit','UpdateVoiceRecording','debug','catch','../../components/encryptor','findOne','create','callRecordingEncryption','format','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x296469,_0x35bc5a){var _0x300551=function(_0xb1ba77){while(--_0xb1ba77){_0x296469['push'](_0x296469['shift']());}};_0x300551(++_0x35bc5a);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x82e1d0,_0x3791d6){_0x82e1d0=_0x82e1d0-0x0;var _0x2ba6ed=_0x4e2e[_0x82e1d0];return _0x2ba6ed;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));var BPromise=require(_0xe4e2('0x2'));var rs=require(_0xe4e2('0x3'));var fs=require('fs');var Redis=require(_0xe4e2('0x4'));var db=require(_0xe4e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4e2('0x6'))(_0xe4e2('0x7'));var config=require(_0xe4e2('0x8'));var jayson=require(_0xe4e2('0x9'));var client=jayson['client'][_0xe4e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36b1c6,_0x1c4e64,_0x125338){return new BPromise(function(_0x956c75,_0x27304b){return client[_0xe4e2('0xb')](_0x36b1c6,_0x125338)[_0xe4e2('0xc')](function(_0x4912da){logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));logger['debug'](_0xe4e2('0x10'),_0x1c4e64,_0xe4e2('0xf'),JSON[_0xe4e2('0x11')](_0x4912da));if(_0x4912da[_0xe4e2('0x12')]){if(_0x4912da[_0xe4e2('0x12')]['code']===0x1f4){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x27304b(_0x4912da['error'][_0xe4e2('0x13')]);}logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x956c75(_0x4912da['error']['message']);}else{logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));_0x956c75(_0x4912da[_0xe4e2('0x14')][_0xe4e2('0x13')]);}})['catch'](function(_0x754778){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x754778);_0x27304b(_0x754778);});});}exports['UpdateVoiceRecording']=function(_0x196f16){var _0x54c80b=this;return new Promise(function(_0x1d5e9d,_0x3f313b){return db[_0xe4e2('0x15')][_0xe4e2('0x16')](_0x196f16[_0xe4e2('0x17')],{'raw':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')]['where']||null:null,'attributes':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x1a')]||null:null,'limit':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x1b')]||null:null})[_0xe4e2('0xc')](function(_0x51c67e){logger[_0xe4e2('0xd')](_0xe4e2('0x1c'),_0x196f16);logger[_0xe4e2('0x1d')]('UpdateVoiceRecording',_0x196f16,JSON[_0xe4e2('0x11')](_0x51c67e));_0x1d5e9d(_0x51c67e);})[_0xe4e2('0x1e')](function(_0x598fa3){logger[_0xe4e2('0x12')](_0xe4e2('0x1c'),_0x598fa3[_0xe4e2('0x13')],_0x196f16);_0x3f313b(_0x54c80b[_0xe4e2('0x12')](0x1f4,_0x598fa3[_0xe4e2('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x166610){var _0x357903=this;return new Promise(function(_0x1f6d1f,_0x5120fd){var _0x3a31b8=require(_0xe4e2('0x1f'));var _0x31f651;return db['Setting'][_0xe4e2('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xe4e2('0xc')](function(_0x1e21c0){_0x31f651=_0x1e21c0;return db['VoiceRecording'][_0xe4e2('0x21')](_0x166610[_0xe4e2('0x17')]);})[_0xe4e2('0xc')](function(_0x41500b){if(_0x31f651[_0xe4e2('0x22')]&&fs['existsSync'](_0x41500b['value'])){var _0x2cb235=util[_0xe4e2('0x23')](_0xe4e2('0x24'),_0x41500b[_0xe4e2('0x25')]);return _0x3a31b8[_0xe4e2('0x26')](_0x41500b[_0xe4e2('0x25')],_0x2cb235,config[_0xe4e2('0x27')][_0xe4e2('0x28')])[_0xe4e2('0xc')](function(){fs[_0xe4e2('0x29')](_0x41500b[_0xe4e2('0x25')]);logger[_0xe4e2('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x41500b;});}return _0x41500b;})[_0xe4e2('0xc')](function(_0x8ffc6){logger[_0xe4e2('0xd')](_0xe4e2('0x2a'),_0x166610);logger[_0xe4e2('0x1d')](_0xe4e2('0x2a'),_0x166610,JSON['stringify'](_0x8ffc6));_0x1f6d1f(_0x8ffc6);})[_0xe4e2('0x1e')](function(_0x286714){logger[_0xe4e2('0x12')](_0xe4e2('0x2a'),_0x286714[_0xe4e2('0x13')],_0x166610);_0x5120fd(_0x357903[_0xe4e2('0x12')](0x1f4,_0x286714[_0xe4e2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 4bc8403..a587604 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 _0x374f=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get'];(function(_0x4476cb,_0x1d71b6){var _0x343cf4=function(_0x2bc6ee){while(--_0x2bc6ee){_0x4476cb['push'](_0x4476cb['shift']());}};_0x343cf4(++_0x1d71b6);}(_0x374f,0x110));var _0xf374=function(_0x3ec26c,_0x46d1ff){_0x3ec26c=_0x3ec26c-0x0;var _0x20d798=_0x374f[_0x3ec26c];return _0x20d798;};'use strict';var multer=require(_0xf374('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf374('0x1'));var express=require(_0xf374('0x2'));var router=express['Router']();var fs_extra=require(_0xf374('0x3'));var auth=require(_0xf374('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf374('0x5'));var controller=require(_0xf374('0x6'));router[_0xf374('0x7')]('/',auth[_0xf374('0x8')](),controller[_0xf374('0x9')]);router['get'](_0xf374('0xa'),auth[_0xf374('0x8')](),controller[_0xf374('0xb')]);router[_0xf374('0x7')](_0xf374('0xc'),auth['isAuthenticated'](),controller[_0xf374('0xd')]);router[_0xf374('0xe')]('/',auth['isAuthenticated'](),controller[_0xf374('0xf')]);router[_0xf374('0x10')](_0xf374('0xc'),auth[_0xf374('0x8')](),controller[_0xf374('0x11')]);router[_0xf374('0x12')](_0xf374('0xc'),auth[_0xf374('0x8')](),controller['destroy']);module[_0xf374('0x13')]=router; \ No newline at end of file +var _0x4256=['get','isAuthenticated','index','/describe','describe','/:id','post','create','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4256,0x1d7));var _0x6425=function(_0x2842b4,_0x2b1b7b){_0x2842b4=_0x2842b4-0x0;var _0x2b9521=_0x4256[_0x2842b4];return _0x2b9521;};'use strict';var multer=require('multer');var util=require(_0x6425('0x0'));var path=require(_0x6425('0x1'));var timeout=require('connect-timeout');var express=require(_0x6425('0x2'));var router=express[_0x6425('0x3')]();var fs_extra=require(_0x6425('0x4'));var auth=require(_0x6425('0x5'));var interaction=require(_0x6425('0x6'));var config=require(_0x6425('0x7'));var controller=require(_0x6425('0x8'));router[_0x6425('0x9')]('/',auth[_0x6425('0xa')](),controller[_0x6425('0xb')]);router[_0x6425('0x9')](_0x6425('0xc'),auth[_0x6425('0xa')](),controller[_0x6425('0xd')]);router[_0x6425('0x9')](_0x6425('0xe'),auth[_0x6425('0xa')](),controller['show']);router[_0x6425('0xf')]('/',auth[_0x6425('0xa')](),controller[_0x6425('0x10')]);router['put'](_0x6425('0xe'),auth[_0x6425('0xa')](),controller['update']);router[_0x6425('0x11')](_0x6425('0xe'),auth[_0x6425('0xa')](),controller[_0x6425('0x12')]);module[_0x6425('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index a287efc..6495491 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 _0x76f8=['Yes','sequelize','moment','exports','ENUM','attended','STRING'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x76f8,0x10b));var _0x876f=function(_0x17ccf0,_0x42d147){_0x17ccf0=_0x17ccf0-0x0;var _0x5a0651=_0x76f8[_0x17ccf0];return _0x5a0651;};'use strict';var Sequelize=require(_0x876f('0x0'));var moment=require(_0x876f('0x1'));module[_0x876f('0x2')]={'type':{'type':Sequelize[_0x876f('0x3')]('blind',_0x876f('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x876f('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x876f('0x5')]},'transferercalleridname':{'type':Sequelize[_0x876f('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x876f('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x876f('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x876f('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x876f('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x876f('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x876f('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x876f('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x876f('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x876f('0x5')]},'isexternal':{'type':Sequelize[_0x876f('0x3')](_0x876f('0x6'),'No')},'context':{'type':Sequelize[_0x876f('0x5')]},'extension':{'type':Sequelize[_0x876f('0x5')]}}; \ No newline at end of file +var _0x9b91=['ENUM','blind','attended','STRING','Yes'];(function(_0x2a94cf,_0x2b970d){var _0x22147f=function(_0xfc71ab){while(--_0xfc71ab){_0x2a94cf['push'](_0x2a94cf['shift']());}};_0x22147f(++_0x2b970d);}(_0x9b91,0x82));var _0x19b9=function(_0x57ac3b,_0x32e884){_0x57ac3b=_0x57ac3b-0x0;var _0x4204c9=_0x9b91[_0x57ac3b];return _0x4204c9;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x19b9('0x0')](_0x19b9('0x1'),_0x19b9('0x2'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x19b9('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x19b9('0x3')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x19b9('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0x19b9('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x19b9('0x3')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x19b9('0x3')]},'transfereechannel':{'type':Sequelize[_0x19b9('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x19b9('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x19b9('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x19b9('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x19b9('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0x19b9('0x3')]},'transfereecontext':{'type':Sequelize[_0x19b9('0x3')]},'transfereeexten':{'type':Sequelize[_0x19b9('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x19b9('0x3')]},'isexternal':{'type':Sequelize[_0x19b9('0x0')](_0x19b9('0x4'),'No')},'context':{'type':Sequelize[_0x19b9('0x3')]},'extension':{'type':Sequelize[_0x19b9('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index a16299b..cc340a7 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 _0xb87b=['VoiceTransferReport','fieldName','type','key','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','rawAttributes','fields','length','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','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','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x3e0191,_0x1d4b20){var _0xf2ae83=function(_0x277210){while(--_0x277210){_0x3e0191['push'](_0x3e0191['shift']());}};_0xf2ae83(++_0x1d4b20);}(_0xb87b,0x107));var _0xbb87=function(_0x3b0e87,_0x47ec1c){_0x3b0e87=_0x3b0e87-0x0;var _0x456b12=_0xb87b[_0x3b0e87];return _0x456b12;};'use strict';var emlformat=require(_0xbb87('0x0'));var rimraf=require(_0xbb87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb87('0x2'));var rp=require(_0xbb87('0x3'));var moment=require(_0xbb87('0x4'));var BPromise=require(_0xbb87('0x5'));var Mustache=require('mustache');var util=require(_0xbb87('0x6'));var path=require(_0xbb87('0x7'));var sox=require(_0xbb87('0x8'));var csv=require('to-csv');var ejs=require(_0xbb87('0x9'));var fs=require('fs');var fs_extra=require(_0xbb87('0xa'));var _=require(_0xbb87('0xb'));var squel=require('squel');var crypto=require(_0xbb87('0xc'));var jsforce=require(_0xbb87('0xd'));var deskjs=require(_0xbb87('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbb87('0xf'));var Redis=require(_0xbb87('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb87('0x11'));var as=require(_0xbb87('0x12'));var hardwareService=require(_0xbb87('0x13'));var logger=require(_0xbb87('0x14'))('api');var utils=require(_0xbb87('0x15'));var config=require(_0xbb87('0x16'));var licenseUtil=require(_0xbb87('0x17'));var db=require(_0xbb87('0x18'))['db'];function respondWithStatusCode(_0x5d1178,_0x1a6412){_0x1a6412=_0x1a6412||0xcc;return function(_0x2537bc){if(_0x2537bc){return _0x5d1178[_0xbb87('0x19')](_0x1a6412);}return _0x5d1178[_0xbb87('0x1a')](_0x1a6412)[_0xbb87('0x1b')]();};}function respondWithResult(_0x1b5d55,_0x55b6a7){_0x55b6a7=_0x55b6a7||0xc8;return function(_0x3c5bf5){if(_0x3c5bf5){return _0x1b5d55[_0xbb87('0x1a')](_0x55b6a7)[_0xbb87('0x1c')](_0x3c5bf5);}};}function respondWithFilteredResult(_0xff7ab5,_0x4f433b){return function(_0x58dd28){if(_0x58dd28){var _0x4ed31f=typeof _0x4f433b[_0xbb87('0x1d')]===_0xbb87('0x1e')&&typeof _0x4f433b[_0xbb87('0x1f')]===_0xbb87('0x1e');var _0x736a1c=_0x58dd28['count'];var _0x55d556=_0x4ed31f?0x0:_0x4f433b[_0xbb87('0x1d')];var _0x1a6554=_0x4ed31f?_0x58dd28[_0xbb87('0x20')]:_0x4f433b['offset']+_0x4f433b[_0xbb87('0x1f')];var _0xdf98d;if(_0x1a6554>=_0x736a1c){_0x1a6554=_0x736a1c;_0xdf98d=0xc8;}else{_0xdf98d=0xce;}_0xff7ab5[_0xbb87('0x1a')](_0xdf98d);return _0xff7ab5[_0xbb87('0x21')]('Content-Range',_0x55d556+'-'+_0x1a6554+'/'+_0x736a1c)[_0xbb87('0x1c')](_0x58dd28);}return null;};}function patchUpdates(_0x27cb4e){return function(_0x390b79){try{jsonpatch['apply'](_0x390b79,_0x27cb4e,!![]);}catch(_0x3cf89d){return BPromise[_0xbb87('0x22')](_0x3cf89d);}return _0x390b79[_0xbb87('0x23')]();};}function saveUpdates(_0x34c454,_0x8151f7){return function(_0x2ff507){if(_0x2ff507){return _0x2ff507[_0xbb87('0x24')](_0x34c454)[_0xbb87('0x25')](function(_0x517796){return _0x517796;});}return null;};}function removeEntity(_0x571aa6,_0x516ad8){return function(_0x3cc805){if(_0x3cc805){return _0x3cc805[_0xbb87('0x26')]()[_0xbb87('0x25')](function(){_0x571aa6[_0xbb87('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f93e0,_0x508f7f){return function(_0x1f66d4){if(!_0x1f66d4){_0x1f93e0['sendStatus'](0x194);}return _0x1f66d4;};}function handleError(_0x4aab9d,_0x5a4ca1){_0x5a4ca1=_0x5a4ca1||0x1f4;return function(_0x6a92a9){logger[_0xbb87('0x27')](_0x6a92a9[_0xbb87('0x28')]);if(_0x6a92a9[_0xbb87('0x29')]){delete _0x6a92a9[_0xbb87('0x29')];}_0x4aab9d[_0xbb87('0x1a')](_0x5a4ca1)[_0xbb87('0x2a')](_0x6a92a9);};}exports[_0xbb87('0x2b')]=function(_0x1ad101,_0x4897f0){var _0x342966={},_0x4d43b7={},_0x43611c={'count':0x0,'rows':[]};var _0x44bcac=_[_0xbb87('0x2c')](db[_0xbb87('0x2d')]['rawAttributes'],function(_0x2db6b8){return{'name':_0x2db6b8[_0xbb87('0x2e')],'type':_0x2db6b8[_0xbb87('0x2f')][_0xbb87('0x30')]};});_0x4d43b7['model']=_[_0xbb87('0x2c')](_0x44bcac,_0xbb87('0x29'));_0x4d43b7[_0xbb87('0x31')]=_['keys'](_0x1ad101['query']);_0x4d43b7[_0xbb87('0x32')]=_[_0xbb87('0x33')](_0x4d43b7[_0xbb87('0x34')],_0x4d43b7[_0xbb87('0x31')]);_0x342966[_0xbb87('0x35')]=_[_0xbb87('0x33')](_0x4d43b7[_0xbb87('0x34')],qs['fields'](_0x1ad101['query']['fields']));_0x342966[_0xbb87('0x35')]=_0x342966['attributes']['length']?_0x342966['attributes']:_0x4d43b7['model'];if(!_0x1ad101[_0xbb87('0x31')][_0xbb87('0x36')](_0xbb87('0x37'))){_0x342966[_0xbb87('0x1f')]=qs[_0xbb87('0x1f')](_0x1ad101['query'][_0xbb87('0x1f')]);_0x342966[_0xbb87('0x1d')]=qs['offset'](_0x1ad101[_0xbb87('0x31')][_0xbb87('0x1d')]);}_0x342966[_0xbb87('0x38')]=qs['sort'](_0x1ad101['query']['sort']);_0x342966[_0xbb87('0x39')]=qs['filters'](_[_0xbb87('0x3a')](_0x1ad101[_0xbb87('0x31')],_0x4d43b7[_0xbb87('0x32')]),_0x44bcac);if(_0x1ad101[_0xbb87('0x31')][_0xbb87('0x3b')]){_0x342966[_0xbb87('0x39')]=_[_0xbb87('0x3c')](_0x342966[_0xbb87('0x39')],{'$or':_[_0xbb87('0x2c')](_0x44bcac,function(_0x6ca5d3){if(_0x6ca5d3[_0xbb87('0x2f')]!==_0xbb87('0x3d')){var _0x2c514b={};_0x2c514b[_0x6ca5d3[_0xbb87('0x29')]]={'$like':'%'+_0x1ad101[_0xbb87('0x31')]['filter']+'%'};return _0x2c514b;}})});}_0x342966=_[_0xbb87('0x3c')]({},_0x342966,_0x1ad101[_0xbb87('0x3e')]);var _0x2da7e9={'where':_0x342966[_0xbb87('0x39')]};return db[_0xbb87('0x2d')][_0xbb87('0x20')](_0x2da7e9)['then'](function(_0x2ae436){_0x43611c[_0xbb87('0x20')]=_0x2ae436;if(_0x1ad101['query'][_0xbb87('0x3f')]){_0x342966[_0xbb87('0x40')]=[{'all':!![]}];}return db[_0xbb87('0x2d')]['findAll'](_0x342966);})[_0xbb87('0x25')](function(_0x323a39){_0x43611c[_0xbb87('0x41')]=_0x323a39;return _0x43611c;})[_0xbb87('0x25')](respondWithFilteredResult(_0x4897f0,_0x342966))[_0xbb87('0x42')](handleError(_0x4897f0,null));};exports[_0xbb87('0x43')]=function(_0x2c5453,_0x4219d9){var _0x3752c7={'raw':!![],'where':{'id':_0x2c5453['params']['id']}},_0x98542={};_0x98542['model']=_[_0xbb87('0x44')](db[_0xbb87('0x2d')][_0xbb87('0x45')]);_0x98542[_0xbb87('0x31')]=_[_0xbb87('0x44')](_0x2c5453[_0xbb87('0x31')]);_0x98542[_0xbb87('0x32')]=_[_0xbb87('0x33')](_0x98542[_0xbb87('0x34')],_0x98542[_0xbb87('0x31')]);_0x3752c7[_0xbb87('0x35')]=_[_0xbb87('0x33')](_0x98542[_0xbb87('0x34')],qs[_0xbb87('0x46')](_0x2c5453['query'][_0xbb87('0x46')]));_0x3752c7[_0xbb87('0x35')]=_0x3752c7['attributes'][_0xbb87('0x47')]?_0x3752c7[_0xbb87('0x35')]:_0x98542[_0xbb87('0x34')];if(_0x2c5453[_0xbb87('0x31')][_0xbb87('0x3f')]){_0x3752c7[_0xbb87('0x40')]=[{'all':!![]}];}_0x3752c7=_[_0xbb87('0x3c')]({},_0x3752c7,_0x2c5453[_0xbb87('0x3e')]);return db[_0xbb87('0x2d')][_0xbb87('0x48')](_0x3752c7)[_0xbb87('0x25')](handleEntityNotFound(_0x4219d9,null))['then'](respondWithResult(_0x4219d9,null))[_0xbb87('0x42')](handleError(_0x4219d9,null));};exports[_0xbb87('0x49')]=function(_0x37b9a0,_0x5218cd){return db[_0xbb87('0x2d')][_0xbb87('0x49')](_0x37b9a0[_0xbb87('0x4a')],{})[_0xbb87('0x25')](respondWithResult(_0x5218cd,0xc9))[_0xbb87('0x42')](handleError(_0x5218cd,null));};exports[_0xbb87('0x24')]=function(_0x47de10,_0x50b454){if(_0x47de10[_0xbb87('0x4a')]['id']){delete _0x47de10[_0xbb87('0x4a')]['id'];}return db[_0xbb87('0x2d')][_0xbb87('0x48')]({'where':{'id':_0x47de10[_0xbb87('0x4b')]['id']}})[_0xbb87('0x25')](handleEntityNotFound(_0x50b454,null))['then'](saveUpdates(_0x47de10[_0xbb87('0x4a')],null))['then'](respondWithResult(_0x50b454,null))['catch'](handleError(_0x50b454,null));};exports[_0xbb87('0x26')]=function(_0x355208,_0x2a7513){return db['VoiceTransferReport'][_0xbb87('0x48')]({'where':{'id':_0x355208[_0xbb87('0x4b')]['id']}})[_0xbb87('0x25')](handleEntityNotFound(_0x2a7513,null))['then'](removeEntity(_0x2a7513,null))['catch'](handleError(_0x2a7513,null));};exports[_0xbb87('0x4c')]=function(_0x526361,_0x2b05bb){return db[_0xbb87('0x2d')]['describe']()[_0xbb87('0x25')](respondWithResult(_0x2b05bb,null))[_0xbb87('0x42')](handleError(_0x2b05bb,null));}; \ No newline at end of file +var _0x6ac0=['eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','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','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','fields','includeAll','body','find','describe'];(function(_0x357946,_0x566f9f){var _0x5194de=function(_0x3a4aab){while(--_0x3a4aab){_0x357946['push'](_0x357946['shift']());}};_0x5194de(++_0x566f9f);}(_0x6ac0,0x17c));var _0x06ac=function(_0x2b4f6d,_0x3fbe10){_0x2b4f6d=_0x2b4f6d-0x0;var _0x2eb3fa=_0x6ac0[_0x2b4f6d];return _0x2eb3fa;};'use strict';var emlformat=require(_0x06ac('0x0'));var rimraf=require(_0x06ac('0x1'));var zipdir=require(_0x06ac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x06ac('0x3'));var BPromise=require(_0x06ac('0x4'));var Mustache=require(_0x06ac('0x5'));var util=require(_0x06ac('0x6'));var path=require(_0x06ac('0x7'));var sox=require(_0x06ac('0x8'));var csv=require(_0x06ac('0x9'));var ejs=require(_0x06ac('0xa'));var fs=require('fs');var fs_extra=require(_0x06ac('0xb'));var _=require('lodash');var squel=require(_0x06ac('0xc'));var crypto=require(_0x06ac('0xd'));var jsforce=require(_0x06ac('0xe'));var deskjs=require(_0x06ac('0xf'));var toCsv=require(_0x06ac('0x9'));var querystring=require(_0x06ac('0x10'));var Papa=require(_0x06ac('0x11'));var Redis=require(_0x06ac('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x06ac('0x13'));var as=require(_0x06ac('0x14'));var hardwareService=require(_0x06ac('0x15'));var logger=require(_0x06ac('0x16'))(_0x06ac('0x17'));var utils=require('../../config/utils');var config=require(_0x06ac('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x06ac('0x19'))['db'];function respondWithStatusCode(_0x386631,_0x4436c0){_0x4436c0=_0x4436c0||0xcc;return function(_0x3cddb3){if(_0x3cddb3){return _0x386631['sendStatus'](_0x4436c0);}return _0x386631[_0x06ac('0x1a')](_0x4436c0)[_0x06ac('0x1b')]();};}function respondWithResult(_0x1cd061,_0x7a581f){_0x7a581f=_0x7a581f||0xc8;return function(_0x348dee){if(_0x348dee){return _0x1cd061[_0x06ac('0x1a')](_0x7a581f)[_0x06ac('0x1c')](_0x348dee);}};}function respondWithFilteredResult(_0x608d15,_0x1f750b){return function(_0x163373){if(_0x163373){var _0x4db525=typeof _0x1f750b[_0x06ac('0x1d')]===_0x06ac('0x1e')&&typeof _0x1f750b[_0x06ac('0x1f')]===_0x06ac('0x1e');var _0x2b67df=_0x163373[_0x06ac('0x20')];var _0x582691=_0x4db525?0x0:_0x1f750b[_0x06ac('0x1d')];var _0x25de1b=_0x4db525?_0x163373[_0x06ac('0x20')]:_0x1f750b['offset']+_0x1f750b[_0x06ac('0x1f')];var _0xa326c0;if(_0x25de1b>=_0x2b67df){_0x25de1b=_0x2b67df;_0xa326c0=0xc8;}else{_0xa326c0=0xce;}_0x608d15[_0x06ac('0x1a')](_0xa326c0);return _0x608d15[_0x06ac('0x21')]('Content-Range',_0x582691+'-'+_0x25de1b+'/'+_0x2b67df)[_0x06ac('0x1c')](_0x163373);}return null;};}function patchUpdates(_0x26a83a){return function(_0x46eb20){try{jsonpatch['apply'](_0x46eb20,_0x26a83a,!![]);}catch(_0x42aa19){return BPromise[_0x06ac('0x22')](_0x42aa19);}return _0x46eb20['save']();};}function saveUpdates(_0x3c69fb,_0x2929f4){return function(_0x2f3d99){if(_0x2f3d99){return _0x2f3d99[_0x06ac('0x23')](_0x3c69fb)[_0x06ac('0x24')](function(_0x31010f){return _0x31010f;});}return null;};}function removeEntity(_0x4b5a77,_0x29fb46){return function(_0x124754){if(_0x124754){return _0x124754[_0x06ac('0x25')]()[_0x06ac('0x24')](function(){_0x4b5a77[_0x06ac('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48e008,_0x515db9){return function(_0x83ecab){if(!_0x83ecab){_0x48e008[_0x06ac('0x26')](0x194);}return _0x83ecab;};}function handleError(_0x3c34a4,_0x2a16bc){_0x2a16bc=_0x2a16bc||0x1f4;return function(_0x30e9d2){logger[_0x06ac('0x27')](_0x30e9d2[_0x06ac('0x28')]);if(_0x30e9d2[_0x06ac('0x29')]){delete _0x30e9d2[_0x06ac('0x29')];}_0x3c34a4['status'](_0x2a16bc)[_0x06ac('0x2a')](_0x30e9d2);};}exports[_0x06ac('0x2b')]=function(_0x133a6d,_0x1d7902){var _0x14b0d8={},_0x131b5f={},_0x34d300={'count':0x0,'rows':[]};var _0x53bb16=_[_0x06ac('0x2c')](db[_0x06ac('0x2d')][_0x06ac('0x2e')],function(_0x5ee77f){return{'name':_0x5ee77f[_0x06ac('0x2f')],'type':_0x5ee77f[_0x06ac('0x30')][_0x06ac('0x31')]};});_0x131b5f[_0x06ac('0x32')]=_[_0x06ac('0x2c')](_0x53bb16,_0x06ac('0x29'));_0x131b5f['query']=_[_0x06ac('0x33')](_0x133a6d[_0x06ac('0x34')]);_0x131b5f[_0x06ac('0x35')]=_[_0x06ac('0x36')](_0x131b5f['model'],_0x131b5f['query']);_0x14b0d8[_0x06ac('0x37')]=_['intersection'](_0x131b5f['model'],qs['fields'](_0x133a6d[_0x06ac('0x34')]['fields']));_0x14b0d8[_0x06ac('0x37')]=_0x14b0d8[_0x06ac('0x37')][_0x06ac('0x38')]?_0x14b0d8[_0x06ac('0x37')]:_0x131b5f[_0x06ac('0x32')];if(!_0x133a6d[_0x06ac('0x34')][_0x06ac('0x39')]('nolimit')){_0x14b0d8['limit']=qs['limit'](_0x133a6d[_0x06ac('0x34')][_0x06ac('0x1f')]);_0x14b0d8[_0x06ac('0x1d')]=qs[_0x06ac('0x1d')](_0x133a6d[_0x06ac('0x34')][_0x06ac('0x1d')]);}_0x14b0d8[_0x06ac('0x3a')]=qs[_0x06ac('0x3b')](_0x133a6d[_0x06ac('0x34')]['sort']);_0x14b0d8[_0x06ac('0x3c')]=qs[_0x06ac('0x35')](_[_0x06ac('0x3d')](_0x133a6d[_0x06ac('0x34')],_0x131b5f[_0x06ac('0x35')]),_0x53bb16);if(_0x133a6d[_0x06ac('0x34')]['filter']){_0x14b0d8['where']=_[_0x06ac('0x3e')](_0x14b0d8[_0x06ac('0x3c')],{'$or':_['map'](_0x53bb16,function(_0x3a5985){if(_0x3a5985[_0x06ac('0x30')]!==_0x06ac('0x3f')){var _0x3c126e={};_0x3c126e[_0x3a5985[_0x06ac('0x29')]]={'$like':'%'+_0x133a6d[_0x06ac('0x34')][_0x06ac('0x40')]+'%'};return _0x3c126e;}})});}_0x14b0d8=_[_0x06ac('0x3e')]({},_0x14b0d8,_0x133a6d[_0x06ac('0x41')]);var _0x411834={'where':_0x14b0d8['where']};return db[_0x06ac('0x2d')][_0x06ac('0x20')](_0x411834)[_0x06ac('0x24')](function(_0x52a80b){_0x34d300[_0x06ac('0x20')]=_0x52a80b;if(_0x133a6d[_0x06ac('0x34')]['includeAll']){_0x14b0d8[_0x06ac('0x42')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x06ac('0x43')](_0x14b0d8);})[_0x06ac('0x24')](function(_0x52107f){_0x34d300['rows']=_0x52107f;return _0x34d300;})['then'](respondWithFilteredResult(_0x1d7902,_0x14b0d8))[_0x06ac('0x44')](handleError(_0x1d7902,null));};exports[_0x06ac('0x45')]=function(_0x14b4bf,_0x208164){var _0x534d24={'raw':!![],'where':{'id':_0x14b4bf[_0x06ac('0x46')]['id']}},_0x19c003={};_0x19c003['model']=_[_0x06ac('0x33')](db['VoiceTransferReport'][_0x06ac('0x2e')]);_0x19c003[_0x06ac('0x34')]=_[_0x06ac('0x33')](_0x14b4bf[_0x06ac('0x34')]);_0x19c003[_0x06ac('0x35')]=_['intersection'](_0x19c003['model'],_0x19c003[_0x06ac('0x34')]);_0x534d24[_0x06ac('0x37')]=_['intersection'](_0x19c003['model'],qs[_0x06ac('0x47')](_0x14b4bf['query'][_0x06ac('0x47')]));_0x534d24['attributes']=_0x534d24[_0x06ac('0x37')][_0x06ac('0x38')]?_0x534d24['attributes']:_0x19c003[_0x06ac('0x32')];if(_0x14b4bf[_0x06ac('0x34')][_0x06ac('0x48')]){_0x534d24[_0x06ac('0x42')]=[{'all':!![]}];}_0x534d24=_[_0x06ac('0x3e')]({},_0x534d24,_0x14b4bf[_0x06ac('0x41')]);return db[_0x06ac('0x2d')]['find'](_0x534d24)[_0x06ac('0x24')](handleEntityNotFound(_0x208164,null))['then'](respondWithResult(_0x208164,null))[_0x06ac('0x44')](handleError(_0x208164,null));};exports['create']=function(_0x367407,_0x2b160a){return db[_0x06ac('0x2d')]['create'](_0x367407['body'],{})[_0x06ac('0x24')](respondWithResult(_0x2b160a,0xc9))[_0x06ac('0x44')](handleError(_0x2b160a,null));};exports[_0x06ac('0x23')]=function(_0x496765,_0x354ef0){if(_0x496765[_0x06ac('0x49')]['id']){delete _0x496765[_0x06ac('0x49')]['id'];}return db[_0x06ac('0x2d')][_0x06ac('0x4a')]({'where':{'id':_0x496765[_0x06ac('0x46')]['id']}})[_0x06ac('0x24')](handleEntityNotFound(_0x354ef0,null))[_0x06ac('0x24')](saveUpdates(_0x496765[_0x06ac('0x49')],null))[_0x06ac('0x24')](respondWithResult(_0x354ef0,null))['catch'](handleError(_0x354ef0,null));};exports['destroy']=function(_0x50822e,_0x4f4d22){return db[_0x06ac('0x2d')][_0x06ac('0x4a')]({'where':{'id':_0x50822e['params']['id']}})[_0x06ac('0x24')](handleEntityNotFound(_0x4f4d22,null))[_0x06ac('0x24')](removeEntity(_0x4f4d22,null))[_0x06ac('0x44')](handleError(_0x4f4d22,null));};exports[_0x06ac('0x4b')]=function(_0x535581,_0x3a9794){return db[_0x06ac('0x2d')][_0x06ac('0x4b')]()[_0x06ac('0x24')](respondWithResult(_0x3a9794,null))[_0x06ac('0x44')](handleError(_0x3a9794,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index d2c9a37..2dd30eb 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 _0x3dd5=['./voiceTransferReport.attributes','exports','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x29d9c4,_0x478de8){var _0x33b987=function(_0x2b21f1){while(--_0x2b21f1){_0x29d9c4['push'](_0x29d9c4['shift']());}};_0x33b987(++_0x478de8);}(_0x3dd5,0xc9));var _0x53dd=function(_0x2d46a1,_0x279f75){_0x2d46a1=_0x2d46a1-0x0;var _0x424301=_0x3dd5[_0x2d46a1];return _0x424301;};'use strict';var _=require(_0x53dd('0x0'));var util=require(_0x53dd('0x1'));var logger=require(_0x53dd('0x2'))(_0x53dd('0x3'));var moment=require(_0x53dd('0x4'));var BPromise=require(_0x53dd('0x5'));var rp=require(_0x53dd('0x6'));var fs=require('fs');var path=require(_0x53dd('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x53dd('0x8'));module[_0x53dd('0x9')]=function(_0x4c1c00,_0x3dd08d){return _0x4c1c00['define']('VoiceTransferReport',attributes,{'tableName':_0x53dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ac6=['request-promise','rimraf','../../config/environment','define','VoiceTransferReport','util','../../config/logger','api'];(function(_0x87a87,_0x54b0bc){var _0x3d7a87=function(_0x369f77){while(--_0x369f77){_0x87a87['push'](_0x87a87['shift']());}};_0x3d7a87(++_0x54b0bc);}(_0x8ac6,0x145));var _0x68ac=function(_0x1af8da,_0x5bfff9){_0x1af8da=_0x1af8da-0x0;var _0x1d8987=_0x8ac6[_0x1af8da];return _0x1d8987;};'use strict';var _=require('lodash');var util=require(_0x68ac('0x0'));var logger=require(_0x68ac('0x1'))(_0x68ac('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x68ac('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ac('0x4'));var config=require(_0x68ac('0x5'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x16dace,_0x5e3f2f){return _0x16dace[_0x68ac('0x6')](_0x68ac('0x7'),attributes,{'tableName':'report_call_transfer','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 f74206e..0e03e05 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 _0xdab3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','request\x20sent','debug','stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','lodash','moment'];(function(_0x5e6c33,_0x4f157a){var _0x142bc9=function(_0x2d2415){while(--_0x2d2415){_0x5e6c33['push'](_0x5e6c33['shift']());}};_0x142bc9(++_0x4f157a);}(_0xdab3,0x127));var _0x3dab=function(_0x4f141b,_0x415feb){_0x4f141b=_0x4f141b-0x0;var _0x23cb3d=_0xdab3[_0x4f141b];return _0x23cb3d;};'use strict';var _=require(_0x3dab('0x0'));var util=require('util');var moment=require(_0x3dab('0x1'));var BPromise=require(_0x3dab('0x2'));var rs=require(_0x3dab('0x3'));var fs=require('fs');var Redis=require(_0x3dab('0x4'));var db=require(_0x3dab('0x5'))['db'];var utils=require(_0x3dab('0x6'));var logger=require(_0x3dab('0x7'))('rpc');var config=require(_0x3dab('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3dab('0x9')][_0x3dab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d9ca4,_0x21ef7f,_0x3c6f81){return new BPromise(function(_0x391de1,_0x13fd46){return client['request'](_0x5d9ca4,_0x3c6f81)[_0x3dab('0xb')](function(_0xb3ab17){logger[_0x3dab('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x21ef7f,_0x3dab('0xd'));logger[_0x3dab('0xe')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x21ef7f,_0x3dab('0xd'),JSON[_0x3dab('0xf')](_0xb3ab17));if(_0xb3ab17[_0x3dab('0x10')]){if(_0xb3ab17[_0x3dab('0x10')][_0x3dab('0x11')]===0x1f4){logger[_0x3dab('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x21ef7f,_0xb3ab17['error'][_0x3dab('0x12')]);return _0x13fd46(_0xb3ab17[_0x3dab('0x10')]['message']);}logger[_0x3dab('0x10')](_0x3dab('0x13'),_0x21ef7f,_0xb3ab17[_0x3dab('0x10')]['message']);return _0x391de1(_0xb3ab17[_0x3dab('0x10')][_0x3dab('0x12')]);}else{logger[_0x3dab('0xc')](_0x3dab('0x13'),_0x21ef7f,_0x3dab('0xd'));_0x391de1(_0xb3ab17[_0x3dab('0x14')][_0x3dab('0x12')]);}})[_0x3dab('0x15')](function(_0x55ade7){logger[_0x3dab('0x10')](_0x3dab('0x13'),_0x21ef7f,_0x55ade7);_0x13fd46(_0x55ade7);});});}exports[_0x3dab('0x16')]=function(_0x1ad2b5){var _0x56a81d=this;return new Promise(function(_0x29adce,_0x173377){return db[_0x3dab('0x17')][_0x3dab('0x18')](_0x1ad2b5[_0x3dab('0x19')],{'raw':_0x1ad2b5[_0x3dab('0x1a')]?_0x1ad2b5[_0x3dab('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x3dab('0xb')](function(_0x3d09d4){logger[_0x3dab('0xc')](_0x3dab('0x16'),_0x1ad2b5);logger['debug']('CreateVoiceTransferReport',_0x1ad2b5,JSON[_0x3dab('0xf')](_0x3d09d4));_0x29adce(_0x3d09d4);})['catch'](function(_0x5485f5){logger[_0x3dab('0x10')](_0x3dab('0x16'),_0x5485f5[_0x3dab('0x12')],_0x1ad2b5);_0x173377(_0x56a81d[_0x3dab('0x10')](0x1f4,_0x5485f5['message']));});});}; \ No newline at end of file +var _0x5856=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','create','options','raw','lodash','util'];(function(_0x5da5b6,_0x32c1a0){var _0x4487eb=function(_0x2bf56b){while(--_0x2bf56b){_0x5da5b6['push'](_0x5da5b6['shift']());}};_0x4487eb(++_0x32c1a0);}(_0x5856,0x148));var _0x6585=function(_0x2906e6,_0x5ccd59){_0x2906e6=_0x2906e6-0x0;var _0x12517a=_0x5856[_0x2906e6];return _0x12517a;};'use strict';var _=require(_0x6585('0x0'));var util=require(_0x6585('0x1'));var moment=require(_0x6585('0x2'));var BPromise=require(_0x6585('0x3'));var rs=require(_0x6585('0x4'));var fs=require('fs');var Redis=require(_0x6585('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6585('0x6'));var logger=require(_0x6585('0x7'))(_0x6585('0x8'));var config=require(_0x6585('0x9'));var jayson=require(_0x6585('0xa'));var client=jayson[_0x6585('0xb')][_0x6585('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x631745,_0x5715dc,_0xbbc4e6){return new BPromise(function(_0x288ab6,_0x4c1141){return client[_0x6585('0xd')](_0x631745,_0xbbc4e6)[_0x6585('0xe')](function(_0x3447ae){logger[_0x6585('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x5715dc,'request\x20sent');logger[_0x6585('0x10')](_0x6585('0x11'),_0x5715dc,_0x6585('0x12'),JSON[_0x6585('0x13')](_0x3447ae));if(_0x3447ae[_0x6585('0x14')]){if(_0x3447ae['error'][_0x6585('0x15')]===0x1f4){logger[_0x6585('0x14')](_0x6585('0x16'),_0x5715dc,_0x3447ae[_0x6585('0x14')]['message']);return _0x4c1141(_0x3447ae[_0x6585('0x14')][_0x6585('0x17')]);}logger[_0x6585('0x14')](_0x6585('0x16'),_0x5715dc,_0x3447ae[_0x6585('0x14')][_0x6585('0x17')]);return _0x288ab6(_0x3447ae['error']['message']);}else{logger[_0x6585('0xf')](_0x6585('0x16'),_0x5715dc,'request\x20sent');_0x288ab6(_0x3447ae[_0x6585('0x18')][_0x6585('0x17')]);}})[_0x6585('0x19')](function(_0x74fa29){logger[_0x6585('0x14')](_0x6585('0x16'),_0x5715dc,_0x74fa29);_0x4c1141(_0x74fa29);});});}exports[_0x6585('0x1a')]=function(_0x14ead0){var _0x419e7f=this;return new Promise(function(_0x50e9d1,_0x276757){return db['VoiceTransferReport'][_0x6585('0x1b')](_0x14ead0['body'],{'raw':_0x14ead0[_0x6585('0x1c')]?_0x14ead0['options'][_0x6585('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x5de8f5){logger['info'](_0x6585('0x1a'),_0x14ead0);logger[_0x6585('0x10')](_0x6585('0x1a'),_0x14ead0,JSON[_0x6585('0x13')](_0x5de8f5));_0x50e9d1(_0x5de8f5);})[_0x6585('0x19')](function(_0xee91e6){logger[_0x6585('0x14')](_0x6585('0x1a'),_0xee91e6[_0x6585('0x17')],_0x14ead0);_0x276757(_0x419e7f[_0x6585('0x14')](0x1f4,_0xee91e6[_0x6585('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 5ad76c8..1cebc1f 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 _0x7c62=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate','/hold','hold','/unhold','unhold','calls'];(function(_0x211058,_0xe1d3d7){var _0x1ff375=function(_0x1463ac){while(--_0x1463ac){_0x211058['push'](_0x211058['shift']());}};_0x1ff375(++_0xe1d3d7);}(_0x7c62,0x89));var _0x27c6=function(_0x4b2449,_0x5b6251){_0x4b2449=_0x4b2449-0x0;var _0x1f85be=_0x7c62[_0x4b2449];return _0x1f85be;};'use strict';var express=require(_0x27c6('0x0'));var router=express[_0x27c6('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x27c6('0x2'));router[_0x27c6('0x3')](_0x27c6('0x4'),auth[_0x27c6('0x5')](),auth[_0x27c6('0x6')](),controller[_0x27c6('0x7')]);router[_0x27c6('0x3')]('/hangup',auth[_0x27c6('0x5')](),auth['canUpdate'](),controller['hangup']);router['post']('/answer',auth[_0x27c6('0x5')](),auth[_0x27c6('0x6')](),controller['answer']);router['post'](_0x27c6('0x8'),auth['isAuthenticated'](),auth[_0x27c6('0x6')](),controller[_0x27c6('0x9')]);router['post'](_0x27c6('0xa'),auth[_0x27c6('0x5')](),auth[_0x27c6('0x6')](),controller[_0x27c6('0xb')]);router[_0x27c6('0x3')]('/calls',auth[_0x27c6('0x5')](),auth[_0x27c6('0x6')](),controller[_0x27c6('0xc')]);router[_0x27c6('0x3')](_0x27c6('0xd'),auth[_0x27c6('0x5')](),auth[_0x27c6('0x6')](),controller[_0x27c6('0xe')]);module['exports']=router; \ No newline at end of file +var _0x98ff=['isAuthenticated','unhold','/calls','calls','/transfer','exports','express','./webbar.controller','post','/originate','canUpdate','originate','/hangup','hangup','/answer','answer','/hold','hold','/unhold'];(function(_0x195a7d,_0x2f2777){var _0xb6112=function(_0x5d85e0){while(--_0x5d85e0){_0x195a7d['push'](_0x195a7d['shift']());}};_0xb6112(++_0x2f2777);}(_0x98ff,0x110));var _0xf98f=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x98ff[_0x3e112d];return _0x531c31;};'use strict';var express=require(_0xf98f('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xf98f('0x1'));router[_0xf98f('0x2')](_0xf98f('0x3'),auth['isAuthenticated'](),auth[_0xf98f('0x4')](),controller[_0xf98f('0x5')]);router['post'](_0xf98f('0x6'),auth['isAuthenticated'](),auth[_0xf98f('0x4')](),controller[_0xf98f('0x7')]);router[_0xf98f('0x2')](_0xf98f('0x8'),auth['isAuthenticated'](),auth[_0xf98f('0x4')](),controller[_0xf98f('0x9')]);router[_0xf98f('0x2')](_0xf98f('0xa'),auth['isAuthenticated'](),auth[_0xf98f('0x4')](),controller[_0xf98f('0xb')]);router[_0xf98f('0x2')](_0xf98f('0xc'),auth[_0xf98f('0xd')](),auth['canUpdate'](),controller[_0xf98f('0xe')]);router['post'](_0xf98f('0xf'),auth[_0xf98f('0xd')](),auth[_0xf98f('0x4')](),controller[_0xf98f('0x10')]);router[_0xf98f('0x2')](_0xf98f('0x11'),auth[_0xf98f('0xd')](),auth[_0xf98f('0x4')](),controller['transfer']);module[_0xf98f('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index cbbd3c5..e5ae9b3 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 _0xf3cd=['webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','VoiceChannels','conference','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','string','callNumber\x20is\x20required','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','all','filter','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callbackUrl','entityFound:','format','user:%s','originate\x20executed!','hangup','hangup\x20fired:','json'];(function(_0x20263b,_0xb0109b){var _0xe357b3=function(_0x11662a){while(--_0x11662a){_0x20263b['push'](_0x20263b['shift']());}};_0xe357b3(++_0xb0109b);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5814ca,_0x3b6713){_0x5814ca=_0x5814ca-0x0;var _0xeb1833=_0xf3cd[_0x5814ca];return _0xeb1833;};'use strict';var path=require(_0xdf3c('0x0'));var fs=require('fs');var _=require(_0xdf3c('0x1'));var db=require(_0xdf3c('0x2'))['db'];var config=require(_0xdf3c('0x3'));var util=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0xdf3c('0x6')][_0xdf3c('0x7')]({'port':0x232a});var logger=require(_0xdf3c('0x8'))('webbarapi');var Redis=require(_0xdf3c('0x9'));config[_0xdf3c('0xa')]=_[_0xdf3c('0xb')](config[_0xdf3c('0xa')],{'host':_0xdf3c('0xc'),'port':0x18eb});var io=require(_0xdf3c('0xd'))(new Redis(config['redis']));var Schema=require(_0xdf3c('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xdf3c('0xf'),'required':[!![],_0xdf3c('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xdf3c('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],_0xdf3c('0x12')]},'sessionId':{'type':_0xdf3c('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],_0xdf3c('0x12')]},'sessionId':{'type':_0xdf3c('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xdf3c('0xf'),'required':[!![],_0xdf3c('0x13')]},'transferNumber':{'type':_0xdf3c('0xf'),'required':[!![],_0xdf3c('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xdf3c('0x12')]},'sessionId':{'type':_0xdf3c('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xdf3c('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],_0xdf3c('0x12')]}});var conferenceValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],_0xdf3c('0x12')]}});function emit(_0x1a7a5a,_0x305ea5,_0x92008b){logger[_0xdf3c('0x15')](_0x1a7a5a,_0x305ea5,JSON[_0xdf3c('0x16')](_0x92008b));io['to'](_0x1a7a5a)['emit'](_0x305ea5,_0x92008b);}function handleError(_0x13b0e6){return function(_0x465e7d){console[_0xdf3c('0x17')](_0xdf3c('0x18'),_0x465e7d,_0x465e7d instanceof RangeError);logger[_0xdf3c('0x19')](_0x465e7d[_0xdf3c('0x1a')]);if(_0x465e7d instanceof RangeError){if(_0x465e7d[_0xdf3c('0x1b')]){delete _0x465e7d[_0xdf3c('0x1b')];}_0x13b0e6[_0xdf3c('0x1c')](0x194)[_0xdf3c('0x1d')](_0x465e7d);}else{if(_0x465e7d[_0xdf3c('0x1b')]){delete _0x465e7d[_0xdf3c('0x1b')];}_0x13b0e6[_0xdf3c('0x1c')](0x1f4)['send'](_0x465e7d);}};}function checkError(){return function(_0x4d620f){if(!_0x4d620f){throw new RangeError(_0xdf3c('0x1e'));}return _0x4d620f;};}function respondWithRpcPromise(_0x583ce4,_0x15776c){return new BPromise(function(_0x40e7ec,_0x36552e){var _0x38b319=amiClient;return _0x38b319[_0xdf3c('0x1f')](_0x583ce4,_0x15776c)[_0xdf3c('0x20')](function(_0x50d8ca){if(_0x50d8ca[_0xdf3c('0x19')]){if(_0x50d8ca[_0xdf3c('0x19')][_0xdf3c('0x21')]===0x1f4){return _0x36552e(_0x50d8ca[_0xdf3c('0x19')][_0xdf3c('0x22')]);}return _0x40e7ec(_0x50d8ca[_0xdf3c('0x19')][_0xdf3c('0x22')]);}else{_0x40e7ec(_0x50d8ca[_0xdf3c('0x23')]);}})[_0xdf3c('0x24')](function(_0x1adee4){_0x36552e(_0x1adee4);});});}function getAgent(_0x4c076c){return db[_0xdf3c('0x25')][_0xdf3c('0x26')]({'where':{'id':_0x4c076c,'role':'agent'}})[_0xdf3c('0x20')](checkError());}function getAgentCheckSession(_0x59659e,_0x4eaced){return new BPromise(function(_0x508be9,_0x14aac9){var _0x186bba=respondWithRpcPromise('VoiceChannels');var _0x5c3b5a=getAgent(_0x59659e);Promise[_0xdf3c('0x27')]([_0x186bba,_0x5c3b5a])[_0xdf3c('0x20')](function(_0xd3cfcb){var _0x1ccdd4=_0xd3cfcb[0x0];var _0x5c98a2=_0xd3cfcb[0x1];var _0x43ce06=_[_0xdf3c('0x28')](_0x1ccdd4['rows'],function(_0x51e0a4){return _0x51e0a4[_0xdf3c('0x29')]==_0x5c98a2['id']&&_0x51e0a4[_0xdf3c('0x2a')]==_0x4eaced;});if(_0x43ce06[_0xdf3c('0x2b')]==0x1){_0x508be9(_0x5c98a2);}else{_0x14aac9(new RangeError('sessionId\x20'+_0x4eaced+_0xdf3c('0x2c')));}});});}exports[_0xdf3c('0x2d')]=function(_0x21e7b8,_0x10099e){logger['info'](_0xdf3c('0x2e'),_0x21e7b8[_0xdf3c('0x2f')]);var _0x522e5f=originateValidation[_0xdf3c('0xe')](_0x21e7b8[_0xdf3c('0x2f')]);if(_0x522e5f[_0xdf3c('0x2b')]>0x0){return _0x10099e[_0xdf3c('0x1c')](0x190)['json'](_0x522e5f);}var _0x33632f=_0x21e7b8[_0xdf3c('0x2f')][_0xdf3c('0x30')];var _0x3b9ce8=_0x21e7b8['body'][_0xdf3c('0x31')];var _0x3e7a4b=_0x21e7b8['body']['callerId'];var _0x12cc19=_0x21e7b8['body'][_0xdf3c('0x32')];return getAgent(_0x33632f)['then'](function(_0x57faba){logger['info'](_0xdf3c('0x33'),_0x57faba[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x57faba['name']),'webbar:originate',{'callNumber':_0x3b9ce8,'callerId':_0x3e7a4b,'callbackUrl':_0x12cc19});return _0x10099e[_0xdf3c('0x1c')](0xc8)['json']({'error':![],'message':_0xdf3c('0x36')});})[_0xdf3c('0x24')](handleError(_0x10099e));};exports[_0xdf3c('0x37')]=function(_0xcdd731,_0x1004e9){logger[_0xdf3c('0x15')](_0xdf3c('0x38'),_0xcdd731[_0xdf3c('0x2f')]);var _0x398c76=hangupValidation['validate'](_0xcdd731[_0xdf3c('0x2f')]);if(_0x398c76['length']>0x0){return _0x1004e9['status'](0x190)[_0xdf3c('0x39')](_0x398c76);}var _0x47f760=_0xcdd731[_0xdf3c('0x2f')]['userId'];var _0x2a94c3=_0xcdd731[_0xdf3c('0x2f')][_0xdf3c('0x2a')];return getAgent(_0x47f760)[_0xdf3c('0x20')](function(_0x3098cb){logger[_0xdf3c('0x15')](_0xdf3c('0x33'),_0x3098cb[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x3098cb[_0xdf3c('0x1b')]),_0xdf3c('0x3a'),{'sessionId':_0x2a94c3});return _0x1004e9['status'](0xc8)['json']({'error':![],'message':_0xdf3c('0x3b')});})['catch'](handleError(_0x1004e9));};exports[_0xdf3c('0x3c')]=function(_0x14d8e1,_0x46194d){logger[_0xdf3c('0x15')]('answer\x20fired:',_0x14d8e1['body']);var _0x335c1b=answerValidation[_0xdf3c('0xe')](_0x14d8e1[_0xdf3c('0x2f')]);if(_0x335c1b['length']>0x0){return _0x46194d[_0xdf3c('0x1c')](0x190)[_0xdf3c('0x39')](_0x335c1b);}var _0x6fc3b6=_0x14d8e1[_0xdf3c('0x2f')]['userId'];var _0x127685=_0x14d8e1[_0xdf3c('0x2f')][_0xdf3c('0x2a')];return getAgent(_0x6fc3b6)[_0xdf3c('0x20')](function(_0x2f52c5){logger['info'](_0xdf3c('0x33'),_0x2f52c5[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x2f52c5[_0xdf3c('0x1b')]),_0xdf3c('0x3d'),{'sessionId':_0x127685});return _0x46194d['status'](0xc8)['json']({'error':![],'message':_0xdf3c('0x3e')});})[_0xdf3c('0x24')](handleError(_0x46194d));};exports['hold']=function(_0x5c9885,_0x269723){logger[_0xdf3c('0x15')](_0xdf3c('0x3f'),_0x5c9885[_0xdf3c('0x2f')]);var _0xaae4bc=holdValidation[_0xdf3c('0xe')](_0x5c9885[_0xdf3c('0x2f')]);if(_0xaae4bc[_0xdf3c('0x2b')]>0x0){return _0x269723[_0xdf3c('0x1c')](0x190)['json'](_0xaae4bc);}var _0x129c2a=_0x5c9885[_0xdf3c('0x2f')][_0xdf3c('0x30')];var _0xe760dd=_0x5c9885[_0xdf3c('0x2f')][_0xdf3c('0x2a')];return getAgent(_0x129c2a)[_0xdf3c('0x20')](function(_0x553f70){logger[_0xdf3c('0x15')]('entityFound:',_0x553f70[_0xdf3c('0x1b')]);emit(util['format'](_0xdf3c('0x35'),_0x553f70[_0xdf3c('0x1b')]),_0xdf3c('0x40'),{'sessionId':_0xe760dd});return _0x269723[_0xdf3c('0x1c')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x269723));};exports[_0xdf3c('0x41')]=function(_0x5f5726,_0x31c600){logger[_0xdf3c('0x15')](_0xdf3c('0x42'),_0x5f5726[_0xdf3c('0x2f')]);var _0x3b17d9=unholdValidation['validate'](_0x5f5726['body']);if(_0x3b17d9[_0xdf3c('0x2b')]>0x0){return _0x31c600[_0xdf3c('0x1c')](0x190)['json'](_0x3b17d9);}var _0x3b215d=_0x5f5726[_0xdf3c('0x2f')][_0xdf3c('0x30')];var _0x3fda0a=_0x5f5726[_0xdf3c('0x2f')][_0xdf3c('0x2a')];return getAgent(_0x3b215d)[_0xdf3c('0x20')](function(_0x492396){logger['info'](_0xdf3c('0x33'),_0x492396[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x492396[_0xdf3c('0x1b')]),_0xdf3c('0x43'),{'sessionId':_0x3fda0a});return _0x31c600[_0xdf3c('0x1c')](0xc8)[_0xdf3c('0x39')]({'error':![],'message':_0xdf3c('0x44')});})[_0xdf3c('0x24')](handleError(_0x31c600));};exports[_0xdf3c('0x45')]=function(_0x4cb28f,_0x1eebcf){logger['info']('calls\x20fired:',_0x1eebcf['body']);var _0x58fcbf=callsValidation['validate'](_0x4cb28f[_0xdf3c('0x2f')]);if(_0x58fcbf[_0xdf3c('0x2b')]>0x0){return _0x1eebcf['status'](0x190)[_0xdf3c('0x39')](_0x58fcbf);}var _0x32427e=_0x4cb28f['body'][_0xdf3c('0x30')];var _0x28f935=respondWithRpcPromise(_0xdf3c('0x46'));var _0x1389e0=getAgent(_0x32427e);return Promise[_0xdf3c('0x27')]([_0x28f935,_0x1389e0])[_0xdf3c('0x20')](function(_0xb54629){var _0xdc859=_0xb54629[0x0];var _0x42efa2=_0xb54629[0x1];var _0xa05518=_[_0xdf3c('0x28')](_0xdc859['rows'],function(_0x1ed898){return _0x1ed898[_0xdf3c('0x29')]==_0x42efa2['id'];});return _0x1eebcf[_0xdf3c('0x1c')](0xc8)['json']({'count':_0xa05518[_0xdf3c('0x2b')],'rows':_0xa05518});})[_0xdf3c('0x24')](handleError(_0x1eebcf));};exports[_0xdf3c('0x47')]=function(_0x552264,_0x1effdb){logger[_0xdf3c('0x15')]('conference\x20fired:',_0x552264[_0xdf3c('0x2f')]);var _0x4f8fd6=conferenceValidation[_0xdf3c('0xe')](_0x552264[_0xdf3c('0x2f')]);if(_0x4f8fd6[_0xdf3c('0x2b')]>0x0){return _0x1effdb[_0xdf3c('0x1c')](0x190)[_0xdf3c('0x39')](_0x4f8fd6);}var _0x30e6e1=_0x552264[_0xdf3c('0x2f')][_0xdf3c('0x30')];return getAgent(_0x30e6e1)[_0xdf3c('0x20')](function(_0x330730){logger[_0xdf3c('0x15')](_0xdf3c('0x33'),_0x330730[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x330730[_0xdf3c('0x1b')]),_0xdf3c('0x48'));return _0x1effdb['status'](0xc8)['json']({'error':![],'message':_0xdf3c('0x49')});})[_0xdf3c('0x24')](handleError(_0x1effdb));};exports[_0xdf3c('0x4a')]=function(_0x596282,_0x164e0a){logger['info']('transfer\x20fired:',_0x596282[_0xdf3c('0x2f')]);var _0x399db6=transferValidation[_0xdf3c('0xe')](_0x596282[_0xdf3c('0x2f')]);if(_0x399db6[_0xdf3c('0x2b')]>0x0){return _0x164e0a[_0xdf3c('0x1c')](0x190)[_0xdf3c('0x39')](_0x399db6);}var _0x3ec03a=_0x596282[_0xdf3c('0x2f')][_0xdf3c('0x30')];var _0x1cce9a=_0x596282[_0xdf3c('0x2f')][_0xdf3c('0x2a')];var _0x4be79a=_0x596282[_0xdf3c('0x2f')][_0xdf3c('0x4b')];return getAgent(_0x3ec03a)[_0xdf3c('0x20')](function(_0x16d6ea){logger[_0xdf3c('0x15')]('entityFound:',_0x16d6ea[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x16d6ea[_0xdf3c('0x1b')]),_0xdf3c('0x4c'),{'sessionId':_0x1cce9a,'transferNumber':_0x4be79a});return _0x164e0a[_0xdf3c('0x1c')](0xc8)[_0xdf3c('0x39')]({'error':![],'message':_0xdf3c('0x4d')});})[_0xdf3c('0x24')](handleError(_0x164e0a));}; \ No newline at end of file +var _0xf72b=['originate\x20executed!','hangup','webbar:hangup','answer','userId','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','string','userId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','body','json','callerId','entityFound:','format','user:%s','webbar:originate'];(function(_0x58cda8,_0x40f2ba){var _0x184b68=function(_0x458108){while(--_0x458108){_0x58cda8['push'](_0x58cda8['shift']());}};_0x184b68(++_0x40f2ba);}(_0xf72b,0x1d9));var _0xbf72=function(_0x269674,_0x21bde1){_0x269674=_0x269674-0x0;var _0x530a67=_0xf72b[_0x269674];return _0x530a67;};'use strict';var path=require(_0xbf72('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0xbf72('0x1'))['db'];var config=require('../../config/environment');var util=require(_0xbf72('0x2'));var BPromise=require(_0xbf72('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0xbf72('0x4')][_0xbf72('0x5')]({'port':0x232a});var logger=require(_0xbf72('0x6'))(_0xbf72('0x7'));var Redis=require(_0xbf72('0x8'));config[_0xbf72('0x9')]=_['defaults'](config[_0xbf72('0x9')],{'host':_0xbf72('0xa'),'port':0x18eb});var io=require(_0xbf72('0xb'))(new Redis(config[_0xbf72('0x9')]));var Schema=require(_0xbf72('0xc'));var originateValidation=new Schema({'userId':{'type':_0xbf72('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xbf72('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xbf72('0xe')},'callbackUrl':{'type':_0xbf72('0xe')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xbf72('0xf')]},'sessionId':{'type':_0xbf72('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xbf72('0xd'),'required':[!![],_0xbf72('0xf')]},'sessionId':{'type':_0xbf72('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xbf72('0xd'),'required':[!![],_0xbf72('0xf')]},'sessionId':{'type':_0xbf72('0xe'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xbf72('0xe'),'required':[!![],_0xbf72('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0xbf72('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xbf72('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xbf72('0xd'),'required':[!![],_0xbf72('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0xbf72('0xd'),'required':[!![],_0xbf72('0xf')]}});function emit(_0x39d0cd,_0x160d61,_0x566075){logger[_0xbf72('0x11')](_0x39d0cd,_0x160d61,JSON[_0xbf72('0x12')](_0x566075));io['to'](_0x39d0cd)[_0xbf72('0x13')](_0x160d61,_0x566075);}function handleError(_0x3d4dea){return function(_0x27dadc){console['log']('handleError:',_0x27dadc,_0x27dadc instanceof RangeError);logger[_0xbf72('0x14')](_0x27dadc[_0xbf72('0x15')]);if(_0x27dadc instanceof RangeError){if(_0x27dadc[_0xbf72('0x16')]){delete _0x27dadc[_0xbf72('0x16')];}_0x3d4dea[_0xbf72('0x17')](0x194)[_0xbf72('0x18')](_0x27dadc);}else{if(_0x27dadc[_0xbf72('0x16')]){delete _0x27dadc['name'];}_0x3d4dea[_0xbf72('0x17')](0x1f4)[_0xbf72('0x18')](_0x27dadc);}};}function checkError(){return function(_0xcd9c0b){if(!_0xcd9c0b){throw new RangeError(_0xbf72('0x19'));}return _0xcd9c0b;};}function respondWithRpcPromise(_0x3486f3,_0x5f2537){return new BPromise(function(_0x3cd181,_0x1de926){var _0x536071=amiClient;return _0x536071[_0xbf72('0x1a')](_0x3486f3,_0x5f2537)[_0xbf72('0x1b')](function(_0x267c41){if(_0x267c41['error']){if(_0x267c41[_0xbf72('0x14')][_0xbf72('0x1c')]===0x1f4){return _0x1de926(_0x267c41[_0xbf72('0x14')][_0xbf72('0x1d')]);}return _0x3cd181(_0x267c41['error'][_0xbf72('0x1d')]);}else{_0x3cd181(_0x267c41[_0xbf72('0x1e')]);}})[_0xbf72('0x1f')](function(_0x54fdfe){_0x1de926(_0x54fdfe);});});}function getAgent(_0x3b3171){return db[_0xbf72('0x20')][_0xbf72('0x21')]({'where':{'id':_0x3b3171,'role':_0xbf72('0x22')}})[_0xbf72('0x1b')](checkError());}function getAgentCheckSession(_0x2b1ff1,_0x182154){return new BPromise(function(_0x25ecdf,_0xd418a2){var _0x92307f=respondWithRpcPromise(_0xbf72('0x23'));var _0x20e747=getAgent(_0x2b1ff1);Promise[_0xbf72('0x24')]([_0x92307f,_0x20e747])[_0xbf72('0x1b')](function(_0x37a233){var _0x51f481=_0x37a233[0x0];var _0x708fcb=_0x37a233[0x1];var _0x475a54=_[_0xbf72('0x25')](_0x51f481[_0xbf72('0x26')],function(_0xb1ee4e){return _0xb1ee4e[_0xbf72('0x27')]==_0x708fcb['id']&&_0xb1ee4e[_0xbf72('0x28')]==_0x182154;});if(_0x475a54[_0xbf72('0x29')]==0x1){_0x25ecdf(_0x708fcb);}else{_0xd418a2(new RangeError(_0xbf72('0x2a')+_0x182154+_0xbf72('0x2b')));}});});}exports[_0xbf72('0x2c')]=function(_0x16cf65,_0x423c61){logger[_0xbf72('0x11')]('originate\x20fired:',_0x16cf65[_0xbf72('0x2d')]);var _0x2fae99=originateValidation[_0xbf72('0xc')](_0x16cf65['body']);if(_0x2fae99['length']>0x0){return _0x423c61['status'](0x190)[_0xbf72('0x2e')](_0x2fae99);}var _0x80d176=_0x16cf65[_0xbf72('0x2d')]['userId'];var _0xb058fa=_0x16cf65[_0xbf72('0x2d')]['callNumber'];var _0x1158d3=_0x16cf65['body'][_0xbf72('0x2f')];var _0x202497=_0x16cf65['body']['callbackUrl'];return getAgent(_0x80d176)[_0xbf72('0x1b')](function(_0xc5edc4){logger[_0xbf72('0x11')](_0xbf72('0x30'),_0xc5edc4[_0xbf72('0x16')]);emit(util[_0xbf72('0x31')](_0xbf72('0x32'),_0xc5edc4[_0xbf72('0x16')]),_0xbf72('0x33'),{'callNumber':_0xb058fa,'callerId':_0x1158d3,'callbackUrl':_0x202497});return _0x423c61['status'](0xc8)[_0xbf72('0x2e')]({'error':![],'message':_0xbf72('0x34')});})[_0xbf72('0x1f')](handleError(_0x423c61));};exports[_0xbf72('0x35')]=function(_0x52d6c7,_0xd0a1a8){logger[_0xbf72('0x11')]('hangup\x20fired:',_0x52d6c7[_0xbf72('0x2d')]);var _0x532170=hangupValidation['validate'](_0x52d6c7['body']);if(_0x532170['length']>0x0){return _0xd0a1a8[_0xbf72('0x17')](0x190)['json'](_0x532170);}var _0x5e6749=_0x52d6c7[_0xbf72('0x2d')]['userId'];var _0x1527d3=_0x52d6c7[_0xbf72('0x2d')]['sessionId'];return getAgent(_0x5e6749)[_0xbf72('0x1b')](function(_0x4aee64){logger['info'](_0xbf72('0x30'),_0x4aee64[_0xbf72('0x16')]);emit(util[_0xbf72('0x31')](_0xbf72('0x32'),_0x4aee64[_0xbf72('0x16')]),_0xbf72('0x36'),{'sessionId':_0x1527d3});return _0xd0a1a8[_0xbf72('0x17')](0xc8)[_0xbf72('0x2e')]({'error':![],'message':'hangup\x20executed!'});})[_0xbf72('0x1f')](handleError(_0xd0a1a8));};exports[_0xbf72('0x37')]=function(_0x58d4e8,_0x45dc3a){logger['info']('answer\x20fired:',_0x58d4e8[_0xbf72('0x2d')]);var _0x15e4c7=answerValidation[_0xbf72('0xc')](_0x58d4e8[_0xbf72('0x2d')]);if(_0x15e4c7[_0xbf72('0x29')]>0x0){return _0x45dc3a['status'](0x190)['json'](_0x15e4c7);}var _0x4b8f31=_0x58d4e8[_0xbf72('0x2d')][_0xbf72('0x38')];var _0x3871d0=_0x58d4e8[_0xbf72('0x2d')]['sessionId'];return getAgent(_0x4b8f31)['then'](function(_0x326801){logger['info'](_0xbf72('0x30'),_0x326801[_0xbf72('0x16')]);emit(util[_0xbf72('0x31')](_0xbf72('0x32'),_0x326801['name']),_0xbf72('0x39'),{'sessionId':_0x3871d0});return _0x45dc3a[_0xbf72('0x17')](0xc8)[_0xbf72('0x2e')]({'error':![],'message':_0xbf72('0x3a')});})['catch'](handleError(_0x45dc3a));};exports[_0xbf72('0x3b')]=function(_0x1353be,_0x5f0bd0){logger[_0xbf72('0x11')](_0xbf72('0x3c'),_0x1353be[_0xbf72('0x2d')]);var _0x410fdb=holdValidation[_0xbf72('0xc')](_0x1353be[_0xbf72('0x2d')]);if(_0x410fdb[_0xbf72('0x29')]>0x0){return _0x5f0bd0['status'](0x190)['json'](_0x410fdb);}var _0x5b4bbb=_0x1353be[_0xbf72('0x2d')]['userId'];var _0x2c9891=_0x1353be['body']['sessionId'];return getAgent(_0x5b4bbb)['then'](function(_0x9f94ea){logger[_0xbf72('0x11')](_0xbf72('0x30'),_0x9f94ea[_0xbf72('0x16')]);emit(util[_0xbf72('0x31')](_0xbf72('0x32'),_0x9f94ea['name']),_0xbf72('0x3d'),{'sessionId':_0x2c9891});return _0x5f0bd0['status'](0xc8)[_0xbf72('0x2e')]({'error':![],'message':'hold\x20executed!'});})[_0xbf72('0x1f')](handleError(_0x5f0bd0));};exports[_0xbf72('0x3e')]=function(_0x45e4d5,_0x1fd1f8){logger[_0xbf72('0x11')](_0xbf72('0x3f'),_0x45e4d5[_0xbf72('0x2d')]);var _0x176a59=unholdValidation[_0xbf72('0xc')](_0x45e4d5['body']);if(_0x176a59[_0xbf72('0x29')]>0x0){return _0x1fd1f8[_0xbf72('0x17')](0x190)[_0xbf72('0x2e')](_0x176a59);}var _0x5cfde1=_0x45e4d5[_0xbf72('0x2d')][_0xbf72('0x38')];var _0x1b39e1=_0x45e4d5[_0xbf72('0x2d')][_0xbf72('0x28')];return getAgent(_0x5cfde1)['then'](function(_0x7101e0){logger[_0xbf72('0x11')]('entityFound:',_0x7101e0[_0xbf72('0x16')]);emit(util['format']('user:%s',_0x7101e0[_0xbf72('0x16')]),_0xbf72('0x40'),{'sessionId':_0x1b39e1});return _0x1fd1f8[_0xbf72('0x17')](0xc8)[_0xbf72('0x2e')]({'error':![],'message':_0xbf72('0x41')});})['catch'](handleError(_0x1fd1f8));};exports['calls']=function(_0x5e2e3a,_0x208c63){logger[_0xbf72('0x11')](_0xbf72('0x42'),_0x208c63[_0xbf72('0x2d')]);var _0x5cfbc4=callsValidation['validate'](_0x5e2e3a[_0xbf72('0x2d')]);if(_0x5cfbc4[_0xbf72('0x29')]>0x0){return _0x208c63[_0xbf72('0x17')](0x190)['json'](_0x5cfbc4);}var _0x19f045=_0x5e2e3a['body'][_0xbf72('0x38')];var _0x3da80c=respondWithRpcPromise('VoiceChannels');var _0x2b3c34=getAgent(_0x19f045);return Promise[_0xbf72('0x24')]([_0x3da80c,_0x2b3c34])['then'](function(_0x3c3e31){var _0x46f908=_0x3c3e31[0x0];var _0xa50217=_0x3c3e31[0x1];var _0x4ee0a8=_['filter'](_0x46f908['rows'],function(_0x452847){return _0x452847[_0xbf72('0x27')]==_0xa50217['id'];});return _0x208c63[_0xbf72('0x17')](0xc8)[_0xbf72('0x2e')]({'count':_0x4ee0a8[_0xbf72('0x29')],'rows':_0x4ee0a8});})[_0xbf72('0x1f')](handleError(_0x208c63));};exports[_0xbf72('0x43')]=function(_0x201342,_0x3b0815){logger['info'](_0xbf72('0x44'),_0x201342[_0xbf72('0x2d')]);var _0x581110=conferenceValidation[_0xbf72('0xc')](_0x201342[_0xbf72('0x2d')]);if(_0x581110[_0xbf72('0x29')]>0x0){return _0x3b0815[_0xbf72('0x17')](0x190)[_0xbf72('0x2e')](_0x581110);}var _0x14f8d0=_0x201342[_0xbf72('0x2d')][_0xbf72('0x38')];return getAgent(_0x14f8d0)[_0xbf72('0x1b')](function(_0x537398){logger['info'](_0xbf72('0x30'),_0x537398[_0xbf72('0x16')]);emit(util[_0xbf72('0x31')](_0xbf72('0x32'),_0x537398[_0xbf72('0x16')]),_0xbf72('0x45'));return _0x3b0815[_0xbf72('0x17')](0xc8)[_0xbf72('0x2e')]({'error':![],'message':'conference\x20executed!'});})[_0xbf72('0x1f')](handleError(_0x3b0815));};exports[_0xbf72('0x46')]=function(_0x3fe70d,_0xe4a99f){logger[_0xbf72('0x11')](_0xbf72('0x47'),_0x3fe70d[_0xbf72('0x2d')]);var _0x59495b=transferValidation[_0xbf72('0xc')](_0x3fe70d[_0xbf72('0x2d')]);if(_0x59495b[_0xbf72('0x29')]>0x0){return _0xe4a99f[_0xbf72('0x17')](0x190)[_0xbf72('0x2e')](_0x59495b);}var _0x107391=_0x3fe70d[_0xbf72('0x2d')][_0xbf72('0x38')];var _0x4fb47f=_0x3fe70d[_0xbf72('0x2d')][_0xbf72('0x28')];var _0x17ab12=_0x3fe70d['body'][_0xbf72('0x48')];return getAgent(_0x107391)[_0xbf72('0x1b')](function(_0x59c26a){logger[_0xbf72('0x11')](_0xbf72('0x30'),_0x59c26a['name']);emit(util[_0xbf72('0x31')](_0xbf72('0x32'),_0x59c26a['name']),_0xbf72('0x49'),{'sessionId':_0x4fb47f,'transferNumber':_0x17ab12});return _0xe4a99f[_0xbf72('0x17')](0xc8)[_0xbf72('0x2e')]({'error':![],'message':_0xbf72('0x4a')});})[_0xbf72('0x1f')](handleError(_0xe4a99f));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index eff73c2..c7912c6 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 _0x2a07=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send','send','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x56d412,_0xb69e5b){var _0x43ac13=function(_0x45a523){while(--_0x45a523){_0x56d412['push'](_0x56d412['shift']());}};_0x43ac13(++_0xb69e5b);}(_0x2a07,0x74));var _0x72a0=function(_0x17882c,_0x4b964b){_0x17882c=_0x17882c-0x0;var _0x355a59=_0x2a07[_0x17882c];return _0x355a59;};'use strict';var multer=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var timeout=require(_0x72a0('0x3'));var express=require(_0x72a0('0x4'));var router=express['Router']();var fs_extra=require(_0x72a0('0x5'));var auth=require(_0x72a0('0x6'));var interaction=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var controller=require(_0x72a0('0x9'));router[_0x72a0('0xa')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0xc')]);router[_0x72a0('0xa')](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0xe')]);router[_0x72a0('0xa')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x10')]);router['get'](_0x72a0('0x11'),auth[_0x72a0('0xb')](),controller['getDispositions']);router[_0x72a0('0xa')](_0x72a0('0x12'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x13')]);router[_0x72a0('0xa')]('/:id/users',auth[_0x72a0('0xb')](),controller[_0x72a0('0x14')]);router[_0x72a0('0xa')](_0x72a0('0x15'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x16')]);router[_0x72a0('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0x72a0('0x17')](_0x72a0('0x11'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x18')]);router[_0x72a0('0x17')](_0x72a0('0x12'),auth['isAuthenticated'](),controller[_0x72a0('0x19')]);router[_0x72a0('0x17')](_0x72a0('0x1a'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1b')]);router['post'](_0x72a0('0x15'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1c')]);router['post'](_0x72a0('0x1d'),controller[_0x72a0('0x1e')]);router[_0x72a0('0x17')](_0x72a0('0x1f'),auth['isAuthenticated'](),controller[_0x72a0('0x20')]);router['put'](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x21')]);router['delete'](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x22')]);router[_0x72a0('0x23')]('/:id/dispositions',auth[_0x72a0('0xb')](),controller[_0x72a0('0x24')]);router[_0x72a0('0x23')](_0x72a0('0x12'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x25')]);router['delete']('/:id/users',auth[_0x72a0('0xb')](),controller[_0x72a0('0x26')]);module[_0x72a0('0x27')]=router; \ No newline at end of file +var _0xf61e=['getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','post','create','addDisposition','addAnswer','addAgents','/:id/applications','addApplications','notify','send','put','/:id','update','delete','destroy','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','isAuthenticated','describe','show','/:id/dispositions'];(function(_0x53402c,_0x49b2d9){var _0x2c47e4=function(_0x3bc9f7){while(--_0x3bc9f7){_0x53402c['push'](_0x53402c['shift']());}};_0x2c47e4(++_0x49b2d9);}(_0xf61e,0x191));var _0xef61=function(_0xc87059,_0x3751dd){_0xc87059=_0xc87059-0x0;var _0x4b5abb=_0xf61e[_0xc87059];return _0x4b5abb;};'use strict';var multer=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var path=require(_0xef61('0x2'));var timeout=require(_0xef61('0x3'));var express=require(_0xef61('0x4'));var router=express[_0xef61('0x5')]();var fs_extra=require(_0xef61('0x6'));var auth=require(_0xef61('0x7'));var interaction=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var controller=require(_0xef61('0xa'));router[_0xef61('0xb')]('/',auth['isAuthenticated'](),controller[_0xef61('0xc')]);router[_0xef61('0xb')]('/describe',auth[_0xef61('0xd')](),controller[_0xef61('0xe')]);router[_0xef61('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xef61('0xf')]);router[_0xef61('0xb')](_0xef61('0x10'),auth[_0xef61('0xd')](),controller[_0xef61('0x11')]);router[_0xef61('0xb')](_0xef61('0x12'),auth[_0xef61('0xd')](),controller[_0xef61('0x13')]);router[_0xef61('0xb')](_0xef61('0x14'),auth[_0xef61('0xd')](),controller[_0xef61('0x15')]);router[_0xef61('0xb')]('/:id/applications',auth[_0xef61('0xd')](),controller['getApplications']);router[_0xef61('0x16')]('/',auth[_0xef61('0xd')](),controller[_0xef61('0x17')]);router[_0xef61('0x16')]('/:id/dispositions',auth[_0xef61('0xd')](),controller[_0xef61('0x18')]);router[_0xef61('0x16')](_0xef61('0x12'),auth['isAuthenticated'](),controller[_0xef61('0x19')]);router[_0xef61('0x16')]('/:id/users',auth[_0xef61('0xd')](),controller[_0xef61('0x1a')]);router[_0xef61('0x16')](_0xef61('0x1b'),auth[_0xef61('0xd')](),controller[_0xef61('0x1c')]);router[_0xef61('0x16')]('/:id/notify',controller[_0xef61('0x1d')]);router[_0xef61('0x16')]('/:id/send',auth[_0xef61('0xd')](),controller[_0xef61('0x1e')]);router[_0xef61('0x1f')](_0xef61('0x20'),auth[_0xef61('0xd')](),controller[_0xef61('0x21')]);router[_0xef61('0x22')]('/:id',auth['isAuthenticated'](),controller[_0xef61('0x23')]);router['delete'](_0xef61('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xef61('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xef61('0x24')]);router[_0xef61('0x22')](_0xef61('0x14'),auth[_0xef61('0xd')](),controller['removeAgents']);module[_0xef61('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 adbb327..2d8e0af 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 _0x92e0=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x45c247,_0xbc6a5c){var _0x387f3f=function(_0x5ea91a){while(--_0x5ea91a){_0x45c247['push'](_0x45c247['shift']());}};_0x387f3f(++_0xbc6a5c);}(_0x92e0,0x104));var _0x092e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92e0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x092e('0x0'));module[_0x092e('0x1')]={'name':{'type':Sequelize[_0x092e('0x2')],'unique':_0x092e('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x092e('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x092e('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x092e('0x2')],'defaultValue':function(){return rs[_0x092e('0x4')]();}},'phone':{'type':Sequelize[_0x092e('0x2')]},'type':{'type':Sequelize[_0x092e('0x5')]('twilio')},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x092e('0x2')]},'notificationTemplate':{'type':Sequelize[_0x092e('0x6')],'defaultValue':function(){return _0x092e('0x7');}},'notificationSound':{'type':Sequelize[_0x092e('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x092e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x092e('0x9')],'comment':_0x092e('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x092e('0x8')],'defaultValue':![],'comment':_0x092e('0xb'),'set':function(_0x29355b){if(!_0x29355b){this[_0x092e('0xc')](_0x092e('0xd'),null);}this[_0x092e('0xc')](_0x092e('0xe'),_0x29355b);}},'description':{'type':Sequelize[_0x092e('0x2')]}}; \ No newline at end of file +var _0xe718=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x4d1b26,_0x3e2c39){var _0xee7124=function(_0x2e4446){while(--_0x2e4446){_0x4d1b26['push'](_0x4d1b26['shift']());}};_0xee7124(++_0x3e2c39);}(_0xe718,0x9e));var _0x8e71=function(_0x305b20,_0x5e57e9){_0x305b20=_0x305b20-0x0;var _0x26d64a=_0xe718[_0x305b20];return _0x26d64a;};'use strict';var Sequelize=require(_0x8e71('0x0'));var rs=require(_0x8e71('0x1'));module[_0x8e71('0x2')]={'name':{'type':Sequelize[_0x8e71('0x3')],'unique':_0x8e71('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x8e71('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x8e71('0x3')],'defaultValue':function(){return rs[_0x8e71('0x5')]();}},'phone':{'type':Sequelize[_0x8e71('0x3')]},'type':{'type':Sequelize[_0x8e71('0x6')](_0x8e71('0x7'))},'accountSid':{'type':Sequelize[_0x8e71('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x8e71('0x8');}},'notificationSound':{'type':Sequelize[_0x8e71('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8e71('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8e71('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8e71('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8e71('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8e71('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x8e71('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x8e71('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x22ec51){if(!_0x22ec51){this[_0x8e71('0xc')](_0x8e71('0xd'),null);}this[_0x8e71('0xc')]('mandatoryDisposition',_0x22ec51);}},'description':{'type':Sequelize[_0x8e71('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 211a865..607ab35 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 _0x1c45=['from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','list','contact','interaction','created','autoclose','push','close','unmanaged','messageId','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','to\x20is\x20mandatory','List','DESC','ListId','WhatsappInteraction','out','WhatsappMessage','Messages','dataValues','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','Pause','map','WhatsappAccount','rawAttributes','type','key','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','keys','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','Applications','applications','orderBy','asc','Sequelize','ValidationError','updatedAt','createdAt','CompanyId','mobile','account','twilio','from','From','whatsapp:','Body','MessageSid','isNil'];(function(_0x264f26,_0xad3f53){var _0x482eff=function(_0x319385){while(--_0x319385){_0x264f26['push'](_0x264f26['shift']());}};_0x482eff(++_0xad3f53);}(_0x1c45,0xe1));var _0x51c4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1c45[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x51c4('0x0'));var zipdir=require(_0x51c4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51c4('0x2'));var moment=require(_0x51c4('0x3'));var BPromise=require(_0x51c4('0x4'));var Mustache=require(_0x51c4('0x5'));var util=require(_0x51c4('0x6'));var path=require('path');var sox=require(_0x51c4('0x7'));var csv=require(_0x51c4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51c4('0x9'));var _=require(_0x51c4('0xa'));var squel=require(_0x51c4('0xb'));var crypto=require(_0x51c4('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x51c4('0x8'));var querystring=require(_0x51c4('0xd'));var Papa=require(_0x51c4('0xe'));var Redis=require(_0x51c4('0xf'));var authService=require(_0x51c4('0x10'));var qs=require(_0x51c4('0x11'));var as=require(_0x51c4('0x12'));var hardwareService=require(_0x51c4('0x13'));var logger=require('../../config/logger')(_0x51c4('0x14'));var utils=require(_0x51c4('0x15'));var config=require(_0x51c4('0x16'));var licenseUtil=require(_0x51c4('0x17'));var db=require('../../mysqldb')['db'];config[_0x51c4('0x18')]=_[_0x51c4('0x19')](config[_0x51c4('0x18')],{'host':_0x51c4('0x1a'),'port':0x18eb});var socket=require(_0x51c4('0x1b'))(new Redis(config[_0x51c4('0x18')]));require(_0x51c4('0x1c'))[_0x51c4('0x1d')](socket);var jayson=require(_0x51c4('0x1e'));var client=jayson[_0x51c4('0x1f')][_0x51c4('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x45557a,_0x1b119a,_0x120a41,_0x45d058){return new BPromise(function(_0x3b691a,_0x2e4037){var _0x5256f1=_0x45d058||client;return _0x5256f1[_0x51c4('0x21')](_0x45557a,_0x120a41)[_0x51c4('0x22')](function(_0x3c78f7){logger[_0x51c4('0x23')](_0x51c4('0x24'),_0x1b119a,_0x51c4('0x25'));logger[_0x51c4('0x26')](_0x51c4('0x27'),_0x1b119a,_0x51c4('0x25'),JSON[_0x51c4('0x28')](_0x3c78f7));if(_0x3c78f7['error']){if(_0x3c78f7[_0x51c4('0x29')][_0x51c4('0x2a')]===0x1f4){logger[_0x51c4('0x29')](_0x51c4('0x24'),_0x1b119a,_0x3c78f7[_0x51c4('0x29')]['message']);return _0x2e4037(_0x3c78f7[_0x51c4('0x29')][_0x51c4('0x2b')]);}logger[_0x51c4('0x29')](_0x51c4('0x24'),_0x1b119a,_0x3c78f7[_0x51c4('0x29')][_0x51c4('0x2b')]);return _0x3b691a(_0x3c78f7[_0x51c4('0x29')][_0x51c4('0x2b')]);}else{logger['info'](_0x51c4('0x24'),_0x1b119a,_0x51c4('0x25'));_0x3b691a(_0x3c78f7[_0x51c4('0x2c')][_0x51c4('0x2b')]);}})['catch'](function(_0x4c619f){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1b119a,_0x4c619f);_0x2e4037(_0x4c619f);});});}function respondWithStatusCode(_0x4df253,_0x2184e7){_0x2184e7=_0x2184e7||0xcc;return function(_0x58e586){if(_0x58e586){return _0x4df253[_0x51c4('0x2d')](_0x2184e7);}return _0x4df253[_0x51c4('0x2e')](_0x2184e7)[_0x51c4('0x2f')]();};}function respondWithResult(_0x173d9d,_0x15e9ba){_0x15e9ba=_0x15e9ba||0xc8;return function(_0x589e75){if(_0x589e75){return _0x173d9d[_0x51c4('0x2e')](_0x15e9ba)['json'](_0x589e75);}};}function respondWithFilteredResult(_0x42b053,_0x25dadc){return function(_0x49a810){if(_0x49a810){var _0x3b51f3=typeof _0x25dadc[_0x51c4('0x30')]===_0x51c4('0x31')&&typeof _0x25dadc[_0x51c4('0x32')]===_0x51c4('0x31');var _0x516f1d=_0x49a810[_0x51c4('0x33')];var _0x25e8b2=_0x3b51f3?0x0:_0x25dadc[_0x51c4('0x30')];var _0x25b2f4=_0x3b51f3?_0x49a810[_0x51c4('0x33')]:_0x25dadc[_0x51c4('0x30')]+_0x25dadc[_0x51c4('0x32')];var _0x1c7e66;if(_0x25b2f4>=_0x516f1d){_0x25b2f4=_0x516f1d;_0x1c7e66=0xc8;}else{_0x1c7e66=0xce;}_0x42b053[_0x51c4('0x2e')](_0x1c7e66);return _0x42b053[_0x51c4('0x34')](_0x51c4('0x35'),_0x25e8b2+'-'+_0x25b2f4+'/'+_0x516f1d)['json'](_0x49a810);}return null;};}function patchUpdates(_0xf9f772){return function(_0x315a07){try{jsonpatch['apply'](_0x315a07,_0xf9f772,!![]);}catch(_0x3f74dc){return BPromise[_0x51c4('0x36')](_0x3f74dc);}return _0x315a07[_0x51c4('0x37')]();};}function saveUpdates(_0x577fdd,_0xa0a1c){return function(_0x318c7d){if(_0x318c7d){return _0x318c7d[_0x51c4('0x38')](_0x577fdd)['then'](function(_0x4d6270){return _0x4d6270;});}return null;};}function removeEntity(_0x525d6d,_0x2ff066){return function(_0x2074f4){if(_0x2074f4){return _0x2074f4[_0x51c4('0x39')]()['then'](function(){var _0x79a024=_0x2074f4[_0x51c4('0x3a')]({'plain':!![]});var _0x3cff7f=_0x51c4('0x3b');return db[_0x51c4('0x3c')]['destroy']({'where':{'type':_0x3cff7f,'resourceId':_0x79a024['id']}})[_0x51c4('0x22')](function(){return _0x2074f4;});})[_0x51c4('0x22')](function(){_0x525d6d[_0x51c4('0x2e')](0xcc)[_0x51c4('0x2f')]();});}};}function handleEntityNotFound(_0x2ce7ea,_0x1672e3){return function(_0x1afdde){if(!_0x1afdde){_0x2ce7ea[_0x51c4('0x2d')](0x194);}return _0x1afdde;};}function handleError(_0x11efc4,_0x1fb8ba){_0x1fb8ba=_0x1fb8ba||0x1f4;return function(_0x3491c9){logger[_0x51c4('0x29')](_0x3491c9[_0x51c4('0x3d')]);if(_0x3491c9['name']){delete _0x3491c9[_0x51c4('0x3e')];}_0x11efc4[_0x51c4('0x2e')](_0x1fb8ba)[_0x51c4('0x3f')](_0x3491c9);};}exports['index']=function(_0x521f77,_0x3516f0){var _0x5a2d19={'include':[{'model':db[_0x51c4('0x40')],'as':'mandatoryDispositionPause'}]},_0x37226c={},_0x4ef079={'count':0x0,'rows':[]};var _0x50fbd1=_[_0x51c4('0x41')](db[_0x51c4('0x42')][_0x51c4('0x43')],function(_0x45909d){return{'name':_0x45909d['fieldName'],'type':_0x45909d[_0x51c4('0x44')][_0x51c4('0x45')]};});_0x37226c['model']=_[_0x51c4('0x41')](_0x50fbd1,'name');_0x37226c[_0x51c4('0x46')]=_['keys'](_0x521f77[_0x51c4('0x46')]);_0x37226c[_0x51c4('0x47')]=_['intersection'](_0x37226c[_0x51c4('0x48')],_0x37226c['query']);_0x5a2d19[_0x51c4('0x49')]=_['intersection'](_0x37226c[_0x51c4('0x48')],qs[_0x51c4('0x4a')](_0x521f77[_0x51c4('0x46')][_0x51c4('0x4a')]));_0x5a2d19['attributes']=_0x5a2d19[_0x51c4('0x49')][_0x51c4('0x4b')]?_0x5a2d19[_0x51c4('0x49')]:_0x37226c[_0x51c4('0x48')];if(!_0x521f77[_0x51c4('0x46')][_0x51c4('0x4c')](_0x51c4('0x4d'))){_0x5a2d19[_0x51c4('0x32')]=qs[_0x51c4('0x32')](_0x521f77['query'][_0x51c4('0x32')]);_0x5a2d19['offset']=qs[_0x51c4('0x30')](_0x521f77[_0x51c4('0x46')][_0x51c4('0x30')]);}_0x5a2d19[_0x51c4('0x4e')]=qs[_0x51c4('0x4f')](_0x521f77[_0x51c4('0x46')][_0x51c4('0x4f')]);_0x5a2d19[_0x51c4('0x50')]=qs['filters'](_[_0x51c4('0x51')](_0x521f77['query'],_0x37226c[_0x51c4('0x47')]),_0x50fbd1);if(_0x521f77['query']['filter']){_0x5a2d19['where']=_['merge'](_0x5a2d19[_0x51c4('0x50')],{'$or':_[_0x51c4('0x41')](_0x50fbd1,function(_0x43eba2){if(_0x43eba2[_0x51c4('0x44')]!==_0x51c4('0x52')){var _0x4e5458={};_0x4e5458[_0x43eba2[_0x51c4('0x3e')]]={'$like':'%'+_0x521f77['query'][_0x51c4('0x53')]+'%'};return _0x4e5458;}})});}_0x5a2d19=_[_0x51c4('0x54')]({},_0x5a2d19,_0x521f77['options']);var _0x19f806={'where':_0x5a2d19[_0x51c4('0x50')]};return db[_0x51c4('0x42')]['count'](_0x19f806)[_0x51c4('0x22')](function(_0xd11f3){_0x4ef079[_0x51c4('0x33')]=_0xd11f3;if(_0x521f77[_0x51c4('0x46')][_0x51c4('0x55')]){_0x5a2d19[_0x51c4('0x56')]=[{'all':!![]}];}return db[_0x51c4('0x42')][_0x51c4('0x57')](_0x5a2d19);})[_0x51c4('0x22')](function(_0x129f31){_0x4ef079[_0x51c4('0x58')]=_0x129f31;return _0x4ef079;})[_0x51c4('0x22')](respondWithFilteredResult(_0x3516f0,_0x5a2d19))[_0x51c4('0x59')](handleError(_0x3516f0,null));};exports[_0x51c4('0x5a')]=function(_0xf77206,_0x2db702){var _0x32e44a={'raw':![],'where':{'id':_0xf77206[_0x51c4('0x5b')]['id']},'include':[{'model':db[_0x51c4('0x40')],'as':_0x51c4('0x5c')}]},_0x10f8f9={};_0x10f8f9['model']=_['keys'](db[_0x51c4('0x42')][_0x51c4('0x43')]);_0x10f8f9[_0x51c4('0x46')]=_[_0x51c4('0x5d')](_0xf77206[_0x51c4('0x46')]);_0x10f8f9['filters']=_[_0x51c4('0x5e')](_0x10f8f9['model'],_0x10f8f9[_0x51c4('0x46')]);_0x32e44a[_0x51c4('0x49')]=_[_0x51c4('0x5e')](_0x10f8f9[_0x51c4('0x48')],qs[_0x51c4('0x4a')](_0xf77206[_0x51c4('0x46')][_0x51c4('0x4a')]));_0x32e44a[_0x51c4('0x49')]=_0x32e44a[_0x51c4('0x49')]['length']?_0x32e44a[_0x51c4('0x49')]:_0x10f8f9[_0x51c4('0x48')];if(_0xf77206['query'][_0x51c4('0x55')]){_0x32e44a[_0x51c4('0x56')]=[{'all':!![]}];}_0x32e44a=_[_0x51c4('0x54')]({},_0x32e44a,_0xf77206[_0x51c4('0x5f')]);return db[_0x51c4('0x42')][_0x51c4('0x60')](_0x32e44a)[_0x51c4('0x22')](handleEntityNotFound(_0x2db702,null))[_0x51c4('0x22')](respondWithResult(_0x2db702,null))['catch'](handleError(_0x2db702,null));};exports[_0x51c4('0x61')]=function(_0x5aecd3,_0x27ab3d){return db['WhatsappAccount'][_0x51c4('0x61')](_0x5aecd3[_0x51c4('0x62')],{})[_0x51c4('0x22')](function(_0x46cc61){var _0x40f4b6=_0x5aecd3[_0x51c4('0x63')][_0x51c4('0x3a')]({'plain':!![]});if(!_0x40f4b6)throw new Error(_0x51c4('0x64'));if(_0x40f4b6[_0x51c4('0x65')]===_0x51c4('0x63')){var _0x2474d1=_0x46cc61[_0x51c4('0x3a')]({'plain':!![]});var _0x45cc11=_0x51c4('0x3b');return db[_0x51c4('0x66')][_0x51c4('0x60')]({'where':{'name':_0x45cc11,'userProfileId':_0x40f4b6['userProfileId']},'raw':!![]})[_0x51c4('0x22')](function(_0x5b4d24){if(_0x5b4d24&&_0x5b4d24[_0x51c4('0x67')]===0x0){return db['UserProfileResource']['create']({'name':_0x2474d1[_0x51c4('0x3e')],'resourceId':_0x2474d1['id'],'type':_0x5b4d24['name'],'sectionId':_0x5b4d24['id']},{})['then'](function(){return _0x46cc61;});}else{return _0x46cc61;}})[_0x51c4('0x59')](function(_0x26770c){logger[_0x51c4('0x29')](_0x51c4('0x68'),_0x26770c);throw _0x26770c;});}return _0x46cc61;})[_0x51c4('0x22')](respondWithResult(_0x27ab3d,0xc9))[_0x51c4('0x59')](handleError(_0x27ab3d,null));};exports[_0x51c4('0x38')]=function(_0x1ab7a3,_0x5336b4){if(_0x1ab7a3[_0x51c4('0x62')]['id']){delete _0x1ab7a3[_0x51c4('0x62')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x1ab7a3['params']['id']},'include':[{'model':db[_0x51c4('0x40')],'as':_0x51c4('0x5c')}]})['then'](handleEntityNotFound(_0x5336b4,null))[_0x51c4('0x22')](saveUpdates(_0x1ab7a3['body'],null))[_0x51c4('0x22')](respondWithResult(_0x5336b4,null))[_0x51c4('0x59')](handleError(_0x5336b4,null));};exports['destroy']=function(_0x4d555b,_0x1db484){return db[_0x51c4('0x42')][_0x51c4('0x60')]({'where':{'id':_0x4d555b[_0x51c4('0x5b')]['id']}})[_0x51c4('0x22')](handleEntityNotFound(_0x1db484,null))[_0x51c4('0x22')](removeEntity(_0x1db484,null))[_0x51c4('0x59')](handleError(_0x1db484,null));};exports['describe']=function(_0x2bb238,_0x5d0e12){return db[_0x51c4('0x42')][_0x51c4('0x69')]()['then'](respondWithResult(_0x5d0e12,null))[_0x51c4('0x59')](handleError(_0x5d0e12,null));};exports[_0x51c4('0x6a')]=function(_0x2acc86,_0x485b3b,_0x157335){if(_0x2acc86[_0x51c4('0x62')]['id']){delete _0x2acc86['body']['id'];}return db[_0x51c4('0x42')][_0x51c4('0x60')]({'where':{'id':_0x2acc86[_0x51c4('0x5b')]['id']}})[_0x51c4('0x22')](handleEntityNotFound(_0x485b3b,null))[_0x51c4('0x22')](function(_0x138728){if(_0x138728){_0x2acc86[_0x51c4('0x62')][_0x51c4('0x6b')]=_0x138728['id'];return db['Disposition'][_0x51c4('0x61')](_0x2acc86[_0x51c4('0x62')]);}})[_0x51c4('0x22')](respondWithResult(_0x485b3b,null))[_0x51c4('0x59')](handleError(_0x485b3b,null));};exports[_0x51c4('0x6c')]=function(_0x105e65,_0x328f29,_0x26dcd0){var _0x196d3c={'raw':![],'where':{}};var _0x173252={};var _0x3e52be={'count':0x0,'rows':[]};return db[_0x51c4('0x42')][_0x51c4('0x6d')]({'where':{'id':_0x105e65[_0x51c4('0x5b')]['id']}})[_0x51c4('0x22')](handleEntityNotFound(_0x328f29,null))[_0x51c4('0x22')](function(_0x330164){if(_0x330164){_0x173252['model']=_[_0x51c4('0x5d')](db[_0x51c4('0x6e')][_0x51c4('0x43')]);_0x173252[_0x51c4('0x46')]=_[_0x51c4('0x5d')](_0x105e65[_0x51c4('0x46')]);_0x173252['filters']=_[_0x51c4('0x5e')](_0x173252[_0x51c4('0x48')],_0x173252[_0x51c4('0x46')]);_0x196d3c[_0x51c4('0x49')]=_['intersection'](_0x173252[_0x51c4('0x48')],qs[_0x51c4('0x4a')](_0x105e65[_0x51c4('0x46')][_0x51c4('0x4a')]));_0x196d3c[_0x51c4('0x49')]=_0x196d3c[_0x51c4('0x49')][_0x51c4('0x4b')]?_0x196d3c[_0x51c4('0x49')]:_0x173252[_0x51c4('0x48')];if(!_0x105e65[_0x51c4('0x46')][_0x51c4('0x4c')](_0x51c4('0x4d'))){_0x196d3c[_0x51c4('0x32')]=qs[_0x51c4('0x32')](_0x105e65[_0x51c4('0x46')]['limit']);_0x196d3c[_0x51c4('0x30')]=qs[_0x51c4('0x30')](_0x105e65[_0x51c4('0x46')][_0x51c4('0x30')]);}_0x196d3c[_0x51c4('0x4e')]=qs[_0x51c4('0x4f')](_0x105e65[_0x51c4('0x46')]['sort']);_0x196d3c[_0x51c4('0x50')]=qs[_0x51c4('0x47')](_['pick'](_0x105e65[_0x51c4('0x46')],_0x173252['filters']));_0x196d3c['where'][_0x51c4('0x6b')]=_0x330164['id'];if(_0x105e65[_0x51c4('0x46')][_0x51c4('0x53')]){_0x196d3c[_0x51c4('0x50')]=_[_0x51c4('0x54')](_0x196d3c[_0x51c4('0x50')],{'$or':_['map'](_0x196d3c[_0x51c4('0x49')],function(_0x21454b){var _0x4af82d={};_0x4af82d[_0x21454b]={'$like':'%'+_0x105e65[_0x51c4('0x46')][_0x51c4('0x53')]+'%'};return _0x4af82d;})});}_0x196d3c=_[_0x51c4('0x54')]({},_0x196d3c,_0x105e65['options']);return db['Disposition'][_0x51c4('0x33')]({'where':_0x196d3c[_0x51c4('0x50')]})[_0x51c4('0x22')](function(_0x2ff4ae){_0x3e52be[_0x51c4('0x33')]=_0x2ff4ae;if(_0x105e65['query'][_0x51c4('0x55')]){_0x196d3c[_0x51c4('0x56')]=[{'all':!![]}];}return db[_0x51c4('0x6e')][_0x51c4('0x57')](_0x196d3c);})['then'](function(_0x3fe4b3){_0x3e52be['rows']=_0x3fe4b3;return _0x3e52be;});}})[_0x51c4('0x22')](respondWithFilteredResult(_0x328f29,_0x196d3c))[_0x51c4('0x59')](handleError(_0x328f29,null));};exports[_0x51c4('0x6f')]=function(_0x5c4d97,_0x57045b,_0x5dfe58){return db['WhatsappAccount'][_0x51c4('0x60')]({'where':{'id':_0x5c4d97['params']['id']}})[_0x51c4('0x22')](handleEntityNotFound(_0x57045b,null))[_0x51c4('0x22')](function(_0x243216){if(_0x243216){return _0x243216[_0x51c4('0x6f')](_0x5c4d97['query'][_0x51c4('0x70')]);}})[_0x51c4('0x22')](respondWithStatusCode(_0x57045b,null))[_0x51c4('0x59')](handleError(_0x57045b,null));};exports[_0x51c4('0x71')]=function(_0x310466,_0x284588,_0x20f7b7){if(_0x310466['body']['id']){delete _0x310466[_0x51c4('0x62')]['id'];}return db[_0x51c4('0x42')][_0x51c4('0x60')]({'where':{'id':_0x310466['params']['id']}})[_0x51c4('0x22')](handleEntityNotFound(_0x284588,null))[_0x51c4('0x22')](function(_0x2dbc60){if(_0x2dbc60){_0x310466['body'][_0x51c4('0x6b')]=_0x2dbc60['id'];return db[_0x51c4('0x72')][_0x51c4('0x61')](_0x310466['body']);}})['then'](respondWithResult(_0x284588,null))[_0x51c4('0x59')](handleError(_0x284588,null));};exports[_0x51c4('0x73')]=function(_0x37ef31,_0x2280e7,_0x34f4a5){var _0x46c56a={'raw':![],'where':{}};var _0x11911f={};var _0x3d4065={'count':0x0,'rows':[]};return db[_0x51c4('0x42')][_0x51c4('0x6d')]({'where':{'id':_0x37ef31[_0x51c4('0x5b')]['id']}})[_0x51c4('0x22')](handleEntityNotFound(_0x2280e7,null))[_0x51c4('0x22')](function(_0x34b4d1){if(_0x34b4d1){_0x11911f[_0x51c4('0x48')]=_[_0x51c4('0x5d')](db[_0x51c4('0x72')][_0x51c4('0x43')]);_0x11911f[_0x51c4('0x46')]=_['keys'](_0x37ef31[_0x51c4('0x46')]);_0x11911f[_0x51c4('0x47')]=_[_0x51c4('0x5e')](_0x11911f[_0x51c4('0x48')],_0x11911f[_0x51c4('0x46')]);_0x46c56a[_0x51c4('0x49')]=_[_0x51c4('0x5e')](_0x11911f['model'],qs[_0x51c4('0x4a')](_0x37ef31[_0x51c4('0x46')]['fields']));_0x46c56a[_0x51c4('0x49')]=_0x46c56a[_0x51c4('0x49')][_0x51c4('0x4b')]?_0x46c56a['attributes']:_0x11911f[_0x51c4('0x48')];if(!_0x37ef31[_0x51c4('0x46')][_0x51c4('0x4c')](_0x51c4('0x4d'))){_0x46c56a[_0x51c4('0x32')]=qs[_0x51c4('0x32')](_0x37ef31[_0x51c4('0x46')][_0x51c4('0x32')]);_0x46c56a['offset']=qs[_0x51c4('0x30')](_0x37ef31[_0x51c4('0x46')][_0x51c4('0x30')]);}_0x46c56a['order']=qs[_0x51c4('0x4f')](_0x37ef31[_0x51c4('0x46')][_0x51c4('0x4f')]);_0x46c56a['where']=qs[_0x51c4('0x47')](_[_0x51c4('0x51')](_0x37ef31[_0x51c4('0x46')],_0x11911f['filters']));_0x46c56a[_0x51c4('0x50')][_0x51c4('0x6b')]=_0x34b4d1['id'];if(_0x37ef31[_0x51c4('0x46')][_0x51c4('0x53')]){_0x46c56a['where']=_[_0x51c4('0x54')](_0x46c56a['where'],{'$or':_['map'](_0x46c56a[_0x51c4('0x49')],function(_0x12e3ef){var _0xccdb3f={};_0xccdb3f[_0x12e3ef]={'$like':'%'+_0x37ef31['query'][_0x51c4('0x53')]+'%'};return _0xccdb3f;})});}_0x46c56a=_['merge']({},_0x46c56a,_0x37ef31['options']);return db[_0x51c4('0x72')][_0x51c4('0x33')]({'where':_0x46c56a['where']})[_0x51c4('0x22')](function(_0x1144f9){_0x3d4065['count']=_0x1144f9;if(_0x37ef31[_0x51c4('0x46')][_0x51c4('0x55')]){_0x46c56a[_0x51c4('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0x51c4('0x57')](_0x46c56a);})['then'](function(_0x44d93f){_0x3d4065[_0x51c4('0x58')]=_0x44d93f;return _0x3d4065;});}})[_0x51c4('0x22')](respondWithFilteredResult(_0x2280e7,_0x46c56a))[_0x51c4('0x59')](handleError(_0x2280e7,null));};exports[_0x51c4('0x74')]=function(_0x4c1b28,_0x4a440e,_0xb1b881){return db[_0x51c4('0x42')][_0x51c4('0x60')]({'where':{'id':_0x4c1b28[_0x51c4('0x5b')]['id']}})[_0x51c4('0x22')](handleEntityNotFound(_0x4a440e,null))[_0x51c4('0x22')](function(_0x30198a){if(_0x30198a){return _0x30198a[_0x51c4('0x74')](_0x4c1b28[_0x51c4('0x46')]['ids']);}})[_0x51c4('0x22')](respondWithStatusCode(_0x4a440e,null))['catch'](handleError(_0x4a440e,null));};exports[_0x51c4('0x75')]=function(_0x38449e,_0x3fc2b4,_0x17755b){return db[_0x51c4('0x42')]['find']({'where':{'id':_0x38449e[_0x51c4('0x5b')]['id']}})[_0x51c4('0x22')](handleEntityNotFound(_0x3fc2b4,null))[_0x51c4('0x22')](function(_0x4c2233){if(_0x4c2233){return _0x4c2233[_0x51c4('0x75')](_0x38449e[_0x51c4('0x62')][_0x51c4('0x70')],_[_0x51c4('0x76')](_0x38449e[_0x51c4('0x62')],[_0x51c4('0x70'),'id'])||{})[_0x51c4('0x77')](function(_0x122b3e){for(var _0x4aac5d=0x0;_0x4aac5d<_0x38449e['body'][_0x51c4('0x70')][_0x51c4('0x4b')];_0x4aac5d+=0x1){socket[_0x51c4('0x78')]('userWhatsappAccount:save',{'UserId':Number(_0x38449e['body'][_0x51c4('0x70')][_0x4aac5d]),'WhatsappAccountId':Number(_0x38449e[_0x51c4('0x5b')]['id'])});}return _0x122b3e;});}})[_0x51c4('0x22')](respondWithResult(_0x3fc2b4,null))[_0x51c4('0x59')](handleError(_0x3fc2b4,null));};exports[_0x51c4('0x79')]=function(_0x58606b,_0x31b101,_0x94f49){return db[_0x51c4('0x42')][_0x51c4('0x60')]({'where':{'id':_0x58606b[_0x51c4('0x5b')]['id']}})[_0x51c4('0x22')](handleEntityNotFound(_0x31b101,null))['then'](function(_0x36d56f){if(_0x36d56f){return _0x36d56f[_0x51c4('0x79')](_0x58606b['query']['ids'])['then'](function(){if(_[_0x51c4('0x7a')](_0x58606b[_0x51c4('0x46')][_0x51c4('0x70')])){for(var _0x3f6da9=0x0;_0x3f6da9<_0x58606b[_0x51c4('0x46')]['ids']['length'];_0x3f6da9+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x58606b['query'][_0x51c4('0x70')][_0x3f6da9]),'WhatsappAccountId':Number(_0x58606b['params']['id'])});}}else{socket[_0x51c4('0x78')](_0x51c4('0x7b'),{'UserId':Number(_0x58606b[_0x51c4('0x46')][_0x51c4('0x70')]),'WhatsappAccountId':Number(_0x58606b['params']['id'])});}});}})[_0x51c4('0x22')](respondWithStatusCode(_0x31b101,null))[_0x51c4('0x59')](handleError(_0x31b101,null));};exports[_0x51c4('0x7c')]=function(_0x1e5fb8,_0x5ab043,_0x3ea821){var _0x19c431={};var _0x14824b={};var _0x3562e1;var _0x221d19;return db[_0x51c4('0x42')][_0x51c4('0x6d')]({'where':{'id':_0x1e5fb8[_0x51c4('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5ab043,null))['then'](function(_0xcf7204){if(_0xcf7204){_0x3562e1=_0xcf7204;_0x14824b['model']=_[_0x51c4('0x5d')](db[_0x51c4('0x7d')][_0x51c4('0x43')]);_0x14824b[_0x51c4('0x46')]=_[_0x51c4('0x5d')](_0x1e5fb8['query']);_0x14824b[_0x51c4('0x47')]=_['intersection'](_0x14824b[_0x51c4('0x48')],_0x14824b[_0x51c4('0x46')]);_0x19c431[_0x51c4('0x49')]=_['intersection'](_0x14824b[_0x51c4('0x48')],qs[_0x51c4('0x4a')](_0x1e5fb8[_0x51c4('0x46')][_0x51c4('0x4a')]));_0x19c431[_0x51c4('0x49')]=_0x19c431[_0x51c4('0x49')][_0x51c4('0x4b')]?_0x19c431[_0x51c4('0x49')]:_0x14824b[_0x51c4('0x48')];_0x19c431[_0x51c4('0x4e')]=qs[_0x51c4('0x4f')](_0x1e5fb8[_0x51c4('0x46')]['sort']);_0x19c431[_0x51c4('0x50')]=qs[_0x51c4('0x47')](_[_0x51c4('0x51')](_0x1e5fb8[_0x51c4('0x46')],_0x14824b['filters']));if(_0x1e5fb8[_0x51c4('0x46')]['filter']){_0x19c431[_0x51c4('0x50')]=_[_0x51c4('0x54')](_0x19c431[_0x51c4('0x50')],{'$or':_[_0x51c4('0x41')](_0x19c431['attributes'],function(_0x4d3d92){var _0x563c02={};_0x563c02[_0x4d3d92]={'$like':'%'+_0x1e5fb8[_0x51c4('0x46')][_0x51c4('0x53')]+'%'};return _0x563c02;})});}_0x19c431=_['merge']({},_0x19c431,_0x1e5fb8[_0x51c4('0x5f')]);return _0x3562e1[_0x51c4('0x7c')](_0x19c431);}})[_0x51c4('0x22')](function(_0x10ea86){if(_0x10ea86){_0x221d19=_0x10ea86[_0x51c4('0x4b')];if(!_0x1e5fb8['query'][_0x51c4('0x4c')](_0x51c4('0x4d'))){_0x19c431['limit']=qs[_0x51c4('0x32')](_0x1e5fb8['query'][_0x51c4('0x32')]);_0x19c431[_0x51c4('0x30')]=qs[_0x51c4('0x30')](_0x1e5fb8['query'][_0x51c4('0x30')]);}return _0x3562e1[_0x51c4('0x7c')](_0x19c431);}})[_0x51c4('0x22')](function(_0x1bb460){if(_0x1bb460){return _0x1bb460?{'count':_0x221d19,'rows':_0x1bb460}:null;}})[_0x51c4('0x22')](respondWithResult(_0x5ab043,null))[_0x51c4('0x59')](handleError(_0x5ab043,null));};exports['addApplications']=function(_0x37f063,_0x324391,_0x54eaf9){return db[_0x51c4('0x42')][_0x51c4('0x6d')]({'where':{'id':_0x37f063[_0x51c4('0x5b')]['id']}})['then'](handleEntityNotFound(_0x324391,null))[_0x51c4('0x22')](function(_0x35cf59){if(_0x35cf59){return db['sequelize'][_0x51c4('0x7e')](function(_0x4564de){return db[_0x51c4('0x7f')][_0x51c4('0x39')]({'where':{'WhatsappAccountId':_0x37f063[_0x51c4('0x5b')]['id']},'transaction':_0x4564de})['then'](function(_0x332ad8){var _0x535c43=_[_0x51c4('0x41')](_0x37f063[_0x51c4('0x62')],function(_0x21b55d){_0x21b55d[_0x51c4('0x6b')]=_0x37f063[_0x51c4('0x5b')]['id'];return _0x21b55d;});return db[_0x51c4('0x7f')]['bulkCreate'](_0x535c43,{'transaction':_0x4564de});});})['then'](function(){return db[_0x51c4('0x7f')][_0x51c4('0x80')]({'where':{'WhatsappAccountId':_0x37f063[_0x51c4('0x5b')]['id']},'order':_0x51c4('0x81')});});}})[_0x51c4('0x22')](respondWithResult(_0x324391,null))['catch'](handleError(_0x324391,null));};exports[_0x51c4('0x82')]=function(_0x28c667,_0x7e4001,_0x58670b){var _0x4ffbff={};var _0x30ea9c={};var _0x2db662;var _0x1446a8;return db[_0x51c4('0x42')][_0x51c4('0x6d')]({'where':{'id':_0x28c667[_0x51c4('0x5b')]['id']}})[_0x51c4('0x22')](handleEntityNotFound(_0x7e4001,null))[_0x51c4('0x22')](function(_0x1cc2cd){if(_0x1cc2cd){_0x2db662=_0x1cc2cd;_0x30ea9c['model']=_[_0x51c4('0x5d')](db[_0x51c4('0x7f')][_0x51c4('0x43')]);_0x30ea9c[_0x51c4('0x46')]=_[_0x51c4('0x5d')](_0x28c667[_0x51c4('0x46')]);_0x30ea9c['filters']=_['intersection'](_0x30ea9c[_0x51c4('0x48')],_0x30ea9c['query']);_0x4ffbff['attributes']=_[_0x51c4('0x5e')](_0x30ea9c[_0x51c4('0x48')],qs['fields'](_0x28c667[_0x51c4('0x46')]['fields']));_0x4ffbff[_0x51c4('0x49')]=_0x4ffbff[_0x51c4('0x49')][_0x51c4('0x4b')]?_0x4ffbff[_0x51c4('0x49')]:_0x30ea9c[_0x51c4('0x48')];_0x4ffbff[_0x51c4('0x4e')]=qs[_0x51c4('0x4f')](_0x28c667[_0x51c4('0x46')][_0x51c4('0x4f')]);_0x4ffbff[_0x51c4('0x50')]=qs[_0x51c4('0x47')](_[_0x51c4('0x51')](_0x28c667[_0x51c4('0x46')],_0x30ea9c[_0x51c4('0x47')]));if(_0x28c667['query'][_0x51c4('0x53')]){_0x4ffbff[_0x51c4('0x50')]=_[_0x51c4('0x54')](_0x4ffbff[_0x51c4('0x50')],{'$or':_['map'](_0x4ffbff[_0x51c4('0x49')],function(_0x35a527){var _0xba1e78={};_0xba1e78[_0x35a527]={'$like':'%'+_0x28c667[_0x51c4('0x46')][_0x51c4('0x53')]+'%'};return _0xba1e78;})});}_0x4ffbff=_[_0x51c4('0x54')]({},_0x4ffbff,_0x28c667[_0x51c4('0x5f')]);return _0x2db662[_0x51c4('0x82')](_0x4ffbff);}})[_0x51c4('0x22')](function(_0x274d28){if(_0x274d28){_0x1446a8=_0x274d28['length'];if(!_0x28c667[_0x51c4('0x46')][_0x51c4('0x4c')](_0x51c4('0x4d'))){_0x4ffbff[_0x51c4('0x32')]=qs['limit'](_0x28c667[_0x51c4('0x46')][_0x51c4('0x32')]);_0x4ffbff[_0x51c4('0x30')]=qs[_0x51c4('0x30')](_0x28c667['query'][_0x51c4('0x30')]);}return _0x2db662[_0x51c4('0x82')](_0x4ffbff);}})[_0x51c4('0x22')](function(_0x3368c4){if(_0x3368c4){return _0x3368c4?{'count':_0x1446a8,'rows':_0x3368c4}:null;}})[_0x51c4('0x22')](respondWithResult(_0x7e4001,null))[_0x51c4('0x59')](handleError(_0x7e4001,null));};exports['notify']=function(_0x47f075,_0x488f73,_0x35d1b1){var _0x2e31bf={'channel':'whatsapp'};var _0x195075=[];var _0x9542bc=[];var _0x308afd={};return db[_0x51c4('0x42')][_0x51c4('0x60')]({'where':{'id':_0x47f075[_0x51c4('0x5b')]['id']},'include':[{'model':db[_0x51c4('0x7f')],'as':_0x51c4('0x83')}]})[_0x51c4('0x22')](handleEntityNotFound(_0x488f73,null))[_0x51c4('0x22')](function(_0x27726d){_0x2e31bf['account']=_0x27726d;_0x2e31bf[_0x51c4('0x84')]=_[_0x51c4('0x85')](_0x27726d[_0x51c4('0x83')],['priority'],[_0x51c4('0x86')]);if(_0x2e31bf['account'][_0x51c4('0x83')]){delete _0x2e31bf['account'][_0x51c4('0x83')];}return db['CmContact']['describe']();})[_0x51c4('0x22')](function(_0x416419){if(!_0x416419){throw new db[(_0x51c4('0x87'))][(_0x51c4('0x88'))]('no\x20available\x20attributes');}_0x195075=_['difference'](_['keys'](_0x416419),['createdAt',_0x51c4('0x89')]);_0x9542bc=_['difference'](_[_0x51c4('0x5d')](_0x416419),[_0x51c4('0x8a'),'updatedAt',_0x51c4('0x8b'),'ListId']);_0x2e31bf[_0x51c4('0x62')]={'mapKey':_0x51c4('0x8c')};if(_0x2e31bf[_0x51c4('0x8d')]['type']&&_0x2e31bf['account'][_0x51c4('0x44')]===_0x51c4('0x8e')){_0x2e31bf[_0x51c4('0x62')][_0x51c4('0x8f')]=_0x47f075[_0x51c4('0x62')][_0x51c4('0x90')]['replace'](_0x51c4('0x91'),'');_0x2e31bf['body'][_0x51c4('0x62')]=_0x47f075[_0x51c4('0x62')][_0x51c4('0x92')];_0x2e31bf[_0x51c4('0x62')]['messageId']=_0x47f075[_0x51c4('0x62')][_0x51c4('0x93')];}if(_0x2e31bf[_0x51c4('0x62')]['id']){delete _0x2e31bf[_0x51c4('0x62')]['id'];}if(_[_0x51c4('0x94')](_0x2e31bf[_0x51c4('0x62')][_0x51c4('0x8f')])){throw new db[(_0x51c4('0x87'))][(_0x51c4('0x88'))](_0x51c4('0x95'));}if(_[_0x51c4('0x94')](_0x2e31bf[_0x51c4('0x62')]['body'])||_0x2e31bf[_0x51c4('0x62')][_0x51c4('0x62')]===''){throw new db[(_0x51c4('0x87'))][(_0x51c4('0x88'))](_0x51c4('0x96'));}if(_[_0x51c4('0x94')](_0x2e31bf[_0x51c4('0x62')][_0x51c4('0x97')])){throw new db[(_0x51c4('0x87'))][(_0x51c4('0x88'))](_0x51c4('0x98')+_0x9542bc);}if(!_[_0x51c4('0x99')](_0x9542bc,_0x2e31bf['body']['mapKey'])){throw new db[(_0x51c4('0x87'))]['ValidationError'](_0x51c4('0x9a')+_0x9542bc);}_0x308afd[_0x2e31bf[_0x51c4('0x62')]['mapKey']]=_0x2e31bf[_0x51c4('0x62')][_0x51c4('0x8f')];return db[_0x51c4('0x9b')][_0x51c4('0x60')]({'where':{'id':_0x2e31bf[_0x51c4('0x8d')]['ListId']},'include':[{'model':db[_0x51c4('0x9c')],'as':_0x51c4('0x9d'),'where':_0x308afd,'limit':0x1,'order':[[_0x51c4('0x89'),'DESC']]}]});})[_0x51c4('0x22')](handleEntityNotFound(_0x488f73,null))[_0x51c4('0x22')](function(_0x2c42f0){if(_0x2c42f0){_0x2e31bf[_0x51c4('0x9e')]=_[_0x51c4('0x76')](_0x2c42f0,[_0x51c4('0x9d')]);if(_0x2c42f0[_0x51c4('0x9d')]['length']){return _0x2c42f0[_0x51c4('0x9d')][0x0];}var _0x273ade=_[_0x51c4('0x19')](_0x2e31bf[_0x51c4('0x62')],{'firstName':_0x2e31bf['body'][_0x51c4('0x8f')],'ListId':_0x2c42f0['id']});_0x273ade[_0x2e31bf[_0x51c4('0x62')][_0x51c4('0x97')]]=_0x2e31bf[_0x51c4('0x62')][_0x51c4('0x8f')];return db['CmContact'][_0x51c4('0x61')](_0x273ade,{'fields':_0x195075,'raw':!![]});}})[_0x51c4('0x22')](handleEntityNotFound(_0x488f73,null))['then'](function(_0x1137c0){if(_0x1137c0){_0x2e31bf[_0x51c4('0x9f')]=_0x1137c0;var _0x412b20={'ContactId':_0x1137c0['id'],'phone':_0x2e31bf[_0x51c4('0x62')][_0x51c4('0x8f')],'WhatsappAccountId':_0x47f075[_0x51c4('0x5b')]['id']};var _0x4fc12b={'ContactId':_0x1137c0['id'],'WhatsappAccountId':_0x47f075[_0x51c4('0x5b')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x51c4('0x60')]({'where':_0x4fc12b})[_0x51c4('0x22')](function(_0x641d3a){if(_0x641d3a){return[_0x641d3a,![]];}return db['WhatsappInteraction'][_0x51c4('0x61')](_0x412b20)['then'](function(_0x3183de){return[_0x3183de,!![]];});});}})[_0x51c4('0x77')](function(_0x47caa9,_0x14d3b3){_0x2e31bf['interaction']=_0x47caa9['get']({'plain':!![]});_0x2e31bf[_0x51c4('0xa0')][_0x51c4('0xa1')]=![];if(_0x14d3b3){if(_0x2e31bf[_0x51c4('0x8d')][_0x51c4('0xa2')]){_0x2e31bf[_0x51c4('0x84')][_0x51c4('0xa3')]({'id':0x0,'priority':_0x2e31bf['applications'][_0x51c4('0x4b')]+0x1,'app':_0x51c4('0xa4'),'appdata':_0x51c4('0xa5'),'interval':'*,*,*,*'});}_0x2e31bf[_0x51c4('0xa0')][_0x51c4('0xa1')]=!![];}return db['WhatsappMessage'][_0x51c4('0x61')]({'phone':_0x2e31bf[_0x51c4('0x62')][_0x51c4('0x8f')],'messageId':_0x2e31bf['body'][_0x51c4('0xa6')],'body':_0x2e31bf[_0x51c4('0x62')][_0x51c4('0x62')],'WhatsappAccountId':_0x47f075['params']['id'],'WhatsappInteractionId':_0x47caa9['id'],'direction':'in','ContactId':_0x47caa9[_0x51c4('0xa7')],'AttachmentId':_0x2e31bf[_0x51c4('0x62')]['AttachmentId']});})['then'](function(_0x2f28d0){_0x2e31bf[_0x51c4('0x2b')]=_0x2f28d0;if(_0x2e31bf[_0x51c4('0xa0')][_0x51c4('0xa8')]){return db[_0x51c4('0x7d')][_0x51c4('0x60')]({'attributes':['id',_0x51c4('0x3e')],'where':{'id':_0x2e31bf[_0x51c4('0xa0')][_0x51c4('0xa8')]}})[_0x51c4('0x22')](function(_0xf6ee05){if(_0xf6ee05){_0x2e31bf[_0x51c4('0x84')][_0x51c4('0xa9')]({'id':0x0,'priority':0x0,'app':_0x51c4('0xaa'),'appdata':_0xf6ee05[_0x51c4('0x3e')]+','+(_0x2e31bf['account'][_0x51c4('0xab')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x51c4('0xac'),_0x51c4('0xad'),_0x2e31bf);});}return respondWithRpcPromise('Start',_0x51c4('0xad'),_0x2e31bf);})[_0x51c4('0x22')](function(_0x2a4d52){if(_0x2a4d52){var _0x2c038e=0xc8;var _0x41d4a4=_0x51c4('0xae');logger[_0x51c4('0x23')](_0x51c4('0x27'),_0x41d4a4,_0x2c038e,_0x51c4('0xaf'));logger[_0x51c4('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x41d4a4,_0x2c038e,_0x51c4('0xaf'),JSON[_0x51c4('0x28')](_0x2a4d52));if(_0x2e31bf[_0x51c4('0x8d')][_0x51c4('0x44')]===_0x51c4('0x8e')){return _0x488f73['status'](_0x2c038e)[_0x51c4('0x34')](_0x51c4('0xb0'),_0x51c4('0xb1'))[_0x51c4('0x3f')]('\x0a');}else{return _0x488f73[_0x51c4('0x2e')](_0x2c038e)['json'](_0x2a4d52);}}})[_0x51c4('0x59')](handleError(_0x488f73,null));};exports[_0x51c4('0x3f')]=function(_0x39c582,_0x26a62d,_0x53bdd2){var _0x50767a,_0x1c0005,_0x529574;if(_[_0x51c4('0x94')](_0x39c582[_0x51c4('0x62')][_0x51c4('0x62')])||_0x39c582['body'][_0x51c4('0x62')]===''){throw new db[(_0x51c4('0x87'))]['ValidationError'](_0x51c4('0x96'));}if(_[_0x51c4('0x94')](_0x39c582[_0x51c4('0x62')]['to'])){throw new db['Sequelize'][(_0x51c4('0x88'))](_0x51c4('0xb2'));}_0x50767a=_0x39c582[_0x51c4('0x62')]['to'];return db[_0x51c4('0x42')][_0x51c4('0x60')]({'where':{'id':_0x39c582[_0x51c4('0x5b')]['id']},'include':[{'model':db[_0x51c4('0x9b')],'as':_0x51c4('0xb3'),'include':[{'model':db[_0x51c4('0x9c')],'as':_0x51c4('0x9d'),'where':{'mobile':_0x50767a},'limit':0x1,'order':[[_0x51c4('0x89'),_0x51c4('0xb4')]]}]}]})[_0x51c4('0x22')](handleEntityNotFound(_0x26a62d,null))[_0x51c4('0x22')](function(_0x34d760){if(_0x34d760&&_0x34d760[_0x51c4('0xb3')]){_0x1c0005=_0x34d760[_0x51c4('0x3a')]({'plain':!![]});if(_0x1c0005['List']&&_0x1c0005[_0x51c4('0xb3')][_0x51c4('0x9d')][_0x51c4('0x4b')]){return _0x1c0005[_0x51c4('0xb3')][_0x51c4('0x9d')][0x0];}return db[_0x51c4('0x9c')][_0x51c4('0x61')](_[_0x51c4('0x19')](_0x39c582[_0x51c4('0x62')],{'firstName':_0x50767a,'mobile':_0x50767a,'phone':_0x50767a,'ListId':_0x1c0005[_0x51c4('0xb5')]}));}})['then'](handleEntityNotFound(_0x26a62d,null))[_0x51c4('0x22')](function(_0x40ea0b){if(_0x40ea0b){_0x529574=_0x40ea0b;return db[_0x51c4('0xb6')][_0x51c4('0x60')]({'where':{'ContactId':_0x529574['id'],'closed':![],'WhatsappAccountId':_0x1c0005['id']}})[_0x51c4('0x22')](function(_0x3177c3){if(_0x3177c3){return[_0x3177c3,![]];}return db['WhatsappInteraction'][_0x51c4('0x61')]({'UserId':_0x39c582['user']['id'],'ContactId':_0x529574['id'],'WhatsappAccountId':_0x1c0005['id'],'phone':_0x50767a,'firstMsgDirection':_0x51c4('0xb7'),'Messages':[_['merge'](_0x39c582[_0x51c4('0x62')],{'read':![],'body':_0x39c582[_0x51c4('0x62')][_0x51c4('0x62')],'phone':_0x50767a,'WhatsappAccountId':_0x1c0005['id'],'UserId':_0x39c582[_0x51c4('0x63')]['id'],'ContactId':_0x529574['id']})]},{'include':[{'model':db[_0x51c4('0xb8')],'as':_0x51c4('0xb9')}]})[_0x51c4('0x22')](function(_0x32ddaa){return[_0x32ddaa,!![]];});});}})[_0x51c4('0x77')](function(_0x155ce3,_0x5e020e){if(_0x5e020e){return _0x155ce3;}return db[_0x51c4('0xb8')]['create'](_[_0x51c4('0x54')](_0x39c582[_0x51c4('0x62')],{'read':![],'body':_0x39c582[_0x51c4('0x62')][_0x51c4('0x62')],'phone':_0x50767a,'WhatsappAccountId':_0x1c0005['id'],'WhatsappInteractionId':_0x155ce3['id'],'UserId':_0x39c582[_0x51c4('0x63')]['id'],'ContactId':_0x529574['id']}))[_0x51c4('0x22')](function(_0x4f0d66){_0x155ce3['dataValues'][_0x51c4('0xb9')]=[];_0x155ce3[_0x51c4('0xba')][_0x51c4('0xb9')][_0x51c4('0xa3')](_0x4f0d66[_0x51c4('0xba')]);return _0x155ce3;});})[_0x51c4('0x22')](respondWithResult(_0x26a62d,null))[_0x51c4('0x59')](handleError(_0x26a62d,null));}; \ No newline at end of file +var _0xf015=['stringify','error','WhatsappAccount,\x20%s,\x20%s','message','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','get','UserProfileResource','end','stack','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','include','rows','show','params','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','order','pick','options','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','User','getAgents','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','notify','Applications','applications','orderBy','asc','account','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','twilio','From','replace','whatsapp:','messageId','MessageSid','isNil','from','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','to\x20is\x20mandatory','List','WhatsappMessage','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','jayson/promise','client','http','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0x513799,_0x18990e){var _0x518a82=function(_0xc1d5cf){while(--_0xc1d5cf){_0x513799['push'](_0x513799['shift']());}};_0x518a82(++_0x18990e);}(_0xf015,0x95));var _0x5f01=function(_0x1cb7d8,_0x2209b4){_0x1cb7d8=_0x1cb7d8-0x0;var _0x28ca3a=_0xf015[_0x1cb7d8];return _0x28ca3a;};'use strict';var emlformat=require(_0x5f01('0x0'));var rimraf=require(_0x5f01('0x1'));var zipdir=require(_0x5f01('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f01('0x3'));var moment=require(_0x5f01('0x4'));var BPromise=require(_0x5f01('0x5'));var Mustache=require(_0x5f01('0x6'));var util=require(_0x5f01('0x7'));var path=require(_0x5f01('0x8'));var sox=require(_0x5f01('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f01('0xa'));var _=require(_0x5f01('0xb'));var squel=require('squel');var crypto=require(_0x5f01('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5f01('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5f01('0xe'));var authService=require(_0x5f01('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5f01('0x10'));var hardwareService=require(_0x5f01('0x11'));var logger=require(_0x5f01('0x12'))(_0x5f01('0x13'));var utils=require(_0x5f01('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5f01('0x15'));var db=require(_0x5f01('0x16'))['db'];config['redis']=_[_0x5f01('0x17')](config['redis'],{'host':_0x5f01('0x18'),'port':0x18eb});var socket=require(_0x5f01('0x19'))(new Redis(config['redis']));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x5f01('0x1a'));var client=jayson[_0x5f01('0x1b')][_0x5f01('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x408af2,_0x33f145,_0x4db387,_0x12fe43){return new BPromise(function(_0x20f30b,_0x19e281){var _0x48f048=_0x12fe43||client;return _0x48f048['request'](_0x408af2,_0x4db387)[_0x5f01('0x1d')](function(_0x5e947c){logger[_0x5f01('0x1e')]('WhatsappAccount,\x20%s,\x20%s',_0x33f145,_0x5f01('0x1f'));logger['debug'](_0x5f01('0x20'),_0x33f145,_0x5f01('0x1f'),JSON[_0x5f01('0x21')](_0x5e947c));if(_0x5e947c['error']){if(_0x5e947c[_0x5f01('0x22')]['code']===0x1f4){logger[_0x5f01('0x22')](_0x5f01('0x23'),_0x33f145,_0x5e947c['error']['message']);return _0x19e281(_0x5e947c[_0x5f01('0x22')][_0x5f01('0x24')]);}logger[_0x5f01('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x33f145,_0x5e947c[_0x5f01('0x22')][_0x5f01('0x24')]);return _0x20f30b(_0x5e947c[_0x5f01('0x22')]['message']);}else{logger[_0x5f01('0x1e')]('WhatsappAccount,\x20%s,\x20%s',_0x33f145,_0x5f01('0x1f'));_0x20f30b(_0x5e947c['result']['message']);}})['catch'](function(_0x5984ab){logger[_0x5f01('0x22')](_0x5f01('0x23'),_0x33f145,_0x5984ab);_0x19e281(_0x5984ab);});});}function respondWithStatusCode(_0x56fbf2,_0x14f294){_0x14f294=_0x14f294||0xcc;return function(_0x12d1ff){if(_0x12d1ff){return _0x56fbf2[_0x5f01('0x25')](_0x14f294);}return _0x56fbf2['status'](_0x14f294)['end']();};}function respondWithResult(_0x3a28bb,_0x11d432){_0x11d432=_0x11d432||0xc8;return function(_0x255abb){if(_0x255abb){return _0x3a28bb[_0x5f01('0x26')](_0x11d432)[_0x5f01('0x27')](_0x255abb);}};}function respondWithFilteredResult(_0x586cdf,_0x1c093d){return function(_0x1a3e13){if(_0x1a3e13){var _0x3a5e10=typeof _0x1c093d[_0x5f01('0x28')]===_0x5f01('0x29')&&typeof _0x1c093d['limit']==='undefined';var _0x58c1ae=_0x1a3e13[_0x5f01('0x2a')];var _0x40619a=_0x3a5e10?0x0:_0x1c093d[_0x5f01('0x28')];var _0x4784c8=_0x3a5e10?_0x1a3e13['count']:_0x1c093d[_0x5f01('0x28')]+_0x1c093d[_0x5f01('0x2b')];var _0xc5f551;if(_0x4784c8>=_0x58c1ae){_0x4784c8=_0x58c1ae;_0xc5f551=0xc8;}else{_0xc5f551=0xce;}_0x586cdf['status'](_0xc5f551);return _0x586cdf[_0x5f01('0x2c')]('Content-Range',_0x40619a+'-'+_0x4784c8+'/'+_0x58c1ae)[_0x5f01('0x27')](_0x1a3e13);}return null;};}function patchUpdates(_0x46fa98){return function(_0x50ce09){try{jsonpatch[_0x5f01('0x2d')](_0x50ce09,_0x46fa98,!![]);}catch(_0x431de5){return BPromise[_0x5f01('0x2e')](_0x431de5);}return _0x50ce09[_0x5f01('0x2f')]();};}function saveUpdates(_0xc80cee,_0x15cd0a){return function(_0x2022fd){if(_0x2022fd){return _0x2022fd[_0x5f01('0x30')](_0xc80cee)[_0x5f01('0x1d')](function(_0x5c967b){return _0x5c967b;});}return null;};}function removeEntity(_0x5b403b,_0x11d475){return function(_0x168013){if(_0x168013){return _0x168013[_0x5f01('0x31')]()[_0x5f01('0x1d')](function(){var _0x2f45df=_0x168013[_0x5f01('0x32')]({'plain':!![]});var _0x41fa0b='WhatsappAccounts';return db[_0x5f01('0x33')][_0x5f01('0x31')]({'where':{'type':_0x41fa0b,'resourceId':_0x2f45df['id']}})[_0x5f01('0x1d')](function(){return _0x168013;});})['then'](function(){_0x5b403b[_0x5f01('0x26')](0xcc)[_0x5f01('0x34')]();});}};}function handleEntityNotFound(_0xe656a,_0x3de0dd){return function(_0x3d0ca3){if(!_0x3d0ca3){_0xe656a['sendStatus'](0x194);}return _0x3d0ca3;};}function handleError(_0x5001c7,_0x4374c8){_0x4374c8=_0x4374c8||0x1f4;return function(_0x190c46){logger[_0x5f01('0x22')](_0x190c46[_0x5f01('0x35')]);if(_0x190c46[_0x5f01('0x36')]){delete _0x190c46[_0x5f01('0x36')];}_0x5001c7[_0x5f01('0x26')](_0x4374c8)[_0x5f01('0x37')](_0x190c46);};}exports['index']=function(_0xbf4777,_0x1928bf){var _0x1d30a7={'include':[{'model':db[_0x5f01('0x38')],'as':_0x5f01('0x39')}]},_0x161779={},_0x4c2762={'count':0x0,'rows':[]};var _0x177443=_[_0x5f01('0x3a')](db[_0x5f01('0x3b')][_0x5f01('0x3c')],function(_0x25b133){return{'name':_0x25b133['fieldName'],'type':_0x25b133['type'][_0x5f01('0x3d')]};});_0x161779[_0x5f01('0x3e')]=_[_0x5f01('0x3a')](_0x177443,'name');_0x161779['query']=_[_0x5f01('0x3f')](_0xbf4777[_0x5f01('0x40')]);_0x161779[_0x5f01('0x41')]=_[_0x5f01('0x42')](_0x161779[_0x5f01('0x3e')],_0x161779[_0x5f01('0x40')]);_0x1d30a7[_0x5f01('0x43')]=_[_0x5f01('0x42')](_0x161779[_0x5f01('0x3e')],qs[_0x5f01('0x44')](_0xbf4777[_0x5f01('0x40')][_0x5f01('0x44')]));_0x1d30a7['attributes']=_0x1d30a7[_0x5f01('0x43')][_0x5f01('0x45')]?_0x1d30a7[_0x5f01('0x43')]:_0x161779['model'];if(!_0xbf4777[_0x5f01('0x40')][_0x5f01('0x46')](_0x5f01('0x47'))){_0x1d30a7['limit']=qs[_0x5f01('0x2b')](_0xbf4777[_0x5f01('0x40')]['limit']);_0x1d30a7[_0x5f01('0x28')]=qs[_0x5f01('0x28')](_0xbf4777['query'][_0x5f01('0x28')]);}_0x1d30a7['order']=qs[_0x5f01('0x48')](_0xbf4777[_0x5f01('0x40')][_0x5f01('0x48')]);_0x1d30a7[_0x5f01('0x49')]=qs[_0x5f01('0x41')](_['pick'](_0xbf4777[_0x5f01('0x40')],_0x161779[_0x5f01('0x41')]),_0x177443);if(_0xbf4777[_0x5f01('0x40')][_0x5f01('0x4a')]){_0x1d30a7[_0x5f01('0x49')]=_[_0x5f01('0x4b')](_0x1d30a7[_0x5f01('0x49')],{'$or':_[_0x5f01('0x3a')](_0x177443,function(_0x5b5591){if(_0x5b5591[_0x5f01('0x4c')]!==_0x5f01('0x4d')){var _0x42af8e={};_0x42af8e[_0x5b5591[_0x5f01('0x36')]]={'$like':'%'+_0xbf4777[_0x5f01('0x40')]['filter']+'%'};return _0x42af8e;}})});}_0x1d30a7=_[_0x5f01('0x4b')]({},_0x1d30a7,_0xbf4777['options']);var _0x1850c5={'where':_0x1d30a7[_0x5f01('0x49')]};return db[_0x5f01('0x3b')][_0x5f01('0x2a')](_0x1850c5)[_0x5f01('0x1d')](function(_0x3ba79a){_0x4c2762[_0x5f01('0x2a')]=_0x3ba79a;if(_0xbf4777[_0x5f01('0x40')]['includeAll']){_0x1d30a7[_0x5f01('0x4e')]=[{'all':!![]}];}return db[_0x5f01('0x3b')]['findAll'](_0x1d30a7);})[_0x5f01('0x1d')](function(_0x557d71){_0x4c2762[_0x5f01('0x4f')]=_0x557d71;return _0x4c2762;})[_0x5f01('0x1d')](respondWithFilteredResult(_0x1928bf,_0x1d30a7))['catch'](handleError(_0x1928bf,null));};exports[_0x5f01('0x50')]=function(_0x51ad92,_0x5bd9e5){var _0xddbd5b={'raw':![],'where':{'id':_0x51ad92[_0x5f01('0x51')]['id']},'include':[{'model':db[_0x5f01('0x38')],'as':_0x5f01('0x39')}]},_0x4cb952={};_0x4cb952[_0x5f01('0x3e')]=_['keys'](db['WhatsappAccount'][_0x5f01('0x3c')]);_0x4cb952[_0x5f01('0x40')]=_[_0x5f01('0x3f')](_0x51ad92['query']);_0x4cb952[_0x5f01('0x41')]=_[_0x5f01('0x42')](_0x4cb952['model'],_0x4cb952[_0x5f01('0x40')]);_0xddbd5b[_0x5f01('0x43')]=_[_0x5f01('0x42')](_0x4cb952['model'],qs[_0x5f01('0x44')](_0x51ad92[_0x5f01('0x40')][_0x5f01('0x44')]));_0xddbd5b[_0x5f01('0x43')]=_0xddbd5b[_0x5f01('0x43')][_0x5f01('0x45')]?_0xddbd5b[_0x5f01('0x43')]:_0x4cb952[_0x5f01('0x3e')];if(_0x51ad92[_0x5f01('0x40')][_0x5f01('0x52')]){_0xddbd5b[_0x5f01('0x4e')]=[{'all':!![]}];}_0xddbd5b=_[_0x5f01('0x4b')]({},_0xddbd5b,_0x51ad92['options']);return db[_0x5f01('0x3b')][_0x5f01('0x53')](_0xddbd5b)[_0x5f01('0x1d')](handleEntityNotFound(_0x5bd9e5,null))[_0x5f01('0x1d')](respondWithResult(_0x5bd9e5,null))[_0x5f01('0x54')](handleError(_0x5bd9e5,null));};exports[_0x5f01('0x55')]=function(_0x36122c,_0x1f7076){return db[_0x5f01('0x3b')]['create'](_0x36122c[_0x5f01('0x56')],{})[_0x5f01('0x1d')](function(_0x2bda81){var _0x3bc119=_0x36122c['user']['get']({'plain':!![]});if(!_0x3bc119)throw new Error(_0x5f01('0x57'));if(_0x3bc119[_0x5f01('0x58')]===_0x5f01('0x59')){var _0x57a0a1=_0x2bda81['get']({'plain':!![]});var _0x23eb3c=_0x5f01('0x5a');return db[_0x5f01('0x5b')][_0x5f01('0x53')]({'where':{'name':_0x23eb3c,'userProfileId':_0x3bc119[_0x5f01('0x5c')]},'raw':!![]})['then'](function(_0x138bf1){if(_0x138bf1&&_0x138bf1[_0x5f01('0x5d')]===0x0){return db[_0x5f01('0x33')]['create']({'name':_0x57a0a1[_0x5f01('0x36')],'resourceId':_0x57a0a1['id'],'type':_0x138bf1[_0x5f01('0x36')],'sectionId':_0x138bf1['id']},{})[_0x5f01('0x1d')](function(){return _0x2bda81;});}else{return _0x2bda81;}})[_0x5f01('0x54')](function(_0x1317fa){logger[_0x5f01('0x22')](_0x5f01('0x5e'),_0x1317fa);throw _0x1317fa;});}return _0x2bda81;})[_0x5f01('0x1d')](respondWithResult(_0x1f7076,0xc9))[_0x5f01('0x54')](handleError(_0x1f7076,null));};exports[_0x5f01('0x30')]=function(_0x48ffe3,_0x539044){if(_0x48ffe3[_0x5f01('0x56')]['id']){delete _0x48ffe3['body']['id'];}return db[_0x5f01('0x3b')]['find']({'where':{'id':_0x48ffe3[_0x5f01('0x51')]['id']},'include':[{'model':db[_0x5f01('0x38')],'as':_0x5f01('0x39')}]})[_0x5f01('0x1d')](handleEntityNotFound(_0x539044,null))[_0x5f01('0x1d')](saveUpdates(_0x48ffe3[_0x5f01('0x56')],null))['then'](respondWithResult(_0x539044,null))[_0x5f01('0x54')](handleError(_0x539044,null));};exports['destroy']=function(_0x12ea81,_0x1d0506){return db[_0x5f01('0x3b')]['find']({'where':{'id':_0x12ea81[_0x5f01('0x51')]['id']}})[_0x5f01('0x1d')](handleEntityNotFound(_0x1d0506,null))['then'](removeEntity(_0x1d0506,null))[_0x5f01('0x54')](handleError(_0x1d0506,null));};exports[_0x5f01('0x5f')]=function(_0x47be57,_0x1a7c8c){return db[_0x5f01('0x3b')][_0x5f01('0x5f')]()[_0x5f01('0x1d')](respondWithResult(_0x1a7c8c,null))['catch'](handleError(_0x1a7c8c,null));};exports[_0x5f01('0x60')]=function(_0xfa2d87,_0x120808,_0x25f42f){if(_0xfa2d87['body']['id']){delete _0xfa2d87[_0x5f01('0x56')]['id'];}return db[_0x5f01('0x3b')][_0x5f01('0x53')]({'where':{'id':_0xfa2d87[_0x5f01('0x51')]['id']}})[_0x5f01('0x1d')](handleEntityNotFound(_0x120808,null))[_0x5f01('0x1d')](function(_0x3b4974){if(_0x3b4974){_0xfa2d87[_0x5f01('0x56')][_0x5f01('0x61')]=_0x3b4974['id'];return db[_0x5f01('0x62')][_0x5f01('0x55')](_0xfa2d87[_0x5f01('0x56')]);}})['then'](respondWithResult(_0x120808,null))[_0x5f01('0x54')](handleError(_0x120808,null));};exports[_0x5f01('0x63')]=function(_0x567681,_0x19b55a,_0x3146ca){var _0x4237e9={'raw':![],'where':{}};var _0x1424a2={};var _0x5416bc={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x5f01('0x64')]({'where':{'id':_0x567681[_0x5f01('0x51')]['id']}})[_0x5f01('0x1d')](handleEntityNotFound(_0x19b55a,null))[_0x5f01('0x1d')](function(_0x470c1a){if(_0x470c1a){_0x1424a2[_0x5f01('0x3e')]=_[_0x5f01('0x3f')](db[_0x5f01('0x62')]['rawAttributes']);_0x1424a2[_0x5f01('0x40')]=_[_0x5f01('0x3f')](_0x567681[_0x5f01('0x40')]);_0x1424a2[_0x5f01('0x41')]=_[_0x5f01('0x42')](_0x1424a2[_0x5f01('0x3e')],_0x1424a2[_0x5f01('0x40')]);_0x4237e9[_0x5f01('0x43')]=_[_0x5f01('0x42')](_0x1424a2[_0x5f01('0x3e')],qs['fields'](_0x567681[_0x5f01('0x40')][_0x5f01('0x44')]));_0x4237e9[_0x5f01('0x43')]=_0x4237e9[_0x5f01('0x43')][_0x5f01('0x45')]?_0x4237e9[_0x5f01('0x43')]:_0x1424a2[_0x5f01('0x3e')];if(!_0x567681[_0x5f01('0x40')]['hasOwnProperty']('nolimit')){_0x4237e9[_0x5f01('0x2b')]=qs['limit'](_0x567681['query'][_0x5f01('0x2b')]);_0x4237e9[_0x5f01('0x28')]=qs['offset'](_0x567681['query'][_0x5f01('0x28')]);}_0x4237e9[_0x5f01('0x65')]=qs[_0x5f01('0x48')](_0x567681[_0x5f01('0x40')]['sort']);_0x4237e9[_0x5f01('0x49')]=qs[_0x5f01('0x41')](_[_0x5f01('0x66')](_0x567681['query'],_0x1424a2[_0x5f01('0x41')]));_0x4237e9['where'][_0x5f01('0x61')]=_0x470c1a['id'];if(_0x567681[_0x5f01('0x40')][_0x5f01('0x4a')]){_0x4237e9[_0x5f01('0x49')]=_['merge'](_0x4237e9[_0x5f01('0x49')],{'$or':_[_0x5f01('0x3a')](_0x4237e9[_0x5f01('0x43')],function(_0xa24cd3){var _0x3ac301={};_0x3ac301[_0xa24cd3]={'$like':'%'+_0x567681[_0x5f01('0x40')][_0x5f01('0x4a')]+'%'};return _0x3ac301;})});}_0x4237e9=_['merge']({},_0x4237e9,_0x567681[_0x5f01('0x67')]);return db['Disposition'][_0x5f01('0x2a')]({'where':_0x4237e9[_0x5f01('0x49')]})['then'](function(_0x56fa30){_0x5416bc[_0x5f01('0x2a')]=_0x56fa30;if(_0x567681[_0x5f01('0x40')][_0x5f01('0x52')]){_0x4237e9[_0x5f01('0x4e')]=[{'all':!![]}];}return db[_0x5f01('0x62')][_0x5f01('0x68')](_0x4237e9);})[_0x5f01('0x1d')](function(_0x2db25f){_0x5416bc[_0x5f01('0x4f')]=_0x2db25f;return _0x5416bc;});}})[_0x5f01('0x1d')](respondWithFilteredResult(_0x19b55a,_0x4237e9))['catch'](handleError(_0x19b55a,null));};exports[_0x5f01('0x69')]=function(_0x189c89,_0x3bc0ba,_0x59a3fa){return db[_0x5f01('0x3b')][_0x5f01('0x53')]({'where':{'id':_0x189c89[_0x5f01('0x51')]['id']}})[_0x5f01('0x1d')](handleEntityNotFound(_0x3bc0ba,null))[_0x5f01('0x1d')](function(_0x122c34){if(_0x122c34){return _0x122c34[_0x5f01('0x69')](_0x189c89['query'][_0x5f01('0x6a')]);}})['then'](respondWithStatusCode(_0x3bc0ba,null))['catch'](handleError(_0x3bc0ba,null));};exports['addAnswer']=function(_0x1eefe9,_0xd3036a,_0x1b7b18){if(_0x1eefe9[_0x5f01('0x56')]['id']){delete _0x1eefe9[_0x5f01('0x56')]['id'];}return db[_0x5f01('0x3b')][_0x5f01('0x53')]({'where':{'id':_0x1eefe9[_0x5f01('0x51')]['id']}})[_0x5f01('0x1d')](handleEntityNotFound(_0xd3036a,null))['then'](function(_0x1d7cee){if(_0x1d7cee){_0x1eefe9[_0x5f01('0x56')]['WhatsappAccountId']=_0x1d7cee['id'];return db[_0x5f01('0x6b')][_0x5f01('0x55')](_0x1eefe9[_0x5f01('0x56')]);}})[_0x5f01('0x1d')](respondWithResult(_0xd3036a,null))[_0x5f01('0x54')](handleError(_0xd3036a,null));};exports[_0x5f01('0x6c')]=function(_0x17db41,_0x15022f,_0x25031e){var _0x34719b={'raw':![],'where':{}};var _0x35d9b4={};var _0x5cf9ce={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x17db41[_0x5f01('0x51')]['id']}})[_0x5f01('0x1d')](handleEntityNotFound(_0x15022f,null))[_0x5f01('0x1d')](function(_0x55911c){if(_0x55911c){_0x35d9b4[_0x5f01('0x3e')]=_[_0x5f01('0x3f')](db['CannedAnswer'][_0x5f01('0x3c')]);_0x35d9b4[_0x5f01('0x40')]=_[_0x5f01('0x3f')](_0x17db41[_0x5f01('0x40')]);_0x35d9b4[_0x5f01('0x41')]=_[_0x5f01('0x42')](_0x35d9b4[_0x5f01('0x3e')],_0x35d9b4[_0x5f01('0x40')]);_0x34719b[_0x5f01('0x43')]=_[_0x5f01('0x42')](_0x35d9b4['model'],qs['fields'](_0x17db41[_0x5f01('0x40')][_0x5f01('0x44')]));_0x34719b[_0x5f01('0x43')]=_0x34719b[_0x5f01('0x43')][_0x5f01('0x45')]?_0x34719b[_0x5f01('0x43')]:_0x35d9b4[_0x5f01('0x3e')];if(!_0x17db41[_0x5f01('0x40')][_0x5f01('0x46')](_0x5f01('0x47'))){_0x34719b[_0x5f01('0x2b')]=qs[_0x5f01('0x2b')](_0x17db41[_0x5f01('0x40')][_0x5f01('0x2b')]);_0x34719b['offset']=qs[_0x5f01('0x28')](_0x17db41[_0x5f01('0x40')]['offset']);}_0x34719b[_0x5f01('0x65')]=qs[_0x5f01('0x48')](_0x17db41['query'][_0x5f01('0x48')]);_0x34719b['where']=qs['filters'](_['pick'](_0x17db41[_0x5f01('0x40')],_0x35d9b4[_0x5f01('0x41')]));_0x34719b[_0x5f01('0x49')][_0x5f01('0x61')]=_0x55911c['id'];if(_0x17db41[_0x5f01('0x40')][_0x5f01('0x4a')]){_0x34719b[_0x5f01('0x49')]=_[_0x5f01('0x4b')](_0x34719b[_0x5f01('0x49')],{'$or':_[_0x5f01('0x3a')](_0x34719b['attributes'],function(_0x26b927){var _0x1fa598={};_0x1fa598[_0x26b927]={'$like':'%'+_0x17db41[_0x5f01('0x40')][_0x5f01('0x4a')]+'%'};return _0x1fa598;})});}_0x34719b=_[_0x5f01('0x4b')]({},_0x34719b,_0x17db41[_0x5f01('0x67')]);return db[_0x5f01('0x6b')]['count']({'where':_0x34719b[_0x5f01('0x49')]})['then'](function(_0x2d21f0){_0x5cf9ce[_0x5f01('0x2a')]=_0x2d21f0;if(_0x17db41['query'][_0x5f01('0x52')]){_0x34719b[_0x5f01('0x4e')]=[{'all':!![]}];}return db[_0x5f01('0x6b')][_0x5f01('0x68')](_0x34719b);})[_0x5f01('0x1d')](function(_0x2e1aca){_0x5cf9ce[_0x5f01('0x4f')]=_0x2e1aca;return _0x5cf9ce;});}})['then'](respondWithFilteredResult(_0x15022f,_0x34719b))[_0x5f01('0x54')](handleError(_0x15022f,null));};exports[_0x5f01('0x6d')]=function(_0x193b5d,_0x1f7cd3,_0x38c798){return db['WhatsappAccount']['find']({'where':{'id':_0x193b5d[_0x5f01('0x51')]['id']}})['then'](handleEntityNotFound(_0x1f7cd3,null))[_0x5f01('0x1d')](function(_0x8f43c7){if(_0x8f43c7){return _0x8f43c7[_0x5f01('0x6d')](_0x193b5d[_0x5f01('0x40')]['ids']);}})['then'](respondWithStatusCode(_0x1f7cd3,null))['catch'](handleError(_0x1f7cd3,null));};exports[_0x5f01('0x6e')]=function(_0x4fd161,_0x332cd9,_0x491292){return db[_0x5f01('0x3b')]['find']({'where':{'id':_0x4fd161[_0x5f01('0x51')]['id']}})[_0x5f01('0x1d')](handleEntityNotFound(_0x332cd9,null))[_0x5f01('0x1d')](function(_0x1a48f2){if(_0x1a48f2){return _0x1a48f2['addAgents'](_0x4fd161['body']['ids'],_[_0x5f01('0x6f')](_0x4fd161[_0x5f01('0x56')],['ids','id'])||{})[_0x5f01('0x70')](function(_0x54636c){for(var _0x1a2a7f=0x0;_0x1a2a7f<_0x4fd161[_0x5f01('0x56')]['ids'][_0x5f01('0x45')];_0x1a2a7f+=0x1){socket[_0x5f01('0x71')](_0x5f01('0x72'),{'UserId':Number(_0x4fd161['body'][_0x5f01('0x6a')][_0x1a2a7f]),'WhatsappAccountId':Number(_0x4fd161[_0x5f01('0x51')]['id'])});}return _0x54636c;});}})[_0x5f01('0x1d')](respondWithResult(_0x332cd9,null))[_0x5f01('0x54')](handleError(_0x332cd9,null));};exports['removeAgents']=function(_0x3fdc30,_0x5c4b46,_0x5985f3){return db['WhatsappAccount'][_0x5f01('0x53')]({'where':{'id':_0x3fdc30[_0x5f01('0x51')]['id']}})[_0x5f01('0x1d')](handleEntityNotFound(_0x5c4b46,null))[_0x5f01('0x1d')](function(_0x2cf6a3){if(_0x2cf6a3){return _0x2cf6a3[_0x5f01('0x73')](_0x3fdc30['query'][_0x5f01('0x6a')])[_0x5f01('0x1d')](function(){if(_['isArray'](_0x3fdc30[_0x5f01('0x40')][_0x5f01('0x6a')])){for(var _0x353c48=0x0;_0x353c48<_0x3fdc30[_0x5f01('0x40')][_0x5f01('0x6a')][_0x5f01('0x45')];_0x353c48+=0x1){socket[_0x5f01('0x71')]('userWhatsappAccount:remove',{'UserId':Number(_0x3fdc30[_0x5f01('0x40')]['ids'][_0x353c48]),'WhatsappAccountId':Number(_0x3fdc30['params']['id'])});}}else{socket[_0x5f01('0x71')]('userWhatsappAccount:remove',{'UserId':Number(_0x3fdc30[_0x5f01('0x40')][_0x5f01('0x6a')]),'WhatsappAccountId':Number(_0x3fdc30[_0x5f01('0x51')]['id'])});}});}})[_0x5f01('0x1d')](respondWithStatusCode(_0x5c4b46,null))[_0x5f01('0x54')](handleError(_0x5c4b46,null));};exports['getAgents']=function(_0x53f20d,_0x4c94fd,_0x53f879){var _0x1f03a0={};var _0xe33f54={};var _0x5a811d;var _0x63036;return db[_0x5f01('0x3b')]['findOne']({'where':{'id':_0x53f20d[_0x5f01('0x51')]['id']}})['then'](handleEntityNotFound(_0x4c94fd,null))['then'](function(_0xc7aa07){if(_0xc7aa07){_0x5a811d=_0xc7aa07;_0xe33f54[_0x5f01('0x3e')]=_['keys'](db[_0x5f01('0x74')][_0x5f01('0x3c')]);_0xe33f54[_0x5f01('0x40')]=_['keys'](_0x53f20d[_0x5f01('0x40')]);_0xe33f54[_0x5f01('0x41')]=_[_0x5f01('0x42')](_0xe33f54[_0x5f01('0x3e')],_0xe33f54[_0x5f01('0x40')]);_0x1f03a0[_0x5f01('0x43')]=_[_0x5f01('0x42')](_0xe33f54['model'],qs[_0x5f01('0x44')](_0x53f20d[_0x5f01('0x40')][_0x5f01('0x44')]));_0x1f03a0['attributes']=_0x1f03a0[_0x5f01('0x43')][_0x5f01('0x45')]?_0x1f03a0[_0x5f01('0x43')]:_0xe33f54[_0x5f01('0x3e')];_0x1f03a0['order']=qs[_0x5f01('0x48')](_0x53f20d[_0x5f01('0x40')][_0x5f01('0x48')]);_0x1f03a0[_0x5f01('0x49')]=qs[_0x5f01('0x41')](_[_0x5f01('0x66')](_0x53f20d[_0x5f01('0x40')],_0xe33f54['filters']));if(_0x53f20d[_0x5f01('0x40')][_0x5f01('0x4a')]){_0x1f03a0['where']=_[_0x5f01('0x4b')](_0x1f03a0['where'],{'$or':_['map'](_0x1f03a0[_0x5f01('0x43')],function(_0x11e4d5){var _0x19399f={};_0x19399f[_0x11e4d5]={'$like':'%'+_0x53f20d[_0x5f01('0x40')][_0x5f01('0x4a')]+'%'};return _0x19399f;})});}_0x1f03a0=_['merge']({},_0x1f03a0,_0x53f20d[_0x5f01('0x67')]);return _0x5a811d[_0x5f01('0x75')](_0x1f03a0);}})['then'](function(_0x921620){if(_0x921620){_0x63036=_0x921620[_0x5f01('0x45')];if(!_0x53f20d[_0x5f01('0x40')]['hasOwnProperty'](_0x5f01('0x47'))){_0x1f03a0['limit']=qs['limit'](_0x53f20d[_0x5f01('0x40')][_0x5f01('0x2b')]);_0x1f03a0[_0x5f01('0x28')]=qs[_0x5f01('0x28')](_0x53f20d[_0x5f01('0x40')][_0x5f01('0x28')]);}return _0x5a811d[_0x5f01('0x75')](_0x1f03a0);}})['then'](function(_0x234234){if(_0x234234){return _0x234234?{'count':_0x63036,'rows':_0x234234}:null;}})[_0x5f01('0x1d')](respondWithResult(_0x4c94fd,null))['catch'](handleError(_0x4c94fd,null));};exports[_0x5f01('0x76')]=function(_0x201e4d,_0x1686d0,_0x303ec8){return db[_0x5f01('0x3b')][_0x5f01('0x64')]({'where':{'id':_0x201e4d[_0x5f01('0x51')]['id']}})[_0x5f01('0x1d')](handleEntityNotFound(_0x1686d0,null))[_0x5f01('0x1d')](function(_0x13c809){if(_0x13c809){return db[_0x5f01('0x77')][_0x5f01('0x78')](function(_0x228ea1){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x201e4d[_0x5f01('0x51')]['id']},'transaction':_0x228ea1})['then'](function(_0x305321){var _0x413c42=_[_0x5f01('0x3a')](_0x201e4d['body'],function(_0x4482f9){_0x4482f9['WhatsappAccountId']=_0x201e4d[_0x5f01('0x51')]['id'];return _0x4482f9;});return db[_0x5f01('0x79')]['bulkCreate'](_0x413c42,{'transaction':_0x228ea1});});})[_0x5f01('0x1d')](function(){return db['WhatsappApplication'][_0x5f01('0x7a')]({'where':{'WhatsappAccountId':_0x201e4d[_0x5f01('0x51')]['id']},'order':_0x5f01('0x7b')});});}})[_0x5f01('0x1d')](respondWithResult(_0x1686d0,null))[_0x5f01('0x54')](handleError(_0x1686d0,null));};exports['getApplications']=function(_0x368c21,_0xcc8d6b,_0x38f5b7){var _0x4e08bf={};var _0x3b6106={};var _0x26ca52;var _0x58d9a1;return db['WhatsappAccount']['findOne']({'where':{'id':_0x368c21['params']['id']}})[_0x5f01('0x1d')](handleEntityNotFound(_0xcc8d6b,null))[_0x5f01('0x1d')](function(_0xcb8669){if(_0xcb8669){_0x26ca52=_0xcb8669;_0x3b6106[_0x5f01('0x3e')]=_['keys'](db[_0x5f01('0x79')][_0x5f01('0x3c')]);_0x3b6106[_0x5f01('0x40')]=_[_0x5f01('0x3f')](_0x368c21[_0x5f01('0x40')]);_0x3b6106['filters']=_['intersection'](_0x3b6106[_0x5f01('0x3e')],_0x3b6106[_0x5f01('0x40')]);_0x4e08bf[_0x5f01('0x43')]=_[_0x5f01('0x42')](_0x3b6106[_0x5f01('0x3e')],qs['fields'](_0x368c21[_0x5f01('0x40')]['fields']));_0x4e08bf['attributes']=_0x4e08bf[_0x5f01('0x43')][_0x5f01('0x45')]?_0x4e08bf[_0x5f01('0x43')]:_0x3b6106[_0x5f01('0x3e')];_0x4e08bf[_0x5f01('0x65')]=qs[_0x5f01('0x48')](_0x368c21[_0x5f01('0x40')][_0x5f01('0x48')]);_0x4e08bf['where']=qs[_0x5f01('0x41')](_[_0x5f01('0x66')](_0x368c21[_0x5f01('0x40')],_0x3b6106[_0x5f01('0x41')]));if(_0x368c21[_0x5f01('0x40')][_0x5f01('0x4a')]){_0x4e08bf[_0x5f01('0x49')]=_[_0x5f01('0x4b')](_0x4e08bf['where'],{'$or':_['map'](_0x4e08bf[_0x5f01('0x43')],function(_0x547271){var _0x193d90={};_0x193d90[_0x547271]={'$like':'%'+_0x368c21[_0x5f01('0x40')][_0x5f01('0x4a')]+'%'};return _0x193d90;})});}_0x4e08bf=_[_0x5f01('0x4b')]({},_0x4e08bf,_0x368c21[_0x5f01('0x67')]);return _0x26ca52[_0x5f01('0x7c')](_0x4e08bf);}})['then'](function(_0xa02cad){if(_0xa02cad){_0x58d9a1=_0xa02cad['length'];if(!_0x368c21[_0x5f01('0x40')][_0x5f01('0x46')](_0x5f01('0x47'))){_0x4e08bf[_0x5f01('0x2b')]=qs[_0x5f01('0x2b')](_0x368c21[_0x5f01('0x40')][_0x5f01('0x2b')]);_0x4e08bf[_0x5f01('0x28')]=qs[_0x5f01('0x28')](_0x368c21[_0x5f01('0x40')][_0x5f01('0x28')]);}return _0x26ca52[_0x5f01('0x7c')](_0x4e08bf);}})[_0x5f01('0x1d')](function(_0x39ef95){if(_0x39ef95){return _0x39ef95?{'count':_0x58d9a1,'rows':_0x39ef95}:null;}})[_0x5f01('0x1d')](respondWithResult(_0xcc8d6b,null))[_0x5f01('0x54')](handleError(_0xcc8d6b,null));};exports[_0x5f01('0x7d')]=function(_0x137f86,_0x2a57ff,_0x1b4973){var _0x3188b2={'channel':'whatsapp'};var _0x183b7e=[];var _0xb22910=[];var _0xb39001={};return db['WhatsappAccount']['find']({'where':{'id':_0x137f86[_0x5f01('0x51')]['id']},'include':[{'model':db[_0x5f01('0x79')],'as':_0x5f01('0x7e')}]})['then'](handleEntityNotFound(_0x2a57ff,null))[_0x5f01('0x1d')](function(_0x307d62){_0x3188b2['account']=_0x307d62;_0x3188b2[_0x5f01('0x7f')]=_[_0x5f01('0x80')](_0x307d62[_0x5f01('0x7e')],[_0x5f01('0x7b')],[_0x5f01('0x81')]);if(_0x3188b2[_0x5f01('0x82')]['Applications']){delete _0x3188b2['account'][_0x5f01('0x7e')];}return db[_0x5f01('0x83')][_0x5f01('0x5f')]();})['then'](function(_0x58e187){if(!_0x58e187){throw new db['Sequelize'][(_0x5f01('0x84'))](_0x5f01('0x85'));}_0x183b7e=_[_0x5f01('0x86')](_[_0x5f01('0x3f')](_0x58e187),['createdAt',_0x5f01('0x87')]);_0xb22910=_['difference'](_[_0x5f01('0x3f')](_0x58e187),[_0x5f01('0x88'),_0x5f01('0x87'),_0x5f01('0x89'),_0x5f01('0x8a')]);_0x3188b2['body']={'mapKey':'mobile'};if(_0x3188b2[_0x5f01('0x82')][_0x5f01('0x4c')]&&_0x3188b2[_0x5f01('0x82')]['type']===_0x5f01('0x8b')){_0x3188b2['body']['from']=_0x137f86[_0x5f01('0x56')][_0x5f01('0x8c')][_0x5f01('0x8d')](_0x5f01('0x8e'),'');_0x3188b2[_0x5f01('0x56')][_0x5f01('0x56')]=_0x137f86['body']['Body'];_0x3188b2[_0x5f01('0x56')][_0x5f01('0x8f')]=_0x137f86[_0x5f01('0x56')][_0x5f01('0x90')];}if(_0x3188b2[_0x5f01('0x56')]['id']){delete _0x3188b2[_0x5f01('0x56')]['id'];}if(_[_0x5f01('0x91')](_0x3188b2[_0x5f01('0x56')][_0x5f01('0x92')])){throw new db['Sequelize'][(_0x5f01('0x84'))](_0x5f01('0x93'));}if(_[_0x5f01('0x91')](_0x3188b2['body'][_0x5f01('0x56')])||_0x3188b2['body'][_0x5f01('0x56')]===''){throw new db[(_0x5f01('0x94'))][(_0x5f01('0x84'))](_0x5f01('0x95'));}if(_[_0x5f01('0x91')](_0x3188b2[_0x5f01('0x56')]['mapKey'])){throw new db[(_0x5f01('0x94'))][(_0x5f01('0x84'))](_0x5f01('0x96')+_0xb22910);}if(!_[_0x5f01('0x97')](_0xb22910,_0x3188b2[_0x5f01('0x56')][_0x5f01('0x98')])){throw new db[(_0x5f01('0x94'))][(_0x5f01('0x84'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xb22910);}_0xb39001[_0x3188b2[_0x5f01('0x56')]['mapKey']]=_0x3188b2[_0x5f01('0x56')][_0x5f01('0x92')];return db[_0x5f01('0x99')][_0x5f01('0x53')]({'where':{'id':_0x3188b2['account'][_0x5f01('0x8a')]},'include':[{'model':db[_0x5f01('0x83')],'as':_0x5f01('0x9a'),'where':_0xb39001,'limit':0x1,'order':[[_0x5f01('0x87'),_0x5f01('0x9b')]]}]});})[_0x5f01('0x1d')](handleEntityNotFound(_0x2a57ff,null))[_0x5f01('0x1d')](function(_0x5a481a){if(_0x5a481a){_0x3188b2[_0x5f01('0x9c')]=_[_0x5f01('0x6f')](_0x5a481a,['Contacts']);if(_0x5a481a[_0x5f01('0x9a')][_0x5f01('0x45')]){return _0x5a481a['Contacts'][0x0];}var _0x36bfab=_[_0x5f01('0x17')](_0x3188b2[_0x5f01('0x56')],{'firstName':_0x3188b2[_0x5f01('0x56')][_0x5f01('0x92')],'ListId':_0x5a481a['id']});_0x36bfab[_0x3188b2[_0x5f01('0x56')][_0x5f01('0x98')]]=_0x3188b2[_0x5f01('0x56')][_0x5f01('0x92')];return db[_0x5f01('0x83')]['create'](_0x36bfab,{'fields':_0x183b7e,'raw':!![]});}})[_0x5f01('0x1d')](handleEntityNotFound(_0x2a57ff,null))['then'](function(_0x457bf0){if(_0x457bf0){_0x3188b2[_0x5f01('0x9d')]=_0x457bf0;var _0xff247c={'ContactId':_0x457bf0['id'],'phone':_0x3188b2[_0x5f01('0x56')]['from'],'WhatsappAccountId':_0x137f86[_0x5f01('0x51')]['id']};var _0x2c2775={'ContactId':_0x457bf0['id'],'WhatsappAccountId':_0x137f86[_0x5f01('0x51')]['id'],'closed':![]};return db[_0x5f01('0x9e')][_0x5f01('0x53')]({'where':_0x2c2775})[_0x5f01('0x1d')](function(_0x60ae4e){if(_0x60ae4e){return[_0x60ae4e,![]];}return db['WhatsappInteraction'][_0x5f01('0x55')](_0xff247c)[_0x5f01('0x1d')](function(_0x2c7389){return[_0x2c7389,!![]];});});}})[_0x5f01('0x70')](function(_0x54b34a,_0x5a197c){_0x3188b2[_0x5f01('0x9f')]=_0x54b34a['get']({'plain':!![]});_0x3188b2[_0x5f01('0x9f')][_0x5f01('0xa0')]=![];if(_0x5a197c){if(_0x3188b2[_0x5f01('0x82')][_0x5f01('0xa1')]){_0x3188b2['applications'][_0x5f01('0xa2')]({'id':0x0,'priority':_0x3188b2[_0x5f01('0x7f')]['length']+0x1,'app':_0x5f01('0xa3'),'appdata':_0x5f01('0xa4'),'interval':'*,*,*,*'});}_0x3188b2[_0x5f01('0x9f')][_0x5f01('0xa0')]=!![];}return db['WhatsappMessage'][_0x5f01('0x55')]({'phone':_0x3188b2[_0x5f01('0x56')][_0x5f01('0x92')],'messageId':_0x3188b2['body'][_0x5f01('0x8f')],'body':_0x3188b2[_0x5f01('0x56')][_0x5f01('0x56')],'WhatsappAccountId':_0x137f86[_0x5f01('0x51')]['id'],'WhatsappInteractionId':_0x54b34a['id'],'direction':'in','ContactId':_0x54b34a[_0x5f01('0xa5')],'AttachmentId':_0x3188b2[_0x5f01('0x56')][_0x5f01('0xa6')]});})[_0x5f01('0x1d')](function(_0x57d861){_0x3188b2[_0x5f01('0x24')]=_0x57d861;if(_0x3188b2['interaction'][_0x5f01('0xa7')]){return db[_0x5f01('0x74')]['find']({'attributes':['id',_0x5f01('0x36')],'where':{'id':_0x3188b2[_0x5f01('0x9f')][_0x5f01('0xa7')]}})[_0x5f01('0x1d')](function(_0x5e9e85){if(_0x5e9e85){_0x3188b2[_0x5f01('0x7f')][_0x5f01('0xa8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5e9e85['name']+','+(_0x3188b2[_0x5f01('0x82')][_0x5f01('0xa9')]||0xa),'interval':_0x5f01('0xaa')});}return respondWithRpcPromise(_0x5f01('0xab'),_0x5f01('0xac'),_0x3188b2);});}return respondWithRpcPromise(_0x5f01('0xab'),_0x5f01('0xac'),_0x3188b2);})['then'](function(_0x1fa2a1){if(_0x1fa2a1){var _0x5dfb22=0xc8;var _0x5d84aa='receiveMessage';logger[_0x5f01('0x1e')](_0x5f01('0x20'),_0x5d84aa,_0x5dfb22,_0x5f01('0xad'));logger['debug'](_0x5f01('0xae'),_0x5d84aa,_0x5dfb22,'entity\x20found',JSON[_0x5f01('0x21')](_0x1fa2a1));if(_0x3188b2[_0x5f01('0x82')]['type']===_0x5f01('0x8b')){return _0x2a57ff[_0x5f01('0x26')](_0x5dfb22)[_0x5f01('0x2c')](_0x5f01('0xaf'),_0x5f01('0xb0'))['send']('\x0a');}else{return _0x2a57ff[_0x5f01('0x26')](_0x5dfb22)['json'](_0x1fa2a1);}}})['catch'](handleError(_0x2a57ff,null));};exports['send']=function(_0x5c920e,_0x20b56a,_0x59bbde){var _0xdb379,_0x360b3e,_0x1bbba2;if(_[_0x5f01('0x91')](_0x5c920e[_0x5f01('0x56')][_0x5f01('0x56')])||_0x5c920e[_0x5f01('0x56')][_0x5f01('0x56')]===''){throw new db[(_0x5f01('0x94'))]['ValidationError'](_0x5f01('0x95'));}if(_[_0x5f01('0x91')](_0x5c920e[_0x5f01('0x56')]['to'])){throw new db['Sequelize'][(_0x5f01('0x84'))](_0x5f01('0xb1'));}_0xdb379=_0x5c920e[_0x5f01('0x56')]['to'];return db[_0x5f01('0x3b')]['find']({'where':{'id':_0x5c920e[_0x5f01('0x51')]['id']},'include':[{'model':db['CmList'],'as':_0x5f01('0xb2'),'include':[{'model':db['CmContact'],'as':_0x5f01('0x9a'),'where':{'mobile':_0xdb379},'limit':0x1,'order':[[_0x5f01('0x87'),_0x5f01('0x9b')]]}]}]})[_0x5f01('0x1d')](handleEntityNotFound(_0x20b56a,null))[_0x5f01('0x1d')](function(_0x4773d5){if(_0x4773d5&&_0x4773d5[_0x5f01('0xb2')]){_0x360b3e=_0x4773d5[_0x5f01('0x32')]({'plain':!![]});if(_0x360b3e[_0x5f01('0xb2')]&&_0x360b3e[_0x5f01('0xb2')][_0x5f01('0x9a')][_0x5f01('0x45')]){return _0x360b3e[_0x5f01('0xb2')][_0x5f01('0x9a')][0x0];}return db['CmContact']['create'](_[_0x5f01('0x17')](_0x5c920e['body'],{'firstName':_0xdb379,'mobile':_0xdb379,'phone':_0xdb379,'ListId':_0x360b3e[_0x5f01('0x8a')]}));}})['then'](handleEntityNotFound(_0x20b56a,null))[_0x5f01('0x1d')](function(_0x1c8698){if(_0x1c8698){_0x1bbba2=_0x1c8698;return db[_0x5f01('0x9e')][_0x5f01('0x53')]({'where':{'ContactId':_0x1bbba2['id'],'closed':![],'WhatsappAccountId':_0x360b3e['id']}})[_0x5f01('0x1d')](function(_0x395e28){if(_0x395e28){return[_0x395e28,![]];}return db[_0x5f01('0x9e')][_0x5f01('0x55')]({'UserId':_0x5c920e[_0x5f01('0x59')]['id'],'ContactId':_0x1bbba2['id'],'WhatsappAccountId':_0x360b3e['id'],'phone':_0xdb379,'firstMsgDirection':'out','Messages':[_[_0x5f01('0x4b')](_0x5c920e[_0x5f01('0x56')],{'read':![],'body':_0x5c920e['body'][_0x5f01('0x56')],'phone':_0xdb379,'WhatsappAccountId':_0x360b3e['id'],'UserId':_0x5c920e[_0x5f01('0x59')]['id'],'ContactId':_0x1bbba2['id']})]},{'include':[{'model':db[_0x5f01('0xb3')],'as':_0x5f01('0xb4')}]})['then'](function(_0x586267){return[_0x586267,!![]];});});}})[_0x5f01('0x70')](function(_0x19e565,_0x18c6d){if(_0x18c6d){return _0x19e565;}return db['WhatsappMessage'][_0x5f01('0x55')](_[_0x5f01('0x4b')](_0x5c920e[_0x5f01('0x56')],{'read':![],'body':_0x5c920e[_0x5f01('0x56')][_0x5f01('0x56')],'phone':_0xdb379,'WhatsappAccountId':_0x360b3e['id'],'WhatsappInteractionId':_0x19e565['id'],'UserId':_0x5c920e[_0x5f01('0x59')]['id'],'ContactId':_0x1bbba2['id']}))[_0x5f01('0x1d')](function(_0x11e469){_0x19e565['dataValues'][_0x5f01('0xb4')]=[];_0x19e565[_0x5f01('0xb5')][_0x5f01('0xb4')][_0x5f01('0xa2')](_0x11e469[_0x5f01('0xb5')]);return _0x19e565;});})[_0x5f01('0x1d')](respondWithResult(_0x20b56a,null))['catch'](handleError(_0x20b56a,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 7274137..e1b4f80 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 _0xe185=['hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','update','remove','emit'];(function(_0x47b947,_0x316fd0){var _0x3d0aa1=function(_0x25e9e8){while(--_0x25e9e8){_0x47b947['push'](_0x47b947['shift']());}};_0x3d0aa1(++_0x316fd0);}(_0xe185,0xa3));var _0x5e18=function(_0x48e765,_0x183055){_0x48e765=_0x48e765-0x0;var _0x15ec0f=_0xe185[_0x48e765];return _0x15ec0f;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x5e18('0x0'))['db'][_0x5e18('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5e18('0x2'),'afterDestroy':_0x5e18('0x3')};function emitEvent(_0x282602){return function(_0x40a065,_0x18419e,_0x12b204){WhatsappAccountEvents['emit'](_0x282602+':'+_0x40a065['id'],_0x40a065);WhatsappAccountEvents[_0x5e18('0x4')](_0x282602,_0x40a065);_0x12b204(null);};}for(var e in events){if(events[_0x5e18('0x5')](e)){var event=events[e];WhatsappAccount[_0x5e18('0x6')](e,emitEvent(event));}}module[_0x5e18('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0xdb2e=['update','remove','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x1863fb,_0x295718){var _0xae8a02=function(_0x4af06f){while(--_0x4af06f){_0x1863fb['push'](_0x1863fb['shift']());}};_0xae8a02(++_0x295718);}(_0xdb2e,0x1f4));var _0xedb2=function(_0x352311,_0x5b2dfc){_0x352311=_0x352311-0x0;var _0x15c3c6=_0xdb2e[_0x352311];return _0x15c3c6;};'use strict';var EventEmitter=require(_0xedb2('0x0'));var WhatsappAccount=require(_0xedb2('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xedb2('0x2')](0x0);var events={'afterCreate':_0xedb2('0x3'),'afterUpdate':_0xedb2('0x4'),'afterDestroy':_0xedb2('0x5')};function emitEvent(_0x3ed238){return function(_0x5c5648,_0x82ccfc,_0x4f505c){WhatsappAccountEvents['emit'](_0x3ed238+':'+_0x5c5648['id'],_0x5c5648);WhatsappAccountEvents['emit'](_0x3ed238,_0x5c5648);_0x4f505c(null);};}for(var e in events){if(events[_0xedb2('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xedb2('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 448385b..024ce5e 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 _0x40e5=['bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger'];(function(_0x2bb48e,_0x2d1e21){var _0x43366d=function(_0x2efa39){while(--_0x2efa39){_0x2bb48e['push'](_0x2bb48e['shift']());}};_0x43366d(++_0x2d1e21);}(_0x40e5,0x1ac));var _0x540e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x40e5[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x540e('0x0'));var util=require('util');var logger=require(_0x540e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x540e('0x2'));var rp=require(_0x540e('0x3'));var fs=require('fs');var path=require(_0x540e('0x4'));var rimraf=require('rimraf');var config=require(_0x540e('0x5'));var attributes=require(_0x540e('0x6'));module['exports']=function(_0x24361d,_0x4fe09e){return _0x24361d[_0x540e('0x7')](_0x540e('0x8'),attributes,{'tableName':_0x540e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8933=['../../config/logger','api','moment','request-promise','path','../../config/environment','./whatsappAccount.attributes','exports','util'];(function(_0x8698aa,_0x1de814){var _0x322bc5=function(_0x5989fd){while(--_0x5989fd){_0x8698aa['push'](_0x8698aa['shift']());}};_0x322bc5(++_0x1de814);}(_0x8933,0x170));var _0x3893=function(_0x5a1dc8,_0x4f85f4){_0x5a1dc8=_0x5a1dc8-0x0;var _0x4b9afd=_0x8933[_0x5a1dc8];return _0x4b9afd;};'use strict';var _=require('lodash');var util=require(_0x3893('0x0'));var logger=require(_0x3893('0x1'))(_0x3893('0x2'));var moment=require(_0x3893('0x3'));var BPromise=require('bluebird');var rp=require(_0x3893('0x4'));var fs=require('fs');var path=require(_0x3893('0x5'));var rimraf=require('rimraf');var config=require(_0x3893('0x6'));var attributes=require(_0x3893('0x7'));module[_0x3893('0x8')]=function(_0x54d122,_0x1f1580){return _0x54d122['define']('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','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 2a10a4a..206e524 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 _0x7f0e=['then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','attributes','include','map','model','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request'];(function(_0x7a7a90,_0x5b9f88){var _0x4acea0=function(_0x51dd5c){while(--_0x51dd5c){_0x7a7a90['push'](_0x7a7a90['shift']());}};_0x4acea0(++_0x5b9f88);}(_0x7f0e,0xd9));var _0xe7f0=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7f0e[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe7f0('0x0'));var rs=require(_0xe7f0('0x1'));var fs=require('fs');var Redis=require(_0xe7f0('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe7f0('0x3'));var config=require(_0xe7f0('0x4'));var jayson=require(_0xe7f0('0x5'));var client=jayson[_0xe7f0('0x6')][_0xe7f0('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe7f0('0x8')],{'host':_0xe7f0('0x9'),'port':0x18eb});var socket=require(_0xe7f0('0xa'))(new Redis(config['redis']));require(_0xe7f0('0xb'))[_0xe7f0('0xc')](socket);function respondWithRpcPromise(_0x7414ac,_0x502454,_0x18622e){return new BPromise(function(_0xffb82f,_0x16fbe7){return client[_0xe7f0('0xd')](_0x7414ac,_0x18622e)[_0xe7f0('0xe')](function(_0x6fe593){logger[_0xe7f0('0xf')](_0xe7f0('0x10'),_0x502454,_0xe7f0('0x11'));logger[_0xe7f0('0x12')](_0xe7f0('0x13'),_0x502454,_0xe7f0('0x11'),JSON[_0xe7f0('0x14')](_0x6fe593));if(_0x6fe593[_0xe7f0('0x15')]){if(_0x6fe593[_0xe7f0('0x15')][_0xe7f0('0x16')]===0x1f4){logger[_0xe7f0('0x15')](_0xe7f0('0x10'),_0x502454,_0x6fe593[_0xe7f0('0x15')]['message']);return _0x16fbe7(_0x6fe593[_0xe7f0('0x15')]['message']);}logger[_0xe7f0('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x502454,_0x6fe593[_0xe7f0('0x15')][_0xe7f0('0x17')]);return _0xffb82f(_0x6fe593[_0xe7f0('0x15')][_0xe7f0('0x17')]);}else{logger[_0xe7f0('0xf')](_0xe7f0('0x10'),_0x502454,_0xe7f0('0x11'));_0xffb82f(_0x6fe593[_0xe7f0('0x18')][_0xe7f0('0x17')]);}})[_0xe7f0('0x19')](function(_0x3dbbd6){logger[_0xe7f0('0x15')](_0xe7f0('0x10'),_0x502454,_0x3dbbd6);_0x16fbe7(_0x3dbbd6);});});}exports[_0xe7f0('0x1a')]=function(_0x31af6d){var _0x566697=this;return new Promise(function(_0x5b6ef4,_0x2f84c4){return db[_0xe7f0('0x1b')]['find']({'raw':_0x31af6d[_0xe7f0('0x1c')]?_0x31af6d['options']['raw']===undefined?!![]:![]:!![],'where':_0x31af6d[_0xe7f0('0x1c')]?_0x31af6d[_0xe7f0('0x1c')]['where']||null:null,'attributes':_0x31af6d['options']?_0x31af6d[_0xe7f0('0x1c')][_0xe7f0('0x1d')]||null:null,'include':_0x31af6d['options']?_0x31af6d['options'][_0xe7f0('0x1e')]?_[_0xe7f0('0x1f')](_0x31af6d[_0xe7f0('0x1c')][_0xe7f0('0x1e')],function(_0x4da125){return{'model':db[_0x4da125[_0xe7f0('0x20')]],'as':_0x4da125['as'],'attributes':_0x4da125[_0xe7f0('0x1d')],'include':_0x4da125[_0xe7f0('0x1e')]?_[_0xe7f0('0x1f')](_0x4da125['include'],function(_0x573c86){return{'model':db[_0x573c86[_0xe7f0('0x20')]],'as':_0x573c86['as'],'attributes':_0x573c86[_0xe7f0('0x1d')],'include':_0x573c86['include']?_['map'](_0x573c86[_0xe7f0('0x1e')],function(_0x38ee00){return{'model':db[_0x38ee00['model']],'as':_0x38ee00['as'],'attributes':_0x38ee00[_0xe7f0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe7f0('0xe')](function(_0xdf9fe2){logger['info'](_0xe7f0('0x1a'),_0x31af6d);logger[_0xe7f0('0x12')](_0xe7f0('0x1a'),_0x31af6d,JSON['stringify'](_0xdf9fe2));_0x5b6ef4(_0xdf9fe2);})[_0xe7f0('0x19')](function(_0x4dbb92){logger[_0xe7f0('0x15')](_0xe7f0('0x1a'),_0x4dbb92[_0xe7f0('0x17')],_0x31af6d);_0x2f84c4(_0x566697[_0xe7f0('0x15')](0x1f4,_0x4dbb92[_0xe7f0('0x17')]));});});}; \ No newline at end of file +var _0x2ccd=['ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','map','include','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2ccd,0x142));var _0xd2cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ccd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd2cc('0x0'));var util=require(_0xd2cc('0x1'));var moment=require(_0xd2cc('0x2'));var BPromise=require(_0xd2cc('0x3'));var rs=require(_0xd2cc('0x4'));var fs=require('fs');var Redis=require(_0xd2cc('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd2cc('0x6'))(_0xd2cc('0x7'));var config=require(_0xd2cc('0x8'));var jayson=require(_0xd2cc('0x9'));var client=jayson[_0xd2cc('0xa')][_0xd2cc('0xb')]({'port':0x232a});config['redis']=_[_0xd2cc('0xc')](config[_0xd2cc('0xd')],{'host':_0xd2cc('0xe'),'port':0x18eb});var socket=require(_0xd2cc('0xf'))(new Redis(config[_0xd2cc('0xd')]));require(_0xd2cc('0x10'))[_0xd2cc('0x11')](socket);function respondWithRpcPromise(_0x4ce112,_0x437d18,_0x21665a){return new BPromise(function(_0x4591cf,_0x5623bb){return client['request'](_0x4ce112,_0x21665a)['then'](function(_0x8fa87e){logger[_0xd2cc('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x437d18,'request\x20sent');logger[_0xd2cc('0x13')](_0xd2cc('0x14'),_0x437d18,_0xd2cc('0x15'),JSON[_0xd2cc('0x16')](_0x8fa87e));if(_0x8fa87e[_0xd2cc('0x17')]){if(_0x8fa87e[_0xd2cc('0x17')][_0xd2cc('0x18')]===0x1f4){logger[_0xd2cc('0x17')](_0xd2cc('0x19'),_0x437d18,_0x8fa87e['error']['message']);return _0x5623bb(_0x8fa87e['error'][_0xd2cc('0x1a')]);}logger['error'](_0xd2cc('0x19'),_0x437d18,_0x8fa87e[_0xd2cc('0x17')][_0xd2cc('0x1a')]);return _0x4591cf(_0x8fa87e[_0xd2cc('0x17')][_0xd2cc('0x1a')]);}else{logger['info'](_0xd2cc('0x19'),_0x437d18,_0xd2cc('0x15'));_0x4591cf(_0x8fa87e[_0xd2cc('0x1b')][_0xd2cc('0x1a')]);}})[_0xd2cc('0x1c')](function(_0x35d256){logger[_0xd2cc('0x17')](_0xd2cc('0x19'),_0x437d18,_0x35d256);_0x5623bb(_0x35d256);});});}exports[_0xd2cc('0x1d')]=function(_0x101d15){var _0x2d22ad=this;return new Promise(function(_0x12e39e,_0x55a1a1){return db[_0xd2cc('0x1e')]['find']({'raw':_0x101d15[_0xd2cc('0x1f')]?_0x101d15[_0xd2cc('0x1f')][_0xd2cc('0x20')]===undefined?!![]:![]:!![],'where':_0x101d15['options']?_0x101d15['options'][_0xd2cc('0x21')]||null:null,'attributes':_0x101d15[_0xd2cc('0x1f')]?_0x101d15[_0xd2cc('0x1f')][_0xd2cc('0x22')]||null:null,'include':_0x101d15[_0xd2cc('0x1f')]?_0x101d15[_0xd2cc('0x1f')]['include']?_[_0xd2cc('0x23')](_0x101d15[_0xd2cc('0x1f')][_0xd2cc('0x24')],function(_0x2736af){return{'model':db[_0x2736af['model']],'as':_0x2736af['as'],'attributes':_0x2736af[_0xd2cc('0x22')],'include':_0x2736af[_0xd2cc('0x24')]?_[_0xd2cc('0x23')](_0x2736af[_0xd2cc('0x24')],function(_0x5451a8){return{'model':db[_0x5451a8['model']],'as':_0x5451a8['as'],'attributes':_0x5451a8[_0xd2cc('0x22')],'include':_0x5451a8[_0xd2cc('0x24')]?_[_0xd2cc('0x23')](_0x5451a8['include'],function(_0x58c0f1){return{'model':db[_0x58c0f1[_0xd2cc('0x25')]],'as':_0x58c0f1['as'],'attributes':_0x58c0f1['attributes']};}):[]};}):[]};}):[]:[]})[_0xd2cc('0x26')](function(_0x54eb38){logger[_0xd2cc('0x12')](_0xd2cc('0x1d'),_0x101d15);logger[_0xd2cc('0x13')]('ShowWhatsappAccount',_0x101d15,JSON['stringify'](_0x54eb38));_0x12e39e(_0x54eb38);})[_0xd2cc('0x1c')](function(_0x111647){logger[_0xd2cc('0x17')](_0xd2cc('0x1d'),_0x111647[_0xd2cc('0x1a')],_0x101d15);_0x55a1a1(_0x2d22ad[_0xd2cc('0x17')](0x1f4,_0x111647[_0xd2cc('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 42e2f12..b720a32 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 _0xffd6=['remove','update','emit','register','length','./whatsappAccount.events','save'];(function(_0x14f4af,_0x7a2e66){var _0x392414=function(_0x27764e){while(--_0x27764e){_0x14f4af['push'](_0x14f4af['shift']());}};_0x392414(++_0x7a2e66);}(_0xffd6,0x15c));var _0x6ffd=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xffd6[_0x45d3f0];return _0x314b79;};'use strict';var WhatsappAccountEvents=require(_0x6ffd('0x0'));var events=[_0x6ffd('0x1'),_0x6ffd('0x2'),_0x6ffd('0x3')];function createListener(_0x588d90,_0x52575a){return function(_0x1b76b0){_0x52575a[_0x6ffd('0x4')](_0x588d90,_0x1b76b0);};}function removeListener(_0x465ff1,_0x404650){return function(){WhatsappAccountEvents['removeListener'](_0x465ff1,_0x404650);};}exports[_0x6ffd('0x5')]=function(_0x3565f7){for(var _0x95337c=0x0,_0x365ebc=events[_0x6ffd('0x6')];_0x95337c<_0x365ebc;_0x95337c++){var _0xa526d2=events[_0x95337c];var _0x5f4663=createListener('whatsappAccount:'+_0xa526d2,_0x3565f7);WhatsappAccountEvents['on'](_0xa526d2,_0x5f4663);}}; \ No newline at end of file +var _0xd2cb=['removeListener','length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit'];(function(_0x592d48,_0x23f1ba){var _0x5d789e=function(_0x156900){while(--_0x156900){_0x592d48['push'](_0x592d48['shift']());}};_0x5d789e(++_0x23f1ba);}(_0xd2cb,0xfb));var _0xbd2c=function(_0x5da1e1,_0xb4e16d){_0x5da1e1=_0x5da1e1-0x0;var _0x1e8871=_0xd2cb[_0x5da1e1];return _0x1e8871;};'use strict';var WhatsappAccountEvents=require(_0xbd2c('0x0'));var events=[_0xbd2c('0x1'),_0xbd2c('0x2'),_0xbd2c('0x3')];function createListener(_0x14f263,_0x37b537){return function(_0x2f7b6e){_0x37b537[_0xbd2c('0x4')](_0x14f263,_0x2f7b6e);};}function removeListener(_0x36ab54,_0x2df3a6){return function(){WhatsappAccountEvents[_0xbd2c('0x5')](_0x36ab54,_0x2df3a6);};}exports['register']=function(_0x34394d){for(var _0x299433=0x0,_0x155311=events[_0xbd2c('0x6')];_0x299433<_0x155311;_0x299433++){var _0x34abd4=events[_0x299433];var _0x5a5c8b=createListener(_0xbd2c('0x7')+_0x34abd4,_0x34394d);WhatsappAccountEvents['on'](_0x34abd4,_0x5a5c8b);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 85b4008..4dab498 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 _0xfc2d=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/:id','post','create','update','delete','destroy'];(function(_0x766909,_0x510154){var _0x16bc3f=function(_0x5259c5){while(--_0x5259c5){_0x766909['push'](_0x766909['shift']());}};_0x16bc3f(++_0x510154);}(_0xfc2d,0x90));var _0xdfc2=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xfc2d[_0x4fbfd9];return _0x31dc94;};'use strict';var multer=require(_0xdfc2('0x0'));var util=require(_0xdfc2('0x1'));var path=require(_0xdfc2('0x2'));var timeout=require(_0xdfc2('0x3'));var express=require(_0xdfc2('0x4'));var router=express[_0xdfc2('0x5')]();var fs_extra=require(_0xdfc2('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdfc2('0x7'));var controller=require('./whatsappApplication.controller');router[_0xdfc2('0x8')]('/',auth[_0xdfc2('0x9')](),controller['index']);router['get'](_0xdfc2('0xa'),auth[_0xdfc2('0x9')](),controller['show']);router[_0xdfc2('0xb')]('/',auth[_0xdfc2('0x9')](),controller[_0xdfc2('0xc')]);router['put']('/:id',auth[_0xdfc2('0x9')](),controller[_0xdfc2('0xd')]);router[_0xdfc2('0xe')](_0xdfc2('0xa'),auth[_0xdfc2('0x9')](),controller[_0xdfc2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7f9f=['post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f9f,0x1d5));var _0xf7f9=function(_0x16c95c,_0x161bae){_0x16c95c=_0x16c95c-0x0;var _0x33b153=_0x7f9f[_0x16c95c];return _0x33b153;};'use strict';var multer=require(_0xf7f9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf7f9('0x1'));var express=require(_0xf7f9('0x2'));var router=express[_0xf7f9('0x3')]();var fs_extra=require(_0xf7f9('0x4'));var auth=require(_0xf7f9('0x5'));var interaction=require(_0xf7f9('0x6'));var config=require(_0xf7f9('0x7'));var controller=require(_0xf7f9('0x8'));router[_0xf7f9('0x9')]('/',auth[_0xf7f9('0xa')](),controller[_0xf7f9('0xb')]);router['get'](_0xf7f9('0xc'),auth['isAuthenticated'](),controller[_0xf7f9('0xd')]);router[_0xf7f9('0xe')]('/',auth['isAuthenticated'](),controller[_0xf7f9('0xf')]);router[_0xf7f9('0x10')]('/:id',auth[_0xf7f9('0xa')](),controller[_0xf7f9('0x11')]);router[_0xf7f9('0x12')]('/:id',auth[_0xf7f9('0xa')](),controller[_0xf7f9('0x13')]);module[_0xf7f9('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 4b264ce..f50e059 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 _0x9054=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9054,0x1a6));var _0x4905=function(_0x41bbbc,_0x5c2750){_0x41bbbc=_0x41bbbc-0x0;var _0x5dd090=_0x9054[_0x41bbbc];return _0x5dd090;};'use strict';var Sequelize=require(_0x4905('0x0'));module[_0x4905('0x1')]={'priority':{'type':Sequelize[_0x4905('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4905('0x3')},'appdata':{'type':Sequelize[_0x4905('0x4')]()},'description':{'type':Sequelize[_0x4905('0x5')]},'interval':{'type':Sequelize[_0x4905('0x5')],'defaultValue':_0x4905('0x6')}}; \ No newline at end of file +var _0xc3a2=['*,*,*,*','sequelize','exports','INTEGER','noop','TEXT','STRING'];(function(_0x243de9,_0x1897bb){var _0x58e4bd=function(_0x342b42){while(--_0x342b42){_0x243de9['push'](_0x243de9['shift']());}};_0x58e4bd(++_0x1897bb);}(_0xc3a2,0xb0));var _0x2c3a=function(_0x16bc6c,_0x1bc651){_0x16bc6c=_0x16bc6c-0x0;var _0xe9f64c=_0xc3a2[_0x16bc6c];return _0xe9f64c;};'use strict';var Sequelize=require(_0x2c3a('0x0'));module[_0x2c3a('0x1')]={'priority':{'type':Sequelize[_0x2c3a('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2c3a('0x3')},'appdata':{'type':Sequelize[_0x2c3a('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2c3a('0x5')],'defaultValue':_0x2c3a('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index ce68802..a2e66a5 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 _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','WhatsappApplication','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5ae237,_0x8fdd75){_0x5ae237=_0x5ae237-0x0;var _0x5bffd6=_0x5f2f[_0x5ae237];return _0x5bffd6;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':!![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));}; \ No newline at end of file +var _0x1893=['key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','map','VIRTUAL','filter','includeAll','include','catch','keys','merge','find','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','send','index','WhatsappApplication','rawAttributes','type'];(function(_0x32e800,_0x3521f6){var _0x886dd9=function(_0x56e3cd){while(--_0x56e3cd){_0x32e800['push'](_0x32e800['shift']());}};_0x886dd9(++_0x3521f6);}(_0x1893,0xa2));var _0x3189=function(_0x26394d,_0x547eea){_0x26394d=_0x26394d-0x0;var _0x5c7861=_0x1893[_0x26394d];return _0x5c7861;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3189('0x0'));var jsonpatch=require(_0x3189('0x1'));var rp=require(_0x3189('0x2'));var moment=require(_0x3189('0x3'));var BPromise=require(_0x3189('0x4'));var Mustache=require(_0x3189('0x5'));var util=require(_0x3189('0x6'));var path=require('path');var sox=require(_0x3189('0x7'));var csv=require(_0x3189('0x8'));var ejs=require(_0x3189('0x9'));var fs=require('fs');var fs_extra=require(_0x3189('0xa'));var _=require(_0x3189('0xb'));var squel=require(_0x3189('0xc'));var crypto=require(_0x3189('0xd'));var jsforce=require(_0x3189('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3189('0x8'));var querystring=require('querystring');var Papa=require(_0x3189('0xf'));var Redis=require('ioredis');var authService=require(_0x3189('0x10'));var qs=require(_0x3189('0x11'));var as=require(_0x3189('0x12'));var hardwareService=require(_0x3189('0x13'));var logger=require('../../config/logger')(_0x3189('0x14'));var utils=require(_0x3189('0x15'));var config=require(_0x3189('0x16'));var licenseUtil=require(_0x3189('0x17'));var db=require(_0x3189('0x18'))['db'];function respondWithStatusCode(_0x5d9fff,_0x22b11e){_0x22b11e=_0x22b11e||0xcc;return function(_0x353b17){if(_0x353b17){return _0x5d9fff[_0x3189('0x19')](_0x22b11e);}return _0x5d9fff[_0x3189('0x1a')](_0x22b11e)[_0x3189('0x1b')]();};}function respondWithResult(_0x20dcc2,_0xef438){_0xef438=_0xef438||0xc8;return function(_0x25a917){if(_0x25a917){return _0x20dcc2['status'](_0xef438)[_0x3189('0x1c')](_0x25a917);}};}function respondWithFilteredResult(_0xb3e4c2,_0x1c209b){return function(_0x2fb62b){if(_0x2fb62b){var _0x486dd2=typeof _0x1c209b[_0x3189('0x1d')]==='undefined'&&typeof _0x1c209b['limit']===_0x3189('0x1e');var _0x49b1bc=_0x2fb62b[_0x3189('0x1f')];var _0xf8aed7=_0x486dd2?0x0:_0x1c209b[_0x3189('0x1d')];var _0x9905c4=_0x486dd2?_0x2fb62b['count']:_0x1c209b[_0x3189('0x1d')]+_0x1c209b[_0x3189('0x20')];var _0x16edd7;if(_0x9905c4>=_0x49b1bc){_0x9905c4=_0x49b1bc;_0x16edd7=0xc8;}else{_0x16edd7=0xce;}_0xb3e4c2['status'](_0x16edd7);return _0xb3e4c2[_0x3189('0x21')](_0x3189('0x22'),_0xf8aed7+'-'+_0x9905c4+'/'+_0x49b1bc)[_0x3189('0x1c')](_0x2fb62b);}return null;};}function patchUpdates(_0x2c1e59){return function(_0x29b275){try{jsonpatch['apply'](_0x29b275,_0x2c1e59,!![]);}catch(_0x1771a8){return BPromise[_0x3189('0x23')](_0x1771a8);}return _0x29b275[_0x3189('0x24')]();};}function saveUpdates(_0x539e12,_0x309c6e){return function(_0x47abb4){if(_0x47abb4){return _0x47abb4[_0x3189('0x25')](_0x539e12)[_0x3189('0x26')](function(_0x200f16){return _0x200f16;});}return null;};}function removeEntity(_0x38e56a,_0x1cbe33){return function(_0x393fcb){if(_0x393fcb){return _0x393fcb['destroy']()['then'](function(){_0x38e56a[_0x3189('0x1a')](0xcc)[_0x3189('0x1b')]();});}};}function handleEntityNotFound(_0x1dc1c8,_0x3cc1e5){return function(_0x103de4){if(!_0x103de4){_0x1dc1c8[_0x3189('0x19')](0x194);}return _0x103de4;};}function handleError(_0xdda38b,_0x379a48){_0x379a48=_0x379a48||0x1f4;return function(_0x17b540){logger[_0x3189('0x27')](_0x17b540['stack']);if(_0x17b540['name']){delete _0x17b540['name'];}_0xdda38b[_0x3189('0x1a')](_0x379a48)[_0x3189('0x28')](_0x17b540);};}exports[_0x3189('0x29')]=function(_0x90c31,_0x36b258){var _0x2f7504={},_0x4d453a={},_0x1ab94b={'count':0x0,'rows':[]};var _0x37b9ec=_['map'](db[_0x3189('0x2a')][_0x3189('0x2b')],function(_0x39c5e4){return{'name':_0x39c5e4['fieldName'],'type':_0x39c5e4[_0x3189('0x2c')][_0x3189('0x2d')]};});_0x4d453a[_0x3189('0x2e')]=_['map'](_0x37b9ec,_0x3189('0x2f'));_0x4d453a[_0x3189('0x30')]=_['keys'](_0x90c31[_0x3189('0x30')]);_0x4d453a[_0x3189('0x31')]=_[_0x3189('0x32')](_0x4d453a[_0x3189('0x2e')],_0x4d453a[_0x3189('0x30')]);_0x2f7504['attributes']=_['intersection'](_0x4d453a[_0x3189('0x2e')],qs['fields'](_0x90c31[_0x3189('0x30')][_0x3189('0x33')]));_0x2f7504[_0x3189('0x34')]=_0x2f7504[_0x3189('0x34')][_0x3189('0x35')]?_0x2f7504[_0x3189('0x34')]:_0x4d453a[_0x3189('0x2e')];if(!_0x90c31[_0x3189('0x30')][_0x3189('0x36')]('nolimit')){_0x2f7504[_0x3189('0x20')]=qs[_0x3189('0x20')](_0x90c31[_0x3189('0x30')][_0x3189('0x20')]);_0x2f7504[_0x3189('0x1d')]=qs[_0x3189('0x1d')](_0x90c31[_0x3189('0x30')]['offset']);}_0x2f7504['order']=qs[_0x3189('0x37')](_0x90c31['query'][_0x3189('0x37')]);_0x2f7504[_0x3189('0x38')]=qs['filters'](_[_0x3189('0x39')](_0x90c31[_0x3189('0x30')],_0x4d453a[_0x3189('0x31')]),_0x37b9ec);if(_0x90c31[_0x3189('0x30')]['filter']){_0x2f7504[_0x3189('0x38')]=_['merge'](_0x2f7504['where'],{'$or':_[_0x3189('0x3a')](_0x37b9ec,function(_0xed3041){if(_0xed3041[_0x3189('0x2c')]!==_0x3189('0x3b')){var _0x12dee0={};_0x12dee0[_0xed3041[_0x3189('0x2f')]]={'$like':'%'+_0x90c31[_0x3189('0x30')][_0x3189('0x3c')]+'%'};return _0x12dee0;}})});}_0x2f7504=_['merge']({},_0x2f7504,_0x90c31['options']);var _0x407e0a={'where':_0x2f7504[_0x3189('0x38')]};return db[_0x3189('0x2a')][_0x3189('0x1f')](_0x407e0a)[_0x3189('0x26')](function(_0xb52c70){_0x1ab94b['count']=_0xb52c70;if(_0x90c31[_0x3189('0x30')][_0x3189('0x3d')]){_0x2f7504[_0x3189('0x3e')]=[{'all':!![]}];}return db[_0x3189('0x2a')]['findAll'](_0x2f7504);})[_0x3189('0x26')](function(_0x2f0d49){_0x1ab94b['rows']=_0x2f0d49;return _0x1ab94b;})['then'](respondWithFilteredResult(_0x36b258,_0x2f7504))[_0x3189('0x3f')](handleError(_0x36b258,null));};exports['show']=function(_0x376787,_0x3074b9){var _0x38bf83={'raw':!![],'where':{'id':_0x376787['params']['id']}},_0x9593f3={};_0x9593f3[_0x3189('0x2e')]=_[_0x3189('0x40')](db['WhatsappApplication'][_0x3189('0x2b')]);_0x9593f3[_0x3189('0x30')]=_[_0x3189('0x40')](_0x376787[_0x3189('0x30')]);_0x9593f3[_0x3189('0x31')]=_['intersection'](_0x9593f3['model'],_0x9593f3[_0x3189('0x30')]);_0x38bf83['attributes']=_[_0x3189('0x32')](_0x9593f3[_0x3189('0x2e')],qs[_0x3189('0x33')](_0x376787['query'][_0x3189('0x33')]));_0x38bf83[_0x3189('0x34')]=_0x38bf83[_0x3189('0x34')]['length']?_0x38bf83[_0x3189('0x34')]:_0x9593f3[_0x3189('0x2e')];if(_0x376787[_0x3189('0x30')][_0x3189('0x3d')]){_0x38bf83[_0x3189('0x3e')]=[{'all':!![]}];}_0x38bf83=_[_0x3189('0x41')]({},_0x38bf83,_0x376787['options']);return db['WhatsappApplication'][_0x3189('0x42')](_0x38bf83)['then'](handleEntityNotFound(_0x3074b9,null))['then'](respondWithResult(_0x3074b9,null))[_0x3189('0x3f')](handleError(_0x3074b9,null));};exports['create']=function(_0x2d58fd,_0x1b6f09){return db[_0x3189('0x2a')]['create'](_0x2d58fd[_0x3189('0x43')],{})['then'](respondWithResult(_0x1b6f09,0xc9))[_0x3189('0x3f')](handleError(_0x1b6f09,null));};exports['update']=function(_0x49c4a8,_0x244166){if(_0x49c4a8['body']['id']){delete _0x49c4a8[_0x3189('0x43')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x49c4a8[_0x3189('0x44')]['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x244166,null))[_0x3189('0x26')](saveUpdates(_0x49c4a8[_0x3189('0x43')],null))[_0x3189('0x26')](respondWithResult(_0x244166,null))[_0x3189('0x3f')](handleError(_0x244166,null));};exports['destroy']=function(_0x21d446,_0x549bc7){return db['WhatsappApplication'][_0x3189('0x42')]({'where':{'id':_0x21d446[_0x3189('0x44')]['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x549bc7,null))[_0x3189('0x26')](removeEntity(_0x549bc7,null))[_0x3189('0x3f')](handleError(_0x549bc7,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 3c8283c..1cd5fe3 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 _0x4fd7=['util','../../config/logger','api','request-promise','path','../../config/environment','exports','define','whatsapp_applications','utf8mb4','lodash'];(function(_0x3a5ceb,_0x5164bc){var _0x38752b=function(_0x35d4eb){while(--_0x35d4eb){_0x3a5ceb['push'](_0x3a5ceb['shift']());}};_0x38752b(++_0x5164bc);}(_0x4fd7,0xe6));var _0x74fd=function(_0x1f8df6,_0x4d134e){_0x1f8df6=_0x1f8df6-0x0;var _0x26daba=_0x4fd7[_0x1f8df6];return _0x26daba;};'use strict';var _=require(_0x74fd('0x0'));var util=require(_0x74fd('0x1'));var logger=require(_0x74fd('0x2'))(_0x74fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x74fd('0x4'));var fs=require('fs');var path=require(_0x74fd('0x5'));var rimraf=require('rimraf');var config=require(_0x74fd('0x6'));var attributes=require('./whatsappApplication.attributes');module[_0x74fd('0x7')]=function(_0x480ec2,_0x1959e1){return _0x480ec2[_0x74fd('0x8')]('WhatsappApplication',attributes,{'tableName':_0x74fd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x74fd('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3937=['../../config/logger','api','bluebird','path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3937,0xbf));var _0x7393=function(_0x3d2070,_0x2e6ce2){_0x3d2070=_0x3d2070-0x0;var _0x3824ff=_0x3937[_0x3d2070];return _0x3824ff;};'use strict';var _=require(_0x7393('0x0'));var util=require('util');var logger=require(_0x7393('0x1'))(_0x7393('0x2'));var moment=require('moment');var BPromise=require(_0x7393('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7393('0x4'));var rimraf=require('rimraf');var config=require(_0x7393('0x5'));var attributes=require(_0x7393('0x6'));module[_0x7393('0x7')]=function(_0x1f538f,_0x15eabd){return _0x1f538f[_0x7393('0x8')](_0x7393('0x9'),attributes,{'tableName':_0x7393('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7393('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 9c4e673..dfdfd22 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 _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x55aa67,_0x52d2a5){var _0x5ce55a=function(_0x491b80){while(--_0x491b80){_0x55aa67['push'](_0x55aa67['shift']());}};_0x5ce55a(++_0x52d2a5);}(_0x54ef,0x112));var _0xf54e=function(_0x4bd79d,_0x197d17){_0x4bd79d=_0x4bd79d-0x0;var _0x1a539e=_0x54ef[_0x4bd79d];return _0x1a539e;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file +var _0x24ca=['request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x356e57,_0x2b6d46){var _0x1cb34d=function(_0x2c2460){while(--_0x2c2460){_0x356e57['push'](_0x356e57['shift']());}};_0x1cb34d(++_0x2b6d46);}(_0x24ca,0x1bc));var _0xa24c=function(_0x54d52,_0x2473ba){_0x54d52=_0x54d52-0x0;var _0x968345=_0x24ca[_0x54d52];return _0x968345;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require(_0xa24c('0x1'));var BPromise=require(_0xa24c('0x2'));var rs=require(_0xa24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa24c('0x4'))['db'];var utils=require(_0xa24c('0x5'));var logger=require(_0xa24c('0x6'))(_0xa24c('0x7'));var config=require(_0xa24c('0x8'));var jayson=require(_0xa24c('0x9'));var client=jayson[_0xa24c('0xa')][_0xa24c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd348,_0x257264,_0x9a5013){return new BPromise(function(_0x481196,_0x42d89c){return client[_0xa24c('0xc')](_0x2dd348,_0x9a5013)[_0xa24c('0xd')](function(_0x5eac78){logger[_0xa24c('0xe')](_0xa24c('0xf'),_0x257264,_0xa24c('0x10'));logger[_0xa24c('0x11')](_0xa24c('0x12'),_0x257264,_0xa24c('0x10'),JSON[_0xa24c('0x13')](_0x5eac78));if(_0x5eac78[_0xa24c('0x14')]){if(_0x5eac78[_0xa24c('0x14')]['code']===0x1f4){logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x42d89c(_0x5eac78['error'][_0xa24c('0x15')]);}logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x481196(_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x257264,_0xa24c('0x10'));_0x481196(_0x5eac78[_0xa24c('0x16')]['message']);}})['catch'](function(_0x221d21){logger[_0xa24c('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x257264,_0x221d21);_0x42d89c(_0x221d21);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 848dcb7..9c3caff 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 _0x0f4d=['isAuthenticated','/describe','describe','show','/:id/messages','getMessages','download','post','create','addMessage','whatsapp','addTags','tracked','whatsappinteraction:update','update','delete','/:id','destroy','/:id/tags','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get'];(function(_0x4392fd,_0x50daad){var _0x13c9c7=function(_0x2ca5e9){while(--_0x2ca5e9){_0x4392fd['push'](_0x4392fd['shift']());}};_0x13c9c7(++_0x50daad);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x43d7bc,_0x20428e){_0x43d7bc=_0x43d7bc-0x0;var _0x40e4be=_0x0f4d[_0x43d7bc];return _0x40e4be;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd0f4('0x0'));var express=require('express');var router=express[_0xd0f4('0x1')]();var fs_extra=require(_0xd0f4('0x2'));var auth=require(_0xd0f4('0x3'));var interaction=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var controller=require(_0xd0f4('0x6'));router[_0xd0f4('0x7')]('/',auth[_0xd0f4('0x8')](),controller['index']);router[_0xd0f4('0x7')](_0xd0f4('0x9'),auth['isAuthenticated'](),controller[_0xd0f4('0xa')]);router[_0xd0f4('0x7')]('/:id',auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xb')]);router['get'](_0xd0f4('0xc'),auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xd')]);router['get']('/:id/download',auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xe')]);router[_0xd0f4('0xf')]('/',auth[_0xd0f4('0x8')](),controller[_0xd0f4('0x10')]);router[_0xd0f4('0xf')](_0xd0f4('0xc'),auth['isAuthenticated'](),controller[_0xd0f4('0x11')]);router[_0xd0f4('0xf')]('/:id/tags',auth[_0xd0f4('0x8')](),interaction['tracked'](_0xd0f4('0x12'),'whatsappinteraction:addtags'),controller[_0xd0f4('0x13')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0xd0f4('0x14')](_0xd0f4('0x12'),_0xd0f4('0x15')),controller[_0xd0f4('0x16')]);router[_0xd0f4('0x17')](_0xd0f4('0x18'),auth[_0xd0f4('0x8')](),interaction[_0xd0f4('0x14')](_0xd0f4('0x12'),'whatsappinteraction:destroy'),controller[_0xd0f4('0x19')]);router[_0xd0f4('0x17')](_0xd0f4('0x1a'),auth[_0xd0f4('0x8')](),controller['removeTags']);module[_0xd0f4('0x1b')]=router; \ No newline at end of file +var _0xfcf0=['/:id/download','download','create','post','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags','tracked','update','delete','whatsappinteraction:destroy','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xfcf0,0x138));var _0x0fcf=function(_0x3ef4f1,_0x5f0f9b){_0x3ef4f1=_0x3ef4f1-0x0;var _0x69953c=_0xfcf0[_0x3ef4f1];return _0x69953c;};'use strict';var multer=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var path=require('path');var timeout=require(_0x0fcf('0x2'));var express=require(_0x0fcf('0x3'));var router=express[_0x0fcf('0x4')]();var fs_extra=require(_0x0fcf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var controller=require(_0x0fcf('0x8'));router[_0x0fcf('0x9')]('/',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0xb')]);router[_0x0fcf('0x9')](_0x0fcf('0xc'),auth['isAuthenticated'](),controller[_0x0fcf('0xd')]);router[_0x0fcf('0x9')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0xf')]);router[_0x0fcf('0x9')](_0x0fcf('0x10'),auth['isAuthenticated'](),controller[_0x0fcf('0x11')]);router['get'](_0x0fcf('0x12'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0fcf('0x14')]);router[_0x0fcf('0x15')]('/:id/messages',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x16')]);router[_0x0fcf('0x15')](_0x0fcf('0x17'),auth[_0x0fcf('0xa')](),interaction['tracked'](_0x0fcf('0x18'),_0x0fcf('0x19')),controller[_0x0fcf('0x1a')]);router['put'](_0x0fcf('0xe'),auth[_0x0fcf('0xa')](),interaction[_0x0fcf('0x1b')](_0x0fcf('0x18'),'whatsappinteraction:update'),controller[_0x0fcf('0x1c')]);router[_0x0fcf('0x1d')](_0x0fcf('0xe'),auth[_0x0fcf('0xa')](),interaction[_0x0fcf('0x1b')]('whatsapp',_0x0fcf('0x1e')),controller[_0x0fcf('0x1f')]);router['delete'](_0x0fcf('0x17'),auth[_0x0fcf('0xa')](),controller['removeTags']);module[_0x0fcf('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index af70deb..d7571f2 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 _0x22ed=['exports','BOOLEAN','DATE','STRING','ENUM','sequelize','moment'];(function(_0x5bb567,_0x3a99f8){var _0x1b0c3b=function(_0x24e99e){while(--_0x24e99e){_0x5bb567['push'](_0x5bb567['shift']());}};_0x1b0c3b(++_0x3a99f8);}(_0x22ed,0x1a9));var _0xd22e=function(_0x15cf2c,_0x114878){_0x15cf2c=_0x15cf2c-0x0;var _0x47b99a=_0x22ed[_0x15cf2c];return _0x47b99a;};'use strict';var Sequelize=require(_0xd22e('0x0'));var moment=require(_0xd22e('0x1'));module[_0xd22e('0x2')]={'closed':{'type':Sequelize[_0xd22e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd22e('0x4')]},'disposition':{'type':Sequelize[_0xd22e('0x5')]},'secondDisposition':{'type':Sequelize[_0xd22e('0x5')]},'thirdDisposition':{'type':Sequelize[_0xd22e('0x5')]},'note':{'type':Sequelize[_0xd22e('0x5')]},'phone':{'type':Sequelize[_0xd22e('0x5')]},'read1stAt':{'type':Sequelize[_0xd22e('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xd22e('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd22e('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xd22e('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd22e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc906=['ENUM','out','sequelize','moment','BOOLEAN','DATE','STRING'];(function(_0x5d0878,_0x3477bf){var _0x1fb283=function(_0x1f7f0b){while(--_0x1f7f0b){_0x5d0878['push'](_0x5d0878['shift']());}};_0x1fb283(++_0x3477bf);}(_0xc906,0x1ad));var _0x6c90=function(_0x5f581b,_0x179fa6){_0x5f581b=_0x5f581b-0x0;var _0x8ab362=_0xc906[_0x5f581b];return _0x8ab362;};'use strict';var Sequelize=require(_0x6c90('0x0'));var moment=require(_0x6c90('0x1'));module['exports']={'closed':{'type':Sequelize[_0x6c90('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6c90('0x3')]},'disposition':{'type':Sequelize[_0x6c90('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6c90('0x4')]},'note':{'type':Sequelize[_0x6c90('0x4')]},'phone':{'type':Sequelize[_0x6c90('0x4')]},'read1stAt':{'type':Sequelize[_0x6c90('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x6c90('0x5')]('in',_0x6c90('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6c90('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 88bc1db..a82568c 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 _0x6548=['CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','all','rows','include','options','create','update','params','describe','addMessage','WhatsappMessage','ids','findOne','filter','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','spread','removeTags','download','unix','files','tmp','join','root','server','attachments','fullname','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','Account','get','mkdirSync','closed','closedAt','basename','pipe','createWriteStream','System','out','views','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','eml-format','fast-json-patch','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','Users','map','Tags','TagIds','forEach','catch','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','users','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','compact','isEmpty','WhatsappAccountId','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','order','DESC','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','user','toString','sequelize','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition'];(function(_0x17afb3,_0x2595b0){var _0x5a9960=function(_0x559b0e){while(--_0x559b0e){_0x17afb3['push'](_0x17afb3['shift']());}};_0x5a9960(++_0x2595b0);}(_0x6548,0x133));var _0x8654=function(_0x567796,_0x460632){_0x567796=_0x567796-0x0;var _0x499a02=_0x6548[_0x567796];return _0x499a02;};'use strict';var emlformat=require(_0x8654('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8654('0x1'));var rp=require(_0x8654('0x2'));var moment=require(_0x8654('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8654('0x4'));var sox=require('sox');var csv=require(_0x8654('0x5'));var ejs=require(_0x8654('0x6'));var fs=require('fs');var fs_extra=require(_0x8654('0x7'));var _=require(_0x8654('0x8'));var squel=require(_0x8654('0x9'));var crypto=require(_0x8654('0xa'));var jsforce=require(_0x8654('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8654('0x5'));var querystring=require(_0x8654('0xc'));var Papa=require('papaparse');var Redis=require(_0x8654('0xd'));var authService=require(_0x8654('0xe'));var qs=require(_0x8654('0xf'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0x8654('0x10'));var logger=require(_0x8654('0x11'))(_0x8654('0x12'));var utils=require(_0x8654('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8654('0x14'));var db=require(_0x8654('0x15'))['db'];config[_0x8654('0x16')]=_['defaults'](config[_0x8654('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x8654('0x17'))(new Redis(config[_0x8654('0x16')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x4e29db,_0x41282f){_0x41282f=_0x41282f||0xcc;return function(_0x24bec4){if(_0x24bec4){return _0x4e29db[_0x8654('0x18')](_0x41282f);}return _0x4e29db[_0x8654('0x19')](_0x41282f)[_0x8654('0x1a')]();};}function respondWithResult(_0x60c88e,_0xe3fa2c){_0xe3fa2c=_0xe3fa2c||0xc8;return function(_0x3b0dff){if(_0x3b0dff){return _0x60c88e[_0x8654('0x19')](_0xe3fa2c)[_0x8654('0x1b')](_0x3b0dff);}};}function respondWithFilteredResult(_0x17a0da,_0x3c4652){return function(_0x3b3040){if(_0x3b3040){var _0x88cbe4=typeof _0x3c4652[_0x8654('0x1c')]===_0x8654('0x1d')&&typeof _0x3c4652['limit']===_0x8654('0x1d');var _0x892873=_0x3b3040[_0x8654('0x1e')];var _0x538ed8=_0x88cbe4?0x0:_0x3c4652[_0x8654('0x1c')];var _0x550b56=_0x88cbe4?_0x3b3040[_0x8654('0x1e')]:_0x3c4652[_0x8654('0x1c')]+_0x3c4652[_0x8654('0x1f')];var _0x195dca;if(_0x550b56>=_0x892873){_0x550b56=_0x892873;_0x195dca=0xc8;}else{_0x195dca=0xce;}_0x17a0da[_0x8654('0x19')](_0x195dca);return _0x17a0da[_0x8654('0x20')](_0x8654('0x21'),_0x538ed8+'-'+_0x550b56+'/'+_0x892873)[_0x8654('0x1b')](_0x3b3040);}return null;};}function patchUpdates(_0xb4edfc){return function(_0x4ad7cc){try{jsonpatch[_0x8654('0x22')](_0x4ad7cc,_0xb4edfc,!![]);}catch(_0x77dae8){return BPromise[_0x8654('0x23')](_0x77dae8);}return _0x4ad7cc[_0x8654('0x24')]();};}function saveUpdates(_0x4a81b5,_0x28e3da){return function(_0x46de8a){if(_0x46de8a){return _0x46de8a['update'](_0x4a81b5)[_0x8654('0x25')](function(_0x2ab3a8){return _0x2ab3a8;});}return null;};}function removeEntity(_0x30cee6,_0x13543b){return function(_0x44a58b){if(_0x44a58b){return _0x44a58b[_0x8654('0x26')]()[_0x8654('0x25')](function(){_0x30cee6[_0x8654('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc16b38,_0x4faa19){return function(_0x394391){if(!_0x394391){_0xc16b38[_0x8654('0x18')](0x194);}return _0x394391;};}function handleError(_0x245ea0,_0x28ad98){_0x28ad98=_0x28ad98||0x1f4;return function(_0x4694c3){logger['error'](_0x4694c3[_0x8654('0x27')]);if(_0x4694c3[_0x8654('0x28')]){delete _0x4694c3[_0x8654('0x28')];}_0x245ea0[_0x8654('0x19')](_0x28ad98)[_0x8654('0x29')](_0x4694c3);};}function getInteractionUsers(_0x33a24a,_0x4d4707){return new BPromise(function(_0x420b30,_0x434c2f){try{if(_0x4d4707[_0x33a24a['id']]){_0x33a24a[_0x8654('0x2a')]=_[_0x8654('0x2b')](_0x4d4707[_0x33a24a['id']],function(_0x3e79ed){return{'id':_0x3e79ed['id'],'fullname':_0x3e79ed['fullname']};});}}catch(_0x33528e){_0x434c2f(_0x33528e);}_0x420b30(_0x33a24a);});}function getInteractionTags(_0x711582,_0x5b89f8){return new BPromise(function(_0x436c53,_0x255244){try{if(_0x711582['TagIds']){_0x711582[_0x8654('0x2c')]=[];_0x711582[_0x8654('0x2d')]['split'](',')[_0x8654('0x2e')](function(_0x442864){_0x711582[_0x8654('0x2c')]['push'](_0x5b89f8[_0x442864]);});}delete _0x711582[_0x8654('0x2d')];}catch(_0x364b3b){_0x255244(_0x364b3b);}_0x436c53(_0x711582);});}function updateWhatsappInteraction(_0x334385,_0x35d5d3,_0x1884c9){return new BPromise(function(_0x2f5615,_0x42ffa5){return getInteractionUsers(_0x334385,_0x1884c9)[_0x8654('0x25')](function(_0x4ded78){return getInteractionTags(_0x4ded78,_0x35d5d3);})[_0x8654('0x25')](function(_0x1e57d5){_0x2f5615(_0x1e57d5);})[_0x8654('0x2f')](function(_0x5a080e){_0x42ffa5(_0x5a080e);});});}exports['index']=function(_0x114fd5,_0x210f1e){var _0x129e29={},_0x5403ca={},_0x26b9ff={'count':0x0,'rows':[]};var _0x218c7a=_['map'](db[_0x8654('0x30')][_0x8654('0x31')],function(_0x2322cd){return{'name':_0x2322cd[_0x8654('0x32')],'type':_0x2322cd[_0x8654('0x33')][_0x8654('0x34')]};});_0x5403ca[_0x8654('0x35')]=_[_0x8654('0x2b')](_0x218c7a,_0x8654('0x28'));_0x5403ca['query']=_['keys'](_0x114fd5[_0x8654('0x36')]);_0x5403ca[_0x8654('0x37')]=_[_0x8654('0x38')](_0x5403ca['model'],_0x5403ca['query']);_0x129e29[_0x8654('0x39')]=_['intersection'](_0x5403ca['model'],qs[_0x8654('0x3a')](_0x114fd5['query']['fields']));_0x129e29[_0x8654('0x39')]=_0x129e29[_0x8654('0x39')][_0x8654('0x3b')]?_0x129e29[_0x8654('0x39')]:_0x5403ca[_0x8654('0x35')];if(!_0x114fd5[_0x8654('0x36')][_0x8654('0x3c')](_0x8654('0x3d'))){_0x129e29[_0x8654('0x1f')]=qs[_0x8654('0x1f')](_0x114fd5[_0x8654('0x36')][_0x8654('0x1f')]);_0x129e29[_0x8654('0x1c')]=qs[_0x8654('0x1c')](_0x114fd5[_0x8654('0x36')][_0x8654('0x1c')]);}_0x129e29['order']=qs[_0x8654('0x3e')](_0x114fd5[_0x8654('0x36')][_0x8654('0x3e')]);_0x129e29[_0x8654('0x3f')]=qs[_0x8654('0x37')](_[_0x8654('0x40')](_0x114fd5['query'],_0x5403ca['filters']),_0x218c7a);var _0x25bf30=[];var _0x215b2c=squel['select']()[_0x8654('0x41')]('id')['field']('name')['field'](_0x8654('0x42'))[_0x8654('0x43')](_0x8654('0x44'));var _0x110c72=squel[_0x8654('0x45')]()[_0x8654('0x41')](_0x8654('0x46'))[_0x8654('0x41')](_0x8654('0x47'))[_0x8654('0x41')](_0x8654('0x48'))[_0x8654('0x43')]('user_has_whatsapp_interactions','ui')['left_join'](_0x8654('0x49'),'u','u.id\x20=\x20ui.UserId');var _0x59d327=squel[_0x8654('0x45')]()[_0x8654('0x43')]('whatsapp_interactions','i')[_0x8654('0x4a')](_0x8654('0x4b'),'c',_0x8654('0x4c'))[_0x8654('0x4a')]('users','o',_0x8654('0x4d'))['left_join']('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')[_0x8654('0x4a')]('whatsapp_messages','me',_0x8654('0x4e'))[_0x8654('0x4a')](_0x8654('0x4f'),'it',_0x8654('0x50'))[_0x8654('0x4a')](_0x8654('0x44'),'t',_0x8654('0x51'));var _0xdd2a4a=squel[_0x8654('0x52')]();var _0x863108=[];var _0x30c097=squel['expr']();var _0x5bedac;if(_0x114fd5[_0x8654('0x36')]['search']){_0x5bedac=as[_0x8654('0x53')](_0x114fd5[_0x8654('0x36')][_0x8654('0x54')]);var _0x31deea=_0x5bedac['sqlOperator'];for(var _0x3e4df9=0x0;_0x3e4df9<_0x5bedac[_0x8654('0x55')][_0x8654('0x3b')];_0x3e4df9++){var _0x3566d7=_0x5bedac['conditions'][_0x3e4df9];var _0x11bfca='i';var _0x3dd4bf=_[_0x8654('0x56')](_0x218c7a,[_0x8654('0x28'),_0x3566d7[_0x8654('0x41')]]);if(!_0x3dd4bf){switch(_0x3566d7[_0x8654('0x41')]){case _0x8654('0x57'):if(_0x3566d7[_0x8654('0x58')]==0x1){_0x59d327[_0x8654('0x59')]('`'+_0x3566d7['field']+_0x8654('0x5a'));}else{_0x59d327[_0x8654('0x59')]('`'+_0x3566d7[_0x8654('0x41')]+_0x8654('0x5b'));}break;case _0x8654('0x5c'):if(_0x3566d7[_0x8654('0x5d')]===_0x8654('0x5e')){if(_0x3566d7[_0x8654('0x58')][_0x8654('0x5f')]('\x20')[_0x8654('0x3b')]>0x1){_0xdd2a4a[_0x31deea](_0x8654('0x60'),qs[_0x8654('0x61')](_0x3566d7['value']),null);}else{var _0x34aef8='%'+_0x3566d7[_0x8654('0x58')]+'%';_0xdd2a4a[_0x31deea]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x34aef8,_0x34aef8,_0x34aef8);}}else{_0x3dd4bf=_[_0x8654('0x56')](_0x218c7a,[_0x8654('0x28'),_0x8654('0x62')]);_0x3566d7[_0x8654('0x41')]='ContactId';_0x58f785=as[_0x8654('0x63')](_0x11bfca,_0x3dd4bf[_0x8654('0x33')],_0x3566d7);_0xdd2a4a[_0x31deea](_0x58f785[_0x8654('0x64')],_0x58f785[_0x8654('0x58')][_0x8654('0x65')],_0x58f785['value'][_0x8654('0x1a')]);}break;case _0x8654('0x66'):var _0x51959d=_0x3566d7[_0x8654('0x58')][_0x8654('0x5f')](',')[_0x8654('0x2b')](function(_0x537e55){return Number(_0x537e55);});_0x51959d[_0x8654('0x2e')](function(_0x295af6){_0x30c097['or'](_0x8654('0x67'),'%,'+_0x295af6+',%');});_0x863108=_[_0x8654('0x68')](_0x863108,_0x51959d);break;case _0x8654('0x69'):if(_0x3566d7['operator']===_0x8654('0x5e')){_0xdd2a4a[_0x31deea](_0x8654('0x6a'),'%'+_0x3566d7[_0x8654('0x58')]+'%',null);}else{_0x3dd4bf=_[_0x8654('0x56')](_0x218c7a,[_0x8654('0x28'),_0x8654('0x6b')]);_0x3566d7['field']='UserId';_0x58f785=as['buildExpression'](_0x11bfca,_0x3dd4bf[_0x8654('0x33')],_0x3566d7);_0xdd2a4a[_0x31deea](_0x58f785[_0x8654('0x64')],_0x58f785[_0x8654('0x58')][_0x8654('0x65')],_0x58f785[_0x8654('0x58')][_0x8654('0x1a')]);}break;case _0x8654('0x6c'):_0x58f785=as[_0x8654('0x63')]('me',null,_0x3566d7);_0xdd2a4a[_0x31deea](_0x58f785[_0x8654('0x64')],_0x58f785['value']['start'],_0x58f785[_0x8654('0x58')][_0x8654('0x1a')]);break;}}else{var _0x58f785=as[_0x8654('0x63')](_0x11bfca,_0x3dd4bf[_0x8654('0x33')],_0x3566d7);_0xdd2a4a[_0x31deea](_0x58f785[_0x8654('0x64')],_0x58f785[_0x8654('0x58')]['start'],_0x58f785['value'][_0x8654('0x1a')]);}}}else{var _0xb9826d=_(_0x114fd5[_0x8654('0x36')])[_0x8654('0x6d')]()[_0x8654('0x2b')](function(_0x570a3b){return _[_0x8654('0x6e')](_0x218c7a,[_0x8654('0x28'),_0x570a3b])?_0x570a3b:undefined;})[_0x8654('0x6f')]()['value']();if(!_[_0x8654('0x70')](_0xb9826d)){_0xb9826d['forEach'](function(_0x3a8c9b){if(_0x3a8c9b===_0x8654('0x71')){_0x59d327[_0x8654('0x3f')]('i.WhatsappAccountId\x20IN\x20?',[][_0x8654('0x72')](_0x114fd5[_0x8654('0x36')][_0x3a8c9b]));}else if(_0x3a8c9b==='createdAt'){var _0x3fb460=JSON[_0x8654('0x73')](_0x114fd5[_0x8654('0x36')][_0x3a8c9b])[_0x8654('0x74')];var _0x3a3690=JSON[_0x8654('0x73')](_0x114fd5['query'][_0x3a8c9b])[_0x8654('0x75')];_0x59d327[_0x8654('0x3f')](_0x8654('0x76'),_0x3fb460,_0x3a3690);}else{if(_0x114fd5[_0x8654('0x36')][_0x3a8c9b]===_0x8654('0x77')){_0x59d327['where']('i.'+_0x3a8c9b+_0x8654('0x78'));}else{_0x59d327[_0x8654('0x3f')]('i.'+_0x3a8c9b+_0x8654('0x79'),_0x114fd5[_0x8654('0x36')][_0x3a8c9b]);}}});}if(_0x114fd5[_0x8654('0x36')][_0x8654('0x7a')]){if(_0x114fd5[_0x8654('0x36')][_0x8654('0x7a')]==0x1){_0x59d327['having'](_0x8654('0x7b'));}else{_0x59d327[_0x8654('0x59')](_0x8654('0x7c'));}}if(_0x114fd5[_0x8654('0x36')]['tag']){_0x863108=_[_0x8654('0x7d')](_0x114fd5[_0x8654('0x36')]['tag'])?_0x114fd5['query'][_0x8654('0x7e')]:new Array(_0x114fd5[_0x8654('0x36')]['tag']);_0x863108[_0x8654('0x2e')](function(_0x559137){_0x30c097['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x559137+',%');});}if(_0x114fd5['query']['filter']){var _0x39f6ae=_0x114fd5[_0x8654('0x36')]['filter'][_0x8654('0x7f')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x8654('0x80')](_0x39f6ae)){_0xdd2a4a['or'](_0x8654('0x81'),_0x39f6ae+'%')['or'](_0x8654('0x82'),_0x39f6ae+'%');}else{_0xdd2a4a['or'](_0x8654('0x83'),qs['getFullTextValue'](_0x39f6ae))['or'](_0x8654('0x84'),_0x39f6ae+'%');}}}_0x59d327['where'](_0xdd2a4a);_0x59d327[_0x8654('0x85')](_0x8654('0x86'));var _0x24f9d8={'type':db[_0x8654('0x87')][_0x8654('0x88')][_0x8654('0x89')],'raw':!![]};var _0x48fbff=_0x59d327[_0x8654('0x8a')]();_0x48fbff['field'](_0x8654('0x86'));_0x48fbff['field'](_0x8654('0x8b'),'unreadMessages');if(_0x129e29['order']){_0x129e29['order'][_0x8654('0x2e')](function(_0x389aa5){var _0x3ca989=_0x389aa5[0x0]===_0x8654('0x8c')?_0x389aa5[0x0]:'i.'+_0x389aa5[0x0];_0x59d327[_0x8654('0x8d')](_0x3ca989,_0x389aa5[0x1]===_0x8654('0x8e')?![]:!![]);});}if(!_[_0x8654('0x70')](_0x863108)){_0x59d327[_0x8654('0x59')](_0x30c097);_0x48fbff[_0x8654('0x3f')](_0x8654('0x8f'),_0x863108);}BPromise['resolve']()[_0x8654('0x25')](function(){if(!_0x5bedac){if(_0x114fd5[_0x8654('0x36')][_0x8654('0x71')])return;_0x48fbff[_0x8654('0x3f')](_0x8654('0x90'));_0x59d327[_0x8654('0x3f')](_0x8654('0x90'));return;}if(_0x114fd5['user'][_0x8654('0x91')]!==_0x8654('0x92'))return;return _0x114fd5['user'][_0x8654('0x93')]({'attributes':['id'],'raw':!![]})[_0x8654('0x25')](function(_0x5518b2){if(_['isEmpty'](_0x5518b2)){_0x48fbff[_0x8654('0x3f')](_0x8654('0x94'));_0x59d327[_0x8654('0x3f')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x48fbff[_0x8654('0x3f')]('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x5518b2,'id'));_0x59d327[_0x8654('0x3f')]('i.WhatsappAccountId\x20IN\x20?',_[_0x8654('0x2b')](_0x5518b2,'id'));}});})[_0x8654('0x25')](function(){if(_0x114fd5[_0x8654('0x95')][_0x8654('0x91')]===_0x8654('0x92')&&!_0x5bedac&&!_0x114fd5['query'][_0x8654('0x71')])return[];return db['sequelize'][_0x8654('0x36')](_0x48fbff[_0x8654('0x96')](),_0x24f9d8);})[_0x8654('0x25')](function(_0x2264d0){_0x26b9ff[_0x8654('0x1e')]=_0x2264d0[_0x8654('0x3b')];if(_0x26b9ff[_0x8654('0x1e')]===0x0)return[];return db[_0x8654('0x97')][_0x8654('0x36')](_0x215b2c['toString'](),_0x24f9d8)[_0x8654('0x25')](function(_0xa5d4cd){_0x25bf30=_['keyBy'](_0xa5d4cd,'id');_0x24f9d8=_[_0x8654('0x98')](_0x24f9d8,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x114fd5[_0x8654('0x36')][_0x8654('0x3a')]){_0x129e29[_0x8654('0x39')][_0x8654('0x2e')](function(_0x33646b){_0x59d327[_0x8654('0x41')]('i.'+_0x33646b);});}else{_0x59d327[_0x8654('0x41')](_0x8654('0x8b'),_0x8654('0x57'));_0x59d327[_0x8654('0x41')](_0x8654('0x99'),_0x8654('0x9a'));_0x59d327['field'](_0x8654('0x9b'),_0x8654('0x9c'));_0x59d327['field'](_0x8654('0x9d'),_0x8654('0x8c'));_0x59d327[_0x8654('0x41')](_0x8654('0x9e'));_0x59d327[_0x8654('0x41')]('c.firstName',_0x8654('0x9f'));_0x59d327[_0x8654('0x41')](_0x8654('0xa0'),'Contact.lastName');_0x59d327[_0x8654('0x41')]('c.email',_0x8654('0xa1'));_0x59d327[_0x8654('0x41')](_0x8654('0xa2'),'Contact.phone');_0x59d327[_0x8654('0x41')](_0x8654('0xa3'),_0x8654('0xa4'));_0x59d327[_0x8654('0x41')](_0x8654('0xa5'),_0x8654('0xa6'));_0x59d327[_0x8654('0x41')](_0x8654('0xa7'),_0x8654('0xa8'));_0x59d327['field'](_0x8654('0xa9'),_0x8654('0xaa'));_0x59d327[_0x8654('0x41')](_0x8654('0xab'),_0x8654('0x2d'));}if(_0x129e29[_0x8654('0x1f')])_0x59d327['limit'](_0x129e29[_0x8654('0x1f')]);if(_0x129e29[_0x8654('0x1c')])_0x59d327[_0x8654('0x1c')](_0x129e29[_0x8654('0x1c')]);return db['sequelize'][_0x8654('0x36')](_0x59d327[_0x8654('0x96')](),_0x24f9d8);})[_0x8654('0x25')](function(_0x503db1){if(_0x503db1[_0x8654('0x3b')]>0x0)_0x110c72[_0x8654('0x3f')](_0x8654('0xac'),_[_0x8654('0x2b')](_0x503db1,'id'));return db[_0x8654('0x97')][_0x8654('0x36')](_0x110c72['toString'](),_0x24f9d8)[_0x8654('0x25')](function(_0x332f23){var _0x339a5c=_[_0x8654('0xad')](_0x332f23,_0x8654('0xae'));var _0x2c1328=[];_0x503db1[_0x8654('0x2e')](function(_0x1010ad){_0x2c1328[_0x8654('0xaf')](updateWhatsappInteraction(_0x1010ad,_0x25bf30,_0x339a5c));});return BPromise[_0x8654('0xb0')](_0x2c1328);});});})[_0x8654('0x25')](function(_0x59e327){_0x26b9ff[_0x8654('0xb1')]=_0x59e327;return _0x26b9ff;})[_0x8654('0x25')](respondWithFilteredResult(_0x210f1e,_0x129e29))[_0x8654('0x2f')](handleError(_0x210f1e,null));};exports['show']=function(_0x6a473b,_0x44cba3){var _0x54dafb={'raw':![],'where':{'id':_0x6a473b['params']['id']}},_0x565bac={};_0x565bac['model']=_['keys'](db[_0x8654('0x30')]['rawAttributes']);_0x565bac['query']=_[_0x8654('0x6d')](_0x6a473b['query']);_0x565bac[_0x8654('0x37')]=_['intersection'](_0x565bac[_0x8654('0x35')],_0x565bac[_0x8654('0x36')]);_0x54dafb[_0x8654('0x39')]=_['intersection'](_0x565bac[_0x8654('0x35')],qs[_0x8654('0x3a')](_0x6a473b['query'][_0x8654('0x3a')]));_0x54dafb[_0x8654('0x39')]=_0x54dafb[_0x8654('0x39')]['length']?_0x54dafb['attributes']:_0x565bac[_0x8654('0x35')];if(_0x6a473b[_0x8654('0x36')]['includeAll']){_0x54dafb[_0x8654('0xb2')]=[{'all':!![]}];}_0x54dafb=_[_0x8654('0x98')]({},_0x54dafb,_0x6a473b[_0x8654('0xb3')]);return db[_0x8654('0x30')][_0x8654('0x56')](_0x54dafb)['then'](handleEntityNotFound(_0x44cba3,null))[_0x8654('0x25')](respondWithResult(_0x44cba3,null))['catch'](handleError(_0x44cba3,null));};exports[_0x8654('0xb4')]=function(_0x322203,_0x1e731a){return db['WhatsappInteraction'][_0x8654('0xb4')](_0x322203[_0x8654('0x6c')],{})[_0x8654('0x25')](respondWithResult(_0x1e731a,0xc9))[_0x8654('0x2f')](handleError(_0x1e731a,null));};exports[_0x8654('0xb5')]=function(_0x5e44d0,_0x489a65){if(_0x5e44d0[_0x8654('0x6c')]['id']){delete _0x5e44d0['body']['id'];}return db[_0x8654('0x30')][_0x8654('0x56')]({'where':{'id':_0x5e44d0[_0x8654('0xb6')]['id']}})[_0x8654('0x25')](handleEntityNotFound(_0x489a65,null))[_0x8654('0x25')](saveUpdates(_0x5e44d0[_0x8654('0x6c')],null))[_0x8654('0x25')](respondWithResult(_0x489a65,null))[_0x8654('0x2f')](handleError(_0x489a65,null));};exports[_0x8654('0x26')]=function(_0x3943d5,_0x17a6e2){return db[_0x8654('0x30')][_0x8654('0x56')]({'where':{'id':_0x3943d5[_0x8654('0xb6')]['id']}})['then'](handleEntityNotFound(_0x17a6e2,null))[_0x8654('0x25')](removeEntity(_0x17a6e2,null))['catch'](handleError(_0x17a6e2,null));};exports[_0x8654('0xb7')]=function(_0x4da233,_0x26dbaf){return db['WhatsappInteraction']['describe']()['then'](respondWithResult(_0x26dbaf,null))[_0x8654('0x2f')](handleError(_0x26dbaf,null));};exports[_0x8654('0xb8')]=function(_0x33b3c4,_0x45f403,_0x2b4444){return db[_0x8654('0xb9')][_0x8654('0x56')]({'where':{'id':_0x33b3c4['params']['id']}})[_0x8654('0x25')](handleEntityNotFound(_0x45f403,null))[_0x8654('0x25')](function(_0x1fb26f){if(_0x1fb26f){return _0x1fb26f['addMessage'](_0x33b3c4[_0x8654('0x6c')]['ids'],_['omit'](_0x33b3c4[_0x8654('0x6c')],[_0x8654('0xba'),'id'])||{});}})[_0x8654('0x25')](respondWithResult(_0x45f403,null))[_0x8654('0x2f')](handleError(_0x45f403,null));};exports['getMessages']=function(_0x3d700e,_0x3aad1a,_0x344f34){var _0x236008={'raw':![],'where':{}};var _0x227b2c={};var _0x223762={'count':0x0,'rows':[]};return db[_0x8654('0x30')][_0x8654('0xbb')]({'where':{'id':_0x3d700e[_0x8654('0xb6')]['id']}})[_0x8654('0x25')](handleEntityNotFound(_0x3aad1a,null))[_0x8654('0x25')](function(_0x37b21c){if(_0x37b21c){_0x227b2c[_0x8654('0x35')]=_[_0x8654('0x6d')](db[_0x8654('0xb9')][_0x8654('0x31')]);_0x227b2c[_0x8654('0x36')]=_['keys'](_0x3d700e['query']);_0x227b2c['filters']=_['intersection'](_0x227b2c[_0x8654('0x35')],_0x227b2c[_0x8654('0x36')]);_0x236008[_0x8654('0x39')]=_[_0x8654('0x38')](_0x227b2c[_0x8654('0x35')],qs['fields'](_0x3d700e[_0x8654('0x36')][_0x8654('0x3a')]));_0x236008[_0x8654('0x39')]=_0x236008[_0x8654('0x39')]['length']?_0x236008[_0x8654('0x39')]:_0x227b2c['model'];if(!_0x3d700e[_0x8654('0x36')][_0x8654('0x3c')](_0x8654('0x3d'))){_0x236008['limit']=qs['limit'](_0x3d700e['query']['limit']);_0x236008[_0x8654('0x1c')]=qs[_0x8654('0x1c')](_0x3d700e[_0x8654('0x36')][_0x8654('0x1c')]);}_0x236008[_0x8654('0x8d')]=qs['sort'](_0x3d700e[_0x8654('0x36')][_0x8654('0x3e')]);_0x236008[_0x8654('0x3f')]=qs['filters'](_[_0x8654('0x40')](_0x3d700e[_0x8654('0x36')],_0x227b2c['filters']));_0x236008[_0x8654('0x3f')][_0x8654('0xae')]=_0x37b21c['id'];if(_0x3d700e[_0x8654('0x36')][_0x8654('0xbc')]){_0x236008[_0x8654('0x3f')]=_[_0x8654('0x98')](_0x236008[_0x8654('0x3f')],{'$or':_[_0x8654('0x2b')](_0x236008['attributes'],function(_0x1d3e68){var _0x16d5f2={};_0x16d5f2[_0x1d3e68]={'$like':'%'+_0x3d700e[_0x8654('0x36')][_0x8654('0xbc')]+'%'};return _0x16d5f2;})});}if(_0x3d700e[_0x8654('0x36')][_0x8654('0x74')]){var _0x247720=_0x3d700e['query']['$gte']['split'](',');var _0x1f6f66={};_0x1f6f66[_0x247720[0x0]]={'$gte':moment(_0x247720[0x1])[_0x8654('0xbd')](_0x8654('0xbe'))};_0x236008[_0x8654('0x3f')]=_[_0x8654('0x98')](_0x236008[_0x8654('0x3f')],_0x1f6f66);}_0x236008=_[_0x8654('0x98')]({},_0x236008,_0x3d700e[_0x8654('0xb3')]);return db[_0x8654('0xb9')][_0x8654('0x1e')]({'where':_0x236008[_0x8654('0x3f')]})['then'](function(_0x1a216a){_0x223762[_0x8654('0x1e')]=_0x1a216a;if(_0x3d700e['query'][_0x8654('0xbf')]){_0x236008[_0x8654('0xb2')]=[{'all':!![]}];}return db[_0x8654('0xb9')][_0x8654('0xc0')](_0x236008);})[_0x8654('0x25')](function(_0x2414bc){_0x223762[_0x8654('0xb1')]=_0x2414bc;return _0x223762;});}})[_0x8654('0x25')](respondWithFilteredResult(_0x3aad1a,_0x236008))['catch'](handleError(_0x3aad1a,null));};exports[_0x8654('0xc1')]=function(_0x4b150a,_0x1689ad,_0x554908){return db[_0x8654('0x30')]['find']({'where':{'id':_0x4b150a['params']['id']}})[_0x8654('0x25')](handleEntityNotFound(_0x1689ad,null))['then'](function(_0x26ebde){if(_0x26ebde){return _0x26ebde[_0x8654('0xc2')](_0x4b150a['body'][_0x8654('0xba')],_['omit'](_0x4b150a[_0x8654('0x6c')],[_0x8654('0xba'),'id'])||{})[_0x8654('0xc3')](function(){return db[_0x8654('0x66')]['findAll']({'attributes':['id',_0x8654('0x28'),_0x8654('0x42')],'where':{'id':_0x4b150a['body']['ids']}});})['then'](function(_0x14559e){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x4b150a[_0x8654('0xb6')]['id']),'tags':_0x14559e||[]});return{'id':Number(_0x4b150a['params']['id']),'tags':_0x14559e||[]};});}})[_0x8654('0x25')](respondWithResult(_0x1689ad,null))[_0x8654('0x2f')](handleError(_0x1689ad,null));};exports[_0x8654('0xc4')]=function(_0x4d6174,_0x51d66a,_0x10618e){return db[_0x8654('0x30')][_0x8654('0x56')]({'where':{'id':_0x4d6174[_0x8654('0xb6')]['id']}})['then'](handleEntityNotFound(_0x51d66a,null))['then'](function(_0x2f05ea){if(_0x2f05ea){return _0x2f05ea[_0x8654('0xc4')](_0x4d6174[_0x8654('0x36')][_0x8654('0xba')]);}})['then'](respondWithStatusCode(_0x51d66a,null))[_0x8654('0x2f')](handleError(_0x51d66a,null));};exports[_0x8654('0xc5')]=function(_0x3d8008,_0xc573d0){var _0x2f9d69=moment()[_0x8654('0xc6')]()['toString']();var _0x1a43a8=path['join'](config['root'],'server',_0x8654('0xc7'),_0x8654('0xc8'));var _0x444bfe=path[_0x8654('0xc9')](config[_0x8654('0xca')],_0x8654('0xcb'),_0x8654('0xc7'),_0x8654('0xcc'));var _0x1b0fd2=path['join'](_0x1a43a8,_0x2f9d69);var _0x159ba8=util[_0x8654('0xbd')]('transcript-%d-%s.zip',_0x3d8008[_0x8654('0xb6')]['id'],_0x2f9d69);var _0x3cb5fa=path[_0x8654('0xc9')](_0x1a43a8,_0x159ba8);var _0x23342f=[];_0x23342f[_0x8654('0xaf')]({'model':db[_0x8654('0x69')],'as':_0x8654('0x69'),'attributes':['id',_0x8654('0xcd')],'raw':!![]});_0x23342f[_0x8654('0xaf')]({'model':db[_0x8654('0xce')],'as':'Contact','attributes':['id',_0x8654('0xcf'),_0x8654('0xd0')],'raw':!![]});if(_0x3d8008[_0x8654('0x36')][_0x8654('0xcc')]){_0x23342f[_0x8654('0xaf')]({'model':db[_0x8654('0xd1')],'as':'Attachment','raw':!![]});}var _0x1b1c9d=[{'model':db[_0x8654('0xb9')],'as':_0x8654('0xd2'),'attributes':['id',_0x8654('0x6c'),_0x8654('0xd3'),_0x8654('0xd4'),_0x8654('0xd5'),_0x8654('0x7a')],'include':_0x23342f}];_0x1b1c9d[_0x8654('0xaf')]({'model':db['WhatsappAccount'],'as':_0x8654('0xd6'),'attributes':['id','name']});_0x1b1c9d['push']({'model':db[_0x8654('0x69')],'as':'Owner','attributes':['id',_0x8654('0xcd')]});return db['WhatsappInteraction'][_0x8654('0x56')]({'where':{'id':_0x3d8008[_0x8654('0xb6')]['id']},'include':_0x1b1c9d})[_0x8654('0x25')](handleEntityNotFound(_0xc573d0,null))[_0x8654('0x25')](function(_0x276c40){if(_0x276c40){var _0x5b7f13=_0x276c40[_0x8654('0xd7')]({'plain':!![]});fs[_0x8654('0xd8')](_0x1b0fd2);var _0x56d657={'channel':'Whatsapp','account':_0x5b7f13[_0x8654('0xd6')][_0x8654('0x28')],'agent':_0x5b7f13['Owner']?_0x5b7f13['Owner'][_0x8654('0xcd')]:'N.A.','createdAt':moment(_0x5b7f13['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x8654('0x96')](),'closedAt':_0x5b7f13[_0x8654('0xd9')]?moment(_0x5b7f13[_0x8654('0xda')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x5b7f13['disposition'],'messages':_(_0x5b7f13['Messages'])['filter']({'secret':![]})[_0x8654('0x2b')](function(_0x59bbc0){if(_0x59bbc0[_0x8654('0xd1')]){var _0x19878f=path[_0x8654('0xc9')](_0x444bfe,_0x59bbc0[_0x8654('0xd1')][_0x8654('0xdb')]);if(fs['existsSync'](_0x19878f)){fs['createReadStream'](_0x19878f)[_0x8654('0xdc')](fs[_0x8654('0xdd')](path[_0x8654('0xc9')](_0x1b0fd2,_0x59bbc0[_0x8654('0xd1')][_0x8654('0xdb')])));}}return{'date':moment(_0x59bbc0[_0x8654('0xd3')])['format'](_0x8654('0xbe'))[_0x8654('0x96')](),'sender':_0x59bbc0[_0x8654('0xd4')]==='out'?_0x59bbc0[_0x8654('0x69')]?_0x59bbc0[_0x8654('0x69')][_0x8654('0xcd')]:_0x8654('0xde'):_0x59bbc0[_0x8654('0x5c')][_0x8654('0xcf')]+(_0x59bbc0[_0x8654('0x5c')][_0x8654('0xd0')]?'\x20'+_0x59bbc0[_0x8654('0x5c')]['lastName']:''),'body':_0x59bbc0[_0x8654('0xd1')]?_0x59bbc0[_0x8654('0xd1')][_0x8654('0xdb')]:_0x59bbc0[_0x8654('0x6c')],'direction':_0x59bbc0[_0x8654('0xd4')]===_0x8654('0xdf')?'A':'C','secret':_0x59bbc0[_0x8654('0xd5')],'read':_0x59bbc0['read'],'attachment':_0x59bbc0['Attachment']};})['value']()};return ejs['renderFile'](path[_0x8654('0xc9')](config[_0x8654('0xca')],'server',_0x8654('0xe0'),'downloadInteraction.ejs'),{'interaction':_0x56d657})[_0x8654('0x25')](function(_0xfbadb){var _0x466962=path['join'](_0x1b0fd2,_0x8654('0xe1')+_0x5b7f13['id']+'-'+_0x2f9d69+_0x8654('0xe2'));var _0x23d549={'path':_0x466962,'channel':_0x8654('0xe3'),'interactionId':_0x5b7f13['id']};return pdf[_0x8654('0xe4')](_0xfbadb,_0x23d549);})[_0x8654('0x25')](function(){return new BPromise(function(_0x10d1c5,_0x1345f6){zipdir(_0x1b0fd2,{'saveTo':_0x3cb5fa},function(_0x4eb1a1,_0x3f7513){if(_0x4eb1a1)return _0x1345f6(_0x4eb1a1);return _0x10d1c5(_0x3f7513);});})[_0x8654('0x25')](function(){return new BPromise(function(_0x4670a9,_0x4c499a){rimraf(_0x1b0fd2,function(_0x1ad3f4){if(_0x1ad3f4)_0x4c499a(_0x1ad3f4);return _0x4670a9();});});})[_0x8654('0x25')](function(){return _0xc573d0[_0x8654('0xc5')](_0x3cb5fa,_0x159ba8,function(_0x2eb437){if(_0x2eb437){console[_0x8654('0xe5')](_0x8654('0xe6'),_0x2eb437);}else{fs[_0x8654('0xe7')](_0x3cb5fa);}});});});}else{return _0xc573d0[_0x8654('0x18')](0xc8);}})[_0x8654('0x2f')](handleError(_0xc573d0,null));}; \ No newline at end of file +var _0xc534=['defaults','socket.io-emitter','./whatsappInteraction.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','Users','fullname','TagIds','split','forEach','Tags','push','catch','WhatsappInteraction','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','select','field','color','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','start','some','compact','isEmpty','where','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','include','options','create','params','describe','WhatsappMessage','ids','omit','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','join','root','server','files','attachments','format','transcript-%d-%s.zip','User','CmContact','lastName','Attachment','secret','WhatsappAccount','Owner','mkdirSync','Whatsapp','Account','N.A.','closed','disposition','Messages','createReadStream','pipe','createWriteStream','basename','direction','out','System','firstName','renderFile','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x2cd22a,_0x23aed4){var _0x23764f=function(_0x40311b){while(--_0x40311b){_0x2cd22a['push'](_0x2cd22a['shift']());}};_0x23764f(++_0x23aed4);}(_0xc534,0x1ca));var _0x4c53=function(_0x1e2bbe,_0x4df37d){_0x1e2bbe=_0x1e2bbe-0x0;var _0x435438=_0xc534[_0x1e2bbe];return _0x435438;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4c53('0x0'));var zipdir=require(_0x4c53('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c53('0x2'));var moment=require(_0x4c53('0x3'));var BPromise=require(_0x4c53('0x4'));var Mustache=require('mustache');var util=require(_0x4c53('0x5'));var path=require('path');var sox=require(_0x4c53('0x6'));var csv=require(_0x4c53('0x7'));var ejs=require(_0x4c53('0x8'));var fs=require('fs');var fs_extra=require(_0x4c53('0x9'));var _=require(_0x4c53('0xa'));var squel=require(_0x4c53('0xb'));var crypto=require(_0x4c53('0xc'));var jsforce=require(_0x4c53('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4c53('0x7'));var querystring=require(_0x4c53('0xe'));var Papa=require('papaparse');var Redis=require(_0x4c53('0xf'));var authService=require(_0x4c53('0x10'));var qs=require(_0x4c53('0x11'));var as=require(_0x4c53('0x12'));var pdf=require(_0x4c53('0x13'));var hardwareService=require(_0x4c53('0x14'));var logger=require(_0x4c53('0x15'))(_0x4c53('0x16'));var utils=require(_0x4c53('0x17'));var config=require(_0x4c53('0x18'));var licenseUtil=require(_0x4c53('0x19'));var db=require(_0x4c53('0x1a'))['db'];config[_0x4c53('0x1b')]=_[_0x4c53('0x1c')](config[_0x4c53('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x4c53('0x1d'))(new Redis(config['redis']));require(_0x4c53('0x1e'))[_0x4c53('0x1f')](socket);function respondWithStatusCode(_0xf21bee,_0x427097){_0x427097=_0x427097||0xcc;return function(_0x3a46cf){if(_0x3a46cf){return _0xf21bee['sendStatus'](_0x427097);}return _0xf21bee[_0x4c53('0x20')](_0x427097)[_0x4c53('0x21')]();};}function respondWithResult(_0x565f08,_0x4705a3){_0x4705a3=_0x4705a3||0xc8;return function(_0x880449){if(_0x880449){return _0x565f08[_0x4c53('0x20')](_0x4705a3)[_0x4c53('0x22')](_0x880449);}};}function respondWithFilteredResult(_0x359be0,_0xe0ff2f){return function(_0x1ac465){if(_0x1ac465){var _0x46b861=typeof _0xe0ff2f[_0x4c53('0x23')]===_0x4c53('0x24')&&typeof _0xe0ff2f[_0x4c53('0x25')]==='undefined';var _0x8bf6a9=_0x1ac465['count'];var _0x1f46b9=_0x46b861?0x0:_0xe0ff2f[_0x4c53('0x23')];var _0x22dc6a=_0x46b861?_0x1ac465[_0x4c53('0x26')]:_0xe0ff2f[_0x4c53('0x23')]+_0xe0ff2f[_0x4c53('0x25')];var _0x1fed39;if(_0x22dc6a>=_0x8bf6a9){_0x22dc6a=_0x8bf6a9;_0x1fed39=0xc8;}else{_0x1fed39=0xce;}_0x359be0[_0x4c53('0x20')](_0x1fed39);return _0x359be0['set'](_0x4c53('0x27'),_0x1f46b9+'-'+_0x22dc6a+'/'+_0x8bf6a9)[_0x4c53('0x22')](_0x1ac465);}return null;};}function patchUpdates(_0x2981e6){return function(_0xa620d7){try{jsonpatch[_0x4c53('0x28')](_0xa620d7,_0x2981e6,!![]);}catch(_0x33f6d4){return BPromise[_0x4c53('0x29')](_0x33f6d4);}return _0xa620d7[_0x4c53('0x2a')]();};}function saveUpdates(_0x2700df,_0x107788){return function(_0x14fde2){if(_0x14fde2){return _0x14fde2[_0x4c53('0x2b')](_0x2700df)[_0x4c53('0x2c')](function(_0x2a8ec3){return _0x2a8ec3;});}return null;};}function removeEntity(_0x124698,_0x5f1e18){return function(_0x32a7cb){if(_0x32a7cb){return _0x32a7cb[_0x4c53('0x2d')]()[_0x4c53('0x2c')](function(){_0x124698['status'](0xcc)[_0x4c53('0x21')]();});}};}function handleEntityNotFound(_0x3be0ba,_0x52d009){return function(_0x45192f){if(!_0x45192f){_0x3be0ba[_0x4c53('0x2e')](0x194);}return _0x45192f;};}function handleError(_0x242db7,_0x467646){_0x467646=_0x467646||0x1f4;return function(_0x22e90b){logger[_0x4c53('0x2f')](_0x22e90b[_0x4c53('0x30')]);if(_0x22e90b[_0x4c53('0x31')]){delete _0x22e90b[_0x4c53('0x31')];}_0x242db7[_0x4c53('0x20')](_0x467646)['send'](_0x22e90b);};}function getInteractionUsers(_0x3393f6,_0xcecee3){return new BPromise(function(_0x2ad617,_0x4623fc){try{if(_0xcecee3[_0x3393f6['id']]){_0x3393f6[_0x4c53('0x32')]=_['map'](_0xcecee3[_0x3393f6['id']],function(_0xc94987){return{'id':_0xc94987['id'],'fullname':_0xc94987[_0x4c53('0x33')]};});}}catch(_0x554897){_0x4623fc(_0x554897);}_0x2ad617(_0x3393f6);});}function getInteractionTags(_0x2dd6f9,_0x5998df){return new BPromise(function(_0x9e9887,_0x42cd1e){try{if(_0x2dd6f9[_0x4c53('0x34')]){_0x2dd6f9['Tags']=[];_0x2dd6f9[_0x4c53('0x34')][_0x4c53('0x35')](',')[_0x4c53('0x36')](function(_0x410cd1){_0x2dd6f9[_0x4c53('0x37')][_0x4c53('0x38')](_0x5998df[_0x410cd1]);});}delete _0x2dd6f9[_0x4c53('0x34')];}catch(_0x277df3){_0x42cd1e(_0x277df3);}_0x9e9887(_0x2dd6f9);});}function updateWhatsappInteraction(_0x8d5073,_0x3b3241,_0x11bc87){return new BPromise(function(_0x4a4950,_0x3d906f){return getInteractionUsers(_0x8d5073,_0x11bc87)[_0x4c53('0x2c')](function(_0x554885){return getInteractionTags(_0x554885,_0x3b3241);})['then'](function(_0xf80c0a){_0x4a4950(_0xf80c0a);})[_0x4c53('0x39')](function(_0x2cc615){_0x3d906f(_0x2cc615);});});}exports['index']=function(_0x1cf182,_0x43db02){var _0x3084b4={},_0x370d76={},_0x455581={'count':0x0,'rows':[]};var _0x201720=_['map'](db[_0x4c53('0x3a')][_0x4c53('0x3b')],function(_0x5d6e7c){return{'name':_0x5d6e7c[_0x4c53('0x3c')],'type':_0x5d6e7c[_0x4c53('0x3d')][_0x4c53('0x3e')]};});_0x370d76[_0x4c53('0x3f')]=_[_0x4c53('0x40')](_0x201720,_0x4c53('0x31'));_0x370d76[_0x4c53('0x41')]=_[_0x4c53('0x42')](_0x1cf182[_0x4c53('0x41')]);_0x370d76[_0x4c53('0x43')]=_['intersection'](_0x370d76['model'],_0x370d76[_0x4c53('0x41')]);_0x3084b4[_0x4c53('0x44')]=_[_0x4c53('0x45')](_0x370d76[_0x4c53('0x3f')],qs['fields'](_0x1cf182[_0x4c53('0x41')][_0x4c53('0x46')]));_0x3084b4[_0x4c53('0x44')]=_0x3084b4['attributes'][_0x4c53('0x47')]?_0x3084b4[_0x4c53('0x44')]:_0x370d76[_0x4c53('0x3f')];if(!_0x1cf182[_0x4c53('0x41')][_0x4c53('0x48')](_0x4c53('0x49'))){_0x3084b4[_0x4c53('0x25')]=qs[_0x4c53('0x25')](_0x1cf182[_0x4c53('0x41')]['limit']);_0x3084b4[_0x4c53('0x23')]=qs[_0x4c53('0x23')](_0x1cf182[_0x4c53('0x41')]['offset']);}_0x3084b4['order']=qs[_0x4c53('0x4a')](_0x1cf182[_0x4c53('0x41')][_0x4c53('0x4a')]);_0x3084b4['where']=qs[_0x4c53('0x43')](_[_0x4c53('0x4b')](_0x1cf182[_0x4c53('0x41')],_0x370d76[_0x4c53('0x43')]),_0x201720);var _0x1dec8d=[];var _0x1127ee=squel[_0x4c53('0x4c')]()[_0x4c53('0x4d')]('id')[_0x4c53('0x4d')](_0x4c53('0x31'))[_0x4c53('0x4d')](_0x4c53('0x4e'))['from'](_0x4c53('0x4f'));var _0x725344=squel['select']()[_0x4c53('0x4d')](_0x4c53('0x50'))[_0x4c53('0x4d')](_0x4c53('0x51'))[_0x4c53('0x4d')](_0x4c53('0x52'))[_0x4c53('0x53')](_0x4c53('0x54'),'ui')[_0x4c53('0x55')](_0x4c53('0x56'),'u',_0x4c53('0x57'));var _0x5dfabe=squel[_0x4c53('0x4c')]()[_0x4c53('0x53')](_0x4c53('0x58'),'i')['left_join'](_0x4c53('0x59'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4c53('0x55')](_0x4c53('0x56'),'o',_0x4c53('0x5a'))[_0x4c53('0x55')](_0x4c53('0x5b'),'a',_0x4c53('0x5c'))[_0x4c53('0x55')]('whatsapp_messages','me',_0x4c53('0x5d'))['left_join'](_0x4c53('0x5e'),'it','it.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x4c53('0x4f'),'t',_0x4c53('0x5f'));var _0x47365c=squel[_0x4c53('0x60')]();var _0x354d7c=[];var _0x57cbdf=squel['expr']();var _0x119284;if(_0x1cf182[_0x4c53('0x41')]['search']){_0x119284=as[_0x4c53('0x61')](_0x1cf182[_0x4c53('0x41')][_0x4c53('0x62')]);var _0x50a467=_0x119284[_0x4c53('0x63')];for(var _0xd9f353=0x0;_0xd9f353<_0x119284['conditions'][_0x4c53('0x47')];_0xd9f353++){var _0x59d83d=_0x119284[_0x4c53('0x64')][_0xd9f353];var _0x1562c3='i';var _0x528520=_[_0x4c53('0x65')](_0x201720,[_0x4c53('0x31'),_0x59d83d[_0x4c53('0x4d')]]);if(!_0x528520){switch(_0x59d83d[_0x4c53('0x4d')]){case _0x4c53('0x66'):if(_0x59d83d[_0x4c53('0x67')]==0x1){_0x5dfabe[_0x4c53('0x68')]('`'+_0x59d83d[_0x4c53('0x4d')]+_0x4c53('0x69'));}else{_0x5dfabe['having']('`'+_0x59d83d['field']+_0x4c53('0x6a'));}break;case _0x4c53('0x6b'):if(_0x59d83d[_0x4c53('0x6c')]===_0x4c53('0x6d')){if(_0x59d83d[_0x4c53('0x67')][_0x4c53('0x35')]('\x20')[_0x4c53('0x47')]>0x1){_0x47365c[_0x50a467](_0x4c53('0x6e'),qs[_0x4c53('0x6f')](_0x59d83d[_0x4c53('0x67')]),null);}else{var _0x506c3a='%'+_0x59d83d[_0x4c53('0x67')]+'%';_0x47365c[_0x50a467](_0x4c53('0x70'),_0x506c3a,_0x506c3a,_0x506c3a);}}else{_0x528520=_[_0x4c53('0x65')](_0x201720,[_0x4c53('0x31'),_0x4c53('0x71')]);_0x59d83d[_0x4c53('0x4d')]=_0x4c53('0x71');_0x3af45d=as['buildExpression'](_0x1562c3,_0x528520[_0x4c53('0x3d')],_0x59d83d);_0x47365c[_0x50a467](_0x3af45d[_0x4c53('0x72')],_0x3af45d['value']['start'],_0x3af45d['value'][_0x4c53('0x21')]);}break;case _0x4c53('0x73'):var _0x2421c4=_0x59d83d[_0x4c53('0x67')][_0x4c53('0x35')](',')[_0x4c53('0x40')](function(_0x1d2b39){return Number(_0x1d2b39);});_0x2421c4[_0x4c53('0x36')](function(_0x527e85){_0x57cbdf['or'](_0x4c53('0x74'),'%,'+_0x527e85+',%');});_0x354d7c=_[_0x4c53('0x75')](_0x354d7c,_0x2421c4);break;case'User':if(_0x59d83d[_0x4c53('0x6c')]==='$substring'){_0x47365c[_0x50a467](_0x4c53('0x76'),'%'+_0x59d83d['value']+'%',null);}else{_0x528520=_[_0x4c53('0x65')](_0x201720,['name',_0x4c53('0x77')]);_0x59d83d[_0x4c53('0x4d')]=_0x4c53('0x77');_0x3af45d=as[_0x4c53('0x78')](_0x1562c3,_0x528520[_0x4c53('0x3d')],_0x59d83d);_0x47365c[_0x50a467](_0x3af45d[_0x4c53('0x72')],_0x3af45d['value']['start'],_0x3af45d[_0x4c53('0x67')][_0x4c53('0x21')]);}break;case _0x4c53('0x79'):_0x3af45d=as['buildExpression']('me',null,_0x59d83d);_0x47365c[_0x50a467](_0x3af45d[_0x4c53('0x72')],_0x3af45d['value']['start'],_0x3af45d[_0x4c53('0x67')][_0x4c53('0x21')]);break;}}else{var _0x3af45d=as[_0x4c53('0x78')](_0x1562c3,_0x528520['type'],_0x59d83d);_0x47365c[_0x50a467](_0x3af45d[_0x4c53('0x72')],_0x3af45d[_0x4c53('0x67')][_0x4c53('0x7a')],_0x3af45d[_0x4c53('0x67')][_0x4c53('0x21')]);}}}else{var _0x3a836a=_(_0x1cf182[_0x4c53('0x41')])[_0x4c53('0x42')]()[_0x4c53('0x40')](function(_0x208664){return _[_0x4c53('0x7b')](_0x201720,['name',_0x208664])?_0x208664:undefined;})[_0x4c53('0x7c')]()[_0x4c53('0x67')]();if(!_[_0x4c53('0x7d')](_0x3a836a)){_0x3a836a[_0x4c53('0x36')](function(_0x2aaabd){if(_0x2aaabd==='WhatsappAccountId'){_0x5dfabe[_0x4c53('0x7e')]('i.WhatsappAccountId\x20IN\x20?',[][_0x4c53('0x7f')](_0x1cf182['query'][_0x2aaabd]));}else if(_0x2aaabd===_0x4c53('0x80')){var _0x1b23c8=JSON[_0x4c53('0x81')](_0x1cf182[_0x4c53('0x41')][_0x2aaabd])[_0x4c53('0x82')];var _0x346899=JSON[_0x4c53('0x81')](_0x1cf182[_0x4c53('0x41')][_0x2aaabd])[_0x4c53('0x83')];_0x5dfabe[_0x4c53('0x7e')](_0x4c53('0x84'),_0x1b23c8,_0x346899);}else{if(_0x1cf182[_0x4c53('0x41')][_0x2aaabd]===_0x4c53('0x85')){_0x5dfabe[_0x4c53('0x7e')]('i.'+_0x2aaabd+_0x4c53('0x86'));}else{_0x5dfabe[_0x4c53('0x7e')]('i.'+_0x2aaabd+_0x4c53('0x87'),_0x1cf182['query'][_0x2aaabd]);}}});}if(_0x1cf182[_0x4c53('0x41')][_0x4c53('0x88')]){if(_0x1cf182[_0x4c53('0x41')]['read']==0x1){_0x5dfabe['having']('`unreadMessages`\x20=\x200');}else{_0x5dfabe['having'](_0x4c53('0x89'));}}if(_0x1cf182[_0x4c53('0x41')][_0x4c53('0x8a')]){_0x354d7c=_[_0x4c53('0x8b')](_0x1cf182[_0x4c53('0x41')][_0x4c53('0x8a')])?_0x1cf182[_0x4c53('0x41')]['tag']:new Array(_0x1cf182[_0x4c53('0x41')][_0x4c53('0x8a')]);_0x354d7c[_0x4c53('0x36')](function(_0x38c85f){_0x57cbdf['or'](_0x4c53('0x74'),'%,'+_0x38c85f+',%');});}if(_0x1cf182[_0x4c53('0x41')][_0x4c53('0x8c')]){var _0x4398a3=_0x1cf182['query']['filter'][_0x4c53('0x8d')]('\x5c','\x5c\x5c')[_0x4c53('0x8d')](/'/g,'\x27\x27');if(qs[_0x4c53('0x8e')](_0x4398a3)){_0x47365c['or']('i.id\x20LIKE\x20?',_0x4398a3+'%')['or']('i.phone\x20LIKE\x20?',_0x4398a3+'%');}else{_0x47365c['or'](_0x4c53('0x8f'),qs[_0x4c53('0x6f')](_0x4398a3))['or'](_0x4c53('0x90'),_0x4398a3+'%');}}}_0x5dfabe[_0x4c53('0x7e')](_0x47365c);_0x5dfabe[_0x4c53('0x91')]('i.id');var _0x269443={'type':db[_0x4c53('0x92')][_0x4c53('0x93')][_0x4c53('0x94')],'raw':!![]};var _0x61820d=_0x5dfabe[_0x4c53('0x95')]();_0x61820d['field'](_0x4c53('0x96'));_0x61820d[_0x4c53('0x4d')](_0x4c53('0x97'),_0x4c53('0x66'));if(_0x3084b4[_0x4c53('0x98')]){_0x3084b4['order'][_0x4c53('0x36')](function(_0x1ca5a0){var _0x13e7f9=_0x1ca5a0[0x0]===_0x4c53('0x99')?_0x1ca5a0[0x0]:'i.'+_0x1ca5a0[0x0];_0x5dfabe[_0x4c53('0x98')](_0x13e7f9,_0x1ca5a0[0x1]==='DESC'?![]:!![]);});}if(!_[_0x4c53('0x7d')](_0x354d7c)){_0x5dfabe[_0x4c53('0x68')](_0x57cbdf);_0x61820d[_0x4c53('0x7e')](_0x4c53('0x9a'),_0x354d7c);}BPromise['resolve']()[_0x4c53('0x2c')](function(){if(!_0x119284){if(_0x1cf182['query'][_0x4c53('0x9b')])return;_0x61820d[_0x4c53('0x7e')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x5dfabe['where'](_0x4c53('0x9c'));return;}if(_0x1cf182[_0x4c53('0x9d')][_0x4c53('0x9e')]!==_0x4c53('0x9f'))return;return _0x1cf182['user'][_0x4c53('0xa0')]({'attributes':['id'],'raw':!![]})[_0x4c53('0x2c')](function(_0x2df0c6){if(_[_0x4c53('0x7d')](_0x2df0c6)){_0x61820d[_0x4c53('0x7e')](_0x4c53('0xa1'));_0x5dfabe[_0x4c53('0x7e')](_0x4c53('0xa1'));}else{_0x61820d[_0x4c53('0x7e')](_0x4c53('0xa2'),_[_0x4c53('0x40')](_0x2df0c6,'id'));_0x5dfabe[_0x4c53('0x7e')](_0x4c53('0xa2'),_[_0x4c53('0x40')](_0x2df0c6,'id'));}});})[_0x4c53('0x2c')](function(){if(_0x1cf182[_0x4c53('0x9d')][_0x4c53('0x9e')]===_0x4c53('0x9f')&&!_0x119284&&!_0x1cf182['query'][_0x4c53('0x9b')])return[];return db[_0x4c53('0xa3')][_0x4c53('0x41')](_0x61820d[_0x4c53('0xa4')](),_0x269443);})['then'](function(_0x572323){_0x455581[_0x4c53('0x26')]=_0x572323[_0x4c53('0x47')];if(_0x455581[_0x4c53('0x26')]===0x0)return[];return db['sequelize'][_0x4c53('0x41')](_0x1127ee[_0x4c53('0xa4')](),_0x269443)['then'](function(_0x5f1539){_0x1dec8d=_[_0x4c53('0xa5')](_0x5f1539,'id');_0x269443=_[_0x4c53('0xa6')](_0x269443,{'model':db[_0x4c53('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1cf182[_0x4c53('0x41')][_0x4c53('0x46')]){_0x3084b4[_0x4c53('0x44')][_0x4c53('0x36')](function(_0x4e11f4){_0x5dfabe['field']('i.'+_0x4e11f4);});}else{_0x5dfabe[_0x4c53('0x4d')](_0x4c53('0x97'),'unreadMessages');_0x5dfabe['field']('a.key',_0x4c53('0xa7'));_0x5dfabe['field'](_0x4c53('0xa8'),_0x4c53('0xa9'));_0x5dfabe[_0x4c53('0x4d')](_0x4c53('0xaa'),'contactName');_0x5dfabe[_0x4c53('0x4d')]('i.*');_0x5dfabe[_0x4c53('0x4d')]('c.firstName',_0x4c53('0xab'));_0x5dfabe[_0x4c53('0x4d')](_0x4c53('0xac'),_0x4c53('0xad'));_0x5dfabe['field']('c.email',_0x4c53('0xae'));_0x5dfabe[_0x4c53('0x4d')](_0x4c53('0xaf'),_0x4c53('0xb0'));_0x5dfabe[_0x4c53('0x4d')](_0x4c53('0xb1'),_0x4c53('0xb2'));_0x5dfabe[_0x4c53('0x4d')]('c.fax',_0x4c53('0xb3'));_0x5dfabe['field']('o.fullname',_0x4c53('0xb4'));_0x5dfabe['field']('o.internal',_0x4c53('0xb5'));_0x5dfabe['field'](_0x4c53('0xb6'),_0x4c53('0x34'));}if(_0x3084b4['limit'])_0x5dfabe[_0x4c53('0x25')](_0x3084b4[_0x4c53('0x25')]);if(_0x3084b4['offset'])_0x5dfabe[_0x4c53('0x23')](_0x3084b4[_0x4c53('0x23')]);return db[_0x4c53('0xa3')][_0x4c53('0x41')](_0x5dfabe[_0x4c53('0xa4')](),_0x269443);})[_0x4c53('0x2c')](function(_0x1b4e49){if(_0x1b4e49['length']>0x0)_0x725344[_0x4c53('0x7e')](_0x4c53('0xb7'),_[_0x4c53('0x40')](_0x1b4e49,'id'));return db[_0x4c53('0xa3')][_0x4c53('0x41')](_0x725344[_0x4c53('0xa4')](),_0x269443)[_0x4c53('0x2c')](function(_0x423c62){var _0x74e586=_[_0x4c53('0xb8')](_0x423c62,_0x4c53('0xb9'));var _0x597442=[];_0x1b4e49[_0x4c53('0x36')](function(_0x4e8d94){_0x597442['push'](updateWhatsappInteraction(_0x4e8d94,_0x1dec8d,_0x74e586));});return BPromise[_0x4c53('0xba')](_0x597442);});});})[_0x4c53('0x2c')](function(_0x2f0794){_0x455581[_0x4c53('0xbb')]=_0x2f0794;return _0x455581;})[_0x4c53('0x2c')](respondWithFilteredResult(_0x43db02,_0x3084b4))['catch'](handleError(_0x43db02,null));};exports['show']=function(_0x104434,_0x4b2a43){var _0x1af2d6={'raw':![],'where':{'id':_0x104434['params']['id']}},_0xee2d81={};_0xee2d81[_0x4c53('0x3f')]=_[_0x4c53('0x42')](db['WhatsappInteraction'][_0x4c53('0x3b')]);_0xee2d81['query']=_[_0x4c53('0x42')](_0x104434[_0x4c53('0x41')]);_0xee2d81[_0x4c53('0x43')]=_[_0x4c53('0x45')](_0xee2d81[_0x4c53('0x3f')],_0xee2d81[_0x4c53('0x41')]);_0x1af2d6['attributes']=_[_0x4c53('0x45')](_0xee2d81[_0x4c53('0x3f')],qs['fields'](_0x104434['query']['fields']));_0x1af2d6[_0x4c53('0x44')]=_0x1af2d6[_0x4c53('0x44')][_0x4c53('0x47')]?_0x1af2d6['attributes']:_0xee2d81[_0x4c53('0x3f')];if(_0x104434[_0x4c53('0x41')]['includeAll']){_0x1af2d6[_0x4c53('0xbc')]=[{'all':!![]}];}_0x1af2d6=_[_0x4c53('0xa6')]({},_0x1af2d6,_0x104434[_0x4c53('0xbd')]);return db[_0x4c53('0x3a')][_0x4c53('0x65')](_0x1af2d6)[_0x4c53('0x2c')](handleEntityNotFound(_0x4b2a43,null))['then'](respondWithResult(_0x4b2a43,null))[_0x4c53('0x39')](handleError(_0x4b2a43,null));};exports[_0x4c53('0xbe')]=function(_0x512407,_0x1d66f7){return db['WhatsappInteraction'][_0x4c53('0xbe')](_0x512407[_0x4c53('0x79')],{})[_0x4c53('0x2c')](respondWithResult(_0x1d66f7,0xc9))[_0x4c53('0x39')](handleError(_0x1d66f7,null));};exports[_0x4c53('0x2b')]=function(_0x18870c,_0x41ab07){if(_0x18870c[_0x4c53('0x79')]['id']){delete _0x18870c[_0x4c53('0x79')]['id'];}return db[_0x4c53('0x3a')][_0x4c53('0x65')]({'where':{'id':_0x18870c[_0x4c53('0xbf')]['id']}})[_0x4c53('0x2c')](handleEntityNotFound(_0x41ab07,null))['then'](saveUpdates(_0x18870c[_0x4c53('0x79')],null))[_0x4c53('0x2c')](respondWithResult(_0x41ab07,null))[_0x4c53('0x39')](handleError(_0x41ab07,null));};exports[_0x4c53('0x2d')]=function(_0x5648d6,_0x4f39af){return db[_0x4c53('0x3a')]['find']({'where':{'id':_0x5648d6[_0x4c53('0xbf')]['id']}})[_0x4c53('0x2c')](handleEntityNotFound(_0x4f39af,null))['then'](removeEntity(_0x4f39af,null))['catch'](handleError(_0x4f39af,null));};exports['describe']=function(_0x18ed68,_0x782329){return db[_0x4c53('0x3a')][_0x4c53('0xc0')]()['then'](respondWithResult(_0x782329,null))[_0x4c53('0x39')](handleError(_0x782329,null));};exports['addMessage']=function(_0x281229,_0x34b9d9,_0x5a32a5){return db[_0x4c53('0xc1')]['find']({'where':{'id':_0x281229[_0x4c53('0xbf')]['id']}})[_0x4c53('0x2c')](handleEntityNotFound(_0x34b9d9,null))[_0x4c53('0x2c')](function(_0x10c762){if(_0x10c762){return _0x10c762['addMessage'](_0x281229[_0x4c53('0x79')][_0x4c53('0xc2')],_[_0x4c53('0xc3')](_0x281229['body'],[_0x4c53('0xc2'),'id'])||{});}})[_0x4c53('0x2c')](respondWithResult(_0x34b9d9,null))[_0x4c53('0x39')](handleError(_0x34b9d9,null));};exports[_0x4c53('0xc4')]=function(_0x355d20,_0x54d1d0,_0x56a2c3){var _0x4e791d={'raw':![],'where':{}};var _0x2a18a0={};var _0x3fbcd6={'count':0x0,'rows':[]};return db[_0x4c53('0x3a')][_0x4c53('0xc5')]({'where':{'id':_0x355d20[_0x4c53('0xbf')]['id']}})[_0x4c53('0x2c')](handleEntityNotFound(_0x54d1d0,null))[_0x4c53('0x2c')](function(_0x1dfb54){if(_0x1dfb54){_0x2a18a0[_0x4c53('0x3f')]=_[_0x4c53('0x42')](db[_0x4c53('0xc1')]['rawAttributes']);_0x2a18a0[_0x4c53('0x41')]=_[_0x4c53('0x42')](_0x355d20['query']);_0x2a18a0['filters']=_[_0x4c53('0x45')](_0x2a18a0[_0x4c53('0x3f')],_0x2a18a0[_0x4c53('0x41')]);_0x4e791d[_0x4c53('0x44')]=_[_0x4c53('0x45')](_0x2a18a0[_0x4c53('0x3f')],qs['fields'](_0x355d20['query']['fields']));_0x4e791d['attributes']=_0x4e791d[_0x4c53('0x44')][_0x4c53('0x47')]?_0x4e791d[_0x4c53('0x44')]:_0x2a18a0[_0x4c53('0x3f')];if(!_0x355d20[_0x4c53('0x41')][_0x4c53('0x48')]('nolimit')){_0x4e791d['limit']=qs[_0x4c53('0x25')](_0x355d20[_0x4c53('0x41')][_0x4c53('0x25')]);_0x4e791d[_0x4c53('0x23')]=qs['offset'](_0x355d20[_0x4c53('0x41')]['offset']);}_0x4e791d['order']=qs[_0x4c53('0x4a')](_0x355d20[_0x4c53('0x41')][_0x4c53('0x4a')]);_0x4e791d[_0x4c53('0x7e')]=qs[_0x4c53('0x43')](_[_0x4c53('0x4b')](_0x355d20[_0x4c53('0x41')],_0x2a18a0['filters']));_0x4e791d[_0x4c53('0x7e')][_0x4c53('0xb9')]=_0x1dfb54['id'];if(_0x355d20[_0x4c53('0x41')][_0x4c53('0x8c')]){_0x4e791d['where']=_[_0x4c53('0xa6')](_0x4e791d[_0x4c53('0x7e')],{'$or':_[_0x4c53('0x40')](_0x4e791d[_0x4c53('0x44')],function(_0x5a266c){var _0x1768cc={};_0x1768cc[_0x5a266c]={'$like':'%'+_0x355d20[_0x4c53('0x41')][_0x4c53('0x8c')]+'%'};return _0x1768cc;})});}if(_0x355d20[_0x4c53('0x41')]['$gte']){var _0x1e7b31=_0x355d20[_0x4c53('0x41')]['$gte']['split'](',');var _0x528f62={};_0x528f62[_0x1e7b31[0x0]]={'$gte':moment(_0x1e7b31[0x1])['format'](_0x4c53('0xc6'))};_0x4e791d[_0x4c53('0x7e')]=_['merge'](_0x4e791d[_0x4c53('0x7e')],_0x528f62);}_0x4e791d=_[_0x4c53('0xa6')]({},_0x4e791d,_0x355d20['options']);return db[_0x4c53('0xc1')][_0x4c53('0x26')]({'where':_0x4e791d[_0x4c53('0x7e')]})[_0x4c53('0x2c')](function(_0x92c6e1){_0x3fbcd6[_0x4c53('0x26')]=_0x92c6e1;if(_0x355d20[_0x4c53('0x41')][_0x4c53('0xc7')]){_0x4e791d[_0x4c53('0xbc')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x4e791d);})[_0x4c53('0x2c')](function(_0x1611d1){_0x3fbcd6['rows']=_0x1611d1;return _0x3fbcd6;});}})[_0x4c53('0x2c')](respondWithFilteredResult(_0x54d1d0,_0x4e791d))['catch'](handleError(_0x54d1d0,null));};exports[_0x4c53('0xc8')]=function(_0x42545a,_0x31ab55,_0x4694a7){return db[_0x4c53('0x3a')]['find']({'where':{'id':_0x42545a[_0x4c53('0xbf')]['id']}})['then'](handleEntityNotFound(_0x31ab55,null))[_0x4c53('0x2c')](function(_0x3e9810){if(_0x3e9810){return _0x3e9810[_0x4c53('0xc9')](_0x42545a[_0x4c53('0x79')][_0x4c53('0xc2')],_[_0x4c53('0xc3')](_0x42545a[_0x4c53('0x79')],['ids','id'])||{})[_0x4c53('0xca')](function(){return db[_0x4c53('0x73')]['findAll']({'attributes':['id',_0x4c53('0x31'),_0x4c53('0x4e')],'where':{'id':_0x42545a[_0x4c53('0x79')]['ids']}});})[_0x4c53('0x2c')](function(_0x58d444){socket[_0x4c53('0xcb')](_0x4c53('0xcc'),{'id':Number(_0x42545a[_0x4c53('0xbf')]['id']),'tags':_0x58d444||[]});return{'id':Number(_0x42545a[_0x4c53('0xbf')]['id']),'tags':_0x58d444||[]};});}})[_0x4c53('0x2c')](respondWithResult(_0x31ab55,null))[_0x4c53('0x39')](handleError(_0x31ab55,null));};exports['removeTags']=function(_0xe2e55f,_0x51aff1,_0x122bab){return db[_0x4c53('0x3a')][_0x4c53('0x65')]({'where':{'id':_0xe2e55f[_0x4c53('0xbf')]['id']}})['then'](handleEntityNotFound(_0x51aff1,null))[_0x4c53('0x2c')](function(_0x4c24c0){if(_0x4c24c0){return _0x4c24c0[_0x4c53('0xcd')](_0xe2e55f[_0x4c53('0x41')][_0x4c53('0xc2')]);}})[_0x4c53('0x2c')](respondWithStatusCode(_0x51aff1,null))[_0x4c53('0x39')](handleError(_0x51aff1,null));};exports[_0x4c53('0xce')]=function(_0x4408cf,_0x29bb1c){var _0x1e69ac=moment()['unix']()[_0x4c53('0xa4')]();var _0x4dd7e1=path[_0x4c53('0xcf')](config[_0x4c53('0xd0')],_0x4c53('0xd1'),_0x4c53('0xd2'),'tmp');var _0x155c36=path[_0x4c53('0xcf')](config[_0x4c53('0xd0')],_0x4c53('0xd1'),_0x4c53('0xd2'),_0x4c53('0xd3'));var _0x3b01fc=path[_0x4c53('0xcf')](_0x4dd7e1,_0x1e69ac);var _0x346a35=util[_0x4c53('0xd4')](_0x4c53('0xd5'),_0x4408cf[_0x4c53('0xbf')]['id'],_0x1e69ac);var _0x1e1b31=path[_0x4c53('0xcf')](_0x4dd7e1,_0x346a35);var _0x1c0b14=[];_0x1c0b14[_0x4c53('0x38')]({'model':db[_0x4c53('0xd6')],'as':_0x4c53('0xd6'),'attributes':['id',_0x4c53('0x33')],'raw':!![]});_0x1c0b14[_0x4c53('0x38')]({'model':db[_0x4c53('0xd7')],'as':_0x4c53('0x6b'),'attributes':['id','firstName',_0x4c53('0xd8')],'raw':!![]});if(_0x4408cf[_0x4c53('0x41')][_0x4c53('0xd3')]){_0x1c0b14[_0x4c53('0x38')]({'model':db[_0x4c53('0xd9')],'as':_0x4c53('0xd9'),'raw':!![]});}var _0x573fe5=[{'model':db[_0x4c53('0xc1')],'as':'Messages','attributes':['id',_0x4c53('0x79'),_0x4c53('0x80'),'direction',_0x4c53('0xda'),'read'],'include':_0x1c0b14}];_0x573fe5['push']({'model':db[_0x4c53('0xdb')],'as':'Account','attributes':['id','name']});_0x573fe5[_0x4c53('0x38')]({'model':db[_0x4c53('0xd6')],'as':_0x4c53('0xdc'),'attributes':['id',_0x4c53('0x33')]});return db[_0x4c53('0x3a')][_0x4c53('0x65')]({'where':{'id':_0x4408cf[_0x4c53('0xbf')]['id']},'include':_0x573fe5})[_0x4c53('0x2c')](handleEntityNotFound(_0x29bb1c,null))[_0x4c53('0x2c')](function(_0xcc5295){if(_0xcc5295){var _0x5bd806=_0xcc5295['get']({'plain':!![]});fs[_0x4c53('0xdd')](_0x3b01fc);var _0x518528={'channel':_0x4c53('0xde'),'account':_0x5bd806[_0x4c53('0xdf')][_0x4c53('0x31')],'agent':_0x5bd806[_0x4c53('0xdc')]?_0x5bd806[_0x4c53('0xdc')][_0x4c53('0x33')]:_0x4c53('0xe0'),'createdAt':moment(_0x5bd806[_0x4c53('0x80')])['format'](_0x4c53('0xc6'))[_0x4c53('0xa4')](),'closedAt':_0x5bd806[_0x4c53('0xe1')]?moment(_0x5bd806['closedAt'])[_0x4c53('0xd4')](_0x4c53('0xc6'))[_0x4c53('0xa4')]():'','disposition':_0x5bd806[_0x4c53('0xe2')],'messages':_(_0x5bd806[_0x4c53('0xe3')])[_0x4c53('0x8c')]({'secret':![]})[_0x4c53('0x40')](function(_0x252afa){if(_0x252afa[_0x4c53('0xd9')]){var _0x2ba8de=path[_0x4c53('0xcf')](_0x155c36,_0x252afa[_0x4c53('0xd9')]['basename']);if(fs['existsSync'](_0x2ba8de)){fs[_0x4c53('0xe4')](_0x2ba8de)[_0x4c53('0xe5')](fs[_0x4c53('0xe6')](path[_0x4c53('0xcf')](_0x3b01fc,_0x252afa['Attachment'][_0x4c53('0xe7')])));}}return{'date':moment(_0x252afa['createdAt'])[_0x4c53('0xd4')](_0x4c53('0xc6'))[_0x4c53('0xa4')](),'sender':_0x252afa[_0x4c53('0xe8')]===_0x4c53('0xe9')?_0x252afa[_0x4c53('0xd6')]?_0x252afa[_0x4c53('0xd6')][_0x4c53('0x33')]:_0x4c53('0xea'):_0x252afa[_0x4c53('0x6b')][_0x4c53('0xeb')]+(_0x252afa[_0x4c53('0x6b')][_0x4c53('0xd8')]?'\x20'+_0x252afa[_0x4c53('0x6b')][_0x4c53('0xd8')]:''),'body':_0x252afa[_0x4c53('0xd9')]?_0x252afa[_0x4c53('0xd9')]['basename']:_0x252afa['body'],'direction':_0x252afa[_0x4c53('0xe8')]==='out'?'A':'C','secret':_0x252afa[_0x4c53('0xda')],'read':_0x252afa[_0x4c53('0x88')],'attachment':_0x252afa[_0x4c53('0xd9')]};})[_0x4c53('0x67')]()};return ejs[_0x4c53('0xec')](path[_0x4c53('0xcf')](config[_0x4c53('0xd0')],'server','views',_0x4c53('0xed')),{'interaction':_0x518528})[_0x4c53('0x2c')](function(_0x8dac09){var _0x296607=path[_0x4c53('0xcf')](_0x3b01fc,'transcript-'+_0x5bd806['id']+'-'+_0x1e69ac+_0x4c53('0xee'));var _0x45a4c9={'path':_0x296607,'channel':_0x4c53('0xde'),'interactionId':_0x5bd806['id']};return pdf[_0x4c53('0xef')](_0x8dac09,_0x45a4c9);})[_0x4c53('0x2c')](function(){return new BPromise(function(_0x13e65c,_0x759fb){zipdir(_0x3b01fc,{'saveTo':_0x1e1b31},function(_0x37c5c1,_0x50766a){if(_0x37c5c1)return _0x759fb(_0x37c5c1);return _0x13e65c(_0x50766a);});})[_0x4c53('0x2c')](function(){return new BPromise(function(_0x101466,_0x14a173){rimraf(_0x3b01fc,function(_0x267c28){if(_0x267c28)_0x14a173(_0x267c28);return _0x101466();});});})[_0x4c53('0x2c')](function(){return _0x29bb1c['download'](_0x1e1b31,_0x346a35,function(_0x33f59e){if(_0x33f59e){console[_0x4c53('0xf0')](_0x4c53('0xf1'),_0x33f59e);}else{fs[_0x4c53('0xf2')](_0x1e1b31);}});});});}else{return _0x29bb1c[_0x4c53('0x2e')](0xc8);}})[_0x4c53('0x39')](handleError(_0x29bb1c,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 0cdc010..c5c4ccf 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 _0xae60=['../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x552fce,_0x3f24bc){var _0x3e27a2=function(_0xc91154){while(--_0xc91154){_0x552fce['push'](_0x552fce['shift']());}};_0x3e27a2(++_0x3f24bc);}(_0xae60,0x1c7));var _0x0ae6=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xae60[_0x243b59];return _0x3e1676;};'use strict';var EventEmitter=require(_0x0ae6('0x0'));var WhatsappInteraction=require(_0x0ae6('0x1'))['db'][_0x0ae6('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x0ae6('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x0ae6('0x4')](0x0);var events={'afterCreate':_0x0ae6('0x5'),'afterUpdate':'update','afterDestroy':_0x0ae6('0x6')};function emitEvent(_0x470e83){return function(_0x47c9e0,_0xe0287b,_0x25ac7c){_0x47c9e0[_0x0ae6('0x7')]({'attributes':['id'],'raw':!![]})[_0x0ae6('0x8')](function(_0xbb596c){_0x47c9e0[_0x0ae6('0x9')](_0x0ae6('0xa'),_0xbb596c[_0x0ae6('0xb')](function(_0x4860f8){return{'id':_0x4860f8['id']};}));return WhatsappMessage[_0x0ae6('0xc')]({'where':{'WhatsappInteractionId':_0x47c9e0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0ae6('0x8')](function(_0x3a8b0e){_0x47c9e0[_0x0ae6('0x9')]('unreadMessages',_0x3a8b0e[_0x0ae6('0xd')]);WhatsappInteractionEvents[_0x0ae6('0xe')](_0x470e83+':'+_0x47c9e0['id'],_0x47c9e0);WhatsappInteractionEvents[_0x0ae6('0xe')](_0x470e83,_0x47c9e0);_0x25ac7c(null);})[_0x0ae6('0xf')](_0x25ac7c(null));};}for(var e in events){if(events[_0x0ae6('0x10')](e)){var event=events[e];WhatsappInteraction[_0x0ae6('0x11')](e,emitEvent(event));}}module[_0x0ae6('0x12')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xf46a=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','WhatsappInteraction','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x5a4937,_0x559869){var _0x33c997=function(_0x45a74d){while(--_0x45a74d){_0x5a4937['push'](_0x5a4937['shift']());}};_0x33c997(++_0x559869);}(_0xf46a,0xa4));var _0xaf46=function(_0x724c2a,_0x1fe991){_0x724c2a=_0x724c2a-0x0;var _0x29ee9b=_0xf46a[_0x724c2a];return _0x29ee9b;};'use strict';var EventEmitter=require(_0xaf46('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xaf46('0x1')];var WhatsappMessage=require(_0xaf46('0x2'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xaf46('0x3')](0x0);var events={'afterCreate':_0xaf46('0x4'),'afterUpdate':_0xaf46('0x5'),'afterDestroy':_0xaf46('0x6')};function emitEvent(_0x34c69d){return function(_0xb39163,_0x35f997,_0x399251){_0xb39163[_0xaf46('0x7')]({'attributes':['id'],'raw':!![]})[_0xaf46('0x8')](function(_0x4f76cc){_0xb39163[_0xaf46('0x9')](_0xaf46('0xa'),_0x4f76cc[_0xaf46('0xb')](function(_0x56f9c8){return{'id':_0x56f9c8['id']};}));return WhatsappMessage[_0xaf46('0xc')]({'where':{'WhatsappInteractionId':_0xb39163['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x54eb46){_0xb39163['setDataValue'](_0xaf46('0xd'),_0x54eb46[_0xaf46('0xe')]);WhatsappInteractionEvents['emit'](_0x34c69d+':'+_0xb39163['id'],_0xb39163);WhatsappInteractionEvents[_0xaf46('0xf')](_0x34c69d,_0xb39163);_0x399251(null);})[_0xaf46('0x10')](_0x399251(null));};}for(var e in events){if(events[_0xaf46('0x11')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xaf46('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index cd8177c..921a97d 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 _0x8ee8=['changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','request-promise','path','rimraf','./whatsappInteraction.attributes','WhatsappInteraction','whatsapp_interactions'];(function(_0x18ee49,_0x1cff4b){var _0x24b573=function(_0x3242ac){while(--_0x3242ac){_0x18ee49['push'](_0x18ee49['shift']());}};_0x24b573(++_0x1cff4b);}(_0x8ee8,0xe4));var _0x88ee=function(_0x2b29ab,_0x201845){_0x2b29ab=_0x2b29ab-0x0;var _0x16e64b=_0x8ee8[_0x2b29ab];return _0x16e64b;};'use strict';var _=require(_0x88ee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x88ee('0x1'));var moment=require(_0x88ee('0x2'));var BPromise=require(_0x88ee('0x3'));var rp=require(_0x88ee('0x4'));var fs=require('fs');var path=require(_0x88ee('0x5'));var rimraf=require(_0x88ee('0x6'));var config=require('../../config/environment');var attributes=require(_0x88ee('0x7'));module['exports']=function(_0x1d4fb4,_0x8a7735){return _0x1d4fb4['define'](_0x88ee('0x8'),attributes,{'tableName':_0x88ee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a4026,_0x242083,_0x1ccd16){if(_0x1a4026[_0x88ee('0xa')]('closed')){_0x1a4026[_0x88ee('0xb')]=moment()[_0x88ee('0xc')](_0x88ee('0xd'));}_0x1ccd16(null,_0x1a4026);}}});}; \ No newline at end of file +var _0xeb4c=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format'];(function(_0x507ac5,_0x33aaee){var _0x12c1bc=function(_0x5c953c){while(--_0x5c953c){_0x507ac5['push'](_0x507ac5['shift']());}};_0x12c1bc(++_0x33aaee);}(_0xeb4c,0xc1));var _0xceb4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xeb4c[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xceb4('0x0'));var util=require(_0xceb4('0x1'));var logger=require(_0xceb4('0x2'))(_0xceb4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xceb4('0x4'));var fs=require('fs');var path=require(_0xceb4('0x5'));var rimraf=require('rimraf');var config=require(_0xceb4('0x6'));var attributes=require(_0xceb4('0x7'));module[_0xceb4('0x8')]=function(_0x23f72a,_0x49181f){return _0x23f72a[_0xceb4('0x9')](_0xceb4('0xa'),attributes,{'tableName':_0xceb4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x80f169,_0x3ea3db,_0x4cd3ba){if(_0x80f169['changed'](_0xceb4('0xc'))){_0x80f169[_0xceb4('0xd')]=moment()[_0xceb4('0xe')](_0xceb4('0xf'));}_0x4cd3ba(null,_0x80f169);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 205e759..fcb171e 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 _0xdd28=['catch','AddTagsToWhatsappInteraction','find','then','addTags','body','ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateWhatsappInteraction','update','options','where','attributes','limit'];(function(_0x24367c,_0x17b55){var _0x2cd30d=function(_0x12ed87){while(--_0x12ed87){_0x24367c['push'](_0x24367c['shift']());}};_0x2cd30d(++_0x17b55);}(_0xdd28,0xd1));var _0x8dd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd28[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8dd2('0x0'));var moment=require(_0x8dd2('0x1'));var BPromise=require(_0x8dd2('0x2'));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['client']['http']({'port':0x232a});config[_0x8dd2('0xa')]=_[_0x8dd2('0xb')](config[_0x8dd2('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8dd2('0xc'))(new Redis(config[_0x8dd2('0xa')]));require(_0x8dd2('0xd'))['register'](socket);function respondWithRpcPromise(_0x5e6800,_0x231453,_0x36bcd8){return new BPromise(function(_0x2bad53,_0x33e3ab){return client[_0x8dd2('0xe')](_0x5e6800,_0x36bcd8)['then'](function(_0x3ec91d){logger[_0x8dd2('0xf')](_0x8dd2('0x10'),_0x231453,_0x8dd2('0x11'));logger[_0x8dd2('0x12')](_0x8dd2('0x13'),_0x231453,_0x8dd2('0x11'),JSON[_0x8dd2('0x14')](_0x3ec91d));if(_0x3ec91d['error']){if(_0x3ec91d[_0x8dd2('0x15')][_0x8dd2('0x16')]===0x1f4){logger['error'](_0x8dd2('0x10'),_0x231453,_0x3ec91d[_0x8dd2('0x15')][_0x8dd2('0x17')]);return _0x33e3ab(_0x3ec91d[_0x8dd2('0x15')][_0x8dd2('0x17')]);}logger[_0x8dd2('0x15')](_0x8dd2('0x10'),_0x231453,_0x3ec91d[_0x8dd2('0x15')][_0x8dd2('0x17')]);return _0x2bad53(_0x3ec91d[_0x8dd2('0x15')]['message']);}else{logger[_0x8dd2('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x231453,_0x8dd2('0x11'));_0x2bad53(_0x3ec91d[_0x8dd2('0x18')][_0x8dd2('0x17')]);}})['catch'](function(_0x549085){logger[_0x8dd2('0x15')](_0x8dd2('0x10'),_0x231453,_0x549085);_0x33e3ab(_0x549085);});});}exports[_0x8dd2('0x19')]=function(_0x5988a3){var _0x35782d=this;return new Promise(function(_0x52f118,_0x1c6ac9){return db['WhatsappInteraction'][_0x8dd2('0x1a')](_0x5988a3['body'],{'raw':_0x5988a3['options']?_0x5988a3[_0x8dd2('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5988a3['options']?_0x5988a3['options'][_0x8dd2('0x1c')]||null:null,'attributes':_0x5988a3[_0x8dd2('0x1b')]?_0x5988a3[_0x8dd2('0x1b')][_0x8dd2('0x1d')]||null:null,'limit':_0x5988a3[_0x8dd2('0x1b')]?_0x5988a3[_0x8dd2('0x1b')][_0x8dd2('0x1e')]||null:null})['then'](function(_0x1708a6){logger[_0x8dd2('0xf')](_0x8dd2('0x19'),_0x5988a3);logger[_0x8dd2('0x12')](_0x8dd2('0x19'),_0x5988a3,JSON[_0x8dd2('0x14')](_0x1708a6));_0x52f118(_0x1708a6);})[_0x8dd2('0x1f')](function(_0x208307){logger['error']('UpdateWhatsappInteraction',_0x208307[_0x8dd2('0x17')],_0x5988a3);_0x1c6ac9(_0x35782d[_0x8dd2('0x15')](0x1f4,_0x208307['message']));});});};exports[_0x8dd2('0x20')]=function(_0x6fa080){return new Promise(function(_0x318c5d,_0x365ebd){return db['WhatsappInteraction'][_0x8dd2('0x21')]({'where':_0x6fa080[_0x8dd2('0x1b')]?_0x6fa080[_0x8dd2('0x1b')]['where']||null:null})[_0x8dd2('0x22')](function(_0x11bce4){if(_0x11bce4){return _0x11bce4[_0x8dd2('0x23')](_0x6fa080[_0x8dd2('0x24')][_0x8dd2('0x25')],_[_0x8dd2('0x26')](_0x6fa080[_0x8dd2('0x24')],[_0x8dd2('0x25'),'id'])||{});}})['spread'](function(_0x46fcc9){logger[_0x8dd2('0xf')](_0x8dd2('0x27'),_0x6fa080);logger[_0x8dd2('0x12')](_0x8dd2('0x27'),_0x6fa080,JSON['stringify'](_0x46fcc9));_0x318c5d(_0x46fcc9);})[_0x8dd2('0x1f')](function(_0x13bbb4){logger['error'](_0x8dd2('0x27'),_0x13bbb4[_0x8dd2('0x17')],_0x6fa080);_0x365ebd(_this[_0x8dd2('0x15')](0x1f4,_0x13bbb4[_0x8dd2('0x17')]));});});}; \ No newline at end of file +var _0x3b7d=['error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','attributes','limit','AddTagsToWhatsappInteraction','find','where','addTags','ids','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x174293,_0x31d326){var _0x34da52=function(_0x425f85){while(--_0x425f85){_0x174293['push'](_0x174293['shift']());}};_0x34da52(++_0x31d326);}(_0x3b7d,0x13f));var _0xd3b7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3b7d[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xd3b7('0x0'));var util=require(_0xd3b7('0x1'));var moment=require(_0xd3b7('0x2'));var BPromise=require(_0xd3b7('0x3'));var rs=require(_0xd3b7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd3b7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd3b7('0x6'))(_0xd3b7('0x7'));var config=require(_0xd3b7('0x8'));var jayson=require(_0xd3b7('0x9'));var client=jayson[_0xd3b7('0xa')][_0xd3b7('0xb')]({'port':0x232a});config['redis']=_[_0xd3b7('0xc')](config[_0xd3b7('0xd')],{'host':_0xd3b7('0xe'),'port':0x18eb});var socket=require(_0xd3b7('0xf'))(new Redis(config[_0xd3b7('0xd')]));require(_0xd3b7('0x10'))[_0xd3b7('0x11')](socket);function respondWithRpcPromise(_0x1f0d9a,_0x2e03f7,_0x3fac49){return new BPromise(function(_0x4c6687,_0x468570){return client[_0xd3b7('0x12')](_0x1f0d9a,_0x3fac49)[_0xd3b7('0x13')](function(_0x11f86a){logger[_0xd3b7('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x2e03f7,_0xd3b7('0x15'));logger[_0xd3b7('0x16')](_0xd3b7('0x17'),_0x2e03f7,_0xd3b7('0x15'),JSON[_0xd3b7('0x18')](_0x11f86a));if(_0x11f86a[_0xd3b7('0x19')]){if(_0x11f86a[_0xd3b7('0x19')][_0xd3b7('0x1a')]===0x1f4){logger[_0xd3b7('0x19')](_0xd3b7('0x1b'),_0x2e03f7,_0x11f86a['error'][_0xd3b7('0x1c')]);return _0x468570(_0x11f86a[_0xd3b7('0x19')][_0xd3b7('0x1c')]);}logger[_0xd3b7('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x2e03f7,_0x11f86a[_0xd3b7('0x19')][_0xd3b7('0x1c')]);return _0x4c6687(_0x11f86a[_0xd3b7('0x19')]['message']);}else{logger[_0xd3b7('0x14')](_0xd3b7('0x1b'),_0x2e03f7,'request\x20sent');_0x4c6687(_0x11f86a[_0xd3b7('0x1d')][_0xd3b7('0x1c')]);}})[_0xd3b7('0x1e')](function(_0x4fc4a7){logger[_0xd3b7('0x19')](_0xd3b7('0x1b'),_0x2e03f7,_0x4fc4a7);_0x468570(_0x4fc4a7);});});}exports[_0xd3b7('0x1f')]=function(_0xf0138c){var _0x4c201c=this;return new Promise(function(_0x1335d7,_0x503d98){return db[_0xd3b7('0x20')]['update'](_0xf0138c[_0xd3b7('0x21')],{'raw':_0xf0138c['options']?_0xf0138c[_0xd3b7('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf0138c[_0xd3b7('0x22')]?_0xf0138c['options']['where']||null:null,'attributes':_0xf0138c[_0xd3b7('0x22')]?_0xf0138c[_0xd3b7('0x22')][_0xd3b7('0x23')]||null:null,'limit':_0xf0138c[_0xd3b7('0x22')]?_0xf0138c['options'][_0xd3b7('0x24')]||null:null})[_0xd3b7('0x13')](function(_0x29fd56){logger[_0xd3b7('0x14')](_0xd3b7('0x1f'),_0xf0138c);logger[_0xd3b7('0x16')](_0xd3b7('0x1f'),_0xf0138c,JSON[_0xd3b7('0x18')](_0x29fd56));_0x1335d7(_0x29fd56);})[_0xd3b7('0x1e')](function(_0x324a7b){logger['error']('UpdateWhatsappInteraction',_0x324a7b[_0xd3b7('0x1c')],_0xf0138c);_0x503d98(_0x4c201c[_0xd3b7('0x19')](0x1f4,_0x324a7b[_0xd3b7('0x1c')]));});});};exports[_0xd3b7('0x25')]=function(_0x11fb14){return new Promise(function(_0x2f061a,_0x86c1bf){return db[_0xd3b7('0x20')][_0xd3b7('0x26')]({'where':_0x11fb14[_0xd3b7('0x22')]?_0x11fb14[_0xd3b7('0x22')][_0xd3b7('0x27')]||null:null})[_0xd3b7('0x13')](function(_0x4589c5){if(_0x4589c5){return _0x4589c5[_0xd3b7('0x28')](_0x11fb14[_0xd3b7('0x21')][_0xd3b7('0x29')],_['omit'](_0x11fb14[_0xd3b7('0x21')],[_0xd3b7('0x29'),'id'])||{});}})['spread'](function(_0xf7683e){logger[_0xd3b7('0x14')]('AddTags',_0x11fb14);logger[_0xd3b7('0x16')](_0xd3b7('0x2a'),_0x11fb14,JSON[_0xd3b7('0x18')](_0xf7683e));_0x2f061a(_0xf7683e);})[_0xd3b7('0x1e')](function(_0x389048){logger[_0xd3b7('0x19')]('AddTags',_0x389048[_0xd3b7('0x1c')],_0x11fb14);_0x86c1bf(_this[_0xd3b7('0x19')](0x1f4,_0x389048[_0xd3b7('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index a3bd46d..dd75075 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 _0x96b0=['whatsappInteraction:','remove','update','emit','length'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x96b0,0xb5));var _0x096b=function(_0x5ccaa8,_0x43f32c){_0x5ccaa8=_0x5ccaa8-0x0;var _0x1d5cfb=_0x96b0[_0x5ccaa8];return _0x1d5cfb;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x096b('0x0'),_0x096b('0x1')];function createListener(_0x966c54,_0x32297c){return function(_0x47ad1f){_0x32297c[_0x096b('0x2')](_0x966c54,_0x47ad1f);};}function removeListener(_0x59d5f4,_0x26dcbd){return function(){WhatsappInteractionEvents['removeListener'](_0x59d5f4,_0x26dcbd);};}exports['register']=function(_0x3c5e9b){for(var _0x411917=0x0,_0x575c3f=events[_0x096b('0x3')];_0x411917<_0x575c3f;_0x411917++){var _0x21e3ce=events[_0x411917];var _0x49dd7c=createListener(_0x096b('0x4')+_0x21e3ce,_0x3c5e9b);WhatsappInteractionEvents['on'](_0x21e3ce,_0x49dd7c);}}; \ No newline at end of file +var _0xd348=['emit','removeListener','length','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0xd348,0xcf));var _0x8d34=function(_0x36caf7,_0x39c0b8){_0x36caf7=_0x36caf7-0x0;var _0x48d78b=_0xd348[_0x36caf7];return _0x48d78b;};'use strict';var WhatsappInteractionEvents=require(_0x8d34('0x0'));var events=[_0x8d34('0x1'),_0x8d34('0x2'),'update'];function createListener(_0x27faf9,_0x2089f5){return function(_0x3f6495){_0x2089f5[_0x8d34('0x3')](_0x27faf9,_0x3f6495);};}function removeListener(_0x2a56d9,_0x349a5a){return function(){WhatsappInteractionEvents[_0x8d34('0x4')](_0x2a56d9,_0x349a5a);};}exports['register']=function(_0x31cda7){for(var _0x52fc15=0x0,_0x3c72c9=events[_0x8d34('0x5')];_0x52fc15<_0x3c72c9;_0x52fc15++){var _0x39db21=events[_0x52fc15];var _0x412e13=createListener(_0x8d34('0x6')+_0x39db21,_0x31cda7);WhatsappInteractionEvents['on'](_0x39db21,_0x412e13);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 9a7d72b..d06b515 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 _0xfef9=['reject','delete','destroy','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','describe','/:id','tracked','whatsapp','post','/:id/status','status','/:id/accept','accept','/:id/reject'];(function(_0x281e5e,_0xf320e2){var _0x5a22d2=function(_0x405ff9){while(--_0x405ff9){_0x281e5e['push'](_0x281e5e['shift']());}};_0x5a22d2(++_0xf320e2);}(_0xfef9,0x123));var _0x9fef=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0xfef9[_0x427352];return _0x23e0e6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9fef('0x0'));var timeout=require('connect-timeout');var express=require(_0x9fef('0x1'));var router=express[_0x9fef('0x2')]();var fs_extra=require(_0x9fef('0x3'));var auth=require(_0x9fef('0x4'));var interaction=require(_0x9fef('0x5'));var config=require(_0x9fef('0x6'));var controller=require(_0x9fef('0x7'));router[_0x9fef('0x8')]('/',auth[_0x9fef('0x9')](),controller[_0x9fef('0xa')]);router['get']('/describe',auth[_0x9fef('0x9')](),controller[_0x9fef('0xb')]);router[_0x9fef('0x8')](_0x9fef('0xc'),auth[_0x9fef('0x9')](),controller['show']);router['post']('/',auth[_0x9fef('0x9')](),interaction[_0x9fef('0xd')](_0x9fef('0xe'),'whatsappmessage:create'),controller['create']);router[_0x9fef('0xf')](_0x9fef('0x10'),controller[_0x9fef('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['put'](_0x9fef('0x12'),auth[_0x9fef('0x9')](),controller[_0x9fef('0x13')]);router['put'](_0x9fef('0x14'),auth[_0x9fef('0x9')](),controller[_0x9fef('0x15')]);router[_0x9fef('0x16')](_0x9fef('0xc'),auth[_0x9fef('0x9')](),controller[_0x9fef('0x17')]);module['exports']=router; \ No newline at end of file +var _0x3ac0=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','whatsappmessage:create','/:id/status','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','exports'];(function(_0x1fead4,_0x3af8c9){var _0x53bc83=function(_0x4da8cf){while(--_0x4da8cf){_0x1fead4['push'](_0x1fead4['shift']());}};_0x53bc83(++_0x3af8c9);}(_0x3ac0,0x78));var _0x03ac=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0x3ac0[_0x26da89];return _0xc95b7b;};'use strict';var multer=require(_0x03ac('0x0'));var util=require(_0x03ac('0x1'));var path=require(_0x03ac('0x2'));var timeout=require(_0x03ac('0x3'));var express=require(_0x03ac('0x4'));var router=express[_0x03ac('0x5')]();var fs_extra=require(_0x03ac('0x6'));var auth=require(_0x03ac('0x7'));var interaction=require(_0x03ac('0x8'));var config=require('../../config/environment');var controller=require(_0x03ac('0x9'));router[_0x03ac('0xa')]('/',auth[_0x03ac('0xb')](),controller[_0x03ac('0xc')]);router[_0x03ac('0xa')](_0x03ac('0xd'),auth[_0x03ac('0xb')](),controller[_0x03ac('0xe')]);router[_0x03ac('0xa')]('/:id',auth[_0x03ac('0xb')](),controller[_0x03ac('0xf')]);router[_0x03ac('0x10')]('/',auth[_0x03ac('0xb')](),interaction[_0x03ac('0x11')]('whatsapp',_0x03ac('0x12')),controller['create']);router[_0x03ac('0x10')](_0x03ac('0x13'),controller[_0x03ac('0x14')]);router[_0x03ac('0x15')](_0x03ac('0x16'),auth[_0x03ac('0xb')](),controller[_0x03ac('0x17')]);router[_0x03ac('0x15')](_0x03ac('0x18'),auth[_0x03ac('0xb')](),controller[_0x03ac('0x19')]);router['put'](_0x03ac('0x1a'),auth['isAuthenticated'](),controller[_0x03ac('0x1b')]);router[_0x03ac('0x1c')](_0x03ac('0x16'),auth[_0x03ac('0xb')](),controller['destroy']);module[_0x03ac('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 7f61f4e..4235276 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 _0xa69d=['medium','BOOLEAN','ENUM','out','STRING','DATE','exports','TEXT'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xa69d,0x146));var _0xda69=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa69d[_0x2bf141];return _0x48277b;};'use strict';var Sequelize=require('sequelize');module[_0xda69('0x0')]={'body':{'type':Sequelize[_0xda69('0x1')](_0xda69('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xda69('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xda69('0x4')]('in',_0xda69('0x5')),'defaultValue':_0xda69('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xda69('0x6')](0xbe)},'phone':{'type':Sequelize[_0xda69('0x6')]},'readAt':{'type':Sequelize[_0xda69('0x7')]},'secret':{'type':Sequelize[_0xda69('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xda69('0x6')]},'providerResponse':{'type':Sequelize[_0xda69('0x1')]}}; \ No newline at end of file +var _0xdc97=['sequelize','exports','TEXT','BOOLEAN','out','STRING','DATE'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xdc97,0x13b));var _0x7dc9=function(_0x1553a6,_0x44ca96){_0x1553a6=_0x1553a6-0x0;var _0x4d77b1=_0xdc97[_0x1553a6];return _0x4d77b1;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'body':{'type':Sequelize[_0x7dc9('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7dc9('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7dc9('0x4')),'defaultValue':_0x7dc9('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x7dc9('0x5')]},'readAt':{'type':Sequelize[_0x7dc9('0x6')]},'secret':{'type':Sequelize[_0x7dc9('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x7dc9('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 17dddff..6a899c0 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 _0x88ff=['ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','includeAll','include','findAll','rows','show','options','create','body','update','find','params','destroy','describe','whatsapp-interactions','accept','whatsapp','read','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteractionId','isNil','read1stAt','format','user','role','interaction','stringify','null','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','channel','event','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','fullname','SIP/%s','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv'];(function(_0x3afe4c,_0x571012){var _0x53b51e=function(_0x1245c4){while(--_0x1245c4){_0x3afe4c['push'](_0x3afe4c['shift']());}};_0x53b51e(++_0x571012);}(_0x88ff,0x196));var _0xf88f=function(_0x2f4ebf,_0x315e8f){_0x2f4ebf=_0x2f4ebf-0x0;var _0x2dd6e5=_0x88ff[_0x2f4ebf];return _0x2dd6e5;};'use strict';var emlformat=require(_0xf88f('0x0'));var rimraf=require(_0xf88f('0x1'));var zipdir=require(_0xf88f('0x2'));var jsonpatch=require(_0xf88f('0x3'));var rp=require(_0xf88f('0x4'));var moment=require(_0xf88f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf88f('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf88f('0x7'));var ejs=require(_0xf88f('0x8'));var fs=require('fs');var fs_extra=require(_0xf88f('0x9'));var _=require(_0xf88f('0xa'));var squel=require(_0xf88f('0xb'));var crypto=require(_0xf88f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf88f('0x7'));var querystring=require('querystring');var Papa=require(_0xf88f('0xd'));var Redis=require(_0xf88f('0xe'));var authService=require(_0xf88f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf88f('0x10'));var hardwareService=require(_0xf88f('0x11'));var logger=require(_0xf88f('0x12'))('api');var utils=require(_0xf88f('0x13'));var config=require(_0xf88f('0x14'));var licenseUtil=require(_0xf88f('0x15'));var db=require(_0xf88f('0x16'))['db'];config[_0xf88f('0x17')]=_[_0xf88f('0x18')](config[_0xf88f('0x17')],{'host':_0xf88f('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf88f('0x1a'))[_0xf88f('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf88f('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xf88f('0x1c')][_0xf88f('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1d0716,_0x1eadcf,_0x1a9fbb,_0x1c5b80){return new BPromise(function(_0x41b06e,_0x50fd47){var _0x3432cc=_0x1c5b80||client;return _0x3432cc[_0xf88f('0x1e')](_0x1d0716,_0x1a9fbb)[_0xf88f('0x1f')](function(_0x5aa045){logger[_0xf88f('0x20')](_0xf88f('0x21'),_0x1eadcf,'request\x20sent');logger[_0xf88f('0x22')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1eadcf,_0xf88f('0x23'),JSON['stringify'](_0x5aa045));if(_0x5aa045[_0xf88f('0x24')]){if(_0x5aa045[_0xf88f('0x24')]['code']===0x1f4){logger[_0xf88f('0x24')](_0xf88f('0x21'),_0x1eadcf,_0x5aa045[_0xf88f('0x24')][_0xf88f('0x25')]);return _0x50fd47(_0x5aa045[_0xf88f('0x24')]['message']);}logger[_0xf88f('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x1eadcf,_0x5aa045[_0xf88f('0x24')][_0xf88f('0x25')]);return _0x41b06e(_0x5aa045[_0xf88f('0x24')][_0xf88f('0x25')]);}else{logger[_0xf88f('0x20')](_0xf88f('0x21'),_0x1eadcf,_0xf88f('0x23'));_0x41b06e(_0x5aa045[_0xf88f('0x26')][_0xf88f('0x25')]);}})[_0xf88f('0x27')](function(_0x4b02b9){logger[_0xf88f('0x24')](_0xf88f('0x21'),_0x1eadcf,_0x4b02b9);_0x50fd47(_0x4b02b9);});});}function respondWithStatusCode(_0x14d654,_0x2bb20e){_0x2bb20e=_0x2bb20e||0xcc;return function(_0x2b11c8){if(_0x2b11c8){return _0x14d654[_0xf88f('0x28')](_0x2bb20e);}return _0x14d654[_0xf88f('0x29')](_0x2bb20e)[_0xf88f('0x2a')]();};}function respondWithResult(_0x4861ca,_0x10be01){_0x10be01=_0x10be01||0xc8;return function(_0x3536ff){if(_0x3536ff){return _0x4861ca[_0xf88f('0x29')](_0x10be01)[_0xf88f('0x2b')](_0x3536ff);}};}function respondWithFilteredResult(_0x390b13,_0x21523e){return function(_0x2a4d7c){if(_0x2a4d7c){var _0x5a893c=typeof _0x21523e[_0xf88f('0x2c')]===_0xf88f('0x2d')&&typeof _0x21523e[_0xf88f('0x2e')]==='undefined';var _0x60f603=_0x2a4d7c[_0xf88f('0x2f')];var _0x420e0a=_0x5a893c?0x0:_0x21523e[_0xf88f('0x2c')];var _0x2c48f8=_0x5a893c?_0x2a4d7c[_0xf88f('0x2f')]:_0x21523e[_0xf88f('0x2c')]+_0x21523e[_0xf88f('0x2e')];var _0x57ec02;if(_0x2c48f8>=_0x60f603){_0x2c48f8=_0x60f603;_0x57ec02=0xc8;}else{_0x57ec02=0xce;}_0x390b13[_0xf88f('0x29')](_0x57ec02);return _0x390b13[_0xf88f('0x30')](_0xf88f('0x31'),_0x420e0a+'-'+_0x2c48f8+'/'+_0x60f603)[_0xf88f('0x2b')](_0x2a4d7c);}return null;};}function patchUpdates(_0x5cadd5){return function(_0x4860b5){try{jsonpatch[_0xf88f('0x32')](_0x4860b5,_0x5cadd5,!![]);}catch(_0x34cabf){return BPromise[_0xf88f('0x33')](_0x34cabf);}return _0x4860b5[_0xf88f('0x34')]();};}function saveUpdates(_0x115332,_0x18e1df){return function(_0x1c7d12){if(_0x1c7d12){return _0x1c7d12['update'](_0x115332)[_0xf88f('0x1f')](function(_0x4da58b){return _0x4da58b;});}return null;};}function removeEntity(_0x318eb2,_0x6ec6d2){return function(_0xd7278b){if(_0xd7278b){return _0xd7278b['destroy']()['then'](function(){_0x318eb2[_0xf88f('0x29')](0xcc)[_0xf88f('0x2a')]();});}};}function handleEntityNotFound(_0x265065,_0x58868c){return function(_0x244907){if(!_0x244907){_0x265065[_0xf88f('0x28')](0x194);}return _0x244907;};}function handleError(_0x2fbd3e,_0x2bee12){_0x2bee12=_0x2bee12||0x1f4;return function(_0x2b741d){logger[_0xf88f('0x24')](_0x2b741d['stack']);if(_0x2b741d['name']){delete _0x2b741d[_0xf88f('0x35')];}_0x2fbd3e[_0xf88f('0x29')](_0x2bee12)[_0xf88f('0x36')](_0x2b741d);};}exports[_0xf88f('0x37')]=function(_0x138cc4,_0x5d4628){var _0x417007={},_0x50af98={},_0x3bff87={'count':0x0,'rows':[]};var _0x1819ce=_[_0xf88f('0x38')](db[_0xf88f('0x39')][_0xf88f('0x3a')],function(_0x5e3dea){return{'name':_0x5e3dea[_0xf88f('0x3b')],'type':_0x5e3dea['type'][_0xf88f('0x3c')]};});_0x50af98[_0xf88f('0x3d')]=_[_0xf88f('0x38')](_0x1819ce,_0xf88f('0x35'));_0x50af98['query']=_[_0xf88f('0x3e')](_0x138cc4[_0xf88f('0x3f')]);_0x50af98['filters']=_['intersection'](_0x50af98[_0xf88f('0x3d')],_0x50af98[_0xf88f('0x3f')]);_0x417007[_0xf88f('0x40')]=_[_0xf88f('0x41')](_0x50af98[_0xf88f('0x3d')],qs[_0xf88f('0x42')](_0x138cc4[_0xf88f('0x3f')][_0xf88f('0x42')]));_0x417007[_0xf88f('0x40')]=_0x417007[_0xf88f('0x40')][_0xf88f('0x43')]?_0x417007[_0xf88f('0x40')]:_0x50af98[_0xf88f('0x3d')];if(!_0x138cc4['query'][_0xf88f('0x44')](_0xf88f('0x45'))){_0x417007[_0xf88f('0x2e')]=qs[_0xf88f('0x2e')](_0x138cc4[_0xf88f('0x3f')][_0xf88f('0x2e')]);_0x417007['offset']=qs[_0xf88f('0x2c')](_0x138cc4[_0xf88f('0x3f')][_0xf88f('0x2c')]);}_0x417007['order']=qs[_0xf88f('0x46')](_0x138cc4[_0xf88f('0x3f')][_0xf88f('0x46')]);_0x417007[_0xf88f('0x47')]=qs['filters'](_[_0xf88f('0x48')](_0x138cc4[_0xf88f('0x3f')],_0x50af98[_0xf88f('0x49')]),_0x1819ce);if(_0x138cc4['query'][_0xf88f('0x4a')]){_0x417007[_0xf88f('0x47')]=_[_0xf88f('0x4b')](_0x417007[_0xf88f('0x47')],{'$or':_[_0xf88f('0x38')](_0x1819ce,function(_0x52765e){if(_0x52765e[_0xf88f('0x4c')]!=='VIRTUAL'){var _0x5f2070={};_0x5f2070[_0x52765e['name']]={'$like':'%'+_0x138cc4[_0xf88f('0x3f')][_0xf88f('0x4a')]+'%'};return _0x5f2070;}})});}_0x417007=_[_0xf88f('0x4b')]({},_0x417007,_0x138cc4['options']);var _0x4ff9a4={'where':_0x417007[_0xf88f('0x47')]};return db[_0xf88f('0x39')][_0xf88f('0x2f')](_0x4ff9a4)[_0xf88f('0x1f')](function(_0x26a845){_0x3bff87[_0xf88f('0x2f')]=_0x26a845;if(_0x138cc4[_0xf88f('0x3f')][_0xf88f('0x4d')]){_0x417007[_0xf88f('0x4e')]=[{'all':!![]}];}return db[_0xf88f('0x39')][_0xf88f('0x4f')](_0x417007);})[_0xf88f('0x1f')](function(_0x4b632f){_0x3bff87[_0xf88f('0x50')]=_0x4b632f;return _0x3bff87;})['then'](respondWithFilteredResult(_0x5d4628,_0x417007))[_0xf88f('0x27')](handleError(_0x5d4628,null));};exports[_0xf88f('0x51')]=function(_0x45e744,_0x47aa6b){var _0x4f9f7b={'raw':!![],'where':{'id':_0x45e744['params']['id']}},_0x5de7ba={};_0x5de7ba[_0xf88f('0x3d')]=_[_0xf88f('0x3e')](db[_0xf88f('0x39')][_0xf88f('0x3a')]);_0x5de7ba['query']=_[_0xf88f('0x3e')](_0x45e744[_0xf88f('0x3f')]);_0x5de7ba['filters']=_[_0xf88f('0x41')](_0x5de7ba[_0xf88f('0x3d')],_0x5de7ba[_0xf88f('0x3f')]);_0x4f9f7b[_0xf88f('0x40')]=_[_0xf88f('0x41')](_0x5de7ba['model'],qs[_0xf88f('0x42')](_0x45e744[_0xf88f('0x3f')]['fields']));_0x4f9f7b[_0xf88f('0x40')]=_0x4f9f7b[_0xf88f('0x40')][_0xf88f('0x43')]?_0x4f9f7b['attributes']:_0x5de7ba[_0xf88f('0x3d')];if(_0x45e744[_0xf88f('0x3f')][_0xf88f('0x4d')]){_0x4f9f7b['include']=[{'all':!![]}];}_0x4f9f7b=_[_0xf88f('0x4b')]({},_0x4f9f7b,_0x45e744[_0xf88f('0x52')]);return db['WhatsappMessage']['find'](_0x4f9f7b)[_0xf88f('0x1f')](handleEntityNotFound(_0x47aa6b,null))[_0xf88f('0x1f')](respondWithResult(_0x47aa6b,null))[_0xf88f('0x27')](handleError(_0x47aa6b,null));};exports[_0xf88f('0x53')]=function(_0x2158b1,_0x36fb15){return db[_0xf88f('0x39')][_0xf88f('0x53')](_0x2158b1[_0xf88f('0x54')],{})['then'](respondWithResult(_0x36fb15,0xc9))[_0xf88f('0x27')](handleError(_0x36fb15,null));};exports[_0xf88f('0x55')]=function(_0x2c259a,_0x2347e2){if(_0x2c259a['body']['id']){delete _0x2c259a[_0xf88f('0x54')]['id'];}return db['WhatsappMessage'][_0xf88f('0x56')]({'where':{'id':_0x2c259a[_0xf88f('0x57')]['id']}})[_0xf88f('0x1f')](handleEntityNotFound(_0x2347e2,null))[_0xf88f('0x1f')](saveUpdates(_0x2c259a['body'],null))[_0xf88f('0x1f')](respondWithResult(_0x2347e2,null))['catch'](handleError(_0x2347e2,null));};exports[_0xf88f('0x58')]=function(_0x58a267,_0x1cd005){return db[_0xf88f('0x39')]['find']({'where':{'id':_0x58a267[_0xf88f('0x57')]['id']}})[_0xf88f('0x1f')](handleEntityNotFound(_0x1cd005,null))[_0xf88f('0x1f')](removeEntity(_0x1cd005,null))[_0xf88f('0x27')](handleError(_0x1cd005,null));};exports[_0xf88f('0x59')]=function(_0x54ca85,_0xf0a0f4){return db['WhatsappMessage'][_0xf88f('0x59')]()[_0xf88f('0x1f')](respondWithResult(_0xf0a0f4,null))[_0xf88f('0x27')](handleError(_0xf0a0f4,null));};var interaction_log=require('../../config/logger')(_0xf88f('0x5a'));exports[_0xf88f('0x5b')]=function(_0x536f23,_0x9f0f57,_0x543967){var _0x241f19={'agent':{},'channel':_0xf88f('0x5c')};if(_0x536f23[_0xf88f('0x54')]['id']){delete _0x536f23[_0xf88f('0x54')]['id'];}_0x536f23[_0xf88f('0x54')][_0xf88f('0x5d')]=!![];_0x536f23[_0xf88f('0x54')]['readAt']=moment()['format'](_0xf88f('0x5e'));_0x536f23[_0xf88f('0x54')][_0xf88f('0x5f')]=_0x536f23['body'][_0xf88f('0x5f')]||_0x536f23['user']['id'];_0x241f19[_0xf88f('0x60')]['id']=_0x536f23[_0xf88f('0x54')]['UserId'];return db[_0xf88f('0x39')][_0xf88f('0x56')]({'where':{'id':_0x536f23[_0xf88f('0x57')]['id'],'UserId':null}})[_0xf88f('0x1f')](handleEntityNotFound(_0x9f0f57,null))[_0xf88f('0x1f')](saveUpdates(_0x536f23['body'],null))['then'](function(_0x4b6be4){if(_0x4b6be4){_0x241f19[_0xf88f('0x25')]=_0x4b6be4[_0xf88f('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0xf88f('0x56')]({'where':{'id':_0x4b6be4[_0xf88f('0x62')]}});}return null;})[_0xf88f('0x1f')](handleEntityNotFound(_0x9f0f57,null))[_0xf88f('0x1f')](function(_0xcb1801){if(_0xcb1801){return _0xcb1801['update']({'UserId':_0x536f23[_0xf88f('0x54')][_0xf88f('0x5f')],'read1stAt':_[_0xf88f('0x63')](_0xcb1801[_0xf88f('0x64')])?moment()[_0xf88f('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf88f('0x1f')](function(_0x495dfc){if(_0x495dfc){_0x241f19['interaction']=_0x495dfc[_0xf88f('0x61')]({'plain':!![]});interaction_log[_0xf88f('0x20')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x536f23[_0xf88f('0x66')]['id'],_0x536f23[_0xf88f('0x66')]['name'],_0x536f23[_0xf88f('0x66')][_0xf88f('0x67')],_0x241f19[_0xf88f('0x68')]['id'],_0x536f23[_0xf88f('0x54')]?JSON[_0xf88f('0x69')](_0x536f23[_0xf88f('0x54')]):_0xf88f('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xf88f('0x6b'),_0x241f19);}return null;})[_0xf88f('0x1f')](function(_0x2efe7f){var _0x4e9876='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2efe7f['message'][_0xf88f('0x6c')];return db[_0xf88f('0x6d')]['query'](_0x4e9876,{'type':db[_0xf88f('0x6e')][_0xf88f('0x6f')][_0xf88f('0x70')],'raw':!![]})['then'](function(_0x4885b8){return _0x4885b8;});})[_0xf88f('0x1f')](function(_0x128198){if(_0x128198){_0x241f19[_0xf88f('0x25')][_0xf88f('0x71')]=_0x128198[0x0];if(!_0x536f23[_0xf88f('0x54')][_0xf88f('0x5f')])return;return db[_0xf88f('0x72')][_0xf88f('0x56')]({'where':{'id':_0x536f23[_0xf88f('0x54')][_0xf88f('0x5f')],'role':'agent'},'attributes':['id',_0xf88f('0x35'),'fullname',_0xf88f('0x73'),_0xf88f('0x74')],'raw':!![]});}return null;})[_0xf88f('0x1f')](function(_0x542ceb){if(!_0x542ceb)return null;_0x241f19[_0xf88f('0x25')]['agent']=_0x542ceb;return _0x241f19;})[_0xf88f('0x1f')](function(_0x4b9cbe){if(_0x4b9cbe){if(_0x536f23[_0xf88f('0x54')][_0xf88f('0x75')]){_0x241f19[_0xf88f('0x25')][_0xf88f('0x76')]=util['format']('SIP/%s',_0x536f23[_0xf88f('0x66')][_0xf88f('0x35')]);_0x241f19['message'][_0xf88f('0x77')]=_0x241f19[_0xf88f('0x77')];_0x241f19[_0xf88f('0x25')][_0xf88f('0x78')]='accept';return respondWithRpcPromise(_0xf88f('0x79'),_0xf88f('0x79'),{'event':_0xf88f('0x7a'),'message':_0x241f19['message']},client9002)[_0xf88f('0x1f')](function(){return _0x241f19;});}return _0x241f19;}return null;})['then'](respondWithResult(_0x9f0f57,null))[_0xf88f('0x27')](handleError(_0x9f0f57,null));};var interaction_log=require('../../config/logger')(_0xf88f('0x5a'));exports[_0xf88f('0x33')]=function(_0x22a337,_0x4e641,_0x17fe13){var _0x2cdbdf={'agent':{},'channel':_0xf88f('0x5c')};if(_0x22a337['body']['id']){delete _0x22a337[_0xf88f('0x54')]['id'];}_0x22a337['body'][_0xf88f('0x5f')]=_0x22a337[_0xf88f('0x54')]['UserId']||_0x22a337[_0xf88f('0x66')]['id'];_0x2cdbdf[_0xf88f('0x60')]['id']=_0x22a337['body'][_0xf88f('0x5f')];return db[_0xf88f('0x39')][_0xf88f('0x56')]({'where':{'id':_0x22a337[_0xf88f('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4e641,null))['then'](function(_0xb4c97){if(_0xb4c97){_0x2cdbdf[_0xf88f('0x25')]=_0xb4c97[_0xf88f('0x61')]({'plain':!![]});return db[_0xf88f('0x7b')]['find']({'where':{'id':_0xb4c97[_0xf88f('0x62')]}});}return null;})[_0xf88f('0x1f')](handleEntityNotFound(_0x4e641,null))[_0xf88f('0x1f')](function(_0x2152be){if(_0x2152be){_0x2cdbdf[_0xf88f('0x68')]=_0x2152be[_0xf88f('0x61')]({'plain':!![]});interaction_log[_0xf88f('0x20')](_0xf88f('0x7c'),_0x22a337[_0xf88f('0x66')]['id'],_0x22a337[_0xf88f('0x66')][_0xf88f('0x35')],_0x22a337[_0xf88f('0x66')][_0xf88f('0x67')],_0x2cdbdf[_0xf88f('0x68')]['id'],_0x22a337['body']?JSON[_0xf88f('0x69')](_0x22a337['body']):_0xf88f('0x6a'));return respondWithRpcPromise('RejectMessage',_0xf88f('0x7d'),_0x2cdbdf);}return null;})[_0xf88f('0x1f')](function(_0x1f29bd){var _0x308e1a=_0xf88f('0x7e')+_0x1f29bd[_0xf88f('0x25')]['ContactId'];return db[_0xf88f('0x6d')][_0xf88f('0x3f')](_0x308e1a,{'type':db[_0xf88f('0x6e')][_0xf88f('0x6f')][_0xf88f('0x70')],'raw':!![]})[_0xf88f('0x1f')](function(_0xc0c81d){return _0xc0c81d;});})['then'](function(_0x33bad3){if(_0x33bad3){_0x2cdbdf[_0xf88f('0x25')][_0xf88f('0x71')]=_0x33bad3[0x0];if(!_0x22a337[_0xf88f('0x54')][_0xf88f('0x5f')])return;return db[_0xf88f('0x72')][_0xf88f('0x56')]({'where':{'id':_0x22a337['body']['UserId'],'role':_0xf88f('0x60')},'attributes':['id',_0xf88f('0x35'),_0xf88f('0x7f'),'email',_0xf88f('0x74')],'raw':!![]});}return null;})[_0xf88f('0x1f')](function(_0xdb5850){if(!_0xdb5850)return null;_0x2cdbdf[_0xf88f('0x25')][_0xf88f('0x60')]=_0xdb5850;return _0x2cdbdf;})[_0xf88f('0x1f')](function(_0x4847e6){if(_0x4847e6){_0x4847e6[_0xf88f('0x25')]['interface']=util[_0xf88f('0x65')](_0xf88f('0x80'),_0x22a337['user']['name']);_0x4847e6['message'][_0xf88f('0x77')]=_0x2cdbdf['channel'];_0x4847e6['message'][_0xf88f('0x78')]='reject';respondWithRpcPromise(_0xf88f('0x79'),_0xf88f('0x79'),{'event':'rejectmessage','message':_0x4847e6[_0xf88f('0x25')]},client9002);return _0x2cdbdf;}return null;})[_0xf88f('0x1f')](respondWithResult(_0x4e641,null))[_0xf88f('0x27')](handleError(_0x4e641,null));};exports[_0xf88f('0x29')]=function(_0x562052,_0x5831b9,_0x45a9af){if(_0x562052['body']['id']){delete _0x562052[_0xf88f('0x54')]['id'];}var _0x1f2daa;return db[_0xf88f('0x39')]['find']({'where':{'id':_0x562052[_0xf88f('0x57')]['id']}})[_0xf88f('0x1f')](handleEntityNotFound(_0x5831b9,null))['then'](function(_0x1bc2cd){if(_0x1bc2cd){_0x1f2daa=_0x1bc2cd;return db[_0xf88f('0x81')][_0xf88f('0x56')]({'where':{'id':_0x1bc2cd[_0xf88f('0x82')]}});}})['then'](handleEntityNotFound(_0x5831b9,null))[_0xf88f('0x1f')](function(_0x31d79e){if(_0x31d79e){logger[_0xf88f('0x22')](_0xf88f('0x83'),_0xf88f('0x29'),'received\x20delivery\x20report\x20from',_0x31d79e[_0xf88f('0x4c')],util[_0xf88f('0x84')](_0x562052[_0xf88f('0x54')],{'showHidden':![],'depth':null}));switch(_0x31d79e['type']){case _0xf88f('0x85'):if(_0x562052[_0xf88f('0x54')][_0xf88f('0x86')]&&_0x562052['body'][_0xf88f('0x86')]===_0x1f2daa[_0xf88f('0x87')]&&_0x562052[_0xf88f('0x54')]['MessageStatus']&&_0x562052[_0xf88f('0x54')][_0xf88f('0x88')]===_0xf88f('0x5d')){return _0x1f2daa[_0xf88f('0x55')]({'read':!![]});}else{logger['error'](_0xf88f('0x89'),'status',_0xf88f('0x85'),util[_0xf88f('0x84')](_0x562052[_0xf88f('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x1f2daa;}})[_0xf88f('0x1f')](respondWithResult(_0x5831b9,null))[_0xf88f('0x27')](handleError(_0x5831b9,null));}; \ No newline at end of file +var _0x792a=['set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','WhatsappMessage','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','describe','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','event','acceptmessage','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','zip-dir','fast-json-patch','request-promise','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','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','info','request\x20sent','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x792a,0xe8));var _0xa792=function(_0x1c1385,_0x3f0bf4){_0x1c1385=_0x1c1385-0x0;var _0x381291=_0x792a[_0x1c1385];return _0x381291;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa792('0x0'));var jsonpatch=require(_0xa792('0x1'));var rp=require(_0xa792('0x2'));var moment=require('moment');var BPromise=require(_0xa792('0x3'));var Mustache=require(_0xa792('0x4'));var util=require(_0xa792('0x5'));var path=require(_0xa792('0x6'));var sox=require(_0xa792('0x7'));var csv=require(_0xa792('0x8'));var ejs=require(_0xa792('0x9'));var fs=require('fs');var fs_extra=require(_0xa792('0xa'));var _=require(_0xa792('0xb'));var squel=require(_0xa792('0xc'));var crypto=require('crypto');var jsforce=require(_0xa792('0xd'));var deskjs=require(_0xa792('0xe'));var toCsv=require(_0xa792('0x8'));var querystring=require(_0xa792('0xf'));var Papa=require(_0xa792('0x10'));var Redis=require(_0xa792('0x11'));var authService=require(_0xa792('0x12'));var qs=require(_0xa792('0x13'));var as=require(_0xa792('0x14'));var hardwareService=require(_0xa792('0x15'));var logger=require(_0xa792('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xa792('0x17'));var licenseUtil=require(_0xa792('0x18'));var db=require('../../mysqldb')['db'];config[_0xa792('0x19')]=_[_0xa792('0x1a')](config[_0xa792('0x19')],{'host':_0xa792('0x1b'),'port':0x18eb});var socket=require(_0xa792('0x1c'))(new Redis(config[_0xa792('0x19')]));require(_0xa792('0x1d'))[_0xa792('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa792('0x1f')][_0xa792('0x20')]({'port':0x232c});var client9002=jayson[_0xa792('0x1f')][_0xa792('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1894ed,_0x30b539,_0x2fdc3c,_0x1f844e){return new BPromise(function(_0x50209e,_0x1ec395){var _0x189f7d=_0x1f844e||client;return _0x189f7d['request'](_0x1894ed,_0x2fdc3c)['then'](function(_0x1e0cf2){logger[_0xa792('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x30b539,_0xa792('0x22'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x30b539,'request\x20sent',JSON[_0xa792('0x23')](_0x1e0cf2));if(_0x1e0cf2['error']){if(_0x1e0cf2[_0xa792('0x24')][_0xa792('0x25')]===0x1f4){logger[_0xa792('0x24')](_0xa792('0x26'),_0x30b539,_0x1e0cf2[_0xa792('0x24')]['message']);return _0x1ec395(_0x1e0cf2[_0xa792('0x24')]['message']);}logger[_0xa792('0x24')](_0xa792('0x26'),_0x30b539,_0x1e0cf2['error']['message']);return _0x50209e(_0x1e0cf2[_0xa792('0x24')][_0xa792('0x27')]);}else{logger[_0xa792('0x21')](_0xa792('0x26'),_0x30b539,_0xa792('0x22'));_0x50209e(_0x1e0cf2[_0xa792('0x28')]['message']);}})[_0xa792('0x29')](function(_0x12c80f){logger[_0xa792('0x24')](_0xa792('0x26'),_0x30b539,_0x12c80f);_0x1ec395(_0x12c80f);});});}function respondWithStatusCode(_0x5cc143,_0x34b8de){_0x34b8de=_0x34b8de||0xcc;return function(_0x4bc06c){if(_0x4bc06c){return _0x5cc143[_0xa792('0x2a')](_0x34b8de);}return _0x5cc143['status'](_0x34b8de)[_0xa792('0x2b')]();};}function respondWithResult(_0x2f0be7,_0xe6d13c){_0xe6d13c=_0xe6d13c||0xc8;return function(_0x38d701){if(_0x38d701){return _0x2f0be7[_0xa792('0x2c')](_0xe6d13c)[_0xa792('0x2d')](_0x38d701);}};}function respondWithFilteredResult(_0x42884c,_0x47f2fb){return function(_0x2b0610){if(_0x2b0610){var _0x4e11e9=typeof _0x47f2fb[_0xa792('0x2e')]===_0xa792('0x2f')&&typeof _0x47f2fb[_0xa792('0x30')]===_0xa792('0x2f');var _0x11a399=_0x2b0610[_0xa792('0x31')];var _0x23fb12=_0x4e11e9?0x0:_0x47f2fb['offset'];var _0x470f22=_0x4e11e9?_0x2b0610[_0xa792('0x31')]:_0x47f2fb[_0xa792('0x2e')]+_0x47f2fb['limit'];var _0x21b407;if(_0x470f22>=_0x11a399){_0x470f22=_0x11a399;_0x21b407=0xc8;}else{_0x21b407=0xce;}_0x42884c['status'](_0x21b407);return _0x42884c[_0xa792('0x32')](_0xa792('0x33'),_0x23fb12+'-'+_0x470f22+'/'+_0x11a399)[_0xa792('0x2d')](_0x2b0610);}return null;};}function patchUpdates(_0x2f7f43){return function(_0x14d948){try{jsonpatch[_0xa792('0x34')](_0x14d948,_0x2f7f43,!![]);}catch(_0x188941){return BPromise[_0xa792('0x35')](_0x188941);}return _0x14d948[_0xa792('0x36')]();};}function saveUpdates(_0x2f271b,_0x283e63){return function(_0x420f17){if(_0x420f17){return _0x420f17[_0xa792('0x37')](_0x2f271b)[_0xa792('0x38')](function(_0x8b387a){return _0x8b387a;});}return null;};}function removeEntity(_0xc6eceb,_0x361a45){return function(_0x138b1a){if(_0x138b1a){return _0x138b1a[_0xa792('0x39')]()[_0xa792('0x38')](function(){_0xc6eceb[_0xa792('0x2c')](0xcc)[_0xa792('0x2b')]();});}};}function handleEntityNotFound(_0x55c909,_0x59175a){return function(_0x38c843){if(!_0x38c843){_0x55c909[_0xa792('0x2a')](0x194);}return _0x38c843;};}function handleError(_0x53fc1d,_0x137a5d){_0x137a5d=_0x137a5d||0x1f4;return function(_0xa1cb64){logger[_0xa792('0x24')](_0xa1cb64[_0xa792('0x3a')]);if(_0xa1cb64[_0xa792('0x3b')]){delete _0xa1cb64[_0xa792('0x3b')];}_0x53fc1d[_0xa792('0x2c')](_0x137a5d)[_0xa792('0x3c')](_0xa1cb64);};}exports[_0xa792('0x3d')]=function(_0x370394,_0x327ad6){var _0x2c6567={},_0x341343={},_0x54f21d={'count':0x0,'rows':[]};var _0x490aba=_['map'](db[_0xa792('0x3e')][_0xa792('0x3f')],function(_0x503e1d){return{'name':_0x503e1d['fieldName'],'type':_0x503e1d['type'][_0xa792('0x40')]};});_0x341343[_0xa792('0x41')]=_['map'](_0x490aba,_0xa792('0x3b'));_0x341343[_0xa792('0x42')]=_[_0xa792('0x43')](_0x370394[_0xa792('0x42')]);_0x341343[_0xa792('0x44')]=_[_0xa792('0x45')](_0x341343[_0xa792('0x41')],_0x341343[_0xa792('0x42')]);_0x2c6567[_0xa792('0x46')]=_['intersection'](_0x341343['model'],qs[_0xa792('0x47')](_0x370394[_0xa792('0x42')][_0xa792('0x47')]));_0x2c6567[_0xa792('0x46')]=_0x2c6567[_0xa792('0x46')][_0xa792('0x48')]?_0x2c6567[_0xa792('0x46')]:_0x341343[_0xa792('0x41')];if(!_0x370394[_0xa792('0x42')][_0xa792('0x49')]('nolimit')){_0x2c6567[_0xa792('0x30')]=qs[_0xa792('0x30')](_0x370394[_0xa792('0x42')][_0xa792('0x30')]);_0x2c6567[_0xa792('0x2e')]=qs[_0xa792('0x2e')](_0x370394[_0xa792('0x42')][_0xa792('0x2e')]);}_0x2c6567[_0xa792('0x4a')]=qs[_0xa792('0x4b')](_0x370394['query'][_0xa792('0x4b')]);_0x2c6567[_0xa792('0x4c')]=qs[_0xa792('0x44')](_[_0xa792('0x4d')](_0x370394[_0xa792('0x42')],_0x341343['filters']),_0x490aba);if(_0x370394['query'][_0xa792('0x4e')]){_0x2c6567[_0xa792('0x4c')]=_[_0xa792('0x4f')](_0x2c6567['where'],{'$or':_[_0xa792('0x50')](_0x490aba,function(_0x1f9235){if(_0x1f9235[_0xa792('0x51')]!==_0xa792('0x52')){var _0x3b327f={};_0x3b327f[_0x1f9235[_0xa792('0x3b')]]={'$like':'%'+_0x370394[_0xa792('0x42')]['filter']+'%'};return _0x3b327f;}})});}_0x2c6567=_[_0xa792('0x4f')]({},_0x2c6567,_0x370394[_0xa792('0x53')]);var _0xe685d2={'where':_0x2c6567[_0xa792('0x4c')]};return db[_0xa792('0x3e')][_0xa792('0x31')](_0xe685d2)[_0xa792('0x38')](function(_0x5ceba5){_0x54f21d['count']=_0x5ceba5;if(_0x370394['query'][_0xa792('0x54')]){_0x2c6567[_0xa792('0x55')]=[{'all':!![]}];}return db[_0xa792('0x3e')]['findAll'](_0x2c6567);})[_0xa792('0x38')](function(_0x50a995){_0x54f21d[_0xa792('0x56')]=_0x50a995;return _0x54f21d;})['then'](respondWithFilteredResult(_0x327ad6,_0x2c6567))[_0xa792('0x29')](handleError(_0x327ad6,null));};exports[_0xa792('0x57')]=function(_0x1f8c1d,_0x4f288b){var _0x496a4d={'raw':!![],'where':{'id':_0x1f8c1d[_0xa792('0x58')]['id']}},_0x123121={};_0x123121[_0xa792('0x41')]=_[_0xa792('0x43')](db[_0xa792('0x3e')][_0xa792('0x3f')]);_0x123121['query']=_['keys'](_0x1f8c1d['query']);_0x123121[_0xa792('0x44')]=_[_0xa792('0x45')](_0x123121[_0xa792('0x41')],_0x123121[_0xa792('0x42')]);_0x496a4d[_0xa792('0x46')]=_[_0xa792('0x45')](_0x123121[_0xa792('0x41')],qs[_0xa792('0x47')](_0x1f8c1d[_0xa792('0x42')][_0xa792('0x47')]));_0x496a4d[_0xa792('0x46')]=_0x496a4d['attributes'][_0xa792('0x48')]?_0x496a4d['attributes']:_0x123121['model'];if(_0x1f8c1d[_0xa792('0x42')]['includeAll']){_0x496a4d[_0xa792('0x55')]=[{'all':!![]}];}_0x496a4d=_['merge']({},_0x496a4d,_0x1f8c1d[_0xa792('0x53')]);return db[_0xa792('0x3e')][_0xa792('0x59')](_0x496a4d)[_0xa792('0x38')](handleEntityNotFound(_0x4f288b,null))[_0xa792('0x38')](respondWithResult(_0x4f288b,null))[_0xa792('0x29')](handleError(_0x4f288b,null));};exports['create']=function(_0x33a8aa,_0x589ba3){return db['WhatsappMessage'][_0xa792('0x5a')](_0x33a8aa[_0xa792('0x5b')],{})['then'](respondWithResult(_0x589ba3,0xc9))[_0xa792('0x29')](handleError(_0x589ba3,null));};exports['update']=function(_0x2b3522,_0x167145){if(_0x2b3522[_0xa792('0x5b')]['id']){delete _0x2b3522[_0xa792('0x5b')]['id'];}return db['WhatsappMessage'][_0xa792('0x59')]({'where':{'id':_0x2b3522['params']['id']}})[_0xa792('0x38')](handleEntityNotFound(_0x167145,null))[_0xa792('0x38')](saveUpdates(_0x2b3522[_0xa792('0x5b')],null))['then'](respondWithResult(_0x167145,null))['catch'](handleError(_0x167145,null));};exports[_0xa792('0x39')]=function(_0x501088,_0x404a6a){return db[_0xa792('0x3e')]['find']({'where':{'id':_0x501088[_0xa792('0x58')]['id']}})['then'](handleEntityNotFound(_0x404a6a,null))['then'](removeEntity(_0x404a6a,null))[_0xa792('0x29')](handleError(_0x404a6a,null));};exports[_0xa792('0x5c')]=function(_0x5a2789,_0x539d37){return db[_0xa792('0x3e')][_0xa792('0x5c')]()[_0xa792('0x38')](respondWithResult(_0x539d37,null))[_0xa792('0x29')](handleError(_0x539d37,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0xa792('0x5d')]=function(_0x4cb9bb,_0x2c1369,_0x3e6731){var _0xb63128={'agent':{},'channel':_0xa792('0x5e')};if(_0x4cb9bb[_0xa792('0x5b')]['id']){delete _0x4cb9bb[_0xa792('0x5b')]['id'];}_0x4cb9bb[_0xa792('0x5b')][_0xa792('0x5f')]=!![];_0x4cb9bb[_0xa792('0x5b')]['readAt']=moment()[_0xa792('0x60')](_0xa792('0x61'));_0x4cb9bb['body'][_0xa792('0x62')]=_0x4cb9bb[_0xa792('0x5b')][_0xa792('0x62')]||_0x4cb9bb[_0xa792('0x63')]['id'];_0xb63128[_0xa792('0x64')]['id']=_0x4cb9bb[_0xa792('0x5b')][_0xa792('0x62')];return db[_0xa792('0x3e')]['find']({'where':{'id':_0x4cb9bb[_0xa792('0x58')]['id'],'UserId':null}})[_0xa792('0x38')](handleEntityNotFound(_0x2c1369,null))[_0xa792('0x38')](saveUpdates(_0x4cb9bb[_0xa792('0x5b')],null))[_0xa792('0x38')](function(_0x54bd01){if(_0x54bd01){_0xb63128['message']=_0x54bd01[_0xa792('0x65')]({'plain':!![]});return db[_0xa792('0x66')][_0xa792('0x59')]({'where':{'id':_0x54bd01['WhatsappInteractionId']}});}return null;})[_0xa792('0x38')](handleEntityNotFound(_0x2c1369,null))[_0xa792('0x38')](function(_0x1f08cf){if(_0x1f08cf){return _0x1f08cf[_0xa792('0x37')]({'UserId':_0x4cb9bb[_0xa792('0x5b')][_0xa792('0x62')],'read1stAt':_[_0xa792('0x67')](_0x1f08cf[_0xa792('0x68')])?moment()[_0xa792('0x60')](_0xa792('0x61')):undefined});}return null;})[_0xa792('0x38')](function(_0x321604){if(_0x321604){_0xb63128['interaction']=_0x321604['get']({'plain':!![]});interaction_log[_0xa792('0x21')](_0xa792('0x69'),_0x4cb9bb['user']['id'],_0x4cb9bb[_0xa792('0x63')][_0xa792('0x3b')],_0x4cb9bb['user'][_0xa792('0x6a')],_0xb63128[_0xa792('0x6b')]['id'],_0x4cb9bb[_0xa792('0x5b')]?JSON[_0xa792('0x23')](_0x4cb9bb[_0xa792('0x5b')]):_0xa792('0x6c'));return respondWithRpcPromise(_0xa792('0x6d'),'acceptMessage',_0xb63128);}return null;})[_0xa792('0x38')](function(_0x4597f6){var _0x322637=_0xa792('0x6e')+_0x4597f6[_0xa792('0x27')][_0xa792('0x6f')];return db[_0xa792('0x70')][_0xa792('0x42')](_0x322637,{'type':db['Sequelize'][_0xa792('0x71')][_0xa792('0x72')],'raw':!![]})[_0xa792('0x38')](function(_0x2219af){return _0x2219af;});})[_0xa792('0x38')](function(_0x31c37e){if(_0x31c37e){_0xb63128[_0xa792('0x27')][_0xa792('0x73')]=_0x31c37e[0x0];if(!_0x4cb9bb[_0xa792('0x5b')][_0xa792('0x62')])return;return db['User'][_0xa792('0x59')]({'where':{'id':_0x4cb9bb[_0xa792('0x5b')][_0xa792('0x62')],'role':'agent'},'attributes':['id','name',_0xa792('0x74'),_0xa792('0x75'),_0xa792('0x76')],'raw':!![]});}return null;})[_0xa792('0x38')](function(_0x4038cc){if(!_0x4038cc)return null;_0xb63128[_0xa792('0x27')]['agent']=_0x4038cc;return _0xb63128;})['then'](function(_0x1a5d5b){if(_0x1a5d5b){if(_0x4cb9bb[_0xa792('0x5b')][_0xa792('0x77')]){_0xb63128['message']['interface']=util['format'](_0xa792('0x78'),_0x4cb9bb[_0xa792('0x63')][_0xa792('0x3b')]);_0xb63128[_0xa792('0x27')][_0xa792('0x79')]=_0xb63128[_0xa792('0x79')];_0xb63128[_0xa792('0x27')][_0xa792('0x7a')]=_0xa792('0x5d');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xa792('0x7b'),'message':_0xb63128[_0xa792('0x27')]},client9002)[_0xa792('0x38')](function(){return _0xb63128;});}return _0xb63128;}return null;})[_0xa792('0x38')](respondWithResult(_0x2c1369,null))[_0xa792('0x29')](handleError(_0x2c1369,null));};var interaction_log=require(_0xa792('0x16'))('whatsapp-interactions');exports[_0xa792('0x35')]=function(_0x5c4a58,_0x46b8ca,_0x2c6e3b){var _0x1e8095={'agent':{},'channel':_0xa792('0x5e')};if(_0x5c4a58[_0xa792('0x5b')]['id']){delete _0x5c4a58['body']['id'];}_0x5c4a58[_0xa792('0x5b')]['UserId']=_0x5c4a58['body'][_0xa792('0x62')]||_0x5c4a58[_0xa792('0x63')]['id'];_0x1e8095['agent']['id']=_0x5c4a58[_0xa792('0x5b')]['UserId'];return db[_0xa792('0x3e')][_0xa792('0x59')]({'where':{'id':_0x5c4a58[_0xa792('0x58')]['id'],'UserId':null}})[_0xa792('0x38')](handleEntityNotFound(_0x46b8ca,null))[_0xa792('0x38')](function(_0x26f211){if(_0x26f211){_0x1e8095[_0xa792('0x27')]=_0x26f211[_0xa792('0x65')]({'plain':!![]});return db[_0xa792('0x66')][_0xa792('0x59')]({'where':{'id':_0x26f211[_0xa792('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0x46b8ca,null))['then'](function(_0x4f2e8a){if(_0x4f2e8a){_0x1e8095[_0xa792('0x6b')]=_0x4f2e8a[_0xa792('0x65')]({'plain':!![]});interaction_log[_0xa792('0x21')](_0xa792('0x7d'),_0x5c4a58[_0xa792('0x63')]['id'],_0x5c4a58[_0xa792('0x63')][_0xa792('0x3b')],_0x5c4a58[_0xa792('0x63')]['role'],_0x1e8095['interaction']['id'],_0x5c4a58['body']?JSON['stringify'](_0x5c4a58[_0xa792('0x5b')]):_0xa792('0x6c'));return respondWithRpcPromise(_0xa792('0x7e'),_0xa792('0x7f'),_0x1e8095);}return null;})[_0xa792('0x38')](function(_0x37e210){var _0x4aa862=_0xa792('0x6e')+_0x37e210['message']['ContactId'];return db[_0xa792('0x70')][_0xa792('0x42')](_0x4aa862,{'type':db['Sequelize'][_0xa792('0x71')][_0xa792('0x72')],'raw':!![]})['then'](function(_0x1f407e){return _0x1f407e;});})['then'](function(_0x204923){if(_0x204923){_0x1e8095[_0xa792('0x27')]['contact']=_0x204923[0x0];if(!_0x5c4a58['body'][_0xa792('0x62')])return;return db['User'][_0xa792('0x59')]({'where':{'id':_0x5c4a58[_0xa792('0x5b')]['UserId'],'role':_0xa792('0x64')},'attributes':['id',_0xa792('0x3b'),'fullname','email',_0xa792('0x76')],'raw':!![]});}return null;})[_0xa792('0x38')](function(_0x37c0c6){if(!_0x37c0c6)return null;_0x1e8095[_0xa792('0x27')][_0xa792('0x64')]=_0x37c0c6;return _0x1e8095;})[_0xa792('0x38')](function(_0x587ff5){if(_0x587ff5){_0x587ff5[_0xa792('0x27')]['interface']=util['format'](_0xa792('0x78'),_0x5c4a58['user']['name']);_0x587ff5[_0xa792('0x27')][_0xa792('0x79')]=_0x1e8095[_0xa792('0x79')];_0x587ff5['message'][_0xa792('0x7a')]=_0xa792('0x35');respondWithRpcPromise(_0xa792('0x80'),'EventManager',{'event':_0xa792('0x81'),'message':_0x587ff5['message']},client9002);return _0x1e8095;}return null;})[_0xa792('0x38')](respondWithResult(_0x46b8ca,null))[_0xa792('0x29')](handleError(_0x46b8ca,null));};exports[_0xa792('0x2c')]=function(_0x30e555,_0x2692ae,_0x39f0d6){if(_0x30e555[_0xa792('0x5b')]['id']){delete _0x30e555['body']['id'];}var _0x150f58;return db[_0xa792('0x3e')][_0xa792('0x59')]({'where':{'id':_0x30e555[_0xa792('0x58')]['id']}})[_0xa792('0x38')](handleEntityNotFound(_0x2692ae,null))[_0xa792('0x38')](function(_0x303a29){if(_0x303a29){_0x150f58=_0x303a29;return db[_0xa792('0x82')][_0xa792('0x59')]({'where':{'id':_0x303a29[_0xa792('0x83')]}});}})[_0xa792('0x38')](handleEntityNotFound(_0x2692ae,null))[_0xa792('0x38')](function(_0x259517){if(_0x259517){logger[_0xa792('0x84')](_0xa792('0x85'),_0xa792('0x2c'),_0xa792('0x86'),_0x259517[_0xa792('0x51')],util[_0xa792('0x87')](_0x30e555[_0xa792('0x5b')],{'showHidden':![],'depth':null}));switch(_0x259517[_0xa792('0x51')]){case _0xa792('0x88'):if(_0x30e555[_0xa792('0x5b')][_0xa792('0x89')]&&_0x30e555[_0xa792('0x5b')]['MessageSid']===_0x150f58[_0xa792('0x8a')]&&_0x30e555['body'][_0xa792('0x8b')]&&_0x30e555['body']['MessageStatus']===_0xa792('0x5f')){return _0x150f58[_0xa792('0x37')]({'read':!![]});}else{logger[_0xa792('0x24')](_0xa792('0x8c'),'status',_0xa792('0x88'),util[_0xa792('0x87')](_0x30e555['body'],{'showHidden':![],'depth':null}));}break;}return _0x150f58;}})[_0xa792('0x38')](respondWithResult(_0x2692ae,null))['catch'](handleError(_0x2692ae,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index a51de22..04eb2bb 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 _0xd757=['setMaxListeners','remove','emit','hook','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x30441d,_0x38cd00){var _0x158e9c=function(_0x5f3bf5){while(--_0x5f3bf5){_0x30441d['push'](_0x30441d['shift']());}};_0x158e9c(++_0x38cd00);}(_0xd757,0x1e5));var _0x7d75=function(_0xb4062e,_0x422b04){_0xb4062e=_0xb4062e-0x0;var _0x5c9a6e=_0xd757[_0xb4062e];return _0x5c9a6e;};'use strict';var EventEmitter=require(_0x7d75('0x0'));var WhatsappMessage=require(_0x7d75('0x1'))['db'][_0x7d75('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x7d75('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7d75('0x4')};function emitEvent(_0x2772a3){return function(_0x5e4a4c,_0xa7df66,_0x10d11a){WhatsappMessageEvents[_0x7d75('0x5')](_0x2772a3+':'+_0x5e4a4c['id'],_0x5e4a4c);WhatsappMessageEvents['emit'](_0x2772a3,_0x5e4a4c);_0x10d11a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x7d75('0x6')](e,emitEvent(event));}}module[_0x7d75('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x1be1=['WhatsappMessage','setMaxListeners','update','remove','emit','hook'];(function(_0x1bc463,_0x35f2d0){var _0x5d6b79=function(_0x77f40b){while(--_0x77f40b){_0x1bc463['push'](_0x1bc463['shift']());}};_0x5d6b79(++_0x35f2d0);}(_0x1be1,0x192));var _0x11be=function(_0xb5f7fe,_0x24f5a1){_0xb5f7fe=_0xb5f7fe-0x0;var _0x428c24=_0x1be1[_0xb5f7fe];return _0x428c24;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0x11be('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x11be('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x11be('0x2'),'afterDestroy':_0x11be('0x3')};function emitEvent(_0x200b2a){return function(_0x318d41,_0x504d3a,_0x3ce56d){WhatsappMessageEvents[_0x11be('0x4')](_0x200b2a+':'+_0x318d41['id'],_0x318d41);WhatsappMessageEvents[_0x11be('0x4')](_0x200b2a,_0x318d41);_0x3ce56d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x11be('0x5')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index e0ddcad..018afb8 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 _0x6d94=['/status?token=','token','sid','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','direction','toLowerCase','secret','isNil','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','whatsapp:','/api/whatsapp/messages/'];(function(_0x23eb66,_0x2b1d4c){var _0x56d482=function(_0x228ba3){while(--_0x228ba3){_0x23eb66['push'](_0x23eb66['shift']());}};_0x56d482(++_0x2b1d4c);}(_0x6d94,0x14b));var _0x46d9=function(_0xfd1b5c,_0x4585d0){_0xfd1b5c=_0xfd1b5c-0x0;var _0x2e5407=_0x6d94[_0xfd1b5c];return _0x2e5407;};'use strict';var _=require(_0x46d9('0x0'));var util=require(_0x46d9('0x1'));var logger=require(_0x46d9('0x2'))(_0x46d9('0x3'));var moment=require(_0x46d9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x46d9('0x5'));var rimraf=require(_0x46d9('0x6'));var config=require(_0x46d9('0x7'));var attributes=require(_0x46d9('0x8'));module['exports']=function(_0x13e730,_0x574d34){return _0x13e730[_0x46d9('0x9')](_0x46d9('0xa'),attributes,{'tableName':_0x46d9('0xb'),'paranoid':![],'indexes':[{'name':_0x46d9('0xc'),'fields':[_0x46d9('0xc')]},{'name':_0x46d9('0xd'),'fields':[_0x46d9('0xe')],'type':_0x46d9('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x59730d,_0x5c586f,_0xacc4ae){var _0x3c41a8=_0x13e730['models'];var _0x2bd346=_0x59730d['get']({'plain':!![]});if(_0x2bd346[_0x46d9('0x10')][_0x46d9('0x11')]()==='in'||_0x2bd346[_0x46d9('0x10')][_0x46d9('0x11')]()==='out'&&!_0x2bd346[_0x46d9('0x12')]&&!_[_0x46d9('0x13')](_0x2bd346['UserId'])){_0x3c41a8['WhatsappInteraction'][_0x46d9('0x14')]({'where':{'id':_0x2bd346[_0x46d9('0x15')]}})[_0x46d9('0x16')](function(_0x1b5e88){if(_0x1b5e88){_0x1b5e88[_0x46d9('0x17')]({'lastMsgAt':_0x2bd346[_0x46d9('0x18')],'lastMsgDirection':_0x2bd346[_0x46d9('0x10')][_0x46d9('0x11')]()});}})[_0x46d9('0x19')](function(_0x2e42c0){console[_0x46d9('0x1a')](_0x2e42c0);});}if(_0x2bd346[_0x46d9('0x10')]==='out'&&!_0x2bd346[_0x46d9('0x12')]){var _0x422ae4;_0x3c41a8['WhatsappAccount'][_0x46d9('0x1b')]({'where':{'id':_0x2bd346[_0x46d9('0x1c')]},'raw':!![]})[_0x46d9('0x16')](function(_0x20f6b3){_0x422ae4=_0x20f6b3;if(_0x422ae4&&_0x422ae4[_0x46d9('0x1d')]){switch(_0x422ae4[_0x46d9('0x1d')]){case'twilio':var _0x225fed=require(_0x46d9('0x1e'));if(_0x422ae4[_0x46d9('0x1f')]&&_0x422ae4['authToken']&&_0x422ae4[_0x46d9('0x20')]){var _0x203398=new _0x225fed(_0x422ae4[_0x46d9('0x1f')],_0x422ae4[_0x46d9('0x21')]);_0x203398[_0x46d9('0x22')]['create']({'body':_0x2bd346['body'],'to':_0x46d9('0x23')+_0x2bd346['phone'],'from':_0x46d9('0x23')+_0x422ae4['phone'],'statusCallback':_0x422ae4['remote']+_0x46d9('0x24')+_0x2bd346['id']+_0x46d9('0x25')+_0x422ae4[_0x46d9('0x26')]})[_0x46d9('0x16')](function(_0x118ba3){if(_0x118ba3[_0x46d9('0x27')]){return _0x59730d[_0x46d9('0x17')]({'messageId':_0x118ba3[_0x46d9('0x27')]});}})['catch'](function(_0x3392d9){logger[_0x46d9('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',util[_0x46d9('0x28')](_0x3392d9,{'showHidden':![],'depth':null}));});}else{logger[_0x46d9('0x1a')](_0x46d9('0x29'),_0x46d9('0x2a'),_0x46d9('0x1e'),_0x46d9('0x2b'));}break;}}})[_0x46d9('0x2c')](function(){_0xacc4ae();});}else{_0xacc4ae();}}},'charset':'utf8mb4','collate':_0x46d9('0x2d')});}; \ No newline at end of file +var _0x5a38=['Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect'];(function(_0x391df0,_0x51b2dc){var _0x30bec6=function(_0x2899b1){while(--_0x2899b1){_0x391df0['push'](_0x391df0['shift']());}};_0x30bec6(++_0x51b2dc);}(_0x5a38,0xaf));var _0x85a3=function(_0x39eaa0,_0x2cea62){_0x39eaa0=_0x39eaa0-0x0;var _0x2402c5=_0x5a38[_0x39eaa0];return _0x2402c5;};'use strict';var _=require(_0x85a3('0x0'));var util=require(_0x85a3('0x1'));var logger=require(_0x85a3('0x2'))(_0x85a3('0x3'));var moment=require(_0x85a3('0x4'));var BPromise=require(_0x85a3('0x5'));var rp=require(_0x85a3('0x6'));var fs=require('fs');var path=require(_0x85a3('0x7'));var rimraf=require('rimraf');var config=require(_0x85a3('0x8'));var attributes=require(_0x85a3('0x9'));module[_0x85a3('0xa')]=function(_0x14a796,_0x381bc9){return _0x14a796[_0x85a3('0xb')](_0x85a3('0xc'),attributes,{'tableName':_0x85a3('0xd'),'paranoid':![],'indexes':[{'name':_0x85a3('0xe'),'fields':[_0x85a3('0xe')]},{'name':_0x85a3('0xf'),'fields':[_0x85a3('0x10')],'type':_0x85a3('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x21694f,_0x2caf5b,_0x239a3){var _0x359e90=_0x14a796[_0x85a3('0x12')];var _0x1f5b0d=_0x21694f[_0x85a3('0x13')]({'plain':!![]});if(_0x1f5b0d[_0x85a3('0x14')]['toLowerCase']()==='in'||_0x1f5b0d[_0x85a3('0x14')][_0x85a3('0x15')]()===_0x85a3('0x16')&&!_0x1f5b0d['secret']&&!_[_0x85a3('0x17')](_0x1f5b0d[_0x85a3('0x18')])){_0x359e90[_0x85a3('0x19')][_0x85a3('0x1a')]({'where':{'id':_0x1f5b0d[_0x85a3('0x1b')]}})[_0x85a3('0x1c')](function(_0x6d6ac4){if(_0x6d6ac4){_0x6d6ac4[_0x85a3('0x1d')]({'lastMsgAt':_0x1f5b0d[_0x85a3('0x1e')],'lastMsgDirection':_0x1f5b0d[_0x85a3('0x14')][_0x85a3('0x15')]()});}})[_0x85a3('0x1f')](function(_0x9f9003){console[_0x85a3('0x20')](_0x9f9003);});}if(_0x1f5b0d[_0x85a3('0x14')]===_0x85a3('0x16')&&!_0x1f5b0d[_0x85a3('0x21')]){var _0x30a289;_0x359e90[_0x85a3('0x22')][_0x85a3('0x23')]({'where':{'id':_0x1f5b0d[_0x85a3('0x24')]},'raw':!![]})['then'](function(_0x126802){_0x30a289=_0x126802;if(_0x30a289&&_0x30a289[_0x85a3('0x25')]){switch(_0x30a289[_0x85a3('0x25')]){case'twilio':var _0x7cbaf7=require(_0x85a3('0x26'));if(_0x30a289[_0x85a3('0x27')]&&_0x30a289[_0x85a3('0x28')]&&_0x30a289[_0x85a3('0x29')]){var _0x849b=new _0x7cbaf7(_0x30a289[_0x85a3('0x27')],_0x30a289[_0x85a3('0x28')]);_0x849b[_0x85a3('0x2a')][_0x85a3('0x2b')]({'body':_0x1f5b0d[_0x85a3('0x10')],'to':_0x85a3('0x2c')+_0x1f5b0d['phone'],'from':_0x85a3('0x2c')+_0x30a289[_0x85a3('0x29')],'statusCallback':_0x30a289[_0x85a3('0x2d')]+_0x85a3('0x2e')+_0x1f5b0d['id']+_0x85a3('0x2f')+_0x30a289[_0x85a3('0x30')]})[_0x85a3('0x1c')](function(_0x573226){if(_0x573226[_0x85a3('0x31')]){return _0x21694f[_0x85a3('0x1d')]({'messageId':_0x573226[_0x85a3('0x31')]});}})[_0x85a3('0x1f')](function(_0x3531de){logger[_0x85a3('0x20')](_0x85a3('0x32'),_0x85a3('0x33'),_0x85a3('0x26'),util[_0x85a3('0x34')](_0x3531de,{'showHidden':![],'depth':null}));});}else{logger[_0x85a3('0x20')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x85a3('0x26'),_0x85a3('0x35'));}break;}}})[_0x85a3('0x36')](function(){_0x239a3();});}else{_0x239a3();}}},'charset':_0x85a3('0x37'),'collate':_0x85a3('0x38')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 19f5ccc..a561fc1 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 _0xa29e=['socket.io-emitter','./whatsappMessage.socket','register','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','WhatsappMessage,\x20%s,\x20%s','result','WhatsappMessage','create','body','options','then','CreateWhatsappMessage','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost'];(function(_0x188945,_0x2aafa5){var _0x4959c2=function(_0x534f43){while(--_0x534f43){_0x188945['push'](_0x188945['shift']());}};_0x4959c2(++_0x2aafa5);}(_0xa29e,0x1d3));var _0xea29=function(_0x32a81f,_0x4eee66){_0x32a81f=_0x32a81f-0x0;var _0x5b67a2=_0xa29e[_0x32a81f];return _0x5b67a2;};'use strict';var _=require(_0xea29('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xea29('0x1'));var rs=require(_0xea29('0x2'));var fs=require('fs');var Redis=require(_0xea29('0x3'));var db=require(_0xea29('0x4'))['db'];var utils=require(_0xea29('0x5'));var logger=require(_0xea29('0x6'))(_0xea29('0x7'));var config=require(_0xea29('0x8'));var jayson=require(_0xea29('0x9'));var client=jayson['client'][_0xea29('0xa')]({'port':0x232a});config[_0xea29('0xb')]=_['defaults'](config[_0xea29('0xb')],{'host':_0xea29('0xc'),'port':0x18eb});var socket=require(_0xea29('0xd'))(new Redis(config[_0xea29('0xb')]));require(_0xea29('0xe'))[_0xea29('0xf')](socket);function respondWithRpcPromise(_0x1f98a3,_0x5a5f87,_0x29b3a7){return new BPromise(function(_0x1376d7,_0x455e3d){return client['request'](_0x1f98a3,_0x29b3a7)['then'](function(_0xa0dd68){logger[_0xea29('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x5a5f87,_0xea29('0x11'));logger['debug'](_0xea29('0x12'),_0x5a5f87,_0xea29('0x11'),JSON[_0xea29('0x13')](_0xa0dd68));if(_0xa0dd68['error']){if(_0xa0dd68['error'][_0xea29('0x14')]===0x1f4){logger[_0xea29('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x5a5f87,_0xa0dd68[_0xea29('0x15')][_0xea29('0x16')]);return _0x455e3d(_0xa0dd68[_0xea29('0x15')][_0xea29('0x16')]);}logger[_0xea29('0x15')](_0xea29('0x17'),_0x5a5f87,_0xa0dd68[_0xea29('0x15')][_0xea29('0x16')]);return _0x1376d7(_0xa0dd68[_0xea29('0x15')]['message']);}else{logger[_0xea29('0x10')](_0xea29('0x17'),_0x5a5f87,_0xea29('0x11'));_0x1376d7(_0xa0dd68[_0xea29('0x18')]['message']);}})['catch'](function(_0x3aa193){logger['error'](_0xea29('0x17'),_0x5a5f87,_0x3aa193);_0x455e3d(_0x3aa193);});});}exports['CreateWhatsappMessage']=function(_0x57ed17){var _0x2b4601=this;return new Promise(function(_0x10304f,_0x3c989e){return db[_0xea29('0x19')][_0xea29('0x1a')](_0x57ed17[_0xea29('0x1b')],{'raw':_0x57ed17['options']?_0x57ed17[_0xea29('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xea29('0x1d')](function(_0x1a5de6){logger['info'](_0xea29('0x1e'),_0x57ed17);logger[_0xea29('0x1f')](_0xea29('0x1e'),_0x57ed17,JSON[_0xea29('0x13')](_0x1a5de6));_0x10304f(_0x1a5de6);})['catch'](function(_0x5587df){logger[_0xea29('0x15')](_0xea29('0x1e'),_0x5587df[_0xea29('0x16')],_0x57ed17);_0x3c989e(_0x2b4601[_0xea29('0x15')](0x1f4,_0x5587df[_0xea29('0x16')]));});});}; \ No newline at end of file +var _0xa614=['rpc','../../config/environment','jayson/promise','client','redis','defaults','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateWhatsappMessage','create','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4d6298,_0x502f6b){var _0x57ccf0=function(_0x3cef94){while(--_0x3cef94){_0x4d6298['push'](_0x4d6298['shift']());}};_0x57ccf0(++_0x502f6b);}(_0xa614,0xf2));var _0x4a61=function(_0x412342,_0x180734){_0x412342=_0x412342-0x0;var _0x3e62cb=_0xa614[_0x412342];return _0x3e62cb;};'use strict';var _=require('lodash');var util=require(_0x4a61('0x0'));var moment=require(_0x4a61('0x1'));var BPromise=require(_0x4a61('0x2'));var rs=require(_0x4a61('0x3'));var fs=require('fs');var Redis=require(_0x4a61('0x4'));var db=require(_0x4a61('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4a61('0x6'));var config=require(_0x4a61('0x7'));var jayson=require(_0x4a61('0x8'));var client=jayson[_0x4a61('0x9')]['http']({'port':0x232a});config[_0x4a61('0xa')]=_[_0x4a61('0xb')](config[_0x4a61('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a61('0xa')]));require(_0x4a61('0xc'))[_0x4a61('0xd')](socket);function respondWithRpcPromise(_0x1f93d8,_0x5c46e6,_0x139e3d){return new BPromise(function(_0xeacb49,_0x2bd35a){return client[_0x4a61('0xe')](_0x1f93d8,_0x139e3d)[_0x4a61('0xf')](function(_0x4124b9){logger['info'](_0x4a61('0x10'),_0x5c46e6,_0x4a61('0x11'));logger[_0x4a61('0x12')](_0x4a61('0x13'),_0x5c46e6,_0x4a61('0x11'),JSON[_0x4a61('0x14')](_0x4124b9));if(_0x4124b9['error']){if(_0x4124b9[_0x4a61('0x15')][_0x4a61('0x16')]===0x1f4){logger[_0x4a61('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x5c46e6,_0x4124b9[_0x4a61('0x15')][_0x4a61('0x17')]);return _0x2bd35a(_0x4124b9[_0x4a61('0x15')]['message']);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x5c46e6,_0x4124b9['error'][_0x4a61('0x17')]);return _0xeacb49(_0x4124b9[_0x4a61('0x15')][_0x4a61('0x17')]);}else{logger[_0x4a61('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x5c46e6,_0x4a61('0x11'));_0xeacb49(_0x4124b9[_0x4a61('0x19')]['message']);}})[_0x4a61('0x1a')](function(_0x2c03b2){logger[_0x4a61('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x5c46e6,_0x2c03b2);_0x2bd35a(_0x2c03b2);});});}exports[_0x4a61('0x1b')]=function(_0x401df7){var _0x3ea3aa=this;return new Promise(function(_0x286079,_0x18106a){return db['WhatsappMessage'][_0x4a61('0x1c')](_0x401df7['body'],{'raw':_0x401df7['options']?_0x401df7[_0x4a61('0x1d')][_0x4a61('0x1e')]===undefined?!![]:![]:!![]})[_0x4a61('0xf')](function(_0x41aa4e){logger[_0x4a61('0x18')](_0x4a61('0x1b'),_0x401df7);logger[_0x4a61('0x12')]('CreateWhatsappMessage',_0x401df7,JSON['stringify'](_0x41aa4e));_0x286079(_0x41aa4e);})['catch'](function(_0x1e660d){logger[_0x4a61('0x15')]('CreateWhatsappMessage',_0x1e660d[_0x4a61('0x17')],_0x401df7);_0x18106a(_0x3ea3aa[_0x4a61('0x15')](0x1f4,_0x1e660d['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 50f7fd7..1499b6e 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 _0x08b5=['update','register','length','./whatsappMessage.events','save'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0x08b5,0x14d));var _0x508b=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x08b5[_0x2dea24];return _0x309d58;};'use strict';var WhatsappMessageEvents=require(_0x508b('0x0'));var events=[_0x508b('0x1'),'remove',_0x508b('0x2')];function createListener(_0x350610,_0x4e6fd4){return function(_0xd1c122){_0x4e6fd4['emit'](_0x350610,_0xd1c122);};}function removeListener(_0x4f4a97,_0x3841c4){return function(){WhatsappMessageEvents['removeListener'](_0x4f4a97,_0x3841c4);};}exports[_0x508b('0x3')]=function(_0x4bd7dd){for(var _0x13351b=0x0,_0x23dad2=events[_0x508b('0x4')];_0x13351b<_0x23dad2;_0x13351b++){var _0x517804=events[_0x13351b];var _0xb5c707=createListener('whatsappMessage:'+_0x517804,_0x4bd7dd);WhatsappMessageEvents['on'](_0x517804,_0xb5c707);}}; \ No newline at end of file +var _0xee9e=['removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','update','emit'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xee9e,0x1f4));var _0xeee9=function(_0x2466f7,_0x597cdd){_0x2466f7=_0x2466f7-0x0;var _0x25bf1d=_0xee9e[_0x2466f7];return _0x25bf1d;};'use strict';var WhatsappMessageEvents=require(_0xeee9('0x0'));var events=[_0xeee9('0x1'),'remove',_0xeee9('0x2')];function createListener(_0x16e49d,_0x57a06d){return function(_0x1de0e8){_0x57a06d[_0xeee9('0x3')](_0x16e49d,_0x1de0e8);};}function removeListener(_0x2a5e10,_0x1e0d93){return function(){WhatsappMessageEvents[_0xeee9('0x4')](_0x2a5e10,_0x1e0d93);};}exports[_0xeee9('0x5')]=function(_0x5c4b40){for(var _0x173c75=0x0,_0x1f1e18=events[_0xeee9('0x6')];_0x173c75<_0x1f1e18;_0x173c75++){var _0x4590b7=events[_0x173c75];var _0x3cf4c0=createListener(_0xeee9('0x7')+_0x4590b7,_0x5c4b40);WhatsappMessageEvents['on'](_0x4590b7,_0x3cf4c0);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 6e96864..4923b27 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 _0xd07e=['removeTeams','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getAgents','create','post','addTeams','/:id/users','addAgents','delete','destroy'];(function(_0x34e948,_0x5ab293){var _0x5607ab=function(_0x417e1c){while(--_0x417e1c){_0x34e948['push'](_0x34e948['shift']());}};_0x5607ab(++_0x5ab293);}(_0xd07e,0x8e));var _0xed07=function(_0x4c5b52,_0x1a945a){_0x4c5b52=_0x4c5b52-0x0;var _0x24fce3=_0xd07e[_0x4c5b52];return _0x24fce3;};'use strict';var multer=require(_0xed07('0x0'));var util=require(_0xed07('0x1'));var path=require(_0xed07('0x2'));var timeout=require(_0xed07('0x3'));var express=require(_0xed07('0x4'));var router=express['Router']();var fs_extra=require(_0xed07('0x5'));var auth=require(_0xed07('0x6'));var interaction=require(_0xed07('0x7'));var config=require('../../config/environment');var controller=require(_0xed07('0x8'));router[_0xed07('0x9')]('/',auth['isAuthenticated'](),controller[_0xed07('0xa')]);router['get'](_0xed07('0xb'),auth[_0xed07('0xc')](),controller[_0xed07('0xd')]);router[_0xed07('0x9')](_0xed07('0xe'),auth[_0xed07('0xc')](),controller[_0xed07('0xf')]);router[_0xed07('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0xed07('0x10')]);router[_0xed07('0x9')](_0xed07('0x11'),auth[_0xed07('0xc')](),controller['getTeams']);router['get']('/:id/users',auth[_0xed07('0xc')](),controller[_0xed07('0x12')]);router['post']('/',auth[_0xed07('0xc')](),controller[_0xed07('0x13')]);router[_0xed07('0x14')](_0xed07('0x11'),auth[_0xed07('0xc')](),controller[_0xed07('0x15')]);router[_0xed07('0x14')](_0xed07('0x16'),auth['isAuthenticated'](),controller[_0xed07('0x17')]);router['put']('/:id',auth[_0xed07('0xc')](),controller['update']);router[_0xed07('0x18')](_0xed07('0xe'),auth['isAuthenticated'](),controller[_0xed07('0x19')]);router[_0xed07('0x18')](_0xed07('0x11'),auth['isAuthenticated'](),controller[_0xed07('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xed07('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x58e5=['get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller'];(function(_0x4ead90,_0x8b246b){var _0x3a898c=function(_0x82b03d){while(--_0x82b03d){_0x4ead90['push'](_0x4ead90['shift']());}};_0x3a898c(++_0x8b246b);}(_0x58e5,0x85));var _0x558e=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x58e5[_0x26462c];return _0x509a42;};'use strict';var multer=require(_0x558e('0x0'));var util=require('util');var path=require(_0x558e('0x1'));var timeout=require(_0x558e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x558e('0x3'));var auth=require(_0x558e('0x4'));var interaction=require(_0x558e('0x5'));var config=require('../../config/environment');var controller=require(_0x558e('0x6'));router[_0x558e('0x7')]('/',auth[_0x558e('0x8')](),controller[_0x558e('0x9')]);router['get'](_0x558e('0xa'),auth['isAuthenticated'](),controller[_0x558e('0xb')]);router['get'](_0x558e('0xc'),auth[_0x558e('0x8')](),controller[_0x558e('0xd')]);router[_0x558e('0x7')]('/:id/members',auth[_0x558e('0x8')](),controller[_0x558e('0xe')]);router['get'](_0x558e('0xf'),auth[_0x558e('0x8')](),controller[_0x558e('0x10')]);router[_0x558e('0x7')](_0x558e('0x11'),auth['isAuthenticated'](),controller[_0x558e('0x12')]);router[_0x558e('0x13')]('/',auth[_0x558e('0x8')](),controller['create']);router[_0x558e('0x13')](_0x558e('0xf'),auth[_0x558e('0x8')](),controller['addTeams']);router[_0x558e('0x13')](_0x558e('0x11'),auth[_0x558e('0x8')](),controller[_0x558e('0x14')]);router[_0x558e('0x15')](_0x558e('0xc'),auth['isAuthenticated'](),controller[_0x558e('0x16')]);router[_0x558e('0x17')](_0x558e('0xc'),auth[_0x558e('0x8')](),controller[_0x558e('0x18')]);router[_0x558e('0x17')](_0x558e('0xf'),auth[_0x558e('0x8')](),controller[_0x558e('0x19')]);router[_0x558e('0x17')](_0x558e('0x11'),auth[_0x558e('0x8')](),controller[_0x558e('0x1a')]);module[_0x558e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index b707aff..d57b7b3 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 _0x1e69=['roundrobin','exports','STRING','name','INTEGER','beepall'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x1e69,0x85));var _0x91e6=function(_0x25a45a,_0x156e4b){_0x25a45a=_0x25a45a-0x0;var _0x237f87=_0x1e69[_0x25a45a];return _0x237f87;};'use strict';var Sequelize=require('sequelize');module[_0x91e6('0x0')]={'name':{'type':Sequelize[_0x91e6('0x1')],'unique':_0x91e6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x91e6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x91e6('0x4'),_0x91e6('0x5'))},'description':{'type':Sequelize[_0x91e6('0x1')]}}; \ No newline at end of file +var _0x0624=['INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING'];(function(_0x43c8ef,_0x12fd95){var _0x454cb8=function(_0x31288b){while(--_0x31288b){_0x43c8ef['push'](_0x43c8ef['shift']());}};_0x454cb8(++_0x12fd95);}(_0x0624,0x132));var _0x4062=function(_0x393161,_0x33aadc){_0x393161=_0x393161-0x0;var _0x3264c4=_0x0624[_0x393161];return _0x3264c4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x4062('0x0')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4062('0x1')](_0x4062('0x2'),_0x4062('0x3'),_0x4062('0x4'))},'description':{'type':Sequelize[_0x4062('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 0ebd1ee..8878203 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 _0x88fd=['../../config/license/util','redis','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','reject','save','update','destroy','then','get','WhatsappQueues','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','WhatsappQueue','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','UserWhatsappQueue','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','updatedAt','findOne','Team','getTeams','addTeams','ids','Agents','voicePause','interface','sequelize','each','forEach','emit','removeTeams','select','field','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','compact','value','transaction','isEmpty','omit','removeAgents','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','moment','mustache','path','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x256e41,_0x42f596){var _0x53a34b=function(_0x441112){while(--_0x441112){_0x256e41['push'](_0x256e41['shift']());}};_0x53a34b(++_0x42f596);}(_0x88fd,0xf1));var _0xd88f=function(_0x5faed1,_0x504d8b){_0x5faed1=_0x5faed1-0x0;var _0x45fb54=_0x88fd[_0x5faed1];return _0x45fb54;};'use strict';var emlformat=require(_0xd88f('0x0'));var rimraf=require(_0xd88f('0x1'));var zipdir=require(_0xd88f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd88f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd88f('0x4'));var util=require('util');var path=require(_0xd88f('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd88f('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd88f('0x7'));var squel=require(_0xd88f('0x8'));var crypto=require('crypto');var jsforce=require(_0xd88f('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd88f('0xa'));var Papa=require(_0xd88f('0xb'));var Redis=require(_0xd88f('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xd88f('0xd'));var as=require(_0xd88f('0xe'));var hardwareService=require(_0xd88f('0xf'));var logger=require(_0xd88f('0x10'))('api');var utils=require(_0xd88f('0x11'));var config=require(_0xd88f('0x12'));var licenseUtil=require(_0xd88f('0x13'));var db=require('../../mysqldb')['db'];config[_0xd88f('0x14')]=_['defaults'](config[_0xd88f('0x14')],{'host':_0xd88f('0x15'),'port':0x18eb});var socket=require(_0xd88f('0x16'))(new Redis(config[_0xd88f('0x14')]));require(_0xd88f('0x17'))['register'](socket);function respondWithStatusCode(_0x4a67f5,_0x393593){_0x393593=_0x393593||0xcc;return function(_0x4bcbed){if(_0x4bcbed){return _0x4a67f5[_0xd88f('0x18')](_0x393593);}return _0x4a67f5[_0xd88f('0x19')](_0x393593)[_0xd88f('0x1a')]();};}function respondWithResult(_0x3cda43,_0x1693ce){_0x1693ce=_0x1693ce||0xc8;return function(_0x1b9937){if(_0x1b9937){return _0x3cda43[_0xd88f('0x19')](_0x1693ce)['json'](_0x1b9937);}};}function respondWithFilteredResult(_0xd586ad,_0x200f36){return function(_0x176f1b){if(_0x176f1b){var _0x35af69=typeof _0x200f36[_0xd88f('0x1b')]===_0xd88f('0x1c')&&typeof _0x200f36['limit']==='undefined';var _0xa92bc2=_0x176f1b['count'];var _0x1d4871=_0x35af69?0x0:_0x200f36['offset'];var _0x1003fe=_0x35af69?_0x176f1b[_0xd88f('0x1d')]:_0x200f36[_0xd88f('0x1b')]+_0x200f36['limit'];var _0x33e3de;if(_0x1003fe>=_0xa92bc2){_0x1003fe=_0xa92bc2;_0x33e3de=0xc8;}else{_0x33e3de=0xce;}_0xd586ad[_0xd88f('0x19')](_0x33e3de);return _0xd586ad[_0xd88f('0x1e')](_0xd88f('0x1f'),_0x1d4871+'-'+_0x1003fe+'/'+_0xa92bc2)[_0xd88f('0x20')](_0x176f1b);}return null;};}function patchUpdates(_0x4b4c7f){return function(_0x1cb4e8){try{jsonpatch['apply'](_0x1cb4e8,_0x4b4c7f,!![]);}catch(_0x34fcf4){return BPromise[_0xd88f('0x21')](_0x34fcf4);}return _0x1cb4e8[_0xd88f('0x22')]();};}function saveUpdates(_0x4802bb,_0x505d5d){return function(_0x36c3bb){if(_0x36c3bb){return _0x36c3bb[_0xd88f('0x23')](_0x4802bb)['then'](function(_0x286de5){return _0x286de5;});}return null;};}function removeEntity(_0x4a22a2,_0xb2b49f){return function(_0x3ea318){if(_0x3ea318){return _0x3ea318[_0xd88f('0x24')]()[_0xd88f('0x25')](function(){var _0x3c3324=_0x3ea318[_0xd88f('0x26')]({'plain':!![]});var _0x2f64c2=_0xd88f('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x2f64c2,'resourceId':_0x3c3324['id']}})['then'](function(){return _0x3ea318;});})[_0xd88f('0x25')](function(){_0x4a22a2[_0xd88f('0x19')](0xcc)[_0xd88f('0x1a')]();});}};}function handleEntityNotFound(_0x316827,_0x48164c){return function(_0x548903){if(!_0x548903){_0x316827[_0xd88f('0x18')](0x194);}return _0x548903;};}function handleError(_0x54c25c,_0x2e87f1){_0x2e87f1=_0x2e87f1||0x1f4;return function(_0x1e0951){logger[_0xd88f('0x28')](_0x1e0951[_0xd88f('0x29')]);if(_0x1e0951[_0xd88f('0x2a')]){delete _0x1e0951[_0xd88f('0x2a')];}_0x54c25c['status'](_0x2e87f1)['send'](_0x1e0951);};}exports[_0xd88f('0x2b')]=function(_0x4e6e8d,_0x54cacb){var _0x419c9f={},_0x236ba0={},_0x82643b={'count':0x0,'rows':[]};var _0x5f1bd1=_[_0xd88f('0x2c')](db['WhatsappQueue'][_0xd88f('0x2d')],function(_0x9d0d19){return{'name':_0x9d0d19[_0xd88f('0x2e')],'type':_0x9d0d19[_0xd88f('0x2f')][_0xd88f('0x30')]};});_0x236ba0[_0xd88f('0x31')]=_[_0xd88f('0x2c')](_0x5f1bd1,_0xd88f('0x2a'));_0x236ba0['query']=_[_0xd88f('0x32')](_0x4e6e8d[_0xd88f('0x33')]);_0x236ba0[_0xd88f('0x34')]=_[_0xd88f('0x35')](_0x236ba0[_0xd88f('0x31')],_0x236ba0[_0xd88f('0x33')]);_0x419c9f['attributes']=_[_0xd88f('0x35')](_0x236ba0[_0xd88f('0x31')],qs[_0xd88f('0x36')](_0x4e6e8d[_0xd88f('0x33')][_0xd88f('0x36')]));_0x419c9f[_0xd88f('0x37')]=_0x419c9f[_0xd88f('0x37')]['length']?_0x419c9f[_0xd88f('0x37')]:_0x236ba0[_0xd88f('0x31')];if(!_0x4e6e8d[_0xd88f('0x33')][_0xd88f('0x38')](_0xd88f('0x39'))){_0x419c9f[_0xd88f('0x3a')]=qs['limit'](_0x4e6e8d[_0xd88f('0x33')]['limit']);_0x419c9f[_0xd88f('0x1b')]=qs[_0xd88f('0x1b')](_0x4e6e8d['query'][_0xd88f('0x1b')]);}_0x419c9f[_0xd88f('0x3b')]=qs[_0xd88f('0x3c')](_0x4e6e8d[_0xd88f('0x33')][_0xd88f('0x3c')]);_0x419c9f[_0xd88f('0x3d')]=qs[_0xd88f('0x34')](_[_0xd88f('0x3e')](_0x4e6e8d[_0xd88f('0x33')],_0x236ba0[_0xd88f('0x34')]),_0x5f1bd1);if(_0x4e6e8d[_0xd88f('0x33')][_0xd88f('0x3f')]){_0x419c9f[_0xd88f('0x3d')]=_[_0xd88f('0x40')](_0x419c9f[_0xd88f('0x3d')],{'$or':_['map'](_0x5f1bd1,function(_0xc55714){if(_0xc55714[_0xd88f('0x2f')]!==_0xd88f('0x41')){var _0x33cbb0={};_0x33cbb0[_0xc55714[_0xd88f('0x2a')]]={'$like':'%'+_0x4e6e8d[_0xd88f('0x33')][_0xd88f('0x3f')]+'%'};return _0x33cbb0;}})});}_0x419c9f=_['merge']({},_0x419c9f,_0x4e6e8d['options']);var _0x23229f={'where':_0x419c9f[_0xd88f('0x3d')]};return db[_0xd88f('0x42')][_0xd88f('0x1d')](_0x23229f)[_0xd88f('0x25')](function(_0x4eab63){_0x82643b['count']=_0x4eab63;if(_0x4e6e8d[_0xd88f('0x33')][_0xd88f('0x43')]){_0x419c9f[_0xd88f('0x44')]=[{'all':!![]}];}return db[_0xd88f('0x42')][_0xd88f('0x45')](_0x419c9f);})[_0xd88f('0x25')](function(_0x382fc0){_0x82643b[_0xd88f('0x46')]=_0x382fc0;return _0x82643b;})[_0xd88f('0x25')](respondWithFilteredResult(_0x54cacb,_0x419c9f))[_0xd88f('0x47')](handleError(_0x54cacb,null));};exports['show']=function(_0x47ae22,_0x483f53){var _0x3aa371={'raw':!![],'where':{'id':_0x47ae22[_0xd88f('0x48')]['id']}},_0x589866={};_0x589866['model']=_[_0xd88f('0x32')](db[_0xd88f('0x42')][_0xd88f('0x2d')]);_0x589866['query']=_[_0xd88f('0x32')](_0x47ae22[_0xd88f('0x33')]);_0x589866[_0xd88f('0x34')]=_['intersection'](_0x589866[_0xd88f('0x31')],_0x589866['query']);_0x3aa371[_0xd88f('0x37')]=_[_0xd88f('0x35')](_0x589866[_0xd88f('0x31')],qs['fields'](_0x47ae22['query']['fields']));_0x3aa371[_0xd88f('0x37')]=_0x3aa371[_0xd88f('0x37')][_0xd88f('0x49')]?_0x3aa371[_0xd88f('0x37')]:_0x589866[_0xd88f('0x31')];if(_0x47ae22[_0xd88f('0x33')][_0xd88f('0x43')]){_0x3aa371[_0xd88f('0x44')]=[{'all':!![]}];}_0x3aa371=_[_0xd88f('0x40')]({},_0x3aa371,_0x47ae22[_0xd88f('0x4a')]);return db['WhatsappQueue'][_0xd88f('0x4b')](_0x3aa371)[_0xd88f('0x25')](handleEntityNotFound(_0x483f53,null))[_0xd88f('0x25')](respondWithResult(_0x483f53,null))[_0xd88f('0x47')](handleError(_0x483f53,null));};exports[_0xd88f('0x4c')]=function(_0x182dab,_0x46bcc9){return db[_0xd88f('0x42')][_0xd88f('0x4c')](_0x182dab[_0xd88f('0x4d')],{})[_0xd88f('0x25')](function(_0x4aa7a9){var _0x3a6304=_0x182dab[_0xd88f('0x4e')][_0xd88f('0x26')]({'plain':!![]});if(!_0x3a6304)throw new Error(_0xd88f('0x4f'));if(_0x3a6304[_0xd88f('0x50')]==='user'){var _0x2f26bc=_0x4aa7a9[_0xd88f('0x26')]({'plain':!![]});var _0x487702='WhatsappQueues';return db['UserProfileSection'][_0xd88f('0x4b')]({'where':{'name':_0x487702,'userProfileId':_0x3a6304[_0xd88f('0x51')]},'raw':!![]})[_0xd88f('0x25')](function(_0x40c17c){if(_0x40c17c&&_0x40c17c['autoAssociation']===0x0){return db[_0xd88f('0x52')][_0xd88f('0x4c')]({'name':_0x2f26bc['name'],'resourceId':_0x2f26bc['id'],'type':_0x40c17c[_0xd88f('0x2a')],'sectionId':_0x40c17c['id']},{})['then'](function(){return _0x4aa7a9;});}else{return _0x4aa7a9;}})[_0xd88f('0x47')](function(_0x3a7480){logger[_0xd88f('0x28')](_0xd88f('0x53'),_0x3a7480);throw _0x3a7480;});}return _0x4aa7a9;})[_0xd88f('0x25')](respondWithResult(_0x46bcc9,0xc9))[_0xd88f('0x47')](handleError(_0x46bcc9,null));};exports[_0xd88f('0x23')]=function(_0x41a444,_0x1672df){if(_0x41a444[_0xd88f('0x4d')]['id']){delete _0x41a444[_0xd88f('0x4d')]['id'];}return db['WhatsappQueue'][_0xd88f('0x4b')]({'where':{'id':_0x41a444[_0xd88f('0x48')]['id']}})[_0xd88f('0x25')](handleEntityNotFound(_0x1672df,null))[_0xd88f('0x25')](saveUpdates(_0x41a444[_0xd88f('0x4d')],null))[_0xd88f('0x25')](respondWithResult(_0x1672df,null))[_0xd88f('0x47')](handleError(_0x1672df,null));};exports[_0xd88f('0x24')]=function(_0x249b6d,_0x3c338d){return db[_0xd88f('0x42')]['find']({'where':{'id':_0x249b6d[_0xd88f('0x48')]['id']}})[_0xd88f('0x25')](handleEntityNotFound(_0x3c338d,null))[_0xd88f('0x25')](removeEntity(_0x3c338d,null))[_0xd88f('0x47')](handleError(_0x3c338d,null));};exports['describe']=function(_0x1495a6,_0x2aba59){return db[_0xd88f('0x42')]['describe']()[_0xd88f('0x25')](respondWithResult(_0x2aba59,null))[_0xd88f('0x47')](handleError(_0x2aba59,null));};exports['getMembers']=function(_0x54c3e3,_0x79099b,_0x19f66b){var _0xf6ae={'raw':!![],'where':{}},_0xfd707a={},_0x199acb;return db[_0xd88f('0x42')]['findOne']({'where':{'id':_0x54c3e3['params']['id']}})[_0xd88f('0x25')](handleEntityNotFound(_0x79099b,null))[_0xd88f('0x25')](function(_0x496c83){if(_0x496c83){_0x199acb=_0x496c83[_0xd88f('0x26')]({'plain':!![]});_0xfd707a['model']=_[_0xd88f('0x32')](db[_0xd88f('0x54')][_0xd88f('0x2d')]);_0xfd707a['query']=_[_0xd88f('0x32')](_0x54c3e3['query']);_0xfd707a[_0xd88f('0x34')]=_['intersection'](_0xfd707a[_0xd88f('0x31')],_0xfd707a[_0xd88f('0x33')]);_0xf6ae[_0xd88f('0x37')]=_[_0xd88f('0x35')](_0xfd707a['model'],qs[_0xd88f('0x36')](_0x54c3e3['query'][_0xd88f('0x36')]));_0xf6ae[_0xd88f('0x37')]=_0xf6ae['attributes']['length']?_0xf6ae[_0xd88f('0x37')]:_0xfd707a[_0xd88f('0x31')];if(!_0x54c3e3['query']['hasOwnProperty']('nolimit')){_0xf6ae[_0xd88f('0x3a')]=qs[_0xd88f('0x3a')](_0x54c3e3[_0xd88f('0x33')]['limit']);_0xf6ae[_0xd88f('0x1b')]=qs[_0xd88f('0x1b')](_0x54c3e3[_0xd88f('0x33')][_0xd88f('0x1b')]);}_0xf6ae[_0xd88f('0x3b')]=qs[_0xd88f('0x3c')](_0x54c3e3[_0xd88f('0x33')][_0xd88f('0x3c')]);_0xf6ae[_0xd88f('0x3d')]=qs[_0xd88f('0x34')](_[_0xd88f('0x3e')](_0x54c3e3['query'],_0xfd707a['filters']));_0xf6ae['where']['WhatsappQueueId']=_0x496c83['id'];if(_0x54c3e3[_0xd88f('0x33')][_0xd88f('0x3f')]){_0xf6ae[_0xd88f('0x3d')]=_[_0xd88f('0x40')](_0xf6ae[_0xd88f('0x3d')],{'$or':_[_0xd88f('0x2c')](_0xf6ae[_0xd88f('0x37')],function(_0x4c3f40){var _0x597011={};_0x597011[_0x4c3f40]={'$like':'%'+_0x54c3e3[_0xd88f('0x33')][_0xd88f('0x3f')]+'%'};return _0x597011;})});}_0xf6ae=_[_0xd88f('0x40')]({},_0xf6ae,_0x54c3e3['options']);return db[_0xd88f('0x54')][_0xd88f('0x45')](_0xf6ae);}})[_0xd88f('0x25')](function(_0x13c14f){if(_0x13c14f){return db[_0xd88f('0x55')][_0xd88f('0x56')]({'where':{'id':_[_0xd88f('0x2c')](_0x13c14f,_0xd88f('0x57')),'role':_0xd88f('0x58')},'attributes':['id',_0xd88f('0x2a'),'whatsappPause','updatedAt',_0xd88f('0x59')]});}})[_0xd88f('0x25')](function(_0x7b7a67){if(_0x7b7a67){return{'count':_0x7b7a67['count'],'rows':_['map'](_0x7b7a67[_0xd88f('0x46')],function(_0x845fc4){return{'membername':_0x845fc4[_0xd88f('0x2a')],'UserId':_0x845fc4['id'],'queue_name':_0x199acb[_0xd88f('0x2a')],'WhatsappQueueId':_0x199acb['id'],'interface':util[_0xd88f('0x5a')](_0xd88f('0x5b'),'SIP',_0x845fc4[_0xd88f('0x2a')]),'penalty':0x0,'paused':_0x845fc4['whatsappPause'],'createdAt':_0x845fc4['createdAt'],'updatedAt':_0x845fc4[_0xd88f('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd88f('0x25')](respondWithFilteredResult(_0x79099b,_0xf6ae))[_0xd88f('0x47')](handleError(_0x79099b,null));};exports['getTeams']=function(_0x45580a,_0x51cffd,_0x417ae7){var _0x543906={};var _0x21491b={};var _0xb35653;var _0x48c6af;return db[_0xd88f('0x42')][_0xd88f('0x5d')]({'where':{'id':_0x45580a[_0xd88f('0x48')]['id']}})[_0xd88f('0x25')](handleEntityNotFound(_0x51cffd,null))[_0xd88f('0x25')](function(_0xbce6d){if(_0xbce6d){_0xb35653=_0xbce6d;_0x21491b[_0xd88f('0x31')]=_[_0xd88f('0x32')](db[_0xd88f('0x5e')][_0xd88f('0x2d')]);_0x21491b[_0xd88f('0x33')]=_['keys'](_0x45580a[_0xd88f('0x33')]);_0x21491b['filters']=_[_0xd88f('0x35')](_0x21491b['model'],_0x21491b[_0xd88f('0x33')]);_0x543906[_0xd88f('0x37')]=_['intersection'](_0x21491b['model'],qs[_0xd88f('0x36')](_0x45580a[_0xd88f('0x33')][_0xd88f('0x36')]));_0x543906[_0xd88f('0x37')]=_0x543906[_0xd88f('0x37')]['length']?_0x543906[_0xd88f('0x37')]:_0x21491b[_0xd88f('0x31')];_0x543906[_0xd88f('0x3b')]=qs[_0xd88f('0x3c')](_0x45580a[_0xd88f('0x33')][_0xd88f('0x3c')]);_0x543906['where']=qs[_0xd88f('0x34')](_[_0xd88f('0x3e')](_0x45580a[_0xd88f('0x33')],_0x21491b[_0xd88f('0x34')]));if(_0x45580a['query']['filter']){_0x543906['where']=_[_0xd88f('0x40')](_0x543906[_0xd88f('0x3d')],{'$or':_[_0xd88f('0x2c')](_0x543906[_0xd88f('0x37')],function(_0x1e0691){var _0x409fca={};_0x409fca[_0x1e0691]={'$like':'%'+_0x45580a[_0xd88f('0x33')][_0xd88f('0x3f')]+'%'};return _0x409fca;})});}_0x543906=_['merge']({},_0x543906,_0x45580a[_0xd88f('0x4a')]);return _0xb35653[_0xd88f('0x5f')](_0x543906);}})[_0xd88f('0x25')](function(_0x12f1fc){if(_0x12f1fc){_0x48c6af=_0x12f1fc[_0xd88f('0x49')];if(!_0x45580a[_0xd88f('0x33')][_0xd88f('0x38')](_0xd88f('0x39'))){_0x543906[_0xd88f('0x3a')]=qs[_0xd88f('0x3a')](_0x45580a[_0xd88f('0x33')][_0xd88f('0x3a')]);_0x543906[_0xd88f('0x1b')]=qs[_0xd88f('0x1b')](_0x45580a[_0xd88f('0x33')][_0xd88f('0x1b')]);}return _0xb35653['getTeams'](_0x543906);}})['then'](function(_0x24410a){if(_0x24410a){return _0x24410a?{'count':_0x48c6af,'rows':_0x24410a}:null;}})['then'](respondWithResult(_0x51cffd,null))[_0xd88f('0x47')](handleError(_0x51cffd,null));};exports[_0xd88f('0x60')]=function(_0x187409,_0x5e5993,_0x315735){var _0x47032d=_0x187409[_0xd88f('0x4d')][_0xd88f('0x61')];return db[_0xd88f('0x5e')][_0xd88f('0x45')]({'where':{'id':_0x47032d},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd88f('0x62'),'attributes':['id',_0xd88f('0x2a'),'online',_0xd88f('0x63'),_0xd88f('0x64')],'raw':!![]}]})[_0xd88f('0x25')](function(_0x4b90ce){if(_0x4b90ce){var _0x4e0f22=_['flatMap'](_0x4b90ce,function(_0x4e01c9){var _0x461c9f=_0x4e01c9[_0xd88f('0x26')]({'plain':!![]});return _0x461c9f[_0xd88f('0x62')];});return db[_0xd88f('0x42')][_0xd88f('0x4b')]({'where':{'id':_0x187409['params']['id']}})[_0xd88f('0x25')](function(_0x20e95f){return db[_0xd88f('0x65')]['transaction'](function(_0x410e44){return _0x20e95f[_0xd88f('0x60')](_0x47032d,{'transaction':_0x410e44})[_0xd88f('0x25')](function(){return BPromise[_0xd88f('0x66')](_0x4e0f22,function(_0x42c95d){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x42c95d['id'],'WhatsappQueueId':_0x187409[_0xd88f('0x48')]['id']},'transaction':_0x410e44});});})[_0xd88f('0x25')](function(){_0x4e0f22[_0xd88f('0x67')](function(_0x167446){socket[_0xd88f('0x68')]('userWhatsappQueue:save',{'UserId':_0x167446['id'],'WhatsappQueueId':_0x20e95f['id']});});});});});}})[_0xd88f('0x25')](respondWithStatusCode(_0x5e5993,null))[_0xd88f('0x47')](handleError(_0x5e5993,null));};exports[_0xd88f('0x69')]=function(_0x5152ae,_0x1284cd,_0x2a23b7){return db[_0xd88f('0x5e')][_0xd88f('0x45')]({'where':{'id':_0x5152ae['query'][_0xd88f('0x61')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd88f('0x62'),'attributes':['id'],'raw':!![]}]})[_0xd88f('0x25')](handleEntityNotFound(_0x1284cd,null))[_0xd88f('0x25')](function(_0x57e9e2){var _0x2e6efc=_[_0xd88f('0x2c')](_0x57e9e2,'id');var _0x4ddf4f=[];var _0x23a06c=[];var _0x341fc4=squel[_0xd88f('0x6a')]();_0x341fc4[_0xd88f('0x6b')]('tq.TeamId')['from'](_0xd88f('0x6c'),'tq')[_0xd88f('0x6d')](_0xd88f('0x6e'),'ut',_0xd88f('0x6f'))['where'](_0xd88f('0x70'),_0x5152ae[_0xd88f('0x48')]['id']);for(var _0x11cc05=0x0;_0x11cc05<_0x57e9e2['length'];_0x11cc05+=0x1){let _0x46834f=_0x57e9e2[_0x11cc05];for(var _0x24e2ee=0x0;_0x24e2ee<_0x46834f[_0xd88f('0x62')][_0xd88f('0x49')];_0x24e2ee+=0x1){let _0x41ec9a=_0x46834f[_0xd88f('0x62')][_0x24e2ee];var _0x3b018d=_0x341fc4[_0xd88f('0x71')]();_0x3b018d['where'](_0xd88f('0x72'),_0x41ec9a['id']);_0x23a06c[_0xd88f('0x73')](db['sequelize'][_0xd88f('0x33')](_0x3b018d[_0xd88f('0x74')](),{'type':db[_0xd88f('0x65')][_0xd88f('0x75')][_0xd88f('0x76')]})[_0xd88f('0x25')](function(_0x29d242){if(_0x29d242[_0xd88f('0x49')]===0x1){return _0x41ec9a['id'];}else{var _0x3fd183=_[_0xd88f('0x77')](_[_0xd88f('0x2c')](_0x29d242,'TeamId'),function(_0x59e3dd){return _[_0xd88f('0x78')](_0x2e6efc,_0x59e3dd);});if(_0x3fd183){return _0x41ec9a['id'];}}}));}}return BPromise['all'](_0x23a06c)[_0xd88f('0x25')](function(_0x5072da){_0x4ddf4f=_(_0x4ddf4f)['union'](_0x5072da)[_0xd88f('0x79')]()[_0xd88f('0x7a')]();return db['WhatsappQueue'][_0xd88f('0x4b')]({'where':{'id':_0x5152ae[_0xd88f('0x48')]['id']}})[_0xd88f('0x25')](function(_0x563cec){return db[_0xd88f('0x65')][_0xd88f('0x7b')](function(_0x3acfdc){return _0x563cec['removeTeams'](_0x5152ae['query'][_0xd88f('0x61')],{'transaction':_0x3acfdc})['then'](function(){if(!_[_0xd88f('0x7c')](_0x4ddf4f)){return _0x563cec['removeAgents'](_0x4ddf4f,{'transaction':_0x3acfdc});}})[_0xd88f('0x25')](function(){_0x4ddf4f[_0xd88f('0x67')](function(_0x5c2172){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x5c2172,'WhatsappQueueId':_0x563cec['id']});});});});});});})[_0xd88f('0x25')](respondWithStatusCode(_0x1284cd,null))[_0xd88f('0x47')](handleError(_0x1284cd,null));};exports['addAgents']=function(_0xd5f843,_0x29769f,_0x2c425c){return db[_0xd88f('0x42')][_0xd88f('0x4b')]({'where':{'id':_0xd5f843[_0xd88f('0x48')]['id']}})['then'](handleEntityNotFound(_0x29769f,null))[_0xd88f('0x25')](function(_0x42e521){if(_0x42e521){return _0x42e521['addAgents'](_0xd5f843['body']['ids'],_[_0xd88f('0x7d')](_0xd5f843['body'],[_0xd88f('0x61'),'id'])||{})['spread'](function(_0x133ddf){for(var _0x164f41=0x0;_0x164f41<_0xd5f843[_0xd88f('0x4d')][_0xd88f('0x61')]['length'];_0x164f41+=0x1){socket[_0xd88f('0x68')]('userWhatsappQueue:save',{'UserId':Number(_0xd5f843['body'][_0xd88f('0x61')][_0x164f41]),'WhatsappQueueId':Number(_0xd5f843[_0xd88f('0x48')]['id'])});}return _0x133ddf;});}})[_0xd88f('0x25')](respondWithResult(_0x29769f,null))[_0xd88f('0x47')](handleError(_0x29769f,null));};exports[_0xd88f('0x7e')]=function(_0x23e69e,_0x53fb2e,_0xe2bda0){return db[_0xd88f('0x42')][_0xd88f('0x4b')]({'where':{'id':_0x23e69e[_0xd88f('0x48')]['id']}})['then'](handleEntityNotFound(_0x53fb2e,null))[_0xd88f('0x25')](function(_0x386105){if(_0x386105){return _0x386105[_0xd88f('0x7e')](_0x23e69e[_0xd88f('0x33')][_0xd88f('0x61')])[_0xd88f('0x25')](function(){if(_[_0xd88f('0x7f')](_0x23e69e[_0xd88f('0x33')][_0xd88f('0x61')])){for(var _0x21b9cd=0x0;_0x21b9cd<_0x23e69e[_0xd88f('0x33')][_0xd88f('0x61')]['length'];_0x21b9cd+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x23e69e[_0xd88f('0x33')][_0xd88f('0x61')][_0x21b9cd]),'WhatsappQueueId':Number(_0x23e69e['params']['id'])});}}else{socket[_0xd88f('0x68')](_0xd88f('0x80'),{'UserId':Number(_0x23e69e[_0xd88f('0x33')][_0xd88f('0x61')]),'WhatsappQueueId':Number(_0x23e69e['params']['id'])});}});}})[_0xd88f('0x25')](respondWithStatusCode(_0x53fb2e,null))[_0xd88f('0x47')](handleError(_0x53fb2e,null));};exports[_0xd88f('0x81')]=function(_0x2aff39,_0x55d4e2,_0x55155f){var _0x2d4b3d={};var _0x52951d={};var _0x46f8b3;var _0x4c53b8;return db[_0xd88f('0x42')][_0xd88f('0x5d')]({'where':{'id':_0x2aff39[_0xd88f('0x48')]['id']}})[_0xd88f('0x25')](handleEntityNotFound(_0x55d4e2,null))[_0xd88f('0x25')](function(_0x41ace1){if(_0x41ace1){_0x46f8b3=_0x41ace1;_0x52951d[_0xd88f('0x31')]=_[_0xd88f('0x32')](db[_0xd88f('0x55')][_0xd88f('0x2d')]);_0x52951d[_0xd88f('0x33')]=_[_0xd88f('0x32')](_0x2aff39['query']);_0x52951d[_0xd88f('0x34')]=_[_0xd88f('0x35')](_0x52951d[_0xd88f('0x31')],_0x52951d[_0xd88f('0x33')]);_0x2d4b3d[_0xd88f('0x37')]=_[_0xd88f('0x35')](_0x52951d[_0xd88f('0x31')],qs[_0xd88f('0x36')](_0x2aff39['query'][_0xd88f('0x36')]));_0x2d4b3d[_0xd88f('0x37')]=_0x2d4b3d['attributes'][_0xd88f('0x49')]?_0x2d4b3d[_0xd88f('0x37')]:_0x52951d[_0xd88f('0x31')];_0x2d4b3d[_0xd88f('0x3b')]=qs[_0xd88f('0x3c')](_0x2aff39[_0xd88f('0x33')][_0xd88f('0x3c')]);_0x2d4b3d['where']=qs[_0xd88f('0x34')](_['pick'](_0x2aff39[_0xd88f('0x33')],_0x52951d['filters']));if(_0x2aff39[_0xd88f('0x33')]['filter']){_0x2d4b3d['where']=_[_0xd88f('0x40')](_0x2d4b3d[_0xd88f('0x3d')],{'$or':_[_0xd88f('0x2c')](_0x2d4b3d['attributes'],function(_0x2e9a4f){var _0x13a808={};_0x13a808[_0x2e9a4f]={'$like':'%'+_0x2aff39[_0xd88f('0x33')][_0xd88f('0x3f')]+'%'};return _0x13a808;})});}_0x2d4b3d=_['merge']({},_0x2d4b3d,_0x2aff39[_0xd88f('0x4a')]);return _0x46f8b3[_0xd88f('0x81')](_0x2d4b3d);}})['then'](function(_0x53d89f){if(_0x53d89f){_0x4c53b8=_0x53d89f[_0xd88f('0x49')];if(!_0x2aff39[_0xd88f('0x33')][_0xd88f('0x38')](_0xd88f('0x39'))){_0x2d4b3d[_0xd88f('0x3a')]=qs['limit'](_0x2aff39[_0xd88f('0x33')]['limit']);_0x2d4b3d[_0xd88f('0x1b')]=qs[_0xd88f('0x1b')](_0x2aff39[_0xd88f('0x33')][_0xd88f('0x1b')]);}return _0x46f8b3['getAgents'](_0x2d4b3d);}})[_0xd88f('0x25')](function(_0x503d17){if(_0x503d17){return _0x503d17?{'count':_0x4c53b8,'rows':_0x503d17}:null;}})['then'](respondWithResult(_0x55d4e2,null))[_0xd88f('0x47')](handleError(_0x55d4e2,null));}; \ No newline at end of file +var _0x14c3=['count','set','Content-Range','apply','reject','save','update','then','get','destroy','end','error','name','send','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','WhatsappQueue','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','pick','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Team','online','interface','flatMap','Agents','sequelize','transaction','each','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userWhatsappQueue:remove','ids','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','limit'];(function(_0x575e2f,_0xa51376){var _0x493a41=function(_0x2e25f7){while(--_0x2e25f7){_0x575e2f['push'](_0x575e2f['shift']());}};_0x493a41(++_0xa51376);}(_0x14c3,0x6e));var _0x314c=function(_0x41aa7b,_0x5735d4){_0x41aa7b=_0x41aa7b-0x0;var _0x2cede7=_0x14c3[_0x41aa7b];return _0x2cede7;};'use strict';var emlformat=require(_0x314c('0x0'));var rimraf=require(_0x314c('0x1'));var zipdir=require(_0x314c('0x2'));var jsonpatch=require(_0x314c('0x3'));var rp=require(_0x314c('0x4'));var moment=require(_0x314c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x314c('0x6'));var path=require(_0x314c('0x7'));var sox=require(_0x314c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x314c('0x9'));var _=require(_0x314c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x314c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x314c('0xc'));var querystring=require(_0x314c('0xd'));var Papa=require(_0x314c('0xe'));var Redis=require(_0x314c('0xf'));var authService=require(_0x314c('0x10'));var qs=require(_0x314c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x314c('0x12'));var logger=require('../../config/logger')(_0x314c('0x13'));var utils=require('../../config/utils');var config=require(_0x314c('0x14'));var licenseUtil=require(_0x314c('0x15'));var db=require(_0x314c('0x16'))['db'];config[_0x314c('0x17')]=_['defaults'](config[_0x314c('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x314c('0x18'))(new Redis(config[_0x314c('0x17')]));require(_0x314c('0x19'))[_0x314c('0x1a')](socket);function respondWithStatusCode(_0x42c785,_0x3d8fa0){_0x3d8fa0=_0x3d8fa0||0xcc;return function(_0x35c6bb){if(_0x35c6bb){return _0x42c785[_0x314c('0x1b')](_0x3d8fa0);}return _0x42c785[_0x314c('0x1c')](_0x3d8fa0)['end']();};}function respondWithResult(_0x40571d,_0xeb8e2c){_0xeb8e2c=_0xeb8e2c||0xc8;return function(_0x9d7b1){if(_0x9d7b1){return _0x40571d[_0x314c('0x1c')](_0xeb8e2c)[_0x314c('0x1d')](_0x9d7b1);}};}function respondWithFilteredResult(_0x5f5532,_0x4514e1){return function(_0x1fff5b){if(_0x1fff5b){var _0x17c771=typeof _0x4514e1[_0x314c('0x1e')]===_0x314c('0x1f')&&typeof _0x4514e1[_0x314c('0x20')]==='undefined';var _0x3ae3cc=_0x1fff5b[_0x314c('0x21')];var _0x4d4352=_0x17c771?0x0:_0x4514e1[_0x314c('0x1e')];var _0x583c8d=_0x17c771?_0x1fff5b[_0x314c('0x21')]:_0x4514e1[_0x314c('0x1e')]+_0x4514e1[_0x314c('0x20')];var _0x5a6a29;if(_0x583c8d>=_0x3ae3cc){_0x583c8d=_0x3ae3cc;_0x5a6a29=0xc8;}else{_0x5a6a29=0xce;}_0x5f5532[_0x314c('0x1c')](_0x5a6a29);return _0x5f5532[_0x314c('0x22')](_0x314c('0x23'),_0x4d4352+'-'+_0x583c8d+'/'+_0x3ae3cc)['json'](_0x1fff5b);}return null;};}function patchUpdates(_0x5d284f){return function(_0x1865a8){try{jsonpatch[_0x314c('0x24')](_0x1865a8,_0x5d284f,!![]);}catch(_0x452fa7){return BPromise[_0x314c('0x25')](_0x452fa7);}return _0x1865a8[_0x314c('0x26')]();};}function saveUpdates(_0x203f36,_0x29c639){return function(_0x3b1393){if(_0x3b1393){return _0x3b1393[_0x314c('0x27')](_0x203f36)[_0x314c('0x28')](function(_0x18d215){return _0x18d215;});}return null;};}function removeEntity(_0x216b6c,_0x508fa1){return function(_0x281347){if(_0x281347){return _0x281347['destroy']()[_0x314c('0x28')](function(){var _0x110299=_0x281347[_0x314c('0x29')]({'plain':!![]});var _0x1bfab3='WhatsappQueues';return db['UserProfileResource'][_0x314c('0x2a')]({'where':{'type':_0x1bfab3,'resourceId':_0x110299['id']}})[_0x314c('0x28')](function(){return _0x281347;});})['then'](function(){_0x216b6c[_0x314c('0x1c')](0xcc)[_0x314c('0x2b')]();});}};}function handleEntityNotFound(_0x485cf2,_0xbba0d6){return function(_0x5667e2){if(!_0x5667e2){_0x485cf2[_0x314c('0x1b')](0x194);}return _0x5667e2;};}function handleError(_0xe5e550,_0x41f10f){_0x41f10f=_0x41f10f||0x1f4;return function(_0x2c495f){logger[_0x314c('0x2c')](_0x2c495f['stack']);if(_0x2c495f[_0x314c('0x2d')]){delete _0x2c495f['name'];}_0xe5e550[_0x314c('0x1c')](_0x41f10f)[_0x314c('0x2e')](_0x2c495f);};}exports['index']=function(_0x341d43,_0x1f318c){var _0x511f2e={},_0x5824ac={},_0x398ba4={'count':0x0,'rows':[]};var _0x3fcf35=_[_0x314c('0x2f')](db['WhatsappQueue']['rawAttributes'],function(_0x3c0256){return{'name':_0x3c0256[_0x314c('0x30')],'type':_0x3c0256[_0x314c('0x31')]['key']};});_0x5824ac[_0x314c('0x32')]=_['map'](_0x3fcf35,_0x314c('0x2d'));_0x5824ac[_0x314c('0x33')]=_[_0x314c('0x34')](_0x341d43[_0x314c('0x33')]);_0x5824ac[_0x314c('0x35')]=_[_0x314c('0x36')](_0x5824ac[_0x314c('0x32')],_0x5824ac['query']);_0x511f2e[_0x314c('0x37')]=_[_0x314c('0x36')](_0x5824ac[_0x314c('0x32')],qs[_0x314c('0x38')](_0x341d43['query']['fields']));_0x511f2e[_0x314c('0x37')]=_0x511f2e[_0x314c('0x37')]['length']?_0x511f2e['attributes']:_0x5824ac['model'];if(!_0x341d43[_0x314c('0x33')]['hasOwnProperty'](_0x314c('0x39'))){_0x511f2e[_0x314c('0x20')]=qs['limit'](_0x341d43['query']['limit']);_0x511f2e['offset']=qs[_0x314c('0x1e')](_0x341d43[_0x314c('0x33')][_0x314c('0x1e')]);}_0x511f2e[_0x314c('0x3a')]=qs[_0x314c('0x3b')](_0x341d43[_0x314c('0x33')][_0x314c('0x3b')]);_0x511f2e[_0x314c('0x3c')]=qs['filters'](_['pick'](_0x341d43[_0x314c('0x33')],_0x5824ac[_0x314c('0x35')]),_0x3fcf35);if(_0x341d43['query'][_0x314c('0x3d')]){_0x511f2e[_0x314c('0x3c')]=_['merge'](_0x511f2e[_0x314c('0x3c')],{'$or':_[_0x314c('0x2f')](_0x3fcf35,function(_0x378456){if(_0x378456[_0x314c('0x31')]!==_0x314c('0x3e')){var _0x5ef700={};_0x5ef700[_0x378456['name']]={'$like':'%'+_0x341d43[_0x314c('0x33')][_0x314c('0x3d')]+'%'};return _0x5ef700;}})});}_0x511f2e=_[_0x314c('0x3f')]({},_0x511f2e,_0x341d43[_0x314c('0x40')]);var _0x418a8f={'where':_0x511f2e['where']};return db['WhatsappQueue']['count'](_0x418a8f)[_0x314c('0x28')](function(_0xc35bf){_0x398ba4[_0x314c('0x21')]=_0xc35bf;if(_0x341d43[_0x314c('0x33')][_0x314c('0x41')]){_0x511f2e[_0x314c('0x42')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x314c('0x43')](_0x511f2e);})[_0x314c('0x28')](function(_0x278862){_0x398ba4[_0x314c('0x44')]=_0x278862;return _0x398ba4;})['then'](respondWithFilteredResult(_0x1f318c,_0x511f2e))['catch'](handleError(_0x1f318c,null));};exports[_0x314c('0x45')]=function(_0x3634fd,_0x113ffd){var _0x256f44={'raw':!![],'where':{'id':_0x3634fd[_0x314c('0x46')]['id']}},_0x39c69a={};_0x39c69a['model']=_[_0x314c('0x34')](db['WhatsappQueue'][_0x314c('0x47')]);_0x39c69a[_0x314c('0x33')]=_[_0x314c('0x34')](_0x3634fd[_0x314c('0x33')]);_0x39c69a['filters']=_['intersection'](_0x39c69a[_0x314c('0x32')],_0x39c69a[_0x314c('0x33')]);_0x256f44[_0x314c('0x37')]=_[_0x314c('0x36')](_0x39c69a[_0x314c('0x32')],qs[_0x314c('0x38')](_0x3634fd['query'][_0x314c('0x38')]));_0x256f44[_0x314c('0x37')]=_0x256f44[_0x314c('0x37')][_0x314c('0x48')]?_0x256f44[_0x314c('0x37')]:_0x39c69a[_0x314c('0x32')];if(_0x3634fd[_0x314c('0x33')]['includeAll']){_0x256f44['include']=[{'all':!![]}];}_0x256f44=_[_0x314c('0x3f')]({},_0x256f44,_0x3634fd[_0x314c('0x40')]);return db[_0x314c('0x49')]['find'](_0x256f44)[_0x314c('0x28')](handleEntityNotFound(_0x113ffd,null))[_0x314c('0x28')](respondWithResult(_0x113ffd,null))[_0x314c('0x4a')](handleError(_0x113ffd,null));};exports[_0x314c('0x4b')]=function(_0x1841a5,_0x209d9c){return db[_0x314c('0x49')][_0x314c('0x4b')](_0x1841a5[_0x314c('0x4c')],{})[_0x314c('0x28')](function(_0x5ace6b){var _0x4a45fd=_0x1841a5['user'][_0x314c('0x29')]({'plain':!![]});if(!_0x4a45fd)throw new Error(_0x314c('0x4d'));if(_0x4a45fd[_0x314c('0x4e')]===_0x314c('0x4f')){var _0x2d521e=_0x5ace6b['get']({'plain':!![]});var _0x115295='WhatsappQueues';return db[_0x314c('0x50')][_0x314c('0x51')]({'where':{'name':_0x115295,'userProfileId':_0x4a45fd[_0x314c('0x52')]},'raw':!![]})[_0x314c('0x28')](function(_0x2d2fa3){if(_0x2d2fa3&&_0x2d2fa3[_0x314c('0x53')]===0x0){return db[_0x314c('0x54')]['create']({'name':_0x2d521e['name'],'resourceId':_0x2d521e['id'],'type':_0x2d2fa3[_0x314c('0x2d')],'sectionId':_0x2d2fa3['id']},{})[_0x314c('0x28')](function(){return _0x5ace6b;});}else{return _0x5ace6b;}})[_0x314c('0x4a')](function(_0x1705a1){logger[_0x314c('0x2c')](_0x314c('0x55'),_0x1705a1);throw _0x1705a1;});}return _0x5ace6b;})['then'](respondWithResult(_0x209d9c,0xc9))[_0x314c('0x4a')](handleError(_0x209d9c,null));};exports[_0x314c('0x27')]=function(_0x767d74,_0x1bd90d){if(_0x767d74[_0x314c('0x4c')]['id']){delete _0x767d74[_0x314c('0x4c')]['id'];}return db[_0x314c('0x49')][_0x314c('0x51')]({'where':{'id':_0x767d74['params']['id']}})[_0x314c('0x28')](handleEntityNotFound(_0x1bd90d,null))[_0x314c('0x28')](saveUpdates(_0x767d74[_0x314c('0x4c')],null))[_0x314c('0x28')](respondWithResult(_0x1bd90d,null))[_0x314c('0x4a')](handleError(_0x1bd90d,null));};exports[_0x314c('0x2a')]=function(_0x3250c7,_0x357bae){return db[_0x314c('0x49')][_0x314c('0x51')]({'where':{'id':_0x3250c7[_0x314c('0x46')]['id']}})[_0x314c('0x28')](handleEntityNotFound(_0x357bae,null))[_0x314c('0x28')](removeEntity(_0x357bae,null))[_0x314c('0x4a')](handleError(_0x357bae,null));};exports[_0x314c('0x56')]=function(_0x513680,_0x24613f){return db[_0x314c('0x49')][_0x314c('0x56')]()['then'](respondWithResult(_0x24613f,null))[_0x314c('0x4a')](handleError(_0x24613f,null));};exports[_0x314c('0x57')]=function(_0x58a675,_0x16b53e,_0x1eda01){var _0x4c15a4={'raw':!![],'where':{}},_0xe5b38e={},_0x129ef4;return db[_0x314c('0x49')][_0x314c('0x58')]({'where':{'id':_0x58a675[_0x314c('0x46')]['id']}})[_0x314c('0x28')](handleEntityNotFound(_0x16b53e,null))['then'](function(_0x30e388){if(_0x30e388){_0x129ef4=_0x30e388['get']({'plain':!![]});_0xe5b38e[_0x314c('0x32')]=_['keys'](db[_0x314c('0x59')][_0x314c('0x47')]);_0xe5b38e[_0x314c('0x33')]=_[_0x314c('0x34')](_0x58a675['query']);_0xe5b38e[_0x314c('0x35')]=_[_0x314c('0x36')](_0xe5b38e[_0x314c('0x32')],_0xe5b38e[_0x314c('0x33')]);_0x4c15a4['attributes']=_[_0x314c('0x36')](_0xe5b38e[_0x314c('0x32')],qs[_0x314c('0x38')](_0x58a675[_0x314c('0x33')][_0x314c('0x38')]));_0x4c15a4[_0x314c('0x37')]=_0x4c15a4[_0x314c('0x37')]['length']?_0x4c15a4[_0x314c('0x37')]:_0xe5b38e[_0x314c('0x32')];if(!_0x58a675['query'][_0x314c('0x5a')](_0x314c('0x39'))){_0x4c15a4[_0x314c('0x20')]=qs[_0x314c('0x20')](_0x58a675['query'][_0x314c('0x20')]);_0x4c15a4[_0x314c('0x1e')]=qs['offset'](_0x58a675['query']['offset']);}_0x4c15a4[_0x314c('0x3a')]=qs[_0x314c('0x3b')](_0x58a675[_0x314c('0x33')][_0x314c('0x3b')]);_0x4c15a4[_0x314c('0x3c')]=qs[_0x314c('0x35')](_[_0x314c('0x5b')](_0x58a675[_0x314c('0x33')],_0xe5b38e['filters']));_0x4c15a4['where']['WhatsappQueueId']=_0x30e388['id'];if(_0x58a675[_0x314c('0x33')][_0x314c('0x3d')]){_0x4c15a4['where']=_[_0x314c('0x3f')](_0x4c15a4[_0x314c('0x3c')],{'$or':_[_0x314c('0x2f')](_0x4c15a4[_0x314c('0x37')],function(_0x3f567c){var _0x163447={};_0x163447[_0x3f567c]={'$like':'%'+_0x58a675[_0x314c('0x33')][_0x314c('0x3d')]+'%'};return _0x163447;})});}_0x4c15a4=_[_0x314c('0x3f')]({},_0x4c15a4,_0x58a675[_0x314c('0x40')]);return db[_0x314c('0x59')][_0x314c('0x43')](_0x4c15a4);}})['then'](function(_0x2c04f4){if(_0x2c04f4){return db[_0x314c('0x5c')][_0x314c('0x5d')]({'where':{'id':_[_0x314c('0x2f')](_0x2c04f4,'UserId'),'role':_0x314c('0x5e')},'attributes':['id','name',_0x314c('0x5f'),_0x314c('0x60'),_0x314c('0x61')]});}})['then'](function(_0x2ed8f5){if(_0x2ed8f5){return{'count':_0x2ed8f5[_0x314c('0x21')],'rows':_[_0x314c('0x2f')](_0x2ed8f5[_0x314c('0x44')],function(_0x15734c){return{'membername':_0x15734c[_0x314c('0x2d')],'UserId':_0x15734c['id'],'queue_name':_0x129ef4[_0x314c('0x2d')],'WhatsappQueueId':_0x129ef4['id'],'interface':util[_0x314c('0x62')](_0x314c('0x63'),_0x314c('0x64'),_0x15734c['name']),'penalty':0x0,'paused':_0x15734c[_0x314c('0x5f')],'createdAt':_0x15734c['createdAt'],'updatedAt':_0x15734c[_0x314c('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x16b53e,_0x4c15a4))[_0x314c('0x4a')](handleError(_0x16b53e,null));};exports['getTeams']=function(_0x38b5dc,_0x1dfe9e,_0x3db724){var _0x4ba992={};var _0x384c7f={};var _0x3773fd;var _0x4a531c;return db[_0x314c('0x49')][_0x314c('0x58')]({'where':{'id':_0x38b5dc[_0x314c('0x46')]['id']}})[_0x314c('0x28')](handleEntityNotFound(_0x1dfe9e,null))[_0x314c('0x28')](function(_0x28d731){if(_0x28d731){_0x3773fd=_0x28d731;_0x384c7f['model']=_[_0x314c('0x34')](db['Team'][_0x314c('0x47')]);_0x384c7f['query']=_[_0x314c('0x34')](_0x38b5dc[_0x314c('0x33')]);_0x384c7f[_0x314c('0x35')]=_[_0x314c('0x36')](_0x384c7f[_0x314c('0x32')],_0x384c7f[_0x314c('0x33')]);_0x4ba992[_0x314c('0x37')]=_[_0x314c('0x36')](_0x384c7f[_0x314c('0x32')],qs[_0x314c('0x38')](_0x38b5dc[_0x314c('0x33')][_0x314c('0x38')]));_0x4ba992[_0x314c('0x37')]=_0x4ba992['attributes'][_0x314c('0x48')]?_0x4ba992[_0x314c('0x37')]:_0x384c7f[_0x314c('0x32')];_0x4ba992['order']=qs[_0x314c('0x3b')](_0x38b5dc[_0x314c('0x33')][_0x314c('0x3b')]);_0x4ba992[_0x314c('0x3c')]=qs[_0x314c('0x35')](_[_0x314c('0x5b')](_0x38b5dc[_0x314c('0x33')],_0x384c7f[_0x314c('0x35')]));if(_0x38b5dc[_0x314c('0x33')][_0x314c('0x3d')]){_0x4ba992[_0x314c('0x3c')]=_['merge'](_0x4ba992['where'],{'$or':_[_0x314c('0x2f')](_0x4ba992[_0x314c('0x37')],function(_0x1b46c3){var _0xb2daeb={};_0xb2daeb[_0x1b46c3]={'$like':'%'+_0x38b5dc[_0x314c('0x33')][_0x314c('0x3d')]+'%'};return _0xb2daeb;})});}_0x4ba992=_['merge']({},_0x4ba992,_0x38b5dc[_0x314c('0x40')]);return _0x3773fd[_0x314c('0x65')](_0x4ba992);}})[_0x314c('0x28')](function(_0x15660b){if(_0x15660b){_0x4a531c=_0x15660b[_0x314c('0x48')];if(!_0x38b5dc[_0x314c('0x33')]['hasOwnProperty']('nolimit')){_0x4ba992[_0x314c('0x20')]=qs[_0x314c('0x20')](_0x38b5dc[_0x314c('0x33')][_0x314c('0x20')]);_0x4ba992['offset']=qs[_0x314c('0x1e')](_0x38b5dc[_0x314c('0x33')][_0x314c('0x1e')]);}return _0x3773fd['getTeams'](_0x4ba992);}})[_0x314c('0x28')](function(_0x1d9baa){if(_0x1d9baa){return _0x1d9baa?{'count':_0x4a531c,'rows':_0x1d9baa}:null;}})[_0x314c('0x28')](respondWithResult(_0x1dfe9e,null))[_0x314c('0x4a')](handleError(_0x1dfe9e,null));};exports[_0x314c('0x66')]=function(_0x10052c,_0x1afc84,_0x170c98){var _0x529278=_0x10052c['body']['ids'];return db[_0x314c('0x67')][_0x314c('0x43')]({'where':{'id':_0x529278},'attributes':['id'],'include':[{'model':db[_0x314c('0x5c')],'as':'Agents','attributes':['id',_0x314c('0x2d'),_0x314c('0x68'),'voicePause',_0x314c('0x69')],'raw':!![]}]})[_0x314c('0x28')](function(_0x1e7d78){if(_0x1e7d78){var _0x4feb85=_[_0x314c('0x6a')](_0x1e7d78,function(_0x41688e){var _0x41ef05=_0x41688e[_0x314c('0x29')]({'plain':!![]});return _0x41ef05[_0x314c('0x6b')];});return db[_0x314c('0x49')][_0x314c('0x51')]({'where':{'id':_0x10052c[_0x314c('0x46')]['id']}})[_0x314c('0x28')](function(_0x1bd17f){return db[_0x314c('0x6c')][_0x314c('0x6d')](function(_0x3af67c){return _0x1bd17f[_0x314c('0x66')](_0x529278,{'transaction':_0x3af67c})[_0x314c('0x28')](function(){return BPromise[_0x314c('0x6e')](_0x4feb85,function(_0x114f88){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x114f88['id'],'WhatsappQueueId':_0x10052c['params']['id']},'transaction':_0x3af67c});});})[_0x314c('0x28')](function(){_0x4feb85[_0x314c('0x6f')](function(_0x59b2a2){socket[_0x314c('0x70')](_0x314c('0x71'),{'UserId':_0x59b2a2['id'],'WhatsappQueueId':_0x1bd17f['id']});});});});});}})[_0x314c('0x28')](respondWithStatusCode(_0x1afc84,null))[_0x314c('0x4a')](handleError(_0x1afc84,null));};exports[_0x314c('0x72')]=function(_0xd1597a,_0x6e649d,_0x53e36b){return db[_0x314c('0x67')]['findAll']({'where':{'id':_0xd1597a[_0x314c('0x33')]['ids']},'attributes':['id'],'include':[{'model':db[_0x314c('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x314c('0x28')](handleEntityNotFound(_0x6e649d,null))['then'](function(_0x209966){var _0x4db19a=_[_0x314c('0x2f')](_0x209966,'id');var _0x4814dc=[];var _0x4eb325=[];var _0x488879=squel[_0x314c('0x73')]();_0x488879[_0x314c('0x74')](_0x314c('0x75'))[_0x314c('0x76')](_0x314c('0x77'),'tq')[_0x314c('0x78')](_0x314c('0x79'),'ut',_0x314c('0x7a'))[_0x314c('0x3c')](_0x314c('0x7b'),_0xd1597a[_0x314c('0x46')]['id']);for(var _0x605a90=0x0;_0x605a90<_0x209966['length'];_0x605a90+=0x1){let _0xe9fd9e=_0x209966[_0x605a90];for(var _0x32aad7=0x0;_0x32aad7<_0xe9fd9e[_0x314c('0x6b')][_0x314c('0x48')];_0x32aad7+=0x1){let _0x579ff4=_0xe9fd9e[_0x314c('0x6b')][_0x32aad7];var _0x367c72=_0x488879['clone']();_0x367c72[_0x314c('0x3c')](_0x314c('0x7c'),_0x579ff4['id']);_0x4eb325[_0x314c('0x7d')](db[_0x314c('0x6c')][_0x314c('0x33')](_0x367c72[_0x314c('0x7e')](),{'type':db['sequelize'][_0x314c('0x7f')][_0x314c('0x80')]})[_0x314c('0x28')](function(_0x2da57e){if(_0x2da57e[_0x314c('0x48')]===0x1){return _0x579ff4['id'];}else{var _0x53b9fe=_['every'](_[_0x314c('0x2f')](_0x2da57e,_0x314c('0x81')),function(_0x45fb41){return _['includes'](_0x4db19a,_0x45fb41);});if(_0x53b9fe){return _0x579ff4['id'];}}}));}}return BPromise[_0x314c('0x82')](_0x4eb325)[_0x314c('0x28')](function(_0x3430a4){_0x4814dc=_(_0x4814dc)[_0x314c('0x83')](_0x3430a4)[_0x314c('0x84')]()[_0x314c('0x85')]();return db[_0x314c('0x49')][_0x314c('0x51')]({'where':{'id':_0xd1597a['params']['id']}})['then'](function(_0x56a25e){return db['sequelize'][_0x314c('0x6d')](function(_0x429ea8){return _0x56a25e[_0x314c('0x72')](_0xd1597a[_0x314c('0x33')]['ids'],{'transaction':_0x429ea8})[_0x314c('0x28')](function(){if(!_[_0x314c('0x86')](_0x4814dc)){return _0x56a25e[_0x314c('0x87')](_0x4814dc,{'transaction':_0x429ea8});}})[_0x314c('0x28')](function(){_0x4814dc[_0x314c('0x6f')](function(_0xcf1452){socket[_0x314c('0x70')]('userWhatsappQueue:remove',{'UserId':_0xcf1452,'WhatsappQueueId':_0x56a25e['id']});});});});});});})[_0x314c('0x28')](respondWithStatusCode(_0x6e649d,null))[_0x314c('0x4a')](handleError(_0x6e649d,null));};exports[_0x314c('0x88')]=function(_0x316b9d,_0x181129,_0xf94412){return db[_0x314c('0x49')][_0x314c('0x51')]({'where':{'id':_0x316b9d[_0x314c('0x46')]['id']}})[_0x314c('0x28')](handleEntityNotFound(_0x181129,null))[_0x314c('0x28')](function(_0x3078dc){if(_0x3078dc){return _0x3078dc[_0x314c('0x88')](_0x316b9d[_0x314c('0x4c')]['ids'],_[_0x314c('0x89')](_0x316b9d[_0x314c('0x4c')],['ids','id'])||{})[_0x314c('0x8a')](function(_0x5dd2e3){for(var _0xc25d75=0x0;_0xc25d75<_0x316b9d[_0x314c('0x4c')]['ids'][_0x314c('0x48')];_0xc25d75+=0x1){socket[_0x314c('0x70')](_0x314c('0x71'),{'UserId':Number(_0x316b9d['body']['ids'][_0xc25d75]),'WhatsappQueueId':Number(_0x316b9d['params']['id'])});}return _0x5dd2e3;});}})['then'](respondWithResult(_0x181129,null))[_0x314c('0x4a')](handleError(_0x181129,null));};exports[_0x314c('0x87')]=function(_0x373ebf,_0x5bf562,_0x516702){return db['WhatsappQueue'][_0x314c('0x51')]({'where':{'id':_0x373ebf[_0x314c('0x46')]['id']}})['then'](handleEntityNotFound(_0x5bf562,null))[_0x314c('0x28')](function(_0x4c869b){if(_0x4c869b){return _0x4c869b[_0x314c('0x87')](_0x373ebf[_0x314c('0x33')]['ids'])[_0x314c('0x28')](function(){if(_[_0x314c('0x8b')](_0x373ebf[_0x314c('0x33')]['ids'])){for(var _0x7bb817=0x0;_0x7bb817<_0x373ebf[_0x314c('0x33')]['ids'][_0x314c('0x48')];_0x7bb817+=0x1){socket[_0x314c('0x70')](_0x314c('0x8c'),{'UserId':Number(_0x373ebf['query'][_0x314c('0x8d')][_0x7bb817]),'WhatsappQueueId':Number(_0x373ebf['params']['id'])});}}else{socket[_0x314c('0x70')](_0x314c('0x8c'),{'UserId':Number(_0x373ebf[_0x314c('0x33')]['ids']),'WhatsappQueueId':Number(_0x373ebf[_0x314c('0x46')]['id'])});}});}})[_0x314c('0x28')](respondWithStatusCode(_0x5bf562,null))['catch'](handleError(_0x5bf562,null));};exports[_0x314c('0x8e')]=function(_0x71ab4e,_0x40e977,_0x9bc801){var _0x3b05d6={};var _0x7cdefd={};var _0x304973;var _0x262d94;return db[_0x314c('0x49')][_0x314c('0x58')]({'where':{'id':_0x71ab4e[_0x314c('0x46')]['id']}})['then'](handleEntityNotFound(_0x40e977,null))[_0x314c('0x28')](function(_0x3fe580){if(_0x3fe580){_0x304973=_0x3fe580;_0x7cdefd['model']=_['keys'](db[_0x314c('0x5c')]['rawAttributes']);_0x7cdefd[_0x314c('0x33')]=_[_0x314c('0x34')](_0x71ab4e['query']);_0x7cdefd[_0x314c('0x35')]=_['intersection'](_0x7cdefd[_0x314c('0x32')],_0x7cdefd[_0x314c('0x33')]);_0x3b05d6[_0x314c('0x37')]=_[_0x314c('0x36')](_0x7cdefd['model'],qs[_0x314c('0x38')](_0x71ab4e[_0x314c('0x33')][_0x314c('0x38')]));_0x3b05d6[_0x314c('0x37')]=_0x3b05d6['attributes'][_0x314c('0x48')]?_0x3b05d6['attributes']:_0x7cdefd['model'];_0x3b05d6['order']=qs[_0x314c('0x3b')](_0x71ab4e[_0x314c('0x33')][_0x314c('0x3b')]);_0x3b05d6[_0x314c('0x3c')]=qs['filters'](_[_0x314c('0x5b')](_0x71ab4e['query'],_0x7cdefd[_0x314c('0x35')]));if(_0x71ab4e[_0x314c('0x33')][_0x314c('0x3d')]){_0x3b05d6['where']=_[_0x314c('0x3f')](_0x3b05d6[_0x314c('0x3c')],{'$or':_[_0x314c('0x2f')](_0x3b05d6[_0x314c('0x37')],function(_0x6939bf){var _0x11a4a2={};_0x11a4a2[_0x6939bf]={'$like':'%'+_0x71ab4e[_0x314c('0x33')][_0x314c('0x3d')]+'%'};return _0x11a4a2;})});}_0x3b05d6=_['merge']({},_0x3b05d6,_0x71ab4e['options']);return _0x304973[_0x314c('0x8e')](_0x3b05d6);}})['then'](function(_0x3d9f8e){if(_0x3d9f8e){_0x262d94=_0x3d9f8e[_0x314c('0x48')];if(!_0x71ab4e[_0x314c('0x33')]['hasOwnProperty']('nolimit')){_0x3b05d6[_0x314c('0x20')]=qs[_0x314c('0x20')](_0x71ab4e[_0x314c('0x33')][_0x314c('0x20')]);_0x3b05d6[_0x314c('0x1e')]=qs[_0x314c('0x1e')](_0x71ab4e[_0x314c('0x33')][_0x314c('0x1e')]);}return _0x304973[_0x314c('0x8e')](_0x3b05d6);}})['then'](function(_0x44774f){if(_0x44774f){return _0x44774f?{'count':_0x262d94,'rows':_0x44774f}:null;}})[_0x314c('0x28')](respondWithResult(_0x40e977,null))['catch'](handleError(_0x40e977,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index e6708fc..1b8626b 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 _0x6c6d=['update','remove','emit','hook','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x6c6d,0x14d));var _0xd6c6=function(_0x35c4f1,_0x32c15f){_0x35c4f1=_0x35c4f1-0x0;var _0x354b8e=_0x6c6d[_0x35c4f1];return _0x354b8e;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xd6c6('0x0'))['db'][_0xd6c6('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd6c6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd6c6('0x3'),'afterDestroy':_0xd6c6('0x4')};function emitEvent(_0x11dd8f){return function(_0x66385f,_0x1539b3,_0x1c9d47){WhatsappQueueEvents['emit'](_0x11dd8f+':'+_0x66385f['id'],_0x66385f);WhatsappQueueEvents[_0xd6c6('0x5')](_0x11dd8f,_0x66385f);_0x1c9d47(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xd6c6('0x6')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0xf098=['hasOwnProperty','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','remove','emit'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xf098,0x109));var _0x8f09=function(_0x1b2b60,_0x1df6b9){_0x1b2b60=_0x1b2b60-0x0;var _0x57a997=_0xf098[_0x1b2b60];return _0x57a997;};'use strict';var EventEmitter=require(_0x8f09('0x0'));var WhatsappQueue=require(_0x8f09('0x1'))['db'][_0x8f09('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8f09('0x3')](0x0);var events={'afterCreate':_0x8f09('0x4'),'afterUpdate':'update','afterDestroy':_0x8f09('0x5')};function emitEvent(_0x357cc4){return function(_0x5df2cf,_0xa7070d,_0x40aae4){WhatsappQueueEvents[_0x8f09('0x6')](_0x357cc4+':'+_0x5df2cf['id'],_0x5df2cf);WhatsappQueueEvents['emit'](_0x357cc4,_0x5df2cf);_0x40aae4(null);};}for(var e in events){if(events[_0x8f09('0x7')](e)){var event=events[e];WhatsappQueue['hook'](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 beb51a0..9b652a9 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 _0xb2d2=['./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xe8f4fd,_0x17dc25){var _0xd98127=function(_0x180e70){while(--_0x180e70){_0xe8f4fd['push'](_0xe8f4fd['shift']());}};_0xd98127(++_0x17dc25);}(_0xb2d2,0x18b));var _0x2b2d=function(_0x2c19de,_0x15559a){_0x2c19de=_0x2c19de-0x0;var _0x4bb883=_0xb2d2[_0x2c19de];return _0x4bb883;};'use strict';var _=require('lodash');var util=require(_0x2b2d('0x0'));var logger=require(_0x2b2d('0x1'))(_0x2b2d('0x2'));var moment=require(_0x2b2d('0x3'));var BPromise=require('bluebird');var rp=require(_0x2b2d('0x4'));var fs=require('fs');var path=require(_0x2b2d('0x5'));var rimraf=require(_0x2b2d('0x6'));var config=require(_0x2b2d('0x7'));var attributes=require(_0x2b2d('0x8'));module[_0x2b2d('0x9')]=function(_0x11a74d,_0x954957){return _0x11a74d[_0x2b2d('0xa')](_0x2b2d('0xb'),attributes,{'tableName':_0x2b2d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda7b=['api','moment','request-promise','path','rimraf','./whatsappQueue.attributes','WhatsappQueue','lodash'];(function(_0x5827e7,_0x57d80d){var _0x1434e7=function(_0x42ec71){while(--_0x42ec71){_0x5827e7['push'](_0x5827e7['shift']());}};_0x1434e7(++_0x57d80d);}(_0xda7b,0x19f));var _0xbda7=function(_0x3fb35e,_0x16c773){_0x3fb35e=_0x3fb35e-0x0;var _0x4e3eb1=_0xda7b[_0x3fb35e];return _0x4e3eb1;};'use strict';var _=require(_0xbda7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbda7('0x1'));var moment=require(_0xbda7('0x2'));var BPromise=require('bluebird');var rp=require(_0xbda7('0x3'));var fs=require('fs');var path=require(_0xbda7('0x4'));var rimraf=require(_0xbda7('0x5'));var config=require('../../config/environment');var attributes=require(_0xbda7('0x6'));module['exports']=function(_0x4305c5,_0x2689ba){return _0x4305c5['define'](_0xbda7('0x7'),attributes,{'tableName':'whatsapp_queues','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 1016ea5..58e8e28 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 _0x4eeb=['register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','include','map','model','ShowWhatsappQueue','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./whatsappQueue.socket'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4eeb,0x95));var _0xb4ee=function(_0x90120c,_0x39c417){_0x90120c=_0x90120c-0x0;var _0x4848e2=_0x4eeb[_0x90120c];return _0x4848e2;};'use strict';var _=require('lodash');var util=require(_0xb4ee('0x0'));var moment=require(_0xb4ee('0x1'));var BPromise=require(_0xb4ee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4ee('0x3'));var db=require(_0xb4ee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb4ee('0x5'))(_0xb4ee('0x6'));var config=require(_0xb4ee('0x7'));var jayson=require(_0xb4ee('0x8'));var client=jayson[_0xb4ee('0x9')][_0xb4ee('0xa')]({'port':0x232a});config['redis']=_[_0xb4ee('0xb')](config[_0xb4ee('0xc')],{'host':_0xb4ee('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb4ee('0xc')]));require(_0xb4ee('0xe'))[_0xb4ee('0xf')](socket);function respondWithRpcPromise(_0x434487,_0x472f8f,_0xdfe242){return new BPromise(function(_0x132100,_0x2c68a8){return client[_0xb4ee('0x10')](_0x434487,_0xdfe242)[_0xb4ee('0x11')](function(_0x448899){logger[_0xb4ee('0x12')](_0xb4ee('0x13'),_0x472f8f,_0xb4ee('0x14'));logger[_0xb4ee('0x15')](_0xb4ee('0x16'),_0x472f8f,_0xb4ee('0x14'),JSON[_0xb4ee('0x17')](_0x448899));if(_0x448899[_0xb4ee('0x18')]){if(_0x448899[_0xb4ee('0x18')][_0xb4ee('0x19')]===0x1f4){logger[_0xb4ee('0x18')](_0xb4ee('0x13'),_0x472f8f,_0x448899[_0xb4ee('0x18')][_0xb4ee('0x1a')]);return _0x2c68a8(_0x448899['error'][_0xb4ee('0x1a')]);}logger[_0xb4ee('0x18')](_0xb4ee('0x13'),_0x472f8f,_0x448899[_0xb4ee('0x18')]['message']);return _0x132100(_0x448899['error'][_0xb4ee('0x1a')]);}else{logger[_0xb4ee('0x12')](_0xb4ee('0x13'),_0x472f8f,_0xb4ee('0x14'));_0x132100(_0x448899[_0xb4ee('0x1b')][_0xb4ee('0x1a')]);}})[_0xb4ee('0x1c')](function(_0x3d5f32){logger[_0xb4ee('0x18')](_0xb4ee('0x13'),_0x472f8f,_0x3d5f32);_0x2c68a8(_0x3d5f32);});});}exports[_0xb4ee('0x1d')]=function(_0x250217){var _0x1fbc92=this;return new Promise(function(_0xeacb6,_0x480846){return db[_0xb4ee('0x1e')][_0xb4ee('0x1f')]({'raw':_0x250217[_0xb4ee('0x20')]?_0x250217[_0xb4ee('0x20')][_0xb4ee('0x21')]===undefined?!![]:![]:!![],'where':_0x250217[_0xb4ee('0x20')]?_0x250217[_0xb4ee('0x20')][_0xb4ee('0x22')]||null:null,'attributes':_0x250217[_0xb4ee('0x20')]?_0x250217[_0xb4ee('0x20')][_0xb4ee('0x23')]||null:null,'limit':_0x250217[_0xb4ee('0x20')]?_0x250217[_0xb4ee('0x20')]['limit']||null:null,'include':_0x250217[_0xb4ee('0x20')]?_0x250217[_0xb4ee('0x20')][_0xb4ee('0x24')]?_[_0xb4ee('0x25')](_0x250217['options'][_0xb4ee('0x24')],function(_0xbf18f5){return{'model':db[_0xbf18f5[_0xb4ee('0x26')]],'as':_0xbf18f5['as'],'attributes':_0xbf18f5[_0xb4ee('0x23')],'include':_0xbf18f5[_0xb4ee('0x24')]?_[_0xb4ee('0x25')](_0xbf18f5[_0xb4ee('0x24')],function(_0x7650ec){return{'model':db[_0x7650ec[_0xb4ee('0x26')]],'as':_0x7650ec['as'],'attributes':_0x7650ec[_0xb4ee('0x23')],'include':_0x7650ec['include']?_[_0xb4ee('0x25')](_0x7650ec[_0xb4ee('0x24')],function(_0x198962){return{'model':db[_0x198962[_0xb4ee('0x26')]],'as':_0x198962['as'],'attributes':_0x198962['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d3ef5){logger[_0xb4ee('0x12')](_0xb4ee('0x1d'),_0x250217);logger[_0xb4ee('0x15')](_0xb4ee('0x1d'),_0x250217,JSON[_0xb4ee('0x17')](_0x2d3ef5));_0xeacb6(_0x2d3ef5);})[_0xb4ee('0x1c')](function(_0x3ae81c){logger[_0xb4ee('0x18')](_0xb4ee('0x1d'),_0x3ae81c[_0xb4ee('0x1a')],_0x250217);_0x480846(_0x1fbc92[_0xb4ee('0x18')](0x1f4,_0x3ae81c[_0xb4ee('0x1a')]));});});};exports[_0xb4ee('0x27')]=function(_0x14053b){var _0x47f376=this;return new Promise(function(_0x3a76d7,_0x2a572d){return db[_0xb4ee('0x1e')][_0xb4ee('0x28')]({'raw':_0x14053b[_0xb4ee('0x20')]?_0x14053b['options']['raw']===undefined?!![]:![]:!![],'where':_0x14053b['options']?_0x14053b['options'][_0xb4ee('0x22')]||null:null,'attributes':_0x14053b[_0xb4ee('0x20')]?_0x14053b[_0xb4ee('0x20')][_0xb4ee('0x23')]||null:null,'include':_0x14053b['options']?_0x14053b['options'][_0xb4ee('0x24')]?_['map'](_0x14053b[_0xb4ee('0x20')][_0xb4ee('0x24')],function(_0x1826b5){return{'model':db[_0x1826b5[_0xb4ee('0x26')]],'as':_0x1826b5['as'],'attributes':_0x1826b5['attributes'],'include':_0x1826b5[_0xb4ee('0x24')]?_[_0xb4ee('0x25')](_0x1826b5[_0xb4ee('0x24')],function(_0x298ed9){return{'model':db[_0x298ed9['model']],'as':_0x298ed9['as'],'attributes':_0x298ed9[_0xb4ee('0x23')],'include':_0x298ed9[_0xb4ee('0x24')]?_[_0xb4ee('0x25')](_0x298ed9['include'],function(_0x39cd95){return{'model':db[_0x39cd95[_0xb4ee('0x26')]],'as':_0x39cd95['as'],'attributes':_0x39cd95[_0xb4ee('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x414972){logger[_0xb4ee('0x12')](_0xb4ee('0x27'),_0x14053b);logger['debug'](_0xb4ee('0x27'),_0x14053b,JSON[_0xb4ee('0x17')](_0x414972));_0x3a76d7(_0x414972);})['catch'](function(_0x2f235a){logger[_0xb4ee('0x18')](_0xb4ee('0x27'),_0x2f235a[_0xb4ee('0x1a')],_0x14053b);_0x2a572d(_0x47f376[_0xb4ee('0x18')](0x1f4,_0x2f235a[_0xb4ee('0x1a')]));});});}; \ No newline at end of file +var _0xc289=['WhatsappQueue,\x20%s,\x20%s','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','include','map','model','attributes','debug','catch','ShowWhatsappQueue','find','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x515e9f,_0xff9586){var _0x19cbf0=function(_0xa2ae5c){while(--_0xa2ae5c){_0x515e9f['push'](_0x515e9f['shift']());}};_0x19cbf0(++_0xff9586);}(_0xc289,0xda));var _0x9c28=function(_0x4cbddd,_0x504c5e){_0x4cbddd=_0x4cbddd-0x0;var _0x4666a9=_0xc289[_0x4cbddd];return _0x4666a9;};'use strict';var _=require('lodash');var util=require(_0x9c28('0x0'));var moment=require('moment');var BPromise=require(_0x9c28('0x1'));var rs=require(_0x9c28('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c28('0x3'))['db'];var utils=require(_0x9c28('0x4'));var logger=require(_0x9c28('0x5'))('rpc');var config=require(_0x9c28('0x6'));var jayson=require(_0x9c28('0x7'));var client=jayson[_0x9c28('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x9c28('0x9')],{'host':_0x9c28('0xa'),'port':0x18eb});var socket=require(_0x9c28('0xb'))(new Redis(config[_0x9c28('0x9')]));require(_0x9c28('0xc'))[_0x9c28('0xd')](socket);function respondWithRpcPromise(_0x19bdf6,_0x1b157a,_0x14e9fc){return new BPromise(function(_0x52446f,_0x4cc78e){return client[_0x9c28('0xe')](_0x19bdf6,_0x14e9fc)[_0x9c28('0xf')](function(_0x17b0a8){logger[_0x9c28('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x1b157a,_0x9c28('0x11'));logger['debug'](_0x9c28('0x12'),_0x1b157a,_0x9c28('0x11'),JSON[_0x9c28('0x13')](_0x17b0a8));if(_0x17b0a8['error']){if(_0x17b0a8[_0x9c28('0x14')][_0x9c28('0x15')]===0x1f4){logger[_0x9c28('0x14')](_0x9c28('0x16'),_0x1b157a,_0x17b0a8[_0x9c28('0x14')][_0x9c28('0x17')]);return _0x4cc78e(_0x17b0a8[_0x9c28('0x14')]['message']);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x1b157a,_0x17b0a8[_0x9c28('0x14')][_0x9c28('0x17')]);return _0x52446f(_0x17b0a8[_0x9c28('0x14')]['message']);}else{logger[_0x9c28('0x10')](_0x9c28('0x16'),_0x1b157a,_0x9c28('0x11'));_0x52446f(_0x17b0a8[_0x9c28('0x18')][_0x9c28('0x17')]);}})['catch'](function(_0x25e712){logger[_0x9c28('0x14')](_0x9c28('0x16'),_0x1b157a,_0x25e712);_0x4cc78e(_0x25e712);});});}exports[_0x9c28('0x19')]=function(_0x177b9f){var _0x453bcd=this;return new Promise(function(_0x17e491,_0x35beb8){return db[_0x9c28('0x1a')][_0x9c28('0x1b')]({'raw':_0x177b9f[_0x9c28('0x1c')]?_0x177b9f[_0x9c28('0x1c')][_0x9c28('0x1d')]===undefined?!![]:![]:!![],'where':_0x177b9f['options']?_0x177b9f['options'][_0x9c28('0x1e')]||null:null,'attributes':_0x177b9f['options']?_0x177b9f[_0x9c28('0x1c')]['attributes']||null:null,'limit':_0x177b9f[_0x9c28('0x1c')]?_0x177b9f[_0x9c28('0x1c')][_0x9c28('0x1f')]||null:null,'include':_0x177b9f[_0x9c28('0x1c')]?_0x177b9f[_0x9c28('0x1c')][_0x9c28('0x20')]?_[_0x9c28('0x21')](_0x177b9f['options']['include'],function(_0x4ed7c3){return{'model':db[_0x4ed7c3['model']],'as':_0x4ed7c3['as'],'attributes':_0x4ed7c3['attributes'],'include':_0x4ed7c3[_0x9c28('0x20')]?_[_0x9c28('0x21')](_0x4ed7c3['include'],function(_0x57d5e5){return{'model':db[_0x57d5e5[_0x9c28('0x22')]],'as':_0x57d5e5['as'],'attributes':_0x57d5e5[_0x9c28('0x23')],'include':_0x57d5e5[_0x9c28('0x20')]?_[_0x9c28('0x21')](_0x57d5e5[_0x9c28('0x20')],function(_0x23356f){return{'model':db[_0x23356f[_0x9c28('0x22')]],'as':_0x23356f['as'],'attributes':_0x23356f[_0x9c28('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9c28('0xf')](function(_0x50a74b){logger[_0x9c28('0x10')](_0x9c28('0x19'),_0x177b9f);logger[_0x9c28('0x24')]('GetWhatsappQueue',_0x177b9f,JSON[_0x9c28('0x13')](_0x50a74b));_0x17e491(_0x50a74b);})[_0x9c28('0x25')](function(_0x42cfed){logger[_0x9c28('0x14')](_0x9c28('0x19'),_0x42cfed['message'],_0x177b9f);_0x35beb8(_0x453bcd['error'](0x1f4,_0x42cfed[_0x9c28('0x17')]));});});};exports[_0x9c28('0x26')]=function(_0x359cb3){var _0x3641da=this;return new Promise(function(_0x42a623,_0x369f27){return db['WhatsappQueue'][_0x9c28('0x27')]({'raw':_0x359cb3[_0x9c28('0x1c')]?_0x359cb3['options'][_0x9c28('0x1d')]===undefined?!![]:![]:!![],'where':_0x359cb3[_0x9c28('0x1c')]?_0x359cb3[_0x9c28('0x1c')][_0x9c28('0x1e')]||null:null,'attributes':_0x359cb3[_0x9c28('0x1c')]?_0x359cb3[_0x9c28('0x1c')][_0x9c28('0x23')]||null:null,'include':_0x359cb3[_0x9c28('0x1c')]?_0x359cb3[_0x9c28('0x1c')][_0x9c28('0x20')]?_[_0x9c28('0x21')](_0x359cb3[_0x9c28('0x1c')][_0x9c28('0x20')],function(_0x1529c9){return{'model':db[_0x1529c9[_0x9c28('0x22')]],'as':_0x1529c9['as'],'attributes':_0x1529c9['attributes'],'include':_0x1529c9[_0x9c28('0x20')]?_[_0x9c28('0x21')](_0x1529c9['include'],function(_0x1dfa92){return{'model':db[_0x1dfa92[_0x9c28('0x22')]],'as':_0x1dfa92['as'],'attributes':_0x1dfa92['attributes'],'include':_0x1dfa92[_0x9c28('0x20')]?_['map'](_0x1dfa92[_0x9c28('0x20')],function(_0xf4f6b3){return{'model':db[_0xf4f6b3[_0x9c28('0x22')]],'as':_0xf4f6b3['as'],'attributes':_0xf4f6b3[_0x9c28('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9c28('0xf')](function(_0x267849){logger[_0x9c28('0x10')](_0x9c28('0x26'),_0x359cb3);logger[_0x9c28('0x24')](_0x9c28('0x26'),_0x359cb3,JSON[_0x9c28('0x13')](_0x267849));_0x42a623(_0x267849);})[_0x9c28('0x25')](function(_0x5a1a3c){logger[_0x9c28('0x14')](_0x9c28('0x26'),_0x5a1a3c['message'],_0x359cb3);_0x369f27(_0x3641da[_0x9c28('0x14')](0x1f4,_0x5a1a3c[_0x9c28('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index b106adc..5f7ecd7 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 _0xf560=['update','removeListener','register','length','./whatsappQueue.events','save','remove'];(function(_0x237c6b,_0x4705de){var _0x7a5299=function(_0xc23533){while(--_0xc23533){_0x237c6b['push'](_0x237c6b['shift']());}};_0x7a5299(++_0x4705de);}(_0xf560,0x97));var _0x0f56=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf560[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappQueueEvents=require(_0x0f56('0x0'));var events=[_0x0f56('0x1'),_0x0f56('0x2'),_0x0f56('0x3')];function createListener(_0x56872f,_0x5a5fdd){return function(_0x40aa87){_0x5a5fdd['emit'](_0x56872f,_0x40aa87);};}function removeListener(_0x19f162,_0x3f6660){return function(){WhatsappQueueEvents[_0x0f56('0x4')](_0x19f162,_0x3f6660);};}exports[_0x0f56('0x5')]=function(_0x5bde6e){for(var _0x57dc1f=0x0,_0xd897e9=events[_0x0f56('0x6')];_0x57dc1f<_0xd897e9;_0x57dc1f++){var _0x413f8d=events[_0x57dc1f];var _0x18ed3f=createListener('whatsappQueue:'+_0x413f8d,_0x5bde6e);WhatsappQueueEvents['on'](_0x413f8d,_0x18ed3f);}}; \ No newline at end of file +var _0xaa59=['./whatsappQueue.events','save','emit','removeListener','register','whatsappQueue:'];(function(_0x3721d0,_0x58efb0){var _0x4ab47c=function(_0x3e38fa){while(--_0x3e38fa){_0x3721d0['push'](_0x3721d0['shift']());}};_0x4ab47c(++_0x58efb0);}(_0xaa59,0x1c8));var _0x9aa5=function(_0x33d8e7,_0x4fbbe7){_0x33d8e7=_0x33d8e7-0x0;var _0x4db5e1=_0xaa59[_0x33d8e7];return _0x4db5e1;};'use strict';var WhatsappQueueEvents=require(_0x9aa5('0x0'));var events=[_0x9aa5('0x1'),'remove','update'];function createListener(_0x1fc0d9,_0x5bb36d){return function(_0x1383ad){_0x5bb36d[_0x9aa5('0x2')](_0x1fc0d9,_0x1383ad);};}function removeListener(_0x48dbd3,_0x5c74e0){return function(){WhatsappQueueEvents[_0x9aa5('0x3')](_0x48dbd3,_0x5c74e0);};}exports[_0x9aa5('0x4')]=function(_0x43ab91){for(var _0x398f10=0x0,_0x208da9=events['length'];_0x398f10<_0x208da9;_0x398f10++){var _0x38c42f=events[_0x398f10];var _0x5beda7=createListener(_0x9aa5('0x5')+_0x38c42f,_0x43ab91);WhatsappQueueEvents['on'](_0x38c42f,_0x5beda7);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 9c98b15..c99a2b4 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 _0x6a44=['path','connect-timeout','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','describe','post','create','/:id','update','delete','exports','multer'];(function(_0x137b6e,_0x3988cd){var _0x13a0b3=function(_0x4d8647){while(--_0x4d8647){_0x137b6e['push'](_0x137b6e['shift']());}};_0x13a0b3(++_0x3988cd);}(_0x6a44,0x6f));var _0x46a4=function(_0x3b2bb0,_0x28d1d5){_0x3b2bb0=_0x3b2bb0-0x0;var _0x3b2cbf=_0x6a44[_0x3b2bb0];return _0x3b2cbf;};'use strict';var multer=require(_0x46a4('0x0'));var util=require('util');var path=require(_0x46a4('0x1'));var timeout=require(_0x46a4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x46a4('0x3'));var config=require(_0x46a4('0x4'));var controller=require(_0x46a4('0x5'));router[_0x46a4('0x6')]('/',auth[_0x46a4('0x7')](),controller[_0x46a4('0x8')]);router[_0x46a4('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x46a4('0x9')]);router[_0x46a4('0x6')]('/:id',auth[_0x46a4('0x7')](),controller['show']);router[_0x46a4('0xa')]('/',auth[_0x46a4('0x7')](),controller[_0x46a4('0xb')]);router['put'](_0x46a4('0xc'),auth['isAuthenticated'](),controller[_0x46a4('0xd')]);router[_0x46a4('0xe')]('/:id',auth[_0x46a4('0x7')](),controller['destroy']);module[_0x46a4('0xf')]=router; \ No newline at end of file +var _0x380f=['create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x310373,_0x4ffb23){var _0x201e9f=function(_0x54a160){while(--_0x54a160){_0x310373['push'](_0x310373['shift']());}};_0x201e9f(++_0x4ffb23);}(_0x380f,0xf7));var _0xf380=function(_0x270174,_0x16d1bd){_0x270174=_0x270174-0x0;var _0x43a694=_0x380f[_0x270174];return _0x43a694;};'use strict';var multer=require(_0xf380('0x0'));var util=require(_0xf380('0x1'));var path=require(_0xf380('0x2'));var timeout=require(_0xf380('0x3'));var express=require('express');var router=express[_0xf380('0x4')]();var fs_extra=require(_0xf380('0x5'));var auth=require(_0xf380('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf380('0x7'));var controller=require(_0xf380('0x8'));router[_0xf380('0x9')]('/',auth['isAuthenticated'](),controller[_0xf380('0xa')]);router[_0xf380('0x9')](_0xf380('0xb'),auth[_0xf380('0xc')](),controller[_0xf380('0xd')]);router[_0xf380('0x9')](_0xf380('0xe'),auth['isAuthenticated'](),controller[_0xf380('0xf')]);router[_0xf380('0x10')]('/',auth[_0xf380('0xc')](),controller[_0xf380('0x11')]);router[_0xf380('0x12')](_0xf380('0xe'),auth[_0xf380('0xc')](),controller[_0xf380('0x13')]);router[_0xf380('0x14')](_0xf380('0xe'),auth[_0xf380('0xc')](),controller[_0xf380('0x15')]);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 7a5a66c..ab4cc23 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(_0x4a3d5d,_0x14c2b4){var _0x4b23ad=function(_0x23c38b){while(--_0x23c38b){_0x4a3d5d['push'](_0x4a3d5d['shift']());}};_0x4b23ad(++_0x14c2b4);}(_0x7a54,0x106));var _0x47a5=function(_0x1b0e64,_0x1ad186){_0x1b0e64=_0x1b0e64-0x0;var _0x3df1ed=_0x7a54[_0x1b0e64];return _0x3df1ed;};'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(_0x43a42f,_0x1fb7d7){var _0x516ed9=function(_0xe53f9d){while(--_0xe53f9d){_0x43a42f['push'](_0x43a42f['shift']());}};_0x516ed9(++_0x1fb7d7);}(_0x7a54,0x106));var _0x47a5=function(_0x3ed841,_0x3fc8a7){_0x3ed841=_0x3ed841-0x0;var _0x52a1b3=_0x7a54[_0x3ed841];return _0x52a1b3;};'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 5a350b4..71950a1 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 _0xb10b=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','WhatsappQueueReport','includeAll','include','rows','show','params','find','catch','create','body','describe','eml-format','zip-dir'];(function(_0x21634c,_0x29aab8){var _0x58762c=function(_0x131b12){while(--_0x131b12){_0x21634c['push'](_0x21634c['shift']());}};_0x58762c(++_0x29aab8);}(_0xb10b,0x12a));var _0xbb10=function(_0x490c45,_0x97b829){_0x490c45=_0x490c45-0x0;var _0x82738e=_0xb10b[_0x490c45];return _0x82738e;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['WhatsappQueueReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'all':!![]}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x1c7fae){_0x2e0249[_0xbb10('0x43')]=_0x1c7fae;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x44')]=function(_0x331751,_0x23dc18){var _0x403beb={'raw':!![],'where':{'id':_0x331751[_0xbb10('0x45')]['id']}},_0x5e2cfa={};_0x5e2cfa[_0xbb10('0x2f')]=_['keys'](db['WhatsappQueueReport'][_0xbb10('0x2c')]);_0x5e2cfa['query']=_[_0xbb10('0x30')](_0x331751[_0xbb10('0x31')]);_0x5e2cfa['filters']=_[_0xbb10('0x32')](_0x5e2cfa[_0xbb10('0x2f')],_0x5e2cfa[_0xbb10('0x31')]);_0x403beb['attributes']=_[_0xbb10('0x32')](_0x5e2cfa[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x331751[_0xbb10('0x31')][_0xbb10('0x34')]));_0x403beb[_0xbb10('0x33')]=_0x403beb[_0xbb10('0x33')][_0xbb10('0x35')]?_0x403beb[_0xbb10('0x33')]:_0x5e2cfa[_0xbb10('0x2f')];if(_0x331751[_0xbb10('0x31')][_0xbb10('0x41')]){_0x403beb['include']=[{'all':!![]}];}_0x403beb=_[_0xbb10('0x3e')]({},_0x403beb,_0x331751[_0xbb10('0x3f')]);return db['WhatsappQueueReport'][_0xbb10('0x46')](_0x403beb)[_0xbb10('0x23')](handleEntityNotFound(_0x23dc18,null))[_0xbb10('0x23')](respondWithResult(_0x23dc18,null))[_0xbb10('0x47')](handleError(_0x23dc18,null));};exports[_0xbb10('0x48')]=function(_0x39f0de,_0x3e06b0){return db['WhatsappQueueReport']['create'](_0x39f0de[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x3e06b0,0xc9))[_0xbb10('0x47')](handleError(_0x3e06b0,null));};exports['update']=function(_0x5f0c12,_0x3cd6f3){if(_0x5f0c12[_0xbb10('0x49')]['id']){delete _0x5f0c12[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x40')][_0xbb10('0x46')]({'where':{'id':_0x5f0c12[_0xbb10('0x45')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x3cd6f3,null))[_0xbb10('0x23')](saveUpdates(_0x5f0c12[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x3cd6f3,null))['catch'](handleError(_0x3cd6f3,null));};exports['destroy']=function(_0x412e13,_0x467dba){return db[_0xbb10('0x40')][_0xbb10('0x46')]({'where':{'id':_0x412e13[_0xbb10('0x45')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x467dba,null))[_0xbb10('0x23')](removeEntity(_0x467dba,null))[_0xbb10('0x47')](handleError(_0x467dba,null));};exports[_0xbb10('0x4a')]=function(_0x1214f7,_0x19ca3e){return db[_0xbb10('0x40')][_0xbb10('0x4a')]()[_0xbb10('0x23')](respondWithResult(_0x19ca3e,null))[_0xbb10('0x47')](handleError(_0x19ca3e,null));}; \ No newline at end of file +var _0x0565=['length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','WhatsappQueueReport','includeAll','findAll','rows','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','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','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes'];(function(_0x56d8ab,_0x4a8fb0){var _0x4d1401=function(_0x5acca2){while(--_0x5acca2){_0x56d8ab['push'](_0x56d8ab['shift']());}};_0x4d1401(++_0x4a8fb0);}(_0x0565,0xf2));var _0x5056=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x0565[_0xac151d];return _0x111dba;};'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(){_0x5afbfe[_0x5056('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x267048,_0x25409f){return function(_0x5d1656){if(!_0x5d1656){_0x267048[_0x5056('0x25')](0x194);}return _0x5d1656;};}function handleError(_0x505ccf,_0x15f03f){_0x15f03f=_0x15f03f||0x1f4;return function(_0x39d539){logger[_0x5056('0x26')](_0x39d539[_0x5056('0x27')]);if(_0x39d539[_0x5056('0x28')]){delete _0x39d539['name'];}_0x505ccf[_0x5056('0x19')](_0x15f03f)[_0x5056('0x29')](_0x39d539);};}exports[_0x5056('0x2a')]=function(_0x2ac79a,_0x53e6db){var _0x24d33e={},_0x5b0270={},_0x70246c={'count':0x0,'rows':[]};var _0x49fe67=_['map'](db['WhatsappQueueReport'][_0x5056('0x2b')],function(_0x252f75){return{'name':_0x252f75['fieldName'],'type':_0x252f75[_0x5056('0x2c')][_0x5056('0x2d')]};});_0x5b0270[_0x5056('0x2e')]=_[_0x5056('0x2f')](_0x49fe67,_0x5056('0x28'));_0x5b0270[_0x5056('0x30')]=_[_0x5056('0x31')](_0x2ac79a[_0x5056('0x30')]);_0x5b0270[_0x5056('0x32')]=_[_0x5056('0x33')](_0x5b0270[_0x5056('0x2e')],_0x5b0270['query']);_0x24d33e['attributes']=_[_0x5056('0x33')](_0x5b0270[_0x5056('0x2e')],qs['fields'](_0x2ac79a[_0x5056('0x30')][_0x5056('0x34')]));_0x24d33e['attributes']=_0x24d33e[_0x5056('0x35')][_0x5056('0x36')]?_0x24d33e[_0x5056('0x35')]:_0x5b0270[_0x5056('0x2e')];if(!_0x2ac79a[_0x5056('0x30')][_0x5056('0x37')](_0x5056('0x38'))){_0x24d33e[_0x5056('0x1d')]=qs[_0x5056('0x1d')](_0x2ac79a[_0x5056('0x30')][_0x5056('0x1d')]);_0x24d33e[_0x5056('0x1c')]=qs[_0x5056('0x1c')](_0x2ac79a[_0x5056('0x30')][_0x5056('0x1c')]);}_0x24d33e['order']=qs[_0x5056('0x39')](_0x2ac79a['query'][_0x5056('0x39')]);_0x24d33e[_0x5056('0x3a')]=qs[_0x5056('0x32')](_[_0x5056('0x3b')](_0x2ac79a['query'],_0x5b0270[_0x5056('0x32')]),_0x49fe67);if(_0x2ac79a[_0x5056('0x30')]['filter']){_0x24d33e[_0x5056('0x3a')]=_['merge'](_0x24d33e[_0x5056('0x3a')],{'$or':_[_0x5056('0x2f')](_0x49fe67,function(_0x3d56cf){if(_0x3d56cf['type']!==_0x5056('0x3c')){var _0x16a940={};_0x16a940[_0x3d56cf[_0x5056('0x28')]]={'$like':'%'+_0x2ac79a[_0x5056('0x30')][_0x5056('0x3d')]+'%'};return _0x16a940;}})});}_0x24d33e=_[_0x5056('0x3e')]({},_0x24d33e,_0x2ac79a[_0x5056('0x3f')]);var _0x21aa75={'where':_0x24d33e[_0x5056('0x3a')]};return db[_0x5056('0x40')][_0x5056('0x1f')](_0x21aa75)[_0x5056('0x23')](function(_0xc1024a){_0x70246c[_0x5056('0x1f')]=_0xc1024a;if(_0x2ac79a[_0x5056('0x30')][_0x5056('0x41')]){_0x24d33e['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x5056('0x42')](_0x24d33e);})[_0x5056('0x23')](function(_0x6946b4){_0x70246c[_0x5056('0x43')]=_0x6946b4;return _0x70246c;})[_0x5056('0x23')](respondWithFilteredResult(_0x53e6db,_0x24d33e))[_0x5056('0x44')](handleError(_0x53e6db,null));};exports[_0x5056('0x45')]=function(_0x2bf472,_0x48ab5e){var _0x58f12f={'raw':!![],'where':{'id':_0x2bf472[_0x5056('0x46')]['id']}},_0x68a385={};_0x68a385[_0x5056('0x2e')]=_['keys'](db[_0x5056('0x40')]['rawAttributes']);_0x68a385[_0x5056('0x30')]=_[_0x5056('0x31')](_0x2bf472[_0x5056('0x30')]);_0x68a385[_0x5056('0x32')]=_[_0x5056('0x33')](_0x68a385[_0x5056('0x2e')],_0x68a385['query']);_0x58f12f[_0x5056('0x35')]=_[_0x5056('0x33')](_0x68a385[_0x5056('0x2e')],qs['fields'](_0x2bf472['query']['fields']));_0x58f12f['attributes']=_0x58f12f[_0x5056('0x35')][_0x5056('0x36')]?_0x58f12f[_0x5056('0x35')]:_0x68a385[_0x5056('0x2e')];if(_0x2bf472[_0x5056('0x30')]['includeAll']){_0x58f12f['include']=[{'all':!![]}];}_0x58f12f=_[_0x5056('0x3e')]({},_0x58f12f,_0x2bf472[_0x5056('0x3f')]);return db[_0x5056('0x40')][_0x5056('0x47')](_0x58f12f)[_0x5056('0x23')](handleEntityNotFound(_0x48ab5e,null))[_0x5056('0x23')](respondWithResult(_0x48ab5e,null))[_0x5056('0x44')](handleError(_0x48ab5e,null));};exports['create']=function(_0x52d6ea,_0x14e3f5){return db[_0x5056('0x40')]['create'](_0x52d6ea[_0x5056('0x48')],{})[_0x5056('0x23')](respondWithResult(_0x14e3f5,0xc9))['catch'](handleError(_0x14e3f5,null));};exports['update']=function(_0x83d8e4,_0x1ab1a9){if(_0x83d8e4['body']['id']){delete _0x83d8e4['body']['id'];}return db[_0x5056('0x40')][_0x5056('0x47')]({'where':{'id':_0x83d8e4['params']['id']}})['then'](handleEntityNotFound(_0x1ab1a9,null))[_0x5056('0x23')](saveUpdates(_0x83d8e4[_0x5056('0x48')],null))[_0x5056('0x23')](respondWithResult(_0x1ab1a9,null))[_0x5056('0x44')](handleError(_0x1ab1a9,null));};exports[_0x5056('0x24')]=function(_0xdf427c,_0x97f7d8){return db[_0x5056('0x40')][_0x5056('0x47')]({'where':{'id':_0xdf427c[_0x5056('0x46')]['id']}})[_0x5056('0x23')](handleEntityNotFound(_0x97f7d8,null))[_0x5056('0x23')](removeEntity(_0x97f7d8,null))[_0x5056('0x44')](handleError(_0x97f7d8,null));};exports[_0x5056('0x49')]=function(_0x34e86e,_0x4bf758){return db['WhatsappQueueReport'][_0x5056('0x49')]()[_0x5056('0x23')](respondWithResult(_0x4bf758,null))[_0x5056('0x44')](handleError(_0x4bf758,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index b8e4158..b6c8e5d 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 _0xf9da=['request-promise','rimraf','../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x527ed8,_0x3ef7c1){var _0x551f3c=function(_0x2e9b7b){while(--_0x2e9b7b){_0x527ed8['push'](_0x527ed8['shift']());}};_0x551f3c(++_0x3ef7c1);}(_0xf9da,0x10c));var _0xaf9d=function(_0x13eda2,_0x1d3123){_0x13eda2=_0x13eda2-0x0;var _0x49c0d1=_0xf9da[_0x13eda2];return _0x49c0d1;};'use strict';var _=require(_0xaf9d('0x0'));var util=require(_0xaf9d('0x1'));var logger=require(_0xaf9d('0x2'))('api');var moment=require(_0xaf9d('0x3'));var BPromise=require(_0xaf9d('0x4'));var rp=require(_0xaf9d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf9d('0x6'));var config=require(_0xaf9d('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0xaf9d('0x8')]=function(_0x24554f,_0x24b53d){return _0x24554f[_0xaf9d('0x9')](_0xaf9d('0xa'),attributes,{'tableName':_0xaf9d('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xaf9d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4794=['../../config/environment','./whatsappQueueReport.attributes','exports','define','uniqueid','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4794,0x71));var _0x4479=function(_0x2ae9c7,_0x144053){_0x2ae9c7=_0x2ae9c7-0x0;var _0xc44373=_0x4794[_0x2ae9c7];return _0xc44373;};'use strict';var _=require(_0x4479('0x0'));var util=require(_0x4479('0x1'));var logger=require('../../config/logger')(_0x4479('0x2'));var moment=require(_0x4479('0x3'));var BPromise=require(_0x4479('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4479('0x5'));var rimraf=require(_0x4479('0x6'));var config=require(_0x4479('0x7'));var attributes=require(_0x4479('0x8'));module[_0x4479('0x9')]=function(_0x5df7a9,_0x5fa2ee){return _0x5df7a9[_0x4479('0xa')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4479('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index f8fee4d..91e7b81 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 _0x1e39=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','update','where','attributes','UpdateWhatsappQueueReport','util','moment','bluebird','randomstring'];(function(_0x455658,_0x38f71d){var _0x300d4a=function(_0x212df4){while(--_0x212df4){_0x455658['push'](_0x455658['shift']());}};_0x300d4a(++_0x38f71d);}(_0x1e39,0xc2));var _0x91e3=function(_0xa98302,_0x844f27){_0xa98302=_0xa98302-0x0;var _0x1ad8e3=_0x1e39[_0xa98302];return _0x1ad8e3;};'use strict';var _=require('lodash');var util=require(_0x91e3('0x0'));var moment=require(_0x91e3('0x1'));var BPromise=require(_0x91e3('0x2'));var rs=require(_0x91e3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91e3('0x4'))['db'];var utils=require(_0x91e3('0x5'));var logger=require(_0x91e3('0x6'))('rpc');var config=require(_0x91e3('0x7'));var jayson=require(_0x91e3('0x8'));var client=jayson[_0x91e3('0x9')][_0x91e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x184435,_0x17a419,_0x2eda89){return new BPromise(function(_0x2fdb50,_0x3cb448){return client[_0x91e3('0xb')](_0x184435,_0x2eda89)[_0x91e3('0xc')](function(_0x11e628){logger[_0x91e3('0xd')](_0x91e3('0xe'),_0x17a419,_0x91e3('0xf'));logger[_0x91e3('0x10')](_0x91e3('0x11'),_0x17a419,_0x91e3('0xf'),JSON[_0x91e3('0x12')](_0x11e628));if(_0x11e628[_0x91e3('0x13')]){if(_0x11e628[_0x91e3('0x13')][_0x91e3('0x14')]===0x1f4){logger[_0x91e3('0x13')](_0x91e3('0xe'),_0x17a419,_0x11e628[_0x91e3('0x13')][_0x91e3('0x15')]);return _0x3cb448(_0x11e628[_0x91e3('0x13')]['message']);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x17a419,_0x11e628['error'][_0x91e3('0x15')]);return _0x2fdb50(_0x11e628[_0x91e3('0x13')][_0x91e3('0x15')]);}else{logger[_0x91e3('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x17a419,'request\x20sent');_0x2fdb50(_0x11e628['result'][_0x91e3('0x15')]);}})[_0x91e3('0x16')](function(_0x4ef4e4){logger[_0x91e3('0x13')](_0x91e3('0xe'),_0x17a419,_0x4ef4e4);_0x3cb448(_0x4ef4e4);});});}exports[_0x91e3('0x17')]=function(_0x5bb189){var _0x4ee5de=this;return new Promise(function(_0x35ae45,_0x1b3818){return db[_0x91e3('0x18')][_0x91e3('0x19')](_0x5bb189[_0x91e3('0x1a')],{'raw':_0x5bb189[_0x91e3('0x1b')]?_0x5bb189[_0x91e3('0x1b')][_0x91e3('0x1c')]===undefined?!![]:![]:!![]})[_0x91e3('0xc')](function(_0x56c25f){logger[_0x91e3('0xd')](_0x91e3('0x17'),_0x5bb189);logger['debug'](_0x91e3('0x17'),_0x5bb189,JSON['stringify'](_0x56c25f));_0x35ae45(_0x56c25f);})[_0x91e3('0x16')](function(_0x1fd273){logger[_0x91e3('0x13')](_0x91e3('0x17'),_0x1fd273['message'],_0x5bb189);_0x1b3818(_0x4ee5de[_0x91e3('0x13')](0x1f4,_0x1fd273[_0x91e3('0x15')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x5468f5){var _0x24624e=this;return new Promise(function(_0x40a755,_0x2b351b){return db['WhatsappQueueReport'][_0x91e3('0x1d')](_0x5468f5[_0x91e3('0x1a')],{'raw':_0x5468f5[_0x91e3('0x1b')]?_0x5468f5[_0x91e3('0x1b')][_0x91e3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5468f5[_0x91e3('0x1b')]?_0x5468f5[_0x91e3('0x1b')][_0x91e3('0x1e')]||null:null,'attributes':_0x5468f5[_0x91e3('0x1b')]?_0x5468f5['options'][_0x91e3('0x1f')]||null:null,'limit':_0x5468f5[_0x91e3('0x1b')]?_0x5468f5['options']['limit']||null:null})['then'](function(_0x2f67bf){logger[_0x91e3('0xd')](_0x91e3('0x20'),_0x5468f5);logger[_0x91e3('0x10')]('UpdateWhatsappQueueReport',_0x5468f5,JSON[_0x91e3('0x12')](_0x2f67bf));_0x40a755(_0x2f67bf);})[_0x91e3('0x16')](function(_0x2500ee){logger[_0x91e3('0x13')]('UpdateWhatsappQueueReport',_0x2500ee[_0x91e3('0x15')],_0x5468f5);_0x2b351b(_0x24624e[_0x91e3('0x13')](0x1f4,_0x2500ee[_0x91e3('0x15')]));});});}; \ No newline at end of file +var _0x8d7d=['request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2a6ba9,_0x28dfd2){var _0x5f264a=function(_0x349192){while(--_0x349192){_0x2a6ba9['push'](_0x2a6ba9['shift']());}};_0x5f264a(++_0x28dfd2);}(_0x8d7d,0x18b));var _0xd8d7=function(_0x440a89,_0x14d823){_0x440a89=_0x440a89-0x0;var _0x46a9e8=_0x8d7d[_0x440a89];return _0x46a9e8;};'use strict';var _=require(_0xd8d7('0x0'));var util=require('util');var moment=require(_0xd8d7('0x1'));var BPromise=require(_0xd8d7('0x2'));var rs=require(_0xd8d7('0x3'));var fs=require('fs');var Redis=require(_0xd8d7('0x4'));var db=require(_0xd8d7('0x5'))['db'];var utils=require(_0xd8d7('0x6'));var logger=require(_0xd8d7('0x7'))(_0xd8d7('0x8'));var config=require(_0xd8d7('0x9'));var jayson=require(_0xd8d7('0xa'));var client=jayson[_0xd8d7('0xb')][_0xd8d7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x514372,_0x3882d4,_0x39b1d5){return new BPromise(function(_0x364c33,_0x22b002){return client[_0xd8d7('0xd')](_0x514372,_0x39b1d5)[_0xd8d7('0xe')](function(_0x1a89c9){logger[_0xd8d7('0xf')](_0xd8d7('0x10'),_0x3882d4,_0xd8d7('0x11'));logger[_0xd8d7('0x12')](_0xd8d7('0x13'),_0x3882d4,_0xd8d7('0x11'),JSON[_0xd8d7('0x14')](_0x1a89c9));if(_0x1a89c9[_0xd8d7('0x15')]){if(_0x1a89c9['error'][_0xd8d7('0x16')]===0x1f4){logger[_0xd8d7('0x15')](_0xd8d7('0x10'),_0x3882d4,_0x1a89c9[_0xd8d7('0x15')][_0xd8d7('0x17')]);return _0x22b002(_0x1a89c9[_0xd8d7('0x15')][_0xd8d7('0x17')]);}logger[_0xd8d7('0x15')](_0xd8d7('0x10'),_0x3882d4,_0x1a89c9['error'][_0xd8d7('0x17')]);return _0x364c33(_0x1a89c9[_0xd8d7('0x15')][_0xd8d7('0x17')]);}else{logger[_0xd8d7('0xf')](_0xd8d7('0x10'),_0x3882d4,_0xd8d7('0x11'));_0x364c33(_0x1a89c9[_0xd8d7('0x18')]['message']);}})[_0xd8d7('0x19')](function(_0x14b577){logger[_0xd8d7('0x15')](_0xd8d7('0x10'),_0x3882d4,_0x14b577);_0x22b002(_0x14b577);});});}exports[_0xd8d7('0x1a')]=function(_0x3622e7){var _0x2c67cc=this;return new Promise(function(_0xa0b6f,_0x390e5d){return db[_0xd8d7('0x1b')]['create'](_0x3622e7[_0xd8d7('0x1c')],{'raw':_0x3622e7[_0xd8d7('0x1d')]?_0x3622e7[_0xd8d7('0x1d')][_0xd8d7('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x56b71a){logger[_0xd8d7('0xf')](_0xd8d7('0x1a'),_0x3622e7);logger[_0xd8d7('0x12')]('CreateWhatsappQueueReport',_0x3622e7,JSON[_0xd8d7('0x14')](_0x56b71a));_0xa0b6f(_0x56b71a);})[_0xd8d7('0x19')](function(_0x595d90){logger[_0xd8d7('0x15')]('CreateWhatsappQueueReport',_0x595d90[_0xd8d7('0x17')],_0x3622e7);_0x390e5d(_0x2c67cc[_0xd8d7('0x15')](0x1f4,_0x595d90[_0xd8d7('0x17')]));});});};exports[_0xd8d7('0x1f')]=function(_0x1bff8d){var _0x9ed9fe=this;return new Promise(function(_0x566baa,_0x5544d3){return db[_0xd8d7('0x1b')]['update'](_0x1bff8d['body'],{'raw':_0x1bff8d[_0xd8d7('0x1d')]?_0x1bff8d['options'][_0xd8d7('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bff8d[_0xd8d7('0x1d')]?_0x1bff8d[_0xd8d7('0x1d')][_0xd8d7('0x20')]||null:null,'attributes':_0x1bff8d['options']?_0x1bff8d[_0xd8d7('0x1d')]['attributes']||null:null,'limit':_0x1bff8d[_0xd8d7('0x1d')]?_0x1bff8d[_0xd8d7('0x1d')][_0xd8d7('0x21')]||null:null})[_0xd8d7('0xe')](function(_0x5f0b97){logger[_0xd8d7('0xf')](_0xd8d7('0x1f'),_0x1bff8d);logger['debug'](_0xd8d7('0x1f'),_0x1bff8d,JSON[_0xd8d7('0x14')](_0x5f0b97));_0x566baa(_0x5f0b97);})[_0xd8d7('0x19')](function(_0x7b26b){logger[_0xd8d7('0x15')](_0xd8d7('0x1f'),_0x7b26b[_0xd8d7('0x17')],_0x1bff8d);_0x5544d3(_0x9ed9fe[_0xd8d7('0x15')](0x1f4,_0x7b26b[_0xd8d7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 91c8b37..bf20e5c 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 _0xf263=['update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put'];(function(_0x4eb082,_0x5ee5de){var _0x2f17e0=function(_0x189b86){while(--_0x189b86){_0x4eb082['push'](_0x4eb082['shift']());}};_0x2f17e0(++_0x5ee5de);}(_0xf263,0xea));var _0x3f26=function(_0x385eb1,_0x497a94){_0x385eb1=_0x385eb1-0x0;var _0x5d40eb=_0xf263[_0x385eb1];return _0x5d40eb;};'use strict';var multer=require(_0x3f26('0x0'));var util=require(_0x3f26('0x1'));var path=require(_0x3f26('0x2'));var timeout=require(_0x3f26('0x3'));var express=require('express');var router=express[_0x3f26('0x4')]();var fs_extra=require(_0x3f26('0x5'));var auth=require(_0x3f26('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3f26('0x7'));var controller=require(_0x3f26('0x8'));router[_0x3f26('0x9')]('/',auth['isAuthenticated'](),controller[_0x3f26('0xa')]);router['get'](_0x3f26('0xb'),auth[_0x3f26('0xc')](),controller[_0x3f26('0xd')]);router[_0x3f26('0x9')](_0x3f26('0xe'),auth['isAuthenticated'](),controller[_0x3f26('0xf')]);router['post']('/',auth[_0x3f26('0xc')](),controller[_0x3f26('0x10')]);router[_0x3f26('0x11')](_0x3f26('0xe'),auth[_0x3f26('0xc')](),controller[_0x3f26('0x12')]);router[_0x3f26('0x13')](_0x3f26('0xe'),auth[_0x3f26('0xc')](),controller[_0x3f26('0x14')]);module['exports']=router; \ No newline at end of file +var _0xb5df=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x1cfcff,_0x3ffcc3){var _0x4af22f=function(_0x201682){while(--_0x201682){_0x1cfcff['push'](_0x1cfcff['shift']());}};_0x4af22f(++_0x3ffcc3);}(_0xb5df,0x1f2));var _0xfb5d=function(_0x2c5e11,_0xc62935){_0x2c5e11=_0x2c5e11-0x0;var _0xaf490f=_0xb5df[_0x2c5e11];return _0xaf490f;};'use strict';var multer=require(_0xfb5d('0x0'));var util=require(_0xfb5d('0x1'));var path=require(_0xfb5d('0x2'));var timeout=require(_0xfb5d('0x3'));var express=require(_0xfb5d('0x4'));var router=express[_0xfb5d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfb5d('0x6'));var interaction=require(_0xfb5d('0x7'));var config=require(_0xfb5d('0x8'));var controller=require(_0xfb5d('0x9'));router[_0xfb5d('0xa')]('/',auth[_0xfb5d('0xb')](),controller[_0xfb5d('0xc')]);router[_0xfb5d('0xa')](_0xfb5d('0xd'),auth['isAuthenticated'](),controller[_0xfb5d('0xe')]);router[_0xfb5d('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xfb5d('0xf')]);router[_0xfb5d('0x10')]('/',auth[_0xfb5d('0xb')](),controller[_0xfb5d('0x11')]);router['put'](_0xfb5d('0x12'),auth[_0xfb5d('0xb')](),controller[_0xfb5d('0x13')]);router['delete'](_0xfb5d('0x12'),auth[_0xfb5d('0xb')](),controller[_0xfb5d('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 91e0ddd..00f691a 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 _0xa908=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xa908,0x1c3));var _0x8a90=function(_0x4629ee,_0x5802d8){_0x4629ee=_0x4629ee-0x0;var _0x47fb5b=_0xa908[_0x4629ee];return _0x47fb5b;};'use strict';var Sequelize=require(_0x8a90('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8a90('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8a90('0x2'),_0x8a90('0x3'),_0x8a90('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x8a90('0x5')]}}; \ No newline at end of file +var _0xb12d=['STRING','account','queue','DATE','sequelize','exports'];(function(_0x305486,_0x3cac45){var _0x59ca18=function(_0x512cfd){while(--_0x512cfd){_0x305486['push'](_0x305486['shift']());}};_0x59ca18(++_0x3cac45);}(_0xb12d,0x124));var _0xdb12=function(_0x419550,_0x15cdf1){_0x419550=_0x419550-0x0;var _0x55f9ef=_0xb12d[_0x419550];return _0x55f9ef;};'use strict';var Sequelize=require(_0xdb12('0x0'));module[_0xdb12('0x1')]={'uniqueid':{'type':Sequelize[_0xdb12('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xdb12('0x3'),'agent',_0xdb12('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xdb12('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index e47099d..6aa90fb 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 _0x1635=['status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','catch','show','params','keys','fields','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end'];(function(_0x26391b,_0x4382d1){var _0x180277=function(_0x421a0a){while(--_0x421a0a){_0x26391b['push'](_0x26391b['shift']());}};_0x180277(++_0x4382d1);}(_0x1635,0x1ae));var _0x5163=function(_0x1fc0a7,_0x395038){_0x1fc0a7=_0x1fc0a7-0x0;var _0x18209a=_0x1635[_0x1fc0a7];return _0x18209a;};'use strict';var emlformat=require(_0x5163('0x0'));var rimraf=require(_0x5163('0x1'));var zipdir=require(_0x5163('0x2'));var jsonpatch=require(_0x5163('0x3'));var rp=require(_0x5163('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5163('0x5'));var sox=require(_0x5163('0x6'));var csv=require(_0x5163('0x7'));var ejs=require(_0x5163('0x8'));var fs=require('fs');var fs_extra=require(_0x5163('0x9'));var _=require(_0x5163('0xa'));var squel=require(_0x5163('0xb'));var crypto=require(_0x5163('0xc'));var jsforce=require(_0x5163('0xd'));var deskjs=require(_0x5163('0xe'));var toCsv=require(_0x5163('0x7'));var querystring=require('querystring');var Papa=require(_0x5163('0xf'));var Redis=require('ioredis');var authService=require(_0x5163('0x10'));var qs=require(_0x5163('0x11'));var as=require(_0x5163('0x12'));var hardwareService=require(_0x5163('0x13'));var logger=require(_0x5163('0x14'))(_0x5163('0x15'));var utils=require(_0x5163('0x16'));var config=require(_0x5163('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c48d9,_0x3d9970){_0x3d9970=_0x3d9970||0xcc;return function(_0x20bcfd){if(_0x20bcfd){return _0x3c48d9[_0x5163('0x18')](_0x3d9970);}return _0x3c48d9['status'](_0x3d9970)[_0x5163('0x19')]();};}function respondWithResult(_0x264a23,_0x11e4f6){_0x11e4f6=_0x11e4f6||0xc8;return function(_0xb807bb){if(_0xb807bb){return _0x264a23[_0x5163('0x1a')](_0x11e4f6)['json'](_0xb807bb);}};}function respondWithFilteredResult(_0x5d5380,_0x476907){return function(_0x35af98){if(_0x35af98){var _0x3b583c=typeof _0x476907[_0x5163('0x1b')]===_0x5163('0x1c')&&typeof _0x476907[_0x5163('0x1d')]==='undefined';var _0xc329bf=_0x35af98[_0x5163('0x1e')];var _0x1e86fb=_0x3b583c?0x0:_0x476907[_0x5163('0x1b')];var _0x32e811=_0x3b583c?_0x35af98[_0x5163('0x1e')]:_0x476907[_0x5163('0x1b')]+_0x476907[_0x5163('0x1d')];var _0x19c860;if(_0x32e811>=_0xc329bf){_0x32e811=_0xc329bf;_0x19c860=0xc8;}else{_0x19c860=0xce;}_0x5d5380['status'](_0x19c860);return _0x5d5380[_0x5163('0x1f')]('Content-Range',_0x1e86fb+'-'+_0x32e811+'/'+_0xc329bf)[_0x5163('0x20')](_0x35af98);}return null;};}function patchUpdates(_0x2f8172){return function(_0x2467b1){try{jsonpatch[_0x5163('0x21')](_0x2467b1,_0x2f8172,!![]);}catch(_0x47ce3d){return BPromise[_0x5163('0x22')](_0x47ce3d);}return _0x2467b1[_0x5163('0x23')]();};}function saveUpdates(_0x57c039,_0x5286d2){return function(_0x48bedc){if(_0x48bedc){return _0x48bedc[_0x5163('0x24')](_0x57c039)[_0x5163('0x25')](function(_0x4ac943){return _0x4ac943;});}return null;};}function removeEntity(_0x159eb1,_0x134253){return function(_0xbe8f13){if(_0xbe8f13){return _0xbe8f13[_0x5163('0x26')]()[_0x5163('0x25')](function(){_0x159eb1[_0x5163('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x338508,_0x26ee92){return function(_0x281c5b){if(!_0x281c5b){_0x338508['sendStatus'](0x194);}return _0x281c5b;};}function handleError(_0x5a5e36,_0x227b4b){_0x227b4b=_0x227b4b||0x1f4;return function(_0x19b5a4){logger[_0x5163('0x27')](_0x19b5a4[_0x5163('0x28')]);if(_0x19b5a4[_0x5163('0x29')]){delete _0x19b5a4[_0x5163('0x29')];}_0x5a5e36[_0x5163('0x1a')](_0x227b4b)[_0x5163('0x2a')](_0x19b5a4);};}exports[_0x5163('0x2b')]=function(_0x1f3186,_0xe1b16b){var _0x1fe9d3={},_0xb9d09e={},_0x134147={'count':0x0,'rows':[]};var _0x399ab5=_[_0x5163('0x2c')](db[_0x5163('0x2d')][_0x5163('0x2e')],function(_0x8f7a27){return{'name':_0x8f7a27[_0x5163('0x2f')],'type':_0x8f7a27[_0x5163('0x30')]['key']};});_0xb9d09e[_0x5163('0x31')]=_[_0x5163('0x2c')](_0x399ab5,_0x5163('0x29'));_0xb9d09e['query']=_['keys'](_0x1f3186[_0x5163('0x32')]);_0xb9d09e[_0x5163('0x33')]=_[_0x5163('0x34')](_0xb9d09e[_0x5163('0x31')],_0xb9d09e['query']);_0x1fe9d3[_0x5163('0x35')]=_[_0x5163('0x34')](_0xb9d09e[_0x5163('0x31')],qs['fields'](_0x1f3186['query']['fields']));_0x1fe9d3[_0x5163('0x35')]=_0x1fe9d3['attributes'][_0x5163('0x36')]?_0x1fe9d3[_0x5163('0x35')]:_0xb9d09e[_0x5163('0x31')];if(!_0x1f3186[_0x5163('0x32')][_0x5163('0x37')](_0x5163('0x38'))){_0x1fe9d3[_0x5163('0x1d')]=qs[_0x5163('0x1d')](_0x1f3186['query'][_0x5163('0x1d')]);_0x1fe9d3[_0x5163('0x1b')]=qs[_0x5163('0x1b')](_0x1f3186[_0x5163('0x32')]['offset']);}_0x1fe9d3[_0x5163('0x39')]=qs[_0x5163('0x3a')](_0x1f3186[_0x5163('0x32')]['sort']);_0x1fe9d3[_0x5163('0x3b')]=qs[_0x5163('0x33')](_[_0x5163('0x3c')](_0x1f3186[_0x5163('0x32')],_0xb9d09e['filters']),_0x399ab5);if(_0x1f3186['query']['filter']){_0x1fe9d3[_0x5163('0x3b')]=_[_0x5163('0x3d')](_0x1fe9d3[_0x5163('0x3b')],{'$or':_[_0x5163('0x2c')](_0x399ab5,function(_0x3f4e47){if(_0x3f4e47['type']!==_0x5163('0x3e')){var _0x1cc054={};_0x1cc054[_0x3f4e47[_0x5163('0x29')]]={'$like':'%'+_0x1f3186[_0x5163('0x32')][_0x5163('0x3f')]+'%'};return _0x1cc054;}})});}_0x1fe9d3=_['merge']({},_0x1fe9d3,_0x1f3186[_0x5163('0x40')]);var _0x42556d={'where':_0x1fe9d3['where']};return db[_0x5163('0x2d')][_0x5163('0x1e')](_0x42556d)[_0x5163('0x25')](function(_0x52ccb7){_0x134147[_0x5163('0x1e')]=_0x52ccb7;if(_0x1f3186[_0x5163('0x32')]['includeAll']){_0x1fe9d3[_0x5163('0x41')]=[{'all':!![]}];}return db[_0x5163('0x2d')]['findAll'](_0x1fe9d3);})[_0x5163('0x25')](function(_0x4dc36d){_0x134147['rows']=_0x4dc36d;return _0x134147;})[_0x5163('0x25')](respondWithFilteredResult(_0xe1b16b,_0x1fe9d3))[_0x5163('0x42')](handleError(_0xe1b16b,null));};exports[_0x5163('0x43')]=function(_0x283500,_0x28b0a6){var _0x25799d={'raw':!![],'where':{'id':_0x283500[_0x5163('0x44')]['id']}},_0x3e2a41={};_0x3e2a41[_0x5163('0x31')]=_[_0x5163('0x45')](db[_0x5163('0x2d')][_0x5163('0x2e')]);_0x3e2a41['query']=_[_0x5163('0x45')](_0x283500[_0x5163('0x32')]);_0x3e2a41[_0x5163('0x33')]=_[_0x5163('0x34')](_0x3e2a41[_0x5163('0x31')],_0x3e2a41[_0x5163('0x32')]);_0x25799d[_0x5163('0x35')]=_['intersection'](_0x3e2a41['model'],qs['fields'](_0x283500[_0x5163('0x32')][_0x5163('0x46')]));_0x25799d[_0x5163('0x35')]=_0x25799d[_0x5163('0x35')][_0x5163('0x36')]?_0x25799d[_0x5163('0x35')]:_0x3e2a41['model'];if(_0x283500[_0x5163('0x32')][_0x5163('0x47')]){_0x25799d['include']=[{'all':!![]}];}_0x25799d=_[_0x5163('0x3d')]({},_0x25799d,_0x283500['options']);return db[_0x5163('0x2d')][_0x5163('0x48')](_0x25799d)[_0x5163('0x25')](handleEntityNotFound(_0x28b0a6,null))[_0x5163('0x25')](respondWithResult(_0x28b0a6,null))[_0x5163('0x42')](handleError(_0x28b0a6,null));};exports[_0x5163('0x49')]=function(_0x5f3777,_0x5d435d){return db[_0x5163('0x2d')][_0x5163('0x49')](_0x5f3777[_0x5163('0x4a')],{})[_0x5163('0x25')](respondWithResult(_0x5d435d,0xc9))[_0x5163('0x42')](handleError(_0x5d435d,null));};exports[_0x5163('0x24')]=function(_0x45f2a3,_0x489017){if(_0x45f2a3[_0x5163('0x4a')]['id']){delete _0x45f2a3[_0x5163('0x4a')]['id'];}return db['WhatsappTransferReport'][_0x5163('0x48')]({'where':{'id':_0x45f2a3[_0x5163('0x44')]['id']}})[_0x5163('0x25')](handleEntityNotFound(_0x489017,null))[_0x5163('0x25')](saveUpdates(_0x45f2a3[_0x5163('0x4a')],null))[_0x5163('0x25')](respondWithResult(_0x489017,null))[_0x5163('0x42')](handleError(_0x489017,null));};exports[_0x5163('0x26')]=function(_0x51ab19,_0x760cfc){return db['WhatsappTransferReport']['find']({'where':{'id':_0x51ab19[_0x5163('0x44')]['id']}})['then'](handleEntityNotFound(_0x760cfc,null))[_0x5163('0x25')](removeEntity(_0x760cfc,null))[_0x5163('0x42')](handleError(_0x760cfc,null));};exports[_0x5163('0x4b')]=function(_0x5517c6,_0x64fb60){return db[_0x5163('0x2d')][_0x5163('0x4b')]()[_0x5163('0x25')](respondWithResult(_0x64fb60,null))[_0x5163('0x42')](handleError(_0x64fb60,null));}; \ No newline at end of file +var _0x001a=['json','apply','reject','save','update','destroy','then','stack','name','index','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','Content-Range'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x001a,0x75));var _0xa001=function(_0x495e9f,_0x1b1d80){_0x495e9f=_0x495e9f-0x0;var _0xb249d2=_0x001a[_0x495e9f];return _0xb249d2;};'use strict';var emlformat=require(_0xa001('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa001('0x1'));var jsonpatch=require(_0xa001('0x2'));var rp=require('request-promise');var moment=require(_0xa001('0x3'));var BPromise=require(_0xa001('0x4'));var Mustache=require(_0xa001('0x5'));var util=require(_0xa001('0x6'));var path=require(_0xa001('0x7'));var sox=require('sox');var csv=require(_0xa001('0x8'));var ejs=require(_0xa001('0x9'));var fs=require('fs');var fs_extra=require(_0xa001('0xa'));var _=require('lodash');var squel=require(_0xa001('0xb'));var crypto=require(_0xa001('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa001('0xd'));var toCsv=require(_0xa001('0x8'));var querystring=require(_0xa001('0xe'));var Papa=require(_0xa001('0xf'));var Redis=require(_0xa001('0x10'));var authService=require(_0xa001('0x11'));var qs=require(_0xa001('0x12'));var as=require(_0xa001('0x13'));var hardwareService=require(_0xa001('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa001('0x15'));var licenseUtil=require(_0xa001('0x16'));var db=require(_0xa001('0x17'))['db'];function respondWithStatusCode(_0x11b5f9,_0x35c17c){_0x35c17c=_0x35c17c||0xcc;return function(_0x170ac2){if(_0x170ac2){return _0x11b5f9[_0xa001('0x18')](_0x35c17c);}return _0x11b5f9[_0xa001('0x19')](_0x35c17c)[_0xa001('0x1a')]();};}function respondWithResult(_0x37bdd7,_0x3f5d1e){_0x3f5d1e=_0x3f5d1e||0xc8;return function(_0x3d6046){if(_0x3d6046){return _0x37bdd7[_0xa001('0x19')](_0x3f5d1e)['json'](_0x3d6046);}};}function respondWithFilteredResult(_0x452729,_0x4609ce){return function(_0x11f0a8){if(_0x11f0a8){var _0x439f13=typeof _0x4609ce[_0xa001('0x1b')]==='undefined'&&typeof _0x4609ce[_0xa001('0x1c')]==='undefined';var _0x5f7622=_0x11f0a8['count'];var _0x2a2be5=_0x439f13?0x0:_0x4609ce[_0xa001('0x1b')];var _0x540bc7=_0x439f13?_0x11f0a8[_0xa001('0x1d')]:_0x4609ce[_0xa001('0x1b')]+_0x4609ce[_0xa001('0x1c')];var _0x128cee;if(_0x540bc7>=_0x5f7622){_0x540bc7=_0x5f7622;_0x128cee=0xc8;}else{_0x128cee=0xce;}_0x452729[_0xa001('0x19')](_0x128cee);return _0x452729['set'](_0xa001('0x1e'),_0x2a2be5+'-'+_0x540bc7+'/'+_0x5f7622)[_0xa001('0x1f')](_0x11f0a8);}return null;};}function patchUpdates(_0x2406f6){return function(_0x103cf0){try{jsonpatch[_0xa001('0x20')](_0x103cf0,_0x2406f6,!![]);}catch(_0x1221dd){return BPromise[_0xa001('0x21')](_0x1221dd);}return _0x103cf0[_0xa001('0x22')]();};}function saveUpdates(_0x54dedf,_0x34c115){return function(_0x445dc6){if(_0x445dc6){return _0x445dc6[_0xa001('0x23')](_0x54dedf)['then'](function(_0xbf7d87){return _0xbf7d87;});}return null;};}function removeEntity(_0x37f48e,_0x1bd84b){return function(_0x5dbf09){if(_0x5dbf09){return _0x5dbf09[_0xa001('0x24')]()[_0xa001('0x25')](function(){_0x37f48e[_0xa001('0x19')](0xcc)[_0xa001('0x1a')]();});}};}function handleEntityNotFound(_0x384533,_0x7fa4b9){return function(_0x40e0f1){if(!_0x40e0f1){_0x384533[_0xa001('0x18')](0x194);}return _0x40e0f1;};}function handleError(_0x5e68b3,_0x5f1cbd){_0x5f1cbd=_0x5f1cbd||0x1f4;return function(_0x45d447){logger['error'](_0x45d447[_0xa001('0x26')]);if(_0x45d447[_0xa001('0x27')]){delete _0x45d447['name'];}_0x5e68b3[_0xa001('0x19')](_0x5f1cbd)['send'](_0x45d447);};}exports[_0xa001('0x28')]=function(_0xbb446f,_0x4a4e3c){var _0x2552e6={},_0x3b1683={},_0x4743b6={'count':0x0,'rows':[]};var _0x5d0339=_['map'](db[_0xa001('0x29')][_0xa001('0x2a')],function(_0x3245f6){return{'name':_0x3245f6[_0xa001('0x2b')],'type':_0x3245f6[_0xa001('0x2c')][_0xa001('0x2d')]};});_0x3b1683[_0xa001('0x2e')]=_[_0xa001('0x2f')](_0x5d0339,_0xa001('0x27'));_0x3b1683['query']=_[_0xa001('0x30')](_0xbb446f[_0xa001('0x31')]);_0x3b1683[_0xa001('0x32')]=_[_0xa001('0x33')](_0x3b1683['model'],_0x3b1683[_0xa001('0x31')]);_0x2552e6[_0xa001('0x34')]=_[_0xa001('0x33')](_0x3b1683[_0xa001('0x2e')],qs[_0xa001('0x35')](_0xbb446f[_0xa001('0x31')][_0xa001('0x35')]));_0x2552e6['attributes']=_0x2552e6[_0xa001('0x34')]['length']?_0x2552e6[_0xa001('0x34')]:_0x3b1683[_0xa001('0x2e')];if(!_0xbb446f[_0xa001('0x31')][_0xa001('0x36')](_0xa001('0x37'))){_0x2552e6['limit']=qs[_0xa001('0x1c')](_0xbb446f[_0xa001('0x31')][_0xa001('0x1c')]);_0x2552e6[_0xa001('0x1b')]=qs['offset'](_0xbb446f[_0xa001('0x31')]['offset']);}_0x2552e6[_0xa001('0x38')]=qs[_0xa001('0x39')](_0xbb446f[_0xa001('0x31')][_0xa001('0x39')]);_0x2552e6[_0xa001('0x3a')]=qs[_0xa001('0x32')](_[_0xa001('0x3b')](_0xbb446f[_0xa001('0x31')],_0x3b1683[_0xa001('0x32')]),_0x5d0339);if(_0xbb446f[_0xa001('0x31')][_0xa001('0x3c')]){_0x2552e6[_0xa001('0x3a')]=_[_0xa001('0x3d')](_0x2552e6[_0xa001('0x3a')],{'$or':_[_0xa001('0x2f')](_0x5d0339,function(_0x2f7978){if(_0x2f7978[_0xa001('0x2c')]!=='VIRTUAL'){var _0x35a4d6={};_0x35a4d6[_0x2f7978[_0xa001('0x27')]]={'$like':'%'+_0xbb446f[_0xa001('0x31')]['filter']+'%'};return _0x35a4d6;}})});}_0x2552e6=_['merge']({},_0x2552e6,_0xbb446f[_0xa001('0x3e')]);var _0x501c23={'where':_0x2552e6[_0xa001('0x3a')]};return db[_0xa001('0x29')][_0xa001('0x1d')](_0x501c23)[_0xa001('0x25')](function(_0x3cc4e5){_0x4743b6[_0xa001('0x1d')]=_0x3cc4e5;if(_0xbb446f[_0xa001('0x31')][_0xa001('0x3f')]){_0x2552e6[_0xa001('0x40')]=[{'all':!![]}];}return db[_0xa001('0x29')][_0xa001('0x41')](_0x2552e6);})[_0xa001('0x25')](function(_0x196a08){_0x4743b6[_0xa001('0x42')]=_0x196a08;return _0x4743b6;})['then'](respondWithFilteredResult(_0x4a4e3c,_0x2552e6))[_0xa001('0x43')](handleError(_0x4a4e3c,null));};exports[_0xa001('0x44')]=function(_0x2d57cf,_0x22856c){var _0x38971e={'raw':!![],'where':{'id':_0x2d57cf[_0xa001('0x45')]['id']}},_0x7e221e={};_0x7e221e[_0xa001('0x2e')]=_[_0xa001('0x30')](db[_0xa001('0x29')][_0xa001('0x2a')]);_0x7e221e[_0xa001('0x31')]=_[_0xa001('0x30')](_0x2d57cf[_0xa001('0x31')]);_0x7e221e['filters']=_[_0xa001('0x33')](_0x7e221e[_0xa001('0x2e')],_0x7e221e[_0xa001('0x31')]);_0x38971e[_0xa001('0x34')]=_[_0xa001('0x33')](_0x7e221e[_0xa001('0x2e')],qs[_0xa001('0x35')](_0x2d57cf['query']['fields']));_0x38971e[_0xa001('0x34')]=_0x38971e[_0xa001('0x34')][_0xa001('0x46')]?_0x38971e['attributes']:_0x7e221e[_0xa001('0x2e')];if(_0x2d57cf[_0xa001('0x31')][_0xa001('0x3f')]){_0x38971e['include']=[{'all':!![]}];}_0x38971e=_[_0xa001('0x3d')]({},_0x38971e,_0x2d57cf[_0xa001('0x3e')]);return db['WhatsappTransferReport'][_0xa001('0x47')](_0x38971e)[_0xa001('0x25')](handleEntityNotFound(_0x22856c,null))[_0xa001('0x25')](respondWithResult(_0x22856c,null))['catch'](handleError(_0x22856c,null));};exports[_0xa001('0x48')]=function(_0x67ad6b,_0x2b16b4){return db[_0xa001('0x29')][_0xa001('0x48')](_0x67ad6b[_0xa001('0x49')],{})[_0xa001('0x25')](respondWithResult(_0x2b16b4,0xc9))[_0xa001('0x43')](handleError(_0x2b16b4,null));};exports['update']=function(_0x149c27,_0x58b676){if(_0x149c27[_0xa001('0x49')]['id']){delete _0x149c27[_0xa001('0x49')]['id'];}return db[_0xa001('0x29')]['find']({'where':{'id':_0x149c27[_0xa001('0x45')]['id']}})[_0xa001('0x25')](handleEntityNotFound(_0x58b676,null))[_0xa001('0x25')](saveUpdates(_0x149c27['body'],null))[_0xa001('0x25')](respondWithResult(_0x58b676,null))[_0xa001('0x43')](handleError(_0x58b676,null));};exports['destroy']=function(_0x3561ed,_0x3da43b){return db[_0xa001('0x29')][_0xa001('0x47')]({'where':{'id':_0x3561ed[_0xa001('0x45')]['id']}})[_0xa001('0x25')](handleEntityNotFound(_0x3da43b,null))[_0xa001('0x25')](removeEntity(_0x3da43b,null))[_0xa001('0x43')](handleError(_0x3da43b,null));};exports['describe']=function(_0x2621ee,_0xe0c419){return db[_0xa001('0x29')]['describe']()[_0xa001('0x25')](respondWithResult(_0xe0c419,null))[_0xa001('0x43')](handleError(_0xe0c419,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 69ad574..82ca024 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 _0x9432=['rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3404f6,_0x5cea8a){var _0x2edbd1=function(_0x235810){while(--_0x235810){_0x3404f6['push'](_0x3404f6['shift']());}};_0x2edbd1(++_0x5cea8a);}(_0x9432,0xe8));var _0x2943=function(_0x11b2a6,_0x4578bf){_0x11b2a6=_0x11b2a6-0x0;var _0x1f02ec=_0x9432[_0x11b2a6];return _0x1f02ec;};'use strict';var _=require(_0x2943('0x0'));var util=require(_0x2943('0x1'));var logger=require(_0x2943('0x2'))(_0x2943('0x3'));var moment=require(_0x2943('0x4'));var BPromise=require(_0x2943('0x5'));var rp=require(_0x2943('0x6'));var fs=require('fs');var path=require(_0x2943('0x7'));var rimraf=require(_0x2943('0x8'));var config=require(_0x2943('0x9'));var attributes=require(_0x2943('0xa'));module[_0x2943('0xb')]=function(_0x194925,_0x301f88){return _0x194925[_0x2943('0xc')]('WhatsappTransferReport',attributes,{'tableName':_0x2943('0xd'),'paranoid':![],'indexes':[{'name':_0x2943('0xe'),'fields':[_0x2943('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x497b=['request-promise','rimraf','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','api','moment'];(function(_0x385507,_0x4a82e3){var _0x419ce1=function(_0x47914b){while(--_0x47914b){_0x385507['push'](_0x385507['shift']());}};_0x419ce1(++_0x4a82e3);}(_0x497b,0x7f));var _0xb497=function(_0x1bf1fb,_0x1545f7){_0x1bf1fb=_0x1bf1fb-0x0;var _0x459b78=_0x497b[_0x1bf1fb];return _0x459b78;};'use strict';var _=require(_0xb497('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb497('0x1'));var moment=require(_0xb497('0x2'));var BPromise=require('bluebird');var rp=require(_0xb497('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb497('0x4'));var config=require('../../config/environment');var attributes=require(_0xb497('0x5'));module[_0xb497('0x6')]=function(_0x300221,_0x16d62b){return _0x300221['define'](_0xb497('0x7'),attributes,{'tableName':_0xb497('0x8'),'paranoid':![],'indexes':[{'name':_0xb497('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 801f952..73868b2 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 _0x1839=['stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x399249,_0x8c915e){var _0x5d67a7=function(_0x572915){while(--_0x572915){_0x399249['push'](_0x399249['shift']());}};_0x5d67a7(++_0x8c915e);}(_0x1839,0x125));var _0x9183=function(_0xc08416,_0x1af7cc){_0xc08416=_0xc08416-0x0;var _0x3d6438=_0x1839[_0xc08416];return _0x3d6438;};'use strict';var _=require(_0x9183('0x0'));var util=require(_0x9183('0x1'));var moment=require(_0x9183('0x2'));var BPromise=require(_0x9183('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9183('0x4'));var db=require(_0x9183('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9183('0x6'))(_0x9183('0x7'));var config=require(_0x9183('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9183('0x9')][_0x9183('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x106d5f,_0x4f2e1c,_0x27963d){return new BPromise(function(_0xe86bfd,_0x1e6d0e){return client[_0x9183('0xb')](_0x106d5f,_0x27963d)['then'](function(_0x11b204){logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x4f2e1c,_0x9183('0xc'));logger[_0x9183('0xd')](_0x9183('0xe'),_0x4f2e1c,_0x9183('0xc'),JSON[_0x9183('0xf')](_0x11b204));if(_0x11b204[_0x9183('0x10')]){if(_0x11b204[_0x9183('0x10')][_0x9183('0x11')]===0x1f4){logger[_0x9183('0x10')](_0x9183('0x12'),_0x4f2e1c,_0x11b204[_0x9183('0x10')]['message']);return _0x1e6d0e(_0x11b204[_0x9183('0x10')][_0x9183('0x13')]);}logger[_0x9183('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4f2e1c,_0x11b204[_0x9183('0x10')]['message']);return _0xe86bfd(_0x11b204['error'][_0x9183('0x13')]);}else{logger[_0x9183('0x14')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4f2e1c,_0x9183('0xc'));_0xe86bfd(_0x11b204[_0x9183('0x15')][_0x9183('0x13')]);}})['catch'](function(_0xddc0d3){logger[_0x9183('0x10')](_0x9183('0x12'),_0x4f2e1c,_0xddc0d3);_0x1e6d0e(_0xddc0d3);});});} \ No newline at end of file +var _0xebf4=['code','message','result','catch','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4478ae,_0x48f246){var _0x4d8c63=function(_0x5372bf){while(--_0x5372bf){_0x4478ae['push'](_0x4478ae['shift']());}};_0x4d8c63(++_0x48f246);}(_0xebf4,0x1a8));var _0x4ebf=function(_0x522382,_0x1f8d81){_0x522382=_0x522382-0x0;var _0xfa7ae6=_0xebf4[_0x522382];return _0xfa7ae6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ebf('0x0'));var BPromise=require(_0x4ebf('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ebf('0x2'))['db'];var utils=require(_0x4ebf('0x3'));var logger=require('../../config/logger')(_0x4ebf('0x4'));var config=require(_0x4ebf('0x5'));var jayson=require(_0x4ebf('0x6'));var client=jayson[_0x4ebf('0x7')][_0x4ebf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x514263,_0x2ce72d,_0x2ec0d4){return new BPromise(function(_0x242092,_0x405539){return client['request'](_0x514263,_0x2ec0d4)[_0x4ebf('0x9')](function(_0x52dec0){logger[_0x4ebf('0xa')](_0x4ebf('0xb'),_0x2ce72d,_0x4ebf('0xc'));logger[_0x4ebf('0xd')](_0x4ebf('0xe'),_0x2ce72d,_0x4ebf('0xc'),JSON[_0x4ebf('0xf')](_0x52dec0));if(_0x52dec0[_0x4ebf('0x10')]){if(_0x52dec0[_0x4ebf('0x10')][_0x4ebf('0x11')]===0x1f4){logger[_0x4ebf('0x10')](_0x4ebf('0xb'),_0x2ce72d,_0x52dec0[_0x4ebf('0x10')][_0x4ebf('0x12')]);return _0x405539(_0x52dec0[_0x4ebf('0x10')][_0x4ebf('0x12')]);}logger[_0x4ebf('0x10')](_0x4ebf('0xb'),_0x2ce72d,_0x52dec0[_0x4ebf('0x10')][_0x4ebf('0x12')]);return _0x242092(_0x52dec0[_0x4ebf('0x10')][_0x4ebf('0x12')]);}else{logger[_0x4ebf('0xa')](_0x4ebf('0xb'),_0x2ce72d,_0x4ebf('0xc'));_0x242092(_0x52dec0[_0x4ebf('0x13')]['message']);}})[_0x4ebf('0x14')](function(_0x3e4643){logger[_0x4ebf('0x10')](_0x4ebf('0xb'),_0x2ce72d,_0x3e4643);_0x405539(_0x3e4643);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index e2dbf17..c4d22f7 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d04=['./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','sync','then','listen','info','start','Online\x20apps:','map','filter','name','join','Offline\x20apps:','status','seedDB','./config/seedDB','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./rpc','./config/environment'];(function(_0x2a0d08,_0x2871d5){var _0x3c4680=function(_0x31759b){while(--_0x31759b){_0x2a0d08['push'](_0x2a0d08['shift']());}};_0x3c4680(++_0x2871d5);}(_0x6d04,0xc1));var _0x46d0=function(_0x3ad462,_0x363c0d){_0x3ad462=_0x3ad462-0x0;var _0x4c721b=_0x6d04[_0x3ad462];return _0x4c721b;};'use strict';var _=require(_0x46d0('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x46d0('0x1'));var config=require(_0x46d0('0x2'));var logger=require(_0x46d0('0x3'))('app');var pm2=require(_0x46d0('0x4'));var pm2Config=require(_0x46d0('0x5'));var schedule=require(_0x46d0('0x6'));var chat=require(_0x46d0('0x7'));var whatsapp=require(_0x46d0('0x8'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x46d0('0x9')][_0x46d0('0xa')]()[_0x46d0('0xb')](function(){return rpc[_0x46d0('0xc')]();})[_0x46d0('0xb')](function(_0x23dc22){logger[_0x46d0('0xd')](_0x23dc22);return chat['start']();})[_0x46d0('0xb')](function(){return whatsapp[_0x46d0('0xe')]();})['then'](function(){return schedule[_0x46d0('0xe')]();})[_0x46d0('0xb')](function(){return transcribe[_0x46d0('0xe')]();})[_0x46d0('0xb')](function(_0x56295a){logger[_0x46d0('0xd')](_0x56295a);return pm2[_0x46d0('0xe')](pm2Config);})[_0x46d0('0xb')](function(_0x6a3f44){logger[_0x46d0('0xd')](_0x46d0('0xf'),_[_0x46d0('0x10')](_[_0x46d0('0x11')](_0x6a3f44,{'status':'online'}),_0x46d0('0x12'))[_0x46d0('0x13')]());logger[_0x46d0('0xd')](_0x46d0('0x14'),_['map'](_[_0x46d0('0x11')](_0x6a3f44,function(_0x24169f){return _0x24169f[_0x46d0('0x15')]!=='online';}),_0x46d0('0x12'))[_0x46d0('0x13')]()||'None');config[_0x46d0('0x16')]&&require(_0x46d0('0x17'))[_0x46d0('0x18')]();require('./config/license')['default']();})[_0x46d0('0x19')](function(_0x111a7f){logger[_0x46d0('0x1a')](_0x46d0('0x1b'),_0x111a7f);process['exit'](0x1);});}main(); \ No newline at end of file +var _0xd944=['map','filter','online','name','join','status','None','./config/seedDB','default','./config/license','catch','./mysqldb','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','info','start','then','Online\x20apps:'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd944,0x1e6));var _0x4d94=function(_0x306be7,_0x37d3c2){_0x306be7=_0x306be7-0x0;var _0x2f6079=_0xd944[_0x306be7];return _0x2f6079;};'use strict';var _=require('lodash');var mysqldb=require(_0x4d94('0x0'));var rpc=require('./rpc');var config=require(_0x4d94('0x1'));var logger=require(_0x4d94('0x2'))(_0x4d94('0x3'));var pm2=require(_0x4d94('0x4'));var pm2Config=require(_0x4d94('0x5'));var schedule=require(_0x4d94('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x4d94('0x7'));var transcribe=require(_0x4d94('0x8'));function main(){return mysqldb['db'][_0x4d94('0x9')]['sync']()['then'](function(){return rpc['listen']();})['then'](function(_0x1576b7){logger[_0x4d94('0xa')](_0x1576b7);return chat[_0x4d94('0xb')]();})[_0x4d94('0xc')](function(){return whatsapp[_0x4d94('0xb')]();})[_0x4d94('0xc')](function(){return schedule['start']();})[_0x4d94('0xc')](function(){return transcribe['start']();})[_0x4d94('0xc')](function(_0x27625f){logger[_0x4d94('0xa')](_0x27625f);return pm2[_0x4d94('0xb')](pm2Config);})[_0x4d94('0xc')](function(_0x38facc){logger['info'](_0x4d94('0xd'),_[_0x4d94('0xe')](_[_0x4d94('0xf')](_0x38facc,{'status':_0x4d94('0x10')}),_0x4d94('0x11'))[_0x4d94('0x12')]());logger[_0x4d94('0xa')]('Offline\x20apps:',_[_0x4d94('0xe')](_[_0x4d94('0xf')](_0x38facc,function(_0x351c32){return _0x351c32[_0x4d94('0x13')]!==_0x4d94('0x10');}),_0x4d94('0x11'))['join']()||_0x4d94('0x14'));config['seedDB']&&require(_0x4d94('0x15'))[_0x4d94('0x16')]();require(_0x4d94('0x17'))[_0x4d94('0x16')]();})[_0x4d94('0x18')](function(_0x3383a1){logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x3383a1);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 167cc45..267b93e 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 _0x4dd3=['decryptString','length','splice','unshift','encryptString','join','promisify','sign','secret','secrets','payload','options','verify','randomBytes','toString','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','composable-middleware','basic-auth','crypto','bluebird','moment','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','smsPause','pauseType','lastPauseAt','passwordResetAt','alias','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','disposition','then','closed','unmanaged','json','Unmanaged.','headers','authorization','startsWith','Basic','User','authenticate','pass','status','Wrong\x20credentials.','Bearer','getUuid','query','apikey','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','minutes','find','User\x20not\x20found.','catch','User\x20object\x20not\x20found.','canUpdate','update','isMiddleware','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','isNil','generateApiKey','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','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory'];(function(_0x35156b,_0x4f47e1){var _0x5e9bee=function(_0x1725aa){while(--_0x1725aa){_0x35156b['push'](_0x35156b['shift']());}};_0x5e9bee(++_0x4f47e1);}(_0x4dd3,0xfe));var _0x34dd=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0x4dd3[_0x2e50a2];return _0x47e5de;};'use strict';var db=require(_0x34dd('0x0'))['db'];var config=require(_0x34dd('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x34dd('0x2'));var encryptor=require('../encryptor');var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0x34dd('0x3'));var basicAuth=require(_0x34dd('0x4'));var crypto=require(_0x34dd('0x5'));var BPromise=require(_0x34dd('0x6'));var util=require('util');var moment=require(_0x34dd('0x7'));var validateJwt=expressJwt({'secret':config['secrets'][_0x34dd('0x8')]});var userAttributes=['id',_0x34dd('0x9'),_0x34dd('0xa'),_0x34dd('0xb'),_0x34dd('0xc'),_0x34dd('0xd'),_0x34dd('0xe'),_0x34dd('0xf'),_0x34dd('0x10'),_0x34dd('0x11'),_0x34dd('0x12'),'mailPause','faxPause',_0x34dd('0x13'),'openchannelPause',_0x34dd('0x14'),'showWebBar','lastLoginAt',_0x34dd('0x15'),'crudPermissions','allowmessenger',_0x34dd('0x16'),_0x34dd('0x17'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0x34dd('0x18'),_0x34dd('0x19'),'phoneBarEnableDtmfTone',_0x34dd('0x1a'),_0x34dd('0x1b'),'phoneBarPrefixRequired',_0x34dd('0x1c'),_0x34dd('0x1d'),'hotdesk',_0x34dd('0x1e'),_0x34dd('0x1f'),_0x34dd('0x20'),_0x34dd('0x21'),_0x34dd('0x22'),'downloadVoiceRecordings','downloadOmnichannelInteractions',_0x34dd('0x23')];exports[_0x34dd('0x24')]=function(){return this[_0x34dd('0x25')](!![])[_0x34dd('0x26')](function(_0x36ad00,_0x2afbd5,_0x1762fa){if(_0x36ad00[_0x34dd('0x27')]){_0x1762fa();}else{return db['ChatInteraction'][_0x34dd('0x28')]({'where':{'id':_0x36ad00['params']['id']},'attributes':['id','closed',_0x34dd('0x29')],'raw':!![]})[_0x34dd('0x2a')](function(_0x266a80){if(_0x266a80&&_0x266a80[_0x34dd('0x2b')]){return _0x2afbd5['status'](_0x266a80['disposition']===_0x34dd('0x2c')?0x195:0x193)[_0x34dd('0x2d')]({'message':_0x266a80[_0x34dd('0x29')]===_0x34dd('0x2c')?_0x34dd('0x2e'):'Forbidden.'});}else{_0x1762fa();}})['catch'](function(_0x27c01d){_0x1762fa(_0x27c01d);});}});};exports[_0x34dd('0x25')]=function isAuthenticated(_0x4e0900){return compose()[_0x34dd('0x26')](function(_0x40225c,_0x2e2db3,_0x3b316e){var _0x316650;if(_0x40225c[_0x34dd('0x2f')][_0x34dd('0x30')]){if(_[_0x34dd('0x31')](_0x40225c['headers'][_0x34dd('0x30')],_0x34dd('0x32'))){var _0x596113=basicAuth(_0x40225c);db[_0x34dd('0x33')]['find']({'where':{'name':_0x596113[_0x34dd('0xb')]}})['then'](function(_0x378cea){if(!_0x378cea||!_0x378cea[_0x34dd('0x34')](_0x596113[_0x34dd('0x35')])){return _0x2e2db3[_0x34dd('0x36')](0x191)['json']({'message':_0x34dd('0x37')});}_0x40225c[_0x34dd('0x27')]={'id':_0x378cea['id']};_0x3b316e();})['catch'](function(_0x4f37b7){_0x3b316e(_0x4f37b7);});}else if(_[_0x34dd('0x31')](_0x40225c[_0x34dd('0x2f')][_0x34dd('0x30')],_0x34dd('0x38'))){validateJwt(_0x40225c,_0x2e2db3,_0x3b316e);}else{if(_0x4e0900){_0x3b316e();}else{return _0x2e2db3['status'](0x193)[_0x34dd('0x2d')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x40225c['query']['apikey']){try{var _0x413dbb={'audience':hardwareConf[_0x34dd('0x39')](),'issuer':hardwareConf[_0x34dd('0x39')]()};verifyJwt(_0x40225c[_0x34dd('0x3a')][_0x34dd('0x3b')],_0x413dbb)[_0x34dd('0x2a')](function(_0x5f391e){return db[_0x34dd('0x33')]['find']({'where':{'id':_0x5f391e[_0x34dd('0x3c')]}})[_0x34dd('0x2a')](function(_0x2d1b34){_0x316650=_0x2d1b34;return db[_0x34dd('0x3d')]['findOne']({'where':{'id':0x1},'attributes':[_0x34dd('0x3e'),_0x34dd('0x3f')],'raw':!![]});})[_0x34dd('0x2a')](function(_0x2420d2){if(!_0x316650||!_[_0x34dd('0x40')](_0x316650[_0x34dd('0x41')],_0x5f391e[_0x34dd('0x42')])){return _0x2e2db3[_0x34dd('0x36')](0x191)[_0x34dd('0x2d')]({'message':_0x34dd('0x43')});}if(_0x316650[_0x34dd('0x44')]){return _0x2e2db3[_0x34dd('0x36')](0x191)[_0x34dd('0x2d')]({'message':_0x34dd('0x45')});}if(_0x316650['blocked']){if(_0x2420d2[_0x34dd('0x3f')]>0x0){if(moment(_0x316650[_0x34dd('0x46')])['add'](_0x2420d2[_0x34dd('0x3f')],_0x34dd('0x47'))>moment()){return _0x2e2db3['status'](0x191)[_0x34dd('0x2d')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x2e2db3[_0x34dd('0x36')](0x191)['json']({'message':_0x34dd('0x45')});}}_0x40225c[_0x34dd('0x27')]={'id':_0x316650['id']};_0x3b316e();});})['catch'](function(){return _0x2e2db3[_0x34dd('0x36')](0x191)[_0x34dd('0x2d')]({'message':_0x34dd('0x45')});});}catch(_0x1cd3e8){_0x3b316e(_0x1cd3e8);}}else if(_0x4e0900){_0x3b316e();}else{return _0x2e2db3[_0x34dd('0x36')](0x193)[_0x34dd('0x2d')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x4e7e40,_0x3df721,_0x59f63f){if(_0x4e7e40[_0x34dd('0x27')]){db[_0x34dd('0x33')][_0x34dd('0x48')]({'where':{'id':_0x4e7e40[_0x34dd('0x27')]['id']},'attributes':userAttributes})[_0x34dd('0x2a')](function(_0x363501){if(!_0x363501){return _0x3df721['status'](0x194)['json']({'message':_0x34dd('0x49')});}_0x4e7e40[_0x34dd('0x27')]=_0x363501;_0x59f63f();})[_0x34dd('0x4a')](function(_0x396829){_0x59f63f(_0x396829);});}else if(_0x4e0900){_0x59f63f();}else{return _0x3df721[_0x34dd('0x36')](0x194)['json']({'message':_0x34dd('0x4b')});}});};exports[_0x34dd('0x4c')]=function canUpdate(){return compose()[_0x34dd('0x26')](function(_0x3292d8,_0x405ca0,_0x989515){return licenseUtil['getLicense']()[_0x34dd('0x2a')](function(_0x4308db){if(_0x4308db[_0x34dd('0x4d')]){_0x989515();}else{return _0x405ca0[_0x34dd('0x36')](0x193)[_0x34dd('0x2d')]({'message':'Forbidden'});}})[_0x34dd('0x4a')](function(_0x50c1d0){_0x989515(_0x50c1d0);});});};exports[_0x34dd('0x4e')]=function(_0x2c2199,_0x5a9ee8,_0x368feb){_0x2c2199[_0x34dd('0x4e')]=!![];return _0x368feb();};exports['signToken']=function signToken(_0x3412e2){return signJwt(_0x3412e2);};exports['setTokenCookie']=function(_0x552f1a,_0x18485a){if(!_0x552f1a['user']){return _0x18485a['status'](0x194)['json']({'message':_0x34dd('0x4f')});}var _0x55be4d={'payload':{'id':_0x552f1a[_0x34dd('0x27')]['id'],'role':_0x552f1a[_0x34dd('0x27')][_0x34dd('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x55be4d)[_0x34dd('0x2a')](function(_0x38756d){_0x18485a[_0x34dd('0x50')](_0x34dd('0x51'),_0x38756d);_0x18485a[_0x34dd('0x52')](_0x34dd('0x53'));})['catch'](function(_0x2a69af){return _0x18485a['status'](0x1f4)[_0x34dd('0x54')](_0x2a69af);});};exports['retrieveApiKey']=function(_0x173954){if(_[_0x34dd('0x55')](_0x173954[_0x34dd('0x41')])||_[_0x34dd('0x55')](_0x173954['apiKeyIat'])){return null;}else{return createJwt(_0x173954);}};exports[_0x34dd('0x56')]=function(_0x235e29){_0x235e29[_0x34dd('0x41')]=generateNonce();_0x235e29[_0x34dd('0x57')]=generateIssuedAt();return createJwt(_0x235e29);};exports['regenerateApiKey']=function(_0x221e9b,_0x2d8588){var _0x40d042=_0x221e9b[_0x34dd('0x3a')][_0x34dd('0x3b')];if(_0x40d042){var _0xa98dd5={'nonce':_0x2d8588[_0x34dd('0x41')],'iat':_0x2d8588[_0x34dd('0x57')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x34dd('0x39')]()};return verifyJwt(_0x40d042,_0xa98dd5)['then'](function(){return generateApiKey(_0x2d8588);});}else{throw{'message':_0x34dd('0x58')};}};exports[_0x34dd('0x59')]=function(_0x3c799c){var _0x4a626c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4a626c[_0x34dd('0x5a')](_0x3c799c))throw new db[(_0x34dd('0x5b'))][(_0x34dd('0x5c'))](_0x34dd('0x5d'));return;};exports[_0x34dd('0x5e')]=function(_0x2ee3be,_0x2c5558,_0x788e43){var _0x392de7=encryptor['decryptString'](_0x2c5558)['split'](',');for(var _0x25e712=0x0;_0x25e712<_0x788e43;_0x25e712++){if(!_0x392de7[_0x25e712])break;if(_0x2ee3be[_0x34dd('0x5f')]()===_0x392de7[_0x25e712][_0x34dd('0x5f')]()){var _0x3b6915=util[_0x34dd('0x60')](_0x34dd('0x61'),_0x788e43);if(_0x788e43===0x1){_0x3b6915=_0x34dd('0x62');}throw new db['Sequelize'][(_0x34dd('0x5c'))](_0x3b6915);}}return;};exports[_0x34dd('0x63')]=function(_0x132750,_0x573bb0){var _0x28a3cd=_0x573bb0?encryptor[_0x34dd('0x64')](_0x573bb0)['split'](','):[];if(_0x28a3cd[_0x34dd('0x65')]===0x5){_0x28a3cd[_0x34dd('0x66')](-0x1,0x1);}_0x28a3cd[_0x34dd('0x67')](_0x132750);return encryptor[_0x34dd('0x68')](_0x28a3cd[_0x34dd('0x69')](','));};function signJwt(_0xa341c5){var _0x318b43=BPromise[_0x34dd('0x6a')](jwt[_0x34dd('0x6b')],{'context':jwt});var _0x3527f4=_0xa341c5[_0x34dd('0x6c')]||config[_0x34dd('0x6d')][_0x34dd('0x8')];return new BPromise(function(_0x452861,_0x234758){_0x318b43(_0xa341c5[_0x34dd('0x6e')],_0x3527f4,_0xa341c5[_0x34dd('0x6f')])['then'](function(_0x53a73d){_0x452861(_0x53a73d);})[_0x34dd('0x4a')](function(_0x6f4b6d){_0x234758(_0x6f4b6d);});});}function verifyJwt(_0x47b864,_0x1e5ae0,_0x3f4a1b){var _0x10ae52=BPromise[_0x34dd('0x6a')](jwt[_0x34dd('0x70')],{'context':jwt});var _0x479a6f=_0x3f4a1b||config[_0x34dd('0x6d')][_0x34dd('0x8')];return new BPromise(function(_0xd8d90,_0x236c4f){_0x10ae52(_0x47b864,_0x479a6f,_0x1e5ae0)['then'](function(_0x390b60){_0xd8d90(_0x390b60);})['catch'](function(_0x801a34){_0x236c4f(_0x801a34);});});}function generateNonce(){return crypto[_0x34dd('0x71')](0x10)[_0x34dd('0x72')]('hex');}function generateIssuedAt(){return Math[_0x34dd('0x73')](Date[_0x34dd('0x74')]()/0x3e8)[_0x34dd('0x72')]();}function createJwt(_0x1f0abd){var _0x5870e9={'payload':{'iat':_0x1f0abd[_0x34dd('0x57')],'nonce':_0x1f0abd[_0x34dd('0x41')]},'options':{'algorithm':_0x34dd('0x75'),'subject':_0x1f0abd['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x5870e9)[_0x34dd('0x2a')](function(_0x16c071){return{'iat':_0x1f0abd[_0x34dd('0x57')],'nonce':_0x1f0abd['apiKeyNonce'],'token':_0x16c071};});} \ No newline at end of file +var _0x5e2a=['util','moment','secrets','fullname','name','internal','voicePause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isAuthenticated','use','ChatInteraction','params','closed','disposition','unmanaged','json','Unmanaged.','Forbidden.','headers','Basic','find','authenticate','pass','Wrong\x20credentials.','user','catch','authorization','status','Unknown\x20authorization\x20format','apikey','getUuid','query','then','User','sub','Setting','findOne','blockDuration','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','splice','unshift','encryptString','join','promisify','secret','session','randomBytes','toString','hex','now','HS512','../../mysqldb','../../config/environment','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto'];(function(_0x5130c5,_0x5a3458){var _0x39acbf=function(_0x3bd9b6){while(--_0x3bd9b6){_0x5130c5['push'](_0x5130c5['shift']());}};_0x39acbf(++_0x5a3458);}(_0x5e2a,0x72));var _0xa5e2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e2a[_0x3dd15e];return _0x231fd0;};'use strict';var db=require(_0xa5e2('0x0'))['db'];var config=require(_0xa5e2('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0xa5e2('0x2'));var jwt=require(_0xa5e2('0x3'));var expressJwt=require('express-jwt');var compose=require(_0xa5e2('0x4'));var basicAuth=require(_0xa5e2('0x5'));var crypto=require(_0xa5e2('0x6'));var BPromise=require('bluebird');var util=require(_0xa5e2('0x7'));var moment=require(_0xa5e2('0x8'));var validateJwt=expressJwt({'secret':config[_0xa5e2('0x9')]['session']});var userAttributes=['id','role',_0xa5e2('0xa'),_0xa5e2('0xb'),_0xa5e2('0xc'),'email','userpic','permissions','md5secret',_0xa5e2('0xd'),'chatPause',_0xa5e2('0xe'),_0xa5e2('0xf'),_0xa5e2('0x10'),_0xa5e2('0x11'),_0xa5e2('0x12'),_0xa5e2('0x13'),_0xa5e2('0x14'),_0xa5e2('0x15'),_0xa5e2('0x16'),'allowmessenger',_0xa5e2('0x17'),'alias',_0xa5e2('0x18'),_0xa5e2('0x19'),_0xa5e2('0x1a'),_0xa5e2('0x1b'),_0xa5e2('0x1c'),'phoneBarEnableSettings',_0xa5e2('0x1d'),'phoneBarPrefixRequired',_0xa5e2('0x1e'),_0xa5e2('0x1f'),_0xa5e2('0x20'),_0xa5e2('0x21'),'userProfileId',_0xa5e2('0x22'),_0xa5e2('0x23'),_0xa5e2('0x24'),_0xa5e2('0x25'),_0xa5e2('0x26'),_0xa5e2('0x27')];exports['isChatInteractionAuthorized']=function(){return this[_0xa5e2('0x28')](!![])[_0xa5e2('0x29')](function(_0x98b8d,_0x54a3e3,_0x12963c){if(_0x98b8d['user']){_0x12963c();}else{return db[_0xa5e2('0x2a')]['findOne']({'where':{'id':_0x98b8d[_0xa5e2('0x2b')]['id']},'attributes':['id',_0xa5e2('0x2c'),'disposition'],'raw':!![]})['then'](function(_0x4fe3cc){if(_0x4fe3cc&&_0x4fe3cc['closed']){return _0x54a3e3['status'](_0x4fe3cc[_0xa5e2('0x2d')]===_0xa5e2('0x2e')?0x195:0x193)[_0xa5e2('0x2f')]({'message':_0x4fe3cc[_0xa5e2('0x2d')]==='unmanaged'?_0xa5e2('0x30'):_0xa5e2('0x31')});}else{_0x12963c();}})['catch'](function(_0x199715){_0x12963c(_0x199715);});}});};exports[_0xa5e2('0x28')]=function isAuthenticated(_0x39dd4a){return compose()[_0xa5e2('0x29')](function(_0x5497db,_0x3276bf,_0x4353f1){var _0x1779e4;if(_0x5497db[_0xa5e2('0x32')]['authorization']){if(_['startsWith'](_0x5497db[_0xa5e2('0x32')]['authorization'],_0xa5e2('0x33'))){var _0x577780=basicAuth(_0x5497db);db['User'][_0xa5e2('0x34')]({'where':{'name':_0x577780[_0xa5e2('0xb')]}})['then'](function(_0x24d92f){if(!_0x24d92f||!_0x24d92f[_0xa5e2('0x35')](_0x577780[_0xa5e2('0x36')])){return _0x3276bf['status'](0x191)[_0xa5e2('0x2f')]({'message':_0xa5e2('0x37')});}_0x5497db[_0xa5e2('0x38')]={'id':_0x24d92f['id']};_0x4353f1();})[_0xa5e2('0x39')](function(_0x4e4373){_0x4353f1(_0x4e4373);});}else if(_['startsWith'](_0x5497db[_0xa5e2('0x32')][_0xa5e2('0x3a')],'Bearer')){validateJwt(_0x5497db,_0x3276bf,_0x4353f1);}else{if(_0x39dd4a){_0x4353f1();}else{return _0x3276bf[_0xa5e2('0x3b')](0x193)[_0xa5e2('0x2f')]({'message':_0xa5e2('0x3c')});}}}else if(_0x5497db['query'][_0xa5e2('0x3d')]){try{var _0x583bce={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xa5e2('0x3e')]()};verifyJwt(_0x5497db[_0xa5e2('0x3f')][_0xa5e2('0x3d')],_0x583bce)[_0xa5e2('0x40')](function(_0x6aaa25){return db[_0xa5e2('0x41')]['find']({'where':{'id':_0x6aaa25[_0xa5e2('0x42')]}})[_0xa5e2('0x40')](function(_0x3f03b8){_0x1779e4=_0x3f03b8;return db[_0xa5e2('0x43')][_0xa5e2('0x44')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xa5e2('0x45')],'raw':!![]});})['then'](function(_0x58e659){if(!_0x1779e4||!_['isEqual'](_0x1779e4[_0xa5e2('0x46')],_0x6aaa25[_0xa5e2('0x47')])){return _0x3276bf[_0xa5e2('0x3b')](0x191)[_0xa5e2('0x2f')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x1779e4[_0xa5e2('0x48')]){return _0x3276bf['status'](0x191)[_0xa5e2('0x2f')]({'message':_0xa5e2('0x49')});}if(_0x1779e4[_0xa5e2('0x4a')]){if(_0x58e659[_0xa5e2('0x45')]>0x0){if(moment(_0x1779e4[_0xa5e2('0x4b')])[_0xa5e2('0x4c')](_0x58e659[_0xa5e2('0x45')],_0xa5e2('0x4d'))>moment()){return _0x3276bf[_0xa5e2('0x3b')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x3276bf[_0xa5e2('0x3b')](0x191)[_0xa5e2('0x2f')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x5497db[_0xa5e2('0x38')]={'id':_0x1779e4['id']};_0x4353f1();});})[_0xa5e2('0x39')](function(){return _0x3276bf[_0xa5e2('0x3b')](0x191)[_0xa5e2('0x2f')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0xe98158){_0x4353f1(_0xe98158);}}else if(_0x39dd4a){_0x4353f1();}else{return _0x3276bf[_0xa5e2('0x3b')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0xa5e2('0x29')](function(_0x28b802,_0x311bd3,_0x40a3cc){if(_0x28b802[_0xa5e2('0x38')]){db['User']['find']({'where':{'id':_0x28b802['user']['id']},'attributes':userAttributes})['then'](function(_0xd7a66e){if(!_0xd7a66e){return _0x311bd3[_0xa5e2('0x3b')](0x194)['json']({'message':_0xa5e2('0x4e')});}_0x28b802['user']=_0xd7a66e;_0x40a3cc();})[_0xa5e2('0x39')](function(_0x34328f){_0x40a3cc(_0x34328f);});}else if(_0x39dd4a){_0x40a3cc();}else{return _0x311bd3[_0xa5e2('0x3b')](0x194)[_0xa5e2('0x2f')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xa5e2('0x4f')]=function canUpdate(){return compose()[_0xa5e2('0x29')](function(_0x34e20b,_0xc3af4c,_0x46a112){return licenseUtil[_0xa5e2('0x50')]()['then'](function(_0x16c02d){if(_0x16c02d[_0xa5e2('0x51')]){_0x46a112();}else{return _0xc3af4c[_0xa5e2('0x3b')](0x193)[_0xa5e2('0x2f')]({'message':_0xa5e2('0x52')});}})[_0xa5e2('0x39')](function(_0x229111){_0x46a112(_0x229111);});});};exports[_0xa5e2('0x53')]=function(_0x451f7d,_0xf07576,_0x5068a3){_0x451f7d['isMiddleware']=!![];return _0x5068a3();};exports[_0xa5e2('0x54')]=function signToken(_0x10c2f3){return signJwt(_0x10c2f3);};exports[_0xa5e2('0x55')]=function(_0x1faa8f,_0x4b8d7d){if(!_0x1faa8f['user']){return _0x4b8d7d[_0xa5e2('0x3b')](0x194)[_0xa5e2('0x2f')]({'message':_0xa5e2('0x56')});}var _0x35fa0f={'payload':{'id':_0x1faa8f[_0xa5e2('0x38')]['id'],'role':_0x1faa8f['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x35fa0f)[_0xa5e2('0x40')](function(_0x43bc90){_0x4b8d7d[_0xa5e2('0x57')](_0xa5e2('0x58'),_0x43bc90);_0x4b8d7d['redirect'](_0xa5e2('0x59'));})[_0xa5e2('0x39')](function(_0xf0eb21){return _0x4b8d7d[_0xa5e2('0x3b')](0x1f4)[_0xa5e2('0x5a')](_0xf0eb21);});};exports[_0xa5e2('0x5b')]=function(_0x4278f5){if(_[_0xa5e2('0x5c')](_0x4278f5[_0xa5e2('0x46')])||_[_0xa5e2('0x5c')](_0x4278f5[_0xa5e2('0x5d')])){return null;}else{return createJwt(_0x4278f5);}};exports[_0xa5e2('0x5e')]=function(_0x42858f){_0x42858f['apiKeyNonce']=generateNonce();_0x42858f['apiKeyIat']=generateIssuedAt();return createJwt(_0x42858f);};exports[_0xa5e2('0x5f')]=function(_0x33c6c4,_0x3a310a){var _0x47d7ef=_0x33c6c4[_0xa5e2('0x3f')][_0xa5e2('0x3d')];if(_0x47d7ef){var _0x18d983={'nonce':_0x3a310a[_0xa5e2('0x46')],'iat':_0x3a310a[_0xa5e2('0x5d')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xa5e2('0x3e')]()};return verifyJwt(_0x47d7ef,_0x18d983)[_0xa5e2('0x40')](function(){return generateApiKey(_0x3a310a);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xa5e2('0x60')]=function(_0xba2915){var _0x4ebefa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4ebefa['test'](_0xba2915))throw new db[(_0xa5e2('0x61'))][(_0xa5e2('0x62'))](_0xa5e2('0x63'));return;};exports[_0xa5e2('0x64')]=function(_0x17a3d3,_0x12e39b,_0x1cbb8a){var _0x513e94=encryptor[_0xa5e2('0x65')](_0x12e39b)['split'](',');for(var _0x31cb57=0x0;_0x31cb57<_0x1cbb8a;_0x31cb57++){if(!_0x513e94[_0x31cb57])break;if(_0x17a3d3['toLowerCase']()===_0x513e94[_0x31cb57][_0xa5e2('0x66')]()){var _0x555790=util[_0xa5e2('0x67')](_0xa5e2('0x68'),_0x1cbb8a);if(_0x1cbb8a===0x1){_0x555790=_0xa5e2('0x69');}throw new db[(_0xa5e2('0x61'))][(_0xa5e2('0x62'))](_0x555790);}}return;};exports[_0xa5e2('0x6a')]=function(_0x1a34a6,_0x1e49fc){var _0x1a979e=_0x1e49fc?encryptor[_0xa5e2('0x65')](_0x1e49fc)[_0xa5e2('0x6b')](','):[];if(_0x1a979e[_0xa5e2('0x6c')]===0x5){_0x1a979e[_0xa5e2('0x6d')](-0x1,0x1);}_0x1a979e[_0xa5e2('0x6e')](_0x1a34a6);return encryptor[_0xa5e2('0x6f')](_0x1a979e[_0xa5e2('0x70')](','));};function signJwt(_0x2aaa85){var _0x389a42=BPromise[_0xa5e2('0x71')](jwt['sign'],{'context':jwt});var _0x290005=_0x2aaa85[_0xa5e2('0x72')]||config[_0xa5e2('0x9')][_0xa5e2('0x73')];return new BPromise(function(_0x38df6b,_0x25b3bd){_0x389a42(_0x2aaa85['payload'],_0x290005,_0x2aaa85['options'])[_0xa5e2('0x40')](function(_0x1cff7e){_0x38df6b(_0x1cff7e);})[_0xa5e2('0x39')](function(_0x53bb87){_0x25b3bd(_0x53bb87);});});}function verifyJwt(_0x1becf2,_0x38a5c4,_0x3f7bf1){var _0x15716c=BPromise[_0xa5e2('0x71')](jwt['verify'],{'context':jwt});var _0x41698d=_0x3f7bf1||config[_0xa5e2('0x9')][_0xa5e2('0x73')];return new BPromise(function(_0x3325d0,_0x22c1d1){_0x15716c(_0x1becf2,_0x41698d,_0x38a5c4)[_0xa5e2('0x40')](function(_0x3867f2){_0x3325d0(_0x3867f2);})['catch'](function(_0x2c0ea4){_0x22c1d1(_0x2c0ea4);});});}function generateNonce(){return crypto[_0xa5e2('0x74')](0x10)[_0xa5e2('0x75')](_0xa5e2('0x76'));}function generateIssuedAt(){return Math['floor'](Date[_0xa5e2('0x77')]()/0x3e8)[_0xa5e2('0x75')]();}function createJwt(_0x5f36b5){var _0x783224={'payload':{'iat':_0x5f36b5[_0xa5e2('0x5d')],'nonce':_0x5f36b5['apiKeyNonce']},'options':{'algorithm':_0xa5e2('0x78'),'subject':_0x5f36b5['id'][_0xa5e2('0x75')](),'issuer':hardwareConf[_0xa5e2('0x3e')](),'audience':hardwareConf[_0xa5e2('0x3e')]()}};return signJwt(_0x783224)[_0xa5e2('0x40')](function(_0x559325){return{'iat':_0x5f36b5[_0xa5e2('0x5d')],'nonce':_0x5f36b5[_0xa5e2('0x46')],'token':_0x559325};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index dda7203..8bb0e51 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 _0xc22b=['data','encryptString','secret','createCipher','utf8','base64','decryptString','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','update','binary','end','final','write','close','unlink','decryptFile','createDecipher'];(function(_0x24213e,_0x53784f){var _0x5f8009=function(_0x4069a0){while(--_0x4069a0){_0x24213e['push'](_0x24213e['shift']());}};_0x5f8009(++_0x53784f);}(_0xc22b,0x193));var _0xbc22=function(_0x5aec6f,_0x597ce5){_0x5aec6f=_0x5aec6f-0x0;var _0x55fa01=_0xc22b[_0x5aec6f];return _0x55fa01;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xbc22('0x0'));var _=require(_0xbc22('0x1'));var config=require(_0xbc22('0x2'));var logger=require(_0xbc22('0x3'))(_0xbc22('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xbc22('0x5')][_0xbc22('0x6')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xbc22('0x7')};if(config['encrypt']&&config[_0xbc22('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xbc22('0x8')][_0xbc22('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0xbc22('0x8')][_0xbc22('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xbc22('0xa')](config[_0xbc22('0x8')]['algorithm'],_0xbc22('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x515ebc){return AES_SUPPORTED_RX[_0xbc22('0xc')](_0x515ebc);}function getSupportedCiphers(){return crypto[_0xbc22('0xd')]()[_0xbc22('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x33fb0c){return getSupportedCiphers()[_0xbc22('0xf')](_0x33fb0c)>-0x1;}function combineOptions(_0x3e9486){var _0x1d6e17={};for(var _0x52d374 in fileOptions){if(fileOptions[_0xbc22('0x10')](_0x52d374)){_0x1d6e17[_0x52d374]=fileOptions[_0x52d374];}}if(_0x3e9486){for(var _0x5abb40 in _0x3e9486){if(_0x3e9486['hasOwnProperty'](_0x5abb40)){_0x1d6e17[_0x5abb40]=_0x3e9486[_0x5abb40];}}}return _0x1d6e17;}exports[_0xbc22('0x11')]=function(_0x38502c,_0x535835,_0x1f28fb,_0x45aa42){return new BPromise(function(_0x83abda,_0x3e9d6f){_0x45aa42=combineOptions(_0x45aa42);var _0x2f5af9=new Buffer(_0x1f28fb);var _0x1232e8=fs[_0xbc22('0x12')](_0x38502c);var _0x3d852c=fs[_0xbc22('0x13')](_0x535835);var _0x212f84=crypto['createCipher'](_0x45aa42['algorithm'],_0x2f5af9);_0x1232e8['on']('data',function(_0x54c405){var _0x5153f5=new Buffer(_0x212f84[_0xbc22('0x14')](_0x54c405),_0xbc22('0x15'));_0x3d852c['write'](_0x5153f5);});_0x1232e8['on'](_0xbc22('0x16'),function(){try{var _0x4eca85=new Buffer(_0x212f84[_0xbc22('0x17')](_0xbc22('0x15')),'binary');_0x3d852c[_0xbc22('0x18')](_0x4eca85);_0x3d852c[_0xbc22('0x16')]();_0x3d852c['on'](_0xbc22('0x19'),function(){return _0x83abda(_0x535835);});}catch(_0x3c749f){fs[_0xbc22('0x1a')](_0x535835);return _0x3e9d6f(_0x3c749f);}});});};exports[_0xbc22('0x1b')]=function(_0x1615a5,_0x356eb4,_0x26b12f,_0x50cc0c){return new BPromise(function(_0x53384f,_0x28abfb){_0x50cc0c=combineOptions(_0x50cc0c);var _0x5b4ad3=new Buffer(_0x26b12f);var _0x5277d2=fs[_0xbc22('0x12')](_0x1615a5);var _0x1dfbc9=fs[_0xbc22('0x13')](_0x356eb4);var _0x4b0fb2=crypto[_0xbc22('0x1c')](_0x50cc0c[_0xbc22('0x9')],_0x5b4ad3);_0x5277d2['on'](_0xbc22('0x1d'),function(_0x418b30){var _0x594028=new Buffer(_0x4b0fb2[_0xbc22('0x14')](_0x418b30),_0xbc22('0x15'));_0x1dfbc9['write'](_0x594028);});_0x5277d2['on']('end',function(){try{var _0x4eebee=new Buffer(_0x4b0fb2[_0xbc22('0x17')](_0xbc22('0x15')),'binary');_0x1dfbc9[_0xbc22('0x18')](_0x4eebee);_0x1dfbc9[_0xbc22('0x16')]();_0x1dfbc9['on'](_0xbc22('0x19'),function(){return _0x53384f(_0x356eb4);});}catch(_0x4aa84b){fs[_0xbc22('0x1a')](_0x356eb4);return _0x28abfb(_0x4aa84b);}});});};exports[_0xbc22('0x1e')]=function(_0x4ae6e2,_0xaec86,_0x933742){var _0x329c68=_0x933742||stringOptions[_0xbc22('0x9')];var _0x16ef02=_0xaec86||stringOptions[_0xbc22('0x1f')];var _0x52e4ed=crypto[_0xbc22('0x20')](_0x329c68,_0x16ef02);var _0x120051=_0x52e4ed[_0xbc22('0x14')](_0x4ae6e2,_0xbc22('0x21'),_0xbc22('0x22'));_0x120051+=_0x52e4ed['final'](_0xbc22('0x22'));return _0x120051;};exports[_0xbc22('0x23')]=function(_0x1b1ee5,_0x120b24,_0x18287a){var _0x3762d2=_0x18287a||stringOptions[_0xbc22('0x9')];var _0x30f4c2=_0x120b24||stringOptions[_0xbc22('0x1f')];var _0x31d74e=crypto[_0xbc22('0x1c')](_0x3762d2,_0x30f4c2);var _0x520338=_0x31d74e[_0xbc22('0x14')](_0x1b1ee5,_0xbc22('0x22'),_0xbc22('0x21'));_0x520338+=_0x31d74e[_0xbc22('0x17')](_0xbc22('0x21'));return _0x520338;}; \ No newline at end of file +var _0x6340=['base64','decryptString','createDecipher','crypto','bluebird','lodash','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','hasOwnProperty','encryptFile','createReadStream','data','update','binary','write','end','final','close','unlink','decryptFile','encryptString','secret','createCipher','utf8'];(function(_0x3460a7,_0x2a899e){var _0x3e954e=function(_0xeca243){while(--_0xeca243){_0x3460a7['push'](_0x3460a7['shift']());}};_0x3e954e(++_0x2a899e);}(_0x6340,0x10b));var _0x0634=function(_0x571c00,_0x3ae028){_0x571c00=_0x571c00-0x0;var _0x2887df=_0x6340[_0x571c00];return _0x2887df;};'use strict';var crypto=require(_0x0634('0x0'));var fs=require('fs');var BPromise=require(_0x0634('0x1'));var _=require(_0x0634('0x2'));var config=require(_0x0634('0x3'));var logger=require(_0x0634('0x4'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0634('0x5')][_0x0634('0x6')],'algorithm':_0x0634('0x7')};const fileOptions={'algorithm':_0x0634('0x8')};if(config[_0x0634('0x9')]&&config[_0x0634('0x9')][_0x0634('0xa')]){var isSupported=isAlgorithmSupported(config[_0x0634('0x9')][_0x0634('0xa')]);if(isSupported){fileOptions[_0x0634('0xa')]=config[_0x0634('0x9')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x0634('0xb')](',\x20');logger['error'](config[_0x0634('0x9')]['algorithm'],_0x0634('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x436d78){return AES_SUPPORTED_RX[_0x0634('0xd')](_0x436d78);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0xc27caa){return getSupportedCiphers()['indexOf'](_0xc27caa)>-0x1;}function combineOptions(_0x479107){var _0x34e5d6={};for(var _0x3a6fe0 in fileOptions){if(fileOptions[_0x0634('0xe')](_0x3a6fe0)){_0x34e5d6[_0x3a6fe0]=fileOptions[_0x3a6fe0];}}if(_0x479107){for(var _0x207f3d in _0x479107){if(_0x479107[_0x0634('0xe')](_0x207f3d)){_0x34e5d6[_0x207f3d]=_0x479107[_0x207f3d];}}}return _0x34e5d6;}exports[_0x0634('0xf')]=function(_0xde6924,_0x2b3d7a,_0x2f687f,_0x5581d9){return new BPromise(function(_0x22866f,_0x11c09e){_0x5581d9=combineOptions(_0x5581d9);var _0x587d41=new Buffer(_0x2f687f);var _0x2eec4b=fs[_0x0634('0x10')](_0xde6924);var _0x3772ad=fs['createWriteStream'](_0x2b3d7a);var _0x1e642a=crypto['createCipher'](_0x5581d9[_0x0634('0xa')],_0x587d41);_0x2eec4b['on'](_0x0634('0x11'),function(_0x3292d4){var _0x463f65=new Buffer(_0x1e642a[_0x0634('0x12')](_0x3292d4),_0x0634('0x13'));_0x3772ad[_0x0634('0x14')](_0x463f65);});_0x2eec4b['on'](_0x0634('0x15'),function(){try{var _0x1da109=new Buffer(_0x1e642a[_0x0634('0x16')](_0x0634('0x13')),_0x0634('0x13'));_0x3772ad[_0x0634('0x14')](_0x1da109);_0x3772ad['end']();_0x3772ad['on'](_0x0634('0x17'),function(){return _0x22866f(_0x2b3d7a);});}catch(_0x43b02a){fs[_0x0634('0x18')](_0x2b3d7a);return _0x11c09e(_0x43b02a);}});});};exports[_0x0634('0x19')]=function(_0x494608,_0x118ef2,_0x42fa55,_0x507feb){return new BPromise(function(_0x39c2e2,_0x2bc2dd){_0x507feb=combineOptions(_0x507feb);var _0x41a6ef=new Buffer(_0x42fa55);var _0x103a00=fs[_0x0634('0x10')](_0x494608);var _0x46d639=fs['createWriteStream'](_0x118ef2);var _0x2e7fb6=crypto['createDecipher'](_0x507feb[_0x0634('0xa')],_0x41a6ef);_0x103a00['on']('data',function(_0x1e43e7){var _0x2b87c7=new Buffer(_0x2e7fb6[_0x0634('0x12')](_0x1e43e7),_0x0634('0x13'));_0x46d639[_0x0634('0x14')](_0x2b87c7);});_0x103a00['on'](_0x0634('0x15'),function(){try{var _0x408671=new Buffer(_0x2e7fb6[_0x0634('0x16')](_0x0634('0x13')),_0x0634('0x13'));_0x46d639['write'](_0x408671);_0x46d639[_0x0634('0x15')]();_0x46d639['on'](_0x0634('0x17'),function(){return _0x39c2e2(_0x118ef2);});}catch(_0x2fa48c){fs[_0x0634('0x18')](_0x118ef2);return _0x2bc2dd(_0x2fa48c);}});});};exports[_0x0634('0x1a')]=function(_0x2ac90a,_0x37f743,_0x365d5b){var _0x4e74a4=_0x365d5b||stringOptions[_0x0634('0xa')];var _0x5d79a9=_0x37f743||stringOptions[_0x0634('0x1b')];var _0x2baca4=crypto[_0x0634('0x1c')](_0x4e74a4,_0x5d79a9);var _0x48f94a=_0x2baca4['update'](_0x2ac90a,_0x0634('0x1d'),_0x0634('0x1e'));_0x48f94a+=_0x2baca4[_0x0634('0x16')]('base64');return _0x48f94a;};exports[_0x0634('0x1f')]=function(_0x67a5b4,_0x5b9829,_0x4c3ded){var _0x1bd291=_0x4c3ded||stringOptions[_0x0634('0xa')];var _0x19346d=_0x5b9829||stringOptions[_0x0634('0x1b')];var _0x4bd661=crypto[_0x0634('0x20')](_0x1bd291,_0x19346d);var _0x617239=_0x4bd661[_0x0634('0x12')](_0x67a5b4,_0x0634('0x1e'),'utf8');_0x617239+=_0x4bd661['final'](_0x0634('0x1d'));return _0x617239;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 2aebae3..67c933a 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 _0xf403=['../../mysqldb','dbH','argv','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','query','QueryTypes','SELECT','Empty','num','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','length','%s%d.%s','%s.%s','writeFileSync','zip','info','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','to-csv','bluebird','zip-dir','rimraf'];(function(_0x7fa013,_0x26498b){var _0x55a2be=function(_0x423b15){while(--_0x423b15){_0x7fa013['push'](_0x7fa013['shift']());}};_0x55a2be(++_0x26498b);}(_0xf403,0x1d3));var _0x3f40=function(_0x180e09,_0x38355a){_0x180e09=_0x180e09-0x0;var _0x21d4c0=_0xf403[_0x180e09];return _0x21d4c0;};'use strict';var util=require(_0x3f40('0x0'));var path=require('path');var _=require(_0x3f40('0x1'));var csv=require(_0x3f40('0x2'));var fs=require('fs');var BPromise=require(_0x3f40('0x3'));var zipdir=require(_0x3f40('0x4'));var rimraf=require(_0x3f40('0x5'));var db=require(_0x3f40('0x6'))['db'];var dbH=require(_0x3f40('0x6'))[_0x3f40('0x7')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x3f40('0x8')][0x2]);var QUERY=process[_0x3f40('0x8')][0x3];var PATH=process[_0x3f40('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1f21fa,_0x5878f9){var _0x1dffe8={'status':_0x1f21fa};var _0x4c1694={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5878f9){_0x1dffe8['savename']=_0x5878f9;}return db[_0x3f40('0x9')][_0x3f40('0xa')](_0x1dffe8,_0x4c1694);}function main(){var _0x40d198=0x1388;var _0x5bf41d;logger['info'](util[_0x3f40('0xb')](_0x3f40('0xc'),EXTRACTED_REPORT_ID,_0x3f40('0xd')));return db['Setting'][_0x3f40('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3f40('0xf'),_0x3f40('0x10')]})['then'](function(_0x332635){if(_0x332635){_0x5bf41d=_0x332635;_0x40d198=_0x5bf41d['splitSizeCsv']||0x1388;}})[_0x3f40('0x11')](function(){return dbH[_0x3f40('0x12')][_0x3f40('0x13')](util[_0x3f40('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x3f40('0x12')][_0x3f40('0x14')][_0x3f40('0x15')]});})[_0x3f40('0x11')](function(_0x232241){if(!_0x232241[0x0]['num']){return analyticExtractedReport(_0x3f40('0x16'));}var _0x3d11c9=[];var _0x535f85=0x0;var _0x4ef80e=!![];if(_0x232241&&_0x232241['length']){var _0x206630=_0x232241[0x0][_0x3f40('0x17')]%(_0x535f85+_0x40d198);if(_0x5bf41d[_0x3f40('0xf')]){for(;_0x4ef80e;_0x535f85+=_0x40d198,_0x206630=_0x232241[0x0][_0x3f40('0x17')]%(_0x535f85+_0x40d198)){if(_0x206630==0x0||_0x206630==_0x232241[0x0][_0x3f40('0x17')]){_0x4ef80e=![];}_0x3d11c9['push'](dbH[_0x3f40('0x12')][_0x3f40('0x13')](util[_0x3f40('0xb')](_0x3f40('0x18'),QUERY,_0x40d198,_0x535f85),{'type':dbH[_0x3f40('0x12')]['QueryTypes'][_0x3f40('0x15')]}));}}else{_0x3d11c9['push'](dbH[_0x3f40('0x12')][_0x3f40('0x13')](QUERY,{'type':dbH[_0x3f40('0x12')][_0x3f40('0x14')][_0x3f40('0x15')]}));}}var _0x4aa559=path[_0x3f40('0x19')](PATH);var _0x379b4e=path[_0x3f40('0x1a')](PATH,_0x3f40('0x1b'));var _0x258de9=_0x5bf41d[_0x3f40('0xf')]&&_0x3d11c9['length']>0x1;var _0x31fc91=[];if(!fs[_0x3f40('0x1c')](path[_0x3f40('0x1d')](_0x4aa559,_0x379b4e))&&_0x258de9){fs['mkdirSync'](path[_0x3f40('0x1d')](_0x4aa559,_0x379b4e));}return BPromise['each'](_0x3d11c9,function(_0x37b47e){_0x31fc91['push'](_0x37b47e);})['then'](function(){for(var _0x4b0ade=0x0;_0x4b0ade<_0x31fc91[_0x3f40('0x1e')];_0x4b0ade+=0x1){var _0x26e46b;var _0x140044=_0x31fc91[_0x4b0ade];if(_0x258de9){_0x26e46b=path[_0x3f40('0x1d')](_0x4aa559,_0x379b4e,util['format'](_0x3f40('0x1f'),_0x379b4e,_0x4b0ade,'csv'));}else{_0x26e46b=path[_0x3f40('0x1d')](_0x4aa559,util[_0x3f40('0xb')](_0x3f40('0x20'),_0x379b4e,'csv'));}fs[_0x3f40('0x21')](_0x26e46b,csv(_0x140044));}})['then'](function(){if(_0x258de9){zipdir(path[_0x3f40('0x1d')](_0x4aa559,_0x379b4e),{'saveTo':path['join'](_0x4aa559,util['format'](_0x3f40('0x20'),_0x379b4e,_0x3f40('0x22')))},function(_0x14fdfd,_0xb23186){});rimraf(path[_0x3f40('0x1d')](_0x4aa559,_0x379b4e),function(){});}})[_0x3f40('0x11')](function(){logger[_0x3f40('0x23')](util[_0x3f40('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x3f40('0xd')));return analyticExtractedReport(_0x3f40('0x24'),_0x258de9?util[_0x3f40('0xb')](_0x3f40('0x20'),_0x379b4e,_0x258de9?_0x3f40('0x22'):'csv'):null);});})[_0x3f40('0x25')](function(_0x86d9cb){logger[_0x3f40('0x23')](util['format'](_0x3f40('0x26'),EXTRACTED_REPORT_ID,_0x3f40('0xd')),util[_0x3f40('0x27')](_0x86d9cb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3f40('0x28'));})[_0x3f40('0x29')](function(){process[_0x3f40('0x2a')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2f68=['%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','mkdirSync','join','%s%d.%s','csv','writeFileSync','%s.%s','zip','info','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','push'];(function(_0x2d608a,_0x329c0a){var _0x580d6f=function(_0x101051){while(--_0x101051){_0x2d608a['push'](_0x2d608a['shift']());}};_0x580d6f(++_0x329c0a);}(_0x2f68,0x9a));var _0x82f6=function(_0x43e86f,_0x5aa58a){_0x43e86f=_0x43e86f-0x0;var _0x30a08a=_0x2f68[_0x43e86f];return _0x30a08a;};'use strict';var util=require('util');var path=require(_0x82f6('0x0'));var _=require(_0x82f6('0x1'));var csv=require(_0x82f6('0x2'));var fs=require('fs');var BPromise=require(_0x82f6('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x82f6('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x82f6('0x5'))[_0x82f6('0x6')];var logger=require('../../config/logger')(_0x82f6('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x82f6('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1bc0be,_0x5660bf){var _0x5daa3c={'status':_0x1bc0be};var _0x864400={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5660bf){_0x5daa3c[_0x82f6('0x9')]=_0x5660bf;}return db[_0x82f6('0xa')]['update'](_0x5daa3c,_0x864400);}function main(){var _0x27db58=0x1388;var _0x432289;logger['info'](util[_0x82f6('0xb')](_0x82f6('0xc'),EXTRACTED_REPORT_ID,_0x82f6('0xd')));return db[_0x82f6('0xe')][_0x82f6('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x82f6('0x10'),'splitSizeCsv']})[_0x82f6('0x11')](function(_0x442262){if(_0x442262){_0x432289=_0x442262;_0x27db58=_0x432289['splitSizeCsv']||0x1388;}})[_0x82f6('0x11')](function(){return dbH[_0x82f6('0x12')][_0x82f6('0x13')](util[_0x82f6('0xb')](_0x82f6('0x14'),QUERY),{'type':dbH[_0x82f6('0x12')][_0x82f6('0x15')][_0x82f6('0x16')]});})[_0x82f6('0x11')](function(_0x55b58e){if(!_0x55b58e[0x0][_0x82f6('0x17')]){return analyticExtractedReport('Empty');}var _0x249222=[];var _0x1d0263=0x0;var _0x31b4fb=!![];if(_0x55b58e&&_0x55b58e[_0x82f6('0x18')]){var _0x18e8dd=_0x55b58e[0x0][_0x82f6('0x17')]%(_0x1d0263+_0x27db58);if(_0x432289[_0x82f6('0x10')]){for(;_0x31b4fb;_0x1d0263+=_0x27db58,_0x18e8dd=_0x55b58e[0x0][_0x82f6('0x17')]%(_0x1d0263+_0x27db58)){if(_0x18e8dd==0x0||_0x18e8dd==_0x55b58e[0x0][_0x82f6('0x17')]){_0x31b4fb=![];}_0x249222[_0x82f6('0x19')](dbH[_0x82f6('0x12')][_0x82f6('0x13')](util[_0x82f6('0xb')](_0x82f6('0x1a'),QUERY,_0x27db58,_0x1d0263),{'type':dbH[_0x82f6('0x12')]['QueryTypes'][_0x82f6('0x16')]}));}}else{_0x249222[_0x82f6('0x19')](dbH['sequelize'][_0x82f6('0x13')](QUERY,{'type':dbH[_0x82f6('0x12')][_0x82f6('0x15')][_0x82f6('0x16')]}));}}var _0x4bfeb8=path[_0x82f6('0x1b')](PATH);var _0x4beccf=path[_0x82f6('0x1c')](PATH,_0x82f6('0x1d'));var _0x573a46=_0x432289['split']&&_0x249222[_0x82f6('0x18')]>0x1;var _0x1d96d5=[];if(!fs['existsSync'](path['join'](_0x4bfeb8,_0x4beccf))&&_0x573a46){fs[_0x82f6('0x1e')](path[_0x82f6('0x1f')](_0x4bfeb8,_0x4beccf));}return BPromise['each'](_0x249222,function(_0xfd8b68){_0x1d96d5[_0x82f6('0x19')](_0xfd8b68);})['then'](function(){for(var _0x57ac0d=0x0;_0x57ac0d<_0x1d96d5[_0x82f6('0x18')];_0x57ac0d+=0x1){var _0x5187d0;var _0x469b6b=_0x1d96d5[_0x57ac0d];if(_0x573a46){_0x5187d0=path[_0x82f6('0x1f')](_0x4bfeb8,_0x4beccf,util['format'](_0x82f6('0x20'),_0x4beccf,_0x57ac0d,_0x82f6('0x21')));}else{_0x5187d0=path[_0x82f6('0x1f')](_0x4bfeb8,util[_0x82f6('0xb')]('%s.%s',_0x4beccf,_0x82f6('0x21')));}fs[_0x82f6('0x22')](_0x5187d0,csv(_0x469b6b));}})[_0x82f6('0x11')](function(){if(_0x573a46){zipdir(path[_0x82f6('0x1f')](_0x4bfeb8,_0x4beccf),{'saveTo':path[_0x82f6('0x1f')](_0x4bfeb8,util[_0x82f6('0xb')](_0x82f6('0x23'),_0x4beccf,_0x82f6('0x24')))},function(_0x1e1aa4,_0x402449){});rimraf(path[_0x82f6('0x1f')](_0x4bfeb8,_0x4beccf),function(){});}})[_0x82f6('0x11')](function(){logger[_0x82f6('0x25')](util[_0x82f6('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x82f6('0xd')));return analyticExtractedReport(_0x82f6('0x26'),_0x573a46?util[_0x82f6('0xb')]('%s.%s',_0x4beccf,_0x573a46?_0x82f6('0x24'):_0x82f6('0x21')):null);});})[_0x82f6('0x27')](function(_0x3da5a9){logger[_0x82f6('0x25')](util[_0x82f6('0xb')](_0x82f6('0x28'),EXTRACTED_REPORT_ID,_0x82f6('0xd')),util[_0x82f6('0x29')](_0x3da5a9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x82f6('0x2a'));})[_0x82f6('0x2b')](function(){process[_0x82f6('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index c61270d..58d2e0a 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 _0xa459=['query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','split','existsSync','all','flatten','createPdfKitDocument','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','AnalyticExtractedReport','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','finish','end','createPdfFromHTML','lodash','util','path','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','map','tableHeader','pick','toString','fill','auto','body','concat','keys','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','length','push','header','pageBreak','margin','landscape','Arial','Empty','.pdf','join','%s.%s','pdf','Setting','find','then','splitSizePdf','num','sequelize'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xa459,0xcc));var _0x9a45=function(_0x316d59,_0x46390a){_0x316d59=_0x316d59-0x0;var _0x53770b=_0xa459[_0x316d59];return _0x53770b;};'use strict';var _=require(_0x9a45('0x0'));var fs=require('fs');var util=require(_0x9a45('0x1'));var path=require(_0x9a45('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0x9a45('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x9a45('0x4'));var rimraf=require(_0x9a45('0x5'));var JSDOM=require(_0x9a45('0x6'))[_0x9a45('0x7')];var window=new JSDOM('')[_0x9a45('0x8')];var db=require(_0x9a45('0x9'))['db'];var dbH=require(_0x9a45('0x9'))[_0x9a45('0xa')];var logger=require(_0x9a45('0xb'))(_0x9a45('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x9a45('0xd')][0x2]);var QUERY=process[_0x9a45('0xd')][0x3];var PATH=process[_0x9a45('0xd')][0x4];var NAME=process[_0x9a45('0xd')][0x5];var FORMAT=_0x9a45('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x14cfc4,_0x563322){var _0x443f1c={'status':_0x14cfc4};var _0x42f4d7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x563322){_0x443f1c[_0x9a45('0xf')]=_0x563322;}return db['AnalyticExtractedReport']['update'](_0x443f1c,_0x42f4d7);}function getHeaders(_0x7198ed){return _[_0x9a45('0x10')](_0x7198ed,function(_0x2fe052){return{'text':_0x2fe052,'style':_0x9a45('0x11')};});}function getRows(_0x1cc5bb,_0x1d8361){return _[_0x9a45('0x10')](_0x1d8361,function(_0x11ae45){return _(_0x11ae45)[_0x9a45('0x12')](_0x1cc5bb)['map'](function(_0xeaf378){return _0xeaf378?_[_0x9a45('0x13')](_0xeaf378):'';})['value']();});}function createTable(_0x380e06,_0x7f002d){var _0x277aef={'widths':_[_0x9a45('0x14')](Array(_0x380e06['length']),0x91),'heights':function(_0x3801d6){return _0x3801d6===0x0?_0x9a45('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5f0f79=getHeaders(_0x380e06);_0x277aef[_0x9a45('0x16')]['push'](_0x5f0f79);var _0x3d3d44=getRows(_0x380e06,_0x7f002d);_0x277aef[_0x9a45('0x16')]=_0x277aef[_0x9a45('0x16')][_0x9a45('0x17')](_0x3d3d44);return _0x277aef;}function createTables(_0x85be5e){var _0x598bd5=[];var _0x2b9cab=_['chunk'](Object[_0x9a45('0x18')](_0x85be5e[0x0]),0x5);_0x2b9cab['forEach'](function(_0x356fa7){_0x598bd5['push'](createTable(_0x356fa7,_0x85be5e));});return _0x598bd5;}function getPDFDocDefinition(_0x53e565){var _0x500575=util['format'](_0x9a45('0x19'),NAME,EXTRACTED_REPORT[_0x9a45('0x1a')],moment(EXTRACTED_REPORT[_0x9a45('0x1b')])[_0x9a45('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x9a45('0x1d')])['format'](FORMAT));var _0x377d8e=[];for(var _0x3e586b=0x0;_0x3e586b<_0x53e565[_0x9a45('0x1e')];_0x3e586b++){var _0x10c705=[];if(_0x3e586b===0x0){_0x10c705[_0x9a45('0x1f')]({'text':_0x500575,'style':_0x9a45('0x20')});}var _0x4d402d={'table':_0x53e565[_0x3e586b]};if(_0x3e586b>0x0){_0x4d402d[_0x9a45('0x21')]='before';_0x4d402d[_0x9a45('0x22')]=[0x0,0x46,0x0,0x0];}_0x10c705[_0x9a45('0x1f')](_0x4d402d);_0x377d8e['push'](_0x10c705);}return{'pageSize':'A4','pageOrientation':_0x9a45('0x23'),'content':_0x377d8e,'footer':function(_0x491726,_0x5ad29a){return{'text':_0x491726['toString']()+'\x20/\x20'+_0x5ad29a,'style':'footer'};},'defaultStyle':{'font':_0x9a45('0x24')},'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(_0x53b848){var _0x3901bf=0x1388;var _0x15135a;if(!_0x53b848[0x0]['num']){return analyticExtractedReport(_0x9a45('0x25'));}var _0x557964=[];var _0x33308f=0x0;var _0xd7a7b2=!![];var _0x3b650e=path['dirname'](PATH);var _0x12dfa6=path['basename'](PATH,_0x9a45('0x26'));var _0x464ab9=path[_0x9a45('0x27')](_0x3b650e,util[_0x9a45('0x1c')](_0x9a45('0x28'),_0x12dfa6,_0x9a45('0x29')));var _0x420fc0=![];return db[_0x9a45('0x2a')][_0x9a45('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})[_0x9a45('0x2c')](function(_0x1aa061){if(_0x1aa061){_0x15135a=_0x1aa061;_0x3901bf=_0x15135a[_0x9a45('0x2d')]||0x3e8;}})[_0x9a45('0x2c')](function(){if(_0x53b848&&_0x53b848[_0x9a45('0x1e')]){var _0x4ad8f4=_0x53b848[0x0][_0x9a45('0x2e')]%(_0x33308f+_0x3901bf);if(_0x15135a['split']){for(;_0xd7a7b2;_0x33308f+=_0x3901bf,_0x4ad8f4=_0x53b848[0x0][_0x9a45('0x2e')]%(_0x33308f+_0x3901bf)){if(_0x4ad8f4==0x0||_0x4ad8f4==_0x53b848[0x0][_0x9a45('0x2e')]){_0xd7a7b2=![];}_0x557964[_0x9a45('0x1f')](dbH[_0x9a45('0x2f')][_0x9a45('0x30')](util[_0x9a45('0x1c')](_0x9a45('0x31'),QUERY,_0x3901bf,_0x33308f),{'type':dbH[_0x9a45('0x2f')][_0x9a45('0x32')][_0x9a45('0x33')]}));}}else{_0x557964[_0x9a45('0x1f')](dbH[_0x9a45('0x2f')][_0x9a45('0x30')](QUERY,{'type':dbH[_0x9a45('0x2f')]['QueryTypes'][_0x9a45('0x33')]}));}}_0x420fc0=_0x15135a[_0x9a45('0x34')]&&_0x557964['length']>0x1;if(!fs[_0x9a45('0x35')](path[_0x9a45('0x27')](_0x3b650e,_0x12dfa6))&&_0x420fc0){fs['mkdirSync'](path[_0x9a45('0x27')](_0x3b650e,_0x12dfa6));}return Promise[_0x9a45('0x36')](_0x557964);})[_0x9a45('0x2c')](function(_0x342727){return createTables(_[_0x9a45('0x37')](_0x342727));})[_0x9a45('0x2c')](function(_0x3a1fd9){var _0xccf2d2=getPDFDocDefinition(_0x3a1fd9);var _0x5b9e81=getPDFPrinter();var _0x663239=_0x5b9e81[_0x9a45('0x38')](_0xccf2d2);if(_0x420fc0)_0x464ab9=path[_0x9a45('0x27')](_0x3b650e,_0x12dfa6,util[_0x9a45('0x1c')]('%s%d.%s',_0x12dfa6,index,_0x9a45('0x29')));return writePDFDocument(_0x663239,_0x464ab9);})[_0x9a45('0x2c')](function(){if(!_0x420fc0)return;zipdir(path['join'](_0x3b650e,_0x12dfa6),{'saveTo':path[_0x9a45('0x27')](_0x3b650e,util['format'](_0x9a45('0x28'),_0x12dfa6,'zip'))},function(_0x58eaf4){if(_0x58eaf4)throw _0x58eaf4;return;});})[_0x9a45('0x2c')](function(){if(!_0x420fc0)return;rimraf(path['join'](_0x3b650e,_0x12dfa6),function(){});})['then'](function(){logger['info'](util[_0x9a45('0x1c')](_0x9a45('0x39'),EXTRACTED_REPORT_ID,_0x9a45('0x3a')));return analyticExtractedReport(_0x9a45('0x3b'),_0x420fc0?util[_0x9a45('0x1c')]('%s.%s',_0x12dfa6,_0x420fc0?_0x9a45('0x3c'):'pdf'):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x9a45('0x1c')](_0x9a45('0x3d'),EXTRACTED_REPORT_ID,_0x9a45('0x3e')));return db[_0x9a45('0x3f')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x9a45('0x2c')](function(_0x2cb7b2){EXTRACTED_REPORT=_0x2cb7b2;return dbH[_0x9a45('0x2f')][_0x9a45('0x30')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x9a45('0x2f')][_0x9a45('0x32')][_0x9a45('0x33')]});})[_0x9a45('0x2c')](extractReport)[_0x9a45('0x40')](function(_0x37a87e){logger[_0x9a45('0x41')](util[_0x9a45('0x1c')](_0x9a45('0x42'),EXTRACTED_REPORT_ID,_0x9a45('0x3e')),util[_0x9a45('0x43')](_0x37a87e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9a45('0x44'));})[_0x9a45('0x45')](function(){process[_0x9a45('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2f8a78=new PdfPrinter({'Arial':{'normal':__dirname+_0x9a45('0x47'),'bold':__dirname+_0x9a45('0x48'),'italics':__dirname+_0x9a45('0x49'),'bolditalics':__dirname+_0x9a45('0x4a')}});return _0x2f8a78;}function getPDFDocDefinitionFromHTML(_0x3ff978,_0x126ac6){var _0x141005=util[_0x9a45('0x1c')](_0x9a45('0x4b'),_0x126ac6['channel'],_0x126ac6['interactionId']);var _0x37437a=moment()[_0x9a45('0x1c')]('YYYY-MM-DD')[_0x9a45('0x13')]();var _0x458c92=htmlToPdfmake(_0x3ff978,{'window':window,'tableAutoSize':!![]});return{'content':[_0x458c92],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x9a45('0x4c'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x9a45('0x4c'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x9a45('0x4d'),'style':_0x9a45('0x20')}];},'footer':function(_0x525026,_0x54daf9){return[{'text':util[_0x9a45('0x1c')](_0x9a45('0x4e'),_0x141005,_0x525026,_0x54daf9,_0x37437a),'style':_0x9a45('0x4f')}];}};}function writePDFDocument(_0x24f063,_0x385829){return new Promise(function(_0x1bca19,_0x5b9f4b){var _0x516ee7=_0x24f063[_0x9a45('0x50')](fs['createWriteStream'](_0x385829));_0x516ee7['on'](_0x9a45('0x51'),function(){_0x1bca19(_0x9a45('0x51'));});_0x516ee7['on']('error',function(_0x5cc90d){_0x5b9f4b(_0x5cc90d);});_0x24f063[_0x9a45('0x52')]();});}exports[_0x9a45('0x53')]=function(_0x2af75d,_0x3383a5){var _0x5328ab=getPDFPrinter();var _0x158398=getPDFDocDefinitionFromHTML(_0x2af75d,_0x3383a5);var _0x259109=_0x5328ab[_0x9a45('0x38')](_0x158398);return writePDFDocument(_0x259109,_0x3383a5[_0x9a45('0x2')])[_0x9a45('0x40')](function(_0x1fc6d2){throw _0x1fc6d2;});}; \ No newline at end of file +var _0xc391=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','createWriteStream','error','end','createPdfFromHTML','util','path','moment','zip-dir','rimraf','JSDOM','window','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','pick','toString','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','before','margin','landscape','\x20/\x20','footer','black','right','num','Empty','dirname','basename','pdf','Setting','find','split','then','splitSizePdf','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','sequelize','existsSync','join','mkdirSync','all','flatten','createPdfKitDocument','%s%d.%s','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne'];(function(_0x16f31e,_0x43c929){var _0x1bbb40=function(_0x1750ca){while(--_0x1750ca){_0x16f31e['push'](_0x16f31e['shift']());}};_0x1bbb40(++_0x43c929);}(_0xc391,0x6c));var _0x1c39=function(_0x3c85c3,_0x5b44de){_0x3c85c3=_0x3c85c3-0x0;var _0x1a59c6=_0xc391[_0x3c85c3];return _0x1a59c6;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x1c39('0x0'));var path=require(_0x1c39('0x1'));var moment=require(_0x1c39('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x1c39('0x3'));var rimraf=require(_0x1c39('0x4'));var JSDOM=require('jsdom')[_0x1c39('0x5')];var window=new JSDOM('')[_0x1c39('0x6')];var db=require('../../mysqldb')['db'];var dbH=require(_0x1c39('0x7'))[_0x1c39('0x8')];var logger=require('../../config/logger')(_0x1c39('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x1c39('0xa')][0x2]);var QUERY=process[_0x1c39('0xa')][0x3];var PATH=process[_0x1c39('0xa')][0x4];var NAME=process[_0x1c39('0xa')][0x5];var FORMAT=_0x1c39('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3431c0,_0x51416d){var _0x59c17f={'status':_0x3431c0};var _0x168954={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x51416d){_0x59c17f['savename']=_0x51416d;}return db[_0x1c39('0xc')][_0x1c39('0xd')](_0x59c17f,_0x168954);}function getHeaders(_0x4ce78e){return _['map'](_0x4ce78e,function(_0x165599){return{'text':_0x165599,'style':'tableHeader'};});}function getRows(_0x42ca31,_0x18886e){return _[_0x1c39('0xe')](_0x18886e,function(_0x6f205a){return _(_0x6f205a)[_0x1c39('0xf')](_0x42ca31)[_0x1c39('0xe')](function(_0x2b809f){return _0x2b809f?_[_0x1c39('0x10')](_0x2b809f):'';})[_0x1c39('0x11')]();});}function createTable(_0x3a593a,_0x46ade3){var _0x4ec5aa={'widths':_[_0x1c39('0x12')](Array(_0x3a593a[_0x1c39('0x13')]),0x91),'heights':function(_0x175bd2){return _0x175bd2===0x0?_0x1c39('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5778d6=getHeaders(_0x3a593a);_0x4ec5aa[_0x1c39('0x15')][_0x1c39('0x16')](_0x5778d6);var _0x180e02=getRows(_0x3a593a,_0x46ade3);_0x4ec5aa[_0x1c39('0x15')]=_0x4ec5aa[_0x1c39('0x15')][_0x1c39('0x17')](_0x180e02);return _0x4ec5aa;}function createTables(_0x30af57){var _0x3437a3=[];var _0x159ed9=_[_0x1c39('0x18')](Object[_0x1c39('0x19')](_0x30af57[0x0]),0x5);_0x159ed9[_0x1c39('0x1a')](function(_0x29229d){_0x3437a3[_0x1c39('0x16')](createTable(_0x29229d,_0x30af57));});return _0x3437a3;}function getPDFDocDefinition(_0x33ca8a){var _0x2e6750=util[_0x1c39('0x1b')](_0x1c39('0x1c'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x1c39('0x1d')])[_0x1c39('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x1c39('0x1e')])['format'](FORMAT));var _0x138fb3=[];for(var _0x59b54b=0x0;_0x59b54b<_0x33ca8a[_0x1c39('0x13')];_0x59b54b++){var _0x39c691=[];if(_0x59b54b===0x0){_0x39c691[_0x1c39('0x16')]({'text':_0x2e6750,'style':_0x1c39('0x1f')});}var _0x37fe38={'table':_0x33ca8a[_0x59b54b]};if(_0x59b54b>0x0){_0x37fe38['pageBreak']=_0x1c39('0x20');_0x37fe38[_0x1c39('0x21')]=[0x0,0x46,0x0,0x0];}_0x39c691[_0x1c39('0x16')](_0x37fe38);_0x138fb3[_0x1c39('0x16')](_0x39c691);}return{'pageSize':'A4','pageOrientation':_0x1c39('0x22'),'content':_0x138fb3,'footer':function(_0x4c11c5,_0x4e8bc6){return{'text':_0x4c11c5[_0x1c39('0x10')]()+_0x1c39('0x23')+_0x4e8bc6,'style':_0x1c39('0x24')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1c39('0x25')},'footer':{'alignment':_0x1c39('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x6a44ed){var _0x3616b7=0x1388;var _0x20ad29;if(!_0x6a44ed[0x0][_0x1c39('0x27')]){return analyticExtractedReport(_0x1c39('0x28'));}var _0x2238df=[];var _0x1ba7b0=0x0;var _0x368422=!![];var _0x4cab96=path[_0x1c39('0x29')](PATH);var _0x1a9560=path[_0x1c39('0x2a')](PATH,'.pdf');var _0x6220eb=path['join'](_0x4cab96,util['format']('%s.%s',_0x1a9560,_0x1c39('0x2b')));var _0x3db4fe=![];return db[_0x1c39('0x2c')][_0x1c39('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1c39('0x2e'),'splitSizePdf']})[_0x1c39('0x2f')](function(_0x49b8a9){if(_0x49b8a9){_0x20ad29=_0x49b8a9;_0x3616b7=_0x20ad29[_0x1c39('0x30')]||0x3e8;}})[_0x1c39('0x2f')](function(){if(_0x6a44ed&&_0x6a44ed['length']){var _0x4c60e4=_0x6a44ed[0x0][_0x1c39('0x27')]%(_0x1ba7b0+_0x3616b7);if(_0x20ad29[_0x1c39('0x2e')]){for(;_0x368422;_0x1ba7b0+=_0x3616b7,_0x4c60e4=_0x6a44ed[0x0][_0x1c39('0x27')]%(_0x1ba7b0+_0x3616b7)){if(_0x4c60e4==0x0||_0x4c60e4==_0x6a44ed[0x0][_0x1c39('0x27')]){_0x368422=![];}_0x2238df[_0x1c39('0x16')](dbH['sequelize'][_0x1c39('0x31')](util[_0x1c39('0x1b')](_0x1c39('0x32'),QUERY,_0x3616b7,_0x1ba7b0),{'type':dbH['sequelize'][_0x1c39('0x33')][_0x1c39('0x34')]}));}}else{_0x2238df[_0x1c39('0x16')](dbH['sequelize'][_0x1c39('0x31')](QUERY,{'type':dbH[_0x1c39('0x35')][_0x1c39('0x33')][_0x1c39('0x34')]}));}}_0x3db4fe=_0x20ad29[_0x1c39('0x2e')]&&_0x2238df[_0x1c39('0x13')]>0x1;if(!fs[_0x1c39('0x36')](path[_0x1c39('0x37')](_0x4cab96,_0x1a9560))&&_0x3db4fe){fs[_0x1c39('0x38')](path[_0x1c39('0x37')](_0x4cab96,_0x1a9560));}return Promise[_0x1c39('0x39')](_0x2238df);})[_0x1c39('0x2f')](function(_0x465829){return createTables(_[_0x1c39('0x3a')](_0x465829));})[_0x1c39('0x2f')](function(_0x54ff89){var _0x3df8c6=getPDFDocDefinition(_0x54ff89);var _0x2d460f=getPDFPrinter();var _0x522581=_0x2d460f[_0x1c39('0x3b')](_0x3df8c6);if(_0x3db4fe)_0x6220eb=path['join'](_0x4cab96,_0x1a9560,util[_0x1c39('0x1b')](_0x1c39('0x3c'),_0x1a9560,index,'pdf'));return writePDFDocument(_0x522581,_0x6220eb);})[_0x1c39('0x2f')](function(){if(!_0x3db4fe)return;zipdir(path[_0x1c39('0x37')](_0x4cab96,_0x1a9560),{'saveTo':path[_0x1c39('0x37')](_0x4cab96,util[_0x1c39('0x1b')](_0x1c39('0x3d'),_0x1a9560,_0x1c39('0x3e')))},function(_0x3e4899){if(_0x3e4899)throw _0x3e4899;return;});})[_0x1c39('0x2f')](function(){if(!_0x3db4fe)return;rimraf(path['join'](_0x4cab96,_0x1a9560),function(){});})[_0x1c39('0x2f')](function(){logger[_0x1c39('0x3f')](util[_0x1c39('0x1b')](_0x1c39('0x40'),EXTRACTED_REPORT_ID,_0x1c39('0x41')));return analyticExtractedReport(_0x1c39('0x42'),_0x3db4fe?util[_0x1c39('0x1b')](_0x1c39('0x3d'),_0x1a9560,_0x3db4fe?'zip':_0x1c39('0x2b')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1c39('0x3f')](util[_0x1c39('0x1b')](_0x1c39('0x43'),EXTRACTED_REPORT_ID,_0x1c39('0x44')));return db[_0x1c39('0xc')][_0x1c39('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x1c39('0x2f')](function(_0x53b95e){EXTRACTED_REPORT=_0x53b95e;return dbH['sequelize'][_0x1c39('0x31')](util[_0x1c39('0x1b')](_0x1c39('0x46'),QUERY),{'type':dbH[_0x1c39('0x35')]['QueryTypes'][_0x1c39('0x34')]});})[_0x1c39('0x2f')](extractReport)[_0x1c39('0x47')](function(_0x44c9f8){logger[_0x1c39('0x3f')](util[_0x1c39('0x1b')](_0x1c39('0x48'),EXTRACTED_REPORT_ID,_0x1c39('0x44')),util['inspect'](_0x44c9f8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1c39('0x49'));})[_0x1c39('0x4a')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5d2df3=new PdfPrinter({'Arial':{'normal':__dirname+_0x1c39('0x4b'),'bold':__dirname+_0x1c39('0x4c'),'italics':__dirname+_0x1c39('0x4d'),'bolditalics':__dirname+_0x1c39('0x4e')}});return _0x5d2df3;}function getPDFDocDefinitionFromHTML(_0xa5a5e5,_0x399527){var _0x24ebc5=util[_0x1c39('0x1b')](_0x1c39('0x4f'),_0x399527[_0x1c39('0x50')],_0x399527['interactionId']);var _0x5c773b=moment()[_0x1c39('0x1b')](_0x1c39('0x51'))['toString']();var _0x575400=htmlToPdfmake(_0xa5a5e5,{'window':window,'tableAutoSize':!![]});return{'content':[_0x575400],'defaultStyle':{'font':_0x1c39('0x52')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x1c39('0x53'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x1c39('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x1c39('0x54'),'style':_0x1c39('0x1f')}];},'footer':function(_0x3a6a31,_0x26c40f){return[{'text':util[_0x1c39('0x1b')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x24ebc5,_0x3a6a31,_0x26c40f,_0x5c773b),'style':_0x1c39('0x24')}];}};}function writePDFDocument(_0xfc4ef5,_0x4bb955){return new Promise(function(_0x1708a5,_0x289c64){var _0x632189=_0xfc4ef5['pipe'](fs[_0x1c39('0x55')](_0x4bb955));_0x632189['on']('finish',function(){_0x1708a5('finish');});_0x632189['on'](_0x1c39('0x56'),function(_0x19f6da){_0x289c64(_0x19f6da);});_0xfc4ef5[_0x1c39('0x57')]();});}exports[_0x1c39('0x58')]=function(_0x4a72d3,_0x28ee94){var _0x7c0c5e=getPDFPrinter();var _0x417bd4=getPDFDocDefinitionFromHTML(_0x4a72d3,_0x28ee94);var _0x1888b2=_0x7c0c5e[_0x1c39('0x3b')](_0x417bd4);return writePDFDocument(_0x1888b2,_0x28ee94['path'])['catch'](function(_0x10a701){throw _0x10a701;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 9139ac2..bab6d5d 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 _0xb75f=['dirname','basename','.xlsx','existsSync','join','mkdirSync','each','xlsx','%s.%s','writeFileSync','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','length','num','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push'];(function(_0xc02d78,_0x2ca478){var _0x545a36=function(_0x4ee6a8){while(--_0x4ee6a8){_0xc02d78['push'](_0xc02d78['shift']());}};_0x545a36(++_0x2ca478);}(_0xb75f,0x71));var _0xfb75=function(_0xcca7b9,_0x59baef){_0xcca7b9=_0xcca7b9-0x0;var _0x1005c4=_0xb75f[_0xcca7b9];return _0x1005c4;};'use strict';var util=require('util');var path=require(_0xfb75('0x0'));var _=require(_0xfb75('0x1'));var fs=require('fs');var json2xls=require(_0xfb75('0x2'));var BPromise=require(_0xfb75('0x3'));var zipdir=require(_0xfb75('0x4'));var rimraf=require('rimraf');var db=require(_0xfb75('0x5'))['db'];var dbH=require(_0xfb75('0x5'))[_0xfb75('0x6')];var logger=require(_0xfb75('0x7'))(_0xfb75('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xfb75('0x9')][0x2]);var QUERY=process[_0xfb75('0x9')][0x3];var PATH=process[_0xfb75('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4f87e4,_0x5ec841){var _0xda6c91={'status':_0x4f87e4};var _0x2250b7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5ec841){_0xda6c91[_0xfb75('0xa')]=_0x5ec841;}return db[_0xfb75('0xb')][_0xfb75('0xc')](_0xda6c91,_0x2250b7);}function main(){var _0x3affb1=0x1388;var _0x2a0f25;logger[_0xfb75('0xd')](util[_0xfb75('0xe')](_0xfb75('0xf'),EXTRACTED_REPORT_ID,_0xfb75('0x10')));return db['Setting'][_0xfb75('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfb75('0x12'),_0xfb75('0x13')]})[_0xfb75('0x14')](function(_0x541fae){if(_0x541fae){_0x2a0f25=_0x541fae;_0x3affb1=_0x2a0f25[_0xfb75('0x13')]||0x1388;}})[_0xfb75('0x14')](function(){return dbH[_0xfb75('0x15')][_0xfb75('0x16')](util['format'](_0xfb75('0x17'),QUERY),{'type':dbH['sequelize'][_0xfb75('0x18')]['SELECT']});})[_0xfb75('0x14')](function(_0x2a9a86){if(!_0x2a9a86[0x0]['num']){return analyticExtractedReport(_0xfb75('0x19'));}var _0x3d01ac=[];var _0x116b77=0x0;var _0x5cef03=!![];if(_0x2a0f25[_0xfb75('0x12')]){if(_0x2a9a86&&_0x2a9a86[_0xfb75('0x1a')]){var _0x47f10f=_0x2a9a86[0x0][_0xfb75('0x1b')]%(_0x116b77+_0x3affb1);for(;_0x5cef03;_0x116b77+=_0x3affb1,_0x47f10f=_0x2a9a86[0x0][_0xfb75('0x1b')]%(_0x116b77+_0x3affb1)){if(_0x47f10f==0x0||_0x47f10f==_0x2a9a86[0x0]['num']){_0x5cef03=![];}_0x3d01ac['push'](dbH[_0xfb75('0x15')]['query'](util[_0xfb75('0xe')](_0xfb75('0x1c'),QUERY,_0x3affb1,_0x116b77),{'type':dbH[_0xfb75('0x15')][_0xfb75('0x18')][_0xfb75('0x1d')]}));}}}else{_0x3d01ac[_0xfb75('0x1e')](dbH[_0xfb75('0x15')][_0xfb75('0x16')](QUERY,{'type':dbH[_0xfb75('0x15')][_0xfb75('0x18')][_0xfb75('0x1d')]}));}var _0x1c5fd1=path[_0xfb75('0x1f')](PATH);var _0x145caa=path[_0xfb75('0x20')](PATH,_0xfb75('0x21'));var _0x284d65=_0x2a0f25[_0xfb75('0x12')]&&_0x3d01ac[_0xfb75('0x1a')]>0x1;var _0x2b9f43=[];if(!fs[_0xfb75('0x22')](path[_0xfb75('0x23')](_0x1c5fd1,_0x145caa))&&_0x284d65){fs[_0xfb75('0x24')](path['join'](_0x1c5fd1,_0x145caa));}return BPromise[_0xfb75('0x25')](_0x3d01ac,function(_0x419b8b){_0x2b9f43[_0xfb75('0x1e')](_0x419b8b);})['then'](function(){for(var _0x2771dd=0x0;_0x2771dd<_0x2b9f43['length'];_0x2771dd+=0x1){var _0x41100b;var _0x3ac271=_0x2b9f43[_0x2771dd];if(_0x284d65){_0x41100b=path[_0xfb75('0x23')](_0x1c5fd1,_0x145caa,util['format']('%s%d.%s',_0x145caa,_0x2771dd,_0xfb75('0x26')));}else{_0x41100b=path['join'](_0x1c5fd1,util[_0xfb75('0xe')](_0xfb75('0x27'),_0x145caa,_0xfb75('0x26')));}fs[_0xfb75('0x28')](_0x41100b,json2xls(_0x3ac271),'binary');}})[_0xfb75('0x14')](function(){if(_0x284d65){zipdir(path[_0xfb75('0x23')](_0x1c5fd1,_0x145caa),{'saveTo':path[_0xfb75('0x23')](_0x1c5fd1,util['format']('%s.%s',_0x145caa,'zip'))},function(_0x5299c7,_0x4ccedb){});rimraf(path['join'](_0x1c5fd1,_0x145caa),function(){});}})['then'](function(){logger[_0xfb75('0xd')](util[_0xfb75('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xfb75('0x10')));return analyticExtractedReport(_0xfb75('0x29'),_0x284d65?util['format'](_0xfb75('0x27'),_0x145caa,_0x284d65?'zip':_0xfb75('0x26')):null);});})[_0xfb75('0x2a')](function(_0x9524a7){logger[_0xfb75('0xd')](util[_0xfb75('0xe')](_0xfb75('0x2b'),EXTRACTED_REPORT_ID,_0xfb75('0x10')),util[_0xfb75('0x2c')](_0x9524a7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xfb75('0x2d'));})[_0xfb75('0x2e')](function(){process[_0xfb75('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x5458=['num','push','dirname','.xlsx','mkdirSync','join','each','%s%d.%s','xlsx','%s.%s','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','query','sequelize','QueryTypes','SELECT','Empty','length'];(function(_0xac2fe1,_0x44977e){var _0x3c5427=function(_0x521a08){while(--_0x521a08){_0xac2fe1['push'](_0xac2fe1['shift']());}};_0x3c5427(++_0x44977e);}(_0x5458,0x120));var _0x8545=function(_0x4dabb7,_0x3a58f0){_0x4dabb7=_0x4dabb7-0x0;var _0x7de17d=_0x5458[_0x4dabb7];return _0x7de17d;};'use strict';var util=require('util');var path=require(_0x8545('0x0'));var _=require(_0x8545('0x1'));var fs=require('fs');var json2xls=require(_0x8545('0x2'));var BPromise=require(_0x8545('0x3'));var zipdir=require(_0x8545('0x4'));var rimraf=require('rimraf');var db=require(_0x8545('0x5'))['db'];var dbH=require(_0x8545('0x5'))[_0x8545('0x6')];var logger=require(_0x8545('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x8545('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5c555d,_0x298d0b){var _0xd42e87={'status':_0x5c555d};var _0x2b3560={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x298d0b){_0xd42e87[_0x8545('0x9')]=_0x298d0b;}return db[_0x8545('0xa')][_0x8545('0xb')](_0xd42e87,_0x2b3560);}function main(){var _0x23426c=0x1388;var _0x3dc66a;logger[_0x8545('0xc')](util[_0x8545('0xd')](_0x8545('0xe'),EXTRACTED_REPORT_ID,_0x8545('0xf')));return db[_0x8545('0x10')][_0x8545('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8545('0x12'),_0x8545('0x13')]})[_0x8545('0x14')](function(_0x24742f){if(_0x24742f){_0x3dc66a=_0x24742f;_0x23426c=_0x3dc66a['splitSizeXlsx']||0x1388;}})[_0x8545('0x14')](function(){return dbH['sequelize'][_0x8545('0x15')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x8545('0x16')][_0x8545('0x17')][_0x8545('0x18')]});})[_0x8545('0x14')](function(_0x42eb90){if(!_0x42eb90[0x0]['num']){return analyticExtractedReport(_0x8545('0x19'));}var _0x552080=[];var _0x3ba9ad=0x0;var _0x289ce8=!![];if(_0x3dc66a['split']){if(_0x42eb90&&_0x42eb90[_0x8545('0x1a')]){var _0x315ab8=_0x42eb90[0x0][_0x8545('0x1b')]%(_0x3ba9ad+_0x23426c);for(;_0x289ce8;_0x3ba9ad+=_0x23426c,_0x315ab8=_0x42eb90[0x0][_0x8545('0x1b')]%(_0x3ba9ad+_0x23426c)){if(_0x315ab8==0x0||_0x315ab8==_0x42eb90[0x0][_0x8545('0x1b')]){_0x289ce8=![];}_0x552080['push'](dbH[_0x8545('0x16')][_0x8545('0x15')](util[_0x8545('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x23426c,_0x3ba9ad),{'type':dbH[_0x8545('0x16')][_0x8545('0x17')][_0x8545('0x18')]}));}}}else{_0x552080[_0x8545('0x1c')](dbH[_0x8545('0x16')][_0x8545('0x15')](QUERY,{'type':dbH[_0x8545('0x16')][_0x8545('0x17')][_0x8545('0x18')]}));}var _0x5dd8bc=path[_0x8545('0x1d')](PATH);var _0xd053e9=path['basename'](PATH,_0x8545('0x1e'));var _0x315d63=_0x3dc66a['split']&&_0x552080[_0x8545('0x1a')]>0x1;var _0x571652=[];if(!fs['existsSync'](path['join'](_0x5dd8bc,_0xd053e9))&&_0x315d63){fs[_0x8545('0x1f')](path[_0x8545('0x20')](_0x5dd8bc,_0xd053e9));}return BPromise[_0x8545('0x21')](_0x552080,function(_0x55d185){_0x571652[_0x8545('0x1c')](_0x55d185);})[_0x8545('0x14')](function(){for(var _0x3bc600=0x0;_0x3bc600<_0x571652[_0x8545('0x1a')];_0x3bc600+=0x1){var _0x2bd27d;var _0x1a1998=_0x571652[_0x3bc600];if(_0x315d63){_0x2bd27d=path[_0x8545('0x20')](_0x5dd8bc,_0xd053e9,util[_0x8545('0xd')](_0x8545('0x22'),_0xd053e9,_0x3bc600,_0x8545('0x23')));}else{_0x2bd27d=path[_0x8545('0x20')](_0x5dd8bc,util['format'](_0x8545('0x24'),_0xd053e9,'xlsx'));}fs['writeFileSync'](_0x2bd27d,json2xls(_0x1a1998),_0x8545('0x25'));}})[_0x8545('0x14')](function(){if(_0x315d63){zipdir(path['join'](_0x5dd8bc,_0xd053e9),{'saveTo':path['join'](_0x5dd8bc,util[_0x8545('0xd')]('%s.%s',_0xd053e9,_0x8545('0x26')))},function(_0x30090b,_0x12d50f){});rimraf(path[_0x8545('0x20')](_0x5dd8bc,_0xd053e9),function(){});}})[_0x8545('0x14')](function(){logger['info'](util[_0x8545('0xd')](_0x8545('0x27'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x315d63?util[_0x8545('0xd')](_0x8545('0x24'),_0xd053e9,_0x315d63?'zip':_0x8545('0x23')):null);});})[_0x8545('0x28')](function(_0x248d4c){logger[_0x8545('0xc')](util['format'](_0x8545('0x29'),EXTRACTED_REPORT_ID,_0x8545('0xf')),util[_0x8545('0x2a')](_0x248d4c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8545('0x2b'));})['finally'](function(){process[_0x8545('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 0047b80..b2d2dce 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 _0xc018=['extensions','extension','find','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','push','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','createdAt','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','transaction','destroy','sortBy','catch','rewrite','util','Interval','findAll','then','intervals','models','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority'];(function(_0x51c4c9,_0x292b15){var _0x3eb6d8=function(_0x4339d1){while(--_0x4339d1){_0x51c4c9['push'](_0x51c4c9['shift']());}};_0x3eb6d8(++_0x292b15);}(_0xc018,0x102));var _0x8c01=function(_0x3462ae,_0x225598){_0x3462ae=_0x3462ae-0x0;var _0x587dd6=_0xc018[_0x3462ae];return _0x587dd6;};'use strict';var _=require('lodash');var util=require(_0x8c01('0x0'));function rewrite(_0x46170a,_0x33af99){var _0x2677e8=this;return _0x46170a['models'][_0x8c01('0x1')][_0x8c01('0x2')]({'raw':!![]})[_0x8c01('0x3')](function(_0x52ec86){_0x2677e8[_0x8c01('0x4')]=_0x52ec86;return _0x46170a[_0x8c01('0x5')][_0x8c01('0x6')][_0x8c01('0x2')]({'where':{'IntervalId':_0x33af99[_0x8c01('0x7')]},'raw':!![]});})[_0x8c01('0x3')](function(_0x373018){return _0x46170a[_0x8c01('0x5')][_0x8c01('0x6')][_0x8c01('0x2')]({'where':{'exten':{'$in':_[_0x8c01('0x8')](_[_0x8c01('0x9')](_0x373018,_0x8c01('0xa')))}},'order':[{'raw':_0x8c01('0xb')}],'raw':!![]});})[_0x8c01('0x3')](function(_0x1a32f2){var _0x1d5fd8=_[_0x8c01('0xc')](_0x1a32f2,{'priority':'1'});var _0xd29a8c=_[_0x8c01('0xc')](_0x1a32f2,{'isApp':0x1});var _0xdc9144=_[_0x8c01('0xd')](_0xd29a8c,_0x8c01('0xa'));var _0x5e616f=[_0x8c01('0xe'),_0x8c01('0xf')];var _0x49856f=[];var _0x315eea=[];for(var _0x2e519b in _0xdc9144){if(_0xdc9144[_0x8c01('0x10')](_0x2e519b)){_0x2677e8[_0x8c01('0x11')]=0x2;_0x2677e8[_0x8c01('0x12')]=[];_0x2677e8[_0x8c01('0x13')]=_[_0x8c01('0x14')](_0x1d5fd8,{'exten':_0xdc9144[_0x2e519b][0x0][_0x8c01('0xa')]});_0x2677e8['extensions']['push']({'type':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x15')],'app':_0x8c01('0x16'),'appdata':util[_0x8c01('0x17')](_0x8c01('0x18'),_0xdc9144[_0x2e519b][0x0][_0x8c01('0x15')]),'context':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x19')],'exten':_0xdc9144[_0x2e519b][0x0][_0x8c01('0xa')],'priority':_0x2677e8[_0x8c01('0x11')]++,'VoiceExtensionId':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x1a')]});if(_0xdc9144[_0x2e519b][0x0][_0x8c01('0x15')]==='inbound'){_0x2677e8['extensions'][_0x8c01('0x1b')]({'type':_0xdc9144[_0x2e519b][0x0]['type'],'app':_0x8c01('0x16'),'appdata':_0x8c01('0x1c')+_0xdc9144[_0x2e519b][0x0][_0x8c01('0x1a')],'context':_0xdc9144[_0x2e519b][0x0]['context'],'exten':_0xdc9144[_0x2e519b][0x0][_0x8c01('0xa')],'priority':_0x2677e8[_0x8c01('0x11')]++,'VoiceExtensionId':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x1a')]});}else if(_0xdc9144[_0x2e519b][0x0]['type']===_0x8c01('0x1d')){if(_0x2677e8[_0x8c01('0x13')]){_0x2677e8[_0x8c01('0x12')][_0x8c01('0x1b')]({'type':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x15')],'app':_0x8c01('0x16'),'appdata':_0x8c01('0x1e')+(_0x2677e8[_0x8c01('0x13')][_0x8c01('0x1f')]?_0x8c01('0x20')+_0x2677e8[_0x8c01('0x13')]['cutdigits']+'}':_0x8c01('0x21')),'context':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x19')],'exten':_0xdc9144[_0x2e519b][0x0][_0x8c01('0xa')],'priority':_0x2677e8['priority']++,'VoiceExtensionId':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x1a')]});}_0x2677e8[_0x8c01('0x12')][_0x8c01('0x1b')]({'type':_0xdc9144[_0x2e519b][0x0]['type'],'app':_0x8c01('0x16'),'appdata':_0x8c01('0x1c')+_0xdc9144[_0x2e519b][0x0][_0x8c01('0x1a')],'context':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x19')],'exten':_0xdc9144[_0x2e519b][0x0][_0x8c01('0xa')],'priority':_0x2677e8['priority']++,'VoiceExtensionId':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x1a')]});var _0x24e2db=_0x2677e8['priority']++;_0x2677e8[_0x8c01('0x12')][_0x8c01('0x1b')]({'type':_0xdc9144[_0x2e519b][0x0]['type'],'app':_0x8c01('0x22'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x24e2db+0x2)+'):Goto('+(_0x24e2db+0x1)+')','context':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x19')],'exten':_0xdc9144[_0x2e519b][0x0][_0x8c01('0xa')],'priority':_0x24e2db,'VoiceExtensionId':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x1a')]});if(_0x2677e8[_0x8c01('0x13')]){_0x2677e8['extensions'][_0x8c01('0x1b')]({'type':_0xdc9144[_0x2e519b][0x0]['type'],'app':'Set','appdata':_0x2677e8[_0x8c01('0x13')][_0x8c01('0x1f')]?_0x8c01('0x23')+_0x2677e8['extension'][_0x8c01('0x1f')]+'}':_0x8c01('0x24'),'context':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x19')],'exten':_0xdc9144[_0x2e519b][0x0]['exten'],'priority':_0x2677e8[_0x8c01('0x11')]++,'VoiceExtensionId':_0xdc9144[_0x2e519b][0x0]['VoiceExtensionId']});}_0x2677e8[_0x8c01('0x12')][_0x8c01('0x1b')]({'type':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x15')],'app':_0x8c01('0x16'),'appdata':_0x8c01('0x25')+_0xdc9144[_0x2e519b][0x0]['VoiceExtensionId'],'context':_0xdc9144[_0x2e519b][0x0]['context'],'exten':_0xdc9144[_0x2e519b][0x0][_0x8c01('0xa')],'priority':_0x2677e8['priority']++,'VoiceExtensionId':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x1a')]});if(_0x2677e8['extension']&&_0x2677e8[_0x8c01('0x13')]['hasOwnProperty']('recordingFormat')&&_0x2677e8['extension'][_0x8c01('0x26')]!==_0x8c01('0x27')){_0x2677e8[_0x8c01('0x12')][_0x8c01('0x1b')]({'type':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x15')],'app':_0x8c01('0x16'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0xdc9144[_0x2e519b][0x0]['context'],'exten':_0xdc9144[_0x2e519b][0x0][_0x8c01('0xa')],'priority':_0x2677e8[_0x8c01('0x11')]++,'VoiceExtensionId':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x1a')]});_0x2677e8[_0x8c01('0x12')]['push']({'type':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x15')],'app':_0x8c01('0x16'),'appdata':_0x8c01('0x28')+_0x2677e8['extension']['recordingFormat']||_0x8c01('0x29'),'context':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x19')],'exten':_0xdc9144[_0x2e519b][0x0][_0x8c01('0xa')],'priority':_0x2677e8[_0x8c01('0x11')]++,'VoiceExtensionId':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x1a')]});}}_0x2677e8[_0x8c01('0x12')][_0x8c01('0x1b')]({'type':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x15')],'app':_0x8c01('0x16'),'appdata':_0x8c01('0x2a'),'context':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x19')],'exten':_0xdc9144[_0x2e519b][0x0][_0x8c01('0xa')],'priority':_0x2677e8[_0x8c01('0x11')]++,'VoiceExtensionId':_0xdc9144[_0x2e519b][0x0]['VoiceExtensionId']});_0x2677e8[_0x8c01('0x12')][_0x8c01('0x1b')]({'type':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x15')],'app':'Set','appdata':_0x8c01('0x2b'),'context':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x19')],'exten':_0xdc9144[_0x2e519b][0x0][_0x8c01('0xa')],'priority':_0x2677e8[_0x8c01('0x11')]++,'VoiceExtensionId':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x1a')]});_0x2677e8[_0x8c01('0x12')][_0x8c01('0x1b')]({'type':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x15')],'app':_0x8c01('0x16'),'appdata':'MONITOR_OPTIONS=ab','context':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x19')],'exten':_0xdc9144[_0x2e519b][0x0]['exten'],'priority':_0x2677e8[_0x8c01('0x11')]++,'VoiceExtensionId':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x1a')]});for(var _0x4ea8ab=0x0,_0x184c41=0x0;_0x4ea8ab<_0xdc9144[_0x2e519b][_0x8c01('0x2c')];_0x4ea8ab+=0x1,_0x184c41=0x0){var _0x5dd129=_0xdc9144[_0x2e519b][_0x4ea8ab];if(_0x5dd129[_0x8c01('0x15')]){_0x5dd129['type']=_0x5dd129[_0x8c01('0x15')]['toLowerCase']();}var _0x2c807c=[];var _0x115b7a=[];delete _0x5dd129['id'];delete _0x5dd129[_0x8c01('0x2d')];delete _0x5dd129['updatedAt'];var _0x4a4689=_0x5dd129['interval']!=='*,*,*,*'?[_0x5dd129[_0x8c01('0x2e')]]:_0x5dd129[_0x8c01('0x7')]?_[_0x8c01('0x9')](_[_0x8c01('0xc')](_0x2677e8[_0x8c01('0x4')],{'IntervalId':_0x5dd129[_0x8c01('0x7')]}),'interval'):[];if(_0x5dd129['hasOwnProperty'](_0x8c01('0x2f'))){if(_0x5dd129['tag']&&_0x5dd129[_0x8c01('0x2f')]!=='--'){_0x2c807c[_0x8c01('0x1b')]({'type':_0x5dd129[_0x8c01('0x15')],'app':'Set','appdata':_0x8c01('0x30')+_0x5dd129[_0x8c01('0x2f')],'context':_0x5dd129[_0x8c01('0x19')],'exten':_0x5dd129['exten'],'priority':_0x4a4689[_0x8c01('0x2c')]+_0x2677e8[_0x8c01('0x11')]+_0x184c41++,'VoiceExtensionId':_0x5dd129[_0x8c01('0x1a')]});}}if(_0x5dd129[_0x8c01('0x15')]==='outbound'&&_0x5dd129['hasOwnProperty'](_0x8c01('0x31'))){if(_0x5dd129[_0x8c01('0x31')]){_0x2c807c[_0x8c01('0x1b')]({'type':_0x5dd129[_0x8c01('0x15')],'app':_0x8c01('0x22'),'appdata':_0x8c01('0x32')+_0x5dd129[_0x8c01('0x31')]+')','context':_0x5dd129[_0x8c01('0x19')],'exten':_0x5dd129[_0x8c01('0xa')],'priority':_0x4a4689[_0x8c01('0x2c')]+_0x2677e8[_0x8c01('0x11')]+_0x184c41++,'VoiceExtensionId':_0x5dd129['VoiceExtensionId']});}else{_0x2c807c[_0x8c01('0x1b')]({'type':_0x5dd129['type'],'app':'ExecIf','appdata':_0x8c01('0x33'),'context':_0x5dd129[_0x8c01('0x19')],'exten':_0x5dd129['exten'],'priority':_0x4a4689[_0x8c01('0x2c')]+_0x2677e8[_0x8c01('0x11')]+_0x184c41++,'VoiceExtensionId':_0x5dd129[_0x8c01('0x1a')]});}}if(_0x5dd129[_0x8c01('0x10')]('answer')){if(_0x5e616f[_0x8c01('0x34')](_0x5dd129[_0x8c01('0x35')][_0x8c01('0x36')]())>=0x0&&_0x5dd129[_0x8c01('0x37')]!==_0x8c01('0x38')){if(_0x5dd129['answer']){_0x2c807c['push']({'type':_0x5dd129['type'],'app':_0x8c01('0x22'),'appdata':_0x8c01('0x39'),'context':_0x5dd129['context'],'exten':_0x5dd129['exten'],'priority':_0x4a4689[_0x8c01('0x2c')]+_0x2677e8[_0x8c01('0x11')]+_0x184c41++,'VoiceExtensionId':_0x5dd129[_0x8c01('0x1a')]});_0x2c807c[_0x8c01('0x1b')]({'type':_0x5dd129[_0x8c01('0x15')],'app':_0x8c01('0x16'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x5dd129['context'],'exten':_0x5dd129['exten'],'priority':_0x4a4689[_0x8c01('0x2c')]+_0x2677e8['priority']+_0x184c41++,'VoiceExtensionId':_0x5dd129[_0x8c01('0x1a')]});}else{_0x2c807c[_0x8c01('0x1b')]({'type':_0x5dd129[_0x8c01('0x15')],'app':_0x8c01('0x22'),'appdata':_0x8c01('0x3a'),'context':_0x5dd129[_0x8c01('0x19')],'exten':_0x5dd129['exten'],'priority':_0x4a4689[_0x8c01('0x2c')]+_0x2677e8[_0x8c01('0x11')]+_0x184c41++,'VoiceExtensionId':_0x5dd129['VoiceExtensionId']});_0x2c807c['push']({'type':_0x5dd129[_0x8c01('0x15')],'app':_0x8c01('0x16'),'appdata':_0x8c01('0x3b'),'context':_0x5dd129['context'],'exten':_0x5dd129[_0x8c01('0xa')],'priority':_0x4a4689[_0x8c01('0x2c')]+_0x2677e8[_0x8c01('0x11')]+_0x184c41++,'VoiceExtensionId':_0x5dd129['VoiceExtensionId']});}}}for(var _0x339b95=0x0;_0x339b95<_0x4a4689[_0x8c01('0x2c')];_0x339b95+=0x1){var _0xe7e9a9=_0x2677e8[_0x8c01('0x11')]+_0x4a4689[_0x8c01('0x2c')];var _0x4d059f=_0x339b95===_0x4a4689[_0x8c01('0x2c')]-0x1?_0x2677e8['priority']+_0x2c807c[_0x8c01('0x2c')]+_0x115b7a[_0x8c01('0x2c')]+0x2:_0x2677e8[_0x8c01('0x11')]+_0x339b95+0x1;_0x2c807c[_0x8c01('0x3c')](_0x339b95,0x0,{'type':_0x5dd129['type'],'app':'GotoIfTime','appdata':_0x4a4689[_0x339b95]+'?'+_0x5dd129[_0x8c01('0x19')]+_0x8c01('0x3d')+_0xe7e9a9+':'+_0x5dd129['context']+_0x8c01('0x3d')+_0x4d059f,'exten':_0x5dd129[_0x8c01('0xa')],'context':_0x5dd129[_0x8c01('0x19')],'priority':_0x2677e8[_0x8c01('0x11')]+_0x339b95,'VoiceExtensionId':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x1a')]});}_0x5dd129[_0x8c01('0x11')]=_0x2c807c[_0x8c01('0x2c')]?_['last'](_0x2c807c)[_0x8c01('0x11')]+0x1:_0x2677e8[_0x8c01('0x11')];_0x2677e8['priority']=(_0x115b7a[_0x8c01('0x2c')]?_[_0x8c01('0x3e')](_0x115b7a)[_0x8c01('0x11')]:_0x5dd129[_0x8c01('0x11')])+0x1;_0x2677e8[_0x8c01('0x12')]=_[_0x8c01('0x3f')](_0x2677e8[_0x8c01('0x12')],_0x2c807c,[_0x5dd129],_0x115b7a);}_0x2677e8[_0x8c01('0x12')][_0x8c01('0x1b')]({'type':_0xdc9144[_0x2e519b][0x0]['type'],'app':'Hangup','exten':_0xdc9144[_0x2e519b][0x0][_0x8c01('0xa')],'context':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x19')],'priority':_0x2677e8[_0x8c01('0x11')],'VoiceExtensionId':_0xdc9144[_0x2e519b][0x0][_0x8c01('0x1a')]});_0x49856f[_0x8c01('0x1b')](_0xdc9144[_0x2e519b][0x0][_0x8c01('0x1a')]);_0x315eea=_[_0x8c01('0x3f')](_0x315eea,_0x2677e8['extensions']);}}return _0x46170a[_0x8c01('0x40')](function(_0x104c9e){return _0x46170a['models'][_0x8c01('0x6')][_0x8c01('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x49856f}},'transaction':_0x104c9e})['then'](function(_0x12d2b2){return _0x46170a[_0x8c01('0x5')][_0x8c01('0x6')]['bulkCreate'](_[_0x8c01('0x42')](_0x315eea,_0x8c01('0x11')),{'transaction':_0x104c9e});});});})[_0x8c01('0x43')](function(_0xae0bc0){console['error'](_0xae0bc0);});}exports[_0x8c01('0x44')]=rewrite; \ No newline at end of file +var _0x21bf=['CDR(type)=%s','context','VoiceExtensionId','inbound','extensions','CDR(routeid)=','CDR(destination)=','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','*,*,*,*','interval','IntervalId','tag','CDR(tag)=','outbound','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','error','rewrite','lodash','models','findAll','intervals','VoiceExtension','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','priority','extension','find','push','type','Set','format'];(function(_0x192f16,_0x454664){var _0x5b6b0b=function(_0x33ff45){while(--_0x33ff45){_0x192f16['push'](_0x192f16['shift']());}};_0x5b6b0b(++_0x454664);}(_0x21bf,0x1d7));var _0xf21b=function(_0x192cbe,_0x3b4b43){_0x192cbe=_0x192cbe-0x0;var _0x4ce395=_0x21bf[_0x192cbe];return _0x4ce395;};'use strict';var _=require(_0xf21b('0x0'));var util=require('util');function rewrite(_0x339964,_0x2d007b){var _0x39d70f=this;return _0x339964[_0xf21b('0x1')]['Interval'][_0xf21b('0x2')]({'raw':!![]})['then'](function(_0x2cb799){_0x39d70f[_0xf21b('0x3')]=_0x2cb799;return _0x339964[_0xf21b('0x1')][_0xf21b('0x4')]['findAll']({'where':{'IntervalId':_0x2d007b['IntervalId']},'raw':!![]});})[_0xf21b('0x5')](function(_0x4b418b){return _0x339964['models']['VoiceExtension'][_0xf21b('0x2')]({'where':{'exten':{'$in':_[_0xf21b('0x6')](_[_0xf21b('0x7')](_0x4b418b,_0xf21b('0x8')))}},'order':[{'raw':_0xf21b('0x9')}],'raw':!![]});})[_0xf21b('0x5')](function(_0x2ae3ff){var _0x4dfd53=_[_0xf21b('0xa')](_0x2ae3ff,{'priority':'1'});var _0x3ee3ac=_[_0xf21b('0xa')](_0x2ae3ff,{'isApp':0x1});var _0xdf6420=_['groupBy'](_0x3ee3ac,_0xf21b('0x8'));var _0x5047e9=['queue',_0xf21b('0xb')];var _0x26228f=[];var _0x2efcad=[];for(var _0xf82ea1 in _0xdf6420){if(_0xdf6420['hasOwnProperty'](_0xf82ea1)){_0x39d70f[_0xf21b('0xc')]=0x2;_0x39d70f['extensions']=[];_0x39d70f[_0xf21b('0xd')]=_[_0xf21b('0xe')](_0x4dfd53,{'exten':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x8')]});_0x39d70f['extensions'][_0xf21b('0xf')]({'type':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x10')],'app':_0xf21b('0x11'),'appdata':util[_0xf21b('0x12')](_0xf21b('0x13'),_0xdf6420[_0xf82ea1][0x0]['type']),'context':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x14')],'exten':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x8')],'priority':_0x39d70f[_0xf21b('0xc')]++,'VoiceExtensionId':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x15')]});if(_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x10')]===_0xf21b('0x16')){_0x39d70f[_0xf21b('0x17')]['push']({'type':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x10')],'app':_0xf21b('0x11'),'appdata':_0xf21b('0x18')+_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x15')],'context':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x14')],'exten':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x8')],'priority':_0x39d70f['priority']++,'VoiceExtensionId':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x15')]});}else if(_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x10')]==='outbound'){if(_0x39d70f[_0xf21b('0xd')]){_0x39d70f['extensions']['push']({'type':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x10')],'app':_0xf21b('0x11'),'appdata':_0xf21b('0x19')+(_0x39d70f['extension']['cutdigits']?_0xf21b('0x1a')+_0x39d70f[_0xf21b('0xd')]['cutdigits']+'}':_0xf21b('0x1b')),'context':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x14')],'exten':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x8')],'priority':_0x39d70f[_0xf21b('0xc')]++,'VoiceExtensionId':_0xdf6420[_0xf82ea1][0x0]['VoiceExtensionId']});}_0x39d70f[_0xf21b('0x17')][_0xf21b('0xf')]({'type':_0xdf6420[_0xf82ea1][0x0]['type'],'app':_0xf21b('0x11'),'appdata':_0xf21b('0x18')+_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x15')],'context':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x14')],'exten':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x8')],'priority':_0x39d70f[_0xf21b('0xc')]++,'VoiceExtensionId':_0xdf6420[_0xf82ea1][0x0]['VoiceExtensionId']});var _0x4286dd=_0x39d70f[_0xf21b('0xc')]++;_0x39d70f['extensions'][_0xf21b('0xf')]({'type':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x10')],'app':'ExecIf','appdata':_0xf21b('0x1c')+(_0x4286dd+0x2)+_0xf21b('0x1d')+(_0x4286dd+0x1)+')','context':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x14')],'exten':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x8')],'priority':_0x4286dd,'VoiceExtensionId':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x15')]});if(_0x39d70f[_0xf21b('0xd')]){_0x39d70f[_0xf21b('0x17')][_0xf21b('0xf')]({'type':_0xdf6420[_0xf82ea1][0x0]['type'],'app':_0xf21b('0x11'),'appdata':_0x39d70f['extension'][_0xf21b('0x1e')]?_0xf21b('0x1f')+_0x39d70f[_0xf21b('0xd')][_0xf21b('0x1e')]+'}':_0xf21b('0x20'),'context':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x14')],'exten':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x8')],'priority':_0x39d70f['priority']++,'VoiceExtensionId':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x15')]});}_0x39d70f[_0xf21b('0x17')][_0xf21b('0xf')]({'type':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x10')],'app':_0xf21b('0x11'),'appdata':_0xf21b('0x21')+_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x15')],'context':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x14')],'exten':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x8')],'priority':_0x39d70f[_0xf21b('0xc')]++,'VoiceExtensionId':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x15')]});if(_0x39d70f[_0xf21b('0xd')]&&_0x39d70f[_0xf21b('0xd')][_0xf21b('0x22')](_0xf21b('0x23'))&&_0x39d70f[_0xf21b('0xd')][_0xf21b('0x23')]!==_0xf21b('0x24')){_0x39d70f[_0xf21b('0x17')][_0xf21b('0xf')]({'type':_0xdf6420[_0xf82ea1][0x0]['type'],'app':_0xf21b('0x11'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x14')],'exten':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x8')],'priority':_0x39d70f[_0xf21b('0xc')]++,'VoiceExtensionId':_0xdf6420[_0xf82ea1][0x0]['VoiceExtensionId']});_0x39d70f['extensions'][_0xf21b('0xf')]({'type':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x10')],'app':_0xf21b('0x11'),'appdata':_0xf21b('0x25')+_0x39d70f[_0xf21b('0xd')]['recordingFormat']||_0xf21b('0x26'),'context':_0xdf6420[_0xf82ea1][0x0]['context'],'exten':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x8')],'priority':_0x39d70f[_0xf21b('0xc')]++,'VoiceExtensionId':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x15')]});}}_0x39d70f[_0xf21b('0x17')]['push']({'type':_0xdf6420[_0xf82ea1][0x0]['type'],'app':_0xf21b('0x11'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x14')],'exten':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x8')],'priority':_0x39d70f['priority']++,'VoiceExtensionId':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x15')]});_0x39d70f[_0xf21b('0x17')][_0xf21b('0xf')]({'type':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x10')],'app':_0xf21b('0x11'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x14')],'exten':_0xdf6420[_0xf82ea1][0x0]['exten'],'priority':_0x39d70f[_0xf21b('0xc')]++,'VoiceExtensionId':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x15')]});_0x39d70f[_0xf21b('0x17')][_0xf21b('0xf')]({'type':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x10')],'app':_0xf21b('0x11'),'appdata':_0xf21b('0x27'),'context':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x14')],'exten':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x8')],'priority':_0x39d70f['priority']++,'VoiceExtensionId':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x15')]});for(var _0x44ba2a=0x0,_0x18e97d=0x0;_0x44ba2a<_0xdf6420[_0xf82ea1][_0xf21b('0x28')];_0x44ba2a+=0x1,_0x18e97d=0x0){var _0x5eefb8=_0xdf6420[_0xf82ea1][_0x44ba2a];if(_0x5eefb8['type']){_0x5eefb8[_0xf21b('0x10')]=_0x5eefb8['type'][_0xf21b('0x29')]();}var _0x10c59f=[];var _0xb52a57=[];delete _0x5eefb8['id'];delete _0x5eefb8[_0xf21b('0x2a')];delete _0x5eefb8['updatedAt'];var _0x2b5305=_0x5eefb8['interval']!==_0xf21b('0x2b')?[_0x5eefb8[_0xf21b('0x2c')]]:_0x5eefb8[_0xf21b('0x2d')]?_[_0xf21b('0x7')](_[_0xf21b('0xa')](_0x39d70f[_0xf21b('0x3')],{'IntervalId':_0x5eefb8[_0xf21b('0x2d')]}),_0xf21b('0x2c')):[];if(_0x5eefb8['hasOwnProperty'](_0xf21b('0x2e'))){if(_0x5eefb8['tag']&&_0x5eefb8['tag']!=='--'){_0x10c59f[_0xf21b('0xf')]({'type':_0x5eefb8[_0xf21b('0x10')],'app':_0xf21b('0x11'),'appdata':_0xf21b('0x2f')+_0x5eefb8['tag'],'context':_0x5eefb8[_0xf21b('0x14')],'exten':_0x5eefb8[_0xf21b('0x8')],'priority':_0x2b5305[_0xf21b('0x28')]+_0x39d70f[_0xf21b('0xc')]+_0x18e97d++,'VoiceExtensionId':_0x5eefb8['VoiceExtensionId']});}}if(_0x5eefb8[_0xf21b('0x10')]===_0xf21b('0x30')&&_0x5eefb8['hasOwnProperty'](_0xf21b('0x31'))){if(_0x5eefb8[_0xf21b('0x31')]){_0x10c59f[_0xf21b('0xf')]({'type':_0x5eefb8[_0xf21b('0x10')],'app':_0xf21b('0x32'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x5eefb8[_0xf21b('0x31')]+')','context':_0x5eefb8[_0xf21b('0x14')],'exten':_0x5eefb8[_0xf21b('0x8')],'priority':_0x2b5305['length']+_0x39d70f[_0xf21b('0xc')]+_0x18e97d++,'VoiceExtensionId':_0x5eefb8[_0xf21b('0x15')]});}else{_0x10c59f[_0xf21b('0xf')]({'type':_0x5eefb8[_0xf21b('0x10')],'app':_0xf21b('0x32'),'appdata':_0xf21b('0x33'),'context':_0x5eefb8[_0xf21b('0x14')],'exten':_0x5eefb8[_0xf21b('0x8')],'priority':_0x2b5305[_0xf21b('0x28')]+_0x39d70f[_0xf21b('0xc')]+_0x18e97d++,'VoiceExtensionId':_0x5eefb8[_0xf21b('0x15')]});}}if(_0x5eefb8[_0xf21b('0x22')](_0xf21b('0x34'))){if(_0x5047e9[_0xf21b('0x35')](_0x5eefb8[_0xf21b('0x36')][_0xf21b('0x29')]())>=0x0&&_0x5eefb8['appType']!==_0xf21b('0x37')){if(_0x5eefb8[_0xf21b('0x34')]){_0x10c59f[_0xf21b('0xf')]({'type':_0x5eefb8[_0xf21b('0x10')],'app':_0xf21b('0x32'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x5eefb8['context'],'exten':_0x5eefb8[_0xf21b('0x8')],'priority':_0x2b5305['length']+_0x39d70f['priority']+_0x18e97d++,'VoiceExtensionId':_0x5eefb8[_0xf21b('0x15')]});_0x10c59f[_0xf21b('0xf')]({'type':_0x5eefb8[_0xf21b('0x10')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x5eefb8[_0xf21b('0x14')],'exten':_0x5eefb8[_0xf21b('0x8')],'priority':_0x2b5305['length']+_0x39d70f['priority']+_0x18e97d++,'VoiceExtensionId':_0x5eefb8['VoiceExtensionId']});}else{_0x10c59f[_0xf21b('0xf')]({'type':_0x5eefb8[_0xf21b('0x10')],'app':_0xf21b('0x32'),'appdata':_0xf21b('0x38'),'context':_0x5eefb8[_0xf21b('0x14')],'exten':_0x5eefb8['exten'],'priority':_0x2b5305[_0xf21b('0x28')]+_0x39d70f[_0xf21b('0xc')]+_0x18e97d++,'VoiceExtensionId':_0x5eefb8[_0xf21b('0x15')]});_0x10c59f[_0xf21b('0xf')]({'type':_0x5eefb8[_0xf21b('0x10')],'app':_0xf21b('0x11'),'appdata':_0xf21b('0x39'),'context':_0x5eefb8['context'],'exten':_0x5eefb8['exten'],'priority':_0x2b5305[_0xf21b('0x28')]+_0x39d70f[_0xf21b('0xc')]+_0x18e97d++,'VoiceExtensionId':_0x5eefb8[_0xf21b('0x15')]});}}}for(var _0x1b1fa9=0x0;_0x1b1fa9<_0x2b5305['length'];_0x1b1fa9+=0x1){var _0x4ab984=_0x39d70f[_0xf21b('0xc')]+_0x2b5305[_0xf21b('0x28')];var _0x35867d=_0x1b1fa9===_0x2b5305['length']-0x1?_0x39d70f[_0xf21b('0xc')]+_0x10c59f[_0xf21b('0x28')]+_0xb52a57['length']+0x2:_0x39d70f[_0xf21b('0xc')]+_0x1b1fa9+0x1;_0x10c59f[_0xf21b('0x3a')](_0x1b1fa9,0x0,{'type':_0x5eefb8[_0xf21b('0x10')],'app':_0xf21b('0x3b'),'appdata':_0x2b5305[_0x1b1fa9]+'?'+_0x5eefb8[_0xf21b('0x14')]+',${EXTEN},'+_0x4ab984+':'+_0x5eefb8[_0xf21b('0x14')]+_0xf21b('0x3c')+_0x35867d,'exten':_0x5eefb8[_0xf21b('0x8')],'context':_0x5eefb8['context'],'priority':_0x39d70f[_0xf21b('0xc')]+_0x1b1fa9,'VoiceExtensionId':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x15')]});}_0x5eefb8[_0xf21b('0xc')]=_0x10c59f[_0xf21b('0x28')]?_[_0xf21b('0x3d')](_0x10c59f)['priority']+0x1:_0x39d70f['priority'];_0x39d70f['priority']=(_0xb52a57[_0xf21b('0x28')]?_[_0xf21b('0x3d')](_0xb52a57)[_0xf21b('0xc')]:_0x5eefb8[_0xf21b('0xc')])+0x1;_0x39d70f[_0xf21b('0x17')]=_[_0xf21b('0x3e')](_0x39d70f[_0xf21b('0x17')],_0x10c59f,[_0x5eefb8],_0xb52a57);}_0x39d70f[_0xf21b('0x17')]['push']({'type':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x10')],'app':_0xf21b('0x3f'),'exten':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x8')],'context':_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x14')],'priority':_0x39d70f[_0xf21b('0xc')],'VoiceExtensionId':_0xdf6420[_0xf82ea1][0x0]['VoiceExtensionId']});_0x26228f[_0xf21b('0xf')](_0xdf6420[_0xf82ea1][0x0][_0xf21b('0x15')]);_0x2efcad=_[_0xf21b('0x3e')](_0x2efcad,_0x39d70f['extensions']);}}return _0x339964[_0xf21b('0x40')](function(_0x345231){return _0x339964[_0xf21b('0x1')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x26228f}},'transaction':_0x345231})[_0xf21b('0x5')](function(_0x56fe66){return _0x339964['models'][_0xf21b('0x4')][_0xf21b('0x41')](_[_0xf21b('0x42')](_0x2efcad,_0xf21b('0xc')),{'transaction':_0x345231});});});})[_0xf21b('0x43')](function(_0x3be333){console[_0xf21b('0x44')](_0x3be333);});}exports[_0xf21b('0x45')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 83ecc98..15e8e7c 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 _0x3392=['phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','updatedAt','ListId\x20=\x20?','id\x20IN\x20?','cm_hopper_final','\x20=\x20?','into','str','cm_hopper_black','VoiceQueue','findAll','Lists','sequelize','query','VoiceQueueId','all','CmList','BlackLists','get','dialCheckDuplicateType','always','onlyIfOpen','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','ioredis','../../../mysqldb','defaults','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','null','Missing\x20socket_timestamp\x20parameter!','error','contact','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','join','hasOwnProperty','data','firstName','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','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','checkHopper','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL'];(function(_0x209e75,_0x563d10){var _0x414786=function(_0x58be5a){while(--_0x58be5a){_0x209e75['push'](_0x209e75['shift']());}};_0x414786(++_0x563d10);}(_0x3392,0x1d7));var _0x2339=function(_0x1480af,_0x99bc5f){_0x1480af=_0x1480af-0x0;var _0x5ae447=_0x3392[_0x1480af];return _0x5ae447;};'use strict';var BPromise=require(_0x2339('0x0'));var util=require(_0x2339('0x1'));var _=require(_0x2339('0x2'));var fs=require('fs');var squel=require(_0x2339('0x3'));var Papa=require('papaparse');var Redis=require(_0x2339('0x4'));var db=require(_0x2339('0x5'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')('api');config['redis']=_[_0x2339('0x6')](config[_0x2339('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x2339('0x8'))(new Redis(config[_0x2339('0x7')]));require(_0x2339('0x9'))[_0x2339('0xa')](socket);try{if(!process[_0x2339('0xb')][0x2]||process[_0x2339('0xb')][0x2]===_0x2339('0xc')||process[_0x2339('0xb')][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x2339('0xb')][0x2];if(!process[_0x2339('0xb')][0x3]||process[_0x2339('0xb')][0x3]===_0x2339('0xc')||process[_0x2339('0xb')][0x3]==='null'||!process[_0x2339('0xb')][0x4]||process[_0x2339('0xb')][0x4]===_0x2339('0xc')||process['argv'][0x4]==='null'){throw new Error(_0x2339('0xd'));}var FIELDS=_['zipObject'](process[_0x2339('0xb')][0x3][_0x2339('0xe')](','),process[_0x2339('0xb')][0x4][_0x2339('0xe')](','));if(!process['argv'][0x5]||process[_0x2339('0xb')][0x5]===_0x2339('0xc')||process['argv'][0x5]==='null'){throw new Error(_0x2339('0xf'));}var LISTID=process[_0x2339('0xb')][0x5];var COMPANYID=process[_0x2339('0xb')][0x6]&&process[_0x2339('0xb')][0x6]!==_0x2339('0xc')&&process['argv'][0x6]!==_0x2339('0x10')?process['argv'][0x6]:null;var DUPLICATES=process[_0x2339('0xb')][0x7]&&process[_0x2339('0xb')][0x7]!==_0x2339('0xc')&&process[_0x2339('0xb')][0x7]!==_0x2339('0x10')?process[_0x2339('0xb')][0x7]:null;if(!process[_0x2339('0xb')][0x8]||process['argv'][0x8]===_0x2339('0xc')||process['argv'][0x8]===_0x2339('0x10')){throw new Error(_0x2339('0x11'));}var SOCKET_TIMESTAMP=process[_0x2339('0xb')][0x8];}catch(_0x4fa5e2){logger[_0x2339('0x12')](_0x4fa5e2);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(_0x2f0bcd,_0xb8efd2,_0x375e42,_0x42b0ca){var _0x4ba4db={'message':_0xb8efd2};_0x4ba4db[_0x2f0bcd]=!![];if(_0x375e42){_0x4ba4db[_0x2339('0x13')]=_0x375e42;}if(_0x42b0ca){_0x4ba4db['index']=_0x42b0ca;}return _0x4ba4db;}function isEmail(_0xb11826){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'](_0xb11826);}function checkRow(_0x1651ea,_0x4cd3cc,_0x3e1cab){return new BPromise(function(_0x3c1ee8,_0x1ea292){if(_['isNil'](_0x1651ea)){return _0x1ea292(handleCheckRowError('error',_0x2339('0x14'),null,_0x3e1cab));}if(_0x1651ea[_0x2339('0x15')]&&_0x1651ea[_0x2339('0x15')]['length']){var _0xd77502=_[_0x2339('0x16')](_0x1651ea[_0x2339('0x15')],'message')[_0x2339('0x17')](';');return _0x1ea292(handleCheckRowError(_0x2339('0x12'),_0xd77502,null,_0x3e1cab));}var _0x253bea={};for(var _0x3e3f3c in FIELDS){if(FIELDS[_0x2339('0x18')](_0x3e3f3c)&&FIELDS[_0x3e3f3c]){_0x253bea[_0x3e3f3c]=_0x1651ea[_0x2339('0x19')][0x0][FIELDS[_0x3e3f3c]]||_0x1651ea['data'][0x0]['\ufeff'+FIELDS[_0x3e3f3c]];}}if(!_0x253bea[_0x2339('0x1a')]){return _0x1ea292(handleCheckRowError(_0x2339('0x12'),_0x2339('0x1b'),null,_0x3e1cab));}if(!_0x253bea[_0x2339('0x1c')]){return _0x1ea292(handleCheckRowError(_0x2339('0x12'),_0x2339('0x1d'),null,_0x3e1cab));}if(_0x253bea[_0x2339('0x1e')]){var _0x18a486=moment(_0x253bea[_0x2339('0x1e')],'YYYY-MM-DD');if(!_0x18a486[_0x2339('0x1f')]()){return _0x1ea292(handleCheckRowError(_0x2339('0x12'),_0x2339('0x20'),null,_0x3e1cab));}}if(_0x253bea[_0x2339('0x21')]){if(!isEmail(_0x253bea[_0x2339('0x21')])){return _0x1ea292(handleCheckRowError(_0x2339('0x12'),_0x2339('0x22'),null,_0x3e1cab));}}_0x253bea[_0x2339('0x23')]=LISTID;_0x253bea['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x2339('0x24')]&&_0x4cd3cc){var _0x1a5d45={};for(var _0x15f116=0x0,_0xa07883=DUPLICATES['length'];_0x15f116<_0xa07883;_0x15f116+=0x1){_0x1a5d45[DUPLICATES[_0x15f116]]=_0x253bea[DUPLICATES[_0x15f116]];}var _0x5d8b50=_[_0x2339('0x25')](_0x4cd3cc,_0x1a5d45);if(_0x5d8b50){return _0x1ea292(handleCheckRowError(_0x2339('0x26'),_0x2339('0x27'),_0x5d8b50,_0x3e1cab));}}return db[_0x2339('0x28')][_0x2339('0x29')](_0x253bea,{'raw':!![],'hooks':![],'fields':_[_0x2339('0x2a')](_0x253bea)})[_0x2339('0x2b')](function(_0x5761f4){if(DUPLICATES&&DUPLICATES[_0x2339('0x24')]&&_0x4cd3cc){_0x4cd3cc[_0x2339('0x2c')](_[_0x2339('0x2d')](_0x253bea,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5761f4['id'];return _0x3c1ee8();})[_0x2339('0x2e')](function(_0xb77cee){return _0x1ea292(handleCheckRowError('error',_0x2339('0x2f')+(_0xb77cee[_0x2339('0x30')]||JSON[_0x2339('0x31')](_0xb77cee)),null,_0x3e1cab));});});}function checkHopper(){function _0x379408(){return function(_0x29ce8){logger[_0x2339('0x12')]('cmContact',_0x2339('0x32'),util['inspect'](_0x29ce8,{'showHidden':![],'depth':null}));};}var _0x875c04=function(_0x1e3677,_0x567511){var _0x38c16b=squel[_0x2339('0x33')]()['into'](_0x2339('0x34'))[_0x2339('0x35')]([_0x2339('0x1c'),_0x2339('0x36'),_0x2339('0x37'),_0x2339('0x23'),_0x567511,_0x2339('0x38'),'updatedAt'],squel['select']()[_0x2339('0x39')](_0x2339('0x1c'),_0x2339('0x1c'))['field'](_0x2339('0x3a'),_0x2339('0x36'))[_0x2339('0x39')]('id',_0x2339('0x37'))[_0x2339('0x39')](LISTID[_0x2339('0x3b')](),_0x2339('0x23'))[_0x2339('0x39')](_0x1e3677['id'][_0x2339('0x3b')](),_0x567511)[_0x2339('0x39')]('NOW()','createdAt')[_0x2339('0x39')]('NOW()','updatedAt')[_0x2339('0x3c')](_0x2339('0x3d'))[_0x2339('0x3e')](_0x2339('0x3f'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0x2339('0x3e')](_0x2339('0x40'))[_0x2339('0x3e')](_0x2339('0x41'),squel[_0x2339('0x42')]()['field'](_0x2339('0x1c'))['from'](_0x2339('0x34'))['where'](_0x567511+'\x20=\x20?',_0x1e3677['id'][_0x2339('0x3b')]())))[_0x2339('0x3b')]();return _0x38c16b;};var _0x2d43dc=function(_0x4a4819,_0x5685cc){var _0x512a9c=squel['insert']()['into'](_0x2339('0x34'))[_0x2339('0x35')]([_0x2339('0x1c'),_0x2339('0x36'),_0x2339('0x37'),'ListId',_0x5685cc,_0x2339('0x38'),_0x2339('0x43')],squel['select']()['field'](_0x2339('0x1c'),_0x2339('0x1c'))[_0x2339('0x39')](_0x2339('0x3a'),_0x2339('0x36'))[_0x2339('0x39')]('id',_0x2339('0x37'))[_0x2339('0x39')](LISTID['toString'](),_0x2339('0x23'))[_0x2339('0x39')](_0x4a4819['id'][_0x2339('0x3b')](),_0x5685cc)[_0x2339('0x39')]('NOW()',_0x2339('0x38'))[_0x2339('0x39')]('NOW()',_0x2339('0x43'))[_0x2339('0x3c')](_0x2339('0x3d'))[_0x2339('0x3e')](_0x2339('0x3f'))[_0x2339('0x3e')](_0x2339('0x44'),LISTID[_0x2339('0x3b')]())['where'](_0x2339('0x45'),squel['str'](hopperContacts))[_0x2339('0x3e')](_0x2339('0x40'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x2339('0x42')]()[_0x2339('0x39')]('calleridnum')[_0x2339('0x3c')](_0x2339('0x46'))[_0x2339('0x3e')](_0x5685cc+_0x2339('0x47'),_0x4a4819['id'][_0x2339('0x3b')]()))[_0x2339('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2339('0x42')]()['field'](_0x2339('0x1c'))[_0x2339('0x3c')](_0x2339('0x34'))['where'](_0x5685cc+'\x20=\x20?',_0x4a4819['id']['toString']())))['toString']();return _0x512a9c;};function _0x5964b5(_0x5bad97,_0x420473){var _0x22de1c=squel[_0x2339('0x33')]()[_0x2339('0x48')](_0x2339('0x34'))[_0x2339('0x35')]([_0x2339('0x1c'),_0x2339('0x36'),'ContactId',_0x2339('0x23'),_0x420473,_0x2339('0x38'),_0x2339('0x43')],squel['select']()[_0x2339('0x39')](_0x2339('0x1c'),'phone')[_0x2339('0x39')](_0x2339('0x3a'),_0x2339('0x36'))[_0x2339('0x39')]('id',_0x2339('0x37'))[_0x2339('0x39')](LISTID[_0x2339('0x3b')](),_0x2339('0x23'))[_0x2339('0x39')](_0x5bad97['id'][_0x2339('0x3b')](),_0x420473)[_0x2339('0x39')](_0x2339('0x3a'),_0x2339('0x38'))[_0x2339('0x39')]('NOW()',_0x2339('0x43'))[_0x2339('0x3c')](_0x2339('0x3d'))[_0x2339('0x3e')]('deletedAt\x20IS\x20NULL')[_0x2339('0x3e')](_0x2339('0x44'),LISTID[_0x2339('0x3b')]())['where'](_0x2339('0x45'),squel[_0x2339('0x49')](hopperContacts))[_0x2339('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0x2339('0x3b')]();return _0x22de1c;}function _0x306752(_0x51c326,_0x56e686){var _0x540f52=squel['insert']()[_0x2339('0x48')](_0x2339('0x4a'))[_0x2339('0x35')](['phone',_0x2339('0x37'),_0x2339('0x23'),_0x56e686,_0x2339('0x38'),_0x2339('0x43')],squel[_0x2339('0x42')]()[_0x2339('0x39')]('phone',_0x2339('0x1c'))['field']('id','ContactId')[_0x2339('0x39')](LISTID[_0x2339('0x3b')](),_0x2339('0x23'))['field'](_0x51c326['id'][_0x2339('0x3b')](),_0x56e686)[_0x2339('0x39')](_0x2339('0x3a'),_0x2339('0x38'))['field']('NOW()','updatedAt')[_0x2339('0x3c')](_0x2339('0x3d'))['where'](_0x2339('0x3f'))[_0x2339('0x3e')](_0x2339('0x44'),LISTID[_0x2339('0x3b')]())['where'](_0x2339('0x45'),squel[_0x2339('0x49')](hopperContacts))[_0x2339('0x3e')](_0x2339('0x40')))['toString']();return _0x540f52;}return db[_0x2339('0x4b')][_0x2339('0x4c')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x2339('0x4d'),'where':{'id':LISTID}}]})['then'](function(_0x40a338){var _0x512364=[];if(_0x40a338){var _0xe6e639;for(var _0x6487f0=0x0,_0x34fb44;_0x6487f0<_0x40a338[_0x2339('0x24')];_0x6487f0+=0x1){_0x34fb44=_0x40a338[_0x6487f0]['get']({'plain':!![]});switch(_0x34fb44['dialCheckDuplicateType']){case'always':_0x512364['push'](db[_0x2339('0x4e')][_0x2339('0x4f')](_0x2d43dc(_0x34fb44,_0x2339('0x50')))[_0x2339('0x2b')](function(){})[_0x2339('0x2e')](_0x379408()));break;case'onlyIfOpen':_0x512364[_0x2339('0x2c')](db[_0x2339('0x4e')][_0x2339('0x4f')](_0x875c04(_0x34fb44,'VoiceQueueId'))['then'](function(){})['catch'](_0x379408()));break;default:_0x512364[_0x2339('0x2c')](db[_0x2339('0x4e')][_0x2339('0x4f')](_0x5964b5(_0x34fb44,_0x2339('0x50')))[_0x2339('0x2b')](function(){})[_0x2339('0x2e')](_0x379408()));}}}return _0x512364;})[_0x2339('0x51')]()[_0x2339('0x2b')](function(){return db[_0x2339('0x4b')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x2339('0x52')],'as':_0x2339('0x53'),'where':{'id':LISTID}}]})[_0x2339('0x2b')](function(_0x287280){var _0x4dbfee=[];if(_0x287280){var _0x2c6e54;for(var _0x2bc815=0x0,_0x3d973a;_0x2bc815<_0x287280[_0x2339('0x24')];_0x2bc815+=0x1){_0x3d973a=_0x287280[_0x2bc815][_0x2339('0x54')]({'plain':!![]});_0x4dbfee['push'](db[_0x2339('0x4e')][_0x2339('0x4f')](_0x306752(_0x3d973a,_0x2339('0x50')))[_0x2339('0x2b')](function(){})['catch'](_0x379408()));}}return _0x4dbfee;})['all']();})[_0x2339('0x2b')](function(){return db['Campaign'][_0x2339('0x4c')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x2339('0x52')],'as':_0x2339('0x4d'),'where':{'id':LISTID}}]})['then'](function(_0x34dc69){var _0xa47606=[];if(_0x34dc69){for(var _0x47e6ac=0x0,_0x16b7e9;_0x47e6ac<_0x34dc69['length'];_0x47e6ac+=0x1){_0x16b7e9=_0x34dc69[_0x47e6ac][_0x2339('0x54')]({'plain':!![]});switch(_0x16b7e9[_0x2339('0x55')]){case _0x2339('0x56'):_0xa47606['push'](db['sequelize'][_0x2339('0x4f')](_0x2d43dc(_0x16b7e9,'CampaignId'))['then'](function(){})[_0x2339('0x2e')](_0x379408()));break;case _0x2339('0x57'):_0xa47606[_0x2339('0x2c')](db[_0x2339('0x4e')][_0x2339('0x4f')](_0x875c04(_0x16b7e9,_0x2339('0x58')))[_0x2339('0x2b')](function(){})[_0x2339('0x2e')](_0x379408()));break;default:_0xa47606['push'](db[_0x2339('0x4e')]['query'](_0x5964b5(_0x16b7e9,_0x2339('0x58')))[_0x2339('0x2b')](function(){})[_0x2339('0x2e')](_0x379408()));}}}return _0xa47606;})['all']();})['then'](function(){return db['Campaign'][_0x2339('0x4c')]({'attributes':['id'],'include':[{'model':db[_0x2339('0x52')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x2339('0x2b')](function(_0x2ef5d9){var _0x10c3b8=[];if(_0x2ef5d9){for(var _0x4806b0=0x0,_0x48f66b;_0x4806b0<_0x2ef5d9[_0x2339('0x24')];_0x4806b0+=0x1){_0x48f66b=_0x2ef5d9[_0x4806b0]['get']({'plain':!![]});_0x10c3b8['push'](db[_0x2339('0x4e')][_0x2339('0x4f')](_0x306752(_0x48f66b,_0x2339('0x58')))['then'](function(){})[_0x2339('0x2e')](_0x379408()));}}return _0x10c3b8;})['all']();})[_0x2339('0x2e')](function(_0x46a2be){logger['error'](_0x2339('0x59'),'generalCheckHopper',_0x46a2be[_0x2339('0x30')]);});}var processPromises=function(_0x623b25){return BPromise[_0x2339('0x51')](promises)[_0x2339('0x2b')](function(_0x673df1){})[_0x2339('0x2e')](function(_0x370b81){logger['error'](_0x2339('0x5a'),JSON[_0x2339('0x31')](_0x370b81));})[_0x2339('0x5b')](function(){socket[_0x2339('0x5c')](_0x2339('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x623b25){return _0x623b25['resume']();}});};var endCsv=function(){return BPromise[_0x2339('0x5e')]()[_0x2339('0x2b')](function(){if(hopperContacts){return checkHopper();}})[_0x2339('0x2b')](function(){socket['emit'](_0x2339('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x2339('0x5f')](FILEPATH);}catch(_0x140906){logger[_0x2339('0x12')](_0x2339('0x60'),JSON[_0x2339('0x31')](_0x140906));}finally{process[_0x2339('0x61')](0x0);}});};process['on'](_0x2339('0x62'),function(){logger[_0x2339('0x63')](_0x2339('0x64'));endCsv();});function main(){return BPromise[_0x2339('0x5e')]()[_0x2339('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x2339('0xe')](',');return db['CmContact'][_0x2339('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x2339('0x2b')](function(_0xe2e481){var _0x2eea01=fs[_0x2339('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x2339('0x66')](_0x2eea01,{'header':!![],'skipEmptyLines':!![],'step':function(_0x47c49a,_0x1fc3c7){total+=0x1;var _0x17657c=total;promises[_0x2339('0x2c')](checkRow(_0x47c49a,_0xe2e481,_0x17657c)[_0x2339('0x2b')](function(){success+=0x1;})[_0x2339('0x2e')](function(_0x524f0a){if(_0x524f0a[_0x2339('0x12')]){errors+=0x1;delete _0x524f0a[_0x2339('0x12')];}else if(_0x524f0a[_0x2339('0x26')]){duplicates+=0x1;delete _0x524f0a['duplicate'];}rows['push'](_0x524f0a);}));if(total%0xc8===0x0){_0x1fc3c7[_0x2339('0x67')]();return processPromises(_0x1fc3c7);}},'complete':function(){return processPromises()[_0x2339('0x2b')](function(){logger['info'](_0x2339('0x68'));endCsv();});},'error':function(_0x425797,_0x16c1df){logger[_0x2339('0x63')](_0x2339('0x69'),JSON['stringify'](_0x425797));endCsv();}});})[_0x2339('0x2e')](function(_0x36f03){logger[_0x2339('0x12')](_0x2339('0x6a'),JSON[_0x2339('0x31')](_0x36f03));});}main(); \ No newline at end of file +var _0xa8eb=['always','sequelize','VoiceQueueId','onlyIfOpen','all','BlackLists','query','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','undefined','argv','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','duplicate','CmContact','keys','then','push','pick','catch','stringify','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','field','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','select','calleridnum','cm_hopper_final','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0xa8eb,0xee));var _0xba8e=function(_0x2664de,_0x10baa4){_0x2664de=_0x2664de-0x0;var _0x357cfc=_0xa8eb[_0x2664de];return _0x357cfc;};'use strict';var BPromise=require('bluebird');var util=require(_0xba8e('0x0'));var _=require('lodash');var fs=require('fs');var squel=require(_0xba8e('0x1'));var Papa=require(_0xba8e('0x2'));var Redis=require(_0xba8e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0xba8e('0x4'));var logger=require(_0xba8e('0x5'))(_0xba8e('0x6'));config[_0xba8e('0x7')]=_[_0xba8e('0x8')](config['redis'],{'host':_0xba8e('0x9'),'port':0x18eb});var socket=require(_0xba8e('0xa'))(new Redis(config[_0xba8e('0x7')]));require(_0xba8e('0xb'))['register'](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0xba8e('0xc')||process[_0xba8e('0xd')][0x2]==='null'){throw new Error(_0xba8e('0xe'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0xba8e('0xd')][0x3]==='undefined'||process['argv'][0x3]===_0xba8e('0xf')||!process[_0xba8e('0xd')][0x4]||process['argv'][0x4]===_0xba8e('0xc')||process['argv'][0x4]==='null'){throw new Error(_0xba8e('0x10'));}var FIELDS=_[_0xba8e('0x11')](process[_0xba8e('0xd')][0x3][_0xba8e('0x12')](','),process[_0xba8e('0xd')][0x4]['split'](','));if(!process[_0xba8e('0xd')][0x5]||process[_0xba8e('0xd')][0x5]===_0xba8e('0xc')||process[_0xba8e('0xd')][0x5]==='null'){throw new Error(_0xba8e('0x13'));}var LISTID=process[_0xba8e('0xd')][0x5];var COMPANYID=process[_0xba8e('0xd')][0x6]&&process[_0xba8e('0xd')][0x6]!==_0xba8e('0xc')&&process[_0xba8e('0xd')][0x6]!==_0xba8e('0xf')?process[_0xba8e('0xd')][0x6]:null;var DUPLICATES=process[_0xba8e('0xd')][0x7]&&process['argv'][0x7]!==_0xba8e('0xc')&&process[_0xba8e('0xd')][0x7]!==_0xba8e('0xf')?process[_0xba8e('0xd')][0x7]:null;if(!process[_0xba8e('0xd')][0x8]||process[_0xba8e('0xd')][0x8]===_0xba8e('0xc')||process['argv'][0x8]===_0xba8e('0xf')){throw new Error(_0xba8e('0x14'));}var SOCKET_TIMESTAMP=process[_0xba8e('0xd')][0x8];}catch(_0x3f1a2d){logger[_0xba8e('0x15')](_0x3f1a2d);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(_0x8dbba8,_0x14e91f,_0xff29ba,_0x2462f8){var _0x254d08={'message':_0x14e91f};_0x254d08[_0x8dbba8]=!![];if(_0xff29ba){_0x254d08[_0xba8e('0x16')]=_0xff29ba;}if(_0x2462f8){_0x254d08[_0xba8e('0x17')]=_0x2462f8;}return _0x254d08;}function isEmail(_0x327c51){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))*$/[_0xba8e('0x18')](_0x327c51);}function checkRow(_0x4fa544,_0x4924ae,_0x1d6374){return new BPromise(function(_0x369884,_0x275291){if(_[_0xba8e('0x19')](_0x4fa544)){return _0x275291(handleCheckRowError(_0xba8e('0x15'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x1d6374));}if(_0x4fa544['errors']&&_0x4fa544[_0xba8e('0x1a')][_0xba8e('0x1b')]){var _0x7a15f2=_['map'](_0x4fa544[_0xba8e('0x1a')],_0xba8e('0x1c'))[_0xba8e('0x1d')](';');return _0x275291(handleCheckRowError(_0xba8e('0x15'),_0x7a15f2,null,_0x1d6374));}var _0x534b84={};for(var _0xccf634 in FIELDS){if(FIELDS[_0xba8e('0x1e')](_0xccf634)&&FIELDS[_0xccf634]){_0x534b84[_0xccf634]=_0x4fa544[_0xba8e('0x1f')][0x0][FIELDS[_0xccf634]]||_0x4fa544[_0xba8e('0x1f')][0x0]['\ufeff'+FIELDS[_0xccf634]];}}if(!_0x534b84[_0xba8e('0x20')]){return _0x275291(handleCheckRowError(_0xba8e('0x15'),_0xba8e('0x21'),null,_0x1d6374));}if(!_0x534b84[_0xba8e('0x22')]){return _0x275291(handleCheckRowError('error',_0xba8e('0x23'),null,_0x1d6374));}if(_0x534b84['birthDate']){var _0x4ac0b9=moment(_0x534b84[_0xba8e('0x24')],_0xba8e('0x25'));if(!_0x4ac0b9['isValid']()){return _0x275291(handleCheckRowError(_0xba8e('0x15'),_0xba8e('0x26'),null,_0x1d6374));}}if(_0x534b84[_0xba8e('0x27')]){if(!isEmail(_0x534b84[_0xba8e('0x27')])){return _0x275291(handleCheckRowError('error',_0xba8e('0x28'),null,_0x1d6374));}}_0x534b84['ListId']=LISTID;_0x534b84['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x4924ae){var _0x1b2ca9={};for(var _0x213080=0x0,_0x3cf50a=DUPLICATES[_0xba8e('0x1b')];_0x213080<_0x3cf50a;_0x213080+=0x1){_0x1b2ca9[DUPLICATES[_0x213080]]=_0x534b84[DUPLICATES[_0x213080]];}var _0x395ed0=_['find'](_0x4924ae,_0x1b2ca9);if(_0x395ed0){return _0x275291(handleCheckRowError(_0xba8e('0x29'),'Duplicate\x20Contact',_0x395ed0,_0x1d6374));}}return db[_0xba8e('0x2a')]['create'](_0x534b84,{'raw':!![],'hooks':![],'fields':_[_0xba8e('0x2b')](_0x534b84)})[_0xba8e('0x2c')](function(_0x20ba40){if(DUPLICATES&&DUPLICATES[_0xba8e('0x1b')]&&_0x4924ae){_0x4924ae[_0xba8e('0x2d')](_[_0xba8e('0x2e')](_0x534b84,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x20ba40['id'];return _0x369884();})[_0xba8e('0x2f')](function(_0x22ba52){return _0x275291(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x22ba52[_0xba8e('0x1c')]||JSON[_0xba8e('0x30')](_0x22ba52)),null,_0x1d6374));});});}function checkHopper(){function _0x30a1a6(){return function(_0x3bb562){logger[_0xba8e('0x15')]('cmContact',_0xba8e('0x31'),util[_0xba8e('0x32')](_0x3bb562,{'showHidden':![],'depth':null}));};}var _0x5ad614=function(_0x4ea837,_0x2bcc9d){var _0x4b201e=squel[_0xba8e('0x33')]()[_0xba8e('0x34')](_0xba8e('0x35'))[_0xba8e('0x36')]([_0xba8e('0x22'),_0xba8e('0x37'),_0xba8e('0x38'),_0xba8e('0x39'),_0x2bcc9d,_0xba8e('0x3a'),_0xba8e('0x3b')],squel['select']()[_0xba8e('0x3c')](_0xba8e('0x22'),_0xba8e('0x22'))['field']('NOW()',_0xba8e('0x37'))[_0xba8e('0x3c')]('id',_0xba8e('0x38'))[_0xba8e('0x3c')](LISTID[_0xba8e('0x3d')](),'ListId')[_0xba8e('0x3c')](_0x4ea837['id'][_0xba8e('0x3d')](),_0x2bcc9d)[_0xba8e('0x3c')]('NOW()',_0xba8e('0x3a'))[_0xba8e('0x3c')](_0xba8e('0x3e'),'updatedAt')[_0xba8e('0x3f')](_0xba8e('0x40'))[_0xba8e('0x41')](_0xba8e('0x42'))[_0xba8e('0x41')](_0xba8e('0x43'),LISTID[_0xba8e('0x3d')]())[_0xba8e('0x41')](_0xba8e('0x44'))[_0xba8e('0x41')](_0xba8e('0x45'),squel['select']()[_0xba8e('0x3c')](_0xba8e('0x22'))[_0xba8e('0x3f')](_0xba8e('0x35'))[_0xba8e('0x41')](_0x2bcc9d+_0xba8e('0x46'),_0x4ea837['id'][_0xba8e('0x3d')]())))[_0xba8e('0x3d')]();return _0x4b201e;};var _0x179e8d=function(_0x256a69,_0x305aae){var _0x5cf844=squel[_0xba8e('0x33')]()[_0xba8e('0x34')](_0xba8e('0x35'))[_0xba8e('0x36')]([_0xba8e('0x22'),'scheduledAt',_0xba8e('0x38'),_0xba8e('0x39'),_0x305aae,_0xba8e('0x3a'),'updatedAt'],squel['select']()[_0xba8e('0x3c')](_0xba8e('0x22'),'phone')[_0xba8e('0x3c')]('NOW()',_0xba8e('0x37'))['field']('id',_0xba8e('0x38'))['field'](LISTID[_0xba8e('0x3d')](),_0xba8e('0x39'))[_0xba8e('0x3c')](_0x256a69['id'][_0xba8e('0x3d')](),_0x305aae)[_0xba8e('0x3c')](_0xba8e('0x3e'),'createdAt')['field'](_0xba8e('0x3e'),_0xba8e('0x3b'))[_0xba8e('0x3f')]('cm_contacts')[_0xba8e('0x41')](_0xba8e('0x42'))[_0xba8e('0x41')](_0xba8e('0x43'),LISTID[_0xba8e('0x3d')]())['where'](_0xba8e('0x47'),squel[_0xba8e('0x48')](hopperContacts))['where'](_0xba8e('0x44'))[_0xba8e('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0xba8e('0x49')]()[_0xba8e('0x3c')](_0xba8e('0x4a'))[_0xba8e('0x3f')](_0xba8e('0x4b'))['where'](_0x305aae+'\x20=\x20?',_0x256a69['id']['toString']()))[_0xba8e('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0xba8e('0x49')]()['field']('phone')[_0xba8e('0x3f')](_0xba8e('0x35'))[_0xba8e('0x41')](_0x305aae+_0xba8e('0x46'),_0x256a69['id'][_0xba8e('0x3d')]())))['toString']();return _0x5cf844;};function _0x5510bd(_0x2c7d0e,_0x58adda){var _0x2f4619=squel[_0xba8e('0x33')]()['into'](_0xba8e('0x35'))[_0xba8e('0x36')](['phone','scheduledAt',_0xba8e('0x38'),'ListId',_0x58adda,_0xba8e('0x3a'),'updatedAt'],squel[_0xba8e('0x49')]()[_0xba8e('0x3c')](_0xba8e('0x22'),_0xba8e('0x22'))[_0xba8e('0x3c')](_0xba8e('0x3e'),'scheduledAt')[_0xba8e('0x3c')]('id',_0xba8e('0x38'))[_0xba8e('0x3c')](LISTID[_0xba8e('0x3d')](),_0xba8e('0x39'))['field'](_0x2c7d0e['id']['toString'](),_0x58adda)[_0xba8e('0x3c')](_0xba8e('0x3e'),_0xba8e('0x3a'))[_0xba8e('0x3c')](_0xba8e('0x3e'),_0xba8e('0x3b'))['from'](_0xba8e('0x40'))[_0xba8e('0x41')](_0xba8e('0x42'))[_0xba8e('0x41')]('ListId\x20=\x20?',LISTID[_0xba8e('0x3d')]())[_0xba8e('0x41')](_0xba8e('0x47'),squel[_0xba8e('0x48')](hopperContacts))[_0xba8e('0x41')](_0xba8e('0x44')))[_0xba8e('0x3d')]();return _0x2f4619;}function _0x3776cd(_0x54024a,_0x272ab6){var _0x5c61d6=squel[_0xba8e('0x33')]()[_0xba8e('0x34')]('cm_hopper_black')['fromQuery']([_0xba8e('0x22'),_0xba8e('0x38'),_0xba8e('0x39'),_0x272ab6,'createdAt',_0xba8e('0x3b')],squel[_0xba8e('0x49')]()[_0xba8e('0x3c')](_0xba8e('0x22'),_0xba8e('0x22'))['field']('id','ContactId')[_0xba8e('0x3c')](LISTID['toString'](),_0xba8e('0x39'))['field'](_0x54024a['id'][_0xba8e('0x3d')](),_0x272ab6)['field'](_0xba8e('0x3e'),'createdAt')[_0xba8e('0x3c')]('NOW()','updatedAt')['from']('cm_contacts')[_0xba8e('0x41')](_0xba8e('0x42'))[_0xba8e('0x41')](_0xba8e('0x43'),LISTID[_0xba8e('0x3d')]())['where'](_0xba8e('0x47'),squel['str'](hopperContacts))[_0xba8e('0x41')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x5c61d6;}return db[_0xba8e('0x4c')][_0xba8e('0x4d')]({'where':{'type':_0xba8e('0x4e')},'attributes':['id',_0xba8e('0x4f')],'include':[{'model':db[_0xba8e('0x50')],'as':_0xba8e('0x51'),'where':{'id':LISTID}}]})['then'](function(_0x192077){var _0x4f11a8=[];if(_0x192077){var _0x20da45;for(var _0x181c35=0x0,_0x516862;_0x181c35<_0x192077[_0xba8e('0x1b')];_0x181c35+=0x1){_0x516862=_0x192077[_0x181c35][_0xba8e('0x52')]({'plain':!![]});switch(_0x516862['dialCheckDuplicateType']){case _0xba8e('0x53'):_0x4f11a8[_0xba8e('0x2d')](db[_0xba8e('0x54')]['query'](_0x179e8d(_0x516862,_0xba8e('0x55')))[_0xba8e('0x2c')](function(){})[_0xba8e('0x2f')](_0x30a1a6()));break;case _0xba8e('0x56'):_0x4f11a8[_0xba8e('0x2d')](db[_0xba8e('0x54')]['query'](_0x5ad614(_0x516862,_0xba8e('0x55')))[_0xba8e('0x2c')](function(){})[_0xba8e('0x2f')](_0x30a1a6()));break;default:_0x4f11a8[_0xba8e('0x2d')](db[_0xba8e('0x54')]['query'](_0x5510bd(_0x516862,'VoiceQueueId'))[_0xba8e('0x2c')](function(){})['catch'](_0x30a1a6()));}}}return _0x4f11a8;})[_0xba8e('0x57')]()[_0xba8e('0x2c')](function(){return db[_0xba8e('0x4c')][_0xba8e('0x4d')]({'where':{'type':_0xba8e('0x4e')},'attributes':['id'],'include':[{'model':db[_0xba8e('0x50')],'as':_0xba8e('0x58'),'where':{'id':LISTID}}]})[_0xba8e('0x2c')](function(_0x5ead2d){var _0x5e2d12=[];if(_0x5ead2d){var _0x2ada48;for(var _0x417271=0x0,_0x586bda;_0x417271<_0x5ead2d[_0xba8e('0x1b')];_0x417271+=0x1){_0x586bda=_0x5ead2d[_0x417271]['get']({'plain':!![]});_0x5e2d12['push'](db[_0xba8e('0x54')][_0xba8e('0x59')](_0x3776cd(_0x586bda,'VoiceQueueId'))['then'](function(){})[_0xba8e('0x2f')](_0x30a1a6()));}}return _0x5e2d12;})[_0xba8e('0x57')]();})[_0xba8e('0x2c')](function(){return db[_0xba8e('0x5a')][_0xba8e('0x4d')]({'attributes':['id',_0xba8e('0x4f')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x101330){var _0x4e94ef=[];if(_0x101330){for(var _0x47d9f0=0x0,_0x2e01e5;_0x47d9f0<_0x101330['length'];_0x47d9f0+=0x1){_0x2e01e5=_0x101330[_0x47d9f0][_0xba8e('0x52')]({'plain':!![]});switch(_0x2e01e5[_0xba8e('0x4f')]){case _0xba8e('0x53'):_0x4e94ef[_0xba8e('0x2d')](db[_0xba8e('0x54')]['query'](_0x179e8d(_0x2e01e5,_0xba8e('0x5b')))[_0xba8e('0x2c')](function(){})[_0xba8e('0x2f')](_0x30a1a6()));break;case'onlyIfOpen':_0x4e94ef['push'](db[_0xba8e('0x54')][_0xba8e('0x59')](_0x5ad614(_0x2e01e5,_0xba8e('0x5b')))[_0xba8e('0x2c')](function(){})[_0xba8e('0x2f')](_0x30a1a6()));break;default:_0x4e94ef[_0xba8e('0x2d')](db[_0xba8e('0x54')][_0xba8e('0x59')](_0x5510bd(_0x2e01e5,_0xba8e('0x5b')))[_0xba8e('0x2c')](function(){})[_0xba8e('0x2f')](_0x30a1a6()));}}}return _0x4e94ef;})[_0xba8e('0x57')]();})[_0xba8e('0x2c')](function(){return db[_0xba8e('0x5a')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0xba8e('0x2c')](function(_0xd59eb4){var _0xec0a6=[];if(_0xd59eb4){for(var _0x382865=0x0,_0x1f4bed;_0x382865<_0xd59eb4[_0xba8e('0x1b')];_0x382865+=0x1){_0x1f4bed=_0xd59eb4[_0x382865]['get']({'plain':!![]});_0xec0a6['push'](db[_0xba8e('0x54')]['query'](_0x3776cd(_0x1f4bed,_0xba8e('0x5b')))[_0xba8e('0x2c')](function(){})[_0xba8e('0x2f')](_0x30a1a6()));}}return _0xec0a6;})[_0xba8e('0x57')]();})['catch'](function(_0x12d97d){logger[_0xba8e('0x15')](_0xba8e('0x5c'),_0xba8e('0x5d'),_0x12d97d[_0xba8e('0x1c')]);});}var processPromises=function(_0x4bff45){return BPromise[_0xba8e('0x57')](promises)[_0xba8e('0x2c')](function(_0x3baa3f){})['catch'](function(_0x39368f){logger[_0xba8e('0x15')]('Error\x20processing\x20rows\x20block:',JSON[_0xba8e('0x30')](_0x39368f));})[_0xba8e('0x5e')](function(){socket[_0xba8e('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4bff45){return _0x4bff45[_0xba8e('0x60')]();}});};var endCsv=function(){return BPromise[_0xba8e('0x61')]()[_0xba8e('0x2c')](function(){if(hopperContacts){return checkHopper();}})[_0xba8e('0x2c')](function(){socket[_0xba8e('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x563238){logger[_0xba8e('0x15')](_0xba8e('0x62'),JSON[_0xba8e('0x30')](_0x563238));}finally{process[_0xba8e('0x63')](0x0);}});};process['on'](_0xba8e('0x64'),function(){logger[_0xba8e('0x65')](_0xba8e('0x66'));endCsv();});function main(){return BPromise[_0xba8e('0x61')]()[_0xba8e('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xba8e('0x12')](',');return db[_0xba8e('0x2a')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xba8e('0x2c')](function(_0x34f2cd){var _0x3c8d9f=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xba8e('0x67')](_0x3c8d9f,{'header':!![],'skipEmptyLines':!![],'step':function(_0xcc922a,_0x5ede82){total+=0x1;var _0x57e0cd=total;promises[_0xba8e('0x2d')](checkRow(_0xcc922a,_0x34f2cd,_0x57e0cd)[_0xba8e('0x2c')](function(){success+=0x1;})[_0xba8e('0x2f')](function(_0x56b5ad){if(_0x56b5ad[_0xba8e('0x15')]){errors+=0x1;delete _0x56b5ad['error'];}else if(_0x56b5ad[_0xba8e('0x29')]){duplicates+=0x1;delete _0x56b5ad['duplicate'];}rows[_0xba8e('0x2d')](_0x56b5ad);}));if(total%0xc8===0x0){_0x5ede82['pause']();return processPromises(_0x5ede82);}},'complete':function(){return processPromises()['then'](function(){logger[_0xba8e('0x65')](_0xba8e('0x68'));endCsv();});},'error':function(_0x32d571,_0x139514){logger[_0xba8e('0x65')](_0xba8e('0x69'),JSON['stringify'](_0x32d571));endCsv();}});})[_0xba8e('0x2f')](function(_0x400e2d){logger[_0xba8e('0x15')](_0xba8e('0x6a'),JSON[_0xba8e('0x30')](_0x400e2d));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 16c3bf0..91ea9b9 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 _0x964b=['argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','util','bluebird','moment','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','select','phone','from','join','.id\x20=\x20','\x20=\x20','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','where','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_contacts.ListId','cm_hopper_black','ContactId','ListId','fields','.CmListId\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','field','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','push','code','sequelize','query','catch','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','createReadStream','data','length','rows','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','appendFileSync','emit','errors','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','format','CompanyId','scheduledat',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','each','affectedRows','contact:import:','unlink','complete'];(function(_0x2730f6,_0x1e7e71){var _0x2fe4b3=function(_0x3a76bf){while(--_0x3a76bf){_0x2730f6['push'](_0x2730f6['shift']());}};_0x2fe4b3(++_0x1e7e71);}(_0x964b,0x112));var _0xb964=function(_0x500636,_0x1699d9){_0x500636=_0x500636-0x0;var _0x47bcd7=_0x964b[_0x500636];return _0x47bcd7;};'use strict';var fs=require('fs');var path=require(_0xb964('0x0'));var _=require(_0xb964('0x1'));var Papa=require('papaparse');var util=require(_0xb964('0x2'));var BPromise=require(_0xb964('0x3'));var moment=require(_0xb964('0x4'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0xb964('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0xb964('0x6'))(_0xb964('0x7'));config[_0xb964('0x8')]=_[_0xb964('0x9')](config[_0xb964('0x8')],{'host':_0xb964('0xa'),'port':0x18eb});var socket=require(_0xb964('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0xb964('0xc'));function isEmail(_0x505a2f){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'](_0x505a2f);}function selectNotIn(_0x295392,_0x4df011,_0x4433a5,_0x38247c,_0x38bae5){return squel[_0xb964('0xd')]()['field'](_0xb964('0xe'))[_0xb964('0xf')](_0x38247c)[_0xb964('0x10')](_0x4df011,null,_0x4df011+_0xb964('0x11')+_0x38247c+'.'+_0x4433a5)['where'](_0x38247c+'.'+_0x4433a5+_0xb964('0x12')+_0x295392+'.'+_0x4433a5)['where'](_0x4df011+'.dialCheckDuplicateType\x20IN\x20('+_0x38bae5[_0xb964('0x10')]()+')');}function insertCmHopper(_0x256e02,_0xe111d2,_0x407f8c,_0x2eebf3,_0x31c7f4){var _0x3d5baa=['cm_contacts.phone',_0xb964('0x13'),'cm_contacts.id','cm_contacts.ListId',_0xe111d2+'.'+_0x2eebf3,_0xb964('0x14'),_0xb964('0x15'),_0xb964('0x16'),_0xb964('0x17'),'\x22'+_0x31c7f4+'\x22'];return squel[_0xb964('0x18')]()[_0xb964('0x19')](_0xb964('0x1a'))[_0xb964('0x1b')]([_0xb964('0xe'),'scheduledat','ContactId','ListId',_0x2eebf3,_0xb964('0x1c'),_0xb964('0x1d'),_0xb964('0x1e'),_0xb964('0x1f'),_0xb964('0x20')],squel['select']()['fields'](_0x3d5baa)['from'](_0xe111d2)[_0xb964('0x10')](_0xb964('0x21'),null,_0xb964('0x22')+_0xe111d2+'.CmListId')[_0xb964('0x10')](_0x407f8c,null,_0x407f8c+_0xb964('0x11')+_0xe111d2+'.'+_0x2eebf3)[_0xb964('0x23')](_0xe111d2+'.CmListId\x20=\x20?',_0x256e02)['where'](_0xb964('0x24'),NOW)['where'](_0xb964('0x25'),selectNotIn(_0xe111d2,_0x407f8c,_0x2eebf3,_0xb964('0x1a'),[_0xb964('0x26'),_0xb964('0x27')]))['where'](_0xb964('0x25'),selectNotIn(_0xe111d2,_0x407f8c,_0x2eebf3,_0xb964('0x1a'),[_0xb964('0x26')])))[_0xb964('0x28')]();}function insertCmHopperBlack(_0x39273e,_0x21372b,_0x13d94d,_0x1626f2){var _0x142f76=['cm_contacts.phone',_0xb964('0x29'),_0xb964('0x2a'),_0x21372b+'.'+_0x1626f2,_0xb964('0x14'),_0xb964('0x15')];return squel[_0xb964('0x18')]()[_0xb964('0x19')](_0xb964('0x2b'))['fromQuery']([_0xb964('0xe'),_0xb964('0x2c'),_0xb964('0x2d'),_0x1626f2,'createdAt',_0xb964('0x1d')],squel[_0xb964('0xd')]()[_0xb964('0x2e')](_0x142f76)[_0xb964('0xf')](_0x21372b)[_0xb964('0x10')](_0xb964('0x21'),null,'cm_contacts.ListId\x20=\x20'+_0x21372b+'.CmListId')[_0xb964('0x10')](_0x13d94d,null,_0x13d94d+_0xb964('0x11')+_0x21372b+'.'+_0x1626f2)[_0xb964('0x23')](_0x21372b+_0xb964('0x2f'),_0x39273e)['where'](_0xb964('0x24'),NOW)['where'](_0xb964('0x25'),squel[_0xb964('0xd')]()['field']('phone')[_0xb964('0xf')](_0xb964('0x2b'))[_0xb964('0x23')](_0xb964('0x30'),_0x39273e)[_0xb964('0x23')](_0x1626f2+_0xb964('0x31'),_0x21372b+'.'+_0x1626f2)))['toString']();}function insertCmContact(_0x5ee03e,_0x4acf69,_0x1bb8f8,_0x726d32){var _0x167561=_[_0xb964('0x32')](_[_0xb964('0x33')](_0x726d32),[_0xb964('0x2d'),'CompanyId','createdAt',_0xb964('0x1d')]);return squel[_0xb964('0x18')]()[_0xb964('0x19')](_0xb964('0x21'))[_0xb964('0x1b')](_0x167561,squel['select']()[_0xb964('0x2e')](_0x167561)[_0xb964('0xf')](_0x4acf69)[_0xb964('0x23')]('('+_0x1bb8f8[_0xb964('0x10')](',')+_0xb964('0x34'),squel[_0xb964('0xd')]()[_0xb964('0x2e')](_0x1bb8f8)['from'](_0xb964('0x21'))['where'](_0xb964('0x30'),_0x5ee03e)['where'](_0xb964('0x35')))[_0xb964('0x23')]('id\x20IN\x20?',squel['select']()[_0xb964('0x36')](_0xb964('0x37'),_0xb964('0x38'))[_0xb964('0xf')](_0x4acf69)[_0xb964('0x39')](_0x1bb8f8['join'](','))))[_0xb964('0x28')]();}function handleStop(){logger[_0xb964('0x3a')](_0xb964('0x3b'));stopped=!![];}function handleUncaughtException(_0x5e8208){logger[_0xb964('0x3c')](_0x5e8208[_0xb964('0x3d')]);process[_0xb964('0x3e')](0x1);}function handleError(_0x2fde31,_0x33cfd){stats['errors'][_0xb964('0x3f')]({'name':_0x33cfd[_0xb964('0x40')],'message':_0x33cfd['message'],'row':_0x2fde31});}function handleQuery(_0x3c9bbc){logger[_0xb964('0x3a')](_0x3c9bbc);return db[_0xb964('0x41')][_0xb964('0x42')](_0x3c9bbc)['spread'](function(_0x4a0d65){results[_0xb964('0x3f')](_0x4a0d65);})[_0xb964('0x43')](function(_0x1b77c7){logger[_0xb964('0x3c')](_0x1b77c7[_0xb964('0x3d')]);});}function main(_0x176c92,_0x218562,_0x19687e,_0x4ab2fc){logger[_0xb964('0x3a')]('main',_0x176c92,JSON[_0xb964('0x44')](_0x218562));process[_0xb964('0x45')](_0xb964('0x46'));var _0x493fdf=_0x218562[_0xb964('0x47')];var _0x1a0b81=_0x218562[_0xb964('0x48')];var _0x372ce3=path[_0xb964('0x10')](config[_0xb964('0x49')],_0xb964('0x4a'),_0x1a0b81+_0xb964('0x4b'));var _0x1b1709=_['keys'](_0x493fdf)['join']();logger['info'](_0xb964('0x4c'),_0x1b1709);fs[_0xb964('0x4d')](_0x372ce3,_0x1b1709+'\x0a');Papa['parse'](fs[_0xb964('0x4e')](_0x176c92),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2b9ec9,_0x516228){try{for(var _0x58f7d1=0x0,_0x343942=[];_0x58f7d1<_0x2b9ec9[_0xb964('0x4f')][_0xb964('0x50')];_0x58f7d1++){stats[_0xb964('0x51')]+=0x1;if(_0x2b9ec9['errors'][_0x58f7d1]){handleError(_0x2b9ec9[_0xb964('0x4f')][_0x58f7d1],_0x2b9ec9['errors'][_0x58f7d1]);}else{var _0x2cbbed=[];for(var _0x29bf54 in _0x493fdf){if(_0x493fdf[_0xb964('0x52')](_0x29bf54)){if(_0x2b9ec9[_0xb964('0x4f')][_0x58f7d1][_0x493fdf[_0x29bf54]]){var _0x2d333c=_[_0xb964('0x53')](_0x2b9ec9[_0xb964('0x4f')][_0x58f7d1][_0x493fdf[_0x29bf54]][_0xb964('0x54')](/"/g,'\x27'));switch(_0x29bf54){case'scheduledat':var _0x2d74b7=moment(_0x2d333c,_0xb964('0xc'),!![]);if(_0x2d74b7[_0xb964('0x55')]()){_0x343942[_0xb964('0x3f')]('\x22'+_0x2d333c+'\x22');}else{_0x2cbbed['push'](_0xb964('0x56'));}break;case _0xb964('0x1e'):var _0x1759bc=parseInt(_0x2d333c);_0x2d333c=_[_0xb964('0x57')](_0x1759bc)||_0x1759bc<0x0||_0x1759bc>0x4?_0x4ab2fc?0x3:0x2:_0x1759bc;_0x343942[_0xb964('0x3f')]('\x22'+_0x2d333c+'\x22');break;case _0xb964('0x1f'):var _0x24c199=parseInt(_0x2d333c);if(_[_0xb964('0x58')](_0x24c199)&&_[_0xb964('0x59')](_0x19687e,_0x24c199)){_0x343942[_0xb964('0x3f')]('\x22'+_0x24c199+'\x22');}else{_0x2cbbed[_0xb964('0x3f')](_0xb964('0x5a'));}break;case _0xb964('0x5b'):if(isEmail(_0x2d333c)){_0x343942[_0xb964('0x3f')]('\x22'+_0x2d333c+'\x22');}else{_0x2cbbed[_0xb964('0x3f')]('email\x20wrong\x20format');}break;case _0xb964('0x5c'):var _0x55929f=moment(_0x2d333c,_0xb964('0x5d'),!![]);if(_0x55929f[_0xb964('0x55')]()){_0x343942[_0xb964('0x3f')]('\x22'+_0x2d333c+'\x22');}else{_0x2cbbed[_0xb964('0x3f')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x343942[_0xb964('0x3f')]('\x22'+_0x2d333c+'\x22');}}else{switch(_0x29bf54){case _0xb964('0x5e'):case _0xb964('0xe'):_0x2cbbed[_0xb964('0x3f')](_0x29bf54+_0xb964('0x5f'));break;default:_0x343942['push']('\x22\x22');}}}}if(_0x2cbbed['length']){handleError(_0x2b9ec9[_0xb964('0x4f')][_0x58f7d1],{'code':'SystemRow','message':_0x2cbbed[_0xb964('0x10')]()});}else{fs[_0xb964('0x60')](_0x372ce3,_0x343942['join']()+'\x0a');}_0x343942=[];}if(!(stats[_0xb964('0x51')]%0xc8)){socket[_0xb964('0x61')]('contact:import:'+_0x1a0b81,stats);stats[_0xb964('0x62')]=[];}}if(stopped){logger[_0xb964('0x3a')]('Abort\x20parser');_0x516228[_0xb964('0x63')]();}}catch(_0x4e164e){handleError(_0x2b9ec9[_0xb964('0x4f')][_0x58f7d1],{'code':_0xb964('0x64'),'message':_0x4e164e[_0xb964('0x3d')]});logger[_0xb964('0x3c')](_0xb964('0x65'),_0x4e164e[_0xb964('0x3d')]);}},'complete':function(){try{var _0x206cb4=[];var _0x4db713=_0xb964('0x21');if(_0x218562['duplicates']&&_0x218562[_0xb964('0x66')]['length']){_0x4db713=_0xb964('0x67')+_0x1a0b81;_0x206cb4[_0xb964('0x3f')](_0xb964('0x68')+_0x4db713+_0xb964('0x69'));}var _0x378769=util[_0xb964('0x6a')]('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',_0x372ce3,_0x4db713,_0x1b1709,_0x218562[_0xb964('0x2d')],_0x218562[_0xb964('0x6b')]||null,NOW,NOW);if(_['isNil'](_0x493fdf[_0xb964('0x6c')])){_0x378769+=_0xb964('0x6d');}_0x206cb4['push'](_0x378769);if(_0x218562[_0xb964('0x66')]&&_0x218562[_0xb964('0x66')][_0xb964('0x50')]){_0x206cb4['push'](insertCmContact(_0x218562[_0xb964('0x2d')],_0x4db713,_0x218562[_0xb964('0x66')],_0x493fdf));_0x206cb4[_0xb964('0x3f')](_0xb964('0x6e')+_0x4db713+';');}_0x206cb4[_0xb964('0x3f')](insertCmHopper(_0x218562[_0xb964('0x2d')],_0xb964('0x6f'),_0xb964('0x70'),_0xb964('0x71'),_0x4ab2fc));_0x206cb4['push'](insertCmHopperBlack(_0x218562[_0xb964('0x2d')],'voice_queues_has_cm_blacklists','voice_queues',_0xb964('0x71')));_0x206cb4['push'](insertCmHopper(_0x218562[_0xb964('0x2d')],_0xb964('0x72'),_0xb964('0x73'),'CampaignId',_0x4ab2fc));_0x206cb4[_0xb964('0x3f')](insertCmHopperBlack(_0x218562[_0xb964('0x2d')],'campaigns_has_cm_blacklists',_0xb964('0x73'),_0xb964('0x74')));BPromise[_0xb964('0x75')](_0x206cb4,handleQuery)['then'](function(_0x316042){stats['finish']=!![];stats[_0xb964('0x76')]=_0x218562['duplicates']&&_0x218562[_0xb964('0x66')][_0xb964('0x50')]?results[0x2][_0xb964('0x76')]:results[0x0][_0xb964('0x76')];socket['emit'](_0xb964('0x77')+_0x1a0b81,stats);fs['unlink'](_0x176c92);fs[_0xb964('0x78')](_0x372ce3);process[_0xb964('0x3e')](0x0);})[_0xb964('0x43')](function(_0xa5a8cb){logger['error'](_0xa5a8cb[_0xb964('0x3d')]);process[_0xb964('0x3e')](0x1);});}catch(_0x15b0c0){logger[_0xb964('0x3c')](_0xb964('0x79'),_0x15b0c0[_0xb964('0x3d')]);process[_0xb964('0x3e')](0x1);}},'error':function(_0x302351,_0x1fdcbd,_0x112e5e,_0x4a38aa){throw new Error(_0x4a38aa);}});}function validate(){if(process[_0xb964('0x7a')]&&process[_0xb964('0x7a')][_0xb964('0x50')]<0x4){throw new Error(_0xb964('0x7b'));}var _0x289901=path[_0xb964('0x10')](config[_0xb964('0x49')],_0xb964('0x4a'),process[_0xb964('0x7a')][0x2]);if(!fs[_0xb964('0x7c')](_0x289901)){throw new Error(_0xb964('0x7d'));}var _0x4c754e={};try{_0x4c754e=JSON['parse'](process[_0xb964('0x7a')][0x3]);if(!_0x4c754e[_0xb964('0x47')]){throw new Error(_0xb964('0x7e'));}if(!_0x4c754e['binding'][_0xb964('0xe')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x4c754e[_0xb964('0x47')]['firstName']){throw new Error(_0xb964('0x7f'));}var _0x206fc8=0x0;if(_0x4c754e[_0xb964('0x47')][_0xb964('0x1f')]){_0x206fc8=0x1;}if(!_0x4c754e[_0xb964('0x2d')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x191b3f){throw new Error('body\x20id\x20mandatory');}var _0x4e8dae=[];try{_0x4e8dae=_[_0xb964('0x80')](JSON['parse'](process[_0xb964('0x7a')][0x4]),'id');}catch(_0x564ad0){logger[_0xb964('0x3a')](_0xb964('0x81'));}main(_0x289901,_0x4c754e,_0x4e8dae,_0x206fc8);}validate();process['on'](_0xb964('0x82'),handleStop);process['on'](_0xb964('0x83'),handleUncaughtException); \ No newline at end of file +var _0x43db=['info','Received\x20SIGINT','error','message','exit','errors','push','code','query','spread','catch','main','start','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','length','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','campaigns','each','then','affectedRows','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','fromQuery','scheduledat','ContactId','ListId','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(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','createdAt','updatedAt','.id\x20=\x20','concat','keys','CompanyId','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group'];(function(_0x488103,_0x22afd7){var _0x3758c3=function(_0x5328e9){while(--_0x5328e9){_0x488103['push'](_0x488103['shift']());}};_0x3758c3(++_0x22afd7);}(_0x43db,0xd5));var _0xb43d=function(_0x50e0c5,_0x49351f){_0x50e0c5=_0x50e0c5-0x0;var _0x11d623=_0x43db[_0x50e0c5];return _0x11d623;};'use strict';var fs=require('fs');var path=require(_0xb43d('0x0'));var _=require(_0xb43d('0x1'));var Papa=require(_0xb43d('0x2'));var util=require(_0xb43d('0x3'));var BPromise=require(_0xb43d('0x4'));var moment=require(_0xb43d('0x5'));var squel=require('squel');var Redis=require(_0xb43d('0x6'));var db=require(_0xb43d('0x7'))['db'];var config=require(_0xb43d('0x8'));var logger=require(_0xb43d('0x9'))('import');config['redis']=_[_0xb43d('0xa')](config[_0xb43d('0xb')],{'host':_0xb43d('0xc'),'port':0x18eb});var socket=require(_0xb43d('0xd'))(new Redis(config[_0xb43d('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xb43d('0xe')](_0xb43d('0xf'));function isEmail(_0x1d4c55){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))*$/[_0xb43d('0x10')](_0x1d4c55);}function selectNotIn(_0x41015c,_0x1acc8a,_0x4b5a4b,_0x579893,_0x303435){return squel[_0xb43d('0x11')]()[_0xb43d('0x12')](_0xb43d('0x13'))[_0xb43d('0x14')](_0x579893)[_0xb43d('0x15')](_0x1acc8a,null,_0x1acc8a+'.id\x20=\x20'+_0x579893+'.'+_0x4b5a4b)[_0xb43d('0x16')](_0x579893+'.'+_0x4b5a4b+_0xb43d('0x17')+_0x41015c+'.'+_0x4b5a4b)[_0xb43d('0x16')](_0x1acc8a+_0xb43d('0x18')+_0x303435[_0xb43d('0x15')]()+')');}function insertCmHopper(_0x59ce00,_0x187330,_0x2609a4,_0x1d6a84,_0x183322){var _0x7ab18b=[_0xb43d('0x19'),_0xb43d('0x1a'),_0xb43d('0x1b'),_0xb43d('0x1c'),_0x187330+'.'+_0x1d6a84,_0xb43d('0x1d'),_0xb43d('0x1e'),_0xb43d('0x1f'),'cm_contacts.UserId','\x22'+_0x183322+'\x22'];return squel[_0xb43d('0x20')]()[_0xb43d('0x21')]('cm_hopper')[_0xb43d('0x22')]([_0xb43d('0x13'),_0xb43d('0x23'),_0xb43d('0x24'),_0xb43d('0x25'),_0x1d6a84,'createdAt','updatedAt','priority',_0xb43d('0x26'),_0xb43d('0x27')],squel[_0xb43d('0x11')]()[_0xb43d('0x28')](_0x7ab18b)[_0xb43d('0x14')](_0x187330)[_0xb43d('0x15')](_0xb43d('0x29'),null,_0xb43d('0x2a')+_0x187330+_0xb43d('0x2b'))[_0xb43d('0x15')](_0x2609a4,null,_0x2609a4+'.id\x20=\x20'+_0x187330+'.'+_0x1d6a84)[_0xb43d('0x16')](_0x187330+_0xb43d('0x2c'),_0x59ce00)[_0xb43d('0x16')](_0xb43d('0x2d'),NOW)['where'](_0xb43d('0x2e'),selectNotIn(_0x187330,_0x2609a4,_0x1d6a84,_0xb43d('0x2f'),[_0xb43d('0x30'),_0xb43d('0x31')]))[_0xb43d('0x16')](_0xb43d('0x2e'),selectNotIn(_0x187330,_0x2609a4,_0x1d6a84,_0xb43d('0x2f'),[_0xb43d('0x30')])))[_0xb43d('0x32')]();}function insertCmHopperBlack(_0x58201d,_0x1e2185,_0x395b47,_0x117c80){var _0x15a72e=[_0xb43d('0x19'),_0xb43d('0x1b'),'cm_contacts.ListId',_0x1e2185+'.'+_0x117c80,_0xb43d('0x1d'),_0xb43d('0x1e')];return squel[_0xb43d('0x20')]()['into'](_0xb43d('0x33'))['fromQuery']([_0xb43d('0x13'),_0xb43d('0x24'),'ListId',_0x117c80,_0xb43d('0x34'),_0xb43d('0x35')],squel['select']()['fields'](_0x15a72e)[_0xb43d('0x14')](_0x1e2185)[_0xb43d('0x15')](_0xb43d('0x29'),null,_0xb43d('0x2a')+_0x1e2185+'.CmListId')[_0xb43d('0x15')](_0x395b47,null,_0x395b47+_0xb43d('0x36')+_0x1e2185+'.'+_0x117c80)['where'](_0x1e2185+_0xb43d('0x2c'),_0x58201d)[_0xb43d('0x16')](_0xb43d('0x2d'),NOW)[_0xb43d('0x16')](_0xb43d('0x2e'),squel[_0xb43d('0x11')]()[_0xb43d('0x12')](_0xb43d('0x13'))[_0xb43d('0x14')]('cm_hopper_black')[_0xb43d('0x16')]('ListId\x20=\x20?',_0x58201d)[_0xb43d('0x16')](_0x117c80+'\x20=\x20?',_0x1e2185+'.'+_0x117c80)))[_0xb43d('0x32')]();}function insertCmContact(_0x16a204,_0x54648e,_0xdf42b4,_0x461db5){var _0x536b28=_[_0xb43d('0x37')](_[_0xb43d('0x38')](_0x461db5),[_0xb43d('0x25'),_0xb43d('0x39'),_0xb43d('0x34'),'updatedAt']);return squel[_0xb43d('0x20')]()[_0xb43d('0x21')]('cm_contacts')[_0xb43d('0x22')](_0x536b28,squel[_0xb43d('0x11')]()[_0xb43d('0x28')](_0x536b28)[_0xb43d('0x14')](_0x54648e)[_0xb43d('0x16')]('('+_0xdf42b4['join'](',')+')\x20NOT\x20IN\x20?',squel['select']()['fields'](_0xdf42b4)[_0xb43d('0x14')](_0xb43d('0x29'))[_0xb43d('0x16')](_0xb43d('0x3a'),_0x16a204)['where'](_0xb43d('0x3b')))[_0xb43d('0x16')](_0xb43d('0x3c'),squel[_0xb43d('0x11')]()['field']('MIN(id)',_0xb43d('0x3d'))[_0xb43d('0x14')](_0x54648e)[_0xb43d('0x3e')](_0xdf42b4[_0xb43d('0x15')](','))))[_0xb43d('0x32')]();}function handleStop(){logger[_0xb43d('0x3f')](_0xb43d('0x40'));stopped=!![];}function handleUncaughtException(_0x5797fb){logger[_0xb43d('0x41')](_0x5797fb[_0xb43d('0x42')]);process[_0xb43d('0x43')](0x1);}function handleError(_0x5dea1b,_0x335690){stats[_0xb43d('0x44')][_0xb43d('0x45')]({'name':_0x335690[_0xb43d('0x46')],'message':_0x335690[_0xb43d('0x42')],'row':_0x5dea1b});}function handleQuery(_0x11b527){logger['info'](_0x11b527);return db['sequelize'][_0xb43d('0x47')](_0x11b527)[_0xb43d('0x48')](function(_0x52192c){results[_0xb43d('0x45')](_0x52192c);})[_0xb43d('0x49')](function(_0x4b54fe){logger['error'](_0x4b54fe['message']);});}function main(_0x262ef8,_0x5e0242,_0x1f15ee,_0x4bd0c9){logger[_0xb43d('0x3f')](_0xb43d('0x4a'),_0x262ef8,JSON['stringify'](_0x5e0242));process['send'](_0xb43d('0x4b'));var _0x19b98c=_0x5e0242['binding'];var _0x2bfca0=_0x5e0242[_0xb43d('0x4c')];var _0x115f30=path[_0xb43d('0x15')](config[_0xb43d('0x4d')],_0xb43d('0x4e'),_0x2bfca0+_0xb43d('0x4f'));var _0x12406f=_[_0xb43d('0x38')](_0x19b98c)[_0xb43d('0x15')]();logger[_0xb43d('0x3f')](_0xb43d('0x50'),_0x12406f);fs[_0xb43d('0x51')](_0x115f30,_0x12406f+'\x0a');Papa[_0xb43d('0x52')](fs[_0xb43d('0x53')](_0x262ef8),{'header':!![],'skipEmptyLines':!![],'step':function(_0xbfc113,_0x2bb375){try{for(var _0x376d92=0x0,_0x56ee40=[];_0x376d92<_0xbfc113[_0xb43d('0x54')]['length'];_0x376d92++){stats[_0xb43d('0x55')]+=0x1;if(_0xbfc113[_0xb43d('0x44')][_0x376d92]){handleError(_0xbfc113[_0xb43d('0x54')][_0x376d92],_0xbfc113[_0xb43d('0x44')][_0x376d92]);}else{var _0x338c96=[];for(var _0x43a622 in _0x19b98c){if(_0x19b98c[_0xb43d('0x56')](_0x43a622)){if(_0xbfc113['data'][_0x376d92][_0x19b98c[_0x43a622]]){var _0xf9c89a=_[_0xb43d('0x57')](_0xbfc113['data'][_0x376d92][_0x19b98c[_0x43a622]][_0xb43d('0x58')](/"/g,'\x27'));switch(_0x43a622){case _0xb43d('0x23'):var _0x3e3084=moment(_0xf9c89a,_0xb43d('0xf'),!![]);if(_0x3e3084['isValid']()){_0x56ee40['push']('\x22'+_0xf9c89a+'\x22');}else{_0x338c96[_0xb43d('0x45')](_0xb43d('0x59'));}break;case _0xb43d('0x5a'):var _0x4a9bdb=parseInt(_0xf9c89a);_0xf9c89a=_[_0xb43d('0x5b')](_0x4a9bdb)||_0x4a9bdb<0x0||_0x4a9bdb>0x4?_0x4bd0c9?0x3:0x2:_0x4a9bdb;_0x56ee40[_0xb43d('0x45')]('\x22'+_0xf9c89a+'\x22');break;case _0xb43d('0x26'):var _0x48296d=parseInt(_0xf9c89a);if(_['isNumber'](_0x48296d)&&_[_0xb43d('0x5c')](_0x1f15ee,_0x48296d)){_0x56ee40[_0xb43d('0x45')]('\x22'+_0x48296d+'\x22');}else{_0x338c96[_0xb43d('0x45')](_0xb43d('0x5d'));}break;case'email':if(isEmail(_0xf9c89a)){_0x56ee40[_0xb43d('0x45')]('\x22'+_0xf9c89a+'\x22');}else{_0x338c96[_0xb43d('0x45')](_0xb43d('0x5e'));}break;case _0xb43d('0x5f'):var _0xbfa30e=moment(_0xf9c89a,'YYYY-MM-DD',!![]);if(_0xbfa30e[_0xb43d('0x60')]()){_0x56ee40[_0xb43d('0x45')]('\x22'+_0xf9c89a+'\x22');}else{_0x338c96[_0xb43d('0x45')](_0xb43d('0x61'));}break;default:_0x56ee40['push']('\x22'+_0xf9c89a+'\x22');}}else{switch(_0x43a622){case'firstName':case'phone':_0x338c96[_0xb43d('0x45')](_0x43a622+_0xb43d('0x62'));break;default:_0x56ee40['push']('\x22\x22');}}}}if(_0x338c96[_0xb43d('0x63')]){handleError(_0xbfc113[_0xb43d('0x54')][_0x376d92],{'code':_0xb43d('0x64'),'message':_0x338c96[_0xb43d('0x15')]()});}else{fs[_0xb43d('0x65')](_0x115f30,_0x56ee40['join']()+'\x0a');}_0x56ee40=[];}if(!(stats['rows']%0xc8)){socket[_0xb43d('0x66')](_0xb43d('0x67')+_0x2bfca0,stats);stats[_0xb43d('0x44')]=[];}}if(stopped){logger[_0xb43d('0x3f')](_0xb43d('0x68'));_0x2bb375[_0xb43d('0x69')]();}}catch(_0x312e25){handleError(_0xbfc113[_0xb43d('0x54')][_0x376d92],{'code':_0xb43d('0x6a'),'message':_0x312e25[_0xb43d('0x42')]});logger['error'](_0xb43d('0x6b'),_0x312e25[_0xb43d('0x42')]);}},'complete':function(){try{var _0x3f4a9d=[];var _0x25eb1b=_0xb43d('0x29');if(_0x5e0242[_0xb43d('0x6c')]&&_0x5e0242[_0xb43d('0x6c')][_0xb43d('0x63')]){_0x25eb1b='cm_contacts_'+_0x2bfca0;_0x3f4a9d[_0xb43d('0x45')](_0xb43d('0x6d')+_0x25eb1b+_0xb43d('0x6e'));}var _0x47ba46=util[_0xb43d('0xe')](_0xb43d('0x6f'),_0x115f30,_0x25eb1b,_0x12406f,_0x5e0242['ListId'],_0x5e0242[_0xb43d('0x39')]||null,NOW,NOW);if(_['isNil'](_0x19b98c[_0xb43d('0x23')])){_0x47ba46+=_0xb43d('0x70');}_0x3f4a9d[_0xb43d('0x45')](_0x47ba46);if(_0x5e0242[_0xb43d('0x6c')]&&_0x5e0242[_0xb43d('0x6c')]['length']){_0x3f4a9d['push'](insertCmContact(_0x5e0242[_0xb43d('0x25')],_0x25eb1b,_0x5e0242[_0xb43d('0x6c')],_0x19b98c));_0x3f4a9d[_0xb43d('0x45')](_0xb43d('0x71')+_0x25eb1b+';');}_0x3f4a9d[_0xb43d('0x45')](insertCmHopper(_0x5e0242[_0xb43d('0x25')],_0xb43d('0x72'),'voice_queues',_0xb43d('0x73'),_0x4bd0c9));_0x3f4a9d[_0xb43d('0x45')](insertCmHopperBlack(_0x5e0242[_0xb43d('0x25')],_0xb43d('0x74'),_0xb43d('0x75'),_0xb43d('0x73')));_0x3f4a9d[_0xb43d('0x45')](insertCmHopper(_0x5e0242[_0xb43d('0x25')],_0xb43d('0x76'),'campaigns',_0xb43d('0x77'),_0x4bd0c9));_0x3f4a9d['push'](insertCmHopperBlack(_0x5e0242[_0xb43d('0x25')],_0xb43d('0x78'),_0xb43d('0x79'),'CampaignId'));BPromise[_0xb43d('0x7a')](_0x3f4a9d,handleQuery)[_0xb43d('0x7b')](function(_0x378edc){stats['finish']=!![];stats[_0xb43d('0x7c')]=_0x5e0242[_0xb43d('0x6c')]&&_0x5e0242['duplicates']['length']?results[0x2]['affectedRows']:results[0x0]['affectedRows'];socket[_0xb43d('0x66')](_0xb43d('0x67')+_0x2bfca0,stats);fs[_0xb43d('0x7d')](_0x262ef8);fs[_0xb43d('0x7d')](_0x115f30);process[_0xb43d('0x43')](0x0);})[_0xb43d('0x49')](function(_0x3fa1d3){logger[_0xb43d('0x41')](_0x3fa1d3[_0xb43d('0x42')]);process[_0xb43d('0x43')](0x1);});}catch(_0x1e821d){logger[_0xb43d('0x41')](_0xb43d('0x7e'),_0x1e821d[_0xb43d('0x42')]);process['exit'](0x1);}},'error':function(_0x2e98b7,_0x23a2af,_0x22cc82,_0x28271b){throw new Error(_0x28271b);}});}function validate(){if(process[_0xb43d('0x7f')]&&process[_0xb43d('0x7f')][_0xb43d('0x63')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x2103d8=path[_0xb43d('0x15')](config[_0xb43d('0x4d')],_0xb43d('0x4e'),process[_0xb43d('0x7f')][0x2]);if(!fs[_0xb43d('0x80')](_0x2103d8)){throw new Error(_0xb43d('0x81'));}var _0x4bca58={};try{_0x4bca58=JSON['parse'](process['argv'][0x3]);if(!_0x4bca58[_0xb43d('0x82')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x4bca58[_0xb43d('0x82')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x4bca58[_0xb43d('0x82')]['firstName']){throw new Error(_0xb43d('0x83'));}var _0x4ccce7=0x0;if(_0x4bca58[_0xb43d('0x82')]['UserId']){_0x4ccce7=0x1;}if(!_0x4bca58[_0xb43d('0x25')]){throw new Error(_0xb43d('0x84'));}}catch(_0x2e4118){throw new Error(_0xb43d('0x85'));}var _0x2b90aa=[];try{_0x2b90aa=_[_0xb43d('0x86')](JSON[_0xb43d('0x52')](process[_0xb43d('0x7f')][0x4]),'id');}catch(_0x43022c){logger['info'](_0xb43d('0x87'));}main(_0x2103d8,_0x4bca58,_0x2b90aa,_0x4ccce7);}validate();process['on'](_0xb43d('0x88'),handleStop);process['on'](_0xb43d('0x89'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 16c15b2..f5fe5c3 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9104=['Queue','UniqueId','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','Member\x20Name','membername','uniqueid','starttime','***\x20Time\x20Info\x20***','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','toLowerCase','inbound','variable','queue','push','calleridnum','outbound','string','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten'];(function(_0x9da7b0,_0x2f4aeb){var _0xf05f94=function(_0x42a13e){while(--_0x42a13e){_0x9da7b0['push'](_0x9da7b0['shift']());}};_0xf05f94(++_0x2f4aeb);}(_0x9104,0x99));var _0x4910=function(_0x40cb83,_0x57022c){_0x40cb83=_0x40cb83-0x0;var _0x4f3e88=_0x9104[_0x40cb83];return _0x4f3e88;};'use strict';exports[_0x4910('0x0')]=function(_0x552e68,_0x58b66a){var _0x3ec725=[{'type':'string','content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x552e68['toLowerCase']()){case'voice':switch(_0x58b66a[_0x4910('0x1')]()){case _0x4910('0x2'):_0x3ec725['push']({'type':_0x4910('0x3'),'content':'','variableName':_0x4910('0x4')});_0x3ec725[_0x4910('0x5')]({'type':_0x4910('0x3'),'content':'','variableName':_0x4910('0x6')});break;case _0x4910('0x7'):_0x3ec725['push']({'type':_0x4910('0x8'),'content':_0x4910('0x9'),'variableName':null});_0x3ec725[_0x4910('0x5')]({'type':_0x4910('0x3'),'content':'','variableName':_0x4910('0xa')});break;}}return _0x3ec725;};exports[_0x4910('0xb')]=function(_0x3cf768,_0x3fe10c){var _0xc6b721=[];switch(_0x3cf768[_0x4910('0x1')]()){case'voice':switch(_0x3fe10c[_0x4910('0x1')]()){case _0x4910('0x2'):_0xc6b721=[{'type':'string','content':_0x4910('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x4910('0xd'),'content':'','key':_0x4910('0xe'),'keyType':_0x4910('0x3'),'variableName':_0x4910('0x6')},{'type':_0x4910('0xd'),'content':'','key':_0x4910('0xf'),'keyType':'variable','variableName':_0x4910('0x10')},{'type':'keyValue','content':'','key':_0x4910('0x11'),'keyType':'variable','variableName':_0x4910('0x12')},{'type':_0x4910('0xd'),'content':'','key':_0x4910('0x13'),'keyType':_0x4910('0x3'),'variableName':_0x4910('0x4')},{'type':_0x4910('0xd'),'content':'','key':_0x4910('0x14'),'keyType':_0x4910('0x3'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':'Date','keyType':_0x4910('0x3'),'variableName':_0x4910('0x15')},{'type':_0x4910('0x8'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x4910('0x16'),'keyType':_0x4910('0x3'),'variableName':_0x4910('0x17')},{'type':_0x4910('0xd'),'content':'','key':_0x4910('0x18'),'keyType':_0x4910('0x3'),'variableName':_0x4910('0xa')},{'type':'string','content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x4910('0xd'),'content':'','key':_0x4910('0x19'),'keyType':_0x4910('0x3'),'variableName':'agentcalledAt'},{'type':_0x4910('0xd'),'content':'','key':_0x4910('0x1a'),'keyType':'variable','variableName':_0x4910('0x1b')},{'type':_0x4910('0xd'),'content':'','key':_0x4910('0x1c'),'keyType':_0x4910('0x3'),'variableName':_0x4910('0x1d')},{'type':_0x4910('0xd'),'content':'','key':'Hold\x20Time','keyType':_0x4910('0x3'),'variableName':_0x4910('0x1e')},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':_0x4910('0x3'),'variableName':'talktime'}];break;case _0x4910('0x7'):_0xc6b721=[{'type':_0x4910('0x8'),'content':_0x4910('0xc'),'variableName':null},{'type':_0x4910('0xd'),'content':'','key':'Called\x20Number','keyType':_0x4910('0x3'),'keyContent':'','variableName':_0x4910('0xa')},{'type':_0x4910('0xd'),'content':'','key':_0x4910('0x1f'),'keyType':_0x4910('0x3'),'keyContent':'','variableName':_0x4910('0x20')},{'type':'keyValue','content':'','key':_0x4910('0x14'),'keyType':'variable','keyContent':'','variableName':_0x4910('0x21')},{'type':_0x4910('0xd'),'content':'','key':'Date','keyType':_0x4910('0x3'),'keyContent':'','variableName':_0x4910('0x22')},{'type':_0x4910('0x8'),'content':_0x4910('0x23')},{'type':_0x4910('0xd'),'content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':_0x4910('0x24')},{'type':_0x4910('0xd'),'content':'','key':_0x4910('0x25'),'keyType':'variable','keyContent':'','variableName':_0x4910('0x26')},{'type':_0x4910('0xd'),'content':'','key':_0x4910('0x27'),'keyType':'variable','keyContent':'','variableName':_0x4910('0x28')},{'type':'keyValue','content':'','key':_0x4910('0x29'),'keyType':'variable','keyContent':'','variableName':_0x4910('0x2a')}];break;}}return _0xc6b721;}; \ No newline at end of file +var _0x53fb=['***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','Billable\x20Time','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','destexten','Queue','UniqueId','uniqueid','Date'];(function(_0x16b83e,_0x44e47e){var _0x4b48dd=function(_0x3e7d5f){while(--_0x3e7d5f){_0x16b83e['push'](_0x16b83e['shift']());}};_0x4b48dd(++_0x44e47e);}(_0x53fb,0xd3));var _0xb53f=function(_0x505abf,_0x2fa567){_0x505abf=_0x505abf-0x0;var _0x3d3dee=_0x53fb[_0x505abf];return _0x3d3dee;};'use strict';exports[_0xb53f('0x0')]=function(_0x4d01e7,_0x53f91e){var _0x394d3c=[{'type':_0xb53f('0x1'),'content':_0xb53f('0x2'),'variableName':null}];switch(_0x4d01e7[_0xb53f('0x3')]()){case _0xb53f('0x4'):switch(_0x53f91e[_0xb53f('0x3')]()){case _0xb53f('0x5'):_0x394d3c[_0xb53f('0x6')]({'type':_0xb53f('0x7'),'content':'','variableName':_0xb53f('0x8')});_0x394d3c[_0xb53f('0x6')]({'type':_0xb53f('0x7'),'content':'','variableName':_0xb53f('0x9')});break;case _0xb53f('0xa'):_0x394d3c[_0xb53f('0x6')]({'type':_0xb53f('0x1'),'content':_0xb53f('0xb'),'variableName':null});_0x394d3c[_0xb53f('0x6')]({'type':_0xb53f('0x7'),'content':'','variableName':_0xb53f('0xc')});break;}}return _0x394d3c;};exports[_0xb53f('0xd')]=function(_0x57299d,_0x5bb902){var _0x3d0499=[];switch(_0x57299d['toLowerCase']()){case _0xb53f('0x4'):switch(_0x5bb902[_0xb53f('0x3')]()){case'inbound':_0x3d0499=[{'type':'string','content':_0xb53f('0xe'),'key':null,'keyType':null,'variableName':null},{'type':_0xb53f('0xf'),'content':'','key':_0xb53f('0x10'),'keyType':_0xb53f('0x7'),'variableName':_0xb53f('0x9')},{'type':'keyValue','content':'','key':_0xb53f('0x11'),'keyType':_0xb53f('0x7'),'variableName':_0xb53f('0x12')},{'type':_0xb53f('0xf'),'content':'','key':'Call\x20To','keyType':_0xb53f('0x7'),'variableName':_0xb53f('0x13')},{'type':_0xb53f('0xf'),'content':'','key':_0xb53f('0x14'),'keyType':_0xb53f('0x7'),'variableName':'queue'},{'type':_0xb53f('0xf'),'content':'','key':_0xb53f('0x15'),'keyType':'variable','variableName':_0xb53f('0x16')},{'type':_0xb53f('0xf'),'content':'','key':_0xb53f('0x17'),'keyType':_0xb53f('0x7'),'variableName':'agentcalledAt'},{'type':'string','content':_0xb53f('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xb53f('0xf'),'content':'','key':_0xb53f('0x19'),'keyType':_0xb53f('0x7'),'variableName':_0xb53f('0x1a')},{'type':_0xb53f('0xf'),'content':'','key':_0xb53f('0x1b'),'keyType':_0xb53f('0x7'),'variableName':'destcalleridnum'},{'type':_0xb53f('0x1'),'content':_0xb53f('0x1c'),'key':null,'keyType':null,'variableName':null},{'type':_0xb53f('0xf'),'content':'','key':_0xb53f('0x1d'),'keyType':_0xb53f('0x7'),'variableName':'agentcalledAt'},{'type':_0xb53f('0xf'),'content':'','key':_0xb53f('0x1e'),'keyType':_0xb53f('0x7'),'variableName':_0xb53f('0x1f')},{'type':_0xb53f('0xf'),'content':'','key':_0xb53f('0x20'),'keyType':_0xb53f('0x7'),'variableName':_0xb53f('0x21')},{'type':_0xb53f('0xf'),'content':'','key':_0xb53f('0x22'),'keyType':_0xb53f('0x7'),'variableName':_0xb53f('0x23')},{'type':_0xb53f('0xf'),'content':'','key':_0xb53f('0x24'),'keyType':_0xb53f('0x7'),'variableName':'talktime'}];break;case _0xb53f('0xa'):_0x3d0499=[{'type':_0xb53f('0x1'),'content':_0xb53f('0xe'),'variableName':null},{'type':_0xb53f('0xf'),'content':'','key':_0xb53f('0x25'),'keyType':_0xb53f('0x7'),'keyContent':'','variableName':_0xb53f('0xc')},{'type':_0xb53f('0xf'),'content':'','key':_0xb53f('0x26'),'keyType':'variable','keyContent':'','variableName':_0xb53f('0x27')},{'type':_0xb53f('0xf'),'content':'','key':_0xb53f('0x15'),'keyType':'variable','keyContent':'','variableName':_0xb53f('0x16')},{'type':_0xb53f('0xf'),'content':'','key':_0xb53f('0x17'),'keyType':_0xb53f('0x7'),'keyContent':'','variableName':_0xb53f('0x28')},{'type':'string','content':_0xb53f('0x1c')},{'type':_0xb53f('0xf'),'content':'','key':_0xb53f('0x29'),'keyType':'variable','keyContent':'','variableName':_0xb53f('0x2a')},{'type':_0xb53f('0xf'),'content':'','key':_0xb53f('0x2b'),'keyType':_0xb53f('0x7'),'keyContent':'','variableName':_0xb53f('0x2c')},{'type':_0xb53f('0xf'),'content':'','key':_0xb53f('0x2d'),'keyType':_0xb53f('0x7'),'keyContent':'','variableName':'duration'},{'type':_0xb53f('0xf'),'content':'','key':_0xb53f('0x2e'),'keyType':_0xb53f('0x7'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x3d0499;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index f8a1f5d..69b9dcd 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95d8=['lodash','../../config/logger','fax-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info','error','query','clone','body','omit','html','phone'];(function(_0x1d5827,_0x2d2e14){var _0x5ea463=function(_0x509c4f){while(--_0x509c4f){_0x1d5827['push'](_0x1d5827['shift']());}};_0x5ea463(++_0x2d2e14);}(_0x95d8,0x11e));var _0x895d=function(_0x307f70,_0x500678){_0x307f70=_0x307f70-0x0;var _0x1d1bf5=_0x95d8[_0x307f70];return _0x1d1bf5;};'use strict';var _=require(_0x895d('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x895d('0x1'))('openchannel-interactions'),'mail':require(_0x895d('0x1'))('mail-interactions'),'fax':require('../../config/logger')(_0x895d('0x2')),'sms':require(_0x895d('0x1'))('sms-interactions'),'chat':require(_0x895d('0x1'))(_0x895d('0x3')),'whatsapp':require(_0x895d('0x1'))(_0x895d('0x4'))};function getInteractionId(_0x30ed1d,_0x1c406f,_0x822630){if(_0x30ed1d&&_0x30ed1d[_[_0x895d('0x5')](_0x822630)+_0x895d('0x6')]){return _0x30ed1d[_[_0x895d('0x5')](_0x822630)+_0x895d('0x6')];}else if(_0x30ed1d&&_0x30ed1d['id']){return _0x30ed1d['id'];}else if(_0x1c406f&&_0x1c406f['id']){return _0x1c406f['id'];}else{return _0x895d('0x7');}}function log(_0x1a059a,_0x41bf85,_0x4288e2,_0x2ace78,_0x13742b,_0x270882){loggers[_0x13742b[_0x895d('0x8')]()][_0x1a059a]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x270882[_0x895d('0x9')](),_0x41bf85?_0x41bf85['id']:null,_0x41bf85?_0x41bf85[_0x895d('0xa')]:null,_0x41bf85?_0x41bf85[_0x895d('0xb')]:null,getInteractionId(_0x4288e2,_0x2ace78,_0x13742b),_0x4288e2?JSON[_0x895d('0xc')](_0x4288e2):_0x895d('0xd'));}function updateUser(_0x151ae9,_0x24cadd,_0x46325d,_0x4f1217,_0x4bec85){db[_[_0x895d('0x5')](_0x4f1217)+_0x895d('0xe')][_0x895d('0xf')]({'where':{'id':getInteractionId(_0x24cadd,_0x46325d,_0x4f1217)}})[_0x895d('0x10')](function(_0x37f913){if(_0x37f913){return _0x37f913[_0x895d('0x11')]({'UserId':_0x151ae9?_0x151ae9['id']:null});}})['then'](function(_0x57cc58){if(_0x57cc58){log(_0x895d('0x12'),_0x151ae9,_0x24cadd,_0x46325d,_0x4f1217,_0x4bec85);}})['catch'](function(){log(_0x895d('0x13'),_0x151ae9,_0x24cadd,_0x46325d,_0x4f1217,_0x4bec85);});}exports['tracked']=function(_0x705b2,_0x5be5ed){return function(_0x2b9eb9,_0xad5ae2,_0x428fe9){var _0x14ec3c=_0x2b9eb9['user'];var _0x536bbb={};var _0x454f01=_0x2b9eb9[_0x895d('0x14')];if(_0x536bbb){_0x536bbb=_[_0x895d('0x15')](_0x2b9eb9[_0x895d('0x16')]);_0x536bbb=_[_0x895d('0x17')](_0x536bbb,[_0x895d('0x16'),_0x895d('0x18'),_0x895d('0x19'),'fax','mobile']);}updateUser(_0x14ec3c,_0x536bbb,_0x454f01,_0x705b2,_0x5be5ed);_0x428fe9(null);};}; \ No newline at end of file +var _0x2580=['whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','name','role','stringify','null','Interaction','findOne','then','update','info','catch','error','tracked','user','query','clone','body','html','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions'];(function(_0x399d6f,_0x5afd50){var _0x1f59e4=function(_0x5ef466){while(--_0x5ef466){_0x399d6f['push'](_0x399d6f['shift']());}};_0x1f59e4(++_0x5afd50);}(_0x2580,0x12e));var _0x0258=function(_0x5067f8,_0x2fcffc){_0x5067f8=_0x5067f8-0x0;var _0x3e568a=_0x2580[_0x5067f8];return _0x3e568a;};'use strict';var _=require(_0x0258('0x0'));var db=require(_0x0258('0x1'))['db'];var loggers={'openchannel':require(_0x0258('0x2'))(_0x0258('0x3')),'mail':require('../../config/logger')(_0x0258('0x4')),'fax':require(_0x0258('0x2'))(_0x0258('0x5')),'sms':require(_0x0258('0x2'))(_0x0258('0x6')),'chat':require(_0x0258('0x2'))(_0x0258('0x7')),'whatsapp':require('../../config/logger')(_0x0258('0x8'))};function getInteractionId(_0x3675ef,_0x4129a2,_0x3b7a13){if(_0x3675ef&&_0x3675ef[_[_0x0258('0x9')](_0x3b7a13)+'InteractionId']){return _0x3675ef[_[_0x0258('0x9')](_0x3b7a13)+_0x0258('0xa')];}else if(_0x3675ef&&_0x3675ef['id']){return _0x3675ef['id'];}else if(_0x4129a2&&_0x4129a2['id']){return _0x4129a2['id'];}else{return _0x0258('0xb');}}function log(_0x13a269,_0x474866,_0x82e6de,_0xa14390,_0x2ed8c4,_0x4a1841){loggers[_0x2ed8c4[_0x0258('0xc')]()][_0x13a269]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4a1841['toUpperCase'](),_0x474866?_0x474866['id']:null,_0x474866?_0x474866[_0x0258('0xd')]:null,_0x474866?_0x474866[_0x0258('0xe')]:null,getInteractionId(_0x82e6de,_0xa14390,_0x2ed8c4),_0x82e6de?JSON[_0x0258('0xf')](_0x82e6de):_0x0258('0x10'));}function updateUser(_0xb99009,_0x2711b5,_0xb6a9c5,_0x1c74c9,_0x1b49a7){db[_[_0x0258('0x9')](_0x1c74c9)+_0x0258('0x11')][_0x0258('0x12')]({'where':{'id':getInteractionId(_0x2711b5,_0xb6a9c5,_0x1c74c9)}})[_0x0258('0x13')](function(_0x20a24c){if(_0x20a24c){return _0x20a24c[_0x0258('0x14')]({'UserId':_0xb99009?_0xb99009['id']:null});}})['then'](function(_0x34e7f6){if(_0x34e7f6){log(_0x0258('0x15'),_0xb99009,_0x2711b5,_0xb6a9c5,_0x1c74c9,_0x1b49a7);}})[_0x0258('0x16')](function(){log(_0x0258('0x17'),_0xb99009,_0x2711b5,_0xb6a9c5,_0x1c74c9,_0x1b49a7);});}exports[_0x0258('0x18')]=function(_0x2aff81,_0x1d6883){return function(_0x274e6d,_0x2765b0,_0x73cbf4){var _0x277900=_0x274e6d[_0x0258('0x19')];var _0x304bff={};var _0x3a6b8c=_0x274e6d[_0x0258('0x1a')];if(_0x304bff){_0x304bff=_[_0x0258('0x1b')](_0x274e6d[_0x0258('0x1c')]);_0x304bff=_['omit'](_0x304bff,[_0x0258('0x1c'),_0x0258('0x1d'),'phone','fax',_0x0258('0x1e')]);}updateUser(_0x277900,_0x304bff,_0x3a6b8c,_0x2aff81,_0x1d6883);_0x73cbf4(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index b800384..b01a609 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 _0xd939=['catch','users','User','admin','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','utf8','final','parse','findOne','count','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached'];(function(_0x438c31,_0x19213e){var _0x2ca268=function(_0x2cc084){while(--_0x2cc084){_0x438c31['push'](_0x438c31['shift']());}};_0x2ca268(++_0x19213e);}(_0xd939,0xf0));var _0x9d93=function(_0x560448,_0x2c1082){_0x560448=_0x560448-0x0;var _0x550276=_0xd939[_0x560448];return _0x550276;};'use strict';var crypto=require(_0x9d93('0x0'));var util=require(_0x9d93('0x1'));var compose=require('composable-middleware');var db=require(_0x9d93('0x2'))['db'];var config=require(_0x9d93('0x3'));function getValueFromLicense(_0x2a0146,_0x3f2c4d){if(_0x2a0146&&_0x3f2c4d){if(_0x3f2c4d[_0x9d93('0x4')]&&_0x3f2c4d[_0x9d93('0x5')]){var _0x491159=_0x3f2c4d['data1'];var _0x4bbe7b=_0x3f2c4d[_0x9d93('0x5')];var _0x358a32=_0x491159[_0x9d93('0x6')]('-')[0x4];var _0x3091a0=_0x491159['split']('-')[0x0];var _0x5c92fd=crypto[_0x9d93('0x7')](_0x9d93('0x8'),util[_0x9d93('0x9')](_0x9d93('0xa'),_0x358a32,_0x491159,_0x3091a0));var _0x2af7dc=_0x5c92fd['update'](_0x4bbe7b,'base64',_0x9d93('0xb'));_0x2af7dc+=_0x5c92fd[_0x9d93('0xc')]('utf8');var _0x394974=JSON[_0x9d93('0xd')](_0x2af7dc);return _0x394974['hasOwnProperty'](_0x2a0146)?_0x394974[_0x2a0146]:null;}}return null;}function isLimit(_0x2a2e96,_0x1f49df,_0x286043,_0x340d96){var _0x45de75=_0x1f49df;return compose()['use'](function(_0x2854dd,_0x12a38b,_0x1294fe){return db['License'][_0x9d93('0xe')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x285371){var _0x31f30e=getValueFromLicense(_0x2a2e96,_0x285371);return _0x31f30e?_0x31f30e:_0x45de75;})['then'](function(_0x2e0ed5){_0x45de75=_0x2e0ed5;return _0x286043[_0x9d93('0xf')](_0x340d96);})[_0x9d93('0x10')](function(_0x9701db){if(_0x9701db>=_0x45de75){return _0x12a38b[_0x9d93('0x11')](0x193)[_0x9d93('0x12')]({'message':util[_0x9d93('0x9')](_0x9d93('0x13'),_0x2a2e96)});}_0x1294fe();})[_0x9d93('0x14')](function(_0x49ccce){_0x1294fe(_0x49ccce);});});}function isUserLimit(){return isLimit(_0x9d93('0x15'),0x1,db[_0x9d93('0x16')],{'where':{'$or':[{'role':_0x9d93('0x17')},{'role':_0x9d93('0x18')}]}});}exports[_0x9d93('0x19')]=isUserLimit; \ No newline at end of file +var _0x7849=['format','%s:%s:%s','update','utf8','final','hasOwnProperty','License','findOne','then','count','status','json','catch','users','admin','user','util','composable-middleware','../../mysqldb','data1','license','split','aes-256-ctr'];(function(_0x5c1390,_0x5dd225){var _0x3c218b=function(_0x4bdeca){while(--_0x4bdeca){_0x5c1390['push'](_0x5c1390['shift']());}};_0x3c218b(++_0x5dd225);}(_0x7849,0x1f3));var _0x9784=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7849[_0x14add3];return _0x4a174f;};'use strict';var crypto=require('crypto');var util=require(_0x9784('0x0'));var compose=require(_0x9784('0x1'));var db=require(_0x9784('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x1bc02e,_0x2d81aa){if(_0x1bc02e&&_0x2d81aa){if(_0x2d81aa[_0x9784('0x3')]&&_0x2d81aa[_0x9784('0x4')]){var _0x53042b=_0x2d81aa[_0x9784('0x3')];var _0x3fdba0=_0x2d81aa['license'];var _0x48691c=_0x53042b['split']('-')[0x4];var _0x4a9e79=_0x53042b[_0x9784('0x5')]('-')[0x0];var _0x57284b=crypto['createDecipher'](_0x9784('0x6'),util[_0x9784('0x7')](_0x9784('0x8'),_0x48691c,_0x53042b,_0x4a9e79));var _0x28886b=_0x57284b[_0x9784('0x9')](_0x3fdba0,'base64',_0x9784('0xa'));_0x28886b+=_0x57284b[_0x9784('0xb')](_0x9784('0xa'));var _0x17fd12=JSON['parse'](_0x28886b);return _0x17fd12[_0x9784('0xc')](_0x1bc02e)?_0x17fd12[_0x1bc02e]:null;}}return null;}function isLimit(_0x396ae8,_0x50d184,_0x3b9888,_0x2c7df8){var _0x2f73ef=_0x50d184;return compose()['use'](function(_0x54155e,_0x4b8161,_0x3895b6){return db[_0x9784('0xd')][_0x9784('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x9784('0xf')](function(_0x2d2094){var _0x59549f=getValueFromLicense(_0x396ae8,_0x2d2094);return _0x59549f?_0x59549f:_0x2f73ef;})[_0x9784('0xf')](function(_0x374bf3){_0x2f73ef=_0x374bf3;return _0x3b9888[_0x9784('0x10')](_0x2c7df8);})[_0x9784('0xf')](function(_0x19767d){if(_0x19767d>=_0x2f73ef){return _0x4b8161[_0x9784('0x11')](0x193)[_0x9784('0x12')]({'message':util[_0x9784('0x7')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x396ae8)});}_0x3895b6();})[_0x9784('0x13')](function(_0x3963f1){_0x3895b6(_0x3963f1);});});}function isUserLimit(){return isLimit(_0x9784('0x14'),0x1,db['User'],{'where':{'$or':[{'role':_0x9784('0x15')},{'role':_0x9784('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index fc98a30..25a3b9a 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 _0x50d7=['$gt','>\x20?','<=\x20?','$gte','>=\x20?','start','$endsWith','pop','utcOffset','hours','seconds','lodash','parseSearch','startsWith','[$or]','and','replace','split','slice','forEach','shift','filter','indexOf','map','conditions','push','DATE','operator','$between','value','$lte','add','format','castTo','text','CAST(','field','\x20AS\x20','includes','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','$eq','$substring','$startsWith','LIKE\x20?','$lt'];(function(_0x4f20ab,_0x857c0f){var _0x2ea2c0=function(_0x2801dd){while(--_0x2801dd){_0x4f20ab['push'](_0x4f20ab['shift']());}};_0x2ea2c0(++_0x857c0f);}(_0x50d7,0xcf));var _0x750d=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x50d7[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x750d('0x0'));var moment=require('moment');exports[_0x750d('0x1')]=function(_0x86194d){var _0x4da44e={'conditions':[]};_0x4da44e['sqlOperator']=_[_0x750d('0x2')](_0x86194d,_0x750d('0x3'))?'or':_0x750d('0x4');var _0x3650bd=_0x86194d[_0x750d('0x5')]('[$and]','')[_0x750d('0x5')](_0x750d('0x3'),'')[_0x750d('0x6')]('||');for(var _0x5d4771=0x0;_0x5d4771<_0x3650bd['length'];_0x5d4771++){var _0x436259=_0x3650bd[_0x5d4771]['split'](':=');var _0x5ebaec=_0x436259[0x0];var _0x581fe3=_0x436259[_0x750d('0x7')](0x1);_0x581fe3[_0x750d('0x8')](function(_0x318f65){var _0x8469ca=_0x318f65[_0x750d('0x6')]('[')[_0x750d('0x9')]();var _0x2c9e47=_0x318f65['match'](/\[(.*?)\]/g);_0x2c9e47[_0x750d('0x8')](function(_0x3f4e76){var _0x311c79=_0x3f4e76[_0x750d('0x6')]('[')[_0x750d('0xa')](function(_0x53cbed){return _0x53cbed[_0x750d('0xb')](']')>-0x1;})[_0x750d('0xc')](function(_0xdd1d2e){return _0xdd1d2e[_0x750d('0x6')](']')[0x0];})[0x0];_0x4da44e[_0x750d('0xd')][_0x750d('0xe')]({'field':_0x5ebaec,'operator':_0x8469ca,'value':_0x311c79});});});}return _0x4da44e;};exports['buildExpression']=function(_0x23dba8,_0x88144f,_0x3ec15b){var _0x114592={};if(_0x88144f===_0x750d('0xf')){if(_0x3ec15b[_0x750d('0x10')]==='$eq'){_0x3ec15b[_0x750d('0x10')]=_0x750d('0x11');_0x3ec15b[_0x750d('0x12')]+=','+_0x3ec15b['value'];}else if(_['includes'](['$gt',_0x750d('0x13')],_0x3ec15b['operator'])){_0x3ec15b[_0x750d('0x12')]=moment(_0x3ec15b[_0x750d('0x12')])[_0x750d('0x14')](0x1,'days')[_0x750d('0x15')]('YYYY-MM-DD');}}if(_0x3ec15b[_0x750d('0x16')]){_0x88144f=_0x3ec15b['castTo'];_0x114592[_0x750d('0x17')]=_0x750d('0x18')+_0x23dba8+'.'+_0x3ec15b[_0x750d('0x19')]+_0x750d('0x1a')+_0x3ec15b['castTo']+')\x20'+parseOperator(_0x3ec15b['operator']);}else{_0x114592[_0x750d('0x17')]=_0x23dba8+'.'+_0x3ec15b['field']+'\x20'+parseOperator(_0x3ec15b[_0x750d('0x10')]);}if(_[_0x750d('0x1b')](['$ne',_0x750d('0x1c')],_0x3ec15b[_0x750d('0x10')]))_0x114592[_0x750d('0x17')]='('+_0x114592[_0x750d('0x17')]+_0x750d('0x1d')+_0x23dba8+'.'+_0x3ec15b[_0x750d('0x19')]+'\x20IS\x20NULL)';_0x114592[_0x750d('0x12')]=parseValue(_0x88144f,_0x3ec15b['operator'],_0x3ec15b['value']);return _0x114592;};function parseOperator(_0x2704c3){var _0x514191;switch(_0x2704c3){case _0x750d('0x1e'):_0x514191=_0x750d('0x1f');break;case _0x750d('0x1c'):_0x514191=_0x750d('0x20');break;case _0x750d('0x21'):_0x514191='=\x20?';break;case'$ne':_0x514191='<>\x20?';break;case _0x750d('0x22'):case _0x750d('0x23'):case'$endsWith':_0x514191=_0x750d('0x24');break;case _0x750d('0x25'):_0x514191='<\x20?';break;case _0x750d('0x26'):_0x514191=_0x750d('0x27');break;case _0x750d('0x13'):_0x514191=_0x750d('0x28');break;case _0x750d('0x29'):_0x514191=_0x750d('0x2a');break;case _0x750d('0x11'):_0x514191='BETWEEN\x20?\x20AND\x20?';break;}return _0x514191;}function parseValue(_0x32c237,_0xa2fcf3,_0x48157f){var _0x504a10={'start':undefined,'end':undefined};switch(_0xa2fcf3){case _0x750d('0x1e'):case _0x750d('0x1c'):_0x504a10['start']=_0x48157f[_0x750d('0x6')](',');break;case _0x750d('0x22'):_0x504a10[_0x750d('0x2b')]='%'+_0x48157f+'%';break;case'$startsWith':_0x504a10[_0x750d('0x2b')]=_0x48157f+'%';break;case _0x750d('0x2c'):_0x504a10[_0x750d('0x2b')]='%'+_0x48157f;break;case _0x750d('0x11'):var _0x28b120=_0x48157f[_0x750d('0x6')](',');var _0x48157f=_0x28b120[_0x750d('0x9')]();var _0x3229ed=_0x28b120[_0x750d('0x2d')]();if(_0x32c237===_0x750d('0xf')){_0x48157f=moment(_0x48157f)[_0x750d('0x2e')](0x0,!![])[_0x750d('0x15')]();_0x3229ed=moment(_0x3229ed)[_0x750d('0x2e')](0x0,!![])[_0x750d('0x14')](0x17,_0x750d('0x2f'))[_0x750d('0x14')](0x3b,'minutes')[_0x750d('0x14')](0x3b,_0x750d('0x30'))['format']();}_0x504a10={'start':_0x48157f,'end':_0x3229ed};break;default:_0x504a10['start']=_0x48157f;break;}return _0x504a10;} \ No newline at end of file +var _0x4586=['[$and]','split','length','slice','shift','match','filter','conditions','push','buildExpression','operator','$eq','$between','value','includes','$lte','add','days','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','format','hours','minutes','seconds','lodash','parseSearch','sqlOperator','startsWith','[$or]','and','replace'];(function(_0x2aa860,_0x462e3c){var _0x24646c=function(_0x38c873){while(--_0x38c873){_0x2aa860['push'](_0x2aa860['shift']());}};_0x24646c(++_0x462e3c);}(_0x4586,0x18f));var _0x6458=function(_0x873d48,_0x3cf3c0){_0x873d48=_0x873d48-0x0;var _0x50c8ca=_0x4586[_0x873d48];return _0x50c8ca;};'use strict';var _=require(_0x6458('0x0'));var moment=require('moment');exports[_0x6458('0x1')]=function(_0x479d40){var _0x385297={'conditions':[]};_0x385297[_0x6458('0x2')]=_[_0x6458('0x3')](_0x479d40,_0x6458('0x4'))?'or':_0x6458('0x5');var _0x1bb81d=_0x479d40[_0x6458('0x6')](_0x6458('0x7'),'')['replace'](_0x6458('0x4'),'')[_0x6458('0x8')]('||');for(var _0x51fe0d=0x0;_0x51fe0d<_0x1bb81d[_0x6458('0x9')];_0x51fe0d++){var _0x3f4ca3=_0x1bb81d[_0x51fe0d]['split'](':=');var _0x5d8f82=_0x3f4ca3[0x0];var _0x39b9cd=_0x3f4ca3[_0x6458('0xa')](0x1);_0x39b9cd['forEach'](function(_0x205f85){var _0x59bf50=_0x205f85[_0x6458('0x8')]('[')[_0x6458('0xb')]();var _0x174072=_0x205f85[_0x6458('0xc')](/\[(.*?)\]/g);_0x174072['forEach'](function(_0x28481d){var _0x4d4879=_0x28481d[_0x6458('0x8')]('[')[_0x6458('0xd')](function(_0x1267cc){return _0x1267cc['indexOf'](']')>-0x1;})['map'](function(_0x461897){return _0x461897[_0x6458('0x8')](']')[0x0];})[0x0];_0x385297[_0x6458('0xe')][_0x6458('0xf')]({'field':_0x5d8f82,'operator':_0x59bf50,'value':_0x4d4879});});});}return _0x385297;};exports[_0x6458('0x10')]=function(_0x16d1ae,_0x58b56a,_0x106048){var _0x2a22e7={};if(_0x58b56a==='DATE'){if(_0x106048[_0x6458('0x11')]===_0x6458('0x12')){_0x106048[_0x6458('0x11')]=_0x6458('0x13');_0x106048[_0x6458('0x14')]+=','+_0x106048[_0x6458('0x14')];}else if(_[_0x6458('0x15')](['$gt',_0x6458('0x16')],_0x106048[_0x6458('0x11')])){_0x106048[_0x6458('0x14')]=moment(_0x106048['value'])[_0x6458('0x17')](0x1,_0x6458('0x18'))['format'](_0x6458('0x19'));}}if(_0x106048[_0x6458('0x1a')]){_0x58b56a=_0x106048[_0x6458('0x1a')];_0x2a22e7[_0x6458('0x1b')]=_0x6458('0x1c')+_0x16d1ae+'.'+_0x106048['field']+_0x6458('0x1d')+_0x106048['castTo']+')\x20'+parseOperator(_0x106048[_0x6458('0x11')]);}else{_0x2a22e7[_0x6458('0x1b')]=_0x16d1ae+'.'+_0x106048[_0x6458('0x1e')]+'\x20'+parseOperator(_0x106048[_0x6458('0x11')]);}if(_[_0x6458('0x15')]([_0x6458('0x1f'),_0x6458('0x20')],_0x106048[_0x6458('0x11')]))_0x2a22e7['text']='('+_0x2a22e7[_0x6458('0x1b')]+_0x6458('0x21')+_0x16d1ae+'.'+_0x106048['field']+_0x6458('0x22');_0x2a22e7['value']=parseValue(_0x58b56a,_0x106048[_0x6458('0x11')],_0x106048[_0x6458('0x14')]);return _0x2a22e7;};function parseOperator(_0x3eaa90){var _0x39ac42;switch(_0x3eaa90){case _0x6458('0x23'):_0x39ac42=_0x6458('0x24');break;case _0x6458('0x20'):_0x39ac42=_0x6458('0x25');break;case'$eq':_0x39ac42='=\x20?';break;case'$ne':_0x39ac42=_0x6458('0x26');break;case _0x6458('0x27'):case _0x6458('0x28'):case _0x6458('0x29'):_0x39ac42=_0x6458('0x2a');break;case _0x6458('0x2b'):_0x39ac42=_0x6458('0x2c');break;case _0x6458('0x2d'):_0x39ac42=_0x6458('0x2e');break;case _0x6458('0x16'):_0x39ac42=_0x6458('0x2f');break;case _0x6458('0x30'):_0x39ac42=_0x6458('0x31');break;case _0x6458('0x13'):_0x39ac42=_0x6458('0x32');break;}return _0x39ac42;}function parseValue(_0x3198b1,_0x446079,_0xb077b7){var _0x36d4db={'start':undefined,'end':undefined};switch(_0x446079){case'$in':case _0x6458('0x20'):_0x36d4db[_0x6458('0x33')]=_0xb077b7[_0x6458('0x8')](',');break;case'$substring':_0x36d4db['start']='%'+_0xb077b7+'%';break;case _0x6458('0x28'):_0x36d4db[_0x6458('0x33')]=_0xb077b7+'%';break;case'$endsWith':_0x36d4db[_0x6458('0x33')]='%'+_0xb077b7;break;case _0x6458('0x13'):var _0x4d8461=_0xb077b7['split'](',');var _0xb077b7=_0x4d8461[_0x6458('0xb')]();var _0xf81d4f=_0x4d8461[_0x6458('0x34')]();if(_0x3198b1===_0x6458('0x35')){_0xb077b7=moment(_0xb077b7)['utcOffset'](0x0,!![])[_0x6458('0x36')]();_0xf81d4f=moment(_0xf81d4f)['utcOffset'](0x0,!![])[_0x6458('0x17')](0x17,_0x6458('0x37'))[_0x6458('0x17')](0x3b,_0x6458('0x38'))[_0x6458('0x17')](0x3b,_0x6458('0x39'))[_0x6458('0x36')]();}_0x36d4db={'start':_0xb077b7,'end':_0xf81d4f};break;default:_0x36d4db['start']=_0xb077b7;break;}return _0x36d4db;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 1755fab..ea7302c 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 _0x730e=['length','omit','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','forEach','replace','join','query','$id','model','name','intersection','attributes','nolimit','offset','order','pick','filter','where','merge','VIRTUAL','lower','lodash','sequelize','moment','parse','keys','includes','fields','split','filters','forOwn','find','type','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte','subtract','isArray','limit','sort','map','indexOf','priority','cast','col','unsigned','DESC','ASC'];(function(_0x264655,_0x57dbd6){var _0x5f05ba=function(_0x470905){while(--_0x470905){_0x264655['push'](_0x264655['shift']());}};_0x5f05ba(++_0x57dbd6);}(_0x730e,0x131));var _0xe730=function(_0x961a45,_0x3977de){_0x961a45=_0x961a45-0x0;var _0x390064=_0x730e[_0x961a45];return _0x390064;};'use strict';var _=require(_0xe730('0x0'));var sequelize=require(_0xe730('0x1'));var moment=require(_0xe730('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x334e9a){var _0x2892c9=['ne'];try{var _0x479ec4=JSON[_0xe730('0x3')](_0x334e9a);var _0x22b229=Object[_0xe730('0x4')](_0x479ec4)[0x0];return _0x2892c9[_0xe730('0x5')](_0x22b229);}catch(_0x27ca43){return![];}}function getOperatorValue(_0x12d77f){var _0x19cf1c=JSON[_0xe730('0x3')](_0x12d77f);var _0x5b91ea=Object['keys'](_0x19cf1c)[0x0];var _0x453596=_0x19cf1c[_0x5b91ea];return{['$'+_0x5b91ea]:_0x453596};}exports[_0xe730('0x6')]=function(_0x823ffe){var _0x21be61=null;if(_0x823ffe){_0x21be61=_0x823ffe[_0xe730('0x7')](',');}return _0x21be61;};exports[_0xe730('0x8')]=function(_0x1ca778,_0x5d452b){var _0x2977de={};if(!_['isEmpty'](_0x1ca778)){_[_0xe730('0x9')](_0x1ca778,function(_0x5aad3d,_0xb9065a){try{if(_0x5d452b){var _0x460b62=_[_0xe730('0xa')](_0x5d452b,{'name':_0xb9065a})||{};if(hasSequelizeOperator(_0x5aad3d)){_0x2977de[_0xb9065a]=getOperatorValue(_0x5aad3d);}else if(_0x460b62[_0xe730('0xb')]===_0xe730('0xc')&&_[_0xe730('0xd')](_0x5aad3d)){var _0x5be8c0=JSON[_0xe730('0x3')](_0x5aad3d);var _0x57d2d9={'$gte':moment(moment(_0x5be8c0[_0xe730('0xe')])['format'](_0xe730('0xf')))[_0xe730('0x10')]()[_0xe730('0x11')](),'$lte':moment(moment(_0x5be8c0[_0xe730('0x12')])['format']('YYYY-MM-DD'))['utc']()[_0xe730('0x13')](0x1,'s')[_0xe730('0x11')]()};_0x2977de[_0xb9065a]=_0x57d2d9;}else if(_0x460b62['name']==='uniqueid'){_0x2977de[_0xb9065a]=_0x5aad3d;}else{_0x2977de[_0xb9065a]=_[_0xe730('0x14')](_0x5aad3d)?_0x5aad3d:JSON[_0xe730('0x3')](_0x5aad3d);}}else{_0x2977de[_0xb9065a]=_[_0xe730('0x14')](_0x5aad3d)?_0x5aad3d:JSON[_0xe730('0x3')](_0x5aad3d);}}catch(_0x1b0635){_0x2977de[_0xb9065a]=_0x5aad3d[_0xe730('0x7')](',');}});}return _0x2977de;};exports[_0xe730('0x15')]=function(_0x1d8726){_0x1d8726=parseInt(_0x1d8726,0xa);if(!_0x1d8726||_0x1d8726<0x0){_0x1d8726=LIMIT_VALUE;}return _0x1d8726;};exports['offset']=function(_0x1a16cc){_0x1a16cc=parseInt(_0x1a16cc,0xa);if(!_0x1a16cc||_0x1a16cc<0x0){_0x1a16cc=0x0;}return _0x1a16cc;};exports[_0xe730('0x16')]=function(_0x5ed60c){var _0x47f829,_0x4b06cc=null;if(_0x5ed60c){_0x47f829=_0x5ed60c[_0xe730('0x7')](',');_0x4b06cc=_[_0xe730('0x17')](_0x47f829,function(_0xb1ea25){if(_0xb1ea25[_0xe730('0x18')]('-')===0x0){return[_0xb1ea25===_0xe730('0x19')?sequelize[_0xe730('0x1a')](sequelize[_0xe730('0x1b')](_0xe730('0x19')),_0xe730('0x1c')):_0xb1ea25['substr'](0x1),_0xe730('0x1d')];}else{return[_0xb1ea25==='priority'?sequelize[_0xe730('0x1a')](sequelize[_0xe730('0x1b')](_0xe730('0x19')),_0xe730('0x1c')):_0xb1ea25,_0xe730('0x1e')];}});}return _0x4b06cc;};exports['omit']=function(_0x5b85ff,_0x4d209e){if(_['isEmpty'](_0x5b85ff)){return _0x5b85ff;}if(_[_0xe730('0x14')](_0x5b85ff)){for(var _0x3872df=0x0;_0x3872df<_0x5b85ff[_0xe730('0x1f')];_0x3872df+=0x1){_0x5b85ff[_0x3872df]=this[_0xe730('0x20')](_0x5b85ff[_0x3872df],_0x4d209e);}return _0x5b85ff;}if(!_['isObject'](_0x5b85ff)){return _0x5b85ff;}if(_['isString'](_0x4d209e)){_0x4d209e=[_0x4d209e];}if(!_['isArray'](_0x4d209e)){return _0x5b85ff;}for(var _0x5dab40=0x0;_0x5dab40<_0x4d209e[_0xe730('0x1f')];_0x5dab40+=0x1){_[_0xe730('0x21')](_0x5b85ff,_0x4d209e[_0x5dab40]);}for(var _0x20bf70 in _0x5b85ff){if(_0x5b85ff['hasOwnProperty'](_0x20bf70)){_0x5b85ff[_0x20bf70]=this[_0xe730('0x20')](_0x5b85ff[_0x20bf70],_0x4d209e);}}return _0x5b85ff;};exports[_0xe730('0x22')]=function(_0x54f2ea){return _0x54f2ea[_0xe730('0x23')](RegExp(_0xe730('0x24')))?!![]:![];};exports[_0xe730('0x25')]=function(_0x257b74){return _0x257b74[_0xe730('0x23')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x14e9fe){var _0x3b7099=[];_0x14e9fe[_0xe730('0x7')](/[ ,]+/)[_0xe730('0x26')](function(_0x36604d){_0x36604d=_0x36604d[_0xe730('0x27')](/([^:]")"+/g,'$1');_0x36604d='+'+_0x36604d+'*';if(_0x36604d[_0xe730('0x5')]('@'))_0x36604d='\x22'+_0x36604d+'\x22';_0x3b7099['push'](_0x36604d);});return _0x3b7099[_0xe730('0x28')]('\x20');};exports['getOptions']=function(_0x5e83bf,_0x1f333a,_0x17ff4c){var _0x11c609={},_0x1e3457={};if(_0x1f333a[_0xe730('0x29')][_0xe730('0x2a')]){_0x1f333a[_0xe730('0x29')]['id']=_0x1f333a[_0xe730('0x29')][_0xe730('0x2a')];delete _0x1f333a[_0xe730('0x29')][_0xe730('0x2a')];}_0x11c609[_0xe730('0x2b')]=_[_0xe730('0x17')](_0x5e83bf,_0xe730('0x2c'));_0x11c609[_0xe730('0x29')]=_[_0xe730('0x4')](_0x1f333a[_0xe730('0x29')]);_0x11c609[_0xe730('0x8')]=_[_0xe730('0x2d')](_0x11c609[_0xe730('0x2b')],_0x11c609[_0xe730('0x29')]);_0x1e3457['attributes']=_[_0xe730('0x2d')](_0x11c609[_0xe730('0x2b')],this[_0xe730('0x6')](_0x1f333a[_0xe730('0x29')][_0xe730('0x6')]));_0x1e3457[_0xe730('0x2e')]=_0x1e3457['attributes'][_0xe730('0x1f')]?_0x1e3457[_0xe730('0x2e')]:_0x11c609[_0xe730('0x2b')];if(!_0x1f333a[_0xe730('0x29')]['hasOwnProperty'](_0xe730('0x2f'))){_0x1e3457[_0xe730('0x15')]=this[_0xe730('0x15')](_0x1f333a['query'][_0xe730('0x15')]);_0x1e3457['offset']=this[_0xe730('0x30')](_0x1f333a['query'][_0xe730('0x30')]);}_0x1e3457[_0xe730('0x31')]=this[_0xe730('0x16')](_0x1f333a[_0xe730('0x29')][_0xe730('0x16')]);_0x1e3457['where']=this['filters'](_[_0xe730('0x32')](_0x1f333a[_0xe730('0x29')],_0x11c609[_0xe730('0x8')]),_0x5e83bf);if(_0x1f333a[_0xe730('0x29')][_0xe730('0x33')]){_0x1e3457[_0xe730('0x34')]=_[_0xe730('0x35')](_0x1e3457[_0xe730('0x34')],{'$or':_[_0xe730('0x17')](_0x5e83bf,function(_0x40d591){if(_0x40d591[_0xe730('0xb')]!==_0xe730('0x36')){if(_0x17ff4c){return sequelize[_0xe730('0x34')](sequelize['fn']('lower',sequelize[_0xe730('0x1b')](_0x40d591[_0xe730('0x2c')])),{'$like':sequelize['fn'](_0xe730('0x37'),'%'+_0x1f333a[_0xe730('0x29')][_0xe730('0x33')]+'%')});}else{var _0x6815be={};_0x6815be[_0x40d591['name']]={'$like':'%'+_0x1f333a[_0xe730('0x29')][_0xe730('0x33')]+'%'};return _0x6815be;}}})});}_0x1e3457=_[_0xe730('0x35')]({},_0x1e3457,_0x1f333a['options']);return _0x1e3457;}; \ No newline at end of file +var _0xe4e3=['length','isObject','hasOwnProperty','omit','isNumeric','match','getOptions','query','$id','model','intersection','attributes','nolimit','order','where','filter','merge','VIRTUAL','lower','options','sequelize','keys','includes','parse','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','name','isArray','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','ASC'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe4e3,0x7a));var _0x3e4e=function(_0x357375,_0x27d159){_0x357375=_0x357375-0x0;var _0x29d552=_0xe4e3[_0x357375];return _0x29d552;};'use strict';var _=require('lodash');var sequelize=require(_0x3e4e('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x26e0d2){var _0x1d7d56=['ne'];try{var _0x252f16=JSON['parse'](_0x26e0d2);var _0x1dd7d8=Object[_0x3e4e('0x1')](_0x252f16)[0x0];return _0x1d7d56[_0x3e4e('0x2')](_0x1dd7d8);}catch(_0x60105b){return![];}}function getOperatorValue(_0x5d3db2){var _0x4957f8=JSON[_0x3e4e('0x3')](_0x5d3db2);var _0x12dc9c=Object[_0x3e4e('0x1')](_0x4957f8)[0x0];var _0x54f196=_0x4957f8[_0x12dc9c];return{['$'+_0x12dc9c]:_0x54f196};}exports[_0x3e4e('0x4')]=function(_0xf41392){var _0x5cc554=null;if(_0xf41392){_0x5cc554=_0xf41392[_0x3e4e('0x5')](',');}return _0x5cc554;};exports[_0x3e4e('0x6')]=function(_0x1ee025,_0x5615b9){var _0x1d540d={};if(!_[_0x3e4e('0x7')](_0x1ee025)){_[_0x3e4e('0x8')](_0x1ee025,function(_0x26b005,_0x19c803){try{if(_0x5615b9){var _0x1c9b26=_[_0x3e4e('0x9')](_0x5615b9,{'name':_0x19c803})||{};if(hasSequelizeOperator(_0x26b005)){_0x1d540d[_0x19c803]=getOperatorValue(_0x26b005);}else if(_0x1c9b26[_0x3e4e('0xa')]===_0x3e4e('0xb')&&_[_0x3e4e('0xc')](_0x26b005)){var _0x5bae05=JSON[_0x3e4e('0x3')](_0x26b005);var _0x2e1d43={'$gte':moment(moment(_0x5bae05[_0x3e4e('0xd')])[_0x3e4e('0xe')](_0x3e4e('0xf')))['utc']()['format'](),'$lte':moment(moment(_0x5bae05['$lte'])[_0x3e4e('0xe')](_0x3e4e('0xf')))[_0x3e4e('0x10')]()[_0x3e4e('0x11')](0x1,'s')['format']()};_0x1d540d[_0x19c803]=_0x2e1d43;}else if(_0x1c9b26[_0x3e4e('0x12')]==='uniqueid'){_0x1d540d[_0x19c803]=_0x26b005;}else{_0x1d540d[_0x19c803]=_[_0x3e4e('0x13')](_0x26b005)?_0x26b005:JSON[_0x3e4e('0x3')](_0x26b005);}}else{_0x1d540d[_0x19c803]=_['isArray'](_0x26b005)?_0x26b005:JSON[_0x3e4e('0x3')](_0x26b005);}}catch(_0x29db07){_0x1d540d[_0x19c803]=_0x26b005[_0x3e4e('0x5')](',');}});}return _0x1d540d;};exports[_0x3e4e('0x14')]=function(_0x48d3e2){_0x48d3e2=parseInt(_0x48d3e2,0xa);if(!_0x48d3e2||_0x48d3e2<0x0){_0x48d3e2=LIMIT_VALUE;}return _0x48d3e2;};exports[_0x3e4e('0x15')]=function(_0x4c4d5b){_0x4c4d5b=parseInt(_0x4c4d5b,0xa);if(!_0x4c4d5b||_0x4c4d5b<0x0){_0x4c4d5b=0x0;}return _0x4c4d5b;};exports[_0x3e4e('0x16')]=function(_0xa39fca){var _0x509ed7,_0x7d2452=null;if(_0xa39fca){_0x509ed7=_0xa39fca[_0x3e4e('0x5')](',');_0x7d2452=_[_0x3e4e('0x17')](_0x509ed7,function(_0x4bd985){if(_0x4bd985[_0x3e4e('0x18')]('-')===0x0){return[_0x4bd985===_0x3e4e('0x19')?sequelize[_0x3e4e('0x1a')](sequelize[_0x3e4e('0x1b')](_0x3e4e('0x19')),_0x3e4e('0x1c')):_0x4bd985[_0x3e4e('0x1d')](0x1),'DESC'];}else{return[_0x4bd985===_0x3e4e('0x19')?sequelize[_0x3e4e('0x1a')](sequelize[_0x3e4e('0x1b')]('priority'),'unsigned'):_0x4bd985,_0x3e4e('0x1e')];}});}return _0x7d2452;};exports['omit']=function(_0x54c054,_0x43c8e1){if(_[_0x3e4e('0x7')](_0x54c054)){return _0x54c054;}if(_[_0x3e4e('0x13')](_0x54c054)){for(var _0x3b0952=0x0;_0x3b0952<_0x54c054[_0x3e4e('0x1f')];_0x3b0952+=0x1){_0x54c054[_0x3b0952]=this['omit'](_0x54c054[_0x3b0952],_0x43c8e1);}return _0x54c054;}if(!_[_0x3e4e('0x20')](_0x54c054)){return _0x54c054;}if(_['isString'](_0x43c8e1)){_0x43c8e1=[_0x43c8e1];}if(!_[_0x3e4e('0x13')](_0x43c8e1)){return _0x54c054;}for(var _0x21d094=0x0;_0x21d094<_0x43c8e1[_0x3e4e('0x1f')];_0x21d094+=0x1){_['unset'](_0x54c054,_0x43c8e1[_0x21d094]);}for(var _0x1a4cd4 in _0x54c054){if(_0x54c054[_0x3e4e('0x21')](_0x1a4cd4)){_0x54c054[_0x1a4cd4]=this[_0x3e4e('0x22')](_0x54c054[_0x1a4cd4],_0x43c8e1);}}return _0x54c054;};exports[_0x3e4e('0x23')]=function(_0x3724eb){return _0x3724eb[_0x3e4e('0x24')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x1afa59){return _0x1afa59['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x5ec3f0){var _0x3e77cc=[];_0x5ec3f0['split'](/[ ,]+/)['forEach'](function(_0x334e79){_0x334e79=_0x334e79['replace'](/([^:]")"+/g,'$1');_0x334e79='+'+_0x334e79+'*';if(_0x334e79[_0x3e4e('0x2')]('@'))_0x334e79='\x22'+_0x334e79+'\x22';_0x3e77cc['push'](_0x334e79);});return _0x3e77cc['join']('\x20');};exports[_0x3e4e('0x25')]=function(_0x17dfe6,_0x18f6b3,_0x247a3d){var _0x13b241={},_0xee7ba8={};if(_0x18f6b3[_0x3e4e('0x26')][_0x3e4e('0x27')]){_0x18f6b3[_0x3e4e('0x26')]['id']=_0x18f6b3['query'][_0x3e4e('0x27')];delete _0x18f6b3['query'][_0x3e4e('0x27')];}_0x13b241[_0x3e4e('0x28')]=_[_0x3e4e('0x17')](_0x17dfe6,_0x3e4e('0x12'));_0x13b241[_0x3e4e('0x26')]=_[_0x3e4e('0x1')](_0x18f6b3[_0x3e4e('0x26')]);_0x13b241['filters']=_[_0x3e4e('0x29')](_0x13b241['model'],_0x13b241['query']);_0xee7ba8[_0x3e4e('0x2a')]=_[_0x3e4e('0x29')](_0x13b241[_0x3e4e('0x28')],this[_0x3e4e('0x4')](_0x18f6b3[_0x3e4e('0x26')][_0x3e4e('0x4')]));_0xee7ba8[_0x3e4e('0x2a')]=_0xee7ba8['attributes'][_0x3e4e('0x1f')]?_0xee7ba8[_0x3e4e('0x2a')]:_0x13b241['model'];if(!_0x18f6b3['query'][_0x3e4e('0x21')](_0x3e4e('0x2b'))){_0xee7ba8['limit']=this[_0x3e4e('0x14')](_0x18f6b3['query'][_0x3e4e('0x14')]);_0xee7ba8[_0x3e4e('0x15')]=this[_0x3e4e('0x15')](_0x18f6b3[_0x3e4e('0x26')][_0x3e4e('0x15')]);}_0xee7ba8[_0x3e4e('0x2c')]=this['sort'](_0x18f6b3[_0x3e4e('0x26')]['sort']);_0xee7ba8[_0x3e4e('0x2d')]=this[_0x3e4e('0x6')](_['pick'](_0x18f6b3[_0x3e4e('0x26')],_0x13b241[_0x3e4e('0x6')]),_0x17dfe6);if(_0x18f6b3[_0x3e4e('0x26')][_0x3e4e('0x2e')]){_0xee7ba8[_0x3e4e('0x2d')]=_[_0x3e4e('0x2f')](_0xee7ba8[_0x3e4e('0x2d')],{'$or':_[_0x3e4e('0x17')](_0x17dfe6,function(_0x4c43cc){if(_0x4c43cc[_0x3e4e('0xa')]!==_0x3e4e('0x30')){if(_0x247a3d){return sequelize[_0x3e4e('0x2d')](sequelize['fn'](_0x3e4e('0x31'),sequelize[_0x3e4e('0x1b')](_0x4c43cc[_0x3e4e('0x12')])),{'$like':sequelize['fn'](_0x3e4e('0x31'),'%'+_0x18f6b3[_0x3e4e('0x26')][_0x3e4e('0x2e')]+'%')});}else{var _0x530753={};_0x530753[_0x4c43cc[_0x3e4e('0x12')]]={'$like':'%'+_0x18f6b3[_0x3e4e('0x26')]['filter']+'%'};return _0x530753;}}})});}_0xee7ba8=_[_0x3e4e('0x2f')]({},_0xee7ba8,_0x18f6b3[_0x3e4e('0x32')]);return _0xee7ba8;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 7bdc85a..0f7e279 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87f7=['split','static','views','engine','html','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','passport','default','get','env','production','set','root','public','appPath','client','use','json\x20replacer','toISOString'];(function(_0x14996e,_0x108636){var _0x2f0151=function(_0x20dd91){while(--_0x20dd91){_0x14996e['push'](_0x14996e['shift']());}};_0x2f0151(++_0x108636);}(_0x87f7,0x1a0));var _0x787f=function(_0x2e3fa4,_0x272694){_0x2e3fa4=_0x2e3fa4-0x0;var _0x277463=_0x87f7[_0x2e3fa4];return _0x277463;};'use strict';var express=require(_0x787f('0x0'));var favicon=require(_0x787f('0x1'));var bodyParser=require(_0x787f('0x2'));var methodOverride=require(_0x787f('0x3'));var cookieParser=require(_0x787f('0x4'));var errorHandler=require(_0x787f('0x5'));var path=require('path');var passport=require(_0x787f('0x6'));var cors=require('cors');var moment=require('moment');var config=require('./environment');var db=require('../mysqldb')['db'];exports[_0x787f('0x7')]=function(_0x3f5091){var _0xadf89a=_0x3f5091[_0x787f('0x8')](_0x787f('0x9'));if(_0xadf89a===_0x787f('0xa')){_0x3f5091[_0x787f('0xb')]('appPath',path['join'](config[_0x787f('0xc')],_0x787f('0xd')));}if(_0xadf89a==='development'||_0xadf89a==='test'){_0x3f5091[_0x787f('0xb')](_0x787f('0xe'),path['join'](config[_0x787f('0xc')],_0x787f('0xf')));_0x3f5091[_0x787f('0x10')](errorHandler());}_0x3f5091[_0x787f('0xb')](_0x787f('0x11'),function(_0x249dfe,_0x2504df){if(this[_0x249dfe]instanceof Date){_0x2504df=this[_0x249dfe][_0x787f('0x12')]()[_0x787f('0x13')]('.')[0x0]+'Z';}return _0x2504df;});_0x3f5091[_0x787f('0x10')](express[_0x787f('0x14')](_0x3f5091['get'](_0x787f('0xe'))));_0x3f5091[_0x787f('0xb')](_0x787f('0x15'),config[_0x787f('0xc')]+'/server/views');_0x3f5091[_0x787f('0x16')](_0x787f('0x17'),require('ejs')['renderFile']);_0x3f5091['set'](_0x787f('0x18'),_0x787f('0x17'));_0x3f5091[_0x787f('0x10')](bodyParser[_0x787f('0x19')]({'limit':_0x787f('0x1a'),'extended':!![]}));_0x3f5091[_0x787f('0x10')](bodyParser[_0x787f('0x1b')]({'limit':_0x787f('0x1a')}));_0x3f5091[_0x787f('0x10')](cors());_0x3f5091[_0x787f('0x10')](methodOverride());_0x3f5091['use'](cookieParser());_0x3f5091[_0x787f('0x10')](passport[_0x787f('0x1c')]());}; \ No newline at end of file +var _0xcc68=['set','appPath','join','root','test','client','use','toISOString','static','views','/server/views','engine','html','ejs','renderFile','urlencoded','50mb','initialize','express','serve-favicon','cookie-parser','path','cors','moment','./environment','default','get','env','production'];(function(_0xee3051,_0xbe4f18){var _0x139e81=function(_0xac81c3){while(--_0xac81c3){_0xee3051['push'](_0xee3051['shift']());}};_0x139e81(++_0xbe4f18);}(_0xcc68,0x86));var _0x8cc6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcc68[_0x321bb2];return _0x9c12ed;};'use strict';var express=require(_0x8cc6('0x0'));var favicon=require(_0x8cc6('0x1'));var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require(_0x8cc6('0x2'));var errorHandler=require('errorhandler');var path=require(_0x8cc6('0x3'));var passport=require('passport');var cors=require(_0x8cc6('0x4'));var moment=require(_0x8cc6('0x5'));var config=require(_0x8cc6('0x6'));var db=require('../mysqldb')['db'];exports[_0x8cc6('0x7')]=function(_0x48a3fd){var _0x1e3884=_0x48a3fd[_0x8cc6('0x8')](_0x8cc6('0x9'));if(_0x1e3884===_0x8cc6('0xa')){_0x48a3fd[_0x8cc6('0xb')](_0x8cc6('0xc'),path[_0x8cc6('0xd')](config[_0x8cc6('0xe')],'public'));}if(_0x1e3884==='development'||_0x1e3884===_0x8cc6('0xf')){_0x48a3fd['set'](_0x8cc6('0xc'),path[_0x8cc6('0xd')](config['root'],_0x8cc6('0x10')));_0x48a3fd[_0x8cc6('0x11')](errorHandler());}_0x48a3fd[_0x8cc6('0xb')]('json\x20replacer',function(_0x527cbf,_0x567f8a){if(this[_0x527cbf]instanceof Date){_0x567f8a=this[_0x527cbf][_0x8cc6('0x12')]()['split']('.')[0x0]+'Z';}return _0x567f8a;});_0x48a3fd[_0x8cc6('0x11')](express[_0x8cc6('0x13')](_0x48a3fd[_0x8cc6('0x8')](_0x8cc6('0xc'))));_0x48a3fd['set'](_0x8cc6('0x14'),config[_0x8cc6('0xe')]+_0x8cc6('0x15'));_0x48a3fd[_0x8cc6('0x16')](_0x8cc6('0x17'),require(_0x8cc6('0x18'))[_0x8cc6('0x19')]);_0x48a3fd[_0x8cc6('0xb')]('view\x20engine',_0x8cc6('0x17'));_0x48a3fd[_0x8cc6('0x11')](bodyParser[_0x8cc6('0x1a')]({'limit':_0x8cc6('0x1b'),'extended':!![]}));_0x48a3fd[_0x8cc6('0x11')](bodyParser['json']({'limit':_0x8cc6('0x1b')}));_0x48a3fd['use'](cors());_0x48a3fd['use'](methodOverride());_0x48a3fd[_0x8cc6('0x11')](cookieParser());_0x48a3fd[_0x8cc6('0x11')](passport[_0x8cc6('0x1c')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index b143c55..489d047 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 _0x59bf=['orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','model','join','createHash','md5','update','digest','getUuid','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','substring','crypto','child_process','execSync'];(function(_0x2bd337,_0x26d9e8){var _0x11b74f=function(_0x14b3e9){while(--_0x14b3e9){_0x2bd337['push'](_0x2bd337['shift']());}};_0x11b74f(++_0x26d9e8);}(_0x59bf,0x126));var _0xf59b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x59bf[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xf59b('0x0'));var machine=require('bimedia-machine-uuid');var exec=require(_0xf59b('0x1'))[_0xf59b('0x2')];var config=require('../environment');function getInterfaces(){var _0xa7058c=[];var _0x365f20=os['networkInterfaces']();var _0x3d9fc5=_[_0xf59b('0x3')](_[_0xf59b('0x4')](_0x365f20));for(var _0x5e4dde=0x0;_0x5e4dde<_0x3d9fc5[_0xf59b('0x5')];_0x5e4dde++){var _0x2564a3=_0x365f20[_0x3d9fc5[_0x5e4dde]][_0xf59b('0x6')](function(_0x4ba603){return _0x4ba603[_0xf59b('0x7')]===_0xf59b('0x8')&&_0x4ba603[_0xf59b('0x9')]===![];});_0xa7058c=_0xa7058c[_0xf59b('0xa')](_0x2564a3);}return _0xa7058c;}function getFirstInterface(){var _0x4519da=_[_0xf59b('0xb')](getInterfaces());return{'macAddress':_0x4519da&&_0x4519da[_0xf59b('0xc')]?_0x4519da[_0xf59b('0xc')]:_0xf59b('0xd'),'ipAddress':_0x4519da&&_0x4519da['address']?_0x4519da[_0xf59b('0xe')]:_0xf59b('0xf')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x351e41=_[_0xf59b('0x3')](os[_0xf59b('0x10')]()['map'](function(_0x13b9cf){return _0x13b9cf[_0xf59b('0x11')];}))[_0xf59b('0x12')](':');return crypto[_0xf59b('0x13')](_0xf59b('0x14'))[_0xf59b('0x15')](_0x351e41)[_0xf59b('0x16')]('hex');}exports[_0xf59b('0x17')]=function(){var _0x5abde2=os['platform']();var _0x41fdad=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x41fdad[_0xf59b('0x18')](config[_0xf59b('0x19')])){return config[_0xf59b('0x19')];}else if(_0x5abde2===_0xf59b('0x1a')){return exec(_0xf59b('0x1b'),{'encoding':_0xf59b('0x1c')})[_0xf59b('0x1d')]('\x0d\x0a','');}else{var _0x1da60e=getFirstInterface();var _0x4aaaf7=getCPUhash();var _0x834fef=_0x4aaaf7+'|'+os[_0xf59b('0x1e')]()+'|'+_0x1da60e[_0xf59b('0x1f')]+'|'+_0x1da60e['ipAddress'];var _0x7f1323=crypto[_0xf59b('0x13')](_0xf59b('0x14'))['update'](_0x834fef)[_0xf59b('0x16')]('hex');return _0x7f1323[_0xf59b('0x20')](0x0,0x8)+'-'+_0x7f1323[_0xf59b('0x20')](0x8,0xc)+'-'+_0x7f1323[_0xf59b('0x20')](0xc,0x10)+'-'+_0x7f1323[_0xf59b('0x20')](0x10,0x14)+'-'+_0x7f1323[_0xf59b('0x20')](0x14);}}; \ No newline at end of file +var _0xf0b1=['map','model','createHash','md5','update','digest','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','hostname','macAddress','ipAddress','substring','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','orderBy','length','filter','internal','concat','head','mac','address','getFirstInterface','cpus'];(function(_0x274b81,_0x4b4848){var _0x1872f3=function(_0x5a1718){while(--_0x5a1718){_0x274b81['push'](_0x274b81['shift']());}};_0x1872f3(++_0x4b4848);}(_0xf0b1,0x146));var _0x1f0b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf0b1[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x1f0b('0x0'));var machine=require(_0x1f0b('0x1'));var exec=require(_0x1f0b('0x2'))['execSync'];var config=require(_0x1f0b('0x3'));function getInterfaces(){var _0x1d7c34=[];var _0x2e7388=os[_0x1f0b('0x4')]();var _0x156e17=_[_0x1f0b('0x5')](_['keys'](_0x2e7388));for(var _0xf29f07=0x0;_0xf29f07<_0x156e17[_0x1f0b('0x6')];_0xf29f07++){var _0x36429d=_0x2e7388[_0x156e17[_0xf29f07]][_0x1f0b('0x7')](function(_0x3a1fad){return _0x3a1fad['family']==='IPv4'&&_0x3a1fad[_0x1f0b('0x8')]===![];});_0x1d7c34=_0x1d7c34[_0x1f0b('0x9')](_0x36429d);}return _0x1d7c34;}function getFirstInterface(){var _0x17a333=_[_0x1f0b('0xa')](getInterfaces());return{'macAddress':_0x17a333&&_0x17a333[_0x1f0b('0xb')]?_0x17a333['mac']:'00:00:00:00:00:00','ipAddress':_0x17a333&&_0x17a333['address']?_0x17a333[_0x1f0b('0xc')]:'127.0.0.1'};}exports[_0x1f0b('0xd')]=getFirstInterface;function getCPUhash(){var _0x2aaf9c=_[_0x1f0b('0x5')](os[_0x1f0b('0xe')]()[_0x1f0b('0xf')](function(_0x92a852){return _0x92a852[_0x1f0b('0x10')];}))['join'](':');return crypto[_0x1f0b('0x11')](_0x1f0b('0x12'))[_0x1f0b('0x13')](_0x2aaf9c)[_0x1f0b('0x14')]('hex');}exports[_0x1f0b('0x15')]=function(){var _0x3d84cc=os[_0x1f0b('0x16')]();var _0x26c5bf=/[0-9a-f-]{36}/;if(config[_0x1f0b('0x17')]&&_0x26c5bf[_0x1f0b('0x18')](config[_0x1f0b('0x17')])){return config[_0x1f0b('0x17')];}else if(_0x3d84cc===_0x1f0b('0x19')){return exec(_0x1f0b('0x1a'),{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x3e444f=getFirstInterface();var _0x1e4fa1=getCPUhash();var _0xff288a=_0x1e4fa1+'|'+os[_0x1f0b('0x1b')]()+'|'+_0x3e444f[_0x1f0b('0x1c')]+'|'+_0x3e444f[_0x1f0b('0x1d')];var _0x467a7c=crypto['createHash'](_0x1f0b('0x12'))['update'](_0xff288a)[_0x1f0b('0x14')]('hex');return _0x467a7c[_0x1f0b('0x1e')](0x0,0x8)+'-'+_0x467a7c[_0x1f0b('0x1e')](0x8,0xc)+'-'+_0x467a7c[_0x1f0b('0x1e')](0xc,0x10)+'-'+_0x467a7c[_0x1f0b('0x1e')](0x10,0x14)+'-'+_0x467a7c['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 3b220d9..4073960 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 _0xebb6=['message','moment','bluebird','pkginfo','version','../../mysqldb','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','catch','get','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','then','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s'];(function(_0x330616,_0x446c69){var _0x50e722=function(_0x14a084){while(--_0x14a084){_0x330616['push'](_0x330616['shift']());}};_0x50e722(++_0x446c69);}(_0xebb6,0x1eb));var _0x6ebb=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xebb6[_0x433a86];return _0x23000c;};'use strict';var util=require('util');var moment=require(_0x6ebb('0x0'));var rp=require('request-promise');var BPromise=require(_0x6ebb('0x1'));var pkginfo=require(_0x6ebb('0x2'))(module,_0x6ebb('0x3'));var db=require(_0x6ebb('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x6ebb('0x5'));var logger=require('../logger')(_0x6ebb('0x6'));var HOST=_0x6ebb('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2ee743){return new BPromise(function(_0x529234,_0x389bf2){var _0x70b066=util[_0x6ebb('0x8')](_0x6ebb('0x9'),HOST,_0x2ee743,module[_0x6ebb('0xa')]['version']);if(oldToken){_0x70b066=util[_0x6ebb('0x8')](_0x6ebb('0xb'),HOST,_0x2ee743,module[_0x6ebb('0xa')][_0x6ebb('0x3')],oldToken);}var _0x53cfd1={'uri':_0x70b066,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x53cfd1)['then'](function(_0x3a88ae){_0x529234(_0x3a88ae);})[_0x6ebb('0xc')](function(_0xcee513){_0x389bf2(_0xcee513);});});}function manageLicense(_0x262790,_0x1c8ae0){var _0xeb0fb7=_0x1c8ae0[_0x6ebb('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0xeb0fb7[_0x6ebb('0xe')]!==_0x262790&&!_0xeb0fb7['data2']){oldToken=_0xeb0fb7[_0x6ebb('0xe')];}httpRequest(_0x262790)['then'](function(_0x56ee68){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x56ee68['active']){isOldTokenSent=![];if(!_0xeb0fb7[_0x6ebb('0x6')]&&_0xeb0fb7[_0x6ebb('0x6')]!=_0x56ee68[_0x6ebb('0x6')]||_0xeb0fb7['license']&&_0xeb0fb7[_0x6ebb('0xf')]){logger[_0x6ebb('0x10')](_0x6ebb('0x11'));}if(_0xeb0fb7[_0x6ebb('0x6')]&&!_0xeb0fb7[_0x6ebb('0xf')]&&_0xeb0fb7[_0x6ebb('0x6')]!=_0x56ee68['license']){logger[_0x6ebb('0x10')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0xeb0fb7[_0x6ebb('0x6')]&&!_0xeb0fb7[_0x6ebb('0xf')]&&_0xeb0fb7[_0x6ebb('0x6')]==_0x56ee68[_0x6ebb('0x6')]){return _0x1c8ae0;}return _0x1c8ae0[_0x6ebb('0x12')]({'data1':_0x262790,'data2':null,'license':_0x56ee68[_0x6ebb('0x6')]});}else{if(_0x56ee68[_0x6ebb('0x6')]||_0xeb0fb7[_0x6ebb('0x6')]){if(!_0xeb0fb7['data2']){if(_0xeb0fb7[_0x6ebb('0xe')]==_0x262790){GRAY_PERIOD_REASON=_0x6ebb('0x13');logger[_0x6ebb('0x10')](_0x6ebb('0x14'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x6ebb('0x10')](_0x6ebb('0x15'),_0xeb0fb7[_0x6ebb('0xe')],_0x262790);}logger[_0x6ebb('0x10')](_0x6ebb('0x16'),GRAY_PERIOD_REASON[_0x6ebb('0x17')](),moment()[_0x6ebb('0x8')](_0x6ebb('0x18')));return _0x1c8ae0['update']({'data2':encryptor[_0x6ebb('0x19')](moment()[_0x6ebb('0x8')](_0x6ebb('0x18')))});}else{if(moment()['diff'](encryptor[_0x6ebb('0x1a')](_0xeb0fb7['data2']),_0x6ebb('0x1b'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x6ebb('0x18')));isOldTokenSent=![];return _0x1c8ae0[_0x6ebb('0x12')]({'data1':_0x262790,'data2':null,'license':null});}}}else{if(_0xeb0fb7[_0x6ebb('0xe')]!=_0x262790){logger[_0x6ebb('0x10')](_0x6ebb('0x15'),_0xeb0fb7[_0x6ebb('0xe')],_0x262790);return _0x1c8ae0[_0x6ebb('0x12')]({'data1':_0x262790,'data2':null,'license':null});}}}return _0x1c8ae0;})[_0x6ebb('0x1c')](function(_0x3d53b3){_0x1c8ae0=_0x3d53b3;})[_0x6ebb('0xc')](function(_0x4dae35){logger['error'](_0x4dae35['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x6ebb('0x1d')](),_0x1c8ae0);},TIME);});}function defaultLicense(){var _0x1b9dee=hardware[_0x6ebb('0x1d')]();if(_0x1b9dee){return db[_0x6ebb('0x1e')][_0x6ebb('0x1f')]({'where':{'id':0x1},'defaults':{'data1':_0x1b9dee}})[_0x6ebb('0x20')](function(_0x2ce3b6,_0x1bafef){logger[_0x6ebb('0x10')](_0x6ebb('0x21'),_0x1b9dee);manageLicense(_0x1b9dee,_0x2ce3b6);})[_0x6ebb('0xc')](function(_0x5d887a){logger['error'](_0x5d887a[_0x6ebb('0x22')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x34df=['days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','findOrCreate','spread','default','util','moment','version','../../mysqldb','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','catch','get','data1','then','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','format','encryptString','decryptString'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0x34df,0xef));var _0xf34d=function(_0x2b152a,_0x3dd988){_0x2b152a=_0x2b152a-0x0;var _0x2ad4c7=_0x34df[_0x2b152a];return _0x2ad4c7;};'use strict';var util=require(_0xf34d('0x0'));var moment=require(_0xf34d('0x1'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0xf34d('0x2'));var db=require(_0xf34d('0x3'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0xf34d('0x4'))(_0xf34d('0x5'));var HOST=_0xf34d('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x21811d){return new BPromise(function(_0x950026,_0x572f4f){var _0x12bd1a=util['format'](_0xf34d('0x7'),HOST,_0x21811d,module[_0xf34d('0x8')][_0xf34d('0x2')]);if(oldToken){_0x12bd1a=util['format'](_0xf34d('0x9'),HOST,_0x21811d,module['exports'][_0xf34d('0x2')],oldToken);}var _0x4fccb1={'uri':_0x12bd1a,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x4fccb1)['then'](function(_0x408954){_0x950026(_0x408954);})[_0xf34d('0xa')](function(_0x227a53){_0x572f4f(_0x227a53);});});}function manageLicense(_0x458858,_0x184322){var _0x47418f=_0x184322[_0xf34d('0xb')]({'plain':!![]});if(!isOldTokenSent&&_0x47418f['data1']!==_0x458858&&!_0x47418f['data2']){oldToken=_0x47418f[_0xf34d('0xc')];}httpRequest(_0x458858)[_0xf34d('0xd')](function(_0x44dbf0){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x44dbf0[_0xf34d('0xe')]){isOldTokenSent=![];if(!_0x47418f[_0xf34d('0x5')]&&_0x47418f[_0xf34d('0x5')]!=_0x44dbf0[_0xf34d('0x5')]||_0x47418f[_0xf34d('0x5')]&&_0x47418f[_0xf34d('0xf')]){logger[_0xf34d('0x10')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x47418f[_0xf34d('0x5')]&&!_0x47418f[_0xf34d('0xf')]&&_0x47418f['license']!=_0x44dbf0['license']){logger[_0xf34d('0x10')](_0xf34d('0x11'));}if(_0x47418f[_0xf34d('0x5')]&&!_0x47418f[_0xf34d('0xf')]&&_0x47418f['license']==_0x44dbf0[_0xf34d('0x5')]){return _0x184322;}return _0x184322[_0xf34d('0x12')]({'data1':_0x458858,'data2':null,'license':_0x44dbf0[_0xf34d('0x5')]});}else{if(_0x44dbf0['license']||_0x47418f[_0xf34d('0x5')]){if(!_0x47418f[_0xf34d('0xf')]){if(_0x47418f[_0xf34d('0xc')]==_0x458858){GRAY_PERIOD_REASON=_0xf34d('0x13');logger[_0xf34d('0x10')](_0xf34d('0x14'));}else{GRAY_PERIOD_REASON=_0xf34d('0x15');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x47418f['data1'],_0x458858);}logger[_0xf34d('0x10')](_0xf34d('0x16'),GRAY_PERIOD_REASON[_0xf34d('0x17')](),moment()[_0xf34d('0x18')]('YYYY-MM-DD\x20HH:mm'));return _0x184322[_0xf34d('0x12')]({'data2':encryptor[_0xf34d('0x19')](moment()[_0xf34d('0x18')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0xf34d('0x1a')](_0x47418f[_0xf34d('0xf')]),_0xf34d('0x1b'))>DAYS){logger[_0xf34d('0x10')](_0xf34d('0x1c'),moment()[_0xf34d('0x18')](_0xf34d('0x1d')));isOldTokenSent=![];return _0x184322[_0xf34d('0x12')]({'data1':_0x458858,'data2':null,'license':null});}}}else{if(_0x47418f[_0xf34d('0xc')]!=_0x458858){logger['info'](_0xf34d('0x1e'),_0x47418f[_0xf34d('0xc')],_0x458858);return _0x184322[_0xf34d('0x12')]({'data1':_0x458858,'data2':null,'license':null});}}}return _0x184322;})[_0xf34d('0xd')](function(_0x55cc3e){_0x184322=_0x55cc3e;})['catch'](function(_0x1a2ff2){logger[_0xf34d('0x1f')](_0x1a2ff2[_0xf34d('0x20')]);})[_0xf34d('0x21')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x184322);},TIME);});}function defaultLicense(){var _0x32dbc3=hardware[_0xf34d('0x22')]();if(_0x32dbc3){return db['License'][_0xf34d('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x32dbc3}})[_0xf34d('0x24')](function(_0x3ff5db,_0x142337){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x32dbc3);manageLicense(_0x32dbc3,_0x3ff5db);})[_0xf34d('0xa')](function(_0x129419){logger[_0xf34d('0x1f')](_0x129419['message']);});}}exports[_0xf34d('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 91b2d59..eb629df 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 _0x57ac=['COUNT','col','count','admin','user','telephone','telephones','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../components/encryptor','getUuid','find','defaults','then','catch','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','deadline','add','days','grayReason','changed','disabled','message','findAll','role','sequelize'];(function(_0x39758d,_0x346423){var _0x44ac11=function(_0x175008){while(--_0x175008){_0x39758d['push'](_0x39758d['shift']());}};_0x44ac11(++_0x346423);}(_0x57ac,0x198));var _0xc57a=function(_0x58ef65,_0x4c4e0a){_0x58ef65=_0x58ef65-0x0;var _0x1f0291=_0x57ac[_0x58ef65];return _0x1f0291;};'use strict';var util=require(_0xc57a('0x0'));var _=require(_0xc57a('0x1'));var moment=require(_0xc57a('0x2'));var BPromise=require('bluebird');var hardware=require(_0xc57a('0x3'));var encryptor=require(_0xc57a('0x4'));var db=require('../../mysqldb')['db'];const demoLicense={'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':![],'description':'Demo\x20license','machineUuid':hardware[_0xc57a('0x5')](),'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':'Breaking\x20license','machineUuid':hardware[_0xc57a('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x205d6e){return new BPromise(function(_0x1b5186,_0x33d3db){return db['License'][_0xc57a('0x6')](_[_0xc57a('0x7')](_0x205d6e,{'raw':!![],'where':{'id':0x1}}))[_0xc57a('0x8')](function(_0x4444e9){return checkLicense(_0x4444e9,null);})[_0xc57a('0x8')](function(_0x2050f1){_0x1b5186(_0x2050f1);return;})[_0xc57a('0x9')](function(_0x10a0ff){_0x33d3db(_0x10a0ff);});});}function checkLicense(_0x3521e2,_0x311805){if(!_0x3521e2){demoLicense[_0xc57a('0xa')]=_0x3521e2[_0xc57a('0xb')];return demoLicense;}try{var _0x28a0b9=_0x311805||_0x3521e2['license'];if(_[_0xc57a('0xc')](_0x28a0b9)){throw new Error(_0xc57a('0xd'));}var _0x2ff115=_0x3521e2[_0xc57a('0xb')];var _0x5bfbc0=_0x3521e2[_0xc57a('0xe')];var _0x24b825=_0x2ff115[_0xc57a('0xf')]('-')[0x4];var _0x2b141b=_0x2ff115[_0xc57a('0xf')]('-')[0x0];var _0x437a16=encryptor[_0xc57a('0x10')](_0x28a0b9,util[_0xc57a('0x11')](_0xc57a('0x12'),_0x24b825,_0x2ff115,_0x2b141b));var _0x56a3e3=JSON[_0xc57a('0x13')](_0x437a16);_0x56a3e3[_0xc57a('0x14')]=![];_0x56a3e3[_0xc57a('0xa')]=_0x2ff115;_0x56a3e3[_0xc57a('0x15')]=hardware[_0xc57a('0x5')]();if(_0x5bfbc0){var _0x37ae2b=encryptor[_0xc57a('0x10')](_0x5bfbc0);_0x56a3e3['gray']=_0x37ae2b;_0x56a3e3[_0xc57a('0x16')]=moment(_0x37ae2b)[_0xc57a('0x17')](0x7,_0xc57a('0x18'))[_0xc57a('0x11')]();_0x56a3e3[_0xc57a('0x19')]=_0x56a3e3['uuid']!=_0x56a3e3[_0xc57a('0x15')]?_0xc57a('0x1a'):_0xc57a('0x1b');}return _0x56a3e3;}catch(_0x437f39){breakingLicense['uuid']=_0x3521e2[_0xc57a('0xb')];breakingLicense[_0xc57a('0x1c')]=_0x437f39[_0xc57a('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x311a6e,_0x328732){getLicense()[_0xc57a('0x8')](function(_0x300ec1){return db['User'][_0xc57a('0x1d')]({'attributes':[_0xc57a('0x1e'),[db[_0xc57a('0x1f')]['fn'](_0xc57a('0x20'),db['sequelize'][_0xc57a('0x21')](_0xc57a('0x1e'))),_0xc57a('0x22')]],'group':'role','where':{'role':{'$or':[_0xc57a('0x23'),_0xc57a('0x24'),_0xc57a('0x25')]}},'raw':!![]})['then'](function(_0x35e41e){var _0x259d25={'user':_0x300ec1['users']||0x0,'telephone':_0x300ec1[_0xc57a('0x26')]||0x0};_0x35e41e['forEach'](function(_0x4e9037){var _0x21d638=_0x4e9037[_0xc57a('0x1e')]===_0xc57a('0x23')?_0xc57a('0x24'):_0x4e9037[_0xc57a('0x1e')];_0x259d25[_0x21d638]-=_0x4e9037['count'];if(_0x259d25[_0x21d638]<0x0)_0x259d25[_0x21d638]=0x0;});_0x311a6e(_0x259d25);return;});})[_0xc57a('0x9')](function(_0x3b57db){_0x328732(_0x3b57db);});});}function checkUserLimits(_0xc56909){return new BPromise(function(_0x39b4bc,_0x46d8fb){getLimits()[_0xc57a('0x8')](function(_0x4c1503){var _0x582f64=_[_0xc57a('0x27')](_[_0xc57a('0x28')](_0xc56909,_0xc57a('0x1e')),['admin','user',_0xc57a('0x25')]);var _0x5987db=(_0x582f64[_0xc57a('0x23')]||0x0)+(_0x582f64['user']||0x0);var _0x4d7b07=_0x582f64[_0xc57a('0x25')]||0x0;if(_0x5987db>_0x4c1503['user'])return _0x46d8fb(_0xc57a('0x29'));if(_0x4d7b07>_0x4c1503[_0xc57a('0x25')])return _0x46d8fb(_0xc57a('0x2a'));return _0x39b4bc();})[_0xc57a('0x9')](function(_0x16201e){_0x46d8fb(_0x16201e);});});}module[_0xc57a('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xe31a=['format','%s:%s:%s','demo','deadline','add','days','grayReason','machineUuid','changed','message','User','findAll','role','sequelize','COUNT','count','admin','user','telephone','users','telephones','forEach','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','License','find','defaults','then','catch','uuid','data1','license','isEmpty','data2','split','decryptString'];(function(_0x4be24e,_0x1e9e6f){var _0x4d06ee=function(_0x18e3d2){while(--_0x18e3d2){_0x4be24e['push'](_0x4be24e['shift']());}};_0x4d06ee(++_0x1e9e6f);}(_0xe31a,0x74));var _0xae31=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xe31a[_0xbd08b4];return _0x314f1e;};'use strict';var util=require(_0xae31('0x0'));var _=require(_0xae31('0x1'));var moment=require(_0xae31('0x2'));var BPromise=require(_0xae31('0x3'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xae31('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xae31('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xae31('0x5'),'machineUuid':hardware[_0xae31('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x121116){return new BPromise(function(_0x4b6cfa,_0x2e7444){return db[_0xae31('0x7')][_0xae31('0x8')](_[_0xae31('0x9')](_0x121116,{'raw':!![],'where':{'id':0x1}}))[_0xae31('0xa')](function(_0x49382f){return checkLicense(_0x49382f,null);})[_0xae31('0xa')](function(_0x230c72){_0x4b6cfa(_0x230c72);return;})[_0xae31('0xb')](function(_0x14ba9b){_0x2e7444(_0x14ba9b);});});}function checkLicense(_0x2dedb3,_0x217878){if(!_0x2dedb3){demoLicense[_0xae31('0xc')]=_0x2dedb3[_0xae31('0xd')];return demoLicense;}try{var _0x14eb85=_0x217878||_0x2dedb3[_0xae31('0xe')];if(_[_0xae31('0xf')](_0x14eb85)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x5baddd=_0x2dedb3[_0xae31('0xd')];var _0xa257fe=_0x2dedb3[_0xae31('0x10')];var _0x5657d9=_0x5baddd[_0xae31('0x11')]('-')[0x4];var _0x33e672=_0x5baddd[_0xae31('0x11')]('-')[0x0];var _0x1ae019=encryptor[_0xae31('0x12')](_0x14eb85,util[_0xae31('0x13')](_0xae31('0x14'),_0x5657d9,_0x5baddd,_0x33e672));var _0x4490bd=JSON['parse'](_0x1ae019);_0x4490bd[_0xae31('0x15')]=![];_0x4490bd[_0xae31('0xc')]=_0x5baddd;_0x4490bd['machineUuid']=hardware[_0xae31('0x6')]();if(_0xa257fe){var _0x3e69d7=encryptor[_0xae31('0x12')](_0xa257fe);_0x4490bd['gray']=_0x3e69d7;_0x4490bd[_0xae31('0x16')]=moment(_0x3e69d7)[_0xae31('0x17')](0x7,_0xae31('0x18'))['format']();_0x4490bd[_0xae31('0x19')]=_0x4490bd[_0xae31('0xc')]!=_0x4490bd[_0xae31('0x1a')]?_0xae31('0x1b'):'disabled';}return _0x4490bd;}catch(_0x5275a5){breakingLicense[_0xae31('0xc')]=_0x2dedb3[_0xae31('0xd')];breakingLicense['message']=_0x5275a5[_0xae31('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x53a89e,_0x1ff93e){getLicense()['then'](function(_0x5c6957){return db[_0xae31('0x1d')][_0xae31('0x1e')]({'attributes':[_0xae31('0x1f'),[db[_0xae31('0x20')]['fn'](_0xae31('0x21'),db[_0xae31('0x20')]['col'](_0xae31('0x1f'))),_0xae31('0x22')]],'group':_0xae31('0x1f'),'where':{'role':{'$or':[_0xae31('0x23'),_0xae31('0x24'),_0xae31('0x25')]}},'raw':!![]})['then'](function(_0x3286cc){var _0x5b8639={'user':_0x5c6957[_0xae31('0x26')]||0x0,'telephone':_0x5c6957[_0xae31('0x27')]||0x0};_0x3286cc[_0xae31('0x28')](function(_0x31a0b2){var _0x4c94fa=_0x31a0b2[_0xae31('0x1f')]===_0xae31('0x23')?_0xae31('0x24'):_0x31a0b2['role'];_0x5b8639[_0x4c94fa]-=_0x31a0b2[_0xae31('0x22')];if(_0x5b8639[_0x4c94fa]<0x0)_0x5b8639[_0x4c94fa]=0x0;});_0x53a89e(_0x5b8639);return;});})[_0xae31('0xb')](function(_0x21eeb9){_0x1ff93e(_0x21eeb9);});});}function checkUserLimits(_0x3312b6){return new BPromise(function(_0x53759a,_0x3a8463){getLimits()[_0xae31('0xa')](function(_0x76becd){var _0x1cd565=_['pick'](_[_0xae31('0x29')](_0x3312b6,_0xae31('0x1f')),['admin',_0xae31('0x24'),_0xae31('0x25')]);var _0x1189d9=(_0x1cd565[_0xae31('0x23')]||0x0)+(_0x1cd565[_0xae31('0x24')]||0x0);var _0x5eea3f=_0x1cd565[_0xae31('0x25')]||0x0;if(_0x1189d9>_0x76becd['user'])return _0x3a8463(_0xae31('0x2a'));if(_0x5eea3f>_0x76becd[_0xae31('0x25')])return _0x3a8463(_0xae31('0x2b'));return _0x53759a();})[_0xae31('0xb')](function(_0x156c33){_0x3a8463(_0x156c33);});});}module[_0xae31('0x2c')]={'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 3a6b087..75c2971 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 _0x1a85=['secret','myappanuglar-secret','app-id'];(function(_0x306457,_0x38a617){var _0x39b402=function(_0x16b1db){while(--_0x16b1db){_0x306457['push'](_0x306457['shift']());}};_0x39b402(++_0x38a617);}(_0x1a85,0x178));var _0x51a8=function(_0x502953,_0x28de83){_0x502953=_0x502953-0x0;var _0x2fa32d=_0x1a85[_0x502953];return _0x2fa32d;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x51a8('0x0'),'GOOGLE_ID':_0x51a8('0x1'),'GOOGLE_SECRET':_0x51a8('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x4325=['app-id','secret','exports','http://localhost:9000'];(function(_0x509d9e,_0x2d1197){var _0x56b488=function(_0x1e98d0){while(--_0x1e98d0){_0x509d9e['push'](_0x509d9e['shift']());}};_0x56b488(++_0x2d1197);}(_0x4325,0x1da));var _0x5432=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4325[_0x4b369d];return _0x571a98;};'use strict';module[_0x5432('0x0')]={'DOMAIN':_0x5432('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x5432('0x2'),'GOOGLE_SECRET':_0x5432('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 57be4e9..cea9704 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3fa6=['YYYY-MM-DD\x20HH:mm:ss','toUpperCase','exports','Logger','transports','File','error','%s-%s','info','Console','env','debugLevel','moment','winston','util','INFO','join','/var','log','xcally','format','%s-%s.log','message','replace','[%s]\x20[%s]\x20%s\x20-\x20%s'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0x3fa6,0xa2));var _0x63fa=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x3fa6[_0x6cf19c];return _0xce14f3;};'use strict';var moment=require(_0x63fa('0x0'));var winston=require(_0x63fa('0x1'));var util=require(_0x63fa('0x2'));var path=require('path');var debugLevel=_0x63fa('0x3');function filename(_0x4f3740,_0x430fa6){return path[_0x63fa('0x4')](_0x63fa('0x5'),_0x63fa('0x6'),_0x63fa('0x7'),util[_0x63fa('0x8')](_0x63fa('0x9'),_0x4f3740,_0x430fa6));}function formatter(_0x2589a5,_0x77494d){_0x77494d[_0x63fa('0xa')]=_0x77494d[_0x63fa('0xa')][_0x63fa('0xb')](/@@{/g,'{{{')[_0x63fa('0xb')](/}@@/g,'}}}')[_0x63fa('0xb')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x63fa('0x8')](_0x63fa('0xc'),moment()[_0x63fa('0x8')](_0x63fa('0xd')),_0x77494d['level'][_0x63fa('0xe')](),_0x2589a5,_0x77494d[_0x63fa('0xa')]);}module[_0x63fa('0xf')]=function(_0x3aa45f){return new winston[(_0x63fa('0x10'))]({'transports':[new winston[(_0x63fa('0x11'))][(_0x63fa('0x12'))]({'name':util[_0x63fa('0x8')]('%s-%s',_0x3aa45f,_0x63fa('0x13')),'filename':filename(_0x3aa45f,_0x63fa('0x13')),'level':_0x63fa('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x240f09){return formatter(_0x3aa45f,_0x240f09);}}),new winston[(_0x63fa('0x11'))][(_0x63fa('0x12'))]({'name':util['format'](_0x63fa('0x14'),_0x3aa45f,_0x63fa('0x15')),'filename':filename(_0x3aa45f,'info'),'level':_0x63fa('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x19d834){return formatter(_0x3aa45f,_0x19d834);}}),new winston['transports'][(_0x63fa('0x16'))]({'level':process[_0x63fa('0x17')][_0x63fa('0x18')]||debugLevel,'json':![],'formatter':function(_0x3f0002){return formatter(_0x3aa45f,_0x3f0002);}})]});}; \ No newline at end of file +var _0x12fc=['}}}','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','util','path','INFO','join','log','xcally','format','%s-%s.log','message','replace'];(function(_0x4362fb,_0x20ef9c){var _0x534b21=function(_0x4840a6){while(--_0x4840a6){_0x4362fb['push'](_0x4362fb['shift']());}};_0x534b21(++_0x20ef9c);}(_0x12fc,0x155));var _0xc12f=function(_0x2d2c03,_0x868e62){_0x2d2c03=_0x2d2c03-0x0;var _0x1f8b85=_0x12fc[_0x2d2c03];return _0x1f8b85;};'use strict';var moment=require(_0xc12f('0x0'));var winston=require('winston');var util=require(_0xc12f('0x1'));var path=require(_0xc12f('0x2'));var debugLevel=_0xc12f('0x3');function filename(_0x47a034,_0x31a86d){return path[_0xc12f('0x4')]('/var',_0xc12f('0x5'),_0xc12f('0x6'),util[_0xc12f('0x7')](_0xc12f('0x8'),_0x47a034,_0x31a86d));}function formatter(_0x2edd5e,_0x395d48){_0x395d48[_0xc12f('0x9')]=_0x395d48['message']['replace'](/@@{/g,'{{{')[_0xc12f('0xa')](/}@@/g,_0xc12f('0xb'))[_0xc12f('0xa')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xc12f('0x7')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xc12f('0x7')](_0xc12f('0xc')),_0x395d48['level']['toUpperCase'](),_0x2edd5e,_0x395d48[_0xc12f('0x9')]);}module['exports']=function(_0x23ee6c){return new winston[(_0xc12f('0xd'))]({'transports':[new winston[(_0xc12f('0xe'))][(_0xc12f('0xf'))]({'name':util['format'](_0xc12f('0x10'),_0x23ee6c,'error'),'filename':filename(_0x23ee6c,_0xc12f('0x11')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3d1df4){return formatter(_0x23ee6c,_0x3d1df4);}}),new winston[(_0xc12f('0xe'))][(_0xc12f('0xf'))]({'name':util['format'](_0xc12f('0x10'),_0x23ee6c,_0xc12f('0x12')),'filename':filename(_0x23ee6c,'info'),'level':_0xc12f('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2cf242){return formatter(_0x23ee6c,_0x2cf242);}}),new winston[(_0xc12f('0xe'))][(_0xc12f('0x13'))]({'level':process[_0xc12f('0x14')][_0xc12f('0x15')]||debugLevel,'json':![],'formatter':function(_0xb0c531){return formatter(_0x23ee6c,_0xb0c531);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index bf267bb..c1386bd 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 _0x24a9=['ami','join','../../services/ami/index.js','agi','email','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','express','../../services/express/index.js'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x24a9,0x1b5));var _0x924a=function(_0x4740f8,_0x31261f){_0x4740f8=_0x4740f8-0x0;var _0x260ba9=_0x24a9[_0x4740f8];return _0x260ba9;};'use strict';var path=require(_0x924a('0x0'));var os=require('os');var config={'apps':[{'name':_0x924a('0x1'),'script':path['join'](__dirname,_0x924a('0x2'))},{'name':_0x924a('0x3'),'script':path[_0x924a('0x4')](__dirname,_0x924a('0x5'))},{'name':_0x924a('0x6'),'script':path[_0x924a('0x4')](__dirname,'../../services/agi/index.js')},{'name':_0x924a('0x7'),'script':path[_0x924a('0x4')](__dirname,'../../services/email/index.js')},{'name':'routing','script':path['join'](__dirname,_0x924a('0x8'))},{'name':_0x924a('0x9'),'script':path[_0x924a('0x4')](__dirname,_0x924a('0xa'))}]};module['exports']=config; \ No newline at end of file +var _0x9b8e=['../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr'];(function(_0x5280f4,_0x3c36d0){var _0xba93e7=function(_0x14d63a){while(--_0x14d63a){_0x5280f4['push'](_0x5280f4['shift']());}};_0xba93e7(++_0x3c36d0);}(_0x9b8e,0x91));var _0xe9b8=function(_0xd7daae,_0x5b4575){_0xd7daae=_0xd7daae-0x0;var _0x57dee8=_0x9b8e[_0xd7daae];return _0x57dee8;};'use strict';var path=require(_0xe9b8('0x0'));var os=require('os');var config={'apps':[{'name':_0xe9b8('0x1'),'script':path[_0xe9b8('0x2')](__dirname,_0xe9b8('0x3'))},{'name':_0xe9b8('0x4'),'script':path[_0xe9b8('0x2')](__dirname,_0xe9b8('0x5'))},{'name':'agi','script':path[_0xe9b8('0x2')](__dirname,_0xe9b8('0x6'))},{'name':'email','script':path['join'](__dirname,_0xe9b8('0x7'))},{'name':_0xe9b8('0x8'),'script':path['join'](__dirname,_0xe9b8('0x9'))},{'name':_0xe9b8('0xa'),'script':path['join'](__dirname,_0xe9b8('0xb'))}]};module[_0xe9b8('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 5d722b0..c6182f2 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 _0xc928=['bluebird','connect','start','then','stop','disconnect','restart','list','describe','delete','dump','saved'];(function(_0x1f0513,_0x441ef4){var _0x5cf726=function(_0x335288){while(--_0x335288){_0x1f0513['push'](_0x1f0513['shift']());}};_0x5cf726(++_0x441ef4);}(_0xc928,0x138));var _0x8c92=function(_0x21de29,_0x59000a){_0x21de29=_0x21de29-0x0;var _0x5ef40e=_0xc928[_0x21de29];return _0x5ef40e;};'use strict';var pm2=require('pm2');var BPromise=require(_0x8c92('0x0'));var config=require('./config');function connect(){return new BPromise(function(_0x4e149d,_0x23119c){return pm2[_0x8c92('0x1')](function(_0x3d1c8a){if(_0x3d1c8a){return _0x23119c(_0x3d1c8a);}return _0x4e149d('connected');});});};exports[_0x8c92('0x2')]=function(_0x32e913){return connect()[_0x8c92('0x3')](function(){return new BPromise(function(_0x2d986f,_0x38613e){return pm2[_0x8c92('0x2')](_0x32e913,function(_0xdc3e,_0x2f0d2c){if(_0xdc3e){return _0x38613e(_0xdc3e);}pm2['disconnect']();return _0x2d986f(_0x2f0d2c);});});});};exports['stop']=function(_0x1e30d3){return connect()['then'](function(){return new BPromise(function(_0x1d46a0,_0x16799d){return pm2[_0x8c92('0x4')](_0x1e30d3,function(_0x51aa8f,_0x1fb687){if(_0x51aa8f){return _0x16799d(_0x51aa8f);}pm2[_0x8c92('0x5')]();return _0x1d46a0(_0x1fb687);});});});};exports[_0x8c92('0x6')]=function(_0x3f54c1){return connect()[_0x8c92('0x3')](function(){return new BPromise(function(_0x1f40ed,_0x3e747e){return pm2[_0x8c92('0x6')](_0x3f54c1,function(_0x4c5b4e,_0x13d0eb){if(_0x4c5b4e){return _0x3e747e(_0x4c5b4e);}pm2[_0x8c92('0x5')]();return _0x1f40ed(_0x13d0eb);});});});};exports[_0x8c92('0x7')]=function(){return connect()[_0x8c92('0x3')](function(){return new BPromise(function(_0xbe15c8,_0x249d20){return pm2[_0x8c92('0x7')](function(_0x1d9c2b,_0x37f82e){if(_0x1d9c2b){return _0x249d20(_0x1d9c2b);}pm2[_0x8c92('0x5')]();return _0xbe15c8(_0x37f82e);});});});};exports[_0x8c92('0x8')]=function(_0x5ee7f0){return connect()[_0x8c92('0x3')](function(){return new BPromise(function(_0x5457fb,_0x3e03a4){return pm2['describe'](_0x5ee7f0,function(_0x651484,_0x56304b){if(_0x651484){return _0x3e03a4(_0x651484);}pm2[_0x8c92('0x5')]();return _0x5457fb(_0x56304b);});});});};exports['delete']=function(_0x5b751c){return connect()[_0x8c92('0x3')](function(){return new BPromise(function(_0x11ffb3,_0x5b119f){return pm2[_0x8c92('0x9')](_0x5b751c,function(_0x3b0ae1,_0x576696){if(_0x3b0ae1){return _0x5b119f(_0x3b0ae1);}pm2[_0x8c92('0x5')]();return _0x11ffb3(_0x576696);});});});};exports['dump']=function(){return connect()[_0x8c92('0x3')](function(){return new BPromise(function(_0x5f52a9,_0x51b3a7){return pm2[_0x8c92('0xa')](function(_0x364b61){if(_0x364b61){return _0x51b3a7(_0x364b61);}return _0x5f52a9(_0x8c92('0xb'));});});});}; \ No newline at end of file +var _0x34fb=['./config','connected','start','then','stop','disconnect','restart','list','describe','delete','dump','saved','pm2','bluebird'];(function(_0x46f800,_0x404d02){var _0x230e63=function(_0x3a5dfd){while(--_0x3a5dfd){_0x46f800['push'](_0x46f800['shift']());}};_0x230e63(++_0x404d02);}(_0x34fb,0xc2));var _0xb34f=function(_0x3a14d6,_0xbb5594){_0x3a14d6=_0x3a14d6-0x0;var _0x590dc6=_0x34fb[_0x3a14d6];return _0x590dc6;};'use strict';var pm2=require(_0xb34f('0x0'));var BPromise=require(_0xb34f('0x1'));var config=require(_0xb34f('0x2'));function connect(){return new BPromise(function(_0x388013,_0x418a52){return pm2['connect'](function(_0x2c70ac){if(_0x2c70ac){return _0x418a52(_0x2c70ac);}return _0x388013(_0xb34f('0x3'));});});};exports[_0xb34f('0x4')]=function(_0x72ca71){return connect()[_0xb34f('0x5')](function(){return new BPromise(function(_0x2f9ced,_0x243e7a){return pm2['start'](_0x72ca71,function(_0x766310,_0x564292){if(_0x766310){return _0x243e7a(_0x766310);}pm2['disconnect']();return _0x2f9ced(_0x564292);});});});};exports[_0xb34f('0x6')]=function(_0x1b962b){return connect()['then'](function(){return new BPromise(function(_0x57c396,_0x45b8c0){return pm2[_0xb34f('0x6')](_0x1b962b,function(_0x4b18da,_0x36d02e){if(_0x4b18da){return _0x45b8c0(_0x4b18da);}pm2[_0xb34f('0x7')]();return _0x57c396(_0x36d02e);});});});};exports[_0xb34f('0x8')]=function(_0x51d5a9){return connect()['then'](function(){return new BPromise(function(_0x1a984e,_0x2ba0c0){return pm2['restart'](_0x51d5a9,function(_0x263d01,_0x511365){if(_0x263d01){return _0x2ba0c0(_0x263d01);}pm2[_0xb34f('0x7')]();return _0x1a984e(_0x511365);});});});};exports[_0xb34f('0x9')]=function(){return connect()[_0xb34f('0x5')](function(){return new BPromise(function(_0x26fb4a,_0x55d403){return pm2[_0xb34f('0x9')](function(_0x4ca187,_0x385a19){if(_0x4ca187){return _0x55d403(_0x4ca187);}pm2[_0xb34f('0x7')]();return _0x26fb4a(_0x385a19);});});});};exports[_0xb34f('0xa')]=function(_0x4a8ab7){return connect()['then'](function(){return new BPromise(function(_0x248303,_0x4b1486){return pm2[_0xb34f('0xa')](_0x4a8ab7,function(_0x3d3c64,_0x31001c){if(_0x3d3c64){return _0x4b1486(_0x3d3c64);}pm2[_0xb34f('0x7')]();return _0x248303(_0x31001c);});});});};exports[_0xb34f('0xb')]=function(_0x372627){return connect()[_0xb34f('0x5')](function(){return new BPromise(function(_0xb328cf,_0x42ed3f){return pm2[_0xb34f('0xb')](_0x372627,function(_0x4f43f2,_0x336569){if(_0x4f43f2){return _0x42ed3f(_0x4f43f2);}pm2['disconnect']();return _0xb328cf(_0x336569);});});});};exports[_0xb34f('0xc')]=function(){return connect()[_0xb34f('0x5')](function(){return new BPromise(function(_0x36ade1,_0x4a1d84){return pm2['dump'](function(_0x395fe4){if(_0x395fe4){return _0x4a1d84(_0x395fe4);}return _0x36ade1(_0xb34f('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index a8b8d1a..c59345f 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 _0x6ddc=['subtract','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','lastMsgAt'];(function(_0x446208,_0xb483fb){var _0xe49563=function(_0x1d3a21){while(--_0x1d3a21){_0x446208['push'](_0x446208['shift']());}};_0xe49563(++_0xb483fb);}(_0x6ddc,0x118));var _0xc6dd=function(_0x3e0d7d,_0x5a6a83){_0x3e0d7d=_0x3e0d7d-0x0;var _0x269866=_0x6ddc[_0x3e0d7d];return _0x269866;};'use strict';var _=require('lodash');var moment=require(_0xc6dd('0x0'));var Redis=require(_0xc6dd('0x1'));var util=require(_0xc6dd('0x2'));var config=require(_0xc6dd('0x3'));var db=require(_0xc6dd('0x4'))['db'];var logger=require(_0xc6dd('0x5'))(_0xc6dd('0x6'));config[_0xc6dd('0x7')]=_[_0xc6dd('0x8')](config[_0xc6dd('0x7')],{'host':_0xc6dd('0x9'),'port':0x18eb});var io=require(_0xc6dd('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x58e42b=0x0;var _0x1e7725=[];return db[_0xc6dd('0xb')][_0xc6dd('0xc')]({'raw':!![],'attributes':['id',_0xc6dd('0xd')],'where':{'id':0x1}})[_0xc6dd('0xe')](function(_0x4c0039){_0x58e42b=_0x4c0039['chatTimeout'];if(_0x58e42b){return db[_0xc6dd('0xf')]['findAll']({'raw':!![],'attributes':['id',_0xc6dd('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xc6dd('0x11')](_0x4c0039[_0xc6dd('0xd')],_0xc6dd('0x12'))}}});}else{return[];}})[_0xc6dd('0xe')](function(_0x4240f9){if(_0x4240f9&&_0x4240f9[_0xc6dd('0x13')]){_0x1e7725=_[_0xc6dd('0x14')](_0x4240f9||[],'id');logger['info'](_0xc6dd('0x15'),_0x1e7725[_0xc6dd('0x16')]());return db['ChatInteraction'][_0xc6dd('0x17')]({'closeReason':_0xc6dd('0x18'),'disposition':_0xc6dd('0x19'),'closed':!![],'closedAt':moment()['format'](_0xc6dd('0x1a'))},{'where':{'id':_0x1e7725}});}})[_0xc6dd('0xe')](function(){if(_0x1e7725&&_0x1e7725['length']){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x1e7725[_0xc6dd('0x16')]());for(var _0x544914=0x0;_0x544914<_0x1e7725['length'];_0x544914++){io['emit'](_0xc6dd('0x1b'),{'id':_0x1e7725[_0x544914],'closed':!![]});}}})[_0xc6dd('0x1c')](function(_0x33eba4){logger[_0xc6dd('0x1d')](_0xc6dd('0x1e'),_0x33eba4?util[_0xc6dd('0x1f')](_0x33eba4,{'showHidden':![],'depth':null}):'');});}exports[_0xc6dd('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x48c3=['info','join','update','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length'];(function(_0x41bded,_0x14818b){var _0x288128=function(_0x40d251){while(--_0x40d251){_0x41bded['push'](_0x41bded['shift']());}};_0x288128(++_0x14818b);}(_0x48c3,0x161));var _0x348c=function(_0x5e5713,_0x22004c){_0x5e5713=_0x5e5713-0x0;var _0x37ef7b=_0x48c3[_0x5e5713];return _0x37ef7b;};'use strict';var _=require('lodash');var moment=require(_0x348c('0x0'));var Redis=require(_0x348c('0x1'));var util=require(_0x348c('0x2'));var config=require('../../config/environment');var db=require(_0x348c('0x3'))['db'];var logger=require(_0x348c('0x4'))(_0x348c('0x5'));config[_0x348c('0x6')]=_[_0x348c('0x7')](config[_0x348c('0x6')],{'host':_0x348c('0x8'),'port':0x18eb});var io=require(_0x348c('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x2dfc6b=0x0;var _0x30fd43=[];return db['Setting'][_0x348c('0xa')]({'raw':!![],'attributes':['id',_0x348c('0xb')],'where':{'id':0x1}})[_0x348c('0xc')](function(_0x1eaafd){_0x2dfc6b=_0x1eaafd[_0x348c('0xb')];if(_0x2dfc6b){return db[_0x348c('0xd')][_0x348c('0xe')]({'raw':!![],'attributes':['id',_0x348c('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x348c('0x10')](_0x1eaafd[_0x348c('0xb')],_0x348c('0x11'))}}});}else{return[];}})['then'](function(_0x5c88c7){if(_0x5c88c7&&_0x5c88c7[_0x348c('0x12')]){_0x30fd43=_['map'](_0x5c88c7||[],'id');logger[_0x348c('0x13')]('[CHAT]\x20Interactions\x20to\x20close:',_0x30fd43[_0x348c('0x14')]());return db[_0x348c('0xd')][_0x348c('0x15')]({'closeReason':_0x348c('0x16'),'disposition':_0x348c('0x17'),'closed':!![],'closedAt':moment()[_0x348c('0x18')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x30fd43}});}})[_0x348c('0xc')](function(){if(_0x30fd43&&_0x30fd43[_0x348c('0x12')]){logger[_0x348c('0x13')](_0x348c('0x19'),_0x30fd43[_0x348c('0x14')]());for(var _0x19ec20=0x0;_0x19ec20<_0x30fd43[_0x348c('0x12')];_0x19ec20++){io['emit'](_0x348c('0x1a'),{'id':_0x30fd43[_0x19ec20],'closed':!![]});}}})['catch'](function(_0x30ca94){logger[_0x348c('0x1b')](_0x348c('0x1c'),_0x30ca94?util[_0x348c('0x1d')](_0x30ca94,{'showHidden':![],'depth':null}):'');});}exports[_0x348c('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 0330f20..4f6e400 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 _0xb865=['intersection','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','index','resolve','run\x20job','cron','active','startAt','endAt','add','start','add\x20cron','stop\x20cron','update','update\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','email','Smtp','service','MailAccount','host','port','secure','authentication','user','format','\x22%s\x22\x20<%s>','name','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','status','Sent','attachments','message','text','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','error','error\x20mail','stringify','info','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','then','catch','CustomReportId','no\x20report\x20id','findAll','keys','jobs','map','toString','keyBy'];(function(_0x3802dd,_0x426503){var _0x2af66a=function(_0x1558bb){while(--_0x1558bb){_0x3802dd['push'](_0x3802dd['shift']());}};_0x2af66a(++_0x426503);}(_0xb865,0x6e));var _0x5b86=function(_0x397bbb,_0x578c5){_0x397bbb=_0x397bbb-0x0;var _0x3ff4cc=_0xb865[_0x397bbb];return _0x3ff4cc;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x5b86('0x0'));var _=require(_0x5b86('0x1'));var moment=require(_0x5b86('0x2'));var CronJobManager=require(_0x5b86('0x3'));var jayson=require(_0x5b86('0x4'));var BPromise=require(_0x5b86('0x5'));var logger=require(_0x5b86('0x6'))(_0x5b86('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x5b86('0x8'));var analyticDefaultReportController=require(_0x5b86('0x9'));var client=jayson[_0x5b86('0xa')][_0x5b86('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x8ee03f,_0x34fa96){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x8ee03f[_0x5b86('0xc')]);var _0x523cfd=!![];var _0x447462={'tls':{'rejectUnauthorized':![]}};if(_0x8ee03f['MailAccount'][_0x5b86('0xd')]['service']){_0x447462[_0x5b86('0xe')]=_0x8ee03f[_0x5b86('0xf')][_0x5b86('0xd')][_0x5b86('0xe')];}else{_0x447462[_0x5b86('0x10')]=_0x8ee03f[_0x5b86('0xf')][_0x5b86('0xd')][_0x5b86('0x10')];_0x447462[_0x5b86('0x11')]=_0x8ee03f['MailAccount'][_0x5b86('0xd')]['port'];_0x447462[_0x5b86('0x12')]=_0x8ee03f[_0x5b86('0xf')]['Smtp']['secure'];}if(_0x8ee03f['MailAccount'][_0x5b86('0xd')][_0x5b86('0x13')]){_0x447462['auth']={'user':_0x8ee03f['MailAccount'][_0x5b86('0xd')][_0x5b86('0x14')],'pass':_0x8ee03f[_0x5b86('0xf')][_0x5b86('0xd')]['pass']};}var _0x205b08={'account':_0x447462,'message':{'from':util[_0x5b86('0x15')](_0x5b86('0x16'),_0x8ee03f[_0x5b86('0xf')][_0x5b86('0x17')],_0x8ee03f[_0x5b86('0xf')]['email']||_0x8ee03f['MailAccount']['Smtp'][_0x5b86('0x14')]),'to':_0x8ee03f['email'],'cc':_0x8ee03f['cc'],'bcc':_0x8ee03f[_0x5b86('0x18')],'subject':util[_0x5b86('0x15')]('Report\x20%s\x20last\x20%s\x20%s',_0x34fa96[_0x5b86('0x17')],_0x8ee03f[_0x5b86('0x19')],_0x8ee03f[_0x5b86('0x1a')])}};var _0xb4eaf1=path[_0x5b86('0x1b')](__dirname,_0x5b86('0x1c'));var _0x1c593f=_0x34fa96[_0x5b86('0x1d')];var _0x2147cc=util['format'](_0x5b86('0x1e'),path[_0x5b86('0x1f')](_0x34fa96[_0x5b86('0x1d')],path[_0x5b86('0x20')](_0x34fa96[_0x5b86('0x1d')])),_0x5b86('0x21'));var _0x519466=path[_0x5b86('0x1b')](_0xb4eaf1,_0x1c593f);var _0x4316db=path[_0x5b86('0x1b')](_0xb4eaf1,_0x2147cc);if(fs['existsSync'](_0x519466)){_0x34fa96[_0x5b86('0x22')]=_0x5b86('0x23');_0x205b08['message'][_0x5b86('0x24')]=[{'filename':_0x1c593f,'path':_0x519466}];_0x205b08[_0x5b86('0x25')][_0x5b86('0x26')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x34fa96,null,0x2));}else if(fs[_0x5b86('0x27')](_0x4316db)){_0x34fa96[_0x5b86('0x22')]=_0x5b86('0x23');_0x205b08[_0x5b86('0x25')][_0x5b86('0x24')]=[{'filename':_0x2147cc,'path':_0x4316db}];}else{_0x205b08[_0x5b86('0x25')][_0x5b86('0x26')]=_0x5b86('0x28');if(!_0x8ee03f[_0x5b86('0x29')]){_0x523cfd=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x523cfd){return client['request']('SendMail',_0x205b08)['then'](function(_0x4dd6f0){if(_0x4dd6f0['error']){return logger[_0x5b86('0x2a')](_0x5b86('0x2b'),JSON[_0x5b86('0x2c')](_0x4dd6f0));}return logger[_0x5b86('0x2d')]('email\x20sent');})['catch'](function(_0x52ef16){return logger[_0x5b86('0x2a')]('error\x20mail',JSON[_0x5b86('0x2c')](_0x52ef16));});}};}function handleError(){return function(_0x571f9a){return logger[_0x5b86('0x2a')](JSON[_0x5b86('0x2c')](_0x571f9a));};}function handleResult(_0x21b661){return function(_0xe5bb23){logger[_0x5b86('0x2d')]('data',JSON[_0x5b86('0x2c')](_0xe5bb23));if(_0x21b661[_0x5b86('0xf')]&&_0x21b661[_0x5b86('0xf')][_0x5b86('0xd')]&&!_[_0x5b86('0x2e')](_0x21b661[_0x5b86('0xc')])){setTimeout(handleSendEmail(_0x21b661,_0xe5bb23),0x3c*0x3e8);}};}function handleJob(_0x4e8cc3){return function(){try{if(_[_0x5b86('0x2e')](_0x4e8cc3[_0x5b86('0x19')])){return logger[_0x5b86('0x2d')](_0x5b86('0x2f'));}if(_[_0x5b86('0x2e')](_0x4e8cc3[_0x5b86('0x1a')])){return logger[_0x5b86('0x2d')](_0x5b86('0x30'));}var _0x579618={'startDate':moment()[_0x5b86('0x31')](_0x4e8cc3[_0x5b86('0x19')],_0x4e8cc3['subtractUnit'])[_0x5b86('0x15')](_0x5b86('0x32')),'endDate':moment()['format'](_0x5b86('0x32')),'type':_0x5b86('0x33'),'output':_0x4e8cc3[_0x5b86('0x34')],'name':_0x4e8cc3[_0x5b86('0x17')]};if(!_[_0x5b86('0x2e')](_0x4e8cc3['DefaultReportId'])){logger['info'](_0x5b86('0x35'),_0x4e8cc3[_0x5b86('0x36')]);return analyticDefaultReportController[_0x5b86('0x37')]({'id':_0x4e8cc3[_0x5b86('0x36')]},_0x579618)[_0x5b86('0x38')](handleResult(_0x4e8cc3))[_0x5b86('0x39')](handleError());}if(!_[_0x5b86('0x2e')](_0x4e8cc3['CustomReportId'])){logger[_0x5b86('0x2d')]('exec\x20custom\x20report\x20id:%s',_0x4e8cc3[_0x5b86('0x3a')]);return analyticCustomReportController[_0x5b86('0x37')]({'id':_0x4e8cc3[_0x5b86('0x3a')]},_0x579618)[_0x5b86('0x38')](handleResult(_0x4e8cc3))['catch'](handleError());}}catch(_0x287b70){logger[_0x5b86('0x2a')](JSON[_0x5b86('0x2c')](_0x287b70));}return logger[_0x5b86('0x2d')](_0x5b86('0x3b'));};}function getJobs(_0x2c5466){var _0x2f2faa={};if(_0x2c5466){_0x2f2faa['id']=_0x2c5466;}return db['Schedule'][_0x5b86('0x3c')]({'where':_0x2f2faa,'include':[{'model':db[_0x5b86('0xf')],'attributes':['id',_0x5b86('0x17'),_0x5b86('0xc')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]}]})[_0x5b86('0x38')](function(_0x2c3d1c){var _0x40d0ae=_[_0x5b86('0x3d')](manager[_0x5b86('0x3e')]);var _0x188cd8=_[_0x5b86('0x3f')](_0x2c3d1c,function(_0x325a69){return _0x325a69['id'][_0x5b86('0x40')]();});var _0x5ee31c=_[_0x5b86('0x41')](_0x2c3d1c,function(_0x10c525){return _0x10c525['id'][_0x5b86('0x40')]();});var _0x3aa27a=_0x2c5466?_0x188cd8:_['difference'](_0x188cd8,_0x40d0ae);var _0x1b96b4=_[_0x5b86('0x42')](_0x188cd8,_0x40d0ae);var _0x1204bb=_[_0x5b86('0x43')](_0x40d0ae,_0x188cd8);var _0x4cfb84;var _0x1c2396;for(_0x4cfb84=0x0;_0x4cfb84<_0x1204bb[_0x5b86('0x44')]&&!_0x2c5466;_0x4cfb84+=0x1){_0x1c2396=_0x1204bb[_0x4cfb84][_0x5b86('0x40')]();if(manager[_0x5b86('0x45')](_0x1c2396)){manager[_0x5b86('0x46')](_0x1c2396);manager[_0x5b86('0x47')](_0x1c2396);logger[_0x5b86('0x2d')](_0x5b86('0x48'),_0x1c2396);}}logger[_0x5b86('0x2d')](_0x5b86('0x49'),JSON[_0x5b86('0x2c')](_0x3aa27a));for(_0x4cfb84=0x0;_0x4cfb84<_0x3aa27a[_0x5b86('0x44')];_0x4cfb84+=0x1){_0x1c2396=_0x3aa27a[_0x4cfb84]['toString']();logger['info'](_0x5b86('0x4a'),_0x1c2396);if(_0x2c5466){logger[_0x5b86('0x2d')]('my\x20id',_0x2c5466);logger[_0x5b86('0x2d')](JSON[_0x5b86('0x2c')](_0x5ee31c[_0x1c2396]));BPromise[_0x5b86('0x4b')]()[_0x5b86('0x38')](handleJob(_0x5ee31c[_0x1c2396]));logger[_0x5b86('0x2d')](_0x5b86('0x4c'),_0x5ee31c[_0x1c2396][_0x5b86('0x17')],_0x5ee31c[_0x1c2396][_0x5b86('0x4d')]);}else if(_0x5ee31c[_0x1c2396][_0x5b86('0x4d')]&&_0x5ee31c[_0x1c2396][_0x5b86('0x4e')]&&moment()['isBetween'](_0x5ee31c[_0x1c2396][_0x5b86('0x4f')],_0x5ee31c[_0x1c2396][_0x5b86('0x50')])){manager[_0x5b86('0x51')](_0x1c2396,_0x5ee31c[_0x1c2396][_0x5b86('0x4d')],handleJob(_0x5ee31c[_0x1c2396]));manager[_0x5b86('0x52')](_0x1c2396);logger[_0x5b86('0x2d')](_0x5b86('0x53'),_0x5ee31c[_0x1c2396][_0x5b86('0x17')],_0x5ee31c[_0x1c2396][_0x5b86('0x4d')]);}else if(manager[_0x5b86('0x45')](_0x1c2396)){manager[_0x5b86('0x46')](_0x1c2396);manager[_0x5b86('0x47')](_0x1c2396);logger['info'](_0x5b86('0x54'),_0x5ee31c[_0x1c2396][_0x5b86('0x17')],_0x5ee31c[_0x1c2396][_0x5b86('0x4d')]);}}for(_0x4cfb84=0x0,_0x1c2396;_0x4cfb84<_0x1b96b4['length']&&!_0x2c5466;_0x4cfb84+=0x1){_0x1c2396=_0x1b96b4[_0x4cfb84][_0x5b86('0x40')]();if(manager[_0x5b86('0x45')](_0x1c2396)){if(_0x5ee31c[_0x1c2396][_0x5b86('0x4d')]&&_0x5ee31c[_0x1c2396][_0x5b86('0x4e')]&&moment()['isBetween'](_0x5ee31c[_0x1c2396]['startAt'],_0x5ee31c[_0x1c2396][_0x5b86('0x50')])){manager[_0x5b86('0x55')](_0x1c2396,_0x5ee31c[_0x1c2396][_0x5b86('0x4d')],handleJob(_0x5ee31c[_0x1c2396]));logger[_0x5b86('0x2d')](_0x5b86('0x56'),_0x5ee31c[_0x1c2396][_0x5b86('0x17')],_0x5ee31c[_0x1c2396][_0x5b86('0x4d')]);}else{manager[_0x5b86('0x46')](_0x1c2396);manager[_0x5b86('0x47')](_0x1c2396);logger[_0x5b86('0x2d')]('stop\x20cron',_0x5ee31c[_0x1c2396][_0x5b86('0x17')],_0x5ee31c[_0x1c2396][_0x5b86('0x4d')]);}}}})[_0x5b86('0x39')](function(_0x4a7ea6){logger['error'](JSON[_0x5b86('0x2c')](_0x4a7ea6));});}exports[_0x5b86('0x57')]=function(_0x1199a5){return getJobs(_0x1199a5);};exports[_0x5b86('0x52')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x4d0d=['add','start','add\x20cron','stop\x20cron','update','update\x20cron','run','path','lodash','moment','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','email','MailAccount','Smtp','service','host','port','secure','auth','pass','name','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','%s.%s','basename','savename','zip','Sent','attachments','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','message','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','email\x20sent','error\x20mail','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','keys','jobs','keyBy','toString','difference','exists','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt'];(function(_0x14bee3,_0x5ac92a){var _0x1a947c=function(_0x46778a){while(--_0x46778a){_0x14bee3['push'](_0x14bee3['shift']());}};_0x1a947c(++_0x5ac92a);}(_0x4d0d,0xb5));var _0xd4d0=function(_0x45f3a4,_0x39be2e){_0x45f3a4=_0x45f3a4-0x0;var _0x49c175=_0x4d0d[_0x45f3a4];return _0x49c175;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xd4d0('0x0'));var _=require(_0xd4d0('0x1'));var moment=require(_0xd4d0('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xd4d0('0x3'));var BPromise=require(_0xd4d0('0x4'));var logger=require('../logger')(_0xd4d0('0x5'));var db=require(_0xd4d0('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xd4d0('0x7'));var client=jayson['client'][_0xd4d0('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4c89d2,_0x4acf0a){return function(){logger[_0xd4d0('0x9')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x4c89d2[_0xd4d0('0xa')]);var _0x528e27=!![];var _0x1a739b={'tls':{'rejectUnauthorized':![]}};if(_0x4c89d2[_0xd4d0('0xb')][_0xd4d0('0xc')][_0xd4d0('0xd')]){_0x1a739b[_0xd4d0('0xd')]=_0x4c89d2['MailAccount'][_0xd4d0('0xc')]['service'];}else{_0x1a739b[_0xd4d0('0xe')]=_0x4c89d2[_0xd4d0('0xb')]['Smtp'][_0xd4d0('0xe')];_0x1a739b[_0xd4d0('0xf')]=_0x4c89d2[_0xd4d0('0xb')][_0xd4d0('0xc')][_0xd4d0('0xf')];_0x1a739b[_0xd4d0('0x10')]=_0x4c89d2[_0xd4d0('0xb')][_0xd4d0('0xc')][_0xd4d0('0x10')];}if(_0x4c89d2[_0xd4d0('0xb')][_0xd4d0('0xc')]['authentication']){_0x1a739b[_0xd4d0('0x11')]={'user':_0x4c89d2[_0xd4d0('0xb')]['Smtp']['user'],'pass':_0x4c89d2[_0xd4d0('0xb')][_0xd4d0('0xc')][_0xd4d0('0x12')]};}var _0x5a76f5={'account':_0x1a739b,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x4c89d2['MailAccount'][_0xd4d0('0x13')],_0x4c89d2['MailAccount']['email']||_0x4c89d2[_0xd4d0('0xb')][_0xd4d0('0xc')][_0xd4d0('0x14')]),'to':_0x4c89d2[_0xd4d0('0xa')],'cc':_0x4c89d2['cc'],'bcc':_0x4c89d2[_0xd4d0('0x15')],'subject':util[_0xd4d0('0x16')](_0xd4d0('0x17'),_0x4acf0a[_0xd4d0('0x13')],_0x4c89d2['subtractNumber'],_0x4c89d2[_0xd4d0('0x18')])}};var _0x5e735a=path[_0xd4d0('0x19')](__dirname,_0xd4d0('0x1a'));var _0x287c34=_0x4acf0a['savename'];var _0xd92061=util[_0xd4d0('0x16')](_0xd4d0('0x1b'),path[_0xd4d0('0x1c')](_0x4acf0a[_0xd4d0('0x1d')],path['extname'](_0x4acf0a[_0xd4d0('0x1d')])),_0xd4d0('0x1e'));var _0x451c39=path[_0xd4d0('0x19')](_0x5e735a,_0x287c34);var _0x2a25c0=path[_0xd4d0('0x19')](_0x5e735a,_0xd92061);if(fs['existsSync'](_0x451c39)){_0x4acf0a['status']=_0xd4d0('0x1f');_0x5a76f5['message'][_0xd4d0('0x20')]=[{'filename':_0x287c34,'path':_0x451c39}];_0x5a76f5['message'][_0xd4d0('0x21')]=util['format'](_0xd4d0('0x22'),JSON[_0xd4d0('0x23')](_0x4acf0a,null,0x2));}else if(fs['existsSync'](_0x2a25c0)){_0x4acf0a['status']='Sent';_0x5a76f5[_0xd4d0('0x24')]['attachments']=[{'filename':_0xd92061,'path':_0x2a25c0}];}else{_0x5a76f5[_0xd4d0('0x24')][_0xd4d0('0x21')]=_0xd4d0('0x25');if(!_0x4c89d2[_0xd4d0('0x26')]){_0x528e27=![];logger[_0xd4d0('0x9')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x528e27){return client[_0xd4d0('0x27')](_0xd4d0('0x28'),_0x5a76f5)[_0xd4d0('0x29')](function(_0x95473a){if(_0x95473a['error']){return logger[_0xd4d0('0x2a')]('error\x20mail',JSON[_0xd4d0('0x23')](_0x95473a));}return logger[_0xd4d0('0x9')](_0xd4d0('0x2b'));})['catch'](function(_0x474b8e){return logger['error'](_0xd4d0('0x2c'),JSON[_0xd4d0('0x23')](_0x474b8e));});}};}function handleError(){return function(_0x3b9486){return logger[_0xd4d0('0x2a')](JSON[_0xd4d0('0x23')](_0x3b9486));};}function handleResult(_0x2b65dd){return function(_0x1fa536){logger[_0xd4d0('0x9')](_0xd4d0('0x2d'),JSON[_0xd4d0('0x23')](_0x1fa536));if(_0x2b65dd['MailAccount']&&_0x2b65dd[_0xd4d0('0xb')][_0xd4d0('0xc')]&&!_[_0xd4d0('0x2e')](_0x2b65dd[_0xd4d0('0xa')])){setTimeout(handleSendEmail(_0x2b65dd,_0x1fa536),0x3c*0x3e8);}};}function handleJob(_0x531e69){return function(){try{if(_[_0xd4d0('0x2e')](_0x531e69[_0xd4d0('0x2f')])){return logger[_0xd4d0('0x9')](_0xd4d0('0x30'));}if(_['isNil'](_0x531e69[_0xd4d0('0x18')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x499caa={'startDate':moment()[_0xd4d0('0x31')](_0x531e69['subtractNumber'],_0x531e69[_0xd4d0('0x18')])[_0xd4d0('0x16')](_0xd4d0('0x32')),'endDate':moment()[_0xd4d0('0x16')](_0xd4d0('0x32')),'type':_0xd4d0('0x33'),'output':_0x531e69['output'],'name':_0x531e69[_0xd4d0('0x13')]};if(!_['isNil'](_0x531e69[_0xd4d0('0x34')])){logger[_0xd4d0('0x9')]('exec\x20defaul\x20report\x20id:%s',_0x531e69[_0xd4d0('0x34')]);return analyticDefaultReportController[_0xd4d0('0x35')]({'id':_0x531e69[_0xd4d0('0x34')]},_0x499caa)[_0xd4d0('0x29')](handleResult(_0x531e69))[_0xd4d0('0x36')](handleError());}if(!_['isNil'](_0x531e69[_0xd4d0('0x37')])){logger[_0xd4d0('0x9')](_0xd4d0('0x38'),_0x531e69[_0xd4d0('0x37')]);return analyticCustomReportController[_0xd4d0('0x35')]({'id':_0x531e69[_0xd4d0('0x37')]},_0x499caa)[_0xd4d0('0x29')](handleResult(_0x531e69))['catch'](handleError());}}catch(_0xe50d0e){logger[_0xd4d0('0x2a')](JSON[_0xd4d0('0x23')](_0xe50d0e));}return logger[_0xd4d0('0x9')]('no\x20report\x20id');};}function getJobs(_0x496637){var _0x18cbea={};if(_0x496637){_0x18cbea['id']=_0x496637;}return db[_0xd4d0('0x39')][_0xd4d0('0x3a')]({'where':_0x18cbea,'include':[{'model':db[_0xd4d0('0xb')],'attributes':['id',_0xd4d0('0x13'),'email'],'include':[{'model':db[_0xd4d0('0x3b')],'as':_0xd4d0('0xc')}]}]})[_0xd4d0('0x29')](function(_0x10ab6f){var _0x3aec21=_[_0xd4d0('0x3c')](manager[_0xd4d0('0x3d')]);var _0x4879da=_['map'](_0x10ab6f,function(_0x4d6018){return _0x4d6018['id']['toString']();});var _0x37cb45=_[_0xd4d0('0x3e')](_0x10ab6f,function(_0x4fe2e6){return _0x4fe2e6['id'][_0xd4d0('0x3f')]();});var _0x4081b9=_0x496637?_0x4879da:_[_0xd4d0('0x40')](_0x4879da,_0x3aec21);var _0x23b089=_['intersection'](_0x4879da,_0x3aec21);var _0x35ac4b=_[_0xd4d0('0x40')](_0x3aec21,_0x4879da);var _0x5e9655;var _0x4501c0;for(_0x5e9655=0x0;_0x5e9655<_0x35ac4b['length']&&!_0x496637;_0x5e9655+=0x1){_0x4501c0=_0x35ac4b[_0x5e9655][_0xd4d0('0x3f')]();if(manager[_0xd4d0('0x41')](_0x4501c0)){manager[_0xd4d0('0x42')](_0x4501c0);manager[_0xd4d0('0x43')](_0x4501c0);logger[_0xd4d0('0x9')](_0xd4d0('0x44'),_0x4501c0);}}logger['info'](_0xd4d0('0x45'),JSON[_0xd4d0('0x23')](_0x4081b9));for(_0x5e9655=0x0;_0x5e9655<_0x4081b9[_0xd4d0('0x46')];_0x5e9655+=0x1){_0x4501c0=_0x4081b9[_0x5e9655][_0xd4d0('0x3f')]();logger[_0xd4d0('0x9')](_0xd4d0('0x47'),_0x4501c0);if(_0x496637){logger['info'](_0xd4d0('0x48'),_0x496637);logger[_0xd4d0('0x9')](JSON[_0xd4d0('0x23')](_0x37cb45[_0x4501c0]));BPromise[_0xd4d0('0x49')]()[_0xd4d0('0x29')](handleJob(_0x37cb45[_0x4501c0]));logger[_0xd4d0('0x9')](_0xd4d0('0x4a'),_0x37cb45[_0x4501c0][_0xd4d0('0x13')],_0x37cb45[_0x4501c0]['cron']);}else if(_0x37cb45[_0x4501c0][_0xd4d0('0x4b')]&&_0x37cb45[_0x4501c0][_0xd4d0('0x4c')]&&moment()[_0xd4d0('0x4d')](_0x37cb45[_0x4501c0][_0xd4d0('0x4e')],_0x37cb45[_0x4501c0][_0xd4d0('0x4f')])){manager[_0xd4d0('0x50')](_0x4501c0,_0x37cb45[_0x4501c0][_0xd4d0('0x4b')],handleJob(_0x37cb45[_0x4501c0]));manager[_0xd4d0('0x51')](_0x4501c0);logger[_0xd4d0('0x9')](_0xd4d0('0x52'),_0x37cb45[_0x4501c0][_0xd4d0('0x13')],_0x37cb45[_0x4501c0]['cron']);}else if(manager[_0xd4d0('0x41')](_0x4501c0)){manager[_0xd4d0('0x42')](_0x4501c0);manager[_0xd4d0('0x43')](_0x4501c0);logger[_0xd4d0('0x9')](_0xd4d0('0x53'),_0x37cb45[_0x4501c0][_0xd4d0('0x13')],_0x37cb45[_0x4501c0][_0xd4d0('0x4b')]);}}for(_0x5e9655=0x0,_0x4501c0;_0x5e9655<_0x23b089[_0xd4d0('0x46')]&&!_0x496637;_0x5e9655+=0x1){_0x4501c0=_0x23b089[_0x5e9655][_0xd4d0('0x3f')]();if(manager[_0xd4d0('0x41')](_0x4501c0)){if(_0x37cb45[_0x4501c0][_0xd4d0('0x4b')]&&_0x37cb45[_0x4501c0][_0xd4d0('0x4c')]&&moment()[_0xd4d0('0x4d')](_0x37cb45[_0x4501c0][_0xd4d0('0x4e')],_0x37cb45[_0x4501c0]['endAt'])){manager[_0xd4d0('0x54')](_0x4501c0,_0x37cb45[_0x4501c0][_0xd4d0('0x4b')],handleJob(_0x37cb45[_0x4501c0]));logger[_0xd4d0('0x9')](_0xd4d0('0x55'),_0x37cb45[_0x4501c0]['name'],_0x37cb45[_0x4501c0][_0xd4d0('0x4b')]);}else{manager['stop'](_0x4501c0);manager[_0xd4d0('0x43')](_0x4501c0);logger[_0xd4d0('0x9')](_0xd4d0('0x53'),_0x37cb45[_0x4501c0][_0xd4d0('0x13')],_0x37cb45[_0x4501c0][_0xd4d0('0x4b')]);}}}})[_0xd4d0('0x36')](function(_0x3babed){logger['error'](JSON['stringify'](_0x3babed));});}exports[_0xd4d0('0x56')]=function(_0x37879c){return getJobs(_0x37879c);};exports[_0xd4d0('0x51')]=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 4b70626..909b308 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 _0x6075=['sentimentAccountId','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Negative','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','push','catch','inspect','start','lodash','aws-sdk','util','bluebird','transcribe','getTranscriptionJob','Comprehend','detectSentiment','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','transcribeName','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','sentiment'];(function(_0xc1c335,_0x12740e){var _0x1f0d19=function(_0x3b7943){while(--_0x3b7943){_0xc1c335['push'](_0xc1c335['shift']());}};_0x1f0d19(++_0x12740e);}(_0x6075,0x142));var _0x5607=function(_0x967605,_0x569216){_0x967605=_0x967605-0x0;var _0x24de00=_0x6075[_0x967605];return _0x24de00;};var _=require(_0x5607('0x0'));var AWS=require(_0x5607('0x1'));var rp=require('request-promise');var util=require(_0x5607('0x2'));var BPromise=require(_0x5607('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x5607('0x4'));function getTranscriptionJob(_0x541f8e,_0x5c9bec,_0x1d29a7,_0x48abca){return new Promise(function(_0x2d42d4,_0x4bb34a){var _0x34a8d9=new AWS['TranscribeService']({'accessKeyId':_0x5c9bec,'secretAccessKey':_0x541f8e,'region':_0x1d29a7});_0x34a8d9[_0x5607('0x5')]({'TranscriptionJobName':_0x48abca},function(_0x5f92ad,_0xbdf802){if(_0x5f92ad){return _0x4bb34a(_0x5f92ad);}else{return _0x2d42d4(_0xbdf802);}});});}function sentiment(_0xea0d09,_0xd69c6c,_0x2aec99,_0x3769ef,_0x24d65d){return new Promise(function(_0x16db79,_0x707cf8){var _0x2a83b6=new AWS[(_0x5607('0x6'))]({'accessKeyId':_0xd69c6c,'secretAccessKey':_0xea0d09,'region':_0x2aec99});_0x2a83b6[_0x5607('0x7')]({'Text':_0x3769ef,'LanguageCode':_0x24d65d['substring'](0x0,0x2)},function(_0x20e18b,_0x141725){if(_0x20e18b){return _0x707cf8(_0x20e18b);}else{return _0x16db79(_0x141725);}});});}function checkTranscribeJob(_0x8a2954,_0x5d9418,_0x8d61f1){var _0x4166c7;return new BPromise(function(_0x5b4f19,_0x413013){logger[_0x5607('0x8')](util['format'](_0x5607('0x9'),_0x8a2954['id'],_0x8a2954['transcribeName']));return getTranscriptionJob(_0x8d61f1[_0x5607('0xa')],_0x8d61f1[_0x5607('0xb')],_0x5d9418[_0x5607('0xc')],_0x8a2954[_0x5607('0xd')])[_0x5607('0xe')](function(_0x17ede4){logger[_0x5607('0x8')](util[_0x5607('0xf')](_0x5607('0x10'),_0x8a2954['id'],_0x8a2954[_0x5607('0xd')],_0x17ede4[_0x5607('0x11')][_0x5607('0x12')]));if(!_0x8a2954[_0x5607('0x13')]){switch(_0x17ede4[_0x5607('0x11')][_0x5607('0x12')]){case _0x5607('0x14'):var _0x19f817={'transcribeStatus':_0x17ede4['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x17ede4['TranscriptionJob']['Transcript'][_0x5607('0x15')]};logger[_0x5607('0x8')](util[_0x5607('0xf')](_0x5607('0x16'),_0x8a2954['id']));return rp({'uri':_0x17ede4[_0x5607('0x11')][_0x5607('0x17')][_0x5607('0x15')],'json':!![]})[_0x5607('0xe')](function(_0x5ecb83){logger['info'](util[_0x5607('0xf')](_0x5607('0x18'),_0x8a2954['id']));if(_0x5ecb83&&_0x5ecb83[_0x5607('0x19')]&&_0x5ecb83['results'][_0x5607('0x1a')]&&_0x5ecb83[_0x5607('0x19')][_0x5607('0x1a')][_0x5607('0x1b')]){_0x19f817[_0x5607('0x13')]='';for(var _0x44c5ef=0x0;_0x44c5ef<_0x5ecb83['results']['transcripts'][_0x5607('0x1b')];_0x44c5ef++){_0x19f817[_0x5607('0x13')]+=_0x5ecb83[_0x5607('0x19')]['transcripts'][_0x44c5ef]['transcript']+'';}}return _0x8a2954[_0x5607('0x1c')](_0x19f817);})['then'](function(){logger[_0x5607('0x8')](util[_0x5607('0xf')](_0x5607('0x1d'),_0x8a2954['id']));if(!_0x8a2954[_0x5607('0x1e')]){throw new db[(_0x5607('0x1f'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5d9418[_0x5607('0x20')]||!_0x5d9418[_0x5607('0x21')]||!_0x5d9418[_0x5607('0x22')]||!_0x5d9418[_0x5607('0x23')]||!_0x5d9418[_0x5607('0x24')]){throw new db[(_0x5607('0x1f'))][(_0x5607('0x25'))](_0x5607('0x26'));}if(!_0x19f817['fileText']){throw new Error(_0x5607('0x27'));}if(_0x5d9418[_0x5607('0x21')]===_0x8d61f1['id']){return _0x8d61f1;}else{return db[_0x5607('0x28')][_0x5607('0x29')]({'where':{'id':_settings[_0x5607('0x21')]}});}})[_0x5607('0xe')](function(_0x337216){if(!_0x337216){throw new db[(_0x5607('0x1f'))][(_0x5607('0x25'))](_0x5607('0x2a'));}if(!_0x337216['data1']||!_0x337216[_0x5607('0xb')]){throw new db['Sequelize'][(_0x5607('0x25'))](_0x5607('0x2b'));}_0x4166c7=_0x337216;logger[_0x5607('0x8')](util[_0x5607('0xf')](_0x5607('0x2c'),_0x8a2954['id']));return sentiment(_0x4166c7['data1'],_0x4166c7[_0x5607('0xb')],_0x5d9418[_0x5607('0x22')],_0x19f817[_0x5607('0x13')],_0x5d9418[_0x5607('0x23')]);})[_0x5607('0xe')](function(_0x2029a8){logger[_0x5607('0x8')](util[_0x5607('0xf')](_0x5607('0x2d'),_0x8a2954['id']));return _0x8a2954['update']({'sentiment':_0x2029a8[_0x5607('0x2e')],'sPositive':_0x2029a8[_0x5607('0x2f')][_0x5607('0x30')],'sNegative':_0x2029a8[_0x5607('0x2f')]['Negative'],'sMixed':_0x2029a8['SentimentScore'][_0x5607('0x31')],'sNeutral':_0x2029a8[_0x5607('0x2f')][_0x5607('0x32')]});})[_0x5607('0xe')](function(){logger['info'](util[_0x5607('0xf')](_0x5607('0x1d'),_0x8a2954['id']));_0x5b4f19();});case _0x5607('0x33'):return _0x8a2954['update']({'transcribeStatus':_0x5607('0x33'),'failureReason':_0x17ede4['TranscriptionJob'][_0x5607('0x34')]})[_0x5607('0xe')](function(){logger[_0x5607('0x8')](util[_0x5607('0xf')](_0x5607('0x1d'),_0x8a2954['id']));_0x5b4f19();});default:logger[_0x5607('0x8')](util[_0x5607('0xf')](_0x5607('0x35'),_0x8a2954['id']));break;}}else{return BPromise[_0x5607('0x36')]()[_0x5607('0xe')](function(){if(!_0x8a2954[_0x5607('0x1e')]){throw new db[(_0x5607('0x1f'))][(_0x5607('0x25'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5d9418[_0x5607('0x20')]||!_0x5d9418['sentimentAccountId']||!_0x5d9418[_0x5607('0x22')]||!_0x5d9418[_0x5607('0x23')]||!_0x5d9418[_0x5607('0x24')]){throw new db[(_0x5607('0x1f'))][(_0x5607('0x25'))](_0x5607('0x26'));}if(!_0x8a2954[_0x5607('0x13')]){throw new Error(_0x5607('0x27'));}if(_0x5d9418['sentimentAccountId']===_0x8d61f1['id']){return _0x8d61f1;}else{return db[_0x5607('0x28')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x307b0e){if(!_0x307b0e){throw new db[(_0x5607('0x1f'))]['ValidationError'](_0x5607('0x2a'));}if(!_0x307b0e[_0x5607('0xa')]||!_0x307b0e[_0x5607('0xb')]){throw new db[(_0x5607('0x1f'))][(_0x5607('0x25'))](_0x5607('0x2b'));}_0x4166c7=_0x307b0e;logger[_0x5607('0x8')](util[_0x5607('0xf')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x8a2954['id']));return sentiment(_0x4166c7[_0x5607('0xa')],_0x4166c7['data2'],_0x5d9418[_0x5607('0x22')],_0x8a2954[_0x5607('0x13')],_0x5d9418[_0x5607('0x23')]);})[_0x5607('0xe')](function(_0x2db550){logger[_0x5607('0x8')](util[_0x5607('0xf')](_0x5607('0x2d'),_0x8a2954['id']));return _0x8a2954[_0x5607('0x1c')]({'sentiment':_0x2db550[_0x5607('0x2e')],'sPositive':_0x2db550[_0x5607('0x2f')]['Positive'],'sNegative':_0x2db550[_0x5607('0x2f')][_0x5607('0x37')],'sMixed':_0x2db550[_0x5607('0x2f')][_0x5607('0x31')],'sNeutral':_0x2db550['SentimentScore'][_0x5607('0x32')],'transcribeStatus':_0x5607('0x14')});})['then'](function(){logger[_0x5607('0x8')](util[_0x5607('0xf')](_0x5607('0x1d'),_0x8a2954['id']));_0x5b4f19();});}})['catch'](function(_0x8aaa44){if(_0x8aaa44){if(!_0x8aaa44[_0x5607('0x38')]||_0x8aaa44[_0x5607('0x38')]!==_0x5607('0x39')){logger[_0x5607('0x3a')](util['format'](_0x5607('0x3b'),_0x8a2954['id']),util['inspect'](_0x8aaa44,{'showHidden':![],'depth':null}));}}_0x5b4f19();});});}function checkTranscribe(){var _0x2745cd;var _0x1188dd;var _0xef0bad;return db['VoiceRecording'][_0x5607('0x3c')]({'where':{'transcribeStatus':_0x5607('0x3d')}})[_0x5607('0xe')](function(_0x152a7a){if(!_0x152a7a||!_0x152a7a[_0x5607('0x1b')]){throw new db[(_0x5607('0x1f'))][(_0x5607('0x25'))](_0x5607('0x3e'));}_0x2745cd=_0x152a7a;return db[_0x5607('0x3f')][_0x5607('0x29')]({'where':{'id':0x1}});})[_0x5607('0xe')](function(_0x108a83){if(!_0x108a83){throw new db[(_0x5607('0x1f'))]['ValidationError'](_0x5607('0x40'));}_0x1188dd=_0x108a83;if(!_0x1188dd['transcribe']||!_0x1188dd[_0x5607('0x41')]||!_0x1188dd['transcribeRegion']||!_0x1188dd[_0x5607('0x23')]||!_0x1188dd[_0x5607('0x24')]){throw new db[(_0x5607('0x1f'))][(_0x5607('0x25'))](_0x5607('0x42'));}return db[_0x5607('0x28')][_0x5607('0x29')]({'where':{'id':_0x1188dd[_0x5607('0x41')]}});})[_0x5607('0xe')](function(_0x46924c){if(!_0x46924c){throw new db[(_0x5607('0x1f'))][(_0x5607('0x25'))](_0x5607('0x2a'));}if(!_0x46924c[_0x5607('0xa')]||!_0x46924c[_0x5607('0xb')]){throw new db[(_0x5607('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0xef0bad=_0x46924c;var _0x3b2989=[];_0x2745cd['forEach'](function(_0x36e4ee){_0x3b2989[_0x5607('0x43')](checkTranscribeJob(_0x36e4ee,_0x1188dd,_0xef0bad));});return BPromise['all'](_0x3b2989);})[_0x5607('0x44')](function(_0x5308aa){if(_0x5308aa){if(!_0x5308aa[_0x5607('0x38')]||_0x5308aa[_0x5607('0x38')]!==_0x5607('0x39')){logger['error'](util[_0x5607('0x45')](_0x5308aa,{'showHidden':![],'depth':null}));}}});}exports[_0x5607('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x4024=['getTranscriptionJob','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Mixed','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','start','lodash','aws-sdk','util','bluebird','../../config/logger'];(function(_0x4b0318,_0x254072){var _0x1e8db1=function(_0x33d8d7){while(--_0x33d8d7){_0x4b0318['push'](_0x4b0318['shift']());}};_0x1e8db1(++_0x254072);}(_0x4024,0x89));var _0x4402=function(_0x46e2cd,_0x2ae674){_0x46e2cd=_0x46e2cd-0x0;var _0x3a691c=_0x4024[_0x46e2cd];return _0x3a691c;};var _=require(_0x4402('0x0'));var AWS=require(_0x4402('0x1'));var rp=require('request-promise');var util=require(_0x4402('0x2'));var BPromise=require(_0x4402('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x4402('0x4'))('transcribe');function getTranscriptionJob(_0x950c82,_0x117f90,_0x5bdb3f,_0x4f9482){return new Promise(function(_0x17699b,_0x346ddc){var _0x168acd=new AWS['TranscribeService']({'accessKeyId':_0x117f90,'secretAccessKey':_0x950c82,'region':_0x5bdb3f});_0x168acd[_0x4402('0x5')]({'TranscriptionJobName':_0x4f9482},function(_0x5d7ca4,_0x5c0b70){if(_0x5d7ca4){return _0x346ddc(_0x5d7ca4);}else{return _0x17699b(_0x5c0b70);}});});}function sentiment(_0x734aae,_0x4c6ca4,_0x4d2882,_0x30fd34,_0x4f56aa){return new Promise(function(_0x1a4a47,_0x4e1a7e){var _0x34b4a6=new AWS['Comprehend']({'accessKeyId':_0x4c6ca4,'secretAccessKey':_0x734aae,'region':_0x4d2882});_0x34b4a6[_0x4402('0x6')]({'Text':_0x30fd34,'LanguageCode':_0x4f56aa[_0x4402('0x7')](0x0,0x2)},function(_0x54410d,_0x949ab7){if(_0x54410d){return _0x4e1a7e(_0x54410d);}else{return _0x1a4a47(_0x949ab7);}});});}function checkTranscribeJob(_0x302c4d,_0xa819e9,_0x4c9032){var _0x7e4475;return new BPromise(function(_0x34d952,_0x42f1b0){logger[_0x4402('0x8')](util[_0x4402('0x9')](_0x4402('0xa'),_0x302c4d['id'],_0x302c4d[_0x4402('0xb')]));return getTranscriptionJob(_0x4c9032[_0x4402('0xc')],_0x4c9032[_0x4402('0xd')],_0xa819e9[_0x4402('0xe')],_0x302c4d[_0x4402('0xb')])[_0x4402('0xf')](function(_0x2a2ce8){logger[_0x4402('0x8')](util[_0x4402('0x9')](_0x4402('0x10'),_0x302c4d['id'],_0x302c4d[_0x4402('0xb')],_0x2a2ce8[_0x4402('0x11')][_0x4402('0x12')]));if(!_0x302c4d[_0x4402('0x13')]){switch(_0x2a2ce8['TranscriptionJob']['TranscriptionJobStatus']){case _0x4402('0x14'):var _0x2a7afc={'transcribeStatus':_0x2a2ce8['TranscriptionJob'][_0x4402('0x12')],'fileUri':_0x2a2ce8[_0x4402('0x11')]['Transcript'][_0x4402('0x15')]};logger['info'](util['format'](_0x4402('0x16'),_0x302c4d['id']));return rp({'uri':_0x2a2ce8[_0x4402('0x11')][_0x4402('0x17')]['TranscriptFileUri'],'json':!![]})[_0x4402('0xf')](function(_0x57a25e){logger['info'](util[_0x4402('0x9')](_0x4402('0x18'),_0x302c4d['id']));if(_0x57a25e&&_0x57a25e[_0x4402('0x19')]&&_0x57a25e[_0x4402('0x19')][_0x4402('0x1a')]&&_0x57a25e[_0x4402('0x19')][_0x4402('0x1a')][_0x4402('0x1b')]){_0x2a7afc[_0x4402('0x13')]='';for(var _0x4d6846=0x0;_0x4d6846<_0x57a25e[_0x4402('0x19')]['transcripts'][_0x4402('0x1b')];_0x4d6846++){_0x2a7afc[_0x4402('0x13')]+=_0x57a25e[_0x4402('0x19')][_0x4402('0x1a')][_0x4d6846]['transcript']+'';}}return _0x302c4d[_0x4402('0x1c')](_0x2a7afc);})['then'](function(){logger['info'](util[_0x4402('0x9')](_0x4402('0x1d'),_0x302c4d['id']));if(!_0x302c4d[_0x4402('0x1e')]){throw new db[(_0x4402('0x1f'))][(_0x4402('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0xa819e9[_0x4402('0x21')]||!_0xa819e9['sentimentAccountId']||!_0xa819e9[_0x4402('0x22')]||!_0xa819e9[_0x4402('0x23')]||!_0xa819e9[_0x4402('0x24')]){throw new db['Sequelize'][(_0x4402('0x20'))](_0x4402('0x25'));}if(!_0x2a7afc[_0x4402('0x13')]){throw new Error(_0x4402('0x26'));}if(_0xa819e9[_0x4402('0x27')]===_0x4c9032['id']){return _0x4c9032;}else{return db[_0x4402('0x28')][_0x4402('0x29')]({'where':{'id':_settings[_0x4402('0x27')]}});}})[_0x4402('0xf')](function(_0xd46d0){if(!_0xd46d0){throw new db[(_0x4402('0x1f'))]['ValidationError'](_0x4402('0x2a'));}if(!_0xd46d0['data1']||!_0xd46d0[_0x4402('0xd')]){throw new db['Sequelize'][(_0x4402('0x20'))](_0x4402('0x2b'));}_0x7e4475=_0xd46d0;logger[_0x4402('0x8')](util[_0x4402('0x9')](_0x4402('0x2c'),_0x302c4d['id']));return sentiment(_0x7e4475['data1'],_0x7e4475[_0x4402('0xd')],_0xa819e9[_0x4402('0x22')],_0x2a7afc[_0x4402('0x13')],_0xa819e9['language']);})[_0x4402('0xf')](function(_0x3383e3){logger['info'](util[_0x4402('0x9')](_0x4402('0x2d'),_0x302c4d['id']));return _0x302c4d[_0x4402('0x1c')]({'sentiment':_0x3383e3[_0x4402('0x2e')],'sPositive':_0x3383e3[_0x4402('0x2f')][_0x4402('0x30')],'sNegative':_0x3383e3[_0x4402('0x2f')][_0x4402('0x31')],'sMixed':_0x3383e3[_0x4402('0x2f')]['Mixed'],'sNeutral':_0x3383e3[_0x4402('0x2f')][_0x4402('0x32')]});})[_0x4402('0xf')](function(){logger['info'](util[_0x4402('0x9')](_0x4402('0x1d'),_0x302c4d['id']));_0x34d952();});case'FAILED':return _0x302c4d['update']({'transcribeStatus':_0x4402('0x33'),'failureReason':_0x2a2ce8[_0x4402('0x11')][_0x4402('0x34')]})[_0x4402('0xf')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x302c4d['id']));_0x34d952();});default:logger[_0x4402('0x8')](util[_0x4402('0x9')](_0x4402('0x35'),_0x302c4d['id']));break;}}else{return BPromise[_0x4402('0x36')]()['then'](function(){if(!_0x302c4d[_0x4402('0x1e')]){throw new db[(_0x4402('0x1f'))][(_0x4402('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0xa819e9[_0x4402('0x21')]||!_0xa819e9['sentimentAccountId']||!_0xa819e9[_0x4402('0x22')]||!_0xa819e9[_0x4402('0x23')]||!_0xa819e9['bucket']){throw new db[(_0x4402('0x1f'))]['ValidationError'](_0x4402('0x25'));}if(!_0x302c4d[_0x4402('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0xa819e9[_0x4402('0x27')]===_0x4c9032['id']){return _0x4c9032;}else{return db[_0x4402('0x28')][_0x4402('0x29')]({'where':{'id':_settings[_0x4402('0x27')]}});}})['then'](function(_0x540440){if(!_0x540440){throw new db[(_0x4402('0x1f'))]['ValidationError'](_0x4402('0x2a'));}if(!_0x540440[_0x4402('0xc')]||!_0x540440[_0x4402('0xd')]){throw new db[(_0x4402('0x1f'))][(_0x4402('0x20'))](_0x4402('0x2b'));}_0x7e4475=_0x540440;logger[_0x4402('0x8')](util[_0x4402('0x9')](_0x4402('0x2c'),_0x302c4d['id']));return sentiment(_0x7e4475[_0x4402('0xc')],_0x7e4475['data2'],_0xa819e9[_0x4402('0x22')],_0x302c4d[_0x4402('0x13')],_0xa819e9['language']);})[_0x4402('0xf')](function(_0x370878){logger['info'](util[_0x4402('0x9')](_0x4402('0x2d'),_0x302c4d['id']));return _0x302c4d[_0x4402('0x1c')]({'sentiment':_0x370878[_0x4402('0x2e')],'sPositive':_0x370878[_0x4402('0x2f')]['Positive'],'sNegative':_0x370878[_0x4402('0x2f')][_0x4402('0x31')],'sMixed':_0x370878[_0x4402('0x2f')][_0x4402('0x37')],'sNeutral':_0x370878[_0x4402('0x2f')][_0x4402('0x32')],'transcribeStatus':_0x4402('0x14')});})[_0x4402('0xf')](function(){logger[_0x4402('0x8')](util[_0x4402('0x9')](_0x4402('0x1d'),_0x302c4d['id']));_0x34d952();});}})['catch'](function(_0x12a0c6){if(_0x12a0c6){if(!_0x12a0c6['name']||_0x12a0c6[_0x4402('0x38')]!==_0x4402('0x39')){logger['error'](util[_0x4402('0x9')](_0x4402('0x3a'),_0x302c4d['id']),util[_0x4402('0x3b')](_0x12a0c6,{'showHidden':![],'depth':null}));}}_0x34d952();});});}function checkTranscribe(){var _0x21aa2d;var _0x4436b2;var _0x2503eb;return db['VoiceRecording'][_0x4402('0x3c')]({'where':{'transcribeStatus':_0x4402('0x3d')}})[_0x4402('0xf')](function(_0x1350c5){if(!_0x1350c5||!_0x1350c5[_0x4402('0x1b')]){throw new db[(_0x4402('0x1f'))][(_0x4402('0x20'))](_0x4402('0x3e'));}_0x21aa2d=_0x1350c5;return db[_0x4402('0x3f')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x5ab12b){if(!_0x5ab12b){throw new db['Sequelize'][(_0x4402('0x20'))](_0x4402('0x40'));}_0x4436b2=_0x5ab12b;if(!_0x4436b2[_0x4402('0x41')]||!_0x4436b2[_0x4402('0x42')]||!_0x4436b2['transcribeRegion']||!_0x4436b2[_0x4402('0x23')]||!_0x4436b2[_0x4402('0x24')]){throw new db[(_0x4402('0x1f'))][(_0x4402('0x20'))](_0x4402('0x43'));}return db[_0x4402('0x28')][_0x4402('0x29')]({'where':{'id':_0x4436b2['transcribeAccountId']}});})[_0x4402('0xf')](function(_0x2a8085){if(!_0x2a8085){throw new db[(_0x4402('0x1f'))][(_0x4402('0x20'))](_0x4402('0x2a'));}if(!_0x2a8085[_0x4402('0xc')]||!_0x2a8085['data2']){throw new db[(_0x4402('0x1f'))][(_0x4402('0x20'))](_0x4402('0x2b'));}_0x2503eb=_0x2a8085;var _0x295c9b=[];_0x21aa2d[_0x4402('0x44')](function(_0x476bf5){_0x295c9b[_0x4402('0x45')](checkTranscribeJob(_0x476bf5,_0x4436b2,_0x2503eb));});return BPromise['all'](_0x295c9b);})['catch'](function(_0x1a94f5){if(_0x1a94f5){if(!_0x1a94f5[_0x4402('0x38')]||_0x1a94f5[_0x4402('0x38')]!=='SequelizeValidationError'){logger['error'](util[_0x4402('0x3b')](_0x1a94f5,{'showHidden':![],'depth':null}));}}});}exports[_0x4402('0x46')]=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 a3c0b43..a9b0c30 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 _0xb44a=['format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','ioredis','../../config/environment','schedule','defaults','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','map','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','timeout'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xb44a,0x1c2));var _0xab44=function(_0x1a8ff0,_0x20788d){_0x1a8ff0=_0x1a8ff0-0x0;var _0x3588bf=_0xb44a[_0x1a8ff0];return _0x3588bf;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0xab44('0x0'));var util=require('util');var config=require(_0xab44('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0xab44('0x2'));config['redis']=_[_0xab44('0x3')](config[_0xab44('0x4')],{'host':_0xab44('0x5'),'port':0x18eb});var io=require(_0xab44('0x6'))(new Redis(config[_0xab44('0x4')]));function closeInteractions(){var _0x3303b1=[];return db[_0xab44('0x7')][_0xab44('0x8')]({'raw':!![],'attributes':['id',_0xab44('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xab44('0xa')](0x18,_0xab44('0xb'))}}})[_0xab44('0xc')](function(_0xa14367){if(_0xa14367&&_0xa14367['length']){_0x3303b1=_[_0xab44('0xd')](_0xa14367||[],'id');logger['info'](_0xab44('0xe'),_0x3303b1['join']());return db['WhatsappInteraction'][_0xab44('0xf')]({'closeReason':_0xab44('0x10'),'disposition':_0xab44('0x11'),'closed':!![],'closedAt':moment()[_0xab44('0x12')](_0xab44('0x13'))},{'where':{'id':_0x3303b1}});}})[_0xab44('0xc')](function(){if(_0x3303b1&&_0x3303b1['length']){logger['info'](_0xab44('0x14'),_0x3303b1['join']());for(var _0x15db10=0x0;_0x15db10<_0x3303b1['length'];_0x15db10++){io[_0xab44('0x15')](_0xab44('0x16'),{'id':_0x3303b1[_0x15db10],'closed':!![]});}}})[_0xab44('0x17')](function(_0x384f02){logger[_0xab44('0x18')](_0xab44('0x19'),_0x384f02?util['inspect'](_0x384f02,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1b9b=['WhatsappInteraction','findAll','lastMsgAt','hours','then','map','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','socket.io-emitter'];(function(_0x11f955,_0x5f16db){var _0xe217c2=function(_0x5b4bee){while(--_0x5b4bee){_0x11f955['push'](_0x11f955['shift']());}};_0xe217c2(++_0x5f16db);}(_0x1b9b,0x89));var _0xb1b9=function(_0x54c38b,_0x4b7b2d){_0x54c38b=_0x54c38b-0x0;var _0x3a8c85=_0x1b9b[_0x54c38b];return _0x3a8c85;};'use strict';var _=require(_0xb1b9('0x0'));var moment=require('moment');var Redis=require(_0xb1b9('0x1'));var util=require(_0xb1b9('0x2'));var config=require(_0xb1b9('0x3'));var db=require(_0xb1b9('0x4'))['db'];var logger=require('../logger')(_0xb1b9('0x5'));config[_0xb1b9('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb1b9('0x7'))(new Redis(config[_0xb1b9('0x6')]));function closeInteractions(){var _0x5d4b92=[];return db[_0xb1b9('0x8')][_0xb1b9('0x9')]({'raw':!![],'attributes':['id',_0xb1b9('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xb1b9('0xb'))}}})[_0xb1b9('0xc')](function(_0x406542){if(_0x406542&&_0x406542['length']){_0x5d4b92=_[_0xb1b9('0xd')](_0x406542||[],'id');logger['info'](_0xb1b9('0xe'),_0x5d4b92['join']());return db[_0xb1b9('0x8')][_0xb1b9('0xf')]({'closeReason':_0xb1b9('0x10'),'disposition':_0xb1b9('0x11'),'closed':!![],'closedAt':moment()[_0xb1b9('0x12')](_0xb1b9('0x13'))},{'where':{'id':_0x5d4b92}});}})[_0xb1b9('0xc')](function(){if(_0x5d4b92&&_0x5d4b92[_0xb1b9('0x14')]){logger['info'](_0xb1b9('0x15'),_0x5d4b92[_0xb1b9('0x16')]());for(var _0x11714e=0x0;_0x11714e<_0x5d4b92['length'];_0x11714e++){io[_0xb1b9('0x17')](_0xb1b9('0x18'),{'id':_0x5d4b92[_0x11714e],'closed':!![]});}}})[_0xb1b9('0x19')](function(_0x2d4fbd){logger[_0xb1b9('0x1a')](_0xb1b9('0x1b'),_0x2d4fbd?util['inspect'](_0x2d4fbd,{'showHidden':![],'depth':null}):'');});}exports[_0xb1b9('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 98594e3..d80228e 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d6d=['catch','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','then','bulkCreate','finished\x20populating','contacts1','CmHopper','log','contacts2'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d6d,0x121));var _0xd4d6=function(_0x2706b5,_0x478ffe){_0x2706b5=_0x2706b5-0x0;var _0x8f0288=_0x4d6d[_0x2706b5];return _0x8f0288;};'use strict';var util=require('util');var db=require(_0xd4d6('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xd4d6('0x1')]({'id':i,'firstName':_0xd4d6('0x2')+i,'lastName':_0xd4d6('0x3')+i,'phone':0xf879fb460+i,'email':_0xd4d6('0x4')+i+_0xd4d6('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xd4d6('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xd4d6('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd4d6('0x6')](),'updatedAt':Date[_0xd4d6('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xd4d6('0x2')+i,'lastName':_0xd4d6('0x3')+i,'phone':0xf879fb460+i,'email':_0xd4d6('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd4d6('0x6')](),'updatedAt':Date[_0xd4d6('0x6')]()});}db[_0xd4d6('0x7')]['destroy']({'where':{}})[_0xd4d6('0x8')](function(){return db[_0xd4d6('0x7')][_0xd4d6('0x9')](contacts);})[_0xd4d6('0x8')](function(){console['log'](_0xd4d6('0xa'),_0xd4d6('0xb'));return db[_0xd4d6('0xc')]['destroy']({'where':{}});})[_0xd4d6('0x8')](function(){return db[_0xd4d6('0xc')][_0xd4d6('0x9')](hopper);})['then'](function(){console['log']('finished\x20populating','hopper1');return db[_0xd4d6('0x7')]['bulkCreate'](contacts2);})[_0xd4d6('0x8')](function(){console[_0xd4d6('0xd')]('finished\x20populating',_0xd4d6('0xe'));return db['CmHopper'][_0xd4d6('0x9')](hopper2);})[_0xd4d6('0x8')](function(){console[_0xd4d6('0xd')](_0xd4d6('0xa'),'hopper2');})[_0xd4d6('0xf')](function(_0x14668c){console[_0xd4d6('0xd')](_0x14668c);}); \ No newline at end of file +var _0x5ad8=['now','@xcally.com','destroy','CmContact','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo'];(function(_0x53fa0d,_0x54ff36){var _0x33dc1c=function(_0xde0523){while(--_0xde0523){_0x53fa0d['push'](_0x53fa0d['shift']());}};_0x33dc1c(++_0x54ff36);}(_0x5ad8,0x162));var _0x85ad=function(_0x5db1ce,_0x57ab66){_0x5db1ce=_0x5db1ce-0x0;var _0xb62cbb=_0x5ad8[_0x5db1ce];return _0xb62cbb;};'use strict';var util=require(_0x85ad('0x0'));var db=require(_0x85ad('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x85ad('0x2')]({'id':i,'firstName':_0x85ad('0x3')+i,'lastName':_0x85ad('0x4')+i,'phone':0xf879fb460+i,'email':_0x85ad('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x85ad('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x85ad('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x85ad('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x85ad('0x4')+i,'phone':0xf879fb460+i,'email':_0x85ad('0x5')+i+_0x85ad('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x85ad('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x85ad('0x6')](),'updatedAt':Date[_0x85ad('0x6')]()});}db['CmContact'][_0x85ad('0x8')]({'where':{}})['then'](function(){return db[_0x85ad('0x9')]['bulkCreate'](contacts);})[_0x85ad('0xa')](function(){console[_0x85ad('0xb')](_0x85ad('0xc'),_0x85ad('0xd'));return db[_0x85ad('0xe')][_0x85ad('0x8')]({'where':{}});})[_0x85ad('0xa')](function(){return db[_0x85ad('0xe')][_0x85ad('0xf')](hopper);})[_0x85ad('0xa')](function(){console[_0x85ad('0xb')](_0x85ad('0xc'),_0x85ad('0x10'));return db['CmContact']['bulkCreate'](contacts2);})[_0x85ad('0xa')](function(){console[_0x85ad('0xb')]('finished\x20populating',_0x85ad('0x11'));return db[_0x85ad('0xe')][_0x85ad('0xf')](hopper2);})[_0x85ad('0xa')](function(){console[_0x85ad('0xb')](_0x85ad('0xc'),_0x85ad('0x12'));})[_0x85ad('0x13')](function(_0x11ec46){console[_0x85ad('0xb')](_0x11ec46);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 6fb2bc8..4d77bad 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e27=['password','udp','all','yes','/etc/pki/tls/certs/motion.crt','actpass','User','then','log','add\x20user','catch','util','../mysqldb','format','agent','%s%s','%s%s@xcally.com'];(function(_0x55d58f,_0x2bea83){var _0x1ad6e6=function(_0x31447e){while(--_0x31447e){_0x55d58f['push'](_0x55d58f['shift']());}};_0x1ad6e6(++_0x2bea83);}(_0x8e27,0x14e));var _0x78e2=function(_0x225f50,_0x48a77d){_0x225f50=_0x225f50-0x0;var _0x19d003=_0x8e27[_0x225f50];return _0x19d003;};'use strict';var util=require(_0x78e2('0x0'));var db=require(_0x78e2('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x78e2('0x2')]('%s%s',_0x78e2('0x3'),i),'fullname':util[_0x78e2('0x2')](_0x78e2('0x4'),_0x78e2('0x3'),i),'email':util[_0x78e2('0x2')](_0x78e2('0x5'),_0x78e2('0x3'),i),'role':_0x78e2('0x3'),'password':_0x78e2('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x78e2('0x7'),'ws','wss'],'disallow':[_0x78e2('0x8')],'allow':['ulaw'],'defaultuser':util[_0x78e2('0x2')](_0x78e2('0x4'),_0x78e2('0x3'),i),'encryption':_0x78e2('0x9'),'avpf':_0x78e2('0x9'),'force_avp':_0x78e2('0x9'),'icesupport':_0x78e2('0x9'),'dtlsenable':_0x78e2('0x9'),'dtlsverify':'no','dtlscertfile':_0x78e2('0xa'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x78e2('0xb'),'callerid':util[_0x78e2('0x2')]('\x22%s\x22\x20<%s>',util['format'](_0x78e2('0x4'),_0x78e2('0x3'),i),0xfa0+i)});}db[_0x78e2('0xc')]['bulkCreate'](users)[_0x78e2('0xd')](function(){console[_0x78e2('0xe')](_0x78e2('0xf'));})[_0x78e2('0x10')](function(_0x355a60){console[_0x78e2('0xe')](_0x355a60);}); \ No newline at end of file +var _0xd2f5=['%s%s@xcally.com','password','udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','add\x20user','catch','log','util','push','agent','format','%s%s'];(function(_0x27e829,_0x4bebba){var _0x34784a=function(_0x3af799){while(--_0x3af799){_0x27e829['push'](_0x27e829['shift']());}};_0x34784a(++_0x4bebba);}(_0xd2f5,0x1b3));var _0x5d2f=function(_0x477240,_0x17d207){_0x477240=_0x477240-0x0;var _0x31da2d=_0xd2f5[_0x477240];return _0x31da2d;};'use strict';var util=require(_0x5d2f('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5d2f('0x1')]({'name':util['format']('%s%s',_0x5d2f('0x2'),i),'fullname':util[_0x5d2f('0x3')](_0x5d2f('0x4'),_0x5d2f('0x2'),i),'email':util[_0x5d2f('0x3')](_0x5d2f('0x5'),_0x5d2f('0x2'),i),'role':_0x5d2f('0x2'),'password':_0x5d2f('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x5d2f('0x7'),'ws',_0x5d2f('0x8')],'disallow':[_0x5d2f('0x9')],'allow':[_0x5d2f('0xa')],'defaultuser':util[_0x5d2f('0x3')](_0x5d2f('0x4'),'agent',i),'encryption':_0x5d2f('0xb'),'avpf':_0x5d2f('0xb'),'force_avp':_0x5d2f('0xb'),'icesupport':_0x5d2f('0xb'),'dtlsenable':_0x5d2f('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x5d2f('0xc'),'dtlssetup':_0x5d2f('0xd'),'callerid':util[_0x5d2f('0x3')](_0x5d2f('0xe'),util[_0x5d2f('0x3')](_0x5d2f('0x4'),_0x5d2f('0x2'),i),0xfa0+i)});}db[_0x5d2f('0xf')]['bulkCreate'](users)[_0x5d2f('0x10')](function(){console['log'](_0x5d2f('0x11'));})[_0x5d2f('0x12')](function(_0x40ad3a){console[_0x5d2f('0x13')](_0x40ad3a);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index f5b3d85..98292d1 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce04=['name','type','ivr','UserProfileSection','findOne','then','VoiceQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','UserProfileResource','resourceId','role','telephone','Campaign','where','format','%s:queue:%s','length','user:%s','handshake','query','User','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','user','userProfileId','ChatQueues','SmsQueues','WhatsappQueue','Trunks','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','removeChatInteractions','emit','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','remoteAddress','request','remotePort','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','lodash','bluebird','../mysqldb','./environment','Agents','agent'];(function(_0x2fa5e8,_0x5f298f){var _0x1fb05f=function(_0x47e9ca){while(--_0x47e9ca){_0x2fa5e8['push'](_0x2fa5e8['shift']());}};_0x1fb05f(++_0x5f298f);}(_0xce04,0xc0));var _0x4ce0=function(_0x482b8c,_0xf64b8c){_0x482b8c=_0x482b8c-0x0;var _0x46ea23=_0xce04[_0x482b8c];return _0x46ea23;};'use strict';var _=require(_0x4ce0('0x0'));var util=require('util');var BPromise=require(_0x4ce0('0x1'));var db=require(_0x4ce0('0x2'))['db'];var config=require(_0x4ce0('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x4ce0('0x4'),'model':db['User'],'attributes':['id','name','role'],'raw':!![],'where':{'role':_0x4ce0('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x4ce0('0x6')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x4ce0('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0x4ce0('0x6')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4ce0('0x6'),_0x4ce0('0x7')],'where':{'type':_0x4ce0('0x8')}};function getAssociatedResources(_0x5b6a00,_0x387442,_0x29c627){return db[_0x4ce0('0x9')][_0x4ce0('0xa')]({'where':{'name':_0x5b6a00,'userProfileId':_0x387442},'raw':!![]})[_0x4ce0('0xb')](function(_0x237510){if(_0x237510){if(_0x237510['autoAssociation']){switch(_0x5b6a00){case _0x4ce0('0xc'):case'ChatQueues':case'FaxQueues':case'SmsQueues':case _0x4ce0('0xd'):case _0x4ce0('0xe'):case _0x4ce0('0xf'):return db[_0x29c627]['findAll'](queryQueues);case _0x4ce0('0x10'):return db[_0x29c627][_0x4ce0('0x11')](queryTelephones);case'Trunks':return db[_0x29c627][_0x4ce0('0x11')](queryTrunks);case'IvrCampaigns':return db[_0x29c627][_0x4ce0('0x11')](queryCampaigns);}}else{return db[_0x4ce0('0x12')][_0x4ce0('0x11')]({'attributes':['resourceId'],'where':{'sectionId':_0x237510['id']},'raw':!![]})[_0x4ce0('0xb')](function(_0x2262b4){if(_0x2262b4){var _0x1df065={'where':{'id':_['map'](_0x2262b4,_0x4ce0('0x13'))},'raw':!![]};switch(_0x29c627){case'User':_0x1df065['where'][_0x4ce0('0x14')]=_0x4ce0('0x15');break;case _0x4ce0('0x16'):_0x1df065[_0x4ce0('0x17')][_0x4ce0('0x7')]=_0x4ce0('0x8');break;}return db[_0x29c627][_0x4ce0('0x11')](_0x1df065);}else{return[];}});}}else{return[];}})['then'](function(_0x6c9cc4){return _0x6c9cc4;});}function joinOrLeaveQueues(_0x88be98,_0x5a600d,_0x258d54,_0x5af932){_0x88be98[_0x5a600d](util[_0x4ce0('0x18')](_0x4ce0('0x19'),_0x258d54,_0x5af932['name']));if(_0x5af932[_0x4ce0('0x4')]){for(var _0x12328c=0x0;_0x12328c<_0x5af932[_0x4ce0('0x4')][_0x4ce0('0x1a')];_0x12328c+=0x1){_0x88be98[_0x5a600d](util[_0x4ce0('0x18')](_0x4ce0('0x1b'),_0x5af932[_0x4ce0('0x4')][_0x12328c][_0x4ce0('0x6')]));}}}function joinOrLeave(_0x4496bf,_0x256163,_0x458bc5){var _0x27024e;if(_0x4496bf[_0x4ce0('0x1c')][_0x4ce0('0x1d')]['id']){db[_0x4ce0('0x1e')]['find']({'attributes':['id',_0x4ce0('0x6'),_0x4ce0('0x14'),'userProfileId'],'where':{'id':_0x4496bf[_0x4ce0('0x1c')][_0x4ce0('0x1d')]['id']},'include':[{'model':db[_0x4ce0('0x1f')],'as':_0x4ce0('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x4ce0('0x21')],'as':_0x4ce0('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x4ce0('0x23')],'as':_0x4ce0('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x4ce0('0x25')],'as':_0x4ce0('0x26'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x4ce0('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x4ce0('0x28')],'as':_0x4ce0('0x29'),'attributes':['id'],'raw':!![]}]})[_0x4ce0('0xb')](function(_0x59e8df){if(_0x59e8df){_0x27024e=_0x59e8df;_0x4496bf[_0x256163](util['format'](_0x4ce0('0x1b'),_0x59e8df[_0x4ce0('0x6')]));var _0x58d232=[];switch(_0x59e8df[_0x4ce0('0x14')]){case'admin':_0x4496bf[_0x256163](_0x4ce0('0x2a'));_0x4496bf[_0x256163](_0x4ce0('0x2b'));if(queryQueues[_0x4ce0('0x2c')](_0x4ce0('0x2d'))){delete queryQueues[_0x4ce0('0x2d')];}_0x58d232['push'](db[_0x4ce0('0x2e')][_0x4ce0('0x11')](queryQueues));_0x58d232[_0x4ce0('0x2f')](db[_0x4ce0('0x30')][_0x4ce0('0x11')](queryQueues));_0x58d232[_0x4ce0('0x2f')](db[_0x4ce0('0x31')][_0x4ce0('0x11')](queryQueues));_0x58d232['push'](db[_0x4ce0('0x32')][_0x4ce0('0x11')](queryQueues));_0x58d232[_0x4ce0('0x2f')](db[_0x4ce0('0x33')]['findAll'](queryQueues));_0x58d232[_0x4ce0('0x2f')](db[_0x4ce0('0x34')]['findAll'](queryQueues));_0x58d232[_0x4ce0('0x2f')](db['WhatsappQueue'][_0x4ce0('0x11')](queryQueues));_0x58d232[_0x4ce0('0x2f')](db[_0x4ce0('0x1e')][_0x4ce0('0x11')](queryTelephones));_0x58d232[_0x4ce0('0x2f')](db['Trunk']['findAll'](queryTrunks));_0x58d232['push'](db[_0x4ce0('0x16')][_0x4ce0('0x11')](queryCampaigns));_0x58d232[_0x4ce0('0x2f')](db[_0x4ce0('0x1e')]['findAll'](queryAgents));break;case _0x4ce0('0x35'):_0x4496bf[_0x256163](_0x4ce0('0x2a'));_0x4496bf[_0x256163](_0x4ce0('0x2b'));_0x58d232[_0x4ce0('0x2f')](getAssociatedResources('VoiceQueues',_0x59e8df[_0x4ce0('0x36')],'VoiceQueue'));_0x58d232[_0x4ce0('0x2f')](getAssociatedResources(_0x4ce0('0x37'),_0x59e8df['userProfileId'],'ChatQueue'));_0x58d232[_0x4ce0('0x2f')](getAssociatedResources('FaxQueues',_0x59e8df[_0x4ce0('0x36')],_0x4ce0('0x31')));_0x58d232[_0x4ce0('0x2f')](getAssociatedResources(_0x4ce0('0x38'),_0x59e8df[_0x4ce0('0x36')],_0x4ce0('0x32')));_0x58d232[_0x4ce0('0x2f')](getAssociatedResources(_0x4ce0('0xd'),_0x59e8df['userProfileId'],_0x4ce0('0x33')));_0x58d232['push'](getAssociatedResources(_0x4ce0('0xe'),_0x59e8df['userProfileId'],_0x4ce0('0x34')));_0x58d232[_0x4ce0('0x2f')](getAssociatedResources(_0x4ce0('0xf'),_0x59e8df[_0x4ce0('0x36')],_0x4ce0('0x39')));_0x58d232[_0x4ce0('0x2f')](getAssociatedResources(_0x4ce0('0x10'),_0x59e8df[_0x4ce0('0x36')],_0x4ce0('0x1e')));_0x58d232[_0x4ce0('0x2f')](getAssociatedResources(_0x4ce0('0x3a'),_0x59e8df[_0x4ce0('0x36')],_0x4ce0('0x3b')));_0x58d232[_0x4ce0('0x2f')](getAssociatedResources('IvrCampaigns',_0x59e8df[_0x4ce0('0x36')],_0x4ce0('0x16')));_0x58d232[_0x4ce0('0x2f')](db['User'][_0x4ce0('0x11')](queryAgents));break;case _0x4ce0('0x5'):_0x4496bf[_0x256163](_0x4ce0('0x2a'));_0x4496bf[_0x256163](_0x4ce0('0x2b'));_0x58d232[_0x4ce0('0x2f')](_0x59e8df[_0x4ce0('0x3c')]({'attributes':['id',_0x4ce0('0x6')]}));_0x58d232[_0x4ce0('0x2f')](_0x59e8df[_0x4ce0('0x3d')]({'attributes':['id','name']}));_0x58d232['push'](_0x59e8df[_0x4ce0('0x3e')]({'attributes':['id',_0x4ce0('0x6')]}));_0x58d232['push'](_0x59e8df[_0x4ce0('0x3f')]({'attributes':['id','name']}));_0x58d232['push'](_0x59e8df[_0x4ce0('0x40')]({'attributes':['id',_0x4ce0('0x6')]}));_0x58d232[_0x4ce0('0x2f')](_0x59e8df[_0x4ce0('0x41')]({'attributes':['id','name']}));_0x58d232[_0x4ce0('0x2f')](_0x59e8df[_0x4ce0('0x42')]({'attributes':['id',_0x4ce0('0x6')]}));break;}return BPromise[_0x4ce0('0x43')](_0x58d232);}})[_0x4ce0('0xb')](function(_0x28c3b1){if(_0x28c3b1&&_0x28c3b1[_0x4ce0('0x1a')]){for(var _0x157a48=0x0;_0x157a48<_0x28c3b1['length'];_0x157a48+=0x1){for(var _0x3d1172=0x0;_0x3d1172<_0x28c3b1[_0x157a48][_0x4ce0('0x1a')];_0x3d1172+=0x1){switch(_0x157a48){case 0x0:joinOrLeaveQueues(_0x4496bf,_0x256163,'voice',_0x28c3b1[_0x157a48][_0x3d1172]);break;case 0x1:joinOrLeaveQueues(_0x4496bf,_0x256163,_0x4ce0('0x44'),_0x28c3b1[_0x157a48][_0x3d1172]);break;case 0x2:joinOrLeaveQueues(_0x4496bf,_0x256163,_0x4ce0('0x45'),_0x28c3b1[_0x157a48][_0x3d1172]);break;case 0x3:joinOrLeaveQueues(_0x4496bf,_0x256163,_0x4ce0('0x46'),_0x28c3b1[_0x157a48][_0x3d1172]);break;case 0x4:joinOrLeaveQueues(_0x4496bf,_0x256163,_0x4ce0('0x47'),_0x28c3b1[_0x157a48][_0x3d1172]);break;case 0x5:joinOrLeaveQueues(_0x4496bf,_0x256163,_0x4ce0('0x48'),_0x28c3b1[_0x157a48][_0x3d1172]);break;case 0x6:joinOrLeaveQueues(_0x4496bf,_0x256163,_0x4ce0('0x49'),_0x28c3b1[_0x157a48][_0x3d1172]);break;case 0x7:if(_0x27024e[_0x4ce0('0x14')]!==_0x4ce0('0x5'))_0x4496bf[_0x256163](util[_0x4ce0('0x18')](_0x4ce0('0x4a'),_0x28c3b1[_0x157a48][_0x3d1172]['name']));break;case 0x8:if(_0x27024e[_0x4ce0('0x14')]!=='agent')_0x4496bf[_0x256163](util['format'](_0x4ce0('0x4b'),_0x28c3b1[_0x157a48][_0x3d1172][_0x4ce0('0x6')]));break;case 0x9:if(_0x27024e[_0x4ce0('0x14')]!==_0x4ce0('0x5'))_0x4496bf[_0x256163](util[_0x4ce0('0x18')](_0x4ce0('0x4c'),_0x28c3b1[_0x157a48][_0x3d1172][_0x4ce0('0x7')],_0x28c3b1[_0x157a48][_0x3d1172][_0x4ce0('0x6')]));break;case 0xa:_0x4496bf[_0x256163](util[_0x4ce0('0x18')](_0x4ce0('0x1b'),_0x28c3b1[_0x157a48][_0x3d1172][_0x4ce0('0x6')]));break;}}}}})[_0x4ce0('0xb')](function(){if(_0x256163===_0x4ce0('0x4d')){var _0x1711f7=_[_0x4ce0('0x4e')](_0x27024e['ChatInteractions'],'id');return _0x27024e[_0x4ce0('0x4f')](_0x1711f7)['then'](function(){for(var _0x465187=0x0;_0x465187<_0x1711f7[_0x4ce0('0x1a')];_0x465187+=0x1){_0x458bc5[_0x4ce0('0x50')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x1711f7[_0x465187]),'UserId':Number(_0x27024e['id'])});}});}})[_0x4ce0('0xb')](function(){if(_0x256163==='leave'){var _0x44d798=_[_0x4ce0('0x4e')](_0x27024e[_0x4ce0('0x22')],'id');return _0x27024e[_0x4ce0('0x51')](_0x44d798)['then'](function(){for(var _0x373456=0x0;_0x373456<_0x44d798[_0x4ce0('0x1a')];_0x373456+=0x1){_0x458bc5['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x44d798[_0x373456]),'UserId':Number(_0x27024e['id'])});}});}})[_0x4ce0('0xb')](function(){if(_0x256163===_0x4ce0('0x4d')){var _0x4dd5cb=_[_0x4ce0('0x4e')](_0x27024e[_0x4ce0('0x24')],'id');return _0x27024e[_0x4ce0('0x52')](_0x4dd5cb)[_0x4ce0('0xb')](function(){for(var _0x2f038e=0x0;_0x2f038e<_0x4dd5cb['length'];_0x2f038e+=0x1){_0x458bc5[_0x4ce0('0x50')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x4dd5cb[_0x2f038e]),'UserId':Number(_0x27024e['id'])});}});}})['then'](function(){if(_0x256163===_0x4ce0('0x4d')){var _0x1be005=_[_0x4ce0('0x4e')](_0x27024e['SmsInteractions'],'id');return _0x27024e[_0x4ce0('0x53')](_0x1be005)[_0x4ce0('0xb')](function(){for(var _0x310431=0x0;_0x310431<_0x1be005[_0x4ce0('0x1a')];_0x310431+=0x1){_0x458bc5['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x1be005[_0x310431]),'UserId':Number(_0x27024e['id'])});}});}})[_0x4ce0('0xb')](function(){if(_0x256163==='leave'){var _0x35cba6=_[_0x4ce0('0x4e')](_0x27024e[_0x4ce0('0x27')],'id');return _0x27024e['removeOpenchannelInteractions'](_0x35cba6)['then'](function(){for(var _0x49b1c5=0x0;_0x49b1c5<_0x35cba6[_0x4ce0('0x1a')];_0x49b1c5+=0x1){_0x458bc5[_0x4ce0('0x50')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x35cba6[_0x49b1c5]),'UserId':Number(_0x27024e['id'])});}});}})['then'](function(){if(_0x256163===_0x4ce0('0x4d')){var _0x36a46f=_['map'](_0x27024e[_0x4ce0('0x29')],'id');return _0x27024e[_0x4ce0('0x54')](_0x36a46f)[_0x4ce0('0xb')](function(){for(var _0x58c8c5=0x0;_0x58c8c5<_0x36a46f['length'];_0x58c8c5+=0x1){_0x458bc5[_0x4ce0('0x50')](_0x4ce0('0x55'),{'WhatsappInteractionId':Number(_0x36a46f[_0x58c8c5]),'UserId':Number(_0x27024e['id'])});}});}})[_0x4ce0('0x56')](function(_0xc6c189){_0x4496bf[_0x4ce0('0x57')](_0xc6c189);});}}function onDisconnect(_0xb49465,_0x1a2963){joinOrLeave(_0xb49465,_0x4ce0('0x4d'),_0x1a2963);}function onConnect(_0x404806){joinOrLeave(_0x404806,_0x4ce0('0x58'));}exports[_0x4ce0('0x59')]=function(_0x1929c1){_0x1929c1['on'](_0x4ce0('0x5a'),function(_0x577399){_0x577399[_0x4ce0('0x5b')](0x0);_0x577399['address']=_0x577399['request']['connection'][_0x4ce0('0x5c')]+':'+_0x577399[_0x4ce0('0x5d')]['connection'][_0x4ce0('0x5e')];_0x577399[_0x4ce0('0x5f')]=new Date();_0x577399[_0x4ce0('0x57')]=function(_0x151650){console[_0x4ce0('0x57')](_0x4ce0('0x60')+_0x577399['nsp'][_0x4ce0('0x6')]+'['+_0x577399['address']+']',_0x151650);};_0x577399['on'](_0x4ce0('0x61'),function(){onDisconnect(_0x577399,_0x1929c1);_0x577399[_0x4ce0('0x57')](_0x4ce0('0x62'));});onConnect(_0x577399);_0x577399['log']('CONNECTED');});}; \ No newline at end of file +var _0x25e7=['findAll','Trunks','UserProfileResource','resourceId','map','Campaign','where','%s:queue:%s','length','format','user:%s','query','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','SmsInteraction','OpenchannelInteractions','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','MailQueues','MailQueue','OpenchannelQueues','Telephones','Trunk','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','address','request','remotePort','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','telephone','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','FaxQueues','SmsQueues','WhatsappQueues'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x25e7,0x1d6));var _0x725e=function(_0x177346,_0x5e4024){_0x177346=_0x177346-0x0;var _0x155669=_0x25e7[_0x177346];return _0x155669;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var BPromise=require(_0x725e('0x2'));var db=require(_0x725e('0x3'))['db'];var config=require(_0x725e('0x4'));var queryQueues={'attributes':['id',_0x725e('0x5')],'include':[{'as':_0x725e('0x6'),'model':db[_0x725e('0x7')],'attributes':['id',_0x725e('0x5'),_0x725e('0x8')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x725e('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x725e('0xa')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x725e('0x5'),_0x725e('0xb')],'where':{'type':_0x725e('0xc')}};function getAssociatedResources(_0x40d238,_0x1f4a94,_0x39858a){return db[_0x725e('0xd')][_0x725e('0xe')]({'where':{'name':_0x40d238,'userProfileId':_0x1f4a94},'raw':!![]})[_0x725e('0xf')](function(_0x441c29){if(_0x441c29){if(_0x441c29[_0x725e('0x10')]){switch(_0x40d238){case'VoiceQueues':case'ChatQueues':case _0x725e('0x11'):case _0x725e('0x12'):case'MailQueues':case'OpenchannelQueues':case _0x725e('0x13'):return db[_0x39858a][_0x725e('0x14')](queryQueues);case'Telephones':return db[_0x39858a][_0x725e('0x14')](queryTelephones);case _0x725e('0x15'):return db[_0x39858a][_0x725e('0x14')](queryTrunks);case'IvrCampaigns':return db[_0x39858a][_0x725e('0x14')](queryCampaigns);}}else{return db[_0x725e('0x16')][_0x725e('0x14')]({'attributes':[_0x725e('0x17')],'where':{'sectionId':_0x441c29['id']},'raw':!![]})[_0x725e('0xf')](function(_0x13fbfe){if(_0x13fbfe){var _0x523422={'where':{'id':_[_0x725e('0x18')](_0x13fbfe,_0x725e('0x17'))},'raw':!![]};switch(_0x39858a){case _0x725e('0x7'):_0x523422['where'][_0x725e('0x8')]=_0x725e('0x9');break;case _0x725e('0x19'):_0x523422[_0x725e('0x1a')][_0x725e('0xb')]=_0x725e('0xc');break;}return db[_0x39858a]['findAll'](_0x523422);}else{return[];}});}}else{return[];}})[_0x725e('0xf')](function(_0x3ec8b3){return _0x3ec8b3;});}function joinOrLeaveQueues(_0x1b8879,_0x338a1d,_0x1a9ea6,_0x3ad3d2){_0x1b8879[_0x338a1d](util['format'](_0x725e('0x1b'),_0x1a9ea6,_0x3ad3d2[_0x725e('0x5')]));if(_0x3ad3d2[_0x725e('0x6')]){for(var _0x40c21b=0x0;_0x40c21b<_0x3ad3d2[_0x725e('0x6')][_0x725e('0x1c')];_0x40c21b+=0x1){_0x1b8879[_0x338a1d](util[_0x725e('0x1d')](_0x725e('0x1e'),_0x3ad3d2[_0x725e('0x6')][_0x40c21b]['name']));}}}function joinOrLeave(_0x10be1c,_0x36cbab,_0x389668){var _0x3facae;if(_0x10be1c['handshake'][_0x725e('0x1f')]['id']){db['User']['find']({'attributes':['id','name',_0x725e('0x8'),_0x725e('0x20')],'where':{'id':_0x10be1c[_0x725e('0x21')]['query']['id']},'include':[{'model':db[_0x725e('0x22')],'as':_0x725e('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x725e('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x725e('0x25')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x725e('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x725e('0x27'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x725e('0x28'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x4de2e0){if(_0x4de2e0){_0x3facae=_0x4de2e0;_0x10be1c[_0x36cbab](util[_0x725e('0x1d')](_0x725e('0x1e'),_0x4de2e0[_0x725e('0x5')]));var _0x545237=[];switch(_0x4de2e0[_0x725e('0x8')]){case'admin':_0x10be1c[_0x36cbab](_0x725e('0x29'));_0x10be1c[_0x36cbab](_0x725e('0x2a'));if(queryQueues[_0x725e('0x2b')](_0x725e('0x2c'))){delete queryQueues[_0x725e('0x2c')];}_0x545237[_0x725e('0x2d')](db[_0x725e('0x2e')][_0x725e('0x14')](queryQueues));_0x545237[_0x725e('0x2d')](db[_0x725e('0x2f')][_0x725e('0x14')](queryQueues));_0x545237['push'](db[_0x725e('0x30')][_0x725e('0x14')](queryQueues));_0x545237['push'](db[_0x725e('0x31')]['findAll'](queryQueues));_0x545237[_0x725e('0x2d')](db['MailQueue'][_0x725e('0x14')](queryQueues));_0x545237[_0x725e('0x2d')](db[_0x725e('0x32')][_0x725e('0x14')](queryQueues));_0x545237[_0x725e('0x2d')](db[_0x725e('0x33')]['findAll'](queryQueues));_0x545237['push'](db[_0x725e('0x7')][_0x725e('0x14')](queryTelephones));_0x545237[_0x725e('0x2d')](db['Trunk'][_0x725e('0x14')](queryTrunks));_0x545237['push'](db[_0x725e('0x19')][_0x725e('0x14')](queryCampaigns));_0x545237[_0x725e('0x2d')](db[_0x725e('0x7')]['findAll'](queryAgents));break;case'user':_0x10be1c[_0x36cbab](_0x725e('0x29'));_0x10be1c[_0x36cbab](_0x725e('0x2a'));_0x545237[_0x725e('0x2d')](getAssociatedResources('VoiceQueues',_0x4de2e0[_0x725e('0x20')],_0x725e('0x2e')));_0x545237[_0x725e('0x2d')](getAssociatedResources('ChatQueues',_0x4de2e0[_0x725e('0x20')],'ChatQueue'));_0x545237[_0x725e('0x2d')](getAssociatedResources(_0x725e('0x11'),_0x4de2e0[_0x725e('0x20')],_0x725e('0x30')));_0x545237[_0x725e('0x2d')](getAssociatedResources('SmsQueues',_0x4de2e0['userProfileId'],_0x725e('0x31')));_0x545237[_0x725e('0x2d')](getAssociatedResources(_0x725e('0x34'),_0x4de2e0['userProfileId'],_0x725e('0x35')));_0x545237['push'](getAssociatedResources(_0x725e('0x36'),_0x4de2e0[_0x725e('0x20')],_0x725e('0x32')));_0x545237[_0x725e('0x2d')](getAssociatedResources('WhatsappQueues',_0x4de2e0[_0x725e('0x20')],_0x725e('0x33')));_0x545237[_0x725e('0x2d')](getAssociatedResources(_0x725e('0x37'),_0x4de2e0[_0x725e('0x20')],_0x725e('0x7')));_0x545237[_0x725e('0x2d')](getAssociatedResources('Trunks',_0x4de2e0[_0x725e('0x20')],_0x725e('0x38')));_0x545237['push'](getAssociatedResources(_0x725e('0x39'),_0x4de2e0[_0x725e('0x20')],'Campaign'));_0x545237['push'](db['User']['findAll'](queryAgents));break;case _0x725e('0xa'):_0x10be1c[_0x36cbab](_0x725e('0x29'));_0x10be1c[_0x36cbab](_0x725e('0x2a'));_0x545237['push'](_0x4de2e0[_0x725e('0x3a')]({'attributes':['id','name']}));_0x545237['push'](_0x4de2e0[_0x725e('0x3b')]({'attributes':['id',_0x725e('0x5')]}));_0x545237[_0x725e('0x2d')](_0x4de2e0[_0x725e('0x3c')]({'attributes':['id',_0x725e('0x5')]}));_0x545237[_0x725e('0x2d')](_0x4de2e0['getSmsQueues']({'attributes':['id',_0x725e('0x5')]}));_0x545237['push'](_0x4de2e0[_0x725e('0x3d')]({'attributes':['id',_0x725e('0x5')]}));_0x545237['push'](_0x4de2e0[_0x725e('0x3e')]({'attributes':['id','name']}));_0x545237[_0x725e('0x2d')](_0x4de2e0[_0x725e('0x3f')]({'attributes':['id','name']}));break;}return BPromise['all'](_0x545237);}})[_0x725e('0xf')](function(_0x5e4c0c){if(_0x5e4c0c&&_0x5e4c0c[_0x725e('0x1c')]){for(var _0x537ae5=0x0;_0x537ae5<_0x5e4c0c['length'];_0x537ae5+=0x1){for(var _0x497c54=0x0;_0x497c54<_0x5e4c0c[_0x537ae5][_0x725e('0x1c')];_0x497c54+=0x1){switch(_0x537ae5){case 0x0:joinOrLeaveQueues(_0x10be1c,_0x36cbab,_0x725e('0x40'),_0x5e4c0c[_0x537ae5][_0x497c54]);break;case 0x1:joinOrLeaveQueues(_0x10be1c,_0x36cbab,'chat',_0x5e4c0c[_0x537ae5][_0x497c54]);break;case 0x2:joinOrLeaveQueues(_0x10be1c,_0x36cbab,_0x725e('0x41'),_0x5e4c0c[_0x537ae5][_0x497c54]);break;case 0x3:joinOrLeaveQueues(_0x10be1c,_0x36cbab,_0x725e('0x42'),_0x5e4c0c[_0x537ae5][_0x497c54]);break;case 0x4:joinOrLeaveQueues(_0x10be1c,_0x36cbab,'mail',_0x5e4c0c[_0x537ae5][_0x497c54]);break;case 0x5:joinOrLeaveQueues(_0x10be1c,_0x36cbab,_0x725e('0x43'),_0x5e4c0c[_0x537ae5][_0x497c54]);break;case 0x6:joinOrLeaveQueues(_0x10be1c,_0x36cbab,_0x725e('0x44'),_0x5e4c0c[_0x537ae5][_0x497c54]);break;case 0x7:if(_0x3facae[_0x725e('0x8')]!==_0x725e('0xa'))_0x10be1c[_0x36cbab](util[_0x725e('0x1d')](_0x725e('0x45'),_0x5e4c0c[_0x537ae5][_0x497c54][_0x725e('0x5')]));break;case 0x8:if(_0x3facae[_0x725e('0x8')]!==_0x725e('0xa'))_0x10be1c[_0x36cbab](util[_0x725e('0x1d')](_0x725e('0x46'),_0x5e4c0c[_0x537ae5][_0x497c54][_0x725e('0x5')]));break;case 0x9:if(_0x3facae[_0x725e('0x8')]!=='agent')_0x10be1c[_0x36cbab](util[_0x725e('0x1d')]('campaign:%s:%s',_0x5e4c0c[_0x537ae5][_0x497c54][_0x725e('0xb')],_0x5e4c0c[_0x537ae5][_0x497c54][_0x725e('0x5')]));break;case 0xa:_0x10be1c[_0x36cbab](util[_0x725e('0x1d')](_0x725e('0x1e'),_0x5e4c0c[_0x537ae5][_0x497c54][_0x725e('0x5')]));break;}}}}})[_0x725e('0xf')](function(){if(_0x36cbab===_0x725e('0x47')){var _0x1a9dca=_[_0x725e('0x18')](_0x3facae[_0x725e('0x23')],'id');return _0x3facae[_0x725e('0x48')](_0x1a9dca)[_0x725e('0xf')](function(){for(var _0x361050=0x0;_0x361050<_0x1a9dca[_0x725e('0x1c')];_0x361050+=0x1){_0x389668[_0x725e('0x49')](_0x725e('0x4a'),{'ChatInteractionId':Number(_0x1a9dca[_0x361050]),'UserId':Number(_0x3facae['id'])});}});}})[_0x725e('0xf')](function(){if(_0x36cbab===_0x725e('0x47')){var _0x5cda07=_[_0x725e('0x18')](_0x3facae['MailInteractions'],'id');return _0x3facae[_0x725e('0x4b')](_0x5cda07)[_0x725e('0xf')](function(){for(var _0x56438d=0x0;_0x56438d<_0x5cda07[_0x725e('0x1c')];_0x56438d+=0x1){_0x389668['emit'](_0x725e('0x4c'),{'MailInteractionId':Number(_0x5cda07[_0x56438d]),'UserId':Number(_0x3facae['id'])});}});}})[_0x725e('0xf')](function(){if(_0x36cbab===_0x725e('0x47')){var _0x53d504=_[_0x725e('0x18')](_0x3facae[_0x725e('0x4d')],'id');return _0x3facae[_0x725e('0x4e')](_0x53d504)[_0x725e('0xf')](function(){for(var _0x2afb6e=0x0;_0x2afb6e<_0x53d504[_0x725e('0x1c')];_0x2afb6e+=0x1){_0x389668[_0x725e('0x49')](_0x725e('0x4f'),{'FaxInteractionId':Number(_0x53d504[_0x2afb6e]),'UserId':Number(_0x3facae['id'])});}});}})['then'](function(){if(_0x36cbab===_0x725e('0x47')){var _0x215018=_['map'](_0x3facae['SmsInteractions'],'id');return _0x3facae[_0x725e('0x50')](_0x215018)[_0x725e('0xf')](function(){for(var _0x49a692=0x0;_0x49a692<_0x215018['length'];_0x49a692+=0x1){_0x389668[_0x725e('0x49')](_0x725e('0x51'),{'SmsInteractionId':Number(_0x215018[_0x49a692]),'UserId':Number(_0x3facae['id'])});}});}})[_0x725e('0xf')](function(){if(_0x36cbab===_0x725e('0x47')){var _0x38afad=_[_0x725e('0x18')](_0x3facae['OpenchannelInteractions'],'id');return _0x3facae[_0x725e('0x52')](_0x38afad)[_0x725e('0xf')](function(){for(var _0x5c5a3f=0x0;_0x5c5a3f<_0x38afad[_0x725e('0x1c')];_0x5c5a3f+=0x1){_0x389668[_0x725e('0x49')](_0x725e('0x53'),{'OpenchannelInteractionId':Number(_0x38afad[_0x5c5a3f]),'UserId':Number(_0x3facae['id'])});}});}})[_0x725e('0xf')](function(){if(_0x36cbab===_0x725e('0x47')){var _0x586ef5=_[_0x725e('0x18')](_0x3facae[_0x725e('0x28')],'id');return _0x3facae[_0x725e('0x54')](_0x586ef5)[_0x725e('0xf')](function(){for(var _0x3af5fd=0x0;_0x3af5fd<_0x586ef5[_0x725e('0x1c')];_0x3af5fd+=0x1){_0x389668['emit'](_0x725e('0x55'),{'WhatsappInteractionId':Number(_0x586ef5[_0x3af5fd]),'UserId':Number(_0x3facae['id'])});}});}})['catch'](function(_0x517bb9){_0x10be1c[_0x725e('0x56')](_0x517bb9);});}}function onDisconnect(_0x55ad92,_0x4e9bb9){joinOrLeave(_0x55ad92,_0x725e('0x47'),_0x4e9bb9);}function onConnect(_0x4452d3){joinOrLeave(_0x4452d3,_0x725e('0x57'));}exports[_0x725e('0x58')]=function(_0x402eb3){_0x402eb3['on'](_0x725e('0x59'),function(_0x3bb800){_0x3bb800['setMaxListeners'](0x0);_0x3bb800[_0x725e('0x5a')]=_0x3bb800[_0x725e('0x5b')][_0x725e('0x59')]['remoteAddress']+':'+_0x3bb800['request'][_0x725e('0x59')][_0x725e('0x5c')];_0x3bb800[_0x725e('0x5d')]=new Date();_0x3bb800[_0x725e('0x56')]=function(_0x106493){console[_0x725e('0x56')](_0x725e('0x5e')+_0x3bb800['nsp'][_0x725e('0x5')]+'['+_0x3bb800['address']+']',_0x106493);};_0x3bb800['on'](_0x725e('0x5f'),function(){onDisconnect(_0x3bb800,_0x402eb3);_0x3bb800['log'](_0x725e('0x60'));});onConnect(_0x3bb800);_0x3bb800[_0x725e('0x56')](_0x725e('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 287f172..cf2d8d6 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 _0x0cfe=['FaxInteraction','FaxMessage','Mail','MailInteraction','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','catch','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','QueryTypes','SELECT','contact','UserId','find','name','fullname','email','internal','format','channel','agent','incomingmessage','opened','closed','get','event','User','interface','SIP/%s','default','length','hasOwnProperty','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','Sms','SmsInteraction','SmsMessage','newmessage','Whatsapp','WhatsappInteraction'];(function(_0x36b84a,_0x5aad0f){var _0x2cdf68=function(_0x1745f7){while(--_0x1745f7){_0x36b84a['push'](_0x36b84a['shift']());}};_0x2cdf68(++_0x5aad0f);}(_0x0cfe,0x167));var _0xe0cf=function(_0x2b5dcb,_0x45c076){_0x2b5dcb=_0x2b5dcb-0x0;var _0x10bf34=_0x0cfe[_0x2b5dcb];return _0x10bf34;};'use strict';var util=require(_0xe0cf('0x0'));var db=require(_0xe0cf('0x1'))['db'];var jayson=require(_0xe0cf('0x2'));var logger=require(_0xe0cf('0x3'))('triggers');var _=require('lodash');var client=jayson[_0xe0cf('0x4')][_0xe0cf('0x5')]({'port':0x232a});var triggers=[{'channel':_0xe0cf('0x6'),'model':_0xe0cf('0x7'),'event':_0xe0cf('0x8'),'condition':_0xe0cf('0x9'),'callback':afterCreate},{'channel':_0xe0cf('0x6'),'model':_0xe0cf('0x7'),'event':_0xe0cf('0xa'),'condition':_0xe0cf('0xb'),'callback':afterUpdate},{'channel':_0xe0cf('0x6'),'model':_0xe0cf('0xc'),'event':_0xe0cf('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xe0cf('0xd'),'model':_0xe0cf('0xe'),'event':_0xe0cf('0x8'),'condition':_0xe0cf('0x9'),'callback':afterCreate},{'channel':_0xe0cf('0xd'),'model':_0xe0cf('0xe'),'event':_0xe0cf('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xe0cf('0xd'),'model':_0xe0cf('0xf'),'event':_0xe0cf('0x8'),'condition':_0xe0cf('0x10'),'callback':afterCreateMessage},{'channel':_0xe0cf('0x11'),'model':_0xe0cf('0x12'),'event':_0xe0cf('0x8'),'condition':_0xe0cf('0x9'),'callback':afterCreate},{'channel':_0xe0cf('0x11'),'model':_0xe0cf('0x12'),'event':_0xe0cf('0xa'),'condition':_0xe0cf('0xb'),'callback':afterUpdate},{'channel':_0xe0cf('0x11'),'model':'WhatsappMessage','event':'afterCreate','condition':_0xe0cf('0x10'),'callback':afterCreateMessage},{'channel':'Fax','model':'FaxInteraction','event':_0xe0cf('0x8'),'condition':_0xe0cf('0x9'),'callback':afterCreate},{'channel':'Fax','model':_0xe0cf('0x13'),'event':'afterUpdate','condition':_0xe0cf('0xb'),'callback':afterUpdate},{'channel':'Fax','model':_0xe0cf('0x14'),'event':_0xe0cf('0x8'),'condition':_0xe0cf('0x10'),'callback':afterCreateMessage},{'channel':_0xe0cf('0x15'),'model':_0xe0cf('0x16'),'event':'afterCreate','condition':_0xe0cf('0x9'),'callback':afterCreate},{'channel':_0xe0cf('0x15'),'model':'MailInteraction','event':_0xe0cf('0xa'),'condition':_0xe0cf('0xb'),'callback':afterUpdate},{'channel':_0xe0cf('0x15'),'model':'MailMessage','event':_0xe0cf('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':_0xe0cf('0x17'),'event':_0xe0cf('0x8'),'condition':_0xe0cf('0x9'),'callback':afterCreate},{'channel':_0xe0cf('0x18'),'model':_0xe0cf('0x17'),'event':'afterUpdate','condition':_0xe0cf('0xb'),'callback':afterUpdate},{'channel':_0xe0cf('0x18'),'model':_0xe0cf('0x19'),'event':_0xe0cf('0x8'),'condition':_0xe0cf('0x10'),'callback':afterCreateMessage}];function request(_0x57c573){return client[_0xe0cf('0x1a')](_0xe0cf('0x1b'),_0x57c573)[_0xe0cf('0x1c')](function(_0x38222a){logger[_0xe0cf('0x1d')](_0xe0cf('0x1e'),'EventManager',_0x38222a);if(_0x38222a[_0xe0cf('0x1f')]){if(_0x38222a[_0xe0cf('0x1f')]['code']===0x1f4){logger[_0xe0cf('0x1f')](_0xe0cf('0x1e'),_0xe0cf('0x1b'),_0x38222a[_0xe0cf('0x1f')]);}}})[_0xe0cf('0x20')](function(_0x11cc47){logger[_0xe0cf('0x1f')]('Trigger,\x20%s',_0xe0cf('0x1b'),_0x11cc47);});}function afterCreateMessage(_0x28c93a,_0x4ae670){return function(_0xa3fbf1,_0x3d7575){_0xa3fbf1=_0xa3fbf1['get']({'plain':!![]});_0xa3fbf1['channel']=_0x28c93a;_0xa3fbf1['event']=_0xa3fbf1['direction'];var _0x426f17=_0xe0cf('0x21')+_0xa3fbf1[_0xe0cf('0x22')];return db[_0xe0cf('0x23')][_0xe0cf('0x24')](_0x426f17,{'type':db['Sequelize'][_0xe0cf('0x25')][_0xe0cf('0x26')],'raw':!![]})[_0xe0cf('0x1c')](function(_0x2a5c81){return _0x2a5c81;})[_0xe0cf('0x1c')](function(_0x355fc6){if(_0x355fc6){_0xa3fbf1[_0xe0cf('0x27')]=_0x355fc6[0x0];}if(_0xa3fbf1[_0xe0cf('0x28')]){return db['User'][_0xe0cf('0x29')]({'where':{'id':_0xa3fbf1[_0xe0cf('0x28')]},'attributes':['id',_0xe0cf('0x2a'),_0xe0cf('0x2b'),_0xe0cf('0x2c'),_0xe0cf('0x2d')],'raw':!![]})['then'](function(_0x27fd02){_0xa3fbf1['interface']=util[_0xe0cf('0x2e')]('SIP/%s',_0x27fd02[_0xe0cf('0x2a')]);_0xa3fbf1[_0xe0cf('0x2f')]=_0x28c93a;_0xa3fbf1[_0xe0cf('0x30')]=_0x27fd02;return request({'event':_0xe0cf('0x31'),'message':_0xa3fbf1});})[_0xe0cf('0x20')](function(_0x44a1a4){console[_0xe0cf('0x1f')](_0x44a1a4);});}else{return request({'event':'outgoingmessage','message':_0xa3fbf1});}});};}function afterCreate(_0x26a123,_0x535c41){return function(_0x236f1f,_0x2f96e4){_0x236f1f=_0x236f1f['get']({'plain':!![]});_0x236f1f[_0xe0cf('0x2f')]=_0x26a123;_0x236f1f['event']=_0xe0cf('0x32');var _0xea5570=_0xe0cf('0x21')+_0x236f1f[_0xe0cf('0x22')];return db['sequelize'][_0xe0cf('0x24')](_0xea5570,{'type':db['Sequelize']['QueryTypes'][_0xe0cf('0x26')],'raw':!![]})[_0xe0cf('0x1c')](function(_0x3c665f){return _0x3c665f;})[_0xe0cf('0x1c')](function(_0x27233f){if(_0x27233f){_0x236f1f[_0xe0cf('0x27')]=_0x27233f[0x0];}return request({'event':_0x535c41,'message':_0x236f1f});});};}function afterUpdate(_0x2939fa,_0x1b72c0){return function(_0xee3e8,_0x1cab8d){if(_0xee3e8['changed'](_0xe0cf('0x33'))&&_0xee3e8['closed']){_0xee3e8=_0xee3e8[_0xe0cf('0x34')]({'plain':!![]});_0xee3e8[_0xe0cf('0x2f')]=_0x2939fa;_0xee3e8[_0xe0cf('0x35')]='closed';var _0xde1e7e=_0xe0cf('0x21')+_0xee3e8[_0xe0cf('0x22')];return db[_0xe0cf('0x23')][_0xe0cf('0x24')](_0xde1e7e,{'type':db['Sequelize'][_0xe0cf('0x25')][_0xe0cf('0x26')],'raw':!![]})[_0xe0cf('0x1c')](function(_0x3e4b77){return _0x3e4b77;})[_0xe0cf('0x1c')](function(_0x37f176){if(_0x37f176){_0xee3e8[_0xe0cf('0x27')]=_0x37f176[0x0];}if(_0xee3e8[_0xe0cf('0x28')]){return db[_0xe0cf('0x36')][_0xe0cf('0x29')]({'where':{'id':_0xee3e8[_0xe0cf('0x28')]},'attributes':['id',_0xe0cf('0x2a'),_0xe0cf('0x2b'),_0xe0cf('0x2c'),_0xe0cf('0x2d')],'raw':!![]})[_0xe0cf('0x1c')](function(_0x552292){_0xee3e8[_0xe0cf('0x37')]=util[_0xe0cf('0x2e')](_0xe0cf('0x38'),_0x552292[_0xe0cf('0x2a')]);_0xee3e8[_0xe0cf('0x30')]=_0x552292;return request({'event':_0x1b72c0,'message':_0xee3e8});})[_0xe0cf('0x20')](function(_0x3c5272){console['error'](_0x3c5272);});}else{return request({'event':_0x1b72c0,'message':_0xee3e8});}});}};}exports[_0xe0cf('0x39')]=function(){for(var _0x27ef45=0x0;_0x27ef45=_0x165de5[_0x1451('0x14')]){throw Error(_0x1451('0x15'));}_0x12ccce(_0x3c7b8a);})[_0x1451('0x16')](function(_0x5c9f93){_0x2b53d0(_0x5c9f93);});});}; \ No newline at end of file +var _0xd463=['Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','./license/util','voice','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','updateAttributes','role','agent','count','getLicense','then','agents'];(function(_0x997db4,_0x4ae863){var _0x173ed9=function(_0x507f37){while(--_0x507f37){_0x997db4['push'](_0x997db4['shift']());}};_0x173ed9(++_0x4ae863);}(_0xd463,0x116));var _0x3d46=function(_0x4d29eb,_0x5ba766){_0x4d29eb=_0x4d29eb-0x0;var _0x53cadb=_0xd463[_0x4d29eb];return _0x53cadb;};'use strict';var _=require(_0x3d46('0x0'));var BPromise=require(_0x3d46('0x1'));var db=require('../mysqldb')['db'];var util=require(_0x3d46('0x2'));var channels=[_0x3d46('0x3'),'mail',_0x3d46('0x4'),_0x3d46('0x5'),_0x3d46('0x6'),_0x3d46('0x7'),_0x3d46('0x8')];exports[_0x3d46('0x9')]=function(){return channels;};exports[_0x3d46('0xa')]=function(_0x3878b6){_0x3878b6=_0x3878b6[_0x3d46('0xb')]();return _[_0x3d46('0xc')](channels,_0x3878b6);};exports[_0x3d46('0xd')]=function(_0x4bcc19,_0x36c787,_0x58dfd8,_0x1e0ac3){var _0x15d6da={'loginAttempts':_0x36c787,'blocked':_0x58dfd8};if(!_['isUndefined'](_0x1e0ac3)){_0x15d6da['blockedAt']=_0x1e0ac3;}return _0x4bcc19[_0x3d46('0xe')](_0x15d6da);};exports['getLicense']=function(_0x517610){return new BPromise(function(_0x2891a7,_0x335c3){var _0xae4474=0x0;if(_0x517610[_0x3d46('0xf')]!==_0x3d46('0x10')){_0x2891a7(_0x517610);}db['User'][_0x3d46('0x11')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x517610['id']}}})['then'](function(_0xb2bc78){_0xae4474=_0xb2bc78;return util[_0x3d46('0x12')]();})[_0x3d46('0x13')](function(_0x20c52c){if(_0x20c52c&&_0x20c52c[_0x3d46('0x14')]&&_0xae4474>=_0x20c52c[_0x3d46('0x14')]){throw Error(_0x3d46('0x15'));}_0x2891a7(_0x517610);})[_0x3d46('0x16')](function(_0x5cd31b){_0x335c3(_0x5cd31b);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 8d5faac..82c46b4 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d88=['json','send','exports','404','status'];(function(_0x4f85ab,_0x4f9be6){var _0x24c33c=function(_0x514f42){while(--_0x514f42){_0x4f85ab['push'](_0x4f85ab['shift']());}};_0x24c33c(++_0x4f9be6);}(_0x2d88,0x110));var _0x82d8=function(_0x55460c,_0x160bbc){_0x55460c=_0x55460c-0x0;var _0x1e3daf=_0x2d88[_0x55460c];return _0x1e3daf;};'use strict';module[_0x82d8('0x0')][0x194]=function pageNotFound(_0x456c04,_0x150da0){var _0x1b0312=_0x82d8('0x1');var _0x13ab3e=0x194;var _0x407e78={'status':_0x13ab3e};_0x150da0[_0x82d8('0x2')](_0x407e78[_0x82d8('0x2')]);_0x150da0['render'](_0x1b0312,{},function(_0x38ef91,_0x186bbe){if(_0x38ef91){return _0x150da0['status'](_0x407e78[_0x82d8('0x2')])[_0x82d8('0x3')](_0x407e78);}_0x150da0[_0x82d8('0x4')](_0x186bbe);});}; \ No newline at end of file +var _0x4d5a=['json','send','status'];(function(_0xbe4081,_0x1ee293){var _0x29c2b7=function(_0x2a1f98){while(--_0x2a1f98){_0xbe4081['push'](_0xbe4081['shift']());}};_0x29c2b7(++_0x1ee293);}(_0x4d5a,0x15e));var _0xa4d5=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4d5a[_0x2dafbe];return _0x58a45a;};'use strict';module['exports'][0x194]=function pageNotFound(_0x158091,_0x2e6438){var _0x22b331='404';var _0x32d206=0x194;var _0x3c99fd={'status':_0x32d206};_0x2e6438[_0xa4d5('0x0')](_0x3c99fd[_0xa4d5('0x0')]);_0x2e6438['render'](_0x22b331,{},function(_0x30a0d8,_0x56769c){if(_0x30a0d8){return _0x2e6438['status'](_0x3c99fd[_0xa4d5('0x0')])[_0xa4d5('0x1')](_0x3c99fd);}_0x2e6438[_0xa4d5('0x2')](_0x56769c);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 5616fcc..1021d26 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f27=['ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','../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/attachment/attachment.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade','UserId','User','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','MailInteractions','WhatsappInteraction','UserNotifications','SenderId','belongsTo','Groups','chat_group_has_users','belongsToMany','cm_user_has_lists','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_sms_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueues','UserChatQueue','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueue','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','user_has_chat_websites','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperFinals','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkBackup','TrunkBackupId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','uniqueid','AgentReports','Contact','ContactId','MailAccountId','MailServerOut','Imap','Smtp','Dispositions','CannedAnswer','Interactions','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','MailInteractionId','CmContact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Attachment','Attachments','Interaction','ChatWebsiteId','restrict','Items','FaxAccountId','Answers','FaxApplication','Exntensions','TagId','Account','Users','user_has_fax_interactions','FaxInteractionId','SmsAccountId','IntervalId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ProactiveActions','ChatApplication','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','AttachmentId','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmCompany','Contacts','CompanyId','HopperHistories','Company','cm_user_has_contacts','cm_contact_has_tags','CampaignId','OwnerId','Automation','Condition','All','OneAll','OneAny','Actions','AutomationId','ParentId','Intervals','Extensions','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','fax_interaction_has_tags','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','SalesforceConfiguration','Subjects','Descriptions','DescriptionId','FieldId','SubjectId','Field','Subject','Description','VariableId','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','ServicenowAccount','Dynamics365Configuration','FreshsalesField','ChatQueueReport','ToId','SessionId','SmsQueueReport','ProjectId','user_has_square_projects','team_has_fax_queues','team_has_whatsapp_queues','TrunkId','SquareProjectId','Lists','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAgent','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','OpenchannelTransferReport','ToOpenchannelQueueId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','CustomFields','HopperHistory','Queues','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','exports','../config/environment','lodash','determine','sequelize','defaultsDeep','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','xcall','database','username','password','options','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserWhatsappQueue','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model'];(function(_0x53807e,_0x247981){var _0x2eeec4=function(_0x3df5fe){while(--_0x3df5fe){_0x53807e['push'](_0x53807e['shift']());}};_0x2eeec4(++_0x247981);}(_0x5f27,0x17c));var _0x75f2=function(_0x7518fa,_0x3ea48a){_0x7518fa=_0x7518fa-0x0;var _0x13369e=_0x5f27[_0x7518fa];return _0x13369e;};'use strict';var config=require(_0x75f2('0x0'));var Sequelize=require('sequelize');var _=require(_0x75f2('0x1'));var jstz=require('jstz');var timezone=jstz[_0x75f2('0x2')]();config[_0x75f2('0x3')]=_[_0x75f2('0x4')](config[_0x75f2('0x3')],{'database':'motion2','username':'xcall','password':_0x75f2('0x5'),'options':{'host':_0x75f2('0x6'),'port':0xcea,'dialect':_0x75f2('0x7'),'dialectOptions':{'charset':_0x75f2('0x8')},'logging':![],'timezone':timezone[_0x75f2('0x9')](),'define':{'charset':_0x75f2('0xa'),'collate':_0x75f2('0xb')}}});config[_0x75f2('0xc')]=_[_0x75f2('0x4')](config['sequelizeHistory'],{'database':_0x75f2('0xd'),'username':_0x75f2('0xe'),'password':_0x75f2('0x5'),'options':{'host':_0x75f2('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x75f2('0x8')},'logging':![],'timezone':timezone[_0x75f2('0x9')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x75f2('0xf')],config[_0x75f2('0x3')]['username'],config['sequelize']['password'],config[_0x75f2('0x3')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x75f2('0xf')],config[_0x75f2('0xc')][_0x75f2('0x10')],config[_0x75f2('0xc')][_0x75f2('0x11')],config['sequelizeHistory'][_0x75f2('0x12')])};db['User']=db['sequelize'][_0x75f2('0x13')]('../api/user/user.model');db[_0x75f2('0x14')]=db[_0x75f2('0x3')]['import'](_0x75f2('0x15'));db[_0x75f2('0x16')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x17'));db[_0x75f2('0x18')]=db[_0x75f2('0x3')][_0x75f2('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0x75f2('0x19')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0x1a'));db[_0x75f2('0x1b')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x1c'));db['VoiceRecording']=db['sequelize']['import'](_0x75f2('0x1d'));db[_0x75f2('0x1e')]=db[_0x75f2('0x3')]['import'](_0x75f2('0x1f'));db[_0x75f2('0x20')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x21'));db[_0x75f2('0x22')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x23'));db[_0x75f2('0x24')]=db[_0x75f2('0x3')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x75f2('0x25')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0x26'));db['VoiceAgentReport']=db['sequelize'][_0x75f2('0x13')](_0x75f2('0x27'));db[_0x75f2('0x28')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x29'));db[_0x75f2('0x2a')]=db[_0x75f2('0x3')]['import'](_0x75f2('0x2b'));db[_0x75f2('0x2c')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x2d'));db[_0x75f2('0x2e')]=db[_0x75f2('0x3')][_0x75f2('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x75f2('0x2f')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0x30'));db[_0x75f2('0x31')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x32'));db['UserChatQueue']=db[_0x75f2('0x3')]['import'](_0x75f2('0x33'));db[_0x75f2('0x34')]=db[_0x75f2('0x3')]['import'](_0x75f2('0x35'));db[_0x75f2('0x36')]=db[_0x75f2('0x3')][_0x75f2('0x13')]('../api/userFaxQueue/userFaxQueue.model');db[_0x75f2('0x37')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x38'));db['UserOpenchannelQueue']=db[_0x75f2('0x3')][_0x75f2('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x75f2('0x39')]=db['sequelize'][_0x75f2('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x3a'));db['MailServerOut']=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x3b'));db[_0x75f2('0x3c')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x3d'));db[_0x75f2('0x3e')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0x3f'));db[_0x75f2('0x40')]=db[_0x75f2('0x3')]['import'](_0x75f2('0x41'));db[_0x75f2('0x42')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x43'));db[_0x75f2('0x44')]=db[_0x75f2('0x3')][_0x75f2('0x13')]('../api/mailMessage/mailMessage.model');db[_0x75f2('0x45')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x46'));db[_0x75f2('0x47')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0x48'));db['Dashboard']=db[_0x75f2('0x3')]['import'](_0x75f2('0x49'));db[_0x75f2('0x4a')]=db['sequelize']['import'](_0x75f2('0x4b'));db[_0x75f2('0x4c')]=db[_0x75f2('0x3')]['import']('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x4d'));db[_0x75f2('0x4e')]=db['sequelize']['import'](_0x75f2('0x4f'));db[_0x75f2('0x50')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x51'));db['FaxQueue']=db[_0x75f2('0x3')]['import'](_0x75f2('0x52'));db[_0x75f2('0x53')]=db['sequelize']['import'](_0x75f2('0x54'));db[_0x75f2('0x55')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x56'));db[_0x75f2('0x57')]=db[_0x75f2('0x3')]['import'](_0x75f2('0x58'));db[_0x75f2('0x59')]=db[_0x75f2('0x3')]['import'](_0x75f2('0x5a'));db[_0x75f2('0x5b')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x5c'));db[_0x75f2('0x5d')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x5e'));db[_0x75f2('0x5f')]=db[_0x75f2('0x3')][_0x75f2('0x13')]('../api/openchannelAccount/openchannelAccount.model');db[_0x75f2('0x60')]=db[_0x75f2('0x3')][_0x75f2('0x13')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db['sequelize'][_0x75f2('0x13')](_0x75f2('0x61'));db[_0x75f2('0x62')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x63'));db['OpenchannelQueue']=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x64'));db[_0x75f2('0x65')]=db[_0x75f2('0x3')]['import'](_0x75f2('0x66'));db[_0x75f2('0x67')]=db[_0x75f2('0x3')]['import'](_0x75f2('0x68'));db['ChatApplication']=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x69'));db[_0x75f2('0x6a')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x6b'));db[_0x75f2('0x6c')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0x6d'));db[_0x75f2('0x6e')]=db[_0x75f2('0x3')][_0x75f2('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x75f2('0x6f')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x70'));db[_0x75f2('0x71')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x72'));db[_0x75f2('0x73')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0x74'));db['CmCompany']=db[_0x75f2('0x3')]['import'](_0x75f2('0x75'));db['CmContact']=db['sequelize'][_0x75f2('0x13')]('../api/cmContact/cmContact.model');db[_0x75f2('0x76')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0x77'));db[_0x75f2('0x78')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0x79'));db[_0x75f2('0x7a')]=db[_0x75f2('0x3')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0x75f2('0x7b')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x7c'));db[_0x75f2('0x7d')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x7e'));db[_0x75f2('0x7f')]=db[_0x75f2('0x3')][_0x75f2('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0x75f2('0x80')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x81'));db['Automation']=db[_0x75f2('0x3')][_0x75f2('0x13')]('../api/automation/automation.model');db['CannedAnswer']=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x82'));db[_0x75f2('0x83')]=db['sequelize'][_0x75f2('0x13')]('../api/disposition/disposition.model');db['Condition']=db['sequelize']['import'](_0x75f2('0x84'));db[_0x75f2('0x85')]=db[_0x75f2('0x3')]['import'](_0x75f2('0x86'));db[_0x75f2('0x87')]=db[_0x75f2('0x3')]['import'](_0x75f2('0x88'));db['Cdr']=db['sequelize']['import'](_0x75f2('0x89'));db[_0x75f2('0x8a')]=db['sequelize'][_0x75f2('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x75f2('0x8b')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x8c'));db[_0x75f2('0x8d')]=db[_0x75f2('0x3')]['import'](_0x75f2('0x8e'));db[_0x75f2('0x8f')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x90'));db[_0x75f2('0x91')]=db['sequelize']['import'](_0x75f2('0x92'));db[_0x75f2('0x93')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x94'));db[_0x75f2('0x95')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x96'));db[_0x75f2('0x97')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x98'));db['IntegrationReport']=db['sequelize'][_0x75f2('0x13')]('../api/integrationReport/integrationReport.model');db[_0x75f2('0x99')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x9a'));db[_0x75f2('0x9b')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0x9c'));db[_0x75f2('0x9d')]=db[_0x75f2('0x3')][_0x75f2('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x75f2('0x9e')]=db[_0x75f2('0x3')]['import'](_0x75f2('0x9f'));db[_0x75f2('0xa0')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0xa1'));db[_0x75f2('0xa2')]=db[_0x75f2('0x3')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x75f2('0xa3')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xa4'));db['SalesforceConfiguration']=db[_0x75f2('0x3')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x75f2('0xa5')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xa6'));db[_0x75f2('0xa7')]=db[_0x75f2('0x3')]['import'](_0x75f2('0xa8'));db[_0x75f2('0xa9')]=db[_0x75f2('0x3')]['import'](_0x75f2('0xaa'));db[_0x75f2('0xab')]=db['sequelize'][_0x75f2('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x75f2('0xac')]=db[_0x75f2('0x3')]['import'](_0x75f2('0xad'));db[_0x75f2('0xae')]=db[_0x75f2('0x3')]['import'](_0x75f2('0xaf'));db[_0x75f2('0xb0')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xb1'));db[_0x75f2('0xb2')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0xb3'));db[_0x75f2('0xb4')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xb5'));db[_0x75f2('0xb6')]=db[_0x75f2('0x3')]['import'](_0x75f2('0xb7'));db[_0x75f2('0xb8')]=db[_0x75f2('0x3')][_0x75f2('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xb9'));db[_0x75f2('0xba')]=db[_0x75f2('0x3')]['import'](_0x75f2('0xbb'));db[_0x75f2('0xbc')]=db[_0x75f2('0x3')][_0x75f2('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x75f2('0x13')](_0x75f2('0xbd'));db['FreshdeskField']=db[_0x75f2('0x3')]['import'](_0x75f2('0xbe'));db[_0x75f2('0xbf')]=db[_0x75f2('0x3')]['import'](_0x75f2('0xc0'));db['VtigerConfiguration']=db[_0x75f2('0x3')]['import'](_0x75f2('0xc1'));db['VtigerField']=db['sequelize'][_0x75f2('0x13')](_0x75f2('0xc2'));db['ServicenowAccount']=db[_0x75f2('0x3')]['import'](_0x75f2('0xc3'));db[_0x75f2('0xc4')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0xc5'));db[_0x75f2('0xc6')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xc7'));db[_0x75f2('0xc8')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xc9'));db['Dynamics365Configuration']=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xca'));db[_0x75f2('0xcb')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xcc'));db[_0x75f2('0xcd')]=db[_0x75f2('0x3')][_0x75f2('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x75f2('0xce')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xcf'));db['FreshsalesField']=db['sequelize']['import']('../api/intFreshsalesField/intFreshsalesField.model');db[_0x75f2('0x97')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0x98'));db['Network']=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xd0'));db['ChatQueueReport']=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xd1'));db[_0x75f2('0xd2')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xd3'));db[_0x75f2('0xd4')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xd5'));db[_0x75f2('0xd6')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xd7'));db['JscriptySessionReport']=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xd8'));db['SmsQueueReport']=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xd9'));db[_0x75f2('0xda')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0xdb'));db[_0x75f2('0xdc')]=db[_0x75f2('0x3')][_0x75f2('0x13')]('../api/squareReportDetail/squareReportDetail.model');db[_0x75f2('0xdd')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xde'));db[_0x75f2('0xdf')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xe0'));db['SquareOdbc']=db[_0x75f2('0x3')]['import'](_0x75f2('0xe1'));db['SquareProject']=db['sequelize'][_0x75f2('0x13')](_0x75f2('0xe2'));db['SquareRecording']=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xe3'));db[_0x75f2('0xe4')]=db[_0x75f2('0x3')]['import'](_0x75f2('0xe5'));db[_0x75f2('0xe6')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0xe7'));db[_0x75f2('0xe8')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0xe9'));db[_0x75f2('0xea')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xeb'));db[_0x75f2('0xec')]=db[_0x75f2('0x3')][_0x75f2('0x13')]('../api/migration/migration.model');db['Attachment']=db[_0x75f2('0x3')]['import'](_0x75f2('0xed'));db['Plugin']=db[_0x75f2('0x3')][_0x75f2('0x13')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xee'));db[_0x75f2('0xef')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xf0'));db[_0x75f2('0xf1')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xf2'));db['OpenchannelTransferReport']=db[_0x75f2('0x3')][_0x75f2('0x13')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xf3'));db[_0x75f2('0xf4')]=db['sequelize'][_0x75f2('0x13')]('../api/cmList/cmList.model');db[_0x75f2('0xf5')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xf6'));db[_0x75f2('0xf7')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0xf8'));db[_0x75f2('0xf9')]=db['sequelize']['import'](_0x75f2('0xfa'));db[_0x75f2('0xfb')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0xfc'));db[_0x75f2('0xfd')]=db[_0x75f2('0x3')]['import']('../api/userNotification/userNotification.model');db[_0x75f2('0xfe')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0xff'));db['WhatsappApplication']=db['sequelize'][_0x75f2('0x13')](_0x75f2('0x100'));db['WhatsappInteraction']=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x101'));db['WhatsappMessage']=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x102'));db[_0x75f2('0x103')]=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x104'));db[_0x75f2('0x105')]=db['sequelize'][_0x75f2('0x13')](_0x75f2('0x106'));db['WhatsappQueue']=db[_0x75f2('0x3')][_0x75f2('0x13')](_0x75f2('0x107'));db['CloudProvider']=db[_0x75f2('0x3')]['import'](_0x75f2('0x108'));db[_0x75f2('0x109')]=db[_0x75f2('0x3')]['import'](_0x75f2('0x10a'));db['User'][_0x75f2('0x10b')](db[_0x75f2('0x20')],{'as':_0x75f2('0x20'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x10d')});db[_0x75f2('0x10e')][_0x75f2('0x10f')](db[_0x75f2('0x110')],{'as':_0x75f2('0x111'),'foreignKey':_0x75f2('0x10d')});db[_0x75f2('0x10e')][_0x75f2('0x10f')](db[_0x75f2('0x2f')],{'as':_0x75f2('0x112'),'foreignKey':'UserId'});db[_0x75f2('0x10e')][_0x75f2('0x10f')](db[_0x75f2('0x18')],{'as':'Extensions','onDelete':_0x75f2('0x10c'),'hooks':!![]});db[_0x75f2('0x10e')][_0x75f2('0x10f')](db[_0x75f2('0x7a')],{'as':'HopperFinals','foreignKey':_0x75f2('0x10d')});db[_0x75f2('0x10e')][_0x75f2('0x10f')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x75f2('0x10d')});db[_0x75f2('0x10e')][_0x75f2('0x10f')](db[_0x75f2('0x7d')],{'as':_0x75f2('0x7d'),'foreignKey':_0x75f2('0x10d')});db['User'][_0x75f2('0x10f')](db[_0x75f2('0x113')],{'as':_0x75f2('0x114'),'foreignKey':'UserId'});db[_0x75f2('0x10e')]['hasMany'](db[_0x75f2('0x6a')],{'as':_0x75f2('0x115'),'foreignKey':_0x75f2('0x10d')});db[_0x75f2('0x10e')][_0x75f2('0x10f')](db[_0x75f2('0x59')],{'as':_0x75f2('0x116'),'foreignKey':'UserId'});db[_0x75f2('0x10e')][_0x75f2('0x10f')](db[_0x75f2('0x4e')],{'as':'FaxInteractions','foreignKey':_0x75f2('0x10d')});db[_0x75f2('0x10e')][_0x75f2('0x10f')](db[_0x75f2('0x42')],{'as':_0x75f2('0x117'),'foreignKey':_0x75f2('0x10d')});db[_0x75f2('0x10e')][_0x75f2('0x10f')](db[_0x75f2('0x118')],{'as':'WhatsappInteractions','foreignKey':_0x75f2('0x10d')});db[_0x75f2('0x10e')][_0x75f2('0x10f')](db['UserNotification'],{'as':_0x75f2('0x119'),'foreignKey':_0x75f2('0x11a')});db[_0x75f2('0x10e')][_0x75f2('0x11b')](db['UserProfile'],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0x75f2('0x10e')]['belongsToMany'](db[_0x75f2('0x71')],{'as':_0x75f2('0x11c'),'through':_0x75f2('0x11d')});db[_0x75f2('0x10e')][_0x75f2('0x11e')](db['CmContact'],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0x75f2('0x10e')][_0x75f2('0x11e')](db['CmList'],{'as':'Lists','through':_0x75f2('0x11f')});db[_0x75f2('0x10e')][_0x75f2('0x11e')](db['Team'],{'through':_0x75f2('0x120')});db[_0x75f2('0x10e')][_0x75f2('0x11e')](db[_0x75f2('0x42')],{'as':'MailInteractions','through':_0x75f2('0x121')});db['User'][_0x75f2('0x11e')](db['ChatInteraction'],{'as':_0x75f2('0x115'),'through':'user_has_chat_interactions'});db['User'][_0x75f2('0x11e')](db[_0x75f2('0x4e')],{'as':_0x75f2('0x122'),'through':'user_has_fax_interactions'});db[_0x75f2('0x10e')][_0x75f2('0x11e')](db['SmsInteraction'],{'as':_0x75f2('0x116'),'through':_0x75f2('0x123')});db[_0x75f2('0x10e')]['belongsToMany'](db[_0x75f2('0x113')],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0x75f2('0x10e')][_0x75f2('0x11e')](db[_0x75f2('0x118')],{'as':_0x75f2('0x124'),'through':_0x75f2('0x125')});db['User'][_0x75f2('0x11e')](db['VoiceQueue'],{'as':_0x75f2('0x126'),'through':_0x75f2('0x31'),'required':![]});db[_0x75f2('0x10e')][_0x75f2('0x11e')](db['MailQueue'],{'as':_0x75f2('0x127'),'through':'UserMailQueue','required':![]});db[_0x75f2('0x10e')][_0x75f2('0x11e')](db[_0x75f2('0x6f')],{'as':_0x75f2('0x128'),'through':_0x75f2('0x129'),'required':![],'hooks':!![]});db[_0x75f2('0x10e')][_0x75f2('0x11e')](db[_0x75f2('0x12a')],{'as':_0x75f2('0x12b'),'through':'UserFaxQueue','required':![]});db['User']['belongsToMany'](db[_0x75f2('0x5d')],{'as':_0x75f2('0x12c'),'through':'UserSmsQueue','required':![]});db['User'][_0x75f2('0x11e')](db[_0x75f2('0x12d')],{'as':_0x75f2('0x12e'),'through':_0x75f2('0x12f'),'required':![]});db[_0x75f2('0x10e')][_0x75f2('0x11e')](db[_0x75f2('0x130')],{'as':_0x75f2('0x131'),'through':_0x75f2('0x39'),'required':![]});db[_0x75f2('0x10e')][_0x75f2('0x11e')](db[_0x75f2('0xf4')],{'through':_0x75f2('0x11f')});db[_0x75f2('0x10e')][_0x75f2('0x11e')](db[_0x75f2('0xf5')],{'as':_0x75f2('0x132'),'through':_0x75f2('0x133'),'required':![]});db[_0x75f2('0x10e')][_0x75f2('0x11e')](db[_0x75f2('0x65')],{'as':'ChatWebsites','through':_0x75f2('0x134')});db[_0x75f2('0x10e')][_0x75f2('0x11e')](db[_0x75f2('0x4c')],{'as':'FaxAccounts','through':_0x75f2('0x135')});db[_0x75f2('0x10e')][_0x75f2('0x11e')](db[_0x75f2('0x3c')],{'as':_0x75f2('0x136'),'through':'user_has_mail_accounts'});db[_0x75f2('0x10e')][_0x75f2('0x11e')](db['OpenchannelAccount'],{'as':_0x75f2('0x137'),'through':_0x75f2('0x138')});db[_0x75f2('0x10e')][_0x75f2('0x11e')](db[_0x75f2('0x55')],{'as':_0x75f2('0x139'),'through':_0x75f2('0x13a')});db['User'][_0x75f2('0x11e')](db[_0x75f2('0xfe')],{'as':'WhatsappAccounts','through':_0x75f2('0x13b')});db[_0x75f2('0x10e')][_0x75f2('0x11e')](db['SquareProject'],{'as':_0x75f2('0x13c'),'through':'user_has_square_projects'});db[_0x75f2('0x14')][_0x75f2('0x10f')](db[_0x75f2('0x18')],{'as':_0x75f2('0x13d'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x13e')});db[_0x75f2('0x16')][_0x75f2('0x10f')](db[_0x75f2('0x18')],{'onDelete':_0x75f2('0x10c')});db[_0x75f2('0x18')]['hasMany'](db[_0x75f2('0x18')],{'as':_0x75f2('0x13f'),'onDelete':'cascade'});db[_0x75f2('0x19')][_0x75f2('0x11e')](db[_0x75f2('0x8d')],{'as':_0x75f2('0x140'),'through':_0x75f2('0x141')});db[_0x75f2('0x1b')][_0x75f2('0x10f')](db['UserVoiceQueueRt'],{'as':_0x75f2('0x142'),'foreignKey':_0x75f2('0x143')});db[_0x75f2('0x1b')][_0x75f2('0x10f')](db[_0x75f2('0x76')],{'as':_0x75f2('0x144'),'foreignKey':_0x75f2('0x143')});db[_0x75f2('0x1b')][_0x75f2('0x10f')](db[_0x75f2('0x7a')],{'as':_0x75f2('0x145'),'foreignKey':_0x75f2('0x143')});db[_0x75f2('0x1b')][_0x75f2('0x10f')](db[_0x75f2('0x7b')],{'as':'HopperHistories','foreignKey':_0x75f2('0x143')});db[_0x75f2('0x1b')][_0x75f2('0x10f')](db[_0x75f2('0x7d')],{'as':_0x75f2('0x7d'),'foreignKey':_0x75f2('0x143')});db[_0x75f2('0x1b')]['hasMany'](db[_0x75f2('0x78')],{'as':_0x75f2('0x146'),'foreignKey':'VoiceQueueId'});db[_0x75f2('0x1b')][_0x75f2('0x10f')](db[_0x75f2('0x147')],{'as':_0x75f2('0x148'),'foreignKey':_0x75f2('0x143')});db[_0x75f2('0x1b')][_0x75f2('0x11b')](db[_0x75f2('0x2c')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x75f2('0x1b')]['belongsTo'](db['Trunk'],{'as':_0x75f2('0x149'),'foreignKey':_0x75f2('0x14a')});db[_0x75f2('0x1b')][_0x75f2('0x11b')](db[_0x75f2('0x85')],{'as':_0x75f2('0x85'),'foreignKey':'IntervalId'});db[_0x75f2('0x1b')][_0x75f2('0x11b')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x75f2('0x14b')});db[_0x75f2('0x1b')][_0x75f2('0x11e')](db[_0x75f2('0xf4')],{'as':'Lists','through':_0x75f2('0x14c')});db[_0x75f2('0x1b')][_0x75f2('0x11e')](db[_0x75f2('0x10e')],{'as':'Agents','through':_0x75f2('0x31')});db['VoiceQueue']['belongsToMany'](db[_0x75f2('0xe6')],{'as':_0x75f2('0x14d'),'through':_0x75f2('0x109')});db['VoiceQueue'][_0x75f2('0x11e')](db[_0x75f2('0xf4')],{'as':_0x75f2('0x14e'),'through':_0x75f2('0x14f')});db[_0x75f2('0x110')][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'as':_0x75f2('0x10e'),'foreignKey':'UserId'});db[_0x75f2('0x1e')][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'as':_0x75f2('0x10e'),'foreignKey':_0x75f2('0x10d')});db['VoiceMail']['hasMany'](db[_0x75f2('0x22')],{'as':_0x75f2('0x150'),'onDelete':_0x75f2('0x10c'),'foreignKey':'mailboxuser','sourceKey':_0x75f2('0x151')});db[_0x75f2('0x22')][_0x75f2('0x11b')](db[_0x75f2('0x20')],{'foreignKey':_0x75f2('0x152'),'targetKey':_0x75f2('0x151')});db['VoiceCallReport'][_0x75f2('0x10f')](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0x75f2('0x153'),'constraints':![]});db['VoiceCallReport']['hasMany'](db['VoiceAgentReport'],{'as':_0x75f2('0x154'),'foreignKey':_0x75f2('0x153'),'constraints':![]});db[_0x75f2('0x24')][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'as':_0x75f2('0x10e'),'foreignKey':_0x75f2('0x10d')});db[_0x75f2('0x24')][_0x75f2('0x11b')](db['CmContact'],{'as':_0x75f2('0x155'),'foreignKey':_0x75f2('0x156')});db['MailServerIn'][_0x75f2('0x11b')](db[_0x75f2('0x3c')],{'as':_0x75f2('0x3c'),'foreignKey':_0x75f2('0x157')});db[_0x75f2('0x158')][_0x75f2('0x11b')](db['MailAccount'],{'as':_0x75f2('0x3c'),'foreignKey':_0x75f2('0x157')});db[_0x75f2('0x3c')][_0x75f2('0x10b')](db['MailServerIn'],{'as':_0x75f2('0x159'),'onDelete':'cascade'});db['MailAccount'][_0x75f2('0x10b')](db[_0x75f2('0x158')],{'as':_0x75f2('0x15a'),'onDelete':'cascade'});db[_0x75f2('0x3c')][_0x75f2('0x10f')](db['Disposition'],{'as':_0x75f2('0x15b'),'foreignKey':_0x75f2('0x157'),'onDelete':_0x75f2('0x10c')});db[_0x75f2('0x3c')]['hasMany'](db[_0x75f2('0x15c')],{'as':'Answers','foreignKey':_0x75f2('0x157')});db['MailAccount'][_0x75f2('0x10f')](db[_0x75f2('0x44')],{'as':_0x75f2('0x150'),'foreignKey':_0x75f2('0x157')});db['MailAccount'][_0x75f2('0x10f')](db[_0x75f2('0x42')],{'as':_0x75f2('0x15d')});db[_0x75f2('0x3c')]['hasMany'](db[_0x75f2('0x45')],{'as':_0x75f2('0x13f')});db[_0x75f2('0x3c')][_0x75f2('0x11b')](db['CmList'],{'as':_0x75f2('0x15e'),'foreignKey':_0x75f2('0x15f')});db[_0x75f2('0x3c')][_0x75f2('0x11b')](db[_0x75f2('0x91')],{'as':_0x75f2('0x91'),'foreignKey':_0x75f2('0x160')});db[_0x75f2('0x3c')][_0x75f2('0x11b')](db[_0x75f2('0x87')],{'as':_0x75f2('0x161'),'foreignKey':_0x75f2('0x14b')});db[_0x75f2('0x3c')][_0x75f2('0x11e')](db[_0x75f2('0x10e')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0x75f2('0x3e')]['belongsToMany'](db[_0x75f2('0x10e')],{'as':_0x75f2('0x162'),'through':_0x75f2('0x34')});db[_0x75f2('0x3e')][_0x75f2('0x11e')](db['Team'],{'through':_0x75f2('0x163'),'as':'Teams'});db[_0x75f2('0x42')][_0x75f2('0x10f')](db[_0x75f2('0x44')],{'as':_0x75f2('0x150'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x164')});db['MailInteraction']['belongsTo'](db['MailAccount'],{'as':'Account','foreignKey':_0x75f2('0x157')});db[_0x75f2('0x42')]['belongsTo'](db[_0x75f2('0x165')],{'as':_0x75f2('0x155'),'foreignKey':_0x75f2('0x156')});db[_0x75f2('0x42')][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'as':_0x75f2('0x166'),'foreignKey':_0x75f2('0x10d')});db[_0x75f2('0x42')][_0x75f2('0x11e')](db[_0x75f2('0x8f')],{'through':_0x75f2('0x167'),'as':_0x75f2('0x168')});db['MailInteraction']['belongsToMany'](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x75f2('0x169')});db[_0x75f2('0x42')][_0x75f2('0x11e')](db['User'],{'as':'Users','through':'user_has_mail_interactions','foreignKey':_0x75f2('0x164')});db[_0x75f2('0x44')][_0x75f2('0x10f')](db[_0x75f2('0x16a')],{'as':_0x75f2('0x16b'),'onDelete':'cascade'});db[_0x75f2('0x44')][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'as':_0x75f2('0x10e')});db['MailMessage']['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0x75f2('0x155')});db[_0x75f2('0x44')][_0x75f2('0x11b')](db[_0x75f2('0x42')],{'as':_0x75f2('0x16c'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x75f2('0x11b')](db[_0x75f2('0x3c')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x75f2('0x44')]['belongsTo'](db[_0x75f2('0x65')],{'as':_0x75f2('0x65'),'foreignKey':_0x75f2('0x16d')});db[_0x75f2('0x44')][_0x75f2('0x11b')](db[_0x75f2('0x6e')],{'as':_0x75f2('0x6e'),'foreignKey':'ChatOfflineMessageId'});db['MailApplication']['belongsTo'](db[_0x75f2('0x10e')],{'onDelete':'restrict'});db[_0x75f2('0x45')][_0x75f2('0x11b')](db[_0x75f2('0x3e')],{'onDelete':_0x75f2('0x16e')});db[_0x75f2('0x45')][_0x75f2('0x11b')](db[_0x75f2('0x3c')],{'onDelete':'restrict'});db['MailApplication'][_0x75f2('0x11b')](db['Interval'],{'onDelete':_0x75f2('0x16e'),'foreignKey':'IntervalId'});db[_0x75f2('0x45')][_0x75f2('0x11b')](db['Tag'],{'onDelete':_0x75f2('0x16e'),'foreignKey':'TagId'});db[_0x75f2('0x47')][_0x75f2('0x11b')](db[_0x75f2('0x3c')],{});db['MailQueueReport'][_0x75f2('0x11b')](db[_0x75f2('0xf4')],{'as':_0x75f2('0x15e'),'foreignKey':_0x75f2('0x15f')});db[_0x75f2('0x47')][_0x75f2('0x11b')](db[_0x75f2('0x165')],{'as':'Contact','foreignKey':_0x75f2('0x156')});db[_0x75f2('0x47')][_0x75f2('0x11b')](db[_0x75f2('0x42')],{});db[_0x75f2('0x47')][_0x75f2('0x11b')](db[_0x75f2('0x44')],{});db[_0x75f2('0x47')][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{});db['MailQueueReport'][_0x75f2('0x11b')](db[_0x75f2('0x3e')],{});db['Dashboard']['hasMany'](db[_0x75f2('0x4a')],{'as':_0x75f2('0x16f'),'onDelete':_0x75f2('0x10c')});db[_0x75f2('0x4c')][_0x75f2('0x10f')](db[_0x75f2('0x83')],{'as':_0x75f2('0x15b'),'foreignKey':_0x75f2('0x170'),'onDelete':_0x75f2('0x10c')});db[_0x75f2('0x4c')][_0x75f2('0x10f')](db[_0x75f2('0x15c')],{'as':_0x75f2('0x171'),'foreignKey':_0x75f2('0x170')});db[_0x75f2('0x4c')][_0x75f2('0x10f')](db[_0x75f2('0x4e')],{'as':_0x75f2('0x15d')});db['FaxAccount'][_0x75f2('0x10f')](db[_0x75f2('0x172')],{'as':_0x75f2('0x13f')});db[_0x75f2('0x4c')]['hasMany'](db['VoiceExtension'],{'as':_0x75f2('0x173'),'onDelete':_0x75f2('0x10c')});db['FaxAccount'][_0x75f2('0x10f')](db['FaxMessage'],{'as':_0x75f2('0x150')});db[_0x75f2('0x4c')][_0x75f2('0x11b')](db[_0x75f2('0x2c')],{'as':_0x75f2('0x2c')});db['FaxAccount'][_0x75f2('0x11b')](db[_0x75f2('0xf4')],{'as':'List','foreignKey':_0x75f2('0x15f')});db['FaxAccount'][_0x75f2('0x11b')](db[_0x75f2('0x87')],{'as':_0x75f2('0x161'),'foreignKey':_0x75f2('0x14b')});db['FaxAccount']['belongsToMany'](db[_0x75f2('0x10e')],{'as':_0x75f2('0x162'),'through':_0x75f2('0x135')});db[_0x75f2('0x172')]['belongsTo'](db['User'],{'onDelete':_0x75f2('0x16e')});db[_0x75f2('0x172')][_0x75f2('0x11b')](db[_0x75f2('0x12a')],{'onDelete':_0x75f2('0x16e')});db[_0x75f2('0x172')]['belongsTo'](db[_0x75f2('0x4c')],{'onDelete':_0x75f2('0x16e')});db[_0x75f2('0x172')][_0x75f2('0x11b')](db[_0x75f2('0x8f')],{'onDelete':_0x75f2('0x16e'),'foreignKey':_0x75f2('0x174')});db[_0x75f2('0x4e')][_0x75f2('0x10f')](db[_0x75f2('0x50')],{'as':_0x75f2('0x150'),'onDelete':_0x75f2('0x10c'),'foreignKey':'FaxInteractionId'});db[_0x75f2('0x4e')][_0x75f2('0x11b')](db[_0x75f2('0x4c')],{'as':_0x75f2('0x175'),'foreignKey':'FaxAccountId'});db['FaxInteraction']['belongsTo'](db['CmContact'],{'as':_0x75f2('0x155'),'foreignKey':_0x75f2('0x156')});db['FaxInteraction'][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'as':_0x75f2('0x166'),'foreignKey':_0x75f2('0x10d')});db[_0x75f2('0x4e')][_0x75f2('0x11e')](db[_0x75f2('0x8f')],{'through':'fax_interaction_has_tags','as':_0x75f2('0x168')});db[_0x75f2('0x4e')]['belongsToMany'](db[_0x75f2('0x8f')],{'through':'fax_interaction_has_tags','as':_0x75f2('0x169')});db[_0x75f2('0x4e')][_0x75f2('0x11e')](db[_0x75f2('0x10e')],{'as':_0x75f2('0x176'),'through':_0x75f2('0x177'),'foreignKey':_0x75f2('0x178')});db[_0x75f2('0x50')]['belongsTo'](db[_0x75f2('0x10e')],{'onDelete':_0x75f2('0x10c'),'as':_0x75f2('0x10e')});db['FaxMessage']['belongsTo'](db[_0x75f2('0x4e')],{'as':_0x75f2('0x16c'),'foreignKey':_0x75f2('0x178')});db[_0x75f2('0x50')][_0x75f2('0x11b')](db['CmContact'],{'onDelete':_0x75f2('0x10c'),'as':'Contact'});db[_0x75f2('0x50')][_0x75f2('0x11b')](db[_0x75f2('0x16a')],{'as':_0x75f2('0x16a'),'foreignKey':'AttachmentId'});db[_0x75f2('0x50')][_0x75f2('0x11b')](db[_0x75f2('0x4c')],{'as':_0x75f2('0x175'),'foreignKey':_0x75f2('0x170')});db[_0x75f2('0x12a')][_0x75f2('0x11e')](db['User'],{'as':_0x75f2('0x162'),'through':_0x75f2('0x36')});db[_0x75f2('0x12a')][_0x75f2('0x11e')](db[_0x75f2('0xe6')],{'through':'team_has_fax_queues','as':_0x75f2('0x14d')});db[_0x75f2('0x53')][_0x75f2('0x11b')](db['FaxAccount'],{});db[_0x75f2('0x53')][_0x75f2('0x11b')](db[_0x75f2('0xf4')],{'as':_0x75f2('0x15e'),'foreignKey':'ListId'});db[_0x75f2('0x53')]['belongsTo'](db['CmContact'],{'as':_0x75f2('0x155'),'foreignKey':'ContactId'});db[_0x75f2('0x53')][_0x75f2('0x11b')](db[_0x75f2('0x4e')],{});db[_0x75f2('0x53')][_0x75f2('0x11b')](db[_0x75f2('0x50')],{});db['FaxQueueReport'][_0x75f2('0x11b')](db['User'],{});db[_0x75f2('0x53')][_0x75f2('0x11b')](db[_0x75f2('0x12a')],{});db['SmsAccount'][_0x75f2('0x10f')](db[_0x75f2('0x83')],{'as':'Dispositions','foreignKey':_0x75f2('0x179'),'onDelete':_0x75f2('0x10c')});db[_0x75f2('0x55')][_0x75f2('0x10f')](db[_0x75f2('0x15c')],{'as':_0x75f2('0x171'),'foreignKey':_0x75f2('0x179')});db[_0x75f2('0x55')][_0x75f2('0x10f')](db['SmsMessage'],{'as':'Messages','foreignKey':_0x75f2('0x179')});db[_0x75f2('0x55')][_0x75f2('0x10f')](db[_0x75f2('0x59')],{'as':'Interactions'});db[_0x75f2('0x55')]['hasMany'](db[_0x75f2('0x57')],{'as':'Applications'});db['SmsAccount']['belongsTo'](db[_0x75f2('0xf4')],{'as':_0x75f2('0x15e'),'foreignKey':_0x75f2('0x15f')});db[_0x75f2('0x55')][_0x75f2('0x11b')](db[_0x75f2('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x75f2('0x14b')});db['SmsAccount'][_0x75f2('0x11e')](db['User'],{'as':_0x75f2('0x162'),'through':'user_has_sms_accounts'});db['SmsApplication'][_0x75f2('0x11b')](db['User'],{'onDelete':_0x75f2('0x16e')});db[_0x75f2('0x57')]['belongsTo'](db[_0x75f2('0x5d')],{'onDelete':_0x75f2('0x16e')});db['SmsApplication'][_0x75f2('0x11b')](db[_0x75f2('0x55')],{'onDelete':_0x75f2('0x16e')});db[_0x75f2('0x57')][_0x75f2('0x11b')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x75f2('0x17a')});db[_0x75f2('0x57')][_0x75f2('0x11b')](db['Tag'],{'onDelete':_0x75f2('0x16e'),'foreignKey':'TagId'});db[_0x75f2('0x59')][_0x75f2('0x10f')](db[_0x75f2('0x5b')],{'as':_0x75f2('0x150'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x17b')});db['SmsInteraction'][_0x75f2('0x11b')](db['SmsAccount'],{'as':_0x75f2('0x175'),'foreignKey':_0x75f2('0x179')});db['SmsInteraction'][_0x75f2('0x11b')](db['CmContact'],{'as':_0x75f2('0x155'),'foreignKey':'ContactId'});db[_0x75f2('0x59')][_0x75f2('0x11b')](db['User'],{'as':_0x75f2('0x166'),'foreignKey':_0x75f2('0x10d')});db[_0x75f2('0x59')][_0x75f2('0x11e')](db[_0x75f2('0x8f')],{'through':_0x75f2('0x17c'),'as':'Tags'});db[_0x75f2('0x59')][_0x75f2('0x11e')](db[_0x75f2('0x8f')],{'through':_0x75f2('0x17c'),'as':_0x75f2('0x169')});db[_0x75f2('0x59')]['belongsToMany'](db[_0x75f2('0x10e')],{'as':_0x75f2('0x176'),'through':'user_has_sms_interactions','foreignKey':_0x75f2('0x17b')});db[_0x75f2('0x5b')][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'as':_0x75f2('0x10e')});db[_0x75f2('0x5b')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0x75f2('0x155')});db['SmsMessage'][_0x75f2('0x11b')](db[_0x75f2('0x59')],{'onDelete':_0x75f2('0x10c'),'as':_0x75f2('0x16c'),'foreignKey':_0x75f2('0x17b')});db[_0x75f2('0x5b')][_0x75f2('0x11b')](db[_0x75f2('0x55')],{'as':_0x75f2('0x175'),'foreignKey':_0x75f2('0x179')});db[_0x75f2('0x5d')][_0x75f2('0x11e')](db[_0x75f2('0x10e')],{'as':_0x75f2('0x162'),'through':_0x75f2('0x37'),'foreignKey':_0x75f2('0x17d')});db[_0x75f2('0x5d')][_0x75f2('0x11e')](db[_0x75f2('0xe6')],{'through':_0x75f2('0x17e'),'as':_0x75f2('0x14d')});db['OpenchannelAccount']['hasMany'](db[_0x75f2('0x83')],{'as':_0x75f2('0x15b'),'foreignKey':_0x75f2('0x17f'),'onDelete':_0x75f2('0x10c')});db[_0x75f2('0x5f')]['hasMany'](db[_0x75f2('0x15c')],{'as':'Answers','foreignKey':_0x75f2('0x17f')});db[_0x75f2('0x5f')][_0x75f2('0x10f')](db[_0x75f2('0x113')],{'as':'Interactions','foreignKey':_0x75f2('0x17f')});db[_0x75f2('0x5f')]['hasMany'](db[_0x75f2('0x62')],{'as':'Messages','foreignKey':_0x75f2('0x17f')});db['OpenchannelAccount'][_0x75f2('0x10f')](db[_0x75f2('0x60')],{'as':'Applications','foreignKey':_0x75f2('0x17f')});db[_0x75f2('0x5f')][_0x75f2('0x11b')](db[_0x75f2('0xf4')],{'as':_0x75f2('0x15e'),'foreignKey':'ListId'});db[_0x75f2('0x5f')]['belongsTo'](db['Pause'],{'as':_0x75f2('0x161'),'foreignKey':_0x75f2('0x14b')});db[_0x75f2('0x5f')]['belongsToMany'](db[_0x75f2('0x10e')],{'as':_0x75f2('0x162'),'through':_0x75f2('0x138')});db[_0x75f2('0x60')]['belongsTo'](db[_0x75f2('0x10e')],{'onDelete':_0x75f2('0x16e')});db[_0x75f2('0x60')][_0x75f2('0x11b')](db['OpenchannelQueue'],{'onDelete':_0x75f2('0x16e'),'foreignKey':_0x75f2('0x180')});db[_0x75f2('0x60')]['belongsTo'](db[_0x75f2('0x5f')],{'onDelete':'restrict','foreignKey':_0x75f2('0x17f')});db[_0x75f2('0x60')]['belongsTo'](db[_0x75f2('0x85')],{'onDelete':_0x75f2('0x16e'),'foreignKey':'IntervalId'});db[_0x75f2('0x60')][_0x75f2('0x11b')](db[_0x75f2('0x8f')],{'onDelete':_0x75f2('0x16e'),'foreignKey':_0x75f2('0x174')});db['OpenchannelInteraction'][_0x75f2('0x10f')](db[_0x75f2('0x62')],{'as':'Messages','onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x181')});db[_0x75f2('0x113')][_0x75f2('0x11b')](db['OpenchannelAccount'],{'as':_0x75f2('0x175'),'foreignKey':'OpenchannelAccountId'});db[_0x75f2('0x113')]['belongsTo'](db[_0x75f2('0x165')],{'as':_0x75f2('0x155'),'foreignKey':'ContactId'});db[_0x75f2('0x113')][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'as':_0x75f2('0x166'),'foreignKey':_0x75f2('0x10d')});db[_0x75f2('0x113')][_0x75f2('0x11e')](db[_0x75f2('0x8f')],{'through':_0x75f2('0x182'),'as':_0x75f2('0x168')});db[_0x75f2('0x113')][_0x75f2('0x11e')](db[_0x75f2('0x8f')],{'through':_0x75f2('0x182'),'as':'ThroughTags'});db['OpenchannelInteraction'][_0x75f2('0x11e')](db[_0x75f2('0x10e')],{'as':_0x75f2('0x176'),'through':_0x75f2('0x183'),'foreignKey':_0x75f2('0x181')});db['OpenchannelMessage'][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'onDelete':_0x75f2('0x10c'),'as':_0x75f2('0x10e')});db[_0x75f2('0x62')][_0x75f2('0x11b')](db[_0x75f2('0x165')],{'onDelete':_0x75f2('0x10c'),'as':_0x75f2('0x155')});db[_0x75f2('0x62')][_0x75f2('0x11b')](db['OpenchannelInteraction'],{'onDelete':_0x75f2('0x10c'),'as':_0x75f2('0x16c'),'foreignKey':'OpenchannelInteractionId'});db[_0x75f2('0x62')][_0x75f2('0x11b')](db[_0x75f2('0x16a')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x75f2('0x62')][_0x75f2('0x11b')](db[_0x75f2('0x5f')],{'as':'Account','foreignKey':_0x75f2('0x17f')});db['OpenchannelQueue'][_0x75f2('0x11e')](db[_0x75f2('0x10e')],{'as':_0x75f2('0x162'),'through':'UserOpenchannelQueue','foreignKey':_0x75f2('0x180')});db['OpenchannelQueue']['belongsToMany'](db[_0x75f2('0xe6')],{'through':_0x75f2('0x184'),'as':_0x75f2('0x14d')});db['ChatWebsite']['hasMany'](db[_0x75f2('0x83')],{'as':'Dispositions','foreignKey':_0x75f2('0x16d'),'onDelete':_0x75f2('0x10c')});db['ChatWebsite'][_0x75f2('0x10f')](db['CannedAnswer'],{'as':_0x75f2('0x171'),'foreignKey':_0x75f2('0x16d')});db[_0x75f2('0x65')]['hasMany'](db['ChatProactiveAction'],{'as':_0x75f2('0x185')});db['ChatWebsite']['hasMany'](db[_0x75f2('0x6a')],{'as':_0x75f2('0x15d')});db[_0x75f2('0x65')][_0x75f2('0x10f')](db[_0x75f2('0x186')],{'as':_0x75f2('0x13f')});db[_0x75f2('0x65')]['hasMany'](db[_0x75f2('0x6c')],{'as':'Messages'});db[_0x75f2('0x65')][_0x75f2('0x11b')](db[_0x75f2('0xf4')],{'as':'List','foreignKey':_0x75f2('0x15f')});db[_0x75f2('0x65')]['belongsTo'](db[_0x75f2('0x85')],{'as':_0x75f2('0x85'),'foreignKey':_0x75f2('0x17a')});db['ChatWebsite']['belongsTo'](db[_0x75f2('0x3c')],{'as':_0x75f2('0x3c'),'foreignKey':_0x75f2('0x157')});db[_0x75f2('0x65')][_0x75f2('0x11b')](db['Pause'],{'as':_0x75f2('0x161'),'foreignKey':_0x75f2('0x14b')});db[_0x75f2('0x65')][_0x75f2('0x11e')](db[_0x75f2('0x10e')],{'as':_0x75f2('0x162'),'through':_0x75f2('0x134')});db[_0x75f2('0x67')][_0x75f2('0x11b')](db[_0x75f2('0x5f')],{});db['OpenchannelQueueReport'][_0x75f2('0x11b')](db['CmList'],{'as':_0x75f2('0x15e'),'foreignKey':_0x75f2('0x15f')});db[_0x75f2('0x67')][_0x75f2('0x11b')](db[_0x75f2('0x165')],{'as':'Contact','foreignKey':'ContactId'});db[_0x75f2('0x67')][_0x75f2('0x11b')](db[_0x75f2('0x113')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x75f2('0x62')],{});db[_0x75f2('0x67')]['belongsTo'](db['User'],{});db[_0x75f2('0x67')][_0x75f2('0x11b')](db[_0x75f2('0x12d')],{});db['ChatApplication']['belongsTo'](db['User'],{'as':_0x75f2('0x187'),'foreignKey':_0x75f2('0x10d'),'onDelete':_0x75f2('0x16e')});db[_0x75f2('0x186')][_0x75f2('0x11b')](db[_0x75f2('0x6f')],{'as':_0x75f2('0x188'),'foreignKey':_0x75f2('0x189'),'onDelete':_0x75f2('0x16e')});db[_0x75f2('0x186')]['belongsTo'](db['ChatWebsite'],{'as':_0x75f2('0x18a'),'foreignKey':_0x75f2('0x16d'),'onDelete':_0x75f2('0x16e')});db['ChatApplication'][_0x75f2('0x11b')](db['Tag'],{'onDelete':_0x75f2('0x16e'),'foreignKey':_0x75f2('0x174')});db[_0x75f2('0x6a')]['hasMany'](db[_0x75f2('0x6c')],{'as':'Messages','onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x18b')});db['ChatInteraction'][_0x75f2('0x11b')](db[_0x75f2('0x65')],{'as':_0x75f2('0x175'),'foreignKey':_0x75f2('0x16d')});db[_0x75f2('0x6a')][_0x75f2('0x11b')](db[_0x75f2('0x165')],{'as':'Contact','foreignKey':_0x75f2('0x156')});db[_0x75f2('0x6a')][_0x75f2('0x11b')](db['User'],{'as':'Owner','foreignKey':_0x75f2('0x10d')});db[_0x75f2('0x6a')]['belongsToMany'](db[_0x75f2('0x8f')],{'through':_0x75f2('0x18c'),'as':_0x75f2('0x168')});db['ChatInteraction']['belongsToMany'](db['Tag'],{'through':_0x75f2('0x18c'),'as':_0x75f2('0x169')});db['ChatInteraction'][_0x75f2('0x11e')](db['User'],{'as':'Users','through':'user_has_chat_interactions','foreignKey':_0x75f2('0x18b')});db[_0x75f2('0x6c')][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'onDelete':'cascade','as':_0x75f2('0x10e')});db[_0x75f2('0x6c')][_0x75f2('0x11b')](db['CmContact'],{'onDelete':_0x75f2('0x10c'),'as':'Contact','foreignKey':_0x75f2('0x156')});db['ChatMessage']['belongsTo'](db[_0x75f2('0x6a')],{'onDelete':_0x75f2('0x10c'),'as':'Interaction','foreignKey':_0x75f2('0x18b')});db[_0x75f2('0x6c')][_0x75f2('0x11b')](db[_0x75f2('0x16a')],{'as':_0x75f2('0x16a'),'foreignKey':_0x75f2('0x18d')});db[_0x75f2('0x6c')][_0x75f2('0x11b')](db[_0x75f2('0x65')],{'as':_0x75f2('0x175'),'foreignKey':_0x75f2('0x16d')});db['ChatOfflineMessage'][_0x75f2('0x10f')](db['Attachment'],{'as':_0x75f2('0x16b'),'foreignKey':_0x75f2('0x18e'),'onDelete':_0x75f2('0x10c'),'hooks':!![]});db[_0x75f2('0x6e')][_0x75f2('0x11b')](db[_0x75f2('0x165')],{'onDelete':_0x75f2('0x10c'),'as':'Contact','foreignKey':'ContactId'});db['ChatOfflineMessage'][_0x75f2('0x11b')](db[_0x75f2('0x65')],{'as':'Account','foreignKey':_0x75f2('0x16d')});db[_0x75f2('0x6f')][_0x75f2('0x11e')](db[_0x75f2('0x10e')],{'as':_0x75f2('0x162'),'through':_0x75f2('0x129'),'hooks':!![]});db[_0x75f2('0x6f')][_0x75f2('0x11e')](db[_0x75f2('0xe6')],{'through':_0x75f2('0x18f'),'as':_0x75f2('0x14d')});db[_0x75f2('0x71')][_0x75f2('0x10f')](db['ChatInternalMessage'],{'as':_0x75f2('0x150'),'foreignKey':_0x75f2('0x190'),'onDelete':_0x75f2('0x10c')});db[_0x75f2('0x71')][_0x75f2('0x11e')](db[_0x75f2('0x10e')],{'as':'Members','through':_0x75f2('0x11d')});db['ChatProactiveAction'][_0x75f2('0x11b')](db[_0x75f2('0x65')],{'as':'Website','foreignKey':'ChatWebsiteId'});db[_0x75f2('0x191')][_0x75f2('0x10f')](db[_0x75f2('0x165')],{'as':_0x75f2('0x192'),'foreignKey':_0x75f2('0x193')});db['CmContact']['hasMany'](db[_0x75f2('0x76')],{'as':_0x75f2('0x144'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0x75f2('0x7a')],{'as':_0x75f2('0x145'),'foreignKey':_0x75f2('0x156')});db[_0x75f2('0x165')][_0x75f2('0x10f')](db[_0x75f2('0x7b')],{'as':_0x75f2('0x194'),'foreignKey':_0x75f2('0x156')});db[_0x75f2('0x165')]['hasMany'](db[_0x75f2('0x7d')],{'as':_0x75f2('0x7d'),'foreignKey':_0x75f2('0x156')});db[_0x75f2('0x165')]['hasMany'](db['JscriptySessionReport'],{'as':_0x75f2('0x148'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0x75f2('0x113')],{'as':_0x75f2('0x114'),'foreignKey':_0x75f2('0x156'),'onDelete':_0x75f2('0x16e')});db[_0x75f2('0x165')]['hasMany'](db['ChatInteraction'],{'as':_0x75f2('0x115'),'foreignKey':'ContactId','onDelete':_0x75f2('0x16e')});db[_0x75f2('0x165')][_0x75f2('0x10f')](db['SmsInteraction'],{'as':_0x75f2('0x116'),'foreignKey':_0x75f2('0x156'),'onDelete':_0x75f2('0x16e')});db[_0x75f2('0x165')][_0x75f2('0x10f')](db['FaxInteraction'],{'as':_0x75f2('0x122'),'foreignKey':'ContactId','onDelete':_0x75f2('0x16e')});db['CmContact'][_0x75f2('0x10f')](db[_0x75f2('0x42')],{'as':_0x75f2('0x117'),'foreignKey':_0x75f2('0x156'),'onDelete':_0x75f2('0x16e')});db[_0x75f2('0x165')]['belongsTo'](db['CmCompany'],{'as':_0x75f2('0x195'),'foreignKey':'CompanyId'});db['CmContact']['belongsTo'](db[_0x75f2('0xf4')],{'as':_0x75f2('0x15e'),'foreignKey':_0x75f2('0x15f'),'onDelete':_0x75f2('0x10c')});db['CmContact'][_0x75f2('0x11e')](db[_0x75f2('0x10e')],{'as':_0x75f2('0x176'),'through':_0x75f2('0x196')});db['CmContact'][_0x75f2('0x11e')](db[_0x75f2('0x8f')],{'as':_0x75f2('0x168'),'through':_0x75f2('0x197')});db[_0x75f2('0x165')][_0x75f2('0x11e')](db[_0x75f2('0x8f')],{'through':'cm_contact_has_tags','as':_0x75f2('0x169')});db[_0x75f2('0x76')][_0x75f2('0x11b')](db[_0x75f2('0x165')],{'as':_0x75f2('0x155'),'foreignKey':_0x75f2('0x156'),'onDelete':_0x75f2('0x10c')});db['CmHopper'][_0x75f2('0x11b')](db['CmList'],{'as':'List','foreignKey':_0x75f2('0x15f'),'onDelete':_0x75f2('0x10c')});db[_0x75f2('0x76')][_0x75f2('0x11b')](db['User'],{'as':_0x75f2('0x187'),'foreignKey':'UserId'});db['CmHopper'][_0x75f2('0x11b')](db[_0x75f2('0x1b')],{'as':_0x75f2('0x188'),'foreignKey':_0x75f2('0x143'),'onDelete':'cascade'});db['CmHopper'][_0x75f2('0x11b')](db[_0x75f2('0xea')],{'as':'Campaign','foreignKey':_0x75f2('0x198'),'onDelete':_0x75f2('0x10c')});db[_0x75f2('0x76')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x75f2('0x199')});db[_0x75f2('0x78')]['belongsTo'](db['CmContact'],{'as':_0x75f2('0x155'),'foreignKey':_0x75f2('0x156'),'onDelete':'cascade'});db[_0x75f2('0x78')][_0x75f2('0x11b')](db[_0x75f2('0xf4')],{'as':_0x75f2('0x15e'),'foreignKey':_0x75f2('0x15f'),'onDelete':_0x75f2('0x10c')});db[_0x75f2('0x78')][_0x75f2('0x11b')](db['VoiceQueue'],{'as':_0x75f2('0x188'),'foreignKey':_0x75f2('0x143'),'onDelete':_0x75f2('0x10c')});db[_0x75f2('0x78')]['belongsTo'](db[_0x75f2('0xea')],{'as':_0x75f2('0xea'),'foreignKey':_0x75f2('0x198'),'onDelete':'cascade'});db[_0x75f2('0x19a')][_0x75f2('0x10f')](db[_0x75f2('0x19b')],{'as':{'plural':_0x75f2('0x19c'),'singular':_0x75f2('0x19d')},'foreignKey':'AutomationAllId','onDelete':_0x75f2('0x10c'),'hooks':!![]});db[_0x75f2('0x19a')][_0x75f2('0x10f')](db[_0x75f2('0x19b')],{'as':{'plural':'Any','singular':_0x75f2('0x19e')},'foreignKey':'AutomationAnyId','onDelete':_0x75f2('0x10c'),'hooks':!![]});db[_0x75f2('0x19a')][_0x75f2('0x10f')](db[_0x75f2('0x80')],{'as':_0x75f2('0x19f'),'foreignKey':_0x75f2('0x1a0'),'onDelete':_0x75f2('0x10c'),'hooks':!![]});db[_0x75f2('0x83')]['hasMany'](db[_0x75f2('0x83')],{'as':_0x75f2('0x15b'),'foreignKey':_0x75f2('0x1a1'),'onDelete':_0x75f2('0x10c')});db[_0x75f2('0x85')][_0x75f2('0x10f')](db[_0x75f2('0x85')],{'as':_0x75f2('0x1a2'),'foreignKey':_0x75f2('0x17a'),'onDelete':_0x75f2('0x10c'),'hooks':!![],'required':![]});db[_0x75f2('0x85')][_0x75f2('0x10f')](db[_0x75f2('0x18')],{'as':_0x75f2('0x1a3'),'foreignKey':_0x75f2('0x17a'),'onDelete':'restrict'});db[_0x75f2('0x85')][_0x75f2('0x10f')](db[_0x75f2('0x45')],{'as':'MailApplications','foreignKey':_0x75f2('0x17a')});db[_0x75f2('0x85')][_0x75f2('0x10f')](db[_0x75f2('0x186')],{'as':_0x75f2('0x1a4'),'foreignKey':_0x75f2('0x17a')});db[_0x75f2('0x85')]['hasMany'](db['FaxApplication'],{'as':_0x75f2('0x1a5'),'foreignKey':_0x75f2('0x17a')});db[_0x75f2('0x85')]['hasMany'](db[_0x75f2('0x57')],{'as':_0x75f2('0x1a6'),'foreignKey':'IntervalId'});db[_0x75f2('0x8b')][_0x75f2('0x11b')](db[_0x75f2('0x3c')],{});db[_0x75f2('0x8b')][_0x75f2('0x11b')](db[_0x75f2('0x9b')],{'foreignKey':_0x75f2('0x1a7')});db[_0x75f2('0x8b')][_0x75f2('0x11b')](db[_0x75f2('0x99')],{'foreignKey':_0x75f2('0x1a8')});db[_0x75f2('0x8d')][_0x75f2('0x11e')](db[_0x75f2('0x19')],{'as':_0x75f2('0x1a9'),'through':_0x75f2('0x141'),'onDelete':'restrict'});db['Tag']['belongsToMany'](db['CmContact'],{'through':_0x75f2('0x197')});db[_0x75f2('0x8f')]['belongsToMany'](db['ChatInteraction'],{'through':_0x75f2('0x18c')});db[_0x75f2('0x8f')][_0x75f2('0x11e')](db[_0x75f2('0x42')],{'through':_0x75f2('0x167')});db[_0x75f2('0x8f')]['belongsToMany'](db[_0x75f2('0x59')],{'through':_0x75f2('0x17c')});db[_0x75f2('0x8f')][_0x75f2('0x11e')](db[_0x75f2('0x4e')],{'through':_0x75f2('0x1aa')});db[_0x75f2('0x8f')][_0x75f2('0x11e')](db[_0x75f2('0x113')],{'through':_0x75f2('0x182')});db[_0x75f2('0x8f')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0x75f2('0x1ab')});db[_0x75f2('0x93')][_0x75f2('0x10f')](db[_0x75f2('0x19b')],{'as':{'plural':'AllConditions','singular':_0x75f2('0x1ac')},'foreignKey':_0x75f2('0x1ad'),'onDelete':'cascade','hooks':!![]});db[_0x75f2('0x93')]['hasMany'](db[_0x75f2('0x19b')],{'as':{'plural':_0x75f2('0x1ae'),'singular':_0x75f2('0x1af')},'foreignKey':_0x75f2('0x1b0'),'onDelete':'cascade','hooks':!![]});db[_0x75f2('0x93')][_0x75f2('0x10f')](db[_0x75f2('0x80')],{'as':_0x75f2('0x19f'),'foreignKey':_0x75f2('0x1b1'),'onDelete':_0x75f2('0x10c'),'hooks':!![]});db[_0x75f2('0x99')][_0x75f2('0x10f')](db[_0x75f2('0xa0')],{'as':_0x75f2('0x1b2'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1a8'),'hooks':!![]});db['AnalyticDefaultReport'][_0x75f2('0x10f')](db[_0x75f2('0xa0')],{'as':_0x75f2('0x1b2'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1a7')});db['AnalyticMetric'][_0x75f2('0x10f')](db[_0x75f2('0xa0')],{'as':'Fields','onDelete':'cascade','foreignKey':'MetricId'});db[_0x75f2('0xa0')][_0x75f2('0x11b')](db[_0x75f2('0x9e')],{'foreignKey':_0x75f2('0x1b3')});db[_0x75f2('0xa3')][_0x75f2('0x10f')](db['SalesforceConfiguration'],{'as':_0x75f2('0x1b4'),'onDelete':'cascade','foreignKey':_0x75f2('0x1b5')});db[_0x75f2('0x1b6')][_0x75f2('0x10f')](db['SalesforceField'],{'as':_0x75f2('0x1b7'),'onDelete':_0x75f2('0x10c'),'foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0x75f2('0x10f')](db['SalesforceField'],{'as':_0x75f2('0x1b8'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1b9')});db[_0x75f2('0x1b6')][_0x75f2('0x10f')](db[_0x75f2('0xa5')],{'as':_0x75f2('0x1b2'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1ba')});db[_0x75f2('0x1b6')]['belongsTo'](db['SalesforceAccount'],{'as':_0x75f2('0x175'),'foreignKey':_0x75f2('0x1b5')});db[_0x75f2('0xa5')][_0x75f2('0x10f')](db['SalesforceField'],{'as':'Subject','foreignKey':_0x75f2('0x1bb')});db[_0x75f2('0xa5')][_0x75f2('0x10f')](db[_0x75f2('0xa5')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x75f2('0xa5')][_0x75f2('0x10f')](db[_0x75f2('0xa5')],{'as':_0x75f2('0x1bc'),'foreignKey':_0x75f2('0x1ba')});db['SalesforceField'][_0x75f2('0x11b')](db[_0x75f2('0x95')],{'as':_0x75f2('0x95'),'foreignKey':'VariableId'});db[_0x75f2('0xa7')][_0x75f2('0x10f')](db[_0x75f2('0xa9')],{'as':'Configurations','onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1b5')});db[_0x75f2('0xa9')][_0x75f2('0x10f')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0x75f2('0x10c'),'foreignKey':'SubjectId'});db[_0x75f2('0xa9')][_0x75f2('0x10f')](db[_0x75f2('0xab')],{'as':_0x75f2('0x1b8'),'onDelete':_0x75f2('0x10c'),'foreignKey':'DescriptionId'});db[_0x75f2('0xa9')][_0x75f2('0x10f')](db[_0x75f2('0xab')],{'as':_0x75f2('0x1b2'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1ba')});db[_0x75f2('0xa9')][_0x75f2('0x11b')](db['SugarcrmAccount'],{'as':_0x75f2('0x175'),'foreignKey':_0x75f2('0x1b5')});db[_0x75f2('0xab')][_0x75f2('0x10f')](db['SugarcrmField'],{'as':_0x75f2('0x1bd'),'foreignKey':_0x75f2('0x1bb')});db[_0x75f2('0xab')]['hasMany'](db[_0x75f2('0xab')],{'as':_0x75f2('0x1be'),'foreignKey':_0x75f2('0x1b9')});db[_0x75f2('0xab')][_0x75f2('0x10f')](db[_0x75f2('0xab')],{'as':_0x75f2('0x1bc'),'foreignKey':_0x75f2('0x1ba')});db[_0x75f2('0xab')][_0x75f2('0x11b')](db[_0x75f2('0x95')],{'as':_0x75f2('0x95'),'foreignKey':_0x75f2('0x1bf')});db['DeskAccount']['hasMany'](db[_0x75f2('0xae')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x75f2('0x1b5')});db['DeskConfiguration'][_0x75f2('0x10f')](db[_0x75f2('0xb0')],{'as':_0x75f2('0x1b7'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1bb')});db[_0x75f2('0xae')][_0x75f2('0x10f')](db[_0x75f2('0xb0')],{'as':_0x75f2('0x1b8'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1b9')});db[_0x75f2('0xae')][_0x75f2('0x10f')](db[_0x75f2('0xb0')],{'as':_0x75f2('0x1b2'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1ba')});db[_0x75f2('0xae')]['belongsTo'](db['DeskAccount'],{'as':_0x75f2('0x175'),'foreignKey':_0x75f2('0x1b5')});db[_0x75f2('0xae')][_0x75f2('0x11e')](db[_0x75f2('0x8f')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x75f2('0x10f')](db[_0x75f2('0xb0')],{'as':_0x75f2('0x1bd'),'foreignKey':'SubjectId'});db['DeskField']['hasMany'](db[_0x75f2('0xb0')],{'as':_0x75f2('0x1be'),'foreignKey':_0x75f2('0x1b9')});db[_0x75f2('0xb0')][_0x75f2('0x10f')](db['DeskField'],{'as':_0x75f2('0x1bc'),'foreignKey':_0x75f2('0x1ba')});db['DeskField']['belongsTo'](db[_0x75f2('0x95')],{'as':'Variable','foreignKey':_0x75f2('0x1bf')});db['ZohoAccount'][_0x75f2('0x10f')](db[_0x75f2('0xb4')],{'as':'Configurations','onDelete':_0x75f2('0x10c'),'foreignKey':'AccountId'});db[_0x75f2('0xb4')][_0x75f2('0x10f')](db[_0x75f2('0xb6')],{'as':'Subjects','onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1bb')});db[_0x75f2('0xb4')][_0x75f2('0x10f')](db['ZohoField'],{'as':_0x75f2('0x1b8'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1b9')});db['ZohoConfiguration'][_0x75f2('0x10f')](db[_0x75f2('0xb6')],{'as':_0x75f2('0x1b2'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1ba')});db[_0x75f2('0xb4')][_0x75f2('0x11b')](db[_0x75f2('0xb2')],{'as':'Account','foreignKey':_0x75f2('0x1b5')});db[_0x75f2('0xb6')][_0x75f2('0x10f')](db[_0x75f2('0xb6')],{'as':'Subject','foreignKey':_0x75f2('0x1bb')});db[_0x75f2('0xb6')][_0x75f2('0x10f')](db['ZohoField'],{'as':_0x75f2('0x1be'),'foreignKey':_0x75f2('0x1b9')});db[_0x75f2('0xb6')][_0x75f2('0x10f')](db[_0x75f2('0xb6')],{'as':'Field','foreignKey':_0x75f2('0x1ba')});db[_0x75f2('0xb6')]['belongsTo'](db[_0x75f2('0x95')],{'as':_0x75f2('0x95'),'foreignKey':_0x75f2('0x1bf')});db['ZendeskAccount'][_0x75f2('0x10f')](db['ZendeskConfiguration'],{'as':_0x75f2('0x1b4'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1b5')});db[_0x75f2('0x1c0')]['hasMany'](db[_0x75f2('0xba')],{'as':_0x75f2('0x1b7'),'foreignKey':_0x75f2('0x1bb')});db[_0x75f2('0x1c0')][_0x75f2('0x10f')](db[_0x75f2('0xba')],{'as':_0x75f2('0x1b8'),'foreignKey':_0x75f2('0x1b9')});db[_0x75f2('0x1c0')][_0x75f2('0x10f')](db['ZendeskField'],{'as':_0x75f2('0x1b2'),'foreignKey':'FieldId'});db[_0x75f2('0x1c0')][_0x75f2('0x11b')](db[_0x75f2('0xb8')],{'as':_0x75f2('0x175'),'foreignKey':_0x75f2('0x1b5')});db['ZendeskConfiguration'][_0x75f2('0x11e')](db['Tag'],{'through':_0x75f2('0x1c1')});db['ZendeskField'][_0x75f2('0x10f')](db[_0x75f2('0xba')],{'as':_0x75f2('0x1bd'),'foreignKey':'SubjectId'});db[_0x75f2('0xba')][_0x75f2('0x10f')](db[_0x75f2('0xba')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x75f2('0xba')]['hasMany'](db['ZendeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0x75f2('0xba')][_0x75f2('0x11b')](db[_0x75f2('0x95')],{'as':_0x75f2('0x95'),'foreignKey':_0x75f2('0x1bf')});db[_0x75f2('0xbc')][_0x75f2('0x10f')](db[_0x75f2('0x1c2')],{'as':_0x75f2('0x1b4'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x75f2('0x1c2')][_0x75f2('0x10f')](db[_0x75f2('0x1c3')],{'as':_0x75f2('0x1b7'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1bb')});db[_0x75f2('0x1c2')]['hasMany'](db['FreshdeskField'],{'as':_0x75f2('0x1b8'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1b9')});db['FreshdeskConfiguration'][_0x75f2('0x10f')](db['FreshdeskField'],{'as':'Fields','onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1ba')});db['FreshdeskConfiguration'][_0x75f2('0x11b')](db['FreshdeskAccount'],{'as':_0x75f2('0x175'),'foreignKey':_0x75f2('0x1b5')});db['FreshdeskConfiguration'][_0x75f2('0x11e')](db[_0x75f2('0x8f')],{'through':_0x75f2('0x1c4')});db['FreshdeskField'][_0x75f2('0x10f')](db[_0x75f2('0x1c3')],{'as':'Subject','foreignKey':_0x75f2('0x1bb')});db['FreshdeskField'][_0x75f2('0x10f')](db[_0x75f2('0x1c3')],{'as':_0x75f2('0x1be'),'foreignKey':_0x75f2('0x1b9')});db[_0x75f2('0x1c3')][_0x75f2('0x10f')](db[_0x75f2('0x1c3')],{'as':_0x75f2('0x1bc'),'foreignKey':_0x75f2('0x1ba')});db[_0x75f2('0x1c3')][_0x75f2('0x11b')](db['Variable'],{'as':_0x75f2('0x95'),'foreignKey':_0x75f2('0x1bf')});db[_0x75f2('0xbf')][_0x75f2('0x10f')](db[_0x75f2('0x1c5')],{'as':_0x75f2('0x1b4'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1b5')});db[_0x75f2('0x1c5')][_0x75f2('0x10f')](db[_0x75f2('0x1c6')],{'as':_0x75f2('0x1b7'),'foreignKey':'SubjectId'});db[_0x75f2('0x1c5')]['hasMany'](db[_0x75f2('0x1c6')],{'as':_0x75f2('0x1b8'),'foreignKey':_0x75f2('0x1b9')});db['VtigerConfiguration'][_0x75f2('0x10f')](db[_0x75f2('0x1c6')],{'as':_0x75f2('0x1b2'),'foreignKey':'FieldId'});db[_0x75f2('0x1c5')][_0x75f2('0x11b')](db[_0x75f2('0xbf')],{'as':_0x75f2('0x175'),'foreignKey':_0x75f2('0x1b5')});db[_0x75f2('0x1c6')][_0x75f2('0x10f')](db[_0x75f2('0x1c6')],{'as':'Subject','foreignKey':_0x75f2('0x1bb')});db['VtigerField'][_0x75f2('0x10f')](db['VtigerField'],{'as':_0x75f2('0x1be'),'foreignKey':_0x75f2('0x1b9')});db['VtigerField'][_0x75f2('0x10f')](db[_0x75f2('0x1c6')],{'as':_0x75f2('0x1bc'),'foreignKey':_0x75f2('0x1ba')});db[_0x75f2('0x1c6')][_0x75f2('0x11b')](db[_0x75f2('0x95')],{'as':_0x75f2('0x95'),'foreignKey':_0x75f2('0x1bf')});db[_0x75f2('0x1c7')][_0x75f2('0x10f')](db[_0x75f2('0xc4')],{'as':_0x75f2('0x1b4'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1b5')});db['ServicenowConfiguration'][_0x75f2('0x10f')](db[_0x75f2('0xc6')],{'as':_0x75f2('0x1b7'),'foreignKey':_0x75f2('0x1bb')});db[_0x75f2('0xc4')][_0x75f2('0x10f')](db[_0x75f2('0xc6')],{'as':_0x75f2('0x1b8'),'foreignKey':_0x75f2('0x1b9')});db['ServicenowConfiguration']['hasMany'](db[_0x75f2('0xc6')],{'as':_0x75f2('0x1b2'),'foreignKey':_0x75f2('0x1ba')});db['ServicenowConfiguration']['belongsTo'](db[_0x75f2('0x1c7')],{'as':_0x75f2('0x175'),'foreignKey':'AccountId'});db['ServicenowField'][_0x75f2('0x10f')](db[_0x75f2('0xc6')],{'as':_0x75f2('0x1bd'),'foreignKey':_0x75f2('0x1bb')});db['ServicenowField'][_0x75f2('0x10f')](db[_0x75f2('0xc6')],{'as':_0x75f2('0x1be'),'foreignKey':_0x75f2('0x1b9')});db[_0x75f2('0xc6')]['hasMany'](db[_0x75f2('0xc6')],{'as':_0x75f2('0x1bc'),'foreignKey':'FieldId'});db[_0x75f2('0xc6')][_0x75f2('0x11b')](db[_0x75f2('0x95')],{'as':_0x75f2('0x95'),'foreignKey':'VariableId'});db['Dynamics365Account'][_0x75f2('0x10f')](db[_0x75f2('0x1c8')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x75f2('0x1b5')});db[_0x75f2('0x1c8')][_0x75f2('0x10f')](db[_0x75f2('0xcb')],{'as':_0x75f2('0x1b7'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1bb')});db[_0x75f2('0x1c8')][_0x75f2('0x10f')](db[_0x75f2('0xcb')],{'as':_0x75f2('0x1b8'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1b9')});db['Dynamics365Configuration']['hasMany'](db[_0x75f2('0xcb')],{'as':_0x75f2('0x1b2'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1ba')});db[_0x75f2('0x1c8')][_0x75f2('0x11b')](db[_0x75f2('0xc8')],{'as':_0x75f2('0x175'),'foreignKey':'AccountId'});db['Dynamics365Field'][_0x75f2('0x10f')](db[_0x75f2('0xcb')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x75f2('0xcb')][_0x75f2('0x10f')](db[_0x75f2('0xcb')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x75f2('0xcb')][_0x75f2('0x10f')](db[_0x75f2('0xcb')],{'as':'Field','foreignKey':'FieldId'});db[_0x75f2('0xcb')][_0x75f2('0x11b')](db[_0x75f2('0x95')],{'as':'Variable','foreignKey':_0x75f2('0x1bf')});db[_0x75f2('0xcd')][_0x75f2('0x10f')](db[_0x75f2('0xce')],{'as':'Configurations','onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1b5')});db[_0x75f2('0xce')]['hasMany'](db[_0x75f2('0x1c9')],{'as':_0x75f2('0x1b7'),'foreignKey':_0x75f2('0x1bb')});db['FreshsalesConfiguration'][_0x75f2('0x10f')](db[_0x75f2('0x1c9')],{'as':_0x75f2('0x1b8'),'foreignKey':'DescriptionId'});db[_0x75f2('0xce')][_0x75f2('0x10f')](db[_0x75f2('0x1c9')],{'as':_0x75f2('0x1b2'),'foreignKey':_0x75f2('0x1ba')});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':_0x75f2('0x175'),'foreignKey':_0x75f2('0x1b5')});db[_0x75f2('0x1c9')]['hasMany'](db[_0x75f2('0x1c9')],{'as':_0x75f2('0x1bd'),'foreignKey':_0x75f2('0x1bb')});db[_0x75f2('0x1c9')][_0x75f2('0x10f')](db[_0x75f2('0x1c9')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x75f2('0x1c9')][_0x75f2('0x10f')](db[_0x75f2('0x1c9')],{'as':_0x75f2('0x1bc'),'foreignKey':_0x75f2('0x1ba')});db[_0x75f2('0x1c9')][_0x75f2('0x11b')](db[_0x75f2('0x95')],{'as':'Variable','foreignKey':_0x75f2('0x1bf')});db[_0x75f2('0x1ca')][_0x75f2('0x11b')](db['ChatWebsite'],{});db[_0x75f2('0x1ca')][_0x75f2('0x11b')](db[_0x75f2('0xf4')],{'as':_0x75f2('0x15e'),'foreignKey':'ListId'});db['ChatQueueReport'][_0x75f2('0x11b')](db[_0x75f2('0x165')],{'as':_0x75f2('0x155'),'foreignKey':_0x75f2('0x156')});db[_0x75f2('0x1ca')][_0x75f2('0x11b')](db[_0x75f2('0x6a')],{});db[_0x75f2('0x1ca')][_0x75f2('0x11b')](db[_0x75f2('0x6c')],{});db[_0x75f2('0x1ca')]['belongsTo'](db[_0x75f2('0x10e')],{});db[_0x75f2('0x1ca')]['belongsTo'](db[_0x75f2('0x6f')],{});db[_0x75f2('0xd2')][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0x75f2('0xd2')][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1cb')});db[_0x75f2('0x147')][_0x75f2('0x10f')](db['JscriptyQuestionReport'],{'foreignKey':_0x75f2('0x1cc'),'onDelete':_0x75f2('0x10c')});db[_0x75f2('0x147')]['hasMany'](db[_0x75f2('0xd4')],{'foreignKey':_0x75f2('0x1cc'),'onDelete':'cascade'});db[_0x75f2('0x1cd')]['belongsTo'](db[_0x75f2('0x55')],{});db[_0x75f2('0x1cd')]['belongsTo'](db[_0x75f2('0xf4')],{'as':'List','foreignKey':'ListId'});db[_0x75f2('0x1cd')][_0x75f2('0x11b')](db['CmContact'],{'as':_0x75f2('0x155'),'foreignKey':'ContactId'});db[_0x75f2('0x1cd')]['belongsTo'](db[_0x75f2('0x59')],{});db[_0x75f2('0x1cd')]['belongsTo'](db[_0x75f2('0x5b')],{});db[_0x75f2('0x1cd')][_0x75f2('0x11b')](db['User'],{});db['SmsQueueReport'][_0x75f2('0x11b')](db[_0x75f2('0x5d')],{});db[_0x75f2('0xdd')][_0x75f2('0x10f')](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x75f2('0x10f')](db[_0x75f2('0xd6')],{'foreignKey':_0x75f2('0x1ce')});db[_0x75f2('0xdd')][_0x75f2('0x10f')](db[_0x75f2('0xd4')],{'foreignKey':'ProjectId'});db['SquareProject'][_0x75f2('0x11e')](db['User'],{'as':_0x75f2('0x176'),'through':_0x75f2('0x1cf')});db[_0x75f2('0xe6')][_0x75f2('0x11e')](db['User'],{'as':_0x75f2('0x162'),'through':_0x75f2('0x120')});db[_0x75f2('0xe6')][_0x75f2('0x11e')](db[_0x75f2('0x1b')],{'through':_0x75f2('0x109'),'as':_0x75f2('0x126')});db[_0x75f2('0xe6')][_0x75f2('0x11e')](db[_0x75f2('0x3e')],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0x75f2('0xe6')]['belongsToMany'](db[_0x75f2('0x6f')],{'through':_0x75f2('0x18f'),'as':_0x75f2('0x128')});db[_0x75f2('0xe6')][_0x75f2('0x11e')](db[_0x75f2('0x12a')],{'through':_0x75f2('0x1d0'),'as':_0x75f2('0x12b')});db[_0x75f2('0xe6')][_0x75f2('0x11e')](db['SmsQueue'],{'through':_0x75f2('0x17e'),'as':_0x75f2('0x12c')});db['Team'][_0x75f2('0x11e')](db[_0x75f2('0x12d')],{'through':_0x75f2('0x184'),'as':'OpenchannelQueues'});db['Team'][_0x75f2('0x11e')](db['WhatsappQueue'],{'through':_0x75f2('0x1d1'),'as':'WhatsappQueues'});db[_0x75f2('0xea')][_0x75f2('0x10f')](db['CmHopper'],{'as':_0x75f2('0x144'),'foreignKey':_0x75f2('0x198')});db[_0x75f2('0xea')][_0x75f2('0x10f')](db['CmHopperFinal'],{'as':_0x75f2('0x145'),'foreignKey':'CampaignId'});db[_0x75f2('0xea')][_0x75f2('0x10f')](db[_0x75f2('0x7b')],{'as':_0x75f2('0x194'),'foreignKey':_0x75f2('0x198')});db['Campaign'][_0x75f2('0x10f')](db[_0x75f2('0x78')],{'as':_0x75f2('0x146'),'foreignKey':_0x75f2('0x198')});db[_0x75f2('0xea')][_0x75f2('0x11b')](db[_0x75f2('0x2c')],{'as':'Trunk','foreignKey':_0x75f2('0x1d2')});db[_0x75f2('0xea')][_0x75f2('0x11b')](db[_0x75f2('0x2c')],{'as':_0x75f2('0x149'),'foreignKey':_0x75f2('0x14a')});db[_0x75f2('0xea')][_0x75f2('0x11b')](db[_0x75f2('0x85')],{'as':_0x75f2('0x85'),'foreignKey':_0x75f2('0x17a')});db[_0x75f2('0xea')][_0x75f2('0x11b')](db['SquareProject'],{'as':'SquareProject','foreignKey':_0x75f2('0x1d3')});db[_0x75f2('0xea')]['belongsToMany'](db[_0x75f2('0xf4')],{'as':_0x75f2('0x1d4'),'through':_0x75f2('0x1d5')});db['Campaign']['belongsToMany'](db[_0x75f2('0xf4')],{'as':_0x75f2('0x14e'),'through':_0x75f2('0x1d6')});db[_0x75f2('0x16a')][_0x75f2('0x11b')](db['ChatOfflineMessage'],{'as':_0x75f2('0x6e'),'foreignKey':_0x75f2('0x18e')});db[_0x75f2('0x1d7')][_0x75f2('0x11b')](db[_0x75f2('0x44')],{});db[_0x75f2('0x1d7')][_0x75f2('0x11b')](db[_0x75f2('0x42')],{});db['MailTransferReport'][_0x75f2('0x11b')](db['MailAccount'],{'foreignKey':_0x75f2('0x1d8'),'as':_0x75f2('0x1d9')});db['MailTransferReport'][_0x75f2('0x11b')](db['User'],{'foreignKey':_0x75f2('0x1da'),'as':'FromAgent'});db['MailTransferReport'][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'foreignKey':_0x75f2('0x1db'),'as':_0x75f2('0x1dc')});db['MailTransferReport']['belongsTo'](db[_0x75f2('0x3e')],{'foreignKey':_0x75f2('0x1dd'),'as':'ToQueue'});db[_0x75f2('0x1d7')][_0x75f2('0x11b')](db[_0x75f2('0x3c')],{'foreignKey':_0x75f2('0x1de'),'as':_0x75f2('0x1df')});db[_0x75f2('0xef')][_0x75f2('0x11b')](db['ChatMessage'],{});db['ChatTransferReport'][_0x75f2('0x11b')](db['ChatInteraction'],{});db[_0x75f2('0xef')][_0x75f2('0x11b')](db['ChatWebsite'],{'foreignKey':_0x75f2('0x1e0'),'as':'FromAccount'});db[_0x75f2('0xef')][_0x75f2('0x11b')](db['User'],{'foreignKey':_0x75f2('0x1da'),'as':_0x75f2('0x1e1')});db['ChatTransferReport'][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x75f2('0xef')][_0x75f2('0x11b')](db[_0x75f2('0x6f')],{'foreignKey':_0x75f2('0x1e2'),'as':_0x75f2('0x1e3')});db['ChatTransferReport']['belongsTo'](db[_0x75f2('0x65')],{'foreignKey':_0x75f2('0x1e4'),'as':_0x75f2('0x1df')});db[_0x75f2('0xf1')][_0x75f2('0x11b')](db[_0x75f2('0x50')],{});db[_0x75f2('0xf1')][_0x75f2('0x11b')](db[_0x75f2('0x4e')],{});db['FaxTransferReport'][_0x75f2('0x11b')](db[_0x75f2('0x4c')],{'foreignKey':_0x75f2('0x1e5'),'as':_0x75f2('0x1d9')});db['FaxTransferReport'][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'foreignKey':_0x75f2('0x1da'),'as':_0x75f2('0x1e1')});db[_0x75f2('0xf1')]['belongsTo'](db[_0x75f2('0x10e')],{'foreignKey':'ToUserId','as':_0x75f2('0x1dc')});db[_0x75f2('0xf1')]['belongsTo'](db[_0x75f2('0x12a')],{'foreignKey':'ToFaxQueueId','as':_0x75f2('0x1e3')});db[_0x75f2('0xf1')][_0x75f2('0x11b')](db[_0x75f2('0x4c')],{'foreignKey':_0x75f2('0x1e6'),'as':_0x75f2('0x1df')});db['OpenchannelTransferReport'][_0x75f2('0x11b')](db['OpenchannelMessage'],{});db[_0x75f2('0x1e7')][_0x75f2('0x11b')](db[_0x75f2('0x113')],{});db['OpenchannelTransferReport'][_0x75f2('0x11b')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x75f2('0x1d9')});db[_0x75f2('0x1e7')]['belongsTo'](db[_0x75f2('0x10e')],{'foreignKey':_0x75f2('0x1da'),'as':_0x75f2('0x1e1')});db['OpenchannelTransferReport'][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'foreignKey':_0x75f2('0x1db'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0x75f2('0x11b')](db['OpenchannelQueue'],{'foreignKey':_0x75f2('0x1e8'),'as':'ToQueue'});db[_0x75f2('0x1e7')][_0x75f2('0x11b')](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':_0x75f2('0x1df')});db[_0x75f2('0x1e9')][_0x75f2('0x11b')](db[_0x75f2('0x5b')],{});db[_0x75f2('0x1e9')]['belongsTo'](db[_0x75f2('0x59')],{});db[_0x75f2('0x1e9')]['belongsTo'](db[_0x75f2('0x55')],{'foreignKey':_0x75f2('0x1ea'),'as':_0x75f2('0x1d9')});db[_0x75f2('0x1e9')][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'foreignKey':_0x75f2('0x1da'),'as':'FromAgent'});db[_0x75f2('0x1e9')][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'foreignKey':_0x75f2('0x1db'),'as':'ToAgent'});db[_0x75f2('0x1e9')][_0x75f2('0x11b')](db[_0x75f2('0x5d')],{'foreignKey':_0x75f2('0x1eb'),'as':_0x75f2('0x1e3')});db[_0x75f2('0x1e9')][_0x75f2('0x11b')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0x75f2('0x1df')});db[_0x75f2('0xf4')][_0x75f2('0x10f')](db['Disposition'],{'as':_0x75f2('0x15b'),'foreignKey':'ListId','onDelete':_0x75f2('0x10c')});db[_0x75f2('0xf4')][_0x75f2('0x10f')](db['CmCustomField'],{'as':_0x75f2('0x1ec'),'foreignKey':_0x75f2('0x15f')});db[_0x75f2('0xf4')][_0x75f2('0x10f')](db[_0x75f2('0x165')],{'as':_0x75f2('0x192'),'onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x15f')});db[_0x75f2('0xf4')][_0x75f2('0x10f')](db[_0x75f2('0x7a')],{'as':'HopperFinals','foreignKey':'ListId'});db[_0x75f2('0xf4')]['hasMany'](db[_0x75f2('0x7b')],{'as':_0x75f2('0x1ed'),'foreignKey':'ListId'});db[_0x75f2('0xf4')][_0x75f2('0x10f')](db['ReportAgentPreview'],{'as':_0x75f2('0x7d'),'foreignKey':'ListId'});db[_0x75f2('0xf4')][_0x75f2('0x11e')](db[_0x75f2('0x1b')],{'as':_0x75f2('0x1ee'),'through':_0x75f2('0x14c')});db['CmList'][_0x75f2('0x11e')](db['User'],{'as':_0x75f2('0x162'),'through':_0x75f2('0x11f')});db[_0x75f2('0xf5')][_0x75f2('0x10f')](db[_0x75f2('0x18')],{'as':_0x75f2('0x1a3'),'onDelete':_0x75f2('0x10c')});db[_0x75f2('0xf5')]['belongsToMany'](db[_0x75f2('0x10e')],{'as':_0x75f2('0x162'),'through':_0x75f2('0x133')});db[_0x75f2('0xf7')]['hasMany'](db[_0x75f2('0x10e')],{'as':_0x75f2('0x176'),'foreignKey':_0x75f2('0x1ef')});db[_0x75f2('0xf7')][_0x75f2('0x10f')](db[_0x75f2('0xf9')],{'as':_0x75f2('0x1f0'),'foreignKey':_0x75f2('0x1ef'),'onDelete':'cascade'});db[_0x75f2('0xf9')][_0x75f2('0x10f')](db[_0x75f2('0xfb')],{'as':_0x75f2('0x1f1'),'foreignKey':_0x75f2('0x1f2'),'onDelete':_0x75f2('0x10c')});db['WhatsappAccount']['hasMany'](db[_0x75f2('0x83')],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0x75f2('0xfe')][_0x75f2('0x10f')](db[_0x75f2('0x15c')],{'as':'Answers','foreignKey':_0x75f2('0x1f3')});db[_0x75f2('0xfe')][_0x75f2('0x10f')](db[_0x75f2('0x1f4')],{'as':_0x75f2('0x150'),'foreignKey':_0x75f2('0x1f3')});db[_0x75f2('0xfe')][_0x75f2('0x10f')](db[_0x75f2('0x118')],{'as':_0x75f2('0x15d')});db[_0x75f2('0xfe')][_0x75f2('0x10f')](db['WhatsappApplication'],{'as':'Applications'});db[_0x75f2('0xfe')][_0x75f2('0x11b')](db[_0x75f2('0xf4')],{'as':_0x75f2('0x15e'),'foreignKey':_0x75f2('0x15f')});db['WhatsappAccount'][_0x75f2('0x11b')](db[_0x75f2('0x87')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x75f2('0xfe')]['belongsToMany'](db['User'],{'as':_0x75f2('0x162'),'through':_0x75f2('0x13b')});db[_0x75f2('0x1f5')][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'onDelete':'restrict'});db[_0x75f2('0x1f5')][_0x75f2('0x11b')](db['WhatsappQueue'],{'onDelete':_0x75f2('0x16e')});db[_0x75f2('0x1f5')][_0x75f2('0x11b')](db['WhatsappAccount'],{'onDelete':_0x75f2('0x16e')});db[_0x75f2('0x1f5')][_0x75f2('0x11b')](db[_0x75f2('0x85')],{'onDelete':'restrict','foreignKey':_0x75f2('0x17a')});db[_0x75f2('0x1f5')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0x75f2('0x174')});db[_0x75f2('0x118')][_0x75f2('0x10f')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0x75f2('0x10c'),'foreignKey':_0x75f2('0x1f6')});db[_0x75f2('0x118')]['belongsTo'](db[_0x75f2('0xfe')],{'as':_0x75f2('0x175'),'foreignKey':_0x75f2('0x1f3')});db[_0x75f2('0x118')][_0x75f2('0x11b')](db[_0x75f2('0x165')],{'as':_0x75f2('0x155'),'foreignKey':'ContactId'});db[_0x75f2('0x118')][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'as':_0x75f2('0x166'),'foreignKey':_0x75f2('0x10d')});db[_0x75f2('0x118')][_0x75f2('0x11e')](db['Tag'],{'through':_0x75f2('0x1ab'),'as':_0x75f2('0x168')});db[_0x75f2('0x118')][_0x75f2('0x11e')](db['Tag'],{'through':_0x75f2('0x1ab'),'as':_0x75f2('0x169')});db[_0x75f2('0x118')]['belongsToMany'](db[_0x75f2('0x10e')],{'as':'Users','through':_0x75f2('0x125'),'foreignKey':_0x75f2('0x1f6')});db[_0x75f2('0x1f4')][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'as':_0x75f2('0x10e')});db[_0x75f2('0x1f4')][_0x75f2('0x11b')](db[_0x75f2('0x165')],{'onDelete':_0x75f2('0x10c'),'as':_0x75f2('0x155')});db[_0x75f2('0x1f4')][_0x75f2('0x11b')](db[_0x75f2('0x118')],{'onDelete':_0x75f2('0x10c'),'as':_0x75f2('0x16c'),'foreignKey':_0x75f2('0x1f6')});db[_0x75f2('0x1f4')][_0x75f2('0x11b')](db['WhatsappAccount'],{'as':_0x75f2('0x175'),'foreignKey':_0x75f2('0x1f3')});db[_0x75f2('0x103')]['belongsTo'](db[_0x75f2('0xfe')],{});db[_0x75f2('0x103')][_0x75f2('0x11b')](db[_0x75f2('0xf4')],{'as':_0x75f2('0x15e'),'foreignKey':'ListId'});db[_0x75f2('0x103')]['belongsTo'](db[_0x75f2('0x165')],{'as':'Contact','foreignKey':'ContactId'});db[_0x75f2('0x103')][_0x75f2('0x11b')](db[_0x75f2('0x118')],{});db['WhatsappQueueReport'][_0x75f2('0x11b')](db[_0x75f2('0x130')],{});db['WhatsappQueueReport'][_0x75f2('0x11b')](db[_0x75f2('0x1f4')],{});db[_0x75f2('0x103')][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{});db['WhatsappTransferReport'][_0x75f2('0x11b')](db[_0x75f2('0x1f4')],{});db[_0x75f2('0x105')][_0x75f2('0x11b')](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0x75f2('0x11b')](db[_0x75f2('0xfe')],{'foreignKey':_0x75f2('0x1f7'),'as':_0x75f2('0x1d9')});db['WhatsappTransferReport'][_0x75f2('0x11b')](db[_0x75f2('0xfe')],{'foreignKey':'ToWhatsappAccountId','as':_0x75f2('0x1df')});db[_0x75f2('0x105')][_0x75f2('0x11b')](db[_0x75f2('0x130')],{'foreignKey':'ToQueueId','as':_0x75f2('0x1e3')});db['WhatsappTransferReport'][_0x75f2('0x11b')](db[_0x75f2('0x10e')],{'foreignKey':'FromUserId','as':_0x75f2('0x1e1')});db[_0x75f2('0x105')]['belongsTo'](db[_0x75f2('0x10e')],{'foreignKey':_0x75f2('0x1db'),'as':_0x75f2('0x1dc')});db['WhatsappQueue']['belongsToMany'](db['User'],{'as':_0x75f2('0x162'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0x75f2('0x130')][_0x75f2('0x11e')](db['Team'],{'through':_0x75f2('0x1d1'),'as':'Teams'});module[_0x75f2('0x1f8')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x34a1=['ThroughTags','Users','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','Interaction','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ProactiveActions','user_has_chat_websites','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Contacts','CompanyId','JscriptySessions','CmCompany','Company','cm_contact_has_tags','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','Actions','AutomationId','ParentId','Intervals','MailApplications','FaxApplications','DefaultReportId','CustomReportId','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','DescriptionId','FieldId','Description','VariableId','SugarcrmAccount','Descriptions','int_desk_configuration_has_tags','Field','ZendeskConfiguration','FreshdeskField','Subject','VtigerField','Dynamics365Field','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','team_has_sms_queues','OpenchannelQueues','Hoppers','TrunkId','TrunkBackup','SquareProjectId','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','user_has_voice_prefixes','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xcall','mysql','utf8mb4','name','utf8','sequelizeHistory','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','Template','../api/template/template.model','Trigger','Variable','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Integration','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','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','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','VoiceMail','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','SmsInteraction','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotification','Groups','chat_group_has_users','belongsToMany','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','OpenchannelInteractions','user_has_whatsapp_interactions','VoiceQueues','MailQueue','MailQueues','UserMailQueue','ChatQueues','FaxQueues','SmsQueues','WhatsappQueue','WhatsappQueues','VoicePrefixes','MailAccounts','user_has_mail_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceMusicOnHold','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','belongsTo','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','mailboxuser','mailbox','VoiceMailMessage','QueueCalls','uniqueid','CmContact','Contact','ContactId','MailServerIn','MailAccountId','Smtp','Disposition','Dispositions','Messages','Interactions','Applications','List','team_has_mail_queues','MailInteractionId','Account','Tag','mail_interaction_has_tags','user_has_mail_interactions','Attachments','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','MailQueueReport','Dashboard','DashboardItem','Items','Answers','FaxAccountId','FaxApplication','Exntensions','ListId','FaxInteractionId','Owner','fax_interaction_has_tags','Tags'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x34a1,0x6f));var _0x134a=function(_0x466afd,_0x9d7043){_0x466afd=_0x466afd-0x0;var _0x263c75=_0x34a1[_0x466afd];return _0x263c75;};'use strict';var config=require(_0x134a('0x0'));var Sequelize=require(_0x134a('0x1'));var _=require('lodash');var jstz=require(_0x134a('0x2'));var timezone=jstz[_0x134a('0x3')]();config[_0x134a('0x1')]=_[_0x134a('0x4')](config[_0x134a('0x1')],{'database':_0x134a('0x5'),'username':_0x134a('0x6'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x134a('0x7'),'dialectOptions':{'charset':_0x134a('0x8')},'logging':![],'timezone':timezone[_0x134a('0x9')](),'define':{'charset':_0x134a('0xa'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x134a('0x4')](config[_0x134a('0xb')],{'database':_0x134a('0x5'),'username':_0x134a('0x6'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x134a('0x7'),'dialectOptions':{'charset':_0x134a('0x8')},'logging':![],'timezone':timezone[_0x134a('0x9')](),'define':{'charset':_0x134a('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x134a('0x1')][_0x134a('0xc')],config[_0x134a('0x1')][_0x134a('0xd')],config[_0x134a('0x1')][_0x134a('0xe')],config[_0x134a('0x1')][_0x134a('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x134a('0xc')],config[_0x134a('0xb')][_0x134a('0xd')],config[_0x134a('0xb')]['password'],config['sequelizeHistory'][_0x134a('0xf')])};db[_0x134a('0x10')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x12'));db[_0x134a('0x13')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x14'));db[_0x134a('0x15')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x16'));db[_0x134a('0x17')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x18'));db['VoiceMusicOnHold']=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x19'));db[_0x134a('0x1a')]=db['sequelize']['import'](_0x134a('0x1b'));db['VoiceRecording']=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x1c'));db[_0x134a('0x1d')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x1e'));db['VoiceMail']=db['sequelize'][_0x134a('0x11')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x1f'));db[_0x134a('0x20')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x21'));db[_0x134a('0x22')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x23'));db['VoiceAgentReport']=db['sequelize']['import'](_0x134a('0x24'));db[_0x134a('0x25')]=db[_0x134a('0x1')]['import'](_0x134a('0x26'));db[_0x134a('0x27')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x28'));db[_0x134a('0x29')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x2a'));db[_0x134a('0x2b')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x2c'));db[_0x134a('0x2d')]=db['sequelize'][_0x134a('0x11')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x134a('0x2e')]=db[_0x134a('0x1')]['import'](_0x134a('0x2f'));db[_0x134a('0x30')]=db['sequelize']['import'](_0x134a('0x31'));db['UserMailQueue']=db['sequelize'][_0x134a('0x11')]('../api/userMailQueue/userMailQueue.model');db[_0x134a('0x32')]=db[_0x134a('0x1')]['import'](_0x134a('0x33'));db[_0x134a('0x34')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x35'));db[_0x134a('0x36')]=db['sequelize'][_0x134a('0x11')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x134a('0x37')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x38'));db['MailServerIn']=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x39'));db[_0x134a('0x3a')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x3b'));db[_0x134a('0x3c')]=db[_0x134a('0x1')]['import'](_0x134a('0x3d'));db['MailQueue']=db['sequelize'][_0x134a('0x11')](_0x134a('0x3e'));db['MailSubstatus']=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x3f'));db['MailInteraction']=db['sequelize']['import']('../api/mailInteraction/mailInteraction.model');db[_0x134a('0x40')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x41'));db[_0x134a('0x42')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x43'));db['MailQueueReport']=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x44'));db['Dashboard']=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x45'));db['DashboardItem']=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x46'));db[_0x134a('0x47')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x48'));db['FaxApplication']=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x49'));db[_0x134a('0x4a')]=db[_0x134a('0x1')]['import'](_0x134a('0x4b'));db[_0x134a('0x4c')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x4d'));db[_0x134a('0x4e')]=db[_0x134a('0x1')]['import'](_0x134a('0x4f'));db['FaxQueueReport']=db[_0x134a('0x1')]['import']('../api/faxQueueReport/faxQueueReport.model');db[_0x134a('0x50')]=db[_0x134a('0x1')][_0x134a('0x11')]('../api/smsAccount/smsAccount.model');db[_0x134a('0x51')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x52'));db['SmsInteraction']=db[_0x134a('0x1')]['import'](_0x134a('0x53'));db[_0x134a('0x54')]=db[_0x134a('0x1')][_0x134a('0x11')]('../api/smsMessage/smsMessage.model');db[_0x134a('0x55')]=db[_0x134a('0x1')]['import'](_0x134a('0x56'));db[_0x134a('0x57')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x58'));db[_0x134a('0x59')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x5a'));db[_0x134a('0x5b')]=db[_0x134a('0x1')]['import'](_0x134a('0x5c'));db['OpenchannelMessage']=db['sequelize'][_0x134a('0x11')](_0x134a('0x5d'));db[_0x134a('0x5e')]=db[_0x134a('0x1')]['import']('../api/openchannelQueue/openchannelQueue.model');db[_0x134a('0x5f')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x60'));db[_0x134a('0x61')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x62'));db[_0x134a('0x63')]=db[_0x134a('0x1')][_0x134a('0x11')]('../api/chatApplication/chatApplication.model');db[_0x134a('0x64')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x65'));db[_0x134a('0x66')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x67'));db[_0x134a('0x68')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x69'));db[_0x134a('0x6a')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x6b'));db[_0x134a('0x6c')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x6d'));db[_0x134a('0x6e')]=db[_0x134a('0x1')]['import'](_0x134a('0x6f'));db['CmCompany']=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x70'));db['CmContact']=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x71'));db[_0x134a('0x72')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x73'));db[_0x134a('0x74')]=db['sequelize'][_0x134a('0x11')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x134a('0x75')]=db[_0x134a('0x1')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0x134a('0x76')]=db[_0x134a('0x1')]['import'](_0x134a('0x77'));db[_0x134a('0x78')]=db['sequelize']['import'](_0x134a('0x79'));db[_0x134a('0x7a')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x7b'));db[_0x134a('0x7c')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x7d'));db[_0x134a('0x7e')]=db[_0x134a('0x1')]['import'](_0x134a('0x7f'));db[_0x134a('0x80')]=db['sequelize'][_0x134a('0x11')](_0x134a('0x81'));db['Disposition']=db[_0x134a('0x1')][_0x134a('0x11')]('../api/disposition/disposition.model');db[_0x134a('0x82')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x83'));db[_0x134a('0x84')]=db[_0x134a('0x1')]['import'](_0x134a('0x85'));db['Pause']=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x86'));db['Cdr']=db['sequelize'][_0x134a('0x11')](_0x134a('0x87'));db[_0x134a('0x88')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x89'));db[_0x134a('0x8a')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x8b'));db[_0x134a('0x8c')]=db['sequelize'][_0x134a('0x11')](_0x134a('0x8d'));db['Tag']=db['sequelize'][_0x134a('0x11')](_0x134a('0x8e'));db[_0x134a('0x8f')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x90'));db[_0x134a('0x91')]=db['sequelize'][_0x134a('0x11')]('../api/trigger/trigger.model');db[_0x134a('0x92')]=db[_0x134a('0x1')][_0x134a('0x11')]('../api/variable/variable.model');db['Integration']=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x93'));db['IntegrationReport']=db['sequelize']['import'](_0x134a('0x94'));db[_0x134a('0x95')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x96'));db[_0x134a('0x97')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x98'));db[_0x134a('0x99')]=db[_0x134a('0x1')]['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x134a('0x9a')]=db[_0x134a('0x1')]['import'](_0x134a('0x9b'));db[_0x134a('0x9c')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x9d'));db[_0x134a('0x9e')]=db[_0x134a('0x1')]['import'](_0x134a('0x9f'));db[_0x134a('0xa0')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xa1'));db[_0x134a('0xa2')]=db['sequelize'][_0x134a('0x11')](_0x134a('0xa3'));db[_0x134a('0xa4')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xa5'));db['SugarcrmAccount']=db[_0x134a('0x1')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x134a('0xa6')]=db[_0x134a('0x1')][_0x134a('0x11')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x134a('0xa7')]=db[_0x134a('0x1')]['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0x134a('0xa8')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xa9'));db[_0x134a('0xaa')]=db['sequelize']['import'](_0x134a('0xab'));db[_0x134a('0xac')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xad'));db[_0x134a('0xae')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xaf'));db[_0x134a('0xb0')]=db[_0x134a('0x1')]['import'](_0x134a('0xb1'));db[_0x134a('0xb2')]=db[_0x134a('0x1')]['import']('../api/intZohoField/intZohoField.model');db[_0x134a('0xb3')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xb4'));db['ZendeskConfiguration']=db[_0x134a('0x1')][_0x134a('0x11')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x134a('0xb5')]=db[_0x134a('0x1')]['import'](_0x134a('0xb6'));db[_0x134a('0xb7')]=db['sequelize'][_0x134a('0x11')](_0x134a('0xb8'));db[_0x134a('0xb9')]=db[_0x134a('0x1')][_0x134a('0x11')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db['sequelize'][_0x134a('0x11')](_0x134a('0xba'));db[_0x134a('0xbb')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xbc'));db[_0x134a('0xbd')]=db['sequelize']['import'](_0x134a('0xbe'));db['VtigerField']=db[_0x134a('0x1')][_0x134a('0x11')]('../api/intVtigerField/intVtigerField.model');db[_0x134a('0xbf')]=db['sequelize'][_0x134a('0x11')](_0x134a('0xc0'));db[_0x134a('0xc1')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xc2'));db[_0x134a('0xc3')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xc4'));db[_0x134a('0xc5')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xc6'));db[_0x134a('0xc7')]=db[_0x134a('0x1')]['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db['sequelize'][_0x134a('0x11')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x134a('0xc8')]=db['sequelize'][_0x134a('0x11')](_0x134a('0xc9'));db[_0x134a('0xca')]=db[_0x134a('0x1')]['import'](_0x134a('0xcb'));db[_0x134a('0xcc')]=db[_0x134a('0x1')][_0x134a('0x11')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x134a('0xcd')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x93'));db[_0x134a('0xce')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xcf'));db[_0x134a('0xd0')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xd1'));db[_0x134a('0xd2')]=db['sequelize']['import'](_0x134a('0xd3'));db[_0x134a('0xd4')]=db[_0x134a('0x1')]['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xd5'));db[_0x134a('0xd6')]=db[_0x134a('0x1')]['import'](_0x134a('0xd7'));db[_0x134a('0xd8')]=db[_0x134a('0x1')]['import'](_0x134a('0xd9'));db[_0x134a('0xda')]=db[_0x134a('0x1')]['import'](_0x134a('0xdb'));db[_0x134a('0xdc')]=db['sequelize'][_0x134a('0x11')](_0x134a('0xdd'));db[_0x134a('0xde')]=db[_0x134a('0x1')]['import']('../api/jscriptyProject/jscriptyProject.model');db[_0x134a('0xdf')]=db['sequelize'][_0x134a('0x11')]('../api/setting/setting.model');db[_0x134a('0xe0')]=db[_0x134a('0x1')]['import'](_0x134a('0xe1'));db[_0x134a('0xe2')]=db[_0x134a('0x1')][_0x134a('0x11')]('../api/squareProject/squareProject.model');db[_0x134a('0xe3')]=db[_0x134a('0x1')][_0x134a('0x11')]('../api/squareRecording/squareRecording.model');db[_0x134a('0xe4')]=db[_0x134a('0x1')]['import'](_0x134a('0xe5'));db[_0x134a('0xe6')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xe7'));db[_0x134a('0xe8')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xe9'));db[_0x134a('0xea')]=db[_0x134a('0x1')]['import'](_0x134a('0xeb'));db[_0x134a('0xec')]=db['sequelize'][_0x134a('0x11')](_0x134a('0xed'));db[_0x134a('0xee')]=db['sequelize'][_0x134a('0x11')](_0x134a('0xef'));db[_0x134a('0xf0')]=db[_0x134a('0x1')]['import'](_0x134a('0xf1'));db[_0x134a('0xf2')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xf3'));db[_0x134a('0xf4')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xf5'));db[_0x134a('0xf6')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xf7'));db[_0x134a('0xf8')]=db[_0x134a('0x1')]['import'](_0x134a('0xf9'));db['SmsTransferReport']=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xfa'));db[_0x134a('0xfb')]=db[_0x134a('0x1')]['import'](_0x134a('0xfc'));db[_0x134a('0xfd')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0xfe'));db[_0x134a('0xff')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x100'));db['UserProfileSection']=db['sequelize'][_0x134a('0x11')](_0x134a('0x101'));db['UserProfileResource']=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x102'));db['UserNotification']=db[_0x134a('0x1')]['import'](_0x134a('0x103'));db[_0x134a('0x104')]=db['sequelize'][_0x134a('0x11')](_0x134a('0x105'));db[_0x134a('0x106')]=db['sequelize'][_0x134a('0x11')](_0x134a('0x107'));db[_0x134a('0x108')]=db[_0x134a('0x1')]['import'](_0x134a('0x109'));db[_0x134a('0x10a')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x10b'));db[_0x134a('0x10c')]=db[_0x134a('0x1')][_0x134a('0x11')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x134a('0x10d')]=db[_0x134a('0x1')]['import'](_0x134a('0x10e'));db['WhatsappQueue']=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x10f'));db[_0x134a('0x110')]=db['sequelize'][_0x134a('0x11')](_0x134a('0x111'));db[_0x134a('0x112')]=db[_0x134a('0x1')][_0x134a('0x11')](_0x134a('0x113'));db['User'][_0x134a('0x114')](db[_0x134a('0x115')],{'as':'VoiceMail','onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x117')});db['User'][_0x134a('0x118')](db[_0x134a('0x119')],{'as':_0x134a('0x11a'),'foreignKey':_0x134a('0x117')});db[_0x134a('0x10')][_0x134a('0x118')](db[_0x134a('0x2d')],{'as':_0x134a('0x11b'),'foreignKey':_0x134a('0x117')});db[_0x134a('0x10')][_0x134a('0x118')](db['VoiceExtension'],{'as':_0x134a('0x11c'),'onDelete':_0x134a('0x116'),'hooks':!![]});db[_0x134a('0x10')]['hasMany'](db[_0x134a('0x75')],{'as':_0x134a('0x11d'),'foreignKey':_0x134a('0x117')});db[_0x134a('0x10')][_0x134a('0x118')](db['CmHopperHistory'],{'as':_0x134a('0x11e'),'foreignKey':_0x134a('0x117')});db['User'][_0x134a('0x118')](db['ReportAgentPreview'],{'as':_0x134a('0x78'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0x134a('0x5b')],{'as':'OpenchannelInteractions','foreignKey':_0x134a('0x117')});db[_0x134a('0x10')]['hasMany'](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0x134a('0x117')});db['User'][_0x134a('0x118')](db[_0x134a('0x11f')],{'as':'SmsInteractions','foreignKey':_0x134a('0x117')});db[_0x134a('0x10')][_0x134a('0x118')](db['FaxInteraction'],{'as':_0x134a('0x120'),'foreignKey':'UserId'});db[_0x134a('0x10')][_0x134a('0x118')](db[_0x134a('0x121')],{'as':_0x134a('0x122'),'foreignKey':_0x134a('0x117')});db[_0x134a('0x10')][_0x134a('0x118')](db[_0x134a('0x108')],{'as':_0x134a('0x123'),'foreignKey':_0x134a('0x117')});db['User']['hasMany'](db[_0x134a('0x124')],{'as':'UserNotifications','foreignKey':'SenderId'});db[_0x134a('0x10')]['belongsTo'](db[_0x134a('0xff')],{'as':_0x134a('0xff'),'foreignKey':'userProfileId'});db[_0x134a('0x10')]['belongsToMany'](db[_0x134a('0x6c')],{'as':_0x134a('0x125'),'through':_0x134a('0x126')});db['User'][_0x134a('0x127')](db['CmContact'],{'as':'Contacts','through':_0x134a('0x128')});db[_0x134a('0x10')]['belongsToMany'](db[_0x134a('0xfb')],{'as':_0x134a('0x129'),'through':_0x134a('0x12a')});db[_0x134a('0x10')][_0x134a('0x127')](db[_0x134a('0xe6')],{'through':_0x134a('0x12b')});db[_0x134a('0x10')][_0x134a('0x127')](db['MailInteraction'],{'as':_0x134a('0x122'),'through':'user_has_mail_interactions'});db[_0x134a('0x10')][_0x134a('0x127')](db['ChatInteraction'],{'as':_0x134a('0x12c'),'through':_0x134a('0x12d')});db[_0x134a('0x10')]['belongsToMany'](db[_0x134a('0x4a')],{'as':_0x134a('0x120'),'through':_0x134a('0x12e')});db[_0x134a('0x10')][_0x134a('0x127')](db[_0x134a('0x11f')],{'as':_0x134a('0x12f'),'through':_0x134a('0x130')});db[_0x134a('0x10')][_0x134a('0x127')](db[_0x134a('0x5b')],{'as':_0x134a('0x131'),'through':'user_has_openchannel_interactions'});db[_0x134a('0x10')][_0x134a('0x127')](db[_0x134a('0x108')],{'as':'WhatsappInteractions','through':_0x134a('0x132')});db[_0x134a('0x10')][_0x134a('0x127')](db[_0x134a('0x1a')],{'as':_0x134a('0x133'),'through':_0x134a('0x2e'),'required':![]});db[_0x134a('0x10')][_0x134a('0x127')](db[_0x134a('0x134')],{'as':_0x134a('0x135'),'through':_0x134a('0x136'),'required':![]});db[_0x134a('0x10')][_0x134a('0x127')](db['ChatQueue'],{'as':_0x134a('0x137'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0x134a('0x127')](db[_0x134a('0x4e')],{'as':_0x134a('0x138'),'through':_0x134a('0x32'),'required':![]});db[_0x134a('0x10')][_0x134a('0x127')](db['SmsQueue'],{'as':_0x134a('0x139'),'through':_0x134a('0x34'),'required':![]});db[_0x134a('0x10')][_0x134a('0x127')](db[_0x134a('0x5e')],{'as':'OpenchannelQueues','through':_0x134a('0x36'),'required':![]});db[_0x134a('0x10')][_0x134a('0x127')](db[_0x134a('0x13a')],{'as':_0x134a('0x13b'),'through':_0x134a('0x37'),'required':![]});db[_0x134a('0x10')]['belongsToMany'](db[_0x134a('0xfb')],{'through':_0x134a('0x12a')});db['User'][_0x134a('0x127')](db[_0x134a('0xfd')],{'as':_0x134a('0x13c'),'through':'user_has_voice_prefixes','required':![]});db[_0x134a('0x10')][_0x134a('0x127')](db[_0x134a('0x5f')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db[_0x134a('0x10')]['belongsToMany'](db[_0x134a('0x47')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0x134a('0x10')][_0x134a('0x127')](db[_0x134a('0x3c')],{'as':_0x134a('0x13d'),'through':_0x134a('0x13e')});db['User']['belongsToMany'](db[_0x134a('0x57')],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db['User'][_0x134a('0x127')](db['SmsAccount'],{'as':_0x134a('0x13f'),'through':_0x134a('0x140')});db[_0x134a('0x10')][_0x134a('0x127')](db[_0x134a('0x104')],{'as':_0x134a('0x141'),'through':_0x134a('0x142')});db[_0x134a('0x10')][_0x134a('0x127')](db[_0x134a('0xe2')],{'as':_0x134a('0x143'),'through':_0x134a('0x144')});db[_0x134a('0x13')][_0x134a('0x118')](db[_0x134a('0x17')],{'as':_0x134a('0x145'),'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x146')});db['VoiceContext'][_0x134a('0x118')](db[_0x134a('0x17')],{'onDelete':_0x134a('0x116')});db[_0x134a('0x17')][_0x134a('0x118')](db[_0x134a('0x17')],{'as':'Applications','onDelete':_0x134a('0x116')});db[_0x134a('0x147')]['belongsToMany'](db[_0x134a('0x8c')],{'as':'Sounds','through':_0x134a('0x148')});db[_0x134a('0x1a')][_0x134a('0x118')](db['UserVoiceQueueRt'],{'as':_0x134a('0x149'),'foreignKey':_0x134a('0x14a')});db[_0x134a('0x1a')][_0x134a('0x118')](db[_0x134a('0x72')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db[_0x134a('0x1a')][_0x134a('0x118')](db[_0x134a('0x75')],{'as':_0x134a('0x11d'),'foreignKey':_0x134a('0x14a')});db[_0x134a('0x1a')][_0x134a('0x118')](db[_0x134a('0x76')],{'as':_0x134a('0x14b'),'foreignKey':_0x134a('0x14a')});db[_0x134a('0x1a')]['hasMany'](db[_0x134a('0x78')],{'as':_0x134a('0x78'),'foreignKey':_0x134a('0x14a')});db[_0x134a('0x1a')][_0x134a('0x118')](db[_0x134a('0x74')],{'as':_0x134a('0x14c'),'foreignKey':_0x134a('0x14a')});db[_0x134a('0x1a')]['hasMany'](db[_0x134a('0xd6')],{'as':'JscriptySessions','foreignKey':_0x134a('0x14a')});db['VoiceQueue'][_0x134a('0x14d')](db['Trunk'],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x134a('0x1a')]['belongsTo'](db[_0x134a('0x29')],{'as':'TrunkBackup','foreignKey':_0x134a('0x14e')});db[_0x134a('0x1a')][_0x134a('0x14d')](db[_0x134a('0x84')],{'as':_0x134a('0x84'),'foreignKey':_0x134a('0x14f')});db[_0x134a('0x1a')][_0x134a('0x14d')](db[_0x134a('0x150')],{'as':_0x134a('0x151'),'foreignKey':_0x134a('0x152')});db['VoiceQueue'][_0x134a('0x127')](db[_0x134a('0xfb')],{'as':_0x134a('0x129'),'through':_0x134a('0x153')});db[_0x134a('0x1a')][_0x134a('0x127')](db['User'],{'as':_0x134a('0x154'),'through':_0x134a('0x2e')});db[_0x134a('0x1a')][_0x134a('0x127')](db[_0x134a('0xe6')],{'as':_0x134a('0x155'),'through':_0x134a('0x112')});db['VoiceQueue'][_0x134a('0x127')](db[_0x134a('0xfb')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0x134a('0x119')][_0x134a('0x14d')](db['User'],{'as':_0x134a('0x10'),'foreignKey':'UserId'});db[_0x134a('0x1d')]['belongsTo'](db[_0x134a('0x10')],{'as':'User','foreignKey':_0x134a('0x117')});db[_0x134a('0x115')]['hasMany'](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x156'),'sourceKey':_0x134a('0x157')});db[_0x134a('0x158')]['belongsTo'](db[_0x134a('0x115')],{'foreignKey':_0x134a('0x156'),'targetKey':'mailbox'});db[_0x134a('0x20')]['hasMany'](db[_0x134a('0x25')],{'as':_0x134a('0x159'),'foreignKey':'uniqueid','constraints':![]});db[_0x134a('0x20')][_0x134a('0x118')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':_0x134a('0x15a'),'constraints':![]});db[_0x134a('0x20')][_0x134a('0x14d')](db[_0x134a('0x10')],{'as':_0x134a('0x10'),'foreignKey':_0x134a('0x117')});db[_0x134a('0x20')][_0x134a('0x14d')](db[_0x134a('0x15b')],{'as':_0x134a('0x15c'),'foreignKey':_0x134a('0x15d')});db[_0x134a('0x15e')][_0x134a('0x14d')](db['MailAccount'],{'as':_0x134a('0x3c'),'foreignKey':_0x134a('0x15f')});db[_0x134a('0x3a')]['belongsTo'](db[_0x134a('0x3c')],{'as':_0x134a('0x3c'),'foreignKey':_0x134a('0x15f')});db[_0x134a('0x3c')][_0x134a('0x114')](db[_0x134a('0x15e')],{'as':'Imap','onDelete':_0x134a('0x116')});db['MailAccount'][_0x134a('0x114')](db['MailServerOut'],{'as':_0x134a('0x160'),'onDelete':_0x134a('0x116')});db[_0x134a('0x3c')][_0x134a('0x118')](db[_0x134a('0x161')],{'as':_0x134a('0x162'),'foreignKey':_0x134a('0x15f'),'onDelete':_0x134a('0x116')});db[_0x134a('0x3c')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x134a('0x15f')});db[_0x134a('0x3c')][_0x134a('0x118')](db[_0x134a('0x40')],{'as':_0x134a('0x163'),'foreignKey':_0x134a('0x15f')});db[_0x134a('0x3c')][_0x134a('0x118')](db[_0x134a('0x121')],{'as':_0x134a('0x164')});db[_0x134a('0x3c')][_0x134a('0x118')](db[_0x134a('0x42')],{'as':_0x134a('0x165')});db[_0x134a('0x3c')][_0x134a('0x14d')](db[_0x134a('0xfb')],{'as':_0x134a('0x166'),'foreignKey':'ListId'});db[_0x134a('0x3c')]['belongsTo'](db['Template'],{'as':_0x134a('0x8f'),'foreignKey':'TemplateId'});db['MailAccount'][_0x134a('0x14d')](db[_0x134a('0x150')],{'as':'mandatoryDispositionPause','foreignKey':_0x134a('0x152')});db['MailAccount'][_0x134a('0x127')](db[_0x134a('0x10')],{'as':_0x134a('0x154'),'through':_0x134a('0x13e')});db[_0x134a('0x134')][_0x134a('0x127')](db[_0x134a('0x10')],{'as':_0x134a('0x154'),'through':'UserMailQueue'});db[_0x134a('0x134')]['belongsToMany'](db[_0x134a('0xe6')],{'through':_0x134a('0x167'),'as':_0x134a('0x155')});db[_0x134a('0x121')][_0x134a('0x118')](db[_0x134a('0x40')],{'as':_0x134a('0x163'),'onDelete':'cascade','foreignKey':_0x134a('0x168')});db[_0x134a('0x121')][_0x134a('0x14d')](db[_0x134a('0x3c')],{'as':_0x134a('0x169'),'foreignKey':_0x134a('0x15f')});db[_0x134a('0x121')][_0x134a('0x14d')](db[_0x134a('0x15b')],{'as':_0x134a('0x15c'),'foreignKey':_0x134a('0x15d')});db[_0x134a('0x121')][_0x134a('0x14d')](db[_0x134a('0x10')],{'as':'Owner','foreignKey':_0x134a('0x117')});db['MailInteraction'][_0x134a('0x127')](db[_0x134a('0x16a')],{'through':_0x134a('0x16b'),'as':'Tags'});db[_0x134a('0x121')][_0x134a('0x127')](db[_0x134a('0x16a')],{'through':_0x134a('0x16b'),'as':'ThroughTags'});db[_0x134a('0x121')][_0x134a('0x127')](db[_0x134a('0x10')],{'as':'Users','through':_0x134a('0x16c'),'foreignKey':_0x134a('0x168')});db['MailMessage'][_0x134a('0x118')](db[_0x134a('0xee')],{'as':_0x134a('0x16d'),'onDelete':_0x134a('0x116')});db[_0x134a('0x40')][_0x134a('0x14d')](db[_0x134a('0x10')],{'as':_0x134a('0x10')});db[_0x134a('0x40')]['belongsTo'](db['CmContact'],{'onDelete':_0x134a('0x116'),'as':'Contact'});db['MailMessage'][_0x134a('0x14d')](db[_0x134a('0x121')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0x134a('0x40')][_0x134a('0x14d')](db[_0x134a('0x3c')],{'as':_0x134a('0x169'),'foreignKey':_0x134a('0x15f')});db['MailMessage'][_0x134a('0x14d')](db[_0x134a('0x5f')],{'as':'ChatWebsite','foreignKey':_0x134a('0x16e')});db[_0x134a('0x40')]['belongsTo'](db[_0x134a('0x68')],{'as':_0x134a('0x68'),'foreignKey':_0x134a('0x16f')});db[_0x134a('0x42')][_0x134a('0x14d')](db[_0x134a('0x10')],{'onDelete':_0x134a('0x170')});db[_0x134a('0x42')][_0x134a('0x14d')](db['MailQueue'],{'onDelete':_0x134a('0x170')});db[_0x134a('0x42')][_0x134a('0x14d')](db['MailAccount'],{'onDelete':_0x134a('0x170')});db['MailApplication'][_0x134a('0x14d')](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x134a('0x42')][_0x134a('0x14d')](db[_0x134a('0x16a')],{'onDelete':_0x134a('0x170'),'foreignKey':_0x134a('0x171')});db['MailQueueReport'][_0x134a('0x14d')](db['MailAccount'],{});db[_0x134a('0x172')][_0x134a('0x14d')](db[_0x134a('0xfb')],{'as':_0x134a('0x166'),'foreignKey':'ListId'});db['MailQueueReport'][_0x134a('0x14d')](db[_0x134a('0x15b')],{'as':_0x134a('0x15c'),'foreignKey':'ContactId'});db[_0x134a('0x172')][_0x134a('0x14d')](db[_0x134a('0x121')],{});db['MailQueueReport'][_0x134a('0x14d')](db[_0x134a('0x40')],{});db[_0x134a('0x172')]['belongsTo'](db['User'],{});db[_0x134a('0x172')][_0x134a('0x14d')](db[_0x134a('0x134')],{});db[_0x134a('0x173')][_0x134a('0x118')](db[_0x134a('0x174')],{'as':_0x134a('0x175'),'onDelete':_0x134a('0x116')});db[_0x134a('0x47')][_0x134a('0x118')](db[_0x134a('0x161')],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':_0x134a('0x116')});db[_0x134a('0x47')]['hasMany'](db['CannedAnswer'],{'as':_0x134a('0x176'),'foreignKey':_0x134a('0x177')});db['FaxAccount'][_0x134a('0x118')](db[_0x134a('0x4a')],{'as':_0x134a('0x164')});db['FaxAccount']['hasMany'](db[_0x134a('0x178')],{'as':'Applications'});db[_0x134a('0x47')][_0x134a('0x118')](db[_0x134a('0x17')],{'as':_0x134a('0x179'),'onDelete':'cascade'});db[_0x134a('0x47')][_0x134a('0x118')](db[_0x134a('0x4c')],{'as':_0x134a('0x163')});db[_0x134a('0x47')][_0x134a('0x14d')](db['Trunk'],{'as':'Trunk'});db[_0x134a('0x47')]['belongsTo'](db['CmList'],{'as':_0x134a('0x166'),'foreignKey':_0x134a('0x17a')});db[_0x134a('0x47')]['belongsTo'](db['Pause'],{'as':_0x134a('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x134a('0x47')]['belongsToMany'](db['User'],{'as':'Agents','through':'user_has_fax_accounts'});db[_0x134a('0x178')][_0x134a('0x14d')](db[_0x134a('0x10')],{'onDelete':_0x134a('0x170')});db[_0x134a('0x178')][_0x134a('0x14d')](db['FaxQueue'],{'onDelete':_0x134a('0x170')});db[_0x134a('0x178')]['belongsTo'](db[_0x134a('0x47')],{'onDelete':_0x134a('0x170')});db[_0x134a('0x178')][_0x134a('0x14d')](db[_0x134a('0x16a')],{'onDelete':_0x134a('0x170'),'foreignKey':_0x134a('0x171')});db['FaxInteraction'][_0x134a('0x118')](db['FaxMessage'],{'as':_0x134a('0x163'),'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x17b')});db[_0x134a('0x4a')][_0x134a('0x14d')](db[_0x134a('0x47')],{'as':'Account','foreignKey':_0x134a('0x177')});db[_0x134a('0x4a')][_0x134a('0x14d')](db[_0x134a('0x15b')],{'as':_0x134a('0x15c'),'foreignKey':_0x134a('0x15d')});db[_0x134a('0x4a')][_0x134a('0x14d')](db['User'],{'as':_0x134a('0x17c'),'foreignKey':_0x134a('0x117')});db[_0x134a('0x4a')]['belongsToMany'](db['Tag'],{'through':_0x134a('0x17d'),'as':_0x134a('0x17e')});db[_0x134a('0x4a')]['belongsToMany'](db['Tag'],{'through':_0x134a('0x17d'),'as':_0x134a('0x17f')});db[_0x134a('0x4a')]['belongsToMany'](db[_0x134a('0x10')],{'as':_0x134a('0x180'),'through':_0x134a('0x12e'),'foreignKey':_0x134a('0x17b')});db[_0x134a('0x4c')]['belongsTo'](db[_0x134a('0x10')],{'onDelete':'cascade','as':'User'});db[_0x134a('0x4c')][_0x134a('0x14d')](db[_0x134a('0x4a')],{'as':'Interaction','foreignKey':_0x134a('0x17b')});db['FaxMessage'][_0x134a('0x14d')](db[_0x134a('0x15b')],{'onDelete':_0x134a('0x116'),'as':'Contact'});db[_0x134a('0x4c')][_0x134a('0x14d')](db[_0x134a('0xee')],{'as':'Attachment','foreignKey':_0x134a('0x181')});db[_0x134a('0x4c')]['belongsTo'](db[_0x134a('0x47')],{'as':_0x134a('0x169'),'foreignKey':_0x134a('0x177')});db[_0x134a('0x4e')][_0x134a('0x127')](db[_0x134a('0x10')],{'as':_0x134a('0x154'),'through':'UserFaxQueue'});db[_0x134a('0x4e')][_0x134a('0x127')](db[_0x134a('0xe6')],{'through':_0x134a('0x182'),'as':_0x134a('0x155')});db[_0x134a('0x183')][_0x134a('0x14d')](db[_0x134a('0x47')],{});db[_0x134a('0x183')][_0x134a('0x14d')](db[_0x134a('0xfb')],{'as':_0x134a('0x166'),'foreignKey':_0x134a('0x17a')});db[_0x134a('0x183')][_0x134a('0x14d')](db[_0x134a('0x15b')],{'as':'Contact','foreignKey':_0x134a('0x15d')});db[_0x134a('0x183')][_0x134a('0x14d')](db[_0x134a('0x4a')],{});db[_0x134a('0x183')][_0x134a('0x14d')](db[_0x134a('0x4c')],{});db[_0x134a('0x183')][_0x134a('0x14d')](db[_0x134a('0x10')],{});db[_0x134a('0x183')][_0x134a('0x14d')](db[_0x134a('0x4e')],{});db[_0x134a('0x50')][_0x134a('0x118')](db[_0x134a('0x161')],{'as':_0x134a('0x162'),'foreignKey':_0x134a('0x184'),'onDelete':'cascade'});db['SmsAccount'][_0x134a('0x118')](db[_0x134a('0x80')],{'as':_0x134a('0x176'),'foreignKey':_0x134a('0x184')});db[_0x134a('0x50')][_0x134a('0x118')](db[_0x134a('0x54')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0x134a('0x50')][_0x134a('0x118')](db[_0x134a('0x11f')],{'as':_0x134a('0x164')});db['SmsAccount']['hasMany'](db[_0x134a('0x51')],{'as':_0x134a('0x165')});db[_0x134a('0x50')]['belongsTo'](db[_0x134a('0xfb')],{'as':_0x134a('0x166'),'foreignKey':'ListId'});db['SmsAccount'][_0x134a('0x14d')](db[_0x134a('0x150')],{'as':_0x134a('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db['SmsAccount'][_0x134a('0x127')](db['User'],{'as':'Agents','through':_0x134a('0x140')});db[_0x134a('0x51')][_0x134a('0x14d')](db['User'],{'onDelete':_0x134a('0x170')});db[_0x134a('0x51')][_0x134a('0x14d')](db['SmsQueue'],{'onDelete':_0x134a('0x170')});db[_0x134a('0x51')][_0x134a('0x14d')](db['SmsAccount'],{'onDelete':'restrict'});db[_0x134a('0x51')][_0x134a('0x14d')](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x134a('0x51')][_0x134a('0x14d')](db['Tag'],{'onDelete':_0x134a('0x170'),'foreignKey':'TagId'});db[_0x134a('0x11f')][_0x134a('0x118')](db[_0x134a('0x54')],{'as':_0x134a('0x163'),'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x185')});db[_0x134a('0x11f')][_0x134a('0x14d')](db[_0x134a('0x50')],{'as':'Account','foreignKey':_0x134a('0x184')});db[_0x134a('0x11f')][_0x134a('0x14d')](db[_0x134a('0x15b')],{'as':_0x134a('0x15c'),'foreignKey':_0x134a('0x15d')});db[_0x134a('0x11f')][_0x134a('0x14d')](db[_0x134a('0x10')],{'as':'Owner','foreignKey':_0x134a('0x117')});db['SmsInteraction'][_0x134a('0x127')](db[_0x134a('0x16a')],{'through':_0x134a('0x186'),'as':'Tags'});db[_0x134a('0x11f')]['belongsToMany'](db['Tag'],{'through':_0x134a('0x186'),'as':_0x134a('0x17f')});db['SmsInteraction']['belongsToMany'](db[_0x134a('0x10')],{'as':_0x134a('0x180'),'through':_0x134a('0x130'),'foreignKey':_0x134a('0x185')});db[_0x134a('0x54')][_0x134a('0x14d')](db[_0x134a('0x10')],{'as':'User'});db['SmsMessage'][_0x134a('0x14d')](db[_0x134a('0x15b')],{'onDelete':_0x134a('0x116'),'as':'Contact'});db[_0x134a('0x54')][_0x134a('0x14d')](db[_0x134a('0x11f')],{'onDelete':_0x134a('0x116'),'as':_0x134a('0x187'),'foreignKey':_0x134a('0x185')});db[_0x134a('0x54')]['belongsTo'](db[_0x134a('0x50')],{'as':_0x134a('0x169'),'foreignKey':'SmsAccountId'});db[_0x134a('0x55')][_0x134a('0x127')](db[_0x134a('0x10')],{'as':_0x134a('0x154'),'through':_0x134a('0x34'),'foreignKey':'SmsQueueId'});db[_0x134a('0x55')][_0x134a('0x127')](db['Team'],{'through':'team_has_sms_queues','as':_0x134a('0x155')});db['OpenchannelAccount']['hasMany'](db['Disposition'],{'as':_0x134a('0x162'),'foreignKey':_0x134a('0x188'),'onDelete':_0x134a('0x116')});db[_0x134a('0x57')][_0x134a('0x118')](db[_0x134a('0x80')],{'as':_0x134a('0x176'),'foreignKey':_0x134a('0x188')});db[_0x134a('0x57')]['hasMany'](db[_0x134a('0x5b')],{'as':_0x134a('0x164'),'foreignKey':_0x134a('0x188')});db[_0x134a('0x57')]['hasMany'](db[_0x134a('0x189')],{'as':_0x134a('0x163'),'foreignKey':_0x134a('0x188')});db['OpenchannelAccount']['hasMany'](db[_0x134a('0x59')],{'as':_0x134a('0x165'),'foreignKey':_0x134a('0x188')});db[_0x134a('0x57')][_0x134a('0x14d')](db[_0x134a('0xfb')],{'as':'List','foreignKey':'ListId'});db[_0x134a('0x57')][_0x134a('0x14d')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x134a('0x152')});db['OpenchannelAccount']['belongsToMany'](db['User'],{'as':_0x134a('0x154'),'through':'user_has_openchannel_accounts'});db[_0x134a('0x59')][_0x134a('0x14d')](db[_0x134a('0x10')],{'onDelete':_0x134a('0x170')});db[_0x134a('0x59')]['belongsTo'](db[_0x134a('0x5e')],{'onDelete':_0x134a('0x170'),'foreignKey':_0x134a('0x18a')});db['OpenchannelApplication'][_0x134a('0x14d')](db[_0x134a('0x57')],{'onDelete':_0x134a('0x170'),'foreignKey':_0x134a('0x188')});db[_0x134a('0x59')][_0x134a('0x14d')](db[_0x134a('0x84')],{'onDelete':'restrict','foreignKey':_0x134a('0x14f')});db['OpenchannelApplication'][_0x134a('0x14d')](db[_0x134a('0x16a')],{'onDelete':_0x134a('0x170'),'foreignKey':'TagId'});db[_0x134a('0x5b')][_0x134a('0x118')](db[_0x134a('0x189')],{'as':_0x134a('0x163'),'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x18b')});db[_0x134a('0x5b')][_0x134a('0x14d')](db[_0x134a('0x57')],{'as':'Account','foreignKey':_0x134a('0x188')});db[_0x134a('0x5b')]['belongsTo'](db[_0x134a('0x15b')],{'as':_0x134a('0x15c'),'foreignKey':'ContactId'});db[_0x134a('0x5b')]['belongsTo'](db['User'],{'as':_0x134a('0x17c'),'foreignKey':_0x134a('0x117')});db['OpenchannelInteraction']['belongsToMany'](db[_0x134a('0x16a')],{'through':_0x134a('0x18c'),'as':_0x134a('0x17e')});db[_0x134a('0x5b')][_0x134a('0x127')](db[_0x134a('0x16a')],{'through':'openchannel_interaction_has_tags','as':_0x134a('0x17f')});db[_0x134a('0x5b')]['belongsToMany'](db[_0x134a('0x10')],{'as':_0x134a('0x180'),'through':_0x134a('0x18d'),'foreignKey':_0x134a('0x18b')});db[_0x134a('0x189')][_0x134a('0x14d')](db[_0x134a('0x10')],{'onDelete':_0x134a('0x116'),'as':_0x134a('0x10')});db['OpenchannelMessage'][_0x134a('0x14d')](db['CmContact'],{'onDelete':_0x134a('0x116'),'as':_0x134a('0x15c')});db[_0x134a('0x189')]['belongsTo'](db[_0x134a('0x5b')],{'onDelete':_0x134a('0x116'),'as':_0x134a('0x187'),'foreignKey':'OpenchannelInteractionId'});db[_0x134a('0x189')]['belongsTo'](db[_0x134a('0xee')],{'as':'Attachment','foreignKey':_0x134a('0x181')});db['OpenchannelMessage'][_0x134a('0x14d')](db['OpenchannelAccount'],{'as':_0x134a('0x169'),'foreignKey':_0x134a('0x188')});db[_0x134a('0x5e')][_0x134a('0x127')](db[_0x134a('0x10')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0x134a('0x18a')});db[_0x134a('0x5e')]['belongsToMany'](db[_0x134a('0xe6')],{'through':_0x134a('0x18e'),'as':_0x134a('0x155')});db[_0x134a('0x5f')][_0x134a('0x118')](db[_0x134a('0x161')],{'as':_0x134a('0x162'),'foreignKey':_0x134a('0x16e'),'onDelete':_0x134a('0x116')});db[_0x134a('0x5f')][_0x134a('0x118')](db['CannedAnswer'],{'as':_0x134a('0x176'),'foreignKey':'ChatWebsiteId'});db[_0x134a('0x5f')][_0x134a('0x118')](db['ChatProactiveAction'],{'as':_0x134a('0x18f')});db['ChatWebsite'][_0x134a('0x118')](db['ChatInteraction'],{'as':_0x134a('0x164')});db[_0x134a('0x5f')][_0x134a('0x118')](db[_0x134a('0x63')],{'as':_0x134a('0x165')});db['ChatWebsite'][_0x134a('0x118')](db[_0x134a('0x66')],{'as':'Messages'});db[_0x134a('0x5f')][_0x134a('0x14d')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x134a('0x5f')][_0x134a('0x14d')](db[_0x134a('0x84')],{'as':'Interval','foreignKey':_0x134a('0x14f')});db[_0x134a('0x5f')][_0x134a('0x14d')](db['MailAccount'],{'as':_0x134a('0x3c'),'foreignKey':_0x134a('0x15f')});db[_0x134a('0x5f')][_0x134a('0x14d')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x134a('0x152')});db[_0x134a('0x5f')][_0x134a('0x127')](db[_0x134a('0x10')],{'as':_0x134a('0x154'),'through':_0x134a('0x190')});db[_0x134a('0x61')][_0x134a('0x14d')](db[_0x134a('0x57')],{});db['OpenchannelQueueReport'][_0x134a('0x14d')](db[_0x134a('0xfb')],{'as':'List','foreignKey':_0x134a('0x17a')});db[_0x134a('0x61')][_0x134a('0x14d')](db[_0x134a('0x15b')],{'as':_0x134a('0x15c'),'foreignKey':_0x134a('0x15d')});db[_0x134a('0x61')][_0x134a('0x14d')](db[_0x134a('0x5b')],{});db[_0x134a('0x61')]['belongsTo'](db[_0x134a('0x189')],{});db['OpenchannelQueueReport'][_0x134a('0x14d')](db[_0x134a('0x10')],{});db[_0x134a('0x61')][_0x134a('0x14d')](db[_0x134a('0x5e')],{});db[_0x134a('0x63')][_0x134a('0x14d')](db[_0x134a('0x10')],{'as':_0x134a('0x191'),'foreignKey':_0x134a('0x117'),'onDelete':_0x134a('0x170')});db[_0x134a('0x63')][_0x134a('0x14d')](db['ChatQueue'],{'as':_0x134a('0x192'),'foreignKey':_0x134a('0x193'),'onDelete':_0x134a('0x170')});db[_0x134a('0x63')][_0x134a('0x14d')](db[_0x134a('0x5f')],{'as':_0x134a('0x194'),'foreignKey':_0x134a('0x16e'),'onDelete':_0x134a('0x170')});db['ChatApplication'][_0x134a('0x14d')](db[_0x134a('0x16a')],{'onDelete':_0x134a('0x170'),'foreignKey':_0x134a('0x171')});db[_0x134a('0x64')][_0x134a('0x118')](db[_0x134a('0x66')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x134a('0x195')});db[_0x134a('0x64')]['belongsTo'](db[_0x134a('0x5f')],{'as':'Account','foreignKey':_0x134a('0x16e')});db[_0x134a('0x64')][_0x134a('0x14d')](db[_0x134a('0x15b')],{'as':_0x134a('0x15c'),'foreignKey':_0x134a('0x15d')});db[_0x134a('0x64')][_0x134a('0x14d')](db[_0x134a('0x10')],{'as':'Owner','foreignKey':_0x134a('0x117')});db['ChatInteraction']['belongsToMany'](db[_0x134a('0x16a')],{'through':'chat_interaction_has_tags','as':_0x134a('0x17e')});db[_0x134a('0x64')][_0x134a('0x127')](db[_0x134a('0x16a')],{'through':_0x134a('0x196'),'as':'ThroughTags'});db[_0x134a('0x64')][_0x134a('0x127')](db[_0x134a('0x10')],{'as':_0x134a('0x180'),'through':_0x134a('0x12d'),'foreignKey':'ChatInteractionId'});db[_0x134a('0x66')][_0x134a('0x14d')](db[_0x134a('0x10')],{'onDelete':_0x134a('0x116'),'as':_0x134a('0x10')});db[_0x134a('0x66')]['belongsTo'](db['CmContact'],{'onDelete':_0x134a('0x116'),'as':_0x134a('0x15c'),'foreignKey':_0x134a('0x15d')});db[_0x134a('0x66')]['belongsTo'](db[_0x134a('0x64')],{'onDelete':_0x134a('0x116'),'as':_0x134a('0x187'),'foreignKey':_0x134a('0x195')});db[_0x134a('0x66')][_0x134a('0x14d')](db[_0x134a('0xee')],{'as':'Attachment','foreignKey':'AttachmentId'});db['ChatMessage'][_0x134a('0x14d')](db[_0x134a('0x5f')],{'as':_0x134a('0x169'),'foreignKey':_0x134a('0x16e')});db[_0x134a('0x68')][_0x134a('0x118')](db[_0x134a('0xee')],{'as':_0x134a('0x16d'),'foreignKey':_0x134a('0x16f'),'onDelete':_0x134a('0x116'),'hooks':!![]});db[_0x134a('0x68')]['belongsTo'](db[_0x134a('0x15b')],{'onDelete':'cascade','as':_0x134a('0x15c'),'foreignKey':_0x134a('0x15d')});db[_0x134a('0x68')][_0x134a('0x14d')](db['ChatWebsite'],{'as':_0x134a('0x169'),'foreignKey':_0x134a('0x16e')});db[_0x134a('0x6a')][_0x134a('0x127')](db[_0x134a('0x10')],{'as':_0x134a('0x154'),'through':_0x134a('0x30'),'hooks':!![]});db[_0x134a('0x6a')][_0x134a('0x127')](db[_0x134a('0xe6')],{'through':_0x134a('0x197'),'as':'Teams'});db[_0x134a('0x6c')]['hasMany'](db[_0x134a('0xd2')],{'as':_0x134a('0x163'),'foreignKey':_0x134a('0x198'),'onDelete':_0x134a('0x116')});db[_0x134a('0x6c')]['belongsToMany'](db[_0x134a('0x10')],{'as':_0x134a('0x149'),'through':'chat_group_has_users'});db[_0x134a('0x6e')][_0x134a('0x14d')](db[_0x134a('0x5f')],{'as':_0x134a('0x194'),'foreignKey':_0x134a('0x16e')});db['CmCompany'][_0x134a('0x118')](db['CmContact'],{'as':_0x134a('0x199'),'foreignKey':_0x134a('0x19a')});db[_0x134a('0x15b')][_0x134a('0x118')](db[_0x134a('0x72')],{'as':'Hoppers','foreignKey':_0x134a('0x15d')});db[_0x134a('0x15b')][_0x134a('0x118')](db['CmHopperFinal'],{'as':_0x134a('0x11d'),'foreignKey':'ContactId'});db['CmContact'][_0x134a('0x118')](db[_0x134a('0x76')],{'as':_0x134a('0x14b'),'foreignKey':_0x134a('0x15d')});db['CmContact']['hasMany'](db[_0x134a('0x78')],{'as':_0x134a('0x78'),'foreignKey':_0x134a('0x15d')});db[_0x134a('0x15b')]['hasMany'](db[_0x134a('0xd6')],{'as':_0x134a('0x19b'),'foreignKey':_0x134a('0x15d')});db[_0x134a('0x15b')]['hasMany'](db[_0x134a('0x5b')],{'as':_0x134a('0x131'),'foreignKey':_0x134a('0x15d'),'onDelete':_0x134a('0x170')});db['CmContact'][_0x134a('0x118')](db[_0x134a('0x64')],{'as':'ChatInteractions','foreignKey':_0x134a('0x15d'),'onDelete':_0x134a('0x170')});db[_0x134a('0x15b')]['hasMany'](db[_0x134a('0x11f')],{'as':_0x134a('0x12f'),'foreignKey':_0x134a('0x15d'),'onDelete':_0x134a('0x170')});db[_0x134a('0x15b')][_0x134a('0x118')](db[_0x134a('0x4a')],{'as':_0x134a('0x120'),'foreignKey':_0x134a('0x15d'),'onDelete':_0x134a('0x170')});db['CmContact'][_0x134a('0x118')](db[_0x134a('0x121')],{'as':_0x134a('0x122'),'foreignKey':_0x134a('0x15d'),'onDelete':_0x134a('0x170')});db[_0x134a('0x15b')][_0x134a('0x14d')](db[_0x134a('0x19c')],{'as':_0x134a('0x19d'),'foreignKey':_0x134a('0x19a')});db[_0x134a('0x15b')][_0x134a('0x14d')](db['CmList'],{'as':_0x134a('0x166'),'foreignKey':_0x134a('0x17a'),'onDelete':_0x134a('0x116')});db[_0x134a('0x15b')][_0x134a('0x127')](db['User'],{'as':_0x134a('0x180'),'through':_0x134a('0x128')});db['CmContact'][_0x134a('0x127')](db[_0x134a('0x16a')],{'as':_0x134a('0x17e'),'through':_0x134a('0x19e')});db['CmContact'][_0x134a('0x127')](db['Tag'],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0x134a('0x72')][_0x134a('0x14d')](db[_0x134a('0x15b')],{'as':_0x134a('0x15c'),'foreignKey':_0x134a('0x15d'),'onDelete':_0x134a('0x116')});db[_0x134a('0x72')][_0x134a('0x14d')](db['CmList'],{'as':_0x134a('0x166'),'foreignKey':'ListId','onDelete':_0x134a('0x116')});db[_0x134a('0x72')]['belongsTo'](db[_0x134a('0x10')],{'as':_0x134a('0x191'),'foreignKey':_0x134a('0x117')});db[_0x134a('0x72')]['belongsTo'](db[_0x134a('0x1a')],{'as':_0x134a('0x192'),'foreignKey':_0x134a('0x14a'),'onDelete':_0x134a('0x116')});db['CmHopper']['belongsTo'](db['Campaign'],{'as':_0x134a('0xea'),'foreignKey':_0x134a('0x19f'),'onDelete':'cascade'});db[_0x134a('0x72')][_0x134a('0x14d')](db['User'],{'as':_0x134a('0x17c'),'foreignKey':'OwnerId'});db[_0x134a('0x74')][_0x134a('0x14d')](db[_0x134a('0x15b')],{'as':_0x134a('0x15c'),'foreignKey':_0x134a('0x15d'),'onDelete':_0x134a('0x116')});db[_0x134a('0x74')][_0x134a('0x14d')](db[_0x134a('0xfb')],{'as':_0x134a('0x166'),'foreignKey':_0x134a('0x17a'),'onDelete':'cascade'});db[_0x134a('0x74')][_0x134a('0x14d')](db[_0x134a('0x1a')],{'as':_0x134a('0x192'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x134a('0x74')][_0x134a('0x14d')](db[_0x134a('0xea')],{'as':'Campaign','foreignKey':_0x134a('0x19f'),'onDelete':_0x134a('0x116')});db[_0x134a('0x7e')][_0x134a('0x118')](db[_0x134a('0x82')],{'as':{'plural':_0x134a('0x1a0'),'singular':_0x134a('0x1a1')},'foreignKey':_0x134a('0x1a2'),'onDelete':'cascade','hooks':!![]});db['Automation']['hasMany'](db[_0x134a('0x82')],{'as':{'plural':_0x134a('0x1a3'),'singular':_0x134a('0x1a4')},'foreignKey':'AutomationAnyId','onDelete':_0x134a('0x116'),'hooks':!![]});db['Automation']['hasMany'](db['Action'],{'as':_0x134a('0x1a5'),'foreignKey':_0x134a('0x1a6'),'onDelete':_0x134a('0x116'),'hooks':!![]});db[_0x134a('0x161')][_0x134a('0x118')](db['Disposition'],{'as':_0x134a('0x162'),'foreignKey':_0x134a('0x1a7'),'onDelete':_0x134a('0x116')});db[_0x134a('0x84')][_0x134a('0x118')](db['Interval'],{'as':_0x134a('0x1a8'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db[_0x134a('0x84')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0x134a('0x14f'),'onDelete':_0x134a('0x170')});db[_0x134a('0x84')]['hasMany'](db[_0x134a('0x42')],{'as':_0x134a('0x1a9'),'foreignKey':_0x134a('0x14f')});db[_0x134a('0x84')][_0x134a('0x118')](db[_0x134a('0x63')],{'as':'ChatApplications','foreignKey':'IntervalId'});db[_0x134a('0x84')][_0x134a('0x118')](db['FaxApplication'],{'as':_0x134a('0x1aa'),'foreignKey':_0x134a('0x14f')});db[_0x134a('0x84')][_0x134a('0x118')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x134a('0x14f')});db[_0x134a('0x8a')]['belongsTo'](db[_0x134a('0x3c')],{});db['Schedule'][_0x134a('0x14d')](db['AnalyticDefaultReport'],{'foreignKey':_0x134a('0x1ab')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x134a('0x1ac')});db[_0x134a('0x8c')]['belongsToMany'](db[_0x134a('0x147')],{'as':'Mohs','through':_0x134a('0x148'),'onDelete':_0x134a('0x170')});db[_0x134a('0x16a')][_0x134a('0x127')](db[_0x134a('0x15b')],{'through':_0x134a('0x19e')});db['Tag'][_0x134a('0x127')](db['ChatInteraction'],{'through':_0x134a('0x196')});db[_0x134a('0x16a')][_0x134a('0x127')](db['MailInteraction'],{'through':_0x134a('0x16b')});db[_0x134a('0x16a')][_0x134a('0x127')](db[_0x134a('0x11f')],{'through':_0x134a('0x186')});db[_0x134a('0x16a')][_0x134a('0x127')](db['FaxInteraction'],{'through':_0x134a('0x17d')});db[_0x134a('0x16a')]['belongsToMany'](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0x134a('0x16a')]['belongsToMany'](db[_0x134a('0x108')],{'through':_0x134a('0x1ad')});db[_0x134a('0x91')][_0x134a('0x118')](db[_0x134a('0x82')],{'as':{'plural':'AllConditions','singular':_0x134a('0x1ae')},'foreignKey':_0x134a('0x1af'),'onDelete':_0x134a('0x116'),'hooks':!![]});db[_0x134a('0x91')]['hasMany'](db[_0x134a('0x82')],{'as':{'plural':_0x134a('0x1b0'),'singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0x134a('0x91')][_0x134a('0x118')](db['Action'],{'as':_0x134a('0x1a5'),'foreignKey':_0x134a('0x1b1'),'onDelete':_0x134a('0x116'),'hooks':!![]});db[_0x134a('0x95')][_0x134a('0x118')](db[_0x134a('0x9c')],{'as':_0x134a('0x1b2'),'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x1ac'),'hooks':!![]});db['AnalyticDefaultReport'][_0x134a('0x118')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x134a('0x116'),'foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0x134a('0x118')](db[_0x134a('0x9c')],{'as':'Fields','onDelete':_0x134a('0x116'),'foreignKey':'MetricId'});db[_0x134a('0x9c')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0x134a('0x1b3')});db['SalesforceAccount'][_0x134a('0x118')](db[_0x134a('0xa2')],{'as':_0x134a('0x1b4'),'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x1b5')});db[_0x134a('0xa2')]['hasMany'](db[_0x134a('0xa4')],{'as':_0x134a('0x1b6'),'onDelete':'cascade','foreignKey':_0x134a('0x1b7')});db['SalesforceConfiguration'][_0x134a('0x118')](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x1b8')});db['SalesforceConfiguration']['hasMany'](db[_0x134a('0xa4')],{'as':_0x134a('0x1b2'),'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x1b9')});db[_0x134a('0xa2')][_0x134a('0x14d')](db[_0x134a('0xa0')],{'as':'Account','foreignKey':_0x134a('0x1b5')});db[_0x134a('0xa4')][_0x134a('0x118')](db['SalesforceField'],{'as':'Subject','foreignKey':_0x134a('0x1b7')});db[_0x134a('0xa4')]['hasMany'](db['SalesforceField'],{'as':_0x134a('0x1ba'),'foreignKey':_0x134a('0x1b8')});db[_0x134a('0xa4')][_0x134a('0x118')](db['SalesforceField'],{'as':'Field','foreignKey':_0x134a('0x1b9')});db[_0x134a('0xa4')][_0x134a('0x14d')](db[_0x134a('0x92')],{'as':'Variable','foreignKey':_0x134a('0x1bb')});db[_0x134a('0x1bc')][_0x134a('0x118')](db[_0x134a('0xa6')],{'as':_0x134a('0x1b4'),'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x1b5')});db[_0x134a('0xa6')]['hasMany'](db[_0x134a('0xa7')],{'as':_0x134a('0x1b6'),'onDelete':_0x134a('0x116'),'foreignKey':'SubjectId'});db[_0x134a('0xa6')][_0x134a('0x118')](db[_0x134a('0xa7')],{'as':_0x134a('0x1bd'),'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x1b8')});db['SugarcrmConfiguration'][_0x134a('0x118')](db[_0x134a('0xa7')],{'as':_0x134a('0x1b2'),'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x1b9')});db[_0x134a('0xa6')][_0x134a('0x14d')](db[_0x134a('0x1bc')],{'as':'Account','foreignKey':_0x134a('0x1b5')});db[_0x134a('0xa7')][_0x134a('0x118')](db[_0x134a('0xa7')],{'as':'Subject','foreignKey':_0x134a('0x1b7')});db[_0x134a('0xa7')][_0x134a('0x118')](db[_0x134a('0xa7')],{'as':_0x134a('0x1ba'),'foreignKey':_0x134a('0x1b8')});db['SugarcrmField']['hasMany'](db[_0x134a('0xa7')],{'as':'Field','foreignKey':_0x134a('0x1b9')});db[_0x134a('0xa7')][_0x134a('0x14d')](db[_0x134a('0x92')],{'as':_0x134a('0x92'),'foreignKey':_0x134a('0x1bb')});db[_0x134a('0xa8')][_0x134a('0x118')](db[_0x134a('0xaa')],{'as':'Configurations','onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x1b5')});db[_0x134a('0xaa')][_0x134a('0x118')](db['DeskField'],{'as':_0x134a('0x1b6'),'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x1b7')});db[_0x134a('0xaa')][_0x134a('0x118')](db[_0x134a('0xac')],{'as':_0x134a('0x1bd'),'onDelete':_0x134a('0x116'),'foreignKey':'DescriptionId'});db['DeskConfiguration'][_0x134a('0x118')](db[_0x134a('0xac')],{'as':_0x134a('0x1b2'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x134a('0xaa')][_0x134a('0x14d')](db['DeskAccount'],{'as':'Account','foreignKey':_0x134a('0x1b5')});db[_0x134a('0xaa')]['belongsToMany'](db[_0x134a('0x16a')],{'through':_0x134a('0x1be')});db[_0x134a('0xac')][_0x134a('0x118')](db[_0x134a('0xac')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x134a('0xac')][_0x134a('0x118')](db[_0x134a('0xac')],{'as':_0x134a('0x1ba'),'foreignKey':_0x134a('0x1b8')});db[_0x134a('0xac')][_0x134a('0x118')](db[_0x134a('0xac')],{'as':_0x134a('0x1bf'),'foreignKey':_0x134a('0x1b9')});db[_0x134a('0xac')][_0x134a('0x14d')](db[_0x134a('0x92')],{'as':_0x134a('0x92'),'foreignKey':_0x134a('0x1bb')});db[_0x134a('0xae')][_0x134a('0x118')](db['ZohoConfiguration'],{'as':_0x134a('0x1b4'),'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x1b5')});db[_0x134a('0xb0')][_0x134a('0x118')](db['ZohoField'],{'as':_0x134a('0x1b6'),'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x1b7')});db[_0x134a('0xb0')]['hasMany'](db['ZohoField'],{'as':_0x134a('0x1bd'),'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x1b8')});db['ZohoConfiguration'][_0x134a('0x118')](db[_0x134a('0xb2')],{'as':'Fields','onDelete':_0x134a('0x116'),'foreignKey':'FieldId'});db[_0x134a('0xb0')][_0x134a('0x14d')](db[_0x134a('0xae')],{'as':_0x134a('0x169'),'foreignKey':_0x134a('0x1b5')});db[_0x134a('0xb2')][_0x134a('0x118')](db[_0x134a('0xb2')],{'as':'Subject','foreignKey':_0x134a('0x1b7')});db[_0x134a('0xb2')][_0x134a('0x118')](db[_0x134a('0xb2')],{'as':_0x134a('0x1ba'),'foreignKey':'DescriptionId'});db[_0x134a('0xb2')][_0x134a('0x118')](db[_0x134a('0xb2')],{'as':_0x134a('0x1bf'),'foreignKey':'FieldId'});db['ZohoField'][_0x134a('0x14d')](db[_0x134a('0x92')],{'as':'Variable','foreignKey':_0x134a('0x1bb')});db[_0x134a('0xb3')][_0x134a('0x118')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':_0x134a('0x116'),'foreignKey':'AccountId'});db[_0x134a('0x1c0')][_0x134a('0x118')](db['ZendeskField'],{'as':'Subjects','foreignKey':'SubjectId'});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0x134a('0x1bd'),'foreignKey':_0x134a('0x1b8')});db[_0x134a('0x1c0')][_0x134a('0x118')](db[_0x134a('0xb5')],{'as':_0x134a('0x1b2'),'foreignKey':'FieldId'});db[_0x134a('0x1c0')][_0x134a('0x14d')](db[_0x134a('0xb3')],{'as':_0x134a('0x169'),'foreignKey':_0x134a('0x1b5')});db[_0x134a('0x1c0')][_0x134a('0x127')](db[_0x134a('0x16a')],{'through':'int_zendesk_configuration_has_tags'});db[_0x134a('0xb5')][_0x134a('0x118')](db[_0x134a('0xb5')],{'as':'Subject','foreignKey':_0x134a('0x1b7')});db[_0x134a('0xb5')]['hasMany'](db['ZendeskField'],{'as':_0x134a('0x1ba'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0x134a('0x118')](db[_0x134a('0xb5')],{'as':_0x134a('0x1bf'),'foreignKey':_0x134a('0x1b9')});db[_0x134a('0xb5')]['belongsTo'](db['Variable'],{'as':_0x134a('0x92'),'foreignKey':'VariableId'});db['FreshdeskAccount']['hasMany'](db[_0x134a('0xb9')],{'as':_0x134a('0x1b4'),'onDelete':_0x134a('0x116'),'foreignKey':'AccountId'});db[_0x134a('0xb9')][_0x134a('0x118')](db[_0x134a('0x1c1')],{'as':_0x134a('0x1b6'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x134a('0xb9')][_0x134a('0x118')](db[_0x134a('0x1c1')],{'as':_0x134a('0x1bd'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x134a('0xb9')][_0x134a('0x118')](db[_0x134a('0x1c1')],{'as':_0x134a('0x1b2'),'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x1b9')});db[_0x134a('0xb9')][_0x134a('0x14d')](db[_0x134a('0xb7')],{'as':_0x134a('0x169'),'foreignKey':'AccountId'});db[_0x134a('0xb9')][_0x134a('0x127')](db[_0x134a('0x16a')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x134a('0x1c1')]['hasMany'](db['FreshdeskField'],{'as':_0x134a('0x1c2'),'foreignKey':_0x134a('0x1b7')});db[_0x134a('0x1c1')][_0x134a('0x118')](db[_0x134a('0x1c1')],{'as':_0x134a('0x1ba'),'foreignKey':_0x134a('0x1b8')});db[_0x134a('0x1c1')][_0x134a('0x118')](db[_0x134a('0x1c1')],{'as':'Field','foreignKey':_0x134a('0x1b9')});db[_0x134a('0x1c1')]['belongsTo'](db[_0x134a('0x92')],{'as':_0x134a('0x92'),'foreignKey':_0x134a('0x1bb')});db[_0x134a('0xbb')][_0x134a('0x118')](db[_0x134a('0xbd')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x134a('0x1b5')});db[_0x134a('0xbd')]['hasMany'](db[_0x134a('0x1c3')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x134a('0xbd')]['hasMany'](db[_0x134a('0x1c3')],{'as':_0x134a('0x1bd'),'foreignKey':_0x134a('0x1b8')});db[_0x134a('0xbd')][_0x134a('0x118')](db[_0x134a('0x1c3')],{'as':_0x134a('0x1b2'),'foreignKey':'FieldId'});db[_0x134a('0xbd')]['belongsTo'](db[_0x134a('0xbb')],{'as':'Account','foreignKey':_0x134a('0x1b5')});db[_0x134a('0x1c3')][_0x134a('0x118')](db[_0x134a('0x1c3')],{'as':_0x134a('0x1c2'),'foreignKey':'SubjectId'});db[_0x134a('0x1c3')][_0x134a('0x118')](db[_0x134a('0x1c3')],{'as':_0x134a('0x1ba'),'foreignKey':_0x134a('0x1b8')});db[_0x134a('0x1c3')][_0x134a('0x118')](db[_0x134a('0x1c3')],{'as':_0x134a('0x1bf'),'foreignKey':_0x134a('0x1b9')});db['VtigerField'][_0x134a('0x14d')](db[_0x134a('0x92')],{'as':'Variable','foreignKey':_0x134a('0x1bb')});db[_0x134a('0xbf')][_0x134a('0x118')](db[_0x134a('0xc1')],{'as':_0x134a('0x1b4'),'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x1b5')});db[_0x134a('0xc1')][_0x134a('0x118')](db[_0x134a('0xc3')],{'as':_0x134a('0x1b6'),'foreignKey':_0x134a('0x1b7')});db[_0x134a('0xc1')][_0x134a('0x118')](db['ServicenowField'],{'as':_0x134a('0x1bd'),'foreignKey':'DescriptionId'});db[_0x134a('0xc1')][_0x134a('0x118')](db[_0x134a('0xc3')],{'as':'Fields','foreignKey':'FieldId'});db['ServicenowConfiguration'][_0x134a('0x14d')](db[_0x134a('0xbf')],{'as':_0x134a('0x169'),'foreignKey':_0x134a('0x1b5')});db[_0x134a('0xc3')][_0x134a('0x118')](db['ServicenowField'],{'as':_0x134a('0x1c2'),'foreignKey':_0x134a('0x1b7')});db[_0x134a('0xc3')][_0x134a('0x118')](db[_0x134a('0xc3')],{'as':_0x134a('0x1ba'),'foreignKey':_0x134a('0x1b8')});db[_0x134a('0xc3')][_0x134a('0x118')](db[_0x134a('0xc3')],{'as':_0x134a('0x1bf'),'foreignKey':'FieldId'});db[_0x134a('0xc3')]['belongsTo'](db[_0x134a('0x92')],{'as':_0x134a('0x92'),'foreignKey':_0x134a('0x1bb')});db[_0x134a('0xc5')]['hasMany'](db[_0x134a('0xc7')],{'as':_0x134a('0x1b4'),'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x1b5')});db['Dynamics365Configuration'][_0x134a('0x118')](db[_0x134a('0x1c4')],{'as':_0x134a('0x1b6'),'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x1b7')});db['Dynamics365Configuration'][_0x134a('0x118')](db[_0x134a('0x1c4')],{'as':_0x134a('0x1bd'),'onDelete':'cascade','foreignKey':_0x134a('0x1b8')});db[_0x134a('0xc7')][_0x134a('0x118')](db['Dynamics365Field'],{'as':_0x134a('0x1b2'),'onDelete':_0x134a('0x116'),'foreignKey':'FieldId'});db[_0x134a('0xc7')][_0x134a('0x14d')](db[_0x134a('0xc5')],{'as':_0x134a('0x169'),'foreignKey':_0x134a('0x1b5')});db['Dynamics365Field'][_0x134a('0x118')](db[_0x134a('0x1c4')],{'as':'Subject','foreignKey':'SubjectId'});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':_0x134a('0x1ba'),'foreignKey':_0x134a('0x1b8')});db[_0x134a('0x1c4')][_0x134a('0x118')](db[_0x134a('0x1c4')],{'as':'Field','foreignKey':_0x134a('0x1b9')});db[_0x134a('0x1c4')][_0x134a('0x14d')](db['Variable'],{'as':'Variable','foreignKey':_0x134a('0x1bb')});db[_0x134a('0xc8')][_0x134a('0x118')](db['FreshsalesConfiguration'],{'as':_0x134a('0x1b4'),'onDelete':_0x134a('0x116'),'foreignKey':'AccountId'});db[_0x134a('0xca')]['hasMany'](db[_0x134a('0xcc')],{'as':_0x134a('0x1b6'),'foreignKey':_0x134a('0x1b7')});db[_0x134a('0xca')][_0x134a('0x118')](db['FreshsalesField'],{'as':_0x134a('0x1bd'),'foreignKey':_0x134a('0x1b8')});db[_0x134a('0xca')][_0x134a('0x118')](db['FreshsalesField'],{'as':_0x134a('0x1b2'),'foreignKey':_0x134a('0x1b9')});db['FreshsalesConfiguration'][_0x134a('0x14d')](db[_0x134a('0xc8')],{'as':'Account','foreignKey':_0x134a('0x1b5')});db[_0x134a('0xcc')][_0x134a('0x118')](db['FreshsalesField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x134a('0xcc')][_0x134a('0x118')](db[_0x134a('0xcc')],{'as':_0x134a('0x1ba'),'foreignKey':_0x134a('0x1b8')});db[_0x134a('0xcc')][_0x134a('0x118')](db[_0x134a('0xcc')],{'as':_0x134a('0x1bf'),'foreignKey':_0x134a('0x1b9')});db['FreshsalesField'][_0x134a('0x14d')](db[_0x134a('0x92')],{'as':'Variable','foreignKey':_0x134a('0x1bb')});db[_0x134a('0xd0')][_0x134a('0x14d')](db[_0x134a('0x5f')],{});db['ChatQueueReport'][_0x134a('0x14d')](db[_0x134a('0xfb')],{'as':_0x134a('0x166'),'foreignKey':_0x134a('0x17a')});db['ChatQueueReport']['belongsTo'](db[_0x134a('0x15b')],{'as':_0x134a('0x15c'),'foreignKey':_0x134a('0x15d')});db['ChatQueueReport'][_0x134a('0x14d')](db[_0x134a('0x64')],{});db[_0x134a('0xd0')][_0x134a('0x14d')](db[_0x134a('0x66')],{});db[_0x134a('0xd0')][_0x134a('0x14d')](db[_0x134a('0x10')],{});db['ChatQueueReport'][_0x134a('0x14d')](db[_0x134a('0x6a')],{});db['ChatInternalMessage']['belongsTo'](db[_0x134a('0x10')],{'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x1c5')});db[_0x134a('0xd2')][_0x134a('0x14d')](db[_0x134a('0x10')],{'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x1c6')});db[_0x134a('0xd6')][_0x134a('0x118')](db[_0x134a('0x1c7')],{'foreignKey':_0x134a('0x1c8'),'onDelete':_0x134a('0x116')});db[_0x134a('0xd6')][_0x134a('0x118')](db[_0x134a('0xd4')],{'foreignKey':_0x134a('0x1c8'),'onDelete':'cascade'});db[_0x134a('0xd8')][_0x134a('0x14d')](db['SmsAccount'],{});db['SmsQueueReport']['belongsTo'](db[_0x134a('0xfb')],{'as':_0x134a('0x166'),'foreignKey':'ListId'});db[_0x134a('0xd8')][_0x134a('0x14d')](db[_0x134a('0x15b')],{'as':_0x134a('0x15c'),'foreignKey':_0x134a('0x15d')});db[_0x134a('0xd8')]['belongsTo'](db[_0x134a('0x11f')],{});db['SmsQueueReport'][_0x134a('0x14d')](db[_0x134a('0x54')],{});db[_0x134a('0xd8')]['belongsTo'](db[_0x134a('0x10')],{});db['SmsQueueReport'][_0x134a('0x14d')](db[_0x134a('0x55')],{});db[_0x134a('0xde')][_0x134a('0x118')](db[_0x134a('0xd6')],{'foreignKey':_0x134a('0x1c9')});db['JscriptyProject']['hasMany'](db[_0x134a('0x1c7')],{'foreignKey':_0x134a('0x1c9')});db['JscriptyProject'][_0x134a('0x118')](db[_0x134a('0xd4')],{'foreignKey':'ProjectId'});db['SquareProject'][_0x134a('0x127')](db[_0x134a('0x10')],{'as':_0x134a('0x180'),'through':'user_has_square_projects'});db[_0x134a('0xe6')][_0x134a('0x127')](db[_0x134a('0x10')],{'as':_0x134a('0x154'),'through':_0x134a('0x12b')});db[_0x134a('0xe6')][_0x134a('0x127')](db[_0x134a('0x1a')],{'through':_0x134a('0x112'),'as':_0x134a('0x133')});db['Team'][_0x134a('0x127')](db[_0x134a('0x134')],{'through':'team_has_mail_queues','as':_0x134a('0x135')});db[_0x134a('0xe6')]['belongsToMany'](db['ChatQueue'],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0x134a('0xe6')]['belongsToMany'](db[_0x134a('0x4e')],{'through':_0x134a('0x182'),'as':_0x134a('0x138')});db[_0x134a('0xe6')][_0x134a('0x127')](db[_0x134a('0x55')],{'through':_0x134a('0x1ca'),'as':_0x134a('0x139')});db[_0x134a('0xe6')][_0x134a('0x127')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':_0x134a('0x1cb')});db[_0x134a('0xe6')][_0x134a('0x127')](db[_0x134a('0x13a')],{'through':'team_has_whatsapp_queues','as':_0x134a('0x13b')});db[_0x134a('0xea')][_0x134a('0x118')](db[_0x134a('0x72')],{'as':_0x134a('0x1cc'),'foreignKey':'CampaignId'});db['Campaign'][_0x134a('0x118')](db[_0x134a('0x75')],{'as':_0x134a('0x11d'),'foreignKey':'CampaignId'});db[_0x134a('0xea')][_0x134a('0x118')](db[_0x134a('0x76')],{'as':_0x134a('0x14b'),'foreignKey':_0x134a('0x19f')});db[_0x134a('0xea')][_0x134a('0x118')](db[_0x134a('0x74')],{'as':_0x134a('0x14c'),'foreignKey':_0x134a('0x19f')});db[_0x134a('0xea')]['belongsTo'](db[_0x134a('0x29')],{'as':_0x134a('0x29'),'foreignKey':_0x134a('0x1cd')});db[_0x134a('0xea')][_0x134a('0x14d')](db[_0x134a('0x29')],{'as':_0x134a('0x1ce'),'foreignKey':_0x134a('0x14e')});db[_0x134a('0xea')][_0x134a('0x14d')](db[_0x134a('0x84')],{'as':_0x134a('0x84'),'foreignKey':'IntervalId'});db[_0x134a('0xea')]['belongsTo'](db[_0x134a('0xe2')],{'as':'SquareProject','foreignKey':_0x134a('0x1cf')});db[_0x134a('0xea')][_0x134a('0x127')](db['CmList'],{'as':_0x134a('0x129'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0x134a('0x127')](db[_0x134a('0xfb')],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db['Attachment'][_0x134a('0x14d')](db[_0x134a('0x68')],{'as':_0x134a('0x68'),'foreignKey':_0x134a('0x16f')});db['MailTransferReport'][_0x134a('0x14d')](db[_0x134a('0x40')],{});db[_0x134a('0xf2')][_0x134a('0x14d')](db['MailInteraction'],{});db[_0x134a('0xf2')][_0x134a('0x14d')](db[_0x134a('0x3c')],{'foreignKey':_0x134a('0x1d0'),'as':_0x134a('0x1d1')});db['MailTransferReport'][_0x134a('0x14d')](db[_0x134a('0x10')],{'foreignKey':_0x134a('0x1d2'),'as':_0x134a('0x1d3')});db[_0x134a('0xf2')]['belongsTo'](db[_0x134a('0x10')],{'foreignKey':_0x134a('0x1d4'),'as':_0x134a('0x1d5')});db[_0x134a('0xf2')][_0x134a('0x14d')](db[_0x134a('0x134')],{'foreignKey':'ToMailQueueId','as':_0x134a('0x1d6')});db[_0x134a('0xf2')][_0x134a('0x14d')](db[_0x134a('0x3c')],{'foreignKey':_0x134a('0x1d7'),'as':_0x134a('0x1d8')});db[_0x134a('0xf4')][_0x134a('0x14d')](db[_0x134a('0x66')],{});db['ChatTransferReport'][_0x134a('0x14d')](db[_0x134a('0x64')],{});db['ChatTransferReport'][_0x134a('0x14d')](db[_0x134a('0x5f')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db['ChatTransferReport'][_0x134a('0x14d')](db[_0x134a('0x10')],{'foreignKey':_0x134a('0x1d2'),'as':_0x134a('0x1d3')});db[_0x134a('0xf4')]['belongsTo'](db[_0x134a('0x10')],{'foreignKey':_0x134a('0x1d4'),'as':_0x134a('0x1d5')});db['ChatTransferReport'][_0x134a('0x14d')](db[_0x134a('0x6a')],{'foreignKey':'ToChatQueueId','as':_0x134a('0x1d6')});db[_0x134a('0xf4')]['belongsTo'](db[_0x134a('0x5f')],{'foreignKey':_0x134a('0x1d9'),'as':_0x134a('0x1d8')});db[_0x134a('0xf6')]['belongsTo'](db['FaxMessage'],{});db[_0x134a('0xf6')][_0x134a('0x14d')](db[_0x134a('0x4a')],{});db[_0x134a('0xf6')][_0x134a('0x14d')](db['FaxAccount'],{'foreignKey':_0x134a('0x1da'),'as':'FromAccount'});db['FaxTransferReport'][_0x134a('0x14d')](db[_0x134a('0x10')],{'foreignKey':_0x134a('0x1d2'),'as':_0x134a('0x1d3')});db[_0x134a('0xf6')][_0x134a('0x14d')](db['User'],{'foreignKey':'ToUserId','as':_0x134a('0x1d5')});db['FaxTransferReport'][_0x134a('0x14d')](db[_0x134a('0x4e')],{'foreignKey':'ToFaxQueueId','as':_0x134a('0x1d6')});db['FaxTransferReport']['belongsTo'](db['FaxAccount'],{'foreignKey':_0x134a('0x1db'),'as':_0x134a('0x1d8')});db[_0x134a('0xf8')][_0x134a('0x14d')](db[_0x134a('0x189')],{});db[_0x134a('0xf8')][_0x134a('0x14d')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0x134a('0x14d')](db[_0x134a('0x57')],{'foreignKey':'FromOpenchannelAccountId','as':_0x134a('0x1d1')});db[_0x134a('0xf8')][_0x134a('0x14d')](db['User'],{'foreignKey':_0x134a('0x1d2'),'as':_0x134a('0x1d3')});db[_0x134a('0xf8')][_0x134a('0x14d')](db[_0x134a('0x10')],{'foreignKey':'ToUserId','as':_0x134a('0x1d5')});db['OpenchannelTransferReport'][_0x134a('0x14d')](db[_0x134a('0x5e')],{'foreignKey':'ToOpenchannelQueueId','as':_0x134a('0x1d6')});db['OpenchannelTransferReport'][_0x134a('0x14d')](db['OpenchannelAccount'],{'foreignKey':_0x134a('0x1dc'),'as':'ToAccount'});db[_0x134a('0x1dd')][_0x134a('0x14d')](db[_0x134a('0x54')],{});db[_0x134a('0x1dd')][_0x134a('0x14d')](db[_0x134a('0x11f')],{});db[_0x134a('0x1dd')][_0x134a('0x14d')](db['SmsAccount'],{'foreignKey':_0x134a('0x1de'),'as':_0x134a('0x1d1')});db[_0x134a('0x1dd')][_0x134a('0x14d')](db[_0x134a('0x10')],{'foreignKey':'FromUserId','as':_0x134a('0x1d3')});db[_0x134a('0x1dd')][_0x134a('0x14d')](db['User'],{'foreignKey':_0x134a('0x1d4'),'as':'ToAgent'});db[_0x134a('0x1dd')]['belongsTo'](db['SmsQueue'],{'foreignKey':_0x134a('0x1df'),'as':_0x134a('0x1d6')});db[_0x134a('0x1dd')][_0x134a('0x14d')](db[_0x134a('0x50')],{'foreignKey':'ToSmsAccountId','as':_0x134a('0x1d8')});db[_0x134a('0xfb')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x134a('0x17a'),'onDelete':_0x134a('0x116')});db[_0x134a('0xfb')][_0x134a('0x118')](db[_0x134a('0x7a')],{'as':_0x134a('0x1e0'),'foreignKey':_0x134a('0x17a')});db[_0x134a('0xfb')][_0x134a('0x118')](db[_0x134a('0x15b')],{'as':_0x134a('0x199'),'onDelete':_0x134a('0x116'),'foreignKey':_0x134a('0x17a')});db[_0x134a('0xfb')][_0x134a('0x118')](db['CmHopperFinal'],{'as':_0x134a('0x11d'),'foreignKey':'ListId'});db[_0x134a('0xfb')][_0x134a('0x118')](db[_0x134a('0x76')],{'as':'HopperHistory','foreignKey':'ListId'});db[_0x134a('0xfb')][_0x134a('0x118')](db[_0x134a('0x78')],{'as':_0x134a('0x78'),'foreignKey':_0x134a('0x17a')});db[_0x134a('0xfb')][_0x134a('0x127')](db[_0x134a('0x1a')],{'as':_0x134a('0x1e1'),'through':'voice_queues_has_cm_lists'});db[_0x134a('0xfb')][_0x134a('0x127')](db[_0x134a('0x10')],{'as':_0x134a('0x154'),'through':_0x134a('0x12a')});db['VoicePrefix'][_0x134a('0x118')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x134a('0x116')});db[_0x134a('0xfd')][_0x134a('0x127')](db[_0x134a('0x10')],{'as':_0x134a('0x154'),'through':_0x134a('0x1e2')});db['UserProfile'][_0x134a('0x118')](db['User'],{'as':_0x134a('0x180'),'foreignKey':_0x134a('0x1e3')});db[_0x134a('0xff')]['hasMany'](db['UserProfileSection'],{'as':_0x134a('0x1e4'),'foreignKey':_0x134a('0x1e3'),'onDelete':_0x134a('0x116')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x134a('0x1e5'),'foreignKey':_0x134a('0x1e6'),'onDelete':_0x134a('0x116')});db['WhatsappAccount'][_0x134a('0x118')](db['Disposition'],{'as':_0x134a('0x162'),'foreignKey':_0x134a('0x1e7'),'onDelete':_0x134a('0x116')});db[_0x134a('0x104')][_0x134a('0x118')](db['CannedAnswer'],{'as':_0x134a('0x176'),'foreignKey':_0x134a('0x1e7')});db['WhatsappAccount'][_0x134a('0x118')](db['WhatsappMessage'],{'as':_0x134a('0x163'),'foreignKey':'WhatsappAccountId'});db[_0x134a('0x104')][_0x134a('0x118')](db[_0x134a('0x108')],{'as':_0x134a('0x164')});db[_0x134a('0x104')][_0x134a('0x118')](db['WhatsappApplication'],{'as':_0x134a('0x165')});db[_0x134a('0x104')]['belongsTo'](db[_0x134a('0xfb')],{'as':_0x134a('0x166'),'foreignKey':_0x134a('0x17a')});db['WhatsappAccount'][_0x134a('0x14d')](db[_0x134a('0x150')],{'as':'mandatoryDispositionPause','foreignKey':_0x134a('0x152')});db['WhatsappAccount'][_0x134a('0x127')](db[_0x134a('0x10')],{'as':_0x134a('0x154'),'through':_0x134a('0x142')});db[_0x134a('0x106')][_0x134a('0x14d')](db[_0x134a('0x10')],{'onDelete':_0x134a('0x170')});db['WhatsappApplication'][_0x134a('0x14d')](db['WhatsappQueue'],{'onDelete':_0x134a('0x170')});db[_0x134a('0x106')][_0x134a('0x14d')](db[_0x134a('0x104')],{'onDelete':_0x134a('0x170')});db['WhatsappApplication'][_0x134a('0x14d')](db[_0x134a('0x84')],{'onDelete':'restrict','foreignKey':_0x134a('0x14f')});db[_0x134a('0x106')][_0x134a('0x14d')](db['Tag'],{'onDelete':_0x134a('0x170'),'foreignKey':'TagId'});db[_0x134a('0x108')][_0x134a('0x118')](db[_0x134a('0x10a')],{'as':_0x134a('0x163'),'onDelete':'cascade','foreignKey':_0x134a('0x1e8')});db[_0x134a('0x108')][_0x134a('0x14d')](db[_0x134a('0x104')],{'as':_0x134a('0x169'),'foreignKey':_0x134a('0x1e7')});db[_0x134a('0x108')][_0x134a('0x14d')](db[_0x134a('0x15b')],{'as':_0x134a('0x15c'),'foreignKey':_0x134a('0x15d')});db[_0x134a('0x108')][_0x134a('0x14d')](db['User'],{'as':_0x134a('0x17c'),'foreignKey':_0x134a('0x117')});db[_0x134a('0x108')]['belongsToMany'](db['Tag'],{'through':_0x134a('0x1ad'),'as':_0x134a('0x17e')});db[_0x134a('0x108')]['belongsToMany'](db['Tag'],{'through':_0x134a('0x1ad'),'as':_0x134a('0x17f')});db[_0x134a('0x108')][_0x134a('0x127')](db['User'],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0x134a('0x1e8')});db[_0x134a('0x10a')][_0x134a('0x14d')](db[_0x134a('0x10')],{'as':_0x134a('0x10')});db[_0x134a('0x10a')]['belongsTo'](db[_0x134a('0x15b')],{'onDelete':'cascade','as':_0x134a('0x15c')});db[_0x134a('0x10a')]['belongsTo'](db[_0x134a('0x108')],{'onDelete':_0x134a('0x116'),'as':_0x134a('0x187'),'foreignKey':_0x134a('0x1e8')});db[_0x134a('0x10a')][_0x134a('0x14d')](db[_0x134a('0x104')],{'as':_0x134a('0x169'),'foreignKey':'WhatsappAccountId'});db[_0x134a('0x10c')][_0x134a('0x14d')](db['WhatsappAccount'],{});db['WhatsappQueueReport'][_0x134a('0x14d')](db[_0x134a('0xfb')],{'as':_0x134a('0x166'),'foreignKey':_0x134a('0x17a')});db[_0x134a('0x10c')][_0x134a('0x14d')](db[_0x134a('0x15b')],{'as':_0x134a('0x15c'),'foreignKey':_0x134a('0x15d')});db[_0x134a('0x10c')]['belongsTo'](db['WhatsappInteraction'],{});db[_0x134a('0x10c')][_0x134a('0x14d')](db[_0x134a('0x13a')],{});db[_0x134a('0x10c')][_0x134a('0x14d')](db['WhatsappMessage'],{});db[_0x134a('0x10c')][_0x134a('0x14d')](db[_0x134a('0x10')],{});db[_0x134a('0x10d')][_0x134a('0x14d')](db['WhatsappMessage'],{});db[_0x134a('0x10d')][_0x134a('0x14d')](db[_0x134a('0x108')],{});db[_0x134a('0x10d')]['belongsTo'](db[_0x134a('0x104')],{'foreignKey':_0x134a('0x1e9'),'as':_0x134a('0x1d1')});db['WhatsappTransferReport'][_0x134a('0x14d')](db[_0x134a('0x104')],{'foreignKey':_0x134a('0x1ea'),'as':_0x134a('0x1d8')});db[_0x134a('0x10d')][_0x134a('0x14d')](db[_0x134a('0x13a')],{'foreignKey':_0x134a('0x1eb'),'as':_0x134a('0x1d6')});db[_0x134a('0x10d')][_0x134a('0x14d')](db[_0x134a('0x10')],{'foreignKey':_0x134a('0x1d2'),'as':_0x134a('0x1d3')});db[_0x134a('0x10d')][_0x134a('0x14d')](db[_0x134a('0x10')],{'foreignKey':'ToUserId','as':_0x134a('0x1d5')});db[_0x134a('0x13a')][_0x134a('0x127')](db['User'],{'as':'Agents','through':_0x134a('0x37'),'foreignKey':_0x134a('0x1ec')});db[_0x134a('0x13a')][_0x134a('0x127')](db[_0x134a('0xe6')],{'through':_0x134a('0x1ed'),'as':_0x134a('0x155')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 3df5332..f87031d 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc27=['/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/sounds','./api/tag','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/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/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','./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/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','join','/www','root','/demo','/snippet','snippet','3.0.0','/plugins','static','/server/files/plugins','route','sendFile','resolve','get','appPath','username','password','newPassword','apiKey','firstName','street','phone','fax','email','clientId','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','accesskeyid','secretaccesskey','key','localstationid','dsn','secret','registry','oldPassword','length','isString','replace','lodash','path','express','util','./errors','./config/environment','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','remoteAddress','url','responseTime','user','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','connection','statusCode','device','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/mailServerOut','./api/mailAccount','/api/mail/queues'];(function(_0xcd8c8c,_0x3589c0){var _0x454f55=function(_0xef5859){while(--_0xef5859){_0xcd8c8c['push'](_0xcd8c8c['shift']());}};_0x454f55(++_0x3589c0);}(_0xdc27,0x103));var _0x7dc2=function(_0x200af4,_0x8416e8){_0x200af4=_0x200af4-0x0;var _0x3831b6=_0xdc27[_0x200af4];return _0x3831b6;};'use strict';var _=require(_0x7dc2('0x0'));var path=require(_0x7dc2('0x1'));var express=require(_0x7dc2('0x2'));var ewinston=require('express-winston');var util=require(_0x7dc2('0x3'));var errors=require(_0x7dc2('0x4'));var config=require(_0x7dc2('0x5'));var logger=require(_0x7dc2('0x6'))(_0x7dc2('0x7'));var authLogger=require(_0x7dc2('0x6'))(_0x7dc2('0x8'));exports[_0x7dc2('0x9')]=function(_0x4ee880){_0x4ee880[_0x7dc2('0xa')](ewinston[_0x7dc2('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0xc2540,_0x5148a9){var _0x3f7b95=_0x7dc2('0xc');if(!_[_0x7dc2('0xd')](_0xc2540[_0x7dc2('0xe')])){_0x3f7b95+=_0x7dc2('0xf');var _0x17583c=_0xc2540[_0x7dc2('0xe')];maskSensitiveData(_0x17583c);}return util[_0x7dc2('0x10')](_0x3f7b95,_0xc2540['method'],_0xc2540[_0x7dc2('0x11')][_0x7dc2('0x12')]?_0xc2540[_0x7dc2('0x11')][_0x7dc2('0x12')]:_0xc2540['connection'][_0x7dc2('0x13')]||_0xc2540['ip'],_0xc2540[_0x7dc2('0x14')],_0x5148a9['statusCode'],_0x5148a9[_0x7dc2('0x15')],_0xc2540[_0x7dc2('0x16')]?_0xc2540[_0x7dc2('0x16')]['id']:null,_0xc2540[_0x7dc2('0x16')]?_0xc2540[_0x7dc2('0x16')][_0x7dc2('0x17')]:null,_0xc2540[_0x7dc2('0x16')]?_0xc2540[_0x7dc2('0x16')][_0x7dc2('0x18')]:null,_0x17583c?util[_0x7dc2('0x19')](_0x17583c,![],null):'');}}));_0x4ee880[_0x7dc2('0xa')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2a1c00,_0x38e51b){var _0x3c2984=_0x7dc2('0x1a');if(_0x2a1c00[_0x7dc2('0xe')]&&_0x2a1c00[_0x7dc2('0xe')]['device']&&_0x2a1c00['body'][_0x7dc2('0x1b')]){_0x3c2984=_0x7dc2('0x1c');}return util['format'](_0x3c2984,_0x2a1c00[_0x7dc2('0x1d')],_0x2a1c00['headers'][_0x7dc2('0x12')]?_0x2a1c00[_0x7dc2('0x11')][_0x7dc2('0x12')]:_0x2a1c00[_0x7dc2('0x1e')][_0x7dc2('0x13')]||_0x2a1c00['ip'],_0x2a1c00[_0x7dc2('0x14')],_0x38e51b[_0x7dc2('0x1f')],_0x38e51b[_0x7dc2('0x15')],_0x2a1c00['user']?_0x2a1c00['user']['id']:null,_0x2a1c00[_0x7dc2('0x16')]?_0x2a1c00[_0x7dc2('0x16')][_0x7dc2('0x17')]:null,_0x2a1c00[_0x7dc2('0x16')]?_0x2a1c00[_0x7dc2('0x16')]['role']:null,_0x2a1c00[_0x7dc2('0xe')]&&_0x2a1c00[_0x7dc2('0xe')][_0x7dc2('0x20')]?_0x2a1c00[_0x7dc2('0xe')][_0x7dc2('0x20')]:'other',_0x2a1c00[_0x7dc2('0xe')]&&_0x2a1c00[_0x7dc2('0xe')][_0x7dc2('0x1b')]?_0x2a1c00[_0x7dc2('0xe')][_0x7dc2('0x1b')]:'',_0x2a1c00['body']&&_0x2a1c00['body']['agent_name']?_0x2a1c00[_0x7dc2('0xe')]['agent_name']:'');},'ignoreRoute':function(_0x15aa9a){var _0x29e777=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x29e777['test'](_0x15aa9a[_0x7dc2('0x14')]);}}));_0x4ee880['use'](_0x7dc2('0x21'),require(_0x7dc2('0x22')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x23'),require('./api/voiceChanSpy'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x24'),require(_0x7dc2('0x25')));_0x4ee880[_0x7dc2('0xa')]('/api/voice/extensions',require(_0x7dc2('0x26')));_0x4ee880[_0x7dc2('0xa')]('/api/voice/mohs',require(_0x7dc2('0x27')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x28'),require('./api/voiceQueue'));_0x4ee880[_0x7dc2('0xa')]('/api/voice/recordings',require(_0x7dc2('0x29')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x2a'),require('./api/screenRecording'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x2b'),require(_0x7dc2('0x2c')));_0x4ee880['use'](_0x7dc2('0x2d'),require(_0x7dc2('0x2e')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x2f'),require(_0x7dc2('0x30')));_0x4ee880['use'](_0x7dc2('0x31'),require(_0x7dc2('0x32')));_0x4ee880['use'](_0x7dc2('0x33'),require(_0x7dc2('0x34')));_0x4ee880['use']('/api/voice/queues/reports',require(_0x7dc2('0x35')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x36'),require(_0x7dc2('0x37')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x38'),require(_0x7dc2('0x39')));_0x4ee880[_0x7dc2('0xa')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x4ee880[_0x7dc2('0xa')]('/api/mail/out_servers',require(_0x7dc2('0x3a')));_0x4ee880[_0x7dc2('0xa')]('/api/mail/accounts',require(_0x7dc2('0x3b')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x3c'),require('./api/mailQueue'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x3d'),require(_0x7dc2('0x3e')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x3f'),require(_0x7dc2('0x40')));_0x4ee880['use'](_0x7dc2('0x41'),require(_0x7dc2('0x42')));_0x4ee880['use'](_0x7dc2('0x43'),require(_0x7dc2('0x44')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x45'),require('./api/mailQueueReport'));_0x4ee880[_0x7dc2('0xa')]('/api/dashboards',require(_0x7dc2('0x46')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x47'),require(_0x7dc2('0x48')));_0x4ee880[_0x7dc2('0xa')]('/api/fax/accounts',require('./api/faxAccount'));_0x4ee880[_0x7dc2('0xa')]('/api/fax/applications',require(_0x7dc2('0x49')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x4a'),require(_0x7dc2('0x4b')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x4c'),require(_0x7dc2('0x4d')));_0x4ee880['use'](_0x7dc2('0x4e'),require('./api/faxQueue'));_0x4ee880[_0x7dc2('0xa')]('/api/fax/reports/queue',require(_0x7dc2('0x4f')));_0x4ee880['use'](_0x7dc2('0x50'),require(_0x7dc2('0x51')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x52'),require(_0x7dc2('0x53')));_0x4ee880[_0x7dc2('0xa')]('/api/sms/interactions',require(_0x7dc2('0x54')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x55'),require(_0x7dc2('0x56')));_0x4ee880[_0x7dc2('0xa')]('/api/sms/queues',require(_0x7dc2('0x57')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x58'),require(_0x7dc2('0x59')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x5a'),require(_0x7dc2('0x5b')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x5c'),require(_0x7dc2('0x5d')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x5e'),require(_0x7dc2('0x5f')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x60'),require(_0x7dc2('0x61')));_0x4ee880[_0x7dc2('0xa')]('/api/chat/websites',require('./api/chatWebsite'));_0x4ee880[_0x7dc2('0xa')]('/api/openchannel/reports/queue',require(_0x7dc2('0x62')));_0x4ee880['use'](_0x7dc2('0x63'),require('./api/chatApplication'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x64'),require(_0x7dc2('0x65')));_0x4ee880[_0x7dc2('0xa')]('/api/chat/messages',require(_0x7dc2('0x66')));_0x4ee880['use'](_0x7dc2('0x67'),require(_0x7dc2('0x68')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x69'),require(_0x7dc2('0x6a')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x6b'),require(_0x7dc2('0x6c')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x6d'),require(_0x7dc2('0x6e')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x6f'),require('./api/cmCompany'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x70'),require(_0x7dc2('0x71')));_0x4ee880[_0x7dc2('0xa')]('/api/cm/hopper',require('./api/cmHopper'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x72'),require(_0x7dc2('0x73')));_0x4ee880['use'](_0x7dc2('0x74'),require('./api/cmHopperFinal'));_0x4ee880['use'](_0x7dc2('0x75'),require(_0x7dc2('0x76')));_0x4ee880['use'](_0x7dc2('0x77'),require(_0x7dc2('0x78')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x79'),require(_0x7dc2('0x7a')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x7b'),require('./api/automation'));_0x4ee880[_0x7dc2('0xa')]('/api/canned_answers',require(_0x7dc2('0x7c')));_0x4ee880['use'](_0x7dc2('0x7d'),require(_0x7dc2('0x7e')));_0x4ee880['use'](_0x7dc2('0x7f'),require('./api/condition'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x80'),require(_0x7dc2('0x81')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x82'),require('./api/pause'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x83'),require(_0x7dc2('0x84')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x85'),require(_0x7dc2('0x86')));_0x4ee880[_0x7dc2('0xa')]('/api/schedules',require('./api/schedule'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x87'),require('./api/sound'));_0x4ee880['use']('/api/tags',require(_0x7dc2('0x88')));_0x4ee880[_0x7dc2('0xa')]('/api/templates',require('./api/template'));_0x4ee880[_0x7dc2('0xa')]('/api/triggers',require(_0x7dc2('0x89')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x8a'),require(_0x7dc2('0x8b')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x8c'),require(_0x7dc2('0x8d')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x8e'),require(_0x7dc2('0x8f')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x90'),require('./api/analyticCustomReport'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x91'),require(_0x7dc2('0x92')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x93'),require(_0x7dc2('0x94')));_0x4ee880['use']('/api/analytics/metrics',require(_0x7dc2('0x95')));_0x4ee880['use'](_0x7dc2('0x96'),require(_0x7dc2('0x97')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x98'),require(_0x7dc2('0x99')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x9a'),require(_0x7dc2('0x9b')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x9c'),require(_0x7dc2('0x9d')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x9e'),require(_0x7dc2('0x9f')));_0x4ee880['use']('/api/integrations/sugarcrm/accounts',require(_0x7dc2('0xa0')));_0x4ee880[_0x7dc2('0xa')]('/api/integrations/sugarcrm/configurations',require(_0x7dc2('0xa1')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xa2'),require(_0x7dc2('0xa3')));_0x4ee880['use'](_0x7dc2('0xa4'),require('./api/intDeskAccount'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xa5'),require(_0x7dc2('0xa6')));_0x4ee880['use'](_0x7dc2('0xa7'),require('./api/intDeskField'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xa8'),require('./api/intZohoAccount'));_0x4ee880[_0x7dc2('0xa')]('/api/integrations/zoho/configurations',require(_0x7dc2('0xa9')));_0x4ee880[_0x7dc2('0xa')]('/api/integrations/zoho/fields',require(_0x7dc2('0xaa')));_0x4ee880[_0x7dc2('0xa')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xab'),require(_0x7dc2('0xac')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xad'),require(_0x7dc2('0xae')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xaf'),require(_0x7dc2('0xb0')));_0x4ee880['use']('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xb1'),require('./api/intFreshdeskField'));_0x4ee880['use'](_0x7dc2('0xb2'),require('./api/intVtigerAccount'));_0x4ee880['use']('/api/integrations/vtiger/configurations',require(_0x7dc2('0xb3')));_0x4ee880[_0x7dc2('0xa')]('/api/integrations/vtiger/fields',require(_0x7dc2('0xb4')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xb5'),require(_0x7dc2('0xb6')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xb7'),require('./api/intServicenowConfiguration'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xb8'),require(_0x7dc2('0xb9')));_0x4ee880[_0x7dc2('0xa')]('/api/integrations/dynamics365/accounts',require(_0x7dc2('0xba')));_0x4ee880['use'](_0x7dc2('0xbb'),require(_0x7dc2('0xbc')));_0x4ee880['use'](_0x7dc2('0xbd'),require(_0x7dc2('0xbe')));_0x4ee880['use']('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xbf'),require(_0x7dc2('0xc0')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xc1'),require(_0x7dc2('0xc2')));_0x4ee880[_0x7dc2('0xa')]('/api/networks',require('./api/network'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xc3'),require(_0x7dc2('0xc4')));_0x4ee880['use'](_0x7dc2('0xc5'),require('./api/chatInternalMessage'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xc6'),require(_0x7dc2('0xc7')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xc8'),require(_0x7dc2('0xc9')));_0x4ee880['use'](_0x7dc2('0xca'),require(_0x7dc2('0xcb')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xcc'),require(_0x7dc2('0xcd')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xce'),require('./api/squareReport'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xcf'),require(_0x7dc2('0xd0')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xd1'),require('./api/jscriptyProject'));_0x4ee880['use']('/api/settings',require(_0x7dc2('0xd2')));_0x4ee880[_0x7dc2('0xa')]('/api/square/odbc',require(_0x7dc2('0xd3')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xd4'),require(_0x7dc2('0xd5')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xd6'),require(_0x7dc2('0xd7')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xd8'),require(_0x7dc2('0xd9')));_0x4ee880['use'](_0x7dc2('0xda'),require(_0x7dc2('0xdb')));_0x4ee880[_0x7dc2('0xa')]('/api/license',require(_0x7dc2('0xdc')));_0x4ee880['use']('/api/campaigns',require('./api/campaign'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xdd'),require(_0x7dc2('0xde')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xdf'),require('./api/attachment'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xe0'),require(_0x7dc2('0xe1')));_0x4ee880[_0x7dc2('0xa')]('/api/mail/reports/transfer',require(_0x7dc2('0xe2')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xe3'),require(_0x7dc2('0xe4')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xe5'),require(_0x7dc2('0xe6')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xe7'),require(_0x7dc2('0xe8')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xe9'),require('./api/smsTransferReport'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xea'),require(_0x7dc2('0xeb')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xec'),require(_0x7dc2('0xed')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xee'),require(_0x7dc2('0xef')));_0x4ee880['use'](_0x7dc2('0xf0'),require('./api/userProfileSection'));_0x4ee880[_0x7dc2('0xa')]('/api/userProfile/resources',require(_0x7dc2('0xf1')));_0x4ee880['use'](_0x7dc2('0xf2'),require(_0x7dc2('0xf3')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xf4'),require('./api/whatsappAccount'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xf5'),require(_0x7dc2('0xf6')));_0x4ee880[_0x7dc2('0xa')]('/api/whatsapp/interactions',require(_0x7dc2('0xf7')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xf8'),require(_0x7dc2('0xf9')));_0x4ee880['use'](_0x7dc2('0xfa'),require('./api/whatsappQueueReport'));_0x4ee880['use'](_0x7dc2('0xfb'),require(_0x7dc2('0xfc')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xfd'),require(_0x7dc2('0xfe')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0xff'),require(_0x7dc2('0x100')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x101'),require(_0x7dc2('0x102')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x103'),require(_0x7dc2('0x104')));_0x4ee880['use'](_0x7dc2('0x105'),require('./api/authGoogle'));_0x4ee880['use'](_0x7dc2('0x106'),require('./api/jira'));_0x4ee880[_0x7dc2('0xa')]('/api/rpc',require(_0x7dc2('0x107')));_0x4ee880['use'](_0x7dc2('0x108'),require('./api/version'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x109'),require(_0x7dc2('0x10a')));_0x4ee880['use'](_0x7dc2('0x10b'),require('./api/pm2'));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x10c'),require(_0x7dc2('0x10d')));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x10e'),express['static'](path[_0x7dc2('0x10f')](config['root'],_0x7dc2('0x10e'))));_0x4ee880['use'](_0x7dc2('0x110'),express['static'](path[_0x7dc2('0x10f')](config[_0x7dc2('0x111')],_0x7dc2('0x110'))));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x112'),express['static'](path[_0x7dc2('0x10f')](config[_0x7dc2('0x111')],_0x7dc2('0x112'))));_0x4ee880['use'](_0x7dc2('0x113'),express['static'](path['join'](config[_0x7dc2('0x111')],_0x7dc2('0x114'),_0x7dc2('0x115'))));_0x4ee880[_0x7dc2('0xa')](_0x7dc2('0x116'),express[_0x7dc2('0x117')](path[_0x7dc2('0x10f')](config[_0x7dc2('0x111')],_0x7dc2('0x118'))));_0x4ee880[_0x7dc2('0x119')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x4ee880[_0x7dc2('0x119')]('/*')['get'](function(_0xb23af2,_0x3f6389){_0x3f6389[_0x7dc2('0x11a')](path[_0x7dc2('0x11b')](_0x4ee880[_0x7dc2('0x11c')](_0x7dc2('0x11d'))+'/index.html'));});};var sensitiveFields=[_0x7dc2('0x11e'),_0x7dc2('0x11f'),_0x7dc2('0x120'),_0x7dc2('0x121'),_0x7dc2('0x122'),'lastName',_0x7dc2('0x123'),_0x7dc2('0x124'),'mobile',_0x7dc2('0x125'),_0x7dc2('0x126'),_0x7dc2('0x127'),'clientSecret','securityToken',_0x7dc2('0x128'),_0x7dc2('0x129'),_0x7dc2('0x12a'),'token',_0x7dc2('0x12b'),_0x7dc2('0x12c'),_0x7dc2('0x12d'),_0x7dc2('0x12e'),_0x7dc2('0x12f'),_0x7dc2('0x130'),_0x7dc2('0x131'),_0x7dc2('0x132'),_0x7dc2('0x133'),_0x7dc2('0x134'),'vidaooApiKey','clientEmail','privateKey',_0x7dc2('0x135'),_0x7dc2('0x136'),_0x7dc2('0x137'),_0x7dc2('0x16'),'pass','accountSid',_0x7dc2('0x138'),_0x7dc2('0x139'),_0x7dc2('0x13a'),_0x7dc2('0x13b'),_0x7dc2('0x13c')];function maskSensitiveData(_0xf2f3d5){var _0xbe8c8a=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0xf2f3d5))return;for(var _0x163aef in _0xf2f3d5){if(_['isArray'](_0xf2f3d5[_0x163aef])){for(var _0x260fec=0x0;_0x260fec<_0xf2f3d5[_0x163aef][_0x7dc2('0x13d')];_0x260fec++){maskSensitiveData(_0xf2f3d5[_0x163aef][_0x260fec]);}}else if(_['isPlainObject'](_0xf2f3d5[_0x163aef])){maskSensitiveData(_0xf2f3d5[_0x163aef]);}else if(_[_0x7dc2('0x13e')](_0xf2f3d5[_0x163aef])){_0xf2f3d5[_0x163aef]=_0xf2f3d5[_0x163aef][_0x7dc2('0x13f')](/{{{/g,'@@{')['replace'](/}}}/g,'}@@')[_0x7dc2('0x13f')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x163aef)){_0xf2f3d5[_0x163aef]=_0xf2f3d5[_0x163aef][_0x7dc2('0x13f')](_0xbe8c8a,'*');}}}} \ No newline at end of file +var _0xa293=['responseTime','user','role','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','format','connection','statusCode','name','other','agent_name','test','/api/users','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/queues','/api/openchannel/accounts','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/configurations','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./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/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userNotification','./api/whatsappAccount','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','join','static','root','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','username','password','newPassword','apiKey','lastName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerKey','calleridname','calleridnum','vidaooApiKey','clientEmail','privateKey','secretaccesskey','pass','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','lodash','path','express','util','./errors','./config/environment','./config/logger','auth','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','method','headers','x-forwarded-for','url'];(function(_0x23551e,_0x56f82f){var _0x4e36ff=function(_0x2249ad){while(--_0x2249ad){_0x23551e['push'](_0x23551e['shift']());}};_0x4e36ff(++_0x56f82f);}(_0xa293,0x138));var _0x3a29=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa293[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x3a29('0x0'));var path=require(_0x3a29('0x1'));var express=require(_0x3a29('0x2'));var ewinston=require('express-winston');var util=require(_0x3a29('0x3'));var errors=require(_0x3a29('0x4'));var config=require(_0x3a29('0x5'));var logger=require(_0x3a29('0x6'))('api');var authLogger=require(_0x3a29('0x6'))(_0x3a29('0x7'));exports['default']=function(_0x5ef6f4){_0x5ef6f4[_0x3a29('0x8')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0xec2a2b,_0x1446e4){var _0x235e45=_0x3a29('0x9');if(!_['isEmpty'](_0xec2a2b[_0x3a29('0xa')])){_0x235e45+=_0x3a29('0xb');var _0x540103=_0xec2a2b[_0x3a29('0xa')];maskSensitiveData(_0x540103);}return util['format'](_0x235e45,_0xec2a2b[_0x3a29('0xc')],_0xec2a2b[_0x3a29('0xd')]['x-forwarded-for']?_0xec2a2b['headers'][_0x3a29('0xe')]:_0xec2a2b['connection']['remoteAddress']||_0xec2a2b['ip'],_0xec2a2b[_0x3a29('0xf')],_0x1446e4['statusCode'],_0x1446e4[_0x3a29('0x10')],_0xec2a2b['user']?_0xec2a2b[_0x3a29('0x11')]['id']:null,_0xec2a2b[_0x3a29('0x11')]?_0xec2a2b['user']['name']:null,_0xec2a2b[_0x3a29('0x11')]?_0xec2a2b[_0x3a29('0x11')][_0x3a29('0x12')]:null,_0x540103?util[_0x3a29('0x13')](_0x540103,![],null):'');}}));_0x5ef6f4[_0x3a29('0x8')](ewinston[_0x3a29('0x14')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2f988a,_0x25a00c){var _0x5785c0=_0x3a29('0x15');if(_0x2f988a[_0x3a29('0xa')]&&_0x2f988a[_0x3a29('0xa')][_0x3a29('0x16')]&&_0x2f988a[_0x3a29('0xa')][_0x3a29('0x17')]){_0x5785c0='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x3a29('0x18')](_0x5785c0,_0x2f988a[_0x3a29('0xc')],_0x2f988a[_0x3a29('0xd')][_0x3a29('0xe')]?_0x2f988a[_0x3a29('0xd')][_0x3a29('0xe')]:_0x2f988a[_0x3a29('0x19')]['remoteAddress']||_0x2f988a['ip'],_0x2f988a[_0x3a29('0xf')],_0x25a00c[_0x3a29('0x1a')],_0x25a00c[_0x3a29('0x10')],_0x2f988a[_0x3a29('0x11')]?_0x2f988a[_0x3a29('0x11')]['id']:null,_0x2f988a[_0x3a29('0x11')]?_0x2f988a[_0x3a29('0x11')][_0x3a29('0x1b')]:null,_0x2f988a['user']?_0x2f988a['user'][_0x3a29('0x12')]:null,_0x2f988a['body']&&_0x2f988a[_0x3a29('0xa')][_0x3a29('0x16')]?_0x2f988a[_0x3a29('0xa')][_0x3a29('0x16')]:_0x3a29('0x1c'),_0x2f988a[_0x3a29('0xa')]&&_0x2f988a[_0x3a29('0xa')][_0x3a29('0x17')]?_0x2f988a[_0x3a29('0xa')]['agent_id']:'',_0x2f988a['body']&&_0x2f988a[_0x3a29('0xa')][_0x3a29('0x1d')]?_0x2f988a[_0x3a29('0xa')]['agent_name']:'');},'ignoreRoute':function(_0x27510c){var _0x572951=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x572951[_0x3a29('0x1e')](_0x27510c[_0x3a29('0xf')]);}}));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x1f'),require('./api/user'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x20'),require(_0x3a29('0x21')));_0x5ef6f4[_0x3a29('0x8')]('/api/voice/contexts',require(_0x3a29('0x22')));_0x5ef6f4['use']('/api/voice/extensions',require('./api/voiceExtension'));_0x5ef6f4[_0x3a29('0x8')]('/api/voice/mohs',require(_0x3a29('0x23')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x24'),require('./api/voiceQueue'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x25'),require(_0x3a29('0x26')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x27'),require(_0x3a29('0x28')));_0x5ef6f4['use'](_0x3a29('0x29'),require(_0x3a29('0x2a')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x2b'),require(_0x3a29('0x2c')));_0x5ef6f4[_0x3a29('0x8')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x2d'),require('./api/voiceDialReport'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x2e'),require(_0x3a29('0x2f')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x30'),require(_0x3a29('0x31')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x32'),require('./api/memberReport'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x33'),require(_0x3a29('0x34')));_0x5ef6f4['use'](_0x3a29('0x35'),require('./api/voiceTransferReport'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x36'),require(_0x3a29('0x37')));_0x5ef6f4['use']('/api/mail/accounts',require(_0x3a29('0x38')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x39'),require(_0x3a29('0x3a')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x3b'),require(_0x3a29('0x3c')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x3d'),require(_0x3a29('0x3e')));_0x5ef6f4['use'](_0x3a29('0x3f'),require(_0x3a29('0x40')));_0x5ef6f4['use'](_0x3a29('0x41'),require(_0x3a29('0x42')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x43'),require(_0x3a29('0x44')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x45'),require(_0x3a29('0x46')));_0x5ef6f4[_0x3a29('0x8')]('/api/dashboards/items',require(_0x3a29('0x47')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x48'),require(_0x3a29('0x49')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x4a'),require(_0x3a29('0x4b')));_0x5ef6f4['use']('/api/fax/interactions',require(_0x3a29('0x4c')));_0x5ef6f4[_0x3a29('0x8')]('/api/fax/messages',require('./api/faxMessage'));_0x5ef6f4['use']('/api/fax/queues',require(_0x3a29('0x4d')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x4e'),require('./api/faxQueueReport'));_0x5ef6f4['use'](_0x3a29('0x4f'),require(_0x3a29('0x50')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x51'),require(_0x3a29('0x52')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x53'),require('./api/smsInteraction'));_0x5ef6f4[_0x3a29('0x8')]('/api/sms/messages',require('./api/smsMessage'));_0x5ef6f4['use'](_0x3a29('0x54'),require('./api/smsQueue'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x55'),require('./api/openchannelAccount'));_0x5ef6f4[_0x3a29('0x8')]('/api/openchannel/applications',require(_0x3a29('0x56')));_0x5ef6f4[_0x3a29('0x8')]('/api/openchannel/interactions',require(_0x3a29('0x57')));_0x5ef6f4['use'](_0x3a29('0x58'),require(_0x3a29('0x59')));_0x5ef6f4['use']('/api/openchannel/queues',require(_0x3a29('0x5a')));_0x5ef6f4['use'](_0x3a29('0x5b'),require(_0x3a29('0x5c')));_0x5ef6f4[_0x3a29('0x8')]('/api/openchannel/reports/queue',require(_0x3a29('0x5d')));_0x5ef6f4['use'](_0x3a29('0x5e'),require(_0x3a29('0x5f')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x60'),require(_0x3a29('0x61')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x62'),require('./api/chatMessage'));_0x5ef6f4['use'](_0x3a29('0x63'),require(_0x3a29('0x64')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x65'),require(_0x3a29('0x66')));_0x5ef6f4['use'](_0x3a29('0x67'),require(_0x3a29('0x68')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x69'),require('./api/chatProactiveAction'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x6a'),require(_0x3a29('0x6b')));_0x5ef6f4[_0x3a29('0x8')]('/api/cm/contacts',require(_0x3a29('0x6c')));_0x5ef6f4['use'](_0x3a29('0x6d'),require('./api/cmHopper'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x6e'),require(_0x3a29('0x6f')));_0x5ef6f4['use'](_0x3a29('0x70'),require(_0x3a29('0x71')));_0x5ef6f4['use'](_0x3a29('0x72'),require('./api/cmHopperHistory'));_0x5ef6f4[_0x3a29('0x8')]('/api/cm/custom_fields',require(_0x3a29('0x73')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x74'),require(_0x3a29('0x75')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x76'),require(_0x3a29('0x77')));_0x5ef6f4['use'](_0x3a29('0x78'),require('./api/cannedAnswer'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x79'),require(_0x3a29('0x7a')));_0x5ef6f4['use'](_0x3a29('0x7b'),require(_0x3a29('0x7c')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x7d'),require('./api/interval'));_0x5ef6f4['use']('/api/pauses',require('./api/pause'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x7e'),require(_0x3a29('0x7f')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x80'),require(_0x3a29('0x81')));_0x5ef6f4['use'](_0x3a29('0x82'),require(_0x3a29('0x83')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x84'),require(_0x3a29('0x85')));_0x5ef6f4['use'](_0x3a29('0x86'),require(_0x3a29('0x87')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x88'),require(_0x3a29('0x89')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x8a'),require(_0x3a29('0x8b')));_0x5ef6f4['use'](_0x3a29('0x8c'),require(_0x3a29('0x8d')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x8e'),require('./api/integration'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x8f'),require(_0x3a29('0x90')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x91'),require(_0x3a29('0x92')));_0x5ef6f4[_0x3a29('0x8')]('/api/analytics/default_reports',require(_0x3a29('0x93')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x94'),require(_0x3a29('0x95')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x96'),require('./api/analyticMetric'));_0x5ef6f4[_0x3a29('0x8')]('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x5ef6f4[_0x3a29('0x8')]('/api/analytics/tree_reports',require(_0x3a29('0x97')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x98'),require('./api/intSalesforceAccount'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x99'),require(_0x3a29('0x9a')));_0x5ef6f4['use'](_0x3a29('0x9b'),require(_0x3a29('0x9c')));_0x5ef6f4['use'](_0x3a29('0x9d'),require('./api/intSugarcrmAccount'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x9e'),require(_0x3a29('0x9f')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xa0'),require('./api/intSugarcrmField'));_0x5ef6f4['use']('/api/integrations/desk/accounts',require(_0x3a29('0xa1')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xa2'),require('./api/intDeskConfiguration'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xa3'),require(_0x3a29('0xa4')));_0x5ef6f4['use'](_0x3a29('0xa5'),require(_0x3a29('0xa6')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xa7'),require(_0x3a29('0xa8')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xa9'),require(_0x3a29('0xaa')));_0x5ef6f4[_0x3a29('0x8')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xab'),require('./api/intZendeskConfiguration'));_0x5ef6f4[_0x3a29('0x8')]('/api/integrations/zendesk/fields',require(_0x3a29('0xac')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xad'),require(_0x3a29('0xae')));_0x5ef6f4[_0x3a29('0x8')]('/api/integrations/freshdesk/configurations',require(_0x3a29('0xaf')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xb0'),require(_0x3a29('0xb1')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xb2'),require('./api/intVtigerAccount'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xb3'),require(_0x3a29('0xb4')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xb5'),require(_0x3a29('0xb6')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xb7'),require(_0x3a29('0xb8')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xb9'),require('./api/intServicenowConfiguration'));_0x5ef6f4['use'](_0x3a29('0xba'),require(_0x3a29('0xbb')));_0x5ef6f4['use'](_0x3a29('0xbc'),require(_0x3a29('0xbd')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xbe'),require('./api/intDynamics365Configuration'));_0x5ef6f4['use'](_0x3a29('0xbf'),require(_0x3a29('0xc0')));_0x5ef6f4[_0x3a29('0x8')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x5ef6f4[_0x3a29('0x8')]('/api/integrations/freshsales/configurations',require(_0x3a29('0xc1')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xc2'),require(_0x3a29('0xc3')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xc4'),require('./api/network'));_0x5ef6f4[_0x3a29('0x8')]('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x5ef6f4['use'](_0x3a29('0xc5'),require(_0x3a29('0xc6')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xc7'),require('./api/jscriptyAnswerReport'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xc8'),require(_0x3a29('0xc9')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xca'),require(_0x3a29('0xcb')));_0x5ef6f4[_0x3a29('0x8')]('/api/sms/reports/queue',require(_0x3a29('0xcc')));_0x5ef6f4['use'](_0x3a29('0xcd'),require(_0x3a29('0xce')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xcf'),require(_0x3a29('0xd0')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xd1'),require('./api/jscriptyProject'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xd2'),require(_0x3a29('0xd3')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xd4'),require('./api/squareOdbc'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xd5'),require(_0x3a29('0xd6')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xd7'),require(_0x3a29('0xd8')));_0x5ef6f4['use'](_0x3a29('0xd9'),require(_0x3a29('0xda')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xdb'),require(_0x3a29('0xdc')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xdd'),require(_0x3a29('0xde')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xdf'),require(_0x3a29('0xe0')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xe1'),require('./api/migration'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xe2'),require(_0x3a29('0xe3')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xe4'),require(_0x3a29('0xe5')));_0x5ef6f4['use'](_0x3a29('0xe6'),require(_0x3a29('0xe7')));_0x5ef6f4['use']('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x5ef6f4['use'](_0x3a29('0xe8'),require('./api/faxTransferReport'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xe9'),require(_0x3a29('0xea')));_0x5ef6f4['use']('/api/sms/reports/transfer',require(_0x3a29('0xeb')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xec'),require(_0x3a29('0xed')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xee'),require('./api/voicePrefix'));_0x5ef6f4['use'](_0x3a29('0xef'),require(_0x3a29('0xf0')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xf1'),require(_0x3a29('0xf2')));_0x5ef6f4['use'](_0x3a29('0xf3'),require('./api/userProfileResource'));_0x5ef6f4[_0x3a29('0x8')]('/api/userNotifications',require(_0x3a29('0xf4')));_0x5ef6f4['use']('/api/whatsapp/accounts',require(_0x3a29('0xf5')));_0x5ef6f4[_0x3a29('0x8')]('/api/whatsapp/applications',require(_0x3a29('0xf6')));_0x5ef6f4[_0x3a29('0x8')]('/api/whatsapp/interactions',require(_0x3a29('0xf7')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xf8'),require(_0x3a29('0xf9')));_0x5ef6f4['use'](_0x3a29('0xfa'),require(_0x3a29('0xfb')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xfc'),require('./api/whatsappTransferReport'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xfd'),require(_0x3a29('0xfe')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0xff'),require(_0x3a29('0x100')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x101'),require(_0x3a29('0x102')));_0x5ef6f4[_0x3a29('0x8')]('/api/auth/local',require(_0x3a29('0x103')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x104'),require(_0x3a29('0x105')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x106'),require('./api/jira'));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x107'),require(_0x3a29('0x108')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x109'),require(_0x3a29('0x10a')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x10b'),require(_0x3a29('0x10c')));_0x5ef6f4[_0x3a29('0x8')]('/api/pm2',require(_0x3a29('0x10d')));_0x5ef6f4['use'](_0x3a29('0x10e'),require(_0x3a29('0x10f')));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x110'),express['static'](path[_0x3a29('0x111')](config['root'],_0x3a29('0x110'))));_0x5ef6f4['use']('/www',express[_0x3a29('0x112')](path[_0x3a29('0x111')](config[_0x3a29('0x113')],_0x3a29('0x114'))));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x115'),express[_0x3a29('0x112')](path[_0x3a29('0x111')](config['root'],_0x3a29('0x115'))));_0x5ef6f4[_0x3a29('0x8')](_0x3a29('0x116'),express[_0x3a29('0x112')](path[_0x3a29('0x111')](config[_0x3a29('0x113')],_0x3a29('0x117'),_0x3a29('0x118'))));_0x5ef6f4['use'](_0x3a29('0x119'),express['static'](path['join'](config[_0x3a29('0x113')],_0x3a29('0x11a'))));_0x5ef6f4[_0x3a29('0x11b')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x3a29('0x11c')](errors[0x194]);_0x5ef6f4[_0x3a29('0x11b')]('/*')[_0x3a29('0x11c')](function(_0xd90d92,_0x43c694){_0x43c694[_0x3a29('0x11d')](path[_0x3a29('0x11e')](_0x5ef6f4['get'](_0x3a29('0x11f'))+_0x3a29('0x120')));});};var sensitiveFields=[_0x3a29('0x121'),_0x3a29('0x122'),_0x3a29('0x123'),_0x3a29('0x124'),'firstName',_0x3a29('0x125'),_0x3a29('0x126'),_0x3a29('0x127'),_0x3a29('0x128'),'fax',_0x3a29('0x129'),_0x3a29('0x12a'),_0x3a29('0x12b'),_0x3a29('0x12c'),_0x3a29('0x12d'),_0x3a29('0x12e'),_0x3a29('0x12f'),_0x3a29('0x130'),_0x3a29('0x131'),_0x3a29('0x132'),'accessTokenSecret',_0x3a29('0x133'),_0x3a29('0x134'),'consumerSecret','membername',_0x3a29('0x135'),_0x3a29('0x136'),'exten',_0x3a29('0x137'),_0x3a29('0x138'),_0x3a29('0x139'),'accesskeyid',_0x3a29('0x13a'),'key',_0x3a29('0x11'),_0x3a29('0x13b'),'accountSid',_0x3a29('0x13c'),_0x3a29('0x13d'),_0x3a29('0x13e'),_0x3a29('0x13f'),_0x3a29('0x140')];function maskSensitiveData(_0x9bba94){var _0x487d67=/(?!^)[\s\S](?!$)/g;if(!_[_0x3a29('0x141')](_0x9bba94))return;for(var _0x5687d3 in _0x9bba94){if(_[_0x3a29('0x142')](_0x9bba94[_0x5687d3])){for(var _0x43e3d4=0x0;_0x43e3d4<_0x9bba94[_0x5687d3][_0x3a29('0x143')];_0x43e3d4++){maskSensitiveData(_0x9bba94[_0x5687d3][_0x43e3d4]);}}else if(_[_0x3a29('0x141')](_0x9bba94[_0x5687d3])){maskSensitiveData(_0x9bba94[_0x5687d3]);}else if(_[_0x3a29('0x144')](_0x9bba94[_0x5687d3])){_0x9bba94[_0x5687d3]=_0x9bba94[_0x5687d3][_0x3a29('0x145')](/{{{/g,_0x3a29('0x146'))[_0x3a29('0x145')](/}}}/g,_0x3a29('0x147'))[_0x3a29('0x145')](/{{/g,'@{')[_0x3a29('0x145')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x5687d3)){_0x9bba94[_0x5687d3]=_0x9bba94[_0x5687d3]['replace'](_0x487d67,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 59406f9..21698e3 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x86b1=['Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','jayson/promise','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.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/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log'];(function(_0x383627,_0x5be16e){var _0x2c16a0=function(_0x569b72){while(--_0x569b72){_0x383627['push'](_0x383627['shift']());}};_0x2c16a0(++_0x5be16e);}(_0x86b1,0x10a));var _0x186b=function(_0x1b7a9a,_0xc3832f){_0x1b7a9a=_0x1b7a9a-0x0;var _0x21113c=_0x86b1[_0x1b7a9a];return _0x21113c;};'use strict';var jayson=require(_0x186b('0x0'));var BPromise=require('bluebird');var _=require('lodash');var config=require('../config/environment');exports['listen']=function(){return new BPromise(function(_0xb13125,_0x4ca7c1){var _0x594557={};_0x594557=_[_0x186b('0x1')](_0x594557,require('../api/user/user.rpc'));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x2')));_0x594557=_['merge'](_0x594557,require(_0x186b('0x3')));_0x594557=_['merge'](_0x594557,require('../api/voiceRecording/voiceRecording.rpc'));_0x594557=_['merge'](_0x594557,require(_0x186b('0x4')));_0x594557=_['merge'](_0x594557,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x5')));_0x594557=_['merge'](_0x594557,require(_0x186b('0x6')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x7')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x8')));_0x594557=_[_0x186b('0x1')](_0x594557,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x9')));_0x594557=_['merge'](_0x594557,require(_0x186b('0xa')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0xb')));_0x594557=_['merge'](_0x594557,require(_0x186b('0xc')));_0x594557=_['merge'](_0x594557,require(_0x186b('0xd')));_0x594557=_['merge'](_0x594557,require(_0x186b('0xe')));_0x594557=_['merge'](_0x594557,require('../api/mailApplication/mailApplication.rpc'));_0x594557=_['merge'](_0x594557,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0xf')));_0x594557=_['merge'](_0x594557,require(_0x186b('0x10')));_0x594557=_[_0x186b('0x1')](_0x594557,require('../api/faxInteraction/faxInteraction.rpc'));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x11')));_0x594557=_['merge'](_0x594557,require(_0x186b('0x12')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x13')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x14')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x15')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x16')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x17')));_0x594557=_['merge'](_0x594557,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x18')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x19')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x1a')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x1b')));_0x594557=_[_0x186b('0x1')](_0x594557,require('../api/chatInteraction/chatInteraction.rpc'));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x1c')));_0x594557=_[_0x186b('0x1')](_0x594557,require('../api/chatQueue/chatQueue.rpc'));_0x594557=_[_0x186b('0x1')](_0x594557,require('../api/cmContact/cmContact.rpc'));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x1d')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x1e')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x1f')));_0x594557=_[_0x186b('0x1')](_0x594557,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x20')));_0x594557=_[_0x186b('0x1')](_0x594557,require('../api/interval/interval.rpc'));_0x594557=_['merge'](_0x594557,require(_0x186b('0x21')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x22')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x23')));_0x594557=_[_0x186b('0x1')](_0x594557,require('../api/trigger/trigger.rpc'));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x24')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x25')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x26')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x27')));_0x594557=_[_0x186b('0x1')](_0x594557,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x594557=_[_0x186b('0x1')](_0x594557,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x594557=_[_0x186b('0x1')](_0x594557,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x594557=_[_0x186b('0x1')](_0x594557,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x594557=_['merge'](_0x594557,require(_0x186b('0x28')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x29')));_0x594557=_['merge'](_0x594557,require(_0x186b('0x2a')));_0x594557=_['merge'](_0x594557,require(_0x186b('0x2b')));_0x594557=_['merge'](_0x594557,require(_0x186b('0x2c')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x2d')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x2e')));_0x594557=_[_0x186b('0x1')](_0x594557,require('../api/setting/setting.rpc'));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x2f')));_0x594557=_['merge'](_0x594557,require(_0x186b('0x30')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x31')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x32')));_0x594557=_['merge'](_0x594557,require(_0x186b('0x33')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x34')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x35')));_0x594557=_[_0x186b('0x1')](_0x594557,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x36')));_0x594557=_[_0x186b('0x1')](_0x594557,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x37')));_0x594557=_[_0x186b('0x1')](_0x594557,require(_0x186b('0x38')));var _0x3310f0=jayson[_0x186b('0x39')](_0x594557)[_0x186b('0x3a')]();var _0x8c4894=config[_0x186b('0x3b')]['port']||config[_0x186b('0x3c')]+0x1;var _0x43ab77=config[_0x186b('0x3b')]['ip']||_0x186b('0x3d');_0x3310f0['on'](_0x186b('0x3e'),function(_0x2e91d2){return _0x4ca7c1(_0x2e91d2);});_0x3310f0['listen'](_0x8c4894,_0x43ab77,function(){console[_0x186b('0x3f')](_0x186b('0x40'),_0x43ab77,_0x8c4894);require('../config/triggers')[_0x186b('0x41')]();return _0xb13125('RPC\x20listening\x20on\x20'+_0x43ab77+':'+_0x8c4894);});});}; \ No newline at end of file +var _0x3e1c=['../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','log','../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/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc'];(function(_0x325ee2,_0xaf1371){var _0x7f2741=function(_0x15569a){while(--_0x15569a){_0x325ee2['push'](_0x325ee2['shift']());}};_0x7f2741(++_0xaf1371);}(_0x3e1c,0xf0));var _0xc3e1=function(_0x2de854,_0x13cfc1){_0x2de854=_0x2de854-0x0;var _0x1c36bf=_0x3e1c[_0x2de854];return _0x1c36bf;};'use strict';var jayson=require(_0xc3e1('0x0'));var BPromise=require('bluebird');var _=require(_0xc3e1('0x1'));var config=require(_0xc3e1('0x2'));exports[_0xc3e1('0x3')]=function(){return new BPromise(function(_0x398431,_0x3f7764){var _0x2dd943={};_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x5')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x6')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x7')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x8')));_0x2dd943=_['merge'](_0x2dd943,require(_0xc3e1('0x9')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0xa')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x2dd943=_['merge'](_0x2dd943,require(_0xc3e1('0xb')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require('../api/memberReport/memberReport.rpc'));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require('../api/trunk/trunk.rpc'));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0xc')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0xd')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0xe')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0xf')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x10')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require('../api/mailMessage/mailMessage.rpc'));_0x2dd943=_['merge'](_0x2dd943,require('../api/mailApplication/mailApplication.rpc'));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x11')));_0x2dd943=_['merge'](_0x2dd943,require(_0xc3e1('0x12')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x13')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require('../api/faxInteraction/faxInteraction.rpc'));_0x2dd943=_['merge'](_0x2dd943,require(_0xc3e1('0x14')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x15')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x16')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require('../api/smsAccount/smsAccount.rpc'));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x17')));_0x2dd943=_['merge'](_0x2dd943,require(_0xc3e1('0x18')));_0x2dd943=_['merge'](_0x2dd943,require(_0xc3e1('0x19')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x1a')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x1b')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x1c')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x1d')));_0x2dd943=_['merge'](_0x2dd943,require(_0xc3e1('0x1e')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require('../api/chatMessage/chatMessage.rpc'));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x1f')));_0x2dd943=_['merge'](_0x2dd943,require(_0xc3e1('0x20')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x21')));_0x2dd943=_['merge'](_0x2dd943,require(_0xc3e1('0x22')));_0x2dd943=_['merge'](_0x2dd943,require(_0xc3e1('0x23')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x24')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x2dd943=_['merge'](_0x2dd943,require(_0xc3e1('0x25')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x26')));_0x2dd943=_['merge'](_0x2dd943,require(_0xc3e1('0x27')));_0x2dd943=_['merge'](_0x2dd943,require('../api/template/template.rpc'));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x28')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require('../api/variable/variable.rpc'));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x29')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x2dd943=_['merge'](_0x2dd943,require(_0xc3e1('0x2a')));_0x2dd943=_['merge'](_0x2dd943,require(_0xc3e1('0x2b')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x2c')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x2d')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x2e')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x2f')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x30')));_0x2dd943=_['merge'](_0x2dd943,require(_0xc3e1('0x31')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require('../api/squareReport/squareReport.rpc'));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x32')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x33')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x34')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x35')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x36')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x37')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x38')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require('../api/attachment/attachment.rpc'));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x39')));_0x2dd943=_['merge'](_0x2dd943,require(_0xc3e1('0x3a')));_0x2dd943=_['merge'](_0x2dd943,require(_0xc3e1('0x3b')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x3c')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x3d')));_0x2dd943=_[_0xc3e1('0x4')](_0x2dd943,require(_0xc3e1('0x3e')));var _0x49d0e8=jayson[_0xc3e1('0x3f')](_0x2dd943)['http']();var _0x234d01=config[_0xc3e1('0x40')][_0xc3e1('0x41')]||config[_0xc3e1('0x41')]+0x1;var _0x212339=config[_0xc3e1('0x40')]['ip']||_0xc3e1('0x42');_0x49d0e8['on'](_0xc3e1('0x43'),function(_0x25184d){return _0x3f7764(_0x25184d);});_0x49d0e8[_0xc3e1('0x3')](_0x234d01,_0x212339,function(){console[_0xc3e1('0x44')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x212339,_0x234d01);require(_0xc3e1('0x45'))[_0xc3e1('0x46')]();return _0x398431(_0xc3e1('0x47')+_0x212339+':'+_0x234d01);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index fb9790a..34cbb0f 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 _0x2ba6=['replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isBoolean','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setContext','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','call','utf8','setTimeout','setEncoding','headers','emit','ready','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','substring','no\x20code'];(function(_0xa1e3ca,_0x559022){var _0x5005ab=function(_0x12f90e){while(--_0x12f90e){_0xa1e3ca['push'](_0xa1e3ca['shift']());}};_0x5005ab(++_0x559022);}(_0x2ba6,0x1ea));var _0x62ba=function(_0x455251,_0x2c05cc){_0x455251=_0x455251-0x0;var _0x396239=_0x2ba6[_0x455251];return _0x396239;};'use strict';var util=require(_0x62ba('0x0'));var _=require(_0x62ba('0x1'));var EventEmitter=require(_0x62ba('0x2'))[_0x62ba('0x3')];var AGIReply=require(_0x62ba('0x4'));var AGIError=require('./error');function AGIChannel(_0xf21fcc){var _0x3b872f=this,_0x19316d=new AGIReply(),_0x362f2c=![],_0x42eef5={};EventEmitter[_0x62ba('0x5')](_0x3b872f);_0xf21fcc['setEncoding'](_0x62ba('0x6'));_0xf21fcc[_0x62ba('0x7')](0x8*0x3c*0x3c*0x3e8);_0x19316d[_0x62ba('0x8')]('utf8');_0x19316d['on'](_0x62ba('0x9'),function(_0x4963c2){for(var _0xb60414 in _0x4963c2){_0x3b872f[_0xb60414]=_0x4963c2[_0xb60414];}_0x3b872f[_0x62ba('0xa')](_0x62ba('0xb'));});_0x19316d['on'](_0x62ba('0xc'),function(_0x405e92){if(_0x405e92[_0x62ba('0xd')]()==_0x62ba('0xe')){_0x3b872f[_0x62ba('0xa')](_0x62ba('0xe'));return;}if(_0x405e92['substring'](0x0,0xb)==_0x62ba('0xf')){_0x362f2c=!![];}if(_0x362f2c){_0x42eef5['rx']+=_0x405e92+'\x0a';if(_0x405e92[_0x62ba('0x10')](_0x62ba('0x11'))!=-0x1){_0x362f2c=![];}}else{_0x42eef5['rx']=_0x405e92;}if(_0x362f2c){return;}if(typeof _0x42eef5['cb']=='function'){var _0x4a4aeb=_0x42eef5['rx'][_0x62ba('0x12')](0x0,0x3),_0x38b8ff=null,_0x408a4b=null;_0x4a4aeb=parseInt(_0x4a4aeb);if(isNaN(_0x4a4aeb)){_0x42eef5['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x62ba('0x13')});return;}if(_0x4a4aeb!=0xc8){_0x42eef5['cb'](null,{'code':_0x4a4aeb,'result':-0x1,'extra':'KO'});return;}_0x38b8ff=_0x42eef5['rx'][_0x62ba('0x12')](0x4)[_0x62ba('0x14')](_0x62ba('0x15'),'');if(_0x38b8ff[_0x62ba('0x16')]('\x20')!=-0x1){_0x38b8ff=_0x38b8ff[_0x62ba('0x17')](0x0,_0x38b8ff[_0x62ba('0x16')]('\x20'));}if(_[_0x62ba('0x18')](_0x38b8ff,'-1')){_0x38b8ff=parseInt(_0x38b8ff);}_0x408a4b=_0x42eef5['rx'][_0x62ba('0x19')]('\x20');if(_0x408a4b['length']==0x3){_0x408a4b=_0x408a4b[0x2][_0x62ba('0x12')](0x1,_0x408a4b[0x2][_0x62ba('0x1a')]-0x1);}else if(_0x408a4b[_0x62ba('0x1a')]>0x3){var _0x28ce61=/\((.+)\)/;var _0x49c41b=_0x42eef5['rx'][_0x62ba('0x1b')](_0x28ce61);if(_0x49c41b){_0x408a4b=_0x49c41b[0x1];}else{_0x408a4b=null;}}else{_0x408a4b=null;}_0x42eef5['cb'](null,{'code':_0x4a4aeb,'result':_0x38b8ff,'extra':_0x408a4b});}});_0xf21fcc['on'](_0x62ba('0x1c'),function(_0x3e0a33){_0x3b872f[_0x62ba('0xa')](_0x62ba('0x1c'),new AGIError(_0x62ba('0x1d'),_0x3e0a33['code']));});_0xf21fcc['on'](_0x62ba('0x1e'),function(){_0x3b872f[_0x62ba('0xa')](_0x62ba('0x1e'),new AGIError(_0x62ba('0x1f')));});_0xf21fcc['on'](_0x62ba('0x20'),function(){_0x3b872f[_0x62ba('0xa')](_0x62ba('0x20'),new AGIError(_0x62ba('0x21')));_0xf21fcc[_0x62ba('0x22')]();});_0xf21fcc[_0x62ba('0x23')](_0x19316d);this[_0x62ba('0x24')]=function(_0x2f7ab2,_0xb5e44a){var _0x2f7ab2=_0x2f7ab2||'',_0xb5e44a=typeof _0xb5e44a==_0x62ba('0x25')?_0xb5e44a:new Function();_0x42eef5={'tx':_0x2f7ab2,'rx':'','cb':_0xb5e44a};_0xf21fcc[_0x62ba('0x26')](_0x2f7ab2+'\x0a');},this[_0x62ba('0x1e')]=function(){_0xf21fcc[_0x62ba('0x22')]();};}util[_0x62ba('0x27')](AGIChannel,EventEmitter);AGIChannel[_0x62ba('0x28')][_0x62ba('0x29')]=function(_0x1c6b91){return this['command'][_0x62ba('0x2a')](this,_0x1c6b91);};AGIChannel[_0x62ba('0x28')][_0x62ba('0x2b')]=function(){return this[_0x62ba('0x29')](_0x62ba('0x2c'));};AGIChannel['prototype'][_0x62ba('0x2d')]=function(_0xd3d676,_0x2064da,_0x4b2721){_0xd3d676=_0xd3d676===undefined?_0x62ba('0x2e'):_0xd3d676;_0x2064da=_0x2064da===undefined?'5':_0x2064da;_0x4b2721=_0x4b2721===undefined?'1':_0x4b2721;return this[_0x62ba('0x29')](util['format'](_0x62ba('0x2f'),_0xd3d676,_0x2064da*0x3e8,_0x4b2721));};AGIChannel[_0x62ba('0x28')][_0x62ba('0x30')]=function(_0x4d4e57){_0x4d4e57=_0x4d4e57||_0x62ba('0x31');return this[_0x62ba('0x29')](util[_0x62ba('0x32')](_0x62ba('0x33'),_0x4d4e57));};AGIChannel[_0x62ba('0x28')][_0x62ba('0x34')]=function(_0x59f026,_0x362997){if(_[_0x62ba('0x35')](_0x362997)){return this['sendRequest'](util[_0x62ba('0x32')](_0x62ba('0x36'),_0x59f026,_0x362997[_0x62ba('0x37')](',')));}return this['sendRequest'](util['format'](_0x62ba('0x36'),_0x59f026,_0x362997));};AGIChannel[_0x62ba('0x28')]['setContext']=function(_0x4d42a4){return this[_0x62ba('0x29')](util[_0x62ba('0x32')](_0x62ba('0x38'),_0x4d42a4));};AGIChannel[_0x62ba('0x28')][_0x62ba('0x39')]=function(_0x11a1ce){return this['sendRequest'](util[_0x62ba('0x32')](_0x62ba('0x3a'),_0x11a1ce));};AGIChannel[_0x62ba('0x28')][_0x62ba('0x3b')]=function(_0x12503a){return this['sendRequest'](util[_0x62ba('0x32')]('SET\x20PRIORITY\x20%s',_0x12503a));};AGIChannel[_0x62ba('0x28')][_0x62ba('0xe')]=function(){return this['sendRequest'](_0x62ba('0x3c'));};AGIChannel['prototype'][_0x62ba('0x3d')]=function(_0x2cc332,_0x175ac7){var _0x108a15=_[_0x62ba('0x3e')](_0x175ac7)||_['isNumber'](_0x175ac7)?_0x175ac7['toString']():_0x175ac7;return this[_0x62ba('0x29')](util[_0x62ba('0x32')](_0x62ba('0x3f'),_0x2cc332,_0x108a15?_0x108a15[_0x62ba('0x40')]()[_0x62ba('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x62ba('0x28')]['sayNumber']=function(_0x1a2dfd,_0x194527){return this['sendRequest'](util[_0x62ba('0x32')](_0x62ba('0x41'),_0x1a2dfd,_0x194527));};AGIChannel[_0x62ba('0x28')][_0x62ba('0x42')]=function(_0x2f88cd,_0x26dc74){return this[_0x62ba('0x29')](util[_0x62ba('0x32')]('SAY\x20DIGITS\x20%s\x20%s',_0x2f88cd,_0x26dc74));};AGIChannel[_0x62ba('0x28')][_0x62ba('0x43')]=function(_0x1353ae,_0x5eb3b3){return this[_0x62ba('0x29')](util[_0x62ba('0x32')](_0x62ba('0x44'),_0x1353ae,_0x5eb3b3));};AGIChannel[_0x62ba('0x28')]['continueAt']=function(_0x37e19e,_0x12d4c7,_0x4b3179){_0x12d4c7=_0x12d4c7||this[_0x62ba('0x45')];_0x4b3179=_0x4b3179||0x1;this[_0x62ba('0x46')](_0x37e19e);this[_0x62ba('0x39')](_0x12d4c7);this['setPriority'](_0x4b3179);return this[_0x62ba('0x30')](util[_0x62ba('0x32')]('GOTO\x20%s\x20%s\x20%s',_0x37e19e,_0x12d4c7,_0x4b3179));};AGIChannel[_0x62ba('0x28')][_0x62ba('0x47')]=function(_0x33997d){return this['sendRequest'](util[_0x62ba('0x32')](_0x62ba('0x48'),_0x33997d));};AGIChannel[_0x62ba('0x28')][_0x62ba('0x49')]=function(_0x420bf1,_0x5b8e85,_0x311e7f,_0x79e04f,_0x419d13,_0x489511){_0x5b8e85=_0x5b8e85||_0x62ba('0x4a');_0x311e7f=_0x311e7f||'';_0x79e04f=_0x79e04f===undefined?-0x1:_0x79e04f==='-1'?-0x1:_0x79e04f*0x3e8;_0x419d13=_0x419d13===undefined?'':'s='+_0x419d13;_0x489511=_0x489511?_0x62ba('0x4b'):'';return this[_0x62ba('0x29')](util[_0x62ba('0x32')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x420bf1,_0x5b8e85,_0x311e7f,_0x79e04f,_0x489511,_0x419d13));};AGIChannel[_0x62ba('0x28')][_0x62ba('0x4c')]=function(_0x3a9fa9,_0x22fcfc){_0x22fcfc=_0x22fcfc||'';return this[_0x62ba('0x29')](util[_0x62ba('0x32')](_0x62ba('0x4d'),_0x3a9fa9,_0x22fcfc));};AGIChannel[_0x62ba('0x28')][_0x62ba('0x4e')]=function(_0x52b6d0){return this[_0x62ba('0x34')](_0x62ba('0x4f'),_0x52b6d0);};AGIChannel[_0x62ba('0x28')][_0x62ba('0x50')]=function(_0x374305){return this[_0x62ba('0x34')](_0x62ba('0x51'),_0x374305);};AGIChannel[_0x62ba('0x28')]['error']=function(_0x373594,_0x19dc6b){this['noop'](util['format'](_0x62ba('0x52'),_0x373594['id'],_0x373594[_0x62ba('0x53')],_0x19dc6b));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x62ba('0x54')]=AGIChannel; \ No newline at end of file +var _0xf1c6=['wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','EventEmitter','./reply','./error','call','setTimeout','setEncoding','utf8','headers','line','toLowerCase','hangup','emit','520-Invalid','search','function','substring','replace','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','inherits','prototype','sendRequest','answer','ANSWER','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','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'];(function(_0x5c26aa,_0x55ab9d){var _0x327baf=function(_0x36265b){while(--_0x36265b){_0x5c26aa['push'](_0x5c26aa['shift']());}};_0x327baf(++_0x55ab9d);}(_0xf1c6,0xf4));var _0x6f1c=function(_0x5aef32,_0x52496b){_0x5aef32=_0x5aef32-0x0;var _0x57621c=_0xf1c6[_0x5aef32];return _0x57621c;};'use strict';var util=require(_0x6f1c('0x0'));var _=require(_0x6f1c('0x1'));var EventEmitter=require(_0x6f1c('0x2'))[_0x6f1c('0x3')];var AGIReply=require(_0x6f1c('0x4'));var AGIError=require(_0x6f1c('0x5'));function AGIChannel(_0x15b146){var _0x48b5bf=this,_0x3747f8=new AGIReply(),_0x2c875e=![],_0x2af48e={};EventEmitter[_0x6f1c('0x6')](_0x48b5bf);_0x15b146['setEncoding']('utf8');_0x15b146[_0x6f1c('0x7')](0x8*0x3c*0x3c*0x3e8);_0x3747f8[_0x6f1c('0x8')](_0x6f1c('0x9'));_0x3747f8['on'](_0x6f1c('0xa'),function(_0x10f531){for(var _0x316e0e in _0x10f531){_0x48b5bf[_0x316e0e]=_0x10f531[_0x316e0e];}_0x48b5bf['emit']('ready');});_0x3747f8['on'](_0x6f1c('0xb'),function(_0x33459a){if(_0x33459a[_0x6f1c('0xc')]()==_0x6f1c('0xd')){_0x48b5bf[_0x6f1c('0xe')](_0x6f1c('0xd'));return;}if(_0x33459a['substring'](0x0,0xb)==_0x6f1c('0xf')){_0x2c875e=!![];}if(_0x2c875e){_0x2af48e['rx']+=_0x33459a+'\x0a';if(_0x33459a[_0x6f1c('0x10')]('520\x20End\x20of\x20proper')!=-0x1){_0x2c875e=![];}}else{_0x2af48e['rx']=_0x33459a;}if(_0x2c875e){return;}if(typeof _0x2af48e['cb']==_0x6f1c('0x11')){var _0x5b3e91=_0x2af48e['rx'][_0x6f1c('0x12')](0x0,0x3),_0x5aa99e=null,_0x380d6=null;_0x5b3e91=parseInt(_0x5b3e91);if(isNaN(_0x5b3e91)){_0x2af48e['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x5b3e91!=0xc8){_0x2af48e['cb'](null,{'code':_0x5b3e91,'result':-0x1,'extra':'KO'});return;}_0x5aa99e=_0x2af48e['rx']['substring'](0x4)[_0x6f1c('0x13')]('result=','');if(_0x5aa99e[_0x6f1c('0x14')]('\x20')!=-0x1){_0x5aa99e=_0x5aa99e[_0x6f1c('0x15')](0x0,_0x5aa99e[_0x6f1c('0x14')]('\x20'));}if(_[_0x6f1c('0x16')](_0x5aa99e,'-1')){_0x5aa99e=parseInt(_0x5aa99e);}_0x380d6=_0x2af48e['rx'][_0x6f1c('0x17')]('\x20');if(_0x380d6[_0x6f1c('0x18')]==0x3){_0x380d6=_0x380d6[0x2][_0x6f1c('0x12')](0x1,_0x380d6[0x2]['length']-0x1);}else if(_0x380d6[_0x6f1c('0x18')]>0x3){var _0x554c42=/\((.+)\)/;var _0x20a8cf=_0x2af48e['rx']['match'](_0x554c42);if(_0x20a8cf){_0x380d6=_0x20a8cf[0x1];}else{_0x380d6=null;}}else{_0x380d6=null;}_0x2af48e['cb'](null,{'code':_0x5b3e91,'result':_0x5aa99e,'extra':_0x380d6});}});_0x15b146['on'](_0x6f1c('0x19'),function(_0x66103a){_0x48b5bf['emit']('error',new AGIError(_0x6f1c('0x1a'),_0x66103a[_0x6f1c('0x1b')]));});_0x15b146['on'](_0x6f1c('0x1c'),function(){_0x48b5bf['emit'](_0x6f1c('0x1c'),new AGIError(_0x6f1c('0x1d')));});_0x15b146['on'](_0x6f1c('0x1e'),function(){_0x48b5bf['emit'](_0x6f1c('0x1e'),new AGIError(_0x6f1c('0x1f')));_0x15b146[_0x6f1c('0x20')]();});_0x15b146['pipe'](_0x3747f8);this[_0x6f1c('0x21')]=function(_0xebf430,_0x493b44){var _0xebf430=_0xebf430||'',_0x493b44=typeof _0x493b44==_0x6f1c('0x11')?_0x493b44:new Function();_0x2af48e={'tx':_0xebf430,'rx':'','cb':_0x493b44};_0x15b146[_0x6f1c('0x22')](_0xebf430+'\x0a');},this['close']=function(){_0x15b146[_0x6f1c('0x20')]();};}util[_0x6f1c('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x6f1c('0x24')][_0x6f1c('0x25')]=function(_0xa9c80d){return this[_0x6f1c('0x21')]['sync'](this,_0xa9c80d);};AGIChannel[_0x6f1c('0x24')][_0x6f1c('0x26')]=function(){return this[_0x6f1c('0x25')](_0x6f1c('0x27'));};AGIChannel[_0x6f1c('0x24')]['getData']=function(_0x2c6da4,_0x43cfb4,_0x2185a7){_0x2c6da4=_0x2c6da4===undefined?_0x6f1c('0x28'):_0x2c6da4;_0x43cfb4=_0x43cfb4===undefined?'5':_0x43cfb4;_0x2185a7=_0x2185a7===undefined?'1':_0x2185a7;return this[_0x6f1c('0x25')](util[_0x6f1c('0x29')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x2c6da4,_0x43cfb4*0x3e8,_0x2185a7));};AGIChannel['prototype'][_0x6f1c('0x2a')]=function(_0x2b3732){_0x2b3732=_0x2b3732||_0x6f1c('0x2b');return this['sendRequest'](util[_0x6f1c('0x29')](_0x6f1c('0x2c'),_0x2b3732));};AGIChannel[_0x6f1c('0x24')][_0x6f1c('0x2d')]=function(_0x4d38ad,_0x127b90){if(_[_0x6f1c('0x2e')](_0x127b90)){return this['sendRequest'](util[_0x6f1c('0x29')](_0x6f1c('0x2f'),_0x4d38ad,_0x127b90[_0x6f1c('0x30')](',')));}return this['sendRequest'](util[_0x6f1c('0x29')]('EXEC\x20%s\x20%s',_0x4d38ad,_0x127b90));};AGIChannel[_0x6f1c('0x24')][_0x6f1c('0x31')]=function(_0x35231b){return this['sendRequest'](util['format'](_0x6f1c('0x32'),_0x35231b));};AGIChannel[_0x6f1c('0x24')][_0x6f1c('0x33')]=function(_0x19fac4){return this[_0x6f1c('0x25')](util[_0x6f1c('0x29')](_0x6f1c('0x34'),_0x19fac4));};AGIChannel[_0x6f1c('0x24')][_0x6f1c('0x35')]=function(_0x4381d7){return this[_0x6f1c('0x25')](util[_0x6f1c('0x29')](_0x6f1c('0x36'),_0x4381d7));};AGIChannel[_0x6f1c('0x24')][_0x6f1c('0xd')]=function(){return this['sendRequest'](_0x6f1c('0x37'));};AGIChannel[_0x6f1c('0x24')][_0x6f1c('0x38')]=function(_0x333126,_0x500982){var _0x2fb07d=_[_0x6f1c('0x39')](_0x500982)||_[_0x6f1c('0x3a')](_0x500982)?_0x500982[_0x6f1c('0x3b')]():_0x500982;return this[_0x6f1c('0x25')](util[_0x6f1c('0x29')](_0x6f1c('0x3c'),_0x333126,_0x2fb07d?_0x2fb07d['toString']()[_0x6f1c('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x6f1c('0x24')][_0x6f1c('0x3d')]=function(_0xc51712,_0x1e2264){return this[_0x6f1c('0x25')](util[_0x6f1c('0x29')](_0x6f1c('0x3e'),_0xc51712,_0x1e2264));};AGIChannel[_0x6f1c('0x24')][_0x6f1c('0x3f')]=function(_0x549fc6,_0x3e6c0a){return this[_0x6f1c('0x25')](util[_0x6f1c('0x29')](_0x6f1c('0x40'),_0x549fc6,_0x3e6c0a));};AGIChannel[_0x6f1c('0x24')][_0x6f1c('0x41')]=function(_0x3f859f,_0x248fc4){return this[_0x6f1c('0x25')](util[_0x6f1c('0x29')](_0x6f1c('0x42'),_0x3f859f,_0x248fc4));};AGIChannel['prototype'][_0x6f1c('0x43')]=function(_0x13d734,_0x300b2e,_0x59f65a){_0x300b2e=_0x300b2e||this['extension'];_0x59f65a=_0x59f65a||0x1;this[_0x6f1c('0x31')](_0x13d734);this['setExtension'](_0x300b2e);this['setPriority'](_0x59f65a);return this[_0x6f1c('0x2a')](util[_0x6f1c('0x29')](_0x6f1c('0x44'),_0x13d734,_0x300b2e,_0x59f65a));};AGIChannel['prototype'][_0x6f1c('0x45')]=function(_0x210509){return this[_0x6f1c('0x25')](util[_0x6f1c('0x29')](_0x6f1c('0x46'),_0x210509));};AGIChannel[_0x6f1c('0x24')]['recordFile']=function(_0x3e2160,_0x30a9c6,_0x113378,_0x234d79,_0x1a506b,_0x307e7e){_0x30a9c6=_0x30a9c6||_0x6f1c('0x47');_0x113378=_0x113378||'';_0x234d79=_0x234d79===undefined?-0x1:_0x234d79==='-1'?-0x1:_0x234d79*0x3e8;_0x1a506b=_0x1a506b===undefined?'':'s='+_0x1a506b;_0x307e7e=_0x307e7e?_0x6f1c('0x48'):'';return this[_0x6f1c('0x25')](util[_0x6f1c('0x29')](_0x6f1c('0x49'),_0x3e2160,_0x30a9c6,_0x113378,_0x234d79,_0x307e7e,_0x1a506b));};AGIChannel[_0x6f1c('0x24')]['streamFile']=function(_0x51117d,_0x346415){_0x346415=_0x346415||'';return this['sendRequest'](util[_0x6f1c('0x29')](_0x6f1c('0x4a'),_0x51117d,_0x346415));};AGIChannel['prototype'][_0x6f1c('0x4b')]=function(_0x25b392){return this[_0x6f1c('0x2d')]('AGI',_0x25b392);};AGIChannel['prototype'][_0x6f1c('0x4c')]=function(_0x15092d){return this[_0x6f1c('0x2d')](_0x6f1c('0x4d'),_0x15092d);};AGIChannel['prototype'][_0x6f1c('0x19')]=function(_0x1cbe9f,_0x3423b1){this[_0x6f1c('0x2a')](util[_0x6f1c('0x29')](_0x6f1c('0x4e'),_0x1cbe9f['id'],_0x1cbe9f['label'],_0x3423b1));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6f1c('0x4f')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 210b8ab..a956d13 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 _0x9086=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','message','exports','util','Undefined\x20error.'];(function(_0x587845,_0x3115b9){var _0x1c2292=function(_0x174e88){while(--_0x174e88){_0x587845['push'](_0x587845['shift']());}};_0x1c2292(++_0x3115b9);}(_0x9086,0x129));var _0x6908=function(_0x499227,_0x3a8c2c){_0x499227=_0x499227-0x0;var _0xec1c0a=_0x9086[_0x499227];return _0xec1c0a;};'use strict';var util=require(_0x6908('0x0'));var error={'E_AGI_UNDEFINED':_0x6908('0x1'),'E_AGI_ARGUMENT_PORT':_0x6908('0x2'),'E_AGI_SERVER_ERROR':_0x6908('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x6908('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x6908('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x6908('0x6'),'E_AGI_COMMAND_EMPTY':_0x6908('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x6908('0x8')};function AGIError(_0x55eb42){var _0x55eb42=_0x55eb42||null,_0x47de78=_0x47de78||[],_0x528412=0x1,_0x3124ac='';if(!error[_0x55eb42]){_0x55eb42=_0x6908('0x9');}_0x47de78[_0x6908('0xa')](error[_0x55eb42]);while(arguments[_0x528412]){_0x47de78[_0x6908('0xa')](arguments[_0x528412]);_0x528412++;}_0x3124ac=util['format']['apply'](util,_0x47de78);this[_0x6908('0xb')]=_0x3124ac;this['name']=_0x55eb42;}module[_0x6908('0xc')]=AGIError; \ No newline at end of file +var _0x0fc0=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','apply','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x297a28,_0x4de5b1){var _0x41b142=function(_0x3261dd){while(--_0x3261dd){_0x297a28['push'](_0x297a28['shift']());}};_0x41b142(++_0x4de5b1);}(_0x0fc0,0x10e));var _0x00fc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0fc0[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x00fc('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x00fc('0x1'),'E_AGI_SERVER_ERROR':_0x00fc('0x2'),'E_AGI_SERVER_CLOSE':_0x00fc('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x00fc('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x00fc('0x5'),'E_AGI_SOCKET_ERROR':_0x00fc('0x6'),'E_AGI_SOCKET_CLOSE':_0x00fc('0x7'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x00fc('0x8'),'E_AGI_IVR_ENTRY':_0x00fc('0x9')};function AGIError(_0x5e62c1){var _0x5e62c1=_0x5e62c1||null,_0x2a1310=_0x2a1310||[],_0x2c2afc=0x1,_0x18aecb='';if(!error[_0x5e62c1]){_0x5e62c1='E_AGI_UNDEFINED';}_0x2a1310['push'](error[_0x5e62c1]);while(arguments[_0x2c2afc]){_0x2a1310['push'](arguments[_0x2c2afc]);_0x2c2afc++;}_0x18aecb=util['format'][_0x00fc('0xa')](util,_0x2a1310);this['message']=_0x18aecb;this[_0x00fc('0xb')]=_0x5e62c1;}module[_0x00fc('0xc')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 8fc4831..5943444 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 _0xdca2=['condition','split','length','agicommand','vswitch','default','target','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','agi','getdigits','vertices','edges','prototype','addEdge','push','numberOfEdges','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','stop\x20traverse','info','no\x20edge/s\x20available'];(function(_0x80d733,_0x266211){var _0x435868=function(_0x2ae0f0){while(--_0x2ae0f0){_0x80d733['push'](_0x80d733['shift']());}};_0x435868(++_0x266211);}(_0xdca2,0xfd));var _0x2dca=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xdca2[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x2dca('0x0'));var logger=require('../../../config/logger')(_0x2dca('0x1'));var verticesWithRetry=['menu',_0x2dca('0x2'),'getsecretdigits'];var Graph=function(){this[_0x2dca('0x3')]={};this[_0x2dca('0x4')]={};this['numberOfEdges']=0x0;};Graph[_0x2dca('0x5')]['addVertex']=function(_0xd11d9){this[_0x2dca('0x3')][_0xd11d9['id']]=_0xd11d9;this['edges'][_0xd11d9['id']]=[];};Graph['prototype'][_0x2dca('0x6')]=function(_0x521c9e,_0x2e86ee,_0x4ca861){this['edges'][_0x521c9e][_0x2dca('0x7')]({'target':_0x2e86ee,'condition':_0x4ca861});this[_0x2dca('0x8')]+=0x1;};Graph[_0x2dca('0x5')][_0x2dca('0x9')]=function(){return _['size'](this[_0x2dca('0x3')]);};Graph['prototype'][_0x2dca('0xa')]=function(){return this[_0x2dca('0x8')];};Graph[_0x2dca('0x5')][_0x2dca('0xb')]=function(_0x4cb278){return this['vertices'][_0x4cb278];};Graph[_0x2dca('0x5')][_0x2dca('0xc')]=function(_0x451c91,_0x368bf1){if(!this[_0x2dca('0x3')][_0x451c91]){return logger['info'](_0x2dca('0xd'));}var _0x246ea4=_0x368bf1(this[_0x2dca('0x3')][_0x451c91]);if(!_0x246ea4){return logger['info'](_0x2dca('0xe'));}if(this['edges'][_0x451c91]['length']===0x0){return logger[_0x2dca('0xf')](_0x2dca('0x10'));}for(var _0x34c526=0x0,_0x53ce05=[],_0x49caaf=![];_0x34c526\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','sync','production','start','debug','mxCell','clear','vertex','gotoc','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','lodash','util','moment','../../config/environment','../../config/logger','agi','./rpc','./mailRpc','./vertices','defaults','127.0.0.1','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','name','message','format','[%s]\x20%s','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','root','agicommand','retry','maxRetry','addVertex','hasOwnProperty','isArray','length','source','target','then','catch','createSquareReport','agi_','substring','inspect'];(function(_0x2d93e4,_0x10b13e){var _0x177a6a=function(_0x4e9127){while(--_0x4e9127){_0x2d93e4['push'](_0x2d93e4['shift']());}};_0x177a6a(++_0x10b13e);}(_0xd7de,0x17f));var _0xed7d=function(_0xb9adec,_0x3400b6){_0xb9adec=_0xb9adec-0x0;var _0x553c2=_0xd7de[_0xb9adec];return _0x553c2;};'use strict';var parser=require('xml2json');var _=require(_0xed7d('0x0'));var syncho=require('syncho');var util=require(_0xed7d('0x1'));var moment=require(_0xed7d('0x2'));var config=require(_0xed7d('0x3'));var logger=require(_0xed7d('0x4'))(_0xed7d('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0xed7d('0x6'));var mailRpc=require(_0xed7d('0x7'));var Graph=require('./graph');var Vertices=require(_0xed7d('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0xed7d('0x9')](config[_0xed7d('0x5')],{'ip':_0xed7d('0xa'),'port':0x11dd});function connectionHandler(_0x3009ad){process[_0xed7d('0xb')](function(){syncho(function(){try{setChannelVariables(_0x3009ad);agiHandler(_0x3009ad);}catch(_0xfc9a8f){logger[_0xed7d('0xc')](_0xfc9a8f['stack']);}});});}function listeningHandler(){console[_0xed7d('0xd')](_0xed7d('0xe'),config['agi'][_0xed7d('0xf')]);logger[_0xed7d('0x10')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xed7d('0x5')]['ip'],config[_0xed7d('0x5')][_0xed7d('0xf')]));}function errorHandler(_0x627ab9){if(_0x627ab9&&_0x627ab9[_0xed7d('0x11')]&&_0x627ab9[_0xed7d('0x12')]){logger['error'](util[_0xed7d('0x13')](_0xed7d('0x14'),_0x627ab9[_0xed7d('0x11')],_0x627ab9[_0xed7d('0x12')]));}else{logger[_0xed7d('0xc')](util[_0xed7d('0x13')](_0xed7d('0x15'),_0x627ab9[_0xed7d('0x16')]));}}function closeHandler(){logger['info'](util[_0xed7d('0x13')](_0xed7d('0x17'),this[_0xed7d('0x18')],this['calleridname'],this['callerid'],this['dnid'],this[_0xed7d('0x19')]));try{createSquareReport(this);}catch(_0x5d8740){logger[_0xed7d('0xc')](_0x5d8740[_0xed7d('0x16')]);}}function timeoutHandler(){logger[_0xed7d('0x10')](util['format'](_0xed7d('0x1a'),this[_0xed7d('0x18')],this[_0xed7d('0x1b')],this[_0xed7d('0x1c')],this[_0xed7d('0x1d')],this['uniqueid']));}function hangupHandler(){logger[_0xed7d('0x10')](util[_0xed7d('0x13')](_0xed7d('0x1e'),this[_0xed7d('0x18')],this[_0xed7d('0x1b')],this['callerid'],this[_0xed7d('0x1d')],this[_0xed7d('0x19')]));this['evtHangup']=!![];}function getRoot(_0x258f6f){return parser['toJson'](_0x258f6f,{'object':!![]})['mxGraphModel'][_0xed7d('0x1f')];}function addVertex(_0x19183c,_0x5898f6,_0x2bb3c8){_0x5898f6[_0xed7d('0x20')]=_0x2bb3c8;if(_0x5898f6['hasOwnProperty'](_0xed7d('0x21'))){_0x5898f6[_0xed7d('0x22')]=parseInt(_0x5898f6[_0xed7d('0x21')],0xa);}_0x19183c[_0xed7d('0x23')](_['omit'](_0x5898f6,'mxCell'));}function initGraph(_0x120582,_0x183d69){var _0x2141fd=new Graph();for(var _0x3e319e in _0x120582){if(_0x120582[_0xed7d('0x24')](_0x3e319e)){if(_[_0xed7d('0x25')](_0x120582[_0x3e319e])){for(var _0x55b88f=0x0;_0x55b88f<_0x120582[_0x3e319e][_0xed7d('0x26')];_0x55b88f+=0x1){addVertex(_0x2141fd,_0x120582[_0x3e319e][_0x55b88f],_0x3e319e);}}else{addVertex(_0x2141fd,_0x120582[_0x3e319e],_0x3e319e);}}}for(var _0x11ceff=0x0;_0x11ceff<_0x183d69[_0xed7d('0x26')];_0x11ceff+=0x1){if(_0x183d69[_0x11ceff][_0xed7d('0x27')]&&_0x183d69[_0x11ceff][_0xed7d('0x28')]){_0x2141fd['addEdge'](_0x183d69[_0x11ceff]['source'],_0x183d69[_0x11ceff][_0xed7d('0x28')],_0x183d69[_0x11ceff]['value']);}}return _0x2141fd;}function getSquareProject(_0x1ab1fa,_0xf98f28){rpc['getSquareProject'](_0x1ab1fa)[_0xed7d('0x29')](function(_0x1a90a4){_0xf98f28(null,_0x1a90a4);})[_0xed7d('0x2a')](function(_0x2182a2){_0xf98f28(null,_0x2182a2);});}function createSquareReport(_0x2fd4c2,_0x2ab58e){rpc[_0xed7d('0x2b')](_0x2fd4c2)['then'](function(_0x1c1437){if(_0x2ab58e){_0x2ab58e(null,_0x1c1437);}})[_0xed7d('0x2a')](function(_0x46736a){if(_0x2ab58e){_0x2ab58e(null,_0x46736a);}});}function setChannelVariables(_0x2aef2b){for(var _0x525b0d in _0x2aef2b){if(_0x2aef2b['hasOwnProperty'](_0x525b0d)){if(_0x525b0d['indexOf'](_0xed7d('0x2c'))===0x0){_0x2aef2b[_0x525b0d[_0xed7d('0x2d')](0x4)]=_0x2aef2b[_0x525b0d];delete _0x2aef2b[_0x525b0d];}}}}function getLogFromObject(_0x2c88d2){return util[_0xed7d('0x2e')](_0x2c88d2,{'showHidden':![],'depth':null});}function agiHandler(_0x2f756e){var _0x54a7d0,_0x292153,_0x4f2996,_0x2f938b,_0x532027;logger['debug'](_0xed7d('0x2f'),JSON[_0xed7d('0x30')](_0x2f756e,null,0x2));logger['info'](util['format'](_0xed7d('0x31'),_0x2f756e[_0xed7d('0x18')],_0x2f756e['calleridname'],_0x2f756e[_0xed7d('0x1c')],_0x2f756e[_0xed7d('0x1d')],_0x2f756e[_0xed7d('0x19')]));_0x2f756e['on'](_0xed7d('0xc'),errorHandler);_0x2f756e['on'](_0xed7d('0x32'),closeHandler);_0x2f756e['on'](_0xed7d('0x33'),timeoutHandler);_0x2f756e[_0xed7d('0x34')]=![];_0x2f756e['on'](_0xed7d('0x35'),hangupHandler);var _0x44b0a0=getSquareProject[_0xed7d('0x36')](null,_0x2f756e['arg_1']);if(_0x44b0a0){if(_0x44b0a0[_0xed7d('0x37')]){_0x54a7d0=getRoot(_0x44b0a0[_0xed7d('0x37')]);if(_0x54a7d0&&_0x54a7d0[_0xed7d('0x38')]){logger[_0xed7d('0x39')](_0xed7d('0x1f'),JSON[_0xed7d('0x30')](_0x54a7d0,null,0x2));_0x2f756e['joinAt']=moment()[_0xed7d('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x292153=initGraph(_['omit'](_0x54a7d0,'mxCell'),_0x54a7d0[_0xed7d('0x3a')]);_0x4f2996=new Vertices(_0x2f756e,rpc,mailRpc);logger[_0xed7d('0x10')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2f756e[_0xed7d('0x18')],_0x2f756e[_0xed7d('0x1b')],_0x2f756e[_0xed7d('0x1c')],_0x2f756e[_0xed7d('0x1d')],_0x2f756e['uniqueid']));_0x292153['traverseBFS'](_0x54a7d0[_0xed7d('0x38')]['id'],function(_0x320f1e){try{_0x320f1e=_0x4f2996[_0xed7d('0x3b')](_0x320f1e);logger[_0xed7d('0x39')](_0xed7d('0x3c'),JSON[_0xed7d('0x30')](_0x320f1e,null,0x2));if(_0x320f1e[_0xed7d('0x20')]===_0xed7d('0x3d')){logger[_0xed7d('0x10')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x2f756e[_0xed7d('0x3e')]=_0x320f1e['context']||_0x2f756e[_0xed7d('0x3e')];_0x2f756e[_0xed7d('0x3f')]=_0x320f1e['extension'];_0x2f756e[_0xed7d('0x40')]=_0x320f1e[_0xed7d('0x40')]?_0x320f1e[_0xed7d('0x40')]-0x1:0x1;return null;}else if(_0x320f1e&&_0x4f2996[_0x320f1e[_0xed7d('0x20')]]){_0x532027=_0x4f2996[_0x320f1e[_0xed7d('0x20')]](_0x320f1e);logger[_0xed7d('0x10')](_0xed7d('0x41'),JSON[_0xed7d('0x30')](_0x532027,null,0x2));if(_0x532027&&_0x532027[_0xed7d('0x42')]===AGI_CODE_SUCCESS&&_0x532027[_0xed7d('0x43')]!==AGI_RESULT_ERROR&&!_0x2f756e[_0xed7d('0x34')]){logger[_0xed7d('0x39')](_0xed7d('0x41'),getLogFromObject(_0x532027));return _[_0xed7d('0x44')](_0x532027[_0xed7d('0x43')])?null:_0x532027[_0xed7d('0x43')][_0xed7d('0x45')]();}else{logger[_0xed7d('0xc')]('response',getLogFromObject(_0x532027));return null;}}else{logger[_0xed7d('0xc')](_0xed7d('0x46'));return null;}}catch(_0x5887ba){logger[_0xed7d('0xc')](_0x5887ba[_0xed7d('0x16')]);return null;}});if(_0x54a7d0[_0xed7d('0x47')]){logger[_0xed7d('0x10')](util[_0xed7d('0x13')](_0xed7d('0x48'),_0x2f756e[_0xed7d('0x18')],_0x2f756e['calleridname'],_0x2f756e[_0xed7d('0x1c')],_0x2f756e['dnid'],_0x2f756e[_0xed7d('0x19')]));_0x292153[_0xed7d('0x49')](_0x54a7d0['finally']['id'],function(_0x5b1359){try{_0x5b1359=_0x4f2996[_0xed7d('0x3b')](_0x5b1359);logger[_0xed7d('0x39')]('vertex',JSON['stringify'](_0x5b1359,null,0x2));if(_0x5b1359&&_0x4f2996[_0x5b1359[_0xed7d('0x20')]]){_0x532027=_0x4f2996[_0x5b1359['agicommand']](_0x5b1359);if(_0x532027){logger[_0xed7d('0x39')](_0xed7d('0x41'),getLogFromObject(_0x532027));return _['isUndefined'](_0x532027['result'])?null:_0x532027['result'][_0xed7d('0x45')]();}else{logger['error'](_0xed7d('0x41'),getLogFromObject(_0x532027));return null;}}else{logger[_0xed7d('0xc')](_0xed7d('0x46'));return null;}}catch(_0x1d532c){logger['error'](_0x1d532c[_0xed7d('0x16')]);return null;}});}logger['info'](util[_0xed7d('0x13')](_0xed7d('0x4a'),_0x2f756e[_0xed7d('0x18')],_0x2f756e[_0xed7d('0x1b')],_0x2f756e[_0xed7d('0x1c')],_0x2f756e[_0xed7d('0x1d')],_0x2f756e['uniqueid']));logger[_0xed7d('0x10')](util[_0xed7d('0x13')](_0xed7d('0x4b'),_0x2f756e[_0xed7d('0x3e')],_0x2f756e[_0xed7d('0x3f')],parseInt(_0x2f756e[_0xed7d('0x40')],0xa)+0x1));_0x2f756e[_0xed7d('0x4c')](_0x2f756e[_0xed7d('0x3e')],_0x2f756e[_0xed7d('0x3f')],parseInt(_0x2f756e[_0xed7d('0x40')],0xa)+0x1);_0x2f756e[_0xed7d('0x32')]();}}else{logger[_0xed7d('0xc')](util[_0xed7d('0x13')](_0xed7d('0x4d'),_0x2f756e[_0xed7d('0x18')]));_0x2f756e[_0xed7d('0x4c')](_0x2f756e[_0xed7d('0x3e')],_0x2f756e[_0xed7d('0x3f')],parseInt(_0x2f756e['priority'],0xa)+0x1);_0x2f756e[_0xed7d('0x32')]();}}else{logger[_0xed7d('0xc')](util[_0xed7d('0x13')]('Project\x20%s\x20not\x20found',_0x2f756e[_0xed7d('0x18')]));_0x2f756e[_0xed7d('0x4c')](_0x2f756e[_0xed7d('0x3e')],_0x2f756e[_0xed7d('0x3f')],parseInt(_0x2f756e[_0xed7d('0x40')],0xa)+0x1);_0x2f756e['close']();}}function main(){var _0x416c4c;return utilLicense[_0xed7d('0x4e')]()[_0xed7d('0x29')](function(_0x42ccbf){if(_0x42ccbf){if(_0x42ccbf[_0xed7d('0x4f')]){if(_0x42ccbf[_0xed7d('0x50')]&&_0x42ccbf[_0xed7d('0x50')]>0x0){logger[_0xed7d('0x10')](util[_0xed7d('0x13')]('[LICENSE]\x20CHANNELS:\x20%s',_0x42ccbf[_0xed7d('0x50')]));_0x416c4c=_0x42ccbf[_0xed7d('0x50')];}else{logger[_0xed7d('0x10')](_0xed7d('0x51'));}}else{logger[_0xed7d('0x10')](_0xed7d('0x52'));_0x416c4c=-0x1;}}})[_0xed7d('0x2a')](function(_0x2ce813){logger[_0xed7d('0xc')](_0xed7d('0x53'),_0x2ce813['stack']);})['finally'](function(){var _0x58d575=require(_0xed7d('0x54'))(config[_0xed7d('0x5')]['port'],config[_0xed7d('0x5')]['ip'],_0x416c4c);_0x58d575['on']('error',errorHandler);_0x58d575['on']('listening',listeningHandler);_0x58d575['on'](_0xed7d('0x55'),connectionHandler);_0x58d575['on'](_0xed7d('0x32'),closeHandler);});}main(); \ No newline at end of file +var _0x777f=['indexOf','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','agicommand','gotoc','context','extension','priority','response','code','isUndefined','result','toString','agicommand\x20not\x20found','finally','[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','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','listening','connection','lodash','syncho','util','moment','../../config/environment','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','nextTick','error','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','message','name','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','arg_1','evtHangup','toJson','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','addEdge','target','value','getSquareProject','then','catch'];(function(_0x39f08f,_0x4aa749){var _0x37d5fd=function(_0x2c6bc4){while(--_0x2c6bc4){_0x39f08f['push'](_0x39f08f['shift']());}};_0x37d5fd(++_0x4aa749);}(_0x777f,0x182));var _0xf777=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x777f[_0x266618];return _0x54dbf5;};'use strict';var parser=require('xml2json');var _=require(_0xf777('0x0'));var syncho=require(_0xf777('0x1'));var util=require(_0xf777('0x2'));var moment=require(_0xf777('0x3'));var config=require(_0xf777('0x4'));var logger=require('../../config/logger')(_0xf777('0x5'));var utilLicense=require(_0xf777('0x6'));var rpc=require(_0xf777('0x7'));var mailRpc=require(_0xf777('0x8'));var Graph=require(_0xf777('0x9'));var Vertices=require(_0xf777('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xf777('0x5')]=_['defaults'](config[_0xf777('0x5')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x29a1ed){process[_0xf777('0xb')](function(){syncho(function(){try{setChannelVariables(_0x29a1ed);agiHandler(_0x29a1ed);}catch(_0x30c6d7){logger[_0xf777('0xc')](_0x30c6d7['stack']);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xf777('0x5')]['port']);logger[_0xf777('0xd')](util[_0xf777('0xe')](_0xf777('0xf'),config[_0xf777('0x5')]['ip'],config[_0xf777('0x5')][_0xf777('0x10')]));}function errorHandler(_0x45c1e5){if(_0x45c1e5&&_0x45c1e5['name']&&_0x45c1e5[_0xf777('0x11')]){logger[_0xf777('0xc')](util[_0xf777('0xe')]('[%s]\x20%s',_0x45c1e5[_0xf777('0x12')],_0x45c1e5[_0xf777('0x11')]));}else{logger[_0xf777('0xc')](util['format']('[ERROR]\x20%s',_0x45c1e5[_0xf777('0x13')]));}}function closeHandler(){logger[_0xf777('0xd')](util['format'](_0xf777('0x14'),this['arg_1'],this[_0xf777('0x15')],this[_0xf777('0x16')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x5824dd){logger['error'](_0x5824dd['stack']);}}function timeoutHandler(){logger[_0xf777('0xd')](util[_0xf777('0xe')](_0xf777('0x17'),this['arg_1'],this[_0xf777('0x15')],this['callerid'],this[_0xf777('0x18')],this[_0xf777('0x19')]));}function hangupHandler(){logger[_0xf777('0xd')](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xf777('0x1a')],this[_0xf777('0x15')],this[_0xf777('0x16')],this[_0xf777('0x18')],this[_0xf777('0x19')]));this[_0xf777('0x1b')]=!![];}function getRoot(_0x1aa1b4){return parser[_0xf777('0x1c')](_0x1aa1b4,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x381693,_0x924f32,_0x4deba8){_0x924f32['agicommand']=_0x4deba8;if(_0x924f32['hasOwnProperty'](_0xf777('0x1d'))){_0x924f32[_0xf777('0x1e')]=parseInt(_0x924f32['retry'],0xa);}_0x381693[_0xf777('0x1f')](_[_0xf777('0x20')](_0x924f32,_0xf777('0x21')));}function initGraph(_0x525e06,_0x1e5c91){var _0xe432b1=new Graph();for(var _0x42c14d in _0x525e06){if(_0x525e06[_0xf777('0x22')](_0x42c14d)){if(_[_0xf777('0x23')](_0x525e06[_0x42c14d])){for(var _0x487387=0x0;_0x487387<_0x525e06[_0x42c14d][_0xf777('0x24')];_0x487387+=0x1){addVertex(_0xe432b1,_0x525e06[_0x42c14d][_0x487387],_0x42c14d);}}else{addVertex(_0xe432b1,_0x525e06[_0x42c14d],_0x42c14d);}}}for(var _0x5319a1=0x0;_0x5319a1<_0x1e5c91[_0xf777('0x24')];_0x5319a1+=0x1){if(_0x1e5c91[_0x5319a1][_0xf777('0x25')]&&_0x1e5c91[_0x5319a1]['target']){_0xe432b1[_0xf777('0x26')](_0x1e5c91[_0x5319a1]['source'],_0x1e5c91[_0x5319a1][_0xf777('0x27')],_0x1e5c91[_0x5319a1][_0xf777('0x28')]);}}return _0xe432b1;}function getSquareProject(_0x484b8f,_0x1ea1df){rpc[_0xf777('0x29')](_0x484b8f)[_0xf777('0x2a')](function(_0x1f5b53){_0x1ea1df(null,_0x1f5b53);})[_0xf777('0x2b')](function(_0x5cd962){_0x1ea1df(null,_0x5cd962);});}function createSquareReport(_0x44753d,_0x14ef1b){rpc['createSquareReport'](_0x44753d)[_0xf777('0x2a')](function(_0x205ef0){if(_0x14ef1b){_0x14ef1b(null,_0x205ef0);}})['catch'](function(_0x4a9445){if(_0x14ef1b){_0x14ef1b(null,_0x4a9445);}});}function setChannelVariables(_0x4513db){for(var _0x27d06a in _0x4513db){if(_0x4513db[_0xf777('0x22')](_0x27d06a)){if(_0x27d06a[_0xf777('0x2c')]('agi_')===0x0){_0x4513db[_0x27d06a[_0xf777('0x2d')](0x4)]=_0x4513db[_0x27d06a];delete _0x4513db[_0x27d06a];}}}}function getLogFromObject(_0x34c3f3){return util[_0xf777('0x2e')](_0x34c3f3,{'showHidden':![],'depth':null});}function agiHandler(_0x281ce9){var _0x53f026,_0x22b742,_0x375171,_0x29673d,_0x19fa68;logger[_0xf777('0x2f')](_0xf777('0x30'),JSON[_0xf777('0x31')](_0x281ce9,null,0x2));logger[_0xf777('0xd')](util[_0xf777('0xe')](_0xf777('0x32'),_0x281ce9[_0xf777('0x1a')],_0x281ce9[_0xf777('0x15')],_0x281ce9['callerid'],_0x281ce9[_0xf777('0x18')],_0x281ce9[_0xf777('0x19')]));_0x281ce9['on'](_0xf777('0xc'),errorHandler);_0x281ce9['on'](_0xf777('0x33'),closeHandler);_0x281ce9['on']('timeout',timeoutHandler);_0x281ce9['evtHangup']=![];_0x281ce9['on'](_0xf777('0x34'),hangupHandler);var _0x39795e=getSquareProject[_0xf777('0x35')](null,_0x281ce9[_0xf777('0x1a')]);if(_0x39795e){if(_0x39795e['production']){_0x53f026=getRoot(_0x39795e[_0xf777('0x36')]);if(_0x53f026&&_0x53f026[_0xf777('0x37')]){logger[_0xf777('0x2f')]('root',JSON['stringify'](_0x53f026,null,0x2));_0x281ce9[_0xf777('0x38')]=moment()['format'](_0xf777('0x39'));_0x22b742=initGraph(_[_0xf777('0x20')](_0x53f026,_0xf777('0x21')),_0x53f026[_0xf777('0x21')]);_0x375171=new Vertices(_0x281ce9,rpc,mailRpc);logger[_0xf777('0xd')](util['format'](_0xf777('0x3a'),_0x281ce9[_0xf777('0x1a')],_0x281ce9['calleridname'],_0x281ce9[_0xf777('0x16')],_0x281ce9[_0xf777('0x18')],_0x281ce9[_0xf777('0x19')]));_0x22b742[_0xf777('0x3b')](_0x53f026[_0xf777('0x37')]['id'],function(_0x3d74bf){try{_0x3d74bf=_0x375171[_0xf777('0x3c')](_0x3d74bf);logger[_0xf777('0x2f')](_0xf777('0x3d'),JSON[_0xf777('0x31')](_0x3d74bf,null,0x2));if(_0x3d74bf[_0xf777('0x3e')]===_0xf777('0x3f')){logger[_0xf777('0xd')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x281ce9[_0xf777('0x40')]=_0x3d74bf[_0xf777('0x40')]||_0x281ce9[_0xf777('0x40')];_0x281ce9[_0xf777('0x41')]=_0x3d74bf[_0xf777('0x41')];_0x281ce9['priority']=_0x3d74bf[_0xf777('0x42')]?_0x3d74bf[_0xf777('0x42')]-0x1:0x1;return null;}else if(_0x3d74bf&&_0x375171[_0x3d74bf[_0xf777('0x3e')]]){_0x19fa68=_0x375171[_0x3d74bf[_0xf777('0x3e')]](_0x3d74bf);logger[_0xf777('0xd')](_0xf777('0x43'),JSON[_0xf777('0x31')](_0x19fa68,null,0x2));if(_0x19fa68&&_0x19fa68[_0xf777('0x44')]===AGI_CODE_SUCCESS&&_0x19fa68['result']!==AGI_RESULT_ERROR&&!_0x281ce9[_0xf777('0x1b')]){logger[_0xf777('0x2f')](_0xf777('0x43'),getLogFromObject(_0x19fa68));return _[_0xf777('0x45')](_0x19fa68[_0xf777('0x46')])?null:_0x19fa68[_0xf777('0x46')][_0xf777('0x47')]();}else{logger[_0xf777('0xc')]('response',getLogFromObject(_0x19fa68));return null;}}else{logger[_0xf777('0xc')](_0xf777('0x48'));return null;}}catch(_0x4c9eca){logger[_0xf777('0xc')](_0x4c9eca[_0xf777('0x13')]);return null;}});if(_0x53f026[_0xf777('0x49')]){logger['info'](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x281ce9[_0xf777('0x1a')],_0x281ce9[_0xf777('0x15')],_0x281ce9['callerid'],_0x281ce9[_0xf777('0x18')],_0x281ce9['uniqueid']));_0x22b742['traverseBFS'](_0x53f026[_0xf777('0x49')]['id'],function(_0x491606){try{_0x491606=_0x375171[_0xf777('0x3c')](_0x491606);logger['debug'](_0xf777('0x3d'),JSON[_0xf777('0x31')](_0x491606,null,0x2));if(_0x491606&&_0x375171[_0x491606[_0xf777('0x3e')]]){_0x19fa68=_0x375171[_0x491606['agicommand']](_0x491606);if(_0x19fa68){logger[_0xf777('0x2f')](_0xf777('0x43'),getLogFromObject(_0x19fa68));return _['isUndefined'](_0x19fa68[_0xf777('0x46')])?null:_0x19fa68[_0xf777('0x46')][_0xf777('0x47')]();}else{logger['error']('response',getLogFromObject(_0x19fa68));return null;}}else{logger[_0xf777('0xc')](_0xf777('0x48'));return null;}}catch(_0x44b5c2){logger['error'](_0x44b5c2[_0xf777('0x13')]);return null;}});}logger[_0xf777('0xd')](util[_0xf777('0xe')](_0xf777('0x4a'),_0x281ce9[_0xf777('0x1a')],_0x281ce9[_0xf777('0x15')],_0x281ce9['callerid'],_0x281ce9['dnid'],_0x281ce9[_0xf777('0x19')]));logger[_0xf777('0xd')](util[_0xf777('0xe')](_0xf777('0x4b'),_0x281ce9[_0xf777('0x40')],_0x281ce9[_0xf777('0x41')],parseInt(_0x281ce9[_0xf777('0x42')],0xa)+0x1));_0x281ce9['continueAt'](_0x281ce9[_0xf777('0x40')],_0x281ce9[_0xf777('0x41')],parseInt(_0x281ce9[_0xf777('0x42')],0xa)+0x1);_0x281ce9[_0xf777('0x33')]();}}else{logger['error'](util[_0xf777('0xe')](_0xf777('0x4c'),_0x281ce9['arg_1']));_0x281ce9[_0xf777('0x4d')](_0x281ce9[_0xf777('0x40')],_0x281ce9[_0xf777('0x41')],parseInt(_0x281ce9[_0xf777('0x42')],0xa)+0x1);_0x281ce9[_0xf777('0x33')]();}}else{logger[_0xf777('0xc')](util[_0xf777('0xe')](_0xf777('0x4e'),_0x281ce9[_0xf777('0x1a')]));_0x281ce9[_0xf777('0x4d')](_0x281ce9[_0xf777('0x40')],_0x281ce9[_0xf777('0x41')],parseInt(_0x281ce9[_0xf777('0x42')],0xa)+0x1);_0x281ce9[_0xf777('0x33')]();}}function main(){var _0x39e198;return utilLicense['getLicense']()[_0xf777('0x2a')](function(_0x4f5eba){if(_0x4f5eba){if(_0x4f5eba[_0xf777('0x4f')]){if(_0x4f5eba[_0xf777('0x50')]&&_0x4f5eba[_0xf777('0x50')]>0x0){logger[_0xf777('0xd')](util['format'](_0xf777('0x51'),_0x4f5eba[_0xf777('0x50')]));_0x39e198=_0x4f5eba[_0xf777('0x50')];}else{logger[_0xf777('0xd')](_0xf777('0x52'));}}else{logger[_0xf777('0xd')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x39e198=-0x1;}}})['catch'](function(_0x35b27b){logger['error'](_0xf777('0x53'),_0x35b27b[_0xf777('0x13')]);})[_0xf777('0x49')](function(){var _0x22c0d1=require('./server')(config[_0xf777('0x5')]['port'],config['agi']['ip'],_0x39e198);_0x22c0d1['on'](_0xf777('0xc'),errorHandler);_0x22c0d1['on'](_0xf777('0x54'),listeningHandler);_0x22c0d1['on'](_0xf777('0x55'),connectionHandler);_0x22c0d1['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 4973c84..f8114bb 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 _0xad09=['error','message','result','catch','sendMailMessage','jayson/promise','client','http','request'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0xad09,0x152));var _0x9ad0=function(_0x5b959e,_0x28debf){_0x5b959e=_0x5b959e-0x0;var _0x11df5a=_0xad09[_0x5b959e];return _0x11df5a;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x9ad0('0x0'));var client=jayson[_0x9ad0('0x1')][_0x9ad0('0x2')]({'port':0x232b});function request(_0x198c50,_0x5a3f65){return new BPromise(function(_0x1598f4,_0x5a5fcc){return client[_0x9ad0('0x3')](_0x198c50,_0x5a3f65)['then'](function(_0x3a1750){if(_0x3a1750['error']){return _0x5a5fcc(_0x3a1750[_0x9ad0('0x4')][_0x9ad0('0x5')]);}else{return _0x1598f4(_0x3a1750[_0x9ad0('0x6')]);}})[_0x9ad0('0x7')](function(_0xf4a165){return _0x5a5fcc(_0xf4a165);});});}exports[_0x9ad0('0x8')]=function(_0x179c1a,_0x2db849){return request('SendMail',{'account':_0x179c1a,'message':_0x2db849});}; \ No newline at end of file +var _0x4326=['error','message','result','catch','SendMail','bluebird','client','http','request'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x4326,0x1be));var _0x6432=function(_0x159f54,_0x4887de){_0x159f54=_0x159f54-0x0;var _0x321451=_0x4326[_0x159f54];return _0x321451;};'use strict';var BPromise=require(_0x6432('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x6432('0x1')][_0x6432('0x2')]({'port':0x232b});function request(_0x542472,_0x4bdf73){return new BPromise(function(_0x5ea485,_0x23f481){return client[_0x6432('0x3')](_0x542472,_0x4bdf73)['then'](function(_0x1d2d65){if(_0x1d2d65[_0x6432('0x4')]){return _0x23f481(_0x1d2d65['error'][_0x6432('0x5')]);}else{return _0x5ea485(_0x1d2d65[_0x6432('0x6')]);}})[_0x6432('0x7')](function(_0x240fb5){return _0x23f481(_0x240fb5);});});}exports['sendMailMessage']=function(_0xa1601e,_0x428120){return request(_0x6432('0x8'),{'account':_0xa1601e,'message':_0x428120});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 74f0efe..2d97793 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 _0x5c38=['_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_localBuffer','indexOf','substring','length','trim','emit','headers','line','exports','stream','Transform','call'];(function(_0x13f5ee,_0x35ec1e){var _0x4130b0=function(_0x278559){while(--_0x278559){_0x13f5ee['push'](_0x13f5ee['shift']());}};_0x4130b0(++_0x35ec1e);}(_0x5c38,0x189));var _0x85c3=function(_0x4e8947,_0x5ca04d){_0x4e8947=_0x4e8947-0x0;var _0x29abde=_0x5c38[_0x4e8947];return _0x29abde;};'use strict';var util=require('util');var Transform=require(_0x85c3('0x0'))[_0x85c3('0x1')];function AGIReply(_0xcaaa41){Transform[_0x85c3('0x2')](this,_0xcaaa41);this['_localBuffer']='';this[_0x85c3('0x3')]=![];}util[_0x85c3('0x4')](AGIReply,Transform);AGIReply[_0x85c3('0x5')][_0x85c3('0x6')]=function(_0x4617b6,_0x4031d3,_0x4c7ddc){var _0x4e848c='\x0a',_0x23d5f3=['\x0a\x0a',_0x85c3('0x7')],_0x2a8b83=-0x1,_0x3181bb=-0x1,_0x500abe='',_0x340b5a=0x0,_0x4c4f80='',_0x27f53a='';this['_localBuffer']+=_0x4617b6[_0x85c3('0x8')]();_0x4c4f80=this[_0x85c3('0x9')];if(!this[_0x85c3('0x3')]){_0x340b5a=0x0;while(_0x23d5f3[_0x340b5a]){while((_0x3181bb=_0x4c4f80[_0x85c3('0xa')](_0x23d5f3[_0x340b5a]))!=-0x1){_0x500abe=_0x23d5f3[_0x340b5a];_0x27f53a=_0x4c4f80['substring'](0x0,_0x3181bb);_0x4c4f80=_0x4c4f80[_0x85c3('0xb')](_0x3181bb+_0x500abe[_0x85c3('0xc')]);var _0x169777=_0x27f53a['split'](_0x4e848c),_0x1e1e3c=0x0,_0x2455a0={},_0x191de5='',_0x1eafd3='',_0x395c08=-0x1;while(_0x169777[_0x1e1e3c]){_0x395c08=_0x169777[_0x1e1e3c]['indexOf'](':');if(_0x395c08!=-0x1){_0x191de5=_0x169777[_0x1e1e3c]['slice'](0x0,_0x395c08)['trim']();_0x1eafd3=_0x169777[_0x1e1e3c]['slice'](_0x395c08+0x1)[_0x85c3('0xd')]();if(_0x191de5[_0x85c3('0xc')]>0x0){_0x2455a0[_0x191de5]=_0x1eafd3;}}else{}_0x1e1e3c++;}this[_0x85c3('0xe')](_0x85c3('0xf'),_0x2455a0);this[_0x85c3('0x3')]=!![];}_0x340b5a++;}this['_localBuffer']=_0x4c4f80;}else{while((_0x2a8b83=_0x4c4f80['indexOf'](_0x4e848c))!=-0x1){_0x27f53a=_0x4c4f80['substring'](0x0,_0x2a8b83);this[_0x85c3('0xe')](_0x85c3('0x10'),_0x27f53a);_0x4c4f80=_0x4c4f80[_0x85c3('0xb')](_0x2a8b83+_0x4e848c['length']);}this['_localBuffer']=_0x4c4f80;}_0x4c7ddc();};module[_0x85c3('0x11')]=AGIReply; \ No newline at end of file +var _0xbf06=['line','exports','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','trim','emit','headers','indexOf'];(function(_0x51a3c2,_0x495e33){var _0x16b5f2=function(_0x4a0e06){while(--_0x4a0e06){_0x51a3c2['push'](_0x51a3c2['shift']());}};_0x16b5f2(++_0x495e33);}(_0xbf06,0x101));var _0x6bf0=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbf06[_0x3947c9];return _0x2e7871;};'use strict';var util=require('util');var Transform=require(_0x6bf0('0x0'))[_0x6bf0('0x1')];function AGIReply(_0x4377eb){Transform[_0x6bf0('0x2')](this,_0x4377eb);this[_0x6bf0('0x3')]='';this[_0x6bf0('0x4')]=![];}util[_0x6bf0('0x5')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1f2628,_0x1d9a84,_0x219a41){var _0x255ed6='\x0a',_0x4fc26f=['\x0a\x0a',_0x6bf0('0x6')],_0x77d107=-0x1,_0x29f59d=-0x1,_0x1db2a7='',_0xfa0ba8=0x0,_0x201ce3='',_0x507cd8='';this[_0x6bf0('0x3')]+=_0x1f2628[_0x6bf0('0x7')]();_0x201ce3=this[_0x6bf0('0x3')];if(!this[_0x6bf0('0x4')]){_0xfa0ba8=0x0;while(_0x4fc26f[_0xfa0ba8]){while((_0x29f59d=_0x201ce3['indexOf'](_0x4fc26f[_0xfa0ba8]))!=-0x1){_0x1db2a7=_0x4fc26f[_0xfa0ba8];_0x507cd8=_0x201ce3['substring'](0x0,_0x29f59d);_0x201ce3=_0x201ce3[_0x6bf0('0x8')](_0x29f59d+_0x1db2a7[_0x6bf0('0x9')]);var _0x38413e=_0x507cd8[_0x6bf0('0xa')](_0x255ed6),_0x1cb781=0x0,_0x1c4eec={},_0x160dd4='',_0x25b518='',_0xfdda14=-0x1;while(_0x38413e[_0x1cb781]){_0xfdda14=_0x38413e[_0x1cb781]['indexOf'](':');if(_0xfdda14!=-0x1){_0x160dd4=_0x38413e[_0x1cb781]['slice'](0x0,_0xfdda14)['trim']();_0x25b518=_0x38413e[_0x1cb781]['slice'](_0xfdda14+0x1)[_0x6bf0('0xb')]();if(_0x160dd4[_0x6bf0('0x9')]>0x0){_0x1c4eec[_0x160dd4]=_0x25b518;}}else{}_0x1cb781++;}this[_0x6bf0('0xc')](_0x6bf0('0xd'),_0x1c4eec);this[_0x6bf0('0x4')]=!![];}_0xfa0ba8++;}this[_0x6bf0('0x3')]=_0x201ce3;}else{while((_0x77d107=_0x201ce3[_0x6bf0('0xe')](_0x255ed6))!=-0x1){_0x507cd8=_0x201ce3['substring'](0x0,_0x77d107);this[_0x6bf0('0xc')](_0x6bf0('0xf'),_0x507cd8);_0x201ce3=_0x201ce3[_0x6bf0('0x8')](_0x77d107+_0x255ed6['length']);}this['_localBuffer']=_0x201ce3;}_0x219a41();};module[_0x6bf0('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 0b1cd22..22a3051 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 _0x9dc5=['lodash','util','http','request','then','error','message','result','catch','ShowSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getTrunkById','getSoundById','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentUnpause','LogoutUser'];(function(_0x2ba1b2,_0x1d4370){var _0x23345e=function(_0x397142){while(--_0x397142){_0x2ba1b2['push'](_0x2ba1b2['shift']());}};_0x23345e(++_0x1d4370);}(_0x9dc5,0x13e));var _0x59dc=function(_0x2715e9,_0x5f11ec){_0x2715e9=_0x2715e9-0x0;var _0x2db8dc=_0x9dc5[_0x2715e9];return _0x2db8dc;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x59dc('0x0'));var util=require(_0x59dc('0x1'));var jayson=require('jayson/promise');var client=jayson['client'][_0x59dc('0x2')]({'port':0x2329});function request(_0xbcd353,_0x636cc1){return new BPromise(function(_0x5e3cec,_0x531926){return client[_0x59dc('0x3')](_0xbcd353,_0x636cc1)[_0x59dc('0x4')](function(_0x21103a){if(_0x21103a[_0x59dc('0x5')]){return _0x531926(_0x21103a['error'][_0x59dc('0x6')]);}else{return _0x5e3cec(_0x21103a[_0x59dc('0x7')]);}})[_0x59dc('0x8')](function(_0x28ecee){return _0x531926(_0x28ecee);});});}exports['getSquareProject']=function(_0x5c3ac2){return request(_0x59dc('0x9'),{'options':{'raw':![],'where':{'name':_0x5c3ac2},'attributes':[_0x59dc('0xa')]}});};exports[_0x59dc('0xb')]=function(_0x343363){return request(_0x59dc('0xc'),{'options':{'raw':![],'where':{'id':_0x343363},'include':[{'model':'MailServerOut','as':_0x59dc('0xd')}],'attributes':['id',_0x59dc('0xe'),_0x59dc('0xf')]}});};exports[_0x59dc('0x10')]=function(_0x20c96f){return request('ShowSquareProject',{'options':{'where':{'id':_0x20c96f},'attributes':['name']}});};exports[_0x59dc('0x11')]=function(_0x50b9e4){return request(_0x59dc('0x12'),{'options':{'where':{'id':_0x50b9e4},'attributes':[_0x59dc('0xe')]}});};exports[_0x59dc('0x13')]=function(_0xe3ea3a){return request(_0x59dc('0x14'),{'options':{'where':{'id':_0xe3ea3a},'attributes':[_0x59dc('0xe')]}});};exports[_0x59dc('0x15')]=function(_0x503fe4){return request(_0x59dc('0x16'),{'options':{'where':{'id':_0x503fe4},'attributes':['dsn']}});};exports['getUserById']=function(_0x25768d){return request('ShowUser',{'options':{'where':{'id':_0x25768d},'attributes':['name']}});};exports[_0x59dc('0x17')]=function(_0x4039bb){return request('ShowTrunk',{'options':{'where':{'id':_0x4039bb},'attributes':['name']}});};exports[_0x59dc('0x18')]=function(_0x258cf8){return request('ShowSound',{'options':{'where':{'id':_0x258cf8},'attributes':['save_name']}});};exports[_0x59dc('0x19')]=function(_0x3e1dcb){return request(_0x59dc('0x1a'),{'options':{'raw':![],'where':{'id':_0x3e1dcb},'include':[{'model':_0x59dc('0x1b'),'as':_0x59dc('0x1c')}]}});};exports[_0x59dc('0x1d')]=function(_0x6106c1){return request(_0x59dc('0x1e'),{'options':{'where':{'id':_0x6106c1},'attributes':['id','name']}});};exports[_0x59dc('0x1f')]=function(_0x348873){return request(_0x59dc('0x20'),{'body':_0x348873});};exports[_0x59dc('0x21')]=function(_0x5d1124){return request(_0x59dc('0x22'),{'body':_0x5d1124});};exports[_0x59dc('0x23')]=function(_0x20507c){return request(_0x59dc('0x24'),{'body':_['merge'](_0x20507c,{'project_name':_0x20507c['arg_1'],'prev_project_name':_0x20507c['arg_2']||'','is_subproject':_0x20507c[_0x59dc('0x25')]?!![]:![],'leaveAt':moment()[_0x59dc('0x26')](_0x59dc('0x27'))})});};exports[_0x59dc('0x28')]=function(_0x3bac6d){return request(_0x59dc('0x29'),{'body':_0x3bac6d});};exports[_0x59dc('0x2a')]=function(_0x7e7422){return request('CreateSquareMessage',{'body':_0x7e7422});};exports[_0x59dc('0x2b')]=function(_0x4d3ecf){return request(_0x59dc('0x2c'),{'options':{'raw':![],'where':{'phone':_0x4d3ecf[_0x59dc('0x2d')],'ListId':_0x4d3ecf['ListId']}}})[_0x59dc('0x4')](function(_0x5d1915){if(_0x5d1915){return _0x5d1915;}return request(_0x59dc('0x2e'),{'body':_0x4d3ecf});});};exports[_0x59dc('0x2f')]=function(_0xb599b1){return request(_0x59dc('0x30'),{'options':{'where':{'id':_0xb599b1},'attributes':['name']}});};exports[_0x59dc('0x31')]=function(_0x25c5ba,_0x2ca694){return request(_0x59dc('0x32'),{'body':{'interface':_0x2ca694},'options':{'where':_0x25c5ba}});};exports['agentPause']=function(_0x52931e,_0x13ba1c,_0x218378){return request('PauseUser',{'body':{'type':_0x13ba1c,'uniqueid':_0x218378},'options':{'where':_0x52931e}});};exports[_0x59dc('0x33')]=function(_0x3d1d1e){return request('UnpauseUser',{'body':{},'options':{'where':_0x3d1d1e}});};exports['agentLogout']=function(_0x1bab79){return request(_0x59dc('0x34'),{'body':{},'options':{'where':_0x1bab79}});}; \ No newline at end of file +var _0xde3d=['agentPause','PauseUser','agentUnpause','agentLogout','moment','lodash','util','client','http','request','then','error','result','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser'];(function(_0x2a5c66,_0x4c6862){var _0x30129a=function(_0x5e579a){while(--_0x5e579a){_0x2a5c66['push'](_0x2a5c66['shift']());}};_0x30129a(++_0x4c6862);}(_0xde3d,0x178));var _0xdde3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xde3d[_0x19e35c];return _0x3e1fe8;};'use strict';var BPromise=require('bluebird');var moment=require(_0xdde3('0x0'));var _=require(_0xdde3('0x1'));var util=require(_0xdde3('0x2'));var jayson=require('jayson/promise');var client=jayson[_0xdde3('0x3')][_0xdde3('0x4')]({'port':0x2329});function request(_0x194357,_0x381bd3){return new BPromise(function(_0x13e903,_0x104b9f){return client[_0xdde3('0x5')](_0x194357,_0x381bd3)[_0xdde3('0x6')](function(_0x3424be){if(_0x3424be[_0xdde3('0x7')]){return _0x104b9f(_0x3424be[_0xdde3('0x7')]['message']);}else{return _0x13e903(_0x3424be[_0xdde3('0x8')]);}})['catch'](function(_0x1f2ad0){return _0x104b9f(_0x1f2ad0);});});}exports[_0xdde3('0x9')]=function(_0x557478){return request(_0xdde3('0xa'),{'options':{'raw':![],'where':{'name':_0x557478},'attributes':['production']}});};exports[_0xdde3('0xb')]=function(_0x2b357f){return request(_0xdde3('0xc'),{'options':{'raw':![],'where':{'id':_0x2b357f},'include':[{'model':_0xdde3('0xd'),'as':_0xdde3('0xe')}],'attributes':['id',_0xdde3('0xf'),_0xdde3('0x10')]}});};exports['getSquareProjectById']=function(_0x244093){return request(_0xdde3('0xa'),{'options':{'where':{'id':_0x244093},'attributes':['name']}});};exports[_0xdde3('0x11')]=function(_0x12b707){return request(_0xdde3('0x12'),{'options':{'where':{'id':_0x12b707},'attributes':[_0xdde3('0xf')]}});};exports[_0xdde3('0x13')]=function(_0x3d1ab4){return request(_0xdde3('0x14'),{'options':{'where':{'id':_0x3d1ab4},'attributes':[_0xdde3('0xf')]}});};exports[_0xdde3('0x15')]=function(_0x46794a){return request(_0xdde3('0x16'),{'options':{'where':{'id':_0x46794a},'attributes':[_0xdde3('0x17')]}});};exports[_0xdde3('0x18')]=function(_0x482fd4){return request(_0xdde3('0x19'),{'options':{'where':{'id':_0x482fd4},'attributes':[_0xdde3('0xf')]}});};exports[_0xdde3('0x1a')]=function(_0x15e322){return request('ShowTrunk',{'options':{'where':{'id':_0x15e322},'attributes':[_0xdde3('0xf')]}});};exports[_0xdde3('0x1b')]=function(_0xff19bd){return request(_0xdde3('0x1c'),{'options':{'where':{'id':_0xff19bd},'attributes':['save_name']}});};exports[_0xdde3('0x1d')]=function(_0x5106e4){return request(_0xdde3('0x1e'),{'options':{'raw':![],'where':{'id':_0x5106e4},'include':[{'model':_0xdde3('0x1f'),'as':_0xdde3('0x20')}]}});};exports[_0xdde3('0x21')]=function(_0x29f720){return request(_0xdde3('0x22'),{'options':{'where':{'id':_0x29f720},'attributes':['id','name']}});};exports[_0xdde3('0x23')]=function(_0x569a8e){return request(_0xdde3('0x24'),{'body':_0x569a8e});};exports[_0xdde3('0x25')]=function(_0x15c2a9){return request('CreateSquareDetailsReport',{'body':_0x15c2a9});};exports[_0xdde3('0x26')]=function(_0x5efa76){return request(_0xdde3('0x27'),{'body':_[_0xdde3('0x28')](_0x5efa76,{'project_name':_0x5efa76[_0xdde3('0x29')],'prev_project_name':_0x5efa76[_0xdde3('0x2a')]||'','is_subproject':_0x5efa76[_0xdde3('0x2a')]?!![]:![],'leaveAt':moment()[_0xdde3('0x2b')](_0xdde3('0x2c'))})});};exports[_0xdde3('0x2d')]=function(_0x23f54b){return request(_0xdde3('0x2e'),{'body':_0x23f54b});};exports[_0xdde3('0x2f')]=function(_0x47d207){return request(_0xdde3('0x30'),{'body':_0x47d207});};exports[_0xdde3('0x31')]=function(_0x129687){return request(_0xdde3('0x32'),{'options':{'raw':![],'where':{'phone':_0x129687[_0xdde3('0x33')],'ListId':_0x129687[_0xdde3('0x34')]}}})['then'](function(_0x1fe098){if(_0x1fe098){return _0x1fe098;}return request(_0xdde3('0x35'),{'body':_0x129687});});};exports[_0xdde3('0x36')]=function(_0x61f116){return request(_0xdde3('0x37'),{'options':{'where':{'id':_0x61f116},'attributes':['name']}});};exports[_0xdde3('0x38')]=function(_0x2c2b85,_0x5d22da){return request(_0xdde3('0x39'),{'body':{'interface':_0x5d22da},'options':{'where':_0x2c2b85}});};exports[_0xdde3('0x3a')]=function(_0x1c204f,_0x12d9d1,_0xc56f00){return request(_0xdde3('0x3b'),{'body':{'type':_0x12d9d1,'uniqueid':_0xc56f00},'options':{'where':_0x1c204f}});};exports[_0xdde3('0x3c')]=function(_0x2d80e6){return request('UnpauseUser',{'body':{},'options':{'where':_0x2d80e6}});};exports[_0xdde3('0x3d')]=function(_0x1ce547){return request('LogoutUser',{'body':{},'options':{'where':_0x1ce547}});}; \ 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 4e95ebf..28cfe96 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 _0xe767=['./lex','exports'];(function(_0x461a9c,_0x25f6d6){var _0x3ac216=function(_0x4f5a13){while(--_0x4f5a13){_0x461a9c['push'](_0x461a9c['shift']());}};_0x3ac216(++_0x25f6d6);}(_0xe767,0x11e));var _0x7e76=function(_0x4e8395,_0x1d26bb){_0x4e8395=_0x4e8395-0x0;var _0x48637b=_0xe767[_0x4e8395];return _0x48637b;};var polly=require('./polly');var lex=require(_0x7e76('0x0'));module[_0x7e76('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var polly=require('./polly');var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 2112fcf..22515b4 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4483=['exports','./lib/api'];(function(_0x5232df,_0xb56dcf){var _0x28e137=function(_0x578f1d){while(--_0x578f1d){_0x5232df['push'](_0x5232df['shift']());}};_0x28e137(++_0xb56dcf);}(_0x4483,0x1a3));var _0x3448=function(_0x202e4f,_0x13a9de){_0x202e4f=_0x202e4f-0x0;var _0xd5e621=_0x4483[_0x202e4f];return _0xd5e621;};'use strict';var lex=require(_0x3448('0x0'));module[_0x3448('0x1')]=function(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178){return lex(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x2936e7,_0x2afa91,_0x27405a,_0x305d85,_0x864539,_0x52b5fb){return lex(_0x2936e7,_0x2afa91,_0x27405a,_0x305d85,_0x864539,_0x52b5fb);}; \ 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 020359a..0f4a586 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(_0x24a115,_0x2304fe){var _0x5029a5=function(_0x27399e){while(--_0x27399e){_0x24a115['push'](_0x24a115['shift']());}};_0x5029a5(++_0x2304fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x224eca,_0x36410d){var _0x1af5f4=function(_0x32347a){while(--_0x32347a){_0x224eca['push'](_0x224eca['shift']());}};_0x1af5f4(++_0x36410d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 f3e042b..40c7fd5 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 _0x8379=['exports','./lib/api'];(function(_0x47e87f,_0x44e369){var _0x158bd7=function(_0x4a405d){while(--_0x4a405d){_0x47e87f['push'](_0x47e87f['shift']());}};_0x158bd7(++_0x44e369);}(_0x8379,0xe3));var _0x9837=function(_0x15a0b0,_0x211684){_0x15a0b0=_0x15a0b0-0x0;var _0x579e78=_0x8379[_0x15a0b0];return _0x579e78;};'use strict';var polly=require(_0x9837('0x0'));module[_0x9837('0x1')]=function(_0x17099c,_0x58f208,_0x40cd85,_0x1c2d2b,_0x52904f,_0x171a38,_0x2983ba){return polly(_0x17099c,_0x58f208,_0x40cd85,_0x1c2d2b,_0x52904f,_0x171a38,_0x2983ba);}; \ No newline at end of file +var _0xc74c=['exports','./lib/api'];(function(_0x5e24d3,_0x172f21){var _0x176704=function(_0x27a3ec){while(--_0x27a3ec){_0x5e24d3['push'](_0x5e24d3['shift']());}};_0x176704(++_0x172f21);}(_0xc74c,0x149));var _0xcc74=function(_0x4a1c44,_0x50816a){_0x4a1c44=_0x4a1c44-0x0;var _0x40641d=_0xc74c[_0x4a1c44];return _0x40641d;};'use strict';var polly=require(_0xcc74('0x0'));module[_0xcc74('0x1')]=function(_0x4b8cf3,_0xcf359b,_0x44357c,_0x27f87b,_0x57c0b4,_0x259130,_0x2bdba9){return polly(_0x4b8cf3,_0xcf359b,_0x44357c,_0x27f87b,_0x57c0b4,_0x259130,_0x2bdba9);}; \ 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 5ffe631..7d8add0 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 _0xc125=['exports','Polly','text','mp3','bluebird','randomstring','synthesizeSpeech','writeFile','AudioStream'];(function(_0x506fa2,_0x145e85){var _0x42c0ce=function(_0x54add9){while(--_0x54add9){_0x506fa2['push'](_0x506fa2['shift']());}};_0x42c0ce(++_0x145e85);}(_0xc125,0x100));var _0x5c12=function(_0x1c5f37,_0x5903b6){_0x1c5f37=_0x1c5f37-0x0;var _0x568e28=_0xc125[_0x1c5f37];return _0x568e28;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x5c12('0x0'));var rs=require(_0x5c12('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x3ee130,_0x30739b,_0x5134a8){return new BPromise(function(_0x3a4496,_0x5ac85b){_0x3ee130[_0x5c12('0x2')](_0x30739b,function(_0xf31137,_0x51c995){if(_0xf31137){_0x5ac85b(_0xf31137);}else if(_0x51c995){if(_0x51c995['AudioStream']instanceof Buffer){fs[_0x5c12('0x3')](_0x5134a8,_0x51c995[_0x5c12('0x4')],function(_0x3efe43){if(_0x3efe43){_0x5ac85b(_0x3efe43);}else{_0x3a4496();}});}else{_0x5ac85b(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x5ac85b(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x5c12('0x5')]=function(_0x544ca5,_0x2c5098,_0x2b835c,_0x377abf,_0x256497,_0x68fe4a,_0x363772){var _0x523818=new AWS[(_0x5c12('0x6'))]({'accessKeyId':_0x544ca5,'secretAccessKey':_0x2c5098,'region':_0x2b835c});var _0x517c17={'Text':_0x256497,'TextType':_0x68fe4a||_0x5c12('0x7'),'OutputFormat':_0x5c12('0x8'),'VoiceId':_0x377abf};return pollyResult(_0x523818,_0x517c17,_0x363772);}; \ No newline at end of file +var _0x415d=['exports','text','mp3','bluebird','randomstring','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x5714e1,_0x2eb751){var _0x3c0e6d=function(_0x5746){while(--_0x5746){_0x5714e1['push'](_0x5714e1['shift']());}};_0x3c0e6d(++_0x2eb751);}(_0x415d,0x1e3));var _0xd415=function(_0x18bfc7,_0x505253){_0x18bfc7=_0x18bfc7-0x0;var _0x17686b=_0x415d[_0x18bfc7];return _0x17686b;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xd415('0x0'));var rs=require(_0xd415('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x1c75f3,_0x3d9d67,_0x2093cf){return new BPromise(function(_0x533da5,_0x2e3ebd){_0x1c75f3[_0xd415('0x2')](_0x3d9d67,function(_0x1414e5,_0x2637a2){if(_0x1414e5){_0x2e3ebd(_0x1414e5);}else if(_0x2637a2){if(_0x2637a2['AudioStream']instanceof Buffer){fs[_0xd415('0x3')](_0x2093cf,_0x2637a2[_0xd415('0x4')],function(_0x5891d3){if(_0x5891d3){_0x2e3ebd(_0x5891d3);}else{_0x533da5();}});}else{_0x2e3ebd(new Error(_0xd415('0x5')));}}else{_0x2e3ebd(new Error(_0xd415('0x6')));}});});}module[_0xd415('0x7')]=function(_0xb76d2f,_0x6163b5,_0xcb4689,_0x562366,_0x36b507,_0x24d839,_0x9fdac2){var _0x297d9c=new AWS['Polly']({'accessKeyId':_0xb76d2f,'secretAccessKey':_0x6163b5,'region':_0xcb4689});var _0x30c36b={'Text':_0x36b507,'TextType':_0x24d839||_0xd415('0x8'),'OutputFormat':_0xd415('0x9'),'VoiceId':_0x562366};return pollyResult(_0x297d9c,_0x30c36b,_0x9fdac2);}; \ 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 f4573c3..cc9495f 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x777443,_0x5c3879,_0x43d811,_0x3fb14e){return asr(_0x777443,_0x5c3879,_0x43d811);}; \ No newline at end of file +var _0x93df=['exports','./lib/api'];(function(_0x3f9edd,_0x43c0bf){var _0x167d51=function(_0x346377){while(--_0x346377){_0x3f9edd['push'](_0x3f9edd['shift']());}};_0x167d51(++_0x43c0bf);}(_0x93df,0x97));var _0xf93d=function(_0x1e243b,_0x6ab858){_0x1e243b=_0x1e243b-0x0;var _0x2c7e5d=_0x93df[_0x1e243b];return _0x2c7e5d;};'use strict';var asr=require(_0xf93d('0x0'));module[_0xf93d('0x1')]=function(_0x363cbb,_0x5bf8d6,_0x2df5bf,_0x42475b){return asr(_0x363cbb,_0x5bf8d6,_0x2df5bf);}; \ 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 daf36ad..63bdcc6 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 _0x4876=['LINEAR16','8000','https://speech.googleapis.com','string','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','length','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key='];(function(_0x209cb4,_0x5a698a){var _0x42ee96=function(_0x490a6c){while(--_0x490a6c){_0x209cb4['push'](_0x209cb4['shift']());}};_0x42ee96(++_0x5a698a);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x6487('0x0');module['exports']=function(_0x502614,_0x236189,_0x498e31){return new BPromise(function(_0x43e7e8,_0x2bace9){var _0x192d3c;if(typeof _0x502614!==_0x6487('0x1')||_0x502614['length']===0x0){return _0x2bace9(_0x6487('0x2'));}if(typeof _0x236189!==_0x6487('0x1')||_0x236189['length']===0x0){return _0x2bace9(_0x6487('0x3'));}if(typeof _0x498e31!==_0x6487('0x4')&&(typeof _0x498e31!==_0x6487('0x1')||_0x498e31[_0x6487('0x5')]===0x0)){return _0x2bace9(_0x6487('0x6'));}try{_0x192d3c=fs[_0x6487('0x7')](_0x502614)[_0x6487('0x8')](_0x6487('0x9'));}catch(_0x5f8f96){return _0x2bace9(_0x5f8f96);}return _0x43e7e8({'method':'POST','uri':host+_0x6487('0xa')+_0x236189,'body':{'config':{'encoding':_0x6487('0xb'),'sampleRateHertz':_0x6487('0xc'),'languageCode':_0x498e31},'audio':{'content':_0x192d3c}},'json':!![]});});}; \ No newline at end of file +var _0x6e77=['filepath\x20should\x20be\x20a\x20string','string','length','undefined','readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','bluebird'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x6e77,0xef));var _0x76e7=function(_0x360cc7,_0x2373f4){_0x360cc7=_0x360cc7-0x0;var _0x36c3b7=_0x6e77[_0x360cc7];return _0x36c3b7;};'use strict';var url=require('url');var BPromise=require(_0x76e7('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x389715,_0x2aea10,_0x57a8b3){return new BPromise(function(_0x37101b,_0x305900){var _0xcc6627;if(typeof _0x389715!=='string'||_0x389715['length']===0x0){return _0x305900(_0x76e7('0x1'));}if(typeof _0x2aea10!==_0x76e7('0x2')||_0x2aea10[_0x76e7('0x3')]===0x0){return _0x305900('key\x20should\x20be\x20a\x20string');}if(typeof _0x57a8b3!==_0x76e7('0x4')&&(typeof _0x57a8b3!==_0x76e7('0x2')||_0x57a8b3[_0x76e7('0x3')]===0x0)){return _0x305900('lang\x20should\x20be\x20a\x20string');}try{_0xcc6627=fs[_0x76e7('0x5')](_0x389715)[_0x76e7('0x6')]('base64');}catch(_0x37f521){return _0x305900(_0x37f521);}return _0x37101b({'method':_0x76e7('0x7'),'uri':host+_0x76e7('0x8')+_0x2aea10,'body':{'config':{'encoding':_0x76e7('0x9'),'sampleRateHertz':'8000','languageCode':_0x57a8b3},'audio':{'content':_0xcc6627}},'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 bba5b78..28d3272 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 _0x7adf=['./asr','exports'];(function(_0x5714e0,_0xbf4ccd){var _0x348053=function(_0x32e904){while(--_0x32e904){_0x5714e0['push'](_0x5714e0['shift']());}};_0x348053(++_0xbf4ccd);}(_0x7adf,0x18e));var _0xf7ad=function(_0x5d547f,_0x50a029){_0x5d547f=_0x5d547f-0x0;var _0x66efe3=_0x7adf[_0x5d547f];return _0x66efe3;};var asr=require(_0xf7ad('0x0'));module[_0xf7ad('0x1')]={'asr':asr}; \ No newline at end of file +var _0xa04b=['exports'];(function(_0x1c4814,_0xb87c40){var _0x5ef489=function(_0x552b41){while(--_0x552b41){_0x1c4814['push'](_0x1c4814['shift']());}};_0x5ef489(++_0xb87c40);}(_0xa04b,0x15f));var _0xba04=function(_0x1f0b36,_0x3ec01f){_0x1f0b36=_0x1f0b36-0x0;var _0x2cd7ac=_0xa04b[_0x1f0b36];return _0x2cd7ac;};var asr=require('./asr');module[_0xba04('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index e93d6f0..0158ce1 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 _0x4ce0=['.wav','base64','then','chmodSync','777','split','readFileSync','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','text:synthesize','generate','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','data','length','lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','textRequest','source','result','resolvedQuery','actionIncomplete','fulfillment','speech','score','code','metadata','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','queryResult','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','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','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','md5','path','querystring','request-promise','sox','google-tts-api','url','parse','./aws','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','get','statusCode','error','request\x20to\x20','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','host','\x20failed,\x20status\x20code\x20=\x20','statusMessage','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4ce0,0xeb));var _0x04ce=function(_0x1f37b6,_0x5bb3db){_0x1f37b6=_0x1f37b6-0x0;var _0x4aabd6=_0x4ce0[_0x1f37b6];return _0x4aabd6;};'use strict';var apiai=require(_0x04ce('0x0'));var BPromise=require(_0x04ce('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x04ce('0x2'));var https=require('https');var md5=require(_0x04ce('0x3'));var path=require(_0x04ce('0x4'));var querystring=require(_0x04ce('0x5'));var rp=require(_0x04ce('0x6'));var rs=require('randomstring');var sox=require(_0x04ce('0x7'));var tts=require(_0x04ce('0x8'));var urlParse=require(_0x04ce('0x9'))[_0x04ce('0xa')];var util=require('util');var aws=require(_0x04ce('0xb'));var google=require('./google');var sestek=require('./sestek');var tilde=require(_0x04ce('0xc'));var logger=require(_0x04ce('0xd'))(_0x04ce('0xe'));var ISPEECH_API=_0x04ce('0xf');function downloadFile(_0x29a723,_0x3d46ad){return new BPromise(function(_0x12dc4e,_0x921b3d){var _0x57129e=urlParse(_0x29a723);var _0x1db6a8=_0x57129e[_0x04ce('0x10')]===_0x04ce('0x11')?https:http;var _0xd9ba91={'host':_0x57129e['host'],'path':_0x57129e[_0x04ce('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x1db6a8[_0x04ce('0x12')](_0xd9ba91,function(_0x1720e6){if(_0x1720e6[_0x04ce('0x13')]!==0xc8){logger[_0x04ce('0x14')](_0x04ce('0x15')+_0x29a723+'\x20failed,\x20status\x20code\x20=\x20'+_0x1720e6[_0x04ce('0x13')]+'\x20('+_0x1720e6['statusMessage']+')');_0x921b3d(new Error(_0x04ce('0x15')+_0x29a723+'\x20failed,\x20status\x20code\x20=\x20'+_0x1720e6[_0x04ce('0x13')]+'\x20('+_0x1720e6['statusMessage']+')'));return;}var _0x7dd292=fs[_0x04ce('0x16')](_0x3d46ad);_0x7dd292['on'](_0x04ce('0x17'),function(){logger[_0x04ce('0x18')](_0x04ce('0x19'));_0x7dd292[_0x04ce('0x1a')](_0x12dc4e);});_0x7dd292['on']('error',function(_0x1cec73){fs[_0x04ce('0x1b')](_0x3d46ad);logger[_0x04ce('0x14')](_0x04ce('0x1c'),_0x1cec73);_0x921b3d(_0x1cec73);});_0x1720e6[_0x04ce('0x1d')](_0x7dd292);})['on'](_0x04ce('0x14'),function(_0x3e3aca){logger[_0x04ce('0x14')](_0x3e3aca);_0x921b3d(_0x3e3aca);})['end']();});}function uploadFile(_0x1b2981){return new BPromise(function(_0x2b70cf,_0x3b4f8d){var _0x25cc07=urlParse(_0x1b2981);var _0x436578=_0x25cc07[_0x04ce('0x10')]===_0x04ce('0x11')?https:http;var _0x973b69={'host':_0x25cc07[_0x04ce('0x1e')],'path':_0x25cc07[_0x04ce('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x436578[_0x04ce('0x12')](_0x973b69,function(_0x5f4d08){if(_0x5f4d08[_0x04ce('0x13')]!==0xc8){_0x3b4f8d(new Error(_0x04ce('0x15')+_0x1b2981+_0x04ce('0x1f')+_0x5f4d08[_0x04ce('0x13')]+'\x20('+_0x5f4d08[_0x04ce('0x20')]+')'));return;}var _0x114f55='';_0x5f4d08['on']('data',function(_0x20f83d){_0x114f55+=_0x20f83d;});_0x5f4d08['on'](_0x04ce('0x21'),function(){_0x2b70cf(_0x114f55);});})['on'](_0x04ce('0x14'),function(_0x4df2e9){_0x3b4f8d(_0x4df2e9);})[_0x04ce('0x21')]();});}function convertFile(_0x3ae739,_0x47479d){return new BPromise(function(_0x4580b4,_0x592236){var _0xb1c556=sox[_0x04ce('0x22')](_0x3ae739,_0x47479d,{'sampleRate':0x1f40,'format':_0x04ce('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xb1c556['on'](_0x04ce('0x14'),function(_0x478792){logger[_0x04ce('0x14')](_0x04ce('0x24'),_0x478792);_0x592236(_0x478792);});_0xb1c556['on']('end',function(){logger[_0x04ce('0x18')](_0x04ce('0x25'));_0x4580b4();});_0xb1c556[_0x04ce('0x26')]();});}function base64Decode(_0x5dde0f,_0x1d9c7c){var _0x52f317=path[_0x04ce('0x27')](__dirname,_0x04ce('0x28'),rs['generate'](0x4)+_0x04ce('0x29'));fs['writeFileSync'](_0x52f317,_0x5dde0f,_0x04ce('0x2a'));return convertFile(_0x52f317,_0x1d9c7c)[_0x04ce('0x2b')](function(){try{fs['unlink'](_0x52f317);fs[_0x04ce('0x2c')](_0x1d9c7c,_0x04ce('0x2d'));}catch(_0x24dd33){logger['error'](_0x24dd33);}return _0x1d9c7c[_0x04ce('0x2e')]('.')[0x0];});}function base64Encode(_0x5aa2ae){var _0x162975=fs[_0x04ce('0x2f')](_0x5aa2ae);return new Buffer(_0x162975)['toString']('base64');}exports['googleCloudTTS']=function(_0x4f7b1f,_0x212818,_0x6439b0,_0x3dcf71,_0x43d090,_0x2e789e){var _0x1bd31f,_0x1b442d;var _0x11e9e6=_0x04ce('0x30');var _0x9ee3b6=_0x04ce('0x31')+_0x4f7b1f;var _0x43a9e7={};if(_0x212818===_0x04ce('0x32')){_0x43a9e7[_0x04ce('0x33')]={'ssml':_0x6439b0};}else{_0x43a9e7[_0x04ce('0x33')]={'text':_0x6439b0};};_0x43a9e7[_0x04ce('0x34')]={'languageCode':_0x3dcf71,'ssmlGender':_0x43d090};_0x43a9e7['audioConfig']={'audioEncoding':_0x04ce('0x35'),'sampleRateHertz':0x1f40};var _0x3d7a8a={'url':_0x11e9e6+_0x04ce('0x36')+_0x9ee3b6,'method':'POST','json':!![],'body':_0x43a9e7};return rp(_0x3d7a8a)[_0x04ce('0x2b')](function(_0x44bcfc){return new BPromise(function(_0x46f0ea,_0x187a66){_0x1bd31f=path['resolve'](__dirname,_0x04ce('0x28'),rs[_0x04ce('0x37')](0x4)+_0x04ce('0x38'));var _0x150498=Buffer[_0x04ce('0x39')](_0x44bcfc[_0x04ce('0x3a')],_0x04ce('0x2a'));return fs[_0x04ce('0x3b')](_0x1bd31f,_0x150498,function(_0x55378a){_0x187a66(_0x55378a);},function(_0x2f7166){fs['chmodSync'](_0x1bd31f,'777');_0x46f0ea(_0x2f7166);});});})[_0x04ce('0x2b')](function(_0x130b9d){_0x1b442d=path['resolve'](__dirname,_0x04ce('0x28'),rs['generate'](0x4)+_0x04ce('0x29'));return convertFile(_0x1bd31f,_0x1b442d);})[_0x04ce('0x2b')](function(){try{fs[_0x04ce('0x1b')](_0x1bd31f);fs[_0x04ce('0x2c')](_0x1b442d,_0x04ce('0x2d'));}catch(_0x128e62){logger[_0x04ce('0x14')](_0x128e62);}logger[_0x04ce('0x18')](_0x04ce('0x3c'),_0x1b442d[_0x04ce('0x2e')]('.')[0x0]);return _0x1b442d[_0x04ce('0x2e')]('.')[0x0];});};exports[_0x04ce('0x3d')]=function(_0x4dccb4,_0x1572d5){var _0x390ad0=_0x04ce('0x3e');var _0x47f331,_0x20efd8;var _0x22740;var _0x2a1e04={'encoding':_0x04ce('0x3f'),'method':_0x04ce('0x40'),'timeout':0x2710,'url':_0x390ad0,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0x04ce('0x41')]([[[_0x04ce('0x42'),JSON[_0x04ce('0x41')]([_0x4dccb4,_0x1572d5||'en',![],_0x04ce('0x43')]),null,_0x04ce('0x44')]]]))};return rp(_0x2a1e04)['then'](function(_0x44bfaf){try{_0x22740=eval(_0x44bfaf['slice'](0x5))[0x0][0x2];}catch(_0xf9b60b){throw new Error(_0x04ce('0x45')+_0x44bfaf[_0x04ce('0x46')]);}if(!_0x22740){if(_0x4dccb4[_0x04ce('0x47')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x04ce('0x48')+_0x1572d5+_0x04ce('0x49'));}}try{_0x22740=eval(_0x22740)[0x0];}catch(_0x54664a){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x2b2099=_0x22740;_0x47f331=path[_0x04ce('0x27')](__dirname,_0x04ce('0x28'),rs[_0x04ce('0x37')](0x4)+_0x04ce('0x38'));fs[_0x04ce('0x4a')](_0x47f331,_0x22740,{'encoding':_0x04ce('0x2a')});_0x20efd8=path[_0x04ce('0x27')](__dirname,_0x04ce('0x28'),rs[_0x04ce('0x37')](0x4)+'.wav');return convertFile(_0x47f331,_0x20efd8);})[_0x04ce('0x2b')](function(){try{fs[_0x04ce('0x1b')](_0x47f331);fs[_0x04ce('0x2c')](_0x20efd8,_0x04ce('0x2d'));}catch(_0x3bad45){logger[_0x04ce('0x14')](_0x3bad45);}logger[_0x04ce('0x18')](_0x04ce('0x4b'),_0x20efd8[_0x04ce('0x2e')]('.')[0x0]);return _0x20efd8['split']('.')[0x0];});};exports[_0x04ce('0x4c')]=function(_0x43f574,_0x5cf51a,_0x3cad04){return google[_0x04ce('0x4d')](_0x43f574,_0x5cf51a,_0x3cad04)[_0x04ce('0x2b')](function(_0x2c660a){logger[_0x04ce('0x18')](_0x2c660a[_0x04ce('0x4e')]);return rp(_0x2c660a);})['then'](function(_0x59fb16){var _0x5538bb='';var _0x348106=0x0;try{fs[_0x04ce('0x1b')](_0x43f574);}catch(_0x5220ca){logger[_0x04ce('0x14')](_0x5220ca);}if(_0x59fb16&&_0x59fb16[_0x04ce('0x4f')]){_0x5538bb=_0x59fb16[_0x04ce('0x4f')][_0x04ce('0x50')](function(_0x213e88){return _0x213e88&&_0x213e88[_0x04ce('0x51')][0x0]&&_0x213e88[_0x04ce('0x51')][0x0][_0x04ce('0x52')]?_0x213e88['alternatives'][0x0][_0x04ce('0x52')]:'';})[_0x04ce('0x53')]('\x0a');_0x348106=_0x59fb16['results'][_0x04ce('0x50')](function(_0x2386dd){return _0x2386dd&&_0x2386dd[_0x04ce('0x51')][0x0]&&_0x2386dd[_0x04ce('0x51')][0x0][_0x04ce('0x54')]?_0x2386dd[_0x04ce('0x51')][0x0][_0x04ce('0x54')]:0x0;})['join']('\x0a');}logger[_0x04ce('0x18')](_0x04ce('0x55'),_0x5538bb);logger[_0x04ce('0x18')]('googleASR\x20confidence',_0x348106);return{'transcript':_0x5538bb,'confidence':_0x348106};})[_0x04ce('0x56')](function(_0x44a833){logger[_0x04ce('0x14')](_0x04ce('0x57'),_0x44a833[_0x04ce('0x13')],_0x44a833[_0x04ce('0x58')],_0x44a833[_0x04ce('0x59')]);});};exports['googleDialogflow']=function(_0x1025ab,_0x262806,_0x4765db,_0x38dbf2){var _0xe16d3=apiai(_0x262806,{'language':_0x38dbf2||'en'});return _0xe16d3[_0x04ce('0x5a')](_0x4765db,{'sessionId':md5(_0x1025ab)})[_0x04ce('0x2b')](function(_0x1dd613){logger[_0x04ce('0x18')](JSON['stringify'](_0x1dd613));return{'source':_0x1dd613['result'][_0x04ce('0x5b')],'resolvedQuery':_0x1dd613[_0x04ce('0x5c')][_0x04ce('0x5d')],'action':_0x1dd613['result']['action'],'actionIncomplete':_0x1dd613[_0x04ce('0x5c')][_0x04ce('0x5e')],'speech':_0x1dd613[_0x04ce('0x5c')][_0x04ce('0x5f')][_0x04ce('0x60')],'score':_0x1dd613[_0x04ce('0x5c')][_0x04ce('0x61')],'statusCode':_0x1dd613['status'][_0x04ce('0x62')],'endConversation':_0x1dd613[_0x04ce('0x5c')][_0x04ce('0x63')]['endConversation']||![],'isFallbackIntent':_0x1dd613[_0x04ce('0x5c')][_0x04ce('0x63')][_0x04ce('0x64')]};});};exports['googleDialogflowV2']=function(_0x221f61,_0xbbeea4,_0x5d2378,_0x27ce72,_0x130030,_0x1c33e5){var _0x367dd4=_0x27ce72[_0x04ce('0x65')](/\\n/g,'\x0a');var _0xc82899={'credentials':{'private_key':_0x367dd4,'client_email':_0x5d2378}};var _0x365e54=new dialogflow[(_0x04ce('0x66'))](_0xc82899);var _0xcb0d3f=_0x365e54[_0x04ce('0x67')](_0xbbeea4,md5(_0x221f61));var _0x3e1ef8={'session':_0xcb0d3f,'queryInput':{'text':{'text':_0x130030,'languageCode':_0x1c33e5}}};return _0x365e54[_0x04ce('0x68')](_0x3e1ef8)['then'](function(_0x3f130d){if(_0x3f130d&&_0x3f130d[_0x04ce('0x47')]){logger[_0x04ce('0x18')]('Dialogflow\x20V2\x20response:',JSON[_0x04ce('0x41')](_0x3f130d));var _0x18502d=_0x3f130d[0x0];if(_0x18502d){var _0x25eecf={'action':_0x18502d[_0x04ce('0x69')]['action'],'allRequiredParamsPresent':_0x18502d['queryResult']['allRequiredParamsPresent'],'endConversation':_0x18502d[_0x04ce('0x69')][_0x04ce('0x6a')]&&_0x18502d[_0x04ce('0x69')][_0x04ce('0x6a')][_0x04ce('0x6b')]?_0x18502d['queryResult'][_0x04ce('0x6a')][_0x04ce('0x6b')][_0x04ce('0x6c')]['boolValue']:![],'fulfillmentText':_0x18502d[_0x04ce('0x69')][_0x04ce('0x6d')],'intentName':_0x18502d[_0x04ce('0x69')][_0x04ce('0x6e')][_0x04ce('0x58')],'intentDisplayName':_0x18502d[_0x04ce('0x69')]['intent'][_0x04ce('0x6f')],'isFallbackIntent':_0x18502d[_0x04ce('0x69')][_0x04ce('0x6e')]['isFallback'],'languageCode':_0x18502d[_0x04ce('0x69')][_0x04ce('0x70')],'queryText':_0x18502d[_0x04ce('0x69')][_0x04ce('0x71')],'responseId':_0x18502d[_0x04ce('0x72')],'score':_0x18502d[_0x04ce('0x69')][_0x04ce('0x73')],'speech':_0x18502d['queryResult'][_0x04ce('0x6d')],'providerResponse':JSON[_0x04ce('0x41')](_0x3f130d)};return _0x25eecf;}}});};exports[_0x04ce('0x74')]=function(_0x44373e,_0x430551,_0x50cedf,_0x461d4b){return tilde[_0x04ce('0x4d')](_0x44373e,_0x430551,_0x50cedf,_0x461d4b)[_0x04ce('0x2b')](function(_0x5ce95f){try{fs['unlink'](_0x44373e);}catch(_0x1ba7b3){logger[_0x04ce('0x14')](_0x1ba7b3);}logger['info'](_0x04ce('0x75'),_0x5ce95f[_0x04ce('0x52')]);logger[_0x04ce('0x18')](_0x04ce('0x76'),_0x5ce95f[_0x04ce('0x54')]);return _0x5ce95f;});};exports['awsPolly']=function(_0x384f84,_0x2b69c3,_0x23e476,_0x4ff36b,_0x406036,_0x3d75f3){var _0x144f48=path[_0x04ce('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0x04ce('0x38'));var _0x346d9b;return aws['polly'](_0x384f84,_0x2b69c3,_0x23e476,_0x4ff36b,_0x406036,_0x3d75f3,_0x144f48)[_0x04ce('0x2b')](function(){_0x346d9b=path[_0x04ce('0x27')](__dirname,'tmp',rs[_0x04ce('0x37')](0x4)+_0x04ce('0x29'));return convertFile(_0x144f48,_0x346d9b);})[_0x04ce('0x2b')](function(){try{fs[_0x04ce('0x1b')](_0x144f48);fs[_0x04ce('0x2c')](_0x346d9b,_0x04ce('0x2d'));}catch(_0x577aea){logger[_0x04ce('0x14')](_0x577aea);}return _0x346d9b[_0x04ce('0x2e')]('.')[0x0];});};exports[_0x04ce('0x77')]=function(_0x4a8c7c,_0x10aef9,_0x3663c6,_0x107a97,_0x4b1898,_0x4c5a3){return aws[_0x04ce('0x78')](_0x4a8c7c,_0x10aef9,_0x3663c6,_0x107a97,_0x4b1898,_0x4c5a3)[_0x04ce('0x2b')](function(_0x9c3702){logger[_0x04ce('0x18')](JSON['stringify'](_0x9c3702));return _0x9c3702;});};exports[_0x04ce('0x79')]=function(_0x4ca577,_0x599d38,_0x2fe000,_0x35d3a2){var _0x14aaf9=util['format'](_0x04ce('0x7a'),ISPEECH_API,_0x4ca577,encodeURIComponent(_0x599d38),_0x2fe000,_0x35d3a2);var _0x66b23e=path['resolve'](__dirname,'tmp',rs[_0x04ce('0x37')](0x4)+'.mp3');var _0x28d470;return downloadFile(_0x14aaf9,_0x66b23e)['then'](function(){_0x28d470=path[_0x04ce('0x27')](__dirname,_0x04ce('0x28'),rs[_0x04ce('0x37')](0x4)+_0x04ce('0x29'));return convertFile(_0x66b23e,_0x28d470);})[_0x04ce('0x2b')](function(){try{fs[_0x04ce('0x1b')](_0x66b23e);fs['chmodSync'](_0x28d470,_0x04ce('0x2d'));}catch(_0x3b101b){logger[_0x04ce('0x14')](_0x3b101b);}return _0x28d470['split']('.')[0x0];});};exports[_0x04ce('0x7b')]=function(_0x57e1c0,_0x3484d9,_0x382398,_0x3b6922){var _0x18ec78=util[_0x04ce('0x7c')](_0x04ce('0x7d'),ISPEECH_API,_0x3484d9,_0x382398,base64Encode(_0x57e1c0),_0x3b6922?util[_0x04ce('0x7c')](_0x04ce('0x7e'),encodeURIComponent(_0x3b6922)):_0x04ce('0x7f'));return uploadFile(_0x18ec78)['then'](function(_0xe7bb12){return querystring['parse'](_0xe7bb12);});};exports[_0x04ce('0x80')]=function(_0x567cc8,_0x53e789){return sestek[_0x04ce('0x81')](_0x567cc8,_0x53e789)[_0x04ce('0x2b')](function(_0x3a987a){logger['info'](JSON[_0x04ce('0x41')](_0x3a987a));var _0x150b02={'speech':_0x3a987a[_0x04ce('0x82')],'action':_0x3a987a['channelData']?_0x3a987a[_0x04ce('0x83')][_0x04ce('0x84')]:undefined,'actiondata':_0x3a987a['channelData']?_0x3a987a['channelData'][_0x04ce('0x85')]:undefined};if(_0x3a987a[_0x04ce('0x83')]&&_0x3a987a['channelData'][_0x04ce('0x86')]){return base64Decode(_0x3a987a[_0x04ce('0x83')][_0x04ce('0x86')][_0x04ce('0x87')],path[_0x04ce('0x27')](__dirname,_0x04ce('0x28'),rs[_0x04ce('0x37')](0x4)+_0x04ce('0x29')))[_0x04ce('0x2b')](function(_0x1d401a){_0x150b02[_0x04ce('0x88')]=_0x1d401a;return _0x150b02;});}return _0x150b02;});};exports[_0x04ce('0x89')]=function(){return __dirname;}; \ No newline at end of file +var _0x5356=['split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','.mp3','from','audioContent','writeFile','777','then','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','jQ1olc','stringify','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','source','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','sestekNDA','nda','channelData','AudioFromTts','audiofile','apiai-promise','http','https','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','close','unlink','download\x20error','end','https:','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','base64','chmodSync'];(function(_0x4186e4,_0x4db806){var _0x544e7a=function(_0x4a7e84){while(--_0x4a7e84){_0x4186e4['push'](_0x4186e4['shift']());}};_0x544e7a(++_0x4db806);}(_0x5356,0x173));var _0x6535=function(_0x5de843,_0x44186b){_0x5de843=_0x5de843-0x0;var _0x17d234=_0x5356[_0x5de843];return _0x17d234;};'use strict';var apiai=require(_0x6535('0x0'));var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x6535('0x1'));var https=require(_0x6535('0x2'));var md5=require('md5');var path=require(_0x6535('0x3'));var querystring=require(_0x6535('0x4'));var rp=require(_0x6535('0x5'));var rs=require(_0x6535('0x6'));var sox=require(_0x6535('0x7'));var tts=require(_0x6535('0x8'));var urlParse=require(_0x6535('0x9'))[_0x6535('0xa')];var util=require(_0x6535('0xb'));var aws=require(_0x6535('0xc'));var google=require(_0x6535('0xd'));var sestek=require(_0x6535('0xe'));var tilde=require(_0x6535('0xf'));var logger=require('../../../config/logger')(_0x6535('0x10'));var ISPEECH_API=_0x6535('0x11');function downloadFile(_0x13ebd4,_0x54c7c8){return new BPromise(function(_0x4bc9f7,_0x3edbfd){var _0x346c84=urlParse(_0x13ebd4);var _0x5d188c=_0x346c84[_0x6535('0x12')]==='https:'?https:http;var _0x30366a={'host':_0x346c84[_0x6535('0x13')],'path':_0x346c84[_0x6535('0x3')],'headers':{'user-agent':_0x6535('0x14')}};_0x5d188c[_0x6535('0x15')](_0x30366a,function(_0x1d1c66){if(_0x1d1c66[_0x6535('0x16')]!==0xc8){logger[_0x6535('0x17')](_0x6535('0x18')+_0x13ebd4+'\x20failed,\x20status\x20code\x20=\x20'+_0x1d1c66['statusCode']+'\x20('+_0x1d1c66[_0x6535('0x19')]+')');_0x3edbfd(new Error(_0x6535('0x18')+_0x13ebd4+_0x6535('0x1a')+_0x1d1c66['statusCode']+'\x20('+_0x1d1c66['statusMessage']+')'));return;}var _0x8a293b=fs[_0x6535('0x1b')](_0x54c7c8);_0x8a293b['on'](_0x6535('0x1c'),function(){logger[_0x6535('0x1d')]('finish\x20download\x20file');_0x8a293b[_0x6535('0x1e')](_0x4bc9f7);});_0x8a293b['on'](_0x6535('0x17'),function(_0x34d5a0){fs[_0x6535('0x1f')](_0x54c7c8);logger[_0x6535('0x17')](_0x6535('0x20'),_0x34d5a0);_0x3edbfd(_0x34d5a0);});_0x1d1c66['pipe'](_0x8a293b);})['on']('error',function(_0x14c691){logger[_0x6535('0x17')](_0x14c691);_0x3edbfd(_0x14c691);})[_0x6535('0x21')]();});}function uploadFile(_0x207577){return new BPromise(function(_0xd6327b,_0x9dd4cf){var _0x5e588a=urlParse(_0x207577);var _0x3cf93d=_0x5e588a[_0x6535('0x12')]===_0x6535('0x22')?https:http;var _0x4be376={'host':_0x5e588a['host'],'path':_0x5e588a['path'],'headers':{'user-agent':_0x6535('0x14')}};_0x3cf93d[_0x6535('0x15')](_0x4be376,function(_0x796e2a){if(_0x796e2a[_0x6535('0x16')]!==0xc8){_0x9dd4cf(new Error(_0x6535('0x18')+_0x207577+'\x20failed,\x20status\x20code\x20=\x20'+_0x796e2a[_0x6535('0x16')]+'\x20('+_0x796e2a[_0x6535('0x19')]+')'));return;}var _0x490762='';_0x796e2a['on'](_0x6535('0x23'),function(_0x123d4a){_0x490762+=_0x123d4a;});_0x796e2a['on']('end',function(){_0xd6327b(_0x490762);});})['on']('error',function(_0x1e1c33){_0x9dd4cf(_0x1e1c33);})['end']();});}function convertFile(_0xa09607,_0x3162a6){return new BPromise(function(_0x23b1c6,_0x5c0f8d){var _0x1ffe2f=sox[_0x6535('0x24')](_0xa09607,_0x3162a6,{'sampleRate':0x1f40,'format':_0x6535('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1ffe2f['on']('error',function(_0x36924d){logger[_0x6535('0x17')](_0x6535('0x26'),_0x36924d);_0x5c0f8d(_0x36924d);});_0x1ffe2f['on'](_0x6535('0x21'),function(){logger[_0x6535('0x1d')](_0x6535('0x27'));_0x23b1c6();});_0x1ffe2f[_0x6535('0x28')]();});}function base64Decode(_0x269f55,_0x3c10e2){var _0x3bbb19=path['resolve'](__dirname,_0x6535('0x29'),rs[_0x6535('0x2a')](0x4)+_0x6535('0x2b'));fs['writeFileSync'](_0x3bbb19,_0x269f55,_0x6535('0x2c'));return convertFile(_0x3bbb19,_0x3c10e2)['then'](function(){try{fs[_0x6535('0x1f')](_0x3bbb19);fs[_0x6535('0x2d')](_0x3c10e2,'777');}catch(_0x3694e1){logger[_0x6535('0x17')](_0x3694e1);}return _0x3c10e2[_0x6535('0x2e')]('.')[0x0];});}function base64Encode(_0x317c1b){var _0x5872d9=fs[_0x6535('0x2f')](_0x317c1b);return new Buffer(_0x5872d9)[_0x6535('0x30')](_0x6535('0x2c'));}exports[_0x6535('0x31')]=function(_0x13b30a,_0x363724,_0x146343,_0x2dacc3,_0xfbab10,_0x1347b2){var _0x16eed8,_0xa110dc;var _0x39a9c=_0x6535('0x32');var _0x35846d='?key='+_0x13b30a;var _0x433a41={};if(_0x363724==='ssml'){_0x433a41[_0x6535('0x33')]={'ssml':_0x146343};}else{_0x433a41[_0x6535('0x33')]={'text':_0x146343};};_0x433a41[_0x6535('0x34')]={'languageCode':_0x2dacc3,'ssmlGender':_0xfbab10};_0x433a41[_0x6535('0x35')]={'audioEncoding':_0x6535('0x36'),'sampleRateHertz':0x1f40};var _0xf6369={'url':_0x39a9c+_0x6535('0x37')+_0x35846d,'method':_0x6535('0x38'),'json':!![],'body':_0x433a41};return rp(_0xf6369)['then'](function(_0x2774ae){return new BPromise(function(_0x1b72d4,_0x578458){_0x16eed8=path[_0x6535('0x39')](__dirname,'tmp',rs[_0x6535('0x2a')](0x4)+_0x6535('0x3a'));var _0x45b1a5=Buffer[_0x6535('0x3b')](_0x2774ae[_0x6535('0x3c')],_0x6535('0x2c'));return fs[_0x6535('0x3d')](_0x16eed8,_0x45b1a5,function(_0x1c615a){_0x578458(_0x1c615a);},function(_0x225452){fs[_0x6535('0x2d')](_0x16eed8,_0x6535('0x3e'));_0x1b72d4(_0x225452);});});})[_0x6535('0x3f')](function(_0x1d73b3){_0xa110dc=path[_0x6535('0x39')](__dirname,'tmp',rs[_0x6535('0x2a')](0x4)+'.wav');return convertFile(_0x16eed8,_0xa110dc);})['then'](function(){try{fs['unlink'](_0x16eed8);fs['chmodSync'](_0xa110dc,_0x6535('0x3e'));}catch(_0x28de4b){logger[_0x6535('0x17')](_0x28de4b);}logger[_0x6535('0x1d')](_0x6535('0x40'),_0xa110dc[_0x6535('0x2e')]('.')[0x0]);return _0xa110dc['split']('.')[0x0];});};exports[_0x6535('0x41')]=function(_0x1cd9ce,_0x486ffc){var _0x31a980='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x219407,_0xf3be3;var _0x2a64f;var _0x546890={'encoding':_0x6535('0x42'),'method':_0x6535('0x38'),'timeout':0x2710,'url':_0x31a980,'headers':{'Content-Type':_0x6535('0x43')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0x6535('0x44'),JSON[_0x6535('0x45')]([_0x1cd9ce,_0x486ffc||'en',![],'null']),null,_0x6535('0x46')]]]))};return rp(_0x546890)[_0x6535('0x3f')](function(_0x5526fa){try{_0x2a64f=eval(_0x5526fa['slice'](0x5))[0x0][0x2];}catch(_0x543f2b){throw new Error(_0x6535('0x47')+_0x5526fa[_0x6535('0x23')]);}if(!_0x2a64f){if(_0x1cd9ce[_0x6535('0x48')]>0xc8){throw new Error(_0x6535('0x49'));}else{throw new Error(_0x6535('0x4a')+_0x486ffc+_0x6535('0x4b'));}}try{_0x2a64f=eval(_0x2a64f)[0x0];}catch(_0x484b46){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x6535('0x23')]);}const _0x542869=_0x2a64f;_0x219407=path[_0x6535('0x39')](__dirname,_0x6535('0x29'),rs[_0x6535('0x2a')](0x4)+'.mp3');fs[_0x6535('0x4c')](_0x219407,_0x2a64f,{'encoding':'base64'});_0xf3be3=path[_0x6535('0x39')](__dirname,_0x6535('0x29'),rs[_0x6535('0x2a')](0x4)+_0x6535('0x2b'));return convertFile(_0x219407,_0xf3be3);})[_0x6535('0x3f')](function(){try{fs[_0x6535('0x1f')](_0x219407);fs[_0x6535('0x2d')](_0xf3be3,'777');}catch(_0x306c1c){logger[_0x6535('0x17')](_0x306c1c);}logger[_0x6535('0x1d')](_0x6535('0x4d'),_0xf3be3[_0x6535('0x2e')]('.')[0x0]);return _0xf3be3['split']('.')[0x0];});};exports[_0x6535('0x4e')]=function(_0x5c7c1e,_0x27df2b,_0x5c6547){return google[_0x6535('0x4f')](_0x5c7c1e,_0x27df2b,_0x5c6547)[_0x6535('0x3f')](function(_0x2da4ef){logger['info'](_0x2da4ef['uri']);return rp(_0x2da4ef);})[_0x6535('0x3f')](function(_0x54b008){var _0x4e00f9='';var _0x2d0a6c=0x0;try{fs[_0x6535('0x1f')](_0x5c7c1e);}catch(_0x53048d){logger['error'](_0x53048d);}if(_0x54b008&&_0x54b008[_0x6535('0x50')]){_0x4e00f9=_0x54b008[_0x6535('0x50')][_0x6535('0x51')](function(_0x1609bb){return _0x1609bb&&_0x1609bb[_0x6535('0x52')][0x0]&&_0x1609bb['alternatives'][0x0][_0x6535('0x53')]?_0x1609bb[_0x6535('0x52')][0x0][_0x6535('0x53')]:'';})[_0x6535('0x54')]('\x0a');_0x2d0a6c=_0x54b008['results']['map'](function(_0x4fb3c8){return _0x4fb3c8&&_0x4fb3c8['alternatives'][0x0]&&_0x4fb3c8['alternatives'][0x0][_0x6535('0x55')]?_0x4fb3c8['alternatives'][0x0][_0x6535('0x55')]:0x0;})[_0x6535('0x54')]('\x0a');}logger['info']('googleASR\x20transcription',_0x4e00f9);logger['info'](_0x6535('0x56'),_0x2d0a6c);return{'transcript':_0x4e00f9,'confidence':_0x2d0a6c};})[_0x6535('0x57')](function(_0x20bb94){logger[_0x6535('0x17')](_0x6535('0x58'),_0x20bb94[_0x6535('0x16')],_0x20bb94[_0x6535('0x59')],_0x20bb94[_0x6535('0x5a')]);});};exports[_0x6535('0x5b')]=function(_0x5b5311,_0xb3062f,_0x3e4cff,_0x4db9f7){var _0x59d880=apiai(_0xb3062f,{'language':_0x4db9f7||'en'});return _0x59d880['textRequest'](_0x3e4cff,{'sessionId':md5(_0x5b5311)})[_0x6535('0x3f')](function(_0x11ca6e){logger['info'](JSON['stringify'](_0x11ca6e));return{'source':_0x11ca6e['result'][_0x6535('0x5c')],'resolvedQuery':_0x11ca6e[_0x6535('0x5d')][_0x6535('0x5e')],'action':_0x11ca6e[_0x6535('0x5d')][_0x6535('0x5f')],'actionIncomplete':_0x11ca6e['result'][_0x6535('0x60')],'speech':_0x11ca6e[_0x6535('0x5d')][_0x6535('0x61')][_0x6535('0x62')],'score':_0x11ca6e[_0x6535('0x5d')][_0x6535('0x63')],'statusCode':_0x11ca6e[_0x6535('0x64')][_0x6535('0x65')],'endConversation':_0x11ca6e[_0x6535('0x5d')][_0x6535('0x66')][_0x6535('0x67')]||![],'isFallbackIntent':_0x11ca6e[_0x6535('0x5d')][_0x6535('0x66')][_0x6535('0x68')]};});};exports[_0x6535('0x69')]=function(_0x1d7c50,_0xd36017,_0x257e86,_0x560cfd,_0x13b21b,_0x4d4e57){var _0x52d1b4=_0x560cfd[_0x6535('0x6a')](/\\n/g,'\x0a');var _0x503086={'credentials':{'private_key':_0x52d1b4,'client_email':_0x257e86}};var _0x4722e3=new dialogflow[(_0x6535('0x6b'))](_0x503086);var _0x699120=_0x4722e3[_0x6535('0x6c')](_0xd36017,md5(_0x1d7c50));var _0x26ed64={'session':_0x699120,'queryInput':{'text':{'text':_0x13b21b,'languageCode':_0x4d4e57}}};return _0x4722e3[_0x6535('0x6d')](_0x26ed64)[_0x6535('0x3f')](function(_0x13b0fd){if(_0x13b0fd&&_0x13b0fd[_0x6535('0x48')]){logger[_0x6535('0x1d')](_0x6535('0x6e'),JSON[_0x6535('0x45')](_0x13b0fd));var _0x5214d9=_0x13b0fd[0x0];if(_0x5214d9){var _0x40aa9d={'action':_0x5214d9['queryResult'][_0x6535('0x5f')],'allRequiredParamsPresent':_0x5214d9[_0x6535('0x6f')][_0x6535('0x70')],'endConversation':_0x5214d9[_0x6535('0x6f')][_0x6535('0x71')]&&_0x5214d9[_0x6535('0x6f')]['diagnosticInfo'][_0x6535('0x72')]?_0x5214d9['queryResult'][_0x6535('0x71')][_0x6535('0x72')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x5214d9[_0x6535('0x6f')][_0x6535('0x73')],'intentName':_0x5214d9[_0x6535('0x6f')][_0x6535('0x74')][_0x6535('0x59')],'intentDisplayName':_0x5214d9[_0x6535('0x6f')]['intent'][_0x6535('0x75')],'isFallbackIntent':_0x5214d9['queryResult']['intent'][_0x6535('0x76')],'languageCode':_0x5214d9[_0x6535('0x6f')][_0x6535('0x77')],'queryText':_0x5214d9[_0x6535('0x6f')][_0x6535('0x78')],'responseId':_0x5214d9[_0x6535('0x79')],'score':_0x5214d9[_0x6535('0x6f')][_0x6535('0x7a')],'speech':_0x5214d9[_0x6535('0x6f')]['fulfillmentText'],'providerResponse':JSON['stringify'](_0x13b0fd)};return _0x40aa9d;}}});};exports[_0x6535('0x7b')]=function(_0x20d83f,_0x346113,_0x390421,_0x4231c6){return tilde[_0x6535('0x4f')](_0x20d83f,_0x346113,_0x390421,_0x4231c6)[_0x6535('0x3f')](function(_0x3b656a){try{fs[_0x6535('0x1f')](_0x20d83f);}catch(_0x410db1){logger[_0x6535('0x17')](_0x410db1);}logger['info'](_0x6535('0x7c'),_0x3b656a[_0x6535('0x53')]);logger[_0x6535('0x1d')](_0x6535('0x7d'),_0x3b656a['confidence']);return _0x3b656a;});};exports[_0x6535('0x7e')]=function(_0x523c1c,_0x5471be,_0x3193bc,_0x5b2e00,_0x299a5e,_0x3270ab){var _0x377ba8=path[_0x6535('0x39')](__dirname,'tmp',rs[_0x6535('0x2a')](0x4)+'.mp3');var _0x1203e4;return aws[_0x6535('0x7f')](_0x523c1c,_0x5471be,_0x3193bc,_0x5b2e00,_0x299a5e,_0x3270ab,_0x377ba8)['then'](function(){_0x1203e4=path[_0x6535('0x39')](__dirname,_0x6535('0x29'),rs[_0x6535('0x2a')](0x4)+_0x6535('0x2b'));return convertFile(_0x377ba8,_0x1203e4);})[_0x6535('0x3f')](function(){try{fs[_0x6535('0x1f')](_0x377ba8);fs[_0x6535('0x2d')](_0x1203e4,_0x6535('0x3e'));}catch(_0xb1a551){logger[_0x6535('0x17')](_0xb1a551);}return _0x1203e4['split']('.')[0x0];});};exports[_0x6535('0x80')]=function(_0x26ba19,_0x16de7b,_0x459e40,_0x3d2978,_0x17daeb,_0x496d74){return aws[_0x6535('0x81')](_0x26ba19,_0x16de7b,_0x459e40,_0x3d2978,_0x17daeb,_0x496d74)[_0x6535('0x3f')](function(_0x5d7612){logger['info'](JSON[_0x6535('0x45')](_0x5d7612));return _0x5d7612;});};exports[_0x6535('0x82')]=function(_0x595110,_0x32688d,_0x4c8c31,_0x352a76){var _0xee0ada=util[_0x6535('0x83')](_0x6535('0x84'),ISPEECH_API,_0x595110,encodeURIComponent(_0x32688d),_0x4c8c31,_0x352a76);var _0x3b9ddc=path[_0x6535('0x39')](__dirname,_0x6535('0x29'),rs['generate'](0x4)+_0x6535('0x3a'));var _0x56a6d3;return downloadFile(_0xee0ada,_0x3b9ddc)[_0x6535('0x3f')](function(){_0x56a6d3=path[_0x6535('0x39')](__dirname,_0x6535('0x29'),rs[_0x6535('0x2a')](0x4)+_0x6535('0x2b'));return convertFile(_0x3b9ddc,_0x56a6d3);})[_0x6535('0x3f')](function(){try{fs[_0x6535('0x1f')](_0x3b9ddc);fs['chmodSync'](_0x56a6d3,_0x6535('0x3e'));}catch(_0x20c301){logger['error'](_0x20c301);}return _0x56a6d3[_0x6535('0x2e')]('.')[0x0];});};exports[_0x6535('0x85')]=function(_0x87d370,_0x2c467d,_0x358f18,_0x1731ae){var _0xdb1baa=util[_0x6535('0x83')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x2c467d,_0x358f18,base64Encode(_0x87d370),_0x1731ae?util[_0x6535('0x83')]('model=%s',encodeURIComponent(_0x1731ae)):'freeform=3');return uploadFile(_0xdb1baa)[_0x6535('0x3f')](function(_0x303624){return querystring[_0x6535('0xa')](_0x303624);});};exports[_0x6535('0x86')]=function(_0x472228,_0xa7c15b){return sestek[_0x6535('0x87')](_0x472228,_0xa7c15b)[_0x6535('0x3f')](function(_0x3cd141){logger[_0x6535('0x1d')](JSON[_0x6535('0x45')](_0x3cd141));var _0xfe9aec={'speech':_0x3cd141['text'],'action':_0x3cd141['channelData']?_0x3cd141['channelData']['CustomAction']:undefined,'actiondata':_0x3cd141['channelData']?_0x3cd141['channelData']['CustomActionData']:undefined};if(_0x3cd141[_0x6535('0x88')]&&_0x3cd141[_0x6535('0x88')][_0x6535('0x89')]){return base64Decode(_0x3cd141[_0x6535('0x88')][_0x6535('0x89')]['Data'],path['resolve'](__dirname,'tmp',rs[_0x6535('0x2a')](0x4)+_0x6535('0x2b')))[_0x6535('0x3f')](function(_0x4641aa){_0xfe9aec[_0x6535('0x8a')]=_0x4641aa;return _0xfe9aec;});}return _0xfe9aec;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index fb745dd..a72c72e 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 _0x8c25=['./nda','exports'];(function(_0x41c577,_0x47ead4){var _0x24a16a=function(_0x34eceb){while(--_0x34eceb){_0x41c577['push'](_0x41c577['shift']());}};_0x24a16a(++_0x47ead4);}(_0x8c25,0x15e));var _0x58c2=function(_0x1aa3c9,_0x36e605){_0x1aa3c9=_0x1aa3c9-0x0;var _0x1be779=_0x8c25[_0x1aa3c9];return _0x1be779;};var nda=require(_0x58c2('0x0'));module[_0x58c2('0x1')]={'nda':nda}; \ No newline at end of file +var _0x5c42=['exports','./nda'];(function(_0x5e68ef,_0x53e11b){var _0xecfc17=function(_0x353e77){while(--_0x353e77){_0x5e68ef['push'](_0x5e68ef['shift']());}};_0xecfc17(++_0x53e11b);}(_0x5c42,0x12d));var _0x25c4=function(_0x1f2999,_0x12220f){_0x1f2999=_0x1f2999-0x0;var _0x3fb41e=_0x5c42[_0x1f2999];return _0x3fb41e;};var nda=require(_0x25c4('0x0'));module[_0x25c4('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 6da90f8..1649746 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 _0xbbfa=['ndauth_url','/token','password','username','ndaactivity_type','Nda','callerid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','request-promise','../../../../../config/logger','exports','POST','resolve'];(function(_0x2c985e,_0x5600cf){var _0x37f34d=function(_0x525c0f){while(--_0x525c0f){_0x2c985e['push'](_0x2c985e['shift']());}};_0x37f34d(++_0x5600cf);}(_0xbbfa,0x1e9));var _0xabbf=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0xbbfa[_0x152136];return _0x20df44;};'use strict';var rp=require(_0xabbf('0x0'));var url=require('url');var logger=require(_0xabbf('0x1'))('agi');module[_0xabbf('0x2')]=function(_0x1ba4c4,_0x33a780){var _0x1b0dee={'method':_0xabbf('0x3'),'uri':url[_0xabbf('0x4')](_0x33a780[_0xabbf('0x5')],_0xabbf('0x6')),'form':{'grant_type':_0xabbf('0x7'),'username':_0x33a780[_0xabbf('0x8')],'password':_0x33a780[_0xabbf('0x7')]},'json':!![]};return rp(_0x1b0dee)['then'](function(_0x5b471b){var _0x536a4c={'method':_0xabbf('0x3'),'uri':url[_0xabbf('0x4')](_0x33a780['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x33a780[_0xabbf('0x9')]||'message','channelId':_0xabbf('0xa'),'conversation':{'id':_0x1ba4c4['uniqueid']},'from':{'id':_0x1ba4c4[_0xabbf('0xb')],'name':_0x1ba4c4['calleridname']},'recipient':{'id':_0x1ba4c4['dnid'],'name':_0x1ba4c4[_0xabbf('0xc')]},'text':_0x33a780[_0xabbf('0xd')],'channelData':{}},'headers':{'Authorization':_0xabbf('0xe')+_0x5b471b[_0xabbf('0xf')]},'json':!![]};if(_0x33a780[_0xabbf('0x10')]){_0x536a4c[_0xabbf('0x11')][_0xabbf('0x12')][_0xabbf('0x13')]=_0x33a780[_0xabbf('0x10')];}if(_0x33a780['ndagenerate_audio']=='1'){_0x536a4c[_0xabbf('0x11')]['channelData'][_0xabbf('0x14')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x33a780[_0xabbf('0x15')]){_0x536a4c[_0xabbf('0x11')][_0xabbf('0x12')][_0xabbf('0x16')]=_0x33a780['custom_action'];if(_0x33a780[_0xabbf('0x17')]){_0x536a4c[_0xabbf('0x11')][_0xabbf('0x12')][_0xabbf('0x18')]=_0x33a780[_0xabbf('0x17')];}}logger['info'](JSON[_0xabbf('0x19')](_0x536a4c));return rp(_0x536a4c);});}; \ No newline at end of file +var _0x6e6c=['calleridname','dnid','extension','text','access_token','body','channelData','ProjectName','project','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','stringify','request-promise','url','agi','exports','resolve','/token','password','then','POST','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var rp=require(_0xc6e6('0x0'));var url=require(_0xc6e6('0x1'));var logger=require('../../../../../config/logger')(_0xc6e6('0x2'));module[_0xc6e6('0x3')]=function(_0x58f303,_0x550e47){var _0x2e97f5={'method':'POST','uri':url[_0xc6e6('0x4')](_0x550e47['ndauth_url'],_0xc6e6('0x5')),'form':{'grant_type':_0xc6e6('0x6'),'username':_0x550e47['username'],'password':_0x550e47[_0xc6e6('0x6')]},'json':!![]};return rp(_0x2e97f5)[_0xc6e6('0x7')](function(_0x4da7bd){var _0x324706={'method':_0xc6e6('0x8'),'uri':url['resolve'](_0x550e47[_0xc6e6('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x550e47[_0xc6e6('0xa')]||_0xc6e6('0xb'),'channelId':_0xc6e6('0xc'),'conversation':{'id':_0x58f303[_0xc6e6('0xd')]},'from':{'id':_0x58f303[_0xc6e6('0xe')],'name':_0x58f303[_0xc6e6('0xf')]},'recipient':{'id':_0x58f303[_0xc6e6('0x10')],'name':_0x58f303[_0xc6e6('0x11')]},'text':_0x550e47[_0xc6e6('0x12')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x4da7bd[_0xc6e6('0x13')]},'json':!![]};if(_0x550e47['project']){_0x324706[_0xc6e6('0x14')][_0xc6e6('0x15')][_0xc6e6('0x16')]=_0x550e47[_0xc6e6('0x17')];}if(_0x550e47['ndagenerate_audio']=='1'){_0x324706[_0xc6e6('0x14')][_0xc6e6('0x15')][_0xc6e6('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xc6e6('0x19')};}if(_0x550e47[_0xc6e6('0x1a')]){_0x324706['body'][_0xc6e6('0x15')][_0xc6e6('0x1b')]=_0x550e47['custom_action'];if(_0x550e47[_0xc6e6('0x1c')]){_0x324706[_0xc6e6('0x14')][_0xc6e6('0x15')]['CustomActionData']=_0x550e47['custom_action_data'];}}logger['info'](JSON[_0xc6e6('0x1d')](_0x324706));return rp(_0x324706);});}; \ 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 ed5368a..13eb03f 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 _0x826a=['exports','./lib/api'];(function(_0x428fe3,_0x273213){var _0xca9a2=function(_0xdee0ef){while(--_0xdee0ef){_0x428fe3['push'](_0x428fe3['shift']());}};_0xca9a2(++_0x273213);}(_0x826a,0x15b));var _0xa826=function(_0x417207,_0x1c2363){_0x417207=_0x417207-0x0;var _0x3e5578=_0x826a[_0x417207];return _0x3e5578;};'use strict';var asr=require(_0xa826('0x0'));module[_0xa826('0x1')]=function(_0x394248,_0x15851b,_0x4af12f,_0x59429b){return asr(_0x394248,_0x15851b,_0x4af12f,_0x59429b);}; \ No newline at end of file +var _0xf9a8=['exports','./lib/api'];(function(_0x1e6978,_0x43a472){var _0x1afc39=function(_0x26e717){while(--_0x26e717){_0x1e6978['push'](_0x1e6978['shift']());}};_0x1afc39(++_0x43a472);}(_0xf9a8,0xdf));var _0x8f9a=function(_0x4b746a,_0xf67d2){_0x4b746a=_0x4b746a-0x0;var _0x2808b1=_0xf9a8[_0x4b746a];return _0x2808b1;};'use strict';var asr=require(_0x8f9a('0x0'));module[_0x8f9a('0x1')]=function(_0x7418c2,_0x224deb,_0x591945,_0x58a228){return asr(_0x7418c2,_0x224deb,_0x591945,_0x58a228);}; \ 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 e27bcb3..d0a708b 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 _0x4b39=['likelihood','Success.','terminate','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','open','bluebird','crypto','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','send','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','parse','status','result','hypotheses','transcript'];(function(_0x38c4ea,_0x42e383){var _0x4d7c2a=function(_0x4c01ac){while(--_0x4c01ac){_0x38c4ea['push'](_0x38c4ea['shift']());}};_0x4d7c2a(++_0x42e383);}(_0x4b39,0xaf));var _0x94b3=function(_0x30b10a,_0x506695){_0x30b10a=_0x30b10a-0x0;var _0x160fd3=_0x4b39[_0x30b10a];return _0x160fd3;};'use strict';var BPromise=require(_0x94b3('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x94b3('0x1'));var logger=require('../../../../../../config/logger')(_0x94b3('0x2'));module['exports']=function(_0x3c4bfb,_0x3e067d,_0x4273e9,_0x28fc6e){return new BPromise(function(_0x11413a,_0x45d640){logger[_0x94b3('0x3')](_0x94b3('0x4'),_0x28fc6e||_0x94b3('0x5'));var _0x52818e=new WebSocket(_0x28fc6e||_0x94b3('0x5'),{'perMessageDeflate':![]});var _0x91441b='';var _0x1031c6='0';var _0x5e276c='1';var _0x1f0d66='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x261530(_0x189863){var _0x2da22c=crypto[_0x94b3('0x6')](_0x94b3('0x7'));_0x2da22c[_0x94b3('0x8')](_0x189863);return _0x2da22c['digest'](_0x94b3('0x9'));}function _0xd38031(){try{logger[_0x94b3('0x3')](_0x94b3('0xa'));var _0x456bc1=moment()['unix']();var _0x41ff82=_0x261530(_0x456bc1+_0x3e067d+_0x4273e9);_0x52818e[_0x94b3('0xb')](JSON['stringify']({'appID':_0x3e067d,'timestamp':_0x456bc1,'appKey':_0x41ff82}));var _0x41aca0=fs['createReadStream'](_0x3c4bfb);_0x41aca0['on'](_0x94b3('0xc'),function(_0x51c31c){_0x52818e[_0x94b3('0xb')](_0x51c31c);});_0x41aca0['on'](_0x94b3('0xd'),function(){_0x52818e[_0x94b3('0xb')](_0x94b3('0xe'));});}catch(_0x22a582){logger[_0x94b3('0xf')](_0x94b3('0x10'),JSON[_0x94b3('0x11')](_0x22a582));_0x52818e['terminate']();}}function _0x582da4(_0x49cc14){try{if(_0x49cc14){var _0x5525ca=JSON[_0x94b3('0x12')](_0x49cc14);switch(_0x5525ca[_0x94b3('0x13')]){case 0x0:if(_0x5525ca[_0x94b3('0x14')]){if(_0x5525ca['result']['final']){logger[_0x94b3('0x3')]('Tilde\x20ASR\x20hypoteses',JSON[_0x94b3('0x11')](_0x5525ca[_0x94b3('0x14')][_0x94b3('0x15')]));_0x91441b=_0x5525ca[_0x94b3('0x14')][_0x94b3('0x15')][0x0][_0x94b3('0x16')];_0x1031c6=_0x5525ca[_0x94b3('0x14')][_0x94b3('0x15')][0x0][_0x94b3('0x17')];_0x5e276c='0';_0x1f0d66=_0x94b3('0x18');_0x52818e[_0x94b3('0x19')]();}}break;case 0x1:logger[_0x94b3('0x3')](_0x94b3('0x1a'));_0x5e276c='1';_0x1f0d66=_0x94b3('0x1a');break;case 0x2:logger[_0x94b3('0x3')](_0x94b3('0x1b'));_0x5e276c='2';_0x1f0d66=_0x94b3('0x1b');break;case 0x9:logger['info'](_0x94b3('0x1c'));_0x5e276c='9';_0x1f0d66=_0x94b3('0x1c');break;case 0xa:logger[_0x94b3('0x3')]('Authentication\x20failed.');_0x5e276c='10';_0x1f0d66=_0x94b3('0x1d');break;case 0xb:logger[_0x94b3('0x3')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x5e276c='11';_0x1f0d66='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0xa225e2){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0x94b3('0x11')](_0xa225e2));_0x52818e[_0x94b3('0x19')]();}}function _0x1e24ab(){logger[_0x94b3('0x3')](_0x94b3('0x1e'));_0x11413a({'transcript':_0x91441b,'confidence':_0x1031c6,'status':_0x5e276c,'status_message':_0x1f0d66});}function _0x4cdb1f(_0x502af9){logger[_0x94b3('0xf')](_0x94b3('0x1f'));if(!_['isNil'](_0x502af9)){logger[_0x94b3('0xf')](_['isObject'](_0x502af9)?JSON['stringify'](_0x502af9):_0x502af9);}}_0x52818e['on'](_0x94b3('0x20'),_0xd38031);_0x52818e['on']('message',_0x582da4);_0x52818e['on']('close',_0x1e24ab);_0x52818e['on']('error',_0x4cdb1f);});}; \ No newline at end of file +var _0xb72b=['All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','moment','agi','exports','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','stringify','data','send','close','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.'];(function(_0x5a5aca,_0x368fbb){var _0x1cb523=function(_0x43f690){while(--_0x43f690){_0x5a5aca['push'](_0x5a5aca['shift']());}};_0x1cb523(++_0x368fbb);}(_0xb72b,0x127));var _0xbb72=function(_0x3d551d,_0x1f1791){_0x3d551d=_0x3d551d-0x0;var _0x35acb1=_0xb72b[_0x3d551d];return _0x35acb1;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xbb72('0x0'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0xbb72('0x1'));module[_0xbb72('0x2')]=function(_0xe76e60,_0x289609,_0x54bc2c,_0x30e6b2){return new BPromise(function(_0x2b37fd,_0x597b01){logger['info']('Tilde\x20URI',_0x30e6b2||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x2bcfb1=new WebSocket(_0x30e6b2||_0xbb72('0x3'),{'perMessageDeflate':![]});var _0x129a32='';var _0x511769='0';var _0x237585='1';var _0x10f8a1=_0xbb72('0x4');function _0x158361(_0xbcd3bf){var _0x48f562=crypto[_0xbb72('0x5')](_0xbb72('0x6'));_0x48f562[_0xbb72('0x7')](_0xbcd3bf);return _0x48f562['digest'](_0xbb72('0x8'));}function _0x460232(){try{logger[_0xbb72('0x9')](_0xbb72('0xa'));var _0x2e2dfe=moment()[_0xbb72('0xb')]();var _0x57822b=_0x158361(_0x2e2dfe+_0x289609+_0x54bc2c);_0x2bcfb1['send'](JSON[_0xbb72('0xc')]({'appID':_0x289609,'timestamp':_0x2e2dfe,'appKey':_0x57822b}));var _0x498adf=fs['createReadStream'](_0xe76e60);_0x498adf['on'](_0xbb72('0xd'),function(_0x354108){_0x2bcfb1[_0xbb72('0xe')](_0x354108);});_0x498adf['on'](_0xbb72('0xf'),function(){_0x2bcfb1[_0xbb72('0xe')]('EOS');});}catch(_0x52dd81){logger['error']('Tilde\x20ASR\x20send\x20error',JSON[_0xbb72('0xc')](_0x52dd81));_0x2bcfb1[_0xbb72('0x10')]();}}function _0x38dff1(_0x26f608){try{if(_0x26f608){var _0x48e66b=JSON['parse'](_0x26f608);switch(_0x48e66b[_0xbb72('0x11')]){case 0x0:if(_0x48e66b[_0xbb72('0x12')]){if(_0x48e66b['result'][_0xbb72('0x13')]){logger['info'](_0xbb72('0x14'),JSON[_0xbb72('0xc')](_0x48e66b[_0xbb72('0x12')][_0xbb72('0x15')]));_0x129a32=_0x48e66b[_0xbb72('0x12')][_0xbb72('0x15')][0x0]['transcript'];_0x511769=_0x48e66b[_0xbb72('0x12')]['hypotheses'][0x0]['likelihood'];_0x237585='0';_0x10f8a1='Success.';_0x2bcfb1[_0xbb72('0x10')]();}}break;case 0x1:logger[_0xbb72('0x9')](_0xbb72('0x4'));_0x237585='1';_0x10f8a1='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info'](_0xbb72('0x16'));_0x237585='2';_0x10f8a1=_0xbb72('0x16');break;case 0x9:logger[_0xbb72('0x9')](_0xbb72('0x17'));_0x237585='9';_0x10f8a1='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info']('Authentication\x20failed.');_0x237585='10';_0x10f8a1=_0xbb72('0x18');break;case 0xb:logger['info'](_0xbb72('0x19'));_0x237585='11';_0x10f8a1=_0xbb72('0x19');}}}catch(_0x58dd56){logger[_0xbb72('0x1a')](_0xbb72('0x1b'),JSON['stringify'](_0x58dd56));_0x2bcfb1[_0xbb72('0x10')]();}}function _0x4ea88d(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x2b37fd({'transcript':_0x129a32,'confidence':_0x511769,'status':_0x237585,'status_message':_0x10f8a1});}function _0x1b2d87(_0x17c1d2){logger[_0xbb72('0x1a')](_0xbb72('0x1c'));if(!_[_0xbb72('0x1d')](_0x17c1d2)){logger[_0xbb72('0x1a')](_['isObject'](_0x17c1d2)?JSON['stringify'](_0x17c1d2):_0x17c1d2);}}_0x2bcfb1['on'](_0xbb72('0x1e'),_0x460232);_0x2bcfb1['on'](_0xbb72('0x1f'),_0x38dff1);_0x2bcfb1['on'](_0xbb72('0xf'),_0x4ea88d);_0x2bcfb1['on'](_0xbb72('0x1a'),_0x1b2d87);});}; \ 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 d6cec5c..0ec29a0 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 _0x942e=['./asr'];(function(_0xd3c939,_0x356e38){var _0x2cb033=function(_0x5cb2fc){while(--_0x5cb2fc){_0xd3c939['push'](_0xd3c939['shift']());}};_0x2cb033(++_0x356e38);}(_0x942e,0x147));var _0xe942=function(_0x19f5b1,_0x2b3b9a){_0x19f5b1=_0x19f5b1-0x0;var _0x5a622a=_0x942e[_0x19f5b1];return _0x5a622a;};var asr=require(_0xe942('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x2724=['exports','./asr'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0x2724,0x1c7));var _0x4272=function(_0x117883,_0x2f6deb){_0x117883=_0x117883-0x0;var _0x257595=_0x2724[_0x117883];return _0x257595;};var asr=require(_0x4272('0x0'));module[_0x4272('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 2256666..3d5590e 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 _0x968b=['E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','net','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','E_AGI_SERVER_ERROR','destroy'];(function(_0x4f77e8,_0x18fb3b){var _0x35c203=function(_0x317193){while(--_0x317193){_0x4f77e8['push'](_0x4f77e8['shift']());}};_0x35c203(++_0x18fb3b);}(_0x968b,0xed));var _0xb968=function(_0x3c3b51,_0xe90b55){_0x3c3b51=_0x3c3b51-0x0;var _0x303246=_0x968b[_0x3c3b51];return _0x303246;};'use strict';var util=require('util');var net=require(_0xb968('0x0'));var EventEmitter=require(_0xb968('0x1'))[_0xb968('0x2')];var AGIError=require(_0xb968('0x3'));var AGIChannel=require(_0xb968('0x4'));var AGIServer=function(_0x251829,_0x5e5750,_0x304e8d){var _0x5db31d=this,_0x251829=_0x251829||0x11dd,_0x5e5750=_0x5e5750||_0xb968('0x5'),_0x59e931=null,_0x14ceab=0x0;EventEmitter[_0xb968('0x6')](_0x5db31d);function _0x16dcbe(){if(!_0x251829){_0x5db31d[_0xb968('0x7')](_0xb968('0x8'),new AGIError(_0xb968('0x9')));return![];}_0x59e931=net[_0xb968('0xa')]();_0x59e931[_0xb968('0xb')](_0x251829,_0x5e5750);_0x59e931['on'](_0xb968('0xc'),function(){_0x5db31d[_0xb968('0x7')](_0xb968('0xc'));});_0x59e931['on'](_0xb968('0xd'),function(_0x40fffa){_0x59e931['getConnections'](function(_0x546b4d,_0x2812da){if(_0x546b4d){_0x5db31d[_0xb968('0x7')]('error',new AGIError(_0xb968('0xe'),_0x546b4d));}else if(_0x304e8d&&_0x304e8d<0x0){_0x5db31d[_0xb968('0x7')]('error',new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x40fffa[_0xb968('0xf')]();}else if(_0x304e8d&&_0x304e8d>0x0&&_0x304e8d<_0x2812da){_0x14ceab+=0x1;_0x5db31d[_0xb968('0x7')](_0xb968('0x8'),new AGIError(_0xb968('0x10'),_0x14ceab));_0x40fffa[_0xb968('0xf')]();}else{var _0x7ec4d2=new AGIChannel(_0x40fffa);_0x7ec4d2['on'](_0xb968('0x11'),function(){_0x5db31d[_0xb968('0x7')]('connection',_0x7ec4d2);});}});});_0x59e931['on'](_0xb968('0x8'),function(_0x4a34af){_0x5db31d[_0xb968('0x7')]('error',new AGIError(_0xb968('0xe'),_0x4a34af[_0xb968('0x12')]));});_0x59e931['on'](_0xb968('0x13'),function(){_0x5db31d[_0xb968('0x7')](_0xb968('0x13'),new AGIError(_0xb968('0x14')));});}process[_0xb968('0x15')](function(){_0x16dcbe();});};util['inherits'](AGIServer,EventEmitter);module[_0xb968('0x16')]=function(_0x550249,_0x5f371b,_0x332799){return new AGIServer(_0x550249,_0x5f371b,_0x332799);}; \ No newline at end of file +var _0xfe30=['net','events','EventEmitter','./error','./channel','127.0.0.1','emit','error','createServer','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','code','close','inherits'];(function(_0x28b17e,_0x41618e){var _0x3b446a=function(_0x4a0243){while(--_0x4a0243){_0x28b17e['push'](_0x28b17e['shift']());}};_0x3b446a(++_0x41618e);}(_0xfe30,0xc6));var _0x0fe3=function(_0x5c8827,_0x5bc5d7){_0x5c8827=_0x5c8827-0x0;var _0x50ffd5=_0xfe30[_0x5c8827];return _0x50ffd5;};'use strict';var util=require('util');var net=require(_0x0fe3('0x0'));var EventEmitter=require(_0x0fe3('0x1'))[_0x0fe3('0x2')];var AGIError=require(_0x0fe3('0x3'));var AGIChannel=require(_0x0fe3('0x4'));var AGIServer=function(_0xddb636,_0x240712,_0x4e3ea5){var _0x165f77=this,_0xddb636=_0xddb636||0x11dd,_0x240712=_0x240712||_0x0fe3('0x5'),_0x517434=null,_0x39bed0=0x0;EventEmitter['call'](_0x165f77);function _0x36dd3b(){if(!_0xddb636){_0x165f77[_0x0fe3('0x6')](_0x0fe3('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x517434=net[_0x0fe3('0x8')]();_0x517434['listen'](_0xddb636,_0x240712);_0x517434['on']('listening',function(){_0x165f77['emit']('listening');});_0x517434['on'](_0x0fe3('0x9'),function(_0x5483f1){_0x517434[_0x0fe3('0xa')](function(_0x172f57,_0x2350db){if(_0x172f57){_0x165f77[_0x0fe3('0x6')](_0x0fe3('0x7'),new AGIError(_0x0fe3('0xb'),_0x172f57));}else if(_0x4e3ea5&&_0x4e3ea5<0x0){_0x165f77['emit'](_0x0fe3('0x7'),new AGIError(_0x0fe3('0xc')));_0x5483f1[_0x0fe3('0xd')]();}else if(_0x4e3ea5&&_0x4e3ea5>0x0&&_0x4e3ea5<_0x2350db){_0x39bed0+=0x1;_0x165f77[_0x0fe3('0x6')](_0x0fe3('0x7'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x39bed0));_0x5483f1[_0x0fe3('0xd')]();}else{var _0x238645=new AGIChannel(_0x5483f1);_0x238645['on'](_0x0fe3('0xe'),function(){_0x165f77[_0x0fe3('0x6')](_0x0fe3('0x9'),_0x238645);});}});});_0x517434['on'](_0x0fe3('0x7'),function(_0x47d937){_0x165f77['emit'](_0x0fe3('0x7'),new AGIError(_0x0fe3('0xb'),_0x47d937[_0x0fe3('0xf')]));});_0x517434['on'](_0x0fe3('0x10'),function(){_0x165f77[_0x0fe3('0x6')](_0x0fe3('0x10'),new AGIError('E_AGI_SERVER_CLOSE'));});}process['nextTick'](function(){_0x36dd3b();});};util[_0x0fe3('0x11')](AGIServer,EventEmitter);module['exports']=function(_0x1ab542,_0x1ad6e7,_0x307bd9){return new AGIServer(_0x1ab542,_0x1ad6e7,_0x307bd9);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index bcded01..df0d3be 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 _0xa1c9=['clear','agicommand','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','isConfigured','noop','no\x20text\x20configured','options','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INSTANCE()','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','SIP/%s','opts','dialogflow','bot','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','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','no\x20ndauth\x20url\x20configured','password','no\x20password\x20configured','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','Executed\x20command\x20%s','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','hiddendigitsnum','generate','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','no\x20key\x20configured','%s/recordings/%s','beep','intKey','googleASR','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','NOBEEP','recordFile','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','no\x20find\x20by\x20configured','math','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','position','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%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','statusCode','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','sayNumber','number','replace','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','email','user','subject','service','host','secure','auth','pass','template_id','sendMail\x20message','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','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\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','channel','rpc','prototype','getVariable','getVariableById','name','getVoiceQueue','getVoiceQueueById','then','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','info','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','callerid','createSquareRecording','calleridname','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agent','agentPause','isNil','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','exec','trim','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','includes','PUT','toUpperCase','body','rawBody','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','message','googleDialogflow','dialogflow_language','googleDialogflowV2','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','key','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','google_asr_language','tildeASR','appid','appsecret'];(function(_0x33e8b6,_0x196326){var _0x1c4498=function(_0x2c7151){while(--_0x2c7151){_0x33e8b6['push'](_0x33e8b6['shift']());}};_0x1c4498(++_0x196326);}(_0xa1c9,0x135));var _0x9a1c=function(_0x5774ac,_0x379bc7){_0x5774ac=_0x5774ac-0x0;var _0x1924bd=_0xa1c9[_0x5774ac];return _0x1924bd;};'use strict';var fs=require('fs');var path=require(_0x9a1c('0x0'));var util=require(_0x9a1c('0x1'));var _=require(_0x9a1c('0x2'));var sh=require(_0x9a1c('0x3'));var odbc=require(_0x9a1c('0x4'))();var rs=require(_0x9a1c('0x5'));var moment=require(_0x9a1c('0x6'));var Mustache=require(_0x9a1c('0x7'));var rp=require(_0x9a1c('0x8'));var logger=require('../../config/logger')(_0x9a1c('0x9'));var config=require(_0x9a1c('0xa'));var scripts=require(_0x9a1c('0xb'));var FILES_PATH=_0x9a1c('0xc');var recursiveMapAttributes=[_0x9a1c('0xd'),'rawBody'];var verticesWithRetry=[_0x9a1c('0xe'),_0x9a1c('0xf'),'getsecretdigits'];var AGIVertices=function(_0x564d86,_0x5ab1f7,_0x4a8a44){this[_0x9a1c('0x10')]=_0x564d86;this[_0x9a1c('0x11')]=_0x5ab1f7;this['mailRpc']=_0x4a8a44;};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x13')]=function(_0x2524e3,_0x3f955b){this[_0x9a1c('0x11')][_0x9a1c('0x14')](_0x2524e3)['then'](function(_0x10e3bb){_0x3f955b(null,_0x10e3bb?_0x10e3bb[_0x9a1c('0x15')]:![]);})['catch'](function(_0x55b576){_0x3f955b(_0x55b576);});};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x16')]=function(_0x518b1e,_0x7eda6){this[_0x9a1c('0x11')][_0x9a1c('0x17')](_0x518b1e)[_0x9a1c('0x18')](function(_0x23edce){_0x7eda6(null,_0x23edce?_0x23edce['name']:![]);})[_0x9a1c('0x19')](function(_0x3e1349){_0x7eda6(_0x3e1349);});};AGIVertices['prototype'][_0x9a1c('0x1a')]=function(_0x59c769,_0x342448){this['rpc'][_0x9a1c('0x1b')](_0x59c769)['then'](function(_0xcca0e5){_0x342448(null,_0xcca0e5?_0xcca0e5[_0x9a1c('0x15')]:![]);})['catch'](function(_0x3b7f8d){_0x342448(_0x3b7f8d);});};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x1c')]=function(_0x3c8d9d,_0x4134ee){this['rpc'][_0x9a1c('0x1d')](_0x3c8d9d)[_0x9a1c('0x18')](function(_0x5ef70a){_0x4134ee(null,_0x5ef70a?_0x5ef70a[_0x9a1c('0x1e')]:![]);})[_0x9a1c('0x19')](function(_0x24254c){_0x4134ee(_0x24254c);});};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x1f')]=function(_0x3a8a12,_0x3a69ef){this[_0x9a1c('0x11')][_0x9a1c('0x20')](_0x3a8a12)[_0x9a1c('0x18')](function(_0x45fa32){_0x3a69ef(null,_0x45fa32?_0x45fa32['name']:![]);})[_0x9a1c('0x19')](function(_0x156f52){_0x3a69ef(_0x156f52);});};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x21')]=function(_0x5b1011,_0x4792bf){this[_0x9a1c('0x11')][_0x9a1c('0x22')](_0x5b1011)[_0x9a1c('0x18')](function(_0x2a9687){_0x4792bf(null,_0x2a9687?_0x2a9687[_0x9a1c('0x15')]:![]);})[_0x9a1c('0x19')](function(_0x36194e){_0x4792bf(_0x36194e);});};AGIVertices['prototype'][_0x9a1c('0x23')]=function(_0x422906,_0x3b25c6){var _0x2eb417=this;this[_0x9a1c('0x11')][_0x9a1c('0x24')](_0x422906)[_0x9a1c('0x18')](function(_0x4a0226){_0x3b25c6(null,_0x4a0226?_0x2eb417[_0x9a1c('0x25')](_0x4a0226[_0x9a1c('0x26')]):![]);})[_0x9a1c('0x19')](function(_0x52248e){_0x3b25c6(_0x52248e);});};AGIVertices[_0x9a1c('0x12')]['getMailAccount']=function(_0x5e6dd9,_0x37e741){this['rpc'][_0x9a1c('0x27')](_0x5e6dd9)['then'](function(_0x2ee6e7){_0x37e741(null,_0x2ee6e7?_0x2ee6e7:![]);})['catch'](function(_0x17d797){_0x37e741(_0x17d797);});};AGIVertices['prototype'][_0x9a1c('0x28')]=function(_0x3c6266,_0x403d48,_0x533ba8){this[_0x9a1c('0x29')][_0x9a1c('0x28')](_0x3c6266,_0x403d48)[_0x9a1c('0x18')](function(){_0x533ba8(null);})['catch'](function(_0x2884ee){_0x533ba8(_0x2884ee);});};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x2a')]=function(_0x303eab,_0x4ce8ab){this[_0x9a1c('0x11')][_0x9a1c('0x2b')](_0x303eab)[_0x9a1c('0x18')](function(_0x5ae8a8){if(_0x5ae8a8){if(_0x5ae8a8['IntervalId']){_0x4ce8ab(null,[_0x5ae8a8[_0x9a1c('0x2c')]]);}else{_0x4ce8ab(null,_[_0x9a1c('0x2d')](_0x5ae8a8[_0x9a1c('0x2e')],'interval'));}}else{_0x4ce8ab(null,![]);}})[_0x9a1c('0x19')](function(_0x5df6c1){_0x4ce8ab(_0x5df6c1);});};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x25')]=function(_0x2ee579){return util['format'](_0x9a1c('0x2f'),FILES_PATH,_0x2ee579);};AGIVertices['prototype'][_0x9a1c('0x30')]=function(_0x4a4a0a,_0x570f44,_0x29252f){odbc[_0x9a1c('0x31')](_0x4a4a0a,function(_0x2bfddb){if(_0x2bfddb){logger[_0x9a1c('0x32')](_0x9a1c('0x33'),_0x2bfddb);_0x29252f(_0x2bfddb);}else{logger['info'](_0x9a1c('0x34'));odbc['query'](_0x570f44,function(_0x20aa2c,_0x526602){if(_0x20aa2c){logger['info']('Error\x20executing\x20query\x20%s',_0x570f44);_0x29252f(_0x20aa2c);}else{logger[_0x9a1c('0x35')](_0x9a1c('0x36'),_0x570f44);odbc[_0x9a1c('0x37')](function(_0x5736a7){if(_0x5736a7){logger[_0x9a1c('0x32')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x5736a7);}_0x29252f(null,_0x526602);});}});}});};AGIVertices['prototype'][_0x9a1c('0x38')]=function(_0x30199b,_0x3cb9a4){this[_0x9a1c('0x11')][_0x9a1c('0x39')](_0x30199b)['then'](function(_0xc55a70){_0x3cb9a4(null,_0xc55a70?_0xc55a70:![]);})[_0x9a1c('0x19')](function(_0x4be325){_0x3cb9a4(_0x4be325);});};AGIVertices['prototype'][_0x9a1c('0x3a')]=function(_0xfeb7d9,_0x4b44c1){this[_0x9a1c('0x11')][_0x9a1c('0x3a')](_0xfeb7d9)[_0x9a1c('0x18')](function(_0x35e7ac){_0x4b44c1(null,_0x35e7ac);})[_0x9a1c('0x19')](function(_0x3606cf){_0x4b44c1(_0x3606cf);});};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x3b')]=function(_0x4efb97,_0x5e95e6,_0xba9bd8){this[_0x9a1c('0x11')][_0x9a1c('0x3b')]({'uniqueid':this[_0x9a1c('0x10')][_0x9a1c('0x3c')],'node':_0x4efb97['label'],'application':_0x4efb97['agicommand'],'data':_0x5e95e6||null,'project_name':this[_0x9a1c('0x10')]['arg_1'],'callerid':this[_0x9a1c('0x10')][_0x9a1c('0x3d')]})['then'](function(_0x2d9016){if(_0xba9bd8){_0xba9bd8(null,_0x2d9016);}})[_0x9a1c('0x19')](function(_0x52ee5c){if(_0xba9bd8){_0xba9bd8(_0x52ee5c);}});};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x3e')]=function(_0x240e62,_0x35acf6,_0x202931,_0x51cdae){this[_0x9a1c('0x11')][_0x9a1c('0x3e')]({'uniqueid':this[_0x9a1c('0x10')][_0x9a1c('0x3c')],'callerid':this[_0x9a1c('0x10')]['callerid'],'calleridname':this[_0x9a1c('0x10')][_0x9a1c('0x3f')],'context':this[_0x9a1c('0x10')]['context'],'extension':this[_0x9a1c('0x10')][_0x9a1c('0x40')],'priority':this[_0x9a1c('0x10')][_0x9a1c('0x41')],'accountcode':this[_0x9a1c('0x10')][_0x9a1c('0x42')],'dnid':this['channel'][_0x9a1c('0x43')],'projectName':this['channel'][_0x9a1c('0x44')],'saveName':_0x35acf6,'filename':_0x240e62[_0x9a1c('0x45')]||_0x35acf6,'savePath':_0x202931})['then'](function(_0x244863){_0x51cdae(null,_0x244863);})[_0x9a1c('0x19')](function(_0x526b3b){_0x51cdae(_0x526b3b);});};AGIVertices[_0x9a1c('0x12')]['createSquareMessage']=function(_0xf6f0f5,_0x5be34e,_0x2c297e,_0x888321,_0x2c0e2a){this[_0x9a1c('0x11')][_0x9a1c('0x46')]({'uniqueid':this['channel'][_0x9a1c('0x3c')],'body':_0xf6f0f5,'direction':_0x5be34e,'providerName':_0x2c297e,'providerResponse':_0x888321})[_0x9a1c('0x18')](function(_0x238ece){if(_0x2c0e2a){_0x2c0e2a(null,_0x238ece);}})[_0x9a1c('0x19')](function(_0xd6a83c){if(_0x2c0e2a){_0x2c0e2a(_0xd6a83c);}});};AGIVertices[_0x9a1c('0x12')]['createCmContact']=function(_0x58ce65,_0x3c4921){this['rpc'][_0x9a1c('0x47')]({'firstName':_[_0x9a1c('0x48')](_0x58ce65['name'])||_['isNil'](_0x58ce65[_0x9a1c('0x15')])?'callback_'+Math[_0x9a1c('0x49')]():_0x58ce65[_0x9a1c('0x15')],'lastName':_[_0x9a1c('0x48')](_0x58ce65[_0x9a1c('0x4a')])||_['isNil'](_0x58ce65[_0x9a1c('0x4a')])?null:_0x58ce65[_0x9a1c('0x4a')],'phone':_0x58ce65[_0x9a1c('0x4b')],'ListId':_0x58ce65[_0x9a1c('0x4c')],'scheduledat':_0x58ce65[_0x9a1c('0x4d')],'callbackUniqueid':this[_0x9a1c('0x10')][_0x9a1c('0x3c')],'tags':_0x9a1c('0x4e'),'description':_0x9a1c('0x4f')+_0x58ce65['scheduledAt'][_0x9a1c('0x50')](),'priority':_0x58ce65[_0x9a1c('0x51')]})[_0x9a1c('0x18')](function(_0x4d5d75){_0x3c4921(null,_0x4d5d75);})[_0x9a1c('0x19')](function(_0x138def){_0x3c4921(_0x138def);});};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x52')]=function(_0x45e611,_0x17bcd1){this[_0x9a1c('0x11')]['getPauseById'](_0x45e611)[_0x9a1c('0x18')](function(_0x430453){_0x17bcd1(null,_0x430453?_0x430453[_0x9a1c('0x15')]:![]);})[_0x9a1c('0x19')](function(_0x675e5){_0x17bcd1(_0x675e5);});};AGIVertices['prototype']['agentPause']=function(_0x378524,_0x53f171,_0x2f3d3d){var _0x37fe32={'role':_0x9a1c('0x53')};_0x37fe32[_0x378524]=this[_0x9a1c('0x10')][_0x9a1c('0x3d')];this['rpc'][_0x9a1c('0x54')](_0x37fe32,_0x53f171,this['channel']['uniqueid'])[_0x9a1c('0x18')](function(_0x462f8c){_0x2f3d3d(null,_[_0x9a1c('0x55')](_0x462f8c)?![]:!![]);})['catch'](function(_0x56c2db){logger[_0x9a1c('0x32')](_0x56c2db);_0x2f3d3d(null,![]);});};AGIVertices[_0x9a1c('0x12')]['agentUnpause']=function(_0x5a2d6d,_0x45c13c){var _0x57a078={'role':_0x9a1c('0x53')};_0x57a078[_0x5a2d6d]=this[_0x9a1c('0x10')][_0x9a1c('0x3d')];this[_0x9a1c('0x11')]['agentUnpause'](_0x57a078)[_0x9a1c('0x18')](function(_0x269c09){_0x45c13c(null,_['isNil'](_0x269c09)?![]:!![]);})[_0x9a1c('0x19')](function(_0x3e5e39){logger[_0x9a1c('0x32')](_0x3e5e39);_0x45c13c(null,![]);});};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x56')]=function(_0x238064,_0x3c2f17){var _0x53a2c0={'role':_0x9a1c('0x53')};_0x53a2c0[_0x238064]=this[_0x9a1c('0x10')][_0x9a1c('0x3d')];this[_0x9a1c('0x11')][_0x9a1c('0x56')](_0x53a2c0)['then'](function(_0x414b27){_0x3c2f17(null,_[_0x9a1c('0x55')](_0x414b27)?![]:!![]);})['catch'](function(_0x536bba){logger[_0x9a1c('0x32')](_0x536bba);_0x3c2f17(null,![]);});};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x57')]=function(_0xfb451,_0x176d17){var _0x1b3a87={'role':_0x9a1c('0x53')};_0x1b3a87[_0xfb451]=this[_0x9a1c('0x10')][_0x9a1c('0x3d')];var _0x528d22=_0xfb451!=_0x9a1c('0x58')?util[_0x9a1c('0x59')](_0x9a1c('0x5a'),_0x9a1c('0x5b'),this[_0x9a1c('0x10')]['callerid']):undefined;this[_0x9a1c('0x11')][_0x9a1c('0x57')](_0x1b3a87,_0x528d22)['then'](function(_0xdd58c6){_0x176d17(null,_[_0x9a1c('0x55')](_0xdd58c6)?![]:!![]);})[_0x9a1c('0x19')](function(_0x8ae731){logger['error'](_0x8ae731);_0x176d17(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x4b8f56,_0x4281f6){sh[_0x9a1c('0x5c')](_[_0x9a1c('0x5d')](_0x4b8f56),function(_0x31159c,_0x5930a7){var _0x5317a3=_0x5930a7['replace'](/(\r\n|\n|\r)/gm,'');_0x4281f6(null,_0x5317a3);});};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x5e')]=function(_0x53c9a6,_0x313152){scripts[_0x9a1c('0x5e')](_0x53c9a6['apiKey'],_0x53c9a6[_0x9a1c('0x5f')]||'text',_0x53c9a6[_0x9a1c('0x60')],_0x53c9a6[_0x9a1c('0x61')]||'en-US',_0x53c9a6[_0x9a1c('0x62')]||_0x9a1c('0x63'),_0x53c9a6['audioEncoding']||_0x9a1c('0x64'))[_0x9a1c('0x18')](function(_0x3b0a28){_0x313152(null,_0x3b0a28);})[_0x9a1c('0x19')](function(_0x545af8){_0x313152(_0x545af8);});};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x65')]=function(_0x2dc17d,_0x3be980){scripts[_0x9a1c('0x65')](_0x2dc17d[_0x9a1c('0x60')],_0x2dc17d[_0x9a1c('0x66')]||'en',0x1)[_0x9a1c('0x18')](function(_0x13b2bf){_0x3be980(null,_0x13b2bf);})[_0x9a1c('0x19')](function(_0x4d05d4){_0x3be980(_0x4d05d4);});};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x67')]=function(_0x2520ec,_0x510917){var _0x3801b7={'uri':_0x2520ec[_0x9a1c('0x68')],'method':_0x2520ec[_0x9a1c('0x69')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2520ec['timeout'])==='number'&&parseInt(_0x2520ec[_0x9a1c('0x6a')])>=0x1?parseInt(_0x2520ec[_0x9a1c('0x6a')])*0x3e8:0x5*0x3e8};if(_[_0x9a1c('0x6b')](['POST',_0x9a1c('0x6c')],_0x3801b7[_0x9a1c('0x69')][_0x9a1c('0x6d')]())){try{_0x3801b7[_0x9a1c('0x6e')]=_0x2520ec[_0x9a1c('0x6f')]?JSON[_0x9a1c('0x70')](_0x2520ec[_0x9a1c('0x6f')]):{};}catch(_0x23169e){logger[_0x9a1c('0x32')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x23169e);}}try{_0x3801b7[_0x9a1c('0x71')]=_0x2520ec[_0x9a1c('0xd')]?JSON[_0x9a1c('0x70')](_0x2520ec[_0x9a1c('0xd')]):{};}catch(_0x4ba902){logger[_0x9a1c('0x32')](_0x9a1c('0x72'),_0x4ba902);}if(_0x2520ec['computedVariables']){try{var _0x227c7c=require(_0x2520ec['computedVariables'])[_0x9a1c('0x73')](this,_0x3801b7);_0x3801b7[_0x9a1c('0x74')]=Mustache['render'](_0x2520ec['url'],_0x227c7c,{},['$$','$$']);if(_0x3801b7['headers']){_0x3801b7[_0x9a1c('0x71')]=JSON[_0x9a1c('0x70')](Mustache['render'](JSON['stringify'](_0x3801b7[_0x9a1c('0x71')]),_0x227c7c,{},['$$','$$']));}if(_0x3801b7['body']){_0x3801b7[_0x9a1c('0x6e')]=JSON[_0x9a1c('0x70')](Mustache[_0x9a1c('0x75')](JSON[_0x9a1c('0x76')](_0x3801b7['body']),_0x227c7c,{},['$$','$$']));}}catch(_0x46d0a4){logger['error'](_0x9a1c('0x77'),_0x46d0a4);}}rp(_0x3801b7)[_0x9a1c('0x18')](function(_0x1aa126){var _0x22e0c2={'statusCode':_0x1aa126['statusCode']||0xc8,'statusMessage':_0x1aa126['statusMessage']||'OK','headers':_0x1aa126[_0x9a1c('0x71')]||{},'body':_0x1aa126[_0x9a1c('0x6e')]||{}};_0x510917(null,_0x22e0c2);})['catch'](function(_0x1aa099){var _0xa1e5c9={'statusCode':_0x1aa099['statusCode']||0x1f4,'statusMessage':_0x1aa099[_0x9a1c('0x78')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x1aa099['options'][_0x9a1c('0x71')]||{},'body':_0x1aa099['options'][_0x9a1c('0x6e')]||{}};_0x510917(null,_0xa1e5c9);});};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x79')]=function(_0x141e63,_0x5b0d3b){scripts[_0x9a1c('0x79')](this[_0x9a1c('0x10')]['uniqueid'],_0x141e63['key'],_0x141e63[_0x9a1c('0x60')],_0x141e63[_0x9a1c('0x7a')]||'en')[_0x9a1c('0x18')](function(_0x3c793f){_0x5b0d3b(null,_0x3c793f);})[_0x9a1c('0x19')](function(_0x35b0bb){_0x5b0d3b(_0x35b0bb);});};AGIVertices['prototype'][_0x9a1c('0x7b')]=function(_0x15c4a0,_0x8b4645){scripts[_0x9a1c('0x7b')](this['channel'][_0x9a1c('0x3c')],_0x15c4a0['dialogflowV2_project_id'],_0x15c4a0['client_email'],_0x15c4a0[_0x9a1c('0x7c')],_0x15c4a0['text'],_0x15c4a0[_0x9a1c('0x7d')]||'en')[_0x9a1c('0x18')](function(_0x830861){_0x8b4645(null,_0x830861);})[_0x9a1c('0x19')](function(_0x37387b){_0x8b4645(_0x37387b);});};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x7e')]=function(_0x86f43e,_0x290abc){scripts[_0x9a1c('0x7e')](this[_0x9a1c('0x10')],_0x86f43e)[_0x9a1c('0x18')](function(_0x51c3c4){_0x290abc(null,_0x51c3c4);})['catch'](function(_0x28681c){_0x290abc(_0x28681c);});};AGIVertices['prototype'][_0x9a1c('0x7f')]=function(_0x1a94b6,_0x31926f){scripts['ispeechTTS'](_0x1a94b6['key'],_0x1a94b6['text'],_0x1a94b6[_0x9a1c('0x80')]||_0x9a1c('0x81'),_0x1a94b6[_0x9a1c('0x82')])[_0x9a1c('0x18')](function(_0x1c7d5c){_0x31926f(null,_0x1c7d5c);})[_0x9a1c('0x19')](function(_0x43c312){_0x31926f(_0x43c312);});};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x83')]=function(_0x473be6,_0x334671,_0x2ee6b0){scripts[_0x9a1c('0x83')](_0x334671,_0x473be6[_0x9a1c('0x84')],_0x473be6[_0x9a1c('0x85')]||_0x9a1c('0x81'),this['isConfigured'](_0x473be6[_0x9a1c('0x86')])?_0x473be6[_0x9a1c('0x86')]:undefined)['then'](function(_0x147ed1){_0x2ee6b0(null,_0x147ed1);})[_0x9a1c('0x19')](function(_0x34f515){_0x2ee6b0(_0x34f515);});};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x87')]=function(_0x988e15,_0x5e4aa6){scripts[_0x9a1c('0x87')](_0x988e15[_0x9a1c('0x88')],_0x988e15[_0x9a1c('0x89')],_0x988e15[_0x9a1c('0x8a')],_0x988e15['aws_polly_voice']||_0x9a1c('0x8b'),_0x988e15[_0x9a1c('0x60')],_0x988e15[_0x9a1c('0x8c')]||'text')[_0x9a1c('0x18')](function(_0x3093c5){_0x5e4aa6(null,_0x3093c5);})[_0x9a1c('0x19')](function(_0x1f1ee6){_0x5e4aa6(_0x1f1ee6);});};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x8d')]=function(_0x20947e,_0x5a805f){scripts[_0x9a1c('0x8d')](this[_0x9a1c('0x10')]['uniqueid'],_0x20947e[_0x9a1c('0x88')],_0x20947e['aws_secret_access_key'],_0x20947e[_0x9a1c('0x8e')],_0x20947e[_0x9a1c('0x60')],_0x20947e[_0x9a1c('0x8f')])['then'](function(_0x5ec1cd){_0x5a805f(null,_0x5ec1cd);})[_0x9a1c('0x19')](function(_0x41bf68){_0x5a805f(_0x41bf68);});};AGIVertices['prototype']['googleASR']=function(_0x5ec7cb,_0x3ec6ff,_0x15c42b){scripts['googleASR'](_0x3ec6ff,_0x5ec7cb[_0x9a1c('0x84')],_0x5ec7cb[_0x9a1c('0x90')]||'en-US')[_0x9a1c('0x18')](function(_0x1b52dd){_0x15c42b(null,_0x1b52dd);})[_0x9a1c('0x19')](function(_0x190320){_0x15c42b(_0x190320);});};AGIVertices['prototype'][_0x9a1c('0x91')]=function(_0x1c5593,_0x3929f3,_0x3033cc){scripts[_0x9a1c('0x91')](_0x3929f3,_0x1c5593[_0x9a1c('0x92')],_0x1c5593[_0x9a1c('0x93')],_0x1c5593[_0x9a1c('0x74')])[_0x9a1c('0x18')](function(_0x17c098){_0x3033cc(null,_0x17c098);})['catch'](function(_0x3bbba1){_0x3033cc(_0x3bbba1);});};AGIVertices['prototype'][_0x9a1c('0x94')]=function(_0xb07150){var _0x19d0f3=_[_0x9a1c('0x6b')](verticesWithRetry,_0xb07150[_0x9a1c('0x95')])?_0xb07150:_['clone'](_0xb07150);for(var _0x4192ef in _0x19d0f3){if(_0x19d0f3[_0x9a1c('0x96')](_0x4192ef)){if(_0x19d0f3[_0x4192ef]&&_[_0x9a1c('0x97')](_0x19d0f3[_0x4192ef])){if(_[_0x9a1c('0x6b')](recursiveMapAttributes,_0x4192ef)){_0x19d0f3[_0x4192ef]=this[_0x9a1c('0x98')](_0x19d0f3[_0x4192ef]);}else{_0x19d0f3[_0x4192ef]=this[_0x9a1c('0x99')](_0x19d0f3[_0x4192ef]);}}}}return _0x19d0f3;};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x9a')]=function(_0x1bd2cf){for(var _0x490131 in _0x1bd2cf){if(_0x1bd2cf['hasOwnProperty'](_0x490131)){if(_[_0x9a1c('0x9b')](_0x1bd2cf[_0x490131])){this[_0x9a1c('0x9a')](_0x1bd2cf[_0x490131]);}else if(_[_0x9a1c('0x9c')](_0x1bd2cf[_0x490131])){for(var _0x2edb10=0x0;_0x2edb10<_0x1bd2cf[_0x490131][_0x9a1c('0x9d')];_0x2edb10++){this[_0x9a1c('0x9a')](_0x1bd2cf[_0x490131][_0x2edb10]);}}else if(_['isString'](_0x1bd2cf[_0x490131])){_0x1bd2cf[_0x490131]=this['replaceAllVariables'](_0x1bd2cf[_0x490131]);}}}};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x9e')]=function(_0x42ceac,_0x32ea05){for(var _0x56d212 in _0x42ceac){if(_0x42ceac[_0x9a1c('0x96')](_0x56d212)){if(_[_0x9a1c('0x9b')](_0x42ceac[_0x56d212])){if(!_[_0x9a1c('0x48')](_0x42ceac[_0x56d212])){this[_0x9a1c('0x9e')](_0x42ceac[_0x56d212],util[_0x9a1c('0x59')]('%s.%s',_0x32ea05,_0x56d212));}}else if(_[_0x9a1c('0x9c')](_0x42ceac[_0x56d212])){for(var _0x8ffe58=0x0;_0x8ffe58<_0x42ceac[_0x56d212][_0x9a1c('0x9d')];_0x8ffe58++){this['saveRestApiResult'](_0x42ceac[_0x56d212][_0x8ffe58],util[_0x9a1c('0x59')](_0x9a1c('0x9f'),_0x32ea05,_0x56d212+'['+_0x8ffe58+']'));}}else{if(!_['isNil'](_0x42ceac[_0x56d212])){this[_0x9a1c('0x10')][_0x9a1c('0xa0')](util['format'](_0x9a1c('0x9f'),_0x32ea05,_0x56d212),_0x42ceac[_0x56d212]);}}}}};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x98')]=function(_0x2224e0){try{var _0x8eaac=JSON[_0x9a1c('0x70')](_0x2224e0);this['recursiveNodeIndex'](_0x8eaac);return JSON[_0x9a1c('0x76')](_0x8eaac);}catch(_0xc269f0){return this['replaceAllVariables'](_0x2224e0);}};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x99')]=function(_0xe27774){var _0x3de1cb=_0xe27774['split']('{');for(var _0x4604ef=0x1;_0x4604ef<_0x3de1cb['length'];_0x4604ef+=0x1){var _0x35c179=_0x3de1cb[_0x4604ef][_0x9a1c('0xa1')]('}');if(_0x35c179[_0x9a1c('0x9d')]>0x1){_0xe27774=_0xe27774[_0x9a1c('0xa2')]('{'+_0x35c179[0x0]+'}',this[_0x9a1c('0x10')]['getVariable'](_0x35c179[0x0])[_0x9a1c('0xa3')]||_0x35c179[0x0]);}}if(_0x3de1cb[_0x9a1c('0x9d')]===0x1){return _0xe27774[_0x9a1c('0x50')]();}return this[_0x9a1c('0x99')](_0xe27774);};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0xa4')]=function(_0x13a192,_0x499b10){var _0x3b1c6a=this[_0x9a1c('0x10')][_0x9a1c('0x13')](_0x13a192);if(_0x3b1c6a[_0x9a1c('0xa5')]===-0x1){return _0x3b1c6a;}logger[_0x9a1c('0x35')](util['format'](_0x9a1c('0xa6'),_0x499b10,_0x3b1c6a[_0x9a1c('0xa3')]));return this[_0x9a1c('0x10')][_0x9a1c('0xa0')](_0x499b10,_0x3b1c6a['extra']);};AGIVertices[_0x9a1c('0x12')]['isConfigured']=function(_0x316a4e){return _0x316a4e&&_0x316a4e!=='0'&&_0x316a4e!=='-1'&&_0x316a4e!=='';};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0xa7')]=function(_0x455763){this[_0x9a1c('0x3b')][_0x9a1c('0x73')](this,_0x455763,'-');_0x455763[_0x9a1c('0xa8')]=_0x455763[_0x9a1c('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x9a1c('0x12')]['mrcpsynth']=function(_0x409985){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0xa9'),_0x409985[_0x9a1c('0xaa')]));if(!this[_0x9a1c('0xab')](_0x409985['text'])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0xad'));}var _0x468ca9='\x22'+_0x409985[_0x9a1c('0x60')]+'\x22';if(this['isConfigured'](_0x409985[_0x9a1c('0xae')])){_0x468ca9+=','+_0x409985[_0x9a1c('0xae')];}var _0x2a003a=this[_0x9a1c('0x10')]['exec']('MRCPSynth',_0x468ca9);if(_0x2a003a[_0x9a1c('0xa5')]===-0x1){return _0x2a003a;}return this['channel'][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0xaf'),_0x468ca9));};AGIVertices['prototype'][_0x9a1c('0xb0')]=function(_0x515d66){logger['info'](util[_0x9a1c('0x59')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x515d66[_0x9a1c('0xaa')]));if(!this[_0x9a1c('0xab')](_0x515d66[_0x9a1c('0xb1')])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0xb2'));}var _0x588e07=_0x515d66[_0x9a1c('0xb1')];if(this['isConfigured'](_0x515d66['options'])){_0x588e07+=','+_0x515d66[_0x9a1c('0xae')];}var _0xec3ca=this[_0x9a1c('0x10')]['exec'](_0x9a1c('0xb3'),_0x588e07);if(_0xec3ca[_0x9a1c('0xa5')]===-0x1){return _0xec3ca;}var _0x1f7cb6=this[_0x9a1c('0xa4')](_0x9a1c('0xb4'),_0x9a1c('0xb5'));if(_0x1f7cb6['result']===-0x1){return _0x1f7cb6;}var _0x150456=this[_0x9a1c('0xa4')]('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x150456[_0x9a1c('0xa5')]===-0x1){return _0x150456;}var _0x3f7f48=this['getAndSetVariable'](_0x9a1c('0xb6'),'MRCP_RECOG_INSTANCE');if(_0x3f7f48[_0x9a1c('0xa5')]===-0x1){return _0x3f7f48;}return this[_0x9a1c('0x10')]['noop'](util[_0x9a1c('0x59')]('Executed\x20command\x20MRCPRecog\x20%s',_0x588e07));};AGIVertices['prototype'][_0x9a1c('0x9')]=function(_0x40170e){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0xb7'),_0x40170e[_0x9a1c('0xaa')]));return this[_0x9a1c('0x10')][_0x9a1c('0x9')]([_0x40170e[_0x9a1c('0xb8')],_0x40170e[_0x9a1c('0xb9')]]);};AGIVertices['prototype'][_0x9a1c('0xba')]=function(_0x177f16){logger['info'](util[_0x9a1c('0x59')](_0x9a1c('0xbb'),_0x177f16[_0x9a1c('0xaa')]));if(this[_0x9a1c('0xab')](_0x177f16[_0x9a1c('0x6a')])){logger['info'](util['format'](_0x9a1c('0xbc'),_0x177f16[_0x9a1c('0x6a')]));var _0x45aae9=this[_0x9a1c('0x10')][_0x9a1c('0xbd')](_0x177f16[_0x9a1c('0x6a')]);if(_0x45aae9[_0x9a1c('0xa5')]===-0x1){return _0x45aae9;}}return this[_0x9a1c('0x10')][_0x9a1c('0xba')]();};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x4e')]=function(_0x3483ca){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0xbe'),_0x3483ca[_0x9a1c('0xaa')]));if(!this[_0x9a1c('0xab')](_0x3483ca[_0x9a1c('0x4c')])){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x3483ca,_0x9a1c('0xbf'));}_0x3483ca[_0x9a1c('0x4d')]=moment();if(this[_0x9a1c('0xab')](_0x3483ca[_0x9a1c('0xc0')])){_0x3483ca[_0x9a1c('0x4d')]=moment()['add'](_0x3483ca[_0x9a1c('0xc0')],_0x9a1c('0xc1'));}if(!this['isConfigured'](_0x3483ca['callback_priority'])){_0x3483ca[_0x9a1c('0x51')]=0x2;}this[_0x9a1c('0x47')][_0x9a1c('0x73')](this,_0x3483ca);return this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0xc2'),_0x3483ca[_0x9a1c('0x4b')],_0x3483ca[_0x9a1c('0x4c')],_0x3483ca[_0x9a1c('0x4d')]));};AGIVertices['prototype']['custom_app']=function(_0x4f40b9){logger['info'](util[_0x9a1c('0x59')](_0x9a1c('0xc3'),_0x4f40b9[_0x9a1c('0xaa')]));var _0x488aac=this['channel']['exec'](_0x4f40b9['application'],_0x4f40b9[_0x9a1c('0xae')]);if(_0x488aac['result']===-0x1){return _0x488aac;}return this[_0x9a1c('0x10')]['noop'](util[_0x9a1c('0x59')](_0x9a1c('0xc4'),_0x4f40b9[_0x9a1c('0xc5')],_0x4f40b9[_0x9a1c('0xae')]));};AGIVertices['prototype'][_0x9a1c('0xc6')]=function(_0x13b42f){logger[_0x9a1c('0x35')](util['format'](_0x9a1c('0xc7'),_0x13b42f['label']));if(!this['isConfigured'](_0x13b42f[_0x9a1c('0x60')])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0xad'));}var _0x2fe42b='\x22'+_0x13b42f[_0x9a1c('0x60')]+'\x22';if(this[_0x9a1c('0xab')](_0x13b42f[_0x9a1c('0xae')])){_0x2fe42b+=','+_0x13b42f[_0x9a1c('0xae')];}var _0x54ed0c=this['channel'][_0x9a1c('0x5c')](_0x9a1c('0xc8'),_0x2fe42b);if(_0x54ed0c['result']===-0x1){return _0x54ed0c;}return this['channel']['noop'](util[_0x9a1c('0x59')](_0x9a1c('0xaf'),_0x2fe42b));};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0xc9')]=function(_0x2f2f96){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0xca'),_0x2f2f96[_0x9a1c('0xaa')]));if(!this[_0x9a1c('0xab')](_0x2f2f96[_0x9a1c('0x60')])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')]('no\x20text\x20configured');}var _0x559211='\x22'+_0x2f2f96[_0x9a1c('0x60')]+'\x22';if(this[_0x9a1c('0xab')](_0x2f2f96[_0x9a1c('0xae')])){_0x559211+=','+_0x2f2f96[_0x9a1c('0xae')];}var _0x50b40b=this['channel'][_0x9a1c('0x5c')](_0x9a1c('0xc8'),_0x559211);if(_0x50b40b[_0x9a1c('0xa5')]===-0x1){return _0x50b40b;}return this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0xaf'),_0x559211));};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0xcb')]=function(_0x1a6229){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0xcc'),_0x1a6229[_0x9a1c('0xaa')]));if(!this[_0x9a1c('0xab')](_0x1a6229[_0x9a1c('0xb1')])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0xb2'));}var _0x33df3e=_0x1a6229['grammar'];if(this[_0x9a1c('0xab')](_0x1a6229[_0x9a1c('0xae')])){_0x33df3e+=','+_0x1a6229[_0x9a1c('0xae')];}var _0x81a834=this['channel'][_0x9a1c('0x5c')](_0x9a1c('0xb3'),_0x33df3e);if(_0x81a834[_0x9a1c('0xa5')]===-0x1){return _0x81a834;}var _0x28d0dd=this[_0x9a1c('0xa4')](_0x9a1c('0xb4'),_0x9a1c('0xcd'));if(_0x28d0dd[_0x9a1c('0xa5')]===-0x1){return _0x28d0dd;}var _0x370be7=this[_0x9a1c('0xa4')](_0x9a1c('0xce'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x370be7[_0x9a1c('0xa5')]===-0x1){return _0x370be7;}var _0x30b1bb=this[_0x9a1c('0xa4')](_0x9a1c('0xb6'),'LUMENVOX_ASR_INSTANCE');if(_0x30b1bb['result']===-0x1){return _0x30b1bb;}return this['channel']['noop'](util['format'](_0x9a1c('0xcf'),_0x33df3e));};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0xd0')]=function(_0x3a1e4b){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x3a1e4b[_0x9a1c('0xaa')]));if(!this['isConfigured'](_0x3a1e4b[_0x9a1c('0xb1')])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0xb2'));}var _0x30b610=_0x3a1e4b[_0x9a1c('0xb1')];if(this[_0x9a1c('0xab')](_0x3a1e4b[_0x9a1c('0xae')])){_0x30b610+=','+_0x3a1e4b['options'];}var _0x15d2e4=this['channel']['exec']('MRCPRecog',_0x30b610);if(_0x15d2e4[_0x9a1c('0xa5')]===-0x1){return _0x15d2e4;}var _0x496540=this['getAndSetVariable'](_0x9a1c('0xb4'),_0x9a1c('0xd1'));if(_0x496540[_0x9a1c('0xa5')]===-0x1){return _0x496540;}var _0x51f0fd=this[_0x9a1c('0xa4')]('RECOG_INPUT()',_0x9a1c('0xd2'));if(_0x51f0fd[_0x9a1c('0xa5')]===-0x1){return _0x51f0fd;}var _0x1fd875=this['getAndSetVariable'](_0x9a1c('0xb6'),_0x9a1c('0xd3'));if(_0x1fd875[_0x9a1c('0xa5')]===-0x1){return _0x1fd875;}return this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0xcf'),_0x30b610));};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0xd4')]=function(_0x2340ea){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x2340ea[_0x9a1c('0xaa')]));if(!this['isConfigured'](_0x2340ea['odbc_id'])){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x2340ea,_0x9a1c('0xd5'));}var _0x4d167f=this['getSquareOdbc'][_0x9a1c('0x73')](this,_0x2340ea[_0x9a1c('0xd6')]);if(!_0x4d167f){return this['channel'][_0x9a1c('0x32')](_0x2340ea,_0x9a1c('0xd7'));}if(!this[_0x9a1c('0xab')](_0x2340ea[_0x9a1c('0xd8')])){return this['channel'][_0x9a1c('0x32')](_0x2340ea,_0x9a1c('0xd9'));}var _0x4f6e4c=_0x2340ea[_0x9a1c('0xd8')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x9a1c('0x10')]['noop'](util[_0x9a1c('0x59')]('query:\x20%s',_0x4f6e4c));var _0x4b93ea=this['getQueryOdbc']['sync'](this,_0x4d167f,_0x4f6e4c);this[_0x9a1c('0x3b')][_0x9a1c('0x73')](this,_0x2340ea,_0x4f6e4c);if(!this['isConfigured'](_0x2340ea[_0x9a1c('0xda')])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0xdb'));}var _0x496b71=this[_0x9a1c('0x13')][_0x9a1c('0x73')](this,_0x2340ea[_0x9a1c('0xda')]);if(!_0x496b71){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x2340ea,_0x9a1c('0xdc'));}var _0x1fb0aa=this;_0x4b93ea[_0x9a1c('0xdd')](function(_0x3cee21,_0x2d4fa3){Object[_0x9a1c('0xde')](_0x3cee21)[_0x9a1c('0xdd')](function(_0xe03143){_0x1fb0aa[_0x9a1c('0x10')][_0x9a1c('0xa0')](util[_0x9a1c('0x59')](_0x9a1c('0xdf'),_0x496b71,_0x2d4fa3,_0xe03143),_0x3cee21[_0xe03143]);});});this[_0x9a1c('0x10')][_0x9a1c('0xa0')](util[_0x9a1c('0x59')](_0x9a1c('0xe0'),_0x496b71),_0x4b93ea['length']);return this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')]('variable\x20%s\x20set',_0x496b71));};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0xe1')]=function(_0x34914a){logger[_0x9a1c('0xe2')](util['format'](_0x9a1c('0xe3'),_0x34914a['label']));if(!this[_0x9a1c('0xab')](_0x34914a['sip_id'])){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x34914a,'no\x20user\x20selected');}var _0x2b28f5=this['getUser'][_0x9a1c('0x73')](this,_0x34914a[_0x9a1c('0xe4')]);if(!_0x2b28f5){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x34914a,'no\x20user\x20found');}var _0x19baa1=this[_0x9a1c('0x10')][_0x9a1c('0x5c')](_0x9a1c('0xe5'),[util['format'](_0x9a1c('0xe6'),_0x2b28f5),_0x34914a['timeout'],_0x34914a[_0x9a1c('0xe7')],_0x34914a[_0x9a1c('0x68')]]);if(_0x19baa1[_0x9a1c('0xa5')]===-0x1){return _0x19baa1;}return this['channel']['noop'](util[_0x9a1c('0x59')]('Executed\x20command\x20%s',_0x9a1c('0xe5')));};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0xe8')]=function(_0x42e19f){logger['info'](util[_0x9a1c('0x59')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x42e19f['label']));if(!this[_0x9a1c('0xab')](_0x42e19f[_0x9a1c('0x84')])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')]('no\x20key\x20configured');}if(!this[_0x9a1c('0xab')](_0x42e19f[_0x9a1c('0x60')])){return this['channel'][_0x9a1c('0xac')](_0x9a1c('0xad'));}this['channel'][_0x9a1c('0xe9')]=!![];this[_0x9a1c('0x3b')](_0x42e19f);this[_0x9a1c('0x46')](_0x42e19f[_0x9a1c('0x60')],'in','','');this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')]('Trying\x20Dialogflow:\x20%s',_0x42e19f[_0x9a1c('0x60')]));var _0x14ff3f=this[_0x9a1c('0x79')][_0x9a1c('0x73')](this,_0x42e19f);if(_0x14ff3f){for(var _0x78da62 in _0x14ff3f){if(_0x14ff3f[_0x9a1c('0x96')](_0x78da62)){this[_0x9a1c('0x10')][_0x9a1c('0xa0')](util[_0x9a1c('0x59')](_0x9a1c('0xea'),_0x78da62['toUpperCase']()),_0x14ff3f[_0x78da62]);}}this['createSquareMessage'](_0x14ff3f[_0x9a1c('0xeb')],_0x9a1c('0xec'),_0x9a1c('0xe8'),'');return this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0xed'),_0x14ff3f[_0x9a1c('0xeb')]));}return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x42e19f,_0x9a1c('0xee'));};AGIVertices['prototype'][_0x9a1c('0xef')]=function(_0x1dc530){logger['info'](util[_0x9a1c('0x59')](_0x9a1c('0xf0'),_0x1dc530[_0x9a1c('0xaa')]));if(!this[_0x9a1c('0xab')](_0x1dc530[_0x9a1c('0xf1')])){return this['channel'][_0x9a1c('0xac')](_0x9a1c('0xf2'));}if(!this[_0x9a1c('0xab')](_0x1dc530['client_email'])){return this['channel'][_0x9a1c('0xac')](_0x9a1c('0xf3'));}if(!this[_0x9a1c('0xab')](_0x1dc530['private_key'])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0xf4'));}if(!this[_0x9a1c('0xab')](_0x1dc530[_0x9a1c('0x7d')])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0xf5'));}if(!this[_0x9a1c('0xab')](_0x1dc530[_0x9a1c('0x60')])){return this['channel'][_0x9a1c('0xac')](_0x9a1c('0xad'));}this[_0x9a1c('0x10')][_0x9a1c('0xe9')]=!![];this[_0x9a1c('0x3b')](_0x1dc530);this['createSquareMessage'](_0x1dc530[_0x9a1c('0x60')],'in','','');this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0xf6'),_0x1dc530[_0x9a1c('0x60')]));var _0x5074a2=this[_0x9a1c('0x7b')][_0x9a1c('0x73')](this,_0x1dc530);if(_0x5074a2){for(var _0x109454 in _0x5074a2){if(_0x5074a2[_0x9a1c('0x96')](_0x109454)){if(_0x109454!=='providerResponse'){this['channel'][_0x9a1c('0xa0')](util[_0x9a1c('0x59')]('DIALOGFLOW_%s',_0x109454[_0x9a1c('0x6d')]()),_0x5074a2[_0x109454]);}}}this[_0x9a1c('0x46')](_0x5074a2[_0x9a1c('0xeb')],_0x9a1c('0xec'),_0x9a1c('0xef'),_0x5074a2[_0x9a1c('0xf7')]);return this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0xf8'),_0x5074a2[_0x9a1c('0xeb')]));}return this[_0x9a1c('0x10')]['error'](_0x1dc530,_0x9a1c('0xf9'));};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0xfa')]=function(_0x2c6b6c){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0xfb'),_0x2c6b6c['label']));if(!this['isConfigured'](_0x2c6b6c[_0x9a1c('0xfc')])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0xfd'));}if(!this['isConfigured'](_0x2c6b6c['username'])){return this['channel'][_0x9a1c('0xac')]('no\x20username\x20configured');}if(!this[_0x9a1c('0xab')](_0x2c6b6c[_0x9a1c('0xfe')])){return this[_0x9a1c('0x10')]['noop'](_0x9a1c('0xff'));}if(!this[_0x9a1c('0xab')](_0x2c6b6c['ndassistant_url'])){return this['channel'][_0x9a1c('0xac')](_0x9a1c('0xad'));}this[_0x9a1c('0x10')][_0x9a1c('0xe9')]=!![];this['createSquareDetailsReport'](_0x2c6b6c);this[_0x9a1c('0x46')](_0x2c6b6c[_0x9a1c('0x60')],'in','','');this['channel']['noop'](util[_0x9a1c('0x59')]('Trying\x20SestekNDA:\x20%s',_0x2c6b6c['text']));var _0xd1fc39=this[_0x9a1c('0x7e')][_0x9a1c('0x73')](this,_0x2c6b6c);if(_0xd1fc39){for(var _0x4611c1 in _0xd1fc39){if(_0xd1fc39['hasOwnProperty'](_0x4611c1)){this[_0x9a1c('0x10')]['setVariable'](util['format'](_0x9a1c('0x100'),_0x4611c1[_0x9a1c('0x6d')]()),_0xd1fc39[_0x4611c1]);}}this['createSquareMessage'](_0xd1fc39['speech'],'out',_0x9a1c('0xfa'),'');if(_0xd1fc39[_0x9a1c('0x101')]){this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0x102'),_0xd1fc39['audiofile']));var _0x5ab32f=this[_0x9a1c('0x10')][_0x9a1c('0x103')](_0xd1fc39['audiofile']);try{fs[_0x9a1c('0x104')](_0xd1fc39[_0x9a1c('0x101')]+_0x9a1c('0x105'));}catch(_0x4f4bb7){logger['error'](_0x4f4bb7);}return _0x5ab32f;}else{return this[_0x9a1c('0x10')]['noop'](util[_0x9a1c('0x59')](_0x9a1c('0x106'),_0xd1fc39['speech']));}}return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x2c6b6c,_0x9a1c('0x107'));};AGIVertices[_0x9a1c('0x12')]['end']=function(_0x3c1af1){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x108'),_0x3c1af1[_0x9a1c('0xaa')]));return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0x109'));};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x10a')]=function(_0x3fc065){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x10b'),_0x3fc065['label']));var _0x36c436='';if(_0x3fc065['trunk_id']){if(!this[_0x9a1c('0xab')](_0x3fc065[_0x9a1c('0x10c')])){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x3fc065,_0x9a1c('0x10d'));}else{var _0x127741=parseInt(_0x3fc065[_0x9a1c('0x10c')],0xa);if(isNaN(_0x127741)){_0x36c436=_0x3fc065[_0x9a1c('0x10c')];}else{_0x36c436=this[_0x9a1c('0x21')][_0x9a1c('0x73')](this,_0x3fc065[_0x9a1c('0x10c')]);if(!_0x36c436){return this[_0x9a1c('0x10')]['error'](_0x3fc065,'no\x20trunk\x20found');}}}}else if(_0x3fc065[_0x9a1c('0x10e')]){_0x36c436=_0x3fc065[_0x9a1c('0x10e')];}else{return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x3fc065,_0x9a1c('0x10d'));}var _0x60b68c=this[_0x9a1c('0x10')][_0x9a1c('0x5c')](_0x9a1c('0xe5'),[util['format']('SIP/%s/%s',_0x36c436,_0x3fc065[_0x9a1c('0x4b')]),_0x3fc065['timeout'],_0x3fc065['opts'],_0x3fc065['url']]);if(_0x60b68c[_0x9a1c('0xa5')]===-0x1){return _0x60b68c;}return this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0x10f'),_0x9a1c('0xe5')));};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x110')]=function(_0x48bfc4){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x48bfc4[_0x9a1c('0xaa')]));return this[_0x9a1c('0x10')][_0x9a1c('0xac')]('finally');};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0xf')]=function(_0x40465b){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x40465b[_0x9a1c('0xaa')]));if(_0x40465b[_0x9a1c('0xa8')]===0x0){return this['maxRetry'](_0x40465b);}_0x40465b[_0x9a1c('0xa8')]-=0x1;if(!this[_0x9a1c('0xab')](_0x40465b[_0x9a1c('0x111')])){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x40465b,_0x9a1c('0x112'));}var _0x2fc08d=this['getSound'][_0x9a1c('0x73')](this,_0x40465b[_0x9a1c('0x111')]);if(!_0x2fc08d){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x40465b,_0x9a1c('0x113'));}if(!this['isConfigured'](_0x40465b[_0x9a1c('0xda')])){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x9a1c('0xdb'));}var _0x19f8d1=this['channel'][_0x9a1c('0x114')](_0x2fc08d,_0x40465b[_0x9a1c('0x115')],_0x40465b['maxdigit']);var _0x38f055=_0x19f8d1[_0x9a1c('0xa5')]?_0x19f8d1[_0x9a1c('0xa5')][_0x9a1c('0x50')]():'';logger[_0x9a1c('0x35')](_0x9a1c('0x116'),JSON['stringify'](_0x19f8d1));if(_0x19f8d1[_0x9a1c('0xa5')]===-0x1){this[_0x9a1c('0x3b')]['sync'](this,_0x40465b,_0x38f055);return _0x19f8d1;}else if(_0x19f8d1[_0x9a1c('0xa3')]===_0x9a1c('0x6a')){_0x19f8d1['result']=_0x38f055[_0x9a1c('0x9d')]>=parseInt(_0x40465b[_0x9a1c('0x117')])?'x':'i';}else{_0x19f8d1[_0x9a1c('0xa5')]=_0x38f055[_0x9a1c('0x9d')]>=parseInt(_0x40465b[_0x9a1c('0x117')])&&_0x38f055[_0x9a1c('0x9d')]<=parseInt(_0x40465b[_0x9a1c('0x118')])?'x':'i';}var _0x3621d2=this['getVariable'][_0x9a1c('0x73')](this,_0x40465b['variable_id']);if(!_0x3621d2){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x40465b,_0x9a1c('0xdc'));}this[_0x9a1c('0x10')][_0x9a1c('0xa0')](_0x3621d2,_0x38f055);if(this[_0x9a1c('0xab')](_0x40465b[_0x9a1c('0x119')])){var _0x2bddb8=parseInt(_0x40465b[_0x9a1c('0x119')],0xa);var _0x3b9e64=rs[_0x9a1c('0x11a')]({'charset':'*','length':_0x2bddb8});var _0x1188a1=_0x38f055[_0x9a1c('0x9d')];if(_0x1188a1>0x0){if(_0x1188a1>_0x2bddb8){this['createSquareDetailsReport'][_0x9a1c('0x73')](this,_0x40465b,_0x40465b['hiddendigitspos']==='first'?_0x3b9e64+_0x38f055['substr'](_0x2bddb8):_0x38f055['substr'](0x0,_0x1188a1-_0x2bddb8)+_0x3b9e64);}else{this[_0x9a1c('0x3b')][_0x9a1c('0x73')](this,_0x40465b,rs[_0x9a1c('0x11a')]({'charset':'*','length':_0x1188a1}));}}else{this[_0x9a1c('0x3b')]['sync'](this,_0x40465b,'');}}else{this[_0x9a1c('0x3b')]['sync'](this,_0x40465b,_0x38f055);}return _0x19f8d1;};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x11b')]=function(_0x4aece5){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x11c'),_0x4aece5[_0x9a1c('0xaa')]));return this[_0x9a1c('0xf')](_0x4aece5);};AGIVertices['prototype'][_0x9a1c('0x11d')]=function(_0x25865c){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x11e'),_0x25865c[_0x9a1c('0xaa')]));this[_0x9a1c('0x3b')][_0x9a1c('0x73')](this,_0x25865c,_0x25865c[_0x9a1c('0x11f')]);return this['channel'][_0x9a1c('0xac')](util['format'](_0x9a1c('0x120'),_0x25865c[_0x9a1c('0x11f')]));};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x121')]=function(_0x553247){logger[_0x9a1c('0x35')](util['format'](_0x9a1c('0x122'),_0x553247[_0x9a1c('0xaa')]));if(!this[_0x9a1c('0xab')](_0x553247['aws_access_key_id'])||!this[_0x9a1c('0xab')](_0x553247[_0x9a1c('0x89')])){return this['channel']['noop'](_0x9a1c('0x123'));}if(!this['isConfigured'](_0x553247['text'])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0xad'));}this['channel'][_0x9a1c('0xac')](util['format'](_0x9a1c('0x124'),_0x553247[_0x9a1c('0x60')]));var _0x60be9d=this[_0x9a1c('0x87')][_0x9a1c('0x73')](this,_0x553247);if(_0x60be9d){this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')]('aws\x20Polly\x20%s\x20file\x20created',_0x60be9d));var _0x15b6c8=this['channel'][_0x9a1c('0x103')](_0x60be9d);try{fs[_0x9a1c('0x104')](_0x60be9d+_0x9a1c('0x105'));}catch(_0xe06bf1){logger[_0x9a1c('0x32')](_0xe06bf1);}return _0x15b6c8;}return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x553247,_0x9a1c('0x125'));};AGIVertices[_0x9a1c('0x12')]['awslex']=function(_0x585d4f){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x126'),_0x585d4f[_0x9a1c('0xaa')]));if(!this['isConfigured'](_0x585d4f[_0x9a1c('0x88')])||!this[_0x9a1c('0xab')](_0x585d4f['aws_secret_access_key'])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0x123'));}if(!this[_0x9a1c('0xab')](_0x585d4f[_0x9a1c('0x8f')])){return this['channel']['noop'](_0x9a1c('0x127'));}if(!this[_0x9a1c('0xab')](_0x585d4f[_0x9a1c('0x60')])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0xad'));}this[_0x9a1c('0x10')]['bot']=!![];this[_0x9a1c('0x3b')](_0x585d4f);this['createSquareMessage'](_0x585d4f[_0x9a1c('0x60')],'in','','');this[_0x9a1c('0x10')]['noop'](util[_0x9a1c('0x59')](_0x9a1c('0x128'),_0x585d4f[_0x9a1c('0x60')]));var _0x2b1195=this[_0x9a1c('0x8d')][_0x9a1c('0x73')](this,_0x585d4f);if(_0x2b1195){for(var _0x1fb575 in _0x2b1195){if(_0x2b1195['hasOwnProperty'](_0x1fb575)&&_[_0x9a1c('0x97')](_0x2b1195[_0x1fb575])){this[_0x9a1c('0x10')]['setVariable'](util['format'](_0x9a1c('0x129'),_0x1fb575[_0x9a1c('0x6d')]()),_0x2b1195[_0x1fb575]);}}if(_[_0x9a1c('0x55')](_0x2b1195['message'])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0x12a'));}else{this[_0x9a1c('0x46')](_0x2b1195['message'],_0x9a1c('0xec'),_0x9a1c('0x12b'),'');return this['channel']['noop'](util[_0x9a1c('0x59')](_0x9a1c('0x12c'),_0x2b1195['message']));}}return this['channel'][_0x9a1c('0x32')](_0x585d4f,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x12d')]=function(_0x4842b0){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x4842b0[_0x9a1c('0xaa')],_0x4842b0[_0x9a1c('0x6a')]));if(!this[_0x9a1c('0xab')](_0x4842b0['key'])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0x12e'));}var _0x277147='wav';var _0x436988=util[_0x9a1c('0x59')](_0x9a1c('0x12f'),FILES_PATH,rs[_0x9a1c('0x11a')](0x4));var _0x376fe8=util[_0x9a1c('0x59')]('%s.%s',_0x436988,_0x277147);var _0x275f78=!![];if(_0x4842b0[_0x9a1c('0x130')]==='NOBEEP'){_0x275f78=![];}var _0x580546=this['channel']['recordFile'](_0x436988,_0x277147,_0x4842b0[_0x9a1c('0x131')],_0x4842b0[_0x9a1c('0x6a')],undefined,_0x275f78);if(_0x580546[_0x9a1c('0xa5')]!==-0x1){this['channel']['noop'](util['format']('google\x20%s\x20file\x20created',_0x376fe8));var _0x26eb05=this[_0x9a1c('0x132')][_0x9a1c('0x73')](this,_0x4842b0,_0x376fe8);if(_0x26eb05){for(var _0x291ade in _0x26eb05){if(_0x26eb05[_0x9a1c('0x96')](_0x291ade)){this[_0x9a1c('0x10')][_0x9a1c('0xa0')](util['format'](_0x9a1c('0x133'),_0x291ade[_0x9a1c('0x6d')]()),_0x26eb05[_0x291ade]);}}return this[_0x9a1c('0x10')][_0x9a1c('0xac')](util['format'](_0x9a1c('0x134'),JSON[_0x9a1c('0x76')](_0x26eb05)));}}return _0x580546;};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x135')]=function(_0x53fb06){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x136'),_0x53fb06[_0x9a1c('0xaa')]));if(!this[_0x9a1c('0xab')](_0x53fb06[_0x9a1c('0x92')])){return this['channel'][_0x9a1c('0xac')](_0x9a1c('0x137'));}if(!this['isConfigured'](_0x53fb06[_0x9a1c('0x93')])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0x138'));}var _0x39de7b=_0x9a1c('0x139');var _0x4b348d=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x9a1c('0x11a')](0x4));var _0x3e1993=util[_0x9a1c('0x59')]('%s.%s',_0x4b348d,_0x39de7b);var _0x1e6ed8=!![];if(_0x53fb06[_0x9a1c('0x130')]===_0x9a1c('0x13a')){_0x1e6ed8=![];}var _0x1869d7=this[_0x9a1c('0x10')][_0x9a1c('0x13b')](_0x4b348d,_0x39de7b,_0x53fb06[_0x9a1c('0x131')],_0x53fb06['timeout'],undefined,_0x1e6ed8);if(_0x1869d7[_0x9a1c('0xa5')]!==-0x1){this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0x13c'),_0x3e1993));var _0x4fb760=this['tildeASR'][_0x9a1c('0x73')](this,_0x53fb06,_0x3e1993);if(_0x4fb760){for(var _0x851e67 in _0x4fb760){if(_0x4fb760['hasOwnProperty'](_0x851e67)){this[_0x9a1c('0x10')][_0x9a1c('0xa0')](util[_0x9a1c('0x59')]('TILDE_ASR_%s',_0x851e67[_0x9a1c('0x6d')]()),_0x4fb760[_0x851e67]);}}return this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0x13d'),JSON[_0x9a1c('0x76')](_0x4fb760)));}}return _0x1869d7;};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x13e')]=function(_0x3366b8){logger['info'](util['format'](_0x9a1c('0x13f'),_0x3366b8[_0x9a1c('0xaa')]));return this[_0x9a1c('0x10')][_0x9a1c('0x140')](_0x3366b8[_0x9a1c('0x141')],_0x3366b8['extension'],_0x3366b8[_0x9a1c('0x41')]);};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x142')]=function(_0x4387a3){logger[_0x9a1c('0x35')](util['format'](_0x9a1c('0x143'),_0x4387a3['label']));if(!this[_0x9a1c('0xab')](_0x4387a3['condition'])){return this['channel'][_0x9a1c('0x32')](_0x4387a3,'no\x20condition\x20configured');}try{var _0x2c88eb=eval(_0x4387a3[_0x9a1c('0x144')])?_0x9a1c('0x145'):'false';this[_0x9a1c('0x10')][_0x9a1c('0xac')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x4387a3['condition'],_0x2c88eb));return{'code':0xc8,'result':_0x2c88eb};}catch(_0x35aacc){return{'code':0xc8,'result':_0x9a1c('0x146')};}};AGIVertices[_0x9a1c('0x12')]['gotoiftime']=function(_0x1407a9){logger[_0x9a1c('0x35')](util['format'](_0x9a1c('0x147'),_0x1407a9[_0x9a1c('0xaa')]));if(!this[_0x9a1c('0xab')](_0x1407a9[_0x9a1c('0x148')])){return this['channel']['error'](_0x1407a9,'no\x20interval\x20configured');}var _0x2576bc=this[_0x9a1c('0x2a')][_0x9a1c('0x73')](this,_0x1407a9[_0x9a1c('0x148')]);if(!_0x2576bc){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x1407a9,_0x9a1c('0x149'));}for(var _0x5f3927=0x0;_0x5f3927<_0x2576bc['length'];_0x5f3927+=0x1){var _0x374280=this[_0x9a1c('0x10')][_0x9a1c('0x13')](util['format']('IFTIME(%s?true:false)',_0x2576bc[_0x5f3927]));if(_0x374280['result']===-0x1){return _0x374280;}logger[_0x9a1c('0x35')](util['format'](_0x9a1c('0x14a'),_0x2576bc[_0x5f3927],_0x374280[_0x9a1c('0xa3')]));if(_0x374280[_0x9a1c('0xa3')]==='true'){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x14a'),_0x2576bc[_0x5f3927],_0x9a1c('0x145')));this['channel']['noop'](util[_0x9a1c('0x59')](_0x9a1c('0x14a'),_0x2576bc[_0x5f3927],'true'));return{'code':0xc8,'result':_0x9a1c('0x145')};}else{logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')]('IFTIME\x20%s\x20%s',_0x2576bc[_0x5f3927],_0x9a1c('0x146')));this[_0x9a1c('0x10')][_0x9a1c('0xac')](util['format'](_0x9a1c('0x14a'),_0x2576bc[_0x5f3927],_0x9a1c('0x146')));}}return{'code':0xc8,'result':_0x9a1c('0x146')};};AGIVertices[_0x9a1c('0x12')]['hangup']=function(_0x52cde0){logger[_0x9a1c('0x35')](util['format'](_0x9a1c('0x14b'),_0x52cde0[_0x9a1c('0xaa')]));return this[_0x9a1c('0x10')][_0x9a1c('0x14c')]();};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x14d')]=function(_0x2ae78a){logger['info'](util[_0x9a1c('0x59')](_0x9a1c('0x14e'),_0x2ae78a['label']));if(!this[_0x9a1c('0xab')](_0x2ae78a['key'])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0x12e'));}var _0x53f222='wav';var _0x4480ec=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x9a1c('0x11a')](0x4));var _0x4936be=util['format'](_0x9a1c('0x9f'),_0x4480ec,_0x53f222);var _0x3bd49e=!![];if(_0x2ae78a[_0x9a1c('0x130')]===_0x9a1c('0x13a')){_0x3bd49e=![];}var _0x12dc78=this[_0x9a1c('0x10')]['recordFile'](_0x4480ec,_0x53f222,_0x2ae78a['intKey'],_0x2ae78a[_0x9a1c('0x6a')],undefined,_0x3bd49e);if(_0x12dc78[_0x9a1c('0xa5')]!==-0x1){this['channel'][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0x14f'),_0x4936be));var _0x2703ba=this[_0x9a1c('0x83')]['sync'](this,_0x2ae78a,_0x4936be);if(_0x2703ba){for(var _0xa54132 in _0x2703ba){if(_0x2703ba['hasOwnProperty'](_0xa54132)){this[_0x9a1c('0x10')][_0x9a1c('0xa0')](util[_0x9a1c('0x59')](_0x9a1c('0x150'),_0xa54132['toUpperCase']()),_0x2703ba[_0xa54132]);}}return this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0x151'),JSON['stringify'](_0x2703ba)));}}return _0x12dc78;};AGIVertices['prototype'][_0x9a1c('0x152')]=function(_0x3285e4){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x3285e4['label']));if(!this[_0x9a1c('0xab')](_0x3285e4[_0x9a1c('0x84')])){return this[_0x9a1c('0x10')]['noop'](_0x9a1c('0x12e'));}if(!this['isConfigured'](_0x3285e4[_0x9a1c('0x60')])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0xad'));}this['channel']['noop'](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x3285e4[_0x9a1c('0x60')]));var _0x29ccd9=this['ispeechTTS'][_0x9a1c('0x73')](this,_0x3285e4);if(_0x29ccd9){this['channel'][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0x14f'),_0x29ccd9));var _0x5760b7=this[_0x9a1c('0x10')][_0x9a1c('0x103')](_0x29ccd9,_0x3285e4[_0x9a1c('0x131')]);try{fs[_0x9a1c('0x104')](_0x29ccd9+_0x9a1c('0x105'));}catch(_0x2d84ec){logger[_0x9a1c('0x32')](_0x2d84ec);}return _0x5760b7;}return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x3285e4,_0x9a1c('0x153'));};AGIVertices[_0x9a1c('0x12')]['login']=function(_0x3511e1){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x154'),_0x3511e1[_0x9a1c('0xaa')]));if(!this['isConfigured'](_0x3511e1[_0x9a1c('0x155')])){return this['channel'][_0x9a1c('0x32')](_0x3511e1,'no\x20find\x20by\x20configured');}logger['info'](util[_0x9a1c('0x59')](_0x9a1c('0x156'),this[_0x9a1c('0x10')][_0x9a1c('0x3d')],_0x3511e1[_0x9a1c('0x155')]));var _0x369327=this['agentLogin']['sync'](this,_0x3511e1[_0x9a1c('0x155')]);if(_0x369327){logger['info'](util[_0x9a1c('0x59')](_0x9a1c('0x157'),this[_0x9a1c('0x10')][_0x9a1c('0x3d')],_0x3511e1[_0x9a1c('0x155')]));this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0x157'),this[_0x9a1c('0x10')][_0x9a1c('0x3d')],_0x3511e1['findBy']));return{'code':0xc8,'result':_0x9a1c('0x158')};}else{logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x159'),this[_0x9a1c('0x10')][_0x9a1c('0x3d')],_0x3511e1[_0x9a1c('0x155')]));this[_0x9a1c('0x10')]['noop'](util[_0x9a1c('0x59')](_0x9a1c('0x159'),this[_0x9a1c('0x10')][_0x9a1c('0x3d')],_0x3511e1[_0x9a1c('0x155')]));return{'code':0xc8,'result':_0x9a1c('0x15a')};}};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x15b')]=function(_0x42fe79){logger[_0x9a1c('0x35')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x42fe79[_0x9a1c('0xaa')]));if(!this['isConfigured'](_0x42fe79[_0x9a1c('0x155')])){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x42fe79,_0x9a1c('0x15c'));}logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x156'),this[_0x9a1c('0x10')][_0x9a1c('0x3d')],_0x42fe79[_0x9a1c('0x155')]));var _0x1d6014=this[_0x9a1c('0x56')][_0x9a1c('0x73')](this,_0x42fe79[_0x9a1c('0x155')]);if(_0x1d6014){logger[_0x9a1c('0x35')](util['format'](_0x9a1c('0x157'),this[_0x9a1c('0x10')]['callerid'],_0x42fe79[_0x9a1c('0x155')]));this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0x157'),this[_0x9a1c('0x10')][_0x9a1c('0x3d')],_0x42fe79[_0x9a1c('0x155')]));return{'code':0xc8,'result':_0x9a1c('0x158')};}else{logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x9a1c('0x3d')],_0x42fe79[_0x9a1c('0x155')]));this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9a1c('0x10')]['callerid'],_0x42fe79[_0x9a1c('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x15d')]=function(_0x1024ed){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x1024ed[_0x9a1c('0xaa')]));if(!this[_0x9a1c('0xab')](_0x1024ed['operation'])){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x1024ed,_0x9a1c('0x15e'));}this[_0x9a1c('0x10')]['noop'](util[_0x9a1c('0x59')](_0x9a1c('0x15f'),_0x1024ed[_0x9a1c('0x160')]));var _0x715894=eval(_0x1024ed[_0x9a1c('0x160')]);if(!this[_0x9a1c('0xab')](_0x1024ed['variable_id'])){return this['channel'][_0x9a1c('0xac')](_0x9a1c('0xdb'));}var _0x63ffdc=this[_0x9a1c('0x13')][_0x9a1c('0x73')](this,_0x1024ed[_0x9a1c('0xda')]);if(!_0x63ffdc){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x1024ed,_0x9a1c('0xdc'));}if(_['isArray'](_0x715894)){var _0x57b1c5=this;_0x715894['forEach'](function(_0x24018f,_0x186397){_0x57b1c5[_0x9a1c('0x10')][_0x9a1c('0xa0')](util[_0x9a1c('0x59')](_0x9a1c('0x161'),_0x63ffdc,_0x186397),_0x24018f);});return this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0x162'),_0x63ffdc));}else{return this[_0x9a1c('0x10')][_0x9a1c('0xa0')](_0x63ffdc,_0x715894);}};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0xe')]=function(_0x193f2c){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x163'),_0x193f2c[_0x9a1c('0xaa')]));if(_0x193f2c['retry']===0x0){return this['maxRetry'](_0x193f2c);}_0x193f2c['retry']-=0x1;if(!this[_0x9a1c('0xab')](_0x193f2c[_0x9a1c('0x111')])){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x193f2c,_0x9a1c('0x112'));}var _0x199848=this[_0x9a1c('0x23')][_0x9a1c('0x73')](this,_0x193f2c[_0x9a1c('0x111')]);if(!_0x199848){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x193f2c,'no\x20file\x20audio\x20found');}var _0x82431c=this[_0x9a1c('0x10')][_0x9a1c('0x114')](_0x199848,_0x193f2c[_0x9a1c('0x115')],_0x193f2c[_0x9a1c('0x164')]);var _0x2fb7ea=_0x82431c[_0x9a1c('0xa5')];if(_0x82431c[_0x9a1c('0xa5')]===-0x1){this[_0x9a1c('0x3b')][_0x9a1c('0x73')](this,_0x193f2c,'-1');return _0x82431c;}else if(_0x82431c[_0x9a1c('0xa3')]===_0x9a1c('0x6a')){_0x82431c[_0x9a1c('0xa5')]=_0x82431c[_0x9a1c('0xa5')][_0x9a1c('0x9d')]>0x0?_0x82431c['result']:'t';}else if(_[_0x9a1c('0x48')](_0x82431c[_0x9a1c('0xa5')])){_0x82431c[_0x9a1c('0xa5')]='#';_0x2fb7ea='#';}if(!this[_0x9a1c('0xab')](_0x193f2c[_0x9a1c('0xda')])){this[_0x9a1c('0x10')][_0x9a1c('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x2ae323=this['getVariable'][_0x9a1c('0x73')](this,_0x193f2c['variable_id']);if(!_0x2ae323){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x193f2c,_0x9a1c('0xdc'));}this[_0x9a1c('0x10')][_0x9a1c('0xa0')](_0x2ae323,_0x2fb7ea);}this[_0x9a1c('0x3b')][_0x9a1c('0x73')](this,_0x193f2c,_0x2fb7ea);return _0x82431c;};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0xac')]=function(_0x53dd6a){logger[_0x9a1c('0x35')](util['format'](_0x9a1c('0x165'),_0x53dd6a[_0x9a1c('0xaa')]));return this[_0x9a1c('0x10')]['noop'](_0x53dd6a[_0x9a1c('0x166')]||_0x53dd6a[_0x9a1c('0xaa')]);};AGIVertices['prototype'][_0x9a1c('0x167')]=function(_0x4bf0b0){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x4bf0b0[_0x9a1c('0xaa')]));if(!this['isConfigured'](_0x4bf0b0[_0x9a1c('0x155')])){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x4bf0b0,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0x9a1c('0x156'),this[_0x9a1c('0x10')][_0x9a1c('0x3d')],_0x4bf0b0[_0x9a1c('0x155')]));var _0x216710=this[_0x9a1c('0x52')][_0x9a1c('0x73')](this,_0x4bf0b0['pause_id']);var _0x448a9d=this['agentPause'][_0x9a1c('0x73')](this,_0x4bf0b0[_0x9a1c('0x155')],_0x216710);if(_0x448a9d){logger[_0x9a1c('0x35')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x9a1c('0x3d')],_0x4bf0b0['findBy']));this[_0x9a1c('0x10')][_0x9a1c('0xac')](util['format'](_0x9a1c('0x157'),this[_0x9a1c('0x10')]['callerid'],_0x4bf0b0[_0x9a1c('0x155')]));return{'code':0xc8,'result':_0x9a1c('0x158')};}else{logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x159'),this[_0x9a1c('0x10')][_0x9a1c('0x3d')],_0x4bf0b0[_0x9a1c('0x155')]));this[_0x9a1c('0x10')]['noop'](util[_0x9a1c('0x59')](_0x9a1c('0x157'),this['channel'][_0x9a1c('0x3d')],_0x4bf0b0['findBy']));return{'code':0xc8,'result':_0x9a1c('0x15a')};}};AGIVertices[_0x9a1c('0x12')]['playback']=function(_0x3625f9){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x168'),_0x3625f9[_0x9a1c('0xaa')]));if(!this['isConfigured'](_0x3625f9['file_id'])){return this[_0x9a1c('0x10')]['error'](_0x3625f9,'no\x20file\x20audio\x20selected');}var _0x1e98fb=this['getSound'][_0x9a1c('0x73')](this,_0x3625f9['file_id']);if(!_0x1e98fb){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x3625f9,_0x9a1c('0x113'));}var _0x1a2512=this[_0x9a1c('0x10')][_0x9a1c('0x5c')]('PLAYBACK',[_0x1e98fb,_0x3625f9[_0x9a1c('0xe7')]]);if(_0x1a2512['result']===-0x1){return _0x1a2512;}return this['channel'][_0x9a1c('0xac')](util[_0x9a1c('0x59')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x1e98fb));};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x169')]=function(_0xc0f46d){logger[_0x9a1c('0x35')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0xc0f46d[_0x9a1c('0xaa')]));if(!this[_0x9a1c('0xab')](_0xc0f46d[_0x9a1c('0x16a')])){return this['channel'][_0x9a1c('0x32')](_0xc0f46d,'no\x20queue\x20selected');}var _0x493ef4='';var _0x202dd1=parseInt(_0xc0f46d['queue_id'],0xa);if(isNaN(_0x202dd1)){_0x493ef4=_0xc0f46d[_0x9a1c('0x16a')];}else{_0x493ef4=this['getVoiceQueue'][_0x9a1c('0x73')](this,_0xc0f46d['queue_id']);if(!_0x493ef4){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0xc0f46d,_0x9a1c('0x16b'));}}var _0x227dcd='';if(this[_0x9a1c('0xab')](_0xc0f46d['file_id'])){var _0x44efec=this[_0x9a1c('0x23')]['sync'](this,_0xc0f46d['file_id']);if(_0x44efec){_0x227dcd=_0x44efec;}}this[_0x9a1c('0x3b')][_0x9a1c('0x73')](this,_0xc0f46d,_0x493ef4);if(_0xc0f46d[_0x9a1c('0xe7')][_0x9a1c('0x16c')]('x')<0x0){_0xc0f46d[_0x9a1c('0xe7')]+='x';}if(_0xc0f46d[_0x9a1c('0xe7')][_0x9a1c('0x16c')]('X')<0x0){_0xc0f46d['opts']+='X';}this[_0x9a1c('0x10')][_0x9a1c('0xa0')](_0x9a1c('0x16d'),_0x493ef4?_0x493ef4[_0x9a1c('0x16e')]():'');var _0x214d1f=this[_0x9a1c('0x10')][_0x9a1c('0x5c')]('QUEUE',[_0x493ef4,_0xc0f46d[_0x9a1c('0xe7')],_0xc0f46d[_0x9a1c('0x68')],_0x227dcd,_0xc0f46d['timeout'],_0xc0f46d['agi'],_0xc0f46d[_0x9a1c('0x16f')],_0xc0f46d['gosub'],'',_0xc0f46d[_0x9a1c('0x170')]]);if(_0x214d1f[_0x9a1c('0xa5')]===-0x1){return _0x214d1f;}return this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0xc4'),_0x9a1c('0x171'),_0x493ef4));};AGIVertices[_0x9a1c('0x12')]['record']=function(_0x288044){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x172'),_0x288044[_0x9a1c('0xaa')]));var _0x244472=_0x288044[_0x9a1c('0x173')]||'wav';var _0x3dce6a=util[_0x9a1c('0x59')](_0x9a1c('0x174'),this[_0x9a1c('0x10')]['uniqueid'],rs[_0x9a1c('0x11a')](0x5));var _0x1a2e95=util[_0x9a1c('0x59')](_0x9a1c('0x175'),FILES_PATH,_0x3dce6a,_0x244472);var _0x49d094=util[_0x9a1c('0x59')](_0x9a1c('0x12f'),FILES_PATH,_0x3dce6a);this[_0x9a1c('0x3e')][_0x9a1c('0x73')](this,_0x288044,_0x3dce6a,_0x1a2e95);this[_0x9a1c('0x10')][_0x9a1c('0xa0')](_0x9a1c('0x176'),_0x3dce6a);logger[_0x9a1c('0x35')](_0x9a1c('0x177'),_0x49d094,_0x244472,_0x288044['escape_digits'],_0x288044['timeout']);return this[_0x9a1c('0x10')][_0x9a1c('0x13b')](_0x49d094,_0x244472,_0x288044[_0x9a1c('0x178')],_0x288044[_0x9a1c('0x6a')],undefined,!![]);};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x179')]=function(_0xf3a23c){logger['info'](util['format'](_0x9a1c('0x17a'),_0xf3a23c[_0x9a1c('0xaa')]));if(!this[_0x9a1c('0xab')](_0xf3a23c['url'])){return this[_0x9a1c('0x10')]['noop'](_0x9a1c('0x17b'));}var _0x387ad1=this[_0x9a1c('0x67')][_0x9a1c('0x73')](this,_0xf3a23c);logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x17c'),util[_0x9a1c('0x17d')](_0x387ad1,{'showHidden':![],'depth':null})));if(!this[_0x9a1c('0xab')](_0xf3a23c['variable_id'])){return this[_0x9a1c('0x10')]['noop'](_0x9a1c('0x17e'));}var _0xab404e=this['getVariable'][_0x9a1c('0x73')](this,_0xf3a23c['variable_id']);if(!_0xab404e){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0xf3a23c,_0x9a1c('0xdc'));}this[_0x9a1c('0x10')][_0x9a1c('0xa0')](util[_0x9a1c('0x59')](_0x9a1c('0x17f'),_0xab404e),_0x387ad1[_0x9a1c('0x180')]?_0x387ad1[_0x9a1c('0x180')]:'200');this[_0x9a1c('0x10')][_0x9a1c('0xa0')](util[_0x9a1c('0x59')]('%s_STATUS_MESSAGE',_0xab404e),_0x387ad1['statusMessage']?_0x387ad1[_0x9a1c('0x181')]:'OK');if(_0x387ad1[_0x9a1c('0x6e')]){try{this[_0x9a1c('0x9e')](_0x387ad1[_0x9a1c('0x6e')],_0xab404e);}catch(_0x30be02){logger[_0x9a1c('0x32')](util[_0x9a1c('0x59')](_0x9a1c('0x182'),_0xab404e));}}return this['channel'][_0x9a1c('0xac')](util['format'](_0x9a1c('0x183'),_0xab404e));};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x184')]=function(_0x4a804b){logger[_0x9a1c('0x35')](util['format'](_0x9a1c('0x185'),_0x4a804b[_0x9a1c('0xaa')]));return this[_0x9a1c('0x10')][_0x9a1c('0x186')](_0x4a804b['digits']['replace'](/\s+/g,''),_0x4a804b['escape_digits']);};AGIVertices['prototype'][_0x9a1c('0x187')]=function(_0x3c41e8){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x3c41e8[_0x9a1c('0xaa')]));return this[_0x9a1c('0x10')][_0x9a1c('0x188')](_0x3c41e8[_0x9a1c('0x189')][_0x9a1c('0x18a')](/\s+/g,''),_0x3c41e8[_0x9a1c('0x178')]);};AGIVertices[_0x9a1c('0x12')]['sayphonetic']=function(_0x2f45c7){logger['info'](util[_0x9a1c('0x59')](_0x9a1c('0x18b'),_0x2f45c7[_0x9a1c('0xaa')]));return this[_0x9a1c('0x10')][_0x9a1c('0x18c')](_0x2f45c7[_0x9a1c('0x60')],_0x2f45c7[_0x9a1c('0x178')]);};AGIVertices['prototype']['sendMail']=function(_0x3cd472){logger[_0x9a1c('0x35')](util['format'](_0x9a1c('0x18d'),_0x3cd472[_0x9a1c('0xaa')]));if(!this[_0x9a1c('0xab')](_0x3cd472[_0x9a1c('0x18e')])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0x18f'));}var _0x23911e=this[_0x9a1c('0x190')][_0x9a1c('0x73')](this,_0x3cd472[_0x9a1c('0x18e')]);if(!_0x23911e||!_0x23911e[_0x9a1c('0x191')]){return this['channel']['error'](_0x3cd472,'no\x20mail\x20account\x20found');}var _0x1198a8={'from':util[_0x9a1c('0x59')]('\x22%s\x22\x20<%s>',_0x23911e['name'],_0x23911e[_0x9a1c('0x192')]||_0x23911e[_0x9a1c('0x191')][_0x9a1c('0x193')]),'to':_0x3cd472['to']||'','cc':_0x3cd472['cc']||'','bcc':_0x3cd472['bcc']||'','subject':_0x3cd472[_0x9a1c('0x194')],'html':_0x3cd472[_0x9a1c('0x60')],'text':_0x3cd472[_0x9a1c('0x60')]};var _0x2a0640={'tls':{'rejectUnauthorized':![]}};if(_0x23911e[_0x9a1c('0x191')][_0x9a1c('0x195')]){_0x2a0640[_0x9a1c('0x195')]=_0x23911e[_0x9a1c('0x191')][_0x9a1c('0x195')];}else{_0x2a0640['host']=_0x23911e[_0x9a1c('0x191')][_0x9a1c('0x196')];_0x2a0640['port']=_0x23911e[_0x9a1c('0x191')]['port'];_0x2a0640['secure']=_0x23911e['Smtp'][_0x9a1c('0x197')];}if(_0x23911e[_0x9a1c('0x191')]['authentication']){_0x2a0640[_0x9a1c('0x198')]={'user':_0x23911e[_0x9a1c('0x191')][_0x9a1c('0x193')],'pass':_0x23911e[_0x9a1c('0x191')][_0x9a1c('0x199')]};}if(this[_0x9a1c('0xab')](_0x3cd472[_0x9a1c('0x19a')])){}logger[_0x9a1c('0xe2')](_0x9a1c('0x19b'),JSON[_0x9a1c('0x76')](_0x1198a8));this[_0x9a1c('0x3b')][_0x9a1c('0x73')](this,_0x3cd472,_0x3cd472[_0x9a1c('0x18e')]);this['channel']['noop'](util[_0x9a1c('0x59')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x23911e[_0x9a1c('0x15')]));this[_0x9a1c('0x28')][_0x9a1c('0x73')](this,_0x2a0640,_0x1198a8);return this[_0x9a1c('0x10')][_0x9a1c('0xac')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x19c')]=function(_0x19d21c){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x19d'),_0x19d21c['label']));return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0x19e'));};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x19f')]=function(_0x2ff9fd){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x1a0'),_0x2ff9fd['label']));if(!this[_0x9a1c('0xab')](_0x2ff9fd[_0x9a1c('0x1a1')])){return this[_0x9a1c('0x10')]['noop'](_0x9a1c('0x1a2'));}var _0x59713c=this[_0x9a1c('0x38')]['sync'](this,_0x2ff9fd[_0x9a1c('0x1a1')]);if(!_0x59713c){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x2ff9fd,_0x9a1c('0x1a3'));}var _0x24e9af={'body':_0x2ff9fd[_0x9a1c('0x1a4')],'phone':_0x2ff9fd['to']||'','SmsAccountId':_0x59713c['id']};logger[_0x9a1c('0xe2')](_0x9a1c('0x1a5'),JSON[_0x9a1c('0x76')](_0x24e9af));this[_0x9a1c('0x3b')][_0x9a1c('0x73')](this,_0x2ff9fd,_0x2ff9fd[_0x9a1c('0x1a1')]);this['channel']['noop'](util[_0x9a1c('0x59')](_0x9a1c('0x1a6'),_0x59713c['name']));this[_0x9a1c('0x3a')][_0x9a1c('0x73')](this,_0x24e9af);return this[_0x9a1c('0x10')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x1a7')]=function(_0x2ec1cc){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x1a8'),_0x2ec1cc[_0x9a1c('0xaa')]));if(!this[_0x9a1c('0xab')](_0x2ec1cc[_0x9a1c('0xda')])){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x2ec1cc,_0x9a1c('0x1a9'));}var _0x1e7a4a=this[_0x9a1c('0x13')][_0x9a1c('0x73')](this,_0x2ec1cc[_0x9a1c('0xda')]);if(!_0x1e7a4a){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x2ec1cc,_0x9a1c('0xdc'));}return this[_0x9a1c('0x10')]['setVariable'](_0x1e7a4a,_0x2ec1cc['variable_value']);};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x1aa')]=function(_0x2ffdb1){logger['info'](util['format'](_0x9a1c('0x1ab'),_0x2ffdb1['label']));this[_0x9a1c('0x10')]['noop'](_0x9a1c('0x1ac'));if(_0x2ffdb1['answer']==='yes'){this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0x1ad'));return this[_0x9a1c('0x10')][_0x9a1c('0xba')]();}return this['channel'][_0x9a1c('0xac')](_0x9a1c('0x1ae'));};AGIVertices[_0x9a1c('0x12')]['subproject']=function(_0x196849){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x1af'),_0x196849[_0x9a1c('0xaa')]));if(!this[_0x9a1c('0xab')](_0x196849[_0x9a1c('0x1b0')])){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x196849,'no\x20subproject\x20selected');}var _0x8c2727=this[_0x9a1c('0x1a')][_0x9a1c('0x73')](this,_0x196849[_0x9a1c('0x1b0')]);if(!this[_0x9a1c('0xab')](_0x8c2727)){return this['channel'][_0x9a1c('0x32')](_0x196849,util['format'](_0x9a1c('0x1b1'),_0x196849[_0x9a1c('0x1b0')]));}if(_0x8c2727===this[_0x9a1c('0x10')]['arg_1']){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x196849,_0x9a1c('0x1b2'));}this['createSquareDetailsReport']['sync'](this,_0x196849,_0x8c2727);var _0xc6eadd=this['channel'][_0x9a1c('0x5c')](_0x9a1c('0x1b3'),util[_0x9a1c('0x59')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x9a1c('0x9')][_0x9a1c('0x196')]||_0x9a1c('0x1b4'),_0x8c2727,this[_0x9a1c('0x10')]['arg_1']));if(_0xc6eadd['result']===-0x1){return _0xc6eadd;}return this[_0x9a1c('0x10')]['noop'](util['format']('Executed\x20command\x20%s\x20%s','AGI',_0x8c2727));};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x1b5')]=function(_0x9d1cbd){logger[_0x9a1c('0x35')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x9d1cbd[_0x9a1c('0xaa')]));var _0x4d399d=this[_0x9a1c('0x1b6')]['sync'](this,_0x9d1cbd[_0x9a1c('0xb8')]);this[_0x9a1c('0x3b')][_0x9a1c('0x73')](this,_0x9d1cbd,_0x9d1cbd[_0x9a1c('0xb8')]);if(this[_0x9a1c('0xab')](_0x9d1cbd[_0x9a1c('0xda')])){var _0x15ef5a=this[_0x9a1c('0x13')][_0x9a1c('0x73')](this,_0x9d1cbd[_0x9a1c('0xda')]);if(_0x15ef5a){this[_0x9a1c('0x10')][_0x9a1c('0xa0')](_0x15ef5a,_0x4d399d);return this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0x1b7'),_0x9d1cbd['command'],_0x15ef5a));}}return this[_0x9a1c('0x10')]['noop'](util[_0x9a1c('0x59')](_0x9a1c('0x1b8'),_0x9d1cbd[_0x9a1c('0xb8')]));};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x1b9')]=function(_0x55844b){logger['info'](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x55844b[_0x9a1c('0xaa')]));_0x55844b['text']=_0x55844b[_0x9a1c('0x60')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9a1c('0xab')](_0x55844b['apiKey'])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0x1ba'));}if(!this[_0x9a1c('0xab')](_0x55844b[_0x9a1c('0x60')])){return this['channel'][_0x9a1c('0xac')](_0x9a1c('0xad'));}this['channel'][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0x1bb'),_0x55844b[_0x9a1c('0x60')]));var _0x1acf97=this[_0x9a1c('0x5e')][_0x9a1c('0x73')](this,_0x55844b);if(_0x1acf97){this[_0x9a1c('0x10')]['noop'](util[_0x9a1c('0x59')](_0x9a1c('0x1bc'),_0x1acf97));var _0x312ea9=this[_0x9a1c('0x10')][_0x9a1c('0x103')](_0x1acf97);try{fs['unlink'](_0x1acf97+'.wav');}catch(_0x665833){logger[_0x9a1c('0x32')](_0x665833);}return _0x312ea9;}return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x55844b,_0x9a1c('0x1bd'));};AGIVertices['prototype']['tts']=function(_0x4d3f88){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x1be'),_0x4d3f88['label']));_0x4d3f88[_0x9a1c('0x60')]=_0x4d3f88[_0x9a1c('0x60')][_0x9a1c('0x18a')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x4d3f88[_0x9a1c('0x60')])){return this[_0x9a1c('0x10')][_0x9a1c('0xac')](_0x9a1c('0xad'));}this[_0x9a1c('0x10')]['noop'](util[_0x9a1c('0x59')](_0x9a1c('0x1bf'),_0x4d3f88[_0x9a1c('0x60')]));var _0x386b9c=this[_0x9a1c('0x65')][_0x9a1c('0x73')](this,_0x4d3f88);if(_0x386b9c){this['channel'][_0x9a1c('0xac')](util[_0x9a1c('0x59')]('Google\x20TTS\x20%s\x20file\x20created',_0x386b9c));var _0x2ddcb8=this[_0x9a1c('0x10')]['streamFile'](_0x386b9c);try{fs[_0x9a1c('0x104')](_0x386b9c+_0x9a1c('0x105'));}catch(_0x5e36eb){logger[_0x9a1c('0x32')](_0x5e36eb);}return _0x2ddcb8;}return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x4d3f88,_0x9a1c('0x1c0'));};AGIVertices[_0x9a1c('0x12')][_0x9a1c('0x1c1')]=function(_0x1a78fb){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x1c2'),_0x1a78fb[_0x9a1c('0xaa')]));if(!this['isConfigured'](_0x1a78fb['findBy'])){return this['channel'][_0x9a1c('0x32')](_0x1a78fb,'no\x20find\x20by\x20configured');}logger[_0x9a1c('0x35')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x9a1c('0x3d')],_0x1a78fb[_0x9a1c('0x155')]));var _0x320c56=this['agentUnpause']['sync'](this,_0x1a78fb[_0x9a1c('0x155')]);if(_0x320c56){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x1a78fb[_0x9a1c('0x155')]));this[_0x9a1c('0x10')][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0x157'),this[_0x9a1c('0x10')][_0x9a1c('0x3d')],_0x1a78fb[_0x9a1c('0x155')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x9a1c('0x59')](_0x9a1c('0x159'),this[_0x9a1c('0x10')][_0x9a1c('0x3d')],_0x1a78fb[_0x9a1c('0x155')]));this[_0x9a1c('0x10')][_0x9a1c('0xac')](util['format'](_0x9a1c('0x159'),this[_0x9a1c('0x10')][_0x9a1c('0x3d')],_0x1a78fb['findBy']));return{'code':0xc8,'result':_0x9a1c('0x15a')};}};AGIVertices['prototype']['voicemail']=function(_0x1dcc83){logger[_0x9a1c('0x35')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x1dcc83[_0x9a1c('0xaa')]));var _0x26126d=this[_0x9a1c('0x10')][_0x9a1c('0x5c')](_0x9a1c('0x1c3'),[_0x1dcc83[_0x9a1c('0x1c4')],_0x1dcc83[_0x9a1c('0xae')]]);if(_0x26126d[_0x9a1c('0xa5')]===-0x1){return _0x26126d;}return this['channel'][_0x9a1c('0xac')](util[_0x9a1c('0x59')](_0x9a1c('0xc4'),_0x9a1c('0x1c3'),_0x1dcc83[_0x9a1c('0x1c4')]));};AGIVertices['prototype'][_0x9a1c('0x1c5')]=function(_0x448396){logger[_0x9a1c('0x35')](util[_0x9a1c('0x59')](_0x9a1c('0x1c6'),_0x448396[_0x9a1c('0xaa')]));if(!this['isConfigured'](_0x448396[_0x9a1c('0xda')])){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x448396,'no\x20variable\x20selected');}var _0x198ea2=this[_0x9a1c('0x13')]['sync'](this,_0x448396[_0x9a1c('0xda')]);if(!_0x198ea2){return this[_0x9a1c('0x10')][_0x9a1c('0x32')](_0x448396,_0x9a1c('0xdc'));}var _0x23b94a=this[_0x9a1c('0x10')][_0x9a1c('0x13')](_0x198ea2);return{'code':0xc8,'result':_0x23b94a[_0x9a1c('0xa3')]?_0x23b94a['extra']:'-'};};String[_0x9a1c('0x12')][_0x9a1c('0xa2')]=function(_0x2105df,_0x2369c6){return this[_0x9a1c('0xa1')](_0x2105df)[_0x9a1c('0x1c7')](_0x2369c6);};module[_0x9a1c('0x1c8')]=AGIVertices; \ No newline at end of file +var _0x826c=['Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','getSound','getData','response','maxdigit','test','hiddendigitsnum','hiddendigitspos','first','substr','generate','GOAL\x20%s','goalname','awspolly','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','%s/recordings/%s','TILDE_ASR_%s','gotoc','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','getIntervals','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','agentLogin','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20selected','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s/recordings/%s.%s','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','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','system','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','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','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','../../config/environment','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','then','name','catch','prototype','getVoiceQueueById','getSquareProjectById','dsn','getUser','getUserById','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','map','interval','format','getQueryOdbc','open','error','query','info','Error\x20executing\x20query\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','file','createSquareMessage','createCmContact','isEmpty','random','lastName','isNil','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentLogout','internal','%s/%s@from-sip/n','shellCommand','exec','trim','replace','apiKey','text','ssmlGender','MALE','MP3','googleTTS','restAPI','url','method','timeout','number','POST','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','en-US','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','google_asr_language','tildeASR','appid','appsecret','clear','includes','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','agi','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','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','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','toUpperCase','speech','out','dialogflow','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','streamFile','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end'];(function(_0x519c88,_0xb84103){var _0x4668d7=function(_0x596c2c){while(--_0x596c2c){_0x519c88['push'](_0x519c88['shift']());}};_0x4668d7(++_0xb84103);}(_0x826c,0xc8));var _0xc826=function(_0x276c16,_0xdf24a2){_0x276c16=_0x276c16-0x0;var _0x10c4eb=_0x826c[_0x276c16];return _0x10c4eb;};'use strict';var fs=require('fs');var path=require(_0xc826('0x0'));var util=require(_0xc826('0x1'));var _=require(_0xc826('0x2'));var sh=require(_0xc826('0x3'));var odbc=require(_0xc826('0x4'))();var rs=require(_0xc826('0x5'));var moment=require(_0xc826('0x6'));var Mustache=require(_0xc826('0x7'));var rp=require(_0xc826('0x8'));var logger=require(_0xc826('0x9'))('agi');var config=require(_0xc826('0xa'));var scripts=require('./scripts');var FILES_PATH=_0xc826('0xb');var recursiveMapAttributes=['rawHeaders',_0xc826('0xc')];var verticesWithRetry=[_0xc826('0xd'),_0xc826('0xe'),_0xc826('0xf')];var AGIVertices=function(_0x3d3f80,_0x3ece3f,_0x50a96b){this[_0xc826('0x10')]=_0x3d3f80;this[_0xc826('0x11')]=_0x3ece3f;this[_0xc826('0x12')]=_0x50a96b;};AGIVertices['prototype'][_0xc826('0x13')]=function(_0x4f8aa3,_0x398dfa){this['rpc']['getVariableById'](_0x4f8aa3)[_0xc826('0x14')](function(_0x59ad35){_0x398dfa(null,_0x59ad35?_0x59ad35[_0xc826('0x15')]:![]);})[_0xc826('0x16')](function(_0x2203d2){_0x398dfa(_0x2203d2);});};AGIVertices[_0xc826('0x17')]['getVoiceQueue']=function(_0x4528f8,_0x56a7a0){this[_0xc826('0x11')][_0xc826('0x18')](_0x4528f8)[_0xc826('0x14')](function(_0x9fa928){_0x56a7a0(null,_0x9fa928?_0x9fa928[_0xc826('0x15')]:![]);})[_0xc826('0x16')](function(_0x3e1bd1){_0x56a7a0(_0x3e1bd1);});};AGIVertices[_0xc826('0x17')]['getSquareProject']=function(_0x202b86,_0x321f6b){this['rpc'][_0xc826('0x19')](_0x202b86)[_0xc826('0x14')](function(_0x2c0d46){_0x321f6b(null,_0x2c0d46?_0x2c0d46[_0xc826('0x15')]:![]);})[_0xc826('0x16')](function(_0x2a4fd9){_0x321f6b(_0x2a4fd9);});};AGIVertices[_0xc826('0x17')]['getSquareOdbc']=function(_0x1949bf,_0x2eeeb3){this[_0xc826('0x11')]['getSquareOdbcById'](_0x1949bf)['then'](function(_0x559911){_0x2eeeb3(null,_0x559911?_0x559911[_0xc826('0x1a')]:![]);})[_0xc826('0x16')](function(_0x2423f5){_0x2eeeb3(_0x2423f5);});};AGIVertices[_0xc826('0x17')][_0xc826('0x1b')]=function(_0x50cca6,_0x475b2e){this[_0xc826('0x11')][_0xc826('0x1c')](_0x50cca6)[_0xc826('0x14')](function(_0x428e5f){_0x475b2e(null,_0x428e5f?_0x428e5f[_0xc826('0x15')]:![]);})[_0xc826('0x16')](function(_0x370b34){_0x475b2e(_0x370b34);});};AGIVertices[_0xc826('0x17')]['getTrunk']=function(_0x175a41,_0x43f173){this['rpc'][_0xc826('0x1d')](_0x175a41)['then'](function(_0x4b28b2){_0x43f173(null,_0x4b28b2?_0x4b28b2[_0xc826('0x15')]:![]);})[_0xc826('0x16')](function(_0x12b129){_0x43f173(_0x12b129);});};AGIVertices['prototype']['getSound']=function(_0xa6cb39,_0xcdebd5){var _0x5d05b6=this;this[_0xc826('0x11')][_0xc826('0x1e')](_0xa6cb39)['then'](function(_0x1bc35f){_0xcdebd5(null,_0x1bc35f?_0x5d05b6[_0xc826('0x1f')](_0x1bc35f[_0xc826('0x20')]):![]);})[_0xc826('0x16')](function(_0x19aac8){_0xcdebd5(_0x19aac8);});};AGIVertices['prototype'][_0xc826('0x21')]=function(_0x393ecd,_0x35f48e){this[_0xc826('0x11')][_0xc826('0x22')](_0x393ecd)['then'](function(_0x5d638c){_0x35f48e(null,_0x5d638c?_0x5d638c:![]);})[_0xc826('0x16')](function(_0x55b917){_0x35f48e(_0x55b917);});};AGIVertices[_0xc826('0x17')][_0xc826('0x23')]=function(_0x3b6228,_0x7e8114,_0x1de8f3){this[_0xc826('0x12')]['sendMailMessage'](_0x3b6228,_0x7e8114)['then'](function(){_0x1de8f3(null);})[_0xc826('0x16')](function(_0x4811e6){_0x1de8f3(_0x4811e6);});};AGIVertices[_0xc826('0x17')]['getIntervals']=function(_0x29d3dc,_0x4d4fd7){this[_0xc826('0x11')][_0xc826('0x24')](_0x29d3dc)[_0xc826('0x14')](function(_0x3b3c24){if(_0x3b3c24){if(_0x3b3c24[_0xc826('0x25')]){_0x4d4fd7(null,[_0x3b3c24['interval']]);}else{_0x4d4fd7(null,_[_0xc826('0x26')](_0x3b3c24['Intervals'],_0xc826('0x27')));}}else{_0x4d4fd7(null,![]);}})[_0xc826('0x16')](function(_0x220a01){_0x4d4fd7(_0x220a01);});};AGIVertices[_0xc826('0x17')][_0xc826('0x1f')]=function(_0x461ff2){return util[_0xc826('0x28')]('%s/sounds/converted/%s',FILES_PATH,_0x461ff2);};AGIVertices[_0xc826('0x17')][_0xc826('0x29')]=function(_0x1ae735,_0x1d966b,_0x472e75){odbc[_0xc826('0x2a')](_0x1ae735,function(_0x4d6ecf){if(_0x4d6ecf){logger[_0xc826('0x2b')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x4d6ecf);_0x472e75(_0x4d6ecf);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0xc826('0x2c')](_0x1d966b,function(_0x21db91,_0x308c3a){if(_0x21db91){logger[_0xc826('0x2d')](_0xc826('0x2e'),_0x1d966b);_0x472e75(_0x21db91);}else{logger[_0xc826('0x2d')]('Query\x20executed\x20correctly\x20%s',_0x1d966b);odbc['close'](function(_0x3055f8){if(_0x3055f8){logger[_0xc826('0x2b')](_0xc826('0x2f'),_0x3055f8);}_0x472e75(null,_0x308c3a);});}});}});};AGIVertices[_0xc826('0x17')][_0xc826('0x30')]=function(_0x1e2f93,_0xaccdbb){this[_0xc826('0x11')][_0xc826('0x31')](_0x1e2f93)['then'](function(_0x34dad8){_0xaccdbb(null,_0x34dad8?_0x34dad8:![]);})[_0xc826('0x16')](function(_0x555559){_0xaccdbb(_0x555559);});};AGIVertices['prototype'][_0xc826('0x32')]=function(_0x18ff50,_0x180044){this[_0xc826('0x11')][_0xc826('0x32')](_0x18ff50)['then'](function(_0x1a9d5c){_0x180044(null,_0x1a9d5c);})[_0xc826('0x16')](function(_0x3724df){_0x180044(_0x3724df);});};AGIVertices[_0xc826('0x17')][_0xc826('0x33')]=function(_0xf52051,_0x9fc97,_0x3bd03c){this['rpc'][_0xc826('0x33')]({'uniqueid':this[_0xc826('0x10')][_0xc826('0x34')],'node':_0xf52051[_0xc826('0x35')],'application':_0xf52051['agicommand'],'data':_0x9fc97||null,'project_name':this[_0xc826('0x10')][_0xc826('0x36')],'callerid':this[_0xc826('0x10')]['callerid']})[_0xc826('0x14')](function(_0x323717){if(_0x3bd03c){_0x3bd03c(null,_0x323717);}})[_0xc826('0x16')](function(_0x9c1744){if(_0x3bd03c){_0x3bd03c(_0x9c1744);}});};AGIVertices[_0xc826('0x17')][_0xc826('0x37')]=function(_0x7eded3,_0x5eb122,_0x1bf3e8,_0x42d04f){this[_0xc826('0x11')]['createSquareRecording']({'uniqueid':this[_0xc826('0x10')][_0xc826('0x34')],'callerid':this[_0xc826('0x10')][_0xc826('0x38')],'calleridname':this[_0xc826('0x10')][_0xc826('0x39')],'context':this['channel'][_0xc826('0x3a')],'extension':this['channel'][_0xc826('0x3b')],'priority':this[_0xc826('0x10')][_0xc826('0x3c')],'accountcode':this[_0xc826('0x10')]['accountcode'],'dnid':this['channel']['dnid'],'projectName':this[_0xc826('0x10')][_0xc826('0x36')],'saveName':_0x5eb122,'filename':_0x7eded3[_0xc826('0x3d')]||_0x5eb122,'savePath':_0x1bf3e8})['then'](function(_0x24eba5){_0x42d04f(null,_0x24eba5);})[_0xc826('0x16')](function(_0x5d687a){_0x42d04f(_0x5d687a);});};AGIVertices[_0xc826('0x17')][_0xc826('0x3e')]=function(_0x250d37,_0x4f8220,_0x568c0c,_0xd1fc6f,_0x48a361){this[_0xc826('0x11')][_0xc826('0x3e')]({'uniqueid':this[_0xc826('0x10')][_0xc826('0x34')],'body':_0x250d37,'direction':_0x4f8220,'providerName':_0x568c0c,'providerResponse':_0xd1fc6f})[_0xc826('0x14')](function(_0x345d5a){if(_0x48a361){_0x48a361(null,_0x345d5a);}})[_0xc826('0x16')](function(_0x2e9d0f){if(_0x48a361){_0x48a361(_0x2e9d0f);}});};AGIVertices['prototype'][_0xc826('0x3f')]=function(_0xa9c608,_0x30f632){this['rpc'][_0xc826('0x3f')]({'firstName':_[_0xc826('0x40')](_0xa9c608[_0xc826('0x15')])||_['isNil'](_0xa9c608[_0xc826('0x15')])?'callback_'+Math[_0xc826('0x41')]():_0xa9c608['name'],'lastName':_['isEmpty'](_0xa9c608[_0xc826('0x42')])||_[_0xc826('0x43')](_0xa9c608['lastName'])?null:_0xa9c608[_0xc826('0x42')],'phone':_0xa9c608[_0xc826('0x44')],'ListId':_0xa9c608[_0xc826('0x45')],'scheduledat':_0xa9c608[_0xc826('0x46')],'callbackUniqueid':this[_0xc826('0x10')][_0xc826('0x34')],'tags':_0xc826('0x47'),'description':'Callback\x20scheduled\x20at\x20'+_0xa9c608['scheduledAt'][_0xc826('0x48')](),'priority':_0xa9c608[_0xc826('0x49')]})[_0xc826('0x14')](function(_0xc5b87c){_0x30f632(null,_0xc5b87c);})[_0xc826('0x16')](function(_0x402dfa){_0x30f632(_0x402dfa);});};AGIVertices[_0xc826('0x17')][_0xc826('0x4a')]=function(_0x45ecfb,_0x80e6e){this['rpc'][_0xc826('0x4b')](_0x45ecfb)[_0xc826('0x14')](function(_0x335ab4){_0x80e6e(null,_0x335ab4?_0x335ab4[_0xc826('0x15')]:![]);})[_0xc826('0x16')](function(_0x2d73ba){_0x80e6e(_0x2d73ba);});};AGIVertices[_0xc826('0x17')]['agentPause']=function(_0x31fbcf,_0x22bbbd,_0x27f7bf){var _0x51bbf9={'role':_0xc826('0x4c')};_0x51bbf9[_0x31fbcf]=this[_0xc826('0x10')][_0xc826('0x38')];this[_0xc826('0x11')][_0xc826('0x4d')](_0x51bbf9,_0x22bbbd,this['channel'][_0xc826('0x34')])[_0xc826('0x14')](function(_0x2c2955){_0x27f7bf(null,_['isNil'](_0x2c2955)?![]:!![]);})[_0xc826('0x16')](function(_0x354a49){logger[_0xc826('0x2b')](_0x354a49);_0x27f7bf(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x488445,_0x49ef19){var _0x18c9ed={'role':'agent'};_0x18c9ed[_0x488445]=this[_0xc826('0x10')]['callerid'];this['rpc']['agentUnpause'](_0x18c9ed)[_0xc826('0x14')](function(_0x16c3ef){_0x49ef19(null,_[_0xc826('0x43')](_0x16c3ef)?![]:!![]);})[_0xc826('0x16')](function(_0x228836){logger[_0xc826('0x2b')](_0x228836);_0x49ef19(null,![]);});};AGIVertices[_0xc826('0x17')][_0xc826('0x4e')]=function(_0x18a023,_0x2339c6){var _0x2f2b8={'role':_0xc826('0x4c')};_0x2f2b8[_0x18a023]=this[_0xc826('0x10')]['callerid'];this[_0xc826('0x11')]['agentLogout'](_0x2f2b8)[_0xc826('0x14')](function(_0x4b2a37){_0x2339c6(null,_[_0xc826('0x43')](_0x4b2a37)?![]:!![]);})[_0xc826('0x16')](function(_0x527ee9){logger[_0xc826('0x2b')](_0x527ee9);_0x2339c6(null,![]);});};AGIVertices[_0xc826('0x17')]['agentLogin']=function(_0x39c6b3,_0x4ec92c){var _0x1fe7cb={'role':'agent'};_0x1fe7cb[_0x39c6b3]=this[_0xc826('0x10')]['callerid'];var _0x1e316b=_0x39c6b3!=_0xc826('0x4f')?util[_0xc826('0x28')](_0xc826('0x50'),'LOCAL',this[_0xc826('0x10')][_0xc826('0x38')]):undefined;this[_0xc826('0x11')]['agentLogin'](_0x1fe7cb,_0x1e316b)['then'](function(_0x1c03d3){_0x4ec92c(null,_[_0xc826('0x43')](_0x1c03d3)?![]:!![]);})[_0xc826('0x16')](function(_0x42f1c4){logger[_0xc826('0x2b')](_0x42f1c4);_0x4ec92c(null,![]);});};AGIVertices[_0xc826('0x17')][_0xc826('0x51')]=function(_0x32f238,_0x5d3313){sh[_0xc826('0x52')](_[_0xc826('0x53')](_0x32f238),function(_0x4555d9,_0x212551){var _0x5cde73=_0x212551[_0xc826('0x54')](/(\r\n|\n|\r)/gm,'');_0x5d3313(null,_0x5cde73);});};AGIVertices[_0xc826('0x17')]['googleCloudTTS']=function(_0x446023,_0x557798){scripts['googleCloudTTS'](_0x446023[_0xc826('0x55')],_0x446023['google_cloud_tts_text_type']||_0xc826('0x56'),_0x446023[_0xc826('0x56')],_0x446023['languageCode']||'en-US',_0x446023[_0xc826('0x57')]||_0xc826('0x58'),_0x446023['audioEncoding']||_0xc826('0x59'))['then'](function(_0x143551){_0x557798(null,_0x143551);})[_0xc826('0x16')](function(_0x47664){_0x557798(_0x47664);});};AGIVertices['prototype'][_0xc826('0x5a')]=function(_0x475959,_0xa02fd4){scripts[_0xc826('0x5a')](_0x475959[_0xc826('0x56')],_0x475959['google_tts_language']||'en',0x1)['then'](function(_0x5a4bbc){_0xa02fd4(null,_0x5a4bbc);})[_0xc826('0x16')](function(_0x47f80a){_0xa02fd4(_0x47f80a);});};AGIVertices[_0xc826('0x17')][_0xc826('0x5b')]=function(_0x30d4f1,_0x199537){var _0x1233f1={'uri':_0x30d4f1[_0xc826('0x5c')],'method':_0x30d4f1[_0xc826('0x5d')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x30d4f1[_0xc826('0x5e')])===_0xc826('0x5f')&&parseInt(_0x30d4f1['timeout'])>=0x1?parseInt(_0x30d4f1['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0xc826('0x60'),'PUT'],_0x1233f1[_0xc826('0x5d')]['toUpperCase']())){try{_0x1233f1['body']=_0x30d4f1[_0xc826('0xc')]?JSON[_0xc826('0x61')](_0x30d4f1[_0xc826('0xc')]):{};}catch(_0x105ece){logger['error'](_0xc826('0x62'),_0x105ece);}}try{_0x1233f1[_0xc826('0x63')]=_0x30d4f1[_0xc826('0x64')]?JSON[_0xc826('0x61')](_0x30d4f1['rawHeaders']):{};}catch(_0x1eb721){logger['error'](_0xc826('0x65'),_0x1eb721);}if(_0x30d4f1[_0xc826('0x66')]){try{var _0x42fe72=require(_0x30d4f1[_0xc826('0x66')])[_0xc826('0x67')](this,_0x1233f1);_0x1233f1[_0xc826('0x68')]=Mustache[_0xc826('0x69')](_0x30d4f1[_0xc826('0x5c')],_0x42fe72,{},['$$','$$']);if(_0x1233f1['headers']){_0x1233f1['headers']=JSON[_0xc826('0x61')](Mustache['render'](JSON[_0xc826('0x6a')](_0x1233f1['headers']),_0x42fe72,{},['$$','$$']));}if(_0x1233f1[_0xc826('0x6b')]){_0x1233f1['body']=JSON['parse'](Mustache[_0xc826('0x69')](JSON[_0xc826('0x6a')](_0x1233f1['body']),_0x42fe72,{},['$$','$$']));}}catch(_0xd401a1){logger[_0xc826('0x2b')](_0xc826('0x6c'),_0xd401a1);}}rp(_0x1233f1)[_0xc826('0x14')](function(_0x1d5540){var _0x187bb8={'statusCode':_0x1d5540['statusCode']||0xc8,'statusMessage':_0x1d5540['statusMessage']||'OK','headers':_0x1d5540[_0xc826('0x63')]||{},'body':_0x1d5540[_0xc826('0x6b')]||{}};_0x199537(null,_0x187bb8);})[_0xc826('0x16')](function(_0x5c078f){var _0x5eb654={'statusCode':_0x5c078f[_0xc826('0x6d')]||0x1f4,'statusMessage':_0x5c078f[_0xc826('0x6e')]||_0xc826('0x6f'),'headers':_0x5c078f['options'][_0xc826('0x63')]||{},'body':_0x5c078f[_0xc826('0x70')][_0xc826('0x6b')]||{}};_0x199537(null,_0x5eb654);});};AGIVertices[_0xc826('0x17')][_0xc826('0x71')]=function(_0x47a6d7,_0x24bf2b){scripts[_0xc826('0x71')](this['channel']['uniqueid'],_0x47a6d7[_0xc826('0x72')],_0x47a6d7[_0xc826('0x56')],_0x47a6d7['dialogflow_language']||'en')['then'](function(_0x253e13){_0x24bf2b(null,_0x253e13);})[_0xc826('0x16')](function(_0x1898be){_0x24bf2b(_0x1898be);});};AGIVertices[_0xc826('0x17')][_0xc826('0x73')]=function(_0x3f0d65,_0x51a9f7){scripts[_0xc826('0x73')](this[_0xc826('0x10')]['uniqueid'],_0x3f0d65[_0xc826('0x74')],_0x3f0d65[_0xc826('0x75')],_0x3f0d65[_0xc826('0x76')],_0x3f0d65['text'],_0x3f0d65[_0xc826('0x77')]||'en')[_0xc826('0x14')](function(_0x3ea308){_0x51a9f7(null,_0x3ea308);})['catch'](function(_0x5571a1){_0x51a9f7(_0x5571a1);});};AGIVertices[_0xc826('0x17')][_0xc826('0x78')]=function(_0x2300dc,_0x5c7541){scripts[_0xc826('0x78')](this[_0xc826('0x10')],_0x2300dc)[_0xc826('0x14')](function(_0x37485e){_0x5c7541(null,_0x37485e);})[_0xc826('0x16')](function(_0x5f10da){_0x5c7541(_0x5f10da);});};AGIVertices['prototype'][_0xc826('0x79')]=function(_0x165a1a,_0x488085){scripts[_0xc826('0x79')](_0x165a1a[_0xc826('0x72')],_0x165a1a[_0xc826('0x56')],_0x165a1a['ispeech_tts_language']||'en-US',_0x165a1a[_0xc826('0x7a')])['then'](function(_0xb7b0a4){_0x488085(null,_0xb7b0a4);})[_0xc826('0x16')](function(_0x1a560a){_0x488085(_0x1a560a);});};AGIVertices[_0xc826('0x17')][_0xc826('0x7b')]=function(_0x92aa0,_0x160a13,_0x4311bf){scripts[_0xc826('0x7b')](_0x160a13,_0x92aa0['key'],_0x92aa0['ispeech_asr_language']||_0xc826('0x7c'),this['isConfigured'](_0x92aa0[_0xc826('0x7d')])?_0x92aa0[_0xc826('0x7d')]:undefined)[_0xc826('0x14')](function(_0x27f1ab){_0x4311bf(null,_0x27f1ab);})[_0xc826('0x16')](function(_0x3b955f){_0x4311bf(_0x3b955f);});};AGIVertices[_0xc826('0x17')][_0xc826('0x7e')]=function(_0x5a2ce9,_0x3b9318){scripts['awsPolly'](_0x5a2ce9[_0xc826('0x7f')],_0x5a2ce9['aws_secret_access_key'],_0x5a2ce9[_0xc826('0x80')],_0x5a2ce9[_0xc826('0x81')]||_0xc826('0x82'),_0x5a2ce9[_0xc826('0x56')],_0x5a2ce9[_0xc826('0x83')]||_0xc826('0x56'))[_0xc826('0x14')](function(_0x8719e9){_0x3b9318(null,_0x8719e9);})[_0xc826('0x16')](function(_0x54c20b){_0x3b9318(_0x54c20b);});};AGIVertices[_0xc826('0x17')][_0xc826('0x84')]=function(_0x268e56,_0x761b4b){scripts[_0xc826('0x84')](this[_0xc826('0x10')][_0xc826('0x34')],_0x268e56[_0xc826('0x7f')],_0x268e56[_0xc826('0x85')],_0x268e56[_0xc826('0x86')],_0x268e56[_0xc826('0x56')],_0x268e56[_0xc826('0x87')])[_0xc826('0x14')](function(_0x554ee5){_0x761b4b(null,_0x554ee5);})['catch'](function(_0x34afe3){_0x761b4b(_0x34afe3);});};AGIVertices[_0xc826('0x17')]['googleASR']=function(_0x40b966,_0x133a5d,_0xd8ecba){scripts[_0xc826('0x88')](_0x133a5d,_0x40b966[_0xc826('0x72')],_0x40b966[_0xc826('0x89')]||'en-US')[_0xc826('0x14')](function(_0x2425c1){_0xd8ecba(null,_0x2425c1);})['catch'](function(_0x506df7){_0xd8ecba(_0x506df7);});};AGIVertices[_0xc826('0x17')][_0xc826('0x8a')]=function(_0x7dc484,_0x26d273,_0x5b3774){scripts[_0xc826('0x8a')](_0x26d273,_0x7dc484[_0xc826('0x8b')],_0x7dc484[_0xc826('0x8c')],_0x7dc484[_0xc826('0x68')])[_0xc826('0x14')](function(_0x1082bc){_0x5b3774(null,_0x1082bc);})[_0xc826('0x16')](function(_0x3813bf){_0x5b3774(_0x3813bf);});};AGIVertices[_0xc826('0x17')][_0xc826('0x8d')]=function(_0x5656b0){var _0x32dece=_[_0xc826('0x8e')](verticesWithRetry,_0x5656b0['agicommand'])?_0x5656b0:_['clone'](_0x5656b0);for(var _0x3c6734 in _0x32dece){if(_0x32dece[_0xc826('0x8f')](_0x3c6734)){if(_0x32dece[_0x3c6734]&&_[_0xc826('0x90')](_0x32dece[_0x3c6734])){if(_['includes'](recursiveMapAttributes,_0x3c6734)){_0x32dece[_0x3c6734]=this['replaceObjectAllVariables'](_0x32dece[_0x3c6734]);}else{_0x32dece[_0x3c6734]=this[_0xc826('0x91')](_0x32dece[_0x3c6734]);}}}}return _0x32dece;};AGIVertices['prototype'][_0xc826('0x92')]=function(_0x3c0d93){for(var _0x56abac in _0x3c0d93){if(_0x3c0d93[_0xc826('0x8f')](_0x56abac)){if(_[_0xc826('0x93')](_0x3c0d93[_0x56abac])){this[_0xc826('0x92')](_0x3c0d93[_0x56abac]);}else if(_[_0xc826('0x94')](_0x3c0d93[_0x56abac])){for(var _0x1d60b2=0x0;_0x1d60b2<_0x3c0d93[_0x56abac][_0xc826('0x95')];_0x1d60b2++){this['recursiveNodeIndex'](_0x3c0d93[_0x56abac][_0x1d60b2]);}}else if(_[_0xc826('0x90')](_0x3c0d93[_0x56abac])){_0x3c0d93[_0x56abac]=this[_0xc826('0x91')](_0x3c0d93[_0x56abac]);}}}};AGIVertices['prototype'][_0xc826('0x96')]=function(_0x110b9d,_0x104269){for(var _0x473a86 in _0x110b9d){if(_0x110b9d[_0xc826('0x8f')](_0x473a86)){if(_[_0xc826('0x93')](_0x110b9d[_0x473a86])){if(!_['isEmpty'](_0x110b9d[_0x473a86])){this[_0xc826('0x96')](_0x110b9d[_0x473a86],util[_0xc826('0x28')](_0xc826('0x97'),_0x104269,_0x473a86));}}else if(_[_0xc826('0x94')](_0x110b9d[_0x473a86])){for(var _0x10e5f6=0x0;_0x10e5f6<_0x110b9d[_0x473a86][_0xc826('0x95')];_0x10e5f6++){this['saveRestApiResult'](_0x110b9d[_0x473a86][_0x10e5f6],util[_0xc826('0x28')]('%s.%s',_0x104269,_0x473a86+'['+_0x10e5f6+']'));}}else{if(!_[_0xc826('0x43')](_0x110b9d[_0x473a86])){this[_0xc826('0x10')][_0xc826('0x98')](util[_0xc826('0x28')](_0xc826('0x97'),_0x104269,_0x473a86),_0x110b9d[_0x473a86]);}}}}};AGIVertices[_0xc826('0x17')][_0xc826('0x99')]=function(_0x57201f){try{var _0x1012c1=JSON[_0xc826('0x61')](_0x57201f);this[_0xc826('0x92')](_0x1012c1);return JSON['stringify'](_0x1012c1);}catch(_0x41f634){return this[_0xc826('0x91')](_0x57201f);}};AGIVertices[_0xc826('0x17')][_0xc826('0x91')]=function(_0x1fc587){var _0x4451db=_0x1fc587[_0xc826('0x9a')]('{');for(var _0x1f3fe6=0x1;_0x1f3fe6<_0x4451db[_0xc826('0x95')];_0x1f3fe6+=0x1){var _0x40655c=_0x4451db[_0x1f3fe6][_0xc826('0x9a')]('}');if(_0x40655c[_0xc826('0x95')]>0x1){_0x1fc587=_0x1fc587[_0xc826('0x9b')]('{'+_0x40655c[0x0]+'}',this[_0xc826('0x10')][_0xc826('0x13')](_0x40655c[0x0])[_0xc826('0x9c')]||_0x40655c[0x0]);}}if(_0x4451db[_0xc826('0x95')]===0x1){return _0x1fc587[_0xc826('0x48')]();}return this[_0xc826('0x91')](_0x1fc587);};AGIVertices[_0xc826('0x17')][_0xc826('0x9d')]=function(_0x4d9caa,_0x49bee8){var _0x209b8a=this[_0xc826('0x10')][_0xc826('0x13')](_0x4d9caa);if(_0x209b8a['result']===-0x1){return _0x209b8a;}logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x9e'),_0x49bee8,_0x209b8a[_0xc826('0x9c')]));return this[_0xc826('0x10')]['setVariable'](_0x49bee8,_0x209b8a[_0xc826('0x9c')]);};AGIVertices[_0xc826('0x17')][_0xc826('0x9f')]=function(_0x54c34d){return _0x54c34d&&_0x54c34d!=='0'&&_0x54c34d!=='-1'&&_0x54c34d!=='';};AGIVertices['prototype'][_0xc826('0xa0')]=function(_0x5375c4){this[_0xc826('0x33')]['sync'](this,_0x5375c4,'-');_0x5375c4[_0xc826('0xa1')]=_0x5375c4[_0xc826('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xc826('0xa2')]=function(_0x714795){logger[_0xc826('0x2d')](util[_0xc826('0x28')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x714795[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x714795[_0xc826('0x56')])){return this['channel'][_0xc826('0xa3')](_0xc826('0xa4'));}var _0x5a3265='\x22'+_0x714795[_0xc826('0x56')]+'\x22';if(this[_0xc826('0x9f')](_0x714795['options'])){_0x5a3265+=','+_0x714795[_0xc826('0x70')];}var _0x317a41=this[_0xc826('0x10')][_0xc826('0x52')]('MRCPSynth',_0x5a3265);if(_0x317a41[_0xc826('0xa5')]===-0x1){return _0x317a41;}return this[_0xc826('0x10')]['noop'](util['format'](_0xc826('0xa6'),_0x5a3265));};AGIVertices[_0xc826('0x17')][_0xc826('0xa7')]=function(_0x506892){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0xa8'),_0x506892[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x506892[_0xc826('0xa9')])){return this['channel'][_0xc826('0xa3')](_0xc826('0xaa'));}var _0x58e0ad=_0x506892[_0xc826('0xa9')];if(this['isConfigured'](_0x506892[_0xc826('0x70')])){_0x58e0ad+=','+_0x506892['options'];}var _0x4f4588=this[_0xc826('0x10')][_0xc826('0x52')](_0xc826('0xab'),_0x58e0ad);if(_0x4f4588['result']===-0x1){return _0x4f4588;}var _0x4518a1=this[_0xc826('0x9d')](_0xc826('0xac'),_0xc826('0xad'));if(_0x4518a1[_0xc826('0xa5')]===-0x1){return _0x4518a1;}var _0x5878eb=this[_0xc826('0x9d')]('RECOG_INPUT()',_0xc826('0xae'));if(_0x5878eb['result']===-0x1){return _0x5878eb;}var _0x39ec9a=this['getAndSetVariable']('RECOG_INSTANCE()',_0xc826('0xaf'));if(_0x39ec9a['result']===-0x1){return _0x39ec9a;}return this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x58e0ad));};AGIVertices[_0xc826('0x17')][_0xc826('0xb0')]=function(_0x56bff7){logger['info'](util[_0xc826('0x28')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x56bff7[_0xc826('0x35')]));return this['channel'][_0xc826('0xb0')]([_0x56bff7['command'],_0x56bff7[_0xc826('0xb1')]]);};AGIVertices[_0xc826('0x17')][_0xc826('0xb2')]=function(_0xeb292){logger[_0xc826('0x2d')](util['format'](_0xc826('0xb3'),_0xeb292[_0xc826('0x35')]));if(this[_0xc826('0x9f')](_0xeb292[_0xc826('0x5e')])){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0xb4'),_0xeb292['timeout']));var _0x306c18=this[_0xc826('0x10')][_0xc826('0xb5')](_0xeb292[_0xc826('0x5e')]);if(_0x306c18[_0xc826('0xa5')]===-0x1){return _0x306c18;}}return this[_0xc826('0x10')]['answer']();};AGIVertices[_0xc826('0x17')][_0xc826('0x47')]=function(_0x408a36){logger[_0xc826('0x2d')](util['format'](_0xc826('0xb6'),_0x408a36[_0xc826('0x35')]));if(!this['isConfigured'](_0x408a36[_0xc826('0x45')])){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x408a36,'no\x20list\x20selected');}_0x408a36[_0xc826('0x46')]=moment();if(this['isConfigured'](_0x408a36[_0xc826('0xb7')])){_0x408a36['scheduledAt']=moment()['add'](_0x408a36[_0xc826('0xb7')],_0xc826('0xb8'));}if(!this['isConfigured'](_0x408a36[_0xc826('0x49')])){_0x408a36[_0xc826('0x49')]=0x2;}this[_0xc826('0x3f')]['sync'](this,_0x408a36);return this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')](_0xc826('0xb9'),_0x408a36[_0xc826('0x44')],_0x408a36[_0xc826('0x45')],_0x408a36[_0xc826('0x46')]));};AGIVertices[_0xc826('0x17')][_0xc826('0xba')]=function(_0x138e2e){logger['info'](util[_0xc826('0x28')](_0xc826('0xbb'),_0x138e2e[_0xc826('0x35')]));var _0x32bd2d=this['channel'][_0xc826('0x52')](_0x138e2e[_0xc826('0xbc')],_0x138e2e[_0xc826('0x70')]);if(_0x32bd2d[_0xc826('0xa5')]===-0x1){return _0x32bd2d;}return this[_0xc826('0x10')][_0xc826('0xa3')](util['format'](_0xc826('0xbd'),_0x138e2e[_0xc826('0xbc')],_0x138e2e['options']));};AGIVertices[_0xc826('0x17')][_0xc826('0xbe')]=function(_0x21329e){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0xbf'),_0x21329e[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x21329e['text'])){return this[_0xc826('0x10')]['noop'](_0xc826('0xa4'));}var _0x5e2b75='\x22'+_0x21329e['text']+'\x22';if(this[_0xc826('0x9f')](_0x21329e[_0xc826('0x70')])){_0x5e2b75+=','+_0x21329e[_0xc826('0x70')];}var _0x465abf=this[_0xc826('0x10')][_0xc826('0x52')](_0xc826('0xc0'),_0x5e2b75);if(_0x465abf['result']===-0x1){return _0x465abf;}return this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')](_0xc826('0xa6'),_0x5e2b75));};AGIVertices[_0xc826('0x17')][_0xc826('0xc1')]=function(_0x3ce560){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0xc2'),_0x3ce560[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x3ce560[_0xc826('0x56')])){return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0xa4'));}var _0x1c6922='\x22'+_0x3ce560[_0xc826('0x56')]+'\x22';if(this['isConfigured'](_0x3ce560[_0xc826('0x70')])){_0x1c6922+=','+_0x3ce560['options'];}var _0x5c8878=this[_0xc826('0x10')][_0xc826('0x52')]('MRCPSynth',_0x1c6922);if(_0x5c8878[_0xc826('0xa5')]===-0x1){return _0x5c8878;}return this['channel']['noop'](util[_0xc826('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1c6922));};AGIVertices[_0xc826('0x17')][_0xc826('0xc3')]=function(_0x537c6b){logger[_0xc826('0x2d')](util['format'](_0xc826('0xc4'),_0x537c6b[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x537c6b[_0xc826('0xa9')])){return this[_0xc826('0x10')][_0xc826('0xa3')]('no\x20grammar\x20configured');}var _0x40ccc1=_0x537c6b[_0xc826('0xa9')];if(this[_0xc826('0x9f')](_0x537c6b[_0xc826('0x70')])){_0x40ccc1+=','+_0x537c6b[_0xc826('0x70')];}var _0x57eb3f=this[_0xc826('0x10')][_0xc826('0x52')]('MRCPRecog',_0x40ccc1);if(_0x57eb3f[_0xc826('0xa5')]===-0x1){return _0x57eb3f;}var _0x3f4b8e=this[_0xc826('0x9d')](_0xc826('0xac'),_0xc826('0xc5'));if(_0x3f4b8e[_0xc826('0xa5')]===-0x1){return _0x3f4b8e;}var _0x2b782a=this['getAndSetVariable']('RECOG_INPUT()',_0xc826('0xc6'));if(_0x2b782a[_0xc826('0xa5')]===-0x1){return _0x2b782a;}var _0x2b9039=this[_0xc826('0x9d')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x2b9039[_0xc826('0xa5')]===-0x1){return _0x2b9039;}return this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x40ccc1));};AGIVertices['prototype']['sestekasr']=function(_0x4895c0){logger['info'](util[_0xc826('0x28')](_0xc826('0xc7'),_0x4895c0[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x4895c0['grammar'])){return this[_0xc826('0x10')][_0xc826('0xa3')]('no\x20grammar\x20configured');}var _0x4c6829=_0x4895c0['grammar'];if(this[_0xc826('0x9f')](_0x4895c0[_0xc826('0x70')])){_0x4c6829+=','+_0x4895c0[_0xc826('0x70')];}var _0x4ada58=this[_0xc826('0x10')]['exec']('MRCPRecog',_0x4c6829);if(_0x4ada58[_0xc826('0xa5')]===-0x1){return _0x4ada58;}var _0x25c2bc=this[_0xc826('0x9d')](_0xc826('0xac'),_0xc826('0xc8'));if(_0x25c2bc['result']===-0x1){return _0x25c2bc;}var _0x540187=this[_0xc826('0x9d')](_0xc826('0xc9'),_0xc826('0xca'));if(_0x540187[_0xc826('0xa5')]===-0x1){return _0x540187;}var _0x2dc9cf=this[_0xc826('0x9d')](_0xc826('0xcb'),_0xc826('0xcc'));if(_0x2dc9cf['result']===-0x1){return _0x2dc9cf;}return this['channel'][_0xc826('0xa3')](util[_0xc826('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4c6829));};AGIVertices[_0xc826('0x17')][_0xc826('0xcd')]=function(_0x2a38e4){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0xce'),_0x2a38e4[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x2a38e4[_0xc826('0xcf')])){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x2a38e4,_0xc826('0xd0'));}var _0x1324e7=this['getSquareOdbc'][_0xc826('0x67')](this,_0x2a38e4[_0xc826('0xcf')]);if(!_0x1324e7){return this['channel'][_0xc826('0x2b')](_0x2a38e4,_0xc826('0xd1'));}if(!this[_0xc826('0x9f')](_0x2a38e4['query'])){return this['channel'][_0xc826('0x2b')](_0x2a38e4,_0xc826('0xd2'));}var _0x3c9a2c=_0x2a38e4[_0xc826('0x2c')][_0xc826('0x54')](/(\r\n|\n|\r)/gm,'\x20');this[_0xc826('0x10')][_0xc826('0xa3')](util['format'](_0xc826('0xd3'),_0x3c9a2c));var _0x49652a=this[_0xc826('0x29')][_0xc826('0x67')](this,_0x1324e7,_0x3c9a2c);this[_0xc826('0x33')][_0xc826('0x67')](this,_0x2a38e4,_0x3c9a2c);if(!this[_0xc826('0x9f')](_0x2a38e4[_0xc826('0xd4')])){return this['channel'][_0xc826('0xa3')](_0xc826('0xd5'));}var _0x71f57e=this[_0xc826('0x13')][_0xc826('0x67')](this,_0x2a38e4[_0xc826('0xd4')]);if(!_0x71f57e){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x2a38e4,_0xc826('0xd6'));}var _0x522647=this;_0x49652a['forEach'](function(_0x410949,_0x233ca1){Object[_0xc826('0xd7')](_0x410949)[_0xc826('0xd8')](function(_0xb2f3f9){_0x522647[_0xc826('0x10')][_0xc826('0x98')](util['format']('%s[%s][%s]',_0x71f57e,_0x233ca1,_0xb2f3f9),_0x410949[_0xb2f3f9]);});});this['channel'][_0xc826('0x98')](util[_0xc826('0x28')]('%s_ROWS_COUNT',_0x71f57e),_0x49652a[_0xc826('0x95')]);return this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')](_0xc826('0xd9'),_0x71f57e));};AGIVertices[_0xc826('0x17')][_0xc826('0xda')]=function(_0x26308e){logger[_0xc826('0xdb')](util[_0xc826('0x28')](_0xc826('0xdc'),_0x26308e[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x26308e['sip_id'])){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x26308e,'no\x20user\x20selected');}var _0x5b99db=this[_0xc826('0x1b')][_0xc826('0x67')](this,_0x26308e[_0xc826('0xdd')]);if(!_0x5b99db){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x26308e,'no\x20user\x20found');}var _0x27a10c=this['channel']['exec'](_0xc826('0xde'),[util[_0xc826('0x28')](_0xc826('0xdf'),_0x5b99db),_0x26308e['timeout'],_0x26308e[_0xc826('0xe0')],_0x26308e[_0xc826('0x5c')]]);if(_0x27a10c[_0xc826('0xa5')]===-0x1){return _0x27a10c;}return this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')](_0xc826('0xe1'),'DIAL'));};AGIVertices[_0xc826('0x17')]['dialogflow']=function(_0x3a6fed){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0xe2'),_0x3a6fed['label']));if(!this[_0xc826('0x9f')](_0x3a6fed[_0xc826('0x72')])){return this[_0xc826('0x10')][_0xc826('0xa3')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x3a6fed['text'])){return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0xa4'));}this['channel'][_0xc826('0xe3')]=!![];this[_0xc826('0x33')](_0x3a6fed);this[_0xc826('0x3e')](_0x3a6fed[_0xc826('0x56')],'in','','');this[_0xc826('0x10')][_0xc826('0xa3')](util['format'](_0xc826('0xe4'),_0x3a6fed[_0xc826('0x56')]));var _0x2d2adb=this['googleDialogflow'][_0xc826('0x67')](this,_0x3a6fed);if(_0x2d2adb){for(var _0x2166a9 in _0x2d2adb){if(_0x2d2adb[_0xc826('0x8f')](_0x2166a9)){this[_0xc826('0x10')][_0xc826('0x98')](util[_0xc826('0x28')]('DIALOGFLOW_%s',_0x2166a9[_0xc826('0xe5')]()),_0x2d2adb[_0x2166a9]);}}this[_0xc826('0x3e')](_0x2d2adb[_0xc826('0xe6')],_0xc826('0xe7'),_0xc826('0xe8'),'');return this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')]('Dialogflow\x20Result\x20%s',_0x2d2adb[_0xc826('0xe6')]));}return this[_0xc826('0x10')]['error'](_0x3a6fed,_0xc826('0xe9'));};AGIVertices[_0xc826('0x17')][_0xc826('0xea')]=function(_0x1bfe5d){logger[_0xc826('0x2d')](util['format'](_0xc826('0xeb'),_0x1bfe5d[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x1bfe5d[_0xc826('0x74')])){return this[_0xc826('0x10')]['noop'](_0xc826('0xec'));}if(!this[_0xc826('0x9f')](_0x1bfe5d[_0xc826('0x75')])){return this['channel'][_0xc826('0xa3')](_0xc826('0xed'));}if(!this[_0xc826('0x9f')](_0x1bfe5d[_0xc826('0x76')])){return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0xee'));}if(!this['isConfigured'](_0x1bfe5d[_0xc826('0x77')])){return this['channel']['noop'](_0xc826('0xef'));}if(!this[_0xc826('0x9f')](_0x1bfe5d['text'])){return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0xa4'));}this['channel'][_0xc826('0xe3')]=!![];this[_0xc826('0x33')](_0x1bfe5d);this[_0xc826('0x3e')](_0x1bfe5d[_0xc826('0x56')],'in','','');this['channel'][_0xc826('0xa3')](util[_0xc826('0x28')](_0xc826('0xf0'),_0x1bfe5d['text']));var _0x39571c=this[_0xc826('0x73')][_0xc826('0x67')](this,_0x1bfe5d);if(_0x39571c){for(var _0x5dd448 in _0x39571c){if(_0x39571c[_0xc826('0x8f')](_0x5dd448)){if(_0x5dd448!==_0xc826('0xf1')){this[_0xc826('0x10')][_0xc826('0x98')](util[_0xc826('0x28')](_0xc826('0xf2'),_0x5dd448['toUpperCase']()),_0x39571c[_0x5dd448]);}}}this[_0xc826('0x3e')](_0x39571c['speech'],_0xc826('0xe7'),_0xc826('0xea'),_0x39571c[_0xc826('0xf1')]);return this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')]('DialogflowV2\x20Result\x20%s',_0x39571c[_0xc826('0xe6')]));}return this[_0xc826('0x10')][_0xc826('0x2b')](_0x1bfe5d,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xc826('0x17')][_0xc826('0xf3')]=function(_0x15a6b3){logger['info'](util[_0xc826('0x28')](_0xc826('0xf4'),_0x15a6b3['label']));if(!this[_0xc826('0x9f')](_0x15a6b3[_0xc826('0xf5')])){return this['channel']['noop'](_0xc826('0xf6'));}if(!this[_0xc826('0x9f')](_0x15a6b3[_0xc826('0xf7')])){return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0xf8'));}if(!this[_0xc826('0x9f')](_0x15a6b3[_0xc826('0xf9')])){return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0xfa'));}if(!this['isConfigured'](_0x15a6b3[_0xc826('0xfb')])){return this[_0xc826('0x10')][_0xc826('0xa3')]('no\x20text\x20configured');}this['channel'][_0xc826('0xe3')]=!![];this[_0xc826('0x33')](_0x15a6b3);this[_0xc826('0x3e')](_0x15a6b3[_0xc826('0x56')],'in','','');this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')](_0xc826('0xfc'),_0x15a6b3[_0xc826('0x56')]));var _0xb60bd3=this[_0xc826('0x78')][_0xc826('0x67')](this,_0x15a6b3);if(_0xb60bd3){for(var _0x1d8b2f in _0xb60bd3){if(_0xb60bd3[_0xc826('0x8f')](_0x1d8b2f)){this[_0xc826('0x10')][_0xc826('0x98')](util['format']('SESTEK_NDA_%s',_0x1d8b2f[_0xc826('0xe5')]()),_0xb60bd3[_0x1d8b2f]);}}this['createSquareMessage'](_0xb60bd3[_0xc826('0xe6')],_0xc826('0xe7'),'sesteknda','');if(_0xb60bd3['audiofile']){this['channel']['noop'](util[_0xc826('0x28')]('Sestek\x20NDA\x20%s\x20file\x20created',_0xb60bd3['audiofile']));var _0x145401=this[_0xc826('0x10')][_0xc826('0xfd')](_0xb60bd3[_0xc826('0xfe')]);try{fs[_0xc826('0xff')](_0xb60bd3[_0xc826('0xfe')]+_0xc826('0x100'));}catch(_0x1530a2){logger[_0xc826('0x2b')](_0x1530a2);}return _0x145401;}else{return this[_0xc826('0x10')]['noop'](util[_0xc826('0x28')](_0xc826('0x101'),_0xb60bd3['speech']));}}return this[_0xc826('0x10')]['error'](_0x15a6b3,_0xc826('0x102'));};AGIVertices['prototype'][_0xc826('0x103')]=function(_0x109a68){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x104'),_0x109a68[_0xc826('0x35')]));return this[_0xc826('0x10')][_0xc826('0xa3')]('end');};AGIVertices[_0xc826('0x17')][_0xc826('0x105')]=function(_0x3dd866){logger[_0xc826('0x2d')](util['format'](_0xc826('0x106'),_0x3dd866['label']));var _0x41019a='';if(_0x3dd866['trunk_id']){if(!this[_0xc826('0x9f')](_0x3dd866[_0xc826('0x107')])){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x3dd866,'no\x20trunk\x20selected');}else{var _0x3e1b45=parseInt(_0x3dd866[_0xc826('0x107')],0xa);if(isNaN(_0x3e1b45)){_0x41019a=_0x3dd866[_0xc826('0x107')];}else{_0x41019a=this[_0xc826('0x108')][_0xc826('0x67')](this,_0x3dd866[_0xc826('0x107')]);if(!_0x41019a){return this[_0xc826('0x10')]['error'](_0x3dd866,_0xc826('0x109'));}}}}else if(_0x3dd866[_0xc826('0x10a')]){_0x41019a=_0x3dd866[_0xc826('0x10a')];}else{return this['channel'][_0xc826('0x2b')](_0x3dd866,_0xc826('0x10b'));}var _0x421f01=this[_0xc826('0x10')]['exec'](_0xc826('0xde'),[util[_0xc826('0x28')](_0xc826('0x10c'),_0x41019a,_0x3dd866['phone']),_0x3dd866[_0xc826('0x5e')],_0x3dd866[_0xc826('0xe0')],_0x3dd866['url']]);if(_0x421f01[_0xc826('0xa5')]===-0x1){return _0x421f01;}return this[_0xc826('0x10')][_0xc826('0xa3')](util['format'](_0xc826('0xe1'),_0xc826('0xde')));};AGIVertices[_0xc826('0x17')][_0xc826('0x10d')]=function(_0x3317f4){logger[_0xc826('0x2d')](util['format'](_0xc826('0x10e'),_0x3317f4['label']));return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0x10d'));};AGIVertices[_0xc826('0x17')][_0xc826('0xe')]=function(_0x44314d){logger['info'](util['format'](_0xc826('0x10f'),_0x44314d[_0xc826('0x35')]));if(_0x44314d[_0xc826('0xa1')]===0x0){return this[_0xc826('0xa0')](_0x44314d);}_0x44314d[_0xc826('0xa1')]-=0x1;if(!this['isConfigured'](_0x44314d[_0xc826('0x110')])){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x44314d,'no\x20file\x20audio\x20selected');}var _0x1bfaa7=this[_0xc826('0x111')][_0xc826('0x67')](this,_0x44314d[_0xc826('0x110')]);if(!_0x1bfaa7){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x44314d,'no\x20file\x20audio\x20found');}if(!this[_0xc826('0x9f')](_0x44314d[_0xc826('0xd4')])){return this[_0xc826('0x10')][_0xc826('0x2b')](_0xc826('0xd5'));}var _0x54845e=this[_0xc826('0x10')][_0xc826('0x112')](_0x1bfaa7,_0x44314d[_0xc826('0x113')],_0x44314d[_0xc826('0x114')]);var _0x436d34=_0x54845e[_0xc826('0xa5')]?_0x54845e[_0xc826('0xa5')]['toString']():'';logger[_0xc826('0x2d')](_0xc826('0x115'),JSON[_0xc826('0x6a')](_0x54845e));if(_0x54845e[_0xc826('0xa5')]===-0x1){this['createSquareDetailsReport'][_0xc826('0x67')](this,_0x44314d,_0x436d34);return _0x54845e;}else if(_0x54845e[_0xc826('0x9c')]===_0xc826('0x5e')){_0x54845e['result']=_0x436d34[_0xc826('0x95')]>=parseInt(_0x44314d['mindigit'])?'x':'i';}else{_0x54845e[_0xc826('0xa5')]=_0x436d34[_0xc826('0x95')]>=parseInt(_0x44314d['mindigit'])&&_0x436d34[_0xc826('0x95')]<=parseInt(_0x44314d[_0xc826('0x114')])?'x':'i';}var _0x2deb3c=this[_0xc826('0x13')][_0xc826('0x67')](this,_0x44314d[_0xc826('0xd4')]);if(!_0x2deb3c){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x44314d,_0xc826('0xd6'));}this[_0xc826('0x10')]['setVariable'](_0x2deb3c,_0x436d34);if(this[_0xc826('0x9f')](_0x44314d[_0xc826('0x116')])){var _0xce0057=parseInt(_0x44314d[_0xc826('0x116')],0xa);var _0x565410=rs['generate']({'charset':'*','length':_0xce0057});var _0x3eaaa7=_0x436d34['length'];if(_0x3eaaa7>0x0){if(_0x3eaaa7>_0xce0057){this[_0xc826('0x33')]['sync'](this,_0x44314d,_0x44314d[_0xc826('0x117')]===_0xc826('0x118')?_0x565410+_0x436d34[_0xc826('0x119')](_0xce0057):_0x436d34['substr'](0x0,_0x3eaaa7-_0xce0057)+_0x565410);}else{this[_0xc826('0x33')]['sync'](this,_0x44314d,rs[_0xc826('0x11a')]({'charset':'*','length':_0x3eaaa7}));}}else{this[_0xc826('0x33')][_0xc826('0x67')](this,_0x44314d,'');}}else{this[_0xc826('0x33')]['sync'](this,_0x44314d,_0x436d34);}return _0x54845e;};AGIVertices[_0xc826('0x17')]['getsecretdigits']=function(_0x5677f2){logger['info'](util[_0xc826('0x28')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x5677f2[_0xc826('0x35')]));return this[_0xc826('0xe')](_0x5677f2);};AGIVertices[_0xc826('0x17')]['goal']=function(_0x8836ad){logger[_0xc826('0x2d')](util[_0xc826('0x28')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x8836ad[_0xc826('0x35')]));this['createSquareDetailsReport'][_0xc826('0x67')](this,_0x8836ad,_0x8836ad['goalname']);return this['channel'][_0xc826('0xa3')](util[_0xc826('0x28')](_0xc826('0x11b'),_0x8836ad[_0xc826('0x11c')]));};AGIVertices[_0xc826('0x17')][_0xc826('0x11d')]=function(_0x573cbe){logger[_0xc826('0x2d')](util[_0xc826('0x28')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x573cbe[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x573cbe['aws_access_key_id'])||!this[_0xc826('0x9f')](_0x573cbe[_0xc826('0x85')])){return this[_0xc826('0x10')][_0xc826('0xa3')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xc826('0x9f')](_0x573cbe['text'])){return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0xa4'));}this[_0xc826('0x10')]['noop'](util['format']('Trying\x20aws\x20Polly\x20%s',_0x573cbe[_0xc826('0x56')]));var _0xd8fb49=this[_0xc826('0x7e')]['sync'](this,_0x573cbe);if(_0xd8fb49){this['channel'][_0xc826('0xa3')](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0xd8fb49));var _0xc7c267=this[_0xc826('0x10')][_0xc826('0xfd')](_0xd8fb49);try{fs[_0xc826('0xff')](_0xd8fb49+_0xc826('0x100'));}catch(_0x45215a){logger['error'](_0x45215a);}return _0xc7c267;}return this['channel'][_0xc826('0x2b')](_0x573cbe,_0xc826('0x11e'));};AGIVertices[_0xc826('0x17')][_0xc826('0x11f')]=function(_0x4ebac5){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x120'),_0x4ebac5[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x4ebac5['aws_access_key_id'])||!this[_0xc826('0x9f')](_0x4ebac5[_0xc826('0x85')])){return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0x121'));}if(!this[_0xc826('0x9f')](_0x4ebac5[_0xc826('0x87')])){return this[_0xc826('0x10')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0xc826('0x9f')](_0x4ebac5[_0xc826('0x56')])){return this[_0xc826('0x10')]['noop']('no\x20text\x20configured');}this[_0xc826('0x10')]['bot']=!![];this[_0xc826('0x33')](_0x4ebac5);this[_0xc826('0x3e')](_0x4ebac5['text'],'in','','');this[_0xc826('0x10')]['noop'](util[_0xc826('0x28')]('Trying\x20Amazon\x20Lex:\x20%s',_0x4ebac5[_0xc826('0x56')]));var _0x5c49fa=this['awsLex']['sync'](this,_0x4ebac5);if(_0x5c49fa){for(var _0x29f008 in _0x5c49fa){if(_0x5c49fa['hasOwnProperty'](_0x29f008)&&_['isString'](_0x5c49fa[_0x29f008])){this['channel'][_0xc826('0x98')](util['format'](_0xc826('0x122'),_0x29f008[_0xc826('0xe5')]()),_0x5c49fa[_0x29f008]);}}if(_['isNil'](_0x5c49fa[_0xc826('0x6e')])){return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0x123'));}else{this['createSquareMessage'](_0x5c49fa[_0xc826('0x6e')],_0xc826('0xe7'),_0xc826('0x124'),'');return this['channel'][_0xc826('0xa3')](util[_0xc826('0x28')]('Amazon\x20Lex\x20Result\x20%s',_0x5c49fa[_0xc826('0x6e')]));}}return this[_0xc826('0x10')][_0xc826('0x2b')](_0x4ebac5,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xc826('0x17')][_0xc826('0x125')]=function(_0x322915){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x126'),_0x322915[_0xc826('0x35')],_0x322915['timeout']));if(!this[_0xc826('0x9f')](_0x322915[_0xc826('0x72')])){return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0x127'));}var _0x9491ca='wav';var _0x7a62e6=util[_0xc826('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0xc826('0x11a')](0x4));var _0x551543=util['format'](_0xc826('0x97'),_0x7a62e6,_0x9491ca);var _0x4e26dc=!![];if(_0x322915[_0xc826('0x128')]===_0xc826('0x129')){_0x4e26dc=![];}var _0xc86388=this[_0xc826('0x10')][_0xc826('0x12a')](_0x7a62e6,_0x9491ca,_0x322915['intKey'],_0x322915[_0xc826('0x5e')],undefined,_0x4e26dc);if(_0xc86388[_0xc826('0xa5')]!==-0x1){this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')](_0xc826('0x12b'),_0x551543));var _0x1ace47=this[_0xc826('0x88')][_0xc826('0x67')](this,_0x322915,_0x551543);if(_0x1ace47){for(var _0x5395f0 in _0x1ace47){if(_0x1ace47['hasOwnProperty'](_0x5395f0)){this[_0xc826('0x10')][_0xc826('0x98')](util[_0xc826('0x28')](_0xc826('0x12c'),_0x5395f0[_0xc826('0xe5')]()),_0x1ace47[_0x5395f0]);}}return this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')](_0xc826('0x12d'),JSON[_0xc826('0x6a')](_0x1ace47)));}}return _0xc86388;};AGIVertices[_0xc826('0x17')]['tildeasr']=function(_0x6ee68e){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x12e'),_0x6ee68e[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x6ee68e[_0xc826('0x8b')])){return this['channel']['noop'](_0xc826('0x12f'));}if(!this[_0xc826('0x9f')](_0x6ee68e[_0xc826('0x8c')])){return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0x130'));}var _0x4afd6f=_0xc826('0x131');var _0x496103=util[_0xc826('0x28')](_0xc826('0x132'),FILES_PATH,rs[_0xc826('0x11a')](0x4));var _0x4413c4=util[_0xc826('0x28')](_0xc826('0x97'),_0x496103,_0x4afd6f);var _0x390412=!![];if(_0x6ee68e[_0xc826('0x128')]===_0xc826('0x129')){_0x390412=![];}var _0x586d67=this[_0xc826('0x10')][_0xc826('0x12a')](_0x496103,_0x4afd6f,_0x6ee68e['intKey'],_0x6ee68e[_0xc826('0x5e')],undefined,_0x390412);if(_0x586d67[_0xc826('0xa5')]!==-0x1){this[_0xc826('0x10')][_0xc826('0xa3')](util['format']('tilde\x20%s\x20file\x20created',_0x4413c4));var _0x4e1a6a=this[_0xc826('0x8a')]['sync'](this,_0x6ee68e,_0x4413c4);if(_0x4e1a6a){for(var _0x1e99a5 in _0x4e1a6a){if(_0x4e1a6a[_0xc826('0x8f')](_0x1e99a5)){this[_0xc826('0x10')][_0xc826('0x98')](util[_0xc826('0x28')](_0xc826('0x133'),_0x1e99a5[_0xc826('0xe5')]()),_0x4e1a6a[_0x1e99a5]);}}return this['channel'][_0xc826('0xa3')](util[_0xc826('0x28')]('TildeASR\x20Result\x20%s',JSON[_0xc826('0x6a')](_0x4e1a6a)));}}return _0x586d67;};AGIVertices[_0xc826('0x17')][_0xc826('0x134')]=function(_0x17ffa5){logger['info'](util[_0xc826('0x28')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x17ffa5[_0xc826('0x35')]));return this[_0xc826('0x10')][_0xc826('0x135')](_0x17ffa5[_0xc826('0x3a')],_0x17ffa5[_0xc826('0x3b')],_0x17ffa5[_0xc826('0x3c')]);};AGIVertices[_0xc826('0x17')]['gotoif']=function(_0x2a68e5){logger[_0xc826('0x2d')](util['format'](_0xc826('0x136'),_0x2a68e5[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x2a68e5[_0xc826('0x137')])){return this['channel'][_0xc826('0x2b')](_0x2a68e5,'no\x20condition\x20configured');}try{var _0x22fc14=eval(_0x2a68e5[_0xc826('0x137')])?_0xc826('0x138'):_0xc826('0x139');this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')](_0xc826('0x13a'),_0x2a68e5[_0xc826('0x137')],_0x22fc14));return{'code':0xc8,'result':_0x22fc14};}catch(_0x45c9fc){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xc826('0x17')]['gotoiftime']=function(_0x3a95d0){logger[_0xc826('0x2d')](util['format'](_0xc826('0x13b'),_0x3a95d0[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x3a95d0[_0xc826('0x13c')])){return this['channel'][_0xc826('0x2b')](_0x3a95d0,'no\x20interval\x20configured');}var _0x308977=this[_0xc826('0x13d')][_0xc826('0x67')](this,_0x3a95d0[_0xc826('0x13c')]);if(!_0x308977){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x3a95d0,'no\x20intervals\x20found');}for(var _0x46ce2f=0x0;_0x46ce2f<_0x308977[_0xc826('0x95')];_0x46ce2f+=0x1){var _0x5ee06a=this[_0xc826('0x10')][_0xc826('0x13')](util['format'](_0xc826('0x13e'),_0x308977[_0x46ce2f]));if(_0x5ee06a[_0xc826('0xa5')]===-0x1){return _0x5ee06a;}logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x13f'),_0x308977[_0x46ce2f],_0x5ee06a['extra']));if(_0x5ee06a[_0xc826('0x9c')]==='true'){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x13f'),_0x308977[_0x46ce2f],_0xc826('0x138')));this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')]('IFTIME\x20%s\x20%s',_0x308977[_0x46ce2f],_0xc826('0x138')));return{'code':0xc8,'result':_0xc826('0x138')};}else{logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x13f'),_0x308977[_0x46ce2f],_0xc826('0x139')));this[_0xc826('0x10')][_0xc826('0xa3')](util['format'](_0xc826('0x13f'),_0x308977[_0x46ce2f],'false'));}}return{'code':0xc8,'result':_0xc826('0x139')};};AGIVertices[_0xc826('0x17')][_0xc826('0x140')]=function(_0x1304d7){logger['info'](util[_0xc826('0x28')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x1304d7[_0xc826('0x35')]));return this['channel'][_0xc826('0x140')]();};AGIVertices[_0xc826('0x17')][_0xc826('0x141')]=function(_0x5989ee){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x142'),_0x5989ee[_0xc826('0x35')]));if(!this['isConfigured'](_0x5989ee[_0xc826('0x72')])){return this['channel']['noop'](_0xc826('0x127'));}var _0x49e814=_0xc826('0x131');var _0x6e51e5=util[_0xc826('0x28')](_0xc826('0x132'),FILES_PATH,rs[_0xc826('0x11a')](0x4));var _0x58b433=util['format'](_0xc826('0x97'),_0x6e51e5,_0x49e814);var _0x44cc15=!![];if(_0x5989ee[_0xc826('0x128')]===_0xc826('0x129')){_0x44cc15=![];}var _0x3ac9ea=this[_0xc826('0x10')][_0xc826('0x12a')](_0x6e51e5,_0x49e814,_0x5989ee['intKey'],_0x5989ee['timeout'],undefined,_0x44cc15);if(_0x3ac9ea[_0xc826('0xa5')]!==-0x1){this['channel'][_0xc826('0xa3')](util['format'](_0xc826('0x143'),_0x58b433));var _0x218d11=this[_0xc826('0x7b')][_0xc826('0x67')](this,_0x5989ee,_0x58b433);if(_0x218d11){for(var _0x1903ee in _0x218d11){if(_0x218d11[_0xc826('0x8f')](_0x1903ee)){this[_0xc826('0x10')][_0xc826('0x98')](util['format'](_0xc826('0x144'),_0x1903ee['toUpperCase']()),_0x218d11[_0x1903ee]);}}return this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x218d11)));}}return _0x3ac9ea;};AGIVertices[_0xc826('0x17')][_0xc826('0x145')]=function(_0x15cfed){logger['info'](util[_0xc826('0x28')](_0xc826('0x146'),_0x15cfed[_0xc826('0x35')]));if(!this['isConfigured'](_0x15cfed['key'])){return this['channel'][_0xc826('0xa3')]('no\x20key\x20configured');}if(!this[_0xc826('0x9f')](_0x15cfed[_0xc826('0x56')])){return this[_0xc826('0x10')][_0xc826('0xa3')]('no\x20text\x20configured');}this[_0xc826('0x10')]['noop'](util[_0xc826('0x28')](_0xc826('0x147'),_0x15cfed[_0xc826('0x56')]));var _0x1c991f=this[_0xc826('0x79')][_0xc826('0x67')](this,_0x15cfed);if(_0x1c991f){this[_0xc826('0x10')]['noop'](util[_0xc826('0x28')](_0xc826('0x143'),_0x1c991f));var _0x1dbb6=this[_0xc826('0x10')][_0xc826('0xfd')](_0x1c991f,_0x15cfed['intKey']);try{fs['unlink'](_0x1c991f+_0xc826('0x100'));}catch(_0x4ba26c){logger[_0xc826('0x2b')](_0x4ba26c);}return _0x1dbb6;}return this[_0xc826('0x10')]['error'](_0x15cfed,_0xc826('0x148'));};AGIVertices[_0xc826('0x17')][_0xc826('0x149')]=function(_0x605625){logger[_0xc826('0x2d')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x605625['label']));if(!this[_0xc826('0x9f')](_0x605625[_0xc826('0x14a')])){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x605625,_0xc826('0x14b'));}logger[_0xc826('0x2d')](util[_0xc826('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xc826('0x10')]['callerid'],_0x605625[_0xc826('0x14a')]));var _0x6e1559=this[_0xc826('0x14c')]['sync'](this,_0x605625[_0xc826('0x14a')]);if(_0x6e1559){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x14d'),this[_0xc826('0x10')][_0xc826('0x38')],_0x605625[_0xc826('0x14a')]));this[_0xc826('0x10')]['noop'](util['format'](_0xc826('0x14d'),this[_0xc826('0x10')][_0xc826('0x38')],_0x605625[_0xc826('0x14a')]));return{'code':0xc8,'result':_0xc826('0x14e')};}else{logger[_0xc826('0x2d')](util['format'](_0xc826('0x14f'),this[_0xc826('0x10')][_0xc826('0x38')],_0x605625['findBy']));this['channel'][_0xc826('0xa3')](util[_0xc826('0x28')](_0xc826('0x14f'),this[_0xc826('0x10')][_0xc826('0x38')],_0x605625[_0xc826('0x14a')]));return{'code':0xc8,'result':_0xc826('0x150')};}};AGIVertices[_0xc826('0x17')][_0xc826('0x151')]=function(_0x3ff454){logger['info'](util[_0xc826('0x28')](_0xc826('0x152'),_0x3ff454[_0xc826('0x35')]));if(!this['isConfigured'](_0x3ff454[_0xc826('0x14a')])){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x3ff454,_0xc826('0x14b'));}logger['info'](util[_0xc826('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xc826('0x38')],_0x3ff454['findBy']));var _0x4be443=this[_0xc826('0x4e')][_0xc826('0x67')](this,_0x3ff454[_0xc826('0x14a')]);if(_0x4be443){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x14d'),this['channel'][_0xc826('0x38')],_0x3ff454[_0xc826('0x14a')]));this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')](_0xc826('0x14d'),this['channel'][_0xc826('0x38')],_0x3ff454[_0xc826('0x14a')]));return{'code':0xc8,'result':_0xc826('0x14e')};}else{logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x14f'),this[_0xc826('0x10')]['callerid'],_0x3ff454[_0xc826('0x14a')]));this[_0xc826('0x10')]['noop'](util[_0xc826('0x28')](_0xc826('0x14f'),this[_0xc826('0x10')]['callerid'],_0x3ff454[_0xc826('0x14a')]));return{'code':0xc8,'result':_0xc826('0x150')};}};AGIVertices['prototype'][_0xc826('0x153')]=function(_0x365120){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x154'),_0x365120[_0xc826('0x35')]));if(!this['isConfigured'](_0x365120[_0xc826('0x155')])){return this['channel']['error'](_0x365120,_0xc826('0x156'));}this[_0xc826('0x10')]['noop'](util[_0xc826('0x28')](_0xc826('0x157'),_0x365120[_0xc826('0x155')]));var _0x350a23=eval(_0x365120[_0xc826('0x155')]);if(!this[_0xc826('0x9f')](_0x365120[_0xc826('0xd4')])){return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0xd5'));}var _0x30aa64=this[_0xc826('0x13')]['sync'](this,_0x365120[_0xc826('0xd4')]);if(!_0x30aa64){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x365120,'no\x20variable\x20found');}if(_['isArray'](_0x350a23)){var _0x3ace25=this;_0x350a23[_0xc826('0xd8')](function(_0x542e7e,_0xf9d0c6){_0x3ace25[_0xc826('0x10')]['setVariable'](util[_0xc826('0x28')]('%s[%s]',_0x30aa64,_0xf9d0c6),_0x542e7e);});return this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')]('variable\x20%s[key]\x20set',_0x30aa64));}else{return this[_0xc826('0x10')][_0xc826('0x98')](_0x30aa64,_0x350a23);}};AGIVertices['prototype'][_0xc826('0xd')]=function(_0x1224fb){logger[_0xc826('0x2d')](util['format'](_0xc826('0x158'),_0x1224fb[_0xc826('0x35')]));if(_0x1224fb[_0xc826('0xa1')]===0x0){return this['maxRetry'](_0x1224fb);}_0x1224fb['retry']-=0x1;if(!this[_0xc826('0x9f')](_0x1224fb['file_id'])){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x1224fb,'no\x20file\x20audio\x20selected');}var _0x39e5bb=this[_0xc826('0x111')][_0xc826('0x67')](this,_0x1224fb[_0xc826('0x110')]);if(!_0x39e5bb){return this[_0xc826('0x10')]['error'](_0x1224fb,_0xc826('0x159'));}var _0x20bc3f=this[_0xc826('0x10')][_0xc826('0x112')](_0x39e5bb,_0x1224fb[_0xc826('0x113')],_0x1224fb['digit']);var _0x562317=_0x20bc3f['result'];if(_0x20bc3f[_0xc826('0xa5')]===-0x1){this[_0xc826('0x33')][_0xc826('0x67')](this,_0x1224fb,'-1');return _0x20bc3f;}else if(_0x20bc3f[_0xc826('0x9c')]===_0xc826('0x5e')){_0x20bc3f[_0xc826('0xa5')]=_0x20bc3f[_0xc826('0xa5')][_0xc826('0x95')]>0x0?_0x20bc3f[_0xc826('0xa5')]:'t';}else if(_[_0xc826('0x40')](_0x20bc3f[_0xc826('0xa5')])){_0x20bc3f[_0xc826('0xa5')]='#';_0x562317='#';}if(!this[_0xc826('0x9f')](_0x1224fb[_0xc826('0xd4')])){this[_0xc826('0x10')]['noop'](_0xc826('0xd5'));}else{var _0x5c2ada=this[_0xc826('0x13')][_0xc826('0x67')](this,_0x1224fb[_0xc826('0xd4')]);if(!_0x5c2ada){return this[_0xc826('0x10')]['error'](_0x1224fb,_0xc826('0xd6'));}this['channel'][_0xc826('0x98')](_0x5c2ada,_0x562317);}this[_0xc826('0x33')][_0xc826('0x67')](this,_0x1224fb,_0x562317);return _0x20bc3f;};AGIVertices['prototype']['noop']=function(_0x93acf6){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x15a'),_0x93acf6[_0xc826('0x35')]));return this['channel'][_0xc826('0xa3')](_0x93acf6['output']||_0x93acf6[_0xc826('0x35')]);};AGIVertices[_0xc826('0x17')][_0xc826('0x15b')]=function(_0x3c19cf){logger['info'](util[_0xc826('0x28')](_0xc826('0x15c'),_0x3c19cf[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x3c19cf[_0xc826('0x14a')])){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x3c19cf,_0xc826('0x14b'));}logger['info'](util[_0xc826('0x28')](_0xc826('0x15d'),this['channel'][_0xc826('0x38')],_0x3c19cf[_0xc826('0x14a')]));var _0x16d028=this['getPause'][_0xc826('0x67')](this,_0x3c19cf[_0xc826('0x15e')]);var _0x565c5d=this[_0xc826('0x4d')][_0xc826('0x67')](this,_0x3c19cf[_0xc826('0x14a')],_0x16d028);if(_0x565c5d){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x14d'),this['channel'][_0xc826('0x38')],_0x3c19cf[_0xc826('0x14a')]));this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc826('0x10')]['callerid'],_0x3c19cf['findBy']));return{'code':0xc8,'result':_0xc826('0x14e')};}else{logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x14f'),this[_0xc826('0x10')][_0xc826('0x38')],_0x3c19cf[_0xc826('0x14a')]));this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x3c19cf[_0xc826('0x14a')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xc826('0x17')][_0xc826('0x15f')]=function(_0x16e0d4){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x160'),_0x16e0d4[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x16e0d4[_0xc826('0x110')])){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x16e0d4,_0xc826('0x161'));}var _0x35840d=this[_0xc826('0x111')]['sync'](this,_0x16e0d4[_0xc826('0x110')]);if(!_0x35840d){return this['channel'][_0xc826('0x2b')](_0x16e0d4,_0xc826('0x159'));}var _0x2a239b=this[_0xc826('0x10')]['exec'](_0xc826('0x162'),[_0x35840d,_0x16e0d4[_0xc826('0xe0')]]);if(_0x2a239b[_0xc826('0xa5')]===-0x1){return _0x2a239b;}return this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')](_0xc826('0xbd'),_0xc826('0x162'),_0x35840d));};AGIVertices[_0xc826('0x17')][_0xc826('0x163')]=function(_0x18478b){logger['info'](util[_0xc826('0x28')](_0xc826('0x164'),_0x18478b[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x18478b[_0xc826('0x165')])){return this[_0xc826('0x10')]['error'](_0x18478b,'no\x20queue\x20selected');}var _0x227ee9='';var _0x51e3ac=parseInt(_0x18478b[_0xc826('0x165')],0xa);if(isNaN(_0x51e3ac)){_0x227ee9=_0x18478b[_0xc826('0x165')];}else{_0x227ee9=this[_0xc826('0x166')][_0xc826('0x67')](this,_0x18478b[_0xc826('0x165')]);if(!_0x227ee9){return this[_0xc826('0x10')]['error'](_0x18478b,_0xc826('0x167'));}}var _0x22a645='';if(this['isConfigured'](_0x18478b[_0xc826('0x110')])){var _0x494e30=this[_0xc826('0x111')][_0xc826('0x67')](this,_0x18478b[_0xc826('0x110')]);if(_0x494e30){_0x22a645=_0x494e30;}}this['createSquareDetailsReport'][_0xc826('0x67')](this,_0x18478b,_0x227ee9);if(_0x18478b['opts'][_0xc826('0x168')]('x')<0x0){_0x18478b[_0xc826('0xe0')]+='x';}if(_0x18478b[_0xc826('0xe0')][_0xc826('0x168')]('X')<0x0){_0x18478b['opts']+='X';}this[_0xc826('0x10')][_0xc826('0x98')](_0xc826('0x169'),_0x227ee9?_0x227ee9[_0xc826('0x16a')]():'');var _0x5bf52a=this['channel'][_0xc826('0x52')](_0xc826('0x16b'),[_0x227ee9,_0x18478b[_0xc826('0xe0')],_0x18478b[_0xc826('0x5c')],_0x22a645,_0x18478b['timeout'],_0x18478b[_0xc826('0xb0')],_0x18478b[_0xc826('0x16c')],_0x18478b[_0xc826('0x16d')],'',_0x18478b[_0xc826('0x16e')]]);if(_0x5bf52a[_0xc826('0xa5')]===-0x1){return _0x5bf52a;}return this[_0xc826('0x10')][_0xc826('0xa3')](util['format']('Executed\x20command\x20%s\x20%s',_0xc826('0x16b'),_0x227ee9));};AGIVertices['prototype'][_0xc826('0x16f')]=function(_0x13bb2c){logger['info'](util[_0xc826('0x28')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x13bb2c[_0xc826('0x35')]));var _0x38bf13=_0x13bb2c[_0xc826('0x170')]||_0xc826('0x131');var _0x4d0422=util[_0xc826('0x28')]('%s_%s',this[_0xc826('0x10')]['uniqueid'],rs[_0xc826('0x11a')](0x5));var _0x1ebc27=util[_0xc826('0x28')](_0xc826('0x171'),FILES_PATH,_0x4d0422,_0x38bf13);var _0x28b4cf=util[_0xc826('0x28')]('%s/recordings/%s',FILES_PATH,_0x4d0422);this[_0xc826('0x37')]['sync'](this,_0x13bb2c,_0x4d0422,_0x1ebc27);this[_0xc826('0x10')][_0xc826('0x98')]('RECORDING_SAVENAME',_0x4d0422);logger['info'](_0xc826('0x172'),_0x28b4cf,_0x38bf13,_0x13bb2c[_0xc826('0x173')],_0x13bb2c['timeout']);return this['channel'][_0xc826('0x12a')](_0x28b4cf,_0x38bf13,_0x13bb2c[_0xc826('0x173')],_0x13bb2c[_0xc826('0x5e')],undefined,!![]);};AGIVertices[_0xc826('0x17')][_0xc826('0x174')]=function(_0x12a2d9){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x175'),_0x12a2d9[_0xc826('0x35')]));if(!this['isConfigured'](_0x12a2d9[_0xc826('0x5c')])){return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0x176'));}var _0xbba60c=this[_0xc826('0x5b')][_0xc826('0x67')](this,_0x12a2d9);logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x177'),util[_0xc826('0x178')](_0xbba60c,{'showHidden':![],'depth':null})));if(!this[_0xc826('0x9f')](_0x12a2d9[_0xc826('0xd4')])){return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0x179'));}var _0x2fb4b6=this[_0xc826('0x13')][_0xc826('0x67')](this,_0x12a2d9[_0xc826('0xd4')]);if(!_0x2fb4b6){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x12a2d9,'no\x20variable\x20found');}this[_0xc826('0x10')][_0xc826('0x98')](util[_0xc826('0x28')](_0xc826('0x17a'),_0x2fb4b6),_0xbba60c['statusCode']?_0xbba60c[_0xc826('0x6d')]:'200');this['channel'][_0xc826('0x98')](util[_0xc826('0x28')](_0xc826('0x17b'),_0x2fb4b6),_0xbba60c['statusMessage']?_0xbba60c[_0xc826('0x17c')]:'OK');if(_0xbba60c[_0xc826('0x6b')]){try{this[_0xc826('0x96')](_0xbba60c[_0xc826('0x6b')],_0x2fb4b6);}catch(_0xab7c54){logger[_0xc826('0x2b')](util['format'](_0xc826('0x17d'),_0x2fb4b6));}}return this[_0xc826('0x10')]['noop'](util[_0xc826('0x28')](_0xc826('0xd9'),_0x2fb4b6));};AGIVertices[_0xc826('0x17')]['saydigits']=function(_0x3341a5){logger['info'](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x3341a5['label']));return this[_0xc826('0x10')][_0xc826('0x17e')](_0x3341a5[_0xc826('0x17f')][_0xc826('0x54')](/\s+/g,''),_0x3341a5[_0xc826('0x173')]);};AGIVertices[_0xc826('0x17')][_0xc826('0x180')]=function(_0x3aaf55){logger['info'](util['format'](_0xc826('0x181'),_0x3aaf55[_0xc826('0x35')]));return this[_0xc826('0x10')][_0xc826('0x182')](_0x3aaf55[_0xc826('0x5f')][_0xc826('0x54')](/\s+/g,''),_0x3aaf55[_0xc826('0x173')]);};AGIVertices[_0xc826('0x17')][_0xc826('0x183')]=function(_0x44a458){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x184'),_0x44a458[_0xc826('0x35')]));return this[_0xc826('0x10')][_0xc826('0x185')](_0x44a458[_0xc826('0x56')],_0x44a458[_0xc826('0x173')]);};AGIVertices[_0xc826('0x17')][_0xc826('0x186')]=function(_0x2cba34){logger['info'](util['format'](_0xc826('0x187'),_0x2cba34[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x2cba34['account_id'])){return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0x188'));}var _0x3399bf=this['getMailAccount'][_0xc826('0x67')](this,_0x2cba34[_0xc826('0x189')]);if(!_0x3399bf||!_0x3399bf[_0xc826('0x18a')]){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x2cba34,_0xc826('0x18b'));}var _0x2c8d11={'from':util[_0xc826('0x28')](_0xc826('0x18c'),_0x3399bf[_0xc826('0x15')],_0x3399bf[_0xc826('0x18d')]||_0x3399bf[_0xc826('0x18a')][_0xc826('0x18e')]),'to':_0x2cba34['to']||'','cc':_0x2cba34['cc']||'','bcc':_0x2cba34[_0xc826('0x18f')]||'','subject':_0x2cba34[_0xc826('0x190')],'html':_0x2cba34[_0xc826('0x56')],'text':_0x2cba34[_0xc826('0x56')]};var _0x23a7ac={'tls':{'rejectUnauthorized':![]}};if(_0x3399bf[_0xc826('0x18a')][_0xc826('0x191')]){_0x23a7ac['service']=_0x3399bf[_0xc826('0x18a')][_0xc826('0x191')];}else{_0x23a7ac['host']=_0x3399bf[_0xc826('0x18a')][_0xc826('0x192')];_0x23a7ac['port']=_0x3399bf[_0xc826('0x18a')][_0xc826('0x193')];_0x23a7ac[_0xc826('0x194')]=_0x3399bf[_0xc826('0x18a')][_0xc826('0x194')];}if(_0x3399bf['Smtp'][_0xc826('0x195')]){_0x23a7ac['auth']={'user':_0x3399bf[_0xc826('0x18a')][_0xc826('0x18e')],'pass':_0x3399bf[_0xc826('0x18a')]['pass']};}if(this['isConfigured'](_0x2cba34[_0xc826('0x196')])){}logger[_0xc826('0xdb')](_0xc826('0x197'),JSON[_0xc826('0x6a')](_0x2c8d11));this['createSquareDetailsReport']['sync'](this,_0x2cba34,_0x2cba34[_0xc826('0x189')]);this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')](_0xc826('0x198'),_0x3399bf[_0xc826('0x15')]));this[_0xc826('0x23')][_0xc826('0x67')](this,_0x23a7ac,_0x2c8d11);return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0x199'));};AGIVertices['prototype']['sendFax']=function(_0x1f3d5b){logger['info'](util[_0xc826('0x28')](_0xc826('0x19a'),_0x1f3d5b[_0xc826('0x35')]));return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0x19b'));};AGIVertices[_0xc826('0x17')]['sendSMS']=function(_0x577b1f){logger['info'](util['format'](_0xc826('0x19c'),_0x577b1f['label']));if(!this['isConfigured'](_0x577b1f[_0xc826('0x19d')])){return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0x19e'));}var _0xfd5316=this['getSmsAccount'][_0xc826('0x67')](this,_0x577b1f[_0xc826('0x19d')]);if(!_0xfd5316){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x577b1f,_0xc826('0x19f'));}var _0x48d26d={'body':_0x577b1f['sms_text'],'phone':_0x577b1f['to']||'','SmsAccountId':_0xfd5316['id']};logger[_0xc826('0xdb')]('sendSMS\x20message',JSON[_0xc826('0x6a')](_0x48d26d));this[_0xc826('0x33')]['sync'](this,_0x577b1f,_0x577b1f[_0xc826('0x19d')]);this[_0xc826('0x10')][_0xc826('0xa3')](util['format'](_0xc826('0x1a0'),_0xfd5316[_0xc826('0x15')]));this[_0xc826('0x32')]['sync'](this,_0x48d26d);return this['channel'][_0xc826('0xa3')](_0xc826('0x1a1'));};AGIVertices['prototype'][_0xc826('0x1a2')]=function(_0x337987){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x1a3'),_0x337987[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x337987[_0xc826('0xd4')])){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x337987,_0xc826('0x1a4'));}var _0x31c52e=this[_0xc826('0x13')][_0xc826('0x67')](this,_0x337987[_0xc826('0xd4')]);if(!_0x31c52e){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x337987,_0xc826('0xd6'));}return this[_0xc826('0x10')][_0xc826('0x98')](_0x31c52e,_0x337987[_0xc826('0x1a5')]);};AGIVertices[_0xc826('0x17')][_0xc826('0x1a6')]=function(_0x3e22e3){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x1a7'),_0x3e22e3[_0xc826('0x35')]));this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0x1a8'));if(_0x3e22e3[_0xc826('0xb2')]===_0xc826('0x1a9')){this[_0xc826('0x10')]['noop'](_0xc826('0x1aa'));return this[_0xc826('0x10')][_0xc826('0xb2')]();}return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0x1ab'));};AGIVertices[_0xc826('0x17')][_0xc826('0x1ac')]=function(_0x21b3a3){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x1ad'),_0x21b3a3[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x21b3a3[_0xc826('0x1ae')])){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x21b3a3,_0xc826('0x1af'));}var _0x5171c9=this[_0xc826('0x1b0')][_0xc826('0x67')](this,_0x21b3a3[_0xc826('0x1ae')]);if(!this[_0xc826('0x9f')](_0x5171c9)){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x21b3a3,util['format'](_0xc826('0x1b1'),_0x21b3a3[_0xc826('0x1ae')]));}if(_0x5171c9===this[_0xc826('0x10')][_0xc826('0x36')]){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x21b3a3,_0xc826('0x1b2'));}this[_0xc826('0x33')]['sync'](this,_0x21b3a3,_0x5171c9);var _0x3d6629=this[_0xc826('0x10')][_0xc826('0x52')]('AGI',util['format'](_0xc826('0x1b3'),config[_0xc826('0xb0')][_0xc826('0x192')]||_0xc826('0x1b4'),_0x5171c9,this['channel'][_0xc826('0x36')]));if(_0x3d6629['result']===-0x1){return _0x3d6629;}return this[_0xc826('0x10')][_0xc826('0xa3')](util['format'](_0xc826('0xbd'),_0xc826('0x1b5'),_0x5171c9));};AGIVertices[_0xc826('0x17')][_0xc826('0x1b6')]=function(_0x5244c9){logger['info'](util[_0xc826('0x28')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x5244c9['label']));var _0x5dc3d0=this[_0xc826('0x51')]['sync'](this,_0x5244c9['command']);this[_0xc826('0x33')][_0xc826('0x67')](this,_0x5244c9,_0x5244c9[_0xc826('0x1b7')]);if(this[_0xc826('0x9f')](_0x5244c9['variable_id'])){var _0x408f56=this[_0xc826('0x13')][_0xc826('0x67')](this,_0x5244c9[_0xc826('0xd4')]);if(_0x408f56){this[_0xc826('0x10')]['setVariable'](_0x408f56,_0x5dc3d0);return this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')](_0xc826('0x1b8'),_0x5244c9['command'],_0x408f56));}}return this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')](_0xc826('0x1b9'),_0x5244c9[_0xc826('0x1b7')]));};AGIVertices[_0xc826('0x17')][_0xc826('0x1ba')]=function(_0x548ed6){logger['info'](util[_0xc826('0x28')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x548ed6[_0xc826('0x35')]));_0x548ed6[_0xc826('0x56')]=_0x548ed6[_0xc826('0x56')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc826('0x9f')](_0x548ed6['apiKey'])){return this[_0xc826('0x10')]['noop'](_0xc826('0x1bb'));}if(!this[_0xc826('0x9f')](_0x548ed6[_0xc826('0x56')])){return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0xa4'));}this[_0xc826('0x10')]['noop'](util[_0xc826('0x28')](_0xc826('0x1bc'),_0x548ed6[_0xc826('0x56')]));var _0x43845f=this['googleCloudTTS']['sync'](this,_0x548ed6);if(_0x43845f){this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')](_0xc826('0x1bd'),_0x43845f));var _0x343d1a=this['channel'][_0xc826('0xfd')](_0x43845f);try{fs[_0xc826('0xff')](_0x43845f+_0xc826('0x100'));}catch(_0xbb5538){logger[_0xc826('0x2b')](_0xbb5538);}return _0x343d1a;}return this['channel']['error'](_0x548ed6,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['tts']=function(_0x4c35e0){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x1be'),_0x4c35e0[_0xc826('0x35')]));_0x4c35e0['text']=_0x4c35e0[_0xc826('0x56')][_0xc826('0x54')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc826('0x9f')](_0x4c35e0[_0xc826('0x56')])){return this[_0xc826('0x10')][_0xc826('0xa3')](_0xc826('0xa4'));}this[_0xc826('0x10')]['noop'](util[_0xc826('0x28')](_0xc826('0x1bf'),_0x4c35e0[_0xc826('0x56')]));var _0x40b585=this[_0xc826('0x5a')][_0xc826('0x67')](this,_0x4c35e0);if(_0x40b585){this[_0xc826('0x10')][_0xc826('0xa3')](util[_0xc826('0x28')](_0xc826('0x1c0'),_0x40b585));var _0x18f85d=this['channel']['streamFile'](_0x40b585);try{fs[_0xc826('0xff')](_0x40b585+_0xc826('0x100'));}catch(_0x5b9c09){logger[_0xc826('0x2b')](_0x5b9c09);}return _0x18f85d;}return this[_0xc826('0x10')][_0xc826('0x2b')](_0x4c35e0,_0xc826('0x1c1'));};AGIVertices[_0xc826('0x17')][_0xc826('0x1c2')]=function(_0x2326bf){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x1c3'),_0x2326bf[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x2326bf[_0xc826('0x14a')])){return this[_0xc826('0x10')][_0xc826('0x2b')](_0x2326bf,_0xc826('0x14b'));}logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x15d'),this[_0xc826('0x10')][_0xc826('0x38')],_0x2326bf[_0xc826('0x14a')]));var _0x579489=this['agentUnpause'][_0xc826('0x67')](this,_0x2326bf[_0xc826('0x14a')]);if(_0x579489){logger['info'](util[_0xc826('0x28')](_0xc826('0x14d'),this['channel']['callerid'],_0x2326bf['findBy']));this['channel']['noop'](util['format'](_0xc826('0x14d'),this[_0xc826('0x10')][_0xc826('0x38')],_0x2326bf[_0xc826('0x14a')]));return{'code':0xc8,'result':_0xc826('0x14e')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc826('0x10')]['callerid'],_0x2326bf['findBy']));this[_0xc826('0x10')]['noop'](util['format'](_0xc826('0x14f'),this[_0xc826('0x10')]['callerid'],_0x2326bf[_0xc826('0x14a')]));return{'code':0xc8,'result':_0xc826('0x150')};}};AGIVertices[_0xc826('0x17')][_0xc826('0x1c4')]=function(_0x59367c){logger[_0xc826('0x2d')](util[_0xc826('0x28')](_0xc826('0x1c5'),_0x59367c[_0xc826('0x35')]));var _0x2d0b97=this[_0xc826('0x10')][_0xc826('0x52')](_0xc826('0x1c6'),[_0x59367c['mailbox'],_0x59367c[_0xc826('0x70')]]);if(_0x2d0b97[_0xc826('0xa5')]===-0x1){return _0x2d0b97;}return this[_0xc826('0x10')][_0xc826('0xa3')](util['format'](_0xc826('0xbd'),'VOICEMAIL',_0x59367c[_0xc826('0x1c7')]));};AGIVertices[_0xc826('0x17')][_0xc826('0x1c8')]=function(_0x33cfa1){logger[_0xc826('0x2d')](util['format'](_0xc826('0x1c9'),_0x33cfa1[_0xc826('0x35')]));if(!this[_0xc826('0x9f')](_0x33cfa1['variable_id'])){return this['channel'][_0xc826('0x2b')](_0x33cfa1,'no\x20variable\x20selected');}var _0x427834=this[_0xc826('0x13')][_0xc826('0x67')](this,_0x33cfa1[_0xc826('0xd4')]);if(!_0x427834){return this['channel'][_0xc826('0x2b')](_0x33cfa1,_0xc826('0xd6'));}var _0x52e11f=this[_0xc826('0x10')]['getVariable'](_0x427834);return{'code':0xc8,'result':_0x52e11f[_0xc826('0x9c')]?_0x52e11f[_0xc826('0x9c')]:'-'};};String[_0xc826('0x17')][_0xc826('0x9b')]=function(_0xfb7f2c,_0x741758){return this[_0xc826('0x9a')](_0xfb7f2c)[_0xc826('0x1ca')](_0x741758);};module[_0xc826('0x1cb')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index f8e1da3..f771516 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 _0xb2a1=['diff','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','name','Action','QueuePause','then','agents','getAgent','voicePause','info','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','queue','updateAcw','lastPauseAt','update','uniqueid','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','stringify','message','[ACW][syncAgentConnect]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','voiceQueues','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds'];(function(_0xb5fc3e,_0x234703){var _0x2efc3c=function(_0x4e4e44){while(--_0x4e4e44){_0xb5fc3e['push'](_0xb5fc3e['shift']());}};_0x2efc3c(++_0x234703);}(_0xb2a1,0x1ed));var _0x1b2a=function(_0x212b78,_0x113070){_0x212b78=_0x212b78-0x0;var _0x129fe4=_0xb2a1[_0x212b78];return _0x129fe4;};'use strict';var util=require(_0x1b2a('0x0'));var _=require(_0x1b2a('0x1'));var moment=require(_0x1b2a('0x2'));var ami=require(_0x1b2a('0x3'));var logger=require(_0x1b2a('0x4'))(_0x1b2a('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x25abe9){this[_0x1b2a('0x6')]=_0x25abe9['voiceQueues'];this['agents']=_0x25abe9['agents'];this[_0x1b2a('0x7')]=_0x25abe9[_0x1b2a('0x7')];this[_0x1b2a('0x8')]={};ami['on'](_0x1b2a('0x9'),this[_0x1b2a('0xa')][_0x1b2a('0xb')](this));ami['on']('hanguprequest',this[_0x1b2a('0xc')][_0x1b2a('0xb')](this));ami['on'](_0x1b2a('0xd'),this[_0x1b2a('0xe')]['bind'](this));ami['on'](_0x1b2a('0xf'),this[_0x1b2a('0x10')]['bind'](this));ami['on'](_0x1b2a('0x11'),this[_0x1b2a('0x12')][_0x1b2a('0xb')](this));ami['on'](_0x1b2a('0x13'),this['syncBlindTransfer'][_0x1b2a('0xb')](this));ami['on'](_0x1b2a('0x14'),this[_0x1b2a('0x15')][_0x1b2a('0xb')](this));}function getDiff(_0x6a6285){var _0x1aad3d=moment()[_0x1b2a('0x16')](0x0);var _0x516094=moment(_0x6a6285)['milliseconds'](0x0);return _0x1aad3d[_0x1b2a('0x17')](_0x516094,_0x1b2a('0x18'));}Acw[_0x1b2a('0x19')][_0x1b2a('0x1a')]=function(_0x1219dc){try{var _0x5c7505=this;var _0x4376b5=this['channels'][_0x1219dc][_0x1b2a('0x1b')];var _0x5adfe1=this[_0x1b2a('0x8')][_0x1219dc]['queue'];var _0x17f4be=this[_0x1b2a('0x6')][_0x5adfe1];var _0x21a134=![];var _0x57eb51=_0x1b2a('0x1c');if(_0x17f4be[_0x1b2a('0x1d')]){if(_0x17f4be['mandatoryDispositionPause'][_0x1b2a('0x1e')]){_0x21a134=!![];_0x57eb51=_0x17f4be['mandatoryDispositionPause'][_0x1b2a('0x1e')];}}ami[_0x1b2a('0x1f')]({'action':_0x1b2a('0x20'),'interface':_0x4376b5,'paused':!![],'reason':_0x57eb51})[_0x1b2a('0x21')](function(_0xfb3762){if(_0x5c7505[_0x1b2a('0x22')][_0x4376b5]){return RpcUser[_0x1b2a('0x23')](_0x5c7505[_0x1b2a('0x22')][_0x4376b5]['id'])[_0x1b2a('0x21')](function(_0x3fc6ce){if(_0x3fc6ce&&!_0x3fc6ce[_0x1b2a('0x24')]){logger[_0x1b2a('0x25')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x1219dc,_0x4376b5,_0x5adfe1);var _0xf0352b=_0x5c7505[_0x1b2a('0x8')][_0x1219dc][_0x1b2a('0x26')]&&_0x5c7505[_0x1b2a('0x8')][_0x1219dc][_0x1b2a('0x27')]?_0x5c7505[_0x1b2a('0x8')][_0x1219dc]['destlinkedid']:_0x1219dc;return RpcUser[_0x1b2a('0x28')](_0x5c7505[_0x1b2a('0x22')][_0x4376b5],_0x57eb51,_0xf0352b)[_0x1b2a('0x21')](function(_0x349a71){if(!_0x21a134){_0x5c7505[_0x1b2a('0x7')][_0x4376b5]={};logger['info'](_0x1b2a('0x29'),_0x1219dc,_0x5c7505[_0x1b2a('0x6')][_0x5adfe1][_0x1b2a('0x2a')],_0x4376b5,_0x5adfe1);_0x5c7505[_0x1b2a('0x7')][_0x4376b5][_0x1b2a('0x2b')]=setTimeout(_0x5c7505[_0x1b2a('0x2c')]['bind'](_0x5c7505,_0x4376b5),_0x5c7505[_0x1b2a('0x6')][_0x5adfe1]['acwTimeout']*0x3e8);_0x5c7505['timers'][_0x4376b5]['lastPauseAt']=moment()[_0x1b2a('0x2d')](_0x1b2a('0x2e'));_0x5c7505[_0x1b2a('0x7')][_0x4376b5]['uniqueid']=_0x1219dc;_0x5c7505[_0x1b2a('0x7')][_0x4376b5][_0x1b2a('0x2f')]=_0x5adfe1;_0x5c7505['timers'][_0x4376b5][_0x1b2a('0x30')]=function(){var _0x359612=getDiff(_0x5c7505[_0x1b2a('0x7')][_0x4376b5][_0x1b2a('0x31')]);clearTimeout(_0x5c7505[_0x1b2a('0x7')][_0x4376b5][_0x1b2a('0x2b')]);_0x5c7505['timers'][_0x4376b5][_0x1b2a('0x2b')]=![];RpcVoiceAgentReport[_0x1b2a('0x32')]({'acwtime':_0x359612},_0x5c7505['timers'][_0x4376b5][_0x1b2a('0x33')],_0x4376b5)['then'](function(_0x2c8b7e){logger[_0x1b2a('0x25')]('[%s][UPDATE][ACWTIME:%s]',_0x1219dc,_0x359612,_0x2c8b7e);})[_0x1b2a('0x34')](function(_0x3c23fc){logger[_0x1b2a('0x35')]('[%s][UPDATE][ERRORS:%s]',_0x1219dc,_0x3c23fc);});delete _0x5c7505['timers'][_0x4376b5];};}});}else{logger[_0x1b2a('0x25')](_0x1b2a('0x36'),_0x1219dc,_0x4376b5,_0x5adfe1);}});}})[_0x1b2a('0x34')](function(_0x276dd5){logger[_0x1b2a('0x35')](_0x1b2a('0x29'),_0x1219dc,_0x5c7505[_0x1b2a('0x6')][_0x5adfe1][_0x1b2a('0x2a')],_0x4376b5,_0x5adfe1);})[_0x1b2a('0x37')](function(){delete _0x5c7505[_0x1b2a('0x8')][_0x1219dc];});}catch(_0x52a72c){logger[_0x1b2a('0x35')](_0x1b2a('0x38'),_0x52a72c['message']);}};Acw[_0x1b2a('0x19')][_0x1b2a('0x2c')]=function(_0x101b3c){try{var _0x8501ca=this;if(_0x8501ca[_0x1b2a('0x7')][_0x101b3c]){_0x8501ca[_0x1b2a('0x7')][_0x101b3c][_0x1b2a('0x2b')]=![];var _0x17cf3b=_0x8501ca['timers'][_0x101b3c][_0x1b2a('0x33')];var _0x51156d=_0x8501ca[_0x1b2a('0x7')][_0x101b3c][_0x1b2a('0x2f')];var _0x14002b=_0x8501ca[_0x1b2a('0x6')][_0x51156d][_0x1b2a('0x2a')];logger[_0x1b2a('0x25')](_0x1b2a('0x39'),_0x17cf3b,_0x101b3c);RpcUser[_0x1b2a('0x3a')](this[_0x1b2a('0x22')][_0x101b3c]);RpcVoiceAgentReport[_0x1b2a('0x32')]({'acwtime':_0x14002b,'agentacw':!![]},_0x17cf3b,_0x101b3c)[_0x1b2a('0x21')](function(_0x521b6a){logger[_0x1b2a('0x25')]('[%s][UPDATE][ACWTIME:%s]',_0x17cf3b,_0x14002b,_0x521b6a);})[_0x1b2a('0x34')](function(_0x22c549){logger[_0x1b2a('0x35')](_0x1b2a('0x3b'),_0x17cf3b,_0x22c549);});}else{logger[_0x1b2a('0x35')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x101b3c);if(_0x8501ca[_0x1b2a('0x7')]){logger[_0x1b2a('0x25')](_0x1b2a('0x3c'),JSON[_0x1b2a('0x3d')](_0x8501ca[_0x1b2a('0x7')]));}}}catch(_0x4814c7){logger[_0x1b2a('0x35')]('[ACW][STOP]\x20%s',_0x4814c7[_0x1b2a('0x3e')]);}};Acw[_0x1b2a('0x19')]['syncAgentConnect']=function(_0x4c713a){try{if(this['voiceQueues'][_0x4c713a['queue']]&&(this[_0x1b2a('0x6')][_0x4c713a[_0x1b2a('0x2f')]][_0x1b2a('0x5')]||this[_0x1b2a('0x6')][_0x4c713a[_0x1b2a('0x2f')]][_0x1b2a('0x1d')])){if(this[_0x1b2a('0x22')][_0x4c713a[_0x1b2a('0x1b')]]){this[_0x1b2a('0x8')][_0x4c713a['uniqueid']]={'queue':_0x4c713a[_0x1b2a('0x2f')],'interface':_0x4c713a['interface'],'destlinkedid':_0x4c713a[_0x1b2a('0x27')]};}}}catch(_0x2afbfa){logger[_0x1b2a('0x35')](_0x1b2a('0x3f'),_0x2afbfa[_0x1b2a('0x3e')]);}};Acw[_0x1b2a('0x19')][_0x1b2a('0x15')]=function(_0x2c6671){try{if(this['voiceQueues'][_0x2c6671[_0x1b2a('0x2f')]]&&(this[_0x1b2a('0x6')][_0x2c6671[_0x1b2a('0x2f')]][_0x1b2a('0x5')]||this['voiceQueues'][_0x2c6671[_0x1b2a('0x2f')]]['mandatoryDisposition'])){if(this[_0x1b2a('0x22')][_0x2c6671[_0x1b2a('0x1b')]]){this['channels'][_0x2c6671['uniqueid']]={'queue':_0x2c6671['queue'],'interface':_0x2c6671['interface']};}}}catch(_0x2c102c){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x2c102c[_0x1b2a('0x3e')]);}};Acw[_0x1b2a('0x19')][_0x1b2a('0xc')]=function(_0x29788f){try{if(this[_0x1b2a('0x8')][_0x29788f[_0x1b2a('0x33')]]&&_[_0x1b2a('0x40')](this[_0x1b2a('0x8')][_0x29788f[_0x1b2a('0x33')]][_0x1b2a('0x26')])){logger[_0x1b2a('0x25')]('[%s][HANGUP:UNIQUEID]',_0x29788f['uniqueid']);this[_0x1b2a('0x1a')](_0x29788f[_0x1b2a('0x33')]);}else if(this[_0x1b2a('0x8')][_0x29788f[_0x1b2a('0x41')]]&&_[_0x1b2a('0x40')](this['channels'][_0x29788f[_0x1b2a('0x41')]][_0x1b2a('0x26')])){logger[_0x1b2a('0x25')](_0x1b2a('0x42'),_0x29788f[_0x1b2a('0x41')]);this['startAcw'](_0x29788f[_0x1b2a('0x41')]);}}catch(_0x7cb31a){logger['error'](_0x1b2a('0x43'),_0x7cb31a[_0x1b2a('0x3e')]);}};Acw[_0x1b2a('0x19')]['syncHangup']=function(_0x203262){try{if(this[_0x1b2a('0x8')][_0x203262['uniqueid']]&&this[_0x1b2a('0x8')][_0x203262[_0x1b2a('0x33')]]['attended']){logger[_0x1b2a('0x25')](_0x1b2a('0x44'),_0x203262[_0x1b2a('0x33')]);this['startAcw'](_0x203262[_0x1b2a('0x33')]);}else if(this[_0x1b2a('0x8')][_0x203262['linkedid']]&&this[_0x1b2a('0x8')][_0x203262['linkedid']][_0x1b2a('0x26')]){logger[_0x1b2a('0x25')](_0x1b2a('0x45'),_0x203262['linkedid']);this[_0x1b2a('0x1a')](_0x203262[_0x1b2a('0x41')]);}}catch(_0x510898){logger[_0x1b2a('0x35')](_0x1b2a('0x46'),_0x510898[_0x1b2a('0x3e')]);}};Acw[_0x1b2a('0x19')][_0x1b2a('0x12')]=function(_0x4a4205){try{if(!_[_0x1b2a('0x47')](this[_0x1b2a('0x8')][_0x4a4205[_0x1b2a('0x48')]])){this[_0x1b2a('0x1a')](_0x4a4205[_0x1b2a('0x48')]);if(this[_0x1b2a('0x8')][_0x4a4205[_0x1b2a('0x49')]]){this['channels'][_0x4a4205[_0x1b2a('0x49')]]['attended']=!![];this[_0x1b2a('0x8')][_0x4a4205[_0x1b2a('0x4a')]]=this[_0x1b2a('0x8')][_0x4a4205[_0x1b2a('0x49')]];delete this[_0x1b2a('0x8')][_0x4a4205[_0x1b2a('0x49')]];}}else if(!_[_0x1b2a('0x47')](this['channels'][_0x4a4205[_0x1b2a('0x4a')]])){this[_0x1b2a('0x1a')](_0x4a4205['transfertargetuniqueid']);if(this[_0x1b2a('0x8')][_0x4a4205[_0x1b2a('0x4b')]]){this[_0x1b2a('0x8')][_0x4a4205[_0x1b2a('0x4b')]][_0x1b2a('0x26')]=!![];this[_0x1b2a('0x8')][_0x4a4205['transfereeuniqueid']]=this[_0x1b2a('0x8')][_0x4a4205[_0x1b2a('0x4b')]];delete this[_0x1b2a('0x8')][_0x4a4205['origtransfereruniqueid']];}}}catch(_0x54bfec){logger['error'](_0x1b2a('0x4c'),_0x54bfec[_0x1b2a('0x3e')]);}};Acw[_0x1b2a('0x19')]['syncBlindTransfer']=function(_0x419885){try{if(this[_0x1b2a('0x8')][_0x419885[_0x1b2a('0x4d')]]){logger[_0x1b2a('0x25')](_0x1b2a('0x4e'),JSON[_0x1b2a('0x3d')](_0x419885[_0x1b2a('0x4d')]));this['startAcw'](_0x419885[_0x1b2a('0x4d')]);}else if(this['channels'][_0x419885[_0x1b2a('0x4f')]]){logger[_0x1b2a('0x25')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x1b2a('0x3d')](_0x419885['transfererlinkedid']));this[_0x1b2a('0x1a')](_0x419885[_0x1b2a('0x4f')]);}}catch(_0x50d0d4){logger[_0x1b2a('0x35')]('[ACW][syncBlindTransfer]\x20%s',_0x50d0d4[_0x1b2a('0x3e')]);}};Acw[_0x1b2a('0x19')][_0x1b2a('0x10')]=function(_0xb224ec){try{if(this[_0x1b2a('0x6')][_0xb224ec[_0x1b2a('0x2f')]]&&this[_0x1b2a('0x6')][_0xb224ec[_0x1b2a('0x2f')]][_0x1b2a('0x50')]===_0x1b2a('0x51')){if(this[_0x1b2a('0x22')][_0xb224ec[_0x1b2a('0x1b')]]){logger['info'](_0x1b2a('0x52'),_0xb224ec[_0x1b2a('0x33')],_0xb224ec[_0x1b2a('0x1b')],_0xb224ec['queue']);return RpcUser[_0x1b2a('0x28')](this[_0x1b2a('0x22')][_0xb224ec[_0x1b2a('0x1b')]],_0x1b2a('0x53'),_0xb224ec[_0x1b2a('0x33')]);}}}catch(_0x3d6e10){logger[_0x1b2a('0x35')](_0x1b2a('0x54'),_0x3d6e10[_0x1b2a('0x3e')]);}};module[_0x1b2a('0x55')]=Acw; \ No newline at end of file +var _0x7585=['stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','util','moment','../ami','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','hanguprequest','bind','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','interface','ACW','mandatoryDisposition','name','mandatoryDispositionPause','QueuePause','then','getAgent','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','timer','stopAcw','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','queue','update','uniqueid','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','prototype','acw','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid'];(function(_0x3e9164,_0x25c935){var _0x4339c2=function(_0xb0e906){while(--_0xb0e906){_0x3e9164['push'](_0x3e9164['shift']());}};_0x4339c2(++_0x25c935);}(_0x7585,0xfd));var _0x5758=function(_0x218ffb,_0x1ec3d5){_0x218ffb=_0x218ffb-0x0;var _0x1bcc86=_0x7585[_0x218ffb];return _0x1bcc86;};'use strict';var util=require(_0x5758('0x0'));var _=require('lodash');var moment=require(_0x5758('0x1'));var ami=require(_0x5758('0x2'));var logger=require(_0x5758('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x5758('0x4'));function Acw(_0x5b8f22){this[_0x5758('0x5')]=_0x5b8f22['voiceQueues'];this[_0x5758('0x6')]=_0x5b8f22[_0x5758('0x6')];this['timers']=_0x5b8f22[_0x5758('0x7')];this[_0x5758('0x8')]={};ami['on'](_0x5758('0x9'),this['syncAgentConnect']['bind'](this));ami['on'](_0x5758('0xa'),this['syncHangupRequest'][_0x5758('0xb')](this));ami['on'](_0x5758('0xc'),this['syncHangup'][_0x5758('0xb')](this));ami['on'](_0x5758('0xd'),this[_0x5758('0xe')][_0x5758('0xb')](this));ami['on'](_0x5758('0xf'),this['syncAttendedTransfer'][_0x5758('0xb')](this));ami['on'](_0x5758('0x10'),this['syncBlindTransfer'][_0x5758('0xb')](this));ami['on'](_0x5758('0x11'),this['syncAgentConnectPreview'][_0x5758('0xb')](this));}function getDiff(_0x191971){var _0x1d72ac=moment()[_0x5758('0x12')](0x0);var _0x1a20e4=moment(_0x191971)[_0x5758('0x12')](0x0);return _0x1d72ac[_0x5758('0x13')](_0x1a20e4,_0x5758('0x14'));}Acw['prototype'][_0x5758('0x15')]=function(_0x20c09f){try{var _0xb7bf88=this;var _0x49c4cb=this['channels'][_0x20c09f][_0x5758('0x16')];var _0x23b831=this['channels'][_0x20c09f]['queue'];var _0x42fb32=this[_0x5758('0x5')][_0x23b831];var _0x4134aa=![];var _0x13c7aa=_0x5758('0x17');if(_0x42fb32[_0x5758('0x18')]){if(_0x42fb32['mandatoryDispositionPause'][_0x5758('0x19')]){_0x4134aa=!![];_0x13c7aa=_0x42fb32[_0x5758('0x1a')]['name'];}}ami['Action']({'action':_0x5758('0x1b'),'interface':_0x49c4cb,'paused':!![],'reason':_0x13c7aa})[_0x5758('0x1c')](function(_0x25ccde){if(_0xb7bf88[_0x5758('0x6')][_0x49c4cb]){return RpcUser[_0x5758('0x1d')](_0xb7bf88[_0x5758('0x6')][_0x49c4cb]['id'])[_0x5758('0x1c')](function(_0x5d80f1){if(_0x5d80f1&&!_0x5d80f1['voicePause']){logger['info'](_0x5758('0x1e'),_0x20c09f,_0x49c4cb,_0x23b831);var _0x2e33fd=_0xb7bf88[_0x5758('0x8')][_0x20c09f][_0x5758('0x1f')]&&_0xb7bf88[_0x5758('0x8')][_0x20c09f][_0x5758('0x20')]?_0xb7bf88[_0x5758('0x8')][_0x20c09f][_0x5758('0x20')]:_0x20c09f;return RpcUser[_0x5758('0x21')](_0xb7bf88[_0x5758('0x6')][_0x49c4cb],_0x13c7aa,_0x2e33fd)['then'](function(_0x4b0492){if(!_0x4134aa){_0xb7bf88[_0x5758('0x7')][_0x49c4cb]={};logger[_0x5758('0x22')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x20c09f,_0xb7bf88[_0x5758('0x5')][_0x23b831]['acwTimeout'],_0x49c4cb,_0x23b831);_0xb7bf88[_0x5758('0x7')][_0x49c4cb][_0x5758('0x23')]=setTimeout(_0xb7bf88[_0x5758('0x24')][_0x5758('0xb')](_0xb7bf88,_0x49c4cb),_0xb7bf88[_0x5758('0x5')][_0x23b831][_0x5758('0x25')]*0x3e8);_0xb7bf88['timers'][_0x49c4cb][_0x5758('0x26')]=moment()[_0x5758('0x27')](_0x5758('0x28'));_0xb7bf88[_0x5758('0x7')][_0x49c4cb]['uniqueid']=_0x20c09f;_0xb7bf88[_0x5758('0x7')][_0x49c4cb][_0x5758('0x29')]=_0x23b831;_0xb7bf88[_0x5758('0x7')][_0x49c4cb]['updateAcw']=function(){var _0x56a911=getDiff(_0xb7bf88[_0x5758('0x7')][_0x49c4cb][_0x5758('0x26')]);clearTimeout(_0xb7bf88[_0x5758('0x7')][_0x49c4cb][_0x5758('0x23')]);_0xb7bf88[_0x5758('0x7')][_0x49c4cb]['timer']=![];RpcVoiceAgentReport[_0x5758('0x2a')]({'acwtime':_0x56a911},_0xb7bf88[_0x5758('0x7')][_0x49c4cb][_0x5758('0x2b')],_0x49c4cb)['then'](function(_0x217e97){logger[_0x5758('0x22')]('[%s][UPDATE][ACWTIME:%s]',_0x20c09f,_0x56a911,_0x217e97);})[_0x5758('0x2c')](function(_0x1150bd){logger[_0x5758('0x2d')](_0x5758('0x2e'),_0x20c09f,_0x1150bd);});delete _0xb7bf88['timers'][_0x49c4cb];};}});}else{logger[_0x5758('0x22')](_0x5758('0x2f'),_0x20c09f,_0x49c4cb,_0x23b831);}});}})[_0x5758('0x2c')](function(_0x3369d6){logger[_0x5758('0x2d')](_0x5758('0x30'),_0x20c09f,_0xb7bf88['voiceQueues'][_0x23b831]['acwTimeout'],_0x49c4cb,_0x23b831);})[_0x5758('0x31')](function(){delete _0xb7bf88[_0x5758('0x8')][_0x20c09f];});}catch(_0x15472b){logger[_0x5758('0x2d')](_0x5758('0x32'),_0x15472b[_0x5758('0x33')]);}};Acw['prototype'][_0x5758('0x24')]=function(_0x5dd0da){try{var _0x104310=this;if(_0x104310[_0x5758('0x7')][_0x5dd0da]){_0x104310[_0x5758('0x7')][_0x5dd0da][_0x5758('0x23')]=![];var _0x1c0beb=_0x104310[_0x5758('0x7')][_0x5dd0da][_0x5758('0x2b')];var _0x1ab8c8=_0x104310[_0x5758('0x7')][_0x5dd0da][_0x5758('0x29')];var _0x141e17=_0x104310[_0x5758('0x5')][_0x1ab8c8][_0x5758('0x25')];logger[_0x5758('0x22')](_0x5758('0x34'),_0x1c0beb,_0x5dd0da);RpcUser['saveUnpause'](this[_0x5758('0x6')][_0x5dd0da]);RpcVoiceAgentReport['update']({'acwtime':_0x141e17,'agentacw':!![]},_0x1c0beb,_0x5dd0da)['then'](function(_0x3c121e){logger[_0x5758('0x22')](_0x5758('0x35'),_0x1c0beb,_0x141e17,_0x3c121e);})[_0x5758('0x2c')](function(_0x2f3520){logger[_0x5758('0x2d')]('[%s][UPDATE][ERRORS:%s]',_0x1c0beb,_0x2f3520);});}else{logger[_0x5758('0x2d')](_0x5758('0x36'),_0x5dd0da);if(_0x104310[_0x5758('0x7')]){logger['info']('[ACW][TIMERS]',JSON['stringify'](_0x104310[_0x5758('0x7')]));}}}catch(_0x228080){logger['error']('[ACW][STOP]\x20%s',_0x228080[_0x5758('0x33')]);}};Acw[_0x5758('0x37')]['syncAgentConnect']=function(_0x3e701b){try{if(this['voiceQueues'][_0x3e701b['queue']]&&(this['voiceQueues'][_0x3e701b[_0x5758('0x29')]][_0x5758('0x38')]||this[_0x5758('0x5')][_0x3e701b['queue']][_0x5758('0x18')])){if(this[_0x5758('0x6')][_0x3e701b[_0x5758('0x16')]]){this[_0x5758('0x8')][_0x3e701b[_0x5758('0x2b')]]={'queue':_0x3e701b[_0x5758('0x29')],'interface':_0x3e701b[_0x5758('0x16')],'destlinkedid':_0x3e701b[_0x5758('0x20')]};}}}catch(_0x18943a){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x18943a[_0x5758('0x33')]);}};Acw[_0x5758('0x37')][_0x5758('0x39')]=function(_0x43b3dc){try{if(this['voiceQueues'][_0x43b3dc['queue']]&&(this[_0x5758('0x5')][_0x43b3dc[_0x5758('0x29')]][_0x5758('0x38')]||this[_0x5758('0x5')][_0x43b3dc[_0x5758('0x29')]][_0x5758('0x18')])){if(this[_0x5758('0x6')][_0x43b3dc[_0x5758('0x16')]]){this[_0x5758('0x8')][_0x43b3dc[_0x5758('0x2b')]]={'queue':_0x43b3dc[_0x5758('0x29')],'interface':_0x43b3dc['interface']};}}}catch(_0x42052c){logger[_0x5758('0x2d')](_0x5758('0x3a'),_0x42052c['message']);}};Acw[_0x5758('0x37')][_0x5758('0x3b')]=function(_0x1cf7b){try{if(this['channels'][_0x1cf7b[_0x5758('0x2b')]]&&_['isUndefined'](this[_0x5758('0x8')][_0x1cf7b[_0x5758('0x2b')]]['attended'])){logger[_0x5758('0x22')](_0x5758('0x3c'),_0x1cf7b['uniqueid']);this[_0x5758('0x15')](_0x1cf7b[_0x5758('0x2b')]);}else if(this['channels'][_0x1cf7b[_0x5758('0x3d')]]&&_[_0x5758('0x3e')](this[_0x5758('0x8')][_0x1cf7b[_0x5758('0x3d')]]['attended'])){logger[_0x5758('0x22')](_0x5758('0x3f'),_0x1cf7b[_0x5758('0x3d')]);this[_0x5758('0x15')](_0x1cf7b[_0x5758('0x3d')]);}}catch(_0x39c6d1){logger[_0x5758('0x2d')](_0x5758('0x40'),_0x39c6d1[_0x5758('0x33')]);}};Acw[_0x5758('0x37')]['syncHangup']=function(_0x92baf3){try{if(this[_0x5758('0x8')][_0x92baf3[_0x5758('0x2b')]]&&this[_0x5758('0x8')][_0x92baf3[_0x5758('0x2b')]]['attended']){logger[_0x5758('0x22')](_0x5758('0x41'),_0x92baf3[_0x5758('0x2b')]);this[_0x5758('0x15')](_0x92baf3[_0x5758('0x2b')]);}else if(this[_0x5758('0x8')][_0x92baf3[_0x5758('0x3d')]]&&this['channels'][_0x92baf3[_0x5758('0x3d')]][_0x5758('0x1f')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x92baf3[_0x5758('0x3d')]);this[_0x5758('0x15')](_0x92baf3['linkedid']);}}catch(_0x268691){logger['error'](_0x5758('0x42'),_0x268691['message']);}};Acw[_0x5758('0x37')][_0x5758('0x43')]=function(_0x45d726){try{if(!_[_0x5758('0x44')](this[_0x5758('0x8')][_0x45d726[_0x5758('0x45')]])){this[_0x5758('0x15')](_0x45d726[_0x5758('0x45')]);if(this[_0x5758('0x8')][_0x45d726['secondtransfereruniqueid']]){this['channels'][_0x45d726['secondtransfereruniqueid']][_0x5758('0x1f')]=!![];this[_0x5758('0x8')][_0x45d726[_0x5758('0x46')]]=this['channels'][_0x45d726[_0x5758('0x47')]];delete this['channels'][_0x45d726[_0x5758('0x47')]];}}else if(!_[_0x5758('0x44')](this[_0x5758('0x8')][_0x45d726[_0x5758('0x46')]])){this[_0x5758('0x15')](_0x45d726[_0x5758('0x46')]);if(this['channels'][_0x45d726['origtransfereruniqueid']]){this['channels'][_0x45d726[_0x5758('0x48')]][_0x5758('0x1f')]=!![];this[_0x5758('0x8')][_0x45d726[_0x5758('0x45')]]=this['channels'][_0x45d726[_0x5758('0x48')]];delete this[_0x5758('0x8')][_0x45d726[_0x5758('0x48')]];}}}catch(_0x44a93b){logger['error'](_0x5758('0x49'),_0x44a93b[_0x5758('0x33')]);}};Acw[_0x5758('0x37')]['syncBlindTransfer']=function(_0x41e286){try{if(this[_0x5758('0x8')][_0x41e286[_0x5758('0x4a')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x5758('0x4b')](_0x41e286['transfereruniqueid']));this['startAcw'](_0x41e286[_0x5758('0x4a')]);}else if(this['channels'][_0x41e286[_0x5758('0x4c')]]){logger[_0x5758('0x22')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x5758('0x4b')](_0x41e286[_0x5758('0x4c')]));this[_0x5758('0x15')](_0x41e286[_0x5758('0x4c')]);}}catch(_0x55bfe8){logger['error'](_0x5758('0x4d'),_0x55bfe8[_0x5758('0x33')]);}};Acw[_0x5758('0x37')][_0x5758('0xe')]=function(_0x3bcd2a){try{if(this[_0x5758('0x5')][_0x3bcd2a[_0x5758('0x29')]]&&this[_0x5758('0x5')][_0x3bcd2a[_0x5758('0x29')]][_0x5758('0x4e')]===_0x5758('0x4f')){if(this[_0x5758('0x6')][_0x3bcd2a[_0x5758('0x16')]]){logger['info'](_0x5758('0x50'),_0x3bcd2a[_0x5758('0x2b')],_0x3bcd2a['interface'],_0x3bcd2a[_0x5758('0x29')]);return RpcUser['savePause'](this[_0x5758('0x6')][_0x3bcd2a['interface']],'Auto-Pause',_0x3bcd2a[_0x5758('0x2b')]);}}}catch(_0x3c77f7){logger[_0x5758('0x2d')](_0x5758('0x51'),_0x3c77f7[_0x5758('0x33')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 848d8c4..d2eff77 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 _0xbad5=['bluebird','moment','util','lodash','../../config/logger','../../config/environment','asterisk','port','password','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','username','actionSipShowRegistry','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','catch','log','asterisk-manager'];(function(_0x3a634c,_0x1967a6){var _0x44e4ef=function(_0x36ac8b){while(--_0x36ac8b){_0x3a634c['push'](_0x3a634c['shift']());}};_0x44e4ef(++_0x1967a6);}(_0xbad5,0x1ac));var _0x5bad=function(_0x456e3c,_0x310367){_0x456e3c=_0x456e3c-0x0;var _0x3589da=_0xbad5[_0x456e3c];return _0x3589da;};'use strict';var Manager=require(_0x5bad('0x0'));var BPromise=require(_0x5bad('0x1'));var moment=require(_0x5bad('0x2'));var util=require(_0x5bad('0x3'));var _=require(_0x5bad('0x4'));var logger=require(_0x5bad('0x5'))('ami');var config=require(_0x5bad('0x6'));var ami=new Manager(config[_0x5bad('0x7')][_0x5bad('0x8')],config['asterisk']['ip'],config[_0x5bad('0x7')]['username'],config['asterisk'][_0x5bad('0x9')],!![]);ami[_0x5bad('0xa')]();ami[_0x5bad('0xb')]=BPromise[_0x5bad('0xc')](ami[_0x5bad('0xd')]);function error(_0x963f96){logger['error'](util[_0x5bad('0xe')](_0x5bad('0xf'),config[_0x5bad('0x7')]['username'],config[_0x5bad('0x7')]['ip'],config[_0x5bad('0x7')]['port'],util[_0x5bad('0x10')](_0x963f96,![],null)));}function close(){logger[_0x5bad('0x11')](util['format'](_0x5bad('0x12'),config[_0x5bad('0x7')][_0x5bad('0x13')],config[_0x5bad('0x7')]['ip'],config[_0x5bad('0x7')][_0x5bad('0x8')]));}ami[_0x5bad('0x14')]=function(){return function(){return ami[_0x5bad('0xb')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x5bad('0xb')]({'action':_0x5bad('0x15')});};};ami[_0x5bad('0x16')]=function(){return function(){return ami[_0x5bad('0xb')]({'action':_0x5bad('0x17')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x5bad('0x18')});};};ami[_0x5bad('0x19')]=function(){return function(){return ami[_0x5bad('0xb')]({'action':_0x5bad('0x1a')});};};function connect(_0x30acde){logger[_0x5bad('0x1b')](util[_0x5bad('0xe')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0x5bad('0x13')],config[_0x5bad('0x7')]['ip'],config[_0x5bad('0x7')][_0x5bad('0x8')]));ami[_0x5bad('0x1c')](_0x5bad('0x11'),error);ami[_0x5bad('0x1c')](_0x5bad('0x1d'),close);}ami['on'](_0x5bad('0x1e'),connect);ami['on'](_0x5bad('0x1f'),function(_0x5de391){logger[_0x5bad('0x1b')](util[_0x5bad('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk']['username'],config[_0x5bad('0x7')]['ip'],config[_0x5bad('0x7')][_0x5bad('0x8')],util[_0x5bad('0x10')](_0x5de391,![],null)));});ami['on'](_0x5bad('0x20'),function(_0x17f63f){logger[_0x5bad('0x1b')](util['format'](_0x5bad('0x21'),config[_0x5bad('0x7')]['username'],config[_0x5bad('0x7')]['ip'],config[_0x5bad('0x7')][_0x5bad('0x8')]));return BPromise[_0x5bad('0x22')]()[_0x5bad('0x23')](ami['actionSipShowRegistry']())[_0x5bad('0x23')](ami[_0x5bad('0x24')]())[_0x5bad('0x23')](ami[_0x5bad('0x16')]())[_0x5bad('0x23')](ami['actionQueueSummary']())['then'](ami[_0x5bad('0x19')]())[_0x5bad('0x25')](function(_0x5d9268){console[_0x5bad('0x26')](_0x5d9268);});});ami[_0x5bad('0x1c')](_0x5bad('0x11'),error);ami['once'](_0x5bad('0x1d'),close);module['exports']=ami; \ No newline at end of file +var _0xc335=['once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','resolve','then','catch','exports','asterisk-manager','bluebird','moment','util','../../config/logger','ami','../../config/environment','asterisk','port','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x126332,_0x3a0437){var _0x1c4a42=function(_0x52ff2c){while(--_0x52ff2c){_0x126332['push'](_0x126332['shift']());}};_0x1c4a42(++_0x3a0437);}(_0xc335,0x10b));var _0x5c33=function(_0x481ffe,_0x2a43ea){_0x481ffe=_0x481ffe-0x0;var _0x3b918a=_0xc335[_0x481ffe];return _0x3b918a;};'use strict';var Manager=require(_0x5c33('0x0'));var BPromise=require(_0x5c33('0x1'));var moment=require(_0x5c33('0x2'));var util=require(_0x5c33('0x3'));var _=require('lodash');var logger=require(_0x5c33('0x4'))(_0x5c33('0x5'));var config=require(_0x5c33('0x6'));var ami=new Manager(config[_0x5c33('0x7')][_0x5c33('0x8')],config[_0x5c33('0x7')]['ip'],config[_0x5c33('0x7')]['username'],config['asterisk']['password'],!![]);ami[_0x5c33('0x9')]();ami[_0x5c33('0xa')]=BPromise[_0x5c33('0xb')](ami[_0x5c33('0xc')]);function error(_0x34af6d){logger[_0x5c33('0xd')](util[_0x5c33('0xe')](_0x5c33('0xf'),config[_0x5c33('0x7')][_0x5c33('0x10')],config[_0x5c33('0x7')]['ip'],config['asterisk'][_0x5c33('0x8')],util[_0x5c33('0x11')](_0x34af6d,![],null)));}function close(){logger[_0x5c33('0xd')](util[_0x5c33('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x5c33('0x7')][_0x5c33('0x10')],config[_0x5c33('0x7')]['ip'],config[_0x5c33('0x7')]['port']));}ami[_0x5c33('0x12')]=function(){return function(){return ami[_0x5c33('0xa')]({'action':_0x5c33('0x13')});};};ami[_0x5c33('0x14')]=function(){return function(){return ami[_0x5c33('0xa')]({'action':_0x5c33('0x15')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0x5c33('0x16')});};};ami[_0x5c33('0x17')]=function(){return function(){return ami[_0x5c33('0xa')]({'action':_0x5c33('0x18')});};};ami[_0x5c33('0x19')]=function(){return function(){return ami[_0x5c33('0xa')]({'action':_0x5c33('0x1a')});};};function connect(_0x1086ef){logger[_0x5c33('0x1b')](util['format'](_0x5c33('0x1c'),config[_0x5c33('0x7')][_0x5c33('0x10')],config[_0x5c33('0x7')]['ip'],config['asterisk'][_0x5c33('0x8')]));ami['once'](_0x5c33('0xd'),error);ami[_0x5c33('0x1d')](_0x5c33('0x1e'),close);}ami['on'](_0x5c33('0x1f'),connect);ami['on']('shutdown',function(_0x32b365){logger['info'](util[_0x5c33('0xe')](_0x5c33('0x20'),config[_0x5c33('0x7')][_0x5c33('0x10')],config['asterisk']['ip'],config['asterisk'][_0x5c33('0x8')],util[_0x5c33('0x11')](_0x32b365,![],null)));});ami['on']('fullybooted',function(_0x197ad1){logger[_0x5c33('0x1b')](util[_0x5c33('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk']['username'],config[_0x5c33('0x7')]['ip'],config[_0x5c33('0x7')][_0x5c33('0x8')]));return BPromise[_0x5c33('0x21')]()[_0x5c33('0x22')](ami[_0x5c33('0x12')]())['then'](ami[_0x5c33('0x14')]())[_0x5c33('0x22')](ami['actionSipPeerStatus']())[_0x5c33('0x22')](ami[_0x5c33('0x17')]())[_0x5c33('0x22')](ami[_0x5c33('0x19')]())[_0x5c33('0x23')](function(_0x1eb27b){console['log'](_0x1eb27b);});});ami[_0x5c33('0x1d')]('error',error);ami[_0x5c33('0x1d')](_0x5c33('0x1e'),close);module[_0x5c33('0x24')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 17b890b..55f25ff 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 _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x1f8f97,_0x1c8de4){var _0x59871e=function(_0x4513ad){while(--_0x4513ad){_0x1f8f97['push'](_0x1f8f97['shift']());}};_0x59871e(++_0x1c8de4);}(_0xf4eb,0xec));var _0xbf4e=function(_0x558473,_0x4008f7){_0x558473=_0x558473-0x0;var _0x5d63ae=_0xf4eb[_0x558473];return _0x5d63ae;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=client; \ No newline at end of file +var _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x5a4495,_0x4ab64c){var _0x2d5e5d=function(_0x4829b5){while(--_0x4829b5){_0x5a4495['push'](_0x5a4495['shift']());}};_0x2d5e5d(++_0x4ab64c);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5d1718,_0x3c0926){_0x5d1718=_0x5d1718-0x0;var _0x1cd8ff=_0xbdb7[_0x5d1718];return _0x1cd8ff;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index e988641..032211c 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe53a=['ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','util','lodash','moment','string','isNil','voiceQueue','name','phone','Contact','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper'];(function(_0x5d7edf,_0x45f343){var _0xc2e4ef=function(_0x1144f5){while(--_0x1144f5){_0x5d7edf['push'](_0x5d7edf['shift']());}};_0xc2e4ef(++_0x45f343);}(_0xe53a,0x1ad));var _0xae53=function(_0x219bf3,_0x211ef0){_0x219bf3=_0x219bf3-0x0;var _0x39171b=_0xe53a[_0x219bf3];return _0x39171b;};'use strict';var util=require(_0xae53('0x0'));var _=require(_0xae53('0x1'));var moment=require(_0xae53('0x2'));function checkNameSurname(_0x110fd9,_0x547c26,_0x387e30){var _0x519356='';if(!_['isNil'](_0x547c26)&&_0xae53('0x3')===typeof _0x547c26){_0x519356+=_0x547c26;}if(!_[_0xae53('0x4')](_0x387e30)&&_0xae53('0x3')===typeof _0x387e30){_0x519356+='\x20'+_0x387e30;}if(_0x519356!==''){return _0x519356;}return _0x110fd9;}function Action(_0x58b38b,_0xe155df,_0x25bf9b){this[_0xae53('0x5')]=_0x58b38b;this['uniqueid']=_0x25bf9b||undefined;this[_0xae53('0x6')]=checkNameSurname(_0xe155df['Contact'][_0xae53('0x7')],_0xe155df[_0xae53('0x8')][_0xae53('0x9')],_0xe155df[_0xae53('0x8')][_0xae53('0xa')]);this[_0xae53('0xb')]=_0xe155df['Contact'][_0xae53('0x7')];this[_0xae53('0xc')]=_0x58b38b[_0xae53('0x6')];this[_0xae53('0xd')]=_0xe155df['active']||![];this[_0xae53('0xe')]=_0x58b38b[_0xae53('0xe')];this[_0xae53('0xf')]=_0x58b38b[_0xae53('0xf')]||0x3;this[_0xae53('0x10')]=_0xe155df[_0xae53('0x10')];this[_0xae53('0x11')]=_0xe155df['countbusyretry'];this['countcongestionretry']=_0xe155df[_0xae53('0x12')];this['countnoanswerretry']=_0xe155df[_0xae53('0x13')];this[_0xae53('0x14')]=_0xe155df[_0xae53('0x14')];this[_0xae53('0x15')]=_0xe155df[_0xae53('0x15')];this[_0xae53('0x16')]=_0xe155df['countabandonedretry'];this['countmachineretry']=_0xe155df[_0xae53('0x17')];this[_0xae53('0x18')]=_0xe155df[_0xae53('0x18')];this[_0xae53('0x19')]=_0xe155df['ContactId'];this[_0xae53('0x1a')]=_0xe155df[_0xae53('0x1a')];this[_0xae53('0x1b')]=_0xe155df[_0xae53('0x1b')];this[_0xae53('0x1c')]=_0xe155df[_0xae53('0x1c')];this[_0xae53('0x1d')]=_0xe155df[_0xae53('0x1d')];this[_0xae53('0x1e')]=_0xe155df['id'];this[_0xae53('0x1f')]=_0xe155df[_0xae53('0x8')]['firstName']||'';this[_0xae53('0x20')]=moment()['format'](_0xae53('0x21'));this[_0xae53('0x22')]=_0xe155df[_0xae53('0x22')];this[_0xae53('0x23')]=_0xe155df[_0xae53('0x23')];this[_0xae53('0x24')]=_0xe155df[_0xae53('0x24')];this[_0xae53('0x25')]=_0xe155df['recallme'];this[_0xae53('0x26')]='';this[_0xae53('0x27')]='';}Action[_0xae53('0x28')]['getCaller']=function(){return util[_0xae53('0x29')](_0xae53('0x2a'),this['name'],this['voiceQueue'][_0xae53('0x2b')]>0x0?this[_0xae53('0xb')][_0xae53('0x2c')](this['voiceQueue'][_0xae53('0x2b')]):this[_0xae53('0xb')]);};Action[_0xae53('0x28')][_0xae53('0x2d')]=function(){return this[_0xae53('0xc')];};module['exports']=Action; \ No newline at end of file +var _0x275b=['lodash','moment','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','voiceQueue','substring','exports','util'];(function(_0x562914,_0x5d1db2){var _0x5306ec=function(_0x3a7e87){while(--_0x3a7e87){_0x562914['push'](_0x562914['shift']());}};_0x5306ec(++_0x5d1db2);}(_0x275b,0x125));var _0xb275=function(_0x35f442,_0x4bd577){_0x35f442=_0x35f442-0x0;var _0xe10789=_0x275b[_0x35f442];return _0xe10789;};'use strict';var util=require(_0xb275('0x0'));var _=require(_0xb275('0x1'));var moment=require(_0xb275('0x2'));function checkNameSurname(_0x2a6b41,_0x38080d,_0xbad22f){var _0x2ffae1='';if(!_[_0xb275('0x3')](_0x38080d)&&_0xb275('0x4')===typeof _0x38080d){_0x2ffae1+=_0x38080d;}if(!_[_0xb275('0x3')](_0xbad22f)&&_0xb275('0x4')===typeof _0xbad22f){_0x2ffae1+='\x20'+_0xbad22f;}if(_0x2ffae1!==''){return _0x2ffae1;}return _0x2a6b41;}function Action(_0x346b68,_0x4837fa,_0x38cc7){this['voiceQueue']=_0x346b68;this[_0xb275('0x5')]=_0x38cc7||undefined;this[_0xb275('0x6')]=checkNameSurname(_0x4837fa[_0xb275('0x7')][_0xb275('0x8')],_0x4837fa['Contact'][_0xb275('0x9')],_0x4837fa[_0xb275('0x7')][_0xb275('0xa')]);this[_0xb275('0xb')]=_0x4837fa[_0xb275('0x7')][_0xb275('0x8')];this[_0xb275('0xc')]=_0x346b68[_0xb275('0x6')];this[_0xb275('0xd')]=_0x4837fa['active']||![];this[_0xb275('0xe')]=_0x346b68['type'];this['dialQueueTimeout']=_0x346b68[_0xb275('0xf')]||0x3;this[_0xb275('0x10')]=_0x4837fa['scheduledat'];this[_0xb275('0x11')]=_0x4837fa[_0xb275('0x11')];this['countcongestionretry']=_0x4837fa[_0xb275('0x12')];this[_0xb275('0x13')]=_0x4837fa[_0xb275('0x13')];this[_0xb275('0x14')]=_0x4837fa[_0xb275('0x14')];this['countdropretry']=_0x4837fa[_0xb275('0x15')];this[_0xb275('0x16')]=_0x4837fa['countabandonedretry'];this[_0xb275('0x17')]=_0x4837fa[_0xb275('0x17')];this['countagentrejectretry']=_0x4837fa[_0xb275('0x18')];this[_0xb275('0x19')]=_0x4837fa[_0xb275('0x19')];this[_0xb275('0x1a')]=_0x4837fa['ListId'];this[_0xb275('0x1b')]=_0x4837fa['UserId'];this[_0xb275('0x1c')]=_0x4837fa['VoiceQueueId'];this[_0xb275('0x1d')]=_0x4837fa[_0xb275('0x1d')];this['idHopper']=_0x4837fa['id'];this[_0xb275('0x1e')]=_0x4837fa[_0xb275('0x7')][_0xb275('0x9')]||'';this[_0xb275('0x1f')]=moment()[_0xb275('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb275('0x21')]=_0x4837fa['callback'];this[_0xb275('0x22')]=_0x4837fa[_0xb275('0x22')];this[_0xb275('0x23')]=_0x4837fa['callbackat'];this[_0xb275('0x24')]=_0x4837fa[_0xb275('0x24')];this['originatecalleridnum']='';this[_0xb275('0x25')]='';}Action[_0xb275('0x26')]['getCaller']=function(){return util[_0xb275('0x20')]('\x22%s\x22\x20<%s>',this[_0xb275('0x6')],this[_0xb275('0x27')]['dialCutDigit']>0x0?this[_0xb275('0xb')][_0xb275('0x28')](this[_0xb275('0x27')]['dialCutDigit']):this[_0xb275('0xb')]);};Action[_0xb275('0x26')]['getQueue']=function(){return this[_0xb275('0xc')];};module[_0xb275('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index fb96e14..aadace1 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb70a=['util','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','number','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0x76ced3,_0x8abc01){var _0x4fea70=function(_0x519c04){while(--_0x519c04){_0x76ced3['push'](_0x76ced3['shift']());}};_0x4fea70(++_0x8abc01);}(_0xb70a,0x160));var _0xab70=function(_0x3c3c3b,_0x52513c){_0x3c3c3b=_0x3c3c3b-0x0;var _0x2f70e3=_0xb70a[_0x3c3c3b];return _0x2f70e3;};'use strict';var util=require(_0xab70('0x0'));var _=require(_0xab70('0x1'));var moment=require(_0xab70('0x2'));function getSeconds(_0x14feaf,_0x434d06){var _0x39f062=moment(_0x14feaf)[_0xab70('0x3')](0x0);var _0x50bcb9=moment(_0x434d06)[_0xab70('0x3')](0x0);return _0x39f062[_0xab70('0x4')](_0x50bcb9,_0xab70('0x5'));}function AgentComplete(_0x48a039,_0xa771c6){this['state']=0x4;this[_0xab70('0x6')]=_0xab70('0x7');this[_0xab70('0x8')]=_0x48a039[_0xab70('0x8')];this['type']=_0x48a039[_0xab70('0x9')];this['campaigntype']=_0x48a039[_0xab70('0x9')]===_0xab70('0xa')?'queue':_0x48a039[_0xab70('0x9')];this[_0xab70('0xb')]=_0x48a039[_0xab70('0xb')];this['countcongestionretry']=_0x48a039[_0xab70('0xc')];this[_0xab70('0xd')]=_0x48a039['countnoanswerretry'];this['countglobal']=_0x48a039[_0xab70('0xb')]+_0x48a039['countcongestionretry']+_0x48a039['countnoanswerretry']+_0x48a039[_0xab70('0xe')]+_0x48a039['countdropretry']+_0x48a039[_0xab70('0xf')]+_0x48a039[_0xab70('0x10')]+_0x48a039[_0xab70('0x11')];this['countnosuchnumberretry']=_0x48a039[_0xab70('0xe')];this[_0xab70('0x12')]=_0x48a039['countdropretry'];this[_0xab70('0xf')]=_0x48a039[_0xab70('0xf')];this[_0xab70('0x10')]=_0x48a039[_0xab70('0x10')];this[_0xab70('0x11')]=_0x48a039[_0xab70('0x11')];this[_0xab70('0x13')]=_0xa771c6['uniqueid'];this['calleridname']=_0x48a039[_0xab70('0x14')];this[_0xab70('0x15')]=_0x48a039[_0xab70('0x16')];this['starttime']=_0x48a039['starttime'];this[_0xab70('0x17')]=_0x48a039[_0xab70('0x17')];this[_0xab70('0x18')]=_0x48a039[_0xab70('0x18')];this[_0xab70('0x19')]=moment()['format'](_0xab70('0x1a'));this[_0xab70('0x1b')]=getSeconds(_0x48a039[_0xab70('0x17')],_0x48a039['starttime']);this['holdtime']=getSeconds(_0x48a039[_0xab70('0x18')],_0x48a039[_0xab70('0x17')]);this[_0xab70('0x1c')]=getSeconds(this[_0xab70('0x19')],_0x48a039[_0xab70('0x18')]);this[_0xab70('0x1d')]=_0xa771c6[_0xab70('0x1d')];this[_0xab70('0x1e')]=_0xa771c6[_0xab70('0x1e')];this[_0xab70('0x1f')]=_0xa771c6[_0xab70('0x1f')];this[_0xab70('0x20')]=_0x48a039['callback'];this[_0xab70('0x21')]=_0x48a039[_0xab70('0x21')];this[_0xab70('0x22')]=_0x48a039[_0xab70('0x22')];this[_0xab70('0x23')]=_0x48a039[_0xab70('0x23')];this[_0xab70('0x24')]=_0x48a039[_0xab70('0x24')];this['ListId']=_0x48a039[_0xab70('0x25')];this[_0xab70('0x26')]=_0x48a039[_0xab70('0x26')];this[_0xab70('0x27')]=_0x48a039[_0xab70('0x27')];this['CampaignId']=_0x48a039[_0xab70('0x28')];this[_0xab70('0x29')]=_0x48a039['originatecalleridnum']||'';this[_0xab70('0x2a')]=_0x48a039[_0xab70('0x2a')]||'';}module[_0xab70('0x2b')]=AgentComplete; \ No newline at end of file +var _0x19b4=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','seconds','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','ringtime','holdtime','endtime','membername','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x32cc68,_0x5d2b21){var _0x472ab1=function(_0x14ff66){while(--_0x14ff66){_0x32cc68['push'](_0x32cc68['shift']());}};_0x472ab1(++_0x5d2b21);}(_0x19b4,0xa2));var _0x419b=function(_0x5c1a97,_0x42e1e3){_0x5c1a97=_0x5c1a97-0x0;var _0x13953e=_0x19b4[_0x5c1a97];return _0x13953e;};'use strict';var util=require(_0x419b('0x0'));var _=require('lodash');var moment=require(_0x419b('0x1'));function getSeconds(_0x2d9062,_0x589661){var _0x2cd934=moment(_0x2d9062)['milliseconds'](0x0);var _0x14c1ab=moment(_0x589661)[_0x419b('0x2')](0x0);return _0x2cd934['diff'](_0x14c1ab,_0x419b('0x3'));}function AgentComplete(_0x217ffb,_0x25d064){this['state']=0x4;this[_0x419b('0x4')]='Answer';this[_0x419b('0x5')]=_0x217ffb['scheduledat'];this[_0x419b('0x6')]=_0x217ffb[_0x419b('0x6')];this[_0x419b('0x7')]=_0x217ffb[_0x419b('0x6')]===_0x419b('0x8')?_0x419b('0x9'):_0x217ffb['type'];this[_0x419b('0xa')]=_0x217ffb['countbusyretry'];this['countcongestionretry']=_0x217ffb[_0x419b('0xb')];this[_0x419b('0xc')]=_0x217ffb['countnoanswerretry'];this['countglobal']=_0x217ffb[_0x419b('0xa')]+_0x217ffb['countcongestionretry']+_0x217ffb['countnoanswerretry']+_0x217ffb[_0x419b('0xd')]+_0x217ffb['countdropretry']+_0x217ffb[_0x419b('0xe')]+_0x217ffb[_0x419b('0xf')]+_0x217ffb['countagentrejectretry'];this[_0x419b('0xd')]=_0x217ffb[_0x419b('0xd')];this['countdropretry']=_0x217ffb['countdropretry'];this[_0x419b('0xe')]=_0x217ffb[_0x419b('0xe')];this[_0x419b('0xf')]=_0x217ffb[_0x419b('0xf')];this[_0x419b('0x10')]=_0x217ffb[_0x419b('0x10')];this['uniqueid']=_0x25d064[_0x419b('0x11')];this[_0x419b('0x12')]=_0x217ffb['name'];this[_0x419b('0x13')]=_0x217ffb[_0x419b('0x14')];this[_0x419b('0x15')]=_0x217ffb[_0x419b('0x15')];this[_0x419b('0x16')]=_0x217ffb['responsetime'];this[_0x419b('0x17')]=_0x217ffb['answertime'];this['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x419b('0x18')]=getSeconds(_0x217ffb[_0x419b('0x16')],_0x217ffb[_0x419b('0x15')]);this[_0x419b('0x19')]=getSeconds(_0x217ffb[_0x419b('0x17')],_0x217ffb[_0x419b('0x16')]);this['talktime']=getSeconds(this[_0x419b('0x1a')],_0x217ffb[_0x419b('0x17')]);this['queue']=_0x25d064[_0x419b('0x9')];this['membername']=_0x25d064[_0x419b('0x1b')];this['reason']=_0x25d064['reason'];this[_0x419b('0x1c')]=_0x217ffb[_0x419b('0x1c')];this['callbackuniqueid']=_0x217ffb[_0x419b('0x1d')];this[_0x419b('0x1e')]=_0x217ffb[_0x419b('0x1e')];this[_0x419b('0x1f')]=_0x217ffb[_0x419b('0x1f')];this[_0x419b('0x20')]=_0x217ffb[_0x419b('0x20')];this[_0x419b('0x21')]=_0x217ffb['ListId'];this[_0x419b('0x22')]=_0x217ffb['UserId'];this['VoiceQueueId']=_0x217ffb[_0x419b('0x23')];this[_0x419b('0x24')]=_0x217ffb[_0x419b('0x24')];this[_0x419b('0x25')]=_0x217ffb[_0x419b('0x25')]||'';this['originatecalleridname']=_0x217ffb[_0x419b('0x26')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 997d860..a904e68 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6d6=['util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0x6b4f52,_0x4a17d1){var _0xa387e5=function(_0x2643b8){while(--_0x2643b8){_0x6b4f52['push'](_0x6b4f52['shift']());}};_0xa387e5(++_0x4a17d1);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x50391f,_0x29212e){_0x50391f=_0x50391f-0x0;var _0x165c27=_0xd6d6[_0x50391f];return _0x165c27;};'use strict';var util=require(_0x6d6d('0x0'));var _=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));function getSeconds(_0x33226e,_0x536523){var _0x2e1aed=moment(_0x33226e)[_0x6d6d('0x3')](0x0);var _0x1b8610=moment(_0x536523)[_0x6d6d('0x3')](0x0);return _0x2e1aed[_0x6d6d('0x4')](_0x1b8610,_0x6d6d('0x5'));}function Final(_0x35a813){this['uniqueid']=_0x35a813[_0x6d6d('0x6')];this[_0x6d6d('0x7')]=_0x35a813[_0x6d6d('0x7')];this[_0x6d6d('0x8')]=_0x35a813[_0x6d6d('0x8')];this[_0x6d6d('0x9')]=_0x35a813[_0x6d6d('0x8')]==='outbound'?'queue':_0x35a813[_0x6d6d('0x8')];this[_0x6d6d('0xa')]=_0x35a813[_0x6d6d('0xa')];this[_0x6d6d('0xb')]=_0x35a813[_0x6d6d('0xb')];this['countnoanswerretry']=_0x35a813[_0x6d6d('0xc')];this[_0x6d6d('0xd')]=_0x35a813['countbusyretry']+_0x35a813['countcongestionretry']+_0x35a813[_0x6d6d('0xc')]+_0x35a813[_0x6d6d('0xe')]+_0x35a813[_0x6d6d('0xf')]+_0x35a813[_0x6d6d('0x10')]+_0x35a813[_0x6d6d('0x11')]+_0x35a813[_0x6d6d('0x12')];this[_0x6d6d('0xe')]=_0x35a813[_0x6d6d('0xe')];this['countdropretry']=_0x35a813[_0x6d6d('0xf')];this[_0x6d6d('0x10')]=_0x35a813[_0x6d6d('0x10')];this[_0x6d6d('0x11')]=_0x35a813[_0x6d6d('0x11')];this['countagentrejectretry']=_0x35a813[_0x6d6d('0x12')];this['queue']=_0x35a813[_0x6d6d('0x13')];this[_0x6d6d('0x14')]=_0x35a813[_0x6d6d('0x14')];this['calleridnum']=_0x35a813['calleridnum'];this[_0x6d6d('0x15')]=_0x35a813[_0x6d6d('0x15')];this[_0x6d6d('0x16')]=_0x35a813[_0x6d6d('0x16')];this['endtime']=_0x35a813['responsetime'];this[_0x6d6d('0x17')]=_0x35a813['ringtime']||0x0;this[_0x6d6d('0x18')]=_0x35a813[_0x6d6d('0x18')]||0x0;this[_0x6d6d('0x19')]=_0x35a813[_0x6d6d('0x19')]||0x0;this[_0x6d6d('0x1a')]=_0x35a813[_0x6d6d('0x1a')];this[_0x6d6d('0x1b')]=_0x35a813[_0x6d6d('0x1b')];this[_0x6d6d('0x1c')]=_0x35a813[_0x6d6d('0x1c')];this[_0x6d6d('0x1d')]=_0x35a813[_0x6d6d('0x1d')];this[_0x6d6d('0x1e')]=_0x35a813[_0x6d6d('0x1e')];this[_0x6d6d('0x1f')]=_0x35a813[_0x6d6d('0x1f')];this[_0x6d6d('0x20')]=_0x35a813['UserId'];this[_0x6d6d('0x21')]=_0x35a813[_0x6d6d('0x21')];this[_0x6d6d('0x22')]=_0x35a813[_0x6d6d('0x22')];this[_0x6d6d('0x23')]=_0x35a813[_0x6d6d('0x23')]||'';this['originatecalleridname']=_0x35a813[_0x6d6d('0x24')]||'';}module[_0x6d6d('0x25')]=Final; \ No newline at end of file +var _0x0c02=['countnosuchnumberretry','countabandonedretry','countmachineretry','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','campaigntype','type','outbound','queue','countbusyretry','countglobal','countcongestionretry','countnoanswerretry','countdropretry','countagentrejectretry'];(function(_0x43ccc3,_0x1ce891){var _0x5ee1a1=function(_0x31e124){while(--_0x31e124){_0x43ccc3['push'](_0x43ccc3['shift']());}};_0x5ee1a1(++_0x1ce891);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x20c0('0x0'));var moment=require(_0x20c0('0x1'));function getSeconds(_0x590c5c,_0x1338cf){var _0x5c8750=moment(_0x590c5c)[_0x20c0('0x2')](0x0);var _0x6d03d0=moment(_0x1338cf)[_0x20c0('0x2')](0x0);return _0x5c8750[_0x20c0('0x3')](_0x6d03d0,_0x20c0('0x4'));}function Final(_0x1474f7){this[_0x20c0('0x5')]=_0x1474f7[_0x20c0('0x5')];this['scheduledat']=_0x1474f7['scheduledat'];this['type']=_0x1474f7['type'];this[_0x20c0('0x6')]=_0x1474f7[_0x20c0('0x7')]===_0x20c0('0x8')?_0x20c0('0x9'):_0x1474f7[_0x20c0('0x7')];this[_0x20c0('0xa')]=_0x1474f7['countbusyretry'];this['countcongestionretry']=_0x1474f7['countcongestionretry'];this['countnoanswerretry']=_0x1474f7['countnoanswerretry'];this[_0x20c0('0xb')]=_0x1474f7[_0x20c0('0xa')]+_0x1474f7[_0x20c0('0xc')]+_0x1474f7[_0x20c0('0xd')]+_0x1474f7['countnosuchnumberretry']+_0x1474f7[_0x20c0('0xe')]+_0x1474f7['countabandonedretry']+_0x1474f7['countmachineretry']+_0x1474f7[_0x20c0('0xf')];this[_0x20c0('0x10')]=_0x1474f7[_0x20c0('0x10')];this[_0x20c0('0xe')]=_0x1474f7[_0x20c0('0xe')];this[_0x20c0('0x11')]=_0x1474f7[_0x20c0('0x11')];this[_0x20c0('0x12')]=_0x1474f7[_0x20c0('0x12')];this['countagentrejectretry']=_0x1474f7[_0x20c0('0xf')];this[_0x20c0('0x9')]=_0x1474f7[_0x20c0('0x9')];this[_0x20c0('0x13')]=_0x1474f7[_0x20c0('0x13')];this[_0x20c0('0x14')]=_0x1474f7['calleridnum'];this['starttime']=_0x1474f7['starttime'];this[_0x20c0('0x15')]=_0x1474f7[_0x20c0('0x15')];this[_0x20c0('0x16')]=_0x1474f7[_0x20c0('0x15')];this['ringtime']=_0x1474f7[_0x20c0('0x17')]||0x0;this[_0x20c0('0x18')]=_0x1474f7[_0x20c0('0x18')]||0x0;this['talktime']=_0x1474f7['talktime']||0x0;this[_0x20c0('0x19')]=_0x1474f7[_0x20c0('0x19')];this[_0x20c0('0x1a')]=_0x1474f7[_0x20c0('0x1a')];this[_0x20c0('0x1b')]=_0x1474f7['callbackat'];this[_0x20c0('0x1c')]=_0x1474f7[_0x20c0('0x1c')];this[_0x20c0('0x1d')]=_0x1474f7[_0x20c0('0x1d')];this['ListId']=_0x1474f7[_0x20c0('0x1e')];this[_0x20c0('0x1f')]=_0x1474f7[_0x20c0('0x1f')];this[_0x20c0('0x20')]=_0x1474f7[_0x20c0('0x20')];this[_0x20c0('0x21')]=_0x1474f7[_0x20c0('0x21')];this['originatecalleridnum']=_0x1474f7[_0x20c0('0x22')]||'';this[_0x20c0('0x23')]=_0x1474f7[_0x20c0('0x23')]||'';}module[_0x20c0('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index da385e6..8d36261 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a2a=['countnosuchnumberretry','countmachineretry','uniqueid','calleridname','calleridnum','starttime','endtime','ringtime','responsetime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','state','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry'];(function(_0x3fd540,_0x384de7){var _0xe53b89=function(_0x2dc21c){while(--_0x2dc21c){_0x3fd540['push'](_0x3fd540['shift']());}};_0xe53b89(++_0x384de7);}(_0x9a2a,0xf0));var _0xa9a2=function(_0xecc93b,_0xc0dab9){_0xecc93b=_0xecc93b-0x0;var _0x5b1795=_0x9a2a[_0xecc93b];return _0x5b1795;};'use strict';var util=require(_0xa9a2('0x0'));var _=require(_0xa9a2('0x1'));var moment=require(_0xa9a2('0x2'));function getSeconds(_0x1b6e30,_0x2ae40b){var _0x4b0987=moment(_0x1b6e30)['milliseconds'](0x0);var _0x9a5335=moment(_0x2ae40b)[_0xa9a2('0x3')](0x0);return _0x4b0987[_0xa9a2('0x4')](_0x9a5335,'seconds');}function Hangup(_0x2223b5,_0x694249){this[_0xa9a2('0x5')]=0x4;this['statedesc']=_0xa9a2('0x6');this[_0xa9a2('0x7')]=_0x2223b5[_0xa9a2('0x7')];this[_0xa9a2('0x8')]=_0x2223b5['type'];this[_0xa9a2('0x9')]=_0x2223b5[_0xa9a2('0x8')]===_0xa9a2('0xa')?'queue':_0x2223b5['type'];this[_0xa9a2('0xb')]=_0x2223b5[_0xa9a2('0xb')];this[_0xa9a2('0xc')]=_0x2223b5[_0xa9a2('0xc')];this[_0xa9a2('0xd')]=_0x2223b5[_0xa9a2('0xd')];this[_0xa9a2('0xe')]=_0x2223b5[_0xa9a2('0xb')]+_0x2223b5[_0xa9a2('0xc')]+_0x2223b5['countnoanswerretry']+_0x2223b5['countnosuchnumberretry']+_0x2223b5[_0xa9a2('0xf')]+_0x2223b5[_0xa9a2('0x10')]+_0x2223b5['countmachineretry']+_0x2223b5[_0xa9a2('0x11')];this[_0xa9a2('0x12')]=_0x2223b5['countnosuchnumberretry'];this[_0xa9a2('0xf')]=_0x2223b5[_0xa9a2('0xf')];this[_0xa9a2('0x10')]=_0x2223b5['countabandonedretry'];this[_0xa9a2('0x13')]=_0x2223b5[_0xa9a2('0x13')];this['countagentrejectretry']=_0x2223b5[_0xa9a2('0x11')];this[_0xa9a2('0x14')]=_0x694249[_0xa9a2('0x14')];this[_0xa9a2('0x15')]=_0x2223b5['name'];this[_0xa9a2('0x16')]=_0x2223b5['number'];this[_0xa9a2('0x17')]=_0x2223b5['starttime'];this['responsetime']=_0x2223b5['responsetime'];this[_0xa9a2('0x18')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xa9a2('0x19')]=getSeconds(_0x2223b5[_0xa9a2('0x1a')],_0x2223b5[_0xa9a2('0x17')]);this[_0xa9a2('0x1b')]=0x0;this[_0xa9a2('0x1c')]=getSeconds(this['endtime'],_0x2223b5[_0xa9a2('0x1a')]);this['queue']=_0x2223b5['queue'];this[_0xa9a2('0x1d')]=_0xa9a2('0x1e');this[_0xa9a2('0x1f')]=_0x694249[_0xa9a2('0x20')];this[_0xa9a2('0x21')]=_0x2223b5[_0xa9a2('0x21')];this[_0xa9a2('0x22')]=_0x2223b5[_0xa9a2('0x22')];this[_0xa9a2('0x23')]=_0x2223b5[_0xa9a2('0x23')];this[_0xa9a2('0x24')]=_0x2223b5['recallme'];this[_0xa9a2('0x25')]=_0x2223b5['ContactId'];this[_0xa9a2('0x26')]=_0x2223b5[_0xa9a2('0x26')];this[_0xa9a2('0x27')]=_0x2223b5[_0xa9a2('0x27')];this[_0xa9a2('0x28')]=_0x2223b5[_0xa9a2('0x28')];this[_0xa9a2('0x29')]=_0x2223b5[_0xa9a2('0x29')];}module[_0xa9a2('0x2a')]=Hangup; \ No newline at end of file +var _0x013d=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x013d,0x126));var _0xd013=function(_0x5af97c,_0x24a49f){_0x5af97c=_0x5af97c-0x0;var _0x3472ae=_0x013d[_0x5af97c];return _0x3472ae;};'use strict';var util=require('util');var _=require(_0xd013('0x0'));var moment=require('moment');function getSeconds(_0x25c490,_0x5a2943){var _0x443e8a=moment(_0x25c490)[_0xd013('0x1')](0x0);var _0x3949f6=moment(_0x5a2943)['milliseconds'](0x0);return _0x443e8a[_0xd013('0x2')](_0x3949f6,_0xd013('0x3'));}function Hangup(_0x4c3a93,_0xf886fc){this[_0xd013('0x4')]=0x4;this[_0xd013('0x5')]=_0xd013('0x6');this['scheduledat']=_0x4c3a93[_0xd013('0x7')];this[_0xd013('0x8')]=_0x4c3a93[_0xd013('0x8')];this[_0xd013('0x9')]=_0x4c3a93['type']===_0xd013('0xa')?_0xd013('0xb'):_0x4c3a93['type'];this['countbusyretry']=_0x4c3a93[_0xd013('0xc')];this[_0xd013('0xd')]=_0x4c3a93['countcongestionretry'];this[_0xd013('0xe')]=_0x4c3a93[_0xd013('0xe')];this[_0xd013('0xf')]=_0x4c3a93['countbusyretry']+_0x4c3a93[_0xd013('0xd')]+_0x4c3a93[_0xd013('0xe')]+_0x4c3a93[_0xd013('0x10')]+_0x4c3a93[_0xd013('0x11')]+_0x4c3a93[_0xd013('0x12')]+_0x4c3a93[_0xd013('0x13')]+_0x4c3a93[_0xd013('0x14')];this['countnosuchnumberretry']=_0x4c3a93['countnosuchnumberretry'];this[_0xd013('0x11')]=_0x4c3a93[_0xd013('0x11')];this[_0xd013('0x12')]=_0x4c3a93[_0xd013('0x12')];this[_0xd013('0x13')]=_0x4c3a93[_0xd013('0x13')];this[_0xd013('0x14')]=_0x4c3a93[_0xd013('0x14')];this[_0xd013('0x15')]=_0xf886fc[_0xd013('0x15')];this[_0xd013('0x16')]=_0x4c3a93[_0xd013('0x17')];this[_0xd013('0x18')]=_0x4c3a93[_0xd013('0x19')];this[_0xd013('0x1a')]=_0x4c3a93[_0xd013('0x1a')];this[_0xd013('0x1b')]=_0x4c3a93[_0xd013('0x1b')];this[_0xd013('0x1c')]=moment()[_0xd013('0x1d')](_0xd013('0x1e'));this[_0xd013('0x1f')]=getSeconds(_0x4c3a93[_0xd013('0x1b')],_0x4c3a93[_0xd013('0x1a')]);this[_0xd013('0x20')]=0x0;this['talktime']=getSeconds(this[_0xd013('0x1c')],_0x4c3a93[_0xd013('0x1b')]);this['queue']=_0x4c3a93[_0xd013('0xb')];this[_0xd013('0x21')]=_0xd013('0x22');this[_0xd013('0x23')]=_0xf886fc['cause-txt'];this['callback']=_0x4c3a93[_0xd013('0x24')];this[_0xd013('0x25')]=_0x4c3a93[_0xd013('0x25')];this[_0xd013('0x26')]=_0x4c3a93[_0xd013('0x26')];this[_0xd013('0x27')]=_0x4c3a93[_0xd013('0x27')];this[_0xd013('0x28')]=_0x4c3a93['ContactId'];this['ListId']=_0x4c3a93[_0xd013('0x29')];this[_0xd013('0x2a')]=_0x4c3a93[_0xd013('0x2a')];this['VoiceQueueId']=_0x4c3a93[_0xd013('0x2b')];this[_0xd013('0x2c')]=_0x4c3a93[_0xd013('0x2c')];}module[_0xd013('0x2d')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index a7a1824..a8203a9 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x848a=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','number','starttime','responsetime','ringtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x848a,0x7c));var _0xa848=function(_0x3e85a4,_0x18c3a9){_0x3e85a4=_0x3e85a4-0x0;var _0x21e7d1=_0x848a[_0x3e85a4];return _0x21e7d1;};'use strict';var util=require(_0xa848('0x0'));var _=require('lodash');var moment=require(_0xa848('0x1'));function getSeconds(_0x4ae5c4,_0x31ed8f){var _0x55d8dd=moment(_0x4ae5c4)[_0xa848('0x2')](0x0);var _0xbf2105=moment(_0x31ed8f)[_0xa848('0x2')](0x0);return _0x55d8dd[_0xa848('0x3')](_0xbf2105,'seconds');}function History(_0x23991e){this[_0xa848('0x4')]=_0x23991e['uniqueid'];this[_0xa848('0x5')]=_0x23991e[_0xa848('0x5')]||undefined;this[_0xa848('0x6')]=_0x23991e[_0xa848('0x6')];this[_0xa848('0x7')]=_0x23991e[_0xa848('0x6')]===_0xa848('0x8')?_0xa848('0x9'):_0x23991e[_0xa848('0x6')];this[_0xa848('0xa')]=_0x23991e[_0xa848('0xa')];this[_0xa848('0xb')]=_0x23991e['countcongestionretry'];this['countnoanswerretry']=_0x23991e[_0xa848('0xc')];this[_0xa848('0xd')]=_0x23991e[_0xa848('0xa')]+_0x23991e[_0xa848('0xb')]+_0x23991e['countnoanswerretry']+_0x23991e[_0xa848('0xe')]+_0x23991e['countdropretry']+_0x23991e['countabandonedretry']+_0x23991e[_0xa848('0xf')]+_0x23991e[_0xa848('0x10')];this[_0xa848('0xe')]=_0x23991e[_0xa848('0xe')];this[_0xa848('0x11')]=_0x23991e[_0xa848('0x11')];this[_0xa848('0x12')]=_0x23991e['countabandonedretry'];this[_0xa848('0xf')]=_0x23991e['countmachineretry'];this[_0xa848('0x10')]=_0x23991e[_0xa848('0x10')];this[_0xa848('0x9')]=_0x23991e[_0xa848('0x9')];this[_0xa848('0x13')]=_0x23991e['name'];this['calleridnum']=_0x23991e[_0xa848('0x14')];this[_0xa848('0x15')]=_0x23991e[_0xa848('0x15')];this[_0xa848('0x16')]=_0x23991e[_0xa848('0x16')];this['endtime']=_0x23991e[_0xa848('0x16')];this[_0xa848('0x17')]=getSeconds(_0x23991e[_0xa848('0x16')],_0x23991e[_0xa848('0x15')]);this[_0xa848('0x18')]=0x0;this[_0xa848('0x19')]=0x0;this[_0xa848('0x1a')]=_0x23991e['callback'];this['callbackuniqueid']=_0x23991e[_0xa848('0x1b')];this[_0xa848('0x1c')]=_0x23991e['callbackat'];this[_0xa848('0x1d')]=_0x23991e[_0xa848('0x1d')];this['ContactId']=_0x23991e[_0xa848('0x1e')];this[_0xa848('0x1f')]=_0x23991e[_0xa848('0x1f')];this[_0xa848('0x20')]=_0x23991e[_0xa848('0x20')];this[_0xa848('0x21')]=_0x23991e[_0xa848('0x21')];this['CampaignId']=_0x23991e[_0xa848('0x22')];this[_0xa848('0x23')]=_0x23991e['originatecalleridnum']||'';this[_0xa848('0x24')]=_0x23991e['originatecalleridname']||'';}module['exports']=History; \ No newline at end of file +var _0x1baa=['name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname'];(function(_0x3d4050,_0x471fc0){var _0x305146=function(_0x1ff15a){while(--_0x1ff15a){_0x3d4050['push'](_0x3d4050['shift']());}};_0x305146(++_0x471fc0);}(_0x1baa,0xf0));var _0xa1ba=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x1baa[_0x4cf98e];return _0x1623ac;};'use strict';var util=require('util');var _=require(_0xa1ba('0x0'));var moment=require(_0xa1ba('0x1'));function getSeconds(_0x3406bf,_0x579aa8){var _0x311250=moment(_0x3406bf)['milliseconds'](0x0);var _0x57305e=moment(_0x579aa8)[_0xa1ba('0x2')](0x0);return _0x311250['diff'](_0x57305e,_0xa1ba('0x3'));}function History(_0x229f8c){this[_0xa1ba('0x4')]=_0x229f8c[_0xa1ba('0x4')];this[_0xa1ba('0x5')]=_0x229f8c[_0xa1ba('0x5')]||undefined;this[_0xa1ba('0x6')]=_0x229f8c[_0xa1ba('0x6')];this['campaigntype']=_0x229f8c[_0xa1ba('0x6')]===_0xa1ba('0x7')?_0xa1ba('0x8'):_0x229f8c[_0xa1ba('0x6')];this[_0xa1ba('0x9')]=_0x229f8c[_0xa1ba('0x9')];this['countcongestionretry']=_0x229f8c[_0xa1ba('0xa')];this[_0xa1ba('0xb')]=_0x229f8c[_0xa1ba('0xb')];this[_0xa1ba('0xc')]=_0x229f8c[_0xa1ba('0x9')]+_0x229f8c[_0xa1ba('0xa')]+_0x229f8c[_0xa1ba('0xb')]+_0x229f8c[_0xa1ba('0xd')]+_0x229f8c[_0xa1ba('0xe')]+_0x229f8c[_0xa1ba('0xf')]+_0x229f8c[_0xa1ba('0x10')]+_0x229f8c[_0xa1ba('0x11')];this[_0xa1ba('0xd')]=_0x229f8c[_0xa1ba('0xd')];this['countdropretry']=_0x229f8c['countdropretry'];this['countabandonedretry']=_0x229f8c[_0xa1ba('0xf')];this[_0xa1ba('0x10')]=_0x229f8c[_0xa1ba('0x10')];this[_0xa1ba('0x11')]=_0x229f8c[_0xa1ba('0x11')];this['queue']=_0x229f8c[_0xa1ba('0x8')];this[_0xa1ba('0x12')]=_0x229f8c[_0xa1ba('0x13')];this[_0xa1ba('0x14')]=_0x229f8c[_0xa1ba('0x15')];this['starttime']=_0x229f8c[_0xa1ba('0x16')];this[_0xa1ba('0x17')]=_0x229f8c[_0xa1ba('0x17')];this[_0xa1ba('0x18')]=_0x229f8c[_0xa1ba('0x17')];this[_0xa1ba('0x19')]=getSeconds(_0x229f8c[_0xa1ba('0x17')],_0x229f8c[_0xa1ba('0x16')]);this['holdtime']=0x0;this[_0xa1ba('0x1a')]=0x0;this['callback']=_0x229f8c['callback'];this[_0xa1ba('0x1b')]=_0x229f8c[_0xa1ba('0x1b')];this[_0xa1ba('0x1c')]=_0x229f8c[_0xa1ba('0x1c')];this[_0xa1ba('0x1d')]=_0x229f8c[_0xa1ba('0x1d')];this['ContactId']=_0x229f8c['ContactId'];this[_0xa1ba('0x1e')]=_0x229f8c[_0xa1ba('0x1e')];this[_0xa1ba('0x1f')]=_0x229f8c['UserId'];this[_0xa1ba('0x20')]=_0x229f8c[_0xa1ba('0x20')];this[_0xa1ba('0x21')]=_0x229f8c[_0xa1ba('0x21')];this[_0xa1ba('0x22')]=_0x229f8c[_0xa1ba('0x22')]||'';this[_0xa1ba('0x23')]=_0x229f8c[_0xa1ba('0x23')]||'';}module[_0xa1ba('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index a30de71..f9aa0be 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 _0xfc75=['run','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','Failure','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','indexOf','true','content','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','power','handlePower','predictive','method\x20not\x20recognized','launchHandleIvr','loggedIn','checkIsTrunkReachable','dialTimezone','[syncQueueSummary]','dialGlobalInterval','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueTimeout','ACTIVE','xcally-motion-dialer','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','toUpper','isTrunkReachable','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','substring','dialCutDigit','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','countnosuchnumberretry','dialNoSuchNumberRetryFrequency','dialMachineRetryFrequency','countagentrejectretry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','handleIvr','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','countReScheduled','RUNNING','[getContactDialer2]','tryOriginatePredictive','[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]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','----\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','bluebird','uuid','moment','../preview/util/util','../../../config/logger','dialer','booked','redis','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./agentComplete','./queueCallerAbandon','./hangup','roundrobin','prototype','enqueue','tail','finally','sequence','preview','campaigns','agents','trunks','maxNumberOriginate','channels','actions','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','bind','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','newexten','varset','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','emit','outbound','answered','available','pTalking','sumBillable','talking','type','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','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','merge','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','string','\x22\x22\x20<>','error','inspect','stack','length','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','sendMessageOneNotActive','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','statedesc','clearZombieChannels','uniqueId','[uniqueid]','[actions]','isNil','Action','status','catch','updateOriginated','voiceQueues','queue','[Dialer][checkChannel][ivr]','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','undefined','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','CampaignId','[emptyContact]','isSuccess','Success','unmonitored','syncVarSet','uniqueid','variable','amdstatus','HANGUP','outboundAnswerCallsDay','HangupInAMD','membername','AMD','custom:amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','Machine','countglobal','amd','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','countmachineretry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','value','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countdropretry','VoiceQueueId','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','syncAgentComplete','reason','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','syncQueueCallerAbandon','droptime','dropreason','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','starttime','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','paused','stateinterface','locked','rrmemory','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','strategy','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xfc75,0xe1));var _0x5fc7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfc75[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x5fc7('0x0'));var _=require(_0x5fc7('0x1'));var BPromise=require(_0x5fc7('0x2'));var uuid=require(_0x5fc7('0x3'));var moment=require(_0x5fc7('0x4'));var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require(_0x5fc7('0x5'));var config=require('../../../config/environment/');var logger=require(_0x5fc7('0x6'))(_0x5fc7('0x7'));var loggerBooked=require(_0x5fc7('0x6'))(_0x5fc7('0x8'));var loggerPredictive=require(_0x5fc7('0x6'))('predictive');var loggerPredictiveCalls=require(_0x5fc7('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x5fc7('0x6'))('syncQueueSummary');var ami=require('../ami');config[_0x5fc7('0x9')]=_['defaults'](config[_0x5fc7('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x5fc7('0xa'))(new Redis(config[_0x5fc7('0x9')]));var cmHopper=require(_0x5fc7('0xb'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x5fc7('0xc'));var voiceQueueRt=require(_0x5fc7('0xd'));var Action=require(_0x5fc7('0xe'));var History=require('./history');var Final=require(_0x5fc7('0xf'));var AgentComplete=require(_0x5fc7('0x10'));var QueueCallerAbandon=require(_0x5fc7('0x11'));var Hangup=require(_0x5fc7('0x12'));var ipAgi=process['env']['XCALLY_IP_AGI']||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0x5fc7('0x13')};var Sequence=function(){};Sequence[_0x5fc7('0x14')][_0x5fc7('0x15')]=function(_0x11e612){this['tail']=this[_0x5fc7('0x16')]?this[_0x5fc7('0x16')][_0x5fc7('0x17')](_0x11e612):_0x11e612();};function Dialer(_0x46590a,_0x51d176){this[_0x5fc7('0x18')]=new Sequence();this[_0x5fc7('0x19')]=_0x51d176;this['voiceQueues']=_0x46590a['voiceQueues'];this[_0x5fc7('0x1a')]=_0x46590a[_0x5fc7('0x1a')];this[_0x5fc7('0x1b')]=_0x46590a[_0x5fc7('0x1b')];this['trunks']=_0x46590a[_0x5fc7('0x1c')];this[_0x5fc7('0x1d')]=config[_0x5fc7('0x1d')]||0x2;this[_0x5fc7('0x1e')]={};this[_0x5fc7('0x1f')]={};this['contactsId']={};this['uniqueId']={};this[_0x5fc7('0x20')]={};this[_0x5fc7('0x21')]={};this[_0x5fc7('0x22')]={};this[_0x5fc7('0x23')]={};this[_0x5fc7('0x24')]={};this[_0x5fc7('0x25')]={};ami['on'](_0x5fc7('0x26'),this[_0x5fc7('0x27')]['bind'](this));ami['on'](_0x5fc7('0x28'),this['syncQueueCallerAbandon'][_0x5fc7('0x29')](this));ami['on'](_0x5fc7('0x2a'),this[_0x5fc7('0x2b')][_0x5fc7('0x29')](this));ami['on'](_0x5fc7('0x2c'),this['syncAgentComplete'][_0x5fc7('0x29')](this));ami['on'](_0x5fc7('0x2d'),this[_0x5fc7('0x2e')][_0x5fc7('0x29')](this));ami['on'](_0x5fc7('0x2f'),this[_0x5fc7('0x30')][_0x5fc7('0x29')](this));ami['on'](_0x5fc7('0x31'),this['syncNewExten']['bind'](this));ami['on'](_0x5fc7('0x32'),this['syncVarSet'][_0x5fc7('0x29')](this));ami['on']('queuemember',this[_0x5fc7('0x33')][_0x5fc7('0x29')](this));ami['on'](_0x5fc7('0x34'),this[_0x5fc7('0x35')][_0x5fc7('0x29')](this));this[_0x5fc7('0x36')]();this[_0x5fc7('0x37')]();}function isNotNull(_0xdbc054){return _0xdbc054!==null&&!_[_0x5fc7('0x38')](_0xdbc054);}function checkIsLoggedIn(_0x52813,_0x58fa14){return function(){if(_0x58fa14<=0x0){_0x52813[_0x5fc7('0x39')]=_0x5fc7('0x3a');throw _0x52813[_0x5fc7('0x3b')]+_0x5fc7('0x3c');}};}function isActive(_0x374612){return _0x374612;}function checkIsActive(_0x879b91,_0x39f476){return function(){if(!isActive(_0x39f476)){_0x879b91[_0x5fc7('0x39')]=_0x5fc7('0x3d');throw _0x879b91['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x8653da){return function(){if(!isNotNull(_0x8653da[_0x5fc7('0x3e')])){_0x8653da[_0x5fc7('0x39')]=_0x5fc7('0x3f');throw _0x8653da[_0x5fc7('0x3b')]+_0x5fc7('0x40');}if(!isNotNull(_0x8653da[_0x5fc7('0x3e')][_0x5fc7('0x41')])){_0x8653da[_0x5fc7('0x39')]=_0x5fc7('0x3f');throw _0x8653da[_0x5fc7('0x3b')]+_0x5fc7('0x40');}if(!isNotNull(_['isEmpty'](_0x8653da['Interval'][_0x5fc7('0x41')]))){_0x8653da['message']=_0x5fc7('0x3f');throw _0x8653da[_0x5fc7('0x3b')]+_0x5fc7('0x40');}};}function msgResponse(_0x2e6faf,_0x3ffb06,_0x169d40){return{'action':_0x2e6faf,'response':_0x3ffb06,'message':_0x169d40,'stack':_0x169d40};}function myreject(_0x542160){return function(_0x4a2d97){return _0x542160(msgResponse(_0x5fc7('0x42'),_0x5fc7('0x43'),JSON[_0x5fc7('0x44')](_0x4a2d97)));};}function getSeconds(_0x3ccb66,_0x51d758){var _0x5357e8=moment(_0x3ccb66)['milliseconds'](0x0);var _0x147764=moment(_0x51d758)[_0x5fc7('0x45')](0x0);return _0x5357e8[_0x5fc7('0x46')](_0x147764,'seconds');}function emit(_0x5f3b23,_0x3ac8e4,_0x2e485){io['to'](_0x5f3b23)[_0x5fc7('0x47')](_0x3ac8e4,_0x2e485);}function emitVoiceQueueSummary(_0x544bbb){if(_0x544bbb['type']===_0x5fc7('0x48')){var _0x27a470={'id':_0x544bbb['id'],'name':_0x544bbb['name'],'strategy':_0x544bbb['strategy'],'answered':_0x544bbb[_0x5fc7('0x49')],'available':_0x544bbb[_0x5fc7('0x4a')],'loggedIn':_0x544bbb['loggedIn'],'pTalking':_0x544bbb[_0x5fc7('0x4b')],'sumBillable':_0x544bbb[_0x5fc7('0x4c')],'sumDuration':_0x544bbb['sumDuration'],'sumHoldTime':_0x544bbb['sumHoldTime']||0x0,'talking':_0x544bbb[_0x5fc7('0x4d')],'total':_0x544bbb['total'],'type':_0x544bbb[_0x5fc7('0x4e')],'unmanaged':_0x544bbb['unmanaged'],'abandoned':_0x544bbb[_0x5fc7('0x4f')],'waiting':_0x544bbb[_0x5fc7('0x50')],'loggedInDb':_0x544bbb['loggedInDb'],'dialActive':_0x544bbb[_0x5fc7('0x51')],'dialMethod':_0x544bbb[_0x5fc7('0x52')],'dialOriginateCallerIdName':_0x544bbb['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x544bbb[_0x5fc7('0x53')],'dialOriginateTimeout':_0x544bbb[_0x5fc7('0x54')],'dialPrefix':_0x544bbb[_0x5fc7('0x55')],'outboundAnswerAgiCallsDay':_0x544bbb[_0x5fc7('0x56')],'outboundAnswerCallsDay':_0x544bbb['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x544bbb['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x544bbb[_0x5fc7('0x57')],'outboundCongestionCallsDay':_0x544bbb[_0x5fc7('0x58')],'outboundDropCallsDayACS':_0x544bbb[_0x5fc7('0x59')],'outboundDropCallsDayCallersExit':_0x544bbb[_0x5fc7('0x5a')],'outboundDropCallsDayTimeout':_0x544bbb[_0x5fc7('0x5b')],'outboundNoAnswerCallsDay':_0x544bbb[_0x5fc7('0x5c')],'outboundNoSuchCallsDay':_0x544bbb['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x544bbb[_0x5fc7('0x5d')],'outboundReCallsDay':_0x544bbb[_0x5fc7('0x5e')],'outboundRejectCallsDay':_0x544bbb[_0x5fc7('0x5f')],'outboundUnknownCallsDay':_0x544bbb[_0x5fc7('0x60')],'predictiveIntervalAnsweredCalls':_0x544bbb['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x544bbb[_0x5fc7('0x61')],'predictiveIntervalAvgTalktime':_0x544bbb['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x544bbb['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x544bbb[_0x5fc7('0x62')],'predictiveIntervalErlangCalls':_0x544bbb['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x544bbb[_0x5fc7('0x63')],'predictiveIntervalHitRate':_0x544bbb[_0x5fc7('0x64')],'predictiveIntervalMultiplicativeFactor':_0x544bbb[_0x5fc7('0x65')],'predictiveIntervalPauses':_0x544bbb[_0x5fc7('0x66')],'predictiveIntervalAvailable':_0x544bbb[_0x5fc7('0x67')],'predictiveIntervalTotalCalls':_0x544bbb[_0x5fc7('0x68')],'message':_0x544bbb[_0x5fc7('0x39')],'originated':_0x544bbb[_0x5fc7('0x69')],'erlangCalls':_0x544bbb[_0x5fc7('0x6a')],'erlangCallToSecond':_0x544bbb[_0x5fc7('0x6b')],'erlangAbandonmentRate':_0x544bbb[_0x5fc7('0x6c')],'erlangBusyFactor':_0x544bbb[_0x5fc7('0x6d')],'startPredictive':_0x544bbb['startPredictive'],'startProgressive':_0x544bbb[_0x5fc7('0x22')]};if(_0x544bbb[_0x5fc7('0x6e')]){_0x27a470[_0x5fc7('0x6e')]={'id':_0x544bbb[_0x5fc7('0x6e')]['id'],'name':_0x544bbb[_0x5fc7('0x6e')]['name'],'active':_0x544bbb[_0x5fc7('0x6e')][_0x5fc7('0x6f')],'callerid':_0x544bbb[_0x5fc7('0x6e')][_0x5fc7('0x70')]};}if(_0x544bbb['Interval']){_0x27a470[_0x5fc7('0x3e')]={'id':_0x544bbb[_0x5fc7('0x3e')]['id'],'name':_0x544bbb[_0x5fc7('0x3e')]['name']};}var _0x468d7e=md5(JSON['stringify'](_0x27a470));if(_0x544bbb[_0x5fc7('0x71')]!==_0x468d7e){_0x544bbb[_0x5fc7('0x71')]=_0x468d7e;emit(util[_0x5fc7('0x72')](_0x5fc7('0x73'),_0x27a470[_0x5fc7('0x3b')]),_0x5fc7('0x74'),_0x27a470);}}}function emitCampaignSummary(_0xae9898){if(_0xae9898['type']===_0x5fc7('0x75')){emit(util[_0x5fc7('0x72')](_0x5fc7('0x76'),_0xae9898[_0x5fc7('0x3b')]),_0x5fc7('0x77'),_0xae9898);}}function checkGetDataPredictive(_0x400d11){if(isNotNull(_0x400d11)&&!_[_0x5fc7('0x78')](_0x400d11)){loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x7a'));loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x7b'),_0x400d11[_0x5fc7('0x68')]);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x7c'),_0x400d11[_0x5fc7('0x7d')]);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x7e'),_0x400d11[_0x5fc7('0x62')]);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x7f'),_0x400d11[_0x5fc7('0x80')]);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x81'),_0x400d11[_0x5fc7('0x61')]);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x82'),_0x400d11[_0x5fc7('0x83')]);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x84'));if(_0x400d11[_0x5fc7('0x68')]>0x0){if(!_['isUndefined'](_0x400d11[_0x5fc7('0x83')])&&_0x400d11[_0x5fc7('0x83')]>0x0){return!![];}loggerPredictive[_0x5fc7('0x79')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x5fc7('0x38')](_0x400d11[_0x5fc7('0x61')])&&_0x400d11[_0x5fc7('0x61')]>0x0){return!![];}loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x85'));}else{loggerPredictive[_0x5fc7('0x79')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x22f630){return function(_0x2f9593){loggerPredictive[_0x5fc7('0x79')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x5fc7('0x86'),_0x2f9593['erlangCalls']);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x87'),_0x2f9593[_0x5fc7('0x6b')]);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x88'),_0x2f9593[_0x5fc7('0x6c')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2f9593['erlangBusyFactor']);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x88'),_0x2f9593[_0x5fc7('0x6c')]);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x84'));_[_0x5fc7('0x89')](_0x22f630,_0x2f9593);};}function getDiff(_0x22ef0d){var _0x3aba20=moment()[_0x5fc7('0x45')](0x0);var _0x5ed4e0=moment(_0x22ef0d)[_0x5fc7('0x45')](0x0);return _0x3aba20[_0x5fc7('0x46')](_0x5ed4e0,_0x5fc7('0x8a'));}function ifInterval(_0x20a45d,_0x18a0fd){if(_[_0x5fc7('0x38')](_0x18a0fd)){return![];}return getDiff(_0x18a0fd)<_0x20a45d*0x3c;}function freeVariablesPredictive(_0x2c46b3){if(isNotNull(_0x2c46b3)){if(!_[_0x5fc7('0x38')](_0x2c46b3['startProgressive'])){_0x2c46b3['startProgressive']=undefined;loggerPredictive[_0x5fc7('0x79')](_0x2c46b3['name'],_0x5fc7('0x8b'));}if(!_[_0x5fc7('0x38')](_0x2c46b3['startPredictive'])){_0x2c46b3[_0x5fc7('0x21')]=undefined;loggerPredictive['info'](_0x2c46b3[_0x5fc7('0x3b')],_0x5fc7('0x8c'));}if(!_[_0x5fc7('0x38')](_0x2c46b3[_0x5fc7('0x8d')])){clearInterval(_0x2c46b3[_0x5fc7('0x8d')]);_0x2c46b3['handlePredictive']=undefined;loggerPredictive[_0x5fc7('0x79')](_0x2c46b3[_0x5fc7('0x3b')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x1790db,_0x31a753){if(_0x31a753===0x0){return 0x0;}var _0x5b0d7a=0x1;for(var _0x29a00c=0x1;_0x29a00c<=_0x31a753;_0x29a00c+=0x1){_0x5b0d7a=0x1+_0x5b0d7a*_0x29a00c/_0x1790db;}return 0x1/_0x5b0d7a;}function isVoiceQueueOutbound(_0x5af29e){return _0x5af29e==='outbound';}function isNotPreview(_0x47d58f){return _0x47d58f!==_0x5fc7('0x19');}function isCampaignIvr(_0x288cfc){return _0x288cfc==='ivr';}function getCallerId(_0x26a34c,_0x16656f,_0x10cf5d){if(!_[_0x5fc7('0x38')](_0x10cf5d)&&typeof _0x10cf5d===_0x5fc7('0x8e')&&!_[_0x5fc7('0x78')](_0x10cf5d)){if(!_[_0x5fc7('0x38')](_0x16656f)&&typeof _0x16656f===_0x5fc7('0x8e')&&!_[_0x5fc7('0x78')](_0x16656f)){return util['format']('\x22%s\x22\x20<%s>',_0x16656f,_0x10cf5d);}return util[_0x5fc7('0x72')]('\x22%s\x22\x20<%s>',_0x10cf5d,_0x10cf5d);}if(!_[_0x5fc7('0x38')](_0x26a34c)&&typeof _0x26a34c==='string'&&!_[_0x5fc7('0x78')](_0x26a34c)){return _0x26a34c;}return _0x5fc7('0x8f');}function loggerCatchQueueSummary(_0x18f7bf,_0x21a668){return function(_0x1ec6e5){freeVariablesPredictive(_0x21a668);emitVoiceQueueSummary(_0x21a668);emitCampaignSummary(_0x21a668);loggerSyncQueueSummary[_0x5fc7('0x90')](_0x18f7bf,util[_0x5fc7('0x91')](_0x1ec6e5,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x29fab1,_0x2bd83f){return function(_0x157b7c){loggerPredictive['error'](_0x2bd83f[_0x5fc7('0x3b')],_0x29fab1);loggerPredictive[_0x5fc7('0x90')](_0x157b7c[_0x5fc7('0x92')]);freeVariablesPredictive(_0x2bd83f);};}function loggerCatch(_0x4beb3d){return function(_0x3ab982){logger[_0x5fc7('0x90')](_0x4beb3d,util['inspect'](_0x3ab982,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2ede0c){return _0x2ede0c&&!_[_0x5fc7('0x38')](_0x2ede0c)&&_0x2ede0c[_0x5fc7('0x93')]>0x0;}function decremetOriginate(_0x8dacdc){if(!_['isUndefined'](_0x8dacdc)&&_0x8dacdc!==null){if(typeof _0x8dacdc[_0x5fc7('0x69')]!=='undefined'){if(_0x8dacdc[_0x5fc7('0x69')]>0x0){_0x8dacdc[_0x5fc7('0x69')]-=0x1;}else{logger[_0x5fc7('0x90')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x5fc7('0x90')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x119a5d,_0x3e3db9,_0x1802b2){if(_0x3e3db9>_0x1802b2){for(var _0x5e0169=0x0;_0x5e0169<_0x3e3db9-_0x1802b2;_0x5e0169+=0x1){decremetOriginate(_0x119a5d);}}}function loggerGetContactDialer(_0xe63193,_0x3f3acd,_0x46c44a){return function(_0xc34646){checkContactLowerLimitOriginate(_0x3f3acd,_0x46c44a,0x0);logger[_0x5fc7('0x90')](_0xe63193,util[_0x5fc7('0x91')](_0xc34646,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x196c27){return function(_0x135191){if(isNotNull(_0x135191)&&isNotNull(_0x135191[0x0])){if(_0x135191[0x0][_0x5fc7('0x94')]>0x0){_0x196c27[_0x5fc7('0x39')]=_0x5fc7('0x95');logger['info'](_0x5fc7('0x96')+_0x196c27[_0x5fc7('0x3b')],_0x135191[0x0][_0x5fc7('0x94')],_0x5fc7('0x97'));}else{_0x196c27[_0x5fc7('0x39')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x5fc7('0x79')]('[getContactDialer2][Empty]'+_0x196c27[_0x5fc7('0x3b')]);}}};}function notSendMessagesQueue(_0x56d0f4){if(_0x56d0f4['sendMessageOneNotActive']){freeVariablesPredictive(_0x56d0f4);if(_0x56d0f4[_0x5fc7('0x69')]===0x0&&_0x56d0f4[_0x5fc7('0x4d')]===0x0&&_0x56d0f4['waiting']===0x0&&(_0x56d0f4[_0x5fc7('0x4b')]||0x0)===0x0){_0x56d0f4[_0x5fc7('0x98')]=![];_0x56d0f4['available']=0x0;_0x56d0f4[_0x5fc7('0x39')]=_0x5fc7('0x3d');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x56d0f4[_0x5fc7('0x3b')],'is\x20not\x20active');}else{_0x56d0f4[_0x5fc7('0x39')]=_0x5fc7('0x99');loggerSyncQueueSummary[_0x5fc7('0x90')](_0x5fc7('0x9a'),_0x56d0f4[_0x5fc7('0x3b')],_0x5fc7('0x9b'));}emitVoiceQueueSummary(_0x56d0f4);}}function notSendMessagesCampaign(_0x414f6a){if(_0x414f6a[_0x5fc7('0x98')]){if(_0x414f6a['originated']===0x0){_0x414f6a[_0x5fc7('0x98')]=![];_0x414f6a[_0x5fc7('0x39')]=_0x5fc7('0x3d');loggerSyncQueueSummary[_0x5fc7('0x90')](_0x5fc7('0x9c'),_0x414f6a[_0x5fc7('0x3b')],_0x5fc7('0x9d'));}else{_0x414f6a[_0x5fc7('0x39')]=_0x5fc7('0x99');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x414f6a[_0x5fc7('0x3b')],_0x5fc7('0x9b'));}emitCampaignSummary(_0x414f6a);}}function createObjHistory(_0x3e226e,_0x370b4c,_0x2260ee,_0x1706f9,_0x191c00){_0x3e226e[_0x5fc7('0x39')]=_0x2260ee;var _0x42b02d=new Action(_0x3e226e,_0x370b4c);var _0x3e7db8=new History(_0x42b02d);_0x3e7db8[_0x5fc7('0x9e')]=_0x1706f9;_0x3e7db8[_0x5fc7('0x9f')]=_0x191c00;_0x3e7db8['endtime']=_0x42b02d['starttime'];return _0x3e7db8;}Dialer[_0x5fc7('0x14')][_0x5fc7('0x37')]=function(){var _0x2f0937=this;setInterval(function(){_0x2f0937[_0x5fc7('0xa0')](_0x2f0937[_0x5fc7('0xa1')],_0x5fc7('0xa2'));_0x2f0937[_0x5fc7('0xa0')](_0x2f0937[_0x5fc7('0x1f')],_0x5fc7('0xa3'));},0x32c8);};Dialer['prototype'][_0x5fc7('0xa0')]=function(_0x44fa29,_0x4c0b72){var _0x6a3f5=this;for(var _0x116416 in _0x44fa29){if(typeof _0x44fa29[_0x116416]!=='undefined'){this[_0x5fc7('0x18')][_0x5fc7('0x15')](function(){if(!_[_0x5fc7('0xa4')](_0x44fa29[_0x116416])){return ami[_0x5fc7('0xa5')]({'action':_0x5fc7('0xa6'),'channel':_0x44fa29[_0x116416]['channel']})[_0x5fc7('0xa7')](function(_0x465795){if(_0x465795[_0x5fc7('0x39')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x44fa29[_0x116416]&&_0x44fa29[_0x116416][_0x5fc7('0x4e')]!==_0x5fc7('0x75')){_0x6a3f5[_0x5fc7('0xa8')](_0x6a3f5[_0x5fc7('0xa9')][_0x44fa29[_0x116416][_0x5fc7('0xaa')]]);logger[_0x5fc7('0x90')]('[Dialer][checkChannel]',_0x4c0b72,_0x116416,_0x44fa29[_0x116416][_0x5fc7('0xaa')]);delete _0x44fa29[_0x116416];}if(_0x44fa29[_0x116416]&&_0x44fa29[_0x116416][_0x5fc7('0x4e')]===_0x5fc7('0x75')){_0x6a3f5[_0x5fc7('0xa8')](_0x6a3f5[_0x5fc7('0x1a')][_0x44fa29[_0x116416][_0x5fc7('0xaa')]]);logger[_0x5fc7('0x90')](_0x5fc7('0xab'),_0x4c0b72,_0x116416,_0x44fa29[_0x116416][_0x5fc7('0xaa')]);delete _0x44fa29[_0x116416];}},0x2328);}});}});}}};Dialer['prototype']['countReScheduled']=function(_0x192711){return BPromise[_0x5fc7('0xac')]()[_0x5fc7('0xad')](cmHopper['countReScheduled'](_0x192711))[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0xae')));};Dialer[_0x5fc7('0x14')][_0x5fc7('0xaf')]=function(_0x14e6f9){return BPromise[_0x5fc7('0xac')]()[_0x5fc7('0xad')](cmHopperBlack[_0x5fc7('0xaf')](_0x14e6f9))['catch'](loggerCatch(_0x5fc7('0xb0')));};Dialer[_0x5fc7('0x14')]['checkIsBlackListIvr']=function(_0x371527){return BPromise[_0x5fc7('0xac')]()[_0x5fc7('0xad')](cmHopperBlack[_0x5fc7('0xb1')](_0x371527))[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0xb2')));};Dialer[_0x5fc7('0x14')][_0x5fc7('0xb3')]=function(_0x5c26bd){return BPromise[_0x5fc7('0xac')]()[_0x5fc7('0xad')](cmHopperHistory[_0x5fc7('0xb4')](_0x5c26bd))[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0xb5')));};Dialer[_0x5fc7('0x14')][_0x5fc7('0xb6')]=function(_0x26ceeb){return BPromise[_0x5fc7('0xac')]()['then'](cmHopper['rescheduleContact'](_0x26ceeb))['catch'](loggerCatch(_0x5fc7('0xb7')));};Dialer[_0x5fc7('0x14')][_0x5fc7('0xb8')]=function(_0xf8535c,_0x1d952e,_0x244b8b){return BPromise[_0x5fc7('0xac')]()[_0x5fc7('0xad')](cmHopper[_0x5fc7('0xb8')](_0xf8535c,_0x1d952e,_0x244b8b))['catch'](loggerCatch(_0x5fc7('0xb9')));};Dialer[_0x5fc7('0x14')][_0x5fc7('0xba')]=function(_0x41e44c,_0x40a80c,_0x1287fb,_0x2c4cd4,_0x3c0d2f){return BPromise[_0x5fc7('0xac')]()[_0x5fc7('0xad')](cmHopper[_0x5fc7('0xba')](_0x41e44c,_0x40a80c,_0x1287fb,_0x2c4cd4))[_0x5fc7('0xa7')](function(_0x3b116b){_0x3c0d2f[_0x5fc7('0xbb')]-=_0x1287fb;_0x3c0d2f[_0x5fc7('0xbb')]=_0x3c0d2f[_0x5fc7('0xbb')]>0x0?_0x3c0d2f['temp']:0x0;loggerCatch(_0x5fc7('0xbc'))(_0x3b116b);});};Dialer[_0x5fc7('0x14')][_0x5fc7('0xbd')]=function(_0x4aa79c,_0x293a5c,_0x2e3d39,_0x2ef7c5){return BPromise[_0x5fc7('0xac')]()[_0x5fc7('0xad')](cmHopper['getContactDialerIvr'](_0x4aa79c,_0x293a5c,_0x2e3d39))[_0x5fc7('0xa7')](function(_0x28d591){_0x2ef7c5[_0x5fc7('0xbb')]-=_0x293a5c;_0x2ef7c5['temp']=_0x2ef7c5[_0x5fc7('0xbb')]>0x0?_0x2ef7c5['temp']:0x0;loggerCatch(_0x5fc7('0xbe'))(_0x28d591);});};Dialer[_0x5fc7('0x14')][_0x5fc7('0xbf')]=function(_0x9706a5){return BPromise[_0x5fc7('0xac')]()[_0x5fc7('0xad')](voiceQueueRt['getVoiceQueueRtPauses'](_0x9706a5))['catch'](loggerCatch(_0x5fc7('0xc0')));};Dialer['prototype']['moveContactManagedDialer']=function(_0x279488){return BPromise[_0x5fc7('0xac')]()[_0x5fc7('0xad')](cmHopper[_0x5fc7('0xc1')](_0x279488))[_0x5fc7('0xa7')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype'][_0x5fc7('0xc2')]=function(_0x2c6f2f){return BPromise[_0x5fc7('0xac')]()[_0x5fc7('0xad')](cmHopperHistory[_0x5fc7('0xc2')](_0x2c6f2f))[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0xc3')));};Dialer['prototype']['updateOriginated']=function(_0x3a45e8){if(!_[_0x5fc7('0x38')](_0x3a45e8)&&_0x3a45e8!==null){if(typeof _0x3a45e8[_0x5fc7('0x69')]!==_0x5fc7('0xc4')){if(_0x3a45e8['originated']>0x0){_0x3a45e8[_0x5fc7('0x69')]-=0x1;}else{logger[_0x5fc7('0x90')](_0x5fc7('0xc5'));}}}else{logger[_0x5fc7('0x90')](_0x5fc7('0xc6'));}};Dialer[_0x5fc7('0x14')][_0x5fc7('0xc7')]=function(_0x5bc71d,_0x5ef3bb){var _0x56f7d5=this;return function(_0x25ac0f){_0x56f7d5[_0x5fc7('0xa8')](_0x5ef3bb);logger[_0x5fc7('0x90')](_0x5bc71d,util[_0x5fc7('0x91')](_0x25ac0f,{'showHidden':![],'depth':null}));};};Dialer[_0x5fc7('0x14')][_0x5fc7('0xc8')]=function(_0x303119,_0x6bb947,_0x77d6fe){var _0x4ed3d0={'state':0x19,'statedesc':_0x5fc7('0xc9')};this['updateOriginated'](_0x6bb947);this[_0x5fc7('0xca')](_[_0x5fc7('0x89')](_0x4ed3d0,_[_0x5fc7('0xcb')](_0x77d6fe,[_0x5fc7('0xcc'),_0x5fc7('0xcd'),_0x5fc7('0xce'),'VoiceQueueId',_0x5fc7('0xcf')])),'[emptyContact][createHistory]',_0x5fc7('0xd0'));logger[_0x5fc7('0x90')](_0x303119);};Dialer['prototype'][_0x5fc7('0xd1')]=function(_0x183f8e){return _0x183f8e===_0x5fc7('0xd2');};Dialer[_0x5fc7('0x14')]['isTrunkReachable']=function(_0x21e2d5){return!_[_0x5fc7('0x38')](_0x21e2d5)&&_0x21e2d5&&!_['isUndefined'](_0x21e2d5[_0x5fc7('0x3b')])&&!_['isUndefined'](_0x21e2d5[_0x5fc7('0x6f')])&&_0x21e2d5['active']&&(this[_0x5fc7('0x1c')][util['format']('SIP/%s',_0x21e2d5[_0x5fc7('0x3b')])]['status']==='reachable'||this[_0x5fc7('0x1c')][util[_0x5fc7('0x72')]('SIP/%s',_0x21e2d5[_0x5fc7('0x3b')])][_0x5fc7('0xa6')]===_0x5fc7('0xd3'));};Dialer['prototype'][_0x5fc7('0xca')]=function(_0x2c14ce,_0x565117,_0x2c8a2c){this[_0x5fc7('0xc2')](_0x2c14ce)[_0x5fc7('0xa7')](loggerCatch(_0x565117));this['moveContactManagedDialer'](_0x2c14ce)[_0x5fc7('0xa7')](loggerCatch(_0x2c8a2c));};Dialer['prototype'][_0x5fc7('0xd4')]=function(_0x4fe9b5){var _0x82d51c=this[_0x5fc7('0xa1')][_0x4fe9b5[_0x5fc7('0xd5')]];var _0x135438;if(!_[_0x5fc7('0xa4')](_0x4fe9b5)&&!_[_0x5fc7('0xa4')](_0x4fe9b5[_0x5fc7('0xd6')])&&!_[_0x5fc7('0xa4')](_0x4fe9b5[_0x5fc7('0xd6')][_0x5fc7('0xd7')])&&_0x4fe9b5['exten']==='xcally-motion-dialer'&&_0x82d51c){if(_0x82d51c[_0x5fc7('0x4e')]!==_0x5fc7('0x75')&&this[_0x5fc7('0xa9')][_0x82d51c['queue']]['dialAMDActive']&&_0x4fe9b5['value']===_0x5fc7('0xd8')){delete this[_0x5fc7('0xa1')][_0x4fe9b5[_0x5fc7('0xd5')]];this[_0x5fc7('0xa8')](this['voiceQueues'][_0x82d51c['queue']]);this[_0x5fc7('0xa9')][_0x82d51c['queue']][_0x5fc7('0xd9')]+=0x1;this[_0x5fc7('0xa9')][_0x82d51c[_0x5fc7('0xaa')]][_0x5fc7('0x56')]+=0x1;_0x135438=new Hangup(_0x82d51c,_0x4fe9b5);_0x135438[_0x5fc7('0x9e')]=0x12;_0x135438[_0x5fc7('0x9f')]=_0x5fc7('0xda');_0x135438[_0x5fc7('0xdb')]=_0x5fc7('0xdc');ami[_0x5fc7('0x47')](_0x5fc7('0xdd'),ut['buildObj'](_0x135438,'amd'));this['saveInDb'](_0x135438,_0x5fc7('0xde'),_0x5fc7('0xdf'));}if(_0x82d51c['type']!==_0x5fc7('0x75')&&this['voiceQueues'][_0x82d51c[_0x5fc7('0xaa')]][_0x5fc7('0xe0')]&&_0x4fe9b5['value']==='MACHINE'){var _0x218d73=this;return new BPromise(function(_0xd01f6b,_0x441052){delete _0x218d73['uniqueId'][_0x4fe9b5['uniqueid']];_0x218d73[_0x5fc7('0xa8')](_0x218d73[_0x5fc7('0xa9')][_0x82d51c[_0x5fc7('0xaa')]]);_0x218d73['voiceQueues'][_0x82d51c[_0x5fc7('0xaa')]][_0x5fc7('0xd9')]+=0x1;_0x218d73[_0x5fc7('0xa9')][_0x82d51c[_0x5fc7('0xaa')]][_0x5fc7('0x56')]+=0x1;var _0x443596=_0x218d73['voiceQueues'][_0x82d51c['queue']];var _0x3264ab=new Hangup(_0x82d51c,_0x4fe9b5);_0x3264ab[_0x5fc7('0x9e')]=0x13;_0x3264ab[_0x5fc7('0x9f')]=_0x5fc7('0xe1');_0x3264ab[_0x5fc7('0xdb')]='AMD';_0x3264ab['countmachineretry']+=0x1;_0x3264ab[_0x5fc7('0xe2')]+=0x1;_0x3264ab[_0x5fc7('0xe3')]=!![];ami[_0x5fc7('0x47')](_0x5fc7('0xdd'),ut[_0x5fc7('0xe4')](_0x3264ab,_0x5fc7('0xe3')));_0x218d73[_0x5fc7('0xc2')](_0x3264ab)['catch'](loggerCatch(_0x5fc7('0xe5')));if(_0x3264ab[_0x5fc7('0xe6')]+_0x3264ab[_0x5fc7('0xe7')]+_0x3264ab[_0x5fc7('0xe8')]+_0x3264ab['countnosuchnumberretry']+_0x3264ab['countdropretry']+_0x3264ab[_0x5fc7('0xe9')]+_0x3264ab['countmachineretry']+_0x3264ab['countagentrejectretry']>=_0x443596[_0x5fc7('0xea')]){_0x218d73[_0x5fc7('0xeb')](_0x3264ab,_0xd01f6b,_0x441052,_0x5fc7('0xec'));}else{if(_0x3264ab[_0x5fc7('0xed')]>=_0x443596[_0x5fc7('0xee')]){_0x218d73[_0x5fc7('0xef')](_0x3264ab,_0xd01f6b,_0x441052,_0x5fc7('0xf0'));}else{_0x218d73[_0x5fc7('0xb6')]({'active':![],'countmachineretry':_0x3264ab['countmachineretry'],'scheduledat':moment()[_0x5fc7('0xf1')](_0x443596['dialMachineRetryFrequency'],_0x5fc7('0xf2'))[_0x5fc7('0x72')](_0x5fc7('0xf3')),'ContactId':_0x3264ab['ContactId'],'ListId':_0x3264ab[_0x5fc7('0xcd')],'VoiceQueueId':_0x3264ab['VoiceQueueId']||undefined,'CampaignId':_0x3264ab[_0x5fc7('0xcf')]||undefined})[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0xf4')));_0xd01f6b({'reschedule':0x1});}}});}if(_0x82d51c[_0x5fc7('0x4e')]==='ivr'&&this[_0x5fc7('0x1a')][_0x82d51c[_0x5fc7('0xaa')]][_0x5fc7('0xe0')]&&_0x4fe9b5[_0x5fc7('0xf5')]==='HANGUP'){delete this[_0x5fc7('0xa1')][_0x4fe9b5[_0x5fc7('0xd5')]];this[_0x5fc7('0xa8')](this['campaigns'][_0x82d51c[_0x5fc7('0xaa')]]);_0x135438=new Hangup(_0x82d51c,_0x4fe9b5);_0x135438[_0x5fc7('0x9e')]=0x12;_0x135438['statedesc']=_0x5fc7('0xda');_0x135438[_0x5fc7('0xdb')]=_0x5fc7('0xdc');ami[_0x5fc7('0x47')](_0x5fc7('0xdd'),ut[_0x5fc7('0xe4')](_0x135438,_0x5fc7('0xe3')));this[_0x5fc7('0xca')](_0x135438,_0x5fc7('0xf6'),_0x5fc7('0xf7'));}if(_0x82d51c[_0x5fc7('0x4e')]===_0x5fc7('0x75')&&this[_0x5fc7('0x1a')][_0x82d51c[_0x5fc7('0xaa')]][_0x5fc7('0xe0')]&&_0x4fe9b5[_0x5fc7('0xf5')]===_0x5fc7('0xf8')){var _0x218d73=this;return new BPromise(function(_0x2a5585,_0x20e801){delete _0x218d73[_0x5fc7('0xa1')][_0x4fe9b5[_0x5fc7('0xd5')]];_0x218d73[_0x5fc7('0xa8')](_0x218d73[_0x5fc7('0x1a')][_0x82d51c[_0x5fc7('0xaa')]]);_0x218d73[_0x5fc7('0x1a')][_0x82d51c[_0x5fc7('0xaa')]][_0x5fc7('0xd9')]+=0x1;_0x218d73['campaigns'][_0x82d51c[_0x5fc7('0xaa')]][_0x5fc7('0x56')]+=0x1;var _0x111f57=_0x218d73[_0x5fc7('0x1a')][_0x82d51c[_0x5fc7('0xaa')]];var _0x52268a=new Hangup(_0x82d51c,_0x4fe9b5);_0x52268a[_0x5fc7('0x9e')]=0x13;_0x52268a['statedesc']=_0x5fc7('0xe1');_0x52268a[_0x5fc7('0xdb')]=_0x5fc7('0xdc');_0x52268a[_0x5fc7('0xed')]+=0x1;_0x52268a[_0x5fc7('0xe2')]+=0x1;_0x52268a[_0x5fc7('0xe3')]=!![];ami['emit'](_0x5fc7('0xdd'),ut['buildObj'](_0x52268a,_0x5fc7('0xe3')));_0x218d73[_0x5fc7('0xc2')](_0x52268a)[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0xe5')));if(_0x52268a[_0x5fc7('0xe6')]+_0x52268a[_0x5fc7('0xe7')]+_0x52268a[_0x5fc7('0xe8')]+_0x52268a['countnosuchnumberretry']+_0x52268a[_0x5fc7('0xf9')]+_0x52268a[_0x5fc7('0xe9')]+_0x52268a[_0x5fc7('0xed')]+_0x52268a['countagentrejectretry']>=_0x111f57['dialGlobalMaxRetry']){_0x218d73[_0x5fc7('0xeb')](_0x52268a,_0x2a5585,_0x20e801,'reason19\x20machine....');}else{if(_0x52268a[_0x5fc7('0xed')]>=_0x111f57[_0x5fc7('0xee')]){_0x218d73[_0x5fc7('0xef')](_0x52268a,_0x2a5585,_0x20e801,_0x5fc7('0xf0'));}else{_0x218d73[_0x5fc7('0xb6')]({'active':![],'countmachineretry':_0x52268a[_0x5fc7('0xed')],'scheduledat':moment()[_0x5fc7('0xf1')](_0x111f57['dialMachineRetryFrequency'],'minutes')[_0x5fc7('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x52268a[_0x5fc7('0xcc')],'ListId':_0x52268a[_0x5fc7('0xcd')],'VoiceQueueId':_0x52268a[_0x5fc7('0xfa')]||undefined,'CampaignId':_0x52268a[_0x5fc7('0xcf')]||undefined})['catch'](loggerCatch(_0x5fc7('0xf4')));_0x2a5585({'reschedule':0x1});}}});}}};Dialer[_0x5fc7('0x14')][_0x5fc7('0x30')]=function(_0x2195f4){var _0x34d224=this['uniqueId'][_0x2195f4[_0x5fc7('0xd5')]];var _0x4edaea=this;var _0x583c1a;if(_0x34d224&&_0x34d224['type']==='ivr'){delete this[_0x5fc7('0xa1')][_0x2195f4[_0x5fc7('0xd5')]];this[_0x5fc7('0xa8')](this[_0x5fc7('0x1a')][_0x34d224['queue']]);this['campaigns'][_0x34d224[_0x5fc7('0xaa')]][_0x5fc7('0xfb')]+=0x1;_0x583c1a=new Hangup(_0x34d224,_0x2195f4);this[_0x5fc7('0xc2')](_0x583c1a)[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0xfc')));this['moveContactManagedDialer'](_0x583c1a)[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0xfd')));}if(_0x34d224&&_0x34d224['type']!==_0x5fc7('0x75')&&isNotNull(this[_0x5fc7('0xa9')][_0x34d224['queue']][_0x5fc7('0xfe')])){delete this[_0x5fc7('0xa1')][_0x2195f4['uniqueid']];this[_0x5fc7('0xa8')](this['voiceQueues'][_0x34d224['queue']]);this[_0x5fc7('0xa9')][_0x34d224[_0x5fc7('0xaa')]][_0x5fc7('0xd9')]+=0x1;this['voiceQueues'][_0x34d224[_0x5fc7('0xaa')]][_0x5fc7('0x56')]+=0x1;_0x583c1a=new Hangup(_0x34d224,_0x2195f4);_0x583c1a['state']=0x10;_0x583c1a[_0x5fc7('0x9f')]=_0x5fc7('0xff');_0x583c1a['membername']=_0x5fc7('0x100');this['createHistory'](_0x583c1a)['catch'](loggerCatch(_0x5fc7('0xfc')));this['moveContactManagedDialer'](_0x583c1a)[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0xfd')));}if(_0x34d224&&_0x34d224[_0x5fc7('0x4e')]!==_0x5fc7('0x75')&&!isNotNull(this[_0x5fc7('0xa9')][_0x34d224[_0x5fc7('0xaa')]][_0x5fc7('0xfe')])){delete this[_0x5fc7('0xa1')][_0x2195f4[_0x5fc7('0xd5')]];this[_0x5fc7('0xa8')](this[_0x5fc7('0xa9')][_0x34d224['queue']]);this[_0x5fc7('0xa9')][_0x34d224[_0x5fc7('0xaa')]][_0x5fc7('0x60')]+=0x1;_0x583c1a=new Hangup(_0x34d224,_0x2195f4);_0x583c1a[_0x5fc7('0x9e')]=0xc;_0x583c1a[_0x5fc7('0x9f')]=_0x2195f4[_0x5fc7('0x101')];_0x583c1a[_0x5fc7('0xdb')]=_0x5fc7('0x102');this[_0x5fc7('0xc2')](_0x583c1a)[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0xfc')));this[_0x5fc7('0xc1')](_0x583c1a)[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0xfd')));}};Dialer[_0x5fc7('0x14')][_0x5fc7('0x103')]=function(_0x1a59bd){var _0x3fc711=this[_0x5fc7('0xa1')][_0x1a59bd[_0x5fc7('0xd5')]];var _0x51bf0c=this;if(this[_0x5fc7('0xa9')][_0x1a59bd['queue']]){if(_0x3fc711&&_0x3fc711[_0x5fc7('0x4e')]!==_0x5fc7('0x75')){delete this[_0x5fc7('0xa1')][_0x1a59bd['uniqueid']];this[_0x5fc7('0xa9')][_0x1a59bd[_0x5fc7('0xaa')]][_0x5fc7('0xd9')]+=0x1;var _0x16eec0=new AgentComplete(_0x3fc711,_0x1a59bd);if(_0x1a59bd[_0x5fc7('0x104')]===_0x5fc7('0x105')){_0x16eec0[_0x5fc7('0x106')]=this['voiceQueues'][_0x1a59bd[_0x5fc7('0xaa')]]['dialQueueProject2']&&this[_0x5fc7('0xa9')][_0x1a59bd['queue']][_0x5fc7('0x107')]?moment()['format'](_0x5fc7('0xf3')):undefined;}this[_0x5fc7('0xc2')](_0x16eec0)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x5fc7('0xc1')](_0x16eec0)[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0x108')));}}};Dialer['prototype'][_0x5fc7('0x27')]=function(_0x590d48){if(this[_0x5fc7('0xa9')][_0x590d48[_0x5fc7('0xaa')]]){if(this[_0x5fc7('0xa1')][_0x590d48[_0x5fc7('0xd5')]]&&this[_0x5fc7('0xa1')][_0x590d48[_0x5fc7('0xd5')]][_0x5fc7('0x4e')]!==_0x5fc7('0x75')){this[_0x5fc7('0xa8')](this[_0x5fc7('0xa9')][_0x590d48[_0x5fc7('0xaa')]]);this[_0x5fc7('0xa1')][_0x590d48[_0x5fc7('0xd5')]][_0x5fc7('0x109')]=moment()['format'](_0x5fc7('0xf3'));}}};Dialer[_0x5fc7('0x14')][_0x5fc7('0x10a')]=function(_0x311b9c){this[_0x5fc7('0xc2')](_0x311b9c)[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0x10b')));this[_0x5fc7('0xc1')](_0x311b9c)[_0x5fc7('0xa7')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer['prototype'][_0x5fc7('0x10c')]=function(_0x45507a){var _0x16bc5a=this[_0x5fc7('0xa1')][_0x45507a[_0x5fc7('0xd5')]];var _0x3a78d5=this;if(this['voiceQueues'][_0x45507a[_0x5fc7('0xaa')]]){if(_0x16bc5a&&_0x16bc5a[_0x5fc7('0x4e')]!==_0x5fc7('0x75')){delete this['uniqueId'][_0x45507a[_0x5fc7('0xd5')]];this[_0x5fc7('0xa8')](this[_0x5fc7('0xa9')][_0x45507a['queue']]);_0x16bc5a['droptime']=moment()[_0x5fc7('0x72')](_0x5fc7('0xf3'));var _0x1ece4a=new QueueCallerAbandon(_0x16bc5a,_0x45507a);if(getSeconds(_0x16bc5a[_0x5fc7('0x10d')],_0x16bc5a['responsetime'])>=_0x16bc5a['dialQueueTimeout']){this[_0x5fc7('0xa9')][_0x45507a[_0x5fc7('0xaa')]][_0x5fc7('0x62')]+=0x1;this['voiceQueues'][_0x45507a[_0x5fc7('0xaa')]][_0x5fc7('0x5b')]+=0x1;this[_0x5fc7('0xa9')][_0x45507a[_0x5fc7('0xaa')]][_0x5fc7('0x63')]+=0x1;_0x1ece4a[_0x5fc7('0x9e')]=0xa;_0x1ece4a['statedesc']='Drop';_0x1ece4a[_0x5fc7('0x10e')]='TIMEOUT';_0x1ece4a['agiafterat']=this[_0x5fc7('0xa9')][_0x45507a[_0x5fc7('0xaa')]][_0x5fc7('0x10f')]?moment()[_0x5fc7('0x72')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x1ece4a['countdropretry']+=0x1;_0x1ece4a['countglobal']+=0x1;if(_0x1ece4a[_0x5fc7('0xf9')]>=this[_0x5fc7('0xa9')][_0x45507a[_0x5fc7('0xaa')]][_0x5fc7('0x110')]){this['queueCallerAbandonCreateState'](_0x1ece4a);}else{this[_0x5fc7('0xb6')]({'active':![],'countdropretry':_0x1ece4a[_0x5fc7('0xf9')],'scheduledat':moment()[_0x5fc7('0xf1')](this[_0x5fc7('0xa9')][_0x45507a['queue']][_0x5fc7('0x111')],_0x5fc7('0xf2'))[_0x5fc7('0x72')](_0x5fc7('0xf3')),'ContactId':_0x16bc5a[_0x5fc7('0xcc')],'ListId':_0x16bc5a[_0x5fc7('0xcd')],'VoiceQueueId':_0x16bc5a[_0x5fc7('0xfa')]||undefined,'CampaignId':_0x16bc5a['CampaignId']||undefined})['catch'](loggerCatch(_0x5fc7('0x112')));var _0x2774b1=new History(_0x1ece4a);_0x2774b1[_0x5fc7('0x9e')]=0xa;_0x2774b1[_0x5fc7('0x9f')]=_0x5fc7('0x113');_0x2774b1[_0x5fc7('0x114')]=moment()['format'](_0x5fc7('0xf3'));_0x2774b1[_0x5fc7('0x115')]=_0x2774b1['starttime'];_0x2774b1['calleridname']=_0x1ece4a[_0x5fc7('0x116')];_0x2774b1[_0x5fc7('0x117')]=_0x1ece4a[_0x5fc7('0x117')];this[_0x5fc7('0xc2')](_0x2774b1)[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0x118')));}}else{this[_0x5fc7('0xa9')][_0x45507a['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x5fc7('0xa9')][_0x45507a[_0x5fc7('0xaa')]][_0x5fc7('0x5a')]+=0x1;_0x1ece4a[_0x5fc7('0x9e')]=0xb;_0x1ece4a[_0x5fc7('0x9f')]=_0x5fc7('0x119');_0x1ece4a['dropreason']=_0x5fc7('0x11a');_0x1ece4a['countabandonedretry']+=0x1;_0x1ece4a[_0x5fc7('0xe2')]+=0x1;if(_0x1ece4a[_0x5fc7('0xe9')]>=this[_0x5fc7('0xa9')][_0x45507a[_0x5fc7('0xaa')]][_0x5fc7('0x11b')]){this[_0x5fc7('0x10a')](_0x1ece4a);}else{this[_0x5fc7('0xb6')]({'active':![],'countabandonedretry':_0x1ece4a['countabandonedretry'],'scheduledat':moment()[_0x5fc7('0xf1')](this[_0x5fc7('0xa9')][_0x45507a['queue']][_0x5fc7('0x11c')],'minutes')['format'](_0x5fc7('0xf3')),'ContactId':_0x16bc5a['ContactId'],'ListId':_0x16bc5a[_0x5fc7('0xcd')],'VoiceQueueId':_0x16bc5a[_0x5fc7('0xfa')]||undefined,'CampaignId':_0x16bc5a[_0x5fc7('0xcf')]||undefined})[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0x11d')));var _0x2774b1=new History(_0x1ece4a);_0x2774b1[_0x5fc7('0x9e')]=0xb;_0x2774b1[_0x5fc7('0x9f')]=_0x5fc7('0x119');_0x2774b1[_0x5fc7('0x114')]=moment()['format'](_0x5fc7('0xf3'));_0x2774b1[_0x5fc7('0x115')]=_0x2774b1['starttime'];_0x2774b1[_0x5fc7('0x116')]=_0x1ece4a['calleridname'];_0x2774b1['calleridnum']=_0x1ece4a['calleridnum'];this['createHistory'](_0x2774b1)[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0x11e')));}}}}};Dialer[_0x5fc7('0x14')][_0x5fc7('0x11f')]=function(_0x56ac7c){if(this['actions'][_0x56ac7c[_0x5fc7('0xd5')]]){this[_0x5fc7('0x1f')][_0x56ac7c[_0x5fc7('0xd5')]][_0x5fc7('0x120')]=_0x56ac7c[_0x5fc7('0x120')];}if(this[_0x5fc7('0xa1')][_0x56ac7c[_0x5fc7('0xd5')]]){this[_0x5fc7('0xa1')][_0x56ac7c['uniqueid']][_0x5fc7('0x120')]=_0x56ac7c[_0x5fc7('0x120')];}};Dialer[_0x5fc7('0x14')][_0x5fc7('0x33')]=function(_0x1025db){if(strategy[this[_0x5fc7('0xa9')][this['actions'][_0x1025db['actionid']][_0x5fc7('0xaa')]]['strategy']]===_0x5fc7('0x13')){if(this[_0x5fc7('0x1f')][_0x1025db[_0x5fc7('0x121')]]&&_['isNil'](this[_0x5fc7('0x1f')][_0x1025db['actionid']]['locked'])&&_0x1025db[_0x5fc7('0xa6')]==='1'&&_0x1025db[_0x5fc7('0x122')]==='0'){if(this[_0x5fc7('0x1b')][_0x1025db[_0x5fc7('0x123')]]){if(!this[_0x5fc7('0x1b')][_0x1025db[_0x5fc7('0x123')]][_0x5fc7('0x124')]){this[_0x5fc7('0x1b')][_0x1025db[_0x5fc7('0x123')]][_0x5fc7('0x124')]=!![];this[_0x5fc7('0x1f')][_0x1025db[_0x5fc7('0x121')]][_0x5fc7('0x124')]=!![];this['actions'][_0x1025db[_0x5fc7('0x121')]]['stateinterface']=_0x1025db[_0x5fc7('0x123')];}}}}else if((strategy[this[_0x5fc7('0xa9')][this[_0x5fc7('0x1f')][_0x1025db[_0x5fc7('0x121')]]['queue']]['strategy']]||_0x5fc7('0x125'))==='rrmemory'){if(this[_0x5fc7('0x1f')][_0x1025db[_0x5fc7('0x121')]]){if(this['agents'][_0x1025db[_0x5fc7('0x123')]]){this[_0x5fc7('0x1f')][_0x1025db[_0x5fc7('0x121')]][_0x5fc7('0x123')]=_0x1025db[_0x5fc7('0x123')];if(_[_0x5fc7('0xa4')](this[_0x5fc7('0x24')][this['actions'][_0x1025db[_0x5fc7('0x121')]][_0x5fc7('0xaa')]])){this[_0x5fc7('0x24')][this[_0x5fc7('0x1f')][_0x1025db[_0x5fc7('0x121')]][_0x5fc7('0xaa')]]=[];}this[_0x5fc7('0x24')][this[_0x5fc7('0x1f')][_0x1025db[_0x5fc7('0x121')]][_0x5fc7('0xaa')]][_0x5fc7('0x126')](_['merge'](_[_0x5fc7('0xcb')](this[_0x5fc7('0x1f')][_0x1025db[_0x5fc7('0x121')]],[_0x5fc7('0x127'),'stateinterface']),{'status':_0x1025db[_0x5fc7('0xa6')],'paused':_0x1025db[_0x5fc7('0x122')]}));}}}};function unlockQueueStatus(_0x1f5ae6,_0x566b70){setTimeout(function(){if(_['isUndefined'](_0x1f5ae6[_0x5fc7('0x128')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x566b70);}_0x1f5ae6[_0x5fc7('0x128')]=!![];loggerBooked['info'](_0x5fc7('0x129'),_0x566b70,JSON[_0x5fc7('0x44')](_[_0x5fc7('0xcb')](_0x1f5ae6,['name',_0x5fc7('0x128')])));},0x1f3);}Dialer['prototype'][_0x5fc7('0x35')]=function(_0x290ee9){var _0x375b13=this;var _0xd1b64a=_0x375b13[_0x5fc7('0xa9')][_0x375b13['actions'][_0x290ee9[_0x5fc7('0x121')]]['queue']];if(strategy[this[_0x5fc7('0xa9')][this[_0x5fc7('0x1f')][_0x290ee9[_0x5fc7('0x121')]][_0x5fc7('0xaa')]][_0x5fc7('0x12a')]]===_0x5fc7('0x13')){if(this[_0x5fc7('0x1f')][_0x290ee9[_0x5fc7('0x121')]]&&this[_0x5fc7('0x1f')][_0x290ee9[_0x5fc7('0x121')]][_0x5fc7('0x123')]){this[_0x5fc7('0x19')]['run'](this[_0x5fc7('0x1f')][_0x290ee9[_0x5fc7('0x121')]][_0x5fc7('0x127')],this[_0x5fc7('0x1f')][_0x290ee9[_0x5fc7('0x121')]][_0x5fc7('0x123')])[_0x5fc7('0xa7')](function(_0x2c4d04){logger[_0x5fc7('0x90')](_0x5fc7('0x12b'),util[_0x5fc7('0x91')](_0x2c4d04,{'showHidden':![],'depth':null}));})[_0x5fc7('0x17')](function(){_0x375b13[_0x5fc7('0xa8')](_0x375b13[_0x5fc7('0xa9')][_0x375b13[_0x5fc7('0x1f')][_0x290ee9[_0x5fc7('0x121')]][_0x5fc7('0xaa')]]);_0x375b13[_0x5fc7('0x1b')][_0x375b13[_0x5fc7('0x1f')][_0x290ee9[_0x5fc7('0x121')]][_0x5fc7('0x123')]][_0x5fc7('0x124')]=![];delete _0x375b13[_0x5fc7('0x1f')][_0x290ee9['actionid']];unlockQueueStatus(_0xd1b64a);});}else{this[_0x5fc7('0xa8')](this[_0x5fc7('0xa9')][this[_0x5fc7('0x1f')][_0x290ee9['actionid']]['queue']]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x290ee9[_0x5fc7('0x121')]][_0x5fc7('0xcc')],'ListId':this[_0x5fc7('0x1f')][_0x290ee9[_0x5fc7('0x121')]][_0x5fc7('0xcd')],'VoiceQueueId':this['actions'][_0x290ee9[_0x5fc7('0x121')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x290ee9[_0x5fc7('0x121')]]['CampaignId']||undefined})['catch'](loggerCatch(_0x5fc7('0x12c')));delete this['actions'][_0x290ee9[_0x5fc7('0x121')]];unlockQueueStatus(_0xd1b64a);}}else if((strategy[this[_0x5fc7('0xa9')][this[_0x5fc7('0x1f')][_0x290ee9[_0x5fc7('0x121')]][_0x5fc7('0xaa')]][_0x5fc7('0x12a')]]||_0x5fc7('0x125'))==='rrmemory'){var _0x1bbe32;if(this[_0x5fc7('0x1f')][_0x290ee9[_0x5fc7('0x121')]]&&!_[_0x5fc7('0x78')](this['queueBooked'][this['actions'][_0x290ee9[_0x5fc7('0x121')]]['queue']])){if(this[_0x5fc7('0x25')][_0x375b13[_0x5fc7('0x1f')][_0x290ee9[_0x5fc7('0x121')]]['queue']]){this[_0x5fc7('0x25')][_0x375b13[_0x5fc7('0x1f')][_0x290ee9[_0x5fc7('0x121')]][_0x5fc7('0xaa')]]=this['queueBookedRR'][this[_0x5fc7('0x1f')][_0x290ee9[_0x5fc7('0x121')]][_0x5fc7('0xaa')]]?this[_0x5fc7('0x25')][this['actions'][_0x290ee9['actionid']][_0x5fc7('0xaa')]]:this[_0x5fc7('0x24')][this[_0x5fc7('0x1f')][_0x290ee9[_0x5fc7('0x121')]][_0x5fc7('0xaa')]]?this[_0x5fc7('0x24')][this[_0x5fc7('0x1f')][_0x290ee9[_0x5fc7('0x121')]]['queue']][_0x5fc7('0x12d')]||0x0:0x0;}this[_0x5fc7('0x24')][this[_0x5fc7('0x1f')][_0x290ee9[_0x5fc7('0x121')]]['queue']][_0x5fc7('0x12d')]=this[_0x5fc7('0x25')][this[_0x5fc7('0x1f')][_0x290ee9[_0x5fc7('0x121')]][_0x5fc7('0xaa')]];for(var _0x2cb858=0x0;_0x2cb858=0x0;})[_0x5fc7('0xa7')](myreject(_0x229bac)));}}else{_0x5f2483[_0x5fc7('0x126')](ami[_0x5fc7('0xa5')]({'action':'command','command':util[_0x5fc7('0x72')]('iftime\x20%s,%s',_0x26e164,!_[_0x5fc7('0x38')](config[_0x5fc7('0x13f')][_0x407e18])?_0x407e18:'')})[_0x5fc7('0xad')](function(_0x211d7f){return _0x211d7f[_0x5fc7('0x148')][_0x5fc7('0x146')](_0x5fc7('0x147'))>=0x0;})[_0x5fc7('0xa7')](myreject(_0x229bac)));}BPromise[_0x5fc7('0x149')](_0x5f2483)[_0x5fc7('0xad')](function(_0x4bc3ce){var _0x5855a3=_['some'](_0x4bc3ce);if(_0x5855a3){return _0x2e2d46(_0x5855a3);}else{_0x1501d6[_0x5fc7('0x39')]=_0x4267b5?_0x5fc7('0x14a'):_0x5fc7('0x14b');return _0x229bac(msgResponse('[ifTime][promiseAll]',_0x5fc7('0x141'),_0x5fc7('0x14c')+_0x4267b5+'\x20'+_0x9825f6+_0x5fc7('0x14d')+util['inspect'](_0x26e164,{'showHidden':![],'depth':null})+_0x5fc7('0x14e')+_0x407e18));}})[_0x5fc7('0xa7')](function(_0xe3efad){return _0x229bac(msgResponse('ifTime',_0x5fc7('0x141'),JSON[_0x5fc7('0x44')](_0xe3efad)));});});};Dialer['prototype'][_0x5fc7('0x14f')]=function(_0x21ed2f){var _0x3cf8bc=this;return function(){switch(_0x21ed2f[_0x5fc7('0x52')]){case _0x5fc7('0x150'):freeVariablesPredictive(_0x21ed2f);_0x3cf8bc['handlePower'](_0x21ed2f,0x1);break;case _0x5fc7('0x151'):freeVariablesPredictive(_0x21ed2f);_0x3cf8bc[_0x5fc7('0x152')](_0x21ed2f,_0x21ed2f['dialPowerLevel']);break;case _0x5fc7('0x153'):_0x3cf8bc['predictive'](_0x21ed2f);break;case _0x5fc7('0x8'):freeVariablesPredictive(_0x21ed2f);_0x3cf8bc[_0x5fc7('0x152')](_0x21ed2f,0x1);break;default:freeVariablesPredictive(_0x21ed2f);logger[_0x5fc7('0x90')]('Queue',_0x21ed2f[_0x5fc7('0x3b')],_0x5fc7('0x154'));}};};Dialer[_0x5fc7('0x14')][_0x5fc7('0x155')]=function(_0x4a90a4){var _0x1188a1=this;return function(){_0x1188a1['handleIvr'](_0x4a90a4);};};Dialer[_0x5fc7('0x14')][_0x5fc7('0x2e')]=function(_0x383ab9){var _0x3f9afa=this;if(isNotPreview(_0x383ab9[_0x5fc7('0x52')])){if(isVoiceQueueOutbound(_0x383ab9[_0x5fc7('0x4e')])&&isActive(_0x383ab9[_0x5fc7('0x51')])){_0x383ab9['sendMessageOneNotActive']=!![];BPromise[_0x5fc7('0xac')]()[_0x5fc7('0xad')](checkIsLoggedIn(_0x383ab9,_0x383ab9[_0x5fc7('0x156')]))['then'](checkIsActive(_0x383ab9,_0x383ab9['dialActive']))[_0x5fc7('0xad')](checkInterval(_0x383ab9))[_0x5fc7('0xad')](_0x3f9afa[_0x5fc7('0x157')](_0x383ab9))['then'](_0x3f9afa[_0x5fc7('0x13a')](_0x383ab9['dialGlobalInterval'],_0x383ab9[_0x5fc7('0x158')],_0x383ab9[_0x5fc7('0x3b')],_0x383ab9))[_0x5fc7('0xad')](_0x3f9afa[_0x5fc7('0x13c')](_0x383ab9[_0x5fc7('0x3e')],_0x383ab9[_0x5fc7('0x158')],_0x383ab9['name'],_0x383ab9))[_0x5fc7('0xad')](_0x3f9afa['checkDialMethod'](_0x383ab9))[_0x5fc7('0xa7')](loggerCatchQueueSummary(_0x5fc7('0x159'),_0x383ab9));}else{notSendMessagesQueue(_0x383ab9);}}else{freeVariablesPredictive(_0x383ab9);}};Dialer[_0x5fc7('0x14')]['syncCampaigns']=function(){var _0x4a4cae=this;var _0x511729;for(var _0x1858fd in this[_0x5fc7('0x1a')]){if(typeof this[_0x5fc7('0x1a')][_0x1858fd]!=='undefined'){_0x511729=this[_0x5fc7('0x1a')][_0x1858fd];if(isCampaignIvr(_0x511729[_0x5fc7('0x4e')])&&isActive(_0x511729[_0x5fc7('0x6f')])){_0x511729[_0x5fc7('0x98')]=!![];BPromise[_0x5fc7('0xac')]()[_0x5fc7('0xad')](checkIsActive(_0x511729,_0x511729['active']))['then'](checkInterval(_0x511729))[_0x5fc7('0xad')](_0x4a4cae[_0x5fc7('0x157')](_0x511729))[_0x5fc7('0xad')](_0x4a4cae[_0x5fc7('0x13a')](_0x511729[_0x5fc7('0x15a')],_0x511729[_0x5fc7('0x158')],_0x511729['name'],_0x511729))['then'](_0x4a4cae[_0x5fc7('0x13c')](_0x511729[_0x5fc7('0x3e')],_0x511729[_0x5fc7('0x158')],_0x511729[_0x5fc7('0x3b')],_0x511729))[_0x5fc7('0xad')](_0x4a4cae[_0x5fc7('0x155')](_0x511729))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x511729));}else{notSendMessagesCampaign(_0x511729);}}}};function getCallerIdRandom(_0x504d38,_0x167bfe){var _0x261995;var _0x1edb0c;var _0x4c2c8a;if(_0x167bfe<=0x0){_0x167bfe=0x1;}_0x261995=new RegExp(_0x5fc7('0x15b')+_0x167bfe+'}$');_0x1edb0c=Math[_0x5fc7('0x15c')](0xa,_0x167bfe-0x1);_0x4c2c8a=Math[_0x5fc7('0x15c')](0xa,_0x167bfe)-0x1;return util[_0x5fc7('0x72')]('%s',_[_0x5fc7('0x15d')](_0x504d38,_0x261995,_[_0x5fc7('0x15e')](_0x1edb0c,_0x4c2c8a)));}function extractCalleridName(_0x161243){var _0x5d9d40=_0x161243[_0x5fc7('0x15f')](/"(.*?)"/);return _0x5d9d40?_0x5d9d40[0x1]:_0x161243;}function extractCalleridNumber(_0x23f82d){var _0x19a82e=_0x23f82d[_0x5fc7('0x15f')](/<(.*?)>/);return _0x19a82e?_0x19a82e[0x1]:_0x23f82d;}Dialer[_0x5fc7('0x14')][_0x5fc7('0x160')]=function(_0x4ff3f8,_0x110df7){var _0x40c94c=this;var _0x8c9b65=uuid['v4']();this['actions'][_0x8c9b65]=new Action(_0x4ff3f8,_0x110df7,_0x8c9b65);return new BPromise(function(_0x2eea1c,_0xd2d22b){if(_[_0x5fc7('0x38')](_0x4ff3f8)&&typeof _0x4ff3f8!==_0x5fc7('0x161')){return _0xd2d22b(msgResponse(_0x5fc7('0x162'),_0x5fc7('0x141'),'voiceQueue\x20is\x20undefine'));}if(_[_0x5fc7('0x38')](_0x110df7[_0x5fc7('0x163')][_0x5fc7('0x164')])||_0x110df7[_0x5fc7('0x163')]['phone']===null){return _0xd2d22b(msgResponse(_0x5fc7('0x162'),_0x5fc7('0x141'),_0x5fc7('0x165')));}var _0x5b2212={'XMD-CALLERID':_0x40c94c[_0x5fc7('0x1f')][_0x8c9b65][_0x5fc7('0x166')](),'XMD-AGI':_0x4ff3f8[_0x5fc7('0xfe')]?util[_0x5fc7('0x72')](_0x5fc7('0x167'),ipAgi,_0x4ff3f8[_0x5fc7('0xfe')]):_0x5fc7('0x168'),'XMD-AGIAFTER':_0x4ff3f8[_0x5fc7('0x10f')]?util['format'](_0x5fc7('0x167'),ipAgi,_0x4ff3f8[_0x5fc7('0x10f')]):_0x5fc7('0x168'),'XMD-QUEUE':_0x4ff3f8[_0x5fc7('0x4e')]===_0x5fc7('0x48')?util[_0x5fc7('0x72')](_0x5fc7('0x169'),_0x4ff3f8[_0x5fc7('0x3b')],_0x4ff3f8['dialQueueOptions']||'',_0x4ff3f8[_0x5fc7('0x107')]?'c':'',_0x4ff3f8[_0x5fc7('0x16a')]||0x3):_0x5fc7('0x168'),'XMD-CONTACTID':_0x110df7[_0x5fc7('0xcc')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x40c94c[_0x5fc7('0x1f')][_0x8c9b65][_0x5fc7('0x166')](),'XMD-AMD':_0x4ff3f8[_0x5fc7('0xe0')]?_0x5fc7('0x16b'):_0x5fc7('0x168'),'XMD-DESTINATION':_0x5fc7('0x16c')};if(_0x4ff3f8[_0x5fc7('0xe0')]){_0x5b2212['XMD-AMDINITIALSILENCE']=_0x4ff3f8['dialAMDInitialSilence']||0x9c4;_0x5b2212[_0x5fc7('0x16d')]=_0x4ff3f8[_0x5fc7('0x16e')]||0x5dc;_0x5b2212['XMD-AMDAFTERGREETINGSILENCE']=_0x4ff3f8[_0x5fc7('0x16f')]||0x320;_0x5b2212[_0x5fc7('0x170')]=_0x4ff3f8['dialAMDTotalAnalysisTime']||0x1388;_0x5b2212[_0x5fc7('0x171')]=_0x4ff3f8[_0x5fc7('0x172')]||0x64;_0x5b2212[_0x5fc7('0x173')]=_0x4ff3f8[_0x5fc7('0x174')]||0x32;_0x5b2212[_0x5fc7('0x175')]=_0x4ff3f8[_0x5fc7('0x176')]||0x3;_0x5b2212[_0x5fc7('0x177')]=_0x4ff3f8['dialAMDSilenceThreshold']||0x100;_0x5b2212[_0x5fc7('0x178')]=_0x4ff3f8[_0x5fc7('0x179')]||0x1388;}if(_0x4ff3f8[_0x5fc7('0x4e')]===_0x5fc7('0x48')){_0x5b2212[_0x5fc7('0x17a')]=_0x110df7[_0x5fc7('0xfa')];}else{_0x5b2212[_0x5fc7('0x17b')]=_0x110df7[_0x5fc7('0xcf')];}for(var _0x44be80 in _0x110df7[_0x5fc7('0x163')]){if(typeof _0x110df7['Contact'][_0x44be80]!=='undefined'){if(isNotNull(_0x110df7[_0x5fc7('0x163')][_0x44be80])&&_0x44be80!=='id'&&_0x44be80!==_0x5fc7('0x17c')&&_0x44be80!=='createdAt'&&_0x44be80!==_0x5fc7('0x17d')){_0x5b2212[util['format'](_0x5fc7('0x17e'),'XMD-',_[_0x5fc7('0x17f')](_0x44be80))]=_0x110df7[_0x5fc7('0x163')][_0x44be80];}}}var _0x1def32=_0x40c94c[_0x5fc7('0x180')](_0x4ff3f8[_0x5fc7('0x6e')])?getCallerId(_0x4ff3f8['Trunk'][_0x5fc7('0x70')],_0x4ff3f8[_0x5fc7('0x181')],_0x4ff3f8[_0x5fc7('0x182')]>0x0?getCallerIdRandom(_0x4ff3f8['dialOriginateCallerIdNumber'],_0x4ff3f8[_0x5fc7('0x182')]):_0x4ff3f8['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x4ff3f8[_0x5fc7('0x137')])?_0x4ff3f8['Trunk'][_0x5fc7('0x70')]:_0x4ff3f8[_0x5fc7('0x137')][_0x5fc7('0x70')],_0x4ff3f8[_0x5fc7('0x181')],_0x4ff3f8[_0x5fc7('0x182')]>0x0?getCallerIdRandom(_0x4ff3f8[_0x5fc7('0x53')],_0x4ff3f8['dialRandomLastDigitCallerIdNumber']):_0x4ff3f8[_0x5fc7('0x53')]);if(_0x1def32){_0x5b2212[_0x5fc7('0x183')]=_0x40c94c[_0x5fc7('0x1f')][_0x8c9b65]['originatecalleridname']=extractCalleridName(_0x1def32);_0x5b2212[_0x5fc7('0x184')]=_0x40c94c['actions'][_0x8c9b65][_0x5fc7('0x185')]=extractCalleridNumber(_0x1def32);}return ami[_0x5fc7('0xa5')]({'actionid':_0x8c9b65,'action':_0x5fc7('0x162'),'channel':_0x40c94c[_0x5fc7('0x180')](_0x4ff3f8[_0x5fc7('0x6e')])?util[_0x5fc7('0x72')](_0x5fc7('0x186'),_0x4ff3f8[_0x5fc7('0x6e')]['name'],isNotNull(_0x4ff3f8[_0x5fc7('0x55')])?_0x4ff3f8[_0x5fc7('0x55')][_0x5fc7('0x187')]()||'':'',_0x4ff3f8['dialCutDigit']>0x0?_0x110df7[_0x5fc7('0x163')]['phone'][_0x5fc7('0x188')](_0x4ff3f8[_0x5fc7('0x189')]):_0x110df7[_0x5fc7('0x163')][_0x5fc7('0x164')]):util[_0x5fc7('0x72')]('SIP/%s/%s%s',_['isNil'](_0x4ff3f8[_0x5fc7('0x137')])?_0x4ff3f8[_0x5fc7('0x6e')][_0x5fc7('0x3b')]:_0x4ff3f8[_0x5fc7('0x137')][_0x5fc7('0x3b')],isNotNull(_0x4ff3f8[_0x5fc7('0x55')])?_0x4ff3f8[_0x5fc7('0x55')][_0x5fc7('0x187')]()||'':'',_0x4ff3f8[_0x5fc7('0x189')]>0x0?_0x110df7[_0x5fc7('0x163')][_0x5fc7('0x164')][_0x5fc7('0x188')](_0x4ff3f8['dialCutDigit']):_0x110df7[_0x5fc7('0x163')][_0x5fc7('0x164')]),'callerid':_0x1def32,'Exten':_0x5fc7('0x16c'),'Context':_0x5fc7('0x18a'),'Priority':'1','variable':_0x5b2212,'timeout':(_0x4ff3f8['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x8c9b65})[_0x5fc7('0xad')](function(_0x137188){return _0x2eea1c(_0x137188);})[_0x5fc7('0xa7')](function(_0x2775e5){_0x4ff3f8[_0x5fc7('0x5d')]+=0x1;var _0x55dcd4=new History(_0x40c94c[_0x5fc7('0x1f')][_0x8c9b65]);logger[_0x5fc7('0x90')](util[_0x5fc7('0x72')](_0x5fc7('0x18b'),JSON[_0x5fc7('0x44')](_0x2775e5)));_0x55dcd4['state']=0xe;_0x55dcd4[_0x5fc7('0x9f')]=_0x5fc7('0x18c');_0x55dcd4['starttime']=moment()[_0x5fc7('0x72')]('YYYY-MM-DD\x20HH:mm:ss');_0x55dcd4[_0x5fc7('0x115')]=_0x55dcd4[_0x5fc7('0x114')];_0x40c94c[_0x5fc7('0xc2')](_0x55dcd4)[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0x18d')));_0x40c94c[_0x5fc7('0xc1')](_0x55dcd4)[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0x18d')))[_0x5fc7('0x17')](function(){delete _0x40c94c[_0x5fc7('0x1f')][_0x8c9b65];return _0xd2d22b(msgResponse(_0x5fc7('0x162'),_0x5fc7('0x43'),_0x5fc7('0x18e')));});});});};Dialer[_0x5fc7('0x14')][_0x5fc7('0x2b')]=function(_0x1f659f){var _0xdfac0b=this[_0x5fc7('0x1f')][_0x1f659f[_0x5fc7('0x121')]];if(_0xdfac0b){delete this[_0x5fc7('0x1f')][_0x1f659f[_0x5fc7('0x121')]];_0xdfac0b['responsetime']=moment()[_0x5fc7('0x72')](_0x5fc7('0xf3'));var _0x6d7b51=_0xdfac0b[_0x5fc7('0x4e')]===_0x5fc7('0x75')?this['campaigns'][_0xdfac0b[_0x5fc7('0xaa')]]:this[_0x5fc7('0xa9')][_0xdfac0b[_0x5fc7('0x18f')]()];if(!this[_0x5fc7('0xd1')](_0x1f659f['response'])){this[_0x5fc7('0xa8')](_0x6d7b51);return this[_0x5fc7('0x190')](_0xdfac0b,_0x6d7b51,_0x1f659f)[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0x191')));}this[_0x5fc7('0xa1')][_0x1f659f[_0x5fc7('0xd5')]]=_0xdfac0b;}};Dialer['prototype'][_0x5fc7('0x192')]=function(_0x1f959f,_0x4af628,_0x3dd4bc){var _0x37f642=new History(_0x4af628);if(_0x37f642[_0x5fc7('0xe6')]+_0x37f642[_0x5fc7('0xe7')]+_0x37f642[_0x5fc7('0xe8')]+_0x37f642['countnosuchnumberretry']+_0x37f642[_0x5fc7('0xf9')]+_0x37f642[_0x5fc7('0xe9')]+_0x37f642[_0x5fc7('0xed')]+_0x37f642['countagentrejectretry']>=_0x3dd4bc[_0x5fc7('0xea')]-0x1){return!![];}switch(_0x1f959f){case 0x3:if(_0x37f642['countnoanswerretry']>=_0x3dd4bc[_0x5fc7('0x193')]-0x1){return!![];}this[_0x5fc7('0xb6')]({'active':![],'countnoanswerretry':_0x37f642['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x5fc7('0xf1')](_0x3dd4bc['dialNoAnswerRetryFrequency'],'minutes')['format'](_0x5fc7('0xf3')),'ContactId':_0x37f642[_0x5fc7('0xcc')],'ListId':_0x37f642[_0x5fc7('0xcd')],'VoiceQueueId':_0x37f642[_0x5fc7('0xfa')]||undefined,'CampaignId':_0x37f642[_0x5fc7('0xcf')]||undefined})['catch'](loggerCatch(_0x5fc7('0x194')));break;case 0x5:if(_0x37f642[_0x5fc7('0xe6')]>=_0x3dd4bc[_0x5fc7('0x195')]-0x1){return!![];}this[_0x5fc7('0xb6')]({'active':![],'countbusyretry':_0x37f642[_0x5fc7('0xe6')]+=0x1,'scheduledat':moment()[_0x5fc7('0xf1')](_0x3dd4bc[_0x5fc7('0x196')],_0x5fc7('0xf2'))[_0x5fc7('0x72')](_0x5fc7('0xf3')),'ContactId':_0x37f642[_0x5fc7('0xcc')],'ListId':_0x37f642[_0x5fc7('0xcd')],'VoiceQueueId':_0x37f642[_0x5fc7('0xfa')]||undefined,'CampaignId':_0x37f642[_0x5fc7('0xcf')]||undefined})[_0x5fc7('0xa7')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x37f642[_0x5fc7('0xe7')]>=_0x3dd4bc[_0x5fc7('0x197')]-0x1){return!![];}this[_0x5fc7('0xb6')]({'active':![],'countcongestionretry':_0x37f642[_0x5fc7('0xe7')]+=0x1,'scheduledat':moment()['add'](_0x3dd4bc['dialCongestionRetryFrequency'],'minutes')['format'](_0x5fc7('0xf3')),'ContactId':_0x37f642[_0x5fc7('0xcc')],'ListId':_0x37f642[_0x5fc7('0xcd')],'VoiceQueueId':_0x37f642[_0x5fc7('0xfa')]||undefined,'CampaignId':_0x37f642[_0x5fc7('0xcf')]||undefined})[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0x198')));break;case 0x0:if(_0x37f642[_0x5fc7('0x199')]>=_0x3dd4bc['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x5fc7('0xb6')]({'active':![],'countnosuchnumberretry':_0x37f642[_0x5fc7('0x199')]+=0x1,'scheduledat':moment()[_0x5fc7('0xf1')](_0x3dd4bc[_0x5fc7('0x19a')],_0x5fc7('0xf2'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x37f642[_0x5fc7('0xcc')],'ListId':_0x37f642['ListId'],'VoiceQueueId':_0x37f642['VoiceQueueId']||undefined,'CampaignId':_0x37f642['CampaignId']||undefined})[_0x5fc7('0xa7')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x37f642['countdropretry']>=_0x3dd4bc[_0x5fc7('0x110')]-0x1){return!![];}this[_0x5fc7('0xb6')]({'active':![],'countdropretry':_0x37f642[_0x5fc7('0xf9')]+=0x1,'scheduledat':moment()[_0x5fc7('0xf1')](_0x3dd4bc[_0x5fc7('0x111')],_0x5fc7('0xf2'))[_0x5fc7('0x72')](_0x5fc7('0xf3')),'ContactId':_0x37f642[_0x5fc7('0xcc')],'ListId':_0x37f642[_0x5fc7('0xcd')],'VoiceQueueId':_0x37f642[_0x5fc7('0xfa')]||undefined,'CampaignId':_0x37f642[_0x5fc7('0xcf')]||undefined})[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0x112')));break;case 0xb:if(_0x37f642[_0x5fc7('0xe9')]>=_0x3dd4bc[_0x5fc7('0x11b')]-0x1){return!![];}this[_0x5fc7('0xb6')]({'active':![],'countabandonedretry':_0x37f642[_0x5fc7('0xe9')]+=0x1,'scheduledat':moment()[_0x5fc7('0xf1')](_0x3dd4bc['dialAbandonedRetryFrequency'],_0x5fc7('0xf2'))[_0x5fc7('0x72')](_0x5fc7('0xf3')),'ContactId':_0x37f642['ContactId'],'ListId':_0x37f642[_0x5fc7('0xcd')],'VoiceQueueId':_0x37f642[_0x5fc7('0xfa')]||undefined,'CampaignId':_0x37f642[_0x5fc7('0xcf')]||undefined})[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0x11d')));break;case 0x13:if(_0x37f642[_0x5fc7('0xed')]>=_0x3dd4bc['dialMachineMaxRetry']-0x1){return!![];}this[_0x5fc7('0xb6')]({'active':![],'countmachineretry':_0x37f642[_0x5fc7('0xed')]+=0x1,'scheduledat':moment()[_0x5fc7('0xf1')](_0x3dd4bc[_0x5fc7('0x19b')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x37f642[_0x5fc7('0xcc')],'ListId':_0x37f642[_0x5fc7('0xcd')],'VoiceQueueId':_0x37f642[_0x5fc7('0xfa')]||undefined,'CampaignId':_0x37f642[_0x5fc7('0xcf')]||undefined})[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0xf4')));break;case 0x14:if(_0x37f642[_0x5fc7('0x19c')]>=_0x3dd4bc[_0x5fc7('0x19d')]-0x1){return!![];}this[_0x5fc7('0xb6')]({'active':![],'countagentrejectretry':_0x37f642[_0x5fc7('0x19c')]+=0x1,'scheduledat':moment()['add'](_0x3dd4bc[_0x5fc7('0x19e')],_0x5fc7('0xf2'))['format'](_0x5fc7('0xf3')),'ContactId':_0x37f642[_0x5fc7('0xcc')],'ListId':_0x37f642[_0x5fc7('0xcd')],'VoiceQueueId':_0x37f642[_0x5fc7('0xfa')]||undefined,'CampaignId':_0x37f642[_0x5fc7('0xcf')]||undefined})['catch'](loggerCatch(_0x5fc7('0x19f')));break;default:return!![];}};Dialer[_0x5fc7('0x14')][_0x5fc7('0x190')]=function(_0x39b7dc,_0x4f8994,_0x407349){var _0x25bc6f=this;var _0x2ab6f5=new History(_0x39b7dc);return new BPromise(function(_0xe94a06,_0xcb6acd){if(_[_0x5fc7('0x38')](_0x4f8994)&&typeof _0x4f8994!==_0x5fc7('0x161')){return _0xcb6acd(msgResponse(_0x5fc7('0x1a0'),_0x5fc7('0x141'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x407349)&&typeof _0x407349!=='object'){return _0xcb6acd(msgResponse('[callProgressDetecting]',_0x5fc7('0x141'),_0x5fc7('0x1a1')));}switch(_0x407349[_0x5fc7('0x104')]){case'0':_0x4f8994[_0x5fc7('0x1a2')]+=0x1;_0x2ab6f5['state']=0x0;_0x2ab6f5['statedesc']='NoSuchNumber';_0x2ab6f5[_0x5fc7('0x199')]+=0x1;_0x2ab6f5['countglobal']+=0x1;ami[_0x5fc7('0x47')](_0x5fc7('0x1a3'),ut['buildObj'](_0x39b7dc,_0x5fc7('0x1a4')));_0x25bc6f[_0x5fc7('0xc2')](_0x2ab6f5)[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0xe5')));if(_0x25bc6f['checkRetriveMax'](0x0,_0x39b7dc,_0x4f8994)){if(_0x2ab6f5[_0x5fc7('0x199')]>=_0x4f8994['dialNoSuchNumberMaxRetry']){_0x25bc6f[_0x5fc7('0xef')](_0x2ab6f5,_0xe94a06,_0xcb6acd,_0x5fc7('0x1a5'));}else{_0x25bc6f['stateGlobal'](_0x2ab6f5,_0xe94a06,_0xcb6acd,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x4f8994['outboundNoAnswerCallsDay']+=0x1;_0x2ab6f5[_0x5fc7('0x9e')]=0x3;_0x2ab6f5['statedesc']=_0x5fc7('0x1a6');_0x2ab6f5['countnoanswerretry']+=0x1;_0x2ab6f5[_0x5fc7('0xe2')]+=0x1;ami[_0x5fc7('0x47')](_0x5fc7('0x1a7'),ut[_0x5fc7('0xe4')](_0x39b7dc,'noanswer'));_0x25bc6f[_0x5fc7('0xc2')](_0x2ab6f5)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x25bc6f[_0x5fc7('0x192')](0x3,_0x39b7dc,_0x4f8994)){if(_0x2ab6f5[_0x5fc7('0xe8')]>=_0x4f8994[_0x5fc7('0x193')]){_0x25bc6f[_0x5fc7('0xef')](_0x2ab6f5,_0xe94a06,_0xcb6acd,'reason\x203\x20ringing\x20no\x20answer');}else{_0x25bc6f[_0x5fc7('0xeb')](_0x2ab6f5,_0xe94a06,_0xcb6acd,_0x5fc7('0x1a8'));}}break;case'5':_0x4f8994[_0x5fc7('0x57')]+=0x1;_0x2ab6f5['state']=0x5;_0x2ab6f5[_0x5fc7('0x9f')]=_0x5fc7('0x1a9');_0x2ab6f5[_0x5fc7('0xe6')]+=0x1;_0x2ab6f5[_0x5fc7('0xe2')]+=0x1;ami[_0x5fc7('0x47')](_0x5fc7('0x1aa'),ut[_0x5fc7('0xe4')](_0x39b7dc,_0x5fc7('0x1ab')));_0x25bc6f[_0x5fc7('0xc2')](_0x2ab6f5)['catch'](loggerCatch(_0x5fc7('0x1ac')));if(_0x25bc6f[_0x5fc7('0x192')](0x5,_0x39b7dc,_0x4f8994)){if(_0x2ab6f5['countbusyretry']>=_0x4f8994[_0x5fc7('0x195')]){_0x25bc6f[_0x5fc7('0xef')](_0x2ab6f5,_0xe94a06,_0xcb6acd,_0x5fc7('0x1ad'));}else{_0x25bc6f[_0x5fc7('0xeb')](_0x2ab6f5,_0xe94a06,_0xcb6acd,_0x5fc7('0x1ad'));}}break;case'8':_0x4f8994['outboundCongestionCallsDay']+=0x1;_0x2ab6f5[_0x5fc7('0x9e')]=0x8;_0x2ab6f5['statedesc']=_0x5fc7('0x1ae');_0x2ab6f5[_0x5fc7('0xe7')]+=0x1;_0x2ab6f5[_0x5fc7('0xe2')]+=0x1;ami[_0x5fc7('0x47')](_0x5fc7('0x1af'),ut[_0x5fc7('0xe4')](_0x39b7dc,'congestion'));_0x25bc6f[_0x5fc7('0xc2')](_0x2ab6f5)[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0x1b0')));if(_0x25bc6f[_0x5fc7('0x192')](0x8,_0x39b7dc,_0x4f8994)){if(_0x2ab6f5['countcongestionretry']>=_0x4f8994[_0x5fc7('0x197')]){_0x25bc6f['createStateFinal'](_0x2ab6f5,_0xe94a06,_0xcb6acd,_0x5fc7('0x1b1'));}else{_0x25bc6f[_0x5fc7('0xeb')](_0x2ab6f5,_0xe94a06,_0xcb6acd,_0x5fc7('0x1b1'));}}break;case'11':_0x4f8994[_0x5fc7('0x1b2')]+=0x1;_0x2ab6f5[_0x5fc7('0x9e')]=0xb;_0x2ab6f5[_0x5fc7('0x9f')]=_0x5fc7('0x119');_0x2ab6f5[_0x5fc7('0xe9')]+=0x1;_0x2ab6f5['countglobal']+=0x1;_0x25bc6f[_0x5fc7('0xc2')](_0x2ab6f5)['catch'](loggerCatch(_0x5fc7('0x11e')));if(_0x25bc6f[_0x5fc7('0x192')](0xb,_0x39b7dc,_0x4f8994)){if(_0x2ab6f5[_0x5fc7('0xe9')]>=_0x4f8994[_0x5fc7('0x11b')]){_0x25bc6f[_0x5fc7('0xef')](_0x2ab6f5,_0xe94a06,_0xcb6acd,'reason\x2011\x20abandoned');}else{_0x25bc6f['stateGlobal'](_0x2ab6f5,_0xe94a06,_0xcb6acd,'reason\x2011\x20abandoned');}}break;case'20':_0x4f8994['outboundRejectCallsDay']+=0x1;_0x2ab6f5[_0x5fc7('0x9e')]=0x14;_0x2ab6f5[_0x5fc7('0x9f')]=_0x5fc7('0x1b3');_0x2ab6f5['countagentrejectretry']+=0x1;_0x2ab6f5[_0x5fc7('0xe2')]+=0x1;ami['emit'](_0x5fc7('0x1b4'),ut['buildObj'](_0x39b7dc,_0x5fc7('0x1b5')));_0x25bc6f['createHistory'](_0x2ab6f5)[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0x1b6')));if(_0x25bc6f[_0x5fc7('0x192')](0x14,_0x39b7dc,_0x4f8994)){if(_0x2ab6f5[_0x5fc7('0x19c')]>=_0x4f8994['dialAgentRejectMaxRetry']){_0x25bc6f[_0x5fc7('0xef')](_0x2ab6f5,_0xe94a06,_0xcb6acd,'reason\x2020\x20agentreject');}else{_0x25bc6f[_0x5fc7('0xeb')](_0x2ab6f5,_0xe94a06,_0xcb6acd,_0x5fc7('0x1b7'));}}break;default:_0x4f8994[_0x5fc7('0x60')]+=0x1;_0x2ab6f5[_0x5fc7('0x9e')]=0xc;_0x2ab6f5[_0x5fc7('0x9f')]=_0x407349[_0x5fc7('0x104')];_0x25bc6f['createHistory'](_0x2ab6f5)[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0x1b8')));if(_0x25bc6f[_0x5fc7('0x192')](_0x407349[_0x5fc7('0x104')],_0x39b7dc,_0x4f8994)){if(_0x2ab6f5[_0x5fc7('0xe6')]+_0x2ab6f5[_0x5fc7('0xe7')]+_0x2ab6f5[_0x5fc7('0xe8')]+_0x2ab6f5[_0x5fc7('0x199')]+_0x2ab6f5[_0x5fc7('0xf9')]+_0x2ab6f5['countabandonedretry']+_0x2ab6f5[_0x5fc7('0xed')]+_0x2ab6f5[_0x5fc7('0x19c')]>=_0x4f8994[_0x5fc7('0xea')]){_0x25bc6f[_0x5fc7('0xeb')](_0x2ab6f5,_0xe94a06,_0xcb6acd,_0x407349['reason']);}else{_0x25bc6f['createStateFinal'](_0x2ab6f5,_0xe94a06,_0xcb6acd,_0x407349[_0x5fc7('0x104')]);}}}});};Dialer[_0x5fc7('0x14')]['stateGlobal']=function(_0x5a57cf,_0x5ce88b,_0x44399f,_0x49d842){var _0x1efebf=new Final(_0x5a57cf);_0x1efebf[_0x5fc7('0x9e')]=0xf;_0x1efebf[_0x5fc7('0x9f')]=_0x5fc7('0x1b9');this[_0x5fc7('0xef')](_0x1efebf,_0x5ce88b,_0x44399f,_0x49d842);};Dialer[_0x5fc7('0x14')][_0x5fc7('0xef')]=function(_0x93432a,_0x5da988,_0x15646a,_0x408d8e){this[_0x5fc7('0xc1')](_0x93432a)[_0x5fc7('0xad')](function(){return _0x5da988(msgResponse(_0x5fc7('0x1a0'),'Success',_0x408d8e));})['catch'](function(){return _0x15646a(msgResponse(_0x5fc7('0x1ba'),_0x5fc7('0x141'),_0x5fc7('0x1bb')));});};Dialer['prototype'][_0x5fc7('0x153')]=function(_0x49c28e){var _0x2eb1c9=_0x49c28e[_0x5fc7('0x1bc')]/0x64;var _0x3439ba=_0x49c28e[_0x5fc7('0x5b')]/(_0x49c28e['outboundDropCallsDayTimeout']+_0x49c28e[_0x5fc7('0xd9')]);var _0x5afda3=Math[_0x5fc7('0x1bd')](_0x49c28e[_0x5fc7('0x67')]*(_0x49c28e[_0x5fc7('0x1be')]/0x64));var _0x2e2c9f=Math[_0x5fc7('0x1bd')](_0x49c28e[_0x5fc7('0x67')]*(_0x49c28e[_0x5fc7('0x1bf')]/0x64));var _0x4abe17=_0x49c28e[_0x5fc7('0x4a')]+_0x49c28e[_0x5fc7('0x4d')];var _0x3d3f06=Math[_0x5fc7('0x1c0')](_0x49c28e[_0x5fc7('0x6a')]*_0x49c28e[_0x5fc7('0x6c')]*_0x49c28e[_0x5fc7('0x64')]*_0x49c28e[_0x5fc7('0x65')]);if(_[_0x5fc7('0x38')](_0x49c28e['startProgressive'])){if(!_[_0x5fc7('0x38')](_0x49c28e[_0x5fc7('0x21')])){_0x49c28e[_0x5fc7('0x21')]=undefined;loggerPredictive[_0x5fc7('0x90')](_0x5fc7('0x1c1'),_0x5fc7('0x1c2'));}if(!_['isUndefined'](_0x49c28e[_0x5fc7('0x8d')])){loggerPredictive[_0x5fc7('0x90')](_0x5fc7('0x1c1'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x49c28e[_0x5fc7('0x8d')]);_0x49c28e[_0x5fc7('0x8d')]=undefined;}_0x49c28e[_0x5fc7('0x22')]=moment()[_0x5fc7('0x72')](_0x5fc7('0xf3'));loggerPredictive['info'](_0x49c28e[_0x5fc7('0x3b')],'collection\x20data\x20in\x20progressive\x20at',_0x49c28e[_0x5fc7('0x22')]);this[_0x5fc7('0x152')](_0x49c28e,0x1);}else if(ifInterval(_0x49c28e[_0x5fc7('0x1c3')],_0x49c28e[_0x5fc7('0x22')])){this[_0x5fc7('0x152')](_0x49c28e,0x1);loggerPredictiveCalls[_0x5fc7('0x79')]('[startMethodPredictive][StartProgressive][Loop]',_0x49c28e['startProgressive'],_0x49c28e[_0x5fc7('0x3b')]);_0x49c28e[_0x5fc7('0x6a')]=0x0;_0x49c28e[_0x5fc7('0x63')]=0x0;}else if(_0x2eb1c9<_0x3439ba&&_0x49c28e[_0x5fc7('0x1c4')]===_0x5fc7('0x1c5')){freeVariablesPredictive(_0x49c28e);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x1c6'),_0x5fc7('0x1c7'),_0x3439ba,_0x5fc7('0x22'),_0x49c28e[_0x5fc7('0x3b')]);}else if(_0x3d3f06<_0x49c28e[_0x5fc7('0x63')]&&_0x49c28e[_0x5fc7('0x1c4')]===_0x5fc7('0x1c5')){freeVariablesPredictive(_0x49c28e);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x1c8'),_0x5fc7('0x1c9'),_0x3d3f06,_0x5fc7('0x1ca'),_0x49c28e[_0x5fc7('0x63')],_0x5fc7('0x22'),_0x49c28e[_0x5fc7('0x3b')]);}else if(!ifInterval(_0x49c28e['dialPredictiveInterval'],_0x49c28e[_0x5fc7('0x22')])&&_[_0x5fc7('0x38')](_0x49c28e['startPredictive'])&&!_[_0x5fc7('0x38')](_0x49c28e[_0x5fc7('0x22')])){_0x49c28e[_0x5fc7('0x21')]=moment()['format'](_0x5fc7('0xf3'));loggerPredictive[_0x5fc7('0x79')](_0x49c28e['name'],_0x5fc7('0x1cb'),_0x49c28e['startPredictive']);this[_0x5fc7('0xb3')](_0x49c28e[_0x5fc7('0x1c3')])[_0x5fc7('0xad')](this[_0x5fc7('0x1cc')](_0x49c28e))[_0x5fc7('0xad')](mergeDataErlangB(_0x49c28e))[_0x5fc7('0xad')](this[_0x5fc7('0x1cd')](_0x49c28e))['catch'](loggerCatchPredictive(_0x5fc7('0x1ce'),_0x49c28e));}else if(!ifInterval(_0x49c28e[_0x5fc7('0x1c3')],_0x49c28e[_0x5fc7('0x21')])){_0x49c28e[_0x5fc7('0x63')]=0x0;_0x49c28e[_0x5fc7('0x21')]=moment()[_0x5fc7('0x72')](_0x5fc7('0xf3'));loggerPredictive['info'](_0x49c28e['name'],_0x5fc7('0x1cf'),_0x49c28e[_0x5fc7('0x21')]);clearInterval(_0x49c28e['handlePredictive']);_0x49c28e[_0x5fc7('0x8d')]=undefined;this[_0x5fc7('0xb3')](_0x49c28e[_0x5fc7('0x1c3')])[_0x5fc7('0xad')](this[_0x5fc7('0x1cc')](_0x49c28e))[_0x5fc7('0xad')](mergeDataErlangB(_0x49c28e))['then'](this[_0x5fc7('0x1cd')](_0x49c28e))[_0x5fc7('0xa7')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x49c28e));}else if(_0x49c28e[_0x5fc7('0x67')]&&_0x4abe17<_0x49c28e[_0x5fc7('0x67')]-_0x2e2c9f){freeVariablesPredictive(_0x49c28e);loggerPredictive['info'](_0x49c28e[_0x5fc7('0x3b')],_0x5fc7('0x1d0'),_0x4abe17,_0x5fc7('0x1d1'),_0x49c28e[_0x5fc7('0x67')],'-',_0x2e2c9f,'=',_0x49c28e[_0x5fc7('0x67')]-_0x2e2c9f,')');}else if(_0x49c28e['predictiveIntervalAvailable']&&_0x4abe17>_0x49c28e[_0x5fc7('0x67')]+_0x5afda3){freeVariablesPredictive(_0x49c28e);loggerPredictive[_0x5fc7('0x79')](_0x49c28e[_0x5fc7('0x3b')],_0x5fc7('0x1d0'),_0x4abe17,')\x20are\x20more\x20than\x20threshold\x20(',_0x49c28e['predictiveIntervalAvailable'],'+',_0x5afda3,'=',_0x49c28e[_0x5fc7('0x67')]+_0x5afda3,')');}};Dialer[_0x5fc7('0x14')][_0x5fc7('0x1cc')]=function(_0xf5bbfc){var _0x2cf3bb=this;return function(_0x2547b4){return new BPromise(function(_0x45daf9,_0xa501d4){_[_0x5fc7('0x89')](_0xf5bbfc,_0x2547b4[0x0]);if(checkGetDataPredictive(_0x2547b4[0x0])){var _0x3c0d63=_0xf5bbfc[_0x5fc7('0x67')]=_0xf5bbfc[_0x5fc7('0x4d')]+_0xf5bbfc[_0x5fc7('0x4a')];var _0x214096=_0xf5bbfc['dialPredictiveInterval']*0x3c;var _0x57633b=_0x2547b4[0x0][_0x5fc7('0x83')]+_0x2547b4[0x0][_0x5fc7('0x61')];var _0x4057c7=(_0x2547b4[0x0][_0x5fc7('0x7d')]+_0x2547b4[0x0][_0x5fc7('0x62')]+_0x2547b4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2547b4[0x0][_0x5fc7('0x68')];_0xf5bbfc[_0x5fc7('0x64')]=_0x4057c7>0x0?_0x4057c7:0x1;switch(_0xf5bbfc[_0x5fc7('0x1c4')]){case _0x5fc7('0x1c5'):var _0xe50b4e=_0xf5bbfc[_0x5fc7('0x1bc')]/0x64;return _0x2cf3bb['abandonmentRate'](_0x3c0d63,_0x214096,_0x57633b,_0x4057c7,_0xe50b4e)[_0x5fc7('0xad')](function(_0x367b26){return _0x45daf9(_0x367b26);});case _0x5fc7('0x1d2'):var _0x2c7922=_0xf5bbfc[_0x5fc7('0x1bc')]/0x64;return _0x2cf3bb['busyFactor'](_0x3c0d63,_0x214096,_0x57633b,_0x4057c7,_0x2c7922)[_0x5fc7('0xad')](function(_0x1e0297){return _0x45daf9(_0x1e0297);});default:return _0xa501d4(msgResponse(_0x5fc7('0x1d3'),_0x5fc7('0x141'),_0x5fc7('0x1d4')));}}else{return _0xa501d4(msgResponse('[getDataPredictive]','Failure',_0x5fc7('0x1d5')));}});};};Dialer[_0x5fc7('0x14')][_0x5fc7('0x1d6')]=function(_0x4adda9){var _0xea7556=this;return function(_0x311b7a){return new BPromise(function(_0x409789,_0x5e7c64){_['merge'](_0x4adda9,_0x311b7a[0x0]);if(checkGetDataPredictive(_0x311b7a[0x0])){loggerPredictive[_0x5fc7('0x79')](JSON[_0x5fc7('0x44')](_0x311b7a[0x0]));if(_0x4adda9[_0x5fc7('0x1c4')]===_0x5fc7('0x1c5')){return _0xea7556[_0x5fc7('0xbf')](_0x4adda9['id'])[_0x5fc7('0xad')](function(_0x5acd00){var _0x3c73cc=_0x4adda9[_0x5fc7('0x156')]-_0x5acd00[0x0][_0x5fc7('0x1d7')];var _0x13354d=_0x4adda9[_0x5fc7('0x1c3')]*0x3c;var _0x38baf5=_0x311b7a[0x0][_0x5fc7('0x83')]+_0x311b7a[0x0][_0x5fc7('0x61')];var _0x253974=(_0x311b7a[0x0][_0x5fc7('0x7d')]+_0x311b7a[0x0][_0x5fc7('0x62')]+_0x311b7a[0x0][_0x5fc7('0x80')])/_0x311b7a[0x0][_0x5fc7('0x68')];var _0x85fed9=_0x4adda9[_0x5fc7('0x1bc')]/0x64;_0x4adda9[_0x5fc7('0x66')]=_0x5acd00[0x0][_0x5fc7('0x1d7')]||0x0;_0x4adda9[_0x5fc7('0x64')]=_0x253974>0x0?_0x253974:0x1;return _0xea7556['abandonmentRate'](_0x3c73cc,_0x13354d,_0x38baf5,_0x253974,_0x85fed9);})[_0x5fc7('0xad')](function(_0x226ddf){return _0x409789(_0x226ddf);})[_0x5fc7('0xa7')](function(_0x17ffd4){return _0x5e7c64(msgResponse(_0x5fc7('0x1d8'),_0x5fc7('0x141'),JSON[_0x5fc7('0x44')](_0x17ffd4)));});}if(_0x4adda9['dialPredictiveOptimization']==='agentBusyFactor'){return _0xea7556[_0x5fc7('0xbf')](_0x4adda9['id'])['then'](function(_0x4b5d1b){var _0x29fe37=_0x4adda9[_0x5fc7('0x156')]-_0x4b5d1b[0x0]['outboundQueuePauses'];var _0x387d65=_0x4adda9[_0x5fc7('0x1c3')]*0x3c;var _0x32321a=_0x311b7a[0x0][_0x5fc7('0x83')]+_0x311b7a[0x0][_0x5fc7('0x61')];var _0x4cec93=(_0x311b7a[0x0]['predictiveIntervalAnsweredCalls']+_0x311b7a[0x0][_0x5fc7('0x62')]+_0x311b7a[0x0][_0x5fc7('0x80')])/_0x311b7a[0x0][_0x5fc7('0x68')];var _0x26aa30=_0x4adda9[_0x5fc7('0x1bc')]/0x64;_0x4adda9[_0x5fc7('0x66')]=_0x4b5d1b[0x0][_0x5fc7('0x1d7')]||0x0;_0x4adda9['predictiveIntervalHitRate']=_0x4cec93>0x0?_0x4cec93:0x1;return _0xea7556[_0x5fc7('0x1d9')](_0x29fe37,_0x387d65,_0x32321a,_0x4cec93,_0x26aa30);})[_0x5fc7('0xad')](function(_0x4eaa31){return _0x409789(_0x4eaa31);})[_0x5fc7('0xa7')](function(_0x5b5b31){return _0x5e7c64(msgResponse(_0x5fc7('0x1d8'),_0x5fc7('0x141'),JSON[_0x5fc7('0x44')](_0x5b5b31)));});}}else{return _0x5e7c64(msgResponse(_0x5fc7('0x1d3'),_0x5fc7('0x141'),'check\x20failure'));}});};};Dialer[_0x5fc7('0x14')][_0x5fc7('0x1cd')]=function(_0x40798f){var _0x52b304=this;return function(){var _0x42e4c1=0x0;var _0x495906=Math[_0x5fc7('0x1c0')](_0x40798f[_0x5fc7('0x6b')]*0x3e8);if(_0x495906>0x0){_0x495906=_0x495906<0x64?0x64:_0x495906;loggerPredictive[_0x5fc7('0x79')](_0x40798f[_0x5fc7('0x3b')],_0x5fc7('0x1da'),_0x495906,_0x5fc7('0x45'));_0x40798f[_0x5fc7('0x8d')]=setInterval(function(){_0x52b304[_0x5fc7('0x8d')](_0x40798f);loggerPredictiveCalls[_0x5fc7('0x79')]('[handlePredictive]',_0x42e4c1+=0x1);},_0x495906);}else{loggerPredictive[_0x5fc7('0x79')](_0x40798f[_0x5fc7('0x3b')],_0x5fc7('0x1db'));}};};Dialer[_0x5fc7('0x14')][_0x5fc7('0x1dc')]=function(_0x2e5164,_0x192598){var _0x4188fe=this;return function(_0x306777){if(_['isEmpty'](_0x306777)){if(_[_0x5fc7('0xa4')](_0x192598[_0x5fc7('0xce')])||!_0x192598['recallme']){if(_0x2e5164[_0x5fc7('0x52')]===_0x5fc7('0x8')){_0x2e5164[_0x5fc7('0x128')]=_[_0x5fc7('0x38')](_0x2e5164[_0x5fc7('0x128')])?!![]:_0x2e5164[_0x5fc7('0x128')];var _0x28c456=uuid['v4']();_0x4188fe['actions'][_0x28c456]=new Action(_0x2e5164,_0x192598,_0x28c456);loggerBooked['info'](_0x5fc7('0x1dd'),_0x28c456,_0x5fc7('0x1de'),JSON[_0x5fc7('0x44')](_0x2e5164[_0x5fc7('0x128')]),_0x5fc7('0x1df'),_0x2e5164[_0x5fc7('0x3b')]);if(_0x2e5164[_0x5fc7('0x128')]){_0x2e5164[_0x5fc7('0x128')]=![];_0x4188fe['queueBooked'][_0x4188fe[_0x5fc7('0x1f')][_0x28c456]['queue']]=[];ami[_0x5fc7('0xa5')]({'actionid':_0x28c456,'action':_0x5fc7('0x1e0'),'queue':_0x2e5164[_0x5fc7('0x3b')]})['catch'](function(){_0x4188fe[_0x5fc7('0xa8')](_0x2e5164);_0x4188fe['rescheduleContact']({'active':![],'ContactId':_0x4188fe[_0x5fc7('0x1f')][_0x28c456][_0x5fc7('0xcc')],'ListId':_0x4188fe['actions'][_0x28c456][_0x5fc7('0xcd')],'VoiceQueueId':_0x4188fe[_0x5fc7('0x1f')][_0x28c456][_0x5fc7('0xfa')]||undefined,'CampaignId':_0x4188fe[_0x5fc7('0x1f')][_0x28c456]['CampaignId']||undefined})[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0x1e1')));delete _0x4188fe['actions'][_0x28c456];});}else{loggerBooked[_0x5fc7('0x79')](_0x5fc7('0x1e2'),JSON[_0x5fc7('0x44')](_0x2e5164['queueStatusComplete']),_0x5fc7('0x1df'),_0x2e5164[_0x5fc7('0x3b')]);_0x4188fe[_0x5fc7('0xa8')](_0x2e5164);_0x4188fe[_0x5fc7('0xb6')]({'active':![],'ContactId':_0x4188fe[_0x5fc7('0x1f')][_0x28c456][_0x5fc7('0xcc')],'ListId':_0x4188fe['actions'][_0x28c456][_0x5fc7('0xcd')],'VoiceQueueId':_0x4188fe[_0x5fc7('0x1f')][_0x28c456][_0x5fc7('0xfa')]||undefined,'CampaignId':_0x4188fe['actions'][_0x28c456][_0x5fc7('0xcf')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4188fe[_0x5fc7('0x1f')][_0x28c456];}}else{return _0x4188fe[_0x5fc7('0x160')](_0x2e5164,_0x192598);}}else{if(getDiff(_0x192598['scheduledat'])<_0x2e5164[_0x5fc7('0x1e3')]*0x3c){if(_0x192598[_0x5fc7('0x1e4')]&&!_0x192598['Agent'][_0x5fc7('0x1e5')]){_0x4188fe[_0x5fc7('0x19')]['run'](_0x192598['id'])[_0x5fc7('0x17')](function(){_0x4188fe['updateOriginated'](_0x2e5164);});}else{_0x4188fe['unlockContact']({'active':![]},_0x192598['id'],0x1)['finally'](function(){_0x4188fe[_0x5fc7('0xa8')](_0x2e5164);});}}else{_0x2e5164[_0x5fc7('0x5e')]+=0x1;_0x4188fe[_0x5fc7('0xa8')](_0x2e5164);if(_0x2e5164[_0x5fc7('0x1e6')]){_0x4188fe[_0x5fc7('0xb6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x192598[_0x5fc7('0xcc')],'ListId':_0x192598[_0x5fc7('0xcd')],'VoiceQueueId':_0x192598[_0x5fc7('0xfa')]||undefined,'CampaignId':_0x192598['CampaignId']||undefined})[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0x1e7')));_0x4188fe[_0x5fc7('0xc2')](createObjHistory(_0x2e5164,_0x192598,_0x5fc7('0x1e8'),0x17,_0x5fc7('0x1e9')))[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0x1ea')));}else{_0x4188fe['saveInDb'](createObjHistory(_0x2e5164,_0x192598,_0x5fc7('0x1eb'),0x16,_0x5fc7('0x1ec')),_0x5fc7('0x1ed'),'[Originate][HistoryRecallClose]');}}}}else{_0x2e5164[_0x5fc7('0x1ee')]+=0x1;_0x4188fe['saveInDb'](createObjHistory(_0x2e5164,_0x192598,_0x5fc7('0x1ef'),0xd,_0x5fc7('0x1f0')),_0x5fc7('0x1f1'),_0x5fc7('0x1f2'));throw'inBlackList';}};};Dialer[_0x5fc7('0x14')][_0x5fc7('0x1f3')]=function(_0x26dc3f){var _0x4b304=this;var _0x5c2a17=_0x26dc3f[_0x5fc7('0x1f4')]-_0x26dc3f['originated']-_0x26dc3f[_0x5fc7('0xbb')];emitCampaignSummary(_0x26dc3f);if(_0x5c2a17>0x0){if(_0x5c2a17>this[_0x5fc7('0x1d')]){_0x5c2a17=this[_0x5fc7('0x1d')];}_0x26dc3f['temp']+=_0x5c2a17;this[_0x5fc7('0xbd')](_0x26dc3f['id'],_0x5c2a17,_0x26dc3f[_0x5fc7('0x1f5')],_0x26dc3f)[_0x5fc7('0xad')](function(_0x2b06a6){_0x26dc3f[_0x5fc7('0xbb')]-=_0x5c2a17;_0x26dc3f[_0x5fc7('0xbb')]=_0x26dc3f[_0x5fc7('0xbb')]>0x0?_0x26dc3f[_0x5fc7('0xbb')]:0x0;if(!checkContactEmpty(_0x2b06a6)){_0x26dc3f[_0x5fc7('0x39')]='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0x5fc7('0x1f6')+_0x26dc3f[_0x5fc7('0x3b')]);}else{_0x26dc3f[_0x5fc7('0x69')]+=_0x2b06a6[_0x5fc7('0x93')];_0x26dc3f[_0x5fc7('0x39')]='RUNNING';for(var _0x488e78=0x0;_0x488e78<_0x2b06a6[_0x5fc7('0x93')];_0x488e78+=0x1){_0x26dc3f[_0x5fc7('0x1f7')]+=0x1;if(_[_0x5fc7('0xa4')](_0x2b06a6[_0x488e78])||_[_0x5fc7('0xa4')](_0x2b06a6[_0x488e78]['Contact'])||_[_0x5fc7('0xa4')](_0x2b06a6[_0x488e78][_0x5fc7('0x163')][_0x5fc7('0x164')])){_0x4b304[_0x5fc7('0xc8')](_0x5fc7('0x1f8'),_0x26dc3f,_0x2b06a6[_0x488e78]);}else{_0x4b304['checkIsBlackListIvr'](_['pick'](_0x2b06a6[_0x488e78],[_0x5fc7('0xcf'),_0x5fc7('0x1f9')]))['then'](_0x4b304['checkContactBlack'](_0x26dc3f,_0x2b06a6[_0x488e78]))[_0x5fc7('0xa7')](_0x4b304[_0x5fc7('0xc7')](_0x5fc7('0x1fa'),_0x26dc3f));}}}})[_0x5fc7('0xa7')](loggerGetContactDialer('[getContactCampaign2]',_0x26dc3f,_0x5c2a17));}};Dialer[_0x5fc7('0x14')][_0x5fc7('0x152')]=function(_0x3fbc70,_0x40ada0){var _0x5ab1e2=this;var _0x3d8e54=[];var _0x11d555=_0x40ada0>=0x1?_0x40ada0:0x1;if(_0x3fbc70[_0x5fc7('0x52')]===_0x5fc7('0x8')){_0x11d555=0x1;}var _0xa59ec7=Math[_0x5fc7('0x1c0')](_0x3fbc70[_0x5fc7('0x4a')]*_0x11d555)-_0x3fbc70['originated']-_0x3fbc70[_0x5fc7('0xbb')];emitVoiceQueueSummary(_0x3fbc70);if(_0x3fbc70[_0x5fc7('0x1fb')]>0x0){var _0x43b737=_0x3fbc70[_0x5fc7('0x1fb')]-_0x3fbc70[_0x5fc7('0x69')]-_0x3fbc70['talking']-_0x3fbc70[_0x5fc7('0xbb')]-_0x3fbc70[_0x5fc7('0x4b')];if(_0xa59ec7>_0x43b737){_0xa59ec7=_0x43b737;}}if(_0xa59ec7>0x0){if(_0x3fbc70['dialMethod']===_0x5fc7('0x8')){_0xa59ec7=0x1;}if(_0xa59ec7>this[_0x5fc7('0x1d')]){_0xa59ec7=this[_0x5fc7('0x1d')];}_0x3fbc70['temp']+=_0xa59ec7;for(var _0x52c5d8 in this[_0x5fc7('0x1b')]){if(typeof this[_0x5fc7('0x1b')][_0x52c5d8]!=='undefined'){if(this[_0x5fc7('0x1b')][_0x52c5d8][_0x5fc7('0x9e')]===_0x5fc7('0x1fc')&&this[_0x5fc7('0x1b')][_0x52c5d8][_0x5fc7('0xa6')]==='reachable'){_0x3d8e54['push'](this[_0x5fc7('0x1b')][_0x52c5d8]['id']);}}}this[_0x5fc7('0xba')](_0x3fbc70['id'],_0x3d8e54,_0xa59ec7,_0x3fbc70[_0x5fc7('0x1f5')],_0x3fbc70)[_0x5fc7('0xad')](function(_0x248e1b){_0x3fbc70[_0x5fc7('0xbb')]-=_0xa59ec7;_0x3fbc70[_0x5fc7('0xbb')]=_0x3fbc70[_0x5fc7('0xbb')]>0x0?_0x3fbc70[_0x5fc7('0xbb')]:0x0;if(!checkContactEmpty(_0x248e1b)){_0x5ab1e2[_0x5fc7('0x1fd')](_0x3fbc70)[_0x5fc7('0xad')](sendMessageReschedule(_0x3fbc70))[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0xae')));}else{_0x3fbc70[_0x5fc7('0x69')]+=_0x248e1b[_0x5fc7('0x93')];_0x3fbc70[_0x5fc7('0x39')]=_0x3fbc70['dialMethod']===_0x5fc7('0x8')?'ACTIVE':_0x5fc7('0x1fe');for(var _0x3a8f23=0x0;_0x3a8f23<_0x248e1b[_0x5fc7('0x93')];_0x3a8f23+=0x1){if(_[_0x5fc7('0xa4')](_0x248e1b[_0x3a8f23])||_[_0x5fc7('0xa4')](_0x248e1b[_0x3a8f23][_0x5fc7('0x163')])||_[_0x5fc7('0xa4')](_0x248e1b[_0x3a8f23]['Contact']['phone'])){_0x5ab1e2[_0x5fc7('0xc8')](_0x5fc7('0x1f8'),_0x3fbc70,_0x248e1b[_0x3a8f23]);}else{_0x5ab1e2[_0x5fc7('0xaf')](_[_0x5fc7('0xcb')](_0x248e1b[_0x3a8f23],[_0x5fc7('0xfa'),_0x5fc7('0x1f9')]))['then'](_0x5ab1e2[_0x5fc7('0x1dc')](_0x3fbc70,_0x248e1b[_0x3a8f23]))['catch'](_0x5ab1e2[_0x5fc7('0xc7')]('[actionOriginate]\x20',_0x3fbc70));}}}})[_0x5fc7('0xa7')](loggerGetContactDialer(_0x5fc7('0x1ff'),_0x3fbc70,_0xa59ec7));}};Dialer['prototype'][_0x5fc7('0x8d')]=function(_0xd8a7b6){if(_0xd8a7b6[_0x5fc7('0x1fb')]>0x0){var _0x1ab9ba=_0xd8a7b6[_0x5fc7('0x1fb')]-_0xd8a7b6[_0x5fc7('0x69')]-_0xd8a7b6[_0x5fc7('0x4d')];if(_0x1ab9ba>0x0){this[_0x5fc7('0x200')](_0xd8a7b6);}else{loggerPredictiveCalls[_0x5fc7('0x79')]('[handlePredictive][limitChannel]');}}else{this[_0x5fc7('0x200')](_0xd8a7b6);}};Dialer[_0x5fc7('0x14')]['tryOriginatePredictive']=function(_0x2a394b){var _0x3379d5=this;var _0x524b55=[];_0x2a394b[_0x5fc7('0x69')]+=0x1;for(var _0x5a7696 in this[_0x5fc7('0x1b')]){if(typeof this[_0x5fc7('0x1b')][_0x5a7696]!=='undefined'){if(this[_0x5fc7('0x1b')][_0x5a7696][_0x5fc7('0x9e')]===_0x5fc7('0x1fc')&&this[_0x5fc7('0x1b')][_0x5a7696][_0x5fc7('0xa6')]==='reachable'){_0x524b55[_0x5fc7('0x126')](this[_0x5fc7('0x1b')][_0x5a7696]['id']);}}}this['getContactDialer'](_0x2a394b['id'],_0x524b55,0x1,_0x2a394b[_0x5fc7('0x1f5')],_0x2a394b)['then'](function(_0x1a718a){if(!checkContactEmpty(_0x1a718a)){checkContactLowerLimitOriginate(_0x2a394b,0x1,0x0);_0x3379d5['countReScheduled'](_0x2a394b)['then'](sendMessageReschedule(_0x2a394b))[_0x5fc7('0xa7')](loggerCatch(_0x5fc7('0xae')));}else{_0x2a394b['message']=_0x5fc7('0x1fe');if(_[_0x5fc7('0xa4')](_0x1a718a[0x0])||_[_0x5fc7('0xa4')](_0x1a718a[0x0][_0x5fc7('0x163')])||_[_0x5fc7('0xa4')](_0x1a718a[0x0][_0x5fc7('0x163')][_0x5fc7('0x164')])){_0x3379d5[_0x5fc7('0xc8')](_0x5fc7('0x1f8'),_0x2a394b,_0x1a718a[0x0]);}else{_0x3379d5[_0x5fc7('0xaf')](_[_0x5fc7('0xcb')](_0x1a718a[0x0],[_0x5fc7('0xfa'),_0x5fc7('0x1f9')]))[_0x5fc7('0xad')](_0x3379d5[_0x5fc7('0x1dc')](_0x2a394b,_0x1a718a[0x0]))['catch'](_0x3379d5[_0x5fc7('0xc7')](_0x5fc7('0x201'),_0x2a394b));}}})[_0x5fc7('0xa7')](loggerGetContactDialer(_0x5fc7('0x202'),_0x2a394b,0x1));emitVoiceQueueSummary(_0x2a394b);};Dialer[_0x5fc7('0x14')][_0x5fc7('0x203')]=function(_0x257f64,_0x2cb368,_0x80ab56,_0x274a99,_0xfced6f,_0x3ec151){loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x204'));loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x205'),_0x257f64);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x206'),_0x2cb368);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x207'),_0x80ab56);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x208'),_0x274a99);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x209'),_0xfced6f);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x84'));return new BPromise(function(_0x3c727f,_0x4b52f4){if(_0x257f64<=0x0||isNaN(_0x257f64)){return _0x4b52f4(msgResponse(_0x5fc7('0x20a'),_0x5fc7('0x43'),_0x5fc7('0x20b')+_0x257f64));}if(_0x80ab56<=0x0||isNaN(_0x80ab56)){return _0x4b52f4(msgResponse(_0x5fc7('0x20a'),'Error',_0x5fc7('0x20c')+_0x80ab56));}if(_0x274a99<=0x0||isNaN(_0x274a99)){return _0x4b52f4(msgResponse(_0x5fc7('0x20a'),_0x5fc7('0x43'),'p\x20=\x20'+_0x274a99));}if(_0x2cb368<=0x0||isNaN(_0x2cb368)){return _0x4b52f4(msgResponse('[abandonmentRate]',_0x5fc7('0x43'),_0x5fc7('0x20d')+_0x2cb368));}if(_0xfced6f<=0x0||isNaN(_0xfced6f)){return _0x4b52f4(msgResponse(_0x5fc7('0x20a'),_0x5fc7('0x43'),'Amax\x20=\x20'+_0xfced6f));}_0x3ec151=_0x3ec151||0x0;var _0xd9dc06=0x1/_0x80ab56;var _0x3e7904=0x0;var _0xe5b48e=0x0;var _0x4d0e36=0x0;var _0x50d59a=0x0;for(var _0x583c1b=0x0;_0x4d0e36<_0xfced6f;_0x583c1b+=0x1){_0xe5b48e=_0x583c1b/_0x2cb368;_0x3e7904=(_0x274a99*_0xe5b48e+_0x3ec151)/_0xd9dc06;_0x4d0e36=erlangb(_0x3e7904,_0x257f64);_0x50d59a=_0x3e7904/_0x257f64*(0x1-erlangb(_0x3e7904,_0x257f64));}return _0x3c727f({'erlangCalls':_0x583c1b,'erlangCallToSecond':_0x2cb368/_0x583c1b,'erlangAbandonmentRate':_0x4d0e36,'erlangBusyFactor':_0x50d59a});});};Dialer[_0x5fc7('0x14')]['busyFactor']=function(_0x4f5fe2,_0x4346ea,_0x11abcd,_0x5e55f9,_0x21b23a,_0x2e221a){loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x20e'));loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x205'),_0x4f5fe2);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x206'),_0x4346ea);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x207'),_0x11abcd);loggerPredictive['info'](_0x5fc7('0x208'),_0x5e55f9);loggerPredictive['info'](_0x5fc7('0x20f'),_0x21b23a);loggerPredictive[_0x5fc7('0x79')](_0x5fc7('0x84'));return new BPromise(function(_0x2d88c9,_0x4f068d){if(_0x4f5fe2<=0x0||isNaN(_0x4f5fe2)){return _0x4f068d(msgResponse(_0x5fc7('0x210'),'Error',_0x5fc7('0x20b')+_0x4f5fe2));}if(_0x11abcd<=0x0||isNaN(_0x11abcd)){return _0x4f068d(msgResponse(_0x5fc7('0x210'),_0x5fc7('0x43'),_0x5fc7('0x20c')+_0x11abcd));}if(_0x5e55f9<=0x0||isNaN(_0x5e55f9)){return _0x4f068d(msgResponse('[busyFactor]',_0x5fc7('0x43'),'p\x20=\x20'+_0x5e55f9));}if(_0x4346ea<=0x0||isNaN(_0x4346ea)){return _0x4f068d(msgResponse(_0x5fc7('0x210'),'Error','interval\x20=\x20'+_0x4346ea));}if(_0x21b23a<=0x0||isNaN(_0x21b23a)){return _0x4f068d(msgResponse(_0x5fc7('0x210'),_0x5fc7('0x43'),_0x5fc7('0x211')+_0x21b23a));}_0x2e221a=_0x2e221a||0x0;var _0x4f3249=0x1/_0x11abcd;var _0x4dadbb=0x0;var _0x104428=0x0;var _0x3c1150=0x0;var _0x565a76=0x0;for(var _0x4fbaba=0x0;_0x565a76<_0x21b23a;_0x4fbaba+=0x1){_0x104428=_0x4fbaba/_0x4346ea;_0x4dadbb=(_0x5e55f9*_0x104428+_0x2e221a)/_0x4f3249;_0x3c1150=erlangb(_0x4dadbb,_0x4f5fe2);_0x565a76=_0x4dadbb/_0x4f5fe2*(0x1-erlangb(_0x4dadbb,_0x4f5fe2));}return _0x2d88c9({'erlangCalls':_0x4fbaba,'erlangCallToSecond':_0x4346ea/_0x4fbaba,'erlangAbandonmentRate':_0x3c1150,'erlangBusyFactor':_0x565a76});});};module[_0x5fc7('0x212')]=Dialer; \ No newline at end of file +var _0x1b73=['available','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','stringify','md5','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\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','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','uniqueId','[uniqueid]','Action','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','countReScheduled','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','then','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','loggerHandler','emptyContact','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','SIP/%s','status','reachable','uniqueid','isNil','variable','amdstatus','exten','dialAMDActive','HangupInAMD','membername','AMD','custom:amd','buildObj','[syncHangupInAMD]','value','outboundAnswerCallsDay','Machine','countmachineretry','amd','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','MACHINE','countglobal','[syncAgentComplete][createHistory][0]','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','reason','agent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','responsetime','dialQueueTimeout','Drop','dropreason','agiafterat','dialQueueProject2','dialDropMaxRetry','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','syncQueueMember','actionid','locked','paused','stateinterface','queueBooked','push','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','timezones','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','predictive','method\x20not\x20recognized','launchHandleIvr','handleIvr','loggedIn','dialTimezone','checkIfTimeIntervals','\x5cw{0,','pow','replace','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','dialCutDigit','trim','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countcongestionretry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','predictiveIntervalErlangCallsDroppedCalls','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','merge','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','predictiveIntervalPauses','floor','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','Agent','voicePause','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','RUNNING','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','Contact.phone','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','[busyFactor]','p\x20=\x20','interval\x20=\x20','Umin\x20=\x20','lodash','bluebird','uuid','moment','ioredis','../../../config/environment/','../../../config/logger','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','Intervals','name','isEmpty','\x20INTERVAL_IS_NULL','[ifTime][Action]','milliseconds','diff','seconds','emit','type','outbound','strategy'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x1b73,0x1d5));var _0x31b7=function(_0x41d282,_0x31385c){_0x41d282=_0x41d282-0x0;var _0x4e0d0b=_0x1b73[_0x41d282];return _0x4e0d0b;};'use strict';var util=require('util');var _=require(_0x31b7('0x0'));var BPromise=require(_0x31b7('0x1'));var uuid=require(_0x31b7('0x2'));var moment=require(_0x31b7('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x31b7('0x4'));var ut=require('../preview/util/util');var config=require(_0x31b7('0x5'));var logger=require(_0x31b7('0x6'))('dialer');var loggerBooked=require(_0x31b7('0x6'))(_0x31b7('0x7'));var loggerPredictive=require(_0x31b7('0x6'))('predictive');var loggerPredictiveCalls=require(_0x31b7('0x6'))(_0x31b7('0x8'));var loggerSyncQueueSummary=require(_0x31b7('0x6'))(_0x31b7('0x9'));var ami=require(_0x31b7('0xa'));config[_0x31b7('0xb')]=_[_0x31b7('0xc')](config['redis'],{'host':_0x31b7('0xd'),'port':0x18eb});var io=require(_0x31b7('0xe'))(new Redis(config[_0x31b7('0xb')]));var cmHopper=require(_0x31b7('0xf'));var cmHopperHistory=require(_0x31b7('0x10'));var cmHopperBlack=require(_0x31b7('0x11'));var voiceQueueRt=require(_0x31b7('0x12'));var Action=require(_0x31b7('0x13'));var History=require(_0x31b7('0x14'));var Final=require(_0x31b7('0x15'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x31b7('0x16'));var Hangup=require(_0x31b7('0x17'));var ipAgi=process[_0x31b7('0x18')][_0x31b7('0x19')]||_0x31b7('0x1a');var strategy={'rrmemory':_0x31b7('0x1b'),'roundrobin':_0x31b7('0x1c')};var Sequence=function(){};Sequence[_0x31b7('0x1d')][_0x31b7('0x1e')]=function(_0x5e6021){this[_0x31b7('0x1f')]=this['tail']?this[_0x31b7('0x1f')][_0x31b7('0x20')](_0x5e6021):_0x5e6021();};function Dialer(_0x48f733,_0x15df1d){this[_0x31b7('0x21')]=new Sequence();this[_0x31b7('0x22')]=_0x15df1d;this[_0x31b7('0x23')]=_0x48f733[_0x31b7('0x23')];this['campaigns']=_0x48f733[_0x31b7('0x24')];this[_0x31b7('0x25')]=_0x48f733[_0x31b7('0x25')];this[_0x31b7('0x26')]=_0x48f733[_0x31b7('0x26')];this['maxNumberOriginate']=config[_0x31b7('0x27')]||0x2;this[_0x31b7('0x28')]={};this[_0x31b7('0x29')]={};this[_0x31b7('0x2a')]={};this['uniqueId']={};this[_0x31b7('0x2b')]={};this[_0x31b7('0x2c')]={};this[_0x31b7('0x2d')]={};this[_0x31b7('0x2e')]={};this['queueBooked']={};this[_0x31b7('0x2f')]={};ami['on'](_0x31b7('0x30'),this[_0x31b7('0x31')][_0x31b7('0x32')](this));ami['on'](_0x31b7('0x33'),this[_0x31b7('0x34')][_0x31b7('0x32')](this));ami['on'](_0x31b7('0x35'),this[_0x31b7('0x36')]['bind'](this));ami['on'](_0x31b7('0x37'),this[_0x31b7('0x38')][_0x31b7('0x32')](this));ami['on'](_0x31b7('0x39'),this['syncQueueSummary'][_0x31b7('0x32')](this));ami['on']('hangup',this[_0x31b7('0x3a')][_0x31b7('0x32')](this));ami['on'](_0x31b7('0x3b'),this[_0x31b7('0x3c')][_0x31b7('0x32')](this));ami['on'](_0x31b7('0x3d'),this[_0x31b7('0x3e')][_0x31b7('0x32')](this));ami['on']('queuemember',this['syncQueueMember']['bind'](this));ami['on'](_0x31b7('0x3f'),this[_0x31b7('0x40')][_0x31b7('0x32')](this));this['loopCampaigns']();this[_0x31b7('0x41')]();}function isNotNull(_0x6ba73c){return _0x6ba73c!==null&&!_[_0x31b7('0x42')](_0x6ba73c);}function checkIsLoggedIn(_0x277273,_0x58a87e){return function(){if(_0x58a87e<=0x0){_0x277273[_0x31b7('0x43')]=_0x31b7('0x44');throw _0x277273['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x241934){return _0x241934;}function checkIsActive(_0x40cc51,_0xdde2de){return function(){if(!isActive(_0xdde2de)){_0x40cc51[_0x31b7('0x43')]='NOT_ACTIVE';throw _0x40cc51['name']+_0x31b7('0x45');}};}function checkInterval(_0x345393){return function(){if(!isNotNull(_0x345393[_0x31b7('0x46')])){_0x345393[_0x31b7('0x43')]=_0x31b7('0x47');throw _0x345393['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x345393[_0x31b7('0x46')][_0x31b7('0x48')])){_0x345393['message']=_0x31b7('0x47');throw _0x345393[_0x31b7('0x49')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x31b7('0x4a')](_0x345393[_0x31b7('0x46')][_0x31b7('0x48')]))){_0x345393[_0x31b7('0x43')]=_0x31b7('0x47');throw _0x345393[_0x31b7('0x49')]+_0x31b7('0x4b');}};}function msgResponse(_0x200314,_0x4257e2,_0x95ec4e){return{'action':_0x200314,'response':_0x4257e2,'message':_0x95ec4e,'stack':_0x95ec4e};}function myreject(_0x1ff017){return function(_0x13d281){return _0x1ff017(msgResponse(_0x31b7('0x4c'),'Error',JSON['stringify'](_0x13d281)));};}function getSeconds(_0x292f61,_0x470ada){var _0x361f24=moment(_0x292f61)[_0x31b7('0x4d')](0x0);var _0x23745c=moment(_0x470ada)[_0x31b7('0x4d')](0x0);return _0x361f24[_0x31b7('0x4e')](_0x23745c,_0x31b7('0x4f'));}function emit(_0x426906,_0x1c545c,_0x5849ad){io['to'](_0x426906)[_0x31b7('0x50')](_0x1c545c,_0x5849ad);}function emitVoiceQueueSummary(_0xfd4863){if(_0xfd4863[_0x31b7('0x51')]===_0x31b7('0x52')){var _0x5c9cec={'id':_0xfd4863['id'],'name':_0xfd4863[_0x31b7('0x49')],'strategy':_0xfd4863[_0x31b7('0x53')],'answered':_0xfd4863['answered'],'available':_0xfd4863[_0x31b7('0x54')],'loggedIn':_0xfd4863['loggedIn'],'pTalking':_0xfd4863['pTalking'],'sumBillable':_0xfd4863[_0x31b7('0x55')],'sumDuration':_0xfd4863[_0x31b7('0x56')],'sumHoldTime':_0xfd4863[_0x31b7('0x57')]||0x0,'talking':_0xfd4863[_0x31b7('0x58')],'total':_0xfd4863[_0x31b7('0x59')],'type':_0xfd4863['type'],'unmanaged':_0xfd4863[_0x31b7('0x5a')],'abandoned':_0xfd4863['abandoned'],'waiting':_0xfd4863['waiting'],'loggedInDb':_0xfd4863['loggedInDb'],'dialActive':_0xfd4863[_0x31b7('0x5b')],'dialMethod':_0xfd4863[_0x31b7('0x5c')],'dialOriginateCallerIdName':_0xfd4863[_0x31b7('0x5d')],'dialOriginateCallerIdNumber':_0xfd4863[_0x31b7('0x5e')],'dialOriginateTimeout':_0xfd4863[_0x31b7('0x5f')],'dialPrefix':_0xfd4863['dialPrefix'],'outboundAnswerAgiCallsDay':_0xfd4863[_0x31b7('0x60')],'outboundAnswerCallsDay':_0xfd4863['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0xfd4863[_0x31b7('0x61')],'outboundBusyCallsDay':_0xfd4863[_0x31b7('0x62')],'outboundCongestionCallsDay':_0xfd4863[_0x31b7('0x63')],'outboundDropCallsDayACS':_0xfd4863[_0x31b7('0x64')],'outboundDropCallsDayCallersExit':_0xfd4863['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0xfd4863[_0x31b7('0x65')],'outboundNoAnswerCallsDay':_0xfd4863[_0x31b7('0x66')],'outboundNoSuchCallsDay':_0xfd4863[_0x31b7('0x67')],'outboundOriginateFailureCallsDay':_0xfd4863['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0xfd4863[_0x31b7('0x68')],'outboundRejectCallsDay':_0xfd4863['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0xfd4863[_0x31b7('0x69')],'predictiveIntervalAnsweredCalls':_0xfd4863[_0x31b7('0x6a')],'predictiveIntervalAvgHoldtime':_0xfd4863['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0xfd4863[_0x31b7('0x6b')],'predictiveIntervalDroppedCallsCallersExit':_0xfd4863[_0x31b7('0x6c')],'predictiveIntervalDroppedCallsTimeout':_0xfd4863[_0x31b7('0x6d')],'predictiveIntervalErlangCalls':_0xfd4863[_0x31b7('0x6e')],'predictiveIntervalErlangCallsDroppedCalls':_0xfd4863['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0xfd4863[_0x31b7('0x6f')],'predictiveIntervalMultiplicativeFactor':_0xfd4863['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0xfd4863['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0xfd4863[_0x31b7('0x70')],'predictiveIntervalTotalCalls':_0xfd4863[_0x31b7('0x71')],'message':_0xfd4863[_0x31b7('0x43')],'originated':_0xfd4863[_0x31b7('0x72')],'erlangCalls':_0xfd4863['erlangCalls'],'erlangCallToSecond':_0xfd4863[_0x31b7('0x73')],'erlangAbandonmentRate':_0xfd4863[_0x31b7('0x74')],'erlangBusyFactor':_0xfd4863['erlangBusyFactor'],'startPredictive':_0xfd4863[_0x31b7('0x2c')],'startProgressive':_0xfd4863[_0x31b7('0x2d')]};if(_0xfd4863[_0x31b7('0x75')]){_0x5c9cec['Trunk']={'id':_0xfd4863[_0x31b7('0x75')]['id'],'name':_0xfd4863[_0x31b7('0x75')][_0x31b7('0x49')],'active':_0xfd4863[_0x31b7('0x75')][_0x31b7('0x76')],'callerid':_0xfd4863[_0x31b7('0x75')][_0x31b7('0x77')]};}if(_0xfd4863[_0x31b7('0x46')]){_0x5c9cec['Interval']={'id':_0xfd4863[_0x31b7('0x46')]['id'],'name':_0xfd4863['Interval']['name']};}var _0x22cc77=md5(JSON[_0x31b7('0x78')](_0x5c9cec));if(_0xfd4863[_0x31b7('0x79')]!==_0x22cc77){_0xfd4863[_0x31b7('0x79')]=_0x22cc77;emit(util['format'](_0x31b7('0x7a'),_0x5c9cec[_0x31b7('0x49')]),_0x31b7('0x7b'),_0x5c9cec);}}}function emitCampaignSummary(_0x5d4967){if(_0x5d4967[_0x31b7('0x51')]===_0x31b7('0x7c')){emit(util[_0x31b7('0x7d')](_0x31b7('0x7e'),_0x5d4967[_0x31b7('0x49')]),_0x31b7('0x7f'),_0x5d4967);}}function checkGetDataPredictive(_0x308000){if(isNotNull(_0x308000)&&!_[_0x31b7('0x4a')](_0x308000)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x31b7('0x80')](_0x31b7('0x81'),_0x308000[_0x31b7('0x71')]);loggerPredictive[_0x31b7('0x80')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x308000['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x31b7('0x80')](_0x31b7('0x82'),_0x308000[_0x31b7('0x6d')]);loggerPredictive[_0x31b7('0x80')](_0x31b7('0x83'),_0x308000[_0x31b7('0x6c')]);loggerPredictive[_0x31b7('0x80')](_0x31b7('0x84'),_0x308000['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0x31b7('0x85'),_0x308000[_0x31b7('0x6b')]);loggerPredictive[_0x31b7('0x80')](_0x31b7('0x86'));if(_0x308000[_0x31b7('0x71')]>0x0){if(!_[_0x31b7('0x42')](_0x308000[_0x31b7('0x6b')])&&_0x308000[_0x31b7('0x6b')]>0x0){return!![];}loggerPredictive[_0x31b7('0x80')](_0x31b7('0x87'));if(!_['isUndefined'](_0x308000['predictiveIntervalAvgHoldtime'])&&_0x308000[_0x31b7('0x88')]>0x0){return!![];}loggerPredictive[_0x31b7('0x80')](_0x31b7('0x89'));}else{loggerPredictive[_0x31b7('0x80')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x31b7('0x80')](_0x31b7('0x8a'));}return![];}function mergeDataErlangB(_0x316175){return function(_0x5c920b){loggerPredictive[_0x31b7('0x80')](_0x31b7('0x8b'));loggerPredictive[_0x31b7('0x80')](_0x31b7('0x8c'),_0x5c920b[_0x31b7('0x8d')]);loggerPredictive[_0x31b7('0x80')](_0x31b7('0x8e'),_0x5c920b['erlangCallToSecond']);loggerPredictive['info'](_0x31b7('0x8f'),_0x5c920b[_0x31b7('0x74')]);loggerPredictive[_0x31b7('0x80')](_0x31b7('0x90'),_0x5c920b[_0x31b7('0x91')]);loggerPredictive[_0x31b7('0x80')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5c920b[_0x31b7('0x74')]);loggerPredictive['info']('---------------------------');_['merge'](_0x316175,_0x5c920b);};}function getDiff(_0x3686b8){var _0x348d82=moment()[_0x31b7('0x4d')](0x0);var _0x29577b=moment(_0x3686b8)[_0x31b7('0x4d')](0x0);return _0x348d82[_0x31b7('0x4e')](_0x29577b,_0x31b7('0x4f'));}function ifInterval(_0x1cf116,_0x243fea){if(_[_0x31b7('0x42')](_0x243fea)){return![];}return getDiff(_0x243fea)<_0x1cf116*0x3c;}function freeVariablesPredictive(_0x40d54b){if(isNotNull(_0x40d54b)){if(!_[_0x31b7('0x42')](_0x40d54b[_0x31b7('0x2d')])){_0x40d54b[_0x31b7('0x2d')]=undefined;loggerPredictive[_0x31b7('0x80')](_0x40d54b[_0x31b7('0x49')],_0x31b7('0x92'));}if(!_[_0x31b7('0x42')](_0x40d54b[_0x31b7('0x2c')])){_0x40d54b[_0x31b7('0x2c')]=undefined;loggerPredictive[_0x31b7('0x80')](_0x40d54b[_0x31b7('0x49')],_0x31b7('0x93'));}if(!_[_0x31b7('0x42')](_0x40d54b['handlePredictive'])){clearInterval(_0x40d54b[_0x31b7('0x94')]);_0x40d54b[_0x31b7('0x94')]=undefined;loggerPredictive['info'](_0x40d54b[_0x31b7('0x49')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x1114b6,_0x35f72f){if(_0x35f72f===0x0){return 0x0;}var _0x318746=0x1;for(var _0x516eac=0x1;_0x516eac<=_0x35f72f;_0x516eac+=0x1){_0x318746=0x1+_0x318746*_0x516eac/_0x1114b6;}return 0x1/_0x318746;}function isVoiceQueueOutbound(_0x593d74){return _0x593d74===_0x31b7('0x52');}function isNotPreview(_0x52208e){return _0x52208e!==_0x31b7('0x22');}function isCampaignIvr(_0x4b368c){return _0x4b368c===_0x31b7('0x7c');}function getCallerId(_0x3d8be8,_0xfeb4e2,_0x2b6631){if(!_['isUndefined'](_0x2b6631)&&typeof _0x2b6631===_0x31b7('0x95')&&!_[_0x31b7('0x4a')](_0x2b6631)){if(!_[_0x31b7('0x42')](_0xfeb4e2)&&typeof _0xfeb4e2===_0x31b7('0x95')&&!_[_0x31b7('0x4a')](_0xfeb4e2)){return util[_0x31b7('0x7d')](_0x31b7('0x96'),_0xfeb4e2,_0x2b6631);}return util[_0x31b7('0x7d')](_0x31b7('0x96'),_0x2b6631,_0x2b6631);}if(!_[_0x31b7('0x42')](_0x3d8be8)&&typeof _0x3d8be8===_0x31b7('0x95')&&!_[_0x31b7('0x4a')](_0x3d8be8)){return _0x3d8be8;}return _0x31b7('0x97');}function loggerCatchQueueSummary(_0x3bfe0c,_0x2de398){return function(_0x1e7bdc){freeVariablesPredictive(_0x2de398);emitVoiceQueueSummary(_0x2de398);emitCampaignSummary(_0x2de398);loggerSyncQueueSummary[_0x31b7('0x98')](_0x3bfe0c,util[_0x31b7('0x99')](_0x1e7bdc,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x412a1e,_0x3fea4c){return function(_0x3291b0){loggerPredictive[_0x31b7('0x98')](_0x3fea4c[_0x31b7('0x49')],_0x412a1e);loggerPredictive[_0x31b7('0x98')](_0x3291b0[_0x31b7('0x9a')]);freeVariablesPredictive(_0x3fea4c);};}function loggerCatch(_0xa14626){return function(_0x14f87a){logger[_0x31b7('0x98')](_0xa14626,util[_0x31b7('0x99')](_0x14f87a,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4b6abb){return _0x4b6abb&&!_[_0x31b7('0x42')](_0x4b6abb)&&_0x4b6abb[_0x31b7('0x9b')]>0x0;}function decremetOriginate(_0x1362c0){if(!_[_0x31b7('0x42')](_0x1362c0)&&_0x1362c0!==null){if(typeof _0x1362c0[_0x31b7('0x72')]!==_0x31b7('0x9c')){if(_0x1362c0[_0x31b7('0x72')]>0x0){_0x1362c0['originated']-=0x1;}else{logger[_0x31b7('0x98')](_0x31b7('0x9d'));}}}else{logger['error'](_0x31b7('0x9e'));}}function checkContactLowerLimitOriginate(_0x2543b8,_0x1a3ddc,_0xa4e565){if(_0x1a3ddc>_0xa4e565){for(var _0x2a12f0=0x0;_0x2a12f0<_0x1a3ddc-_0xa4e565;_0x2a12f0+=0x1){decremetOriginate(_0x2543b8);}}}function loggerGetContactDialer(_0x4bffc5,_0xc9bfee,_0x2a6abf){return function(_0x172ac2){checkContactLowerLimitOriginate(_0xc9bfee,_0x2a6abf,0x0);logger[_0x31b7('0x98')](_0x4bffc5,util[_0x31b7('0x99')](_0x172ac2,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x23b0b1){return function(_0x41eaa5){if(isNotNull(_0x41eaa5)&&isNotNull(_0x41eaa5[0x0])){if(_0x41eaa5[0x0][_0x31b7('0x9f')]>0x0){_0x23b0b1[_0x31b7('0x43')]=_0x31b7('0xa0');logger[_0x31b7('0x80')](_0x31b7('0xa1')+_0x23b0b1['name'],_0x41eaa5[0x0]['contactsRescheduled'],'contacts');}else{_0x23b0b1[_0x31b7('0x43')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x31b7('0x80')](_0x31b7('0xa2')+_0x23b0b1['name']);}}};}function notSendMessagesQueue(_0xd3f428){if(_0xd3f428[_0x31b7('0xa3')]){freeVariablesPredictive(_0xd3f428);if(_0xd3f428[_0x31b7('0x72')]===0x0&&_0xd3f428[_0x31b7('0x58')]===0x0&&_0xd3f428['waiting']===0x0&&(_0xd3f428['pTalking']||0x0)===0x0){_0xd3f428[_0x31b7('0xa3')]=![];_0xd3f428[_0x31b7('0x54')]=0x0;_0xd3f428[_0x31b7('0x43')]=_0x31b7('0xa4');loggerSyncQueueSummary[_0x31b7('0x98')](_0x31b7('0xa5'),_0xd3f428[_0x31b7('0x49')],_0x31b7('0xa6'));}else{_0xd3f428[_0x31b7('0x43')]=_0x31b7('0xa7');loggerSyncQueueSummary['error'](_0x31b7('0xa5'),_0xd3f428['name'],_0x31b7('0xa8'));}emitVoiceQueueSummary(_0xd3f428);}}function notSendMessagesCampaign(_0x50f1b5){if(_0x50f1b5[_0x31b7('0xa3')]){if(_0x50f1b5[_0x31b7('0x72')]===0x0){_0x50f1b5[_0x31b7('0xa3')]=![];_0x50f1b5[_0x31b7('0x43')]='NOT_ACTIVE';loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x50f1b5[_0x31b7('0x49')],'is\x20not\x20active');}else{_0x50f1b5['message']=_0x31b7('0xa7');loggerSyncQueueSummary['error'](_0x31b7('0xa9'),_0x50f1b5[_0x31b7('0x49')],'is\x20disactive');}emitCampaignSummary(_0x50f1b5);}}function createObjHistory(_0x5f0be5,_0x3f64ff,_0x3a72fd,_0x330c58,_0x3bf8ed){_0x5f0be5[_0x31b7('0x43')]=_0x3a72fd;var _0x56ebb9=new Action(_0x5f0be5,_0x3f64ff);var _0x228cb6=new History(_0x56ebb9);_0x228cb6[_0x31b7('0xaa')]=_0x330c58;_0x228cb6[_0x31b7('0xab')]=_0x3bf8ed;_0x228cb6[_0x31b7('0xac')]=_0x56ebb9[_0x31b7('0xad')];return _0x228cb6;}Dialer[_0x31b7('0x1d')]['loopClearZombieChannels']=function(){var _0xf914b6=this;setInterval(function(){_0xf914b6[_0x31b7('0xae')](_0xf914b6[_0x31b7('0xaf')],_0x31b7('0xb0'));_0xf914b6[_0x31b7('0xae')](_0xf914b6[_0x31b7('0x29')],'[actions]');},0x32c8);};Dialer[_0x31b7('0x1d')]['clearZombieChannels']=function(_0x43a55f,_0x4e369c){var _0x8d6e11=this;for(var _0x59fe1e in _0x43a55f){if(typeof _0x43a55f[_0x59fe1e]!=='undefined'){this[_0x31b7('0x21')][_0x31b7('0x1e')](function(){if(!_['isNil'](_0x43a55f[_0x59fe1e])){return ami[_0x31b7('0xb1')]({'action':'status','channel':_0x43a55f[_0x59fe1e][_0x31b7('0xb2')]})[_0x31b7('0xb3')](function(_0x5d4388){if(_0x5d4388[_0x31b7('0x43')]===_0x31b7('0xb4')){setTimeout(function(){if(_0x43a55f[_0x59fe1e]&&_0x43a55f[_0x59fe1e]['type']!=='ivr'){_0x8d6e11[_0x31b7('0xb5')](_0x8d6e11[_0x31b7('0x23')][_0x43a55f[_0x59fe1e][_0x31b7('0xb6')]]);logger['error'](_0x31b7('0xb7'),_0x4e369c,_0x59fe1e,_0x43a55f[_0x59fe1e][_0x31b7('0xb6')]);delete _0x43a55f[_0x59fe1e];}if(_0x43a55f[_0x59fe1e]&&_0x43a55f[_0x59fe1e][_0x31b7('0x51')]==='ivr'){_0x8d6e11['updateOriginated'](_0x8d6e11[_0x31b7('0x24')][_0x43a55f[_0x59fe1e]['queue']]);logger[_0x31b7('0x98')](_0x31b7('0xb8'),_0x4e369c,_0x59fe1e,_0x43a55f[_0x59fe1e]['queue']);delete _0x43a55f[_0x59fe1e];}},0x2328);}});}});}}};Dialer[_0x31b7('0x1d')]['countReScheduled']=function(_0x4caec0){return BPromise[_0x31b7('0xb9')]()['then'](cmHopper[_0x31b7('0xba')](_0x4caec0))[_0x31b7('0xb3')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x31b7('0x1d')][_0x31b7('0xbb')]=function(_0x5486bc){return BPromise['resolve']()['then'](cmHopperBlack[_0x31b7('0xbb')](_0x5486bc))[_0x31b7('0xb3')](loggerCatch(_0x31b7('0xbc')));};Dialer[_0x31b7('0x1d')][_0x31b7('0xbd')]=function(_0x240006){return BPromise['resolve']()['then'](cmHopperBlack[_0x31b7('0xbd')](_0x240006))['catch'](loggerCatch(_0x31b7('0xbe')));};Dialer[_0x31b7('0x1d')][_0x31b7('0xbf')]=function(_0x11d2b4){return BPromise[_0x31b7('0xb9')]()[_0x31b7('0xc0')](cmHopperHistory[_0x31b7('0xc1')](_0x11d2b4))[_0x31b7('0xb3')](loggerCatch(_0x31b7('0xc2')));};Dialer[_0x31b7('0x1d')][_0x31b7('0xc3')]=function(_0x9e9eb3){return BPromise['resolve']()['then'](cmHopper[_0x31b7('0xc3')](_0x9e9eb3))[_0x31b7('0xb3')](loggerCatch(_0x31b7('0xc4')));};Dialer[_0x31b7('0x1d')][_0x31b7('0xc5')]=function(_0x275098,_0x5c7864,_0xfcd4b5){return BPromise[_0x31b7('0xb9')]()[_0x31b7('0xc0')](cmHopper[_0x31b7('0xc5')](_0x275098,_0x5c7864,_0xfcd4b5))['catch'](loggerCatch('[unlockContact]\x20'));};Dialer[_0x31b7('0x1d')][_0x31b7('0xc6')]=function(_0x27d881,_0x5ee4ff,_0x360d01,_0x52ba80,_0x1e8bd1){return BPromise[_0x31b7('0xb9')]()['then'](cmHopper['getContactDialer'](_0x27d881,_0x5ee4ff,_0x360d01,_0x52ba80))[_0x31b7('0xb3')](function(_0x2dd417){_0x1e8bd1[_0x31b7('0xc7')]-=_0x360d01;_0x1e8bd1[_0x31b7('0xc7')]=_0x1e8bd1[_0x31b7('0xc7')]>0x0?_0x1e8bd1[_0x31b7('0xc7')]:0x0;loggerCatch(_0x31b7('0xc8'))(_0x2dd417);});};Dialer[_0x31b7('0x1d')][_0x31b7('0xc9')]=function(_0x16bce7,_0x197290,_0x31cb08,_0x264c3e){return BPromise['resolve']()[_0x31b7('0xc0')](cmHopper[_0x31b7('0xc9')](_0x16bce7,_0x197290,_0x31cb08))[_0x31b7('0xb3')](function(_0xde7fc){_0x264c3e[_0x31b7('0xc7')]-=_0x197290;_0x264c3e[_0x31b7('0xc7')]=_0x264c3e[_0x31b7('0xc7')]>0x0?_0x264c3e[_0x31b7('0xc7')]:0x0;loggerCatch(_0x31b7('0xca'))(_0xde7fc);});};Dialer[_0x31b7('0x1d')][_0x31b7('0xcb')]=function(_0xad0c10){return BPromise['resolve']()['then'](voiceQueueRt[_0x31b7('0xcb')](_0xad0c10))[_0x31b7('0xb3')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x31b7('0x1d')][_0x31b7('0xcc')]=function(_0x430e13){return BPromise['resolve']()[_0x31b7('0xc0')](cmHopper['moveContactManagedDialer'](_0x430e13))[_0x31b7('0xb3')](loggerCatch(_0x31b7('0xcd')));};Dialer[_0x31b7('0x1d')][_0x31b7('0xce')]=function(_0xab916b){return BPromise[_0x31b7('0xb9')]()[_0x31b7('0xc0')](cmHopperHistory[_0x31b7('0xce')](_0xab916b))[_0x31b7('0xb3')](loggerCatch(_0x31b7('0xcf')));};Dialer[_0x31b7('0x1d')]['updateOriginated']=function(_0x186a3f){if(!_[_0x31b7('0x42')](_0x186a3f)&&_0x186a3f!==null){if(typeof _0x186a3f[_0x31b7('0x72')]!==_0x31b7('0x9c')){if(_0x186a3f['originated']>0x0){_0x186a3f[_0x31b7('0x72')]-=0x1;}else{logger[_0x31b7('0x98')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x31b7('0x98')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x31b7('0x1d')][_0x31b7('0xd0')]=function(_0x22efbc,_0x84f4b6){var _0xe7429f=this;return function(_0x3e500b){_0xe7429f['updateOriginated'](_0x84f4b6);logger[_0x31b7('0x98')](_0x22efbc,util[_0x31b7('0x99')](_0x3e500b,{'showHidden':![],'depth':null}));};};Dialer[_0x31b7('0x1d')][_0x31b7('0xd1')]=function(_0x344517,_0x3bebcb,_0x2f8c39){var _0x4a855a={'state':0x19,'statedesc':'notFound'};this[_0x31b7('0xb5')](_0x3bebcb);this[_0x31b7('0xd2')](_['merge'](_0x4a855a,_[_0x31b7('0xd3')](_0x2f8c39,[_0x31b7('0xd4'),_0x31b7('0xd5'),_0x31b7('0xd6'),_0x31b7('0xd7'),_0x31b7('0xd8')])),'[emptyContact][createHistory]',_0x31b7('0xd9'));logger[_0x31b7('0x98')](_0x344517);};Dialer['prototype'][_0x31b7('0xda')]=function(_0x192da1){return _0x192da1==='Success';};Dialer[_0x31b7('0x1d')]['isTrunkReachable']=function(_0x2e9bf5){return!_[_0x31b7('0x42')](_0x2e9bf5)&&_0x2e9bf5&&!_[_0x31b7('0x42')](_0x2e9bf5[_0x31b7('0x49')])&&!_[_0x31b7('0x42')](_0x2e9bf5[_0x31b7('0x76')])&&_0x2e9bf5['active']&&(this[_0x31b7('0x26')][util[_0x31b7('0x7d')](_0x31b7('0xdb'),_0x2e9bf5[_0x31b7('0x49')])][_0x31b7('0xdc')]===_0x31b7('0xdd')||this[_0x31b7('0x26')][util[_0x31b7('0x7d')]('SIP/%s',_0x2e9bf5[_0x31b7('0x49')])][_0x31b7('0xdc')]==='unmonitored');};Dialer['prototype']['saveInDb']=function(_0x46c8a8,_0x3033a2,_0x2786cc){this[_0x31b7('0xce')](_0x46c8a8)[_0x31b7('0xb3')](loggerCatch(_0x3033a2));this[_0x31b7('0xcc')](_0x46c8a8)[_0x31b7('0xb3')](loggerCatch(_0x2786cc));};Dialer[_0x31b7('0x1d')]['syncVarSet']=function(_0x2826bd){var _0x13572a=this['uniqueId'][_0x2826bd[_0x31b7('0xde')]];var _0x7bc9ea;if(!_[_0x31b7('0xdf')](_0x2826bd)&&!_[_0x31b7('0xdf')](_0x2826bd[_0x31b7('0xe0')])&&!_[_0x31b7('0xdf')](_0x2826bd[_0x31b7('0xe0')][_0x31b7('0xe1')])&&_0x2826bd[_0x31b7('0xe2')]==='xcally-motion-dialer'&&_0x13572a){if(_0x13572a[_0x31b7('0x51')]!==_0x31b7('0x7c')&&this[_0x31b7('0x23')][_0x13572a['queue']][_0x31b7('0xe3')]&&_0x2826bd['value']==='HANGUP'){delete this[_0x31b7('0xaf')][_0x2826bd[_0x31b7('0xde')]];this['updateOriginated'](this[_0x31b7('0x23')][_0x13572a[_0x31b7('0xb6')]]);this[_0x31b7('0x23')][_0x13572a['queue']]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x13572a[_0x31b7('0xb6')]][_0x31b7('0x60')]+=0x1;_0x7bc9ea=new Hangup(_0x13572a,_0x2826bd);_0x7bc9ea['state']=0x12;_0x7bc9ea[_0x31b7('0xab')]=_0x31b7('0xe4');_0x7bc9ea[_0x31b7('0xe5')]=_0x31b7('0xe6');ami[_0x31b7('0x50')](_0x31b7('0xe7'),ut[_0x31b7('0xe8')](_0x7bc9ea,'amd'));this[_0x31b7('0xd2')](_0x7bc9ea,'[syncHangupInAMD][createHistory]',_0x31b7('0xe9'));}if(_0x13572a[_0x31b7('0x51')]!==_0x31b7('0x7c')&&this['voiceQueues'][_0x13572a[_0x31b7('0xb6')]]['dialAMDActive']&&_0x2826bd[_0x31b7('0xea')]==='MACHINE'){var _0x3f0c72=this;return new BPromise(function(_0x5b12fe,_0x2ae40c){delete _0x3f0c72[_0x31b7('0xaf')][_0x2826bd[_0x31b7('0xde')]];_0x3f0c72['updateOriginated'](_0x3f0c72[_0x31b7('0x23')][_0x13572a[_0x31b7('0xb6')]]);_0x3f0c72['voiceQueues'][_0x13572a[_0x31b7('0xb6')]][_0x31b7('0xeb')]+=0x1;_0x3f0c72[_0x31b7('0x23')][_0x13572a[_0x31b7('0xb6')]][_0x31b7('0x60')]+=0x1;var _0x5c8071=_0x3f0c72[_0x31b7('0x23')][_0x13572a[_0x31b7('0xb6')]];var _0x454e27=new Hangup(_0x13572a,_0x2826bd);_0x454e27[_0x31b7('0xaa')]=0x13;_0x454e27[_0x31b7('0xab')]=_0x31b7('0xec');_0x454e27[_0x31b7('0xe5')]=_0x31b7('0xe6');_0x454e27[_0x31b7('0xed')]+=0x1;_0x454e27['countglobal']+=0x1;_0x454e27[_0x31b7('0xee')]=!![];ami['emit']('custom:amd',ut[_0x31b7('0xe8')](_0x454e27,_0x31b7('0xee')));_0x3f0c72[_0x31b7('0xce')](_0x454e27)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x454e27[_0x31b7('0xef')]+_0x454e27['countcongestionretry']+_0x454e27[_0x31b7('0xf0')]+_0x454e27[_0x31b7('0xf1')]+_0x454e27[_0x31b7('0xf2')]+_0x454e27['countabandonedretry']+_0x454e27[_0x31b7('0xed')]+_0x454e27[_0x31b7('0xf3')]>=_0x5c8071[_0x31b7('0xf4')]){_0x3f0c72[_0x31b7('0xf5')](_0x454e27,_0x5b12fe,_0x2ae40c,_0x31b7('0xf6'));}else{if(_0x454e27[_0x31b7('0xed')]>=_0x5c8071[_0x31b7('0xf7')]){_0x3f0c72[_0x31b7('0xf8')](_0x454e27,_0x5b12fe,_0x2ae40c,'reason\x2019\x20machine....');}else{_0x3f0c72[_0x31b7('0xc3')]({'active':![],'countmachineretry':_0x454e27[_0x31b7('0xed')],'scheduledat':moment()[_0x31b7('0xf9')](_0x5c8071[_0x31b7('0xfa')],_0x31b7('0xfb'))['format'](_0x31b7('0xfc')),'ContactId':_0x454e27[_0x31b7('0xd4')],'ListId':_0x454e27[_0x31b7('0xd5')],'VoiceQueueId':_0x454e27[_0x31b7('0xd7')]||undefined,'CampaignId':_0x454e27['CampaignId']||undefined})[_0x31b7('0xb3')](loggerCatch(_0x31b7('0xfd')));_0x5b12fe({'reschedule':0x1});}}});}if(_0x13572a['type']===_0x31b7('0x7c')&&this[_0x31b7('0x24')][_0x13572a[_0x31b7('0xb6')]][_0x31b7('0xe3')]&&_0x2826bd[_0x31b7('0xea')]==='HANGUP'){delete this[_0x31b7('0xaf')][_0x2826bd['uniqueid']];this[_0x31b7('0xb5')](this[_0x31b7('0x24')][_0x13572a['queue']]);_0x7bc9ea=new Hangup(_0x13572a,_0x2826bd);_0x7bc9ea[_0x31b7('0xaa')]=0x12;_0x7bc9ea[_0x31b7('0xab')]='HangupInAMD';_0x7bc9ea['membername']=_0x31b7('0xe6');ami[_0x31b7('0x50')](_0x31b7('0xe7'),ut['buildObj'](_0x7bc9ea,_0x31b7('0xee')));this[_0x31b7('0xd2')](_0x7bc9ea,_0x31b7('0xfe'),'[syncHangupInAMDIvr]');}if(_0x13572a[_0x31b7('0x51')]==='ivr'&&this[_0x31b7('0x24')][_0x13572a['queue']][_0x31b7('0xe3')]&&_0x2826bd['value']===_0x31b7('0xff')){var _0x3f0c72=this;return new BPromise(function(_0x2099a6,_0x1e3f50){delete _0x3f0c72[_0x31b7('0xaf')][_0x2826bd[_0x31b7('0xde')]];_0x3f0c72['updateOriginated'](_0x3f0c72[_0x31b7('0x24')][_0x13572a[_0x31b7('0xb6')]]);_0x3f0c72[_0x31b7('0x24')][_0x13572a[_0x31b7('0xb6')]][_0x31b7('0xeb')]+=0x1;_0x3f0c72[_0x31b7('0x24')][_0x13572a[_0x31b7('0xb6')]][_0x31b7('0x60')]+=0x1;var _0x5e1bd4=_0x3f0c72[_0x31b7('0x24')][_0x13572a[_0x31b7('0xb6')]];var _0x37d78c=new Hangup(_0x13572a,_0x2826bd);_0x37d78c[_0x31b7('0xaa')]=0x13;_0x37d78c[_0x31b7('0xab')]=_0x31b7('0xec');_0x37d78c[_0x31b7('0xe5')]=_0x31b7('0xe6');_0x37d78c[_0x31b7('0xed')]+=0x1;_0x37d78c[_0x31b7('0x100')]+=0x1;_0x37d78c[_0x31b7('0xee')]=!![];ami[_0x31b7('0x50')]('custom:amd',ut[_0x31b7('0xe8')](_0x37d78c,'amd'));_0x3f0c72[_0x31b7('0xce')](_0x37d78c)[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x101')));if(_0x37d78c[_0x31b7('0xef')]+_0x37d78c['countcongestionretry']+_0x37d78c[_0x31b7('0xf0')]+_0x37d78c['countnosuchnumberretry']+_0x37d78c[_0x31b7('0xf2')]+_0x37d78c['countabandonedretry']+_0x37d78c[_0x31b7('0xed')]+_0x37d78c[_0x31b7('0xf3')]>=_0x5e1bd4[_0x31b7('0xf4')]){_0x3f0c72['stateGlobal'](_0x37d78c,_0x2099a6,_0x1e3f50,_0x31b7('0xf6'));}else{if(_0x37d78c['countmachineretry']>=_0x5e1bd4[_0x31b7('0xf7')]){_0x3f0c72['createStateFinal'](_0x37d78c,_0x2099a6,_0x1e3f50,_0x31b7('0x102'));}else{_0x3f0c72['rescheduleContact']({'active':![],'countmachineretry':_0x37d78c[_0x31b7('0xed')],'scheduledat':moment()['add'](_0x5e1bd4[_0x31b7('0xfa')],_0x31b7('0xfb'))[_0x31b7('0x7d')](_0x31b7('0xfc')),'ContactId':_0x37d78c[_0x31b7('0xd4')],'ListId':_0x37d78c[_0x31b7('0xd5')],'VoiceQueueId':_0x37d78c[_0x31b7('0xd7')]||undefined,'CampaignId':_0x37d78c[_0x31b7('0xd8')]||undefined})[_0x31b7('0xb3')](loggerCatch(_0x31b7('0xfd')));_0x2099a6({'reschedule':0x1});}}});}}};Dialer[_0x31b7('0x1d')][_0x31b7('0x3a')]=function(_0x459c0a){var _0x4a3add=this['uniqueId'][_0x459c0a[_0x31b7('0xde')]];var _0x3998da=this;var _0x179c10;if(_0x4a3add&&_0x4a3add['type']===_0x31b7('0x7c')){delete this[_0x31b7('0xaf')][_0x459c0a[_0x31b7('0xde')]];this[_0x31b7('0xb5')](this[_0x31b7('0x24')][_0x4a3add[_0x31b7('0xb6')]]);this[_0x31b7('0x24')][_0x4a3add[_0x31b7('0xb6')]][_0x31b7('0x103')]+=0x1;_0x179c10=new Hangup(_0x4a3add,_0x459c0a);this[_0x31b7('0xce')](_0x179c10)[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x104')));this['moveContactManagedDialer'](_0x179c10)[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x105')));}if(_0x4a3add&&_0x4a3add[_0x31b7('0x51')]!=='ivr'&&isNotNull(this[_0x31b7('0x23')][_0x4a3add[_0x31b7('0xb6')]][_0x31b7('0x106')])){delete this[_0x31b7('0xaf')][_0x459c0a[_0x31b7('0xde')]];this['updateOriginated'](this[_0x31b7('0x23')][_0x4a3add[_0x31b7('0xb6')]]);this['voiceQueues'][_0x4a3add[_0x31b7('0xb6')]][_0x31b7('0xeb')]+=0x1;this[_0x31b7('0x23')][_0x4a3add[_0x31b7('0xb6')]][_0x31b7('0x60')]+=0x1;_0x179c10=new Hangup(_0x4a3add,_0x459c0a);_0x179c10[_0x31b7('0xaa')]=0x10;_0x179c10[_0x31b7('0xab')]=_0x31b7('0x107');_0x179c10['membername']=_0x31b7('0x108');this[_0x31b7('0xce')](_0x179c10)['catch'](loggerCatch(_0x31b7('0x104')));this[_0x31b7('0xcc')](_0x179c10)[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x105')));}if(_0x4a3add&&_0x4a3add[_0x31b7('0x51')]!==_0x31b7('0x7c')&&!isNotNull(this['voiceQueues'][_0x4a3add['queue']][_0x31b7('0x106')])){delete this[_0x31b7('0xaf')][_0x459c0a[_0x31b7('0xde')]];this['updateOriginated'](this[_0x31b7('0x23')][_0x4a3add[_0x31b7('0xb6')]]);this[_0x31b7('0x23')][_0x4a3add['queue']][_0x31b7('0x69')]+=0x1;_0x179c10=new Hangup(_0x4a3add,_0x459c0a);_0x179c10['state']=0xc;_0x179c10[_0x31b7('0xab')]=_0x459c0a[_0x31b7('0x109')];_0x179c10[_0x31b7('0xe5')]=_0x31b7('0x10a');this[_0x31b7('0xce')](_0x179c10)[_0x31b7('0xb3')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x31b7('0xcc')](_0x179c10)[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x105')));}};Dialer[_0x31b7('0x1d')][_0x31b7('0x38')]=function(_0x5209be){var _0x1f7b63=this[_0x31b7('0xaf')][_0x5209be['uniqueid']];var _0x357371=this;if(this[_0x31b7('0x23')][_0x5209be[_0x31b7('0xb6')]]){if(_0x1f7b63&&_0x1f7b63[_0x31b7('0x51')]!==_0x31b7('0x7c')){delete this[_0x31b7('0xaf')][_0x5209be[_0x31b7('0xde')]];this['voiceQueues'][_0x5209be[_0x31b7('0xb6')]]['outboundAnswerCallsDay']+=0x1;var _0x1a820c=new AgentComplete(_0x1f7b63,_0x5209be);if(_0x5209be[_0x31b7('0x10b')]===_0x31b7('0x10c')){_0x1a820c['agiafterat']=this[_0x31b7('0x23')][_0x5209be[_0x31b7('0xb6')]]['dialQueueProject2']&&this[_0x31b7('0x23')][_0x5209be[_0x31b7('0xb6')]]['dialAgiAfterHangupAgent']?moment()[_0x31b7('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x31b7('0xce')](_0x1a820c)[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x10d')));this['moveContactManagedDialer'](_0x1a820c)['catch'](loggerCatch(_0x31b7('0x10e')));}}};Dialer[_0x31b7('0x1d')][_0x31b7('0x31')]=function(_0xcb5178){if(this[_0x31b7('0x23')][_0xcb5178[_0x31b7('0xb6')]]){if(this[_0x31b7('0xaf')][_0xcb5178['uniqueid']]&&this[_0x31b7('0xaf')][_0xcb5178[_0x31b7('0xde')]][_0x31b7('0x51')]!==_0x31b7('0x7c')){this[_0x31b7('0xb5')](this[_0x31b7('0x23')][_0xcb5178['queue']]);this[_0x31b7('0xaf')][_0xcb5178[_0x31b7('0xde')]][_0x31b7('0x10f')]=moment()[_0x31b7('0x7d')](_0x31b7('0xfc'));}}};Dialer[_0x31b7('0x1d')][_0x31b7('0x110')]=function(_0x4c42e4){this[_0x31b7('0xce')](_0x4c42e4)[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x10d')));this[_0x31b7('0xcc')](_0x4c42e4)[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x111')));};Dialer[_0x31b7('0x1d')][_0x31b7('0x34')]=function(_0x4a000e){var _0x47b0c0=this[_0x31b7('0xaf')][_0x4a000e['uniqueid']];var _0x315889=this;if(this['voiceQueues'][_0x4a000e['queue']]){if(_0x47b0c0&&_0x47b0c0[_0x31b7('0x51')]!==_0x31b7('0x7c')){delete this['uniqueId'][_0x4a000e[_0x31b7('0xde')]];this['updateOriginated'](this[_0x31b7('0x23')][_0x4a000e[_0x31b7('0xb6')]]);_0x47b0c0['droptime']=moment()[_0x31b7('0x7d')](_0x31b7('0xfc'));var _0x4bdd02=new QueueCallerAbandon(_0x47b0c0,_0x4a000e);if(getSeconds(_0x47b0c0['droptime'],_0x47b0c0[_0x31b7('0x112')])>=_0x47b0c0[_0x31b7('0x113')]){this[_0x31b7('0x23')][_0x4a000e['queue']][_0x31b7('0x6d')]+=0x1;this[_0x31b7('0x23')][_0x4a000e['queue']][_0x31b7('0x65')]+=0x1;this[_0x31b7('0x23')][_0x4a000e[_0x31b7('0xb6')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x4bdd02['state']=0xa;_0x4bdd02[_0x31b7('0xab')]=_0x31b7('0x114');_0x4bdd02[_0x31b7('0x115')]='TIMEOUT';_0x4bdd02[_0x31b7('0x116')]=this[_0x31b7('0x23')][_0x4a000e[_0x31b7('0xb6')]][_0x31b7('0x117')]?moment()[_0x31b7('0x7d')](_0x31b7('0xfc')):undefined;_0x4bdd02[_0x31b7('0xf2')]+=0x1;_0x4bdd02[_0x31b7('0x100')]+=0x1;if(_0x4bdd02['countdropretry']>=this['voiceQueues'][_0x4a000e[_0x31b7('0xb6')]][_0x31b7('0x118')]){this['queueCallerAbandonCreateState'](_0x4bdd02);}else{this[_0x31b7('0xc3')]({'active':![],'countdropretry':_0x4bdd02[_0x31b7('0xf2')],'scheduledat':moment()[_0x31b7('0xf9')](this[_0x31b7('0x23')][_0x4a000e[_0x31b7('0xb6')]]['dialDropRetryFrequency'],_0x31b7('0xfb'))[_0x31b7('0x7d')](_0x31b7('0xfc')),'ContactId':_0x47b0c0['ContactId'],'ListId':_0x47b0c0[_0x31b7('0xd5')],'VoiceQueueId':_0x47b0c0[_0x31b7('0xd7')]||undefined,'CampaignId':_0x47b0c0['CampaignId']||undefined})[_0x31b7('0xb3')](loggerCatch('[rescheduleContact][Drop]'));var _0x1cc5c5=new History(_0x4bdd02);_0x1cc5c5[_0x31b7('0xaa')]=0xa;_0x1cc5c5[_0x31b7('0xab')]='Drop';_0x1cc5c5[_0x31b7('0xad')]=moment()[_0x31b7('0x7d')](_0x31b7('0xfc'));_0x1cc5c5[_0x31b7('0xac')]=_0x1cc5c5[_0x31b7('0xad')];_0x1cc5c5['calleridname']=_0x4bdd02[_0x31b7('0x119')];_0x1cc5c5[_0x31b7('0x11a')]=_0x4bdd02[_0x31b7('0x11a')];this[_0x31b7('0xce')](_0x1cc5c5)[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x11b')));}}else{this[_0x31b7('0x23')][_0x4a000e[_0x31b7('0xb6')]][_0x31b7('0x6c')]+=0x1;this[_0x31b7('0x23')][_0x4a000e[_0x31b7('0xb6')]][_0x31b7('0x11c')]+=0x1;_0x4bdd02[_0x31b7('0xaa')]=0xb;_0x4bdd02[_0x31b7('0xab')]=_0x31b7('0x11d');_0x4bdd02[_0x31b7('0x115')]=_0x31b7('0x11e');_0x4bdd02[_0x31b7('0x11f')]+=0x1;_0x4bdd02[_0x31b7('0x100')]+=0x1;if(_0x4bdd02[_0x31b7('0x11f')]>=this[_0x31b7('0x23')][_0x4a000e[_0x31b7('0xb6')]][_0x31b7('0x120')]){this[_0x31b7('0x110')](_0x4bdd02);}else{this[_0x31b7('0xc3')]({'active':![],'countabandonedretry':_0x4bdd02[_0x31b7('0x11f')],'scheduledat':moment()[_0x31b7('0xf9')](this[_0x31b7('0x23')][_0x4a000e[_0x31b7('0xb6')]][_0x31b7('0x121')],'minutes')[_0x31b7('0x7d')](_0x31b7('0xfc')),'ContactId':_0x47b0c0[_0x31b7('0xd4')],'ListId':_0x47b0c0[_0x31b7('0xd5')],'VoiceQueueId':_0x47b0c0['VoiceQueueId']||undefined,'CampaignId':_0x47b0c0[_0x31b7('0xd8')]||undefined})['catch'](loggerCatch(_0x31b7('0x122')));var _0x1cc5c5=new History(_0x4bdd02);_0x1cc5c5[_0x31b7('0xaa')]=0xb;_0x1cc5c5[_0x31b7('0xab')]='Abandoned';_0x1cc5c5[_0x31b7('0xad')]=moment()[_0x31b7('0x7d')](_0x31b7('0xfc'));_0x1cc5c5['endtime']=_0x1cc5c5[_0x31b7('0xad')];_0x1cc5c5['calleridname']=_0x4bdd02[_0x31b7('0x119')];_0x1cc5c5[_0x31b7('0x11a')]=_0x4bdd02[_0x31b7('0x11a')];this[_0x31b7('0xce')](_0x1cc5c5)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer['prototype'][_0x31b7('0x3c')]=function(_0x3685f0){if(this[_0x31b7('0x29')][_0x3685f0[_0x31b7('0xde')]]){this[_0x31b7('0x29')][_0x3685f0[_0x31b7('0xde')]][_0x31b7('0xb2')]=_0x3685f0[_0x31b7('0xb2')];}if(this[_0x31b7('0xaf')][_0x3685f0[_0x31b7('0xde')]]){this[_0x31b7('0xaf')][_0x3685f0['uniqueid']][_0x31b7('0xb2')]=_0x3685f0[_0x31b7('0xb2')];}};Dialer[_0x31b7('0x1d')][_0x31b7('0x123')]=function(_0x4c3670){if(strategy[this[_0x31b7('0x23')][this[_0x31b7('0x29')][_0x4c3670[_0x31b7('0x124')]]['queue']][_0x31b7('0x53')]]===_0x31b7('0x1c')){if(this[_0x31b7('0x29')][_0x4c3670['actionid']]&&_[_0x31b7('0xdf')](this['actions'][_0x4c3670[_0x31b7('0x124')]][_0x31b7('0x125')])&&_0x4c3670[_0x31b7('0xdc')]==='1'&&_0x4c3670[_0x31b7('0x126')]==='0'){if(this['agents'][_0x4c3670[_0x31b7('0x127')]]){if(!this[_0x31b7('0x25')][_0x4c3670['stateinterface']][_0x31b7('0x125')]){this['agents'][_0x4c3670['stateinterface']]['locked']=!![];this[_0x31b7('0x29')][_0x4c3670[_0x31b7('0x124')]][_0x31b7('0x125')]=!![];this[_0x31b7('0x29')][_0x4c3670[_0x31b7('0x124')]][_0x31b7('0x127')]=_0x4c3670['stateinterface'];}}}}else if((strategy[this[_0x31b7('0x23')][this['actions'][_0x4c3670['actionid']]['queue']][_0x31b7('0x53')]]||_0x31b7('0x1b'))===_0x31b7('0x1b')){if(this['actions'][_0x4c3670[_0x31b7('0x124')]]){if(this['agents'][_0x4c3670['stateinterface']]){this[_0x31b7('0x29')][_0x4c3670['actionid']][_0x31b7('0x127')]=_0x4c3670[_0x31b7('0x127')];if(_[_0x31b7('0xdf')](this[_0x31b7('0x128')][this['actions'][_0x4c3670[_0x31b7('0x124')]]['queue']])){this[_0x31b7('0x128')][this[_0x31b7('0x29')][_0x4c3670[_0x31b7('0x124')]][_0x31b7('0xb6')]]=[];}this[_0x31b7('0x128')][this[_0x31b7('0x29')][_0x4c3670['actionid']][_0x31b7('0xb6')]][_0x31b7('0x129')](_['merge'](_[_0x31b7('0xd3')](this[_0x31b7('0x29')][_0x4c3670[_0x31b7('0x124')]],['idHopper',_0x31b7('0x127')]),{'status':_0x4c3670[_0x31b7('0xdc')],'paused':_0x4c3670[_0x31b7('0x126')]}));}}}};function unlockQueueStatus(_0x3e9072,_0x23904b){setTimeout(function(){if(_[_0x31b7('0x42')](_0x3e9072[_0x31b7('0x12a')])){loggerBooked['error'](_0x31b7('0x12b'),_0x23904b);}_0x3e9072['queueStatusComplete']=!![];loggerBooked[_0x31b7('0x80')](_0x31b7('0x12c'),_0x23904b,JSON['stringify'](_['pick'](_0x3e9072,[_0x31b7('0x49'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x31b7('0x1d')][_0x31b7('0x40')]=function(_0x4de8b1){var _0x27fd49=this;var _0x206c0f=_0x27fd49['voiceQueues'][_0x27fd49[_0x31b7('0x29')][_0x4de8b1[_0x31b7('0x124')]][_0x31b7('0xb6')]];if(strategy[this[_0x31b7('0x23')][this[_0x31b7('0x29')][_0x4de8b1[_0x31b7('0x124')]][_0x31b7('0xb6')]][_0x31b7('0x53')]]===_0x31b7('0x1c')){if(this[_0x31b7('0x29')][_0x4de8b1[_0x31b7('0x124')]]&&this[_0x31b7('0x29')][_0x4de8b1[_0x31b7('0x124')]]['stateinterface']){this[_0x31b7('0x22')][_0x31b7('0x12d')](this[_0x31b7('0x29')][_0x4de8b1[_0x31b7('0x124')]][_0x31b7('0x12e')],this[_0x31b7('0x29')][_0x4de8b1[_0x31b7('0x124')]][_0x31b7('0x127')])['catch'](function(_0x24c059){logger[_0x31b7('0x98')](_0x31b7('0x12f'),util['inspect'](_0x24c059,{'showHidden':![],'depth':null}));})[_0x31b7('0x20')](function(){_0x27fd49[_0x31b7('0xb5')](_0x27fd49['voiceQueues'][_0x27fd49['actions'][_0x4de8b1['actionid']][_0x31b7('0xb6')]]);_0x27fd49['agents'][_0x27fd49['actions'][_0x4de8b1[_0x31b7('0x124')]]['stateinterface']][_0x31b7('0x125')]=![];delete _0x27fd49[_0x31b7('0x29')][_0x4de8b1['actionid']];unlockQueueStatus(_0x206c0f);});}else{this['updateOriginated'](this[_0x31b7('0x23')][this['actions'][_0x4de8b1[_0x31b7('0x124')]][_0x31b7('0xb6')]]);this[_0x31b7('0xc3')]({'active':![],'ContactId':this[_0x31b7('0x29')][_0x4de8b1[_0x31b7('0x124')]]['ContactId'],'ListId':this[_0x31b7('0x29')][_0x4de8b1[_0x31b7('0x124')]][_0x31b7('0xd5')],'VoiceQueueId':this[_0x31b7('0x29')][_0x4de8b1['actionid']][_0x31b7('0xd7')]||undefined,'CampaignId':this[_0x31b7('0x29')][_0x4de8b1[_0x31b7('0x124')]][_0x31b7('0xd8')]||undefined})[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x130')));delete this['actions'][_0x4de8b1[_0x31b7('0x124')]];unlockQueueStatus(_0x206c0f);}}else if((strategy[this[_0x31b7('0x23')][this[_0x31b7('0x29')][_0x4de8b1['actionid']][_0x31b7('0xb6')]][_0x31b7('0x53')]]||'rrmemory')===_0x31b7('0x1b')){var _0x5757e9;if(this[_0x31b7('0x29')][_0x4de8b1[_0x31b7('0x124')]]&&!_[_0x31b7('0x4a')](this[_0x31b7('0x128')][this['actions'][_0x4de8b1[_0x31b7('0x124')]][_0x31b7('0xb6')]])){if(this[_0x31b7('0x2f')][_0x27fd49[_0x31b7('0x29')][_0x4de8b1[_0x31b7('0x124')]]['queue']]){this[_0x31b7('0x2f')][_0x27fd49['actions'][_0x4de8b1[_0x31b7('0x124')]][_0x31b7('0xb6')]]=this[_0x31b7('0x2f')][this[_0x31b7('0x29')][_0x4de8b1['actionid']][_0x31b7('0xb6')]]?this[_0x31b7('0x2f')][this[_0x31b7('0x29')][_0x4de8b1['actionid']][_0x31b7('0xb6')]]:this[_0x31b7('0x128')][this[_0x31b7('0x29')][_0x4de8b1[_0x31b7('0x124')]][_0x31b7('0xb6')]]?this[_0x31b7('0x128')][this['actions'][_0x4de8b1[_0x31b7('0x124')]][_0x31b7('0xb6')]][_0x31b7('0x131')]||0x0:0x0;}this[_0x31b7('0x128')][this[_0x31b7('0x29')][_0x4de8b1['actionid']]['queue']][_0x31b7('0x131')]=this['queueBookedRR'][this[_0x31b7('0x29')][_0x4de8b1[_0x31b7('0x124')]][_0x31b7('0xb6')]];for(var _0x30cebb=0x0;_0x30cebb=0x0;})[_0x31b7('0xb3')](myreject(_0x50e9a8)));}}else{_0x4b4063[_0x31b7('0x129')](ami[_0x31b7('0xb1')]({'action':_0x31b7('0x14a'),'command':util[_0x31b7('0x7d')]('iftime\x20%s,%s',_0xcf1ac5,!_[_0x31b7('0x42')](config[_0x31b7('0x14c')][_0x395148])?_0x395148:'')})[_0x31b7('0xc0')](function(_0x278bf8){return _0x278bf8['content'][_0x31b7('0x14e')](_0x31b7('0x14f'))>=0x0;})[_0x31b7('0xb3')](myreject(_0x50e9a8)));}BPromise['all'](_0x4b4063)[_0x31b7('0xc0')](function(_0x34ed54){var _0x4ef282=_[_0x31b7('0x150')](_0x34ed54);if(_0x4ef282){return _0x47e42a(_0x4ef282);}else{_0x41d07f[_0x31b7('0x43')]=_0x153575?_0x31b7('0x151'):_0x31b7('0x152');return _0x50e9a8(msgResponse('[ifTime][promiseAll]',_0x31b7('0x144'),_0x31b7('0x153')+_0x153575+'\x20'+_0xa8ae6f+_0x31b7('0x154')+util[_0x31b7('0x99')](_0xcf1ac5,{'showHidden':![],'depth':null})+_0x31b7('0x155')+_0x395148));}})['catch'](function(_0x228a13){return _0x50e9a8(msgResponse(_0x31b7('0x143'),_0x31b7('0x144'),JSON[_0x31b7('0x78')](_0x228a13)));});});};Dialer[_0x31b7('0x1d')][_0x31b7('0x156')]=function(_0x2a3120){var _0x322fec=this;return function(){switch(_0x2a3120[_0x31b7('0x5c')]){case _0x31b7('0x157'):freeVariablesPredictive(_0x2a3120);_0x322fec[_0x31b7('0x158')](_0x2a3120,0x1);break;case'power':freeVariablesPredictive(_0x2a3120);_0x322fec[_0x31b7('0x158')](_0x2a3120,_0x2a3120[_0x31b7('0x159')]);break;case'predictive':_0x322fec[_0x31b7('0x15a')](_0x2a3120);break;case _0x31b7('0x7'):freeVariablesPredictive(_0x2a3120);_0x322fec[_0x31b7('0x158')](_0x2a3120,0x1);break;default:freeVariablesPredictive(_0x2a3120);logger[_0x31b7('0x98')]('Queue',_0x2a3120[_0x31b7('0x49')],_0x31b7('0x15b'));}};};Dialer[_0x31b7('0x1d')][_0x31b7('0x15c')]=function(_0x14e65f){var _0x3a1a77=this;return function(){_0x3a1a77[_0x31b7('0x15d')](_0x14e65f);};};Dialer[_0x31b7('0x1d')][_0x31b7('0x9')]=function(_0x5b56fd){var _0x34e21e=this;if(isNotPreview(_0x5b56fd[_0x31b7('0x5c')])){if(isVoiceQueueOutbound(_0x5b56fd[_0x31b7('0x51')])&&isActive(_0x5b56fd['dialActive'])){_0x5b56fd[_0x31b7('0xa3')]=!![];BPromise[_0x31b7('0xb9')]()[_0x31b7('0xc0')](checkIsLoggedIn(_0x5b56fd,_0x5b56fd[_0x31b7('0x15e')]))[_0x31b7('0xc0')](checkIsActive(_0x5b56fd,_0x5b56fd[_0x31b7('0x5b')]))[_0x31b7('0xc0')](checkInterval(_0x5b56fd))[_0x31b7('0xc0')](_0x34e21e[_0x31b7('0x13d')](_0x5b56fd))[_0x31b7('0xc0')](_0x34e21e[_0x31b7('0x142')](_0x5b56fd['dialGlobalInterval'],_0x5b56fd[_0x31b7('0x15f')],_0x5b56fd[_0x31b7('0x49')],_0x5b56fd))[_0x31b7('0xc0')](_0x34e21e[_0x31b7('0x160')](_0x5b56fd[_0x31b7('0x46')],_0x5b56fd[_0x31b7('0x15f')],_0x5b56fd[_0x31b7('0x49')],_0x5b56fd))[_0x31b7('0xc0')](_0x34e21e[_0x31b7('0x156')](_0x5b56fd))[_0x31b7('0xb3')](loggerCatchQueueSummary('[syncQueueSummary]',_0x5b56fd));}else{notSendMessagesQueue(_0x5b56fd);}}else{freeVariablesPredictive(_0x5b56fd);}};Dialer['prototype']['syncCampaigns']=function(){var _0x156739=this;var _0x2e3837;for(var _0x5ce8bc in this[_0x31b7('0x24')]){if(typeof this['campaigns'][_0x5ce8bc]!==_0x31b7('0x9c')){_0x2e3837=this[_0x31b7('0x24')][_0x5ce8bc];if(isCampaignIvr(_0x2e3837['type'])&&isActive(_0x2e3837['active'])){_0x2e3837[_0x31b7('0xa3')]=!![];BPromise[_0x31b7('0xb9')]()[_0x31b7('0xc0')](checkIsActive(_0x2e3837,_0x2e3837[_0x31b7('0x76')]))[_0x31b7('0xc0')](checkInterval(_0x2e3837))[_0x31b7('0xc0')](_0x156739[_0x31b7('0x13d')](_0x2e3837))['then'](_0x156739[_0x31b7('0x142')](_0x2e3837['dialGlobalInterval'],_0x2e3837[_0x31b7('0x15f')],_0x2e3837[_0x31b7('0x49')],_0x2e3837))[_0x31b7('0xc0')](_0x156739[_0x31b7('0x160')](_0x2e3837[_0x31b7('0x46')],_0x2e3837[_0x31b7('0x15f')],_0x2e3837[_0x31b7('0x49')],_0x2e3837))[_0x31b7('0xc0')](_0x156739[_0x31b7('0x15c')](_0x2e3837))[_0x31b7('0xb3')](loggerCatchQueueSummary('[syncCampaigns]',_0x2e3837));}else{notSendMessagesCampaign(_0x2e3837);}}}};function getCallerIdRandom(_0x3808c8,_0x5a195d){var _0x5deea7;var _0x2643fb;var _0x3e7b60;if(_0x5a195d<=0x0){_0x5a195d=0x1;}_0x5deea7=new RegExp(_0x31b7('0x161')+_0x5a195d+'}$');_0x2643fb=Math[_0x31b7('0x162')](0xa,_0x5a195d-0x1);_0x3e7b60=Math['pow'](0xa,_0x5a195d)-0x1;return util[_0x31b7('0x7d')]('%s',_[_0x31b7('0x163')](_0x3808c8,_0x5deea7,_['random'](_0x2643fb,_0x3e7b60)));}function extractCalleridName(_0x165f49){var _0x5ae302=_0x165f49['match'](/"(.*?)"/);return _0x5ae302?_0x5ae302[0x1]:_0x165f49;}function extractCalleridNumber(_0xae112b){var _0x44e910=_0xae112b[_0x31b7('0x164')](/<(.*?)>/);return _0x44e910?_0x44e910[0x1]:_0xae112b;}Dialer['prototype'][_0x31b7('0x165')]=function(_0x5b7873,_0x409e53){var _0x24abb1=this;var _0x144e63=uuid['v4']();this[_0x31b7('0x29')][_0x144e63]=new Action(_0x5b7873,_0x409e53,_0x144e63);return new BPromise(function(_0x234e48,_0x5664a2){if(_[_0x31b7('0x42')](_0x5b7873)&&typeof _0x5b7873!==_0x31b7('0x166')){return _0x5664a2(msgResponse(_0x31b7('0x167'),_0x31b7('0x144'),_0x31b7('0x168')));}if(_[_0x31b7('0x42')](_0x409e53['Contact'][_0x31b7('0x169')])||_0x409e53['Contact']['phone']===null){return _0x5664a2(msgResponse(_0x31b7('0x167'),_0x31b7('0x144'),_0x31b7('0x16a')));}var _0x197493={'XMD-CALLERID':_0x24abb1[_0x31b7('0x29')][_0x144e63][_0x31b7('0x16b')](),'XMD-AGI':_0x5b7873[_0x31b7('0x106')]?util[_0x31b7('0x7d')](_0x31b7('0x16c'),ipAgi,_0x5b7873[_0x31b7('0x106')]):_0x31b7('0x16d'),'XMD-AGIAFTER':_0x5b7873[_0x31b7('0x117')]?util['format'](_0x31b7('0x16c'),ipAgi,_0x5b7873[_0x31b7('0x117')]):'NONE','XMD-QUEUE':_0x5b7873[_0x31b7('0x51')]===_0x31b7('0x52')?util[_0x31b7('0x7d')](_0x31b7('0x16e'),_0x5b7873[_0x31b7('0x49')],_0x5b7873[_0x31b7('0x16f')]||'',_0x5b7873[_0x31b7('0x170')]?'c':'',_0x5b7873[_0x31b7('0x113')]||0x3):'NONE','XMD-CONTACTID':_0x409e53[_0x31b7('0xd4')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x24abb1[_0x31b7('0x29')][_0x144e63][_0x31b7('0x16b')](),'XMD-AMD':_0x5b7873[_0x31b7('0xe3')]?_0x31b7('0x171'):_0x31b7('0x16d'),'XMD-DESTINATION':_0x31b7('0x172')};if(_0x5b7873['dialAMDActive']){_0x197493[_0x31b7('0x173')]=_0x5b7873[_0x31b7('0x174')]||0x9c4;_0x197493[_0x31b7('0x175')]=_0x5b7873[_0x31b7('0x176')]||0x5dc;_0x197493[_0x31b7('0x177')]=_0x5b7873[_0x31b7('0x178')]||0x320;_0x197493[_0x31b7('0x179')]=_0x5b7873[_0x31b7('0x17a')]||0x1388;_0x197493[_0x31b7('0x17b')]=_0x5b7873['dialAMDMinWordLength']||0x64;_0x197493['XMD-AMDBETWEENWORDSSILENCE']=_0x5b7873[_0x31b7('0x17c')]||0x32;_0x197493['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x5b7873[_0x31b7('0x17d')]||0x3;_0x197493[_0x31b7('0x17e')]=_0x5b7873[_0x31b7('0x17f')]||0x100;_0x197493[_0x31b7('0x180')]=_0x5b7873[_0x31b7('0x181')]||0x1388;}if(_0x5b7873[_0x31b7('0x51')]===_0x31b7('0x52')){_0x197493[_0x31b7('0x182')]=_0x409e53[_0x31b7('0xd7')];}else{_0x197493[_0x31b7('0x183')]=_0x409e53[_0x31b7('0xd8')];}for(var _0x19469f in _0x409e53[_0x31b7('0x184')]){if(typeof _0x409e53[_0x31b7('0x184')][_0x19469f]!==_0x31b7('0x9c')){if(isNotNull(_0x409e53[_0x31b7('0x184')][_0x19469f])&&_0x19469f!=='id'&&_0x19469f!==_0x31b7('0x185')&&_0x19469f!==_0x31b7('0x186')&&_0x19469f!==_0x31b7('0x187')){_0x197493[util[_0x31b7('0x7d')]('%s%s',_0x31b7('0x188'),_[_0x31b7('0x189')](_0x19469f))]=_0x409e53['Contact'][_0x19469f];}}}var _0x5c64f7=_0x24abb1[_0x31b7('0x13e')](_0x5b7873[_0x31b7('0x75')])?getCallerId(_0x5b7873[_0x31b7('0x75')][_0x31b7('0x77')],_0x5b7873[_0x31b7('0x5d')],_0x5b7873[_0x31b7('0x18a')]>0x0?getCallerIdRandom(_0x5b7873[_0x31b7('0x5e')],_0x5b7873[_0x31b7('0x18a')]):_0x5b7873[_0x31b7('0x5e')]):getCallerId(_[_0x31b7('0xdf')](_0x5b7873[_0x31b7('0x13f')])?_0x5b7873[_0x31b7('0x75')][_0x31b7('0x77')]:_0x5b7873[_0x31b7('0x13f')]['callerid'],_0x5b7873[_0x31b7('0x5d')],_0x5b7873[_0x31b7('0x18a')]>0x0?getCallerIdRandom(_0x5b7873[_0x31b7('0x5e')],_0x5b7873['dialRandomLastDigitCallerIdNumber']):_0x5b7873[_0x31b7('0x5e')]);if(_0x5c64f7){_0x197493[_0x31b7('0x18b')]=_0x24abb1[_0x31b7('0x29')][_0x144e63][_0x31b7('0x18c')]=extractCalleridName(_0x5c64f7);_0x197493[_0x31b7('0x18d')]=_0x24abb1[_0x31b7('0x29')][_0x144e63][_0x31b7('0x18e')]=extractCalleridNumber(_0x5c64f7);}return ami[_0x31b7('0xb1')]({'actionid':_0x144e63,'action':_0x31b7('0x167'),'channel':_0x24abb1[_0x31b7('0x13e')](_0x5b7873[_0x31b7('0x75')])?util[_0x31b7('0x7d')](_0x31b7('0x18f'),_0x5b7873['Trunk'][_0x31b7('0x49')],isNotNull(_0x5b7873[_0x31b7('0x190')])?_0x5b7873['dialPrefix']['trim']()||'':'',_0x5b7873[_0x31b7('0x191')]>0x0?_0x409e53[_0x31b7('0x184')][_0x31b7('0x169')]['substring'](_0x5b7873[_0x31b7('0x191')]):_0x409e53[_0x31b7('0x184')][_0x31b7('0x169')]):util[_0x31b7('0x7d')](_0x31b7('0x18f'),_[_0x31b7('0xdf')](_0x5b7873[_0x31b7('0x13f')])?_0x5b7873[_0x31b7('0x75')][_0x31b7('0x49')]:_0x5b7873['TrunkBackup'][_0x31b7('0x49')],isNotNull(_0x5b7873[_0x31b7('0x190')])?_0x5b7873[_0x31b7('0x190')][_0x31b7('0x192')]()||'':'',_0x5b7873[_0x31b7('0x191')]>0x0?_0x409e53[_0x31b7('0x184')][_0x31b7('0x169')]['substring'](_0x5b7873[_0x31b7('0x191')]):_0x409e53[_0x31b7('0x184')][_0x31b7('0x169')]),'callerid':_0x5c64f7,'Exten':_0x31b7('0x172'),'Context':'from-sip','Priority':'1','variable':_0x197493,'timeout':(_0x5b7873[_0x31b7('0x5f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x144e63})['then'](function(_0x5e8db3){return _0x234e48(_0x5e8db3);})['catch'](function(_0x44f9d6){_0x5b7873[_0x31b7('0x193')]+=0x1;var _0xdf2f4b=new History(_0x24abb1[_0x31b7('0x29')][_0x144e63]);logger['error'](util[_0x31b7('0x7d')](_0x31b7('0x194'),JSON[_0x31b7('0x78')](_0x44f9d6)));_0xdf2f4b[_0x31b7('0xaa')]=0xe;_0xdf2f4b['statedesc']=_0x31b7('0x195');_0xdf2f4b[_0x31b7('0xad')]=moment()[_0x31b7('0x7d')](_0x31b7('0xfc'));_0xdf2f4b['endtime']=_0xdf2f4b[_0x31b7('0xad')];_0x24abb1[_0x31b7('0xce')](_0xdf2f4b)[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x196')));_0x24abb1[_0x31b7('0xcc')](_0xdf2f4b)[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x196')))[_0x31b7('0x20')](function(){delete _0x24abb1['actions'][_0x144e63];return _0x5664a2(msgResponse(_0x31b7('0x167'),_0x31b7('0x197'),_0x31b7('0x198')));});});});};Dialer['prototype'][_0x31b7('0x36')]=function(_0xd8548){var _0x1eb3ab=this['actions'][_0xd8548['actionid']];if(_0x1eb3ab){delete this[_0x31b7('0x29')][_0xd8548[_0x31b7('0x124')]];_0x1eb3ab[_0x31b7('0x112')]=moment()[_0x31b7('0x7d')](_0x31b7('0xfc'));var _0x3165c1=_0x1eb3ab[_0x31b7('0x51')]===_0x31b7('0x7c')?this[_0x31b7('0x24')][_0x1eb3ab[_0x31b7('0xb6')]]:this[_0x31b7('0x23')][_0x1eb3ab[_0x31b7('0x199')]()];if(!this[_0x31b7('0xda')](_0xd8548[_0x31b7('0x19a')])){this[_0x31b7('0xb5')](_0x3165c1);return this[_0x31b7('0x19b')](_0x1eb3ab,_0x3165c1,_0xd8548)[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x19c')));}this[_0x31b7('0xaf')][_0xd8548['uniqueid']]=_0x1eb3ab;}};Dialer['prototype'][_0x31b7('0x19d')]=function(_0x14a2df,_0x3d206c,_0x1dee59){var _0x4165a9=new History(_0x3d206c);if(_0x4165a9['countbusyretry']+_0x4165a9[_0x31b7('0x19e')]+_0x4165a9['countnoanswerretry']+_0x4165a9[_0x31b7('0xf1')]+_0x4165a9[_0x31b7('0xf2')]+_0x4165a9[_0x31b7('0x11f')]+_0x4165a9[_0x31b7('0xed')]+_0x4165a9[_0x31b7('0xf3')]>=_0x1dee59[_0x31b7('0xf4')]-0x1){return!![];}switch(_0x14a2df){case 0x3:if(_0x4165a9[_0x31b7('0xf0')]>=_0x1dee59['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x31b7('0xc3')]({'active':![],'countnoanswerretry':_0x4165a9[_0x31b7('0xf0')]+=0x1,'scheduledat':moment()[_0x31b7('0xf9')](_0x1dee59[_0x31b7('0x19f')],'minutes')['format'](_0x31b7('0xfc')),'ContactId':_0x4165a9[_0x31b7('0xd4')],'ListId':_0x4165a9['ListId'],'VoiceQueueId':_0x4165a9['VoiceQueueId']||undefined,'CampaignId':_0x4165a9[_0x31b7('0xd8')]||undefined})[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x1a0')));break;case 0x5:if(_0x4165a9[_0x31b7('0xef')]>=_0x1dee59[_0x31b7('0x1a1')]-0x1){return!![];}this[_0x31b7('0xc3')]({'active':![],'countbusyretry':_0x4165a9[_0x31b7('0xef')]+=0x1,'scheduledat':moment()[_0x31b7('0xf9')](_0x1dee59[_0x31b7('0x1a2')],_0x31b7('0xfb'))[_0x31b7('0x7d')](_0x31b7('0xfc')),'ContactId':_0x4165a9[_0x31b7('0xd4')],'ListId':_0x4165a9[_0x31b7('0xd5')],'VoiceQueueId':_0x4165a9[_0x31b7('0xd7')]||undefined,'CampaignId':_0x4165a9[_0x31b7('0xd8')]||undefined})[_0x31b7('0xb3')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x4165a9[_0x31b7('0x19e')]>=_0x1dee59['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x4165a9[_0x31b7('0x19e')]+=0x1,'scheduledat':moment()['add'](_0x1dee59[_0x31b7('0x1a3')],_0x31b7('0xfb'))[_0x31b7('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4165a9['ContactId'],'ListId':_0x4165a9['ListId'],'VoiceQueueId':_0x4165a9[_0x31b7('0xd7')]||undefined,'CampaignId':_0x4165a9['CampaignId']||undefined})['catch'](loggerCatch(_0x31b7('0x1a4')));break;case 0x0:if(_0x4165a9[_0x31b7('0xf1')]>=_0x1dee59[_0x31b7('0x1a5')]-0x1){return!![];}else{this[_0x31b7('0xc3')]({'active':![],'countnosuchnumberretry':_0x4165a9[_0x31b7('0xf1')]+=0x1,'scheduledat':moment()[_0x31b7('0xf9')](_0x1dee59[_0x31b7('0x1a6')],'minutes')[_0x31b7('0x7d')](_0x31b7('0xfc')),'ContactId':_0x4165a9[_0x31b7('0xd4')],'ListId':_0x4165a9[_0x31b7('0xd5')],'VoiceQueueId':_0x4165a9['VoiceQueueId']||undefined,'CampaignId':_0x4165a9[_0x31b7('0xd8')]||undefined})[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x1a7')));}break;case 0xa:if(_0x4165a9[_0x31b7('0xf2')]>=_0x1dee59[_0x31b7('0x118')]-0x1){return!![];}this[_0x31b7('0xc3')]({'active':![],'countdropretry':_0x4165a9[_0x31b7('0xf2')]+=0x1,'scheduledat':moment()[_0x31b7('0xf9')](_0x1dee59[_0x31b7('0x1a8')],_0x31b7('0xfb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4165a9[_0x31b7('0xd4')],'ListId':_0x4165a9[_0x31b7('0xd5')],'VoiceQueueId':_0x4165a9[_0x31b7('0xd7')]||undefined,'CampaignId':_0x4165a9['CampaignId']||undefined})[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x1a9')));break;case 0xb:if(_0x4165a9[_0x31b7('0x11f')]>=_0x1dee59[_0x31b7('0x120')]-0x1){return!![];}this[_0x31b7('0xc3')]({'active':![],'countabandonedretry':_0x4165a9[_0x31b7('0x11f')]+=0x1,'scheduledat':moment()[_0x31b7('0xf9')](_0x1dee59[_0x31b7('0x121')],_0x31b7('0xfb'))[_0x31b7('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4165a9[_0x31b7('0xd4')],'ListId':_0x4165a9[_0x31b7('0xd5')],'VoiceQueueId':_0x4165a9[_0x31b7('0xd7')]||undefined,'CampaignId':_0x4165a9['CampaignId']||undefined})['catch'](loggerCatch(_0x31b7('0x122')));break;case 0x13:if(_0x4165a9[_0x31b7('0xed')]>=_0x1dee59[_0x31b7('0xf7')]-0x1){return!![];}this[_0x31b7('0xc3')]({'active':![],'countmachineretry':_0x4165a9['countmachineretry']+=0x1,'scheduledat':moment()[_0x31b7('0xf9')](_0x1dee59['dialMachineRetryFrequency'],_0x31b7('0xfb'))[_0x31b7('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4165a9[_0x31b7('0xd4')],'ListId':_0x4165a9[_0x31b7('0xd5')],'VoiceQueueId':_0x4165a9[_0x31b7('0xd7')]||undefined,'CampaignId':_0x4165a9[_0x31b7('0xd8')]||undefined})[_0x31b7('0xb3')](loggerCatch(_0x31b7('0xfd')));break;case 0x14:if(_0x4165a9[_0x31b7('0xf3')]>=_0x1dee59[_0x31b7('0x1aa')]-0x1){return!![];}this[_0x31b7('0xc3')]({'active':![],'countagentrejectretry':_0x4165a9['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x31b7('0xf9')](_0x1dee59[_0x31b7('0x1ab')],'minutes')[_0x31b7('0x7d')](_0x31b7('0xfc')),'ContactId':_0x4165a9[_0x31b7('0xd4')],'ListId':_0x4165a9[_0x31b7('0xd5')],'VoiceQueueId':_0x4165a9[_0x31b7('0xd7')]||undefined,'CampaignId':_0x4165a9[_0x31b7('0xd8')]||undefined})[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x1ac')));break;default:return!![];}};Dialer[_0x31b7('0x1d')][_0x31b7('0x19b')]=function(_0x5f474a,_0x373ffb,_0x5361d9){var _0x1da16b=this;var _0x244894=new History(_0x5f474a);return new BPromise(function(_0x27f2c0,_0x30aeb6){if(_[_0x31b7('0x42')](_0x373ffb)&&typeof _0x373ffb!==_0x31b7('0x166')){return _0x30aeb6(msgResponse(_0x31b7('0x1ad'),_0x31b7('0x144'),_0x31b7('0x1ae')));}if(_[_0x31b7('0x42')](_0x5361d9)&&typeof _0x5361d9!=='object'){return _0x30aeb6(msgResponse('[callProgressDetecting]',_0x31b7('0x144'),_0x31b7('0x1af')));}switch(_0x5361d9[_0x31b7('0x10b')]){case'0':_0x373ffb[_0x31b7('0x67')]+=0x1;_0x244894['state']=0x0;_0x244894[_0x31b7('0xab')]='NoSuchNumber';_0x244894[_0x31b7('0xf1')]+=0x1;_0x244894['countglobal']+=0x1;ami['emit'](_0x31b7('0x1b0'),ut[_0x31b7('0xe8')](_0x5f474a,_0x31b7('0x1b1')));_0x1da16b[_0x31b7('0xce')](_0x244894)[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x101')));if(_0x1da16b[_0x31b7('0x19d')](0x0,_0x5f474a,_0x373ffb)){if(_0x244894[_0x31b7('0xf1')]>=_0x373ffb[_0x31b7('0x1a5')]){_0x1da16b[_0x31b7('0xf8')](_0x244894,_0x27f2c0,_0x30aeb6,_0x31b7('0x1b2'));}else{_0x1da16b[_0x31b7('0xf5')](_0x244894,_0x27f2c0,_0x30aeb6,_0x31b7('0x1b2'));}}break;case'3':_0x373ffb[_0x31b7('0x66')]+=0x1;_0x244894[_0x31b7('0xaa')]=0x3;_0x244894[_0x31b7('0xab')]='NoAnswer';_0x244894[_0x31b7('0xf0')]+=0x1;_0x244894[_0x31b7('0x100')]+=0x1;ami[_0x31b7('0x50')](_0x31b7('0x1b3'),ut[_0x31b7('0xe8')](_0x5f474a,_0x31b7('0x1b4')));_0x1da16b[_0x31b7('0xce')](_0x244894)['catch'](loggerCatch(_0x31b7('0x1b5')));if(_0x1da16b[_0x31b7('0x19d')](0x3,_0x5f474a,_0x373ffb)){if(_0x244894[_0x31b7('0xf0')]>=_0x373ffb[_0x31b7('0x1b6')]){_0x1da16b[_0x31b7('0xf8')](_0x244894,_0x27f2c0,_0x30aeb6,_0x31b7('0x1b7'));}else{_0x1da16b['stateGlobal'](_0x244894,_0x27f2c0,_0x30aeb6,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x373ffb[_0x31b7('0x62')]+=0x1;_0x244894[_0x31b7('0xaa')]=0x5;_0x244894[_0x31b7('0xab')]=_0x31b7('0x1b8');_0x244894[_0x31b7('0xef')]+=0x1;_0x244894['countglobal']+=0x1;ami['emit'](_0x31b7('0x1b9'),ut[_0x31b7('0xe8')](_0x5f474a,'busy'));_0x1da16b[_0x31b7('0xce')](_0x244894)['catch'](loggerCatch(_0x31b7('0x1ba')));if(_0x1da16b[_0x31b7('0x19d')](0x5,_0x5f474a,_0x373ffb)){if(_0x244894['countbusyretry']>=_0x373ffb[_0x31b7('0x1a1')]){_0x1da16b[_0x31b7('0xf8')](_0x244894,_0x27f2c0,_0x30aeb6,'reason\x205\x20busy');}else{_0x1da16b[_0x31b7('0xf5')](_0x244894,_0x27f2c0,_0x30aeb6,_0x31b7('0x1bb'));}}break;case'8':_0x373ffb['outboundCongestionCallsDay']+=0x1;_0x244894[_0x31b7('0xaa')]=0x8;_0x244894[_0x31b7('0xab')]=_0x31b7('0x1bc');_0x244894[_0x31b7('0x19e')]+=0x1;_0x244894['countglobal']+=0x1;ami['emit'](_0x31b7('0x1bd'),ut['buildObj'](_0x5f474a,_0x31b7('0x1be')));_0x1da16b['createHistory'](_0x244894)[_0x31b7('0xb3')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x1da16b[_0x31b7('0x19d')](0x8,_0x5f474a,_0x373ffb)){if(_0x244894[_0x31b7('0x19e')]>=_0x373ffb['dialCongestionMaxRetry']){_0x1da16b['createStateFinal'](_0x244894,_0x27f2c0,_0x30aeb6,_0x31b7('0x1bf'));}else{_0x1da16b['stateGlobal'](_0x244894,_0x27f2c0,_0x30aeb6,_0x31b7('0x1bf'));}}break;case'11':_0x373ffb[_0x31b7('0x1c0')]+=0x1;_0x244894[_0x31b7('0xaa')]=0xb;_0x244894[_0x31b7('0xab')]=_0x31b7('0x11d');_0x244894[_0x31b7('0x11f')]+=0x1;_0x244894[_0x31b7('0x100')]+=0x1;_0x1da16b[_0x31b7('0xce')](_0x244894)[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x1c1')));if(_0x1da16b[_0x31b7('0x19d')](0xb,_0x5f474a,_0x373ffb)){if(_0x244894[_0x31b7('0x11f')]>=_0x373ffb[_0x31b7('0x120')]){_0x1da16b[_0x31b7('0xf8')](_0x244894,_0x27f2c0,_0x30aeb6,_0x31b7('0x1c2'));}else{_0x1da16b[_0x31b7('0xf5')](_0x244894,_0x27f2c0,_0x30aeb6,_0x31b7('0x1c2'));}}break;case'20':_0x373ffb['outboundRejectCallsDay']+=0x1;_0x244894[_0x31b7('0xaa')]=0x14;_0x244894[_0x31b7('0xab')]=_0x31b7('0x1c3');_0x244894[_0x31b7('0xf3')]+=0x1;_0x244894[_0x31b7('0x100')]+=0x1;ami['emit']('custom:agentreject',ut[_0x31b7('0xe8')](_0x5f474a,_0x31b7('0x1c4')));_0x1da16b[_0x31b7('0xce')](_0x244894)[_0x31b7('0xb3')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x1da16b[_0x31b7('0x19d')](0x14,_0x5f474a,_0x373ffb)){if(_0x244894[_0x31b7('0xf3')]>=_0x373ffb['dialAgentRejectMaxRetry']){_0x1da16b['createStateFinal'](_0x244894,_0x27f2c0,_0x30aeb6,_0x31b7('0x1c5'));}else{_0x1da16b[_0x31b7('0xf5')](_0x244894,_0x27f2c0,_0x30aeb6,_0x31b7('0x1c5'));}}break;default:_0x373ffb[_0x31b7('0x69')]+=0x1;_0x244894['state']=0xc;_0x244894['statedesc']=_0x5361d9[_0x31b7('0x10b')];_0x1da16b['createHistory'](_0x244894)[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x1c6')));if(_0x1da16b['checkRetriveMax'](_0x5361d9[_0x31b7('0x10b')],_0x5f474a,_0x373ffb)){if(_0x244894[_0x31b7('0xef')]+_0x244894[_0x31b7('0x19e')]+_0x244894['countnoanswerretry']+_0x244894[_0x31b7('0xf1')]+_0x244894['countdropretry']+_0x244894['countabandonedretry']+_0x244894[_0x31b7('0xed')]+_0x244894[_0x31b7('0xf3')]>=_0x373ffb[_0x31b7('0xf4')]){_0x1da16b[_0x31b7('0xf5')](_0x244894,_0x27f2c0,_0x30aeb6,_0x5361d9['reason']);}else{_0x1da16b[_0x31b7('0xf8')](_0x244894,_0x27f2c0,_0x30aeb6,_0x5361d9[_0x31b7('0x10b')]);}}}});};Dialer[_0x31b7('0x1d')][_0x31b7('0xf5')]=function(_0x1d2dc1,_0x2fcb54,_0x16bcb4,_0x373f23){var _0x464b34=new Final(_0x1d2dc1);_0x464b34['state']=0xf;_0x464b34[_0x31b7('0xab')]=_0x31b7('0x1c7');this[_0x31b7('0xf8')](_0x464b34,_0x2fcb54,_0x16bcb4,_0x373f23);};Dialer[_0x31b7('0x1d')][_0x31b7('0xf8')]=function(_0x19096e,_0x808140,_0x5969a2,_0x2caaa1){this[_0x31b7('0xcc')](_0x19096e)[_0x31b7('0xc0')](function(){return _0x808140(msgResponse(_0x31b7('0x1ad'),_0x31b7('0x1c8'),_0x2caaa1));})['catch'](function(){return _0x5969a2(msgResponse(_0x31b7('0x1c9'),_0x31b7('0x144'),_0x31b7('0x1ca')));});};Dialer[_0x31b7('0x1d')]['predictive']=function(_0x5ffc74){var _0x4b5114=_0x5ffc74[_0x31b7('0x1cb')]/0x64;var _0x1d0f2a=_0x5ffc74[_0x31b7('0x65')]/(_0x5ffc74[_0x31b7('0x65')]+_0x5ffc74[_0x31b7('0xeb')]);var _0x3bb2a8=Math[_0x31b7('0x1cc')](_0x5ffc74[_0x31b7('0x70')]*(_0x5ffc74[_0x31b7('0x1cd')]/0x64));var _0x321d56=Math[_0x31b7('0x1cc')](_0x5ffc74[_0x31b7('0x70')]*(_0x5ffc74[_0x31b7('0x1ce')]/0x64));var _0x58926b=_0x5ffc74[_0x31b7('0x54')]+_0x5ffc74[_0x31b7('0x58')];var _0x5eccb2=Math['floor'](_0x5ffc74['erlangCalls']*_0x5ffc74[_0x31b7('0x74')]*_0x5ffc74['predictiveIntervalHitRate']*_0x5ffc74[_0x31b7('0x1cf')]);if(_[_0x31b7('0x42')](_0x5ffc74[_0x31b7('0x2d')])){if(!_[_0x31b7('0x42')](_0x5ffc74[_0x31b7('0x2c')])){_0x5ffc74['startPredictive']=undefined;loggerPredictive[_0x31b7('0x98')](_0x31b7('0x1d0'),_0x31b7('0x1d1'));}if(!_['isUndefined'](_0x5ffc74[_0x31b7('0x94')])){loggerPredictive[_0x31b7('0x98')]('[startMethodPredictive][StartProgressive]',_0x31b7('0x1d2'));clearInterval(_0x5ffc74[_0x31b7('0x94')]);_0x5ffc74[_0x31b7('0x94')]=undefined;}_0x5ffc74['startProgressive']=moment()[_0x31b7('0x7d')](_0x31b7('0xfc'));loggerPredictive[_0x31b7('0x80')](_0x5ffc74['name'],_0x31b7('0x1d3'),_0x5ffc74['startProgressive']);this[_0x31b7('0x158')](_0x5ffc74,0x1);}else if(ifInterval(_0x5ffc74[_0x31b7('0x1d4')],_0x5ffc74[_0x31b7('0x2d')])){this['handlePower'](_0x5ffc74,0x1);loggerPredictiveCalls['info'](_0x31b7('0x1d5'),_0x5ffc74[_0x31b7('0x2d')],_0x5ffc74['name']);_0x5ffc74[_0x31b7('0x8d')]=0x0;_0x5ffc74['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x4b5114<_0x1d0f2a&&_0x5ffc74[_0x31b7('0x1d6')]===_0x31b7('0x1d7')){freeVariablesPredictive(_0x5ffc74);loggerPredictive['info'](_0x31b7('0x1d8'),_0x31b7('0x1d9'),_0x1d0f2a,_0x31b7('0x2d'),_0x5ffc74[_0x31b7('0x49')]);}else if(_0x5eccb2<_0x5ffc74[_0x31b7('0x1da')]&&_0x5ffc74[_0x31b7('0x1d6')]===_0x31b7('0x1d7')){freeVariablesPredictive(_0x5ffc74);loggerPredictive[_0x31b7('0x80')](_0x31b7('0x1db'),_0x31b7('0x1dc'),_0x5eccb2,_0x31b7('0x1dd'),_0x5ffc74[_0x31b7('0x1da')],'startProgressive',_0x5ffc74['name']);}else if(!ifInterval(_0x5ffc74[_0x31b7('0x1d4')],_0x5ffc74[_0x31b7('0x2d')])&&_[_0x31b7('0x42')](_0x5ffc74[_0x31b7('0x2c')])&&!_[_0x31b7('0x42')](_0x5ffc74[_0x31b7('0x2d')])){_0x5ffc74[_0x31b7('0x2c')]=moment()[_0x31b7('0x7d')](_0x31b7('0xfc'));loggerPredictive[_0x31b7('0x80')](_0x5ffc74['name'],_0x31b7('0x1de'),_0x5ffc74[_0x31b7('0x2c')]);this[_0x31b7('0xbf')](_0x5ffc74['dialPredictiveInterval'])[_0x31b7('0xc0')](this[_0x31b7('0x1df')](_0x5ffc74))[_0x31b7('0xc0')](mergeDataErlangB(_0x5ffc74))[_0x31b7('0xc0')](this[_0x31b7('0x1e0')](_0x5ffc74))['catch'](loggerCatchPredictive(_0x31b7('0x1e1'),_0x5ffc74));}else if(!ifInterval(_0x5ffc74[_0x31b7('0x1d4')],_0x5ffc74['startPredictive'])){_0x5ffc74['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x5ffc74[_0x31b7('0x2c')]=moment()['format'](_0x31b7('0xfc'));loggerPredictive[_0x31b7('0x80')](_0x5ffc74[_0x31b7('0x49')],_0x31b7('0x1e2'),_0x5ffc74[_0x31b7('0x2c')]);clearInterval(_0x5ffc74[_0x31b7('0x94')]);_0x5ffc74['handlePredictive']=undefined;this['averageHandleTime'](_0x5ffc74['dialPredictiveInterval'])[_0x31b7('0xc0')](this[_0x31b7('0x1df')](_0x5ffc74))[_0x31b7('0xc0')](mergeDataErlangB(_0x5ffc74))[_0x31b7('0xc0')](this['startMethodPredictive'](_0x5ffc74))[_0x31b7('0xb3')](loggerCatchPredictive(_0x31b7('0x1e3'),_0x5ffc74));}else if(_0x5ffc74[_0x31b7('0x70')]&&_0x58926b<_0x5ffc74[_0x31b7('0x70')]-_0x321d56){freeVariablesPredictive(_0x5ffc74);loggerPredictive[_0x31b7('0x80')](_0x5ffc74[_0x31b7('0x49')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x58926b,_0x31b7('0x1e4'),_0x5ffc74[_0x31b7('0x70')],'-',_0x321d56,'=',_0x5ffc74[_0x31b7('0x70')]-_0x321d56,')');}else if(_0x5ffc74[_0x31b7('0x70')]&&_0x58926b>_0x5ffc74[_0x31b7('0x70')]+_0x3bb2a8){freeVariablesPredictive(_0x5ffc74);loggerPredictive[_0x31b7('0x80')](_0x5ffc74[_0x31b7('0x49')],_0x31b7('0x1e5'),_0x58926b,_0x31b7('0x1e6'),_0x5ffc74[_0x31b7('0x70')],'+',_0x3bb2a8,'=',_0x5ffc74[_0x31b7('0x70')]+_0x3bb2a8,')');}};Dialer['prototype'][_0x31b7('0x1df')]=function(_0x3afe02){var _0x5a4c2d=this;return function(_0x3e4776){return new BPromise(function(_0x3e84fd,_0x43109d){_['merge'](_0x3afe02,_0x3e4776[0x0]);if(checkGetDataPredictive(_0x3e4776[0x0])){var _0x3c96c5=_0x3afe02[_0x31b7('0x70')]=_0x3afe02[_0x31b7('0x58')]+_0x3afe02[_0x31b7('0x54')];var _0x586e5b=_0x3afe02[_0x31b7('0x1d4')]*0x3c;var _0x21ee46=_0x3e4776[0x0]['predictiveIntervalAvgTalktime']+_0x3e4776[0x0]['predictiveIntervalAvgHoldtime'];var _0x4198a8=(_0x3e4776[0x0]['predictiveIntervalAnsweredCalls']+_0x3e4776[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3e4776[0x0][_0x31b7('0x6c')])/_0x3e4776[0x0][_0x31b7('0x71')];_0x3afe02['predictiveIntervalHitRate']=_0x4198a8>0x0?_0x4198a8:0x1;switch(_0x3afe02[_0x31b7('0x1d6')]){case _0x31b7('0x1d7'):var _0x319e6c=_0x3afe02['dialPredictiveOptimizationPercentage']/0x64;return _0x5a4c2d[_0x31b7('0x1e7')](_0x3c96c5,_0x586e5b,_0x21ee46,_0x4198a8,_0x319e6c)[_0x31b7('0xc0')](function(_0x48dd75){return _0x3e84fd(_0x48dd75);});case'agentBusyFactor':var _0x5b50a0=_0x3afe02[_0x31b7('0x1cb')]/0x64;return _0x5a4c2d[_0x31b7('0x1e8')](_0x3c96c5,_0x586e5b,_0x21ee46,_0x4198a8,_0x5b50a0)[_0x31b7('0xc0')](function(_0xa7a5ab){return _0x3e84fd(_0xa7a5ab);});default:return _0x43109d(msgResponse('[getDataPredictive]',_0x31b7('0x144'),_0x31b7('0x1e9')));}}else{return _0x43109d(msgResponse(_0x31b7('0x1ea'),_0x31b7('0x144'),_0x31b7('0x1eb')));}});};};Dialer[_0x31b7('0x1d')][_0x31b7('0x1ec')]=function(_0x375417){var _0x32286b=this;return function(_0x1fb665){return new BPromise(function(_0x1d17f1,_0xc4b2b5){_[_0x31b7('0x1ed')](_0x375417,_0x1fb665[0x0]);if(checkGetDataPredictive(_0x1fb665[0x0])){loggerPredictive['info'](JSON[_0x31b7('0x78')](_0x1fb665[0x0]));if(_0x375417[_0x31b7('0x1d6')]===_0x31b7('0x1d7')){return _0x32286b[_0x31b7('0xcb')](_0x375417['id'])[_0x31b7('0xc0')](function(_0x56a39e){var _0x2f218d=_0x375417[_0x31b7('0x15e')]-_0x56a39e[0x0][_0x31b7('0x1ee')];var _0xe4da3b=_0x375417[_0x31b7('0x1d4')]*0x3c;var _0x3cb6b9=_0x1fb665[0x0][_0x31b7('0x6b')]+_0x1fb665[0x0][_0x31b7('0x88')];var _0x23dbf1=(_0x1fb665[0x0]['predictiveIntervalAnsweredCalls']+_0x1fb665[0x0][_0x31b7('0x6d')]+_0x1fb665[0x0][_0x31b7('0x6c')])/_0x1fb665[0x0][_0x31b7('0x71')];var _0x201881=_0x375417['dialPredictiveOptimizationPercentage']/0x64;_0x375417['predictiveIntervalPauses']=_0x56a39e[0x0]['outboundQueuePauses']||0x0;_0x375417['predictiveIntervalHitRate']=_0x23dbf1>0x0?_0x23dbf1:0x1;return _0x32286b['abandonmentRate'](_0x2f218d,_0xe4da3b,_0x3cb6b9,_0x23dbf1,_0x201881);})['then'](function(_0x5a8e71){return _0x1d17f1(_0x5a8e71);})[_0x31b7('0xb3')](function(_0x233aa3){return _0xc4b2b5(msgResponse(_0x31b7('0x1ef'),_0x31b7('0x144'),JSON[_0x31b7('0x78')](_0x233aa3)));});}if(_0x375417[_0x31b7('0x1d6')]===_0x31b7('0x1f0')){return _0x32286b['getVoiceQueueRtPauses'](_0x375417['id'])['then'](function(_0x2de3bf){var _0x17dc94=_0x375417[_0x31b7('0x15e')]-_0x2de3bf[0x0][_0x31b7('0x1ee')];var _0x1b15df=_0x375417[_0x31b7('0x1d4')]*0x3c;var _0x423092=_0x1fb665[0x0]['predictiveIntervalAvgTalktime']+_0x1fb665[0x0][_0x31b7('0x88')];var _0x218058=(_0x1fb665[0x0]['predictiveIntervalAnsweredCalls']+_0x1fb665[0x0][_0x31b7('0x6d')]+_0x1fb665[0x0][_0x31b7('0x6c')])/_0x1fb665[0x0][_0x31b7('0x71')];var _0x16c5fe=_0x375417[_0x31b7('0x1cb')]/0x64;_0x375417[_0x31b7('0x1f1')]=_0x2de3bf[0x0][_0x31b7('0x1ee')]||0x0;_0x375417[_0x31b7('0x6f')]=_0x218058>0x0?_0x218058:0x1;return _0x32286b[_0x31b7('0x1e8')](_0x17dc94,_0x1b15df,_0x423092,_0x218058,_0x16c5fe);})[_0x31b7('0xc0')](function(_0x274f5c){return _0x1d17f1(_0x274f5c);})[_0x31b7('0xb3')](function(_0x9020b6){return _0xc4b2b5(msgResponse(_0x31b7('0x1ef'),_0x31b7('0x144'),JSON[_0x31b7('0x78')](_0x9020b6)));});}}else{return _0xc4b2b5(msgResponse(_0x31b7('0x1ea'),_0x31b7('0x144'),_0x31b7('0x1eb')));}});};};Dialer['prototype'][_0x31b7('0x1e0')]=function(_0x464767){var _0xca24af=this;return function(){var _0xab6ab2=0x0;var _0x5f45ac=Math[_0x31b7('0x1f2')](_0x464767[_0x31b7('0x73')]*0x3e8);if(_0x5f45ac>0x0){_0x5f45ac=_0x5f45ac<0x64?0x64:_0x5f45ac;loggerPredictive[_0x31b7('0x80')](_0x464767[_0x31b7('0x49')],_0x31b7('0x1f3'),_0x5f45ac,_0x31b7('0x4d'));_0x464767['handlePredictive']=setInterval(function(){_0xca24af[_0x31b7('0x94')](_0x464767);loggerPredictiveCalls[_0x31b7('0x80')](_0x31b7('0x1f4'),_0xab6ab2+=0x1);},_0x5f45ac);}else{loggerPredictive['info'](_0x464767[_0x31b7('0x49')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x31b7('0x1f5')]=function(_0x30dcb1,_0x35fd2d){var _0x467577=this;return function(_0x2f636a){if(_[_0x31b7('0x4a')](_0x2f636a)){if(_['isNil'](_0x35fd2d['UserId'])||!_0x35fd2d[_0x31b7('0x1f6')]){if(_0x30dcb1[_0x31b7('0x5c')]==='booked'){_0x30dcb1[_0x31b7('0x12a')]=_[_0x31b7('0x42')](_0x30dcb1[_0x31b7('0x12a')])?!![]:_0x30dcb1['queueStatusComplete'];var _0x225387=uuid['v4']();_0x467577['actions'][_0x225387]=new Action(_0x30dcb1,_0x35fd2d,_0x225387);loggerBooked[_0x31b7('0x80')]('[booked][checkContactBlack]',_0x225387,_0x31b7('0x1f7'),JSON[_0x31b7('0x78')](_0x30dcb1[_0x31b7('0x12a')]),'Queue:\x20',_0x30dcb1[_0x31b7('0x49')]);if(_0x30dcb1[_0x31b7('0x12a')]){_0x30dcb1['queueStatusComplete']=![];_0x467577[_0x31b7('0x128')][_0x467577[_0x31b7('0x29')][_0x225387][_0x31b7('0xb6')]]=[];ami['Action']({'actionid':_0x225387,'action':_0x31b7('0x1f8'),'queue':_0x30dcb1[_0x31b7('0x49')]})[_0x31b7('0xb3')](function(){_0x467577[_0x31b7('0xb5')](_0x30dcb1);_0x467577[_0x31b7('0xc3')]({'active':![],'ContactId':_0x467577['actions'][_0x225387]['ContactId'],'ListId':_0x467577[_0x31b7('0x29')][_0x225387]['ListId'],'VoiceQueueId':_0x467577['actions'][_0x225387][_0x31b7('0xd7')]||undefined,'CampaignId':_0x467577[_0x31b7('0x29')][_0x225387][_0x31b7('0xd8')]||undefined})['catch'](loggerCatch(_0x31b7('0x1f9')));delete _0x467577[_0x31b7('0x29')][_0x225387];});}else{loggerBooked[_0x31b7('0x80')](_0x31b7('0x1fa'),JSON['stringify'](_0x30dcb1[_0x31b7('0x12a')]),_0x31b7('0x1fb'),_0x30dcb1[_0x31b7('0x49')]);_0x467577[_0x31b7('0xb5')](_0x30dcb1);_0x467577['rescheduleContact']({'active':![],'ContactId':_0x467577[_0x31b7('0x29')][_0x225387][_0x31b7('0xd4')],'ListId':_0x467577[_0x31b7('0x29')][_0x225387]['ListId'],'VoiceQueueId':_0x467577[_0x31b7('0x29')][_0x225387][_0x31b7('0xd7')]||undefined,'CampaignId':_0x467577[_0x31b7('0x29')][_0x225387][_0x31b7('0xd8')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x467577[_0x31b7('0x29')][_0x225387];}}else{return _0x467577[_0x31b7('0x165')](_0x30dcb1,_0x35fd2d);}}else{if(getDiff(_0x35fd2d[_0x31b7('0x1fc')])<_0x30dcb1[_0x31b7('0x1fd')]*0x3c){if(_0x35fd2d['Agent']&&!_0x35fd2d[_0x31b7('0x1fe')][_0x31b7('0x1ff')]){_0x467577[_0x31b7('0x22')][_0x31b7('0x12d')](_0x35fd2d['id'])[_0x31b7('0x20')](function(){_0x467577[_0x31b7('0xb5')](_0x30dcb1);});}else{_0x467577[_0x31b7('0xc5')]({'active':![]},_0x35fd2d['id'],0x1)[_0x31b7('0x20')](function(){_0x467577[_0x31b7('0xb5')](_0x30dcb1);});}}else{_0x30dcb1[_0x31b7('0x68')]+=0x1;_0x467577[_0x31b7('0xb5')](_0x30dcb1);if(_0x30dcb1['dialRecallInQueue']){_0x467577['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x35fd2d[_0x31b7('0xd4')],'ListId':_0x35fd2d['ListId'],'VoiceQueueId':_0x35fd2d['VoiceQueueId']||undefined,'CampaignId':_0x35fd2d[_0x31b7('0xd8')]||undefined})[_0x31b7('0xb3')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x467577[_0x31b7('0xce')](createObjHistory(_0x30dcb1,_0x35fd2d,_0x31b7('0x200'),0x17,_0x31b7('0x201')))[_0x31b7('0xb3')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x467577[_0x31b7('0xd2')](createObjHistory(_0x30dcb1,_0x35fd2d,_0x31b7('0x202'),0x16,_0x31b7('0x203')),_0x31b7('0x204'),'[Originate][HistoryRecallClose]');}}}}else{_0x30dcb1[_0x31b7('0x61')]+=0x1;_0x467577['saveInDb'](createObjHistory(_0x30dcb1,_0x35fd2d,_0x31b7('0x205'),0xd,_0x31b7('0x206')),_0x31b7('0x207'),_0x31b7('0x208'));throw'inBlackList';}};};Dialer['prototype'][_0x31b7('0x15d')]=function(_0x5489bb){var _0x3bcce6=this;var _0x3a3b9c=_0x5489bb[_0x31b7('0x209')]-_0x5489bb['originated']-_0x5489bb[_0x31b7('0xc7')];emitCampaignSummary(_0x5489bb);if(_0x3a3b9c>0x0){if(_0x3a3b9c>this[_0x31b7('0x27')]){_0x3a3b9c=this['maxNumberOriginate'];}_0x5489bb[_0x31b7('0xc7')]+=_0x3a3b9c;this[_0x31b7('0xc9')](_0x5489bb['id'],_0x3a3b9c,_0x5489bb['dialOrderByScheduledAt'],_0x5489bb)[_0x31b7('0xc0')](function(_0x221ecc){_0x5489bb[_0x31b7('0xc7')]-=_0x3a3b9c;_0x5489bb[_0x31b7('0xc7')]=_0x5489bb['temp']>0x0?_0x5489bb['temp']:0x0;if(!checkContactEmpty(_0x221ecc)){_0x5489bb[_0x31b7('0x43')]=_0x31b7('0x20a');logger['info'](_0x31b7('0x20b')+_0x5489bb['name']);}else{_0x5489bb[_0x31b7('0x72')]+=_0x221ecc[_0x31b7('0x9b')];_0x5489bb[_0x31b7('0x43')]='RUNNING';for(var _0x19e88c=0x0;_0x19e88c<_0x221ecc[_0x31b7('0x9b')];_0x19e88c+=0x1){_0x5489bb[_0x31b7('0x20c')]+=0x1;if(_['isNil'](_0x221ecc[_0x19e88c])||_['isNil'](_0x221ecc[_0x19e88c]['Contact'])||_[_0x31b7('0xdf')](_0x221ecc[_0x19e88c][_0x31b7('0x184')][_0x31b7('0x169')])){_0x3bcce6[_0x31b7('0xd1')](_0x31b7('0x20d'),_0x5489bb,_0x221ecc[_0x19e88c]);}else{_0x3bcce6[_0x31b7('0xbd')](_[_0x31b7('0xd3')](_0x221ecc[_0x19e88c],[_0x31b7('0xd8'),'Contact.phone']))[_0x31b7('0xc0')](_0x3bcce6['checkContactBlack'](_0x5489bb,_0x221ecc[_0x19e88c]))[_0x31b7('0xb3')](_0x3bcce6[_0x31b7('0xd0')](_0x31b7('0x20e'),_0x5489bb));}}}})[_0x31b7('0xb3')](loggerGetContactDialer(_0x31b7('0x20f'),_0x5489bb,_0x3a3b9c));}};Dialer[_0x31b7('0x1d')][_0x31b7('0x158')]=function(_0x1f7bf4,_0x29b5f0){var _0x3a9ee0=this;var _0x5a5948=[];var _0x16f28e=_0x29b5f0>=0x1?_0x29b5f0:0x1;if(_0x1f7bf4[_0x31b7('0x5c')]===_0x31b7('0x7')){_0x16f28e=0x1;}var _0x358136=Math[_0x31b7('0x1f2')](_0x1f7bf4[_0x31b7('0x54')]*_0x16f28e)-_0x1f7bf4[_0x31b7('0x72')]-_0x1f7bf4[_0x31b7('0xc7')];emitVoiceQueueSummary(_0x1f7bf4);if(_0x1f7bf4[_0x31b7('0x210')]>0x0){var _0x777349=_0x1f7bf4[_0x31b7('0x210')]-_0x1f7bf4[_0x31b7('0x72')]-_0x1f7bf4[_0x31b7('0x58')]-_0x1f7bf4[_0x31b7('0xc7')]-_0x1f7bf4[_0x31b7('0x211')];if(_0x358136>_0x777349){_0x358136=_0x777349;}}if(_0x358136>0x0){if(_0x1f7bf4['dialMethod']==='booked'){_0x358136=0x1;}if(_0x358136>this[_0x31b7('0x27')]){_0x358136=this[_0x31b7('0x27')];}_0x1f7bf4[_0x31b7('0xc7')]+=_0x358136;for(var _0x234e22 in this[_0x31b7('0x25')]){if(typeof this[_0x31b7('0x25')][_0x234e22]!==_0x31b7('0x9c')){if(this[_0x31b7('0x25')][_0x234e22][_0x31b7('0xaa')]===_0x31b7('0x212')&&this[_0x31b7('0x25')][_0x234e22][_0x31b7('0xdc')]==='reachable'){_0x5a5948[_0x31b7('0x129')](this[_0x31b7('0x25')][_0x234e22]['id']);}}}this[_0x31b7('0xc6')](_0x1f7bf4['id'],_0x5a5948,_0x358136,_0x1f7bf4[_0x31b7('0x213')],_0x1f7bf4)[_0x31b7('0xc0')](function(_0x260bf9){_0x1f7bf4[_0x31b7('0xc7')]-=_0x358136;_0x1f7bf4[_0x31b7('0xc7')]=_0x1f7bf4['temp']>0x0?_0x1f7bf4['temp']:0x0;if(!checkContactEmpty(_0x260bf9)){_0x3a9ee0[_0x31b7('0xba')](_0x1f7bf4)['then'](sendMessageReschedule(_0x1f7bf4))[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x214')));}else{_0x1f7bf4[_0x31b7('0x72')]+=_0x260bf9[_0x31b7('0x9b')];_0x1f7bf4['message']=_0x1f7bf4[_0x31b7('0x5c')]==='booked'?_0x31b7('0x171'):_0x31b7('0x215');for(var _0x1ea63c=0x0;_0x1ea63c<_0x260bf9[_0x31b7('0x9b')];_0x1ea63c+=0x1){if(_['isNil'](_0x260bf9[_0x1ea63c])||_['isNil'](_0x260bf9[_0x1ea63c][_0x31b7('0x184')])||_[_0x31b7('0xdf')](_0x260bf9[_0x1ea63c][_0x31b7('0x184')]['phone'])){_0x3a9ee0[_0x31b7('0xd1')](_0x31b7('0x20d'),_0x1f7bf4,_0x260bf9[_0x1ea63c]);}else{_0x3a9ee0[_0x31b7('0xbb')](_[_0x31b7('0xd3')](_0x260bf9[_0x1ea63c],[_0x31b7('0xd7'),'Contact.phone']))[_0x31b7('0xc0')](_0x3a9ee0[_0x31b7('0x1f5')](_0x1f7bf4,_0x260bf9[_0x1ea63c]))[_0x31b7('0xb3')](_0x3a9ee0['loggerHandler'](_0x31b7('0x20d'),_0x1f7bf4));}}}})['catch'](loggerGetContactDialer(_0x31b7('0x216'),_0x1f7bf4,_0x358136));}};Dialer[_0x31b7('0x1d')][_0x31b7('0x94')]=function(_0x486734){if(_0x486734[_0x31b7('0x210')]>0x0){var _0x5a6391=_0x486734[_0x31b7('0x210')]-_0x486734['originated']-_0x486734[_0x31b7('0x58')];if(_0x5a6391>0x0){this['tryOriginatePredictive'](_0x486734);}else{loggerPredictiveCalls['info'](_0x31b7('0x217'));}}else{this[_0x31b7('0x218')](_0x486734);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x216321){var _0x5ba6b0=this;var _0x517548=[];_0x216321[_0x31b7('0x72')]+=0x1;for(var _0x336384 in this[_0x31b7('0x25')]){if(typeof this['agents'][_0x336384]!==_0x31b7('0x9c')){if(this[_0x31b7('0x25')][_0x336384]['state']===_0x31b7('0x212')&&this[_0x31b7('0x25')][_0x336384][_0x31b7('0xdc')]===_0x31b7('0xdd')){_0x517548['push'](this['agents'][_0x336384]['id']);}}}this[_0x31b7('0xc6')](_0x216321['id'],_0x517548,0x1,_0x216321['dialOrderByScheduledAt'],_0x216321)['then'](function(_0x4f93da){if(!checkContactEmpty(_0x4f93da)){checkContactLowerLimitOriginate(_0x216321,0x1,0x0);_0x5ba6b0[_0x31b7('0xba')](_0x216321)[_0x31b7('0xc0')](sendMessageReschedule(_0x216321))[_0x31b7('0xb3')](loggerCatch(_0x31b7('0x214')));}else{_0x216321[_0x31b7('0x43')]='RUNNING';if(_[_0x31b7('0xdf')](_0x4f93da[0x0])||_[_0x31b7('0xdf')](_0x4f93da[0x0]['Contact'])||_[_0x31b7('0xdf')](_0x4f93da[0x0][_0x31b7('0x184')][_0x31b7('0x169')])){_0x5ba6b0['emptyContact'](_0x31b7('0x20d'),_0x216321,_0x4f93da[0x0]);}else{_0x5ba6b0[_0x31b7('0xbb')](_[_0x31b7('0xd3')](_0x4f93da[0x0],[_0x31b7('0xd7'),_0x31b7('0x219')]))[_0x31b7('0xc0')](_0x5ba6b0[_0x31b7('0x1f5')](_0x216321,_0x4f93da[0x0]))['catch'](_0x5ba6b0[_0x31b7('0xd0')](_0x31b7('0x21a'),_0x216321));}}})[_0x31b7('0xb3')](loggerGetContactDialer('[getContactDialerPredictive]',_0x216321,0x1));emitVoiceQueueSummary(_0x216321);};Dialer[_0x31b7('0x1d')]['abandonmentRate']=function(_0x407218,_0x3e684c,_0x3d6e02,_0x437363,_0x546183,_0x36f2f4){loggerPredictive[_0x31b7('0x80')](_0x31b7('0x21b'));loggerPredictive['info'](_0x31b7('0x21c'),_0x407218);loggerPredictive[_0x31b7('0x80')](_0x31b7('0x21d'),_0x3e684c);loggerPredictive[_0x31b7('0x80')]('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',_0x3d6e02);loggerPredictive['info'](_0x31b7('0x21e'),_0x437363);loggerPredictive[_0x31b7('0x80')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x546183);loggerPredictive[_0x31b7('0x80')](_0x31b7('0x86'));return new BPromise(function(_0x410fe8,_0x525392){if(_0x407218<=0x0||isNaN(_0x407218)){return _0x525392(msgResponse(_0x31b7('0x21f'),_0x31b7('0x197'),_0x31b7('0x220')+_0x407218));}if(_0x3d6e02<=0x0||isNaN(_0x3d6e02)){return _0x525392(msgResponse(_0x31b7('0x21f'),'Error',_0x31b7('0x221')+_0x3d6e02));}if(_0x437363<=0x0||isNaN(_0x437363)){return _0x525392(msgResponse(_0x31b7('0x21f'),_0x31b7('0x197'),'p\x20=\x20'+_0x437363));}if(_0x3e684c<=0x0||isNaN(_0x3e684c)){return _0x525392(msgResponse('[abandonmentRate]',_0x31b7('0x197'),'interval\x20=\x20'+_0x3e684c));}if(_0x546183<=0x0||isNaN(_0x546183)){return _0x525392(msgResponse(_0x31b7('0x21f'),_0x31b7('0x197'),_0x31b7('0x222')+_0x546183));}_0x36f2f4=_0x36f2f4||0x0;var _0x4af2d4=0x1/_0x3d6e02;var _0x751948=0x0;var _0x319543=0x0;var _0x396392=0x0;var _0x393a22=0x0;for(var _0x5a77ea=0x0;_0x396392<_0x546183;_0x5a77ea+=0x1){_0x319543=_0x5a77ea/_0x3e684c;_0x751948=(_0x437363*_0x319543+_0x36f2f4)/_0x4af2d4;_0x396392=erlangb(_0x751948,_0x407218);_0x393a22=_0x751948/_0x407218*(0x1-erlangb(_0x751948,_0x407218));}return _0x410fe8({'erlangCalls':_0x5a77ea,'erlangCallToSecond':_0x3e684c/_0x5a77ea,'erlangAbandonmentRate':_0x396392,'erlangBusyFactor':_0x393a22});});};Dialer[_0x31b7('0x1d')][_0x31b7('0x1e8')]=function(_0x4bec27,_0x1caa97,_0x14ab62,_0x4c2f9d,_0x50c9df,_0x27338d){loggerPredictive[_0x31b7('0x80')](_0x31b7('0x223'));loggerPredictive[_0x31b7('0x80')]('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',_0x4bec27);loggerPredictive['info'](_0x31b7('0x21d'),_0x1caa97);loggerPredictive['info'](_0x31b7('0x224'),_0x14ab62);loggerPredictive[_0x31b7('0x80')](_0x31b7('0x21e'),_0x4c2f9d);loggerPredictive[_0x31b7('0x80')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x50c9df);loggerPredictive[_0x31b7('0x80')](_0x31b7('0x86'));return new BPromise(function(_0x416c42,_0x50261c){if(_0x4bec27<=0x0||isNaN(_0x4bec27)){return _0x50261c(msgResponse(_0x31b7('0x225'),_0x31b7('0x197'),_0x31b7('0x220')+_0x4bec27));}if(_0x14ab62<=0x0||isNaN(_0x14ab62)){return _0x50261c(msgResponse(_0x31b7('0x225'),_0x31b7('0x197'),_0x31b7('0x221')+_0x14ab62));}if(_0x4c2f9d<=0x0||isNaN(_0x4c2f9d)){return _0x50261c(msgResponse(_0x31b7('0x225'),_0x31b7('0x197'),_0x31b7('0x226')+_0x4c2f9d));}if(_0x1caa97<=0x0||isNaN(_0x1caa97)){return _0x50261c(msgResponse(_0x31b7('0x225'),_0x31b7('0x197'),_0x31b7('0x227')+_0x1caa97));}if(_0x50c9df<=0x0||isNaN(_0x50c9df)){return _0x50261c(msgResponse(_0x31b7('0x225'),_0x31b7('0x197'),_0x31b7('0x228')+_0x50c9df));}_0x27338d=_0x27338d||0x0;var _0x2b01a8=0x1/_0x14ab62;var _0x4c2646=0x0;var _0x4e1baf=0x0;var _0x102ad0=0x0;var _0x4337b1=0x0;for(var _0x1195b6=0x0;_0x4337b1<_0x50c9df;_0x1195b6+=0x1){_0x4e1baf=_0x1195b6/_0x1caa97;_0x4c2646=(_0x4c2f9d*_0x4e1baf+_0x27338d)/_0x2b01a8;_0x102ad0=erlangb(_0x4c2646,_0x4bec27);_0x4337b1=_0x4c2646/_0x4bec27*(0x1-erlangb(_0x4c2646,_0x4bec27));}return _0x416c42({'erlangCalls':_0x1195b6,'erlangCallToSecond':_0x1caa97/_0x1195b6,'erlangAbandonmentRate':_0x102ad0,'erlangBusyFactor':_0x4337b1});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index b7cff58..3142621 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce5c=['countdropretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','endtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','seconds','scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xce5c,0xe4));var _0xcce5=function(_0x57474e,_0x4178b8){_0x57474e=_0x57474e-0x0;var _0xfaae8c=_0xce5c[_0x57474e];return _0xfaae8c;};'use strict';var util=require(_0xcce5('0x0'));var _=require('lodash');var moment=require(_0xcce5('0x1'));function getSeconds(_0x21d50e,_0x3db642){var _0x169243=moment(_0x21d50e)[_0xcce5('0x2')](0x0);var _0x5a9b03=moment(_0x3db642)[_0xcce5('0x2')](0x0);return _0x169243['diff'](_0x5a9b03,_0xcce5('0x3'));}function QueueCallerAbandon(_0x4daebe,_0x296760){this['scheduledat']=_0x4daebe[_0xcce5('0x4')];this[_0xcce5('0x5')]=_0x4daebe[_0xcce5('0x5')];this['campaigntype']=_0x4daebe['type']===_0xcce5('0x6')?_0xcce5('0x7'):_0x4daebe['type'];this['countbusyretry']=_0x4daebe['countbusyretry'];this[_0xcce5('0x8')]=_0x4daebe[_0xcce5('0x8')];this[_0xcce5('0x9')]=_0x4daebe['countnoanswerretry'];this[_0xcce5('0xa')]=_0x4daebe['countbusyretry']+_0x4daebe[_0xcce5('0x8')]+_0x4daebe[_0xcce5('0x9')]+_0x4daebe[_0xcce5('0xb')]+_0x4daebe[_0xcce5('0xc')]+_0x4daebe['countabandonedretry']+_0x4daebe['countmachineretry']+_0x4daebe[_0xcce5('0xd')];this['countnosuchnumberretry']=_0x4daebe[_0xcce5('0xb')];this[_0xcce5('0xc')]=_0x4daebe[_0xcce5('0xc')];this[_0xcce5('0xe')]=_0x4daebe[_0xcce5('0xe')];this['countmachineretry']=_0x4daebe['countmachineretry'];this['countagentrejectretry']=_0x4daebe[_0xcce5('0xd')];this[_0xcce5('0xf')]=_0x296760[_0xcce5('0xf')];this[_0xcce5('0x10')]=_0x4daebe[_0xcce5('0x11')];this['calleridnum']=_0x4daebe[_0xcce5('0x12')];this[_0xcce5('0x13')]=_0x4daebe[_0xcce5('0x13')];this['responsetime']=_0x4daebe[_0xcce5('0x14')];this[_0xcce5('0x15')]=_0x4daebe[_0xcce5('0x15')];this[_0xcce5('0x16')]=this[_0xcce5('0x15')];this['ringtime']=getSeconds(_0x4daebe[_0xcce5('0x14')],_0x4daebe['starttime']);this[_0xcce5('0x17')]=getSeconds(this[_0xcce5('0x15')],_0x4daebe['responsetime']);this[_0xcce5('0x18')]=0x0;this[_0xcce5('0x7')]=_0x296760['queue'];this[_0xcce5('0x19')]=_0x296760[_0xcce5('0x1a')];this['reason']=_0x296760[_0xcce5('0x1b')];this[_0xcce5('0x1c')]=_0x4daebe['callback'];this[_0xcce5('0x1d')]=_0x4daebe[_0xcce5('0x1d')];this[_0xcce5('0x1e')]=_0x4daebe['callbackat'];this[_0xcce5('0x1f')]=_0x4daebe['recallme'];this['ContactId']=_0x4daebe[_0xcce5('0x20')];this[_0xcce5('0x21')]=_0x4daebe['ListId'];this[_0xcce5('0x22')]=_0x4daebe[_0xcce5('0x22')];this[_0xcce5('0x23')]=_0x4daebe['VoiceQueueId'];this[_0xcce5('0x24')]=_0x4daebe[_0xcce5('0x24')];this[_0xcce5('0x25')]=_0x4daebe[_0xcce5('0x25')]||'';this[_0xcce5('0x26')]=_0x4daebe[_0xcce5('0x26')]||'';}module[_0xcce5('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0x0c46=['holdtime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0c46,0xe6));var _0x60c4=function(_0x4093c5,_0x25753e){_0x4093c5=_0x4093c5-0x0;var _0x3e06e4=_0x0c46[_0x4093c5];return _0x3e06e4;};'use strict';var util=require(_0x60c4('0x0'));var _=require('lodash');var moment=require(_0x60c4('0x1'));function getSeconds(_0x2b8124,_0x10b897){var _0x1fab30=moment(_0x2b8124)[_0x60c4('0x2')](0x0);var _0x34b6d6=moment(_0x10b897)[_0x60c4('0x2')](0x0);return _0x1fab30[_0x60c4('0x3')](_0x34b6d6,_0x60c4('0x4'));}function QueueCallerAbandon(_0x5a328b,_0x146d31){this[_0x60c4('0x5')]=_0x5a328b[_0x60c4('0x5')];this[_0x60c4('0x6')]=_0x5a328b[_0x60c4('0x6')];this[_0x60c4('0x7')]=_0x5a328b[_0x60c4('0x6')]===_0x60c4('0x8')?_0x60c4('0x9'):_0x5a328b[_0x60c4('0x6')];this[_0x60c4('0xa')]=_0x5a328b['countbusyretry'];this['countcongestionretry']=_0x5a328b[_0x60c4('0xb')];this[_0x60c4('0xc')]=_0x5a328b[_0x60c4('0xc')];this[_0x60c4('0xd')]=_0x5a328b[_0x60c4('0xa')]+_0x5a328b[_0x60c4('0xb')]+_0x5a328b['countnoanswerretry']+_0x5a328b[_0x60c4('0xe')]+_0x5a328b[_0x60c4('0xf')]+_0x5a328b[_0x60c4('0x10')]+_0x5a328b[_0x60c4('0x11')]+_0x5a328b[_0x60c4('0x12')];this[_0x60c4('0xe')]=_0x5a328b[_0x60c4('0xe')];this[_0x60c4('0xf')]=_0x5a328b['countdropretry'];this['countabandonedretry']=_0x5a328b[_0x60c4('0x10')];this['countmachineretry']=_0x5a328b[_0x60c4('0x11')];this[_0x60c4('0x12')]=_0x5a328b[_0x60c4('0x12')];this[_0x60c4('0x13')]=_0x146d31[_0x60c4('0x13')];this[_0x60c4('0x14')]=_0x5a328b[_0x60c4('0x15')];this[_0x60c4('0x16')]=_0x5a328b[_0x60c4('0x17')];this[_0x60c4('0x18')]=_0x5a328b[_0x60c4('0x18')];this[_0x60c4('0x19')]=_0x5a328b[_0x60c4('0x19')];this['droptime']=_0x5a328b[_0x60c4('0x1a')];this[_0x60c4('0x1b')]=this['droptime'];this['ringtime']=getSeconds(_0x5a328b[_0x60c4('0x19')],_0x5a328b[_0x60c4('0x18')]);this[_0x60c4('0x1c')]=getSeconds(this[_0x60c4('0x1a')],_0x5a328b['responsetime']);this['talktime']=0x0;this[_0x60c4('0x9')]=_0x146d31[_0x60c4('0x9')];this['membername']=_0x146d31[_0x60c4('0x1d')];this[_0x60c4('0x1e')]=_0x146d31[_0x60c4('0x1e')];this[_0x60c4('0x1f')]=_0x5a328b[_0x60c4('0x1f')];this[_0x60c4('0x20')]=_0x5a328b[_0x60c4('0x20')];this[_0x60c4('0x21')]=_0x5a328b[_0x60c4('0x21')];this['recallme']=_0x5a328b[_0x60c4('0x22')];this[_0x60c4('0x23')]=_0x5a328b[_0x60c4('0x23')];this['ListId']=_0x5a328b[_0x60c4('0x24')];this[_0x60c4('0x25')]=_0x5a328b['UserId'];this[_0x60c4('0x26')]=_0x5a328b[_0x60c4('0x26')];this[_0x60c4('0x27')]=_0x5a328b['CampaignId'];this[_0x60c4('0x28')]=_0x5a328b[_0x60c4('0x28')]||'';this[_0x60c4('0x29')]=_0x5a328b[_0x60c4('0x29')]||'';}module[_0x60c4('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 7a19b10..760d4c6 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(_0x45c16a,_0x665979){var _0x57c530=function(_0x5330e3){while(--_0x5330e3){_0x45c16a['push'](_0x45c16a['shift']());}};_0x57c530(++_0x665979);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x58f742,_0x8556f1){var _0x65bac4=function(_0x30067a){while(--_0x30067a){_0x58f742['push'](_0x58f742['shift']());}};_0x65bac4(++_0x8556f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 1a0cb46..51f27c2 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 _0x6829=['notify','catch','error','\x20receiveFax\x20','merge','pick','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','stringify','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','format','%s/%s.tif','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','.pdf','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','hasOwnProperty','exten','localstationid','uniqueid','name','info','channel','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','application/pdf','then'];(function(_0x522e32,_0x440e6d){var _0x216842=function(_0x467028){while(--_0x467028){_0x522e32['push'](_0x522e32['shift']());}};_0x216842(++_0x440e6d);}(_0x6829,0x19c));var _0x9682=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x6829[_0x31e29a];return _0x32d892;};'use strict';var util=require(_0x9682('0x0'));var _=require('lodash');var BPromise=require(_0x9682('0x1'));var uuid=require(_0x9682('0x2'));var moment=require(_0x9682('0x3'));var path=require(_0x9682('0x4'));var tiff2pdf=require(_0x9682('0x5'));var gs=require(_0x9682('0x6'));var logger=require(_0x9682('0x7'))(_0x9682('0x8'));var ami=require('../ami');var rpcDb=require(_0x9682('0x9'));var Channel=require(_0x9682('0xa'));var ut=require(_0x9682('0xb'));var Action=require(_0x9682('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x9682('0xd'));var faxMessage=require(_0x9682('0xe'));function Fax(_0x49cd34){this[_0x9682('0xf')]={};this[_0x9682('0x10')]=_0x49cd34[_0x9682('0x10')];this[_0x9682('0x11')]=_0x49cd34[_0x9682('0x11')];this[_0x9682('0x12')]={};ami['on'](_0x9682('0x13'),this['syncNewchannel'][_0x9682('0x14')](this));ami['on'](_0x9682('0x15'),this[_0x9682('0x16')][_0x9682('0x14')](this));ami['on'](_0x9682('0x17'),this[_0x9682('0x18')][_0x9682('0x14')](this));ami['on'](_0x9682('0x19'),this[_0x9682('0x1a')][_0x9682('0x14')](this));ami['on'](_0x9682('0x1b'),this[_0x9682('0x1c')][_0x9682('0x14')](this));ami['on'](_0x9682('0x1d'),this[_0x9682('0x1e')][_0x9682('0x14')](this));ami['on'](_0x9682('0x1f'),this[_0x9682('0x20')][_0x9682('0x14')](this));ami['on'](_0x9682('0x21'),this[_0x9682('0x22')][_0x9682('0x14')](this));}Fax[_0x9682('0x23')][_0x9682('0x24')]=function(_0x2f0344){if(_0x2f0344['context']==='from-voip-provider'){for(var _0x37c92e in this[_0x9682('0x10')]){if(this[_0x9682('0x10')][_0x9682('0x25')](_0x37c92e)){if(_0x2f0344[_0x9682('0x26')]===this[_0x9682('0x10')][_0x37c92e][_0x9682('0x27')]){this[_0x9682('0xf')][_0x2f0344[_0x9682('0x28')]]={};this['channels'][_0x2f0344['uniqueid']]['channel']=_0x2f0344['channel'];this[_0x9682('0xf')][_0x2f0344[_0x9682('0x28')]]['id']=this[_0x9682('0x10')][_0x37c92e]['id'];this[_0x9682('0xf')][_0x2f0344['uniqueid']][_0x9682('0x29')]=this['faxAccounts'][_0x37c92e][_0x9682('0x29')];logger[_0x9682('0x2a')](_0x2f0344[_0x9682('0x28')],'\x20syncNewchannel\x20');}}}}if(this[_0x9682('0x12')][_0x2f0344[_0x9682('0x28')]]){this[_0x9682('0xf')][_0x2f0344['uniqueid']]={};this[_0x9682('0xf')][_0x2f0344[_0x9682('0x28')]][_0x9682('0x2b')]=_0x2f0344[_0x9682('0x2b')];logger[_0x9682('0x2a')](_0x2f0344[_0x9682('0x28')],_0x9682('0x2c'));}};Fax[_0x9682('0x23')]['syncVarSet']=function(_0xd8fad){if(this[_0x9682('0xf')][_0xd8fad[_0x9682('0x28')]]){for(var _0x5b7f9a in _0xd8fad['variable']){if(_0xd8fad[_0x9682('0x2d')][_0x9682('0x25')](_0x5b7f9a)){this[_0x9682('0xf')][_0xd8fad['uniqueid']][_0x5b7f9a]=_0xd8fad[_0x9682('0x2e')];}}}};Fax['prototype'][_0x9682('0x18')]=function(_0x566411){if(this[_0x9682('0xf')][_0x566411[_0x9682('0x28')]]){this[_0x9682('0xf')][_0x566411[_0x9682('0x28')]][_0x9682('0x2f')]=_0x566411[_0x9682('0x2f')];this[_0x9682('0xf')][_0x566411[_0x9682('0x28')]][_0x9682('0x30')]=_0x566411[_0x9682('0x30')];}};Fax[_0x9682('0x23')][_0x9682('0x1a')]=function(_0x532f9c){if(this[_0x9682('0xf')][_0x532f9c[_0x9682('0x28')]]){for(var _0x338e55 in _0x532f9c[_0x9682('0x2d')]){if(_0x532f9c['variable']['hasOwnProperty'](_0x338e55)){this['channels'][_0x532f9c[_0x9682('0x28')]][_0x338e55]=_0x532f9c[_0x9682('0x2e')];}}}};Fax[_0x9682('0x23')]['syncFaxStatus']=function(_0x40c7f1){if(this[_0x9682('0xf')][_0x40c7f1[_0x9682('0x28')]]){this['channels'][_0x40c7f1['uniqueid']][_0x9682('0x31')]=_0x40c7f1['operation'];this[_0x9682('0xf')][_0x40c7f1[_0x9682('0x28')]][_0x9682('0x32')]=_0x40c7f1[_0x9682('0x32')];this['channels'][_0x40c7f1['uniqueid']]['localstationid']=_0x40c7f1[_0x9682('0x27')];this[_0x9682('0xf')][_0x40c7f1[_0x9682('0x28')]][_0x9682('0x33')]=_0x40c7f1[_0x9682('0x33')];logger['info'](_0x40c7f1[_0x9682('0x28')],_0x9682('0x34'));}};Fax['prototype'][_0x9682('0x1e')]=function(_0x45c73a){var _0x1b243e=this;if(this[_0x9682('0xf')][_0x45c73a[_0x9682('0x28')]]){var _0x16d3cd=this[_0x9682('0xf')][_0x45c73a['uniqueid']]['id'];this[_0x9682('0xf')][_0x45c73a['uniqueid']]['remotestationid']=_0x45c73a[_0x9682('0x35')];this[_0x9682('0xf')][_0x45c73a['uniqueid']][_0x9682('0x36')]=_0x45c73a[_0x9682('0x36')];this[_0x9682('0xf')][_0x45c73a['uniqueid']][_0x9682('0x27')]=_0x45c73a['localstationid'];this['channels'][_0x45c73a['uniqueid']][_0x9682('0x37')]=_0x45c73a[_0x9682('0x37')];this[_0x9682('0xf')][_0x45c73a[_0x9682('0x28')]][_0x9682('0x38')]=_0x45c73a[_0x9682('0x38')];this[_0x9682('0xf')][_0x45c73a[_0x9682('0x28')]][_0x9682('0x33')]=_0x45c73a[_0x9682('0x33')];this[_0x9682('0xf')][_0x45c73a[_0x9682('0x28')]]['calleridnum']=_0x45c73a[_0x9682('0x39')];if(this['channels'][_0x45c73a['uniqueid']][_0x9682('0x36')]>0x0){tiff2pdf(_0x45c73a[_0x9682('0x33')],_0x9682('0x3a'),function(_0x908b84){logger['info'](_0x45c73a[_0x9682('0x28')],_0x9682('0x3b'),_0x908b84[_0x9682('0x3c')]);attachment['create']({'name':path[_0x9682('0x3d')](_0x45c73a[_0x9682('0x33')])[_0x9682('0x29')],'basename':path[_0x9682('0x3d')](_0x45c73a[_0x9682('0x33')])[_0x9682('0x29')]+'.pdf','type':_0x9682('0x3e')})[_0x9682('0x3f')](function(_0x5eaa57){faxAccount[_0x9682('0x40')](_0x16d3cd,{'from':_0x45c73a['calleridnum'],'mapKey':_0x9682('0x8'),'body':path[_0x9682('0x3d')](_0x45c73a[_0x9682('0x33')])[_0x9682('0x29')]+'.pdf','AttachmentId':_0x5eaa57['id']})[_0x9682('0x41')](function(_0xa364d9){logger[_0x9682('0x42')](_0x45c73a[_0x9682('0x28')],'\x20notify\x20',JSON['stringify'](_0xa364d9));});})[_0x9682('0x41')](function(_0x153a73){logger[_0x9682('0x42')](_0x45c73a[_0x9682('0x28')],_0x9682('0x43'),JSON['stringify'](_0x153a73));});});}logger[_0x9682('0x2a')](_0x45c73a['uniqueid'],_0x9682('0x43'));}};Fax[_0x9682('0x23')][_0x9682('0x22')]=function(_0x4fe5b7){if(this[_0x9682('0x12')][_0x4fe5b7[_0x9682('0x28')]]){_[_0x9682('0x44')](this['channels'][_0x4fe5b7[_0x9682('0x28')]],_[_0x9682('0x45')](_0x4fe5b7,['response',_0x9682('0x46')]));}};function updateStatus(_0x704a98){if(_0x704a98['AttachmentId']){faxMessage[_0x9682('0x47')](_0x704a98[_0x9682('0x48')],{'failMessage':_0x9682('0x49')})[_0x9682('0x3f')](function(_0x1a04da){ut['logger']('[Fax][Message][Error][Updated]',_0x1a04da);})[_0x9682('0x41')](function(_0x45329e){ut[_0x9682('0x4a')]('[Fax][Message][Error][NoUpdate1]',_0x45329e);});}else{ut[_0x9682('0x4a')](_0x9682('0x4b'));}}Fax[_0x9682('0x23')][_0x9682('0x4c')]=function(_0x542111,_0x4fb76f,_0x2231c8){var _0x4f5aa7=this;var _0x18c7be={};if(_0x4fb76f){_0x18c7be={'read':_0x4fb76f};}else{_0x18c7be={'failMessage':_0x2231c8};}if(this[_0x9682('0x12')][_0x542111]['AttachmentId']){faxMessage[_0x9682('0x47')](this['actions'][_0x542111][_0x9682('0x48')],_0x18c7be)[_0x9682('0x3f')](function(_0x2485ca){ut['logger']('[Fax][Message][Updated]',_0x2485ca);})[_0x9682('0x41')](function(_0x5b8c81){ut['logger'](_0x9682('0x4d'),_0x5b8c81);})[_0x9682('0x4e')](function(){delete _0x4f5aa7['channels'][_0x542111];delete _0x4f5aa7['actions'][_0x542111];});}else{ut[_0x9682('0x4a')](_0x9682('0x4f'));delete this[_0x9682('0xf')][_0x542111];delete this['actions'][_0x542111];}};Fax['prototype'][_0x9682('0x20')]=function(_0x190cd4){var _0x2ae6a4=this;if(this[_0x9682('0xf')][_0x190cd4[_0x9682('0x28')]]){if(this[_0x9682('0x12')][_0x190cd4[_0x9682('0x28')]]){this[_0x9682('0xf')][_0x190cd4['uniqueid']]['id']=this[_0x9682('0x12')][_0x190cd4[_0x9682('0x28')]]['id'];this[_0x9682('0xf')][_0x190cd4[_0x9682('0x28')]]['name']=this['actions'][_0x190cd4['uniqueid']][_0x9682('0x29')];}logger[_0x9682('0x2a')](_0x190cd4[_0x9682('0x28')],this[_0x9682('0x12')][_0x190cd4[_0x9682('0x28')]]?_0x9682('0x50'):_0x9682('0x51'),JSON[_0x9682('0x52')](this[_0x9682('0xf')][_0x190cd4[_0x9682('0x28')]]));if(this[_0x9682('0x12')][_0x190cd4['uniqueid']]){if(this[_0x9682('0xf')][_0x190cd4[_0x9682('0x28')]][_0x9682('0x53')]>0x0&&this['channels'][_0x190cd4[_0x9682('0x28')]][_0x9682('0x1b')]===_0x9682('0x54')){this[_0x9682('0x4c')](_0x190cd4[_0x9682('0x28')],!![]);}else{this['updateStatus'](_0x190cd4[_0x9682('0x28')],![],this[_0x9682('0xf')][_0x190cd4['uniqueid']][_0x9682('0x55')]?_0x9682('0x56')+this[_0x9682('0xf')][_0x190cd4['uniqueid']]['faxstatusstring']:_0x9682('0x57'));}}}};Fax[_0x9682('0x23')]['send']=function(_0x1f57a1){var _0xce0116=this;return new BPromise(function(_0x5f2cb1,_0x287ba2){_0xce0116[_0x9682('0x58')](_0x1f57a1,_0xce0116[_0x9682('0x10')][_0x1f57a1[_0x9682('0x59')]])['then'](function(_0x3606dd){ut['logger'](_0x9682('0x5a'),_0x3606dd);_0x5f2cb1(ut[_0x9682('0x3c')](_0x9682('0x5b')));})[_0x9682('0x41')](function(_0x4fbc3a){ut[_0x9682('0x4a')](_0x9682('0x5c'),_0x4fbc3a);updateStatus(_0x1f57a1);_0x287ba2(ut[_0x9682('0x3c')](_0x9682('0x5d')));});});};Fax['prototype']['checkAfterSend']=function(_0x22bc71){var _0x54089c=this;return new BPromise(function(_0x51ebee,_0x1e9c70){var _0x53817c=_0x54089c[_0x9682('0x5e')](_0x54089c[_0x9682('0x10')][_0x22bc71['FaxAccountId']][_0x9682('0x5f')],_0x22bc71);if(_0x53817c[_0x9682('0x60')]){_0x51ebee(ut['message']('Trunk\x20Reachable'));}else{_0x1e9c70(ut['message'](_0x53817c[_0x9682('0x3c')]));}});};function originate(_0x1dac9f,_0xf54c9,_0x377c27){return new BPromise(function(_0x30b7cd,_0x1932fc){if(_0x377c27){var _0x1c9067=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x9682('0x3d')](_0x1dac9f[_0x9682('0x4')])[_0x9682('0x29')],_0x1dac9f[_0x9682('0x4')]);gs['execute'](_0x1c9067)['then'](function(){_0x1dac9f[_0x9682('0x4')]=util[_0x9682('0x61')](_0x9682('0x62'),path['parse'](_0x1dac9f[_0x9682('0x4')])['dir'],path[_0x9682('0x3d')](_0x1dac9f[_0x9682('0x4')])[_0x9682('0x29')]);_0xf54c9['XMF-PATH']=_0x1dac9f[_0x9682('0x4')];ut['logger'](_0x9682('0x63'),'');ami[_0x9682('0x64')](ut[_0x9682('0x65')](_0x1dac9f,_0xf54c9))[_0x9682('0x3f')](function(_0x56662f){_0x30b7cd(_0x56662f);})[_0x9682('0x41')](function(_0x399942){_0x1932fc(_0x399942);});})[_0x9682('0x41')](function(_0x17299b){_0x1932fc(_0x17299b);});}else{ami[_0x9682('0x64')](ut[_0x9682('0x65')](_0x1dac9f,_0xf54c9))['then'](function(_0x3f121d){_0x30b7cd(_0x3f121d);})[_0x9682('0x41')](function(_0x57ab9e){_0x1932fc(_0x57ab9e);});}});}Fax[_0x9682('0x23')]['execOriginate']=function(_0x9d4a6d,_0x9b6f99){var _0x4993db=this;return new BPromise(function(_0x32efa8,_0x48c275){var _0xb16f5e=uuid['v4']();var _0x3699c0=ut[_0x9682('0x66')](_0x9d4a6d,_0x9b6f99);_0x4993db[_0x9682('0x12')][_0xb16f5e]=new Action(_0xb16f5e,_0x9b6f99,_0x9d4a6d);var _0x57cc79=_0x4993db[_0x9682('0x12')][_0xb16f5e];if(path[_0x9682('0x3d')](_0x9d4a6d['path'])[_0x9682('0x67')]===_0x9682('0x68')){originate(_0x57cc79,_0x3699c0,!![])[_0x9682('0x3f')](function(_0x1aadd9){_0x32efa8(_0x1aadd9);})['catch'](function(_0x26537a){_0x48c275(_0x26537a);});}else{originate(_0x57cc79,_0x3699c0,![])[_0x9682('0x3f')](function(_0x4e82a7){_0x32efa8(_0x4e82a7);})['catch'](function(_0x2b14d8){_0x48c275(_0x2b14d8);});}});};Fax[_0x9682('0x23')][_0x9682('0x69')]=function(_0x3ede2c){return!_['isNil'](_0x3ede2c)&&!_[_0x9682('0x6a')](_0x3ede2c[_0x9682('0x29')])&&!_[_0x9682('0x6a')](_0x3ede2c[_0x9682('0x6b')])&&_0x3ede2c[_0x9682('0x6b')]&&!_['isNil'](this[_0x9682('0x11')][util[_0x9682('0x61')](_0x9682('0x6c'),_0x3ede2c[_0x9682('0x29')])])&&!_[_0x9682('0x6a')](this[_0x9682('0x11')][util[_0x9682('0x61')](_0x9682('0x6c'),_0x3ede2c[_0x9682('0x29')])][_0x9682('0x32')])&&(this['trunks'][util[_0x9682('0x61')](_0x9682('0x6c'),_0x3ede2c[_0x9682('0x29')])][_0x9682('0x32')]==='reachable'||this[_0x9682('0x11')][util[_0x9682('0x61')](_0x9682('0x6c'),_0x3ede2c[_0x9682('0x29')])]['status']===_0x9682('0x6d'));};Fax[_0x9682('0x23')]['checkTrunk']=function(_0x571af4,_0x2efa59){if(!this[_0x9682('0x69')](_0x571af4)){ut[_0x9682('0x4a')](_0x9682('0x6e'),_[_0x9682('0x6a')](_0x571af4)?'':_0x571af4[_0x9682('0x29')]+_0x9682('0x6f'));return{'isValid':![],'message':_0x9682('0x70')};}if(_[_0x9682('0x6a')](_0x2efa59[_0x9682('0x8')])){ut[_0x9682('0x4a')](_0x9682('0x71'),JSON[_0x9682('0x52')](_0x2efa59));return{'isValid':![],'message':_0x9682('0x72')};}if(_[_0x9682('0x6a')](_0x2efa59[_0x9682('0x4')])){ut[_0x9682('0x4a')](_0x9682('0x73'),JSON[_0x9682('0x52')](_0x2efa59));return{'isValid':![],'message':_0x9682('0x74')};}return{'isValid':!![],'message':_0x9682('0x75')};};module[_0x9682('0x76')]=Fax; \ No newline at end of file +var _0x3180=['[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','uuid','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','channels','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','channelstate','channelstatedesc','value','operation','status','localstationid','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','catch','error','\x20notify\x20','stringify','merge','response','reason','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','AttachmentId','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax'];(function(_0x1831e7,_0x1c4f81){var _0x3c02f4=function(_0x48282){while(--_0x48282){_0x1831e7['push'](_0x1831e7['shift']());}};_0x3c02f4(++_0x1c4f81);}(_0x3180,0x80));var _0x0318=function(_0x702144,_0x148431){_0x702144=_0x702144-0x0;var _0x50276c=_0x3180[_0x702144];return _0x50276c;};'use strict';var util=require(_0x0318('0x0'));var _=require(_0x0318('0x1'));var BPromise=require(_0x0318('0x2'));var uuid=require(_0x0318('0x3'));var moment=require('moment');var path=require(_0x0318('0x4'));var tiff2pdf=require(_0x0318('0x5'));var gs=require('./util/gs');var logger=require(_0x0318('0x6'))(_0x0318('0x7'));var ami=require(_0x0318('0x8'));var rpcDb=require(_0x0318('0x9'));var Channel=require(_0x0318('0xa'));var ut=require(_0x0318('0xb'));var Action=require('./action');var faxAccount=require(_0x0318('0xc'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x0318('0xd'));function Fax(_0x50517f){this['channels']={};this['faxAccounts']=_0x50517f[_0x0318('0xe')];this[_0x0318('0xf')]=_0x50517f[_0x0318('0xf')];this[_0x0318('0x10')]={};ami['on'](_0x0318('0x11'),this[_0x0318('0x12')][_0x0318('0x13')](this));ami['on'](_0x0318('0x14'),this[_0x0318('0x15')][_0x0318('0x13')](this));ami['on'](_0x0318('0x16'),this[_0x0318('0x17')][_0x0318('0x13')](this));ami['on'](_0x0318('0x18'),this[_0x0318('0x19')][_0x0318('0x13')](this));ami['on'](_0x0318('0x1a'),this[_0x0318('0x1b')][_0x0318('0x13')](this));ami['on'](_0x0318('0x1c'),this['syncReceiveFax'][_0x0318('0x13')](this));ami['on']('hangup',this[_0x0318('0x1d')][_0x0318('0x13')](this));ami['on'](_0x0318('0x1e'),this[_0x0318('0x1f')][_0x0318('0x13')](this));}Fax[_0x0318('0x20')][_0x0318('0x12')]=function(_0x5eec29){if(_0x5eec29[_0x0318('0x21')]===_0x0318('0x22')){for(var _0x4a3b4c in this[_0x0318('0xe')]){if(this[_0x0318('0xe')][_0x0318('0x23')](_0x4a3b4c)){if(_0x5eec29['exten']===this[_0x0318('0xe')][_0x4a3b4c]['localstationid']){this['channels'][_0x5eec29['uniqueid']]={};this[_0x0318('0x24')][_0x5eec29[_0x0318('0x25')]][_0x0318('0x26')]=_0x5eec29['channel'];this[_0x0318('0x24')][_0x5eec29[_0x0318('0x25')]]['id']=this[_0x0318('0xe')][_0x4a3b4c]['id'];this[_0x0318('0x24')][_0x5eec29[_0x0318('0x25')]][_0x0318('0x27')]=this['faxAccounts'][_0x4a3b4c][_0x0318('0x27')];logger['info'](_0x5eec29['uniqueid'],_0x0318('0x28'));}}}}if(this[_0x0318('0x10')][_0x5eec29[_0x0318('0x25')]]){this['channels'][_0x5eec29[_0x0318('0x25')]]={};this[_0x0318('0x24')][_0x5eec29['uniqueid']][_0x0318('0x26')]=_0x5eec29['channel'];logger[_0x0318('0x29')](_0x5eec29['uniqueid'],_0x0318('0x28'));}};Fax[_0x0318('0x20')][_0x0318('0x15')]=function(_0x2e802b){if(this[_0x0318('0x24')][_0x2e802b[_0x0318('0x25')]]){for(var _0x37f552 in _0x2e802b[_0x0318('0x2a')]){if(_0x2e802b['variable'][_0x0318('0x23')](_0x37f552)){this[_0x0318('0x24')][_0x2e802b['uniqueid']][_0x37f552]=_0x2e802b['value'];}}}};Fax[_0x0318('0x20')][_0x0318('0x17')]=function(_0x3a322b){if(this[_0x0318('0x24')][_0x3a322b[_0x0318('0x25')]]){this['channels'][_0x3a322b['uniqueid']][_0x0318('0x2b')]=_0x3a322b[_0x0318('0x2b')];this[_0x0318('0x24')][_0x3a322b[_0x0318('0x25')]][_0x0318('0x2c')]=_0x3a322b[_0x0318('0x2c')];}};Fax[_0x0318('0x20')][_0x0318('0x19')]=function(_0x23ba70){if(this['channels'][_0x23ba70[_0x0318('0x25')]]){for(var _0x21ef09 in _0x23ba70[_0x0318('0x2a')]){if(_0x23ba70[_0x0318('0x2a')][_0x0318('0x23')](_0x21ef09)){this[_0x0318('0x24')][_0x23ba70['uniqueid']][_0x21ef09]=_0x23ba70[_0x0318('0x2d')];}}}};Fax[_0x0318('0x20')][_0x0318('0x1b')]=function(_0x48c35d){if(this[_0x0318('0x24')][_0x48c35d[_0x0318('0x25')]]){this['channels'][_0x48c35d[_0x0318('0x25')]][_0x0318('0x2e')]=_0x48c35d['operation'];this[_0x0318('0x24')][_0x48c35d[_0x0318('0x25')]][_0x0318('0x2f')]=_0x48c35d[_0x0318('0x2f')];this['channels'][_0x48c35d['uniqueid']][_0x0318('0x30')]=_0x48c35d['localstationid'];this[_0x0318('0x24')][_0x48c35d[_0x0318('0x25')]][_0x0318('0x31')]=_0x48c35d['filename'];logger[_0x0318('0x29')](_0x48c35d[_0x0318('0x25')],_0x0318('0x32'));}};Fax[_0x0318('0x20')][_0x0318('0x33')]=function(_0xaf7fb7){var _0x442cf2=this;if(this[_0x0318('0x24')][_0xaf7fb7[_0x0318('0x25')]]){var _0x2cc9d2=this['channels'][_0xaf7fb7['uniqueid']]['id'];this[_0x0318('0x24')][_0xaf7fb7[_0x0318('0x25')]][_0x0318('0x34')]=_0xaf7fb7[_0x0318('0x34')];this[_0x0318('0x24')][_0xaf7fb7['uniqueid']][_0x0318('0x35')]=_0xaf7fb7[_0x0318('0x35')];this[_0x0318('0x24')][_0xaf7fb7[_0x0318('0x25')]]['localstationid']=_0xaf7fb7[_0x0318('0x30')];this['channels'][_0xaf7fb7[_0x0318('0x25')]]['resolution']=_0xaf7fb7['resolution'];this[_0x0318('0x24')][_0xaf7fb7[_0x0318('0x25')]]['transferrate']=_0xaf7fb7[_0x0318('0x36')];this['channels'][_0xaf7fb7[_0x0318('0x25')]][_0x0318('0x31')]=_0xaf7fb7['filename'];this[_0x0318('0x24')][_0xaf7fb7[_0x0318('0x25')]][_0x0318('0x37')]=_0xaf7fb7[_0x0318('0x37')];if(this[_0x0318('0x24')][_0xaf7fb7[_0x0318('0x25')]][_0x0318('0x35')]>0x0){tiff2pdf(_0xaf7fb7['filename'],_0x0318('0x38'),function(_0x584d31){logger[_0x0318('0x29')](_0xaf7fb7[_0x0318('0x25')],_0x0318('0x39'),_0x584d31[_0x0318('0x3a')]);attachment[_0x0318('0x3b')]({'name':path[_0x0318('0x3c')](_0xaf7fb7[_0x0318('0x31')])[_0x0318('0x27')],'basename':path[_0x0318('0x3c')](_0xaf7fb7[_0x0318('0x31')])['name']+_0x0318('0x3d'),'type':_0x0318('0x3e')})['then'](function(_0xa73bff){faxAccount[_0x0318('0x3f')](_0x2cc9d2,{'from':_0xaf7fb7[_0x0318('0x37')],'mapKey':_0x0318('0x7'),'body':path[_0x0318('0x3c')](_0xaf7fb7[_0x0318('0x31')])[_0x0318('0x27')]+_0x0318('0x3d'),'AttachmentId':_0xa73bff['id']})[_0x0318('0x40')](function(_0x4fd9ff){logger[_0x0318('0x41')](_0xaf7fb7[_0x0318('0x25')],_0x0318('0x42'),JSON[_0x0318('0x43')](_0x4fd9ff));});})[_0x0318('0x40')](function(_0x5067f7){logger[_0x0318('0x41')](_0xaf7fb7[_0x0318('0x25')],'\x20receiveFax\x20',JSON['stringify'](_0x5067f7));});});}logger[_0x0318('0x29')](_0xaf7fb7[_0x0318('0x25')],'\x20receiveFax\x20');}};Fax[_0x0318('0x20')][_0x0318('0x1f')]=function(_0x5bd599){if(this[_0x0318('0x10')][_0x5bd599[_0x0318('0x25')]]){_[_0x0318('0x44')](this[_0x0318('0x24')][_0x5bd599[_0x0318('0x25')]],_['pick'](_0x5bd599,[_0x0318('0x45'),_0x0318('0x46')]));}};function updateStatus(_0x7187ac){if(_0x7187ac['AttachmentId']){faxMessage['update'](_0x7187ac['AttachmentId'],{'failMessage':_0x0318('0x47')})[_0x0318('0x48')](function(_0x6698ce){ut[_0x0318('0x49')](_0x0318('0x4a'),_0x6698ce);})[_0x0318('0x40')](function(_0x3e4bad){ut[_0x0318('0x49')](_0x0318('0x4b'),_0x3e4bad);});}else{ut['logger'](_0x0318('0x4c'));}}Fax[_0x0318('0x20')]['updateStatus']=function(_0x32de6c,_0x1e9848,_0x1b55ad){var _0x467f34=this;var _0x2d85e9={};if(_0x1e9848){_0x2d85e9={'read':_0x1e9848};}else{_0x2d85e9={'failMessage':_0x1b55ad};}if(this[_0x0318('0x10')][_0x32de6c][_0x0318('0x4d')]){faxMessage[_0x0318('0x4e')](this['actions'][_0x32de6c][_0x0318('0x4d')],_0x2d85e9)[_0x0318('0x48')](function(_0x6d0f82){ut['logger'](_0x0318('0x4f'),_0x6d0f82);})[_0x0318('0x40')](function(_0x2eb296){ut[_0x0318('0x49')](_0x0318('0x50'),_0x2eb296);})[_0x0318('0x51')](function(){delete _0x467f34[_0x0318('0x24')][_0x32de6c];delete _0x467f34[_0x0318('0x10')][_0x32de6c];});}else{ut['logger'](_0x0318('0x52'));delete this[_0x0318('0x24')][_0x32de6c];delete this[_0x0318('0x10')][_0x32de6c];}};Fax[_0x0318('0x20')][_0x0318('0x1d')]=function(_0x26247d){var _0x152cb1=this;if(this[_0x0318('0x24')][_0x26247d[_0x0318('0x25')]]){if(this[_0x0318('0x10')][_0x26247d[_0x0318('0x25')]]){this['channels'][_0x26247d[_0x0318('0x25')]]['id']=this[_0x0318('0x10')][_0x26247d[_0x0318('0x25')]]['id'];this[_0x0318('0x24')][_0x26247d[_0x0318('0x25')]][_0x0318('0x27')]=this[_0x0318('0x10')][_0x26247d['uniqueid']][_0x0318('0x27')];}logger['info'](_0x26247d[_0x0318('0x25')],this[_0x0318('0x10')][_0x26247d[_0x0318('0x25')]]?'\x20hangup\x20sendFile\x20':_0x0318('0x53'),JSON[_0x0318('0x43')](this['channels'][_0x26247d[_0x0318('0x25')]]));if(this[_0x0318('0x10')][_0x26247d['uniqueid']]){if(this['channels'][_0x26247d[_0x0318('0x25')]][_0x0318('0x54')]>0x0&&this[_0x0318('0x24')][_0x26247d[_0x0318('0x25')]][_0x0318('0x1a')]===_0x0318('0x55')){this[_0x0318('0x56')](_0x26247d[_0x0318('0x25')],!![]);}else{this[_0x0318('0x56')](_0x26247d[_0x0318('0x25')],![],this[_0x0318('0x24')][_0x26247d[_0x0318('0x25')]][_0x0318('0x57')]?_0x0318('0x58')+this[_0x0318('0x24')][_0x26247d[_0x0318('0x25')]][_0x0318('0x57')]:_0x0318('0x59'));}}}};Fax['prototype'][_0x0318('0x5a')]=function(_0x3a1f20){var _0x46291f=this;return new BPromise(function(_0xf528b5,_0x493f05){_0x46291f['execOriginate'](_0x3a1f20,_0x46291f['faxAccounts'][_0x3a1f20[_0x0318('0x5b')]])[_0x0318('0x48')](function(_0x5a249b){ut[_0x0318('0x49')](_0x0318('0x5c'),_0x5a249b);_0xf528b5(ut['message'](_0x0318('0x5d')));})[_0x0318('0x40')](function(_0x20811f){ut[_0x0318('0x49')](_0x0318('0x5e'),_0x20811f);updateStatus(_0x3a1f20);_0x493f05(ut[_0x0318('0x3a')](_0x0318('0x5f')));});});};Fax[_0x0318('0x20')][_0x0318('0x60')]=function(_0x3a39ad){var _0x29611d=this;return new BPromise(function(_0x235222,_0x302dc1){var _0x123040=_0x29611d[_0x0318('0x61')](_0x29611d[_0x0318('0xe')][_0x3a39ad[_0x0318('0x5b')]][_0x0318('0x62')],_0x3a39ad);if(_0x123040[_0x0318('0x63')]){_0x235222(ut['message'](_0x0318('0x64')));}else{_0x302dc1(ut[_0x0318('0x3a')](_0x123040['message']));}});};function originate(_0x1b23c3,_0xfb7e7e,_0x4bac4b){return new BPromise(function(_0x5bf070,_0x46f26f){if(_0x4bac4b){var _0x1b393e=util[_0x0318('0x65')](_0x0318('0x66'),path[_0x0318('0x3c')](_0x1b23c3['path'])[_0x0318('0x27')],_0x1b23c3[_0x0318('0x4')]);gs[_0x0318('0x67')](_0x1b393e)[_0x0318('0x48')](function(){_0x1b23c3[_0x0318('0x4')]=util[_0x0318('0x65')](_0x0318('0x68'),path['parse'](_0x1b23c3[_0x0318('0x4')])[_0x0318('0x69')],path['parse'](_0x1b23c3['path'])[_0x0318('0x27')]);_0xfb7e7e[_0x0318('0x6a')]=_0x1b23c3[_0x0318('0x4')];ut[_0x0318('0x49')](_0x0318('0x6b'),'');ami[_0x0318('0x6c')](ut[_0x0318('0x6d')](_0x1b23c3,_0xfb7e7e))['then'](function(_0x3a7b34){_0x5bf070(_0x3a7b34);})['catch'](function(_0x25b50b){_0x46f26f(_0x25b50b);});})[_0x0318('0x40')](function(_0x51e8a1){_0x46f26f(_0x51e8a1);});}else{ami['Action'](ut[_0x0318('0x6d')](_0x1b23c3,_0xfb7e7e))['then'](function(_0x1e96c6){_0x5bf070(_0x1e96c6);})[_0x0318('0x40')](function(_0xfb4d39){_0x46f26f(_0xfb4d39);});}});}Fax[_0x0318('0x20')]['execOriginate']=function(_0x16caf8,_0x500854){var _0x1eea0c=this;return new BPromise(function(_0x518499,_0x4c741c){var _0x21462b=uuid['v4']();var _0x37af27=ut[_0x0318('0x6e')](_0x16caf8,_0x500854);_0x1eea0c[_0x0318('0x10')][_0x21462b]=new Action(_0x21462b,_0x500854,_0x16caf8);var _0x8ecae9=_0x1eea0c[_0x0318('0x10')][_0x21462b];if(path['parse'](_0x16caf8[_0x0318('0x4')])[_0x0318('0x6f')]==='.pdf'){originate(_0x8ecae9,_0x37af27,!![])[_0x0318('0x48')](function(_0x16ee3e){_0x518499(_0x16ee3e);})[_0x0318('0x40')](function(_0x4fce6c){_0x4c741c(_0x4fce6c);});}else{originate(_0x8ecae9,_0x37af27,![])['then'](function(_0x300c36){_0x518499(_0x300c36);})[_0x0318('0x40')](function(_0x2821da){_0x4c741c(_0x2821da);});}});};Fax[_0x0318('0x20')][_0x0318('0x70')]=function(_0x276915){return!_[_0x0318('0x71')](_0x276915)&&!_[_0x0318('0x71')](_0x276915[_0x0318('0x27')])&&!_['isNil'](_0x276915[_0x0318('0x72')])&&_0x276915['active']&&!_['isNil'](this[_0x0318('0xf')][util['format'](_0x0318('0x73'),_0x276915[_0x0318('0x27')])])&&!_['isNil'](this['trunks'][util[_0x0318('0x65')](_0x0318('0x73'),_0x276915[_0x0318('0x27')])][_0x0318('0x2f')])&&(this[_0x0318('0xf')][util['format'](_0x0318('0x73'),_0x276915['name'])][_0x0318('0x2f')]==='reachable'||this[_0x0318('0xf')][util['format'](_0x0318('0x73'),_0x276915[_0x0318('0x27')])][_0x0318('0x2f')]===_0x0318('0x74'));};Fax[_0x0318('0x20')]['checkTrunk']=function(_0x45a3bf,_0x574a35){if(!this[_0x0318('0x70')](_0x45a3bf)){ut[_0x0318('0x49')](_0x0318('0x75'),_['isNil'](_0x45a3bf)?'':_0x45a3bf[_0x0318('0x27')]+_0x0318('0x76'));return{'isValid':![],'message':_0x0318('0x77')};}if(_['isNil'](_0x574a35[_0x0318('0x7')])){ut[_0x0318('0x49')](_0x0318('0x78'),JSON['stringify'](_0x574a35));return{'isValid':![],'message':_0x0318('0x79')};}if(_[_0x0318('0x71')](_0x574a35[_0x0318('0x4')])){ut[_0x0318('0x49')](_0x0318('0x7a'),JSON[_0x0318('0x43')](_0x574a35));return{'isValid':![],'message':_0x0318('0x7b')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x0318('0x7c')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 0f07dcd..de26747 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 _0xfa8b=['preview','../rpc/faxAccount','error','notify','resolve','then','catch','util','bluebird','../../../config/logger'];(function(_0x1951de,_0x173387){var _0x418584=function(_0xfaf379){while(--_0xfaf379){_0x1951de['push'](_0x1951de['shift']());}};_0x418584(++_0x173387);}(_0xfa8b,0x179));var _0xbfa8=function(_0x268f87,_0x1a5ea2){_0x268f87=_0x268f87-0x0;var _0x58e90a=_0xfa8b[_0x268f87];return _0x58e90a;};'use strict';var util=require(_0xbfa8('0x0'));var BPromise=require(_0xbfa8('0x1'));var logger=require(_0xbfa8('0x2'))(_0xbfa8('0x3'));var _=require('lodash');var faxAccount=require(_0xbfa8('0x4'));function loggerCatch(_0x2cfe8d){return function(_0x51bb63){logger[_0xbfa8('0x5')](_0x2cfe8d,util['inspect'](_0x51bb63,{'showHidden':![],'depth':null}));};}exports[_0xbfa8('0x6')]=function(_0x1acb83,_0x324fab){return BPromise[_0xbfa8('0x7')]()[_0xbfa8('0x8')](faxAccount['notify'](_0x1acb83,_0x324fab))[_0xbfa8('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x8b44=['notify','resolve','then','[Notify]\x20','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error'];(function(_0x562bea,_0x54b1a9){var _0x5baa11=function(_0x59c557){while(--_0x59c557){_0x562bea['push'](_0x562bea['shift']());}};_0x5baa11(++_0x54b1a9);}(_0x8b44,0x90));var _0x48b4=function(_0x37b252,_0x489177){_0x37b252=_0x37b252-0x0;var _0xe06f7f=_0x8b44[_0x37b252];return _0xe06f7f;};'use strict';var util=require(_0x48b4('0x0'));var BPromise=require('bluebird');var logger=require(_0x48b4('0x1'))(_0x48b4('0x2'));var _=require(_0x48b4('0x3'));var faxAccount=require(_0x48b4('0x4'));function loggerCatch(_0x5dc846){return function(_0x212255){logger[_0x48b4('0x5')](_0x5dc846,util['inspect'](_0x212255,{'showHidden':![],'depth':null}));};}exports[_0x48b4('0x6')]=function(_0x173867,_0x175f32){return BPromise[_0x48b4('0x7')]()[_0x48b4('0x8')](faxAccount['notify'](_0x173867,_0x175f32))['catch'](loggerCatch(_0x48b4('0x9')));}; \ 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 bac287f..041362a 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 _0x5058=['execute','info','\x20Error\x20:','inspect','bluebird','child_process'];(function(_0x593c1f,_0x8cd159){var _0x4c7417=function(_0x4726f3){while(--_0x4726f3){_0x593c1f['push'](_0x593c1f['shift']());}};_0x4c7417(++_0x8cd159);}(_0x5058,0xca));var _0x8505=function(_0x4f431d,_0xd51a3b){_0x4f431d=_0x4f431d-0x0;var _0x4f31e1=_0x5058[_0x4f431d];return _0x4f31e1;};'use strict';var util=require('util');var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x8505('0x0'));var exec=require(_0x8505('0x1'))['exec'];exports[_0x8505('0x2')]=function(_0x5dcccd){return new BPromise(function(_0x1665dc,_0x3af04d){exec(_0x5dcccd,function(_0xe6b2c9,_0x312734,_0x28ca17){logger['info']('Exec\x20gs',_0x312734);if(_0xe6b2c9){logger[_0x8505('0x3')]('Exec\x20gs',_0x8505('0x4'),util[_0x8505('0x5')](_0xe6b2c9,{'showHidden':![],'depth':null}),_0x312734,_0x28ca17);_0x3af04d(_0xe6b2c9);}_0x1665dc(_0x312734);});});}; \ No newline at end of file +var _0xdb29=['bluebird','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax'];(function(_0x58d2ac,_0x5620bc){var _0x314134=function(_0x4ca7c1){while(--_0x4ca7c1){_0x58d2ac['push'](_0x58d2ac['shift']());}};_0x314134(++_0x5620bc);}(_0xdb29,0x193));var _0x9db2=function(_0x2c6b9f,_0x177194){_0x2c6b9f=_0x2c6b9f-0x0;var _0x2ae254=_0xdb29[_0x2c6b9f];return _0x2ae254;};'use strict';var util=require('util');var logger=require(_0x9db2('0x0'))(_0x9db2('0x1'));var BPromise=require(_0x9db2('0x2'));var exec=require('child_process')[_0x9db2('0x3')];exports[_0x9db2('0x4')]=function(_0xbc1019){return new BPromise(function(_0x1c1f6f,_0x1b03da){exec(_0xbc1019,function(_0x2d3656,_0x2f523a,_0x2724cc){logger[_0x9db2('0x5')](_0x9db2('0x6'),_0x2f523a);if(_0x2d3656){logger[_0x9db2('0x5')](_0x9db2('0x6'),_0x9db2('0x7'),util[_0x9db2('0x8')](_0x2d3656,{'showHidden':![],'depth':null}),_0x2f523a,_0x2724cc);_0x1b03da(_0x2d3656);}_0x1c1f6f(_0x2f523a);});});}; \ 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 4ba81e0..ed4306c 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 _0x5b04=['lodash','moment','../../../../config/logger','fax','message','info','inspect','addVariables','ecm','headerinfo','maxrate','format','t38timeout','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>'];(function(_0x14fad0,_0x278d75){var _0x5c665f=function(_0xe43a83){while(--_0xe43a83){_0x14fad0['push'](_0x14fad0['shift']());}};_0x5c665f(++_0x278d75);}(_0x5b04,0x17a));var _0x45b0=function(_0x1c9626,_0x48f3ec){_0x1c9626=_0x1c9626-0x0;var _0x5ec34f=_0x5b04[_0x1c9626];return _0x5ec34f;};'use strict';var util=require('util');var _=require(_0x45b0('0x0'));var moment=require(_0x45b0('0x1'));var logger=require(_0x45b0('0x2'))(_0x45b0('0x3'));exports[_0x45b0('0x4')]=function(_0x2f5a6c){return{'message':_0x2f5a6c};};exports['logger']=function(_0x32b3db,_0x2f41f0){logger[_0x45b0('0x5')](_0x32b3db,util[_0x45b0('0x6')](_0x2f41f0,{'showHidden':![],'depth':null}));};exports[_0x45b0('0x7')]=function(_0x85a7a1,_0x2d4742){var _0x410711={'XMF-ECM':_0x2d4742[_0x45b0('0x8')],'XMF-HEADERINFO':_0x2d4742[_0x45b0('0x9')],'XMF-MINRATE':_0x2d4742['minrate'],'XMF-MAXRATE':_0x2d4742[_0x45b0('0xa')],'XMF-MODEM':util[_0x45b0('0xb')]('\x22%s\x22',_0x2d4742['modem']),'XMF-GATEWAY':_0x2d4742['gateway'],'XMF-FAXDETECT':_0x2d4742['faxdetect'],'XMF-T38TIMEOUT':_0x2d4742[_0x45b0('0xc')],'XMF-LOCALSTATIONID':_0x2d4742[_0x45b0('0xd')],'XMF-PATH':_0x85a7a1[_0x45b0('0xe')]};return _0x410711;};exports[_0x45b0('0xf')]=function(_0x36813e,_0x465126){return{'actionid':_0x36813e[_0x45b0('0x10')],'action':_0x45b0('0x11'),'channel':_0x36813e['channel'],'Exten':_0x45b0('0x12'),'Context':_0x45b0('0x13'),'Priority':'1','callerid':util[_0x45b0('0xb')](_0x45b0('0x14'),_0x36813e[_0x45b0('0x9')]?_0x36813e[_0x45b0('0x9')]:'',_0x36813e[_0x45b0('0xd')]),'variable':_0x465126,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x36813e[_0x45b0('0x10')]};}; \ No newline at end of file +var _0xd710=['variablesAction','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','uniqueid','util','lodash','moment','logger','info','ecm','headerinfo','minrate','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path'];(function(_0x554755,_0x2d28fb){var _0x20a259=function(_0x506ef0){while(--_0x506ef0){_0x554755['push'](_0x554755['shift']());}};_0x20a259(++_0x2d28fb);}(_0xd710,0x12c));var _0x0d71=function(_0x556ab5,_0x316319){_0x556ab5=_0x556ab5-0x0;var _0x53dabb=_0xd710[_0x556ab5];return _0x53dabb;};'use strict';var util=require(_0x0d71('0x0'));var _=require(_0x0d71('0x1'));var moment=require(_0x0d71('0x2'));var logger=require('../../../../config/logger')('fax');exports['message']=function(_0x206de6){return{'message':_0x206de6};};exports[_0x0d71('0x3')]=function(_0x374f0d,_0x55c4d8){logger[_0x0d71('0x4')](_0x374f0d,util['inspect'](_0x55c4d8,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x490d39,_0x36ce99){var _0x4a29b6={'XMF-ECM':_0x36ce99[_0x0d71('0x5')],'XMF-HEADERINFO':_0x36ce99[_0x0d71('0x6')],'XMF-MINRATE':_0x36ce99[_0x0d71('0x7')],'XMF-MAXRATE':_0x36ce99['maxrate'],'XMF-MODEM':util[_0x0d71('0x8')](_0x0d71('0x9'),_0x36ce99['modem']),'XMF-GATEWAY':_0x36ce99[_0x0d71('0xa')],'XMF-FAXDETECT':_0x36ce99[_0x0d71('0xb')],'XMF-T38TIMEOUT':_0x36ce99[_0x0d71('0xc')],'XMF-LOCALSTATIONID':_0x36ce99[_0x0d71('0xd')],'XMF-PATH':_0x490d39[_0x0d71('0xe')]};return _0x4a29b6;};exports[_0x0d71('0xf')]=function(_0x16b017,_0x44c2ac){return{'actionid':_0x16b017['uniqueid'],'action':_0x0d71('0x10'),'channel':_0x16b017[_0x0d71('0x11')],'Exten':_0x0d71('0x12'),'Context':'from-sip','Priority':'1','callerid':util[_0x0d71('0x8')](_0x0d71('0x13'),_0x16b017[_0x0d71('0x6')]?_0x16b017[_0x0d71('0x6')]:'',_0x16b017[_0x0d71('0xd')]),'variable':_0x44c2ac,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x16b017[_0x0d71('0x14')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 9647148..d500eb9 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 _0x9497=['./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','initAgents','getTelephones','then','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initZohoAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./preview','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm'];(function(_0x1434c9,_0x573b06){var _0x164c66=function(_0x20caf9){while(--_0x20caf9){_0x1434c9['push'](_0x1434c9['shift']());}};_0x164c66(++_0x573b06);}(_0x9497,0xaa));var _0x7949=function(_0x2999ad,_0x402e7f){_0x2999ad=_0x2999ad-0x0;var _0x3660bf=_0x9497[_0x2999ad];return _0x3660bf;};'use strict';var BPromise=require(_0x7949('0x0'));var util=require(_0x7949('0x1'));var moment=require(_0x7949('0x2'));var server=require(_0x7949('0x3'));var Realtime=require(_0x7949('0x4'));var Report=require(_0x7949('0x5'));var Acw=require(_0x7949('0x6'));var Trigger=require(_0x7949('0x7'));var Dialer=require('./dialer');var Preview=require(_0x7949('0x8'));var Fax=require('./fax');var user=require(_0x7949('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x7949('0xa'));var voiceCallReport=require(_0x7949('0xb'));var trunk=require(_0x7949('0xc'));var trigger=require(_0x7949('0xd'));var template=require(_0x7949('0xe'));var cmHopperHistory=require(_0x7949('0xf'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x7949('0x10'));var zendesk=require(_0x7949('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x7949('0x12'));var freshdesk=require(_0x7949('0x13'));var desk=require(_0x7949('0x14'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x7949('0x15'));var servicenow=require(_0x7949('0x16'));var dynamics365=require(_0x7949('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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x7949('0x18')](_0x7949('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x7949('0x18')](_0x7949('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user['getAgents']())['then'](realtime[_0x7949('0x1a')]())['then'](user[_0x7949('0x1b')]())[_0x7949('0x1c')](realtime['initTelephones']())['then'](trunk[_0x7949('0x1d')]())[_0x7949('0x1c')](realtime[_0x7949('0x1e')]())[_0x7949('0x1c')](voiceQueue[_0x7949('0x1f')]())['then'](realtime[_0x7949('0x20')]())[_0x7949('0x1c')](trigger[_0x7949('0x21')]())[_0x7949('0x1c')](realtime['initTriggers']())[_0x7949('0x1c')](template['getTemplates']())['then'](realtime[_0x7949('0x22')]())[_0x7949('0x1c')](zendesk[_0x7949('0x23')]())[_0x7949('0x1c')](realtime[_0x7949('0x24')]())[_0x7949('0x1c')](salesforce[_0x7949('0x25')]())['then'](realtime['initSalesforceAccounts']())[_0x7949('0x1c')](sugarcrm[_0x7949('0x26')]())[_0x7949('0x1c')](realtime[_0x7949('0x27')]())[_0x7949('0x1c')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0x7949('0x28')]())['then'](desk[_0x7949('0x29')]())['then'](realtime['initDeskAccounts']())[_0x7949('0x1c')](zoho['getZohoAccounts']())[_0x7949('0x1c')](realtime[_0x7949('0x2a')]())[_0x7949('0x1c')](vtiger['getVtigerAccounts']())[_0x7949('0x1c')](realtime['initVtigerAccounts']())[_0x7949('0x1c')](freshsales['getFreshsalesAccounts']())[_0x7949('0x1c')](realtime[_0x7949('0x2b')]())[_0x7949('0x1c')](servicenow[_0x7949('0x2c')]())[_0x7949('0x1c')](realtime[_0x7949('0x2d')]())[_0x7949('0x1c')](dynamics365[_0x7949('0x2e')]())[_0x7949('0x1c')](realtime['initDynamics365Accounts']())['then'](campaign[_0x7949('0x2f')]())['then'](realtime[_0x7949('0x30')]())[_0x7949('0x1c')](voiceExtension[_0x7949('0x31')]())[_0x7949('0x1c')](realtime[_0x7949('0x32')]())[_0x7949('0x1c')](faxAccount[_0x7949('0x33')]())[_0x7949('0x1c')](realtime[_0x7949('0x34')]())[_0x7949('0x1c')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x7949('0x1c')](voiceQueueReport[_0x7949('0x35')]())['then'](realtime[_0x7949('0x36')]())['then'](cmHopperHistory[_0x7949('0x37')]())['then'](realtime[_0x7949('0x38')]())['then'](cmHopperHistory[_0x7949('0x39')]())[_0x7949('0x1c')](realtime[_0x7949('0x3a')]())[_0x7949('0x1c')](voiceCallReport['getVoiceCallReports']())['then'](realtime['initVoiceCallReports']())[_0x7949('0x1c')](function(_0x32278b){})[_0x7949('0x3b')](function(_0x5c11c0){console[_0x7949('0x3c')](_0x5c11c0);});}function main(){return server[_0x7949('0x3d')](realtime,preview,fax)[_0x7949('0x1c')](function(_0x2dcf9b){return initRealtime();})[_0x7949('0x1c')](function(){return initParams();})[_0x7949('0x1c')](function(){report[_0x7949('0x3e')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x193811){console[_0x7949('0x3c')](_0x193811);});}main(); \ No newline at end of file +var _0x14cb=['./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','hour','get','resolve','getAgents','initAgents','getTelephones','initTelephones','then','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','sync','bluebird','util','moment','./server','./realtime','./acw','./dialer'];(function(_0x1f5303,_0x354414){var _0x84ef1a=function(_0x27e275){while(--_0x27e275){_0x1f5303['push'](_0x1f5303['shift']());}};_0x84ef1a(++_0x354414);}(_0x14cb,0xc5));var _0xb14c=function(_0x184b33,_0x520188){_0x184b33=_0x184b33-0x0;var _0x53c7a8=_0x14cb[_0x184b33];return _0x53c7a8;};'use strict';var BPromise=require(_0xb14c('0x0'));var util=require(_0xb14c('0x1'));var moment=require(_0xb14c('0x2'));var server=require(_0xb14c('0x3'));var Realtime=require(_0xb14c('0x4'));var Report=require('./report');var Acw=require(_0xb14c('0x5'));var Trigger=require('./trigger');var Dialer=require(_0xb14c('0x6'));var Preview=require(_0xb14c('0x7'));var Fax=require(_0xb14c('0x8'));var user=require(_0xb14c('0x9'));var voiceQueue=require(_0xb14c('0xa'));var voiceQueueReport=require(_0xb14c('0xb'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xb14c('0xc'));var trigger=require('./rpc/trigger');var template=require(_0xb14c('0xd'));var cmHopperHistory=require(_0xb14c('0xe'));var campaign=require(_0xb14c('0xf'));var voiceExtension=require(_0xb14c('0x10'));var faxAccount=require(_0xb14c('0x11'));var zendesk=require(_0xb14c('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xb14c('0x13'));var freshdesk=require(_0xb14c('0x14'));var desk=require(_0xb14c('0x15'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xb14c('0x16'));var freshsales=require(_0xb14c('0x17'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xb14c('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xb14c('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xb14c('0x1a')](_0xb14c('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xb14c('0x1b')]()['then'](user[_0xb14c('0x1c')]())['then'](realtime[_0xb14c('0x1d')]())['then'](user[_0xb14c('0x1e')]())['then'](realtime[_0xb14c('0x1f')]())[_0xb14c('0x20')](trunk[_0xb14c('0x21')]())[_0xb14c('0x20')](realtime[_0xb14c('0x22')]())[_0xb14c('0x20')](voiceQueue[_0xb14c('0x23')]())[_0xb14c('0x20')](realtime['initVoiceQueues']())[_0xb14c('0x20')](trigger[_0xb14c('0x24')]())[_0xb14c('0x20')](realtime[_0xb14c('0x25')]())['then'](template[_0xb14c('0x26')]())[_0xb14c('0x20')](realtime[_0xb14c('0x27')]())['then'](zendesk[_0xb14c('0x28')]())[_0xb14c('0x20')](realtime[_0xb14c('0x29')]())['then'](salesforce['getSalesforceAccounts']())[_0xb14c('0x20')](realtime['initSalesforceAccounts']())[_0xb14c('0x20')](sugarcrm[_0xb14c('0x2a')]())[_0xb14c('0x20')](realtime[_0xb14c('0x2b')]())[_0xb14c('0x20')](freshdesk[_0xb14c('0x2c')]())[_0xb14c('0x20')](realtime[_0xb14c('0x2d')]())['then'](desk['getDeskAccounts']())[_0xb14c('0x20')](realtime[_0xb14c('0x2e')]())['then'](zoho[_0xb14c('0x2f')]())[_0xb14c('0x20')](realtime[_0xb14c('0x30')]())[_0xb14c('0x20')](vtiger[_0xb14c('0x31')]())[_0xb14c('0x20')](realtime[_0xb14c('0x32')]())[_0xb14c('0x20')](freshsales['getFreshsalesAccounts']())[_0xb14c('0x20')](realtime[_0xb14c('0x33')]())[_0xb14c('0x20')](servicenow[_0xb14c('0x34')]())['then'](realtime['initServicenowAccounts']())[_0xb14c('0x20')](dynamics365[_0xb14c('0x35')]())[_0xb14c('0x20')](realtime[_0xb14c('0x36')]())['then'](campaign[_0xb14c('0x37')]())['then'](realtime['initCampaigns']())['then'](voiceExtension[_0xb14c('0x38')]())[_0xb14c('0x20')](realtime[_0xb14c('0x39')]())[_0xb14c('0x20')](faxAccount[_0xb14c('0x3a')]())[_0xb14c('0x20')](realtime[_0xb14c('0x3b')]())[_0xb14c('0x20')](function(){return realtime;});}function initParams(){return BPromise[_0xb14c('0x1b')]()[_0xb14c('0x20')](voiceQueueReport[_0xb14c('0x3c')]())[_0xb14c('0x20')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0xb14c('0x3d')]())[_0xb14c('0x20')](realtime['initVoiceQueueHopperHistory']())[_0xb14c('0x20')](cmHopperHistory['getCampaignHopperHistory']())[_0xb14c('0x20')](realtime[_0xb14c('0x3e')]())[_0xb14c('0x20')](voiceCallReport[_0xb14c('0x3f')]())[_0xb14c('0x20')](realtime[_0xb14c('0x40')]())[_0xb14c('0x20')](function(_0x4f70c2){})[_0xb14c('0x41')](function(_0x457b15){console[_0xb14c('0x42')](_0x457b15);});}function main(){return server['listen'](realtime,preview,fax)[_0xb14c('0x20')](function(_0x3329f0){return initRealtime();})['then'](function(){return initParams();})[_0xb14c('0x20')](function(){report[_0xb14c('0x43')]();setInterval(initRealtime,0x1388);})[_0xb14c('0x41')](function(_0x50d695){console[_0xb14c('0x42')](_0x50d695);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 4eff1d1..241cae2 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 _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x277d37,_0x2e350e){var _0x1ca1f6=function(_0x2f90d5){while(--_0x2f90d5){_0x277d37['push'](_0x277d37['shift']());}};_0x1ca1f6(++_0x2e350e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5dfc2a,_0x1a953f){_0x5dfc2a=_0x5dfc2a-0x0;var _0x3f1a71=_0xcb91[_0x5dfc2a];return _0x3f1a71;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file +var _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x2d729f,_0x535d12){var _0x24abae=function(_0x387092){while(--_0x387092){_0x2d729f['push'](_0x2d729f['shift']());}};_0x24abae(++_0x535d12);}(_0xe706,0xa3));var _0x6e70=function(_0x5ec454,_0xfcd77e){_0x5ec454=_0x5ec454-0x0;var _0x5ebf50=_0xe706[_0x5ec454];return _0x5ebf50;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 1fe7910..12d9851 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 _0xc62b=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x238d10,_0x18534e){var _0x4d5b76=function(_0x28502a){while(--_0x28502a){_0x238d10['push'](_0x238d10['shift']());}};_0x4d5b76(++_0x18534e);}(_0xc62b,0x1e2));var _0xbc62=function(_0x4dffa3,_0x546fe0){_0x4dffa3=_0x4dffa3-0x0;var _0x154c53=_0xc62b[_0x4dffa3];return _0x154c53;};'use strict';function Campaign(_0x169637){this['id']=_0x169637['id']||0x0;this[_0xbc62('0x0')]=_0x169637[_0xbc62('0x0')]||'';this['type']=_0x169637['type']||'campaign';this['originated']=0x0;this[_0xbc62('0x1')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xbc62('0x2')]=0x0;this[_0xbc62('0x3')]='';this[_0xbc62('0x4')]=!![];this[_0xbc62('0x5')]=_0x169637['active'];this[_0xbc62('0x6')]=_0x169637['limitCalls'];this[_0xbc62('0x7')]=_0x169637[_0xbc62('0x7')]||null;this['dialGlobalInterval']=_0x169637[_0xbc62('0x8')]?_0x169637['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x169637[_0xbc62('0x9')];this[_0xbc62('0xa')]=_0x169637[_0xbc62('0xa')];this[_0xbc62('0xb')]=_0x169637[_0xbc62('0xb')]||0x1e;this['dialCongestionMaxRetry']=_0x169637[_0xbc62('0xc')];this[_0xbc62('0xd')]=_0x169637[_0xbc62('0xd')];this[_0xbc62('0xe')]=_0x169637['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x169637[_0xbc62('0xf')];this[_0xbc62('0x10')]=_0x169637[_0xbc62('0x10')];this[_0xbc62('0x11')]=_0x169637['dialNoAnswerRetryFrequency'];this[_0xbc62('0x12')]=_0x169637[_0xbc62('0x12')];this[_0xbc62('0x13')]=_0x169637[_0xbc62('0x13')]||0x3;this[_0xbc62('0x14')]=_0x169637[_0xbc62('0x14')]||0x96;this['dialDropMaxRetry']=_0x169637[_0xbc62('0x15')]||0x3;this['dialDropRetryFrequency']=_0x169637['dialDropRetryFrequency']||0x96;this[_0xbc62('0x16')]=_0x169637[_0xbc62('0x16')]||0x3;this[_0xbc62('0x17')]=_0x169637[_0xbc62('0x17')]||0x96;this[_0xbc62('0x18')]=_0x169637[_0xbc62('0x18')]||0x3;this[_0xbc62('0x19')]=_0x169637[_0xbc62('0x19')]||0x96;this[_0xbc62('0x1a')]=_0x169637[_0xbc62('0x1a')]||0x3;this['dialAgentRejectRetryFrequency']=_0x169637[_0xbc62('0x1b')]||0x96;this[_0xbc62('0x1c')]=_0x169637[_0xbc62('0x1c')]||_0xbc62('0x1d');this[_0xbc62('0x1e')]=_0x169637[_0xbc62('0x1e')]||undefined;this[_0xbc62('0x1f')]=_0x169637[_0xbc62('0x1f')]||undefined;this['dialCutDigit']=_0x169637[_0xbc62('0x20')]||undefined;this['TrunkBackup']=_0x169637[_0xbc62('0x21')]?_0x169637[_0xbc62('0x21')]:undefined;this[_0xbc62('0x22')]=_0x169637[_0xbc62('0x22')]?_0x169637[_0xbc62('0x22')]:undefined;this[_0xbc62('0x23')]=_0x169637[_0xbc62('0x23')]?_0x169637[_0xbc62('0x23')]:undefined;this[_0xbc62('0x24')]=_0x169637[_0xbc62('0x24')]?_0x169637[_0xbc62('0x24')]:undefined;this[_0xbc62('0x25')]=_0x169637[_0xbc62('0x24')]?_0x169637[_0xbc62('0x24')][_0xbc62('0x0')]:undefined;this['dialAMDActive']=_0x169637['dialAMDActive']||![];this[_0xbc62('0x26')]=_0x169637['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x169637['dialAMDGreeting'];this[_0xbc62('0x27')]=_0x169637[_0xbc62('0x27')];this[_0xbc62('0x28')]=_0x169637[_0xbc62('0x28')];this['dialAMDMinWordLength']=_0x169637['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x169637[_0xbc62('0x29')];this[_0xbc62('0x2a')]=_0x169637[_0xbc62('0x2a')];this[_0xbc62('0x2b')]=_0x169637['dialAMDSilenceThreshold'];this[_0xbc62('0x2c')]=_0x169637[_0xbc62('0x2c')];}module[_0xbc62('0x2d')]=Campaign; \ No newline at end of file +var _0x9f49=['ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay'];(function(_0x5b5808,_0x929bcc){var _0xd20276=function(_0x190892){while(--_0x190892){_0x5b5808['push'](_0x5b5808['shift']());}};_0xd20276(++_0x929bcc);}(_0x9f49,0xeb));var _0x99f4=function(_0x4228f4,_0x388db8){_0x4228f4=_0x4228f4-0x0;var _0x379ef7=_0x9f49[_0x4228f4];return _0x379ef7;};'use strict';function Campaign(_0x4039da){this['id']=_0x4039da['id']||0x0;this[_0x99f4('0x0')]=_0x4039da[_0x99f4('0x0')]||'';this[_0x99f4('0x1')]=_0x4039da[_0x99f4('0x1')]||_0x99f4('0x2');this[_0x99f4('0x3')]=0x0;this['temp']=0x0;this[_0x99f4('0x4')]=0x0;this[_0x99f4('0x5')]=0x0;this['message']='';this[_0x99f4('0x6')]=!![];this['active']=_0x4039da[_0x99f4('0x7')];this[_0x99f4('0x8')]=_0x4039da[_0x99f4('0x8')];this[_0x99f4('0x9')]=_0x4039da[_0x99f4('0x9')]||null;this['dialGlobalInterval']=_0x4039da[_0x99f4('0xa')]?_0x4039da['dialGlobalInterval']:null;this[_0x99f4('0xb')]=_0x4039da[_0x99f4('0xb')];this[_0x99f4('0xc')]=_0x4039da[_0x99f4('0xc')];this[_0x99f4('0xd')]=_0x4039da[_0x99f4('0xd')]||0x1e;this[_0x99f4('0xe')]=_0x4039da[_0x99f4('0xe')];this[_0x99f4('0xf')]=_0x4039da[_0x99f4('0xf')];this['dialBusyMaxRetry']=_0x4039da[_0x99f4('0x10')];this['dialBusyRetryFrequency']=_0x4039da[_0x99f4('0x11')];this[_0x99f4('0x12')]=_0x4039da[_0x99f4('0x12')];this[_0x99f4('0x13')]=_0x4039da[_0x99f4('0x13')];this[_0x99f4('0x14')]=_0x4039da['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x4039da['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4039da[_0x99f4('0x15')]||0x96;this[_0x99f4('0x16')]=_0x4039da['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x4039da['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x4039da[_0x99f4('0x17')]||0x3;this[_0x99f4('0x18')]=_0x4039da[_0x99f4('0x18')]||0x96;this[_0x99f4('0x19')]=_0x4039da[_0x99f4('0x19')]||0x3;this[_0x99f4('0x1a')]=_0x4039da[_0x99f4('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x4039da['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x4039da[_0x99f4('0x1b')]||0x96;this[_0x99f4('0x1c')]=_0x4039da[_0x99f4('0x1c')]||_0x99f4('0x1d');this[_0x99f4('0x1e')]=_0x4039da[_0x99f4('0x1e')]||undefined;this[_0x99f4('0x1f')]=_0x4039da[_0x99f4('0x1f')]||undefined;this[_0x99f4('0x20')]=_0x4039da['dialCutDigit']||undefined;this['TrunkBackup']=_0x4039da[_0x99f4('0x21')]?_0x4039da[_0x99f4('0x21')]:undefined;this[_0x99f4('0x22')]=_0x4039da[_0x99f4('0x22')]?_0x4039da[_0x99f4('0x22')]:undefined;this['Interval']=_0x4039da[_0x99f4('0x23')]?_0x4039da['Interval']:undefined;this[_0x99f4('0x24')]=_0x4039da[_0x99f4('0x24')]?_0x4039da['SquareProject']:undefined;this[_0x99f4('0x25')]=_0x4039da[_0x99f4('0x24')]?_0x4039da[_0x99f4('0x24')][_0x99f4('0x0')]:undefined;this[_0x99f4('0x26')]=_0x4039da[_0x99f4('0x26')]||![];this[_0x99f4('0x27')]=_0x4039da['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x4039da[_0x99f4('0x28')];this[_0x99f4('0x29')]=_0x4039da[_0x99f4('0x29')];this['dialAMDTotalAnalysisTime']=_0x4039da['dialAMDTotalAnalysisTime'];this[_0x99f4('0x2a')]=_0x4039da['dialAMDMinWordLength'];this[_0x99f4('0x2b')]=_0x4039da['dialAMDBetweenWordsSilence'];this[_0x99f4('0x2c')]=_0x4039da[_0x99f4('0x2c')];this['dialAMDSilenceThreshold']=_0x4039da[_0x99f4('0x2d')];this[_0x99f4('0x2e')]=_0x4039da['dialAMDMaximumWordLength'];}module[_0x99f4('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index c1243aa..df21058 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 _0xc210=['answered','answertime','endtime','unmanaged','lastapplication','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','monitors','transfercalleridnum','mohtime','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten'];(function(_0x17bab9,_0xb7f42e){var _0x81f1fd=function(_0x56d4b1){while(--_0x56d4b1){_0x17bab9['push'](_0x17bab9['shift']());}};_0x81f1fd(++_0xb7f42e);}(_0xc210,0x7c));var _0x0c21=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0xc210[_0x38854e];return _0x3f8415;};'use strict';function Channel(){this[_0x0c21('0x0')]=null;this[_0x0c21('0x1')]='';this['destinationchannel']='';this[_0x0c21('0x2')]=0x0;this[_0x0c21('0x3')]='';this[_0x0c21('0x4')]=undefined;this[_0x0c21('0x5')]=undefined;this[_0x0c21('0x6')]=0x0;this[_0x0c21('0x7')]='';this[_0x0c21('0x8')]=0x0;this[_0x0c21('0x9')]=0x0;this[_0x0c21('0xa')]=0x0;this[_0x0c21('0xb')]=![];this[_0x0c21('0xc')]=null;this[_0x0c21('0xd')]=null;this[_0x0c21('0xe')]=![];this['abandoned']=![];this[_0x0c21('0xf')]='';this['lastdata']='';this['duration']=0x0;this[_0x0c21('0x10')]=0x0;this[_0x0c21('0x11')]=0x0;this[_0x0c21('0x12')]=null;this[_0x0c21('0x13')]=null;this[_0x0c21('0x14')]=null;this[_0x0c21('0x15')]=![];this[_0x0c21('0x16')]=null;this['queue']=null;this[_0x0c21('0x17')]=[];this[_0x0c21('0x18')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0x0c21('0x19')]=0x0;}module[_0x0c21('0x1a')]=Channel; \ No newline at end of file +var _0x6df4=['endtime','abandoned','lastapplication','lastdata','duration','billableseconds','type','disposition','monitor','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','destinationchannel','calleridnum','accountcode','exten','answertime'];(function(_0x39f4e1,_0x23fcdf){var _0x2f74d9=function(_0x7fd732){while(--_0x7fd732){_0x39f4e1['push'](_0x39f4e1['shift']());}};_0x2f74d9(++_0x23fcdf);}(_0x6df4,0x78));var _0x46df=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0x6df4[_0x13137e];return _0x346261;};'use strict';function Channel(){this[_0x46df('0x0')]=null;this['channel']='';this[_0x46df('0x1')]='';this[_0x46df('0x2')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0x46df('0x3')]=0x0;this['context']='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0x46df('0x4')]=0x0;this['answered']=![];this[_0x46df('0x5')]=null;this[_0x46df('0x6')]=null;this['unmanaged']=![];this[_0x46df('0x7')]=![];this[_0x46df('0x8')]='';this[_0x46df('0x9')]='';this[_0x46df('0xa')]=0x0;this[_0x46df('0xb')]=0x0;this['holdtime']=0x0;this[_0x46df('0xc')]=null;this['tag']=null;this[_0x46df('0xd')]=null;this[_0x46df('0xe')]=![];this[_0x46df('0xf')]=null;this[_0x46df('0x10')]=null;this['monitors']=[];this[_0x46df('0x11')]=undefined;this[_0x46df('0x12')]=undefined;this[_0x46df('0x13')]=undefined;this[_0x46df('0x14')]=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 bc6e9ac..9e32af3 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 _0x0c77=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','remoteUri','authType'];(function(_0x4c4d3e,_0x20ded2){var _0x40fbeb=function(_0x25d53f){while(--_0x25d53f){_0x4c4d3e['push'](_0x4c4d3e['shift']());}};_0x40fbeb(++_0x20ded2);}(_0x0c77,0x1b6));var _0x70c7=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x0c77[_0x5bd426];return _0x23a7eb;};'use strict';function DeskAccount(_0x13345b){this['id']=_0x13345b['id']||0x0;this['name']=_0x13345b['name']||'';this['username']=_0x13345b['username']||'';this[_0x70c7('0x0')]=_0x13345b['remoteUri']||'';this['authType']=_0x13345b[_0x70c7('0x1')]||'';this[_0x70c7('0x2')]=_0x13345b[_0x70c7('0x2')]||'';this[_0x70c7('0x3')]=_0x13345b[_0x70c7('0x3')]||'';this[_0x70c7('0x4')]=_0x13345b[_0x70c7('0x4')]||'';this[_0x70c7('0x5')]=_0x13345b['token']||'';this['tokenSecret']=_0x13345b[_0x70c7('0x6')]||'';this[_0x70c7('0x7')]=_0x13345b['type']||'';this[_0x70c7('0x8')]=_0x13345b[_0x70c7('0x8')]||'';this['Configurations']=_0x13345b[_0x70c7('0x9')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xde92=['name','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xde92,0xb4));var _0x2de9=function(_0x328bd3,_0x9cf5a5){_0x328bd3=_0x328bd3-0x0;var _0x458149=_0xde92[_0x328bd3];return _0x458149;};'use strict';function DeskAccount(_0x162f0e){this['id']=_0x162f0e['id']||0x0;this[_0x2de9('0x0')]=_0x162f0e[_0x2de9('0x0')]||'';this['username']=_0x162f0e['username']||'';this[_0x2de9('0x1')]=_0x162f0e[_0x2de9('0x1')]||'';this[_0x2de9('0x2')]=_0x162f0e['authType']||'';this['password']=_0x162f0e[_0x2de9('0x3')]||'';this[_0x2de9('0x4')]=_0x162f0e[_0x2de9('0x4')]||'';this['consumerSecret']=_0x162f0e[_0x2de9('0x5')]||'';this[_0x2de9('0x6')]=_0x162f0e[_0x2de9('0x6')]||'';this['tokenSecret']=_0x162f0e[_0x2de9('0x7')]||'';this[_0x2de9('0x8')]=_0x162f0e[_0x2de9('0x8')]||'';this[_0x2de9('0x9')]=_0x162f0e[_0x2de9('0x9')]||'';this[_0x2de9('0xa')]=_0x162f0e[_0x2de9('0xa')]||{};}module[_0x2de9('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 92d850d..c63d304 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 _0xac4a=['clientId','clientSecret','serverUrl','Configurations','name','username','password','remoteUri','tenantId'];(function(_0x865e28,_0x3de135){var _0x3c97d9=function(_0x731417){while(--_0x731417){_0x865e28['push'](_0x865e28['shift']());}};_0x3c97d9(++_0x3de135);}(_0xac4a,0x13f));var _0xaac4=function(_0x21a409,_0x5e65f8){_0x21a409=_0x21a409-0x0;var _0x54d86f=_0xac4a[_0x21a409];return _0x54d86f;};'use strict';function Dynamics365Account(_0x5d2081){this['id']=_0x5d2081['id']||0x0;this[_0xaac4('0x0')]=_0x5d2081[_0xaac4('0x0')]||'';this[_0xaac4('0x1')]=_0x5d2081[_0xaac4('0x1')]||'';this[_0xaac4('0x2')]=_0x5d2081['password']||'';this['remoteUri']=_0x5d2081[_0xaac4('0x3')]||'';this[_0xaac4('0x4')]=_0x5d2081[_0xaac4('0x4')]||'';this['clientId']=_0x5d2081[_0xaac4('0x5')]||'';this['clientSecret']=_0x5d2081[_0xaac4('0x6')]||{};this['serverUrl']=_0x5d2081[_0xaac4('0x7')]||'';this[_0xaac4('0x8')]=_0x5d2081['Configurations']||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xee5b=['clientId','clientSecret','name','username','password','remoteUri'];(function(_0x229128,_0x273558){var _0x1875b9=function(_0x275e35){while(--_0x275e35){_0x229128['push'](_0x229128['shift']());}};_0x1875b9(++_0x273558);}(_0xee5b,0x1f4));var _0xbee5=function(_0x5d2053,_0x4c5ca6){_0x5d2053=_0x5d2053-0x0;var _0x59ef00=_0xee5b[_0x5d2053];return _0x59ef00;};'use strict';function Dynamics365Account(_0x5384bd){this['id']=_0x5384bd['id']||0x0;this['name']=_0x5384bd[_0xbee5('0x0')]||'';this[_0xbee5('0x1')]=_0x5384bd['username']||'';this[_0xbee5('0x2')]=_0x5384bd[_0xbee5('0x2')]||'';this[_0xbee5('0x3')]=_0x5384bd[_0xbee5('0x3')]||'';this['tenantId']=_0x5384bd['tenantId']||'';this[_0xbee5('0x4')]=_0x5384bd[_0xbee5('0x4')]||'';this[_0xbee5('0x5')]=_0x5384bd[_0xbee5('0x5')]||{};this['serverUrl']=_0x5384bd['serverUrl']||'';this['Configurations']=_0x5384bd['Configurations']||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 3ea298d..9e2ec91 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 _0x569d=['SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech'];(function(_0x3eec75,_0x229a49){var _0xaf1ea=function(_0x5e8116){while(--_0x5e8116){_0x3eec75['push'](_0x3eec75['shift']());}};_0xaf1ea(++_0x229a49);}(_0x569d,0x125));var _0xd569=function(_0x20006a,_0x30e3a9){_0x20006a=_0x20006a-0x0;var _0x5e26ac=_0x569d[_0x20006a];return _0x5e26ac;};'use strict';function FaxAccount(_0x35212a){this['id']=_0x35212a['id']||0x0;this[_0xd569('0x0')]=_0x35212a['name']||'';this[_0xd569('0x1')]=_0x35212a[_0xd569('0x1')];this['ecm']=_0x35212a[_0xd569('0x2')];this[_0xd569('0x3')]=_0x35212a[_0xd569('0x3')];this['localstationid']=_0x35212a[_0xd569('0x4')];this[_0xd569('0x5')]=_0x35212a[_0xd569('0x5')]||0x960;this[_0xd569('0x6')]=_0x35212a['maxrate']||0x3840;this[_0xd569('0x7')]=_0x35212a[_0xd569('0x7')]||_0xd569('0x8');this['gateway']=_0x35212a[_0xd569('0x9')]||'no';this[_0xd569('0xa')]=_0x35212a[_0xd569('0xa')]||'no';this[_0xd569('0xb')]=_0x35212a[_0xd569('0xb')]||0x1388;this['tech']=_0x35212a[_0xd569('0xc')]||_0xd569('0xd');this[_0xd569('0xe')]=_0x35212a[_0xd569('0xe')]?_0x35212a[_0xd569('0xe')]:undefined;this[_0xd569('0xf')]=_0x35212a[_0xd569('0xf')];this[_0xd569('0x10')]=_0x35212a[_0xd569('0x10')];}module[_0xd569('0x11')]=FaxAccount; \ No newline at end of file +var _0xbe4e=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name'];(function(_0x11ee32,_0x1314ed){var _0x14e928=function(_0x697d4){while(--_0x697d4){_0x11ee32['push'](_0x11ee32['shift']());}};_0x14e928(++_0x1314ed);}(_0xbe4e,0xba));var _0xebe4=function(_0x5b6375,_0x563718){_0x5b6375=_0x5b6375-0x0;var _0x4045b4=_0xbe4e[_0x5b6375];return _0x4045b4;};'use strict';function FaxAccount(_0x25da43){this['id']=_0x25da43['id']||0x0;this[_0xebe4('0x0')]=_0x25da43[_0xebe4('0x0')]||'';this[_0xebe4('0x1')]=_0x25da43[_0xebe4('0x1')];this[_0xebe4('0x2')]=_0x25da43[_0xebe4('0x2')];this[_0xebe4('0x3')]=_0x25da43[_0xebe4('0x3')];this[_0xebe4('0x4')]=_0x25da43[_0xebe4('0x4')];this[_0xebe4('0x5')]=_0x25da43[_0xebe4('0x5')]||0x960;this[_0xebe4('0x6')]=_0x25da43[_0xebe4('0x6')]||0x3840;this['modem']=_0x25da43[_0xebe4('0x7')]||_0xebe4('0x8');this[_0xebe4('0x9')]=_0x25da43['gateway']||'no';this[_0xebe4('0xa')]=_0x25da43[_0xebe4('0xa')]||'no';this[_0xebe4('0xb')]=_0x25da43['t38timeout']||0x1388;this[_0xebe4('0xc')]=_0x25da43[_0xebe4('0xc')]||'SIP';this[_0xebe4('0xd')]=_0x25da43[_0xebe4('0xd')]?_0x25da43['Trunk']:undefined;this[_0xebe4('0xe')]=_0x25da43['ListId'];this['key']=_0x25da43[_0xebe4('0xf')];}module[_0xebe4('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index a63ca50..eb1a8c4 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 _0xcbf6=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0xd6c36b,_0x460f51){var _0x2dd5eb=function(_0x4d77ee){while(--_0x4d77ee){_0xd6c36b['push'](_0xd6c36b['shift']());}};_0x2dd5eb(++_0x460f51);}(_0xcbf6,0x70));var _0x6cbf=function(_0x4507c1,_0xa8d71a){_0x4507c1=_0x4507c1-0x0;var _0x3d3b03=_0xcbf6[_0x4507c1];return _0x3d3b03;};'use strict';function FreshdeskAccount(_0x49215a){this['id']=_0x49215a['id']||0x0;this[_0x6cbf('0x0')]=_0x49215a['name']||'';this[_0x6cbf('0x1')]=_0x49215a[_0x6cbf('0x1')]||'';this[_0x6cbf('0x2')]=_0x49215a[_0x6cbf('0x3')]||'';this[_0x6cbf('0x4')]=_0x49215a[_0x6cbf('0x4')]||'';this['serverUrl']=_0x49215a[_0x6cbf('0x5')]||'';this[_0x6cbf('0x6')]=_0x49215a[_0x6cbf('0x6')]||{};}module[_0x6cbf('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x57c0=['name','username','apiKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x3e6dbd,_0x9dc614){var _0xd4fa0c=function(_0x552491){while(--_0x552491){_0x3e6dbd['push'](_0x3e6dbd['shift']());}};_0xd4fa0c(++_0x9dc614);}(_0x57c0,0x157));var _0x057c=function(_0x4c5c97,_0x4f85bf){_0x4c5c97=_0x4c5c97-0x0;var _0xd5d2cb=_0x57c0[_0x4c5c97];return _0xd5d2cb;};'use strict';function FreshdeskAccount(_0x99bd88){this['id']=_0x99bd88['id']||0x0;this[_0x057c('0x0')]=_0x99bd88[_0x057c('0x0')]||'';this[_0x057c('0x1')]=_0x99bd88[_0x057c('0x1')]||'';this[_0x057c('0x2')]=_0x99bd88['token']||'';this[_0x057c('0x3')]=_0x99bd88[_0x057c('0x3')]||'';this['serverUrl']=_0x99bd88[_0x057c('0x4')]||'';this[_0x057c('0x5')]=_0x99bd88['Configurations']||{};}module[_0x057c('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 4c2e0e8..28f5558 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 _0xe626=['remoteUri','serverUrl','exports','name','username','apiKey','token'];(function(_0x10791d,_0x2562b6){var _0x1b4f9c=function(_0x3b2815){while(--_0x3b2815){_0x10791d['push'](_0x10791d['shift']());}};_0x1b4f9c(++_0x2562b6);}(_0xe626,0x9d));var _0x6e62=function(_0x379581,_0x55f5fd){_0x379581=_0x379581-0x0;var _0x709b5=_0xe626[_0x379581];return _0x709b5;};'use strict';function FreshsalesAccount(_0x165dfe){this['id']=_0x165dfe['id']||0x0;this[_0x6e62('0x0')]=_0x165dfe[_0x6e62('0x0')]||'';this[_0x6e62('0x1')]=_0x165dfe['username']||'';this[_0x6e62('0x2')]=_0x165dfe[_0x6e62('0x3')]||'';this[_0x6e62('0x4')]=_0x165dfe[_0x6e62('0x4')]||'';this[_0x6e62('0x5')]=_0x165dfe['serverUrl']||'';this['Configurations']=_0x165dfe['Configurations']||{};}module[_0x6e62('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xf1c6=['serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x129071,_0x360dba){var _0x4edaab=function(_0x12c4b8){while(--_0x12c4b8){_0x129071['push'](_0x129071['shift']());}};_0x4edaab(++_0x360dba);}(_0xf1c6,0x145));var _0x6f1c=function(_0x23d3bd,_0x1bbc41){_0x23d3bd=_0x23d3bd-0x0;var _0x12c7c6=_0xf1c6[_0x23d3bd];return _0x12c7c6;};'use strict';function FreshsalesAccount(_0x5cd10b){this['id']=_0x5cd10b['id']||0x0;this['name']=_0x5cd10b[_0x6f1c('0x0')]||'';this[_0x6f1c('0x1')]=_0x5cd10b[_0x6f1c('0x1')]||'';this[_0x6f1c('0x2')]=_0x5cd10b[_0x6f1c('0x3')]||'';this['remoteUri']=_0x5cd10b['remoteUri']||'';this[_0x6f1c('0x4')]=_0x5cd10b['serverUrl']||'';this[_0x6f1c('0x5')]=_0x5cd10b[_0x6f1c('0x5')]||{};}module[_0x6f1c('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 fc1e0fa..1bced6e 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 _0x3714=['queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','context','priority','holdtime','assigned','lastAssignedTo','variables','exports','type','inbound','calleridnum','calleridname','queue'];(function(_0x3001b0,_0x2c682a){var _0x5ccb06=function(_0x1b588c){while(--_0x1b588c){_0x3001b0['push'](_0x3001b0['shift']());}};_0x5ccb06(++_0x2c682a);}(_0x3714,0x95));var _0x4371=function(_0x282455,_0x1ad89c){_0x282455=_0x282455-0x0;var _0x571b5a=_0x3714[_0x282455];return _0x571b5a;};'use strict';function QueueReport(){this[_0x4371('0x0')]=_0x4371('0x1');this['uniqueid']='';this[_0x4371('0x2')]='';this[_0x4371('0x3')]='';this[_0x4371('0x4')]='';this['queuecallerjoinAt']=null;this[_0x4371('0x5')]=null;this[_0x4371('0x6')]=0x1;this[_0x4371('0x7')]=0x1;this['queuecallerabandon']=![];this[_0x4371('0x8')]=null;this['queuecallercomplete']=![];this[_0x4371('0x9')]=null;this[_0x4371('0xa')]=![];this['queuecallerexitAt']=null;this[_0x4371('0xb')]=0x1;this[_0x4371('0xc')]='';this[_0x4371('0xd')]='';this[_0x4371('0xe')]='';this['accountcode']='';this[_0x4371('0xf')]='';this['exten']='';this[_0x4371('0x10')]='';this[_0x4371('0x11')]=0x0;this[_0x4371('0x12')]=![];this[_0x4371('0x13')]='';this['mohtime']=0x0;this[_0x4371('0x14')]={};}module[_0x4371('0x15')]=QueueReport; \ No newline at end of file +var _0x276c=['context','exten','priority','holdtime','assigned','mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','connectedlinename','accountcode'];(function(_0x279aa6,_0x8abf13){var _0x3eb5d5=function(_0x41e877){while(--_0x41e877){_0x279aa6['push'](_0x279aa6['shift']());}};_0x3eb5d5(++_0x8abf13);}(_0x276c,0x177));var _0xc276=function(_0x1dac21,_0x26ee97){_0x1dac21=_0x1dac21-0x0;var _0x5e8656=_0x276c[_0x1dac21];return _0x5e8656;};'use strict';function QueueReport(){this[_0xc276('0x0')]=_0xc276('0x1');this[_0xc276('0x2')]='';this[_0xc276('0x3')]='';this[_0xc276('0x4')]='';this[_0xc276('0x5')]='';this[_0xc276('0x6')]=null;this[_0xc276('0x7')]=null;this['position']=0x1;this[_0xc276('0x8')]=0x1;this[_0xc276('0x9')]=![];this[_0xc276('0xa')]=null;this[_0xc276('0xb')]=![];this[_0xc276('0xc')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0xc276('0xd')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0xc276('0xe')]='';this[_0xc276('0xf')]='';this[_0xc276('0x10')]='';this[_0xc276('0x11')]='';this[_0xc276('0x12')]='';this[_0xc276('0x13')]=0x0;this[_0xc276('0x14')]=![];this['lastAssignedTo']='';this[_0xc276('0x15')]=0x0;this['variables']={};}module[_0xc276('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index a013a28..916a0c0 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 _0xb082=['serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','type','integrationTab'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb082,0x110));var _0x2b08=function(_0x53b42d,_0x323991){_0x53b42d=_0x53b42d-0x0;var _0x3c3e30=_0xb082[_0x53b42d];return _0x3c3e30;};'use strict';function SalesforceAccount(_0x4400d2){this['id']=_0x4400d2['id']||0x0;this[_0x2b08('0x0')]=_0x4400d2[_0x2b08('0x0')]||'';this[_0x2b08('0x1')]=_0x4400d2[_0x2b08('0x1')]||'';this[_0x2b08('0x2')]=_0x4400d2['remoteUri']||'';this[_0x2b08('0x3')]=_0x4400d2[_0x2b08('0x3')]||'';this[_0x2b08('0x4')]=_0x4400d2['clientId']||'';this[_0x2b08('0x5')]=_0x4400d2['clientSecret']||'';this['securityToken']=_0x4400d2['securityToken']||'';this[_0x2b08('0x6')]=_0x4400d2[_0x2b08('0x6')]||_0x2b08('0x7');this['serverUrl']=_0x4400d2[_0x2b08('0x8')]||'';this['Configurations']=_0x4400d2[_0x2b08('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x5c41=['username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports'];(function(_0xca1091,_0x539dbf){var _0xd3019c=function(_0xd629e0){while(--_0xd629e0){_0xca1091['push'](_0xca1091['shift']());}};_0xd3019c(++_0x539dbf);}(_0x5c41,0xb4));var _0x15c4=function(_0x3364a5,_0x43b3d4){_0x3364a5=_0x3364a5-0x0;var _0x2521a1=_0x5c41[_0x3364a5];return _0x2521a1;};'use strict';function SalesforceAccount(_0x2871ee){this['id']=_0x2871ee['id']||0x0;this['name']=_0x2871ee['name']||'';this['username']=_0x2871ee[_0x15c4('0x0')]||'';this[_0x15c4('0x1')]=_0x2871ee['remoteUri']||'';this[_0x15c4('0x2')]=_0x2871ee[_0x15c4('0x2')]||'';this[_0x15c4('0x3')]=_0x2871ee['clientId']||'';this[_0x15c4('0x4')]=_0x2871ee[_0x15c4('0x4')]||'';this[_0x15c4('0x5')]=_0x2871ee['securityToken']||'';this[_0x15c4('0x6')]=_0x2871ee[_0x15c4('0x6')]||'integrationTab';this[_0x15c4('0x7')]=_0x2871ee[_0x15c4('0x7')]||'';this[_0x15c4('0x8')]=_0x2871ee['Configurations']||{};}module[_0x15c4('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 b783a07..a60e6b5 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 _0x9ed2=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x5e78c4,_0x5946b8){var _0x1e8b54=function(_0x1634d7){while(--_0x1634d7){_0x5e78c4['push'](_0x5e78c4['shift']());}};_0x1e8b54(++_0x5946b8);}(_0x9ed2,0x11a));var _0x29ed=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9ed2[_0x2e4aa2];return _0x5e6092;};'use strict';function ServicenowAccount(_0x481653){this['id']=_0x481653['id']||0x0;this[_0x29ed('0x0')]=_0x481653[_0x29ed('0x0')]||'';this['username']=_0x481653[_0x29ed('0x1')]||'';this[_0x29ed('0x2')]=_0x481653[_0x29ed('0x2')]||'';this[_0x29ed('0x3')]=_0x481653[_0x29ed('0x3')]||'';this[_0x29ed('0x4')]=_0x481653[_0x29ed('0x4')]||'';this[_0x29ed('0x5')]=_0x481653[_0x29ed('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x1c4e=['remoteUri','serverUrl','Configurations','exports','name','password'];(function(_0x258fb5,_0x47c7f5){var _0x124437=function(_0x4a0ad1){while(--_0x4a0ad1){_0x258fb5['push'](_0x258fb5['shift']());}};_0x124437(++_0x47c7f5);}(_0x1c4e,0x100));var _0xe1c4=function(_0x19a5c9,_0x5c2e5c){_0x19a5c9=_0x19a5c9-0x0;var _0x5108b3=_0x1c4e[_0x19a5c9];return _0x5108b3;};'use strict';function ServicenowAccount(_0x5c807c){this['id']=_0x5c807c['id']||0x0;this[_0xe1c4('0x0')]=_0x5c807c[_0xe1c4('0x0')]||'';this['username']=_0x5c807c['username']||'';this['password']=_0x5c807c[_0xe1c4('0x1')]||'';this[_0xe1c4('0x2')]=_0x5c807c[_0xe1c4('0x2')]||'';this[_0xe1c4('0x3')]=_0x5c807c[_0xe1c4('0x3')]||'';this['Configurations']=_0x5c807c[_0xe1c4('0x4')]||{};}module[_0xe1c4('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 04d0b37..f93950f 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 _0xd9ba=['name','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x5bfc92,_0x488c84){var _0x10bb5b=function(_0x5b85c5){while(--_0x5b85c5){_0x5bfc92['push'](_0x5bfc92['shift']());}};_0x10bb5b(++_0x488c84);}(_0xd9ba,0x102));var _0xad9b=function(_0x50c663,_0x3dddb3){_0x50c663=_0x50c663-0x0;var _0x3e7766=_0xd9ba[_0x50c663];return _0x3e7766;};'use strict';function SugarcrmAccount(_0x16d6a2){this['id']=_0x16d6a2['id']||0x0;this['name']=_0x16d6a2[_0xad9b('0x0')]||'';this['username']=_0x16d6a2['username']||'';this['password']=_0x16d6a2[_0xad9b('0x1')]||'';this[_0xad9b('0x2')]=_0x16d6a2['remoteUri']||'';this['serverUrl']=_0x16d6a2[_0xad9b('0x3')]||'';this['Configurations']=_0x16d6a2[_0xad9b('0x4')]||{};}module[_0xad9b('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x63b2=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x63b2,0x9a));var _0x263b=function(_0x303e99,_0x530e1d){_0x303e99=_0x303e99-0x0;var _0xcb3339=_0x63b2[_0x303e99];return _0xcb3339;};'use strict';function SugarcrmAccount(_0x3fc743){this['id']=_0x3fc743['id']||0x0;this[_0x263b('0x0')]=_0x3fc743['name']||'';this[_0x263b('0x1')]=_0x3fc743[_0x263b('0x1')]||'';this[_0x263b('0x2')]=_0x3fc743[_0x263b('0x2')]||'';this[_0x263b('0x3')]=_0x3fc743[_0x263b('0x3')]||'';this[_0x263b('0x4')]=_0x3fc743[_0x263b('0x4')]||'';this[_0x263b('0x5')]=_0x3fc743[_0x263b('0x5')]||{};}module[_0x263b('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 c5f2afd..6677ea2 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 _0x5dd5=['status','address','exports','name','accountcode','state','stateTime'];(function(_0x97c6ea,_0x4cffce){var _0x2d7f50=function(_0x54010e){while(--_0x54010e){_0x97c6ea['push'](_0x97c6ea['shift']());}};_0x2d7f50(++_0x4cffce);}(_0x5dd5,0x1a0));var _0x55dd=function(_0x51f51e,_0x2e24e9){_0x51f51e=_0x51f51e-0x0;var _0x236e20=_0x5dd5[_0x51f51e];return _0x236e20;};'use strict';function Telephone(_0x47c784){this['id']=_0x47c784['id']||0x0;this[_0x55dd('0x0')]=_0x47c784['name']||'';this['accountcode']=_0x47c784[_0x55dd('0x1')]||'';this[_0x55dd('0x2')]='unknown';this[_0x55dd('0x3')]=0x0;this[_0x55dd('0x4')]='unknown';this[_0x55dd('0x5')]='';}module[_0x55dd('0x6')]=Telephone; \ No newline at end of file +var _0x4242=['accountcode','unknown','stateTime','status','address','exports','name'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0x4242,0xb5));var _0x2424=function(_0x590979,_0x3b23f8){_0x590979=_0x590979-0x0;var _0x19c9ac=_0x4242[_0x590979];return _0x19c9ac;};'use strict';function Telephone(_0x253e0d){this['id']=_0x253e0d['id']||0x0;this[_0x2424('0x0')]=_0x253e0d[_0x2424('0x0')]||'';this[_0x2424('0x1')]=_0x253e0d['accountcode']||'';this['state']=_0x2424('0x2');this[_0x2424('0x3')]=0x0;this[_0x2424('0x4')]='unknown';this[_0x2424('0x5')]='';}module[_0x2424('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index f9101b3..776f1e9 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0xe89e35,_0xeacae4){var _0x323bae=function(_0x57fff3){while(--_0x57fff3){_0xe89e35['push'](_0xe89e35['shift']());}};_0x323bae(++_0xeacae4);}(_0xb10b,0x12a));var _0xbb10=function(_0x73ea6d,_0x57d5bd){_0x73ea6d=_0x73ea6d-0x0;var _0x4c3a66=_0xb10b[_0x73ea6d];return _0x4c3a66;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x10c8bf,_0x5e858){var _0x5ab52f=function(_0x539608){while(--_0x539608){_0x10c8bf['push'](_0x10c8bf['shift']());}};_0x5ab52f(++_0x5e858);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 98e046f..2e6abb0 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 _0x5f66=['AllConditions','AnyConditions','Actions','name','channel','voice','status'];(function(_0x5f519b,_0x5b606f){var _0x2461e2=function(_0x510241){while(--_0x510241){_0x5f519b['push'](_0x5f519b['shift']());}};_0x2461e2(++_0x5b606f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'use strict';function Trigger(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||_0x65f6('0x2');this[_0x65f6('0x3')]=_0x253044[_0x65f6('0x3')]||![];this['AllConditions']=_0x253044[_0x65f6('0x4')]||[];this['AnyConditions']=_0x253044[_0x65f6('0x5')]||[];this[_0x65f6('0x6')]=_0x253044['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x556286,_0x497028){var _0x12031a=function(_0x24d4eb){while(--_0x24d4eb){_0x556286['push'](_0x556286['shift']());}};_0x12031a(++_0x497028);}(_0x8603,0x190));var _0x3860=function(_0x35b7e6,_0x550f5d){_0x35b7e6=_0x35b7e6-0x0;var _0x114d5e=_0x8603[_0x35b7e6];return _0x114d5e;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('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 e94018b..1fd3533 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 _0x72da=['registrationtime','address','defaultuser','exports','name','state','unknown','stateTime','registry','indexOf','split','port','domain','refresh'];(function(_0x38d7da,_0x51a52f){var _0x4388a7=function(_0x2368d3){while(--_0x2368d3){_0x38d7da['push'](_0x38d7da['shift']());}};_0x4388a7(++_0x51a52f);}(_0x72da,0x11c));var _0xa72d=function(_0x3f4dd9,_0xe0b819){_0x3f4dd9=_0x3f4dd9-0x0;var _0x31c54a=_0x72da[_0x3f4dd9];return _0x31c54a;};'use strict';function Trunk(_0x566ea4){this['id']=_0x566ea4['id']||0x0;this['active']=_0x566ea4['active']||![];this[_0xa72d('0x0')]=_0x566ea4[_0xa72d('0x0')]||'';this[_0xa72d('0x1')]=_0xa72d('0x2');this[_0xa72d('0x3')]=0x0;this['status']='unknown';this[_0xa72d('0x4')]=_0x566ea4['registry']&&_0x566ea4[_0xa72d('0x4')][_0xa72d('0x5')](':')?_0x566ea4[_0xa72d('0x4')][_0xa72d('0x6')](':')[0x0]:'';this['host']='';this[_0xa72d('0x7')]='';this[_0xa72d('0x8')]='';this['domainport']='';this[_0xa72d('0x9')]='';this['stateRegistry']=_0xa72d('0x2');this[_0xa72d('0xa')]='';this[_0xa72d('0xb')]='';this[_0xa72d('0xc')]=_0x566ea4[_0xa72d('0xc')]||'';}module[_0xa72d('0xd')]=Trunk; \ No newline at end of file +var _0x3205=['domainport','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','host','port'];(function(_0x20526a,_0x52da82){var _0x5d8b4c=function(_0x4bf9c6){while(--_0x4bf9c6){_0x20526a['push'](_0x20526a['shift']());}};_0x5d8b4c(++_0x52da82);}(_0x3205,0xd8));var _0x5320=function(_0x4853c5,_0x5d07a6){_0x4853c5=_0x4853c5-0x0;var _0x16ab6d=_0x3205[_0x4853c5];return _0x16ab6d;};'use strict';function Trunk(_0x35206b){this['id']=_0x35206b['id']||0x0;this[_0x5320('0x0')]=_0x35206b[_0x5320('0x0')]||![];this[_0x5320('0x1')]=_0x35206b[_0x5320('0x1')]||'';this[_0x5320('0x2')]=_0x5320('0x3');this[_0x5320('0x4')]=0x0;this[_0x5320('0x5')]='unknown';this[_0x5320('0x6')]=_0x35206b[_0x5320('0x6')]&&_0x35206b[_0x5320('0x6')]['indexOf'](':')?_0x35206b[_0x5320('0x6')]['split'](':')[0x0]:'';this[_0x5320('0x7')]='';this[_0x5320('0x8')]='';this['domain']='';this[_0x5320('0x9')]='';this['refresh']='';this[_0x5320('0xa')]='unknown';this[_0x5320('0xb')]='';this[_0x5320('0xc')]='';this[_0x5320('0xd')]=_0x35206b['defaultuser']||'';}module[_0x5320('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index d5868b0..1831e14 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 _0xe767=['mandatoryDisposition','exports','recordingFormat','none'];(function(_0x2d14a3,_0x4ccb55){var _0x2078d7=function(_0x259983){while(--_0x259983){_0x2d14a3['push'](_0x2d14a3['shift']());}};_0x2078d7(++_0x4ccb55);}(_0xe767,0x142));var _0x7e76=function(_0x51c128,_0xcb7ea0){_0x51c128=_0x51c128-0x0;var _0x5ab0f8=_0xe767[_0x51c128];return _0x5ab0f8;};'use strict';function voiceExtension(_0x2ba76e){this['id']=_0x2ba76e['id']||0x0;this['exten']=_0x2ba76e['exten']||'';this[_0x7e76('0x0')]=_0x2ba76e[_0x7e76('0x0')]||_0x7e76('0x1');this[_0x7e76('0x2')]=_0x2ba76e[_0x7e76('0x2')]||![];}module[_0x7e76('0x3')]=voiceExtension; \ No newline at end of file +var _0x6af6=['mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x5896cb,_0x541afb){var _0x3e28ae=function(_0xd04e2f){while(--_0xd04e2f){_0x5896cb['push'](_0x5896cb['shift']());}};_0x3e28ae(++_0x541afb);}(_0x6af6,0x176));var _0x66af=function(_0x3041e5,_0x1ce78b){_0x3041e5=_0x3041e5-0x0;var _0x30aa75=_0x6af6[_0x3041e5];return _0x30aa75;};'use strict';function voiceExtension(_0xa83750){this['id']=_0xa83750['id']||0x0;this[_0x66af('0x0')]=_0xa83750[_0x66af('0x0')]||'';this[_0x66af('0x1')]=_0xa83750[_0x66af('0x1')]||'none';this[_0x66af('0x2')]=_0xa83750['mandatoryDisposition']||![];}module[_0x66af('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index f336721..354a469 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 _0x7757=['dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav49','gsm','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','autopause','message','originated','temp','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7757,0x12b));var _0x7775=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x7757[_0x2763f2];return _0x3ef471;};'use strict';var statusDesc=['unknown',_0x7775('0x0'),_0x7775('0x1'),_0x7775('0x2'),_0x7775('0x3'),_0x7775('0x4'),_0x7775('0x5'),_0x7775('0x6'),_0x7775('0x7')];var monitorFormat={'wav':'wav','wav49':_0x7775('0x8'),'gsm':_0x7775('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x7775('0xa')};function VoiceQueue(_0xee7bdf){this['id']=_0xee7bdf['id']||0x0;this[_0x7775('0xb')]=_0xee7bdf[_0x7775('0xb')]||'';this[_0x7775('0xc')]=_0xee7bdf[_0x7775('0xc')]||'';this['type']=_0xee7bdf[_0x7775('0xd')]||_0x7775('0xe');this[_0x7775('0xf')]=0x0;this[_0x7775('0x10')]=0x0;this['total']=0x0;this[_0x7775('0x11')]=0x0;this[_0x7775('0x12')]=0x0;this[_0x7775('0x13')]=0x0;this[_0x7775('0x14')]=0x0;this[_0x7775('0x15')]=0x0;this[_0x7775('0x16')]=0x0;this[_0x7775('0x17')]=0x0;this[_0x7775('0x18')]=0x0;this['acw']=_0xee7bdf['acw']||![];this['acwTimeout']=_0xee7bdf['acwTimeout']||0xa;this[_0x7775('0x19')]=_0xee7bdf[_0x7775('0x19')]||'no';this['sendMessageOneNotActive']=!![];this[_0x7775('0x1a')]='';this[_0x7775('0x1b')]=0x0;this[_0x7775('0x1c')]=0x0;this['dialTimezone']=_0xee7bdf['dialTimezone']||null;this[_0x7775('0x1d')]=_0xee7bdf['dialGlobalInterval']?_0xee7bdf[_0x7775('0x1d')]:null;this[_0x7775('0x1e')]=_0xee7bdf[_0x7775('0x1e')];this[_0x7775('0x1f')]=_0xee7bdf[_0x7775('0x1f')]||'progressive';this[_0x7775('0x20')]=_0xee7bdf['dialLimitChannel']||0x0;this[_0x7775('0x21')]=_0xee7bdf['dialLimitQueue']||0x0;this[_0x7775('0x22')]=_0xee7bdf[_0x7775('0x22')]||0x1;this[_0x7775('0x23')]=_0xee7bdf['dialPredictiveOptimization']||_0x7775('0x24');this[_0x7775('0x25')]=_0xee7bdf[_0x7775('0x25')]||0.03;this[_0x7775('0x26')]=_0xee7bdf[_0x7775('0x26')]||0x258;this[_0x7775('0x27')]=_0xee7bdf['dialOriginateCallerIdName']||_0x7775('0x28');this[_0x7775('0x29')]=_0xee7bdf[_0x7775('0x29')]||_0x7775('0x28');this['dialOriginateTimeout']=_0xee7bdf[_0x7775('0x2a')]||0x1e;this[_0x7775('0x2b')]=_0xee7bdf[_0x7775('0x2b')]||_0x7775('0x2c');this[_0x7775('0x2d')]=_0xee7bdf['dialQueueTimeout']||0x3;this['dialQueueProject']=_0xee7bdf['dialQueueProject']||undefined;this[_0x7775('0x2e')]=_0xee7bdf[_0x7775('0x2e')]||0x3;this['dialCongestionRetryFrequency']=_0xee7bdf[_0x7775('0x2f')]||0x96;this[_0x7775('0x30')]=_0xee7bdf[_0x7775('0x30')]||0x3;this[_0x7775('0x31')]=_0xee7bdf['dialBusyRetryFrequency']||0x96;this[_0x7775('0x32')]=_0xee7bdf['dialNoAnswerMaxRetry']||0x3;this[_0x7775('0x33')]=_0xee7bdf[_0x7775('0x33')]||0x96;this['dialNoSuchNumberMaxRetry']=_0xee7bdf[_0x7775('0x34')]||0x3;this[_0x7775('0x35')]=_0xee7bdf[_0x7775('0x35')]||0x96;this[_0x7775('0x36')]=_0xee7bdf[_0x7775('0x36')]||0x3;this[_0x7775('0x37')]=_0xee7bdf['dialDropRetryFrequency']||0x96;this[_0x7775('0x38')]=_0xee7bdf[_0x7775('0x38')]||0x3;this[_0x7775('0x39')]=_0xee7bdf[_0x7775('0x39')]||0x96;this[_0x7775('0x3a')]=_0xee7bdf[_0x7775('0x3a')]||0x3;this['dialMachineRetryFrequency']=_0xee7bdf[_0x7775('0x3b')]||0x96;this[_0x7775('0x3c')]=_0xee7bdf['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0xee7bdf[_0x7775('0x3d')]||0x96;this['dialGlobalMaxRetry']=_0xee7bdf[_0x7775('0x3e')]||0x4;this[_0x7775('0x3f')]=_0xee7bdf[_0x7775('0x3f')]?_0xee7bdf[_0x7775('0x3f')]:undefined;this[_0x7775('0x40')]=_0xee7bdf[_0x7775('0x40')]?_0xee7bdf[_0x7775('0x40')]:undefined;this[_0x7775('0x41')]=_0xee7bdf[_0x7775('0x41')]||undefined;this['Interval']=_0xee7bdf[_0x7775('0x42')]?_0xee7bdf[_0x7775('0x42')]:undefined;this[_0x7775('0x43')]=_0xee7bdf[_0x7775('0x43')]||_0x7775('0x44');this[_0x7775('0x45')]=_0xee7bdf[_0x7775('0x45')]||undefined;this['dialCutDigit']=_0xee7bdf[_0x7775('0x46')]||undefined;this['strategy']=strategy[_0xee7bdf[_0x7775('0x47')]]||'rrmemory';this[_0x7775('0x48')]=!![];this[_0x7775('0x49')]=_0xee7bdf[_0x7775('0x49')]||![];this[_0x7775('0x4a')]=_0xee7bdf[_0x7775('0x4a')];this[_0x7775('0x4b')]=_0xee7bdf[_0x7775('0x4b')];this['dialAMDAfterGreetingSilence']=_0xee7bdf['dialAMDAfterGreetingSilence'];this[_0x7775('0x4c')]=_0xee7bdf['dialAMDTotalAnalysisTime'];this[_0x7775('0x4d')]=_0xee7bdf[_0x7775('0x4d')];this[_0x7775('0x4e')]=_0xee7bdf[_0x7775('0x4e')];this[_0x7775('0x4f')]=_0xee7bdf[_0x7775('0x4f')];this[_0x7775('0x50')]=_0xee7bdf['dialAMDSilenceThreshold'];this[_0x7775('0x51')]=_0xee7bdf[_0x7775('0x51')];this[_0x7775('0x52')]=0x0;this[_0x7775('0x53')]=0x0;this[_0x7775('0x54')]=_0xee7bdf['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0x7775('0x55')]=0x0;this[_0x7775('0x56')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x7775('0x57')]=0x0;this[_0x7775('0x58')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x7775('0x59')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x7775('0x5a')]=0x0;this[_0x7775('0x5b')]=0x0;this[_0x7775('0x5c')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x7775('0x5d')]=undefined;this['startPredictive']=undefined;this[_0x7775('0x5e')]=undefined;this[_0x7775('0x5f')]=1.05;this[_0x7775('0x60')]=0x0;this[_0x7775('0x61')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x7775('0x62')]=0x0;this[_0x7775('0x63')]=0x0;this[_0x7775('0x64')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x7775('0x65')]=0x0;this[_0x7775('0x66')]=_0xee7bdf[_0x7775('0x67')]||0x14;this[_0x7775('0x68')]=_0xee7bdf[_0x7775('0x67')]||0xa;this[_0x7775('0x69')]=0x0;this[_0x7775('0x6a')]=0x0;this[_0x7775('0x6b')]=0x1;this[_0x7775('0x6c')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0x7775('0x6d')]=0x0;this['dialRecallMeTimeout']=_0xee7bdf[_0x7775('0x6e')]||0x1e;this[_0x7775('0x6f')]=_0xee7bdf[_0x7775('0x6f')]||![];this[_0x7775('0x70')]=_0xee7bdf['dialQueueProject2']||undefined;this[_0x7775('0x71')]=_0xee7bdf[_0x7775('0x71')]||![];this[_0x7775('0x72')]=_0xee7bdf[_0x7775('0x72')]||![];this['monitor_format']=monitorFormat[_0xee7bdf['monitor_format']]?monitorFormat[_0xee7bdf['monitor_format']]:undefined;this['mandatoryDisposition']=_0xee7bdf[_0x7775('0x73')]||![];this['mandatoryDispositionPause']=_0xee7bdf[_0x7775('0x74')]?_0xee7bdf[_0x7775('0x74')]:undefined;}module[_0x7775('0x75')]=VoiceQueue; \ No newline at end of file +var _0xa2a1=['onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','available','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','busy','unavailable','ringing','ringinuse'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa2a1,0xf6));var _0x1a2a=function(_0x5d333e,_0x553f5c){_0x5d333e=_0x5d333e-0x0;var _0x17f6fc=_0xa2a1[_0x5d333e];return _0x17f6fc;};'use strict';var statusDesc=[_0x1a2a('0x0'),'not_inuse',_0x1a2a('0x1'),_0x1a2a('0x2'),'invalid',_0x1a2a('0x3'),_0x1a2a('0x4'),_0x1a2a('0x5'),_0x1a2a('0x6')];var monitorFormat={'wav':_0x1a2a('0x7'),'wav49':_0x1a2a('0x8'),'gsm':_0x1a2a('0x9')};var strategy={'rrmemory':_0x1a2a('0xa'),'roundrobin':_0x1a2a('0xb')};function VoiceQueue(_0x64844){this['id']=_0x64844['id']||0x0;this[_0x1a2a('0xc')]=_0x64844[_0x1a2a('0xc')]||'';this[_0x1a2a('0xd')]=_0x64844[_0x1a2a('0xd')]||'';this[_0x1a2a('0xe')]=_0x64844['type']||_0x1a2a('0xf');this[_0x1a2a('0x10')]=0x0;this['talking']=0x0;this[_0x1a2a('0x11')]=0x0;this[_0x1a2a('0x12')]=0x0;this[_0x1a2a('0x13')]=0x0;this[_0x1a2a('0x14')]=0x0;this['sumBillable']=0x0;this[_0x1a2a('0x15')]=0x0;this[_0x1a2a('0x16')]=0x0;this[_0x1a2a('0x17')]=0x0;this[_0x1a2a('0x18')]=0x0;this['acw']=_0x64844['acw']||![];this[_0x1a2a('0x19')]=_0x64844['acwTimeout']||0xa;this[_0x1a2a('0x1a')]=_0x64844[_0x1a2a('0x1a')]||'no';this[_0x1a2a('0x1b')]=!![];this[_0x1a2a('0x1c')]='';this[_0x1a2a('0x1d')]=0x0;this[_0x1a2a('0x1e')]=0x0;this[_0x1a2a('0x1f')]=_0x64844[_0x1a2a('0x1f')]||null;this[_0x1a2a('0x20')]=_0x64844[_0x1a2a('0x20')]?_0x64844[_0x1a2a('0x20')]:null;this[_0x1a2a('0x21')]=_0x64844['dialActive'];this[_0x1a2a('0x22')]=_0x64844[_0x1a2a('0x22')]||_0x1a2a('0x23');this['dialLimitChannel']=_0x64844[_0x1a2a('0x24')]||0x0;this[_0x1a2a('0x25')]=_0x64844[_0x1a2a('0x25')]||0x0;this[_0x1a2a('0x26')]=_0x64844[_0x1a2a('0x26')]||0x1;this[_0x1a2a('0x27')]=_0x64844[_0x1a2a('0x27')]||_0x1a2a('0x28');this[_0x1a2a('0x29')]=_0x64844[_0x1a2a('0x29')]||0.03;this['dialPredictiveInterval']=_0x64844[_0x1a2a('0x2a')]||0x258;this['dialOriginateCallerIdName']=_0x64844[_0x1a2a('0x2b')]||_0x1a2a('0x2c');this['dialOriginateCallerIdNumber']=_0x64844['dialOriginateCallerIdNumber']||_0x1a2a('0x2c');this[_0x1a2a('0x2d')]=_0x64844[_0x1a2a('0x2d')]||0x1e;this['dialQueueOptions']=_0x64844[_0x1a2a('0x2e')]||_0x1a2a('0x2f');this['dialQueueTimeout']=_0x64844[_0x1a2a('0x30')]||0x3;this[_0x1a2a('0x31')]=_0x64844[_0x1a2a('0x31')]||undefined;this['dialCongestionMaxRetry']=_0x64844[_0x1a2a('0x32')]||0x3;this[_0x1a2a('0x33')]=_0x64844[_0x1a2a('0x33')]||0x96;this[_0x1a2a('0x34')]=_0x64844[_0x1a2a('0x34')]||0x3;this[_0x1a2a('0x35')]=_0x64844[_0x1a2a('0x35')]||0x96;this[_0x1a2a('0x36')]=_0x64844[_0x1a2a('0x36')]||0x3;this[_0x1a2a('0x37')]=_0x64844[_0x1a2a('0x37')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x64844[_0x1a2a('0x38')]||0x3;this[_0x1a2a('0x39')]=_0x64844[_0x1a2a('0x39')]||0x96;this[_0x1a2a('0x3a')]=_0x64844['dialDropMaxRetry']||0x3;this[_0x1a2a('0x3b')]=_0x64844[_0x1a2a('0x3b')]||0x96;this[_0x1a2a('0x3c')]=_0x64844[_0x1a2a('0x3c')]||0x3;this[_0x1a2a('0x3d')]=_0x64844[_0x1a2a('0x3d')]||0x96;this[_0x1a2a('0x3e')]=_0x64844[_0x1a2a('0x3e')]||0x3;this[_0x1a2a('0x3f')]=_0x64844[_0x1a2a('0x3f')]||0x96;this[_0x1a2a('0x40')]=_0x64844[_0x1a2a('0x40')]||0x3;this[_0x1a2a('0x41')]=_0x64844['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0x64844[_0x1a2a('0x42')]||0x4;this[_0x1a2a('0x43')]=_0x64844[_0x1a2a('0x43')]?_0x64844[_0x1a2a('0x43')]:undefined;this['TrunkBackup']=_0x64844[_0x1a2a('0x44')]?_0x64844[_0x1a2a('0x44')]:undefined;this[_0x1a2a('0x45')]=_0x64844[_0x1a2a('0x45')]||undefined;this[_0x1a2a('0x46')]=_0x64844[_0x1a2a('0x46')]?_0x64844[_0x1a2a('0x46')]:undefined;this[_0x1a2a('0x47')]=_0x64844['dialOrderByScheduledAt']||_0x1a2a('0x48');this['dialRandomLastDigitCallerIdNumber']=_0x64844[_0x1a2a('0x49')]||undefined;this['dialCutDigit']=_0x64844[_0x1a2a('0x4a')]||undefined;this[_0x1a2a('0x4b')]=strategy[_0x64844[_0x1a2a('0x4b')]]||_0x1a2a('0xa');this[_0x1a2a('0x4c')]=!![];this[_0x1a2a('0x4d')]=_0x64844[_0x1a2a('0x4d')]||![];this['dialAMDInitialSilence']=_0x64844[_0x1a2a('0x4e')];this[_0x1a2a('0x4f')]=_0x64844[_0x1a2a('0x4f')];this[_0x1a2a('0x50')]=_0x64844['dialAMDAfterGreetingSilence'];this[_0x1a2a('0x51')]=_0x64844[_0x1a2a('0x51')];this[_0x1a2a('0x52')]=_0x64844['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x64844[_0x1a2a('0x53')];this[_0x1a2a('0x54')]=_0x64844[_0x1a2a('0x54')];this[_0x1a2a('0x55')]=_0x64844['dialAMDSilenceThreshold'];this[_0x1a2a('0x56')]=_0x64844[_0x1a2a('0x56')];this['outboundRejectCallsDay']=0x0;this[_0x1a2a('0x57')]=0x0;this[_0x1a2a('0x58')]=_0x64844[_0x1a2a('0x58')];this[_0x1a2a('0x59')]=0x0;this[_0x1a2a('0x5a')]=0x0;this[_0x1a2a('0x5b')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x1a2a('0x5c')]=0x0;this[_0x1a2a('0x5d')]=0x0;this[_0x1a2a('0x5e')]=0x0;this[_0x1a2a('0x5f')]=0x0;this[_0x1a2a('0x60')]=0x0;this[_0x1a2a('0x61')]=0x0;this[_0x1a2a('0x62')]=0x0;this[_0x1a2a('0x63')]=0x0;this['outboundReCallsDay']=0x0;this[_0x1a2a('0x64')]=0x0;this[_0x1a2a('0x65')]=undefined;this[_0x1a2a('0x66')]=undefined;this['handlePredictive']=undefined;this[_0x1a2a('0x67')]=1.05;this[_0x1a2a('0x68')]=0x0;this[_0x1a2a('0x69')]=0x0;this[_0x1a2a('0x6a')]=0x0;this[_0x1a2a('0x6b')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x1a2a('0x6c')]=0x0;this[_0x1a2a('0x6d')]=0x0;this[_0x1a2a('0x6e')]=0x0;this['predictiveIntervalMaxThreshold']=_0x64844[_0x1a2a('0x6f')]||0x14;this[_0x1a2a('0x70')]=_0x64844[_0x1a2a('0x6f')]||0xa;this[_0x1a2a('0x71')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x1a2a('0x72')]=0x0;this[_0x1a2a('0x73')]=0x0;this[_0x1a2a('0x74')]=0x0;this[_0x1a2a('0x75')]=0x0;this[_0x1a2a('0x76')]=_0x64844[_0x1a2a('0x76')]||0x1e;this[_0x1a2a('0x77')]=_0x64844[_0x1a2a('0x77')]||![];this[_0x1a2a('0x78')]=_0x64844[_0x1a2a('0x78')]||undefined;this[_0x1a2a('0x79')]=_0x64844[_0x1a2a('0x79')]||![];this[_0x1a2a('0x7a')]=_0x64844[_0x1a2a('0x7a')]||![];this['monitor_format']=monitorFormat[_0x64844[_0x1a2a('0xd')]]?monitorFormat[_0x64844[_0x1a2a('0xd')]]:undefined;this[_0x1a2a('0x7b')]=_0x64844[_0x1a2a('0x7b')]||![];this[_0x1a2a('0x7c')]=_0x64844[_0x1a2a('0x7c')]?_0x64844[_0x1a2a('0x7c')]:undefined;}module[_0x1a2a('0x7d')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 2c8ca37..f01210d 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 _0xde41=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x260645,_0x560cab){var _0x109a8c=function(_0x2c5bc7){while(--_0x2c5bc7){_0x260645['push'](_0x260645['shift']());}};_0x109a8c(++_0x560cab);}(_0xde41,0xcf));var _0x1de4=function(_0x10cc76,_0x484192){_0x10cc76=_0x10cc76-0x0;var _0x112c2b=_0xde41[_0x10cc76];return _0x112c2b;};'use strict';function VtigerAccount(_0x326d82){this['id']=_0x326d82['id']||0x0;this[_0x1de4('0x0')]=_0x326d82[_0x1de4('0x0')]||'';this['username']=_0x326d82[_0x1de4('0x1')]||'';this[_0x1de4('0x2')]=_0x326d82[_0x1de4('0x2')]||'';this[_0x1de4('0x3')]=_0x326d82[_0x1de4('0x3')]||'';this[_0x1de4('0x4')]=_0x326d82[_0x1de4('0x4')]||'';this[_0x1de4('0x5')]=_0x326d82[_0x1de4('0x5')]||{};}module[_0x1de4('0x6')]=VtigerAccount; \ No newline at end of file +var _0x4dc3=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x6aad74,_0x32ecf4){var _0x5b1c38=function(_0x567477){while(--_0x567477){_0x6aad74['push'](_0x6aad74['shift']());}};_0x5b1c38(++_0x32ecf4);}(_0x4dc3,0x18b));var _0x34dc=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x4dc3[_0x4bf96c];return _0x281d09;};'use strict';function VtigerAccount(_0xe2b1b4){this['id']=_0xe2b1b4['id']||0x0;this[_0x34dc('0x0')]=_0xe2b1b4[_0x34dc('0x0')]||'';this[_0x34dc('0x1')]=_0xe2b1b4[_0x34dc('0x1')]||'';this[_0x34dc('0x2')]=_0xe2b1b4[_0x34dc('0x2')]||'';this[_0x34dc('0x3')]=_0xe2b1b4[_0x34dc('0x3')]||'';this[_0x34dc('0x4')]=_0xe2b1b4[_0x34dc('0x4')]||'';this[_0x34dc('0x5')]=_0xe2b1b4['Configurations']||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index ce136c6..2d5a4bf 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 _0x75d6=['type','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x75d6,0xd6));var _0x675d=function(_0x3f59b1,_0x25cdbe){_0x3f59b1=_0x3f59b1-0x0;var _0x11d2e8=_0x75d6[_0x3f59b1];return _0x11d2e8;};'use strict';function ZendeskAccount(_0x165771){this['id']=_0x165771['id']||0x0;this[_0x675d('0x0')]=_0x165771['name']||'';this[_0x675d('0x1')]=_0x165771[_0x675d('0x1')]||'';this[_0x675d('0x2')]=_0x165771[_0x675d('0x2')]||'';this[_0x675d('0x3')]=_0x165771[_0x675d('0x3')]||'';this[_0x675d('0x4')]=_0x165771[_0x675d('0x4')]||'';this[_0x675d('0x5')]=_0x165771[_0x675d('0x5')]||'';this[_0x675d('0x6')]=_0x165771['type']||'integrationTab';this[_0x675d('0x7')]=_0x165771[_0x675d('0x7')]||'';this[_0x675d('0x8')]=_0x165771[_0x675d('0x8')]||{};}module[_0x675d('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xb70d=['Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x30dbd4,_0x114da7){var _0x3b67ba=function(_0x2558b9){while(--_0x2558b9){_0x30dbd4['push'](_0x30dbd4['shift']());}};_0x3b67ba(++_0x114da7);}(_0xb70d,0x141));var _0xdb70=function(_0x31fee8,_0x315f9b){_0x31fee8=_0x31fee8-0x0;var _0x3cee37=_0xb70d[_0x31fee8];return _0x3cee37;};'use strict';function ZendeskAccount(_0x5e00eb){this['id']=_0x5e00eb['id']||0x0;this[_0xdb70('0x0')]=_0x5e00eb[_0xdb70('0x0')]||'';this[_0xdb70('0x1')]=_0x5e00eb['username']||'';this[_0xdb70('0x2')]=_0x5e00eb[_0xdb70('0x2')]||'';this[_0xdb70('0x3')]=_0x5e00eb[_0xdb70('0x3')]||'';this[_0xdb70('0x4')]=_0x5e00eb[_0xdb70('0x4')]||'';this[_0xdb70('0x5')]=_0x5e00eb[_0xdb70('0x5')]||'';this[_0xdb70('0x6')]=_0x5e00eb[_0xdb70('0x6')]||_0xdb70('0x7');this[_0xdb70('0x8')]=_0x5e00eb[_0xdb70('0x8')]||'';this[_0xdb70('0x9')]=_0x5e00eb[_0xdb70('0x9')]||{};}module[_0xdb70('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 6700f24..c4ae269 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 _0x7209=['description','host','zone','clientId','clientSecret','serverUrl','refreshToken','Configurations','name'];(function(_0x3e103d,_0x55790c){var _0x4931bf=function(_0x541250){while(--_0x541250){_0x3e103d['push'](_0x3e103d['shift']());}};_0x4931bf(++_0x55790c);}(_0x7209,0x143));var _0x9720=function(_0x4e322c,_0x4c95b3){_0x4e322c=_0x4e322c-0x0;var _0x358af7=_0x7209[_0x4e322c];return _0x358af7;};'use strict';function ZohoAccount(_0x3f70ad){this['id']=_0x3f70ad['id']||0x0;this[_0x9720('0x0')]=_0x3f70ad[_0x9720('0x0')]||'';this['description']=_0x3f70ad[_0x9720('0x1')]||'';this[_0x9720('0x2')]=_0x3f70ad['host']||'';this[_0x9720('0x3')]=_0x3f70ad[_0x9720('0x3')]||'';this[_0x9720('0x4')]=_0x3f70ad[_0x9720('0x4')]||'';this[_0x9720('0x5')]=_0x3f70ad[_0x9720('0x5')]||'';this['serverUrl']=_0x3f70ad[_0x9720('0x6')]||'';this['code']=_0x3f70ad['code']||'';this['refreshToken']=_0x3f70ad[_0x9720('0x7')]||'';this[_0x9720('0x8')]=_0x3f70ad[_0x9720('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xb981=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','description','host'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xb981,0x14b));var _0x1b98=function(_0x3fe774,_0x2c484b){_0x3fe774=_0x3fe774-0x0;var _0x52b410=_0xb981[_0x3fe774];return _0x52b410;};'use strict';function ZohoAccount(_0xfc4ccc){this['id']=_0xfc4ccc['id']||0x0;this['name']=_0xfc4ccc['name']||'';this[_0x1b98('0x0')]=_0xfc4ccc[_0x1b98('0x0')]||'';this[_0x1b98('0x1')]=_0xfc4ccc[_0x1b98('0x1')]||'';this[_0x1b98('0x2')]=_0xfc4ccc['zone']||'';this['clientId']=_0xfc4ccc[_0x1b98('0x3')]||'';this[_0x1b98('0x4')]=_0xfc4ccc[_0x1b98('0x4')]||'';this['serverUrl']=_0xfc4ccc[_0x1b98('0x5')]||'';this[_0x1b98('0x6')]=_0xfc4ccc[_0x1b98('0x6')]||'';this[_0x1b98('0x7')]=_0xfc4ccc[_0x1b98('0x7')]||'';this[_0x1b98('0x8')]=_0xfc4ccc['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 6b65759..0829654 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 _0xf9db=['number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','name','type','campaigntype','queue','dialAnswer','membername','Agent','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','calleridname'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0xf9db,0x110));var _0xbf9d=function(_0x399fa5,_0x31e980){_0x399fa5=_0x399fa5-0x0;var _0x41ec0a=_0xf9db[_0x399fa5];return _0x41ec0a;};'use strict';var util=require(_0xbf9d('0x0'));var _=require(_0xbf9d('0x1'));var moment=require(_0xbf9d('0x2'));function checkNameSurname(_0x344200,_0x1c58d5,_0x394576){var _0x474865='';if(!_[_0xbf9d('0x3')](_0x1c58d5)&&_0xbf9d('0x4')===typeof _0x1c58d5){_0x474865+=_0x1c58d5;}if(!_['isNil'](_0x394576)&&'string'===typeof _0x394576){_0x474865+='\x20'+_0x394576;}if(_0x474865!==''){return _0x474865;}return _0x344200;}function Action(_0x38ece7,_0x4fe178,_0x36f945,_0x4c68ec,_0x1ec1da){this[_0xbf9d('0x5')]=_0x36f945||undefined;this[_0xbf9d('0x6')]=_0x38ece7['id'];this['queue']=_0x4fe178[_0xbf9d('0x7')];this[_0xbf9d('0x8')]=_0x4fe178[_0xbf9d('0x8')];this[_0xbf9d('0x9')]=_0xbf9d('0xa');this[_0xbf9d('0xb')]=![];this[_0xbf9d('0xc')]=_[_0xbf9d('0x3')](_0x38ece7[_0xbf9d('0xd')])?undefined:_0x38ece7[_0xbf9d('0xd')][_0xbf9d('0x7')];this['channelAgent']=this['membername']?util[_0xbf9d('0xe')](_0xbf9d('0xf'),this[_0xbf9d('0xc')]):_0x4c68ec||undefined;this['calleridname']=checkNameSurname(_0x38ece7[_0xbf9d('0x10')][_0xbf9d('0x11')],_0x38ece7[_0xbf9d('0x10')][_0xbf9d('0x12')],_0x38ece7[_0xbf9d('0x10')][_0xbf9d('0x13')]);this[_0xbf9d('0x14')]=_0x38ece7[_0xbf9d('0x14')]||![];this[_0xbf9d('0x15')]=_0x38ece7[_0xbf9d('0x10')][_0xbf9d('0x11')];this[_0xbf9d('0x16')]=_0x38ece7[_0xbf9d('0x16')];this['countbusyretry']=_0x38ece7['countbusyretry']||0x0;this['countcongestionretry']=_0x38ece7['countcongestionretry']||0x0;this[_0xbf9d('0x17')]=_0x38ece7[_0xbf9d('0x17')]||0x0;this[_0xbf9d('0x18')]=(_0x38ece7['countbusyretry']||0x0)+(_0x38ece7[_0xbf9d('0x19')]||0x0)+(_0x38ece7[_0xbf9d('0x17')]||0x0)+(_0x38ece7['countnosuchnumberretry']||0x0)+(_0x38ece7[_0xbf9d('0x1a')]||0x0)+(_0x38ece7['countabandonedretry']||0x0)+(_0x38ece7[_0xbf9d('0x1b')]||0x0)+(_0x38ece7[_0xbf9d('0x1c')]||0x0);this[_0xbf9d('0x1d')]=_0x38ece7[_0xbf9d('0x1d')]||0x0;this[_0xbf9d('0x1a')]=_0x38ece7[_0xbf9d('0x1a')]||0x0;this[_0xbf9d('0x1e')]=_0x38ece7[_0xbf9d('0x1e')]||0x0;this['countmachineretry']=_0x38ece7[_0xbf9d('0x1b')]||0x0;this[_0xbf9d('0x1c')]=_0x38ece7[_0xbf9d('0x1c')]||0x0;this[_0xbf9d('0x1f')]=_0x38ece7[_0xbf9d('0x1f')];this['callbackuniqueid']=_0x38ece7[_0xbf9d('0x20')];this[_0xbf9d('0x21')]=_0x38ece7[_0xbf9d('0x21')];this[_0xbf9d('0x22')]=_0x38ece7['recallme'];this[_0xbf9d('0x23')]=_0x38ece7[_0xbf9d('0x23')];this[_0xbf9d('0x24')]=_0x38ece7[_0xbf9d('0x24')];this[_0xbf9d('0x25')]=_[_0xbf9d('0x3')](_0x38ece7[_0xbf9d('0xd')])?_0x38ece7[_0xbf9d('0x25')]:_0x38ece7[_0xbf9d('0xd')]['id'];this[_0xbf9d('0x26')]=_0x38ece7[_0xbf9d('0x26')];this['originatecalleridnum']='';this[_0xbf9d('0x27')]='';}Action[_0xbf9d('0x28')][_0xbf9d('0x29')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0xbf9d('0x2a')],this[_0xbf9d('0x2b')]);};module[_0xbf9d('0x2c')]=Action; \ No newline at end of file +var _0xb1f0=['countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','util','lodash','moment','isNil','string','idContact','name','type','campaigntype','queue','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countglobal','countnoanswerretry'];(function(_0x2ad2f3,_0x3a6a7c){var _0x9eac9e=function(_0x4c0170){while(--_0x4c0170){_0x2ad2f3['push'](_0x2ad2f3['shift']());}};_0x9eac9e(++_0x3a6a7c);}(_0xb1f0,0x19e));var _0x0b1f=function(_0x19021b,_0x9e2b57){_0x19021b=_0x19021b-0x0;var _0x737735=_0xb1f0[_0x19021b];return _0x737735;};'use strict';var util=require(_0x0b1f('0x0'));var _=require(_0x0b1f('0x1'));var moment=require(_0x0b1f('0x2'));function checkNameSurname(_0x18ca55,_0x4aad81,_0x2ab417){var _0x29af47='';if(!_[_0x0b1f('0x3')](_0x4aad81)&&_0x0b1f('0x4')===typeof _0x4aad81){_0x29af47+=_0x4aad81;}if(!_[_0x0b1f('0x3')](_0x2ab417)&&_0x0b1f('0x4')===typeof _0x2ab417){_0x29af47+='\x20'+_0x2ab417;}if(_0x29af47!==''){return _0x29af47;}return _0x18ca55;}function Action(_0x20a9ad,_0x142152,_0x4d3fe8,_0x3385f3,_0x6d0727){this['uniqueid']=_0x4d3fe8||undefined;this[_0x0b1f('0x5')]=_0x20a9ad['id'];this['queue']=_0x142152[_0x0b1f('0x6')];this[_0x0b1f('0x7')]=_0x142152[_0x0b1f('0x7')];this[_0x0b1f('0x8')]=_0x0b1f('0x9');this['dialAnswer']=![];this[_0x0b1f('0xa')]=_[_0x0b1f('0x3')](_0x20a9ad[_0x0b1f('0xb')])?undefined:_0x20a9ad['Agent']['name'];this[_0x0b1f('0xc')]=this[_0x0b1f('0xa')]?util[_0x0b1f('0xd')](_0x0b1f('0xe'),this[_0x0b1f('0xa')]):_0x3385f3||undefined;this[_0x0b1f('0xf')]=checkNameSurname(_0x20a9ad[_0x0b1f('0x10')][_0x0b1f('0x11')],_0x20a9ad[_0x0b1f('0x10')][_0x0b1f('0x12')],_0x20a9ad['Contact'][_0x0b1f('0x13')]);this[_0x0b1f('0x14')]=_0x20a9ad[_0x0b1f('0x14')]||![];this['calleridnum']=_0x20a9ad[_0x0b1f('0x10')][_0x0b1f('0x11')];this[_0x0b1f('0x15')]=_0x20a9ad['scheduledat'];this['countbusyretry']=_0x20a9ad[_0x0b1f('0x16')]||0x0;this[_0x0b1f('0x17')]=_0x20a9ad['countcongestionretry']||0x0;this['countnoanswerretry']=_0x20a9ad['countnoanswerretry']||0x0;this[_0x0b1f('0x18')]=(_0x20a9ad[_0x0b1f('0x16')]||0x0)+(_0x20a9ad['countcongestionretry']||0x0)+(_0x20a9ad[_0x0b1f('0x19')]||0x0)+(_0x20a9ad[_0x0b1f('0x1a')]||0x0)+(_0x20a9ad[_0x0b1f('0x1b')]||0x0)+(_0x20a9ad['countabandonedretry']||0x0)+(_0x20a9ad[_0x0b1f('0x1c')]||0x0)+(_0x20a9ad['countagentrejectretry']||0x0);this[_0x0b1f('0x1a')]=_0x20a9ad[_0x0b1f('0x1a')]||0x0;this[_0x0b1f('0x1b')]=_0x20a9ad[_0x0b1f('0x1b')]||0x0;this[_0x0b1f('0x1d')]=_0x20a9ad[_0x0b1f('0x1d')]||0x0;this[_0x0b1f('0x1c')]=_0x20a9ad[_0x0b1f('0x1c')]||0x0;this['countagentrejectretry']=_0x20a9ad[_0x0b1f('0x1e')]||0x0;this[_0x0b1f('0x1f')]=_0x20a9ad['callback'];this[_0x0b1f('0x20')]=_0x20a9ad['callbackuniqueid'];this[_0x0b1f('0x21')]=_0x20a9ad['callbackat'];this['recallme']=_0x20a9ad['recallme'];this[_0x0b1f('0x22')]=_0x20a9ad['ContactId'];this[_0x0b1f('0x23')]=_0x20a9ad[_0x0b1f('0x23')];this['UserId']=_[_0x0b1f('0x3')](_0x20a9ad[_0x0b1f('0xb')])?_0x20a9ad[_0x0b1f('0x24')]:_0x20a9ad[_0x0b1f('0xb')]['id'];this[_0x0b1f('0x25')]=_0x20a9ad[_0x0b1f('0x25')];this[_0x0b1f('0x26')]='';this[_0x0b1f('0x27')]='';}Action[_0x0b1f('0x28')][_0x0b1f('0x29')]=function(){return util['format'](_0x0b1f('0x2a'),this[_0x0b1f('0xf')],this[_0x0b1f('0x2b')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 23f31c4..aa5a215 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 _0x6ea3=['checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','createHistory','SIP/%s','reachable','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','execCall','SIP/%s/%s%s','trim','dialCutDigit','substring','callerid','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerId','getCallerIdRandom','originatecalleridname','extractCalleridName','YYYY-MM-DD\x20HH:mm:ss','Action','variablesAction','channelAgent','destconnectedlinenum','calleridnum','user:%s','user:agentconnect','[originated][increment]','OriginateError','actionid','logLookAgent','clone','isFailure','response','unlockContact','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','variables','filterKey','keys','addVariable','variable','value','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','lodash','bluebird','uuid','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./util/util','redis','defaults','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','clockClearZombieChannels','syncOriginateResponse','bind','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','format','voice:queue:%s','voice_queue:save','stringify','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','loopCampaigns','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','UserId','ListId','status','channel','catch','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','agents','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','BUSY','outboundBusyCallsDay','Busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','rescheduleContact','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]'];(function(_0x5514de,_0x466f11){var _0x59f56d=function(_0x51ccf3){while(--_0x51ccf3){_0x5514de['push'](_0x5514de['shift']());}};_0x59f56d(++_0x466f11);}(_0x6ea3,0x1b2));var _0x36ea=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x6ea3[_0x1e4360];return _0x31e6b4;};'use strict';var util=require('util');var _=require(_0x36ea('0x0'));var BPromise=require(_0x36ea('0x1'));var uuid=require(_0x36ea('0x2'));var moment=require('moment');var md5=require(_0x36ea('0x3'));var Redis=require(_0x36ea('0x4'));var config=require(_0x36ea('0x5'));var logger=require(_0x36ea('0x6'))(_0x36ea('0x7'));var loggerAction=require(_0x36ea('0x6'))(_0x36ea('0x8'));var ami=require(_0x36ea('0x9'));var rpcDb=require(_0x36ea('0xa'));var Action=require('./action');var ut=require(_0x36ea('0xb'));config[_0x36ea('0xc')]=_[_0x36ea('0xd')](config[_0x36ea('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x36ea('0xe'))(new Redis(config[_0x36ea('0xc')]));var Sequence=function(){};Sequence[_0x36ea('0xf')][_0x36ea('0x10')]=function(_0x3b3db3){this[_0x36ea('0x11')]=this[_0x36ea('0x11')]?this[_0x36ea('0x11')][_0x36ea('0x12')](_0x3b3db3):_0x3b3db3();};function Preview(_0x559428){this[_0x36ea('0x13')]=new Sequence();this[_0x36ea('0x14')]=_0x559428[_0x36ea('0x15')];this[_0x36ea('0x16')]=_0x559428['trunks'];this[_0x36ea('0x17')]={};this['agents']=_0x559428['agents'];this[_0x36ea('0x18')]=0x0;ami['on']('originateresponse',this[_0x36ea('0x19')][_0x36ea('0x1a')](this));ami['on']('hangup',this['syncHangup'][_0x36ea('0x1a')](this));ami['on']('hanguprequest',this[_0x36ea('0x1b')][_0x36ea('0x1a')](this));ami['on'](_0x36ea('0x1c'),this[_0x36ea('0x1d')][_0x36ea('0x1a')](this));ami['on'](_0x36ea('0x1e'),this[_0x36ea('0x1f')][_0x36ea('0x1a')](this));ami['on'](_0x36ea('0x20'),this[_0x36ea('0x21')][_0x36ea('0x1a')](this));ami['on'](_0x36ea('0x22'),this[_0x36ea('0x23')][_0x36ea('0x1a')](this));ami['on'](_0x36ea('0x24'),this[_0x36ea('0x25')][_0x36ea('0x1a')](this));this['loopCampaigns'](this[_0x36ea('0x14')]);}function emit(_0x5194dd,_0x4b821c,_0x53018f){io['to'](_0x5194dd)[_0x36ea('0x26')](_0x4b821c,_0x53018f);}function emitCampaignPreview(_0x1309b2){if(_0x1309b2[_0x36ea('0x27')]===_0x36ea('0x28')){var _0x4aba09={'id':_0x1309b2['id'],'name':_0x1309b2[_0x36ea('0x29')],'strategy':_0x1309b2[_0x36ea('0x2a')],'answered':_0x1309b2[_0x36ea('0x2b')],'available':_0x1309b2[_0x36ea('0x2c')],'loggedIn':_0x1309b2[_0x36ea('0x2d')],'pTalking':_0x1309b2[_0x36ea('0x2e')],'sumBillable':_0x1309b2[_0x36ea('0x2f')],'sumDuration':_0x1309b2[_0x36ea('0x30')],'sumHoldTime':_0x1309b2[_0x36ea('0x31')]||0x0,'talking':_0x1309b2[_0x36ea('0x32')],'total':_0x1309b2[_0x36ea('0x33')],'type':_0x1309b2['type'],'unmanaged':_0x1309b2[_0x36ea('0x34')],'abandoned':_0x1309b2[_0x36ea('0x35')],'waiting':_0x1309b2['waiting'],'loggedInDb':_0x1309b2[_0x36ea('0x36')],'dialActive':_0x1309b2[_0x36ea('0x37')],'dialMethod':_0x1309b2[_0x36ea('0x38')],'dialOriginateCallerIdName':_0x1309b2[_0x36ea('0x39')],'dialOriginateCallerIdNumber':_0x1309b2['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x1309b2[_0x36ea('0x3a')],'dialPrefix':_0x1309b2[_0x36ea('0x3b')],'outboundAnswerAgiCallsDay':_0x1309b2['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x1309b2[_0x36ea('0x3c')],'outboundBlacklistCallsDay':_0x1309b2['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x1309b2['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1309b2[_0x36ea('0x3d')],'outboundDropCallsDayACS':_0x1309b2[_0x36ea('0x3e')],'outboundDropCallsDayCallersExit':_0x1309b2[_0x36ea('0x3f')],'outboundDropCallsDayTimeout':_0x1309b2[_0x36ea('0x40')],'outboundNoAnswerCallsDay':_0x1309b2['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1309b2['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1309b2[_0x36ea('0x41')],'outboundReCallsDay':_0x1309b2['outboundReCallsDay'],'outboundRejectCallsDay':_0x1309b2['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x1309b2[_0x36ea('0x42')],'outboundAbandonedCallsDay':_0x1309b2[_0x36ea('0x43')],'predictiveIntervalAnsweredCalls':_0x1309b2[_0x36ea('0x44')],'predictiveIntervalAvgHoldtime':_0x1309b2['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x1309b2[_0x36ea('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x1309b2[_0x36ea('0x46')],'predictiveIntervalDroppedCallsTimeout':_0x1309b2['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x1309b2[_0x36ea('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x1309b2[_0x36ea('0x48')],'predictiveIntervalHitRate':_0x1309b2[_0x36ea('0x49')],'predictiveIntervalMultiplicativeFactor':_0x1309b2[_0x36ea('0x4a')],'predictiveIntervalPauses':_0x1309b2['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x1309b2[_0x36ea('0x4b')],'predictiveIntervalTotalCalls':_0x1309b2[_0x36ea('0x4c')],'message':_0x1309b2[_0x36ea('0x4d')],'originated':_0x1309b2[_0x36ea('0x4e')],'erlangCalls':_0x1309b2[_0x36ea('0x4f')],'erlangCallToSecond':_0x1309b2[_0x36ea('0x50')],'erlangAbandonmentRate':_0x1309b2[_0x36ea('0x51')],'erlangBusyFactor':_0x1309b2[_0x36ea('0x52')],'startPredictive':_0x1309b2[_0x36ea('0x53')],'startProgressive':_0x1309b2[_0x36ea('0x54')]};if(_0x1309b2[_0x36ea('0x55')]){_0x4aba09[_0x36ea('0x55')]={'id':_0x1309b2['Trunk']['id'],'name':_0x1309b2[_0x36ea('0x55')]['name'],'active':_0x1309b2[_0x36ea('0x55')][_0x36ea('0x56')],'callerid':_0x1309b2['Trunk']['callerid']};}if(_0x1309b2[_0x36ea('0x57')]){_0x4aba09[_0x36ea('0x57')]={'id':_0x1309b2[_0x36ea('0x57')]['id'],'name':_0x1309b2[_0x36ea('0x57')]['name']};}var _0x27ffe9=md5(JSON['stringify'](_0x4aba09));if(_0x1309b2['md5']!==_0x27ffe9){_0x1309b2['md5']=_0x27ffe9;emit(util[_0x36ea('0x58')](_0x36ea('0x59'),_0x4aba09[_0x36ea('0x29')]),_0x36ea('0x5a'),_0x4aba09);}}}function emitVoiceQueueChannelRemove(_0x1ea95f){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x36ea('0x5b')](_0x1ea95f));emit(util[_0x36ea('0x58')]('voice:queue:%s',_0x1ea95f[_0x36ea('0x29')]),_0x36ea('0x5c'),_0x1ea95f);io[_0x36ea('0x26')](_0x36ea('0x5d'),_0x1ea95f);}function notSendMessagesQueue(_0x48f626){if(_0x48f626[_0x36ea('0x5e')]){if(_0x48f626[_0x36ea('0x4e')]===0x0&&_0x48f626[_0x36ea('0x2e')]===0x0){_0x48f626[_0x36ea('0x5e')]=![];_0x48f626['available']=0x0;_0x48f626[_0x36ea('0x5f')]=0x0;_0x48f626[_0x36ea('0x4d')]=_0x36ea('0x60');ut[_0x36ea('0x61')](_0x36ea('0x62'),_0x48f626[_0x36ea('0x29')]+_0x36ea('0x63'));}else{_0x48f626[_0x36ea('0x4d')]=_0x36ea('0x64');ut[_0x36ea('0x61')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x48f626[_0x36ea('0x29')]+_0x36ea('0x65'));}emitCampaignPreview(_0x48f626);}}Preview['prototype'][_0x36ea('0x66')]=function(){var _0x3ce6e8=this;setInterval(function(){_0x3ce6e8[_0x36ea('0x67')]();},0x7cf);};Preview['prototype'][_0x36ea('0x67')]=function(){var _0x30749a=this[_0x36ea('0x14')];this['clockClearZombieChannels']+=0x1;for(var _0x1add1c in _0x30749a){if(_0x30749a[_0x36ea('0x68')](_0x1add1c)&&(_0x30749a[_0x1add1c][_0x36ea('0x38')]===_0x36ea('0x7')||_0x30749a[_0x1add1c][_0x36ea('0x38')]===_0x36ea('0x69'))&&_0x30749a[_0x1add1c][_0x36ea('0x27')]==='outbound'){if(this[_0x36ea('0x18')]>0x7){this[_0x36ea('0x18')]=0x0;this[_0x36ea('0x6a')]();}}if(_0x30749a['hasOwnProperty'](_0x1add1c)&&_0x30749a[_0x1add1c][_0x36ea('0x38')]===_0x36ea('0x7')&&_0x30749a[_0x1add1c][_0x36ea('0x27')]===_0x36ea('0x28')){if(_0x30749a[_0x1add1c][_0x36ea('0x37')]){this[_0x36ea('0x6b')](_0x30749a[_0x1add1c]);this[_0x36ea('0x6c')](_0x30749a[_0x1add1c]);}else{notSendMessagesQueue(_0x30749a[_0x1add1c]);}}}};Preview[_0x36ea('0xf')][_0x36ea('0x6d')]=function(_0x115de5){var _0x522daf=this;this[_0x36ea('0x13')][_0x36ea('0x10')](function(){if(!_[_0x36ea('0x6e')](_0x522daf[_0x36ea('0x17')][_0x115de5])){loggerAction[_0x36ea('0x6f')](_0x36ea('0x70'),_0x115de5,_0x36ea('0x71'),_0x522daf[_0x36ea('0x17')][_0x115de5][_0x36ea('0x72')],_0x36ea('0x73'),JSON[_0x36ea('0x5b')](_0x522daf[_0x36ea('0x14')][_0x522daf[_0x36ea('0x17')][_0x115de5][_0x36ea('0x72')]][_0x36ea('0x4e')]),_0x36ea('0x74'),JSON[_0x36ea('0x5b')](_0x522daf[_0x36ea('0x14')][_0x522daf[_0x36ea('0x17')][_0x115de5][_0x36ea('0x72')]][_0x36ea('0x2e')]),JSON[_0x36ea('0x5b')](_0x522daf[_0x36ea('0x17')][_0x115de5][_0x36ea('0x75')]),JSON['stringify'](_[_0x36ea('0x76')](_0x522daf['actions'][_0x115de5],['contactId',_0x36ea('0x77'),'VoiceQueueId',_0x36ea('0x78')])));return ami['Action']({'action':_0x36ea('0x79'),'channel':_0x522daf['actions'][_0x115de5][_0x36ea('0x7a')]})[_0x36ea('0x7b')](function(_0xc0821e){if(_0xc0821e[_0x36ea('0x4d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x522daf['actions'][_0x115de5]){ut[_0x36ea('0x7c')](_0x522daf[_0x36ea('0x14')][_0x522daf['actions'][_0x115de5]['queue']],'[clearZombieChannel]');if(_0x522daf['actions'][_0x115de5][_0x36ea('0x75')]===!![]){ut[_0x36ea('0x7d')](_0x522daf[_0x36ea('0x14')][_0x522daf[_0x36ea('0x17')][_0x115de5][_0x36ea('0x72')]],_0x36ea('0x7e'));ut[_0x36ea('0x7f')](_0x36ea('0x80')+_0x115de5,_0x522daf[_0x36ea('0x17')][_0x115de5][_0x36ea('0x72')]);}ut[_0x36ea('0x7f')](_0x36ea('0x81')+_0x115de5,_0x522daf[_0x36ea('0x17')][_0x115de5][_0x36ea('0x72')]);delete _0x522daf[_0x36ea('0x17')][_0x115de5];}},0x2328);}});}});};Preview[_0x36ea('0xf')][_0x36ea('0x6a')]=function(){var _0x205081=this;loggerAction[_0x36ea('0x6f')](_0x36ea('0x82'),_[_0x36ea('0x83')](this['actions']));for(var _0x118f29 in this[_0x36ea('0x17')]){if(_0x205081['actions'][_0x36ea('0x68')](_0x118f29)){_0x205081['clearZombieChannel'](_0x118f29);}}};Preview[_0x36ea('0xf')][_0x36ea('0x6c')]=function(_0x59053b){var _0x40d16f=this;rpcDb[_0x36ea('0x84')](_0x59053b['id'],ut[_0x36ea('0x85')](this[_0x36ea('0x86')]))[_0x36ea('0x87')](function(_0x451405){if(!_[_0x36ea('0x6e')](_0x451405)){for(var _0x59a265=0x0;_0x59a265<_0x451405[_0x36ea('0x88')];_0x59a265+=0x1){if(ut['getDiff'](_0x451405[_0x59a265][_0x36ea('0x89')])<_0x59053b[_0x36ea('0x8a')]*0x3c){if(_0x451405[_0x59a265][_0x36ea('0x8b')]&&!_0x451405[_0x59a265]['Agent'][_0x36ea('0x8c')]){_0x40d16f[_0x36ea('0x8d')](_0x451405[_0x59a265]['id'])[_0x36ea('0x87')](ut[_0x36ea('0x8e')](_0x36ea('0x8f')))[_0x36ea('0x7b')](ut['logger2'](_0x36ea('0x8f')));}else{rpcDb[_0x36ea('0x90')](_0x451405[_0x59a265]['id']);}}else{var _0x4bc460=new Action(_0x451405[_0x59a265],_0x59053b);_0x4bc460[_0x36ea('0x91')]=moment()[_0x36ea('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x59053b[_0x36ea('0x92')]+=0x1;ut[_0x36ea('0x93')](_0x4bc460,0x17,_0x36ea('0x94'));if(_0x59053b[_0x36ea('0x95')]){rpcDb[_0x36ea('0x96')](ut['createBody'](_0x451405[_0x59a265]));rpcDb['createCustomerHistory'](_0x4bc460,_0x36ea('0x97'));}else{ut[_0x36ea('0x93')](_0x4bc460,0x16,_0x36ea('0x98'));rpcDb[_0x36ea('0x99')](_0x4bc460,'[HistoryRecallClose]');rpcDb[_0x36ea('0x9a')](_0x4bc460,'[HistoryRecallClose]');}}}}})[_0x36ea('0x7b')](ut[_0x36ea('0x8e')](_0x36ea('0x9b')));};Preview[_0x36ea('0xf')][_0x36ea('0x6b')]=function(_0x151113){_0x151113[_0x36ea('0x5e')]=!![];if(ut[_0x36ea('0x9c')](_0x151113[_0x36ea('0x2d')])){_0x151113[_0x36ea('0x4d')]=_0x36ea('0x9d');}else if(!ut[_0x36ea('0x9e')](_0x151113['dialActive'])){_0x151113[_0x36ea('0x4d')]='NOT_ACTIVE';}else if(!this[_0x36ea('0x9f')](_0x151113['Trunk'])){if(!this[_0x36ea('0x9f')](_0x151113[_0x36ea('0xa0')])){_0x151113[_0x36ea('0x4d')]=_0x36ea('0xa1');}else{_0x151113[_0x36ea('0x4d')]=_0x36ea('0xa2');}}else{_0x151113['message']=_0x36ea('0xa2');}emitCampaignPreview(_0x151113);};Preview[_0x36ea('0xf')][_0x36ea('0xa3')]=function(_0x16c197,_0x2814db,_0x59b6a3){var _0x24fd72=this;var _0x5d1df1=this[_0x36ea('0x17')][_0x2814db];var _0x1eac39=this[_0x36ea('0x14')][_0x5d1df1[_0x36ea('0x72')]];var _0x49c671;if(_0x1eac39){switch(_0x59b6a3){case'1':_0x1eac39[_0x36ea('0xa4')]+=0x1;_0x5d1df1['countnosuchnumberretry']+=0x1;_0x5d1df1[_0x36ea('0xa5')]=ut['totalGlobal'](_0x5d1df1);ut[_0x36ea('0x93')](_0x5d1df1,0x0,_0x36ea('0xa6'));ami[_0x36ea('0x26')](_0x36ea('0xa7'),ut[_0x36ea('0xa8')](_0x5d1df1,_0x36ea('0xa9')));rpcDb[_0x36ea('0x99')](_0x5d1df1,_0x36ea('0xaa'));if(ut[_0x36ea('0xab')](_0x5d1df1)>=_0x1eac39[_0x36ea('0xac')]){_0x49c671=ut[_0x36ea('0xad')](_0x5d1df1,0xf,'Global');rpcDb[_0x36ea('0x9a')](_0x49c671,_0x36ea('0xae'));}else{if(_0x5d1df1[_0x36ea('0xaf')]>=_0x1eac39[_0x36ea('0xb0')]){rpcDb['createCustomerFinal'](_0x5d1df1,_0x36ea('0xae'));}else{rpcDb['rescheduleContact'](ut[_0x36ea('0xb1')](_0x5d1df1,'countnosuchnumberretry',_0x1eac39[_0x36ea('0xb2')]),_0x5d1df1[_0x36ea('0xb3')],_0x5d1df1['activeContact']);}}delete this['actions'][_0x16c197[_0x36ea('0xb4')]];break;case _0x36ea('0xb5'):var _0x174904=moment()[_0x36ea('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x5d1df1[_0x36ea('0xb6')]=_0x174904;_0x5d1df1[_0x36ea('0xb7')]=_0x174904;_0x5d1df1[_0x36ea('0x75')]=!![];_0x1eac39[_0x36ea('0x2e')]+=0x1;logger[_0x36ea('0x6f')](_0x36ea('0xb8'),_0x5d1df1[_0x36ea('0xb9')],_0x36ea('0xba'),_0x1eac39['name'],_0x36ea('0x74'),_0x1eac39[_0x36ea('0x2e')]);ami[_0x36ea('0x26')]('custom:agentconnect',ut[_0x36ea('0xa8')](_0x5d1df1,'connect',this[_0x36ea('0x14')][_0x5d1df1[_0x36ea('0x72')]]));if(_0x1eac39['acw']){ami[_0x36ea('0x26')]('custom:agentConnectPreview',ut[_0x36ea('0xbb')](_0x5d1df1));}break;case'16':ami[_0x36ea('0x26')](_0x36ea('0xbc'),ut[_0x36ea('0xa8')](_0x5d1df1,'complete',this[_0x36ea('0x14')][_0x5d1df1[_0x36ea('0x72')]]));emitVoiceQueueChannelRemove(ut[_0x36ea('0xa8')](_0x5d1df1,_0x36ea('0xbd')));_0x1eac39[_0x36ea('0x3c')]+=0x1;_0x1eac39[_0x36ea('0x33')]+=0x1;_0x1eac39[_0x36ea('0x2b')]+=0x1;ut[_0x36ea('0x7d')](_0x1eac39,_0x36ea('0xbe'));_0x5d1df1['countglobal']=ut[_0x36ea('0xab')](_0x5d1df1);ut[_0x36ea('0x93')](_0x5d1df1,0x4,_0x36ea('0xbf'));rpcDb[_0x36ea('0x99')](_0x5d1df1,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x36ea('0x9a')](_0x5d1df1,_0x36ea('0xc0'));rpcDb[_0x36ea('0xc1')](_0x5d1df1);_0x1eac39[_0x36ea('0x30')]+=_0x5d1df1[_0x36ea('0xc2')];_0x1eac39[_0x36ea('0x2f')]+=_0x5d1df1['talktime'];logger['info']('[syncHangup][talking][decrement]',_0x5d1df1[_0x36ea('0xb9')],_0x36ea('0xba'),_0x1eac39[_0x36ea('0x29')],_0x36ea('0x74'),_0x1eac39[_0x36ea('0x2e')]);delete this[_0x36ea('0x17')][_0x16c197[_0x36ea('0xb4')]];break;case _0x36ea('0xc3'):_0x1eac39[_0x36ea('0xc4')]+=0x1;_0x5d1df1['countbusyretry']+=0x1;_0x5d1df1[_0x36ea('0xa5')]=ut[_0x36ea('0xab')](_0x5d1df1);ut['logCustomer'](_0x5d1df1,0x5,_0x36ea('0xc5'));ami[_0x36ea('0x26')]('custom:agentbusy',ut[_0x36ea('0xa8')](_0x5d1df1,'busy'));rpcDb[_0x36ea('0x99')](_0x5d1df1,_0x36ea('0xc6'));if(ut[_0x36ea('0xab')](_0x5d1df1)>=_0x1eac39[_0x36ea('0xac')]){_0x49c671=ut[_0x36ea('0xad')](_0x5d1df1,0xf,_0x36ea('0xc7'));rpcDb[_0x36ea('0x9a')](_0x49c671,_0x36ea('0xc8'));}else{if(_0x5d1df1[_0x36ea('0xc9')]>=_0x1eac39[_0x36ea('0xca')]){rpcDb[_0x36ea('0x9a')](_0x5d1df1,_0x36ea('0xc6'));}else{rpcDb['rescheduleContact'](ut[_0x36ea('0xb1')](_0x5d1df1,_0x36ea('0xc9'),_0x1eac39[_0x36ea('0xcb')]),_0x5d1df1['unlockAgent'],_0x5d1df1[_0x36ea('0xcc')]);}}break;case _0x36ea('0xcd'):_0x1eac39[_0x36ea('0xce')]+=0x1;_0x5d1df1[_0x36ea('0xcf')]+=0x1;_0x5d1df1[_0x36ea('0xa5')]=ut[_0x36ea('0xab')](_0x5d1df1);ut[_0x36ea('0x93')](_0x5d1df1,0x3,_0x36ea('0xd0'));ami[_0x36ea('0x26')](_0x36ea('0xd1'),ut[_0x36ea('0xa8')](_0x5d1df1,'noanswer'));rpcDb[_0x36ea('0x99')](_0x5d1df1,_0x36ea('0xd2'));if(ut[_0x36ea('0xab')](_0x5d1df1)>=_0x1eac39[_0x36ea('0xac')]){_0x49c671=ut[_0x36ea('0xad')](_0x5d1df1,0xf,_0x36ea('0xc7'));rpcDb['createCustomerFinal'](_0x49c671,_0x36ea('0xd3'));}else{if(_0x5d1df1['countnoanswerretry']>=_0x1eac39['dialNoAnswerMaxRetry']){rpcDb[_0x36ea('0x9a')](_0x5d1df1,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x36ea('0xd4')](ut['scheduledAt'](_0x5d1df1,_0x36ea('0xcf'),_0x1eac39[_0x36ea('0xd5')]),_0x5d1df1[_0x36ea('0xb3')],_0x5d1df1[_0x36ea('0xcc')]);}}break;case _0x36ea('0xd6'):_0x1eac39[_0x36ea('0x3d')]+=0x1;_0x5d1df1[_0x36ea('0xd7')]+=0x1;_0x5d1df1['countglobal']=ut[_0x36ea('0xab')](_0x5d1df1);ut[_0x36ea('0x93')](_0x5d1df1,0x8,_0x36ea('0xd8'));ami[_0x36ea('0x26')]('custom:agentcongestion',ut[_0x36ea('0xa8')](_0x5d1df1,_0x36ea('0xd9')));rpcDb[_0x36ea('0x99')](_0x5d1df1,_0x36ea('0xda'));if(ut[_0x36ea('0xab')](_0x5d1df1)>=_0x1eac39[_0x36ea('0xac')]){_0x49c671=ut[_0x36ea('0xad')](_0x5d1df1,0xf,_0x36ea('0xc7'));rpcDb[_0x36ea('0x9a')](_0x49c671,_0x36ea('0xdb'));}else{if(_0x5d1df1[_0x36ea('0xd7')]>=_0x1eac39[_0x36ea('0xdc')]){rpcDb['createCustomerFinal'](_0x5d1df1,_0x36ea('0xda'));}else{rpcDb[_0x36ea('0xd4')](ut[_0x36ea('0xb1')](_0x5d1df1,_0x36ea('0xd7'),_0x1eac39[_0x36ea('0xcb')]),_0x5d1df1[_0x36ea('0xb3')],_0x5d1df1['activeContact']);}}break;case _0x36ea('0xdd'):_0x1eac39[_0x36ea('0xde')]+=0x1;_0x5d1df1[_0x36ea('0xdf')]+=0x1;_0x5d1df1[_0x36ea('0xa5')]=ut[_0x36ea('0xab')](_0x5d1df1);ut['logCustomer'](_0x5d1df1,0x14,_0x36ea('0xe0'));ami[_0x36ea('0x26')](_0x36ea('0xe1'),ut['buildObj'](_0x5d1df1,'agentreject'));rpcDb[_0x36ea('0x99')](_0x5d1df1,_0x36ea('0xe2'));if(ut[_0x36ea('0xab')](_0x5d1df1)>=_0x1eac39[_0x36ea('0xac')]){_0x49c671=ut[_0x36ea('0xad')](_0x5d1df1,0x14,_0x36ea('0xe0'));rpcDb['createCustomerFinal'](_0x49c671,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x5d1df1[_0x36ea('0xdf')]>=_0x1eac39[_0x36ea('0xe3')]){rpcDb['createCustomerFinal'](_0x5d1df1,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x5d1df1,_0x36ea('0xdf'),_0x1eac39[_0x36ea('0xe4')]),_0x5d1df1[_0x36ea('0xb3')],_0x5d1df1['activeContact']);}}break;case'ABANDONED':_0x1eac39[_0x36ea('0x43')]+=0x1;_0x5d1df1[_0x36ea('0xe5')]+=0x1;_0x5d1df1[_0x36ea('0xa5')]=ut['totalGlobal'](_0x5d1df1);ut[_0x36ea('0x93')](_0x5d1df1,0xb,_0x36ea('0xe6'));rpcDb[_0x36ea('0x99')](_0x5d1df1,_0x36ea('0xe7'));if(ut[_0x36ea('0xab')](_0x5d1df1)>=_0x1eac39[_0x36ea('0xac')]){_0x49c671=ut[_0x36ea('0xad')](_0x5d1df1,0xf,_0x36ea('0xc7'));rpcDb[_0x36ea('0x9a')](_0x49c671,_0x36ea('0xe7'));}else{if(_0x5d1df1['countabandonedetry']>=_0x1eac39['dialAbandonedMaxRety']){rpcDb[_0x36ea('0x9a')](_0x5d1df1,_0x36ea('0xe7'));}else{rpcDb[_0x36ea('0xd4')](ut[_0x36ea('0xb1')](_0x5d1df1,_0x36ea('0xe5'),_0x1eac39[_0x36ea('0xe8')]),_0x5d1df1[_0x36ea('0xb3')],_0x5d1df1['activeContact']);}}break;case'18':_0x1eac39[_0x36ea('0x42')]+=0x1;_0x5d1df1[_0x36ea('0xe9')]+=0x1;_0x5d1df1['countglobal']=ut[_0x36ea('0xab')](_0x5d1df1);ut[_0x36ea('0x93')](_0x5d1df1,0x12,_0x16c197[_0x36ea('0xea')]||_0x16c197[_0x36ea('0xeb')]);ami['emit'](_0x36ea('0xec'),ut[_0x36ea('0xa8')](_0x5d1df1,_0x36ea('0xed')));rpcDb[_0x36ea('0x99')](_0x5d1df1,_0x36ea('0xee'));if(ut[_0x36ea('0xab')](_0x5d1df1)>=_0x1eac39[_0x36ea('0xac')]){_0x49c671=ut[_0x36ea('0xad')](_0x5d1df1,0xf,_0x36ea('0xc7'));rpcDb['createCustomerFinal'](_0x49c671,_0x36ea('0xee'));}else{rpcDb[_0x36ea('0x9a')](_0x5d1df1,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x36ea('0x17')][_0x16c197[_0x36ea('0xb4')]];break;case'19':_0x1eac39[_0x36ea('0x42')]+=0x1;_0x5d1df1[_0x36ea('0xa5')]=ut[_0x36ea('0xab')](_0x5d1df1);ut['logCustomer'](_0x5d1df1,0x13,_0x16c197[_0x36ea('0xea')]||_0x16c197[_0x36ea('0xeb')]);ami[_0x36ea('0x26')](_0x36ea('0xec'),ut[_0x36ea('0xa8')](_0x5d1df1,_0x36ea('0xed')));rpcDb[_0x36ea('0x99')](_0x5d1df1,_0x36ea('0xef'));if(ut[_0x36ea('0xab')](_0x5d1df1)>=_0x1eac39['dialGlobalMaxRetry']){_0x49c671=ut['cloneAction'](_0x5d1df1,0xf,_0x36ea('0xc7'));rpcDb[_0x36ea('0x9a')](_0x49c671,'[callProgressDetectingCustomer][machine]');}else{rpcDb['createCustomerFinal'](_0x5d1df1,_0x36ea('0xef'));}delete this[_0x36ea('0x17')][_0x16c197[_0x36ea('0xb4')]];break;default:if(_0x5d1df1[_0x36ea('0x75')]){ut[_0x36ea('0x7d')](_0x1eac39,_0x36ea('0xf0'));ut[_0x36ea('0x7f')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x1eac39[_0x36ea('0x29')],_0x16c197);}_0x1eac39[_0x36ea('0x42')]+=0x1;_0x5d1df1[_0x36ea('0xa5')]=ut[_0x36ea('0xab')](_0x5d1df1);ut[_0x36ea('0x93')](_0x5d1df1,0xc,_0x16c197[_0x36ea('0xea')]||_0x16c197[_0x36ea('0xeb')]);rpcDb['createCustomerHistory'](_0x5d1df1,_0x36ea('0xf1'));if(ut[_0x36ea('0xab')](_0x5d1df1)>=_0x1eac39['dialGlobalMaxRetry']){_0x49c671=ut[_0x36ea('0xad')](_0x5d1df1,0xf,_0x36ea('0xc7'));rpcDb[_0x36ea('0x9a')](_0x49c671,_0x36ea('0xf2'));}else{rpcDb[_0x36ea('0x9a')](_0x5d1df1,_0x36ea('0xf2'));}delete this[_0x36ea('0x17')][_0x16c197['linkedid']];}if(!(_0x5d1df1['dialAnswer']&&_0x59b6a3==='16')){ut[_0x36ea('0x7c')](_0x1eac39,_0x36ea('0xf3'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x5d1df1[_0x36ea('0xb9')],_0x36ea('0xba'),_0x1eac39['name'],'originated:\x20',_0x1eac39[_0x36ea('0x4e')]);}if(_0x59b6a3!==_0x36ea('0xb5')){delete this[_0x36ea('0x17')][_0x16c197[_0x36ea('0xb4')]];delete this[_0x36ea('0x17')][_0x16c197[_0x36ea('0xf4')]];}}};Preview[_0x36ea('0xf')][_0x36ea('0xf5')]=function(_0x3f9303,_0x5be03d,_0x48edcd){if(_[_0x36ea('0xf6')](_0x5be03d)&&_0x36ea('0xf7')!==typeof _0x5be03d){return;}if(_[_0x36ea('0xf6')](_0x48edcd)&&_0x36ea('0xf7')!==typeof _0x48edcd){return;}switch(_0x48edcd[_0x36ea('0xf8')]){case'0':ut['logAgent'](_0x3f9303,0x0,_0x36ea('0xa6'));rpcDb[_0x36ea('0xf9')](_0x3f9303,_0x36ea('0xfa'));break;case'3':ut[_0x36ea('0xfb')](_0x3f9303,0x3,_0x36ea('0xd0'));rpcDb[_0x36ea('0xf9')](_0x3f9303,_0x36ea('0xfc'));break;case'5':ut[_0x36ea('0xfb')](_0x3f9303,0x5,_0x36ea('0xc5'));rpcDb[_0x36ea('0xf9')](_0x3f9303,_0x36ea('0xfd'));break;case'8':ut[_0x36ea('0xfb')](_0x3f9303,0x8,_0x36ea('0xd8'));rpcDb[_0x36ea('0xf9')](_0x3f9303,_0x36ea('0xfe'));break;case'22':ut[_0x36ea('0xfb')](_0x3f9303,0x16,_0x36ea('0xff'));rpcDb[_0x36ea('0xf9')](_0x3f9303,_0x36ea('0x100'));break;default:ut['logAgent'](_0x3f9303,0xc,_0x48edcd[_0x36ea('0xf8')]);rpcDb[_0x36ea('0xf9')](_0x3f9303,_0x36ea('0xfe'));}ut['updateOriginated'](_0x5be03d,_0x36ea('0x101'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x3f9303[_0x36ea('0xb9')],_0x36ea('0xba'),_0x5be03d['name'],_0x36ea('0x73'),_0x5be03d['originated']);delete this[_0x36ea('0x17')][_0x3f9303[_0x36ea('0xb9')]];};Preview[_0x36ea('0xf')][_0x36ea('0x102')]=function(_0x497146,_0x541851,_0x1624d3,_0x286313,_0x5e9160){var _0x581c81=this;return new BPromise(function(_0xe0dde6,_0x2263d6){if(_[_0x36ea('0x6e')](_0x541851)||_[_0x36ea('0x6e')](_0x541851['Contact'])||_['isNil'](_0x541851[_0x36ea('0x103')][_0x36ea('0x104')])||_[_0x36ea('0x6e')](_0x541851[_0x36ea('0x105')])){_0x2263d6(ut[_0x36ea('0x4d')](_0x36ea('0x106'),_0x286313,_0x5e9160));return;}var _0x1fef8b=uuid['v4']();var _0x513dc8=_0x581c81[_0x36ea('0x14')][_0x541851[_0x36ea('0x71')][_0x36ea('0x29')]];var _0xfcbc24=_0x1624d3?_0x581c81['agents'][_0x1624d3]['id']:undefined;_0x581c81[_0x36ea('0x17')][_0x1fef8b]=new Action(_0x541851,_0x513dc8,_0x1fef8b,_0x1624d3,_0xfcbc24);var _0x409809=_0x581c81[_0x36ea('0x17')][_0x1fef8b];_0x409809[_0x36ea('0xb3')]=_0x286313;_0x409809[_0x36ea('0xcc')]=_0x5e9160;_0x409809[_0x36ea('0x107')]=_0x1624d3;if(_['isEmpty'](_0x497146)){_0x581c81['execCall'](_0x409809,_0x513dc8,_0x541851,_0x1624d3)[_0x36ea('0x87')](function(_0x201e93){logger[_0x36ea('0x6f')](_0x36ea('0x108'),_0x36ea('0x109')+_0x409809['queue']+_0x36ea('0x10a')+_0x409809['idContact'],JSON[_0x36ea('0x5b')](_0x201e93));ami[_0x36ea('0x26')](_0x36ea('0x10b'),ut['buildObj'](_0x409809,_0x36ea('0x10c'),_0x581c81[_0x36ea('0x14')][_0x409809[_0x36ea('0x72')]]));_0xe0dde6(ut['message'](_0x36ea('0x10d')));})[_0x36ea('0x7b')](function(_0x175bd0){ut['logger'](_0x36ea('0x10e'),_0x175bd0);_0x2263d6(ut[_0x36ea('0x4d')]('Call\x20failed',_0x286313,_0x5e9160));});}else{_0x513dc8[_0x36ea('0x10f')]+=0x1;ut['logBlacklist'](_0x409809);rpcDb[_0x36ea('0x110')](_0x409809,'[Blacklist][error]');delete _0x581c81[_0x36ea('0x17')][_0x1fef8b];_0x2263d6(ut['message']('Contact\x20in\x20black\x20List',_0x286313,_0x5e9160));}});};Preview['prototype'][_0x36ea('0x9f')]=function(_0x3af9ae){return!_[_0x36ea('0x6e')](_0x3af9ae)&&!_[_0x36ea('0x6e')](_0x3af9ae[_0x36ea('0x29')])&&!_[_0x36ea('0x6e')](_0x3af9ae[_0x36ea('0x56')])&&_0x3af9ae[_0x36ea('0x56')]&&!_['isNil'](this[_0x36ea('0x16')][util['format'](_0x36ea('0x111'),_0x3af9ae[_0x36ea('0x29')])])&&!_[_0x36ea('0x6e')](this[_0x36ea('0x16')][util[_0x36ea('0x58')](_0x36ea('0x111'),_0x3af9ae[_0x36ea('0x29')])][_0x36ea('0x79')])&&(this[_0x36ea('0x16')][util['format'](_0x36ea('0x111'),_0x3af9ae[_0x36ea('0x29')])][_0x36ea('0x79')]===_0x36ea('0x112')||this['trunks'][util[_0x36ea('0x58')](_0x36ea('0x111'),_0x3af9ae[_0x36ea('0x29')])][_0x36ea('0x79')]==='unmonitored');};Preview['prototype'][_0x36ea('0x8d')]=function(_0x56c244,_0x55225b){var _0x126728=this;return new BPromise(function(_0x4aeec9,_0x4fe59e){_0x126728['execRun'](_0x56c244,_0x55225b)[_0x36ea('0x87')](function(_0x2f7000){_0x4aeec9(_['pick'](_0x2f7000,['message']));})[_0x36ea('0x7b')](function(_0x2103e0){if(_0x2103e0['unlock']){rpcDb['unlockContact'](_0x56c244);}if(_0x2103e0[_0x36ea('0x56')]){rpcDb[_0x36ea('0x90')](_0x56c244);}_0x4fe59e(_[_0x36ea('0x76')](_0x2103e0,['message']));});});};Preview['prototype'][_0x36ea('0x113')]=function(_0x1d1185,_0x3f66a9){var _0x13bd0e=this;return new BPromise(function(_0x4fc6c0,_0xa2ae34){var _0x40cce3,_0x7b6c7b;rpcDb[_0x36ea('0x114')](_0x1d1185)['then'](function(_0x3adadc){if(!_[_0x36ea('0x6e')](_0x3adadc[0x0])){_0x7b6c7b=_0x3adadc[0x0][_0x36ea('0x115')]?![]:!![];_0x40cce3=_0x3adadc[0x0][_0x36ea('0x115')]?!![]:![];_0x40cce3=_0x3f66a9?!![]:_0x40cce3;}var _0x3ba374=_0x13bd0e[_0x36ea('0x116')](_0x3adadc);if(_0x3ba374[_0x36ea('0x117')]){rpcDb[_0x36ea('0x118')](_[_0x36ea('0x76')](_0x3adadc[0x0],[_0x36ea('0x105'),_0x36ea('0x119')]))[_0x36ea('0x87')](function(_0x3406fe){_0x13bd0e[_0x36ea('0x102')](_0x3406fe,_0x3adadc[0x0],_0x3f66a9,_0x7b6c7b,_0x40cce3)['then'](function(_0x484941){_0x4fc6c0(_0x484941);})[_0x36ea('0x7b')](function(_0x41a66f){_0xa2ae34(_0x41a66f);});})[_0x36ea('0x7b')](function(_0x20684c){ut[_0x36ea('0x61')](_0x36ea('0x11a'),_0x20684c);_0xa2ae34(ut[_0x36ea('0x4d')](_0x36ea('0x11b'),_0x7b6c7b,_0x40cce3));});}else{_0xa2ae34(ut[_0x36ea('0x4d')](_0x3ba374['message'],_0x7b6c7b,_0x40cce3));}})[_0x36ea('0x7b')](function(_0x2f5604){ut['logger'](_0x36ea('0x11c'),_0x2f5604);_0xa2ae34(ut[_0x36ea('0x4d')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x36ea('0xf')]['validateContact']=function(_0x8d1141){if(_[_0x36ea('0x6e')](_0x8d1141)||_[_0x36ea('0x11d')](_0x8d1141)||!_[_0x36ea('0x6e')](_0x8d1141[0x0]['Agent'])&&_[_0x36ea('0x6e')](_0x8d1141[0x0]['Agent'][_0x36ea('0x29')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x8d1141);return{'isValid':![],'message':_0x36ea('0x11e')};}var _0x7b2f60=this[_0x36ea('0x14')][_0x8d1141[0x0][_0x36ea('0x71')][_0x36ea('0x29')]];_0x7b2f60['message']=_0x36ea('0xa2');if(_[_0x36ea('0x6e')](_0x7b2f60)){ut['logger'](_0x36ea('0x11f'),_0x7b2f60);return{'isValid':![],'message':_0x36ea('0x120')};}if(!this[_0x36ea('0x9f')](_0x7b2f60[_0x36ea('0x55')])){ut['logger'](_0x36ea('0x121'),_0x36ea('0x122')+_0x7b2f60[_0x36ea('0x29')]+_0x36ea('0x123'));if(!this['isTrunkReachable'](_0x7b2f60['TrunkBackup'])){ut[_0x36ea('0x61')](_0x36ea('0x121'),_0x7b2f60[_0x36ea('0x29')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x36ea('0x124')};}}if(!ut['isActive'](_0x7b2f60[_0x36ea('0x37')])){ut['logger'](_0x36ea('0x125'),_0x7b2f60[_0x36ea('0x29')]+_0x36ea('0x126'));return{'isValid':![],'message':_0x36ea('0x122')+_0x7b2f60[_0x36ea('0x29')]+_0x36ea('0x126')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x36ea('0xf')][_0x36ea('0x127')]=function(_0x5c180f,_0x418bdb,_0x4c1237,_0x465a38){var _0x151ffa=this;return new BPromise(function(_0x20132f,_0x115bd7){var _0x587b07=_0x5c180f[_0x36ea('0xb9')];var _0x181efb=_0x151ffa[_0x36ea('0x9f')](_0x418bdb[_0x36ea('0x55')])?util[_0x36ea('0x58')](_0x36ea('0x128'),_0x418bdb['Trunk'][_0x36ea('0x29')],_[_0x36ea('0x6e')](_0x418bdb[_0x36ea('0x3b')])?'':_0x418bdb[_0x36ea('0x3b')][_0x36ea('0x129')]()||'',_0x418bdb[_0x36ea('0x12a')]>0x0?_0x4c1237[_0x36ea('0x103')][_0x36ea('0x104')][_0x36ea('0x12b')](_0x418bdb['dialCutDigit']):_0x4c1237[_0x36ea('0x103')][_0x36ea('0x104')]):util[_0x36ea('0x58')](_0x36ea('0x128'),_[_0x36ea('0x6e')](_0x418bdb[_0x36ea('0xa0')])?_0x418bdb[_0x36ea('0x55')][_0x36ea('0x29')]:_0x418bdb[_0x36ea('0xa0')]['name'],_[_0x36ea('0x6e')](_0x418bdb[_0x36ea('0x3b')])?'':_0x418bdb[_0x36ea('0x3b')][_0x36ea('0x129')]()||'',_0x418bdb['dialCutDigit']>0x0?_0x4c1237[_0x36ea('0x103')][_0x36ea('0x104')][_0x36ea('0x12b')](_0x418bdb['dialCutDigit']):_0x4c1237[_0x36ea('0x103')][_0x36ea('0x104')]);var _0x5dd7c3=_0x151ffa[_0x36ea('0x9f')](_0x418bdb[_0x36ea('0x55')])?ut['getCallerId'](_0x418bdb[_0x36ea('0x55')][_0x36ea('0x12c')],_0x418bdb['dialOriginateCallerIdName'],_0x418bdb['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x418bdb[_0x36ea('0x12d')],_0x418bdb[_0x36ea('0x12e')]):_0x418bdb['dialOriginateCallerIdNumber']):ut[_0x36ea('0x12f')](_['isNil'](_0x418bdb[_0x36ea('0xa0')])?_0x418bdb['Trunk'][_0x36ea('0x12c')]:_0x418bdb[_0x36ea('0xa0')][_0x36ea('0x12c')],_0x418bdb[_0x36ea('0x39')],_0x418bdb['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x36ea('0x130')](_0x418bdb[_0x36ea('0x12d')],_0x418bdb[_0x36ea('0x12e')]):_0x418bdb['dialOriginateCallerIdNumber']);if(_0x5dd7c3){_0x5c180f[_0x36ea('0x131')]=ut[_0x36ea('0x132')](_0x5dd7c3);_0x5c180f['originatecalleridnum']=ut['extractCalleridNumber'](_0x5dd7c3);}var _0x5aa3fb=ut['addVariables'](_0x418bdb,_0x4c1237,_0x181efb,_0x5dd7c3,_0x587b07,_0x5c180f);_['merge'](_0x5c180f,ut['toLowerVariables'](_0x5aa3fb));_0x5c180f[_0x36ea('0x91')]=moment()[_0x36ea('0x58')](_0x36ea('0x133'));ami[_0x36ea('0x134')](ut[_0x36ea('0x135')](_0x5c180f,_0x418bdb,_0x5aa3fb,_0x5c180f[_0x36ea('0xcc')],_0x465a38))[_0x36ea('0x87')](function(_0x4b2c00){var _0x1f8e27=_0x5c180f[_0x36ea('0x136')];if(!_[_0x36ea('0x6e')](_0x1f8e27)){if(!_[_0x36ea('0x6e')](_0x151ffa['agents'][_0x1f8e27])){_0x151ffa['agents'][_0x1f8e27][_0x36ea('0x137')]=_0x5c180f[_0x36ea('0x138')];emit(util[_0x36ea('0x58')](_0x36ea('0x139'),_0x151ffa['agents'][_0x1f8e27][_0x36ea('0x29')]),_0x36ea('0x13a'),{'destaccountcode':_0x151ffa[_0x36ea('0x86')][_0x1f8e27]['accountcode'],'destconnectedlinenum':_0x5c180f[_0x36ea('0x138')]});}}_0x418bdb[_0x36ea('0x4e')]+=0x1;logger[_0x36ea('0x6f')](_0x36ea('0x13b'),_0x587b07,'\x20Queue',_0x418bdb[_0x36ea('0x29')],_0x36ea('0x73'),_0x418bdb[_0x36ea('0x4e')]);_0x20132f(_0x4b2c00);})[_0x36ea('0x7b')](function(_0x55c399){ut[_0x36ea('0xfb')](_0x5c180f,0xe,_0x36ea('0x13c'));rpcDb[_0x36ea('0xf9')](_0x5c180f,'[originateFailure][logOriginateFailure]');_0x115bd7(_0x55c399);});});};Preview['prototype'][_0x36ea('0x1f')]=function(_0x2a84d5){if(this['actions'][_0x2a84d5['linkedid']]){this[_0x36ea('0x17')][_0x2a84d5[_0x36ea('0xb4')]][_0x36ea('0x7a')]=_0x2a84d5[_0x36ea('0x7a')];}};Preview[_0x36ea('0xf')][_0x36ea('0x19')]=function(_0x31bd37){var _0x529e75=this;var _0x2ffbfb=this[_0x36ea('0x17')][_0x31bd37[_0x36ea('0x13d')]];if(_0x2ffbfb){if(_0x2ffbfb['lookAgent']&&this[_0x36ea('0x86')][_0x2ffbfb[_0x36ea('0x107')]]){ut[_0x36ea('0x13e')](_0x2ffbfb,this[_0x36ea('0x86')][_0x2ffbfb[_0x36ea('0x107')]][_0x36ea('0x29')],this[_0x36ea('0x86')][_0x2ffbfb[_0x36ea('0x107')]]['id']);}var _0x4d2a5f=_[_0x36ea('0x13f')](_0x2ffbfb);_0x4d2a5f[_0x36ea('0xb6')]=moment()[_0x36ea('0x58')]('YYYY-MM-DD\x20HH:mm:ss');var _0x217128=_0x529e75[_0x36ea('0x14')][_0x2ffbfb[_0x36ea('0x72')]];if(ut[_0x36ea('0x140')](_0x31bd37[_0x36ea('0x141')])){if(_0x2ffbfb['unlockAgent']){rpcDb[_0x36ea('0x142')](_0x2ffbfb[_0x36ea('0x143')]);}if(_0x2ffbfb['activeContact']){rpcDb[_0x36ea('0x90')](_0x2ffbfb[_0x36ea('0x143')]);}ami[_0x36ea('0x26')](_0x36ea('0x144'),ut['buildObj'](_0x2ffbfb,_0x36ea('0x145'),this['campaignsPreview'][_0x2ffbfb[_0x36ea('0x72')]]));this[_0x36ea('0xf5')](_0x4d2a5f,_0x217128,_0x31bd37);}else{_0x2ffbfb['starttime']=moment()['format'](_0x36ea('0x133'));ut[_0x36ea('0xfb')](_0x4d2a5f,0x4,_0x36ea('0xbf'));rpcDb[_0x36ea('0xf9')](_0x4d2a5f,_0x36ea('0x146'));}}};Preview[_0x36ea('0xf')][_0x36ea('0x147')]=function(_0x36cfdf){var _0x267a57=this;var _0x4099e9=this[_0x36ea('0x17')][_0x36cfdf[_0x36ea('0xb4')]];var _0x4bd24f;if(_0x4099e9){_0x4bd24f=this['campaignsPreview'][_0x4099e9[_0x36ea('0x72')]];logger['info']('[syncHangup][talking]',_0x36cfdf['linkedid'],_0x36ea('0xba'),_0x4bd24f[_0x36ea('0x29')],_0x36ea('0x74'),_0x4bd24f[_0x36ea('0x2e')]);}if(this['actions'][_0x36cfdf[_0x36ea('0xb4')]]&&_0x36cfdf[_0x36ea('0xb4')]!==_0x36cfdf[_0x36ea('0xb9')]){if(_0x36cfdf[_0x36ea('0x148')]==='16'&&this[_0x36ea('0x17')][_0x36cfdf[_0x36ea('0xb4')]][_0x36ea('0x75')]){this['callProgressDetectingCustomer'](_0x36cfdf,_0x36cfdf[_0x36ea('0xb4')],_0x36cfdf['cause']);}else if(this[_0x36ea('0x17')][_0x36cfdf[_0x36ea('0xb4')]][_0x36ea('0x75')]){logger['info'](_0x36ea('0x149'),_0x36cfdf[_0x36ea('0xb4')],_0x36cfdf[_0x36ea('0x148')],'\x20Queue',_0x4bd24f[_0x36ea('0x29')],_0x36ea('0x74'),_0x4bd24f['pTalking']);this[_0x36ea('0xa3')](_0x36cfdf,_0x36cfdf['linkedid'],_0x36cfdf['cause']);}}else if(_0x4099e9&&_[_0x36ea('0x6e')](_0x4099e9[_0x36ea('0x14a')])&&_0x4bd24f[_0x36ea('0x14b')]&&_0x36cfdf['linkedid']===_0x36cfdf[_0x36ea('0xb9')]&&_[_0x36ea('0x6e')](_0x36cfdf[_0x36ea('0xf8')])&&_0x36cfdf[_0x36ea('0x148')]==='16'&&_0x36cfdf[_0x36ea('0x14c')]==='6'&&_[_0x36ea('0xf6')](_0x4099e9[_0x36ea('0x14d')])){if(_0x4099e9[_0x36ea('0xb3')]){rpcDb[_0x36ea('0x142')](_0x4099e9[_0x36ea('0x143')]);}if(_0x4099e9[_0x36ea('0xcc')]){rpcDb[_0x36ea('0x90')](_0x4099e9[_0x36ea('0x143')]);}_0x36cfdf[_0x36ea('0xf8')]='22';this[_0x36ea('0xf5')](_0x4099e9,_0x4bd24f,_0x36cfdf);}else if(_0x4099e9&&_0x4099e9[_0x36ea('0x14d')]){if(_0x36cfdf[_0x36ea('0x148')]==='16'&&this[_0x36ea('0x17')][_0x36cfdf['linkedid']]['dialAnswer']){logger['info'](_0x36ea('0x14e'),_0x36cfdf['linkedid'],_0x36cfdf[_0x36ea('0x148')],_0x36ea('0xba'),_0x4bd24f[_0x36ea('0x29')],_0x36ea('0x74'),_0x4bd24f['pTalking']);this[_0x36ea('0xa3')](_0x36cfdf,_0x36cfdf[_0x36ea('0xb4')],_0x36cfdf[_0x36ea('0x148')]);}else if(this[_0x36ea('0x17')][_0x36cfdf['linkedid']][_0x36ea('0x75')]){logger[_0x36ea('0x6f')](_0x36ea('0x149'),_0x36cfdf[_0x36ea('0xb4')],_0x36cfdf[_0x36ea('0x148')],_0x36ea('0xba'),_0x4bd24f['name'],_0x36ea('0x74'),_0x4bd24f[_0x36ea('0x2e')]);this[_0x36ea('0xa3')](_0x36cfdf,_0x36cfdf[_0x36ea('0xb4')],_0x36cfdf['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x9e9a8f){if(this[_0x36ea('0x17')][_0x9e9a8f[_0x36ea('0xf4')]]&&_0x9e9a8f[_0x36ea('0xf4')]!==_0x9e9a8f[_0x36ea('0x14f')]){this[_0x36ea('0xa3')](_0x9e9a8f,_0x9e9a8f['destlinkedid'],_0x9e9a8f[_0x36ea('0xeb')]);}};Preview['prototype']['syncHangupRequest']=function(_0x6f0333){if(this[_0x36ea('0x17')][_0x6f0333[_0x36ea('0xb4')]]&&_0x6f0333['linkedid']!==_0x6f0333['uniqueid']&&!this[_0x36ea('0x17')][_0x6f0333[_0x36ea('0xb4')]][_0x36ea('0x75')]){if(_0x6f0333[_0x36ea('0x148')]==='1'){this[_0x36ea('0xa3')](_0x6f0333,_0x6f0333[_0x36ea('0xb4')],_0x6f0333['cause']);}}};Preview[_0x36ea('0xf')]['addVariable']=function(_0x43551a,_0x24d5af,_0x4928c3){if(this['actions'][_0x43551a]){if(_[_0x36ea('0x6e')](this[_0x36ea('0x17')][_0x43551a][_0x36ea('0x150')])){this[_0x36ea('0x17')][_0x43551a][_0x36ea('0x150')]={};}this[_0x36ea('0x17')][_0x43551a]['variables'][_0x24d5af]=_0x4928c3;}};Preview[_0x36ea('0xf')][_0x36ea('0x21')]=function(_0x5642f7){try{if(!_[_0x36ea('0x6e')](_0x5642f7)){if(ut[_0x36ea('0x151')](_[_0x36ea('0x152')](_0x5642f7['variable'])[0x0])){this[_0x36ea('0x153')](_0x5642f7[_0x36ea('0xb9')],_[_0x36ea('0x152')](_0x5642f7[_0x36ea('0x154')])[0x0],_0x5642f7[_0x36ea('0x155')]);}}}catch(_0x14fcfd){logger['error'](_0x36ea('0x156'),util['inspect'](_0x14fcfd,{'showHidden':![],'depth':null}));}};Preview[_0x36ea('0xf')][_0x36ea('0x23')]=function(_0x5715cd){if(_0x5715cd){if(this['actions'][_0x5715cd['transfertargetlinkedid']]){this['actions'][_0x5715cd[_0x36ea('0x157')]][_0x36ea('0x14d')]=!![];}}};Preview[_0x36ea('0xf')][_0x36ea('0x25')]=function(_0x3c36b6){if(_0x3c36b6){if(this['actions'][_0x3c36b6['transfererlinkedid']]){this[_0x36ea('0x17')][_0x3c36b6[_0x36ea('0x158')]][_0x36ea('0x14d')]=!![];}}};module[_0x36ea('0x159')]=Preview; \ No newline at end of file +var _0x75eb=['hanguprequest','syncHangupRequest','dialend','syncDialEnd','syncNewExten','syncAttendedTransfer','blindtransfer','syncBlindTransfer','type','outbound','name','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','hasOwnProperty','preview','booked','clearZombieChannels','recallMe','clearZombieChannel','enqueue','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking','pick','UserId','VoiceQueueId','ListId','catch','No\x20such\x20channel','updateOriginated','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','size','agentReadyId','isNil','length','getDiff','scheduledat','Agent','voicePause','run','then','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','dialNoSuchNumberRetryFrequency','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','\x20Queue','pTalking:\x20','custom:agentconnect','connect','acw','custom:agentcomplete','complete','answered','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','activeContact','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','rescheduleContact','dialNoAnswerRetryFrequency','countcongestionretry','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','countmachineretry','cause-txt','custom:amd','amd','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','uniqueid','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Congestion','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','lookAgent','isEmpty','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','unlock','unlockContact','disableContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','execCall','SIP/%s/%s%s','trim','dialCutDigit','Contact','substring','phone','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridNumber','merge','toLowerVariables','Action','channelAgent','destconnectedlinenum','calleridnum','user:%s','user:agentconnect','accountcode','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','isFailure','response','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','channelstate','transfer','[syncHangup][talking][cause]','destuniqueid','addVariable','variables','syncVarSet','keys','variable','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','util','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./util/util','redis','defaults','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup'];(function(_0x443f68,_0xd695b7){var _0x50f0e8=function(_0x21edd1){while(--_0x21edd1){_0x443f68['push'](_0x443f68['shift']());}};_0x50f0e8(++_0xd695b7);}(_0x75eb,0x130));var _0xb75e=function(_0x484bd8,_0x36da28){_0x484bd8=_0x484bd8-0x0;var _0x2e0f52=_0x75eb[_0x484bd8];return _0x2e0f52;};'use strict';var util=require(_0xb75e('0x0'));var _=require('lodash');var BPromise=require(_0xb75e('0x1'));var uuid=require(_0xb75e('0x2'));var moment=require(_0xb75e('0x3'));var md5=require(_0xb75e('0x4'));var Redis=require(_0xb75e('0x5'));var config=require(_0xb75e('0x6'));var logger=require(_0xb75e('0x7'))('preview');var loggerAction=require('../../../config/logger')(_0xb75e('0x8'));var ami=require(_0xb75e('0x9'));var rpcDb=require('./rpcDb');var Action=require('./action');var ut=require(_0xb75e('0xa'));config[_0xb75e('0xb')]=_[_0xb75e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb75e('0xd'))(new Redis(config[_0xb75e('0xb')]));var Sequence=function(){};Sequence[_0xb75e('0xe')]['enqueue']=function(_0x3a0eef){this['tail']=this[_0xb75e('0xf')]?this[_0xb75e('0xf')][_0xb75e('0x10')](_0x3a0eef):_0x3a0eef();};function Preview(_0x2c7ce0){this[_0xb75e('0x11')]=new Sequence();this[_0xb75e('0x12')]=_0x2c7ce0[_0xb75e('0x13')];this[_0xb75e('0x14')]=_0x2c7ce0[_0xb75e('0x14')];this[_0xb75e('0x15')]={};this[_0xb75e('0x16')]=_0x2c7ce0[_0xb75e('0x16')];this[_0xb75e('0x17')]=0x0;ami['on'](_0xb75e('0x18'),this[_0xb75e('0x19')][_0xb75e('0x1a')](this));ami['on'](_0xb75e('0x1b'),this[_0xb75e('0x1c')][_0xb75e('0x1a')](this));ami['on'](_0xb75e('0x1d'),this[_0xb75e('0x1e')][_0xb75e('0x1a')](this));ami['on'](_0xb75e('0x1f'),this[_0xb75e('0x20')][_0xb75e('0x1a')](this));ami['on']('newexten',this[_0xb75e('0x21')][_0xb75e('0x1a')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on']('attendedtransfer',this[_0xb75e('0x22')][_0xb75e('0x1a')](this));ami['on'](_0xb75e('0x23'),this[_0xb75e('0x24')][_0xb75e('0x1a')](this));this['loopCampaigns'](this[_0xb75e('0x12')]);}function emit(_0x564323,_0x205193,_0x226759){io['to'](_0x564323)['emit'](_0x205193,_0x226759);}function emitCampaignPreview(_0x57685c){if(_0x57685c[_0xb75e('0x25')]===_0xb75e('0x26')){var _0x258cba={'id':_0x57685c['id'],'name':_0x57685c[_0xb75e('0x27')],'strategy':_0x57685c['strategy'],'answered':_0x57685c['answered'],'available':_0x57685c[_0xb75e('0x28')],'loggedIn':_0x57685c[_0xb75e('0x29')],'pTalking':_0x57685c['pTalking'],'sumBillable':_0x57685c[_0xb75e('0x2a')],'sumDuration':_0x57685c[_0xb75e('0x2b')],'sumHoldTime':_0x57685c[_0xb75e('0x2c')]||0x0,'talking':_0x57685c[_0xb75e('0x2d')],'total':_0x57685c[_0xb75e('0x2e')],'type':_0x57685c[_0xb75e('0x25')],'unmanaged':_0x57685c[_0xb75e('0x2f')],'abandoned':_0x57685c['abandoned'],'waiting':_0x57685c[_0xb75e('0x30')],'loggedInDb':_0x57685c[_0xb75e('0x31')],'dialActive':_0x57685c[_0xb75e('0x32')],'dialMethod':_0x57685c[_0xb75e('0x33')],'dialOriginateCallerIdName':_0x57685c['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x57685c[_0xb75e('0x34')],'dialOriginateTimeout':_0x57685c['dialOriginateTimeout'],'dialPrefix':_0x57685c[_0xb75e('0x35')],'outboundAnswerAgiCallsDay':_0x57685c['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x57685c[_0xb75e('0x36')],'outboundBlacklistCallsDay':_0x57685c[_0xb75e('0x37')],'outboundBusyCallsDay':_0x57685c['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x57685c[_0xb75e('0x38')],'outboundDropCallsDayACS':_0x57685c[_0xb75e('0x39')],'outboundDropCallsDayCallersExit':_0x57685c['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x57685c['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x57685c[_0xb75e('0x3a')],'outboundNoSuchCallsDay':_0x57685c[_0xb75e('0x3b')],'outboundOriginateFailureCallsDay':_0x57685c[_0xb75e('0x3c')],'outboundReCallsDay':_0x57685c[_0xb75e('0x3d')],'outboundRejectCallsDay':_0x57685c[_0xb75e('0x3e')],'outboundUnknownCallsDay':_0x57685c[_0xb75e('0x3f')],'outboundAbandonedCallsDay':_0x57685c['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x57685c[_0xb75e('0x40')],'predictiveIntervalAvgHoldtime':_0x57685c['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x57685c[_0xb75e('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x57685c[_0xb75e('0x42')],'predictiveIntervalDroppedCallsTimeout':_0x57685c['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x57685c['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x57685c['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x57685c[_0xb75e('0x43')],'predictiveIntervalMultiplicativeFactor':_0x57685c[_0xb75e('0x44')],'predictiveIntervalPauses':_0x57685c[_0xb75e('0x45')],'predictiveIntervalAvailable':_0x57685c[_0xb75e('0x46')],'predictiveIntervalTotalCalls':_0x57685c[_0xb75e('0x47')],'message':_0x57685c[_0xb75e('0x48')],'originated':_0x57685c[_0xb75e('0x49')],'erlangCalls':_0x57685c[_0xb75e('0x4a')],'erlangCallToSecond':_0x57685c[_0xb75e('0x4b')],'erlangAbandonmentRate':_0x57685c[_0xb75e('0x4c')],'erlangBusyFactor':_0x57685c[_0xb75e('0x4d')],'startPredictive':_0x57685c[_0xb75e('0x4e')],'startProgressive':_0x57685c['startProgressive']};if(_0x57685c[_0xb75e('0x4f')]){_0x258cba[_0xb75e('0x4f')]={'id':_0x57685c[_0xb75e('0x4f')]['id'],'name':_0x57685c[_0xb75e('0x4f')][_0xb75e('0x27')],'active':_0x57685c[_0xb75e('0x4f')]['active'],'callerid':_0x57685c[_0xb75e('0x4f')][_0xb75e('0x50')]};}if(_0x57685c[_0xb75e('0x51')]){_0x258cba[_0xb75e('0x51')]={'id':_0x57685c[_0xb75e('0x51')]['id'],'name':_0x57685c['Interval'][_0xb75e('0x27')]};}var _0x5d731c=md5(JSON[_0xb75e('0x52')](_0x258cba));if(_0x57685c[_0xb75e('0x4')]!==_0x5d731c){_0x57685c['md5']=_0x5d731c;emit(util[_0xb75e('0x53')](_0xb75e('0x54'),_0x258cba[_0xb75e('0x27')]),_0xb75e('0x55'),_0x258cba);}}}function emitVoiceQueueChannelRemove(_0x3a30b3){logger[_0xb75e('0x56')](_0xb75e('0x57'),JSON[_0xb75e('0x52')](_0x3a30b3));emit(util[_0xb75e('0x53')](_0xb75e('0x54'),_0x3a30b3[_0xb75e('0x27')]),_0xb75e('0x58'),_0x3a30b3);io[_0xb75e('0x59')](_0xb75e('0x5a'),_0x3a30b3);}function notSendMessagesQueue(_0x3b37db){if(_0x3b37db[_0xb75e('0x5b')]){if(_0x3b37db[_0xb75e('0x49')]===0x0&&_0x3b37db['pTalking']===0x0){_0x3b37db[_0xb75e('0x5b')]=![];_0x3b37db[_0xb75e('0x28')]=0x0;_0x3b37db[_0xb75e('0x5c')]=0x0;_0x3b37db['message']=_0xb75e('0x5d');ut[_0xb75e('0x5e')](_0xb75e('0x5f'),_0x3b37db[_0xb75e('0x27')]+_0xb75e('0x60'));}else{_0x3b37db['message']=_0xb75e('0x61');ut[_0xb75e('0x5e')](_0xb75e('0x5f'),_0x3b37db[_0xb75e('0x27')]+'\x20is\x20disactive');}emitCampaignPreview(_0x3b37db);}}Preview[_0xb75e('0xe')]['loopCampaigns']=function(){var _0x4e302c=this;setInterval(function(){_0x4e302c[_0xb75e('0x62')]();},0x7cf);};Preview[_0xb75e('0xe')][_0xb75e('0x62')]=function(){var _0x449b13=this[_0xb75e('0x12')];this['clockClearZombieChannels']+=0x1;for(var _0x5ee4fb in _0x449b13){if(_0x449b13[_0xb75e('0x63')](_0x5ee4fb)&&(_0x449b13[_0x5ee4fb][_0xb75e('0x33')]===_0xb75e('0x64')||_0x449b13[_0x5ee4fb]['dialMethod']===_0xb75e('0x65'))&&_0x449b13[_0x5ee4fb][_0xb75e('0x25')]===_0xb75e('0x26')){if(this[_0xb75e('0x17')]>0x7){this[_0xb75e('0x17')]=0x0;this[_0xb75e('0x66')]();}}if(_0x449b13[_0xb75e('0x63')](_0x5ee4fb)&&_0x449b13[_0x5ee4fb][_0xb75e('0x33')]===_0xb75e('0x64')&&_0x449b13[_0x5ee4fb][_0xb75e('0x25')]===_0xb75e('0x26')){if(_0x449b13[_0x5ee4fb][_0xb75e('0x32')]){this['setMessage'](_0x449b13[_0x5ee4fb]);this[_0xb75e('0x67')](_0x449b13[_0x5ee4fb]);}else{notSendMessagesQueue(_0x449b13[_0x5ee4fb]);}}}};Preview[_0xb75e('0xe')][_0xb75e('0x68')]=function(_0x49fb18){var _0x30468b=this;this[_0xb75e('0x11')][_0xb75e('0x69')](function(){if(!_['isNil'](_0x30468b[_0xb75e('0x15')][_0x49fb18])){loggerAction[_0xb75e('0x56')](_0xb75e('0x6a'),_0x49fb18,_0xb75e('0x6b'),_0x30468b[_0xb75e('0x15')][_0x49fb18][_0xb75e('0x6c')],_0xb75e('0x6d'),JSON[_0xb75e('0x52')](_0x30468b[_0xb75e('0x12')][_0x30468b[_0xb75e('0x15')][_0x49fb18][_0xb75e('0x6c')]][_0xb75e('0x49')]),'pTalking:\x20',JSON[_0xb75e('0x52')](_0x30468b[_0xb75e('0x12')][_0x30468b[_0xb75e('0x15')][_0x49fb18][_0xb75e('0x6c')]][_0xb75e('0x6e')]),JSON[_0xb75e('0x52')](_0x30468b['actions'][_0x49fb18]['dialAnswer']),JSON[_0xb75e('0x52')](_[_0xb75e('0x6f')](_0x30468b['actions'][_0x49fb18],['contactId',_0xb75e('0x70'),_0xb75e('0x71'),_0xb75e('0x72')])));return ami['Action']({'action':'status','channel':_0x30468b[_0xb75e('0x15')][_0x49fb18]['channel']})[_0xb75e('0x73')](function(_0xb8a252){if(_0xb8a252[_0xb75e('0x48')]===_0xb75e('0x74')){setTimeout(function(){if(_0x30468b[_0xb75e('0x15')][_0x49fb18]){ut[_0xb75e('0x75')](_0x30468b[_0xb75e('0x12')][_0x30468b[_0xb75e('0x15')][_0x49fb18][_0xb75e('0x6c')]],'[clearZombieChannel]');if(_0x30468b['actions'][_0x49fb18][_0xb75e('0x76')]===!![]){ut[_0xb75e('0x77')](_0x30468b[_0xb75e('0x12')][_0x30468b[_0xb75e('0x15')][_0x49fb18][_0xb75e('0x6c')]],_0xb75e('0x78'));ut[_0xb75e('0x79')](_0xb75e('0x7a')+_0x49fb18,_0x30468b[_0xb75e('0x15')][_0x49fb18][_0xb75e('0x6c')]);}ut[_0xb75e('0x79')]('[Dialer][checkChannel][Preview]'+_0x49fb18,_0x30468b[_0xb75e('0x15')][_0x49fb18][_0xb75e('0x6c')]);delete _0x30468b[_0xb75e('0x15')][_0x49fb18];}},0x2328);}});}});};Preview[_0xb75e('0xe')][_0xb75e('0x66')]=function(){var _0x3fc105=this;loggerAction[_0xb75e('0x56')](_0xb75e('0x7b'),_[_0xb75e('0x7c')](this[_0xb75e('0x15')]));for(var _0x154c78 in this[_0xb75e('0x15')]){if(_0x3fc105[_0xb75e('0x15')][_0xb75e('0x63')](_0x154c78)){_0x3fc105[_0xb75e('0x68')](_0x154c78);}}};Preview[_0xb75e('0xe')][_0xb75e('0x67')]=function(_0x257560){var _0xaef59c=this;rpcDb['getContactRecallMe'](_0x257560['id'],ut[_0xb75e('0x7d')](this['agents']))['then'](function(_0x1f9dbf){if(!_[_0xb75e('0x7e')](_0x1f9dbf)){for(var _0xf07548=0x0;_0xf07548<_0x1f9dbf[_0xb75e('0x7f')];_0xf07548+=0x1){if(ut[_0xb75e('0x80')](_0x1f9dbf[_0xf07548][_0xb75e('0x81')])<_0x257560['dialRecallMeTimeout']*0x3c){if(_0x1f9dbf[_0xf07548][_0xb75e('0x82')]&&!_0x1f9dbf[_0xf07548][_0xb75e('0x82')][_0xb75e('0x83')]){_0xaef59c[_0xb75e('0x84')](_0x1f9dbf[_0xf07548]['id'])[_0xb75e('0x85')](ut[_0xb75e('0x86')](_0xb75e('0x87')))[_0xb75e('0x73')](ut[_0xb75e('0x86')](_0xb75e('0x87')));}else{rpcDb['disableContact'](_0x1f9dbf[_0xf07548]['id']);}}else{var _0x21f983=new Action(_0x1f9dbf[_0xf07548],_0x257560);_0x21f983[_0xb75e('0x88')]=moment()['format'](_0xb75e('0x89'));_0x257560[_0xb75e('0x3d')]+=0x1;ut['logCustomer'](_0x21f983,0x17,'RecallInQueue');if(_0x257560[_0xb75e('0x8a')]){rpcDb[_0xb75e('0x8b')](ut[_0xb75e('0x8c')](_0x1f9dbf[_0xf07548]));rpcDb[_0xb75e('0x8d')](_0x21f983,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xb75e('0x8e')](_0x21f983,0x16,_0xb75e('0x8f'));rpcDb[_0xb75e('0x8d')](_0x21f983,_0xb75e('0x90'));rpcDb[_0xb75e('0x91')](_0x21f983,_0xb75e('0x90'));}}}}})[_0xb75e('0x73')](ut[_0xb75e('0x86')](_0xb75e('0x92')));};Preview[_0xb75e('0xe')][_0xb75e('0x93')]=function(_0x42c1a7){_0x42c1a7[_0xb75e('0x5b')]=!![];if(ut[_0xb75e('0x94')](_0x42c1a7[_0xb75e('0x29')])){_0x42c1a7[_0xb75e('0x48')]='AGENTS_NOT_LOGGED';}else if(!ut[_0xb75e('0x95')](_0x42c1a7['dialActive'])){_0x42c1a7['message']=_0xb75e('0x5d');}else if(!this[_0xb75e('0x96')](_0x42c1a7[_0xb75e('0x4f')])){if(!this['isTrunkReachable'](_0x42c1a7[_0xb75e('0x97')])){_0x42c1a7[_0xb75e('0x48')]='TRUNK_IS_NOT_REACHABLE';}else{_0x42c1a7['message']=_0xb75e('0x98');}}else{_0x42c1a7[_0xb75e('0x48')]='ACTIVE';}emitCampaignPreview(_0x42c1a7);};Preview[_0xb75e('0xe')][_0xb75e('0x99')]=function(_0x51e0d1,_0x6328c7,_0x3ee4b0){var _0x16cd1a=this;var _0x2b1edc=this[_0xb75e('0x15')][_0x6328c7];var _0x163dea=this[_0xb75e('0x12')][_0x2b1edc[_0xb75e('0x6c')]];var _0x59cb0e;if(_0x163dea){switch(_0x3ee4b0){case'1':_0x163dea[_0xb75e('0x3b')]+=0x1;_0x2b1edc[_0xb75e('0x9a')]+=0x1;_0x2b1edc[_0xb75e('0x9b')]=ut[_0xb75e('0x9c')](_0x2b1edc);ut['logCustomer'](_0x2b1edc,0x0,_0xb75e('0x9d'));ami[_0xb75e('0x59')](_0xb75e('0x9e'),ut[_0xb75e('0x9f')](_0x2b1edc,_0xb75e('0xa0')));rpcDb[_0xb75e('0x8d')](_0x2b1edc,_0xb75e('0xa1'));if(ut[_0xb75e('0x9c')](_0x2b1edc)>=_0x163dea[_0xb75e('0xa2')]){_0x59cb0e=ut['cloneAction'](_0x2b1edc,0xf,_0xb75e('0xa3'));rpcDb[_0xb75e('0x91')](_0x59cb0e,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x2b1edc[_0xb75e('0x9a')]>=_0x163dea[_0xb75e('0xa4')]){rpcDb[_0xb75e('0x91')](_0x2b1edc,_0xb75e('0xa5'));}else{rpcDb['rescheduleContact'](ut[_0xb75e('0xa6')](_0x2b1edc,_0xb75e('0x9a'),_0x163dea[_0xb75e('0xa7')]),_0x2b1edc['unlockAgent'],_0x2b1edc['activeContact']);}}delete this[_0xb75e('0x15')][_0x51e0d1[_0xb75e('0xa8')]];break;case _0xb75e('0xa9'):var _0x47bac8=moment()['format'](_0xb75e('0x89'));_0x2b1edc['responsetime']=_0x47bac8;_0x2b1edc[_0xb75e('0xaa')]=_0x47bac8;_0x2b1edc[_0xb75e('0x76')]=!![];_0x163dea[_0xb75e('0x6e')]+=0x1;logger[_0xb75e('0x56')](_0xb75e('0xab'),_0x2b1edc['uniqueid'],_0xb75e('0xac'),_0x163dea['name'],_0xb75e('0xad'),_0x163dea[_0xb75e('0x6e')]);ami['emit'](_0xb75e('0xae'),ut['buildObj'](_0x2b1edc,_0xb75e('0xaf'),this['campaignsPreview'][_0x2b1edc['queue']]));if(_0x163dea[_0xb75e('0xb0')]){ami[_0xb75e('0x59')]('custom:agentConnectPreview',ut['buildAcw'](_0x2b1edc));}break;case'16':ami[_0xb75e('0x59')](_0xb75e('0xb1'),ut[_0xb75e('0x9f')](_0x2b1edc,'complete',this['campaignsPreview'][_0x2b1edc['queue']]));emitVoiceQueueChannelRemove(ut[_0xb75e('0x9f')](_0x2b1edc,_0xb75e('0xb2')));_0x163dea['outboundAnswerCallsDay']+=0x1;_0x163dea[_0xb75e('0x2e')]+=0x1;_0x163dea[_0xb75e('0xb3')]+=0x1;ut[_0xb75e('0x77')](_0x163dea,'[16]');_0x2b1edc['countglobal']=ut['totalGlobal'](_0x2b1edc);ut[_0xb75e('0x8e')](_0x2b1edc,0x4,_0xb75e('0xb4'));rpcDb[_0xb75e('0x8d')](_0x2b1edc,_0xb75e('0xb5'));rpcDb[_0xb75e('0x91')](_0x2b1edc,_0xb75e('0xb6'));rpcDb[_0xb75e('0xb7')](_0x2b1edc);_0x163dea['sumDuration']+=_0x2b1edc[_0xb75e('0xb8')];_0x163dea[_0xb75e('0x2a')]+=_0x2b1edc[_0xb75e('0xb8')];logger[_0xb75e('0x56')](_0xb75e('0xb9'),_0x2b1edc['uniqueid'],'\x20Queue',_0x163dea[_0xb75e('0x27')],_0xb75e('0xad'),_0x163dea[_0xb75e('0x6e')]);delete this[_0xb75e('0x15')][_0x51e0d1[_0xb75e('0xa8')]];break;case _0xb75e('0xba'):_0x163dea[_0xb75e('0xbb')]+=0x1;_0x2b1edc[_0xb75e('0xbc')]+=0x1;_0x2b1edc[_0xb75e('0x9b')]=ut[_0xb75e('0x9c')](_0x2b1edc);ut[_0xb75e('0x8e')](_0x2b1edc,0x5,_0xb75e('0xbd'));ami[_0xb75e('0x59')]('custom:agentbusy',ut['buildObj'](_0x2b1edc,_0xb75e('0xbe')));rpcDb[_0xb75e('0x8d')](_0x2b1edc,_0xb75e('0xbf'));if(ut[_0xb75e('0x9c')](_0x2b1edc)>=_0x163dea[_0xb75e('0xa2')]){_0x59cb0e=ut[_0xb75e('0xc0')](_0x2b1edc,0xf,_0xb75e('0xa3'));rpcDb[_0xb75e('0x91')](_0x59cb0e,_0xb75e('0xc1'));}else{if(_0x2b1edc['countbusyretry']>=_0x163dea[_0xb75e('0xc2')]){rpcDb['createCustomerFinal'](_0x2b1edc,_0xb75e('0xbf'));}else{rpcDb['rescheduleContact'](ut[_0xb75e('0xa6')](_0x2b1edc,'countbusyretry',_0x163dea[_0xb75e('0xc3')]),_0x2b1edc[_0xb75e('0xc4')],_0x2b1edc[_0xb75e('0xc5')]);}}break;case _0xb75e('0xc6'):_0x163dea[_0xb75e('0x3a')]+=0x1;_0x2b1edc[_0xb75e('0xc7')]+=0x1;_0x2b1edc['countglobal']=ut[_0xb75e('0x9c')](_0x2b1edc);ut[_0xb75e('0x8e')](_0x2b1edc,0x3,_0xb75e('0xc8'));ami[_0xb75e('0x59')]('custom:agentnoanswer',ut['buildObj'](_0x2b1edc,'noanswer'));rpcDb[_0xb75e('0x8d')](_0x2b1edc,_0xb75e('0xc9'));if(ut[_0xb75e('0x9c')](_0x2b1edc)>=_0x163dea[_0xb75e('0xa2')]){_0x59cb0e=ut['cloneAction'](_0x2b1edc,0xf,_0xb75e('0xa3'));rpcDb[_0xb75e('0x91')](_0x59cb0e,_0xb75e('0xca'));}else{if(_0x2b1edc['countnoanswerretry']>=_0x163dea[_0xb75e('0xcb')]){rpcDb['createCustomerFinal'](_0x2b1edc,_0xb75e('0xc9'));}else{rpcDb[_0xb75e('0xcc')](ut[_0xb75e('0xa6')](_0x2b1edc,'countnoanswerretry',_0x163dea[_0xb75e('0xcd')]),_0x2b1edc['unlockAgent'],_0x2b1edc[_0xb75e('0xc5')]);}}break;case'CONGESTION':_0x163dea[_0xb75e('0x38')]+=0x1;_0x2b1edc[_0xb75e('0xce')]+=0x1;_0x2b1edc[_0xb75e('0x9b')]=ut[_0xb75e('0x9c')](_0x2b1edc);ut[_0xb75e('0x8e')](_0x2b1edc,0x8,'Congestion');ami['emit']('custom:agentcongestion',ut[_0xb75e('0x9f')](_0x2b1edc,_0xb75e('0xcf')));rpcDb[_0xb75e('0x8d')](_0x2b1edc,_0xb75e('0xd0'));if(ut[_0xb75e('0x9c')](_0x2b1edc)>=_0x163dea['dialGlobalMaxRetry']){_0x59cb0e=ut['cloneAction'](_0x2b1edc,0xf,_0xb75e('0xa3'));rpcDb[_0xb75e('0x91')](_0x59cb0e,_0xb75e('0xd1'));}else{if(_0x2b1edc[_0xb75e('0xce')]>=_0x163dea['dialCongestionMaxRetry']){rpcDb[_0xb75e('0x91')](_0x2b1edc,_0xb75e('0xd0'));}else{rpcDb[_0xb75e('0xcc')](ut[_0xb75e('0xa6')](_0x2b1edc,_0xb75e('0xce'),_0x163dea[_0xb75e('0xc3')]),_0x2b1edc[_0xb75e('0xc4')],_0x2b1edc[_0xb75e('0xc5')]);}}break;case'CANCEL':_0x163dea[_0xb75e('0x3e')]+=0x1;_0x2b1edc['countagentrejectretry']+=0x1;_0x2b1edc[_0xb75e('0x9b')]=ut[_0xb75e('0x9c')](_0x2b1edc);ut['logCustomer'](_0x2b1edc,0x14,_0xb75e('0xd2'));ami[_0xb75e('0x59')](_0xb75e('0xd3'),ut['buildObj'](_0x2b1edc,_0xb75e('0xd4')));rpcDb[_0xb75e('0x8d')](_0x2b1edc,_0xb75e('0xd5'));if(ut[_0xb75e('0x9c')](_0x2b1edc)>=_0x163dea['dialGlobalMaxRetry']){_0x59cb0e=ut[_0xb75e('0xc0')](_0x2b1edc,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x59cb0e,_0xb75e('0xd6'));}else{if(_0x2b1edc[_0xb75e('0xd7')]>=_0x163dea[_0xb75e('0xd8')]){rpcDb[_0xb75e('0x91')](_0x2b1edc,_0xb75e('0xd6'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x2b1edc,_0xb75e('0xd7'),_0x163dea[_0xb75e('0xd9')]),_0x2b1edc[_0xb75e('0xc4')],_0x2b1edc[_0xb75e('0xc5')]);}}break;case _0xb75e('0xda'):_0x163dea[_0xb75e('0xdb')]+=0x1;_0x2b1edc['countabandonedretry']+=0x1;_0x2b1edc[_0xb75e('0x9b')]=ut[_0xb75e('0x9c')](_0x2b1edc);ut['logCustomer'](_0x2b1edc,0xb,_0xb75e('0xdc'));rpcDb[_0xb75e('0x8d')](_0x2b1edc,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xb75e('0x9c')](_0x2b1edc)>=_0x163dea['dialGlobalMaxRetry']){_0x59cb0e=ut[_0xb75e('0xc0')](_0x2b1edc,0xf,_0xb75e('0xa3'));rpcDb[_0xb75e('0x91')](_0x59cb0e,_0xb75e('0xdd'));}else{if(_0x2b1edc[_0xb75e('0xde')]>=_0x163dea[_0xb75e('0xdf')]){rpcDb[_0xb75e('0x91')](_0x2b1edc,_0xb75e('0xdd'));}else{rpcDb['rescheduleContact'](ut[_0xb75e('0xa6')](_0x2b1edc,_0xb75e('0xe0'),_0x163dea['dialAbandonedRetryFrequency']),_0x2b1edc['unlockAgent'],_0x2b1edc['activeContact']);}}break;case'18':_0x163dea['outboundUnknownCallsDay']+=0x1;_0x2b1edc[_0xb75e('0xe1')]+=0x1;_0x2b1edc[_0xb75e('0x9b')]=ut[_0xb75e('0x9c')](_0x2b1edc);ut['logCustomer'](_0x2b1edc,0x12,_0x51e0d1[_0xb75e('0xe2')]||_0x51e0d1['dialstatus']);ami[_0xb75e('0x59')](_0xb75e('0xe3'),ut['buildObj'](_0x2b1edc,_0xb75e('0xe4')));rpcDb[_0xb75e('0x8d')](_0x2b1edc,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0xb75e('0x9c')](_0x2b1edc)>=_0x163dea[_0xb75e('0xa2')]){_0x59cb0e=ut['cloneAction'](_0x2b1edc,0xf,_0xb75e('0xa3'));rpcDb[_0xb75e('0x91')](_0x59cb0e,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x2b1edc,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0xb75e('0x15')][_0x51e0d1[_0xb75e('0xa8')]];break;case'19':_0x163dea[_0xb75e('0x3f')]+=0x1;_0x2b1edc[_0xb75e('0x9b')]=ut[_0xb75e('0x9c')](_0x2b1edc);ut[_0xb75e('0x8e')](_0x2b1edc,0x13,_0x51e0d1[_0xb75e('0xe2')]||_0x51e0d1[_0xb75e('0xe5')]);ami[_0xb75e('0x59')](_0xb75e('0xe3'),ut['buildObj'](_0x2b1edc,_0xb75e('0xe4')));rpcDb[_0xb75e('0x8d')](_0x2b1edc,_0xb75e('0xe6'));if(ut[_0xb75e('0x9c')](_0x2b1edc)>=_0x163dea[_0xb75e('0xa2')]){_0x59cb0e=ut[_0xb75e('0xc0')](_0x2b1edc,0xf,'Global');rpcDb[_0xb75e('0x91')](_0x59cb0e,_0xb75e('0xe6'));}else{rpcDb[_0xb75e('0x91')](_0x2b1edc,'[callProgressDetectingCustomer][machine]');}delete this[_0xb75e('0x15')][_0x51e0d1[_0xb75e('0xa8')]];break;default:if(_0x2b1edc[_0xb75e('0x76')]){ut[_0xb75e('0x77')](_0x163dea,_0xb75e('0xe7'));ut[_0xb75e('0x79')](_0xb75e('0xe8')+_0x163dea[_0xb75e('0x27')],_0x51e0d1);}_0x163dea[_0xb75e('0x3f')]+=0x1;_0x2b1edc['countglobal']=ut['totalGlobal'](_0x2b1edc);ut[_0xb75e('0x8e')](_0x2b1edc,0xc,_0x51e0d1[_0xb75e('0xe2')]||_0x51e0d1[_0xb75e('0xe5')]);rpcDb['createCustomerHistory'](_0x2b1edc,_0xb75e('0xe9'));if(ut[_0xb75e('0x9c')](_0x2b1edc)>=_0x163dea['dialGlobalMaxRetry']){_0x59cb0e=ut['cloneAction'](_0x2b1edc,0xf,_0xb75e('0xa3'));rpcDb[_0xb75e('0x91')](_0x59cb0e,_0xb75e('0xea'));}else{rpcDb[_0xb75e('0x91')](_0x2b1edc,_0xb75e('0xea'));}delete this['actions'][_0x51e0d1[_0xb75e('0xa8')]];}if(!(_0x2b1edc[_0xb75e('0x76')]&&_0x3ee4b0==='16')){ut[_0xb75e('0x75')](_0x163dea,'[callProgressDetectingCustomer]');logger[_0xb75e('0x56')](_0xb75e('0xeb'),_0x2b1edc[_0xb75e('0xec')],'\x20Queue',_0x163dea[_0xb75e('0x27')],_0xb75e('0x6d'),_0x163dea['originated']);}if(_0x3ee4b0!==_0xb75e('0xa9')){delete this[_0xb75e('0x15')][_0x51e0d1[_0xb75e('0xa8')]];delete this[_0xb75e('0x15')][_0x51e0d1[_0xb75e('0xed')]];}}};Preview['prototype'][_0xb75e('0xee')]=function(_0x3757b1,_0x42d91f,_0x2a47e8){if(_[_0xb75e('0xef')](_0x42d91f)&&_0xb75e('0xf0')!==typeof _0x42d91f){return;}if(_['isUndefined'](_0x2a47e8)&&_0xb75e('0xf0')!==typeof _0x2a47e8){return;}switch(_0x2a47e8['reason']){case'0':ut[_0xb75e('0xf1')](_0x3757b1,0x0,_0xb75e('0x9d'));rpcDb[_0xb75e('0xf2')](_0x3757b1,_0xb75e('0xf3'));break;case'3':ut['logAgent'](_0x3757b1,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x3757b1,_0xb75e('0xf4'));break;case'5':ut[_0xb75e('0xf1')](_0x3757b1,0x5,_0xb75e('0xbd'));rpcDb[_0xb75e('0xf2')](_0x3757b1,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xb75e('0xf1')](_0x3757b1,0x8,_0xb75e('0xf5'));rpcDb[_0xb75e('0xf2')](_0x3757b1,_0xb75e('0xf6'));break;case'22':ut[_0xb75e('0xf1')](_0x3757b1,0x16,'AnswerAGI');rpcDb[_0xb75e('0xf2')](_0x3757b1,_0xb75e('0xf7'));break;default:ut[_0xb75e('0xf1')](_0x3757b1,0xc,_0x2a47e8[_0xb75e('0xf8')]);rpcDb[_0xb75e('0xf2')](_0x3757b1,_0xb75e('0xf6'));}ut['updateOriginated'](_0x42d91f,_0xb75e('0xf9'));logger[_0xb75e('0x56')](_0xb75e('0xfa'),_0x3757b1[_0xb75e('0xec')],'\x20Queue',_0x42d91f[_0xb75e('0x27')],_0xb75e('0x6d'),_0x42d91f[_0xb75e('0x49')]);delete this[_0xb75e('0x15')][_0x3757b1[_0xb75e('0xec')]];};Preview['prototype'][_0xb75e('0xfb')]=function(_0x432cf0,_0xe621ac,_0x2e2873,_0xab3324,_0x3c5d52){var _0x59724e=this;return new BPromise(function(_0x1222de,_0x18cfe4){if(_[_0xb75e('0x7e')](_0xe621ac)||_['isNil'](_0xe621ac['Contact'])||_[_0xb75e('0x7e')](_0xe621ac['Contact']['phone'])||_[_0xb75e('0x7e')](_0xe621ac[_0xb75e('0x71')])){_0x18cfe4(ut[_0xb75e('0x48')]('Contact\x20is\x20undefined',_0xab3324,_0x3c5d52));return;}var _0x1e4787=uuid['v4']();var _0x441166=_0x59724e['campaignsPreview'][_0xe621ac[_0xb75e('0x6b')]['name']];var _0x1c4540=_0x2e2873?_0x59724e[_0xb75e('0x16')][_0x2e2873]['id']:undefined;_0x59724e[_0xb75e('0x15')][_0x1e4787]=new Action(_0xe621ac,_0x441166,_0x1e4787,_0x2e2873,_0x1c4540);var _0x325c64=_0x59724e[_0xb75e('0x15')][_0x1e4787];_0x325c64[_0xb75e('0xc4')]=_0xab3324;_0x325c64[_0xb75e('0xc5')]=_0x3c5d52;_0x325c64[_0xb75e('0xfc')]=_0x2e2873;if(_[_0xb75e('0xfd')](_0x432cf0)){_0x59724e['execCall'](_0x325c64,_0x441166,_0xe621ac,_0x2e2873)[_0xb75e('0x85')](function(_0x165dec){logger[_0xb75e('0x56')](_0xb75e('0xfe'),'Queue:\x20'+_0x325c64[_0xb75e('0x6c')]+_0xb75e('0xff')+_0x325c64['idContact'],JSON[_0xb75e('0x52')](_0x165dec));ami['emit'](_0xb75e('0x100'),ut[_0xb75e('0x9f')](_0x325c64,_0xb75e('0x101'),_0x59724e['campaignsPreview'][_0x325c64[_0xb75e('0x6c')]]));_0x1222de(ut[_0xb75e('0x48')]('Calling'));})[_0xb75e('0x73')](function(_0x254492){ut[_0xb75e('0x5e')](_0xb75e('0x102'),_0x254492);_0x18cfe4(ut[_0xb75e('0x48')]('Call\x20failed',_0xab3324,_0x3c5d52));});}else{_0x441166[_0xb75e('0x37')]+=0x1;ut['logBlacklist'](_0x325c64);rpcDb['createHistory'](_0x325c64,_0xb75e('0x103'));delete _0x59724e[_0xb75e('0x15')][_0x1e4787];_0x18cfe4(ut[_0xb75e('0x48')](_0xb75e('0x104'),_0xab3324,_0x3c5d52));}});};Preview[_0xb75e('0xe')][_0xb75e('0x96')]=function(_0x2bb4fb){return!_[_0xb75e('0x7e')](_0x2bb4fb)&&!_[_0xb75e('0x7e')](_0x2bb4fb['name'])&&!_[_0xb75e('0x7e')](_0x2bb4fb[_0xb75e('0x105')])&&_0x2bb4fb[_0xb75e('0x105')]&&!_[_0xb75e('0x7e')](this[_0xb75e('0x14')][util[_0xb75e('0x53')](_0xb75e('0x106'),_0x2bb4fb[_0xb75e('0x27')])])&&!_[_0xb75e('0x7e')](this['trunks'][util[_0xb75e('0x53')]('SIP/%s',_0x2bb4fb[_0xb75e('0x27')])]['status'])&&(this[_0xb75e('0x14')][util[_0xb75e('0x53')](_0xb75e('0x106'),_0x2bb4fb[_0xb75e('0x27')])][_0xb75e('0x107')]===_0xb75e('0x108')||this[_0xb75e('0x14')][util[_0xb75e('0x53')](_0xb75e('0x106'),_0x2bb4fb[_0xb75e('0x27')])][_0xb75e('0x107')]===_0xb75e('0x109'));};Preview[_0xb75e('0xe')][_0xb75e('0x84')]=function(_0xb011b,_0x12edd2){var _0x5b848e=this;return new BPromise(function(_0xd5403,_0x723d02){_0x5b848e['execRun'](_0xb011b,_0x12edd2)['then'](function(_0x3692b3){_0xd5403(_['pick'](_0x3692b3,[_0xb75e('0x48')]));})[_0xb75e('0x73')](function(_0x1f2a5a){if(_0x1f2a5a[_0xb75e('0x10a')]){rpcDb[_0xb75e('0x10b')](_0xb011b);}if(_0x1f2a5a[_0xb75e('0x105')]){rpcDb[_0xb75e('0x10c')](_0xb011b);}_0x723d02(_[_0xb75e('0x6f')](_0x1f2a5a,[_0xb75e('0x48')]));});});};Preview[_0xb75e('0xe')]['execRun']=function(_0x2ae136,_0x3d3165){var _0x2af4a4=this;return new BPromise(function(_0x4c0162,_0x5c4641){var _0x54ed74,_0x4e5a49;rpcDb[_0xb75e('0x10d')](_0x2ae136)['then'](function(_0x14126b){if(!_[_0xb75e('0x7e')](_0x14126b[0x0])){_0x4e5a49=_0x14126b[0x0][_0xb75e('0x10e')]?![]:!![];_0x54ed74=_0x14126b[0x0][_0xb75e('0x10e')]?!![]:![];_0x54ed74=_0x3d3165?!![]:_0x54ed74;}var _0x34889d=_0x2af4a4[_0xb75e('0x10f')](_0x14126b);if(_0x34889d[_0xb75e('0x110')]){rpcDb[_0xb75e('0x111')](_[_0xb75e('0x6f')](_0x14126b[0x0],[_0xb75e('0x71'),'Contact.phone']))['then'](function(_0x126e2e){_0x2af4a4['checkInBlack'](_0x126e2e,_0x14126b[0x0],_0x3d3165,_0x4e5a49,_0x54ed74)[_0xb75e('0x85')](function(_0x5da55d){_0x4c0162(_0x5da55d);})[_0xb75e('0x73')](function(_0x194a93){_0x5c4641(_0x194a93);});})['catch'](function(_0x616a40){ut[_0xb75e('0x5e')](_0xb75e('0x112'),_0x616a40);_0x5c4641(ut[_0xb75e('0x48')](_0xb75e('0x113'),_0x4e5a49,_0x54ed74));});}else{_0x5c4641(ut[_0xb75e('0x48')](_0x34889d[_0xb75e('0x48')],_0x4e5a49,_0x54ed74));}})[_0xb75e('0x73')](function(_0x540675){ut[_0xb75e('0x5e')](_0xb75e('0x114'),_0x540675);_0x5c4641(ut['message'](_0xb75e('0x113'),![],!![]));});});};Preview[_0xb75e('0xe')][_0xb75e('0x10f')]=function(_0x42bbc1){if(_[_0xb75e('0x7e')](_0x42bbc1)||_[_0xb75e('0xfd')](_0x42bbc1)||!_['isNil'](_0x42bbc1[0x0]['Agent'])&&_['isNil'](_0x42bbc1[0x0][_0xb75e('0x82')]['name'])){ut[_0xb75e('0x5e')](_0xb75e('0x115'),_0x42bbc1);return{'isValid':![],'message':_0xb75e('0x116')};}var _0x2fe533=this[_0xb75e('0x12')][_0x42bbc1[0x0][_0xb75e('0x6b')]['name']];_0x2fe533[_0xb75e('0x48')]=_0xb75e('0x98');if(_[_0xb75e('0x7e')](_0x2fe533)){ut[_0xb75e('0x5e')](_0xb75e('0x117'),_0x2fe533);return{'isValid':![],'message':_0xb75e('0x118')};}if(!this[_0xb75e('0x96')](_0x2fe533[_0xb75e('0x4f')])){ut[_0xb75e('0x5e')](_0xb75e('0x119'),_0xb75e('0x11a')+_0x2fe533[_0xb75e('0x27')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xb75e('0x96')](_0x2fe533[_0xb75e('0x97')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x2fe533[_0xb75e('0x27')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0xb75e('0x95')](_0x2fe533[_0xb75e('0x32')])){ut[_0xb75e('0x5e')](_0xb75e('0x11b'),_0x2fe533[_0xb75e('0x27')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x2fe533['name']+_0xb75e('0x11c')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xb75e('0xe')][_0xb75e('0x11d')]=function(_0x549227,_0x2b5c18,_0x210cfe,_0x573911){var _0x31647c=this;return new BPromise(function(_0x58f8d8,_0xc68eae){var _0x5d9f31=_0x549227[_0xb75e('0xec')];var _0x205742=_0x31647c['isTrunkReachable'](_0x2b5c18['Trunk'])?util[_0xb75e('0x53')](_0xb75e('0x11e'),_0x2b5c18[_0xb75e('0x4f')][_0xb75e('0x27')],_[_0xb75e('0x7e')](_0x2b5c18['dialPrefix'])?'':_0x2b5c18[_0xb75e('0x35')][_0xb75e('0x11f')]()||'',_0x2b5c18[_0xb75e('0x120')]>0x0?_0x210cfe[_0xb75e('0x121')]['phone'][_0xb75e('0x122')](_0x2b5c18[_0xb75e('0x120')]):_0x210cfe[_0xb75e('0x121')][_0xb75e('0x123')]):util[_0xb75e('0x53')](_0xb75e('0x11e'),_['isNil'](_0x2b5c18[_0xb75e('0x97')])?_0x2b5c18[_0xb75e('0x4f')][_0xb75e('0x27')]:_0x2b5c18[_0xb75e('0x97')][_0xb75e('0x27')],_['isNil'](_0x2b5c18[_0xb75e('0x35')])?'':_0x2b5c18[_0xb75e('0x35')][_0xb75e('0x11f')]()||'',_0x2b5c18[_0xb75e('0x120')]>0x0?_0x210cfe['Contact']['phone']['substring'](_0x2b5c18[_0xb75e('0x120')]):_0x210cfe['Contact'][_0xb75e('0x123')]);var _0x4975f2=_0x31647c[_0xb75e('0x96')](_0x2b5c18[_0xb75e('0x4f')])?ut[_0xb75e('0x124')](_0x2b5c18[_0xb75e('0x4f')][_0xb75e('0x50')],_0x2b5c18[_0xb75e('0x125')],_0x2b5c18[_0xb75e('0x126')]>0x0?ut['getCallerIdRandom'](_0x2b5c18[_0xb75e('0x34')],_0x2b5c18[_0xb75e('0x126')]):_0x2b5c18[_0xb75e('0x34')]):ut['getCallerId'](_['isNil'](_0x2b5c18['TrunkBackup'])?_0x2b5c18[_0xb75e('0x4f')][_0xb75e('0x50')]:_0x2b5c18[_0xb75e('0x97')][_0xb75e('0x50')],_0x2b5c18[_0xb75e('0x125')],_0x2b5c18[_0xb75e('0x126')]>0x0?ut['getCallerIdRandom'](_0x2b5c18['dialOriginateCallerIdNumber'],_0x2b5c18['dialRandomLastDigitCallerIdNumber']):_0x2b5c18[_0xb75e('0x34')]);if(_0x4975f2){_0x549227[_0xb75e('0x127')]=ut['extractCalleridName'](_0x4975f2);_0x549227['originatecalleridnum']=ut[_0xb75e('0x128')](_0x4975f2);}var _0x9001b9=ut['addVariables'](_0x2b5c18,_0x210cfe,_0x205742,_0x4975f2,_0x5d9f31,_0x549227);_[_0xb75e('0x129')](_0x549227,ut[_0xb75e('0x12a')](_0x9001b9));_0x549227[_0xb75e('0x88')]=moment()['format'](_0xb75e('0x89'));ami[_0xb75e('0x12b')](ut['variablesAction'](_0x549227,_0x2b5c18,_0x9001b9,_0x549227[_0xb75e('0xc5')],_0x573911))['then'](function(_0x4dfa15){var _0x54ce57=_0x549227[_0xb75e('0x12c')];if(!_[_0xb75e('0x7e')](_0x54ce57)){if(!_['isNil'](_0x31647c['agents'][_0x54ce57])){_0x31647c[_0xb75e('0x16')][_0x54ce57][_0xb75e('0x12d')]=_0x549227[_0xb75e('0x12e')];emit(util['format'](_0xb75e('0x12f'),_0x31647c[_0xb75e('0x16')][_0x54ce57][_0xb75e('0x27')]),_0xb75e('0x130'),{'destaccountcode':_0x31647c[_0xb75e('0x16')][_0x54ce57][_0xb75e('0x131')],'destconnectedlinenum':_0x549227[_0xb75e('0x12e')]});}}_0x2b5c18[_0xb75e('0x49')]+=0x1;logger[_0xb75e('0x56')](_0xb75e('0x132'),_0x5d9f31,_0xb75e('0xac'),_0x2b5c18[_0xb75e('0x27')],_0xb75e('0x6d'),_0x2b5c18[_0xb75e('0x49')]);_0x58f8d8(_0x4dfa15);})[_0xb75e('0x73')](function(_0x58fa4b){ut[_0xb75e('0xf1')](_0x549227,0xe,_0xb75e('0x133'));rpcDb[_0xb75e('0xf2')](_0x549227,_0xb75e('0x134'));_0xc68eae(_0x58fa4b);});});};Preview[_0xb75e('0xe')][_0xb75e('0x21')]=function(_0x3855af){if(this[_0xb75e('0x15')][_0x3855af[_0xb75e('0xa8')]]){this[_0xb75e('0x15')][_0x3855af[_0xb75e('0xa8')]][_0xb75e('0x135')]=_0x3855af['channel'];}};Preview[_0xb75e('0xe')][_0xb75e('0x19')]=function(_0x1e4f9a){var _0x4ada2b=this;var _0x72f0cb=this[_0xb75e('0x15')][_0x1e4f9a[_0xb75e('0x136')]];if(_0x72f0cb){if(_0x72f0cb['lookAgent']&&this[_0xb75e('0x16')][_0x72f0cb[_0xb75e('0xfc')]]){ut['logLookAgent'](_0x72f0cb,this[_0xb75e('0x16')][_0x72f0cb[_0xb75e('0xfc')]][_0xb75e('0x27')],this['agents'][_0x72f0cb[_0xb75e('0xfc')]]['id']);}var _0x5773b4=_['clone'](_0x72f0cb);_0x5773b4['responsetime']=moment()['format'](_0xb75e('0x89'));var _0x455b48=_0x4ada2b[_0xb75e('0x12')][_0x72f0cb['queue']];if(ut[_0xb75e('0x137')](_0x1e4f9a[_0xb75e('0x138')])){if(_0x72f0cb[_0xb75e('0xc4')]){rpcDb[_0xb75e('0x10b')](_0x72f0cb[_0xb75e('0x139')]);}if(_0x72f0cb[_0xb75e('0xc5')]){rpcDb[_0xb75e('0x10c')](_0x72f0cb['idContact']);}ami[_0xb75e('0x59')](_0xb75e('0x13a'),ut['buildObj'](_0x72f0cb,_0xb75e('0x13b'),this['campaignsPreview'][_0x72f0cb[_0xb75e('0x6c')]]));this['callProgressDetectingAgent'](_0x5773b4,_0x455b48,_0x1e4f9a);}else{_0x72f0cb[_0xb75e('0x88')]=moment()[_0xb75e('0x53')](_0xb75e('0x89'));ut['logAgent'](_0x5773b4,0x4,_0xb75e('0xb4'));rpcDb[_0xb75e('0xf2')](_0x5773b4,_0xb75e('0x13c'));}}};Preview[_0xb75e('0xe')]['syncHangup']=function(_0x1dd7de){var _0x2a6a27=this;var _0x331e84=this['actions'][_0x1dd7de['linkedid']];var _0x182a04;if(_0x331e84){_0x182a04=this[_0xb75e('0x12')][_0x331e84[_0xb75e('0x6c')]];logger[_0xb75e('0x56')](_0xb75e('0x13d'),_0x1dd7de[_0xb75e('0xa8')],_0xb75e('0xac'),_0x182a04[_0xb75e('0x27')],_0xb75e('0xad'),_0x182a04['pTalking']);}if(this[_0xb75e('0x15')][_0x1dd7de[_0xb75e('0xa8')]]&&_0x1dd7de[_0xb75e('0xa8')]!==_0x1dd7de[_0xb75e('0xec')]){if(_0x1dd7de['cause']==='16'&&this[_0xb75e('0x15')][_0x1dd7de[_0xb75e('0xa8')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x1dd7de,_0x1dd7de[_0xb75e('0xa8')],_0x1dd7de[_0xb75e('0x13e')]);}else if(this[_0xb75e('0x15')][_0x1dd7de[_0xb75e('0xa8')]][_0xb75e('0x76')]){logger[_0xb75e('0x56')]('[syncHangup][talking][cause]',_0x1dd7de[_0xb75e('0xa8')],_0x1dd7de['cause'],'\x20Queue',_0x182a04[_0xb75e('0x27')],_0xb75e('0xad'),_0x182a04[_0xb75e('0x6e')]);this[_0xb75e('0x99')](_0x1dd7de,_0x1dd7de[_0xb75e('0xa8')],_0x1dd7de[_0xb75e('0x13e')]);}}else if(_0x331e84&&_[_0xb75e('0x7e')](_0x331e84[_0xb75e('0x13f')])&&_0x182a04['dialQueueProject']&&_0x1dd7de['linkedid']===_0x1dd7de[_0xb75e('0xec')]&&_[_0xb75e('0x7e')](_0x1dd7de[_0xb75e('0xf8')])&&_0x1dd7de['cause']==='16'&&_0x1dd7de[_0xb75e('0x140')]==='6'&&_[_0xb75e('0xef')](_0x331e84[_0xb75e('0x141')])){if(_0x331e84[_0xb75e('0xc4')]){rpcDb[_0xb75e('0x10b')](_0x331e84[_0xb75e('0x139')]);}if(_0x331e84['activeContact']){rpcDb[_0xb75e('0x10c')](_0x331e84[_0xb75e('0x139')]);}_0x1dd7de[_0xb75e('0xf8')]='22';this[_0xb75e('0xee')](_0x331e84,_0x182a04,_0x1dd7de);}else if(_0x331e84&&_0x331e84[_0xb75e('0x141')]){if(_0x1dd7de[_0xb75e('0x13e')]==='16'&&this[_0xb75e('0x15')][_0x1dd7de['linkedid']][_0xb75e('0x76')]){logger[_0xb75e('0x56')]('[syncHangup][talking][transfer]',_0x1dd7de[_0xb75e('0xa8')],_0x1dd7de[_0xb75e('0x13e')],'\x20Queue',_0x182a04[_0xb75e('0x27')],_0xb75e('0xad'),_0x182a04[_0xb75e('0x6e')]);this[_0xb75e('0x99')](_0x1dd7de,_0x1dd7de['linkedid'],_0x1dd7de['cause']);}else if(this['actions'][_0x1dd7de[_0xb75e('0xa8')]][_0xb75e('0x76')]){logger[_0xb75e('0x56')](_0xb75e('0x142'),_0x1dd7de[_0xb75e('0xa8')],_0x1dd7de['cause'],'\x20Queue',_0x182a04['name'],_0xb75e('0xad'),_0x182a04[_0xb75e('0x6e')]);this[_0xb75e('0x99')](_0x1dd7de,_0x1dd7de['linkedid'],_0x1dd7de[_0xb75e('0x13e')]);}}};Preview[_0xb75e('0xe')][_0xb75e('0x20')]=function(_0x2a0f91){if(this[_0xb75e('0x15')][_0x2a0f91[_0xb75e('0xed')]]&&_0x2a0f91[_0xb75e('0xed')]!==_0x2a0f91[_0xb75e('0x143')]){this['callProgressDetectingCustomer'](_0x2a0f91,_0x2a0f91[_0xb75e('0xed')],_0x2a0f91[_0xb75e('0xe5')]);}};Preview[_0xb75e('0xe')]['syncHangupRequest']=function(_0x1e8ab7){if(this[_0xb75e('0x15')][_0x1e8ab7['linkedid']]&&_0x1e8ab7[_0xb75e('0xa8')]!==_0x1e8ab7[_0xb75e('0xec')]&&!this['actions'][_0x1e8ab7['linkedid']]['dialAnswer']){if(_0x1e8ab7[_0xb75e('0x13e')]==='1'){this[_0xb75e('0x99')](_0x1e8ab7,_0x1e8ab7['linkedid'],_0x1e8ab7['cause']);}}};Preview[_0xb75e('0xe')][_0xb75e('0x144')]=function(_0x5b8878,_0x49078a,_0x5c9fac){if(this[_0xb75e('0x15')][_0x5b8878]){if(_[_0xb75e('0x7e')](this[_0xb75e('0x15')][_0x5b8878][_0xb75e('0x145')])){this[_0xb75e('0x15')][_0x5b8878][_0xb75e('0x145')]={};}this[_0xb75e('0x15')][_0x5b8878][_0xb75e('0x145')][_0x49078a]=_0x5c9fac;}};Preview[_0xb75e('0xe')][_0xb75e('0x146')]=function(_0x3798b4){try{if(!_[_0xb75e('0x7e')](_0x3798b4)){if(ut['filterKey'](_[_0xb75e('0x147')](_0x3798b4['variable'])[0x0])){this[_0xb75e('0x144')](_0x3798b4[_0xb75e('0xec')],_[_0xb75e('0x147')](_0x3798b4[_0xb75e('0x148')])[0x0],_0x3798b4['value']);}}}catch(_0x2c2f75){logger[_0xb75e('0x149')](_0xb75e('0x14a'),util['inspect'](_0x2c2f75,{'showHidden':![],'depth':null}));}};Preview[_0xb75e('0xe')]['syncAttendedTransfer']=function(_0x44c49c){if(_0x44c49c){if(this['actions'][_0x44c49c[_0xb75e('0x14b')]]){this[_0xb75e('0x15')][_0x44c49c[_0xb75e('0x14b')]][_0xb75e('0x141')]=!![];}}};Preview[_0xb75e('0xe')]['syncBlindTransfer']=function(_0x422f38){if(_0x422f38){if(this[_0xb75e('0x15')][_0x422f38[_0xb75e('0x14c')]]){this[_0xb75e('0x15')][_0x422f38[_0xb75e('0x14c')]][_0xb75e('0x141')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 9909961..558f4aa 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 _0xe087=['rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','[createHistory]\x20','createHistory','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','then','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','endtime','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20'];(function(_0x10244e,_0x80c616){var _0x101359=function(_0x376508){while(--_0x376508){_0x10244e['push'](_0x10244e['shift']());}};_0x101359(++_0x80c616);}(_0xe087,0x6e));var _0x7e08=function(_0xa41ff,_0x4bd1d5){_0xa41ff=_0xa41ff-0x0;var _0x2a87ff=_0xe087[_0xa41ff];return _0x2a87ff;};'use strict';var util=require(_0x7e08('0x0'));var BPromise=require(_0x7e08('0x1'));var logger=require('../../../config/logger')(_0x7e08('0x2'));var _=require('lodash');var cmHopper=require(_0x7e08('0x3'));var cmHopperFinal=require(_0x7e08('0x4'));var cmHopperHistory=require(_0x7e08('0x5'));var cmHopperBlack=require(_0x7e08('0x6'));var voiceQueueRt=require(_0x7e08('0x7'));var agentReportPreview=require(_0x7e08('0x8'));var voiceQueueReport=require(_0x7e08('0x9'));function loggerCatch(_0xe3727){return function(_0x4a0c52){logger[_0x7e08('0xa')](_0xe3727,util['inspect'](_0x4a0c52,{'showHidden':![],'depth':null}));};}function create(_0x4fcd54){return BPromise[_0x7e08('0xb')]()['then'](cmHopperHistory['createHistory'](_0x4fcd54))['catch'](loggerCatch(_0x7e08('0xc')));}function createAgent(_0x43da4e){return BPromise[_0x7e08('0xb')]()['then'](agentReportPreview[_0x7e08('0xd')](_0x43da4e))[_0x7e08('0xe')](loggerCatch(_0x7e08('0xc')));}function moveContact(_0x4d9ba5){return BPromise[_0x7e08('0xb')]()['then'](cmHopper[_0x7e08('0xf')](_0x4d9ba5,!![]))['catch'](loggerCatch(_0x7e08('0x10')));}exports['checkIsBlackList']=function(_0x103056){return BPromise[_0x7e08('0xb')]()[_0x7e08('0x11')](cmHopperBlack[_0x7e08('0x12')](_0x103056))[_0x7e08('0xe')](loggerCatch(_0x7e08('0x13')));};exports[_0x7e08('0x14')]=function(_0x548916){return BPromise['resolve']()[_0x7e08('0x11')](cmHopper['getContactPreview'](_0x548916))[_0x7e08('0xe')](loggerCatch(_0x7e08('0x15')));};exports[_0x7e08('0xd')]=function(_0x224734,_0x4f039d){create(_0x224734)['catch'](loggerCatch(_0x4f039d));moveContact(_0x224734)[_0x7e08('0xe')](loggerCatch(_0x4f039d));};exports['createAgentHistory']=function(_0x593f37,_0x50710f){createAgent(_0x593f37)[_0x7e08('0xe')](loggerCatch(_0x50710f));};exports[_0x7e08('0x16')]=function(_0x37d900,_0x388112){create(_0x37d900)[_0x7e08('0xe')](loggerCatch(_0x388112));};exports[_0x7e08('0x17')]=function(_0x38d0c6,_0x5cb0ef){moveContact(_0x38d0c6)[_0x7e08('0xe')](loggerCatch(_0x5cb0ef));};exports[_0x7e08('0x18')]=function(_0x3d796b,_0x4d59a6,_0x46e1ad){if(_0x4d59a6){_0x3d796b[_0x7e08('0x19')]=null;}if(_0x46e1ad){_0x3d796b[_0x7e08('0x1a')]=![];}return BPromise[_0x7e08('0xb')]()['then'](cmHopper[_0x7e08('0x18')](_0x3d796b))[_0x7e08('0xe')](loggerCatch(_0x7e08('0x1b')));};exports['countReScheduled']=function(_0x15f4c6){return BPromise[_0x7e08('0xb')]()[_0x7e08('0x11')](cmHopper[_0x7e08('0x1c')](_0x15f4c6))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0x7e08('0x1d')]=function(_0x2a7d30){return BPromise[_0x7e08('0xb')]()[_0x7e08('0x11')](cmHopper['unlockContact']({'UserId':null},_0x2a7d30,0x1))['catch'](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x5beed2){return BPromise[_0x7e08('0xb')]()['then'](cmHopper[_0x7e08('0x1d')]({'active':![]},_0x5beed2,0x1))[_0x7e08('0xe')](loggerCatch('[activeContact]\x20'));};exports[_0x7e08('0x1e')]=function(_0x53f80a){var _0xe4b549={};_0xe4b549[_0x7e08('0x1f')]=_0x53f80a[_0x7e08('0x1f')];_0xe4b549[_0x7e08('0x20')]=_0x53f80a['uniqueid'];_0xe4b549[_0x7e08('0x21')]=_0x53f80a[_0x7e08('0x21')];_0xe4b549[_0x7e08('0x22')]=_0x53f80a['calleridname'];_0xe4b549[_0x7e08('0x23')]=_0x53f80a[_0x7e08('0x23')];_0xe4b549[_0x7e08('0x24')]=_0x53f80a[_0x7e08('0x25')];_0xe4b549[_0x7e08('0x26')]=_0x53f80a[_0x7e08('0x25')];_0xe4b549['queuecallercomplete']=0x1;_0xe4b549['queuecallercompleteAt']=_0x53f80a[_0x7e08('0x27')];_0xe4b549['connectedlinename']=_0x53f80a[_0x7e08('0x28')];_0xe4b549['context']=_0x7e08('0x29');_0xe4b549[_0x7e08('0x2a')]=_0x7e08('0x2b');_0xe4b549[_0x7e08('0x2c')]=0x0;_0xe4b549[_0x7e08('0x2d')]=0x1;_0xe4b549[_0x7e08('0x2e')]=_0x53f80a[_0x7e08('0x28')];_0xe4b549[_0x7e08('0x2f')]=_0x7e08('0x30');return BPromise['resolve']()[_0x7e08('0x11')](voiceQueueReport['create'](_0xe4b549))[_0x7e08('0xe')](loggerCatch(_0x7e08('0x31')));};exports[_0x7e08('0x32')]=function(_0x1d4f09,_0x434d73){return BPromise['resolve']()[_0x7e08('0x11')](cmHopper[_0x7e08('0x32')](_0x1d4f09,_0x434d73))['catch'](loggerCatch(_0x7e08('0x33')));};exports[_0x7e08('0x34')]=function(_0x186dab){return BPromise[_0x7e08('0xb')]()[_0x7e08('0x11')](cmHopper['rescheduleContact'](_0x186dab,!![],!![]))['catch'](loggerCatch(_0x7e08('0x35')));}; \ No newline at end of file +var _0x30ad=['from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','UserId','rescheduleContact','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context'];(function(_0x3ecbc5,_0x18da4e){var _0xf5544c=function(_0x1b12b2){while(--_0x1b12b2){_0x3ecbc5['push'](_0x3ecbc5['shift']());}};_0xf5544c(++_0x18da4e);}(_0x30ad,0x17f));var _0xd30a=function(_0x567029,_0x9771b3){_0x567029=_0x567029-0x0;var _0x1943f1=_0x30ad[_0x567029];return _0x1943f1;};'use strict';var util=require(_0xd30a('0x0'));var BPromise=require(_0xd30a('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0xd30a('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xd30a('0x3'));var cmHopperHistory=require(_0xd30a('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xd30a('0x5'));var agentReportPreview=require(_0xd30a('0x6'));var voiceQueueReport=require(_0xd30a('0x7'));function loggerCatch(_0x2bb373){return function(_0x26522d){logger['error'](_0x2bb373,util[_0xd30a('0x8')](_0x26522d,{'showHidden':![],'depth':null}));};}function create(_0x18fec2){return BPromise[_0xd30a('0x9')]()[_0xd30a('0xa')](cmHopperHistory[_0xd30a('0xb')](_0x18fec2))[_0xd30a('0xc')](loggerCatch(_0xd30a('0xd')));}function createAgent(_0x45d8e9){return BPromise[_0xd30a('0x9')]()[_0xd30a('0xa')](agentReportPreview[_0xd30a('0xb')](_0x45d8e9))[_0xd30a('0xc')](loggerCatch(_0xd30a('0xd')));}function moveContact(_0x4281ef){return BPromise[_0xd30a('0x9')]()[_0xd30a('0xa')](cmHopper[_0xd30a('0xe')](_0x4281ef,!![]))[_0xd30a('0xc')](loggerCatch(_0xd30a('0xf')));}exports[_0xd30a('0x10')]=function(_0x5e20ff){return BPromise[_0xd30a('0x9')]()['then'](cmHopperBlack['checkIsBlackList'](_0x5e20ff))[_0xd30a('0xc')](loggerCatch(_0xd30a('0x11')));};exports[_0xd30a('0x12')]=function(_0x490cb4){return BPromise[_0xd30a('0x9')]()['then'](cmHopper[_0xd30a('0x12')](_0x490cb4))[_0xd30a('0xc')](loggerCatch(_0xd30a('0x13')));};exports[_0xd30a('0xb')]=function(_0x21adb6,_0x4ddee8){create(_0x21adb6)['catch'](loggerCatch(_0x4ddee8));moveContact(_0x21adb6)[_0xd30a('0xc')](loggerCatch(_0x4ddee8));};exports[_0xd30a('0x14')]=function(_0x2d826b,_0xd41367){createAgent(_0x2d826b)[_0xd30a('0xc')](loggerCatch(_0xd41367));};exports['createCustomerHistory']=function(_0x70ac47,_0x3e00d2){create(_0x70ac47)[_0xd30a('0xc')](loggerCatch(_0x3e00d2));};exports['createCustomerFinal']=function(_0x238c03,_0x4909f4){moveContact(_0x238c03)[_0xd30a('0xc')](loggerCatch(_0x4909f4));};exports['rescheduleContact']=function(_0x713ccf,_0x4e0d57,_0x39779d){if(_0x4e0d57){_0x713ccf[_0xd30a('0x15')]=null;}if(_0x39779d){_0x713ccf['active']=![];}return BPromise[_0xd30a('0x9')]()[_0xd30a('0xa')](cmHopper[_0xd30a('0x16')](_0x713ccf))['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0xd30a('0x17')]=function(_0x54fe3d){return BPromise[_0xd30a('0x9')]()[_0xd30a('0xa')](cmHopper[_0xd30a('0x17')](_0x54fe3d))[_0xd30a('0xc')](loggerCatch(_0xd30a('0x18')));};exports[_0xd30a('0x19')]=function(_0x29c77b){return BPromise[_0xd30a('0x9')]()[_0xd30a('0xa')](cmHopper[_0xd30a('0x19')]({'UserId':null},_0x29c77b,0x1))[_0xd30a('0xc')](loggerCatch('[unlockContact]\x20'));};exports[_0xd30a('0x1a')]=function(_0x346935){return BPromise['resolve']()[_0xd30a('0xa')](cmHopper['unlockContact']({'active':![]},_0x346935,0x1))[_0xd30a('0xc')](loggerCatch(_0xd30a('0x1b')));};exports[_0xd30a('0x1c')]=function(_0x1a9384){var _0x5a7f7b={};_0x5a7f7b[_0xd30a('0x1d')]=_0x1a9384[_0xd30a('0x1d')];_0x5a7f7b['uniqueid']=_0x1a9384['uniqueid'];_0x5a7f7b[_0xd30a('0x1e')]=_0x1a9384[_0xd30a('0x1e')];_0x5a7f7b[_0xd30a('0x1f')]=_0x1a9384[_0xd30a('0x1f')];_0x5a7f7b[_0xd30a('0x20')]=_0x1a9384[_0xd30a('0x20')];_0x5a7f7b[_0xd30a('0x21')]=_0x1a9384[_0xd30a('0x22')];_0x5a7f7b[_0xd30a('0x23')]=_0x1a9384['answertime'];_0x5a7f7b[_0xd30a('0x24')]=0x1;_0x5a7f7b['queuecallercompleteAt']=_0x1a9384[_0xd30a('0x25')];_0x5a7f7b[_0xd30a('0x26')]=_0x1a9384[_0xd30a('0x27')];_0x5a7f7b[_0xd30a('0x28')]=_0xd30a('0x29');_0x5a7f7b[_0xd30a('0x2a')]=_0xd30a('0x2b');_0x5a7f7b[_0xd30a('0x2c')]=0x0;_0x5a7f7b[_0xd30a('0x2d')]=0x1;_0x5a7f7b[_0xd30a('0x2e')]=_0x1a9384['membername'];_0x5a7f7b[_0xd30a('0x2f')]='COMPLETED';return BPromise[_0xd30a('0x9')]()[_0xd30a('0xa')](voiceQueueReport[_0xd30a('0x30')](_0x5a7f7b))[_0xd30a('0xc')](loggerCatch(_0xd30a('0x31')));};exports['getContactRecallMe']=function(_0x5bf29c,_0x5459b9){return BPromise['resolve']()['then'](cmHopper[_0xd30a('0x32')](_0x5bf29c,_0x5459b9))[_0xd30a('0xc')](loggerCatch(_0xd30a('0x33')));};exports[_0xd30a('0x34')]=function(_0x173836){return BPromise[_0xd30a('0x9')]()[_0xd30a('0xa')](cmHopper[_0xd30a('0x16')](_0x173836,!![],!![]))[_0xd30a('0xc')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ 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 4de79f1..8fa503b 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 _0xc239=['logLookAgent','membername','logCustomer','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','active','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','queue','channelAgent','mandatoryDisposition','agentReadyId','getDiff','CampaignId','type','campaigntype','scheduledat','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosloss','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','match','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','inspect','logger','info','loggerError','error','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','isNil','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime'];(function(_0x330f28,_0x2ef9dd){var _0xd32470=function(_0x2bc607){while(--_0x2bc607){_0x330f28['push'](_0x330f28['shift']());}};_0xd32470(++_0x2ef9dd);}(_0xc239,0xcd));var _0x9c23=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc239[_0x40a045];return _0x1a687c;};'use strict';var util=require(_0x9c23('0x0'));var _=require(_0x9c23('0x1'));var moment=require('moment');var logger=require(_0x9c23('0x2'))(_0x9c23('0x3'));var ipAgi=process[_0x9c23('0x4')][_0x9c23('0x5')]||_0x9c23('0x6');function getSeconds(_0x3a155a,_0x5578a4){var _0x5992fe=moment(_0x3a155a)['milliseconds'](0x0);var _0x16221e=moment(_0x5578a4)[_0x9c23('0x7')](0x0);return _0x5992fe[_0x9c23('0x8')](_0x16221e,_0x9c23('0x9'));}exports[_0x9c23('0xa')]=function(_0x156532){return function(_0x4bcb81){logger['error'](_0x156532,util[_0x9c23('0xb')](_0x4bcb81,{'showHidden':![],'depth':null}));};};exports[_0x9c23('0xc')]=function(_0x4dfba8,_0x2eaeba){logger[_0x9c23('0xd')](_0x4dfba8,util[_0x9c23('0xb')](_0x2eaeba,{'showHidden':![],'depth':null}));};exports[_0x9c23('0xe')]=function(_0x1ecf6f,_0x2dd3c7){logger[_0x9c23('0xf')](_0x1ecf6f,util[_0x9c23('0xb')](_0x2dd3c7,{'showHidden':![],'depth':null}));};exports[_0x9c23('0x10')]=function(_0x206985){return function(_0x10252b){logger[_0x9c23('0xd')](_0x206985,util[_0x9c23('0xb')](_0x10252b,{'showHidden':![],'depth':null}));};};exports[_0x9c23('0x11')]=function(_0x8285f0,_0x2398c2,_0x148ca1){return{'message':_0x8285f0,'unlock':_0x2398c2,'active':_0x148ca1};};exports[_0x9c23('0x12')]=function(_0x5b1ee0,_0x2eac3e,_0x890f3d){if(!_[_0x9c23('0x13')](_0x890f3d)&&_0x9c23('0x14')===typeof _0x890f3d&&!_[_0x9c23('0x15')](_0x890f3d)){if(!_[_0x9c23('0x13')](_0x2eac3e)&&_0x9c23('0x14')===typeof _0x2eac3e&&!_['isEmpty'](_0x2eac3e)){return util[_0x9c23('0x16')](_0x9c23('0x17'),_0x2eac3e,_0x890f3d);}return util[_0x9c23('0x16')](_0x9c23('0x17'),_0x890f3d,_0x890f3d);}if(!_[_0x9c23('0x13')](_0x5b1ee0)&&'string'===typeof _0x5b1ee0&&!_[_0x9c23('0x15')](_0x5b1ee0)){return _0x5b1ee0;}return _0x9c23('0x18');};exports[_0x9c23('0x19')]=function(_0x3ebbad){if(_['isNil'](_0x3ebbad)){return![];}return _0x3ebbad;};exports['addVariables']=function(_0x5fa4f4,_0x28b85a,_0x25c47d,_0x46987a,_0x3993ea,_0x50b307){var _0x4eb1e8={'XMD-QUEUE':_0x28b85a[_0x9c23('0x1a')]?_0x28b85a['Queue']['name']:'','XMD-CALLERID':_0x46987a,'XMD-CALLERID-PREVIEW':_0x50b307?util[_0x9c23('0x16')](_0x9c23('0x17'),_0x50b307[_0x9c23('0x1b')],_0x50b307[_0x9c23('0x1c')]):_0x46987a,'XMD-DIALID':_0x3993ea,'XMD-CONTACTID':_0x28b85a[_0x9c23('0x1d')],'XMD-CDRTYPE':_0x9c23('0x1e'),'CALLERID(all)':_0x46987a,'XMD-VOICEQUEUEID':_0x28b85a[_0x9c23('0x1f')],'XMD-DIALCHANNEL':_0x25c47d,'XMD-DIALTIMEOUT':_0x5fa4f4[_0x9c23('0x20')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x9c23('0x21'),_0x5fa4f4[_0x9c23('0x22')]?'g':'',_[_0x9c23('0x15')](_0x5fa4f4[_0x9c23('0x23')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x5fa4f4[_0x9c23('0x24')]||'','XMD-AGI':_0x5fa4f4[_0x9c23('0x25')]?util[_0x9c23('0x16')](_0x9c23('0x26'),ipAgi,_0x5fa4f4[_0x9c23('0x25')]):'NONE','XMD-AGIAFTER':_0x5fa4f4['dialQueueProject2']?util[_0x9c23('0x16')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5fa4f4[_0x9c23('0x22')]):_0x9c23('0x27'),'XMD-ORIGINATECALLERIDNUM':_0x50b307?_0x50b307['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x50b307?_0x50b307[_0x9c23('0x28')]:'','XMD-DESTINATION':_0x9c23('0x29')};if(!_['isEmpty'](_0x5fa4f4[_0x9c23('0x23')])){_0x4eb1e8[util[_0x9c23('0x16')]('%s',_0x9c23('0x2a'))]=_0x5fa4f4[_0x9c23('0x23')];_0x4eb1e8[util['format']('%s',_0x9c23('0x2b'))]=_0x3993ea;}if(_0x28b85a&&_0x28b85a['Contact']){for(var _0x42bcd5 in _0x28b85a[_0x9c23('0x2c')]){if(_0x28b85a['Contact']['hasOwnProperty'](_0x42bcd5)){if(!_[_0x9c23('0x2d')](_0x28b85a[_0x9c23('0x2c')][_0x42bcd5])&&_0x42bcd5!=='id'&&_0x42bcd5!==_0x9c23('0x2e')&&_0x42bcd5!==_0x9c23('0x2f')&&_0x42bcd5!=='updatedAt'){_0x4eb1e8[util[_0x9c23('0x16')](_0x9c23('0x30'),_0x9c23('0x31'),_[_0x9c23('0x32')](_0x42bcd5))]=_0x28b85a[_0x9c23('0x2c')][_0x42bcd5];}}}}return _0x4eb1e8;};exports[_0x9c23('0x33')]=function(_0x2768b1){var _0x114d7f={};for(var _0x46ae3b in _0x2768b1){if(_0x2768b1[_0x9c23('0x34')](_0x46ae3b)){_0x114d7f[util[_0x9c23('0x16')]('%s',_[_0x9c23('0x35')](_0x46ae3b))]=_0x2768b1[_0x46ae3b];}}return{'variables':_0x114d7f};};exports[_0x9c23('0x36')]=function(_0x340fde,_0x34aedf){if(!_[_0x9c23('0x2d')](_0x340fde)){if(_0x340fde[_0x9c23('0x34')](_0x9c23('0x37'))){if(_0x340fde[_0x9c23('0x37')]>0x0){_0x340fde[_0x9c23('0x37')]-=0x1;}else{logger[_0x9c23('0xf')](_0x9c23('0x38'),_0x34aedf);}}}else{logger[_0x9c23('0xf')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x34aedf);}};exports[_0x9c23('0x39')]=function(_0x431154){var _0x2acbf0=moment()[_0x9c23('0x16')](_0x9c23('0x3a'));_0x431154[_0x9c23('0x3b')]=0xd;_0x431154[_0x9c23('0x3c')]=_0x9c23('0x3d');_0x431154[_0x9c23('0x3e')]=_0x2acbf0;_0x431154[_0x9c23('0x3f')]=_0x2acbf0;_0x431154[_0x9c23('0x40')]=_0x2acbf0;};exports[_0x9c23('0x41')]=function(_0x24c100,_0x35c86a,_0x1ce126){var _0x1db69c=moment()[_0x9c23('0x16')](_0x9c23('0x3a'));_0x24c100['state']=_0x35c86a;_0x24c100[_0x9c23('0x3c')]=_0x1ce126;_0x24c100[_0x9c23('0x3f')]=_0x1db69c;_0x24c100[_0x9c23('0x42')]=getSeconds(_0x24c100[_0x9c23('0x3f')],_0x24c100[_0x9c23('0x3e')]);};exports[_0x9c23('0x43')]=function(_0x4a0c8c,_0x521440,_0xfd5b2d){_0x4a0c8c[_0x9c23('0x44')]=_0x521440;_0x4a0c8c['UserId']=_0xfd5b2d;};exports[_0x9c23('0x45')]=function(_0x433528,_0x4d4787,_0x1afee6){var _0x4b0d84=moment()[_0x9c23('0x16')](_0x9c23('0x3a'));_0x433528[_0x9c23('0x3b')]=_0x4d4787;_0x433528[_0x9c23('0x3c')]=_0x1afee6;_0x433528[_0x9c23('0x3f')]=_0x433528[_0x9c23('0x3f')]?_0x433528[_0x9c23('0x3f')]:_0x4b0d84;_0x433528['endtime']=_0x433528[_0x9c23('0x40')]?_0x433528['endtime']:_0x4b0d84;_0x433528[_0x9c23('0x42')]=getSeconds(_0x433528[_0x9c23('0x3f')]||0x0,_0x433528['starttime']||0x0);_0x433528['talktime']=_0x433528[_0x9c23('0x46')]?getSeconds(_0x433528['endtime'],_0x433528[_0x9c23('0x46')]):0x0;};exports[_0x9c23('0x47')]=function(_0x3a276){return _0x3a276===_0x9c23('0x48');};exports[_0x9c23('0x49')]=function(_0x4f9fea,_0x591b8e,_0x53eb7b,_0x1b379b,_0x152e71){var _0x359944=_0x1b379b?_0x9c23('0x4a'):_0x4f9fea[_0x9c23('0x1b')];_0x359944=_0x152e71?_0x9c23('0x4b'):_0x359944;return{'actionid':_0x4f9fea['uniqueid'],'action':'originate','channel':_0x4f9fea['channelAgent'],'callerid':util[_0x9c23('0x16')](_0x9c23('0x17'),_0x359944,_0x4f9fea[_0x9c23('0x1c')]),'Exten':_0x9c23('0x29'),'Context':'from-sip','Priority':'1','variable':_0x53eb7b,'timeout':(_0x591b8e[_0x9c23('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4f9fea[_0x9c23('0x4d')]};};exports[_0x9c23('0x4e')]=function(_0x510c1a){return _0x510c1a[_0x9c23('0x4f')]+_0x510c1a[_0x9c23('0x50')]+_0x510c1a[_0x9c23('0x51')]+_0x510c1a['countagentrejectretry']+_0x510c1a[_0x9c23('0x52')];};exports[_0x9c23('0x53')]=function(_0x139772){var _0x3dbe39=_[_0x9c23('0x54')](_0x139772);_0x3dbe39[_0x9c23('0x3b')]=0xf;_0x3dbe39[_0x9c23('0x3c')]=_0x9c23('0x55');return _0x3dbe39;};exports['scheduledAt']=function(_0x4f47e0,_0x55b29c,_0x894142){var _0x5a45c5={};_0x5a45c5[_0x55b29c]=_0x4f47e0[_0x55b29c];_0x5a45c5[_0x9c23('0x56')]=![];_0x5a45c5['scheduledat']=moment()[_0x9c23('0x57')](_0x894142,_0x9c23('0x58'))[_0x9c23('0x16')](_0x9c23('0x3a'));_0x5a45c5[_0x9c23('0x1d')]=_0x4f47e0[_0x9c23('0x1d')];_0x5a45c5[_0x9c23('0x59')]=_0x4f47e0[_0x9c23('0x59')];_0x5a45c5['VoiceQueueId']=_0x4f47e0[_0x9c23('0x1f')]||undefined;return _0x5a45c5;};exports['decrementTalkink']=function(_0x883d08,_0x1d3b8c){if(!_['isNil'](_0x883d08)){if(_0x883d08[_0x9c23('0x5a')]>0x0){_0x883d08[_0x9c23('0x5a')]-=0x1;}else{logger[_0x9c23('0xf')](_0x1d3b8c,_0x9c23('0x5b'));}}else{logger[_0x9c23('0xf')](_0x1d3b8c,_0x9c23('0x5c'));}};exports[_0x9c23('0x5d')]=function(_0x3e16f3){if(_0x3e16f3<=0x0){return!![];}return![];};exports[_0x9c23('0x5e')]=function(_0x4b1e88,_0x57350d,_0x476212){_0x4b1e88[_0x9c23('0x5f')]=_0x57350d;_0x4b1e88[_0x9c23('0x60')]=_0x4b1e88[_0x9c23('0x61')];_0x4b1e88['interface']=_0x4b1e88[_0x9c23('0x62')];if(_0x476212){_0x4b1e88[_0x9c23('0x63')]=_0x476212[_0x9c23('0x63')];}return _0x4b1e88;};exports['buildAcw']=function(_0x527d7e){var _0xdf1e1d={};_0xdf1e1d[_0x9c23('0x61')]=_0x527d7e['queue'];_0xdf1e1d['interface']=_0x527d7e[_0x9c23('0x62')];_0xdf1e1d[_0x9c23('0x4d')]=_0x527d7e[_0x9c23('0x4d')];return _0xdf1e1d;};exports[_0x9c23('0x64')]=function(_0x13d6af){var _0x13f7dd=[];for(var _0x7afe78 in _0x13d6af){if(_0x13d6af[_0x9c23('0x34')](_0x7afe78)){if(!_['isNil'](_0x13d6af[_0x7afe78])&&_0x13d6af[_0x7afe78]['state']==='not_inuse'&&_0x13d6af[_0x7afe78]['status']==='reachable'){_0x13f7dd['push'](_0x13d6af[_0x7afe78]['id']);}}}return _0x13f7dd;};exports[_0x9c23('0x65')]=function(_0x446a41){var _0x5f149a=moment()[_0x9c23('0x7')](0x0);var _0x26d891=moment(_0x446a41)[_0x9c23('0x7')](0x0);return _0x5f149a['diff'](_0x26d891,_0x9c23('0x9'));};exports['createBody']=function(_0x5719d2){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5719d2[_0x9c23('0x1d')],'ListId':_0x5719d2[_0x9c23('0x59')],'VoiceQueueId':_0x5719d2[_0x9c23('0x1f')]||undefined,'CampaignId':_0x5719d2[_0x9c23('0x66')]||undefined};};exports['filterKey']=function(_0x271dc7){if(_0x271dc7===_0x9c23('0x4d')||_0x271dc7==='idContact'||_0x271dc7===_0x9c23('0x61')||_0x271dc7===_0x9c23('0x67')||_0x271dc7===_0x9c23('0x68')||_0x271dc7==='dialAnswer'||_0x271dc7===_0x9c23('0x44')||_0x271dc7==='channelAgent'||_0x271dc7===_0x9c23('0x1b')||_0x271dc7===_0x9c23('0x56')||_0x271dc7===_0x9c23('0x1c')||_0x271dc7===_0x9c23('0x69')||_0x271dc7==='countbusyretry'||_0x271dc7===_0x9c23('0x50')||_0x271dc7==='countnoanswerretry'||_0x271dc7===_0x9c23('0x6a')||_0x271dc7===_0x9c23('0x6b')||_0x271dc7===_0x9c23('0x6c')||_0x271dc7===_0x9c23('0x6d')||_0x271dc7===_0x9c23('0x6e')||_0x271dc7===_0x9c23('0x1d')||_0x271dc7===_0x9c23('0x59')||_0x271dc7===_0x9c23('0x6f')||_0x271dc7==='VoiceQueueId'||_0x271dc7==='sipcallid'||_0x271dc7===_0x9c23('0x70')||_0x271dc7===_0x9c23('0x71')||_0x271dc7===_0x9c23('0x72')||_0x271dc7===_0x9c23('0x73')||_0x271dc7===_0x9c23('0x74')||_0x271dc7===_0x9c23('0x75')||_0x271dc7===_0x9c23('0x76')||_0x271dc7==='xmd-dialid'||_0x271dc7===_0x9c23('0x77')||_0x271dc7===_0x9c23('0x78')||_0x271dc7===_0x9c23('0x79')||_0x271dc7===_0x9c23('0x7a')||_0x271dc7==='xmd-agiafter'||_0x271dc7==='xmd-agi'||_0x271dc7==='rtpaudioqos'||_0x271dc7===_0x9c23('0x7b')||_0x271dc7===_0x9c23('0x7c')||_0x271dc7===_0x9c23('0x7d')||_0x271dc7==='rtpaudioqosloss'||_0x271dc7===_0x9c23('0x7e')||_0x271dc7===_0x9c23('0x7f')||_0x271dc7===_0x9c23('0x80')||_0x271dc7===_0x9c23('0x81')||_0x271dc7===_0x9c23('0x7b')||_0x271dc7===_0x9c23('0x7c')||_0x271dc7===_0x9c23('0x7d')||_0x271dc7===_0x9c23('0x82')||_0x271dc7===_0x9c23('0x7e')||_0x271dc7===_0x9c23('0x7f')||_0x271dc7==='rtpaudioqosrttbridged'||_0x271dc7===_0x9c23('0x83')||_0x271dc7===_0x9c23('0x84')||_0x271dc7===_0x9c23('0x3b')||_0x271dc7===_0x9c23('0x3c')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x20b6a3,_0xe8e06){var _0xc5bfbe,_0x2a2dc6,_0x3b0af7;if(_0xe8e06<=0x0){_0xe8e06=0x1;}_0xc5bfbe=new RegExp(_0x9c23('0x85')+_0xe8e06+'}$');_0x2a2dc6=Math[_0x9c23('0x86')](0xa,_0xe8e06-0x1);_0x3b0af7=Math[_0x9c23('0x86')](0xa,_0xe8e06)-0x1;return util[_0x9c23('0x16')]('%s',_['replace'](_0x20b6a3,_0xc5bfbe,_['random'](_0x2a2dc6,_0x3b0af7)));};exports['extractCalleridName']=function(_0xa1126a){var _0x5dab5c=_0xa1126a[_0x9c23('0x87')](/"(.*?)"/);return _0x5dab5c?_0x5dab5c[0x1]:_0xa1126a;};exports['extractCalleridNumber']=function(_0x2871e6){var _0x3fb8a6=_0x2871e6[_0x9c23('0x87')](/<(.*?)>/);return _0x3fb8a6?_0x3fb8a6[0x1]:_0x2871e6;}; \ No newline at end of file +var _0xa58d=['dialAnswer','countcongestionretry','countglobal','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','extractCalleridName','match','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','logger','info','inspect','loggerError','error','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','string','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','updateOriginated','originated','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','calleridname','uniqueid','originate','xcally-motion-preview','timeout','totalGlobal','countbusyretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','queue','interface','mandatoryDisposition','buildAcw','channelAgent','agentReadyId','status','reachable','push','createBody','CampaignId','filterKey','idContact','type'];(function(_0xea3c80,_0x144753){var _0xbe8cb8=function(_0x47d54c){while(--_0x47d54c){_0xea3c80['push'](_0xea3c80['shift']());}};_0xbe8cb8(++_0x144753);}(_0xa58d,0x132));var _0xda58=function(_0x4773bf,_0x370448){_0x4773bf=_0x4773bf-0x0;var _0x2e18c6=_0xa58d[_0x4773bf];return _0x2e18c6;};'use strict';var util=require('util');var _=require(_0xda58('0x0'));var moment=require(_0xda58('0x1'));var logger=require(_0xda58('0x2'))('preview');var ipAgi=process[_0xda58('0x3')][_0xda58('0x4')]||_0xda58('0x5');function getSeconds(_0x462159,_0x5a0744){var _0x501120=moment(_0x462159)[_0xda58('0x6')](0x0);var _0x3f44f0=moment(_0x5a0744)[_0xda58('0x6')](0x0);return _0x501120[_0xda58('0x7')](_0x3f44f0,_0xda58('0x8'));}exports[_0xda58('0x9')]=function(_0x2582d0){return function(_0x21d7b8){logger['error'](_0x2582d0,util['inspect'](_0x21d7b8,{'showHidden':![],'depth':null}));};};exports[_0xda58('0xa')]=function(_0x5a9e9b,_0x311ec7){logger[_0xda58('0xb')](_0x5a9e9b,util[_0xda58('0xc')](_0x311ec7,{'showHidden':![],'depth':null}));};exports[_0xda58('0xd')]=function(_0x39f7e2,_0x2d5e35){logger[_0xda58('0xe')](_0x39f7e2,util[_0xda58('0xc')](_0x2d5e35,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x10a6bd){return function(_0x22bae7){logger[_0xda58('0xb')](_0x10a6bd,util[_0xda58('0xc')](_0x22bae7,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x25d5e8,_0x1a6501,_0x49c527){return{'message':_0x25d5e8,'unlock':_0x1a6501,'active':_0x49c527};};exports['getCallerId']=function(_0x364d97,_0x588e13,_0x534b81){if(!_[_0xda58('0xf')](_0x534b81)&&'string'===typeof _0x534b81&&!_[_0xda58('0x10')](_0x534b81)){if(!_[_0xda58('0xf')](_0x588e13)&&'string'===typeof _0x588e13&&!_['isEmpty'](_0x588e13)){return util[_0xda58('0x11')](_0xda58('0x12'),_0x588e13,_0x534b81);}return util[_0xda58('0x11')](_0xda58('0x12'),_0x534b81,_0x534b81);}if(!_[_0xda58('0xf')](_0x364d97)&&_0xda58('0x13')===typeof _0x364d97&&!_[_0xda58('0x10')](_0x364d97)){return _0x364d97;}return'\x22\x22\x20<>';};exports[_0xda58('0x14')]=function(_0x307d90){if(_[_0xda58('0x15')](_0x307d90)){return![];}return _0x307d90;};exports[_0xda58('0x16')]=function(_0xce6671,_0x5a685d,_0x4c3506,_0xdef77e,_0x3288c4,_0x359075){var _0x1fb13d={'XMD-QUEUE':_0x5a685d['Queue']?_0x5a685d[_0xda58('0x17')][_0xda58('0x18')]:'','XMD-CALLERID':_0xdef77e,'XMD-CALLERID-PREVIEW':_0x359075?util['format'](_0xda58('0x12'),_0x359075['calleridname'],_0x359075[_0xda58('0x19')]):_0xdef77e,'XMD-DIALID':_0x3288c4,'XMD-CONTACTID':_0x5a685d[_0xda58('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xdef77e,'XMD-VOICEQUEUEID':_0x5a685d[_0xda58('0x1b')],'XMD-DIALCHANNEL':_0x4c3506,'XMD-DIALTIMEOUT':_0xce6671[_0xda58('0x1c')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0xce6671[_0xda58('0x1d')]?'g':'',_[_0xda58('0x10')](_0xce6671[_0xda58('0x1e')])?'':_0xda58('0x1f')),'XMD-DIALURL':_0xce6671[_0xda58('0x20')]||'','XMD-AGI':_0xce6671[_0xda58('0x21')]?util['format'](_0xda58('0x22'),ipAgi,_0xce6671[_0xda58('0x21')]):'NONE','XMD-AGIAFTER':_0xce6671[_0xda58('0x1d')]?util[_0xda58('0x11')](_0xda58('0x22'),ipAgi,_0xce6671['dialQueueProject2']):_0xda58('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x359075?_0x359075[_0xda58('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x359075?_0x359075[_0xda58('0x25')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0xda58('0x10')](_0xce6671[_0xda58('0x1e')])){_0x1fb13d[util[_0xda58('0x11')]('%s',_0xda58('0x26'))]=_0xce6671[_0xda58('0x1e')];_0x1fb13d[util[_0xda58('0x11')]('%s',_0xda58('0x27'))]=_0x3288c4;}if(_0x5a685d&&_0x5a685d['Contact']){for(var _0x34543e in _0x5a685d[_0xda58('0x28')]){if(_0x5a685d[_0xda58('0x28')][_0xda58('0x29')](_0x34543e)){if(!_[_0xda58('0x15')](_0x5a685d[_0xda58('0x28')][_0x34543e])&&_0x34543e!=='id'&&_0x34543e!==_0xda58('0x2a')&&_0x34543e!==_0xda58('0x2b')&&_0x34543e!==_0xda58('0x2c')){_0x1fb13d[util['format']('%s%s',_0xda58('0x2d'),_[_0xda58('0x2e')](_0x34543e))]=_0x5a685d[_0xda58('0x28')][_0x34543e];}}}}return _0x1fb13d;};exports[_0xda58('0x2f')]=function(_0x794b05){var _0x18b3e8={};for(var _0x2885fb in _0x794b05){if(_0x794b05[_0xda58('0x29')](_0x2885fb)){_0x18b3e8[util['format']('%s',_['toLower'](_0x2885fb))]=_0x794b05[_0x2885fb];}}return{'variables':_0x18b3e8};};exports[_0xda58('0x30')]=function(_0x1b07a0,_0x573800){if(!_[_0xda58('0x15')](_0x1b07a0)){if(_0x1b07a0[_0xda58('0x29')](_0xda58('0x31'))){if(_0x1b07a0['originated']>0x0){_0x1b07a0[_0xda58('0x31')]-=0x1;}else{logger[_0xda58('0xe')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x573800);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x573800);}};exports['logBlacklist']=function(_0x36dda5){var _0x42afda=moment()[_0xda58('0x11')](_0xda58('0x32'));_0x36dda5[_0xda58('0x33')]=0xd;_0x36dda5[_0xda58('0x34')]=_0xda58('0x35');_0x36dda5[_0xda58('0x36')]=_0x42afda;_0x36dda5[_0xda58('0x37')]=_0x42afda;_0x36dda5[_0xda58('0x38')]=_0x42afda;};exports[_0xda58('0x39')]=function(_0x37f2d8,_0x3f6433,_0x16ccd1){var _0x396bb9=moment()['format'](_0xda58('0x32'));_0x37f2d8[_0xda58('0x33')]=_0x3f6433;_0x37f2d8['statedesc']=_0x16ccd1;_0x37f2d8['responsetime']=_0x396bb9;_0x37f2d8[_0xda58('0x3a')]=getSeconds(_0x37f2d8[_0xda58('0x37')],_0x37f2d8[_0xda58('0x36')]);};exports[_0xda58('0x3b')]=function(_0x1ad6b0,_0xa5749a,_0x563c69){_0x1ad6b0[_0xda58('0x3c')]=_0xa5749a;_0x1ad6b0[_0xda58('0x3d')]=_0x563c69;};exports[_0xda58('0x3e')]=function(_0x9d3a58,_0x191db6,_0x29542d){var _0x557c46=moment()[_0xda58('0x11')](_0xda58('0x32'));_0x9d3a58[_0xda58('0x33')]=_0x191db6;_0x9d3a58[_0xda58('0x34')]=_0x29542d;_0x9d3a58[_0xda58('0x37')]=_0x9d3a58[_0xda58('0x37')]?_0x9d3a58[_0xda58('0x37')]:_0x557c46;_0x9d3a58[_0xda58('0x38')]=_0x9d3a58[_0xda58('0x38')]?_0x9d3a58[_0xda58('0x38')]:_0x557c46;_0x9d3a58[_0xda58('0x3a')]=getSeconds(_0x9d3a58[_0xda58('0x37')]||0x0,_0x9d3a58[_0xda58('0x36')]||0x0);_0x9d3a58[_0xda58('0x3f')]=_0x9d3a58[_0xda58('0x40')]?getSeconds(_0x9d3a58[_0xda58('0x38')],_0x9d3a58['answertime']):0x0;};exports[_0xda58('0x41')]=function(_0x451ddf){return _0x451ddf===_0xda58('0x42');};exports[_0xda58('0x43')]=function(_0x39c926,_0x4c8bdb,_0x10f01c,_0x446ea8,_0x454573){var _0x5548da=_0x446ea8?'RECALL':_0x39c926[_0xda58('0x44')];_0x5548da=_0x454573?'BOOKED':_0x5548da;return{'actionid':_0x39c926[_0xda58('0x45')],'action':_0xda58('0x46'),'channel':_0x39c926['channelAgent'],'callerid':util['format'](_0xda58('0x12'),_0x5548da,_0x39c926[_0xda58('0x19')]),'Exten':_0xda58('0x47'),'Context':'from-sip','Priority':'1','variable':_0x10f01c,'timeout':(_0x4c8bdb[_0xda58('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x39c926[_0xda58('0x45')]};};exports[_0xda58('0x49')]=function(_0x2ba84e){return _0x2ba84e[_0xda58('0x4a')]+_0x2ba84e['countcongestionretry']+_0x2ba84e[_0xda58('0x4b')]+_0x2ba84e['countagentrejectretry']+_0x2ba84e[_0xda58('0x4c')];};exports[_0xda58('0x4d')]=function(_0x1de402){var _0xdb07fb=_[_0xda58('0x4e')](_0x1de402);_0xdb07fb[_0xda58('0x33')]=0xf;_0xdb07fb[_0xda58('0x34')]=_0xda58('0x4f');return _0xdb07fb;};exports[_0xda58('0x50')]=function(_0x206b20,_0x6a7920,_0x339e79){var _0x521c83={};_0x521c83[_0x6a7920]=_0x206b20[_0x6a7920];_0x521c83[_0xda58('0x51')]=![];_0x521c83[_0xda58('0x52')]=moment()[_0xda58('0x53')](_0x339e79,'minutes')[_0xda58('0x11')](_0xda58('0x32'));_0x521c83['ContactId']=_0x206b20['ContactId'];_0x521c83[_0xda58('0x54')]=_0x206b20['ListId'];_0x521c83['VoiceQueueId']=_0x206b20[_0xda58('0x1b')]||undefined;return _0x521c83;};exports[_0xda58('0x55')]=function(_0x358a93,_0x2a622d){if(!_[_0xda58('0x15')](_0x358a93)){if(_0x358a93[_0xda58('0x56')]>0x0){_0x358a93[_0xda58('0x56')]-=0x1;}else{logger[_0xda58('0xe')](_0x2a622d,_0xda58('0x57'));}}else{logger[_0xda58('0xe')](_0x2a622d,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xda58('0x58')]=function(_0x3fd457){if(_0x3fd457<=0x0){return!![];}return![];};exports[_0xda58('0x59')]=function(_0x2992c4,_0x49fef0,_0x326dce){_0x2992c4[_0xda58('0x5a')]=_0x49fef0;_0x2992c4[_0xda58('0x18')]=_0x2992c4[_0xda58('0x5b')];_0x2992c4[_0xda58('0x5c')]=_0x2992c4['channelAgent'];if(_0x326dce){_0x2992c4[_0xda58('0x5d')]=_0x326dce[_0xda58('0x5d')];}return _0x2992c4;};exports[_0xda58('0x5e')]=function(_0x4945ed){var _0x5a5abc={};_0x5a5abc[_0xda58('0x5b')]=_0x4945ed['queue'];_0x5a5abc['interface']=_0x4945ed[_0xda58('0x5f')];_0x5a5abc[_0xda58('0x45')]=_0x4945ed[_0xda58('0x45')];return _0x5a5abc;};exports[_0xda58('0x60')]=function(_0x34985b){var _0xbba76c=[];for(var _0x3bbfd6 in _0x34985b){if(_0x34985b['hasOwnProperty'](_0x3bbfd6)){if(!_[_0xda58('0x15')](_0x34985b[_0x3bbfd6])&&_0x34985b[_0x3bbfd6][_0xda58('0x33')]==='not_inuse'&&_0x34985b[_0x3bbfd6][_0xda58('0x61')]===_0xda58('0x62')){_0xbba76c[_0xda58('0x63')](_0x34985b[_0x3bbfd6]['id']);}}}return _0xbba76c;};exports['getDiff']=function(_0x1ef9e4){var _0x11acdb=moment()['milliseconds'](0x0);var _0x11481a=moment(_0x1ef9e4)[_0xda58('0x6')](0x0);return _0x11acdb[_0xda58('0x7')](_0x11481a,'seconds');};exports[_0xda58('0x64')]=function(_0x1f29db){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1f29db[_0xda58('0x1a')],'ListId':_0x1f29db['ListId'],'VoiceQueueId':_0x1f29db[_0xda58('0x1b')]||undefined,'CampaignId':_0x1f29db[_0xda58('0x65')]||undefined};};exports[_0xda58('0x66')]=function(_0x403c06){if(_0x403c06===_0xda58('0x45')||_0x403c06===_0xda58('0x67')||_0x403c06===_0xda58('0x5b')||_0x403c06===_0xda58('0x68')||_0x403c06==='campaigntype'||_0x403c06===_0xda58('0x69')||_0x403c06===_0xda58('0x3c')||_0x403c06==='channelAgent'||_0x403c06===_0xda58('0x44')||_0x403c06==='active'||_0x403c06===_0xda58('0x19')||_0x403c06===_0xda58('0x52')||_0x403c06===_0xda58('0x4a')||_0x403c06===_0xda58('0x6a')||_0x403c06==='countnoanswerretry'||_0x403c06===_0xda58('0x6b')||_0x403c06==='callback'||_0x403c06===_0xda58('0x6c')||_0x403c06===_0xda58('0x6d')||_0x403c06==='recallme'||_0x403c06===_0xda58('0x1a')||_0x403c06===_0xda58('0x54')||_0x403c06===_0xda58('0x3d')||_0x403c06===_0xda58('0x1b')||_0x403c06===_0xda58('0x6e')||_0x403c06===_0xda58('0x6f')||_0x403c06===_0xda58('0x70')||_0x403c06===_0xda58('0x71')||_0x403c06===_0xda58('0x72')||_0x403c06==='xmd-dialurl'||_0x403c06===_0xda58('0x73')||_0x403c06===_0xda58('0x74')||_0x403c06===_0xda58('0x75')||_0x403c06===_0xda58('0x76')||_0x403c06===_0xda58('0x77')||_0x403c06===_0xda58('0x78')||_0x403c06==='xmd-callerid'||_0x403c06===_0xda58('0x79')||_0x403c06===_0xda58('0x7a')||_0x403c06===_0xda58('0x7b')||_0x403c06==='rtpaudioqosbridged'||_0x403c06===_0xda58('0x7c')||_0x403c06===_0xda58('0x7d')||_0x403c06===_0xda58('0x7e')||_0x403c06==='rtpaudioqoslossbridged'||_0x403c06===_0xda58('0x7f')||_0x403c06===_0xda58('0x80')||_0x403c06===_0xda58('0x7b')||_0x403c06==='rtpaudioqosbridged'||_0x403c06===_0xda58('0x7c')||_0x403c06===_0xda58('0x7d')||_0x403c06===_0xda58('0x7e')||_0x403c06===_0xda58('0x81')||_0x403c06===_0xda58('0x7f')||_0x403c06===_0xda58('0x80')||_0x403c06===_0xda58('0x82')||_0x403c06===_0xda58('0x83')||_0x403c06===_0xda58('0x33')||_0x403c06==='statedesc'){return![];}return!![];};exports[_0xda58('0x84')]=function(_0x1da6d4,_0x3fba13){var _0x4c7ea1,_0x4f3b21,_0x19baff;if(_0x3fba13<=0x0){_0x3fba13=0x1;}_0x4c7ea1=new RegExp('\x5cw{0,'+_0x3fba13+'}$');_0x4f3b21=Math[_0xda58('0x85')](0xa,_0x3fba13-0x1);_0x19baff=Math['pow'](0xa,_0x3fba13)-0x1;return util[_0xda58('0x11')]('%s',_[_0xda58('0x86')](_0x1da6d4,_0x4c7ea1,_['random'](_0x4f3b21,_0x19baff)));};exports[_0xda58('0x87')]=function(_0x457430){var _0x34de56=_0x457430[_0xda58('0x88')](/"(.*?)"/);return _0x34de56?_0x34de56[0x1]:_0x457430;};exports['extractCalleridNumber']=function(_0x4c4661){var _0x2beb6d=_0x4c4661[_0xda58('0x88')](/<(.*?)>/);return _0x2beb6d?_0x2beb6d[0x1]:_0x4c4661;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index cb3001e..3aa7153 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 _0xe38f=['voicechannel','queueadd','string','number','queuepause','reload'];(function(_0x5e248d,_0x459d1c){var _0x1a13b6=function(_0xeabb9a){while(--_0xeabb9a){_0x5e248d['push'](_0x5e248d['shift']());}};_0x1a13b6(++_0x459d1c);}(_0xe38f,0xb5));var _0xfe38=function(_0x4e46de,_0x265e19){_0x4e46de=_0x4e46de-0x0;var _0xfe88e8=_0xe38f[_0x4e46de];return _0xfe88e8;};'use strict';exports[_0xfe38('0x0')]={'queue':{'type':_0xfe38('0x1'),'required':!![]},'interface':{'type':_0xfe38('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xfe38('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0xfe38('0x1'),'required':!![]},'interface':{'type':_0xfe38('0x1'),'required':!![]}};exports[_0xfe38('0x3')]={'interface':{'type':_0xfe38('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports[_0xfe38('0x4')]={'module':{'type':_0xfe38('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xfe38('0x1'),'required':!![]}};exports[_0xfe38('0x5')]={'uniqueid':{'type':_0xfe38('0x1'),'required':!![]},'filename':{'type':_0xfe38('0x1')},'format':{'type':_0xfe38('0x1')},'mixmonitorid':{'type':_0xfe38('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xfe38('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xfe38('0x1')}}; \ No newline at end of file +var _0x4146=['voicequeuechannelredirect','string','number','queueremove','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x29d725,_0x403d85){var _0x407b96=function(_0x5a6281){while(--_0x5a6281){_0x29d725['push'](_0x29d725['shift']());}};_0x407b96(++_0x403d85);}(_0x4146,0xb5));var _0x6414=function(_0x567c1f,_0x23b25f){_0x567c1f=_0x567c1f-0x0;var _0x1b064c=_0x4146[_0x567c1f];return _0x1b064c;};'use strict';exports['queueadd']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x6414('0x0'),'required':!![]},'membername':{'type':_0x6414('0x0'),'required':!![]},'penalty':{'type':_0x6414('0x1'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x6414('0x2')]={'queue':{'type':_0x6414('0x0'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0x6414('0x3')},'reason':{'type':_0x6414('0x0'),'required':![]}};exports[_0x6414('0x4')]={'module':{'type':_0x6414('0x0'),'required':![]}};exports[_0x6414('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x6414('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0x6414('0x0')},'mixmonitorid':{'type':_0x6414('0x0')}};exports[_0x6414('0x7')]={'uniqueid':{'type':_0x6414('0x0'),'required':!![]}};exports[_0x6414('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x6414('0x0'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 3a4838b..5532bad 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 _0x7d27=['outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','format','isUndefined','agents','initTelephones','telephones','initTriggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','merge','initVoiceQueueReports','groupBy','uniqueid','unmanaged','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','disposition','ANSWERED','dialQueueProject','SquareProject','initCampaignHopperHistory','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','outboundChannels','timers','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','isNil','interface','SIP/%s','name','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay'];(function(_0x19d6b6,_0x3381d5){var _0x179783=function(_0x523326){while(--_0x523326){_0x19d6b6['push'](_0x19d6b6['shift']());}};_0x179783(++_0x3381d5);}(_0x7d27,0x97));var _0x77d2=function(_0x504f15,_0x23a1ca){_0x504f15=_0x504f15-0x0;var _0x2a92c1=_0x7d27[_0x504f15];return _0x2a92c1;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x77d2('0x0'));var moment=require(_0x77d2('0x1'));var Agent=require(_0x77d2('0x2'));var Telephone=require(_0x77d2('0x3'));var Trunk=require(_0x77d2('0x4'));var VoiceQueue=require(_0x77d2('0x5'));var Trigger=require(_0x77d2('0x6'));var Template=require(_0x77d2('0x7'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x77d2('0x8'));var ZendeskAccount=require(_0x77d2('0x9'));var SalesforceAccount=require(_0x77d2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x77d2('0xb'));var ZohoAccount=require(_0x77d2('0xc'));var DeskAccount=require(_0x77d2('0xd'));var VtigerAccount=require(_0x77d2('0xe'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x77d2('0xf'));var FreshsalesAccount=require(_0x77d2('0x10'));var FaxAccount=require(_0x77d2('0x11'));var Realtime=function(){this['agents']={};this['telephones']={};this[_0x77d2('0x12')]={};this[_0x77d2('0x13')]={};this[_0x77d2('0x14')]={};this[_0x77d2('0x15')]={};this[_0x77d2('0x16')]={};this[_0x77d2('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x77d2('0x18')]={};this[_0x77d2('0x19')]={};this['queueChannels']={};this[_0x77d2('0x1a')]={};this[_0x77d2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x77d2('0x1c')]={};this['sugarcrmAccounts']={};this[_0x77d2('0x1d')]={};this[_0x77d2('0x1e')]={};this[_0x77d2('0x1f')]={};this['vtigerAccounts']={};this['servicenowAccounts']={};this[_0x77d2('0x20')]={};this[_0x77d2('0x21')]={};this[_0x77d2('0x22')]={};};function freeIsNotKey(_0x399999,_0x2f50ac,_0x23372f){var _0xb2e588=_[_0x77d2('0x23')](_0x399999,function(_0x3dad26,_0x429292){return _0x3dad26[_0x23372f];});for(var _0x160f76 in _0x2f50ac){if(_0x2f50ac[_0x77d2('0x24')](_0x160f76)){if(!_0xb2e588[_0x160f76]){delete _0x2f50ac[_0x160f76];}}}}function freeIsNotKeySip(_0x6d588b,_0x5507c4){var _0x300784=_[_0x77d2('0x23')](_0x6d588b,function(_0x293957,_0x256c74){return util['format']('SIP/%s',_0x293957['name']);});for(var _0x3e7530 in _0x5507c4){if(_0x5507c4[_0x77d2('0x24')](_0x3e7530)){if(!_0x300784[_0x3e7530]){delete _0x5507c4[_0x3e7530];}}}}function freeIsNotKeyAgent(_0x4c7e96,_0x36a3fa){var _0x4c6d68=_[_0x77d2('0x23')](_0x4c7e96,function(_0x1c281f,_0x371a1b){var _0xb1c1c2=_[_0x77d2('0x25')](_0x1c281f[_0x77d2('0x26')])?util['format'](_0x77d2('0x27'),_0x1c281f[_0x77d2('0x28')]):_0x1c281f[_0x77d2('0x26')];return _0xb1c1c2;});for(var _0x54513d in _0x36a3fa){if(_0x36a3fa[_0x77d2('0x24')](_0x54513d)){if(!_0x4c6d68[_0x54513d]){delete _0x36a3fa[_0x54513d];}}}}function clearVoiceCallReports(_0xed154e){_0xed154e[_0x77d2('0x29')]=0x0;_0xed154e[_0x77d2('0x2a')]=0x0;_0xed154e[_0x77d2('0x2b')]=0x0;_0xed154e[_0x77d2('0x2c')]=0x0;_0xed154e[_0x77d2('0x2d')]=0x0;}function clearCampaigns(_0x19f2f4){if(!_[_0x77d2('0x2e')](_0x19f2f4)){for(var _0x1b9059 in _0x19f2f4){if(_0x19f2f4['hasOwnProperty'](_0x1b9059)){_0x19f2f4[_0x1b9059][_0x77d2('0x2f')]=0x0;_0x19f2f4[_0x1b9059][_0x77d2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x435986){if(!_[_0x77d2('0x2e')](_0x435986)){for(var _0x49d113 in _0x435986){if(_0x435986[_0x77d2('0x24')](_0x49d113)){_0x435986[_0x49d113][_0x77d2('0x29')]=0x0;_0x435986[_0x49d113][_0x77d2('0x2a')]=0x0;_0x435986[_0x49d113]['unmanaged']=0x0;_0x435986[_0x49d113][_0x77d2('0x31')]=0x0;_0x435986[_0x49d113][_0x77d2('0x2b')]=0x0;_0x435986[_0x49d113][_0x77d2('0x2c')]=0x0;_0x435986[_0x49d113][_0x77d2('0x2d')]=0x0;_0x435986[_0x49d113][_0x77d2('0x32')]=0x0;_0x435986[_0x49d113][_0x77d2('0x33')]=0x0;_0x435986[_0x49d113][_0x77d2('0x34')]=0x0;_0x435986[_0x49d113][_0x77d2('0x35')]=0x0;_0x435986[_0x49d113][_0x77d2('0x36')]=0x0;_0x435986[_0x49d113]['outboundUnknownCallsDay']=0x0;_0x435986[_0x49d113][_0x77d2('0x37')]=0x0;_0x435986[_0x49d113][_0x77d2('0x38')]=0x0;_0x435986[_0x49d113][_0x77d2('0x39')]=0x0;_0x435986[_0x49d113][_0x77d2('0x3a')]=0x0;_0x435986[_0x49d113][_0x77d2('0x3b')]=0x0;_0x435986[_0x49d113][_0x77d2('0x3c')]=0x0;_0x435986[_0x49d113]['outboundAnswerAgiCallsDay']=0x0;_0x435986[_0x49d113][_0x77d2('0x3d')]=0x0;_0x435986[_0x49d113][_0x77d2('0x3e')]=!![];}}}}Realtime[_0x77d2('0x3f')][_0x77d2('0x40')]=function(_0x1d20b6,_0x2c2832){for(var _0x1e2a0e in _0x2c2832){if(_0x1d20b6[_0x77d2('0x24')](_0x1e2a0e)){_0x1d20b6[_0x1e2a0e]=_0x2c2832[_0x1e2a0e];}}};Realtime[_0x77d2('0x3f')][_0x77d2('0x41')]=function(){var _0x52f2ba=this;return function(_0x343120){if(_0x343120){freeIsNotKeyAgent(_0x343120,_0x52f2ba['agents']);for(var _0x2d8836=0x0,_0x1fd043={},_0x5e797c={};_0x2d8836<_0x343120[_0x77d2('0x42')];_0x2d8836+=0x1){_0x1fd043=_0x343120[_0x2d8836];var _0x4ac599=_[_0x77d2('0x25')](_0x1fd043['interface'])?util[_0x77d2('0x43')](_0x77d2('0x27'),_0x1fd043['name']):_0x1fd043[_0x77d2('0x26')];if(_[_0x77d2('0x44')](_0x52f2ba[_0x77d2('0x45')][_0x4ac599])){_0x52f2ba[_0x77d2('0x45')][_0x4ac599]=new Agent(_0x1fd043);}else{_0x52f2ba[_0x77d2('0x40')](_0x52f2ba[_0x77d2('0x45')][_0x4ac599],_0x1fd043);}}}return _0x52f2ba[_0x77d2('0x45')];};};Realtime[_0x77d2('0x3f')][_0x77d2('0x46')]=function(){var _0x3ab0ef=this;return function(_0xe8ec44){if(_0xe8ec44){freeIsNotKeySip(_0xe8ec44,_0x3ab0ef[_0x77d2('0x47')]);for(var _0x55a266=0x0,_0x46b871={},_0xd1e82c={};_0x55a266<_0xe8ec44[_0x77d2('0x42')];_0x55a266+=0x1){_0x46b871=_0xe8ec44[_0x55a266];if(_[_0x77d2('0x44')](_0x3ab0ef[_0x77d2('0x47')][util[_0x77d2('0x43')](_0x77d2('0x27'),_0x46b871[_0x77d2('0x28')])])){_0x3ab0ef[_0x77d2('0x47')][util['format'](_0x77d2('0x27'),_0x46b871[_0x77d2('0x28')])]=new Telephone(_0x46b871);}else{_0x3ab0ef['mergeFromDatabase'](_0x3ab0ef[_0x77d2('0x47')][util[_0x77d2('0x43')](_0x77d2('0x27'),_0x46b871['name'])],_0x46b871);}}}return _0x3ab0ef[_0x77d2('0x47')];};};Realtime[_0x77d2('0x3f')]['initTrunks']=function(){var _0x59c191=this;return function(_0x256caf){if(_0x256caf){freeIsNotKeySip(_0x256caf,_0x59c191[_0x77d2('0x12')]);for(var _0x51f730=0x0,_0x1a514a={},_0x4f2a26={};_0x51f730<_0x256caf['length'];_0x51f730+=0x1){_0x1a514a=_0x256caf[_0x51f730];if(_['isUndefined'](_0x59c191[_0x77d2('0x12')][util['format'](_0x77d2('0x27'),_0x1a514a[_0x77d2('0x28')])])){_0x59c191[_0x77d2('0x12')][util[_0x77d2('0x43')](_0x77d2('0x27'),_0x1a514a[_0x77d2('0x28')])]=new Trunk(_0x1a514a);}else{_0x59c191[_0x77d2('0x40')](_0x59c191[_0x77d2('0x12')][util['format'](_0x77d2('0x27'),_0x1a514a[_0x77d2('0x28')])],_0x1a514a);}}}return _0x59c191[_0x77d2('0x12')];};};Realtime[_0x77d2('0x3f')]['initVoiceQueues']=function(){var _0x486a25=this;return function(_0x48d019){if(_0x48d019){freeIsNotKey(_0x48d019,_0x486a25['voiceQueues'],'name');for(var _0x5374b8=0x0,_0x43edda={},_0x32a5da={};_0x5374b8<_0x48d019[_0x77d2('0x42')];_0x5374b8+=0x1){_0x43edda=_0x48d019[_0x5374b8];if(_['isUndefined'](_0x486a25[_0x77d2('0x13')][_0x43edda['name']])){_0x486a25[_0x77d2('0x13')][_0x43edda['name']]=new VoiceQueue(_0x43edda);}else{_0x486a25[_0x77d2('0x40')](_0x486a25[_0x77d2('0x13')][_0x43edda[_0x77d2('0x28')]],_0x43edda);}}}return _0x486a25[_0x77d2('0x13')];};};Realtime[_0x77d2('0x3f')][_0x77d2('0x48')]=function(){var _0x1abd93=this;return function(_0x5eb12e){if(_0x5eb12e){freeIsNotKey(_0x5eb12e,_0x1abd93[_0x77d2('0x14')],'id');for(var _0x2ae39b=0x0,_0x3eddbe={},_0x21085b={};_0x2ae39b<_0x5eb12e['length'];_0x2ae39b+=0x1){_0x3eddbe=_0x5eb12e[_0x2ae39b];if(_['isUndefined'](_0x1abd93[_0x77d2('0x14')][_0x3eddbe['id']])){_0x1abd93[_0x77d2('0x14')][_0x3eddbe['id']]=new Trigger(_0x3eddbe);}else{_0x1abd93['mergeFromDatabase'](_0x1abd93[_0x77d2('0x14')][_0x3eddbe['id']],_0x3eddbe);}}}return _0x1abd93[_0x77d2('0x14')];};};Realtime[_0x77d2('0x3f')]['initTemplates']=function(){var _0x4e76c2=this;return function(_0x62b285){if(_0x62b285){freeIsNotKey(_0x62b285,_0x4e76c2[_0x77d2('0x16')],'id');for(var _0xb4e334=0x0,_0x31dbb3={},_0x19f120={};_0xb4e334<_0x62b285[_0x77d2('0x42')];_0xb4e334+=0x1){_0x31dbb3=_0x62b285[_0xb4e334];if(_['isUndefined'](_0x4e76c2[_0x77d2('0x16')][_0x31dbb3['id']])){_0x4e76c2['templates'][_0x31dbb3['id']]=new Template(_0x31dbb3);}else{_0x4e76c2[_0x77d2('0x40')](_0x4e76c2[_0x77d2('0x16')][_0x31dbb3['id']],_0x31dbb3);}}}return _0x4e76c2['templates'];};};Realtime['prototype'][_0x77d2('0x49')]=function(){var _0x78cb19=this;return function(_0x453d95){if(_0x453d95){freeIsNotKey(_0x453d95,_0x78cb19['zendeskAccounts'],'id');for(var _0x56e79a=0x0,_0x1b4666={},_0xb1cd53={};_0x56e79a<_0x453d95[_0x77d2('0x42')];_0x56e79a+=0x1){_0x1b4666=_0x453d95[_0x56e79a];if(_[_0x77d2('0x44')](_0x78cb19['zendeskAccounts'][_0x1b4666['id']])){_0x78cb19['zendeskAccounts'][_0x1b4666['id']]=new ZendeskAccount(_0x1b4666);}else{_0x78cb19['mergeFromDatabase'](_0x78cb19[_0x77d2('0x4a')][_0x1b4666['id']],_0x1b4666);}}}return _0x78cb19[_0x77d2('0x4a')];};};Realtime[_0x77d2('0x3f')][_0x77d2('0x4b')]=function(){var _0x5c2533=this;return function(_0xbd1f66){if(_0xbd1f66){freeIsNotKey(_0xbd1f66,_0x5c2533['salesforceAccounts'],'id');for(var _0x2e5636=0x0,_0x38ad04={},_0x373eac={};_0x2e5636<_0xbd1f66[_0x77d2('0x42')];_0x2e5636+=0x1){_0x38ad04=_0xbd1f66[_0x2e5636];if(_[_0x77d2('0x44')](_0x5c2533[_0x77d2('0x1c')][_0x38ad04['id']])){_0x5c2533[_0x77d2('0x1c')][_0x38ad04['id']]=new SalesforceAccount(_0x38ad04);}else{_0x5c2533[_0x77d2('0x40')](_0x5c2533['salesforceAccounts'][_0x38ad04['id']],_0x38ad04);}}}return _0x5c2533['salesforceAccounts'];};};Realtime[_0x77d2('0x3f')][_0x77d2('0x4c')]=function(){var _0x5ba8a1=this;return function(_0x5440d0){if(_0x5440d0){freeIsNotKey(_0x5440d0,_0x5ba8a1['freshdeskAccounts'],'id');for(var _0x2e1667=0x0,_0x1c408f={},_0x2003ab={};_0x2e1667<_0x5440d0[_0x77d2('0x42')];_0x2e1667+=0x1){_0x1c408f=_0x5440d0[_0x2e1667];if(_[_0x77d2('0x44')](_0x5ba8a1[_0x77d2('0x1d')][_0x1c408f['id']])){_0x5ba8a1[_0x77d2('0x1d')][_0x1c408f['id']]=new FreshdeskAccount(_0x1c408f);}else{_0x5ba8a1[_0x77d2('0x40')](_0x5ba8a1[_0x77d2('0x1d')][_0x1c408f['id']],_0x1c408f);}}}return _0x5ba8a1[_0x77d2('0x1d')];};};Realtime[_0x77d2('0x3f')][_0x77d2('0x4d')]=function(){var _0x450fbe=this;return function(_0x509c29){if(_0x509c29){freeIsNotKey(_0x509c29,_0x450fbe[_0x77d2('0x1e')],'id');for(var _0x14e16b=0x0,_0x26e49a={},_0x34f959={};_0x14e16b<_0x509c29[_0x77d2('0x42')];_0x14e16b+=0x1){_0x26e49a=_0x509c29[_0x14e16b];if(_[_0x77d2('0x44')](_0x450fbe[_0x77d2('0x1e')][_0x26e49a['id']])){_0x450fbe['zohoAccounts'][_0x26e49a['id']]=new ZohoAccount(_0x26e49a);}else{_0x450fbe[_0x77d2('0x40')](_0x450fbe[_0x77d2('0x1e')][_0x26e49a['id']],_0x26e49a);}}}return _0x450fbe[_0x77d2('0x1e')];};};Realtime['prototype'][_0x77d2('0x4e')]=function(){var _0x3a5e48=this;return function(_0x4e51a2){if(_0x4e51a2){freeIsNotKey(_0x4e51a2,_0x3a5e48[_0x77d2('0x1f')],'id');for(var _0x12bcef=0x0,_0x2d2c1b={},_0x2321a7={};_0x12bcef<_0x4e51a2[_0x77d2('0x42')];_0x12bcef+=0x1){_0x2d2c1b=_0x4e51a2[_0x12bcef];if(_[_0x77d2('0x44')](_0x3a5e48[_0x77d2('0x1f')][_0x2d2c1b['id']])){_0x3a5e48[_0x77d2('0x1f')][_0x2d2c1b['id']]=new DeskAccount(_0x2d2c1b);}else{_0x3a5e48['mergeFromDatabase'](_0x3a5e48[_0x77d2('0x1f')][_0x2d2c1b['id']],_0x2d2c1b);}}}return _0x3a5e48['deskAccounts'];};};Realtime[_0x77d2('0x3f')][_0x77d2('0x4f')]=function(){var _0x250b2f=this;return function(_0xcabec5){if(_0xcabec5){freeIsNotKey(_0xcabec5,_0x250b2f['sugarcrmAccounts'],'id');for(var _0x24cf0e=0x0,_0x5f55c7={},_0x4e99dc={};_0x24cf0e<_0xcabec5[_0x77d2('0x42')];_0x24cf0e+=0x1){_0x5f55c7=_0xcabec5[_0x24cf0e];if(_[_0x77d2('0x44')](_0x250b2f['sugarcrmAccounts'][_0x5f55c7['id']])){_0x250b2f[_0x77d2('0x50')][_0x5f55c7['id']]=new SugarcrmAccount(_0x5f55c7);}else{_0x250b2f[_0x77d2('0x40')](_0x250b2f[_0x77d2('0x50')][_0x5f55c7['id']],_0x5f55c7);}}}return _0x250b2f['sugarcrmAccounts'];};};Realtime[_0x77d2('0x3f')][_0x77d2('0x51')]=function(){var _0x2c05c8=this;return function(_0x63a86c){if(_0x63a86c){freeIsNotKey(_0x63a86c,_0x2c05c8[_0x77d2('0x52')],'id');for(var _0x474e1e=0x0,_0x54421a={},_0x302b87={};_0x474e1e<_0x63a86c[_0x77d2('0x42')];_0x474e1e+=0x1){_0x54421a=_0x63a86c[_0x474e1e];if(_[_0x77d2('0x44')](_0x2c05c8[_0x77d2('0x52')][_0x54421a['id']])){_0x2c05c8[_0x77d2('0x52')][_0x54421a['id']]=new VtigerAccount(_0x54421a);}else{_0x2c05c8['mergeFromDatabase'](_0x2c05c8[_0x77d2('0x52')][_0x54421a['id']],_0x54421a);}}}return _0x2c05c8[_0x77d2('0x52')];};};Realtime[_0x77d2('0x3f')][_0x77d2('0x53')]=function(){var _0x44bbd1=this;return function(_0x4b8bf2){if(_0x4b8bf2){freeIsNotKey(_0x4b8bf2,_0x44bbd1[_0x77d2('0x54')],'id');for(var _0x3ac759=0x0,_0x1773d7={},_0x40da11={};_0x3ac759<_0x4b8bf2[_0x77d2('0x42')];_0x3ac759+=0x1){_0x1773d7=_0x4b8bf2[_0x3ac759];if(_['isUndefined'](_0x44bbd1[_0x77d2('0x54')][_0x1773d7['id']])){_0x44bbd1[_0x77d2('0x54')][_0x1773d7['id']]=new ServicenowAccount(_0x1773d7);}else{_0x44bbd1['mergeFromDatabase'](_0x44bbd1[_0x77d2('0x54')][_0x1773d7['id']],_0x1773d7);}}}return _0x44bbd1[_0x77d2('0x54')];};};Realtime['prototype'][_0x77d2('0x55')]=function(){var _0x22f352=this;return function(_0x2c56be){if(_0x2c56be){freeIsNotKey(_0x2c56be,_0x22f352[_0x77d2('0x20')],'id');for(var _0x586a24=0x0,_0x504b44={},_0x2af927={};_0x586a24<_0x2c56be[_0x77d2('0x42')];_0x586a24+=0x1){_0x504b44=_0x2c56be[_0x586a24];if(_[_0x77d2('0x44')](_0x22f352['dynamics365Accounts'][_0x504b44['id']])){_0x22f352[_0x77d2('0x20')][_0x504b44['id']]=new Dynamics365Account(_0x504b44);}else{_0x22f352[_0x77d2('0x40')](_0x22f352[_0x77d2('0x20')][_0x504b44['id']],_0x504b44);}}}return _0x22f352[_0x77d2('0x20')];};};Realtime[_0x77d2('0x3f')]['initFreshsalesAccounts']=function(){var _0x56dcf6=this;return function(_0x220147){if(_0x220147){freeIsNotKey(_0x220147,_0x56dcf6[_0x77d2('0x21')],'id');for(var _0x5a922c=0x0,_0x18d043={},_0x502ec6={};_0x5a922c<_0x220147[_0x77d2('0x42')];_0x5a922c+=0x1){_0x18d043=_0x220147[_0x5a922c];if(_[_0x77d2('0x44')](_0x56dcf6['freshsalesAccounts'][_0x18d043['id']])){_0x56dcf6['freshsalesAccounts'][_0x18d043['id']]=new FreshsalesAccount(_0x18d043);}else{_0x56dcf6[_0x77d2('0x40')](_0x56dcf6[_0x77d2('0x21')][_0x18d043['id']],_0x18d043);}}}return _0x56dcf6[_0x77d2('0x21')];};};Realtime[_0x77d2('0x3f')]['initVoiceQueueHopperHistory']=function(){var _0x2cdcc3=this;return function(_0x59cc32){for(var _0x3069fa=0x0;_0x3069fa<_0x59cc32[_0x77d2('0x42')];_0x3069fa+=0x1){_[_0x77d2('0x56')](_0x2cdcc3[_0x77d2('0x13')][_0x59cc32[_0x3069fa][_0x77d2('0x28')]],_0x59cc32[_0x3069fa]);}return _0x2cdcc3[_0x77d2('0x13')];};};Realtime[_0x77d2('0x3f')][_0x77d2('0x57')]=function(){var _0x5ed4a3=this;return function(_0x1f3dc8){clearVoiceQueues(_0x5ed4a3['voiceQueues']);if(_0x1f3dc8){_0x1f3dc8=_[_0x77d2('0x58')](_0x1f3dc8,_0x77d2('0x59'));for(var _0x50e918 in _0x1f3dc8){if(_0x1f3dc8[_0x77d2('0x24')](_0x50e918)){var _0x273eb3={};for(var _0x16d1ea=0x0;_0x16d1ea<_0x1f3dc8[_0x50e918][_0x77d2('0x42')];_0x16d1ea+=0x1){var _0x4c9dca=_0x1f3dc8[_0x50e918][_0x16d1ea]['queue'];if(_0x5ed4a3['voiceQueues'][_0x4c9dca]){if(_0x1f3dc8[_0x50e918][_0x16d1ea]['queuecallerexit']){_0x5ed4a3[_0x77d2('0x13')][_0x4c9dca][_0x77d2('0x5a')]+=0x1;}if(_0x1f3dc8[_0x50e918][_0x16d1ea]['queuecallerabandon']){_0x5ed4a3['voiceQueues'][_0x4c9dca][_0x77d2('0x31')]+=0x1;}_0x5ed4a3['voiceQueues'][_0x4c9dca][_0x77d2('0x2b')]+=moment(_0x1f3dc8[_0x50e918][_0x16d1ea][_0x77d2('0x5b')])[_0x77d2('0x5c')](moment(_0x1f3dc8[_0x50e918][_0x16d1ea][_0x77d2('0x5d')]),_0x77d2('0x5e'))||0x0;if(_0x16d1ea===_0x1f3dc8[_0x50e918][_0x77d2('0x42')]-0x1){_0x5ed4a3['voiceQueues'][_0x4c9dca][_0x77d2('0x2c')]+=moment(_0x1f3dc8[_0x50e918][_0x16d1ea][_0x77d2('0x5f')]||_0x1f3dc8[_0x50e918][_0x16d1ea][_0x77d2('0x60')]||_0x1f3dc8[_0x50e918][_0x16d1ea][_0x77d2('0x61')])[_0x77d2('0x5c')](moment(_0x1f3dc8[_0x50e918][_0x16d1ea]['queuecallerjoinAt']),_0x77d2('0x5e'))||0x0;_0x5ed4a3['voiceQueues'][_0x4c9dca]['total']+=0x1;if(_0x1f3dc8[_0x50e918][_0x16d1ea]['queuecallercomplete']){_0x5ed4a3[_0x77d2('0x13')][_0x4c9dca][_0x77d2('0x2a')]+=0x1;_0x5ed4a3['voiceQueues'][_0x4c9dca]['sumBillable']+=moment(_0x1f3dc8[_0x50e918][_0x16d1ea][_0x77d2('0x5f')])[_0x77d2('0x5c')](moment(_0x1f3dc8[_0x50e918][_0x16d1ea][_0x77d2('0x5b')]),_0x77d2('0x5e'))||0x0;}}else{_0x5ed4a3[_0x77d2('0x13')][_0x4c9dca][_0x77d2('0x2c')]+=_0x5ed4a3[_0x77d2('0x13')][_0x4c9dca][_0x77d2('0x2b')]||0x0;}}}}}}return _0x5ed4a3[_0x77d2('0x13')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x34e3c0=this;return function(_0x12faa6){clearVoiceCallReports(_0x34e3c0[_0x77d2('0x17')]);if(_0x12faa6){for(var _0x3c9131=0x0;_0x3c9131<_0x12faa6[_0x77d2('0x42')];_0x3c9131+=0x1){_0x34e3c0[_0x77d2('0x17')][_0x77d2('0x29')]+=0x1;_0x34e3c0[_0x77d2('0x17')][_0x77d2('0x2c')]+=_0x12faa6[_0x3c9131]['duration'];if(_0x12faa6[_0x3c9131][_0x77d2('0x62')]===_0x77d2('0x63')){_0x34e3c0[_0x77d2('0x17')][_0x77d2('0x2a')]+=0x1;_0x34e3c0[_0x77d2('0x17')]['sumHoldTime']+=_0x12faa6[_0x3c9131]['duration']-_0x12faa6[_0x3c9131]['billableseconds']||0x0;_0x34e3c0['outbound'][_0x77d2('0x2d')]+=_0x12faa6[_0x3c9131]['billableseconds'];}}}return _0x34e3c0[_0x77d2('0x17')];};};Realtime[_0x77d2('0x3f')]['initCampaigns']=function(){var _0x3e098a=this;return function(_0x7fea28){if(_0x7fea28){freeIsNotKey(_0x7fea28,_0x3e098a['campaigns'],'name');for(var _0x1fa61b=0x0,_0x19809c={};_0x1fa61b<_0x7fea28[_0x77d2('0x42')];_0x1fa61b+=0x1){_0x19809c=_0x7fea28[_0x1fa61b];if(_[_0x77d2('0x44')](_0x3e098a['campaigns'][_0x19809c[_0x77d2('0x28')]])){_0x3e098a[_0x77d2('0x15')][_0x19809c[_0x77d2('0x28')]]=new Campaign(_0x19809c);}else{_0x3e098a[_0x77d2('0x40')](_0x3e098a['campaigns'][_0x19809c[_0x77d2('0x28')]],_0x19809c);_0x3e098a[_0x77d2('0x15')][_0x19809c[_0x77d2('0x28')]][_0x77d2('0x64')]=_0x19809c[_0x77d2('0x65')]?_0x19809c[_0x77d2('0x65')][_0x77d2('0x28')]:undefined;}}}return _0x3e098a[_0x77d2('0x15')];};};Realtime[_0x77d2('0x3f')]['initVoiceExtensions']=function(){var _0x2ab463=this;return function(_0x4e4608){if(_0x4e4608){freeIsNotKey(_0x4e4608,_0x2ab463['voiceExtensions'],'id');for(var _0x20127c=0x0,_0x46dae6={};_0x20127c<_0x4e4608['length'];_0x20127c+=0x1){_0x46dae6=_0x4e4608[_0x20127c];if(_[_0x77d2('0x44')](_0x2ab463[_0x77d2('0x18')][_0x46dae6['id']])){_0x2ab463[_0x77d2('0x18')][_0x46dae6['id']]=new VoiceExtension(_0x46dae6);}else{_0x2ab463[_0x77d2('0x40')](_0x2ab463['voiceExtensions'][_0x46dae6['id']],_0x46dae6);}}}return _0x2ab463['voiceExtensions'];};};Realtime['prototype'][_0x77d2('0x66')]=function(){var _0x5e36bc=this;return function(_0x37db84){clearCampaigns(_0x5e36bc[_0x77d2('0x15')]);for(var _0x476ab4=0x0;_0x476ab4<_0x37db84[_0x77d2('0x42')];_0x476ab4+=0x1){_['merge'](_0x5e36bc[_0x77d2('0x15')][_0x37db84[_0x476ab4][_0x77d2('0x28')]],_0x37db84[_0x476ab4]);}return _0x5e36bc[_0x77d2('0x15')];};};Realtime[_0x77d2('0x3f')]['initFaxAccounts']=function(){var _0x3cac7f=this;return function(_0x58f676){if(_0x58f676){freeIsNotKey(_0x58f676,_0x3cac7f['faxAccounts'],'id');for(var _0x250e72=0x0,_0x168138={},_0x48248e={};_0x250e72<_0x58f676[_0x77d2('0x42')];_0x250e72+=0x1){_0x168138=_0x58f676[_0x250e72];if(_['isUndefined'](_0x3cac7f[_0x77d2('0x22')][_0x168138['id']])){_0x3cac7f[_0x77d2('0x22')][_0x168138['id']]=new FaxAccount(_0x168138);}else{_0x3cac7f[_0x77d2('0x40')](_0x3cac7f[_0x77d2('0x22')][_0x168138['id']],_0x168138);}}}return _0x3cac7f[_0x77d2('0x22')];};};module['exports']=Realtime; \ No newline at end of file +var _0x9dd9=['mergeFromDatabase','initAgents','length','isUndefined','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','seconds','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','disposition','ANSWERED','duration','initCampaigns','campaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','initFaxAccounts','bluebird','util','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','templates','voiceExtensions','channels','queueChannels','outboundChannels','zendeskAccounts','salesforceAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','isEmpty','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype'];(function(_0x5c117e,_0x38a25e){var _0x4a7758=function(_0x2e3e71){while(--_0x2e3e71){_0x5c117e['push'](_0x5c117e['shift']());}};_0x4a7758(++_0x38a25e);}(_0x9dd9,0x16d));var _0x99dd=function(_0x548112,_0x41ca88){_0x548112=_0x548112-0x0;var _0x51cf58=_0x9dd9[_0x548112];return _0x51cf58;};'use strict';var BPromise=require(_0x99dd('0x0'));var util=require(_0x99dd('0x1'));var _=require('lodash');var moment=require(_0x99dd('0x2'));var Agent=require(_0x99dd('0x3'));var Telephone=require(_0x99dd('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x99dd('0x5'));var Trigger=require(_0x99dd('0x6'));var Template=require(_0x99dd('0x7'));var Campaign=require(_0x99dd('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x99dd('0x9'));var FreshdeskAccount=require(_0x99dd('0xa'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x99dd('0xb'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x99dd('0xc'));var ServicenowAccount=require(_0x99dd('0xd'));var Dynamics365Account=require(_0x99dd('0xe'));var FreshsalesAccount=require(_0x99dd('0xf'));var FaxAccount=require(_0x99dd('0x10'));var Realtime=function(){this[_0x99dd('0x11')]={};this[_0x99dd('0x12')]={};this[_0x99dd('0x13')]={};this[_0x99dd('0x14')]={};this['triggers']={};this['campaigns']={};this[_0x99dd('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x99dd('0x16')]={};this[_0x99dd('0x17')]={};this[_0x99dd('0x18')]={};this[_0x99dd('0x19')]={};this['timers']={};this['settings']={};this[_0x99dd('0x1a')]={};this[_0x99dd('0x1b')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this['zohoAccounts']={};this['deskAccounts']={};this[_0x99dd('0x1c')]={};this[_0x99dd('0x1d')]={};this[_0x99dd('0x1e')]={};this[_0x99dd('0x1f')]={};this[_0x99dd('0x20')]={};};function freeIsNotKey(_0x3628a2,_0x1dd2da,_0x3bbb71){var _0x3008f1=_[_0x99dd('0x21')](_0x3628a2,function(_0x59c66c,_0x49a8f4){return _0x59c66c[_0x3bbb71];});for(var _0x257559 in _0x1dd2da){if(_0x1dd2da[_0x99dd('0x22')](_0x257559)){if(!_0x3008f1[_0x257559]){delete _0x1dd2da[_0x257559];}}}}function freeIsNotKeySip(_0x54a531,_0x44377e){var _0xb6b233=_[_0x99dd('0x21')](_0x54a531,function(_0x3744bf,_0x3d27a9){return util[_0x99dd('0x23')](_0x99dd('0x24'),_0x3744bf[_0x99dd('0x25')]);});for(var _0x5607aa in _0x44377e){if(_0x44377e[_0x99dd('0x22')](_0x5607aa)){if(!_0xb6b233[_0x5607aa]){delete _0x44377e[_0x5607aa];}}}}function freeIsNotKeyAgent(_0x56038b,_0x180a8a){var _0x233fd6=_['mapKeys'](_0x56038b,function(_0x15016e,_0x5294fa){var _0x317e94=_[_0x99dd('0x26')](_0x15016e['interface'])?util[_0x99dd('0x23')]('SIP/%s',_0x15016e[_0x99dd('0x25')]):_0x15016e[_0x99dd('0x27')];return _0x317e94;});for(var _0x4bd9d7 in _0x180a8a){if(_0x180a8a[_0x99dd('0x22')](_0x4bd9d7)){if(!_0x233fd6[_0x4bd9d7]){delete _0x180a8a[_0x4bd9d7];}}}}function clearVoiceCallReports(_0x20af19){_0x20af19[_0x99dd('0x28')]=0x0;_0x20af19[_0x99dd('0x29')]=0x0;_0x20af19[_0x99dd('0x2a')]=0x0;_0x20af19[_0x99dd('0x2b')]=0x0;_0x20af19['sumBillable']=0x0;}function clearCampaigns(_0x48e25d){if(!_[_0x99dd('0x2c')](_0x48e25d)){for(var _0x568470 in _0x48e25d){if(_0x48e25d['hasOwnProperty'](_0x568470)){_0x48e25d[_0x568470]['ivrTotalCallsDays']=0x0;_0x48e25d[_0x568470][_0x99dd('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x11430d){if(!_[_0x99dd('0x2c')](_0x11430d)){for(var _0x28c2bd in _0x11430d){if(_0x11430d[_0x99dd('0x22')](_0x28c2bd)){_0x11430d[_0x28c2bd][_0x99dd('0x28')]=0x0;_0x11430d[_0x28c2bd][_0x99dd('0x29')]=0x0;_0x11430d[_0x28c2bd][_0x99dd('0x2e')]=0x0;_0x11430d[_0x28c2bd]['abandoned']=0x0;_0x11430d[_0x28c2bd]['sumHoldTime']=0x0;_0x11430d[_0x28c2bd][_0x99dd('0x2b')]=0x0;_0x11430d[_0x28c2bd][_0x99dd('0x2f')]=0x0;_0x11430d[_0x28c2bd][_0x99dd('0x30')]=0x0;_0x11430d[_0x28c2bd][_0x99dd('0x31')]=0x0;_0x11430d[_0x28c2bd][_0x99dd('0x32')]=0x0;_0x11430d[_0x28c2bd][_0x99dd('0x33')]=0x0;_0x11430d[_0x28c2bd][_0x99dd('0x34')]=0x0;_0x11430d[_0x28c2bd][_0x99dd('0x35')]=0x0;_0x11430d[_0x28c2bd]['outboundDropCallsDayTimeout']=0x0;_0x11430d[_0x28c2bd][_0x99dd('0x36')]=0x0;_0x11430d[_0x28c2bd]['outboundBlacklistCallsDay']=0x0;_0x11430d[_0x28c2bd][_0x99dd('0x37')]=0x0;_0x11430d[_0x28c2bd]['outboundRejectCallsDay']=0x0;_0x11430d[_0x28c2bd]['outboundReCallsDay']=0x0;_0x11430d[_0x28c2bd][_0x99dd('0x30')]=0x0;_0x11430d[_0x28c2bd][_0x99dd('0x38')]=0x0;_0x11430d[_0x28c2bd][_0x99dd('0x39')]=!![];}}}}Realtime[_0x99dd('0x3a')][_0x99dd('0x3b')]=function(_0x8f80b5,_0x1bc0bb){for(var _0x266583 in _0x1bc0bb){if(_0x8f80b5[_0x99dd('0x22')](_0x266583)){_0x8f80b5[_0x266583]=_0x1bc0bb[_0x266583];}}};Realtime[_0x99dd('0x3a')][_0x99dd('0x3c')]=function(){var _0x220203=this;return function(_0x20b677){if(_0x20b677){freeIsNotKeyAgent(_0x20b677,_0x220203[_0x99dd('0x11')]);for(var _0x55cef3=0x0,_0x4bdeb4={},_0x24a854={};_0x55cef3<_0x20b677[_0x99dd('0x3d')];_0x55cef3+=0x1){_0x4bdeb4=_0x20b677[_0x55cef3];var _0x1db9f5=_[_0x99dd('0x26')](_0x4bdeb4[_0x99dd('0x27')])?util[_0x99dd('0x23')]('SIP/%s',_0x4bdeb4[_0x99dd('0x25')]):_0x4bdeb4['interface'];if(_[_0x99dd('0x3e')](_0x220203[_0x99dd('0x11')][_0x1db9f5])){_0x220203['agents'][_0x1db9f5]=new Agent(_0x4bdeb4);}else{_0x220203[_0x99dd('0x3b')](_0x220203[_0x99dd('0x11')][_0x1db9f5],_0x4bdeb4);}}}return _0x220203[_0x99dd('0x11')];};};Realtime['prototype']['initTelephones']=function(){var _0x34a699=this;return function(_0x37cd23){if(_0x37cd23){freeIsNotKeySip(_0x37cd23,_0x34a699[_0x99dd('0x12')]);for(var _0x217840=0x0,_0x40ec18={},_0x383169={};_0x217840<_0x37cd23['length'];_0x217840+=0x1){_0x40ec18=_0x37cd23[_0x217840];if(_[_0x99dd('0x3e')](_0x34a699[_0x99dd('0x12')][util[_0x99dd('0x23')](_0x99dd('0x24'),_0x40ec18[_0x99dd('0x25')])])){_0x34a699[_0x99dd('0x12')][util[_0x99dd('0x23')](_0x99dd('0x24'),_0x40ec18[_0x99dd('0x25')])]=new Telephone(_0x40ec18);}else{_0x34a699[_0x99dd('0x3b')](_0x34a699['telephones'][util[_0x99dd('0x23')](_0x99dd('0x24'),_0x40ec18[_0x99dd('0x25')])],_0x40ec18);}}}return _0x34a699['telephones'];};};Realtime[_0x99dd('0x3a')]['initTrunks']=function(){var _0x379bf6=this;return function(_0x36ee7f){if(_0x36ee7f){freeIsNotKeySip(_0x36ee7f,_0x379bf6[_0x99dd('0x13')]);for(var _0x4d8b75=0x0,_0x53a6ef={},_0x530f64={};_0x4d8b75<_0x36ee7f['length'];_0x4d8b75+=0x1){_0x53a6ef=_0x36ee7f[_0x4d8b75];if(_[_0x99dd('0x3e')](_0x379bf6[_0x99dd('0x13')][util[_0x99dd('0x23')](_0x99dd('0x24'),_0x53a6ef['name'])])){_0x379bf6[_0x99dd('0x13')][util['format'](_0x99dd('0x24'),_0x53a6ef[_0x99dd('0x25')])]=new Trunk(_0x53a6ef);}else{_0x379bf6['mergeFromDatabase'](_0x379bf6[_0x99dd('0x13')][util[_0x99dd('0x23')](_0x99dd('0x24'),_0x53a6ef['name'])],_0x53a6ef);}}}return _0x379bf6[_0x99dd('0x13')];};};Realtime[_0x99dd('0x3a')]['initVoiceQueues']=function(){var _0x1e6082=this;return function(_0x460ee7){if(_0x460ee7){freeIsNotKey(_0x460ee7,_0x1e6082[_0x99dd('0x14')],_0x99dd('0x25'));for(var _0x27ee7f=0x0,_0x226468={},_0x3dad42={};_0x27ee7f<_0x460ee7['length'];_0x27ee7f+=0x1){_0x226468=_0x460ee7[_0x27ee7f];if(_['isUndefined'](_0x1e6082[_0x99dd('0x14')][_0x226468[_0x99dd('0x25')]])){_0x1e6082[_0x99dd('0x14')][_0x226468[_0x99dd('0x25')]]=new VoiceQueue(_0x226468);}else{_0x1e6082[_0x99dd('0x3b')](_0x1e6082['voiceQueues'][_0x226468['name']],_0x226468);}}}return _0x1e6082[_0x99dd('0x14')];};};Realtime[_0x99dd('0x3a')][_0x99dd('0x3f')]=function(){var _0x546559=this;return function(_0x248aa0){if(_0x248aa0){freeIsNotKey(_0x248aa0,_0x546559[_0x99dd('0x40')],'id');for(var _0x3f00f9=0x0,_0x1e9480={},_0x2edc07={};_0x3f00f9<_0x248aa0[_0x99dd('0x3d')];_0x3f00f9+=0x1){_0x1e9480=_0x248aa0[_0x3f00f9];if(_[_0x99dd('0x3e')](_0x546559[_0x99dd('0x40')][_0x1e9480['id']])){_0x546559[_0x99dd('0x40')][_0x1e9480['id']]=new Trigger(_0x1e9480);}else{_0x546559['mergeFromDatabase'](_0x546559[_0x99dd('0x40')][_0x1e9480['id']],_0x1e9480);}}}return _0x546559['triggers'];};};Realtime[_0x99dd('0x3a')][_0x99dd('0x41')]=function(){var _0x443e03=this;return function(_0xb8974f){if(_0xb8974f){freeIsNotKey(_0xb8974f,_0x443e03['templates'],'id');for(var _0x22efb4=0x0,_0x1cff0e={},_0x492657={};_0x22efb4<_0xb8974f[_0x99dd('0x3d')];_0x22efb4+=0x1){_0x1cff0e=_0xb8974f[_0x22efb4];if(_[_0x99dd('0x3e')](_0x443e03[_0x99dd('0x15')][_0x1cff0e['id']])){_0x443e03[_0x99dd('0x15')][_0x1cff0e['id']]=new Template(_0x1cff0e);}else{_0x443e03[_0x99dd('0x3b')](_0x443e03[_0x99dd('0x15')][_0x1cff0e['id']],_0x1cff0e);}}}return _0x443e03[_0x99dd('0x15')];};};Realtime['prototype'][_0x99dd('0x42')]=function(){var _0x24afc4=this;return function(_0x25b338){if(_0x25b338){freeIsNotKey(_0x25b338,_0x24afc4[_0x99dd('0x1a')],'id');for(var _0x2f9646=0x0,_0x46681f={},_0x3f4338={};_0x2f9646<_0x25b338[_0x99dd('0x3d')];_0x2f9646+=0x1){_0x46681f=_0x25b338[_0x2f9646];if(_[_0x99dd('0x3e')](_0x24afc4['zendeskAccounts'][_0x46681f['id']])){_0x24afc4['zendeskAccounts'][_0x46681f['id']]=new ZendeskAccount(_0x46681f);}else{_0x24afc4[_0x99dd('0x3b')](_0x24afc4[_0x99dd('0x1a')][_0x46681f['id']],_0x46681f);}}}return _0x24afc4[_0x99dd('0x1a')];};};Realtime['prototype'][_0x99dd('0x43')]=function(){var _0x198b28=this;return function(_0x1171b6){if(_0x1171b6){freeIsNotKey(_0x1171b6,_0x198b28['salesforceAccounts'],'id');for(var _0x255d01=0x0,_0x31b88f={},_0x6e103f={};_0x255d01<_0x1171b6[_0x99dd('0x3d')];_0x255d01+=0x1){_0x31b88f=_0x1171b6[_0x255d01];if(_[_0x99dd('0x3e')](_0x198b28[_0x99dd('0x1b')][_0x31b88f['id']])){_0x198b28[_0x99dd('0x1b')][_0x31b88f['id']]=new SalesforceAccount(_0x31b88f);}else{_0x198b28[_0x99dd('0x3b')](_0x198b28[_0x99dd('0x1b')][_0x31b88f['id']],_0x31b88f);}}}return _0x198b28[_0x99dd('0x1b')];};};Realtime[_0x99dd('0x3a')][_0x99dd('0x44')]=function(){var _0x5b1027=this;return function(_0x46b7ab){if(_0x46b7ab){freeIsNotKey(_0x46b7ab,_0x5b1027['freshdeskAccounts'],'id');for(var _0x1bf1c4=0x0,_0x545b14={},_0x400753={};_0x1bf1c4<_0x46b7ab[_0x99dd('0x3d')];_0x1bf1c4+=0x1){_0x545b14=_0x46b7ab[_0x1bf1c4];if(_[_0x99dd('0x3e')](_0x5b1027[_0x99dd('0x45')][_0x545b14['id']])){_0x5b1027[_0x99dd('0x45')][_0x545b14['id']]=new FreshdeskAccount(_0x545b14);}else{_0x5b1027['mergeFromDatabase'](_0x5b1027[_0x99dd('0x45')][_0x545b14['id']],_0x545b14);}}}return _0x5b1027[_0x99dd('0x45')];};};Realtime['prototype'][_0x99dd('0x46')]=function(){var _0x90b9fa=this;return function(_0xb1ad02){if(_0xb1ad02){freeIsNotKey(_0xb1ad02,_0x90b9fa['zohoAccounts'],'id');for(var _0x392899=0x0,_0x42c414={},_0x4a06ae={};_0x392899<_0xb1ad02[_0x99dd('0x3d')];_0x392899+=0x1){_0x42c414=_0xb1ad02[_0x392899];if(_['isUndefined'](_0x90b9fa[_0x99dd('0x47')][_0x42c414['id']])){_0x90b9fa[_0x99dd('0x47')][_0x42c414['id']]=new ZohoAccount(_0x42c414);}else{_0x90b9fa[_0x99dd('0x3b')](_0x90b9fa[_0x99dd('0x47')][_0x42c414['id']],_0x42c414);}}}return _0x90b9fa['zohoAccounts'];};};Realtime[_0x99dd('0x3a')][_0x99dd('0x48')]=function(){var _0x47f23e=this;return function(_0x4088d0){if(_0x4088d0){freeIsNotKey(_0x4088d0,_0x47f23e[_0x99dd('0x49')],'id');for(var _0x492302=0x0,_0x104547={},_0x54411e={};_0x492302<_0x4088d0[_0x99dd('0x3d')];_0x492302+=0x1){_0x104547=_0x4088d0[_0x492302];if(_[_0x99dd('0x3e')](_0x47f23e['deskAccounts'][_0x104547['id']])){_0x47f23e['deskAccounts'][_0x104547['id']]=new DeskAccount(_0x104547);}else{_0x47f23e[_0x99dd('0x3b')](_0x47f23e[_0x99dd('0x49')][_0x104547['id']],_0x104547);}}}return _0x47f23e['deskAccounts'];};};Realtime['prototype'][_0x99dd('0x4a')]=function(){var _0x2c472b=this;return function(_0x540f0e){if(_0x540f0e){freeIsNotKey(_0x540f0e,_0x2c472b[_0x99dd('0x4b')],'id');for(var _0x1fe96f=0x0,_0x36c85b={},_0x493c7d={};_0x1fe96f<_0x540f0e[_0x99dd('0x3d')];_0x1fe96f+=0x1){_0x36c85b=_0x540f0e[_0x1fe96f];if(_['isUndefined'](_0x2c472b[_0x99dd('0x4b')][_0x36c85b['id']])){_0x2c472b[_0x99dd('0x4b')][_0x36c85b['id']]=new SugarcrmAccount(_0x36c85b);}else{_0x2c472b[_0x99dd('0x3b')](_0x2c472b[_0x99dd('0x4b')][_0x36c85b['id']],_0x36c85b);}}}return _0x2c472b[_0x99dd('0x4b')];};};Realtime[_0x99dd('0x3a')][_0x99dd('0x4c')]=function(){var _0xd27538=this;return function(_0x31f1b2){if(_0x31f1b2){freeIsNotKey(_0x31f1b2,_0xd27538[_0x99dd('0x1c')],'id');for(var _0x5bcdb0=0x0,_0x459d7d={},_0x206897={};_0x5bcdb0<_0x31f1b2[_0x99dd('0x3d')];_0x5bcdb0+=0x1){_0x459d7d=_0x31f1b2[_0x5bcdb0];if(_['isUndefined'](_0xd27538['vtigerAccounts'][_0x459d7d['id']])){_0xd27538['vtigerAccounts'][_0x459d7d['id']]=new VtigerAccount(_0x459d7d);}else{_0xd27538[_0x99dd('0x3b')](_0xd27538[_0x99dd('0x1c')][_0x459d7d['id']],_0x459d7d);}}}return _0xd27538[_0x99dd('0x1c')];};};Realtime[_0x99dd('0x3a')][_0x99dd('0x4d')]=function(){var _0x3985ce=this;return function(_0x2cdb61){if(_0x2cdb61){freeIsNotKey(_0x2cdb61,_0x3985ce[_0x99dd('0x1d')],'id');for(var _0x38e116=0x0,_0xf6a2be={},_0x3a0d1f={};_0x38e116<_0x2cdb61['length'];_0x38e116+=0x1){_0xf6a2be=_0x2cdb61[_0x38e116];if(_[_0x99dd('0x3e')](_0x3985ce[_0x99dd('0x1d')][_0xf6a2be['id']])){_0x3985ce['servicenowAccounts'][_0xf6a2be['id']]=new ServicenowAccount(_0xf6a2be);}else{_0x3985ce[_0x99dd('0x3b')](_0x3985ce[_0x99dd('0x1d')][_0xf6a2be['id']],_0xf6a2be);}}}return _0x3985ce[_0x99dd('0x1d')];};};Realtime[_0x99dd('0x3a')]['initDynamics365Accounts']=function(){var _0xafb464=this;return function(_0x14db22){if(_0x14db22){freeIsNotKey(_0x14db22,_0xafb464[_0x99dd('0x1e')],'id');for(var _0x19645e=0x0,_0x35731b={},_0x5366b9={};_0x19645e<_0x14db22[_0x99dd('0x3d')];_0x19645e+=0x1){_0x35731b=_0x14db22[_0x19645e];if(_[_0x99dd('0x3e')](_0xafb464[_0x99dd('0x1e')][_0x35731b['id']])){_0xafb464[_0x99dd('0x1e')][_0x35731b['id']]=new Dynamics365Account(_0x35731b);}else{_0xafb464[_0x99dd('0x3b')](_0xafb464[_0x99dd('0x1e')][_0x35731b['id']],_0x35731b);}}}return _0xafb464[_0x99dd('0x1e')];};};Realtime[_0x99dd('0x3a')][_0x99dd('0x4e')]=function(){var _0x15f8e4=this;return function(_0x3a0146){if(_0x3a0146){freeIsNotKey(_0x3a0146,_0x15f8e4[_0x99dd('0x1f')],'id');for(var _0x228c9f=0x0,_0x8df2f0={},_0x5d74ad={};_0x228c9f<_0x3a0146['length'];_0x228c9f+=0x1){_0x8df2f0=_0x3a0146[_0x228c9f];if(_[_0x99dd('0x3e')](_0x15f8e4['freshsalesAccounts'][_0x8df2f0['id']])){_0x15f8e4[_0x99dd('0x1f')][_0x8df2f0['id']]=new FreshsalesAccount(_0x8df2f0);}else{_0x15f8e4['mergeFromDatabase'](_0x15f8e4[_0x99dd('0x1f')][_0x8df2f0['id']],_0x8df2f0);}}}return _0x15f8e4[_0x99dd('0x1f')];};};Realtime['prototype'][_0x99dd('0x4f')]=function(){var _0x2bdff4=this;return function(_0x50c2c7){for(var _0x2da17e=0x0;_0x2da17e<_0x50c2c7[_0x99dd('0x3d')];_0x2da17e+=0x1){_[_0x99dd('0x50')](_0x2bdff4[_0x99dd('0x14')][_0x50c2c7[_0x2da17e][_0x99dd('0x25')]],_0x50c2c7[_0x2da17e]);}return _0x2bdff4[_0x99dd('0x14')];};};Realtime[_0x99dd('0x3a')][_0x99dd('0x51')]=function(){var _0x44eb9a=this;return function(_0x4fdfff){clearVoiceQueues(_0x44eb9a[_0x99dd('0x14')]);if(_0x4fdfff){_0x4fdfff=_[_0x99dd('0x52')](_0x4fdfff,_0x99dd('0x53'));for(var _0x176cb9 in _0x4fdfff){if(_0x4fdfff[_0x99dd('0x22')](_0x176cb9)){var _0x49ed43={};for(var _0x5978fc=0x0;_0x5978fc<_0x4fdfff[_0x176cb9][_0x99dd('0x3d')];_0x5978fc+=0x1){var _0x1675c7=_0x4fdfff[_0x176cb9][_0x5978fc][_0x99dd('0x54')];if(_0x44eb9a[_0x99dd('0x14')][_0x1675c7]){if(_0x4fdfff[_0x176cb9][_0x5978fc][_0x99dd('0x55')]){_0x44eb9a[_0x99dd('0x14')][_0x1675c7][_0x99dd('0x2e')]+=0x1;}if(_0x4fdfff[_0x176cb9][_0x5978fc][_0x99dd('0x56')]){_0x44eb9a['voiceQueues'][_0x1675c7][_0x99dd('0x57')]+=0x1;}_0x44eb9a[_0x99dd('0x14')][_0x1675c7][_0x99dd('0x2a')]+=moment(_0x4fdfff[_0x176cb9][_0x5978fc]['queuecallerleaveAt'])[_0x99dd('0x58')](moment(_0x4fdfff[_0x176cb9][_0x5978fc][_0x99dd('0x59')]),'seconds')||0x0;if(_0x5978fc===_0x4fdfff[_0x176cb9]['length']-0x1){_0x44eb9a['voiceQueues'][_0x1675c7][_0x99dd('0x2b')]+=moment(_0x4fdfff[_0x176cb9][_0x5978fc][_0x99dd('0x5a')]||_0x4fdfff[_0x176cb9][_0x5978fc][_0x99dd('0x5b')]||_0x4fdfff[_0x176cb9][_0x5978fc]['queuecallerexitAt'])[_0x99dd('0x58')](moment(_0x4fdfff[_0x176cb9][_0x5978fc][_0x99dd('0x59')]),_0x99dd('0x5c'))||0x0;_0x44eb9a[_0x99dd('0x14')][_0x1675c7]['total']+=0x1;if(_0x4fdfff[_0x176cb9][_0x5978fc][_0x99dd('0x5d')]){_0x44eb9a[_0x99dd('0x14')][_0x1675c7][_0x99dd('0x29')]+=0x1;_0x44eb9a[_0x99dd('0x14')][_0x1675c7][_0x99dd('0x2f')]+=moment(_0x4fdfff[_0x176cb9][_0x5978fc]['queuecallercompleteAt'])[_0x99dd('0x58')](moment(_0x4fdfff[_0x176cb9][_0x5978fc][_0x99dd('0x5e')]),_0x99dd('0x5c'))||0x0;}}else{_0x44eb9a[_0x99dd('0x14')][_0x1675c7]['sumDuration']+=_0x44eb9a[_0x99dd('0x14')][_0x1675c7][_0x99dd('0x2a')]||0x0;}}}}}}return _0x44eb9a[_0x99dd('0x14')];};};Realtime['prototype'][_0x99dd('0x5f')]=function(){var _0x280051=this;return function(_0x79e768){clearVoiceCallReports(_0x280051[_0x99dd('0x60')]);if(_0x79e768){for(var _0x56d447=0x0;_0x56d447<_0x79e768[_0x99dd('0x3d')];_0x56d447+=0x1){_0x280051['outbound'][_0x99dd('0x28')]+=0x1;_0x280051['outbound'][_0x99dd('0x2b')]+=_0x79e768[_0x56d447]['duration'];if(_0x79e768[_0x56d447][_0x99dd('0x61')]===_0x99dd('0x62')){_0x280051[_0x99dd('0x60')][_0x99dd('0x29')]+=0x1;_0x280051[_0x99dd('0x60')]['sumHoldTime']+=_0x79e768[_0x56d447][_0x99dd('0x63')]-_0x79e768[_0x56d447]['billableseconds']||0x0;_0x280051['outbound'][_0x99dd('0x2f')]+=_0x79e768[_0x56d447]['billableseconds'];}}}return _0x280051[_0x99dd('0x60')];};};Realtime['prototype'][_0x99dd('0x64')]=function(){var _0x1283f2=this;return function(_0x40fbb3){if(_0x40fbb3){freeIsNotKey(_0x40fbb3,_0x1283f2['campaigns'],_0x99dd('0x25'));for(var _0x457ca5=0x0,_0x550441={};_0x457ca5<_0x40fbb3[_0x99dd('0x3d')];_0x457ca5+=0x1){_0x550441=_0x40fbb3[_0x457ca5];if(_[_0x99dd('0x3e')](_0x1283f2[_0x99dd('0x65')][_0x550441['name']])){_0x1283f2[_0x99dd('0x65')][_0x550441[_0x99dd('0x25')]]=new Campaign(_0x550441);}else{_0x1283f2['mergeFromDatabase'](_0x1283f2[_0x99dd('0x65')][_0x550441[_0x99dd('0x25')]],_0x550441);_0x1283f2[_0x99dd('0x65')][_0x550441[_0x99dd('0x25')]][_0x99dd('0x66')]=_0x550441['SquareProject']?_0x550441[_0x99dd('0x67')][_0x99dd('0x25')]:undefined;}}}return _0x1283f2[_0x99dd('0x65')];};};Realtime[_0x99dd('0x3a')]['initVoiceExtensions']=function(){var _0x352160=this;return function(_0x2fb9b6){if(_0x2fb9b6){freeIsNotKey(_0x2fb9b6,_0x352160['voiceExtensions'],'id');for(var _0x2c418c=0x0,_0x569c28={};_0x2c418c<_0x2fb9b6[_0x99dd('0x3d')];_0x2c418c+=0x1){_0x569c28=_0x2fb9b6[_0x2c418c];if(_[_0x99dd('0x3e')](_0x352160[_0x99dd('0x16')][_0x569c28['id']])){_0x352160[_0x99dd('0x16')][_0x569c28['id']]=new VoiceExtension(_0x569c28);}else{_0x352160['mergeFromDatabase'](_0x352160[_0x99dd('0x16')][_0x569c28['id']],_0x569c28);}}}return _0x352160[_0x99dd('0x16')];};};Realtime[_0x99dd('0x3a')][_0x99dd('0x68')]=function(){var _0x46c924=this;return function(_0x13c8c9){clearCampaigns(_0x46c924[_0x99dd('0x65')]);for(var _0x50e059=0x0;_0x50e059<_0x13c8c9[_0x99dd('0x3d')];_0x50e059+=0x1){_['merge'](_0x46c924[_0x99dd('0x65')][_0x13c8c9[_0x50e059]['name']],_0x13c8c9[_0x50e059]);}return _0x46c924['campaigns'];};};Realtime['prototype'][_0x99dd('0x69')]=function(){var _0x443d0b=this;return function(_0x10a2df){if(_0x10a2df){freeIsNotKey(_0x10a2df,_0x443d0b[_0x99dd('0x20')],'id');for(var _0x1cf691=0x0,_0x17997d={},_0x551286={};_0x1cf691<_0x10a2df[_0x99dd('0x3d')];_0x1cf691+=0x1){_0x17997d=_0x10a2df[_0x1cf691];if(_[_0x99dd('0x3e')](_0x443d0b[_0x99dd('0x20')][_0x17997d['id']])){_0x443d0b[_0x99dd('0x20')][_0x17997d['id']]=new FaxAccount(_0x17997d);}else{_0x443d0b[_0x99dd('0x3b')](_0x443d0b[_0x99dd('0x20')][_0x17997d['id']],_0x17997d);}}}return _0x443d0b[_0x99dd('0x20')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index bad3d13..7c57830 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 _0x044c=['../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','realtime','agents','sync','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','prototype','find','accountcode','name','isNil','telephones','interface','length','findAgent','connectedlinenum','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','queuecallercompleteAt','format','queuecallerexit','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','exten','type','dialer','lastapplication','lastdata','queue','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','transfers','linkedid','transfereelinkedid','uniqueid','monitors','monitorFilename','filename','connectedlinename','xcally-motion-dialer','isArray','startsWith','Local','substring','indexOf','mobile','lastIndexOf','membername','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport'];(function(_0x7ad6cb,_0xffee6c){var _0x22a0ba=function(_0x47f291){while(--_0x47f291){_0x7ad6cb['push'](_0x7ad6cb['shift']());}};_0x22a0ba(++_0xffee6c);}(_0x044c,0x155));var _0xc044=function(_0x5dd721,_0x12d33c){_0x5dd721=_0x5dd721-0x0;var _0x592748=_0x044c[_0x5dd721];return _0x592748;};'use strict';var _=require(_0xc044('0x0'));var moment=require(_0xc044('0x1'));var util=require(_0xc044('0x2'));var config=require(_0xc044('0x3'));var ami=require(_0xc044('0x4'));var RpcVoiceAgentReport=require(_0xc044('0x5'));var RpcVoiceCallReport=require(_0xc044('0x6'));var RpcVoiceDialReport=require(_0xc044('0x7'));var RpcMemberReport=require(_0xc044('0x8'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xc044('0x9'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xc044('0xa'));var VoiceCallReport=require(_0xc044('0xb'));var VoiceAgentReport=require(_0xc044('0xc'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x18ee63){this[_0xc044('0xd')]=_0x18ee63;this[_0xc044('0xe')]=_0x18ee63[_0xc044('0xe')];this['telephones']=_0x18ee63['telephones'];}Report['prototype'][_0xc044('0xf')]=function(_0x46496c){var _0x3d1bc6=new VoiceQueueReport(this[_0xc044('0xd')]);var _0x29674a=new VoiceAgentReport(this['realtime']);var _0x5c032b=new VoiceDialReport(this[_0xc044('0xd')]);var _0x13cf8a=new VoiceCallReport(this[_0xc044('0xd')]);var _0x171be8=new UserReport(this['realtime']);if(config['xdr']&&config['xdr'][_0xc044('0x10')]){ami['on'](_0xc044('0x11'),this[_0xc044('0x12')][_0xc044('0x13')](this));ami['on'](_0xc044('0x14'),this[_0xc044('0x15')][_0xc044('0x13')](this));ami['on'](_0xc044('0x16'),this[_0xc044('0x17')]['bind'](this));ami['on'](_0xc044('0x18'),this[_0xc044('0x19')][_0xc044('0x13')](this));ami['on'](_0xc044('0x1a'),this[_0xc044('0x1b')][_0xc044('0x13')](this));ami['on'](_0xc044('0x1c'),this[_0xc044('0x1d')][_0xc044('0x13')](this));}};Report[_0xc044('0x1e')]['findAgent']=function(_0xdb5835){var _0x237ec4;_0x237ec4=_[_0xc044('0x1f')](this[_0xc044('0xe')],function(_0x397b7c){return _0x397b7c[_0xc044('0x20')]==_0xdb5835||_0x397b7c[_0xc044('0x21')]==_0xdb5835;});if(_[_0xc044('0x22')](_0x237ec4)){var _0xa866f3=_[_0xc044('0x1f')](this[_0xc044('0x23')],function(_0x485148){return _0x485148[_0xc044('0x20')]==_0xdb5835||_0x485148[_0xc044('0x21')]==_0xdb5835;});if(_0xa866f3){_0x237ec4=_[_0xc044('0x1f')](this[_0xc044('0xe')],function(_0x10995f){return _0x10995f[_0xc044('0x24')]==util['format']('SIP/%s',_0xa866f3[_0xc044('0x21')]);});}}return _0x237ec4;};Report['prototype'][_0xc044('0x12')]=function(_0x4f12f8){for(var _0xd2649c=0x0;_0xd2649c<_0x4f12f8[_0xc044('0x25')];_0xd2649c+=0x1){var _0x12466c=this[_0xc044('0x26')](_0x4f12f8[_0xd2649c][_0xc044('0x27')]);if(_0x12466c){_0x4f12f8[_0xd2649c][_0xc044('0x20')]=_0x12466c[_0xc044('0x20')];_0x4f12f8[_0xd2649c][_0xc044('0x28')]=!![];_0x4f12f8[_0xd2649c][_0xc044('0x29')]=_0x12466c[_0xc044('0x21')];_0x4f12f8[_0xd2649c][_0xc044('0x24')]=_[_0xc044('0x22')](_0x12466c[_0xc044('0x24')])?util['format'](_0xc044('0x2a'),_0x12466c[_0xc044('0x21')]):_0x12466c[_0xc044('0x24')];if(_0x4f12f8[_0xd2649c][_0xc044('0x2b')]){_0x4f12f8[_0xd2649c][_0xc044('0x2c')]=moment()[_0xc044('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4f12f8[_0xd2649c][_0xc044('0x2e')]){_0x4f12f8[_0xd2649c]['queuecallerexitAt']=moment()['format'](_0xc044('0x2f'));}RpcMemberReport[_0xc044('0x12')](_0x4f12f8[_0xd2649c]);}RpcVoiceQueueReport[_0xc044('0x30')](_0x4f12f8[_0xd2649c]);}};function extractCalleridNumber(_0xbe065c){var _0x37bd1e=_0xbe065c[_0xc044('0x31')](/<(.*?)>/);return _0x37bd1e?_0x37bd1e[0x1]:_0xbe065c;}Report['prototype'][_0xc044('0x15')]=function(_0x5a364b){_0x5a364b['destination']=_0x5a364b[_0xc044('0x32')]||_0x5a364b[_0xc044('0x33')];if(_0x5a364b[_0xc044('0x34')]==_0xc044('0x35')){_0x5a364b[_0xc044('0x36')]='queue';_0x5a364b[_0xc044('0x37')]=_0x5a364b[_0xc044('0x38')];if(_0x5a364b['context']==_0xc044('0x39')){_0x5a364b[_0xc044('0x20')]='';_0x5a364b[_0xc044('0x32')]=extractCalleridNumber(_0x5a364b[_0xc044('0x3a')]);}else if(_0x5a364b[_0xc044('0x3b')]==_0xc044('0x3c')){if(_0x5a364b[_0xc044('0x32')]==_0xc044('0x3d')){_0x5a364b['destination']=extractCalleridNumber(_0x5a364b['calleridpreview']);_0x5a364b[_0xc044('0x3e')]=_0x5a364b[_0xc044('0x3f')];_0x5a364b[_0xc044('0x40')]=[_0x5a364b[_0xc044('0x41')],_0x5a364b[_0xc044('0x41')]=_0x5a364b[_0xc044('0x40')]][0x0];_0x5a364b[_0xc044('0x3a')]=_0x5a364b[_0xc044('0x42')];}else{_0x5a364b['destination']=_0x5a364b[_0xc044('0x3e')];_0x5a364b[_0xc044('0x3e')]=_0x5a364b[_0xc044('0x3f')];if(_0x5a364b[_0xc044('0x43')]=='ANSWERED'){_0x5a364b[_0xc044('0x20')]=_0x5a364b['connectedlinenum'];}else{_0x5a364b[_0xc044('0x20')]='';}}}}else{_0x5a364b[_0xc044('0x3a')]=util[_0xc044('0x2d')]('\x22%s\x22\x20<%s>',_0x5a364b['calleridname'],_0x5a364b[_0xc044('0x3e')]);}if(RpcVoiceTransferReport[_0xc044('0x44')][_0x5a364b['linkedid']]){var _0x70863e=RpcVoiceTransferReport[_0xc044('0x44')][_0x5a364b[_0xc044('0x45')]];_0x70863e[_0xc044('0x46')]=_0x5a364b[_0xc044('0x47')];RpcVoiceTransferReport[_0xc044('0x1b')](_0x70863e);delete RpcVoiceTransferReport['transfers'][_0x5a364b[_0xc044('0x45')]];}RpcVoiceCallReport[_0xc044('0x30')](_0x5a364b);if(_0x5a364b['monitor']){for(var _0x130a29=0x0;_0x130a29<_0x5a364b[_0xc044('0x48')][_0xc044('0x25')];_0x130a29+=0x1){_0x5a364b[_0xc044('0x49')]=_0x5a364b[_0xc044('0x48')][_0x130a29][_0xc044('0x4a')];_0x5a364b['createdAt']=_0x5a364b[_0xc044('0x48')][_0x130a29]['createdAt'];if(_0x5a364b[_0xc044('0x33')]=='xcally-motion-preview'){_0x5a364b['calleridnum']=_0x5a364b[_0xc044('0x27')];_0x5a364b['calleridname']=_0x5a364b[_0xc044('0x4b')];_0x5a364b['connectedlinenum']=_0x5a364b['accountcode'];_0x5a364b['connectedlinename']=_0x5a364b['membername'];_0x5a364b[_0xc044('0x33')]=_0x5a364b[_0xc044('0x3f')];}else if(_0x5a364b[_0xc044('0x33')]==_0xc044('0x4c')){_0x5a364b[_0xc044('0x3e')]=_0x5a364b['destination'];_0x5a364b[_0xc044('0x33')]=_0x5a364b['originatecalleridnum'];}RpcVoiceRecording[_0xc044('0x30')](_0x5a364b);}}};Report['prototype']['voiceAgentReport']=function(_0x41707c){if(_[_0xc044('0x4d')](_0x41707c)){_0x41707c['forEach'](function(_0x57272c){RpcVoiceAgentReport[_0xc044('0x30')](_0x57272c);});}else{RpcVoiceAgentReport['create'](_0x41707c);}};Report[_0xc044('0x1e')]['voiceDialReport']=function(_0x42acbf){RpcVoiceDialReport['create'](_0x42acbf);var _0x50e7f1;var _0x5ec1dc;var _0x299cdb=_0x42acbf[_0xc044('0x41')];if(_[_0xc044('0x4e')](_0x299cdb,_0xc044('0x4f'))){_0x5ec1dc=_0x299cdb[_0xc044('0x50')](_0x299cdb[_0xc044('0x51')]('/')+0x1,_0x299cdb[_0xc044('0x51')]('@'));_0x50e7f1=_[_0xc044('0x1f')](this[_0xc044('0xe')],function(_0x3bcdde){return _0x3bcdde[_0xc044('0x52')]==_0x5ec1dc||_0x3bcdde['phone']==_0x5ec1dc||_0x3bcdde[_0xc044('0x20')]==_0x5ec1dc;});}else{_0x5ec1dc=_0x299cdb[_0xc044('0x50')](_0x299cdb[_0xc044('0x51')]('/')+0x1,_0x299cdb[_0xc044('0x53')]('-'));_0x50e7f1=this[_0xc044('0x26')](_0x5ec1dc);}if(_0x50e7f1){_0x42acbf[_0xc044('0x24')]=_[_0xc044('0x22')](_0x50e7f1[_0xc044('0x24')])?util[_0xc044('0x2d')]('SIP/%s',_0x50e7f1[_0xc044('0x21')]):_0x50e7f1[_0xc044('0x24')];_0x42acbf[_0xc044('0x54')]=_0x50e7f1[_0xc044('0x21')];_0x42acbf[_0xc044('0x20')]=_0x50e7f1['accountcode'];RpcMemberReport[_0xc044('0x19')](_0x42acbf);}};Report[_0xc044('0x1e')][_0xc044('0x1b')]=function(_0xf9ed76){RpcVoiceTransferReport[_0xc044('0x44')][_0xf9ed76[_0xc044('0x55')]]=_0xf9ed76;};Report['prototype']['attendedTransfer']=function(_0x481eb5){RpcVoiceTransferReport[_0xc044('0x1d')](_0x481eb5);};module[_0xc044('0x56')]=Report; \ No newline at end of file +var _0xba06=['../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','xdr','disabled','custom:voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','prototype','findAgent','accountcode','name','isNil','find','interface','format','SIP/%s','voiceQueueReport','length','assigned','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','calleridpreview','destinationchannel','calleridnum','originatecalleridnum','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','transfers','linkedid','uniqueid','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','calleridname','connectedlinename','xcally-motion-dialer','isArray','forEach','Local','indexOf','mobile','phone','substring','lastIndexOf','membername','blindTransfer','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport'];(function(_0x58a1ef,_0x4938cd){var _0x384e65=function(_0x61be1e){while(--_0x61be1e){_0x58a1ef['push'](_0x58a1ef['shift']());}};_0x384e65(++_0x4938cd);}(_0xba06,0x10a));var _0x6ba0=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xba06[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0x6ba0('0x0'));var moment=require(_0x6ba0('0x1'));var util=require(_0x6ba0('0x2'));var config=require(_0x6ba0('0x3'));var ami=require(_0x6ba0('0x4'));var RpcVoiceAgentReport=require(_0x6ba0('0x5'));var RpcVoiceCallReport=require(_0x6ba0('0x6'));var RpcVoiceDialReport=require(_0x6ba0('0x7'));var RpcMemberReport=require(_0x6ba0('0x8'));var RpcVoiceQueueReport=require(_0x6ba0('0x9'));var RpcVoiceRecording=require(_0x6ba0('0xa'));var RpcVoiceTransferReport=require(_0x6ba0('0xb'));var VoiceQueueReport=require(_0x6ba0('0xc'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x6ba0('0xd'));var VoiceDialReport=require(_0x6ba0('0xe'));var UserReport=require(_0x6ba0('0xf'));function Report(_0x231832){this[_0x6ba0('0x10')]=_0x231832;this[_0x6ba0('0x11')]=_0x231832[_0x6ba0('0x11')];this[_0x6ba0('0x12')]=_0x231832[_0x6ba0('0x12')];}Report['prototype']['sync']=function(_0x12df28){var _0x2faaaf=new VoiceQueueReport(this[_0x6ba0('0x10')]);var _0x53c622=new VoiceAgentReport(this['realtime']);var _0x407d32=new VoiceDialReport(this[_0x6ba0('0x10')]);var _0x2ff7f3=new VoiceCallReport(this[_0x6ba0('0x10')]);var _0x3431dc=new UserReport(this[_0x6ba0('0x10')]);if(config[_0x6ba0('0x13')]&&config[_0x6ba0('0x13')][_0x6ba0('0x14')]){ami['on'](_0x6ba0('0x15'),this['voiceQueueReport']['bind'](this));ami['on'](_0x6ba0('0x16'),this[_0x6ba0('0x17')][_0x6ba0('0x18')](this));ami['on'](_0x6ba0('0x19'),this[_0x6ba0('0x1a')][_0x6ba0('0x18')](this));ami['on'](_0x6ba0('0x1b'),this[_0x6ba0('0x1c')][_0x6ba0('0x18')](this));ami['on'](_0x6ba0('0x1d'),this['blindTransfer'][_0x6ba0('0x18')](this));ami['on'](_0x6ba0('0x1e'),this[_0x6ba0('0x1f')]['bind'](this));}};Report[_0x6ba0('0x20')][_0x6ba0('0x21')]=function(_0x28c251){var _0x2850bc;_0x2850bc=_['find'](this[_0x6ba0('0x11')],function(_0x32d40f){return _0x32d40f[_0x6ba0('0x22')]==_0x28c251||_0x32d40f[_0x6ba0('0x23')]==_0x28c251;});if(_[_0x6ba0('0x24')](_0x2850bc)){var _0x5aa6ce=_[_0x6ba0('0x25')](this[_0x6ba0('0x12')],function(_0x3bd86e){return _0x3bd86e[_0x6ba0('0x22')]==_0x28c251||_0x3bd86e['name']==_0x28c251;});if(_0x5aa6ce){_0x2850bc=_[_0x6ba0('0x25')](this['agents'],function(_0x55ae27){return _0x55ae27[_0x6ba0('0x26')]==util[_0x6ba0('0x27')](_0x6ba0('0x28'),_0x5aa6ce[_0x6ba0('0x23')]);});}}return _0x2850bc;};Report['prototype'][_0x6ba0('0x29')]=function(_0x3f15a7){for(var _0x3e370e=0x0;_0x3e370e<_0x3f15a7[_0x6ba0('0x2a')];_0x3e370e+=0x1){var _0x5c1e28=this[_0x6ba0('0x21')](_0x3f15a7[_0x3e370e]['connectedlinenum']);if(_0x5c1e28){_0x3f15a7[_0x3e370e][_0x6ba0('0x22')]=_0x5c1e28['accountcode'];_0x3f15a7[_0x3e370e][_0x6ba0('0x2b')]=!![];_0x3f15a7[_0x3e370e]['lastAssignedTo']=_0x5c1e28[_0x6ba0('0x23')];_0x3f15a7[_0x3e370e][_0x6ba0('0x26')]=_[_0x6ba0('0x24')](_0x5c1e28[_0x6ba0('0x26')])?util['format']('SIP/%s',_0x5c1e28['name']):_0x5c1e28[_0x6ba0('0x26')];if(_0x3f15a7[_0x3e370e][_0x6ba0('0x2c')]){_0x3f15a7[_0x3e370e][_0x6ba0('0x2d')]=moment()[_0x6ba0('0x27')](_0x6ba0('0x2e'));}if(_0x3f15a7[_0x3e370e][_0x6ba0('0x2f')]){_0x3f15a7[_0x3e370e][_0x6ba0('0x30')]=moment()['format'](_0x6ba0('0x2e'));}RpcMemberReport[_0x6ba0('0x29')](_0x3f15a7[_0x3e370e]);}RpcVoiceQueueReport[_0x6ba0('0x31')](_0x3f15a7[_0x3e370e]);}};function extractCalleridNumber(_0x3712ea){var _0x297162=_0x3712ea[_0x6ba0('0x32')](/<(.*?)>/);return _0x297162?_0x297162[0x1]:_0x3712ea;}Report[_0x6ba0('0x20')][_0x6ba0('0x17')]=function(_0x33d5b9){_0x33d5b9['destination']=_0x33d5b9[_0x6ba0('0x33')]||_0x33d5b9[_0x6ba0('0x34')];if(_0x33d5b9[_0x6ba0('0x35')]==_0x6ba0('0x36')){_0x33d5b9[_0x6ba0('0x37')]=_0x6ba0('0x38');_0x33d5b9[_0x6ba0('0x39')]=_0x33d5b9[_0x6ba0('0x38')];if(_0x33d5b9[_0x6ba0('0x3a')]==_0x6ba0('0x3b')){_0x33d5b9[_0x6ba0('0x22')]='';_0x33d5b9[_0x6ba0('0x33')]=extractCalleridNumber(_0x33d5b9[_0x6ba0('0x3c')]);}else if(_0x33d5b9[_0x6ba0('0x3a')]==_0x6ba0('0x3d')){if(_0x33d5b9['destination']=='xcally-motion-preview'){_0x33d5b9[_0x6ba0('0x33')]=extractCalleridNumber(_0x33d5b9[_0x6ba0('0x3e')]);_0x33d5b9['calleridnum']=_0x33d5b9['originatecalleridnum'];_0x33d5b9[_0x6ba0('0x3f')]=[_0x33d5b9['channel'],_0x33d5b9['channel']=_0x33d5b9[_0x6ba0('0x3f')]][0x0];_0x33d5b9[_0x6ba0('0x3c')]=_0x33d5b9[_0x6ba0('0x3e')];}else{_0x33d5b9[_0x6ba0('0x33')]=_0x33d5b9[_0x6ba0('0x40')];_0x33d5b9[_0x6ba0('0x40')]=_0x33d5b9[_0x6ba0('0x41')];if(_0x33d5b9[_0x6ba0('0x42')]==_0x6ba0('0x43')){_0x33d5b9[_0x6ba0('0x22')]=_0x33d5b9[_0x6ba0('0x44')];}else{_0x33d5b9['accountcode']='';}}}}else{_0x33d5b9[_0x6ba0('0x3c')]=util[_0x6ba0('0x27')](_0x6ba0('0x45'),_0x33d5b9['calleridname'],_0x33d5b9[_0x6ba0('0x40')]);}if(RpcVoiceTransferReport[_0x6ba0('0x46')][_0x33d5b9[_0x6ba0('0x47')]]){var _0x56a4d9=RpcVoiceTransferReport[_0x6ba0('0x46')][_0x33d5b9[_0x6ba0('0x47')]];_0x56a4d9['transfereelinkedid']=_0x33d5b9[_0x6ba0('0x48')];RpcVoiceTransferReport['blindTransfer'](_0x56a4d9);delete RpcVoiceTransferReport[_0x6ba0('0x46')][_0x33d5b9[_0x6ba0('0x47')]];}RpcVoiceCallReport[_0x6ba0('0x31')](_0x33d5b9);if(_0x33d5b9['monitor']){for(var _0x3b183b=0x0;_0x3b183b<_0x33d5b9[_0x6ba0('0x49')][_0x6ba0('0x2a')];_0x3b183b+=0x1){_0x33d5b9[_0x6ba0('0x4a')]=_0x33d5b9[_0x6ba0('0x49')][_0x3b183b][_0x6ba0('0x4b')];_0x33d5b9[_0x6ba0('0x4c')]=_0x33d5b9[_0x6ba0('0x49')][_0x3b183b][_0x6ba0('0x4c')];if(_0x33d5b9['exten']==_0x6ba0('0x4d')){_0x33d5b9[_0x6ba0('0x40')]=_0x33d5b9[_0x6ba0('0x44')];_0x33d5b9[_0x6ba0('0x4e')]=_0x33d5b9[_0x6ba0('0x4f')];_0x33d5b9['connectedlinenum']=_0x33d5b9[_0x6ba0('0x22')];_0x33d5b9[_0x6ba0('0x4f')]=_0x33d5b9['membername'];_0x33d5b9['exten']=_0x33d5b9[_0x6ba0('0x41')];}else if(_0x33d5b9[_0x6ba0('0x34')]==_0x6ba0('0x50')){_0x33d5b9[_0x6ba0('0x40')]=_0x33d5b9[_0x6ba0('0x33')];_0x33d5b9[_0x6ba0('0x34')]=_0x33d5b9['originatecalleridnum'];}RpcVoiceRecording[_0x6ba0('0x31')](_0x33d5b9);}}};Report[_0x6ba0('0x20')][_0x6ba0('0x1a')]=function(_0x1098bf){if(_[_0x6ba0('0x51')](_0x1098bf)){_0x1098bf[_0x6ba0('0x52')](function(_0x319a26){RpcVoiceAgentReport['create'](_0x319a26);});}else{RpcVoiceAgentReport[_0x6ba0('0x31')](_0x1098bf);}};Report[_0x6ba0('0x20')][_0x6ba0('0x1c')]=function(_0x1a9d56){RpcVoiceDialReport['create'](_0x1a9d56);var _0x341698;var _0x470ae4;var _0x111547=_0x1a9d56['channel'];if(_['startsWith'](_0x111547,_0x6ba0('0x53'))){_0x470ae4=_0x111547['substring'](_0x111547[_0x6ba0('0x54')]('/')+0x1,_0x111547[_0x6ba0('0x54')]('@'));_0x341698=_[_0x6ba0('0x25')](this[_0x6ba0('0x11')],function(_0x1d3bb3){return _0x1d3bb3[_0x6ba0('0x55')]==_0x470ae4||_0x1d3bb3[_0x6ba0('0x56')]==_0x470ae4||_0x1d3bb3[_0x6ba0('0x22')]==_0x470ae4;});}else{_0x470ae4=_0x111547[_0x6ba0('0x57')](_0x111547[_0x6ba0('0x54')]('/')+0x1,_0x111547[_0x6ba0('0x58')]('-'));_0x341698=this[_0x6ba0('0x21')](_0x470ae4);}if(_0x341698){_0x1a9d56[_0x6ba0('0x26')]=_[_0x6ba0('0x24')](_0x341698[_0x6ba0('0x26')])?util[_0x6ba0('0x27')](_0x6ba0('0x28'),_0x341698[_0x6ba0('0x23')]):_0x341698[_0x6ba0('0x26')];_0x1a9d56[_0x6ba0('0x59')]=_0x341698['name'];_0x1a9d56[_0x6ba0('0x22')]=_0x341698[_0x6ba0('0x22')];RpcMemberReport[_0x6ba0('0x1c')](_0x1a9d56);}};Report[_0x6ba0('0x20')][_0x6ba0('0x5a')]=function(_0x3a6c4c){RpcVoiceTransferReport[_0x6ba0('0x46')][_0x3a6c4c['transfererlinkedid']]=_0x3a6c4c;};Report[_0x6ba0('0x20')]['attendedTransfer']=function(_0x1c4499){RpcVoiceTransferReport[_0x6ba0('0x1f')](_0x1c4499);};module[_0x6ba0('0x5b')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index c99e515..e65447d 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d13=['syncPeerStatus','syncRealtimeShow','resolve','then','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','actionSipPeerStatus','prototype','isUndefined','emit','isNotNull','info','username','state','debug','[userReport][registry]','find','stateRegistry','omit','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','device','local','toLowerCase','inuse','updateStatusRealtime','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','Local','substring','indexOf','mobile','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','moment','util','ioredis','bluebird','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x9d13,0x1eb));var _0x39d1=function(_0x3ad20a,_0x2830c9){_0x3ad20a=_0x3ad20a-0x0;var _0x4d5d60=_0x9d13[_0x3ad20a];return _0x4d5d60;};'use strict';var _=require('lodash');var moment=require(_0x39d1('0x0'));var util=require(_0x39d1('0x1'));var Redis=require(_0x39d1('0x2'));var BPromise=require(_0x39d1('0x3'));var config=require('../../../config/environment');var logger=require(_0x39d1('0x4'))(_0x39d1('0x5'));var ami=require(_0x39d1('0x6'));config[_0x39d1('0x7')]=_[_0x39d1('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x39d1('0x9'))(new Redis(config[_0x39d1('0x7')]));function UserReport(_0x5dd7ad){this['trunks']=_0x5dd7ad[_0x39d1('0xa')];this[_0x39d1('0xb')]=_0x5dd7ad[_0x39d1('0xb')];this[_0x39d1('0xc')]=_0x5dd7ad[_0x39d1('0xc')];ami['on'](_0x39d1('0xd'),this[_0x39d1('0xe')][_0x39d1('0xf')](this));ami['on'](_0x39d1('0x10'),this[_0x39d1('0xe')][_0x39d1('0xf')](this));ami['on'](_0x39d1('0x11'),this[_0x39d1('0x12')]['bind'](this));ami['on'](_0x39d1('0x13'),this[_0x39d1('0x14')][_0x39d1('0xf')](this));return this[_0x39d1('0x15')]();}function showSipRegistrations(){Promise[_0x39d1('0x16')]()[_0x39d1('0x17')](ami['actionSipShowRegistry']())['catch'](function(_0x44fdea){logger[_0x39d1('0x18')](_0x39d1('0x19'),util[_0x39d1('0x1a')](_0x44fdea,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x39d1('0x16')]()['then'](ami[_0x39d1('0x1b')]())['catch'](function(_0x1f6c58){logger[_0x39d1('0x18')]('[userReport][devicestatelist]',util[_0x39d1('0x1a')](_0x1f6c58,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x39d1('0x16')]()[_0x39d1('0x17')](ami[_0x39d1('0x1c')]())['catch'](function(_0x289cfa){logger[_0x39d1('0x18')]('[userReport][sippeerstatus]',util[_0x39d1('0x1a')](_0x289cfa,{'showHidden':![],'depth':null}));});}UserReport[_0x39d1('0x1d')][_0x39d1('0x15')]=function(){setInterval(function(){BPromise['resolve']()[_0x39d1('0x17')](showSipRegistrations())[_0x39d1('0x17')](listDeviceStates())[_0x39d1('0x17')](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x7dde9f){return _0x7dde9f!==null&&!_[_0x39d1('0x1e')](_0x7dde9f);};UserReport[_0x39d1('0x1d')][_0x39d1('0x1f')]=function(_0x1218ad,_0x124f08,_0x50eff0){io['to'](_0x1218ad)[_0x39d1('0x1f')](_0x124f08,_0x50eff0);};UserReport[_0x39d1('0x1d')]['syncRegistry']=function(_0x1e00fe){try{if(this[_0x39d1('0x20')](_0x1e00fe)){logger[_0x39d1('0x21')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x1e00fe[_0x39d1('0x22')],_0x1e00fe[_0x39d1('0x23')]);logger[_0x39d1('0x24')](_0x39d1('0x25'),util[_0x39d1('0x1a')](_0x1e00fe,{'showHidden':![],'depth':null}));var _0x659a5c=_[_0x39d1('0x26')](this[_0x39d1('0xa')],{'defaultuser':_0x1e00fe[_0x39d1('0x22')]});if(_0x659a5c){_0x1e00fe[_0x39d1('0x27')]=_0x1e00fe[_0x39d1('0x23')];_['merge'](_0x659a5c,_[_0x39d1('0x28')](_0x1e00fe,['event',_0x39d1('0x29'),_0x39d1('0x22'),_0x39d1('0x23')]));logger[_0x39d1('0x24')](_0x39d1('0x2a'),util['inspect'](_0x659a5c,{'showHidden':![],'depth':null}));this[_0x39d1('0x1f')](util[_0x39d1('0x2b')](_0x39d1('0x2c'),_0x659a5c[_0x39d1('0x2d')]),'trunk:save',_0x659a5c);}}}catch(_0x5b4fee){logger[_0x39d1('0x18')]('[userReport][registry]',util[_0x39d1('0x1a')](_0x5b4fee,{'showHidden':![],'depth':null}));}};UserReport[_0x39d1('0x1d')][_0x39d1('0x12')]=function(_0x3f0899){try{if(this[_0x39d1('0x20')](_0x3f0899)){logger[_0x39d1('0x21')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x3f0899[_0x39d1('0x2e')],_0x3f0899[_0x39d1('0x23')]);logger[_0x39d1('0x24')]('[userReport][devicestatechange]',util['inspect'](_0x3f0899,{'showHidden':![],'depth':null}));if(this[_0x39d1('0xb')][_0x3f0899[_0x39d1('0x2e')]]){if(!this['agents'][_0x3f0899[_0x39d1('0x2e')]][_0x39d1('0x2f')]||_0x3f0899[_0x39d1('0x23')][_0x39d1('0x30')]()==_0x39d1('0x31')){this[_0x39d1('0xb')][_0x3f0899[_0x39d1('0x2e')]]['local']=![];if(this[_0x39d1('0xb')][_0x3f0899[_0x39d1('0x2e')]][_0x39d1('0x23')]!==_0x3f0899[_0x39d1('0x23')][_0x39d1('0x30')]()){this[_0x39d1('0xb')][_0x3f0899['device']]['stateTime']=_['toNumber'](moment()['format']('x'));}this[_0x39d1('0xb')][_0x3f0899['device']][_0x39d1('0x23')]=_0x3f0899[_0x39d1('0x23')][_0x39d1('0x30')]();this[_0x39d1('0xb')][_0x3f0899[_0x39d1('0x2e')]][_0x39d1('0x32')](_0x3f0899);}}else if(this[_0x39d1('0xc')][_0x3f0899[_0x39d1('0x2e')]]){if(this[_0x39d1('0xc')][_0x3f0899[_0x39d1('0x2e')]][_0x39d1('0x23')]!==_0x3f0899['state']['toLowerCase']()){this[_0x39d1('0xc')][_0x3f0899[_0x39d1('0x2e')]][_0x39d1('0x33')]=_[_0x39d1('0x34')](moment()['format']('x'));}this[_0x39d1('0xc')][_0x3f0899[_0x39d1('0x2e')]][_0x39d1('0x23')]=_0x3f0899[_0x39d1('0x23')][_0x39d1('0x30')]();logger[_0x39d1('0x24')](_0x39d1('0x35'),util[_0x39d1('0x1a')](this['telephones'][_0x3f0899[_0x39d1('0x2e')]],{'showHidden':![],'depth':null}));this[_0x39d1('0x1f')](util['format'](_0x39d1('0x36'),this[_0x39d1('0xc')][_0x3f0899[_0x39d1('0x2e')]][_0x39d1('0x2d')]),_0x39d1('0x37'),this['telephones'][_0x3f0899[_0x39d1('0x2e')]]);}else if(this[_0x39d1('0xa')][_0x3f0899[_0x39d1('0x2e')]]){if(this[_0x39d1('0xa')][_0x3f0899[_0x39d1('0x2e')]][_0x39d1('0x23')]!==_0x3f0899[_0x39d1('0x23')][_0x39d1('0x30')]()){this[_0x39d1('0xa')][_0x3f0899['device']][_0x39d1('0x33')]=_[_0x39d1('0x34')](moment()[_0x39d1('0x2b')]('x'));}this[_0x39d1('0xa')][_0x3f0899[_0x39d1('0x2e')]][_0x39d1('0x23')]=_0x3f0899[_0x39d1('0x23')]['toLowerCase']();logger[_0x39d1('0x24')](_0x39d1('0x38'),util['inspect'](this['trunks'][_0x3f0899[_0x39d1('0x2e')]],{'showHidden':![],'depth':null}));this[_0x39d1('0x1f')](util[_0x39d1('0x2b')](_0x39d1('0x2c'),this[_0x39d1('0xa')][_0x3f0899[_0x39d1('0x2e')]]['name']),_0x39d1('0x39'),this['trunks'][_0x3f0899[_0x39d1('0x2e')]]);}else if(_['startsWith'](_0x3f0899[_0x39d1('0x2e')],_0x39d1('0x3a'))){var _0x204f7f=_0x3f0899[_0x39d1('0x2e')];var _0x2e6cb7=_0x204f7f[_0x39d1('0x3b')](_0x204f7f[_0x39d1('0x3c')]('/')+0x1,_0x204f7f[_0x39d1('0x3c')]('@'));var _0x58893d=_['find'](this[_0x39d1('0xb')],function(_0x39c95c){return _0x39c95c[_0x39d1('0x3d')]==_0x2e6cb7||_0x39c95c[_0x39d1('0x3e')]==_0x2e6cb7||_0x39c95c[_0x39d1('0x3f')]==_0x2e6cb7;});if(_0x58893d){if(_0x58893d[_0x39d1('0x23')]!==_0x3f0899[_0x39d1('0x23')][_0x39d1('0x30')]()){_0x58893d[_0x39d1('0x33')]=_[_0x39d1('0x34')](moment()['format']('x'));}_0x58893d[_0x39d1('0x23')]=_0x3f0899[_0x39d1('0x23')][_0x39d1('0x30')]();_0x58893d[_0x39d1('0x2f')]=!![];_0x58893d[_0x39d1('0x32')](_0x3f0899);}}}}catch(_0x48f298){logger[_0x39d1('0x18')]('[userReport][devicestatechange]',util['inspect'](_0x48f298,{'showHidden':![],'depth':null}));}};UserReport[_0x39d1('0x1d')][_0x39d1('0x14')]=function(_0x57f498){try{if(this[_0x39d1('0x20')](_0x57f498)&&this[_0x39d1('0x20')](_0x57f498['peerstatus'])){logger[_0x39d1('0x21')](_0x39d1('0x40'),_0x57f498[_0x39d1('0x41')],_0x57f498['address'],_0x57f498['peerstatus']);logger[_0x39d1('0x24')](_0x39d1('0x42'),util[_0x39d1('0x1a')](_0x57f498,{'showHidden':![],'depth':null}));if(this[_0x39d1('0xb')][_0x57f498[_0x39d1('0x41')]]){if(!this[_0x39d1('0xb')][_0x57f498[_0x39d1('0x41')]]['local']||_0x57f498[_0x39d1('0x13')][_0x39d1('0x30')]()==_0x39d1('0x43')){this[_0x39d1('0xb')][_0x57f498[_0x39d1('0x41')]][_0x39d1('0x2f')]=![];this[_0x39d1('0xb')][_0x57f498[_0x39d1('0x41')]][_0x39d1('0x44')]=_0x57f498[_0x39d1('0x13')][_0x39d1('0x30')]();this[_0x39d1('0xb')][_0x57f498['peer']]['address']=_0x57f498['address'];this[_0x39d1('0xb')][_0x57f498[_0x39d1('0x41')]][_0x39d1('0x32')](_0x57f498);}}else if(this['telephones'][_0x57f498[_0x39d1('0x41')]]){this[_0x39d1('0xc')][_0x57f498['peer']][_0x39d1('0x44')]=_0x57f498['peerstatus'][_0x39d1('0x30')]();this['telephones'][_0x57f498[_0x39d1('0x41')]][_0x39d1('0x45')]=_0x57f498[_0x39d1('0x45')];logger[_0x39d1('0x24')](_0x39d1('0x46'),util[_0x39d1('0x1a')](this['telephones'][_0x57f498[_0x39d1('0x41')]],{'showHidden':![],'depth':null}));this[_0x39d1('0x1f')](util[_0x39d1('0x2b')](_0x39d1('0x36'),this[_0x39d1('0xc')][_0x57f498[_0x39d1('0x41')]][_0x39d1('0x2d')]),'telephone:save',this[_0x39d1('0xc')][_0x57f498[_0x39d1('0x41')]]);}else if(this[_0x39d1('0xa')][_0x57f498[_0x39d1('0x41')]]){this[_0x39d1('0xa')][_0x57f498[_0x39d1('0x41')]][_0x39d1('0x44')]=_0x57f498['peerstatus'][_0x39d1('0x30')]();this[_0x39d1('0xa')][_0x57f498[_0x39d1('0x41')]][_0x39d1('0x45')]=_0x57f498[_0x39d1('0x45')];logger[_0x39d1('0x24')](_0x39d1('0x47'),util[_0x39d1('0x1a')](this['trunks'][_0x57f498[_0x39d1('0x41')]],{'showHidden':![],'depth':null}));this[_0x39d1('0x1f')](util[_0x39d1('0x2b')]('trunk:%s',this['trunks'][_0x57f498[_0x39d1('0x41')]][_0x39d1('0x2d')]),_0x39d1('0x39'),this[_0x39d1('0xa')][_0x57f498[_0x39d1('0x41')]]);}}}catch(_0xa05750){logger[_0x39d1('0x18')]('[userReport][peerstatus]',util['inspect'](_0xa05750,{'showHidden':![],'depth':null}));}};module[_0x39d1('0x48')]=UserReport; \ No newline at end of file +var _0x0d49=['inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','emit','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','find','username','stateRegistry','merge','omit','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','name','trunk:save','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','format','updateStatusRealtime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','phone','accountcode','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/logger','ami','redis','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','devicestatechange','syncDeviceState','syncPeerStatus','syncRealtimeShow','resolve','actionSipShowRegistry','catch','[userReport][sipshowregistry]','then','error','[userReport][devicestatelist]'];(function(_0x3e10ed,_0x5d5f1d){var _0x5f366c=function(_0x3e3f24){while(--_0x3e3f24){_0x3e10ed['push'](_0x3e10ed['shift']());}};_0x5f366c(++_0x5d5f1d);}(_0x0d49,0xc8));var _0x90d4=function(_0x47740a,_0x24fd1d){_0x47740a=_0x47740a-0x0;var _0x28e5af=_0x0d49[_0x47740a];return _0x28e5af;};'use strict';var _=require(_0x90d4('0x0'));var moment=require(_0x90d4('0x1'));var util=require(_0x90d4('0x2'));var Redis=require(_0x90d4('0x3'));var BPromise=require(_0x90d4('0x4'));var config=require('../../../config/environment');var logger=require(_0x90d4('0x5'))(_0x90d4('0x6'));var ami=require('../ami');config[_0x90d4('0x7')]=_['defaults'](config[_0x90d4('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x90d4('0x8'))(new Redis(config[_0x90d4('0x7')]));function UserReport(_0x16bf9e){this['trunks']=_0x16bf9e[_0x90d4('0x9')];this[_0x90d4('0xa')]=_0x16bf9e[_0x90d4('0xa')];this[_0x90d4('0xb')]=_0x16bf9e['telephones'];ami['on']('registryentry',this[_0x90d4('0xc')]['bind'](this));ami['on']('registry',this[_0x90d4('0xc')][_0x90d4('0xd')](this));ami['on'](_0x90d4('0xe'),this[_0x90d4('0xf')][_0x90d4('0xd')](this));ami['on']('peerstatus',this[_0x90d4('0x10')][_0x90d4('0xd')](this));return this[_0x90d4('0x11')]();}function showSipRegistrations(){Promise[_0x90d4('0x12')]()['then'](ami[_0x90d4('0x13')]())[_0x90d4('0x14')](function(_0x3f7065){logger['error'](_0x90d4('0x15'),util['inspect'](_0x3f7065,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x90d4('0x12')]()[_0x90d4('0x16')](ami['actionDeviceStateList']())[_0x90d4('0x14')](function(_0x1acea8){logger[_0x90d4('0x17')](_0x90d4('0x18'),util[_0x90d4('0x19')](_0x1acea8,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x90d4('0x12')]()[_0x90d4('0x16')](ami[_0x90d4('0x1a')]())[_0x90d4('0x14')](function(_0x3f534b){logger[_0x90d4('0x17')](_0x90d4('0x1b'),util['inspect'](_0x3f534b,{'showHidden':![],'depth':null}));});}UserReport[_0x90d4('0x1c')][_0x90d4('0x11')]=function(){setInterval(function(){BPromise[_0x90d4('0x12')]()[_0x90d4('0x16')](showSipRegistrations())[_0x90d4('0x16')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x90d4('0x1c')][_0x90d4('0x1d')]=function(_0xe491cd){return _0xe491cd!==null&&!_['isUndefined'](_0xe491cd);};UserReport[_0x90d4('0x1c')][_0x90d4('0x1e')]=function(_0x397964,_0x192660,_0x3926b6){io['to'](_0x397964)[_0x90d4('0x1e')](_0x192660,_0x3926b6);};UserReport['prototype'][_0x90d4('0xc')]=function(_0x333db0){try{if(this[_0x90d4('0x1d')](_0x333db0)){logger['info'](_0x90d4('0x1f'),_0x333db0['username'],_0x333db0[_0x90d4('0x20')]);logger[_0x90d4('0x21')]('[userReport][registry]',util['inspect'](_0x333db0,{'showHidden':![],'depth':null}));var _0x59dd9e=_[_0x90d4('0x22')](this[_0x90d4('0x9')],{'defaultuser':_0x333db0[_0x90d4('0x23')]});if(_0x59dd9e){_0x333db0[_0x90d4('0x24')]=_0x333db0[_0x90d4('0x20')];_[_0x90d4('0x25')](_0x59dd9e,_[_0x90d4('0x26')](_0x333db0,['event',_0x90d4('0x27'),_0x90d4('0x23'),_0x90d4('0x20')]));logger[_0x90d4('0x21')](_0x90d4('0x28'),util['inspect'](_0x59dd9e,{'showHidden':![],'depth':null}));this[_0x90d4('0x1e')](util['format'](_0x90d4('0x29'),_0x59dd9e[_0x90d4('0x2a')]),_0x90d4('0x2b'),_0x59dd9e);}}}catch(_0x182819){logger[_0x90d4('0x17')]('[userReport][registry]',util[_0x90d4('0x19')](_0x182819,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x90d4('0xf')]=function(_0x42b2bc){try{if(this[_0x90d4('0x1d')](_0x42b2bc)){logger[_0x90d4('0x2c')](_0x90d4('0x2d'),_0x42b2bc[_0x90d4('0x2e')],_0x42b2bc[_0x90d4('0x20')]);logger[_0x90d4('0x21')](_0x90d4('0x2f'),util[_0x90d4('0x19')](_0x42b2bc,{'showHidden':![],'depth':null}));if(this[_0x90d4('0xa')][_0x42b2bc[_0x90d4('0x2e')]]){if(!this[_0x90d4('0xa')][_0x42b2bc['device']][_0x90d4('0x30')]||_0x42b2bc[_0x90d4('0x20')][_0x90d4('0x31')]()==_0x90d4('0x32')){this['agents'][_0x42b2bc[_0x90d4('0x2e')]][_0x90d4('0x30')]=![];if(this[_0x90d4('0xa')][_0x42b2bc[_0x90d4('0x2e')]][_0x90d4('0x20')]!==_0x42b2bc[_0x90d4('0x20')][_0x90d4('0x31')]()){this[_0x90d4('0xa')][_0x42b2bc[_0x90d4('0x2e')]][_0x90d4('0x33')]=_['toNumber'](moment()[_0x90d4('0x34')]('x'));}this[_0x90d4('0xa')][_0x42b2bc[_0x90d4('0x2e')]][_0x90d4('0x20')]=_0x42b2bc[_0x90d4('0x20')][_0x90d4('0x31')]();this[_0x90d4('0xa')][_0x42b2bc['device']][_0x90d4('0x35')](_0x42b2bc);}}else if(this[_0x90d4('0xb')][_0x42b2bc[_0x90d4('0x2e')]]){if(this[_0x90d4('0xb')][_0x42b2bc[_0x90d4('0x2e')]][_0x90d4('0x20')]!==_0x42b2bc[_0x90d4('0x20')]['toLowerCase']()){this[_0x90d4('0xb')][_0x42b2bc[_0x90d4('0x2e')]][_0x90d4('0x33')]=_[_0x90d4('0x36')](moment()[_0x90d4('0x34')]('x'));}this['telephones'][_0x42b2bc[_0x90d4('0x2e')]]['state']=_0x42b2bc[_0x90d4('0x20')]['toLowerCase']();logger[_0x90d4('0x21')](_0x90d4('0x37'),util['inspect'](this['telephones'][_0x42b2bc[_0x90d4('0x2e')]],{'showHidden':![],'depth':null}));this[_0x90d4('0x1e')](util['format'](_0x90d4('0x38'),this['telephones'][_0x42b2bc['device']]['name']),_0x90d4('0x39'),this[_0x90d4('0xb')][_0x42b2bc[_0x90d4('0x2e')]]);}else if(this[_0x90d4('0x9')][_0x42b2bc['device']]){if(this['trunks'][_0x42b2bc['device']][_0x90d4('0x20')]!==_0x42b2bc[_0x90d4('0x20')]['toLowerCase']()){this[_0x90d4('0x9')][_0x42b2bc[_0x90d4('0x2e')]][_0x90d4('0x33')]=_['toNumber'](moment()['format']('x'));}this['trunks'][_0x42b2bc[_0x90d4('0x2e')]]['state']=_0x42b2bc[_0x90d4('0x20')][_0x90d4('0x31')]();logger[_0x90d4('0x21')](_0x90d4('0x3a'),util[_0x90d4('0x19')](this['trunks'][_0x42b2bc[_0x90d4('0x2e')]],{'showHidden':![],'depth':null}));this[_0x90d4('0x1e')](util['format']('trunk:%s',this[_0x90d4('0x9')][_0x42b2bc[_0x90d4('0x2e')]][_0x90d4('0x2a')]),_0x90d4('0x2b'),this[_0x90d4('0x9')][_0x42b2bc[_0x90d4('0x2e')]]);}else if(_[_0x90d4('0x3b')](_0x42b2bc['device'],_0x90d4('0x3c'))){var _0x1980a2=_0x42b2bc[_0x90d4('0x2e')];var _0x548869=_0x1980a2[_0x90d4('0x3d')](_0x1980a2[_0x90d4('0x3e')]('/')+0x1,_0x1980a2[_0x90d4('0x3e')]('@'));var _0xf24365=_[_0x90d4('0x22')](this[_0x90d4('0xa')],function(_0x21e871){return _0x21e871[_0x90d4('0x3f')]==_0x548869||_0x21e871[_0x90d4('0x40')]==_0x548869||_0x21e871[_0x90d4('0x41')]==_0x548869;});if(_0xf24365){if(_0xf24365['state']!==_0x42b2bc['state'][_0x90d4('0x31')]()){_0xf24365[_0x90d4('0x33')]=_['toNumber'](moment()[_0x90d4('0x34')]('x'));}_0xf24365[_0x90d4('0x20')]=_0x42b2bc[_0x90d4('0x20')][_0x90d4('0x31')]();_0xf24365[_0x90d4('0x30')]=!![];_0xf24365[_0x90d4('0x35')](_0x42b2bc);}}}}catch(_0x585f38){logger[_0x90d4('0x17')](_0x90d4('0x2f'),util[_0x90d4('0x19')](_0x585f38,{'showHidden':![],'depth':null}));}};UserReport[_0x90d4('0x1c')][_0x90d4('0x10')]=function(_0x3888e1){try{if(this[_0x90d4('0x1d')](_0x3888e1)&&this[_0x90d4('0x1d')](_0x3888e1[_0x90d4('0x42')])){logger[_0x90d4('0x2c')](_0x90d4('0x43'),_0x3888e1[_0x90d4('0x44')],_0x3888e1[_0x90d4('0x45')],_0x3888e1['peerstatus']);logger[_0x90d4('0x21')](_0x90d4('0x46'),util[_0x90d4('0x19')](_0x3888e1,{'showHidden':![],'depth':null}));if(this['agents'][_0x3888e1[_0x90d4('0x44')]]){if(!this[_0x90d4('0xa')][_0x3888e1['peer']][_0x90d4('0x30')]||_0x3888e1[_0x90d4('0x42')][_0x90d4('0x31')]()==_0x90d4('0x47')){this['agents'][_0x3888e1[_0x90d4('0x44')]][_0x90d4('0x30')]=![];this['agents'][_0x3888e1[_0x90d4('0x44')]][_0x90d4('0x48')]=_0x3888e1[_0x90d4('0x42')][_0x90d4('0x31')]();this[_0x90d4('0xa')][_0x3888e1[_0x90d4('0x44')]][_0x90d4('0x45')]=_0x3888e1[_0x90d4('0x45')];this['agents'][_0x3888e1[_0x90d4('0x44')]][_0x90d4('0x35')](_0x3888e1);}}else if(this[_0x90d4('0xb')][_0x3888e1[_0x90d4('0x44')]]){this[_0x90d4('0xb')][_0x3888e1['peer']][_0x90d4('0x48')]=_0x3888e1[_0x90d4('0x42')][_0x90d4('0x31')]();this[_0x90d4('0xb')][_0x3888e1[_0x90d4('0x44')]]['address']=_0x3888e1['address'];logger[_0x90d4('0x21')](_0x90d4('0x49'),util[_0x90d4('0x19')](this[_0x90d4('0xb')][_0x3888e1[_0x90d4('0x44')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x90d4('0x34')](_0x90d4('0x38'),this[_0x90d4('0xb')][_0x3888e1[_0x90d4('0x44')]][_0x90d4('0x2a')]),_0x90d4('0x39'),this[_0x90d4('0xb')][_0x3888e1[_0x90d4('0x44')]]);}else if(this['trunks'][_0x3888e1[_0x90d4('0x44')]]){this[_0x90d4('0x9')][_0x3888e1['peer']][_0x90d4('0x48')]=_0x3888e1[_0x90d4('0x42')]['toLowerCase']();this[_0x90d4('0x9')][_0x3888e1['peer']][_0x90d4('0x45')]=_0x3888e1[_0x90d4('0x45')];logger[_0x90d4('0x21')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x90d4('0x19')](this[_0x90d4('0x9')][_0x3888e1[_0x90d4('0x44')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x90d4('0x34')]('trunk:%s',this['trunks'][_0x3888e1['peer']]['name']),_0x90d4('0x2b'),this['trunks'][_0x3888e1[_0x90d4('0x44')]]);}}}catch(_0x4b7301){logger['error'](_0x90d4('0x46'),util[_0x90d4('0x19')](_0x4b7301,{'showHidden':![],'depth':null}));}};module[_0x90d4('0x4a')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 0579ec6..3291438 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0x13b10b,_0x202280){var _0x288715=function(_0x15be9c){while(--_0x15be9c){_0x13b10b['push'](_0x13b10b['shift']());}};_0x288715(++_0x202280);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0x50390e,_0x21268a){var _0x25d7e5=function(_0x3c5aa3){while(--_0x3c5aa3){_0x50390e['push'](_0x50390e['shift']());}};_0x25d7e5(++_0x21268a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};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 bb0006f..ef143af 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 _0x81fc=['unknown','inuse','unavailable','ringinuse','onhold','queue','agi','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','localhost','channels','agents','blindTransfers','coreshowchannel','syncNewExten','newexten','bind','newstate','syncNewState','varset','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstop','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','isUndefined','prototype','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','inspect','merge','pick','keys','context','channel','split','exten','destconnectedlinenum','format','user:%s','user:agentconnect','accountcode','connectedlinenum','error','[%s][voiceCallReport][newcallerid]','syncNewChannel','[%s][voiceCallReport][newchannel]\x20event:','linkedid','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','disposition','toNumber','channelstate','from-sip','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','appdata','CDR(routeAlias)','applicationdata','subtract','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','set','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinename','destinationchannel','UserId','membername','name','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.wav49','monitorFilename','find','push','rec','syncVarSet','variable','mixmonitor_filename','info','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','monitors','getSettings','stopRecordingOnTransfer','StopMixMonitor','catch','Action','finally','webbar:stopmonitors','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','outbound','routeid','ATTENDED','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','BLIND','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','isNil','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel'];(function(_0x36634b,_0x499e59){var _0xf8c840=function(_0x1bbb58){while(--_0x1bbb58){_0x36634b['push'](_0x36634b['shift']());}};_0xf8c840(++_0x499e59);}(_0x81fc,0xc3));var _0xc81f=function(_0x260894,_0x6a1a36){_0x260894=_0x260894-0x0;var _0x359f16=_0x81fc[_0x260894];return _0x359f16;};'use strict';var BPromise=require(_0xc81f('0x0'));var _=require(_0xc81f('0x1'));var moment=require('moment');var util=require(_0xc81f('0x2'));var path=require(_0xc81f('0x3'));var Redis=require(_0xc81f('0x4'));var config=require(_0xc81f('0x5'));var logger=require(_0xc81f('0x6'))(_0xc81f('0x7'));var ami=require(_0xc81f('0x8'));var Channel=require(_0xc81f('0x9'));var RpcSetting=require('../rpc/setting');var statusDesc=[_0xc81f('0xa'),'not_inuse',_0xc81f('0xb'),'busy','invalid',_0xc81f('0xc'),'ringing',_0xc81f('0xd'),_0xc81f('0xe')];var applications=['set',_0xc81f('0xf'),_0xc81f('0x10'),'dial',_0xc81f('0x11'),_0xc81f('0x12')];var dispositions=[_0xc81f('0x13'),_0xc81f('0x14'),'FAILED',_0xc81f('0x13'),'NO\x20ANSWER',_0xc81f('0x13'),'ANSWERED',_0xc81f('0x15'),'FAILED',_0xc81f('0x14'),'FAILED'];var actions={};config[_0xc81f('0x16')]=_[_0xc81f('0x17')](config[_0xc81f('0x16')],{'host':_0xc81f('0x18'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0xb3df95){this[_0xc81f('0x19')]=_0xb3df95['channels'];this[_0xc81f('0x1a')]=_0xb3df95[_0xc81f('0x1a')];this[_0xc81f('0x1b')]={};ami['on'](_0xc81f('0x1c'),this[_0xc81f('0x1d')]['bind'](this));ami['on'](_0xc81f('0x1e'),this[_0xc81f('0x1d')][_0xc81f('0x1f')](this));ami['on']('newchannel',this['syncNewChannel'][_0xc81f('0x1f')](this));ami['on'](_0xc81f('0x20'),this[_0xc81f('0x21')]['bind'](this));ami['on'](_0xc81f('0x22'),this['syncVarSet'][_0xc81f('0x1f')](this));ami['on'](_0xc81f('0x23'),this[_0xc81f('0x24')][_0xc81f('0x1f')](this));ami['on'](_0xc81f('0x25'),this[_0xc81f('0x26')]['bind'](this));ami['on'](_0xc81f('0x27'),this[_0xc81f('0x28')][_0xc81f('0x1f')](this));ami['on']('blindtransfer',this[_0xc81f('0x29')]['bind'](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0xc81f('0x1f')](this));ami['on'](_0xc81f('0x2a'),this['syncMusicOnHoldStop'][_0xc81f('0x1f')](this));try{logger['info']('[voiceCallReport][coreshowchannels]\x20started');ami[_0xc81f('0x2b')]();}catch(_0x377048){logger['error'](_0xc81f('0x2c'),util['inspect'](_0x377048,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x53fe21){return _0x53fe21!==null&&!_[_0xc81f('0x2d')](_0x53fe21);};VoiceCallReport[_0xc81f('0x2e')][_0xc81f('0x2f')]=function(_0x3219a8,_0x262749,_0xb59fbd){io['to'](_0x3219a8)[_0xc81f('0x2f')](_0x262749,_0xb59fbd);};VoiceCallReport[_0xc81f('0x2e')][_0xc81f('0x26')]=function(_0x42724f){try{if(this[_0xc81f('0x30')](_0x42724f)){logger['info'](_0xc81f('0x31'),_0x42724f[_0xc81f('0x32')],_0x42724f[_0xc81f('0x33')],_0x42724f[_0xc81f('0x34')]);logger[_0xc81f('0x35')](_0xc81f('0x36'),_0x42724f['uniqueid'],util[_0xc81f('0x37')](_0x42724f,{'showHidden':![],'depth':null}));if(_0x42724f['uniqueid']===_0x42724f['linkedid']){if(!_[_0xc81f('0x2d')](this['channels'][_0x42724f[_0xc81f('0x32')]])){_[_0xc81f('0x38')](this['channels'][_0x42724f[_0xc81f('0x32')]],_[_0xc81f('0x39')](_0x42724f,_[_0xc81f('0x3a')](this[_0xc81f('0x19')][_0x42724f[_0xc81f('0x32')]])));}}if(_0x42724f[_0xc81f('0x3b')]==='from-sip'){if(this['agents'][_0x42724f[_0xc81f('0x3c')][_0xc81f('0x3d')]('-')[0x0]]){if(_0x42724f[_0xc81f('0x3e')]=='xcally-motion-preview'){this[_0xc81f('0x1a')][_0x42724f[_0xc81f('0x3c')][_0xc81f('0x3d')]('-')[0x0]][_0xc81f('0x3f')]=_0x42724f['connectedlinenum'];this[_0xc81f('0x2f')](util[_0xc81f('0x40')](_0xc81f('0x41'),this['agents'][_0x42724f[_0xc81f('0x3c')][_0xc81f('0x3d')]('-')[0x0]]['name']),_0xc81f('0x42'),{'destaccountcode':this[_0xc81f('0x1a')][_0x42724f[_0xc81f('0x3c')][_0xc81f('0x3d')]('-')[0x0]][_0xc81f('0x43')],'destconnectedlinenum':_0x42724f[_0xc81f('0x44')]});}}}}}catch(_0x5117b6){logger[_0xc81f('0x45')](_0xc81f('0x46'),_0x42724f[_0xc81f('0x32')],util['inspect'](_0x5117b6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc81f('0x2e')][_0xc81f('0x47')]=function(_0x828dfe){try{if(this[_0xc81f('0x30')](_0x828dfe)){logger[_0xc81f('0x35')](_0xc81f('0x48'),_0x828dfe['uniqueid'],util['inspect'](_0x828dfe,{'showHidden':![],'depth':null}));if(_0x828dfe['uniqueid']===_0x828dfe[_0xc81f('0x49')]&&_0x828dfe[_0xc81f('0x3c')]!=_0xc81f('0x4a')){if(_[_0xc81f('0x2d')](this[_0xc81f('0x19')][_0x828dfe[_0xc81f('0x32')]])){logger['info'](_0xc81f('0x4b'),_0x828dfe[_0xc81f('0x32')],_0x828dfe['context'],_0x828dfe[_0xc81f('0x3e')]);this[_0xc81f('0x19')][_0x828dfe[_0xc81f('0x32')]]=new Channel();this[_0xc81f('0x19')][_0x828dfe['uniqueid']][_0xc81f('0x4c')]=moment()[_0xc81f('0x40')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x828dfe['uniqueid']][_0xc81f('0x4d')]=dispositions[_[_0xc81f('0x4e')](_0x828dfe[_0xc81f('0x4f')])];_['merge'](this[_0xc81f('0x19')][_0x828dfe[_0xc81f('0x32')]],_['pick'](_0x828dfe,_['keys'](this[_0xc81f('0x19')][_0x828dfe[_0xc81f('0x32')]])));if(_0x828dfe[_0xc81f('0x3b')]===_0xc81f('0x50')){if(this['agents'][_0x828dfe['channel'][_0xc81f('0x3d')]('-')[0x0]]){if(_[_0xc81f('0x2d')](this[_0xc81f('0x1a')][_0x828dfe[_0xc81f('0x3c')][_0xc81f('0x3d')]('-')[0x0]][_0xc81f('0x3f')])){this['agents'][_0x828dfe[_0xc81f('0x3c')][_0xc81f('0x3d')]('-')[0x0]]['destconnectedlinenum']=_0x828dfe[_0xc81f('0x3e')];logger[_0xc81f('0x35')](_0xc81f('0x51'),_0x828dfe[_0xc81f('0x32')],util[_0xc81f('0x37')]({'destaccountcode':this['agents'][_0x828dfe[_0xc81f('0x3c')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x828dfe['exten']},{'showHidden':![],'depth':null}));this[_0xc81f('0x2f')](util[_0xc81f('0x40')]('user:%s',this[_0xc81f('0x1a')][_0x828dfe[_0xc81f('0x3c')]['split']('-')[0x0]]['name']),_0xc81f('0x42'),{'destaccountcode':this[_0xc81f('0x1a')][_0x828dfe['channel'][_0xc81f('0x3d')]('-')[0x0]][_0xc81f('0x43')],'destconnectedlinenum':_0x828dfe[_0xc81f('0x3e')]});}}}}}}}catch(_0x2bd5e7){logger[_0xc81f('0x45')](_0xc81f('0x52'),_0x828dfe[_0xc81f('0x32')],util['inspect'](_0x2bd5e7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc81f('0x2e')][_0xc81f('0x1d')]=function(_0x52fdcb){try{if(this[_0xc81f('0x30')](_0x52fdcb)){logger[_0xc81f('0x35')](_0xc81f('0x53'),_0x52fdcb[_0xc81f('0x32')],util[_0xc81f('0x37')](_0x52fdcb,{'showHidden':![],'depth':null}));if(_0x52fdcb[_0xc81f('0x32')]===_0x52fdcb['linkedid']&&_0x52fdcb[_0xc81f('0x3e')]!='h'&&_0x52fdcb[_0xc81f('0x3c')]!=_0xc81f('0x4a')){_0x52fdcb[_0xc81f('0x54')]=_0x52fdcb[_0xc81f('0x54')][_0xc81f('0x55')]();_0x52fdcb['applicationdata']=_0x52fdcb[_0xc81f('0x56')]&&_0x52fdcb[_0xc81f('0x56')]['startsWith'](_0xc81f('0x57'))?_0x52fdcb[_0xc81f('0x56')]:(_0x52fdcb[_0xc81f('0x56')]||_0x52fdcb[_0xc81f('0x58')])['toLowerCase']();logger['info']('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x52fdcb[_0xc81f('0x32')],_0x52fdcb[_0xc81f('0x54')],_0x52fdcb['applicationdata']);if(_[_0xc81f('0x2d')](this[_0xc81f('0x19')][_0x52fdcb[_0xc81f('0x32')]])){this[_0xc81f('0x19')][_0x52fdcb[_0xc81f('0x32')]]=new Channel();this['channels'][_0x52fdcb['uniqueid']][_0xc81f('0x4c')]=_0x52fdcb['duration']?moment()[_0xc81f('0x59')](moment[_0xc81f('0x5a')](_0x52fdcb['duration'])[_0xc81f('0x5b')](),'seconds')[_0xc81f('0x40')](_0xc81f('0x5c')):moment()[_0xc81f('0x40')](_0xc81f('0x5c'));this['channels'][_0x52fdcb[_0xc81f('0x32')]][_0xc81f('0x4d')]='NO\x20ANSWER';}_['merge'](this['channels'][_0x52fdcb[_0xc81f('0x32')]],_[_0xc81f('0x39')](_0x52fdcb,_[_0xc81f('0x3a')](this['channels'][_0x52fdcb['uniqueid']])));if(_[_0xc81f('0x5d')](applications,_0x52fdcb[_0xc81f('0x54')])){this['channels'][_0x52fdcb[_0xc81f('0x32')]][_0xc81f('0x5e')]=_0x52fdcb[_0xc81f('0x54')];this['channels'][_0x52fdcb[_0xc81f('0x32')]][_0xc81f('0x5f')]=_0x52fdcb[_0xc81f('0x58')];if(_0x52fdcb[_0xc81f('0x54')]===_0xc81f('0x60')&&_[_0xc81f('0x61')](_0x52fdcb[_0xc81f('0x58')]['toLowerCase'](),_0xc81f('0x62'))){var _0x5d4a5e=_0x52fdcb[_0xc81f('0x58')][_0xc81f('0x3d')]('=');var _0x265360=_0x5d4a5e[0x0][_0xc81f('0x55')]()[_0xc81f('0x63')](/cdr\((.*)\)/);if(_0x265360){this['channels'][_0x52fdcb[_0xc81f('0x32')]][_0x265360[0x1]]=_0x5d4a5e[0x1];}}else if(_0x52fdcb[_0xc81f('0x54')]==='queue'){this['channels'][_0x52fdcb[_0xc81f('0x32')]][_0xc81f('0xf')]=_0x52fdcb['applicationdata'][_0xc81f('0x3d')](',')[0x0];}}}}}catch(_0xd10229){logger[_0xc81f('0x45')](_0xc81f('0x64'),_0x52fdcb['uniqueid'],util[_0xc81f('0x37')](_0xd10229,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc81f('0x2e')][_0xc81f('0x21')]=function(_0x293808){try{if(this[_0xc81f('0x30')](_0x293808)){logger['info']('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x293808[_0xc81f('0x32')],_0x293808['linkedid'],_0x293808['calleridname'],_0x293808[_0xc81f('0x34')]);logger[_0xc81f('0x35')](_0xc81f('0x65'),_0x293808[_0xc81f('0x32')],util[_0xc81f('0x37')](_0x293808,{'showHidden':![],'depth':null}));if(_0x293808[_0xc81f('0x32')]!==_0x293808['linkedid']){if(this[_0xc81f('0x19')][_0x293808[_0xc81f('0x49')]]){if(_0x293808['channelstate']==='6'){if(!this['channels'][_0x293808['linkedid']][_0xc81f('0x66')]){var _0x2c8e32=moment();this[_0xc81f('0x19')][_0x293808[_0xc81f('0x49')]]['answered']=!![];this['channels'][_0x293808[_0xc81f('0x49')]][_0xc81f('0x67')]=_0x2c8e32[_0xc81f('0x40')](_0xc81f('0x5c'));if(this[_0xc81f('0x19')][_0x293808[_0xc81f('0x49')]][_0xc81f('0x4c')]){this[_0xc81f('0x19')][_0x293808[_0xc81f('0x49')]][_0xc81f('0x68')]=_0x2c8e32[_0xc81f('0x69')](this[_0xc81f('0x19')][_0x293808[_0xc81f('0x49')]][_0xc81f('0x4c')],_0xc81f('0x5b'));}}this['channels'][_0x293808[_0xc81f('0x49')]][_0xc81f('0x49')]=_0x293808[_0xc81f('0x32')];if(_0x293808[_0xc81f('0x34')]!==_0xc81f('0x6a')){this[_0xc81f('0x19')][_0x293808[_0xc81f('0x49')]][_0xc81f('0x44')]=_0x293808[_0xc81f('0x34')];}this[_0xc81f('0x19')][_0x293808[_0xc81f('0x49')]][_0xc81f('0x6b')]=_0x293808[_0xc81f('0x33')];this[_0xc81f('0x19')][_0x293808['linkedid']][_0xc81f('0x6c')]=_0x293808[_0xc81f('0x3c')];this[_0xc81f('0x19')][_0x293808[_0xc81f('0x49')]][_0xc81f('0x4d')]=dispositions[_[_0xc81f('0x4e')](_0x293808[_0xc81f('0x4f')])];if(this[_0xc81f('0x1a')][_0x293808[_0xc81f('0x3c')]['split']('-')[0x0]]){this[_0xc81f('0x19')][_0x293808[_0xc81f('0x49')]][_0xc81f('0x6d')]=this[_0xc81f('0x1a')][_0x293808['channel'][_0xc81f('0x3d')]('-')[0x0]]['id'];this[_0xc81f('0x19')][_0x293808['linkedid']][_0xc81f('0x6e')]=this[_0xc81f('0x1a')][_0x293808[_0xc81f('0x3c')]['split']('-')[0x0]][_0xc81f('0x6f')];}}}}else{if(this['channels'][_0x293808['uniqueid']]){if(_0x293808[_0xc81f('0x4f')]==='6'){if(this[_0xc81f('0x1a')][_0x293808['channel'][_0xc81f('0x3d')]('-')[0x0]]){this[_0xc81f('0x19')][_0x293808['uniqueid']]['UserId']=this[_0xc81f('0x1a')][_0x293808[_0xc81f('0x3c')][_0xc81f('0x3d')]('-')[0x0]]['id'];this[_0xc81f('0x19')][_0x293808[_0xc81f('0x32')]]['membername']=this[_0xc81f('0x1a')][_0x293808[_0xc81f('0x3c')][_0xc81f('0x3d')]('-')[0x0]][_0xc81f('0x6f')];}}}}if(_0x293808['channelstate']==='6'&&_0x293808[_0xc81f('0x3b')]===_0xc81f('0x50')){if(this[_0xc81f('0x1a')][_0x293808[_0xc81f('0x3c')]['split']('-')[0x0]]){this[_0xc81f('0x1a')][_0x293808[_0xc81f('0x3c')]['split']('-')[0x0]]['destconnectedlinenum']=_0x293808[_0xc81f('0x3e')];var _0x1ab7fe;if(this['channels'][_0x293808['uniqueid']])_0x1ab7fe=this[_0xc81f('0x19')][_0x293808['uniqueid']][_0xc81f('0x70')];else if(this[_0xc81f('0x19')][_0x293808[_0xc81f('0x49')]])_0x1ab7fe=this[_0xc81f('0x19')][_0x293808['linkedid']][_0xc81f('0x70')];logger[_0xc81f('0x35')](_0xc81f('0x71'),_0x293808[_0xc81f('0x32')],util['inspect']({'destaccountcode':this[_0xc81f('0x1a')][_0x293808[_0xc81f('0x3c')][_0xc81f('0x3d')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x293808[_0xc81f('0x3e')],'routealias':_0x1ab7fe},{'showHidden':![],'depth':null}));this[_0xc81f('0x2f')](util['format'](_0xc81f('0x41'),this[_0xc81f('0x1a')][_0x293808[_0xc81f('0x3c')][_0xc81f('0x3d')]('-')[0x0]][_0xc81f('0x6f')]),_0xc81f('0x42'),{'destaccountcode':this[_0xc81f('0x1a')][_0x293808[_0xc81f('0x3c')][_0xc81f('0x3d')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x293808[_0xc81f('0x3e')],'routealias':_0x1ab7fe});}}}}catch(_0x29f399){logger[_0xc81f('0x45')](_0xc81f('0x72'),_0x293808['uniqueid'],util[_0xc81f('0x37')](_0x29f399,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc81f('0x2e')][_0xc81f('0x73')]=function(_0x54064a,_0x1dac6e){try{if(this['channels'][_0x54064a]){logger['info'](_0xc81f('0x74'),_0x54064a,_0x1dac6e);this[_0xc81f('0x19')][_0x54064a][_0xc81f('0x75')]=!![];if(_[_0xc81f('0x76')](_0x1dac6e,'.wav49')){_0x1dac6e=_0x1dac6e[_0xc81f('0x77')](_0xc81f('0x78'),'.WAV');}this[_0xc81f('0x19')][_0x54064a][_0xc81f('0x79')]=_0x1dac6e;var _0x5894f3=_[_0xc81f('0x7a')](this[_0xc81f('0x19')][_0x54064a]['monitors'],{'filename':_0x1dac6e});if(_['isNil'](_0x5894f3)){this['channels'][_0x54064a]['monitors'][_0xc81f('0x7b')]({'filename':_0x1dac6e,'createdAt':moment()['format'](_0xc81f('0x5c')),'mixmonitorid':'','status':_0xc81f('0x7c')});}}}catch(_0xb20215){logger[_0xc81f('0x45')]('[%s][voiceCallReport][mixMonitorFilename]',_0x54064a,util[_0xc81f('0x37')](_0xb20215,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xc81f('0x7d')]=function(_0x52f806){try{if(this[_0xc81f('0x30')](_0x52f806)){logger[_0xc81f('0x35')]('[%s][voiceCallReport][varset]\x20event:',_0x52f806[_0xc81f('0x32')],util[_0xc81f('0x37')](_0x52f806,{'showHidden':![],'depth':null}));if(this['channels'][_0x52f806['uniqueid']]&&_0x52f806[_0xc81f('0x3c')]!=_0xc81f('0x4a')){if(this[_0xc81f('0x30')](_0x52f806[_0xc81f('0x7e')])){if(this[_0xc81f('0x30')](_0x52f806[_0xc81f('0x7e')][_0xc81f('0x7f')])){logger[_0xc81f('0x80')](_0xc81f('0x81'),_0x52f806[_0xc81f('0x32')],_0x52f806[_0xc81f('0x82')]);this[_0xc81f('0x73')](_0x52f806[_0xc81f('0x32')],_0x52f806[_0xc81f('0x82')]);}else if(this[_0xc81f('0x30')](_0x52f806[_0xc81f('0x7e')][_0xc81f('0x83')])){logger['info'](_0xc81f('0x84'),_0x52f806['uniqueid'],_0x52f806[_0xc81f('0x82')]);this[_0xc81f('0x19')][_0x52f806[_0xc81f('0x32')]][_0xc81f('0x34')]=_0x52f806['value'];}else if(this[_0xc81f('0x30')](_0x52f806[_0xc81f('0x7e')][_0xc81f('0x85')])){logger[_0xc81f('0x80')](_0xc81f('0x86'),_0x52f806[_0xc81f('0x32')],_0x52f806[_0xc81f('0x82')]);this[_0xc81f('0x19')][_0x52f806[_0xc81f('0x32')]][_0xc81f('0x87')]=_0x52f806[_0xc81f('0x82')];}else if(this[_0xc81f('0x30')](_0x52f806[_0xc81f('0x7e')][_0xc81f('0x88')])){logger['info'](_0xc81f('0x89'),_0x52f806[_0xc81f('0x32')],_0x52f806['value']);this['channels'][_0x52f806[_0xc81f('0x32')]][_0xc81f('0x8a')]=_0x52f806['value'];}else if(this[_0xc81f('0x30')](_0x52f806[_0xc81f('0x7e')][_0xc81f('0x8b')])){logger[_0xc81f('0x80')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x52f806['uniqueid'],_0x52f806[_0xc81f('0x82')][_0xc81f('0x3d')](',')[0x0]);this[_0xc81f('0x19')][_0x52f806[_0xc81f('0x32')]][_0xc81f('0xf')]=_0x52f806[_0xc81f('0x82')][_0xc81f('0x3d')](',')[0x0];}else if(this['isNotNull'](_0x52f806[_0xc81f('0x7e')][_0xc81f('0x8c')])){logger[_0xc81f('0x80')](_0xc81f('0x8d'),_0x52f806['uniqueid'],_0x52f806['value']);this[_0xc81f('0x19')][_0x52f806['uniqueid']]['originatecalleridnum']=_0x52f806[_0xc81f('0x82')];}else if(this['isNotNull'](_0x52f806[_0xc81f('0x7e')]['xmd-destination'])){logger[_0xc81f('0x80')](_0xc81f('0x8e'),_0x52f806[_0xc81f('0x32')],_0x52f806[_0xc81f('0x82')]);this[_0xc81f('0x19')][_0x52f806[_0xc81f('0x32')]][_0xc81f('0x8f')]=_0x52f806[_0xc81f('0x82')];}else if(this[_0xc81f('0x30')](_0x52f806[_0xc81f('0x7e')][_0xc81f('0x90')])){logger[_0xc81f('0x80')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x52f806[_0xc81f('0x32')],_0x52f806['value']);this[_0xc81f('0x19')][_0x52f806[_0xc81f('0x32')]]['calleridpreview']=_0x52f806[_0xc81f('0x82')];}else if(this[_0xc81f('0x30')](_0x52f806[_0xc81f('0x7e')][_0xc81f('0x91')])){logger[_0xc81f('0x80')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x52f806[_0xc81f('0x32')],_0x52f806[_0xc81f('0x82')]);this[_0xc81f('0x19')][_0x52f806[_0xc81f('0x32')]][_0xc81f('0xf')]=_0x52f806[_0xc81f('0x82')];}else if(this[_0xc81f('0x30')](_0x52f806[_0xc81f('0x7e')][_0xc81f('0x92')])){logger[_0xc81f('0x80')](_0xc81f('0x93'),_0x52f806['uniqueid'],_0x52f806[_0xc81f('0x82')]);this[_0xc81f('0x19')][_0x52f806[_0xc81f('0x32')]][_0xc81f('0x94')]=_0x52f806['value'];}}}else if(this[_0xc81f('0x30')](_0x52f806[_0xc81f('0x7e')][_0xc81f('0x7f')])){if(_0x52f806[_0xc81f('0x82')]){var _0xa98bcd=path[_0xc81f('0x95')](_0x52f806['value'])[_0xc81f('0x6f')];logger[_0xc81f('0x80')](_0xc81f('0x81'),_0xa98bcd,_0x52f806[_0xc81f('0x82')]);this[_0xc81f('0x73')](_0xa98bcd,_0x52f806[_0xc81f('0x82')]);}}else if(this[_0xc81f('0x19')][_0x52f806[_0xc81f('0x49')]]){if(this[_0xc81f('0x30')](_0x52f806[_0xc81f('0x7e')])){if(this[_0xc81f('0x30')](_0x52f806[_0xc81f('0x7e')][_0xc81f('0x92')])){logger[_0xc81f('0x80')](_0xc81f('0x93'),_0x52f806['linkedid'],_0x52f806['value']);this[_0xc81f('0x19')][_0x52f806['linkedid']][_0xc81f('0x96')]=_0x52f806[_0xc81f('0x82')];}}}}}catch(_0x599a8b){logger[_0xc81f('0x45')](_0xc81f('0x97'),_0x52f806[_0xc81f('0x32')],util[_0xc81f('0x37')](_0x599a8b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc81f('0x2e')]['syncHangup']=function(_0xd419b9){try{if(this['isNotNull'](_0xd419b9)){logger['debug'](_0xc81f('0x98'),_0xd419b9[_0xc81f('0x32')],util[_0xc81f('0x37')](_0xd419b9,{'showHidden':![],'depth':null}));if(this[_0xc81f('0x19')][_0xd419b9[_0xc81f('0x32')]]){logger[_0xc81f('0x80')](_0xc81f('0x99'),_0xd419b9[_0xc81f('0x32')],_0xd419b9[_0xc81f('0x9a')]);var _0x298d84=moment();this[_0xc81f('0x19')][_0xd419b9[_0xc81f('0x32')]][_0xc81f('0x9b')]=_0x298d84[_0xc81f('0x40')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc81f('0x19')][_0xd419b9['uniqueid']]['duration']=_0x298d84['diff'](this['channels'][_0xd419b9[_0xc81f('0x32')]][_0xc81f('0x4c')],_0xc81f('0x5b'));if(this[_0xc81f('0x19')][_0xd419b9[_0xc81f('0x32')]][_0xc81f('0x66')]){this[_0xc81f('0x19')][_0xd419b9[_0xc81f('0x32')]]['billableseconds']=_0x298d84[_0xc81f('0x69')](this[_0xc81f('0x19')][_0xd419b9[_0xc81f('0x32')]][_0xc81f('0x67')],_0xc81f('0x5b'));this[_0xc81f('0x19')][_0xd419b9[_0xc81f('0x32')]][_0xc81f('0x68')]=this[_0xc81f('0x19')][_0xd419b9[_0xc81f('0x32')]]['duration']-this[_0xc81f('0x19')][_0xd419b9['uniqueid']][_0xc81f('0x9c')];}if(_0xd419b9[_0xc81f('0x3b')]===_0xc81f('0x50')){if(this[_0xc81f('0x1a')][_0xd419b9[_0xc81f('0x3c')]['split']('-')[0x0]]){this[_0xc81f('0x1a')][_0xd419b9['channel']['split']('-')[0x0]]=_[_0xc81f('0x9d')](this[_0xc81f('0x1a')][_0xd419b9[_0xc81f('0x3c')]['split']('-')[0x0]],[_0xc81f('0x3f')]);logger[_0xc81f('0x35')](_0xc81f('0x9e'),_0xd419b9['uniqueid'],util['inspect']({'id':this[_0xc81f('0x1a')][_0xd419b9[_0xc81f('0x3c')][_0xc81f('0x3d')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0xd419b9['channel']['split']('-')[0x0]][_0xc81f('0x43')]},{'showHidden':![],'depth':null}));this[_0xc81f('0x2f')](util['format'](_0xc81f('0x41'),this['agents'][_0xd419b9[_0xc81f('0x3c')]['split']('-')[0x0]][_0xc81f('0x6f')]),_0xc81f('0x9f'),{'id':this[_0xc81f('0x1a')][_0xd419b9['channel']['split']('-')[0x0]]['id'],'destaccountcode':this[_0xc81f('0x1a')][_0xd419b9[_0xc81f('0x3c')][_0xc81f('0x3d')]('-')[0x0]][_0xc81f('0x43')]});}}var _0x2cbfac=this;Promise[_0xc81f('0xa0')]()[_0xc81f('0xa1')](function(){var _0x4e68f2=_0x2cbfac['channels'][_0xd419b9['uniqueid']];if(typeof _0x4e68f2[_0xc81f('0xa2')]==='undefined')return;if(_['isEmpty'](_0x4e68f2[_0xc81f('0xa3')]))return;return RpcSetting[_0xc81f('0xa4')]()[_0xc81f('0xa1')](function(_0x13525a){if(!_0x13525a[_0xc81f('0xa5')])return;return Promise[_0xc81f('0xa0')]()['then'](function(){return ami['Action']({'action':_0xc81f('0xa6'),'channel':_0x4e68f2[_0xc81f('0x3c')]})[_0xc81f('0xa7')](function(){});})[_0xc81f('0xa1')](function(){return ami[_0xc81f('0xa8')]({'action':'StopMixMonitor','channel':_0x4e68f2[_0xc81f('0x6c')]})['catch'](function(){})[_0xc81f('0xa9')](function(){var _0x357a36=_0x2cbfac[_0xc81f('0x1a')][_0x4e68f2[_0xc81f('0x6c')][_0xc81f('0x3d')]('-')[0x0]];if(!_0x357a36)return;io[_0xc81f('0x2f')](_0xc81f('0xaa'),{'agentId':_0x357a36['id'],'uniqueid':_0x4e68f2[_0xc81f('0x32')]});});});});})[_0xc81f('0xa1')](function(){if(_0xd419b9['event']===_0xc81f('0xab')){_0x2cbfac[_0xc81f('0x1b')][_0xd419b9[_0xc81f('0x32')]]=_0x2cbfac[_0xc81f('0x19')][_0xd419b9['uniqueid']];}else{if(_0x2cbfac[_0xc81f('0x19')][_0xd419b9[_0xc81f('0x32')]][_0xc81f('0x8a')]==='outbound'&&_0x2cbfac[_0xc81f('0x1b')][_0xd419b9['uniqueid']]){_0x2cbfac['channels'][_0xd419b9['uniqueid']][_0xc81f('0x32')]=[_0x2cbfac['channels'][_0xd419b9['uniqueid']]['linkedid'],_0x2cbfac['channels'][_0xd419b9[_0xc81f('0x32')]][_0xc81f('0x49')]=_0x2cbfac[_0xc81f('0x19')][_0xd419b9[_0xc81f('0x32')]]['uniqueid']][0x0];delete _0x2cbfac[_0xc81f('0x1b')][_0xd419b9['uniqueid']];}}logger[_0xc81f('0x35')](_0xc81f('0xac'),_0xd419b9[_0xc81f('0x32')],util[_0xc81f('0x37')](_0x2cbfac[_0xc81f('0x19')][_0xd419b9[_0xc81f('0x32')]],{'showHidden':![],'depth':null}));ami[_0xc81f('0x2f')](_0xc81f('0xad'),_0x2cbfac[_0xc81f('0x19')][_0xd419b9[_0xc81f('0x32')]]);delete _0x2cbfac[_0xc81f('0x19')][_0xd419b9['uniqueid']];});}}}catch(_0x56bbb1){logger[_0xc81f('0x45')](_0xc81f('0xae'),_0xd419b9[_0xc81f('0x32')],util[_0xc81f('0x37')](_0x56bbb1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xc81f('0x28')]=function(_0x400b3b){try{if(this['isNotNull'](_0x400b3b)){logger[_0xc81f('0x80')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x400b3b[_0xc81f('0x32')],_0x400b3b[_0xc81f('0xaf')],_0x400b3b[_0xc81f('0xb0')]);logger[_0xc81f('0x35')](_0xc81f('0xb1'),_0x400b3b['uniqueid'],util[_0xc81f('0x37')](_0x400b3b,{'showHidden':![],'depth':null}));if(this['channels'][_0x400b3b[_0xc81f('0xb2')]]){this[_0xc81f('0x19')][_0x400b3b[_0xc81f('0xb2')]][_0xc81f('0xb3')]=_0x400b3b[_0xc81f('0xaf')];this[_0xc81f('0x19')][_0x400b3b['transfereeuniqueid']][_0xc81f('0xb4')]=_0x400b3b[_0xc81f('0xb0')];if(this[_0xc81f('0x19')][_0x400b3b[_0xc81f('0xb5')]]){var _0x257d28=this[_0xc81f('0x19')][_0x400b3b['secondtransfereruniqueid']];this[_0xc81f('0x19')][_0x400b3b['secondtransfereruniqueid']]=this['channels'][_0x400b3b[_0xc81f('0xb2')]];this[_0xc81f('0x19')][_0x400b3b[_0xc81f('0xb2')]]=_0x257d28;}}else if(this[_0xc81f('0x19')][_0x400b3b[_0xc81f('0xb6')]]){this[_0xc81f('0x19')][_0x400b3b[_0xc81f('0xb6')]][_0xc81f('0xb3')]=_0x400b3b[_0xc81f('0xaf')];this['channels'][_0x400b3b[_0xc81f('0xb6')]][_0xc81f('0xb4')]=_0x400b3b['transfertargetcalleridnum'];if(this[_0xc81f('0x19')][_0x400b3b[_0xc81f('0xb7')]]){var _0x257d28=this[_0xc81f('0x19')][_0x400b3b[_0xc81f('0xb7')]];this[_0xc81f('0x19')][_0x400b3b[_0xc81f('0xb7')]]=this[_0xc81f('0x19')][_0x400b3b[_0xc81f('0xb6')]];this[_0xc81f('0x19')][_0x400b3b['transfertargetuniqueid']]=_0x257d28;}}if((this['channels'][_0x400b3b[_0xc81f('0xb7')]]||this[_0xc81f('0x19')][_0x400b3b[_0xc81f('0xb8')]])&&this[_0xc81f('0x19')][_0x400b3b[_0xc81f('0xb5')]]){var _0x5c7bf9=_[_0xc81f('0xb9')]([this[_0xc81f('0x19')][_0x400b3b[_0xc81f('0xb7')]],this[_0xc81f('0x19')][_0x400b3b[_0xc81f('0xb8')]],this['channels'][_0x400b3b[_0xc81f('0xb5')]]],function(_0x250cc8){return _0x250cc8&&_0x250cc8[_0xc81f('0x8a')]===_0xc81f('0xba')&&_0x250cc8[_0xc81f('0xbb')];});if(_0x5c7bf9){if(this[_0xc81f('0x19')][_0x400b3b['origtransfereruniqueid']])this[_0xc81f('0x19')][_0x400b3b['origtransfereruniqueid']][_0xc81f('0xa2')]=_0xc81f('0xbc');if(this[_0xc81f('0x19')][_0x400b3b[_0xc81f('0xb8')]])this[_0xc81f('0x19')][_0x400b3b[_0xc81f('0xb8')]]['transferType']='ATTENDED';this[_0xc81f('0x19')][_0x400b3b[_0xc81f('0xb5')]][_0xc81f('0xa2')]=_0xc81f('0xbc');}}}}catch(_0x4d810b){logger[_0xc81f('0x45')]('[%s][voiceCallReport][attendedtransfer]',_0x400b3b[_0xc81f('0x32')],util[_0xc81f('0x37')](_0x4d810b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncBlindTransfer']=function(_0x5944b9){try{if(this[_0xc81f('0x30')](_0x5944b9)){logger[_0xc81f('0x80')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x5944b9[_0xc81f('0x32')],_0x5944b9[_0xc81f('0xbd')],_0x5944b9[_0xc81f('0xbe')]);logger['debug'](_0xc81f('0xbf'),_0x5944b9[_0xc81f('0x32')],util[_0xc81f('0x37')](_0x5944b9,{'showHidden':![],'depth':null}));if(this[_0xc81f('0x19')][_0x5944b9['transfereeuniqueid']]){this[_0xc81f('0x19')][_0x5944b9[_0xc81f('0xb2')]][_0xc81f('0xb3')]=_0x5944b9[_0xc81f('0xbd')];this['channels'][_0x5944b9['transfereeuniqueid']][_0xc81f('0xb4')]=_0x5944b9['extension'];this[_0xc81f('0x19')][_0x5944b9[_0xc81f('0xb2')]][_0xc81f('0xa2')]='BLIND';this[_0xc81f('0x24')]({'event':_0xc81f('0xab'),'uniqueid':_0x5944b9['transfereeuniqueid'],'context':_0x5944b9[_0xc81f('0x3b')],'channel':_0x5944b9[_0xc81f('0xc0')]});}else{this[_0xc81f('0x19')][_0x5944b9['transfereruniqueid']][_0xc81f('0xa2')]=_0xc81f('0xc1');}}}catch(_0x29f3e7){logger[_0xc81f('0x45')](_0xc81f('0xc2'),_0x5944b9['uniqueid'],util[_0xc81f('0x37')](_0x29f3e7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc81f('0x2e')]['syncMusicOnHoldStart']=function(_0x3a15e5){try{if(this[_0xc81f('0x30')](_0x3a15e5)){logger[_0xc81f('0x35')](_0xc81f('0xc3'),_0x3a15e5[_0xc81f('0x32')],util['inspect'](_0x3a15e5,{'showHidden':![],'depth':null}));if(this['channels'][_0x3a15e5[_0xc81f('0x32')]]){if(!_['isNil'](this['channels'][_0x3a15e5[_0xc81f('0x32')]][_0xc81f('0x67')])){this[_0xc81f('0x19')][_0x3a15e5[_0xc81f('0x32')]][_0xc81f('0xc4')]=moment()[_0xc81f('0x40')](_0xc81f('0x5c'));logger['info'](_0xc81f('0xc5'),_0x3a15e5[_0xc81f('0x32')],this[_0xc81f('0x19')][_0x3a15e5[_0xc81f('0x32')]][_0xc81f('0xc4')]);}}}}catch(_0x1d782e){logger[_0xc81f('0x45')](_0xc81f('0xc6'),_0x3a15e5[_0xc81f('0x32')],util[_0xc81f('0x37')](_0x1d782e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc81f('0x2e')][_0xc81f('0xc7')]=function(_0xcd3e4){try{if(this[_0xc81f('0x30')](_0xcd3e4)){logger['debug']('[%s][voiceCallReport][musiconholdstop]\x20event:',_0xcd3e4[_0xc81f('0x32')],util[_0xc81f('0x37')](_0xcd3e4,{'showHidden':![],'depth':null}));if(this[_0xc81f('0x19')][_0xcd3e4['uniqueid']]){if(!_[_0xc81f('0xc8')](this['channels'][_0xcd3e4[_0xc81f('0x32')]][_0xc81f('0xc4')])){this[_0xc81f('0x19')][_0xcd3e4[_0xc81f('0x32')]][_0xc81f('0xc9')]+=moment()[_0xc81f('0xca')](0x0)[_0xc81f('0x69')](this['channels'][_0xcd3e4[_0xc81f('0x32')]][_0xc81f('0xc4')],_0xc81f('0x5b'));logger[_0xc81f('0x80')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0xcd3e4['uniqueid'],this[_0xc81f('0x19')][_0xcd3e4[_0xc81f('0x32')]][_0xc81f('0xc9')]);delete this[_0xc81f('0x19')][_0xcd3e4[_0xc81f('0x32')]][_0xc81f('0xc4')];}}}}catch(_0x138ba7){logger[_0xc81f('0x45')](_0xc81f('0xcb'),_0xcd3e4['uniqueid'],util['inspect'](_0x138ba7,{'showHidden':![],'depth':null}));}};module[_0xc81f('0xcc')]=VoiceCallReport; \ No newline at end of file +var _0x5b82=['secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','some','outbound','ATTENDED','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','BLIND','BlindTransfer','transfererchannel','mohstarttime','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','set','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','newexten','bind','newchannel','syncNewChannel','varset','syncVarSet','hangup','syncHangup','newcallerid','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','isNotNull','prototype','emit','syncNewCallerId','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','isUndefined','merge','context','channel','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','split','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','debug','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','pick','keys','from-sip','user:%s','[%s][voiceCallReport][newchannel]','application','toLowerCase','applicationdata','appdata','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','includes','startsWith','cdr(','match','queue','[%s][voiceCallReport][newexten]','syncNewState','calleridname','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','holdtime','destinationchannel','disposition','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','.wav49','replace','monitorFilename','find','monitors','isNil','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','syncMixMonitorFilename','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','diff','answertime','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','resolve','then','transferType','undefined','isEmpty','getSettings','stopRecordingOnTransfer','StopMixMonitor','catch','Action','finally','webbar:stopmonitors','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum'];(function(_0x1a073c,_0x22e86e){var _0x3d30f8=function(_0x410d29){while(--_0x410d29){_0x1a073c['push'](_0x1a073c['shift']());}};_0x3d30f8(++_0x22e86e);}(_0x5b82,0xdf));var _0x25b8=function(_0x53eacf,_0x256c37){_0x53eacf=_0x53eacf-0x0;var _0x4f0fa4=_0x5b82[_0x53eacf];return _0x4f0fa4;};'use strict';var BPromise=require('bluebird');var _=require(_0x25b8('0x0'));var moment=require(_0x25b8('0x1'));var util=require(_0x25b8('0x2'));var path=require('path');var Redis=require('ioredis');var config=require(_0x25b8('0x3'));var logger=require(_0x25b8('0x4'))(_0x25b8('0x5'));var ami=require(_0x25b8('0x6'));var Channel=require(_0x25b8('0x7'));var RpcSetting=require('../rpc/setting');var statusDesc=[_0x25b8('0x8'),_0x25b8('0x9'),'inuse',_0x25b8('0xa'),_0x25b8('0xb'),_0x25b8('0xc'),_0x25b8('0xd'),_0x25b8('0xe'),'onhold'];var applications=[_0x25b8('0xf'),'queue','agi',_0x25b8('0x10'),_0x25b8('0x11'),_0x25b8('0x12')];var dispositions=['NO\x20ANSWER',_0x25b8('0x13'),'FAILED',_0x25b8('0x14'),'NO\x20ANSWER',_0x25b8('0x14'),_0x25b8('0x15'),_0x25b8('0x16'),_0x25b8('0x13'),_0x25b8('0x13'),_0x25b8('0x13')];var actions={};config[_0x25b8('0x17')]=_['defaults'](config[_0x25b8('0x17')],{'host':_0x25b8('0x18'),'port':0x18eb});var io=require(_0x25b8('0x19'))(new Redis(config['redis']));function VoiceCallReport(_0x4d070d){this[_0x25b8('0x1a')]=_0x4d070d[_0x25b8('0x1a')];this['agents']=_0x4d070d[_0x25b8('0x1b')];this[_0x25b8('0x1c')]={};ami['on'](_0x25b8('0x1d'),this[_0x25b8('0x1e')]['bind'](this));ami['on'](_0x25b8('0x1f'),this['syncNewExten'][_0x25b8('0x20')](this));ami['on'](_0x25b8('0x21'),this[_0x25b8('0x22')][_0x25b8('0x20')](this));ami['on']('newstate',this['syncNewState'][_0x25b8('0x20')](this));ami['on'](_0x25b8('0x23'),this[_0x25b8('0x24')]['bind'](this));ami['on'](_0x25b8('0x25'),this[_0x25b8('0x26')][_0x25b8('0x20')](this));ami['on'](_0x25b8('0x27'),this['syncNewCallerId'][_0x25b8('0x20')](this));ami['on']('attendedtransfer',this[_0x25b8('0x28')][_0x25b8('0x20')](this));ami['on'](_0x25b8('0x29'),this['syncBlindTransfer'][_0x25b8('0x20')](this));ami['on'](_0x25b8('0x2a'),this[_0x25b8('0x2b')][_0x25b8('0x20')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop']['bind'](this));try{logger[_0x25b8('0x2c')](_0x25b8('0x2d'));ami[_0x25b8('0x2e')]();}catch(_0x22d4bb){logger[_0x25b8('0x2f')]('[voiceCallReport][coreshowchannels]',util[_0x25b8('0x30')](_0x22d4bb,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x25b8('0x31')]=function(_0x580b49){return _0x580b49!==null&&!_['isUndefined'](_0x580b49);};VoiceCallReport[_0x25b8('0x32')][_0x25b8('0x33')]=function(_0x464f65,_0x7e6ac7,_0x4ad8d0){io['to'](_0x464f65)[_0x25b8('0x33')](_0x7e6ac7,_0x4ad8d0);};VoiceCallReport[_0x25b8('0x32')][_0x25b8('0x34')]=function(_0xde10f3){try{if(this['isNotNull'](_0xde10f3)){logger['info']('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0xde10f3['uniqueid'],_0xde10f3['calleridname'],_0xde10f3[_0x25b8('0x35')]);logger['debug'](_0x25b8('0x36'),_0xde10f3['uniqueid'],util[_0x25b8('0x30')](_0xde10f3,{'showHidden':![],'depth':null}));if(_0xde10f3[_0x25b8('0x37')]===_0xde10f3[_0x25b8('0x38')]){if(!_[_0x25b8('0x39')](this['channels'][_0xde10f3[_0x25b8('0x37')]])){_[_0x25b8('0x3a')](this['channels'][_0xde10f3[_0x25b8('0x37')]],_['pick'](_0xde10f3,_['keys'](this[_0x25b8('0x1a')][_0xde10f3[_0x25b8('0x37')]])));}}if(_0xde10f3[_0x25b8('0x3b')]==='from-sip'){if(this[_0x25b8('0x1b')][_0xde10f3[_0x25b8('0x3c')]['split']('-')[0x0]]){if(_0xde10f3[_0x25b8('0x3d')]==_0x25b8('0x3e')){this[_0x25b8('0x1b')][_0xde10f3[_0x25b8('0x3c')]['split']('-')[0x0]][_0x25b8('0x3f')]=_0xde10f3[_0x25b8('0x40')];this[_0x25b8('0x33')](util[_0x25b8('0x41')]('user:%s',this[_0x25b8('0x1b')][_0xde10f3['channel'][_0x25b8('0x42')]('-')[0x0]][_0x25b8('0x43')]),_0x25b8('0x44'),{'destaccountcode':this[_0x25b8('0x1b')][_0xde10f3[_0x25b8('0x3c')][_0x25b8('0x42')]('-')[0x0]][_0x25b8('0x45')],'destconnectedlinenum':_0xde10f3[_0x25b8('0x40')]});}}}}}catch(_0x2a7160){logger[_0x25b8('0x2f')](_0x25b8('0x46'),_0xde10f3[_0x25b8('0x37')],util[_0x25b8('0x30')](_0x2a7160,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x25b8('0x32')][_0x25b8('0x22')]=function(_0x28c5cc){try{if(this[_0x25b8('0x31')](_0x28c5cc)){logger[_0x25b8('0x47')](_0x25b8('0x48'),_0x28c5cc[_0x25b8('0x37')],util[_0x25b8('0x30')](_0x28c5cc,{'showHidden':![],'depth':null}));if(_0x28c5cc[_0x25b8('0x37')]===_0x28c5cc[_0x25b8('0x38')]&&_0x28c5cc[_0x25b8('0x3c')]!=_0x25b8('0x49')){if(_[_0x25b8('0x39')](this[_0x25b8('0x1a')][_0x28c5cc[_0x25b8('0x37')]])){logger[_0x25b8('0x2c')](_0x25b8('0x4a'),_0x28c5cc[_0x25b8('0x37')],_0x28c5cc[_0x25b8('0x3b')],_0x28c5cc[_0x25b8('0x3d')]);this['channels'][_0x28c5cc[_0x25b8('0x37')]]=new Channel();this[_0x25b8('0x1a')][_0x28c5cc['uniqueid']][_0x25b8('0x4b')]=moment()[_0x25b8('0x41')](_0x25b8('0x4c'));this[_0x25b8('0x1a')][_0x28c5cc['uniqueid']]['disposition']=dispositions[_['toNumber'](_0x28c5cc['channelstate'])];_['merge'](this['channels'][_0x28c5cc[_0x25b8('0x37')]],_[_0x25b8('0x4d')](_0x28c5cc,_[_0x25b8('0x4e')](this[_0x25b8('0x1a')][_0x28c5cc[_0x25b8('0x37')]])));if(_0x28c5cc['context']===_0x25b8('0x4f')){if(this[_0x25b8('0x1b')][_0x28c5cc[_0x25b8('0x3c')][_0x25b8('0x42')]('-')[0x0]]){if(_[_0x25b8('0x39')](this[_0x25b8('0x1b')][_0x28c5cc['channel'][_0x25b8('0x42')]('-')[0x0]][_0x25b8('0x3f')])){this['agents'][_0x28c5cc[_0x25b8('0x3c')][_0x25b8('0x42')]('-')[0x0]][_0x25b8('0x3f')]=_0x28c5cc[_0x25b8('0x3d')];logger[_0x25b8('0x47')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x28c5cc[_0x25b8('0x37')],util[_0x25b8('0x30')]({'destaccountcode':this[_0x25b8('0x1b')][_0x28c5cc[_0x25b8('0x3c')][_0x25b8('0x42')]('-')[0x0]][_0x25b8('0x45')],'destconnectedlinenum':_0x28c5cc[_0x25b8('0x3d')]},{'showHidden':![],'depth':null}));this[_0x25b8('0x33')](util[_0x25b8('0x41')](_0x25b8('0x50'),this[_0x25b8('0x1b')][_0x28c5cc[_0x25b8('0x3c')][_0x25b8('0x42')]('-')[0x0]][_0x25b8('0x43')]),_0x25b8('0x44'),{'destaccountcode':this['agents'][_0x28c5cc[_0x25b8('0x3c')][_0x25b8('0x42')]('-')[0x0]][_0x25b8('0x45')],'destconnectedlinenum':_0x28c5cc['exten']});}}}}}}}catch(_0xf7f89f){logger[_0x25b8('0x2f')](_0x25b8('0x51'),_0x28c5cc[_0x25b8('0x37')],util[_0x25b8('0x30')](_0xf7f89f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x25b8('0x32')][_0x25b8('0x1e')]=function(_0x88cbdd){try{if(this[_0x25b8('0x31')](_0x88cbdd)){logger[_0x25b8('0x47')]('[%s][voiceCallReport][newexten]\x20event:',_0x88cbdd[_0x25b8('0x37')],util[_0x25b8('0x30')](_0x88cbdd,{'showHidden':![],'depth':null}));if(_0x88cbdd[_0x25b8('0x37')]===_0x88cbdd[_0x25b8('0x38')]&&_0x88cbdd[_0x25b8('0x3d')]!='h'&&_0x88cbdd[_0x25b8('0x3c')]!=_0x25b8('0x49')){_0x88cbdd[_0x25b8('0x52')]=_0x88cbdd[_0x25b8('0x52')][_0x25b8('0x53')]();_0x88cbdd[_0x25b8('0x54')]=_0x88cbdd[_0x25b8('0x55')]&&_0x88cbdd[_0x25b8('0x55')]['startsWith'](_0x25b8('0x56'))?_0x88cbdd['appdata']:(_0x88cbdd[_0x25b8('0x55')]||_0x88cbdd['applicationdata'])[_0x25b8('0x53')]();logger['info'](_0x25b8('0x57'),_0x88cbdd[_0x25b8('0x37')],_0x88cbdd[_0x25b8('0x52')],_0x88cbdd[_0x25b8('0x54')]);if(_[_0x25b8('0x39')](this[_0x25b8('0x1a')][_0x88cbdd[_0x25b8('0x37')]])){this[_0x25b8('0x1a')][_0x88cbdd['uniqueid']]=new Channel();this[_0x25b8('0x1a')][_0x88cbdd[_0x25b8('0x37')]][_0x25b8('0x4b')]=_0x88cbdd[_0x25b8('0x58')]?moment()[_0x25b8('0x59')](moment[_0x25b8('0x58')](_0x88cbdd['duration'])[_0x25b8('0x5a')](),'seconds')[_0x25b8('0x41')](_0x25b8('0x4c')):moment()[_0x25b8('0x41')](_0x25b8('0x4c'));this[_0x25b8('0x1a')][_0x88cbdd['uniqueid']]['disposition']=_0x25b8('0x14');}_[_0x25b8('0x3a')](this[_0x25b8('0x1a')][_0x88cbdd[_0x25b8('0x37')]],_[_0x25b8('0x4d')](_0x88cbdd,_[_0x25b8('0x4e')](this[_0x25b8('0x1a')][_0x88cbdd['uniqueid']])));if(_[_0x25b8('0x5b')](applications,_0x88cbdd[_0x25b8('0x52')])){this[_0x25b8('0x1a')][_0x88cbdd[_0x25b8('0x37')]]['lastapplication']=_0x88cbdd[_0x25b8('0x52')];this[_0x25b8('0x1a')][_0x88cbdd['uniqueid']]['lastdata']=_0x88cbdd[_0x25b8('0x54')];if(_0x88cbdd[_0x25b8('0x52')]===_0x25b8('0xf')&&_[_0x25b8('0x5c')](_0x88cbdd[_0x25b8('0x54')]['toLowerCase'](),_0x25b8('0x5d'))){var _0x449ef6=_0x88cbdd['applicationdata'][_0x25b8('0x42')]('=');var _0x488251=_0x449ef6[0x0][_0x25b8('0x53')]()[_0x25b8('0x5e')](/cdr\((.*)\)/);if(_0x488251){this[_0x25b8('0x1a')][_0x88cbdd['uniqueid']][_0x488251[0x1]]=_0x449ef6[0x1];}}else if(_0x88cbdd[_0x25b8('0x52')]===_0x25b8('0x5f')){this['channels'][_0x88cbdd[_0x25b8('0x37')]]['queue']=_0x88cbdd['applicationdata']['split'](',')[0x0];}}}}}catch(_0x24eed3){logger[_0x25b8('0x2f')](_0x25b8('0x60'),_0x88cbdd['uniqueid'],util[_0x25b8('0x30')](_0x24eed3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x25b8('0x32')][_0x25b8('0x61')]=function(_0x5b58f1){try{if(this[_0x25b8('0x31')](_0x5b58f1)){logger['info']('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x5b58f1[_0x25b8('0x37')],_0x5b58f1[_0x25b8('0x38')],_0x5b58f1[_0x25b8('0x62')],_0x5b58f1['calleridnum']);logger[_0x25b8('0x47')](_0x25b8('0x63'),_0x5b58f1[_0x25b8('0x37')],util[_0x25b8('0x30')](_0x5b58f1,{'showHidden':![],'depth':null}));if(_0x5b58f1['uniqueid']!==_0x5b58f1[_0x25b8('0x38')]){if(this[_0x25b8('0x1a')][_0x5b58f1[_0x25b8('0x38')]]){if(_0x5b58f1[_0x25b8('0x64')]==='6'){if(!this[_0x25b8('0x1a')][_0x5b58f1[_0x25b8('0x38')]]['answered']){var _0x27396a=moment();this[_0x25b8('0x1a')][_0x5b58f1[_0x25b8('0x38')]][_0x25b8('0x65')]=!![];this[_0x25b8('0x1a')][_0x5b58f1['linkedid']]['answertime']=_0x27396a[_0x25b8('0x41')](_0x25b8('0x4c'));if(this[_0x25b8('0x1a')][_0x5b58f1[_0x25b8('0x38')]][_0x25b8('0x4b')]){this['channels'][_0x5b58f1['linkedid']][_0x25b8('0x66')]=_0x27396a['diff'](this[_0x25b8('0x1a')][_0x5b58f1[_0x25b8('0x38')]]['starttime'],_0x25b8('0x5a'));}}this[_0x25b8('0x1a')][_0x5b58f1[_0x25b8('0x38')]][_0x25b8('0x38')]=_0x5b58f1[_0x25b8('0x37')];if(_0x5b58f1[_0x25b8('0x35')]!==_0x25b8('0x3e')){this['channels'][_0x5b58f1[_0x25b8('0x38')]][_0x25b8('0x40')]=_0x5b58f1[_0x25b8('0x35')];}this[_0x25b8('0x1a')][_0x5b58f1['linkedid']]['connectedlinename']=_0x5b58f1[_0x25b8('0x62')];this[_0x25b8('0x1a')][_0x5b58f1[_0x25b8('0x38')]][_0x25b8('0x67')]=_0x5b58f1['channel'];this[_0x25b8('0x1a')][_0x5b58f1[_0x25b8('0x38')]][_0x25b8('0x68')]=dispositions[_['toNumber'](_0x5b58f1[_0x25b8('0x64')])];if(this[_0x25b8('0x1b')][_0x5b58f1[_0x25b8('0x3c')][_0x25b8('0x42')]('-')[0x0]]){this[_0x25b8('0x1a')][_0x5b58f1[_0x25b8('0x38')]][_0x25b8('0x69')]=this[_0x25b8('0x1b')][_0x5b58f1[_0x25b8('0x3c')]['split']('-')[0x0]]['id'];this[_0x25b8('0x1a')][_0x5b58f1['linkedid']][_0x25b8('0x6a')]=this[_0x25b8('0x1b')][_0x5b58f1['channel']['split']('-')[0x0]][_0x25b8('0x43')];}}}}else{if(this[_0x25b8('0x1a')][_0x5b58f1[_0x25b8('0x37')]]){if(_0x5b58f1['channelstate']==='6'){if(this['agents'][_0x5b58f1['channel'][_0x25b8('0x42')]('-')[0x0]]){this[_0x25b8('0x1a')][_0x5b58f1['uniqueid']]['UserId']=this[_0x25b8('0x1b')][_0x5b58f1['channel'][_0x25b8('0x42')]('-')[0x0]]['id'];this['channels'][_0x5b58f1[_0x25b8('0x37')]]['membername']=this[_0x25b8('0x1b')][_0x5b58f1['channel'][_0x25b8('0x42')]('-')[0x0]][_0x25b8('0x43')];}}}}if(_0x5b58f1[_0x25b8('0x64')]==='6'&&_0x5b58f1[_0x25b8('0x3b')]===_0x25b8('0x4f')){if(this[_0x25b8('0x1b')][_0x5b58f1[_0x25b8('0x3c')][_0x25b8('0x42')]('-')[0x0]]){this[_0x25b8('0x1b')][_0x5b58f1[_0x25b8('0x3c')]['split']('-')[0x0]]['destconnectedlinenum']=_0x5b58f1[_0x25b8('0x3d')];var _0xd05dde;if(this[_0x25b8('0x1a')][_0x5b58f1['uniqueid']])_0xd05dde=this[_0x25b8('0x1a')][_0x5b58f1[_0x25b8('0x37')]][_0x25b8('0x6b')];else if(this['channels'][_0x5b58f1[_0x25b8('0x38')]])_0xd05dde=this[_0x25b8('0x1a')][_0x5b58f1[_0x25b8('0x38')]][_0x25b8('0x6b')];logger[_0x25b8('0x47')](_0x25b8('0x6c'),_0x5b58f1['uniqueid'],util['inspect']({'destaccountcode':this['agents'][_0x5b58f1['channel'][_0x25b8('0x42')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x5b58f1[_0x25b8('0x3d')],'routealias':_0xd05dde},{'showHidden':![],'depth':null}));this[_0x25b8('0x33')](util['format'](_0x25b8('0x50'),this[_0x25b8('0x1b')][_0x5b58f1[_0x25b8('0x3c')][_0x25b8('0x42')]('-')[0x0]][_0x25b8('0x43')]),_0x25b8('0x44'),{'destaccountcode':this['agents'][_0x5b58f1['channel'][_0x25b8('0x42')]('-')[0x0]][_0x25b8('0x45')],'destconnectedlinenum':_0x5b58f1[_0x25b8('0x3d')],'routealias':_0xd05dde});}}}}catch(_0x5e38ab){logger['error'](_0x25b8('0x6d'),_0x5b58f1['uniqueid'],util[_0x25b8('0x30')](_0x5e38ab,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x25b8('0x32')]['syncMixMonitorFilename']=function(_0x2e0118,_0x438d69){try{if(this[_0x25b8('0x1a')][_0x2e0118]){logger[_0x25b8('0x2c')](_0x25b8('0x6e'),_0x2e0118,_0x438d69);this[_0x25b8('0x1a')][_0x2e0118]['monitor']=!![];if(_['endsWith'](_0x438d69,_0x25b8('0x6f'))){_0x438d69=_0x438d69[_0x25b8('0x70')](_0x25b8('0x6f'),'.WAV');}this[_0x25b8('0x1a')][_0x2e0118][_0x25b8('0x71')]=_0x438d69;var _0x55ecd9=_[_0x25b8('0x72')](this['channels'][_0x2e0118][_0x25b8('0x73')],{'filename':_0x438d69});if(_[_0x25b8('0x74')](_0x55ecd9)){this[_0x25b8('0x1a')][_0x2e0118][_0x25b8('0x73')][_0x25b8('0x75')]({'filename':_0x438d69,'createdAt':moment()[_0x25b8('0x41')](_0x25b8('0x4c')),'mixmonitorid':'','status':_0x25b8('0x76')});}}}catch(_0x3191a0){logger[_0x25b8('0x2f')]('[%s][voiceCallReport][mixMonitorFilename]',_0x2e0118,util[_0x25b8('0x30')](_0x3191a0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x25b8('0x32')]['syncVarSet']=function(_0xcaf0db){try{if(this[_0x25b8('0x31')](_0xcaf0db)){logger[_0x25b8('0x47')](_0x25b8('0x77'),_0xcaf0db[_0x25b8('0x37')],util['inspect'](_0xcaf0db,{'showHidden':![],'depth':null}));if(this[_0x25b8('0x1a')][_0xcaf0db[_0x25b8('0x37')]]&&_0xcaf0db[_0x25b8('0x3c')]!=_0x25b8('0x49')){if(this[_0x25b8('0x31')](_0xcaf0db[_0x25b8('0x78')])){if(this[_0x25b8('0x31')](_0xcaf0db[_0x25b8('0x78')]['mixmonitor_filename'])){logger[_0x25b8('0x2c')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0xcaf0db[_0x25b8('0x37')],_0xcaf0db[_0x25b8('0x79')]);this['syncMixMonitorFilename'](_0xcaf0db[_0x25b8('0x37')],_0xcaf0db[_0x25b8('0x79')]);}else if(this['isNotNull'](_0xcaf0db[_0x25b8('0x78')][_0x25b8('0x7a')])){logger[_0x25b8('0x2c')](_0x25b8('0x7b'),_0xcaf0db[_0x25b8('0x37')],_0xcaf0db[_0x25b8('0x79')]);this[_0x25b8('0x1a')][_0xcaf0db[_0x25b8('0x37')]]['calleridnum']=_0xcaf0db[_0x25b8('0x79')];}else if(this['isNotNull'](_0xcaf0db[_0x25b8('0x78')][_0x25b8('0x7c')])){logger[_0x25b8('0x2c')](_0x25b8('0x7d'),_0xcaf0db[_0x25b8('0x37')],_0xcaf0db[_0x25b8('0x79')]);this[_0x25b8('0x1a')][_0xcaf0db[_0x25b8('0x37')]][_0x25b8('0x7e')]=_0xcaf0db['value'];}else if(this['isNotNull'](_0xcaf0db['variable'][_0x25b8('0x7f')])){logger[_0x25b8('0x2c')](_0x25b8('0x80'),_0xcaf0db[_0x25b8('0x37')],_0xcaf0db['value']);this[_0x25b8('0x1a')][_0xcaf0db[_0x25b8('0x37')]][_0x25b8('0x81')]=_0xcaf0db[_0x25b8('0x79')];}else if(this[_0x25b8('0x31')](_0xcaf0db['variable'][_0x25b8('0x82')])){logger[_0x25b8('0x2c')](_0x25b8('0x83'),_0xcaf0db[_0x25b8('0x37')],_0xcaf0db[_0x25b8('0x79')]['split'](',')[0x0]);this['channels'][_0xcaf0db[_0x25b8('0x37')]]['queue']=_0xcaf0db['value'][_0x25b8('0x42')](',')[0x0];}else if(this[_0x25b8('0x31')](_0xcaf0db['variable'][_0x25b8('0x84')])){logger[_0x25b8('0x2c')](_0x25b8('0x85'),_0xcaf0db[_0x25b8('0x37')],_0xcaf0db[_0x25b8('0x79')]);this[_0x25b8('0x1a')][_0xcaf0db[_0x25b8('0x37')]][_0x25b8('0x86')]=_0xcaf0db[_0x25b8('0x79')];}else if(this[_0x25b8('0x31')](_0xcaf0db[_0x25b8('0x78')][_0x25b8('0x87')])){logger[_0x25b8('0x2c')](_0x25b8('0x88'),_0xcaf0db[_0x25b8('0x37')],_0xcaf0db[_0x25b8('0x79')]);this[_0x25b8('0x1a')][_0xcaf0db[_0x25b8('0x37')]][_0x25b8('0x89')]=_0xcaf0db[_0x25b8('0x79')];}else if(this[_0x25b8('0x31')](_0xcaf0db['variable'][_0x25b8('0x8a')])){logger[_0x25b8('0x2c')](_0x25b8('0x8b'),_0xcaf0db[_0x25b8('0x37')],_0xcaf0db['value']);this[_0x25b8('0x1a')][_0xcaf0db['uniqueid']]['calleridpreview']=_0xcaf0db[_0x25b8('0x79')];}else if(this[_0x25b8('0x31')](_0xcaf0db[_0x25b8('0x78')][_0x25b8('0x8c')])){logger[_0x25b8('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0xcaf0db[_0x25b8('0x37')],_0xcaf0db[_0x25b8('0x79')]);this[_0x25b8('0x1a')][_0xcaf0db[_0x25b8('0x37')]][_0x25b8('0x5f')]=_0xcaf0db['value'];}else if(this[_0x25b8('0x31')](_0xcaf0db[_0x25b8('0x78')][_0x25b8('0x8d')])){logger[_0x25b8('0x2c')](_0x25b8('0x8e'),_0xcaf0db['uniqueid'],_0xcaf0db[_0x25b8('0x79')]);this[_0x25b8('0x1a')][_0xcaf0db[_0x25b8('0x37')]][_0x25b8('0x8f')]=_0xcaf0db[_0x25b8('0x79')];}}}else if(this[_0x25b8('0x31')](_0xcaf0db[_0x25b8('0x78')][_0x25b8('0x90')])){if(_0xcaf0db[_0x25b8('0x79')]){var _0x8adcf0=path[_0x25b8('0x91')](_0xcaf0db['value'])['name'];logger[_0x25b8('0x2c')](_0x25b8('0x92'),_0x8adcf0,_0xcaf0db[_0x25b8('0x79')]);this[_0x25b8('0x93')](_0x8adcf0,_0xcaf0db['value']);}}else if(this[_0x25b8('0x1a')][_0xcaf0db['linkedid']]){if(this[_0x25b8('0x31')](_0xcaf0db['variable'])){if(this[_0x25b8('0x31')](_0xcaf0db[_0x25b8('0x78')][_0x25b8('0x8d')])){logger['info'](_0x25b8('0x8e'),_0xcaf0db['linkedid'],_0xcaf0db[_0x25b8('0x79')]);this['channels'][_0xcaf0db['linkedid']][_0x25b8('0x94')]=_0xcaf0db[_0x25b8('0x79')];}}}}}catch(_0x1a3eaa){logger[_0x25b8('0x2f')](_0x25b8('0x95'),_0xcaf0db[_0x25b8('0x37')],util[_0x25b8('0x30')](_0x1a3eaa,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x25b8('0x26')]=function(_0x3ca0cf){try{if(this[_0x25b8('0x31')](_0x3ca0cf)){logger['debug'](_0x25b8('0x96'),_0x3ca0cf[_0x25b8('0x37')],util['inspect'](_0x3ca0cf,{'showHidden':![],'depth':null}));if(this[_0x25b8('0x1a')][_0x3ca0cf['uniqueid']]){logger[_0x25b8('0x2c')](_0x25b8('0x97'),_0x3ca0cf[_0x25b8('0x37')],_0x3ca0cf['cause-txt']);var _0x460443=moment();this[_0x25b8('0x1a')][_0x3ca0cf[_0x25b8('0x37')]][_0x25b8('0x98')]=_0x460443[_0x25b8('0x41')](_0x25b8('0x4c'));this[_0x25b8('0x1a')][_0x3ca0cf[_0x25b8('0x37')]][_0x25b8('0x58')]=_0x460443['diff'](this[_0x25b8('0x1a')][_0x3ca0cf[_0x25b8('0x37')]][_0x25b8('0x4b')],'seconds');if(this[_0x25b8('0x1a')][_0x3ca0cf[_0x25b8('0x37')]][_0x25b8('0x65')]){this[_0x25b8('0x1a')][_0x3ca0cf[_0x25b8('0x37')]][_0x25b8('0x99')]=_0x460443[_0x25b8('0x9a')](this[_0x25b8('0x1a')][_0x3ca0cf['uniqueid']][_0x25b8('0x9b')],_0x25b8('0x5a'));this['channels'][_0x3ca0cf[_0x25b8('0x37')]]['holdtime']=this[_0x25b8('0x1a')][_0x3ca0cf[_0x25b8('0x37')]][_0x25b8('0x58')]-this[_0x25b8('0x1a')][_0x3ca0cf[_0x25b8('0x37')]][_0x25b8('0x99')];}if(_0x3ca0cf['context']===_0x25b8('0x4f')){if(this[_0x25b8('0x1b')][_0x3ca0cf[_0x25b8('0x3c')][_0x25b8('0x42')]('-')[0x0]]){this[_0x25b8('0x1b')][_0x3ca0cf[_0x25b8('0x3c')][_0x25b8('0x42')]('-')[0x0]]=_['omit'](this[_0x25b8('0x1b')][_0x3ca0cf['channel']['split']('-')[0x0]],[_0x25b8('0x3f')]);logger[_0x25b8('0x47')](_0x25b8('0x9c'),_0x3ca0cf[_0x25b8('0x37')],util[_0x25b8('0x30')]({'id':this[_0x25b8('0x1b')][_0x3ca0cf[_0x25b8('0x3c')][_0x25b8('0x42')]('-')[0x0]]['id'],'destaccountcode':this[_0x25b8('0x1b')][_0x3ca0cf[_0x25b8('0x3c')][_0x25b8('0x42')]('-')[0x0]][_0x25b8('0x45')]},{'showHidden':![],'depth':null}));this[_0x25b8('0x33')](util[_0x25b8('0x41')](_0x25b8('0x50'),this[_0x25b8('0x1b')][_0x3ca0cf['channel'][_0x25b8('0x42')]('-')[0x0]][_0x25b8('0x43')]),'user:agentcomplete',{'id':this[_0x25b8('0x1b')][_0x3ca0cf[_0x25b8('0x3c')][_0x25b8('0x42')]('-')[0x0]]['id'],'destaccountcode':this[_0x25b8('0x1b')][_0x3ca0cf[_0x25b8('0x3c')][_0x25b8('0x42')]('-')[0x0]][_0x25b8('0x45')]});}}var _0x4eb642=this;Promise[_0x25b8('0x9d')]()[_0x25b8('0x9e')](function(){var _0x16d46d=_0x4eb642['channels'][_0x3ca0cf[_0x25b8('0x37')]];if(typeof _0x16d46d[_0x25b8('0x9f')]===_0x25b8('0xa0'))return;if(_[_0x25b8('0xa1')](_0x16d46d['monitors']))return;return RpcSetting[_0x25b8('0xa2')]()[_0x25b8('0x9e')](function(_0x37574e){if(!_0x37574e[_0x25b8('0xa3')])return;return Promise[_0x25b8('0x9d')]()[_0x25b8('0x9e')](function(){return ami['Action']({'action':_0x25b8('0xa4'),'channel':_0x16d46d['channel']})[_0x25b8('0xa5')](function(){});})['then'](function(){return ami[_0x25b8('0xa6')]({'action':_0x25b8('0xa4'),'channel':_0x16d46d[_0x25b8('0x67')]})['catch'](function(){})[_0x25b8('0xa7')](function(){var _0x1a2e8d=_0x4eb642[_0x25b8('0x1b')][_0x16d46d['destinationchannel'][_0x25b8('0x42')]('-')[0x0]];if(!_0x1a2e8d)return;io['emit'](_0x25b8('0xa8'),{'agentId':_0x1a2e8d['id'],'uniqueid':_0x16d46d[_0x25b8('0x37')]});});});});})['then'](function(){if(_0x3ca0cf['event']==='BlindTransfer'){_0x4eb642[_0x25b8('0x1c')][_0x3ca0cf[_0x25b8('0x37')]]=_0x4eb642['channels'][_0x3ca0cf[_0x25b8('0x37')]];}else{if(_0x4eb642['channels'][_0x3ca0cf[_0x25b8('0x37')]][_0x25b8('0x81')]==='outbound'&&_0x4eb642[_0x25b8('0x1c')][_0x3ca0cf[_0x25b8('0x37')]]){_0x4eb642[_0x25b8('0x1a')][_0x3ca0cf[_0x25b8('0x37')]][_0x25b8('0x37')]=[_0x4eb642[_0x25b8('0x1a')][_0x3ca0cf[_0x25b8('0x37')]]['linkedid'],_0x4eb642[_0x25b8('0x1a')][_0x3ca0cf['uniqueid']][_0x25b8('0x38')]=_0x4eb642[_0x25b8('0x1a')][_0x3ca0cf['uniqueid']][_0x25b8('0x37')]][0x0];delete _0x4eb642[_0x25b8('0x1c')][_0x3ca0cf['uniqueid']];}}logger[_0x25b8('0x47')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x3ca0cf[_0x25b8('0x37')],util[_0x25b8('0x30')](_0x4eb642[_0x25b8('0x1a')][_0x3ca0cf[_0x25b8('0x37')]],{'showHidden':![],'depth':null}));ami[_0x25b8('0x33')](_0x25b8('0xa9'),_0x4eb642[_0x25b8('0x1a')][_0x3ca0cf[_0x25b8('0x37')]]);delete _0x4eb642[_0x25b8('0x1a')][_0x3ca0cf[_0x25b8('0x37')]];});}}}catch(_0x1a53ec){logger['error'](_0x25b8('0xaa'),_0x3ca0cf[_0x25b8('0x37')],util[_0x25b8('0x30')](_0x1a53ec,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x25b8('0x28')]=function(_0x2a477a){try{if(this[_0x25b8('0x31')](_0x2a477a)){logger[_0x25b8('0x2c')](_0x25b8('0xab'),_0x2a477a[_0x25b8('0x37')],_0x2a477a[_0x25b8('0xac')],_0x2a477a[_0x25b8('0xad')]);logger[_0x25b8('0x47')](_0x25b8('0xae'),_0x2a477a[_0x25b8('0x37')],util[_0x25b8('0x30')](_0x2a477a,{'showHidden':![],'depth':null}));if(this[_0x25b8('0x1a')][_0x2a477a[_0x25b8('0xaf')]]){this[_0x25b8('0x1a')][_0x2a477a[_0x25b8('0xaf')]][_0x25b8('0xb0')]=_0x2a477a[_0x25b8('0xac')];this['channels'][_0x2a477a['transfereeuniqueid']]['transferconnectedlinenum']=_0x2a477a[_0x25b8('0xad')];if(this[_0x25b8('0x1a')][_0x2a477a[_0x25b8('0xb1')]]){var _0x50b93f=this[_0x25b8('0x1a')][_0x2a477a[_0x25b8('0xb1')]];this['channels'][_0x2a477a['secondtransfereruniqueid']]=this[_0x25b8('0x1a')][_0x2a477a[_0x25b8('0xaf')]];this['channels'][_0x2a477a[_0x25b8('0xaf')]]=_0x50b93f;}}else if(this[_0x25b8('0x1a')][_0x2a477a[_0x25b8('0xb2')]]){this['channels'][_0x2a477a[_0x25b8('0xb2')]][_0x25b8('0xb0')]=_0x2a477a[_0x25b8('0xac')];this['channels'][_0x2a477a[_0x25b8('0xb2')]][_0x25b8('0xb3')]=_0x2a477a[_0x25b8('0xad')];if(this[_0x25b8('0x1a')][_0x2a477a[_0x25b8('0xb4')]]){var _0x50b93f=this['channels'][_0x2a477a['origtransfereruniqueid']];this[_0x25b8('0x1a')][_0x2a477a[_0x25b8('0xb4')]]=this[_0x25b8('0x1a')][_0x2a477a[_0x25b8('0xb2')]];this[_0x25b8('0x1a')][_0x2a477a[_0x25b8('0xb2')]]=_0x50b93f;}}if((this[_0x25b8('0x1a')][_0x2a477a[_0x25b8('0xb4')]]||this[_0x25b8('0x1a')][_0x2a477a[_0x25b8('0xb5')]])&&this[_0x25b8('0x1a')][_0x2a477a[_0x25b8('0xb1')]]){var _0x4e627f=_[_0x25b8('0xb6')]([this['channels'][_0x2a477a[_0x25b8('0xb4')]],this[_0x25b8('0x1a')][_0x2a477a[_0x25b8('0xb5')]],this['channels'][_0x2a477a[_0x25b8('0xb1')]]],function(_0x1599c0){return _0x1599c0&&_0x1599c0[_0x25b8('0x81')]===_0x25b8('0xb7')&&_0x1599c0['routeid'];});if(_0x4e627f){if(this['channels'][_0x2a477a[_0x25b8('0xb4')]])this[_0x25b8('0x1a')][_0x2a477a['origtransfereruniqueid']][_0x25b8('0x9f')]=_0x25b8('0xb8');if(this[_0x25b8('0x1a')][_0x2a477a[_0x25b8('0xb5')]])this[_0x25b8('0x1a')][_0x2a477a[_0x25b8('0xb5')]][_0x25b8('0x9f')]=_0x25b8('0xb8');this[_0x25b8('0x1a')][_0x2a477a[_0x25b8('0xb1')]][_0x25b8('0x9f')]=_0x25b8('0xb8');}}}}catch(_0x106da3){logger[_0x25b8('0x2f')]('[%s][voiceCallReport][attendedtransfer]',_0x2a477a[_0x25b8('0x37')],util[_0x25b8('0x30')](_0x106da3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x25b8('0x32')][_0x25b8('0xb9')]=function(_0x3f25e2){try{if(this[_0x25b8('0x31')](_0x3f25e2)){logger['info'](_0x25b8('0xba'),_0x3f25e2[_0x25b8('0x37')],_0x3f25e2[_0x25b8('0xbb')],_0x3f25e2[_0x25b8('0xbc')]);logger[_0x25b8('0x47')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x3f25e2[_0x25b8('0x37')],util[_0x25b8('0x30')](_0x3f25e2,{'showHidden':![],'depth':null}));if(this[_0x25b8('0x1a')][_0x3f25e2['transfereeuniqueid']]){this[_0x25b8('0x1a')][_0x3f25e2[_0x25b8('0xaf')]][_0x25b8('0xb0')]=_0x3f25e2[_0x25b8('0xbb')];this[_0x25b8('0x1a')][_0x3f25e2[_0x25b8('0xaf')]][_0x25b8('0xb3')]=_0x3f25e2[_0x25b8('0xbc')];this[_0x25b8('0x1a')][_0x3f25e2['transfereeuniqueid']]['transferType']=_0x25b8('0xbd');this[_0x25b8('0x26')]({'event':_0x25b8('0xbe'),'uniqueid':_0x3f25e2['transfereeuniqueid'],'context':_0x3f25e2[_0x25b8('0x3b')],'channel':_0x3f25e2[_0x25b8('0xbf')]});}else{this[_0x25b8('0x1a')][_0x3f25e2['transfereruniqueid']][_0x25b8('0x9f')]=_0x25b8('0xbd');}}}catch(_0x5b9240){logger[_0x25b8('0x2f')]('[%s][voiceCallReport][blindtransfer]',_0x3f25e2['uniqueid'],util['inspect'](_0x5b9240,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x25b8('0x32')][_0x25b8('0x2b')]=function(_0x28406d){try{if(this[_0x25b8('0x31')](_0x28406d)){logger[_0x25b8('0x47')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x28406d[_0x25b8('0x37')],util['inspect'](_0x28406d,{'showHidden':![],'depth':null}));if(this[_0x25b8('0x1a')][_0x28406d[_0x25b8('0x37')]]){if(!_[_0x25b8('0x74')](this[_0x25b8('0x1a')][_0x28406d[_0x25b8('0x37')]][_0x25b8('0x9b')])){this[_0x25b8('0x1a')][_0x28406d[_0x25b8('0x37')]][_0x25b8('0xc0')]=moment()[_0x25b8('0x41')](_0x25b8('0x4c'));logger['info']('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0x28406d['uniqueid'],this['channels'][_0x28406d[_0x25b8('0x37')]][_0x25b8('0xc0')]);}}}}catch(_0x5768a1){logger['error'](_0x25b8('0xc1'),_0x28406d[_0x25b8('0x37')],util['inspect'](_0x5768a1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x25b8('0x32')][_0x25b8('0xc2')]=function(_0x32923d){try{if(this[_0x25b8('0x31')](_0x32923d)){logger[_0x25b8('0x47')](_0x25b8('0xc3'),_0x32923d[_0x25b8('0x37')],util[_0x25b8('0x30')](_0x32923d,{'showHidden':![],'depth':null}));if(this[_0x25b8('0x1a')][_0x32923d[_0x25b8('0x37')]]){if(!_[_0x25b8('0x74')](this['channels'][_0x32923d[_0x25b8('0x37')]][_0x25b8('0xc0')])){this[_0x25b8('0x1a')][_0x32923d[_0x25b8('0x37')]]['mohtime']+=moment()[_0x25b8('0xc4')](0x0)[_0x25b8('0x9a')](this[_0x25b8('0x1a')][_0x32923d['uniqueid']][_0x25b8('0xc0')],_0x25b8('0x5a'));logger['info'](_0x25b8('0xc5'),_0x32923d[_0x25b8('0x37')],this[_0x25b8('0x1a')][_0x32923d['uniqueid']]['mohtime']);delete this[_0x25b8('0x1a')][_0x32923d['uniqueid']][_0x25b8('0xc0')];}}}}catch(_0x31389c){logger[_0x25b8('0x2f')](_0x25b8('0xc6'),_0x32923d[_0x25b8('0x37')],util[_0x25b8('0x30')](_0x31389c,{'showHidden':![],'depth':null}));}};module[_0x25b8('0xc7')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index cda4b88..8d597b7 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 _0x7d9b=['[%s][voiceDialReport][newexten]\x20event:','application','set','applicationdata','appdata','toLowerCase','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','match','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','newexten','syncNewExten','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','[%s][voiceDialReport][dialbegin]\x20event:','inspect','channels','uniqueid','called','channel','substring','lastIndexOf','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','merge','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','lastevent','connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','outboundrouteid','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','complete','answered','starttime','seconds','billableseconds','diff','sumHoldTime','holdtime','sumBillable','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','linkedid'];(function(_0x1a47f5,_0x5252b9){var _0x33e8ae=function(_0x2e0baf){while(--_0x2e0baf){_0x1a47f5['push'](_0x1a47f5['shift']());}};_0x33e8ae(++_0x5252b9);}(_0x7d9b,0x1de));var _0xb7d9=function(_0x58a50e,_0x12a952){_0x58a50e=_0x58a50e-0x0;var _0x3b1e57=_0x7d9b[_0x58a50e];return _0x3b1e57;};'use strict';var _=require(_0xb7d9('0x0'));var moment=require('moment');var util=require(_0xb7d9('0x1'));var Redis=require(_0xb7d9('0x2'));var config=require(_0xb7d9('0x3'));var logger=require(_0xb7d9('0x4'))(_0xb7d9('0x5'));var ami=require(_0xb7d9('0x6'));config[_0xb7d9('0x7')]=_[_0xb7d9('0x8')](config[_0xb7d9('0x7')],{'host':_0xb7d9('0x9'),'port':0x18eb});var io=require(_0xb7d9('0xa'))(new Redis(config['redis']));function VoiceDialReport(_0x30cab4){this['channels']=_0x30cab4[_0xb7d9('0xb')];this['outbound']=_0x30cab4[_0xb7d9('0xc')];this[_0xb7d9('0xd')]={};this[_0xb7d9('0xe')]={};ami['on'](_0xb7d9('0xf'),this[_0xb7d9('0x10')][_0xb7d9('0x11')](this));ami['on'](_0xb7d9('0x12'),this[_0xb7d9('0x13')]['bind'](this));ami['on'](_0xb7d9('0x14'),this[_0xb7d9('0x15')][_0xb7d9('0x11')](this));ami['on'](_0xb7d9('0x16'),this[_0xb7d9('0x17')]['bind'](this));ami['on'](_0xb7d9('0x18'),this[_0xb7d9('0x19')][_0xb7d9('0x11')](this));}VoiceDialReport[_0xb7d9('0x1a')][_0xb7d9('0x1b')]=function(_0x435ab8){return _0x435ab8!==null&&!_[_0xb7d9('0x1c')](_0x435ab8);};VoiceDialReport['prototype'][_0xb7d9('0x1d')]=function(_0x5f2355,_0x250481,_0x43582c){io['to'](_0x5f2355)[_0xb7d9('0x1d')](_0x250481,_0x43582c);};VoiceDialReport['prototype'][_0xb7d9('0x10')]=function(_0x4bac62){try{if(this[_0xb7d9('0x1b')](_0x4bac62)){logger['debug'](_0xb7d9('0x1e'),_0x4bac62['uniqueid'],util[_0xb7d9('0x1f')](_0x4bac62,{'showHidden':![],'depth':null}));if(this[_0xb7d9('0x20')][_0x4bac62['uniqueid']]){_['merge'](this['channels'][_0x4bac62[_0xb7d9('0x21')]],{'starttime':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xb7d9('0x22'),'interface':_0x4bac62[_0xb7d9('0x23')][_0xb7d9('0x24')](0x0,_0x4bac62[_0xb7d9('0x23')][_0xb7d9('0x25')]('-')),'membername':_0x4bac62['channel'][_0xb7d9('0x24')](_0x4bac62[_0xb7d9('0x23')]['lastIndexOf']('/')+0x1,_0x4bac62[_0xb7d9('0x23')][_0xb7d9('0x25')]('-'))},_['omit'](_0x4bac62,[_0xb7d9('0x26'),_0xb7d9('0x27')]));logger[_0xb7d9('0x28')](_0xb7d9('0x29'),_0x4bac62[_0xb7d9('0x21')],this[_0xb7d9('0x20')][_0x4bac62[_0xb7d9('0x21')]]['membername'],this[_0xb7d9('0x20')][_0x4bac62[_0xb7d9('0x21')]][_0xb7d9('0x2a')]);logger[_0xb7d9('0x2b')](_0xb7d9('0x2c'),_0x4bac62['uniqueid'],util['inspect'](this[_0xb7d9('0x20')][_0x4bac62[_0xb7d9('0x21')]],{'showHidden':![],'depth':null}));if(this[_0xb7d9('0xd')][_0x4bac62[_0xb7d9('0x21')]])_[_0xb7d9('0x2d')](this[_0xb7d9('0x20')][_0x4bac62[_0xb7d9('0x21')]],this[_0xb7d9('0xd')][_0x4bac62[_0xb7d9('0x21')]]);this[_0xb7d9('0x1d')](_0xb7d9('0x2e'),_0xb7d9('0x2f'),this[_0xb7d9('0x20')][_0x4bac62[_0xb7d9('0x21')]]);logger[_0xb7d9('0x2b')](_0xb7d9('0x30'),_0x4bac62[_0xb7d9('0x21')],util['inspect'](this[_0xb7d9('0x20')][_0x4bac62[_0xb7d9('0x21')]],{'showHidden':![],'depth':null}));ami['emit'](_0xb7d9('0x31'),this[_0xb7d9('0x20')][_0x4bac62[_0xb7d9('0x21')]]);}}}catch(_0x3cc7d1){logger[_0xb7d9('0x32')]('[%s][voiceDialReport][dialbegin]',_0x4bac62['uniqueid'],util[_0xb7d9('0x1f')](_0x3cc7d1,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb7d9('0x1a')][_0xb7d9('0x13')]=function(_0x341239){try{if(this[_0xb7d9('0x1b')](_0x341239)){logger[_0xb7d9('0x2b')](_0xb7d9('0x33'),_0x341239[_0xb7d9('0x21')],util[_0xb7d9('0x1f')](_0x341239,{'showHidden':![],'depth':null}));if(this[_0xb7d9('0x20')][_0x341239['uniqueid']]){this[_0xb7d9('0x20')][_0x341239['uniqueid']][_0xb7d9('0x34')]=_0x341239[_0xb7d9('0x34')];if(_0x341239[_0xb7d9('0x34')]===_0xb7d9('0x35')){this[_0xb7d9('0x20')][_0x341239[_0xb7d9('0x21')]][_0xb7d9('0x36')]=_0x341239[_0xb7d9('0x36')];this[_0xb7d9('0x20')][_0x341239[_0xb7d9('0x21')]][_0xb7d9('0x37')]=_0x341239[_0xb7d9('0x37')];this[_0xb7d9('0x20')][_0x341239[_0xb7d9('0x21')]][_0xb7d9('0x38')]=moment()[_0xb7d9('0x39')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb7d9('0x20')][_0x341239[_0xb7d9('0x21')]][_0xb7d9('0x3a')]=_0xb7d9('0x3b');logger['info']('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x341239[_0xb7d9('0x21')],_0x341239[_0xb7d9('0x23')]['substring'](_0x341239[_0xb7d9('0x23')][_0xb7d9('0x25')]('/')+0x1,_0x341239[_0xb7d9('0x23')][_0xb7d9('0x25')]('-')));logger[_0xb7d9('0x2b')](_0xb7d9('0x3c'),_0x341239['uniqueid'],util[_0xb7d9('0x1f')](this[_0xb7d9('0x20')][_0x341239[_0xb7d9('0x21')]],{'showHidden':![],'depth':null}));ami[_0xb7d9('0x1d')]('custom:dialconnect',this[_0xb7d9('0x20')][_0x341239[_0xb7d9('0x21')]]);}logger[_0xb7d9('0x2b')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x341239[_0xb7d9('0x21')],util['inspect'](this[_0xb7d9('0x20')][_0x341239['uniqueid']],{'showHidden':![],'depth':null}));this[_0xb7d9('0x1d')]('voice:outbound',_0xb7d9('0x2f'),this[_0xb7d9('0x20')][_0x341239[_0xb7d9('0x21')]]);}}}catch(_0x4873bb){logger['error']('[%s][voiceDialReport][dialend]',_0x341239[_0xb7d9('0x21')],util[_0xb7d9('0x1f')](_0x4873bb,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb7d9('0x1a')][_0xb7d9('0x15')]=function(_0x297c3e){try{if(this[_0xb7d9('0x1b')](_0x297c3e)){logger[_0xb7d9('0x2b')](_0xb7d9('0x3d'),_0x297c3e[_0xb7d9('0x21')],util[_0xb7d9('0x1f')](_0x297c3e,{'showHidden':![],'depth':null}));this[_0xb7d9('0x3e')](_0x297c3e[_0xb7d9('0x21')],_[_0xb7d9('0x3f')](_0x297c3e[_0xb7d9('0x40')])[0x0],_0x297c3e['value']);if(this[_0xb7d9('0x1b')](_0x297c3e[_0xb7d9('0x40')])&&this['isNotNull'](_0x297c3e[_0xb7d9('0x40')][_0xb7d9('0x41')])){if(_['isUndefined'](this['channels'][_0x297c3e[_0xb7d9('0x21')]])){this[_0xb7d9('0x20')][_0x297c3e['uniqueid']]={'routeId':_0x297c3e[_0xb7d9('0x42')],'variables':this[_0xb7d9('0xe')][_0x297c3e[_0xb7d9('0x21')]]};logger['info'](_0xb7d9('0x43'),_0x297c3e['uniqueid'],_0x297c3e['variable'][_0xb7d9('0x41')],_[_0xb7d9('0x3f')](_0x297c3e[_0xb7d9('0x40')])[0x0],_0x297c3e['value']);logger[_0xb7d9('0x2b')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x297c3e[_0xb7d9('0x21')],util[_0xb7d9('0x1f')](this[_0xb7d9('0x20')][_0x297c3e['uniqueid']],{'showHidden':![],'depth':null}));this[_0xb7d9('0x1d')]('voice:outbound',_0xb7d9('0x2f'),this['channels'][_0x297c3e[_0xb7d9('0x21')]]);}}}}catch(_0x2b5c6f){logger[_0xb7d9('0x32')](_0xb7d9('0x44'),_0x297c3e[_0xb7d9('0x21')],util[_0xb7d9('0x1f')](_0x2b5c6f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb7d9('0x1a')][_0xb7d9('0x3e')]=function(_0x3049d3,_0x8d29e0,_0x470a1c){var _0x2756a0=['rtpaudioqos',_0xb7d9('0x45'),'rtpaudioqosjitter',_0xb7d9('0x46'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0xb7d9('0x47'),_0xb7d9('0x48'),_0xb7d9('0x49'),_0xb7d9('0x4a'),_0xb7d9('0x4b'),_0xb7d9('0x4c'),'membercalls',_0xb7d9('0x4d'),_0xb7d9('0x4e'),_0xb7d9('0x4f'),_0xb7d9('0x50'),_0xb7d9('0x51'),_0xb7d9('0x52')];if(!_[_0xb7d9('0x53')](_0x8d29e0)&&!_['includes'](_0x2756a0,_0x8d29e0)){if(_[_0xb7d9('0x1c')](this['variables'][_0x3049d3])){this[_0xb7d9('0xe')][_0x3049d3]={};}this[_0xb7d9('0xe')][_0x3049d3][_0x8d29e0]=_0x470a1c;}};VoiceDialReport[_0xb7d9('0x1a')]['syncHangup']=function(_0x1e2516){try{if(this[_0xb7d9('0x1b')](_0x1e2516)){logger[_0xb7d9('0x2b')](_0xb7d9('0x54'),_0x1e2516[_0xb7d9('0x21')],util[_0xb7d9('0x1f')](_0x1e2516,{'showHidden':![],'depth':null}));if(this['channels'][_0x1e2516['uniqueid']]){logger[_0xb7d9('0x28')](_0xb7d9('0x55'),_0x1e2516[_0xb7d9('0x21')],_0x1e2516[_0xb7d9('0x56')]);this[_0xb7d9('0x20')][_0x1e2516[_0xb7d9('0x21')]][_0xb7d9('0x57')]=moment()[_0xb7d9('0x39')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb7d9('0x20')][_0x1e2516['uniqueid']][_0xb7d9('0x58')]=moment(this['channels'][_0x1e2516[_0xb7d9('0x21')]][_0xb7d9('0x57')])['diff'](this['channels'][_0x1e2516[_0xb7d9('0x21')]]['starttime'],'seconds');this['channels'][_0x1e2516[_0xb7d9('0x21')]]['lastevent']=_0xb7d9('0x59');this[_0xb7d9('0xc')]['total']+=0x1;if(this[_0xb7d9('0x20')][_0x1e2516[_0xb7d9('0x21')]]['answertime']){this[_0xb7d9('0xc')][_0xb7d9('0x5a')]+=0x1;this['channels'][_0x1e2516[_0xb7d9('0x21')]]['holdtime']=moment(this[_0xb7d9('0x20')][_0x1e2516[_0xb7d9('0x21')]][_0xb7d9('0x38')])['diff'](this[_0xb7d9('0x20')][_0x1e2516[_0xb7d9('0x21')]][_0xb7d9('0x5b')],_0xb7d9('0x5c'));this[_0xb7d9('0x20')][_0x1e2516[_0xb7d9('0x21')]][_0xb7d9('0x5d')]=moment(this[_0xb7d9('0x20')][_0x1e2516[_0xb7d9('0x21')]][_0xb7d9('0x57')])[_0xb7d9('0x5e')](this[_0xb7d9('0x20')][_0x1e2516[_0xb7d9('0x21')]][_0xb7d9('0x38')],_0xb7d9('0x5c'));this['outbound'][_0xb7d9('0x5f')]+=this[_0xb7d9('0x20')][_0x1e2516[_0xb7d9('0x21')]][_0xb7d9('0x60')]||0x0;this['outbound'][_0xb7d9('0x61')]+=this[_0xb7d9('0x20')][_0x1e2516['uniqueid']][_0xb7d9('0x5d')];}this[_0xb7d9('0xc')]['sumDuration']+=this[_0xb7d9('0x20')][_0x1e2516[_0xb7d9('0x21')]]['duration'];logger['debug'](_0xb7d9('0x62'),_0x1e2516[_0xb7d9('0x21')],util['inspect'](this['channels'][_0x1e2516[_0xb7d9('0x21')]],{'showHidden':![],'depth':null}));ami[_0xb7d9('0x1d')](_0xb7d9('0x63'),this[_0xb7d9('0x20')][_0x1e2516['uniqueid']]);logger['debug'](_0xb7d9('0x64'),_0x1e2516['uniqueid'],util[_0xb7d9('0x1f')](this[_0xb7d9('0x20')][_0x1e2516[_0xb7d9('0x21')]],{'showHidden':![],'depth':null}));ami[_0xb7d9('0x1d')](_0xb7d9('0x65'),this[_0xb7d9('0x20')][_0x1e2516[_0xb7d9('0x21')]]);logger[_0xb7d9('0x2b')](_0xb7d9('0x66'),_0x1e2516[_0xb7d9('0x21')],util[_0xb7d9('0x1f')](this[_0xb7d9('0x20')][_0x1e2516[_0xb7d9('0x21')]],{'showHidden':![],'depth':null}));this[_0xb7d9('0x1d')](_0xb7d9('0x2e'),_0xb7d9('0x67'),this[_0xb7d9('0xc')]);logger['info']('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0xb7d9('0x68')](this[_0xb7d9('0x20')][_0x1e2516[_0xb7d9('0x21')]]));logger[_0xb7d9('0x2b')](_0xb7d9('0x69'),_0x1e2516[_0xb7d9('0x21')],util[_0xb7d9('0x1f')](this[_0xb7d9('0x20')][_0x1e2516[_0xb7d9('0x21')]],{'showHidden':![],'depth':null}));this[_0xb7d9('0x1d')](_0xb7d9('0x2e'),'voice_outbound_channel:remove',this[_0xb7d9('0x20')][_0x1e2516[_0xb7d9('0x21')]]);delete this['channels'][_0x1e2516['uniqueid']];}else if(this[_0xb7d9('0x20')][_0x1e2516[_0xb7d9('0x6a')]]){this[_0xb7d9('0x20')][_0x1e2516['linkedid']][_0xb7d9('0x21')]=this['channels'][_0x1e2516[_0xb7d9('0x6a')]]['destuniqueid'];}if(this['variables'][_0x1e2516[_0xb7d9('0x21')]]){delete this[_0xb7d9('0xe')][_0x1e2516['uniqueid']];}}}catch(_0xca151d){logger[_0xb7d9('0x32')]('[%s][voiceDialReport][hangup]',_0x1e2516['uniqueid'],util[_0xb7d9('0x1f')](_0xca151d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb7d9('0x1a')][_0xb7d9('0x17')]=function(_0x2dae36){try{if(this[_0xb7d9('0x1b')](_0x2dae36)){logger[_0xb7d9('0x2b')](_0xb7d9('0x6b'),_0x2dae36[_0xb7d9('0x21')],util['inspect'](_0x2dae36,{'showHidden':![],'depth':null}));if(_0x2dae36[_0xb7d9('0x6c')]['toLowerCase']()===_0xb7d9('0x6d')){_0x2dae36[_0xb7d9('0x6e')]=(_0x2dae36[_0xb7d9('0x6f')]||_0x2dae36[_0xb7d9('0x6e')])[_0xb7d9('0x70')]();if(_[_0xb7d9('0x71')](_0x2dae36[_0xb7d9('0x6e')],_0xb7d9('0x72'))){if(_[_0xb7d9('0x1c')](this[_0xb7d9('0xd')][_0x2dae36[_0xb7d9('0x21')]]))this[_0xb7d9('0xd')][_0x2dae36['uniqueid']]={};logger[_0xb7d9('0x28')](_0xb7d9('0x73'),_0x2dae36['uniqueid'],_0x2dae36['application'],_0x2dae36[_0xb7d9('0x6e')]);var _0x4773de=_0x2dae36[_0xb7d9('0x6e')]['split']('=');var _0x3790ba=_0x4773de[0x0][_0xb7d9('0x74')](/cdr\((.*)\)/);if(_0x3790ba)this['applications'][_0x2dae36['uniqueid']][_0x3790ba[0x1]]=_0x4773de[0x1];}}}}catch(_0x4bbeee){logger[_0xb7d9('0x32')]('[%s][voiceDialReport][newexten]',_0x2dae36[_0xb7d9('0x21')],util['inspect'](_0x4bbeee,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0xb5bd=['socket.io-emitter','outbound','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','newexten','hangup','prototype','emit','isNotNull','debug','[%s][voiceDialReport][dialbegin]\x20event:','channels','uniqueid','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','variables','syncHangup','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','duration','endtime','starttime','total','answered','holdtime','diff','seconds','billableseconds','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','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','cdr(','isUndefined','applications','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost'];(function(_0x2b5404,_0x51147b){var _0x30acd4=function(_0x4b8103){while(--_0x4b8103){_0x2b5404['push'](_0x2b5404['shift']());}};_0x30acd4(++_0x51147b);}(_0xb5bd,0x1ea));var _0xdb5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb5bd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdb5b('0x0'));var moment=require('moment');var util=require(_0xdb5b('0x1'));var Redis=require(_0xdb5b('0x2'));var config=require(_0xdb5b('0x3'));var logger=require(_0xdb5b('0x4'))(_0xdb5b('0x5'));var ami=require(_0xdb5b('0x6'));config[_0xdb5b('0x7')]=_[_0xdb5b('0x8')](config['redis'],{'host':_0xdb5b('0x9'),'port':0x18eb});var io=require(_0xdb5b('0xa'))(new Redis(config[_0xdb5b('0x7')]));function VoiceDialReport(_0xa066b9){this['channels']=_0xa066b9['outboundChannels'];this[_0xdb5b('0xb')]=_0xa066b9[_0xdb5b('0xb')];this['applications']={};this['variables']={};ami['on'](_0xdb5b('0xc'),this[_0xdb5b('0xd')][_0xdb5b('0xe')](this));ami['on']('dialend',this[_0xdb5b('0xf')][_0xdb5b('0xe')](this));ami['on'](_0xdb5b('0x10'),this[_0xdb5b('0x11')]['bind'](this));ami['on'](_0xdb5b('0x12'),this['syncNewExten'][_0xdb5b('0xe')](this));ami['on'](_0xdb5b('0x13'),this['syncHangup'][_0xdb5b('0xe')](this));}VoiceDialReport[_0xdb5b('0x14')]['isNotNull']=function(_0x45718b){return _0x45718b!==null&&!_['isUndefined'](_0x45718b);};VoiceDialReport['prototype'][_0xdb5b('0x15')]=function(_0x32a662,_0x1a4cea,_0xd8837f){io['to'](_0x32a662)[_0xdb5b('0x15')](_0x1a4cea,_0xd8837f);};VoiceDialReport[_0xdb5b('0x14')][_0xdb5b('0xd')]=function(_0x1eb47f){try{if(this[_0xdb5b('0x16')](_0x1eb47f)){logger[_0xdb5b('0x17')](_0xdb5b('0x18'),_0x1eb47f['uniqueid'],util['inspect'](_0x1eb47f,{'showHidden':![],'depth':null}));if(this[_0xdb5b('0x19')][_0x1eb47f[_0xdb5b('0x1a')]]){_[_0xdb5b('0x1b')](this[_0xdb5b('0x19')][_0x1eb47f[_0xdb5b('0x1a')]],{'starttime':moment()['format'](_0xdb5b('0x1c')),'lastevent':_0xdb5b('0x1d'),'interface':_0x1eb47f[_0xdb5b('0x1e')]['substring'](0x0,_0x1eb47f['channel'][_0xdb5b('0x1f')]('-')),'membername':_0x1eb47f[_0xdb5b('0x1e')][_0xdb5b('0x20')](_0x1eb47f['channel'][_0xdb5b('0x1f')]('/')+0x1,_0x1eb47f[_0xdb5b('0x1e')][_0xdb5b('0x1f')]('-'))},_[_0xdb5b('0x21')](_0x1eb47f,[_0xdb5b('0x22'),_0xdb5b('0x23')]));logger['info'](_0xdb5b('0x24'),_0x1eb47f[_0xdb5b('0x1a')],this[_0xdb5b('0x19')][_0x1eb47f[_0xdb5b('0x1a')]][_0xdb5b('0x25')],this[_0xdb5b('0x19')][_0x1eb47f[_0xdb5b('0x1a')]][_0xdb5b('0x26')]);logger[_0xdb5b('0x17')](_0xdb5b('0x27'),_0x1eb47f['uniqueid'],util[_0xdb5b('0x28')](this['channels'][_0x1eb47f['uniqueid']],{'showHidden':![],'depth':null}));if(this['applications'][_0x1eb47f[_0xdb5b('0x1a')]])_[_0xdb5b('0x1b')](this[_0xdb5b('0x19')][_0x1eb47f[_0xdb5b('0x1a')]],this['applications'][_0x1eb47f[_0xdb5b('0x1a')]]);this[_0xdb5b('0x15')]('voice:outbound',_0xdb5b('0x29'),this[_0xdb5b('0x19')][_0x1eb47f[_0xdb5b('0x1a')]]);logger[_0xdb5b('0x17')](_0xdb5b('0x2a'),_0x1eb47f['uniqueid'],util[_0xdb5b('0x28')](this[_0xdb5b('0x19')][_0x1eb47f[_0xdb5b('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xdb5b('0x15')]('custom:dialbegin',this[_0xdb5b('0x19')][_0x1eb47f[_0xdb5b('0x1a')]]);}}}catch(_0x2e0b72){logger[_0xdb5b('0x2b')]('[%s][voiceDialReport][dialbegin]',_0x1eb47f[_0xdb5b('0x1a')],util[_0xdb5b('0x28')](_0x2e0b72,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdb5b('0x14')]['syncDialEnd']=function(_0x55a4ff){try{if(this[_0xdb5b('0x16')](_0x55a4ff)){logger[_0xdb5b('0x17')](_0xdb5b('0x2c'),_0x55a4ff[_0xdb5b('0x1a')],util[_0xdb5b('0x28')](_0x55a4ff,{'showHidden':![],'depth':null}));if(this[_0xdb5b('0x19')][_0x55a4ff['uniqueid']]){this['channels'][_0x55a4ff[_0xdb5b('0x1a')]][_0xdb5b('0x2d')]=_0x55a4ff[_0xdb5b('0x2d')];if(_0x55a4ff['dialstatus']===_0xdb5b('0x2e')){this['channels'][_0x55a4ff[_0xdb5b('0x1a')]][_0xdb5b('0x2f')]=_0x55a4ff[_0xdb5b('0x2f')];this[_0xdb5b('0x19')][_0x55a4ff['uniqueid']][_0xdb5b('0x30')]=_0x55a4ff[_0xdb5b('0x30')];this[_0xdb5b('0x19')][_0x55a4ff[_0xdb5b('0x1a')]][_0xdb5b('0x31')]=moment()[_0xdb5b('0x32')](_0xdb5b('0x1c'));this[_0xdb5b('0x19')][_0x55a4ff[_0xdb5b('0x1a')]][_0xdb5b('0x33')]=_0xdb5b('0x34');logger[_0xdb5b('0x35')](_0xdb5b('0x36'),_0x55a4ff['uniqueid'],_0x55a4ff[_0xdb5b('0x1e')][_0xdb5b('0x20')](_0x55a4ff[_0xdb5b('0x1e')][_0xdb5b('0x1f')]('/')+0x1,_0x55a4ff[_0xdb5b('0x1e')][_0xdb5b('0x1f')]('-')));logger['debug'](_0xdb5b('0x37'),_0x55a4ff[_0xdb5b('0x1a')],util[_0xdb5b('0x28')](this[_0xdb5b('0x19')][_0x55a4ff['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xdb5b('0x15')](_0xdb5b('0x38'),this[_0xdb5b('0x19')][_0x55a4ff[_0xdb5b('0x1a')]]);}logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x55a4ff[_0xdb5b('0x1a')],util[_0xdb5b('0x28')](this[_0xdb5b('0x19')][_0x55a4ff[_0xdb5b('0x1a')]],{'showHidden':![],'depth':null}));this[_0xdb5b('0x15')]('voice:outbound',_0xdb5b('0x29'),this[_0xdb5b('0x19')][_0x55a4ff[_0xdb5b('0x1a')]]);}}}catch(_0x7b487){logger[_0xdb5b('0x2b')](_0xdb5b('0x39'),_0x55a4ff[_0xdb5b('0x1a')],util[_0xdb5b('0x28')](_0x7b487,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdb5b('0x14')]['syncVarSet']=function(_0x5998f7){try{if(this[_0xdb5b('0x16')](_0x5998f7)){logger[_0xdb5b('0x17')](_0xdb5b('0x3a'),_0x5998f7[_0xdb5b('0x1a')],util['inspect'](_0x5998f7,{'showHidden':![],'depth':null}));this[_0xdb5b('0x3b')](_0x5998f7[_0xdb5b('0x1a')],_[_0xdb5b('0x3c')](_0x5998f7[_0xdb5b('0x3d')])[0x0],_0x5998f7[_0xdb5b('0x3e')]);if(this['isNotNull'](_0x5998f7[_0xdb5b('0x3d')])&&this[_0xdb5b('0x16')](_0x5998f7[_0xdb5b('0x3d')][_0xdb5b('0x3f')])){if(_['isUndefined'](this[_0xdb5b('0x19')][_0x5998f7[_0xdb5b('0x1a')]])){this[_0xdb5b('0x19')][_0x5998f7['uniqueid']]={'routeId':_0x5998f7['value'],'variables':this['variables'][_0x5998f7[_0xdb5b('0x1a')]]};logger[_0xdb5b('0x35')](_0xdb5b('0x40'),_0x5998f7[_0xdb5b('0x1a')],_0x5998f7['variable']['outboundrouteid'],_[_0xdb5b('0x3c')](_0x5998f7[_0xdb5b('0x3d')])[0x0],_0x5998f7[_0xdb5b('0x3e')]);logger[_0xdb5b('0x17')](_0xdb5b('0x41'),_0x5998f7[_0xdb5b('0x1a')],util[_0xdb5b('0x28')](this[_0xdb5b('0x19')][_0x5998f7[_0xdb5b('0x1a')]],{'showHidden':![],'depth':null}));this[_0xdb5b('0x15')]('voice:outbound',_0xdb5b('0x29'),this[_0xdb5b('0x19')][_0x5998f7['uniqueid']]);}}}}catch(_0x42985e){logger['error'](_0xdb5b('0x42'),_0x5998f7[_0xdb5b('0x1a')],util[_0xdb5b('0x28')](_0x42985e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdb5b('0x14')][_0xdb5b('0x3b')]=function(_0xe7eed9,_0x35ac49,_0x3d4ea6){var _0x1c3acb=[_0xdb5b('0x43'),_0xdb5b('0x44'),_0xdb5b('0x45'),_0xdb5b('0x46'),'rtpaudioqosloss',_0xdb5b('0x47'),_0xdb5b('0x48'),_0xdb5b('0x49'),_0xdb5b('0x4a'),'sipuri',_0xdb5b('0x4b'),_0xdb5b('0x4c'),_0xdb5b('0x4d'),_0xdb5b('0x4e'),_0xdb5b('0x4f'),'memberlastcall',_0xdb5b('0x25'),_0xdb5b('0x50'),_0xdb5b('0x51')];if(!_[_0xdb5b('0x52')](_0x35ac49)&&!_[_0xdb5b('0x53')](_0x1c3acb,_0x35ac49)){if(_['isUndefined'](this[_0xdb5b('0x54')][_0xe7eed9])){this['variables'][_0xe7eed9]={};}this[_0xdb5b('0x54')][_0xe7eed9][_0x35ac49]=_0x3d4ea6;}};VoiceDialReport['prototype'][_0xdb5b('0x55')]=function(_0x33b1f6){try{if(this[_0xdb5b('0x16')](_0x33b1f6)){logger['debug'](_0xdb5b('0x56'),_0x33b1f6['uniqueid'],util['inspect'](_0x33b1f6,{'showHidden':![],'depth':null}));if(this[_0xdb5b('0x19')][_0x33b1f6[_0xdb5b('0x1a')]]){logger[_0xdb5b('0x35')](_0xdb5b('0x57'),_0x33b1f6['uniqueid'],_0x33b1f6[_0xdb5b('0x58')]);this[_0xdb5b('0x19')][_0x33b1f6[_0xdb5b('0x1a')]]['endtime']=moment()['format'](_0xdb5b('0x1c'));this[_0xdb5b('0x19')][_0x33b1f6['uniqueid']][_0xdb5b('0x59')]=moment(this[_0xdb5b('0x19')][_0x33b1f6[_0xdb5b('0x1a')]][_0xdb5b('0x5a')])['diff'](this[_0xdb5b('0x19')][_0x33b1f6[_0xdb5b('0x1a')]][_0xdb5b('0x5b')],'seconds');this[_0xdb5b('0x19')][_0x33b1f6[_0xdb5b('0x1a')]][_0xdb5b('0x33')]='complete';this[_0xdb5b('0xb')][_0xdb5b('0x5c')]+=0x1;if(this[_0xdb5b('0x19')][_0x33b1f6[_0xdb5b('0x1a')]]['answertime']){this[_0xdb5b('0xb')][_0xdb5b('0x5d')]+=0x1;this[_0xdb5b('0x19')][_0x33b1f6[_0xdb5b('0x1a')]][_0xdb5b('0x5e')]=moment(this[_0xdb5b('0x19')][_0x33b1f6[_0xdb5b('0x1a')]][_0xdb5b('0x31')])[_0xdb5b('0x5f')](this[_0xdb5b('0x19')][_0x33b1f6[_0xdb5b('0x1a')]]['starttime'],_0xdb5b('0x60'));this[_0xdb5b('0x19')][_0x33b1f6['uniqueid']][_0xdb5b('0x61')]=moment(this[_0xdb5b('0x19')][_0x33b1f6[_0xdb5b('0x1a')]]['endtime'])[_0xdb5b('0x5f')](this[_0xdb5b('0x19')][_0x33b1f6[_0xdb5b('0x1a')]][_0xdb5b('0x31')],'seconds');this[_0xdb5b('0xb')]['sumHoldTime']+=this['channels'][_0x33b1f6['uniqueid']][_0xdb5b('0x5e')]||0x0;this[_0xdb5b('0xb')][_0xdb5b('0x62')]+=this[_0xdb5b('0x19')][_0x33b1f6[_0xdb5b('0x1a')]]['billableseconds'];}this[_0xdb5b('0xb')][_0xdb5b('0x63')]+=this['channels'][_0x33b1f6[_0xdb5b('0x1a')]]['duration'];logger[_0xdb5b('0x17')](_0xdb5b('0x64'),_0x33b1f6[_0xdb5b('0x1a')],util[_0xdb5b('0x28')](this[_0xdb5b('0x19')][_0x33b1f6['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xdb5b('0x15')](_0xdb5b('0x65'),this[_0xdb5b('0x19')][_0x33b1f6['uniqueid']]);logger[_0xdb5b('0x17')](_0xdb5b('0x66'),_0x33b1f6['uniqueid'],util[_0xdb5b('0x28')](this[_0xdb5b('0x19')][_0x33b1f6[_0xdb5b('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xdb5b('0x15')]('custom:dialend',this[_0xdb5b('0x19')][_0x33b1f6[_0xdb5b('0x1a')]]);logger[_0xdb5b('0x17')](_0xdb5b('0x67'),_0x33b1f6[_0xdb5b('0x1a')],util[_0xdb5b('0x28')](this[_0xdb5b('0x19')][_0x33b1f6[_0xdb5b('0x1a')]],{'showHidden':![],'depth':null}));this[_0xdb5b('0x15')](_0xdb5b('0x68'),_0xdb5b('0x69'),this[_0xdb5b('0xb')]);logger[_0xdb5b('0x35')](_0xdb5b('0x6a'),JSON[_0xdb5b('0x6b')](this[_0xdb5b('0x19')][_0x33b1f6[_0xdb5b('0x1a')]]));logger[_0xdb5b('0x17')](_0xdb5b('0x6c'),_0x33b1f6[_0xdb5b('0x1a')],util[_0xdb5b('0x28')](this[_0xdb5b('0x19')][_0x33b1f6[_0xdb5b('0x1a')]],{'showHidden':![],'depth':null}));this[_0xdb5b('0x15')]('voice:outbound',_0xdb5b('0x6d'),this['channels'][_0x33b1f6[_0xdb5b('0x1a')]]);delete this['channels'][_0x33b1f6[_0xdb5b('0x1a')]];}else if(this[_0xdb5b('0x19')][_0x33b1f6[_0xdb5b('0x6e')]]){this[_0xdb5b('0x19')][_0x33b1f6['linkedid']][_0xdb5b('0x1a')]=this['channels'][_0x33b1f6[_0xdb5b('0x6e')]]['destuniqueid'];}if(this[_0xdb5b('0x54')][_0x33b1f6[_0xdb5b('0x1a')]]){delete this[_0xdb5b('0x54')][_0x33b1f6[_0xdb5b('0x1a')]];}}}catch(_0x5c9e21){logger[_0xdb5b('0x2b')](_0xdb5b('0x6f'),_0x33b1f6['uniqueid'],util['inspect'](_0x5c9e21,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdb5b('0x14')]['syncNewExten']=function(_0x4d8e35){try{if(this[_0xdb5b('0x16')](_0x4d8e35)){logger[_0xdb5b('0x17')](_0xdb5b('0x70'),_0x4d8e35[_0xdb5b('0x1a')],util['inspect'](_0x4d8e35,{'showHidden':![],'depth':null}));if(_0x4d8e35[_0xdb5b('0x71')][_0xdb5b('0x72')]()==='set'){_0x4d8e35[_0xdb5b('0x73')]=(_0x4d8e35[_0xdb5b('0x74')]||_0x4d8e35[_0xdb5b('0x73')])[_0xdb5b('0x72')]();if(_[_0xdb5b('0x75')](_0x4d8e35[_0xdb5b('0x73')],_0xdb5b('0x76'))){if(_[_0xdb5b('0x77')](this[_0xdb5b('0x78')][_0x4d8e35[_0xdb5b('0x1a')]]))this[_0xdb5b('0x78')][_0x4d8e35[_0xdb5b('0x1a')]]={};logger[_0xdb5b('0x35')](_0xdb5b('0x79'),_0x4d8e35[_0xdb5b('0x1a')],_0x4d8e35['application'],_0x4d8e35['applicationdata']);var _0x25c122=_0x4d8e35['applicationdata'][_0xdb5b('0x7a')]('=');var _0x34555b=_0x25c122[0x0][_0xdb5b('0x7b')](/cdr\((.*)\)/);if(_0x34555b)this[_0xdb5b('0x78')][_0x4d8e35['uniqueid']][_0x34555b[0x1]]=_0x25c122[0x1];}}}}catch(_0x4ce1e8){logger['error'](_0xdb5b('0x7c'),_0x4d8e35[_0xdb5b('0x1a')],util[_0xdb5b('0x28')](_0x4ce1e8,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 9365611..195735c 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 _0x3b59=['sumDuration','sumHoldTime','total','unmanaged','Trunk','active','Interval','stringify','[voiceQueueReport][','voice_queue:save','isUndefined','[voiceQueueReport][queues]','flagQueueSummary','Action','[voiceQueueReport][queuesummary]','queue','debug','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','waiting','toNumber','loggedin','emitVoiceQueueSummary','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','isNotNull','[%s][voiceQueueReport][queuecallerjoin]','inbound','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','push','emitVoiceQueueChannelSave','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandon','queuecallerabandonAt','queuecallerexitreason','ABANDONED','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','queuecallerleave','queuecallercomplete','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','assigned','queuecallerexit','queuecallerexitAt','transfer','reason','startsWith','local/','linkedid','queuecallerjoinAt','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[%s][voiceQueueReport][agentcomplete]','[%s][voiceQueueReport][varset]','addVariable','keys','variable','value','CONTINUE','TIMEOUT','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','includes','length','abandoned','diff','sumBillable','milliseconds','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','lastevent','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','isNil','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','application','set','applicationdata','appdata','toLowerCase','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','exports','lodash','moment','util','md5','ioredis','../../../config/environment','ami','../model/queueReport','redis','defaults','socket.io-emitter','prototype','tail','finally','sequence','queueReports','agents','channels','voiceQueues','campaigns','variables','queuesummary','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','bind','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','newexten','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','queueStatusComplete','unlockRR','clearZombieChannels','switch','enqueue','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','voice:queue:%s','name','voice_queue_channel:save','voice_queue_presence:save','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:remove\x20event:','format','voice_queue_channel:remove','type','strategy','answered','available','loggedIn'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0x3b59,0x9c));var _0x93b5=function(_0x25214d,_0x1db1ec){_0x25214d=_0x25214d-0x0;var _0x16640c=_0x3b59[_0x25214d];return _0x16640c;};'use strict';var _=require(_0x93b5('0x0'));var moment=require(_0x93b5('0x1'));var util=require(_0x93b5('0x2'));var md5=require(_0x93b5('0x3'));var Redis=require(_0x93b5('0x4'));var config=require(_0x93b5('0x5'));var logger=require('../../../config/logger')(_0x93b5('0x6'));var ami=require('../ami');var QueueReport=require(_0x93b5('0x7'));config[_0x93b5('0x8')]=_[_0x93b5('0x9')](config[_0x93b5('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x93b5('0xa'))(new Redis(config[_0x93b5('0x8')]));var Sequence=function(){};Sequence[_0x93b5('0xb')]['enqueue']=function(_0x8e475e){this[_0x93b5('0xc')]=this[_0x93b5('0xc')]?this[_0x93b5('0xc')][_0x93b5('0xd')](_0x8e475e):_0x8e475e();};function VoiceQueueReport(_0x490b0d){this[_0x93b5('0xe')]=new Sequence();this[_0x93b5('0xf')]={};this[_0x93b5('0x10')]=_0x490b0d[_0x93b5('0x10')];this[_0x93b5('0x11')]=_0x490b0d['queueChannels'];this[_0x93b5('0x12')]=_0x490b0d[_0x93b5('0x12')];this['flagQueueSummary']=!![];this[_0x93b5('0x13')]=_0x490b0d[_0x93b5('0x13')];this[_0x93b5('0x14')]={};ami['on'](_0x93b5('0x15'),this[_0x93b5('0x16')]['bind'](this));ami['on'](_0x93b5('0x17'),this[_0x93b5('0x18')]['bind'](this));ami['on'](_0x93b5('0x19'),this[_0x93b5('0x1a')][_0x93b5('0x1b')](this));ami['on']('queuecallerabandon',this[_0x93b5('0x1c')]['bind'](this));ami['on']('queuecallerleave',this[_0x93b5('0x1d')]['bind'](this));ami['on'](_0x93b5('0x1e'),this[_0x93b5('0x1f')][_0x93b5('0x1b')](this));ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on'](_0x93b5('0x20'),this[_0x93b5('0x21')][_0x93b5('0x1b')](this));ami['on'](_0x93b5('0x22'),this[_0x93b5('0x23')][_0x93b5('0x1b')](this));ami['on'](_0x93b5('0x24'),this[_0x93b5('0x25')][_0x93b5('0x1b')](this));ami['on'](_0x93b5('0x26'),this['syncNewExten']['bind'](this));ami['on'](_0x93b5('0x27'),this[_0x93b5('0x28')]['bind'](this));ami['on'](_0x93b5('0x29'),this[_0x93b5('0x2a')][_0x93b5('0x1b')](this));ami['on'](_0x93b5('0x2b'),this[_0x93b5('0x2c')][_0x93b5('0x1b')](this));ami['on'](_0x93b5('0x2d'),this[_0x93b5('0x2e')][_0x93b5('0x1b')](this));this[_0x93b5('0x2f')]();this[_0x93b5('0x30')]();}function clearChannels(_0x126746){if(!_[_0x93b5('0x31')](_0x126746)){for(var _0x3a31db in _0x126746){if(_0x126746[_0x93b5('0x32')](_0x3a31db)){delete _0x126746[_0x3a31db];}}}}function clearCampaigns(_0x7eed38){if(!_[_0x93b5('0x31')](_0x7eed38)){for(var _0x11add6 in _0x7eed38){if(_0x7eed38['hasOwnProperty'](_0x11add6)){_0x7eed38[_0x11add6][_0x93b5('0x33')]=0x0;}}}}function clearVoiceQueues(_0x2ed60b){if(!_[_0x93b5('0x31')](_0x2ed60b)){for(var _0x124101 in _0x2ed60b){if(_0x2ed60b[_0x93b5('0x32')](_0x124101)){_0x2ed60b[_0x124101][_0x93b5('0x33')]=0x0;_0x2ed60b[_0x124101][_0x93b5('0x34')]=0x0;_0x2ed60b[_0x124101][_0x93b5('0x35')]=0x0;_0x2ed60b[_0x124101]['waiting']=0x0;_0x2ed60b[_0x124101][_0x93b5('0x36')]=!![];}}}}function clearAgentBooked(_0x239f96){if(!_['isEmpty'](_0x239f96)){for(var _0xf7fc9c in _0x239f96){if(_0x239f96['hasOwnProperty'](_0xf7fc9c)){_0x239f96[_0xf7fc9c][_0x93b5('0x37')]=!![];}}}}VoiceQueueReport[_0x93b5('0xb')][_0x93b5('0x38')]=function(){var _0x1a3495=this;for(var _0x207b04 in this[_0x93b5('0x11')]){if(this[_0x93b5('0x11')][_0x93b5('0x32')](_0x207b04)&&!this[_0x93b5('0x11')][_0x207b04][_0x93b5('0x39')]){this['sequence'][_0x93b5('0x3a')](function(){if(!_['isNil'](_0x1a3495['channels'][_0x207b04])){return ami['Action']({'action':'status','channel':_0x1a3495[_0x93b5('0x11')][_0x207b04][_0x93b5('0x3b')]})[_0x93b5('0x3c')](function(_0x94d29a){if(_0x94d29a[_0x93b5('0x3d')]===_0x93b5('0x3e')){setTimeout(function(){if(_0x1a3495[_0x93b5('0x11')][_0x207b04]){delete _0x1a3495[_0x93b5('0x11')][_0x207b04];logger[_0x93b5('0x3f')](_0x93b5('0x40'),_0x207b04,util[_0x93b5('0x41')](_0x94d29a,{'showHidden':![],'depth':null}));}if(_0x1a3495['queueReports'][_0x207b04]){delete _0x1a3495['queueReports'][_0x207b04];logger[_0x93b5('0x3f')](_0x93b5('0x42'),_0x207b04,util[_0x93b5('0x41')](_0x94d29a,{'showHidden':![],'depth':null}));}if(_0x1a3495[_0x93b5('0x14')][_0x207b04]){delete _0x1a3495[_0x93b5('0x14')][_0x207b04];logger[_0x93b5('0x3f')]('[%s][voiceQueueReport][checkVariables]',_0x207b04,util['inspect'](_0x94d29a,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger['error'](_0x93b5('0x43'));clearChannels(this[_0x93b5('0x11')]);this[_0x93b5('0x44')](this[_0x93b5('0xf')]);clearAgentBooked(this[_0x93b5('0x10')]);clearVoiceQueues(this[_0x93b5('0x12')]);clearCampaigns(this[_0x93b5('0x13')]);};VoiceQueueReport[_0x93b5('0xb')][_0x93b5('0x44')]=function(_0x2f52ea){var _0x5400b9=this;if(!_['isEmpty'](_0x2f52ea)){for(var _0x48320d in _0x2f52ea){if(_0x2f52ea[_0x93b5('0x32')](_0x48320d)){_0x5400b9[_0x93b5('0x45')](_0x2f52ea[_0x48320d],_0x93b5('0x46'));delete _0x2f52ea[_0x48320d];}}}};VoiceQueueReport[_0x93b5('0xb')][_0x93b5('0x47')]=function(_0x2a5382,_0x5ef62a,_0x27800e){io['to'](_0x2a5382)[_0x93b5('0x47')](_0x5ef62a,_0x27800e);};VoiceQueueReport[_0x93b5('0xb')]['emitVoiceQueueChannelSave']=function(_0x1cf514,_0x426403){logger['debug']('[%s][voiceQueueReport]['+_0x426403+_0x93b5('0x48'),_0x1cf514[_0x93b5('0x49')],util[_0x93b5('0x41')](_0x1cf514,{'showHidden':![],'depth':null}));this[_0x93b5('0x47')](util['format'](_0x93b5('0x4a'),_0x1cf514[_0x93b5('0x4b')]),_0x93b5('0x4c'),_0x1cf514);io[_0x93b5('0x47')](_0x93b5('0x4d'),_0x1cf514);};VoiceQueueReport[_0x93b5('0xb')][_0x93b5('0x45')]=function(_0xe53ce3,_0x51726a){logger['debug'](_0x93b5('0x4e')+_0x51726a+_0x93b5('0x4f'),_0xe53ce3[_0x93b5('0x49')],util[_0x93b5('0x41')](_0xe53ce3,{'showHidden':![],'depth':null}));this[_0x93b5('0x47')](util[_0x93b5('0x50')](_0x93b5('0x4a'),_0xe53ce3[_0x93b5('0x4b')]),_0x93b5('0x51'),_0xe53ce3);io[_0x93b5('0x47')]('voice_queue_presence:remove',_0xe53ce3);};VoiceQueueReport[_0x93b5('0xb')]['emitVoiceQueueSummary']=function(_0x2568b8,_0x2f5967){if(_0x2568b8[_0x93b5('0x52')]==='inbound'){var _0x36b5c0={'id':_0x2568b8['id'],'name':_0x2568b8[_0x93b5('0x4b')],'strategy':_0x2568b8[_0x93b5('0x53')],'answered':_0x2568b8[_0x93b5('0x54')],'available':_0x2568b8[_0x93b5('0x55')],'loggedIn':_0x2568b8[_0x93b5('0x56')],'pTalking':_0x2568b8[_0x93b5('0x35')],'sumBillable':_0x2568b8['sumBillable'],'sumDuration':_0x2568b8[_0x93b5('0x57')],'sumHoldTime':_0x2568b8[_0x93b5('0x58')]||0x0,'talking':_0x2568b8[_0x93b5('0x34')],'total':_0x2568b8[_0x93b5('0x59')],'type':_0x2568b8['type'],'unmanaged':_0x2568b8[_0x93b5('0x5a')],'abandoned':_0x2568b8['abandoned'],'waiting':_0x2568b8['waiting']};if(_0x2568b8['Trunk']){_0x36b5c0[_0x93b5('0x5b')]={'id':_0x2568b8[_0x93b5('0x5b')]['id'],'name':_0x2568b8[_0x93b5('0x5b')][_0x93b5('0x4b')],'active':_0x2568b8[_0x93b5('0x5b')][_0x93b5('0x5c')],'callerid':_0x2568b8[_0x93b5('0x5b')]['callerid']};}if(_0x2568b8[_0x93b5('0x5d')]){_0x36b5c0[_0x93b5('0x5d')]={'id':_0x2568b8[_0x93b5('0x5d')]['id'],'name':_0x2568b8['Interval'][_0x93b5('0x4b')]};}var _0x33831d=md5(JSON[_0x93b5('0x5e')](_0x36b5c0));if(_0x2568b8['md5']!==_0x33831d){_0x2568b8['md5']=_0x33831d;logger['debug'](_0x93b5('0x5f')+_0x2f5967+']\x20sending\x20voice_queue:save\x20event:',util['inspect'](_0x36b5c0,{'showHidden':![],'depth':null}));this[_0x93b5('0x47')](util['format'](_0x93b5('0x4a'),_0x36b5c0['name']),_0x93b5('0x60'),_0x36b5c0);}}};VoiceQueueReport['prototype']['isNotNull']=function(_0x3ffb49){return _0x3ffb49!==null&&!_[_0x93b5('0x61')](_0x3ffb49);};VoiceQueueReport[_0x93b5('0xb')][_0x93b5('0x30')]=function(){var _0x27c467=this;setInterval(function(){_0x27c467['clearZombieChannels']();ami['Action']({'action':'queues'})[_0x93b5('0x3c')](function(_0xe7b552){logger[_0x93b5('0x3f')](_0x93b5('0x62'),util['inspect'](_0xe7b552,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0x93b5('0x2f')]=function(){var _0x57eec8=this;setInterval(function(){if(_0x57eec8[_0x93b5('0x63')]){return ami[_0x93b5('0x64')]({'action':_0x93b5('0x15')})['then'](function(_0x1c97bb){_0x57eec8['flagQueueSummary']=![];})[_0x93b5('0x3c')](function(_0xd98f49){logger[_0x93b5('0x3f')](_0x93b5('0x65'),util[_0x93b5('0x41')](_0xd98f49,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype']['syncQueueSummary']=function(_0x3aa7fd){try{if(this['isNotNull'](_0x3aa7fd)&&this['isNotNull'](_0x3aa7fd[_0x93b5('0x66')])){logger[_0x93b5('0x67')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x93b5('0x41')](_0x3aa7fd,{'showHidden':![],'depth':null}));if(this['voiceQueues'][_0x3aa7fd[_0x93b5('0x66')]]){logger['info'](_0x93b5('0x68'),_0x3aa7fd['queue']);var _0x1e04a8=_[_0x93b5('0x69')](this['channels'],'queue')[_0x3aa7fd[_0x93b5('0x66')]]||0x0;var _0xc90ad8=_0x1e04a8-_0x3aa7fd[_0x93b5('0x6a')];if(this['voiceQueues'][_0x3aa7fd[_0x93b5('0x66')]][_0x93b5('0x6b')]!==_[_0x93b5('0x6c')](_0x3aa7fd[_0x93b5('0x6a')])||this[_0x93b5('0x12')][_0x3aa7fd[_0x93b5('0x66')]]['loggedIn']!==_[_0x93b5('0x6c')](_0x3aa7fd[_0x93b5('0x6d')])||this['voiceQueues'][_0x3aa7fd[_0x93b5('0x66')]][_0x93b5('0x55')]!==_[_0x93b5('0x6c')](_0x3aa7fd[_0x93b5('0x55')])||this[_0x93b5('0x12')][_0x3aa7fd[_0x93b5('0x66')]][_0x93b5('0x34')]!==_0xc90ad8){this[_0x93b5('0x12')][_0x3aa7fd[_0x93b5('0x66')]][_0x93b5('0x6b')]=_[_0x93b5('0x6c')](_0x3aa7fd[_0x93b5('0x6a')]);this['voiceQueues'][_0x3aa7fd[_0x93b5('0x66')]]['loggedIn']=_[_0x93b5('0x6c')](_0x3aa7fd[_0x93b5('0x6d')]);this[_0x93b5('0x12')][_0x3aa7fd[_0x93b5('0x66')]]['available']=_['toNumber'](_0x3aa7fd[_0x93b5('0x55')]);this[_0x93b5('0x12')][_0x3aa7fd[_0x93b5('0x66')]][_0x93b5('0x34')]=_0xc90ad8>0x0?_0xc90ad8:0x0;this[_0x93b5('0x12')][_0x3aa7fd[_0x93b5('0x66')]][_0x93b5('0x34')]=this['voiceQueues'][_0x3aa7fd[_0x93b5('0x66')]]['talking']>_[_0x93b5('0x6c')](_0x3aa7fd[_0x93b5('0x6d')])?_[_0x93b5('0x6c')](_0x3aa7fd['loggedin']):this[_0x93b5('0x12')][_0x3aa7fd[_0x93b5('0x66')]][_0x93b5('0x34')];this[_0x93b5('0x6e')](this['voiceQueues'][_0x3aa7fd[_0x93b5('0x66')]],'queuesummary');}logger[_0x93b5('0x67')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x93b5('0x41')](this[_0x93b5('0x12')][_0x3aa7fd[_0x93b5('0x66')]],{'showHidden':![],'depth':null}));ami['emit'](_0x93b5('0x6f'),this['voiceQueues'][_0x3aa7fd['queue']]);}}}catch(_0x1f0089){logger[_0x93b5('0x3f')]('[voiceQueueReport][queuesummary]',util[_0x93b5('0x41')](_0x1f0089,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x93b5('0x18')]=function(_0x492baa){logger[_0x93b5('0x67')](_0x93b5('0x70'),util['inspect'](_0x492baa,{'showHidden':![],'depth':null}));this[_0x93b5('0x63')]=!![];};VoiceQueueReport[_0x93b5('0xb')][_0x93b5('0x1a')]=function(_0x3afa27){try{if(this[_0x93b5('0x71')](_0x3afa27)){logger[_0x93b5('0x67')](_0x93b5('0x72'),_0x3afa27['uniqueid'],util[_0x93b5('0x41')](_0x3afa27,{'showHidden':![],'depth':null}));if(_[_0x93b5('0x61')](this[_0x93b5('0xf')][_0x3afa27['uniqueid']]))this[_0x93b5('0xf')][_0x3afa27[_0x93b5('0x49')]]=[];if(_[_0x93b5('0x61')](this['channels'][_0x3afa27['uniqueid']]))this[_0x93b5('0x11')][_0x3afa27[_0x93b5('0x49')]]={};var _0x2d1b30=new QueueReport();_0x2d1b30[_0x93b5('0x4b')]=_0x3afa27['queue'];_0x2d1b30[_0x93b5('0x52')]=this['voiceQueues'][_0x2d1b30[_0x93b5('0x4b')]]&&this[_0x93b5('0x12')][_0x2d1b30['name']][_0x93b5('0x52')]?this['voiceQueues'][_0x2d1b30[_0x93b5('0x4b')]]['type']||_0x93b5('0x73'):_0x93b5('0x73');_0x2d1b30['queue']=_0x3afa27[_0x93b5('0x66')];_0x2d1b30['queuecallerjoinAt']=moment()[_0x93b5('0x50')](_0x93b5('0x74'));_0x2d1b30[_0x93b5('0x75')]=_0x3afa27[_0x93b5('0x75')];_0x2d1b30[_0x93b5('0x76')]=_0x3afa27['count'];_0x2d1b30['uniqueid']=_0x3afa27[_0x93b5('0x49')];_0x2d1b30[_0x93b5('0x77')]=this[_0x93b5('0x11')][_0x3afa27[_0x93b5('0x49')]][_0x93b5('0x77')];logger[_0x93b5('0x78')](_0x93b5('0x79'),_0x2d1b30[_0x93b5('0x4b')],_0x2d1b30[_0x93b5('0x52')]);_[_0x93b5('0x7a')](_0x2d1b30,_['pick'](_0x3afa27,_['keys'](_0x2d1b30)));this[_0x93b5('0xf')][_0x3afa27[_0x93b5('0x49')]][_0x93b5('0x7b')](_0x2d1b30);this['channels'][_0x3afa27[_0x93b5('0x49')]]=_0x2d1b30;this[_0x93b5('0x7c')](_0x2d1b30,_0x93b5('0x19'));}}catch(_0x2340e0){logger[_0x93b5('0x3f')](_0x93b5('0x72'),_0x3afa27[_0x93b5('0x49')],util[_0x93b5('0x41')](_0x2340e0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x93b5('0xb')][_0x93b5('0x1c')]=function(_0x5c5083){try{if(this[_0x93b5('0x71')](_0x5c5083)){logger[_0x93b5('0x67')](_0x93b5('0x7d'),_0x5c5083['uniqueid'],util[_0x93b5('0x41')](_0x5c5083,{'showHidden':![],'depth':null}));if(this[_0x93b5('0xf')][_0x5c5083[_0x93b5('0x49')]]){var _0x32beff=_[_0x93b5('0x7e')](this[_0x93b5('0xf')][_0x5c5083['uniqueid']]);_0x32beff['queuecallercomplete']=![];_0x32beff[_0x93b5('0x7f')]=null;_0x32beff[_0x93b5('0x80')]=_0x5c5083[_0x93b5('0x80')];_0x32beff[_0x93b5('0x81')]=_0x5c5083[_0x93b5('0x81')];_0x32beff[_0x93b5('0x82')]=!![];_0x32beff[_0x93b5('0x83')]=moment()[_0x93b5('0x50')](_0x93b5('0x74'));_0x32beff[_0x93b5('0x84')]=_0x93b5('0x85');_0x32beff['lastAssignedTo']=null;logger[_0x93b5('0x78')](_0x93b5('0x86'),_0x32beff[_0x93b5('0x4b')],_0x32beff[_0x93b5('0x52')]);this[_0x93b5('0x11')][_0x5c5083['uniqueid']]=_0x32beff;this['emitVoiceQueueChannelRemove'](_0x32beff,_0x93b5('0x82'));}}}catch(_0x128450){logger[_0x93b5('0x3f')]('[%s][voiceQueueReport][queuecallerabandon]',_0x5c5083[_0x93b5('0x49')],util[_0x93b5('0x41')](_0x128450,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x93b5('0xb')][_0x93b5('0x1d')]=function(_0x43ecd0){try{if(this[_0x93b5('0x71')](_0x43ecd0)){logger[_0x93b5('0x67')](_0x93b5('0x87'),_0x43ecd0[_0x93b5('0x49')],util[_0x93b5('0x41')](_0x43ecd0,{'showHidden':![],'depth':null}));if(this[_0x93b5('0xf')][_0x43ecd0[_0x93b5('0x49')]]){var _0x1dc286=_[_0x93b5('0x7e')](this[_0x93b5('0xf')][_0x43ecd0['uniqueid']]);_0x1dc286[_0x93b5('0x88')]=moment()[_0x93b5('0x50')](_0x93b5('0x74'));_0x1dc286[_0x93b5('0x89')]=_0x43ecd0[_0x93b5('0x89')];_0x1dc286[_0x93b5('0x8a')]=_0x43ecd0[_0x93b5('0x8a')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x1dc286[_0x93b5('0x4b')],_0x1dc286[_0x93b5('0x52')],_0x43ecd0['connectedlinenum'],_0x43ecd0['connectedlinename']);this[_0x93b5('0x11')][_0x43ecd0[_0x93b5('0x49')]]=_0x1dc286;this[_0x93b5('0x7c')](_0x1dc286,_0x93b5('0x8b'));}}}catch(_0x321eca){logger['error'](_0x93b5('0x87'),_0x43ecd0[_0x93b5('0x49')],util['inspect'](_0x321eca,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x48a696){try{if(this[_0x93b5('0x71')](_0x48a696)){logger[_0x93b5('0x67')]('[%s][voiceQueueReport][agentconnect]',_0x48a696['uniqueid'],util[_0x93b5('0x41')](_0x48a696,{'showHidden':![],'depth':null}));if(this[_0x93b5('0xf')][_0x48a696[_0x93b5('0x49')]]){var _0x3926a1=_['last'](this['queueReports'][_0x48a696[_0x93b5('0x49')]]);_0x3926a1[_0x93b5('0x8c')]=!![];_0x3926a1['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0x93b5('0x78')](_0x93b5('0x8d'),_0x3926a1['name'],_0x3926a1[_0x93b5('0x52')]);}}}catch(_0x4a0948){logger[_0x93b5('0x3f')](_0x93b5('0x8e'),_0x48a696[_0x93b5('0x49')],util[_0x93b5('0x41')](_0x4a0948,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x93b5('0xb')][_0x93b5('0x1f')]=function(_0x334b8f){try{if(this['isNotNull'](_0x334b8f)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x334b8f[_0x93b5('0x49')],util[_0x93b5('0x41')](_0x334b8f,{'showHidden':![],'depth':null}));if(this[_0x93b5('0xf')][_0x334b8f[_0x93b5('0x49')]]){var _0x10fa31=_['last'](this[_0x93b5('0xf')][_0x334b8f[_0x93b5('0x49')]]);_0x10fa31[_0x93b5('0x82')]=![];_0x10fa31[_0x93b5('0x83')]=null;_0x10fa31[_0x93b5('0x8f')]=!![];_0x10fa31['lastAssignedTo']=_0x334b8f['membername'];_0x10fa31['holdtime']=_0x334b8f['holdtime'];_0x10fa31['queuecallercomplete']=!![];_0x10fa31[_0x93b5('0x90')]=![];_0x10fa31[_0x93b5('0x91')]=null;if(!_0x10fa31[_0x93b5('0x92')]){if(_0x334b8f[_0x93b5('0x93')]==_0x93b5('0x92')){_0x10fa31[_0x93b5('0x84')]='COMPLETED';logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x10fa31['name'],_0x10fa31['type']);}else{if(_[_0x93b5('0x94')](_0x334b8f[_0x93b5('0x3b')]['toLowerCase'](),_0x93b5('0x95'))){if(this[_0x93b5('0xf')][_0x334b8f[_0x93b5('0x96')]]){var _0x5e0eda=_['last'](this[_0x93b5('0xf')][_0x334b8f['linkedid']]);_0x5e0eda['queuecallercomplete']=![];_0x5e0eda['queuecallerexit']=!![];_0x5e0eda[_0x93b5('0x91')]=moment(_0x10fa31[_0x93b5('0x97')])[_0x93b5('0x98')](_0x334b8f['holdtime'],_0x93b5('0x99'))[_0x93b5('0x50')](_0x93b5('0x74'));_0x5e0eda[_0x93b5('0x84')]=_0x93b5('0x9a');_0x5e0eda[_0x93b5('0x92')]=!![];_0x5e0eda[_0x93b5('0x9b')]=_0x93b5('0x9c');_0x5e0eda[_0x93b5('0x9d')]=_0x334b8f[_0x93b5('0x9e')];_0x5e0eda[_0x93b5('0x9f')]=_0x334b8f[_0x93b5('0x49')];logger[_0x93b5('0x78')](_0x93b5('0xa0'),_0x5e0eda[_0x93b5('0x4b')],_0x5e0eda[_0x93b5('0x52')]);var _0x1339f3=this[_0x93b5('0xf')][_0x334b8f[_0x93b5('0x96')]];this[_0x93b5('0xf')][_0x334b8f['linkedid']]=this['queueReports'][_0x334b8f['uniqueid']];this[_0x93b5('0xf')][_0x334b8f[_0x93b5('0x49')]]=_0x1339f3;}}else{_0x10fa31[_0x93b5('0x84')]=_0x93b5('0xa1')+_0x334b8f[_0x93b5('0x93')][_0x93b5('0xa2')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x10fa31[_0x93b5('0x4b')],_0x10fa31[_0x93b5('0x52')],_0x10fa31[_0x93b5('0x84')]);}}}this[_0x93b5('0x11')][_0x334b8f[_0x93b5('0x49')]]=_0x10fa31;this[_0x93b5('0x45')](_0x10fa31,_0x93b5('0x1e'));}}}catch(_0x1bb9b5){logger['error'](_0x93b5('0xa3'),_0x334b8f[_0x93b5('0x49')],util[_0x93b5('0x41')](_0x1bb9b5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x53ab9f){try{if(this[_0x93b5('0x71')](_0x53ab9f)){logger[_0x93b5('0x67')](_0x93b5('0xa4'),_0x53ab9f['uniqueid'],util[_0x93b5('0x41')](_0x53ab9f,{'showHidden':![],'depth':null}));this[_0x93b5('0xa5')](_0x53ab9f['uniqueid'],_[_0x93b5('0xa6')](_0x53ab9f[_0x93b5('0xa7')])[0x0],_0x53ab9f[_0x93b5('0xa8')]);if(this['queueReports'][_0x53ab9f[_0x93b5('0x49')]]){var _0x4c96ec=_['last'](this[_0x93b5('0xf')][_0x53ab9f[_0x93b5('0x49')]]);if(_0x4c96ec){if(this[_0x93b5('0x71')](_0x53ab9f['variable'])&&this[_0x93b5('0x71')](_0x53ab9f[_0x93b5('0xa7')]['queuestatus'])){switch(_0x53ab9f['value']){case _0x93b5('0xa9'):_0x4c96ec[_0x93b5('0x90')]=![];_0x4c96ec[_0x93b5('0x91')]=null;break;case _0x93b5('0xaa'):_0x4c96ec['lastevent']=_0x93b5('0xab');_0x4c96ec[_0x93b5('0x90')]=!![];_0x4c96ec[_0x93b5('0x91')]=moment()[_0x93b5('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c96ec[_0x93b5('0x88')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x93b5('0x67')](_0x93b5('0xac'),_0x53ab9f[_0x93b5('0x49')],util[_0x93b5('0x41')](_0x4c96ec,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x4c96ec);break;default:_0x4c96ec['queuecallerexit']=!![];_0x4c96ec['queuecallerexitAt']=moment()[_0x93b5('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c96ec[_0x93b5('0x88')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4c96ec['queuecallerabandon']=![];_0x4c96ec[_0x93b5('0x83')]=null;_0x4c96ec['queuecallerexitreason']=_0x53ab9f[_0x93b5('0xa8')];this[_0x93b5('0x11')][_0x53ab9f[_0x93b5('0x49')]]=_0x4c96ec;this[_0x93b5('0x45')](_0x4c96ec,_0x93b5('0x20'));}else if(this[_0x93b5('0x71')](_0x53ab9f[_0x93b5('0xa7')])&&this[_0x93b5('0x71')](_0x53ab9f[_0x93b5('0xa7')][_0x93b5('0xad')])){if(!_0x4c96ec[_0x93b5('0x82')]){_0x4c96ec['queuecallerexit']=!![];_0x4c96ec[_0x93b5('0x91')]=moment()[_0x93b5('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c96ec['queuecallerexitreason']=_0x93b5('0xae');_0x4c96ec[_0x93b5('0x88')]=moment()[_0x93b5('0x50')](_0x93b5('0x74'));this[_0x93b5('0x11')][_0x53ab9f['uniqueid']]=_0x4c96ec;}}logger[_0x93b5('0x78')](_0x93b5('0xaf'),_0x53ab9f['uniqueid'],_0x4c96ec[_0x93b5('0x4b')],_0x4c96ec['type'],_[_0x93b5('0xa6')](_0x53ab9f[_0x93b5('0xa7')])[0x0],_0x53ab9f[_0x93b5('0xa8')]);_0x4c96ec[_0x93b5('0x14')]=this['variables'][_0x53ab9f[_0x93b5('0x49')]];}}}}catch(_0x52ecba){logger[_0x93b5('0x3f')](_0x93b5('0xa4'),_0x53ab9f[_0x93b5('0x49')],util[_0x93b5('0x41')](_0x52ecba,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x93b5('0xb')][_0x93b5('0xa5')]=function(_0x34c6de,_0xcf3957,_0xc2550b){var _0x433a14=[_0x93b5('0xb0'),_0x93b5('0xb1'),_0x93b5('0xb2'),_0x93b5('0xb3'),_0x93b5('0xb4'),_0x93b5('0xb5'),_0x93b5('0xb6'),'rtpaudioqosrttbridged',_0x93b5('0xb7'),_0x93b5('0xb8'),_0x93b5('0xb9'),_0x93b5('0xba'),_0x93b5('0xbb'),_0x93b5('0xbc'),_0x93b5('0xbd'),_0x93b5('0xbe'),_0x93b5('0xbf'),_0x93b5('0xc0'),'memberrealtime'];if(!_['isNil'](_0xcf3957)&&!_[_0x93b5('0xc1')](_0x433a14,_0xcf3957)){if(_[_0x93b5('0x61')](this['variables'][_0x34c6de])){this[_0x93b5('0x14')][_0x34c6de]={};}this[_0x93b5('0x14')][_0x34c6de][_0xcf3957]=_0xc2550b;}};VoiceQueueReport['prototype']['syncHangup']=function(_0x31080f){try{if(this['isNotNull'](_0x31080f)){logger[_0x93b5('0x67')]('[%s][voiceQueueReport][hangup]',_0x31080f[_0x93b5('0x49')],util['inspect'](_0x31080f,{'showHidden':![],'depth':null}));if(this[_0x93b5('0xf')][_0x31080f['uniqueid']]){for(var _0x56fa08=0x0,_0x2f39da={};_0x56fa080x0?_0x49914b:0x0;this[_0xa477('0xe')][_0x12b028[_0xa477('0x70')]]['talking']=this[_0xa477('0xe')][_0x12b028[_0xa477('0x70')]][_0xa477('0x30')]>_['toNumber'](_0x12b028[_0xa477('0x76')])?_['toNumber'](_0x12b028[_0xa477('0x76')]):this[_0xa477('0xe')][_0x12b028[_0xa477('0x70')]][_0xa477('0x30')];this[_0xa477('0x56')](this['voiceQueues'][_0x12b028['queue']],_0xa477('0x6d'));}logger[_0xa477('0x4b')](_0xa477('0x78'),util['inspect'](this[_0xa477('0xe')][_0x12b028['queue']],{'showHidden':![],'depth':null}));ami['emit'](_0xa477('0x79'),this['voiceQueues'][_0x12b028['queue']]);}}}catch(_0x597ac1){logger[_0xa477('0x3f')](_0xa477('0x6f'),util[_0xa477('0x40')](_0x597ac1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa477('0x9')][_0xa477('0x14')]=function(_0x4283c1){logger['debug'](_0xa477('0x7a'),util[_0xa477('0x40')](_0x4283c1,{'showHidden':![],'depth':null}));this[_0xa477('0x6c')]=!![];};VoiceQueueReport['prototype'][_0xa477('0x15')]=function(_0x14a129){try{if(this[_0xa477('0x68')](_0x14a129)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x14a129['uniqueid'],util['inspect'](_0x14a129,{'showHidden':![],'depth':null}));if(_[_0xa477('0x69')](this[_0xa477('0x41')][_0x14a129[_0xa477('0x52')]]))this[_0xa477('0x41')][_0x14a129[_0xa477('0x52')]]=[];if(_[_0xa477('0x69')](this['channels'][_0x14a129[_0xa477('0x52')]]))this['channels'][_0x14a129[_0xa477('0x52')]]={};var _0x3383aa=new QueueReport();_0x3383aa[_0xa477('0x4f')]=_0x14a129[_0xa477('0x70')];_0x3383aa[_0xa477('0x5f')]=this[_0xa477('0xe')][_0x3383aa[_0xa477('0x4f')]]&&this[_0xa477('0xe')][_0x3383aa[_0xa477('0x4f')]]['type']?this[_0xa477('0xe')][_0x3383aa['name']][_0xa477('0x5f')]||'inbound':_0xa477('0x57');_0x3383aa['queue']=_0x14a129[_0xa477('0x70')];_0x3383aa[_0xa477('0x7b')]=moment()[_0xa477('0x4e')](_0xa477('0x7c'));_0x3383aa['position']=_0x14a129[_0xa477('0x7d')];_0x3383aa['count']=_0x14a129[_0xa477('0x7e')];_0x3383aa[_0xa477('0x52')]=_0x14a129['uniqueid'];_0x3383aa[_0xa477('0x7f')]=this[_0xa477('0x35')][_0x14a129[_0xa477('0x52')]][_0xa477('0x7f')];logger['info'](_0xa477('0x80'),_0x3383aa[_0xa477('0x4f')],_0x3383aa[_0xa477('0x5f')]);_[_0xa477('0x81')](_0x3383aa,_[_0xa477('0x82')](_0x14a129,_[_0xa477('0x83')](_0x3383aa)));this[_0xa477('0x41')][_0x14a129['uniqueid']][_0xa477('0x84')](_0x3383aa);this[_0xa477('0x35')][_0x14a129[_0xa477('0x52')]]=_0x3383aa;this[_0xa477('0x4a')](_0x3383aa,'queuecallerjoin');}}catch(_0x6ed50){logger[_0xa477('0x3f')](_0xa477('0x85'),_0x14a129[_0xa477('0x52')],util[_0xa477('0x40')](_0x6ed50,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa477('0x9')]['syncQueueCallerAbandon']=function(_0x4823d1){try{if(this[_0xa477('0x68')](_0x4823d1)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x4823d1[_0xa477('0x52')],util[_0xa477('0x40')](_0x4823d1,{'showHidden':![],'depth':null}));if(this[_0xa477('0x41')][_0x4823d1[_0xa477('0x52')]]){var _0x456aa6=_[_0xa477('0x86')](this[_0xa477('0x41')][_0x4823d1['uniqueid']]);_0x456aa6[_0xa477('0x87')]=![];_0x456aa6[_0xa477('0x88')]=null;_0x456aa6[_0xa477('0x89')]=_0x4823d1[_0xa477('0x89')];_0x456aa6['originalposition']=_0x4823d1[_0xa477('0x8a')];_0x456aa6[_0xa477('0x16')]=!![];_0x456aa6[_0xa477('0x8b')]=moment()[_0xa477('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x456aa6['queuecallerexitreason']=_0xa477('0x8c');_0x456aa6['lastAssignedTo']=null;logger[_0xa477('0x72')](_0xa477('0x8d'),_0x456aa6['name'],_0x456aa6[_0xa477('0x5f')]);this['channels'][_0x4823d1[_0xa477('0x52')]]=_0x456aa6;this['emitVoiceQueueChannelRemove'](_0x456aa6,_0xa477('0x16'));}}}catch(_0x5c76c9){logger[_0xa477('0x3f')](_0xa477('0x8e'),_0x4823d1[_0xa477('0x52')],util[_0xa477('0x40')](_0x5c76c9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x5a7b5b){try{if(this['isNotNull'](_0x5a7b5b)){logger[_0xa477('0x4b')]('[%s][voiceQueueReport][queuecallerleave]',_0x5a7b5b['uniqueid'],util[_0xa477('0x40')](_0x5a7b5b,{'showHidden':![],'depth':null}));if(this[_0xa477('0x41')][_0x5a7b5b[_0xa477('0x52')]]){var _0x3d2d8a=_['last'](this[_0xa477('0x41')][_0x5a7b5b[_0xa477('0x52')]]);_0x3d2d8a['queuecallerleaveAt']=moment()[_0xa477('0x4e')](_0xa477('0x7c'));_0x3d2d8a[_0xa477('0x8f')]=_0x5a7b5b[_0xa477('0x8f')];_0x3d2d8a[_0xa477('0x90')]=_0x5a7b5b[_0xa477('0x90')];logger[_0xa477('0x72')](_0xa477('0x91'),_0x3d2d8a[_0xa477('0x4f')],_0x3d2d8a[_0xa477('0x5f')],_0x5a7b5b[_0xa477('0x8f')],_0x5a7b5b['connectedlinename']);this[_0xa477('0x35')][_0x5a7b5b[_0xa477('0x52')]]=_0x3d2d8a;this[_0xa477('0x4a')](_0x3d2d8a,'queuecallerleave');}}}catch(_0x40b292){logger[_0xa477('0x3f')]('[%s][voiceQueueReport][queuecallerleave]',_0x5a7b5b['uniqueid'],util[_0xa477('0x40')](_0x40b292,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa477('0x9')][_0xa477('0x1d')]=function(_0x4cc3ff){try{if(this[_0xa477('0x68')](_0x4cc3ff)){logger[_0xa477('0x4b')](_0xa477('0x92'),_0x4cc3ff[_0xa477('0x52')],util[_0xa477('0x40')](_0x4cc3ff,{'showHidden':![],'depth':null}));if(this[_0xa477('0x41')][_0x4cc3ff[_0xa477('0x52')]]){var _0x14d966=_[_0xa477('0x86')](this['queueReports'][_0x4cc3ff[_0xa477('0x52')]]);_0x14d966[_0xa477('0x87')]=!![];_0x14d966[_0xa477('0x93')]=_0xa477('0x94');logger['info'](_0xa477('0x95'),_0x14d966[_0xa477('0x4f')],_0x14d966['type']);}}}catch(_0x450c7e){logger[_0xa477('0x3f')](_0xa477('0x92'),_0x4cc3ff[_0xa477('0x52')],util[_0xa477('0x40')](_0x450c7e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xa477('0x1b')]=function(_0x2a433b){try{if(this[_0xa477('0x68')](_0x2a433b)){logger['debug'](_0xa477('0x96'),_0x2a433b[_0xa477('0x52')],util['inspect'](_0x2a433b,{'showHidden':![],'depth':null}));if(this[_0xa477('0x41')][_0x2a433b[_0xa477('0x52')]]){var _0x2401cd=_[_0xa477('0x86')](this[_0xa477('0x41')][_0x2a433b[_0xa477('0x52')]]);_0x2401cd[_0xa477('0x16')]=![];_0x2401cd[_0xa477('0x8b')]=null;_0x2401cd['assigned']=!![];_0x2401cd[_0xa477('0x97')]=_0x2a433b[_0xa477('0x98')];_0x2401cd[_0xa477('0x89')]=_0x2a433b[_0xa477('0x89')];_0x2401cd[_0xa477('0x87')]=!![];_0x2401cd[_0xa477('0x99')]=![];_0x2401cd[_0xa477('0x9a')]=null;if(!_0x2401cd[_0xa477('0x9b')]){if(_0x2a433b[_0xa477('0x9c')]=='transfer'){_0x2401cd['queuecallerexitreason']=_0xa477('0x9d');logger[_0xa477('0x72')](_0xa477('0x9e'),_0x2401cd[_0xa477('0x4f')],_0x2401cd['type']);}else{if(_[_0xa477('0x9f')](_0x2a433b[_0xa477('0x3b')][_0xa477('0xa0')](),_0xa477('0xa1'))){if(this[_0xa477('0x41')][_0x2a433b[_0xa477('0xa2')]]){var _0x50780d=_[_0xa477('0x86')](this[_0xa477('0x41')][_0x2a433b[_0xa477('0xa2')]]);_0x50780d[_0xa477('0x87')]=![];_0x50780d[_0xa477('0x99')]=!![];_0x50780d[_0xa477('0x9a')]=moment(_0x2401cd[_0xa477('0x7b')])['add'](_0x2a433b[_0xa477('0x89')],_0xa477('0xa3'))[_0xa477('0x4e')](_0xa477('0x7c'));_0x50780d[_0xa477('0x93')]=_0xa477('0xa4');_0x50780d[_0xa477('0x9b')]=!![];_0x50780d[_0xa477('0xa5')]=_0xa477('0xa6');_0x50780d[_0xa477('0xa7')]=_0x2a433b[_0xa477('0xa8')];_0x50780d[_0xa477('0xa9')]=_0x2a433b[_0xa477('0x52')];logger[_0xa477('0x72')](_0xa477('0xaa'),_0x50780d[_0xa477('0x4f')],_0x50780d[_0xa477('0x5f')]);var _0x49d721=this[_0xa477('0x41')][_0x2a433b[_0xa477('0xa2')]];this['queueReports'][_0x2a433b['linkedid']]=this['queueReports'][_0x2a433b[_0xa477('0x52')]];this[_0xa477('0x41')][_0x2a433b[_0xa477('0x52')]]=_0x49d721;}}else{_0x2401cd[_0xa477('0x93')]=_0xa477('0xab')+_0x2a433b[_0xa477('0x9c')][_0xa477('0xac')]();logger[_0xa477('0x72')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x2401cd[_0xa477('0x4f')],_0x2401cd[_0xa477('0x5f')],_0x2401cd['queuecallerexitreason']);}}}this['channels'][_0x2a433b[_0xa477('0x52')]]=_0x2401cd;this['emitVoiceQueueChannelRemove'](_0x2401cd,'agentcomplete');}}}catch(_0x1d43aa){logger[_0xa477('0x3f')](_0xa477('0x96'),_0x2a433b[_0xa477('0x52')],util[_0xa477('0x40')](_0x1d43aa,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa477('0x9')][_0xa477('0x1f')]=function(_0x35af51){try{if(this['isNotNull'](_0x35af51)){logger[_0xa477('0x4b')]('[%s][voiceQueueReport][varset]',_0x35af51[_0xa477('0x52')],util[_0xa477('0x40')](_0x35af51,{'showHidden':![],'depth':null}));this[_0xa477('0xad')](_0x35af51[_0xa477('0x52')],_['keys'](_0x35af51[_0xa477('0xae')])[0x0],_0x35af51[_0xa477('0xaf')]);if(this[_0xa477('0x41')][_0x35af51[_0xa477('0x52')]]){var _0x13f61b=_[_0xa477('0x86')](this['queueReports'][_0x35af51[_0xa477('0x52')]]);if(_0x13f61b){if(this[_0xa477('0x68')](_0x35af51['variable'])&&this[_0xa477('0x68')](_0x35af51['variable'][_0xa477('0xb0')])){switch(_0x35af51[_0xa477('0xaf')]){case _0xa477('0xb1'):_0x13f61b[_0xa477('0x99')]=![];_0x13f61b['queuecallerexitAt']=null;break;case'TIMEOUT':_0x13f61b['lastevent']=_0xa477('0xb2');_0x13f61b[_0xa477('0x99')]=!![];_0x13f61b[_0xa477('0x9a')]=moment()[_0xa477('0x4e')](_0xa477('0x7c'));_0x13f61b[_0xa477('0xb3')]=moment()[_0xa477('0x4e')](_0xa477('0x7c'));logger[_0xa477('0x4b')](_0xa477('0xb4'),_0x35af51['uniqueid'],util[_0xa477('0x40')](_0x13f61b,{'showHidden':![],'depth':null}));ami[_0xa477('0x49')](_0xa477('0xb5'),_0x13f61b);break;default:_0x13f61b[_0xa477('0x99')]=!![];_0x13f61b[_0xa477('0x9a')]=moment()[_0xa477('0x4e')](_0xa477('0x7c'));_0x13f61b['queuecallerleaveAt']=moment()[_0xa477('0x4e')](_0xa477('0x7c'));}_0x13f61b['queuecallerabandon']=![];_0x13f61b[_0xa477('0x8b')]=null;_0x13f61b[_0xa477('0x93')]=_0x35af51[_0xa477('0xaf')];this[_0xa477('0x35')][_0x35af51[_0xa477('0x52')]]=_0x13f61b;this['emitVoiceQueueChannelRemove'](_0x13f61b,_0xa477('0x1e'));}else if(this[_0xa477('0x68')](_0x35af51[_0xa477('0xae')])&&this[_0xa477('0x68')](_0x35af51[_0xa477('0xae')][_0xa477('0xb6')])){if(!_0x13f61b[_0xa477('0x16')]){_0x13f61b[_0xa477('0x99')]=!![];_0x13f61b[_0xa477('0x9a')]=moment()[_0xa477('0x4e')](_0xa477('0x7c'));_0x13f61b[_0xa477('0x93')]='EXITWITHKEY';_0x13f61b[_0xa477('0xb3')]=moment()[_0xa477('0x4e')](_0xa477('0x7c'));this['channels'][_0x35af51['uniqueid']]=_0x13f61b;}}logger[_0xa477('0x72')](_0xa477('0xb7'),_0x35af51[_0xa477('0x52')],_0x13f61b[_0xa477('0x4f')],_0x13f61b[_0xa477('0x5f')],_[_0xa477('0x83')](_0x35af51['variable'])[0x0],_0x35af51['value']);_0x13f61b[_0xa477('0x10')]=this[_0xa477('0x10')][_0x35af51[_0xa477('0x52')]];}}}}catch(_0x2afec8){logger[_0xa477('0x3f')](_0xa477('0xb8'),_0x35af51[_0xa477('0x52')],util[_0xa477('0x40')](_0x2afec8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xa477('0xad')]=function(_0x4962a5,_0x40d7a4,_0x10d553){var _0x5af5f3=[_0xa477('0xb9'),_0xa477('0xba'),_0xa477('0xbb'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0xa477('0xbc'),_0xa477('0xbd'),_0xa477('0xbe'),_0xa477('0xbf'),'sipuri','bridgepeer',_0xa477('0xc0'),'membercalls','memberdynamic',_0xa477('0xc1'),_0xa477('0xc2'),_0xa477('0x98'),'memberpenalty',_0xa477('0xc3')];if(!_['isNil'](_0x40d7a4)&&!_[_0xa477('0xc4')](_0x5af5f3,_0x40d7a4)){if(_[_0xa477('0x69')](this[_0xa477('0x10')][_0x4962a5])){this[_0xa477('0x10')][_0x4962a5]={};}this[_0xa477('0x10')][_0x4962a5][_0x40d7a4]=_0x10d553;}};VoiceQueueReport[_0xa477('0x9')][_0xa477('0x21')]=function(_0x98652d){try{if(this[_0xa477('0x68')](_0x98652d)){logger['debug']('[%s][voiceQueueReport][hangup]',_0x98652d['uniqueid'],util[_0xa477('0x40')](_0x98652d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x98652d[_0xa477('0x52')]]){for(var _0x17eace=0x0,_0x5f1a16={};_0x17eace=0x0?moment(_0x325fe3[_0x6038('0x16')])[_0x6038('0x17')](_0x325fe3[_0x6038('0x15')],_0x6038('0x18')):null,'data1':_0x6038('0x19'),'data2':_0x325fe3[_0x6038('0xf')],'data3':_0x325fe3['exten'],'data4':_0x325fe3[_0x6038('0x1a')]||null,'role':_0x6038('0xe'),'internal':_0x325fe3[_0x6038('0xf')]?_[_0x6038('0x10')](_0x325fe3[_0x6038('0xf')]):undefined,'uniqueid':_0x325fe3[_0x6038('0x11')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x7bc1=['queuecallercompleteAt','Request','CreateMemberReport','isNil','SIP/%s','lastAssignedTo','interface','queuecallerleaveAt','diff','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','voiceDialReport','voice','membername','TALKING','starttime','endtime','seconds','dialstring','moment','lodash','../client','voiceQueueReport'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7bc1,0x114));var _0x17bc=function(_0x5a1f78,_0x16c0f0){_0x5a1f78=_0x5a1f78-0x0;var _0x25366e=_0x7bc1[_0x5a1f78];return _0x25366e;};'use strict';var moment=require(_0x17bc('0x0'));var _=require(_0x17bc('0x1'));var util=require('util');var client=require(_0x17bc('0x2'));exports[_0x17bc('0x3')]=function(_0x179d69){var _0x318a52=_0x179d69[_0x17bc('0x4')]||_0x179d69['queuecallerexitAt'];return client[_0x17bc('0x5')](_0x17bc('0x6'),{'body':{'channel':'voice','membername':_0x179d69['lastAssignedTo'],'interface':_[_0x17bc('0x7')](_0x179d69['interface'])?util['format'](_0x17bc('0x8'),_0x179d69[_0x17bc('0x9')]):_0x179d69[_0x17bc('0xa')],'type':'TALKING','enterAt':_0x179d69[_0x17bc('0xb')],'exitAt':_0x318a52,'duration':moment(_0x318a52)[_0x17bc('0xc')](_0x179d69[_0x17bc('0xb')],'seconds'),'data1':_0x17bc('0xd'),'data2':_0x179d69[_0x17bc('0xe')],'data3':_0x179d69[_0x17bc('0xf')],'data4':null,'data5':_0x179d69[_0x17bc('0x10')],'role':_0x17bc('0x11'),'internal':_0x179d69[_0x17bc('0x12')]?_[_0x17bc('0x13')](_0x179d69[_0x17bc('0x12')]):undefined,'uniqueid':_0x179d69['uniqueid']},'log':_0x17bc('0x6')});};exports[_0x17bc('0x14')]=function(_0x171f7e){return client['Request'](_0x17bc('0x6'),{'body':{'channel':_0x17bc('0x15'),'membername':_0x171f7e[_0x17bc('0x16')],'interface':_0x171f7e[_0x17bc('0xa')],'type':_0x17bc('0x17'),'enterAt':_0x171f7e[_0x17bc('0x18')],'exitAt':_0x171f7e[_0x17bc('0x19')],'duration':moment(_0x171f7e[_0x17bc('0x19')])['diff'](_0x171f7e[_0x17bc('0x18')],'seconds')>=0x0?moment(_0x171f7e['endtime'])[_0x17bc('0xc')](_0x171f7e['starttime'],_0x17bc('0x1a')):null,'data1':'outbound','data2':_0x171f7e[_0x17bc('0x12')],'data3':_0x171f7e[_0x17bc('0xf')],'data4':_0x171f7e[_0x17bc('0x1b')]||null,'role':_0x17bc('0x11'),'internal':_0x171f7e[_0x17bc('0x12')]?_[_0x17bc('0x13')](_0x171f7e['accountcode']):undefined,'uniqueid':_0x171f7e['uniqueid']},'log':_0x17bc('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index b417eec..942e51d 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 _0x5b02=['ShowSetting','../client','getSettings','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b02,0xe9));var _0x25b0=function(_0x37f9d7,_0xace53b){_0x37f9d7=_0x37f9d7-0x0;var _0x198f7d=_0x5b02[_0x37f9d7];return _0x198f7d;};'use strict';var client=require(_0x25b0('0x0'));exports[_0x25b0('0x1')]=function(){return client[_0x25b0('0x2')](_0x25b0('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':'GetSettings'});}; \ No newline at end of file +var _0xbe99=['stopRecordingOnTransfer','../client','getSettings','Request','ShowSetting'];(function(_0x24507f,_0x239ee0){var _0x28adaa=function(_0x3cccf9){while(--_0x3cccf9){_0x24507f['push'](_0x24507f['shift']());}};_0x28adaa(++_0x239ee0);}(_0xbe99,0x196));var _0x9be9=function(_0x46b579,_0x566d72){_0x46b579=_0x46b579-0x0;var _0x373a12=_0xbe99[_0x46b579];return _0x373a12;};'use strict';var client=require(_0x9be9('0x0'));exports[_0x9be9('0x1')]=function(){return client[_0x9be9('0x2')](_0x9be9('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9be9('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 8d5a6d4..b2e5d7d 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 _0x9db7=['getTemplates','GetTemplate','html','../client'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x9db7,0x1bf));var _0x79db=function(_0x5e0d09,_0x114c2e){_0x5e0d09=_0x5e0d09-0x0;var _0x2b48a8=_0x9db7[_0x5e0d09];return _0x2b48a8;};'use strict';var client=require(_0x79db('0x0'));exports[_0x79db('0x1')]=function(_0x435fde){return function(_0x5ded0a){return client['Request'](_0x79db('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x79db('0x3')]},'log':_0x79db('0x2')});};}; \ No newline at end of file +var _0x9eef=['getTemplates','Request','name','GetTemplate','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9eef,0x103));var _0xf9ee=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x9eef[_0x34843e];return _0x598f7f;};'use strict';var client=require(_0xf9ee('0x0'));exports[_0xf9ee('0x1')]=function(_0x45b4fc){return function(_0x23b67c){return client[_0xf9ee('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xf9ee('0x3'),'html']},'log':_0xf9ee('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index f3b5152..32ec357 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 _0xb71f=['field','operator','Condition','value','action','data1','data3','data4','data5','GetTrigger','../client','getTriggers','Request','name','channel','status','AllConditions'];(function(_0x174852,_0x556334){var _0x553df1=function(_0x112dab){while(--_0x112dab){_0x174852['push'](_0x174852['shift']());}};_0x553df1(++_0x556334);}(_0xb71f,0x13c));var _0xfb71=function(_0x1c5142,_0x30ea72){_0x1c5142=_0x1c5142-0x0;var _0x1268cb=_0xb71f[_0x1c5142];return _0x1268cb;};'use strict';var client=require(_0xfb71('0x0'));exports[_0xfb71('0x1')]=function(_0x2f01e5){return function(_0x5ab981){return client[_0xfb71('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xfb71('0x3'),_0xfb71('0x4'),_0xfb71('0x5')],'include':[{'model':'Condition','as':_0xfb71('0x6'),'attributes':['id',_0xfb71('0x7'),_0xfb71('0x8'),'value']},{'model':_0xfb71('0x9'),'as':'AnyConditions','attributes':['id','field',_0xfb71('0x8'),_0xfb71('0xa')]},{'model':'Action','as':'Actions','attributes':['id',_0xfb71('0xb'),_0xfb71('0xc'),'data2',_0xfb71('0xd'),_0xfb71('0xe'),_0xfb71('0xf'),'data6','data7']}]},'log':_0xfb71('0x10')});};}; \ No newline at end of file +var _0xa61f=['data1','data2','data3','data4','data6','data7','../client','getTriggers','Request','GetTrigger','name','status','Condition','AllConditions','field','operator','value','Actions','action'];(function(_0x5da4d8,_0x31cca6){var _0x354518=function(_0x1abe20){while(--_0x1abe20){_0x5da4d8['push'](_0x5da4d8['shift']());}};_0x354518(++_0x31cca6);}(_0xa61f,0x123));var _0xfa61=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa61f[_0x2641f9];return _0x585741;};'use strict';var client=require(_0xfa61('0x0'));exports[_0xfa61('0x1')]=function(_0x43ee7e){return function(_0x82c0dd){return client[_0xfa61('0x2')](_0xfa61('0x3'),{'options':{'raw':![],'attributes':['id',_0xfa61('0x4'),'channel',_0xfa61('0x5')],'include':[{'model':_0xfa61('0x6'),'as':_0xfa61('0x7'),'attributes':['id',_0xfa61('0x8'),_0xfa61('0x9'),_0xfa61('0xa')]},{'model':_0xfa61('0x6'),'as':'AnyConditions','attributes':['id','field','operator',_0xfa61('0xa')]},{'model':'Action','as':_0xfa61('0xb'),'attributes':['id',_0xfa61('0xc'),_0xfa61('0xd'),_0xfa61('0xe'),_0xfa61('0xf'),_0xfa61('0x10'),'data5',_0xfa61('0x11'),_0xfa61('0x12')]}]},'log':_0xfa61('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 6f162b9..b5097c2 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 _0x59e5=['Request','name','GetTrunk','../client','getTrunks'];(function(_0x3366bd,_0x242f71){var _0x540757=function(_0x193457){while(--_0x193457){_0x3366bd['push'](_0x3366bd['shift']());}};_0x540757(++_0x242f71);}(_0x59e5,0x14d));var _0x559e=function(_0x4e17c6,_0x122092){_0x4e17c6=_0x4e17c6-0x0;var _0x5d5e96=_0x59e5[_0x4e17c6];return _0x5d5e96;};'use strict';var client=require(_0x559e('0x0'));exports[_0x559e('0x1')]=function(_0x30705c){return function(_0x190256){return client[_0x559e('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x559e('0x3'),'registry','defaultuser']},'log':_0x559e('0x4')});};}; \ No newline at end of file +var _0xee1f=['GetTrunk','name','registry','../client','Request'];(function(_0x21553d,_0x24a9ba){var _0x29f8c6=function(_0xf615d7){while(--_0xf615d7){_0x21553d['push'](_0x21553d['shift']());}};_0x29f8c6(++_0x24a9ba);}(_0xee1f,0x198));var _0xfee1=function(_0x1e7664,_0x42a224){_0x1e7664=_0x1e7664-0x0;var _0x1e92c7=_0xee1f[_0x1e7664];return _0x1e92c7;};'use strict';var client=require(_0xfee1('0x0'));exports['getTrunks']=function(_0x5e8c9a){return function(_0x1133fb){return client[_0xfee1('0x1')](_0xfee1('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xfee1('0x3'),_0xfee1('0x4'),'defaultuser']},'log':_0xfee1('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index e15599c..82b9ae5 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 _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x1e711d,_0x434a16){var _0x159ee8=function(_0x3f3ae4){while(--_0x3f3ae4){_0x1e711d['push'](_0x1e711d['shift']());}};_0x159ee8(++_0x434a16);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file +var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x2889b6,_0x558a66){var _0x79991d=function(_0x43251a){while(--_0x43251a){_0x2889b6['push'](_0x2889b6['shift']());}};_0x79991d(++_0x558a66);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x495e9f,_0x1b1d80){_0x495e9f=_0x495e9f-0x0;var _0xb249d2=_0xcb91[_0x495e9f];return _0xb249d2;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 1796478..25189a8 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 _0x37eb=['../client','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x4d6ca1,_0x1cb01b){var _0x3ab38d=function(_0xcddcd9){while(--_0xcddcd9){_0x4d6ca1['push'](_0x4d6ca1['shift']());}};_0x3ab38d(++_0x1cb01b);}(_0x37eb,0x1e0));var _0xb37e=function(_0x387620,_0x7e5560){_0x387620=_0x387620-0x0;var _0x4cfcef=_0x37eb[_0x387620];return _0x4cfcef;};'use strict';var client=require(_0xb37e('0x0'));exports['create']=function(_0x2c1e59){return client[_0xb37e('0x1')]('CreateVoiceAgentReport',{'body':_0x2c1e59,'log':_0xb37e('0x2')});};exports[_0xb37e('0x3')]=function(_0x37f959,_0x4b59c0,_0x529946){return client['Request'](_0xb37e('0x4'),{'body':_0x37f959,'options':{'where':{'uniqueid':_0x4b59c0,'interface':_0x529946,'agentcomplete':!![]}},'log':_0xb37e('0x4')});}; \ No newline at end of file +var _0x4f29=['update','Request','UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport'];(function(_0x115a0f,_0x46c0ae){var _0x2b53a0=function(_0x5ad110){while(--_0x5ad110){_0x115a0f['push'](_0x115a0f['shift']());}};_0x2b53a0(++_0x46c0ae);}(_0x4f29,0x129));var _0x94f2=function(_0x1cd338,_0xc61c22){_0x1cd338=_0x1cd338-0x0;var _0x2b5b57=_0x4f29[_0x1cd338];return _0x2b5b57;};'use strict';var client=require(_0x94f2('0x0'));exports[_0x94f2('0x1')]=function(_0x1af854){return client['Request']('CreateVoiceAgentReport',{'body':_0x1af854,'log':_0x94f2('0x2')});};exports[_0x94f2('0x3')]=function(_0x511163,_0x3357c4,_0x2a46c8){return client[_0x94f2('0x4')](_0x94f2('0x5'),{'body':_0x511163,'options':{'where':{'uniqueid':_0x3357c4,'interface':_0x2a46c8,'agentcomplete':!![]}},'log':_0x94f2('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index cd97722..5b7643f 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 _0xe819=['context','Request','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','GetVoiceCallReports','moment','util','lodash','../client','create','CreateVoiceCallReport','merge'];(function(_0x45eec9,_0x2ee4db){var _0x12794d=function(_0x2c5971){while(--_0x2c5971){_0x45eec9['push'](_0x45eec9['shift']());}};_0x12794d(++_0x2ee4db);}(_0xe819,0xf0));var _0x9e81=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe819[_0x501510];return _0x1e6ee5;};'use strict';var moment=require(_0x9e81('0x0'));var util=require(_0x9e81('0x1'));var _=require(_0x9e81('0x2'));var client=require(_0x9e81('0x3'));exports[_0x9e81('0x4')]=function(_0x3bf512){return client['Request'](_0x9e81('0x5'),{'body':_[_0x9e81('0x6')](_0x3bf512,{'source':_0x3bf512['calleridnum'],'destinationcontext':_0x3bf512[_0x9e81('0x7')],'callerid':_0x3bf512['callerid'],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0x9e81('0x8')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x9e81('0x9')],'createdAt':{'$between':[moment()[_0x9e81('0xa')](_0x9e81('0xb'))[_0x9e81('0xc')](_0x9e81('0xd')),moment()[_0x9e81('0xe')](_0x9e81('0xb'))[_0x9e81('0xc')](_0x9e81('0xd'))]}},'attributes':[_0x9e81('0xf'),_0x9e81('0x10'),_0x9e81('0x11'),'billableseconds']},'log':_0x9e81('0x12')});};}; \ No newline at end of file +var _0x4426=['calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','endOf','format','YYYY-MM-DD\x20HH:mm:ss','billableseconds','moment','util','create','Request','CreateVoiceCallReport','merge'];(function(_0x50ff09,_0x53dee2){var _0x549b1f=function(_0x1f4676){while(--_0x1f4676){_0x50ff09['push'](_0x50ff09['shift']());}};_0x549b1f(++_0x53dee2);}(_0x4426,0x163));var _0x6442=function(_0x3677ad,_0xd3eb75){_0x3677ad=_0x3677ad-0x0;var _0x1efb79=_0x4426[_0x3677ad];return _0x1efb79;};'use strict';var moment=require(_0x6442('0x0'));var util=require(_0x6442('0x1'));var _=require('lodash');var client=require('../client');exports[_0x6442('0x2')]=function(_0x3965b4){return client[_0x6442('0x3')](_0x6442('0x4'),{'body':_[_0x6442('0x5')](_0x3965b4,{'source':_0x3965b4[_0x6442('0x6')],'destinationcontext':_0x3965b4[_0x6442('0x7')],'callerid':_0x3965b4[_0x6442('0x8')],'amaflags':_0x6442('0x9')}),'log':_0x6442('0x4')});};exports[_0x6442('0xa')]=function(){return function(){return client[_0x6442('0x3')](_0x6442('0xb'),{'options':{'where':{'type':[_0x6442('0xc')],'createdAt':{'$between':[moment()[_0x6442('0xd')](_0x6442('0xe'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x6442('0xf')](_0x6442('0xe'))[_0x6442('0x10')](_0x6442('0x11'))]}},'attributes':['type','disposition','duration',_0x6442('0x12')]},'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 e7ceddb..69c89e7 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 _0xb111=['CreateVoiceDialReport','../client','create'];(function(_0x101a17,_0x5d047a){var _0x3b76ee=function(_0x89be1b){while(--_0x89be1b){_0x101a17['push'](_0x101a17['shift']());}};_0x3b76ee(++_0x5d047a);}(_0xb111,0x1a2));var _0x1b11=function(_0x15e3df,_0x324630){_0x15e3df=_0x15e3df-0x0;var _0x8b00da=_0xb111[_0x15e3df];return _0x8b00da;};'use strict';var client=require(_0x1b11('0x0'));exports[_0x1b11('0x1')]=function(_0x49ae34){return client['Request'](_0x1b11('0x2'),{'body':_0x49ae34,'log':_0x1b11('0x2')});}; \ No newline at end of file +var _0xc265=['create','Request','CreateVoiceDialReport','../client'];(function(_0x57e2b7,_0x54d1a5){var _0x3de3dc=function(_0x2309a9){while(--_0x2309a9){_0x57e2b7['push'](_0x57e2b7['shift']());}};_0x3de3dc(++_0x54d1a5);}(_0xc265,0xcf));var _0x5c26=function(_0x2c9ad0,_0x5986c0){_0x2c9ad0=_0x2c9ad0-0x0;var _0x49f8cb=_0xc265[_0x2c9ad0];return _0x49f8cb;};'use strict';var client=require(_0x5c26('0x0'));exports[_0x5c26('0x1')]=function(_0x46a219){return client[_0x5c26('0x2')](_0x5c26('0x3'),{'body':_0x46a219,'log':_0x5c26('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 48a60bd..376a61f 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 _0x81d5=['exten','recordingFormat','../client','getVoiceExtensions','GetVoiceExtension'];(function(_0x45494d,_0x4c7bb3){var _0x22872d=function(_0x19c9a9){while(--_0x19c9a9){_0x45494d['push'](_0x45494d['shift']());}};_0x22872d(++_0x4c7bb3);}(_0x81d5,0x1ab));var _0x581d=function(_0x14e6f8,_0x1de5c2){_0x14e6f8=_0x14e6f8-0x0;var _0x4f6daa=_0x81d5[_0x14e6f8];return _0x4f6daa;};'use strict';var client=require(_0x581d('0x0'));exports[_0x581d('0x1')]=function(){return function(){return client['Request'](_0x581d('0x2'),{'options':{'raw':!![],'attributes':['id',_0x581d('0x3'),_0x581d('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x581d('0x1')});};}; \ No newline at end of file +var _0xaf80=['getVoiceExtensions','Request','GetVoiceExtension','../client'];(function(_0x5c9c6f,_0x5f2d8b){var _0x52d8a6=function(_0x1d4210){while(--_0x1d4210){_0x5c9c6f['push'](_0x5c9c6f['shift']());}};_0x52d8a6(++_0x5f2d8b);}(_0xaf80,0x1ef));var _0x0af8=function(_0x2059df,_0x1f0399){_0x2059df=_0x2059df-0x0;var _0x4ccf93=_0xaf80[_0x2059df];return _0x4ccf93;};'use strict';var client=require(_0x0af8('0x0'));exports[_0x0af8('0x1')]=function(){return function(){return client[_0x0af8('0x2')](_0x0af8('0x3'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'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 1654b4e..c22c578 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 _0xf66a=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','getVoiceQueues','Request','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency'];(function(_0x428018,_0x2e3229){var _0x49fefa=function(_0x3dacdc){while(--_0x3dacdc){_0x428018['push'](_0x428018['shift']());}};_0x49fefa(++_0x2e3229);}(_0xf66a,0x6e));var _0xaf66=function(_0x1ceaca,_0x19dbe7){_0x1ceaca=_0x1ceaca-0x0;var _0x5b4a51=_0xf66a[_0x1ceaca];return _0x5b4a51;};'use strict';var client=require('../client');exports[_0xaf66('0x0')]=function(){return function(){return client[_0xaf66('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0xaf66('0x2'),_0xaf66('0x3'),_0xaf66('0x4'),_0xaf66('0x5'),_0xaf66('0x6'),_0xaf66('0x7'),_0xaf66('0x8'),_0xaf66('0x9'),_0xaf66('0xa'),_0xaf66('0xb'),'dialPredictiveOptimization',_0xaf66('0xc'),'dialPredictiveInterval',_0xaf66('0xd'),_0xaf66('0xe'),'dialOriginateTimeout','dialQueueOptions',_0xaf66('0xf'),_0xaf66('0x10'),'dialCongestionMaxRetry',_0xaf66('0x11'),_0xaf66('0x12'),_0xaf66('0x13'),_0xaf66('0x14'),'dialNoAnswerRetryFrequency',_0xaf66('0x15'),_0xaf66('0x16'),_0xaf66('0x17'),_0xaf66('0x18'),_0xaf66('0x19'),_0xaf66('0x1a'),_0xaf66('0x1b'),_0xaf66('0x1c'),_0xaf66('0x1d'),_0xaf66('0x1e'),_0xaf66('0x1f'),_0xaf66('0x20'),_0xaf66('0x21'),_0xaf66('0x22'),_0xaf66('0x23'),_0xaf66('0x24'),_0xaf66('0x25'),_0xaf66('0x26'),_0xaf66('0x27'),_0xaf66('0x28'),_0xaf66('0x29'),_0xaf66('0x2a'),_0xaf66('0x5'),_0xaf66('0x2b'),_0xaf66('0x2c'),'dialCutDigit',_0xaf66('0x2d'),_0xaf66('0x2e'),_0xaf66('0x2f'),_0xaf66('0x30'),'dialAbandonedMaxRetry',_0xaf66('0x31'),_0xaf66('0x32'),_0xaf66('0x33'),_0xaf66('0x34'),_0xaf66('0x35'),'mandatoryDisposition',_0xaf66('0x36'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0xaf66('0x37'),'as':_0xaf66('0x37'),'attributes':['id',_0xaf66('0x38'),_0xaf66('0x39'),_0xaf66('0x3a')]},{'model':_0xaf66('0x3b'),'as':_0xaf66('0x3c'),'attributes':['id','name']},{'model':_0xaf66('0x37'),'as':_0xaf66('0x3d'),'attributes':['id','name',_0xaf66('0x39'),'active']},{'model':_0xaf66('0x3e'),'as':'Interval','attributes':['id',_0xaf66('0x38')],'include':[{'model':_0xaf66('0x3e'),'as':_0xaf66('0x3f'),'attributes':['id',_0xaf66('0x38'),'interval']}]}]},'log':_0xaf66('0x0')});};}; \ No newline at end of file +var _0x0d00=['type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause'];(function(_0x352547,_0x47c5a4){var _0x47b4be=function(_0x6ed883){while(--_0x6ed883){_0x352547['push'](_0x352547['shift']());}};_0x47b4be(++_0x47c5a4);}(_0x0d00,0x138));var _0x00d0=function(_0x539533,_0x59b89b){_0x539533=_0x539533-0x0;var _0x3942f3=_0x0d00[_0x539533];return _0x3942f3;};'use strict';var client=require(_0x00d0('0x0'));exports[_0x00d0('0x1')]=function(){return function(){return client[_0x00d0('0x2')](_0x00d0('0x3'),{'options':{'raw':![],'attributes':['id',_0x00d0('0x4'),_0x00d0('0x5'),_0x00d0('0x6'),_0x00d0('0x7'),'monitor_format',_0x00d0('0x8'),'dialActive',_0x00d0('0x9'),_0x00d0('0xa'),_0x00d0('0xb'),_0x00d0('0xc'),_0x00d0('0xd'),_0x00d0('0xe'),'dialPredictiveInterval',_0x00d0('0xf'),_0x00d0('0x10'),_0x00d0('0x11'),_0x00d0('0x12'),'dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry',_0x00d0('0x13'),_0x00d0('0x14'),_0x00d0('0x15'),_0x00d0('0x16'),_0x00d0('0x17'),_0x00d0('0x18'),_0x00d0('0x19'),_0x00d0('0x1a'),_0x00d0('0x1b'),_0x00d0('0x1c'),_0x00d0('0x1d'),_0x00d0('0x1e'),_0x00d0('0x1f'),_0x00d0('0x20'),_0x00d0('0x21'),_0x00d0('0x22'),'dialAMDBetweenWordsSilence',_0x00d0('0x23'),_0x00d0('0x24'),_0x00d0('0x25'),_0x00d0('0x26'),_0x00d0('0x27'),_0x00d0('0x28'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0x00d0('0x29'),'dialQueueProject2',_0x00d0('0x2a'),_0x00d0('0x2b'),_0x00d0('0x2c'),_0x00d0('0x2d'),_0x00d0('0x2e'),_0x00d0('0x2f'),_0x00d0('0x30'),'dialDropRetryFrequency',_0x00d0('0x31'),_0x00d0('0x32'),'dialMachineMaxRetry',_0x00d0('0x33'),_0x00d0('0x34'),_0x00d0('0x35'),_0x00d0('0x36'),_0x00d0('0x37'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':_0x00d0('0x38'),'attributes':['id','name',_0x00d0('0x39'),_0x00d0('0x3a')]},{'model':_0x00d0('0x3b'),'as':'mandatoryDispositionPause','attributes':['id',_0x00d0('0x4')]},{'model':_0x00d0('0x38'),'as':_0x00d0('0x3c'),'attributes':['id',_0x00d0('0x4'),_0x00d0('0x39'),_0x00d0('0x3a')]},{'model':_0x00d0('0x3d'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0x00d0('0x3d'),'as':_0x00d0('0x3e'),'attributes':['id','name',_0x00d0('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 014cd8e..93d7f52 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(_0x555748,_0x4c6ba4){var _0x2d43fe=function(_0x36f5ad){while(--_0x36f5ad){_0x555748['push'](_0x555748['shift']());}};_0x2d43fe(++_0x4c6ba4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x4abc6e,_0x29d432){var _0x41d658=function(_0x8afa28){while(--_0x8afa28){_0x4abc6e['push'](_0x4abc6e['shift']());}};_0x41d658(++_0x29d432);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 171b946..53969d0 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 _0x505b=['getVoiceQueueRtPauses','../client','Request','GetVoiceQueueRtPauses'];(function(_0x1fc716,_0x263857){var _0x637fd3=function(_0x1fbfeb){while(--_0x1fbfeb){_0x1fc716['push'](_0x1fc716['shift']());}};_0x637fd3(++_0x263857);}(_0x505b,0x139));var _0xb505=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x505b[_0x2c7618];return _0x5ce3f0;};'use strict';var client=require(_0xb505('0x0'));exports['getVoiceQueueRtPauses']=function(_0x5c3242){return function(){return client[_0xb505('0x1')](_0xb505('0x2'),{'options':{'where':{'VoiceQueueId':_0x5c3242,'paused':!![]},'raw':!![]},'log':_0xb505('0x3')});};}; \ No newline at end of file +var _0x7244=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x55e7f2,_0x4e2ead){var _0x146ee8=function(_0x233a78){while(--_0x233a78){_0x55e7f2['push'](_0x55e7f2['shift']());}};_0x146ee8(++_0x4e2ead);}(_0x7244,0x1dd));var _0x4724=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x7244[_0x29d915];return _0x160f86;};'use strict';var client=require(_0x4724('0x0'));exports[_0x4724('0x1')]=function(_0x283fe5){return function(){return client[_0x4724('0x2')](_0x4724('0x3'),{'options':{'where':{'VoiceQueueId':_0x283fe5,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 1161d52..716eefc 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x4d3239,_0x10972b){var _0x347422=function(_0x34daca){while(--_0x34daca){_0x4d3239['push'](_0x4d3239['shift']());}};_0x347422(++_0x10972b);}(_0x7a54,0x106));var _0x47a5=function(_0x4a57cd,_0x2303d5){_0x4a57cd=_0x4a57cd-0x0;var _0x4f5ed3=_0x7a54[_0x4a57cd];return _0x4f5ed3;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x2ee924,_0x5b530a){var _0x419f16=function(_0x25be1a){while(--_0x25be1a){_0x2ee924['push'](_0x2ee924['shift']());}};_0x419f16(++_0x5b530a);}(_0x7a54,0x106));var _0x47a5=function(_0x21ad6f,_0xb8b902){_0x21ad6f=_0x21ad6f-0x0;var _0x2d5354=_0x7a54[_0x21ad6f];return _0x2d5354;};'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 1bfc072..5dd1578 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 _0xd9f7=['transfereelinkedid','isexternal','context','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten'];(function(_0x16a185,_0x35a264){var _0x321655=function(_0x1073de){while(--_0x1073de){_0x16a185['push'](_0x16a185['shift']());}};_0x321655(++_0x35a264);}(_0xd9f7,0xf1));var _0x7d9f=function(_0x4233cc,_0x6f3c35){_0x4233cc=_0x4233cc-0x0;var _0x37825a=_0xd9f7[_0x4233cc];return _0x37825a;};'use strict';var client=require(_0x7d9f('0x0'));exports[_0x7d9f('0x1')]={};exports[_0x7d9f('0x2')]=function(_0x5ac4ca){return client[_0x7d9f('0x3')](_0x7d9f('0x4'),{'body':{'result':_0x5ac4ca['result'],'transfererchannel':_0x5ac4ca['transfererchannel'],'transferercalleridnum':_0x5ac4ca[_0x7d9f('0x5')],'transferercalleridname':_0x5ac4ca['transferercalleridname'],'transfererconnectedlinenum':_0x5ac4ca[_0x7d9f('0x6')],'transfererconnectedlinename':_0x5ac4ca[_0x7d9f('0x7')],'transfereraccountcode':_0x5ac4ca['transfereraccountcode'],'transferercontext':_0x5ac4ca[_0x7d9f('0x8')],'transfererexten':_0x5ac4ca[_0x7d9f('0x9')],'transfererlinkedid':_0x5ac4ca[_0x7d9f('0xa')],'transfereechannel':_0x5ac4ca[_0x7d9f('0xb')],'transfereecalleridnum':_0x5ac4ca[_0x7d9f('0xc')],'transfereecalleridname':_0x5ac4ca[_0x7d9f('0xd')],'transfereeconnectedlinenum':_0x5ac4ca[_0x7d9f('0xe')],'transfereeconnectedlinename':_0x5ac4ca['transfereeconnectedlinename'],'transfereeaccountcode':_0x5ac4ca[_0x7d9f('0xf')],'transfereecontext':_0x5ac4ca[_0x7d9f('0x10')],'transfereeexten':_0x5ac4ca[_0x7d9f('0x11')],'transfereelinkedid':_0x5ac4ca[_0x7d9f('0x12')],'isexternal':_0x5ac4ca[_0x7d9f('0x13')],'context':_0x5ac4ca[_0x7d9f('0x14')],'extension':_0x5ac4ca['extension'],'type':'blind'},'log':_0x7d9f('0x4')});};exports[_0x7d9f('0x15')]=function(_0x545315){return client[_0x7d9f('0x3')](_0x7d9f('0x4'),{'body':{'result':_0x545315[_0x7d9f('0x16')],'transfererchannel':_0x545315[_0x7d9f('0x17')],'transferercalleridnum':_0x545315[_0x7d9f('0x18')],'transferercalleridname':_0x545315['origtransferercalleridname'],'transfererconnectedlinenum':_0x545315[_0x7d9f('0x19')],'transfererconnectedlinename':_0x545315[_0x7d9f('0x1a')],'transfereraccountcode':_0x545315['origtransfereraccountcode'],'transferercontext':_0x545315[_0x7d9f('0x1b')],'transfererexten':_0x545315['secondtransfererexten'],'transfererlinkedid':_0x545315[_0x7d9f('0x1c')],'transfereechannel':_0x545315['transfertargetchannel'],'transfereecalleridnum':_0x545315['transfertargetcalleridnum'],'transfereecalleridname':_0x545315[_0x7d9f('0x1d')],'transfereeconnectedlinenum':_0x545315[_0x7d9f('0x1e')],'transfereeconnectedlinename':_0x545315[_0x7d9f('0x1f')],'transfereeaccountcode':_0x545315[_0x7d9f('0x20')],'transfereecontext':_0x545315['transfertargetcontext'],'transfereeexten':_0x545315[_0x7d9f('0x21')],'transfereelinkedid':_0x545315[_0x7d9f('0x22')],'isexternal':_0x545315[_0x7d9f('0x13')],'context':_0x545315[_0x7d9f('0x23')],'extension':_0x545315['origtransfererexten'],'type':_0x7d9f('0x24')},'log':_0x7d9f('0x4')});}; \ No newline at end of file +var _0x919d=['transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x919d,0x12e));var _0xd919=function(_0x5545f9,_0x2fd9e6){_0x5545f9=_0x5545f9-0x0;var _0x3c203a=_0x919d[_0x5545f9];return _0x3c203a;};'use strict';var client=require(_0xd919('0x0'));exports[_0xd919('0x1')]={};exports[_0xd919('0x2')]=function(_0x7318b1){return client[_0xd919('0x3')](_0xd919('0x4'),{'body':{'result':_0x7318b1[_0xd919('0x5')],'transfererchannel':_0x7318b1[_0xd919('0x6')],'transferercalleridnum':_0x7318b1['transferercalleridnum'],'transferercalleridname':_0x7318b1[_0xd919('0x7')],'transfererconnectedlinenum':_0x7318b1[_0xd919('0x8')],'transfererconnectedlinename':_0x7318b1['transfererconnectedlinename'],'transfereraccountcode':_0x7318b1[_0xd919('0x9')],'transferercontext':_0x7318b1[_0xd919('0xa')],'transfererexten':_0x7318b1[_0xd919('0xb')],'transfererlinkedid':_0x7318b1[_0xd919('0xc')],'transfereechannel':_0x7318b1[_0xd919('0xd')],'transfereecalleridnum':_0x7318b1[_0xd919('0xe')],'transfereecalleridname':_0x7318b1[_0xd919('0xf')],'transfereeconnectedlinenum':_0x7318b1[_0xd919('0x10')],'transfereeconnectedlinename':_0x7318b1[_0xd919('0x11')],'transfereeaccountcode':_0x7318b1['transfereeaccountcode'],'transfereecontext':_0x7318b1['transfereecontext'],'transfereeexten':_0x7318b1[_0xd919('0x12')],'transfereelinkedid':_0x7318b1[_0xd919('0x13')],'isexternal':_0x7318b1[_0xd919('0x14')],'context':_0x7318b1[_0xd919('0x15')],'extension':_0x7318b1[_0xd919('0x16')],'type':_0xd919('0x17')},'log':'CreateVoiceTransferReport'});};exports[_0xd919('0x18')]=function(_0xbf2467){return client[_0xd919('0x3')](_0xd919('0x4'),{'body':{'result':_0xbf2467[_0xd919('0x5')],'transfererchannel':_0xbf2467[_0xd919('0x19')],'transferercalleridnum':_0xbf2467[_0xd919('0x1a')],'transferercalleridname':_0xbf2467[_0xd919('0x1b')],'transfererconnectedlinenum':_0xbf2467[_0xd919('0x1c')],'transfererconnectedlinename':_0xbf2467[_0xd919('0x1d')],'transfereraccountcode':_0xbf2467['origtransfereraccountcode'],'transferercontext':_0xbf2467['secondtransferercontext'],'transfererexten':_0xbf2467[_0xd919('0x1e')],'transfererlinkedid':_0xbf2467[_0xd919('0x1f')],'transfereechannel':_0xbf2467[_0xd919('0x20')],'transfereecalleridnum':_0xbf2467[_0xd919('0x21')],'transfereecalleridname':_0xbf2467['transfertargetcalleridname'],'transfereeconnectedlinenum':_0xbf2467[_0xd919('0x22')],'transfereeconnectedlinename':_0xbf2467[_0xd919('0x23')],'transfereeaccountcode':_0xbf2467[_0xd919('0x24')],'transfereecontext':_0xbf2467['transfertargetcontext'],'transfereeexten':_0xbf2467[_0xd919('0x25')],'transfereelinkedid':_0xbf2467[_0xd919('0x26')],'isexternal':_0xbf2467[_0xd919('0x14')],'context':_0xbf2467[_0xd919('0x27')],'extension':_0xbf2467[_0xd919('0x28')],'type':_0xd919('0x29')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 5eac5a0..9e3760e 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 _0xc9c3=['exten','context','trunks','outboundChannels','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','agents','updateStatusRealtime','pause','asterisk','username','ami\x20disconnected','join','pick','module','then','message','catch','error','command','action','Command','Action','content','voiceQueues','hasOwnProperty','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','find','omit','undefined','values','channels','length','isConnected','voicechannel','validate','map','uniqueid','channel','wav','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','status','stop','%s.%s','filename','StopMixMonitor\x20Success','voicequeuechannel','voicequeuechannelhangup','queueChannels','Redirect'];(function(_0x45cde7,_0x39f056){var _0x2a0443=function(_0x2e83ee){while(--_0x2e83ee){_0x45cde7['push'](_0x45cde7['shift']());}};_0x2a0443(++_0x39f056);}(_0xc9c3,0x96));var _0x3c9c=function(_0x2ba232,_0x242965){_0x2ba232=_0x2ba232-0x0;var _0x1eb5b=_0xc9c3[_0x2ba232];return _0x1eb5b;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0x3c9c('0x0'));var schema=require('validate');var BPromise=require(_0x3c9c('0x1'));var moment=require(_0x3c9c('0x2'));var config=require(_0x3c9c('0x3'));var properties=require(_0x3c9c('0x4'));var ami=require(_0x3c9c('0x5'));exports[_0x3c9c('0x6')]=function(_0x143bfe,_0x512e80,_0x48b219){return new BPromise(function(_0x5c86bd,_0x5a2836){var _0x3ca0ce={'QueuePause':function(_0xc35e75){return new Promise(function(_0x2eb946,_0x3e5ccb){var _0x355ef3=util[_0x3c9c('0x7')](_0x3c9c('0x8'),_0x3c9c('0x9'),_0xc35e75[_0x3c9c('0xa')]);if(_0x143bfe['timers']&&_0x143bfe[_0x3c9c('0xb')][_0x355ef3]&&_0x143bfe[_0x3c9c('0xb')][_0x355ef3]['timer']){_0x143bfe[_0x3c9c('0xb')][_0x355ef3]['updateAcw']();}if(_0x143bfe[_0x3c9c('0xc')][_0x355ef3]){_0x143bfe[_0x3c9c('0xc')][_0x355ef3][_0x3c9c('0xd')]({'statePause':_0xc35e75[_0x3c9c('0xe')]?!![]:![]});}_0x2eb946({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x50cf96){var _0x4a60d9=this;return new Promise(function(_0x857b1f,_0x59bbc6){if(ami['isConnected']()==![]){return _0x59bbc6(_0x4a60d9['error'](0x1f4,[config[_0x3c9c('0xf')]['ip'],config['asterisk'][_0x3c9c('0x10')],_0x3c9c('0x11')][_0x3c9c('0x12')]('\x20')));}_0x50cf96=_[_0x3c9c('0x13')](_0x50cf96,_['keys'](properties[_0x3c9c('0x14')]));_0x50cf96['action']='Reload';return ami['Action'](_0x50cf96)[_0x3c9c('0x15')](function(_0x32d94a){_0x857b1f({'code':0xc8,'message':_0x32d94a[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x3e63e0){_0x59bbc6(_0x4a60d9[_0x3c9c('0x18')](0x1f5,_0x3e63e0[_0x3c9c('0x16')]));});});},'Command':function(_0x56fa79){var _0x15a90a=this;return new Promise(function(_0x4c7122,_0x461711){if(ami['isConnected']()==![]){return _0x461711(_0x15a90a[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config['asterisk'][_0x3c9c('0x10')],_0x3c9c('0x11')][_0x3c9c('0x12')]('\x20')));}_0x56fa79=_['pick'](_0x56fa79,_0x3c9c('0x19'));_0x56fa79[_0x3c9c('0x1a')]=_0x3c9c('0x1b');return ami[_0x3c9c('0x1c')](_0x56fa79)[_0x3c9c('0x15')](function(_0x3bc5c4){_0x4c7122({'code':0xc8,'message':_0x3bc5c4[_0x3c9c('0x1d')]});})[_0x3c9c('0x17')](function(_0x509bf7){_0x461711(_0x15a90a[_0x3c9c('0x18')](0x1f5,_0x509bf7['message']));});});},'VoiceQueues':function(_0x497145){return new Promise(function(_0xe04fca,_0x4ca078){var _0x527bb9=[];for(var _0x379880 in _0x143bfe[_0x3c9c('0x1e')]){if(_0x143bfe[_0x3c9c('0x1e')][_0x3c9c('0x1f')](_0x379880)){var _0x4c283d=_0x143bfe[_0x3c9c('0x1e')][_0x379880];var _0x65b831={'id':_0x4c283d['id'],'name':_0x4c283d['name'],'strategy':_0x4c283d[_0x3c9c('0x20')],'answered':_0x4c283d['answered'],'available':_0x4c283d['available'],'loggedIn':_0x4c283d[_0x3c9c('0x21')],'pTalking':_0x4c283d[_0x3c9c('0x22')],'sumBillable':_0x4c283d[_0x3c9c('0x23')],'sumDuration':_0x4c283d[_0x3c9c('0x24')],'sumHoldTime':_0x4c283d[_0x3c9c('0x25')]||0x0,'talking':_0x4c283d['talking'],'total':_0x4c283d[_0x3c9c('0x26')],'type':_0x4c283d['type'],'unmanaged':_0x4c283d[_0x3c9c('0x27')],'abandoned':_0x4c283d[_0x3c9c('0x28')],'waiting':_0x4c283d[_0x3c9c('0x29')],'loggedInDb':_0x4c283d[_0x3c9c('0x2a')]};if(_0x4c283d['type']===_0x3c9c('0x2b')){_0x65b831[_0x3c9c('0x2c')]=_0x4c283d[_0x3c9c('0x2c')];_0x65b831[_0x3c9c('0x2d')]=_0x4c283d[_0x3c9c('0x2d')];_0x65b831[_0x3c9c('0x2e')]=_0x4c283d[_0x3c9c('0x2e')];_0x65b831[_0x3c9c('0x2f')]=_0x4c283d['dialOriginateCallerIdNumber'];_0x65b831[_0x3c9c('0x30')]=_0x4c283d[_0x3c9c('0x30')];_0x65b831[_0x3c9c('0x31')]=_0x4c283d[_0x3c9c('0x31')];_0x65b831[_0x3c9c('0x32')]=_0x4c283d[_0x3c9c('0x32')];_0x65b831[_0x3c9c('0x33')]=_0x4c283d[_0x3c9c('0x33')];_0x65b831[_0x3c9c('0x34')]=_0x4c283d[_0x3c9c('0x34')];_0x65b831[_0x3c9c('0x35')]=_0x4c283d[_0x3c9c('0x35')];_0x65b831[_0x3c9c('0x36')]=_0x4c283d[_0x3c9c('0x36')];_0x65b831['outboundCongestionCallsDay']=_0x4c283d[_0x3c9c('0x37')];_0x65b831[_0x3c9c('0x38')]=_0x4c283d[_0x3c9c('0x38')];_0x65b831['outboundDropCallsDayCallersExit']=_0x4c283d[_0x3c9c('0x39')];_0x65b831[_0x3c9c('0x3a')]=_0x4c283d[_0x3c9c('0x3a')];_0x65b831[_0x3c9c('0x3b')]=_0x4c283d['outboundNoAnswerCallsDay'];_0x65b831['outboundNoSuchCallsDay']=_0x4c283d[_0x3c9c('0x3c')];_0x65b831[_0x3c9c('0x3d')]=_0x4c283d[_0x3c9c('0x3d')];_0x65b831['outboundReCallsDay']=_0x4c283d['outboundReCallsDay'];_0x65b831[_0x3c9c('0x3e')]=_0x4c283d['outboundRejectCallsDay'];_0x65b831['outboundUnknownCallsDay']=_0x4c283d[_0x3c9c('0x3f')];_0x65b831[_0x3c9c('0x40')]=_0x4c283d[_0x3c9c('0x40')];_0x65b831['predictiveIntervalAvgHoldtime']=_0x4c283d[_0x3c9c('0x41')];_0x65b831[_0x3c9c('0x42')]=_0x4c283d[_0x3c9c('0x42')];_0x65b831['predictiveIntervalDroppedCallsCallersExit']=_0x4c283d['predictiveIntervalDroppedCallsCallersExit'];_0x65b831['predictiveIntervalDroppedCallsTimeout']=_0x4c283d[_0x3c9c('0x43')];_0x65b831[_0x3c9c('0x44')]=_0x4c283d[_0x3c9c('0x44')];_0x65b831[_0x3c9c('0x45')]=_0x4c283d[_0x3c9c('0x45')];_0x65b831[_0x3c9c('0x46')]=_0x4c283d['predictiveIntervalHitRate'];_0x65b831['predictiveIntervalMultiplicativeFactor']=_0x4c283d[_0x3c9c('0x47')];_0x65b831[_0x3c9c('0x48')]=_0x4c283d[_0x3c9c('0x48')];_0x65b831['predictiveIntervalAvailable']=_0x4c283d[_0x3c9c('0x49')];_0x65b831[_0x3c9c('0x4a')]=_0x4c283d[_0x3c9c('0x4a')];_0x65b831['message']=_0x4c283d['message'];_0x65b831[_0x3c9c('0x4b')]=_0x4c283d[_0x3c9c('0x4b')];_0x65b831[_0x3c9c('0x4c')]=_0x4c283d['erlangCalls'];_0x65b831[_0x3c9c('0x4d')]=_0x4c283d[_0x3c9c('0x4d')];_0x65b831[_0x3c9c('0x4e')]=_0x4c283d[_0x3c9c('0x4e')];_0x65b831['erlangBusyFactor']=_0x4c283d[_0x3c9c('0x4f')];_0x65b831[_0x3c9c('0x50')]=_0x4c283d['startPredictive'];_0x65b831['startProgressive']=_0x4c283d[_0x3c9c('0x51')];}if(_0x4c283d[_0x3c9c('0x52')]){_0x65b831['Trunk']={'id':_0x4c283d[_0x3c9c('0x52')]['id'],'name':_0x4c283d[_0x3c9c('0x52')][_0x3c9c('0xa')],'active':_0x4c283d[_0x3c9c('0x52')][_0x3c9c('0x53')],'callerid':_0x4c283d[_0x3c9c('0x52')]['callerid']};}if(_0x4c283d[_0x3c9c('0x54')]){_0x65b831[_0x3c9c('0x54')]={'id':_0x4c283d[_0x3c9c('0x54')]['id'],'name':_0x4c283d[_0x3c9c('0x54')][_0x3c9c('0xa')]};}_0x527bb9['push'](_0x65b831);}}_0xe04fca({'count':_0x527bb9['length'],'rows':_0x527bb9});});},'UpdateVoiceQueue':function(_0x55a6ba){return new Promise(function(_0x3ff47a,_0x1da3e7){var _0x25285d=_[_0x3c9c('0x55')](_0x143bfe['voiceQueues'],{'id':parseInt(_0x55a6ba['id'])});var _0x798651=_[_0x3c9c('0x56')](_0x55a6ba,['id']);if(_0x25285d){for(var _0x27a013 in _0x798651){if(typeof _0x798651[_0x27a013]!==_0x3c9c('0x57')&&typeof _0x25285d[_0x27a013]!==_0x3c9c('0x57')){_0x25285d[_0x27a013]=_0x798651[_0x27a013];}}_0x3ff47a(_0x25285d);}else{_0x1da3e7();}});},'VoiceChannels':function(_0x58f6b7){return new Promise(function(_0x184c22,_0x1177b3){var _0x1804e3=_[_0x3c9c('0x58')](_0x143bfe[_0x3c9c('0x59')]);_0x184c22({'count':_0x1804e3[_0x3c9c('0x5a')],'rows':_0x1804e3});});},'VoiceChannelMixMonitor':function(_0x475fd6){var _0x5a74ce=this;return new Promise(function(_0x260d3b,_0x3a59f9){if(ami[_0x3c9c('0x5b')]()==![]){return _0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config[_0x3c9c('0xf')]['username'],_0x3c9c('0x11')][_0x3c9c('0x12')]('\x20')));}var _0x2b0691=schema(properties[_0x3c9c('0x5c')])[_0x3c9c('0x5d')](_0x475fd6);if(_0x2b0691[_0x3c9c('0x5a')]>0x0){return _0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f4,_[_0x3c9c('0x5e')](_0x2b0691,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x39b9d8=_[_0x3c9c('0x55')](_0x143bfe[_0x3c9c('0x59')],{'uniqueid':_0x475fd6[_0x3c9c('0x5f')]});if(_0x39b9d8&&_0x39b9d8[_0x3c9c('0x60')]){var _0x2b022f=util['format']('%s.%s',_0x475fd6['filename']||_0x475fd6[_0x3c9c('0x5f')],_0x475fd6[_0x3c9c('0x7')]||_0x3c9c('0x61'));return ami[_0x3c9c('0x1c')]({'action':'MixMonitor','channel':_0x39b9d8[_0x3c9c('0x60')],'file':_0x2b022f,'options':'ai(mixmonitorid)'})['then'](function(_0x34cd84){var _0x2849c6=_[_0x3c9c('0x55')](_0x39b9d8[_0x3c9c('0x62')],{'filename':_0x3c9c('0x63')+_0x2b022f[_0x3c9c('0x64')]()});if(_[_0x3c9c('0x65')](_0x2849c6)){_0x39b9d8[_0x3c9c('0x62')][_0x3c9c('0x66')]({'filename':'/var/spool/asterisk/monitor/'+_0x2b022f[_0x3c9c('0x64')](),'createdAt':moment()[_0x3c9c('0x7')](_0x3c9c('0x67')),'mixmonitorid':_0x34cd84[_0x3c9c('0x68')],'status':_0x3c9c('0x69')});}else{_0x2849c6[_0x3c9c('0x68')]=_0x34cd84[_0x3c9c('0x68')];_0x2849c6['status']='rec';}_0x260d3b({'code':0xc8,'message':[_0x475fd6[_0x3c9c('0x5f')],_0x3c9c('0x6a'),_0x34cd84[_0x3c9c('0x68')]][_0x3c9c('0x12')]('\x20'),'mixmonitorid':_0x34cd84[_0x3c9c('0x68')]});})[_0x3c9c('0x17')](function(_0x287ca1){_0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f5,[_0x475fd6[_0x3c9c('0x5f')],_0x287ca1[_0x3c9c('0x16')][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')));});}else{return _0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f5,_0x3c9c('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x581523){var _0x423891=this;return new Promise(function(_0x4306fe,_0x1b6f0a){if(ami[_0x3c9c('0x5b')]()==![]){return _0x1b6f0a(_0x423891[_0x3c9c('0x18')](0x1f4,[config['asterisk']['ip'],config[_0x3c9c('0xf')][_0x3c9c('0x10')],'ami\x20disconnected']['join']('\x20')));}var _0x1d810d=schema(properties[_0x3c9c('0x5c')])['validate'](_0x581523);if(_0x1d810d[_0x3c9c('0x5a')]>0x0){return _0x1b6f0a(_0x423891[_0x3c9c('0x18')](0x1f4,_[_0x3c9c('0x5e')](_0x1d810d,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x2264b7=_[_0x3c9c('0x55')](_0x143bfe[_0x3c9c('0x59')],{'uniqueid':_0x581523[_0x3c9c('0x5f')]});if(_0x2264b7){return BPromise[_0x3c9c('0x6c')]()[_0x3c9c('0x15')](function(){if(_0x2264b7['channel']){return ami[_0x3c9c('0x1c')]({'action':'StopMixMonitor','channel':_0x2264b7['channel'],'mixmonitorid':_0x581523[_0x3c9c('0x68')]})[_0x3c9c('0x17')](function(_0x1a1485){});}})[_0x3c9c('0x15')](function(){if(_0x2264b7[_0x3c9c('0x6d')]){return ami[_0x3c9c('0x1c')]({'action':_0x3c9c('0x6e'),'channel':_0x2264b7['destinationchannel'],'mixmonitorid':_0x581523[_0x3c9c('0x68')]})[_0x3c9c('0x17')](function(_0x31fb57){});}})[_0x3c9c('0x15')](function(_0x1cfaea){var _0x4fb887=_['find'](_0x2264b7[_0x3c9c('0x62')],{'mixmonitorid':_0x581523[_0x3c9c('0x68')]});if(_0x4fb887){_0x4fb887[_0x3c9c('0x6f')]=_0x3c9c('0x70');}})[_0x3c9c('0x15')](function(){var _0x990934=util[_0x3c9c('0x7')](_0x3c9c('0x71'),_0x581523[_0x3c9c('0x72')]||_0x581523[_0x3c9c('0x5f')],_0x581523[_0x3c9c('0x7')]||_0x3c9c('0x61'));var _0x4311c0=_[_0x3c9c('0x55')](_0x2264b7[_0x3c9c('0x62')],{'filename':_0x3c9c('0x63')+_0x990934[_0x3c9c('0x64')]()});if(_0x4311c0){_0x4311c0['status']=_0x3c9c('0x70');}})['then'](function(){_0x4306fe({'code':0xc8,'message':[_0x581523['uniqueid'],_0x3c9c('0x73')][_0x3c9c('0x12')]('\x20')});})[_0x3c9c('0x17')](function(_0x4b1b16){_0x1b6f0a(_0x423891[_0x3c9c('0x18')](0x1f5,[_0x581523[_0x3c9c('0x5f')],_0x4b1b16['message'][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')));});}else{return _0x1b6f0a(_0x423891['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5e4146){return new Promise(function(_0x1e93d7,_0x2fc65b){var _0xbc5b78=_[_0x3c9c('0x58')](_0x143bfe['queueChannels']);_0x1e93d7({'count':_0xbc5b78['length'],'rows':_0xbc5b78});});},'VoiceQueuesChannel':function(_0x2f2628){var _0x2dc609=this;return new Promise(function(_0x260a90,_0x94bc44){var _0x4342a9=schema(properties[_0x3c9c('0x74')])[_0x3c9c('0x5d')](_0x2f2628);if(_0x4342a9[_0x3c9c('0x5a')]>0x0){return _0x94bc44(_0x2dc609[_0x3c9c('0x18')](0x1f4,_['map'](_0x4342a9,'message')[_0x3c9c('0x12')](',\x20')));}var _0x5cf82a=_['find'](_0x143bfe['queueChannels'],{'uniqueid':_0x2f2628[_0x3c9c('0x5f')]});if(_0x5cf82a){_0x260a90(_0x5cf82a);}else{return _0x94bc44(_0x2dc609[_0x3c9c('0x18')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x56effa){var _0x53ccaf=this;return new Promise(function(_0x482612,_0x77afb5){if(ami['isConnected']()==![]){return _0x77afb5(_0x53ccaf[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config[_0x3c9c('0xf')]['username'],'ami\x20disconnected'][_0x3c9c('0x12')]('\x20')));}var _0x5ca292=schema(properties[_0x3c9c('0x75')])[_0x3c9c('0x5d')](_0x56effa);if(_0x5ca292[_0x3c9c('0x5a')]>0x0){return _0x77afb5(_0x53ccaf[_0x3c9c('0x18')](0x1f4,_['map'](_0x5ca292,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x5c1a13=_[_0x3c9c('0x55')](_0x143bfe[_0x3c9c('0x76')],{'uniqueid':_0x56effa['uniqueid']});if(_0x5c1a13&&_0x5c1a13[_0x3c9c('0x60')]){return ami[_0x3c9c('0x1c')]({'action':'Hangup','channel':_0x5c1a13[_0x3c9c('0x60')]})[_0x3c9c('0x15')](function(_0xab562a){_0x482612({'code':0xc8,'message':[_0x56effa['uniqueid'],_0xab562a['message'][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')});})['catch'](function(_0x386197){_0x77afb5(_0x53ccaf[_0x3c9c('0x18')](0x1f5,[_0x56effa[_0x3c9c('0x5f')],_0x386197['message'][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')));});}else{return _0x77afb5(_0x53ccaf['error'](0x1f5,_0x3c9c('0x6b')));}});},'VoiceQueuesChannelRedirect':function(_0x2cb21d){var _0xc4b7c9=this;return new Promise(function(_0x3caddb,_0x1ecabd){if(ami[_0x3c9c('0x5b')]()==![]){return _0x1ecabd(_0xc4b7c9[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config[_0x3c9c('0xf')][_0x3c9c('0x10')],'ami\x20disconnected'][_0x3c9c('0x12')]('\x20')));}var _0x150a27=schema(properties['voicequeuechannelredirect'])[_0x3c9c('0x5d')](_0x2cb21d);if(_0x150a27[_0x3c9c('0x5a')]>0x0){return _0x1ecabd(_0xc4b7c9['error'](0x1f4,_[_0x3c9c('0x5e')](_0x150a27,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x17d23e=_[_0x3c9c('0x55')](_0x143bfe['queueChannels'],{'uniqueid':_0x2cb21d[_0x3c9c('0x5f')]});if(_0x17d23e&&_0x17d23e[_0x3c9c('0x60')]){return ami[_0x3c9c('0x1c')]({'action':_0x3c9c('0x77'),'channel':_0x17d23e[_0x3c9c('0x60')],'exten':_0x2cb21d[_0x3c9c('0x78')],'context':_0x2cb21d[_0x3c9c('0x79')]||_0x17d23e[_0x3c9c('0x79')],'priority':0x1})[_0x3c9c('0x15')](function(_0x36018f){_0x3caddb({'code':0xc8,'message':[_0x2cb21d[_0x3c9c('0x5f')],_0x36018f[_0x3c9c('0x16')][_0x3c9c('0x64')]()]['join']('\x20')});})[_0x3c9c('0x17')](function(_0x296e46){_0x1ecabd(_0xc4b7c9['error'](0x1f5,[_0x2cb21d[_0x3c9c('0x5f')],_0x296e46[_0x3c9c('0x16')][_0x3c9c('0x64')]()]['join']('\x20')));});}else{return _0x1ecabd(_0xc4b7c9[_0x3c9c('0x18')](0x1f5,_0x3c9c('0x6b')));}});},'Agents':function(_0x21c7c3){return new Promise(function(_0x285ebc,_0x478572){var _0x773eea=_['values'](_0x143bfe[_0x3c9c('0xc')]);_0x285ebc({'count':_0x773eea['length'],'rows':_0x773eea});});},'Telephones':function(_0x2265e8){return new Promise(function(_0x48a57f,_0x4950c3){var _0x263270=_['values'](_0x143bfe['telephones']);_0x48a57f({'count':_0x263270[_0x3c9c('0x5a')],'rows':_0x263270});});},'Trunks':function(_0x2f3a98){return new Promise(function(_0x14ccbc,_0x9b3118){var _0x2f4e79=_[_0x3c9c('0x58')](_0x143bfe[_0x3c9c('0x7a')]);_0x14ccbc({'count':_0x2f4e79[_0x3c9c('0x5a')],'rows':_0x2f4e79});});},'OutboundChannels':function(_0x2e6b96){return new Promise(function(_0x13e236,_0x1528a6){var _0x570ae6=_['values'](_0x143bfe[_0x3c9c('0x7b')]);_0x13e236({'count':_0x570ae6['length'],'rows':_0x570ae6});});},'Outbound':function(_0x552ec1){return new Promise(function(_0x3bb0c1,_0x1838d7){_0x3bb0c1(_0x143bfe[_0x3c9c('0x2b')]);});},'Campaigns':function(_0x1748c7){return new Promise(function(_0x2dec50,_0x57746d){var _0x105e67=_[_0x3c9c('0x58')](_0x143bfe['campaigns']);_0x2dec50({'count':_0x105e67['length'],'rows':_0x105e67});});},'VoiceQueuesPreview':function(_0x308a24){var _0x5f42c1=this;return new Promise(function(_0x2e3cab,_0x1ceaa3){_0x512e80[_0x3c9c('0x7c')](_0x308a24['id'])[_0x3c9c('0x15')](function(_0x327e63){_0x2e3cab({'code':0xc8,'message':_0x327e63[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x18012e){_0x1ceaa3(_0x5f42c1[_0x3c9c('0x18')](0x1f4,_0x18012e[_0x3c9c('0x16')]));});});},'EventManager':function(_0x52af3a){var _0x32690f=this;return new Promise(function(_0x2f5738,_0xf6f1ea){if(!_0x52af3a[_0x3c9c('0x7d')]){return _0xf6f1ea(_0x32690f['error'](0x1f4,_0x3c9c('0x7e')));}ami['emit'](_0x3c9c('0x7f')+_0x52af3a[_0x3c9c('0x7d')],_0x52af3a['message']);_0x2f5738({'code':0xc8,'message':_0x52af3a});});},'FaxAccounts':function(_0x22d2bd){return new Promise(function(_0x4cd7b9,_0x49559f){var _0x3d34e3=_[_0x3c9c('0x58')](_0x143bfe[_0x3c9c('0x80')]);_0x4cd7b9({'count':_0x3d34e3[_0x3c9c('0x5a')],'rows':_0x3d34e3});});},'SendFax':function(_0x17e5ce){var _0x5c96ad=this;return new Promise(function(_0x3e2f73,_0x48c11d){_0x48b219[_0x3c9c('0x81')](_0x17e5ce)['then'](function(_0x12bb7b){_0x3e2f73({'code':0xc8,'message':_0x12bb7b[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x19db8a){_0x48c11d(_0x5c96ad[_0x3c9c('0x18')](0x1f4,_0x19db8a[_0x3c9c('0x16')]));});});},'CheckAfterSend':function(_0x1fe080){var _0x41c07b=this;return new Promise(function(_0x557dc6,_0xa1de30){_0x48b219[_0x3c9c('0x82')](_0x1fe080)[_0x3c9c('0x15')](function(_0x5614df){_0x557dc6({'code':0xc8,'message':_0x5614df[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x37d2b6){_0xa1de30(_0x41c07b[_0x3c9c('0x18')](0x1f4,_0x37d2b6[_0x3c9c('0x16')]));});});}};var _0xdfe4f7=jayson['server'](_0x3ca0ce)[_0x3c9c('0x83')]();_0xdfe4f7['on'](_0x3c9c('0x18'),function(_0x2e158c){return _0x5a2836(_0x2e158c);});_0xdfe4f7[_0x3c9c('0x6')](0x232a,'127.0.0.1',function(){console[_0x3c9c('0x84')](_0x3c9c('0x85'),0x232a);return _0x5c86bd(_0x3c9c('0x86')+0x232a);});});}; \ No newline at end of file +var _0x4975=['send','log','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','%s/%s','SIP','name','timers','timer','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','join','pick','keys','module','action','Reload','Action','message','catch','ami\x20disconnected','Command','then','content','voiceQueues','hasOwnProperty','strategy','pTalking','sumHoldTime','talking','total','waiting','loggedInDb','type','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','undefined','values','channels','find','uniqueid','channel','%s.%s','format','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','rec','voicechannel','map','resolve','StopMixMonitor','destinationchannel','monitors','stop','filename','Channel\x20doesn\x27t\x20exist','voicequeuechannel','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outbound','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts'];(function(_0x32283c,_0x3e149d){var _0x250150=function(_0x42f0e8){while(--_0x42f0e8){_0x32283c['push'](_0x32283c['shift']());}};_0x250150(++_0x3e149d);}(_0x4975,0x86));var _0x5497=function(_0xfbf1dc,_0x3be1b5){_0xfbf1dc=_0xfbf1dc-0x0;var _0x39cfd0=_0x4975[_0xfbf1dc];return _0x39cfd0;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var jayson=require(_0x5497('0x1'));var schema=require(_0x5497('0x2'));var BPromise=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var config=require(_0x5497('0x5'));var properties=require(_0x5497('0x6'));var ami=require(_0x5497('0x7'));exports[_0x5497('0x8')]=function(_0xbb1888,_0x5d5272,_0x539a27){return new BPromise(function(_0x37e48d,_0x4f563d){var _0x1d0019={'QueuePause':function(_0x674a2a){return new Promise(function(_0x368e8b,_0x57f930){var _0x42af11=util['format'](_0x5497('0x9'),_0x5497('0xa'),_0x674a2a[_0x5497('0xb')]);if(_0xbb1888[_0x5497('0xc')]&&_0xbb1888[_0x5497('0xc')][_0x42af11]&&_0xbb1888[_0x5497('0xc')][_0x42af11][_0x5497('0xd')]){_0xbb1888[_0x5497('0xc')][_0x42af11]['updateAcw']();}if(_0xbb1888['agents'][_0x42af11]){_0xbb1888['agents'][_0x42af11][_0x5497('0xe')]({'statePause':_0x674a2a[_0x5497('0xf')]?!![]:![]});}_0x368e8b({'code':0xc8,'message':_0x5497('0x10')});});},'Reload':function(_0x984990){var _0x747dc7=this;return new Promise(function(_0x365144,_0x1f7169){if(ami[_0x5497('0x11')]()==![]){return _0x1f7169(_0x747dc7[_0x5497('0x12')](0x1f4,[config[_0x5497('0x13')]['ip'],config['asterisk'][_0x5497('0x14')],'ami\x20disconnected'][_0x5497('0x15')]('\x20')));}_0x984990=_[_0x5497('0x16')](_0x984990,_[_0x5497('0x17')](properties[_0x5497('0x18')]));_0x984990[_0x5497('0x19')]=_0x5497('0x1a');return ami[_0x5497('0x1b')](_0x984990)['then'](function(_0x56a788){_0x365144({'code':0xc8,'message':_0x56a788[_0x5497('0x1c')]});})[_0x5497('0x1d')](function(_0x3a47fd){_0x1f7169(_0x747dc7['error'](0x1f5,_0x3a47fd[_0x5497('0x1c')]));});});},'Command':function(_0xcbd71d){var _0x18e8a8=this;return new Promise(function(_0x43da2c,_0x1b1b43){if(ami[_0x5497('0x11')]()==![]){return _0x1b1b43(_0x18e8a8[_0x5497('0x12')](0x1f4,[config[_0x5497('0x13')]['ip'],config[_0x5497('0x13')][_0x5497('0x14')],_0x5497('0x1e')]['join']('\x20')));}_0xcbd71d=_[_0x5497('0x16')](_0xcbd71d,'command');_0xcbd71d[_0x5497('0x19')]=_0x5497('0x1f');return ami[_0x5497('0x1b')](_0xcbd71d)[_0x5497('0x20')](function(_0x35ecd9){_0x43da2c({'code':0xc8,'message':_0x35ecd9[_0x5497('0x21')]});})['catch'](function(_0x54043a){_0x1b1b43(_0x18e8a8[_0x5497('0x12')](0x1f5,_0x54043a[_0x5497('0x1c')]));});});},'VoiceQueues':function(_0x24482a){return new Promise(function(_0x281155,_0x5223b5){var _0x13b7a4=[];for(var _0x57268c in _0xbb1888[_0x5497('0x22')]){if(_0xbb1888[_0x5497('0x22')][_0x5497('0x23')](_0x57268c)){var _0x34a1a5=_0xbb1888[_0x5497('0x22')][_0x57268c];var _0x31cd01={'id':_0x34a1a5['id'],'name':_0x34a1a5['name'],'strategy':_0x34a1a5[_0x5497('0x24')],'answered':_0x34a1a5['answered'],'available':_0x34a1a5['available'],'loggedIn':_0x34a1a5['loggedIn'],'pTalking':_0x34a1a5[_0x5497('0x25')],'sumBillable':_0x34a1a5['sumBillable'],'sumDuration':_0x34a1a5['sumDuration'],'sumHoldTime':_0x34a1a5[_0x5497('0x26')]||0x0,'talking':_0x34a1a5[_0x5497('0x27')],'total':_0x34a1a5[_0x5497('0x28')],'type':_0x34a1a5['type'],'unmanaged':_0x34a1a5['unmanaged'],'abandoned':_0x34a1a5['abandoned'],'waiting':_0x34a1a5[_0x5497('0x29')],'loggedInDb':_0x34a1a5[_0x5497('0x2a')]};if(_0x34a1a5[_0x5497('0x2b')]==='outbound'){_0x31cd01['dialActive']=_0x34a1a5['dialActive'];_0x31cd01[_0x5497('0x2c')]=_0x34a1a5['dialMethod'];_0x31cd01[_0x5497('0x2d')]=_0x34a1a5[_0x5497('0x2d')];_0x31cd01[_0x5497('0x2e')]=_0x34a1a5['dialOriginateCallerIdNumber'];_0x31cd01[_0x5497('0x2f')]=_0x34a1a5[_0x5497('0x2f')];_0x31cd01['dialPrefix']=_0x34a1a5[_0x5497('0x30')];_0x31cd01[_0x5497('0x31')]=_0x34a1a5[_0x5497('0x31')];_0x31cd01['outboundAnswerAgiCallsDay']=_0x34a1a5[_0x5497('0x32')];_0x31cd01[_0x5497('0x33')]=_0x34a1a5[_0x5497('0x33')];_0x31cd01[_0x5497('0x34')]=_0x34a1a5[_0x5497('0x34')];_0x31cd01['outboundBusyCallsDay']=_0x34a1a5[_0x5497('0x35')];_0x31cd01[_0x5497('0x36')]=_0x34a1a5['outboundCongestionCallsDay'];_0x31cd01[_0x5497('0x37')]=_0x34a1a5[_0x5497('0x37')];_0x31cd01[_0x5497('0x38')]=_0x34a1a5[_0x5497('0x38')];_0x31cd01[_0x5497('0x39')]=_0x34a1a5[_0x5497('0x39')];_0x31cd01['outboundNoAnswerCallsDay']=_0x34a1a5[_0x5497('0x3a')];_0x31cd01['outboundNoSuchCallsDay']=_0x34a1a5[_0x5497('0x3b')];_0x31cd01[_0x5497('0x3c')]=_0x34a1a5[_0x5497('0x3c')];_0x31cd01['outboundReCallsDay']=_0x34a1a5['outboundReCallsDay'];_0x31cd01[_0x5497('0x3d')]=_0x34a1a5[_0x5497('0x3d')];_0x31cd01[_0x5497('0x3e')]=_0x34a1a5[_0x5497('0x3e')];_0x31cd01[_0x5497('0x3f')]=_0x34a1a5[_0x5497('0x3f')];_0x31cd01['predictiveIntervalAvgHoldtime']=_0x34a1a5[_0x5497('0x40')];_0x31cd01[_0x5497('0x41')]=_0x34a1a5[_0x5497('0x41')];_0x31cd01[_0x5497('0x42')]=_0x34a1a5[_0x5497('0x42')];_0x31cd01[_0x5497('0x43')]=_0x34a1a5[_0x5497('0x43')];_0x31cd01[_0x5497('0x44')]=_0x34a1a5[_0x5497('0x44')];_0x31cd01['predictiveIntervalErlangCallsDroppedCalls']=_0x34a1a5[_0x5497('0x45')];_0x31cd01[_0x5497('0x46')]=_0x34a1a5[_0x5497('0x46')];_0x31cd01[_0x5497('0x47')]=_0x34a1a5[_0x5497('0x47')];_0x31cd01[_0x5497('0x48')]=_0x34a1a5[_0x5497('0x48')];_0x31cd01['predictiveIntervalAvailable']=_0x34a1a5[_0x5497('0x49')];_0x31cd01[_0x5497('0x4a')]=_0x34a1a5[_0x5497('0x4a')];_0x31cd01[_0x5497('0x1c')]=_0x34a1a5[_0x5497('0x1c')];_0x31cd01[_0x5497('0x4b')]=_0x34a1a5[_0x5497('0x4b')];_0x31cd01['erlangCalls']=_0x34a1a5[_0x5497('0x4c')];_0x31cd01[_0x5497('0x4d')]=_0x34a1a5[_0x5497('0x4d')];_0x31cd01[_0x5497('0x4e')]=_0x34a1a5[_0x5497('0x4e')];_0x31cd01[_0x5497('0x4f')]=_0x34a1a5[_0x5497('0x4f')];_0x31cd01[_0x5497('0x50')]=_0x34a1a5[_0x5497('0x50')];_0x31cd01[_0x5497('0x51')]=_0x34a1a5['startProgressive'];}if(_0x34a1a5[_0x5497('0x52')]){_0x31cd01['Trunk']={'id':_0x34a1a5[_0x5497('0x52')]['id'],'name':_0x34a1a5[_0x5497('0x52')][_0x5497('0xb')],'active':_0x34a1a5[_0x5497('0x52')][_0x5497('0x53')],'callerid':_0x34a1a5['Trunk'][_0x5497('0x54')]};}if(_0x34a1a5[_0x5497('0x55')]){_0x31cd01['Interval']={'id':_0x34a1a5[_0x5497('0x55')]['id'],'name':_0x34a1a5['Interval'][_0x5497('0xb')]};}_0x13b7a4['push'](_0x31cd01);}}_0x281155({'count':_0x13b7a4[_0x5497('0x56')],'rows':_0x13b7a4});});},'UpdateVoiceQueue':function(_0x1a0df5){return new Promise(function(_0x2e8c6a,_0x3a852a){var _0xbf2f0=_['find'](_0xbb1888['voiceQueues'],{'id':parseInt(_0x1a0df5['id'])});var _0x498de5=_['omit'](_0x1a0df5,['id']);if(_0xbf2f0){for(var _0x3cbe4b in _0x498de5){if(typeof _0x498de5[_0x3cbe4b]!==_0x5497('0x57')&&typeof _0xbf2f0[_0x3cbe4b]!==_0x5497('0x57')){_0xbf2f0[_0x3cbe4b]=_0x498de5[_0x3cbe4b];}}_0x2e8c6a(_0xbf2f0);}else{_0x3a852a();}});},'VoiceChannels':function(_0x185512){return new Promise(function(_0x3cb32c,_0x33a733){var _0xc78abe=_[_0x5497('0x58')](_0xbb1888[_0x5497('0x59')]);_0x3cb32c({'count':_0xc78abe['length'],'rows':_0xc78abe});});},'VoiceChannelMixMonitor':function(_0x43ac49){var _0x18db5b=this;return new Promise(function(_0x1a9138,_0x52a189){if(ami[_0x5497('0x11')]()==![]){return _0x52a189(_0x18db5b['error'](0x1f4,[config[_0x5497('0x13')]['ip'],config[_0x5497('0x13')][_0x5497('0x14')],'ami\x20disconnected'][_0x5497('0x15')]('\x20')));}var _0x356d61=schema(properties['voicechannel'])[_0x5497('0x2')](_0x43ac49);if(_0x356d61['length']>0x0){return _0x52a189(_0x18db5b[_0x5497('0x12')](0x1f4,_['map'](_0x356d61,_0x5497('0x1c'))[_0x5497('0x15')](',\x20')));}var _0x26fd9f=_[_0x5497('0x5a')](_0xbb1888[_0x5497('0x59')],{'uniqueid':_0x43ac49[_0x5497('0x5b')]});if(_0x26fd9f&&_0x26fd9f[_0x5497('0x5c')]){var _0x2a6e4d=util['format'](_0x5497('0x5d'),_0x43ac49['filename']||_0x43ac49['uniqueid'],_0x43ac49[_0x5497('0x5e')]||_0x5497('0x5f'));return ami['Action']({'action':_0x5497('0x60'),'channel':_0x26fd9f[_0x5497('0x5c')],'file':_0x2a6e4d,'options':_0x5497('0x61')})[_0x5497('0x20')](function(_0x4ccf0e){var _0x1b9f3d=_['find'](_0x26fd9f['monitors'],{'filename':_0x5497('0x62')+_0x2a6e4d[_0x5497('0x63')]()});if(_[_0x5497('0x64')](_0x1b9f3d)){_0x26fd9f['monitors']['push']({'filename':_0x5497('0x62')+_0x2a6e4d['toLowerCase'](),'createdAt':moment()[_0x5497('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x4ccf0e[_0x5497('0x65')],'status':'rec'});}else{_0x1b9f3d[_0x5497('0x65')]=_0x4ccf0e[_0x5497('0x65')];_0x1b9f3d['status']=_0x5497('0x66');}_0x1a9138({'code':0xc8,'message':[_0x43ac49['uniqueid'],'MixMonitor\x20Success',_0x4ccf0e[_0x5497('0x65')]][_0x5497('0x15')]('\x20'),'mixmonitorid':_0x4ccf0e['mixmonitorid']});})[_0x5497('0x1d')](function(_0x4be39e){_0x52a189(_0x18db5b[_0x5497('0x12')](0x1f5,[_0x43ac49[_0x5497('0x5b')],_0x4be39e[_0x5497('0x1c')][_0x5497('0x63')]()]['join']('\x20')));});}else{return _0x52a189(_0x18db5b[_0x5497('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x4e0d4c){var _0x480582=this;return new Promise(function(_0x1f3965,_0x37e0b9){if(ami[_0x5497('0x11')]()==![]){return _0x37e0b9(_0x480582['error'](0x1f4,[config[_0x5497('0x13')]['ip'],config['asterisk']['username'],_0x5497('0x1e')][_0x5497('0x15')]('\x20')));}var _0x3c54e3=schema(properties[_0x5497('0x67')])[_0x5497('0x2')](_0x4e0d4c);if(_0x3c54e3[_0x5497('0x56')]>0x0){return _0x37e0b9(_0x480582['error'](0x1f4,_[_0x5497('0x68')](_0x3c54e3,_0x5497('0x1c'))[_0x5497('0x15')](',\x20')));}var _0xc783ce=_['find'](_0xbb1888[_0x5497('0x59')],{'uniqueid':_0x4e0d4c[_0x5497('0x5b')]});if(_0xc783ce){return BPromise[_0x5497('0x69')]()[_0x5497('0x20')](function(){if(_0xc783ce['channel']){return ami[_0x5497('0x1b')]({'action':_0x5497('0x6a'),'channel':_0xc783ce[_0x5497('0x5c')],'mixmonitorid':_0x4e0d4c['mixmonitorid']})[_0x5497('0x1d')](function(_0x50a144){});}})['then'](function(){if(_0xc783ce['destinationchannel']){return ami[_0x5497('0x1b')]({'action':_0x5497('0x6a'),'channel':_0xc783ce[_0x5497('0x6b')],'mixmonitorid':_0x4e0d4c['mixmonitorid']})[_0x5497('0x1d')](function(_0x1e1b12){});}})[_0x5497('0x20')](function(_0x35e75a){var _0x4fec68=_[_0x5497('0x5a')](_0xc783ce[_0x5497('0x6c')],{'mixmonitorid':_0x4e0d4c[_0x5497('0x65')]});if(_0x4fec68){_0x4fec68['status']=_0x5497('0x6d');}})[_0x5497('0x20')](function(){var _0xb3eec2=util[_0x5497('0x5e')](_0x5497('0x5d'),_0x4e0d4c[_0x5497('0x6e')]||_0x4e0d4c[_0x5497('0x5b')],_0x4e0d4c['format']||_0x5497('0x5f'));var _0x17186e=_[_0x5497('0x5a')](_0xc783ce[_0x5497('0x6c')],{'filename':'/var/spool/asterisk/monitor/'+_0xb3eec2['toLowerCase']()});if(_0x17186e){_0x17186e['status']=_0x5497('0x6d');}})[_0x5497('0x20')](function(){_0x1f3965({'code':0xc8,'message':[_0x4e0d4c[_0x5497('0x5b')],'StopMixMonitor\x20Success'][_0x5497('0x15')]('\x20')});})[_0x5497('0x1d')](function(_0x3c1363){_0x37e0b9(_0x480582[_0x5497('0x12')](0x1f5,[_0x4e0d4c[_0x5497('0x5b')],_0x3c1363[_0x5497('0x1c')][_0x5497('0x63')]()][_0x5497('0x15')]('\x20')));});}else{return _0x37e0b9(_0x480582[_0x5497('0x12')](0x1f5,_0x5497('0x6f')));}});},'VoiceQueuesChannels':function(_0x1fc6ad){return new Promise(function(_0x5a8b3a,_0x15d5a4){var _0x2940ec=_[_0x5497('0x58')](_0xbb1888['queueChannels']);_0x5a8b3a({'count':_0x2940ec[_0x5497('0x56')],'rows':_0x2940ec});});},'VoiceQueuesChannel':function(_0x589008){var _0x21c780=this;return new Promise(function(_0x469e97,_0x4ca2d2){var _0x2c67d7=schema(properties[_0x5497('0x70')])[_0x5497('0x2')](_0x589008);if(_0x2c67d7[_0x5497('0x56')]>0x0){return _0x4ca2d2(_0x21c780['error'](0x1f4,_[_0x5497('0x68')](_0x2c67d7,_0x5497('0x1c'))[_0x5497('0x15')](',\x20')));}var _0x530a44=_[_0x5497('0x5a')](_0xbb1888[_0x5497('0x71')],{'uniqueid':_0x589008['uniqueid']});if(_0x530a44){_0x469e97(_0x530a44);}else{return _0x4ca2d2(_0x21c780[_0x5497('0x12')](0x1f5,_0x5497('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x6c9547){var _0x560c15=this;return new Promise(function(_0x4dbd4e,_0x3cc968){if(ami[_0x5497('0x11')]()==![]){return _0x3cc968(_0x560c15[_0x5497('0x12')](0x1f4,[config[_0x5497('0x13')]['ip'],config[_0x5497('0x13')][_0x5497('0x14')],_0x5497('0x1e')]['join']('\x20')));}var _0x48a571=schema(properties[_0x5497('0x72')])[_0x5497('0x2')](_0x6c9547);if(_0x48a571['length']>0x0){return _0x3cc968(_0x560c15[_0x5497('0x12')](0x1f4,_[_0x5497('0x68')](_0x48a571,_0x5497('0x1c'))['join'](',\x20')));}var _0xd55539=_[_0x5497('0x5a')](_0xbb1888['queueChannels'],{'uniqueid':_0x6c9547[_0x5497('0x5b')]});if(_0xd55539&&_0xd55539[_0x5497('0x5c')]){return ami[_0x5497('0x1b')]({'action':_0x5497('0x73'),'channel':_0xd55539[_0x5497('0x5c')]})['then'](function(_0x2bad48){_0x4dbd4e({'code':0xc8,'message':[_0x6c9547[_0x5497('0x5b')],_0x2bad48[_0x5497('0x1c')][_0x5497('0x63')]()][_0x5497('0x15')]('\x20')});})['catch'](function(_0x394bf3){_0x3cc968(_0x560c15[_0x5497('0x12')](0x1f5,[_0x6c9547[_0x5497('0x5b')],_0x394bf3[_0x5497('0x1c')]['toLowerCase']()][_0x5497('0x15')]('\x20')));});}else{return _0x3cc968(_0x560c15[_0x5497('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0xb72eed){var _0x40dc61=this;return new Promise(function(_0x803ac6,_0x3a8cf9){if(ami['isConnected']()==![]){return _0x3a8cf9(_0x40dc61['error'](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x5497('0x1e')][_0x5497('0x15')]('\x20')));}var _0x15d0da=schema(properties[_0x5497('0x74')])[_0x5497('0x2')](_0xb72eed);if(_0x15d0da['length']>0x0){return _0x3a8cf9(_0x40dc61['error'](0x1f4,_[_0x5497('0x68')](_0x15d0da,_0x5497('0x1c'))[_0x5497('0x15')](',\x20')));}var _0x2737a2=_[_0x5497('0x5a')](_0xbb1888[_0x5497('0x71')],{'uniqueid':_0xb72eed[_0x5497('0x5b')]});if(_0x2737a2&&_0x2737a2[_0x5497('0x5c')]){return ami[_0x5497('0x1b')]({'action':_0x5497('0x75'),'channel':_0x2737a2['channel'],'exten':_0xb72eed[_0x5497('0x76')],'context':_0xb72eed[_0x5497('0x77')]||_0x2737a2[_0x5497('0x77')],'priority':0x1})[_0x5497('0x20')](function(_0x20538f){_0x803ac6({'code':0xc8,'message':[_0xb72eed[_0x5497('0x5b')],_0x20538f['message'][_0x5497('0x63')]()]['join']('\x20')});})[_0x5497('0x1d')](function(_0x420b6b){_0x3a8cf9(_0x40dc61[_0x5497('0x12')](0x1f5,[_0xb72eed['uniqueid'],_0x420b6b['message'][_0x5497('0x63')]()][_0x5497('0x15')]('\x20')));});}else{return _0x3a8cf9(_0x40dc61[_0x5497('0x12')](0x1f5,_0x5497('0x6f')));}});},'Agents':function(_0x46f681){return new Promise(function(_0x1876d2,_0x2a1d6e){var _0x41c82d=_['values'](_0xbb1888['agents']);_0x1876d2({'count':_0x41c82d['length'],'rows':_0x41c82d});});},'Telephones':function(_0x1f47e6){return new Promise(function(_0x1dfe31,_0x160b4b){var _0xc81d7d=_['values'](_0xbb1888['telephones']);_0x1dfe31({'count':_0xc81d7d[_0x5497('0x56')],'rows':_0xc81d7d});});},'Trunks':function(_0xf38193){return new Promise(function(_0x5dd9bc,_0x83b240){var _0x2fc11a=_[_0x5497('0x58')](_0xbb1888[_0x5497('0x78')]);_0x5dd9bc({'count':_0x2fc11a['length'],'rows':_0x2fc11a});});},'OutboundChannels':function(_0x4bbcf1){return new Promise(function(_0x55e597,_0x5d914c){var _0x50a75b=_[_0x5497('0x58')](_0xbb1888['outboundChannels']);_0x55e597({'count':_0x50a75b[_0x5497('0x56')],'rows':_0x50a75b});});},'Outbound':function(_0x5aa5e1){return new Promise(function(_0x2a1424,_0x26a358){_0x2a1424(_0xbb1888[_0x5497('0x79')]);});},'Campaigns':function(_0x2f379e){return new Promise(function(_0x103b0c,_0x188525){var _0x525fe6=_[_0x5497('0x58')](_0xbb1888['campaigns']);_0x103b0c({'count':_0x525fe6[_0x5497('0x56')],'rows':_0x525fe6});});},'VoiceQueuesPreview':function(_0x2721b2){var _0x9e03a5=this;return new Promise(function(_0xb5a807,_0x33cd5a){_0x5d5272[_0x5497('0x7a')](_0x2721b2['id'])[_0x5497('0x20')](function(_0x21371b){_0xb5a807({'code':0xc8,'message':_0x21371b[_0x5497('0x1c')]});})[_0x5497('0x1d')](function(_0x5daeb2){_0x33cd5a(_0x9e03a5[_0x5497('0x12')](0x1f4,_0x5daeb2['message']));});});},'EventManager':function(_0x41ec68){var _0x459409=this;return new Promise(function(_0x5e4229,_0x3135bd){if(!_0x41ec68[_0x5497('0x7b')]){return _0x3135bd(_0x459409[_0x5497('0x12')](0x1f4,_0x5497('0x7c')));}ami[_0x5497('0x7d')](_0x5497('0x7e')+_0x41ec68[_0x5497('0x7b')],_0x41ec68[_0x5497('0x1c')]);_0x5e4229({'code':0xc8,'message':_0x41ec68});});},'FaxAccounts':function(_0x456ea4){return new Promise(function(_0x188fc1,_0x208a62){var _0x926bc1=_[_0x5497('0x58')](_0xbb1888[_0x5497('0x7f')]);_0x188fc1({'count':_0x926bc1['length'],'rows':_0x926bc1});});},'SendFax':function(_0x37c17e){var _0x163b5b=this;return new Promise(function(_0x3a31be,_0xeecd7){_0x539a27[_0x5497('0x80')](_0x37c17e)['then'](function(_0x3e8fce){_0x3a31be({'code':0xc8,'message':_0x3e8fce[_0x5497('0x1c')]});})['catch'](function(_0x58fe2a){_0xeecd7(_0x163b5b[_0x5497('0x12')](0x1f4,_0x58fe2a[_0x5497('0x1c')]));});});},'CheckAfterSend':function(_0x36507a){var _0x14f693=this;return new Promise(function(_0x3d649c,_0x585ad6){_0x539a27['checkAfterSend'](_0x36507a)[_0x5497('0x20')](function(_0x593b38){_0x3d649c({'code':0xc8,'message':_0x593b38[_0x5497('0x1c')]});})[_0x5497('0x1d')](function(_0x3fa5d8){_0x585ad6(_0x14f693[_0x5497('0x12')](0x1f4,_0x3fa5d8[_0x5497('0x1c')]));});});}};var _0x13350b=jayson['server'](_0x1d0019)['http']();_0x13350b['on'](_0x5497('0x12'),function(_0x40fce7){return _0x4f563d(_0x40fce7);});_0x13350b[_0x5497('0x8')](0x232a,'127.0.0.1',function(){console[_0x5497('0x81')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x37e48d(_0x5497('0x82')+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 4ffc380..866dc30 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 _0xac00=['resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridnum','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','user:%s','name','format','trigger:%s','action','toLowerCase','bluebird','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','info','[CM][%s][%s]','stringify','exec','data2','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','firstName','mobile','fax','createdAt','updatedAt','union'];(function(_0x583f7d,_0x5e9fd7){var _0x318051=function(_0x578c8e){while(--_0x578c8e){_0x583f7d['push'](_0x583f7d['shift']());}};_0x318051(++_0x5e9fd7);}(_0xac00,0x1c1));var _0x0ac0=function(_0xf72786,_0x1a0ddd){_0xf72786=_0xf72786-0x0;var _0x113f3e=_0xac00[_0xf72786];return _0x113f3e;};'use strict';var _=require('lodash');var BPromise=require(_0x0ac0('0x0'));var Redis=require('ioredis');var util=require('util');var config=require(_0x0ac0('0x1'));var logger=require(_0x0ac0('0x2'))(_0x0ac0('0x3'));var cmContactRpc=require(_0x0ac0('0x4'));config['redis']=_[_0x0ac0('0x5')](config[_0x0ac0('0x6')],{'host':_0x0ac0('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0ac0('0x6')]));function emit(_0x869b09,_0x7b0c71,_0x499317,_0x280db0,_0x2c3700){logger[_0x0ac0('0x8')](_0x0ac0('0x9'),_0x869b09,_0x7b0c71['id'],_0x499317,_0x280db0,JSON[_0x0ac0('0xa')](_0x2c3700));io['to'](_0x499317)['emit'](_0x280db0,_0x2c3700);}exports[_0x0ac0('0xb')]=function(_0x2b0f1c,_0x524d90,_0x12e311,_0x132eb0){var _0x3c9f42,_0x54f08f;var _0x58f4e3={};var _0x187f47=Number(_0x12e311['data1']);var _0x3a1504=_0x12e311[_0x0ac0('0xc')]?Boolean(Number(_0x12e311[_0x0ac0('0xc')])):![];var _0x4785b2;if(_0x132eb0[_0x0ac0('0xd')]){_0x58f4e3['id']=_0x132eb0[_0x0ac0('0xd')];}if(!_0x58f4e3['id']){_0x58f4e3[_0x0ac0('0xe')]=_0x187f47;_0x4785b2=_0x12e311[_0x0ac0('0xf')]&&_0x12e311[_0x0ac0('0xf')]!=='0'?_0x12e311[_0x0ac0('0xf')][_0x0ac0('0x10')](','):[_0x0ac0('0x11')];_0x58f4e3[_0x0ac0('0x12')]=_[_0x0ac0('0x13')](_0x4785b2,function(_0x53537c){var _0x819fd7={};_0x819fd7[_0x53537c]=_0x132eb0[_0x0ac0('0x14')]?_0x132eb0[_0x0ac0('0x15')]:_0x132eb0['calleridnum'];return _0x819fd7;});}var _0x564e8c=['id',_0x0ac0('0x16'),'lastName','phone',_0x0ac0('0x17'),_0x0ac0('0x18'),'ListId',_0x0ac0('0x19'),'scheduledAt',_0x0ac0('0x1a')];var _0x32edb3=_[_0x0ac0('0x1b')](_0x564e8c,_0x4785b2);BPromise[_0x0ac0('0x1c')]()[_0x0ac0('0x1d')](cmContactRpc['getContacts']({'attributes':_0x32edb3,'where':_0x58f4e3}))[_0x0ac0('0x1d')](function(_0x25b30e){_0x54f08f=_0x25b30e;if(!_[_0x0ac0('0x1e')](_0x54f08f)){if(_0x54f08f[_0x0ac0('0x1f')]===0x1){_0x3c9f42=_0x54f08f[0x0];logger[_0x0ac0('0x8')](_0x0ac0('0x20'),_0x132eb0[_0x0ac0('0x21')],_0x524d90['id'],_0x3c9f42['id']);}else{logger[_0x0ac0('0x8')](_0x0ac0('0x22'),_0x132eb0[_0x0ac0('0x21')],_0x524d90['id'],_[_0x0ac0('0x13')](_0x54f08f,'id')[_0x0ac0('0x23')](','));}return;}else{logger['info'](_0x0ac0('0x24'),_0x132eb0[_0x0ac0('0x21')],_0x524d90['id']);var _0x299fcd={'ListId':_0x187f47};var _0x464e23=_0x12e311[_0x0ac0('0x25')]&&_0x12e311[_0x0ac0('0x25')]!=='0'?_0x12e311[_0x0ac0('0x25')]:'phone';if(_0x3a1504){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x132eb0['uniqueid'],_0x524d90['id']);_0x299fcd[_0x464e23]=_[_0x0ac0('0x26')](_0x132eb0[_0x0ac0('0x14')])?_0x132eb0[_0x0ac0('0x27')]:_0x132eb0[_0x0ac0('0x15')];if(_[_0x0ac0('0x26')](_0x132eb0['routeId'])){_0x299fcd[_0x0ac0('0x16')]=_0x132eb0[_0x0ac0('0x28')]&&_0x132eb0[_0x0ac0('0x28')]!==_0x0ac0('0x29')?_0x132eb0[_0x0ac0('0x28')]:_0x0ac0('0x2a');}else{_0x299fcd[_0x0ac0('0x16')]=_0x132eb0[_0x0ac0('0x2b')]&&_0x132eb0['destcalleridname']!==_0x0ac0('0x29')?_0x132eb0[_0x0ac0('0x2b')]:_0x0ac0('0x2a');}return BPromise['resolve']()[_0x0ac0('0x1d')](cmContactRpc[_0x0ac0('0x2c')](_0x299fcd))[_0x0ac0('0x1d')](function(_0x4872e9){_0x3c9f42=_0x4872e9;_0x54f08f[_0x0ac0('0x2d')](_0x4872e9);if(_0x3c9f42){logger[_0x0ac0('0x8')](_0x0ac0('0x2e'),_0x132eb0['uniqueid'],_0x524d90['id'],_0x3c9f42['id']);}return;});}else{logger[_0x0ac0('0x8')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x132eb0[_0x0ac0('0x21')],_0x524d90['id']);_0x299fcd[_0x464e23]=_[_0x0ac0('0x26')](_0x132eb0[_0x0ac0('0x14')])?_0x132eb0[_0x0ac0('0x27')]:_0x132eb0['destcalleridnum'];if(_[_0x0ac0('0x26')](_0x132eb0[_0x0ac0('0x14')])){_0x299fcd[_0x0ac0('0x16')]=_0x132eb0['calleridname']&&_0x132eb0[_0x0ac0('0x28')]!==''?_0x132eb0['calleridname']:'Unknown';}else{_0x299fcd[_0x0ac0('0x16')]=_0x132eb0[_0x0ac0('0x2b')]&&_0x132eb0[_0x0ac0('0x2b')]!==_0x0ac0('0x29')?_0x132eb0[_0x0ac0('0x2b')]:_0x0ac0('0x2a');}_0x3c9f42=_0x299fcd;_0x54f08f[_0x0ac0('0x2d')](_0x299fcd);return;}}})[_0x0ac0('0x1d')](function(){if(_0x2b0f1c){emit(_0x132eb0[_0x0ac0('0x21')],_0x524d90,util['format'](_0x0ac0('0x2f'),_0x2b0f1c[_0x0ac0('0x30')]),util[_0x0ac0('0x31')](_0x0ac0('0x32'),_0x12e311[_0x0ac0('0x33')][_0x0ac0('0x34')]()),{'evt':_['merge'](_0x132eb0,{'autoCreate':_0x3a1504}),'contact':_0x3c9f42===undefined?{}:_0x3c9f42,'contacts':_0x54f08f[_0x0ac0('0x1f')]===0x0?undefined:_0x54f08f});}});}; \ No newline at end of file +var _0x8a89=['scheduledAt','union','resolve','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[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','format','trigger:%s','action','toLowerCase','merge','lodash','ioredis','util','trigger','../../rpc/cmContact','defaults','localhost','socket.io-emitter','redis','info','data2','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a89,0x119));var _0x98a8=function(_0x5c0ff6,_0x22cdd2){_0x5c0ff6=_0x5c0ff6-0x0;var _0x1135cd=_0x8a89[_0x5c0ff6];return _0x1135cd;};'use strict';var _=require(_0x98a8('0x0'));var BPromise=require('bluebird');var Redis=require(_0x98a8('0x1'));var util=require(_0x98a8('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x98a8('0x3'));var cmContactRpc=require(_0x98a8('0x4'));config['redis']=_[_0x98a8('0x5')](config['redis'],{'host':_0x98a8('0x6'),'port':0x18eb});var io=require(_0x98a8('0x7'))(new Redis(config[_0x98a8('0x8')]));function emit(_0x3110fe,_0x5a3d14,_0x24dd7e,_0x578302,_0x407e2e){logger[_0x98a8('0x9')]('[CM][%s][%s]',_0x3110fe,_0x5a3d14['id'],_0x24dd7e,_0x578302,JSON['stringify'](_0x407e2e));io['to'](_0x24dd7e)['emit'](_0x578302,_0x407e2e);}exports['exec']=function(_0x47c879,_0x26a435,_0x4f6a30,_0x4d8dcb){var _0x21468f,_0x2fb423;var _0x5bea0c={};var _0x3ebbcd=Number(_0x4f6a30['data1']);var _0x1e2937=_0x4f6a30[_0x98a8('0xa')]?Boolean(Number(_0x4f6a30[_0x98a8('0xa')])):![];var _0x12d96e;if(_0x4d8dcb['xmd-contactid']){_0x5bea0c['id']=_0x4d8dcb[_0x98a8('0xb')];}if(!_0x5bea0c['id']){_0x5bea0c[_0x98a8('0xc')]=_0x3ebbcd;_0x12d96e=_0x4f6a30[_0x98a8('0xd')]&&_0x4f6a30[_0x98a8('0xd')]!=='0'?_0x4f6a30[_0x98a8('0xd')]['split'](','):[_0x98a8('0xe')];_0x5bea0c[_0x98a8('0xf')]=_[_0x98a8('0x10')](_0x12d96e,function(_0x5692ed){var _0x206158={};_0x206158[_0x5692ed]=_0x4d8dcb[_0x98a8('0x11')]?_0x4d8dcb[_0x98a8('0x12')]:_0x4d8dcb[_0x98a8('0x13')];return _0x206158;});}var _0x39cbb4=['id',_0x98a8('0x14'),_0x98a8('0x15'),_0x98a8('0xe'),_0x98a8('0x16'),_0x98a8('0x17'),_0x98a8('0xc'),_0x98a8('0x18'),_0x98a8('0x19'),'updatedAt'];var _0x76716e=_[_0x98a8('0x1a')](_0x39cbb4,_0x12d96e);BPromise[_0x98a8('0x1b')]()[_0x98a8('0x1c')](cmContactRpc[_0x98a8('0x1d')]({'attributes':_0x76716e,'where':_0x5bea0c}))[_0x98a8('0x1c')](function(_0x3f9312){_0x2fb423=_0x3f9312;if(!_['isEmpty'](_0x2fb423)){if(_0x2fb423[_0x98a8('0x1e')]===0x1){_0x21468f=_0x2fb423[0x0];logger[_0x98a8('0x9')](_0x98a8('0x1f'),_0x4d8dcb[_0x98a8('0x20')],_0x26a435['id'],_0x21468f['id']);}else{logger[_0x98a8('0x9')](_0x98a8('0x21'),_0x4d8dcb[_0x98a8('0x20')],_0x26a435['id'],_[_0x98a8('0x10')](_0x2fb423,'id')['join'](','));}return;}else{logger[_0x98a8('0x9')](_0x98a8('0x22'),_0x4d8dcb[_0x98a8('0x20')],_0x26a435['id']);var _0x23bbfa={'ListId':_0x3ebbcd};var _0x19d57d=_0x4f6a30['data4']&&_0x4f6a30['data4']!=='0'?_0x4f6a30[_0x98a8('0x23')]:_0x98a8('0xe');if(_0x1e2937){logger[_0x98a8('0x9')](_0x98a8('0x24'),_0x4d8dcb[_0x98a8('0x20')],_0x26a435['id']);_0x23bbfa[_0x19d57d]=_['isNil'](_0x4d8dcb['routeId'])?_0x4d8dcb['calleridnum']:_0x4d8dcb[_0x98a8('0x12')];if(_[_0x98a8('0x25')](_0x4d8dcb[_0x98a8('0x11')])){_0x23bbfa[_0x98a8('0x14')]=_0x4d8dcb[_0x98a8('0x26')]&&_0x4d8dcb[_0x98a8('0x26')]!==_0x98a8('0x27')?_0x4d8dcb[_0x98a8('0x26')]:'Unknown';}else{_0x23bbfa[_0x98a8('0x14')]=_0x4d8dcb[_0x98a8('0x28')]&&_0x4d8dcb['destcalleridname']!==_0x98a8('0x27')?_0x4d8dcb[_0x98a8('0x28')]:_0x98a8('0x29');}return BPromise[_0x98a8('0x1b')]()[_0x98a8('0x1c')](cmContactRpc[_0x98a8('0x2a')](_0x23bbfa))['then'](function(_0x42de84){_0x21468f=_0x42de84;_0x2fb423[_0x98a8('0x2b')](_0x42de84);if(_0x21468f){logger[_0x98a8('0x9')](_0x98a8('0x2c'),_0x4d8dcb['uniqueid'],_0x26a435['id'],_0x21468f['id']);}return;});}else{logger['info'](_0x98a8('0x2d'),_0x4d8dcb[_0x98a8('0x20')],_0x26a435['id']);_0x23bbfa[_0x19d57d]=_[_0x98a8('0x25')](_0x4d8dcb[_0x98a8('0x11')])?_0x4d8dcb[_0x98a8('0x13')]:_0x4d8dcb['destcalleridnum'];if(_[_0x98a8('0x25')](_0x4d8dcb[_0x98a8('0x11')])){_0x23bbfa[_0x98a8('0x14')]=_0x4d8dcb['calleridname']&&_0x4d8dcb[_0x98a8('0x26')]!==_0x98a8('0x27')?_0x4d8dcb[_0x98a8('0x26')]:_0x98a8('0x29');}else{_0x23bbfa['firstName']=_0x4d8dcb[_0x98a8('0x28')]&&_0x4d8dcb[_0x98a8('0x28')]!==_0x98a8('0x27')?_0x4d8dcb['destcalleridname']:_0x98a8('0x29');}_0x21468f=_0x23bbfa;_0x2fb423[_0x98a8('0x2b')](_0x23bbfa);return;}}})[_0x98a8('0x1c')](function(){if(_0x47c879){emit(_0x4d8dcb['uniqueid'],_0x26a435,util[_0x98a8('0x2e')]('user:%s',_0x47c879['name']),util['format'](_0x98a8('0x2f'),_0x4f6a30[_0x98a8('0x30')][_0x98a8('0x31')]()),{'evt':_[_0x98a8('0x32')](_0x4d8dcb,{'autoCreate':_0x1e2937}),'contact':_0x21468f===undefined?{}:_0x21468f,'contacts':_0x2fb423[_0x98a8('0x1e')]===0x0?undefined:_0x2fb423});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 349d6e4..de81a38 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 _0xab57=['query','search','replace','AllConditions','every','channel','AnyConditions','checkConditions','field','account','value','ChatWebsiteId','upperFirst','operator','AccountId','interaction','message','event','agent','membername','lastevent','exports','util','lodash','url','mustache','./urlforward','../../../config/environment','../../../config/logger','../ami','defaults','redis','localhost','socket.io-emitter','popup','triggers','agents','voiceQueues','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:outgoingmessage','info','stringify','clone','checkTriggers','prototype','hasOwnProperty','checkTrigger','Actions','length','motionbar','browser','data1','data2','html','templates','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','uriLocation','windowWidth','data5','windowHeight','data6','600','winapp','winApplication','winArguments','emit','format','user:%s','interface','trigger:%s:%s','action','toLowerCase','merge','jscripty','name','trigger:%s','contactmanager','integration','exec','accounts','queue','routeId','urlforward','parse'];(function(_0x25b59c,_0xc4cf14){var _0x89c4b4=function(_0x563ad8){while(--_0x563ad8){_0x25b59c['push'](_0x25b59c['shift']());}};_0x89c4b4(++_0xc4cf14);}(_0xab57,0x1e6));var _0x7ab5=function(_0x56bc44,_0x4b9e7c){_0x56bc44=_0x56bc44-0x0;var _0x592a81=_0xab57[_0x56bc44];return _0x592a81;};'use strict';var util=require(_0x7ab5('0x0'));var _=require(_0x7ab5('0x1'));var url=require(_0x7ab5('0x2'));var Mustache=require(_0x7ab5('0x3'));var Redis=require('ioredis');var urlforward=require(_0x7ab5('0x4'));var integration=require('./integration');var cmContact=require('./cmContact');var script=require('./script');var config=require(_0x7ab5('0x5'));var logger=require(_0x7ab5('0x6'))('trigger');var ami=require(_0x7ab5('0x7'));config['redis']=_[_0x7ab5('0x8')](config[_0x7ab5('0x9')],{'host':_0x7ab5('0xa'),'port':0x18eb});var io=require(_0x7ab5('0xb'))(new Redis(config[_0x7ab5('0x9')]));var operators={'equals':function(_0x1957f1,_0x431792){return _0x1957f1==_0x431792;},'not_equals':function(_0x3e9023,_0x3bf8d9){return _0x3e9023!=_0x3bf8d9;}};var barAndWebActions=[_0x7ab5('0xc'),'url','winapp'];function Trigger(_0x9a9671){this[_0x7ab5('0xd')]=_0x9a9671[_0x7ab5('0xd')];this['agents']=_0x9a9671[_0x7ab5('0xe')];this['voiceQueues']=_0x9a9671[_0x7ab5('0xf')];this['templates']=_0x9a9671['templates'];this[_0x7ab5('0x10')]=_0x9a9671[_0x7ab5('0x10')];this[_0x7ab5('0x11')]=_0x9a9671['zendeskAccounts'];this[_0x7ab5('0x12')]=_0x9a9671[_0x7ab5('0x12')];this[_0x7ab5('0x13')]=_0x9a9671[_0x7ab5('0x13')];this[_0x7ab5('0x14')]=_0x9a9671[_0x7ab5('0x14')];this[_0x7ab5('0x15')]=_0x9a9671[_0x7ab5('0x15')];this[_0x7ab5('0x16')]=_0x9a9671['deskAccounts'];this[_0x7ab5('0x17')]=_0x9a9671[_0x7ab5('0x17')];this[_0x7ab5('0x18')]=_0x9a9671['servicenowAccounts'];this[_0x7ab5('0x19')]=_0x9a9671[_0x7ab5('0x19')];this['freshsalesAccounts']=_0x9a9671[_0x7ab5('0x1a')];this['accounts']={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x7ab5('0x13')],'freshdesk':this[_0x7ab5('0x12')],'sugarcrm':this[_0x7ab5('0x14')],'zoho':this[_0x7ab5('0x15')],'desk':this[_0x7ab5('0x16')],'vtiger':this[_0x7ab5('0x17')],'dynamics365':this['dynamics365Accounts'],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x7ab5('0x18')]};ami['on']('custom:agentcalled',this[_0x7ab5('0x1b')][_0x7ab5('0x1c')](this));ami['on'](_0x7ab5('0x1d'),this[_0x7ab5('0x1b')][_0x7ab5('0x1c')](this));ami['on'](_0x7ab5('0x1e'),this[_0x7ab5('0x1b')][_0x7ab5('0x1c')](this));ami['on'](_0x7ab5('0x1f'),this[_0x7ab5('0x1b')][_0x7ab5('0x1c')](this));ami['on'](_0x7ab5('0x20'),this[_0x7ab5('0x1b')]['bind'](this));ami['on'](_0x7ab5('0x21'),this[_0x7ab5('0x1b')][_0x7ab5('0x1c')](this));ami['on'](_0x7ab5('0x22'),this[_0x7ab5('0x1b')]['bind'](this));ami['on'](_0x7ab5('0x23'),this['syncCustomEvent'][_0x7ab5('0x1c')](this));ami['on']('custom:agentreject',this[_0x7ab5('0x1b')]['bind'](this));ami['on'](_0x7ab5('0x24'),this['syncCustomEvent'][_0x7ab5('0x1c')](this));ami['on'](_0x7ab5('0x25'),this[_0x7ab5('0x1b')][_0x7ab5('0x1c')](this));ami['on'](_0x7ab5('0x26'),this[_0x7ab5('0x1b')]['bind'](this));ami['on'](_0x7ab5('0x27'),this[_0x7ab5('0x28')][_0x7ab5('0x1c')](this));ami['on'](_0x7ab5('0x29'),this[_0x7ab5('0x28')][_0x7ab5('0x1c')](this));ami['on']('custom:dialend',this[_0x7ab5('0x28')][_0x7ab5('0x1c')](this));ami['on'](_0x7ab5('0x2a'),this['syncCustomEvent'][_0x7ab5('0x1c')](this));ami['on']('custom:closedinteraction',this[_0x7ab5('0x1b')]['bind'](this));ami['on']('custom:incomingmessage',this['syncCustomEvent'][_0x7ab5('0x1c')](this));ami['on'](_0x7ab5('0x2b'),this[_0x7ab5('0x1b')][_0x7ab5('0x1c')](this));ami['on']('custom:acceptmessage',this[_0x7ab5('0x1b')][_0x7ab5('0x1c')](this));ami['on']('custom:rejectmessage',this[_0x7ab5('0x1b')]['bind'](this));}Trigger['prototype']['emit']=function(_0x25a266,_0x23dcf9,_0x2c1506){logger[_0x7ab5('0x2c')](_0x25a266,_0x23dcf9,JSON[_0x7ab5('0x2d')](_0x2c1506));io['to'](_0x25a266)['emit'](_0x23dcf9,_0x2c1506);};Trigger['prototype'][_0x7ab5('0x1b')]=function(_0x1b0c8d){var _0x116b5f=_[_0x7ab5('0x2e')](_0x1b0c8d);this[_0x7ab5('0x2f')](_0x116b5f);};Trigger[_0x7ab5('0x30')]['syncAgentDial']=function(_0x258404){if(this[_0x7ab5('0xe')][_0x258404['interface']]){this[_0x7ab5('0x1b')](_0x258404);}};Trigger[_0x7ab5('0x30')][_0x7ab5('0x2f')]=function(_0x1a98c6){var _0x1c6d62;for(var _0x257073 in this[_0x7ab5('0xd')]){if(this['triggers'][_0x7ab5('0x31')](_0x257073)){if(this[_0x7ab5('0xd')][_0x257073]['status']){_0x1c6d62=this[_0x7ab5('0x32')](this[_0x7ab5('0xd')][_0x257073],_0x1a98c6);if(_0x1c6d62){_['merge'](_0x1a98c6,_0x1a98c6['variables']);for(var _0x4befc5=0x0,_0x5c4539,_0x171474,_0xaa1f8;_0x4befc50x0){_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 +var _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x4488c8,_0x2abc48){var _0x1994ff=function(_0x40ce58){while(--_0x40ce58){_0x4488c8['push'](_0x4488c8['shift']());}};_0x1994ff(++_0x2abc48);}(_0x7217,0x19e));var _0x7721=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x7217[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ 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 d06e7f7..4169b46 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 _0x85fb=['https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','redis','defaults','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','value','isNil','validateEmail','userEmail','length','internalemailaddress','email',']\x20Agent\x20found\x20','userId','systemuserid','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','contactid','info',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','includes','picklist','type','nameField','customField','idField','indexOf','content','incident','incidents','getString','Subjects','Descriptions','/contacts(','/systemusers(','ticketType','phonecall','phonecalls','assign','callDirection','queue','Fields','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/'];(function(_0x46ab02,_0x46f430){var _0x39d9a4=function(_0x6ec26a){while(--_0x6ec26a){_0x46ab02['push'](_0x46ab02['shift']());}};_0x39d9a4(++_0x46f430);}(_0x85fb,0x146));var _0xb85f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x85fb[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var BPromise=require(_0xb85f('0x0'));var rp=require(_0xb85f('0x1'));var util=require(_0xb85f('0x2'));var intUtil=require(_0xb85f('0x3'));var md5=require(_0xb85f('0x4'));var Redis=require(_0xb85f('0x5'));var logger=require(_0xb85f('0x6'))('dynamics365');var config=require('../../../../config/environment');config[_0xb85f('0x7')]=_[_0xb85f('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb85f('0x9'))(new Redis(config['redis']));function getAuthToken(_0x19572e,_0x19e2ac,_0x80298b){var _0x202d9e={'method':_0xb85f('0xa'),'uri':_0x19e2ac,'form':{'client_id':_0x19572e[_0xb85f('0xb')],'resource':_0x19572e[_0xb85f('0xc')],'username':_0x19572e[_0xb85f('0xd')],'password':_0x19572e['password'],'grant_type':_0xb85f('0xe'),'client_secret':_0x19572e[_0xb85f('0xf')]},'json':!![]};return rp(_0x202d9e)[_0xb85f('0x10')](function(_0x3b89a0){return _0x3b89a0[_0xb85f('0x11')];})[_0xb85f('0x12')](function(_0x37d58a){logger[_0xb85f('0x13')]('['+[_0x80298b[_0xb85f('0x14')]()]+_0xb85f('0x15'));return _0x37d58a[_0xb85f('0x16')];});}function getUser(_0x444447,_0x1d08e3,_0x14ad4b,_0x36b089,_0x3cd417,_0x56e94a){return new BPromise(function(_0x5d84e8,_0x48893c){return getAuthToken(_0x1d08e3,_0x36b089,_0x56e94a)['then'](function(_0x4c1e34){var _0x5f10c4={'method':_0xb85f('0x17'),'uri':_0x3cd417+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xb85f('0x18')+_0x4c1e34,'OData-Version':_0xb85f('0x19')},'json':!![]};return rp(_0x5f10c4);})[_0xb85f('0x10')](function(_0x47df0e){var _0x2dcee0=_0x47df0e[_0xb85f('0x1a')];var _0x1b8d8d=![];var _0x90d43a=null;if(!_[_0xb85f('0x1b')](_0x14ad4b)){if(intUtil[_0xb85f('0x1c')](_0x14ad4b['email'])){_0x444447[_0xb85f('0x1d')]=_0x14ad4b['email'];for(_0x90d43a=0x0;_0x90d43a<_0x2dcee0[_0xb85f('0x1e')];_0x90d43a++){if(_0x2dcee0[_0x90d43a][_0xb85f('0x1f')]===_0x14ad4b[_0xb85f('0x20')]&&!_0x2dcee0[_0x90d43a]['isdisabled']){_0x1b8d8d=!![];logger['info']('['+[_0x56e94a['toUpperCase']()]+_0xb85f('0x21')+_0x2dcee0[_0x90d43a]['systemuserid']+'!');_0x444447[_0xb85f('0x22')]=_0x2dcee0[_0x90d43a]['systemuserid'];}}}}if(!_0x1b8d8d){logger['info']('['+[_0x56e94a[_0xb85f('0x14')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x444447[_0xb85f('0x1d')]=_0x1d08e3[_0xb85f('0xd')];for(_0x90d43a=0x0;_0x90d43a<_0x2dcee0['length'];_0x90d43a++){if(_0x2dcee0[_0x90d43a][_0xb85f('0x1f')]===_0x1d08e3[_0xb85f('0xd')]){_0x444447[_0xb85f('0x22')]=_0x2dcee0[_0x90d43a][_0xb85f('0x23')];}}}_0x5d84e8(_0x444447);})['catch'](function(_0x2bdb40){_0x48893c(_0x2bdb40['message']);});});}function createEndUser(_0x3dae91,_0x375e04,_0x47e8a8,_0x4112a8,_0x4f6dee,_0x2948f3){return new BPromise(function(_0x1d6181,_0x44c141){return getAuthToken(_0x375e04,_0x47e8a8,_0x2948f3)[_0xb85f('0x10')](function(_0x42dd35){var _0x48e289=_0x2948f3[_0xb85f('0x24')]()===_0xb85f('0x25')?_0x4f6dee[_0xb85f('0x26')]:_0x4f6dee[_0xb85f('0x27')];var _0xbf721b={'method':_0xb85f('0xa'),'uri':_0x4112a8+_0xb85f('0x28'),'body':{'telephone1':_0x48e289,'fullname':_0x48e289,'firstname':_0x48e289,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x3dae91[_0xb85f('0x22')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x42dd35,'OData-Version':_0xb85f('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xbf721b);})['then'](function(_0x45bd23){var _0x4c5291=_0x45bd23[_0xb85f('0x29')][_0xb85f('0x2a')];var _0x5671a4=_0x4c5291[_0xb85f('0x2b')](_0x4c5291[_0xb85f('0x2c')]('(')+0x1,_0x4c5291['lastIndexOf'](')'));_0x3dae91[_0xb85f('0x2d')]=_0x5671a4;_0x1d6181(_0x3dae91);})[_0xb85f('0x12')](function(_0x24239a){_0x44c141(_0x24239a['message']);});});}function getEndUser(_0x18281e,_0x5846fa,_0x58eae7,_0x213226,_0x271c05,_0x215385){return new BPromise(function(_0xc4f560,_0x360575){var _0x4c5ff0=_0x215385['toLowerCase']()===_0xb85f('0x25')?_0x271c05[_0xb85f('0x26')]:_0x271c05['calleridnum'];return getAuthToken(_0x5846fa,_0x58eae7,_0x215385)[_0xb85f('0x10')](function(_0xe9692){var _0x580c5f={'method':'GET','uri':_0x213226+_0xb85f('0x2e')+_0x4c5ff0[_0xb85f('0x2f')]('+',_0xb85f('0x30'))+'\x27','headers':{'Authorization':_0xb85f('0x18')+_0xe9692,'If-None-Match':null,'OData-Version':_0xb85f('0x19')},'json':!![]};return rp(_0x580c5f);})['then'](function(_0x388ee5){var _0x3ee3ae=null;if(_0x388ee5){var _0x5e689e=_0x388ee5[_0xb85f('0x1a')];var _0x426f21=![];for(_0x3ee3ae=0x0;_0x3ee3ae<_0x5e689e[_0xb85f('0x1e')];_0x3ee3ae++){if(_0x5e689e[_0x3ee3ae][_0xb85f('0x31')]===_0x4c5ff0){_0x426f21=!![];_0x18281e[_0xb85f('0x2d')]=_0x5e689e[_0x3ee3ae][_0xb85f('0x32')];}}if(_0x426f21){_0xc4f560(_0x18281e);}else{return createEndUser(_0x18281e,_0x5846fa,_0x58eae7,_0x213226,_0x271c05,_0x215385)[_0xb85f('0x10')](function(_0x219673){logger[_0xb85f('0x33')]('['+[_0x215385[_0xb85f('0x14')]()]+_0xb85f('0x34'),_0x219673['enduserId']);_0xc4f560(_0x219673);});}}else{return createEndUser(_0x18281e,_0x5846fa,_0x58eae7,_0x213226,_0x271c05,_0x215385)['then'](function(_0x4e72f6){logger[_0xb85f('0x33')]('['+[_0x215385[_0xb85f('0x14')]()]+_0xb85f('0x35'),_0x4e72f6[_0xb85f('0x2d')]);_0xc4f560(_0x4e72f6);});}});});}function getCustomFields(_0x1cec1d,_0xc44c4e,_0x2250d8){var _0x127d9e={};if(_0x1cec1d[_0xb85f('0x1e')]>0x0){_['forEach'](_0x1cec1d,function(_0x2d3d28){if(_[_0xb85f('0x36')](['string',_0xb85f('0x37')],_0x2d3d28[_0xb85f('0x38')])&&_0x2d3d28[_0xb85f('0x39')]&&!_0x2d3d28[_0xb85f('0x3a')]){var _0x3b11b3=_0x2d3d28[_0xb85f('0x3b')][_0xb85f('0x24')]();var _0x1bcfd8=_0x3b11b3[_0xb85f('0x2b')](0x0,_0x3b11b3[_0xb85f('0x3c')]('_'));var _0x21fdfc=_0x3b11b3['substring'](_0x3b11b3[_0xb85f('0x3c')]('_')+0x1);if(_0x1bcfd8===_0x2250d8){_0x127d9e[_0x21fdfc]=_0x2d3d28[_0xb85f('0x3d')];}}});}return _0x127d9e;}function getTicket(_0x1242e8,_0x2aa907,_0x28335e,_0x3dc72c,_0xd9c616,_0x23e86a,_0x389dc8){return new BPromise(function(_0x1e55cf,_0x2d758b){var _0x287ae2;return getAuthToken(_0x2aa907,_0x28335e,_0x389dc8)[_0xb85f('0x10')](function(_0x55b1d8){if(_0x23e86a['ticketType']===_0xb85f('0x3e')){_0x287ae2={'method':_0xb85f('0xa'),'uri':_0x3dc72c+_0xb85f('0x3f'),'body':Object['assign']({},{'title':intUtil[_0xb85f('0x40')](_0x23e86a[_0xb85f('0x41')],_0xd9c616,'\x20'),'description':intUtil['getString'](_0x23e86a[_0xb85f('0x42')],_0xd9c616,'\x0a'),'customerid_contact@odata.bind':_0xb85f('0x43')+_0x1242e8['enduserId']+')','ownerid@odata.bind':_0xb85f('0x44')+_0x1242e8[_0xb85f('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x23e86a['Fields'],_0xd9c616,_0x23e86a['ticketType'])),'headers':{'Authorization':_0xb85f('0x18')+_0x55b1d8,'OData-Version':_0xb85f('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x23e86a[_0xb85f('0x45')]===_0xb85f('0x46')){_0x287ae2={'method':_0xb85f('0xa'),'uri':_0x3dc72c+_0xb85f('0x47'),'body':Object[_0xb85f('0x48')]({},{'subject':intUtil[_0xb85f('0x40')](_0x23e86a[_0xb85f('0x41')],_0xd9c616,'\x20'),'phonenumber':String(_0xd9c616[_0xb85f('0x27')]),'description':intUtil[_0xb85f('0x40')](_0x23e86a[_0xb85f('0x42')],_0xd9c616,'\x0a'),'regardingobjectid_contact@odata.bind':_0xb85f('0x43')+_0x1242e8[_0xb85f('0x2d')]+')','ownerid@odata.bind':_0xb85f('0x44')+_0x1242e8['userId']+')','directioncode':_0x1242e8[_0xb85f('0x49')]===_0xb85f('0x4a')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xb85f('0x44')+_0x1242e8[_0xb85f('0x22')]+')','participationtypemask':_0x1242e8[_0xb85f('0x49')]===_0xb85f('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':_0xb85f('0x43')+_0x1242e8[_0xb85f('0x2d')]+')','participationtypemask':_0x1242e8[_0xb85f('0x49')]===_0xb85f('0x4a')?0x1:0x2}]},getCustomFields(_0x23e86a[_0xb85f('0x4b')],_0xd9c616,_0x23e86a[_0xb85f('0x45')])),'headers':{'Authorization':_0xb85f('0x18')+_0x55b1d8,'OData-Version':_0xb85f('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x287ae2);})[_0xb85f('0x10')](function(_0xa20fe8){var _0x34925d=_0xa20fe8[_0xb85f('0x29')][_0xb85f('0x2a')];var _0x2fde9b=_0x34925d[_0xb85f('0x2b')](_0x34925d[_0xb85f('0x2c')]('(')+0x1,_0x34925d[_0xb85f('0x2c')](')'));_0x1242e8[_0xb85f('0x4c')]=_0x2fde9b;_0x1e55cf(_0x1242e8);})[_0xb85f('0x12')](function(_0x5aae8e){_0x2d758b(_0x5aae8e[_0xb85f('0x16')]);});});}function emit(_0x501bd6,_0x520d79,_0x3f3912,_0x443095){var _0x426daa={'uri':util[_0xb85f('0x4d')](_0xb85f('0x4e'),_0x501bd6,_0x3f3912,_0x443095)};io['to'](util[_0xb85f('0x4d')](_0xb85f('0x4f'),_0x520d79))[_0xb85f('0x50')](_0xb85f('0x51'),_0x426daa);}exports['cs']=function(_0x513c78,_0x1b9e8b,_0x305876,_0x5c4fac,_0x1d19e0,_0x2c0758,_0x2eef44,_0x5bfb13){var _0xecd791={};_0x2c0758[_0xb85f('0xc')]=intUtil[_0xb85f('0x52')](_0x2c0758[_0xb85f('0xc')]);_0x2c0758['serverUrl']=intUtil[_0xb85f('0x52')](_0x2c0758[_0xb85f('0x53')]);_0xecd791['callDirection']=_0x5bfb13===_0xb85f('0x4a')||_0x5bfb13===_0xb85f('0x54')?_0xb85f('0x4a'):'outbound';var _0x535d5d=util[_0xb85f('0x4d')](_0xb85f('0x55'),_0x2c0758['remoteUri']);var _0x12fff=util[_0xb85f('0x4d')](_0xb85f('0x56'),_0x2c0758[_0xb85f('0x57')]);var _0x1074e7=util[_0xb85f('0x4d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2c0758[_0xb85f('0x53')],_0x1b9e8b[_0xb85f('0x58')],md5(_0x1b9e8b['uniqueid']));if(_0x1d19e0&&_0x1d19e0[_0xb85f('0x59')]){logger[_0xb85f('0x33')](_0xb85f('0x5a'),_0xb85f('0x5b'));_0x1b9e8b['recordingURL']=_0x1074e7;}else if(_0x2eef44&&_0x2eef44[_0xb85f('0x5c')]&&_0x2eef44['recordingFormat']!==_0xb85f('0x5d')){logger[_0xb85f('0x33')](_0xb85f('0x5e'),_0xb85f('0x5b'));_0x1b9e8b['recordingURL']=_0x1074e7;}else{_0x1b9e8b[_0xb85f('0x5f')]='';}return getUser(_0xecd791,_0x2c0758,_0x5c4fac,_0x12fff,_0x535d5d,_0x5bfb13)['then'](function(_0x5a0bfe){logger[_0xb85f('0x33')]('['+_0x5bfb13[_0xb85f('0x14')]()+_0xb85f('0x60'),_0x5a0bfe[_0xb85f('0x22')]);logger[_0xb85f('0x33')]('['+_0x5bfb13[_0xb85f('0x14')]()+_0xb85f('0x61'),_0x5a0bfe[_0xb85f('0x1d')]);return getEndUser(_0x5a0bfe,_0x2c0758,_0x12fff,_0x535d5d,_0x1b9e8b,_0x5bfb13);})['then'](function(_0x358257){logger[_0xb85f('0x33')]('['+_0x5bfb13[_0xb85f('0x14')]()+_0xb85f('0x62'),_0x358257['enduserId']);logger['info']('['+_0x5bfb13[_0xb85f('0x14')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x1b9e8b[_0xb85f('0x27')]);return getTicket(_0x358257,_0x2c0758,_0x12fff,_0x535d5d,_0x1b9e8b,_0x305876,_0x5bfb13);})['then'](function(_0x2ad5d0){logger[_0xb85f('0x33')](util[_0xb85f('0x4d')]('['+_0x5bfb13[_0xb85f('0x14')]()+_0xb85f('0x63'),_0x305876['ticketType'],_0x2ad5d0[_0xb85f('0x4c')]));logger[_0xb85f('0x33')](util[_0xb85f('0x4d')]('['+_0x5bfb13['toUpperCase']()+_0xb85f('0x64'),_0x5bfb13));if(_0x5bfb13!==_0xb85f('0x54')){logger[_0xb85f('0x33')]('['+_0x5bfb13[_0xb85f('0x14')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2c0758['remoteUri'],_0x5c4fac[_0xb85f('0x65')],_0x305876[_0xb85f('0x45')],_0x2ad5d0['ticketId']);}})[_0xb85f('0x12')](function(_0x3508cc){logger[_0xb85f('0x13')]('['+_0x5bfb13[_0xb85f('0x14')]()+_0xb85f('0x66'),util['inspect'](_0x3508cc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6081=['calleridnum','/systemusers(','headers','substring','lastIndexOf','enduserId','destcalleridnum','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','string','picklist','type','nameField','customField','indexOf','content','ticketType','incident','assign','Subjects','Descriptions','/contacts(','phonecall','phonecalls','getString','callDirection','queue','Fields','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%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','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','inspect','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','POST','clientId','remoteUri','username','password','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','message','toLowerCase','outbound'];(function(_0x2ea405,_0xf298a3){var _0xd21ab0=function(_0x4bf7ba){while(--_0x4bf7ba){_0x2ea405['push'](_0x2ea405['shift']());}};_0xd21ab0(++_0xf298a3);}(_0x6081,0x107));var _0x1608=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6081[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var rp=require('request-promise');var util=require(_0x1608('0x0'));var intUtil=require(_0x1608('0x1'));var md5=require(_0x1608('0x2'));var Redis=require(_0x1608('0x3'));var logger=require(_0x1608('0x4'))(_0x1608('0x5'));var config=require(_0x1608('0x6'));config[_0x1608('0x7')]=_[_0x1608('0x8')](config['redis'],{'host':_0x1608('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1608('0x7')]));function getAuthToken(_0x1b7947,_0x58854a,_0x2d1ffb){var _0x5e63d5={'method':_0x1608('0xa'),'uri':_0x58854a,'form':{'client_id':_0x1b7947[_0x1608('0xb')],'resource':_0x1b7947[_0x1608('0xc')],'username':_0x1b7947[_0x1608('0xd')],'password':_0x1b7947[_0x1608('0xe')],'grant_type':_0x1608('0xe'),'client_secret':_0x1b7947['clientSecret']},'json':!![]};return rp(_0x5e63d5)[_0x1608('0xf')](function(_0x194d3a){return _0x194d3a[_0x1608('0x10')];})['catch'](function(_0x4192c1){logger[_0x1608('0x11')]('['+[_0x2d1ffb[_0x1608('0x12')]()]+_0x1608('0x13'));return _0x4192c1['message'];});}function getUser(_0x562446,_0x19be5d,_0x5b040c,_0x2b073d,_0x162599,_0x5a1915){return new BPromise(function(_0x1e6b36,_0x251911){return getAuthToken(_0x19be5d,_0x2b073d,_0x5a1915)[_0x1608('0xf')](function(_0x55ca36){var _0x11bde8={'method':_0x1608('0x14'),'uri':_0x162599+_0x1608('0x15'),'headers':{'Authorization':_0x1608('0x16')+_0x55ca36,'OData-Version':_0x1608('0x17')},'json':!![]};return rp(_0x11bde8);})[_0x1608('0xf')](function(_0xcfbe04){var _0x5dc3a0=_0xcfbe04[_0x1608('0x18')];var _0x212856=![];var _0x4e1c2b=null;if(!_[_0x1608('0x19')](_0x5b040c)){if(intUtil['validateEmail'](_0x5b040c[_0x1608('0x1a')])){_0x562446[_0x1608('0x1b')]=_0x5b040c[_0x1608('0x1a')];for(_0x4e1c2b=0x0;_0x4e1c2b<_0x5dc3a0[_0x1608('0x1c')];_0x4e1c2b++){if(_0x5dc3a0[_0x4e1c2b][_0x1608('0x1d')]===_0x5b040c[_0x1608('0x1a')]&&!_0x5dc3a0[_0x4e1c2b][_0x1608('0x1e')]){_0x212856=!![];logger[_0x1608('0x1f')]('['+[_0x5a1915[_0x1608('0x12')]()]+_0x1608('0x20')+_0x5dc3a0[_0x4e1c2b]['systemuserid']+'!');_0x562446[_0x1608('0x21')]=_0x5dc3a0[_0x4e1c2b][_0x1608('0x22')];}}}}if(!_0x212856){logger[_0x1608('0x1f')]('['+[_0x5a1915['toUpperCase']()]+_0x1608('0x23'));_0x562446[_0x1608('0x1b')]=_0x19be5d[_0x1608('0xd')];for(_0x4e1c2b=0x0;_0x4e1c2b<_0x5dc3a0[_0x1608('0x1c')];_0x4e1c2b++){if(_0x5dc3a0[_0x4e1c2b][_0x1608('0x1d')]===_0x19be5d[_0x1608('0xd')]){_0x562446['userId']=_0x5dc3a0[_0x4e1c2b][_0x1608('0x22')];}}}_0x1e6b36(_0x562446);})[_0x1608('0x24')](function(_0x1257bc){_0x251911(_0x1257bc[_0x1608('0x25')]);});});}function createEndUser(_0x3fea94,_0x322f54,_0x414df2,_0x2af565,_0x6c1a94,_0x363aef){return new BPromise(function(_0x409969,_0x52fa82){return getAuthToken(_0x322f54,_0x414df2,_0x363aef)[_0x1608('0xf')](function(_0x41d4cf){var _0x592bb8=_0x363aef[_0x1608('0x26')]()===_0x1608('0x27')?_0x6c1a94['destcalleridnum']:_0x6c1a94[_0x1608('0x28')];var _0x5aac24={'method':_0x1608('0xa'),'uri':_0x2af565+'contacts','body':{'telephone1':_0x592bb8,'fullname':_0x592bb8,'firstname':_0x592bb8,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x1608('0x29')+_0x3fea94[_0x1608('0x21')]+')'},'headers':{'Authorization':_0x1608('0x16')+_0x41d4cf,'OData-Version':_0x1608('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5aac24);})[_0x1608('0xf')](function(_0x4abf66){var _0x3a5503=_0x4abf66[_0x1608('0x2a')]['odata-entityid'];var _0xa22205=_0x3a5503[_0x1608('0x2b')](_0x3a5503[_0x1608('0x2c')]('(')+0x1,_0x3a5503[_0x1608('0x2c')](')'));_0x3fea94[_0x1608('0x2d')]=_0xa22205;_0x409969(_0x3fea94);})['catch'](function(_0x573ba0){_0x52fa82(_0x573ba0['message']);});});}function getEndUser(_0x38dcc6,_0x5b27a7,_0x229ec2,_0x17ee1a,_0x60ac76,_0x2d01df){return new BPromise(function(_0x4d24a9,_0x4dea81){var _0x1b255d=_0x2d01df[_0x1608('0x26')]()===_0x1608('0x27')?_0x60ac76[_0x1608('0x2e')]:_0x60ac76[_0x1608('0x28')];return getAuthToken(_0x5b27a7,_0x229ec2,_0x2d01df)[_0x1608('0xf')](function(_0x4b68bc){var _0x3569db={'method':'GET','uri':_0x17ee1a+_0x1608('0x2f')+_0x1b255d[_0x1608('0x30')]('+','%2b')+'\x27','headers':{'Authorization':_0x1608('0x16')+_0x4b68bc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3569db);})[_0x1608('0xf')](function(_0x12787c){var _0x7b9762=null;if(_0x12787c){var _0x5260ca=_0x12787c[_0x1608('0x18')];var _0x3b7c3c=![];for(_0x7b9762=0x0;_0x7b9762<_0x5260ca['length'];_0x7b9762++){if(_0x5260ca[_0x7b9762][_0x1608('0x31')]===_0x1b255d){_0x3b7c3c=!![];_0x38dcc6['enduserId']=_0x5260ca[_0x7b9762][_0x1608('0x32')];}}if(_0x3b7c3c){_0x4d24a9(_0x38dcc6);}else{return createEndUser(_0x38dcc6,_0x5b27a7,_0x229ec2,_0x17ee1a,_0x60ac76,_0x2d01df)[_0x1608('0xf')](function(_0x2131a5){logger['info']('['+[_0x2d01df['toUpperCase']()]+_0x1608('0x33'),_0x2131a5[_0x1608('0x2d')]);_0x4d24a9(_0x2131a5);});}}else{return createEndUser(_0x38dcc6,_0x5b27a7,_0x229ec2,_0x17ee1a,_0x60ac76,_0x2d01df)[_0x1608('0xf')](function(_0x5d78cf){logger[_0x1608('0x1f')]('['+[_0x2d01df[_0x1608('0x12')]()]+_0x1608('0x34'),_0x5d78cf[_0x1608('0x2d')]);_0x4d24a9(_0x5d78cf);});}});});}function getCustomFields(_0x2208d8,_0x2c26ec,_0x3b47dd){var _0x3f8c29={};if(_0x2208d8[_0x1608('0x1c')]>0x0){_[_0x1608('0x35')](_0x2208d8,function(_0x899095){if(_['includes']([_0x1608('0x36'),_0x1608('0x37')],_0x899095[_0x1608('0x38')])&&_0x899095[_0x1608('0x39')]&&!_0x899095[_0x1608('0x3a')]){var _0x7eee50=_0x899095['idField'][_0x1608('0x26')]();var _0x2496bd=_0x7eee50[_0x1608('0x2b')](0x0,_0x7eee50['indexOf']('_'));var _0x536705=_0x7eee50[_0x1608('0x2b')](_0x7eee50[_0x1608('0x3b')]('_')+0x1);if(_0x2496bd===_0x3b47dd){_0x3f8c29[_0x536705]=_0x899095[_0x1608('0x3c')];}}});}return _0x3f8c29;}function getTicket(_0x161fa9,_0x1012ac,_0x579b5b,_0x3ba8b9,_0x13f55f,_0x2a4317,_0x4fc434){return new BPromise(function(_0x454085,_0x2eef91){var _0x137993;return getAuthToken(_0x1012ac,_0x579b5b,_0x4fc434)['then'](function(_0x3f0b41){if(_0x2a4317[_0x1608('0x3d')]===_0x1608('0x3e')){_0x137993={'method':'POST','uri':_0x3ba8b9+'incidents','body':Object[_0x1608('0x3f')]({},{'title':intUtil['getString'](_0x2a4317[_0x1608('0x40')],_0x13f55f,'\x20'),'description':intUtil['getString'](_0x2a4317[_0x1608('0x41')],_0x13f55f,'\x0a'),'customerid_contact@odata.bind':_0x1608('0x42')+_0x161fa9[_0x1608('0x2d')]+')','ownerid@odata.bind':'/systemusers('+_0x161fa9[_0x1608('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x2a4317['Fields'],_0x13f55f,_0x2a4317[_0x1608('0x3d')])),'headers':{'Authorization':_0x1608('0x16')+_0x3f0b41,'OData-Version':_0x1608('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2a4317[_0x1608('0x3d')]===_0x1608('0x43')){_0x137993={'method':'POST','uri':_0x3ba8b9+_0x1608('0x44'),'body':Object[_0x1608('0x3f')]({},{'subject':intUtil[_0x1608('0x45')](_0x2a4317[_0x1608('0x40')],_0x13f55f,'\x20'),'phonenumber':String(_0x13f55f[_0x1608('0x28')]),'description':intUtil['getString'](_0x2a4317[_0x1608('0x41')],_0x13f55f,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1608('0x42')+_0x161fa9[_0x1608('0x2d')]+')','ownerid@odata.bind':_0x1608('0x29')+_0x161fa9[_0x1608('0x21')]+')','directioncode':_0x161fa9[_0x1608('0x46')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x1608('0x29')+_0x161fa9['userId']+')','participationtypemask':_0x161fa9[_0x1608('0x46')]===_0x1608('0x47')?0x2:0x1},{'partyid_contact@odata.bind':_0x1608('0x42')+_0x161fa9[_0x1608('0x2d')]+')','participationtypemask':_0x161fa9[_0x1608('0x46')]===_0x1608('0x47')?0x1:0x2}]},getCustomFields(_0x2a4317[_0x1608('0x48')],_0x13f55f,_0x2a4317['ticketType'])),'headers':{'Authorization':_0x1608('0x16')+_0x3f0b41,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x137993);})[_0x1608('0xf')](function(_0x3d9a0e){var _0x2b6826=_0x3d9a0e[_0x1608('0x2a')][_0x1608('0x49')];var _0x30f86c=_0x2b6826[_0x1608('0x2b')](_0x2b6826[_0x1608('0x2c')]('(')+0x1,_0x2b6826['lastIndexOf'](')'));_0x161fa9[_0x1608('0x4a')]=_0x30f86c;_0x454085(_0x161fa9);})[_0x1608('0x24')](function(_0x5a25e8){_0x2eef91(_0x5a25e8[_0x1608('0x25')]);});});}function emit(_0x3a99dc,_0x47c521,_0x4bb4b6,_0x53b108){var _0xd75bac={'uri':util[_0x1608('0x4b')](_0x1608('0x4c'),_0x3a99dc,_0x4bb4b6,_0x53b108)};io['to'](util['format'](_0x1608('0x4d'),_0x47c521))[_0x1608('0x4e')](_0x1608('0x4f'),_0xd75bac);}exports['cs']=function(_0x486dcb,_0x5cb861,_0x2d789d,_0x55b91e,_0x25e0d6,_0x16c372,_0x4d0bb7,_0xf2b709){var _0x1121d2={};_0x16c372[_0x1608('0xc')]=intUtil[_0x1608('0x50')](_0x16c372['remoteUri']);_0x16c372['serverUrl']=intUtil['stripTrailingSlash'](_0x16c372[_0x1608('0x51')]);_0x1121d2[_0x1608('0x46')]=_0xf2b709==='queue'||_0xf2b709==='unmanaged'?_0x1608('0x47'):_0x1608('0x27');var _0x2aee0f=util[_0x1608('0x4b')](_0x1608('0x52'),_0x16c372[_0x1608('0xc')]);var _0x1a9334=util[_0x1608('0x4b')](_0x1608('0x53'),_0x16c372['tenantId']);var _0xcf3fbd=util[_0x1608('0x4b')](_0x1608('0x54'),_0x16c372[_0x1608('0x51')],_0x5cb861[_0x1608('0x55')],md5(_0x5cb861['uniqueid']));if(_0x25e0d6&&_0x25e0d6[_0x1608('0x56')]){logger['info']('[QUEUE]',_0x1608('0x57'));_0x5cb861[_0x1608('0x58')]=_0xcf3fbd;}else if(_0x4d0bb7&&_0x4d0bb7[_0x1608('0x59')]&&_0x4d0bb7['recordingFormat']!==_0x1608('0x5a')){logger[_0x1608('0x1f')](_0x1608('0x5b'),_0x1608('0x57'));_0x5cb861[_0x1608('0x58')]=_0xcf3fbd;}else{_0x5cb861[_0x1608('0x58')]='';}return getUser(_0x1121d2,_0x16c372,_0x55b91e,_0x1a9334,_0x2aee0f,_0xf2b709)[_0x1608('0xf')](function(_0x403aaf){logger[_0x1608('0x1f')]('['+_0xf2b709[_0x1608('0x12')]()+']\x20The\x20User\x20ID\x20is:',_0x403aaf[_0x1608('0x21')]);logger[_0x1608('0x1f')]('['+_0xf2b709[_0x1608('0x12')]()+_0x1608('0x5c'),_0x403aaf[_0x1608('0x1b')]);return getEndUser(_0x403aaf,_0x16c372,_0x1a9334,_0x2aee0f,_0x5cb861,_0xf2b709);})[_0x1608('0xf')](function(_0x1b83ba){logger[_0x1608('0x1f')]('['+_0xf2b709['toUpperCase']()+_0x1608('0x5d'),_0x1b83ba[_0x1608('0x2d')]);logger[_0x1608('0x1f')]('['+_0xf2b709['toUpperCase']()+_0x1608('0x5e'),_0x5cb861['calleridnum']);return getTicket(_0x1b83ba,_0x16c372,_0x1a9334,_0x2aee0f,_0x5cb861,_0x2d789d,_0xf2b709);})[_0x1608('0xf')](function(_0x1e6a2c){logger[_0x1608('0x1f')](util[_0x1608('0x4b')]('['+_0xf2b709[_0x1608('0x12')]()+_0x1608('0x5f'),_0x2d789d[_0x1608('0x3d')],_0x1e6a2c[_0x1608('0x4a')]));logger['info'](util['format']('['+_0xf2b709[_0x1608('0x12')]()+_0x1608('0x60'),_0xf2b709));if(_0xf2b709!==_0x1608('0x61')){logger['info']('['+_0xf2b709[_0x1608('0x12')]()+']',_0x1608('0x62'));emit(_0x16c372[_0x1608('0xc')],_0x55b91e[_0x1608('0x63')],_0x2d789d[_0x1608('0x3d')],_0x1e6a2c[_0x1608('0x4a')]);}})[_0x1608('0x24')](function(_0x381230){logger[_0x1608('0x11')]('['+_0xf2b709[_0x1608('0x12')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x1608('0x64')](_0x381230,{'showHidden':!![],'depth':null}));});}; \ 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 f41894f..e023f9c 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 _0xf305=['forEach','string','picklist','type','nameField','toLowerCase','content','includes','customField','custom_fields','push','idField','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','calleridname','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','The\x20Ticket\x20ID\x20is:','trigger:browser:url','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','application/json','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridnum','getString','Subjects','Tags','name','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','find','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','map'];(function(_0x5a70a9,_0x18fbc9){var _0xe56623=function(_0x1e19f3){while(--_0x1e19f3){_0x5a70a9['push'](_0x5a70a9['shift']());}};_0xe56623(++_0x18fbc9);}(_0xf305,0x1e6));var _0x5f30=function(_0x888385,_0x9cdc66){_0x888385=_0x888385-0x0;var _0x22d5c2=_0xf305[_0x888385];return _0x22d5c2;};'use strict';var _=require(_0x5f30('0x0'));var rp=require(_0x5f30('0x1'));var md5=require(_0x5f30('0x2'));var util=require(_0x5f30('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x5f30('0x4'));var logger=require(_0x5f30('0x5'))(_0x5f30('0x6'));config['redis']=_[_0x5f30('0x7')](config[_0x5f30('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x5f30('0x9'),'Accept':'application/json'};function emit(_0x2c7711,_0x18201a,_0x24d2d0){io['to'](_0x2c7711)['emit'](_0x18201a,_0x24d2d0);}function getTicket(_0x39ec49,_0x5f1ef3,_0x4044d5,_0x408a12,_0x45f5c0){logger[_0x5f30('0xa')](_0x5f30('0xb'));var _0x396504=_[_0x5f30('0xc')]({'responder_id':_0x5f1ef3['id'],'requester_id':_0x4044d5['id'],'name':util['format'](_0x5f30('0xd'),_0x45f5c0['calleridname']),'phone':_0x45f5c0[_0x5f30('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x5f30('0xf')](_0x408a12[_0x5f30('0x10')],_0x45f5c0,'\x20'),'description':intUtil['getString'](_0x408a12['Descriptions'],_0x45f5c0,'
'),'tags':getTags(_0x408a12[_0x5f30('0x11')],_0x5f30('0x12'))},getCustomFields(_0x408a12['Fields'],_0x45f5c0));_0x396504['custom_fields']=_[_0x5f30('0x13')](_[_0x5f30('0x14')](_0x396504['custom_fields'],'id'),_0x5f30('0x15'));return request({'uri':util[_0x5f30('0x16')](_0x5f30('0x17'),_0x39ec49[_0x5f30('0x18')]),'method':_0x5f30('0x19'),'body':_0x396504})['then'](function(_0x5a2aa1){logger[_0x5f30('0xa')](_0x5f30('0x1a'));return _0x5a2aa1;});}function getUser(_0x28d41d,_0x19826a){if(intUtil[_0x5f30('0x1b')](_0x19826a)){return request({'uri':util[_0x5f30('0x16')](_0x5f30('0x1c'),_0x28d41d[_0x5f30('0x18')]),'qs':{'email':_0x19826a}})[_0x5f30('0x1d')](function(_0x1ae6f4){if(_0x1ae6f4[_0x5f30('0x1e')]){logger['info'](_0x5f30('0x1f'));return _[_0x5f30('0x20')](_0x1ae6f4,function(_0x1cb8a2){return _0x1cb8a2['contact'][_0x5f30('0x21')]===_0x19826a;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5f30('0x16')](_0x5f30('0x22'),_0x28d41d['remoteUri'])})[_0x5f30('0x1d')](function(_0x2a3f09){logger[_0x5f30('0xa')](_0x5f30('0x23'));return _0x2a3f09;});}});}else{logger[_0x5f30('0xa')](_0x5f30('0x24'));return request({'uri':util[_0x5f30('0x16')]('%s/api/v2/agents/me',_0x28d41d[_0x5f30('0x18')])})[_0x5f30('0x1d')](function(_0x82905){logger['info'](_0x5f30('0x23'));return _0x82905;});}}function getEndUser(_0x2b7d60,_0x1b3a93,_0x4be412){logger[_0x5f30('0xa')](_0x5f30('0x25'),_0x4be412);return request({'uri':util[_0x5f30('0x16')]('%s/api/v2/contacts',_0x2b7d60[_0x5f30('0x18')]),'qs':{'phone':_0x4be412}})['then'](function(_0x348a4b){if(_0x348a4b['length']){logger[_0x5f30('0xa')]('Enduser\x20found!');return _[_0x5f30('0x20')](_0x348a4b,{'phone':_0x4be412});}else{logger[_0x5f30('0xa')](_0x5f30('0x26'));return request({'uri':util[_0x5f30('0x16')](_0x5f30('0x27'),_0x2b7d60['remoteUri']),'method':'POST','body':{'name':_0x1b3a93,'phone':_0x4be412}})[_0x5f30('0x1d')](function(_0x482a72){logger[_0x5f30('0xa')](_0x5f30('0x28'));return _0x482a72;});}});}function getAuth(_0x31e446){return util[_0x5f30('0x16')](_0x5f30('0x29'),new Buffer(_0x31e446[_0x5f30('0x2a')]+':X')[_0x5f30('0x2b')]('base64'));}function request(_0xa27c48){logger[_0x5f30('0x2c')](_0x5f30('0x2d'),JSON[_0x5f30('0x2e')](_0xa27c48));return rp(_[_0x5f30('0x7')](_0xa27c48,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x13cc93,_0x5152db){var _0xca2dc1=[];if(_0x13cc93&&_0x13cc93[_0x5f30('0x1e')]>0x0){_0xca2dc1=_[_0x5f30('0x2f')](_0x13cc93,_0x5152db);}return _0xca2dc1;}function getCustomFields(_0x3c4426,_0x1c0c84){var _0x4b373b=[];var _0x2c8faf={'custom_fields':[]};if(_0x3c4426['length']>0x0){_[_0x5f30('0x30')](_0x3c4426,function(_0x424c2d){if(_['includes']([_0x5f30('0x31'),_0x5f30('0x32')],_0x424c2d[_0x5f30('0x33')])&&_0x424c2d['nameField']&&!_0x424c2d['customField']){_0x2c8faf[_0x424c2d[_0x5f30('0x34')][_0x5f30('0x35')]()]=_0x424c2d[_0x5f30('0x36')]['toString']();}else if(_[_0x5f30('0x37')]([_0x5f30('0x31'),_0x5f30('0x32')],_0x424c2d[_0x5f30('0x33')])&&_0x424c2d['idField']&&_0x424c2d[_0x5f30('0x38')]){_0x2c8faf[_0x5f30('0x39')][_0x5f30('0x3a')]({'id':_0x424c2d[_0x5f30('0x3b')],'value':_0x424c2d['content'][_0x5f30('0x2b')]()});}else if(_0x424c2d[_0x5f30('0x33')]===_0x5f30('0x3c')&&_0x424c2d[_0x5f30('0x3d')]&&_0x424c2d[_0x5f30('0x3b')]&&_0x424c2d[_0x5f30('0x38')]){_0x1c0c84[_0x424c2d[_0x5f30('0x3d')]]&&_0x2c8faf[_0x5f30('0x39')][_0x5f30('0x3a')]({'id':_0x424c2d[_0x5f30('0x3b')],'value':_0x1c0c84[_0x424c2d[_0x5f30('0x3d')]][_0x5f30('0x2b')]()});}else if(_0x424c2d['type']==='customVariable'&&_0x424c2d[_0x5f30('0x3e')]&&_0x424c2d['Variable'][_0x5f30('0x12')]&&_0x424c2d[_0x5f30('0x3b')]&&_0x424c2d[_0x5f30('0x38')]){_0x1c0c84[_0x424c2d[_0x5f30('0x3e')]['name'][_0x5f30('0x35')]()]&&_0x2c8faf['custom_fields'][_0x5f30('0x3a')]({'id':_0x424c2d['idField'],'value':_0x1c0c84[_0x424c2d[_0x5f30('0x3e')][_0x5f30('0x12')][_0x5f30('0x35')]()][_0x5f30('0x2b')]()});}});}return _0x2c8faf;}exports[_0x5f30('0x3f')]=function(_0x4c1fb2,_0x32bc58,_0x588685,_0x47c948,_0x4bce68,_0x5c89c6){var _0x37d50f,_0x4380c7;_0x5c89c6[_0x5f30('0x18')]=intUtil[_0x5f30('0x40')](_0x5c89c6[_0x5f30('0x18')]);_0x5c89c6[_0x5f30('0x41')]=intUtil['stripTrailingSlash'](_0x5c89c6[_0x5f30('0x41')]);if(_0x4bce68&&_0x4bce68['monitor_format']){logger[_0x5f30('0xa')](_0x5f30('0x42'),_0x5f30('0x43'));_0x32bc58[_0x5f30('0x44')]=util[_0x5f30('0x16')](_0x5f30('0x45'),_0x5c89c6[_0x5f30('0x41')],_0x32bc58['uniqueid'],md5(_0x32bc58['uniqueid']));}else{_0x32bc58[_0x5f30('0x44')]='';}headers[_0x5f30('0x46')]=getAuth(_0x5c89c6);return getUser(_0x5c89c6,_0x47c948[_0x5f30('0x21')])[_0x5f30('0x1d')](function(_0x4ee5c2){_0x37d50f=_0x4ee5c2;logger[_0x5f30('0xa')]('The\x20User\x20ID\x20is:',_0x37d50f['id']);return getEndUser(_0x5c89c6,_0x32bc58[_0x5f30('0x47')],_0x32bc58[_0x5f30('0xe')]);})[_0x5f30('0x1d')](function(_0x25ed21){_0x4380c7=_0x25ed21;logger[_0x5f30('0xa')](_0x5f30('0x48'),_0x4380c7['id']);return getTicket(_0x5c89c6,_0x37d50f,_0x4380c7,_0x588685,_0x32bc58);})['then'](function(_0x59419d){if(_0x59419d&&_0x59419d['id']){logger[_0x5f30('0xa')](_0x5f30('0x1a'));logger[_0x5f30('0xa')]('The\x20Ticket\x20ID\x20is:',_0x59419d['id']);logger[_0x5f30('0xa')](_0x5f30('0x42'),_0x5f30('0x49'));emit(util['format'](_0x5f30('0x4a'),_0x47c948[_0x5f30('0x12')]),'trigger:browser:url',{'uri':util[_0x5f30('0x16')]('%s/helpdesk/tickets/%d',_0x5c89c6[_0x5f30('0x18')],_0x59419d['id'])});}})[_0x5f30('0x4b')](function(_0xd95613){logger[_0x5f30('0x4c')]('[QUEUE]',JSON['stringify'](_0xd95613));});};exports[_0x5f30('0x4d')]=function(_0x4fd924,_0x476795,_0x378725,_0x1660a0,_0x532ffe,_0x307fc1,_0x3223c6){var _0x11896c,_0x37323f;_0x307fc1[_0x5f30('0x18')]=intUtil[_0x5f30('0x40')](_0x307fc1['remoteUri']);_0x307fc1['serverUrl']=intUtil['stripTrailingSlash'](_0x307fc1[_0x5f30('0x41')]);if(_0x3223c6&&_0x3223c6[_0x5f30('0x4e')]&&_0x3223c6[_0x5f30('0x4e')]!==_0x5f30('0x4f')){logger['info'](_0x5f30('0x50'),_0x5f30('0x43'));_0x476795[_0x5f30('0x44')]=util[_0x5f30('0x16')](_0x5f30('0x45'),_0x307fc1['serverUrl'],_0x476795[_0x5f30('0x51')],md5(_0x476795[_0x5f30('0x51')]));}headers[_0x5f30('0x46')]=getAuth(_0x307fc1);return getUser(_0x307fc1,_0x1660a0[_0x5f30('0x21')])[_0x5f30('0x1d')](function(_0x47b93c){_0x11896c=_0x47b93c;logger[_0x5f30('0xa')](_0x5f30('0x52'),_0x11896c['id']);return getEndUser(_0x307fc1,_0x476795[_0x5f30('0x53')],_0x476795['destcalleridnum']);})[_0x5f30('0x1d')](function(_0x5f5b07){_0x37323f=_0x5f5b07;logger[_0x5f30('0xa')](_0x5f30('0x48'),_0x37323f['id']);return getTicket(_0x307fc1,_0x11896c,_0x37323f,_0x378725,_0x476795);})[_0x5f30('0x1d')](function(_0x12bbc9){if(_0x12bbc9&&_0x12bbc9['id']){logger[_0x5f30('0xa')](_0x5f30('0x1a'));logger[_0x5f30('0xa')](_0x5f30('0x54'),_0x12bbc9['id']);logger[_0x5f30('0xa')](_0x5f30('0x50'),_0x5f30('0x49'));emit(util[_0x5f30('0x16')](_0x5f30('0x4a'),_0x1660a0[_0x5f30('0x12')]),_0x5f30('0x55'),{'uri':util[_0x5f30('0x16')]('%s/helpdesk/tickets/%d',_0x307fc1[_0x5f30('0x18')],_0x12bbc9['id'])});}})[_0x5f30('0x4b')](function(_0x57af33){logger[_0x5f30('0x4c')](_0x5f30('0x50'),JSON[_0x5f30('0x2e')](_0x57af33));});};exports[_0x5f30('0x56')]=function(_0x4d1d4a,_0x1534f1,_0x1a16ac,_0x10a9f1,_0x466d8c,_0x39adce){var _0x3a6971,_0x55cc0c;_0x39adce[_0x5f30('0x18')]=intUtil['stripTrailingSlash'](_0x39adce[_0x5f30('0x18')]);_0x39adce[_0x5f30('0x41')]=intUtil[_0x5f30('0x40')](_0x39adce['serverUrl']);if(_0x466d8c&&_0x466d8c['monitor_format']){logger[_0x5f30('0xa')]('['+_0x1534f1[_0x5f30('0x57')][_0x5f30('0x58')]()+']','Recording\x20is\x20enabled!');_0x1534f1[_0x5f30('0x44')]=util[_0x5f30('0x16')](_0x5f30('0x45'),_0x39adce['serverUrl'],_0x1534f1[_0x5f30('0x51')],md5(_0x1534f1[_0x5f30('0x51')]));}else{_0x1534f1[_0x5f30('0x44')]='';}headers[_0x5f30('0x46')]=getAuth(_0x39adce);return getUser(_0x39adce,'')[_0x5f30('0x1d')](function(_0xd85f86){_0x3a6971=_0xd85f86;logger[_0x5f30('0xa')]('The\x20User\x20ID\x20is:',_0x3a6971['id']);return getEndUser(_0x39adce,_0x1534f1['calleridname'],_0x1534f1['calleridnum']);})['then'](function(_0x25f895){_0x55cc0c=_0x25f895;logger['info'](_0x5f30('0x48'),_0x55cc0c['id']);return getTicket(_0x39adce,_0x3a6971,_0x55cc0c,_0x1a16ac,_0x1534f1);})[_0x5f30('0x1d')](function(_0x2a1b7f){if(_0x2a1b7f){logger[_0x5f30('0xa')](_0x5f30('0x1a'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2a1b7f['id']);}})[_0x5f30('0x4b')](function(_0x3cf0d8){logger['error']('['+_0x1534f1['lastevent'][_0x5f30('0x58')]()+']',JSON[_0x5f30('0x2e')](_0x3cf0d8));});}; \ No newline at end of file +var _0x965d=['monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','toUpperCase','The\x20Enduser\x20ID\x20is:','lastevent','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','calleridname','calleridnum','getString','Subjects','Descriptions','name','Fields','custom_fields','mapValues','keyBy','POST','then','Ticket\x20created!','validateEmail','format','remoteUri','Agent\x20found!','contact','email','Admin\x20account\x20selected.','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','toString','base64','forEach','includes','type','nameField','toLowerCase','content','string','idField','customField','push','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl'];(function(_0xeca29a,_0x3ed6e6){var _0x299a52=function(_0x3062ed){while(--_0x3062ed){_0xeca29a['push'](_0xeca29a['shift']());}};_0x299a52(++_0x3ed6e6);}(_0x965d,0x1bc));var _0xd965=function(_0x2edbe8,_0x881707){_0x2edbe8=_0x2edbe8-0x0;var _0x4face9=_0x965d[_0x2edbe8];return _0x4face9;};'use strict';var _=require('lodash');var rp=require(_0xd965('0x0'));var md5=require(_0xd965('0x1'));var util=require(_0xd965('0x2'));var Redis=require(_0xd965('0x3'));var intUtil=require('./util');var config=require(_0xd965('0x4'));var logger=require(_0xd965('0x5'))(_0xd965('0x6'));config[_0xd965('0x7')]=_[_0xd965('0x8')](config[_0xd965('0x7')],{'host':_0xd965('0x9'),'port':0x18eb});var io=require(_0xd965('0xa'))(new Redis(config[_0xd965('0x7')]));var headers={'Content-Type':_0xd965('0xb'),'Accept':_0xd965('0xb')};function emit(_0x3581d7,_0x5a7574,_0x4002f4){io['to'](_0x3581d7)[_0xd965('0xc')](_0x5a7574,_0x4002f4);}function getTicket(_0x83c2da,_0x1c0f50,_0x28e531,_0x55998c,_0x1fe43b){logger[_0xd965('0xd')](_0xd965('0xe'));var _0xada69f=_['merge']({'responder_id':_0x1c0f50['id'],'requester_id':_0x28e531['id'],'name':util['format']('Caller\x20-\x20%s',_0x1fe43b[_0xd965('0xf')]),'phone':_0x1fe43b[_0xd965('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xd965('0x11')](_0x55998c[_0xd965('0x12')],_0x1fe43b,'\x20'),'description':intUtil[_0xd965('0x11')](_0x55998c[_0xd965('0x13')],_0x1fe43b,'
'),'tags':getTags(_0x55998c['Tags'],_0xd965('0x14'))},getCustomFields(_0x55998c[_0xd965('0x15')],_0x1fe43b));_0xada69f[_0xd965('0x16')]=_[_0xd965('0x17')](_[_0xd965('0x18')](_0xada69f[_0xd965('0x16')],'id'),'value');return request({'uri':util['format']('%s/api/v2/tickets',_0x83c2da['remoteUri']),'method':_0xd965('0x19'),'body':_0xada69f})[_0xd965('0x1a')](function(_0x4200c5){logger[_0xd965('0xd')](_0xd965('0x1b'));return _0x4200c5;});}function getUser(_0x57c936,_0x1db9e3){if(intUtil[_0xd965('0x1c')](_0x1db9e3)){return request({'uri':util[_0xd965('0x1d')]('%s/api/v2/agents',_0x57c936[_0xd965('0x1e')]),'qs':{'email':_0x1db9e3}})['then'](function(_0x5240b4){if(_0x5240b4['length']){logger[_0xd965('0xd')](_0xd965('0x1f'));return _['find'](_0x5240b4,function(_0x34008c){return _0x34008c[_0xd965('0x20')][_0xd965('0x21')]===_0x1db9e3;});}else{logger[_0xd965('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xd965('0x1d')]('%s/api/v2/agents/me',_0x57c936['remoteUri'])})[_0xd965('0x1a')](function(_0x153bd1){logger[_0xd965('0xd')](_0xd965('0x22'));return _0x153bd1;});}});}else{logger[_0xd965('0xd')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xd965('0x23'),_0x57c936['remoteUri'])})[_0xd965('0x1a')](function(_0x1bfe77){logger['info']('Admin\x20account\x20selected.');return _0x1bfe77;});}}function getEndUser(_0x47c14b,_0x529a8b,_0x4aa9db){logger[_0xd965('0xd')](_0xd965('0x24'),_0x4aa9db);return request({'uri':util[_0xd965('0x1d')]('%s/api/v2/contacts',_0x47c14b[_0xd965('0x1e')]),'qs':{'phone':_0x4aa9db}})[_0xd965('0x1a')](function(_0x357630){if(_0x357630[_0xd965('0x25')]){logger[_0xd965('0xd')]('Enduser\x20found!');return _['find'](_0x357630,{'phone':_0x4aa9db});}else{logger[_0xd965('0xd')](_0xd965('0x26'));return request({'uri':util['format'](_0xd965('0x27'),_0x47c14b[_0xd965('0x1e')]),'method':_0xd965('0x19'),'body':{'name':_0x529a8b,'phone':_0x4aa9db}})[_0xd965('0x1a')](function(_0x475cbd){logger['info'](_0xd965('0x28'));return _0x475cbd;});}});}function getAuth(_0x46f41d){return util[_0xd965('0x1d')](_0xd965('0x29'),new Buffer(_0x46f41d['apiKey']+':X')[_0xd965('0x2a')](_0xd965('0x2b')));}function request(_0x243db8){logger['debug']('[HTTP]',JSON['stringify'](_0x243db8));return rp(_[_0xd965('0x8')](_0x243db8,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4416d5,_0x2f80b9){var _0x14261a=[];if(_0x4416d5&&_0x4416d5[_0xd965('0x25')]>0x0){_0x14261a=_['map'](_0x4416d5,_0x2f80b9);}return _0x14261a;}function getCustomFields(_0x53701b,_0x1eb304){var _0x3580f4=[];var _0x2d826b={'custom_fields':[]};if(_0x53701b[_0xd965('0x25')]>0x0){_[_0xd965('0x2c')](_0x53701b,function(_0x3ac76a){if(_[_0xd965('0x2d')](['string','picklist'],_0x3ac76a[_0xd965('0x2e')])&&_0x3ac76a[_0xd965('0x2f')]&&!_0x3ac76a['customField']){_0x2d826b[_0x3ac76a[_0xd965('0x2f')][_0xd965('0x30')]()]=_0x3ac76a[_0xd965('0x31')][_0xd965('0x2a')]();}else if(_['includes']([_0xd965('0x32'),'picklist'],_0x3ac76a[_0xd965('0x2e')])&&_0x3ac76a[_0xd965('0x33')]&&_0x3ac76a[_0xd965('0x34')]){_0x2d826b[_0xd965('0x16')][_0xd965('0x35')]({'id':_0x3ac76a[_0xd965('0x33')],'value':_0x3ac76a[_0xd965('0x31')][_0xd965('0x2a')]()});}else if(_0x3ac76a[_0xd965('0x2e')]===_0xd965('0x36')&&_0x3ac76a[_0xd965('0x37')]&&_0x3ac76a['idField']&&_0x3ac76a[_0xd965('0x34')]){_0x1eb304[_0x3ac76a[_0xd965('0x37')]]&&_0x2d826b[_0xd965('0x16')]['push']({'id':_0x3ac76a[_0xd965('0x33')],'value':_0x1eb304[_0x3ac76a[_0xd965('0x37')]]['toString']()});}else if(_0x3ac76a[_0xd965('0x2e')]===_0xd965('0x38')&&_0x3ac76a[_0xd965('0x39')]&&_0x3ac76a['Variable']['name']&&_0x3ac76a[_0xd965('0x33')]&&_0x3ac76a[_0xd965('0x34')]){_0x1eb304[_0x3ac76a['Variable'][_0xd965('0x14')][_0xd965('0x30')]()]&&_0x2d826b['custom_fields'][_0xd965('0x35')]({'id':_0x3ac76a[_0xd965('0x33')],'value':_0x1eb304[_0x3ac76a[_0xd965('0x39')][_0xd965('0x14')][_0xd965('0x30')]()][_0xd965('0x2a')]()});}});}return _0x2d826b;}exports['queue']=function(_0x180e13,_0x54d79a,_0x53d289,_0x512c1a,_0x3b5109,_0x19ab87){var _0x7d0dcf,_0x25d335;_0x19ab87['remoteUri']=intUtil[_0xd965('0x3a')](_0x19ab87[_0xd965('0x1e')]);_0x19ab87[_0xd965('0x3b')]=intUtil[_0xd965('0x3a')](_0x19ab87[_0xd965('0x3b')]);if(_0x3b5109&&_0x3b5109[_0xd965('0x3c')]){logger[_0xd965('0xd')](_0xd965('0x3d'),_0xd965('0x3e'));_0x54d79a[_0xd965('0x3f')]=util[_0xd965('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x19ab87['serverUrl'],_0x54d79a[_0xd965('0x40')],md5(_0x54d79a[_0xd965('0x40')]));}else{_0x54d79a['recordingURL']='';}headers['Authorization']=getAuth(_0x19ab87);return getUser(_0x19ab87,_0x512c1a['email'])[_0xd965('0x1a')](function(_0x422c25){_0x7d0dcf=_0x422c25;logger[_0xd965('0xd')](_0xd965('0x41'),_0x7d0dcf['id']);return getEndUser(_0x19ab87,_0x54d79a['calleridname'],_0x54d79a[_0xd965('0x10')]);})['then'](function(_0x41d747){_0x25d335=_0x41d747;logger[_0xd965('0xd')]('The\x20Enduser\x20ID\x20is:',_0x25d335['id']);return getTicket(_0x19ab87,_0x7d0dcf,_0x25d335,_0x53d289,_0x54d79a);})['then'](function(_0x2f0fc3){if(_0x2f0fc3&&_0x2f0fc3['id']){logger[_0xd965('0xd')](_0xd965('0x1b'));logger['info'](_0xd965('0x42'),_0x2f0fc3['id']);logger[_0xd965('0xd')](_0xd965('0x3d'),_0xd965('0x43'));emit(util[_0xd965('0x1d')](_0xd965('0x44'),_0x512c1a[_0xd965('0x14')]),_0xd965('0x45'),{'uri':util['format'](_0xd965('0x46'),_0x19ab87['remoteUri'],_0x2f0fc3['id'])});}})[_0xd965('0x47')](function(_0x484d21){logger[_0xd965('0x48')](_0xd965('0x3d'),JSON[_0xd965('0x49')](_0x484d21));});};exports[_0xd965('0x4a')]=function(_0x82923c,_0x170362,_0x1b04c1,_0x49beba,_0x4a02a8,_0x52b48c,_0x1499c7){var _0x392b23,_0x363147;_0x52b48c[_0xd965('0x1e')]=intUtil[_0xd965('0x3a')](_0x52b48c[_0xd965('0x1e')]);_0x52b48c['serverUrl']=intUtil[_0xd965('0x3a')](_0x52b48c[_0xd965('0x3b')]);if(_0x1499c7&&_0x1499c7[_0xd965('0x4b')]&&_0x1499c7['recordingFormat']!==_0xd965('0x4c')){logger[_0xd965('0xd')](_0xd965('0x4d'),_0xd965('0x3e'));_0x170362[_0xd965('0x3f')]=util[_0xd965('0x1d')](_0xd965('0x4e'),_0x52b48c[_0xd965('0x3b')],_0x170362['uniqueid'],md5(_0x170362[_0xd965('0x40')]));}headers[_0xd965('0x4f')]=getAuth(_0x52b48c);return getUser(_0x52b48c,_0x49beba[_0xd965('0x21')])['then'](function(_0x3569e5){_0x392b23=_0x3569e5;logger[_0xd965('0xd')](_0xd965('0x41'),_0x392b23['id']);return getEndUser(_0x52b48c,_0x170362[_0xd965('0x50')],_0x170362['destcalleridnum']);})[_0xd965('0x1a')](function(_0x1d158d){_0x363147=_0x1d158d;logger[_0xd965('0xd')]('The\x20Enduser\x20ID\x20is:',_0x363147['id']);return getTicket(_0x52b48c,_0x392b23,_0x363147,_0x1b04c1,_0x170362);})[_0xd965('0x1a')](function(_0x51d984){if(_0x51d984&&_0x51d984['id']){logger[_0xd965('0xd')]('Ticket\x20created!');logger['info'](_0xd965('0x42'),_0x51d984['id']);logger['info']('[OUTBOUND]',_0xd965('0x43'));emit(util[_0xd965('0x1d')](_0xd965('0x44'),_0x49beba['name']),'trigger:browser:url',{'uri':util[_0xd965('0x1d')](_0xd965('0x46'),_0x52b48c[_0xd965('0x1e')],_0x51d984['id'])});}})['catch'](function(_0x2b0b69){logger[_0xd965('0x48')](_0xd965('0x4d'),JSON[_0xd965('0x49')](_0x2b0b69));});};exports['unmanaged']=function(_0x37d9d3,_0x29716d,_0x43937f,_0x762198,_0x2b0b44,_0x1e2966){var _0x443233,_0x1ba991;_0x1e2966['remoteUri']=intUtil['stripTrailingSlash'](_0x1e2966[_0xd965('0x1e')]);_0x1e2966['serverUrl']=intUtil['stripTrailingSlash'](_0x1e2966[_0xd965('0x3b')]);if(_0x2b0b44&&_0x2b0b44['monitor_format']){logger[_0xd965('0xd')]('['+_0x29716d['lastevent'][_0xd965('0x51')]()+']',_0xd965('0x3e'));_0x29716d[_0xd965('0x3f')]=util[_0xd965('0x1d')](_0xd965('0x4e'),_0x1e2966[_0xd965('0x3b')],_0x29716d[_0xd965('0x40')],md5(_0x29716d['uniqueid']));}else{_0x29716d['recordingURL']='';}headers[_0xd965('0x4f')]=getAuth(_0x1e2966);return getUser(_0x1e2966,'')[_0xd965('0x1a')](function(_0x5aebc2){_0x443233=_0x5aebc2;logger[_0xd965('0xd')](_0xd965('0x41'),_0x443233['id']);return getEndUser(_0x1e2966,_0x29716d[_0xd965('0xf')],_0x29716d[_0xd965('0x10')]);})[_0xd965('0x1a')](function(_0x251619){_0x1ba991=_0x251619;logger[_0xd965('0xd')](_0xd965('0x52'),_0x1ba991['id']);return getTicket(_0x1e2966,_0x443233,_0x1ba991,_0x43937f,_0x29716d);})['then'](function(_0x42c533){if(_0x42c533){logger['info'](_0xd965('0x1b'));logger[_0xd965('0xd')](_0xd965('0x42'),_0x42c533['id']);}})[_0xd965('0x47')](function(_0x572b98){logger[_0xd965('0x48')]('['+_0x29716d[_0xd965('0x53')][_0xd965('0x51')]()+']',JSON[_0xd965('0x49')](_0x572b98));});}; \ 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 376b564..fdd89a9 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 _0xdedd=['userEmail','userId','User\x20found:','Admin\x20selected','find','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','toLowerCase','outbound','destcalleridnum','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','md5','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email'];(function(_0x1d188e,_0x148a81){var _0xc79d38=function(_0x94b78f){while(--_0x94b78f){_0x1d188e['push'](_0x1d188e['shift']());}};_0xc79d38(++_0x148a81);}(_0xdedd,0x1c8));var _0xdded=function(_0x3e52da,_0x5245f9){_0x3e52da=_0x3e52da-0x0;var _0x22ee7d=_0xdedd[_0x3e52da];return _0x22ee7d;};'use strict';var _=require(_0xdded('0x0'));var rp=require('request-promise');var md5=require(_0xdded('0x1'));var util=require('util');var moment=require(_0xdded('0x2'));var Promise=require(_0xdded('0x3'));var Redis=require(_0xdded('0x4'));var intUtil=require(_0xdded('0x5'));var config=require(_0xdded('0x6'));var logger=require(_0xdded('0x7'))(_0xdded('0x8'));config['redis']=_['defaults'](config[_0xdded('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xdded('0xa'))(new Redis(config[_0xdded('0x9')]));function getAdminId(_0x3929b3,_0x120bcc,_0xcb371,_0x24f8e2){return new Promise(function(_0x3345b3,_0x29b946){var _0x39f450=![];var _0x44c9e6={'method':_0xdded('0xb'),'uri':_0x24f8e2+_0xdded('0xc'),'json':!![]};_0x44c9e6[_0xdded('0xd')]=_0xcb371;logger[_0xdded('0xe')](_0xdded('0xf'));return rp(_0x44c9e6)[_0xdded('0x10')](function(_0x50ef65){if(_0x50ef65){var _0x525e6f=_0x50ef65[_0xdded('0x11')];var _0x470771=null;for(_0x470771=0x0;_0x470771<_0x525e6f['length'];_0x470771++){if(_0x525e6f[_0x470771][_0xdded('0x12')]===_0x3929b3[_0xdded('0x13')]){_0x3929b3[_0xdded('0x14')]=_0x525e6f[_0x470771]['id'];_0x39f450=!![];}}if(_0x39f450){logger[_0xdded('0xe')](_0xdded('0x15'),_0x3929b3['adminId']);_0x3345b3(_0x3929b3);}else{_0x29b946({'statusCode':0x194,'message':_0xdded('0x16')});}}else{_0x29b946({'statusCode':0x194,'message':_0xdded('0x16')});}})[_0xdded('0x17')](function(_0x310a3c){logger[_0xdded('0x18')]('['+[_0x120bcc[_0xdded('0x19')]()]+']',_0x310a3c[_0xdded('0x1a')]);_0x29b946(_0x310a3c);});});}function getUser(_0x485462,_0x4d7d99,_0xd54e82){return function(_0x556488){return new Promise(function(_0x2d99e0,_0x985363){var _0x42fac1={'method':_0xdded('0xb'),'uri':_0xd54e82+'/api/selector/owners','json':!![]};_0x42fac1[_0xdded('0xd')]=_0x4d7d99;logger['info'](_0xdded('0x1b'));return rp(_0x42fac1)[_0xdded('0x10')](function(_0x26ff03){if(_0x26ff03){var _0x537b9e=_0x26ff03[_0xdded('0x11')];var _0x53d9bf=![];var _0x80dc06=null;if(_0x556488[_0xdded('0x1c')]!==null){logger[_0xdded('0xe')](_0xdded('0x1d'),_0x556488[_0xdded('0x1c')]);_0x556488[_0xdded('0x1e')]=_0x556488[_0xdded('0x1c')];for(_0x80dc06=0x0;_0x80dc06<_0x537b9e['length'];_0x80dc06++){if(_0x537b9e[_0x80dc06][_0xdded('0x12')]===_0x556488[_0xdded('0x1c')]){_0x53d9bf=!![];_0x556488[_0xdded('0x1f')]=_0x537b9e[_0x80dc06]['id'];logger[_0xdded('0xe')](_0xdded('0x20'),_0x556488[_0xdded('0x1f')]);}}}if(!_0x53d9bf){logger['info'](_0xdded('0x21'));_0x556488[_0xdded('0x1e')]=_0x556488['adminEmail'];_0x556488[_0xdded('0x1f')]=_0x556488[_0xdded('0x14')];_0x53d9bf=!![];}if(_0x53d9bf){_0x2d99e0(_0x556488);}else{_0x985363({'statusCode':0x194,'message':_0xdded('0x16')});}}else{_0x985363({'statusCode':0x194,'message':_0xdded('0x16')});}})[_0xdded('0x17')](function(_0x5640ad){logger['error']('['+[_0x485462['toUpperCase']()]+']',_0x5640ad[_0xdded('0x1a')]);_0x985363(_0x5640ad);});});};}function searchContact(_0x20363c,_0x460e92,_0x30b476,_0x2dec91){return new Promise(function(_0x42f422,_0x3669ec){var _0xa14879={'method':_0xdded('0xb'),'headers':_0x460e92,'uri':_0x20363c+'/api/lookup?q='+_0x2dec91+'&f='+_0x30b476+'&entities=contact','json':!![]};rp(_0xa14879)[_0xdded('0x10')](function(_0x250c1b){var _0x563d28=_[_0xdded('0x22')](_0x250c1b['contacts']['contacts'],[_0x30b476,_0x2dec91]);_0x42f422(_0x563d28);})[_0xdded('0x17')](function(_0x15cf3c){_0x3669ec(_0x15cf3c);});});}function getEndUser(_0x2950df,_0x4eb80e,_0x136894){return function(_0x5de50b){return new Promise(function(_0x51e26a,_0x56b3cd){logger['info'](util[_0xdded('0x23')]('Searching\x20contact\x20with\x20phone\x20%s',_0x5de50b[_0xdded('0x24')]));searchContact(_0x136894,_0x4eb80e,_0xdded('0x25'),_0x5de50b[_0xdded('0x24')])[_0xdded('0x10')](function(_0x4e5543){if(_0x4e5543){_0x5de50b[_0xdded('0x26')]=_0x4e5543['id'];logger[_0xdded('0xe')](_0xdded('0x27'),_0x5de50b[_0xdded('0x26')]);return _0x51e26a(_0x5de50b);}searchContact(_0x136894,_0x4eb80e,_0xdded('0x28'),_0x5de50b[_0xdded('0x24')])[_0xdded('0x10')](function(_0x230e59){if(_0x230e59){_0x5de50b['endUserId']=_0x230e59['id'];logger[_0xdded('0xe')](_0xdded('0x29'),_0x5de50b[_0xdded('0x26')]);return _0x51e26a(_0x5de50b);}createEndUser(_0x5de50b,_0x2950df,_0x4eb80e,_0x136894)['then'](function(_0x256b0f){logger[_0xdded('0xe')](_0xdded('0x2a'),_0x256b0f[_0xdded('0x26')]);return _0x51e26a(_0x256b0f);});});})[_0xdded('0x17')](function(_0x107761){_0x56b3cd(_0x107761);});});};}function createEndUser(_0x17d5a2,_0x120e4a,_0x3d8c5e,_0x3b17a4){return new Promise(function(_0x1f9717,_0x322a38){var _0x1718b5=moment();var _0x4ecbee={'method':_0xdded('0x2b'),'uri':_0x3b17a4+'/api/contacts','body':{'contact':{'last_name':_0x17d5a2[_0xdded('0x24')],'work_number':_0x17d5a2[_0xdded('0x24')],'mobile_number':_0x17d5a2[_0xdded('0x24')],'owner_id':_0x17d5a2[_0xdded('0x1f')],'created_at':_0x1718b5[_0xdded('0x23')](_0xdded('0x2c'))}},'json':!![]};_0x4ecbee['headers']=_0x3d8c5e;logger['info'](_0xdded('0x2d'));return rp(_0x4ecbee)[_0xdded('0x10')](function(_0x58361b){_0x17d5a2['endUserId']=_0x58361b[_0xdded('0x2e')]['id'];_0x1f9717(_0x17d5a2);})['catch'](function(_0x5ecd3d){logger[_0xdded('0x18')]('['+[_0x120e4a[_0xdded('0x19')]()]+']',_0x5ecd3d['message']);_0x322a38(_0x5ecd3d[_0xdded('0x1a')]);});});}function getTicket(_0x4a2146,_0x5ef69e,_0x3bb4c5,_0x3bffc5,_0x319281){return function(_0x391af4){logger[_0xdded('0xe')]('Creating\x20new\x20task');return new Promise(function(_0x4aabaa,_0x2a990f){var _0x5aa95f=moment();var _0x1f962b={'method':_0xdded('0x2b'),'uri':_0x3bb4c5+_0xdded('0x2f'),'body':{'title':intUtil[_0xdded('0x30')](_0x3bffc5[_0xdded('0x31')],_0x319281,'\x20'),'description':intUtil['getString'](_0x3bffc5[_0xdded('0x32')],_0x319281,'\x0a'),'owner_id':_0x391af4[_0xdded('0x1f')],'creater_id':_0x391af4[_0xdded('0x14')],'targetable_id':_0x391af4[_0xdded('0x26')],'targetable_type':_0xdded('0x33'),'created_at':_0x5aa95f[_0xdded('0x23')](_0xdded('0x2c')),'due_date':_0x5aa95f[_0xdded('0x34')](0x1e,'m')[_0xdded('0x23')](_0xdded('0x2c'))},'json':!![]};_0x1f962b[_0xdded('0xd')]=_0x5ef69e;return rp(_0x1f962b)[_0xdded('0x10')](function(_0x442660){_0x391af4[_0xdded('0x35')]=_0x442660[_0xdded('0x36')]['id'];logger[_0xdded('0xe')](_0xdded('0x37'),_0x391af4[_0xdded('0x35')]);_0x4aabaa(_0x391af4);})[_0xdded('0x17')](function(_0x1c1b8e){logger[_0xdded('0x18')]('['+[_0x4a2146[_0xdded('0x19')]()]+']',_0x1c1b8e[_0xdded('0x1a')]);_0x2a990f(_0x1c1b8e[_0xdded('0x1a')]);});});};}function emit(_0x2be673,_0x344a50,_0x54efa7){var _0x688326={'uri':_0x2be673+_0xdded('0x38')+_0x54efa7};io['to'](util['format']('user:%s',_0x344a50))['emit']('trigger:browser:url',_0x688326);}exports['cs']=function(_0x2d3d0e,_0x5a7198,_0x36ac71,_0x40fbf6,_0x583006,_0x51886b,_0x166dcd,_0x2763e7){var _0x5e5c83={};var _0x1ae4c1={'Authorization':_0xdded('0x39')+_0x51886b[_0xdded('0x3a')]};_0x51886b[_0xdded('0x3b')]=intUtil['stripTrailingSlash'](_0x51886b[_0xdded('0x3b')]);_0x51886b[_0xdded('0x3c')]=intUtil[_0xdded('0x3d')](_0x51886b[_0xdded('0x3c')]);var _0x24a4b7=_0x51886b[_0xdded('0x3b')];_0x5e5c83['adminEmail']=_0x51886b['username'];_0x5e5c83[_0xdded('0x24')]=_0x2763e7[_0xdded('0x3e')]()===_0xdded('0x3f')?_0x5a7198[_0xdded('0x40')]:_0x5a7198[_0xdded('0x41')];_0x5e5c83['callDirection']=_0x2763e7===_0xdded('0x42')||_0x2763e7==='unmanaged'?'queue':_0xdded('0x3f');if(_0x40fbf6){_0x5e5c83[_0xdded('0x1c')]=_0x40fbf6[_0xdded('0x12')];}var _0x44e4b4=util['format'](_0xdded('0x43'),_0x51886b[_0xdded('0x3c')],_0x5a7198[_0xdded('0x44')],md5(_0x5a7198[_0xdded('0x44')]));if(_0x583006&&_0x583006[_0xdded('0x45')]){logger[_0xdded('0xe')](_0xdded('0x46'),_0xdded('0x47'));_0x5a7198['recordingURL']=_0x44e4b4;}else if(_0x166dcd&&_0x166dcd[_0xdded('0x48')]&&_0x166dcd[_0xdded('0x48')]!==_0xdded('0x49')){logger[_0xdded('0xe')](_0xdded('0x4a'),_0xdded('0x47'));_0x5a7198[_0xdded('0x4b')]=_0x44e4b4;}else{_0x5a7198[_0xdded('0x4b')]='';}return getAdminId(_0x5e5c83,_0x2763e7,_0x1ae4c1,_0x24a4b7)[_0xdded('0x10')](getUser(_0x2763e7,_0x1ae4c1,_0x24a4b7))[_0xdded('0x10')](getEndUser(_0x2763e7,_0x1ae4c1,_0x24a4b7))[_0xdded('0x10')](getTicket(_0x2763e7,_0x1ae4c1,_0x24a4b7,_0x36ac71,_0x5a7198))['then'](function(_0x660550){logger[_0xdded('0xe')](util['format'](_0xdded('0x4c'),_0x660550[_0xdded('0x35')]));if(_0x2763e7!==_0xdded('0x4d')){logger[_0xdded('0xe')]('['+[_0x2763e7[_0xdded('0x19')]()]+']',_0xdded('0x4e'));emit(_0x24a4b7,_0x40fbf6[_0xdded('0x4f')],_0x660550[_0xdded('0x26')]);}})[_0xdded('0x17')](function(_0x218056){logger['error']('['+[_0x2763e7[_0xdded('0x19')]()]+_0xdded('0x50'),util['inspect'](_0x218056,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x25a3=['headers','info','Getting\x20admin\x20information','then','users','email','adminEmail','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','userId','User\x20found:','Admin\x20selected','adminId','toUpperCase','message','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20created:','POST','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','add','Task\x20created:','ticketId','/contacts/','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','lodash','request-promise','md5','util','moment','ioredis','./util','../../../../config/environment','freshsales','redis','defaults','socket.io-emitter','/api/selector/owners'];(function(_0x17dee8,_0x478727){var _0x4c410b=function(_0x228c9d){while(--_0x228c9d){_0x17dee8['push'](_0x17dee8['shift']());}};_0x4c410b(++_0x478727);}(_0x25a3,0x1cd));var _0x325a=function(_0x38f44f,_0x439137){_0x38f44f=_0x38f44f-0x0;var _0x397bc0=_0x25a3[_0x38f44f];return _0x397bc0;};'use strict';var _=require(_0x325a('0x0'));var rp=require(_0x325a('0x1'));var md5=require(_0x325a('0x2'));var util=require(_0x325a('0x3'));var moment=require(_0x325a('0x4'));var Promise=require('bluebird');var Redis=require(_0x325a('0x5'));var intUtil=require(_0x325a('0x6'));var config=require(_0x325a('0x7'));var logger=require('../../../../config/logger')(_0x325a('0x8'));config[_0x325a('0x9')]=_[_0x325a('0xa')](config[_0x325a('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x325a('0xb'))(new Redis(config['redis']));function getAdminId(_0x53c566,_0x55a366,_0xe2c0c6,_0x110943){return new Promise(function(_0x178a87,_0x1368b7){var _0x24bd04=![];var _0x29093b={'method':'GET','uri':_0x110943+_0x325a('0xc'),'json':!![]};_0x29093b[_0x325a('0xd')]=_0xe2c0c6;logger[_0x325a('0xe')](_0x325a('0xf'));return rp(_0x29093b)[_0x325a('0x10')](function(_0x16ac06){if(_0x16ac06){var _0x485a2e=_0x16ac06[_0x325a('0x11')];var _0x240cae=null;for(_0x240cae=0x0;_0x240cae<_0x485a2e['length'];_0x240cae++){if(_0x485a2e[_0x240cae][_0x325a('0x12')]===_0x53c566[_0x325a('0x13')]){_0x53c566['adminId']=_0x485a2e[_0x240cae]['id'];_0x24bd04=!![];}}if(_0x24bd04){logger['info'](_0x325a('0x14'),_0x53c566['adminId']);_0x178a87(_0x53c566);}else{_0x1368b7({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x1368b7({'statusCode':0x194,'message':_0x325a('0x15')});}})[_0x325a('0x16')](function(_0x101ddb){logger[_0x325a('0x17')]('['+[_0x55a366['toUpperCase']()]+']',_0x101ddb['message']);_0x1368b7(_0x101ddb);});});}function getUser(_0x41a082,_0x4d6557,_0x305e9f){return function(_0x2e1e2e){return new Promise(function(_0x32af62,_0x5ea902){var _0x25445b={'method':'GET','uri':_0x305e9f+_0x325a('0xc'),'json':!![]};_0x25445b[_0x325a('0xd')]=_0x4d6557;logger[_0x325a('0xe')]('Getting\x20user\x20list');return rp(_0x25445b)[_0x325a('0x10')](function(_0x3d7bf9){if(_0x3d7bf9){var _0x5abf56=_0x3d7bf9[_0x325a('0x11')];var _0x38b0e7=![];var _0x57bb0b=null;if(_0x2e1e2e[_0x325a('0x18')]!==null){logger[_0x325a('0xe')](_0x325a('0x19'),_0x2e1e2e[_0x325a('0x18')]);_0x2e1e2e[_0x325a('0x1a')]=_0x2e1e2e['agentEmail'];for(_0x57bb0b=0x0;_0x57bb0b<_0x5abf56[_0x325a('0x1b')];_0x57bb0b++){if(_0x5abf56[_0x57bb0b]['email']===_0x2e1e2e[_0x325a('0x18')]){_0x38b0e7=!![];_0x2e1e2e[_0x325a('0x1c')]=_0x5abf56[_0x57bb0b]['id'];logger[_0x325a('0xe')](_0x325a('0x1d'),_0x2e1e2e['userId']);}}}if(!_0x38b0e7){logger['info'](_0x325a('0x1e'));_0x2e1e2e[_0x325a('0x1a')]=_0x2e1e2e[_0x325a('0x13')];_0x2e1e2e[_0x325a('0x1c')]=_0x2e1e2e[_0x325a('0x1f')];_0x38b0e7=!![];}if(_0x38b0e7){_0x32af62(_0x2e1e2e);}else{_0x5ea902({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x5ea902({'statusCode':0x194,'message':_0x325a('0x15')});}})['catch'](function(_0x55efd0){logger[_0x325a('0x17')]('['+[_0x41a082[_0x325a('0x20')]()]+']',_0x55efd0[_0x325a('0x21')]);_0x5ea902(_0x55efd0);});});};}function searchContact(_0x526781,_0x4b3475,_0x25f83f,_0x1bb3ea){return new Promise(function(_0x15808c,_0x27142b){var _0x577196={'method':'GET','headers':_0x4b3475,'uri':_0x526781+'/api/lookup?q='+_0x1bb3ea+'&f='+_0x25f83f+_0x325a('0x22'),'json':!![]};rp(_0x577196)[_0x325a('0x10')](function(_0x2a3195){var _0x14e53b=_[_0x325a('0x23')](_0x2a3195['contacts'][_0x325a('0x24')],[_0x25f83f,_0x1bb3ea]);_0x15808c(_0x14e53b);})[_0x325a('0x16')](function(_0xa15ab4){_0x27142b(_0xa15ab4);});});}function getEndUser(_0x6255cd,_0x1b5f3b,_0x5a94ef){return function(_0x1aaaee){return new Promise(function(_0x4e64a8,_0x5d02e4){logger['info'](util['format'](_0x325a('0x25'),_0x1aaaee[_0x325a('0x26')]));searchContact(_0x5a94ef,_0x1b5f3b,_0x325a('0x27'),_0x1aaaee[_0x325a('0x26')])['then'](function(_0x1a113b){if(_0x1a113b){_0x1aaaee[_0x325a('0x28')]=_0x1a113b['id'];logger[_0x325a('0xe')](_0x325a('0x29'),_0x1aaaee['endUserId']);return _0x4e64a8(_0x1aaaee);}searchContact(_0x5a94ef,_0x1b5f3b,'work_number',_0x1aaaee[_0x325a('0x26')])[_0x325a('0x10')](function(_0x4280b7){if(_0x4280b7){_0x1aaaee[_0x325a('0x28')]=_0x4280b7['id'];logger[_0x325a('0xe')]('Contact\x20found\x20work_number:',_0x1aaaee['endUserId']);return _0x4e64a8(_0x1aaaee);}createEndUser(_0x1aaaee,_0x6255cd,_0x1b5f3b,_0x5a94ef)[_0x325a('0x10')](function(_0x1934f3){logger[_0x325a('0xe')](_0x325a('0x2a'),_0x1934f3[_0x325a('0x28')]);return _0x4e64a8(_0x1934f3);});});})[_0x325a('0x16')](function(_0x1edd41){_0x5d02e4(_0x1edd41);});});};}function createEndUser(_0x30a656,_0x525ffb,_0x2ee19d,_0x1488ca){return new Promise(function(_0x46d51b,_0x1a296c){var _0x392681=moment();var _0x4ed566={'method':_0x325a('0x2b'),'uri':_0x1488ca+'/api/contacts','body':{'contact':{'last_name':_0x30a656['contactNumber'],'work_number':_0x30a656[_0x325a('0x26')],'mobile_number':_0x30a656[_0x325a('0x26')],'owner_id':_0x30a656[_0x325a('0x1c')],'created_at':_0x392681[_0x325a('0x2c')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x4ed566[_0x325a('0xd')]=_0x2ee19d;logger[_0x325a('0xe')](_0x325a('0x2d'));return rp(_0x4ed566)['then'](function(_0x38f85d){_0x30a656[_0x325a('0x28')]=_0x38f85d[_0x325a('0x2e')]['id'];_0x46d51b(_0x30a656);})[_0x325a('0x16')](function(_0xa520b9){logger['error']('['+[_0x525ffb[_0x325a('0x20')]()]+']',_0xa520b9[_0x325a('0x21')]);_0x1a296c(_0xa520b9[_0x325a('0x21')]);});});}function getTicket(_0x1591cc,_0x388e7e,_0x4301da,_0x3e117b,_0xa5a1ef){return function(_0x1f4c8a){logger[_0x325a('0xe')](_0x325a('0x2f'));return new Promise(function(_0x3d2004,_0x2f8092){var _0x1cb966=moment();var _0x600890={'method':'POST','uri':_0x4301da+_0x325a('0x30'),'body':{'title':intUtil['getString'](_0x3e117b[_0x325a('0x31')],_0xa5a1ef,'\x20'),'description':intUtil[_0x325a('0x32')](_0x3e117b[_0x325a('0x33')],_0xa5a1ef,'\x0a'),'owner_id':_0x1f4c8a[_0x325a('0x1c')],'creater_id':_0x1f4c8a[_0x325a('0x1f')],'targetable_id':_0x1f4c8a[_0x325a('0x28')],'targetable_type':'Contact','created_at':_0x1cb966[_0x325a('0x2c')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x1cb966[_0x325a('0x34')](0x1e,'m')[_0x325a('0x2c')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x600890[_0x325a('0xd')]=_0x388e7e;return rp(_0x600890)[_0x325a('0x10')](function(_0x1c9004){_0x1f4c8a['ticketId']=_0x1c9004['task']['id'];logger[_0x325a('0xe')](_0x325a('0x35'),_0x1f4c8a[_0x325a('0x36')]);_0x3d2004(_0x1f4c8a);})[_0x325a('0x16')](function(_0x24c14f){logger['error']('['+[_0x1591cc[_0x325a('0x20')]()]+']',_0x24c14f[_0x325a('0x21')]);_0x2f8092(_0x24c14f['message']);});});};}function emit(_0x1172c6,_0x80f54e,_0x23506e){var _0x170cce={'uri':_0x1172c6+_0x325a('0x37')+_0x23506e};io['to'](util[_0x325a('0x2c')]('user:%s',_0x80f54e))[_0x325a('0x38')](_0x325a('0x39'),_0x170cce);}exports['cs']=function(_0x1037f0,_0x406dec,_0x3e2df6,_0x4d7bde,_0x32f2b9,_0x2f0f1b,_0x1e3eea,_0x3efffe){var _0x5129ba={};var _0x126ffc={'Authorization':'Token\x20token='+_0x2f0f1b[_0x325a('0x3a')]};_0x2f0f1b[_0x325a('0x3b')]=intUtil[_0x325a('0x3c')](_0x2f0f1b['remoteUri']);_0x2f0f1b[_0x325a('0x3d')]=intUtil[_0x325a('0x3c')](_0x2f0f1b[_0x325a('0x3d')]);var _0x6a0a27=_0x2f0f1b[_0x325a('0x3b')];_0x5129ba[_0x325a('0x13')]=_0x2f0f1b[_0x325a('0x3e')];_0x5129ba[_0x325a('0x26')]=_0x3efffe[_0x325a('0x3f')]()==='outbound'?_0x406dec[_0x325a('0x40')]:_0x406dec[_0x325a('0x41')];_0x5129ba[_0x325a('0x42')]=_0x3efffe===_0x325a('0x43')||_0x3efffe===_0x325a('0x44')?_0x325a('0x43'):_0x325a('0x45');if(_0x4d7bde){_0x5129ba['agentEmail']=_0x4d7bde['email'];}var _0x5d3eec=util[_0x325a('0x2c')](_0x325a('0x46'),_0x2f0f1b[_0x325a('0x3d')],_0x406dec[_0x325a('0x47')],md5(_0x406dec[_0x325a('0x47')]));if(_0x32f2b9&&_0x32f2b9['monitor_format']){logger['info']('[QUEUE]',_0x325a('0x48'));_0x406dec[_0x325a('0x49')]=_0x5d3eec;}else if(_0x1e3eea&&_0x1e3eea[_0x325a('0x4a')]&&_0x1e3eea[_0x325a('0x4a')]!=='none'){logger[_0x325a('0xe')](_0x325a('0x4b'),_0x325a('0x48'));_0x406dec[_0x325a('0x49')]=_0x5d3eec;}else{_0x406dec['recordingURL']='';}return getAdminId(_0x5129ba,_0x3efffe,_0x126ffc,_0x6a0a27)[_0x325a('0x10')](getUser(_0x3efffe,_0x126ffc,_0x6a0a27))['then'](getEndUser(_0x3efffe,_0x126ffc,_0x6a0a27))[_0x325a('0x10')](getTicket(_0x3efffe,_0x126ffc,_0x6a0a27,_0x3e2df6,_0x406dec))[_0x325a('0x10')](function(_0xebd1f4){logger[_0x325a('0xe')](util[_0x325a('0x2c')](_0x325a('0x4c'),_0xebd1f4[_0x325a('0x36')]));if(_0x3efffe!==_0x325a('0x44')){logger[_0x325a('0xe')]('['+[_0x3efffe[_0x325a('0x20')]()]+']',_0x325a('0x4d'));emit(_0x6a0a27,_0x4d7bde[_0x325a('0x4e')],_0xebd1f4[_0x325a('0x28')]);}})[_0x325a('0x16')](function(_0x5399ef){logger[_0x325a('0x17')]('['+[_0x3efffe[_0x325a('0x20')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x5399ef,{'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 cdd47a0..b15ce61 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 _0x544e=['log','EVENT\x20UNKNOWN','unmanaged','desk','servicenow','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho','dynamics365','freshsales','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x544e,0xe4));var _0xe544=function(_0x1455a9,_0x203030){_0x1455a9=_0x1455a9-0x0;var _0x442892=_0x544e[_0x1455a9];return _0x442892;};'use strict';var _=require(_0xe544('0x0'));var util=require('util');var zendesk=require(_0xe544('0x1'));var salesforce=require(_0xe544('0x2'));var sugarcrm=require(_0xe544('0x3'));var freshdesk=require(_0xe544('0x4'));var zoho=require('./zoho');var desk=require(_0xe544('0x5'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0xe544('0x6'));var freshsales=require(_0xe544('0x7'));var integrations=[_0xe544('0x8'),'salesforce',_0xe544('0x9'),_0xe544('0xa'),_0xe544('0xb'),'desk','vtiger',_0xe544('0xc'),_0xe544('0xd'),'servicenow'];exports[_0xe544('0xe')]=function(_0x13342e,_0x1572ac,_0x40ffcd,_0x3b6e7e,_0x545e8d,_0x5002ac){if(_0x40ffcd){if(_[_0xe544('0xf')](integrations,_0x13342e[_0xe544('0x10')][_0xe544('0x11')]())){try{var _0x51cd87=null;var _0x340df0='';var _0x225b33=_0x40ffcd[_0x13342e[_0xe544('0x10')][_0xe544('0x11')]()];if(_0x225b33){var _0x580b57=_0x225b33[_0x13342e['data2']];if(_0x580b57){var _0x2a886c=_[_0xe544('0x12')](_0x580b57[_0xe544('0x13')],{'id':parseInt(_0x13342e[_0xe544('0x14')],0xa)});if(_0x2a886c){if(_0x3b6e7e){if(_0x545e8d&&_0x1572ac['queue']){_0x340df0=_0xe544('0x15');}else if(_0x1572ac[_0xe544('0x16')]){_0x340df0=_0xe544('0x17');}else{console[_0xe544('0x18')](_0xe544('0x19'),_0x1572ac);}}else{_0x340df0=_0xe544('0x1a');}switch(_0x13342e[_0xe544('0x10')][_0xe544('0x11')]()){case'zendesk':zendesk[_0x340df0](_0x13342e,_0x1572ac,_0x2a886c,_0x3b6e7e,_0x545e8d,_0x580b57,_0x5002ac);break;case'salesforce':salesforce[_0x340df0](_0x13342e,_0x1572ac,_0x2a886c,_0x3b6e7e,_0x545e8d,_0x580b57,_0x5002ac);break;case _0xe544('0x9'):sugarcrm[_0x340df0](_0x13342e,_0x1572ac,_0x2a886c,_0x3b6e7e,_0x545e8d,_0x580b57,_0x5002ac);break;case _0xe544('0xa'):freshdesk[_0x340df0](_0x13342e,_0x1572ac,_0x2a886c,_0x3b6e7e,_0x545e8d,_0x580b57,_0x5002ac);break;case _0xe544('0xb'):zoho[_0x340df0](_0x13342e,_0x1572ac,_0x2a886c,_0x3b6e7e,_0x545e8d,_0x580b57,_0x5002ac);break;case _0xe544('0x1b'):desk[_0x340df0](_0x13342e,_0x1572ac,_0x2a886c,_0x3b6e7e,_0x545e8d,_0x580b57,_0x5002ac);break;case'vtiger':vtiger[_0x340df0](_0x13342e,_0x1572ac,_0x2a886c,_0x3b6e7e,_0x545e8d,_0x580b57,_0x5002ac);break;case _0xe544('0xd'):freshsales['cs'](_0x13342e,_0x1572ac,_0x2a886c,_0x3b6e7e,_0x545e8d,_0x580b57,_0x5002ac,_0x340df0);break;case _0xe544('0x1c'):servicenow['cs'](_0x13342e,_0x1572ac,_0x2a886c,_0x3b6e7e,_0x545e8d,_0x580b57,_0x5002ac,_0x340df0);break;case _0xe544('0xc'):dynamics365['cs'](_0x13342e,_0x1572ac,_0x2a886c,_0x3b6e7e,_0x545e8d,_0x580b57,_0x5002ac,_0x340df0);break;default:console[_0xe544('0x18')](_0xe544('0x1d'));}}else{_0x51cd87=require(_0xe544('0x1e'))(_0x13342e[_0xe544('0x10')][_0xe544('0x11')]());_0x51cd87[_0xe544('0x1f')](_0xe544('0x20'),util[_0xe544('0x21')](_0xe544('0x22'),_0x13342e['data1'][_0xe544('0x11')](),_0x13342e['data3']));}}else{_0x51cd87=require(_0xe544('0x1e'))(_0x13342e[_0xe544('0x10')]['toLowerCase']());_0x51cd87['error'](_0xe544('0x20'),util[_0xe544('0x21')](_0xe544('0x23'),_0x13342e[_0xe544('0x10')][_0xe544('0x11')](),_0x13342e['data2']));}}else{}}catch(_0x2b6a92){console[_0xe544('0x1f')](_0x2b6a92);}}}}; \ No newline at end of file +var _0x06fe=['../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','data2','find','Configurations','data3','queue','outbound','log','unmanaged','unknown\x20integration'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x06fe,0x99));var _0xe06f=function(_0x597bf3,_0x3a2bd8){_0x597bf3=_0x597bf3-0x0;var _0x4db0db=_0x06fe[_0x597bf3];return _0x4db0db;};'use strict';var _=require(_0xe06f('0x0'));var util=require(_0xe06f('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0xe06f('0x2'));var sugarcrm=require(_0xe06f('0x3'));var freshdesk=require(_0xe06f('0x4'));var zoho=require(_0xe06f('0x5'));var desk=require(_0xe06f('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0xe06f('0x7'));var dynamics365=require(_0xe06f('0x8'));var freshsales=require(_0xe06f('0x9'));var integrations=[_0xe06f('0xa'),_0xe06f('0xb'),_0xe06f('0xc'),_0xe06f('0xd'),_0xe06f('0xe'),_0xe06f('0xf'),_0xe06f('0x10'),_0xe06f('0x11'),_0xe06f('0x12'),_0xe06f('0x13')];exports[_0xe06f('0x14')]=function(_0x10c456,_0x407780,_0x11d1ae,_0x2f8172,_0x56a8d6,_0x5416d0){if(_0x11d1ae){if(_['includes'](integrations,_0x10c456[_0xe06f('0x15')]['toLowerCase']())){try{var _0x5e1303=null;var _0x5e6428='';var _0x3b1d8f=_0x11d1ae[_0x10c456[_0xe06f('0x15')][_0xe06f('0x16')]()];if(_0x3b1d8f){var _0x1c7fb3=_0x3b1d8f[_0x10c456[_0xe06f('0x17')]];if(_0x1c7fb3){var _0x37a219=_[_0xe06f('0x18')](_0x1c7fb3[_0xe06f('0x19')],{'id':parseInt(_0x10c456[_0xe06f('0x1a')],0xa)});if(_0x37a219){if(_0x2f8172){if(_0x56a8d6&&_0x407780['queue']){_0x5e6428=_0xe06f('0x1b');}else if(_0x407780['routeId']){_0x5e6428=_0xe06f('0x1c');}else{console[_0xe06f('0x1d')]('EVENT\x20UNKNOWN',_0x407780);}}else{_0x5e6428=_0xe06f('0x1e');}switch(_0x10c456[_0xe06f('0x15')][_0xe06f('0x16')]()){case _0xe06f('0xa'):zendesk[_0x5e6428](_0x10c456,_0x407780,_0x37a219,_0x2f8172,_0x56a8d6,_0x1c7fb3,_0x5416d0);break;case _0xe06f('0xb'):salesforce[_0x5e6428](_0x10c456,_0x407780,_0x37a219,_0x2f8172,_0x56a8d6,_0x1c7fb3,_0x5416d0);break;case _0xe06f('0xc'):sugarcrm[_0x5e6428](_0x10c456,_0x407780,_0x37a219,_0x2f8172,_0x56a8d6,_0x1c7fb3,_0x5416d0);break;case _0xe06f('0xd'):freshdesk[_0x5e6428](_0x10c456,_0x407780,_0x37a219,_0x2f8172,_0x56a8d6,_0x1c7fb3,_0x5416d0);break;case _0xe06f('0xe'):zoho[_0x5e6428](_0x10c456,_0x407780,_0x37a219,_0x2f8172,_0x56a8d6,_0x1c7fb3,_0x5416d0);break;case _0xe06f('0xf'):desk[_0x5e6428](_0x10c456,_0x407780,_0x37a219,_0x2f8172,_0x56a8d6,_0x1c7fb3,_0x5416d0);break;case _0xe06f('0x10'):vtiger[_0x5e6428](_0x10c456,_0x407780,_0x37a219,_0x2f8172,_0x56a8d6,_0x1c7fb3,_0x5416d0);break;case _0xe06f('0x12'):freshsales['cs'](_0x10c456,_0x407780,_0x37a219,_0x2f8172,_0x56a8d6,_0x1c7fb3,_0x5416d0,_0x5e6428);break;case'servicenow':servicenow['cs'](_0x10c456,_0x407780,_0x37a219,_0x2f8172,_0x56a8d6,_0x1c7fb3,_0x5416d0,_0x5e6428);break;case'dynamics365':dynamics365['cs'](_0x10c456,_0x407780,_0x37a219,_0x2f8172,_0x56a8d6,_0x1c7fb3,_0x5416d0,_0x5e6428);break;default:console[_0xe06f('0x1d')](_0xe06f('0x1f'));}}else{_0x5e1303=require(_0xe06f('0x20'))(_0x10c456[_0xe06f('0x15')]['toLowerCase']());_0x5e1303[_0xe06f('0x21')](_0xe06f('0x22'),util[_0xe06f('0x23')](_0xe06f('0x24'),_0x10c456[_0xe06f('0x15')][_0xe06f('0x16')](),_0x10c456[_0xe06f('0x1a')]));}}else{_0x5e1303=require(_0xe06f('0x20'))(_0x10c456['data1'][_0xe06f('0x16')]());_0x5e1303[_0xe06f('0x21')](_0xe06f('0x22'),util[_0xe06f('0x23')]('%s\x20account\x20#%s\x20not\x20found',_0x10c456[_0xe06f('0x15')][_0xe06f('0x16')](),_0x10c456[_0xe06f('0x17')]));}}else{}}catch(_0x1189b2){console[_0xe06f('0x21')](_0x1189b2);}}}}; \ 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 eff5d74..7b24fcc 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 _0x3042=['info','sobject','isNil','validateEmail','find','then','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','length','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','execute','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','format','Caller\x20-\x20%s','','No\x20Company','upperFirst','forEach','includes','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','email','calleridname','calleridnum','integrationTab','user:%s','trigger:browser:url','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','none','[OUTBOUND]','Recording\x20is\x20enabled!','uniqueid','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','util','ioredis','../../../../config/environment','../../../../config/logger','defaults','redis','socket.io-emitter','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3042,0x1bf));var _0x2304=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0x3042[_0x7feb90];return _0x3c5b33;};'use strict';var _=require(_0x2304('0x0'));var rp=require(_0x2304('0x1'));var moment=require(_0x2304('0x2'));var BPromise=require(_0x2304('0x3'));var md5=require('md5');var jsforce=require('jsforce');var util=require(_0x2304('0x4'));var Redis=require(_0x2304('0x5'));var intUtil=require('./util');var config=require(_0x2304('0x6'));var logger=require(_0x2304('0x7'))('salesforce');config['redis']=_[_0x2304('0x8')](config[_0x2304('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x2304('0xa'))(new Redis(config[_0x2304('0x9')]));function emit(_0x40d594,_0x3589d2,_0x42538d){io['to'](_0x40d594)['emit'](_0x3589d2,_0x42538d);}function getTicket(_0x49a2a6,_0x5903c5,_0x25044f,_0x289ede,_0x4d2cc1,_0x3e33d1,_0x275282,_0x1fd070){var _0x3c0210=Object[_0x2304('0xb')]({},{'OwnerId':_0x5903c5['id'],'Subject':intUtil[_0x2304('0xc')](_0x289ede[_0x2304('0xd')],_0x4d2cc1,'\x20'),'Description':intUtil[_0x2304('0xc')](_0x289ede[_0x2304('0xe')],_0x4d2cc1,'\x0a')},getCustomFields(_0x3e33d1,_0x4d2cc1));if(_0x25044f){if(_0x289ede[_0x2304('0xf')]===_0x2304('0x10')){_0x3c0210[_0x2304('0x11')]=moment['utc']();_0x3c0210[_0x2304('0x12')]=![];_0x3c0210['IsRecurrence']=![];if(_0x25044f[_0x2304('0x13')]===_0x2304('0x14')||_0x25044f[_0x2304('0x13')]===_0x2304('0x15')){_0x3c0210[_0x2304('0x16')]=_0x25044f['id'];}else if(_0x25044f[_0x2304('0x13')]===_0x2304('0x17')){_0x3c0210[_0x2304('0x18')]=_0x25044f['id'];}}else if(_0x289ede[_0x2304('0xf')]===_0x2304('0x19')){if(_0x25044f[_0x2304('0x13')]===_0x2304('0x14')){_0x3c0210[_0x2304('0x1a')]=_0x25044f['id'];}else if(_0x25044f[_0x2304('0x13')]===_0x2304('0x17')){_0x3c0210[_0x2304('0x1b')]=_0x25044f['id'];}else if(_0x25044f['endUserType']===_0x2304('0x15')&&_0x289ede['leadId']){_0x3c0210[_0x289ede[_0x2304('0x1c')]]=_0x25044f['id'];}else{logger[_0x2304('0x1d')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x275282[_0x2304('0x1e')](_0x289ede['ticketType'])['create'](_0x3c0210);}function getUser(_0x4491b6,_0x5d15d6,_0x44a50c){if(!_[_0x2304('0x1f')](_0x5d15d6)&&intUtil[_0x2304('0x20')](_0x5d15d6)){var _0x5aa7e8={'Email':_0x5d15d6};var _0x148b43={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x44a50c[_0x2304('0x1e')]('User')[_0x2304('0x21')](_0x5aa7e8,_0x148b43)['execute']()[_0x2304('0x22')](function(_0x56fceb){if(_0x56fceb['length']){var _0x51522f=_[_0x2304('0x21')](_0x56fceb,function(_0x6fb06c){return _0x6fb06c[_0x2304('0x23')]===_0x5d15d6;});if(_0x51522f){logger[_0x2304('0x1d')](_0x2304('0x24'),_0x5d15d6);return BPromise['resolve']({'id':_0x51522f['Id'],'name':_0x51522f[_0x2304('0x25')]});}}else{logger['info'](_0x2304('0x26'),_0x5d15d6);return _0x44a50c['identity']()['then'](function(_0x5f2808){return BPromise[_0x2304('0x27')]({'id':_0x5f2808[_0x2304('0x28')],'name':_0x5f2808[_0x2304('0x29')]});});}});}else{logger[_0x2304('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5d15d6);return _0x44a50c['identity']()['then'](function(_0x55798b){return BPromise[_0x2304('0x27')]({'id':_0x55798b[_0x2304('0x28')],'name':_0x55798b[_0x2304('0x29')]});});}}function getEndUser(_0x4513ce,_0x828953,_0x5988a3,_0x57610e,_0x105e31){var _0x41a4b7={'$or':{'Phone':_0x57610e}};var _0x19de03={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x2304('0x27')]()['then'](function(){logger[_0x2304('0x1d')](_0x2304('0x2a'),_0x57610e,_0x828953[_0x2304('0x2b')]);switch(_0x828953[_0x2304('0x2b')]){case _0x2304('0x2c'):var _0x39edd8=_[_0x2304('0x2d')](_0x41a4b7);if(_0x828953[_0x2304('0x2e')]){var _0xb784a1={};_0xb784a1[_0x828953[_0x2304('0x2e')]]=_0x57610e;_[_0x2304('0x2f')](_0x39edd8[_0x2304('0x30')],_0xb784a1);}return _0x105e31['sobject'](_0x2304('0x31'))[_0x2304('0x21')](_0x39edd8,_0x19de03)['execute']()[_0x2304('0x22')](function(_0x4c24d2){if(_0x4c24d2&&_0x4c24d2[_0x2304('0x32')]){return _0x4c24d2;}else{var _0x410ef5=_[_0x2304('0x2d')](_0x41a4b7);if(_0x828953[_0x2304('0x33')]){var _0x545586={};_0x545586[_0x828953['additionalSearchLead']]=_0x57610e;_['merge'](_0x410ef5['$or'],_0x545586);}return _0x105e31[_0x2304('0x1e')](_0x2304('0x34'))['find'](_0x410ef5,_0x19de03);}});case _0x2304('0x35'):var _0x27872b=_[_0x2304('0x2d')](_0x41a4b7);if(_0x828953[_0x2304('0x36')]){var _0xb784a1={};_0xb784a1[_0x828953[_0x2304('0x36')]]=_0x57610e;_[_0x2304('0x2f')](_0x27872b[_0x2304('0x30')],_0xb784a1);}return _0x105e31['sobject'](_0x2304('0x37'))[_0x2304('0x21')](_0x27872b,_0x19de03)[_0x2304('0x38')]()[_0x2304('0x22')](function(_0x3b240f){if(_0x3b240f&&_0x3b240f[_0x2304('0x32')]){return _0x3b240f;}else{var _0x1cf7e4=_['cloneDeep'](_0x41a4b7);if(_0x828953['additionalSearchContact']){var _0x425c22={};_0x425c22[_0x828953[_0x2304('0x2e')]]=_0x57610e;_[_0x2304('0x2f')](_0x1cf7e4[_0x2304('0x30')],_0x425c22);}return _0x105e31[_0x2304('0x1e')](_0x2304('0x31'))[_0x2304('0x21')](_0x1cf7e4,_0x19de03)[_0x2304('0x22')](function(_0x3df5e1){if(_0x3df5e1&&_0x3df5e1['length']){return _0x3df5e1;}else{var _0x1d6849=_[_0x2304('0x2d')](_0x41a4b7);if(_0x828953['additionalSearchLead']){var _0x1ef088={};_0x1ef088[_0x828953[_0x2304('0x33')]]=_0x57610e;_[_0x2304('0x2f')](_0x1d6849[_0x2304('0x30')],_0x1ef088);}return _0x105e31[_0x2304('0x1e')](_0x2304('0x34'))[_0x2304('0x21')](_0x1d6849,_0x19de03);}});}});case'contact':var _0x39edd8=_[_0x2304('0x2d')](_0x41a4b7);if(_0x828953[_0x2304('0x2e')]){var _0xb784a1={};_0xb784a1[_0x828953[_0x2304('0x2e')]]=_0x57610e;_[_0x2304('0x2f')](_0x39edd8[_0x2304('0x30')],_0xb784a1);}return _0x105e31[_0x2304('0x1e')]('Contact')['find'](_0x39edd8,_0x19de03)[_0x2304('0x38')]();case _0x2304('0x15'):var _0xec651a=_['cloneDeep'](_0x41a4b7);if(_0x828953[_0x2304('0x33')]){var _0xb784a1={};_0xb784a1[_0x828953[_0x2304('0x33')]]=_0x57610e;_[_0x2304('0x2f')](_0xec651a[_0x2304('0x30')],_0xb784a1);}return _0x105e31['sobject'](_0x2304('0x34'))[_0x2304('0x21')](_0xec651a,_0x19de03);case _0x2304('0x17'):var _0x27872b=_[_0x2304('0x2d')](_0x41a4b7);if(_0x828953[_0x2304('0x36')]){var _0xb784a1={};_0xb784a1[_0x828953[_0x2304('0x36')]]=_0x57610e;_[_0x2304('0x2f')](_0x27872b['$or'],_0xb784a1);}return _0x105e31[_0x2304('0x1e')](_0x2304('0x37'))[_0x2304('0x21')](_0x27872b,_0x19de03);default:return null;}})['then'](function(_0xa9237){if(_0xa9237&&_0xa9237[_0x2304('0x32')]){var _0x58ee6d=_['first'](_0xa9237);if(_0x58ee6d){return BPromise[_0x2304('0x27')]({'id':_0x58ee6d['Id'],'name':_0x58ee6d[_0x2304('0x25')],'phone':_0x58ee6d[_0x2304('0x39')],'endUserType':_0x58ee6d['attributes'][_0x2304('0x3a')][_0x2304('0x3b')]()});}}})['then'](function(_0x77e25){if(_0x77e25){logger[_0x2304('0x1d')](_0x2304('0x3c'),_0x77e25[_0x2304('0x13')],_0x57610e);return BPromise[_0x2304('0x27')](_0x77e25);}else{logger[_0x2304('0x1d')](_0x2304('0x3d'),_0x57610e);var _0x1ae8b1={'Phone':_0x57610e};if(_0x828953['moduleCreate']){if(_0x828953['moduleCreate']==='contact'){logger[_0x2304('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x57610e,_0x828953[_0x2304('0x3e')]);_0x1ae8b1[_0x2304('0x3f')]=_0x5988a3!==''?_0x5988a3:util[_0x2304('0x40')](_0x2304('0x41'),_0x57610e);}else if(_0x828953[_0x2304('0x3e')]==='lead'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x57610e,_0x828953[_0x2304('0x3e')]);_0x1ae8b1[_0x2304('0x3f')]=_0x5988a3!==_0x2304('0x42')?_0x5988a3:util[_0x2304('0x40')](_0x2304('0x41'),_0x57610e);_0x1ae8b1['Company']=_0x2304('0x43');}else if(_0x828953['moduleCreate']===_0x2304('0x17')){logger[_0x2304('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x57610e,_0x828953[_0x2304('0x3e')]);_0x1ae8b1['Name']=_0x5988a3!==_0x2304('0x42')?_0x5988a3:util[_0x2304('0x40')](_0x2304('0x41'),_0x57610e);}else{return null;}}return _0x105e31[_0x2304('0x1e')](_[_0x2304('0x44')](_0x828953[_0x2304('0x3e')]))['create'](_0x1ae8b1)[_0x2304('0x22')](function(_0x55bcc0){return BPromise['resolve']({'id':_0x55bcc0['id'],'endUserType':_0x828953[_0x2304('0x3e')]});});}});}function getCustomFields(_0x5ff146,_0x39aed5){var _0x4c0b9d={};if(_0x5ff146[_0x2304('0x32')]>0x0){_[_0x2304('0x45')](_0x5ff146,function(_0x4633f5){if(_[_0x2304('0x46')](['string',_0x2304('0x47')],_0x4633f5[_0x2304('0x3a')])&&_0x4633f5[_0x2304('0x48')]){_0x4c0b9d[_0x4633f5[_0x2304('0x48')]]=_0x4633f5[_0x2304('0x49')][_0x2304('0x4a')]();}else if(_0x4633f5[_0x2304('0x3a')]===_0x2304('0x4b')&&_0x4633f5[_0x2304('0x4c')]&&_0x4633f5[_0x2304('0x48')]){_0x39aed5[_0x4633f5[_0x2304('0x4c')]]&&(_0x4c0b9d[_0x4633f5[_0x2304('0x48')]]=_0x39aed5[_0x4633f5[_0x2304('0x4c')]][_0x2304('0x4a')]());}else if(_0x4633f5[_0x2304('0x3a')]===_0x2304('0x4d')&&_0x4633f5[_0x2304('0x4e')]&&_0x4633f5[_0x2304('0x4e')]['name']&&_0x4633f5[_0x2304('0x48')]){_0x39aed5[_0x4633f5[_0x2304('0x4e')][_0x2304('0x4f')][_0x2304('0x3b')]()]&&(_0x4c0b9d[_0x4633f5[_0x2304('0x48')]]=_0x39aed5[_0x4633f5[_0x2304('0x4e')]['name'][_0x2304('0x3b')]()][_0x2304('0x4a')]());}});}return _0x4c0b9d;}function getConnection(_0xddebd4){var _0x147b8a=_0xddebd4['password'][_0x2304('0x50')](_0xddebd4[_0x2304('0x51')]);var _0x29ba54=new jsforce[(_0x2304('0x52'))]({'oauth2':{'loginUrl':_0xddebd4[_0x2304('0x53')]||_0x2304('0x54'),'clientId':_0xddebd4['clientId'],'clientSecret':_0xddebd4['clientSecret']}});return _0x29ba54['login'](_0xddebd4[_0x2304('0x55')],_0x147b8a)[_0x2304('0x22')](function(){logger[_0x2304('0x1d')](_0x2304('0x56'));return _0x29ba54;});}exports[_0x2304('0x57')]=function(_0x2616f5,_0x42ca49,_0x4d6a39,_0x18465d,_0x11971c,_0x2d1658){var _0x3b56e5,_0x39ed2c,_0x49e922,_0x57ee0e;_0x2d1658[_0x2304('0x58')]=intUtil[_0x2304('0x59')](_0x2d1658[_0x2304('0x58')]);_0x2d1658[_0x2304('0x53')]=intUtil[_0x2304('0x59')](_0x2d1658['remoteUri']);if(_0x11971c&&_0x11971c[_0x2304('0x5a')]){logger[_0x2304('0x1d')](_0x2304('0x5b'),'Recording\x20is\x20enabled!');_0x42ca49['recordingURL']=util[_0x2304('0x40')](_0x2304('0x5c'),_0x2d1658[_0x2304('0x58')],_0x42ca49['uniqueid'],md5(_0x42ca49['uniqueid']));}else{_0x42ca49[_0x2304('0x5d')]='';}return getConnection(_0x2d1658)[_0x2304('0x22')](function(_0x40f04f){_0x57ee0e=_0x40f04f;return getUser(_0x2d1658,_0x18465d[_0x2304('0x5e')],_0x57ee0e);})[_0x2304('0x22')](function(_0x2b5e70){_0x3b56e5=_0x2b5e70;return getEndUser(_0x2d1658,_0x4d6a39,_0x42ca49[_0x2304('0x5f')],_0x42ca49[_0x2304('0x60')],_0x57ee0e);})[_0x2304('0x22')](function(_0x5e9a62){_0x39ed2c=_0x5e9a62;return getTicket(_0x2d1658,_0x3b56e5,_0x39ed2c,_0x4d6a39,_0x42ca49,_0x4d6a39['Fields'],_0x57ee0e,'queue');})['then'](function(_0x241e89){_0x49e922=_0x241e89;logger[_0x2304('0x1d')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x49e922['id']);logger[_0x2304('0x1d')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x49e922['id'],_0x18465d[_0x2304('0x4f')],_0x2d1658[_0x2304('0x3a')]);switch(_0x2d1658[_0x2304('0x3a')]){case _0x2304('0x61'):emit(util[_0x2304('0x40')](_0x2304('0x62'),_0x18465d[_0x2304('0x4f')]),'trigger:salesforce:display',{'recordId':_0x49e922['id']});break;case'newTab':emit(util[_0x2304('0x40')](_0x2304('0x62'),_0x18465d[_0x2304('0x4f')]),_0x2304('0x63'),{'uri':util[_0x2304('0x40')]('%s/%s/e',_0x57ee0e[_0x2304('0x64')],_0x49e922['id'])});break;default:logger['error'](_0x2304('0x65'));}})[_0x2304('0x66')](function(_0x358808){logger[_0x2304('0x67')](_0x2304('0x5b'),_0x358808);});};exports[_0x2304('0x68')]=function(_0x1325e7,_0x130df2,_0x20b093,_0x31bd6c,_0x1fd3d2,_0x3c367b,_0x421647){var _0x1f80c3,_0x512b82,_0x3fc1c4,_0x30111d;_0x3c367b[_0x2304('0x58')]=intUtil[_0x2304('0x59')](_0x3c367b[_0x2304('0x58')]);_0x3c367b[_0x2304('0x53')]=intUtil[_0x2304('0x59')](_0x3c367b[_0x2304('0x53')]);if(_0x421647&&_0x421647['recordingFormat']&&_0x421647['recordingFormat']!==_0x2304('0x69')){logger['info'](_0x2304('0x6a'),_0x2304('0x6b'));_0x130df2['recordingURL']=util['format'](_0x2304('0x5c'),_0x3c367b[_0x2304('0x58')],_0x130df2['uniqueid'],md5(_0x130df2[_0x2304('0x6c')]));}return getConnection(_0x3c367b)[_0x2304('0x22')](function(_0x54707b){_0x30111d=_0x54707b;return getUser(_0x3c367b,_0x31bd6c[_0x2304('0x5e')],_0x30111d);})[_0x2304('0x22')](function(_0x50b86f){_0x1f80c3=_0x50b86f;return getEndUser(_0x3c367b,_0x20b093,_0x130df2['destcalleridname'],_0x130df2[_0x2304('0x6d')],_0x30111d);})[_0x2304('0x22')](function(_0x106457){_0x512b82=_0x106457;return getTicket(_0x3c367b,_0x1f80c3,_0x512b82,_0x20b093,_0x130df2,_0x20b093[_0x2304('0x6e')],_0x30111d,_0x2304('0x68'));})[_0x2304('0x22')](function(_0x35280d){_0x3fc1c4=_0x35280d;logger[_0x2304('0x1d')](_0x2304('0x6f'),_0x3fc1c4['id']);logger[_0x2304('0x1d')](_0x2304('0x70'),_0x3fc1c4['id'],_0x31bd6c[_0x2304('0x4f')],_0x3c367b[_0x2304('0x3a')]);switch(_0x3c367b[_0x2304('0x3a')]){case _0x2304('0x61'):emit(util[_0x2304('0x40')]('user:%s',_0x31bd6c[_0x2304('0x4f')]),_0x2304('0x71'),{'recordId':_0x3fc1c4['id']});break;case'newTab':emit(util[_0x2304('0x40')](_0x2304('0x62'),_0x31bd6c[_0x2304('0x4f')]),_0x2304('0x63'),{'uri':util['format'](_0x2304('0x72'),_0x30111d[_0x2304('0x64')],_0x3fc1c4['id'])});break;default:logger[_0x2304('0x67')](_0x2304('0x6a'),_0x2304('0x73'));}})[_0x2304('0x66')](function(_0x502869){logger[_0x2304('0x67')]('[OUTBOUND]',_0x502869);});};exports['unmanaged']=function(_0x18f796,_0x2027a2,_0x28e1c4,_0x52a87f,_0xb1a471,_0x1839d6){var _0x2eb60e,_0x36a97d,_0x5cf33b,_0x6b1002;_0x1839d6[_0x2304('0x58')]=intUtil[_0x2304('0x59')](_0x1839d6[_0x2304('0x58')]);_0x1839d6['remoteUri']=intUtil[_0x2304('0x59')](_0x1839d6[_0x2304('0x53')]);if(_0xb1a471&&_0xb1a471[_0x2304('0x5a')]){logger['info']('['+_0x2027a2[_0x2304('0x74')]['toUpperCase']()+']',_0x2304('0x6b'));_0x2027a2[_0x2304('0x5d')]=util[_0x2304('0x40')](_0x2304('0x5c'),_0x1839d6[_0x2304('0x58')],_0x2027a2['uniqueid'],md5(_0x2027a2[_0x2304('0x6c')]));}else{_0x2027a2['recordingURL']='';}return getConnection(_0x1839d6)[_0x2304('0x22')](function(_0x494507){_0x6b1002=_0x494507;if(!_['isNil'](_0x52a87f)){return getUser(_0x1839d6,_0x52a87f['name'],_0x6b1002);}else{return getUser(_0x1839d6,null,_0x6b1002);}})[_0x2304('0x22')](function(_0x528bbd){_0x2eb60e=_0x528bbd;return getEndUser(_0x1839d6,_0x28e1c4,_0x2027a2[_0x2304('0x5f')],_0x2027a2[_0x2304('0x60')],_0x6b1002);})['then'](function(_0xb6df81){_0x36a97d=_0xb6df81;return getTicket(_0x1839d6,_0x2eb60e,_0x36a97d,_0x28e1c4,_0x2027a2,_0x28e1c4['Fields'],_0x6b1002);})[_0x2304('0x22')](function(_0x4a037f){_0x5cf33b=_0x4a037f;logger[_0x2304('0x1d')]('['+_0x2027a2[_0x2304('0x74')][_0x2304('0x75')]()+']\x20Ticket\x20%s\x20created.',_0x5cf33b['id']);logger[_0x2304('0x1d')]('['+_0x2027a2[_0x2304('0x74')][_0x2304('0x75')]()+_0x2304('0x76'),_0x1839d6[_0x2304('0x3a')]);})[_0x2304('0x66')](function(_0x14ceb6){logger['error']('['+_0x2027a2[_0x2304('0x74')]['toUpperCase']()+']',_0x14ceb6);});}; \ No newline at end of file +var _0x182d=['Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','instanceUrl','unmanaged','lastevent','toUpperCase','isNil',']\x20Integration\x20account\x20type\x20%s.','catch','request-promise','moment','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','assign','getString','Subjects','Descriptions','Task','ActivityDate','endUserType','lead','WhoId','account','WhatId','ticketType','contact','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','find','execute','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','picklist','idField','content','variable','variableName','customVariable','Variable','name','toString','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','stripTrailingSlash','serverUrl','monitor_format'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x182d,0x1a3));var _0xd182=function(_0x1fe2c8,_0x506422){_0x1fe2c8=_0x1fe2c8-0x0;var _0xc080b8=_0x182d[_0x1fe2c8];return _0xc080b8;};'use strict';var _=require('lodash');var rp=require(_0xd182('0x0'));var moment=require(_0xd182('0x1'));var BPromise=require('bluebird');var md5=require(_0xd182('0x2'));var jsforce=require('jsforce');var util=require(_0xd182('0x3'));var Redis=require(_0xd182('0x4'));var intUtil=require(_0xd182('0x5'));var config=require(_0xd182('0x6'));var logger=require(_0xd182('0x7'))(_0xd182('0x8'));config[_0xd182('0x9')]=_[_0xd182('0xa')](config[_0xd182('0x9')],{'host':_0xd182('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd182('0x9')]));function emit(_0xfb9368,_0x1cb344,_0x39f1f2){io['to'](_0xfb9368)['emit'](_0x1cb344,_0x39f1f2);}function getTicket(_0x36a58f,_0x43cf31,_0x4b50e3,_0x2066a5,_0x2e43a7,_0x181a6a,_0x19dcd0,_0x24ba7e){var _0x1adcda=Object[_0xd182('0xc')]({},{'OwnerId':_0x43cf31['id'],'Subject':intUtil[_0xd182('0xd')](_0x2066a5[_0xd182('0xe')],_0x2e43a7,'\x20'),'Description':intUtil['getString'](_0x2066a5[_0xd182('0xf')],_0x2e43a7,'\x0a')},getCustomFields(_0x181a6a,_0x2e43a7));if(_0x4b50e3){if(_0x2066a5['ticketType']===_0xd182('0x10')){_0x1adcda[_0xd182('0x11')]=moment['utc']();_0x1adcda['IsReminderSet']=![];_0x1adcda['IsRecurrence']=![];if(_0x4b50e3['endUserType']==='contact'||_0x4b50e3[_0xd182('0x12')]===_0xd182('0x13')){_0x1adcda[_0xd182('0x14')]=_0x4b50e3['id'];}else if(_0x4b50e3[_0xd182('0x12')]===_0xd182('0x15')){_0x1adcda[_0xd182('0x16')]=_0x4b50e3['id'];}}else if(_0x2066a5[_0xd182('0x17')]==='Case'){if(_0x4b50e3[_0xd182('0x12')]===_0xd182('0x18')){_0x1adcda[_0xd182('0x19')]=_0x4b50e3['id'];}else if(_0x4b50e3[_0xd182('0x12')]===_0xd182('0x15')){_0x1adcda[_0xd182('0x1a')]=_0x4b50e3['id'];}else if(_0x4b50e3[_0xd182('0x12')]===_0xd182('0x13')&&_0x2066a5['leadId']){_0x1adcda[_0x2066a5[_0xd182('0x1b')]]=_0x4b50e3['id'];}else{logger[_0xd182('0x1c')](_0xd182('0x1d'));}}}return _0x19dcd0[_0xd182('0x1e')](_0x2066a5[_0xd182('0x17')])[_0xd182('0x1f')](_0x1adcda);}function getUser(_0x4dd9fd,_0x2ff148,_0x42d964){if(!_['isNil'](_0x2ff148)&&intUtil['validateEmail'](_0x2ff148)){var _0x24da9b={'Email':_0x2ff148};var _0x3b2c21={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x42d964['sobject']('User')[_0xd182('0x20')](_0x24da9b,_0x3b2c21)[_0xd182('0x21')]()['then'](function(_0x425977){if(_0x425977[_0xd182('0x22')]){var _0x30e073=_[_0xd182('0x20')](_0x425977,function(_0x5cdf31){return _0x5cdf31[_0xd182('0x23')]===_0x2ff148;});if(_0x30e073){logger[_0xd182('0x1c')]('Agent\x20%s\x20found.',_0x2ff148);return BPromise[_0xd182('0x24')]({'id':_0x30e073['Id'],'name':_0x30e073[_0xd182('0x25')]});}}else{logger['info'](_0xd182('0x26'),_0x2ff148);return _0x42d964['identity']()[_0xd182('0x27')](function(_0x281f4f){return BPromise['resolve']({'id':_0x281f4f[_0xd182('0x28')],'name':_0x281f4f[_0xd182('0x29')]});});}});}else{logger[_0xd182('0x1c')](_0xd182('0x26'),_0x2ff148);return _0x42d964[_0xd182('0x2a')]()[_0xd182('0x27')](function(_0x4cb88d){return BPromise[_0xd182('0x24')]({'id':_0x4cb88d[_0xd182('0x28')],'name':_0x4cb88d[_0xd182('0x29')]});});}}function getEndUser(_0x187769,_0x4b898c,_0x483fbc,_0x266b74,_0x316186){var _0x26ee1b={'$or':{'Phone':_0x266b74}};var _0x17c184={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd182('0x24')]()['then'](function(){logger[_0xd182('0x1c')](_0xd182('0x2b'),_0x266b74,_0x4b898c[_0xd182('0x2c')]);switch(_0x4b898c['moduleSearch']){case'contact_lead':var _0x4eb5c7=_[_0xd182('0x2d')](_0x26ee1b);if(_0x4b898c[_0xd182('0x2e')]){var _0xfa5dfe={};_0xfa5dfe[_0x4b898c[_0xd182('0x2e')]]=_0x266b74;_[_0xd182('0x2f')](_0x4eb5c7[_0xd182('0x30')],_0xfa5dfe);}return _0x316186[_0xd182('0x1e')]('Contact')[_0xd182('0x20')](_0x4eb5c7,_0x17c184)[_0xd182('0x21')]()['then'](function(_0x91447e){if(_0x91447e&&_0x91447e[_0xd182('0x22')]){return _0x91447e;}else{var _0x3968e2=_[_0xd182('0x2d')](_0x26ee1b);if(_0x4b898c[_0xd182('0x31')]){var _0x335301={};_0x335301[_0x4b898c[_0xd182('0x31')]]=_0x266b74;_[_0xd182('0x2f')](_0x3968e2[_0xd182('0x30')],_0x335301);}return _0x316186[_0xd182('0x1e')](_0xd182('0x32'))[_0xd182('0x20')](_0x3968e2,_0x17c184);}});case _0xd182('0x33'):var _0x13a4fb=_['cloneDeep'](_0x26ee1b);if(_0x4b898c[_0xd182('0x34')]){var _0xfa5dfe={};_0xfa5dfe[_0x4b898c[_0xd182('0x34')]]=_0x266b74;_[_0xd182('0x2f')](_0x13a4fb[_0xd182('0x30')],_0xfa5dfe);}return _0x316186[_0xd182('0x1e')](_0xd182('0x35'))[_0xd182('0x20')](_0x13a4fb,_0x17c184)[_0xd182('0x21')]()[_0xd182('0x27')](function(_0x3a00cb){if(_0x3a00cb&&_0x3a00cb[_0xd182('0x22')]){return _0x3a00cb;}else{var _0x10d435=_[_0xd182('0x2d')](_0x26ee1b);if(_0x4b898c[_0xd182('0x2e')]){var _0x48ce34={};_0x48ce34[_0x4b898c[_0xd182('0x2e')]]=_0x266b74;_[_0xd182('0x2f')](_0x10d435[_0xd182('0x30')],_0x48ce34);}return _0x316186['sobject']('Contact')['find'](_0x10d435,_0x17c184)[_0xd182('0x27')](function(_0x28c19a){if(_0x28c19a&&_0x28c19a[_0xd182('0x22')]){return _0x28c19a;}else{var _0xb2d9ed=_['cloneDeep'](_0x26ee1b);if(_0x4b898c[_0xd182('0x31')]){var _0x48e966={};_0x48e966[_0x4b898c[_0xd182('0x31')]]=_0x266b74;_[_0xd182('0x2f')](_0xb2d9ed['$or'],_0x48e966);}return _0x316186[_0xd182('0x1e')](_0xd182('0x32'))[_0xd182('0x20')](_0xb2d9ed,_0x17c184);}});}});case _0xd182('0x18'):var _0x4eb5c7=_['cloneDeep'](_0x26ee1b);if(_0x4b898c[_0xd182('0x2e')]){var _0xfa5dfe={};_0xfa5dfe[_0x4b898c[_0xd182('0x2e')]]=_0x266b74;_[_0xd182('0x2f')](_0x4eb5c7[_0xd182('0x30')],_0xfa5dfe);}return _0x316186['sobject'](_0xd182('0x36'))[_0xd182('0x20')](_0x4eb5c7,_0x17c184)[_0xd182('0x21')]();case _0xd182('0x13'):var _0x180d58=_['cloneDeep'](_0x26ee1b);if(_0x4b898c[_0xd182('0x31')]){var _0xfa5dfe={};_0xfa5dfe[_0x4b898c[_0xd182('0x31')]]=_0x266b74;_['merge'](_0x180d58[_0xd182('0x30')],_0xfa5dfe);}return _0x316186[_0xd182('0x1e')](_0xd182('0x32'))['find'](_0x180d58,_0x17c184);case _0xd182('0x15'):var _0x13a4fb=_[_0xd182('0x2d')](_0x26ee1b);if(_0x4b898c[_0xd182('0x34')]){var _0xfa5dfe={};_0xfa5dfe[_0x4b898c[_0xd182('0x34')]]=_0x266b74;_[_0xd182('0x2f')](_0x13a4fb[_0xd182('0x30')],_0xfa5dfe);}return _0x316186[_0xd182('0x1e')](_0xd182('0x35'))[_0xd182('0x20')](_0x13a4fb,_0x17c184);default:return null;}})[_0xd182('0x27')](function(_0x3df163){if(_0x3df163&&_0x3df163[_0xd182('0x22')]){var _0x230afb=_['first'](_0x3df163);if(_0x230afb){return BPromise[_0xd182('0x24')]({'id':_0x230afb['Id'],'name':_0x230afb[_0xd182('0x25')],'phone':_0x230afb[_0xd182('0x37')],'endUserType':_0x230afb[_0xd182('0x38')][_0xd182('0x39')][_0xd182('0x3a')]()});}}})[_0xd182('0x27')](function(_0x5cdeef){if(_0x5cdeef){logger[_0xd182('0x1c')](_0xd182('0x3b'),_0x5cdeef[_0xd182('0x12')],_0x266b74);return BPromise[_0xd182('0x24')](_0x5cdeef);}else{logger['info'](_0xd182('0x3c'),_0x266b74);var _0x1dbba7={'Phone':_0x266b74};if(_0x4b898c['moduleCreate']){if(_0x4b898c[_0xd182('0x3d')]==='contact'){logger['info'](_0xd182('0x3e'),_0x266b74,_0x4b898c[_0xd182('0x3d')]);_0x1dbba7[_0xd182('0x3f')]=_0x483fbc!==_0xd182('0x40')?_0x483fbc:util[_0xd182('0x41')](_0xd182('0x42'),_0x266b74);}else if(_0x4b898c[_0xd182('0x3d')]===_0xd182('0x13')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x266b74,_0x4b898c[_0xd182('0x3d')]);_0x1dbba7[_0xd182('0x3f')]=_0x483fbc!==_0xd182('0x40')?_0x483fbc:util[_0xd182('0x41')](_0xd182('0x42'),_0x266b74);_0x1dbba7[_0xd182('0x43')]=_0xd182('0x44');}else if(_0x4b898c['moduleCreate']==='account'){logger[_0xd182('0x1c')](_0xd182('0x3e'),_0x266b74,_0x4b898c[_0xd182('0x3d')]);_0x1dbba7[_0xd182('0x25')]=_0x483fbc!==''?_0x483fbc:util['format'](_0xd182('0x42'),_0x266b74);}else{return null;}}return _0x316186[_0xd182('0x1e')](_[_0xd182('0x45')](_0x4b898c['moduleCreate']))[_0xd182('0x1f')](_0x1dbba7)[_0xd182('0x27')](function(_0x2a63aa){return BPromise[_0xd182('0x24')]({'id':_0x2a63aa['id'],'endUserType':_0x4b898c[_0xd182('0x3d')]});});}});}function getCustomFields(_0x176970,_0x39e3b7){var _0x4057b9={};if(_0x176970[_0xd182('0x22')]>0x0){_[_0xd182('0x46')](_0x176970,function(_0x46c993){if(_['includes'](['string',_0xd182('0x47')],_0x46c993[_0xd182('0x39')])&&_0x46c993[_0xd182('0x48')]){_0x4057b9[_0x46c993[_0xd182('0x48')]]=_0x46c993[_0xd182('0x49')]['toString']();}else if(_0x46c993[_0xd182('0x39')]===_0xd182('0x4a')&&_0x46c993[_0xd182('0x4b')]&&_0x46c993['idField']){_0x39e3b7[_0x46c993[_0xd182('0x4b')]]&&(_0x4057b9[_0x46c993[_0xd182('0x48')]]=_0x39e3b7[_0x46c993[_0xd182('0x4b')]]['toString']());}else if(_0x46c993[_0xd182('0x39')]===_0xd182('0x4c')&&_0x46c993['Variable']&&_0x46c993[_0xd182('0x4d')][_0xd182('0x4e')]&&_0x46c993[_0xd182('0x48')]){_0x39e3b7[_0x46c993['Variable']['name'][_0xd182('0x3a')]()]&&(_0x4057b9[_0x46c993['idField']]=_0x39e3b7[_0x46c993['Variable']['name'][_0xd182('0x3a')]()][_0xd182('0x4f')]());}});}return _0x4057b9;}function getConnection(_0x31d37d){var _0x182ea1=_0x31d37d['password'][_0xd182('0x50')](_0x31d37d[_0xd182('0x51')]);var _0x8c6790=new jsforce[(_0xd182('0x52'))]({'oauth2':{'loginUrl':_0x31d37d[_0xd182('0x53')]||_0xd182('0x54'),'clientId':_0x31d37d[_0xd182('0x55')],'clientSecret':_0x31d37d[_0xd182('0x56')]}});return _0x8c6790[_0xd182('0x57')](_0x31d37d[_0xd182('0x58')],_0x182ea1)[_0xd182('0x27')](function(){logger[_0xd182('0x1c')](_0xd182('0x59'));return _0x8c6790;});}exports['queue']=function(_0x41cd9b,_0x21fbe1,_0x90f7d8,_0x4f935b,_0x57ac37,_0x2bde8b){var _0x26c629,_0x11ead5,_0xddc99e,_0x1a75bb;_0x2bde8b['serverUrl']=intUtil[_0xd182('0x5a')](_0x2bde8b[_0xd182('0x5b')]);_0x2bde8b[_0xd182('0x53')]=intUtil['stripTrailingSlash'](_0x2bde8b[_0xd182('0x53')]);if(_0x57ac37&&_0x57ac37[_0xd182('0x5c')]){logger[_0xd182('0x1c')]('[QUEUE]',_0xd182('0x5d'));_0x21fbe1[_0xd182('0x5e')]=util['format'](_0xd182('0x5f'),_0x2bde8b['serverUrl'],_0x21fbe1[_0xd182('0x60')],md5(_0x21fbe1[_0xd182('0x60')]));}else{_0x21fbe1[_0xd182('0x5e')]='';}return getConnection(_0x2bde8b)[_0xd182('0x27')](function(_0x3751de){_0x1a75bb=_0x3751de;return getUser(_0x2bde8b,_0x4f935b['email'],_0x1a75bb);})[_0xd182('0x27')](function(_0xc6df2a){_0x26c629=_0xc6df2a;return getEndUser(_0x2bde8b,_0x90f7d8,_0x21fbe1[_0xd182('0x61')],_0x21fbe1[_0xd182('0x62')],_0x1a75bb);})[_0xd182('0x27')](function(_0x106c96){_0x11ead5=_0x106c96;return getTicket(_0x2bde8b,_0x26c629,_0x11ead5,_0x90f7d8,_0x21fbe1,_0x90f7d8['Fields'],_0x1a75bb,_0xd182('0x63'));})['then'](function(_0x5c564c){_0xddc99e=_0x5c564c;logger[_0xd182('0x1c')](_0xd182('0x64'),_0xddc99e['id']);logger[_0xd182('0x1c')](_0xd182('0x65'),_0xddc99e['id'],_0x4f935b[_0xd182('0x4e')],_0x2bde8b[_0xd182('0x39')]);switch(_0x2bde8b[_0xd182('0x39')]){case _0xd182('0x66'):emit(util[_0xd182('0x41')]('user:%s',_0x4f935b[_0xd182('0x4e')]),'trigger:salesforce:display',{'recordId':_0xddc99e['id']});break;case'newTab':emit(util[_0xd182('0x41')](_0xd182('0x67'),_0x4f935b[_0xd182('0x4e')]),_0xd182('0x68'),{'uri':util['format'](_0xd182('0x69'),_0x1a75bb['instanceUrl'],_0xddc99e['id'])});break;default:logger[_0xd182('0x6a')](_0xd182('0x6b'));}})['catch'](function(_0xa8e68f){logger[_0xd182('0x6a')](_0xd182('0x6c'),_0xa8e68f);});};exports[_0xd182('0x6d')]=function(_0x149f6a,_0x3f402a,_0x210887,_0x38ea3a,_0x302058,_0xaabde9,_0x49236f){var _0x26c07d,_0x2261bc,_0x3ddb32,_0x17dde4;_0xaabde9[_0xd182('0x5b')]=intUtil[_0xd182('0x5a')](_0xaabde9['serverUrl']);_0xaabde9[_0xd182('0x53')]=intUtil[_0xd182('0x5a')](_0xaabde9[_0xd182('0x53')]);if(_0x49236f&&_0x49236f[_0xd182('0x6e')]&&_0x49236f[_0xd182('0x6e')]!==_0xd182('0x6f')){logger[_0xd182('0x1c')](_0xd182('0x70'),_0xd182('0x5d'));_0x3f402a[_0xd182('0x5e')]=util[_0xd182('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xaabde9[_0xd182('0x5b')],_0x3f402a[_0xd182('0x60')],md5(_0x3f402a[_0xd182('0x60')]));}return getConnection(_0xaabde9)[_0xd182('0x27')](function(_0x3f7041){_0x17dde4=_0x3f7041;return getUser(_0xaabde9,_0x38ea3a[_0xd182('0x71')],_0x17dde4);})['then'](function(_0xb17674){_0x26c07d=_0xb17674;return getEndUser(_0xaabde9,_0x210887,_0x3f402a[_0xd182('0x72')],_0x3f402a[_0xd182('0x73')],_0x17dde4);})[_0xd182('0x27')](function(_0x183886){_0x2261bc=_0x183886;return getTicket(_0xaabde9,_0x26c07d,_0x2261bc,_0x210887,_0x3f402a,_0x210887[_0xd182('0x74')],_0x17dde4,'outbound');})[_0xd182('0x27')](function(_0x228a7a){_0x3ddb32=_0x228a7a;logger[_0xd182('0x1c')](_0xd182('0x75'),_0x3ddb32['id']);logger[_0xd182('0x1c')](_0xd182('0x76'),_0x3ddb32['id'],_0x38ea3a[_0xd182('0x4e')],_0xaabde9[_0xd182('0x39')]);switch(_0xaabde9[_0xd182('0x39')]){case'integrationTab':emit(util[_0xd182('0x41')](_0xd182('0x67'),_0x38ea3a[_0xd182('0x4e')]),_0xd182('0x77'),{'recordId':_0x3ddb32['id']});break;case _0xd182('0x78'):emit(util[_0xd182('0x41')](_0xd182('0x67'),_0x38ea3a['name']),_0xd182('0x68'),{'uri':util[_0xd182('0x41')](_0xd182('0x69'),_0x17dde4[_0xd182('0x79')],_0x3ddb32['id'])});break;default:logger[_0xd182('0x6a')](_0xd182('0x70'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x189373){logger[_0xd182('0x6a')](_0xd182('0x70'),_0x189373);});};exports[_0xd182('0x7a')]=function(_0x23f043,_0x135253,_0xa2fd2f,_0x293ebb,_0x38ccaa,_0x263134){var _0x4d7921,_0x3c0458,_0x744831,_0x3a281d;_0x263134[_0xd182('0x5b')]=intUtil['stripTrailingSlash'](_0x263134[_0xd182('0x5b')]);_0x263134[_0xd182('0x53')]=intUtil['stripTrailingSlash'](_0x263134['remoteUri']);if(_0x38ccaa&&_0x38ccaa[_0xd182('0x5c')]){logger[_0xd182('0x1c')]('['+_0x135253[_0xd182('0x7b')][_0xd182('0x7c')]()+']','Recording\x20is\x20enabled!');_0x135253['recordingURL']=util[_0xd182('0x41')](_0xd182('0x5f'),_0x263134[_0xd182('0x5b')],_0x135253[_0xd182('0x60')],md5(_0x135253[_0xd182('0x60')]));}else{_0x135253['recordingURL']='';}return getConnection(_0x263134)[_0xd182('0x27')](function(_0x3cafe8){_0x3a281d=_0x3cafe8;if(!_[_0xd182('0x7d')](_0x293ebb)){return getUser(_0x263134,_0x293ebb[_0xd182('0x4e')],_0x3a281d);}else{return getUser(_0x263134,null,_0x3a281d);}})['then'](function(_0x143fd4){_0x4d7921=_0x143fd4;return getEndUser(_0x263134,_0xa2fd2f,_0x135253[_0xd182('0x61')],_0x135253[_0xd182('0x62')],_0x3a281d);})[_0xd182('0x27')](function(_0x297f33){_0x3c0458=_0x297f33;return getTicket(_0x263134,_0x4d7921,_0x3c0458,_0xa2fd2f,_0x135253,_0xa2fd2f['Fields'],_0x3a281d);})[_0xd182('0x27')](function(_0x1bc07e){_0x744831=_0x1bc07e;logger[_0xd182('0x1c')]('['+_0x135253[_0xd182('0x7b')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x744831['id']);logger[_0xd182('0x1c')]('['+_0x135253[_0xd182('0x7b')]['toUpperCase']()+_0xd182('0x7e'),_0x263134[_0xd182('0x39')]);})[_0xd182('0x7f')](function(_0x49436a){logger[_0xd182('0x6a')]('['+_0x135253[_0xd182('0x7b')]['toUpperCase']()+']',_0x49436a);});}; \ 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 6ea46b3..7cc6278 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 _0x0696=['picklist','nameField','content','toString','customField','idField','toLowerCase','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','incident','Incident','Incident\x20-\x20','forEach','push',']\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','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','request-promise','util','md5','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','GET','result','length','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','message','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','catch','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','then','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','includes','string'];(function(_0x2e9d2c,_0x125cc4){var _0x1027d0=function(_0x143ace){while(--_0x143ace){_0x2e9d2c['push'](_0x2e9d2c['shift']());}};_0x1027d0(++_0x125cc4);}(_0x0696,0x1e2));var _0x6069=function(_0x1e06f1,_0x59d7e1){_0x1e06f1=_0x1e06f1-0x0;var _0x34f77e=_0x0696[_0x1e06f1];return _0x34f77e;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0x6069('0x0'));var util=require(_0x6069('0x1'));var md5=require(_0x6069('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x6069('0x3'));var logger=require(_0x6069('0x4'))(_0x6069('0x5'));config['redis']=_['defaults'](config[_0x6069('0x6')],{'host':_0x6069('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6069('0x6')]));function getAdminUser(_0x3d818d,_0x401847,_0x53d6f2,_0x14cdfc,_0xbb03df,_0x4df1f8){return new Promise(function(_0x39f2d5,_0xa58d26){var _0x13832d={'method':_0x6069('0x8'),'uri':_0x14cdfc+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0xbb03df+'&'+_0x4df1f8,'auth':_0x401847,'json':!![]};return rp(_0x13832d)['then'](function(_0x265407){if(_0x265407[_0x6069('0x9')][_0x6069('0xa')]>0x0){_0x53d6f2['adminId']=_0x265407[_0x6069('0x9')][0x0][_0x6069('0xb')];}logger[_0x6069('0xc')]('['+[_0x3d818d[_0x6069('0xd')]()]+_0x6069('0xe'),_0x53d6f2);_0x39f2d5(_0x53d6f2);})['catch'](function(_0x3fffed){logger['error']('['+[_0x3d818d[_0x6069('0xd')]()]+']',_0x3fffed[_0x6069('0xf')]);_0xa58d26(_0x3fffed['message']);});});}function getUser(_0x5b3cfb,_0x3d6d19,_0x5e0e8c,_0x364a59,_0xda3cf8){return function(_0x13e2a5){logger[_0x6069('0xc')]('['+[_0x5b3cfb[_0x6069('0xd')]()]+'],\x20getUser\x20input\x20crm',_0x13e2a5);return new Promise(function(_0x290cff,_0x5c6aa2){if(intUtil['validateEmail'](_0x13e2a5[_0x6069('0x10')])){var _0x2df38d={'method':'GET','uri':_0x5e0e8c+_0x6069('0x11')+_0x13e2a5['userEmail']+'&'+_0x364a59+'&'+_0xda3cf8,'auth':_0x3d6d19,'json':!![]};logger['info']('['+[_0x5b3cfb[_0x6069('0xd')]()]+_0x6069('0x12'),_0x2df38d);return rp(_0x2df38d)['then'](function(_0x204a36){logger[_0x6069('0xc')]('['+[_0x5b3cfb[_0x6069('0xd')]()]+_0x6069('0x13'),_0x204a36);if(_0x204a36['result'][_0x6069('0xa')]>0x0&&String(_0x204a36[_0x6069('0x9')][0x0][_0x6069('0x14')])===_0x6069('0x15')){_0x13e2a5[_0x6069('0x16')]=_0x204a36[_0x6069('0x9')][0x0]['sys_id'];}else{_0x13e2a5['userId']=_0x13e2a5['adminId'];_0x13e2a5[_0x6069('0x10')]=_0x13e2a5[_0x6069('0x17')];}logger[_0x6069('0xc')]('['+[_0x5b3cfb[_0x6069('0xd')]()]+'],\x20getUser\x20crm',_0x13e2a5);_0x290cff(_0x13e2a5);})[_0x6069('0x18')](function(_0x37b7d8){logger[_0x6069('0x19')]('['+[_0x5b3cfb[_0x6069('0xd')]()]+']',_0x37b7d8[_0x6069('0xf')]);_0x5c6aa2(_0x37b7d8['message']);});}else{logger[_0x6069('0xc')]('['+[_0x5b3cfb[_0x6069('0xd')]()]+_0x6069('0x1a'));_0x13e2a5[_0x6069('0x16')]=_0x13e2a5['adminId'];_0x13e2a5[_0x6069('0x10')]=_0x13e2a5[_0x6069('0x17')];_0x290cff(_0x13e2a5);}});};}function createEndUser(_0x3b8f1d,_0x1c88b4,_0x4ae89a,_0xebc5db,_0x21b676){logger[_0x6069('0xc')]('['+[_0x3b8f1d[_0x6069('0xd')]()]+_0x6069('0x1b'),_0x4ae89a);return new Promise(function(_0x190af4,_0x5a2a0b){var _0x2aa33b={'method':_0x6069('0x1c'),'uri':_0xebc5db+'sys_user?'+_0x21b676,'body':{'user_name':_0x4ae89a[_0x6069('0x1d')],'roles':'user','first_name':_0x4ae89a[_0x6069('0x1d')],'active':_0x6069('0x15'),'date_format':'System','phone':_0x4ae89a[_0x6069('0x1d')]},'auth':_0x1c88b4,'json':!![]};return rp(_0x2aa33b)[_0x6069('0x1e')](function(_0x451c73){logger[_0x6069('0xc')]('['+[_0x3b8f1d[_0x6069('0xd')]()]+_0x6069('0x1f'),_0x451c73[_0x6069('0x9')]);_0x4ae89a[_0x6069('0x20')]=_0x451c73[_0x6069('0x9')][_0x6069('0xb')];_0x190af4(_0x4ae89a);})[_0x6069('0x18')](function(_0xe2decc){logger[_0x6069('0x19')]('['+[_0x3b8f1d[_0x6069('0xd')]()]+']',_0xe2decc['message']);_0x5a2a0b(_0xe2decc[_0x6069('0xf')]);});});}function getEndUser(_0x5ca231,_0x2d878a,_0x1f56d9,_0x3b15b7,_0x5e597b){return function(_0x5970a8){logger[_0x6069('0xc')]('['+[_0x5ca231['toUpperCase']()]+_0x6069('0x21'),_0x5970a8);return new Promise(function(_0x286423,_0x283841){var _0x583b10={'method':_0x6069('0x8'),'uri':_0x1f56d9+_0x6069('0x22')+_0x5970a8[_0x6069('0x1d')]+'&'+_0x3b15b7+'&'+_0x5e597b,'auth':_0x2d878a,'json':!![]};return rp(_0x583b10)[_0x6069('0x1e')](function(_0x3275e2){if(_0x3275e2[_0x6069('0x9')]['length']>0x0){_0x5970a8[_0x6069('0x20')]=_0x3275e2[_0x6069('0x9')][0x0][_0x6069('0xb')];logger[_0x6069('0xc')]('['+[_0x5ca231[_0x6069('0xd')]()]+_0x6069('0x23'),_0x5970a8);_0x286423(_0x5970a8);}else{return createEndUser(_0x5ca231,_0x2d878a,_0x5970a8,_0x1f56d9,_0x3b15b7)[_0x6069('0x1e')](function(_0x58e616){logger[_0x6069('0xc')]('['+[_0x5ca231[_0x6069('0xd')]()]+'],\x20createEndUser\x20crm',_0x58e616);_0x286423(_0x58e616);});}})[_0x6069('0x18')](function(_0x2d2901){logger['error']('['+[_0x5ca231[_0x6069('0xd')]()]+']',_0x2d2901['message']);_0x283841(_0x2d2901[_0x6069('0xf')]);});});};}function getCustomFields(_0xf33285,_0x3a5732){var _0x4f7903={};if(_0xf33285[_0x6069('0xa')]>0x0){_['forEach'](_0xf33285,function(_0x1bf572){if(_[_0x6069('0x24')]([_0x6069('0x25'),_0x6069('0x26')],_0x1bf572['type'])&&_0x1bf572[_0x6069('0x27')]&&!_0x1bf572['customField']){_0x4f7903[_0x1bf572[_0x6069('0x27')]['toLowerCase']()]=_0x1bf572[_0x6069('0x28')][_0x6069('0x29')]();}else if(_[_0x6069('0x24')](['string',_0x6069('0x26')],_0x1bf572['type'])&&_0x1bf572['idField']&&_0x1bf572[_0x6069('0x2a')]){_0x4f7903[_0x1bf572[_0x6069('0x2b')][_0x6069('0x2c')]()]=_0x1bf572[_0x6069('0x28')][_0x6069('0x29')]();}else if(_0x1bf572['type']===_0x6069('0x2d')&&_0x1bf572[_0x6069('0x2e')]&&_0x1bf572[_0x6069('0x2b')]&&_0x1bf572[_0x6069('0x2a')]){_0x4f7903[_0x1bf572[_0x6069('0x2b')]['toLowerCase']()]=_0x3a5732[_0x1bf572[_0x6069('0x2e')]]['toString']();}else if(_0x1bf572['type']===_0x6069('0x2f')&&_0x1bf572['Variable']&&_0x1bf572[_0x6069('0x30')][_0x6069('0x31')]&&_0x1bf572[_0x6069('0x2b')]&&_0x1bf572[_0x6069('0x2a')]){_0x4f7903[_0x1bf572[_0x6069('0x2b')]['toLowerCase']()]=_0x3a5732[_0x1bf572[_0x6069('0x30')][_0x6069('0x31')]['toLowerCase']()][_0x6069('0x29')]();}});}return _0x4f7903;}function getTicket(_0x26731f,_0x52e8ab,_0x359abd,_0x4ab2a9,_0x1b0b1e,_0x2ef972){return function(_0x39a16b){logger[_0x6069('0xc')]('['+[_0x26731f[_0x6069('0xd')]()]+_0x6069('0x32'),_0x39a16b);return new Promise(function(_0x48ad8a,_0x1a8587){var _0x4c8ce4=_0x26731f['toLowerCase']()===_0x6069('0x33')?_0x39a16b[_0x6069('0x16')]:_0x39a16b[_0x6069('0x20')];var _0x2e0c78={'method':_0x6069('0x1c'),'uri':_0x359abd+'incident'+'?'+_0x2ef972,'body':Object['assign']({},{'active':_0x6069('0x15'),'caller_id':_0x4c8ce4,'assigned_to':_0x39a16b[_0x6069('0x16')],'short_description':intUtil[_0x6069('0x34')](_0x4ab2a9[_0x6069('0x35')],_0x1b0b1e,'\x20'),'description':intUtil['getString'](_0x4ab2a9['Descriptions'],_0x1b0b1e,'\x0a')},getCustomFields(_0x4ab2a9[_0x6069('0x36')],_0x1b0b1e)),'auth':_0x52e8ab,'json':!![]};return rp(_0x2e0c78)[_0x6069('0x1e')](function(_0x50428d){logger['info']('['+[_0x26731f['toUpperCase']()]+_0x6069('0x37'),_0x50428d['result']);_0x39a16b[_0x6069('0x38')]=_0x50428d['result'][_0x6069('0xb')];_0x39a16b[_0x6069('0x39')]=_0x50428d[_0x6069('0x9')][_0x6069('0x3a')];logger[_0x6069('0xc')]('['+[_0x26731f[_0x6069('0xd')]()]+_0x6069('0x3b'),_0x39a16b);_0x48ad8a(_0x39a16b);})[_0x6069('0x18')](function(_0x27c333){logger[_0x6069('0x19')]('['+[_0x26731f['toUpperCase']()]+']',_0x27c333[_0x6069('0xf')]);_0x1a8587(_0x27c333[_0x6069('0xf')]);});});};}function createRemoteTag(_0x4d9bc8,_0x1b5631,_0x252cae,_0x22dcbd){return new Promise(function(_0x59fad5,_0x1d07f1){var _0x39ed06={'method':_0x6069('0x1c'),'uri':_0x252cae+'label'+'?'+_0x22dcbd,'body':{'short_description':_0x4d9bc8,'global':!![],'active':!![],'name':_0x4d9bc8},'auth':_0x1b5631,'json':!![]};return rp(_0x39ed06)[_0x6069('0x1e')](function(_0x38a054){var _0xcaab39=_0x38a054['result'][_0x6069('0xb')];_0x59fad5(_0xcaab39);});});}function getRemoteTag(_0x2cc96b,_0x224c0a,_0x537ab9,_0x2969a4,_0x5ac2fb){return new Promise(function(_0x282a24,_0x3f8403){var _0x5dd5ce={'method':_0x6069('0x8'),'uri':_0x537ab9+_0x6069('0x3c')+'?sysparm_query=name%3D'+_0x2cc96b+'&'+_0x2969a4,'auth':_0x224c0a,'json':!![]};return rp(_0x5dd5ce)[_0x6069('0x1e')](function(_0x36bbbe){if(_0x36bbbe[_0x6069('0x9')][_0x6069('0xa')]>0x0){var _0x5dc9d8=_0x36bbbe[_0x6069('0x9')][0x0][_0x6069('0xb')];_0x282a24(_0x5dc9d8);}else{return createRemoteTag(_0x2cc96b,_0x224c0a,_0x537ab9,_0x2969a4)[_0x6069('0x1e')](function(_0x2ab803){_0x282a24(_0x2ab803);});}});});}function assignTagToIncident(_0x3c8895,_0x376ada,_0x2e8c01,_0x2a7945,_0x5a08d4){return new Promise(function(_0x2959ef,_0x5bdf5b){var _0x5d5630={'method':_0x6069('0x1c'),'uri':_0x2e8c01+'label_entry'+'?'+_0x5a08d4,'body':{'label':_0x3c8895,'table':_0x6069('0x3d'),'id_type':_0x6069('0x3e'),'table_key':_0x2a7945['ticketId'],'title':_0x6069('0x3f')+_0x2a7945[_0x6069('0x39')],'id_display':_0x2a7945['ticketNumber']},'auth':_0x376ada,'json':!![]};return rp(_0x5d5630)[_0x6069('0x1e')](function(_0x373218){_0x2959ef();})[_0x6069('0x18')](function(){_0x2959ef();});});}function manageTags(_0xc033fd,_0x2f2a2b,_0x456b8b,_0x588675,_0x41a722,_0x284280,_0x37a1c8){return new Promise(function(_0xfee43d,_0xd02f90){var _0x115032=[];_0x2f2a2b[_0x6069('0x40')](function(_0xa59f6e){_0x115032[_0x6069('0x41')](getRemoteTag(_0xa59f6e,_0x456b8b,_0x588675,_0x284280,_0x37a1c8));});return Promise['all'](_0x115032)[_0x6069('0x1e')](function(_0xfb64b6){if(_0xfb64b6[_0x6069('0xa')]){logger[_0x6069('0xc')]('['+[_0xc033fd[_0x6069('0xd')]()]+_0x6069('0x42'),_0xfb64b6);var _0x590789=[];_0xfb64b6[_0x6069('0x40')](function(_0x7440e4){_0x590789[_0x6069('0x41')](assignTagToIncident(_0x7440e4,_0x456b8b,_0x588675,_0x41a722,_0x284280));});return Promise[_0x6069('0x43')](_0x590789)[_0x6069('0x1e')](function(){_0xfee43d();})[_0x6069('0x18')](function(){_0xfee43d();});}else{_0xfee43d();}});});}function getTags(_0x25907b,_0x244f03,_0xafc95,_0x1f3db1,_0x2375ce,_0x2745dd){return function(_0x2bd0d1){return new Promise(function(_0x4753df,_0x19afdd){var _0x3c9a09=[];var _0x290a33=_0x1f3db1[_0x6069('0x44')];if(_0x290a33&&_0x290a33[_0x6069('0xa')]>0x0){_0x3c9a09=_[_0x6069('0x45')](_0x290a33,_0x6069('0x31'));}if(_0x3c9a09[_0x6069('0xa')]>0x0){return manageTags(_0x25907b,_0x3c9a09,_0x244f03,_0xafc95,_0x2bd0d1,_0x2375ce,_0x2745dd)[_0x6069('0x1e')](function(){_0x4753df(_0x2bd0d1);});}else{_0x4753df(_0x2bd0d1);}});};}function emit(_0x1e3051,_0x2ef03f,_0x4d78d1){var _0x27924f=_0x6069('0x46')+_0x6069('0x47')+_0x6069('0x48')+_0x6069('0x49');var _0x161a68={'uri':_0x1e3051+_0x6069('0x4a')+_0x4d78d1+_0x27924f};io['to'](util[_0x6069('0x4b')](_0x6069('0x4c'),_0x2ef03f))[_0x6069('0x4d')](_0x6069('0x4e'),_0x161a68);}exports['cs']=function(_0x3fd046,_0x1f50f1,_0x3770c4,_0xc67907,_0x1601a9,_0x333c1e,_0xa9cf73,_0x1d6327){var _0x48df22={};var _0x1dc95a={'user':_0x333c1e[_0x6069('0x4f')],'pass':_0x333c1e[_0x6069('0x50')]};var _0x16d763=_0x6069('0x51');var _0x4b72b7=_0x6069('0x52');_0x333c1e[_0x6069('0x53')]=intUtil['stripTrailingSlash'](_0x333c1e[_0x6069('0x53')]);_0x333c1e['serverUrl']=intUtil[_0x6069('0x54')](_0x333c1e[_0x6069('0x55')]);var _0xfe8a12=util[_0x6069('0x4b')](_0x6069('0x56'),_0x333c1e['remoteUri']);_0x48df22[_0x6069('0x10')]=!_[_0x6069('0x57')](_0xc67907)?_0xc67907['email']:null;_0x48df22[_0x6069('0x17')]=_0x333c1e['email'];_0x48df22[_0x6069('0x1d')]=_0x1d6327[_0x6069('0x2c')]()===_0x6069('0x33')?_0x1f50f1['destcalleridnum']:_0x1f50f1[_0x6069('0x58')];_0x48df22['callDirection']=_0x1d6327===_0x6069('0x59')||_0x1d6327==='unmanaged'?'queue':_0x6069('0x33');var _0x45acd7=util['format'](_0x6069('0x5a'),_0x333c1e[_0x6069('0x55')],_0x1f50f1[_0x6069('0x5b')],md5(_0x1f50f1['uniqueid']));if(_0x1601a9&&_0x1601a9[_0x6069('0x5c')]){logger[_0x6069('0xc')](_0x6069('0x5d'),_0x6069('0x5e'));_0x1f50f1[_0x6069('0x5f')]=_0x45acd7;}else if(_0xa9cf73&&_0xa9cf73[_0x6069('0x60')]&&_0xa9cf73[_0x6069('0x60')]!==_0x6069('0x61')){logger[_0x6069('0xc')](_0x6069('0x62'),'Recording\x20is\x20enabled!');_0x1f50f1[_0x6069('0x5f')]=_0x45acd7;}else{_0x1f50f1[_0x6069('0x5f')]='';}return getAdminUser(_0x1d6327,_0x1dc95a,_0x48df22,_0xfe8a12,_0x4b72b7,_0x16d763)['then'](getUser(_0x1d6327,_0x1dc95a,_0xfe8a12,_0x4b72b7,_0x16d763))[_0x6069('0x1e')](getEndUser(_0x1d6327,_0x1dc95a,_0xfe8a12,_0x4b72b7,_0x16d763))[_0x6069('0x1e')](getTicket(_0x1d6327,_0x1dc95a,_0xfe8a12,_0x3770c4,_0x1f50f1,_0x4b72b7))[_0x6069('0x1e')](function(_0x5b8bb1){logger['info'](util[_0x6069('0x4b')](_0x6069('0x63'),_0x5b8bb1['ticketId']));logger[_0x6069('0xc')](util[_0x6069('0x4b')](_0x6069('0x64'),_0x1d6327));if(_0x1d6327!==_0x6069('0x65')){logger[_0x6069('0xc')]('['+[_0x1d6327[_0x6069('0xd')]()]+']',_0x6069('0x66'));emit(_0x333c1e['remoteUri'],_0xc67907[_0x6069('0x31')],_0x5b8bb1[_0x6069('0x38')]);}})[_0x6069('0x18')](function(_0x5865c5){logger[_0x6069('0x19')]('['+[_0x1d6327[_0x6069('0xd')]()]+_0x6069('0x67'),util['inspect'](_0x5865c5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x220f=['%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','queue','unmanaged','format','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','bluebird','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','then','length','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','userId','adminEmail','catch','error','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','GET','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','toLowerCase','content','toString','idField','customField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x220f,0xeb));var _0xf220=function(_0x4e0be6,_0x248d3e){_0x4e0be6=_0x4e0be6-0x0;var _0x2df297=_0x220f[_0x4e0be6];return _0x2df297;};'use strict';var _=require('lodash');var Promise=require(_0xf220('0x0'));var rp=require('request-promise');var util=require('util');var md5=require(_0xf220('0x1'));var Redis=require('ioredis');var intUtil=require(_0xf220('0x2'));var config=require(_0xf220('0x3'));var logger=require(_0xf220('0x4'))(_0xf220('0x5'));config[_0xf220('0x6')]=_[_0xf220('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf220('0x8'))(new Redis(config[_0xf220('0x6')]));function getAdminUser(_0x3f4cd3,_0x11aef2,_0x3c79fa,_0x464bb0,_0x19477e,_0x558cc6){return new Promise(function(_0x39e9c,_0x587da6){var _0x235c00={'method':'GET','uri':_0x464bb0+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x19477e+'&'+_0x558cc6,'auth':_0x11aef2,'json':!![]};return rp(_0x235c00)[_0xf220('0x9')](function(_0xcde505){if(_0xcde505['result'][_0xf220('0xa')]>0x0){_0x3c79fa[_0xf220('0xb')]=_0xcde505[_0xf220('0xc')][0x0][_0xf220('0xd')];}logger[_0xf220('0xe')]('['+[_0x3f4cd3[_0xf220('0xf')]()]+_0xf220('0x10'),_0x3c79fa);_0x39e9c(_0x3c79fa);})['catch'](function(_0x4645ce){logger['error']('['+[_0x3f4cd3[_0xf220('0xf')]()]+']',_0x4645ce[_0xf220('0x11')]);_0x587da6(_0x4645ce['message']);});});}function getUser(_0x53ef1e,_0x372bdd,_0x418733,_0x44f55c,_0x3ab51f){return function(_0x32efb4){logger['info']('['+[_0x53ef1e[_0xf220('0xf')]()]+'],\x20getUser\x20input\x20crm',_0x32efb4);return new Promise(function(_0x1adbd3,_0x50c873){if(intUtil[_0xf220('0x12')](_0x32efb4[_0xf220('0x13')])){var _0x11eca7={'method':'GET','uri':_0x418733+_0xf220('0x14')+_0x32efb4[_0xf220('0x13')]+'&'+_0x44f55c+'&'+_0x3ab51f,'auth':_0x372bdd,'json':!![]};logger['info']('['+[_0x53ef1e['toUpperCase']()]+_0xf220('0x15'),_0x11eca7);return rp(_0x11eca7)[_0xf220('0x9')](function(_0x3c688b){logger[_0xf220('0xe')]('['+[_0x53ef1e['toUpperCase']()]+_0xf220('0x16'),_0x3c688b);if(_0x3c688b[_0xf220('0xc')]['length']>0x0&&String(_0x3c688b[_0xf220('0xc')][0x0][_0xf220('0x17')])==='true'){_0x32efb4[_0xf220('0x18')]=_0x3c688b[_0xf220('0xc')][0x0][_0xf220('0xd')];}else{_0x32efb4['userId']=_0x32efb4[_0xf220('0xb')];_0x32efb4[_0xf220('0x13')]=_0x32efb4[_0xf220('0x19')];}logger[_0xf220('0xe')]('['+[_0x53ef1e['toUpperCase']()]+'],\x20getUser\x20crm',_0x32efb4);_0x1adbd3(_0x32efb4);})[_0xf220('0x1a')](function(_0x468a11){logger[_0xf220('0x1b')]('['+[_0x53ef1e[_0xf220('0xf')]()]+']',_0x468a11[_0xf220('0x11')]);_0x50c873(_0x468a11[_0xf220('0x11')]);});}else{logger[_0xf220('0xe')]('['+[_0x53ef1e[_0xf220('0xf')]()]+']\x20using\x20admin\x20profile');_0x32efb4[_0xf220('0x18')]=_0x32efb4['adminId'];_0x32efb4[_0xf220('0x13')]=_0x32efb4[_0xf220('0x19')];_0x1adbd3(_0x32efb4);}});};}function createEndUser(_0x16f413,_0x8694f2,_0x5a9359,_0x251ffd,_0x1902b6){logger['info']('['+[_0x16f413['toUpperCase']()]+_0xf220('0x1c'),_0x5a9359);return new Promise(function(_0x423c55,_0x2b6312){var _0x12c609={'method':'POST','uri':_0x251ffd+_0xf220('0x1d')+_0x1902b6,'body':{'user_name':_0x5a9359[_0xf220('0x1e')],'roles':_0xf220('0x1f'),'first_name':_0x5a9359[_0xf220('0x1e')],'active':_0xf220('0x20'),'date_format':_0xf220('0x21'),'phone':_0x5a9359[_0xf220('0x1e')]},'auth':_0x8694f2,'json':!![]};return rp(_0x12c609)['then'](function(_0x56c8ce){logger['info']('['+[_0x16f413[_0xf220('0xf')]()]+_0xf220('0x22'),_0x56c8ce['result']);_0x5a9359[_0xf220('0x23')]=_0x56c8ce[_0xf220('0xc')][_0xf220('0xd')];_0x423c55(_0x5a9359);})[_0xf220('0x1a')](function(_0x53a9b6){logger[_0xf220('0x1b')]('['+[_0x16f413[_0xf220('0xf')]()]+']',_0x53a9b6['message']);_0x2b6312(_0x53a9b6[_0xf220('0x11')]);});});}function getEndUser(_0x51bfeb,_0x30217,_0x5d9b3e,_0x5da0a4,_0x57ffd7){return function(_0x3ea86b){logger['info']('['+[_0x51bfeb[_0xf220('0xf')]()]+_0xf220('0x24'),_0x3ea86b);return new Promise(function(_0x1a7a0d,_0x3815ed){var _0x3e0430={'method':_0xf220('0x25'),'uri':_0x5d9b3e+_0xf220('0x26')+_0x3ea86b['endUserNumber']+'&'+_0x5da0a4+'&'+_0x57ffd7,'auth':_0x30217,'json':!![]};return rp(_0x3e0430)['then'](function(_0x230639){if(_0x230639[_0xf220('0xc')][_0xf220('0xa')]>0x0){_0x3ea86b[_0xf220('0x23')]=_0x230639[_0xf220('0xc')][0x0][_0xf220('0xd')];logger[_0xf220('0xe')]('['+[_0x51bfeb[_0xf220('0xf')]()]+'],\x20getEndUser\x20crm',_0x3ea86b);_0x1a7a0d(_0x3ea86b);}else{return createEndUser(_0x51bfeb,_0x30217,_0x3ea86b,_0x5d9b3e,_0x5da0a4)[_0xf220('0x9')](function(_0x13dfed){logger[_0xf220('0xe')]('['+[_0x51bfeb[_0xf220('0xf')]()]+_0xf220('0x27'),_0x13dfed);_0x1a7a0d(_0x13dfed);});}})[_0xf220('0x1a')](function(_0x2c87ec){logger[_0xf220('0x1b')]('['+[_0x51bfeb[_0xf220('0xf')]()]+']',_0x2c87ec[_0xf220('0x11')]);_0x3815ed(_0x2c87ec[_0xf220('0x11')]);});});};}function getCustomFields(_0x5b54a0,_0x36227b){var _0x364d0d={};if(_0x5b54a0[_0xf220('0xa')]>0x0){_[_0xf220('0x28')](_0x5b54a0,function(_0x24d09a){if(_[_0xf220('0x29')]([_0xf220('0x2a'),_0xf220('0x2b')],_0x24d09a[_0xf220('0x2c')])&&_0x24d09a[_0xf220('0x2d')]&&!_0x24d09a['customField']){_0x364d0d[_0x24d09a['nameField'][_0xf220('0x2e')]()]=_0x24d09a[_0xf220('0x2f')][_0xf220('0x30')]();}else if(_[_0xf220('0x29')]([_0xf220('0x2a'),_0xf220('0x2b')],_0x24d09a[_0xf220('0x2c')])&&_0x24d09a[_0xf220('0x31')]&&_0x24d09a[_0xf220('0x32')]){_0x364d0d[_0x24d09a[_0xf220('0x31')][_0xf220('0x2e')]()]=_0x24d09a['content'][_0xf220('0x30')]();}else if(_0x24d09a['type']===_0xf220('0x33')&&_0x24d09a[_0xf220('0x34')]&&_0x24d09a['idField']&&_0x24d09a[_0xf220('0x32')]){_0x364d0d[_0x24d09a[_0xf220('0x31')][_0xf220('0x2e')]()]=_0x36227b[_0x24d09a[_0xf220('0x34')]][_0xf220('0x30')]();}else if(_0x24d09a[_0xf220('0x2c')]===_0xf220('0x35')&&_0x24d09a[_0xf220('0x36')]&&_0x24d09a['Variable'][_0xf220('0x37')]&&_0x24d09a['idField']&&_0x24d09a[_0xf220('0x32')]){_0x364d0d[_0x24d09a['idField'][_0xf220('0x2e')]()]=_0x36227b[_0x24d09a[_0xf220('0x36')][_0xf220('0x37')][_0xf220('0x2e')]()][_0xf220('0x30')]();}});}return _0x364d0d;}function getTicket(_0x565862,_0xe489e8,_0x364692,_0x64edea,_0x4da2ec,_0x226ca9){return function(_0x508c1e){logger[_0xf220('0xe')]('['+[_0x565862['toUpperCase']()]+_0xf220('0x38'),_0x508c1e);return new Promise(function(_0x9cf422,_0x4491ce){var _0x580585=_0x565862[_0xf220('0x2e')]()===_0xf220('0x39')?_0x508c1e[_0xf220('0x18')]:_0x508c1e['endUserId'];var _0x4a0500={'method':'POST','uri':_0x364692+'incident'+'?'+_0x226ca9,'body':Object[_0xf220('0x3a')]({},{'active':_0xf220('0x20'),'caller_id':_0x580585,'assigned_to':_0x508c1e[_0xf220('0x18')],'short_description':intUtil[_0xf220('0x3b')](_0x64edea[_0xf220('0x3c')],_0x4da2ec,'\x20'),'description':intUtil[_0xf220('0x3b')](_0x64edea[_0xf220('0x3d')],_0x4da2ec,'\x0a')},getCustomFields(_0x64edea[_0xf220('0x3e')],_0x4da2ec)),'auth':_0xe489e8,'json':!![]};return rp(_0x4a0500)[_0xf220('0x9')](function(_0x30c951){logger[_0xf220('0xe')]('['+[_0x565862[_0xf220('0xf')]()]+_0xf220('0x3f'),_0x30c951['result']);_0x508c1e[_0xf220('0x40')]=_0x30c951[_0xf220('0xc')][_0xf220('0xd')];_0x508c1e[_0xf220('0x41')]=_0x30c951[_0xf220('0xc')][_0xf220('0x42')];logger[_0xf220('0xe')]('['+[_0x565862[_0xf220('0xf')]()]+_0xf220('0x43'),_0x508c1e);_0x9cf422(_0x508c1e);})[_0xf220('0x1a')](function(_0x583e2e){logger[_0xf220('0x1b')]('['+[_0x565862[_0xf220('0xf')]()]+']',_0x583e2e[_0xf220('0x11')]);_0x4491ce(_0x583e2e[_0xf220('0x11')]);});});};}function createRemoteTag(_0x33376c,_0x50a4cb,_0x46658f,_0x4e86b0){return new Promise(function(_0x24f840,_0x37de81){var _0x3c06a3={'method':'POST','uri':_0x46658f+'label'+'?'+_0x4e86b0,'body':{'short_description':_0x33376c,'global':!![],'active':!![],'name':_0x33376c},'auth':_0x50a4cb,'json':!![]};return rp(_0x3c06a3)[_0xf220('0x9')](function(_0x4e60b4){var _0x3e8f03=_0x4e60b4[_0xf220('0xc')][_0xf220('0xd')];_0x24f840(_0x3e8f03);});});}function getRemoteTag(_0x14d086,_0x45ff46,_0x1fe0af,_0x1c44d4,_0x109fb4){return new Promise(function(_0x10dc2e,_0x2f9990){var _0x53667e={'method':_0xf220('0x25'),'uri':_0x1fe0af+_0xf220('0x44')+_0xf220('0x45')+_0x14d086+'&'+_0x1c44d4,'auth':_0x45ff46,'json':!![]};return rp(_0x53667e)['then'](function(_0x371c90){if(_0x371c90[_0xf220('0xc')][_0xf220('0xa')]>0x0){var _0x39ca48=_0x371c90[_0xf220('0xc')][0x0][_0xf220('0xd')];_0x10dc2e(_0x39ca48);}else{return createRemoteTag(_0x14d086,_0x45ff46,_0x1fe0af,_0x1c44d4)[_0xf220('0x9')](function(_0x47409e){_0x10dc2e(_0x47409e);});}});});}function assignTagToIncident(_0x6903d4,_0xfb4458,_0x31fbca,_0x28a9e1,_0xd65dd8){return new Promise(function(_0x22558a,_0x2c8d02){var _0x8777e9={'method':'POST','uri':_0x31fbca+'label_entry'+'?'+_0xd65dd8,'body':{'label':_0x6903d4,'table':'incident','id_type':_0xf220('0x46'),'table_key':_0x28a9e1['ticketId'],'title':_0xf220('0x47')+_0x28a9e1['ticketNumber'],'id_display':_0x28a9e1[_0xf220('0x41')]},'auth':_0xfb4458,'json':!![]};return rp(_0x8777e9)[_0xf220('0x9')](function(_0xcbcd37){_0x22558a();})[_0xf220('0x1a')](function(){_0x22558a();});});}function manageTags(_0x3a3926,_0x4db03e,_0x457925,_0x53aeeb,_0x10196c,_0x4b075f,_0x3bb23a){return new Promise(function(_0x2a5f54,_0x3e4b0b){var _0x222266=[];_0x4db03e[_0xf220('0x28')](function(_0x51a547){_0x222266[_0xf220('0x48')](getRemoteTag(_0x51a547,_0x457925,_0x53aeeb,_0x4b075f,_0x3bb23a));});return Promise[_0xf220('0x49')](_0x222266)[_0xf220('0x9')](function(_0x51fc99){if(_0x51fc99[_0xf220('0xa')]){logger['info']('['+[_0x3a3926[_0xf220('0xf')]()]+_0xf220('0x4a'),_0x51fc99);var _0x48229f=[];_0x51fc99[_0xf220('0x28')](function(_0x4520aa){_0x48229f[_0xf220('0x48')](assignTagToIncident(_0x4520aa,_0x457925,_0x53aeeb,_0x10196c,_0x4b075f));});return Promise['all'](_0x48229f)[_0xf220('0x9')](function(){_0x2a5f54();})[_0xf220('0x1a')](function(){_0x2a5f54();});}else{_0x2a5f54();}});});}function getTags(_0x2adfca,_0xbe9386,_0x5b0abc,_0x387526,_0x15fbce,_0x19aeb0){return function(_0x1a60f1){return new Promise(function(_0x5a5333,_0x465f0e){var _0x760199=[];var _0x472b89=_0x387526[_0xf220('0x4b')];if(_0x472b89&&_0x472b89['length']>0x0){_0x760199=_[_0xf220('0x4c')](_0x472b89,_0xf220('0x37'));}if(_0x760199[_0xf220('0xa')]>0x0){return manageTags(_0x2adfca,_0x760199,_0xbe9386,_0x5b0abc,_0x1a60f1,_0x15fbce,_0x19aeb0)[_0xf220('0x9')](function(){_0x5a5333(_0x1a60f1);});}else{_0x5a5333(_0x1a60f1);}});};}function emit(_0x52870c,_0x2e4da1,_0x30108a){var _0x34bea0=_0xf220('0x4d')+_0xf220('0x4e')+_0xf220('0x4f')+_0xf220('0x50');var _0x3f02ee={'uri':_0x52870c+_0xf220('0x51')+_0x30108a+_0x34bea0};io['to'](util['format'](_0xf220('0x52'),_0x2e4da1))[_0xf220('0x53')](_0xf220('0x54'),_0x3f02ee);}exports['cs']=function(_0x1f8159,_0x4b015c,_0x484a0b,_0x98a78,_0x255940,_0x572f78,_0x44da25,_0x1bbe70){var _0x19c92d={};var _0x4de3c2={'user':_0x572f78[_0xf220('0x55')],'pass':_0x572f78[_0xf220('0x56')]};var _0x27e5a4=_0xf220('0x57');var _0x3c6ae9=_0xf220('0x58');_0x572f78[_0xf220('0x59')]=intUtil[_0xf220('0x5a')](_0x572f78['remoteUri']);_0x572f78[_0xf220('0x5b')]=intUtil[_0xf220('0x5a')](_0x572f78['serverUrl']);var _0x4d2b37=util['format'](_0xf220('0x5c'),_0x572f78[_0xf220('0x59')]);_0x19c92d[_0xf220('0x13')]=!_[_0xf220('0x5d')](_0x98a78)?_0x98a78[_0xf220('0x5e')]:null;_0x19c92d[_0xf220('0x19')]=_0x572f78[_0xf220('0x5e')];_0x19c92d[_0xf220('0x1e')]=_0x1bbe70[_0xf220('0x2e')]()===_0xf220('0x39')?_0x4b015c[_0xf220('0x5f')]:_0x4b015c[_0xf220('0x60')];_0x19c92d['callDirection']=_0x1bbe70===_0xf220('0x61')||_0x1bbe70===_0xf220('0x62')?_0xf220('0x61'):_0xf220('0x39');var _0x262615=util[_0xf220('0x63')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x572f78[_0xf220('0x5b')],_0x4b015c[_0xf220('0x64')],md5(_0x4b015c[_0xf220('0x64')]));if(_0x255940&&_0x255940[_0xf220('0x65')]){logger['info'](_0xf220('0x66'),_0xf220('0x67'));_0x4b015c['recordingURL']=_0x262615;}else if(_0x44da25&&_0x44da25['recordingFormat']&&_0x44da25['recordingFormat']!==_0xf220('0x68')){logger[_0xf220('0xe')](_0xf220('0x69'),_0xf220('0x67'));_0x4b015c[_0xf220('0x6a')]=_0x262615;}else{_0x4b015c['recordingURL']='';}return getAdminUser(_0x1bbe70,_0x4de3c2,_0x19c92d,_0x4d2b37,_0x3c6ae9,_0x27e5a4)['then'](getUser(_0x1bbe70,_0x4de3c2,_0x4d2b37,_0x3c6ae9,_0x27e5a4))[_0xf220('0x9')](getEndUser(_0x1bbe70,_0x4de3c2,_0x4d2b37,_0x3c6ae9,_0x27e5a4))['then'](getTicket(_0x1bbe70,_0x4de3c2,_0x4d2b37,_0x484a0b,_0x4b015c,_0x3c6ae9))[_0xf220('0x9')](function(_0x824b17){logger[_0xf220('0xe')](util[_0xf220('0x63')]('The\x20ticket\x20ID\x20is:\x20%s',_0x824b17['ticketId']));logger['info'](util[_0xf220('0x63')](_0xf220('0x6b'),_0x1bbe70));if(_0x1bbe70!=='unmanaged'){logger['info']('['+[_0x1bbe70[_0xf220('0xf')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x572f78[_0xf220('0x59')],_0x98a78[_0xf220('0x37')],_0x824b17['ticketId']);}})[_0xf220('0x1a')](function(_0x1afe95){logger['error']('['+[_0x1bbe70[_0xf220('0xf')]()]+_0xf220('0x6c'),util['inspect'](_0x1afe95,{'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 03fbf81..bb033fd 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 _0x613a=['date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','parent_type','parent_name','length','variableName','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','get_server_info','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','find','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Contacts','then','Enduser\x20found!','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','forEach','string','nameField','customField','toLowerCase','content','type','custom_fields','push','variable','customVariable','Variable','POST','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','Outbound','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','error','unmanaged','monitor_format','lastevent','toUpperCase','calleridname','catch','lodash','request-promise','bluebird','md5','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','assigned_user_id','created_by','description','getString','Descriptions'];(function(_0x3abc17,_0x29e41b){var _0x134348=function(_0xe65377){while(--_0xe65377){_0x3abc17['push'](_0x3abc17['shift']());}};_0x134348(++_0x29e41b);}(_0x613a,0x1d4));var _0xa613=function(_0x1e081a,_0x2ce645){_0x1e081a=_0x1e081a-0x0;var _0x3e742f=_0x613a[_0x1e081a];return _0x3e742f;};'use strict';var _=require(_0xa613('0x0'));var rp=require(_0xa613('0x1'));var BPromise=require(_0xa613('0x2'));var md5=require(_0xa613('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa613('0x4'));var config=require(_0xa613('0x5'));var logger=require(_0xa613('0x6'))(_0xa613('0x7'));config[_0xa613('0x8')]=_['defaults'](config[_0xa613('0x8')],{'host':_0xa613('0x9'),'port':0x18eb});var io=require(_0xa613('0xa'))(new Redis(config[_0xa613('0x8')]));var def={'method':'POST','json':!![]};function emit(_0x5f1907,_0x4d13d4,_0x3bcb14){io['to'](_0x5f1907)[_0xa613('0xb')](_0x4d13d4,_0x3bcb14);}function getTicket(_0x46fe6c,_0x4718c6,_0x16d1bf,_0x4d969d,_0x2f4338,_0x54ab9d,_0x337c7d,_0x557f5a){logger[_0xa613('0xc')](_0xa613('0xd'));var _0x5396b4=new Date();var _0x13757a=[{'name':_0xa613('0xe'),'value':intUtil['getString'](_0x4d969d['Subjects'],_0x2f4338,'\x20')},{'name':_0xa613('0xf'),'value':_0x4718c6['id']},{'name':_0xa613('0x10'),'value':_0x4718c6['id']},{'name':_0xa613('0x11'),'value':intUtil[_0xa613('0x12')](_0x4d969d[_0xa613('0x13')],_0x2f4338,'\x0a')},{'name':_0xa613('0x14'),'value':_0x5396b4[_0xa613('0x15')]()[_0xa613('0x16')](0x0,0x13)['replace']('T','\x20')},{'name':_0xa613('0x17'),'value':'0'},{'name':_0xa613('0x18'),'value':'15'},{'name':_0xa613('0x19'),'value':_0x16d1bf['id']},{'name':_0xa613('0x1a'),'value':'Contacts'},{'name':_0xa613('0x1b'),'value':_0x16d1bf['name']},{'name':'direction','value':_0x557f5a}];if(_0x54ab9d[_0xa613('0x1c')]){_['forEach'](_0x54ab9d,function(_0x2ec91a){if(_0x2f4338[_0x2ec91a[_0xa613('0x1d')]]){_0x13757a['push']({'name':_0x2ec91a[_0xa613('0x1e')],'value':_0x2f4338[_0x2ec91a[_0xa613('0x1d')]]});}});}return request({'form':{'method':_0xa613('0x1f'),'input_type':_0xa613('0x20'),'response_type':_0xa613('0x20'),'rest_data':JSON[_0xa613('0x21')]({'session':_0x337c7d['id'],'module_name':_0xa613('0x22'),'name_value_list':_0x13757a})}});}function getAuth(_0x378e4a){return util[_0xa613('0x23')](_0xa613('0x24'),new Buffer(_0x378e4a['apiKey']+':X')[_0xa613('0x25')]('base64'));}function getServerInfo(_0x4ac291){return request({'form':{'method':_0xa613('0x26'),'input_type':_0xa613('0x20'),'response_type':_0xa613('0x20'),'rest_data':JSON['stringify']({'session':_0x4ac291['id']})}});}function getUser(_0x1a78c2,_0x24cfc5,_0x332314){if(!_['isNil'](_0x24cfc5)){logger[_0xa613('0xc')]('Getting\x20agent\x20with\x20name',_0x24cfc5);return request({'form':{'method':_0xa613('0x27'),'input_type':_0xa613('0x20'),'response_type':'JSON','rest_data':JSON[_0xa613('0x21')]({'session':_0x332314['id'],'module_name':_0xa613('0x28'),'query':util[_0xa613('0x23')](_0xa613('0x29'),_0x24cfc5),'order_by':'','offset':'0','select_fields':['id',_0xa613('0xe'),_0xa613('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x25750f){if(_0x25750f['entry_list'][_0xa613('0x1c')]){var _0x4053ea=_[_0xa613('0x2b')](_0x25750f[_0xa613('0x2c')],function(_0x43aa6b){return _0x43aa6b['name_value_list'][_0xa613('0x2a')][_0xa613('0x2d')]===_0x24cfc5;});if(_0x4053ea){logger[_0xa613('0xc')](_0xa613('0x2e'));return BPromise[_0xa613('0x2f')]({'id':_0x4053ea[_0xa613('0x30')]['id']['value'],'name':_0x4053ea['name_value_list'][_0xa613('0xe')][_0xa613('0x2d')]});}}logger['info'](_0xa613('0x31'));return BPromise[_0xa613('0x2f')]({'id':_0x332314[_0xa613('0x30')][_0xa613('0x32')]['value'],'name':_0x332314[_0xa613('0x30')][_0xa613('0x2a')][_0xa613('0x2d')]});});}else{logger['info'](_0xa613('0x33'));return BPromise[_0xa613('0x2f')]({'id':_0x332314[_0xa613('0x30')]['user_id'][_0xa613('0x2d')],'name':_0x332314['name_value_list'][_0xa613('0x2a')][_0xa613('0x2d')]});}}function getEndUser(_0x35c1a0,_0x531f9b,_0x34d3d4,_0x4a4872){logger[_0xa613('0xc')]('Searching\x20enduser\x20with\x20phone',_0x34d3d4);return request({'form':{'method':'get_entry_list','input_type':_0xa613('0x20'),'response_type':_0xa613('0x20'),'rest_data':JSON['stringify']({'session':_0x4a4872['id'],'module_name':_0xa613('0x34'),'query':util[_0xa613('0x23')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x34d3d4),'order_by':'','offset':'0','select_fields':['id',_0xa613('0xe'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa613('0x35')](function(_0x261cd8){if(_0x261cd8[_0xa613('0x2c')][_0xa613('0x1c')]){var _0x3e9a28=_[_0xa613('0x2b')](_0x261cd8[_0xa613('0x2c')],function(_0x522968){return _0x522968[_0xa613('0x30')]['phone_home']['value']===_0x34d3d4;});if(_0x3e9a28){logger[_0xa613('0xc')](_0xa613('0x36'));return BPromise[_0xa613('0x2f')]({'id':_0x3e9a28[_0xa613('0x30')]['id'][_0xa613('0x2d')],'name':_0x3e9a28[_0xa613('0x30')][_0xa613('0xe')][_0xa613('0x2d')],'phone':_0x3e9a28[_0xa613('0x30')][_0xa613('0x37')][_0xa613('0x2d')]});}}else{logger['info'](_0xa613('0x38'));return request({'form':{'method':_0xa613('0x1f'),'input_type':_0xa613('0x20'),'response_type':_0xa613('0x20'),'rest_data':JSON[_0xa613('0x21')]({'session':_0x4a4872['id'],'module_name':_0xa613('0x34'),'name_value_list':[{'name':_0xa613('0x39'),'value':_0x531f9b!==_0xa613('0x3a')?_0x531f9b:util['format'](_0xa613('0x3b'),_0x34d3d4)},{'name':_0xa613('0x37'),'value':_0x34d3d4}]})}})['then'](function(_0x8c7e93){logger[_0xa613('0xc')](_0xa613('0x3c'));return BPromise[_0xa613('0x2f')]({'id':_0x8c7e93['id'],'name':_0x8c7e93[_0xa613('0x2c')][_0xa613('0x39')][_0xa613('0x2d')],'phone':_0x8c7e93[_0xa613('0x2c')]['phone_home'][_0xa613('0x2d')]});});}});}function request(_0x3b4202){logger[_0xa613('0x3d')](_0xa613('0x3e'),JSON[_0xa613('0x21')](_0x3b4202));return rp(_[_0xa613('0x3f')](def,_0x3b4202));}function getTags(_0x35ff0b,_0x1eb43b){var _0x2d3771=[];if(_0x35ff0b&&_0x35ff0b[_0xa613('0x1c')]>0x0){_0x2d3771=_[_0xa613('0x40')](_0x35ff0b,_0x1eb43b);}return _0x2d3771;}function getCustomFields(_0x35fe3a,_0x272e86){var _0x754d63=[];var _0xddb760={'custom_fields':[]};if(_0x35fe3a[_0xa613('0x1c')]>0x0){_[_0xa613('0x41')](_0x35fe3a,function(_0x1ed0ab){if(_0x1ed0ab['type']===_0xa613('0x42')&&_0x1ed0ab[_0xa613('0x43')]&&!_0x1ed0ab[_0xa613('0x44')]){_0xddb760[_0x1ed0ab[_0xa613('0x43')][_0xa613('0x45')]()]=_0x1ed0ab[_0xa613('0x46')]['toString']();}else if(_0x1ed0ab[_0xa613('0x47')]==='string'&&_0x1ed0ab[_0xa613('0x1e')]&&_0x1ed0ab[_0xa613('0x44')]){_0xddb760[_0xa613('0x48')][_0xa613('0x49')]({'id':_0x1ed0ab['idField'],'value':_0x1ed0ab[_0xa613('0x46')][_0xa613('0x25')]()});}else if(_0x1ed0ab['type']===_0xa613('0x4a')&&_0x1ed0ab[_0xa613('0x1d')]&&_0x1ed0ab[_0xa613('0x1e')]&&_0x1ed0ab['customField']){_0x272e86[_0x1ed0ab['variableName']]&&_0xddb760[_0xa613('0x48')][_0xa613('0x49')]({'id':_0x1ed0ab[_0xa613('0x1e')],'value':_0x272e86[_0x1ed0ab[_0xa613('0x1d')]][_0xa613('0x25')]()});}else if(_0x1ed0ab['type']===_0xa613('0x4b')&&_0x1ed0ab[_0xa613('0x4c')]&&_0x1ed0ab[_0xa613('0x4c')][_0xa613('0xe')]&&_0x1ed0ab['idField']&&_0x1ed0ab[_0xa613('0x44')]){_0x272e86[_0x1ed0ab[_0xa613('0x4c')][_0xa613('0xe')][_0xa613('0x45')]()]&&_0xddb760[_0xa613('0x48')]['push']({'id':_0x1ed0ab[_0xa613('0x1e')],'value':_0x272e86[_0x1ed0ab[_0xa613('0x4c')][_0xa613('0xe')][_0xa613('0x45')]()][_0xa613('0x25')]()});}});}return _0xddb760;}function getConnection(_0x3ad6ae){return request({'method':_0xa613('0x4d'),'form':{'method':_0xa613('0x4e'),'input_type':_0xa613('0x20'),'response_type':_0xa613('0x20'),'rest_data':JSON[_0xa613('0x21')]({'user_auth':{'user_name':_0x3ad6ae[_0xa613('0x4f')],'password':_0x3ad6ae[_0xa613('0x50')],'encryption':'PLAIN'},'application':_0xa613('0x51')})}})[_0xa613('0x35')](function(_0x7f3b1f){var _0x3f03bd=_0x7f3b1f;if(_0x3f03bd['id']){def[_0xa613('0x52')]=_0x3f03bd['id'];return BPromise[_0xa613('0x2f')](_0x3f03bd);}else{throw new Error(util[_0xa613('0x23')](_0xa613('0x53'),_0x3ad6ae['id']));}});}function setRelationship(_0x56e163,_0x4102b0,_0x3ac97a,_0x229aa6){return request({'form':{'method':'set_relationship','input_type':_0xa613('0x20'),'response_type':_0xa613('0x20'),'rest_data':JSON[_0xa613('0x21')]({'session':_0x56e163['id'],'module_name':'Calls','module_id':_0x3ac97a['id'],'link_field_name':_0x229aa6,'related_ids':[_0x4102b0['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xa613('0x54')]=function(_0x508b5b,_0xb44140,_0x509ce4,_0x3490b7,_0x9962f2,_0x36d4f4){var _0x56263b,_0x5d8417,_0x1132a4,_0x391c27;_0x36d4f4['remoteUri']=intUtil[_0xa613('0x55')](_0x36d4f4[_0xa613('0x56')]);_0x36d4f4[_0xa613('0x57')]=intUtil[_0xa613('0x55')](_0x36d4f4[_0xa613('0x57')]);def[_0xa613('0x58')]=util[_0xa613('0x23')](_0xa613('0x59'),_0x36d4f4[_0xa613('0x56')]);if(_0x9962f2&&_0x9962f2['monitor_format']){logger[_0xa613('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0xb44140[_0xa613('0x5a')]=util[_0xa613('0x23')](_0xa613('0x5b'),_0x36d4f4['serverUrl'],_0xb44140['uniqueid'],md5(_0xb44140[_0xa613('0x5c')]));}else{_0xb44140['recordingURL']='';}return getConnection(_0x36d4f4)[_0xa613('0x35')](function(_0x39dac4){_0x391c27=_0x39dac4;return getUser(_0x36d4f4,_0x3490b7[_0xa613('0xe')],_0x391c27);})[_0xa613('0x35')](function(_0x772e4d){_0x56263b=_0x772e4d;logger['info'](_0xa613('0x5d'),_0x56263b['id']);return getEndUser(_0x36d4f4,_0xb44140['calleridname'],_0xb44140[_0xa613('0x5e')],_0x391c27);})['then'](function(_0x2ebde9){_0x5d8417=_0x2ebde9;logger[_0xa613('0xc')](_0xa613('0x5f'),_0x5d8417['id']);return getTicket(_0x36d4f4,_0x56263b,_0x5d8417,_0x509ce4,_0xb44140,_0x509ce4['Fields'],_0x391c27,_0xa613('0x60'));})[_0xa613('0x35')](function(_0x3c59a9){_0x1132a4=_0x3c59a9;logger[_0xa613('0xc')](_0xa613('0x61'));logger['info'](_0xa613('0x62'),_0x1132a4['id']);return setRelationship(_0x391c27,_0x56263b,_0x1132a4,_0xa613('0x63'));})[_0xa613('0x35')](function(){return setRelationship(_0x391c27,_0x5d8417,_0x1132a4,_0xa613('0x64'));})[_0xa613('0x35')](function(){return getServerInfo(_0x391c27);})[_0xa613('0x35')](function(_0x2aadd6){var _0x1ca0e8=parseInt(_0x2aadd6['version'][_0xa613('0x65')](0x0));var _0x7480a8=util[_0xa613('0x23')](_0xa613('0x66'),_0x36d4f4[_0xa613('0x56')],_0x1132a4['id']);if(_0x1ca0e8>0x6){_0x7480a8=util[_0xa613('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x36d4f4['remoteUri'],_0x1132a4['id']);}logger['info']('[QUEUE]',_0xa613('0x67'));emit(util[_0xa613('0x23')]('user:%s',_0x3490b7[_0xa613('0xe')]),_0xa613('0x68'),{'uri':_0x7480a8});})['catch'](function(_0x35ca7d){logger['error']('[QUEUE]',JSON['stringify'](_0x35ca7d));});};exports[_0xa613('0x69')]=function(_0x760634,_0x3480b9,_0x2e82bc,_0x40c647,_0x4f4f33,_0x497757,_0x13b212){var _0x3043da,_0xd5138b,_0x1b1d1f,_0x1d8a35;_0x497757[_0xa613('0x56')]=intUtil[_0xa613('0x55')](_0x497757['remoteUri']);_0x497757['serverUrl']=intUtil[_0xa613('0x55')](_0x497757[_0xa613('0x57')]);def[_0xa613('0x58')]=util[_0xa613('0x23')](_0xa613('0x59'),_0x497757['remoteUri']);if(_0x13b212&&_0x13b212[_0xa613('0x6a')]&&_0x13b212[_0xa613('0x6a')]!=='none'){logger[_0xa613('0xc')](_0xa613('0x6b'),'Recording\x20is\x20enabled!');_0x3480b9['recordingURL']=util[_0xa613('0x23')](_0xa613('0x5b'),_0x497757[_0xa613('0x57')],_0x3480b9[_0xa613('0x5c')],md5(_0x3480b9['uniqueid']));}return getConnection(_0x497757)[_0xa613('0x35')](function(_0x1d2c34){_0x1d8a35=_0x1d2c34;return getUser(_0x497757,_0x40c647[_0xa613('0xe')],_0x1d8a35);})[_0xa613('0x35')](function(_0x411b72){_0x3043da=_0x411b72;logger[_0xa613('0xc')]('The\x20User\x20ID\x20is:',_0x3043da['id']);return getEndUser(_0x497757,_0x3480b9[_0xa613('0x6c')],_0x3480b9[_0xa613('0x6d')],_0x1d8a35);})[_0xa613('0x35')](function(_0x410455){_0xd5138b=_0x410455;logger[_0xa613('0xc')](_0xa613('0x5f'),_0xd5138b['id']);return getTicket(_0x497757,_0x3043da,_0xd5138b,_0x2e82bc,_0x3480b9,_0x2e82bc[_0xa613('0x6e')],_0x1d8a35,_0xa613('0x6f'));})[_0xa613('0x35')](function(_0x4f9b31){_0x1b1d1f=_0x4f9b31;logger[_0xa613('0xc')](_0xa613('0x61'));logger[_0xa613('0xc')](_0xa613('0x62'),_0x1b1d1f['id']);return setRelationship(_0x1d8a35,_0x3043da,_0x1b1d1f,'users');})[_0xa613('0x35')](function(){return setRelationship(_0x1d8a35,_0xd5138b,_0x1b1d1f,_0xa613('0x64'));})['then'](function(){return getServerInfo(_0x1d8a35);})[_0xa613('0x35')](function(_0xf47aac){var _0x3b4f3a=parseInt(_0xf47aac[_0xa613('0x70')][_0xa613('0x65')](0x0));var _0xfab453=util[_0xa613('0x23')](_0xa613('0x66'),_0x497757['remoteUri'],_0x1b1d1f['id']);if(_0x3b4f3a>0x6){_0xfab453=util['format'](_0xa613('0x71'),_0x497757['remoteUri'],_0x1b1d1f['id']);}logger[_0xa613('0xc')](_0xa613('0x6b'),_0xa613('0x67'));emit(util[_0xa613('0x23')](_0xa613('0x72'),_0x40c647[_0xa613('0xe')]),_0xa613('0x68'),{'uri':_0xfab453});})['catch'](function(_0xefe56c){logger[_0xa613('0x73')](_0xa613('0x6b'),JSON[_0xa613('0x21')](_0xefe56c));});};exports[_0xa613('0x74')]=function(_0x4e1453,_0xe7c21a,_0x3c8d60,_0x426b30,_0x278e6e,_0x4ea6d9){var _0x33026e,_0x1d326f,_0x2d5495,_0x4b715c;_0x4ea6d9[_0xa613('0x56')]=intUtil[_0xa613('0x55')](_0x4ea6d9['remoteUri']);_0x4ea6d9[_0xa613('0x57')]=intUtil[_0xa613('0x55')](_0x4ea6d9[_0xa613('0x57')]);def[_0xa613('0x58')]=util[_0xa613('0x23')]('%s/service/v4_1/rest.php',_0x4ea6d9[_0xa613('0x56')]);if(_0x278e6e&&_0x278e6e[_0xa613('0x75')]){logger['info']('['+_0xe7c21a[_0xa613('0x76')][_0xa613('0x77')]()+']','Recording\x20is\x20enabled!');_0xe7c21a['recordingURL']=util[_0xa613('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4ea6d9[_0xa613('0x57')],_0xe7c21a[_0xa613('0x5c')],md5(_0xe7c21a['uniqueid']));}else{_0xe7c21a['recordingURL']='';}return getConnection(_0x4ea6d9)['then'](function(_0x4dcf7d){_0x4b715c=_0x4dcf7d;if(!_['isNil'](_0x426b30)){return getUser(_0x4ea6d9,_0x426b30[_0xa613('0xe')],_0x4b715c);}else{return getUser(_0x4ea6d9,null,_0x4b715c);}})[_0xa613('0x35')](function(_0xcac2a2){_0x33026e=_0xcac2a2;logger[_0xa613('0xc')](_0xa613('0x5d'),_0x33026e['id']);return getEndUser(_0x4ea6d9,_0xe7c21a[_0xa613('0x78')],_0xe7c21a[_0xa613('0x5e')],_0x4b715c);})[_0xa613('0x35')](function(_0x2155bd){_0x1d326f=_0x2155bd;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1d326f['id']);return getTicket(_0x4ea6d9,_0x33026e,_0x1d326f,_0x3c8d60,_0xe7c21a,_0x3c8d60['Fields'],_0x4b715c,_0xa613('0x60'));})[_0xa613('0x35')](function(_0x4b2c97){_0x2d5495=_0x4b2c97;logger['info'](_0xa613('0x61'));logger[_0xa613('0xc')](_0xa613('0x62'),_0x2d5495['id']);return setRelationship(_0x4b715c,_0x33026e,_0x2d5495,_0xa613('0x63'));})[_0xa613('0x35')](function(){return setRelationship(_0x4b715c,_0x1d326f,_0x2d5495,_0xa613('0x64'));})[_0xa613('0x35')](function(){return getServerInfo(_0x4b715c);})[_0xa613('0x79')](function(_0x4c30bd){logger[_0xa613('0x73')]('['+_0xe7c21a[_0xa613('0x76')]['toUpperCase']()+']',JSON[_0xa613('0x21')](_0x4c30bd));});}; \ No newline at end of file +var _0x8d5e=['apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','then','Enduser\x20created.','[HTTP]','map','type','customField','nameField','toLowerCase','content','string','custom_fields','variable','customVariable','Variable','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','serverUrl','stripTrailingSlash','uri','%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','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','contacts','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','users','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','unmanaged','lastevent','toUpperCase','calleridnum','Inbound','lodash','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','created_by','description','Descriptions','slice','replace','duration_hours','duration_minutes','Contacts','parent_name','name','direction','length','forEach','variableName','push','idField','JSON','stringify'];(function(_0x325f1c,_0x78778e){var _0xdc7bf3=function(_0x4b794f){while(--_0x4b794f){_0x325f1c['push'](_0x325f1c['shift']());}};_0xdc7bf3(++_0x78778e);}(_0x8d5e,0x1bd));var _0xe8d5=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x8d5e[_0x122096];return _0x3d1966;};'use strict';var _=require(_0xe8d5('0x0'));var rp=require('request-promise');var BPromise=require(_0xe8d5('0x1'));var md5=require(_0xe8d5('0x2'));var util=require(_0xe8d5('0x3'));var Redis=require(_0xe8d5('0x4'));var intUtil=require('./util');var config=require(_0xe8d5('0x5'));var logger=require(_0xe8d5('0x6'))(_0xe8d5('0x7'));config[_0xe8d5('0x8')]=_[_0xe8d5('0x9')](config['redis'],{'host':_0xe8d5('0xa'),'port':0x18eb});var io=require(_0xe8d5('0xb'))(new Redis(config[_0xe8d5('0x8')]));var def={'method':_0xe8d5('0xc'),'json':!![]};function emit(_0x3f19e5,_0x1a089a,_0x523006){io['to'](_0x3f19e5)[_0xe8d5('0xd')](_0x1a089a,_0x523006);}function getTicket(_0x28d82f,_0xdd54af,_0x5b0d30,_0x4ac406,_0x1e2de1,_0x162b57,_0x2b9bcb,_0x485671){logger[_0xe8d5('0xe')](_0xe8d5('0xf'));var _0x77c4b5=new Date();var _0x82aa4=[{'name':'name','value':intUtil[_0xe8d5('0x10')](_0x4ac406['Subjects'],_0x1e2de1,'\x20')},{'name':'assigned_user_id','value':_0xdd54af['id']},{'name':_0xe8d5('0x11'),'value':_0xdd54af['id']},{'name':_0xe8d5('0x12'),'value':intUtil[_0xe8d5('0x10')](_0x4ac406[_0xe8d5('0x13')],_0x1e2de1,'\x0a')},{'name':'date_start','value':_0x77c4b5['toISOString']()[_0xe8d5('0x14')](0x0,0x13)[_0xe8d5('0x15')]('T','\x20')},{'name':_0xe8d5('0x16'),'value':'0'},{'name':_0xe8d5('0x17'),'value':'15'},{'name':'parent_id','value':_0x5b0d30['id']},{'name':'parent_type','value':_0xe8d5('0x18')},{'name':_0xe8d5('0x19'),'value':_0x5b0d30[_0xe8d5('0x1a')]},{'name':_0xe8d5('0x1b'),'value':_0x485671}];if(_0x162b57[_0xe8d5('0x1c')]){_[_0xe8d5('0x1d')](_0x162b57,function(_0x27d5d6){if(_0x1e2de1[_0x27d5d6[_0xe8d5('0x1e')]]){_0x82aa4[_0xe8d5('0x1f')]({'name':_0x27d5d6[_0xe8d5('0x20')],'value':_0x1e2de1[_0x27d5d6[_0xe8d5('0x1e')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xe8d5('0x21'),'response_type':_0xe8d5('0x21'),'rest_data':JSON[_0xe8d5('0x22')]({'session':_0x2b9bcb['id'],'module_name':'Calls','name_value_list':_0x82aa4})}});}function getAuth(_0x3d344a){return util['format']('Basic\x20%s',new Buffer(_0x3d344a[_0xe8d5('0x23')]+':X')[_0xe8d5('0x24')](_0xe8d5('0x25')));}function getServerInfo(_0x100912){return request({'form':{'method':_0xe8d5('0x26'),'input_type':_0xe8d5('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x100912['id']})}});}function getUser(_0x3dfbd2,_0xb3521b,_0x42d214){if(!_[_0xe8d5('0x27')](_0xb3521b)){logger[_0xe8d5('0xe')](_0xe8d5('0x28'),_0xb3521b);return request({'form':{'method':_0xe8d5('0x29'),'input_type':'JSON','response_type':_0xe8d5('0x21'),'rest_data':JSON[_0xe8d5('0x22')]({'session':_0x42d214['id'],'module_name':'Employees','query':util[_0xe8d5('0x2a')](_0xe8d5('0x2b'),_0xb3521b),'order_by':'','offset':'0','select_fields':['id',_0xe8d5('0x1a'),_0xe8d5('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2ae72b){if(_0x2ae72b[_0xe8d5('0x2d')]['length']){var _0xa8f7a1=_['find'](_0x2ae72b[_0xe8d5('0x2d')],function(_0x3ae3b7){return _0x3ae3b7[_0xe8d5('0x2e')][_0xe8d5('0x2c')][_0xe8d5('0x2f')]===_0xb3521b;});if(_0xa8f7a1){logger[_0xe8d5('0xe')](_0xe8d5('0x30'));return BPromise[_0xe8d5('0x31')]({'id':_0xa8f7a1[_0xe8d5('0x2e')]['id'][_0xe8d5('0x2f')],'name':_0xa8f7a1[_0xe8d5('0x2e')]['name'][_0xe8d5('0x2f')]});}}logger[_0xe8d5('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xe8d5('0x31')]({'id':_0x42d214[_0xe8d5('0x2e')][_0xe8d5('0x32')][_0xe8d5('0x2f')],'name':_0x42d214[_0xe8d5('0x2e')]['user_name'][_0xe8d5('0x2f')]});});}else{logger['info'](_0xe8d5('0x33'));return BPromise[_0xe8d5('0x31')]({'id':_0x42d214[_0xe8d5('0x2e')][_0xe8d5('0x32')][_0xe8d5('0x2f')],'name':_0x42d214[_0xe8d5('0x2e')][_0xe8d5('0x2c')][_0xe8d5('0x2f')]});}}function getEndUser(_0x521316,_0x50fab7,_0x42778b,_0x5432b6){logger[_0xe8d5('0xe')](_0xe8d5('0x34'),_0x42778b);return request({'form':{'method':_0xe8d5('0x29'),'input_type':_0xe8d5('0x21'),'response_type':'JSON','rest_data':JSON[_0xe8d5('0x22')]({'session':_0x5432b6['id'],'module_name':'Contacts','query':util[_0xe8d5('0x2a')](_0xe8d5('0x35'),_0x42778b),'order_by':'','offset':'0','select_fields':['id',_0xe8d5('0x1a'),_0xe8d5('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3218b6){if(_0x3218b6[_0xe8d5('0x2d')]['length']){var _0xf74bce=_[_0xe8d5('0x37')](_0x3218b6[_0xe8d5('0x2d')],function(_0x34343e){return _0x34343e[_0xe8d5('0x2e')][_0xe8d5('0x36')]['value']===_0x42778b;});if(_0xf74bce){logger[_0xe8d5('0xe')](_0xe8d5('0x38'));return BPromise[_0xe8d5('0x31')]({'id':_0xf74bce[_0xe8d5('0x2e')]['id'][_0xe8d5('0x2f')],'name':_0xf74bce['name_value_list'][_0xe8d5('0x1a')][_0xe8d5('0x2f')],'phone':_0xf74bce[_0xe8d5('0x2e')][_0xe8d5('0x36')][_0xe8d5('0x2f')]});}}else{logger[_0xe8d5('0xe')](_0xe8d5('0x39'));return request({'form':{'method':'set_entry','input_type':_0xe8d5('0x21'),'response_type':_0xe8d5('0x21'),'rest_data':JSON[_0xe8d5('0x22')]({'session':_0x5432b6['id'],'module_name':_0xe8d5('0x18'),'name_value_list':[{'name':_0xe8d5('0x3a'),'value':_0x50fab7!==_0xe8d5('0x3b')?_0x50fab7:util[_0xe8d5('0x2a')](_0xe8d5('0x3c'),_0x42778b)},{'name':_0xe8d5('0x36'),'value':_0x42778b}]})}})[_0xe8d5('0x3d')](function(_0x573da1){logger[_0xe8d5('0xe')](_0xe8d5('0x3e'));return BPromise[_0xe8d5('0x31')]({'id':_0x573da1['id'],'name':_0x573da1[_0xe8d5('0x2d')]['first_name']['value'],'phone':_0x573da1[_0xe8d5('0x2d')][_0xe8d5('0x36')][_0xe8d5('0x2f')]});});}});}function request(_0x48c382){logger['debug'](_0xe8d5('0x3f'),JSON['stringify'](_0x48c382));return rp(_['merge'](def,_0x48c382));}function getTags(_0x1c2e03,_0x2ec5e0){var _0x5b08ab=[];if(_0x1c2e03&&_0x1c2e03[_0xe8d5('0x1c')]>0x0){_0x5b08ab=_[_0xe8d5('0x40')](_0x1c2e03,_0x2ec5e0);}return _0x5b08ab;}function getCustomFields(_0x35e65f,_0x125740){var _0x26184d=[];var _0x4f5be4={'custom_fields':[]};if(_0x35e65f[_0xe8d5('0x1c')]>0x0){_['forEach'](_0x35e65f,function(_0xaf1995){if(_0xaf1995[_0xe8d5('0x41')]==='string'&&_0xaf1995['nameField']&&!_0xaf1995[_0xe8d5('0x42')]){_0x4f5be4[_0xaf1995[_0xe8d5('0x43')][_0xe8d5('0x44')]()]=_0xaf1995[_0xe8d5('0x45')][_0xe8d5('0x24')]();}else if(_0xaf1995[_0xe8d5('0x41')]===_0xe8d5('0x46')&&_0xaf1995[_0xe8d5('0x20')]&&_0xaf1995['customField']){_0x4f5be4[_0xe8d5('0x47')][_0xe8d5('0x1f')]({'id':_0xaf1995[_0xe8d5('0x20')],'value':_0xaf1995[_0xe8d5('0x45')]['toString']()});}else if(_0xaf1995[_0xe8d5('0x41')]===_0xe8d5('0x48')&&_0xaf1995[_0xe8d5('0x1e')]&&_0xaf1995[_0xe8d5('0x20')]&&_0xaf1995[_0xe8d5('0x42')]){_0x125740[_0xaf1995[_0xe8d5('0x1e')]]&&_0x4f5be4[_0xe8d5('0x47')]['push']({'id':_0xaf1995[_0xe8d5('0x20')],'value':_0x125740[_0xaf1995[_0xe8d5('0x1e')]][_0xe8d5('0x24')]()});}else if(_0xaf1995['type']===_0xe8d5('0x49')&&_0xaf1995[_0xe8d5('0x4a')]&&_0xaf1995[_0xe8d5('0x4a')][_0xe8d5('0x1a')]&&_0xaf1995['idField']&&_0xaf1995['customField']){_0x125740[_0xaf1995['Variable']['name'][_0xe8d5('0x44')]()]&&_0x4f5be4[_0xe8d5('0x47')][_0xe8d5('0x1f')]({'id':_0xaf1995[_0xe8d5('0x20')],'value':_0x125740[_0xaf1995[_0xe8d5('0x4a')][_0xe8d5('0x1a')]['toLowerCase']()]['toString']()});}});}return _0x4f5be4;}function getConnection(_0x1d415f){return request({'method':_0xe8d5('0xc'),'form':{'method':'login','input_type':_0xe8d5('0x21'),'response_type':_0xe8d5('0x21'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1d415f[_0xe8d5('0x4b')],'password':_0x1d415f[_0xe8d5('0x4c')],'encryption':_0xe8d5('0x4d')},'application':_0xe8d5('0x4e')})}})[_0xe8d5('0x3d')](function(_0x4f916d){var _0x349ad4=_0x4f916d;if(_0x349ad4['id']){def[_0xe8d5('0x4f')]=_0x349ad4['id'];return BPromise['resolve'](_0x349ad4);}else{throw new Error(util[_0xe8d5('0x2a')](_0xe8d5('0x50'),_0x1d415f['id']));}});}function setRelationship(_0x5ba253,_0xdd29e,_0x251f7c,_0x11904c){return request({'form':{'method':_0xe8d5('0x51'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xe8d5('0x22')]({'session':_0x5ba253['id'],'module_name':'Calls','module_id':_0x251f7c['id'],'link_field_name':_0x11904c,'related_ids':[_0xdd29e['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x162a61,_0x311185,_0x2b64f0,_0xfe2bc4,_0x9cdc55,_0x54890){var _0x4a05c0,_0x4148ae,_0x4e8a8c,_0x5c95ab;_0x54890[_0xe8d5('0x52')]=intUtil['stripTrailingSlash'](_0x54890[_0xe8d5('0x52')]);_0x54890[_0xe8d5('0x53')]=intUtil[_0xe8d5('0x54')](_0x54890[_0xe8d5('0x53')]);def[_0xe8d5('0x55')]=util[_0xe8d5('0x2a')](_0xe8d5('0x56'),_0x54890[_0xe8d5('0x52')]);if(_0x9cdc55&&_0x9cdc55[_0xe8d5('0x57')]){logger[_0xe8d5('0xe')](_0xe8d5('0x58'),_0xe8d5('0x59'));_0x311185[_0xe8d5('0x5a')]=util[_0xe8d5('0x2a')](_0xe8d5('0x5b'),_0x54890[_0xe8d5('0x53')],_0x311185['uniqueid'],md5(_0x311185[_0xe8d5('0x5c')]));}else{_0x311185['recordingURL']='';}return getConnection(_0x54890)[_0xe8d5('0x3d')](function(_0x358dfa){_0x5c95ab=_0x358dfa;return getUser(_0x54890,_0xfe2bc4[_0xe8d5('0x1a')],_0x5c95ab);})[_0xe8d5('0x3d')](function(_0x1bba7f){_0x4a05c0=_0x1bba7f;logger[_0xe8d5('0xe')](_0xe8d5('0x5d'),_0x4a05c0['id']);return getEndUser(_0x54890,_0x311185[_0xe8d5('0x5e')],_0x311185['calleridnum'],_0x5c95ab);})[_0xe8d5('0x3d')](function(_0x186833){_0x4148ae=_0x186833;logger[_0xe8d5('0xe')](_0xe8d5('0x5f'),_0x4148ae['id']);return getTicket(_0x54890,_0x4a05c0,_0x4148ae,_0x2b64f0,_0x311185,_0x2b64f0[_0xe8d5('0x60')],_0x5c95ab,'Inbound');})['then'](function(_0x24c862){_0x4e8a8c=_0x24c862;logger['info'](_0xe8d5('0x61'));logger[_0xe8d5('0xe')]('The\x20Ticket\x20ID\x20is:',_0x4e8a8c['id']);return setRelationship(_0x5c95ab,_0x4a05c0,_0x4e8a8c,'users');})[_0xe8d5('0x3d')](function(){return setRelationship(_0x5c95ab,_0x4148ae,_0x4e8a8c,_0xe8d5('0x62'));})[_0xe8d5('0x3d')](function(){return getServerInfo(_0x5c95ab);})[_0xe8d5('0x3d')](function(_0x202500){var _0x2e435b=parseInt(_0x202500['version'][_0xe8d5('0x63')](0x0));var _0x5c5df7=util[_0xe8d5('0x2a')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x54890[_0xe8d5('0x52')],_0x4e8a8c['id']);if(_0x2e435b>0x6){_0x5c5df7=util[_0xe8d5('0x2a')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x54890['remoteUri'],_0x4e8a8c['id']);}logger[_0xe8d5('0xe')](_0xe8d5('0x58'),_0xe8d5('0x64'));emit(util[_0xe8d5('0x2a')](_0xe8d5('0x65'),_0xfe2bc4['name']),_0xe8d5('0x66'),{'uri':_0x5c5df7});})[_0xe8d5('0x67')](function(_0x4d6162){logger[_0xe8d5('0x68')](_0xe8d5('0x58'),JSON[_0xe8d5('0x22')](_0x4d6162));});};exports['outbound']=function(_0x91c0ed,_0x28d350,_0x14fbf3,_0x13b595,_0xc48567,_0x8f46b5,_0x23ed45){var _0x57c0f0,_0x4a72b9,_0x5ef99c,_0xf7dbf9;_0x8f46b5[_0xe8d5('0x52')]=intUtil[_0xe8d5('0x54')](_0x8f46b5[_0xe8d5('0x52')]);_0x8f46b5['serverUrl']=intUtil[_0xe8d5('0x54')](_0x8f46b5[_0xe8d5('0x53')]);def[_0xe8d5('0x55')]=util[_0xe8d5('0x2a')](_0xe8d5('0x56'),_0x8f46b5[_0xe8d5('0x52')]);if(_0x23ed45&&_0x23ed45[_0xe8d5('0x69')]&&_0x23ed45[_0xe8d5('0x69')]!==_0xe8d5('0x6a')){logger['info'](_0xe8d5('0x6b'),_0xe8d5('0x59'));_0x28d350[_0xe8d5('0x5a')]=util[_0xe8d5('0x2a')](_0xe8d5('0x5b'),_0x8f46b5[_0xe8d5('0x53')],_0x28d350[_0xe8d5('0x5c')],md5(_0x28d350[_0xe8d5('0x5c')]));}return getConnection(_0x8f46b5)[_0xe8d5('0x3d')](function(_0x43cece){_0xf7dbf9=_0x43cece;return getUser(_0x8f46b5,_0x13b595[_0xe8d5('0x1a')],_0xf7dbf9);})[_0xe8d5('0x3d')](function(_0x3283c2){_0x57c0f0=_0x3283c2;logger[_0xe8d5('0xe')](_0xe8d5('0x5d'),_0x57c0f0['id']);return getEndUser(_0x8f46b5,_0x28d350[_0xe8d5('0x6c')],_0x28d350[_0xe8d5('0x6d')],_0xf7dbf9);})[_0xe8d5('0x3d')](function(_0x1085f8){_0x4a72b9=_0x1085f8;logger[_0xe8d5('0xe')](_0xe8d5('0x5f'),_0x4a72b9['id']);return getTicket(_0x8f46b5,_0x57c0f0,_0x4a72b9,_0x14fbf3,_0x28d350,_0x14fbf3['Fields'],_0xf7dbf9,_0xe8d5('0x6e'));})[_0xe8d5('0x3d')](function(_0x5365ac){_0x5ef99c=_0x5365ac;logger[_0xe8d5('0xe')](_0xe8d5('0x61'));logger[_0xe8d5('0xe')](_0xe8d5('0x6f'),_0x5ef99c['id']);return setRelationship(_0xf7dbf9,_0x57c0f0,_0x5ef99c,_0xe8d5('0x70'));})['then'](function(){return setRelationship(_0xf7dbf9,_0x4a72b9,_0x5ef99c,_0xe8d5('0x62'));})[_0xe8d5('0x3d')](function(){return getServerInfo(_0xf7dbf9);})[_0xe8d5('0x3d')](function(_0x3d5918){var _0x497c85=parseInt(_0x3d5918[_0xe8d5('0x71')][_0xe8d5('0x63')](0x0));var _0x3bed12=util[_0xe8d5('0x2a')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x8f46b5[_0xe8d5('0x52')],_0x5ef99c['id']);if(_0x497c85>0x6){_0x3bed12=util[_0xe8d5('0x2a')](_0xe8d5('0x72'),_0x8f46b5['remoteUri'],_0x5ef99c['id']);}logger[_0xe8d5('0xe')](_0xe8d5('0x6b'),_0xe8d5('0x64'));emit(util[_0xe8d5('0x2a')](_0xe8d5('0x65'),_0x13b595[_0xe8d5('0x1a')]),'trigger:browser:url',{'uri':_0x3bed12});})[_0xe8d5('0x67')](function(_0x3f3b5c){logger[_0xe8d5('0x68')](_0xe8d5('0x6b'),JSON[_0xe8d5('0x22')](_0x3f3b5c));});};exports[_0xe8d5('0x73')]=function(_0x2b4f6e,_0x225f84,_0x185773,_0x11ca65,_0x1f6e43,_0x2090bc){var _0x383060,_0x5df6f9,_0x12d14c,_0x38cbbd;_0x2090bc['remoteUri']=intUtil[_0xe8d5('0x54')](_0x2090bc[_0xe8d5('0x52')]);_0x2090bc[_0xe8d5('0x53')]=intUtil[_0xe8d5('0x54')](_0x2090bc[_0xe8d5('0x53')]);def[_0xe8d5('0x55')]=util[_0xe8d5('0x2a')](_0xe8d5('0x56'),_0x2090bc[_0xe8d5('0x52')]);if(_0x1f6e43&&_0x1f6e43[_0xe8d5('0x57')]){logger['info']('['+_0x225f84[_0xe8d5('0x74')][_0xe8d5('0x75')]()+']',_0xe8d5('0x59'));_0x225f84[_0xe8d5('0x5a')]=util[_0xe8d5('0x2a')](_0xe8d5('0x5b'),_0x2090bc['serverUrl'],_0x225f84[_0xe8d5('0x5c')],md5(_0x225f84['uniqueid']));}else{_0x225f84[_0xe8d5('0x5a')]='';}return getConnection(_0x2090bc)['then'](function(_0x2b986b){_0x38cbbd=_0x2b986b;if(!_['isNil'](_0x11ca65)){return getUser(_0x2090bc,_0x11ca65[_0xe8d5('0x1a')],_0x38cbbd);}else{return getUser(_0x2090bc,null,_0x38cbbd);}})[_0xe8d5('0x3d')](function(_0x5c8cc9){_0x383060=_0x5c8cc9;logger[_0xe8d5('0xe')]('The\x20User\x20ID\x20is:',_0x383060['id']);return getEndUser(_0x2090bc,_0x225f84['calleridname'],_0x225f84[_0xe8d5('0x76')],_0x38cbbd);})[_0xe8d5('0x3d')](function(_0x37f37f){_0x5df6f9=_0x37f37f;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5df6f9['id']);return getTicket(_0x2090bc,_0x383060,_0x5df6f9,_0x185773,_0x225f84,_0x185773['Fields'],_0x38cbbd,_0xe8d5('0x77'));})[_0xe8d5('0x3d')](function(_0x4646bd){_0x12d14c=_0x4646bd;logger['info'](_0xe8d5('0x61'));logger['info'](_0xe8d5('0x6f'),_0x12d14c['id']);return setRelationship(_0x38cbbd,_0x383060,_0x12d14c,_0xe8d5('0x70'));})[_0xe8d5('0x3d')](function(){return setRelationship(_0x38cbbd,_0x5df6f9,_0x12d14c,_0xe8d5('0x62'));})['then'](function(){return getServerInfo(_0x38cbbd);})['catch'](function(_0x2d731b){logger[_0xe8d5('0x68')]('['+_0x225f84['lastevent'][_0xe8d5('0x75')]()+']',JSON[_0xe8d5('0x22')](_0x2d731b));});}; \ 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 0a79b46..ed3a857 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 _0x5c02=['util','length','type','string','content','variable','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','format','%s:\x20%s','key','keyContent','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','test','lodash'];(function(_0x5d2331,_0x33970a){var _0x165126=function(_0x1e72da){while(--_0x1e72da){_0x5d2331['push'](_0x5d2331['shift']());}};_0x165126(++_0x33970a);}(_0x5c02,0xbc));var _0x25c0=function(_0x79d488,_0xbb0bb0){_0x79d488=_0x79d488-0x0;var _0x3cf3c9=_0x5c02[_0x79d488];return _0x3cf3c9;};'use strict';var _=require(_0x25c0('0x0'));var util=require(_0x25c0('0x1'));exports['getString']=function(_0x2f25ba,_0x1d888f,_0x23fd34){var _0xe38c3c=[];if(_0x2f25ba[_0x25c0('0x2')]>0x0){var _0x3bd57f=_['sortBy'](_0x2f25ba,['id']);for(var _0x236dd5=0x0;_0x236dd5<_0x3bd57f[_0x25c0('0x2')];_0x236dd5++){var _0x510504=_0x3bd57f[_0x236dd5];if(_0x510504[_0x25c0('0x3')]===_0x25c0('0x4')){_0xe38c3c['push'](_0x510504[_0x25c0('0x5')]);}else if(_0x510504['type']===_0x25c0('0x6')&&_0x510504[_0x25c0('0x7')]){_0x1d888f[_0x510504[_0x25c0('0x7')]]&&_0xe38c3c[_0x25c0('0x8')](_0x1d888f[_0x510504['variableName']][_0x25c0('0x9')]());}else if(_0x510504[_0x25c0('0x3')]===_0x25c0('0xa')&&_0x510504[_0x25c0('0xb')]&&_0x510504['Variable']['name']){_0x1d888f[_0x510504[_0x25c0('0xb')][_0x25c0('0xc')][_0x25c0('0xd')]()]&&_0xe38c3c[_0x25c0('0x8')](_0x1d888f[_0x510504[_0x25c0('0xb')][_0x25c0('0xc')][_0x25c0('0xd')]()][_0x25c0('0x9')]());}else if(_0x510504['type']===_0x25c0('0xe')){if(_0x510504[_0x25c0('0xf')]===_0x25c0('0x4')&&_0x510504['key']){_0xe38c3c[_0x25c0('0x8')](util[_0x25c0('0x10')](_0x25c0('0x11'),_0x510504[_0x25c0('0x12')],_0x510504[_0x25c0('0x13')]));}else if(_0x510504[_0x25c0('0xf')]===_0x25c0('0x6')&&_0x510504[_0x25c0('0x7')]&&_0x510504['key']){_0x1d888f[_0x510504[_0x25c0('0x7')]]&&_0xe38c3c[_0x25c0('0x8')](util[_0x25c0('0x10')](_0x25c0('0x11'),_0x510504['key'],_0x1d888f[_0x510504[_0x25c0('0x7')]]));}else if(_0x510504[_0x25c0('0xf')]===_0x25c0('0xa')&&_0x510504[_0x25c0('0xb')]&&_0x510504['Variable'][_0x25c0('0xc')]&&_0x510504['key']){_0x1d888f[_0x510504[_0x25c0('0xb')][_0x25c0('0xc')][_0x25c0('0xd')]()]&&_0xe38c3c[_0x25c0('0x8')](util[_0x25c0('0x10')](_0x25c0('0x11'),_0x510504[_0x25c0('0x12')],_0x1d888f[_0x510504[_0x25c0('0xb')][_0x25c0('0xc')]['toLowerCase']()]));}}}}return _0xe38c3c[_0x25c0('0x14')](_0x23fd34);};exports[_0x25c0('0x15')]=function(_0x514b02){var _0x53ab76=_0x514b02[_0x25c0('0x16')](-0x1);if(_0x53ab76==='/'){_0x514b02=_0x514b02[_0x25c0('0x17')](0x0,_0x514b02[_0x25c0('0x18')](_0x53ab76));}return _0x514b02;};exports[_0x25c0('0x19')]=function(_0x56982e){if(!_['isNil'](_0x56982e)&&_0x56982e!==''){var _0x26f670=/^(([^<>()\[\]\\.,;:\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 _0x26f670[_0x25c0('0x1a')](String(_0x56982e)[_0x25c0('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x8aeb=['push','content','variableName','toString','Variable','name','toLowerCase','keyValue','key','format','%s:\x20%s','keyType','customVariable','stripTrailingSlash','slice','lastIndexOf','isNil','lodash','util','getString','length','type','string'];(function(_0x309c73,_0x48077a){var _0x5b6d69=function(_0x28fc66){while(--_0x28fc66){_0x309c73['push'](_0x309c73['shift']());}};_0x5b6d69(++_0x48077a);}(_0x8aeb,0x6d));var _0xb8ae=function(_0x328bd3,_0x9cf5a5){_0x328bd3=_0x328bd3-0x0;var _0x458149=_0x8aeb[_0x328bd3];return _0x458149;};'use strict';var _=require(_0xb8ae('0x0'));var util=require(_0xb8ae('0x1'));exports[_0xb8ae('0x2')]=function(_0x2eac53,_0xead919,_0x47599b){var _0x403ce6=[];if(_0x2eac53[_0xb8ae('0x3')]>0x0){var _0x21ea3d=_['sortBy'](_0x2eac53,['id']);for(var _0x118919=0x0;_0x118919<_0x21ea3d[_0xb8ae('0x3')];_0x118919++){var _0x18a361=_0x21ea3d[_0x118919];if(_0x18a361[_0xb8ae('0x4')]===_0xb8ae('0x5')){_0x403ce6[_0xb8ae('0x6')](_0x18a361[_0xb8ae('0x7')]);}else if(_0x18a361[_0xb8ae('0x4')]==='variable'&&_0x18a361[_0xb8ae('0x8')]){_0xead919[_0x18a361[_0xb8ae('0x8')]]&&_0x403ce6[_0xb8ae('0x6')](_0xead919[_0x18a361[_0xb8ae('0x8')]][_0xb8ae('0x9')]());}else if(_0x18a361[_0xb8ae('0x4')]==='customVariable'&&_0x18a361[_0xb8ae('0xa')]&&_0x18a361[_0xb8ae('0xa')][_0xb8ae('0xb')]){_0xead919[_0x18a361[_0xb8ae('0xa')][_0xb8ae('0xb')][_0xb8ae('0xc')]()]&&_0x403ce6[_0xb8ae('0x6')](_0xead919[_0x18a361[_0xb8ae('0xa')][_0xb8ae('0xb')][_0xb8ae('0xc')]()][_0xb8ae('0x9')]());}else if(_0x18a361[_0xb8ae('0x4')]===_0xb8ae('0xd')){if(_0x18a361['keyType']===_0xb8ae('0x5')&&_0x18a361[_0xb8ae('0xe')]){_0x403ce6[_0xb8ae('0x6')](util[_0xb8ae('0xf')](_0xb8ae('0x10'),_0x18a361[_0xb8ae('0xe')],_0x18a361['keyContent']));}else if(_0x18a361['keyType']==='variable'&&_0x18a361[_0xb8ae('0x8')]&&_0x18a361[_0xb8ae('0xe')]){_0xead919[_0x18a361[_0xb8ae('0x8')]]&&_0x403ce6[_0xb8ae('0x6')](util[_0xb8ae('0xf')]('%s:\x20%s',_0x18a361[_0xb8ae('0xe')],_0xead919[_0x18a361[_0xb8ae('0x8')]]));}else if(_0x18a361[_0xb8ae('0x11')]===_0xb8ae('0x12')&&_0x18a361[_0xb8ae('0xa')]&&_0x18a361[_0xb8ae('0xa')]['name']&&_0x18a361[_0xb8ae('0xe')]){_0xead919[_0x18a361['Variable'][_0xb8ae('0xb')][_0xb8ae('0xc')]()]&&_0x403ce6[_0xb8ae('0x6')](util[_0xb8ae('0xf')]('%s:\x20%s',_0x18a361[_0xb8ae('0xe')],_0xead919[_0x18a361[_0xb8ae('0xa')][_0xb8ae('0xb')][_0xb8ae('0xc')]()]));}}}}return _0x403ce6['join'](_0x47599b);};exports[_0xb8ae('0x13')]=function(_0x267692){var _0x3f9b91=_0x267692[_0xb8ae('0x14')](-0x1);if(_0x3f9b91==='/'){_0x267692=_0x267692['substring'](0x0,_0x267692[_0xb8ae('0x15')](_0x3f9b91));}return _0x267692;};exports['validateEmail']=function(_0x170379){if(!_[_0xb8ae('0x16')](_0x170379)&&_0x170379!==''){var _0x3aceae=/^(([^<>()\[\]\\.,;:\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 _0x3aceae['test'](String(_0x170379)[_0xb8ae('0xc')]());}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 35d3ca0..1ec89fc 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(_0x1bc40c,_0x36041c){var _0x2ab19e=function(_0x3f7550){while(--_0x3f7550){_0x1bc40c['push'](_0x1bc40c['shift']());}};_0x2ab19e(++_0x36041c);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'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 _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x46e523,_0xe6fccb){var _0x5da0ee=function(_0x396682){while(--_0x396682){_0x46e523['push'](_0x46e523['shift']());}};_0x5da0ee(++_0xe6fccb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('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;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ 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 ebc9987..719e6b1 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 _0x9ee5=['Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','filter','end-user','length','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','token','%s/token:%s','username','toString','base64','debug','[HTTP]','GET','map','forEach','includes','string','picklist','nameField','toLowerCase','idField','customField','custom_fields','push','content','type','variable','variableName','customVariable','Variable','name','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','catch','inspect','outbound','serverUrl','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridname','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','user:%s','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridname','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','getString','Subjects','Descriptions','Fields','then','info','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json'];(function(_0x46f5d8,_0x43f6d6){var _0x43acbe=function(_0xadd8d8){while(--_0xadd8d8){_0x46f5d8['push'](_0x46f5d8['shift']());}};_0x43acbe(++_0x43f6d6);}(_0x9ee5,0x19e));var _0x59ee=function(_0xb21fa3,_0x4ce1bc){_0xb21fa3=_0xb21fa3-0x0;var _0x4c66fe=_0x9ee5[_0xb21fa3];return _0x4c66fe;};'use strict';var _=require(_0x59ee('0x0'));var rp=require(_0x59ee('0x1'));var md5=require(_0x59ee('0x2'));var util=require(_0x59ee('0x3'));var Redis=require(_0x59ee('0x4'));var intUtil=require(_0x59ee('0x5'));var config=require(_0x59ee('0x6'));var logger=require(_0x59ee('0x7'))(_0x59ee('0x8'));config[_0x59ee('0x9')]=_[_0x59ee('0xa')](config[_0x59ee('0x9')],{'host':_0x59ee('0xb'),'port':0x18eb});var io=require(_0x59ee('0xc'))(new Redis(config[_0x59ee('0x9')]));function emit(_0x3fee6c,_0x2fc193,_0x3891b2){io['to'](_0x3fee6c)[_0x59ee('0xd')](_0x2fc193,_0x3891b2);}var headers={'Content-Type':_0x59ee('0xe'),'Accept':_0x59ee('0xe')};function getTicket(_0x2e9784,_0x347cde,_0x3ab293,_0x3c0e9d,_0x3cabfb){logger['info'](_0x59ee('0xf'));return request({'uri':util[_0x59ee('0x10')](_0x59ee('0x11'),_0x2e9784[_0x59ee('0x12')]),'method':_0x59ee('0x13'),'body':{'ticket':_['merge']({'requester_id':_0x3ab293['id'],'submitter_id':_0x347cde?_0x347cde['id']:undefined,'assignee_id':_0x347cde?_0x347cde['id']:undefined,'tags':getTags(_0x3c0e9d['Tags'],'name'),'subject':intUtil[_0x59ee('0x14')](_0x3c0e9d[_0x59ee('0x15')],_0x3cabfb,'\x20'),'description':intUtil[_0x59ee('0x14')](_0x3c0e9d[_0x59ee('0x16')],_0x3cabfb,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x3c0e9d[_0x59ee('0x16')],_0x3cabfb,'\x0a')}},getCustomFields(_0x3c0e9d[_0x59ee('0x17')],_0x3cabfb))}})[_0x59ee('0x18')](function(_0x1c96dd){logger[_0x59ee('0x19')]('Ticket\x20created!');return _0x1c96dd[_0x59ee('0x1a')];});}function getUser(_0x4e2742,_0x1de2cb){if(intUtil[_0x59ee('0x1b')](_0x1de2cb)){logger['info'](_0x59ee('0x1c'),_0x1de2cb);return request({'uri':util[_0x59ee('0x10')](_0x59ee('0x1d'),_0x4e2742[_0x59ee('0x12')]),'qs':{'query':util[_0x59ee('0x10')](_0x59ee('0x1e'),_0x1de2cb)}})[_0x59ee('0x18')](function(_0x40dbcf){if(_0x40dbcf[_0x59ee('0x1f')]){logger[_0x59ee('0x19')](_0x59ee('0x20'));return _[_0x59ee('0x21')](_0x40dbcf[_0x59ee('0x22')],{'email':_0x1de2cb,'role':_0x59ee('0x23')});}else{logger[_0x59ee('0x19')](_0x59ee('0x24'));return request({'uri':util['format'](_0x59ee('0x25'),_0x4e2742[_0x59ee('0x12')])})['then'](function(_0x3d25c0){logger['info'](_0x59ee('0x26'));return _0x3d25c0[_0x59ee('0x27')];});}});}else{logger[_0x59ee('0x19')](_0x59ee('0x24'));return request({'uri':util[_0x59ee('0x10')](_0x59ee('0x25'),_0x4e2742['remoteUri'])})['then'](function(_0x5ed5f2){logger['info'](_0x59ee('0x26'));return _0x5ed5f2[_0x59ee('0x27')];});}}function getEndUser(_0x4d4638,_0x1b6037,_0x9f9e54){logger[_0x59ee('0x19')](_0x59ee('0x28'),_0x9f9e54);return request({'uri':util['format'](_0x59ee('0x1d'),_0x4d4638[_0x59ee('0x12')]),'qs':{'query':util[_0x59ee('0x10')]('type:user\x20role:end-user\x20phone:%s',_0x9f9e54)}})[_0x59ee('0x18')](function(_0x49cc9b){var _0x4f5edf;if(_0x49cc9b[_0x59ee('0x22')]['length']){_0x49cc9b[_0x59ee('0x22')]=_[_0x59ee('0x29')](_0x49cc9b[_0x59ee('0x22')],{'suspended':![],'role':_0x59ee('0x2a')});if(_0x49cc9b[_0x59ee('0x22')][_0x59ee('0x2b')]){_0x4f5edf=_['first'](_0x49cc9b[_0x59ee('0x22')]);}}if(_0x4f5edf){logger[_0x59ee('0x19')]('Enduser\x20found!');return _0x4f5edf;}else{logger[_0x59ee('0x19')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x59ee('0x10')](_0x59ee('0x2c'),_0x4d4638[_0x59ee('0x12')]),'method':'POST','body':{'user':{'role':_0x59ee('0x2a'),'name':util['format'](_0x59ee('0x2d'),_0x1b6037||_0x9f9e54),'phone':_0x9f9e54}}})[_0x59ee('0x18')](function(_0x4572cc){logger['info'](_0x59ee('0x2e'));return _0x4572cc[_0x59ee('0x27')];});}});}function getAuth(_0x2b0b40){var _0x511239;if(_0x2b0b40[_0x59ee('0x2f')]===_0x59ee('0x30')){_0x511239=util[_0x59ee('0x10')]('%s:%s',_0x2b0b40['username'],_0x2b0b40['password']);}else if(_0x2b0b40[_0x59ee('0x2f')]===_0x59ee('0x31')){_0x511239=util[_0x59ee('0x10')](_0x59ee('0x32'),_0x2b0b40[_0x59ee('0x33')],_0x2b0b40['token']);}return util['format']('Basic\x20%s',new Buffer(_0x511239)[_0x59ee('0x34')](_0x59ee('0x35')));}function request(_0x3beffa){logger[_0x59ee('0x36')](_0x59ee('0x37'),JSON['stringify'](_0x3beffa));return rp(_[_0x59ee('0xa')](_0x3beffa,{'method':_0x59ee('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x3b3175,_0x2d7817){var _0x284ade=[];if(_0x3b3175&&_0x3b3175[_0x59ee('0x2b')]>0x0){_0x284ade=_[_0x59ee('0x39')](_0x3b3175,_0x2d7817);}return _0x284ade;}function getCustomFields(_0x5dcf72,_0x253eb9){var _0x43225a=[];var _0x36e52e={'custom_fields':[]};if(_0x5dcf72[_0x59ee('0x2b')]>0x0){_[_0x59ee('0x3a')](_0x5dcf72,function(_0x3867cd){if(_[_0x59ee('0x3b')]([_0x59ee('0x3c'),_0x59ee('0x3d')],_0x3867cd['type'])&&_0x3867cd[_0x59ee('0x3e')]&&!_0x3867cd['customField']){_0x36e52e[_0x3867cd[_0x59ee('0x3e')][_0x59ee('0x3f')]()]=_0x3867cd['content'][_0x59ee('0x34')]();}else if(_[_0x59ee('0x3b')](['string',_0x59ee('0x3d')],_0x3867cd['type'])&&_0x3867cd[_0x59ee('0x40')]&&_0x3867cd[_0x59ee('0x41')]){_0x36e52e[_0x59ee('0x42')][_0x59ee('0x43')]({'id':_0x3867cd[_0x59ee('0x40')],'value':_0x3867cd[_0x59ee('0x44')]['toString']()});}else if(_0x3867cd[_0x59ee('0x45')]===_0x59ee('0x46')&&_0x3867cd[_0x59ee('0x47')]&&_0x3867cd[_0x59ee('0x40')]&&_0x3867cd[_0x59ee('0x41')]){_0x253eb9[_0x3867cd[_0x59ee('0x47')]]&&_0x36e52e['custom_fields'][_0x59ee('0x43')]({'id':_0x3867cd[_0x59ee('0x40')],'value':_0x253eb9[_0x3867cd[_0x59ee('0x47')]][_0x59ee('0x34')]()});}else if(_0x3867cd[_0x59ee('0x45')]===_0x59ee('0x48')&&_0x3867cd[_0x59ee('0x49')]&&_0x3867cd['Variable'][_0x59ee('0x4a')]&&_0x3867cd[_0x59ee('0x40')]&&_0x3867cd[_0x59ee('0x41')]){_0x253eb9[_0x3867cd[_0x59ee('0x49')][_0x59ee('0x4a')][_0x59ee('0x3f')]()]&&_0x36e52e[_0x59ee('0x42')]['push']({'id':_0x3867cd['idField'],'value':_0x253eb9[_0x3867cd[_0x59ee('0x49')][_0x59ee('0x4a')][_0x59ee('0x3f')]()][_0x59ee('0x34')]()});}});}return _0x36e52e;}exports['queue']=function(_0x18fc9b,_0x101f28,_0x4ae370,_0x17ff41,_0x3da625,_0x374a71){var _0x34c9a3,_0x489fd0;_0x374a71[_0x59ee('0x12')]=intUtil['stripTrailingSlash'](_0x374a71[_0x59ee('0x12')]);_0x374a71['serverUrl']=intUtil[_0x59ee('0x4b')](_0x374a71['serverUrl']);if(_0x3da625&&_0x3da625[_0x59ee('0x4c')]){logger[_0x59ee('0x19')](_0x59ee('0x4d'),_0x59ee('0x4e'));_0x101f28[_0x59ee('0x4f')]=util[_0x59ee('0x10')](_0x59ee('0x50'),_0x374a71['serverUrl'],_0x101f28[_0x59ee('0x51')],md5(_0x101f28['uniqueid']));}else{_0x101f28[_0x59ee('0x4f')]='';}headers[_0x59ee('0x52')]=getAuth(_0x374a71);return getUser(_0x374a71,_0x17ff41[_0x59ee('0x53')])[_0x59ee('0x18')](function(_0x577b55){_0x34c9a3=_0x577b55;logger['info']('The\x20User\x20ID\x20is:',_0x34c9a3['id']);return getEndUser(_0x374a71,_0x101f28['calleridname'],_0x101f28[_0x59ee('0x54')]);})[_0x59ee('0x18')](function(_0x503597){_0x489fd0=_0x503597;logger[_0x59ee('0x19')](_0x59ee('0x55'),_0x489fd0['id']);return getTicket(_0x374a71,_0x34c9a3,_0x489fd0,_0x4ae370,_0x101f28);})[_0x59ee('0x18')](function(_0x29403f){if(_0x29403f){logger[_0x59ee('0x19')](_0x59ee('0x56'),_0x29403f['id']);switch(_0x374a71[_0x59ee('0x45')]){case _0x59ee('0x57'):logger[_0x59ee('0x19')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x59ee('0x10')](_0x59ee('0x58'),_0x374a71[_0x59ee('0x12')],_0x34c9a3['id'],_0x29403f['id']),'method':'POST'});case _0x59ee('0x59'):logger[_0x59ee('0x19')]('[QUEUE]',_0x59ee('0x5a'));emit(util[_0x59ee('0x10')]('user:%s',_0x17ff41[_0x59ee('0x4a')]),_0x59ee('0x5b'),{'uri':util[_0x59ee('0x10')](_0x59ee('0x5c'),_0x374a71[_0x59ee('0x12')]['replace'](_0x59ee('0x5d'),''),_0x29403f['id'])});break;default:logger[_0x59ee('0x5e')](_0x59ee('0x4d'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x59ee('0x5f')](function(_0x22b9e7){logger[_0x59ee('0x5e')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x59ee('0x60')](_0x22b9e7,{'showHidden':!![],'depth':null}));});};exports[_0x59ee('0x61')]=function(_0x2ef8f7,_0x3b4868,_0x54ef31,_0x4e4b77,_0x2bd9be,_0x2d4de5,_0x2dafb3){var _0x1a0206,_0x11e011;_0x2d4de5[_0x59ee('0x12')]=intUtil['stripTrailingSlash'](_0x2d4de5[_0x59ee('0x12')]);_0x2d4de5[_0x59ee('0x62')]=intUtil[_0x59ee('0x4b')](_0x2d4de5[_0x59ee('0x62')]);if(_0x2dafb3&&_0x2dafb3[_0x59ee('0x63')]&&_0x2dafb3[_0x59ee('0x63')]!==_0x59ee('0x64')){logger[_0x59ee('0x19')]('[OUTBOUND]',_0x59ee('0x4e'));_0x3b4868[_0x59ee('0x4f')]=util[_0x59ee('0x10')](_0x59ee('0x50'),_0x2d4de5[_0x59ee('0x62')],_0x3b4868['uniqueid'],md5(_0x3b4868[_0x59ee('0x51')]));}headers[_0x59ee('0x52')]=getAuth(_0x2d4de5);return getUser(_0x2d4de5,_0x4e4b77['email'])['then'](function(_0xfdc6d8){_0x1a0206=_0xfdc6d8;logger['info'](_0x59ee('0x65'),_0x1a0206['id']);return getEndUser(_0x2d4de5,_0x3b4868[_0x59ee('0x66')],_0x3b4868['destcalleridnum']);})[_0x59ee('0x18')](function(_0x1a9909){_0x11e011=_0x1a9909;logger[_0x59ee('0x19')](_0x59ee('0x55'),_0x11e011['id']);return getTicket(_0x2d4de5,_0x1a0206,_0x11e011,_0x54ef31,_0x3b4868);})[_0x59ee('0x18')](function(_0x30b9dc){if(_0x30b9dc){logger[_0x59ee('0x19')]('The\x20Ticket\x20ID\x20is:',_0x30b9dc['id']);switch(_0x2d4de5[_0x59ee('0x45')]){case _0x59ee('0x57'):logger[_0x59ee('0x19')](_0x59ee('0x67'),_0x59ee('0x68'));return request({'uri':util[_0x59ee('0x10')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2d4de5[_0x59ee('0x12')],_0x1a0206['id'],_0x30b9dc['id']),'method':_0x59ee('0x13')});case'newTab':logger[_0x59ee('0x19')](_0x59ee('0x67'),_0x59ee('0x5a'));emit(util[_0x59ee('0x10')](_0x59ee('0x69'),_0x4e4b77[_0x59ee('0x4a')]),_0x59ee('0x5b'),{'uri':util[_0x59ee('0x10')](_0x59ee('0x5c'),_0x2d4de5[_0x59ee('0x12')]['replace'](_0x59ee('0x5d'),''),_0x30b9dc['id'])});break;default:logger[_0x59ee('0x5e')](_0x59ee('0x67'),_0x59ee('0x6a'));}}})[_0x59ee('0x5f')](function(_0x518f33){logger[_0x59ee('0x5e')](_0x59ee('0x6b'),util[_0x59ee('0x60')](_0x518f33,{'showHidden':!![],'depth':null}));});};exports[_0x59ee('0x6c')]=function(_0x29ce63,_0x3707cb,_0x53b514,_0x2dcbdd,_0x3d7b2f,_0x4ff286){var _0x4dcd22,_0x272b23;_0x4ff286['remoteUri']=intUtil[_0x59ee('0x4b')](_0x4ff286[_0x59ee('0x12')]);_0x4ff286[_0x59ee('0x62')]=intUtil['stripTrailingSlash'](_0x4ff286[_0x59ee('0x62')]);if(_0x3d7b2f&&_0x3d7b2f['monitor_format']){logger['info']('['+_0x3707cb[_0x59ee('0x6d')][_0x59ee('0x6e')]()+']',_0x59ee('0x4e'));_0x3707cb[_0x59ee('0x4f')]=util['format'](_0x59ee('0x50'),_0x4ff286[_0x59ee('0x62')],_0x3707cb[_0x59ee('0x51')],md5(_0x3707cb[_0x59ee('0x51')]));}else{_0x3707cb['recordingURL']='';}headers['Authorization']=getAuth(_0x4ff286);return getUser(_0x4ff286)[_0x59ee('0x18')](function(_0x20f560){_0x4dcd22=_0x20f560;logger['info'](_0x59ee('0x65'),_0x4dcd22['id']);return getEndUser(_0x4ff286,_0x3707cb[_0x59ee('0x6f')],_0x3707cb[_0x59ee('0x54')]);})[_0x59ee('0x18')](function(_0x531b7c){_0x272b23=_0x531b7c;logger[_0x59ee('0x19')](_0x59ee('0x55'),_0x272b23['id']);return getTicket(_0x4ff286,_0x4dcd22,_0x272b23,_0x53b514,_0x3707cb);})[_0x59ee('0x18')](function(_0x3f78f5){if(_0x3f78f5){logger[_0x59ee('0x19')](_0x59ee('0x56'),_0x3f78f5['id']);}})['catch'](function(_0x49d3c5){logger[_0x59ee('0x5e')]('['+_0x3707cb[_0x59ee('0x6d')]['toUpperCase']()+']'+_0x59ee('0x70'),util['inspect'](_0x49d3c5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x058d=['variableName','Variable','name','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','ioredis','./util','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','merge','Tags','Subjects','Descriptions','getString','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','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','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','remoteUri','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','token','Basic\x20%s','toString','base64','GET','map','forEach','string','picklist','type','customField','nameField','toLowerCase','content','idField','custom_fields','push','variable'];(function(_0x318256,_0xa773f3){var _0xb1e352=function(_0x4bb14e){while(--_0x4bb14e){_0x318256['push'](_0x318256['shift']());}};_0xb1e352(++_0xa773f3);}(_0x058d,0x10b));var _0xd058=function(_0x21fb6a,_0x44c809){_0x21fb6a=_0x21fb6a-0x0;var _0x4cac4b=_0x058d[_0x21fb6a];return _0x4cac4b;};'use strict';var _=require(_0xd058('0x0'));var rp=require(_0xd058('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xd058('0x2'));var intUtil=require(_0xd058('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xd058('0x4'));config[_0xd058('0x5')]=_[_0xd058('0x6')](config[_0xd058('0x5')],{'host':_0xd058('0x7'),'port':0x18eb});var io=require(_0xd058('0x8'))(new Redis(config[_0xd058('0x5')]));function emit(_0x4911f6,_0x1fb16d,_0x163730){io['to'](_0x4911f6)[_0xd058('0x9')](_0x1fb16d,_0x163730);}var headers={'Content-Type':_0xd058('0xa'),'Accept':_0xd058('0xa')};function getTicket(_0x599cdb,_0x492f7f,_0x53a006,_0x33f914,_0x572411){logger[_0xd058('0xb')](_0xd058('0xc'));return request({'uri':util[_0xd058('0xd')](_0xd058('0xe'),_0x599cdb['remoteUri']),'method':'POST','body':{'ticket':_[_0xd058('0xf')]({'requester_id':_0x53a006['id'],'submitter_id':_0x492f7f?_0x492f7f['id']:undefined,'assignee_id':_0x492f7f?_0x492f7f['id']:undefined,'tags':getTags(_0x33f914[_0xd058('0x10')],'name'),'subject':intUtil['getString'](_0x33f914[_0xd058('0x11')],_0x572411,'\x20'),'description':intUtil['getString'](_0x33f914[_0xd058('0x12')],_0x572411,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd058('0x13')](_0x33f914[_0xd058('0x12')],_0x572411,'\x0a')}},getCustomFields(_0x33f914[_0xd058('0x14')],_0x572411))}})[_0xd058('0x15')](function(_0x3c2758){logger[_0xd058('0xb')](_0xd058('0x16'));return _0x3c2758['ticket'];});}function getUser(_0x419a17,_0x11fe59){if(intUtil[_0xd058('0x17')](_0x11fe59)){logger[_0xd058('0xb')](_0xd058('0x18'),_0x11fe59);return request({'uri':util[_0xd058('0xd')](_0xd058('0x19'),_0x419a17['remoteUri']),'qs':{'query':util[_0xd058('0xd')]('type:user\x20role:agent\x20email:%s',_0x11fe59)}})[_0xd058('0x15')](function(_0x1f9c9f){if(_0x1f9c9f[_0xd058('0x1a')]){logger[_0xd058('0xb')](_0xd058('0x1b'));return _[_0xd058('0x1c')](_0x1f9c9f[_0xd058('0x1d')],{'email':_0x11fe59,'role':_0xd058('0x1e')});}else{logger['info'](_0xd058('0x1f'));return request({'uri':util['format'](_0xd058('0x20'),_0x419a17['remoteUri'])})[_0xd058('0x15')](function(_0x571f58){logger[_0xd058('0xb')]('Admin\x20account\x20selected.');return _0x571f58['user'];});}});}else{logger[_0xd058('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xd058('0xd')]('%s/users/me.json',_0x419a17['remoteUri'])})[_0xd058('0x15')](function(_0x461405){logger['info'](_0xd058('0x21'));return _0x461405[_0xd058('0x22')];});}}function getEndUser(_0xef1702,_0x372c1e,_0x1485f1){logger[_0xd058('0xb')](_0xd058('0x23'),_0x1485f1);return request({'uri':util[_0xd058('0xd')](_0xd058('0x19'),_0xef1702['remoteUri']),'qs':{'query':util[_0xd058('0xd')](_0xd058('0x24'),_0x1485f1)}})[_0xd058('0x15')](function(_0x4708e2){var _0x170c8a;if(_0x4708e2[_0xd058('0x1d')][_0xd058('0x25')]){_0x4708e2[_0xd058('0x1d')]=_[_0xd058('0x26')](_0x4708e2['results'],{'suspended':![],'role':_0xd058('0x27')});if(_0x4708e2[_0xd058('0x1d')]['length']){_0x170c8a=_['first'](_0x4708e2[_0xd058('0x1d')]);}}if(_0x170c8a){logger[_0xd058('0xb')](_0xd058('0x28'));return _0x170c8a;}else{logger['info'](_0xd058('0x29'));return request({'uri':util['format'](_0xd058('0x2a'),_0xef1702[_0xd058('0x2b')]),'method':'POST','body':{'user':{'role':_0xd058('0x27'),'name':util[_0xd058('0xd')](_0xd058('0x2c'),_0x372c1e||_0x1485f1),'phone':_0x1485f1}}})['then'](function(_0x1cb585){logger[_0xd058('0xb')](_0xd058('0x2d'));return _0x1cb585[_0xd058('0x22')];});}});}function getAuth(_0x11e44b){var _0x51e8bc;if(_0x11e44b[_0xd058('0x2e')]===_0xd058('0x2f')){_0x51e8bc=util[_0xd058('0xd')](_0xd058('0x30'),_0x11e44b[_0xd058('0x31')],_0x11e44b['password']);}else if(_0x11e44b[_0xd058('0x2e')]==='token'){_0x51e8bc=util[_0xd058('0xd')](_0xd058('0x32'),_0x11e44b[_0xd058('0x31')],_0x11e44b[_0xd058('0x33')]);}return util[_0xd058('0xd')](_0xd058('0x34'),new Buffer(_0x51e8bc)[_0xd058('0x35')](_0xd058('0x36')));}function request(_0x1b8b15){logger['debug']('[HTTP]',JSON['stringify'](_0x1b8b15));return rp(_[_0xd058('0x6')](_0x1b8b15,{'method':_0xd058('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x1fa1f9,_0x386d6b){var _0x277358=[];if(_0x1fa1f9&&_0x1fa1f9[_0xd058('0x25')]>0x0){_0x277358=_[_0xd058('0x38')](_0x1fa1f9,_0x386d6b);}return _0x277358;}function getCustomFields(_0x43cd34,_0x2443c8){var _0x256177=[];var _0x352d95={'custom_fields':[]};if(_0x43cd34[_0xd058('0x25')]>0x0){_[_0xd058('0x39')](_0x43cd34,function(_0x924532){if(_['includes']([_0xd058('0x3a'),_0xd058('0x3b')],_0x924532[_0xd058('0x3c')])&&_0x924532['nameField']&&!_0x924532[_0xd058('0x3d')]){_0x352d95[_0x924532[_0xd058('0x3e')][_0xd058('0x3f')]()]=_0x924532[_0xd058('0x40')]['toString']();}else if(_['includes']([_0xd058('0x3a'),'picklist'],_0x924532[_0xd058('0x3c')])&&_0x924532[_0xd058('0x41')]&&_0x924532[_0xd058('0x3d')]){_0x352d95[_0xd058('0x42')][_0xd058('0x43')]({'id':_0x924532[_0xd058('0x41')],'value':_0x924532[_0xd058('0x40')]['toString']()});}else if(_0x924532[_0xd058('0x3c')]===_0xd058('0x44')&&_0x924532['variableName']&&_0x924532[_0xd058('0x41')]&&_0x924532[_0xd058('0x3d')]){_0x2443c8[_0x924532['variableName']]&&_0x352d95[_0xd058('0x42')][_0xd058('0x43')]({'id':_0x924532['idField'],'value':_0x2443c8[_0x924532[_0xd058('0x45')]][_0xd058('0x35')]()});}else if(_0x924532[_0xd058('0x3c')]==='customVariable'&&_0x924532[_0xd058('0x46')]&&_0x924532[_0xd058('0x46')]['name']&&_0x924532[_0xd058('0x41')]&&_0x924532[_0xd058('0x3d')]){_0x2443c8[_0x924532[_0xd058('0x46')]['name'][_0xd058('0x3f')]()]&&_0x352d95[_0xd058('0x42')][_0xd058('0x43')]({'id':_0x924532[_0xd058('0x41')],'value':_0x2443c8[_0x924532[_0xd058('0x46')][_0xd058('0x47')][_0xd058('0x3f')]()][_0xd058('0x35')]()});}});}return _0x352d95;}exports['queue']=function(_0x4763a7,_0x11f201,_0x1521a2,_0x4a25f2,_0x290274,_0x585388){var _0x46f644,_0x27fc41;_0x585388[_0xd058('0x2b')]=intUtil['stripTrailingSlash'](_0x585388[_0xd058('0x2b')]);_0x585388['serverUrl']=intUtil[_0xd058('0x48')](_0x585388[_0xd058('0x49')]);if(_0x290274&&_0x290274[_0xd058('0x4a')]){logger['info']('[QUEUE]',_0xd058('0x4b'));_0x11f201[_0xd058('0x4c')]=util[_0xd058('0xd')](_0xd058('0x4d'),_0x585388[_0xd058('0x49')],_0x11f201['uniqueid'],md5(_0x11f201[_0xd058('0x4e')]));}else{_0x11f201['recordingURL']='';}headers[_0xd058('0x4f')]=getAuth(_0x585388);return getUser(_0x585388,_0x4a25f2[_0xd058('0x50')])[_0xd058('0x15')](function(_0x53c888){_0x46f644=_0x53c888;logger[_0xd058('0xb')](_0xd058('0x51'),_0x46f644['id']);return getEndUser(_0x585388,_0x11f201[_0xd058('0x52')],_0x11f201[_0xd058('0x53')]);})[_0xd058('0x15')](function(_0x2fd323){_0x27fc41=_0x2fd323;logger['info'](_0xd058('0x54'),_0x27fc41['id']);return getTicket(_0x585388,_0x46f644,_0x27fc41,_0x1521a2,_0x11f201);})['then'](function(_0x30ecf8){if(_0x30ecf8){logger[_0xd058('0xb')](_0xd058('0x55'),_0x30ecf8['id']);switch(_0x585388[_0xd058('0x3c')]){case _0xd058('0x56'):logger['info'](_0xd058('0x57'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0xd058('0x58'),_0x585388[_0xd058('0x2b')],_0x46f644['id'],_0x30ecf8['id']),'method':_0xd058('0x59')});case _0xd058('0x5a'):logger[_0xd058('0xb')]('[QUEUE]',_0xd058('0x5b'));emit(util[_0xd058('0xd')](_0xd058('0x5c'),_0x4a25f2[_0xd058('0x47')]),_0xd058('0x5d'),{'uri':util[_0xd058('0xd')](_0xd058('0x5e'),_0x585388[_0xd058('0x2b')]['replace']('/api/v2',''),_0x30ecf8['id'])});break;default:logger['error'](_0xd058('0x57'),_0xd058('0x5f'));}}})[_0xd058('0x60')](function(_0xbd8de7){logger[_0xd058('0x61')](_0xd058('0x62'),util['inspect'](_0xbd8de7,{'showHidden':!![],'depth':null}));});};exports[_0xd058('0x63')]=function(_0x45ce25,_0x172599,_0x14b1c2,_0x5582cd,_0x571c5f,_0x250b75,_0x475c17){var _0x22ee92,_0x2312cc;_0x250b75[_0xd058('0x2b')]=intUtil[_0xd058('0x48')](_0x250b75[_0xd058('0x2b')]);_0x250b75[_0xd058('0x49')]=intUtil[_0xd058('0x48')](_0x250b75['serverUrl']);if(_0x475c17&&_0x475c17[_0xd058('0x64')]&&_0x475c17[_0xd058('0x64')]!==_0xd058('0x65')){logger[_0xd058('0xb')](_0xd058('0x66'),_0xd058('0x4b'));_0x172599[_0xd058('0x4c')]=util[_0xd058('0xd')](_0xd058('0x4d'),_0x250b75[_0xd058('0x49')],_0x172599[_0xd058('0x4e')],md5(_0x172599[_0xd058('0x4e')]));}headers[_0xd058('0x4f')]=getAuth(_0x250b75);return getUser(_0x250b75,_0x5582cd[_0xd058('0x50')])['then'](function(_0x531fc5){_0x22ee92=_0x531fc5;logger[_0xd058('0xb')](_0xd058('0x51'),_0x22ee92['id']);return getEndUser(_0x250b75,_0x172599['destcalleridname'],_0x172599[_0xd058('0x67')]);})[_0xd058('0x15')](function(_0x24a368){_0x2312cc=_0x24a368;logger['info'](_0xd058('0x54'),_0x2312cc['id']);return getTicket(_0x250b75,_0x22ee92,_0x2312cc,_0x14b1c2,_0x172599);})['then'](function(_0x6ec103){if(_0x6ec103){logger[_0xd058('0xb')]('The\x20Ticket\x20ID\x20is:',_0x6ec103['id']);switch(_0x250b75['type']){case _0xd058('0x56'):logger[_0xd058('0xb')](_0xd058('0x66'),_0xd058('0x68'));return request({'uri':util[_0xd058('0xd')](_0xd058('0x58'),_0x250b75[_0xd058('0x2b')],_0x22ee92['id'],_0x6ec103['id']),'method':'POST'});case'newTab':logger[_0xd058('0xb')](_0xd058('0x66'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd058('0xd')]('user:%s',_0x5582cd[_0xd058('0x47')]),_0xd058('0x5d'),{'uri':util['format'](_0xd058('0x5e'),_0x250b75[_0xd058('0x2b')]['replace'](_0xd058('0x69'),''),_0x6ec103['id'])});break;default:logger[_0xd058('0x61')](_0xd058('0x66'),_0xd058('0x5f'));}}})[_0xd058('0x60')](function(_0x569af0){logger['error'](_0xd058('0x6a'),util[_0xd058('0x6b')](_0x569af0,{'showHidden':!![],'depth':null}));});};exports[_0xd058('0x6c')]=function(_0x1b99ed,_0x5a7e79,_0x4bec99,_0x1482a4,_0x3a5d22,_0x243a7a){var _0x247cb4,_0x47495c;_0x243a7a['remoteUri']=intUtil[_0xd058('0x48')](_0x243a7a[_0xd058('0x2b')]);_0x243a7a['serverUrl']=intUtil[_0xd058('0x48')](_0x243a7a[_0xd058('0x49')]);if(_0x3a5d22&&_0x3a5d22[_0xd058('0x4a')]){logger[_0xd058('0xb')]('['+_0x5a7e79[_0xd058('0x6d')][_0xd058('0x6e')]()+']',_0xd058('0x4b'));_0x5a7e79['recordingURL']=util[_0xd058('0xd')](_0xd058('0x4d'),_0x243a7a[_0xd058('0x49')],_0x5a7e79[_0xd058('0x4e')],md5(_0x5a7e79[_0xd058('0x4e')]));}else{_0x5a7e79[_0xd058('0x4c')]='';}headers['Authorization']=getAuth(_0x243a7a);return getUser(_0x243a7a)[_0xd058('0x15')](function(_0x1531f0){_0x247cb4=_0x1531f0;logger['info'](_0xd058('0x51'),_0x247cb4['id']);return getEndUser(_0x243a7a,_0x5a7e79[_0xd058('0x52')],_0x5a7e79[_0xd058('0x53')]);})[_0xd058('0x15')](function(_0x36c618){_0x47495c=_0x36c618;logger[_0xd058('0xb')](_0xd058('0x54'),_0x47495c['id']);return getTicket(_0x243a7a,_0x247cb4,_0x47495c,_0x4bec99,_0x5a7e79);})[_0xd058('0x15')](function(_0x1f535c){if(_0x1f535c){logger['info'](_0xd058('0x55'),_0x1f535c['id']);}})['catch'](function(_0x4b82c3){logger['error']('['+_0x5a7e79[_0xd058('0x6d')][_0xd058('0x6e')]()+']'+_0xd058('0x6f'),util[_0xd058('0x6b')](_0x4b82c3,{'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 f1ffaeb..f357e94 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 _0xcab6=['Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','merge','Fields','/crm/v2/Calls','code','Call\x20created!','err','host','stripTrailingSlash','monitor_format','[QUEUE]','serverUrl','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','recordingFormat','none','destcalleridnum','Outbound','[OUTBOUND]','unmanaged','toUpperCase','lodash','md5','util','./util','moment','ioredis','bluebird','../../../../config/logger','redis','defaults','socket.io-emitter','debug','[HTTP]','stringify','length','includes','picklist','toString','type','variable','variableName','idField','customVariable','Variable','toLowerCase','name','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','refresh_token','then','add','seconds','error','stack','info','GET','format','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Administrator','profile','Using\x20the\x20admin\x20account!','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','catch','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0xcab6,0xd4));var _0x6cab=function(_0x5ef225,_0x3f9b24){_0x5ef225=_0x5ef225-0x0;var _0x3375db=_0xcab6[_0x5ef225];return _0x3375db;};'use strict';var _=require(_0x6cab('0x0'));var rp=require('request-promise');var md5=require(_0x6cab('0x1'));var util=require(_0x6cab('0x2'));var intUtil=require(_0x6cab('0x3'));var moment=require(_0x6cab('0x4'));var Redis=require(_0x6cab('0x5'));var BPromise=require(_0x6cab('0x6'));var config=require('../../../../config/environment');var logger=require(_0x6cab('0x7'))('zoho');config[_0x6cab('0x8')]=_[_0x6cab('0x9')](config[_0x6cab('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x6cab('0xa'))(new Redis(config[_0x6cab('0x8')]));function emit(_0x230f8b,_0xd520bd,_0x58d0ee){io['to'](_0x230f8b)['emit'](_0xd520bd,_0x58d0ee);}function request(_0x12c055){logger[_0x6cab('0xb')](_0x6cab('0xc'),JSON[_0x6cab('0xd')](_0x12c055));return rp(_0x12c055);}function getCustomFields(_0x161b9c,_0xe1e146){var _0x511e2c={};if(_0x161b9c[_0x6cab('0xe')]>0x0){_['forEach'](_0x161b9c,function(_0x5e5a48){if(_[_0x6cab('0xf')](['string',_0x6cab('0x10')],_0x5e5a48['type'])&&_0x5e5a48['idField']){_0x511e2c[_0x5e5a48['idField']]=_0x5e5a48['content'][_0x6cab('0x11')]();}else if(_0x5e5a48[_0x6cab('0x12')]===_0x6cab('0x13')&&_0x5e5a48[_0x6cab('0x14')]&&_0x5e5a48[_0x6cab('0x15')]&&_0xe1e146[_0x5e5a48[_0x6cab('0x14')]]){_0x511e2c[_0x5e5a48[_0x6cab('0x15')]]=_0xe1e146[_0x5e5a48[_0x6cab('0x14')]][_0x6cab('0x11')]();}else if(_0x5e5a48[_0x6cab('0x12')]===_0x6cab('0x16')&&_0x5e5a48[_0x6cab('0x17')]&&_0x5e5a48[_0x6cab('0x17')]['name']&&_0x5e5a48[_0x6cab('0x15')]&&_0xe1e146[_0x5e5a48[_0x6cab('0x17')]['name'][_0x6cab('0x18')]()]){_0x511e2c[_0x5e5a48[_0x6cab('0x15')]]=_0xe1e146[_0x5e5a48[_0x6cab('0x17')][_0x6cab('0x19')]['toLowerCase']()]['toString']();}});}return _0x511e2c;}function getName(_0x46848a){if(_0x46848a[_0x6cab('0x1a')]('\x20')>0x0){var _0x1b5565=_0x46848a[_0x6cab('0x1b')](/ (.+)/);if(_0x1b5565[0x1]){return _0x1b5565;}}return[_0x46848a,_0x46848a];}var accountsTokens={};function getAccessToken(_0xa36dad){return new Promise(function(_0x565a51,_0x555185){if(!_[_0x6cab('0x1c')](accountsTokens[_0xa36dad['id']])&&!_['isNil'](accountsTokens[_0xa36dad['id']][_0x6cab('0x1d')])){if(moment()[_0x6cab('0x1e')](accountsTokens[_0xa36dad['id']][_0x6cab('0x1f')])){_0x565a51(accountsTokens[_0xa36dad['id']][_0x6cab('0x1d')]);}}var _0x3588e9;switch(_0xa36dad[_0x6cab('0x20')]){case'US':_0x3588e9=_0x6cab('0x21');break;case'AU':_0x3588e9=_0x6cab('0x22');break;case'EU':_0x3588e9=_0x6cab('0x23');break;case'IN':_0x3588e9=_0x6cab('0x24');break;case'CN':_0x3588e9=_0x6cab('0x25');break;default:_0x3588e9=_0x6cab('0x23');break;}var _0xbfbeca={'method':'POST','uri':_0x3588e9+'/oauth/v2/token','qs':{'refresh_token':_0xa36dad['refreshToken'],'client_id':_0xa36dad['clientId'],'client_secret':_0xa36dad['clientSecret'],'grant_type':_0x6cab('0x26')},'json':!![]};return rp(_0xbfbeca)[_0x6cab('0x27')](function(_0x426531){accountsTokens[_0xa36dad['id']]={'access_token':_0x426531['access_token'],'expires_in':moment()[_0x6cab('0x28')](_0x426531[_0x6cab('0x1f')],_0x6cab('0x29'))};_0x565a51(_0x426531[_0x6cab('0x1d')]);})['catch'](function(_0x3b2690){logger[_0x6cab('0x2a')]('Failing\x20creating\x20the\x20access_token',_0x3b2690[_0x6cab('0x2b')]);_0x555185(_0x3b2690);});});}function getUser(_0x5b4bbf,_0x14e1de,_0x4abbe5,_0x550cc7){logger[_0x6cab('0x2c')]('Search\x20user');return request({'method':_0x6cab('0x2d'),'uri':util[_0x6cab('0x2e')]('https://www.zohoapis.%s/crm/v2/users',_0x14e1de),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x6cab('0x2f')+_0x5b4bbf},'json':!![]})[_0x6cab('0x27')](function(_0xd4a4c4){if(_0xd4a4c4['users']){var _0x52ed72=-0x1;if(_[_0x6cab('0x30')](_0xd4a4c4[_0x6cab('0x31')])){if(!_[_0x6cab('0x1c')](_0x550cc7)){_0x52ed72=_[_0x6cab('0x32')](_0xd4a4c4[_0x6cab('0x31')],function(_0x20c637){return _0x20c637[_0x6cab('0x33')]===_0x550cc7;});}if(_0x52ed72>=0x0){logger[_0x6cab('0x2c')]('Agent\x20found!');}else{logger['info']('Using\x20the\x20admin\x20account!');_0x52ed72=_[_0x6cab('0x32')](_0xd4a4c4[_0x6cab('0x31')],function(_0xcde7c4){return _0xcde7c4['profile'][_0x6cab('0x19')]===_0x6cab('0x34');});}return _0xd4a4c4[_0x6cab('0x31')][_0x52ed72];}else{if(_0xd4a4c4['user'][_0x6cab('0x35')][_0x6cab('0x19')]===_0x6cab('0x34')){logger['info'](_0x6cab('0x36'));user=_0xd4a4c4['user'];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x6cab('0xd')](_0xd4a4c4));throw new Error(_0x6cab('0x37')+JSON['stringify'](_0xd4a4c4));}}}else{logger[_0x6cab('0x2a')](_0x6cab('0x38'),JSON[_0x6cab('0xd')](_0xd4a4c4));throw new Error(_0x6cab('0x37')+JSON[_0x6cab('0xd')](_0xd4a4c4));}})[_0x6cab('0x39')](function(_0x16ce84){console[_0x6cab('0x2a')](_0x16ce84);});}function getZohoUser(_0x45b00c,_0x106fdf){return new BPromise(function(_0x568660,_0x1389f8){request(_0x45b00c)['then'](function(_0x2dac29){var _0x5715ea=null;if(_0x2dac29){_0x5715ea=_0x2dac29[_0x6cab('0x3a')][0x0];_0x5715ea[_0x6cab('0x3b')]=_0x106fdf;}_0x568660(_0x5715ea);})[_0x6cab('0x39')](function(_0x5bc0c9){_0x1389f8(_0x5bc0c9);});});}function createEndUser(_0x239018,_0x452f19,_0x1b4784,_0x3e9a1f,_0xe3ca3b,_0x54792b){var _0x1b4784=getName(_0x1b4784);return request({'method':_0x6cab('0x3c'),'uri':_0x6cab('0x3d')+_0x452f19+_0x6cab('0x3e')+_[_0x6cab('0x3f')](_0x54792b[_0x6cab('0x40')])+'s','body':{'data':[{'Last_Name':_0x1b4784[0x1],'First_Name':_0x1b4784[0x0],'Phone':_0x3e9a1f,'Owner':{'name':!_[_0x6cab('0x1c')](_0xe3ca3b[_0x6cab('0x41')][_0x6cab('0x19')])?_0xe3ca3b['role']['name']:!_[_0x6cab('0x1c')](_0xe3ca3b[_0x6cab('0x42')])?_0xe3ca3b[_0x6cab('0x42')]+'\x20'+_0xe3ca3b[_0x6cab('0x43')]:_0xe3ca3b[_0x6cab('0x43')],'id':_0xe3ca3b['id']}}]},'headers':{'Authorization':_0x6cab('0x2f')+_0x239018},'json':!![]})[_0x6cab('0x27')](function(_0x1ecc1a){if(_0x1ecc1a&&_0x1ecc1a[_0x6cab('0x3a')][0x0]['code']===_0x6cab('0x44')){var _0x26ce12=_0x1ecc1a['data'][0x0][_0x6cab('0x45')];_0x26ce12[_0x6cab('0x3b')]=_[_0x6cab('0x3f')](_0x54792b['moduleCreate'])+'s';return _0x26ce12;}logger[_0x6cab('0x2a')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0x6cab('0xd')](data));})['catch'](function(_0x245d4e){console[_0x6cab('0x46')]('CREATE\x20ERROR',_0x245d4e);});}function getEndUser(_0x3ab218,_0x41e08e,_0x4bc6e8,_0x2691b3,_0x1272f8,_0xe77e9f,_0x53ca80){var _0x1d153f={'method':_0x6cab('0x2d'),'uri':'','headers':{'Authorization':_0x6cab('0x2f')+_0x3ab218},'json':!![]};switch(_0x53ca80[_0x6cab('0x47')]){case _0x6cab('0x48'):_0x1d153f[_0x6cab('0x49')]=_0x6cab('0x3d')+_0x41e08e+_0x6cab('0x4a')+_0x1272f8+'))';return getZohoUser(_0x1d153f,_0x6cab('0x4b'))[_0x6cab('0x27')](function(_0x1419ae){if(_0x1419ae)return _0x1419ae;_0x1d153f[_0x6cab('0x49')]=_0x6cab('0x3d')+_0x41e08e+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1272f8+'))';return getZohoUser(_0x1d153f,_0x6cab('0x4c'))['then'](function(_0x41a889){if(_0x41a889)return _0x41a889;if(_0x53ca80[_0x6cab('0x40')]!='nothing'){return createEndUser(_0x3ab218,_0x41e08e,_0x2691b3,_0x1272f8,_0xe77e9f,_0x53ca80);}else{return{};}});});break;case _0x6cab('0x4d'):_0x1d153f[_0x6cab('0x49')]=_0x6cab('0x3d')+_0x41e08e+_0x6cab('0x4a')+_0x1272f8+'))';return getZohoUser(_0x1d153f,_0x6cab('0x4b'))[_0x6cab('0x27')](function(_0xde3984){if(_0xde3984)return _0xde3984;if(_0x53ca80[_0x6cab('0x40')]!='nothing'){return createEndUser(_0x3ab218,_0x41e08e,_0x2691b3,_0x1272f8,_0xe77e9f,_0x53ca80);}else{return{};}});break;case _0x6cab('0x4e'):_0x1d153f['uri']=_0x6cab('0x3d')+_0x41e08e+_0x6cab('0x4f')+_0x1272f8+'))';return getZohoUser(_0x1d153f,'Leads')[_0x6cab('0x27')](function(_0x52827d){if(_0x52827d)return _0x52827d;if(_0x53ca80[_0x6cab('0x40')]!=_0x6cab('0x50')){return createEndUser(_0x3ab218,_0x41e08e,_0x2691b3,_0x1272f8,_0xe77e9f,_0x53ca80);}else{return{};}});break;}}function getCall(_0xd36abd,_0xfd8fdd,_0x59d37e,_0x2c66e2,_0x30a0f2,_0x443689,_0x3584e3,_0x5c29b7){logger[_0x6cab('0x2c')](_0x6cab('0x51'));var _0x3b8e22={};_0x3b8e22[_0x6cab('0x52')]={'name':!_[_0x6cab('0x1c')](_0x2c66e2['role']['name'])&&!_['isNil'](_0x2c66e2[_0x6cab('0x35')]['name'])&&_0x2c66e2[_0x6cab('0x35')][_0x6cab('0x19')]===_0x6cab('0x53')?_0x2c66e2[_0x6cab('0x41')][_0x6cab('0x19')]:!_[_0x6cab('0x1c')](_0x2c66e2[_0x6cab('0x42')])?_0x2c66e2[_0x6cab('0x42')]+'\x20'+_0x2c66e2[_0x6cab('0x43')]:_0x2c66e2[_0x6cab('0x43')],'id':_0x2c66e2['id']};_0x3b8e22[_0x6cab('0x54')]=intUtil[_0x6cab('0x55')](_0x443689[_0x6cab('0x56')],_0x3584e3,'\x20');_0x3b8e22[_0x6cab('0x57')]=intUtil[_0x6cab('0x55')](_0x443689['Descriptions'],_0x3584e3,'\x0a');if(_0x30a0f2[_0x6cab('0x3b')]===_0x6cab('0x4b')){_0x3b8e22[_0x6cab('0x58')]={'name':!_[_0x6cab('0x1c')](_0x30a0f2['Full_Name'])?_0x30a0f2[_0x6cab('0x59')]:!_[_0x6cab('0x1c')](_0x30a0f2['First_Name'])?_0x30a0f2[_0x6cab('0x5a')]+'\x20'+_0x30a0f2['Last_Name']:_0x30a0f2[_0x6cab('0x5b')],'id':_0x30a0f2['id']};}if(_0x30a0f2[_0x6cab('0x3b')]===_0x6cab('0x4c')){_0x3b8e22[_0x6cab('0x5c')]={'name':!_[_0x6cab('0x1c')](_0x30a0f2[_0x6cab('0x59')])?_0x30a0f2['Full_Name']:!_['isNil'](_0x30a0f2['First_Name'])?_0x30a0f2[_0x6cab('0x5a')]+'\x20'+_0x30a0f2[_0x6cab('0x5b')]:_0x30a0f2[_0x6cab('0x5b')],'id':_0x30a0f2['id']};_0x3b8e22[_0x6cab('0x5d')]=_[_0x6cab('0x3f')](_0x30a0f2[_0x6cab('0x3b')]);}if(_0x3584e3[_0x6cab('0x5e')]){_0x3b8e22[_0x6cab('0x5f')]=moment[_0x6cab('0x60')](parseInt(_0x3584e3[_0x6cab('0x5e')])*0x3e8)[_0x6cab('0x2e')](_0x6cab('0x61'));}else if(_0x3584e3[_0x6cab('0x62')]&&_0x3584e3[_0x6cab('0x63')]){_0x3b8e22[_0x6cab('0x5f')]=moment[_0x6cab('0x60')](moment(_0x3584e3[_0x6cab('0x63')],_0x6cab('0x64'))[_0x6cab('0x65')](moment(_0x3584e3[_0x6cab('0x66')],_0x6cab('0x64'))))[_0x6cab('0x2e')](_0x6cab('0x61'));}switch(_0x3584e3[_0x6cab('0x67')]){case _0x6cab('0x68'):_0x3b8e22[_0x6cab('0x69')]=_0x6cab('0x6a');break;case _0x6cab('0x6b'):case _0x6cab('0x6c'):_0x3b8e22[_0x6cab('0x69')]=_0x6cab('0x6d');break;case _0x6cab('0x6e'):_0x3b8e22[_0x6cab('0x69')]='Rejected';break;case _0x6cab('0x6f'):_0x3b8e22['Call_Result']=_0x6cab('0x70');break;case _0x6cab('0x71'):_0x3b8e22[_0x6cab('0x69')]=_0x6cab('0x72');default:}_0x3b8e22[_0x6cab('0x73')]=(_0x5c29b7===_0x6cab('0x74')?moment(_0x3584e3[_0x6cab('0x66')])[_0x6cab('0x2e')](_0x6cab('0x64')):moment(_0x3584e3['agentcalledAt'])[_0x6cab('0x2e')](_0x6cab('0x64')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x3b8e22[_0x6cab('0x75')]=_0x5c29b7||'Inbound';_0x3b8e22=_[_0x6cab('0x76')](_0x3b8e22,getCustomFields(_0x443689[_0x6cab('0x77')],_0x3584e3));return request({'method':'POST','uri':_0x6cab('0x3d')+_0xfd8fdd+_0x6cab('0x78'),'headers':{'Authorization':_0x6cab('0x2f')+_0xd36abd},'body':{'data':[_0x3b8e22]},'json':!![]})[_0x6cab('0x27')](function(_0x57e9a8){if(_0x57e9a8&&_0x57e9a8['data'][0x0][_0x6cab('0x79')]===_0x6cab('0x44')){logger[_0x6cab('0x2c')](_0x6cab('0x7a'));return{'id':_0x57e9a8[_0x6cab('0x3a')][0x0][_0x6cab('0x45')]['id']};}})[_0x6cab('0x39')](function(_0x23c1c6){logger[_0x6cab('0x2c')](_0x6cab('0x7b'),_0x23c1c6[_0x6cab('0x2b')]);console[_0x6cab('0x46')]('err',_0x23c1c6);});}exports['queue']=function(_0x44f364,_0x415708,_0x350a0a,_0x21c285,_0x38fdfd,_0x471426){var _0x51f609,_0x308fb9,_0x202ebf;_0x471426[_0x6cab('0x7c')]=intUtil['stripTrailingSlash'](_0x471426[_0x6cab('0x7c')]);_0x471426['serverUrl']=intUtil[_0x6cab('0x7d')](_0x471426['serverUrl']);if(_0x38fdfd&&_0x38fdfd[_0x6cab('0x7e')]){logger[_0x6cab('0x2c')](_0x6cab('0x7f'),'Recording\x20is\x20enabled!');_0x415708['recordingURL']=_0x471426[_0x6cab('0x80')]+_0x6cab('0x81')+_0x415708['uniqueid']+_0x6cab('0x82')+md5(_0x415708[_0x6cab('0x83')]);}else{_0x415708[_0x6cab('0x84')]='';}var _0x27489a=_0x471426[_0x6cab('0x7c')]===_0x6cab('0x85')?'eu':_0x6cab('0x86');return getAccessToken(_0x471426)[_0x6cab('0x27')](function(_0x17c332){_0x202ebf=_0x17c332;return getUser(_0x202ebf,_0x27489a,_0x471426,_0x21c285[_0x6cab('0x33')]);})[_0x6cab('0x27')](function(_0x14e3e9){_0x51f609=_0x14e3e9;logger[_0x6cab('0x2c')](_0x6cab('0x87'),_0x51f609['id']);return getEndUser(_0x202ebf,_0x27489a,_0x471426,_0x415708[_0x6cab('0x88')],_0x415708[_0x6cab('0x89')],_0x51f609,_0x350a0a);})[_0x6cab('0x27')](function(_0x3e7a74){_0x308fb9=_0x3e7a74;return getCall(_0x202ebf,_0x27489a,_0x471426,_0x51f609,_0x308fb9,_0x350a0a,_0x415708,_0x6cab('0x8a'));})[_0x6cab('0x27')](function(_0x2a53a6){if(_0x2a53a6){logger['info'](_0x6cab('0x8b'),_0x2a53a6['id']);logger[_0x6cab('0x2c')]('[QUEUE]',_0x6cab('0x8c'));emit(util[_0x6cab('0x2e')](_0x6cab('0x8d'),_0x21c285['name']),_0x6cab('0x8e'),{'uri':'https://crm.'+_0x471426[_0x6cab('0x7c')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2a53a6['id']});}})[_0x6cab('0x39')](function(_0xf6184b){logger[_0x6cab('0x2a')]('[QUEUE]',JSON[_0x6cab('0xd')](_0xf6184b));});};exports['outbound']=function(_0x592e36,_0x4c0f08,_0x2c92c7,_0x102898,_0x269ffc,_0x2a96be,_0x5dd1d9){var _0x101eb9,_0x1127d0,_0x411488;_0x2a96be[_0x6cab('0x7c')]=intUtil[_0x6cab('0x7d')](_0x2a96be[_0x6cab('0x7c')]);_0x2a96be[_0x6cab('0x80')]=intUtil['stripTrailingSlash'](_0x2a96be['serverUrl']);if(_0x5dd1d9&&_0x5dd1d9['recordingFormat']&&_0x5dd1d9[_0x6cab('0x8f')]!==_0x6cab('0x90')){logger[_0x6cab('0x2c')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4c0f08['recordingURL']=_0x2a96be[_0x6cab('0x80')]+'/api/voice/recordings/'+_0x4c0f08[_0x6cab('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x4c0f08[_0x6cab('0x83')]);}var _0x5603d7=_0x2a96be[_0x6cab('0x7c')]===_0x6cab('0x85')?'eu':_0x6cab('0x86');return getAccessToken(_0x2a96be)[_0x6cab('0x27')](function(_0x492477){_0x411488=_0x492477;return getUser(_0x411488,_0x5603d7,_0x2a96be,_0x102898[_0x6cab('0x33')]);})[_0x6cab('0x27')](function(_0x27eec2){_0x101eb9=_0x27eec2;logger[_0x6cab('0x2c')](_0x6cab('0x87'),_0x101eb9['id']);return getEndUser(_0x411488,_0x5603d7,_0x2a96be,_0x4c0f08['destcalleridname'],_0x4c0f08[_0x6cab('0x91')],_0x101eb9,_0x2c92c7);})['then'](function(_0x431847){_0x1127d0=_0x431847;return getCall(_0x411488,_0x5603d7,_0x2a96be,_0x101eb9,_0x1127d0,_0x2c92c7,_0x4c0f08,_0x6cab('0x92'));})['then'](function(_0x384f6f){if(_0x384f6f){logger[_0x6cab('0x2c')](_0x6cab('0x8b'),_0x384f6f['id']);logger[_0x6cab('0x2c')](_0x6cab('0x93'),_0x6cab('0x8c'));emit(util[_0x6cab('0x2e')](_0x6cab('0x8d'),_0x102898[_0x6cab('0x19')]),'trigger:browser:url',{'uri':'https://crm.'+_0x2a96be['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x384f6f['id']});}})['catch'](function(_0x277c6a){logger[_0x6cab('0x2a')]('[OUTBOUND]',JSON[_0x6cab('0xd')](_0x277c6a));});};exports[_0x6cab('0x94')]=function(_0x216aa0,_0x167a84,_0x2274cb,_0x48656a,_0x7d54d6,_0x28a49c){var _0x2cae78,_0x8f036d,_0x4bf8dd;_0x28a49c[_0x6cab('0x7c')]=intUtil[_0x6cab('0x7d')](_0x28a49c[_0x6cab('0x7c')]);_0x28a49c['serverUrl']=intUtil['stripTrailingSlash'](_0x28a49c[_0x6cab('0x80')]);if(_0x7d54d6&&_0x7d54d6[_0x6cab('0x7e')]){logger[_0x6cab('0x2c')]('['+_0x167a84[_0x6cab('0x67')][_0x6cab('0x95')]()+']','Recording\x20is\x20enabled!');_0x167a84[_0x6cab('0x84')]=_0x28a49c['serverUrl']+'/api/voice/recordings/'+_0x167a84['uniqueid']+_0x6cab('0x82')+md5(_0x167a84[_0x6cab('0x83')]);}else{_0x167a84[_0x6cab('0x84')]='';}var _0x575f25=_0x28a49c['host']===_0x6cab('0x85')?'eu':_0x6cab('0x86');return getAccessToken(_0x28a49c)['then'](function(_0x516644){_0x4bf8dd=_0x516644;return getUser(_0x4bf8dd,_0x575f25,_0x28a49c);})[_0x6cab('0x27')](function(_0x46a498){_0x2cae78=_0x46a498;logger[_0x6cab('0x2c')](_0x6cab('0x87'),_0x2cae78['id']);return getEndUser(_0x4bf8dd,_0x575f25,_0x28a49c,_0x167a84[_0x6cab('0x88')],_0x167a84[_0x6cab('0x89')],_0x2cae78,_0x2274cb);})[_0x6cab('0x27')](function(_0x340dd8){_0x8f036d=_0x340dd8;return getCall(_0x4bf8dd,_0x575f25,_0x28a49c,_0x2cae78,_0x8f036d,_0x2274cb,_0x167a84,'Inbound');})[_0x6cab('0x27')](function(_0x1c98e6){if(_0x1c98e6){logger[_0x6cab('0x2c')]('The\x20Call\x20ID\x20is:',_0x1c98e6['id']);}})[_0x6cab('0x39')](function(_0xb848c9){logger[_0x6cab('0x2a')]('['+_0x167a84[_0x6cab('0x67')]['toUpperCase']()+']',JSON[_0x6cab('0xd')](_0xb848c9));});}; \ No newline at end of file +var _0xa3df=['md5','util','./util','moment','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','length','forEach','includes','picklist','type','idField','content','toString','variableName','customVariable','Variable','toLowerCase','name','indexOf','split','isNil','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','access_token','add','seconds','catch','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','findIndex','users','email','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','details','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','merge','POST','/crm/v2/Calls','code','SUCCESS','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','recordingFormat','[OUTBOUND]','/downloads?type=uniqueid&token=','com','destcalleridname','destcalleridnum','Outbound','user:%s','https://crm.','toUpperCase','lodash'];(function(_0x331797,_0x3a0bda){var _0x5e2a52=function(_0x3bc2b7){while(--_0x3bc2b7){_0x331797['push'](_0x331797['shift']());}};_0x5e2a52(++_0x3a0bda);}(_0xa3df,0x1c7));var _0xfa3d=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa3df[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0xfa3d('0x0'));var rp=require('request-promise');var md5=require(_0xfa3d('0x1'));var util=require(_0xfa3d('0x2'));var intUtil=require(_0xfa3d('0x3'));var moment=require(_0xfa3d('0x4'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0xfa3d('0x5'));var logger=require(_0xfa3d('0x6'))(_0xfa3d('0x7'));config[_0xfa3d('0x8')]=_[_0xfa3d('0x9')](config[_0xfa3d('0x8')],{'host':_0xfa3d('0xa'),'port':0x18eb});var io=require(_0xfa3d('0xb'))(new Redis(config[_0xfa3d('0x8')]));function emit(_0x1fab4d,_0x2cd779,_0x9c5dbb){io['to'](_0x1fab4d)[_0xfa3d('0xc')](_0x2cd779,_0x9c5dbb);}function request(_0x546b78){logger[_0xfa3d('0xd')]('[HTTP]',JSON[_0xfa3d('0xe')](_0x546b78));return rp(_0x546b78);}function getCustomFields(_0x22c704,_0x4ba693){var _0x5608ed={};if(_0x22c704[_0xfa3d('0xf')]>0x0){_[_0xfa3d('0x10')](_0x22c704,function(_0x123cc9){if(_[_0xfa3d('0x11')](['string',_0xfa3d('0x12')],_0x123cc9[_0xfa3d('0x13')])&&_0x123cc9[_0xfa3d('0x14')]){_0x5608ed[_0x123cc9['idField']]=_0x123cc9[_0xfa3d('0x15')][_0xfa3d('0x16')]();}else if(_0x123cc9['type']==='variable'&&_0x123cc9['variableName']&&_0x123cc9[_0xfa3d('0x14')]&&_0x4ba693[_0x123cc9[_0xfa3d('0x17')]]){_0x5608ed[_0x123cc9[_0xfa3d('0x14')]]=_0x4ba693[_0x123cc9[_0xfa3d('0x17')]][_0xfa3d('0x16')]();}else if(_0x123cc9['type']===_0xfa3d('0x18')&&_0x123cc9[_0xfa3d('0x19')]&&_0x123cc9[_0xfa3d('0x19')]['name']&&_0x123cc9[_0xfa3d('0x14')]&&_0x4ba693[_0x123cc9[_0xfa3d('0x19')]['name'][_0xfa3d('0x1a')]()]){_0x5608ed[_0x123cc9[_0xfa3d('0x14')]]=_0x4ba693[_0x123cc9[_0xfa3d('0x19')][_0xfa3d('0x1b')][_0xfa3d('0x1a')]()][_0xfa3d('0x16')]();}});}return _0x5608ed;}function getName(_0x533553){if(_0x533553[_0xfa3d('0x1c')]('\x20')>0x0){var _0x3523d7=_0x533553[_0xfa3d('0x1d')](/ (.+)/);if(_0x3523d7[0x1]){return _0x3523d7;}}return[_0x533553,_0x533553];}var accountsTokens={};function getAccessToken(_0x4bcfc3){return new Promise(function(_0x4b986b,_0x58e48d){if(!_[_0xfa3d('0x1e')](accountsTokens[_0x4bcfc3['id']])&&!_[_0xfa3d('0x1e')](accountsTokens[_0x4bcfc3['id']]['access_token'])){if(moment()[_0xfa3d('0x1f')](accountsTokens[_0x4bcfc3['id']][_0xfa3d('0x20')])){_0x4b986b(accountsTokens[_0x4bcfc3['id']]['access_token']);}}var _0xa5acf8;switch(_0x4bcfc3[_0xfa3d('0x21')]){case'US':_0xa5acf8=_0xfa3d('0x22');break;case'AU':_0xa5acf8='https://accounts.zoho.com.au';break;case'EU':_0xa5acf8=_0xfa3d('0x23');break;case'IN':_0xa5acf8='https://accounts.zoho.in';break;case'CN':_0xa5acf8='https://accounts.zoho.com.cn';break;default:_0xa5acf8=_0xfa3d('0x23');break;}var _0xe18ace={'method':'POST','uri':_0xa5acf8+_0xfa3d('0x24'),'qs':{'refresh_token':_0x4bcfc3[_0xfa3d('0x25')],'client_id':_0x4bcfc3[_0xfa3d('0x26')],'client_secret':_0x4bcfc3[_0xfa3d('0x27')],'grant_type':_0xfa3d('0x28')},'json':!![]};return rp(_0xe18ace)[_0xfa3d('0x29')](function(_0x4ac310){accountsTokens[_0x4bcfc3['id']]={'access_token':_0x4ac310[_0xfa3d('0x2a')],'expires_in':moment()[_0xfa3d('0x2b')](_0x4ac310[_0xfa3d('0x20')],_0xfa3d('0x2c'))};_0x4b986b(_0x4ac310[_0xfa3d('0x2a')]);})[_0xfa3d('0x2d')](function(_0x411acd){logger['error']('Failing\x20creating\x20the\x20access_token',_0x411acd[_0xfa3d('0x2e')]);_0x58e48d(_0x411acd);});});}function getUser(_0x1211a6,_0x115423,_0x49f911,_0x1d06c6){logger[_0xfa3d('0x2f')](_0xfa3d('0x30'));return request({'method':_0xfa3d('0x31'),'uri':util[_0xfa3d('0x32')]('https://www.zohoapis.%s/crm/v2/users',_0x115423),'qs':{'type':_0xfa3d('0x33')},'headers':{'Authorization':_0xfa3d('0x34')+_0x1211a6},'json':!![]})[_0xfa3d('0x29')](function(_0x39c3e5){if(_0x39c3e5['users']){var _0x13c144=-0x1;if(_['isArrayLikeObject'](_0x39c3e5['users'])){if(!_[_0xfa3d('0x1e')](_0x1d06c6)){_0x13c144=_[_0xfa3d('0x35')](_0x39c3e5[_0xfa3d('0x36')],function(_0x6b8ad7){return _0x6b8ad7[_0xfa3d('0x37')]===_0x1d06c6;});}if(_0x13c144>=0x0){logger[_0xfa3d('0x2f')]('Agent\x20found!');}else{logger[_0xfa3d('0x2f')](_0xfa3d('0x38'));_0x13c144=_[_0xfa3d('0x35')](_0x39c3e5['users'],function(_0x169cb1){return _0x169cb1['profile']['name']===_0xfa3d('0x39');});}return _0x39c3e5[_0xfa3d('0x36')][_0x13c144];}else{if(_0x39c3e5[_0xfa3d('0x3a')][_0xfa3d('0x3b')][_0xfa3d('0x1b')]===_0xfa3d('0x39')){logger[_0xfa3d('0x2f')]('Using\x20the\x20admin\x20account!');user=_0x39c3e5[_0xfa3d('0x3a')];return user;}else{logger['error'](_0xfa3d('0x3c'),JSON[_0xfa3d('0xe')](_0x39c3e5));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xfa3d('0xe')](_0x39c3e5));}}}else{logger[_0xfa3d('0x3d')](_0xfa3d('0x3c'),JSON[_0xfa3d('0xe')](_0x39c3e5));throw new Error(_0xfa3d('0x3e')+JSON[_0xfa3d('0xe')](_0x39c3e5));}})[_0xfa3d('0x2d')](function(_0x4dddbd){console[_0xfa3d('0x3d')](_0x4dddbd);});}function getZohoUser(_0x2785e3,_0x12bd32){return new BPromise(function(_0x203b3e,_0x9ca477){request(_0x2785e3)[_0xfa3d('0x29')](function(_0x1db9a7){var _0x15ff62=null;if(_0x1db9a7){_0x15ff62=_0x1db9a7[_0xfa3d('0x3f')][0x0];_0x15ff62[_0xfa3d('0x40')]=_0x12bd32;}_0x203b3e(_0x15ff62);})[_0xfa3d('0x2d')](function(_0x382df7){_0x9ca477(_0x382df7);});});}function createEndUser(_0x5f1e17,_0x3cee47,_0x218d8a,_0x2dc227,_0x13e9ae,_0x588a7c){var _0x218d8a=getName(_0x218d8a);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x3cee47+_0xfa3d('0x41')+_[_0xfa3d('0x42')](_0x588a7c[_0xfa3d('0x43')])+'s','body':{'data':[{'Last_Name':_0x218d8a[0x1],'First_Name':_0x218d8a[0x0],'Phone':_0x2dc227,'Owner':{'name':!_[_0xfa3d('0x1e')](_0x13e9ae[_0xfa3d('0x44')][_0xfa3d('0x1b')])?_0x13e9ae['role']['name']:!_['isNil'](_0x13e9ae[_0xfa3d('0x45')])?_0x13e9ae[_0xfa3d('0x45')]+'\x20'+_0x13e9ae[_0xfa3d('0x46')]:_0x13e9ae['last_name'],'id':_0x13e9ae['id']}}]},'headers':{'Authorization':_0xfa3d('0x34')+_0x5f1e17},'json':!![]})['then'](function(_0x2ab57a){if(_0x2ab57a&&_0x2ab57a['data'][0x0]['code']==='SUCCESS'){var _0x557fdb=_0x2ab57a[_0xfa3d('0x3f')][0x0][_0xfa3d('0x47')];_0x557fdb[_0xfa3d('0x40')]=_['startCase'](_0x588a7c['moduleCreate'])+'s';return _0x557fdb;}logger[_0xfa3d('0x3d')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0xfa3d('0x48')+JSON['stringify'](data));})[_0xfa3d('0x2d')](function(_0x1c80c9){console[_0xfa3d('0x49')](_0xfa3d('0x4a'),_0x1c80c9);});}function getEndUser(_0x4b9831,_0x5230a5,_0x3c769d,_0x3e25e6,_0x22abdb,_0x148766,_0x12adc3){var _0x25f032={'method':_0xfa3d('0x31'),'uri':'','headers':{'Authorization':_0xfa3d('0x34')+_0x4b9831},'json':!![]};switch(_0x12adc3['moduleSearch']){case _0xfa3d('0x4b'):_0x25f032[_0xfa3d('0x4c')]=_0xfa3d('0x4d')+_0x5230a5+_0xfa3d('0x4e')+_0x22abdb+'))';return getZohoUser(_0x25f032,_0xfa3d('0x4f'))[_0xfa3d('0x29')](function(_0x5b1b73){if(_0x5b1b73)return _0x5b1b73;_0x25f032['uri']=_0xfa3d('0x4d')+_0x5230a5+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x22abdb+'))';return getZohoUser(_0x25f032,_0xfa3d('0x50'))[_0xfa3d('0x29')](function(_0x24b48d){if(_0x24b48d)return _0x24b48d;if(_0x12adc3[_0xfa3d('0x43')]!=_0xfa3d('0x51')){return createEndUser(_0x4b9831,_0x5230a5,_0x3e25e6,_0x22abdb,_0x148766,_0x12adc3);}else{return{};}});});break;case'contact':_0x25f032[_0xfa3d('0x4c')]='https://www.zohoapis.'+_0x5230a5+_0xfa3d('0x4e')+_0x22abdb+'))';return getZohoUser(_0x25f032,'Contacts')[_0xfa3d('0x29')](function(_0x73101e){if(_0x73101e)return _0x73101e;if(_0x12adc3[_0xfa3d('0x43')]!=_0xfa3d('0x51')){return createEndUser(_0x4b9831,_0x5230a5,_0x3e25e6,_0x22abdb,_0x148766,_0x12adc3);}else{return{};}});break;case _0xfa3d('0x52'):_0x25f032[_0xfa3d('0x4c')]='https://www.zohoapis.'+_0x5230a5+_0xfa3d('0x53')+_0x22abdb+'))';return getZohoUser(_0x25f032,_0xfa3d('0x50'))[_0xfa3d('0x29')](function(_0x3d09e8){if(_0x3d09e8)return _0x3d09e8;if(_0x12adc3[_0xfa3d('0x43')]!=_0xfa3d('0x51')){return createEndUser(_0x4b9831,_0x5230a5,_0x3e25e6,_0x22abdb,_0x148766,_0x12adc3);}else{return{};}});break;}}function getCall(_0x568f83,_0x3516af,_0x801014,_0x19c1a4,_0x216f54,_0xd697af,_0x4588c2,_0x5b9560){logger['info'](_0xfa3d('0x54'));var _0x269cec={};_0x269cec[_0xfa3d('0x55')]={'name':!_[_0xfa3d('0x1e')](_0x19c1a4[_0xfa3d('0x44')][_0xfa3d('0x1b')])&&!_[_0xfa3d('0x1e')](_0x19c1a4[_0xfa3d('0x3b')][_0xfa3d('0x1b')])&&_0x19c1a4[_0xfa3d('0x3b')][_0xfa3d('0x1b')]===_0xfa3d('0x56')?_0x19c1a4[_0xfa3d('0x44')][_0xfa3d('0x1b')]:!_[_0xfa3d('0x1e')](_0x19c1a4[_0xfa3d('0x45')])?_0x19c1a4[_0xfa3d('0x45')]+'\x20'+_0x19c1a4['last_name']:_0x19c1a4['last_name'],'id':_0x19c1a4['id']};_0x269cec[_0xfa3d('0x57')]=intUtil[_0xfa3d('0x58')](_0xd697af[_0xfa3d('0x59')],_0x4588c2,'\x20');_0x269cec['Description']=intUtil[_0xfa3d('0x58')](_0xd697af[_0xfa3d('0x5a')],_0x4588c2,'\x0a');if(_0x216f54[_0xfa3d('0x40')]===_0xfa3d('0x4f')){_0x269cec[_0xfa3d('0x5b')]={'name':!_['isNil'](_0x216f54[_0xfa3d('0x5c')])?_0x216f54[_0xfa3d('0x5c')]:!_[_0xfa3d('0x1e')](_0x216f54[_0xfa3d('0x5d')])?_0x216f54['First_Name']+'\x20'+_0x216f54[_0xfa3d('0x5e')]:_0x216f54[_0xfa3d('0x5e')],'id':_0x216f54['id']};}if(_0x216f54[_0xfa3d('0x40')]===_0xfa3d('0x50')){_0x269cec[_0xfa3d('0x5f')]={'name':!_[_0xfa3d('0x1e')](_0x216f54[_0xfa3d('0x5c')])?_0x216f54['Full_Name']:!_[_0xfa3d('0x1e')](_0x216f54['First_Name'])?_0x216f54['First_Name']+'\x20'+_0x216f54['Last_Name']:_0x216f54[_0xfa3d('0x5e')],'id':_0x216f54['id']};_0x269cec[_0xfa3d('0x60')]=_['startCase'](_0x216f54['enduserType']);}if(_0x4588c2[_0xfa3d('0x61')]){_0x269cec['Call_Duration']=moment[_0xfa3d('0x62')](parseInt(_0x4588c2[_0xfa3d('0x61')])*0x3e8)[_0xfa3d('0x32')](_0xfa3d('0x63'));}else if(_0x4588c2['answertime']&&_0x4588c2[_0xfa3d('0x64')]){_0x269cec['Call_Duration']=moment[_0xfa3d('0x62')](moment(_0x4588c2[_0xfa3d('0x64')],_0xfa3d('0x65'))['diff'](moment(_0x4588c2['starttime'],_0xfa3d('0x65'))))[_0xfa3d('0x32')](_0xfa3d('0x63'));}switch(_0x4588c2[_0xfa3d('0x66')]){case _0xfa3d('0x67'):_0x269cec[_0xfa3d('0x68')]=_0xfa3d('0x69');break;case _0xfa3d('0x6a'):case'connect':_0x269cec[_0xfa3d('0x68')]=_0xfa3d('0x6b');break;case _0xfa3d('0x6c'):_0x269cec[_0xfa3d('0x68')]=_0xfa3d('0x6d');break;case _0xfa3d('0x6e'):_0x269cec[_0xfa3d('0x68')]=_0xfa3d('0x6f');break;case _0xfa3d('0x70'):_0x269cec[_0xfa3d('0x68')]=_0xfa3d('0x71');default:}_0x269cec[_0xfa3d('0x72')]=(_0x5b9560===_0xfa3d('0x73')?moment(_0x4588c2[_0xfa3d('0x74')])['format'](_0xfa3d('0x65')):moment(_0x4588c2[_0xfa3d('0x75')])[_0xfa3d('0x32')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xfa3d('0x32')](_0xfa3d('0x65'));_0x269cec['Call_Type']=_0x5b9560||'Inbound';_0x269cec=_[_0xfa3d('0x76')](_0x269cec,getCustomFields(_0xd697af['Fields'],_0x4588c2));return request({'method':_0xfa3d('0x77'),'uri':_0xfa3d('0x4d')+_0x3516af+_0xfa3d('0x78'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x568f83},'body':{'data':[_0x269cec]},'json':!![]})[_0xfa3d('0x29')](function(_0xb7a512){if(_0xb7a512&&_0xb7a512[_0xfa3d('0x3f')][0x0][_0xfa3d('0x79')]===_0xfa3d('0x7a')){logger[_0xfa3d('0x2f')](_0xfa3d('0x7b'));return{'id':_0xb7a512[_0xfa3d('0x3f')][0x0][_0xfa3d('0x47')]['id']};}})[_0xfa3d('0x2d')](function(_0x78b488){logger[_0xfa3d('0x2f')](_0xfa3d('0x7c'),_0x78b488[_0xfa3d('0x2e')]);console[_0xfa3d('0x49')](_0xfa3d('0x7c'),_0x78b488);});}exports[_0xfa3d('0x7d')]=function(_0x188110,_0x20955d,_0x200ae7,_0x1ebe51,_0x1b4678,_0x20c7d5){var _0x3423ca,_0x347fec,_0x139d8c;_0x20c7d5['host']=intUtil[_0xfa3d('0x7e')](_0x20c7d5[_0xfa3d('0x7f')]);_0x20c7d5[_0xfa3d('0x80')]=intUtil[_0xfa3d('0x7e')](_0x20c7d5[_0xfa3d('0x80')]);if(_0x1b4678&&_0x1b4678[_0xfa3d('0x81')]){logger[_0xfa3d('0x2f')]('[QUEUE]',_0xfa3d('0x82'));_0x20955d[_0xfa3d('0x83')]=_0x20c7d5[_0xfa3d('0x80')]+_0xfa3d('0x84')+_0x20955d[_0xfa3d('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x20955d[_0xfa3d('0x85')]);}else{_0x20955d[_0xfa3d('0x83')]='';}var _0x1a4056=_0x20c7d5[_0xfa3d('0x7f')]===_0xfa3d('0x86')?'eu':'com';return getAccessToken(_0x20c7d5)[_0xfa3d('0x29')](function(_0x34ffad){_0x139d8c=_0x34ffad;return getUser(_0x139d8c,_0x1a4056,_0x20c7d5,_0x1ebe51[_0xfa3d('0x37')]);})[_0xfa3d('0x29')](function(_0x47e85c){_0x3423ca=_0x47e85c;logger[_0xfa3d('0x2f')](_0xfa3d('0x87'),_0x3423ca['id']);return getEndUser(_0x139d8c,_0x1a4056,_0x20c7d5,_0x20955d[_0xfa3d('0x88')],_0x20955d[_0xfa3d('0x89')],_0x3423ca,_0x200ae7);})[_0xfa3d('0x29')](function(_0x48e992){_0x347fec=_0x48e992;return getCall(_0x139d8c,_0x1a4056,_0x20c7d5,_0x3423ca,_0x347fec,_0x200ae7,_0x20955d,_0xfa3d('0x8a'));})[_0xfa3d('0x29')](function(_0x35bf44){if(_0x35bf44){logger[_0xfa3d('0x2f')](_0xfa3d('0x8b'),_0x35bf44['id']);logger[_0xfa3d('0x2f')](_0xfa3d('0x8c'),_0xfa3d('0x8d'));emit(util['format']('user:%s',_0x1ebe51[_0xfa3d('0x1b')]),'trigger:browser:url',{'uri':'https://crm.'+_0x20c7d5['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x35bf44['id']});}})[_0xfa3d('0x2d')](function(_0x5bf258){logger[_0xfa3d('0x3d')](_0xfa3d('0x8c'),JSON[_0xfa3d('0xe')](_0x5bf258));});};exports[_0xfa3d('0x73')]=function(_0x1a7e58,_0x3083d7,_0x5687ba,_0x20356f,_0x96ad11,_0x312723,_0x3ab08e){var _0x1a8f56,_0xcfdeaa,_0x4333ea;_0x312723[_0xfa3d('0x7f')]=intUtil[_0xfa3d('0x7e')](_0x312723[_0xfa3d('0x7f')]);_0x312723[_0xfa3d('0x80')]=intUtil[_0xfa3d('0x7e')](_0x312723[_0xfa3d('0x80')]);if(_0x3ab08e&&_0x3ab08e[_0xfa3d('0x8e')]&&_0x3ab08e[_0xfa3d('0x8e')]!=='none'){logger[_0xfa3d('0x2f')](_0xfa3d('0x8f'),_0xfa3d('0x82'));_0x3083d7['recordingURL']=_0x312723[_0xfa3d('0x80')]+_0xfa3d('0x84')+_0x3083d7[_0xfa3d('0x85')]+_0xfa3d('0x90')+md5(_0x3083d7[_0xfa3d('0x85')]);}var _0xec8610=_0x312723[_0xfa3d('0x7f')]===_0xfa3d('0x86')?'eu':_0xfa3d('0x91');return getAccessToken(_0x312723)[_0xfa3d('0x29')](function(_0x1c849f){_0x4333ea=_0x1c849f;return getUser(_0x4333ea,_0xec8610,_0x312723,_0x20356f[_0xfa3d('0x37')]);})['then'](function(_0x4dbb5f){_0x1a8f56=_0x4dbb5f;logger[_0xfa3d('0x2f')](_0xfa3d('0x87'),_0x1a8f56['id']);return getEndUser(_0x4333ea,_0xec8610,_0x312723,_0x3083d7[_0xfa3d('0x92')],_0x3083d7[_0xfa3d('0x93')],_0x1a8f56,_0x5687ba);})[_0xfa3d('0x29')](function(_0x3980ea){_0xcfdeaa=_0x3980ea;return getCall(_0x4333ea,_0xec8610,_0x312723,_0x1a8f56,_0xcfdeaa,_0x5687ba,_0x3083d7,_0xfa3d('0x94'));})[_0xfa3d('0x29')](function(_0x3491fd){if(_0x3491fd){logger['info']('The\x20Call\x20ID\x20is:',_0x3491fd['id']);logger[_0xfa3d('0x2f')](_0xfa3d('0x8f'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfa3d('0x32')](_0xfa3d('0x95'),_0x20356f['name']),'trigger:browser:url',{'uri':_0xfa3d('0x96')+_0x312723[_0xfa3d('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x3491fd['id']});}})[_0xfa3d('0x2d')](function(_0x5ed9be){logger['error']('[OUTBOUND]',JSON[_0xfa3d('0xe')](_0x5ed9be));});};exports['unmanaged']=function(_0x5b326e,_0x556167,_0x4b349c,_0x13ffdd,_0x1ccd5e,_0x378a42){var _0x19a3b1,_0x3d8756,_0x1ee0e9;_0x378a42['host']=intUtil[_0xfa3d('0x7e')](_0x378a42[_0xfa3d('0x7f')]);_0x378a42['serverUrl']=intUtil[_0xfa3d('0x7e')](_0x378a42[_0xfa3d('0x80')]);if(_0x1ccd5e&&_0x1ccd5e['monitor_format']){logger[_0xfa3d('0x2f')]('['+_0x556167[_0xfa3d('0x66')][_0xfa3d('0x97')]()+']',_0xfa3d('0x82'));_0x556167[_0xfa3d('0x83')]=_0x378a42[_0xfa3d('0x80')]+_0xfa3d('0x84')+_0x556167['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x556167[_0xfa3d('0x85')]);}else{_0x556167[_0xfa3d('0x83')]='';}var _0x3bd4b5=_0x378a42[_0xfa3d('0x7f')]===_0xfa3d('0x86')?'eu':_0xfa3d('0x91');return getAccessToken(_0x378a42)[_0xfa3d('0x29')](function(_0x358535){_0x1ee0e9=_0x358535;return getUser(_0x1ee0e9,_0x3bd4b5,_0x378a42);})[_0xfa3d('0x29')](function(_0x227191){_0x19a3b1=_0x227191;logger[_0xfa3d('0x2f')](_0xfa3d('0x87'),_0x19a3b1['id']);return getEndUser(_0x1ee0e9,_0x3bd4b5,_0x378a42,_0x556167['calleridname'],_0x556167[_0xfa3d('0x89')],_0x19a3b1,_0x4b349c);})[_0xfa3d('0x29')](function(_0x48003d){_0x3d8756=_0x48003d;return getCall(_0x1ee0e9,_0x3bd4b5,_0x378a42,_0x19a3b1,_0x3d8756,_0x4b349c,_0x556167,'Inbound');})[_0xfa3d('0x29')](function(_0x19902c){if(_0x19902c){logger[_0xfa3d('0x2f')](_0xfa3d('0x8b'),_0x19902c['id']);}})[_0xfa3d('0x2d')](function(_0x4d78bc){logger[_0xfa3d('0x3d')]('['+_0x556167[_0xfa3d('0x66')][_0xfa3d('0x97')]()+']',JSON['stringify'](_0x4d78bc));});}; \ 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 512175a..08a1a83 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 _0x3aaf=['util','shelljs','mustache','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x462577,_0x3a25c1){var _0x238cca=function(_0xe6f466){while(--_0xe6f466){_0x462577['push'](_0x462577['shift']());}};_0x238cca(++_0x3a25c1);}(_0x3aaf,0x1d4));var _0xf3aa=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x3aaf[_0x23e7c1];return _0x1add43;};'use strict';var util=require(_0xf3aa('0x0'));var sh=require(_0xf3aa('0x1'));var Mustache=require(_0xf3aa('0x2'));var logger=require('../../../../config/logger')('trigger');exports[_0xf3aa('0x3')]=function(_0x7e7b9,_0xff1a45){var _0x18afde=_0x7e7b9[_0xf3aa('0x4')]?_0x7e7b9[_0xf3aa('0x4')]:_0xf3aa('0x5');var _0x579bca=_0x7e7b9[_0xf3aa('0x6')]?Mustache[_0xf3aa('0x7')](_0x7e7b9['data3'],_0xff1a45):_0xff1a45;sh['exec'](_0x579bca,function(_0x1737b5,_0x4f9949,_0x2e3aa0){if(_0x1737b5!==0x0){logger[_0xf3aa('0x8')](util[_0xf3aa('0x9')](_0xf3aa('0xa'),_0x18afde,_0x579bca,_0x1737b5,_0x2e3aa0));}else{logger[_0xf3aa('0xb')](util['format'](_0xf3aa('0xc'),_0x18afde,_0x579bca,_0x4f9949));}});}; \ No newline at end of file +var _0x6cc9=['exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','util','mustache','../../../../config/logger','trigger'];(function(_0x5bd594,_0x2037eb){var _0x59754e=function(_0x321dec){while(--_0x321dec){_0x5bd594['push'](_0x5bd594['shift']());}};_0x59754e(++_0x2037eb);}(_0x6cc9,0x1a9));var _0x96cc=function(_0x200c2f,_0x542373){_0x200c2f=_0x200c2f-0x0;var _0x23fb44=_0x6cc9[_0x200c2f];return _0x23fb44;};'use strict';var util=require(_0x96cc('0x0'));var sh=require('shelljs');var Mustache=require(_0x96cc('0x1'));var logger=require(_0x96cc('0x2'))(_0x96cc('0x3'));exports[_0x96cc('0x4')]=function(_0x50ff6d,_0x4168f9){var _0x437173=_0x50ff6d[_0x96cc('0x5')]?_0x50ff6d[_0x96cc('0x5')]:_0x96cc('0x6');var _0x5019d4=_0x50ff6d[_0x96cc('0x7')]?Mustache[_0x96cc('0x8')](_0x50ff6d[_0x96cc('0x7')],_0x4168f9):_0x4168f9;sh[_0x96cc('0x4')](_0x5019d4,function(_0x32aed4,_0x39310d,_0x2bdbaf){if(_0x32aed4!==0x0){logger[_0x96cc('0x9')](util[_0x96cc('0xa')](_0x96cc('0xb'),_0x437173,_0x5019d4,_0x32aed4,_0x2bdbaf));}else{logger[_0x96cc('0xc')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x437173,_0x5019d4,_0x39310d));}});}; \ 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 41921df..58d1256 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 _0x0417=['isNil','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','util','lodash','mustache','trigger','exec','data1','toUpperCase','render','data2','data5','number','data6','parse','error','stack','POST','PUT','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','stringify','then'];(function(_0xd4e448,_0x588aba){var _0x19b0af=function(_0x3774df){while(--_0x3774df){_0xd4e448['push'](_0xd4e448['shift']());}};_0x19b0af(++_0x588aba);}(_0x0417,0xc2));var _0x7041=function(_0x2b99a3,_0x21cf2c){_0x2b99a3=_0x2b99a3-0x0;var _0x3a0450=_0x0417[_0x2b99a3];return _0x3a0450;};'use strict';var rp=require('request-promise');var util=require(_0x7041('0x0'));var _=require(_0x7041('0x1'));var Mustache=require(_0x7041('0x2'));var logger=require('../../../../config/logger')(_0x7041('0x3'));exports[_0x7041('0x4')]=function(_0x52fddc,_0x11ae45){var _0x56ddfd,_0x20ba68;var _0x1a066c={'method':_0x52fddc[_0x7041('0x5')][_0x7041('0x6')](),'uri':Mustache[_0x7041('0x7')](_0x52fddc[_0x7041('0x8')],_0x11ae45),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x52fddc[_0x7041('0x9')])===_0x7041('0xa')&&parseInt(_0x52fddc[_0x7041('0x9')])>=0x1&&parseInt(_0x52fddc['data5'])<=0xa?parseInt(_0x52fddc['data5'])*0x3e8:0x5*0x3e8};try{_0x1a066c['headers']=_0x52fddc[_0x7041('0xb')]?JSON[_0x7041('0xc')](Mustache[_0x7041('0x7')](_0x52fddc[_0x7041('0xb')],_0x11ae45)):{};}catch(_0x43f952){logger[_0x7041('0xd')](_0x43f952[_0x7041('0xe')]);}switch(_0x52fddc[_0x7041('0x5')][_0x7041('0x6')]()){case'GET':case'DELETE':_0x56ddfd=null;_0x1a066c['qs']=_0x11ae45;break;case _0x7041('0xf'):case _0x7041('0x10'):if(_0x52fddc['data7']){try{_0x56ddfd=JSON[_0x7041('0xc')](Mustache[_0x7041('0x7')](_0x52fddc['data7'],_0x11ae45));_0x1a066c[_0x7041('0x11')]=_0x56ddfd;}catch(_0x532f26){logger['error'](_0x532f26[_0x7041('0xe')]);logger['error'](_0x7041('0x12'));}}else{_0x56ddfd=_0x11ae45;_0x1a066c[_0x7041('0x11')]=_0x56ddfd;}break;}logger[_0x7041('0x13')](util[_0x7041('0x14')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x52fddc['data1'],_0x52fddc[_0x7041('0x8')],JSON[_0x7041('0x15')](_0x1a066c)));rp(_0x1a066c)[_0x7041('0x16')](function(_0x55ec17){_0x56ddfd=!_[_0x7041('0x17')](_0x56ddfd)?',\x20request\x20body:\x20'+_0x56ddfd:'';_0x20ba68=typeof _0x55ec17[_0x7041('0x11')]===_0x7041('0x18')?JSON[_0x7041('0x15')](_0x55ec17[_0x7041('0x11')]):_0x55ec17['body'];logger[_0x7041('0x13')](util[_0x7041('0x14')](_0x7041('0x19'),_0x52fddc[_0x7041('0x5')],_0x52fddc[_0x7041('0x8')],_0x55ec17['statusCode'],_0x20ba68));})[_0x7041('0x1a')](function(_0x4beb52){logger['error'](util[_0x7041('0x14')](_0x7041('0x1b'),_0x52fddc[_0x7041('0x5')],_0x52fddc[_0x7041('0x8')],_0x4beb52[_0x7041('0x1c')],_0x4beb52[_0x7041('0x1d')],_0x4beb52[_0x7041('0x1e')]));});}; \ No newline at end of file +var _0xcd7f=['data1','render','data5','number','headers','data6','parse','error','stack','toUpperCase','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','stringify','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data2','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','util','lodash','mustache','../../../../config/logger','trigger','exec'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xcd7f,0xae));var _0xfcd7=function(_0x11fbaa,_0x52dc16){_0x11fbaa=_0x11fbaa-0x0;var _0x1831fd=_0xcd7f[_0x11fbaa];return _0x1831fd;};'use strict';var rp=require('request-promise');var util=require(_0xfcd7('0x0'));var _=require(_0xfcd7('0x1'));var Mustache=require(_0xfcd7('0x2'));var logger=require(_0xfcd7('0x3'))(_0xfcd7('0x4'));exports[_0xfcd7('0x5')]=function(_0x22a47c,_0x48599c){var _0x1d17cc,_0x4771d4;var _0x2c55f3={'method':_0x22a47c[_0xfcd7('0x6')]['toUpperCase'](),'uri':Mustache[_0xfcd7('0x7')](_0x22a47c['data2'],_0x48599c),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x22a47c[_0xfcd7('0x8')])===_0xfcd7('0x9')&&parseInt(_0x22a47c[_0xfcd7('0x8')])>=0x1&&parseInt(_0x22a47c[_0xfcd7('0x8')])<=0xa?parseInt(_0x22a47c[_0xfcd7('0x8')])*0x3e8:0x5*0x3e8};try{_0x2c55f3[_0xfcd7('0xa')]=_0x22a47c[_0xfcd7('0xb')]?JSON[_0xfcd7('0xc')](Mustache[_0xfcd7('0x7')](_0x22a47c[_0xfcd7('0xb')],_0x48599c)):{};}catch(_0x5556d4){logger[_0xfcd7('0xd')](_0x5556d4[_0xfcd7('0xe')]);}switch(_0x22a47c[_0xfcd7('0x6')][_0xfcd7('0xf')]()){case _0xfcd7('0x10'):case _0xfcd7('0x11'):_0x1d17cc=null;_0x2c55f3['qs']=_0x48599c;break;case _0xfcd7('0x12'):case _0xfcd7('0x13'):if(_0x22a47c[_0xfcd7('0x14')]){try{_0x1d17cc=JSON[_0xfcd7('0xc')](Mustache[_0xfcd7('0x7')](_0x22a47c['data7'],_0x48599c));_0x2c55f3[_0xfcd7('0x15')]=_0x1d17cc;}catch(_0xc347c8){logger[_0xfcd7('0xd')](_0xc347c8[_0xfcd7('0xe')]);logger[_0xfcd7('0xd')](_0xfcd7('0x16'));}}else{_0x1d17cc=_0x48599c;_0x2c55f3[_0xfcd7('0x15')]=_0x1d17cc;}break;}logger[_0xfcd7('0x17')](util[_0xfcd7('0x18')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x22a47c[_0xfcd7('0x6')],_0x22a47c['data2'],JSON[_0xfcd7('0x19')](_0x2c55f3)));rp(_0x2c55f3)['then'](function(_0x3212ad){_0x1d17cc=!_[_0xfcd7('0x1a')](_0x1d17cc)?_0xfcd7('0x1b')+_0x1d17cc:'';_0x4771d4=typeof _0x3212ad['body']===_0xfcd7('0x1c')?JSON[_0xfcd7('0x19')](_0x3212ad[_0xfcd7('0x15')]):_0x3212ad[_0xfcd7('0x15')];logger['info'](util[_0xfcd7('0x18')](_0xfcd7('0x1d'),_0x22a47c[_0xfcd7('0x6')],_0x22a47c[_0xfcd7('0x1e')],_0x3212ad[_0xfcd7('0x1f')],_0x4771d4));})[_0xfcd7('0x20')](function(_0x5bb704){logger[_0xfcd7('0xd')](util[_0xfcd7('0x18')](_0xfcd7('0x21'),_0x22a47c[_0xfcd7('0x6')],_0x22a47c[_0xfcd7('0x1e')],_0x5bb704['statusCode'],_0x5bb704[_0xfcd7('0x22')],_0x5bb704[_0xfcd7('0x23')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index f0084f2..49303b4 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 _0xa8f2=['Request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa8f2,0xf9));var _0x2a8f=function(_0x48c9fe,_0x27e842){_0x48c9fe=_0x48c9fe-0x0;var _0x4dc475=_0xa8f2[_0x48c9fe];return _0x4dc475;};'use strict';var jayson=require(_0x2a8f('0x0'));var BPromise=require(_0x2a8f('0x1'));var logger=require(_0x2a8f('0x2'))(_0x2a8f('0x3'));var client=jayson[_0x2a8f('0x4')][_0x2a8f('0x5')]({'port':0x2329});client[_0x2a8f('0x6')]=function(_0x393183,_0x153ad7){return new BPromise(function(_0x45d310,_0x484e42){return client['request'](_0x393183,_0x153ad7)[_0x2a8f('0x7')](function(_0x37a91c){logger[_0x2a8f('0x8')](_0x2a8f('0x9'),_0x2a8f('0x3'),_0x393183,_0x153ad7,_0x37a91c);if(_0x37a91c[_0x2a8f('0xa')]){logger[_0x2a8f('0xa')](_0x2a8f('0x9'),_0x2a8f('0x3'),_0x393183,_0x37a91c[_0x2a8f('0xa')]['message'],_0x153ad7);return _0x484e42(_0x37a91c[_0x2a8f('0xa')][_0x2a8f('0xb')]);}else{return _0x45d310(_0x37a91c[_0x2a8f('0xc')]);}})[_0x2a8f('0xd')](function(_0x3daca6){logger[_0x2a8f('0xa')](_0x2a8f('0x9'),_0x2a8f('0x3'),_0x393183,_0x3daca6,_0x153ad7);return _0x484e42(_0x3daca6);});});};module[_0x2a8f('0xe')]=client; \ No newline at end of file +var _0x80a3=['error','message','result','catch','exports','jayson/promise','Request','request','then','rpc','routing'];(function(_0x364852,_0x17691e){var _0x2ec071=function(_0x5608a1){while(--_0x5608a1){_0x364852['push'](_0x364852['shift']());}};_0x2ec071(++_0x17691e);}(_0x80a3,0x17b));var _0x380a=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x80a3[_0x36dfbd];return _0x4ecad9;};'use strict';var jayson=require(_0x380a('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('routing');var client=jayson['client']['http']({'port':0x2329});client[_0x380a('0x1')]=function(_0x27f46c,_0x1cac98){return new BPromise(function(_0x1b508d,_0x377bce){return client[_0x380a('0x2')](_0x27f46c,_0x1cac98)[_0x380a('0x3')](function(_0xf23456){logger['debug'](_0x380a('0x4'),_0x380a('0x5'),_0x27f46c,_0x1cac98,_0xf23456);if(_0xf23456[_0x380a('0x6')]){logger['error'](_0x380a('0x4'),_0x380a('0x5'),_0x27f46c,_0xf23456[_0x380a('0x6')][_0x380a('0x7')],_0x1cac98);return _0x377bce(_0xf23456['error'][_0x380a('0x7')]);}else{return _0x1b508d(_0xf23456[_0x380a('0x8')]);}})[_0x380a('0x9')](function(_0x2ac144){logger['error'](_0x380a('0x4'),_0x380a('0x5'),_0x27f46c,_0x2ac144,_0x1cac98);return _0x377bce(_0x2ac144);});});};module[_0x380a('0xa')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index f94f4b0..0cde6ac 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 _0xcd89=['then','initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency','log','./server','./realtime','./lib/email','./rpc/setting','resolve'];(function(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0xcd89,0x67));var _0x9cd8=function(_0x2d8584,_0x354347){_0x2d8584=_0x2d8584-0x0;var _0x5c72e4=_0xcd89[_0x2d8584];return _0x5c72e4;};'use strict';var BPromise=require('bluebird');var server=require(_0x9cd8('0x0'));var Realtime=require(_0x9cd8('0x1'));var EmailChannel=require(_0x9cd8('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x9cd8('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x9cd8('0x4')]()[_0x9cd8('0x5')](mailAccount['getMailAccounts']())[_0x9cd8('0x5')](realtime[_0x9cd8('0x6')]())[_0x9cd8('0x5')](function(){email['refresh'](realtime[_0x9cd8('0x7')]);return realtime;});}function main(){return server[_0x9cd8('0x8')](realtime,email)['then'](function(){return initRealtime();})[_0x9cd8('0x5')](function(){return setting[_0x9cd8('0x9')]();})[_0x9cd8('0x5')](function(_0x1aae21){return setInterval(initRealtime,_0x1aae21[_0x9cd8('0xa')]*0x3e8);})['catch'](function(_0x3c65a2){console[_0x9cd8('0xb')](_0x3c65a2);});}main(); \ No newline at end of file +var _0x16e8=['catch','./server','./realtime','./lib/email','./rpc/setting','resolve','then','mailAccounts','getSettings'];(function(_0x1c584e,_0x339336){var _0xbdbb59=function(_0xbf9f41){while(--_0xbf9f41){_0x1c584e['push'](_0x1c584e['shift']());}};_0xbdbb59(++_0x339336);}(_0x16e8,0x106));var _0x816e=function(_0x502c99,_0x18f93d){_0x502c99=_0x502c99-0x0;var _0x22a6a0=_0x16e8[_0x502c99];return _0x22a6a0;};'use strict';var BPromise=require('bluebird');var server=require(_0x816e('0x0'));var Realtime=require(_0x816e('0x1'));var EmailChannel=require(_0x816e('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x816e('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x816e('0x4')]()[_0x816e('0x5')](mailAccount['getMailAccounts']())[_0x816e('0x5')](realtime['initMailAccounts']())[_0x816e('0x5')](function(){email['refresh'](realtime[_0x816e('0x6')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x816e('0x5')](function(){return initRealtime();})[_0x816e('0x5')](function(){return setting[_0x816e('0x7')]();})['then'](function(_0xdb17b0){return setInterval(initRealtime,_0xdb17b0['loginMailFrequency']*0x3e8);})[_0x816e('0x8')](function(_0x49a325){console['log'](_0x49a325);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 62fbe84..1d39fdc 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 _0xe8aa=['Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','verify','verified','catch','exports','lodash','bluebird','md5','ioredis','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','smtp','emit','key','active','Imap','status','total','isNil','prototype','refresh','hasOwnProperty','imapAccounts','box','handleImapBox','end','handleImapEnd','bind','error','mailAccounts','disabled','messageStatus','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','info'];(function(_0x4d934b,_0x52f8e9){var _0xc0338b=function(_0x1a356c){while(--_0x1a356c){_0x4d934b['push'](_0x4d934b['shift']());}};_0xc0338b(++_0x52f8e9);}(_0xe8aa,0x1f3));var _0xae8a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe8aa[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xae8a('0x0'));var moment=require('moment');var BPromise=require(_0xae8a('0x1'));var md5=require(_0xae8a('0x2'));var Redis=require(_0xae8a('0x3'));var config=require('../../../config/environment');var logger=require(_0xae8a('0x4'))(_0xae8a('0x5'));config['redis']=_['defaults'](config[_0xae8a('0x6')],{'host':_0xae8a('0x7'),'port':0x18eb});var io=require(_0xae8a('0x8'))(new Redis(config[_0xae8a('0x6')]));var EmailImap=require(_0xae8a('0x9'));var EmailSmtp=require(_0xae8a('0xa'));var mailAccount=require(_0xae8a('0xb'));var md5Accounts={};function EmailChannel(_0x3bdf3a){logger['info']('start\x20email\x20channel');this['mailAccounts']=_0x3bdf3a['mailAccounts'];this['imapAccounts']={};this[_0xae8a('0xc')]=new EmailSmtp();}EmailChannel['prototype'][_0xae8a('0xd')]=function(_0x505125){var _0x33da65=this['mailAccounts'][_0x505125];var _0x1f9a3e={'id':_0x33da65['id'],'name':_0x33da65['name'],'key':_0x33da65[_0xae8a('0xe')],'active':_0x33da65[_0xae8a('0xf')],'Imap':{'status':_0x33da65[_0xae8a('0x10')][_0xae8a('0x11')],'messageStatus':_0x33da65[_0xae8a('0x10')]['messageStatus'],'total':_0x33da65[_0xae8a('0x10')][_0xae8a('0x12')]}};if(_[_0xae8a('0x13')](md5Accounts[_0x505125])){md5Accounts[_0x505125]={};}var _0x114935=md5(JSON['stringify'](_0x1f9a3e));if(md5Accounts[_0x505125][_0xae8a('0x2')]!==_0x114935){md5Accounts[_0x505125][_0xae8a('0x2')]=_0x114935;io[_0xae8a('0xd')]('mailAccount:update',_0x1f9a3e);}};EmailChannel[_0xae8a('0x14')][_0xae8a('0x15')]=function(_0x28a068){for(var _0x5c1cdf in _0x28a068){if(_0x28a068[_0xae8a('0x16')](_0x5c1cdf)){if(_0x28a068[_0x5c1cdf][_0xae8a('0x10')]&&_0x28a068[_0x5c1cdf][_0xae8a('0xf')]){var _0x1cafd3=_0x28a068[_0x5c1cdf][_0xae8a('0x10')];if(!this['imapAccounts'][_0xae8a('0x16')](_0x1cafd3['id'])){this['imapAccounts'][_0x1cafd3['id']]=new EmailImap(_0x1cafd3,_0x28a068[_0x5c1cdf][_0xae8a('0x5')]);this[_0xae8a('0x17')][_0x1cafd3['id']]['on'](_0xae8a('0x18'),this[_0xae8a('0x19')]['bind'](this,_0x5c1cdf));this[_0xae8a('0x17')][_0x1cafd3['id']]['on'](_0xae8a('0x5'),this['handleImapEmail']['bind'](this,_0x5c1cdf));this[_0xae8a('0x17')][_0x1cafd3['id']]['on'](_0xae8a('0x1a'),this[_0xae8a('0x1b')][_0xae8a('0x1c')](this,_0x5c1cdf));this['imapAccounts'][_0x1cafd3['id']]['on'](_0xae8a('0x1d'),this['handleImapError'][_0xae8a('0x1c')](this,_0x5c1cdf));}}else{if(_[_0xae8a('0x13')](this[_0xae8a('0x1e')][_0x5c1cdf]['Imap'])){this[_0xae8a('0x1e')][_0x5c1cdf]['Imap']={};}this[_0xae8a('0x1e')][_0x5c1cdf]['Imap'][_0xae8a('0x11')]=_0xae8a('0x1f');this[_0xae8a('0x1e')][_0x5c1cdf][_0xae8a('0x10')][_0xae8a('0x20')]='';this[_0xae8a('0xd')](_0x5c1cdf);}}}};EmailChannel[_0xae8a('0x14')][_0xae8a('0x19')]=function(_0x210361,_0x9efa04){if(this[_0xae8a('0x1e')][_0x210361]){this[_0xae8a('0x1e')][_0x210361][_0xae8a('0x10')][_0xae8a('0x11')]='connected';this[_0xae8a('0x1e')][_0x210361][_0xae8a('0x10')]['messageStatus']=_0x9efa04[_0xae8a('0x21')];if(_0x9efa04[_0xae8a('0x22')]){this[_0xae8a('0x1e')][_0x210361][_0xae8a('0x10')]['total']=_0x9efa04[_0xae8a('0x22')][_0xae8a('0x12')];}return this[_0xae8a('0xd')](_0x210361);}};EmailChannel[_0xae8a('0x14')]['handleImapEmail']=function(_0xa6594e,_0x15031d){logger['info'](_0xae8a('0x23'),_0x15031d[_0xae8a('0x24')],_0x15031d[_0xae8a('0x25')],_0x15031d[_0xae8a('0x26')],_0xa6594e);if(this['mailAccounts'][_0xa6594e]){return mailAccount['notify'](_0xa6594e,_0x15031d)[_0xae8a('0x27')](function(_0x57e5fb){if(_0x57e5fb){logger[_0xae8a('0x28')](_0xae8a('0x29'));}})['catch'](function(_0x234710){logger['error'](_0xae8a('0x2a'),JSON[_0xae8a('0x2b')](_0x234710));});}};EmailChannel[_0xae8a('0x14')][_0xae8a('0x1b')]=function(_0x19a7ca){if(this[_0xae8a('0x1e')][_0x19a7ca]&&this[_0xae8a('0x1e')][_0x19a7ca][_0xae8a('0x10')]){if(this[_0xae8a('0x17')][this[_0xae8a('0x1e')][_0x19a7ca]['Imap']['id']]){delete this[_0xae8a('0x17')][this[_0xae8a('0x1e')][_0x19a7ca][_0xae8a('0x10')]['id']];}this[_0xae8a('0x1e')][_0x19a7ca][_0xae8a('0x10')][_0xae8a('0x2c')]=moment();this['emit'](_0x19a7ca);}};EmailChannel[_0xae8a('0x14')][_0xae8a('0x2d')]=function(_0x5cbd01,_0x308235){if(this[_0xae8a('0x1e')][_0x5cbd01]){this[_0xae8a('0x1e')][_0x5cbd01][_0xae8a('0x10')][_0xae8a('0x11')]=_0xae8a('0x1d');this['mailAccounts'][_0x5cbd01][_0xae8a('0x10')]['messageStatus']=_0x308235;return this[_0xae8a('0xd')](_0x5cbd01);}};EmailChannel[_0xae8a('0x14')][_0xae8a('0x2e')]=function(_0x1fa134,_0x42c935){return this[_0xae8a('0xc')][_0xae8a('0x2f')](_0x1fa134,_0x42c935);};EmailChannel[_0xae8a('0x14')][_0xae8a('0x30')]=function(_0x28684d){var _0x42c74f=this;if(this[_0xae8a('0x1e')][_0x28684d['id']]){if(_[_0xae8a('0x13')](this['mailAccounts'][_0x28684d['id']][_0xae8a('0x31')])){this[_0xae8a('0x1e')][_0x28684d['id']]['Smtp']={};}this[_0xae8a('0x1e')][_0x28684d['id']][_0xae8a('0x31')]['lastSync']=moment();return new BPromise(function(_0x47c31b,_0xa978f8){return _0x42c74f['smtp'][_0xae8a('0x32')](_0x28684d)[_0xae8a('0x27')](function(_0x4bddd2){_0x42c74f[_0xae8a('0x1e')][_0x28684d['id']]['Smtp'][_0xae8a('0x11')]=_0xae8a('0x33');_0x42c74f[_0xae8a('0x1e')][_0x28684d['id']][_0xae8a('0x31')][_0xae8a('0x20')]='';_0x42c74f[_0xae8a('0xd')](_0x28684d['id']);_0x47c31b(_0x4bddd2);})[_0xae8a('0x34')](function(_0x591242){_0x42c74f[_0xae8a('0x1e')][_0x28684d['id']][_0xae8a('0x31')]['status']=_0xae8a('0x1d');_0x42c74f[_0xae8a('0x1e')][_0x28684d['id']]['Smtp']['messageStatus']=_0x591242;_0x42c74f[_0xae8a('0xd')](_0x28684d['id']);_0xa978f8(_0x591242);});});}return this[_0xae8a('0xc')][_0xae8a('0x32')](_0x28684d);};module[_0xae8a('0x35')]=EmailChannel; \ No newline at end of file +var _0xab03=['./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','name','key','active','Imap','messageStatus','isNil','emit','mailAccount:update','refresh','hasOwnProperty','imapAccounts','handleImapBox','handleImapEmail','end','handleImapEnd','error','handleImapError','bind','status','disabled','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter'];(function(_0xcba4b6,_0x1ecf6a){var _0x2bd8bf=function(_0x46812a){while(--_0x46812a){_0xcba4b6['push'](_0xcba4b6['shift']());}};_0x2bd8bf(++_0x1ecf6a);}(_0xab03,0x185));var _0x3ab0=function(_0x218e0b,_0x1de408){_0x218e0b=_0x218e0b-0x0;var _0x19a20c=_0xab03[_0x218e0b];return _0x19a20c;};'use strict';var _=require(_0x3ab0('0x0'));var moment=require(_0x3ab0('0x1'));var BPromise=require(_0x3ab0('0x2'));var md5=require(_0x3ab0('0x3'));var Redis=require(_0x3ab0('0x4'));var config=require(_0x3ab0('0x5'));var logger=require(_0x3ab0('0x6'))('email');config['redis']=_['defaults'](config[_0x3ab0('0x7')],{'host':_0x3ab0('0x8'),'port':0x18eb});var io=require(_0x3ab0('0x9'))(new Redis(config['redis']));var EmailImap=require(_0x3ab0('0xa'));var EmailSmtp=require(_0x3ab0('0xb'));var mailAccount=require(_0x3ab0('0xc'));var md5Accounts={};function EmailChannel(_0x4aeab1){logger[_0x3ab0('0xd')](_0x3ab0('0xe'));this[_0x3ab0('0xf')]=_0x4aeab1[_0x3ab0('0xf')];this['imapAccounts']={};this[_0x3ab0('0x10')]=new EmailSmtp();}EmailChannel[_0x3ab0('0x11')]['emit']=function(_0xea64db){var _0x4d9982=this[_0x3ab0('0xf')][_0xea64db];var _0x416569={'id':_0x4d9982['id'],'name':_0x4d9982[_0x3ab0('0x12')],'key':_0x4d9982[_0x3ab0('0x13')],'active':_0x4d9982[_0x3ab0('0x14')],'Imap':{'status':_0x4d9982[_0x3ab0('0x15')]['status'],'messageStatus':_0x4d9982[_0x3ab0('0x15')][_0x3ab0('0x16')],'total':_0x4d9982[_0x3ab0('0x15')]['total']}};if(_[_0x3ab0('0x17')](md5Accounts[_0xea64db])){md5Accounts[_0xea64db]={};}var _0x3d0f48=md5(JSON['stringify'](_0x416569));if(md5Accounts[_0xea64db][_0x3ab0('0x3')]!==_0x3d0f48){md5Accounts[_0xea64db][_0x3ab0('0x3')]=_0x3d0f48;io[_0x3ab0('0x18')](_0x3ab0('0x19'),_0x416569);}};EmailChannel[_0x3ab0('0x11')][_0x3ab0('0x1a')]=function(_0x245008){for(var _0x458201 in _0x245008){if(_0x245008[_0x3ab0('0x1b')](_0x458201)){if(_0x245008[_0x458201]['Imap']&&_0x245008[_0x458201]['active']){var _0x470cdb=_0x245008[_0x458201][_0x3ab0('0x15')];if(!this[_0x3ab0('0x1c')][_0x3ab0('0x1b')](_0x470cdb['id'])){this[_0x3ab0('0x1c')][_0x470cdb['id']]=new EmailImap(_0x470cdb,_0x245008[_0x458201]['email']);this[_0x3ab0('0x1c')][_0x470cdb['id']]['on']('box',this[_0x3ab0('0x1d')]['bind'](this,_0x458201));this[_0x3ab0('0x1c')][_0x470cdb['id']]['on']('email',this[_0x3ab0('0x1e')]['bind'](this,_0x458201));this[_0x3ab0('0x1c')][_0x470cdb['id']]['on'](_0x3ab0('0x1f'),this[_0x3ab0('0x20')]['bind'](this,_0x458201));this[_0x3ab0('0x1c')][_0x470cdb['id']]['on'](_0x3ab0('0x21'),this[_0x3ab0('0x22')][_0x3ab0('0x23')](this,_0x458201));}}else{if(_['isNil'](this['mailAccounts'][_0x458201]['Imap'])){this[_0x3ab0('0xf')][_0x458201][_0x3ab0('0x15')]={};}this[_0x3ab0('0xf')][_0x458201]['Imap'][_0x3ab0('0x24')]=_0x3ab0('0x25');this[_0x3ab0('0xf')][_0x458201][_0x3ab0('0x15')][_0x3ab0('0x16')]='';this['emit'](_0x458201);}}}};EmailChannel[_0x3ab0('0x11')][_0x3ab0('0x1d')]=function(_0x47cb7f,_0x75fbfe){if(this[_0x3ab0('0xf')][_0x47cb7f]){this[_0x3ab0('0xf')][_0x47cb7f][_0x3ab0('0x15')][_0x3ab0('0x24')]='connected';this[_0x3ab0('0xf')][_0x47cb7f][_0x3ab0('0x15')]['messageStatus']=_0x75fbfe[_0x3ab0('0x12')];if(_0x75fbfe[_0x3ab0('0x26')]){this[_0x3ab0('0xf')][_0x47cb7f][_0x3ab0('0x15')][_0x3ab0('0x27')]=_0x75fbfe[_0x3ab0('0x26')]['total'];}return this[_0x3ab0('0x18')](_0x47cb7f);}};EmailChannel[_0x3ab0('0x11')]['handleImapEmail']=function(_0x44a363,_0xc082a){logger[_0x3ab0('0xd')](_0x3ab0('0x28'),_0xc082a[_0x3ab0('0x29')],_0xc082a['lastName'],_0xc082a[_0x3ab0('0x2a')],_0x44a363);if(this[_0x3ab0('0xf')][_0x44a363]){return mailAccount[_0x3ab0('0x2b')](_0x44a363,_0xc082a)[_0x3ab0('0x2c')](function(_0xe7c4c6){if(_0xe7c4c6){logger[_0x3ab0('0xd')](_0x3ab0('0x2d'));}})[_0x3ab0('0x2e')](function(_0x553b46){logger[_0x3ab0('0x21')](_0x3ab0('0x2f'),JSON[_0x3ab0('0x30')](_0x553b46));});}};EmailChannel['prototype'][_0x3ab0('0x20')]=function(_0x5988ee){if(this[_0x3ab0('0xf')][_0x5988ee]&&this[_0x3ab0('0xf')][_0x5988ee][_0x3ab0('0x15')]){if(this[_0x3ab0('0x1c')][this[_0x3ab0('0xf')][_0x5988ee][_0x3ab0('0x15')]['id']]){delete this[_0x3ab0('0x1c')][this[_0x3ab0('0xf')][_0x5988ee]['Imap']['id']];}this[_0x3ab0('0xf')][_0x5988ee][_0x3ab0('0x15')]['lastSync']=moment();this[_0x3ab0('0x18')](_0x5988ee);}};EmailChannel[_0x3ab0('0x11')][_0x3ab0('0x22')]=function(_0x2bfc4e,_0x44421a){if(this[_0x3ab0('0xf')][_0x2bfc4e]){this[_0x3ab0('0xf')][_0x2bfc4e][_0x3ab0('0x15')][_0x3ab0('0x24')]=_0x3ab0('0x21');this[_0x3ab0('0xf')][_0x2bfc4e][_0x3ab0('0x15')][_0x3ab0('0x16')]=_0x44421a;return this['emit'](_0x2bfc4e);}};EmailChannel['prototype'][_0x3ab0('0x31')]=function(_0x251425,_0x3678d3){return this['smtp'][_0x3ab0('0x32')](_0x251425,_0x3678d3);};EmailChannel[_0x3ab0('0x11')][_0x3ab0('0x33')]=function(_0x6a31fe){var _0x58d868=this;if(this['mailAccounts'][_0x6a31fe['id']]){if(_[_0x3ab0('0x17')](this[_0x3ab0('0xf')][_0x6a31fe['id']]['Smtp'])){this[_0x3ab0('0xf')][_0x6a31fe['id']][_0x3ab0('0x34')]={};}this[_0x3ab0('0xf')][_0x6a31fe['id']][_0x3ab0('0x34')][_0x3ab0('0x35')]=moment();return new BPromise(function(_0x507379,_0xb33eea){return _0x58d868[_0x3ab0('0x10')][_0x3ab0('0x36')](_0x6a31fe)[_0x3ab0('0x2c')](function(_0x2c3eac){_0x58d868['mailAccounts'][_0x6a31fe['id']][_0x3ab0('0x34')][_0x3ab0('0x24')]=_0x3ab0('0x37');_0x58d868[_0x3ab0('0xf')][_0x6a31fe['id']]['Smtp']['messageStatus']='';_0x58d868[_0x3ab0('0x18')](_0x6a31fe['id']);_0x507379(_0x2c3eac);})[_0x3ab0('0x2e')](function(_0x5c07b0){_0x58d868[_0x3ab0('0xf')][_0x6a31fe['id']][_0x3ab0('0x34')][_0x3ab0('0x24')]='error';_0x58d868['mailAccounts'][_0x6a31fe['id']][_0x3ab0('0x34')][_0x3ab0('0x16')]=_0x5c07b0;_0x58d868['emit'](_0x6a31fe['id']);_0xb33eea(_0x5c07b0);});});}return this[_0x3ab0('0x10')]['verify'](_0x6a31fe);};module[_0x3ab0('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 48ba361..a38a019 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 _0xc36a=['handleError','bind','connect','inherits','getAccount','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','getHost','anonymous@xcally.com','handleReady','openBox','prototype','handleCloseBox','readUnseen','search','UNSEEN','length','fetch','message','handleFetchMessage','error','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','emit','account','textCode','exports','path','util','lodash','mailparser','simpleParser','events','./utils','../../../config/logger','email','INBOX','imap','once','ready','end','handleEnd'];(function(_0x3650a8,_0x44b7ad){var _0x8d27be=function(_0x244d1e){while(--_0x244d1e){_0x3650a8['push'](_0x3650a8['shift']());}};_0x8d27be(++_0x44b7ad);}(_0xc36a,0x180));var _0xac36=function(_0x27e670,_0x28479b){_0x27e670=_0x27e670-0x0;var _0x2029f8=_0xc36a[_0x27e670];return _0x2029f8;};'use strict';var fs=require('fs');var path=require(_0xac36('0x0'));var util=require(_0xac36('0x1'));var Imap=require('imap');var _=require(_0xac36('0x2'));var rs=require('randomstring');var simpleParser=require(_0xac36('0x3'))[_0xac36('0x4')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0xac36('0x5'))['EventEmitter'];var utils=require(_0xac36('0x6'));var logger=require(_0xac36('0x7'))(_0xac36('0x8'));function EmailImap(_0xa2f50e,_0x4a72ab){this['mailbox']=_0xac36('0x9');this['account']=this['getAccount'](_0xa2f50e,_0x4a72ab);this[_0xac36('0xa')]=new Imap(this['account']);this[_0xac36('0xa')][_0xac36('0xb')](_0xac36('0xc'),this['handleReady']['bind'](this));this[_0xac36('0xa')][_0xac36('0xb')](_0xac36('0xd'),this[_0xac36('0xe')]['bind'](this));this[_0xac36('0xa')]['on']('error',this[_0xac36('0xf')][_0xac36('0x10')](this));this[_0xac36('0xa')][_0xac36('0x11')]();}util[_0xac36('0x12')](EmailImap,EventEmitter);EmailImap['prototype'][_0xac36('0x13')]=function(_0x427799,_0x30b786){var _0x504ee1={'connTimeout':_0x427799['connTimeout']?_0x427799[_0xac36('0x14')]*0x3e8:0x2710,'authTimeout':_0x427799['authTimeout']?_0x427799[_0xac36('0x15')]*0x3e8:0x1388};if(_[_0xac36('0x16')](_0x427799[_0xac36('0x17')])){if(_0x427799[_0xac36('0x18')]){_0x504ee1[_0xac36('0x19')]=_0x427799['user'];_0x504ee1['password']=_0x427799[_0xac36('0x1a')];}_0x504ee1[_0xac36('0x1b')]=_0x427799['host'];_0x504ee1[_0xac36('0x1c')]=_0x427799['port']||0x3e1;if(_0x427799[_0xac36('0x1d')]){_0x504ee1['tls']=!![];}else{_0x504ee1[_0xac36('0x1d')]=![];_0x504ee1['autotls']='required';}}else{_0x504ee1['user']=_0x427799[_0xac36('0x19')];_0x504ee1['password']=_0x427799[_0xac36('0x1a')];_0x504ee1[_0xac36('0x1b')]=utils[_0xac36('0x1e')](_0x427799[_0xac36('0x17')]);_0x504ee1[_0xac36('0x1c')]=0x3e1;_0x504ee1[_0xac36('0x1d')]=!![];}_0x504ee1[_0xac36('0x8')]=_0x30b786||_0x427799[_0xac36('0x19')]||_0xac36('0x1f');return _0x504ee1;};EmailImap['prototype'][_0xac36('0x20')]=function(){this[_0xac36('0xa')][_0xac36('0x21')](this['mailbox'],![],this['handleOpenBox'][_0xac36('0x10')](this));};EmailImap[_0xac36('0x22')]['handleOpenBox']=function(_0x537cbd,_0x48bf58){if(_0x537cbd){this[_0xac36('0xf')](_0x537cbd,!![]);}else{this['emit']('box',_0x48bf58);this['readUnseen']();}};EmailImap[_0xac36('0x22')][_0xac36('0x23')]=function(_0x4fa0b5){if(_0x4fa0b5){this[_0xac36('0xf')](_0x4fa0b5,!![]);}else{this[_0xac36('0xa')][_0xac36('0xd')]();}};EmailImap[_0xac36('0x22')][_0xac36('0x24')]=function(){this['imap'][_0xac36('0x25')]([_0xac36('0x26')],this['handleReadUnseen'][_0xac36('0x10')](this));};EmailImap[_0xac36('0x22')]['handleReadUnseen']=function(_0x1a14e3,_0x382777){if(_0x1a14e3){this[_0xac36('0xf')](_0x1a14e3,!![]);}else{if(_0x382777[_0xac36('0x27')]){try{var _0x4fce15=this[_0xac36('0xa')][_0xac36('0x28')](_0x382777,{'bodies':'','markSeen':!![]});_0x4fce15['on'](_0xac36('0x29'),this[_0xac36('0x2a')][_0xac36('0x10')](this));_0x4fce15[_0xac36('0xb')](_0xac36('0x2b'),this['handleFetchError']['bind'](this));_0x4fce15['once'](_0xac36('0xd'),this[_0xac36('0x2c')][_0xac36('0x10')](this));}catch(_0x3c68e7){logger['error'](_0x3c68e7);}}else{this[_0xac36('0xa')][_0xac36('0x2d')](!![],this[_0xac36('0x23')][_0xac36('0x10')](this));}}};EmailImap[_0xac36('0x22')]['handleFetchMessage']=function(_0x5e7fa7,_0x6b8131){_0x5e7fa7['on'](_0xac36('0x2e'),this['handleMessageBody'][_0xac36('0x10')](this));_0x5e7fa7[_0xac36('0xb')](_0xac36('0x2f'),this[_0xac36('0x30')]['bind'](this));_0x5e7fa7['once'](_0xac36('0xd'),this[_0xac36('0x31')]['bind'](this));};EmailImap[_0xac36('0x22')][_0xac36('0x32')]=function(_0x4688b,_0x330438){simpleParser(_0x4688b,{'Iconv':Iconv},this[_0xac36('0x33')][_0xac36('0x10')](this));};EmailImap['prototype'][_0xac36('0x30')]=function(_0x173e72){};EmailImap[_0xac36('0x22')][_0xac36('0x31')]=function(){};EmailImap[_0xac36('0x22')][_0xac36('0x33')]=function(_0x2a0ea8,_0x454e1c){if(_0x2a0ea8){logger[_0xac36('0x2b')](_0x2a0ea8);}else{var _0x2f8cea=this;utils[_0xac36('0x34')](this['account'],_0x454e1c,function(_0x1962ca){_0x2f8cea['emit'](_0xac36('0x8'),_0x1962ca);});}};EmailImap[_0xac36('0x22')]['handleFetchEnd']=function(){this['imap'][_0xac36('0x2d')](!![],this['handleCloseBox'][_0xac36('0x10')](this));};EmailImap['prototype']['handleFetchError']=function(_0x4d6651){this[_0xac36('0xf')](_0x4d6651);this[_0xac36('0xa')]['closeBox'](!![],this[_0xac36('0x23')][_0xac36('0x10')](this));};EmailImap['prototype'][_0xac36('0xe')]=function(){this[_0xac36('0x35')](_0xac36('0xd'));};EmailImap['prototype'][_0xac36('0xf')]=function(_0x39cba1,_0x39fb36){logger['error'](_0xac36('0xf'),this[_0xac36('0x36')][_0xac36('0x8')],JSON['stringify'](_0x39cba1));var _0x52b32a='';if(_0x39cba1){if(_0x39cba1[_0xac36('0x37')]){_0x52b32a=_0x39cba1[_0xac36('0x37')];}else{for(var _0x3b3ea7 in _0x39cba1){if(_0x39cba1['hasOwnProperty'](_0x3b3ea7)){_0x52b32a+=_['upperFirst'](_0x3b3ea7)+':\x20'+_0x39cba1[_0x3b3ea7]+'\x0a';}}}}if(_0x39fb36){this[_0xac36('0xa')][_0xac36('0xd')]();}else{this[_0xac36('0x35')]('error',_0x52b32a);this['emit'](_0xac36('0xd'));}};module[_0xac36('0x38')]=EmailImap; \ No newline at end of file +var _0x3dcb=['end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','handleReadUnseen','length','message','handleFetchMessage','handleFetchEnd','closeBox','attributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleMessageAttributes','parser','email','handleFetchError','stringify','textCode','upperFirst','path','util','lodash','mailparser','simpleParser','iconv','events','./utils','../../../config/logger','mailbox','INBOX','account','getAccount','imap','once','ready','handleReady','bind'];(function(_0x29ce17,_0x100ee2){var _0x51bf75=function(_0x5d6958){while(--_0x5d6958){_0x29ce17['push'](_0x29ce17['shift']());}};_0x51bf75(++_0x100ee2);}(_0x3dcb,0xe6));var _0xb3dc=function(_0x2e7b36,_0x291e75){_0x2e7b36=_0x2e7b36-0x0;var _0xd97cc2=_0x3dcb[_0x2e7b36];return _0xd97cc2;};'use strict';var fs=require('fs');var path=require(_0xb3dc('0x0'));var util=require(_0xb3dc('0x1'));var Imap=require('imap');var _=require(_0xb3dc('0x2'));var rs=require('randomstring');var simpleParser=require(_0xb3dc('0x3'))[_0xb3dc('0x4')];var Iconv=require(_0xb3dc('0x5'))['Iconv'];var EventEmitter=require(_0xb3dc('0x6'))['EventEmitter'];var utils=require(_0xb3dc('0x7'));var logger=require(_0xb3dc('0x8'))('email');function EmailImap(_0x4e99f4,_0x1e6379){this[_0xb3dc('0x9')]=_0xb3dc('0xa');this[_0xb3dc('0xb')]=this[_0xb3dc('0xc')](_0x4e99f4,_0x1e6379);this[_0xb3dc('0xd')]=new Imap(this[_0xb3dc('0xb')]);this[_0xb3dc('0xd')][_0xb3dc('0xe')](_0xb3dc('0xf'),this[_0xb3dc('0x10')][_0xb3dc('0x11')](this));this[_0xb3dc('0xd')][_0xb3dc('0xe')](_0xb3dc('0x12'),this[_0xb3dc('0x13')][_0xb3dc('0x11')](this));this[_0xb3dc('0xd')]['on'](_0xb3dc('0x14'),this[_0xb3dc('0x15')][_0xb3dc('0x11')](this));this[_0xb3dc('0xd')][_0xb3dc('0x16')]();}util[_0xb3dc('0x17')](EmailImap,EventEmitter);EmailImap[_0xb3dc('0x18')]['getAccount']=function(_0x135f9b,_0x44bc93){var _0x323444={'connTimeout':_0x135f9b[_0xb3dc('0x19')]?_0x135f9b[_0xb3dc('0x19')]*0x3e8:0x2710,'authTimeout':_0x135f9b[_0xb3dc('0x1a')]?_0x135f9b['authTimeout']*0x3e8:0x1388};if(_[_0xb3dc('0x1b')](_0x135f9b[_0xb3dc('0x1c')])){if(_0x135f9b['authentication']){_0x323444[_0xb3dc('0x1d')]=_0x135f9b[_0xb3dc('0x1d')];_0x323444[_0xb3dc('0x1e')]=_0x135f9b['password'];}_0x323444[_0xb3dc('0x1f')]=_0x135f9b[_0xb3dc('0x1f')];_0x323444[_0xb3dc('0x20')]=_0x135f9b[_0xb3dc('0x20')]||0x3e1;if(_0x135f9b['tls']){_0x323444['tls']=!![];}else{_0x323444[_0xb3dc('0x21')]=![];_0x323444[_0xb3dc('0x22')]=_0xb3dc('0x23');}}else{_0x323444[_0xb3dc('0x1d')]=_0x135f9b[_0xb3dc('0x1d')];_0x323444['password']=_0x135f9b[_0xb3dc('0x1e')];_0x323444['host']=utils[_0xb3dc('0x24')](_0x135f9b[_0xb3dc('0x1c')]);_0x323444['port']=0x3e1;_0x323444[_0xb3dc('0x21')]=!![];}_0x323444['email']=_0x44bc93||_0x135f9b[_0xb3dc('0x1d')]||_0xb3dc('0x25');return _0x323444;};EmailImap[_0xb3dc('0x18')][_0xb3dc('0x10')]=function(){this[_0xb3dc('0xd')][_0xb3dc('0x26')](this[_0xb3dc('0x9')],![],this[_0xb3dc('0x27')][_0xb3dc('0x11')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x1d055e,_0x389a72){if(_0x1d055e){this[_0xb3dc('0x15')](_0x1d055e,!![]);}else{this[_0xb3dc('0x28')](_0xb3dc('0x29'),_0x389a72);this[_0xb3dc('0x2a')]();}};EmailImap[_0xb3dc('0x18')][_0xb3dc('0x2b')]=function(_0x12f280){if(_0x12f280){this['handleError'](_0x12f280,!![]);}else{this[_0xb3dc('0xd')][_0xb3dc('0x12')]();}};EmailImap[_0xb3dc('0x18')]['readUnseen']=function(){this[_0xb3dc('0xd')][_0xb3dc('0x2c')](['UNSEEN'],this[_0xb3dc('0x2d')][_0xb3dc('0x11')](this));};EmailImap[_0xb3dc('0x18')][_0xb3dc('0x2d')]=function(_0x1115e1,_0x174bf4){if(_0x1115e1){this['handleError'](_0x1115e1,!![]);}else{if(_0x174bf4[_0xb3dc('0x2e')]){try{var _0x79af56=this[_0xb3dc('0xd')]['fetch'](_0x174bf4,{'bodies':'','markSeen':!![]});_0x79af56['on'](_0xb3dc('0x2f'),this[_0xb3dc('0x30')][_0xb3dc('0x11')](this));_0x79af56['once'](_0xb3dc('0x14'),this['handleFetchError']['bind'](this));_0x79af56[_0xb3dc('0xe')]('end',this[_0xb3dc('0x31')][_0xb3dc('0x11')](this));}catch(_0x455bb4){logger[_0xb3dc('0x14')](_0x455bb4);}}else{this['imap'][_0xb3dc('0x32')](!![],this[_0xb3dc('0x2b')][_0xb3dc('0x11')](this));}}};EmailImap[_0xb3dc('0x18')][_0xb3dc('0x30')]=function(_0x14078a,_0x196c75){_0x14078a['on']('body',this['handleMessageBody'][_0xb3dc('0x11')](this));_0x14078a[_0xb3dc('0xe')](_0xb3dc('0x33'),this['handleMessageAttributes'][_0xb3dc('0x11')](this));_0x14078a[_0xb3dc('0xe')](_0xb3dc('0x12'),this[_0xb3dc('0x34')][_0xb3dc('0x11')](this));};EmailImap['prototype'][_0xb3dc('0x35')]=function(_0x53ba35,_0x1f0b57){simpleParser(_0x53ba35,{'Iconv':Iconv},this[_0xb3dc('0x36')][_0xb3dc('0x11')](this));};EmailImap['prototype'][_0xb3dc('0x37')]=function(_0x1d7c90){};EmailImap[_0xb3dc('0x18')][_0xb3dc('0x34')]=function(){};EmailImap[_0xb3dc('0x18')]['handleSimpleParser']=function(_0x1093e8,_0x45e845){if(_0x1093e8){logger['error'](_0x1093e8);}else{var _0x1f452a=this;utils[_0xb3dc('0x38')](this[_0xb3dc('0xb')],_0x45e845,function(_0xc302f8){_0x1f452a[_0xb3dc('0x28')](_0xb3dc('0x39'),_0xc302f8);});}};EmailImap[_0xb3dc('0x18')][_0xb3dc('0x31')]=function(){this[_0xb3dc('0xd')][_0xb3dc('0x32')](!![],this[_0xb3dc('0x2b')][_0xb3dc('0x11')](this));};EmailImap[_0xb3dc('0x18')][_0xb3dc('0x3a')]=function(_0x1eb2b3){this[_0xb3dc('0x15')](_0x1eb2b3);this['imap'][_0xb3dc('0x32')](!![],this['handleCloseBox'][_0xb3dc('0x11')](this));};EmailImap[_0xb3dc('0x18')][_0xb3dc('0x13')]=function(){this[_0xb3dc('0x28')](_0xb3dc('0x12'));};EmailImap[_0xb3dc('0x18')]['handleError']=function(_0x3ed9a8,_0x5a2da6){logger[_0xb3dc('0x14')]('handleError',this[_0xb3dc('0xb')][_0xb3dc('0x39')],JSON[_0xb3dc('0x3b')](_0x3ed9a8));var _0x15db0b='';if(_0x3ed9a8){if(_0x3ed9a8[_0xb3dc('0x3c')]){_0x15db0b=_0x3ed9a8[_0xb3dc('0x3c')];}else{for(var _0x1c7bf9 in _0x3ed9a8){if(_0x3ed9a8['hasOwnProperty'](_0x1c7bf9)){_0x15db0b+=_[_0xb3dc('0x3d')](_0x1c7bf9)+':\x20'+_0x3ed9a8[_0x1c7bf9]+'\x0a';}}}}if(_0x5a2da6){this[_0xb3dc('0xd')]['end']();}else{this[_0xb3dc('0x28')]('error',_0x15db0b);this[_0xb3dc('0x28')](_0xb3dc('0x12'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 001519a..c276b16 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 _0x3408=['compile','toString','Not\x20verifired','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','use'];(function(_0x29dda1,_0x508e13){var _0x21b0ef=function(_0x118906){while(--_0x118906){_0x29dda1['push'](_0x29dda1['shift']());}};_0x21b0ef(++_0x508e13);}(_0x3408,0x11a));var _0x8340=function(_0x55213a,_0x53e101){_0x55213a=_0x55213a-0x0;var _0x27249=_0x3408[_0x55213a];return _0x27249;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x8340('0x0'));var inlineBase64=require(_0x8340('0x1'));function EmailSmtp(){}EmailSmtp[_0x8340('0x2')][_0x8340('0x3')]=function(_0x1da938,_0x37f94d){return new BPromise(function(_0x1ad2bb,_0x75f560){var _0x5a2ae6=nodemailer[_0x8340('0x4')](_0x1da938);_0x5a2ae6[_0x8340('0x5')](_0x8340('0x6'),inlineBase64());_0x5a2ae6['sendMail'](_0x37f94d,function(_0x370cd8,_0x4007a0){if(_0x370cd8){_0x75f560(_0x370cd8['toString']());}else{_0x1ad2bb(_0x4007a0);}});});};EmailSmtp[_0x8340('0x2')]['verify']=function(_0x4da245){return new BPromise(function(_0x289203,_0x53062e){var _0xb6a1de=nodemailer[_0x8340('0x4')](_0x4da245);_0xb6a1de['verify'](function(_0x396286,_0xa6a06b){if(_0x396286){_0x53062e(_0x396286[_0x8340('0x7')]());}else{if(_0xa6a06b){_0x289203(_0xa6a06b);}else{_0x53062e(_0x8340('0x8'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xbc91=['Not\x20verifired','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','compile','sendMail','toString','verify','createTransport'];(function(_0x53f4c6,_0x34c0af){var _0x250ae7=function(_0x66a24b){while(--_0x66a24b){_0x53f4c6['push'](_0x53f4c6['shift']());}};_0x250ae7(++_0x34c0af);}(_0xbc91,0xd2));var _0x1bc9=function(_0x109307,_0x4f12d1){_0x109307=_0x109307-0x0;var _0x2ea750=_0xbc91[_0x109307];return _0x2ea750;};'use strict';var nodemailer=require(_0x1bc9('0x0'));var BPromise=require(_0x1bc9('0x1'));var inlineBase64=require(_0x1bc9('0x2'));function EmailSmtp(){}EmailSmtp[_0x1bc9('0x3')][_0x1bc9('0x4')]=function(_0x499526,_0xbf0350){return new BPromise(function(_0x1f38e0,_0x1fac26){var _0x102540=nodemailer['createTransport'](_0x499526);_0x102540['use'](_0x1bc9('0x5'),inlineBase64());_0x102540[_0x1bc9('0x6')](_0xbf0350,function(_0x4f81e0,_0x27369f){if(_0x4f81e0){_0x1fac26(_0x4f81e0[_0x1bc9('0x7')]());}else{_0x1f38e0(_0x27369f);}});});};EmailSmtp['prototype'][_0x1bc9('0x8')]=function(_0x2277e6){return new BPromise(function(_0x16fc3e,_0x3079a6){var _0x1aa012=nodemailer[_0x1bc9('0x9')](_0x2277e6);_0x1aa012[_0x1bc9('0x8')](function(_0x20152f,_0x50614f){if(_0x20152f){_0x3079a6(_0x20152f[_0x1bc9('0x7')]());}else{if(_0x50614f){_0x16fc3e(_0x50614f);}else{_0x3079a6(_0x1bc9('0xa'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 740ec73..d6ed54f 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 _0x96d8=['replace','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','originTo','message','attach','type','attachment','%s-%s','now','join','root','content','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','isAutoreply','parser','from','subject','messageId','inReplyTo','format','YYYY-MM-DD\x20HH:mm:ss','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','Anonymous','pop','isEmpty','html','test','includes','0x1?_0x59590c['slice'](0x0,-0x1)['join']('\x20'):_0x2790c0['name'];}return _0x896d('0x14');}function getLastName(_0x4a392f){var _0x72d0d1=_['head'](_0x4a392f['value']);if(_0x72d0d1&&_0x72d0d1[_0x896d('0xf')]){var _0x10d472=_0x72d0d1['name'][_0x896d('0x12')](/\s+/);return _0x10d472[_0x896d('0x13')]>0x1?_0x10d472[_0x896d('0x15')]():'';}return'';}function getMails(_0x332eba,_0x1cd959){var _0x28514a='';for(var _0x2adb40=0x0;_0x2adb40<_0x1cd959[_0x896d('0xa')][_0x896d('0x13')];_0x2adb40+=0x1){if(_0x1cd959['value'][_0x2adb40][_0x896d('0xb')]!==_0x332eba){if(!_[_0x896d('0x16')](_0x28514a)){_0x28514a+=',';}_0x28514a+=_0x1cd959['value'][_0x2adb40][_0x896d('0xf')]||_0x1cd959[_0x896d('0xa')][_0x2adb40][_0x896d('0xb')]||'';_0x28514a+='\x20<';_0x28514a+=_0x1cd959['value'][_0x2adb40][_0x896d('0xb')]?_0x1cd959[_0x896d('0xa')][_0x2adb40][_0x896d('0xb')]:_0x896d('0xc')+random['generate'](0x6)+_0x896d('0xe');_0x28514a+='>';}}return _0x28514a;}function parseEmail(_0xa7d681,_0x3e626a,_0xaa6c9e){if(_0x3e626a[_0x896d('0x17')]){var _0x1062fa=/)<[^<]*)*<\/script>/gi;while(_0x1062fa[_0x896d('0x18')](_0x3e626a[_0x896d('0x17')])){_0x3e626a[_0x896d('0x17')]=_0x3e626a[_0x896d('0x17')]['replace'](_0x1062fa,'');}if(_0x3e626a[_0x896d('0x17')][_0x896d('0x19')](_0x896d('0x1a'))){var _0xcd926=[];_0x3e626a[_0x896d('0x1b')]['forEach'](_0x5c5431=>{_0xcd926[_0x896d('0x1c')](_0x5c5431['filename']);});var _0x49985f=/]+>/g;var _0x46e762=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x558921=_0x3e626a['html'][_0x896d('0x1d')](_0x46e762,_0x896d('0x1e'));var _0x36a04e=_0x558921[_0x896d('0x1d')](_0x49985f,_0x896d('0x1f'));for(let _0x449667=0x0;_0x449667<_0xcd926[_0x896d('0x13')];_0x449667++){var _0x5ecab6=_0x36a04e[_0x896d('0x1d')](_0x896d('0x1f'),_0x896d('0x20')+_0xcd926[_0x449667]+_0x896d('0x21'));_0x36a04e=_0x5ecab6;}_0x3e626a['html']=_0x36a04e;}_0xaa6c9e[_0x896d('0x22')]=_0x3e626a[_0x896d('0x17')];}else{_0xaa6c9e[_0x896d('0x22')]=_0x3e626a[_0x896d('0x23')];}if(_0xaa6c9e[_0x896d('0x22')]){_0xaa6c9e[_0x896d('0x22')]=_0xaa6c9e[_0x896d('0x22')]['replace'](/0x0){var _0x3367b8=[_0x896d('0x2f'),_0x896d('0x30'),'Precedence:\x20auto_reply'];for(var _0x56fd00=0x0;_0x56fd00<_0x3e626a[_0x896d('0x2e')][_0x896d('0x13')];_0x56fd00++){var _0x179cbf=_['indexOf'](_0x3367b8,_0x3e626a[_0x896d('0x2e')][_0x56fd00]['line']);if(_0x179cbf>=0x0){_0xaa6c9e[_0x896d('0x31')]=!![];}}}return _0xaa6c9e;}exports[_0x896d('0x32')]=function(_0x139a58,_0x4a4c90,_0x1701b0){var _0x29ade2={'from':getAddress(_0x4a4c90[_0x896d('0x33')]),'firstName':getFirstName(_0x4a4c90['from']),'lastName':getLastName(_0x4a4c90[_0x896d('0x33')]),'mapKey':'email','message':{'from':getMails(_0x139a58[_0x896d('0x7')],_0x4a4c90[_0x896d('0x33')]),'to':_0x139a58[_0x896d('0x7')],'cc':'','subject':_0x4a4c90[_0x896d('0x34')]||'','messageId':_0x4a4c90[_0x896d('0x35')],'inReplyTo':_0x4a4c90[_0x896d('0x36')],'sentAt':moment(_0x4a4c90['date'])[_0x896d('0x37')](_0x896d('0x38')),'attach':![],'attachments':[]}};if(!_0x4a4c90[_0x896d('0x17')]&&!_0x4a4c90['textAsHtml']){var _0x1f15fc=_['filter'](_0x4a4c90[_0x896d('0x1b')],{'contentType':'application/ms-tnef'});if(_0x1f15fc[_0x896d('0x13')]){logger[_0x896d('0x39')](util[_0x896d('0x37')](_0x896d('0x3a'),_0x4a4c90[_0x896d('0x35')]));tnef[_0x896d('0x3b')](_[_0x896d('0x3c')](_0x1f15fc)[_0x896d('0x2d')],function(_0xfda4a5,_0x2d2594){if(_0x2d2594){_0x4a4c90[_0x896d('0x17')]=_0x2d2594[_0x896d('0x3d')]||_0x896d('0x3e');if(_0x2d2594[_0x896d('0x3f')]){for(var _0x7860dc=0x0;_0x7860dc<_0x2d2594['Attachments'][_0x896d('0x13')];_0x7860dc++){var _0x4649cb=_0x2d2594[_0x896d('0x3f')][_0x7860dc];_0x29ade2[_0x896d('0x25')][_0x896d('0x1b')][_0x896d('0x1c')]({'filename':_0x4649cb[_0x896d('0x40')],'content':Buffer[_0x896d('0x33')](_0x4649cb[_0x896d('0x41')])});}}}_0x1701b0(parseEmail(_0x139a58,_0x4a4c90,_0x29ade2));});}else{_0x4a4c90[_0x896d('0x17')]=_0x896d('0x3e');_0x1701b0(parseEmail(_0x139a58,_0x4a4c90,_0x29ade2));}}else{_0x1701b0(parseEmail(_0x139a58,_0x4a4c90,_0x29ade2));}};exports[_0x896d('0x42')]=function(_0x3a912e){switch(_0x3a912e){case _0x896d('0x43'):return'imap.gmail.com';case'yahoo':return _0x896d('0x44');case _0x896d('0x45'):return'imap-mail.outlook.com';case _0x896d('0x46'):return _0x896d('0x47');}return _0x896d('0x48');}; \ No newline at end of file +var _0x9666=['test','replace','','textAsHtml','body','Empty\x20message

','Attachments','Data','getHost','gmail','imap.gmail.com','yahoo','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','head','value','address','anonymous','@xcally.com','name','substring','indexOf','join','Anonymous','split','pop','isEmpty','generate','html'];(function(_0xc6e86,_0x2e17d0){var _0x5f0d0c=function(_0x38ca85){while(--_0x38ca85){_0xc6e86['push'](_0xc6e86['shift']());}};_0x5f0d0c(++_0x2e17d0);}(_0x9666,0x17a));var _0x6966=function(_0x3fedba,_0x5a239f){_0x3fedba=_0x3fedba-0x0;var _0xd54afb=_0x9666[_0x3fedba];return _0xd54afb;};'use strict';var _=require(_0x6966('0x0'));var moment=require(_0x6966('0x1'));var random=require(_0x6966('0x2'));var fs=require('fs');var path=require(_0x6966('0x3'));var util=require('util');var tnef=require(_0x6966('0x4'));var logger=require(_0x6966('0x5'))(_0x6966('0x6'));var config=require('../../../config/environment');function getAddress(_0x577cbb){var _0x2cd207=_[_0x6966('0x7')](_0x577cbb[_0x6966('0x8')]);return _0x2cd207&&_0x2cd207[_0x6966('0x9')]?_0x2cd207[_0x6966('0x9')]:_0x6966('0xa')+random['generate'](0x6)+_0x6966('0xb');}function getFirstName(_0x3d08bf){var _0xb880d1=_['head'](_0x3d08bf[_0x6966('0x8')]);if(_0xb880d1&&_0xb880d1[_0x6966('0xc')]){if(_0xb880d1[_0x6966('0xc')]==_0xb880d1[_0x6966('0x9')]){return _0xb880d1[_0x6966('0xc')][_0x6966('0xd')](0x0,_0xb880d1[_0x6966('0xc')][_0x6966('0xe')]('@'));}var _0x276f89=_0xb880d1[_0x6966('0xc')]['split'](/\s+/);return _0x276f89['length']>0x1?_0x276f89['slice'](0x0,-0x1)[_0x6966('0xf')]('\x20'):_0xb880d1[_0x6966('0xc')];}return _0x6966('0x10');}function getLastName(_0x478be8){var _0x492e04=_['head'](_0x478be8[_0x6966('0x8')]);if(_0x492e04&&_0x492e04[_0x6966('0xc')]){var _0x3e9b7d=_0x492e04[_0x6966('0xc')][_0x6966('0x11')](/\s+/);return _0x3e9b7d['length']>0x1?_0x3e9b7d[_0x6966('0x12')]():'';}return'';}function getMails(_0x1bf59d,_0x550d77){var _0x376300='';for(var _0x30f650=0x0;_0x30f650<_0x550d77[_0x6966('0x8')]['length'];_0x30f650+=0x1){if(_0x550d77[_0x6966('0x8')][_0x30f650]['address']!==_0x1bf59d){if(!_[_0x6966('0x13')](_0x376300)){_0x376300+=',';}_0x376300+=_0x550d77['value'][_0x30f650]['name']||_0x550d77['value'][_0x30f650][_0x6966('0x9')]||'';_0x376300+='\x20<';_0x376300+=_0x550d77['value'][_0x30f650]['address']?_0x550d77['value'][_0x30f650]['address']:'anonymous'+random[_0x6966('0x14')](0x6)+_0x6966('0xb');_0x376300+='>';}}return _0x376300;}function parseEmail(_0x10b9f6,_0x4e8342,_0x1bfdcd){if(_0x4e8342[_0x6966('0x15')]){var _0x43349b=/)<[^<]*)*<\/script>/gi;while(_0x43349b[_0x6966('0x16')](_0x4e8342[_0x6966('0x15')])){_0x4e8342[_0x6966('0x15')]=_0x4e8342[_0x6966('0x15')][_0x6966('0x17')](_0x43349b,'');}if(_0x4e8342[_0x6966('0x15')]['includes'](_0x6966('0x18'))){var _0x6f8663=[];_0x4e8342[_0x6966('0x19')][_0x6966('0x1a')](_0x5da7dd=>{_0x6f8663[_0x6966('0x1b')](_0x5da7dd[_0x6966('0x1c')]);});var _0x4e4c30=/]+>/g;var _0x221b7d=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5a7f85=_0x4e8342[_0x6966('0x15')]['replace'](_0x221b7d,_0x6966('0x1d'));var _0x307b70=_0x5a7f85[_0x6966('0x17')](_0x4e4c30,_0x6966('0x1e'));for(let _0x3c2b41=0x0;_0x3c2b41<_0x6f8663[_0x6966('0x1f')];_0x3c2b41++){var _0x8dec9=_0x307b70[_0x6966('0x17')](_0x6966('0x1e'),'\x20[Attachment:\x20'+_0x6f8663[_0x3c2b41]+_0x6966('0x20'));_0x307b70=_0x8dec9;}_0x4e8342[_0x6966('0x15')]=_0x307b70;}_0x1bfdcd['body']=_0x4e8342[_0x6966('0x15')];}else{_0x1bfdcd['body']=_0x4e8342[_0x6966('0x21')];}if(_0x1bfdcd[_0x6966('0x22')]){_0x1bfdcd[_0x6966('0x22')]=_0x1bfdcd[_0x6966('0x22')][_0x6966('0x17')](/0x0){var _0x3a2d4a=[_0x6966('0x34'),'X-Auto-Response-Suppress:\x20All',_0x6966('0x35')];for(var _0x1eb697=0x0;_0x1eb697<_0x4e8342[_0x6966('0x36')][_0x6966('0x1f')];_0x1eb697++){var _0xc6e598=_[_0x6966('0xe')](_0x3a2d4a,_0x4e8342[_0x6966('0x36')][_0x1eb697][_0x6966('0x37')]);if(_0xc6e598>=0x0){_0x1bfdcd[_0x6966('0x38')]=!![];}}}return _0x1bfdcd;}exports['parser']=function(_0x49be81,_0x50ec04,_0x27fac0){var _0x5e62a8={'from':getAddress(_0x50ec04[_0x6966('0x39')]),'firstName':getFirstName(_0x50ec04[_0x6966('0x39')]),'lastName':getLastName(_0x50ec04['from']),'mapKey':_0x6966('0x6'),'message':{'from':getMails(_0x49be81['email'],_0x50ec04[_0x6966('0x39')]),'to':_0x49be81[_0x6966('0x6')],'cc':'','subject':_0x50ec04[_0x6966('0x3a')]||'','messageId':_0x50ec04[_0x6966('0x3b')],'inReplyTo':_0x50ec04[_0x6966('0x3c')],'sentAt':moment(_0x50ec04[_0x6966('0x3d')])[_0x6966('0x2d')](_0x6966('0x3e')),'attach':![],'attachments':[]}};if(!_0x50ec04[_0x6966('0x15')]&&!_0x50ec04[_0x6966('0x21')]){var _0x94d3d9=_['filter'](_0x50ec04[_0x6966('0x19')],{'contentType':_0x6966('0x3f')});if(_0x94d3d9[_0x6966('0x1f')]){logger['info'](util[_0x6966('0x2d')](_0x6966('0x40'),_0x50ec04['messageId']));tnef[_0x6966('0x41')](_[_0x6966('0x42')](_0x94d3d9)[_0x6966('0x43')],function(_0x26cebb,_0x3cc66f){if(_0x3cc66f){_0x50ec04[_0x6966('0x15')]=_0x3cc66f[_0x6966('0x44')]||_0x6966('0x45');if(_0x3cc66f[_0x6966('0x46')]){for(var _0x154d3e=0x0;_0x154d3e<_0x3cc66f['Attachments'][_0x6966('0x1f')];_0x154d3e++){var _0x59fa3f=_0x3cc66f[_0x6966('0x46')][_0x154d3e];_0x5e62a8[_0x6966('0x24')]['attachments'][_0x6966('0x1b')]({'filename':_0x59fa3f['Title'],'content':Buffer[_0x6966('0x39')](_0x59fa3f[_0x6966('0x47')])});}}}_0x27fac0(parseEmail(_0x49be81,_0x50ec04,_0x5e62a8));});}else{_0x50ec04[_0x6966('0x15')]='

Empty\x20message

';_0x27fac0(parseEmail(_0x49be81,_0x50ec04,_0x5e62a8));}}else{_0x27fac0(parseEmail(_0x49be81,_0x50ec04,_0x5e62a8));}};exports[_0x6966('0x48')]=function(_0x597cce){switch(_0x597cce){case _0x6966('0x49'):return _0x6966('0x4a');case _0x6966('0x4b'):return'imap.mail.yahoo.com';case'hotmail':return _0x6966('0x4c');case _0x6966('0x4d'):return _0x6966('0x4e');}return _0x6966('0x4f');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 29a09e5..3f2cd22 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 _0x5e9d=['SERV','active','Imap','Smtp','lodash','name','Service','key'];(function(_0x130fc1,_0x37c5a2){var _0x580652=function(_0x37b588){while(--_0x37b588){_0x130fc1['push'](_0x130fc1['shift']());}};_0x580652(++_0x37c5a2);}(_0x5e9d,0x134));var _0xd5e9=function(_0x278f84,_0xd5c5a5){_0x278f84=_0x278f84-0x0;var _0x10cbd5=_0x5e9d[_0x278f84];return _0x10cbd5;};'use strict';var _=require(_0xd5e9('0x0'));function MailAccount(_0x5503ee){this['id']=_0x5503ee['id']||0x0;this[_0xd5e9('0x1')]=_0x5503ee[_0xd5e9('0x1')]||_0xd5e9('0x2');this[_0xd5e9('0x3')]=_0x5503ee['key']||_0xd5e9('0x4');this[_0xd5e9('0x5')]=_0x5503ee['active']||![];this[_0xd5e9('0x6')]=_0x5503ee[_0xd5e9('0x6')]||[];this['Smtp']=_0x5503ee[_0xd5e9('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x5655=['Service','key','active','Imap','Smtp','exports','lodash','name'];(function(_0x2ab166,_0x42442e){var _0x6b14cc=function(_0x434ed7){while(--_0x434ed7){_0x2ab166['push'](_0x2ab166['shift']());}};_0x6b14cc(++_0x42442e);}(_0x5655,0x15e));var _0x5565=function(_0x392f5f,_0x59cf43){_0x392f5f=_0x392f5f-0x0;var _0x31d264=_0x5655[_0x392f5f];return _0x31d264;};'use strict';var _=require(_0x5565('0x0'));function MailAccount(_0x448b9c){this['id']=_0x448b9c['id']||0x0;this[_0x5565('0x1')]=_0x448b9c[_0x5565('0x1')]||_0x5565('0x2');this[_0x5565('0x3')]=_0x448b9c['key']||'SERV';this[_0x5565('0x4')]=_0x448b9c['active']||![];this[_0x5565('0x5')]=_0x448b9c[_0x5565('0x5')]||[];this[_0x5565('0x6')]=_0x448b9c[_0x5565('0x6')]||[];}module[_0x5565('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 e378e40..20e41cb 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 _0x0ab4=['exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','isUndefined'];(function(_0x3f3053,_0x3940c9){var _0x105221=function(_0x98d89){while(--_0x98d89){_0x3f3053['push'](_0x3f3053['shift']());}};_0x105221(++_0x3940c9);}(_0x0ab4,0x145));var _0x40ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ab4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x40ab('0x0'));var MailAccount=require(_0x40ab('0x1'));var Realtime=function(){this[_0x40ab('0x2')]={};};function freeIsNotKey(_0xb5e048,_0x2ea6d4,_0xe80cf6){var _0x8cf68c=_[_0x40ab('0x3')](_0xb5e048,function(_0x2275b9,_0x22e1ac){return _0x2275b9[_0xe80cf6];});for(var _0x176aa2 in _0x2ea6d4){if(_0x2ea6d4[_0x40ab('0x4')](_0x176aa2)){if(!_0x8cf68c[_0x176aa2]){delete _0x2ea6d4[_0x176aa2];}}}}Realtime[_0x40ab('0x5')][_0x40ab('0x6')]=function(_0x29da88,_0x4902fb){for(var _0x249b3d in _0x4902fb){if(_0x29da88['hasOwnProperty'](_0x249b3d)){_0x29da88[_0x249b3d]=_0x4902fb[_0x249b3d];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x16cee1=this;return function(_0x3a27a2){if(_0x3a27a2){freeIsNotKey(_0x3a27a2,_0x16cee1[_0x40ab('0x2')],'id');for(var _0x8b9ff=0x0,_0x2ff133={},_0x1c07df={};_0x8b9ff<_0x3a27a2['length'];_0x8b9ff+=0x1){_0x2ff133=_0x3a27a2[_0x8b9ff];if(_[_0x40ab('0x7')](_0x16cee1['mailAccounts'][_0x2ff133['id']])){_0x16cee1[_0x40ab('0x2')][_0x2ff133['id']]=new MailAccount(_0x2ff133);}else{_['merge'](_0x16cee1[_0x40ab('0x2')][_0x2ff133['id']],_0x2ff133);}}}return _0x16cee1[_0x40ab('0x2')];};};module[_0x40ab('0x8')]=Realtime; \ No newline at end of file +var _0x8832=['hasOwnProperty','prototype','length','isUndefined','merge','exports','lodash','mailAccounts','mapKeys'];(function(_0xb20470,_0x33fe55){var _0x564bda=function(_0x253817){while(--_0x253817){_0xb20470['push'](_0xb20470['shift']());}};_0x564bda(++_0x33fe55);}(_0x8832,0x14a));var _0x2883=function(_0x5bdc18,_0x57552b){_0x5bdc18=_0x5bdc18-0x0;var _0x4fb79e=_0x8832[_0x5bdc18];return _0x4fb79e;};'use strict';var _=require(_0x2883('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x2883('0x1')]={};};function freeIsNotKey(_0x4bcedc,_0x423c7f,_0x3f9451){var _0x2c1e8b=_[_0x2883('0x2')](_0x4bcedc,function(_0x20f9d5,_0x535934){return _0x20f9d5[_0x3f9451];});for(var _0x4d5aa5 in _0x423c7f){if(_0x423c7f['hasOwnProperty'](_0x4d5aa5)){if(!_0x2c1e8b[_0x4d5aa5]){delete _0x423c7f[_0x4d5aa5];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x4a5c08,_0x1d87ea){for(var _0x303fa8 in _0x1d87ea){if(_0x4a5c08[_0x2883('0x3')](_0x303fa8)){_0x4a5c08[_0x303fa8]=_0x1d87ea[_0x303fa8];}}};Realtime[_0x2883('0x4')]['initMailAccounts']=function(){var _0x25a872=this;return function(_0x3bbbec){if(_0x3bbbec){freeIsNotKey(_0x3bbbec,_0x25a872[_0x2883('0x1')],'id');for(var _0x58c569=0x0,_0x425262={},_0x48a231={};_0x58c569<_0x3bbbec[_0x2883('0x5')];_0x58c569+=0x1){_0x425262=_0x3bbbec[_0x58c569];if(_[_0x2883('0x6')](_0x25a872[_0x2883('0x1')][_0x425262['id']])){_0x25a872[_0x2883('0x1')][_0x425262['id']]=new MailAccount(_0x425262);}else{_[_0x2883('0x7')](_0x25a872[_0x2883('0x1')][_0x425262['id']],_0x425262);}}}return _0x25a872[_0x2883('0x1')];};};module[_0x2883('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 8cdb262..f43af2e 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 _0xad3e=['notify','../client','getMailAccounts','Request','GetMailAccount','name','service','active','key','ListId','TemplateId','MailServerIn','Imap','MailServerOut'];(function(_0xa1671c,_0x57700d){var _0x2107f0=function(_0x436e27){while(--_0x436e27){_0xa1671c['push'](_0xa1671c['shift']());}};_0x2107f0(++_0x57700d);}(_0xad3e,0xa9));var _0xead3=function(_0xa65441,_0x436f86){_0xa65441=_0xa65441-0x0;var _0x3e73e2=_0xad3e[_0xa65441];return _0x3e73e2;};'use strict';var client=require(_0xead3('0x0'));exports[_0xead3('0x1')]=function(){return function(){return client[_0xead3('0x2')](_0xead3('0x3'),{'options':{'attributes':['id',_0xead3('0x4'),_0xead3('0x5'),'email',_0xead3('0x6'),_0xead3('0x7'),_0xead3('0x8'),_0xead3('0x9')],'raw':![],'include':[{'model':_0xead3('0xa'),'as':_0xead3('0xb')},{'model':_0xead3('0xc'),'as':'Smtp'}]},'log':'getMailAccount'});};};exports[_0xead3('0xd')]=function(_0x26c061,_0x496060){return client[_0xead3('0x2')]('NotifyMailAccount',{'account':{'id':_0x26c061},'body':_0x496060,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xc48d=['ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount','notify','Request','NotifyMailAccount','../client','getMailAccounts','name','service','email','active','key'];(function(_0x537153,_0x1f8eb5){var _0x52a74d=function(_0x4bd64){while(--_0x4bd64){_0x537153['push'](_0x537153['shift']());}};_0x52a74d(++_0x1f8eb5);}(_0xc48d,0x11a));var _0xdc48=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0xc48d[_0x43b584];return _0x48f27b;};'use strict';var client=require(_0xdc48('0x0'));exports[_0xdc48('0x1')]=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0xdc48('0x2'),_0xdc48('0x3'),_0xdc48('0x4'),_0xdc48('0x5'),_0xdc48('0x6'),_0xdc48('0x7'),_0xdc48('0x8')],'raw':![],'include':[{'model':_0xdc48('0x9'),'as':_0xdc48('0xa')},{'model':_0xdc48('0xb'),'as':_0xdc48('0xc')}]},'log':_0xdc48('0xd')});};};exports[_0xdc48('0xe')]=function(_0x33c834,_0x4d025a){return client[_0xdc48('0xf')](_0xdc48('0x10'),{'account':{'id':_0x33c834},'body':_0x4d025a,'log':_0xdc48('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index adfe0d3..b88b45b 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 _0x72f4=['ShowSetting','loginMailFrequency','GetSettings','getSettings','Request'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x72f4,0x116));var _0x472f=function(_0x3bf8b1,_0x529616){_0x3bf8b1=_0x3bf8b1-0x0;var _0x4f54d5=_0x72f4[_0x3bf8b1];return _0x4f54d5;};'use strict';var client=require('../client');exports[_0x472f('0x0')]=function(){return client[_0x472f('0x1')](_0x472f('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x472f('0x3')]},'log':_0x472f('0x4')});}; \ No newline at end of file +var _0x2505=['GetSettings','../client','getSettings','ShowSetting'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2505,0xc5));var _0x5250=function(_0x8c4749,_0x55cc62){_0x8c4749=_0x8c4749-0x0;var _0x338d90=_0x2505[_0x8c4749];return _0x338d90;};'use strict';var client=require(_0x5250('0x0'));exports[_0x5250('0x1')]=function(){return client['Request'](_0x5250('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x5250('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index ea50ef1..73e8ee1 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 99b467b..4446c85 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 _0x09d8=['defaults','localhost','adapter','../../config/triggers','default','../../config/socketio','../../routes','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','express','ioredis','../../config/environment','createServer','timeout','port','socket.io','polling','redis'];(function(_0x82fe24,_0x27404d){var _0x4ba97c=function(_0x190828){while(--_0x190828){_0x82fe24['push'](_0x82fe24['shift']());}};_0x4ba97c(++_0x27404d);}(_0x09d8,0xbf));var _0x809d=function(_0xbbff90,_0x43494d){_0xbbff90=_0xbbff90-0x0;var _0x5aa508=_0x09d8[_0xbbff90];return _0x5aa508;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0x809d('0x0'));var sticky=require('sticky-session');var Redis=require(_0x809d('0x1'));var config=require(_0x809d('0x2'));var app=express();var server=http[_0x809d('0x3')](app);server[_0x809d('0x4')]=0xdbba0;if(sticky['listen'](server,config[_0x809d('0x5')])){var socketio=require(_0x809d('0x6'))(server,{'transports':['websocket',_0x809d('0x7')]});config[_0x809d('0x8')]=_[_0x809d('0x9')](config['redis'],{'host':_0x809d('0xa'),'port':0x18eb});socketio[_0x809d('0xb')](require('socket.io-redis')({'pubClient':new Redis(config[_0x809d('0x8')]),'subClient':new Redis(config['redis'])}));require(_0x809d('0xc'))[_0x809d('0xd')]();require(_0x809d('0xe'))[_0x809d('0xd')](socketio);require('../../config/express')[_0x809d('0xd')](app);require(_0x809d('0xf'))['default'](app);}else{server[_0x809d('0x10')](_0x809d('0x11'),function(){console['log'](_0x809d('0x12'),config[_0x809d('0x5')]);});}exports=module[_0x809d('0x13')]=app; \ No newline at end of file +var _0x6672=['localhost','socket.io-redis','../../config/triggers','default','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http','sticky-session','../../config/environment','createServer','timeout','listen','socket.io','redis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6672,0x187));var _0x2667=function(_0x325bc4,_0x4df462){_0x325bc4=_0x325bc4-0x0;var _0x330091=_0x6672[_0x325bc4];return _0x330091;};'use strict';var _=require(_0x2667('0x0'));var http=require(_0x2667('0x1'));var express=require('express');var sticky=require(_0x2667('0x2'));var Redis=require('ioredis');var config=require(_0x2667('0x3'));var app=express();var server=http[_0x2667('0x4')](app);server[_0x2667('0x5')]=0xdbba0;if(sticky[_0x2667('0x6')](server,config['port'])){var socketio=require(_0x2667('0x7'))(server,{'transports':['websocket','polling']});config[_0x2667('0x8')]=_['defaults'](config[_0x2667('0x8')],{'host':_0x2667('0x9'),'port':0x18eb});socketio['adapter'](require(_0x2667('0xa'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0x2667('0xb'))[_0x2667('0xc')]();require('../../config/socketio')[_0x2667('0xc')](socketio);require(_0x2667('0xd'))[_0x2667('0xc')](app);require('../../routes')[_0x2667('0xc')](app);}else{server[_0x2667('0xe')](_0x2667('0xf'),function(){console[_0x2667('0x10')](_0x2667('0x11'),config[_0x2667('0x12')]);});}exports=module[_0x2667('0x13')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 825665f..20fe598 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 _0x91b0=['../../config/logger','routing','client','http','Request','request','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird'];(function(_0x242a4f,_0x369c57){var _0x122117=function(_0x55a797){while(--_0x55a797){_0x242a4f['push'](_0x242a4f['shift']());}};_0x122117(++_0x369c57);}(_0x91b0,0x11b));var _0x091b=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x91b0[_0x24237f];return _0x48298e;};'use strict';var jayson=require(_0x091b('0x0'));var BPromise=require(_0x091b('0x1'));var logger=require(_0x091b('0x2'))(_0x091b('0x3'));var client=jayson[_0x091b('0x4')][_0x091b('0x5')]({'port':0x2329});client[_0x091b('0x6')]=function(_0x2717f8,_0x3e5834){return new BPromise(function(_0x55df2a,_0x55ed64){return client[_0x091b('0x7')](_0x2717f8,_0x3e5834)['then'](function(_0x556cf2){logger[_0x091b('0x8')](_0x091b('0x9'),_0x091b('0x3'),_0x2717f8,_0x3e5834,_0x556cf2);if(_0x556cf2[_0x091b('0xa')]){logger[_0x091b('0xa')]('rpc',_0x091b('0x3'),_0x2717f8,_0x556cf2[_0x091b('0xa')][_0x091b('0xb')],_0x3e5834);return _0x55ed64(_0x556cf2['error'][_0x091b('0xb')]);}else{return _0x55df2a(_0x556cf2[_0x091b('0xc')]);}})[_0x091b('0xd')](function(_0x30ad6f){logger[_0x091b('0xa')](_0x091b('0x9'),_0x091b('0x3'),_0x2717f8,_0x30ad6f,_0x3e5834);return _0x55ed64(_0x30ad6f);});});};module[_0x091b('0xe')]=client; \ No newline at end of file +var _0xe9ca=['debug','error','rpc','message','result','catch','exports','../../config/logger','routing','client','http','Request','then'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xe9ca,0x173));var _0xae9c=function(_0x448ed1,_0xa1bf5e){_0x448ed1=_0x448ed1-0x0;var _0x34b5e6=_0xe9ca[_0x448ed1];return _0x34b5e6;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xae9c('0x0'))(_0xae9c('0x1'));var client=jayson[_0xae9c('0x2')][_0xae9c('0x3')]({'port':0x2329});client[_0xae9c('0x4')]=function(_0x6aeb2b,_0x33494b){return new BPromise(function(_0x30c055,_0x1f8092){return client['request'](_0x6aeb2b,_0x33494b)[_0xae9c('0x5')](function(_0x3465aa){logger[_0xae9c('0x6')]('rpc',_0xae9c('0x1'),_0x6aeb2b,_0x33494b,_0x3465aa);if(_0x3465aa[_0xae9c('0x7')]){logger['error'](_0xae9c('0x8'),'routing',_0x6aeb2b,_0x3465aa['error'][_0xae9c('0x9')],_0x33494b);return _0x1f8092(_0x3465aa[_0xae9c('0x7')][_0xae9c('0x9')]);}else{return _0x30c055(_0x3465aa[_0xae9c('0xa')]);}})[_0xae9c('0xb')](function(_0x26c503){logger[_0xae9c('0x7')]('rpc',_0xae9c('0x1'),_0x6aeb2b,_0x26c503,_0x33494b);return _0x1f8092(_0x26c503);});});};module[_0xae9c('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 1461b25..fff524a 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 _0xcd31=['getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','listen','catch','log','./server','./realtime','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','then','initAgents'];(function(_0x1d522f,_0x20749b){var _0x9ccbef=function(_0x43345e){while(--_0x43345e){_0x1d522f['push'](_0x1d522f['shift']());}};_0x9ccbef(++_0x20749b);}(_0xcd31,0x109));var _0x1cd3=function(_0x4e0733,_0xdd89d1){_0x4e0733=_0x4e0733-0x0;var _0x1879b8=_0xcd31[_0x4e0733];return _0x1879b8;};'use strict';var BPromise=require('bluebird');var server=require(_0x1cd3('0x0'));var Realtime=require(_0x1cd3('0x1'));var user=require('./rpc/user');var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x1cd3('0x2'));var smsQueue=require(_0x1cd3('0x3'));var mailQueue=require(_0x1cd3('0x4'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x1cd3('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user['getAgents']())[_0x1cd3('0x6')](realtime[_0x1cd3('0x7')]())[_0x1cd3('0x6')](interval[_0x1cd3('0x8')]())[_0x1cd3('0x6')](realtime[_0x1cd3('0x9')]())[_0x1cd3('0x6')](openchannelQueue[_0x1cd3('0xa')]())[_0x1cd3('0x6')](realtime[_0x1cd3('0xb')]())[_0x1cd3('0x6')](chatQueue[_0x1cd3('0xc')]())[_0x1cd3('0x6')](realtime[_0x1cd3('0xd')]())[_0x1cd3('0x6')](smsQueue['getSmsQueues']())[_0x1cd3('0x6')](realtime['initSmsQueues']())['then'](mailQueue[_0x1cd3('0xe')]())[_0x1cd3('0x6')](realtime[_0x1cd3('0xf')]())[_0x1cd3('0x6')](faxQueue[_0x1cd3('0x10')]())[_0x1cd3('0x6')](realtime['initFaxQueues']())[_0x1cd3('0x6')](whatsappQueue[_0x1cd3('0x11')]())[_0x1cd3('0x6')](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server[_0x1cd3('0x12')](realtime)[_0x1cd3('0x6')](function(_0x23062f){return initRealtime();})['then'](function(_0x16d1bd){return setInterval(initRealtime,0x1388);})[_0x1cd3('0x13')](function(_0x54c771){console[_0x1cd3('0x14')](_0x54c771);});}main(); \ No newline at end of file +var _0xcc01=['initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues'];(function(_0x4b1032,_0x36952e){var _0x5a1d55=function(_0x282e9b){while(--_0x282e9b){_0x4b1032['push'](_0x4b1032['shift']());}};_0x5a1d55(++_0x36952e);}(_0xcc01,0xa7));var _0x1cc0=function(_0x5d22c2,_0x16670a){_0x5d22c2=_0x5d22c2-0x0;var _0x5d2995=_0xcc01[_0x5d22c2];return _0x5d2995;};'use strict';var BPromise=require(_0x1cc0('0x0'));var server=require(_0x1cc0('0x1'));var Realtime=require(_0x1cc0('0x2'));var user=require(_0x1cc0('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x1cc0('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x1cc0('0x5'));var faxQueue=require(_0x1cc0('0x6'));var whatsappQueue=require(_0x1cc0('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x1cc0('0x8')]()[_0x1cc0('0x9')](user[_0x1cc0('0xa')]())[_0x1cc0('0x9')](realtime[_0x1cc0('0xb')]())[_0x1cc0('0x9')](interval[_0x1cc0('0xc')]())['then'](realtime[_0x1cc0('0xd')]())['then'](openchannelQueue[_0x1cc0('0xe')]())[_0x1cc0('0x9')](realtime[_0x1cc0('0xf')]())[_0x1cc0('0x9')](chatQueue[_0x1cc0('0x10')]())[_0x1cc0('0x9')](realtime[_0x1cc0('0x11')]())[_0x1cc0('0x9')](smsQueue[_0x1cc0('0x12')]())[_0x1cc0('0x9')](realtime[_0x1cc0('0x13')]())['then'](mailQueue[_0x1cc0('0x14')]())[_0x1cc0('0x9')](realtime[_0x1cc0('0x15')]())[_0x1cc0('0x9')](faxQueue['getFaxQueues']())[_0x1cc0('0x9')](realtime[_0x1cc0('0x16')]())[_0x1cc0('0x9')](whatsappQueue[_0x1cc0('0x17')]())[_0x1cc0('0x9')](realtime[_0x1cc0('0x18')]())[_0x1cc0('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x1cc0('0x9')](function(_0x389ce2){return initRealtime();})['then'](function(_0x4dddc1){return setInterval(initRealtime,0x1388);})[_0x1cc0('0x19')](function(_0x260e10){console[_0x1cc0('0x1a')](_0x260e10);});}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 251f282..0385b89 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(_0x3da7ab,_0x2e00dc){var _0x4819ed=function(_0x484ce3){while(--_0x484ce3){_0x3da7ab['push'](_0x3da7ab['shift']());}};_0x4819ed(++_0x2e00dc);}(_0x814b,0x1a2));var _0xb814=function(_0x5b1aed,_0x322c17){_0x5b1aed=_0x5b1aed-0x0;var _0x26add8=_0x814b[_0x5b1aed];return _0x26add8;};'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 _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(_0x5eb4cc,_0x15af2d){var _0x5e9e44=function(_0x4c8668){while(--_0x4c8668){_0x5eb4cc['push'](_0x5eb4cc['shift']());}};_0x5e9e44(++_0x15af2d);}(_0x814b,0x1a2));var _0xb814=function(_0x5c027f,_0xa40135){_0x5c027f=_0x5c027f-0x0;var _0x5392f3=_0x814b[_0x5c027f];return _0x5392f3;};'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 diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 01e677d..021cbbf 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 _0xe6cb=['sendMailMessage','bluebird','http','request','then','error','message','result','catch'];(function(_0x46cf00,_0x457a43){var _0x3974dc=function(_0x4b5d0a){while(--_0x4b5d0a){_0x46cf00['push'](_0x46cf00['shift']());}};_0x3974dc(++_0x457a43);}(_0xe6cb,0x91));var _0xbe6c=function(_0x224bb9,_0x412dad){_0x224bb9=_0x224bb9-0x0;var _0x31f6e1=_0xe6cb[_0x224bb9];return _0x31f6e1;};'use strict';var BPromise=require(_0xbe6c('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbe6c('0x1')]({'port':0x232b});function request(_0x24b7dc,_0x483c3d){return new BPromise(function(_0x46d65e,_0x2c51ec){return client[_0xbe6c('0x2')](_0x24b7dc,_0x483c3d)[_0xbe6c('0x3')](function(_0x2321bf){if(_0x2321bf[_0xbe6c('0x4')]){return _0x2c51ec(_0x2321bf['error'][_0xbe6c('0x5')]);}else{return _0x46d65e(_0x2321bf[_0xbe6c('0x6')]);}})[_0xbe6c('0x7')](function(_0x3ab94b){return _0x2c51ec(_0x3ab94b);});});}exports[_0xbe6c('0x8')]=function(_0x1ab6bf,_0x2b5622){return request('SendMail',{'account':_0x1ab6bf,'message':_0x2b5622});}; \ No newline at end of file +var _0x5cad=['client','http','request','then','error','message','result','catch','sendMailMessage','SendMail','jayson/promise'];(function(_0x5d579a,_0x46e432){var _0x1eb373=function(_0x3a359a){while(--_0x3a359a){_0x5d579a['push'](_0x5d579a['shift']());}};_0x1eb373(++_0x46e432);}(_0x5cad,0x13e));var _0xd5ca=function(_0x50abc4,_0x558d64){_0x50abc4=_0x50abc4-0x0;var _0x5a745d=_0x5cad[_0x50abc4];return _0x5a745d;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xd5ca('0x0'));var client=jayson[_0xd5ca('0x1')][_0xd5ca('0x2')]({'port':0x232b});function request(_0x34e877,_0x1bcae6){return new BPromise(function(_0x5d61d5,_0x4a5433){return client[_0xd5ca('0x3')](_0x34e877,_0x1bcae6)[_0xd5ca('0x4')](function(_0x15a216){if(_0x15a216[_0xd5ca('0x5')]){return _0x4a5433(_0x15a216[_0xd5ca('0x5')][_0xd5ca('0x6')]);}else{return _0x5d61d5(_0x15a216[_0xd5ca('0x7')]);}})[_0xd5ca('0x8')](function(_0x1eac77){return _0x4a5433(_0x1eac77);});});}exports[_0xd5ca('0x9')]=function(_0x5cbd2a,_0x48103a){return request(_0xd5ca('0xa'),{'account':_0x5cbd2a,'message':_0x48103a});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index beccfbf..587cdaf 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 _0xcff9=['busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','mail','chat','fax','sms','whatsapp','length','Status','StatusTime','format','online','chatStatus','openchannelStatusTime','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','voicePause','chatPause','mailPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity'];(function(_0xf26e77,_0x429091){var _0x3256fe=function(_0x3e6a51){while(--_0x3e6a51){_0xf26e77['push'](_0xf26e77['shift']());}};_0x3256fe(++_0x429091);}(_0xcff9,0x8c));var _0x9cff=function(_0x23db69,_0x4f4161){_0x23db69=_0x23db69-0x0;var _0x3b3c11=_0xcff9[_0x23db69];return _0x3b3c11;};'use strict';var _=require(_0x9cff('0x0'));var moment=require(_0x9cff('0x1'));var md5=require(_0x9cff('0x2'));var Redis=require(_0x9cff('0x3'));var config=require('../../../config/environment');config[_0x9cff('0x4')]=_[_0x9cff('0x5')](config['redis'],{'host':_0x9cff('0x6'),'port':0x18eb});var io=require(_0x9cff('0x7'))(new Redis(config[_0x9cff('0x4')]));function Agent(_0x18422f){this['id']=_0x18422f['id']||0x0;this[_0x9cff('0x8')]=_0x18422f[_0x9cff('0x8')]||'';this['online']=_0x18422f['online']||!![];this[_0x9cff('0x9')]=_0x18422f['voicePause']||![];this[_0x9cff('0xa')]=_0x18422f['chatPause']||![];this[_0x9cff('0xb')]=_0x18422f[_0x9cff('0xb')]||![];this['faxPause']=_0x18422f['faxPause']||![];this[_0x9cff('0xc')]=_0x18422f[_0x9cff('0xc')]||![];this[_0x9cff('0xd')]=_0x18422f[_0x9cff('0xd')]||![];this['chatStatus']=_0x9cff('0xe');this[_0x9cff('0xf')]=0x0;this[_0x9cff('0x10')]=_0x18422f[_0x9cff('0x10')]||0x0;this[_0x9cff('0x11')]=0x0;this[_0x9cff('0x12')]=_0x9cff('0xe');this['mailStatusTime']=0x0;this[_0x9cff('0x13')]=_0x18422f[_0x9cff('0x13')]||0x0;this[_0x9cff('0x14')]=0x0;this['faxStatus']='unknown';this[_0x9cff('0x15')]=0x0;this[_0x9cff('0x16')]=_0x18422f[_0x9cff('0x16')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x9cff('0x17')]=_0x9cff('0xe');this[_0x9cff('0x18')]=0x0;this[_0x9cff('0x19')]=_0x18422f[_0x9cff('0x19')]||0x0;this[_0x9cff('0x1a')]=0x0;this[_0x9cff('0x1b')]=_0x9cff('0xe');this[_0x9cff('0x1c')]=0x0;this[_0x9cff('0x1d')]=_0x18422f['whatsappCapacity']||0x0;this[_0x9cff('0x1e')]=0x0;this[_0x9cff('0x1f')]=_0x9cff('0xe');this['openchannelStatusTime']=0x0;this[_0x9cff('0x20')]=_0x18422f[_0x9cff('0x20')]||0x0;this[_0x9cff('0x21')]=0x0;this[_0x9cff('0x22')]=![];this[_0x9cff('0x23')]=undefined;this[_0x9cff('0x2')]='';this[_0x9cff('0x24')]();}Agent[_0x9cff('0x25')][_0x9cff('0x26')]=function(_0x1babfb){if(this[_0x1babfb+_0x9cff('0x27')]>0x0){if(this[_0x1babfb+_0x9cff('0x28')]>0x0&&this[_0x1babfb+'CurrentCapacity']>=this[_0x1babfb+_0x9cff('0x28')]){return'maxcapacity';}else{return _0x9cff('0x29');}}else{return'idle';}};Agent[_0x9cff('0x25')][_0x9cff('0x24')]=function(){var _0x3088b8=[_0x9cff('0x2a'),_0x9cff('0x2b'),'openchannel',_0x9cff('0x2c'),_0x9cff('0x2d'),_0x9cff('0x2e')];for(var _0x481eb9=0x0;_0x481eb9<_0x3088b8[_0x9cff('0x2f')];_0x481eb9+=0x1){var _0x479d72=this[_0x9cff('0x26')](_0x3088b8[_0x481eb9]);if(this[_0x3088b8[_0x481eb9]+_0x9cff('0x30')]!==_0x479d72){this[_0x3088b8[_0x481eb9]+_0x9cff('0x31')]=_['toNumber'](moment()[_0x9cff('0x32')]('x'));}this[_0x3088b8[_0x481eb9]+'Status']=_0x479d72;}var _0x56dfa8={'id':this['id'],'name':this[_0x9cff('0x8')],'online':this[_0x9cff('0x33')],'voicePause':this['voicePause'],'chatPause':this[_0x9cff('0xa')],'mailPause':this[_0x9cff('0xb')],'smsPause':this[_0x9cff('0xc')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x9cff('0x34')],'chatStatusTime':this[_0x9cff('0xf')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x9cff('0x11')],'mailStatus':this[_0x9cff('0x12')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x9cff('0x13')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x9cff('0x15')],'faxCapacity':this[_0x9cff('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x9cff('0x18')],'smsCapacity':this[_0x9cff('0x19')],'smsCurrentCapacity':this[_0x9cff('0x1a')],'whatsappStatus':this[_0x9cff('0x1b')],'whatsappStatusTime':this[_0x9cff('0x1c')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x9cff('0x1e')],'openchannelStatus':this[_0x9cff('0x1f')],'openchannelStatusTime':this[_0x9cff('0x35')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x9cff('0x22')],'busyQueue':this[_0x9cff('0x23')]};var _0x5d3cfa=md5(JSON[_0x9cff('0x36')](_0x56dfa8));if(this['md5']!==_0x5d3cfa){this[_0x9cff('0x2')]=_0x5d3cfa;io[_0x9cff('0x37')](_0x9cff('0x38'),_0x56dfa8);}};module[_0x9cff('0x39')]=Agent; \ No newline at end of file +var _0x0b95=['defaults','localhost','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','chat','openchannel','fax','whatsapp','length','format','Status','chatPause','mailStatusTime','faxStatusTime','smsStatusTime','smsCurrentCapacity','whatsappCurrentCapacity','busy','stringify','emit','user:save','moment','md5','ioredis','../../../config/environment','redis'];(function(_0x5de8fa,_0x4665af){var _0x136868=function(_0xf16f59){while(--_0xf16f59){_0x5de8fa['push'](_0x5de8fa['shift']());}};_0x136868(++_0x4665af);}(_0x0b95,0x198));var _0x50b9=function(_0x1c4c91,_0x3e2517){_0x1c4c91=_0x1c4c91-0x0;var _0x1f2b38=_0x0b95[_0x1c4c91];return _0x1f2b38;};'use strict';var _=require('lodash');var moment=require(_0x50b9('0x0'));var md5=require(_0x50b9('0x1'));var Redis=require(_0x50b9('0x2'));var config=require(_0x50b9('0x3'));config[_0x50b9('0x4')]=_[_0x50b9('0x5')](config[_0x50b9('0x4')],{'host':_0x50b9('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x557f40){this['id']=_0x557f40['id']||0x0;this[_0x50b9('0x7')]=_0x557f40[_0x50b9('0x7')]||'';this[_0x50b9('0x8')]=_0x557f40[_0x50b9('0x8')]||!![];this['voicePause']=_0x557f40[_0x50b9('0x9')]||![];this['chatPause']=_0x557f40['chatPause']||![];this['mailPause']=_0x557f40[_0x50b9('0xa')]||![];this['faxPause']=_0x557f40[_0x50b9('0xb')]||![];this[_0x50b9('0xc')]=_0x557f40['smsPause']||![];this[_0x50b9('0xd')]=_0x557f40['openchannelPause']||![];this[_0x50b9('0xe')]=_0x50b9('0xf');this[_0x50b9('0x10')]=0x0;this[_0x50b9('0x11')]=_0x557f40[_0x50b9('0x11')]||0x0;this[_0x50b9('0x12')]=0x0;this[_0x50b9('0x13')]=_0x50b9('0xf');this['mailStatusTime']=0x0;this[_0x50b9('0x14')]=_0x557f40[_0x50b9('0x14')]||0x0;this[_0x50b9('0x15')]=0x0;this[_0x50b9('0x16')]=_0x50b9('0xf');this['faxStatusTime']=0x0;this[_0x50b9('0x17')]=_0x557f40['faxCapacity']||0x0;this[_0x50b9('0x18')]=0x0;this[_0x50b9('0x19')]='unknown';this['smsStatusTime']=0x0;this[_0x50b9('0x1a')]=_0x557f40['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0x50b9('0x1b')]=_0x50b9('0xf');this[_0x50b9('0x1c')]=0x0;this['whatsappCapacity']=_0x557f40[_0x50b9('0x1d')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x50b9('0x1e')]='unknown';this[_0x50b9('0x1f')]=0x0;this[_0x50b9('0x20')]=_0x557f40[_0x50b9('0x20')]||0x0;this[_0x50b9('0x21')]=0x0;this['busy']=![];this[_0x50b9('0x22')]=undefined;this[_0x50b9('0x1')]='';this[_0x50b9('0x23')]();}Agent[_0x50b9('0x24')][_0x50b9('0x25')]=function(_0x14c448){if(this[_0x14c448+_0x50b9('0x26')]>0x0){if(this[_0x14c448+_0x50b9('0x27')]>0x0&&this[_0x14c448+'CurrentCapacity']>=this[_0x14c448+_0x50b9('0x27')]){return _0x50b9('0x28');}else{return'working';}}else{return _0x50b9('0x29');}};Agent[_0x50b9('0x24')][_0x50b9('0x23')]=function(){var _0x2a047e=['mail',_0x50b9('0x2a'),_0x50b9('0x2b'),_0x50b9('0x2c'),'sms',_0x50b9('0x2d')];for(var _0x610d45=0x0;_0x610d45<_0x2a047e[_0x50b9('0x2e')];_0x610d45+=0x1){var _0x4af818=this[_0x50b9('0x25')](_0x2a047e[_0x610d45]);if(this[_0x2a047e[_0x610d45]+'Status']!==_0x4af818){this[_0x2a047e[_0x610d45]+'StatusTime']=_['toNumber'](moment()[_0x50b9('0x2f')]('x'));}this[_0x2a047e[_0x610d45]+_0x50b9('0x30')]=_0x4af818;}var _0x5bd2b0={'id':this['id'],'name':this[_0x50b9('0x7')],'online':this['online'],'voicePause':this[_0x50b9('0x9')],'chatPause':this[_0x50b9('0x31')],'mailPause':this[_0x50b9('0xa')],'smsPause':this[_0x50b9('0xc')],'faxPause':this['faxPause'],'openchannelPause':this[_0x50b9('0xd')],'chatStatus':this[_0x50b9('0xe')],'chatStatusTime':this[_0x50b9('0x10')],'chatCapacity':this[_0x50b9('0x11')],'chatCurrentCapacity':this[_0x50b9('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x50b9('0x32')],'mailCapacity':this[_0x50b9('0x14')],'mailCurrentCapacity':this[_0x50b9('0x15')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x50b9('0x33')],'faxCapacity':this[_0x50b9('0x17')],'faxCurrentCapacity':this[_0x50b9('0x18')],'smsStatus':this[_0x50b9('0x19')],'smsStatusTime':this[_0x50b9('0x34')],'smsCapacity':this[_0x50b9('0x1a')],'smsCurrentCapacity':this[_0x50b9('0x35')],'whatsappStatus':this[_0x50b9('0x1b')],'whatsappStatusTime':this[_0x50b9('0x1c')],'whatsappCapacity':this[_0x50b9('0x1d')],'whatsappCurrentCapacity':this[_0x50b9('0x36')],'openchannelStatus':this[_0x50b9('0x1e')],'openchannelStatusTime':this[_0x50b9('0x1f')],'openchannelCapacity':this[_0x50b9('0x20')],'openchannelCurrentCapacity':this[_0x50b9('0x21')],'busy':this[_0x50b9('0x37')],'busyQueue':this[_0x50b9('0x22')]};var _0x430540=md5(JSON[_0x50b9('0x38')](_0x5bd2b0));if(this['md5']!==_0x430540){this[_0x50b9('0x1')]=_0x430540;io[_0x50b9('0x39')](_0x50b9('0x3a'),_0x5bd2b0);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 73045d4..4c5f841 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 _0x9005=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9005,0x154));var _0x5900=function(_0x3c9def,_0x5384ea){_0x3c9def=_0x3c9def-0x0;var _0x591e39=_0x9005[_0x3c9def];return _0x591e39;};'use strict';var _=require(_0x5900('0x0'));var md5=require(_0x5900('0x1'));var util=require(_0x5900('0x2'));var Redis=require(_0x5900('0x3'));var config=require(_0x5900('0x4'));config[_0x5900('0x5')]=_[_0x5900('0x6')](config['redis'],{'host':_0x5900('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x1494df){this['id']=_0x1494df['id']||0x0;this[_0x5900('0x8')]=_0x1494df['name']||'';this['timeout']=_0x1494df[_0x5900('0x9')]||0xa;this['strategy']=_0x1494df[_0x5900('0xa')]||_0x5900('0xb');this[_0x5900('0xc')]=_0x1494df[_0x5900('0xc')];this[_0x5900('0xd')]={};this[_0x5900('0xe')]=0x0;this[_0x5900('0x1')]='';this[_0x5900('0xf')]();this[_0x5900('0x10')]();}ChatQueue[_0x5900('0x11')][_0x5900('0xf')]=function(){var _0x56dbc0=this[_0x5900('0xd')][_0x5900('0x12')];this[_0x5900('0xd')]=_['map'](this[_0x5900('0xc')],'id');this['mapAgentsId'][_0x5900('0x12')]=_0x56dbc0;};ChatQueue[_0x5900('0x11')][_0x5900('0x10')]=function(){this[_0x5900('0x13')]=0x0;this[_0x5900('0x14')]=0x0;for(var _0x1956a3=0x0;_0x1956a3=0x0?this[_0x5900('0x18')]:0x0;var _0x1a2efd={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5900('0x13')],'name':this[_0x5900('0x8')],'paused':this['paused'],'waiting':this[_0x5900('0xe')]};var _0x228133=md5(JSON[_0x5900('0x19')](_0x1a2efd));if(this[_0x5900('0x1')]!==_0x228133){this[_0x5900('0x1')]=_0x228133;io['to'](util[_0x5900('0x1a')](_0x5900('0x1b'),_0x1a2efd[_0x5900('0x8')]))['emit']('chat_queue:save',_0x1a2efd);}};module[_0x5900('0x1c')]=ChatQueue; \ No newline at end of file +var _0x9126=['loggedIn','available','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','paused','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9126,0x10c));var _0x6912=function(_0x5869c4,_0x399531){_0x5869c4=_0x5869c4-0x0;var _0x5f56e9=_0x9126[_0x5869c4];return _0x5f56e9;};'use strict';var _=require(_0x6912('0x0'));var md5=require(_0x6912('0x1'));var util=require(_0x6912('0x2'));var Redis=require(_0x6912('0x3'));var config=require(_0x6912('0x4'));config[_0x6912('0x5')]=_[_0x6912('0x6')](config[_0x6912('0x5')],{'host':_0x6912('0x7'),'port':0x18eb});var io=require(_0x6912('0x8'))(new Redis(config[_0x6912('0x5')]));function ChatQueue(_0x494337){this['id']=_0x494337['id']||0x0;this[_0x6912('0x9')]=_0x494337['name']||'';this[_0x6912('0xa')]=_0x494337[_0x6912('0xa')]||0xa;this[_0x6912('0xb')]=_0x494337[_0x6912('0xb')]||_0x6912('0xc');this[_0x6912('0xd')]=_0x494337[_0x6912('0xd')];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0x6912('0xe')]();this[_0x6912('0xf')]();}ChatQueue[_0x6912('0x10')][_0x6912('0xe')]=function(){var _0x3ddec6=this[_0x6912('0x11')][_0x6912('0x12')];this[_0x6912('0x11')]=_[_0x6912('0x13')](this[_0x6912('0xd')],'id');this[_0x6912('0x11')]['_rr']=_0x3ddec6;};ChatQueue['prototype'][_0x6912('0xf')]=function(){this['loggedIn']=0x0;this[_0x6912('0x14')]=0x0;for(var _0x18a0d7=0x0;_0x18a0d7=0x0?this['available']:0x0;var _0x25cbdb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6912('0x16')],'name':this[_0x6912('0x9')],'paused':this[_0x6912('0x14')],'waiting':this['waiting']};var _0x3748dd=md5(JSON['stringify'](_0x25cbdb));if(this[_0x6912('0x1')]!==_0x3748dd){this[_0x6912('0x1')]=_0x3748dd;io['to'](util[_0x6912('0x18')](_0x6912('0x19'),_0x25cbdb['name']))[_0x6912('0x1a')](_0x6912('0x1b'),_0x25cbdb);}};module[_0x6912('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 37dd79d..911e56d 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 _0xf21b=['updateRealtime','prototype','_rr','map','Agents','paused','online','loggedIn','faxPause','available','stringify','fax:queue:%s','emit','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting'];(function(_0x2dcef1,_0x60a4ce){var _0x12dadb=function(_0x47e21c){while(--_0x47e21c){_0x2dcef1['push'](_0x2dcef1['shift']());}};_0x12dadb(++_0x60a4ce);}(_0xf21b,0x1d8));var _0xbf21=function(_0x2d367c,_0x4e505a){_0x2d367c=_0x2d367c-0x0;var _0x3e30af=_0xf21b[_0x2d367c];return _0x3e30af;};'use strict';var _=require('lodash');var md5=require(_0xbf21('0x0'));var util=require(_0xbf21('0x1'));var Redis=require(_0xbf21('0x2'));var config=require(_0xbf21('0x3'));config[_0xbf21('0x4')]=_[_0xbf21('0x5')](config[_0xbf21('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xbf21('0x6'))(new Redis(config[_0xbf21('0x4')]));function FaxQueue(_0x465ff5){this['id']=_0x465ff5['id']||0x0;this[_0xbf21('0x7')]=_0x465ff5['name']||'';this[_0xbf21('0x8')]=_0x465ff5['timeout']||0xa;this[_0xbf21('0x9')]=_0x465ff5[_0xbf21('0x9')]||_0xbf21('0xa');this['Agents']=_0x465ff5['Agents'];this[_0xbf21('0xb')]={};this[_0xbf21('0xc')]=0x0;this[_0xbf21('0x0')]='';this[_0xbf21('0xd')]();this[_0xbf21('0xe')]();}FaxQueue[_0xbf21('0xf')][_0xbf21('0xd')]=function(){var _0x3a4af6=this[_0xbf21('0xb')][_0xbf21('0x10')];this['mapAgentsId']=_[_0xbf21('0x11')](this[_0xbf21('0x12')],'id');this[_0xbf21('0xb')]['_rr']=_0x3a4af6;};FaxQueue[_0xbf21('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xbf21('0x13')]=0x0;for(var _0x3239d9=0x0;_0x3239d9=0x0?this['available']:0x0;var _0x1ed251={'id':this['id'],'available':this[_0xbf21('0x17')],'loggedIn':this[_0xbf21('0x15')],'name':this[_0xbf21('0x7')],'paused':this[_0xbf21('0x13')],'waiting':this[_0xbf21('0xc')]};var _0x21aa91=md5(JSON[_0xbf21('0x18')](_0x1ed251));if(this['md5']!==_0x21aa91){this['md5']=_0x21aa91;io['to'](util['format'](_0xbf21('0x19'),_0x1ed251[_0xbf21('0x7')]))[_0xbf21('0x1a')]('fax_queue:save',_0x1ed251);}};module['exports']=FaxQueue; \ No newline at end of file +var _0xf9d9=['util','ioredis','redis','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','paused','length','online','faxPause','available','stringify','md5','fax:queue:%s','emit','fax_queue:save','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf9d9,0xdf));var _0x9f9d=function(_0x2a8b5c,_0x429c22){_0x2a8b5c=_0x2a8b5c-0x0;var _0x3bbefe=_0xf9d9[_0x2a8b5c];return _0x3bbefe;};'use strict';var _=require(_0x9f9d('0x0'));var md5=require('md5');var util=require(_0x9f9d('0x1'));var Redis=require(_0x9f9d('0x2'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x9f9d('0x3')],{'host':_0x9f9d('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9f9d('0x3')]));function FaxQueue(_0x2bd32c){this['id']=_0x2bd32c['id']||0x0;this[_0x9f9d('0x5')]=_0x2bd32c[_0x9f9d('0x5')]||'';this[_0x9f9d('0x6')]=_0x2bd32c['timeout']||0xa;this[_0x9f9d('0x7')]=_0x2bd32c[_0x9f9d('0x7')]||_0x9f9d('0x8');this[_0x9f9d('0x9')]=_0x2bd32c[_0x9f9d('0x9')];this['mapAgentsId']={};this[_0x9f9d('0xa')]=0x0;this['md5']='';this[_0x9f9d('0xb')]();this[_0x9f9d('0xc')]();}FaxQueue['prototype']['updateRouting']=function(){var _0x2f82ce=this[_0x9f9d('0xd')][_0x9f9d('0xe')];this[_0x9f9d('0xd')]=_[_0x9f9d('0xf')](this[_0x9f9d('0x9')],'id');this[_0x9f9d('0xd')]['_rr']=_0x2f82ce;};FaxQueue[_0x9f9d('0x10')][_0x9f9d('0xc')]=function(){this[_0x9f9d('0x11')]=0x0;this[_0x9f9d('0x12')]=0x0;for(var _0x52355b=0x0;_0x52355b=0x0?this[_0x9f9d('0x16')]:0x0;var _0x95a9dd={'id':this['id'],'available':this[_0x9f9d('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x9f9d('0x5')],'paused':this[_0x9f9d('0x12')],'waiting':this[_0x9f9d('0xa')]};var _0x3b31bc=md5(JSON[_0x9f9d('0x17')](_0x95a9dd));if(this[_0x9f9d('0x18')]!==_0x3b31bc){this[_0x9f9d('0x18')]=_0x3b31bc;io['to'](util['format'](_0x9f9d('0x19'),_0x95a9dd[_0x9f9d('0x5')]))[_0x9f9d('0x1a')](_0x9f9d('0x1b'),_0x95a9dd);}};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 8d8f46d..999f61a 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 _0x974d=['name','Intervals','exports'];(function(_0x3e0f29,_0x2ae461){var _0x3ddb82=function(_0x86438e){while(--_0x86438e){_0x3e0f29['push'](_0x3e0f29['shift']());}};_0x3ddb82(++_0x2ae461);}(_0x974d,0x19b));var _0xd974=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x974d[_0x2c91e9];return _0x13f0ff;};'use strict';function Interval(_0x309f14){this['id']=_0x309f14['id']||0x0;this[_0xd974('0x0')]=_0x309f14[_0xd974('0x0')]||'';this[_0xd974('0x1')]=_0x309f14[_0xd974('0x1')]||{};}module[_0xd974('0x2')]=Interval; \ No newline at end of file +var _0x17fc=['exports','name','Intervals'];(function(_0x36cc19,_0xa29f1f){var _0x3f7c4a=function(_0xc43e60){while(--_0xc43e60){_0x36cc19['push'](_0x36cc19['shift']());}};_0x3f7c4a(++_0xa29f1f);}(_0x17fc,0xd3));var _0xc17f=function(_0x5aa0f0,_0x1b1523){_0x5aa0f0=_0x5aa0f0-0x0;var _0x485552=_0x17fc[_0x5aa0f0];return _0x485552;};'use strict';function Interval(_0x56a7b9){this['id']=_0x56a7b9['id']||0x0;this[_0xc17f('0x0')]=_0x56a7b9[_0xc17f('0x0')]||'';this[_0xc17f('0x1')]=_0x56a7b9[_0xc17f('0x1')]||{};}module[_0xc17f('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 7148208..66e8cf2 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 _0xf2f8=['format','mail_queue:save','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','Agents','loggedIn','paused','online','mailPause','available','stringify'];(function(_0x290ceb,_0x1941ca){var _0x205565=function(_0x31bd18){while(--_0x31bd18){_0x290ceb['push'](_0x290ceb['shift']());}};_0x205565(++_0x1941ca);}(_0xf2f8,0xc6));var _0x8f2f=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xf2f8[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x8f2f('0x0'));var md5=require(_0x8f2f('0x1'));var util=require(_0x8f2f('0x2'));var Redis=require('ioredis');var config=require(_0x8f2f('0x3'));config[_0x8f2f('0x4')]=_[_0x8f2f('0x5')](config[_0x8f2f('0x4')],{'host':_0x8f2f('0x6'),'port':0x18eb});var io=require(_0x8f2f('0x7'))(new Redis(config[_0x8f2f('0x4')]));function MailQueue(_0x2aadb9){this['id']=_0x2aadb9['id']||0x0;this[_0x8f2f('0x8')]=_0x2aadb9['name']||'';this[_0x8f2f('0x9')]=_0x2aadb9[_0x8f2f('0x9')]||0xa;this[_0x8f2f('0xa')]=_0x2aadb9['strategy']||_0x8f2f('0xb');this['Agents']=_0x2aadb9['Agents'];this['mapAgentsId']={};this[_0x8f2f('0xc')]=0x0;this['md5']='';this[_0x8f2f('0xd')]();this[_0x8f2f('0xe')]();}MailQueue[_0x8f2f('0xf')][_0x8f2f('0xd')]=function(){var _0x2a81c3=this[_0x8f2f('0x10')][_0x8f2f('0x11')];this[_0x8f2f('0x10')]=_[_0x8f2f('0x12')](this[_0x8f2f('0x13')],'id');this['mapAgentsId'][_0x8f2f('0x11')]=_0x2a81c3;};MailQueue[_0x8f2f('0xf')][_0x8f2f('0xe')]=function(){this[_0x8f2f('0x14')]=0x0;this[_0x8f2f('0x15')]=0x0;for(var _0x47ebbe=0x0;_0x47ebbe=0x0?this['available']:0x0;var _0x5ade63={'id':this['id'],'available':this[_0x8f2f('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x8f2f('0x8')],'paused':this[_0x8f2f('0x15')],'waiting':this[_0x8f2f('0xc')]};var _0x5f4c9b=md5(JSON[_0x8f2f('0x19')](_0x5ade63));if(this[_0x8f2f('0x1')]!==_0x5f4c9b){this[_0x8f2f('0x1')]=_0x5f4c9b;io['to'](util[_0x8f2f('0x1a')]('mail:queue:%s',_0x5ade63['name']))['emit'](_0x8f2f('0x1b'),_0x5ade63);}};module['exports']=MailQueue; \ No newline at end of file +var _0xc696=['updateRouting','_rr','map','mapAgentsId','loggedIn','length','online','mailPause','paused','available','format','emit','exports','lodash','md5','util','ioredis','redis','defaults','localhost','name','strategy','beepall','Agents','waiting','updateRealtime','prototype'];(function(_0x20bff7,_0x2f76c8){var _0xeb2645=function(_0x46e4ee){while(--_0x46e4ee){_0x20bff7['push'](_0x20bff7['shift']());}};_0xeb2645(++_0x2f76c8);}(_0xc696,0x136));var _0x6c69=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xc696[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x6c69('0x0'));var md5=require(_0x6c69('0x1'));var util=require(_0x6c69('0x2'));var Redis=require(_0x6c69('0x3'));var config=require('../../../config/environment');config[_0x6c69('0x4')]=_[_0x6c69('0x5')](config['redis'],{'host':_0x6c69('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x5063b8){this['id']=_0x5063b8['id']||0x0;this[_0x6c69('0x7')]=_0x5063b8[_0x6c69('0x7')]||'';this['timeout']=_0x5063b8['timeout']||0xa;this['strategy']=_0x5063b8[_0x6c69('0x8')]||_0x6c69('0x9');this[_0x6c69('0xa')]=_0x5063b8[_0x6c69('0xa')];this['mapAgentsId']={};this[_0x6c69('0xb')]=0x0;this['md5']='';this['updateRouting']();this[_0x6c69('0xc')]();}MailQueue[_0x6c69('0xd')][_0x6c69('0xe')]=function(){var _0x56f2eb=this['mapAgentsId'][_0x6c69('0xf')];this['mapAgentsId']=_[_0x6c69('0x10')](this[_0x6c69('0xa')],'id');this[_0x6c69('0x11')][_0x6c69('0xf')]=_0x56f2eb;};MailQueue[_0x6c69('0xd')][_0x6c69('0xc')]=function(){this[_0x6c69('0x12')]=0x0;this['paused']=0x0;for(var _0x323acf=0x0;_0x323acf=0x0?this[_0x6c69('0x17')]:0x0;var _0x5b68a1={'id':this['id'],'available':this[_0x6c69('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x6c69('0x7')],'paused':this[_0x6c69('0x16')],'waiting':this[_0x6c69('0xb')]};var _0x1714f1=md5(JSON['stringify'](_0x5b68a1));if(this['md5']!==_0x1714f1){this[_0x6c69('0x1')]=_0x1714f1;io['to'](util[_0x6c69('0x18')]('mail:queue:%s',_0x5b68a1['name']))[_0x6c69('0x19')]('mail_queue:save',_0x5b68a1);}};module[_0x6c69('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 6743f83..5d58b2e 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x4f01e1,_0x320904){var _0x1f949f=function(_0x54f4f3){while(--_0x54f4f3){_0x4f01e1['push'](_0x4f01e1['shift']());}};_0x1f949f(++_0x320904);}(_0x814b,0x1a2));var _0xb814=function(_0x36de10,_0xfe25e8){_0x36de10=_0x36de10-0x0;var _0x58100f=_0x814b[_0x36de10];return _0x58100f;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x3a0662,_0x381fe3){var _0x455b88=function(_0x5a57f5){while(--_0x5a57f5){_0x3a0662['push'](_0x3a0662['shift']());}};_0x455b88(++_0x381fe3);}(_0x814b,0x1a2));var _0xb814=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x814b[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index ebbf636..c0555bb 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 _0x222f=['lodash','md5','util','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','map','_rr','updateRealtime','loggedIn','length','online','smsPause','paused','available','stringify','sms:queue:%s','emit','sms_queue:save','exports'];(function(_0x3972f3,_0x3c5b39){var _0xf20dee=function(_0x29f555){while(--_0x29f555){_0x3972f3['push'](_0x3972f3['shift']());}};_0xf20dee(++_0x3c5b39);}(_0x222f,0x1a4));var _0xf222=function(_0x1b95a1,_0x529852){_0x1b95a1=_0x1b95a1-0x0;var _0x57aef1=_0x222f[_0x1b95a1];return _0x57aef1;};'use strict';var _=require(_0xf222('0x0'));var md5=require(_0xf222('0x1'));var util=require(_0xf222('0x2'));var Redis=require(_0xf222('0x3'));var config=require('../../../config/environment');config['redis']=_[_0xf222('0x4')](config[_0xf222('0x5')],{'host':_0xf222('0x6'),'port':0x18eb});var io=require(_0xf222('0x7'))(new Redis(config['redis']));function SmsQueue(_0x3a2751){this['id']=_0x3a2751['id']||0x0;this['name']=_0x3a2751[_0xf222('0x8')]||'';this[_0xf222('0x9')]=_0x3a2751['timeout']||0xa;this[_0xf222('0xa')]=_0x3a2751[_0xf222('0xa')]||'beepall';this[_0xf222('0xb')]=_0x3a2751[_0xf222('0xb')];this[_0xf222('0xc')]={};this[_0xf222('0xd')]=0x0;this[_0xf222('0x1')]='';this[_0xf222('0xe')]();this['updateRealtime']();}SmsQueue[_0xf222('0xf')][_0xf222('0xe')]=function(){var _0x226dbd=this[_0xf222('0xc')]['_rr'];this[_0xf222('0xc')]=_[_0xf222('0x10')](this[_0xf222('0xb')],'id');this[_0xf222('0xc')][_0xf222('0x11')]=_0x226dbd;};SmsQueue[_0xf222('0xf')][_0xf222('0x12')]=function(){this[_0xf222('0x13')]=0x0;this['paused']=0x0;for(var _0x5b8f97=0x0;_0x5b8f97=0x0?this[_0xf222('0x18')]:0x0;var _0xfb4ddf={'id':this['id'],'available':this[_0xf222('0x18')],'loggedIn':this[_0xf222('0x13')],'name':this[_0xf222('0x8')],'paused':this['paused'],'waiting':this[_0xf222('0xd')]};var _0x1bdd0a=md5(JSON[_0xf222('0x19')](_0xfb4ddf));if(this[_0xf222('0x1')]!==_0x1bdd0a){this['md5']=_0x1bdd0a;io['to'](util['format'](_0xf222('0x1a'),_0xfb4ddf[_0xf222('0x8')]))[_0xf222('0x1b')](_0xf222('0x1c'),_0xfb4ddf);}};module[_0xf222('0x1d')]=SmsQueue; \ No newline at end of file +var _0x6e77=['format','sms:queue:%s','emit','sms_queue:save','exports','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','smsPause','paused','available'];(function(_0x495c39,_0x1d430c){var _0x2c2142=function(_0x173eee){while(--_0x173eee){_0x495c39['push'](_0x495c39['shift']());}};_0x2c2142(++_0x1d430c);}(_0x6e77,0xef));var _0x76e7=function(_0x343e44,_0x519af9){_0x343e44=_0x343e44-0x0;var _0xa5130e=_0x6e77[_0x343e44];return _0xa5130e;};'use strict';var _=require('lodash');var md5=require(_0x76e7('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x76e7('0x1'));config[_0x76e7('0x2')]=_['defaults'](config[_0x76e7('0x2')],{'host':_0x76e7('0x3'),'port':0x18eb});var io=require(_0x76e7('0x4'))(new Redis(config['redis']));function SmsQueue(_0x498ec3){this['id']=_0x498ec3['id']||0x0;this[_0x76e7('0x5')]=_0x498ec3[_0x76e7('0x5')]||'';this[_0x76e7('0x6')]=_0x498ec3['timeout']||0xa;this[_0x76e7('0x7')]=_0x498ec3[_0x76e7('0x7')]||_0x76e7('0x8');this['Agents']=_0x498ec3[_0x76e7('0x9')];this[_0x76e7('0xa')]={};this['waiting']=0x0;this[_0x76e7('0x0')]='';this[_0x76e7('0xb')]();this[_0x76e7('0xc')]();}SmsQueue[_0x76e7('0xd')]['updateRouting']=function(){var _0xdb24f6=this[_0x76e7('0xa')][_0x76e7('0xe')];this[_0x76e7('0xa')]=_[_0x76e7('0xf')](this[_0x76e7('0x9')],'id');this[_0x76e7('0xa')][_0x76e7('0xe')]=_0xdb24f6;};SmsQueue[_0x76e7('0xd')][_0x76e7('0xc')]=function(){this[_0x76e7('0x10')]=0x0;this['paused']=0x0;for(var _0x2661d2=0x0;_0x2661d2=0x0?this['available']:0x0;var _0x91d06e={'id':this['id'],'available':this[_0x76e7('0x14')],'loggedIn':this[_0x76e7('0x10')],'name':this[_0x76e7('0x5')],'paused':this[_0x76e7('0x13')],'waiting':this['waiting']};var _0xfd3d29=md5(JSON['stringify'](_0x91d06e));if(this[_0x76e7('0x0')]!==_0xfd3d29){this[_0x76e7('0x0')]=_0xfd3d29;io['to'](util[_0x76e7('0x15')](_0x76e7('0x16'),_0x91d06e[_0x76e7('0x5')]))[_0x76e7('0x17')](_0x76e7('0x18'),_0x91d06e);}};module[_0x76e7('0x19')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 8a76d27..5590c7c 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 _0x834a=['length','online','available','format','whatsapp:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','loggedIn','paused'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x834a,0x93));var _0xa834=function(_0x143f3f,_0xf84b8f){_0x143f3f=_0x143f3f-0x0;var _0x218368=_0x834a[_0x143f3f];return _0x218368;};'use strict';var _=require(_0xa834('0x0'));var md5=require(_0xa834('0x1'));var util=require(_0xa834('0x2'));var Redis=require(_0xa834('0x3'));var config=require(_0xa834('0x4'));config[_0xa834('0x5')]=_[_0xa834('0x6')](config[_0xa834('0x5')],{'host':_0xa834('0x7'),'port':0x18eb});var io=require(_0xa834('0x8'))(new Redis(config[_0xa834('0x5')]));function WhatsappQueue(_0x188942){this['id']=_0x188942['id']||0x0;this[_0xa834('0x9')]=_0x188942[_0xa834('0x9')]||'';this[_0xa834('0xa')]=_0x188942[_0xa834('0xa')]||0xa;this[_0xa834('0xb')]=_0x188942[_0xa834('0xb')]||'beepall';this[_0xa834('0xc')]=_0x188942['Agents'];this[_0xa834('0xd')]={};this[_0xa834('0xe')]=0x0;this[_0xa834('0x1')]='';this['updateRouting']();this[_0xa834('0xf')]();}WhatsappQueue[_0xa834('0x10')]['updateRouting']=function(){var _0x47772a=this['mapAgentsId'][_0xa834('0x11')];this[_0xa834('0xd')]=_[_0xa834('0x12')](this[_0xa834('0xc')],'id');this[_0xa834('0xd')][_0xa834('0x11')]=_0x47772a;};WhatsappQueue[_0xa834('0x10')][_0xa834('0xf')]=function(){this[_0xa834('0x13')]=0x0;this[_0xa834('0x14')]=0x0;for(var _0x16120b=0x0;_0x16120b=0x0?this[_0xa834('0x17')]:0x0;var _0x56acbf={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xa834('0x9')],'paused':this[_0xa834('0x14')],'waiting':this[_0xa834('0xe')]};var _0x49cd1a=md5(JSON['stringify'](_0x56acbf));if(this[_0xa834('0x1')]!==_0x49cd1a){this[_0xa834('0x1')]=_0x49cd1a;io['to'](util[_0xa834('0x18')](_0xa834('0x19'),_0x56acbf[_0xa834('0x9')]))[_0xa834('0x1a')]('whatsapp_queue:save',_0x56acbf);}};module[_0xa834('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x710e=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','available','stringify','format','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x177ce4,_0x241a0b){var _0x1488a5=function(_0x1d40e9){while(--_0x1d40e9){_0x177ce4['push'](_0x177ce4['shift']());}};_0x1488a5(++_0x241a0b);}(_0x710e,0x6f));var _0xe710=function(_0x48723b,_0x568b00){_0x48723b=_0x48723b-0x0;var _0x26b738=_0x710e[_0x48723b];return _0x26b738;};'use strict';var _=require(_0xe710('0x0'));var md5=require(_0xe710('0x1'));var util=require(_0xe710('0x2'));var Redis=require(_0xe710('0x3'));var config=require(_0xe710('0x4'));config[_0xe710('0x5')]=_[_0xe710('0x6')](config[_0xe710('0x5')],{'host':_0xe710('0x7'),'port':0x18eb});var io=require(_0xe710('0x8'))(new Redis(config[_0xe710('0x5')]));function WhatsappQueue(_0x2e33a3){this['id']=_0x2e33a3['id']||0x0;this[_0xe710('0x9')]=_0x2e33a3['name']||'';this[_0xe710('0xa')]=_0x2e33a3['timeout']||0xa;this[_0xe710('0xb')]=_0x2e33a3['strategy']||_0xe710('0xc');this[_0xe710('0xd')]=_0x2e33a3[_0xe710('0xd')];this[_0xe710('0xe')]={};this[_0xe710('0xf')]=0x0;this[_0xe710('0x1')]='';this[_0xe710('0x10')]();this[_0xe710('0x11')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x3549e8=this[_0xe710('0xe')]['_rr'];this['mapAgentsId']=_[_0xe710('0x12')](this[_0xe710('0xd')],'id');this['mapAgentsId'][_0xe710('0x13')]=_0x3549e8;};WhatsappQueue[_0xe710('0x14')]['updateRealtime']=function(){this[_0xe710('0x15')]=0x0;this[_0xe710('0x16')]=0x0;for(var _0x2a4976=0x0;_0x2a4976=0x0?this[_0xe710('0x18')]:0x0;var _0x261bf2={'id':this['id'],'available':this[_0xe710('0x18')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xe710('0x16')],'waiting':this['waiting']};var _0x285698=md5(JSON[_0xe710('0x19')](_0x261bf2));if(this[_0xe710('0x1')]!==_0x285698){this[_0xe710('0x1')]=_0x285698;io['to'](util[_0xe710('0x1a')]('whatsapp:queue:%s',_0x261bf2[_0xe710('0x9')]))[_0xe710('0x1b')](_0xe710('0x1c'),_0x261bf2);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 906143a..d6e76ae 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(_0xcb3b44,_0x296e30){var _0x2d7e92=function(_0x2fad20){while(--_0x2fad20){_0xcb3b44['push'](_0xcb3b44['shift']());}};_0x2d7e92(++_0x296e30);}(_0xb10b,0x12a));var _0xbb10=function(_0x245efb,_0x2c636b){_0x245efb=_0x245efb-0x0;var _0x59ee7b=_0xb10b[_0x245efb];return _0x59ee7b;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 8e5640a..7acd82a 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 _0xf781=['update','UpdateChatInteraction','updateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x1e3f81,_0x409420){var _0x2b9247=function(_0x2df523){while(--_0x2df523){_0x1e3f81['push'](_0x1e3f81['shift']());}};_0x2b9247(++_0x409420);}(_0xf781,0x8f));var _0x1f78=function(_0x47af2f,_0x344bcf){_0x47af2f=_0x47af2f-0x0;var _0x59dd9a=_0xf781[_0x47af2f];return _0x59dd9a;};'use strict';var client=require(_0x1f78('0x0'));exports[_0x1f78('0x1')]=function(_0x2193d1,_0x2c7595){return client['Request'](_0x1f78('0x2'),{'body':_0x2c7595,'options':{'where':{'id':_0x2193d1}},'log':_0x1f78('0x3')});};exports[_0x1f78('0x4')]=function(_0xc654d7,_0x38068c){return client[_0x1f78('0x5')](_0x1f78('0x6'),{'body':_0x38068c,'options':{'where':{'id':_0xc654d7}},'log':_0x1f78('0x7')});}; \ No newline at end of file +var _0x768c=['../client','update','Request','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x34880d,_0x319ee9){var _0x54f38f=function(_0x13316d){while(--_0x13316d){_0x34880d['push'](_0x34880d['shift']());}};_0x54f38f(++_0x319ee9);}(_0x768c,0x186));var _0xc768=function(_0x5a6c29,_0x4b614e){_0x5a6c29=_0x5a6c29-0x0;var _0x1ef023=_0x768c[_0x5a6c29];return _0x1ef023;};'use strict';var client=require(_0xc768('0x0'));exports[_0xc768('0x1')]=function(_0x2d4ecb,_0x53ed5c){return client[_0xc768('0x2')]('UpdateChatInteraction',{'body':_0x53ed5c,'options':{'where':{'id':_0x2d4ecb}},'log':_0xc768('0x3')});};exports['addTags']=function(_0x3ee36e,_0x5c9aba){return client['Request'](_0xc768('0x4'),{'body':_0x5c9aba,'options':{'where':{'id':_0x3ee36e}},'log':_0xc768('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index c0abc88..f72f104 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 _0xaef4=['createChatMessage','create','Request','CreateChatMessage'];(function(_0x3e9424,_0x450199){var _0x2728ee=function(_0x19018b){while(--_0x19018b){_0x3e9424['push'](_0x3e9424['shift']());}};_0x2728ee(++_0x450199);}(_0xaef4,0x95));var _0x4aef=function(_0x5b7daf,_0x4be25f){_0x5b7daf=_0x5b7daf-0x0;var _0x337a7a=_0xaef4[_0x5b7daf];return _0x337a7a;};'use strict';var client=require('../client');exports[_0x4aef('0x0')]=function(_0x241b52){return client[_0x4aef('0x1')](_0x4aef('0x2'),{'body':_0x241b52,'log':_0x4aef('0x3')});}; \ No newline at end of file +var _0x2145=['Request','create'];(function(_0x2965d6,_0x4f3c54){var _0x122ef7=function(_0x3f31a6){while(--_0x3f31a6){_0x2965d6['push'](_0x2965d6['shift']());}};_0x122ef7(++_0x4f3c54);}(_0x2145,0x81));var _0x5214=function(_0x419432,_0x45d514){_0x419432=_0x419432-0x0;var _0x328b63=_0x2145[_0x419432];return _0x328b63;};'use strict';var client=require('../client');exports[_0x5214('0x0')]=function(_0x514fae){return client[_0x5214('0x1')]('CreateChatMessage',{'body':_0x514fae,'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 334aed0..f3cd047 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 _0x4ce6=['../client','Request','GetChatQueue','name','timeout','strategy','User','getChatQueues'];(function(_0x4d7775,_0x808554){var _0x4ff7db=function(_0x1f582e){while(--_0x1f582e){_0x4d7775['push'](_0x4d7775['shift']());}};_0x4ff7db(++_0x808554);}(_0x4ce6,0x108));var _0x64ce=function(_0x43dc7e,_0x49a390){_0x43dc7e=_0x43dc7e-0x0;var _0x21e12d=_0x4ce6[_0x43dc7e];return _0x21e12d;};'use strict';var client=require(_0x64ce('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x64ce('0x1')](_0x64ce('0x2'),{'options':{'raw':![],'attributes':['id',_0x64ce('0x3'),_0x64ce('0x4'),_0x64ce('0x5')],'include':[{'model':_0x64ce('0x6'),'as':'Agents','attributes':['id',_0x64ce('0x3'),'online','chatPause']}]},'log':_0x64ce('0x7')});};}; \ No newline at end of file +var _0x2a9a=['getChatQueues','../client','Request','timeout','strategy','User','Agents','name','chatPause'];(function(_0x2bdd9c,_0x31871a){var _0x2ded3b=function(_0x4d30f4){while(--_0x4d30f4){_0x2bdd9c['push'](_0x2bdd9c['shift']());}};_0x2ded3b(++_0x31871a);}(_0x2a9a,0x64));var _0xa2a9=function(_0x1e43a3,_0x5ef4e4){_0x1e43a3=_0x1e43a3-0x0;var _0x2a29d6=_0x2a9a[_0x1e43a3];return _0x2a29d6;};'use strict';var client=require(_0xa2a9('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xa2a9('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0xa2a9('0x2'),_0xa2a9('0x3')],'include':[{'model':_0xa2a9('0x4'),'as':_0xa2a9('0x5'),'attributes':['id',_0xa2a9('0x6'),'online',_0xa2a9('0x7')]}]},'log':_0xa2a9('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index ee99e39..9a88c46 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 _0x1159=['CreateChatQueueReport','update','UpdateChatQueueReport','../client','Request'];(function(_0x36f6da,_0x2f166b){var _0x57155e=function(_0x5bed0e){while(--_0x5bed0e){_0x36f6da['push'](_0x36f6da['shift']());}};_0x57155e(++_0x2f166b);}(_0x1159,0xf3));var _0x9115=function(_0x9e78a7,_0x4d32e2){_0x9e78a7=_0x9e78a7-0x0;var _0x46022e=_0x1159[_0x9e78a7];return _0x46022e;};'use strict';var client=require(_0x9115('0x0'));exports['create']=function(_0x5d2146){return client[_0x9115('0x1')](_0x9115('0x2'),{'body':_0x5d2146,'log':_0x9115('0x2')});};exports[_0x9115('0x3')]=function(_0x4554f6,_0x4661fc){return client[_0x9115('0x1')](_0x9115('0x4'),{'body':_0x4661fc,'options':{'where':{'uniqueid':_0x4554f6},'order':[['id','DESC']],'limit':0x1},'log':_0x9115('0x4')});}; \ No newline at end of file +var _0xd382=['Request','CreateChatQueueReport','update','../client','create'];(function(_0x21348d,_0x3702ae){var _0x4442be=function(_0x14c6d4){while(--_0x14c6d4){_0x21348d['push'](_0x21348d['shift']());}};_0x4442be(++_0x3702ae);}(_0xd382,0x1b6));var _0x2d38=function(_0x4efc19,_0x41b3e8){_0x4efc19=_0x4efc19-0x0;var _0x3d5137=_0xd382[_0x4efc19];return _0x3d5137;};'use strict';var client=require(_0x2d38('0x0'));exports[_0x2d38('0x1')]=function(_0x188226){return client[_0x2d38('0x2')](_0x2d38('0x3'),{'body':_0x188226,'log':_0x2d38('0x3')});};exports[_0x2d38('0x4')]=function(_0x3e5d82,_0xf6bceb){return client[_0x2d38('0x2')]('UpdateChatQueueReport',{'body':_0xf6bceb,'options':{'where':{'uniqueid':_0x3e5d82},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index e6d39dc..4f91a71 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(_0x271537,_0x8b7b3b){var _0x19dc22=function(_0x459bbf){while(--_0x459bbf){_0x271537['push'](_0x271537['shift']());}};_0x19dc22(++_0x8b7b3b);}(_0x7a54,0x106));var _0x47a5=function(_0x40544b,_0xefac1b){_0x40544b=_0x40544b-0x0;var _0x43e91d=_0x7a54[_0x40544b];return _0x43e91d;};'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 _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x112fe3,_0x16b642){var _0x1ec903=function(_0x1539eb){while(--_0x1539eb){_0x112fe3['push'](_0x112fe3['shift']());}};_0x1ec903(++_0x16b642);}(_0x7a54,0x106));var _0x47a5=function(_0x47e5ed,_0xd6fedd){_0x47e5ed=_0x47e5ed-0x0;var _0xc4c344=_0x7a54[_0x47e5ed];return _0xc4c344;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 225b08e..aa21ce5 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 _0x9b01=['../client','create','Request'];(function(_0x53126e,_0x4c55eb){var _0x2dd805=function(_0x2a4c0c){while(--_0x2a4c0c){_0x53126e['push'](_0x53126e['shift']());}};_0x2dd805(++_0x4c55eb);}(_0x9b01,0x6f));var _0x19b0=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0x9b01[_0x36c6eb];return _0x30675b;};'use strict';var client=require(_0x19b0('0x0'));exports[_0x19b0('0x1')]=function(_0x47e33b){return client[_0x19b0('0x2')]('CreateFaxMessage',{'body':_0x47e33b,'log':'createFaxMessage'});}; \ No newline at end of file +var _0xe2c7=['create','Request','createFaxMessage','../client'];(function(_0x28fc6c,_0x2b8cc8){var _0xb4c67b=function(_0x16e19c){while(--_0x16e19c){_0x28fc6c['push'](_0x28fc6c['shift']());}};_0xb4c67b(++_0x2b8cc8);}(_0xe2c7,0xdb));var _0x7e2c=function(_0x186020,_0x1fc7f9){_0x186020=_0x186020-0x0;var _0x30380a=_0xe2c7[_0x186020];return _0x30380a;};'use strict';var client=require(_0x7e2c('0x0'));exports[_0x7e2c('0x1')]=function(_0x589e21){return client[_0x7e2c('0x2')]('CreateFaxMessage',{'body':_0x589e21,'log':_0x7e2c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index cfacf24..2035d9d 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 _0x6249=['timeout','strategy','User','online','faxPause','getFaxQueues','GetFaxQueue','name'];(function(_0x36186e,_0x1705a7){var _0x4dea23=function(_0x3d7ee9){while(--_0x3d7ee9){_0x36186e['push'](_0x36186e['shift']());}};_0x4dea23(++_0x1705a7);}(_0x6249,0x95));var _0x9624=function(_0x5e322c,_0x317e5f){_0x5e322c=_0x5e322c-0x0;var _0x488865=_0x6249[_0x5e322c];return _0x488865;};'use strict';var client=require('../client');exports[_0x9624('0x0')]=function(){return function(){return client['Request'](_0x9624('0x1'),{'options':{'raw':![],'attributes':['id',_0x9624('0x2'),_0x9624('0x3'),_0x9624('0x4')],'include':[{'model':_0x9624('0x5'),'as':'Agents','attributes':['id','name',_0x9624('0x6'),_0x9624('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xcf0b=['User','Agents','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy'];(function(_0x4ce310,_0x489712){var _0x4434e2=function(_0x285026){while(--_0x285026){_0x4ce310['push'](_0x4ce310['shift']());}};_0x4434e2(++_0x489712);}(_0xcf0b,0xe3));var _0xbcf0=function(_0x268396,_0x864c1c){_0x268396=_0x268396-0x0;var _0x2d7b5d=_0xcf0b[_0x268396];return _0x2d7b5d;};'use strict';var client=require(_0xbcf0('0x0'));exports[_0xbcf0('0x1')]=function(){return function(){return client[_0xbcf0('0x2')](_0xbcf0('0x3'),{'options':{'raw':![],'attributes':['id',_0xbcf0('0x4'),_0xbcf0('0x5'),_0xbcf0('0x6')],'include':[{'model':_0xbcf0('0x7'),'as':_0xbcf0('0x8'),'attributes':['id',_0xbcf0('0x4'),'online','faxPause']}]},'log':_0xbcf0('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0485b01..0a11050 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 _0x07d7=['update','UpdateFaxQueueReport','../client','create','CreateFaxQueueReport'];(function(_0x525d4f,_0x25fa07){var _0x3aa209=function(_0x17fda3){while(--_0x17fda3){_0x525d4f['push'](_0x525d4f['shift']());}};_0x3aa209(++_0x25fa07);}(_0x07d7,0xa7));var _0x707d=function(_0x4f6d08,_0x1b3dd0){_0x4f6d08=_0x4f6d08-0x0;var _0x53a9c6=_0x07d7[_0x4f6d08];return _0x53a9c6;};'use strict';var client=require(_0x707d('0x0'));exports[_0x707d('0x1')]=function(_0x5eeabb){return client['Request'](_0x707d('0x2'),{'body':_0x5eeabb,'log':_0x707d('0x2')});};exports[_0x707d('0x3')]=function(_0x201148,_0x4f8de5){return client['Request'](_0x707d('0x4'),{'body':_0x4f8de5,'options':{'where':{'uniqueid':_0x201148},'order':[['id','DESC']],'limit':0x1},'log':_0x707d('0x4')});}; \ No newline at end of file +var _0x1f84=['../client','create','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x589002,_0x1c9c42){var _0x1ebe5a=function(_0x7f9547){while(--_0x7f9547){_0x589002['push'](_0x589002['shift']());}};_0x1ebe5a(++_0x1c9c42);}(_0x1f84,0x1b3));var _0x41f8=function(_0x59c683,_0x209444){_0x59c683=_0x59c683-0x0;var _0x47251b=_0x1f84[_0x59c683];return _0x47251b;};'use strict';var client=require(_0x41f8('0x0'));exports[_0x41f8('0x1')]=function(_0xa1b3c2){return client[_0x41f8('0x2')](_0x41f8('0x3'),{'body':_0xa1b3c2,'log':_0x41f8('0x3')});};exports['update']=function(_0x203dda,_0xa8169e){return client['Request'](_0x41f8('0x4'),{'body':_0xa8169e,'options':{'where':{'uniqueid':_0x203dda},'order':[['id','DESC']],'limit':0x1},'log':_0x41f8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index ee99cec..79ec3a4 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 _0x59ab=['GetInterval','name','Interval','interval','getIntervals'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0x59ab,0xd6));var _0xb59a=function(_0x377e4c,_0x2860d2){_0x377e4c=_0x377e4c-0x0;var _0x529cb9=_0x59ab[_0x377e4c];return _0x529cb9;};'use strict';var client=require('../client');exports[_0xb59a('0x0')]=function(){return function(){return client['Request'](_0xb59a('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xb59a('0x2')],'include':[{'model':_0xb59a('0x3'),'as':'Intervals','attributes':['id',_0xb59a('0x2'),_0xb59a('0x4')]}]},'log':_0xb59a('0x0')});};}; \ No newline at end of file +var _0x1a41=['GetInterval','Interval','name','interval','getIntervals','../client','Request'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x1a41,0x16a));var _0x11a4=function(_0x3daf92,_0x378bc8){_0x3daf92=_0x3daf92-0x0;var _0x37142e=_0x1a41[_0x3daf92];return _0x37142e;};'use strict';var client=require(_0x11a4('0x0'));exports['getIntervals']=function(){return function(){return client[_0x11a4('0x1')](_0x11a4('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x11a4('0x3'),'as':'Intervals','attributes':['id',_0x11a4('0x4'),_0x11a4('0x5')]}]},'log':_0x11a4('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index c30350f..9ab0a7e 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 _0x0598=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','updateMailInteraction','addTags'];(function(_0xb4e69c,_0x2c2f38){var _0x452c3=function(_0x412ccb){while(--_0x412ccb){_0xb4e69c['push'](_0xb4e69c['shift']());}};_0x452c3(++_0x2c2f38);}(_0x0598,0x92));var _0x8059=function(_0x46e263,_0x8d2901){_0x46e263=_0x46e263-0x0;var _0x598cd4=_0x0598[_0x46e263];return _0x598cd4;};'use strict';var client=require(_0x8059('0x0'));exports[_0x8059('0x1')]=function(_0x5c8253,_0x3386f0){return client['Request']('UpdateMailInteraction',{'body':_0x3386f0,'options':{'where':{'id':_0x5c8253}},'log':_0x8059('0x2')});};exports[_0x8059('0x3')]=function(_0x54b9a2,_0x54f42f){return client['Request'](_0x8059('0x4'),{'body':_0x54f42f,'options':{'where':{'id':_0x54b9a2}},'log':_0x8059('0x5')});}; \ No newline at end of file +var _0x7880=['AddTagsToMailInteraction','addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x230e39,_0x5341){var _0xa804e=function(_0xe14796){while(--_0xe14796){_0x230e39['push'](_0x230e39['shift']());}};_0xa804e(++_0x5341);}(_0x7880,0x1f4));var _0x0788=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0x7880[_0x31bab3];return _0x4fd382;};'use strict';var client=require('../client');exports[_0x0788('0x0')]=function(_0x219c25,_0x841a33){return client[_0x0788('0x1')](_0x0788('0x2'),{'body':_0x841a33,'options':{'where':{'id':_0x219c25}},'log':_0x0788('0x3')});};exports['addTags']=function(_0x3925a6,_0x1e0814){return client[_0x0788('0x1')](_0x0788('0x4'),{'body':_0x1e0814,'options':{'where':{'id':_0x3925a6}},'log':_0x0788('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index f28dac8..f0799f9 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 _0x46af=['createMailMessage','CreateMailMessage'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x46af,0xe5));var _0xf46a=function(_0x17d665,_0x38217a){_0x17d665=_0x17d665-0x0;var _0x5ab865=_0x46af[_0x17d665];return _0x5ab865;};'use strict';var client=require('../client');exports['create']=function(_0x39c782){return client['Request'](_0xf46a('0x0'),{'body':_0x39c782,'log':_0xf46a('0x1')});}; \ No newline at end of file +var _0xfdf6=['../client','CreateMailMessage','createMailMessage'];(function(_0x4706af,_0x24b450){var _0x2f75c4=function(_0x415a9a){while(--_0x415a9a){_0x4706af['push'](_0x4706af['shift']());}};_0x2f75c4(++_0x24b450);}(_0xfdf6,0x138));var _0x6fdf=function(_0x1bbb7e,_0x53c403){_0x1bbb7e=_0x1bbb7e-0x0;var _0x319bc5=_0xfdf6[_0x1bbb7e];return _0x319bc5;};'use strict';var client=require(_0x6fdf('0x0'));exports['create']=function(_0x20d08d){return client['Request'](_0x6fdf('0x1'),{'body':_0x20d08d,'log':_0x6fdf('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 9a59e5f..8fb2787 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 _0xb933=['timeout','strategy','User','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name'];(function(_0x34119a,_0x4f315b){var _0x5ae3c1=function(_0x329157){while(--_0x329157){_0x34119a['push'](_0x34119a['shift']());}};_0x5ae3c1(++_0x4f315b);}(_0xb933,0x1ef));var _0x3b93=function(_0x2ef44b,_0x553359){_0x2ef44b=_0x2ef44b-0x0;var _0x2405b9=_0xb933[_0x2ef44b];return _0x2405b9;};'use strict';var client=require(_0x3b93('0x0'));exports[_0x3b93('0x1')]=function(){return function(){return client[_0x3b93('0x2')](_0x3b93('0x3'),{'options':{'raw':![],'attributes':['id',_0x3b93('0x4'),_0x3b93('0x5'),_0x3b93('0x6')],'include':[{'model':_0x3b93('0x7'),'as':'Agents','attributes':['id',_0x3b93('0x4'),_0x3b93('0x8'),_0x3b93('0x9')]}]},'log':_0x3b93('0x1')});};}; \ No newline at end of file +var _0xbd79=['getMailQueues','Request','GetMailQueue','strategy','User','name','online','mailPause','../client'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xbd79,0x1af));var _0x9bd7=function(_0x4bfdb7,_0x4b05c8){_0x4bfdb7=_0x4bfdb7-0x0;var _0x384eac=_0xbd79[_0x4bfdb7];return _0x384eac;};'use strict';var client=require(_0x9bd7('0x0'));exports[_0x9bd7('0x1')]=function(){return function(){return client[_0x9bd7('0x2')](_0x9bd7('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x9bd7('0x4')],'include':[{'model':_0x9bd7('0x5'),'as':'Agents','attributes':['id',_0x9bd7('0x6'),_0x9bd7('0x7'),_0x9bd7('0x8')]}]},'log':_0x9bd7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 5e0bf94..6f5e48e 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 _0xecfc=['CreateMailQueueReport','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x41bfa8,_0x2222f0){var _0x5a689e=function(_0x9c9b27){while(--_0x9c9b27){_0x41bfa8['push'](_0x41bfa8['shift']());}};_0x5a689e(++_0x2222f0);}(_0xecfc,0x117));var _0xcecf=function(_0x81f4ea,_0xdeb3a5){_0x81f4ea=_0x81f4ea-0x0;var _0x4e641b=_0xecfc[_0x81f4ea];return _0x4e641b;};'use strict';var client=require(_0xcecf('0x0'));exports[_0xcecf('0x1')]=function(_0x39e7d4){return client[_0xcecf('0x2')](_0xcecf('0x3'),{'body':_0x39e7d4,'log':'CreateMailQueueReport'});};exports['update']=function(_0x25bada,_0x1e94fa){return client[_0xcecf('0x2')](_0xcecf('0x4'),{'body':_0x1e94fa,'options':{'where':{'uniqueid':_0x25bada},'order':[['id',_0xcecf('0x5')]],'limit':0x1},'log':_0xcecf('0x4')});}; \ No newline at end of file +var _0x1da9=['CreateMailQueueReport','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x3e0191,_0x1d4b20){var _0xf2ae83=function(_0x277210){while(--_0x277210){_0x3e0191['push'](_0x3e0191['shift']());}};_0xf2ae83(++_0x1d4b20);}(_0x1da9,0x177));var _0x91da=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x1da9[_0x311c35];return _0x5cc50c;};'use strict';var client=require(_0x91da('0x0'));exports[_0x91da('0x1')]=function(_0x20c961){return client[_0x91da('0x2')](_0x91da('0x3'),{'body':_0x20c961,'log':_0x91da('0x3')});};exports['update']=function(_0x328bc8,_0x2d967d){return client[_0x91da('0x2')](_0x91da('0x4'),{'body':_0x2d967d,'options':{'where':{'uniqueid':_0x328bc8},'order':[['id',_0x91da('0x5')]],'limit':0x1},'log':_0x91da('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index d712dc3..247d297 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 _0x1f4d=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x524c28,_0x5320e1){var _0x598a65=function(_0x362987){while(--_0x362987){_0x524c28['push'](_0x524c28['shift']());}};_0x598a65(++_0x5320e1);}(_0x1f4d,0xf4));var _0xd1f4=function(_0x320635,_0x33518f){_0x320635=_0x320635-0x0;var _0x46ea17=_0x1f4d[_0x320635];return _0x46ea17;};'use strict';var client=require(_0xd1f4('0x0'));exports[_0xd1f4('0x1')]=function(_0x2c2606,_0x87c797){return client[_0xd1f4('0x2')](_0xd1f4('0x3'),{'body':_0x87c797,'options':{'where':{'id':_0x2c2606}},'log':_0xd1f4('0x4')});};exports[_0xd1f4('0x5')]=function(_0x33d2f9,_0x5d0e45){return client[_0xd1f4('0x2')](_0xd1f4('0x6'),{'body':_0x5d0e45,'options':{'where':{'id':_0x33d2f9}},'log':_0xd1f4('0x7')});}; \ No newline at end of file +var _0x1fe7=['update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','Request','addTagsToChatInteraction'];(function(_0x4f9b51,_0x210c63){var _0x456ddf=function(_0x166c0b){while(--_0x166c0b){_0x4f9b51['push'](_0x4f9b51['shift']());}};_0x456ddf(++_0x210c63);}(_0x1fe7,0x8c));var _0x71fe=function(_0x53f267,_0x36cb78){_0x53f267=_0x53f267-0x0;var _0x11c6f0=_0x1fe7[_0x53f267];return _0x11c6f0;};'use strict';var client=require('../client');exports[_0x71fe('0x0')]=function(_0x3c112b,_0x456d8){return client['Request'](_0x71fe('0x1'),{'body':_0x456d8,'options':{'where':{'id':_0x3c112b}},'log':_0x71fe('0x2')});};exports['addTags']=function(_0x13f68f,_0x29ee01){return client[_0x71fe('0x3')]('AddTagsToOpenchannelInteraction',{'body':_0x29ee01,'options':{'where':{'id':_0x13f68f}},'log':_0x71fe('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index ad41848..0eaf743 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 _0x5cd0=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x3d540f,_0x330ad3){var _0x470664=function(_0x463481){while(--_0x463481){_0x3d540f['push'](_0x3d540f['shift']());}};_0x470664(++_0x330ad3);}(_0x5cd0,0x1c4));var _0x05cd=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5cd0[_0x199572];return _0x13cfa3;};'use strict';var client=require(_0x05cd('0x0'));exports[_0x05cd('0x1')]=function(_0x161cf4){return client[_0x05cd('0x2')](_0x05cd('0x3'),{'body':_0x161cf4,'log':_0x05cd('0x4')});}; \ No newline at end of file +var _0x8061=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0x8061,0x1dd));var _0x1806=function(_0x3ca18a,_0xd76838){_0x3ca18a=_0x3ca18a-0x0;var _0xaac48b=_0x8061[_0x3ca18a];return _0xaac48b;};'use strict';var client=require(_0x1806('0x0'));exports[_0x1806('0x1')]=function(_0x5acc11){return client[_0x1806('0x2')](_0x1806('0x3'),{'body':_0x5acc11,'log':_0x1806('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index f7c302e..56a7ac9 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 _0xe2c8=['Agents','name','openchannelPause','getOpenchannelQueues','../client','Request','strategy','User'];(function(_0xdcda3,_0x4252fb){var _0x2bec82=function(_0x589fe2){while(--_0x589fe2){_0xdcda3['push'](_0xdcda3['shift']());}};_0x2bec82(++_0x4252fb);}(_0xe2c8,0x8c));var _0x8e2c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xe2c8[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x8e2c('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x8e2c('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x8e2c('0x2')],'include':[{'model':_0x8e2c('0x3'),'as':_0x8e2c('0x4'),'attributes':['id',_0x8e2c('0x5'),'online',_0x8e2c('0x6')]}]},'log':_0x8e2c('0x7')});};}; \ No newline at end of file +var _0xa00e=['Request','GetOpenchannelQueue','name','timeout','strategy','Agents','online','openchannelPause','../client'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xa00e,0x170));var _0xea00=function(_0x3a32d1,_0x516101){_0x3a32d1=_0x3a32d1-0x0;var _0x63a703=_0xa00e[_0x3a32d1];return _0x63a703;};'use strict';var client=require(_0xea00('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0xea00('0x1')](_0xea00('0x2'),{'options':{'raw':![],'attributes':['id',_0xea00('0x3'),_0xea00('0x4'),_0xea00('0x5')],'include':[{'model':'User','as':_0xea00('0x6'),'attributes':['id','name',_0xea00('0x7'),_0xea00('0x8')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 53d3133..4bf844f 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 _0xf742=['Request','DESC','UpdateOpenchannelQueueReport','create','CreateOpenchannelQueueReport','update'];(function(_0x23d63e,_0x1a6044){var _0x28dafe=function(_0x4d6e12){while(--_0x4d6e12){_0x23d63e['push'](_0x23d63e['shift']());}};_0x28dafe(++_0x1a6044);}(_0xf742,0x75));var _0x2f74=function(_0x3b3f40,_0x5551ad){_0x3b3f40=_0x3b3f40-0x0;var _0x4413b8=_0xf742[_0x3b3f40];return _0x4413b8;};'use strict';var client=require('../client');exports[_0x2f74('0x0')]=function(_0x37a85e){return client['Request'](_0x2f74('0x1'),{'body':_0x37a85e,'log':_0x2f74('0x1')});};exports[_0x2f74('0x2')]=function(_0xc105fe,_0x4124af){return client[_0x2f74('0x3')]('UpdateOpenchannelQueueReport',{'body':_0x4124af,'options':{'where':{'uniqueid':_0xc105fe},'order':[['id',_0x2f74('0x4')]],'limit':0x1},'log':_0x2f74('0x5')});}; \ No newline at end of file +var _0x2126=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','create','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2126,0xe4));var _0x6212=function(_0x2e1d7c,_0x1742f0){_0x2e1d7c=_0x2e1d7c-0x0;var _0x4508b9=_0x2126[_0x2e1d7c];return _0x4508b9;};'use strict';var client=require('../client');exports[_0x6212('0x0')]=function(_0x1781f4){return client[_0x6212('0x1')](_0x6212('0x2'),{'body':_0x1781f4,'log':'CreateOpenchannelQueueReport'});};exports[_0x6212('0x3')]=function(_0x1144ca,_0x250beb){return client[_0x6212('0x1')]('UpdateOpenchannelQueueReport',{'body':_0x250beb,'options':{'where':{'uniqueid':_0x1144ca},'order':[['id','DESC']],'limit':0x1},'log':_0x6212('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e99f17a..42be05e 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 _0xd04b=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','updateSmsInteraction'];(function(_0x705771,_0x5e2ac0){var _0x366e89=function(_0x4e21c1){while(--_0x4e21c1){_0x705771['push'](_0x705771['shift']());}};_0x366e89(++_0x5e2ac0);}(_0xd04b,0x145));var _0xbd04=function(_0x4410f4,_0x1d1c17){_0x4410f4=_0x4410f4-0x0;var _0x20352e=_0xd04b[_0x4410f4];return _0x20352e;};'use strict';var client=require(_0xbd04('0x0'));exports[_0xbd04('0x1')]=function(_0x4775e2,_0x5186f0){return client[_0xbd04('0x2')]('UpdateSmsInteraction',{'body':_0x5186f0,'options':{'where':{'id':_0x4775e2}},'log':_0xbd04('0x3')});};exports[_0xbd04('0x4')]=function(_0xc1c02f,_0xe948b3){return client[_0xbd04('0x2')](_0xbd04('0x5'),{'body':_0xe948b3,'options':{'where':{'id':_0xc1c02f}},'log':_0xbd04('0x6')});}; \ No newline at end of file +var _0xac65=['UpdateSmsInteraction','updateSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x24ba3f,_0x246bf0){var _0x4e52bf=function(_0xfe6590){while(--_0xfe6590){_0x24ba3f['push'](_0x24ba3f['shift']());}};_0x4e52bf(++_0x246bf0);}(_0xac65,0x11d));var _0x5ac6=function(_0x53c70f,_0xa36676){_0x53c70f=_0x53c70f-0x0;var _0x461142=_0xac65[_0x53c70f];return _0x461142;};'use strict';var client=require(_0x5ac6('0x0'));exports[_0x5ac6('0x1')]=function(_0x11c244,_0x550314){return client[_0x5ac6('0x2')](_0x5ac6('0x3'),{'body':_0x550314,'options':{'where':{'id':_0x11c244}},'log':_0x5ac6('0x4')});};exports['addTags']=function(_0x16800d,_0x2cbf7e){return client[_0x5ac6('0x2')]('AddTagsToSmsInteraction',{'body':_0x2cbf7e,'options':{'where':{'id':_0x16800d}},'log':_0x5ac6('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 8ff8a08..d9a605c 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 _0x972c=['create','createSmsMessage','../client'];(function(_0x57f621,_0x39f2b6){var _0x1534ee=function(_0x12be0c){while(--_0x12be0c){_0x57f621['push'](_0x57f621['shift']());}};_0x1534ee(++_0x39f2b6);}(_0x972c,0xd1));var _0xc972=function(_0x43bb1e,_0x184613){_0x43bb1e=_0x43bb1e-0x0;var _0x554c38=_0x972c[_0x43bb1e];return _0x554c38;};'use strict';var client=require(_0xc972('0x0'));exports[_0xc972('0x1')]=function(_0x4e493c){return client['Request']('CreateSmsMessage',{'body':_0x4e493c,'log':_0xc972('0x2')});}; \ No newline at end of file +var _0x9fd3=['../client','Request'];(function(_0x4a3000,_0x81d396){var _0x88f8f9=function(_0x462887){while(--_0x462887){_0x4a3000['push'](_0x4a3000['shift']());}};_0x88f8f9(++_0x81d396);}(_0x9fd3,0x19c));var _0x39fd=function(_0x148f4c,_0x3eb8da){_0x148f4c=_0x148f4c-0x0;var _0x2c99dd=_0x9fd3[_0x148f4c];return _0x2c99dd;};'use strict';var client=require(_0x39fd('0x0'));exports['create']=function(_0x44d4fb){return client[_0x39fd('0x1')]('CreateSmsMessage',{'body':_0x44d4fb,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 6e11893..363cd09 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 _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0xda6cbb,_0x468e2e){var _0x4b4d87=function(_0x4926f7){while(--_0x4926f7){_0xda6cbb['push'](_0xda6cbb['shift']());}};_0x4b4d87(++_0x468e2e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x270a54,_0x307ff6){_0x270a54=_0x270a54-0x0;var _0x4d07d0=_0xcb91[_0x270a54];return _0x4d07d0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x11cbc9,_0x10a746){var _0x2fcea0=function(_0x254169){while(--_0x254169){_0x11cbc9['push'](_0x11cbc9['shift']());}};_0x2fcea0(++_0x10a746);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x43a5c7,_0x2286bf){_0x43a5c7=_0x43a5c7-0x0;var _0x3b12a2=_0xcb91[_0x43a5c7];return _0x3b12a2;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 4be0eb7..53aced1 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 _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x49a3a6,_0x2fd407){var _0x5cfa3b=function(_0x33462d){while(--_0x33462d){_0x49a3a6['push'](_0x49a3a6['shift']());}};_0x5cfa3b(++_0x2fd407);}(_0x34e8,0x12c));var _0x834e=function(_0x40e3e6,_0x5cb1bf){_0x40e3e6=_0x40e3e6-0x0;var _0x54210f=_0x34e8[_0x40e3e6];return _0x54210f;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x4ab7cf,_0x168584){var _0x567a24=function(_0x1f048b){while(--_0x1f048b){_0x4ab7cf['push'](_0x4ab7cf['shift']());}};_0x567a24(++_0x168584);}(_0x55ca,0x126));var _0xa55c=function(_0x56562d,_0x578183){_0x56562d=_0x56562d-0x0;var _0xdafef9=_0x55ca[_0x56562d];return _0xdafef9;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 02216f3..76fc43e 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(_0x3b5332,_0x1c351f){var _0x2cebf6=function(_0x12c6b8){while(--_0x12c6b8){_0x3b5332['push'](_0x3b5332['shift']());}};_0x2cebf6(++_0x1c351f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x41d1f0,_0x596b23){var _0x1d1e4a=function(_0x34d787){while(--_0x34d787){_0x41d1f0['push'](_0x41d1f0['shift']());}};_0x1d1e4a(++_0x596b23);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 efeb33e..5c0a133 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 _0x1b65=['Request','AddTagsToWhatsappInteraction','../client','update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x44f190,_0x28b97d){var _0x33ed63=function(_0x4e6ae2){while(--_0x4e6ae2){_0x44f190['push'](_0x44f190['shift']());}};_0x33ed63(++_0x28b97d);}(_0x1b65,0x1b4));var _0x51b6=function(_0x30a19c,_0x379a40){_0x30a19c=_0x30a19c-0x0;var _0x4f3f36=_0x1b65[_0x30a19c];return _0x4f3f36;};'use strict';var client=require(_0x51b6('0x0'));exports[_0x51b6('0x1')]=function(_0x3e4953,_0x1a876f){return client['Request'](_0x51b6('0x2'),{'body':_0x1a876f,'options':{'where':{'id':_0x3e4953}},'log':_0x51b6('0x3')});};exports[_0x51b6('0x4')]=function(_0x2d5762,_0x1a1c26){return client[_0x51b6('0x5')](_0x51b6('0x6'),{'body':_0x1a1c26,'options':{'where':{'id':_0x2d5762}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0xbd0a=['Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','updateWhatsappInteraction','addTags'];(function(_0x5c7b9f,_0x2d72d2){var _0x117eab=function(_0x19b961){while(--_0x19b961){_0x5c7b9f['push'](_0x5c7b9f['shift']());}};_0x117eab(++_0x2d72d2);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x48ef17,_0x25e86c){_0x48ef17=_0x48ef17-0x0;var _0x45034e=_0xbd0a[_0x48ef17];return _0x45034e;};'use strict';var client=require(_0xabd0('0x0'));exports['update']=function(_0x3b0fc0,_0x48c569){return client['Request']('UpdateWhatsappInteraction',{'body':_0x48c569,'options':{'where':{'id':_0x3b0fc0}},'log':_0xabd0('0x1')});};exports[_0xabd0('0x2')]=function(_0x41e52b,_0x3d1138){return client[_0xabd0('0x3')](_0xabd0('0x4'),{'body':_0x3d1138,'options':{'where':{'id':_0x41e52b}},'log':_0xabd0('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 5d54216..772855c 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 _0x8ee7=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x531495,_0x29cbfe){var _0x39766a=function(_0x5436ef){while(--_0x5436ef){_0x531495['push'](_0x531495['shift']());}};_0x39766a(++_0x29cbfe);}(_0x8ee7,0x128));var _0x78ee=function(_0x51a0c6,_0x4b3b74){_0x51a0c6=_0x51a0c6-0x0;var _0x249563=_0x8ee7[_0x51a0c6];return _0x249563;};'use strict';var client=require(_0x78ee('0x0'));exports[_0x78ee('0x1')]=function(_0x31375b){return client[_0x78ee('0x2')](_0x78ee('0x3'),{'body':_0x31375b,'log':_0x78ee('0x4')});}; \ No newline at end of file +var _0x23dd=['createWhatsappMessage','create','CreateWhatsappMessage'];(function(_0x5ac375,_0x12d837){var _0x3e9926=function(_0x153a80){while(--_0x153a80){_0x5ac375['push'](_0x5ac375['shift']());}};_0x3e9926(++_0x12d837);}(_0x23dd,0x130));var _0xd23d=function(_0x5eb3eb,_0x58c549){_0x5eb3eb=_0x5eb3eb-0x0;var _0x51e8e5=_0x23dd[_0x5eb3eb];return _0x51e8e5;};'use strict';var client=require('../client');exports[_0xd23d('0x0')]=function(_0xd0eb3e){return client['Request'](_0xd23d('0x1'),{'body':_0xd0eb3e,'log':_0xd23d('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 9fa0643..ef265ee 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 _0xabec=['timeout','strategy','User','Agents','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xabec,0x16d));var _0xcabe=function(_0xcd81b8,_0x18d9fd){_0xcd81b8=_0xcd81b8-0x0;var _0xc3ae18=_0xabec[_0xcd81b8];return _0xc3ae18;};'use strict';var client=require(_0xcabe('0x0'));exports[_0xcabe('0x1')]=function(){return function(){return client[_0xcabe('0x2')](_0xcabe('0x3'),{'options':{'raw':![],'attributes':['id',_0xcabe('0x4'),_0xcabe('0x5'),_0xcabe('0x6')],'include':[{'model':_0xcabe('0x7'),'as':_0xcabe('0x8'),'attributes':['id',_0xcabe('0x4'),'online',_0xcabe('0x9')]}]},'log':_0xcabe('0x1')});};}; \ No newline at end of file +var _0x93a5=['Request','GetWhatsappQueue','name','timeout','strategy','User','online','whatsappPause','getWhatsappQueues'];(function(_0x585015,_0x415b68){var _0x93ce02=function(_0x559330){while(--_0x559330){_0x585015['push'](_0x585015['shift']());}};_0x93ce02(++_0x415b68);}(_0x93a5,0x13a));var _0x593a=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x93a5[_0x29b609];return _0x54c952;};'use strict';var client=require('../client');exports[_0x593a('0x0')]=function(){return function(){return client[_0x593a('0x1')](_0x593a('0x2'),{'options':{'raw':![],'attributes':['id',_0x593a('0x3'),_0x593a('0x4'),_0x593a('0x5')],'include':[{'model':_0x593a('0x6'),'as':'Agents','attributes':['id',_0x593a('0x3'),_0x593a('0x7'),_0x593a('0x8')]}]},'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 8d0d115..52cf6d5 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 _0x6e6e=['CreateWhatsappQueueReport','Request','UpdateWhatsappQueueReport','../client','create'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6e6e,0xe9));var _0xe6e6=function(_0x247d58,_0x432aca){_0x247d58=_0x247d58-0x0;var _0x59ac25=_0x6e6e[_0x247d58];return _0x59ac25;};'use strict';var client=require(_0xe6e6('0x0'));exports[_0xe6e6('0x1')]=function(_0x141db0){return client['Request'](_0xe6e6('0x2'),{'body':_0x141db0,'log':_0xe6e6('0x2')});};exports['update']=function(_0x25d085,_0x3be2d9){return client[_0xe6e6('0x3')](_0xe6e6('0x4'),{'body':_0x3be2d9,'options':{'where':{'uniqueid':_0x25d085},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x695a=['../client','create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC'];(function(_0x5dbfe8,_0x2eb959){var _0x579124=function(_0x4a69c5){while(--_0x4a69c5){_0x5dbfe8['push'](_0x5dbfe8['shift']());}};_0x579124(++_0x2eb959);}(_0x695a,0x1b6));var _0xa695=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x695a[_0x3ab51d];return _0x29a04e;};'use strict';var client=require(_0xa695('0x0'));exports[_0xa695('0x1')]=function(_0x4ef737){return client[_0xa695('0x2')](_0xa695('0x3'),{'body':_0x4ef737,'log':_0xa695('0x3')});};exports['update']=function(_0x58ed43,_0x2457a7){return client['Request'](_0xa695('0x4'),{'body':_0x2457a7,'options':{'where':{'uniqueid':_0x58ed43},'order':[['id',_0xa695('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index e9d5ff1..8ed5ff1 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 _0xa094=['[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','message','join','stop','find','agents','timeout','createQueue','channel','START:%s','rules'];(function(_0x357db8,_0x2aa371){var _0x51066a=function(_0x1dd4aa){while(--_0x1dd4aa){_0x357db8['push'](_0x357db8['shift']());}};_0x51066a(++_0x2aa371);}(_0xa094,0x6e));var _0x4a09=function(_0x103d1d,_0x1ee454){_0x103d1d=_0x103d1d-0x0;var _0x384499=_0xa094[_0x103d1d];return _0x384499;};'use strict';var schema=require(_0x4a09('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x4a09('0x1'));var logger=require(_0x4a09('0x2'))(_0x4a09('0x3'));var strategy=require(_0x4a09('0x4'));var queue=schema({'name':{'type':_0x4a09('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x4a09('0x6'),'message':_0x4a09('0x7')}});function writeLog(_0x7e1985,_0x31e02c,_0x553bf0){return logger[_0x4a09('0x8')](util[_0x4a09('0x9')](_0x4a09('0xa'),_0x7e1985,_0x31e02c[_0x4a09('0xb')],_0x553bf0));}function handleFindAgent(_0x2976e5){return function(_0x383ded){return _0x383ded[_0x4a09('0xb')][_0x4a09('0xc')]()===_0x2976e5['toLowerCase']();};}exports[_0x4a09('0xd')]=function(_0x37bd53,_0x582476,_0x56b7a3,_0x353dd7){return function(_0x34bf38){try{var _0x375d46={'name':_0x582476[0x0],'timeout':_0x582476[0x1]};var _0x397be1=queue[_0x4a09('0x0')](_0x375d46,{'typecast':!![]});if(_0x397be1['length']){logger[_0x4a09('0xe')](_0x4a09('0xf'),_0x37bd53,_['map'](_0x397be1,_0x4a09('0x10'))[_0x4a09('0x11')](',\x20'));_0x34bf38[_0x4a09('0x12')]();}else{var _0x250106=_[_0x4a09('0x13')](_0x56b7a3[_0x4a09('0x14')],handleFindAgent(_0x375d46[_0x4a09('0xb')]));if(_0x250106){var _0x53dab7=(_0x375d46[_0x4a09('0x15')]||0xa)*0x3e8;var _0x438879,_0xafd7cf;var _0xce23b0=seqqueue[_0x4a09('0x16')](_0x53dab7);_0xce23b0['id']=_0x37bd53;_0xce23b0['atimeout']=_0x53dab7;_0xce23b0['channel']=_0x353dd7[_0x4a09('0x17')];writeLog(_0x37bd53,_0x250106,util['format'](_0x4a09('0x18'),_0x53dab7));_0x56b7a3[_0x4a09('0x19')][_0x37bd53]['on']('end',function(){logger[_0x4a09('0x8')](_0x4a09('0x1a'),_0x37bd53);clearTimeout(_0xafd7cf);_0xafd7cf=undefined;_0xce23b0[_0x4a09('0x1b')]();if(_0x56b7a3[_0x4a09('0x19')][_0x37bd53]){delete _0x56b7a3[_0x4a09('0x19')][_0x37bd53];}_0x34bf38[_0x4a09('0x12')]();});_0x56b7a3[_0x4a09('0x19')][_0x37bd53]['on']('complete',function(){if(_0x56b7a3[_0x4a09('0x19')][_0x37bd53]){delete _0x56b7a3[_0x4a09('0x19')][_0x37bd53];}});_0xafd7cf=setTimeout(function(){logger[_0x4a09('0x8')](_0x4a09('0x1c'),_0x37bd53);clearTimeout(_0xafd7cf);_0xce23b0[_0x4a09('0x1b')]();_0x34bf38['next']();},_0x53dab7);strategy[_0x4a09('0x1d')](_0xce23b0,_0x250106,_0x56b7a3,_0x353dd7);}else{logger[_0x4a09('0xe')](_0x4a09('0x1e'),_0x37bd53,_0x375d46[_0x4a09('0xb')]);_0x34bf38['stop']();}}}catch(_0x5dbed5){console[_0x4a09('0x1f')](_0x5dbed5);logger[_0x4a09('0xe')](_0x4a09('0x20'),_0x37bd53,_0x5dbed5[_0x4a09('0x21')]);_0x34bf38[_0x4a09('0x12')]();}};}; \ No newline at end of file +var _0xc1d0=['length','error','[%s][AGENT]\x20%s','message','join','stop','find','name','createQueue','atimeout','channel','START:%s','rules','end','info','close','complete','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','consequence'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc1d0,0x1a1));var _0x0c1d=function(_0x137ae3,_0x4e93bf){_0x137ae3=_0x137ae3-0x0;var _0x3de34c=_0xc1d0[_0x137ae3];return _0x3de34c;};'use strict';var schema=require(_0x0c1d('0x0'));var _=require(_0x0c1d('0x1'));var util=require(_0x0c1d('0x2'));var seqqueue=require(_0x0c1d('0x3'));var logger=require(_0x0c1d('0x4'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0x0c1d('0x5'),'required':!![],'message':_0x0c1d('0x6')},'timeout':{'type':_0x0c1d('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x2b1615,_0xe16e0a,_0x47a9d2){return logger['info'](util[_0x0c1d('0x8')](_0x0c1d('0x9'),_0x2b1615,_0xe16e0a['name'],_0x47a9d2));}function handleFindAgent(_0x41ef74){return function(_0xada1c8){return _0xada1c8['name']['toLowerCase']()===_0x41ef74[_0x0c1d('0xa')]();};}exports[_0x0c1d('0xb')]=function(_0x759a5a,_0xf85a56,_0x1740bf,_0xa882cd){return function(_0x4031e1){try{var _0x13fce9={'name':_0xf85a56[0x0],'timeout':_0xf85a56[0x1]};var _0x119aba=queue[_0x0c1d('0x0')](_0x13fce9,{'typecast':!![]});if(_0x119aba[_0x0c1d('0xc')]){logger[_0x0c1d('0xd')](_0x0c1d('0xe'),_0x759a5a,_['map'](_0x119aba,_0x0c1d('0xf'))[_0x0c1d('0x10')](',\x20'));_0x4031e1[_0x0c1d('0x11')]();}else{var _0x2171a1=_[_0x0c1d('0x12')](_0x1740bf['agents'],handleFindAgent(_0x13fce9[_0x0c1d('0x13')]));if(_0x2171a1){var _0x26661f=(_0x13fce9['timeout']||0xa)*0x3e8;var _0x405e7f,_0xb03380;var _0x34de39=seqqueue[_0x0c1d('0x14')](_0x26661f);_0x34de39['id']=_0x759a5a;_0x34de39[_0x0c1d('0x15')]=_0x26661f;_0x34de39[_0x0c1d('0x16')]=_0xa882cd[_0x0c1d('0x16')];writeLog(_0x759a5a,_0x2171a1,util['format'](_0x0c1d('0x17'),_0x26661f));_0x1740bf[_0x0c1d('0x18')][_0x759a5a]['on'](_0x0c1d('0x19'),function(){logger[_0x0c1d('0x1a')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x759a5a);clearTimeout(_0xb03380);_0xb03380=undefined;_0x34de39[_0x0c1d('0x1b')]();if(_0x1740bf[_0x0c1d('0x18')][_0x759a5a]){delete _0x1740bf['rules'][_0x759a5a];}_0x4031e1['stop']();});_0x1740bf['rules'][_0x759a5a]['on'](_0x0c1d('0x1c'),function(){if(_0x1740bf['rules'][_0x759a5a]){delete _0x1740bf['rules'][_0x759a5a];}});_0xb03380=setTimeout(function(){logger[_0x0c1d('0x1a')]('[%s][AGENT]\x20ROUTING\x20END',_0x759a5a);clearTimeout(_0xb03380);_0x34de39[_0x0c1d('0x1b')]();_0x4031e1[_0x0c1d('0x1d')]();},_0x26661f);strategy['agent'](_0x34de39,_0x2171a1,_0x1740bf,_0xa882cd);}else{logger[_0x0c1d('0xd')](_0x0c1d('0x1e'),_0x759a5a,_0x13fce9[_0x0c1d('0x13')]);_0x4031e1[_0x0c1d('0x11')]();}}}catch(_0x7be5c0){console['log'](_0x7be5c0);logger[_0x0c1d('0xd')](_0x0c1d('0x1f'),_0x759a5a,_0x7be5c0[_0x0c1d('0x20')]);_0x4031e1['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 5b7b082..97708a5 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 _0x3a09=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','interaction','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','body','Message','create','then','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','toString','message','amazonlex','providerResponse','dialogState','Failed','moment','../../rpc/chatMessage'];(function(_0x2194e7,_0x1ee2c0){var _0x44c5dd=function(_0x420f44){while(--_0x420f44){_0x2194e7['push'](_0x2194e7['shift']());}};_0x44c5dd(++_0x1ee2c0);}(_0x3a09,0x1ac));var _0x93a0=function(_0x373294,_0x554274){_0x373294=_0x373294-0x0;var _0x59fbf1=_0x3a09[_0x373294];return _0x59fbf1;};'use strict';var _=require('lodash');var moment=require(_0x93a0('0x0'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x93a0('0x1')),'openchannelMessage':require(_0x93a0('0x2')),'mailMessage':require(_0x93a0('0x3')),'smsMessage':require(_0x93a0('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x93a0('0x5'))};exports[_0x93a0('0x6')]=function(_0x34a9b7,_0x3790b4){return function(_0x2bab93){try{if(!_[_0x93a0('0x7')](this['interaction']['UserId'])){logger[_0x93a0('0x8')](_0x93a0('0x9'),_0x34a9b7,_0x93a0('0xa'));return _0x2bab93[_0x93a0('0xb')]();}var _0x1f562f={'ContactId':this[_0x93a0('0xc')]['id'],'sentAt':moment()[_0x93a0('0xd')](_0x93a0('0xe')),'direction':_0x93a0('0xf')};if(this[_0x93a0('0x10')]==='sms'||this[_0x93a0('0x10')]===_0x93a0('0x11')){_0x1f562f[_0x93a0('0x12')]=this[_0x93a0('0x13')]['phone'];}var _0x3b2a30=this[_0x93a0('0x10')];if(_0x3b2a30==='chat'){_0x1f562f[_0x93a0('0x14')]=this[_0x93a0('0x15')]['id'];}else{_0x1f562f[_[_0x93a0('0x16')](_0x3b2a30)+_0x93a0('0x17')]=this[_0x93a0('0x15')]['id'];}_0x1f562f[_[_0x93a0('0x16')](_0x3b2a30)+_0x93a0('0x18')]=this[_0x93a0('0x13')]['id'];if(this[_0x93a0('0x13')]['created']){var _0x29d18a=_0x3790b4[0x4];if(!_['isEmpty'](_0x29d18a)){_0x1f562f[_0x93a0('0x19')]=utils['getMustacheRender'](_0x29d18a,this);return rpc[_0x3b2a30+_0x93a0('0x1a')][_0x93a0('0x1b')](_0x1f562f)[_0x93a0('0x1c')](function(_0x5d3a33){logger[_0x93a0('0x8')](_0x93a0('0x9'),_0x34a9b7,_0x1f562f[_0x93a0('0x19')]);})[_0x93a0('0x1d')](function(_0x35b348){logger[_0x93a0('0x1e')](_0x93a0('0x9'),_0x34a9b7,JSON[_0x93a0('0x1f')](_0x35b348));})[_0x93a0('0x20')](function(){logger[_0x93a0('0x8')](_0x93a0('0x21'),_0x34a9b7);_0x2bab93[_0x93a0('0x22')]();});}else{logger['info'](_0x93a0('0x23'),_0x34a9b7);_0x2bab93[_0x93a0('0x22')]();}}else{var _0x4c3bd0=this;var _0x6f03ba=new AWS[(_0x93a0('0x24'))]({'accessKeyId':_0x3790b4[0x0],'secretAccessKey':_0x3790b4[0x1],'region':_0x3790b4[0x2]});var _0x31a4af={'botAlias':'$LATEST','botName':_0x3790b4[0x3],'inputText':this['message'][_0x93a0('0x19')],'userId':this[_0x93a0('0x10')]+':'+this[_0x93a0('0x13')]['id'][_0x93a0('0x25')]()};_0x6f03ba['postText'](_0x31a4af,function(_0x1f4a0f,_0x33ca4d){if(_0x1f4a0f){logger['error']('[%s][AMAZONLEX]\x20%s',_0x34a9b7,_0x1f4a0f[_0x93a0('0x26')]);_0x2bab93[_0x93a0('0xb')]();}else if(_0x33ca4d&&_0x33ca4d[_0x93a0('0x26')]){_0x4c3bd0[_0x93a0('0x19')][_0x93a0('0x27')]=_0x33ca4d;_0x1f562f[_0x93a0('0x19')]=_0x33ca4d['message'];_0x1f562f['providerName']='amazonlex';_0x1f562f[_0x93a0('0x28')]=JSON[_0x93a0('0x1f')](_0x33ca4d);return rpc[_0x3b2a30+_0x93a0('0x1a')]['create'](_0x1f562f)[_0x93a0('0x1c')](function(_0x336faa){logger[_0x93a0('0x8')](_0x93a0('0x9'),_0x34a9b7,_0x1f562f['body']);if(_0x33ca4d[_0x93a0('0x29')]==_0x93a0('0x2a')){_0x2bab93[_0x93a0('0xb')]();}else{_0x2bab93[_0x93a0('0x22')]();}})[_0x93a0('0x1d')](function(_0x3dc606){logger[_0x93a0('0x1e')](_0x93a0('0x9'),_0x34a9b7,JSON[_0x93a0('0x1f')](_0x3dc606));_0x2bab93[_0x93a0('0xb')]();});}else{_0x2bab93[_0x93a0('0xb')]();}});}}catch(_0xcdbbb2){logger[_0x93a0('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x34a9b7,JSON[_0x93a0('0x1f')](_0xcdbbb2));_0x2bab93[_0x93a0('0x22')]();}};}; \ No newline at end of file +var _0x8abf=['./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','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','chat','ChatWebsiteId','account','upperFirst','InteractionId','isEmpty','body','getMustacheRender','Message','create','catch','error','stringify','finally','stop','message','toString','providerName','amazonlex','providerResponse','dialogState','Failed','lodash','moment'];(function(_0x2d0843,_0x4642b5){var _0x29e22a=function(_0x308058){while(--_0x308058){_0x2d0843['push'](_0x2d0843['shift']());}};_0x29e22a(++_0x4642b5);}(_0x8abf,0xdf));var _0xf8ab=function(_0x15c496,_0x510aad){_0x15c496=_0x15c496-0x0;var _0x3d00c1=_0x8abf[_0x15c496];return _0x3d00c1;};'use strict';var _=require(_0xf8ab('0x0'));var moment=require(_0xf8ab('0x1'));var AWS=require('aws-sdk');var utils=require(_0xf8ab('0x2'));var logger=require('../../../../config/logger')(_0xf8ab('0x3'));var rpc={'chatMessage':require(_0xf8ab('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf8ab('0x5')),'smsMessage':require(_0xf8ab('0x6')),'faxMessage':require(_0xf8ab('0x7')),'whatsappMessage':require(_0xf8ab('0x8'))};exports[_0xf8ab('0x9')]=function(_0x51ca2b,_0x443adf){return function(_0x18372e){try{if(!_[_0xf8ab('0xa')](this[_0xf8ab('0xb')][_0xf8ab('0xc')])){logger[_0xf8ab('0xd')](_0xf8ab('0xe'),_0x51ca2b,_0xf8ab('0xf'));return _0x18372e[_0xf8ab('0x10')]();}var _0x550904={'ContactId':this[_0xf8ab('0x11')]['id'],'sentAt':moment()[_0xf8ab('0x12')](_0xf8ab('0x13')),'direction':'out'};if(this[_0xf8ab('0x14')]===_0xf8ab('0x15')||this[_0xf8ab('0x14')]==='whatsapp'){_0x550904['phone']=this[_0xf8ab('0xb')][_0xf8ab('0x16')];}var _0x11840f=this[_0xf8ab('0x14')];if(_0x11840f===_0xf8ab('0x17')){_0x550904[_0xf8ab('0x18')]=this[_0xf8ab('0x19')]['id'];}else{_0x550904[_[_0xf8ab('0x1a')](_0x11840f)+'AccountId']=this[_0xf8ab('0x19')]['id'];}_0x550904[_[_0xf8ab('0x1a')](_0x11840f)+_0xf8ab('0x1b')]=this[_0xf8ab('0xb')]['id'];if(this[_0xf8ab('0xb')]['created']){var _0x31b9bc=_0x443adf[0x4];if(!_[_0xf8ab('0x1c')](_0x31b9bc)){_0x550904[_0xf8ab('0x1d')]=utils[_0xf8ab('0x1e')](_0x31b9bc,this);return rpc[_0x11840f+_0xf8ab('0x1f')][_0xf8ab('0x20')](_0x550904)['then'](function(_0x457c80){logger[_0xf8ab('0xd')](_0xf8ab('0xe'),_0x51ca2b,_0x550904['body']);})[_0xf8ab('0x21')](function(_0x4d1695){logger[_0xf8ab('0x22')]('[%s][AMAZONLEX]\x20%s',_0x51ca2b,JSON[_0xf8ab('0x23')](_0x4d1695));})[_0xf8ab('0x24')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x51ca2b);_0x18372e[_0xf8ab('0x25')]();});}else{logger[_0xf8ab('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x51ca2b);_0x18372e[_0xf8ab('0x25')]();}}else{var _0x43f2b0=this;var _0x21bd13=new AWS['LexRuntime']({'accessKeyId':_0x443adf[0x0],'secretAccessKey':_0x443adf[0x1],'region':_0x443adf[0x2]});var _0x3074b7={'botAlias':'$LATEST','botName':_0x443adf[0x3],'inputText':this[_0xf8ab('0x26')][_0xf8ab('0x1d')],'userId':this[_0xf8ab('0x14')]+':'+this[_0xf8ab('0xb')]['id'][_0xf8ab('0x27')]()};_0x21bd13['postText'](_0x3074b7,function(_0x57fb90,_0x34cf81){if(_0x57fb90){logger[_0xf8ab('0x22')](_0xf8ab('0xe'),_0x51ca2b,_0x57fb90[_0xf8ab('0x26')]);_0x18372e[_0xf8ab('0x10')]();}else if(_0x34cf81&&_0x34cf81[_0xf8ab('0x26')]){_0x43f2b0[_0xf8ab('0x1d')]['amazonlex']=_0x34cf81;_0x550904[_0xf8ab('0x1d')]=_0x34cf81[_0xf8ab('0x26')];_0x550904[_0xf8ab('0x28')]=_0xf8ab('0x29');_0x550904[_0xf8ab('0x2a')]=JSON[_0xf8ab('0x23')](_0x34cf81);return rpc[_0x11840f+_0xf8ab('0x1f')][_0xf8ab('0x20')](_0x550904)['then'](function(_0x47e1d1){logger[_0xf8ab('0xd')](_0xf8ab('0xe'),_0x51ca2b,_0x550904[_0xf8ab('0x1d')]);if(_0x34cf81[_0xf8ab('0x2b')]==_0xf8ab('0x2c')){_0x18372e['next']();}else{_0x18372e['stop']();}})[_0xf8ab('0x21')](function(_0x5908f0){logger[_0xf8ab('0x22')](_0xf8ab('0xe'),_0x51ca2b,JSON[_0xf8ab('0x23')](_0x5908f0));_0x18372e['next']();});}else{_0x18372e['next']();}});}}catch(_0x22b173){logger[_0xf8ab('0x22')](_0xf8ab('0xe'),_0x51ca2b,JSON[_0xf8ab('0x23')](_0x22b173));_0x18372e[_0xf8ab('0x25')]();}};}; \ 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 ec8ac24..96355bd 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 _0x4a24=['create','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','Interaction','update','stringify','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','message','channel','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','Message','service','Smtp','host','port','secure','authentication','auth','user','messageId','','';_0x16add5[_0x44a2('0x38')]={'Auto-Submitted':_0x44a2('0x39'),'X-Auto-Response-Suppress':_0x44a2('0x3a'),'Precedence':_0x44a2('0x3b')};return mailRpc['sendMailMessage'](_0x578947,_0x16add5)[_0x44a2('0x3c')](function(_0x2df3c2){logger[_0x44a2('0x10')](_0x44a2('0x3d'),_0x4b95e2);_0x16add5['messageId']=_0x2df3c2['message'][_0x44a2('0x34')];return rpc[_0x3f107e+'Message'][_0x44a2('0x3e')](_0x16add5);})[_0x44a2('0x3c')](function(_0x342f60){logger[_0x44a2('0x10')]('[%s][AUTOREPLY]\x20%s',_0x4b95e2,JSON['stringify'](_0x342f60));})['catch'](function(_0x1b3d9b){logger[_0x44a2('0x3f')](_0x44a2('0x40'),_0x4b95e2,JSON['stringify'](_0x1b3d9b));})[_0x44a2('0x41')](function(){Promise[_0x44a2('0x42')]()[_0x44a2('0x3c')](function(){if(_0x24a59f[0x0]!=='2'||_0x40b451[_0x44a2('0x43')])return;return rpc[_0x3f107e+_0x44a2('0x44')][_0x44a2('0x45')](_0x40b451['id'],{'autoreplyExecuted':!![]})['then'](function(_0x3d7111){logger[_0x44a2('0x10')](_0x44a2('0x18'),_0x4b95e2,JSON[_0x44a2('0x46')](_0x3d7111));})['catch'](function(_0x213d9e){logger[_0x44a2('0x3f')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4b95e2,JSON['stringify'](_0x213d9e));});})[_0x44a2('0x3c')](function(){_0x1f847b[_0x44a2('0x13')]();});});}else{return rpc[this[_0x44a2('0x1e')]+_0x44a2('0x2b')][_0x44a2('0x3e')](_0x16add5)[_0x44a2('0x3c')](function(_0x43bdfb){logger['info'](_0x44a2('0x11'),_0x4b95e2,_0x16add5[_0x44a2('0xe')]);})[_0x44a2('0x47')](function(_0x41b5d8){logger[_0x44a2('0x3f')](_0x44a2('0x11'),_0x4b95e2,JSON[_0x44a2('0x46')](_0x41b5d8));})[_0x44a2('0x41')](function(){Promise[_0x44a2('0x42')]()[_0x44a2('0x3c')](function(){if(_0x24a59f[0x0]!=='2'||_0x40b451['autoreplyExecuted'])return;return rpc[_0x3f107e+_0x44a2('0x44')][_0x44a2('0x45')](_0x40b451['id'],{'autoreplyExecuted':!![]})[_0x44a2('0x3c')](function(_0x244a62){logger[_0x44a2('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4b95e2,JSON[_0x44a2('0x46')](_0x244a62));})['catch'](function(_0x4f51d5){logger['error'](_0x44a2('0x48'),_0x4b95e2,JSON[_0x44a2('0x46')](_0x4f51d5));});})['then'](function(){_0x1f847b[_0x44a2('0x13')]();});});}}}catch(_0x49b13a){logger[_0x44a2('0x3f')](_0x44a2('0x11'),_0x4b95e2,JSON['stringify'](_0x49b13a));_0x1f847b[_0x44a2('0x49')]();}};}; \ No newline at end of file +var _0xd375=['finally','resolve','Interaction','update','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','body','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','upperFirst','AccountId','account','InteractionId','service','Smtp','host','port','secure','authentication','user','pass','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','then','error','[RPC][%s][AUTOREPLY]\x20%s','stringify'];(function(_0x589ca6,_0x29828a){var _0x6d656b=function(_0x54cee4){while(--_0x54cee4){_0x589ca6['push'](_0x589ca6['shift']());}};_0x6d656b(++_0x29828a);}(_0xd375,0xf4));var _0x5d37=function(_0x38af71,_0x381082){_0x38af71=_0x38af71-0x0;var _0x2354d5=_0xd375[_0x38af71];return _0x2354d5;};'use strict';var _=require('lodash');var moment=require(_0x5d37('0x0'));var utils=require('./utils');var logger=require(_0x5d37('0x1'))('routing');var rpc={'chatMessage':require(_0x5d37('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x5d37('0x3')),'smsMessage':require(_0x5d37('0x4')),'faxMessage':require(_0x5d37('0x5')),'whatsappMessage':require(_0x5d37('0x6')),'chatInteraction':require(_0x5d37('0x7')),'openchannelInteraction':require(_0x5d37('0x8')),'mailInteraction':require(_0x5d37('0x9')),'smsInteraction':require(_0x5d37('0xa')),'faxInteraction':require(_0x5d37('0xb')),'whatsappInteraction':require(_0x5d37('0xc'))};var mailRpc=require(_0x5d37('0xd'));exports[_0x5d37('0xe')]=function(_0x33537e,_0x32197c,_0x3df501,_0x1b3229){return function(_0x55b327){try{var _0x42e4ad=this['channel'];if(_0x42e4ad===_0x5d37('0xf')&&_0x1b3229['body'][_0x5d37('0x10')]){logger[_0x5d37('0x11')](_0x5d37('0x12'),_0x33537e,_0x5d37('0x13'));return _0x55b327['next']();}if(_0x32197c[0x0]==='1'&&(_[_0x5d37('0x14')](this[_0x5d37('0x15')][_0x5d37('0x16')])||!this[_0x5d37('0x15')][_0x5d37('0x16')])){logger[_0x5d37('0x11')](_0x5d37('0x12'),_0x33537e,'Autoreply\x20already\x20sent');return _0x55b327['next']();}if(_0x32197c[0x0]==='2'&&this[_0x5d37('0x15')][_0x5d37('0x17')]){logger[_0x5d37('0x11')](_0x5d37('0x18'),_0x33537e,'One\x20Time\x20already\x20sent');return _0x55b327[_0x5d37('0x19')]();}var _0x505d90={'ContactId':this[_0x5d37('0x1a')]['id'],'sentAt':moment()[_0x5d37('0x1b')](_0x5d37('0x1c')),'direction':_0x5d37('0x1d')};if(this[_0x5d37('0x1e')]===_0x5d37('0xf')){_0x505d90[_0x5d37('0x1f')]=utils[_0x5d37('0x20')](_0x32197c[0x2],this);}else{_0x505d90[_0x5d37('0x1f')]=utils[_0x5d37('0x20')](_0x32197c[0x1],this);}if(this[_0x5d37('0x21')]){_0x505d90['to']=this[_0x5d37('0x21')][_0x5d37('0x22')]||'';if(this[_0x5d37('0x1e')]==='mail'&&_0x32197c[0x1]==='1'){_0x505d90['cc']=this[_0x5d37('0x21')]['cc']||'';}_0x505d90[_0x5d37('0x22')]=this[_0x5d37('0x21')]['to']||'';_0x505d90['phone']=this[_0x5d37('0x21')][_0x5d37('0x23')]||'';_0x505d90[_0x5d37('0x24')]=!![];if(this['message'][_0x5d37('0x25')]){_0x505d90[_0x5d37('0x25')]='';_0x505d90[_0x5d37('0x25')]+=_['startsWith'](this['message'][_0x5d37('0x25')],_0x5d37('0x26'))?'':_0x5d37('0x27');_0x505d90['subject']+=this[_0x5d37('0x21')]['subject'];}}if(this[_0x5d37('0x1e')]===_0x5d37('0x28')){_0x505d90['ChatWebsiteId']=this['account']['id'];}else{_0x505d90[_[_0x5d37('0x29')](this[_0x5d37('0x1e')])+_0x5d37('0x2a')]=this[_0x5d37('0x2b')]['id'];}_0x505d90[_[_0x5d37('0x29')](this['channel'])+_0x5d37('0x2c')]=this[_0x5d37('0x15')]['id'];var _0x4327cc=this['interaction'];if(rpc[this[_0x5d37('0x1e')]+'Message']){if(this[_0x5d37('0x1e')]==='mail'){var _0x4682e9={'tls':{'rejectUnauthorized':![]}};if(this[_0x5d37('0x2b')]['Smtp'][_0x5d37('0x2d')]){_0x4682e9[_0x5d37('0x2d')]=this[_0x5d37('0x2b')][_0x5d37('0x2e')][_0x5d37('0x2d')];}else{_0x4682e9[_0x5d37('0x2f')]=this[_0x5d37('0x2b')]['Smtp'][_0x5d37('0x2f')];_0x4682e9[_0x5d37('0x30')]=this[_0x5d37('0x2b')][_0x5d37('0x2e')][_0x5d37('0x30')];_0x4682e9[_0x5d37('0x31')]=this[_0x5d37('0x2b')][_0x5d37('0x2e')][_0x5d37('0x31')];}if(this[_0x5d37('0x2b')]['Smtp'][_0x5d37('0x32')]){_0x4682e9['auth']={'user':this[_0x5d37('0x2b')][_0x5d37('0x2e')][_0x5d37('0x33')],'pass':this[_0x5d37('0x2b')][_0x5d37('0x2e')][_0x5d37('0x34')]};}_0x505d90[_0x5d37('0x35')]=this[_0x5d37('0x21')][_0x5d37('0x36')];_0x505d90[_0x5d37('0x37')]=_0x5d37('0x38')+_[_0x5d37('0x39')](_0x505d90[_0x5d37('0x1f')],']+(>|$)/g,''),'priorityTrue':_0x49a3f1[0x1],'priorityFalse':_0x49a3f1[0x2]};var _0xba0ccd=gotoif['validate'](_0x5bf310,{'typecast':!![]});if(_0xba0ccd[_0xb317('0xa')]){logger['error'](_0xb317('0xb'),_0x168be3,_[_0xb317('0xc')](_0xba0ccd,_0xb317('0xd'))[_0xb317('0xe')](',\x20'));_0x3ffc08[_0xb317('0xf')]();}else{try{var _0x582d36=eval('('+_0x5bf310[_0xb317('0x10')]+')');var _0x3157e2=_0x582d36?_0x5bf310[_0xb317('0x11')]:_0x5bf310['priorityFalse'];logger[_0xb317('0x12')](_0xb317('0x13'),_0x168be3,_0x5bf310[_0xb317('0x10')],_0x582d36,_0x3157e2||_0xb317('0x14'));if(_0x3157e2){var _0x2bf054=_['findIndex'](_0x3ffc08[_0xb317('0x15')](),{'p':_0x3157e2});if(_0x2bf054>=0x0){logger[_0xb317('0x12')](_0xb317('0x16'),_0x168be3,_0x3157e2||_0xb317('0x14'),_0x2bf054);_0x3ffc08[_0xb317('0x14')](_0x2bf054);}else{logger['info'](_0xb317('0x17'),_0x168be3,_0x3157e2||_0xb317('0x14'));_0x3ffc08['stop']();}}else{_0x3ffc08['next']();}}catch(_0x4a2687){logger[_0xb317('0x18')](_0xb317('0x19'),_0x168be3,_0x4a2687[_0xb317('0xd')]);_0x3ffc08[_0xb317('0xf')]();}}}catch(_0x190fc4){logger[_0xb317('0x18')](_0xb317('0xb'),_0x168be3,JSON['stringify'](_0x190fc4));_0x3ffc08['stop']();}};}; \ No newline at end of file +var _0x5380=['../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate','html-to-text','./utils'];(function(_0x5efadc,_0x36293b){var _0x3a84e5=function(_0x409be3){while(--_0x409be3){_0x5efadc['push'](_0x5efadc['shift']());}};_0x3a84e5(++_0x36293b);}(_0x5380,0xab));var _0x0538=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5380[_0x122ef9];return _0x42fba0;};'use strict';var schema=require(_0x0538('0x0'));var _=require('lodash');var htmlToText=require(_0x0538('0x1'));var utils=require(_0x0538('0x2'));var logger=require(_0x0538('0x3'))(_0x0538('0x4'));var gotoif=schema({'condition':{'type':_0x0538('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x0538('0x6'),'message':_0x0538('0x7')},'priorityFalse':{'type':'number','message':_0x0538('0x8')}});exports[_0x0538('0x9')]=function(_0x52a324,_0x59b004){return function(_0x2fb285){try{var _0x296f74={'condition':htmlToText[_0x0538('0xa')](utils['getMustacheRender'](_0x59b004[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x59b004[0x1],'priorityFalse':_0x59b004[0x2]};var _0x329759=gotoif[_0x0538('0x0')](_0x296f74,{'typecast':!![]});if(_0x329759[_0x0538('0xb')]){logger[_0x0538('0xc')](_0x0538('0xd'),_0x52a324,_[_0x0538('0xe')](_0x329759,_0x0538('0xf'))[_0x0538('0x10')](',\x20'));_0x2fb285[_0x0538('0x11')]();}else{try{var _0x4578a7=eval('('+_0x296f74[_0x0538('0x12')]+')');var _0x144d59=_0x4578a7?_0x296f74[_0x0538('0x13')]:_0x296f74[_0x0538('0x14')];logger[_0x0538('0x15')](_0x0538('0x16'),_0x52a324,_0x296f74[_0x0538('0x12')],_0x4578a7,_0x144d59||'next');if(_0x144d59){var _0x361480=_[_0x0538('0x17')](_0x2fb285[_0x0538('0x18')](),{'p':_0x144d59});if(_0x361480>=0x0){logger[_0x0538('0x15')](_0x0538('0x19'),_0x52a324,_0x144d59||_0x0538('0x1a'),_0x361480);_0x2fb285[_0x0538('0x1a')](_0x361480);}else{logger[_0x0538('0x15')](_0x0538('0x1b'),_0x52a324,_0x144d59||_0x0538('0x1a'));_0x2fb285['stop']();}}else{_0x2fb285[_0x0538('0x1a')]();}}catch(_0x5eb803){logger[_0x0538('0xc')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x52a324,_0x5eb803['message']);_0x2fb285[_0x0538('0x11')]();}}}catch(_0x2e3ad6){logger[_0x0538('0xc')]('[%s][GOTOIF]\x20%s',_0x52a324,JSON[_0x0538('0x1c')](_0x2e3ad6));_0x2fb285['stop']();}};}; \ 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 3ad9dc1..97187b8 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 _0x0326=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','next'];(function(_0x22268f,_0x1d6577){var _0x38158f=function(_0x4a1d43){while(--_0x4a1d43){_0x22268f['push'](_0x22268f['shift']());}};_0x38158f(++_0x1d6577);}(_0x0326,0x152));var _0x6032=function(_0x361ee1,_0x37fed8){_0x361ee1=_0x361ee1-0x0;var _0x1fcaad=_0x0326[_0x361ee1];return _0x1fcaad;};'use strict';var schema=require(_0x6032('0x0'));var _=require(_0x6032('0x1'));var logger=require(_0x6032('0x2'))(_0x6032('0x3'));var gotop=schema({'priority':{'type':_0x6032('0x4'),'required':!![],'message':_0x6032('0x5')}});exports[_0x6032('0x6')]=function(_0x297b89,_0x3d1cfe){return function(_0x19463e){try{var _0x4adb3b={'priority':_0x3d1cfe[0x0]};var _0x4daab5=gotop[_0x6032('0x0')](_0x4adb3b,{'typecast':!![]});if(_0x4daab5[_0x6032('0x7')]){logger[_0x6032('0x8')](_0x6032('0x9'),_0x297b89,_[_0x6032('0xa')](_0x4daab5,_0x6032('0xb'))[_0x6032('0xc')](',\x20'));_0x19463e[_0x6032('0xd')]();}else{logger[_0x6032('0xe')](_0x6032('0xf'),_0x297b89,_0x4adb3b['priority']);if(_0x4adb3b[_0x6032('0x10')]){var _0x336996=_[_0x6032('0x11')](_0x19463e['rules'](),{'p':_0x4adb3b['priority']});if(_0x336996>=0x0){logger[_0x6032('0xe')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x297b89,_0x4adb3b[_0x6032('0x10')]||_0x6032('0x12'),_0x336996);_0x19463e[_0x6032('0x12')](_0x336996);}else{logger[_0x6032('0xe')](_0x6032('0x13'),_0x297b89,_0x4adb3b[_0x6032('0x10')]||'next');_0x19463e['stop']();}}else{_0x19463e['next']();}}}catch(_0x184346){logger[_0x6032('0x8')](_0x6032('0x9'),_0x297b89,JSON[_0x6032('0x14')](_0x184346));_0x19463e[_0x6032('0xd')]();}};}; \ No newline at end of file +var _0xe8fb=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing','number'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe8fb,0x18c));var _0xbe8f=function(_0x4024d7,_0x41f766){_0x4024d7=_0x4024d7-0x0;var _0x1e6617=_0xe8fb[_0x4024d7];return _0x1e6617;};'use strict';var schema=require(_0xbe8f('0x0'));var _=require(_0xbe8f('0x1'));var logger=require('../../../../config/logger')(_0xbe8f('0x2'));var gotop=schema({'priority':{'type':_0xbe8f('0x3'),'required':!![],'message':_0xbe8f('0x4')}});exports[_0xbe8f('0x5')]=function(_0x182720,_0x3be6ad){return function(_0x54fb89){try{var _0x5beb9d={'priority':_0x3be6ad[0x0]};var _0xa9c5d0=gotop[_0xbe8f('0x0')](_0x5beb9d,{'typecast':!![]});if(_0xa9c5d0[_0xbe8f('0x6')]){logger[_0xbe8f('0x7')](_0xbe8f('0x8'),_0x182720,_[_0xbe8f('0x9')](_0xa9c5d0,_0xbe8f('0xa'))[_0xbe8f('0xb')](',\x20'));_0x54fb89['stop']();}else{logger[_0xbe8f('0xc')](_0xbe8f('0xd'),_0x182720,_0x5beb9d[_0xbe8f('0xe')]);if(_0x5beb9d[_0xbe8f('0xe')]){var _0x2a5028=_['findIndex'](_0x54fb89[_0xbe8f('0xf')](),{'p':_0x5beb9d['priority']});if(_0x2a5028>=0x0){logger[_0xbe8f('0xc')](_0xbe8f('0x10'),_0x182720,_0x5beb9d[_0xbe8f('0xe')]||_0xbe8f('0x11'),_0x2a5028);_0x54fb89[_0xbe8f('0x11')](_0x2a5028);}else{logger[_0xbe8f('0xc')](_0xbe8f('0x12'),_0x182720,_0x5beb9d[_0xbe8f('0xe')]||_0xbe8f('0x11'));_0x54fb89['stop']();}}else{_0x54fb89['next']();}}}catch(_0x40758e){logger['error'](_0xbe8f('0x8'),_0x182720,JSON[_0xbe8f('0x13')](_0x40758e));_0x54fb89['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 7d738a7..3867ef5 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 _0x8ee8=['./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','body','next','error','stringify','stop','[%s][MESSAGE]\x20%s','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ee8,0x9b));var _0x88ee=function(_0x4bd795,_0x4b5438){_0x4bd795=_0x4bd795-0x0;var _0x5e37f8=_0x8ee8[_0x4bd795];return _0x5e37f8;};'use strict';var _=require(_0x88ee('0x0'));var utils=require(_0x88ee('0x1'));var logger=require(_0x88ee('0x2'))(_0x88ee('0x3'));var rpc={'chatMessage':require(_0x88ee('0x4')),'openchannelMessage':require(_0x88ee('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x88ee('0x6')),'whatsappMessage':require(_0x88ee('0x7'))};exports[_0x88ee('0x8')]=function(_0x4c90f5,_0x1919c9){return function(_0x4e325a){try{var _0x4e5b23={'body':utils['getMustacheRender'](_0x1919c9[0x0],this),'ContactId':this[_0x88ee('0x9')]['id']};if(this[_0x88ee('0xa')]===_0x88ee('0xb')){_0x4e5b23['ChatWebsiteId']=this[_0x88ee('0xc')]['id'];}else{_0x4e5b23[_[_0x88ee('0xd')](this[_0x88ee('0xa')])+_0x88ee('0xe')]=this[_0x88ee('0xc')]['id'];}_0x4e5b23[_['upperFirst'](this['channel'])+_0x88ee('0xf')]=this[_0x88ee('0x10')]['id'];if(rpc[this[_0x88ee('0xa')]+'Message']){return rpc[this[_0x88ee('0xa')]+_0x88ee('0x11')][_0x88ee('0x12')](_0x4e5b23)[_0x88ee('0x13')](function(_0x414cd3){logger['info']('[%s][MESSAGE]\x20%s',_0x4c90f5,_0x4e5b23[_0x88ee('0x14')]);_0x4e325a[_0x88ee('0x15')]();})['catch'](function(_0x2978b7){logger[_0x88ee('0x16')]('[%s][MESSAGE]\x20%s',_0x4c90f5,JSON[_0x88ee('0x17')](_0x2978b7));_0x4e325a[_0x88ee('0x18')]();});}}catch(_0x336e87){logger['error'](_0x88ee('0x19'),_0x4c90f5,JSON[_0x88ee('0x17')](_0x336e87));_0x4e325a[_0x88ee('0x18')]();}};}; \ No newline at end of file +var _0xb6e6=['../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','error','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage'];(function(_0x1c1308,_0x5e6fad){var _0x8ce99a=function(_0x1cb2c5){while(--_0x1cb2c5){_0x1c1308['push'](_0x1c1308['shift']());}};_0x8ce99a(++_0x5e6fad);}(_0xb6e6,0xbf));var _0x6b6e=function(_0xe43bf4,_0x2dfd33){_0xe43bf4=_0xe43bf4-0x0;var _0x5c76fd=_0xb6e6[_0xe43bf4];return _0x5c76fd;};'use strict';var _=require(_0x6b6e('0x0'));var utils=require('./utils');var logger=require(_0x6b6e('0x1'))(_0x6b6e('0x2'));var rpc={'chatMessage':require(_0x6b6e('0x3')),'openchannelMessage':require(_0x6b6e('0x4')),'mailMessage':require(_0x6b6e('0x5')),'smsMessage':require(_0x6b6e('0x6')),'faxMessage':require(_0x6b6e('0x7')),'whatsappMessage':require(_0x6b6e('0x8'))};exports[_0x6b6e('0x9')]=function(_0x9dd813,_0x319018){return function(_0x29ab81){try{var _0x1fd5ca={'body':utils[_0x6b6e('0xa')](_0x319018[0x0],this),'ContactId':this[_0x6b6e('0xb')]['id']};if(this[_0x6b6e('0xc')]==='chat'){_0x1fd5ca[_0x6b6e('0xd')]=this[_0x6b6e('0xe')]['id'];}else{_0x1fd5ca[_[_0x6b6e('0xf')](this[_0x6b6e('0xc')])+_0x6b6e('0x10')]=this[_0x6b6e('0xe')]['id'];}_0x1fd5ca[_[_0x6b6e('0xf')](this[_0x6b6e('0xc')])+_0x6b6e('0x11')]=this[_0x6b6e('0x12')]['id'];if(rpc[this['channel']+_0x6b6e('0x13')]){return rpc[this['channel']+'Message'][_0x6b6e('0x14')](_0x1fd5ca)[_0x6b6e('0x15')](function(_0x4506db){logger[_0x6b6e('0x16')](_0x6b6e('0x17'),_0x9dd813,_0x1fd5ca['body']);_0x29ab81[_0x6b6e('0x18')]();})['catch'](function(_0x113f92){logger[_0x6b6e('0x19')](_0x6b6e('0x17'),_0x9dd813,JSON[_0x6b6e('0x1a')](_0x113f92));_0x29ab81[_0x6b6e('0x1b')]();});}}catch(_0x410ba1){logger['error'](_0x6b6e('0x17'),_0x9dd813,JSON[_0x6b6e('0x1a')](_0x410ba1));_0x29ab81['stop']();}};}; \ 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 6225896..ca3530d 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 _0xe2dd=['stringify','stop','./utils','../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s','getMustacheRender','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe2dd,0x92));var _0xde2d=function(_0x575b72,_0x1a7eb1){_0x575b72=_0x575b72-0x0;var _0x561c57=_0xe2dd[_0x575b72];return _0x561c57;};'use strict';var utils=require(_0xde2d('0x0'));var logger=require(_0xde2d('0x1'))(_0xde2d('0x2'));exports[_0xde2d('0x3')]=function(_0x45983a,_0x1072a8){return function(_0x548bd3){try{logger['info'](_0xde2d('0x4'),_0x45983a,utils[_0xde2d('0x5')](_0x1072a8[0x0],this));_0x548bd3['next']();}catch(_0x38f2a2){logger[_0xde2d('0x6')](_0xde2d('0x4'),_0x45983a,JSON[_0xde2d('0x7')](_0x38f2a2));_0x548bd3[_0xde2d('0x8')]();}};}; \ No newline at end of file +var _0xb10b=['error','[%s][NOOP]\x20%s','stringify','stop','../../../../config/logger','info','getMustacheRender','next'];(function(_0x3b961e,_0x3e22ad){var _0x3c3a84=function(_0x13a47f){while(--_0x13a47f){_0x3b961e['push'](_0x3b961e['shift']());}};_0x3c3a84(++_0x3e22ad);}(_0xb10b,0x144));var _0xbb10=function(_0x402b7e,_0x35fdf7){_0x402b7e=_0x402b7e-0x0;var _0x55f359=_0xb10b[_0x402b7e];return _0x55f359;};'use strict';var utils=require('./utils');var logger=require(_0xbb10('0x0'))('routing');exports['consequence']=function(_0x2ac060,_0x34e1ee){return function(_0x1b9f62){try{logger[_0xbb10('0x1')]('[%s][NOOP]\x20%s',_0x2ac060,utils[_0xbb10('0x2')](_0x34e1ee[0x0],this));_0x1b9f62[_0xbb10('0x3')]();}catch(_0x458025){logger[_0xbb10('0x4')](_0xbb10('0x5'),_0x2ac060,JSON[_0xbb10('0x6')](_0x458025));_0x1b9f62[_0xbb10('0x7')]();}};}; \ 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 e622af3..a6ae58f 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 _0x4608=['account','queue','from','joinAt','emit','clone','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','accepted','[%s][STOP:QUEUE][NAME:%s]','update','error','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','map','join','stop','find','Queues','timeout','qtimeout','rules','end','close','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','log','stack','validate','util','seq-queue','ioredis','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id'];(function(_0x1f71f9,_0x28d756){var _0x305cbd=function(_0x46d211){while(--_0x46d211){_0x1f71f9['push'](_0x1f71f9['shift']());}};_0x305cbd(++_0x28d756);}(_0x4608,0x1b6));var _0x8460=function(_0x390c4e,_0x17df15){_0x390c4e=_0x390c4e-0x0;var _0x17c4a4=_0x4608[_0x390c4e];return _0x17c4a4;};'use strict';var schema=require(_0x8460('0x0'));var _=require('lodash');var util=require(_0x8460('0x1'));var seqqueue=require(_0x8460('0x2'));var moment=require('moment');var Redis=require(_0x8460('0x3'));var config=require('../../../../config/environment');var logger=require(_0x8460('0x4'))(_0x8460('0x5'));var strategy=require(_0x8460('0x6'));config[_0x8460('0x7')]=_[_0x8460('0x8')](config[_0x8460('0x7')],{'host':_0x8460('0x9'),'port':0x18eb});var io=require(_0x8460('0xa'))(new Redis(config[_0x8460('0x7')]));var attributes=['id',_0x8460('0xb'),_0x8460('0xc'),_0x8460('0xd'),_0x8460('0xe'),_0x8460('0xf')];function emit(_0x291234,_0x22e704,_0x1f3d6c){io['to'](_0x291234)[_0x8460('0x10')](_0x22e704,_0x1f3d6c);}function emitChannelQueueInteraction(_0x277b45,_0x1a3de3,_0x42b8ec,_0x2887ee,_0xe36c16,_0x3c4f62,_0x52aa5b,_0x54c22c){var _0x33b034=_[_0x8460('0x11')](_0x42b8ec);_0x33b034['queue_id']=_0x54c22c;_0x33b034[_0x8460('0xd')]=_0x1a3de3;_0x33b034[_0x8460('0xc')]=_0x2887ee;_0x33b034['id']=_0xe36c16;if(_0x3c4f62){_0x52aa5b[util['format'](_0x8460('0x12'),_0x277b45)][_0xe36c16]=_[_0x8460('0x13')](_0x33b034,attributes);}else{delete _0x52aa5b[util[_0x8460('0x14')](_0x8460('0x12'),_0x277b45)][_0xe36c16];}emit(util[_0x8460('0x14')](_0x8460('0x15'),_0x277b45,_0x1a3de3),util['format'](_0x8460('0x16'),_0x277b45,_0x3c4f62?'save':_0x8460('0x17')),_['pick'](_0x33b034,attributes));}var rpc={'openchannelQueueReport':require(_0x8460('0x18')),'mailQueueReport':require(_0x8460('0x19')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x8460('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x8460('0x1b'),'required':!![],'message':_0x8460('0x1c')},'timeout':{'type':_0x8460('0x1d'),'message':_0x8460('0x1e')}});function startRouting(_0x456013,_0x1ab9fe,_0x767ef4,_0x5103c8){if(_0x456013&&_0x1ab9fe&&_0x767ef4){_0x1ab9fe[_0x8460('0x1f')]+=0x1;var _0x38f75d={'uniqueid':_0x456013,'from':_0x767ef4[_0x8460('0x20')]?_0x767ef4['body'][_0x8460('0xe')]:'','joinAt':moment()[_0x8460('0x14')](_0x8460('0x21')),'ContactId':_0x767ef4[_0x8460('0x22')]?_0x767ef4[_0x8460('0x22')]['id']:null,'ListId':_0x767ef4[_0x8460('0x23')]?_0x767ef4[_0x8460('0x23')]['id']:null};_0x38f75d[_[_0x8460('0x24')](_0x767ef4[_0x8460('0x25')])+_0x8460('0x26')]=_0x1ab9fe['id']||null;_0x38f75d[_[_0x8460('0x24')](_0x767ef4[_0x8460('0x25')])+_0x8460('0x27')]=_0x767ef4[_0x8460('0x28')]?_0x767ef4[_0x8460('0x28')]['id']:null;_0x38f75d[_[_0x8460('0x24')](_0x767ef4[_0x8460('0x25')])+'MessageId']=_0x767ef4[_0x8460('0x29')]?_0x767ef4[_0x8460('0x29')]['id']:null;_0x38f75d[_[_0x8460('0x24')](_0x767ef4['channel'])+(_0x767ef4[_0x8460('0x25')]!==_0x8460('0x2a')?_0x8460('0x2b'):_0x8460('0x2c'))]=_0x767ef4[_0x8460('0xc')]?_0x767ef4[_0x8460('0xc')]['id']:null;logger[_0x8460('0x2d')](util[_0x8460('0x14')](_0x8460('0x2e'),_0x456013,_0x1ab9fe[_0x8460('0x2f')]));emitChannelQueueInteraction(_0x767ef4['channel'],_0x1ab9fe[_0x8460('0x2f')],_0x38f75d,_0x767ef4['account'][_0x8460('0x2f')],_0x767ef4[_0x8460('0x29')]['id'],!![],_0x5103c8,_0x1ab9fe['id']);if(rpc[_0x767ef4['channel']+_0x8460('0x30')]){return rpc[_0x767ef4[_0x8460('0x25')]+_0x8460('0x30')][_0x8460('0x31')](_0x38f75d)[_0x8460('0x32')](function(_0x2adff7){logger['error']('create\x20queue\x20report');});}}}function stopRouting(_0x508962,_0x3ed102,_0x5ca035,_0x2eb68f){if(_0x508962&&_0x3ed102){_0x3ed102[_0x8460('0x1f')]-=0x1;var _0x325f92={'leaveAt':moment()[_0x8460('0x14')](_0x8460('0x21')),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x8460('0x33')};logger[_0x8460('0x2d')](util[_0x8460('0x14')](_0x8460('0x34'),_0x508962,_0x3ed102[_0x8460('0x2f')]));emitChannelQueueInteraction(_0x5ca035[_0x8460('0x25')],_0x3ed102[_0x8460('0x2f')],_0x5ca035[_0x8460('0x20')],_0x5ca035[_0x8460('0xc')][_0x8460('0x2f')],_0x5ca035[_0x8460('0x29')]['id'],![],_0x2eb68f,_0x3ed102['id']);if(rpc[_0x5ca035[_0x8460('0x25')]+_0x8460('0x30')]){return rpc[_0x5ca035[_0x8460('0x25')]+_0x8460('0x30')][_0x8460('0x35')](_0x508962,_0x325f92)[_0x8460('0x32')](function(_0x27a004){logger[_0x8460('0x36')](_0x8460('0x37'));});}}}function endRouting(_0x349591,_0x33fca8,_0x1be9ef,_0x1ea0f0){if(_0x349591&&_0x33fca8){_0x33fca8['waiting']-=0x1;var _0x147baa={'leaveAt':moment()[_0x8460('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x8460('0x14')](_0x8460('0x21')),'reason':'timeout'};logger[_0x8460('0x2d')](util['format'](_0x8460('0x38'),_0x349591,_0x33fca8[_0x8460('0x2f')]));emitChannelQueueInteraction(_0x1be9ef[_0x8460('0x25')],_0x33fca8[_0x8460('0x2f')],_0x1be9ef[_0x8460('0x20')],_0x1be9ef[_0x8460('0xc')][_0x8460('0x2f')],_0x1be9ef[_0x8460('0x29')]['id'],![],_0x1ea0f0);if(rpc[_0x1be9ef['channel']+'QueueReport']){return rpc[_0x1be9ef[_0x8460('0x25')]+_0x8460('0x30')][_0x8460('0x35')](_0x349591,_0x147baa)[_0x8460('0x32')](function(_0x3709a2){logger[_0x8460('0x36')](_0x8460('0x37'));});}}}function handleFindQueue(_0x42004c){return function(_0x5db814){return _0x5db814[_0x8460('0x2f')][_0x8460('0x39')]()===_0x42004c[_0x8460('0x39')]();};}exports['consequence']=function(_0x54b905,_0x5d3845,_0xfdcab1,_0x3979cd){return function(_0x2dc3f2){try{var _0x5b1331={'name':_0x5d3845[0x0],'timeout':_0x5d3845[0x1]};var _0x894c86=queue[_0x8460('0x0')](_0x5b1331,{'typecast':!![]});if(_0x894c86[_0x8460('0x3a')]){logger[_0x8460('0x36')]('[%s][QUEUE]\x20%s',_0x54b905,_[_0x8460('0x3b')](_0x894c86,_0x8460('0x29'))[_0x8460('0x3c')](',\x20'));_0x2dc3f2[_0x8460('0x3d')]();}else{var _0x3103e5=_[_0x8460('0x3e')](_0xfdcab1[_0x3979cd[_0x8460('0x25')]+_0x8460('0x3f')],handleFindQueue(_0x5b1331[_0x8460('0x2f')]));if(_0x3103e5){startRouting(_0x54b905,_0x3103e5,_0x3979cd,_0xfdcab1);var _0x558073=(_0x3103e5[_0x8460('0x40')]||0xa)*0x3e8;var _0x298c9e=(_0x5b1331['timeout']||0x14)*0x3e8;var _0x2f872c,_0x208395;if(_0x558073>_0x298c9e){_0x298c9e=_0x558073;}var _0x5edf4d=seqqueue['createQueue'](_0x558073);_0x5edf4d['id']=_0x54b905;_0x5edf4d['atimeout']=_0x558073;_0x5edf4d[_0x8460('0x41')]=_0x298c9e;_0x5edf4d[_0x8460('0x25')]=_0x3979cd[_0x8460('0x25')];_0xfdcab1[_0x8460('0x42')][_0x54b905]['on'](_0x8460('0x43'),function(){logger[_0x8460('0x2d')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x54b905);stopRouting(_0x54b905,_0x3103e5,_0x3979cd,_0xfdcab1);clearTimeout(_0x2f872c);_0x2f872c=undefined;_0x5edf4d[_0x8460('0x44')](!![]);if(_0xfdcab1[_0x8460('0x42')][_0x54b905]){delete _0xfdcab1[_0x8460('0x42')][_0x54b905];}_0x2dc3f2['stop']();});_0xfdcab1['rules'][_0x54b905]['on']('complete',function(){if(_0xfdcab1[_0x8460('0x42')][_0x54b905]){delete _0xfdcab1[_0x8460('0x42')][_0x54b905];}});_0x2f872c=setTimeout(function(){logger[_0x8460('0x2d')](_0x8460('0x45'),_0x54b905);endRouting(_0x54b905,_0x3103e5,_0x3979cd,_0xfdcab1);clearTimeout(_0x2f872c);_0x5edf4d[_0x8460('0x44')](!![]);_0x2dc3f2['next']();},_0x298c9e);switch(_0x3103e5[_0x8460('0x46')]){case _0x8460('0x47'):strategy[_0x8460('0x47')](_0x5edf4d,_0x3103e5,_0xfdcab1,_0x3979cd);break;default:strategy[_0x8460('0x48')](_0x5edf4d,_0x3103e5,_0xfdcab1,_0x3979cd);}}else{logger[_0x8460('0x36')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x54b905,_0x5b1331[_0x8460('0x2f')]);_0x2dc3f2[_0x8460('0x3d')]();}}}catch(_0x107665){console[_0x8460('0x49')](_0x107665);logger['error']('[%s][QUEUE]\x20%s',_0x54b905,_0x107665[_0x8460('0x4a')]);_0x2dc3f2[_0x8460('0x3d')]();}};}; \ No newline at end of file +var _0xdaf9=['WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','accepted','update','catch','update\x20queue\x20report','timeout','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','moment','../../../../config/logger','routing','redis','defaults','socket.io-emitter','queue_id','account','queue','from','emit','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId'];(function(_0xdc5b00,_0x293e5c){var _0x4a0cf9=function(_0x1b6667){while(--_0x1b6667){_0xdc5b00['push'](_0xdc5b00['shift']());}};_0x4a0cf9(++_0x293e5c);}(_0xdaf9,0xac));var _0x9daf=function(_0x1bf7c6,_0x3695be){_0x1bf7c6=_0x1bf7c6-0x0;var _0x3f1443=_0xdaf9[_0x1bf7c6];return _0x3f1443;};'use strict';var schema=require(_0x9daf('0x0'));var _=require(_0x9daf('0x1'));var util=require(_0x9daf('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x9daf('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x9daf('0x4'))(_0x9daf('0x5'));var strategy=require('./strategy');config[_0x9daf('0x6')]=_[_0x9daf('0x7')](config[_0x9daf('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x9daf('0x8'))(new Redis(config[_0x9daf('0x6')]));var attributes=['id',_0x9daf('0x9'),_0x9daf('0xa'),_0x9daf('0xb'),_0x9daf('0xc'),'joinAt'];function emit(_0x2abebb,_0x687319,_0x50300d){io['to'](_0x2abebb)[_0x9daf('0xd')](_0x687319,_0x50300d);}function emitChannelQueueInteraction(_0x1ef74e,_0x8c9973,_0x5f0c4a,_0x17f946,_0x58553d,_0x3f18c6,_0x13f83b,_0x2bbc69){var _0x174473=_['clone'](_0x5f0c4a);_0x174473[_0x9daf('0x9')]=_0x2bbc69;_0x174473['queue']=_0x8c9973;_0x174473[_0x9daf('0xa')]=_0x17f946;_0x174473['id']=_0x58553d;if(_0x3f18c6){_0x13f83b[util['format'](_0x9daf('0xe'),_0x1ef74e)][_0x58553d]=_[_0x9daf('0xf')](_0x174473,attributes);}else{delete _0x13f83b[util[_0x9daf('0x10')](_0x9daf('0xe'),_0x1ef74e)][_0x58553d];}emit(util['format'](_0x9daf('0x11'),_0x1ef74e,_0x8c9973),util[_0x9daf('0x10')](_0x9daf('0x12'),_0x1ef74e,_0x3f18c6?'save':_0x9daf('0x13')),_['pick'](_0x174473,attributes));}var rpc={'openchannelQueueReport':require(_0x9daf('0x14')),'mailQueueReport':require(_0x9daf('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x9daf('0x16'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x9daf('0x17')},'timeout':{'type':'number','message':_0x9daf('0x18')}});function startRouting(_0x70317c,_0x2a70f4,_0x563d13,_0x312db3){if(_0x70317c&&_0x2a70f4&&_0x563d13){_0x2a70f4[_0x9daf('0x19')]+=0x1;var _0x1906e5={'uniqueid':_0x70317c,'from':_0x563d13['body']?_0x563d13[_0x9daf('0x1a')][_0x9daf('0xc')]:'','joinAt':moment()[_0x9daf('0x10')](_0x9daf('0x1b')),'ContactId':_0x563d13[_0x9daf('0x1c')]?_0x563d13[_0x9daf('0x1c')]['id']:null,'ListId':_0x563d13[_0x9daf('0x1d')]?_0x563d13[_0x9daf('0x1d')]['id']:null};_0x1906e5[_[_0x9daf('0x1e')](_0x563d13[_0x9daf('0x1f')])+_0x9daf('0x20')]=_0x2a70f4['id']||null;_0x1906e5[_[_0x9daf('0x1e')](_0x563d13[_0x9daf('0x1f')])+_0x9daf('0x21')]=_0x563d13[_0x9daf('0x22')]?_0x563d13[_0x9daf('0x22')]['id']:null;_0x1906e5[_[_0x9daf('0x1e')](_0x563d13[_0x9daf('0x1f')])+_0x9daf('0x23')]=_0x563d13[_0x9daf('0x24')]?_0x563d13[_0x9daf('0x24')]['id']:null;_0x1906e5[_['upperFirst'](_0x563d13[_0x9daf('0x1f')])+(_0x563d13['channel']!=='chat'?_0x9daf('0x25'):_0x9daf('0x26'))]=_0x563d13[_0x9daf('0xa')]?_0x563d13[_0x9daf('0xa')]['id']:null;logger[_0x9daf('0x27')](util[_0x9daf('0x10')](_0x9daf('0x28'),_0x70317c,_0x2a70f4[_0x9daf('0x29')]));emitChannelQueueInteraction(_0x563d13['channel'],_0x2a70f4[_0x9daf('0x29')],_0x1906e5,_0x563d13['account'][_0x9daf('0x29')],_0x563d13[_0x9daf('0x24')]['id'],!![],_0x312db3,_0x2a70f4['id']);if(rpc[_0x563d13[_0x9daf('0x1f')]+_0x9daf('0x2a')]){return rpc[_0x563d13[_0x9daf('0x1f')]+_0x9daf('0x2a')][_0x9daf('0x2b')](_0x1906e5)['catch'](function(_0x28d2e3){logger[_0x9daf('0x2c')]('create\x20queue\x20report');});}}}function stopRouting(_0x4c4edb,_0x1de901,_0x32124a,_0x57806b){if(_0x4c4edb&&_0x1de901){_0x1de901['waiting']-=0x1;var _0x5c04d1={'leaveAt':moment()[_0x9daf('0x10')](_0x9daf('0x1b')),'acceptAt':moment()['format'](_0x9daf('0x1b')),'reason':_0x9daf('0x2d')};logger[_0x9daf('0x27')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x4c4edb,_0x1de901[_0x9daf('0x29')]));emitChannelQueueInteraction(_0x32124a['channel'],_0x1de901[_0x9daf('0x29')],_0x32124a[_0x9daf('0x1a')],_0x32124a[_0x9daf('0xa')][_0x9daf('0x29')],_0x32124a[_0x9daf('0x24')]['id'],![],_0x57806b,_0x1de901['id']);if(rpc[_0x32124a[_0x9daf('0x1f')]+_0x9daf('0x2a')]){return rpc[_0x32124a[_0x9daf('0x1f')]+_0x9daf('0x2a')][_0x9daf('0x2e')](_0x4c4edb,_0x5c04d1)[_0x9daf('0x2f')](function(_0x30e2f2){logger[_0x9daf('0x2c')](_0x9daf('0x30'));});}}}function endRouting(_0x44b0c9,_0x303bbc,_0x4c9a09,_0x5094d0){if(_0x44b0c9&&_0x303bbc){_0x303bbc[_0x9daf('0x19')]-=0x1;var _0x376d91={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x9daf('0x31')};logger['info'](util[_0x9daf('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x44b0c9,_0x303bbc[_0x9daf('0x29')]));emitChannelQueueInteraction(_0x4c9a09[_0x9daf('0x1f')],_0x303bbc[_0x9daf('0x29')],_0x4c9a09[_0x9daf('0x1a')],_0x4c9a09['account'][_0x9daf('0x29')],_0x4c9a09[_0x9daf('0x24')]['id'],![],_0x5094d0);if(rpc[_0x4c9a09['channel']+_0x9daf('0x2a')]){return rpc[_0x4c9a09['channel']+_0x9daf('0x2a')][_0x9daf('0x2e')](_0x44b0c9,_0x376d91)[_0x9daf('0x2f')](function(_0xbb832a){logger[_0x9daf('0x2c')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x381486){return function(_0x284bb8){return _0x284bb8[_0x9daf('0x29')][_0x9daf('0x32')]()===_0x381486[_0x9daf('0x32')]();};}exports[_0x9daf('0x33')]=function(_0x4e7bf5,_0x304072,_0x307ac7,_0x10960c){return function(_0x25a495){try{var _0x1448ae={'name':_0x304072[0x0],'timeout':_0x304072[0x1]};var _0x5c0518=queue[_0x9daf('0x0')](_0x1448ae,{'typecast':!![]});if(_0x5c0518[_0x9daf('0x34')]){logger[_0x9daf('0x2c')](_0x9daf('0x35'),_0x4e7bf5,_[_0x9daf('0x36')](_0x5c0518,_0x9daf('0x24'))['join'](',\x20'));_0x25a495[_0x9daf('0x37')]();}else{var _0x696996=_[_0x9daf('0x38')](_0x307ac7[_0x10960c[_0x9daf('0x1f')]+'Queues'],handleFindQueue(_0x1448ae[_0x9daf('0x29')]));if(_0x696996){startRouting(_0x4e7bf5,_0x696996,_0x10960c,_0x307ac7);var _0x58b86f=(_0x696996['timeout']||0xa)*0x3e8;var _0x1e4e47=(_0x1448ae['timeout']||0x14)*0x3e8;var _0x526f0f,_0x5a1b43;if(_0x58b86f>_0x1e4e47){_0x1e4e47=_0x58b86f;}var _0x361cd5=seqqueue['createQueue'](_0x58b86f);_0x361cd5['id']=_0x4e7bf5;_0x361cd5[_0x9daf('0x39')]=_0x58b86f;_0x361cd5[_0x9daf('0x3a')]=_0x1e4e47;_0x361cd5[_0x9daf('0x1f')]=_0x10960c[_0x9daf('0x1f')];_0x307ac7[_0x9daf('0x3b')][_0x4e7bf5]['on'](_0x9daf('0x3c'),function(){logger[_0x9daf('0x27')](_0x9daf('0x3d'),_0x4e7bf5);stopRouting(_0x4e7bf5,_0x696996,_0x10960c,_0x307ac7);clearTimeout(_0x526f0f);_0x526f0f=undefined;_0x361cd5[_0x9daf('0x3e')](!![]);if(_0x307ac7[_0x9daf('0x3b')][_0x4e7bf5]){delete _0x307ac7[_0x9daf('0x3b')][_0x4e7bf5];}_0x25a495['stop']();});_0x307ac7[_0x9daf('0x3b')][_0x4e7bf5]['on']('complete',function(){if(_0x307ac7['rules'][_0x4e7bf5]){delete _0x307ac7[_0x9daf('0x3b')][_0x4e7bf5];}});_0x526f0f=setTimeout(function(){logger[_0x9daf('0x27')](_0x9daf('0x3f'),_0x4e7bf5);endRouting(_0x4e7bf5,_0x696996,_0x10960c,_0x307ac7);clearTimeout(_0x526f0f);_0x361cd5['close'](!![]);_0x25a495[_0x9daf('0x40')]();},_0x1e4e47);switch(_0x696996[_0x9daf('0x41')]){case _0x9daf('0x42'):strategy[_0x9daf('0x42')](_0x361cd5,_0x696996,_0x307ac7,_0x10960c);break;default:strategy['beepall'](_0x361cd5,_0x696996,_0x307ac7,_0x10960c);}}else{logger[_0x9daf('0x2c')](_0x9daf('0x43'),_0x4e7bf5,_0x1448ae[_0x9daf('0x29')]);_0x25a495[_0x9daf('0x37')]();}}}catch(_0x59e9f9){console[_0x9daf('0x44')](_0x59e9f9);logger[_0x9daf('0x2c')](_0x9daf('0x35'),_0x4e7bf5,_0x59e9f9[_0x9daf('0x45')]);_0x25a495[_0x9daf('0x37')]();}};}; \ 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 fadf7fc..8f86d10 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 _0x2a23=['showNotification','writeLog','RINGING','forcedOwnership','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','handleRun','bind','handleTimeout','timeout','drained','prototype','push','handleDrained','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','busyQueue'];(function(_0x3b681a,_0x5ce177){var _0x3791de=function(_0x21dfe1){while(--_0x21dfe1){_0x3b681a['push'](_0x3b681a['shift']());}};_0x3791de(++_0x5ce177);}(_0x2a23,0x71));var _0x32a2=function(_0x5b57f0,_0x2d83a6){_0x5b57f0=_0x5b57f0-0x0;var _0x336a47=_0x2a23[_0x5b57f0];return _0x336a47;};'use strict';var _=require(_0x32a2('0x0'));var uuid=require(_0x32a2('0x1'));var util=require(_0x32a2('0x2'));var logger=require(_0x32a2('0x3'))('routing');var Agent=function(_0x53f2af,_0xad645d,_0x5af6ae,_0x202495){this[_0x32a2('0x4')]=uuid['v4']();this[_0x32a2('0x5')]=_0x53f2af;this[_0x32a2('0x6')]=_0xad645d;this[_0x32a2('0x7')]=_0x5af6ae;this[_0x32a2('0x8')]=_0x202495;this[_0x32a2('0x5')]['push'](this[_0x32a2('0x9')][_0x32a2('0xa')](this),this[_0x32a2('0xb')][_0x32a2('0xa')](this));this[_0x32a2('0x5')]['on'](_0x32a2('0xc'),this[_0x32a2('0xb')][_0x32a2('0xa')](this));this['squeue']['on'](_0x32a2('0xd'),this['handleDrained']['bind'](this));};Agent[_0x32a2('0xe')][_0x32a2('0xf')]=function(){this[_0x32a2('0x5')][_0x32a2('0xf')](this[_0x32a2('0x9')]['bind'](this),this['handleTimeout'][_0x32a2('0xa')](this));};Agent[_0x32a2('0xe')][_0x32a2('0x10')]=function(){this['handleTimeout'](!![]);};Agent[_0x32a2('0xe')]['handleRun']=function(_0x15846f){logger[_0x32a2('0x11')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x32a2('0x5')]['id'],this[_0x32a2('0x6')]['id']);if(_['isNil'](this[_0x32a2('0x7')]['agents'][this[_0x32a2('0x6')]['id']])){logger[_0x32a2('0x11')](_0x32a2('0x12'),this[_0x32a2('0x5')]['id'],this[_0x32a2('0x6')]['id']);setTimeout(this['push'][_0x32a2('0xa')](this),0x3e8);}else{if(this[_0x32a2('0x8')]['forcedOwnership']||util[_0x32a2('0x13')](this['squeue']['id'],this[_0x32a2('0x7')][_0x32a2('0x14')][this['agent']['id']],this[_0x32a2('0x5')][_0x32a2('0x15')],![])){this[_0x32a2('0x7')]['agents'][this[_0x32a2('0x6')]['id']]['busy']=!![];this['realtime'][_0x32a2('0x14')][this[_0x32a2('0x6')]['id']][_0x32a2('0x16')]=undefined;util[_0x32a2('0x17')](this[_0x32a2('0x4')],this[_0x32a2('0x5')]['id'],this[_0x32a2('0x7')][_0x32a2('0x14')][this[_0x32a2('0x6')]['id']],null,this[_0x32a2('0x8')]);util[_0x32a2('0x18')](this[_0x32a2('0x5')]['id'],this[_0x32a2('0x7')][_0x32a2('0x14')][this['agent']['id']],_0x32a2('0x19')+(this[_0x32a2('0x8')][_0x32a2('0x1a')]?':FORCED':''));}else{logger[_0x32a2('0x11')](_0x32a2('0x1b'),this[_0x32a2('0x5')]['id'],this[_0x32a2('0x6')]['id']);setTimeout(this[_0x32a2('0xf')]['bind'](this),0x3e8);}}};Agent[_0x32a2('0xe')][_0x32a2('0xb')]=function(_0x206a4b){if(_[_0x32a2('0x1c')](this[_0x32a2('0x7')][_0x32a2('0x14')][this[_0x32a2('0x6')]['id']])){return logger['info'](_0x32a2('0x12'),this['squeue']['id'],this[_0x32a2('0x6')]['id']);}else{logger[_0x32a2('0x11')](_0x32a2('0x1d'),this[_0x32a2('0x5')]['id'],this['agent']['id']);util[_0x32a2('0x1e')](this[_0x32a2('0x4')],this[_0x32a2('0x5')]['id'],this[_0x32a2('0x7')][_0x32a2('0x14')][this[_0x32a2('0x6')]['id']],null,this[_0x32a2('0x8')]);this[_0x32a2('0x7')][_0x32a2('0x14')][this[_0x32a2('0x6')]['id']]['busy']=![];this['realtime']['agents'][this[_0x32a2('0x6')]['id']][_0x32a2('0x16')]=undefined;util[_0x32a2('0x18')](this['squeue']['id'],this[_0x32a2('0x7')][_0x32a2('0x14')][this[_0x32a2('0x6')]['id']],_0x206a4b?_0x32a2('0x1f'):_0x32a2('0x20'));}if(!_0x206a4b){setTimeout(this['push'][_0x32a2('0xa')](this),0x3e8);}};function agent(_0x5c0f2e,_0x3b327b,_0x11e483,_0x35d1d2){return new Agent(_0x5c0f2e,_0x3b327b,_0x11e483,_0x35d1d2);}module[_0x32a2('0x21')]=agent; \ No newline at end of file +var _0x74c4=['routing','notificationId','squeue','agent','realtime','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','info','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue','showNotification','RINGING',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','exports','./util','../../../../../config/logger'];(function(_0xa3c5fc,_0x54ee7a){var _0x507e4c=function(_0x195428){while(--_0x195428){_0xa3c5fc['push'](_0xa3c5fc['shift']());}};_0x507e4c(++_0x54ee7a);}(_0x74c4,0x184));var _0x474c=function(_0x912cd6,_0xe62809){_0x912cd6=_0x912cd6-0x0;var _0x4d2e4e=_0x74c4[_0x912cd6];return _0x4d2e4e;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x474c('0x0'));var logger=require(_0x474c('0x1'))(_0x474c('0x2'));var Agent=function(_0x3e074d,_0x58e64e,_0x1d2fcb,_0x36be2c){this[_0x474c('0x3')]=uuid['v4']();this[_0x474c('0x4')]=_0x3e074d;this[_0x474c('0x5')]=_0x58e64e;this[_0x474c('0x6')]=_0x1d2fcb;this[_0x474c('0x2')]=_0x36be2c;this['squeue']['push'](this[_0x474c('0x7')][_0x474c('0x8')](this),this[_0x474c('0x9')][_0x474c('0x8')](this));this[_0x474c('0x4')]['on'](_0x474c('0xa'),this[_0x474c('0x9')][_0x474c('0x8')](this));this['squeue']['on'](_0x474c('0xb'),this[_0x474c('0xc')]['bind'](this));};Agent[_0x474c('0xd')][_0x474c('0xe')]=function(){this[_0x474c('0x4')][_0x474c('0xe')](this[_0x474c('0x7')]['bind'](this),this['handleTimeout'][_0x474c('0x8')](this));};Agent[_0x474c('0xd')]['handleDrained']=function(){this[_0x474c('0x9')](!![]);};Agent[_0x474c('0xd')][_0x474c('0x7')]=function(_0x5d0da3){logger[_0x474c('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x474c('0x4')]['id'],this[_0x474c('0x5')]['id']);if(_[_0x474c('0x10')](this[_0x474c('0x6')][_0x474c('0x11')][this[_0x474c('0x5')]['id']])){logger[_0x474c('0xf')](_0x474c('0x12'),this[_0x474c('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x474c('0xe')][_0x474c('0x8')](this),0x3e8);}else{if(this[_0x474c('0x2')][_0x474c('0x13')]||util['isAgentAvailable'](this[_0x474c('0x4')]['id'],this[_0x474c('0x6')][_0x474c('0x11')][this[_0x474c('0x5')]['id']],this[_0x474c('0x4')][_0x474c('0x14')],![])){this[_0x474c('0x6')][_0x474c('0x11')][this[_0x474c('0x5')]['id']][_0x474c('0x15')]=!![];this['realtime'][_0x474c('0x11')][this[_0x474c('0x5')]['id']][_0x474c('0x16')]=undefined;util[_0x474c('0x17')](this[_0x474c('0x3')],this[_0x474c('0x4')]['id'],this[_0x474c('0x6')][_0x474c('0x11')][this[_0x474c('0x5')]['id']],null,this[_0x474c('0x2')]);util['writeLog'](this['squeue']['id'],this[_0x474c('0x6')]['agents'][this[_0x474c('0x5')]['id']],_0x474c('0x18')+(this[_0x474c('0x2')][_0x474c('0x13')]?_0x474c('0x19'):''));}else{logger[_0x474c('0xf')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x474c('0xe')]['bind'](this),0x3e8);}}};Agent[_0x474c('0xd')]['handleTimeout']=function(_0x15894f){if(_['isNil'](this[_0x474c('0x6')][_0x474c('0x11')][this[_0x474c('0x5')]['id']])){return logger['info'](_0x474c('0x12'),this['squeue']['id'],this[_0x474c('0x5')]['id']);}else{logger[_0x474c('0xf')](_0x474c('0x1a'),this[_0x474c('0x4')]['id'],this['agent']['id']);util[_0x474c('0x1b')](this[_0x474c('0x3')],this[_0x474c('0x4')]['id'],this[_0x474c('0x6')][_0x474c('0x11')][this['agent']['id']],null,this[_0x474c('0x2')]);this['realtime'][_0x474c('0x11')][this[_0x474c('0x5')]['id']][_0x474c('0x15')]=![];this['realtime'][_0x474c('0x11')][this[_0x474c('0x5')]['id']][_0x474c('0x16')]=undefined;util[_0x474c('0x1c')](this[_0x474c('0x4')]['id'],this[_0x474c('0x6')][_0x474c('0x11')][this[_0x474c('0x5')]['id']],_0x15894f?'STOP':'TIMEOUT');}if(!_0x15894f){setTimeout(this[_0x474c('0xe')][_0x474c('0x8')](this),0x3e8);}};function agent(_0x4407d0,_0xdad7b5,_0x25e016,_0x210c59){return new Agent(_0x4407d0,_0xdad7b5,_0x25e016,_0x210c59);}module[_0x474c('0x1d')]=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 e0e2b04..fd81b27 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 _0x8e0f=['push','handleRun','handleTimeout','bind','drained','handleDrained','prototype','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','writeLog','realtime','busyQueue','name','showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','isNil','STOP','TIMEOUT','busy','lodash','uuid','./util','../../../../../config/logger','routing','squeue','queue'];(function(_0x56b47b,_0x1032f5){var _0x561db3=function(_0x45a94c){while(--_0x45a94c){_0x56b47b['push'](_0x56b47b['shift']());}};_0x561db3(++_0x1032f5);}(_0x8e0f,0x12f));var _0xf8e0=function(_0x408a86,_0x39beb1){_0x408a86=_0x408a86-0x0;var _0x522185=_0x8e0f[_0x408a86];return _0x522185;};'use strict';var _=require(_0xf8e0('0x0'));var uuid=require(_0xf8e0('0x1'));var util=require(_0xf8e0('0x2'));var logger=require(_0xf8e0('0x3'))(_0xf8e0('0x4'));var Beepall=function(_0x15a893,_0x2ce589,_0x5e954c,_0x40d121){this['notificationId']=uuid['v4']();this[_0xf8e0('0x5')]=_0x15a893;this[_0xf8e0('0x6')]=_0x2ce589;this['realtime']=_0x5e954c;this[_0xf8e0('0x4')]=_0x40d121;this[_0xf8e0('0x5')][_0xf8e0('0x7')](this[_0xf8e0('0x8')]['bind'](this),this[_0xf8e0('0x9')][_0xf8e0('0xa')](this));this['squeue']['on']('timeout',this[_0xf8e0('0x9')][_0xf8e0('0xa')](this));this[_0xf8e0('0x5')]['on'](_0xf8e0('0xb'),this[_0xf8e0('0xc')][_0xf8e0('0xa')](this));};Beepall[_0xf8e0('0xd')][_0xf8e0('0x7')]=function(){this[_0xf8e0('0x5')]['push'](this[_0xf8e0('0x8')][_0xf8e0('0xa')](this),this[_0xf8e0('0x9')][_0xf8e0('0xa')](this));};Beepall['prototype'][_0xf8e0('0xc')]=function(_0x5e958d){this[_0xf8e0('0x9')](!![]);};Beepall[_0xf8e0('0xd')][_0xf8e0('0x8')]=function(_0x506587){var _0x173f34=!![];if(!_['isNil'](this[_0xf8e0('0x6')])&&!_['isNil'](this[_0xf8e0('0x6')][_0xf8e0('0xe')])&&this[_0xf8e0('0x6')][_0xf8e0('0xe')][_0xf8e0('0xf')]>0x0){for(var _0x49e649=0x0,_0x616054;_0x49e6490x0){for(var _0x437b01=0x0,_0x2994f0;_0x437b010x0&&_0x4f3e0a[_0x58e54b+'CurrentCapacity']>=_0x4f3e0a[_0x58e54b+_0x8eda('0x25')]){writeLog(_0x2dab25,_0x4f3e0a,_0x58e54b['toUpperCase']()+_0x8eda('0x27'));return![];}}return!![];};exports[_0x8eda('0x28')]=function(_0x8337b4,_0x567f69,_0x23e892,_0x244400,_0x1dd12){return sendNotification(!![],_0x8337b4,_0x567f69,_0x23e892,_0x244400,_0x1dd12);};exports['hideNotification']=function(_0x1616ea,_0x11a999,_0x5dd315,_0x27d2ce,_0x29e6f4){return sendNotification(![],_0x1616ea,_0x11a999,_0x5dd315,_0x27d2ce,_0x29e6f4);};exports[_0x8eda('0x29')]=writeLog; \ No newline at end of file +var _0x7c09=['[%s][QUEUE]\x20%s','message','user:%s','notification:%s','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','emit','name','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','error','format'];(function(_0x5978f1,_0x195fbc){var _0x40af2b=function(_0x788834){while(--_0x788834){_0x5978f1['push'](_0x5978f1['shift']());}};_0x40af2b(++_0x195fbc);}(_0x7c09,0x102));var _0x97c0=function(_0x3b4cd3,_0x247874){_0x3b4cd3=_0x3b4cd3-0x0;var _0x4298a8=_0x7c09[_0x3b4cd3];return _0x4298a8;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var utils=require(_0x97c0('0x1'));var Mustache=require('mustache');var Redis=require(_0x97c0('0x2'));var config=require(_0x97c0('0x3'));var logger=require(_0x97c0('0x4'))(_0x97c0('0x5'));config[_0x97c0('0x6')]=_[_0x97c0('0x7')](config[_0x97c0('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x46fdd9,_0x42c6c7,_0x2c19fa){io['to'](_0x46fdd9)[_0x97c0('0x8')](_0x42c6c7,_0x2c19fa);}function sendNotification(_0x293785,_0x57661a,_0x205520,_0x4ac5f1,_0x2d5507,_0x28cac4){io['to'](util['format']('user:%s',_0x4ac5f1[_0x97c0('0x9')]))[_0x97c0('0x8')](_0x97c0('0xa'),_0x4ac5f1);var _0x238ed9=_0x28cac4||{};var _0x346e34=_0x205520[_0x97c0('0xb')]('.');var _0x7fc93={'uniqueid':_0x57661a,'channel':_0x346e34[0x0],'id':_0x346e34[0x1],'title':_0x346e34[0x0]+_0x97c0('0xc'),'interactionId':_0x346e34[0x2],'queue':_0x2d5507?_0x2d5507[_0x97c0('0x9')]:null,'sound':_0x238ed9[_0x97c0('0xd')][_0x97c0('0xe')],'shake':_0x238ed9[_0x97c0('0xd')][_0x97c0('0xf')]};try{if(!_0x238ed9['body']){_0x238ed9[_0x97c0('0x10')]={};}if(_0x2d5507){_0x238ed9[_0x97c0('0x10')][_0x97c0('0x11')]=_0x2d5507;}else if(_0x238ed9['body'][_0x97c0('0x11')]){delete _0x238ed9[_0x97c0('0x10')][_0x97c0('0x11')];}_0x7fc93[_0x97c0('0x12')]=utils[_0x97c0('0x13')](_0x238ed9[_0x97c0('0xd')]['notificationTemplate'],_0x238ed9);}catch(_0x16fea6){_0x7fc93[_0x97c0('0x12')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x97c0('0x14')](util[_0x97c0('0x15')](_0x97c0('0x16'),_0x57661a,_0x16fea6[_0x97c0('0x17')]));}io['to'](util[_0x97c0('0x15')](_0x97c0('0x18'),_0x4ac5f1[_0x97c0('0x9')]))[_0x97c0('0x8')](util[_0x97c0('0x15')](_0x97c0('0x19'),_0x293785?'save':'remove'),_0x7fc93);}function writeLog(_0x2b74a2,_0xa3f59d,_0x169f19){return logger['info'](util[_0x97c0('0x15')](_0x97c0('0x1a'),_0x2b74a2,_0xa3f59d[_0x97c0('0x9')],_0x169f19));}exports[_0x97c0('0x1b')]=function(_0x30fba2,_0x3a0bfb,_0x9dff60,_0x5ac457){if(_0x3a0bfb[_0x97c0('0x1c')]){writeLog(_0x30fba2,_0x3a0bfb,_0x97c0('0x1d'));return![];}if(!_0x3a0bfb[_0x97c0('0x1e')]){writeLog(_0x30fba2,_0x3a0bfb,_0x97c0('0x1f'));return![];}if(_0x3a0bfb[_0x9dff60+'Pause']){writeLog(_0x30fba2,_0x3a0bfb,_0x97c0('0x20'));return![];}if(_0x5ac457&&_0x3a0bfb[_0x97c0('0x21')](_0x9dff60+'Capacity')&&_0x3a0bfb[_0x97c0('0x21')](_0x9dff60+_0x97c0('0x22'))){if(_0x3a0bfb[_0x9dff60+_0x97c0('0x23')]>0x0&&_0x3a0bfb[_0x9dff60+'CurrentCapacity']>=_0x3a0bfb[_0x9dff60+'Capacity']){writeLog(_0x30fba2,_0x3a0bfb,_0x9dff60['toUpperCase']()+_0x97c0('0x24'));return![];}}return!![];};exports[_0x97c0('0x25')]=function(_0x3a744c,_0x225e43,_0x26939e,_0x153b14,_0x4a3645){return sendNotification(!![],_0x3a744c,_0x225e43,_0x26939e,_0x153b14,_0x4a3645);};exports[_0x97c0('0x26')]=function(_0x1c183f,_0x325090,_0x4ad645,_0x14617c,_0x148e95){return sendNotification(![],_0x1c183f,_0x325090,_0x4ad645,_0x14617c,_0x148e95);};exports[_0x97c0('0x27')]=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 3a3f06e..ff9828b 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 _0x0585=['[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','error','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim'];(function(_0xc183d4,_0x1d8e6c){var _0x2e38a8=function(_0x34b7b2){while(--_0x34b7b2){_0xc183d4['push'](_0xc183d4['shift']());}};_0x2e38a8(++_0x1d8e6c);}(_0x0585,0x1ba));var _0x5058=function(_0x6d0e63,_0x245774){_0x6d0e63=_0x6d0e63-0x0;var _0x233650=_0x0585[_0x6d0e63];return _0x233650;};'use strict';var schema=require(_0x5058('0x0'));var sh=require(_0x5058('0x1'));var _=require('lodash');var utils=require(_0x5058('0x2'));var logger=require('../../../../config/logger')(_0x5058('0x3'));var system=schema({'command':{'type':_0x5058('0x4'),'required':!![],'message':_0x5058('0x5')}});exports[_0x5058('0x6')]=function(_0x43f4ed,_0x373feb){return function(_0xcca164){try{var _0x58841b={'command':_0x373feb[0x0]};var _0x3992c9=system[_0x5058('0x0')](_0x58841b,{'typecast':!![]});if(_0x3992c9[_0x5058('0x7')]){logger['error'](_0x5058('0x8'),_0x43f4ed,_[_0x5058('0x9')](_0x3992c9,_0x5058('0xa'))[_0x5058('0xb')](',\x20'));logger[_0x5058('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x43f4ed);_0xcca164[_0x5058('0xd')]();}else{var _0x22d47a=this;var _0x4025f3=utils[_0x5058('0xe')](_0x373feb[0x0],this);logger[_0x5058('0xc')](_0x5058('0xf'),_0x43f4ed,_0x4025f3);sh['exec'](_[_0x5058('0x10')](_0x4025f3),function(_0x3d7845,_0x5503a6){logger[_0x5058('0xc')](_0x5058('0x11'),_0x43f4ed,_0x3d7845);if(_0x3d7845==0x0){var _0x3e21a8=_0x5503a6[_0x5058('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x5058('0x13')](_0x373feb[0x1])||_[_0x5058('0x14')](_0x373feb[0x1])){logger[_0x5058('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x43f4ed);_0x22d47a['body'][_0x373feb[0x1]]=_0x3e21a8;}else{logger[_0x5058('0xc')](_0x5058('0x15'),_0x43f4ed,_0x373feb[0x1],_0x3e21a8);_0x22d47a[_0x5058('0x16')][_0x373feb[0x1]]=_0x3e21a8;}}_0xcca164[_0x5058('0xd')]();});}}catch(_0xeb3584){logger[_0x5058('0x17')](_0x5058('0x8'),_0x43f4ed,_[_0x5058('0x18')](_0xeb3584)?JSON[_0x5058('0x19')](_0xeb3584):_0xeb3584);logger[_0x5058('0xc')](_0x5058('0x1a'),_0x43f4ed);_0xcca164[_0x5058('0xd')]();}};}; \ No newline at end of file +var _0x2f72=['string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing'];(function(_0x589d2f,_0xc49372){var _0x1db27c=function(_0x25d0d3){while(--_0x25d0d3){_0x589d2f['push'](_0x589d2f['shift']());}};_0x1db27c(++_0xc49372);}(_0x2f72,0x166));var _0x22f7=function(_0x41c50c,_0x323841){_0x41c50c=_0x41c50c-0x0;var _0x390d66=_0x2f72[_0x41c50c];return _0x390d66;};'use strict';var schema=require(_0x22f7('0x0'));var sh=require(_0x22f7('0x1'));var _=require(_0x22f7('0x2'));var utils=require(_0x22f7('0x3'));var logger=require(_0x22f7('0x4'))(_0x22f7('0x5'));var system=schema({'command':{'type':_0x22f7('0x6'),'required':!![],'message':_0x22f7('0x7')}});exports['consequence']=function(_0x24a994,_0x18a9ff){return function(_0x45c37b){try{var _0x216f96={'command':_0x18a9ff[0x0]};var _0xd85654=system[_0x22f7('0x0')](_0x216f96,{'typecast':!![]});if(_0xd85654[_0x22f7('0x8')]){logger[_0x22f7('0x9')](_0x22f7('0xa'),_0x24a994,_[_0x22f7('0xb')](_0xd85654,_0x22f7('0xc'))[_0x22f7('0xd')](',\x20'));logger[_0x22f7('0xe')](_0x22f7('0xf'),_0x24a994);_0x45c37b[_0x22f7('0x10')]();}else{var _0x18588e=this;var _0x541f04=utils[_0x22f7('0x11')](_0x18a9ff[0x0],this);logger[_0x22f7('0xe')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x24a994,_0x541f04);sh[_0x22f7('0x12')](_[_0x22f7('0x13')](_0x541f04),function(_0x4e2c06,_0x3fc180){logger['info'](_0x22f7('0x14'),_0x24a994,_0x4e2c06);if(_0x4e2c06==0x0){var _0x2d87bc=_0x3fc180['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x22f7('0x15')](_0x18a9ff[0x1])||_[_0x22f7('0x16')](_0x18a9ff[0x1])){logger[_0x22f7('0xe')](_0x22f7('0x17'),_0x24a994);_0x18588e[_0x22f7('0x18')][_0x18a9ff[0x1]]=_0x2d87bc;}else{logger[_0x22f7('0xe')](_0x22f7('0x19'),_0x24a994,_0x18a9ff[0x1],_0x2d87bc);_0x18588e[_0x22f7('0x18')][_0x18a9ff[0x1]]=_0x2d87bc;}}_0x45c37b[_0x22f7('0x10')]();});}}catch(_0x2f0a74){logger[_0x22f7('0x9')](_0x22f7('0xa'),_0x24a994,_[_0x22f7('0x1a')](_0x2f0a74)?JSON[_0x22f7('0x1b')](_0x2f0a74):_0x2f0a74);logger[_0x22f7('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x24a994);_0x45c37b[_0x22f7('0x10')]();}};}; \ 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 c323d74..1934c03 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 _0x53af=['../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0xdc4d33,_0x1afbfe){var _0xc2afdc=function(_0x30e38c){while(--_0x30e38c){_0xdc4d33['push'](_0xdc4d33['shift']());}};_0xc2afdc(++_0x1afbfe);}(_0x53af,0x1e8));var _0xf53a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x53af[_0x19950b];return _0x3c6b41;};'use strict';var schema=require(_0xf53a('0x0'));var _=require(_0xf53a('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xf53a('0x2')),'smsInteraction':require(_0xf53a('0x3')),'mailInteraction':require(_0xf53a('0x4')),'faxInteraction':require(_0xf53a('0x5')),'whatsappInteraction':require(_0xf53a('0x6'))};var logger=require(_0xf53a('0x7'))('routing');var tag=schema({'tag':{'type':_0xf53a('0x8'),'required':!![],'message':_0xf53a('0x9')}});exports[_0xf53a('0xa')]=function(_0x419dc5,_0x46a691,_0x1595cf,_0x1bbba7){return function(_0x19ecfc){try{var _0x33d92b={'tag':_0x46a691[0x0]};var _0x59591f=tag['validate'](_0x33d92b,{'typecast':!![]});if(_0x59591f[_0xf53a('0xb')]){logger[_0xf53a('0xc')](_0xf53a('0xd'),_0x419dc5,_[_0xf53a('0xe')](_0x59591f,_0xf53a('0xf'))[_0xf53a('0x10')](',\x20'));logger[_0xf53a('0x11')](_0xf53a('0x12'),_0x419dc5);_0x19ecfc[_0xf53a('0x13')]();}else{var _0x23068f={'ids':[_0x46a691[0x0]]};if(rpc[_0x1bbba7[_0xf53a('0x14')]+_0xf53a('0x15')]){rpc[_0x1bbba7[_0xf53a('0x14')]+_0xf53a('0x15')]['addTags'](_0x1bbba7['interaction']['id'],_0x23068f)['then'](function(_0x5d5c22){logger[_0xf53a('0x11')](_0xf53a('0x16'),_0x419dc5,_0x46a691[0x1],_0x1bbba7[_0xf53a('0x14')],_0x1bbba7[_0xf53a('0x17')]['id']);})[_0xf53a('0x18')](function(_0x229279){logger[_0xf53a('0xc')]('[%s][TAG]\x20%s',_0x419dc5,JSON[_0xf53a('0x19')](_0x229279));logger[_0xf53a('0x11')](_0xf53a('0x12'),_0x419dc5);})['finally'](function(){_0x19ecfc['next']();});}}}catch(_0x28705e){logger[_0xf53a('0xc')](_0xf53a('0xd'),_0x419dc5,_['isObject'](_0x28705e)?JSON[_0xf53a('0x19')](_0x28705e):_0x28705e);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x419dc5);_0x19ecfc['next']();}};}; \ No newline at end of file +var _0xa6f1=['then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','join','info','Interaction','interaction'];(function(_0xaaa478,_0x47f7d1){var _0x3d4c49=function(_0x8a4e10){while(--_0x8a4e10){_0xaaa478['push'](_0xaaa478['shift']());}};_0x3d4c49(++_0x47f7d1);}(_0xa6f1,0xb7));var _0x1a6f=function(_0x2472a6,_0x5f2d82){_0x2472a6=_0x2472a6-0x0;var _0x5c04b9=_0xa6f1[_0x2472a6];return _0x5c04b9;};'use strict';var schema=require(_0x1a6f('0x0'));var _=require(_0x1a6f('0x1'));var rpc={'chatInteraction':require(_0x1a6f('0x2')),'openchannelInteraction':require(_0x1a6f('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x1a6f('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x1a6f('0x5'))(_0x1a6f('0x6'));var tag=schema({'tag':{'type':_0x1a6f('0x7'),'required':!![],'message':_0x1a6f('0x8')}});exports[_0x1a6f('0x9')]=function(_0x168a00,_0x180cec,_0x58746e,_0x38b2b6){return function(_0x148e47){try{var _0x3d6766={'tag':_0x180cec[0x0]};var _0x104ccd=tag[_0x1a6f('0x0')](_0x3d6766,{'typecast':!![]});if(_0x104ccd['length']){logger[_0x1a6f('0xa')](_0x1a6f('0xb'),_0x168a00,_[_0x1a6f('0xc')](_0x104ccd,'message')[_0x1a6f('0xd')](',\x20'));logger[_0x1a6f('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x168a00);_0x148e47['next']();}else{var _0x3732c8={'ids':[_0x180cec[0x0]]};if(rpc[_0x38b2b6['channel']+_0x1a6f('0xf')]){rpc[_0x38b2b6['channel']+_0x1a6f('0xf')]['addTags'](_0x38b2b6[_0x1a6f('0x10')]['id'],_0x3732c8)[_0x1a6f('0x11')](function(_0x176b0f){logger[_0x1a6f('0xe')](_0x1a6f('0x12'),_0x168a00,_0x180cec[0x1],_0x38b2b6[_0x1a6f('0x13')],_0x38b2b6[_0x1a6f('0x10')]['id']);})[_0x1a6f('0x14')](function(_0x378cea){logger[_0x1a6f('0xa')]('[%s][TAG]\x20%s',_0x168a00,JSON[_0x1a6f('0x15')](_0x378cea));logger[_0x1a6f('0xe')](_0x1a6f('0x16'),_0x168a00);})[_0x1a6f('0x17')](function(){_0x148e47[_0x1a6f('0x18')]();});}}}catch(_0xb3cb18){logger[_0x1a6f('0xa')](_0x1a6f('0xb'),_0x168a00,_['isObject'](_0xb3cb18)?JSON[_0x1a6f('0x15')](_0xb3cb18):_0xb3cb18);logger[_0x1a6f('0xe')](_0x1a6f('0x16'),_0x168a00);_0x148e47[_0x1a6f('0x18')]();}};}; \ 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 57ed138..ad92db6 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x368116,_0xcd35ab){var _0x2af10a=function(_0x4a3c6b){while(--_0x4a3c6b){_0x368116['push'](_0x368116['shift']());}};_0x2af10a(++_0xcd35ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x494df7,_0x14d1a){var _0x534498=function(_0x3b5369){while(--_0x3b5369){_0x494df7['push'](_0x494df7['shift']());}};_0x534498(++_0x14d1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 7668cfe..811f3e7 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 _0x0c5d=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','message','interaction','applications','isArray','length','existsSync','join','app','.js','appdata','split','channel','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','format','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','No\x20applications\x20to\x20execute','error','stack','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues'];(function(_0xad3841,_0x5b60ba){var _0x5366bc=function(_0x236ba6){while(--_0x236ba6){_0xad3841['push'](_0xad3841['shift']());}};_0x5366bc(++_0x5b60ba);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x2418b5,_0x4e599b){_0x2418b5=_0x2418b5-0x0;var _0x45a3d0=_0x0c5d[_0x2418b5];return _0x45a3d0;};'use strict';var _=require(_0xd0c5('0x0'));var util=require(_0xd0c5('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0xd0c5('0x2'));var BPromise=require('bluebird');var uuid=require(_0xd0c5('0x3'));var config=require(_0xd0c5('0x4'));var logger=require(_0xd0c5('0x5'))(_0xd0c5('0x6'));var rpc={'openchannelQueueReport':require(_0xd0c5('0x7')),'mailQueueReport':require(_0xd0c5('0x8')),'chatQueueReport':require(_0xd0c5('0x9')),'smsQueueReport':require(_0xd0c5('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xd0c5('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x47f0f4,_0x365e04,_0x4be307){return util['format'](_0xd0c5('0xc'),_0x47f0f4,_0x365e04||0x0,_0x4be307||0x0);}function getIntervals(_0x227cb7,_0x50ed33){var _0x33a77b=[];if(!_[_0xd0c5('0xd')](_0x50ed33['IntervalId'])&&!_[_0xd0c5('0xd')](_0x227cb7[_0x50ed33[_0xd0c5('0xe')]])&&!_[_0xd0c5('0xd')](_0x227cb7[_0x50ed33[_0xd0c5('0xe')]][_0xd0c5('0xf')])){_0x33a77b=_[_0xd0c5('0x10')](_0x227cb7[_0x50ed33[_0xd0c5('0xe')]][_0xd0c5('0xf')],_0xd0c5('0x11'));}else if(!_[_0xd0c5('0xd')](_0x50ed33[_0xd0c5('0x11')])){_0x33a77b=[_0x50ed33[_0xd0c5('0x11')]];}return _0x33a77b;}exports['listen']=function(_0x11511d){_0x11511d[_0xd0c5('0x12')]={};return new BPromise(function(_0x1fc98d,_0x408e02){var _0x553c38={'Start':function(_0x280e22){var _0x23d941=this;return new Promise(function(_0x242615,_0x639e72){if(_0x280e22){try{var _0x556487=[];var _0x2be13d=getId(_0x280e22['channel'],_0x280e22[_0xd0c5('0x13')]?_0x280e22['message']['id']:0x0,_0x280e22[_0xd0c5('0x14')]?_0x280e22[_0xd0c5('0x14')]['id']:0x0);if(_0x280e22[_0xd0c5('0x15')]&&_[_0xd0c5('0x16')](_0x280e22[_0xd0c5('0x15')])&&_0x280e22[_0xd0c5('0x15')][_0xd0c5('0x17')]){for(var _0x287961=0x0;_0x287961<_0x280e22['applications'][_0xd0c5('0x17')];_0x287961+=0x1){var _0x2cd03c=_0x280e22['applications'][_0x287961];if(fs[_0xd0c5('0x18')](path[_0xd0c5('0x19')](__dirname,_0xd0c5('0x15'),_0x2cd03c[_0xd0c5('0x1a')]+_0xd0c5('0x1b')))){var _0x3f0b74=[];switch(_0x2cd03c[_0xd0c5('0x1a')]['toLowerCase']()){case'autoreply':var _0x25fd73=_0x2cd03c[_0xd0c5('0x1c')][_0xd0c5('0x1d')](',');if(_0x280e22[_0xd0c5('0x1e')]==='mail'){_0x3f0b74[_0xd0c5('0x1f')](_0x25fd73[0x0]);_0x3f0b74['push'](_0x25fd73[0x1]);_0x3f0b74['push'](_0x25fd73[_0xd0c5('0x20')](0x2,_0x25fd73[_0xd0c5('0x17')])[_0xd0c5('0x19')](','));}else{_0x3f0b74[_0xd0c5('0x1f')](_0x25fd73[0x0]);_0x3f0b74[_0xd0c5('0x1f')](_0x25fd73[_0xd0c5('0x20')](0x1,_0x25fd73[_0xd0c5('0x17')])[_0xd0c5('0x19')](','));}break;case _0xd0c5('0x21'):var _0x198e39=_0x2cd03c[_0xd0c5('0x1c')][_0xd0c5('0x1d')](',');_0x3f0b74[_0xd0c5('0x1f')](_0x198e39[0x0]);_0x3f0b74[_0xd0c5('0x1f')](_0x198e39[0x1]);_0x3f0b74[_0xd0c5('0x1f')](_0x198e39[_0xd0c5('0x20')](0x2,_0x198e39[_0xd0c5('0x17')])['join'](','));break;case _0xd0c5('0x22'):var _0x36415f=_0x2cd03c[_0xd0c5('0x1c')][_0xd0c5('0x1d')](',');_0x3f0b74[_0xd0c5('0x1f')](_0x36415f[0x0]);_0x3f0b74[_0xd0c5('0x1f')](_0x36415f[0x1]);_0x3f0b74[_0xd0c5('0x1f')](_0x36415f[0x2]);_0x3f0b74['push'](_0x36415f[0x3]);_0x3f0b74[_0xd0c5('0x1f')](_0x36415f['slice'](0x4,_0x36415f[_0xd0c5('0x17')])[_0xd0c5('0x19')](','));break;case _0xd0c5('0x23'):var _0x3799c7=_0x2cd03c[_0xd0c5('0x1c')][_0xd0c5('0x1d')](',');_0x3f0b74[_0xd0c5('0x1f')](_0x3799c7[0x0]);_0x3f0b74['push'](_0x3799c7[0x1]);_0x3f0b74['push'](_0x3799c7[0x2]);_0x3f0b74[_0xd0c5('0x1f')](_0x3799c7[0x3]);_0x3f0b74['push'](_0x3799c7[_0xd0c5('0x20')](0x4,_0x3799c7[_0xd0c5('0x17')])[_0xd0c5('0x19')](','));break;case _0xd0c5('0x13'):_0x3f0b74['push'](_0x2cd03c[_0xd0c5('0x1c')]);break;case _0xd0c5('0x24'):_0x3f0b74['push'](_0x2cd03c[_0xd0c5('0x25')]);_0x3f0b74['push'](_0x2cd03c[_0xd0c5('0x1c')]);break;default:_0x3f0b74=_[_0xd0c5('0xd')](_0x2cd03c[_0xd0c5('0x1c')])?[]:_0x2cd03c['appdata'][_0xd0c5('0x1d')](',');}var _0x263d3b={'id':util[_0xd0c5('0x26')](_0xd0c5('0x27'),_0x2be13d,_0x2cd03c['id'],_0x2cd03c[_0xd0c5('0x1a')]),'condition':require(_0xd0c5('0x28'))[_0xd0c5('0x29')](_0x2be13d,getIntervals(_0x11511d[_0xd0c5('0x2a')],_0x2cd03c),_0x11511d),'consequence':require(_0xd0c5('0x2b')+_0x2cd03c[_0xd0c5('0x1a')])[_0xd0c5('0x2c')](_0x2be13d,_0x3f0b74,_0x11511d,_0x280e22),'p':_0x2cd03c[_0xd0c5('0x2d')]||0x0};logger[_0xd0c5('0x2e')]('Push\x20new\x20rule',_0x263d3b['id'],'on\x20interval',getIntervals(_0x11511d[_0xd0c5('0x2a')],_0x2cd03c)['join'](_0xd0c5('0x2f')));_0x556487[_0xd0c5('0x1f')](_0x263d3b);}else{logger['error'](_0xd0c5('0x30'),path[_0xd0c5('0x19')](__dirname,'applications',_0x2cd03c[_0xd0c5('0x1a')]+_0xd0c5('0x1b')));}}_0x11511d[_0xd0c5('0x12')][_0x2be13d]=new RuleEngine(_0x556487);_0x11511d[_0xd0c5('0x12')][_0x2be13d][_0xd0c5('0x31')](_0x280e22,function(_0x9e4a1c){logger[_0xd0c5('0x2e')](_0xd0c5('0x32'),JSON[_0xd0c5('0x33')](_0x9e4a1c[_0xd0c5('0x34')]));if(_0x11511d[_0xd0c5('0x12')][_0x2be13d]){_0x11511d[_0xd0c5('0x12')][_0x2be13d][_0xd0c5('0x35')]('complete');}});return _0x242615({'code':0xc8,'message':_0x280e22});}else{logger[_0xd0c5('0x2e')](_0xd0c5('0x36'));return _0x242615({'code':0xc8,'message':_0x280e22});}}catch(_0x215048){logger[_0xd0c5('0x37')](_0x215048[_0xd0c5('0x38')]);return _0x639e72(_0x23d941['error'](0x1f4,_0x215048));}}return _0x639e72('routing\x20is\x20empty');});},'AcceptMessage':function(_0x13db1a){var _0x2c51c1=this;return new Promise(function(_0xfdffaa,_0x35d9c3){if(_0x13db1a['agent']&&_0x13db1a[_0xd0c5('0x39')]['id']){if(_0x11511d[_0xd0c5('0x3a')][_0x13db1a[_0xd0c5('0x39')]['id']]){_0x11511d[_0xd0c5('0x3a')][_0x13db1a[_0xd0c5('0x39')]['id']][_0xd0c5('0x3b')]=![];_0x11511d[_0xd0c5('0x3a')][_0x13db1a['agent']['id']][_0xd0c5('0x3c')]=undefined;}}if(_0x13db1a[_0xd0c5('0x13')]&&_0x13db1a['message']['id']){try{var _0x26dd8a=getId(_0x13db1a[_0xd0c5('0x1e')],_0x13db1a[_0xd0c5('0x13')]?_0x13db1a['message']['id']:0x0,_0x13db1a['interaction']?_0x13db1a['interaction']['id']:0x0);if(_0x11511d['rules'][_0x26dd8a]){_0x11511d[_0xd0c5('0x12')][_0x26dd8a]['emit'](_0xd0c5('0x3d'));if(rpc[_0x13db1a['channel']+_0xd0c5('0x3e')]){rpc[_0x13db1a['channel']+_0xd0c5('0x3e')][_0xd0c5('0x3f')](_0x26dd8a,{'UserId':_0x13db1a[_0xd0c5('0x13')][_0xd0c5('0x40')]})[_0xd0c5('0x41')](function(_0x560d35){logger[_0xd0c5('0x37')](_0xd0c5('0x42'));});}}return _0xfdffaa({'code':0xc8,'message':_0x13db1a});}catch(_0xb240b6){logger[_0xd0c5('0x37')](_0xb240b6[_0xd0c5('0x38')]);return _0x35d9c3(_0x2c51c1[_0xd0c5('0x37')](0x1f4,_0xb240b6));}}logger['error'](_0xd0c5('0x43'));return _0x35d9c3(_0x2c51c1[_0xd0c5('0x37')](0x1f4,_0xd0c5('0x43')));});},'RejectMessage':function(_0x38324c){var _0x5b935c=this;return new Promise(function(_0x3616b6,_0x1b1b26){if(_0x38324c[_0xd0c5('0x39')]&&_0x38324c[_0xd0c5('0x39')]['id']){try{if(_0x11511d[_0xd0c5('0x3a')][_0x38324c[_0xd0c5('0x39')]['id']]){_0x11511d[_0xd0c5('0x3a')][_0x38324c[_0xd0c5('0x39')]['id']][_0xd0c5('0x3b')]=![];_0x11511d[_0xd0c5('0x3a')][_0x38324c[_0xd0c5('0x39')]['id']][_0xd0c5('0x3c')]=undefined;}return _0x3616b6({'code':0xc8,'message':_0x38324c});}catch(_0x592ff6){logger['error'](_0x592ff6[_0xd0c5('0x38')]);return _0x1b1b26(_0x5b935c[_0xd0c5('0x37')](0x1f4,_0x592ff6));}}logger[_0xd0c5('0x37')](_0xd0c5('0x43'));return _0x1b1b26(_0x5b935c[_0xd0c5('0x37')](0x1f4,_0xd0c5('0x43')));});},'AbandonInteraction':function(_0x5bf9bb){var _0x208334=this;return new Promise(function(_0x2c2485,_0x1f7d24){if(_0x5bf9bb[_0xd0c5('0x1e')]&&_0x5bf9bb[_0xd0c5('0x14')]&&_0x5bf9bb[_0xd0c5('0x14')]['id']){try{var _0x3441eb=getId(_0x5bf9bb[_0xd0c5('0x1e')],_0x5bf9bb[_0xd0c5('0x13')]?_0x5bf9bb[_0xd0c5('0x13')]['id']:0x0,_0x5bf9bb[_0xd0c5('0x14')]?_0x5bf9bb[_0xd0c5('0x14')]['id']:0x0);if(_0x11511d[_0xd0c5('0x12')][_0x3441eb]){_0x11511d['rules'][_0x3441eb][_0xd0c5('0x35')](_0xd0c5('0x3d'));}return _0x2c2485({'code':0xc8,'message':_0x5bf9bb});}catch(_0x5b929e){logger[_0xd0c5('0x37')](_0x5b929e['stack']);return _0x1f7d24(_0x208334['error'](0x1f4,_0x5b929e));}}logger[_0xd0c5('0x37')](_0xd0c5('0x43'));return _0x1f7d24(_0x208334[_0xd0c5('0x37')](0x1f4,_0xd0c5('0x43')));});},'AgentCapacity':function(_0x4243ad){var _0x10e938=this;return new Promise(function(_0x23fcd6,_0x1924a4){if(_0x11511d[_0xd0c5('0x3a')][_0xd0c5('0x44')](_0x4243ad['id'])){for(var _0x1b25e0 in _0x4243ad[_0xd0c5('0x45')]){if(_0x4243ad[_0xd0c5('0x45')][_0xd0c5('0x44')](_0x1b25e0)){if(_0x11511d[_0xd0c5('0x3a')][_0x4243ad['id']][_0xd0c5('0x44')](_0x1b25e0+_0xd0c5('0x46'))){_0x11511d['agents'][_0x4243ad['id']][_0x1b25e0+'CurrentCapacity']=parseInt(_0x4243ad[_0xd0c5('0x45')][_0x1b25e0],0xa);}}}_0x11511d[_0xd0c5('0x3a')][_0x4243ad['id']]['updateRealtime']();return _0x23fcd6({'code':0xc8,'message':_0x11511d['agents'][_0x4243ad['id']]});}else{return _0x1924a4(_0x10e938[_0xd0c5('0x37')](0x1f4,_0xd0c5('0x47')));}});},'Agents':function(_0x3a5bf9){return new Promise(function(_0x164646,_0x268fb0){var _0x2890b7=_[_0xd0c5('0x48')](_0x11511d[_0xd0c5('0x3a')]);_0x164646({'count':_0x2890b7[_0xd0c5('0x17')],'rows':_0x2890b7});});},'ChatQueues':function(_0x54b571){return new Promise(function(_0x20b422,_0x2141c1){var _0x4ec681=[];for(var _0x1330a5 in _0x11511d['chatQueues']){if(_0x11511d[_0xd0c5('0x49')]['hasOwnProperty'](_0x1330a5)){var _0x2e8b0d=_0x11511d['chatQueues'][_0x1330a5];var _0x261e81={'id':_0x2e8b0d['id'],'available':_0x2e8b0d[_0xd0c5('0x4a')],'loggedIn':_0x2e8b0d[_0xd0c5('0x4b')],'name':_0x2e8b0d[_0xd0c5('0x4c')],'paused':_0x2e8b0d[_0xd0c5('0x4d')],'waiting':_0x2e8b0d[_0xd0c5('0x4e')]};_0x4ec681[_0xd0c5('0x1f')](_0x261e81);}}_0x20b422({'count':_0x4ec681[_0xd0c5('0x17')],'rows':_0x4ec681});});},'MailQueues':function(_0x6b4081){return new Promise(function(_0x3b7ac2,_0x1eb9d1){var _0x3c7e4b=[];for(var _0x5599cf in _0x11511d[_0xd0c5('0x4f')]){if(_0x11511d['mailQueues'][_0xd0c5('0x44')](_0x5599cf)){var _0x37e731=_0x11511d['mailQueues'][_0x5599cf];var _0x35287f={'id':_0x37e731['id'],'available':_0x37e731[_0xd0c5('0x4a')],'loggedIn':_0x37e731[_0xd0c5('0x4b')],'name':_0x37e731[_0xd0c5('0x4c')],'paused':_0x37e731[_0xd0c5('0x4d')],'waiting':_0x37e731[_0xd0c5('0x4e')]};_0x3c7e4b['push'](_0x35287f);}}_0x3b7ac2({'count':_0x3c7e4b[_0xd0c5('0x17')],'rows':_0x3c7e4b});});},'OpenchannelQueues':function(_0x269a24){return new Promise(function(_0x12f8ad,_0x22815a){var _0x5c170d=[];for(var _0x3440db in _0x11511d[_0xd0c5('0x50')]){if(_0x11511d[_0xd0c5('0x50')][_0xd0c5('0x44')](_0x3440db)){var _0x19b799=_0x11511d[_0xd0c5('0x50')][_0x3440db];var _0x2b5558={'id':_0x19b799['id'],'available':_0x19b799[_0xd0c5('0x4a')],'loggedIn':_0x19b799[_0xd0c5('0x4b')],'name':_0x19b799[_0xd0c5('0x4c')],'paused':_0x19b799['paused'],'waiting':_0x19b799[_0xd0c5('0x4e')]};_0x5c170d[_0xd0c5('0x1f')](_0x2b5558);}}_0x12f8ad({'count':_0x5c170d[_0xd0c5('0x17')],'rows':_0x5c170d});});},'SmsQueues':function(_0x427461){return new Promise(function(_0x383e7c,_0xed6cca){var _0x4ebf38=[];for(var _0x1f002c in _0x11511d['smsQueues']){if(_0x11511d[_0xd0c5('0x51')][_0xd0c5('0x44')](_0x1f002c)){var _0x38ee47=_0x11511d[_0xd0c5('0x51')][_0x1f002c];var _0x14b90f={'id':_0x38ee47['id'],'available':_0x38ee47['available'],'loggedIn':_0x38ee47['loggedIn'],'name':_0x38ee47[_0xd0c5('0x4c')],'paused':_0x38ee47[_0xd0c5('0x4d')],'waiting':_0x38ee47[_0xd0c5('0x4e')]};_0x4ebf38[_0xd0c5('0x1f')](_0x14b90f);}}_0x383e7c({'count':_0x4ebf38[_0xd0c5('0x17')],'rows':_0x4ebf38});});},'FaxQueues':function(_0x313a4c){return new Promise(function(_0x7d38d7,_0x381362){var _0x3d4f41=[];for(var _0x7dd009 in _0x11511d[_0xd0c5('0x52')]){if(_0x11511d[_0xd0c5('0x52')][_0xd0c5('0x44')](_0x7dd009)){var _0x1543fe=_0x11511d[_0xd0c5('0x52')][_0x7dd009];var _0x18ecc4={'id':_0x1543fe['id'],'available':_0x1543fe[_0xd0c5('0x4a')],'loggedIn':_0x1543fe['loggedIn'],'name':_0x1543fe[_0xd0c5('0x4c')],'paused':_0x1543fe['paused'],'waiting':_0x1543fe[_0xd0c5('0x4e')]};_0x3d4f41[_0xd0c5('0x1f')](_0x18ecc4);}}_0x7d38d7({'count':_0x3d4f41['length'],'rows':_0x3d4f41});});},'WhatsappQueues':function(_0x24f21b){return new Promise(function(_0x3d4785,_0xaabd2f){var _0x3a52d2=[];for(var _0x3af153 in _0x11511d[_0xd0c5('0x53')]){if(_0x11511d[_0xd0c5('0x53')][_0xd0c5('0x44')](_0x3af153)){var _0x33314e=_0x11511d['whatsappQueues'][_0x3af153];var _0x51a1e2={'id':_0x33314e['id'],'available':_0x33314e[_0xd0c5('0x4a')],'loggedIn':_0x33314e['loggedIn'],'name':_0x33314e['name'],'paused':_0x33314e[_0xd0c5('0x4d')],'waiting':_0x33314e[_0xd0c5('0x4e')]};_0x3a52d2[_0xd0c5('0x1f')](_0x51a1e2);}}_0x3d4785({'count':_0x3a52d2[_0xd0c5('0x17')],'rows':_0x3a52d2});});},'ChatQueuesWaitingInteractions':function(_0x3b64ae){return new Promise(function(_0x51910f,_0x5873e4){var _0x25c918=_[_0xd0c5('0x48')](_0x11511d[_0xd0c5('0x54')]);_0x51910f({'count':_0x25c918[_0xd0c5('0x17')],'rows':_0x25c918});});},'MailQueuesWaitingInteractions':function(_0x1eeb74){return new Promise(function(_0x3eecb6,_0x3cd5ff){var _0x4e1fa9=_[_0xd0c5('0x48')](_0x11511d[_0xd0c5('0x55')]);_0x3eecb6({'count':_0x4e1fa9[_0xd0c5('0x17')],'rows':_0x4e1fa9});});},'OpenchannelQueuesWaitingInteractions':function(_0x34107b){return new Promise(function(_0x554ddf,_0x403987){var _0x5cf467=_[_0xd0c5('0x48')](_0x11511d[_0xd0c5('0x56')]);_0x554ddf({'count':_0x5cf467[_0xd0c5('0x17')],'rows':_0x5cf467});});},'SmsQueuesWaitingInteractions':function(_0x3595f3){return new Promise(function(_0x235818,_0x4c997f){var _0x2529b0=_[_0xd0c5('0x48')](_0x11511d[_0xd0c5('0x57')]);_0x235818({'count':_0x2529b0[_0xd0c5('0x17')],'rows':_0x2529b0});});},'FaxQueuesWaitingInteractions':function(_0x1d0db1){return new Promise(function(_0x141104,_0x5ab587){var _0x3fe4f5=_['values'](_0x11511d[_0xd0c5('0x58')]);_0x141104({'count':_0x3fe4f5[_0xd0c5('0x17')],'rows':_0x3fe4f5});});},'WhatsappQueuesWaitingInteractions':function(_0x464989){return new Promise(function(_0x97b101,_0x1ed824){var _0x37c6b8=_[_0xd0c5('0x48')](_0x11511d[_0xd0c5('0x59')]);_0x97b101({'count':_0x37c6b8['length'],'rows':_0x37c6b8});});}};var _0x3aaa55=jayson['server'](_0x553c38)[_0xd0c5('0x5a')]();_0x3aaa55['on'](_0xd0c5('0x37'),function(_0x351ba1){logger[_0xd0c5('0x37')](JSON[_0xd0c5('0x33')](_0x351ba1));return _0x408e02(_0x351ba1);});_0x3aaa55[_0xd0c5('0x5b')](0x232c,_0xd0c5('0x5c'),function(){console[_0xd0c5('0x5d')](_0xd0c5('0x5e'),0x232c);return _0x1fc98d('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xd3dd=['interval','listen','rules','channel','message','interaction','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','intervals','./applications/','consequence','priority','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','info','Applications\x20executed','stringify','matchPath','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','emit','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','busyQueue','message\x20is\x20empty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','hasOwnProperty','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map'];(function(_0x44334a,_0x181bce){var _0x20a140=function(_0x7ee785){while(--_0x7ee785){_0x44334a['push'](_0x44334a['shift']());}};_0x20a140(++_0x181bce);}(_0xd3dd,0x108));var _0xdd3d=function(_0x2d4eb7,_0x1270c9){_0x2d4eb7=_0x2d4eb7-0x0;var _0x297a78=_0xd3dd[_0x2d4eb7];return _0x297a78;};'use strict';var _=require('lodash');var util=require(_0xdd3d('0x0'));var path=require(_0xdd3d('0x1'));var fs=require('fs');var jayson=require(_0xdd3d('0x2'));var BPromise=require(_0xdd3d('0x3'));var uuid=require(_0xdd3d('0x4'));var config=require(_0xdd3d('0x5'));var logger=require(_0xdd3d('0x6'))(_0xdd3d('0x7'));var rpc={'openchannelQueueReport':require(_0xdd3d('0x8')),'mailQueueReport':require(_0xdd3d('0x9')),'chatQueueReport':require(_0xdd3d('0xa')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xdd3d('0xb')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x1f441a,_0x59aae6,_0x3c95d3){return util[_0xdd3d('0xc')](_0xdd3d('0xd'),_0x1f441a,_0x59aae6||0x0,_0x3c95d3||0x0);}function getIntervals(_0x10153b,_0x22fcfe){var _0x418e1a=[];if(!_[_0xdd3d('0xe')](_0x22fcfe[_0xdd3d('0xf')])&&!_[_0xdd3d('0xe')](_0x10153b[_0x22fcfe[_0xdd3d('0xf')]])&&!_[_0xdd3d('0xe')](_0x10153b[_0x22fcfe[_0xdd3d('0xf')]][_0xdd3d('0x10')])){_0x418e1a=_[_0xdd3d('0x11')](_0x10153b[_0x22fcfe[_0xdd3d('0xf')]][_0xdd3d('0x10')],'interval');}else if(!_[_0xdd3d('0xe')](_0x22fcfe[_0xdd3d('0x12')])){_0x418e1a=[_0x22fcfe[_0xdd3d('0x12')]];}return _0x418e1a;}exports[_0xdd3d('0x13')]=function(_0x2208f7){_0x2208f7[_0xdd3d('0x14')]={};return new BPromise(function(_0x2fa216,_0x55f85d){var _0x82fd1e={'Start':function(_0x5bac63){var _0x372fc3=this;return new Promise(function(_0x95b569,_0x4b1bda){if(_0x5bac63){try{var _0x250f43=[];var _0x2713c4=getId(_0x5bac63[_0xdd3d('0x15')],_0x5bac63['message']?_0x5bac63[_0xdd3d('0x16')]['id']:0x0,_0x5bac63[_0xdd3d('0x17')]?_0x5bac63[_0xdd3d('0x17')]['id']:0x0);if(_0x5bac63['applications']&&_[_0xdd3d('0x18')](_0x5bac63[_0xdd3d('0x19')])&&_0x5bac63['applications'][_0xdd3d('0x1a')]){for(var _0x3bafbe=0x0;_0x3bafbe<_0x5bac63[_0xdd3d('0x19')][_0xdd3d('0x1a')];_0x3bafbe+=0x1){var _0x182212=_0x5bac63['applications'][_0x3bafbe];if(fs[_0xdd3d('0x1b')](path[_0xdd3d('0x1c')](__dirname,_0xdd3d('0x19'),_0x182212[_0xdd3d('0x1d')]+_0xdd3d('0x1e')))){var _0x4e21e7=[];switch(_0x182212[_0xdd3d('0x1d')][_0xdd3d('0x1f')]()){case _0xdd3d('0x20'):var _0x4308ca=_0x182212[_0xdd3d('0x21')][_0xdd3d('0x22')](',');if(_0x5bac63[_0xdd3d('0x15')]===_0xdd3d('0x23')){_0x4e21e7[_0xdd3d('0x24')](_0x4308ca[0x0]);_0x4e21e7['push'](_0x4308ca[0x1]);_0x4e21e7[_0xdd3d('0x24')](_0x4308ca['slice'](0x2,_0x4308ca[_0xdd3d('0x1a')])[_0xdd3d('0x1c')](','));}else{_0x4e21e7[_0xdd3d('0x24')](_0x4308ca[0x0]);_0x4e21e7[_0xdd3d('0x24')](_0x4308ca[_0xdd3d('0x25')](0x1,_0x4308ca[_0xdd3d('0x1a')])[_0xdd3d('0x1c')](','));}break;case'dialogflow':var _0x2dccad=_0x182212['appdata'][_0xdd3d('0x22')](',');_0x4e21e7[_0xdd3d('0x24')](_0x2dccad[0x0]);_0x4e21e7[_0xdd3d('0x24')](_0x2dccad[0x1]);_0x4e21e7['push'](_0x2dccad[_0xdd3d('0x25')](0x2,_0x2dccad[_0xdd3d('0x1a')])[_0xdd3d('0x1c')](','));break;case _0xdd3d('0x26'):var _0x436142=_0x182212[_0xdd3d('0x21')][_0xdd3d('0x22')](',');_0x4e21e7[_0xdd3d('0x24')](_0x436142[0x0]);_0x4e21e7['push'](_0x436142[0x1]);_0x4e21e7['push'](_0x436142[0x2]);_0x4e21e7[_0xdd3d('0x24')](_0x436142[0x3]);_0x4e21e7[_0xdd3d('0x24')](_0x436142[_0xdd3d('0x25')](0x4,_0x436142[_0xdd3d('0x1a')])[_0xdd3d('0x1c')](','));break;case _0xdd3d('0x27'):var _0x55bac2=_0x182212[_0xdd3d('0x21')][_0xdd3d('0x22')](',');_0x4e21e7[_0xdd3d('0x24')](_0x55bac2[0x0]);_0x4e21e7['push'](_0x55bac2[0x1]);_0x4e21e7[_0xdd3d('0x24')](_0x55bac2[0x2]);_0x4e21e7['push'](_0x55bac2[0x3]);_0x4e21e7[_0xdd3d('0x24')](_0x55bac2[_0xdd3d('0x25')](0x4,_0x55bac2[_0xdd3d('0x1a')])[_0xdd3d('0x1c')](','));break;case _0xdd3d('0x16'):_0x4e21e7[_0xdd3d('0x24')](_0x182212['appdata']);break;case _0xdd3d('0x28'):_0x4e21e7[_0xdd3d('0x24')](_0x182212[_0xdd3d('0x29')]);_0x4e21e7[_0xdd3d('0x24')](_0x182212['appdata']);break;default:_0x4e21e7=_[_0xdd3d('0xe')](_0x182212[_0xdd3d('0x21')])?[]:_0x182212[_0xdd3d('0x21')][_0xdd3d('0x22')](',');}var _0x4049fe={'id':util['format'](_0xdd3d('0x2a'),_0x2713c4,_0x182212['id'],_0x182212[_0xdd3d('0x1d')]),'condition':require('./interval')['condition'](_0x2713c4,getIntervals(_0x2208f7[_0xdd3d('0x2b')],_0x182212),_0x2208f7),'consequence':require(_0xdd3d('0x2c')+_0x182212[_0xdd3d('0x1d')])[_0xdd3d('0x2d')](_0x2713c4,_0x4e21e7,_0x2208f7,_0x5bac63),'p':_0x182212[_0xdd3d('0x2e')]||0x0};logger['info']('Push\x20new\x20rule',_0x4049fe['id'],_0xdd3d('0x2f'),getIntervals(_0x2208f7['intervals'],_0x182212)[_0xdd3d('0x1c')](_0xdd3d('0x30')));_0x250f43['push'](_0x4049fe);}else{logger[_0xdd3d('0x31')](_0xdd3d('0x32'),path[_0xdd3d('0x1c')](__dirname,_0xdd3d('0x19'),_0x182212[_0xdd3d('0x1d')]+'.js'));}}_0x2208f7[_0xdd3d('0x14')][_0x2713c4]=new RuleEngine(_0x250f43);_0x2208f7[_0xdd3d('0x14')][_0x2713c4]['execute'](_0x5bac63,function(_0x2cc723){logger[_0xdd3d('0x33')](_0xdd3d('0x34'),JSON[_0xdd3d('0x35')](_0x2cc723[_0xdd3d('0x36')]));if(_0x2208f7['rules'][_0x2713c4]){_0x2208f7[_0xdd3d('0x14')][_0x2713c4]['emit'](_0xdd3d('0x37'));}});return _0x95b569({'code':0xc8,'message':_0x5bac63});}else{logger[_0xdd3d('0x33')](_0xdd3d('0x38'));return _0x95b569({'code':0xc8,'message':_0x5bac63});}}catch(_0x6525ee){logger[_0xdd3d('0x31')](_0x6525ee['stack']);return _0x4b1bda(_0x372fc3['error'](0x1f4,_0x6525ee));}}return _0x4b1bda(_0xdd3d('0x39'));});},'AcceptMessage':function(_0x4f44bf){var _0x381dbc=this;return new Promise(function(_0x425479,_0x347c9c){if(_0x4f44bf['agent']&&_0x4f44bf[_0xdd3d('0x3a')]['id']){if(_0x2208f7[_0xdd3d('0x3b')][_0x4f44bf[_0xdd3d('0x3a')]['id']]){_0x2208f7[_0xdd3d('0x3b')][_0x4f44bf[_0xdd3d('0x3a')]['id']]['busy']=![];_0x2208f7[_0xdd3d('0x3b')][_0x4f44bf['agent']['id']]['busyQueue']=undefined;}}if(_0x4f44bf['message']&&_0x4f44bf[_0xdd3d('0x16')]['id']){try{var _0x2eee25=getId(_0x4f44bf[_0xdd3d('0x15')],_0x4f44bf['message']?_0x4f44bf[_0xdd3d('0x16')]['id']:0x0,_0x4f44bf['interaction']?_0x4f44bf[_0xdd3d('0x17')]['id']:0x0);if(_0x2208f7['rules'][_0x2eee25]){_0x2208f7[_0xdd3d('0x14')][_0x2eee25][_0xdd3d('0x3c')](_0xdd3d('0x3d'));if(rpc[_0x4f44bf[_0xdd3d('0x15')]+_0xdd3d('0x3e')]){rpc[_0x4f44bf[_0xdd3d('0x15')]+_0xdd3d('0x3e')][_0xdd3d('0x3f')](_0x2eee25,{'UserId':_0x4f44bf['message'][_0xdd3d('0x40')]})[_0xdd3d('0x41')](function(_0x37492f){logger['error'](_0xdd3d('0x42'));});}}return _0x425479({'code':0xc8,'message':_0x4f44bf});}catch(_0xd4824a){logger[_0xdd3d('0x31')](_0xd4824a[_0xdd3d('0x43')]);return _0x347c9c(_0x381dbc[_0xdd3d('0x31')](0x1f4,_0xd4824a));}}logger[_0xdd3d('0x31')]('message\x20is\x20empty');return _0x347c9c(_0x381dbc[_0xdd3d('0x31')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0xd575a){var _0x11e3bb=this;return new Promise(function(_0x590635,_0xd4bc55){if(_0xd575a['agent']&&_0xd575a[_0xdd3d('0x3a')]['id']){try{if(_0x2208f7[_0xdd3d('0x3b')][_0xd575a[_0xdd3d('0x3a')]['id']]){_0x2208f7['agents'][_0xd575a[_0xdd3d('0x3a')]['id']]['busy']=![];_0x2208f7[_0xdd3d('0x3b')][_0xd575a[_0xdd3d('0x3a')]['id']][_0xdd3d('0x44')]=undefined;}return _0x590635({'code':0xc8,'message':_0xd575a});}catch(_0x352778){logger[_0xdd3d('0x31')](_0x352778[_0xdd3d('0x43')]);return _0xd4bc55(_0x11e3bb[_0xdd3d('0x31')](0x1f4,_0x352778));}}logger[_0xdd3d('0x31')](_0xdd3d('0x45'));return _0xd4bc55(_0x11e3bb[_0xdd3d('0x31')](0x1f4,_0xdd3d('0x45')));});},'AbandonInteraction':function(_0x13eb06){var _0x517cbe=this;return new Promise(function(_0x1f22bc,_0xe185a8){if(_0x13eb06[_0xdd3d('0x15')]&&_0x13eb06[_0xdd3d('0x17')]&&_0x13eb06[_0xdd3d('0x17')]['id']){try{var _0x1f4a75=getId(_0x13eb06['channel'],_0x13eb06[_0xdd3d('0x16')]?_0x13eb06['message']['id']:0x0,_0x13eb06[_0xdd3d('0x17')]?_0x13eb06['interaction']['id']:0x0);if(_0x2208f7[_0xdd3d('0x14')][_0x1f4a75]){_0x2208f7['rules'][_0x1f4a75][_0xdd3d('0x3c')](_0xdd3d('0x3d'));}return _0x1f22bc({'code':0xc8,'message':_0x13eb06});}catch(_0x5b4d8d){logger[_0xdd3d('0x31')](_0x5b4d8d[_0xdd3d('0x43')]);return _0xe185a8(_0x517cbe[_0xdd3d('0x31')](0x1f4,_0x5b4d8d));}}logger[_0xdd3d('0x31')](_0xdd3d('0x45'));return _0xe185a8(_0x517cbe[_0xdd3d('0x31')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x4faa30){var _0x1b7960=this;return new Promise(function(_0x268258,_0x3acb47){if(_0x2208f7[_0xdd3d('0x3b')]['hasOwnProperty'](_0x4faa30['id'])){for(var _0x45bb09 in _0x4faa30[_0xdd3d('0x46')]){if(_0x4faa30[_0xdd3d('0x46')]['hasOwnProperty'](_0x45bb09)){if(_0x2208f7[_0xdd3d('0x3b')][_0x4faa30['id']]['hasOwnProperty'](_0x45bb09+_0xdd3d('0x47'))){_0x2208f7['agents'][_0x4faa30['id']][_0x45bb09+_0xdd3d('0x47')]=parseInt(_0x4faa30['capacity'][_0x45bb09],0xa);}}}_0x2208f7['agents'][_0x4faa30['id']][_0xdd3d('0x48')]();return _0x268258({'code':0xc8,'message':_0x2208f7[_0xdd3d('0x3b')][_0x4faa30['id']]});}else{return _0x3acb47(_0x1b7960[_0xdd3d('0x31')](0x1f4,_0xdd3d('0x49')));}});},'Agents':function(_0x2f34c1){return new Promise(function(_0x518d47,_0x4a4e57){var _0x259660=_[_0xdd3d('0x4a')](_0x2208f7[_0xdd3d('0x3b')]);_0x518d47({'count':_0x259660['length'],'rows':_0x259660});});},'ChatQueues':function(_0x17bdd0){return new Promise(function(_0x48f4b1,_0x59a53f){var _0x513370=[];for(var _0x589a0f in _0x2208f7[_0xdd3d('0x4b')]){if(_0x2208f7['chatQueues'][_0xdd3d('0x4c')](_0x589a0f)){var _0x4cc936=_0x2208f7['chatQueues'][_0x589a0f];var _0x2160dc={'id':_0x4cc936['id'],'available':_0x4cc936[_0xdd3d('0x4d')],'loggedIn':_0x4cc936['loggedIn'],'name':_0x4cc936[_0xdd3d('0x4e')],'paused':_0x4cc936[_0xdd3d('0x4f')],'waiting':_0x4cc936[_0xdd3d('0x50')]};_0x513370[_0xdd3d('0x24')](_0x2160dc);}}_0x48f4b1({'count':_0x513370['length'],'rows':_0x513370});});},'MailQueues':function(_0x2bd974){return new Promise(function(_0x5e6488,_0x13cf2b){var _0x3b09d8=[];for(var _0x2ae99d in _0x2208f7['mailQueues']){if(_0x2208f7[_0xdd3d('0x51')][_0xdd3d('0x4c')](_0x2ae99d)){var _0x150134=_0x2208f7['mailQueues'][_0x2ae99d];var _0x46ad0c={'id':_0x150134['id'],'available':_0x150134[_0xdd3d('0x4d')],'loggedIn':_0x150134[_0xdd3d('0x52')],'name':_0x150134['name'],'paused':_0x150134[_0xdd3d('0x4f')],'waiting':_0x150134['waiting']};_0x3b09d8[_0xdd3d('0x24')](_0x46ad0c);}}_0x5e6488({'count':_0x3b09d8[_0xdd3d('0x1a')],'rows':_0x3b09d8});});},'OpenchannelQueues':function(_0x4ce317){return new Promise(function(_0x4631b2,_0x5c1705){var _0xd0013d=[];for(var _0x3342c5 in _0x2208f7['openchannelQueues']){if(_0x2208f7[_0xdd3d('0x53')][_0xdd3d('0x4c')](_0x3342c5)){var _0x2e162f=_0x2208f7[_0xdd3d('0x53')][_0x3342c5];var _0x3bbfbd={'id':_0x2e162f['id'],'available':_0x2e162f['available'],'loggedIn':_0x2e162f[_0xdd3d('0x52')],'name':_0x2e162f[_0xdd3d('0x4e')],'paused':_0x2e162f[_0xdd3d('0x4f')],'waiting':_0x2e162f['waiting']};_0xd0013d[_0xdd3d('0x24')](_0x3bbfbd);}}_0x4631b2({'count':_0xd0013d['length'],'rows':_0xd0013d});});},'SmsQueues':function(_0x1883f7){return new Promise(function(_0x150e71,_0x2437cb){var _0x3b0360=[];for(var _0x247988 in _0x2208f7[_0xdd3d('0x54')]){if(_0x2208f7[_0xdd3d('0x54')][_0xdd3d('0x4c')](_0x247988)){var _0x58c994=_0x2208f7[_0xdd3d('0x54')][_0x247988];var _0x1fda21={'id':_0x58c994['id'],'available':_0x58c994['available'],'loggedIn':_0x58c994['loggedIn'],'name':_0x58c994[_0xdd3d('0x4e')],'paused':_0x58c994[_0xdd3d('0x4f')],'waiting':_0x58c994[_0xdd3d('0x50')]};_0x3b0360[_0xdd3d('0x24')](_0x1fda21);}}_0x150e71({'count':_0x3b0360[_0xdd3d('0x1a')],'rows':_0x3b0360});});},'FaxQueues':function(_0x587654){return new Promise(function(_0x4a4467,_0x4ae8d6){var _0xd19f0d=[];for(var _0x56f5f6 in _0x2208f7[_0xdd3d('0x55')]){if(_0x2208f7[_0xdd3d('0x55')][_0xdd3d('0x4c')](_0x56f5f6)){var _0x3e76f2=_0x2208f7['faxQueues'][_0x56f5f6];var _0x2094fe={'id':_0x3e76f2['id'],'available':_0x3e76f2[_0xdd3d('0x4d')],'loggedIn':_0x3e76f2[_0xdd3d('0x52')],'name':_0x3e76f2[_0xdd3d('0x4e')],'paused':_0x3e76f2['paused'],'waiting':_0x3e76f2[_0xdd3d('0x50')]};_0xd19f0d[_0xdd3d('0x24')](_0x2094fe);}}_0x4a4467({'count':_0xd19f0d['length'],'rows':_0xd19f0d});});},'WhatsappQueues':function(_0x578aa9){return new Promise(function(_0x1a00c8,_0x1fe67b){var _0x2b63ac=[];for(var _0x3c09ba in _0x2208f7[_0xdd3d('0x56')]){if(_0x2208f7[_0xdd3d('0x56')][_0xdd3d('0x4c')](_0x3c09ba)){var _0x3332a1=_0x2208f7[_0xdd3d('0x56')][_0x3c09ba];var _0x57547f={'id':_0x3332a1['id'],'available':_0x3332a1[_0xdd3d('0x4d')],'loggedIn':_0x3332a1[_0xdd3d('0x52')],'name':_0x3332a1[_0xdd3d('0x4e')],'paused':_0x3332a1[_0xdd3d('0x4f')],'waiting':_0x3332a1[_0xdd3d('0x50')]};_0x2b63ac['push'](_0x57547f);}}_0x1a00c8({'count':_0x2b63ac[_0xdd3d('0x1a')],'rows':_0x2b63ac});});},'ChatQueuesWaitingInteractions':function(_0x14e84a){return new Promise(function(_0x134328,_0x385a73){var _0x59a7cd=_[_0xdd3d('0x4a')](_0x2208f7[_0xdd3d('0x57')]);_0x134328({'count':_0x59a7cd[_0xdd3d('0x1a')],'rows':_0x59a7cd});});},'MailQueuesWaitingInteractions':function(_0x12849a){return new Promise(function(_0x169587,_0x54f4cc){var _0x24a567=_[_0xdd3d('0x4a')](_0x2208f7[_0xdd3d('0x58')]);_0x169587({'count':_0x24a567[_0xdd3d('0x1a')],'rows':_0x24a567});});},'OpenchannelQueuesWaitingInteractions':function(_0xb5985d){return new Promise(function(_0x169116,_0x2504cc){var _0x5b046a=_[_0xdd3d('0x4a')](_0x2208f7['openchannelQueuesWaitingInteractions']);_0x169116({'count':_0x5b046a[_0xdd3d('0x1a')],'rows':_0x5b046a});});},'SmsQueuesWaitingInteractions':function(_0x56f054){return new Promise(function(_0x5b4927,_0x1bed79){var _0x4fd2dc=_[_0xdd3d('0x4a')](_0x2208f7[_0xdd3d('0x59')]);_0x5b4927({'count':_0x4fd2dc['length'],'rows':_0x4fd2dc});});},'FaxQueuesWaitingInteractions':function(_0x1f0464){return new Promise(function(_0x3fbf55,_0x3b3a1e){var _0x36d824=_[_0xdd3d('0x4a')](_0x2208f7['faxQueuesWaitingInteractions']);_0x3fbf55({'count':_0x36d824[_0xdd3d('0x1a')],'rows':_0x36d824});});},'WhatsappQueuesWaitingInteractions':function(_0xbb2dc7){return new Promise(function(_0x3dc105,_0x583a0f){var _0x2a7162=_[_0xdd3d('0x4a')](_0x2208f7['whatsappQueuesWaitingInteractions']);_0x3dc105({'count':_0x2a7162['length'],'rows':_0x2a7162});});}};var _0x1d2690=jayson['server'](_0x82fd1e)['http']();_0x1d2690['on'](_0xdd3d('0x31'),function(_0x3ac08a){logger[_0xdd3d('0x31')](JSON['stringify'](_0x3ac08a));return _0x55f85d(_0x3ac08a);});_0x1d2690[_0xdd3d('0x13')](0x232c,_0xdd3d('0x5a'),function(){console[_0xdd3d('0x5b')](_0xdd3d('0x5c'),0x232c);return _0x2fa216(_0xdd3d('0x5d')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 64c5de1..61d4348 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 _0xb9a7=['some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','stop','bluebird','jayson/promise','lodash','../../../config/logger','client','http','request','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','Command','format','indexOf','true','[%s][INTERVAL]\x20%s','all'];(function(_0x25a54d,_0x2d84e8){var _0x36b530=function(_0x1dea9d){while(--_0x1dea9d){_0x25a54d['push'](_0x25a54d['shift']());}};_0x36b530(++_0x2d84e8);}(_0xb9a7,0xd3));var _0x7b9a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xb9a7[_0x199572];return _0x13cfa3;};'use strict';var util=require('util');var BPromise=require(_0x7b9a('0x0'));var jayson=require(_0x7b9a('0x1'));var _=require(_0x7b9a('0x2'));var logger=require(_0x7b9a('0x3'))('routing');var client=jayson[_0x7b9a('0x4')][_0x7b9a('0x5')]({'port':0x232a});function request(_0x472b8a,_0xed2655){return new BPromise(function(_0x46b9da,_0x5b759f){return client[_0x7b9a('0x6')](_0x472b8a,_0xed2655)[_0x7b9a('0x7')](function(_0x4d3dce){if(_0x4d3dce[_0x7b9a('0x8')]){return _0x5b759f(_0x4d3dce[_0x7b9a('0x8')][_0x7b9a('0x9')]);}else{return _0x46b9da(_0x4d3dce['result']);}})[_0x7b9a('0xa')](function(_0x4c40e3){return _0x5b759f(_0x4c40e3);});});}exports[_0x7b9a('0xb')]=function(_0x39b1eb,_0x4f7aec,_0x1ca636){return function(_0xd92130){if(_0x1ca636[_0x7b9a('0xc')]&&!_0x1ca636['rules'][_0x39b1eb]){logger[_0x7b9a('0xd')](_0x7b9a('0xe'),_0x39b1eb);return _0xd92130['stop']();}var _0x323097=[];for(var _0x5c5625=0x0;_0x5c5625<_0x4f7aec['length'];_0x5c5625+=0x1){_0x323097['push'](request(_0x7b9a('0xf'),{'command':util[_0x7b9a('0x10')]('iftime\x20%s',_0x4f7aec[_0x5c5625])})['then'](function(_0x5c2849){return _0x5c2849&&_0x5c2849[_0x7b9a('0x9')]&&_0x5c2849[_0x7b9a('0x9')][_0x7b9a('0x11')](_0x7b9a('0x12'))>=0x0?!![]:![];})[_0x7b9a('0xa')](function(_0x57c43d){logger[_0x7b9a('0x8')](_0x7b9a('0x13'),_0x39b1eb,_0x4f7aec[_0x5c5625]);}));}BPromise[_0x7b9a('0x14')](_0x323097)[_0x7b9a('0x7')](function(_0x1c26eb){var _0x5ca2fd=_[_0x7b9a('0x15')](_0x1c26eb);logger[_0x7b9a('0xd')](_0x7b9a('0x16'),_0x39b1eb,_0x4f7aec['join'](_0x7b9a('0x17')),_0x5ca2fd);_0xd92130[_0x7b9a('0x18')](_0x5ca2fd);})[_0x7b9a('0xa')](function(_0x53abf6){console[_0x7b9a('0x19')](_0x53abf6);logger[_0x7b9a('0x8')](_0x7b9a('0x16'),_0x39b1eb,_0x4f7aec[_0x7b9a('0x1a')](_0x7b9a('0x17')),_0x53abf6[_0x7b9a('0x1b')]);_0xd92130[_0x7b9a('0x1c')]();});};}; \ No newline at end of file +var _0xd52b=['routing','client','http','request','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','Command','format','message','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','bluebird','../../../config/logger'];(function(_0x27e0b5,_0x33f408){var _0x42c0a2=function(_0x513c27){while(--_0x513c27){_0x27e0b5['push'](_0x27e0b5['shift']());}};_0x42c0a2(++_0x33f408);}(_0xd52b,0x1cd));var _0xbd52=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xd52b[_0x46aff0];return _0x9d78cf;};'use strict';var util=require(_0xbd52('0x0'));var BPromise=require(_0xbd52('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0xbd52('0x2'))(_0xbd52('0x3'));var client=jayson[_0xbd52('0x4')][_0xbd52('0x5')]({'port':0x232a});function request(_0x4ea81e,_0x4ce40e){return new BPromise(function(_0x11441c,_0x499579){return client[_0xbd52('0x6')](_0x4ea81e,_0x4ce40e)[_0xbd52('0x7')](function(_0x1e526e){if(_0x1e526e['error']){return _0x499579(_0x1e526e[_0xbd52('0x8')]['message']);}else{return _0x11441c(_0x1e526e[_0xbd52('0x9')]);}})[_0xbd52('0xa')](function(_0x56d116){return _0x499579(_0x56d116);});});}exports[_0xbd52('0xb')]=function(_0x4ab78f,_0xb2a225,_0x50eff4){return function(_0x3982b8){if(_0x50eff4[_0xbd52('0xc')]&&!_0x50eff4[_0xbd52('0xc')][_0x4ab78f]){logger[_0xbd52('0xd')](_0xbd52('0xe'),_0x4ab78f);return _0x3982b8[_0xbd52('0xf')]();}var _0x5d19a1=[];for(var _0x2cb3ee=0x0;_0x2cb3ee<_0xb2a225['length'];_0x2cb3ee+=0x1){_0x5d19a1['push'](request(_0xbd52('0x10'),{'command':util[_0xbd52('0x11')]('iftime\x20%s',_0xb2a225[_0x2cb3ee])})[_0xbd52('0x7')](function(_0x2271f9){return _0x2271f9&&_0x2271f9[_0xbd52('0x12')]&&_0x2271f9[_0xbd52('0x12')]['indexOf'](_0xbd52('0x13'))>=0x0?!![]:![];})[_0xbd52('0xa')](function(_0x20853b){logger[_0xbd52('0x8')](_0xbd52('0x14'),_0x4ab78f,_0xb2a225[_0x2cb3ee]);}));}BPromise[_0xbd52('0x15')](_0x5d19a1)[_0xbd52('0x7')](function(_0x12260c){var _0x97a159=_[_0xbd52('0x16')](_0x12260c);logger[_0xbd52('0xd')](_0xbd52('0x17'),_0x4ab78f,_0xb2a225[_0xbd52('0x18')](_0xbd52('0x19')),_0x97a159);_0x3982b8[_0xbd52('0x1a')](_0x97a159);})['catch'](function(_0x55e618){console[_0xbd52('0x1b')](_0x55e618);logger[_0xbd52('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x4ab78f,_0xb2a225[_0xbd52('0x18')](_0xbd52('0x19')),_0x55e618[_0xbd52('0x1c')]);_0x3982b8[_0xbd52('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index d6832a7..1ade80f 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 _0x6c76=['answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','agentconnectAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','calleridnum','calleridname','agentcalledAt','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','splice','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','lodash','util','./utils','info','uniqueid','channel','membername','interface','connectedlinenum','getVoiceQueueByName','queue','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','format','[%s][agents][agentcalled]','now','lastevent','called','error','isNil','[%s][agents][agentringnoanswer]','agentringnoanswer','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','agentringnoanswerAt','abandoned','reason','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','answered_elsewhere'];(function(_0x342b59,_0x50285f){var _0x19c5c1=function(_0x6a378){while(--_0x6a378){_0x342b59['push'](_0x342b59['shift']());}};_0x19c5c1(++_0x50285f);}(_0x6c76,0x184));var _0x66c7=function(_0x2d07f1,_0x112dc6){_0x2d07f1=_0x2d07f1-0x0;var _0x38701e=_0x6c76[_0x2d07f1];return _0x38701e;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var utils=require(_0x66c7('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x55604c,_0x203e75){utils[_0x66c7('0x3')](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x55604c[_0x66c7('0x4')],_0x55604c[_0x66c7('0x5')],_0x55604c['queue'],_0x55604c[_0x66c7('0x6')],_0x55604c[_0x66c7('0x7')],_0x55604c['calleridnum'],_0x55604c[_0x66c7('0x8')],_0x55604c['lastevent']));if(_0x55604c['queue']){utils[_0x66c7('0x9')](_0x55604c[_0x66c7('0xa')])[_0x66c7('0xb')](function(_0x53a81c){if(_0x53a81c){_0x55604c[_0x66c7('0xc')]=_0x53a81c[_0x66c7('0xc')];_0x55604c[_0x66c7('0xd')]=_0x55604c[_0x66c7('0xe')]?_0x53a81c['acw']:![];_0x55604c[_0x66c7('0xf')]=_0x55604c[_0x66c7('0xd')]?_0x53a81c[_0x66c7('0x10')]:0x0;}utils[_0x66c7('0x11')](_0x66c7('0x12'),_0x55604c);});}else{utils[_0x66c7('0x11')](_0x66c7('0x12'),_0x55604c);}if(_0x203e75){delete transfers[_0x55604c['uniqueid']];}else{delete agents[_0x55604c[_0x66c7('0x13')]];}}exports[_0x66c7('0x14')]=function(_0x35cbc2){try{utils[_0x66c7('0x15')](util[_0x66c7('0x16')](_0x66c7('0x17'),_0x35cbc2[_0x66c7('0x4')]),_0x35cbc2);agents[_0x35cbc2[_0x66c7('0x13')]]=_0x35cbc2;agents[_0x35cbc2[_0x66c7('0x13')]]['agentcalledAt']=utils[_0x66c7('0x18')]();agents[_0x35cbc2['destuniqueid']][_0x66c7('0x19')]=_0x66c7('0x1a');agents[_0x35cbc2[_0x66c7('0x13')]][_0x66c7('0x8')]=null;agents[_0x35cbc2[_0x66c7('0x13')]]['connectedlinename']=null;utils['info'](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x35cbc2[_0x66c7('0x4')],agents[_0x35cbc2[_0x66c7('0x13')]]['membername'],_0x35cbc2['destuniqueid']));}catch(_0x256b0a){utils[_0x66c7('0x1b')](util[_0x66c7('0x16')](_0x66c7('0x17'),_0x35cbc2['uniqueid']),_0x256b0a);}};exports['agentringnoanswer']=function(_0x1853b2){try{if(!_[_0x66c7('0x1c')](agents[_0x1853b2[_0x66c7('0x13')]])){utils[_0x66c7('0x15')](util[_0x66c7('0x16')](_0x66c7('0x1d'),_0x1853b2['uniqueid']),_0x1853b2);utils[_0x66c7('0x3')](util[_0x66c7('0x16')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x1853b2[_0x66c7('0x4')],agents[_0x1853b2[_0x66c7('0x13')]][_0x66c7('0x6')],_0x1853b2[_0x66c7('0x13')]));agents[_0x1853b2['destuniqueid']][_0x66c7('0x1e')]=!![];agents[_0x1853b2[_0x66c7('0x13')]]['agentringnoanswerAt']=utils[_0x66c7('0x18')]();agents[_0x1853b2[_0x66c7('0x13')]][_0x66c7('0x19')]=_0x66c7('0x1f');agents[_0x1853b2[_0x66c7('0x13')]]['reason']='timeout';agents[_0x1853b2['destuniqueid']][_0x66c7('0x20')]=_0x1853b2[_0x66c7('0x21')]?parseInt(_0x1853b2['ringtime'])/0x3e8:0x0;agents[_0x1853b2[_0x66c7('0x13')]][_0x66c7('0x22')]=0x0;unanswered[_0x66c7('0x23')](_0x1853b2[_0x66c7('0x13')]);}}catch(_0x36a830){utils[_0x66c7('0x1b')](util['format'](_0x66c7('0x1d'),_0x1853b2[_0x66c7('0x4')]),_0x36a830);}};exports[_0x66c7('0x24')]=function(_0x33be23){try{_[_0x66c7('0x25')](agents,function(_0x592f0e,_0x263b48){if(_0x592f0e['uniqueid']==_0x33be23[_0x66c7('0x4')]&&!_['includes'](unanswered,_0x592f0e[_0x66c7('0x13')])){utils[_0x66c7('0x15')](util[_0x66c7('0x16')](_0x66c7('0x26'),_0x33be23[_0x66c7('0x4')]),_0x33be23);utils[_0x66c7('0x3')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x33be23[_0x66c7('0x4')],_0x592f0e[_0x66c7('0x6')],_0x592f0e[_0x66c7('0x13')]));_0x592f0e[_0x66c7('0x1e')]=!![];_0x592f0e[_0x66c7('0x27')]=utils[_0x66c7('0x18')]();_0x592f0e[_0x66c7('0x19')]=_0x66c7('0x28');_0x592f0e[_0x66c7('0x29')]=_0x66c7('0x28');_0x592f0e[_0x66c7('0x20')]=_0x33be23[_0x66c7('0x20')];_0x592f0e['talktime']=0x0;writeDB(_0x592f0e);}});}catch(_0x562283){utils[_0x66c7('0x1b')](util[_0x66c7('0x16')](_0x66c7('0x26'),_0x33be23[_0x66c7('0x4')]),_0x562283);}};exports[_0x66c7('0x2a')]=function(_0x2bf7c2){try{if(agents[_0x2bf7c2[_0x66c7('0x13')]]){utils['debug'](util[_0x66c7('0x16')](_0x66c7('0x2b'),_0x2bf7c2[_0x66c7('0x4')]),_0x2bf7c2);utils[_0x66c7('0x3')](util[_0x66c7('0x16')](_0x66c7('0x2c'),_0x2bf7c2[_0x66c7('0x4')],agents[_0x2bf7c2[_0x66c7('0x13')]][_0x66c7('0x6')],_0x2bf7c2[_0x66c7('0x13')]));agents[_0x2bf7c2[_0x66c7('0x13')]]['agentconnectAt']=utils['now']();agents[_0x2bf7c2[_0x66c7('0x13')]][_0x66c7('0x8')]=_0x2bf7c2[_0x66c7('0x8')];agents[_0x2bf7c2['destuniqueid']]['connectedlinename']=_0x2bf7c2[_0x66c7('0x2d')];agents[_0x2bf7c2[_0x66c7('0x13')]]['holdtime']=_0x2bf7c2[_0x66c7('0x21')];agents[_0x2bf7c2[_0x66c7('0x13')]][_0x66c7('0x19')]='connect';_[_0x66c7('0x25')](agents,function(_0x16b754,_0x9f6ca8){if(_0x16b754[_0x66c7('0x13')]!=_0x2bf7c2[_0x66c7('0x13')]&&_0x16b754[_0x66c7('0x4')]==_0x2bf7c2[_0x66c7('0x4')]){_0x16b754[_0x66c7('0x22')]=0x0;_0x16b754[_0x66c7('0x20')]=_0x2bf7c2['ringtime'];_0x16b754[_0x66c7('0x1e')]=!![];_0x16b754[_0x66c7('0x27')]=utils[_0x66c7('0x18')]();_0x16b754[_0x66c7('0x19')]=_0x66c7('0x2e');_0x16b754[_0x66c7('0x29')]=_0x66c7('0x2e');_0x16b754[_0x66c7('0x2f')]=_0x2bf7c2[_0x66c7('0x13')];_0x16b754[_0x66c7('0x30')]=_0x2bf7c2['membername'];writeDB(_0x16b754);}});}}catch(_0x5bb5fc){utils['error'](util[_0x66c7('0x16')](_0x66c7('0x2b'),_0x2bf7c2['uniqueid']),_0x5bb5fc);}};exports['agentcomplete']=function(_0x34d002){try{if(!_[_0x66c7('0x1c')](agents[_0x34d002[_0x66c7('0x13')]])){utils[_0x66c7('0x15')](util[_0x66c7('0x16')]('[%s][agents][agentcomplete]',_0x34d002[_0x66c7('0x4')]),_0x34d002);utils['info'](util['format'](_0x66c7('0x31'),_0x34d002[_0x66c7('0x4')],agents[_0x34d002[_0x66c7('0x13')]][_0x66c7('0x6')],_0x34d002['destuniqueid']));agents[_0x34d002['destuniqueid']][_0x66c7('0xe')]=!![];agents[_0x34d002['destuniqueid']]['agentcompleteAt']=utils[_0x66c7('0x18')]();agents[_0x34d002[_0x66c7('0x13')]][_0x66c7('0x22')]=utils[_0x66c7('0x32')](agents[_0x34d002['destuniqueid']][_0x66c7('0x33')],agents[_0x34d002[_0x66c7('0x13')]][_0x66c7('0x34')]);agents[_0x34d002['destuniqueid']][_0x66c7('0x29')]=_0x34d002[_0x66c7('0x29')];agents[_0x34d002[_0x66c7('0x13')]][_0x66c7('0x19')]=_0x66c7('0x35');writeDB(agents[_0x34d002[_0x66c7('0x13')]]);}}catch(_0x2e3f06){utils[_0x66c7('0x1b')](util['format'](_0x66c7('0x36'),_0x34d002[_0x66c7('0x4')]),_0x2e3f06);}};exports[_0x66c7('0x37')]=function(_0x1386a2){try{if(!_[_0x66c7('0x1c')](agents[_0x1386a2[_0x66c7('0x38')]])){utils[_0x66c7('0x15')](util[_0x66c7('0x16')](_0x66c7('0x39'),_0x1386a2[_0x66c7('0x4')]),_0x1386a2);utils[_0x66c7('0x3')](util[_0x66c7('0x16')](_0x66c7('0x3a'),_0x1386a2[_0x66c7('0x4')],agents[_0x1386a2['transfereruniqueid']][_0x66c7('0x6')],agents[_0x1386a2[_0x66c7('0x38')]][_0x66c7('0x4')]));agents[_0x1386a2[_0x66c7('0x38')]]['transfer']=!![];agents[_0x1386a2[_0x66c7('0x38')]][_0x66c7('0x3b')]='blind';agents[_0x1386a2[_0x66c7('0x38')]][_0x66c7('0x3c')]=_0x1386a2[_0x66c7('0x3d')];agents[_0x1386a2[_0x66c7('0x38')]][_0x66c7('0x3e')]=agents[_0x1386a2[_0x66c7('0x38')]][_0x66c7('0x4')];}}catch(_0x5cd4e9){utils[_0x66c7('0x1b')](util[_0x66c7('0x16')]('[%s][agents][blindtransfer]',_0x1386a2[_0x66c7('0x4')]),_0x5cd4e9);}};exports[_0x66c7('0x3f')]=function(_0x3ef4cf){try{utils['debug'](util[_0x66c7('0x16')](_0x66c7('0x40'),_0x3ef4cf[_0x66c7('0x41')]),_0x3ef4cf);if(_0x3ef4cf[_0x66c7('0x41')]==_0x3ef4cf[_0x66c7('0x42')]){if(!_[_0x66c7('0x1c')](agents[_0x3ef4cf[_0x66c7('0x43')]])){utils[_0x66c7('0x3')](util['format'](_0x66c7('0x44'),_0x3ef4cf[_0x66c7('0x41')],agents[_0x3ef4cf['secondtransfereruniqueid']][_0x66c7('0x6')]));agents[_0x3ef4cf[_0x66c7('0x43')]][_0x66c7('0x45')]=!![];agents[_0x3ef4cf['secondtransfereruniqueid']]['transfertype']=_0x66c7('0x46');agents[_0x3ef4cf['secondtransfereruniqueid']][_0x66c7('0x3c')]=_0x3ef4cf[_0x66c7('0x47')];agents[_0x3ef4cf[_0x66c7('0x43')]][_0x66c7('0x3e')]=_0x3ef4cf[_0x66c7('0x41')];}if(_0x3ef4cf[_0x66c7('0x48')]&&agents[_0x3ef4cf['transfereeuniqueid']]){agents[_0x3ef4cf['transfereeuniqueid']][_0x66c7('0x49')]=0x1;transfers[_0x3ef4cf[_0x66c7('0x48')]]=_['clone'](agents[_0x3ef4cf['transfereeuniqueid']]);transfers[_0x3ef4cf[_0x66c7('0x48')]]['calleridnum']=agents[_0x3ef4cf[_0x66c7('0x43')]][_0x66c7('0x4a')];transfers[_0x3ef4cf[_0x66c7('0x48')]][_0x66c7('0x4b')]=agents[_0x3ef4cf['secondtransfereruniqueid']][_0x66c7('0x4b')];transfers[_0x3ef4cf[_0x66c7('0x48')]][_0x66c7('0x4c')]=utils[_0x66c7('0x18')]();transfers[_0x3ef4cf[_0x66c7('0x48')]][_0x66c7('0x34')]=utils['now']();transfers[_0x3ef4cf[_0x66c7('0x48')]][_0x66c7('0x20')]=0x0;transfers[_0x3ef4cf[_0x66c7('0x48')]]['agententerreason']=0x2;}}else if(_0x3ef4cf[_0x66c7('0x43')]==_0x3ef4cf['secondtransfererlinkedid']){if(!_[_0x66c7('0x1c')](agents[_0x3ef4cf[_0x66c7('0x41')]])){utils[_0x66c7('0x3')](util[_0x66c7('0x16')](_0x66c7('0x44'),_0x3ef4cf[_0x66c7('0x41')],agents[_0x3ef4cf['origtransfereruniqueid']][_0x66c7('0x6')]));agents[_0x3ef4cf[_0x66c7('0x41')]][_0x66c7('0x45')]=!![];agents[_0x3ef4cf[_0x66c7('0x41')]][_0x66c7('0x3b')]='ATTENDED';agents[_0x3ef4cf[_0x66c7('0x41')]][_0x66c7('0x3c')]=_0x3ef4cf[_0x66c7('0x4d')];agents[_0x3ef4cf[_0x66c7('0x41')]][_0x66c7('0x3e')]=_0x3ef4cf[_0x66c7('0x43')];}if(_0x3ef4cf[_0x66c7('0x4e')]&&agents[_0x3ef4cf[_0x66c7('0x4e')]]){agents[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x49')]=0x1;transfers[_0x3ef4cf[_0x66c7('0x4e')]]=_[_0x66c7('0x4f')](agents[_0x3ef4cf['transfertargetuniqueid']]);transfers[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x4a')]=agents[_0x3ef4cf[_0x66c7('0x41')]][_0x66c7('0x4a')];transfers[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x4b')]=agents[_0x3ef4cf[_0x66c7('0x41')]]['calleridname'];transfers[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x4c')]=utils[_0x66c7('0x18')]();transfers[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x34')]=utils[_0x66c7('0x18')]();transfers[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x20')]=0x0;transfers[_0x3ef4cf[_0x66c7('0x4e')]][_0x66c7('0x49')]=0x2;}}}catch(_0x21eb0a){utils[_0x66c7('0x1b')](util[_0x66c7('0x16')](_0x66c7('0x40'),_0x3ef4cf[_0x66c7('0x41')]),_0x21eb0a);}};exports[_0x66c7('0x50')]=function(_0x5bca99){try{utils[_0x66c7('0x15')](util[_0x66c7('0x16')](_0x66c7('0x51'),_0x5bca99[_0x66c7('0x4')]),_0x5bca99);if(agents[_0x5bca99[_0x66c7('0x4')]]&&agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x29')]===_0x66c7('0x1f')){if(_0x5bca99[_0x66c7('0x52')]==='21'){agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x29')]=_0x66c7('0x53');agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x19')]=_0x66c7('0x53');}utils[_0x66c7('0x3')](util[_0x66c7('0x16')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5bca99[_0x66c7('0x4')],agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x6')],agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x29')],agents[_0x5bca99[_0x66c7('0x4')]]['lastevent']));writeDB(agents[_0x5bca99['uniqueid']]);var _0x34d4f7=unanswered['indexOf'](_0x5bca99[_0x66c7('0x4')]);if(_0x34d4f7>-0x1){unanswered[_0x66c7('0x54')](_0x34d4f7,0x1);}}if(transfers[_0x5bca99[_0x66c7('0x4')]]){transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0xe')]=!![];transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x33')]=utils[_0x66c7('0x18')]();transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x22')]=utils[_0x66c7('0x32')](transfers[_0x5bca99[_0x66c7('0x4')]]['agentcompleteAt'],transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x34')]);transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x29')]='agent';transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x19')]='complete';utils[_0x66c7('0x3')](util[_0x66c7('0x16')](_0x66c7('0x55'),_0x5bca99[_0x66c7('0x4')],transfers[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x6')],transfers[_0x5bca99['uniqueid']]['reason'],transfers[_0x5bca99[_0x66c7('0x4')]]['lastevent']));writeDB(transfers[_0x5bca99['uniqueid']],!![]);}if(agents[_0x5bca99[_0x66c7('0x4')]]&&agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x34')]){agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0xe')]=!![];agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x33')]=utils[_0x66c7('0x18')]();agents[_0x5bca99['uniqueid']][_0x66c7('0x22')]=utils[_0x66c7('0x32')](agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x33')],agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x34')]);agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x29')]=agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x45')]?_0x66c7('0x45'):_0x66c7('0x56');agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x19')]=_0x66c7('0x35');utils[_0x66c7('0x3')](util[_0x66c7('0x16')](_0x66c7('0x55'),_0x5bca99[_0x66c7('0x4')],agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x6')],agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x29')],agents[_0x5bca99[_0x66c7('0x4')]][_0x66c7('0x19')]));writeDB(agents[_0x5bca99[_0x66c7('0x4')]]);}}catch(_0x331acc){utils['error'](util[_0x66c7('0x16')](_0x66c7('0x51'),_0x5bca99[_0x66c7('0x4')]),_0x331acc);}}; \ No newline at end of file +var _0x0bb5=['called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]','agentringnoanswer','agentringnoanswerAt','now','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','timeout','cause','rejected','indexOf','splice','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt'];(function(_0x59aeb3,_0x32f513){var _0x3c6521=function(_0x1129b2){while(--_0x1129b2){_0x59aeb3['push'](_0x59aeb3['shift']());}};_0x3c6521(++_0x32f513);}(_0x0bb5,0x148));var _0x50bb=function(_0x54b836,_0x3dcd7e){_0x54b836=_0x54b836-0x0;var _0x385eea=_0x0bb5[_0x54b836];return _0x385eea;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x5a12b6,_0x348380){utils[_0x50bb('0x2')](util[_0x50bb('0x3')](_0x50bb('0x4'),_0x5a12b6[_0x50bb('0x5')],_0x5a12b6[_0x50bb('0x6')],_0x5a12b6[_0x50bb('0x7')],_0x5a12b6[_0x50bb('0x8')],_0x5a12b6['interface'],_0x5a12b6['calleridnum'],_0x5a12b6[_0x50bb('0x9')],_0x5a12b6[_0x50bb('0xa')]));if(_0x5a12b6[_0x50bb('0x7')]){utils[_0x50bb('0xb')](_0x5a12b6['queue'])['then'](function(_0x2bede8){if(_0x2bede8){_0x5a12b6[_0x50bb('0xc')]=_0x2bede8[_0x50bb('0xc')];_0x5a12b6[_0x50bb('0xd')]=_0x5a12b6['agentcomplete']?_0x2bede8[_0x50bb('0xe')]:![];_0x5a12b6[_0x50bb('0xf')]=_0x5a12b6[_0x50bb('0xd')]?_0x2bede8[_0x50bb('0x10')]:0x0;}utils[_0x50bb('0x11')](_0x50bb('0x12'),_0x5a12b6);});}else{utils[_0x50bb('0x11')]('CreateVoiceAgentReport',_0x5a12b6);}if(_0x348380){delete transfers[_0x5a12b6[_0x50bb('0x5')]];}else{delete agents[_0x5a12b6['destuniqueid']];}}exports[_0x50bb('0x13')]=function(_0xd8ab27){try{utils[_0x50bb('0x14')](util['format'](_0x50bb('0x15'),_0xd8ab27[_0x50bb('0x5')]),_0xd8ab27);agents[_0xd8ab27[_0x50bb('0x16')]]=_0xd8ab27;agents[_0xd8ab27['destuniqueid']][_0x50bb('0x17')]=utils['now']();agents[_0xd8ab27[_0x50bb('0x16')]][_0x50bb('0xa')]=_0x50bb('0x18');agents[_0xd8ab27[_0x50bb('0x16')]][_0x50bb('0x9')]=null;agents[_0xd8ab27['destuniqueid']][_0x50bb('0x19')]=null;utils[_0x50bb('0x2')](util['format'](_0x50bb('0x1a'),_0xd8ab27['uniqueid'],agents[_0xd8ab27[_0x50bb('0x16')]][_0x50bb('0x8')],_0xd8ab27['destuniqueid']));}catch(_0x4f1c0a){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')](_0x50bb('0x15'),_0xd8ab27[_0x50bb('0x5')]),_0x4f1c0a);}};exports['agentringnoanswer']=function(_0x19dc5d){try{if(!_[_0x50bb('0x1c')](agents[_0x19dc5d[_0x50bb('0x16')]])){utils['debug'](util[_0x50bb('0x3')](_0x50bb('0x1d'),_0x19dc5d[_0x50bb('0x5')]),_0x19dc5d);utils['info'](util[_0x50bb('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x19dc5d[_0x50bb('0x5')],agents[_0x19dc5d[_0x50bb('0x16')]][_0x50bb('0x8')],_0x19dc5d[_0x50bb('0x16')]));agents[_0x19dc5d[_0x50bb('0x16')]][_0x50bb('0x1e')]=!![];agents[_0x19dc5d['destuniqueid']][_0x50bb('0x1f')]=utils[_0x50bb('0x20')]();agents[_0x19dc5d[_0x50bb('0x16')]][_0x50bb('0xa')]='timeout';agents[_0x19dc5d[_0x50bb('0x16')]]['reason']='timeout';agents[_0x19dc5d[_0x50bb('0x16')]]['holdtime']=_0x19dc5d['ringtime']?parseInt(_0x19dc5d[_0x50bb('0x21')])/0x3e8:0x0;agents[_0x19dc5d[_0x50bb('0x16')]][_0x50bb('0x22')]=0x0;unanswered[_0x50bb('0x23')](_0x19dc5d[_0x50bb('0x16')]);}}catch(_0x269479){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')]('[%s][agents][agentringnoanswer]',_0x19dc5d[_0x50bb('0x5')]),_0x269479);}};exports[_0x50bb('0x24')]=function(_0x15ee2e){try{_[_0x50bb('0x25')](agents,function(_0x560b07,_0x13dc3c){if(_0x560b07[_0x50bb('0x5')]==_0x15ee2e[_0x50bb('0x5')]&&!_[_0x50bb('0x26')](unanswered,_0x560b07[_0x50bb('0x16')])){utils[_0x50bb('0x14')](util[_0x50bb('0x3')](_0x50bb('0x27'),_0x15ee2e[_0x50bb('0x5')]),_0x15ee2e);utils[_0x50bb('0x2')](util[_0x50bb('0x3')](_0x50bb('0x28'),_0x15ee2e['uniqueid'],_0x560b07[_0x50bb('0x8')],_0x560b07[_0x50bb('0x16')]));_0x560b07[_0x50bb('0x1e')]=!![];_0x560b07[_0x50bb('0x1f')]=utils[_0x50bb('0x20')]();_0x560b07[_0x50bb('0xa')]=_0x50bb('0x29');_0x560b07[_0x50bb('0x2a')]=_0x50bb('0x29');_0x560b07[_0x50bb('0x2b')]=_0x15ee2e[_0x50bb('0x2b')];_0x560b07['talktime']=0x0;writeDB(_0x560b07);}});}catch(_0x364ea0){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')](_0x50bb('0x27'),_0x15ee2e[_0x50bb('0x5')]),_0x364ea0);}};exports[_0x50bb('0x2c')]=function(_0x53600a){try{if(agents[_0x53600a['destuniqueid']]){utils[_0x50bb('0x14')](util['format'](_0x50bb('0x2d'),_0x53600a[_0x50bb('0x5')]),_0x53600a);utils[_0x50bb('0x2')](util[_0x50bb('0x3')](_0x50bb('0x2e'),_0x53600a['uniqueid'],agents[_0x53600a[_0x50bb('0x16')]]['membername'],_0x53600a[_0x50bb('0x16')]));agents[_0x53600a[_0x50bb('0x16')]][_0x50bb('0x2f')]=utils['now']();agents[_0x53600a['destuniqueid']][_0x50bb('0x9')]=_0x53600a[_0x50bb('0x9')];agents[_0x53600a[_0x50bb('0x16')]][_0x50bb('0x19')]=_0x53600a['connectedlinename'];agents[_0x53600a[_0x50bb('0x16')]]['holdtime']=_0x53600a['ringtime'];agents[_0x53600a[_0x50bb('0x16')]]['lastevent']=_0x50bb('0x30');_[_0x50bb('0x25')](agents,function(_0x1ef231,_0x1f156e){if(_0x1ef231[_0x50bb('0x16')]!=_0x53600a[_0x50bb('0x16')]&&_0x1ef231[_0x50bb('0x5')]==_0x53600a[_0x50bb('0x5')]){_0x1ef231[_0x50bb('0x22')]=0x0;_0x1ef231[_0x50bb('0x2b')]=_0x53600a['ringtime'];_0x1ef231['agentringnoanswer']=!![];_0x1ef231[_0x50bb('0x1f')]=utils[_0x50bb('0x20')]();_0x1ef231[_0x50bb('0xa')]=_0x50bb('0x31');_0x1ef231['reason']=_0x50bb('0x31');_0x1ef231['answeredelsewheredestinationuniqueid']=_0x53600a[_0x50bb('0x16')];_0x1ef231[_0x50bb('0x32')]=_0x53600a[_0x50bb('0x8')];writeDB(_0x1ef231);}});}}catch(_0x40748d){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')](_0x50bb('0x2d'),_0x53600a[_0x50bb('0x5')]),_0x40748d);}};exports[_0x50bb('0x33')]=function(_0x46c1c3){try{if(!_[_0x50bb('0x1c')](agents[_0x46c1c3[_0x50bb('0x16')]])){utils[_0x50bb('0x14')](util[_0x50bb('0x3')](_0x50bb('0x34'),_0x46c1c3[_0x50bb('0x5')]),_0x46c1c3);utils['info'](util[_0x50bb('0x3')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x46c1c3[_0x50bb('0x5')],agents[_0x46c1c3[_0x50bb('0x16')]][_0x50bb('0x8')],_0x46c1c3[_0x50bb('0x16')]));agents[_0x46c1c3[_0x50bb('0x16')]][_0x50bb('0x33')]=!![];agents[_0x46c1c3[_0x50bb('0x16')]][_0x50bb('0x35')]=utils[_0x50bb('0x20')]();agents[_0x46c1c3[_0x50bb('0x16')]][_0x50bb('0x22')]=utils[_0x50bb('0x36')](agents[_0x46c1c3[_0x50bb('0x16')]][_0x50bb('0x35')],agents[_0x46c1c3['destuniqueid']][_0x50bb('0x2f')]);agents[_0x46c1c3['destuniqueid']][_0x50bb('0x2a')]=_0x46c1c3[_0x50bb('0x2a')];agents[_0x46c1c3[_0x50bb('0x16')]][_0x50bb('0xa')]=_0x50bb('0x37');writeDB(agents[_0x46c1c3[_0x50bb('0x16')]]);}}catch(_0x133dd9){utils[_0x50bb('0x1b')](util['format'](_0x50bb('0x34'),_0x46c1c3[_0x50bb('0x5')]),_0x133dd9);}};exports[_0x50bb('0x38')]=function(_0x13afe2){try{if(!_[_0x50bb('0x1c')](agents[_0x13afe2['transfereruniqueid']])){utils[_0x50bb('0x14')](util[_0x50bb('0x3')](_0x50bb('0x39'),_0x13afe2[_0x50bb('0x5')]),_0x13afe2);utils[_0x50bb('0x2')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x13afe2[_0x50bb('0x5')],agents[_0x13afe2['transfereruniqueid']][_0x50bb('0x8')],agents[_0x13afe2['transfereruniqueid']][_0x50bb('0x5')]));agents[_0x13afe2[_0x50bb('0x3a')]][_0x50bb('0x3b')]=!![];agents[_0x13afe2['transfereruniqueid']][_0x50bb('0x3c')]=_0x50bb('0x3d');agents[_0x13afe2['transfereruniqueid']][_0x50bb('0x3e')]=_0x13afe2[_0x50bb('0x3f')];agents[_0x13afe2[_0x50bb('0x3a')]][_0x50bb('0x40')]=agents[_0x13afe2['transfereruniqueid']][_0x50bb('0x5')];}}catch(_0x46b51e){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')](_0x50bb('0x39'),_0x13afe2['uniqueid']),_0x46b51e);}};exports[_0x50bb('0x41')]=function(_0x50943a){try{utils[_0x50bb('0x14')](util['format']('[%s][agents][attendedtransfer]',_0x50943a[_0x50bb('0x42')]),_0x50943a);if(_0x50943a['origtransfereruniqueid']==_0x50943a['origtransfererlinkedid']){if(!_[_0x50bb('0x1c')](agents[_0x50943a[_0x50bb('0x43')]])){utils[_0x50bb('0x2')](util[_0x50bb('0x3')](_0x50bb('0x44'),_0x50943a[_0x50bb('0x42')],agents[_0x50943a[_0x50bb('0x43')]][_0x50bb('0x8')]));agents[_0x50943a['secondtransfereruniqueid']]['transfer']=!![];agents[_0x50943a[_0x50bb('0x43')]][_0x50bb('0x3c')]=_0x50bb('0x45');agents[_0x50943a[_0x50bb('0x43')]][_0x50bb('0x3e')]=_0x50943a[_0x50bb('0x46')];agents[_0x50943a[_0x50bb('0x43')]]['transferuniqueid']=_0x50943a[_0x50bb('0x42')];}if(_0x50943a[_0x50bb('0x47')]&&agents[_0x50943a[_0x50bb('0x47')]]){agents[_0x50943a[_0x50bb('0x47')]][_0x50bb('0x48')]=0x1;transfers[_0x50943a['transfereeuniqueid']]=_[_0x50bb('0x49')](agents[_0x50943a[_0x50bb('0x47')]]);transfers[_0x50943a[_0x50bb('0x47')]][_0x50bb('0x4a')]=agents[_0x50943a[_0x50bb('0x43')]]['calleridnum'];transfers[_0x50943a[_0x50bb('0x47')]]['calleridname']=agents[_0x50943a['secondtransfereruniqueid']][_0x50bb('0x4b')];transfers[_0x50943a[_0x50bb('0x47')]][_0x50bb('0x17')]=utils[_0x50bb('0x20')]();transfers[_0x50943a[_0x50bb('0x47')]][_0x50bb('0x2f')]=utils[_0x50bb('0x20')]();transfers[_0x50943a[_0x50bb('0x47')]][_0x50bb('0x2b')]=0x0;transfers[_0x50943a[_0x50bb('0x47')]][_0x50bb('0x48')]=0x2;}}else if(_0x50943a['secondtransfereruniqueid']==_0x50943a[_0x50bb('0x4c')]){if(!_['isNil'](agents[_0x50943a[_0x50bb('0x42')]])){utils[_0x50bb('0x2')](util['format'](_0x50bb('0x44'),_0x50943a[_0x50bb('0x42')],agents[_0x50943a[_0x50bb('0x42')]][_0x50bb('0x8')]));agents[_0x50943a[_0x50bb('0x42')]][_0x50bb('0x3b')]=!![];agents[_0x50943a[_0x50bb('0x42')]][_0x50bb('0x3c')]='ATTENDED';agents[_0x50943a[_0x50bb('0x42')]][_0x50bb('0x3e')]=_0x50943a[_0x50bb('0x4d')];agents[_0x50943a['origtransfereruniqueid']][_0x50bb('0x40')]=_0x50943a[_0x50bb('0x43')];}if(_0x50943a[_0x50bb('0x4e')]&&agents[_0x50943a[_0x50bb('0x4e')]]){agents[_0x50943a[_0x50bb('0x4e')]][_0x50bb('0x48')]=0x1;transfers[_0x50943a['transfertargetuniqueid']]=_[_0x50bb('0x49')](agents[_0x50943a[_0x50bb('0x4e')]]);transfers[_0x50943a[_0x50bb('0x4e')]][_0x50bb('0x4a')]=agents[_0x50943a[_0x50bb('0x42')]][_0x50bb('0x4a')];transfers[_0x50943a['transfertargetuniqueid']][_0x50bb('0x4b')]=agents[_0x50943a[_0x50bb('0x42')]][_0x50bb('0x4b')];transfers[_0x50943a[_0x50bb('0x4e')]][_0x50bb('0x17')]=utils[_0x50bb('0x20')]();transfers[_0x50943a[_0x50bb('0x4e')]][_0x50bb('0x2f')]=utils[_0x50bb('0x20')]();transfers[_0x50943a['transfertargetuniqueid']][_0x50bb('0x2b')]=0x0;transfers[_0x50943a[_0x50bb('0x4e')]][_0x50bb('0x48')]=0x2;}}}catch(_0x2d2463){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')](_0x50bb('0x4f'),_0x50943a[_0x50bb('0x42')]),_0x2d2463);}};exports[_0x50bb('0x50')]=function(_0x578ff3){try{utils['debug'](util['format'](_0x50bb('0x51'),_0x578ff3['uniqueid']),_0x578ff3);if(agents[_0x578ff3['uniqueid']]&&agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x2a')]===_0x50bb('0x52')){if(_0x578ff3[_0x50bb('0x53')]==='21'){agents[_0x578ff3['uniqueid']][_0x50bb('0x2a')]=_0x50bb('0x54');agents[_0x578ff3['uniqueid']][_0x50bb('0xa')]='rejected';}utils[_0x50bb('0x2')](util[_0x50bb('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x578ff3[_0x50bb('0x5')],agents[_0x578ff3['uniqueid']][_0x50bb('0x8')],agents[_0x578ff3[_0x50bb('0x5')]]['reason'],agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0xa')]));writeDB(agents[_0x578ff3[_0x50bb('0x5')]]);var _0x51142c=unanswered[_0x50bb('0x55')](_0x578ff3[_0x50bb('0x5')]);if(_0x51142c>-0x1){unanswered[_0x50bb('0x56')](_0x51142c,0x1);}}if(transfers[_0x578ff3[_0x50bb('0x5')]]){transfers[_0x578ff3['uniqueid']][_0x50bb('0x33')]=!![];transfers[_0x578ff3[_0x50bb('0x5')]]['agentcompleteAt']=utils['now']();transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x22')]=utils['diffTime'](transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x35')],transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x2f')]);transfers[_0x578ff3[_0x50bb('0x5')]]['reason']='agent';transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0xa')]=_0x50bb('0x37');utils[_0x50bb('0x2')](util['format'](_0x50bb('0x57'),_0x578ff3['uniqueid'],transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x8')],transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x2a')],transfers[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0xa')]));writeDB(transfers[_0x578ff3[_0x50bb('0x5')]],!![]);}if(agents[_0x578ff3['uniqueid']]&&agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x2f')]){agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x33')]=!![];agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x35')]=utils[_0x50bb('0x20')]();agents[_0x578ff3['uniqueid']][_0x50bb('0x22')]=utils[_0x50bb('0x36')](agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x35')],agents[_0x578ff3[_0x50bb('0x5')]]['agentconnectAt']);agents[_0x578ff3['uniqueid']][_0x50bb('0x2a')]=agents[_0x578ff3['uniqueid']][_0x50bb('0x3b')]?_0x50bb('0x3b'):'agent';agents[_0x578ff3['uniqueid']][_0x50bb('0xa')]=_0x50bb('0x37');utils[_0x50bb('0x2')](util['format'](_0x50bb('0x57'),_0x578ff3[_0x50bb('0x5')],agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x8')],agents[_0x578ff3[_0x50bb('0x5')]][_0x50bb('0x2a')],agents[_0x578ff3[_0x50bb('0x5')]]['lastevent']));writeDB(agents[_0x578ff3['uniqueid']]);}}catch(_0x28c99d){utils[_0x50bb('0x1b')](util[_0x50bb('0x3')](_0x50bb('0x51'),_0x578ff3[_0x50bb('0x5')]),_0x28c99d);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 765eccd..db158a9 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 _0xb449=['FAILED','NO\x20ANSWER','BUSY','uniqueid','blinds','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','linkedid','OutgoingSpoolFailed','context','exten','DOCUMENTATION','error','[%s][calls][newchannel]','isNil','channelstate','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','ANSWERED','[%s][calls][newstate]','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','duration','endtime','starttime','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','set','startsWith','toLowerCase','cdr','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','lodash','./utils'];(function(_0x2674d0,_0x927e65){var _0xe8ecd9=function(_0x56295e){while(--_0x56295e){_0x2674d0['push'](_0x2674d0['shift']());}};_0xe8ecd9(++_0x927e65);}(_0xb449,0x1ae));var _0x9b44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb449[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9b44('0x0'));var util=require('util');var utils=require(_0x9b44('0x1'));var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER','FAILED',_0x9b44('0x2'),_0x9b44('0x3'),_0x9b44('0x3'),_0x9b44('0x3'),'ANSWERED',_0x9b44('0x4'),_0x9b44('0x2'),_0x9b44('0x2'),_0x9b44('0x2')];var channels={};function writeDB(_0x1ebccf){var _0xde2303;if(transfers['blinds'][_0x1ebccf[_0x9b44('0x5')]]){_0xde2303=_0x1ebccf['uniqueid'];_0x1ebccf[_0x9b44('0x5')]=transfers[_0x9b44('0x6')][_0x1ebccf[_0x9b44('0x5')]][_0x9b44('0x7')];}utils[_0x9b44('0x8')](util[_0x9b44('0x9')](_0x9b44('0xa'),_0x1ebccf[_0x9b44('0x5')],_0x1ebccf[_0x9b44('0xb')],_0x1ebccf[_0x9b44('0xc')],_0x1ebccf[_0x9b44('0xd')],_0x1ebccf[_0x9b44('0xe')],_0x1ebccf[_0x9b44('0xf')],_0x1ebccf[_0x9b44('0x10')],_0x1ebccf['lastevent']));if(_0x1ebccf['accountcode']){utils[_0x9b44('0x11')](_0x1ebccf[_0x9b44('0x12')])[_0x9b44('0x13')](function(_0x510335){if(_0x510335){_0x1ebccf[_0x9b44('0x14')]=_0x510335['id'];}utils[_0x9b44('0x15')](_0x9b44('0x16'),_0x1ebccf);});}else{utils[_0x9b44('0x15')](_0x9b44('0x16'),_0x1ebccf);}if(channels[_0x1ebccf[_0x9b44('0x5')]]){delete channels[_0x1ebccf['uniqueid']];}else if(_0xde2303&&channels[_0xde2303]){delete transfers[_0x9b44('0x6')][_0xde2303];delete channels[_0xde2303];}}exports[_0x9b44('0x17')]=function(_0x3611d5){try{utils[_0x9b44('0x18')](util['format']('[%s][calls][newchannel]',_0x3611d5[_0x9b44('0x5')]),_0x3611d5);if(_0x3611d5['uniqueid']==_0x3611d5[_0x9b44('0x19')]&&_0x3611d5[_0x9b44('0xb')]!=_0x9b44('0x1a')){utils['info'](util[_0x9b44('0x9')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x3611d5[_0x9b44('0x5')],_0x3611d5[_0x9b44('0x1b')],_0x3611d5[_0x9b44('0x1c')]));channels[_0x3611d5['uniqueid']]={'uniqueid':_0x3611d5[_0x9b44('0x5')],'accountcode':_0x3611d5[_0x9b44('0x12')],'source':_0x3611d5['calleridnum'],'destination':_0x3611d5[_0x9b44('0x1c')],'destinationcontext':_0x3611d5[_0x9b44('0x1b')],'channel':_0x3611d5['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9b44('0x3'),'amaflags':_0x9b44('0x1d')};}}catch(_0x3a39f7){utils[_0x9b44('0x1e')](util['format'](_0x9b44('0x1f'),_0x3611d5[_0x9b44('0x5')]),_0x3a39f7);}};exports['newstate']=function(_0x502a57){try{utils['debug'](util[_0x9b44('0x9')]('[%s][calls][newstate]',_0x502a57[_0x9b44('0x5')]),_0x502a57);if(!_[_0x9b44('0x20')](channels[_0x502a57[_0x9b44('0x5')]])&&_0x502a57[_0x9b44('0x21')]==0x6){utils['info'](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x502a57[_0x9b44('0x5')],_0x502a57[_0x9b44('0x1b')],_0x502a57['channel']));if(_['isNil'](channels[_0x502a57['uniqueid']][_0x9b44('0x22')])){channels[_0x502a57[_0x9b44('0x5')]]['systemanswertime']=utils[_0x9b44('0x23')]();}}else if(!_[_0x9b44('0x20')](channels[_0x502a57[_0x9b44('0x19')]])&&_0x502a57['channelstate']==0x6&&_0x502a57[_0x9b44('0x1b')]!=_0x9b44('0x24')){utils['info'](util[_0x9b44('0x9')](_0x9b44('0x25'),_0x502a57[_0x9b44('0x5')],_0x502a57[_0x9b44('0x19')],_0x502a57[_0x9b44('0x1b')],_0x502a57[_0x9b44('0xb')]));channels[_0x502a57['linkedid']][_0x9b44('0x12')]=_0x502a57[_0x9b44('0x12')];channels[_0x502a57[_0x9b44('0x19')]][_0x9b44('0x26')]=_0x502a57[_0x9b44('0xb')];if(_['isNil'](channels[_0x502a57[_0x9b44('0x19')]]['answertime'])){channels[_0x502a57[_0x9b44('0x19')]][_0x9b44('0x27')]=utils[_0x9b44('0x23')]();}channels[_0x502a57[_0x9b44('0x19')]][_0x9b44('0x28')]=dispositions[_[_0x9b44('0x29')](_0x502a57[_0x9b44('0x21')])]||_0x9b44('0x2a');}}catch(_0x1af553){utils[_0x9b44('0x1e')](util[_0x9b44('0x9')](_0x9b44('0x2b'),_0x502a57[_0x9b44('0x5')]),_0x1af553);}};exports['hangup']=function(_0x24e690){try{if(!_[_0x9b44('0x20')](channels[_0x24e690[_0x9b44('0x5')]])){utils[_0x9b44('0x18')](util[_0x9b44('0x9')](_0x9b44('0x2c'),_0x24e690[_0x9b44('0x5')]),_0x24e690);if(_[_0x9b44('0x20')](channels[_0x24e690[_0x9b44('0x5')]][_0x9b44('0x2d')])){channels[_0x24e690[_0x9b44('0x5')]][_0x9b44('0x2d')]=_0x24e690[_0x9b44('0x2e')]+'\x20<'+_0x24e690[_0x9b44('0xf')]+'>';}utils[_0x9b44('0x8')](util['format'](_0x9b44('0x2f'),_0x24e690[_0x9b44('0x5')],channels[_0x24e690[_0x9b44('0x5')]][_0x9b44('0x2d')],_0x24e690['cause-txt']));channels[_0x24e690[_0x9b44('0x5')]]['endtime']=utils[_0x9b44('0x23')]();channels[_0x24e690[_0x9b44('0x5')]][_0x9b44('0x30')]=utils['diffTime'](channels[_0x24e690[_0x9b44('0x5')]][_0x9b44('0x31')],channels[_0x24e690[_0x9b44('0x5')]][_0x9b44('0x32')]);channels[_0x24e690[_0x9b44('0x5')]]['billableseconds']=channels[_0x24e690[_0x9b44('0x5')]][_0x9b44('0x27')]?utils[_0x9b44('0x33')](channels[_0x24e690[_0x9b44('0x5')]][_0x9b44('0x31')],channels[_0x24e690[_0x9b44('0x5')]]['answertime']):0x0;writeDB(channels[_0x24e690[_0x9b44('0x5')]]);}}catch(_0x36d160){utils['error'](util[_0x9b44('0x9')](_0x9b44('0x2c'),_0x24e690[_0x9b44('0x5')]),_0x36d160);}};exports[_0x9b44('0x34')]=function(_0x1264ee){try{if(!_[_0x9b44('0x20')](channels[_0x1264ee[_0x9b44('0x35')]])){utils['debug'](util[_0x9b44('0x9')](_0x9b44('0x36'),_0x1264ee[_0x9b44('0x37')]),_0x1264ee);if(channels[_0x1264ee[_0x9b44('0x35')]][_0x9b44('0xb')]==_0x1264ee['transfereechannel']){utils[_0x9b44('0x8')](util[_0x9b44('0x9')](_0x9b44('0x38'),_0x1264ee[_0x9b44('0x37')],_0x1264ee[_0x9b44('0x35')],_0x1264ee[_0x9b44('0x39')]));channels[_0x1264ee[_0x9b44('0x35')]][_0x9b44('0x26')]=_0x1264ee['secondtransfererchannel'];channels[_0x1264ee[_0x9b44('0x35')]][_0x9b44('0x3a')]=_0x9b44('0x3b');}else if(channels[_0x1264ee['localtwolinkedid']][_0x9b44('0xb')]=_0x1264ee[_0x9b44('0x3c')]){utils[_0x9b44('0x8')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x1264ee['origtransfereruniqueid'],_0x1264ee['localtwolinkedid'],_0x1264ee['origtransfererchannel']));channels[_0x1264ee[_0x9b44('0x35')]][_0x9b44('0x26')]=_0x1264ee['origtransfererchannel'];channels[_0x1264ee[_0x9b44('0x35')]]['userfield']=_0x9b44('0x3b');}}}catch(_0x364473){utils[_0x9b44('0x1e')](util['format'](_0x9b44('0x36'),_0x1264ee[_0x9b44('0x37')]),_0x364473);}};exports[_0x9b44('0x3d')]=function(_0xd5ac1f){try{if(!_[_0x9b44('0x20')](channels[_0xd5ac1f[_0x9b44('0x5')]])){utils['debug'](util[_0x9b44('0x9')](_0x9b44('0x3e'),_0xd5ac1f[_0x9b44('0x5')]),_0xd5ac1f);channels[_0xd5ac1f[_0x9b44('0x5')]]['musiconholdstartAt']=utils[_0x9b44('0x23')]();utils[_0x9b44('0x8')](util[_0x9b44('0x9')](_0x9b44('0x3f'),_0xd5ac1f[_0x9b44('0x5')],channels[_0xd5ac1f[_0x9b44('0x5')]][_0x9b44('0x40')]));}}catch(_0xc609ae){utils[_0x9b44('0x1e')](util[_0x9b44('0x9')](_0x9b44('0x3e'),_0xd5ac1f[_0x9b44('0x5')]),_0xc609ae);}};exports[_0x9b44('0x41')]=function(_0x12dc0a){try{if(!_[_0x9b44('0x20')](channels[_0x12dc0a[_0x9b44('0x5')]])){utils[_0x9b44('0x18')](util[_0x9b44('0x9')]('[%s][calls][musiconholdstop]',_0x12dc0a[_0x9b44('0x5')]),_0x12dc0a);if(!_[_0x9b44('0x20')](channels[_0x12dc0a[_0x9b44('0x5')]]['musiconholdstartAt'])){channels[_0x12dc0a[_0x9b44('0x5')]]['mohtime']+=utils[_0x9b44('0x33')](utils['now'](),channels[_0x12dc0a['uniqueid']]['musiconholdstartAt']);utils[_0x9b44('0x8')](util[_0x9b44('0x9')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x12dc0a[_0x9b44('0x5')],channels[_0x12dc0a[_0x9b44('0x5')]][_0x9b44('0x42')]));delete channels[_0x12dc0a['uniqueid']]['musiconholdstartAt'];}}}catch(_0x49155c){utils['error'](util[_0x9b44('0x9')]('[%s][calls][musiconholdstop]',_0x12dc0a[_0x9b44('0x5')]),_0x49155c);}};exports[_0x9b44('0x43')]=function(_0x39931b){try{if(!_['isNil'](channels[_0x39931b[_0x9b44('0x5')]])){utils[_0x9b44('0x18')](util[_0x9b44('0x9')](_0x9b44('0x44'),_0x39931b[_0x9b44('0x5')]),_0x39931b);if(!_[_0x9b44('0x20')](_0x39931b[_0x9b44('0x45')][_0x9b44('0x46')])){utils[_0x9b44('0x8')](util['format'](_0x9b44('0x47'),_0x39931b[_0x9b44('0x5')],_0x39931b['value']));channels[_0x39931b[_0x9b44('0x5')]]['source']=_0x39931b[_0x9b44('0x48')];}if(!_['isNil'](_0x39931b['variable'][_0x9b44('0x49')])){utils[_0x9b44('0x8')](util[_0x9b44('0x9')](_0x9b44('0x4a'),_0x39931b[_0x9b44('0x5')],_0x39931b['value']));channels[_0x39931b[_0x9b44('0x5')]][_0x9b44('0x4b')]=_0x39931b[_0x9b44('0x48')];channels[_0x39931b[_0x9b44('0x5')]][_0x9b44('0x2d')]='\x22'+_0x39931b[_0x9b44('0x48')]+_0x9b44('0x4c')+_0x39931b[_0x9b44('0x48')]+'>';}if(!_['isNil'](_0x39931b[_0x9b44('0x45')][_0x9b44('0x4d')])||!_[_0x9b44('0x20')](_0x39931b[_0x9b44('0x45')]['xmd-callerid'])){utils[_0x9b44('0x8')](util[_0x9b44('0x9')](_0x9b44('0x4e'),_0x39931b['uniqueid'],!_[_0x9b44('0x20')](_0x39931b[_0x9b44('0x45')][_0x9b44('0x4d')])?_0x9b44('0x4d'):_0x9b44('0x4f'),_0x39931b[_0x9b44('0x48')]));channels[_0x39931b['uniqueid']][_0x9b44('0x2d')]=_0x39931b[_0x9b44('0x48')];}if(!_['isNil'](_0x39931b['variable']['xmd-queue'])||!_[_0x9b44('0x20')](_0x39931b[_0x9b44('0x45')][_0x9b44('0x50')])){utils[_0x9b44('0x8')](util[_0x9b44('0x9')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x39931b['uniqueid'],!_['isNil'](_0x39931b['variable'][_0x9b44('0x51')])?_0x9b44('0x51'):_0x9b44('0x50'),_0x39931b[_0x9b44('0x48')]));channels[_0x39931b['uniqueid']][_0x9b44('0x52')]=_0x9b44('0x53');channels[_0x39931b[_0x9b44('0x5')]][_0x9b44('0x54')]=_0x39931b[_0x9b44('0x48')];channels[_0x39931b[_0x9b44('0x5')]]['queue']=!![];}if(!_[_0x9b44('0x20')](_0x39931b[_0x9b44('0x45')][_0x9b44('0x55')])){utils[_0x9b44('0x8')](util[_0x9b44('0x9')](_0x9b44('0x56'),_0x39931b[_0x9b44('0x5')],_0x39931b[_0x9b44('0x48')]));channels[_0x39931b[_0x9b44('0x5')]]['ContactId']=_0x39931b['value'];}if(!_[_0x9b44('0x20')](_0x39931b[_0x9b44('0x45')][_0x9b44('0x57')])){utils[_0x9b44('0x8')](util[_0x9b44('0x9')](_0x9b44('0x58'),_0x39931b[_0x9b44('0x5')],_0x39931b[_0x9b44('0x48')]));channels[_0x39931b[_0x9b44('0x5')]]['type']=_0x39931b[_0x9b44('0x48')];}if(!_[_0x9b44('0x20')](_0x39931b[_0x9b44('0x45')]['outboundrouteid'])){utils[_0x9b44('0x8')](util[_0x9b44('0x9')](_0x9b44('0x59'),_0x39931b[_0x9b44('0x5')],_0x39931b[_0x9b44('0x48')]));channels[_0x39931b[_0x9b44('0x5')]][_0x9b44('0x5a')]=_0x39931b[_0x9b44('0x48')];}if(!_[_0x9b44('0x20')](_0x39931b[_0x9b44('0x45')][_0x9b44('0x5b')])){utils[_0x9b44('0x8')](util['format'](_0x9b44('0x5c'),_0x39931b['uniqueid'],_0x39931b[_0x9b44('0x48')]));channels[_0x39931b[_0x9b44('0x5')]][_0x9b44('0x5b')]=_0x39931b[_0x9b44('0x48')];}}}catch(_0x2c2692){utils[_0x9b44('0x1e')](util['format'](_0x9b44('0x44'),_0x39931b[_0x9b44('0x5')]),_0x2c2692);}};exports[_0x9b44('0x5d')]=function(_0x2234c3){try{if(!_[_0x9b44('0x20')](channels[_0x2234c3[_0x9b44('0x5')]])){utils[_0x9b44('0x18')](util[_0x9b44('0x9')](_0x9b44('0x5e'),_0x2234c3[_0x9b44('0x5')]),_0x2234c3);utils[_0x9b44('0x8')](util[_0x9b44('0x9')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x2234c3[_0x9b44('0x5')],_0x2234c3[_0x9b44('0x5f')],_0x2234c3[_0x9b44('0x60')]));if(_0x2234c3[_0x9b44('0x5f')]['toLowerCase']()==_0x9b44('0x61')&&_[_0x9b44('0x62')](_0x2234c3[_0x9b44('0x60')][_0x9b44('0x63')](),_0x9b44('0x64'))){var _0x69dcca=_0x2234c3[_0x9b44('0x60')]['split']('=');var _0x43ebc9=_0x69dcca[0x0][_0x9b44('0x65')](_0x69dcca[0x0][_0x9b44('0x66')]('(')+0x1,_0x69dcca[0x0][_0x9b44('0x66')](')'));var _0x2af198=_0x69dcca[0x1];channels[_0x2234c3[_0x9b44('0x5')]][_0x43ebc9]=_0x2af198;}if(!_[_0x9b44('0x67')]([_0x9b44('0x68'),_0x9b44('0x69'),_0x9b44('0x6a'),'set',_0x9b44('0x6b')],_0x2234c3[_0x9b44('0x5f')]['toLowerCase']())){channels[_0x2234c3['uniqueid']]['lastapplication']=_0x2234c3[_0x9b44('0x5f')];channels[_0x2234c3[_0x9b44('0x5')]][_0x9b44('0x54')]=_0x2234c3[_0x9b44('0x60')];}}}catch(_0x7520e0){utils[_0x9b44('0x1e')](util[_0x9b44('0x9')](_0x9b44('0x5e'),_0x2234c3['uniqueid']),_0x7520e0);}}; \ No newline at end of file +var _0x6338=['now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','toNumber','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','answertime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','split','substring','lastIndexOf','includes','hangup','noop','toLowerCase','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0x6338,0x199));var _0x8633=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6338[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8633('0x0'));var util=require(_0x8633('0x1'));var utils=require(_0x8633('0x2'));var transfers=require(_0x8633('0x3'));var dispositions=[_0x8633('0x4'),_0x8633('0x5'),_0x8633('0x5'),_0x8633('0x4'),_0x8633('0x4'),'NO\x20ANSWER',_0x8633('0x6'),_0x8633('0x7'),_0x8633('0x5'),_0x8633('0x5'),_0x8633('0x5')];var channels={};function writeDB(_0x59d760){var _0x191b04;if(transfers[_0x8633('0x8')][_0x59d760[_0x8633('0x9')]]){_0x191b04=_0x59d760[_0x8633('0x9')];_0x59d760['uniqueid']=transfers['blinds'][_0x59d760['uniqueid']][_0x8633('0xa')];}utils['info'](util[_0x8633('0xb')](_0x8633('0xc'),_0x59d760[_0x8633('0x9')],_0x59d760[_0x8633('0xd')],_0x59d760[_0x8633('0xe')],_0x59d760[_0x8633('0xf')],_0x59d760[_0x8633('0x10')],_0x59d760[_0x8633('0x11')],_0x59d760[_0x8633('0x12')],_0x59d760[_0x8633('0x13')]));if(_0x59d760['accountcode']){utils[_0x8633('0x14')](_0x59d760[_0x8633('0x15')])[_0x8633('0x16')](function(_0x39ad70){if(_0x39ad70){_0x59d760[_0x8633('0x17')]=_0x39ad70['id'];}utils[_0x8633('0x18')](_0x8633('0x19'),_0x59d760);});}else{utils['request'](_0x8633('0x19'),_0x59d760);}if(channels[_0x59d760[_0x8633('0x9')]]){delete channels[_0x59d760[_0x8633('0x9')]];}else if(_0x191b04&&channels[_0x191b04]){delete transfers['blinds'][_0x191b04];delete channels[_0x191b04];}}exports[_0x8633('0x1a')]=function(_0x6cb7de){try{utils[_0x8633('0x1b')](util[_0x8633('0xb')](_0x8633('0x1c'),_0x6cb7de['uniqueid']),_0x6cb7de);if(_0x6cb7de[_0x8633('0x9')]==_0x6cb7de[_0x8633('0x1d')]&&_0x6cb7de[_0x8633('0xd')]!=_0x8633('0x1e')){utils[_0x8633('0x1f')](util[_0x8633('0xb')](_0x8633('0x20'),_0x6cb7de['uniqueid'],_0x6cb7de[_0x8633('0x21')],_0x6cb7de[_0x8633('0x22')]));channels[_0x6cb7de[_0x8633('0x9')]]={'uniqueid':_0x6cb7de[_0x8633('0x9')],'accountcode':_0x6cb7de['accountcode'],'source':_0x6cb7de[_0x8633('0x11')],'destination':_0x6cb7de[_0x8633('0x22')],'destinationcontext':_0x6cb7de[_0x8633('0x21')],'channel':_0x6cb7de[_0x8633('0xd')],'starttime':utils[_0x8633('0x23')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x8633('0x24')};}}catch(_0x190f52){utils[_0x8633('0x25')](util[_0x8633('0xb')]('[%s][calls][newchannel]',_0x6cb7de[_0x8633('0x9')]),_0x190f52);}};exports[_0x8633('0x26')]=function(_0x1a651b){try{utils[_0x8633('0x1b')](util[_0x8633('0xb')](_0x8633('0x27'),_0x1a651b[_0x8633('0x9')]),_0x1a651b);if(!_[_0x8633('0x28')](channels[_0x1a651b[_0x8633('0x9')]])&&_0x1a651b[_0x8633('0x29')]==0x6){utils[_0x8633('0x1f')](util[_0x8633('0xb')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x1a651b[_0x8633('0x9')],_0x1a651b[_0x8633('0x21')],_0x1a651b[_0x8633('0xd')]));if(_[_0x8633('0x28')](channels[_0x1a651b[_0x8633('0x9')]][_0x8633('0x2a')])){channels[_0x1a651b[_0x8633('0x9')]][_0x8633('0x2a')]=utils[_0x8633('0x23')]();}}else if(!_[_0x8633('0x28')](channels[_0x1a651b['linkedid']])&&_0x1a651b[_0x8633('0x29')]==0x6&&_0x1a651b[_0x8633('0x21')]!=_0x8633('0x2b')){utils[_0x8633('0x1f')](util[_0x8633('0xb')](_0x8633('0x2c'),_0x1a651b[_0x8633('0x9')],_0x1a651b[_0x8633('0x1d')],_0x1a651b['context'],_0x1a651b[_0x8633('0xd')]));channels[_0x1a651b['linkedid']][_0x8633('0x15')]=_0x1a651b[_0x8633('0x15')];channels[_0x1a651b['linkedid']][_0x8633('0x2d')]=_0x1a651b[_0x8633('0xd')];if(_[_0x8633('0x28')](channels[_0x1a651b[_0x8633('0x1d')]]['answertime'])){channels[_0x1a651b['linkedid']]['answertime']=utils[_0x8633('0x23')]();}channels[_0x1a651b[_0x8633('0x1d')]]['disposition']=dispositions[_[_0x8633('0x2e')](_0x1a651b['channelstate'])]||_0x8633('0x6');}}catch(_0x29d0ba){utils[_0x8633('0x25')](util[_0x8633('0xb')](_0x8633('0x27'),_0x1a651b[_0x8633('0x9')]),_0x29d0ba);}};exports['hangup']=function(_0x159745){try{if(!_[_0x8633('0x28')](channels[_0x159745['uniqueid']])){utils[_0x8633('0x1b')](util[_0x8633('0xb')]('[%s][calls][hangup]',_0x159745[_0x8633('0x9')]),_0x159745);if(_[_0x8633('0x28')](channels[_0x159745[_0x8633('0x9')]][_0x8633('0x2f')])){channels[_0x159745[_0x8633('0x9')]][_0x8633('0x2f')]=_0x159745[_0x8633('0x30')]+'\x20<'+_0x159745[_0x8633('0x11')]+'>';}utils[_0x8633('0x1f')](util[_0x8633('0xb')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x159745['uniqueid'],channels[_0x159745[_0x8633('0x9')]]['callerid'],_0x159745[_0x8633('0x31')]));channels[_0x159745[_0x8633('0x9')]][_0x8633('0x32')]=utils['now']();channels[_0x159745[_0x8633('0x9')]][_0x8633('0x33')]=utils[_0x8633('0x34')](channels[_0x159745['uniqueid']]['endtime'],channels[_0x159745['uniqueid']][_0x8633('0x35')]);channels[_0x159745['uniqueid']]['billableseconds']=channels[_0x159745[_0x8633('0x9')]][_0x8633('0x36')]?utils['diffTime'](channels[_0x159745[_0x8633('0x9')]][_0x8633('0x32')],channels[_0x159745[_0x8633('0x9')]][_0x8633('0x36')]):0x0;writeDB(channels[_0x159745[_0x8633('0x9')]]);}}catch(_0x123030){utils[_0x8633('0x25')](util['format']('[%s][calls][hangup]',_0x159745[_0x8633('0x9')]),_0x123030);}};exports[_0x8633('0x37')]=function(_0x4c74d0){try{if(!_[_0x8633('0x28')](channels[_0x4c74d0[_0x8633('0x38')]])){utils[_0x8633('0x1b')](util[_0x8633('0xb')](_0x8633('0x39'),_0x4c74d0[_0x8633('0x3a')]),_0x4c74d0);if(channels[_0x4c74d0['localtwolinkedid']][_0x8633('0xd')]==_0x4c74d0[_0x8633('0x3b')]){utils['info'](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4c74d0[_0x8633('0x3a')],_0x4c74d0[_0x8633('0x38')],_0x4c74d0[_0x8633('0x3c')]));channels[_0x4c74d0[_0x8633('0x38')]][_0x8633('0x2d')]=_0x4c74d0[_0x8633('0x3c')];channels[_0x4c74d0[_0x8633('0x38')]][_0x8633('0x3d')]=_0x8633('0x3e');}else if(channels[_0x4c74d0[_0x8633('0x38')]]['channel']=_0x4c74d0[_0x8633('0x3f')]){utils['info'](util[_0x8633('0xb')](_0x8633('0x40'),_0x4c74d0['origtransfereruniqueid'],_0x4c74d0['localtwolinkedid'],_0x4c74d0[_0x8633('0x41')]));channels[_0x4c74d0[_0x8633('0x38')]][_0x8633('0x2d')]=_0x4c74d0[_0x8633('0x41')];channels[_0x4c74d0[_0x8633('0x38')]][_0x8633('0x3d')]=_0x8633('0x3e');}}}catch(_0x53a313){utils[_0x8633('0x25')](util[_0x8633('0xb')](_0x8633('0x39'),_0x4c74d0[_0x8633('0x3a')]),_0x53a313);}};exports['musiconholdstart']=function(_0x575391){try{if(!_[_0x8633('0x28')](channels[_0x575391[_0x8633('0x9')]])){utils['debug'](util[_0x8633('0xb')](_0x8633('0x42'),_0x575391[_0x8633('0x9')]),_0x575391);channels[_0x575391['uniqueid']][_0x8633('0x43')]=utils['now']();utils[_0x8633('0x1f')](util[_0x8633('0xb')](_0x8633('0x44'),_0x575391['uniqueid'],channels[_0x575391['uniqueid']][_0x8633('0x43')]));}}catch(_0x3757de){utils[_0x8633('0x25')](util['format'](_0x8633('0x42'),_0x575391[_0x8633('0x9')]),_0x3757de);}};exports['musiconholdstop']=function(_0x3ec731){try{if(!_['isNil'](channels[_0x3ec731[_0x8633('0x9')]])){utils[_0x8633('0x1b')](util['format'](_0x8633('0x45'),_0x3ec731[_0x8633('0x9')]),_0x3ec731);if(!_[_0x8633('0x28')](channels[_0x3ec731[_0x8633('0x9')]][_0x8633('0x43')])){channels[_0x3ec731['uniqueid']]['mohtime']+=utils[_0x8633('0x34')](utils[_0x8633('0x23')](),channels[_0x3ec731['uniqueid']]['musiconholdstartAt']);utils[_0x8633('0x1f')](util[_0x8633('0xb')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x3ec731['uniqueid'],channels[_0x3ec731[_0x8633('0x9')]][_0x8633('0x46')]));delete channels[_0x3ec731['uniqueid']][_0x8633('0x43')];}}}catch(_0x472896){utils['error'](util['format'](_0x8633('0x45'),_0x3ec731['uniqueid']),_0x472896);}};exports[_0x8633('0x47')]=function(_0x41f122){try{if(!_[_0x8633('0x28')](channels[_0x41f122[_0x8633('0x9')]])){utils[_0x8633('0x1b')](util[_0x8633('0xb')]('[%s][calls][varset]',_0x41f122[_0x8633('0x9')]),_0x41f122);if(!_['isNil'](_0x41f122[_0x8633('0x48')][_0x8633('0x49')])){utils[_0x8633('0x1f')](util[_0x8633('0xb')](_0x8633('0x4a'),_0x41f122['uniqueid'],_0x41f122[_0x8633('0x4b')]));channels[_0x41f122[_0x8633('0x9')]][_0x8633('0x4c')]=_0x41f122['value'];}if(!_[_0x8633('0x28')](_0x41f122['variable'][_0x8633('0x4d')])){utils[_0x8633('0x1f')](util[_0x8633('0xb')](_0x8633('0x4e'),_0x41f122[_0x8633('0x9')],_0x41f122[_0x8633('0x4b')]));channels[_0x41f122[_0x8633('0x9')]][_0x8633('0x4f')]=_0x41f122[_0x8633('0x4b')];channels[_0x41f122[_0x8633('0x9')]][_0x8633('0x2f')]='\x22'+_0x41f122[_0x8633('0x4b')]+'\x22\x20<'+_0x41f122[_0x8633('0x4b')]+'>';}if(!_[_0x8633('0x28')](_0x41f122[_0x8633('0x48')][_0x8633('0x50')])||!_['isNil'](_0x41f122[_0x8633('0x48')][_0x8633('0x51')])){utils[_0x8633('0x1f')](util[_0x8633('0xb')](_0x8633('0x52'),_0x41f122[_0x8633('0x9')],!_[_0x8633('0x28')](_0x41f122[_0x8633('0x48')]['xmd-callerid-preview'])?_0x8633('0x50'):_0x8633('0x51'),_0x41f122['value']));channels[_0x41f122['uniqueid']]['callerid']=_0x41f122[_0x8633('0x4b')];}if(!_[_0x8633('0x28')](_0x41f122['variable'][_0x8633('0x53')])||!_['isNil'](_0x41f122[_0x8633('0x48')][_0x8633('0x54')])){utils[_0x8633('0x1f')](util[_0x8633('0xb')](_0x8633('0x52'),_0x41f122['uniqueid'],!_[_0x8633('0x28')](_0x41f122[_0x8633('0x48')][_0x8633('0x53')])?'xmd-queue':_0x8633('0x54'),_0x41f122['value']));channels[_0x41f122['uniqueid']][_0x8633('0x55')]=_0x8633('0x56');channels[_0x41f122[_0x8633('0x9')]][_0x8633('0x57')]=_0x41f122[_0x8633('0x4b')];channels[_0x41f122[_0x8633('0x9')]][_0x8633('0xe')]=!![];}if(!_['isNil'](_0x41f122[_0x8633('0x48')][_0x8633('0x58')])){utils[_0x8633('0x1f')](util[_0x8633('0xb')](_0x8633('0x59'),_0x41f122[_0x8633('0x9')],_0x41f122[_0x8633('0x4b')]));channels[_0x41f122['uniqueid']][_0x8633('0x5a')]=_0x41f122[_0x8633('0x4b')];}if(!_['isNil'](_0x41f122['variable']['xmd-cdrtype'])){utils[_0x8633('0x1f')](util[_0x8633('0xb')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x41f122[_0x8633('0x9')],_0x41f122[_0x8633('0x4b')]));channels[_0x41f122[_0x8633('0x9')]][_0x8633('0x5b')]=_0x41f122[_0x8633('0x4b')];}if(!_[_0x8633('0x28')](_0x41f122['variable'][_0x8633('0x5c')])){utils['info'](util[_0x8633('0xb')](_0x8633('0x5d'),_0x41f122['uniqueid'],_0x41f122[_0x8633('0x4b')]));channels[_0x41f122[_0x8633('0x9')]][_0x8633('0x5e')]=_0x41f122[_0x8633('0x4b')];}if(!_['isNil'](_0x41f122['variable'][_0x8633('0x5f')])){utils[_0x8633('0x1f')](util[_0x8633('0xb')](_0x8633('0x60'),_0x41f122[_0x8633('0x9')],_0x41f122[_0x8633('0x4b')]));channels[_0x41f122['uniqueid']]['sipcallid']=_0x41f122[_0x8633('0x4b')];}}}catch(_0x3b4e71){utils[_0x8633('0x25')](util[_0x8633('0xb')](_0x8633('0x61'),_0x41f122['uniqueid']),_0x3b4e71);}};exports[_0x8633('0x62')]=function(_0x1d754a){try{if(!_[_0x8633('0x28')](channels[_0x1d754a[_0x8633('0x9')]])){utils[_0x8633('0x1b')](util[_0x8633('0xb')](_0x8633('0x63'),_0x1d754a[_0x8633('0x9')]),_0x1d754a);utils[_0x8633('0x1f')](util[_0x8633('0xb')](_0x8633('0x64'),_0x1d754a['uniqueid'],_0x1d754a[_0x8633('0x65')],_0x1d754a[_0x8633('0x66')]));if(_0x1d754a[_0x8633('0x65')]['toLowerCase']()==_0x8633('0x67')&&_['startsWith'](_0x1d754a[_0x8633('0x66')]['toLowerCase'](),'cdr')){var _0x138efd=_0x1d754a['appdata'][_0x8633('0x68')]('=');var _0x2367d1=_0x138efd[0x0][_0x8633('0x69')](_0x138efd[0x0][_0x8633('0x6a')]('(')+0x1,_0x138efd[0x0]['lastIndexOf'](')'));var _0x25ee8c=_0x138efd[0x1];channels[_0x1d754a[_0x8633('0x9')]][_0x2367d1]=_0x25ee8c;}if(!_[_0x8633('0x6b')]([_0x8633('0x6c'),_0x8633('0x6d'),'execif',_0x8633('0x67'),'gotoif'],_0x1d754a[_0x8633('0x65')][_0x8633('0x6e')]())){channels[_0x1d754a[_0x8633('0x9')]][_0x8633('0x55')]=_0x1d754a[_0x8633('0x65')];channels[_0x1d754a[_0x8633('0x9')]][_0x8633('0x57')]=_0x1d754a[_0x8633('0x66')];}}}catch(_0x31ddd5){utils[_0x8633('0x25')](util[_0x8633('0xb')]('[%s][calls][newexten]',_0x1d754a[_0x8633('0x9')]),_0x31ddd5);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index ba6adbf..a2032dd 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 _0x4389=['./utils','connect','info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','managerevent'];(function(_0x5f365a,_0x5da547){var _0x276814=function(_0x3a74f0){while(--_0x3a74f0){_0x5f365a['push'](_0x5f365a['shift']());}};_0x276814(++_0x5da547);}(_0x4389,0xfd));var _0x9438=function(_0x145a51,_0x3a9647){_0x145a51=_0x145a51-0x0;var _0x44bf14=_0x4389[_0x145a51];return _0x44bf14;};'use strict';var utils=require(_0x9438('0x0'));exports[_0x9438('0x1')]=function(){utils[_0x9438('0x2')](_0x9438('0x3'));};exports[_0x9438('0x4')]=function(){utils[_0x9438('0x2')]('[core]\x20shutdown');};exports[_0x9438('0x5')]=function(){utils['info'](_0x9438('0x6'));};exports[_0x9438('0x7')]=function(_0x13d5a5){utils['error'](_0x9438('0x8'),_0x13d5a5);};exports[_0x9438('0x9')]=function(){utils[_0x9438('0x2')]('[core]\x20close');};exports[_0x9438('0xa')]=function(_0x2016b6){}; \ No newline at end of file +var _0x2480=['[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x93e2fc,_0x37f6ce){var _0x2bdd60=function(_0x56b756){while(--_0x56b756){_0x93e2fc['push'](_0x93e2fc['shift']());}};_0x2bdd60(++_0x37f6ce);}(_0x2480,0x1d8));var _0x0248=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2480[_0x2dafbe];return _0x58a45a;};'use strict';var utils=require(_0x0248('0x0'));exports[_0x0248('0x1')]=function(){utils[_0x0248('0x2')](_0x0248('0x3'));};exports[_0x0248('0x4')]=function(){utils[_0x0248('0x2')](_0x0248('0x5'));};exports[_0x0248('0x6')]=function(){utils[_0x0248('0x2')](_0x0248('0x7'));};exports[_0x0248('0x8')]=function(_0x3b58ba){utils[_0x0248('0x8')](_0x0248('0x9'),_0x3b58ba);};exports[_0x0248('0xa')]=function(){utils[_0x0248('0x2')](_0x0248('0xb'));};exports[_0x0248('0xc')]=function(_0x7027fe){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index ec0ba8c..0c82262 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 _0x1436=['now','called','[%s][dials][dialbegin]','dialend','ANSWER','answertime','lastevent','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','duration','starttime','diffTime','endtime','billableseconds','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr(routeid)','error','[%s][dials][newexten]','debug','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','assign'];(function(_0x666df1,_0x2a4b08){var _0x552c3e=function(_0x33dea3){while(--_0x33dea3){_0x666df1['push'](_0x666df1['shift']());}};_0x552c3e(++_0x2a4b08);}(_0x1436,0xa4));var _0x6143=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1436[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6143('0x0'));var util=require('util');var utils=require(_0x6143('0x1'));var dials={};function writeDB(_0x1ed24d){utils[_0x6143('0x2')](util[_0x6143('0x3')](_0x6143('0x4'),_0x1ed24d[_0x6143('0x5')],_0x1ed24d[_0x6143('0x6')],_0x1ed24d[_0x6143('0x7')],_0x1ed24d['calleridnum'],_0x1ed24d[_0x6143('0x8')],_0x1ed24d[_0x6143('0x9')]));utils[_0x6143('0xa')](_0x6143('0xb'),_0x1ed24d);delete dials[_0x1ed24d[_0x6143('0x5')]];}exports[_0x6143('0xc')]=function(_0x5c1174){try{utils['debug'](util[_0x6143('0x3')]('[%s][dials][newexten]',_0x5c1174[_0x6143('0x5')]),_0x5c1174);utils[_0x6143('0x2')](util[_0x6143('0x3')](_0x6143('0xd'),_0x5c1174['uniqueid'],_0x5c1174[_0x6143('0xe')],_0x5c1174[_0x6143('0xf')]));if(_0x5c1174['application'][_0x6143('0x10')]()==_0x6143('0x11')&&_['startsWith'](_0x5c1174['appdata'][_0x6143('0x10')](),_0x6143('0x12'))){var _0x2aa979=_0x5c1174[_0x6143('0xf')]['split']('=');dials[_0x5c1174[_0x6143('0x5')]]={'routeId':_0x2aa979[0x1]};}}catch(_0x543668){utils[_0x6143('0x13')](util[_0x6143('0x3')](_0x6143('0x14'),_0x5c1174[_0x6143('0x5')]),_0x543668);}};exports['varset']=function(_0x4e8e6f){try{utils[_0x6143('0x15')](util['format']('[%s][dials][varset]',_0x4e8e6f[_0x6143('0x5')]),_0x4e8e6f);if(!_[_0x6143('0x16')](_0x4e8e6f[_0x6143('0x17')]['outboundrouteid'])){utils[_0x6143('0x2')](util[_0x6143('0x3')](_0x6143('0x18'),_0x4e8e6f[_0x6143('0x5')],_0x4e8e6f[_0x6143('0x19')]));dials[_0x4e8e6f[_0x6143('0x5')]]={'routeId':_0x4e8e6f[_0x6143('0x19')]};}}catch(_0x134cb9){utils['error'](util[_0x6143('0x3')](_0x6143('0x1a'),_0x4e8e6f[_0x6143('0x5')]),_0x134cb9);}};exports['dialbegin']=function(_0xae27b6){try{if(!_[_0x6143('0x16')](dials[_0xae27b6[_0x6143('0x5')]])){utils[_0x6143('0x15')](util[_0x6143('0x3')]('[%s][dials][dialbegin]',_0xae27b6[_0x6143('0x5')]),_0xae27b6);dials[_0xae27b6['uniqueid']]=_[_0x6143('0x1b')](dials[_0xae27b6[_0x6143('0x5')]],_0xae27b6);dials[_0xae27b6[_0x6143('0x5')]]['starttime']=utils[_0x6143('0x1c')]();dials[_0xae27b6[_0x6143('0x5')]]['lastevent']=_0x6143('0x1d');utils[_0x6143('0x2')](util[_0x6143('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0xae27b6[_0x6143('0x5')],dials[_0xae27b6['uniqueid']]['starttime']));}}catch(_0x5473fc){utils[_0x6143('0x13')](util['format'](_0x6143('0x1e'),_0xae27b6[_0x6143('0x5')]),_0x5473fc);}};exports[_0x6143('0x1f')]=function(_0x225ac1){try{if(!_[_0x6143('0x16')](dials[_0x225ac1[_0x6143('0x5')]])){utils[_0x6143('0x15')](util[_0x6143('0x3')]('[%s][dials][dialend]',_0x225ac1[_0x6143('0x5')]),_0x225ac1);dials[_0x225ac1[_0x6143('0x5')]][_0x6143('0x9')]=_0x225ac1[_0x6143('0x9')];if(_0x225ac1[_0x6143('0x9')]==_0x6143('0x20')){dials[_0x225ac1[_0x6143('0x5')]]=_[_0x6143('0x1b')](dials[_0x225ac1[_0x6143('0x5')]],_0x225ac1);dials[_0x225ac1[_0x6143('0x5')]][_0x6143('0x21')]=utils[_0x6143('0x1c')]();dials[_0x225ac1['uniqueid']][_0x6143('0x22')]='connect';utils[_0x6143('0x2')](util[_0x6143('0x3')](_0x6143('0x23'),_0x225ac1[_0x6143('0x5')],_0x225ac1[_0x6143('0x9')],dials[_0x225ac1[_0x6143('0x5')]][_0x6143('0x21')]));}else{utils[_0x6143('0x2')](util[_0x6143('0x3')](_0x6143('0x24'),_0x225ac1[_0x6143('0x5')],_0x225ac1[_0x6143('0x9')]));}}}catch(_0x3f3c62){utils['error'](util[_0x6143('0x3')](_0x6143('0x25'),_0x225ac1[_0x6143('0x5')]),_0x3f3c62);}};exports['hangup']=function(_0x50e5e1){try{if(!_[_0x6143('0x16')](dials[_0x50e5e1[_0x6143('0x5')]])){utils[_0x6143('0x15')](util[_0x6143('0x3')](_0x6143('0x26'),_0x50e5e1[_0x6143('0x5')]),_0x50e5e1);utils[_0x6143('0x2')](util[_0x6143('0x3')](_0x6143('0x27'),_0x50e5e1['uniqueid'],_0x50e5e1[_0x6143('0x28')],_0x50e5e1[_0x6143('0x29')],_0x50e5e1[_0x6143('0x2a')]));dials[_0x50e5e1['uniqueid']]=_[_0x6143('0x1b')](dials[_0x50e5e1[_0x6143('0x5')]],{'endtime':utils[_0x6143('0x1c')](),'lastevent':'complete'});dials[_0x50e5e1['uniqueid']][_0x6143('0x2b')]=utils['diffTime'](dials[_0x50e5e1['uniqueid']]['endtime'],dials[_0x50e5e1['uniqueid']][_0x6143('0x2c')]);dials[_0x50e5e1[_0x6143('0x5')]]['holdtime']=utils[_0x6143('0x2d')](dials[_0x50e5e1[_0x6143('0x5')]][_0x6143('0x21')]||dials[_0x50e5e1[_0x6143('0x5')]][_0x6143('0x2e')],dials[_0x50e5e1[_0x6143('0x5')]][_0x6143('0x2c')]);dials[_0x50e5e1[_0x6143('0x5')]][_0x6143('0x2f')]=dials[_0x50e5e1[_0x6143('0x5')]][_0x6143('0x21')]?utils['diffTime'](dials[_0x50e5e1[_0x6143('0x5')]][_0x6143('0x2e')],dials[_0x50e5e1[_0x6143('0x5')]]['answertime']):0x0;writeDB(dials[_0x50e5e1[_0x6143('0x5')]]);}}catch(_0x3cc86e){utils['error'](util[_0x6143('0x3')](_0x6143('0x26'),_0x50e5e1[_0x6143('0x5')]),_0x3cc86e);}}; \ No newline at end of file +var _0x8786=['lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','error','dialend','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','split','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now'];(function(_0x4ec556,_0x475548){var _0x4ac4d2=function(_0x1f8112){while(--_0x1f8112){_0x4ec556['push'](_0x4ec556['shift']());}};_0x4ac4d2(++_0x475548);}(_0x8786,0x1cd));var _0x6878=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8786[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x6878('0x0'));var util=require(_0x6878('0x1'));var utils=require(_0x6878('0x2'));var dials={};function writeDB(_0x5bc05c){utils[_0x6878('0x3')](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x5bc05c[_0x6878('0x4')],_0x5bc05c[_0x6878('0x5')],_0x5bc05c[_0x6878('0x6')],_0x5bc05c[_0x6878('0x7')],_0x5bc05c[_0x6878('0x8')],_0x5bc05c[_0x6878('0x9')]));utils[_0x6878('0xa')](_0x6878('0xb'),_0x5bc05c);delete dials[_0x5bc05c[_0x6878('0x4')]];}exports[_0x6878('0xc')]=function(_0x51d41e){try{utils[_0x6878('0xd')](util[_0x6878('0xe')]('[%s][dials][newexten]',_0x51d41e[_0x6878('0x4')]),_0x51d41e);utils['info'](util[_0x6878('0xe')](_0x6878('0xf'),_0x51d41e[_0x6878('0x4')],_0x51d41e['application'],_0x51d41e[_0x6878('0x10')]));if(_0x51d41e[_0x6878('0x11')][_0x6878('0x12')]()==_0x6878('0x13')&&_[_0x6878('0x14')](_0x51d41e[_0x6878('0x10')]['toLowerCase'](),'cdr(routeid)')){var _0x52c836=_0x51d41e[_0x6878('0x10')][_0x6878('0x15')]('=');dials[_0x51d41e['uniqueid']]={'routeId':_0x52c836[0x1]};}}catch(_0x52fd9b){utils['error'](util['format'](_0x6878('0x16'),_0x51d41e[_0x6878('0x4')]),_0x52fd9b);}};exports[_0x6878('0x17')]=function(_0x324d15){try{utils[_0x6878('0xd')](util[_0x6878('0xe')](_0x6878('0x18'),_0x324d15[_0x6878('0x4')]),_0x324d15);if(!_[_0x6878('0x19')](_0x324d15[_0x6878('0x1a')]['outboundrouteid'])){utils[_0x6878('0x3')](util['format'](_0x6878('0x1b'),_0x324d15[_0x6878('0x4')],_0x324d15[_0x6878('0x1c')]));dials[_0x324d15[_0x6878('0x4')]]={'routeId':_0x324d15[_0x6878('0x1c')]};}}catch(_0x3597d7){utils['error'](util[_0x6878('0xe')](_0x6878('0x18'),_0x324d15[_0x6878('0x4')]),_0x3597d7);}};exports[_0x6878('0x1d')]=function(_0x25ea8c){try{if(!_[_0x6878('0x19')](dials[_0x25ea8c[_0x6878('0x4')]])){utils['debug'](util['format'](_0x6878('0x1e'),_0x25ea8c[_0x6878('0x4')]),_0x25ea8c);dials[_0x25ea8c[_0x6878('0x4')]]=_[_0x6878('0x1f')](dials[_0x25ea8c[_0x6878('0x4')]],_0x25ea8c);dials[_0x25ea8c[_0x6878('0x4')]][_0x6878('0x20')]=utils[_0x6878('0x21')]();dials[_0x25ea8c[_0x6878('0x4')]][_0x6878('0x22')]=_0x6878('0x23');utils[_0x6878('0x3')](util[_0x6878('0xe')](_0x6878('0x24'),_0x25ea8c[_0x6878('0x4')],dials[_0x25ea8c[_0x6878('0x4')]]['starttime']));}}catch(_0x65c066){utils[_0x6878('0x25')](util[_0x6878('0xe')](_0x6878('0x1e'),_0x25ea8c['uniqueid']),_0x65c066);}};exports[_0x6878('0x26')]=function(_0x3fe531){try{if(!_['isNil'](dials[_0x3fe531[_0x6878('0x4')]])){utils['debug'](util['format']('[%s][dials][dialend]',_0x3fe531[_0x6878('0x4')]),_0x3fe531);dials[_0x3fe531[_0x6878('0x4')]][_0x6878('0x9')]=_0x3fe531[_0x6878('0x9')];if(_0x3fe531[_0x6878('0x9')]=='ANSWER'){dials[_0x3fe531[_0x6878('0x4')]]=_[_0x6878('0x1f')](dials[_0x3fe531[_0x6878('0x4')]],_0x3fe531);dials[_0x3fe531[_0x6878('0x4')]][_0x6878('0x27')]=utils[_0x6878('0x21')]();dials[_0x3fe531['uniqueid']]['lastevent']=_0x6878('0x28');utils[_0x6878('0x3')](util[_0x6878('0xe')](_0x6878('0x29'),_0x3fe531[_0x6878('0x4')],_0x3fe531[_0x6878('0x9')],dials[_0x3fe531[_0x6878('0x4')]]['answertime']));}else{utils[_0x6878('0x3')](util[_0x6878('0xe')](_0x6878('0x2a'),_0x3fe531[_0x6878('0x4')],_0x3fe531['dialstatus']));}}}catch(_0x4557f0){utils[_0x6878('0x25')](util[_0x6878('0xe')](_0x6878('0x2b'),_0x3fe531[_0x6878('0x4')]),_0x4557f0);}};exports[_0x6878('0x2c')]=function(_0x291f80){try{if(!_[_0x6878('0x19')](dials[_0x291f80[_0x6878('0x4')]])){utils[_0x6878('0xd')](util[_0x6878('0xe')](_0x6878('0x2d'),_0x291f80[_0x6878('0x4')]),_0x291f80);utils[_0x6878('0x3')](util[_0x6878('0xe')](_0x6878('0x2e'),_0x291f80[_0x6878('0x4')],_0x291f80[_0x6878('0x7')],_0x291f80[_0x6878('0x2f')],_0x291f80[_0x6878('0x30')]));dials[_0x291f80['uniqueid']]=_[_0x6878('0x1f')](dials[_0x291f80[_0x6878('0x4')]],{'endtime':utils[_0x6878('0x21')](),'lastevent':_0x6878('0x31')});dials[_0x291f80['uniqueid']][_0x6878('0x32')]=utils[_0x6878('0x33')](dials[_0x291f80[_0x6878('0x4')]][_0x6878('0x34')],dials[_0x291f80['uniqueid']][_0x6878('0x20')]);dials[_0x291f80[_0x6878('0x4')]][_0x6878('0x35')]=utils[_0x6878('0x33')](dials[_0x291f80['uniqueid']]['answertime']||dials[_0x291f80[_0x6878('0x4')]][_0x6878('0x34')],dials[_0x291f80[_0x6878('0x4')]][_0x6878('0x20')]);dials[_0x291f80[_0x6878('0x4')]][_0x6878('0x36')]=dials[_0x291f80[_0x6878('0x4')]][_0x6878('0x27')]?utils[_0x6878('0x33')](dials[_0x291f80[_0x6878('0x4')]]['endtime'],dials[_0x291f80[_0x6878('0x4')]][_0x6878('0x27')]):0x0;writeDB(dials[_0x291f80[_0x6878('0x4')]]);}}catch(_0x237c74){utils[_0x6878('0x25')](util[_0x6878('0xe')](_0x6878('0x2d'),_0x291f80['uniqueid']),_0x237c74);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 1499dff..90b5b13 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 _0xe6ad=['device','devicestatechange','format','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialend]','asterisk-manager','./utils','util','asterisk','username','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','[%s][index][devicestatechange]'];(function(_0x154075,_0x8b3c38){var _0x3ea7ba=function(_0x78e624){while(--_0x78e624){_0x154075['push'](_0x154075['shift']());}};_0x3ea7ba(++_0x8b3c38);}(_0xe6ad,0x1da));var _0xde6a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xe6ad[_0x13d07a];return _0x5ee0ee;};var AsteriskManager=require(_0xde6a('0x0'));var config=require('../../config/environment');var utils=require(_0xde6a('0x1'));var util=require(_0xde6a('0x2'));var ami=new AsteriskManager(config[_0xde6a('0x3')]['port'],config[_0xde6a('0x3')]['ip'],config[_0xde6a('0x3')][_0xde6a('0x4')],config['asterisk']['password'],!![]);ami['keepConnected']();if(config[_0xde6a('0x5')]&&config[_0xde6a('0x5')][_0xde6a('0x6')]){utils[_0xde6a('0x7')](_0xde6a('0x8'));}else{var agents=require(_0xde6a('0x9'));var calls=require(_0xde6a('0xa'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0xde6a('0xb'));var dials=require('./dials.controller');var transfers=require(_0xde6a('0xc'));var core=require(_0xde6a('0xd'));ami['on']('connect',core[_0xde6a('0xe')]);ami['on'](_0xde6a('0xf'),core[_0xde6a('0xf')]);ami['on'](_0xde6a('0x10'),core[_0xde6a('0x10')]);ami['on'](_0xde6a('0x11'),core[_0xde6a('0x11')]);ami['on'](_0xde6a('0x12'),core[_0xde6a('0x12')]);ami['on'](_0xde6a('0x13'),core['managerevent']);ami['on']('devicestatechange',function(_0x153a35){try{utils[_0xde6a('0x14')](util['format'](_0xde6a('0x15'),_0x153a35[_0xde6a('0x16')]),_0x153a35);members[_0xde6a('0x17')](_0x153a35);}catch(_0x5d1377){utils[_0xde6a('0x11')](util['format'](_0xde6a('0x15'),_0x153a35['device']),_0x5d1377);}});ami['on']('agentcalled',function(_0x332c5c){try{utils[_0xde6a('0x14')](util[_0xde6a('0x18')](_0xde6a('0x19'),_0x332c5c[_0xde6a('0x1a')]),_0x332c5c);agents[_0xde6a('0x1b')](_0x332c5c);}catch(_0x49b0db){utils[_0xde6a('0x11')](util[_0xde6a('0x18')](_0xde6a('0x19'),_0x332c5c[_0xde6a('0x1a')]),_0x49b0db);}});ami['on'](_0xde6a('0x1c'),function(_0x3685ab){try{utils['debug'](util['format'](_0xde6a('0x1d'),_0x3685ab[_0xde6a('0x1a')]),_0x3685ab);agents[_0xde6a('0x1c')](_0x3685ab);}catch(_0x4393e3){utils[_0xde6a('0x11')](util[_0xde6a('0x18')](_0xde6a('0x1d'),_0x3685ab[_0xde6a('0x1a')]),_0x4393e3);}});ami['on'](_0xde6a('0x1e'),function(_0xf93cb9){try{utils[_0xde6a('0x14')](util[_0xde6a('0x18')]('[%s][index][agentconnect]',_0xf93cb9['uniqueid']),_0xf93cb9);agents[_0xde6a('0x1e')](_0xf93cb9);queues['agentconnect'](_0xf93cb9);}catch(_0x58375e){utils[_0xde6a('0x11')](util[_0xde6a('0x18')]('[%s][index][agentconnect]',_0xf93cb9['uniqueid']),_0x58375e);}});ami['on'](_0xde6a('0x1f'),function(_0x279a4c){try{utils[_0xde6a('0x14')](util['format'](_0xde6a('0x20'),_0x279a4c[_0xde6a('0x1a')]),_0x279a4c);agents[_0xde6a('0x1f')](_0x279a4c);queues[_0xde6a('0x1f')](_0x279a4c);members['agentcomplete'](_0x279a4c);}catch(_0x1889be){utils[_0xde6a('0x11')](util[_0xde6a('0x18')](_0xde6a('0x20'),_0x279a4c['uniqueid']),_0x1889be);}});ami['on'](_0xde6a('0x21'),function(_0x367945){try{utils['debug'](util[_0xde6a('0x18')](_0xde6a('0x22'),_0x367945[_0xde6a('0x1a')]),_0x367945);agents[_0xde6a('0x21')](_0x367945);queues[_0xde6a('0x21')](_0x367945);}catch(_0x4fd0ce){utils[_0xde6a('0x11')](util[_0xde6a('0x18')](_0xde6a('0x22'),_0x367945[_0xde6a('0x1a')]),_0x4fd0ce);}});ami['on'](_0xde6a('0x23'),function(_0x378f15){try{utils[_0xde6a('0x14')](util[_0xde6a('0x18')](_0xde6a('0x24'),_0x378f15['uniqueid']),_0x378f15);queues[_0xde6a('0x23')](_0x378f15);recordings['queuecallerjoin'](_0x378f15);}catch(_0x533345){utils[_0xde6a('0x11')](util[_0xde6a('0x18')]('[%s][index][queuecallerjoin]',_0x378f15[_0xde6a('0x1a')]),_0x533345);}});ami['on'](_0xde6a('0x25'),function(_0x55ef32){try{utils[_0xde6a('0x14')](util[_0xde6a('0x18')](_0xde6a('0x26'),_0x55ef32[_0xde6a('0x1a')]),_0x55ef32);queues['queuecallerleave'](_0x55ef32);}catch(_0x54aefd){utils[_0xde6a('0x11')](util[_0xde6a('0x18')](_0xde6a('0x26'),_0x55ef32[_0xde6a('0x1a')]),_0x54aefd);}});ami['on'](_0xde6a('0x27'),function(_0x4410cc){try{utils[_0xde6a('0x14')](util[_0xde6a('0x18')](_0xde6a('0x28'),_0x4410cc[_0xde6a('0x1a')]),_0x4410cc);queues[_0xde6a('0x27')](_0x4410cc);calls[_0xde6a('0x27')](_0x4410cc);}catch(_0x1359ab){utils['error'](util[_0xde6a('0x18')](_0xde6a('0x28'),_0x4410cc[_0xde6a('0x1a')]),_0x1359ab);}});ami['on'](_0xde6a('0x29'),function(_0x4caff6){try{utils[_0xde6a('0x14')](util[_0xde6a('0x18')](_0xde6a('0x2a'),_0x4caff6[_0xde6a('0x1a')]),_0x4caff6);queues[_0xde6a('0x29')](_0x4caff6);calls[_0xde6a('0x29')](_0x4caff6);}catch(_0x4c779c){utils['error'](util[_0xde6a('0x18')](_0xde6a('0x2a'),_0x4caff6[_0xde6a('0x1a')]),_0x4c779c);}});ami['on'](_0xde6a('0x2b'),function(_0x44db67){try{utils[_0xde6a('0x14')](util[_0xde6a('0x18')](_0xde6a('0x2c'),_0x44db67['uniqueid']),_0x44db67);calls[_0xde6a('0x2b')](_0x44db67);recordings[_0xde6a('0x2b')](_0x44db67);}catch(_0x3d358d){utils[_0xde6a('0x11')](util[_0xde6a('0x18')](_0xde6a('0x2c'),_0x44db67[_0xde6a('0x1a')]),_0x3d358d);}});ami['on'](_0xde6a('0x2d'),function(_0x42a983){try{utils[_0xde6a('0x14')](util[_0xde6a('0x18')]('[%s][index][hangup]',_0x42a983[_0xde6a('0x1a')]),_0x42a983);calls[_0xde6a('0x2d')](_0x42a983);recordings['hangup'](_0x42a983);dials[_0xde6a('0x2d')](_0x42a983);agents[_0xde6a('0x2d')](_0x42a983);queues[_0xde6a('0x2d')](_0x42a983);}catch(_0x7dad37){utils[_0xde6a('0x11')](util[_0xde6a('0x18')](_0xde6a('0x2e'),_0x42a983[_0xde6a('0x1a')]),_0x7dad37);}});ami['on'](_0xde6a('0x2f'),function(_0x51685e){try{utils[_0xde6a('0x14')](util['format'](_0xde6a('0x30'),_0x51685e[_0xde6a('0x1a')]),_0x51685e);members[_0xde6a('0x2f')](_0x51685e);}catch(_0x41a419){utils['error'](util[_0xde6a('0x18')](_0xde6a('0x30'),_0x51685e[_0xde6a('0x1a')]),_0x41a419);}});ami['on']('blindtransfer',function(_0x182b0d){try{utils[_0xde6a('0x14')](util['format'](_0xde6a('0x31'),_0x182b0d[_0xde6a('0x1a')]),_0x182b0d);queues['blindtransfer'](_0x182b0d);agents['blindtransfer'](_0x182b0d);transfers[_0xde6a('0x32')](_0x182b0d);}catch(_0x41d749){utils[_0xde6a('0x11')](util[_0xde6a('0x18')](_0xde6a('0x31'),_0x182b0d['uniqueid']),_0x41d749);}});ami['on'](_0xde6a('0x33'),function(_0x39affa){try{utils[_0xde6a('0x14')](util[_0xde6a('0x18')](_0xde6a('0x34'),_0x39affa[_0xde6a('0x35')]),_0x39affa);queues[_0xde6a('0x33')](_0x39affa);transfers[_0xde6a('0x33')](_0x39affa);agents[_0xde6a('0x33')](_0x39affa);calls[_0xde6a('0x33')](_0x39affa);}catch(_0x9407d8){utils[_0xde6a('0x11')](util[_0xde6a('0x18')](_0xde6a('0x34'),_0x39affa[_0xde6a('0x35')]),_0x9407d8);}});ami['on'](_0xde6a('0x36'),function(_0x44f5f2){try{utils[_0xde6a('0x14')](util[_0xde6a('0x18')](_0xde6a('0x37'),_0x44f5f2['uniqueid']),_0x44f5f2);queues[_0xde6a('0x36')](_0x44f5f2);recordings[_0xde6a('0x36')](_0x44f5f2);calls[_0xde6a('0x36')](_0x44f5f2);dials[_0xde6a('0x36')](_0x44f5f2);}catch(_0x11868c){utils['error'](util[_0xde6a('0x18')](_0xde6a('0x37'),_0x44f5f2[_0xde6a('0x1a')]),_0x11868c);}});ami['on'](_0xde6a('0x38'),function(_0x4e7bdb){try{utils[_0xde6a('0x14')](util[_0xde6a('0x18')](_0xde6a('0x39'),_0x4e7bdb[_0xde6a('0x1a')]),_0x4e7bdb);calls[_0xde6a('0x38')](_0x4e7bdb);recordings[_0xde6a('0x38')](_0x4e7bdb);dials['newexten'](_0x4e7bdb);}catch(_0x13066d){utils['error'](util[_0xde6a('0x18')](_0xde6a('0x39'),_0x4e7bdb[_0xde6a('0x1a')]),_0x13066d);}});ami['on']('newchannel',function(_0x593f17){try{utils[_0xde6a('0x14')](util[_0xde6a('0x18')](_0xde6a('0x3a'),_0x593f17['uniqueid']),_0x593f17);calls[_0xde6a('0x3b')](_0x593f17);recordings[_0xde6a('0x3b')](_0x593f17);}catch(_0x414a8d){utils['error'](util[_0xde6a('0x18')](_0xde6a('0x3a'),_0x593f17[_0xde6a('0x1a')]),_0x414a8d);}});ami['on'](_0xde6a('0x3c'),function(_0x3aac42){try{utils[_0xde6a('0x14')](util[_0xde6a('0x18')]('[%s][index][dialbegin]',_0x3aac42[_0xde6a('0x1a')]),_0x3aac42);dials[_0xde6a('0x3c')](_0x3aac42);}catch(_0x142c38){utils[_0xde6a('0x11')](util[_0xde6a('0x18')]('[%s]dialbegin',_0x3aac42['uniqueid']),_0x142c38);}});ami['on']('dialend',function(_0x3e9550){try{utils['debug'](util[_0xde6a('0x18')](_0xde6a('0x3d'),_0x3e9550[_0xde6a('0x1a')]),_0x3e9550);dials['dialend'](_0x3e9550);}catch(_0x724267){utils['error'](util['format'](_0xde6a('0x3d'),_0x3e9550['uniqueid']),_0x724267);}});} \ No newline at end of file +var _0xad5b=['[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%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','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','./utils','util','port','asterisk','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]'];(function(_0x38143a,_0xc2572a){var _0x425fde=function(_0x35c2bc){while(--_0x35c2bc){_0x38143a['push'](_0x38143a['shift']());}};_0x425fde(++_0xc2572a);}(_0xad5b,0xf1));var _0xbad5=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0xad5b[_0x54381d];return _0x5308a7;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0xbad5('0x0'));var util=require(_0xbad5('0x1'));var ami=new AsteriskManager(config['asterisk'][_0xbad5('0x2')],config[_0xbad5('0x3')]['ip'],config[_0xbad5('0x3')][_0xbad5('0x4')],config['asterisk'][_0xbad5('0x5')],!![]);ami[_0xbad5('0x6')]();if(config[_0xbad5('0x7')]&&config[_0xbad5('0x7')][_0xbad5('0x8')]){utils[_0xbad5('0x9')](_0xbad5('0xa'));}else{var agents=require(_0xbad5('0xb'));var calls=require(_0xbad5('0xc'));var queues=require(_0xbad5('0xd'));var recordings=require(_0xbad5('0xe'));var members=require(_0xbad5('0xf'));var dials=require(_0xbad5('0x10'));var transfers=require(_0xbad5('0x11'));var core=require(_0xbad5('0x12'));ami['on'](_0xbad5('0x13'),core[_0xbad5('0x13')]);ami['on'](_0xbad5('0x14'),core[_0xbad5('0x14')]);ami['on'](_0xbad5('0x15'),core[_0xbad5('0x15')]);ami['on'](_0xbad5('0x16'),core[_0xbad5('0x16')]);ami['on']('close',core[_0xbad5('0x17')]);ami['on'](_0xbad5('0x18'),core['managerevent']);ami['on'](_0xbad5('0x19'),function(_0x263f6a){try{utils[_0xbad5('0x1a')](util[_0xbad5('0x1b')](_0xbad5('0x1c'),_0x263f6a[_0xbad5('0x1d')]),_0x263f6a);members[_0xbad5('0x19')](_0x263f6a);}catch(_0x398f87){utils[_0xbad5('0x16')](util[_0xbad5('0x1b')](_0xbad5('0x1c'),_0x263f6a[_0xbad5('0x1d')]),_0x398f87);}});ami['on'](_0xbad5('0x1e'),function(_0x1b7ae2){try{utils[_0xbad5('0x1a')](util[_0xbad5('0x1b')](_0xbad5('0x1f'),_0x1b7ae2[_0xbad5('0x20')]),_0x1b7ae2);agents['agentcalled'](_0x1b7ae2);}catch(_0x422798){utils[_0xbad5('0x16')](util[_0xbad5('0x1b')](_0xbad5('0x1f'),_0x1b7ae2['uniqueid']),_0x422798);}});ami['on'](_0xbad5('0x21'),function(_0x4306a7){try{utils['debug'](util[_0xbad5('0x1b')](_0xbad5('0x22'),_0x4306a7[_0xbad5('0x20')]),_0x4306a7);agents[_0xbad5('0x21')](_0x4306a7);}catch(_0x4d4e05){utils[_0xbad5('0x16')](util[_0xbad5('0x1b')]('[%s][index][agentringnoanswer]',_0x4306a7['uniqueid']),_0x4d4e05);}});ami['on'](_0xbad5('0x23'),function(_0x1d686d){try{utils[_0xbad5('0x1a')](util['format'](_0xbad5('0x24'),_0x1d686d[_0xbad5('0x20')]),_0x1d686d);agents[_0xbad5('0x23')](_0x1d686d);queues[_0xbad5('0x23')](_0x1d686d);}catch(_0x270d34){utils['error'](util[_0xbad5('0x1b')]('[%s][index][agentconnect]',_0x1d686d[_0xbad5('0x20')]),_0x270d34);}});ami['on'](_0xbad5('0x25'),function(_0x4940ac){try{utils['debug'](util[_0xbad5('0x1b')](_0xbad5('0x26'),_0x4940ac[_0xbad5('0x20')]),_0x4940ac);agents['agentcomplete'](_0x4940ac);queues['agentcomplete'](_0x4940ac);members[_0xbad5('0x25')](_0x4940ac);}catch(_0x22c595){utils[_0xbad5('0x16')](util[_0xbad5('0x1b')](_0xbad5('0x26'),_0x4940ac['uniqueid']),_0x22c595);}});ami['on']('queuecallerabandon',function(_0x4e4917){try{utils[_0xbad5('0x1a')](util[_0xbad5('0x1b')](_0xbad5('0x27'),_0x4e4917[_0xbad5('0x20')]),_0x4e4917);agents[_0xbad5('0x28')](_0x4e4917);queues[_0xbad5('0x28')](_0x4e4917);}catch(_0x3d8dab){utils[_0xbad5('0x16')](util[_0xbad5('0x1b')](_0xbad5('0x27'),_0x4e4917[_0xbad5('0x20')]),_0x3d8dab);}});ami['on']('queuecallerjoin',function(_0x1bbf42){try{utils['debug'](util[_0xbad5('0x1b')]('[%s][index][queuecallerjoin]',_0x1bbf42['uniqueid']),_0x1bbf42);queues[_0xbad5('0x29')](_0x1bbf42);recordings[_0xbad5('0x29')](_0x1bbf42);}catch(_0x9b4f91){utils[_0xbad5('0x16')](util['format'](_0xbad5('0x2a'),_0x1bbf42['uniqueid']),_0x9b4f91);}});ami['on'](_0xbad5('0x2b'),function(_0x56ac7b){try{utils[_0xbad5('0x1a')](util[_0xbad5('0x1b')](_0xbad5('0x2c'),_0x56ac7b[_0xbad5('0x20')]),_0x56ac7b);queues[_0xbad5('0x2b')](_0x56ac7b);}catch(_0x58d37f){utils[_0xbad5('0x16')](util[_0xbad5('0x1b')](_0xbad5('0x2c'),_0x56ac7b[_0xbad5('0x20')]),_0x58d37f);}});ami['on'](_0xbad5('0x2d'),function(_0x4a285d){try{utils[_0xbad5('0x1a')](util[_0xbad5('0x1b')](_0xbad5('0x2e'),_0x4a285d[_0xbad5('0x20')]),_0x4a285d);queues['musiconholdstart'](_0x4a285d);calls[_0xbad5('0x2d')](_0x4a285d);}catch(_0x2f4ed7){utils[_0xbad5('0x16')](util['format'](_0xbad5('0x2e'),_0x4a285d[_0xbad5('0x20')]),_0x2f4ed7);}});ami['on'](_0xbad5('0x2f'),function(_0x16b60f){try{utils[_0xbad5('0x1a')](util[_0xbad5('0x1b')](_0xbad5('0x30'),_0x16b60f['uniqueid']),_0x16b60f);queues[_0xbad5('0x2f')](_0x16b60f);calls[_0xbad5('0x2f')](_0x16b60f);}catch(_0x547849){utils[_0xbad5('0x16')](util[_0xbad5('0x1b')](_0xbad5('0x30'),_0x16b60f[_0xbad5('0x20')]),_0x547849);}});ami['on'](_0xbad5('0x31'),function(_0x1ac287){try{utils[_0xbad5('0x1a')](util[_0xbad5('0x1b')](_0xbad5('0x32'),_0x1ac287[_0xbad5('0x20')]),_0x1ac287);calls[_0xbad5('0x31')](_0x1ac287);recordings[_0xbad5('0x31')](_0x1ac287);}catch(_0x16832c){utils[_0xbad5('0x16')](util[_0xbad5('0x1b')](_0xbad5('0x32'),_0x1ac287[_0xbad5('0x20')]),_0x16832c);}});ami['on'](_0xbad5('0x33'),function(_0x5c3442){try{utils['debug'](util[_0xbad5('0x1b')](_0xbad5('0x34'),_0x5c3442[_0xbad5('0x20')]),_0x5c3442);calls[_0xbad5('0x33')](_0x5c3442);recordings['hangup'](_0x5c3442);dials[_0xbad5('0x33')](_0x5c3442);agents[_0xbad5('0x33')](_0x5c3442);queues[_0xbad5('0x33')](_0x5c3442);}catch(_0x1e422c){utils[_0xbad5('0x16')](util[_0xbad5('0x1b')]('[%s][index][hangup]',_0x5c3442[_0xbad5('0x20')]),_0x1e422c);}});ami['on'](_0xbad5('0x35'),function(_0x5a96e9){try{utils['debug'](util['format'](_0xbad5('0x36'),_0x5a96e9[_0xbad5('0x20')]),_0x5a96e9);members['cdr'](_0x5a96e9);}catch(_0x559137){utils[_0xbad5('0x16')](util[_0xbad5('0x1b')](_0xbad5('0x36'),_0x5a96e9['uniqueid']),_0x559137);}});ami['on'](_0xbad5('0x37'),function(_0x23cc29){try{utils[_0xbad5('0x1a')](util[_0xbad5('0x1b')](_0xbad5('0x38'),_0x23cc29[_0xbad5('0x20')]),_0x23cc29);queues[_0xbad5('0x37')](_0x23cc29);agents[_0xbad5('0x37')](_0x23cc29);transfers[_0xbad5('0x37')](_0x23cc29);}catch(_0x5874fe){utils[_0xbad5('0x16')](util['format']('[%s][index][blindtransfer]',_0x23cc29[_0xbad5('0x20')]),_0x5874fe);}});ami['on'](_0xbad5('0x39'),function(_0x595b1b){try{utils['debug'](util['format'](_0xbad5('0x3a'),_0x595b1b['origtransfereruniqueid']),_0x595b1b);queues[_0xbad5('0x39')](_0x595b1b);transfers[_0xbad5('0x39')](_0x595b1b);agents[_0xbad5('0x39')](_0x595b1b);calls[_0xbad5('0x39')](_0x595b1b);}catch(_0x343d4f){utils[_0xbad5('0x16')](util['format'](_0xbad5('0x3a'),_0x595b1b[_0xbad5('0x3b')]),_0x343d4f);}});ami['on'](_0xbad5('0x3c'),function(_0x3bae3e){try{utils[_0xbad5('0x1a')](util[_0xbad5('0x1b')](_0xbad5('0x3d'),_0x3bae3e[_0xbad5('0x20')]),_0x3bae3e);queues['varset'](_0x3bae3e);recordings['varset'](_0x3bae3e);calls[_0xbad5('0x3c')](_0x3bae3e);dials[_0xbad5('0x3c')](_0x3bae3e);}catch(_0x34d360){utils[_0xbad5('0x16')](util[_0xbad5('0x1b')](_0xbad5('0x3d'),_0x3bae3e['uniqueid']),_0x34d360);}});ami['on'](_0xbad5('0x3e'),function(_0x59d765){try{utils[_0xbad5('0x1a')](util['format'](_0xbad5('0x3f'),_0x59d765[_0xbad5('0x20')]),_0x59d765);calls['newexten'](_0x59d765);recordings['newexten'](_0x59d765);dials[_0xbad5('0x3e')](_0x59d765);}catch(_0x5e1740){utils[_0xbad5('0x16')](util['format'](_0xbad5('0x3f'),_0x59d765[_0xbad5('0x20')]),_0x5e1740);}});ami['on'](_0xbad5('0x40'),function(_0xb1fc0b){try{utils[_0xbad5('0x1a')](util['format'](_0xbad5('0x41'),_0xb1fc0b[_0xbad5('0x20')]),_0xb1fc0b);calls['newchannel'](_0xb1fc0b);recordings[_0xbad5('0x40')](_0xb1fc0b);}catch(_0x134998){utils[_0xbad5('0x16')](util[_0xbad5('0x1b')](_0xbad5('0x41'),_0xb1fc0b[_0xbad5('0x20')]),_0x134998);}});ami['on'](_0xbad5('0x42'),function(_0x141117){try{utils[_0xbad5('0x1a')](util[_0xbad5('0x1b')](_0xbad5('0x43'),_0x141117['uniqueid']),_0x141117);dials['dialbegin'](_0x141117);}catch(_0x1ddf3c){utils[_0xbad5('0x16')](util[_0xbad5('0x1b')]('[%s]dialbegin',_0x141117[_0xbad5('0x20')]),_0x1ddf3c);}});ami['on'](_0xbad5('0x44'),function(_0x546f91){try{utils[_0xbad5('0x1a')](util[_0xbad5('0x1b')](_0xbad5('0x45'),_0x546f91[_0xbad5('0x20')]),_0x546f91);dials['dialend'](_0x546f91);}catch(_0x56107d){utils['error'](util[_0xbad5('0x1b')](_0xbad5('0x45'),_0x546f91[_0xbad5('0x20')]),_0x56107d);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index f1dfe51..22e92bb 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 _0x177a=['debug','device','INUSE','voice','now','agent','NOT_INUSE','duration','diffTime','enterAt','[%s][members][devicestatechange]','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','split','assign','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','exitAt','destinationchannel','data1','lodash','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','then','error','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange'];(function(_0x39c8f2,_0x23df6c){var _0x445526=function(_0x56376c){while(--_0x56376c){_0x39c8f2['push'](_0x39c8f2['shift']());}};_0x445526(++_0x23df6c);}(_0x177a,0xdd));var _0xa177=function(_0x4dc061,_0x5292cd){_0x4dc061=_0x4dc061-0x0;var _0x25dbce=_0x177a[_0x4dc061];return _0x25dbce;};'use strict';var _=require(_0xa177('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=[_0xa177('0x1'),_0xa177('0x2')];function writeDB(_0x5becaa){utils[_0xa177('0x3')](util[_0xa177('0x4')](_0xa177('0x5'),_0x5becaa['uniqueid'],_0x5becaa[_0xa177('0x6')],_0x5becaa[_0xa177('0x7')],_0x5becaa[_0xa177('0x8')],_0x5becaa[_0xa177('0x9')],_0x5becaa[_0xa177('0xa')]));if(_0x5becaa[_0xa177('0x6')]){utils[_0xa177('0xb')](_0x5becaa[_0xa177('0x6')])['then'](function(_0x807734){if(_0x807734){_0x5becaa['membername']=_0x807734[_0xa177('0xc')];_0x5becaa[_0xa177('0xd')]=_0x807734[_0xa177('0xd')];utils[_0xa177('0xe')](_0xa177('0xf'),_0x5becaa);}else{utils[_0xa177('0x10')](_0x5becaa[_0xa177('0x6')]['split']('/')[0x1])[_0xa177('0x11')](function(_0x3b116a){if(_0x3b116a){_0x5becaa[_0xa177('0x9')]=_0x3b116a[_0xa177('0xc')];_0x5becaa[_0xa177('0xd')]=_0x3b116a[_0xa177('0xd')];utils[_0xa177('0xe')]('CreateMemberReport',_0x5becaa);}});}})['catch'](function(_0xca78d4){utils[_0xa177('0x12')](util[_0xa177('0x4')](_0xa177('0x13'),_0x5becaa[_0xa177('0x14')]),_0xca78d4);});}delete members[_0x5becaa[_0xa177('0x6')]];}function startsWith(_0x258985,_0xbc9fa4){return _[_0xa177('0x15')](_0x258985,function(_0x3c1443){return _[_0xa177('0x16')](_0xbc9fa4,_0x3c1443);});}exports[_0xa177('0x17')]=function(_0x5445da){try{utils[_0xa177('0x18')](util[_0xa177('0x4')]('[%s][members][devicestatechange]',members[_0x5445da[_0xa177('0x19')]]?members[_0x5445da[_0xa177('0x19')]][_0xa177('0x14')]:_0x5445da[_0xa177('0x19')]),_0x5445da);utils['info'](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x5445da[_0xa177('0x19')]]?members[_0x5445da[_0xa177('0x19')]][_0xa177('0x14')]:_0x5445da[_0xa177('0x19')],_0x5445da['state'],_0x5445da[_0xa177('0x19')]));switch(_0x5445da['state']){case _0xa177('0x1a'):case'BUSY':if(!startsWith(exclude,_0x5445da[_0xa177('0x19')])){members[_0x5445da[_0xa177('0x19')]]={'channel':_0xa177('0x1b'),'interface':_0x5445da[_0xa177('0x19')],'type':'TALKING','enterAt':utils[_0xa177('0x1c')](),'role':_0xa177('0x1d')};}break;case _0xa177('0x1e'):if(!_['isNil'](members[_0x5445da['device']])){members[_0x5445da['device']]['exitAt']=utils[_0xa177('0x1c')]();members[_0x5445da[_0xa177('0x19')]][_0xa177('0x1f')]=utils[_0xa177('0x20')](members[_0x5445da[_0xa177('0x19')]]['exitAt'],members[_0x5445da[_0xa177('0x19')]][_0xa177('0x21')]);if(members[_0x5445da['device']]['uniqueid']){writeDB(members[_0x5445da[_0xa177('0x19')]]);}}break;default:break;}}catch(_0x5b42a1){utils['error'](util['format'](_0xa177('0x22'),members[_0x5445da['device']]?members[_0x5445da[_0xa177('0x19')]][_0xa177('0x14')]:_0x5445da[_0xa177('0x19')]),_0x5b42a1);}};exports['agentcomplete']=function(_0x41949a){try{if(!_[_0xa177('0x23')](members[_0x41949a['interface']])){utils[_0xa177('0x18')](util[_0xa177('0x4')](_0xa177('0x24'),_0x41949a[_0xa177('0x14')]),_0x41949a);utils[_0xa177('0x3')](util[_0xa177('0x4')](_0xa177('0x25'),_0x41949a[_0xa177('0x14')],_0x41949a['interface'],_0x41949a[_0xa177('0x26')]));members[_0x41949a[_0xa177('0x6')]]=_['assign'](members[_0x41949a[_0xa177('0x6')]],{'data4':_0x41949a[_0xa177('0x26')],'uniqueid':_0x41949a['uniqueid']});}}catch(_0x2b5cdc){utils[_0xa177('0x12')](util['format'](_0xa177('0x24'),_0x41949a[_0xa177('0x14')]),_0x2b5cdc);}};exports[_0xa177('0x27')]=function(_0x5cf398){try{utils['debug'](util['format']('[%s][members][cdr]',_0x5cf398['uniqueid']),_0x5cf398);if(_0x5cf398[_0xa177('0x7')]){var _0xd57ceb=_0x5cf398[_0xa177('0x7')][_0xa177('0x28')]('-')[0x0];if(!_[_0xa177('0x23')](members[_0xd57ceb])){members[_0xd57ceb]=_[_0xa177('0x29')](members[_0xd57ceb],{'data1':members[_0xd57ceb]['data1']||_0x5cf398[_0xa177('0xa')],'data2':members[_0xd57ceb][_0xa177('0x8')]||_0x5cf398[_0xa177('0x2a')],'data3':members[_0xd57ceb][_0xa177('0x2b')]||_0x5cf398[_0xa177('0x2c')],'uniqueid':members[_0xd57ceb][_0xa177('0x14')]||_0x5cf398[_0xa177('0x14')]});utils[_0xa177('0x3')](util['format'](_0xa177('0x2d'),_0x5cf398[_0xa177('0x14')],members[_0xd57ceb]['data1'],members[_0xd57ceb][_0xa177('0x8')],members[_0xd57ceb]['data3']));if(members[_0xd57ceb][_0xa177('0x2e')]){writeDB(members[_0xd57ceb]);}}}if(_0x5cf398[_0xa177('0x2f')]){var _0x4b51fc=_0x5cf398[_0xa177('0x2f')][_0xa177('0x28')]('-')[0x0];if(!_[_0xa177('0x23')](members[_0x4b51fc])){members[_0x4b51fc]=_[_0xa177('0x29')](members[_0x4b51fc],{'data1':members[_0x4b51fc][_0xa177('0x30')]||_0x5cf398[_0xa177('0xa')],'data2':members[_0x4b51fc][_0xa177('0x8')]||_0x5cf398[_0xa177('0x2a')],'data3':members[_0x4b51fc][_0xa177('0x2b')]||_0x5cf398[_0xa177('0x2c')],'uniqueid':members[_0x4b51fc][_0xa177('0x14')]||_0x5cf398[_0xa177('0x14')]});utils['info'](util['format'](_0xa177('0x2d'),_0x5cf398[_0xa177('0x14')],members[_0x4b51fc][_0xa177('0x30')],members[_0x4b51fc][_0xa177('0x8')],members[_0x4b51fc][_0xa177('0x2b')]));if(members[_0x4b51fc][_0xa177('0x2e')]){writeDB(members[_0x4b51fc]);}}}}catch(_0x2d7e2d){utils[_0xa177('0x12')](util['format']('[%s][members][cdr]',_0x5cf398[_0xa177('0x14')]),_0x2d7e2d);}}; \ No newline at end of file +var _0x48c6=['INUSE','voice','TALKING','agent','exitAt','now','duration','enterAt','agentcomplete','debug','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','isNil','data1','type','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','getUserByInterface','internal','request','CreateMemberReport','getUserByName','split','membername','name','catch','error','format','[%s][members][writeDB]','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s'];(function(_0x18d255,_0xcab1e6){var _0x5242ab=function(_0x7c033b){while(--_0x7c033b){_0x18d255['push'](_0x18d255['shift']());}};_0x5242ab(++_0xcab1e6);}(_0x48c6,0x17d));var _0x648c=function(_0x1f245d,_0x408a0e){_0x1f245d=_0x1f245d-0x0;var _0x444056=_0x48c6[_0x1f245d];return _0x444056;};'use strict';var _=require(_0x648c('0x0'));var util=require(_0x648c('0x1'));var utils=require('./utils');var members={};var exclude=[_0x648c('0x2'),_0x648c('0x3')];function writeDB(_0x5aca90){utils[_0x648c('0x4')](util['format'](_0x648c('0x5'),_0x5aca90[_0x648c('0x6')],_0x5aca90[_0x648c('0x7')],_0x5aca90[_0x648c('0x8')],_0x5aca90['data2'],_0x5aca90['membername'],_0x5aca90['type']));if(_0x5aca90[_0x648c('0x7')]){utils[_0x648c('0x9')](_0x5aca90[_0x648c('0x7')])['then'](function(_0x17148d){if(_0x17148d){_0x5aca90['membername']=_0x17148d['name'];_0x5aca90[_0x648c('0xa')]=_0x17148d[_0x648c('0xa')];utils[_0x648c('0xb')](_0x648c('0xc'),_0x5aca90);}else{utils[_0x648c('0xd')](_0x5aca90[_0x648c('0x7')][_0x648c('0xe')]('/')[0x1])['then'](function(_0x3659fe){if(_0x3659fe){_0x5aca90[_0x648c('0xf')]=_0x3659fe[_0x648c('0x10')];_0x5aca90[_0x648c('0xa')]=_0x3659fe['internal'];utils['request'](_0x648c('0xc'),_0x5aca90);}});}})[_0x648c('0x11')](function(_0x485d5d){utils[_0x648c('0x12')](util[_0x648c('0x13')](_0x648c('0x14'),_0x5aca90[_0x648c('0x6')]),_0x485d5d);});}delete members[_0x5aca90[_0x648c('0x7')]];}function startsWith(_0x581700,_0x1dd08d){return _[_0x648c('0x15')](_0x581700,function(_0x4c1bf4){return _[_0x648c('0x16')](_0x1dd08d,_0x4c1bf4);});}exports[_0x648c('0x17')]=function(_0x3864af){try{utils['debug'](util[_0x648c('0x13')](_0x648c('0x18'),members[_0x3864af[_0x648c('0x19')]]?members[_0x3864af['device']]['uniqueid']:_0x3864af['device']),_0x3864af);utils[_0x648c('0x4')](util[_0x648c('0x13')](_0x648c('0x1a'),members[_0x3864af['device']]?members[_0x3864af[_0x648c('0x19')]][_0x648c('0x6')]:_0x3864af['device'],_0x3864af['state'],_0x3864af[_0x648c('0x19')]));switch(_0x3864af['state']){case _0x648c('0x1b'):case'BUSY':if(!startsWith(exclude,_0x3864af[_0x648c('0x19')])){members[_0x3864af[_0x648c('0x19')]]={'channel':_0x648c('0x1c'),'interface':_0x3864af[_0x648c('0x19')],'type':_0x648c('0x1d'),'enterAt':utils['now'](),'role':_0x648c('0x1e')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x3864af[_0x648c('0x19')]])){members[_0x3864af['device']][_0x648c('0x1f')]=utils[_0x648c('0x20')]();members[_0x3864af[_0x648c('0x19')]][_0x648c('0x21')]=utils['diffTime'](members[_0x3864af[_0x648c('0x19')]][_0x648c('0x1f')],members[_0x3864af[_0x648c('0x19')]][_0x648c('0x22')]);if(members[_0x3864af[_0x648c('0x19')]]['uniqueid']){writeDB(members[_0x3864af['device']]);}}break;default:break;}}catch(_0x33c132){utils[_0x648c('0x12')](util[_0x648c('0x13')]('[%s][members][devicestatechange]',members[_0x3864af[_0x648c('0x19')]]?members[_0x3864af[_0x648c('0x19')]][_0x648c('0x6')]:_0x3864af[_0x648c('0x19')]),_0x33c132);}};exports[_0x648c('0x23')]=function(_0x187572){try{if(!_['isNil'](members[_0x187572[_0x648c('0x7')]])){utils[_0x648c('0x24')](util[_0x648c('0x13')]('[%s][members][agentcomplete]',_0x187572['uniqueid']),_0x187572);utils[_0x648c('0x4')](util['format'](_0x648c('0x25'),_0x187572['uniqueid'],_0x187572[_0x648c('0x7')],_0x187572[_0x648c('0x26')]));members[_0x187572[_0x648c('0x7')]]=_[_0x648c('0x27')](members[_0x187572[_0x648c('0x7')]],{'data4':_0x187572[_0x648c('0x26')],'uniqueid':_0x187572[_0x648c('0x6')]});}}catch(_0x193b3b){utils[_0x648c('0x12')](util['format']('[%s][members][agentcomplete]',_0x187572['uniqueid']),_0x193b3b);}};exports[_0x648c('0x28')]=function(_0x590530){try{utils['debug'](util['format'](_0x648c('0x29'),_0x590530['uniqueid']),_0x590530);if(_0x590530['channel']){var _0x4505af=_0x590530[_0x648c('0x8')][_0x648c('0xe')]('-')[0x0];if(!_[_0x648c('0x2a')](members[_0x4505af])){members[_0x4505af]=_['assign'](members[_0x4505af],{'data1':members[_0x4505af][_0x648c('0x2b')]||_0x590530[_0x648c('0x2c')],'data2':members[_0x4505af][_0x648c('0x2d')]||_0x590530[_0x648c('0x2e')],'data3':members[_0x4505af][_0x648c('0x2f')]||_0x590530[_0x648c('0x30')],'uniqueid':members[_0x4505af][_0x648c('0x6')]||_0x590530[_0x648c('0x6')]});utils[_0x648c('0x4')](util[_0x648c('0x13')](_0x648c('0x31'),_0x590530[_0x648c('0x6')],members[_0x4505af][_0x648c('0x2b')],members[_0x4505af][_0x648c('0x2d')],members[_0x4505af][_0x648c('0x2f')]));if(members[_0x4505af][_0x648c('0x1f')]){writeDB(members[_0x4505af]);}}}if(_0x590530['destinationchannel']){var _0xde11d2=_0x590530[_0x648c('0x32')][_0x648c('0xe')]('-')[0x0];if(!_['isNil'](members[_0xde11d2])){members[_0xde11d2]=_[_0x648c('0x27')](members[_0xde11d2],{'data1':members[_0xde11d2][_0x648c('0x2b')]||_0x590530[_0x648c('0x2c')],'data2':members[_0xde11d2]['data2']||_0x590530[_0x648c('0x2e')],'data3':members[_0xde11d2][_0x648c('0x2f')]||_0x590530[_0x648c('0x30')],'uniqueid':members[_0xde11d2][_0x648c('0x6')]||_0x590530[_0x648c('0x6')]});utils[_0x648c('0x4')](util[_0x648c('0x13')](_0x648c('0x31'),_0x590530['uniqueid'],members[_0xde11d2]['data1'],members[_0xde11d2][_0x648c('0x2d')],members[_0xde11d2][_0x648c('0x2f')]));if(members[_0xde11d2][_0x648c('0x1f')]){writeDB(members[_0xde11d2]);}}}}catch(_0x3ea19a){utils[_0x648c('0x12')](util[_0x648c('0x13')](_0x648c('0x29'),_0x590530[_0x648c('0x6')]),_0x3ea19a);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index a2b49dd..9b77e5a 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 _0x5042=['type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','[%s][queues][queuecallerjoin]','hangup','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','[%s][queues][varset]','isNil','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','variable','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','error','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfereruniqueid','origtransfererexten','transfertype','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','queuecallerenterreason','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','queuecallerexitreason','getVoiceQueueByName','then'];(function(_0x364b32,_0x4dec35){var _0x3f3ea0=function(_0x1911a8){while(--_0x1911a8){_0x364b32['push'](_0x364b32['shift']());}};_0x3f3ea0(++_0x4dec35);}(_0x5042,0x132));var _0x2504=function(_0x117099,_0x4e87c0){_0x117099=_0x117099-0x0;var _0x2d0438=_0x5042[_0x117099];return _0x2d0438;};'use strict';var _=require(_0x2504('0x0'));var util=require(_0x2504('0x1'));var utils=require(_0x2504('0x2'));var queues={};function writeDB(_0x30a4a7){utils[_0x2504('0x3')](util[_0x2504('0x4')](_0x2504('0x5'),_0x30a4a7[_0x2504('0x6')],_0x30a4a7[_0x2504('0x7')],_0x30a4a7['queue'],_0x30a4a7[_0x2504('0x8')],_0x30a4a7['calleridnum'],_0x30a4a7['accountcode'],_0x30a4a7[_0x2504('0x9')]));if(_0x30a4a7['queue']){utils[_0x2504('0xa')](_0x30a4a7['queue'])[_0x2504('0xb')](function(_0x178605){if(_0x178605){_0x30a4a7[_0x2504('0xc')]=_0x178605[_0x2504('0xc')];}utils[_0x2504('0xd')](_0x2504('0xe'),_0x30a4a7);});}else{utils[_0x2504('0xd')](_0x2504('0xe'),_0x30a4a7);}if(_0x30a4a7[_0x2504('0xf')]){delete queues[_0x30a4a7[_0x2504('0xf')]];}else{delete queues[_0x30a4a7[_0x2504('0x6')]];}}exports['queuecallerjoin']=function(_0x5ab468){try{utils[_0x2504('0x10')](util[_0x2504('0x4')]('[%s][queues][queuecallerjoin]',_0x5ab468['uniqueid']),_0x5ab468);utils[_0x2504('0x3')](util[_0x2504('0x4')](_0x2504('0x11'),_0x5ab468['uniqueid'],_0x5ab468['queue'],_0x5ab468[_0x2504('0x12')]));queues[_0x5ab468[_0x2504('0x6')]]=_[_0x2504('0x13')](_0x5ab468,{'originalposition':_0x5ab468['position'],'queuecallerjoinAt':utils[_0x2504('0x14')](),'mohtime':0x0});}catch(_0x5b5abf){utils['error'](util[_0x2504('0x4')](_0x2504('0x15'),_0x5ab468['uniqueid']),_0x5b5abf);}};exports[_0x2504('0x16')]=function(_0x3fc6c2){try{if(!_['isNil'](queues[_0x3fc6c2['uniqueid']])){utils[_0x2504('0x10')](util[_0x2504('0x4')](_0x2504('0x17'),_0x3fc6c2[_0x2504('0x6')]),_0x3fc6c2);if(queues[_0x3fc6c2[_0x2504('0x6')]]['queuecallerleaveAt']){if(!queues[_0x3fc6c2[_0x2504('0x6')]][_0x2504('0x18')]&&!queues[_0x3fc6c2[_0x2504('0x6')]][_0x2504('0x19')]){queues[_0x3fc6c2[_0x2504('0x6')]]['queuecallercomplete']=!![];queues[_0x3fc6c2[_0x2504('0x6')]][_0x2504('0x1a')]=utils['now']();queues[_0x3fc6c2[_0x2504('0x6')]]['queuecallerexitreason']=_0x2504('0x1b');}utils[_0x2504('0x3')](util['format'](_0x2504('0x1c'),_0x3fc6c2[_0x2504('0x6')],queues[_0x3fc6c2['uniqueid']]['name'],queues[_0x3fc6c2['uniqueid']][_0x2504('0x9')]));writeDB(queues[_0x3fc6c2[_0x2504('0x6')]]);}else if(queues[_0x3fc6c2['uniqueid']][_0x2504('0xf')]){utils['info'](util[_0x2504('0x4')](_0x2504('0x1d'),_0x3fc6c2['uniqueid'],queues[_0x3fc6c2[_0x2504('0x6')]][_0x2504('0x1e')],queues[_0x3fc6c2[_0x2504('0x6')]][_0x2504('0xf')]));queues[queues[_0x3fc6c2[_0x2504('0x6')]][_0x2504('0xf')]]=queues[_0x3fc6c2[_0x2504('0x6')]];queues[queues[_0x3fc6c2[_0x2504('0x6')]][_0x2504('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x3fc6c2[_0x2504('0x6')]];}}}catch(_0x16b759){utils['error'](util[_0x2504('0x4')](_0x2504('0x17'),_0x3fc6c2[_0x2504('0x6')]),_0x16b759);}};exports['varset']=function(_0x2026f7){try{utils[_0x2504('0x10')](util[_0x2504('0x4')](_0x2504('0x1f'),_0x2026f7[_0x2504('0x6')]),_0x2026f7);if(!_[_0x2504('0x20')](_0x2026f7['variable']['queuestatus'])&&_0x2026f7[_0x2504('0x21')][_0x2504('0x22')]()!==_0x2504('0x23')){if(!_[_0x2504('0x20')](queues[_0x2026f7[_0x2504('0x6')]])){queues[_0x2026f7[_0x2504('0x6')]][_0x2504('0x18')]=![];queues[_0x2026f7['uniqueid']][_0x2504('0x24')]=null;queues[_0x2026f7['uniqueid']]['queuecallerexit']=!![];queues[_0x2026f7[_0x2504('0x6')]][_0x2504('0x25')]=utils[_0x2504('0x14')]();queues[_0x2026f7['uniqueid']][_0x2504('0x9')]=_0x2026f7[_0x2504('0x21')][_0x2504('0x22')]();utils[_0x2504('0x3')](util[_0x2504('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x2026f7['uniqueid'],queues[_0x2026f7[_0x2504('0x6')]][_0x2504('0x1e')],_0x2026f7['value'],queues[_0x2026f7[_0x2504('0x6')]][_0x2504('0x9')]));writeDB(queues[_0x2026f7[_0x2504('0x6')]]);}}else if(!_['isNil'](_0x2026f7[_0x2504('0x26')]['queueposition'])){if(!_['isNil'](queues[_0x2026f7[_0x2504('0x6')]])&&!queues[_0x2026f7[_0x2504('0x6')]][_0x2504('0x18')]){queues[_0x2026f7['uniqueid']][_0x2504('0x18')]=![];queues[_0x2026f7[_0x2504('0x6')]][_0x2504('0x24')]=null;queues[_0x2026f7[_0x2504('0x6')]][_0x2504('0x19')]=!![];queues[_0x2026f7[_0x2504('0x6')]]['queuecallerexitAt']=utils['now']();queues[_0x2026f7[_0x2504('0x6')]]['queuecallerexitreason']=_0x2504('0x27');utils[_0x2504('0x3')](util[_0x2504('0x4')](_0x2504('0x28'),_0x2026f7[_0x2504('0x6')],queues[_0x2026f7[_0x2504('0x6')]][_0x2504('0x1e')],_0x2026f7[_0x2504('0x21')],queues[_0x2026f7['uniqueid']][_0x2504('0x9')]));}}}catch(_0x4bd1a9){utils['error'](util[_0x2504('0x4')]('[%s][queues][varset]',_0x2026f7[_0x2504('0x6')]),_0x4bd1a9);}};exports['queuecallerabandon']=function(_0x16cf49){try{if(!_[_0x2504('0x20')](queues[_0x16cf49['uniqueid']])){utils[_0x2504('0x10')](util['format'](_0x2504('0x29'),_0x16cf49[_0x2504('0x6')]),_0x16cf49);queues[_0x16cf49[_0x2504('0x6')]][_0x2504('0x19')]=![];queues[_0x16cf49[_0x2504('0x6')]][_0x2504('0x25')]=null;queues[_0x16cf49['uniqueid']][_0x2504('0x18')]=!![];queues[_0x16cf49['uniqueid']][_0x2504('0x24')]=utils[_0x2504('0x14')]();queues[_0x16cf49[_0x2504('0x6')]][_0x2504('0x9')]=_0x2504('0x2a');utils[_0x2504('0x3')](util[_0x2504('0x4')](_0x2504('0x2b'),_0x16cf49[_0x2504('0x6')],queues[_0x16cf49[_0x2504('0x6')]][_0x2504('0x1e')],queues[_0x16cf49[_0x2504('0x6')]]['queuecallerexitreason']));}}catch(_0x5625b0){utils['error'](util[_0x2504('0x4')](_0x2504('0x29'),_0x16cf49[_0x2504('0x6')]),_0x5625b0);}};exports[_0x2504('0x2c')]=function(_0x583c79){try{if(!_[_0x2504('0x20')](queues[_0x583c79['uniqueid']])){utils[_0x2504('0x10')](util[_0x2504('0x4')](_0x2504('0x2d'),_0x583c79[_0x2504('0x6')]),_0x583c79);utils[_0x2504('0x3')](util[_0x2504('0x4')](_0x2504('0x2e'),_0x583c79[_0x2504('0x6')],queues[_0x583c79['uniqueid']][_0x2504('0x1e')],_0x583c79[_0x2504('0x2f')],_0x583c79['connectedlinename']));queues[_0x583c79[_0x2504('0x6')]][_0x2504('0x2c')]=!![];queues[_0x583c79['uniqueid']][_0x2504('0x30')]=utils['now']();queues[_0x583c79['uniqueid']][_0x2504('0x31')]=utils[_0x2504('0x32')](queues[_0x583c79[_0x2504('0x6')]][_0x2504('0x30')],queues[_0x583c79[_0x2504('0x6')]][_0x2504('0x33')]);queues[_0x583c79[_0x2504('0x6')]][_0x2504('0x12')]=_0x583c79['position'];queues[_0x583c79[_0x2504('0x6')]]['count']=_0x583c79[_0x2504('0x34')];queues[_0x583c79[_0x2504('0x6')]][_0x2504('0x2f')]=_0x583c79[_0x2504('0x2f')];queues[_0x583c79[_0x2504('0x6')]][_0x2504('0x35')]=_0x583c79[_0x2504('0x35')];}}catch(_0x17739f){utils[_0x2504('0x36')](util[_0x2504('0x4')]('[%s][queues][queuecallerleave]',_0x583c79[_0x2504('0x6')]),_0x17739f);}};exports[_0x2504('0x37')]=function(_0x1d5307){try{if(!_[_0x2504('0x20')](queues[_0x1d5307['uniqueid']])){utils['debug'](util[_0x2504('0x4')]('[%s][queues][agentconnect]',_0x1d5307[_0x2504('0x6')]),_0x1d5307);utils[_0x2504('0x3')](util[_0x2504('0x4')](_0x2504('0x38'),_0x1d5307[_0x2504('0x6')],queues[_0x1d5307['uniqueid']][_0x2504('0x1e')],_0x1d5307[_0x2504('0x39')],_0x1d5307[_0x2504('0x3a')]));queues[_0x1d5307[_0x2504('0x6')]]['queuecallerabandon']=![];queues[_0x1d5307[_0x2504('0x6')]][_0x2504('0x18')]=![];queues[_0x1d5307[_0x2504('0x6')]]['queuecallerabandonAt']=null;queues[_0x1d5307['uniqueid']][_0x2504('0x19')]=![];queues[_0x1d5307[_0x2504('0x6')]][_0x2504('0x9')]=null;queues[_0x1d5307[_0x2504('0x6')]][_0x2504('0x25')]=null;queues[_0x1d5307[_0x2504('0x6')]][_0x2504('0x3b')]=!![];queues[_0x1d5307[_0x2504('0x6')]]['accountcode']=_0x1d5307['destaccountcode'];queues[_0x1d5307[_0x2504('0x6')]][_0x2504('0x8')]=_0x1d5307[_0x2504('0x39')];}}catch(_0x80e57e){utils[_0x2504('0x36')](util[_0x2504('0x4')](_0x2504('0x3c'),_0x1d5307['uniqueid']),_0x80e57e);}};exports[_0x2504('0x3d')]=function(_0x28554c){try{if(!_[_0x2504('0x20')](queues[_0x28554c[_0x2504('0x6')]])){if(queues[_0x28554c['uniqueid']]['queuecallerleaveAt']){utils['debug'](util[_0x2504('0x4')](_0x2504('0x3e'),_0x28554c[_0x2504('0x6')]),_0x28554c);queues[_0x28554c[_0x2504('0x6')]][_0x2504('0x18')]=![];queues[_0x28554c[_0x2504('0x6')]][_0x2504('0x18')]=![];queues[_0x28554c[_0x2504('0x6')]]['queuecallerabandonAt']=null;queues[_0x28554c[_0x2504('0x6')]][_0x2504('0x19')]=![];queues[_0x28554c[_0x2504('0x6')]]['queuecallerexitAt']=null;queues[_0x28554c[_0x2504('0x6')]][_0x2504('0x3b')]=!![];queues[_0x28554c['uniqueid']][_0x2504('0x8')]=_0x28554c[_0x2504('0x39')];queues[_0x28554c[_0x2504('0x6')]][_0x2504('0x3f')]=!![];queues[_0x28554c[_0x2504('0x6')]][_0x2504('0x1a')]=utils[_0x2504('0x14')]();if(_0x28554c[_0x2504('0x40')]==_0x2504('0x41')){if(!queues[_0x28554c[_0x2504('0x6')]]['transfer']){queues[_0x28554c[_0x2504('0x6')]][_0x2504('0x9')]=_0x2504('0x42');}}else{queues[_0x28554c[_0x2504('0x6')]][_0x2504('0x9')]=_0x2504('0x43')+_0x28554c[_0x2504('0x40')][_0x2504('0x22')]();}utils[_0x2504('0x3')](util[_0x2504('0x4')](_0x2504('0x44'),_0x28554c[_0x2504('0x6')],queues[_0x28554c['uniqueid']][_0x2504('0x1e')],_0x28554c[_0x2504('0x39')],queues[_0x28554c['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x28554c[_0x2504('0x6')]]);}}}catch(_0x201610){utils['error'](util['format'](_0x2504('0x3e'),_0x28554c['uniqueid']),_0x201610);}};exports[_0x2504('0x45')]=function(_0xcb1433){try{if(!_[_0x2504('0x20')](queues[_0xcb1433['transfereeuniqueid']])){utils[_0x2504('0x10')](util['format'](_0x2504('0x46'),_0xcb1433[_0x2504('0x6')]),_0xcb1433);queues[_0xcb1433[_0x2504('0x47')]][_0x2504('0x41')]=!![];queues[_0xcb1433['transfereeuniqueid']]['transfertype']=_0x2504('0x48');queues[_0xcb1433[_0x2504('0x47')]][_0x2504('0x49')]=_0xcb1433[_0x2504('0x4a')];queues[_0xcb1433[_0x2504('0x47')]]['transferuniqueid']=_0xcb1433['transfereeuniqueid'];queues[_0xcb1433['transfereeuniqueid']][_0x2504('0x9')]=_0x2504('0x4b');utils[_0x2504('0x3')](util[_0x2504('0x4')](_0x2504('0x4c'),_0xcb1433[_0x2504('0x6')],queues[_0xcb1433[_0x2504('0x47')]]['name'],_0xcb1433['transfereeuniqueid'],_0xcb1433[_0x2504('0x4a')]));}}catch(_0xee9e5b){utils[_0x2504('0x36')](util[_0x2504('0x4')](_0x2504('0x46'),_0xcb1433[_0x2504('0x6')]),_0xee9e5b);}};exports[_0x2504('0x4d')]=function(_0x30bf9d){try{utils[_0x2504('0x10')](util[_0x2504('0x4')](_0x2504('0x4e'),_0x30bf9d['origtransfereruniqueid']),_0x30bf9d);if(_0x30bf9d['origtransfereruniqueid']==_0x30bf9d[_0x2504('0x4f')]){if(!_[_0x2504('0x20')](queues[_0x30bf9d[_0x2504('0x50')]])){utils[_0x2504('0x3')](util['format'](_0x2504('0x51'),_0x30bf9d[_0x2504('0x52')],queues[_0x30bf9d[_0x2504('0x50')]]['name'],_0x30bf9d[_0x2504('0x53')]));queues[_0x30bf9d[_0x2504('0x50')]]['transfer']=!![];queues[_0x30bf9d[_0x2504('0x50')]][_0x2504('0x54')]=_0x2504('0x55');queues[_0x30bf9d[_0x2504('0x50')]][_0x2504('0x49')]=_0x30bf9d['origtransfererexten'];queues[_0x30bf9d[_0x2504('0x50')]][_0x2504('0x56')]=_0x30bf9d[_0x2504('0x52')];queues[_0x30bf9d[_0x2504('0x50')]]['queuecallerexitreason']=_0x2504('0x57');}if(!_[_0x2504('0x20')](queues[_0x30bf9d[_0x2504('0x4f')]])){if(_0x30bf9d[_0x2504('0x58')]&&queues[_0x30bf9d['transfereelinkedid']]){queues[_0x30bf9d[_0x2504('0x58')]]['queuecallerenterreason']=0x1;queues[_0x30bf9d['transfereeuniqueid']]=_['clone'](queues[_0x30bf9d[_0x2504('0x58')]]);queues[_0x30bf9d[_0x2504('0x47')]][_0x2504('0xf')]=_0x30bf9d[_0x2504('0x59')];queues[_0x30bf9d[_0x2504('0x47')]]['queuecallerenterreason']=0x2;queues[_0x30bf9d[_0x2504('0x47')]]['calleridnum']=queues[_0x30bf9d[_0x2504('0x50')]][_0x2504('0x5a')];queues[_0x30bf9d[_0x2504('0x47')]]['calleridname']=queues[_0x30bf9d[_0x2504('0x50')]][_0x2504('0x5b')];queues[_0x30bf9d[_0x2504('0x47')]][_0x2504('0x33')]=utils['now']();queues[_0x30bf9d[_0x2504('0x47')]][_0x2504('0x30')]=utils[_0x2504('0x14')]();queues[_0x30bf9d['transfereeuniqueid']]['holdtime']=0x0;queues[_0x30bf9d[_0x2504('0x47')]][_0x2504('0x5c')]=0x0;utils['info'](util[_0x2504('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x30bf9d[_0x2504('0x52')],queues[_0x30bf9d['transfereeuniqueid']][_0x2504('0x1e')],queues[_0x30bf9d[_0x2504('0x47')]][_0x2504('0x5a')],queues[_0x30bf9d['transfereeuniqueid']]['calleridname']));}else{utils[_0x2504('0x3')](util[_0x2504('0x4')](_0x2504('0x5d'),_0x30bf9d[_0x2504('0x52')],queues[_0x30bf9d[_0x2504('0x4f')]][_0x2504('0x1e')],_0x30bf9d[_0x2504('0x50')]));queues[_0x30bf9d['origtransfererlinkedid']][_0x2504('0xf')]=_0x30bf9d[_0x2504('0x50')];}}}else if(_0x30bf9d['secondtransfereruniqueid']==_0x30bf9d[_0x2504('0x50')]){if(!_[_0x2504('0x20')](queues[_0x30bf9d[_0x2504('0x4f')]])){utils['info'](util[_0x2504('0x4')](_0x2504('0x5e'),_0x30bf9d[_0x2504('0x52')],queues[_0x30bf9d[_0x2504('0x4f')]][_0x2504('0x1e')],_0x30bf9d[_0x2504('0x5f')],_0x30bf9d[_0x2504('0x60')]));queues[_0x30bf9d[_0x2504('0x4f')]]['transfer']=!![];queues[_0x30bf9d[_0x2504('0x4f')]][_0x2504('0x54')]=_0x2504('0x55');queues[_0x30bf9d[_0x2504('0x4f')]]['transferexten']=_0x30bf9d['secondtransfererexten'];queues[_0x30bf9d[_0x2504('0x4f')]]['transferuniqueid']=_0x30bf9d['secondtransfereruniqueid'];queues[_0x30bf9d['origtransfererlinkedid']][_0x2504('0x9')]=_0x2504('0x57');}if(!_[_0x2504('0x20')](queues[_0x30bf9d[_0x2504('0x50')]])){if(_0x30bf9d[_0x2504('0x61')]&&queues[_0x30bf9d[_0x2504('0x61')]]){queues[_0x30bf9d[_0x2504('0x61')]][_0x2504('0x62')]=0x1;queues[_0x30bf9d[_0x2504('0x59')]]=_[_0x2504('0x63')](queues[_0x30bf9d['transfertargetlinkedid']]);queues[_0x30bf9d[_0x2504('0x59')]][_0x2504('0xf')]=_0x30bf9d[_0x2504('0x59')];queues[_0x30bf9d[_0x2504('0x59')]]['queuecallerenterreason']=0x2;queues[_0x30bf9d['transfertargetuniqueid']][_0x2504('0x5a')]=queues[_0x30bf9d['origtransfererlinkedid']][_0x2504('0x5a')];queues[_0x30bf9d[_0x2504('0x59')]][_0x2504('0x5b')]=queues[_0x30bf9d[_0x2504('0x4f')]][_0x2504('0x5b')];queues[_0x30bf9d[_0x2504('0x59')]]['queuecallerjoinAt']=utils[_0x2504('0x14')]();queues[_0x30bf9d[_0x2504('0x59')]][_0x2504('0x30')]=utils['now']();queues[_0x30bf9d[_0x2504('0x59')]][_0x2504('0x31')]=0x0;queues[_0x30bf9d[_0x2504('0x59')]][_0x2504('0x5c')]=0x0;utils['info'](util['format'](_0x2504('0x64'),_0x30bf9d[_0x2504('0x52')],queues[_0x30bf9d[_0x2504('0x59')]][_0x2504('0x1e')],queues[_0x30bf9d[_0x2504('0x59')]][_0x2504('0xf')],queues[_0x30bf9d['transfertargetuniqueid']][_0x2504('0x5a')],queues[_0x30bf9d[_0x2504('0x59')]][_0x2504('0x5b')]));}else{utils[_0x2504('0x3')](util[_0x2504('0x4')](_0x2504('0x5d'),_0x30bf9d[_0x2504('0x52')],queues[_0x30bf9d['secondtransfererlinkedid']][_0x2504('0x1e')],_0x30bf9d[_0x2504('0x4f')]));queues[_0x30bf9d['secondtransfererlinkedid']][_0x2504('0xf')]=_0x30bf9d[_0x2504('0x4f')];}}}}catch(_0x389333){utils[_0x2504('0x36')](util['format'](_0x2504('0x4e'),_0x30bf9d[_0x2504('0x52')]),_0x389333);}};exports[_0x2504('0x65')]=function(_0x4057cd){try{if(!_['isNil'](queues[_0x4057cd['uniqueid']])){utils[_0x2504('0x10')](util['format'](_0x2504('0x66'),_0x4057cd[_0x2504('0x6')]),_0x4057cd);queues[_0x4057cd[_0x2504('0x6')]][_0x2504('0x67')]=utils[_0x2504('0x14')]();utils[_0x2504('0x3')](util[_0x2504('0x4')](_0x2504('0x68'),_0x4057cd[_0x2504('0x6')],queues[_0x4057cd[_0x2504('0x6')]][_0x2504('0x1e')],queues[_0x4057cd[_0x2504('0x6')]][_0x2504('0x67')]));}}catch(_0x36b835){utils[_0x2504('0x36')](util['format']('[%s][queues][musiconholdstart]',_0x4057cd['uniqueid']),_0x36b835);}};exports['musiconholdstop']=function(_0x172086){try{if(!_[_0x2504('0x20')](queues[_0x172086['uniqueid']])){if(!_[_0x2504('0x20')](queues[_0x172086[_0x2504('0x6')]][_0x2504('0x67')])){utils['debug'](util[_0x2504('0x4')](_0x2504('0x69'),_0x172086[_0x2504('0x6')]),_0x172086);queues[_0x172086[_0x2504('0x6')]][_0x2504('0x5c')]+=utils[_0x2504('0x32')](utils['now'](),queues[_0x172086[_0x2504('0x6')]]['musiconholdstartAt']);utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x172086[_0x2504('0x6')],queues[_0x172086['uniqueid']][_0x2504('0x1e')],queues[_0x172086['uniqueid']][_0x2504('0x5c')]));delete queues[_0x172086[_0x2504('0x6')]]['musiconholdstartAt'];}}}catch(_0x10186a){utils['error'](util[_0x2504('0x4')](_0x2504('0x69'),_0x172086[_0x2504('0x6')]),_0x10186a);}}; \ No newline at end of file +var _0x7882=['secondtransfererlinkedid','transfertype','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','mohtime','lodash','util','uniqueid','queue','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','hangup','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','isNil','variable','queuestatus','value','queuecallerabandonAt','queuecallerexitAt','toUpperCase','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','[%s][queues][agentconnect]','[%s][queues][agentcomplete]','queuecallercompleteAt','transfer','COMPLETEDBY','reason','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','[%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'];(function(_0x379fbe,_0x1d4cc4){var _0x52ac5d=function(_0xa6e6b1){while(--_0xa6e6b1){_0x379fbe['push'](_0x379fbe['shift']());}};_0x52ac5d(++_0x1d4cc4);}(_0x7882,0xdf));var _0x2788=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0x7882[_0x374ada];return _0x449ed8;};'use strict';var _=require(_0x2788('0x0'));var util=require(_0x2788('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x2de5d6){utils['info'](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x2de5d6[_0x2788('0x2')],_0x2de5d6['channel'],_0x2de5d6[_0x2788('0x3')],_0x2de5d6['lastAssignedTo'],_0x2de5d6['calleridnum'],_0x2de5d6[_0x2788('0x4')],_0x2de5d6[_0x2788('0x5')]));if(_0x2de5d6[_0x2788('0x3')]){utils[_0x2788('0x6')](_0x2de5d6[_0x2788('0x3')])['then'](function(_0x3fa1cc){if(_0x3fa1cc){_0x2de5d6[_0x2788('0x7')]=_0x3fa1cc[_0x2788('0x7')];}utils[_0x2788('0x8')](_0x2788('0x9'),_0x2de5d6);});}else{utils[_0x2788('0x8')](_0x2788('0x9'),_0x2de5d6);}if(_0x2de5d6[_0x2788('0xa')]){delete queues[_0x2de5d6[_0x2788('0xa')]];}else{delete queues[_0x2de5d6[_0x2788('0x2')]];}}exports[_0x2788('0xb')]=function(_0x3eed96){try{utils[_0x2788('0xc')](util[_0x2788('0xd')](_0x2788('0xe'),_0x3eed96[_0x2788('0x2')]),_0x3eed96);utils[_0x2788('0xf')](util[_0x2788('0xd')](_0x2788('0x10'),_0x3eed96[_0x2788('0x2')],_0x3eed96[_0x2788('0x3')],_0x3eed96[_0x2788('0x11')]));queues[_0x3eed96['uniqueid']]=_['assign'](_0x3eed96,{'originalposition':_0x3eed96[_0x2788('0x11')],'queuecallerjoinAt':utils[_0x2788('0x12')](),'mohtime':0x0});}catch(_0x5afcae){utils[_0x2788('0x13')](util[_0x2788('0xd')](_0x2788('0xe'),_0x3eed96['uniqueid']),_0x5afcae);}};exports[_0x2788('0x14')]=function(_0x1ff541){try{if(!_['isNil'](queues[_0x1ff541[_0x2788('0x2')]])){utils[_0x2788('0xc')](util[_0x2788('0xd')](_0x2788('0x15'),_0x1ff541['uniqueid']),_0x1ff541);if(queues[_0x1ff541['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x1ff541[_0x2788('0x2')]][_0x2788('0x16')]&&!queues[_0x1ff541['uniqueid']][_0x2788('0x17')]){queues[_0x1ff541['uniqueid']][_0x2788('0x18')]=!![];queues[_0x1ff541[_0x2788('0x2')]]['queuecallercompleteAt']=utils['now']();queues[_0x1ff541[_0x2788('0x2')]][_0x2788('0x5')]=_0x2788('0x19');}utils['info'](util[_0x2788('0xd')](_0x2788('0x1a'),_0x1ff541[_0x2788('0x2')],queues[_0x1ff541['uniqueid']][_0x2788('0x1b')],queues[_0x1ff541[_0x2788('0x2')]][_0x2788('0x5')]));writeDB(queues[_0x1ff541[_0x2788('0x2')]]);}else if(queues[_0x1ff541[_0x2788('0x2')]][_0x2788('0xa')]){utils[_0x2788('0xf')](util[_0x2788('0xd')](_0x2788('0x1c'),_0x1ff541[_0x2788('0x2')],queues[_0x1ff541[_0x2788('0x2')]][_0x2788('0x1b')],queues[_0x1ff541[_0x2788('0x2')]]['transfereduniqueid']));queues[queues[_0x1ff541[_0x2788('0x2')]][_0x2788('0xa')]]=queues[_0x1ff541[_0x2788('0x2')]];queues[queues[_0x1ff541[_0x2788('0x2')]][_0x2788('0xa')]][_0x2788('0x1d')]=0x2;delete queues[_0x1ff541[_0x2788('0x2')]];}}}catch(_0x13f6ff){utils['error'](util[_0x2788('0xd')](_0x2788('0x15'),_0x1ff541[_0x2788('0x2')]),_0x13f6ff);}};exports[_0x2788('0x1e')]=function(_0x1c6fa4){try{utils['debug'](util[_0x2788('0xd')](_0x2788('0x1f'),_0x1c6fa4[_0x2788('0x2')]),_0x1c6fa4);if(!_[_0x2788('0x20')](_0x1c6fa4[_0x2788('0x21')][_0x2788('0x22')])&&_0x1c6fa4[_0x2788('0x23')]['toUpperCase']()!=='CONTINUE'){if(!_[_0x2788('0x20')](queues[_0x1c6fa4[_0x2788('0x2')]])){queues[_0x1c6fa4[_0x2788('0x2')]][_0x2788('0x16')]=![];queues[_0x1c6fa4['uniqueid']][_0x2788('0x24')]=null;queues[_0x1c6fa4[_0x2788('0x2')]][_0x2788('0x17')]=!![];queues[_0x1c6fa4[_0x2788('0x2')]][_0x2788('0x25')]=utils['now']();queues[_0x1c6fa4['uniqueid']][_0x2788('0x5')]=_0x1c6fa4[_0x2788('0x23')][_0x2788('0x26')]();utils['info'](util[_0x2788('0xd')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x1c6fa4[_0x2788('0x2')],queues[_0x1c6fa4[_0x2788('0x2')]][_0x2788('0x1b')],_0x1c6fa4[_0x2788('0x23')],queues[_0x1c6fa4[_0x2788('0x2')]][_0x2788('0x5')]));writeDB(queues[_0x1c6fa4[_0x2788('0x2')]]);}}else if(!_['isNil'](_0x1c6fa4[_0x2788('0x21')][_0x2788('0x27')])){if(!_['isNil'](queues[_0x1c6fa4['uniqueid']])&&!queues[_0x1c6fa4[_0x2788('0x2')]][_0x2788('0x16')]){queues[_0x1c6fa4[_0x2788('0x2')]][_0x2788('0x16')]=![];queues[_0x1c6fa4['uniqueid']][_0x2788('0x24')]=null;queues[_0x1c6fa4[_0x2788('0x2')]]['queuecallerexit']=!![];queues[_0x1c6fa4['uniqueid']]['queuecallerexitAt']=utils[_0x2788('0x12')]();queues[_0x1c6fa4[_0x2788('0x2')]][_0x2788('0x5')]=_0x2788('0x28');utils[_0x2788('0xf')](util[_0x2788('0xd')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x1c6fa4[_0x2788('0x2')],queues[_0x1c6fa4[_0x2788('0x2')]]['name'],_0x1c6fa4[_0x2788('0x23')],queues[_0x1c6fa4[_0x2788('0x2')]]['queuecallerexitreason']));}}}catch(_0xaa95e1){utils[_0x2788('0x13')](util[_0x2788('0xd')](_0x2788('0x1f'),_0x1c6fa4[_0x2788('0x2')]),_0xaa95e1);}};exports[_0x2788('0x16')]=function(_0x173265){try{if(!_[_0x2788('0x20')](queues[_0x173265[_0x2788('0x2')]])){utils[_0x2788('0xc')](util[_0x2788('0xd')](_0x2788('0x29'),_0x173265[_0x2788('0x2')]),_0x173265);queues[_0x173265[_0x2788('0x2')]]['queuecallerexit']=![];queues[_0x173265[_0x2788('0x2')]]['queuecallerexitAt']=null;queues[_0x173265['uniqueid']][_0x2788('0x16')]=!![];queues[_0x173265[_0x2788('0x2')]][_0x2788('0x24')]=utils[_0x2788('0x12')]();queues[_0x173265[_0x2788('0x2')]][_0x2788('0x5')]='ABANDONED';utils[_0x2788('0xf')](util['format'](_0x2788('0x2a'),_0x173265['uniqueid'],queues[_0x173265[_0x2788('0x2')]][_0x2788('0x1b')],queues[_0x173265[_0x2788('0x2')]][_0x2788('0x5')]));}}catch(_0x41a0df){utils[_0x2788('0x13')](util[_0x2788('0xd')](_0x2788('0x29'),_0x173265[_0x2788('0x2')]),_0x41a0df);}};exports['queuecallerleave']=function(_0x36f437){try{if(!_[_0x2788('0x20')](queues[_0x36f437['uniqueid']])){utils[_0x2788('0xc')](util[_0x2788('0xd')](_0x2788('0x2b'),_0x36f437[_0x2788('0x2')]),_0x36f437);utils['info'](util['format'](_0x2788('0x2c'),_0x36f437['uniqueid'],queues[_0x36f437['uniqueid']][_0x2788('0x1b')],_0x36f437[_0x2788('0x2d')],_0x36f437[_0x2788('0x2e')]));queues[_0x36f437['uniqueid']][_0x2788('0x2f')]=!![];queues[_0x36f437['uniqueid']][_0x2788('0x30')]=utils[_0x2788('0x12')]();queues[_0x36f437['uniqueid']][_0x2788('0x31')]=utils[_0x2788('0x32')](queues[_0x36f437[_0x2788('0x2')]]['queuecallerleaveAt'],queues[_0x36f437[_0x2788('0x2')]][_0x2788('0x33')]);queues[_0x36f437['uniqueid']][_0x2788('0x11')]=_0x36f437[_0x2788('0x11')];queues[_0x36f437[_0x2788('0x2')]][_0x2788('0x34')]=_0x36f437[_0x2788('0x34')];queues[_0x36f437[_0x2788('0x2')]][_0x2788('0x2d')]=_0x36f437[_0x2788('0x2d')];queues[_0x36f437[_0x2788('0x2')]][_0x2788('0x2e')]=_0x36f437[_0x2788('0x2e')];}}catch(_0x787ca6){utils[_0x2788('0x13')](util['format']('[%s][queues][queuecallerleave]',_0x36f437['uniqueid']),_0x787ca6);}};exports[_0x2788('0x35')]=function(_0x40b9ee){try{if(!_['isNil'](queues[_0x40b9ee[_0x2788('0x2')]])){utils[_0x2788('0xc')](util['format']('[%s][queues][agentconnect]',_0x40b9ee[_0x2788('0x2')]),_0x40b9ee);utils[_0x2788('0xf')](util[_0x2788('0xd')](_0x2788('0x36'),_0x40b9ee[_0x2788('0x2')],queues[_0x40b9ee[_0x2788('0x2')]][_0x2788('0x1b')],_0x40b9ee[_0x2788('0x37')],_0x40b9ee[_0x2788('0x38')]));queues[_0x40b9ee[_0x2788('0x2')]][_0x2788('0x16')]=![];queues[_0x40b9ee['uniqueid']][_0x2788('0x16')]=![];queues[_0x40b9ee[_0x2788('0x2')]][_0x2788('0x24')]=null;queues[_0x40b9ee[_0x2788('0x2')]][_0x2788('0x17')]=![];queues[_0x40b9ee[_0x2788('0x2')]]['queuecallerexitreason']=null;queues[_0x40b9ee[_0x2788('0x2')]][_0x2788('0x25')]=null;queues[_0x40b9ee[_0x2788('0x2')]][_0x2788('0x39')]=!![];queues[_0x40b9ee[_0x2788('0x2')]]['accountcode']=_0x40b9ee[_0x2788('0x38')];queues[_0x40b9ee['uniqueid']][_0x2788('0x3a')]=_0x40b9ee['membername'];}}catch(_0x491935){utils['error'](util[_0x2788('0xd')](_0x2788('0x3b'),_0x40b9ee[_0x2788('0x2')]),_0x491935);}};exports['agentcomplete']=function(_0x50e67c){try{if(!_['isNil'](queues[_0x50e67c[_0x2788('0x2')]])){if(queues[_0x50e67c[_0x2788('0x2')]][_0x2788('0x30')]){utils[_0x2788('0xc')](util[_0x2788('0xd')](_0x2788('0x3c'),_0x50e67c['uniqueid']),_0x50e67c);queues[_0x50e67c[_0x2788('0x2')]][_0x2788('0x16')]=![];queues[_0x50e67c[_0x2788('0x2')]]['queuecallerabandon']=![];queues[_0x50e67c[_0x2788('0x2')]][_0x2788('0x24')]=null;queues[_0x50e67c[_0x2788('0x2')]][_0x2788('0x17')]=![];queues[_0x50e67c[_0x2788('0x2')]][_0x2788('0x25')]=null;queues[_0x50e67c[_0x2788('0x2')]][_0x2788('0x39')]=!![];queues[_0x50e67c['uniqueid']][_0x2788('0x3a')]=_0x50e67c[_0x2788('0x37')];queues[_0x50e67c['uniqueid']]['queuecallercomplete']=!![];queues[_0x50e67c['uniqueid']][_0x2788('0x3d')]=utils[_0x2788('0x12')]();if(_0x50e67c['reason']==_0x2788('0x3e')){if(!queues[_0x50e67c[_0x2788('0x2')]][_0x2788('0x3e')]){queues[_0x50e67c[_0x2788('0x2')]][_0x2788('0x5')]='TRANSFER';}}else{queues[_0x50e67c[_0x2788('0x2')]][_0x2788('0x5')]=_0x2788('0x3f')+_0x50e67c[_0x2788('0x40')][_0x2788('0x26')]();}utils[_0x2788('0xf')](util[_0x2788('0xd')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x50e67c[_0x2788('0x2')],queues[_0x50e67c['uniqueid']][_0x2788('0x1b')],_0x50e67c[_0x2788('0x37')],queues[_0x50e67c[_0x2788('0x2')]][_0x2788('0x5')]));writeDB(queues[_0x50e67c[_0x2788('0x2')]]);}}}catch(_0x5542fc){utils[_0x2788('0x13')](util[_0x2788('0xd')](_0x2788('0x3c'),_0x50e67c[_0x2788('0x2')]),_0x5542fc);}};exports['blindtransfer']=function(_0x281dbb){try{if(!_[_0x2788('0x20')](queues[_0x281dbb['transfereeuniqueid']])){utils[_0x2788('0xc')](util[_0x2788('0xd')](_0x2788('0x41'),_0x281dbb[_0x2788('0x2')]),_0x281dbb);queues[_0x281dbb[_0x2788('0x42')]]['transfer']=!![];queues[_0x281dbb[_0x2788('0x42')]]['transfertype']=_0x2788('0x43');queues[_0x281dbb[_0x2788('0x42')]][_0x2788('0x44')]=_0x281dbb[_0x2788('0x45')];queues[_0x281dbb[_0x2788('0x42')]][_0x2788('0x46')]=_0x281dbb[_0x2788('0x42')];queues[_0x281dbb['transfereeuniqueid']][_0x2788('0x5')]='BLINDTRANSFER';utils[_0x2788('0xf')](util['format'](_0x2788('0x47'),_0x281dbb[_0x2788('0x2')],queues[_0x281dbb[_0x2788('0x42')]][_0x2788('0x1b')],_0x281dbb[_0x2788('0x42')],_0x281dbb[_0x2788('0x45')]));}}catch(_0xe6f68b){utils[_0x2788('0x13')](util[_0x2788('0xd')](_0x2788('0x41'),_0x281dbb['uniqueid']),_0xe6f68b);}};exports[_0x2788('0x48')]=function(_0xf59156){try{utils[_0x2788('0xc')](util[_0x2788('0xd')](_0x2788('0x49'),_0xf59156[_0x2788('0x4a')]),_0xf59156);if(_0xf59156[_0x2788('0x4a')]==_0xf59156[_0x2788('0x4b')]){if(!_[_0x2788('0x20')](queues[_0xf59156['secondtransfererlinkedid']])){utils[_0x2788('0xf')](util[_0x2788('0xd')](_0x2788('0x4c'),_0xf59156[_0x2788('0x4a')],queues[_0xf59156['secondtransfererlinkedid']][_0x2788('0x1b')],_0xf59156['origtransfererexten']));queues[_0xf59156[_0x2788('0x4d')]][_0x2788('0x3e')]=!![];queues[_0xf59156[_0x2788('0x4d')]][_0x2788('0x4e')]=_0x2788('0x4f');queues[_0xf59156[_0x2788('0x4d')]]['transferexten']=_0xf59156[_0x2788('0x50')];queues[_0xf59156[_0x2788('0x4d')]][_0x2788('0x46')]=_0xf59156[_0x2788('0x4a')];queues[_0xf59156[_0x2788('0x4d')]][_0x2788('0x5')]=_0x2788('0x51');}if(!_[_0x2788('0x20')](queues[_0xf59156[_0x2788('0x4b')]])){if(_0xf59156[_0x2788('0x52')]&&queues[_0xf59156[_0x2788('0x52')]]){queues[_0xf59156['transfereelinkedid']][_0x2788('0x1d')]=0x1;queues[_0xf59156[_0x2788('0x42')]]=_[_0x2788('0x53')](queues[_0xf59156[_0x2788('0x52')]]);queues[_0xf59156[_0x2788('0x42')]][_0x2788('0xa')]=_0xf59156[_0x2788('0x54')];queues[_0xf59156[_0x2788('0x42')]][_0x2788('0x1d')]=0x2;queues[_0xf59156['transfereeuniqueid']][_0x2788('0x55')]=queues[_0xf59156['secondtransfererlinkedid']][_0x2788('0x55')];queues[_0xf59156[_0x2788('0x42')]][_0x2788('0x56')]=queues[_0xf59156['secondtransfererlinkedid']][_0x2788('0x56')];queues[_0xf59156['transfereeuniqueid']][_0x2788('0x33')]=utils[_0x2788('0x12')]();queues[_0xf59156[_0x2788('0x42')]][_0x2788('0x30')]=utils[_0x2788('0x12')]();queues[_0xf59156[_0x2788('0x42')]][_0x2788('0x31')]=0x0;queues[_0xf59156['transfereeuniqueid']]['mohtime']=0x0;utils[_0x2788('0xf')](util[_0x2788('0xd')](_0x2788('0x57'),_0xf59156[_0x2788('0x4a')],queues[_0xf59156[_0x2788('0x42')]][_0x2788('0x1b')],queues[_0xf59156['transfereeuniqueid']][_0x2788('0x55')],queues[_0xf59156['transfereeuniqueid']][_0x2788('0x56')]));}else{utils[_0x2788('0xf')](util['format'](_0x2788('0x58'),_0xf59156[_0x2788('0x4a')],queues[_0xf59156[_0x2788('0x4b')]][_0x2788('0x1b')],_0xf59156[_0x2788('0x4d')]));queues[_0xf59156[_0x2788('0x4b')]][_0x2788('0xa')]=_0xf59156[_0x2788('0x4d')];}}}else if(_0xf59156[_0x2788('0x59')]==_0xf59156[_0x2788('0x4d')]){if(!_[_0x2788('0x20')](queues[_0xf59156[_0x2788('0x4b')]])){utils[_0x2788('0xf')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0xf59156[_0x2788('0x4a')],queues[_0xf59156[_0x2788('0x4b')]]['name'],_0xf59156[_0x2788('0x59')],_0xf59156[_0x2788('0x5a')]));queues[_0xf59156['origtransfererlinkedid']][_0x2788('0x3e')]=!![];queues[_0xf59156[_0x2788('0x4b')]][_0x2788('0x4e')]='ATTENDED';queues[_0xf59156[_0x2788('0x4b')]][_0x2788('0x44')]=_0xf59156[_0x2788('0x5a')];queues[_0xf59156[_0x2788('0x4b')]][_0x2788('0x46')]=_0xf59156[_0x2788('0x59')];queues[_0xf59156['origtransfererlinkedid']][_0x2788('0x5')]='ATTENDEDTRANSFER';}if(!_[_0x2788('0x20')](queues[_0xf59156[_0x2788('0x4d')]])){if(_0xf59156[_0x2788('0x5b')]&&queues[_0xf59156[_0x2788('0x5b')]]){queues[_0xf59156[_0x2788('0x5b')]]['queuecallerenterreason']=0x1;queues[_0xf59156['transfertargetuniqueid']]=_['clone'](queues[_0xf59156[_0x2788('0x5b')]]);queues[_0xf59156['transfertargetuniqueid']][_0x2788('0xa')]=_0xf59156['transfertargetuniqueid'];queues[_0xf59156[_0x2788('0x54')]][_0x2788('0x1d')]=0x2;queues[_0xf59156['transfertargetuniqueid']][_0x2788('0x55')]=queues[_0xf59156['origtransfererlinkedid']][_0x2788('0x55')];queues[_0xf59156[_0x2788('0x54')]][_0x2788('0x56')]=queues[_0xf59156[_0x2788('0x4b')]][_0x2788('0x56')];queues[_0xf59156[_0x2788('0x54')]]['queuecallerjoinAt']=utils[_0x2788('0x12')]();queues[_0xf59156[_0x2788('0x54')]][_0x2788('0x30')]=utils[_0x2788('0x12')]();queues[_0xf59156[_0x2788('0x54')]][_0x2788('0x31')]=0x0;queues[_0xf59156[_0x2788('0x54')]]['mohtime']=0x0;utils[_0x2788('0xf')](util[_0x2788('0xd')](_0x2788('0x5c'),_0xf59156['origtransfereruniqueid'],queues[_0xf59156[_0x2788('0x54')]]['name'],queues[_0xf59156['transfertargetuniqueid']]['transfereduniqueid'],queues[_0xf59156[_0x2788('0x54')]][_0x2788('0x55')],queues[_0xf59156['transfertargetuniqueid']][_0x2788('0x56')]));}else{utils[_0x2788('0xf')](util[_0x2788('0xd')](_0x2788('0x58'),_0xf59156['origtransfereruniqueid'],queues[_0xf59156[_0x2788('0x4d')]][_0x2788('0x1b')],_0xf59156[_0x2788('0x4b')]));queues[_0xf59156[_0x2788('0x4d')]][_0x2788('0xa')]=_0xf59156['origtransfererlinkedid'];}}}}catch(_0x34b14f){utils[_0x2788('0x13')](util['format'](_0x2788('0x49'),_0xf59156[_0x2788('0x4a')]),_0x34b14f);}};exports[_0x2788('0x5d')]=function(_0x1ce492){try{if(!_[_0x2788('0x20')](queues[_0x1ce492['uniqueid']])){utils[_0x2788('0xc')](util['format'](_0x2788('0x5e'),_0x1ce492['uniqueid']),_0x1ce492);queues[_0x1ce492['uniqueid']][_0x2788('0x5f')]=utils[_0x2788('0x12')]();utils[_0x2788('0xf')](util[_0x2788('0xd')](_0x2788('0x60'),_0x1ce492[_0x2788('0x2')],queues[_0x1ce492[_0x2788('0x2')]][_0x2788('0x1b')],queues[_0x1ce492['uniqueid']][_0x2788('0x5f')]));}}catch(_0x565b90){utils[_0x2788('0x13')](util['format'](_0x2788('0x5e'),_0x1ce492['uniqueid']),_0x565b90);}};exports[_0x2788('0x61')]=function(_0x5bd54f){try{if(!_[_0x2788('0x20')](queues[_0x5bd54f['uniqueid']])){if(!_['isNil'](queues[_0x5bd54f[_0x2788('0x2')]][_0x2788('0x5f')])){utils['debug'](util['format'](_0x2788('0x62'),_0x5bd54f[_0x2788('0x2')]),_0x5bd54f);queues[_0x5bd54f[_0x2788('0x2')]][_0x2788('0x63')]+=utils['diffTime'](utils['now'](),queues[_0x5bd54f[_0x2788('0x2')]][_0x2788('0x5f')]);utils[_0x2788('0xf')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x5bd54f[_0x2788('0x2')],queues[_0x5bd54f[_0x2788('0x2')]][_0x2788('0x1b')],queues[_0x5bd54f[_0x2788('0x2')]][_0x2788('0x63')]));delete queues[_0x5bd54f[_0x2788('0x2')]]['musiconholdstartAt'];}}}catch(_0x85ed4b){utils[_0x2788('0x13')](util['format'](_0x2788('0x62'),_0x5bd54f[_0x2788('0x2')]),_0x85ed4b);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index c5ce331..e82bec3 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 _0x5ee1=['split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','replace','.wav49','.WAV','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith'];(function(_0xb7e9b8,_0x45eec8){var _0x41d33c=function(_0x4c551e){while(--_0x4c551e){_0xb7e9b8['push'](_0xb7e9b8['shift']());}};_0x41d33c(++_0x45eec8);}(_0x5ee1,0x10a));var _0x15ee=function(_0x22c5c7,_0x3b5bca){_0x22c5c7=_0x22c5c7-0x0;var _0x2c49ea=_0x5ee1[_0x22c5c7];return _0x2c49ea;};'use strict';var _=require(_0x15ee('0x0'));var util=require(_0x15ee('0x1'));var utils=require(_0x15ee('0x2'));var recordings={};function writeDB(_0x18665e){utils[_0x15ee('0x3')](util[_0x15ee('0x4')](_0x15ee('0x5'),_0x18665e[_0x15ee('0x6')]));if(_0x18665e['accountcode']){utils[_0x15ee('0x7')](_0x18665e[_0x15ee('0x8')])['then'](function(_0x10926b){if(_0x10926b){_0x18665e[_0x15ee('0x9')]=_0x10926b[_0x15ee('0xa')];_0x18665e[_0x15ee('0xb')]=_0x10926b['id'];}utils[_0x15ee('0xc')](_0x15ee('0xd'),_0x18665e);});}else{utils[_0x15ee('0xc')](_0x15ee('0xd'),_0x18665e);}}exports[_0x15ee('0xe')]=function(_0x3ebf58){try{utils[_0x15ee('0xf')](util[_0x15ee('0x4')](_0x15ee('0x10'),_0x3ebf58[_0x15ee('0x6')]),_0x3ebf58);if(_0x3ebf58['uniqueid']==_0x3ebf58['linkedid']){utils[_0x15ee('0x3')](util[_0x15ee('0x4')](_0x15ee('0x11'),_0x3ebf58[_0x15ee('0x6')],_0x3ebf58[_0x15ee('0x12')],_0x3ebf58[_0x15ee('0x13')]));recordings[_0x3ebf58['uniqueid']]={'uniqueid':_0x3ebf58[_0x15ee('0x6')],'accountcode':_0x3ebf58['accountcode'],'exten':_0x3ebf58[_0x15ee('0x13')],'context':_0x3ebf58[_0x15ee('0x12')],'channel':_0x3ebf58[_0x15ee('0x14')],'monitors':[]};}}catch(_0xc4dc20){utils[_0x15ee('0x15')](util[_0x15ee('0x4')](_0x15ee('0x10'),_0x3ebf58['uniqueid']),_0xc4dc20);}};exports[_0x15ee('0x16')]=function(_0x278470){try{utils[_0x15ee('0xf')](util['format'](_0x15ee('0x17'),_0x278470[_0x15ee('0x6')]),_0x278470);if(!_['isNil'](recordings[_0x278470['uniqueid']])&&_0x278470[_0x15ee('0x18')]==0x6){utils[_0x15ee('0x3')](util[_0x15ee('0x4')](_0x15ee('0x19'),_0x278470[_0x15ee('0x6')],_0x278470['context'],_0x278470[_0x15ee('0x14')]));}else if(!_[_0x15ee('0x1a')](recordings[_0x278470[_0x15ee('0x1b')]])&&_0x278470['channelstate']==0x6&&_0x278470[_0x15ee('0x12')]!=_0x15ee('0x1c')){utils[_0x15ee('0x3')](util[_0x15ee('0x4')](_0x15ee('0x1d'),_0x278470['uniqueid'],_0x278470['linkedid'],_0x278470[_0x15ee('0x12')],_0x278470[_0x15ee('0x14')]));recordings[_0x278470[_0x15ee('0x1b')]][_0x15ee('0x8')]=_0x278470[_0x15ee('0x8')];}}catch(_0xcd42cb){utils[_0x15ee('0x15')](util[_0x15ee('0x4')](_0x15ee('0x17'),_0x278470['uniqueid']),_0xcd42cb);}};exports[_0x15ee('0x1e')]=function(_0x35ef3f){try{if(!_['isNil'](_0x35ef3f['variable'])&&!_[_0x15ee('0x1a')](_0x35ef3f[_0x15ee('0x1f')][_0x15ee('0x20')])){utils['debug'](util[_0x15ee('0x4')](_0x15ee('0x21'),_0x35ef3f['uniqueid']),_0x35ef3f);utils[_0x15ee('0x3')](util['format'](_0x15ee('0x22'),_0x35ef3f[_0x15ee('0x6')],_0x35ef3f[_0x15ee('0x1f')],_0x35ef3f['value']));if(_[_0x15ee('0x23')](_0x35ef3f[_0x15ee('0x24')],'.wav49')){_0x35ef3f[_0x15ee('0x24')]=_0x35ef3f[_0x15ee('0x24')][_0x15ee('0x25')](_0x15ee('0x26'),_0x15ee('0x27'));}if(recordings[_0x35ef3f[_0x15ee('0x1b')]]){var _0x4dcf97=_['find'](recordings[_0x35ef3f['linkedid']][_0x15ee('0x28')],{'value':_0x35ef3f[_0x15ee('0x24')]});if(_[_0x15ee('0x1a')](_0x4dcf97)){recordings[_0x35ef3f[_0x15ee('0x1b')]][_0x15ee('0x28')][_0x15ee('0x29')]({'value':_0x35ef3f[_0x15ee('0x24')]});}}}}catch(_0x143918){utils[_0x15ee('0x15')](util[_0x15ee('0x4')](_0x15ee('0x21'),_0x35ef3f['uniqueid']),_0x143918);}};exports[_0x15ee('0x2a')]=function(_0x1934e5){try{if(!_['isNil'](recordings[_0x1934e5['uniqueid']])){utils[_0x15ee('0xf')](util[_0x15ee('0x4')](_0x15ee('0x2b'),_0x1934e5[_0x15ee('0x6')]),_0x1934e5);utils[_0x15ee('0x3')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x1934e5[_0x15ee('0x6')],_0x1934e5[_0x15ee('0x2c')],_0x1934e5[_0x15ee('0x2d')],_0x1934e5[_0x15ee('0x2e')]));recordings[_0x1934e5[_0x15ee('0x6')]]['calleridnum']=_0x1934e5[_0x15ee('0x2c')];recordings[_0x1934e5['uniqueid']][_0x15ee('0x2d')]=_0x1934e5[_0x15ee('0x2d')];recordings[_0x1934e5[_0x15ee('0x6')]]['connectedlinenum']=_0x1934e5[_0x15ee('0x2f')];recordings[_0x1934e5[_0x15ee('0x6')]]['connectedlinename']=_0x1934e5[_0x15ee('0x30')];if(recordings[_0x1934e5[_0x15ee('0x6')]][_0x15ee('0x31')]==_0x15ee('0x32')&&recordings[_0x1934e5[_0x15ee('0x6')]][_0x15ee('0x8')]){recordings[_0x1934e5['uniqueid']][_0x15ee('0x2f')]=recordings[_0x1934e5[_0x15ee('0x6')]]['accountcode'];recordings[_0x1934e5[_0x15ee('0x6')]][_0x15ee('0x30')]='';}recordings[_0x1934e5[_0x15ee('0x6')]]['monitors']['forEach'](function(_0x2d0ed7){var _0x2b4c5e=_[_0x15ee('0x33')](recordings[_0x1934e5[_0x15ee('0x6')]]);_0x2b4c5e[_0x15ee('0x24')]=_0x2d0ed7[_0x15ee('0x24')];writeDB(_0x2b4c5e);});delete recordings[_0x1934e5[_0x15ee('0x6')]];}}catch(_0x42a8e5){utils[_0x15ee('0x15')](util[_0x15ee('0x4')](_0x15ee('0x2b'),_0x1934e5[_0x15ee('0x6')]),_0x42a8e5);}};exports[_0x15ee('0x34')]=function(_0x9e04ce){try{if(!_[_0x15ee('0x1a')](recordings[_0x9e04ce[_0x15ee('0x6')]])){utils[_0x15ee('0xf')](util['format'](_0x15ee('0x35'),_0x9e04ce[_0x15ee('0x6')]),_0x9e04ce);utils[_0x15ee('0x3')](util[_0x15ee('0x4')](_0x15ee('0x36'),_0x9e04ce[_0x15ee('0x6')],_0x9e04ce[_0x15ee('0x37')],_0x9e04ce[_0x15ee('0x38')]));if(_0x9e04ce[_0x15ee('0x37')][_0x15ee('0x39')]()=='set'&&_[_0x15ee('0x3a')](_0x9e04ce[_0x15ee('0x38')][_0x15ee('0x39')](),'cdr')){var _0x4f3d45=_0x9e04ce[_0x15ee('0x38')][_0x15ee('0x3b')]('=');var _0x469889=_0x4f3d45[0x0]['substring'](_0x4f3d45[0x0][_0x15ee('0x3c')]('(')+0x1,_0x4f3d45[0x0][_0x15ee('0x3c')](')'));var _0xf170cf=_0x4f3d45[0x1];recordings[_0x9e04ce['uniqueid']][_0x469889]=_0xf170cf;}}}catch(_0x821e68){utils[_0x15ee('0x15')](util[_0x15ee('0x4')](_0x15ee('0x35'),_0x9e04ce[_0x15ee('0x6')]),_0x821e68);}};exports[_0x15ee('0x3d')]=function(_0x19f0d3){try{if(!_['isNil'](recordings[_0x19f0d3['uniqueid']])){utils['debug'](util[_0x15ee('0x4')](_0x15ee('0x3e'),_0x19f0d3[_0x15ee('0x6')]),_0x19f0d3);utils[_0x15ee('0x3')](util['format'](_0x15ee('0x3f'),_0x19f0d3['uniqueid'],_0x19f0d3[_0x15ee('0x40')]));recordings[_0x19f0d3[_0x15ee('0x6')]][_0x15ee('0x40')]=_0x19f0d3[_0x15ee('0x40')];}}catch(_0x356812){utils[_0x15ee('0x15')](util[_0x15ee('0x4')](_0x15ee('0x3e'),_0x19f0d3[_0x15ee('0x6')]),_0x356812);}}; \ No newline at end of file +var _0xd5e7=['uniqueid','accountcode','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','newchannel','debug','format','[%s][recordings][newchannel]','linkedid','context','exten','error','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','replace','.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','info','[%s][recordings][writeDB]'];(function(_0x45c48f,_0x4aa891){var _0xaf5037=function(_0x3e3c1f){while(--_0x3e3c1f){_0x45c48f['push'](_0x45c48f['shift']());}};_0xaf5037(++_0x4aa891);}(_0xd5e7,0x141));var _0x7d5e=function(_0x5f1de4,_0x47c201){_0x5f1de4=_0x5f1de4-0x0;var _0x1aeaf0=_0xd5e7[_0x5f1de4];return _0x1aeaf0;};'use strict';var _=require('lodash');var util=require(_0x7d5e('0x0'));var utils=require(_0x7d5e('0x1'));var recordings={};function writeDB(_0x30b6a6){utils[_0x7d5e('0x2')](util['format'](_0x7d5e('0x3'),_0x30b6a6[_0x7d5e('0x4')]));if(_0x30b6a6[_0x7d5e('0x5')]){utils[_0x7d5e('0x6')](_0x30b6a6[_0x7d5e('0x5')])[_0x7d5e('0x7')](function(_0x34ef9e){if(_0x34ef9e){_0x30b6a6['membername']=_0x34ef9e[_0x7d5e('0x8')];_0x30b6a6[_0x7d5e('0x9')]=_0x34ef9e['id'];}utils[_0x7d5e('0xa')](_0x7d5e('0xb'),_0x30b6a6);});}else{utils[_0x7d5e('0xa')](_0x7d5e('0xb'),_0x30b6a6);}}exports[_0x7d5e('0xc')]=function(_0x14060b){try{utils[_0x7d5e('0xd')](util[_0x7d5e('0xe')](_0x7d5e('0xf'),_0x14060b[_0x7d5e('0x4')]),_0x14060b);if(_0x14060b[_0x7d5e('0x4')]==_0x14060b[_0x7d5e('0x10')]){utils['info'](util[_0x7d5e('0xe')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x14060b[_0x7d5e('0x4')],_0x14060b[_0x7d5e('0x11')],_0x14060b[_0x7d5e('0x12')]));recordings[_0x14060b[_0x7d5e('0x4')]]={'uniqueid':_0x14060b[_0x7d5e('0x4')],'accountcode':_0x14060b[_0x7d5e('0x5')],'exten':_0x14060b['exten'],'context':_0x14060b[_0x7d5e('0x11')],'channel':_0x14060b['channel'],'monitors':[]};}}catch(_0x4145ab){utils[_0x7d5e('0x13')](util[_0x7d5e('0xe')](_0x7d5e('0xf'),_0x14060b[_0x7d5e('0x4')]),_0x4145ab);}};exports[_0x7d5e('0x14')]=function(_0xc053){try{utils[_0x7d5e('0xd')](util[_0x7d5e('0xe')](_0x7d5e('0x15'),_0xc053['uniqueid']),_0xc053);if(!_[_0x7d5e('0x16')](recordings[_0xc053[_0x7d5e('0x4')]])&&_0xc053['channelstate']==0x6){utils['info'](util[_0x7d5e('0xe')](_0x7d5e('0x17'),_0xc053[_0x7d5e('0x4')],_0xc053[_0x7d5e('0x11')],_0xc053['channel']));}else if(!_[_0x7d5e('0x16')](recordings[_0xc053[_0x7d5e('0x10')]])&&_0xc053[_0x7d5e('0x18')]==0x6&&_0xc053[_0x7d5e('0x11')]!=_0x7d5e('0x19')){utils[_0x7d5e('0x2')](util[_0x7d5e('0xe')](_0x7d5e('0x1a'),_0xc053[_0x7d5e('0x4')],_0xc053[_0x7d5e('0x10')],_0xc053['context'],_0xc053['channel']));recordings[_0xc053[_0x7d5e('0x10')]][_0x7d5e('0x5')]=_0xc053[_0x7d5e('0x5')];}}catch(_0x4b242b){utils[_0x7d5e('0x13')](util[_0x7d5e('0xe')](_0x7d5e('0x15'),_0xc053[_0x7d5e('0x4')]),_0x4b242b);}};exports[_0x7d5e('0x1b')]=function(_0x3cba4f){try{if(!_[_0x7d5e('0x16')](_0x3cba4f[_0x7d5e('0x1c')])&&!_['isNil'](_0x3cba4f[_0x7d5e('0x1c')][_0x7d5e('0x1d')])){utils['debug'](util[_0x7d5e('0xe')](_0x7d5e('0x1e'),_0x3cba4f[_0x7d5e('0x4')]),_0x3cba4f);utils[_0x7d5e('0x2')](util[_0x7d5e('0xe')](_0x7d5e('0x1f'),_0x3cba4f[_0x7d5e('0x4')],_0x3cba4f[_0x7d5e('0x1c')],_0x3cba4f['value']));if(_[_0x7d5e('0x20')](_0x3cba4f[_0x7d5e('0x21')],'.wav49')){_0x3cba4f[_0x7d5e('0x21')]=_0x3cba4f['value'][_0x7d5e('0x22')]('.wav49',_0x7d5e('0x23'));}if(recordings[_0x3cba4f['linkedid']]){var _0x356a99=_[_0x7d5e('0x24')](recordings[_0x3cba4f[_0x7d5e('0x10')]][_0x7d5e('0x25')],{'value':_0x3cba4f[_0x7d5e('0x21')]});if(_['isNil'](_0x356a99)){recordings[_0x3cba4f[_0x7d5e('0x10')]][_0x7d5e('0x25')][_0x7d5e('0x26')]({'value':_0x3cba4f[_0x7d5e('0x21')]});}}}}catch(_0xd05a48){utils[_0x7d5e('0x13')](util['format'](_0x7d5e('0x1e'),_0x3cba4f[_0x7d5e('0x4')]),_0xd05a48);}};exports['hangup']=function(_0xed9e50){try{if(!_['isNil'](recordings[_0xed9e50[_0x7d5e('0x4')]])){utils[_0x7d5e('0xd')](util[_0x7d5e('0xe')](_0x7d5e('0x27'),_0xed9e50[_0x7d5e('0x4')]),_0xed9e50);utils[_0x7d5e('0x2')](util[_0x7d5e('0xe')](_0x7d5e('0x28'),_0xed9e50[_0x7d5e('0x4')],_0xed9e50[_0x7d5e('0x29')],_0xed9e50[_0x7d5e('0x2a')],_0xed9e50[_0x7d5e('0x2b')]));recordings[_0xed9e50[_0x7d5e('0x4')]]['calleridnum']=_0xed9e50[_0x7d5e('0x29')];recordings[_0xed9e50[_0x7d5e('0x4')]][_0x7d5e('0x2a')]=_0xed9e50[_0x7d5e('0x2a')];recordings[_0xed9e50[_0x7d5e('0x4')]][_0x7d5e('0x2c')]=_0xed9e50[_0x7d5e('0x2c')];recordings[_0xed9e50[_0x7d5e('0x4')]][_0x7d5e('0x2d')]=_0xed9e50[_0x7d5e('0x2d')];if(recordings[_0xed9e50['uniqueid']][_0x7d5e('0x2e')]==_0x7d5e('0x2f')&&recordings[_0xed9e50[_0x7d5e('0x4')]][_0x7d5e('0x5')]){recordings[_0xed9e50['uniqueid']]['connectedlinenum']=recordings[_0xed9e50[_0x7d5e('0x4')]]['accountcode'];recordings[_0xed9e50[_0x7d5e('0x4')]][_0x7d5e('0x2d')]='';}recordings[_0xed9e50[_0x7d5e('0x4')]]['monitors'][_0x7d5e('0x30')](function(_0x28922d){var _0x3c2631=_['clone'](recordings[_0xed9e50[_0x7d5e('0x4')]]);_0x3c2631['value']=_0x28922d[_0x7d5e('0x21')];writeDB(_0x3c2631);});delete recordings[_0xed9e50[_0x7d5e('0x4')]];}}catch(_0xca4a76){utils[_0x7d5e('0x13')](util['format'](_0x7d5e('0x27'),_0xed9e50[_0x7d5e('0x4')]),_0xca4a76);}};exports[_0x7d5e('0x31')]=function(_0x290f89){try{if(!_[_0x7d5e('0x16')](recordings[_0x290f89[_0x7d5e('0x4')]])){utils[_0x7d5e('0xd')](util[_0x7d5e('0xe')]('[%s][recordings][newexten]',_0x290f89['uniqueid']),_0x290f89);utils[_0x7d5e('0x2')](util[_0x7d5e('0xe')](_0x7d5e('0x32'),_0x290f89[_0x7d5e('0x4')],_0x290f89[_0x7d5e('0x33')],_0x290f89[_0x7d5e('0x34')]));if(_0x290f89[_0x7d5e('0x33')]['toLowerCase']()==_0x7d5e('0x35')&&_[_0x7d5e('0x36')](_0x290f89[_0x7d5e('0x34')][_0x7d5e('0x37')](),_0x7d5e('0x38'))){var _0x2432b9=_0x290f89['appdata'][_0x7d5e('0x39')]('=');var _0x5d8635=_0x2432b9[0x0][_0x7d5e('0x3a')](_0x2432b9[0x0][_0x7d5e('0x3b')]('(')+0x1,_0x2432b9[0x0][_0x7d5e('0x3b')](')'));var _0x20691e=_0x2432b9[0x1];recordings[_0x290f89[_0x7d5e('0x4')]][_0x5d8635]=_0x20691e;}}}catch(_0x4bd712){utils[_0x7d5e('0x13')](util[_0x7d5e('0xe')](_0x7d5e('0x3c'),_0x290f89[_0x7d5e('0x4')]),_0x4bd712);}};exports[_0x7d5e('0x3d')]=function(_0x4e38c6){try{if(!_['isNil'](recordings[_0x4e38c6[_0x7d5e('0x4')]])){utils[_0x7d5e('0xd')](util[_0x7d5e('0xe')](_0x7d5e('0x3e'),_0x4e38c6[_0x7d5e('0x4')]),_0x4e38c6);utils[_0x7d5e('0x2')](util[_0x7d5e('0xe')](_0x7d5e('0x3f'),_0x4e38c6[_0x7d5e('0x4')],_0x4e38c6['queue']));recordings[_0x4e38c6[_0x7d5e('0x4')]][_0x7d5e('0x40')]=_0x4e38c6[_0x7d5e('0x40')];}}catch(_0x52e1d4){utils[_0x7d5e('0x13')](util[_0x7d5e('0xe')](_0x7d5e('0x3e'),_0x4e38c6[_0x7d5e('0x4')]),_0x52e1d4);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 7a4cad6..2e185bb 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 _0xb64e=['type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','debug','format','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfererexten','isNil','transfereechannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','util','./utils','info'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0xb64e,0x149));var _0xeb64=function(_0x4bbc15,_0x5ed722){_0x4bbc15=_0x4bbc15-0x0;var _0x192991=_0xb64e[_0x4bbc15];return _0x192991;};'use strict';var _=require(_0xeb64('0x0'));var util=require(_0xeb64('0x1'));var utils=require(_0xeb64('0x2'));function writeDB(_0x455194){utils[_0xeb64('0x3')](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x455194[_0xeb64('0x4')]===_0xeb64('0x5')?_0x455194[_0xeb64('0x6')]:_0x455194[_0xeb64('0x7')],_0x455194['type']));utils['request'](_0xeb64('0x8'),_0x455194);}exports[_0xeb64('0x9')]={};exports[_0xeb64('0xa')]=function(_0x317c11){try{utils[_0xeb64('0xb')](util[_0xeb64('0xc')]('[%s][transfers][blindtransfer]',_0x317c11[_0xeb64('0x7')]),_0x317c11);utils[_0xeb64('0x3')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x317c11['uniqueid'],_0x317c11['transferercalleridnum'],_0x317c11[_0xeb64('0xd')],_0x317c11[_0xeb64('0xe')],_0x317c11[_0xeb64('0xf')]));_0x317c11[_0xeb64('0x4')]=_0xeb64('0x10');exports[_0xeb64('0x9')][_0x317c11[_0xeb64('0x11')]]=_0x317c11;writeDB(_0x317c11);}catch(_0x38e921){utils['error'](util[_0xeb64('0xc')]('[%s][transfers][blindtransfer]',_0x317c11[_0xeb64('0x7')]),_0x38e921);}};exports[_0xeb64('0x12')]=function(_0x129b1c){try{utils[_0xeb64('0xb')](util[_0xeb64('0xc')](_0xeb64('0x13'),_0x129b1c[_0xeb64('0x6')]),_0x129b1c);utils['info'](util[_0xeb64('0xc')](_0xeb64('0x14'),_0x129b1c[_0xeb64('0x6')],_0x129b1c[_0xeb64('0x15')],_0x129b1c[_0xeb64('0x16')],_0x129b1c[_0xeb64('0x17')],_0x129b1c['transfertargetcalleridname']));_0x129b1c=_[_0xeb64('0x18')](_0x129b1c,{'transfererchannel':_0x129b1c[_0xeb64('0x19')],'transferercalleridnum':_0x129b1c[_0xeb64('0x15')],'transferercalleridname':_0x129b1c[_0xeb64('0x16')],'transfererconnectedlinenum':_0x129b1c[_0xeb64('0x1a')],'transfererconnectedlinename':_0x129b1c[_0xeb64('0x1b')],'transfereraccountcode':_0x129b1c['origtransfereraccountcode'],'transferercontext':_0x129b1c['secondtransferercontext'],'transfererexten':_0x129b1c['secondtransfererexten'],'transfererlinkedid':_0x129b1c['origtransfererlinkedid'],'context':_0x129b1c['origtransferercontext'],'extension':_0x129b1c[_0xeb64('0x1c')],'type':_0xeb64('0x5')});if(_[_0xeb64('0x1d')](_0x129b1c[_0xeb64('0x1e')])){_0x129b1c=_[_0xeb64('0x18')](_0x129b1c,{'transfereechannel':_0x129b1c['transfertargetchannel'],'transfereecalleridnum':_0x129b1c['transfertargetcalleridnum'],'transfereecalleridname':_0x129b1c[_0xeb64('0x1f')],'transfereeconnectedlinenum':_0x129b1c[_0xeb64('0x20')],'transfereeconnectedlinename':_0x129b1c[_0xeb64('0x21')],'transfereeaccountcode':_0x129b1c[_0xeb64('0x22')],'transfereecontext':_0x129b1c[_0xeb64('0x23')],'transfereeexten':_0x129b1c[_0xeb64('0x24')],'transfereelinkedid':_0x129b1c['transfertargetlinkedid']});}writeDB(_0x129b1c);}catch(_0x4b1aab){utils['error'](util[_0xeb64('0xc')]('[%s][transfers][attendedtransfer]',_0x129b1c[_0xeb64('0x6')]),_0x4b1aab);}}; \ No newline at end of file +var _0xf03b=['origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','blind','blinds','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode'];(function(_0x3a7424,_0x4856a8){var _0x13b53a=function(_0x6725a8){while(--_0x6725a8){_0x3a7424['push'](_0x3a7424['shift']());}};_0x13b53a(++_0x4856a8);}(_0xf03b,0x187));var _0xbf03=function(_0x1698dd,_0x4e59cf){_0x1698dd=_0x1698dd-0x0;var _0x4c3cd8=_0xf03b[_0x1698dd];return _0x4c3cd8;};'use strict';var _=require('lodash');var util=require(_0xbf03('0x0'));var utils=require('./utils');function writeDB(_0x2f66c4){utils[_0xbf03('0x1')](util[_0xbf03('0x2')](_0xbf03('0x3'),_0x2f66c4[_0xbf03('0x4')]===_0xbf03('0x5')?_0x2f66c4[_0xbf03('0x6')]:_0x2f66c4[_0xbf03('0x7')],_0x2f66c4['type']));utils[_0xbf03('0x8')](_0xbf03('0x9'),_0x2f66c4);}exports['blinds']={};exports[_0xbf03('0xa')]=function(_0x283dd3){try{utils['debug'](util['format'](_0xbf03('0xb'),_0x283dd3[_0xbf03('0x7')]),_0x283dd3);utils['info'](util[_0xbf03('0x2')](_0xbf03('0xc'),_0x283dd3[_0xbf03('0x7')],_0x283dd3[_0xbf03('0xd')],_0x283dd3['transferercalleridname'],_0x283dd3[_0xbf03('0xe')],_0x283dd3['transfereecalleridname']));_0x283dd3['type']=_0xbf03('0xf');exports[_0xbf03('0x10')][_0x283dd3[_0xbf03('0x11')]]=_0x283dd3;writeDB(_0x283dd3);}catch(_0x23ce1c){utils['error'](util['format'](_0xbf03('0xb'),_0x283dd3[_0xbf03('0x7')]),_0x23ce1c);}};exports[_0xbf03('0x12')]=function(_0x5dcfa1){try{utils['debug'](util['format'](_0xbf03('0x13'),_0x5dcfa1['origtransfereruniqueid']),_0x5dcfa1);utils[_0xbf03('0x1')](util[_0xbf03('0x2')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x5dcfa1['origtransfereruniqueid'],_0x5dcfa1[_0xbf03('0x14')],_0x5dcfa1[_0xbf03('0x15')],_0x5dcfa1['transfertargetcalleridnum'],_0x5dcfa1[_0xbf03('0x16')]));_0x5dcfa1=_[_0xbf03('0x17')](_0x5dcfa1,{'transfererchannel':_0x5dcfa1[_0xbf03('0x18')],'transferercalleridnum':_0x5dcfa1[_0xbf03('0x14')],'transferercalleridname':_0x5dcfa1[_0xbf03('0x15')],'transfererconnectedlinenum':_0x5dcfa1['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5dcfa1[_0xbf03('0x19')],'transfereraccountcode':_0x5dcfa1[_0xbf03('0x1a')],'transferercontext':_0x5dcfa1['secondtransferercontext'],'transfererexten':_0x5dcfa1['secondtransfererexten'],'transfererlinkedid':_0x5dcfa1[_0xbf03('0x1b')],'context':_0x5dcfa1[_0xbf03('0x1c')],'extension':_0x5dcfa1[_0xbf03('0x1d')],'type':_0xbf03('0x5')});if(_[_0xbf03('0x1e')](_0x5dcfa1['transfereechannel'])){_0x5dcfa1=_[_0xbf03('0x17')](_0x5dcfa1,{'transfereechannel':_0x5dcfa1[_0xbf03('0x1f')],'transfereecalleridnum':_0x5dcfa1[_0xbf03('0x20')],'transfereecalleridname':_0x5dcfa1['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5dcfa1[_0xbf03('0x21')],'transfereeconnectedlinename':_0x5dcfa1[_0xbf03('0x22')],'transfereeaccountcode':_0x5dcfa1[_0xbf03('0x23')],'transfereecontext':_0x5dcfa1[_0xbf03('0x24')],'transfereeexten':_0x5dcfa1[_0xbf03('0x25')],'transfereelinkedid':_0x5dcfa1['transfertargetlinkedid']});}writeDB(_0x5dcfa1);}catch(_0x30e0c3){utils['error'](util[_0xbf03('0x2')](_0xbf03('0x13'),_0x5dcfa1[_0xbf03('0x6')]),_0x30e0c3);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 59610ca..b6b9890 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 _0x6889=['info','debug','inspect','request','catch','GetUser','internal','interface','then','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','error','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','seconds','subtractTime','subtract','format','diffTime','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','../../config/logger'];(function(_0x2ad3de,_0x5eb5c2){var _0x3e8ba2=function(_0x228458){while(--_0x228458){_0x2ad3de['push'](_0x2ad3de['shift']());}};_0x3e8ba2(++_0x5eb5c2);}(_0x6889,0x114));var _0x9688=function(_0x22f7aa,_0x5c01d8){_0x22f7aa=_0x22f7aa-0x0;var _0x9f6274=_0x6889[_0x22f7aa];return _0x9f6274;};'use strict';var BPromise=require(_0x9688('0x0'));var jayson=require(_0x9688('0x1'));var moment=require(_0x9688('0x2'));var util=require(_0x9688('0x3'));var client=jayson[_0x9688('0x4')]['http']({'port':0x2329});var logger=require(_0x9688('0x5'))('xdr');exports['info']=function(_0x36070d,_0x293b45){logger[_0x9688('0x6')](_0x36070d,_0x293b45?util['inspect'](_0x293b45,{'showHidden':![],'depth':null}):'');};exports[_0x9688('0x7')]=function(_0x2b8881,_0x340fe0){logger['debug'](_0x2b8881,_0x340fe0?util[_0x9688('0x8')](_0x340fe0,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x5428eb,_0x4567ac){logger['error'](_0x5428eb,_0x4567ac?util['inspect'](_0x4567ac,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x3171ed,_0x396ab2){return client[_0x9688('0x9')](_0x3171ed,{'body':_0x396ab2})['then'](function(_0x123c50){logger['debug']('[utils][request]\x20name:%s',_0x3171ed,_0x123c50?util['inspect'](_0x123c50,{'showHidden':![],'depth':null}):'');})[_0x9688('0xa')](function(_0x31017a){logger['error']('[utils][request]\x20name:%s',_0x3171ed,_0x31017a?util[_0x9688('0x8')](_0x31017a,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1aa35b){return client[_0x9688('0x9')](_0x9688('0xb'),{'options':{'raw':!![],'attributes':['id',_0x9688('0xc'),'name',_0x9688('0xd')],'where':_0x1aa35b,'limit':0x1}})[_0x9688('0xe')](function(_0x2daabc){logger[_0x9688('0x7')](_0x9688('0xf'),JSON[_0x9688('0x10')](_0x1aa35b),_0x2daabc?util[_0x9688('0x8')](_0x2daabc,{'showHidden':![],'depth':null}):'');return _0x2daabc[_0x9688('0x11')][_0x9688('0x12')]?_0x2daabc[_0x9688('0x11')][0x0]:null;});}exports[_0x9688('0x13')]=function(_0x20a0f5){return new BPromise(function(_0x51fe0e,_0x1fa88b){if(_0x20a0f5){return getUser({'internal':_0x20a0f5})[_0x9688('0xe')](function(_0x3f3f76){logger[_0x9688('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x20a0f5,_0x3f3f76?_0x9688('0x14'):_0x9688('0x15'));return _0x51fe0e(_0x3f3f76);})['catch'](function(_0x24b3da){logger['error']('[utils][getUserByInternal]',_0x24b3da?util[_0x9688('0x8')](_0x24b3da,{'showHidden':![],'depth':null}):'');return _0x51fe0e(null);});}return _0x51fe0e(null);});};exports[_0x9688('0x16')]=function(_0x5b3adc){return new BPromise(function(_0x146729,_0x56ac53){if(_0x5b3adc){return getUser({'interface':_0x5b3adc})[_0x9688('0xe')](function(_0x477a58){logger['info'](_0x9688('0x17'),_0x5b3adc,_0x477a58?_0x9688('0x14'):_0x9688('0x15'));return _0x146729(_0x477a58);})[_0x9688('0xa')](function(_0xb250da){logger[_0x9688('0x18')](_0x9688('0x19'),_0xb250da?util[_0x9688('0x8')](_0xb250da,{'showHidden':![],'depth':null}):'');return _0x146729(null);});}return _0x146729(null);});};exports['getUserByName']=function(_0x6471c){return new BPromise(function(_0x283fd5,_0x430341){if(_0x6471c){return getUser({'name':_0x6471c})[_0x9688('0xe')](function(_0x4ff594){logger['info'](_0x9688('0x1a'),_0x6471c,_0x4ff594?_0x9688('0x14'):_0x9688('0x15'));return _0x283fd5(_0x4ff594);})[_0x9688('0xa')](function(_0x1e645c){logger[_0x9688('0x18')](_0x9688('0x1b'),_0x1e645c?util[_0x9688('0x8')](_0x1e645c,{'showHidden':![],'depth':null}):'');return _0x283fd5(null);});}return _0x283fd5(null);});};exports[_0x9688('0x1c')]=function(_0x2be019){return new BPromise(function(_0x54f5c3,_0x338caa){if(_0x2be019){return client[_0x9688('0x9')](_0x9688('0x1d'),{'options':{'raw':!![],'attributes':['id',_0x9688('0x1e'),_0x9688('0x1f'),_0x9688('0x20'),_0x9688('0x21')],'where':{'name':_0x2be019},'limit':0x1}})['then'](function(_0x4a8168){logger['debug'](_0x9688('0x22'),_0x2be019,_0x4a8168?util[_0x9688('0x8')](_0x4a8168,{'showHidden':![],'depth':null}):'');logger['info'](_0x9688('0x23'),_0x2be019,_0x4a8168?_0x9688('0x14'):_0x9688('0x15'));return _0x54f5c3(_0x4a8168[_0x9688('0x11')]['length']?_0x4a8168[_0x9688('0x11')][0x0]:null);})[_0x9688('0xa')](function(_0x49725e){logger[_0x9688('0x18')](_0x9688('0x24'),_0x49725e?util[_0x9688('0x8')](_0x49725e,{'showHidden':![],'depth':null}):'');return _0x54f5c3(null);});}return _0x54f5c3(null);});};exports[_0x9688('0x25')]=function(_0x1249a9,_0x4bb748){return moment(_0x1249a9)['add'](_0x4bb748,_0x9688('0x26'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x9688('0x27')]=function(_0xea231e,_0x2c262f){return moment(_0xea231e)[_0x9688('0x28')](_0x2c262f,_0x9688('0x26'))[_0x9688('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x9688('0x2a')]=function(_0x51dbf4,_0x32f573){return moment(_0x51dbf4)[_0x9688('0x2b')](moment(_0x32f573),_0x9688('0x26'));};exports[_0x9688('0x2c')]=function(_0xb01f17,_0x2f583f){return parseInt(_0xb01f17,0xa)+parseInt(_0x2f583f,0xa);};exports['now']=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x9688('0x2d')]=function(_0x481a6a,_0xac2cfd){if(_0xac2cfd){return moment(_0x481a6a)[_0x9688('0x2d')](_0xac2cfd);}return!![];};exports[_0x9688('0x2e')]=function(_0x26814c,_0x379691){if(_0x379691){return moment(_0x26814c)[_0x9688('0x2e')](_0x379691);}else if(_0x26814c){return!![];}return![];}; \ No newline at end of file +var _0xf796=['subtractTime','seconds','diffTime','now','isAfter','isBefore','bluebird','jayson/promise','util','client','http','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','then','[utils][getUser]\x20where:%s','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','result','[utils][getVoiceQueueByName]','addTime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x56ba92,_0xb3c986){var _0x8fe94d=function(_0x23b21c){while(--_0x23b21c){_0x56ba92['push'](_0x56ba92['shift']());}};_0x8fe94d(++_0xb3c986);}(_0xf796,0x19b));var _0x6f79=function(_0xe114fa,_0x5b58f8){_0xe114fa=_0xe114fa-0x0;var _0x277d69=_0xf796[_0xe114fa];return _0x277d69;};'use strict';var BPromise=require(_0x6f79('0x0'));var jayson=require(_0x6f79('0x1'));var moment=require('moment');var util=require(_0x6f79('0x2'));var client=jayson[_0x6f79('0x3')][_0x6f79('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x6f79('0x5'));exports['info']=function(_0x2aaca7,_0x207258){logger[_0x6f79('0x6')](_0x2aaca7,_0x207258?util[_0x6f79('0x7')](_0x207258,{'showHidden':![],'depth':null}):'');};exports[_0x6f79('0x8')]=function(_0xf7675d,_0xaf4591){logger[_0x6f79('0x8')](_0xf7675d,_0xaf4591?util[_0x6f79('0x7')](_0xaf4591,{'showHidden':![],'depth':null}):'');};exports[_0x6f79('0x9')]=function(_0x399234,_0x373e3c){logger[_0x6f79('0x9')](_0x399234,_0x373e3c?util['inspect'](_0x373e3c,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x52de8d,_0x342024){return client[_0x6f79('0xa')](_0x52de8d,{'body':_0x342024})['then'](function(_0x51514b){logger[_0x6f79('0x8')](_0x6f79('0xb'),_0x52de8d,_0x51514b?util[_0x6f79('0x7')](_0x51514b,{'showHidden':![],'depth':null}):'');})[_0x6f79('0xc')](function(_0x8fd241){logger[_0x6f79('0x9')](_0x6f79('0xb'),_0x52de8d,_0x8fd241?util[_0x6f79('0x7')](_0x8fd241,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4ae16f){return client[_0x6f79('0xa')](_0x6f79('0xd'),{'options':{'raw':!![],'attributes':['id',_0x6f79('0xe'),_0x6f79('0xf'),'interface'],'where':_0x4ae16f,'limit':0x1}})[_0x6f79('0x10')](function(_0x5c43d0){logger['debug'](_0x6f79('0x11'),JSON['stringify'](_0x4ae16f),_0x5c43d0?util[_0x6f79('0x7')](_0x5c43d0,{'showHidden':![],'depth':null}):'');return _0x5c43d0['result'][_0x6f79('0x12')]?_0x5c43d0['result'][0x0]:null;});}exports[_0x6f79('0x13')]=function(_0x1458cd){return new BPromise(function(_0x24a3a9,_0x342fbe){if(_0x1458cd){return getUser({'internal':_0x1458cd})['then'](function(_0x218661){logger['info'](_0x6f79('0x14'),_0x1458cd,_0x218661?_0x6f79('0x15'):'notfound');return _0x24a3a9(_0x218661);})[_0x6f79('0xc')](function(_0x49c2b1){logger[_0x6f79('0x9')](_0x6f79('0x16'),_0x49c2b1?util[_0x6f79('0x7')](_0x49c2b1,{'showHidden':![],'depth':null}):'');return _0x24a3a9(null);});}return _0x24a3a9(null);});};exports[_0x6f79('0x17')]=function(_0x173a60){return new BPromise(function(_0x39772f,_0x4cfaef){if(_0x173a60){return getUser({'interface':_0x173a60})[_0x6f79('0x10')](function(_0x126814){logger[_0x6f79('0x6')](_0x6f79('0x18'),_0x173a60,_0x126814?_0x6f79('0x15'):_0x6f79('0x19'));return _0x39772f(_0x126814);})[_0x6f79('0xc')](function(_0x1cb5b2){logger[_0x6f79('0x9')]('[utils][getUserByInterface]',_0x1cb5b2?util[_0x6f79('0x7')](_0x1cb5b2,{'showHidden':![],'depth':null}):'');return _0x39772f(null);});}return _0x39772f(null);});};exports[_0x6f79('0x1a')]=function(_0x51aad2){return new BPromise(function(_0x5057b9,_0x1f5dd0){if(_0x51aad2){return getUser({'name':_0x51aad2})[_0x6f79('0x10')](function(_0x299489){logger[_0x6f79('0x6')](_0x6f79('0x1b'),_0x51aad2,_0x299489?_0x6f79('0x15'):_0x6f79('0x19'));return _0x5057b9(_0x299489);})['catch'](function(_0x1242f2){logger[_0x6f79('0x9')]('[utils][getUserByName]',_0x1242f2?util[_0x6f79('0x7')](_0x1242f2,{'showHidden':![],'depth':null}):'');return _0x5057b9(null);});}return _0x5057b9(null);});};exports[_0x6f79('0x1c')]=function(_0x106590){return new BPromise(function(_0x6771bf,_0x5d7675){if(_0x106590){return client[_0x6f79('0xa')](_0x6f79('0x1d'),{'options':{'raw':!![],'attributes':['id',_0x6f79('0xf'),_0x6f79('0x1e'),_0x6f79('0x1f'),_0x6f79('0x20')],'where':{'name':_0x106590},'limit':0x1}})['then'](function(_0x4d8941){logger[_0x6f79('0x8')](_0x6f79('0x21'),_0x106590,_0x4d8941?util[_0x6f79('0x7')](_0x4d8941,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x106590,_0x4d8941?_0x6f79('0x15'):_0x6f79('0x19'));return _0x6771bf(_0x4d8941['result'][_0x6f79('0x12')]?_0x4d8941[_0x6f79('0x22')][0x0]:null);})['catch'](function(_0xe80b7f){logger[_0x6f79('0x9')](_0x6f79('0x23'),_0xe80b7f?util[_0x6f79('0x7')](_0xe80b7f,{'showHidden':![],'depth':null}):'');return _0x6771bf(null);});}return _0x6771bf(null);});};exports[_0x6f79('0x24')]=function(_0x4b4b79,_0x2b9997){return moment(_0x4b4b79)['add'](_0x2b9997,'seconds')[_0x6f79('0x25')](_0x6f79('0x26'));};exports[_0x6f79('0x27')]=function(_0x878c28,_0x2a4809){return moment(_0x878c28)['subtract'](_0x2a4809,_0x6f79('0x28'))[_0x6f79('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x6f79('0x29')]=function(_0x26c25d,_0x49601e){return moment(_0x26c25d)['diff'](moment(_0x49601e),_0x6f79('0x28'));};exports['sumTime']=function(_0x223331,_0x4ac510){return parseInt(_0x223331,0xa)+parseInt(_0x4ac510,0xa);};exports[_0x6f79('0x2a')]=function(){return moment()['format'](_0x6f79('0x26'));};exports['isAfter']=function(_0x261f28,_0x5a2a3e){if(_0x5a2a3e){return moment(_0x261f28)[_0x6f79('0x2b')](_0x5a2a3e);}return!![];};exports['isBefore']=function(_0x5f2c77,_0x4bcdaa){if(_0x4bcdaa){return moment(_0x5f2c77)[_0x6f79('0x2c')](_0x4bcdaa);}else if(_0x5f2c77){return!![];}return![];}; \ No newline at end of file